From: Andrea Amorese Date: Fri, 5 Nov 2021 13:49:12 +0000 (+0100) Subject: Built motion from commit c0cddcae.|2.5.37 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22%7B%7Blicense.mail?a=commitdiff_plain;h=a839d313084389c44144250e79e477d1278ac8eb;p=motion2.git Built motion from commit c0cddcae.|2.5.37 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 44e1814..4f3af23 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-05T13:29:56.970Z", + "time": "2021-11-05T13:40:46.278Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 7e98970..a6c7747 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-05T13:29:56.970Z", + "time": "2021-11-05T13:40:46.278Z", "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 621726e..60b1508 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 _0xcd9e=['browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','contactManager','integration','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[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'];(function(_0x2eea9a,_0x368daf){var _0x1ec61e=function(_0x1fc2fc){while(--_0x1fc2fc){_0x2eea9a['push'](_0x2eea9a['shift']());}};_0x1ec61e(++_0x368daf);}(_0xcd9e,0x6e));var _0xecd9=function(_0x3d4555,_0x32b1e6){_0x3d4555=_0x3d4555-0x0;var _0x12e5e5=_0xcd9e[_0x3d4555];return _0x12e5e5;};'use strict';var Sequelize=require(_0xecd9('0x0'));module[_0xecd9('0x1')]={'name':{'type':Sequelize[_0xecd9('0x2')],'get':function(_0x45376d){return this[_0xecd9('0x3')](_0xecd9('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xecd9('0x5'),_0xecd9('0x6'),'motionbar',_0xecd9('0x7'),_0xecd9('0x8'),_0xecd9('0x9'),_0xecd9('0xa'),_0xecd9('0xb')]],'msg':_0xecd9('0xc')}},'comment':_0xecd9('0xc')},'data1':{'type':Sequelize[_0xecd9('0xd')](0x1000),'comment':_0xecd9('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xecd9('0xd')](0x1000),'comment':_0xecd9('0xf')},'data4':{'type':Sequelize[_0xecd9('0xd')](0x1000),'comments':_0xecd9('0x10')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':_0xecd9('0x11')}}; \ No newline at end of file +var _0xa454=['jscripty','urlForward','browser','bot','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)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','action','STRING','contactManager','motionbar'];(function(_0x19e44b,_0x561072){var _0x2efaa7=function(_0x3be7c5){while(--_0x3be7c5){_0x19e44b['push'](_0x19e44b['shift']());}};_0x2efaa7(++_0x561072);}(_0xa454,0xa3));var _0x4a45=function(_0x23cbde,_0x3579b2){_0x23cbde=_0x23cbde-0x0;var _0x1cc6b5=_0xa454[_0x23cbde];return _0x1cc6b5;};'use strict';var Sequelize=require(_0x4a45('0x0'));module[_0x4a45('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5e8d23){return this[_0x4a45('0x2')](_0x4a45('0x3'));}},'action':{'type':Sequelize[_0x4a45('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x4a45('0x5'),'integration',_0x4a45('0x6'),_0x4a45('0x7'),_0x4a45('0x8'),_0x4a45('0x9'),_0x4a45('0xa'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x4a45('0x4')](0x1000),'comment':_0x4a45('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x4a45('0x4')](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':_0x4a45('0xc')},'data5':{'type':Sequelize[_0x4a45('0x4')](0x1000),'comments':_0x4a45('0xd')},'data6':{'type':Sequelize[_0x4a45('0x4')],'comments':_0x4a45('0xe')},'data7':{'type':Sequelize[_0x4a45('0xf')],'comments':_0x4a45('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index db0607b..83162e6 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 _0xf8a0=['count','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','body','Action','find','catch','params','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0xf8a0,0x17b));var _0x0f8a=function(_0x2eb47c,_0x43bdf3){_0x2eb47c=_0x2eb47c-0x0;var _0x13097b=_0xf8a0[_0x2eb47c];return _0x13097b;};'use strict';var emlformat=require(_0x0f8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f8a('0x1'));var jsonpatch=require(_0x0f8a('0x2'));var rp=require('request-promise');var moment=require(_0x0f8a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0f8a('0x4'));var util=require('util');var path=require(_0x0f8a('0x5'));var sox=require(_0x0f8a('0x6'));var csv=require(_0x0f8a('0x7'));var ejs=require(_0x0f8a('0x8'));var fs=require('fs');var fs_extra=require(_0x0f8a('0x9'));var _=require('lodash');var squel=require(_0x0f8a('0xa'));var crypto=require(_0x0f8a('0xb'));var jsforce=require(_0x0f8a('0xc'));var deskjs=require(_0x0f8a('0xd'));var toCsv=require(_0x0f8a('0x7'));var querystring=require(_0x0f8a('0xe'));var Papa=require(_0x0f8a('0xf'));var Redis=require('ioredis');var authService=require(_0x0f8a('0x10'));var qs=require(_0x0f8a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f8a('0x12'));var logger=require('../../config/logger')(_0x0f8a('0x13'));var utils=require('../../config/utils');var config=require(_0x0f8a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0f8a('0x15'))['db'];function respondWithStatusCode(_0xa6a4ac,_0x5575d6){_0x5575d6=_0x5575d6||0xcc;return function(_0x3d2e28){if(_0x3d2e28){return _0xa6a4ac[_0x0f8a('0x16')](_0x5575d6);}return _0xa6a4ac[_0x0f8a('0x17')](_0x5575d6)['end']();};}function respondWithResult(_0x53d3f6,_0xaf3d21){_0xaf3d21=_0xaf3d21||0xc8;return function(_0x9dc67){if(_0x9dc67){return _0x53d3f6[_0x0f8a('0x17')](_0xaf3d21)['json'](_0x9dc67);}};}function respondWithFilteredResult(_0x11a192,_0x3560b0){return function(_0x12fb51){if(_0x12fb51){var _0x2b85ce=typeof _0x3560b0[_0x0f8a('0x18')]===_0x0f8a('0x19')&&typeof _0x3560b0['limit']===_0x0f8a('0x19');var _0x58caf2=_0x12fb51[_0x0f8a('0x1a')];var _0x1db1e5=_0x2b85ce?0x0:_0x3560b0['offset'];var _0x51fa31=_0x2b85ce?_0x12fb51[_0x0f8a('0x1a')]:_0x3560b0['offset']+_0x3560b0[_0x0f8a('0x1b')];var _0x4b5e0b;if(_0x51fa31>=_0x58caf2){_0x51fa31=_0x58caf2;_0x4b5e0b=0xc8;}else{_0x4b5e0b=0xce;}_0x11a192[_0x0f8a('0x17')](_0x4b5e0b);return _0x11a192[_0x0f8a('0x1c')]('Content-Range',_0x1db1e5+'-'+_0x51fa31+'/'+_0x58caf2)['json'](_0x12fb51);}return null;};}function patchUpdates(_0x3eaa78){return function(_0x53daee){try{jsonpatch[_0x0f8a('0x1d')](_0x53daee,_0x3eaa78,!![]);}catch(_0x5f0b34){return BPromise[_0x0f8a('0x1e')](_0x5f0b34);}return _0x53daee[_0x0f8a('0x1f')]();};}function saveUpdates(_0x5a54fc,_0x4ad4a1){return function(_0x3b6259){if(_0x3b6259){return _0x3b6259[_0x0f8a('0x20')](_0x5a54fc)[_0x0f8a('0x21')](function(_0x2e6aac){return _0x2e6aac;});}return null;};}function removeEntity(_0x583c25,_0x3a97cb){return function(_0xbb543){if(_0xbb543){return _0xbb543[_0x0f8a('0x22')]()[_0x0f8a('0x21')](function(){_0x583c25[_0x0f8a('0x17')](0xcc)[_0x0f8a('0x23')]();});}};}function handleEntityNotFound(_0x3a544f,_0x3a21c0){return function(_0xc01ee9){if(!_0xc01ee9){_0x3a544f[_0x0f8a('0x16')](0x194);}return _0xc01ee9;};}function handleError(_0x908df3,_0x485f8a){_0x485f8a=_0x485f8a||0x1f4;return function(_0x4cf116){logger[_0x0f8a('0x24')](_0x4cf116[_0x0f8a('0x25')]);if(_0x4cf116[_0x0f8a('0x26')]){delete _0x4cf116[_0x0f8a('0x26')];}_0x908df3[_0x0f8a('0x17')](_0x485f8a)[_0x0f8a('0x27')](_0x4cf116);};}exports[_0x0f8a('0x20')]=function(_0x5ab245,_0x3f3873){if(_0x5ab245[_0x0f8a('0x28')]['id']){delete _0x5ab245['body']['id'];}return db[_0x0f8a('0x29')][_0x0f8a('0x2a')]({'where':{'id':_0x5ab245['params']['id']}})['then'](handleEntityNotFound(_0x3f3873,null))[_0x0f8a('0x21')](saveUpdates(_0x5ab245['body'],null))[_0x0f8a('0x21')](respondWithResult(_0x3f3873,null))[_0x0f8a('0x2b')](handleError(_0x3f3873,null));};exports[_0x0f8a('0x22')]=function(_0x113726,_0xd3d7bb){return db[_0x0f8a('0x29')][_0x0f8a('0x2a')]({'where':{'id':_0x113726[_0x0f8a('0x2c')]['id']}})['then'](handleEntityNotFound(_0xd3d7bb,null))[_0x0f8a('0x21')](removeEntity(_0xd3d7bb,null))['catch'](handleError(_0xd3d7bb,null));}; \ No newline at end of file +var _0x212a=['reject','save','update','then','error','name','send','body','Action','params','catch','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x26779f,_0x552286){var _0x2c943d=function(_0x5c947f){while(--_0x5c947f){_0x26779f['push'](_0x26779f['shift']());}};_0x2c943d(++_0x552286);}(_0x212a,0x1a1));var _0xa212=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x212a[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xa212('0x0'));var rimraf=require(_0xa212('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa212('0x2'));var rp=require(_0xa212('0x3'));var moment=require('moment');var BPromise=require(_0xa212('0x4'));var Mustache=require(_0xa212('0x5'));var util=require(_0xa212('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa212('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa212('0x8'));var _=require(_0xa212('0x9'));var squel=require(_0xa212('0xa'));var crypto=require('crypto');var jsforce=require(_0xa212('0xb'));var deskjs=require(_0xa212('0xc'));var toCsv=require(_0xa212('0x7'));var querystring=require('querystring');var Papa=require(_0xa212('0xd'));var Redis=require(_0xa212('0xe'));var authService=require(_0xa212('0xf'));var qs=require(_0xa212('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa212('0x11'))('api');var utils=require(_0xa212('0x12'));var config=require(_0xa212('0x13'));var licenseUtil=require(_0xa212('0x14'));var db=require(_0xa212('0x15'))['db'];function respondWithStatusCode(_0x377c98,_0x572416){_0x572416=_0x572416||0xcc;return function(_0xf77f2){if(_0xf77f2){return _0x377c98[_0xa212('0x16')](_0x572416);}return _0x377c98[_0xa212('0x17')](_0x572416)[_0xa212('0x18')]();};}function respondWithResult(_0x36bb54,_0x159756){_0x159756=_0x159756||0xc8;return function(_0x279cb0){if(_0x279cb0){return _0x36bb54['status'](_0x159756)[_0xa212('0x19')](_0x279cb0);}};}function respondWithFilteredResult(_0x3d1933,_0xa3ae3d){return function(_0x3f79d4){if(_0x3f79d4){var _0x381caf=typeof _0xa3ae3d['offset']===_0xa212('0x1a')&&typeof _0xa3ae3d[_0xa212('0x1b')]===_0xa212('0x1a');var _0x43c9f8=_0x3f79d4[_0xa212('0x1c')];var _0x39bffc=_0x381caf?0x0:_0xa3ae3d[_0xa212('0x1d')];var _0x1b48e9=_0x381caf?_0x3f79d4[_0xa212('0x1c')]:_0xa3ae3d[_0xa212('0x1d')]+_0xa3ae3d['limit'];var _0x5641f;if(_0x1b48e9>=_0x43c9f8){_0x1b48e9=_0x43c9f8;_0x5641f=0xc8;}else{_0x5641f=0xce;}_0x3d1933[_0xa212('0x17')](_0x5641f);return _0x3d1933[_0xa212('0x1e')](_0xa212('0x1f'),_0x39bffc+'-'+_0x1b48e9+'/'+_0x43c9f8)[_0xa212('0x19')](_0x3f79d4);}return null;};}function patchUpdates(_0x47429b){return function(_0x15b58c){try{jsonpatch[_0xa212('0x20')](_0x15b58c,_0x47429b,!![]);}catch(_0x283fd1){return BPromise[_0xa212('0x21')](_0x283fd1);}return _0x15b58c[_0xa212('0x22')]();};}function saveUpdates(_0x5dc542,_0x16d92f){return function(_0x508911){if(_0x508911){return _0x508911[_0xa212('0x23')](_0x5dc542)[_0xa212('0x24')](function(_0x476115){return _0x476115;});}return null;};}function removeEntity(_0x3d739d,_0x578ed6){return function(_0x18c240){if(_0x18c240){return _0x18c240['destroy']()[_0xa212('0x24')](function(){_0x3d739d[_0xa212('0x17')](0xcc)[_0xa212('0x18')]();});}};}function handleEntityNotFound(_0x448f39,_0x9ca609){return function(_0x9bf3fe){if(!_0x9bf3fe){_0x448f39[_0xa212('0x16')](0x194);}return _0x9bf3fe;};}function handleError(_0x512a23,_0x2914d6){_0x2914d6=_0x2914d6||0x1f4;return function(_0x248f48){logger[_0xa212('0x25')](_0x248f48['stack']);if(_0x248f48[_0xa212('0x26')]){delete _0x248f48[_0xa212('0x26')];}_0x512a23[_0xa212('0x17')](_0x2914d6)[_0xa212('0x27')](_0x248f48);};}exports['update']=function(_0x38847b,_0x173bad){if(_0x38847b[_0xa212('0x28')]['id']){delete _0x38847b[_0xa212('0x28')]['id'];}return db[_0xa212('0x29')]['find']({'where':{'id':_0x38847b[_0xa212('0x2a')]['id']}})[_0xa212('0x24')](handleEntityNotFound(_0x173bad,null))[_0xa212('0x24')](saveUpdates(_0x38847b[_0xa212('0x28')],null))['then'](respondWithResult(_0x173bad,null))[_0xa212('0x2b')](handleError(_0x173bad,null));};exports['destroy']=function(_0xcba841,_0x4c285e){return db[_0xa212('0x29')][_0xa212('0x2c')]({'where':{'id':_0xcba841['params']['id']}})['then'](handleEntityNotFound(_0x4c285e,null))['then'](removeEntity(_0x4c285e,null))['catch'](handleError(_0x4c285e,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index a95a40d..9c1dc4e 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 _0x6856=['moment','bluebird','rimraf','../../config/environment','exports','define','Action','tools_actions','util','api'];(function(_0x47b381,_0x38cb74){var _0x1ee2c9=function(_0x566123){while(--_0x566123){_0x47b381['push'](_0x47b381['shift']());}};_0x1ee2c9(++_0x38cb74);}(_0x6856,0x13e));var _0x6685=function(_0x343e6d,_0x5cbea0){_0x343e6d=_0x343e6d-0x0;var _0xf2ea5b=_0x6856[_0x343e6d];return _0xf2ea5b;};'use strict';var _=require('lodash');var util=require(_0x6685('0x0'));var logger=require('../../config/logger')(_0x6685('0x1'));var moment=require(_0x6685('0x2'));var BPromise=require(_0x6685('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6685('0x4'));var config=require(_0x6685('0x5'));var attributes=require('./action.attributes');module[_0x6685('0x6')]=function(_0x5e9152,_0x2162dd){return _0x5e9152[_0x6685('0x7')](_0x6685('0x8'),attributes,{'tableName':_0x6685('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8452=['lodash','../../config/logger','api','bluebird','path','rimraf','exports','define','Action','tools_actions'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8452,0x154));var _0x2845=function(_0x236209,_0x51b840){_0x236209=_0x236209-0x0;var _0x2afd5b=_0x8452[_0x236209];return _0x2afd5b;};'use strict';var _=require(_0x2845('0x0'));var util=require('util');var logger=require(_0x2845('0x1'))(_0x2845('0x2'));var moment=require('moment');var BPromise=require(_0x2845('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2845('0x4'));var rimraf=require(_0x2845('0x5'));var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0x2845('0x6')]=function(_0x3e8494,_0x2fa9ed){return _0x3e8494[_0x2845('0x7')](_0x2845('0x8'),attributes,{'tableName':_0x2845('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 68539de..5407bcc 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4853a9,_0x506436){_0x4853a9=_0x4853a9-0x0;var _0x2294c7=_0x1cb9[_0x4853a9];return _0x2294c7;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ 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(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xf494,0x1c6));var _0x4f49=function(_0x1de023,_0x17334d){_0x1de023=_0x1de023-0x0;var _0x1b25ff=_0xf494[_0x1de023];return _0x1b25ff;};'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 3149bc5..1a0a715 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 _0x4561=['../../config/environment','./action.controller','put','/:id','update','delete','isAuthenticated','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4561,0x125));var _0x1456=function(_0x3dabc0,_0x1c0f3e){_0x3dabc0=_0x3dabc0-0x0;var _0x5a3550=_0x4561[_0x3dabc0];return _0x5a3550;};'use strict';var multer=require(_0x1456('0x0'));var util=require(_0x1456('0x1'));var path=require('path');var timeout=require(_0x1456('0x2'));var express=require('express');var router=express[_0x1456('0x3')]();var fs_extra=require(_0x1456('0x4'));var auth=require(_0x1456('0x5'));var interaction=require(_0x1456('0x6'));var config=require(_0x1456('0x7'));var controller=require(_0x1456('0x8'));router[_0x1456('0x9')](_0x1456('0xa'),auth['isAuthenticated'](),controller[_0x1456('0xb')]);router[_0x1456('0xc')](_0x1456('0xa'),auth[_0x1456('0xd')](),controller[_0x1456('0xe')]);module['exports']=router; \ No newline at end of file +var _0xac59=['update','delete','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./action.controller','/:id'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xac59,0x17e));var _0x9ac5=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xac59[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x9ac5('0x0'));var util=require(_0x9ac5('0x1'));var path=require(_0x9ac5('0x2'));var timeout=require(_0x9ac5('0x3'));var express=require(_0x9ac5('0x4'));var router=express[_0x9ac5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9ac5('0x6'));var interaction=require(_0x9ac5('0x7'));var config=require('../../config/environment');var controller=require(_0x9ac5('0x8'));router['put'](_0x9ac5('0x9'),auth['isAuthenticated'](),controller[_0x9ac5('0xa')]);router[_0x9ac5('0xb')]('/:id',auth[_0x9ac5('0xc')](),controller['destroy']);module[_0x9ac5('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 28508d4..96e616e 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 _0x9c5a=['exports','STRING','TEXT','sequelize'];(function(_0x1f7f1d,_0x401d09){var _0x44c5d2=function(_0x3c8e46){while(--_0x3c8e46){_0x1f7f1d['push'](_0x1f7f1d['shift']());}};_0x44c5d2(++_0x401d09);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x24d438,_0x2054a5){_0x24d438=_0x24d438-0x0;var _0x149d29=_0x9c5a[_0x24d438];return _0x149d29;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa9c5('0x2')]},'parent':{'type':Sequelize[_0xa9c5('0x2')]},'table':{'type':Sequelize[_0xa9c5('0x2')]},'conditions':{'type':Sequelize[_0xa9c5('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xbd51=['sequelize','STRING'];(function(_0xac1d19,_0x447fa8){var _0x1133e0=function(_0x44a661){while(--_0x44a661){_0xac1d19['push'](_0xac1d19['shift']());}};_0x1133e0(++_0x447fa8);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3e542d,_0x30face){_0x3e542d=_0x3e542d-0x0;var _0x5b385b=_0xbd51[_0x3e542d];return _0x5b385b;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bd5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1bd5('0x1')]},'parent':{'type':Sequelize[_0x1bd5('0x1')]},'table':{'type':Sequelize[_0x1bd5('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index bd1f376..2bd89be 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 _0x39bc=['CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%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)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','QueryTypes','AVG(%s)','HOUR(%s)','Sequelize','ValidationErrorItem','select','output','web','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','savename','countTable','COUNT(*)','sequelize','SELECT','runReport','MAX(%s)','ROUND(%s)','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','where','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','autoAssociation'];(function(_0x45ce90,_0x114609){var _0x313c45=function(_0x55102a){while(--_0x55102a){_0x45ce90['push'](_0x45ce90['shift']());}};_0x313c45(++_0x114609);}(_0x39bc,0xf8));var _0xc39b=function(_0x2aefec,_0x44aafd){_0x2aefec=_0x2aefec-0x0;var _0x533057=_0x39bc[_0x2aefec];return _0x533057;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc39b('0x0'));var zipdir=require(_0xc39b('0x1'));var jsonpatch=require(_0xc39b('0x2'));var rp=require(_0xc39b('0x3'));var moment=require(_0xc39b('0x4'));var BPromise=require(_0xc39b('0x5'));var Mustache=require(_0xc39b('0x6'));var util=require('util');var path=require(_0xc39b('0x7'));var sox=require(_0xc39b('0x8'));var csv=require('to-csv');var ejs=require(_0xc39b('0x9'));var fs=require('fs');var fs_extra=require(_0xc39b('0xa'));var _=require(_0xc39b('0xb'));var squel=require(_0xc39b('0xc'));var crypto=require(_0xc39b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc39b('0xe'));var Papa=require(_0xc39b('0xf'));var Redis=require(_0xc39b('0x10'));var authService=require(_0xc39b('0x11'));var qs=require(_0xc39b('0x12'));var as=require(_0xc39b('0x13'));var hardwareService=require(_0xc39b('0x14'));var logger=require(_0xc39b('0x15'))(_0xc39b('0x16'));var utils=require(_0xc39b('0x17'));var config=require(_0xc39b('0x18'));var licenseUtil=require(_0xc39b('0x19'));var db=require(_0xc39b('0x1a'))['db'];var dbH=require(_0xc39b('0x1a'))[_0xc39b('0x1b')];function respondWithStatusCode(_0x6a991a,_0x4cd0ea){_0x4cd0ea=_0x4cd0ea||0xcc;return function(_0x2b608b){if(_0x2b608b){return _0x6a991a[_0xc39b('0x1c')](_0x4cd0ea);}return _0x6a991a[_0xc39b('0x1d')](_0x4cd0ea)[_0xc39b('0x1e')]();};}function respondWithResult(_0x56daa4,_0x1518ad){_0x1518ad=_0x1518ad||0xc8;return function(_0x4042fb){if(_0x4042fb){return _0x56daa4[_0xc39b('0x1d')](_0x1518ad)[_0xc39b('0x1f')](_0x4042fb);}};}function respondWithFilteredResult(_0x481672,_0x15c592){return function(_0x4f5455){if(_0x4f5455){var _0x3e7400=typeof _0x15c592[_0xc39b('0x20')]===_0xc39b('0x21')&&typeof _0x15c592['limit']===_0xc39b('0x21');var _0x3da9b8=_0x4f5455[_0xc39b('0x22')];var _0x30958a=_0x3e7400?0x0:_0x15c592[_0xc39b('0x20')];var _0x224b28=_0x3e7400?_0x4f5455[_0xc39b('0x22')]:_0x15c592[_0xc39b('0x20')]+_0x15c592[_0xc39b('0x23')];var _0x42483f;if(_0x224b28>=_0x3da9b8){_0x224b28=_0x3da9b8;_0x42483f=0xc8;}else{_0x42483f=0xce;}_0x481672[_0xc39b('0x1d')](_0x42483f);return _0x481672[_0xc39b('0x24')](_0xc39b('0x25'),_0x30958a+'-'+_0x224b28+'/'+_0x3da9b8)['json'](_0x4f5455);}return null;};}function patchUpdates(_0x10c266){return function(_0xfc8494){try{jsonpatch[_0xc39b('0x26')](_0xfc8494,_0x10c266,!![]);}catch(_0x20a7a6){return BPromise[_0xc39b('0x27')](_0x20a7a6);}return _0xfc8494[_0xc39b('0x28')]();};}function saveUpdates(_0x50b748,_0x39d059){return function(_0x459e9a){if(_0x459e9a){return _0x459e9a[_0xc39b('0x29')](_0x50b748)[_0xc39b('0x2a')](function(_0x407f44){return _0x407f44;});}return null;};}function removeEntity(_0x3d2f59,_0x5d6d2f){return function(_0x3e6989){if(_0x3e6989){return _0x3e6989[_0xc39b('0x2b')]()[_0xc39b('0x2a')](function(){var _0x4a7fe8=_0x3e6989[_0xc39b('0x2c')]({'plain':!![]});var _0x11f55e='CustomReports';return db[_0xc39b('0x2d')][_0xc39b('0x2b')]({'where':{'type':_0x11f55e,'resourceId':_0x4a7fe8['id']}})[_0xc39b('0x2a')](function(){return _0x3e6989;});})[_0xc39b('0x2a')](function(){_0x3d2f59[_0xc39b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4065ce,_0x24d3a8){return function(_0x2b5940){if(!_0x2b5940){_0x4065ce[_0xc39b('0x1c')](0x194);}return _0x2b5940;};}function handleError(_0x4889fa,_0x5bb88c){_0x5bb88c=_0x5bb88c||0x1f4;return function(_0xae7d10){logger[_0xc39b('0x2e')](_0xae7d10[_0xc39b('0x2f')]);if(_0xae7d10[_0xc39b('0x30')]){delete _0xae7d10[_0xc39b('0x30')];}_0x4889fa[_0xc39b('0x1d')](_0x5bb88c)['send'](_0xae7d10);};}exports[_0xc39b('0x31')]=function(_0x4a4231,_0x1c2580){var _0x238771={},_0xa0e7f1={},_0xcd336={'count':0x0,'rows':[]};var _0x22b2e6=_[_0xc39b('0x32')](db[_0xc39b('0x33')][_0xc39b('0x34')],function(_0x2b4b7c){return{'name':_0x2b4b7c[_0xc39b('0x35')],'type':_0x2b4b7c[_0xc39b('0x36')][_0xc39b('0x37')]};});_0xa0e7f1[_0xc39b('0x38')]=_['map'](_0x22b2e6,_0xc39b('0x30'));_0xa0e7f1[_0xc39b('0x39')]=_[_0xc39b('0x3a')](_0x4a4231['query']);_0xa0e7f1[_0xc39b('0x3b')]=_['intersection'](_0xa0e7f1[_0xc39b('0x38')],_0xa0e7f1['query']);_0x238771[_0xc39b('0x3c')]=_[_0xc39b('0x3d')](_0xa0e7f1[_0xc39b('0x38')],qs['fields'](_0x4a4231[_0xc39b('0x39')][_0xc39b('0x3e')]));_0x238771['attributes']=_0x238771[_0xc39b('0x3c')][_0xc39b('0x3f')]?_0x238771[_0xc39b('0x3c')]:_0xa0e7f1[_0xc39b('0x38')];if(!_0x4a4231['query']['hasOwnProperty'](_0xc39b('0x40'))){_0x238771[_0xc39b('0x23')]=qs[_0xc39b('0x23')](_0x4a4231['query'][_0xc39b('0x23')]);_0x238771[_0xc39b('0x20')]=qs[_0xc39b('0x20')](_0x4a4231['query'][_0xc39b('0x20')]);}_0x238771[_0xc39b('0x41')]=qs[_0xc39b('0x42')](_0x4a4231[_0xc39b('0x39')][_0xc39b('0x42')]);_0x238771['where']=qs[_0xc39b('0x3b')](_['pick'](_0x4a4231['query'],_0xa0e7f1[_0xc39b('0x3b')]),_0x22b2e6);if(_0x4a4231[_0xc39b('0x39')][_0xc39b('0x43')]){_0x238771[_0xc39b('0x44')]=_[_0xc39b('0x45')](_0x238771[_0xc39b('0x44')],{'$or':_[_0xc39b('0x32')](_0x22b2e6,function(_0x443eb8){if(_0x443eb8[_0xc39b('0x36')]!=='VIRTUAL'){var _0x19088d={};_0x19088d[_0x443eb8[_0xc39b('0x30')]]={'$like':'%'+_0x4a4231[_0xc39b('0x39')][_0xc39b('0x43')]+'%'};return _0x19088d;}})});}_0x238771=_['merge']({},_0x238771,_0x4a4231[_0xc39b('0x46')]);var _0x536f9={'where':_0x238771[_0xc39b('0x44')]};return db[_0xc39b('0x33')][_0xc39b('0x22')](_0x536f9)[_0xc39b('0x2a')](function(_0x388444){_0xcd336[_0xc39b('0x22')]=_0x388444;if(_0x4a4231[_0xc39b('0x39')]['includeAll']){_0x238771[_0xc39b('0x47')]=[{'all':!![]}];}return db[_0xc39b('0x33')][_0xc39b('0x48')](_0x238771);})[_0xc39b('0x2a')](function(_0x2050c9){_0xcd336['rows']=_0x2050c9;return _0xcd336;})[_0xc39b('0x2a')](respondWithFilteredResult(_0x1c2580,_0x238771))[_0xc39b('0x49')](handleError(_0x1c2580,null));};exports[_0xc39b('0x4a')]=function(_0x1cf902,_0x2a2111){var _0xdc9a7d={'raw':![],'where':{'id':_0x1cf902[_0xc39b('0x4b')]['id']}},_0x12d4d9={};_0x12d4d9[_0xc39b('0x38')]=_['keys'](db[_0xc39b('0x33')]['rawAttributes']);_0x12d4d9['query']=_['keys'](_0x1cf902[_0xc39b('0x39')]);_0x12d4d9[_0xc39b('0x3b')]=_[_0xc39b('0x3d')](_0x12d4d9['model'],_0x12d4d9[_0xc39b('0x39')]);_0xdc9a7d[_0xc39b('0x3c')]=_[_0xc39b('0x3d')](_0x12d4d9[_0xc39b('0x38')],qs[_0xc39b('0x3e')](_0x1cf902[_0xc39b('0x39')][_0xc39b('0x3e')]));_0xdc9a7d[_0xc39b('0x3c')]=_0xdc9a7d[_0xc39b('0x3c')][_0xc39b('0x3f')]?_0xdc9a7d[_0xc39b('0x3c')]:_0x12d4d9[_0xc39b('0x38')];if(_0x1cf902[_0xc39b('0x39')][_0xc39b('0x4c')]){_0xdc9a7d[_0xc39b('0x47')]=[{'all':!![]}];}_0xdc9a7d=_[_0xc39b('0x45')]({},_0xdc9a7d,_0x1cf902[_0xc39b('0x46')]);return db[_0xc39b('0x33')][_0xc39b('0x4d')](_0xdc9a7d)['then'](handleEntityNotFound(_0x2a2111,null))['then'](respondWithResult(_0x2a2111,null))[_0xc39b('0x49')](handleError(_0x2a2111,null));};exports[_0xc39b('0x4e')]=function(_0x328270,_0x2db38f){return db[_0xc39b('0x33')][_0xc39b('0x4e')](_0x328270[_0xc39b('0x4f')],{})[_0xc39b('0x2a')](function(_0x5f0474){var _0xfc1f86=_0x328270['user'][_0xc39b('0x2c')]({'plain':!![]});if(!_0xfc1f86)throw new Error(_0xc39b('0x50'));if(_0xfc1f86[_0xc39b('0x51')]===_0xc39b('0x52')){var _0xb3a3f=_0x5f0474[_0xc39b('0x2c')]({'plain':!![]});var _0x57d8a8=_0xc39b('0x53');return db['UserProfileSection'][_0xc39b('0x4d')]({'where':{'name':_0x57d8a8,'userProfileId':_0xfc1f86[_0xc39b('0x54')]},'raw':!![]})[_0xc39b('0x2a')](function(_0x69026c){if(_0x69026c&&_0x69026c[_0xc39b('0x55')]===0x0){return db[_0xc39b('0x2d')][_0xc39b('0x4e')]({'name':_0xb3a3f[_0xc39b('0x30')],'resourceId':_0xb3a3f['id'],'type':_0xc39b('0x56'),'sectionId':_0x69026c['id']},{})[_0xc39b('0x2a')](function(){return _0x5f0474;});}else{return _0x5f0474;}})[_0xc39b('0x49')](function(_0x513872){logger[_0xc39b('0x2e')](_0xc39b('0x57'),_0x513872);throw _0x513872;});}return _0x5f0474;})['then'](respondWithResult(_0x2db38f,0xc9))['catch'](handleError(_0x2db38f,null));};exports[_0xc39b('0x29')]=function(_0x35bcdd,_0x4e905d){if(_0x35bcdd[_0xc39b('0x4f')]['id']){delete _0x35bcdd[_0xc39b('0x4f')]['id'];}return db['AnalyticCustomReport'][_0xc39b('0x4d')]({'where':{'id':_0x35bcdd[_0xc39b('0x4b')]['id']}})[_0xc39b('0x2a')](handleEntityNotFound(_0x4e905d,null))[_0xc39b('0x2a')](saveUpdates(_0x35bcdd[_0xc39b('0x4f')],null))[_0xc39b('0x2a')](respondWithResult(_0x4e905d,null))[_0xc39b('0x49')](handleError(_0x4e905d,null));};exports[_0xc39b('0x2b')]=function(_0x2aa155,_0x369171){return db['AnalyticCustomReport']['find']({'where':{'id':_0x2aa155[_0xc39b('0x4b')]['id']}})[_0xc39b('0x2a')](handleEntityNotFound(_0x369171,null))[_0xc39b('0x2a')](removeEntity(_0x369171,null))['catch'](handleError(_0x369171,null));};exports[_0xc39b('0x58')]=function(_0x24d72c,_0x55465){var _0x4d3bd2=0xa;var _0x2e65d2=[_0xc39b('0x59'),_0xc39b('0x5a'),_0xc39b('0x5b'),_0xc39b('0x5c')];var _0x4fc03d={'SUM':_0xc39b('0x5d'),'COUNT':_0xc39b('0x5e'),'COUNT DISTINCT':_0xc39b('0x5f'),'MAX':'MAX(%s)','MIN':_0xc39b('0x60'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xc39b('0x61'),'GROUP_CONCAT ASC':_0xc39b('0x62'),'GROUP_CONCAT DESC':_0xc39b('0x63')};var _0x26772c={'SEC_TO_TIME':_0xc39b('0x64'),'DATE':_0xc39b('0x65'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc39b('0x66')};var _0x500513=function(_0x143dd0){return!_['includes']([_0xc39b('0x67'),_0xc39b('0x68'),_0xc39b('0x69'),_0xc39b('0x6a')],_0x143dd0);};var _0x14f664=function(_0x433ced){if(!_0x433ced||!_0x433ced[_0xc39b('0x6b')]['length']){return'';}for(var _0x377f2a='(',_0x4a0e5b=0x0;_0x4a0e5b<_0x433ced[_0xc39b('0x6b')][_0xc39b('0x3f')];_0x4a0e5b+=0x1){_0x4a0e5b>0x0&&(_0x377f2a+='\x20'+_0x433ced[_0xc39b('0x6c')]+'\x20');_0x377f2a+=_0x433ced[_0xc39b('0x6b')][_0x4a0e5b][_0xc39b('0x6d')]?_0x14f664(_0x433ced[_0xc39b('0x6b')][_0x4a0e5b][_0xc39b('0x6d')]):_0x433ced[_0xc39b('0x6b')][_0x4a0e5b][_0xc39b('0x6e')]+'\x20'+_0x433ced[_0xc39b('0x6b')][_0x4a0e5b][_0xc39b('0x6f')]+(_0x500513(_0x433ced[_0xc39b('0x6b')][_0x4a0e5b][_0xc39b('0x6f')])?'\x20'+_0x433ced['rules'][_0x4a0e5b][_0xc39b('0x70')]:'');}return _0x377f2a+')';};var _0x226e19={'where':{'id':_0x24d72c[_0xc39b('0x4b')]['id']}},_0x5f22ce,_0xfb0f45,_0xe92990,_0x2ed2e3,_0x33a346;_0x226e19=_[_0xc39b('0x45')]({},_0x226e19,_0x24d72c[_0xc39b('0x46')]);return db[_0xc39b('0x33')][_0xc39b('0x4d')](_0x226e19)[_0xc39b('0x2a')](function(_0x26401a){if(_0x26401a){_0x5f22ce=_0x26401a;return _0x26401a[_0xc39b('0x71')]();}return null;})[_0xc39b('0x2a')](function(_0xf8506c){if(_0xf8506c){if(!_0xf8506c[_0xc39b('0x3f')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc39b('0x72'),0x193);}_0xfb0f45=_0xf8506c;return db[_0xc39b('0x73')][_0xc39b('0x48')]({'raw':!![]});}return null;})['then'](function(_0x103928){if(_0x103928){_0xe92990=_[_0xc39b('0x74')](_0x103928,'id');var _0x3aea8c;var _0x116faa=squel['select']();_0x116faa[_0xc39b('0x75')](_0x5f22ce[_0xc39b('0x76')]);for(var _0xb5782f=0x0;_0xb5782f<_0xfb0f45[_0xc39b('0x3f')];_0xb5782f+=0x1){_0x3aea8c=_0xfb0f45[_0xb5782f][_0xc39b('0x77')]?_0xe92990[_0xfb0f45[_0xb5782f][_0xc39b('0x77')]][_0xc39b('0x78')]:_0xfb0f45[_0xb5782f]['field'];_0x3aea8c=_0xfb0f45[_0xb5782f][_0xc39b('0x79')]?_[_0xc39b('0x7a')](_0x4fc03d[_0xfb0f45[_0xb5782f][_0xc39b('0x79')]],'%s',_0x3aea8c):_0x3aea8c;_0x3aea8c=_0xfb0f45[_0xb5782f][_0xc39b('0x7b')]?_[_0xc39b('0x7a')](_0x26772c[_0xfb0f45[_0xb5782f][_0xc39b('0x7b')]],'%s',_0x3aea8c):_0x3aea8c;if(_0xfb0f45[_0xb5782f][_0xc39b('0x7c')]){_0x116faa[_0xc39b('0x6d')](_0x3aea8c);}_0xfb0f45[_0xb5782f][_0xc39b('0x7d')]&&_0x116faa['order'](_0x3aea8c,_0xfb0f45[_0xb5782f]['orderBy']===_0xc39b('0x7e')?![]:!![]);_0x116faa[_0xc39b('0x6e')](_0x3aea8c,_0xfb0f45[_0xb5782f][_0xc39b('0x7f')]||_0x3aea8c);}if(_0x5f22ce[_0xc39b('0x80')]){_0x5f22ce['joins']=JSON[_0xc39b('0x81')](_0x5f22ce[_0xc39b('0x80')]);for(var _0x34a0c7=0x0;_0x34a0c7<_0x5f22ce[_0xc39b('0x80')][_0xc39b('0x3f')];_0x34a0c7+=0x1){if(_0x5f22ce[_0xc39b('0x80')][_0x34a0c7]['type']&&_[_0xc39b('0x82')](_0x2e65d2,_0x5f22ce[_0xc39b('0x80')][_0x34a0c7][_0xc39b('0x36')])&&_0x5f22ce['joins'][_0x34a0c7][_0xc39b('0x83')]&&_0x5f22ce[_0xc39b('0x80')][_0x34a0c7][_0xc39b('0x84')]&&_0x5f22ce['joins'][_0x34a0c7][_0xc39b('0x85')]){_0x116faa[_0x5f22ce['joins'][_0x34a0c7][_0xc39b('0x36')]](_0x5f22ce[_0xc39b('0x80')][_0x34a0c7]['foreignTable'],null,util['format'](_0xc39b('0x86'),_0x5f22ce['table'],_0x5f22ce[_0xc39b('0x80')][_0x34a0c7][_0xc39b('0x83')],_0x5f22ce[_0xc39b('0x80')][_0x34a0c7]['foreignTable'],_0x5f22ce[_0xc39b('0x80')][_0x34a0c7][_0xc39b('0x85')]));}}}if(_0x5f22ce[_0xc39b('0x87')]){_0x5f22ce[_0xc39b('0x87')]=JSON[_0xc39b('0x81')](_0x5f22ce[_0xc39b('0x87')]);_0x116faa[_0xc39b('0x44')](_0x14f664(_0x5f22ce[_0xc39b('0x87')]['group']));}_0x33a346=_0x116faa[_0xc39b('0x88')]();_0x116faa[_0xc39b('0x23')](_0x4d3bd2);_0x116faa[_0xc39b('0x20')](0x0);logger[_0xc39b('0x89')](_0xc39b('0x8a'),_0x116faa[_0xc39b('0x8b')]());return dbH['sequelize'][_0xc39b('0x39')](_0x116faa['toString'](),{'type':dbH['sequelize'][_0xc39b('0x8c')]['SELECT']});}})[_0xc39b('0x2a')](respondWithResult(_0x55465,null))[_0xc39b('0x49')](handleError(_0x55465,null));};function runReport(_0x373bd8,_0x152efe,_0x4c7231){var _0x4be968=_0x152efe[_0xc39b('0x30')];var _0x5adf8c=0xa;var _0x2eaf76=[_0xc39b('0x59'),_0xc39b('0x5a'),_0xc39b('0x5b'),_0xc39b('0x5c')];var _0xa1eb20={'SUM':_0xc39b('0x5d'),'COUNT':_0xc39b('0x5e'),'COUNT DISTINCT':_0xc39b('0x5f'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xc39b('0x8d'),'GROUP_CONCAT':_0xc39b('0x61'),'GROUP_CONCAT ASC':_0xc39b('0x62'),'GROUP_CONCAT DESC':_0xc39b('0x63')};var _0x23dc14={'SEC_TO_TIME':_0xc39b('0x64'),'DATE':'DATE(%s)','HOUR':_0xc39b('0x8e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc39b('0x66')};var _0x44fb35=function(_0x2d6e93){return!_[_0xc39b('0x82')]([_0xc39b('0x67'),_0xc39b('0x68'),_0xc39b('0x69'),_0xc39b('0x6a')],_0x2d6e93);};var _0x32f141=function(_0x4546f2){if(!_0x4546f2||!_0x4546f2['rules'][_0xc39b('0x3f')]){return'';}for(var _0x45ae8f='(',_0x34575a=0x0;_0x34575a<_0x4546f2[_0xc39b('0x6b')][_0xc39b('0x3f')];_0x34575a+=0x1){_0x34575a>0x0&&(_0x45ae8f+='\x20'+_0x4546f2[_0xc39b('0x6c')]+'\x20');_0x45ae8f+=_0x4546f2[_0xc39b('0x6b')][_0x34575a][_0xc39b('0x6d')]?_0x32f141(_0x4546f2[_0xc39b('0x6b')][_0x34575a][_0xc39b('0x6d')]):_0x4546f2[_0xc39b('0x6b')][_0x34575a][_0xc39b('0x6e')]+'\x20'+_0x4546f2[_0xc39b('0x6b')][_0x34575a]['condition']+(_0x44fb35(_0x4546f2['rules'][_0x34575a][_0xc39b('0x6f')])?'\x20'+_0x4546f2[_0xc39b('0x6b')][_0x34575a][_0xc39b('0x70')]:'');}return _0x45ae8f+')';};var _0x5ef6cd={'where':{'id':_0x373bd8['id']}},_0x350732,_0x5e84c8,_0x1a3a24,_0x85ea37,_0x3d3d98;_0x5ef6cd=_['merge']({},_0x5ef6cd,_0x4c7231);return db[_0xc39b('0x33')][_0xc39b('0x4d')](_0x5ef6cd)['then'](function(_0x3b4e4d){if(_0x3b4e4d){_0x350732=_0x3b4e4d;return _0x3b4e4d[_0xc39b('0x71')]();}return null;})[_0xc39b('0x2a')](function(_0x10dc29){if(_0x10dc29){if(!_0x10dc29[_0xc39b('0x3f')]){throw new db[(_0xc39b('0x8f'))][(_0xc39b('0x90'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5e84c8=_0x10dc29;return db['AnalyticMetric'][_0xc39b('0x48')]({'raw':!![]});}return null;})[_0xc39b('0x2a')](function(_0x59aa1b){if(_0x59aa1b){_0x1a3a24=_[_0xc39b('0x74')](_0x59aa1b,'id');var _0x6adf95;var _0x584424=squel[_0xc39b('0x91')]();_0x584424[_0xc39b('0x75')](_0x350732[_0xc39b('0x76')]);for(var _0x1f7000=0x0;_0x1f7000<_0x5e84c8[_0xc39b('0x3f')];_0x1f7000+=0x1){_0x6adf95=_0x5e84c8[_0x1f7000][_0xc39b('0x77')]?_0x1a3a24[_0x5e84c8[_0x1f7000]['MetricId']][_0xc39b('0x78')]:_0x5e84c8[_0x1f7000][_0xc39b('0x6e')];_0x6adf95=_0x5e84c8[_0x1f7000]['function']?_[_0xc39b('0x7a')](_0xa1eb20[_0x5e84c8[_0x1f7000][_0xc39b('0x79')]],'%s',_0x6adf95):_0x6adf95;_0x6adf95=_0x5e84c8[_0x1f7000][_0xc39b('0x7b')]?_[_0xc39b('0x7a')](_0x23dc14[_0x5e84c8[_0x1f7000]['format']],'%s',_0x6adf95):_0x6adf95;if(_0x5e84c8[_0x1f7000][_0xc39b('0x7c')]){_0x584424[_0xc39b('0x6d')](_0x6adf95);}_0x5e84c8[_0x1f7000][_0xc39b('0x7d')]&&_0x584424[_0xc39b('0x41')](_0x6adf95,_0x5e84c8[_0x1f7000][_0xc39b('0x7d')]===_0xc39b('0x7e')?![]:!![]);_0x584424[_0xc39b('0x6e')](_0x6adf95,_0x5e84c8[_0x1f7000]['alias']||_0x6adf95);}if(_0x350732['joins']){_0x350732['joins']=JSON[_0xc39b('0x81')](_0x350732[_0xc39b('0x80')]);for(var _0x1929f8=0x0;_0x1929f8<_0x350732['joins'][_0xc39b('0x3f')];_0x1929f8+=0x1){if(_0x350732[_0xc39b('0x80')][_0x1929f8][_0xc39b('0x36')]&&_[_0xc39b('0x82')](_0x2eaf76,_0x350732[_0xc39b('0x80')][_0x1929f8][_0xc39b('0x36')])&&_0x350732['joins'][_0x1929f8][_0xc39b('0x83')]&&_0x350732[_0xc39b('0x80')][_0x1929f8][_0xc39b('0x84')]&&_0x350732[_0xc39b('0x80')][_0x1929f8][_0xc39b('0x85')]){_0x584424[_0x350732[_0xc39b('0x80')][_0x1929f8][_0xc39b('0x36')]](_0x350732[_0xc39b('0x80')][_0x1929f8][_0xc39b('0x84')],null,util['format'](_0xc39b('0x86'),_0x350732[_0xc39b('0x76')],_0x350732['joins'][_0x1929f8][_0xc39b('0x83')],_0x350732[_0xc39b('0x80')][_0x1929f8]['foreignTable'],_0x350732['joins'][_0x1929f8]['foreignKey']));}}}if(_0x350732[_0xc39b('0x87')]){_0x350732['conditions']=JSON[_0xc39b('0x81')](_0x350732['conditions']);_0x584424[_0xc39b('0x44')](_0x32f141(_0x350732[_0xc39b('0x87')][_0xc39b('0x6d')]));}_0x3d3d98=_0x584424[_0xc39b('0x88')]();_0x584424[_0xc39b('0x23')](_0x5adf8c);_0x584424[_0xc39b('0x20')](0x0);return;}})['then'](function(){if(_0x152efe[_0xc39b('0x92')]===_0xc39b('0x93')){return null;}var _0x3afb6d=_[_0xc39b('0x45')](_0x152efe,{'name':_0x152efe['fullPath']||_0x152efe['name']||_0x350732[_0xc39b('0x30')],'basename':_0x4be968,'savename':util['format'](_0xc39b('0x94'),_0x152efe[_0xc39b('0x30')]||_0x350732[_0xc39b('0x30')],require(_0xc39b('0x95'))[_0xc39b('0x96')](0x4),_0x152efe['output']||_0xc39b('0x97')),'reportId':_0x350732['id'],'reportType':_0xc39b('0x98')});return db['AnalyticExtractedReport'][_0xc39b('0x4e')](_0x3afb6d,{'raw':!![]});})[_0xc39b('0x2a')](function(_0xf5ece6){if(_0x350732[_0xc39b('0x76')]===_0xc39b('0x99')){_0x3d3d98['where'](_0x350732[_0xc39b('0x76')]+_0xc39b('0x9a'),_0x152efe[_0xc39b('0x9b')],_0x152efe['endDate']);}else{_0x3d3d98[_0xc39b('0x44')](_0x350732[_0xc39b('0x76')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x152efe[_0xc39b('0x9b')],_0x152efe['endDate']);}if(_0xf5ece6){logger[_0xc39b('0x9c')](_0xc39b('0x9d'),_0x3d3d98['toString']());require(_0xc39b('0x9e'))['fork'](path[_0xc39b('0x59')](__dirname,'../../components/export/',_0xf5ece6[_0xc39b('0x92')]),[_0xf5ece6['id'],_0x3d3d98[_0xc39b('0x8b')](),path[_0xc39b('0x59')](__dirname,'../../files/reports',_0xf5ece6[_0xc39b('0x9f')]),_0x4be968]);return _0xf5ece6;}else{var _0x34013a=squel[_0xc39b('0x91')]();_0x34013a[_0xc39b('0x75')]('('+_0x3d3d98[_0xc39b('0x8b')]()+')',_0xc39b('0xa0'));_0x34013a[_0xc39b('0x6e')](_0xc39b('0xa1'),_0xc39b('0x22'));_0x3d3d98[_0xc39b('0x23')](_0x152efe[_0xc39b('0x23')]||_0x5adf8c);_0x3d3d98[_0xc39b('0x20')](_0x152efe['offset']||0x0);return dbH['sequelize'][_0xc39b('0x39')](_0x34013a[_0xc39b('0x8b')](),{'type':dbH[_0xc39b('0xa2')][_0xc39b('0x8c')]['SELECT']})[_0xc39b('0x2a')](function(_0xf7ddd0){if(!_0xf7ddd0[_0xc39b('0x3f')]){_0x85ea37=0x0;}else{_0x85ea37=_0xf7ddd0[0x0]['count']||0x0;}return dbH['sequelize'][_0xc39b('0x39')](_0x3d3d98[_0xc39b('0x8b')](),{'type':dbH[_0xc39b('0xa2')][_0xc39b('0x8c')][_0xc39b('0xa3')]});})[_0xc39b('0x2a')](function(_0x1994f8){return{'rows':_0x1994f8||[],'count':_0x85ea37};});}});}exports['run']=function(_0x294a46,_0x1c3fa9){return runReport(_0x294a46[_0xc39b('0x4b')],_0x294a46[_0xc39b('0x39')],_0x294a46['options'])[_0xc39b('0x2a')](respondWithResult(_0x1c3fa9,null))[_0xc39b('0x49')](handleError(_0x1c3fa9,null));};exports[_0xc39b('0xa4')]=runReport;exports[_0xc39b('0x39')]=function(_0x2846ad,_0x269d53){var _0x519681=0xa;var _0x2c65a4=[_0xc39b('0x59'),_0xc39b('0x5a'),_0xc39b('0x5b'),_0xc39b('0x5c')];var _0x1df6ae={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc39b('0x5f'),'MAX':_0xc39b('0xa5'),'MIN':_0xc39b('0x60'),'AVG':_0xc39b('0x8d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc39b('0x62'),'GROUP_CONCAT DESC':_0xc39b('0x63')};var _0x4b101d={'SEC_TO_TIME':_0xc39b('0x64'),'DATE':_0xc39b('0x65'),'HOUR':_0xc39b('0x8e'),'ROUND':_0xc39b('0xa6'),'UNIX_TIMESTAMP':_0xc39b('0x66')};var _0x53191d=function(_0x33e912){return!_[_0xc39b('0x82')]([_0xc39b('0x67'),'IS\x20NOT\x20NULL',_0xc39b('0x69'),_0xc39b('0x6a')],_0x33e912);};var _0xd36774=function(_0x5a82f4){if(!_0x5a82f4||!_0x5a82f4[_0xc39b('0x6b')][_0xc39b('0x3f')]){return'';}for(var _0x5dbc54='(',_0x256974=0x0;_0x256974<_0x5a82f4[_0xc39b('0x6b')][_0xc39b('0x3f')];_0x256974+=0x1){_0x256974>0x0&&(_0x5dbc54+='\x20'+_0x5a82f4[_0xc39b('0x6c')]+'\x20');_0x5dbc54+=_0x5a82f4[_0xc39b('0x6b')][_0x256974]['group']?_0xd36774(_0x5a82f4[_0xc39b('0x6b')][_0x256974][_0xc39b('0x6d')]):_0x5a82f4[_0xc39b('0x6b')][_0x256974][_0xc39b('0x6e')]+'\x20'+_0x5a82f4[_0xc39b('0x6b')][_0x256974][_0xc39b('0x6f')]+(_0x53191d(_0x5a82f4[_0xc39b('0x6b')][_0x256974][_0xc39b('0x6f')])?'\x20'+_0x5a82f4[_0xc39b('0x6b')][_0x256974][_0xc39b('0x70')]:'');}return _0x5dbc54+')';};var _0x2eb31f={'where':{'id':_0x2846ad['params']['id']}},_0x5162f1,_0x5b7f87,_0x26d947,_0xff510f,_0x515000;_0x2eb31f=_[_0xc39b('0x45')]({},_0x2eb31f,_0x2846ad['options']);return db[_0xc39b('0x33')]['find'](_0x2eb31f)['then'](function(_0x125e5e){if(_0x125e5e){_0x5162f1=_0x125e5e;return _0x125e5e[_0xc39b('0x71')]();}return null;})[_0xc39b('0x2a')](function(_0x1d13b4){if(_0x1d13b4){if(!_0x1d13b4[_0xc39b('0x3f')]){throw new db[(_0xc39b('0x8f'))][(_0xc39b('0x90'))](_0xc39b('0x72'),0x193);}_0x5b7f87=_0x1d13b4;return db[_0xc39b('0x73')][_0xc39b('0x48')]({'raw':!![]});}return null;})['then'](function(_0xc8b9a7){if(_0xc8b9a7){_0x26d947=_['keyBy'](_0xc8b9a7,'id');var _0x33c003;var _0x5aba9e=squel['select']();_0x5aba9e['from'](_0x5162f1['table']);for(var _0x38ccb7=0x0;_0x38ccb7<_0x5b7f87[_0xc39b('0x3f')];_0x38ccb7+=0x1){_0x33c003=_0x5b7f87[_0x38ccb7]['MetricId']?_0x26d947[_0x5b7f87[_0x38ccb7][_0xc39b('0x77')]][_0xc39b('0x78')]:_0x5b7f87[_0x38ccb7]['field'];_0x33c003=_0x5b7f87[_0x38ccb7][_0xc39b('0x79')]?_['replace'](_0x1df6ae[_0x5b7f87[_0x38ccb7][_0xc39b('0x79')]],'%s',_0x33c003):_0x33c003;_0x33c003=_0x5b7f87[_0x38ccb7]['format']?_[_0xc39b('0x7a')](_0x4b101d[_0x5b7f87[_0x38ccb7][_0xc39b('0x7b')]],'%s',_0x33c003):_0x33c003;if(_0x5b7f87[_0x38ccb7][_0xc39b('0x7c')]){_0x5aba9e[_0xc39b('0x6d')](_0x33c003);}_0x5b7f87[_0x38ccb7][_0xc39b('0x7d')]&&_0x5aba9e[_0xc39b('0x41')](_0x33c003,_0x5b7f87[_0x38ccb7][_0xc39b('0x7d')]==='DESC'?![]:!![]);_0x5aba9e[_0xc39b('0x6e')](_0x33c003,_0x5b7f87[_0x38ccb7][_0xc39b('0x7f')]||_0x33c003);}if(_0x5162f1[_0xc39b('0x80')]){_0x5162f1[_0xc39b('0x80')]=JSON[_0xc39b('0x81')](_0x5162f1[_0xc39b('0x80')]);for(var _0x283fb3=0x0;_0x283fb3<_0x5162f1[_0xc39b('0x80')]['length'];_0x283fb3+=0x1){if(_0x5162f1[_0xc39b('0x80')][_0x283fb3]['type']&&_[_0xc39b('0x82')](_0x2c65a4,_0x5162f1[_0xc39b('0x80')][_0x283fb3][_0xc39b('0x36')])&&_0x5162f1['joins'][_0x283fb3][_0xc39b('0x83')]&&_0x5162f1['joins'][_0x283fb3][_0xc39b('0x84')]&&_0x5162f1[_0xc39b('0x80')][_0x283fb3][_0xc39b('0x85')]){_0x5aba9e[_0x5162f1[_0xc39b('0x80')][_0x283fb3][_0xc39b('0x36')]](_0x5162f1['joins'][_0x283fb3][_0xc39b('0x84')],null,util['format'](_0xc39b('0x86'),_0x5162f1['table'],_0x5162f1[_0xc39b('0x80')][_0x283fb3]['parentKey'],_0x5162f1[_0xc39b('0x80')][_0x283fb3][_0xc39b('0x84')],_0x5162f1[_0xc39b('0x80')][_0x283fb3][_0xc39b('0x85')]));}}}if(_0x5162f1[_0xc39b('0x87')]){_0x5162f1[_0xc39b('0x87')]=JSON[_0xc39b('0x81')](_0x5162f1[_0xc39b('0x87')]);_0x5aba9e['where'](_0xd36774(_0x5162f1['conditions'][_0xc39b('0x6d')]));}_0x515000=_0x5aba9e['clone']();_0x5aba9e['limit'](_0x519681);_0x5aba9e[_0xc39b('0x20')](0x0);logger['debug'](_0xc39b('0x8a'),_0x5aba9e[_0xc39b('0x8b')]());return dbH[_0xc39b('0xa2')][_0xc39b('0x39')](_0x5aba9e['toString'](),{'type':dbH[_0xc39b('0xa2')][_0xc39b('0x8c')][_0xc39b('0xa3')]});}})[_0xc39b('0x2a')](function(){return{'sql':_0x515000['toString']()};})['then'](respondWithResult(_0x269d53,null))[_0xc39b('0x49')](handleError(_0x269d53,null));}; \ No newline at end of file +var _0xc600=['then','destroy','get','CustomReports','UserProfileResource','sendStatus','name','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','include','findAll','rows','catch','intersection','includeAll','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','find','userProfileId','autoAssociation','error','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20EMPTY','rules','operator','group','condition','getFields','ValidationErrorItem','keyBy','select','from','metric','function','format','replace','groupBy','orderBy','order','field','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','MetricId','DESC','output','%s-%s.%s','randomstring','generate','csv','custom','startDate','endDate','child_process','savename','countTable','COUNT(*)','run','runReport','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x319676,_0x1ad06a){var _0x143d3a=function(_0x378871){while(--_0x378871){_0x319676['push'](_0x319676['shift']());}};_0x143d3a(++_0x1ad06a);}(_0xc600,0x11a));var _0x0c60=function(_0x3b5080,_0x10775f){_0x3b5080=_0x3b5080-0x0;var _0x3195ec=_0xc600[_0x3b5080];return _0x3195ec;};'use strict';var emlformat=require(_0x0c60('0x0'));var rimraf=require(_0x0c60('0x1'));var zipdir=require(_0x0c60('0x2'));var jsonpatch=require(_0x0c60('0x3'));var rp=require(_0x0c60('0x4'));var moment=require(_0x0c60('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0c60('0x6'));var util=require(_0x0c60('0x7'));var path=require(_0x0c60('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0c60('0x9'));var fs=require('fs');var fs_extra=require(_0x0c60('0xa'));var _=require('lodash');var squel=require(_0x0c60('0xb'));var crypto=require(_0x0c60('0xc'));var jsforce=require(_0x0c60('0xd'));var deskjs=require(_0x0c60('0xe'));var toCsv=require(_0x0c60('0xf'));var querystring=require(_0x0c60('0x10'));var Papa=require(_0x0c60('0x11'));var Redis=require('ioredis');var authService=require(_0x0c60('0x12'));var qs=require(_0x0c60('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c60('0x14'))(_0x0c60('0x15'));var utils=require(_0x0c60('0x16'));var config=require(_0x0c60('0x17'));var licenseUtil=require(_0x0c60('0x18'));var db=require(_0x0c60('0x19'))['db'];var dbH=require(_0x0c60('0x19'))[_0x0c60('0x1a')];function respondWithStatusCode(_0x581c9e,_0x27327f){_0x27327f=_0x27327f||0xcc;return function(_0x13ce1f){if(_0x13ce1f){return _0x581c9e['sendStatus'](_0x27327f);}return _0x581c9e[_0x0c60('0x1b')](_0x27327f)[_0x0c60('0x1c')]();};}function respondWithResult(_0x3f24dd,_0x7daa6c){_0x7daa6c=_0x7daa6c||0xc8;return function(_0x13cba0){if(_0x13cba0){return _0x3f24dd[_0x0c60('0x1b')](_0x7daa6c)[_0x0c60('0x1d')](_0x13cba0);}};}function respondWithFilteredResult(_0x1f2865,_0x57355d){return function(_0x51a73b){if(_0x51a73b){var _0x3296ae=typeof _0x57355d[_0x0c60('0x1e')]===_0x0c60('0x1f')&&typeof _0x57355d[_0x0c60('0x20')]===_0x0c60('0x1f');var _0x4d3c23=_0x51a73b['count'];var _0x2bd5e8=_0x3296ae?0x0:_0x57355d[_0x0c60('0x1e')];var _0x2135c3=_0x3296ae?_0x51a73b[_0x0c60('0x21')]:_0x57355d[_0x0c60('0x1e')]+_0x57355d[_0x0c60('0x20')];var _0x4bc24;if(_0x2135c3>=_0x4d3c23){_0x2135c3=_0x4d3c23;_0x4bc24=0xc8;}else{_0x4bc24=0xce;}_0x1f2865['status'](_0x4bc24);return _0x1f2865[_0x0c60('0x22')](_0x0c60('0x23'),_0x2bd5e8+'-'+_0x2135c3+'/'+_0x4d3c23)['json'](_0x51a73b);}return null;};}function patchUpdates(_0x594680){return function(_0x581465){try{jsonpatch[_0x0c60('0x24')](_0x581465,_0x594680,!![]);}catch(_0x5346d8){return BPromise[_0x0c60('0x25')](_0x5346d8);}return _0x581465[_0x0c60('0x26')]();};}function saveUpdates(_0x20dca0,_0x3fc885){return function(_0x422439){if(_0x422439){return _0x422439[_0x0c60('0x27')](_0x20dca0)[_0x0c60('0x28')](function(_0x1ffe6c){return _0x1ffe6c;});}return null;};}function removeEntity(_0x25f760,_0xc19b3d){return function(_0xc2de13){if(_0xc2de13){return _0xc2de13[_0x0c60('0x29')]()[_0x0c60('0x28')](function(){var _0x14ffbe=_0xc2de13[_0x0c60('0x2a')]({'plain':!![]});var _0x3bdfa7=_0x0c60('0x2b');return db[_0x0c60('0x2c')][_0x0c60('0x29')]({'where':{'type':_0x3bdfa7,'resourceId':_0x14ffbe['id']}})[_0x0c60('0x28')](function(){return _0xc2de13;});})['then'](function(){_0x25f760[_0x0c60('0x1b')](0xcc)[_0x0c60('0x1c')]();});}};}function handleEntityNotFound(_0x2cdcc4,_0x51255c){return function(_0xd75015){if(!_0xd75015){_0x2cdcc4[_0x0c60('0x2d')](0x194);}return _0xd75015;};}function handleError(_0x2c178c,_0x5b7a08){_0x5b7a08=_0x5b7a08||0x1f4;return function(_0x4ee96e){logger['error'](_0x4ee96e['stack']);if(_0x4ee96e[_0x0c60('0x2e')]){delete _0x4ee96e[_0x0c60('0x2e')];}_0x2c178c[_0x0c60('0x1b')](_0x5b7a08)['send'](_0x4ee96e);};}exports[_0x0c60('0x2f')]=function(_0xeb9130,_0x43eb66){var _0x4c4ed3={},_0x33e527={},_0x5f0415={'count':0x0,'rows':[]};var _0x441e88=_[_0x0c60('0x30')](db[_0x0c60('0x31')][_0x0c60('0x32')],function(_0x1c94bc){return{'name':_0x1c94bc['fieldName'],'type':_0x1c94bc[_0x0c60('0x33')][_0x0c60('0x34')]};});_0x33e527[_0x0c60('0x35')]=_[_0x0c60('0x30')](_0x441e88,_0x0c60('0x2e'));_0x33e527[_0x0c60('0x36')]=_[_0x0c60('0x37')](_0xeb9130['query']);_0x33e527[_0x0c60('0x38')]=_['intersection'](_0x33e527[_0x0c60('0x35')],_0x33e527['query']);_0x4c4ed3[_0x0c60('0x39')]=_['intersection'](_0x33e527[_0x0c60('0x35')],qs['fields'](_0xeb9130['query'][_0x0c60('0x3a')]));_0x4c4ed3[_0x0c60('0x39')]=_0x4c4ed3[_0x0c60('0x39')][_0x0c60('0x3b')]?_0x4c4ed3[_0x0c60('0x39')]:_0x33e527[_0x0c60('0x35')];if(!_0xeb9130[_0x0c60('0x36')][_0x0c60('0x3c')](_0x0c60('0x3d'))){_0x4c4ed3[_0x0c60('0x20')]=qs[_0x0c60('0x20')](_0xeb9130[_0x0c60('0x36')][_0x0c60('0x20')]);_0x4c4ed3[_0x0c60('0x1e')]=qs[_0x0c60('0x1e')](_0xeb9130[_0x0c60('0x36')][_0x0c60('0x1e')]);}_0x4c4ed3['order']=qs[_0x0c60('0x3e')](_0xeb9130[_0x0c60('0x36')][_0x0c60('0x3e')]);_0x4c4ed3['where']=qs['filters'](_['pick'](_0xeb9130['query'],_0x33e527[_0x0c60('0x38')]),_0x441e88);if(_0xeb9130[_0x0c60('0x36')][_0x0c60('0x3f')]){_0x4c4ed3[_0x0c60('0x40')]=_['merge'](_0x4c4ed3[_0x0c60('0x40')],{'$or':_['map'](_0x441e88,function(_0x36ffbd){if(_0x36ffbd[_0x0c60('0x33')]!=='VIRTUAL'){var _0x837f84={};_0x837f84[_0x36ffbd[_0x0c60('0x2e')]]={'$like':'%'+_0xeb9130[_0x0c60('0x36')]['filter']+'%'};return _0x837f84;}})});}_0x4c4ed3=_[_0x0c60('0x41')]({},_0x4c4ed3,_0xeb9130['options']);var _0x6e2db2={'where':_0x4c4ed3[_0x0c60('0x40')]};return db[_0x0c60('0x31')][_0x0c60('0x21')](_0x6e2db2)['then'](function(_0x1af130){_0x5f0415['count']=_0x1af130;if(_0xeb9130[_0x0c60('0x36')]['includeAll']){_0x4c4ed3[_0x0c60('0x42')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x0c60('0x43')](_0x4c4ed3);})['then'](function(_0x1794c1){_0x5f0415[_0x0c60('0x44')]=_0x1794c1;return _0x5f0415;})[_0x0c60('0x28')](respondWithFilteredResult(_0x43eb66,_0x4c4ed3))[_0x0c60('0x45')](handleError(_0x43eb66,null));};exports['show']=function(_0x58ca5c,_0x408761){var _0x546a42={'raw':![],'where':{'id':_0x58ca5c['params']['id']}},_0x1ae0a1={};_0x1ae0a1[_0x0c60('0x35')]=_['keys'](db['AnalyticCustomReport'][_0x0c60('0x32')]);_0x1ae0a1['query']=_[_0x0c60('0x37')](_0x58ca5c[_0x0c60('0x36')]);_0x1ae0a1['filters']=_['intersection'](_0x1ae0a1[_0x0c60('0x35')],_0x1ae0a1[_0x0c60('0x36')]);_0x546a42[_0x0c60('0x39')]=_[_0x0c60('0x46')](_0x1ae0a1[_0x0c60('0x35')],qs['fields'](_0x58ca5c['query']['fields']));_0x546a42[_0x0c60('0x39')]=_0x546a42[_0x0c60('0x39')][_0x0c60('0x3b')]?_0x546a42[_0x0c60('0x39')]:_0x1ae0a1[_0x0c60('0x35')];if(_0x58ca5c[_0x0c60('0x36')][_0x0c60('0x47')]){_0x546a42['include']=[{'all':!![]}];}_0x546a42=_[_0x0c60('0x41')]({},_0x546a42,_0x58ca5c[_0x0c60('0x48')]);return db[_0x0c60('0x31')]['find'](_0x546a42)[_0x0c60('0x28')](handleEntityNotFound(_0x408761,null))['then'](respondWithResult(_0x408761,null))[_0x0c60('0x45')](handleError(_0x408761,null));};exports[_0x0c60('0x49')]=function(_0x18913b,_0x431f98){return db[_0x0c60('0x31')]['create'](_0x18913b[_0x0c60('0x4a')],{})[_0x0c60('0x28')](function(_0x412adb){var _0x1a0bdd=_0x18913b['user'][_0x0c60('0x2a')]({'plain':!![]});if(!_0x1a0bdd)throw new Error(_0x0c60('0x4b'));if(_0x1a0bdd[_0x0c60('0x4c')]===_0x0c60('0x4d')){var _0x51c965=_0x412adb[_0x0c60('0x2a')]({'plain':!![]});var _0x574c8c=_0x0c60('0x4e');return db['UserProfileSection'][_0x0c60('0x4f')]({'where':{'name':_0x574c8c,'userProfileId':_0x1a0bdd[_0x0c60('0x50')]},'raw':!![]})[_0x0c60('0x28')](function(_0x52dfd9){if(_0x52dfd9&&_0x52dfd9[_0x0c60('0x51')]===0x0){return db['UserProfileResource'][_0x0c60('0x49')]({'name':_0x51c965['name'],'resourceId':_0x51c965['id'],'type':_0x0c60('0x2b'),'sectionId':_0x52dfd9['id']},{})['then'](function(){return _0x412adb;});}else{return _0x412adb;}})[_0x0c60('0x45')](function(_0x466f20){logger[_0x0c60('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x466f20);throw _0x466f20;});}return _0x412adb;})[_0x0c60('0x28')](respondWithResult(_0x431f98,0xc9))['catch'](handleError(_0x431f98,null));};exports['update']=function(_0x208f6f,_0xb0b755){if(_0x208f6f[_0x0c60('0x4a')]['id']){delete _0x208f6f[_0x0c60('0x4a')]['id'];}return db[_0x0c60('0x31')][_0x0c60('0x4f')]({'where':{'id':_0x208f6f['params']['id']}})['then'](handleEntityNotFound(_0xb0b755,null))['then'](saveUpdates(_0x208f6f[_0x0c60('0x4a')],null))[_0x0c60('0x28')](respondWithResult(_0xb0b755,null))[_0x0c60('0x45')](handleError(_0xb0b755,null));};exports[_0x0c60('0x29')]=function(_0x1f17b6,_0x41d9de){return db['AnalyticCustomReport']['find']({'where':{'id':_0x1f17b6[_0x0c60('0x53')]['id']}})[_0x0c60('0x28')](handleEntityNotFound(_0x41d9de,null))['then'](removeEntity(_0x41d9de,null))[_0x0c60('0x45')](handleError(_0x41d9de,null));};exports[_0x0c60('0x54')]=function(_0x390b67,_0x56e835){var _0x5657aa=0xa;var _0x29adc4=[_0x0c60('0x55'),_0x0c60('0x56'),_0x0c60('0x57'),_0x0c60('0x58')];var _0x7370b8={'SUM':_0x0c60('0x59'),'COUNT':_0x0c60('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x0c60('0x5b'),'MIN':_0x0c60('0x5c'),'AVG':_0x0c60('0x5d'),'GROUP_CONCAT':_0x0c60('0x5e'),'GROUP_CONCAT ASC':_0x0c60('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1030e5={'SEC_TO_TIME':_0x0c60('0x60'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x0c60('0x61'),'UNIX_TIMESTAMP':_0x0c60('0x62')};var _0x528db2=function(_0x12d505){return!_[_0x0c60('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x0c60('0x64')],_0x12d505);};var _0x3ad905=function(_0x32e136){if(!_0x32e136||!_0x32e136[_0x0c60('0x65')][_0x0c60('0x3b')]){return'';}for(var _0x5527ae='(',_0x583488=0x0;_0x583488<_0x32e136['rules'][_0x0c60('0x3b')];_0x583488+=0x1){_0x583488>0x0&&(_0x5527ae+='\x20'+_0x32e136[_0x0c60('0x66')]+'\x20');_0x5527ae+=_0x32e136[_0x0c60('0x65')][_0x583488][_0x0c60('0x67')]?_0x3ad905(_0x32e136['rules'][_0x583488][_0x0c60('0x67')]):_0x32e136[_0x0c60('0x65')][_0x583488]['field']+'\x20'+_0x32e136[_0x0c60('0x65')][_0x583488][_0x0c60('0x68')]+(_0x528db2(_0x32e136[_0x0c60('0x65')][_0x583488][_0x0c60('0x68')])?'\x20'+_0x32e136['rules'][_0x583488]['value']:'');}return _0x5527ae+')';};var _0x4a2d5a={'where':{'id':_0x390b67[_0x0c60('0x53')]['id']}},_0x376562,_0x13d9ec,_0x26426c,_0x4c6311,_0x276ec;_0x4a2d5a=_[_0x0c60('0x41')]({},_0x4a2d5a,_0x390b67[_0x0c60('0x48')]);return db[_0x0c60('0x31')][_0x0c60('0x4f')](_0x4a2d5a)['then'](function(_0x7dd78f){if(_0x7dd78f){_0x376562=_0x7dd78f;return _0x7dd78f[_0x0c60('0x69')]();}return null;})[_0x0c60('0x28')](function(_0x19bff0){if(_0x19bff0){if(!_0x19bff0[_0x0c60('0x3b')]){throw new db['Sequelize'][(_0x0c60('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x13d9ec=_0x19bff0;return db['AnalyticMetric'][_0x0c60('0x43')]({'raw':!![]});}return null;})[_0x0c60('0x28')](function(_0x23a6ab){if(_0x23a6ab){_0x26426c=_[_0x0c60('0x6b')](_0x23a6ab,'id');var _0x3e5d12;var _0x50655b=squel[_0x0c60('0x6c')]();_0x50655b[_0x0c60('0x6d')](_0x376562['table']);for(var _0x242c44=0x0;_0x242c44<_0x13d9ec[_0x0c60('0x3b')];_0x242c44+=0x1){_0x3e5d12=_0x13d9ec[_0x242c44]['MetricId']?_0x26426c[_0x13d9ec[_0x242c44]['MetricId']][_0x0c60('0x6e')]:_0x13d9ec[_0x242c44]['field'];_0x3e5d12=_0x13d9ec[_0x242c44][_0x0c60('0x6f')]?_['replace'](_0x7370b8[_0x13d9ec[_0x242c44][_0x0c60('0x6f')]],'%s',_0x3e5d12):_0x3e5d12;_0x3e5d12=_0x13d9ec[_0x242c44][_0x0c60('0x70')]?_[_0x0c60('0x71')](_0x1030e5[_0x13d9ec[_0x242c44][_0x0c60('0x70')]],'%s',_0x3e5d12):_0x3e5d12;if(_0x13d9ec[_0x242c44][_0x0c60('0x72')]){_0x50655b[_0x0c60('0x67')](_0x3e5d12);}_0x13d9ec[_0x242c44][_0x0c60('0x73')]&&_0x50655b[_0x0c60('0x74')](_0x3e5d12,_0x13d9ec[_0x242c44][_0x0c60('0x73')]==='DESC'?![]:!![]);_0x50655b[_0x0c60('0x75')](_0x3e5d12,_0x13d9ec[_0x242c44][_0x0c60('0x76')]||_0x3e5d12);}if(_0x376562[_0x0c60('0x77')]){_0x376562['joins']=JSON[_0x0c60('0x78')](_0x376562[_0x0c60('0x77')]);for(var _0x5074e0=0x0;_0x5074e0<_0x376562[_0x0c60('0x77')][_0x0c60('0x3b')];_0x5074e0+=0x1){if(_0x376562['joins'][_0x5074e0][_0x0c60('0x33')]&&_[_0x0c60('0x63')](_0x29adc4,_0x376562['joins'][_0x5074e0][_0x0c60('0x33')])&&_0x376562[_0x0c60('0x77')][_0x5074e0]['parentKey']&&_0x376562[_0x0c60('0x77')][_0x5074e0][_0x0c60('0x79')]&&_0x376562[_0x0c60('0x77')][_0x5074e0][_0x0c60('0x7a')]){_0x50655b[_0x376562['joins'][_0x5074e0][_0x0c60('0x33')]](_0x376562[_0x0c60('0x77')][_0x5074e0][_0x0c60('0x79')],null,util[_0x0c60('0x70')](_0x0c60('0x7b'),_0x376562[_0x0c60('0x7c')],_0x376562[_0x0c60('0x77')][_0x5074e0][_0x0c60('0x7d')],_0x376562[_0x0c60('0x77')][_0x5074e0]['foreignTable'],_0x376562[_0x0c60('0x77')][_0x5074e0][_0x0c60('0x7a')]));}}}if(_0x376562[_0x0c60('0x7e')]){_0x376562[_0x0c60('0x7e')]=JSON[_0x0c60('0x78')](_0x376562['conditions']);_0x50655b[_0x0c60('0x40')](_0x3ad905(_0x376562[_0x0c60('0x7e')]['group']));}_0x276ec=_0x50655b[_0x0c60('0x7f')]();_0x50655b[_0x0c60('0x20')](_0x5657aa);_0x50655b['offset'](0x0);logger[_0x0c60('0x80')]('Limited\x20Query:',_0x50655b[_0x0c60('0x81')]());return dbH['sequelize']['query'](_0x50655b[_0x0c60('0x81')](),{'type':dbH[_0x0c60('0x82')][_0x0c60('0x83')][_0x0c60('0x84')]});}})['then'](respondWithResult(_0x56e835,null))[_0x0c60('0x45')](handleError(_0x56e835,null));};function runReport(_0x15c2b3,_0x7110af,_0x44c5c2){var _0x18797a=_0x7110af[_0x0c60('0x2e')];var _0x128536=0xa;var _0x33ffe7=['join','left_join','right_join','cross_join'];var _0x4c5a80={'SUM':'SUM(%s)','COUNT':_0x0c60('0x5a'),'COUNT DISTINCT':_0x0c60('0x85'),'MAX':_0x0c60('0x5b'),'MIN':_0x0c60('0x5c'),'AVG':_0x0c60('0x5d'),'GROUP_CONCAT':_0x0c60('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0c60('0x86')};var _0x352100={'SEC_TO_TIME':_0x0c60('0x60'),'DATE':_0x0c60('0x87'),'HOUR':_0x0c60('0x88'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0c60('0x62')};var _0x18815a=function(_0x3936eb){return!_[_0x0c60('0x63')]([_0x0c60('0x89'),_0x0c60('0x8a'),_0x0c60('0x8b'),'IS\x20NOT\x20EMPTY'],_0x3936eb);};var _0x384c62=function(_0x547c45){if(!_0x547c45||!_0x547c45[_0x0c60('0x65')][_0x0c60('0x3b')]){return'';}for(var _0x4410d0='(',_0x71d6ed=0x0;_0x71d6ed<_0x547c45['rules'][_0x0c60('0x3b')];_0x71d6ed+=0x1){_0x71d6ed>0x0&&(_0x4410d0+='\x20'+_0x547c45[_0x0c60('0x66')]+'\x20');_0x4410d0+=_0x547c45[_0x0c60('0x65')][_0x71d6ed]['group']?_0x384c62(_0x547c45[_0x0c60('0x65')][_0x71d6ed][_0x0c60('0x67')]):_0x547c45['rules'][_0x71d6ed][_0x0c60('0x75')]+'\x20'+_0x547c45[_0x0c60('0x65')][_0x71d6ed][_0x0c60('0x68')]+(_0x18815a(_0x547c45['rules'][_0x71d6ed]['condition'])?'\x20'+_0x547c45[_0x0c60('0x65')][_0x71d6ed][_0x0c60('0x8c')]:'');}return _0x4410d0+')';};var _0x44cc77={'where':{'id':_0x15c2b3['id']}},_0x427c2f,_0xade455,_0x1b21cc,_0x47d5ab,_0x53b819;_0x44cc77=_['merge']({},_0x44cc77,_0x44c5c2);return db[_0x0c60('0x31')][_0x0c60('0x4f')](_0x44cc77)[_0x0c60('0x28')](function(_0x3465ee){if(_0x3465ee){_0x427c2f=_0x3465ee;return _0x3465ee[_0x0c60('0x69')]();}return null;})[_0x0c60('0x28')](function(_0x5f599c){if(_0x5f599c){if(!_0x5f599c['length']){throw new db[(_0x0c60('0x8d'))]['ValidationErrorItem'](_0x0c60('0x8e'),0x193);}_0xade455=_0x5f599c;return db[_0x0c60('0x8f')][_0x0c60('0x43')]({'raw':!![]});}return null;})[_0x0c60('0x28')](function(_0x947fc6){if(_0x947fc6){_0x1b21cc=_['keyBy'](_0x947fc6,'id');var _0x7e1fba;var _0x54bff8=squel['select']();_0x54bff8[_0x0c60('0x6d')](_0x427c2f['table']);for(var _0x56dc90=0x0;_0x56dc90<_0xade455['length'];_0x56dc90+=0x1){_0x7e1fba=_0xade455[_0x56dc90][_0x0c60('0x90')]?_0x1b21cc[_0xade455[_0x56dc90]['MetricId']]['metric']:_0xade455[_0x56dc90][_0x0c60('0x75')];_0x7e1fba=_0xade455[_0x56dc90][_0x0c60('0x6f')]?_[_0x0c60('0x71')](_0x4c5a80[_0xade455[_0x56dc90][_0x0c60('0x6f')]],'%s',_0x7e1fba):_0x7e1fba;_0x7e1fba=_0xade455[_0x56dc90]['format']?_[_0x0c60('0x71')](_0x352100[_0xade455[_0x56dc90][_0x0c60('0x70')]],'%s',_0x7e1fba):_0x7e1fba;if(_0xade455[_0x56dc90][_0x0c60('0x72')]){_0x54bff8[_0x0c60('0x67')](_0x7e1fba);}_0xade455[_0x56dc90][_0x0c60('0x73')]&&_0x54bff8[_0x0c60('0x74')](_0x7e1fba,_0xade455[_0x56dc90][_0x0c60('0x73')]===_0x0c60('0x91')?![]:!![]);_0x54bff8[_0x0c60('0x75')](_0x7e1fba,_0xade455[_0x56dc90][_0x0c60('0x76')]||_0x7e1fba);}if(_0x427c2f[_0x0c60('0x77')]){_0x427c2f['joins']=JSON[_0x0c60('0x78')](_0x427c2f[_0x0c60('0x77')]);for(var _0xde5e44=0x0;_0xde5e44<_0x427c2f['joins'][_0x0c60('0x3b')];_0xde5e44+=0x1){if(_0x427c2f[_0x0c60('0x77')][_0xde5e44][_0x0c60('0x33')]&&_[_0x0c60('0x63')](_0x33ffe7,_0x427c2f['joins'][_0xde5e44]['type'])&&_0x427c2f[_0x0c60('0x77')][_0xde5e44][_0x0c60('0x7d')]&&_0x427c2f[_0x0c60('0x77')][_0xde5e44][_0x0c60('0x79')]&&_0x427c2f[_0x0c60('0x77')][_0xde5e44][_0x0c60('0x7a')]){_0x54bff8[_0x427c2f['joins'][_0xde5e44][_0x0c60('0x33')]](_0x427c2f[_0x0c60('0x77')][_0xde5e44][_0x0c60('0x79')],null,util['format'](_0x0c60('0x7b'),_0x427c2f[_0x0c60('0x7c')],_0x427c2f[_0x0c60('0x77')][_0xde5e44][_0x0c60('0x7d')],_0x427c2f['joins'][_0xde5e44][_0x0c60('0x79')],_0x427c2f[_0x0c60('0x77')][_0xde5e44][_0x0c60('0x7a')]));}}}if(_0x427c2f[_0x0c60('0x7e')]){_0x427c2f[_0x0c60('0x7e')]=JSON['parse'](_0x427c2f['conditions']);_0x54bff8['where'](_0x384c62(_0x427c2f['conditions'][_0x0c60('0x67')]));}_0x53b819=_0x54bff8[_0x0c60('0x7f')]();_0x54bff8[_0x0c60('0x20')](_0x128536);_0x54bff8[_0x0c60('0x1e')](0x0);return;}})['then'](function(){if(_0x7110af[_0x0c60('0x92')]==='web'){return null;}var _0x17b855=_[_0x0c60('0x41')](_0x7110af,{'name':_0x7110af['fullPath']||_0x7110af[_0x0c60('0x2e')]||_0x427c2f[_0x0c60('0x2e')],'basename':_0x18797a,'savename':util['format'](_0x0c60('0x93'),_0x7110af[_0x0c60('0x2e')]||_0x427c2f[_0x0c60('0x2e')],require(_0x0c60('0x94'))[_0x0c60('0x95')](0x4),_0x7110af[_0x0c60('0x92')]||_0x0c60('0x96')),'reportId':_0x427c2f['id'],'reportType':_0x0c60('0x97')});return db['AnalyticExtractedReport'][_0x0c60('0x49')](_0x17b855,{'raw':!![]});})[_0x0c60('0x28')](function(_0xe30be2){if(_0x427c2f[_0x0c60('0x7c')]==='cdr'){_0x53b819[_0x0c60('0x40')](_0x427c2f[_0x0c60('0x7c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x7110af[_0x0c60('0x98')],_0x7110af[_0x0c60('0x99')]);}else{_0x53b819['where'](_0x427c2f['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x7110af[_0x0c60('0x98')],_0x7110af[_0x0c60('0x99')]);}if(_0xe30be2){logger['info']('Run\x20Query:',_0x53b819[_0x0c60('0x81')]());require(_0x0c60('0x9a'))['fork'](path[_0x0c60('0x55')](__dirname,'../../components/export/',_0xe30be2[_0x0c60('0x92')]),[_0xe30be2['id'],_0x53b819['toString'](),path['join'](__dirname,'../../files/reports',_0xe30be2[_0x0c60('0x9b')]),_0x18797a]);return _0xe30be2;}else{var _0x595860=squel[_0x0c60('0x6c')]();_0x595860[_0x0c60('0x6d')]('('+_0x53b819['toString']()+')',_0x0c60('0x9c'));_0x595860['field'](_0x0c60('0x9d'),_0x0c60('0x21'));_0x53b819[_0x0c60('0x20')](_0x7110af[_0x0c60('0x20')]||_0x128536);_0x53b819['offset'](_0x7110af[_0x0c60('0x1e')]||0x0);return dbH[_0x0c60('0x82')][_0x0c60('0x36')](_0x595860[_0x0c60('0x81')](),{'type':dbH['sequelize'][_0x0c60('0x83')][_0x0c60('0x84')]})[_0x0c60('0x28')](function(_0xb8e400){if(!_0xb8e400['length']){_0x47d5ab=0x0;}else{_0x47d5ab=_0xb8e400[0x0][_0x0c60('0x21')]||0x0;}return dbH[_0x0c60('0x82')][_0x0c60('0x36')](_0x53b819[_0x0c60('0x81')](),{'type':dbH[_0x0c60('0x82')][_0x0c60('0x83')][_0x0c60('0x84')]});})[_0x0c60('0x28')](function(_0x237148){return{'rows':_0x237148||[],'count':_0x47d5ab};});}});}exports[_0x0c60('0x9e')]=function(_0x1fb7e9,_0x505fee){return runReport(_0x1fb7e9[_0x0c60('0x53')],_0x1fb7e9[_0x0c60('0x36')],_0x1fb7e9[_0x0c60('0x48')])['then'](respondWithResult(_0x505fee,null))[_0x0c60('0x45')](handleError(_0x505fee,null));};exports[_0x0c60('0x9f')]=runReport;exports[_0x0c60('0x36')]=function(_0x509181,_0x46dd45){var _0x12e2ed=0xa;var _0x748335=['join',_0x0c60('0x56'),'right_join',_0x0c60('0x58')];var _0x514f65={'SUM':_0x0c60('0x59'),'COUNT':_0x0c60('0x5a'),'COUNT DISTINCT':_0x0c60('0x85'),'MAX':_0x0c60('0x5b'),'MIN':'MIN(%s)','AVG':_0x0c60('0x5d'),'GROUP_CONCAT':_0x0c60('0x5e'),'GROUP_CONCAT ASC':_0x0c60('0x5f'),'GROUP_CONCAT DESC':_0x0c60('0x86')};var _0x5be827={'SEC_TO_TIME':_0x0c60('0x60'),'DATE':_0x0c60('0x87'),'HOUR':_0x0c60('0x88'),'ROUND':_0x0c60('0x61'),'UNIX_TIMESTAMP':_0x0c60('0x62')};var _0x32ba=function(_0x2b711e){return!_[_0x0c60('0x63')](['IS\x20NULL',_0x0c60('0x8a'),_0x0c60('0x8b'),_0x0c60('0x64')],_0x2b711e);};var _0xd15b65=function(_0x3d6972){if(!_0x3d6972||!_0x3d6972[_0x0c60('0x65')][_0x0c60('0x3b')]){return'';}for(var _0x53ba66='(',_0x15b186=0x0;_0x15b186<_0x3d6972[_0x0c60('0x65')][_0x0c60('0x3b')];_0x15b186+=0x1){_0x15b186>0x0&&(_0x53ba66+='\x20'+_0x3d6972[_0x0c60('0x66')]+'\x20');_0x53ba66+=_0x3d6972[_0x0c60('0x65')][_0x15b186][_0x0c60('0x67')]?_0xd15b65(_0x3d6972[_0x0c60('0x65')][_0x15b186][_0x0c60('0x67')]):_0x3d6972[_0x0c60('0x65')][_0x15b186]['field']+'\x20'+_0x3d6972[_0x0c60('0x65')][_0x15b186][_0x0c60('0x68')]+(_0x32ba(_0x3d6972[_0x0c60('0x65')][_0x15b186][_0x0c60('0x68')])?'\x20'+_0x3d6972['rules'][_0x15b186][_0x0c60('0x8c')]:'');}return _0x53ba66+')';};var _0x4275c5={'where':{'id':_0x509181[_0x0c60('0x53')]['id']}},_0xb87c1d,_0x31e2c7,_0x1c0bc7,_0x317ae9,_0x458e9c;_0x4275c5=_['merge']({},_0x4275c5,_0x509181[_0x0c60('0x48')]);return db[_0x0c60('0x31')][_0x0c60('0x4f')](_0x4275c5)[_0x0c60('0x28')](function(_0x9f537a){if(_0x9f537a){_0xb87c1d=_0x9f537a;return _0x9f537a[_0x0c60('0x69')]();}return null;})[_0x0c60('0x28')](function(_0x1beaa2){if(_0x1beaa2){if(!_0x1beaa2[_0x0c60('0x3b')]){throw new db[(_0x0c60('0x8d'))][(_0x0c60('0x6a'))](_0x0c60('0x8e'),0x193);}_0x31e2c7=_0x1beaa2;return db['AnalyticMetric'][_0x0c60('0x43')]({'raw':!![]});}return null;})[_0x0c60('0x28')](function(_0x65962){if(_0x65962){_0x1c0bc7=_[_0x0c60('0x6b')](_0x65962,'id');var _0xb5bde3;var _0x57187f=squel[_0x0c60('0x6c')]();_0x57187f['from'](_0xb87c1d[_0x0c60('0x7c')]);for(var _0x5d3980=0x0;_0x5d3980<_0x31e2c7['length'];_0x5d3980+=0x1){_0xb5bde3=_0x31e2c7[_0x5d3980][_0x0c60('0x90')]?_0x1c0bc7[_0x31e2c7[_0x5d3980][_0x0c60('0x90')]]['metric']:_0x31e2c7[_0x5d3980][_0x0c60('0x75')];_0xb5bde3=_0x31e2c7[_0x5d3980][_0x0c60('0x6f')]?_[_0x0c60('0x71')](_0x514f65[_0x31e2c7[_0x5d3980][_0x0c60('0x6f')]],'%s',_0xb5bde3):_0xb5bde3;_0xb5bde3=_0x31e2c7[_0x5d3980][_0x0c60('0x70')]?_[_0x0c60('0x71')](_0x5be827[_0x31e2c7[_0x5d3980][_0x0c60('0x70')]],'%s',_0xb5bde3):_0xb5bde3;if(_0x31e2c7[_0x5d3980][_0x0c60('0x72')]){_0x57187f[_0x0c60('0x67')](_0xb5bde3);}_0x31e2c7[_0x5d3980]['orderBy']&&_0x57187f[_0x0c60('0x74')](_0xb5bde3,_0x31e2c7[_0x5d3980][_0x0c60('0x73')]==='DESC'?![]:!![]);_0x57187f['field'](_0xb5bde3,_0x31e2c7[_0x5d3980][_0x0c60('0x76')]||_0xb5bde3);}if(_0xb87c1d[_0x0c60('0x77')]){_0xb87c1d[_0x0c60('0x77')]=JSON[_0x0c60('0x78')](_0xb87c1d[_0x0c60('0x77')]);for(var _0x533cba=0x0;_0x533cba<_0xb87c1d['joins']['length'];_0x533cba+=0x1){if(_0xb87c1d['joins'][_0x533cba][_0x0c60('0x33')]&&_[_0x0c60('0x63')](_0x748335,_0xb87c1d[_0x0c60('0x77')][_0x533cba]['type'])&&_0xb87c1d['joins'][_0x533cba][_0x0c60('0x7d')]&&_0xb87c1d[_0x0c60('0x77')][_0x533cba][_0x0c60('0x79')]&&_0xb87c1d[_0x0c60('0x77')][_0x533cba]['foreignKey']){_0x57187f[_0xb87c1d[_0x0c60('0x77')][_0x533cba][_0x0c60('0x33')]](_0xb87c1d['joins'][_0x533cba][_0x0c60('0x79')],null,util[_0x0c60('0x70')](_0x0c60('0x7b'),_0xb87c1d['table'],_0xb87c1d[_0x0c60('0x77')][_0x533cba]['parentKey'],_0xb87c1d['joins'][_0x533cba][_0x0c60('0x79')],_0xb87c1d[_0x0c60('0x77')][_0x533cba]['foreignKey']));}}}if(_0xb87c1d['conditions']){_0xb87c1d['conditions']=JSON[_0x0c60('0x78')](_0xb87c1d[_0x0c60('0x7e')]);_0x57187f['where'](_0xd15b65(_0xb87c1d['conditions'][_0x0c60('0x67')]));}_0x458e9c=_0x57187f[_0x0c60('0x7f')]();_0x57187f['limit'](_0x12e2ed);_0x57187f[_0x0c60('0x1e')](0x0);logger[_0x0c60('0x80')](_0x0c60('0xa0'),_0x57187f[_0x0c60('0x81')]());return dbH[_0x0c60('0x82')][_0x0c60('0x36')](_0x57187f[_0x0c60('0x81')](),{'type':dbH['sequelize'][_0x0c60('0x83')][_0x0c60('0x84')]});}})[_0x0c60('0x28')](function(){return{'sql':_0x458e9c['toString']()};})[_0x0c60('0x28')](respondWithResult(_0x46dd45,null))['catch'](handleError(_0x46dd45,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index e17d599..2efb035 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 _0x6648=['AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','define'];(function(_0x2c3a47,_0x170687){var _0x1c04de=function(_0x367deb){while(--_0x367deb){_0x2c3a47['push'](_0x2c3a47['shift']());}};_0x1c04de(++_0x170687);}(_0x6648,0xda));var _0x8664=function(_0xa93be7,_0x58e797){_0xa93be7=_0xa93be7-0x0;var _0x3ac526=_0x6648[_0xa93be7];return _0x3ac526;};'use strict';var _=require('lodash');var util=require(_0x8664('0x0'));var logger=require(_0x8664('0x1'))('api');var moment=require(_0x8664('0x2'));var BPromise=require(_0x8664('0x3'));var rp=require(_0x8664('0x4'));var fs=require('fs');var path=require(_0x8664('0x5'));var rimraf=require(_0x8664('0x6'));var config=require('../../config/environment');var attributes=require(_0x8664('0x7'));module[_0x8664('0x8')]=function(_0x487ae1,_0x2cf4a0){return _0x487ae1[_0x8664('0x9')](_0x8664('0xa'),attributes,{'tableName':_0x8664('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54a2=['AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x29b208,_0x4f1009){var _0xfcf716=function(_0x210d14){while(--_0x210d14){_0x29b208['push'](_0x29b208['shift']());}};_0xfcf716(++_0x4f1009);}(_0x54a2,0x91));var _0x254a=function(_0x363a2b,_0x2c51a2){_0x363a2b=_0x363a2b-0x0;var _0x2c720e=_0x54a2[_0x363a2b];return _0x2c720e;};'use strict';var _=require(_0x254a('0x0'));var util=require(_0x254a('0x1'));var logger=require(_0x254a('0x2'))(_0x254a('0x3'));var moment=require(_0x254a('0x4'));var BPromise=require(_0x254a('0x5'));var rp=require(_0x254a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x254a('0x7'));var config=require(_0x254a('0x8'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x5f27c3,_0x163dcb){return _0x5f27c3['define'](_0x254a('0x9'),attributes,{'tableName':_0x254a('0xa'),'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 4a34194..2aff523 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 _0xc902=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x1c1410,_0x4ef11d){var _0x717081=function(_0x4e19f0){while(--_0x4e19f0){_0x1c1410['push'](_0x1c1410['shift']());}};_0x717081(++_0x4ef11d);}(_0xc902,0x16b));var _0x2c90=function(_0x56cce9,_0x38855f){_0x56cce9=_0x56cce9-0x0;var _0x399741=_0xc902[_0x56cce9];return _0x399741;};'use strict';var _=require(_0x2c90('0x0'));var util=require('util');var moment=require(_0x2c90('0x1'));var BPromise=require(_0x2c90('0x2'));var rs=require(_0x2c90('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c90('0x4'))['db'];var utils=require(_0x2c90('0x5'));var logger=require(_0x2c90('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2c90('0x7'));var client=jayson[_0x2c90('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1505a1,_0x519466,_0x1643ae){return new BPromise(function(_0x37e433,_0x3b028e){return client[_0x2c90('0x9')](_0x1505a1,_0x1643ae)[_0x2c90('0xa')](function(_0x2eac56){logger[_0x2c90('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x519466,_0x2c90('0xc'));logger['debug'](_0x2c90('0xd'),_0x519466,_0x2c90('0xc'),JSON[_0x2c90('0xe')](_0x2eac56));if(_0x2eac56['error']){if(_0x2eac56[_0x2c90('0xf')]['code']===0x1f4){logger[_0x2c90('0xf')](_0x2c90('0x10'),_0x519466,_0x2eac56['error'][_0x2c90('0x11')]);return _0x3b028e(_0x2eac56[_0x2c90('0xf')][_0x2c90('0x11')]);}logger[_0x2c90('0xf')](_0x2c90('0x10'),_0x519466,_0x2eac56['error'][_0x2c90('0x11')]);return _0x37e433(_0x2eac56[_0x2c90('0xf')][_0x2c90('0x11')]);}else{logger['info'](_0x2c90('0x10'),_0x519466,_0x2c90('0xc'));_0x37e433(_0x2eac56[_0x2c90('0x12')]['message']);}})[_0x2c90('0x13')](function(_0xec7bed){logger['error'](_0x2c90('0x10'),_0x519466,_0xec7bed);_0x3b028e(_0xec7bed);});});} \ No newline at end of file +var _0xa4e5=['../../config/logger','../../config/environment','jayson/promise','client','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x35d8af,_0x14fd75){var _0x1d08b0=function(_0x36b437){while(--_0x36b437){_0x35d8af['push'](_0x35d8af['shift']());}};_0x1d08b0(++_0x14fd75);}(_0xa4e5,0x162));var _0x5a4e=function(_0x3671d7,_0x586bbc){_0x3671d7=_0x3671d7-0x0;var _0xf9f6e6=_0xa4e5[_0x3671d7];return _0xf9f6e6;};'use strict';var _=require('lodash');var util=require(_0x5a4e('0x0'));var moment=require(_0x5a4e('0x1'));var BPromise=require(_0x5a4e('0x2'));var rs=require(_0x5a4e('0x3'));var fs=require('fs');var Redis=require(_0x5a4e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a4e('0x5'));var logger=require(_0x5a4e('0x6'))('rpc');var config=require(_0x5a4e('0x7'));var jayson=require(_0x5a4e('0x8'));var client=jayson[_0x5a4e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dd436,_0x26029e,_0x4c0449){return new BPromise(function(_0x59c3f5,_0x414ad6){return client['request'](_0x2dd436,_0x4c0449)[_0x5a4e('0xa')](function(_0x5d06c8){logger[_0x5a4e('0xb')](_0x5a4e('0xc'),_0x26029e,_0x5a4e('0xd'));logger[_0x5a4e('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x26029e,_0x5a4e('0xd'),JSON[_0x5a4e('0xf')](_0x5d06c8));if(_0x5d06c8['error']){if(_0x5d06c8[_0x5a4e('0x10')][_0x5a4e('0x11')]===0x1f4){logger[_0x5a4e('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x26029e,_0x5d06c8[_0x5a4e('0x10')][_0x5a4e('0x12')]);return _0x414ad6(_0x5d06c8[_0x5a4e('0x10')]['message']);}logger[_0x5a4e('0x10')](_0x5a4e('0xc'),_0x26029e,_0x5d06c8[_0x5a4e('0x10')]['message']);return _0x59c3f5(_0x5d06c8['error'][_0x5a4e('0x12')]);}else{logger[_0x5a4e('0xb')](_0x5a4e('0xc'),_0x26029e,_0x5a4e('0xd'));_0x59c3f5(_0x5d06c8[_0x5a4e('0x13')][_0x5a4e('0x12')]);}})['catch'](function(_0x3deb1f){logger[_0x5a4e('0x10')](_0x5a4e('0xc'),_0x26029e,_0x3deb1f);_0x414ad6(_0x3deb1f);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index c75501d..13933de 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 _0x0307=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put'];(function(_0x16616a,_0x37307e){var _0x44e5f0=function(_0x1dff7d){while(--_0x1dff7d){_0x16616a['push'](_0x16616a['shift']());}};_0x44e5f0(++_0x37307e);}(_0x0307,0x8b));var _0x7030=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x0307[_0x2fee96];return _0x2e6ad1;};'use strict';var multer=require(_0x7030('0x0'));var util=require('util');var path=require(_0x7030('0x1'));var timeout=require(_0x7030('0x2'));var express=require(_0x7030('0x3'));var router=express[_0x7030('0x4')]();var fs_extra=require(_0x7030('0x5'));var auth=require(_0x7030('0x6'));var interaction=require(_0x7030('0x7'));var config=require(_0x7030('0x8'));var controller=require(_0x7030('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7030('0xa')](_0x7030('0xb'),auth[_0x7030('0xc')](),controller[_0x7030('0xd')]);router['get'](_0x7030('0xe'),auth[_0x7030('0xc')](),controller[_0x7030('0xf')]);router[_0x7030('0xa')](_0x7030('0x10'),auth['isAuthenticated'](),controller[_0x7030('0x11')]);router['get'](_0x7030('0x12'),auth[_0x7030('0xc')](),controller[_0x7030('0x13')]);router[_0x7030('0x14')]('/',auth[_0x7030('0xc')](),controller[_0x7030('0x15')]);router[_0x7030('0x16')]('/:id',auth[_0x7030('0xc')](),controller[_0x7030('0x17')]);router[_0x7030('0x18')](_0x7030('0xb'),auth['isAuthenticated'](),controller[_0x7030('0x19')]);module[_0x7030('0x1a')]=router; \ No newline at end of file +var _0x2ec5=['get','isAuthenticated','index','show','/:id/preview','run','/:id/query','query','post','create','/:id','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller'];(function(_0x4dccf2,_0x5cfcd7){var _0x12640e=function(_0x1fb2c7){while(--_0x1fb2c7){_0x4dccf2['push'](_0x4dccf2['shift']());}};_0x12640e(++_0x5cfcd7);}(_0x2ec5,0x116));var _0x52ec=function(_0x563a3b,_0x2a3ac4){_0x563a3b=_0x563a3b-0x0;var _0x146a95=_0x2ec5[_0x563a3b];return _0x146a95;};'use strict';var multer=require('multer');var util=require(_0x52ec('0x0'));var path=require('path');var timeout=require(_0x52ec('0x1'));var express=require(_0x52ec('0x2'));var router=express['Router']();var fs_extra=require(_0x52ec('0x3'));var auth=require(_0x52ec('0x4'));var interaction=require(_0x52ec('0x5'));var config=require(_0x52ec('0x6'));var controller=require(_0x52ec('0x7'));router[_0x52ec('0x8')]('/',auth[_0x52ec('0x9')](),controller[_0x52ec('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x52ec('0xb')]);router[_0x52ec('0x8')](_0x52ec('0xc'),auth[_0x52ec('0x9')](),controller['preview']);router['get']('/:id/run',auth[_0x52ec('0x9')](),controller[_0x52ec('0xd')]);router[_0x52ec('0x8')](_0x52ec('0xe'),auth['isAuthenticated'](),controller[_0x52ec('0xf')]);router[_0x52ec('0x10')]('/',auth['isAuthenticated'](),controller[_0x52ec('0x11')]);router['put'](_0x52ec('0x12'),auth[_0x52ec('0x9')](),controller[_0x52ec('0x13')]);router[_0x52ec('0x14')](_0x52ec('0x12'),auth[_0x52ec('0x9')](),controller['destroy']);module[_0x52ec('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 86d6b11..40fefc0 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 _0x2675=['sequelize','STRING','TEXT'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x2675,0x75));var _0x5267=function(_0x41765e,_0x4d7b27){_0x41765e=_0x41765e-0x0;var _0x197ab9=_0x2675[_0x41765e];return _0x197ab9;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5267('0x1')]},'table':{'type':Sequelize[_0x5267('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5267('0x2')]}}; \ No newline at end of file +var _0x2eb2=['TEXT','exports','STRING'];(function(_0x5f5eb2,_0x3868f5){var _0x58df87=function(_0x91d228){while(--_0x91d228){_0x5f5eb2['push'](_0x5f5eb2['shift']());}};_0x58df87(++_0x3868f5);}(_0x2eb2,0x19f));var _0x22eb=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x2eb2[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]},'parent':{'type':Sequelize[_0x22eb('0x1')]},'table':{'type':Sequelize[_0x22eb('0x1')]},'conditions':{'type':Sequelize[_0x22eb('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 5b8f180..fda9227 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 _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(_0x16a994,_0x27eb6b){var _0x221681=function(_0x327f4b){while(--_0x327f4b){_0x16a994['push'](_0x16a994['shift']());}};_0x221681(++_0x27eb6b);}(_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'];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 +var _0x6d38=['Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','countTable','COUNT(*)','sequelize','run','SEC_TO_TIME(%s)','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','dbH','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','get','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','AnalyticDefaultReport','findAll','rows','show','keys','fields','find','catch','create','body','user','role','Reports','autoAssociation','UserProfileResource','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','toString','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6d38,0x1ef));var _0x86d3=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x6d38[_0x484e36];return _0xafc85d;};'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'];var dbH=require(_0x86d3('0x13'))[_0x86d3('0x14')];function respondWithStatusCode(_0x26d64c,_0xe1b3d7){_0xe1b3d7=_0xe1b3d7||0xcc;return function(_0x1b8d0a){if(_0x1b8d0a){return _0x26d64c[_0x86d3('0x15')](_0xe1b3d7);}return _0x26d64c[_0x86d3('0x16')](_0xe1b3d7)['end']();};}function respondWithResult(_0x1c1ba8,_0x1f35cf){_0x1f35cf=_0x1f35cf||0xc8;return function(_0x356e7d){if(_0x356e7d){return _0x1c1ba8[_0x86d3('0x16')](_0x1f35cf)[_0x86d3('0x17')](_0x356e7d);}};}function respondWithFilteredResult(_0x34fb3b,_0x1ff008){return function(_0x44436d){if(_0x44436d){var _0x53b437=typeof _0x1ff008[_0x86d3('0x18')]===_0x86d3('0x19')&&typeof _0x1ff008[_0x86d3('0x1a')]===_0x86d3('0x19');var _0x46feec=_0x44436d[_0x86d3('0x1b')];var _0x33e459=_0x53b437?0x0:_0x1ff008[_0x86d3('0x18')];var _0x9b76f2=_0x53b437?_0x44436d['count']:_0x1ff008[_0x86d3('0x18')]+_0x1ff008['limit'];var _0x6ced9e;if(_0x9b76f2>=_0x46feec){_0x9b76f2=_0x46feec;_0x6ced9e=0xc8;}else{_0x6ced9e=0xce;}_0x34fb3b['status'](_0x6ced9e);return _0x34fb3b['set'](_0x86d3('0x1c'),_0x33e459+'-'+_0x9b76f2+'/'+_0x46feec)[_0x86d3('0x17')](_0x44436d);}return null;};}function patchUpdates(_0x988066){return function(_0x1720ae){try{jsonpatch['apply'](_0x1720ae,_0x988066,!![]);}catch(_0x2901de){return BPromise['reject'](_0x2901de);}return _0x1720ae[_0x86d3('0x1d')]();};}function saveUpdates(_0x3fdf67,_0x1ce849){return function(_0x5b990d){if(_0x5b990d){return _0x5b990d[_0x86d3('0x1e')](_0x3fdf67)[_0x86d3('0x1f')](function(_0x1fa4ac){return _0x1fa4ac;});}return null;};}function removeEntity(_0x4bf5b8,_0x58ba51){return function(_0x26262a){if(_0x26262a){return _0x26262a['destroy']()[_0x86d3('0x1f')](function(){var _0x1bea5e=_0x26262a[_0x86d3('0x20')]({'plain':!![]});var _0x3c5fe4='DefaultReports';return db['UserProfileResource'][_0x86d3('0x21')]({'where':{'type':_0x3c5fe4,'resourceId':_0x1bea5e['id']}})[_0x86d3('0x1f')](function(){return _0x26262a;});})['then'](function(){_0x4bf5b8[_0x86d3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42413c,_0x41e2f0){return function(_0x287b96){if(!_0x287b96){_0x42413c[_0x86d3('0x15')](0x194);}return _0x287b96;};}function handleError(_0x11a6fd,_0x14c9ff){_0x14c9ff=_0x14c9ff||0x1f4;return function(_0x1f203e){logger[_0x86d3('0x22')](_0x1f203e[_0x86d3('0x23')]);if(_0x1f203e[_0x86d3('0x24')]){delete _0x1f203e[_0x86d3('0x24')];}_0x11a6fd[_0x86d3('0x16')](_0x14c9ff)[_0x86d3('0x25')](_0x1f203e);};}exports[_0x86d3('0x26')]=function(_0x5b09f6,_0x120a0c){var _0x403be3={},_0x2bda35={},_0x31cefe={'count':0x0,'rows':[]};var _0x7709f0=_[_0x86d3('0x27')](db['AnalyticDefaultReport'][_0x86d3('0x28')],function(_0x5c71df){return{'name':_0x5c71df['fieldName'],'type':_0x5c71df[_0x86d3('0x29')][_0x86d3('0x2a')]};});_0x2bda35[_0x86d3('0x2b')]=_['map'](_0x7709f0,_0x86d3('0x24'));_0x2bda35[_0x86d3('0x2c')]=_['keys'](_0x5b09f6[_0x86d3('0x2c')]);_0x2bda35[_0x86d3('0x2d')]=_[_0x86d3('0x2e')](_0x2bda35[_0x86d3('0x2b')],_0x2bda35[_0x86d3('0x2c')]);_0x403be3[_0x86d3('0x2f')]=_[_0x86d3('0x2e')](_0x2bda35[_0x86d3('0x2b')],qs['fields'](_0x5b09f6['query']['fields']));_0x403be3[_0x86d3('0x2f')]=_0x403be3['attributes'][_0x86d3('0x30')]?_0x403be3['attributes']:_0x2bda35[_0x86d3('0x2b')];if(!_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x31')](_0x86d3('0x32'))){_0x403be3[_0x86d3('0x1a')]=qs[_0x86d3('0x1a')](_0x5b09f6[_0x86d3('0x2c')]['limit']);_0x403be3[_0x86d3('0x18')]=qs[_0x86d3('0x18')](_0x5b09f6['query'][_0x86d3('0x18')]);}_0x403be3[_0x86d3('0x33')]=qs[_0x86d3('0x34')](_0x5b09f6[_0x86d3('0x2c')]['sort']);_0x403be3[_0x86d3('0x35')]=qs[_0x86d3('0x2d')](_[_0x86d3('0x36')](_0x5b09f6['query'],_0x2bda35[_0x86d3('0x2d')]),_0x7709f0);if(_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x37')]){_0x403be3[_0x86d3('0x35')]=_[_0x86d3('0x38')](_0x403be3[_0x86d3('0x35')],{'$or':_[_0x86d3('0x27')](_0x7709f0,function(_0x436065){if(_0x436065['type']!==_0x86d3('0x39')){var _0x470978={};_0x470978[_0x436065[_0x86d3('0x24')]]={'$like':'%'+_0x5b09f6[_0x86d3('0x2c')]['filter']+'%'};return _0x470978;}})});}_0x403be3=_[_0x86d3('0x38')]({},_0x403be3,_0x5b09f6[_0x86d3('0x3a')]);var _0x6f72be={'where':_0x403be3[_0x86d3('0x35')]};return db['AnalyticDefaultReport']['count'](_0x6f72be)[_0x86d3('0x1f')](function(_0x4f422b){_0x31cefe['count']=_0x4f422b;if(_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x3b')]){_0x403be3[_0x86d3('0x3c')]=[{'all':!![]}];}return db[_0x86d3('0x3d')][_0x86d3('0x3e')](_0x403be3);})['then'](function(_0x2a5f6c){_0x31cefe[_0x86d3('0x3f')]=_0x2a5f6c;return _0x31cefe;})[_0x86d3('0x1f')](respondWithFilteredResult(_0x120a0c,_0x403be3))['catch'](handleError(_0x120a0c,null));};exports[_0x86d3('0x40')]=function(_0x810d10,_0x5dfae8){var _0x369f68={'raw':!![],'where':{'id':_0x810d10['params']['id']}},_0xcf6c9e={};_0xcf6c9e['model']=_['keys'](db[_0x86d3('0x3d')][_0x86d3('0x28')]);_0xcf6c9e[_0x86d3('0x2c')]=_[_0x86d3('0x41')](_0x810d10[_0x86d3('0x2c')]);_0xcf6c9e[_0x86d3('0x2d')]=_['intersection'](_0xcf6c9e[_0x86d3('0x2b')],_0xcf6c9e[_0x86d3('0x2c')]);_0x369f68['attributes']=_[_0x86d3('0x2e')](_0xcf6c9e[_0x86d3('0x2b')],qs[_0x86d3('0x42')](_0x810d10[_0x86d3('0x2c')][_0x86d3('0x42')]));_0x369f68[_0x86d3('0x2f')]=_0x369f68['attributes'][_0x86d3('0x30')]?_0x369f68[_0x86d3('0x2f')]:_0xcf6c9e['model'];if(_0x810d10[_0x86d3('0x2c')][_0x86d3('0x3b')]){_0x369f68[_0x86d3('0x3c')]=[{'all':!![]}];}_0x369f68=_[_0x86d3('0x38')]({},_0x369f68,_0x810d10[_0x86d3('0x3a')]);return db['AnalyticDefaultReport'][_0x86d3('0x43')](_0x369f68)[_0x86d3('0x1f')](handleEntityNotFound(_0x5dfae8,null))[_0x86d3('0x1f')](respondWithResult(_0x5dfae8,null))[_0x86d3('0x44')](handleError(_0x5dfae8,null));};exports[_0x86d3('0x45')]=function(_0x7af7b3,_0x1a4345){return db[_0x86d3('0x3d')][_0x86d3('0x45')](_0x7af7b3[_0x86d3('0x46')],{})[_0x86d3('0x1f')](function(_0x1236ea){var _0x4ea940=_0x7af7b3[_0x86d3('0x47')][_0x86d3('0x20')]({'plain':!![]});if(!_0x4ea940)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ea940[_0x86d3('0x48')]===_0x86d3('0x47')){var _0x197047=_0x1236ea[_0x86d3('0x20')]({'plain':!![]});var _0x1dcff0=_0x86d3('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x1dcff0,'userProfileId':_0x4ea940['userProfileId']},'raw':!![]})['then'](function(_0x159253){if(_0x159253&&_0x159253[_0x86d3('0x4a')]===0x0){return db[_0x86d3('0x4b')][_0x86d3('0x45')]({'name':_0x197047[_0x86d3('0x24')],'resourceId':_0x197047['id'],'type':_0x86d3('0x4c'),'sectionId':_0x159253['id']},{})[_0x86d3('0x1f')](function(){return _0x1236ea;});}else{return _0x1236ea;}})['catch'](function(_0x2afb07){logger[_0x86d3('0x22')](_0x86d3('0x4d'),_0x2afb07);throw _0x2afb07;});}return _0x1236ea;})[_0x86d3('0x1f')](respondWithResult(_0x1a4345,0xc9))[_0x86d3('0x44')](handleError(_0x1a4345,null));};exports[_0x86d3('0x1e')]=function(_0x34935f,_0x4c8828){if(_0x34935f[_0x86d3('0x46')]['id']){delete _0x34935f['body']['id'];}return db[_0x86d3('0x3d')][_0x86d3('0x43')]({'where':{'id':_0x34935f[_0x86d3('0x4e')]['id']}})[_0x86d3('0x1f')](handleEntityNotFound(_0x4c8828,null))[_0x86d3('0x1f')](saveUpdates(_0x34935f['body'],null))[_0x86d3('0x1f')](respondWithResult(_0x4c8828,null))[_0x86d3('0x44')](handleError(_0x4c8828,null));};exports[_0x86d3('0x21')]=function(_0x4e10d9,_0x4ad164){return db['AnalyticDefaultReport'][_0x86d3('0x43')]({'where':{'id':_0x4e10d9['params']['id']}})[_0x86d3('0x1f')](handleEntityNotFound(_0x4ad164,null))[_0x86d3('0x1f')](removeEntity(_0x4ad164,null))[_0x86d3('0x44')](handleError(_0x4ad164,null));};exports[_0x86d3('0x4f')]=function(_0x5963bb,_0x4cd835){var _0x551806=0xa;var _0x28655a=[_0x86d3('0x50'),'left_join',_0x86d3('0x51'),_0x86d3('0x52')];var _0xa085b2={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':_0x86d3('0x57'),'GROUP_CONCAT':_0x86d3('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x86d3('0x59')};var _0x41fad7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x86d3('0x5a'),'HOUR':_0x86d3('0x5b'),'ROUND':_0x86d3('0x5c'),'UNIX_TIMESTAMP':_0x86d3('0x5d')};var _0x4598d4=function(_0x4029a4){return!_[_0x86d3('0x5e')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x86d3('0x5f'),'IS\x20NOT\x20EMPTY'],_0x4029a4);};var _0x528ca8=function(_0x58e4b6){if(!_0x58e4b6||!_0x58e4b6[_0x86d3('0x60')]['length']){return'';}for(var _0x254ac3='(',_0x5f2ed6=0x0;_0x5f2ed6<_0x58e4b6[_0x86d3('0x60')][_0x86d3('0x30')];_0x5f2ed6+=0x1){_0x5f2ed6>0x0&&(_0x254ac3+='\x20'+_0x58e4b6[_0x86d3('0x61')]+'\x20');_0x254ac3+=_0x58e4b6['rules'][_0x5f2ed6]['group']?_0x528ca8(_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x62')]):_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x63')]+'\x20'+_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x64')]+(_0x4598d4(_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x64')])?'\x20'+_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x65')]:'');}return _0x254ac3+')';};var _0x1e3479={'where':{'id':_0x5963bb[_0x86d3('0x4e')]['id']}},_0x265beb,_0xfaf168,_0xf0dbbb,_0x3f978c,_0x5e1835;_0x1e3479=_[_0x86d3('0x38')]({},_0x1e3479,_0x5963bb['options']);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x1e3479)[_0x86d3('0x1f')](function(_0x52dc99){if(_0x52dc99){_0x265beb=_0x52dc99;return _0x52dc99[_0x86d3('0x66')]();}return null;})[_0x86d3('0x1f')](function(_0x45e8d9){if(_0x45e8d9){if(!_0x45e8d9[_0x86d3('0x30')]){throw new db['Sequelize'][(_0x86d3('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xfaf168=_0x45e8d9;return db[_0x86d3('0x68')][_0x86d3('0x3e')]({'raw':!![]});}return null;})[_0x86d3('0x1f')](function(_0x2d4bc1){if(_0x2d4bc1){_0xf0dbbb=_[_0x86d3('0x69')](_0x2d4bc1,'id');var _0x56fd96;var _0x3cc1d8=squel['select']();_0x3cc1d8[_0x86d3('0x6a')](_0x265beb[_0x86d3('0x6b')]);for(var _0x5866fe=0x0;_0x5866fe<_0xfaf168[_0x86d3('0x30')];_0x5866fe+=0x1){_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x6c')]?_0xf0dbbb[_0xfaf168[_0x5866fe][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0xfaf168[_0x5866fe][_0x86d3('0x63')];_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x6e')]?_[_0x86d3('0x6f')](_0xa085b2[_0xfaf168[_0x5866fe]['function']],'%s',_0x56fd96):_0x56fd96;_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x70')]?_[_0x86d3('0x6f')](_0x41fad7[_0xfaf168[_0x5866fe][_0x86d3('0x70')]],'%s',_0x56fd96):_0x56fd96;if(_0xfaf168[_0x5866fe][_0x86d3('0x71')]){_0x3cc1d8[_0x86d3('0x62')](_0x56fd96);}_0xfaf168[_0x5866fe]['orderBy']&&_0x3cc1d8[_0x86d3('0x33')](_0x56fd96,_0xfaf168[_0x5866fe][_0x86d3('0x72')]==='DESC'?![]:!![]);_0x3cc1d8[_0x86d3('0x63')](_0x56fd96,_0xfaf168[_0x5866fe][_0x86d3('0x73')]||_0x56fd96);}if(_0x265beb[_0x86d3('0x74')]){_0x265beb[_0x86d3('0x74')]=JSON[_0x86d3('0x75')](_0x265beb[_0x86d3('0x74')]);for(var _0x1bf5ba=0x0;_0x1bf5ba<_0x265beb[_0x86d3('0x74')][_0x86d3('0x30')];_0x1bf5ba+=0x1){if(_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x28655a,_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')])&&_0x265beb['joins'][_0x1bf5ba][_0x86d3('0x76')]&&_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x77')]&&_0x265beb[_0x86d3('0x74')][_0x1bf5ba]['foreignKey']){_0x3cc1d8[_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')]](_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x77')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x265beb[_0x86d3('0x6b')],_0x265beb['joins'][_0x1bf5ba][_0x86d3('0x76')],_0x265beb['joins'][_0x1bf5ba]['foreignTable'],_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x78')]));}}}if(_0x265beb[_0x86d3('0x79')]){_0x265beb[_0x86d3('0x79')]=JSON[_0x86d3('0x75')](_0x265beb['conditions']);_0x3cc1d8[_0x86d3('0x35')](_0x528ca8(_0x265beb[_0x86d3('0x79')]['group']));}_0x5e1835=_0x3cc1d8[_0x86d3('0x7a')]();_0x3cc1d8[_0x86d3('0x1a')](_0x551806);_0x3cc1d8['offset'](0x0);logger[_0x86d3('0x7b')]('Limited\x20Query:',_0x3cc1d8[_0x86d3('0x7c')]());return dbH['sequelize']['query'](_0x3cc1d8[_0x86d3('0x7c')](),{'type':dbH['sequelize'][_0x86d3('0x7d')][_0x86d3('0x7e')]});}})[_0x86d3('0x1f')](respondWithResult(_0x4cd835,null))[_0x86d3('0x44')](handleError(_0x4cd835,null));};function runReport(_0x3193d5,_0x3a1acc,_0x268c93){var _0x3b989c=_0x3a1acc['name'];var _0x245b39=0xa;var _0x158f56=[_0x86d3('0x50'),_0x86d3('0x7f'),_0x86d3('0x51'),'cross_join'];var _0x3d8b35={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':_0x86d3('0x80'),'MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':_0x86d3('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x86d3('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xca2e0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x86d3('0x5b'),'ROUND':_0x86d3('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1b503a=function(_0x24410c){return!_[_0x86d3('0x5e')]([_0x86d3('0x82'),_0x86d3('0x83'),_0x86d3('0x5f'),_0x86d3('0x84')],_0x24410c);};var _0x5f4a38=function(_0x593b85){if(!_0x593b85||!_0x593b85[_0x86d3('0x60')][_0x86d3('0x30')]){return'';}for(var _0x3fac94='(',_0x28d98e=0x0;_0x28d98e<_0x593b85[_0x86d3('0x60')][_0x86d3('0x30')];_0x28d98e+=0x1){_0x28d98e>0x0&&(_0x3fac94+='\x20'+_0x593b85['operator']+'\x20');_0x3fac94+=_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x62')]?_0x5f4a38(_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x62')]):_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x63')]+'\x20'+_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x64')]+(_0x1b503a(_0x593b85[_0x86d3('0x60')][_0x28d98e]['condition'])?'\x20'+_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x65')]:'');}return _0x3fac94+')';};var _0x4b871b={'where':{'id':_0x3193d5['id']}},_0x584a57,_0x36ee46,_0x1cbc3a,_0x682a6d,_0x5004cd;_0x4b871b=_[_0x86d3('0x38')]({},_0x4b871b,_0x268c93);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x4b871b)[_0x86d3('0x1f')](function(_0x3d3e7f){if(_0x3d3e7f){_0x584a57=_0x3d3e7f;return _0x3d3e7f['getFields']();}return null;})[_0x86d3('0x1f')](function(_0x1aaf08){if(_0x1aaf08){if(!_0x1aaf08['length']){throw new db[(_0x86d3('0x85'))][(_0x86d3('0x67'))](_0x86d3('0x86'),0x193);}_0x36ee46=_0x1aaf08;return db[_0x86d3('0x68')]['findAll']({'raw':!![]});}return null;})[_0x86d3('0x1f')](function(_0x2896e1){if(_0x2896e1){_0x1cbc3a=_[_0x86d3('0x69')](_0x2896e1,'id');var _0x18295c;var _0x44af1c=squel['select']();_0x44af1c[_0x86d3('0x6a')](_0x584a57[_0x86d3('0x6b')]);for(var _0x3582a2=0x0;_0x3582a2<_0x36ee46[_0x86d3('0x30')];_0x3582a2+=0x1){_0x18295c=_0x36ee46[_0x3582a2][_0x86d3('0x6c')]?_0x1cbc3a[_0x36ee46[_0x3582a2][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0x36ee46[_0x3582a2][_0x86d3('0x63')];_0x18295c=_0x36ee46[_0x3582a2][_0x86d3('0x6e')]?_[_0x86d3('0x6f')](_0x3d8b35[_0x36ee46[_0x3582a2]['function']],'%s',_0x18295c):_0x18295c;_0x18295c=_0x36ee46[_0x3582a2]['format']?_[_0x86d3('0x6f')](_0xca2e0[_0x36ee46[_0x3582a2][_0x86d3('0x70')]],'%s',_0x18295c):_0x18295c;if(_0x36ee46[_0x3582a2]['groupBy']){_0x44af1c[_0x86d3('0x62')](_0x18295c);}_0x36ee46[_0x3582a2][_0x86d3('0x72')]&&_0x44af1c[_0x86d3('0x33')](_0x18295c,_0x36ee46[_0x3582a2][_0x86d3('0x72')]===_0x86d3('0x87')?![]:!![]);_0x44af1c[_0x86d3('0x63')](_0x18295c,_0x36ee46[_0x3582a2][_0x86d3('0x73')]||_0x18295c);}if(_0x584a57[_0x86d3('0x74')]){_0x584a57[_0x86d3('0x74')]=JSON['parse'](_0x584a57['joins']);for(var _0x48a6d7=0x0;_0x48a6d7<_0x584a57['joins'][_0x86d3('0x30')];_0x48a6d7+=0x1){if(_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x158f56,_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x29')])&&_0x584a57[_0x86d3('0x74')][_0x48a6d7]['parentKey']&&_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x77')]&&_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x78')]){_0x44af1c[_0x584a57['joins'][_0x48a6d7][_0x86d3('0x29')]](_0x584a57['joins'][_0x48a6d7][_0x86d3('0x77')],null,util[_0x86d3('0x70')](_0x86d3('0x88'),_0x584a57[_0x86d3('0x6b')],_0x584a57[_0x86d3('0x74')][_0x48a6d7]['parentKey'],_0x584a57['joins'][_0x48a6d7][_0x86d3('0x77')],_0x584a57['joins'][_0x48a6d7][_0x86d3('0x78')]));}}}if(_0x584a57['conditions']){_0x584a57[_0x86d3('0x79')]=JSON['parse'](_0x584a57['conditions']);_0x44af1c[_0x86d3('0x35')](_0x5f4a38(_0x584a57[_0x86d3('0x79')][_0x86d3('0x62')]));}_0x5004cd=_0x44af1c[_0x86d3('0x7a')]();_0x44af1c[_0x86d3('0x1a')](_0x245b39);_0x44af1c[_0x86d3('0x18')](0x0);return;}})[_0x86d3('0x1f')](function(){if(_0x3a1acc[_0x86d3('0x89')]===_0x86d3('0x8a')){return null;}var _0x120a85=_[_0x86d3('0x38')](_0x3a1acc,{'name':_0x3a1acc[_0x86d3('0x8b')]||_0x3a1acc[_0x86d3('0x24')]||_0x584a57[_0x86d3('0x24')],'basename':_0x3b989c,'savename':util[_0x86d3('0x70')]('%s-%s.%s',_0x3a1acc['name']||_0x584a57['name'],require(_0x86d3('0x8c'))[_0x86d3('0x8d')](0x4),_0x3a1acc[_0x86d3('0x89')]||_0x86d3('0x8e')),'reportId':_0x584a57['id'],'reportType':_0x86d3('0x8f')});return db[_0x86d3('0x90')][_0x86d3('0x45')](_0x120a85,{'raw':!![]});})[_0x86d3('0x1f')](function(_0x10e23d){if(_0x584a57[_0x86d3('0x6b')]===_0x86d3('0x91')){_0x5004cd['where'](_0x584a57[_0x86d3('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3a1acc[_0x86d3('0x92')],_0x3a1acc[_0x86d3('0x93')]);}else{_0x5004cd[_0x86d3('0x35')](_0x584a57[_0x86d3('0x6b')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3a1acc[_0x86d3('0x92')],_0x3a1acc[_0x86d3('0x93')]);}if(_0x10e23d){logger[_0x86d3('0x94')](_0x86d3('0x95'),_0x5004cd[_0x86d3('0x7c')]());require(_0x86d3('0x96'))[_0x86d3('0x97')](path[_0x86d3('0x50')](__dirname,_0x86d3('0x98'),_0x10e23d[_0x86d3('0x89')]),[_0x10e23d['id'],_0x5004cd[_0x86d3('0x7c')](),path[_0x86d3('0x50')](__dirname,_0x86d3('0x99'),_0x10e23d[_0x86d3('0x9a')]),_0x3b989c]);return _0x10e23d;}else{var _0x428b11=squel[_0x86d3('0x9b')]();_0x428b11[_0x86d3('0x6a')]('('+_0x5004cd['toString']()+')',_0x86d3('0x9c'));_0x428b11[_0x86d3('0x63')](_0x86d3('0x9d'),_0x86d3('0x1b'));_0x5004cd['limit'](_0x3a1acc[_0x86d3('0x1a')]||_0x245b39);_0x5004cd['offset'](_0x3a1acc['offset']||0x0);return dbH[_0x86d3('0x9e')][_0x86d3('0x2c')](_0x428b11[_0x86d3('0x7c')](),{'type':dbH[_0x86d3('0x9e')][_0x86d3('0x7d')][_0x86d3('0x7e')]})[_0x86d3('0x1f')](function(_0x4777f1){if(!_0x4777f1['length']){_0x682a6d=0x0;}else{_0x682a6d=_0x4777f1[0x0]['count']||0x0;}return dbH['sequelize'][_0x86d3('0x2c')](_0x5004cd[_0x86d3('0x7c')](),{'type':dbH[_0x86d3('0x9e')]['QueryTypes'][_0x86d3('0x7e')]});})['then'](function(_0x435b8e){return{'rows':_0x435b8e||[],'count':_0x682a6d};});}});}exports[_0x86d3('0x9f')]=function(_0x73b8e6,_0x2c98e1){return runReport(_0x73b8e6['params'],_0x73b8e6[_0x86d3('0x2c')],_0x73b8e6[_0x86d3('0x3a')])[_0x86d3('0x1f')](respondWithResult(_0x2c98e1,null))['catch'](handleError(_0x2c98e1,null));};exports['runReport']=runReport;exports['query']=function(_0x458997,_0x1e3559){var _0x49a101=0xa;var _0x38d724=['join',_0x86d3('0x7f'),_0x86d3('0x51'),_0x86d3('0x52')];var _0x56ff91={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':_0x86d3('0x80'),'MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x86d3('0x58'),'GROUP_CONCAT ASC':_0x86d3('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1f347e={'SEC_TO_TIME':_0x86d3('0xa0'),'DATE':'DATE(%s)','HOUR':_0x86d3('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x45b210=function(_0x144e43){return!_[_0x86d3('0x5e')]([_0x86d3('0x82'),_0x86d3('0x83'),_0x86d3('0x5f'),_0x86d3('0x84')],_0x144e43);};var _0xdc7c21=function(_0x2e0397){if(!_0x2e0397||!_0x2e0397[_0x86d3('0x60')][_0x86d3('0x30')]){return'';}for(var _0x2cc617='(',_0x25339c=0x0;_0x25339c<_0x2e0397['rules'][_0x86d3('0x30')];_0x25339c+=0x1){_0x25339c>0x0&&(_0x2cc617+='\x20'+_0x2e0397[_0x86d3('0x61')]+'\x20');_0x2cc617+=_0x2e0397[_0x86d3('0x60')][_0x25339c][_0x86d3('0x62')]?_0xdc7c21(_0x2e0397[_0x86d3('0x60')][_0x25339c][_0x86d3('0x62')]):_0x2e0397['rules'][_0x25339c][_0x86d3('0x63')]+'\x20'+_0x2e0397['rules'][_0x25339c][_0x86d3('0x64')]+(_0x45b210(_0x2e0397[_0x86d3('0x60')][_0x25339c]['condition'])?'\x20'+_0x2e0397['rules'][_0x25339c][_0x86d3('0x65')]:'');}return _0x2cc617+')';};var _0x2c0070={'where':{'id':_0x458997[_0x86d3('0x4e')]['id']}},_0x31d436,_0x56e713,_0x525559,_0x3b9e1e,_0x1d8d7c;_0x2c0070=_['merge']({},_0x2c0070,_0x458997[_0x86d3('0x3a')]);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x2c0070)[_0x86d3('0x1f')](function(_0x1f80be){if(_0x1f80be){_0x31d436=_0x1f80be;return _0x1f80be[_0x86d3('0x66')]();}return null;})[_0x86d3('0x1f')](function(_0x3dddbe){if(_0x3dddbe){if(!_0x3dddbe[_0x86d3('0x30')]){throw new db[(_0x86d3('0x85'))][(_0x86d3('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x56e713=_0x3dddbe;return db[_0x86d3('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1d7e83){if(_0x1d7e83){_0x525559=_[_0x86d3('0x69')](_0x1d7e83,'id');var _0x5d9385;var _0x49a499=squel[_0x86d3('0x9b')]();_0x49a499[_0x86d3('0x6a')](_0x31d436[_0x86d3('0x6b')]);for(var _0x33e0a5=0x0;_0x33e0a5<_0x56e713['length'];_0x33e0a5+=0x1){_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x6c')]?_0x525559[_0x56e713[_0x33e0a5][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0x56e713[_0x33e0a5][_0x86d3('0x63')];_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x6e')]?_['replace'](_0x56ff91[_0x56e713[_0x33e0a5][_0x86d3('0x6e')]],'%s',_0x5d9385):_0x5d9385;_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x70')]?_[_0x86d3('0x6f')](_0x1f347e[_0x56e713[_0x33e0a5]['format']],'%s',_0x5d9385):_0x5d9385;if(_0x56e713[_0x33e0a5][_0x86d3('0x71')]){_0x49a499['group'](_0x5d9385);}_0x56e713[_0x33e0a5][_0x86d3('0x72')]&&_0x49a499[_0x86d3('0x33')](_0x5d9385,_0x56e713[_0x33e0a5]['orderBy']===_0x86d3('0x87')?![]:!![]);_0x49a499[_0x86d3('0x63')](_0x5d9385,_0x56e713[_0x33e0a5][_0x86d3('0x73')]||_0x5d9385);}if(_0x31d436[_0x86d3('0x74')]){_0x31d436[_0x86d3('0x74')]=JSON[_0x86d3('0x75')](_0x31d436['joins']);for(var _0x10af91=0x0;_0x10af91<_0x31d436['joins'][_0x86d3('0x30')];_0x10af91+=0x1){if(_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x38d724,_0x31d436['joins'][_0x10af91][_0x86d3('0x29')])&&_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x76')]&&_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x77')]&&_0x31d436[_0x86d3('0x74')][_0x10af91]['foreignKey']){_0x49a499[_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x29')]](_0x31d436['joins'][_0x10af91]['foreignTable'],null,util[_0x86d3('0x70')]('%s.%s\x20=\x20%s.%s',_0x31d436['table'],_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x76')],_0x31d436[_0x86d3('0x74')][_0x10af91]['foreignTable'],_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x78')]));}}}if(_0x31d436[_0x86d3('0x79')]){_0x31d436[_0x86d3('0x79')]=JSON[_0x86d3('0x75')](_0x31d436['conditions']);_0x49a499[_0x86d3('0x35')](_0xdc7c21(_0x31d436[_0x86d3('0x79')]['group']));}_0x1d8d7c=_0x49a499['clone']();_0x49a499['limit'](_0x49a101);_0x49a499[_0x86d3('0x18')](0x0);logger['debug']('Limited\x20Query:',_0x49a499[_0x86d3('0x7c')]());return dbH[_0x86d3('0x9e')]['query'](_0x49a499['toString'](),{'type':dbH[_0x86d3('0x9e')][_0x86d3('0x7d')][_0x86d3('0x7e')]});}})['then'](function(){return{'sql':_0x1d8d7c[_0x86d3('0x7c')]()};})[_0x86d3('0x1f')](respondWithResult(_0x1e3559,null))[_0x86d3('0x44')](handleError(_0x1e3559,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 021d739..0f2be3b 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 _0xe3c0=['analytics_default_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x1a3bd2,_0x344d4a){var _0x4222e6=function(_0x4a20c8){while(--_0x4a20c8){_0x1a3bd2['push'](_0x1a3bd2['shift']());}};_0x4222e6(++_0x344d4a);}(_0xe3c0,0x189));var _0x0e3c=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xe3c0[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0x0e3c('0x0'));var util=require('util');var logger=require(_0x0e3c('0x1'))(_0x0e3c('0x2'));var moment=require(_0x0e3c('0x3'));var BPromise=require(_0x0e3c('0x4'));var rp=require(_0x0e3c('0x5'));var fs=require('fs');var path=require(_0x0e3c('0x6'));var rimraf=require(_0x0e3c('0x7'));var config=require(_0x0e3c('0x8'));var attributes=require(_0x0e3c('0x9'));module[_0x0e3c('0xa')]=function(_0x38ae92,_0x3f6b22){return _0x38ae92[_0x0e3c('0xb')](_0x0e3c('0xc'),attributes,{'tableName':_0x0e3c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13d0=['../../config/logger','api','moment','bluebird','request-promise','path','exports','AnalyticDefaultReport','analytics_default_reports','util'];(function(_0x5b2cff,_0x43db7a){var _0x1a1288=function(_0x5218c4){while(--_0x5218c4){_0x5b2cff['push'](_0x5b2cff['shift']());}};_0x1a1288(++_0x43db7a);}(_0x13d0,0xf9));var _0x013d=function(_0x18bb2d,_0xf07147){_0x18bb2d=_0x18bb2d-0x0;var _0x32b927=_0x13d0[_0x18bb2d];return _0x32b927;};'use strict';var _=require('lodash');var util=require(_0x013d('0x0'));var logger=require(_0x013d('0x1'))(_0x013d('0x2'));var moment=require(_0x013d('0x3'));var BPromise=require(_0x013d('0x4'));var rp=require(_0x013d('0x5'));var fs=require('fs');var path=require(_0x013d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x013d('0x7')]=function(_0x3986d9,_0x3a434b){return _0x3986d9['define'](_0x013d('0x8'),attributes,{'tableName':_0x013d('0x9'),'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 cc1b41d..d88de2c 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 _0x403b=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x12c05d,_0x1b6332){var _0x19847d=function(_0x14e9e2){while(--_0x14e9e2){_0x12c05d['push'](_0x12c05d['shift']());}};_0x19847d(++_0x1b6332);}(_0x403b,0x112));var _0xb403=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x403b[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xb403('0x0'));var util=require(_0xb403('0x1'));var moment=require(_0xb403('0x2'));var BPromise=require(_0xb403('0x3'));var rs=require(_0xb403('0x4'));var fs=require('fs');var Redis=require(_0xb403('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb403('0x6'))(_0xb403('0x7'));var config=require(_0xb403('0x8'));var jayson=require(_0xb403('0x9'));var client=jayson['client'][_0xb403('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x222c82,_0x4d1e0e,_0x2eab73){return new BPromise(function(_0x250b60,_0x59b416){return client[_0xb403('0xb')](_0x222c82,_0x2eab73)[_0xb403('0xc')](function(_0x56727f){logger[_0xb403('0xd')](_0xb403('0xe'),_0x4d1e0e,'request\x20sent');logger[_0xb403('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x4d1e0e,_0xb403('0x10'),JSON[_0xb403('0x11')](_0x56727f));if(_0x56727f[_0xb403('0x12')]){if(_0x56727f['error'][_0xb403('0x13')]===0x1f4){logger[_0xb403('0x12')](_0xb403('0xe'),_0x4d1e0e,_0x56727f[_0xb403('0x12')][_0xb403('0x14')]);return _0x59b416(_0x56727f[_0xb403('0x12')][_0xb403('0x14')]);}logger[_0xb403('0x12')](_0xb403('0xe'),_0x4d1e0e,_0x56727f[_0xb403('0x12')]['message']);return _0x250b60(_0x56727f[_0xb403('0x12')][_0xb403('0x14')]);}else{logger[_0xb403('0xd')](_0xb403('0xe'),_0x4d1e0e,_0xb403('0x10'));_0x250b60(_0x56727f[_0xb403('0x15')][_0xb403('0x14')]);}})[_0xb403('0x16')](function(_0x380409){logger[_0xb403('0x12')](_0xb403('0xe'),_0x4d1e0e,_0x380409);_0x59b416(_0x380409);});});} \ No newline at end of file +var _0x11c1=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x5cdfd0,_0x1190ca){var _0x392215=function(_0x5774a7){while(--_0x5774a7){_0x5cdfd0['push'](_0x5cdfd0['shift']());}};_0x392215(++_0x1190ca);}(_0x11c1,0x169));var _0x111c=function(_0x4a6c17,_0x158ded){_0x4a6c17=_0x4a6c17-0x0;var _0x174c8f=_0x11c1[_0x4a6c17];return _0x174c8f;};'use strict';var _=require(_0x111c('0x0'));var util=require(_0x111c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x111c('0x2'));var fs=require('fs');var Redis=require(_0x111c('0x3'));var db=require(_0x111c('0x4'))['db'];var utils=require(_0x111c('0x5'));var logger=require(_0x111c('0x6'))('rpc');var config=require(_0x111c('0x7'));var jayson=require(_0x111c('0x8'));var client=jayson['client'][_0x111c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f12d2,_0x4bc4f1,_0x1fc337){return new BPromise(function(_0x2317b1,_0x302896){return client['request'](_0x2f12d2,_0x1fc337)[_0x111c('0xa')](function(_0x567c3c){logger[_0x111c('0xb')](_0x111c('0xc'),_0x4bc4f1,'request\x20sent');logger[_0x111c('0xd')](_0x111c('0xe'),_0x4bc4f1,_0x111c('0xf'),JSON[_0x111c('0x10')](_0x567c3c));if(_0x567c3c['error']){if(_0x567c3c[_0x111c('0x11')][_0x111c('0x12')]===0x1f4){logger[_0x111c('0x11')](_0x111c('0xc'),_0x4bc4f1,_0x567c3c[_0x111c('0x11')][_0x111c('0x13')]);return _0x302896(_0x567c3c[_0x111c('0x11')][_0x111c('0x13')]);}logger[_0x111c('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4bc4f1,_0x567c3c['error'][_0x111c('0x13')]);return _0x2317b1(_0x567c3c[_0x111c('0x11')][_0x111c('0x13')]);}else{logger[_0x111c('0xb')](_0x111c('0xc'),_0x4bc4f1,_0x111c('0xf'));_0x2317b1(_0x567c3c[_0x111c('0x14')][_0x111c('0x13')]);}})[_0x111c('0x15')](function(_0x5476db){logger[_0x111c('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4bc4f1,_0x5476db);_0x302896(_0x5476db);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 196cf61..277d722 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 _0xca65=['../../components/auth/service','get','index','/:id','isAuthenticated','/:id/preview','preview','/:id/run','run','/:id/query','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x51af8c,_0x7ae22f){var _0x170551=function(_0x140494){while(--_0x140494){_0x51af8c['push'](_0x51af8c['shift']());}};_0x170551(++_0x7ae22f);}(_0xca65,0x1dd));var _0x5ca6=function(_0x44279c,_0x3cf289){_0x44279c=_0x44279c-0x0;var _0x1fd297=_0xca65[_0x44279c];return _0x1fd297;};'use strict';var multer=require(_0x5ca6('0x0'));var util=require(_0x5ca6('0x1'));var path=require(_0x5ca6('0x2'));var timeout=require(_0x5ca6('0x3'));var express=require(_0x5ca6('0x4'));var router=express[_0x5ca6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5ca6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x5ca6('0x7')]('/',auth['isAuthenticated'](),controller[_0x5ca6('0x8')]);router[_0x5ca6('0x7')](_0x5ca6('0x9'),auth[_0x5ca6('0xa')](),controller['show']);router[_0x5ca6('0x7')](_0x5ca6('0xb'),auth[_0x5ca6('0xa')](),controller[_0x5ca6('0xc')]);router[_0x5ca6('0x7')](_0x5ca6('0xd'),auth['isAuthenticated'](),controller[_0x5ca6('0xe')]);router[_0x5ca6('0x7')](_0x5ca6('0xf'),auth['isAuthenticated'](),controller['query']);router[_0x5ca6('0x10')]('/',auth[_0x5ca6('0xa')](),controller[_0x5ca6('0x11')]);router['put'](_0x5ca6('0x9'),auth[_0x5ca6('0xa')](),controller['update']);router[_0x5ca6('0x12')](_0x5ca6('0x9'),auth['isAuthenticated'](),controller[_0x5ca6('0x13')]);module[_0x5ca6('0x14')]=router; \ No newline at end of file +var _0x2582=['show','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','update','delete','/:id','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated'];(function(_0x1e8982,_0x37bfc7){var _0x115066=function(_0x202cb1){while(--_0x202cb1){_0x1e8982['push'](_0x1e8982['shift']());}};_0x115066(++_0x37bfc7);}(_0x2582,0xd5));var _0x2258=function(_0x290c78,_0x406c3d){_0x290c78=_0x290c78-0x0;var _0x5d5bf5=_0x2582[_0x290c78];return _0x5d5bf5;};'use strict';var multer=require(_0x2258('0x0'));var util=require(_0x2258('0x1'));var path=require('path');var timeout=require(_0x2258('0x2'));var express=require(_0x2258('0x3'));var router=express[_0x2258('0x4')]();var fs_extra=require(_0x2258('0x5'));var auth=require(_0x2258('0x6'));var interaction=require(_0x2258('0x7'));var config=require(_0x2258('0x8'));var controller=require(_0x2258('0x9'));router[_0x2258('0xa')]('/',auth[_0x2258('0xb')](),controller['index']);router[_0x2258('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x2258('0xc')]);router[_0x2258('0xa')](_0x2258('0xd'),auth[_0x2258('0xb')](),controller[_0x2258('0xe')]);router['get'](_0x2258('0xf'),auth[_0x2258('0xb')](),controller[_0x2258('0x10')]);router[_0x2258('0xa')](_0x2258('0x11'),auth['isAuthenticated'](),controller[_0x2258('0x12')]);router['post']('/',auth[_0x2258('0xb')](),controller[_0x2258('0x13')]);router[_0x2258('0x14')]('/:id',auth[_0x2258('0xb')](),controller[_0x2258('0x15')]);router[_0x2258('0x16')](_0x2258('0x17'),auth[_0x2258('0xb')](),controller[_0x2258('0x18')]);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 f7ed447..cb4f365 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 _0xcaf9=['DATE','manual','scheduled','INTEGER','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx'];(function(_0x211ecf,_0x4b4f33){var _0x3b2581=function(_0x5bcf23){while(--_0x5bcf23){_0x211ecf['push'](_0x211ecf['shift']());}};_0x3b2581(++_0x4b4f33);}(_0xcaf9,0x1cc));var _0x9caf=function(_0x5974b5,_0x428fd1){_0x5974b5=_0x5974b5-0x0;var _0x5230ce=_0xcaf9[_0x5974b5];return _0x5230ce;};'use strict';var Sequelize=require(_0x9caf('0x0'));var moment=require(_0x9caf('0x1'));module[_0x9caf('0x2')]={'name':{'type':Sequelize[_0x9caf('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x9caf('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x9caf('0x4')](_0x9caf('0x5'),_0x9caf('0x6'),_0x9caf('0x7')),'allowNull':![],'defaultValue':_0x9caf('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x9caf('0x8')]},'status':{'type':Sequelize[_0x9caf('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x9caf('0x4')](_0x9caf('0x9'),_0x9caf('0xa')),'allowNull':![],'defaultValue':_0x9caf('0x9')},'reportId':{'type':Sequelize[_0x9caf('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x9caf('0x3')]}}; \ No newline at end of file +var _0xb2f7=['ENUM','csv','pdf','xlsx','DATE','Loading','scheduled','manual','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0xb2f7,0x1a9));var _0x7b2f=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xb2f7[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require(_0x7b2f('0x0'));var moment=require(_0x7b2f('0x1'));module[_0x7b2f('0x2')]={'name':{'type':Sequelize[_0x7b2f('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x7b2f('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x7b2f('0x4')](_0x7b2f('0x5'),_0x7b2f('0x6'),_0x7b2f('0x7')),'allowNull':![],'defaultValue':_0x7b2f('0x5')},'savename':{'type':Sequelize[_0x7b2f('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x7b2f('0x8')]},'endDate':{'type':Sequelize[_0x7b2f('0x8')]},'status':{'type':Sequelize[_0x7b2f('0x3')],'defaultValue':_0x7b2f('0x9')},'type':{'type':Sequelize[_0x7b2f('0x4')]('manual',_0x7b2f('0xa')),'allowNull':![],'defaultValue':_0x7b2f('0xb')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x7b2f('0xc')]},'reportType':{'type':Sequelize[_0x7b2f('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 9c9801d..74d07c9 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 _0x935f=['update','then','destroy','get','ExtractedReports','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','params','download','basename','savename','output','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x935f,0x1b2));var _0xf935=function(_0x2cc4b6,_0x4862fe){_0x2cc4b6=_0x2cc4b6-0x0;var _0x247a8c=_0x935f[_0x2cc4b6];return _0x247a8c;};'use strict';var emlformat=require(_0xf935('0x0'));var rimraf=require(_0xf935('0x1'));var zipdir=require(_0xf935('0x2'));var jsonpatch=require(_0xf935('0x3'));var rp=require('request-promise');var moment=require(_0xf935('0x4'));var BPromise=require(_0xf935('0x5'));var Mustache=require(_0xf935('0x6'));var util=require(_0xf935('0x7'));var path=require(_0xf935('0x8'));var sox=require(_0xf935('0x9'));var csv=require(_0xf935('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf935('0xb'));var _=require(_0xf935('0xc'));var squel=require(_0xf935('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf935('0xe'));var toCsv=require(_0xf935('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf935('0xf'));var authService=require(_0xf935('0x10'));var qs=require(_0xf935('0x11'));var as=require(_0xf935('0x12'));var hardwareService=require(_0xf935('0x13'));var logger=require(_0xf935('0x14'))(_0xf935('0x15'));var utils=require(_0xf935('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf935('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7585,_0x25fc75){_0x25fc75=_0x25fc75||0xcc;return function(_0x283080){if(_0x283080){return _0x4c7585[_0xf935('0x18')](_0x25fc75);}return _0x4c7585[_0xf935('0x19')](_0x25fc75)[_0xf935('0x1a')]();};}function respondWithResult(_0x41a140,_0x3b2e5d){_0x3b2e5d=_0x3b2e5d||0xc8;return function(_0x24aae7){if(_0x24aae7){return _0x41a140[_0xf935('0x19')](_0x3b2e5d)[_0xf935('0x1b')](_0x24aae7);}};}function respondWithFilteredResult(_0x645c50,_0x2e8872){return function(_0x1d1117){if(_0x1d1117){var _0x49844b=typeof _0x2e8872[_0xf935('0x1c')]===_0xf935('0x1d')&&typeof _0x2e8872[_0xf935('0x1e')]===_0xf935('0x1d');var _0x157146=_0x1d1117[_0xf935('0x1f')];var _0x56b083=_0x49844b?0x0:_0x2e8872[_0xf935('0x1c')];var _0x29e3ff=_0x49844b?_0x1d1117['count']:_0x2e8872[_0xf935('0x1c')]+_0x2e8872[_0xf935('0x1e')];var _0x1b3515;if(_0x29e3ff>=_0x157146){_0x29e3ff=_0x157146;_0x1b3515=0xc8;}else{_0x1b3515=0xce;}_0x645c50[_0xf935('0x19')](_0x1b3515);return _0x645c50[_0xf935('0x20')](_0xf935('0x21'),_0x56b083+'-'+_0x29e3ff+'/'+_0x157146)[_0xf935('0x1b')](_0x1d1117);}return null;};}function patchUpdates(_0x306039){return function(_0x25c933){try{jsonpatch[_0xf935('0x22')](_0x25c933,_0x306039,!![]);}catch(_0x2b5848){return BPromise[_0xf935('0x23')](_0x2b5848);}return _0x25c933['save']();};}function saveUpdates(_0x388db4,_0x5727d4){return function(_0x1d2c70){if(_0x1d2c70){return _0x1d2c70[_0xf935('0x24')](_0x388db4)[_0xf935('0x25')](function(_0x4deeb3){return _0x4deeb3;});}return null;};}function removeEntity(_0x3d22cd,_0x50d084){return function(_0x263be3){if(_0x263be3){return _0x263be3[_0xf935('0x26')]()[_0xf935('0x25')](function(){var _0x53cf41=_0x263be3[_0xf935('0x27')]({'plain':!![]});var _0x216f5b=_0xf935('0x28');return db['UserProfileResource'][_0xf935('0x26')]({'where':{'type':_0x216f5b,'resourceId':_0x53cf41['id']}})['then'](function(){return _0x263be3;});})[_0xf935('0x25')](function(){_0x3d22cd[_0xf935('0x19')](0xcc)[_0xf935('0x1a')]();});}};}function handleEntityNotFound(_0x5bc10e,_0x3f2002){return function(_0x577bce){if(!_0x577bce){_0x5bc10e[_0xf935('0x18')](0x194);}return _0x577bce;};}function handleError(_0x18f1c2,_0x569840){_0x569840=_0x569840||0x1f4;return function(_0x449dd8){logger[_0xf935('0x29')](_0x449dd8[_0xf935('0x2a')]);if(_0x449dd8[_0xf935('0x2b')]){delete _0x449dd8[_0xf935('0x2b')];}_0x18f1c2['status'](_0x569840)[_0xf935('0x2c')](_0x449dd8);};}exports['index']=function(_0x5e2a6b,_0x187b5){var _0x55fa79={},_0x3af1f8={},_0x107522={'count':0x0,'rows':[]};var _0x5a0005=_[_0xf935('0x2d')](db[_0xf935('0x2e')][_0xf935('0x2f')],function(_0x3b46cc){return{'name':_0x3b46cc[_0xf935('0x30')],'type':_0x3b46cc[_0xf935('0x31')][_0xf935('0x32')]};});_0x3af1f8[_0xf935('0x33')]=_[_0xf935('0x2d')](_0x5a0005,_0xf935('0x2b'));_0x3af1f8[_0xf935('0x34')]=_[_0xf935('0x35')](_0x5e2a6b[_0xf935('0x34')]);_0x3af1f8['filters']=_[_0xf935('0x36')](_0x3af1f8[_0xf935('0x33')],_0x3af1f8[_0xf935('0x34')]);_0x55fa79[_0xf935('0x37')]=_[_0xf935('0x36')](_0x3af1f8[_0xf935('0x33')],qs[_0xf935('0x38')](_0x5e2a6b[_0xf935('0x34')][_0xf935('0x38')]));_0x55fa79[_0xf935('0x37')]=_0x55fa79['attributes']['length']?_0x55fa79['attributes']:_0x3af1f8[_0xf935('0x33')];if(!_0x5e2a6b[_0xf935('0x34')][_0xf935('0x39')](_0xf935('0x3a'))){_0x55fa79['limit']=qs[_0xf935('0x1e')](_0x5e2a6b[_0xf935('0x34')][_0xf935('0x1e')]);_0x55fa79['offset']=qs[_0xf935('0x1c')](_0x5e2a6b[_0xf935('0x34')][_0xf935('0x1c')]);}_0x55fa79[_0xf935('0x3b')]=qs[_0xf935('0x3c')](_0x5e2a6b[_0xf935('0x34')]['sort']);_0x55fa79[_0xf935('0x3d')]=qs[_0xf935('0x3e')](_[_0xf935('0x3f')](_0x5e2a6b[_0xf935('0x34')],_0x3af1f8[_0xf935('0x3e')]),_0x5a0005);if(_0x5e2a6b[_0xf935('0x34')]['filter']){_0x55fa79[_0xf935('0x3d')]=_[_0xf935('0x40')](_0x55fa79[_0xf935('0x3d')],{'$or':_['map'](_0x5a0005,function(_0x53be60){if(_0x53be60[_0xf935('0x31')]!==_0xf935('0x41')){var _0x32c35a={};_0x32c35a[_0x53be60[_0xf935('0x2b')]]={'$like':'%'+_0x5e2a6b['query']['filter']+'%'};return _0x32c35a;}})});}_0x55fa79=_[_0xf935('0x40')]({},_0x55fa79,_0x5e2a6b[_0xf935('0x42')]);var _0x2266f4={'where':_0x55fa79[_0xf935('0x3d')]};return db['AnalyticExtractedReport'][_0xf935('0x1f')](_0x2266f4)['then'](function(_0x53c638){_0x107522[_0xf935('0x1f')]=_0x53c638;if(_0x5e2a6b[_0xf935('0x34')]['includeAll']){_0x55fa79[_0xf935('0x43')]=[{'all':!![]}];}return db[_0xf935('0x2e')][_0xf935('0x44')](_0x55fa79);})['then'](function(_0x542817){_0x107522[_0xf935('0x45')]=_0x542817;return _0x107522;})[_0xf935('0x25')](respondWithFilteredResult(_0x187b5,_0x55fa79))['catch'](handleError(_0x187b5,null));};exports[_0xf935('0x46')]=function(_0xdaa875,_0x2059bc){var _0x1340c9={'raw':!![],'where':{'id':_0xdaa875['params']['id']}},_0x1d61ef={};_0x1d61ef[_0xf935('0x33')]=_[_0xf935('0x35')](db[_0xf935('0x2e')][_0xf935('0x2f')]);_0x1d61ef['query']=_[_0xf935('0x35')](_0xdaa875[_0xf935('0x34')]);_0x1d61ef[_0xf935('0x3e')]=_[_0xf935('0x36')](_0x1d61ef[_0xf935('0x33')],_0x1d61ef[_0xf935('0x34')]);_0x1340c9[_0xf935('0x37')]=_[_0xf935('0x36')](_0x1d61ef[_0xf935('0x33')],qs[_0xf935('0x38')](_0xdaa875['query']['fields']));_0x1340c9[_0xf935('0x37')]=_0x1340c9['attributes']['length']?_0x1340c9[_0xf935('0x37')]:_0x1d61ef[_0xf935('0x33')];if(_0xdaa875[_0xf935('0x34')][_0xf935('0x47')]){_0x1340c9['include']=[{'all':!![]}];}_0x1340c9=_[_0xf935('0x40')]({},_0x1340c9,_0xdaa875[_0xf935('0x42')]);return db[_0xf935('0x2e')][_0xf935('0x48')](_0x1340c9)[_0xf935('0x25')](handleEntityNotFound(_0x2059bc,null))['then'](respondWithResult(_0x2059bc,null))[_0xf935('0x49')](handleError(_0x2059bc,null));};exports['create']=function(_0x3943fa,_0x5dfe28){return db[_0xf935('0x2e')][_0xf935('0x4a')](_0x3943fa['body'],{})[_0xf935('0x25')](function(_0xb4759c){var _0x393fb1=_0x3943fa[_0xf935('0x4b')]['get']({'plain':!![]});if(!_0x393fb1)throw new Error(_0xf935('0x4c'));if(_0x393fb1['role']===_0xf935('0x4b')){var _0x48f613=_0xb4759c[_0xf935('0x27')]({'plain':!![]});var _0x2622c7='ExtractedReports';return db[_0xf935('0x4d')][_0xf935('0x48')]({'where':{'name':_0x2622c7,'userProfileId':_0x393fb1[_0xf935('0x4e')]},'raw':!![]})['then'](function(_0x276f85){if(_0x276f85&&_0x276f85[_0xf935('0x4f')]===0x0){return db['UserProfileResource'][_0xf935('0x4a')]({'name':_0x48f613[_0xf935('0x2b')],'resourceId':_0x48f613['id'],'type':_0x276f85[_0xf935('0x2b')],'sectionId':_0x276f85['id']},{})[_0xf935('0x25')](function(){return _0xb4759c;});}else{return _0xb4759c;}})[_0xf935('0x49')](function(_0x4ee966){logger[_0xf935('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ee966);throw _0x4ee966;});}return _0xb4759c;})['then'](respondWithResult(_0x5dfe28,0xc9))[_0xf935('0x49')](handleError(_0x5dfe28,null));};exports[_0xf935('0x24')]=function(_0x31bfb7,_0x532617){if(_0x31bfb7['body']['id']){delete _0x31bfb7[_0xf935('0x50')]['id'];}return db[_0xf935('0x2e')][_0xf935('0x48')]({'where':{'id':_0x31bfb7['params']['id']}})[_0xf935('0x25')](handleEntityNotFound(_0x532617,null))[_0xf935('0x25')](saveUpdates(_0x31bfb7[_0xf935('0x50')],null))[_0xf935('0x25')](respondWithResult(_0x532617,null))['catch'](handleError(_0x532617,null));};exports[_0xf935('0x26')]=function(_0x5ee66d,_0x1277b9){return db['AnalyticExtractedReport'][_0xf935('0x48')]({'where':{'id':_0x5ee66d[_0xf935('0x51')]['id']}})[_0xf935('0x25')](handleEntityNotFound(_0x1277b9,null))[_0xf935('0x25')](removeEntity(_0x1277b9,null))['catch'](handleError(_0x1277b9,null));};exports[_0xf935('0x52')]=function(_0x30961f,_0x43ea67,_0x3781f4){return db[_0xf935('0x2e')][_0xf935('0x48')]({'where':{'id':_0x30961f['params']['id']},'attributes':[_0xf935('0x2b'),_0xf935('0x53'),_0xf935('0x54'),_0xf935('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x43ea67,null))[_0xf935('0x25')](function(_0x920716){if(_0x920716){if(!fs[_0xf935('0x56')](path[_0xf935('0x57')](config[_0xf935('0x58')],_0xf935('0x59'),_0x920716['savename']))){throw new db['Sequelize'][(_0xf935('0x5a'))](_0xf935('0x5b'));}if(_0x30961f[_0xf935('0x34')][_0xf935('0x5c')]){return _0x43ea67[_0xf935('0x18')](0xc8);}return _0x43ea67[_0xf935('0x52')](path['join'](config[_0xf935('0x58')],'server/files/reports',_0x920716['savename']),util['format']('%s.%s',_0x920716[_0xf935('0x53')]||_0x920716[_0xf935('0x2b')],_0x920716[_0xf935('0x55')][_0xf935('0x5d')]()));}})[_0xf935('0x49')](handleError(_0x43ea67,null));}; \ No newline at end of file +var _0x0e40=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','error','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','exists','format','toLowerCase','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','index','AnalyticExtractedReport','rawAttributes','type','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create'];(function(_0x2751c,_0x142508){var _0x4606df=function(_0x453f54){while(--_0x453f54){_0x2751c['push'](_0x2751c['shift']());}};_0x4606df(++_0x142508);}(_0x0e40,0xc5));var _0x00e4=function(_0x41c7ca,_0x282185){_0x41c7ca=_0x41c7ca-0x0;var _0x1460e5=_0x0e40[_0x41c7ca];return _0x1460e5;};'use strict';var emlformat=require(_0x00e4('0x0'));var rimraf=require(_0x00e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00e4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x00e4('0x3'));var Mustache=require(_0x00e4('0x4'));var util=require('util');var path=require(_0x00e4('0x5'));var sox=require('sox');var csv=require(_0x00e4('0x6'));var ejs=require(_0x00e4('0x7'));var fs=require('fs');var fs_extra=require(_0x00e4('0x8'));var _=require(_0x00e4('0x9'));var squel=require(_0x00e4('0xa'));var crypto=require(_0x00e4('0xb'));var jsforce=require(_0x00e4('0xc'));var deskjs=require(_0x00e4('0xd'));var toCsv=require(_0x00e4('0x6'));var querystring=require(_0x00e4('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x00e4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00e4('0x10'));var logger=require('../../config/logger')(_0x00e4('0x11'));var utils=require(_0x00e4('0x12'));var config=require(_0x00e4('0x13'));var licenseUtil=require(_0x00e4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50322c,_0x2eef55){_0x2eef55=_0x2eef55||0xcc;return function(_0x5cb8c1){if(_0x5cb8c1){return _0x50322c[_0x00e4('0x15')](_0x2eef55);}return _0x50322c[_0x00e4('0x16')](_0x2eef55)[_0x00e4('0x17')]();};}function respondWithResult(_0xdba386,_0x6a5596){_0x6a5596=_0x6a5596||0xc8;return function(_0x14232f){if(_0x14232f){return _0xdba386[_0x00e4('0x16')](_0x6a5596)[_0x00e4('0x18')](_0x14232f);}};}function respondWithFilteredResult(_0x3ee554,_0x99742){return function(_0x3c5ab6){if(_0x3c5ab6){var _0x78e536=typeof _0x99742['offset']===_0x00e4('0x19')&&typeof _0x99742[_0x00e4('0x1a')]==='undefined';var _0x2c4324=_0x3c5ab6[_0x00e4('0x1b')];var _0x5850ca=_0x78e536?0x0:_0x99742[_0x00e4('0x1c')];var _0x348301=_0x78e536?_0x3c5ab6['count']:_0x99742['offset']+_0x99742[_0x00e4('0x1a')];var _0x19bfea;if(_0x348301>=_0x2c4324){_0x348301=_0x2c4324;_0x19bfea=0xc8;}else{_0x19bfea=0xce;}_0x3ee554[_0x00e4('0x16')](_0x19bfea);return _0x3ee554['set'](_0x00e4('0x1d'),_0x5850ca+'-'+_0x348301+'/'+_0x2c4324)[_0x00e4('0x18')](_0x3c5ab6);}return null;};}function patchUpdates(_0x33088c){return function(_0x39332e){try{jsonpatch[_0x00e4('0x1e')](_0x39332e,_0x33088c,!![]);}catch(_0x4c96e9){return BPromise[_0x00e4('0x1f')](_0x4c96e9);}return _0x39332e[_0x00e4('0x20')]();};}function saveUpdates(_0x1fb466,_0x3a112a){return function(_0x505f99){if(_0x505f99){return _0x505f99[_0x00e4('0x21')](_0x1fb466)[_0x00e4('0x22')](function(_0x25e9dc){return _0x25e9dc;});}return null;};}function removeEntity(_0x34ac5b,_0x3c94f2){return function(_0x3c1d39){if(_0x3c1d39){return _0x3c1d39[_0x00e4('0x23')]()[_0x00e4('0x22')](function(){var _0x253bc3=_0x3c1d39[_0x00e4('0x24')]({'plain':!![]});var _0x4be6c9=_0x00e4('0x25');return db['UserProfileResource'][_0x00e4('0x23')]({'where':{'type':_0x4be6c9,'resourceId':_0x253bc3['id']}})[_0x00e4('0x22')](function(){return _0x3c1d39;});})['then'](function(){_0x34ac5b[_0x00e4('0x16')](0xcc)[_0x00e4('0x17')]();});}};}function handleEntityNotFound(_0x1d4a06,_0xd8b7a3){return function(_0x2eef26){if(!_0x2eef26){_0x1d4a06[_0x00e4('0x15')](0x194);}return _0x2eef26;};}function handleError(_0x3d8a47,_0x1aeb9a){_0x1aeb9a=_0x1aeb9a||0x1f4;return function(_0x4977dc){logger['error'](_0x4977dc['stack']);if(_0x4977dc['name']){delete _0x4977dc['name'];}_0x3d8a47[_0x00e4('0x16')](_0x1aeb9a)['send'](_0x4977dc);};}exports[_0x00e4('0x26')]=function(_0x1269c9,_0x12d523){var _0x1ff71e={},_0x38367b={},_0x497afb={'count':0x0,'rows':[]};var _0x55a24f=_['map'](db[_0x00e4('0x27')][_0x00e4('0x28')],function(_0x511f10){return{'name':_0x511f10['fieldName'],'type':_0x511f10[_0x00e4('0x29')][_0x00e4('0x2a')]};});_0x38367b[_0x00e4('0x2b')]=_[_0x00e4('0x2c')](_0x55a24f,_0x00e4('0x2d'));_0x38367b['query']=_[_0x00e4('0x2e')](_0x1269c9[_0x00e4('0x2f')]);_0x38367b[_0x00e4('0x30')]=_[_0x00e4('0x31')](_0x38367b[_0x00e4('0x2b')],_0x38367b[_0x00e4('0x2f')]);_0x1ff71e[_0x00e4('0x32')]=_['intersection'](_0x38367b[_0x00e4('0x2b')],qs[_0x00e4('0x33')](_0x1269c9[_0x00e4('0x2f')][_0x00e4('0x33')]));_0x1ff71e[_0x00e4('0x32')]=_0x1ff71e[_0x00e4('0x32')][_0x00e4('0x34')]?_0x1ff71e[_0x00e4('0x32')]:_0x38367b[_0x00e4('0x2b')];if(!_0x1269c9[_0x00e4('0x2f')][_0x00e4('0x35')](_0x00e4('0x36'))){_0x1ff71e['limit']=qs[_0x00e4('0x1a')](_0x1269c9[_0x00e4('0x2f')][_0x00e4('0x1a')]);_0x1ff71e[_0x00e4('0x1c')]=qs['offset'](_0x1269c9[_0x00e4('0x2f')]['offset']);}_0x1ff71e[_0x00e4('0x37')]=qs[_0x00e4('0x38')](_0x1269c9[_0x00e4('0x2f')]['sort']);_0x1ff71e[_0x00e4('0x39')]=qs[_0x00e4('0x30')](_[_0x00e4('0x3a')](_0x1269c9[_0x00e4('0x2f')],_0x38367b[_0x00e4('0x30')]),_0x55a24f);if(_0x1269c9[_0x00e4('0x2f')][_0x00e4('0x3b')]){_0x1ff71e[_0x00e4('0x39')]=_[_0x00e4('0x3c')](_0x1ff71e[_0x00e4('0x39')],{'$or':_['map'](_0x55a24f,function(_0x242488){if(_0x242488['type']!=='VIRTUAL'){var _0x674e84={};_0x674e84[_0x242488[_0x00e4('0x2d')]]={'$like':'%'+_0x1269c9[_0x00e4('0x2f')]['filter']+'%'};return _0x674e84;}})});}_0x1ff71e=_[_0x00e4('0x3c')]({},_0x1ff71e,_0x1269c9[_0x00e4('0x3d')]);var _0x3449ab={'where':_0x1ff71e['where']};return db[_0x00e4('0x27')]['count'](_0x3449ab)[_0x00e4('0x22')](function(_0x2d25c3){_0x497afb['count']=_0x2d25c3;if(_0x1269c9['query'][_0x00e4('0x3e')]){_0x1ff71e[_0x00e4('0x3f')]=[{'all':!![]}];}return db[_0x00e4('0x27')][_0x00e4('0x40')](_0x1ff71e);})[_0x00e4('0x22')](function(_0x119943){_0x497afb[_0x00e4('0x41')]=_0x119943;return _0x497afb;})['then'](respondWithFilteredResult(_0x12d523,_0x1ff71e))[_0x00e4('0x42')](handleError(_0x12d523,null));};exports[_0x00e4('0x43')]=function(_0x5bc5c5,_0x39b2a0){var _0xd3fb7e={'raw':!![],'where':{'id':_0x5bc5c5[_0x00e4('0x44')]['id']}},_0xfbb21={};_0xfbb21[_0x00e4('0x2b')]=_[_0x00e4('0x2e')](db[_0x00e4('0x27')][_0x00e4('0x28')]);_0xfbb21[_0x00e4('0x2f')]=_['keys'](_0x5bc5c5[_0x00e4('0x2f')]);_0xfbb21['filters']=_[_0x00e4('0x31')](_0xfbb21[_0x00e4('0x2b')],_0xfbb21[_0x00e4('0x2f')]);_0xd3fb7e[_0x00e4('0x32')]=_[_0x00e4('0x31')](_0xfbb21[_0x00e4('0x2b')],qs[_0x00e4('0x33')](_0x5bc5c5[_0x00e4('0x2f')][_0x00e4('0x33')]));_0xd3fb7e['attributes']=_0xd3fb7e[_0x00e4('0x32')][_0x00e4('0x34')]?_0xd3fb7e[_0x00e4('0x32')]:_0xfbb21[_0x00e4('0x2b')];if(_0x5bc5c5[_0x00e4('0x2f')]['includeAll']){_0xd3fb7e[_0x00e4('0x3f')]=[{'all':!![]}];}_0xd3fb7e=_[_0x00e4('0x3c')]({},_0xd3fb7e,_0x5bc5c5[_0x00e4('0x3d')]);return db[_0x00e4('0x27')]['find'](_0xd3fb7e)[_0x00e4('0x22')](handleEntityNotFound(_0x39b2a0,null))[_0x00e4('0x22')](respondWithResult(_0x39b2a0,null))[_0x00e4('0x42')](handleError(_0x39b2a0,null));};exports['create']=function(_0x96094f,_0x52f6aa){return db[_0x00e4('0x27')][_0x00e4('0x45')](_0x96094f[_0x00e4('0x46')],{})[_0x00e4('0x22')](function(_0x5d31fe){var _0x3448c0=_0x96094f[_0x00e4('0x47')][_0x00e4('0x24')]({'plain':!![]});if(!_0x3448c0)throw new Error(_0x00e4('0x48'));if(_0x3448c0[_0x00e4('0x49')]===_0x00e4('0x47')){var _0x2245d5=_0x5d31fe[_0x00e4('0x24')]({'plain':!![]});var _0x14f927=_0x00e4('0x25');return db['UserProfileSection'][_0x00e4('0x4a')]({'where':{'name':_0x14f927,'userProfileId':_0x3448c0['userProfileId']},'raw':!![]})['then'](function(_0x4d8b3c){if(_0x4d8b3c&&_0x4d8b3c[_0x00e4('0x4b')]===0x0){return db[_0x00e4('0x4c')]['create']({'name':_0x2245d5['name'],'resourceId':_0x2245d5['id'],'type':_0x4d8b3c[_0x00e4('0x2d')],'sectionId':_0x4d8b3c['id']},{})[_0x00e4('0x22')](function(){return _0x5d31fe;});}else{return _0x5d31fe;}})[_0x00e4('0x42')](function(_0x12fb62){logger[_0x00e4('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12fb62);throw _0x12fb62;});}return _0x5d31fe;})[_0x00e4('0x22')](respondWithResult(_0x52f6aa,0xc9))[_0x00e4('0x42')](handleError(_0x52f6aa,null));};exports[_0x00e4('0x21')]=function(_0x1caf00,_0x2c8eeb){if(_0x1caf00[_0x00e4('0x46')]['id']){delete _0x1caf00['body']['id'];}return db[_0x00e4('0x27')][_0x00e4('0x4a')]({'where':{'id':_0x1caf00[_0x00e4('0x44')]['id']}})[_0x00e4('0x22')](handleEntityNotFound(_0x2c8eeb,null))[_0x00e4('0x22')](saveUpdates(_0x1caf00[_0x00e4('0x46')],null))[_0x00e4('0x22')](respondWithResult(_0x2c8eeb,null))[_0x00e4('0x42')](handleError(_0x2c8eeb,null));};exports['destroy']=function(_0x4dd95f,_0x4fdc99){return db[_0x00e4('0x27')][_0x00e4('0x4a')]({'where':{'id':_0x4dd95f[_0x00e4('0x44')]['id']}})[_0x00e4('0x22')](handleEntityNotFound(_0x4fdc99,null))['then'](removeEntity(_0x4fdc99,null))[_0x00e4('0x42')](handleError(_0x4fdc99,null));};exports['download']=function(_0xdd25a5,_0x1f1d6f,_0x5bc096){return db['AnalyticExtractedReport'][_0x00e4('0x4a')]({'where':{'id':_0xdd25a5[_0x00e4('0x44')]['id']},'attributes':[_0x00e4('0x2d'),_0x00e4('0x4e'),_0x00e4('0x4f'),_0x00e4('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x1f1d6f,null))[_0x00e4('0x22')](function(_0x32c1f8){if(_0x32c1f8){if(!fs['existsSync'](path[_0x00e4('0x51')](config[_0x00e4('0x52')],_0x00e4('0x53'),_0x32c1f8[_0x00e4('0x4f')]))){throw new db[(_0x00e4('0x54'))][(_0x00e4('0x55'))]('Report\x20not\x20found\x20or\x20empty');}if(_0xdd25a5[_0x00e4('0x2f')][_0x00e4('0x56')]){return _0x1f1d6f[_0x00e4('0x15')](0xc8);}return _0x1f1d6f['download'](path[_0x00e4('0x51')](config[_0x00e4('0x52')],_0x00e4('0x53'),_0x32c1f8[_0x00e4('0x4f')]),util[_0x00e4('0x57')]('%s.%s',_0x32c1f8[_0x00e4('0x4e')]||_0x32c1f8['name'],_0x32c1f8[_0x00e4('0x50')][_0x00e4('0x58')]()));}})[_0x00e4('0x42')](handleError(_0x1f1d6f,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 9dbe627..bf330e4 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 _0x44b0=['lodash','../../config/logger','bluebird','request-promise','path','rimraf','exports','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x31ada0,_0x47aa09){var _0x3b40b4=function(_0x379ee9){while(--_0x379ee9){_0x31ada0['push'](_0x31ada0['shift']());}};_0x3b40b4(++_0x47aa09);}(_0x44b0,0x82));var _0x044b=function(_0x50879d,_0x520bf4){_0x50879d=_0x50879d-0x0;var _0x2c4866=_0x44b0[_0x50879d];return _0x2c4866;};'use strict';var _=require(_0x044b('0x0'));var util=require('util');var logger=require(_0x044b('0x1'))('api');var moment=require('moment');var BPromise=require(_0x044b('0x2'));var rp=require(_0x044b('0x3'));var fs=require('fs');var path=require(_0x044b('0x4'));var rimraf=require(_0x044b('0x5'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0x044b('0x6')]=function(_0x36f6d3,_0x3a2ced){return _0x36f6d3[_0x044b('0x7')](_0x044b('0x8'),attributes,{'tableName':_0x044b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b2f=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash'];(function(_0x43b34a,_0x39f685){var _0x4d4b3b=function(_0x488b72){while(--_0x488b72){_0x43b34a['push'](_0x43b34a['shift']());}};_0x4d4b3b(++_0x39f685);}(_0x0b2f,0x178));var _0xf0b2=function(_0x16ed05,_0x4e7734){_0x16ed05=_0x16ed05-0x0;var _0x3f38ea=_0x0b2f[_0x16ed05];return _0x3f38ea;};'use strict';var _=require(_0xf0b2('0x0'));var util=require(_0xf0b2('0x1'));var logger=require(_0xf0b2('0x2'))(_0xf0b2('0x3'));var moment=require(_0xf0b2('0x4'));var BPromise=require(_0xf0b2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0b2('0x6'));var rimraf=require(_0xf0b2('0x7'));var config=require(_0xf0b2('0x8'));var attributes=require(_0xf0b2('0x9'));module[_0xf0b2('0xa')]=function(_0x56d769,_0xdaee6f){return _0x56d769[_0xf0b2('0xb')]('AnalyticExtractedReport',attributes,{'tableName':_0xf0b2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index a5a7c98..75fa60e 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 _0xb5d6=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb5d6,0x176));var _0x6b5d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb5d6[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x6b5d('0x0'));var util=require('util');var moment=require(_0x6b5d('0x1'));var BPromise=require(_0x6b5d('0x2'));var rs=require(_0x6b5d('0x3'));var fs=require('fs');var Redis=require(_0x6b5d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6b5d('0x5'));var logger=require(_0x6b5d('0x6'))(_0x6b5d('0x7'));var config=require(_0x6b5d('0x8'));var jayson=require(_0x6b5d('0x9'));var client=jayson[_0x6b5d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e0a3b,_0x46ba0f,_0x495c08){return new BPromise(function(_0x384c26,_0x58ac8a){return client[_0x6b5d('0xb')](_0x2e0a3b,_0x495c08)['then'](function(_0x1dfe9d){logger[_0x6b5d('0xc')](_0x6b5d('0xd'),_0x46ba0f,_0x6b5d('0xe'));logger[_0x6b5d('0xf')](_0x6b5d('0x10'),_0x46ba0f,'request\x20sent',JSON[_0x6b5d('0x11')](_0x1dfe9d));if(_0x1dfe9d[_0x6b5d('0x12')]){if(_0x1dfe9d[_0x6b5d('0x12')][_0x6b5d('0x13')]===0x1f4){logger[_0x6b5d('0x12')](_0x6b5d('0xd'),_0x46ba0f,_0x1dfe9d[_0x6b5d('0x12')][_0x6b5d('0x14')]);return _0x58ac8a(_0x1dfe9d[_0x6b5d('0x12')][_0x6b5d('0x14')]);}logger['error'](_0x6b5d('0xd'),_0x46ba0f,_0x1dfe9d[_0x6b5d('0x12')][_0x6b5d('0x14')]);return _0x384c26(_0x1dfe9d[_0x6b5d('0x12')][_0x6b5d('0x14')]);}else{logger[_0x6b5d('0xc')](_0x6b5d('0xd'),_0x46ba0f,_0x6b5d('0xe'));_0x384c26(_0x1dfe9d[_0x6b5d('0x15')][_0x6b5d('0x14')]);}})[_0x6b5d('0x16')](function(_0x19462b){logger[_0x6b5d('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x46ba0f,_0x19462b);_0x58ac8a(_0x19462b);});});} \ No newline at end of file +var _0x0ade=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x2edfe8,_0x5d2d2a){var _0x558e6e=function(_0xe17872){while(--_0xe17872){_0x2edfe8['push'](_0x2edfe8['shift']());}};_0x558e6e(++_0x5d2d2a);}(_0x0ade,0x1dc));var _0xe0ad=function(_0x49ed16,_0x3c0331){_0x49ed16=_0x49ed16-0x0;var _0x2a0f3a=_0x0ade[_0x49ed16];return _0x2a0f3a;};'use strict';var _=require(_0xe0ad('0x0'));var util=require('util');var moment=require(_0xe0ad('0x1'));var BPromise=require(_0xe0ad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0ad('0x3'));var db=require(_0xe0ad('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0ad('0x5'))('rpc');var config=require(_0xe0ad('0x6'));var jayson=require(_0xe0ad('0x7'));var client=jayson[_0xe0ad('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x61c01a,_0x4d386c,_0x5e5e11){return new BPromise(function(_0x2be84f,_0x3260de){return client['request'](_0x61c01a,_0x5e5e11)[_0xe0ad('0x9')](function(_0x3c0419){logger[_0xe0ad('0xa')](_0xe0ad('0xb'),_0x4d386c,_0xe0ad('0xc'));logger[_0xe0ad('0xd')](_0xe0ad('0xe'),_0x4d386c,'request\x20sent',JSON['stringify'](_0x3c0419));if(_0x3c0419[_0xe0ad('0xf')]){if(_0x3c0419['error'][_0xe0ad('0x10')]===0x1f4){logger[_0xe0ad('0xf')](_0xe0ad('0xb'),_0x4d386c,_0x3c0419['error'][_0xe0ad('0x11')]);return _0x3260de(_0x3c0419[_0xe0ad('0xf')][_0xe0ad('0x11')]);}logger[_0xe0ad('0xf')](_0xe0ad('0xb'),_0x4d386c,_0x3c0419[_0xe0ad('0xf')]['message']);return _0x2be84f(_0x3c0419['error'][_0xe0ad('0x11')]);}else{logger[_0xe0ad('0xa')](_0xe0ad('0xb'),_0x4d386c,_0xe0ad('0xc'));_0x2be84f(_0x3c0419[_0xe0ad('0x12')][_0xe0ad('0x11')]);}})[_0xe0ad('0x13')](function(_0x3aa7b0){logger[_0xe0ad('0xf')](_0xe0ad('0xb'),_0x4d386c,_0x3aa7b0);_0x3260de(_0x3aa7b0);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 6600b7b..37fa2f4 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 _0xa3a1=['./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x563e66,_0x3b6277){var _0x594d5a=function(_0x45cece){while(--_0x45cece){_0x563e66['push'](_0x563e66['shift']());}};_0x594d5a(++_0x3b6277);}(_0xa3a1,0xbe));var _0x1a3a=function(_0x19d880,_0x24a6c7){_0x19d880=_0x19d880-0x0;var _0x500042=_0xa3a1[_0x19d880];return _0x500042;};'use strict';var multer=require(_0x1a3a('0x0'));var util=require(_0x1a3a('0x1'));var path=require(_0x1a3a('0x2'));var timeout=require(_0x1a3a('0x3'));var express=require(_0x1a3a('0x4'));var router=express[_0x1a3a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1a3a('0x6'));var interaction=require(_0x1a3a('0x7'));var config=require('../../config/environment');var controller=require(_0x1a3a('0x8'));router['get']('/',auth[_0x1a3a('0x9')](),controller[_0x1a3a('0xa')]);router[_0x1a3a('0xb')](_0x1a3a('0xc'),auth[_0x1a3a('0x9')](),controller[_0x1a3a('0xd')]);router[_0x1a3a('0xb')](_0x1a3a('0xe'),auth['isAuthenticated'](),controller[_0x1a3a('0xf')]);router['post']('/',auth[_0x1a3a('0x9')](),controller[_0x1a3a('0x10')]);router[_0x1a3a('0x11')]('/:id',auth[_0x1a3a('0x9')](),controller[_0x1a3a('0x12')]);router[_0x1a3a('0x13')](_0x1a3a('0xc'),auth[_0x1a3a('0x9')](),controller[_0x1a3a('0x14')]);module[_0x1a3a('0x15')]=router; \ No newline at end of file +var _0xfefd=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id/download','post','create','/:id','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfefd,0x18b));var _0xdfef=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0xfefd[_0x3712e2];return _0x1faff4;};'use strict';var multer=require(_0xdfef('0x0'));var util=require(_0xdfef('0x1'));var path=require(_0xdfef('0x2'));var timeout=require(_0xdfef('0x3'));var express=require(_0xdfef('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdfef('0x5'));var interaction=require(_0xdfef('0x6'));var config=require(_0xdfef('0x7'));var controller=require(_0xdfef('0x8'));router[_0xdfef('0x9')]('/',auth[_0xdfef('0xa')](),controller[_0xdfef('0xb')]);router[_0xdfef('0x9')]('/:id',auth[_0xdfef('0xa')](),controller['show']);router[_0xdfef('0x9')](_0xdfef('0xc'),auth[_0xdfef('0xa')](),controller['download']);router[_0xdfef('0xd')]('/',auth[_0xdfef('0xa')](),controller[_0xdfef('0xe')]);router['put'](_0xdfef('0xf'),auth[_0xdfef('0xa')](),controller[_0xdfef('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xdfef('0x11')]);module[_0xdfef('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index a2baf06..c172ccb 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 _0x5024=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x1bfe2b,_0x34856e){var _0x1477d4=function(_0x1d558c){while(--_0x1d558c){_0x1bfe2b['push'](_0x1bfe2b['shift']());}};_0x1477d4(++_0x34856e);}(_0x5024,0x9d));var _0x4502=function(_0x1c6269,_0x53e58d){_0x1c6269=_0x1c6269-0x0;var _0x39df6a=_0x5024[_0x1c6269];return _0x39df6a;};'use strict';var Sequelize=require(_0x4502('0x0'));module[_0x4502('0x1')]={'field':{'type':Sequelize[_0x4502('0x2')]},'alias':{'type':Sequelize[_0x4502('0x3')]},'function':{'type':Sequelize[_0x4502('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x4502('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x4502('0x3')]},'custom':{'type':Sequelize[_0x4502('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xf889=['STRING','BOOLEAN','sequelize','exports'];(function(_0x239372,_0x54b520){var _0x42ee4e=function(_0x227d75){while(--_0x227d75){_0x239372['push'](_0x239372['shift']());}};_0x42ee4e(++_0x54b520);}(_0xf889,0xe6));var _0x9f88=function(_0x241223,_0x102b76){_0x241223=_0x241223-0x0;var _0x279243=_0xf889[_0x241223];return _0x279243;};'use strict';var Sequelize=require(_0x9f88('0x0'));module[_0x9f88('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x9f88('0x2')]},'function':{'type':Sequelize[_0x9f88('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x9f88('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x9f88('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 8a5b61f..aea9ba9 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 _0xd31c=['request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','includeAll','include','AnalyticFieldReport','findAll','catch','show','params','options','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','eml-format','zip-dir'];(function(_0x29312c,_0x55f134){var _0x11a02b=function(_0x10ee44){while(--_0x10ee44){_0x29312c['push'](_0x29312c['shift']());}};_0x11a02b(++_0x55f134);}(_0xd31c,0x1cc));var _0xcd31=function(_0x41acfd,_0xcfa795){_0x41acfd=_0x41acfd-0x0;var _0x3f1e79=_0xd31c[_0x41acfd];return _0x3f1e79;};'use strict';var emlformat=require(_0xcd31('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd31('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd31('0x2'));var moment=require(_0xcd31('0x3'));var BPromise=require(_0xcd31('0x4'));var Mustache=require(_0xcd31('0x5'));var util=require('util');var path=require(_0xcd31('0x6'));var sox=require(_0xcd31('0x7'));var csv=require(_0xcd31('0x8'));var ejs=require(_0xcd31('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcd31('0xa'));var crypto=require(_0xcd31('0xb'));var jsforce=require(_0xcd31('0xc'));var deskjs=require(_0xcd31('0xd'));var toCsv=require(_0xcd31('0x8'));var querystring=require('querystring');var Papa=require(_0xcd31('0xe'));var Redis=require(_0xcd31('0xf'));var authService=require(_0xcd31('0x10'));var qs=require(_0xcd31('0x11'));var as=require(_0xcd31('0x12'));var hardwareService=require(_0xcd31('0x13'));var logger=require('../../config/logger')(_0xcd31('0x14'));var utils=require('../../config/utils');var config=require(_0xcd31('0x15'));var licenseUtil=require(_0xcd31('0x16'));var db=require(_0xcd31('0x17'))['db'];function respondWithStatusCode(_0x331bb2,_0x12ca36){_0x12ca36=_0x12ca36||0xcc;return function(_0x446f2b){if(_0x446f2b){return _0x331bb2[_0xcd31('0x18')](_0x12ca36);}return _0x331bb2[_0xcd31('0x19')](_0x12ca36)[_0xcd31('0x1a')]();};}function respondWithResult(_0x3bf18b,_0x3fbc33){_0x3fbc33=_0x3fbc33||0xc8;return function(_0xbee26){if(_0xbee26){return _0x3bf18b['status'](_0x3fbc33)[_0xcd31('0x1b')](_0xbee26);}};}function respondWithFilteredResult(_0x1a07e5,_0x1478c8){return function(_0x5e4394){if(_0x5e4394){var _0x4f996e=typeof _0x1478c8[_0xcd31('0x1c')]===_0xcd31('0x1d')&&typeof _0x1478c8[_0xcd31('0x1e')]===_0xcd31('0x1d');var _0x1cb8c5=_0x5e4394[_0xcd31('0x1f')];var _0xe3b7b1=_0x4f996e?0x0:_0x1478c8[_0xcd31('0x1c')];var _0x90ca90=_0x4f996e?_0x5e4394[_0xcd31('0x1f')]:_0x1478c8[_0xcd31('0x1c')]+_0x1478c8['limit'];var _0x3b8da2;if(_0x90ca90>=_0x1cb8c5){_0x90ca90=_0x1cb8c5;_0x3b8da2=0xc8;}else{_0x3b8da2=0xce;}_0x1a07e5['status'](_0x3b8da2);return _0x1a07e5[_0xcd31('0x20')](_0xcd31('0x21'),_0xe3b7b1+'-'+_0x90ca90+'/'+_0x1cb8c5)[_0xcd31('0x1b')](_0x5e4394);}return null;};}function patchUpdates(_0x159b60){return function(_0x42a974){try{jsonpatch['apply'](_0x42a974,_0x159b60,!![]);}catch(_0x164b54){return BPromise[_0xcd31('0x22')](_0x164b54);}return _0x42a974[_0xcd31('0x23')]();};}function saveUpdates(_0x3116f4,_0x70aa1b){return function(_0x5cea87){if(_0x5cea87){return _0x5cea87[_0xcd31('0x24')](_0x3116f4)[_0xcd31('0x25')](function(_0x51196b){return _0x51196b;});}return null;};}function removeEntity(_0x74f6cc,_0x24949b){return function(_0xe19399){if(_0xe19399){return _0xe19399[_0xcd31('0x26')]()[_0xcd31('0x25')](function(){_0x74f6cc['status'](0xcc)[_0xcd31('0x1a')]();});}};}function handleEntityNotFound(_0x2559f1,_0xa3ce4f){return function(_0x210d8e){if(!_0x210d8e){_0x2559f1[_0xcd31('0x18')](0x194);}return _0x210d8e;};}function handleError(_0x52121c,_0x2b5a8b){_0x2b5a8b=_0x2b5a8b||0x1f4;return function(_0x423324){logger[_0xcd31('0x27')](_0x423324[_0xcd31('0x28')]);if(_0x423324[_0xcd31('0x29')]){delete _0x423324[_0xcd31('0x29')];}_0x52121c[_0xcd31('0x19')](_0x2b5a8b)[_0xcd31('0x2a')](_0x423324);};}exports['index']=function(_0xf7faf9,_0x4bf416){var _0x58002c={},_0x363799={},_0x2fc264={'count':0x0,'rows':[]};var _0x3afe36=_['map'](db['AnalyticFieldReport'][_0xcd31('0x2b')],function(_0x945774){return{'name':_0x945774['fieldName'],'type':_0x945774[_0xcd31('0x2c')]['key']};});_0x363799[_0xcd31('0x2d')]=_[_0xcd31('0x2e')](_0x3afe36,_0xcd31('0x29'));_0x363799[_0xcd31('0x2f')]=_[_0xcd31('0x30')](_0xf7faf9[_0xcd31('0x2f')]);_0x363799[_0xcd31('0x31')]=_[_0xcd31('0x32')](_0x363799[_0xcd31('0x2d')],_0x363799[_0xcd31('0x2f')]);_0x58002c[_0xcd31('0x33')]=_[_0xcd31('0x32')](_0x363799[_0xcd31('0x2d')],qs['fields'](_0xf7faf9[_0xcd31('0x2f')][_0xcd31('0x34')]));_0x58002c['attributes']=_0x58002c['attributes'][_0xcd31('0x35')]?_0x58002c[_0xcd31('0x33')]:_0x363799[_0xcd31('0x2d')];if(!_0xf7faf9[_0xcd31('0x2f')][_0xcd31('0x36')]('nolimit')){_0x58002c['limit']=qs[_0xcd31('0x1e')](_0xf7faf9[_0xcd31('0x2f')][_0xcd31('0x1e')]);_0x58002c[_0xcd31('0x1c')]=qs[_0xcd31('0x1c')](_0xf7faf9[_0xcd31('0x2f')][_0xcd31('0x1c')]);}_0x58002c[_0xcd31('0x37')]=qs[_0xcd31('0x38')](_0xf7faf9[_0xcd31('0x2f')][_0xcd31('0x38')]);_0x58002c[_0xcd31('0x39')]=qs[_0xcd31('0x31')](_[_0xcd31('0x3a')](_0xf7faf9['query'],_0x363799[_0xcd31('0x31')]),_0x3afe36);if(_0xf7faf9[_0xcd31('0x2f')]['filter']){_0x58002c[_0xcd31('0x39')]=_[_0xcd31('0x3b')](_0x58002c['where'],{'$or':_[_0xcd31('0x2e')](_0x3afe36,function(_0x4ee369){if(_0x4ee369[_0xcd31('0x2c')]!==_0xcd31('0x3c')){var _0x45cb06={};_0x45cb06[_0x4ee369[_0xcd31('0x29')]]={'$like':'%'+_0xf7faf9['query']['filter']+'%'};return _0x45cb06;}})});}_0x58002c=_[_0xcd31('0x3b')]({},_0x58002c,_0xf7faf9['options']);var _0x2c1a6a={'where':_0x58002c['where']};return db['AnalyticFieldReport']['count'](_0x2c1a6a)['then'](function(_0x5db7ab){_0x2fc264['count']=_0x5db7ab;if(_0xf7faf9[_0xcd31('0x2f')][_0xcd31('0x3d')]){_0x58002c[_0xcd31('0x3e')]=[{'all':!![]}];}return db[_0xcd31('0x3f')][_0xcd31('0x40')](_0x58002c);})[_0xcd31('0x25')](function(_0x4d89f3){_0x2fc264['rows']=_0x4d89f3;return _0x2fc264;})[_0xcd31('0x25')](respondWithFilteredResult(_0x4bf416,_0x58002c))[_0xcd31('0x41')](handleError(_0x4bf416,null));};exports[_0xcd31('0x42')]=function(_0x5e2ae9,_0x26131c){var _0x5554ad={'raw':![],'where':{'id':_0x5e2ae9[_0xcd31('0x43')]['id']}},_0x50f50b={};_0x50f50b[_0xcd31('0x2d')]=_[_0xcd31('0x30')](db[_0xcd31('0x3f')][_0xcd31('0x2b')]);_0x50f50b[_0xcd31('0x2f')]=_[_0xcd31('0x30')](_0x5e2ae9[_0xcd31('0x2f')]);_0x50f50b[_0xcd31('0x31')]=_[_0xcd31('0x32')](_0x50f50b[_0xcd31('0x2d')],_0x50f50b[_0xcd31('0x2f')]);_0x5554ad[_0xcd31('0x33')]=_[_0xcd31('0x32')](_0x50f50b[_0xcd31('0x2d')],qs[_0xcd31('0x34')](_0x5e2ae9[_0xcd31('0x2f')][_0xcd31('0x34')]));_0x5554ad[_0xcd31('0x33')]=_0x5554ad[_0xcd31('0x33')][_0xcd31('0x35')]?_0x5554ad[_0xcd31('0x33')]:_0x50f50b[_0xcd31('0x2d')];if(_0x5e2ae9['query'][_0xcd31('0x3d')]){_0x5554ad['include']=[{'all':!![]}];}_0x5554ad=_[_0xcd31('0x3b')]({},_0x5554ad,_0x5e2ae9[_0xcd31('0x44')]);return db[_0xcd31('0x3f')][_0xcd31('0x45')](_0x5554ad)[_0xcd31('0x25')](handleEntityNotFound(_0x26131c,null))[_0xcd31('0x25')](respondWithResult(_0x26131c,null))['catch'](handleError(_0x26131c,null));};exports[_0xcd31('0x46')]=function(_0xda48d0,_0x2553c4){return db[_0xcd31('0x3f')][_0xcd31('0x46')](_0xda48d0[_0xcd31('0x47')],{})['then'](respondWithResult(_0x2553c4,0xc9))['catch'](handleError(_0x2553c4,null));};exports[_0xcd31('0x48')]=function(_0x3d5317,_0x338ce6){return db[_0xcd31('0x3f')][_0xcd31('0x48')](_0x3d5317[_0xcd31('0x47')],{'raw':![],'individualHooks':!![]})[_0xcd31('0x25')](respondWithResult(_0x338ce6,0xc9))['catch'](handleError(_0x338ce6,null));};exports[_0xcd31('0x24')]=function(_0x468694,_0x427162){if(_0x468694[_0xcd31('0x47')]['id']){delete _0x468694[_0xcd31('0x47')]['id'];}return db[_0xcd31('0x3f')][_0xcd31('0x45')]({'where':{'id':_0x468694[_0xcd31('0x43')]['id']}})[_0xcd31('0x25')](handleEntityNotFound(_0x427162,null))['then'](saveUpdates(_0x468694[_0xcd31('0x47')],null))[_0xcd31('0x25')](respondWithResult(_0x427162,null))[_0xcd31('0x41')](handleError(_0x427162,null));};exports['destroy']=function(_0x41205f,_0x524e16){return db['AnalyticFieldReport']['find']({'where':{'id':_0x41205f[_0xcd31('0x43')]['id']}})[_0xcd31('0x25')](handleEntityNotFound(_0x524e16,null))['then'](removeEntity(_0x524e16,null))[_0xcd31('0x41')](handleError(_0x524e16,null));};exports[_0xcd31('0x49')]=function(_0xe7fa3a,_0x3b019a){return db[_0xcd31('0x3f')][_0xcd31('0x26')]({'where':{'id':_0xe7fa3a[_0xcd31('0x2f')][_0xcd31('0x4a')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3b019a,0xcc))[_0xcd31('0x41')](handleError(_0x3b019a,null));};exports[_0xcd31('0x4b')]=function(_0x2cbde6,_0x5b1f63,_0x4efa66){return db[_0xcd31('0x4c')]['findOne']({'where':{'id':_0x2cbde6[_0xcd31('0x43')]['id']}})['then'](handleEntityNotFound(_0x5b1f63,null))[_0xcd31('0x25')](function(_0x25ba7c){if(_0x25ba7c){return db['sequelize']['transaction'](function(_0x34e1f6){return db[_0xcd31('0x3f')][_0xcd31('0x26')]({'where':{'CustomReportId':_0x2cbde6[_0xcd31('0x43')]['id']},'transaction':_0x34e1f6})[_0xcd31('0x25')](function(_0x223be0){var _0x76016f=_['map'](_0x2cbde6[_0xcd31('0x47')],function(_0x5108fd){delete _0x5108fd['id'];_0x5108fd['CustomReportId']=_0x2cbde6['params']['id'];return _0x5108fd;});return db[_0xcd31('0x3f')]['bulkCreate'](_0x76016f,{'transaction':_0x34e1f6});});})[_0xcd31('0x25')](function(){return db[_0xcd31('0x3f')][_0xcd31('0x40')]({'where':{'CustomReportId':_0x2cbde6['params']['id']}});});}})['then'](respondWithResult(_0x5b1f63,null))[_0xcd31('0x41')](handleError(_0x5b1f63,null));}; \ No newline at end of file +var _0x322a=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','options','includeAll','include','findAll','catch','params','find','create','body','bulkCreate','bulkDestroy','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x235076,_0x2f08ff){var _0x55eeb3=function(_0x33e792){while(--_0x33e792){_0x235076['push'](_0x235076['shift']());}};_0x55eeb3(++_0x2f08ff);}(_0x322a,0xed));var _0xa322=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0x322a[_0x365be9];return _0x185c12;};'use strict';var emlformat=require(_0xa322('0x0'));var rimraf=require(_0xa322('0x1'));var zipdir=require(_0xa322('0x2'));var jsonpatch=require(_0xa322('0x3'));var rp=require(_0xa322('0x4'));var moment=require(_0xa322('0x5'));var BPromise=require(_0xa322('0x6'));var Mustache=require(_0xa322('0x7'));var util=require(_0xa322('0x8'));var path=require('path');var sox=require(_0xa322('0x9'));var csv=require(_0xa322('0xa'));var ejs=require(_0xa322('0xb'));var fs=require('fs');var fs_extra=require(_0xa322('0xc'));var _=require(_0xa322('0xd'));var squel=require('squel');var crypto=require(_0xa322('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa322('0xf'));var toCsv=require(_0xa322('0xa'));var querystring=require(_0xa322('0x10'));var Papa=require(_0xa322('0x11'));var Redis=require(_0xa322('0x12'));var authService=require(_0xa322('0x13'));var qs=require(_0xa322('0x14'));var as=require(_0xa322('0x15'));var hardwareService=require(_0xa322('0x16'));var logger=require(_0xa322('0x17'))(_0xa322('0x18'));var utils=require(_0xa322('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xa322('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c594a,_0x15e4f1){_0x15e4f1=_0x15e4f1||0xcc;return function(_0x5b3055){if(_0x5b3055){return _0x5c594a[_0xa322('0x1b')](_0x15e4f1);}return _0x5c594a[_0xa322('0x1c')](_0x15e4f1)[_0xa322('0x1d')]();};}function respondWithResult(_0x8df399,_0x5add81){_0x5add81=_0x5add81||0xc8;return function(_0x55e60f){if(_0x55e60f){return _0x8df399['status'](_0x5add81)[_0xa322('0x1e')](_0x55e60f);}};}function respondWithFilteredResult(_0xda2009,_0x5706e6){return function(_0x3f13a0){if(_0x3f13a0){var _0x53fb6a=typeof _0x5706e6[_0xa322('0x1f')]===_0xa322('0x20')&&typeof _0x5706e6['limit']===_0xa322('0x20');var _0x3abfbf=_0x3f13a0[_0xa322('0x21')];var _0x130522=_0x53fb6a?0x0:_0x5706e6[_0xa322('0x1f')];var _0x208e0f=_0x53fb6a?_0x3f13a0[_0xa322('0x21')]:_0x5706e6['offset']+_0x5706e6[_0xa322('0x22')];var _0x1dc354;if(_0x208e0f>=_0x3abfbf){_0x208e0f=_0x3abfbf;_0x1dc354=0xc8;}else{_0x1dc354=0xce;}_0xda2009[_0xa322('0x1c')](_0x1dc354);return _0xda2009[_0xa322('0x23')](_0xa322('0x24'),_0x130522+'-'+_0x208e0f+'/'+_0x3abfbf)[_0xa322('0x1e')](_0x3f13a0);}return null;};}function patchUpdates(_0x299267){return function(_0x4e6d0c){try{jsonpatch['apply'](_0x4e6d0c,_0x299267,!![]);}catch(_0x3f5de2){return BPromise[_0xa322('0x25')](_0x3f5de2);}return _0x4e6d0c[_0xa322('0x26')]();};}function saveUpdates(_0x1b1e3b,_0x3871a5){return function(_0x37698f){if(_0x37698f){return _0x37698f[_0xa322('0x27')](_0x1b1e3b)['then'](function(_0x18b8e1){return _0x18b8e1;});}return null;};}function removeEntity(_0xab068,_0x4d1f8c){return function(_0x1b2ea2){if(_0x1b2ea2){return _0x1b2ea2[_0xa322('0x28')]()[_0xa322('0x29')](function(){_0xab068[_0xa322('0x1c')](0xcc)[_0xa322('0x1d')]();});}};}function handleEntityNotFound(_0x4c4b2c,_0x482ed8){return function(_0x3cf078){if(!_0x3cf078){_0x4c4b2c['sendStatus'](0x194);}return _0x3cf078;};}function handleError(_0x20cd72,_0x47a297){_0x47a297=_0x47a297||0x1f4;return function(_0x2946c6){logger['error'](_0x2946c6[_0xa322('0x2a')]);if(_0x2946c6[_0xa322('0x2b')]){delete _0x2946c6[_0xa322('0x2b')];}_0x20cd72['status'](_0x47a297)[_0xa322('0x2c')](_0x2946c6);};}exports['index']=function(_0xa80e0e,_0x239287){var _0x2198ef={},_0x5e4dc6={},_0x52b0d6={'count':0x0,'rows':[]};var _0x54f910=_[_0xa322('0x2d')](db[_0xa322('0x2e')][_0xa322('0x2f')],function(_0x269613){return{'name':_0x269613[_0xa322('0x30')],'type':_0x269613['type'][_0xa322('0x31')]};});_0x5e4dc6[_0xa322('0x32')]=_[_0xa322('0x2d')](_0x54f910,_0xa322('0x2b'));_0x5e4dc6['query']=_[_0xa322('0x33')](_0xa80e0e[_0xa322('0x34')]);_0x5e4dc6[_0xa322('0x35')]=_[_0xa322('0x36')](_0x5e4dc6[_0xa322('0x32')],_0x5e4dc6[_0xa322('0x34')]);_0x2198ef[_0xa322('0x37')]=_[_0xa322('0x36')](_0x5e4dc6[_0xa322('0x32')],qs[_0xa322('0x38')](_0xa80e0e[_0xa322('0x34')]['fields']));_0x2198ef[_0xa322('0x37')]=_0x2198ef[_0xa322('0x37')][_0xa322('0x39')]?_0x2198ef['attributes']:_0x5e4dc6['model'];if(!_0xa80e0e[_0xa322('0x34')][_0xa322('0x3a')](_0xa322('0x3b'))){_0x2198ef['limit']=qs[_0xa322('0x22')](_0xa80e0e[_0xa322('0x34')][_0xa322('0x22')]);_0x2198ef[_0xa322('0x1f')]=qs[_0xa322('0x1f')](_0xa80e0e[_0xa322('0x34')][_0xa322('0x1f')]);}_0x2198ef[_0xa322('0x3c')]=qs['sort'](_0xa80e0e[_0xa322('0x34')][_0xa322('0x3d')]);_0x2198ef['where']=qs[_0xa322('0x35')](_[_0xa322('0x3e')](_0xa80e0e['query'],_0x5e4dc6[_0xa322('0x35')]),_0x54f910);if(_0xa80e0e[_0xa322('0x34')]['filter']){_0x2198ef[_0xa322('0x3f')]=_[_0xa322('0x40')](_0x2198ef[_0xa322('0x3f')],{'$or':_['map'](_0x54f910,function(_0x3871b9){if(_0x3871b9[_0xa322('0x41')]!=='VIRTUAL'){var _0x1a94f7={};_0x1a94f7[_0x3871b9[_0xa322('0x2b')]]={'$like':'%'+_0xa80e0e[_0xa322('0x34')]['filter']+'%'};return _0x1a94f7;}})});}_0x2198ef=_['merge']({},_0x2198ef,_0xa80e0e[_0xa322('0x42')]);var _0x32c60d={'where':_0x2198ef[_0xa322('0x3f')]};return db[_0xa322('0x2e')][_0xa322('0x21')](_0x32c60d)[_0xa322('0x29')](function(_0x48ed03){_0x52b0d6[_0xa322('0x21')]=_0x48ed03;if(_0xa80e0e['query'][_0xa322('0x43')]){_0x2198ef[_0xa322('0x44')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xa322('0x45')](_0x2198ef);})[_0xa322('0x29')](function(_0x4b3b5c){_0x52b0d6['rows']=_0x4b3b5c;return _0x52b0d6;})[_0xa322('0x29')](respondWithFilteredResult(_0x239287,_0x2198ef))[_0xa322('0x46')](handleError(_0x239287,null));};exports['show']=function(_0x24eadc,_0x15d2a1){var _0x261f56={'raw':![],'where':{'id':_0x24eadc[_0xa322('0x47')]['id']}},_0x204a38={};_0x204a38[_0xa322('0x32')]=_[_0xa322('0x33')](db[_0xa322('0x2e')][_0xa322('0x2f')]);_0x204a38[_0xa322('0x34')]=_[_0xa322('0x33')](_0x24eadc[_0xa322('0x34')]);_0x204a38[_0xa322('0x35')]=_[_0xa322('0x36')](_0x204a38[_0xa322('0x32')],_0x204a38[_0xa322('0x34')]);_0x261f56[_0xa322('0x37')]=_[_0xa322('0x36')](_0x204a38['model'],qs['fields'](_0x24eadc['query'][_0xa322('0x38')]));_0x261f56[_0xa322('0x37')]=_0x261f56[_0xa322('0x37')][_0xa322('0x39')]?_0x261f56[_0xa322('0x37')]:_0x204a38[_0xa322('0x32')];if(_0x24eadc['query'][_0xa322('0x43')]){_0x261f56[_0xa322('0x44')]=[{'all':!![]}];}_0x261f56=_['merge']({},_0x261f56,_0x24eadc['options']);return db[_0xa322('0x2e')][_0xa322('0x48')](_0x261f56)[_0xa322('0x29')](handleEntityNotFound(_0x15d2a1,null))[_0xa322('0x29')](respondWithResult(_0x15d2a1,null))[_0xa322('0x46')](handleError(_0x15d2a1,null));};exports[_0xa322('0x49')]=function(_0x4dd91c,_0x2ec985){return db[_0xa322('0x2e')]['create'](_0x4dd91c[_0xa322('0x4a')],{})[_0xa322('0x29')](respondWithResult(_0x2ec985,0xc9))[_0xa322('0x46')](handleError(_0x2ec985,null));};exports[_0xa322('0x4b')]=function(_0x4bd799,_0x490549){return db[_0xa322('0x2e')]['bulkCreate'](_0x4bd799['body'],{'raw':![],'individualHooks':!![]})[_0xa322('0x29')](respondWithResult(_0x490549,0xc9))[_0xa322('0x46')](handleError(_0x490549,null));};exports[_0xa322('0x27')]=function(_0x3d24ce,_0x36b894){if(_0x3d24ce[_0xa322('0x4a')]['id']){delete _0x3d24ce[_0xa322('0x4a')]['id'];}return db[_0xa322('0x2e')][_0xa322('0x48')]({'where':{'id':_0x3d24ce[_0xa322('0x47')]['id']}})[_0xa322('0x29')](handleEntityNotFound(_0x36b894,null))[_0xa322('0x29')](saveUpdates(_0x3d24ce[_0xa322('0x4a')],null))[_0xa322('0x29')](respondWithResult(_0x36b894,null))[_0xa322('0x46')](handleError(_0x36b894,null));};exports[_0xa322('0x28')]=function(_0x4aaeab,_0xc090c7){return db[_0xa322('0x2e')]['find']({'where':{'id':_0x4aaeab[_0xa322('0x47')]['id']}})[_0xa322('0x29')](handleEntityNotFound(_0xc090c7,null))[_0xa322('0x29')](removeEntity(_0xc090c7,null))[_0xa322('0x46')](handleError(_0xc090c7,null));};exports[_0xa322('0x4c')]=function(_0x6a946f,_0x12c5d7){return db[_0xa322('0x2e')]['destroy']({'where':{'id':_0x6a946f[_0xa322('0x34')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xa322('0x29')](respondWithResult(_0x12c5d7,0xcc))['catch'](handleError(_0x12c5d7,null));};exports['addFields']=function(_0x649918,_0x323205,_0x398dab){return db['AnalyticCustomReport'][_0xa322('0x4d')]({'where':{'id':_0x649918[_0xa322('0x47')]['id']}})[_0xa322('0x29')](handleEntityNotFound(_0x323205,null))['then'](function(_0x5be01d){if(_0x5be01d){return db[_0xa322('0x4e')][_0xa322('0x4f')](function(_0x6ca579){return db['AnalyticFieldReport'][_0xa322('0x28')]({'where':{'CustomReportId':_0x649918['params']['id']},'transaction':_0x6ca579})['then'](function(_0x5b5f24){var _0x43dc47=_['map'](_0x649918[_0xa322('0x4a')],function(_0x43f4f7){delete _0x43f4f7['id'];_0x43f4f7[_0xa322('0x50')]=_0x649918[_0xa322('0x47')]['id'];return _0x43f4f7;});return db['AnalyticFieldReport'][_0xa322('0x4b')](_0x43dc47,{'transaction':_0x6ca579});});})[_0xa322('0x29')](function(){return db[_0xa322('0x2e')]['findAll']({'where':{'CustomReportId':_0x649918['params']['id']}});});}})[_0xa322('0x29')](respondWithResult(_0x323205,null))['catch'](handleError(_0x323205,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index c384f4d..b20623b 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 _0xe75e=['moment','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','util','../../config/logger'];(function(_0x5c883f,_0x38f092){var _0x4210cc=function(_0x51be71){while(--_0x51be71){_0x5c883f['push'](_0x5c883f['shift']());}};_0x4210cc(++_0x38f092);}(_0xe75e,0x1c0));var _0xee75=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0xe75e[_0x54a761];return _0x37d1da;};'use strict';var _=require(_0xee75('0x0'));var util=require(_0xee75('0x1'));var logger=require(_0xee75('0x2'))('api');var moment=require(_0xee75('0x3'));var BPromise=require('bluebird');var rp=require(_0xee75('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee75('0x5'));var config=require(_0xee75('0x6'));var attributes=require(_0xee75('0x7'));module[_0xee75('0x8')]=function(_0xefc5dd,_0x120fd2){return _0xefc5dd[_0xee75('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0xee75('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x156d=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x46fae2,_0x4ea16c){var _0xc524bf=function(_0x36f4c4){while(--_0x36f4c4){_0x46fae2['push'](_0x46fae2['shift']());}};_0xc524bf(++_0x4ea16c);}(_0x156d,0x88));var _0xd156=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x156d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd156('0x0'))(_0xd156('0x1'));var moment=require(_0xd156('0x2'));var BPromise=require(_0xd156('0x3'));var rp=require(_0xd156('0x4'));var fs=require('fs');var path=require(_0xd156('0x5'));var rimraf=require(_0xd156('0x6'));var config=require(_0xd156('0x7'));var attributes=require(_0xd156('0x8'));module[_0xd156('0x9')]=function(_0x50639a,_0x3e88e7){return _0x50639a[_0xd156('0xa')](_0xd156('0xb'),attributes,{'tableName':_0xd156('0xc'),'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 f80c355..912f95f 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 _0x03eb=['http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x482493,_0xbe84be){var _0x3b9e70=function(_0x47e013){while(--_0x47e013){_0x482493['push'](_0x482493['shift']());}};_0x3b9e70(++_0xbe84be);}(_0x03eb,0xf2));var _0xb03e=function(_0x1fc697,_0x2a2b1d){_0x1fc697=_0x1fc697-0x0;var _0x1b9f8f=_0x03eb[_0x1fc697];return _0x1b9f8f;};'use strict';var _=require(_0xb03e('0x0'));var util=require(_0xb03e('0x1'));var moment=require(_0xb03e('0x2'));var BPromise=require(_0xb03e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb03e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb03e('0x5'));var logger=require(_0xb03e('0x6'))(_0xb03e('0x7'));var config=require(_0xb03e('0x8'));var jayson=require(_0xb03e('0x9'));var client=jayson[_0xb03e('0xa')][_0xb03e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3320d8,_0x13aa9d,_0x3021e6){return new BPromise(function(_0x5e22c6,_0x4f2857){return client[_0xb03e('0xc')](_0x3320d8,_0x3021e6)[_0xb03e('0xd')](function(_0x21a791){logger[_0xb03e('0xe')](_0xb03e('0xf'),_0x13aa9d,'request\x20sent');logger['debug'](_0xb03e('0x10'),_0x13aa9d,_0xb03e('0x11'),JSON['stringify'](_0x21a791));if(_0x21a791[_0xb03e('0x12')]){if(_0x21a791['error'][_0xb03e('0x13')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x13aa9d,_0x21a791[_0xb03e('0x12')]['message']);return _0x4f2857(_0x21a791[_0xb03e('0x12')][_0xb03e('0x14')]);}logger[_0xb03e('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x13aa9d,_0x21a791[_0xb03e('0x12')][_0xb03e('0x14')]);return _0x5e22c6(_0x21a791[_0xb03e('0x12')]['message']);}else{logger[_0xb03e('0xe')](_0xb03e('0xf'),_0x13aa9d,_0xb03e('0x11'));_0x5e22c6(_0x21a791[_0xb03e('0x15')][_0xb03e('0x14')]);}})[_0xb03e('0x16')](function(_0x225711){logger[_0xb03e('0x12')](_0xb03e('0xf'),_0x13aa9d,_0x225711);_0x4f2857(_0x225711);});});} \ No newline at end of file +var _0x28aa=['http','request','then','request\x20sent','debug','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2435b1,_0x119921){var _0x36b189=function(_0xf8d103){while(--_0xf8d103){_0x2435b1['push'](_0x2435b1['shift']());}};_0x36b189(++_0x119921);}(_0x28aa,0x182));var _0xa28a=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x28aa[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0xa28a('0x0'));var util=require(_0xa28a('0x1'));var moment=require('moment');var BPromise=require(_0xa28a('0x2'));var rs=require(_0xa28a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa28a('0x4'))['db'];var utils=require(_0xa28a('0x5'));var logger=require('../../config/logger')(_0xa28a('0x6'));var config=require(_0xa28a('0x7'));var jayson=require(_0xa28a('0x8'));var client=jayson[_0xa28a('0x9')][_0xa28a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44184e,_0x34a80d,_0x542ddd){return new BPromise(function(_0x1024ed,_0x1bebc8){return client[_0xa28a('0xb')](_0x44184e,_0x542ddd)[_0xa28a('0xc')](function(_0x397000){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x34a80d,_0xa28a('0xd'));logger[_0xa28a('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x34a80d,'request\x20sent',JSON[_0xa28a('0xf')](_0x397000));if(_0x397000[_0xa28a('0x10')]){if(_0x397000[_0xa28a('0x10')][_0xa28a('0x11')]===0x1f4){logger[_0xa28a('0x10')](_0xa28a('0x12'),_0x34a80d,_0x397000[_0xa28a('0x10')][_0xa28a('0x13')]);return _0x1bebc8(_0x397000[_0xa28a('0x10')][_0xa28a('0x13')]);}logger[_0xa28a('0x10')](_0xa28a('0x12'),_0x34a80d,_0x397000[_0xa28a('0x10')][_0xa28a('0x13')]);return _0x1024ed(_0x397000['error'][_0xa28a('0x13')]);}else{logger[_0xa28a('0x14')](_0xa28a('0x12'),_0x34a80d,_0xa28a('0xd'));_0x1024ed(_0x397000['result'][_0xa28a('0x13')]);}})[_0xa28a('0x15')](function(_0x161476){logger[_0xa28a('0x10')](_0xa28a('0x12'),_0x34a80d,_0x161476);_0x1bebc8(_0x161476);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e8dea96..c864265 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(_0x53311a,_0x59a37e){var _0x29a7c3=function(_0xf1c36a){while(--_0xf1c36a){_0x53311a['push'](_0x53311a['shift']());}};_0x29a7c3(++_0x59a37e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x3456,_0x58beb2){var _0x4015ea=function(_0x1df2b4){while(--_0x1df2b4){_0x3456['push'](_0x3456['shift']());}};_0x4015ea(++_0x58beb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 03c3cc6..b12076b 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 _0x8533=['TEXT','sequelize','exports','STRING'];(function(_0x146be0,_0x39a85e){var _0x1bcc25=function(_0x4f871f){while(--_0x4f871f){_0x146be0['push'](_0x146be0['shift']());}};_0x1bcc25(++_0x39a85e);}(_0x8533,0x141));var _0x3853=function(_0x4c1ef2,_0x151329){_0x4c1ef2=_0x4c1ef2-0x0;var _0x18e3d8=_0x8533[_0x4c1ef2];return _0x18e3d8;};'use strict';var Sequelize=require(_0x3853('0x0'));module[_0x3853('0x1')]={'name':{'type':Sequelize[_0x3853('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x3853('0x2')]},'metric':{'type':Sequelize[_0x3853('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x56bd=['TEXT','exports','STRING','name'];(function(_0x42d789,_0x175d8f){var _0x13e40c=function(_0x40033e){while(--_0x40033e){_0x42d789['push'](_0x42d789['shift']());}};_0x13e40c(++_0x175d8f);}(_0x56bd,0xe9));var _0xd56b=function(_0x52afd8,_0x146bb8){_0x52afd8=_0x52afd8-0x0;var _0x25f938=_0x56bd[_0x52afd8];return _0x25f938;};'use strict';var Sequelize=require('sequelize');module[_0xd56b('0x0')]={'name':{'type':Sequelize[_0xd56b('0x1')],'allowNull':![],'unique':_0xd56b('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xd56b('0x3')]},'description':{'type':Sequelize[_0xd56b('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index a663cee..834d8f5 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 _0x84ab=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x84ab,0x12f));var _0xb84a=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x84ab[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){var _0x1aab7d=_0x3aa06f[_0xb84a('0x24')]({'plain':!![]});var _0x409df0=_0xb84a('0x25');return db[_0xb84a('0x26')][_0xb84a('0x23')]({'where':{'type':_0x409df0,'resourceId':_0x1aab7d['id']}})[_0xb84a('0x22')](function(){return _0x3aa06f;});})[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x1db72c,_0x2fe40d){return function(_0x35d1f7){if(!_0x35d1f7){_0x1db72c[_0xb84a('0x16')](0x194);}return _0x35d1f7;};}function handleError(_0x97d71b,_0x5349ea){_0x5349ea=_0x5349ea||0x1f4;return function(_0x582954){logger[_0xb84a('0x27')](_0x582954[_0xb84a('0x28')]);if(_0x582954['name']){delete _0x582954[_0xb84a('0x29')];}_0x97d71b[_0xb84a('0x17')](_0x5349ea)['send'](_0x582954);};}exports['index']=function(_0x28f2e7,_0x8e9319){var _0x49ba3d={},_0x251778={},_0xba1147={'count':0x0,'rows':[]};var _0x3abc22=_[_0xb84a('0x2a')](db[_0xb84a('0x2b')][_0xb84a('0x2c')],function(_0x34b212){return{'name':_0x34b212[_0xb84a('0x2d')],'type':_0x34b212['type'][_0xb84a('0x2e')]};});_0x251778['model']=_['map'](_0x3abc22,_0xb84a('0x29'));_0x251778[_0xb84a('0x2f')]=_['keys'](_0x28f2e7['query']);_0x251778[_0xb84a('0x30')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],_0x251778[_0xb84a('0x2f')]);_0x49ba3d[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],qs[_0xb84a('0x34')](_0x28f2e7['query'][_0xb84a('0x34')]));_0x49ba3d[_0xb84a('0x33')]=_0x49ba3d[_0xb84a('0x33')][_0xb84a('0x35')]?_0x49ba3d[_0xb84a('0x33')]:_0x251778[_0xb84a('0x32')];if(!_0x28f2e7[_0xb84a('0x2f')]['hasOwnProperty'](_0xb84a('0x36'))){_0x49ba3d['limit']=qs[_0xb84a('0x1c')](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x49ba3d['offset']=qs['offset'](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1a')]);}_0x49ba3d[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_0x28f2e7[_0xb84a('0x2f')]['sort']);_0x49ba3d[_0xb84a('0x39')]=qs[_0xb84a('0x30')](_['pick'](_0x28f2e7[_0xb84a('0x2f')],_0x251778[_0xb84a('0x30')]),_0x3abc22);if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3a')]){_0x49ba3d['where']=_['merge'](_0x49ba3d['where'],{'$or':_[_0xb84a('0x2a')](_0x3abc22,function(_0x11e1ac){if(_0x11e1ac[_0xb84a('0x3b')]!==_0xb84a('0x3c')){var _0x55b0b8={};_0x55b0b8[_0x11e1ac[_0xb84a('0x29')]]={'$like':'%'+_0x28f2e7['query'][_0xb84a('0x3a')]+'%'};return _0x55b0b8;}})});}_0x49ba3d=_['merge']({},_0x49ba3d,_0x28f2e7['options']);var _0x59d7a1={'where':_0x49ba3d[_0xb84a('0x39')]};return db[_0xb84a('0x2b')][_0xb84a('0x1d')](_0x59d7a1)[_0xb84a('0x22')](function(_0x5e547e){_0xba1147[_0xb84a('0x1d')]=_0x5e547e;if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x49ba3d[_0xb84a('0x3e')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x49ba3d);})[_0xb84a('0x22')](function(_0x1f3e04){_0xba1147['rows']=_0x1f3e04;return _0xba1147;})[_0xb84a('0x22')](respondWithFilteredResult(_0x8e9319,_0x49ba3d))[_0xb84a('0x3f')](handleError(_0x8e9319,null));};exports[_0xb84a('0x40')]=function(_0x25280a,_0x3f005b){var _0x241536={'raw':!![],'where':{'id':_0x25280a[_0xb84a('0x41')]['id']}},_0x24d700={};_0x24d700[_0xb84a('0x32')]=_[_0xb84a('0x42')](db[_0xb84a('0x2b')][_0xb84a('0x2c')]);_0x24d700[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x25280a[_0xb84a('0x2f')]);_0x24d700['filters']=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],_0x24d700[_0xb84a('0x2f')]);_0x241536[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],qs['fields'](_0x25280a[_0xb84a('0x2f')]['fields']));_0x241536[_0xb84a('0x33')]=_0x241536[_0xb84a('0x33')][_0xb84a('0x35')]?_0x241536[_0xb84a('0x33')]:_0x24d700['model'];if(_0x25280a[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x241536[_0xb84a('0x3e')]=[{'all':!![]}];}_0x241536=_['merge']({},_0x241536,_0x25280a['options']);return db[_0xb84a('0x2b')][_0xb84a('0x43')](_0x241536)[_0xb84a('0x22')](handleEntityNotFound(_0x3f005b,null))['then'](respondWithResult(_0x3f005b,null))['catch'](handleError(_0x3f005b,null));};exports['create']=function(_0x45630d,_0x384a0d){return db[_0xb84a('0x2b')][_0xb84a('0x44')](_0x45630d[_0xb84a('0x45')],{})['then'](function(_0x4b40fe){var _0x5b853a=_0x45630d['user'][_0xb84a('0x24')]({'plain':!![]});if(!_0x5b853a)throw new Error(_0xb84a('0x46'));if(_0x5b853a['role']===_0xb84a('0x47')){var _0xc8bac2=_0x4b40fe[_0xb84a('0x24')]({'plain':!![]});var _0x2f70f0=_0xb84a('0x25');return db[_0xb84a('0x48')]['find']({'where':{'name':_0x2f70f0,'userProfileId':_0x5b853a['userProfileId']},'raw':!![]})[_0xb84a('0x22')](function(_0x50172a){if(_0x50172a&&_0x50172a[_0xb84a('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xc8bac2['name'],'resourceId':_0xc8bac2['id'],'type':_0x50172a[_0xb84a('0x29')],'sectionId':_0x50172a['id']},{})[_0xb84a('0x22')](function(){return _0x4b40fe;});}else{return _0x4b40fe;}})[_0xb84a('0x3f')](function(_0x25b6a0){logger[_0xb84a('0x27')](_0xb84a('0x4a'),_0x25b6a0);throw _0x25b6a0;});}return _0x4b40fe;})[_0xb84a('0x22')](respondWithResult(_0x384a0d,0xc9))[_0xb84a('0x3f')](handleError(_0x384a0d,null));};exports['update']=function(_0x5afdd0,_0x4c5bdf){if(_0x5afdd0[_0xb84a('0x45')]['id']){delete _0x5afdd0[_0xb84a('0x45')]['id'];}return db['AnalyticMetric'][_0xb84a('0x43')]({'where':{'id':_0x5afdd0['params']['id']}})['then'](handleEntityNotFound(_0x4c5bdf,null))['then'](saveUpdates(_0x5afdd0[_0xb84a('0x45')],null))[_0xb84a('0x22')](respondWithResult(_0x4c5bdf,null))[_0xb84a('0x3f')](handleError(_0x4c5bdf,null));};exports['destroy']=function(_0x5f757e,_0x2e98bf){return db[_0xb84a('0x2b')]['find']({'where':{'id':_0x5f757e[_0xb84a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e98bf,null))['then'](removeEntity(_0x2e98bf,null))[_0xb84a('0x3f')](handleError(_0x2e98bf,null));}; \ No newline at end of file +var _0x55ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','AnalyticMetric','findAll','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5f0627,_0x72504a){var _0x490fe6=function(_0x421e95){while(--_0x421e95){_0x5f0627['push'](_0x5f0627['shift']());}};_0x490fe6(++_0x72504a);}(_0x55ca,0x126));var _0xa55c=function(_0x46bb73,_0x44f394){_0x46bb73=_0x46bb73-0x0;var _0x44f271=_0x55ca[_0x46bb73];return _0x44f271;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){var _0x54b038=_0x5ba836[_0xa55c('0x21')]({'plain':!![]});var _0x190757=_0xa55c('0x22');return db[_0xa55c('0x23')][_0xa55c('0x24')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x20')](function(){return _0x5ba836;});})[_0xa55c('0x20')](function(){_0x1fc828[_0xa55c('0x18')](0xcc)[_0xa55c('0x25')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x26')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x18')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=_[_0xa55c('0x2b')](db['AnalyticMetric'][_0xa55c('0x2c')],function(_0x2096ae){return{'name':_0x2096ae[_0xa55c('0x2d')],'type':_0x2096ae[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x35c9c2[_0xa55c('0x30')]=_[_0xa55c('0x2b')](_0x1cc53e,_0xa55c('0x28'));_0x35c9c2[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x52d37f[_0xa55c('0x31')]);_0x35c9c2['filters']=_['intersection'](_0x35c9c2[_0xa55c('0x30')],_0x35c9c2[_0xa55c('0x31')]);_0x490b7d['attributes']=_[_0xa55c('0x33')](_0x35c9c2[_0xa55c('0x30')],qs[_0xa55c('0x34')](_0x52d37f[_0xa55c('0x31')][_0xa55c('0x34')]));_0x490b7d[_0xa55c('0x35')]=_0x490b7d[_0xa55c('0x35')][_0xa55c('0x36')]?_0x490b7d[_0xa55c('0x35')]:_0x35c9c2['model'];if(!_0x52d37f['query']['hasOwnProperty'](_0xa55c('0x37'))){_0x490b7d[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x52d37f['query'][_0xa55c('0x1c')]);_0x490b7d['offset']=qs[_0xa55c('0x1a')](_0x52d37f['query'][_0xa55c('0x1a')]);}_0x490b7d[_0xa55c('0x38')]=qs[_0xa55c('0x39')](_0x52d37f['query'][_0xa55c('0x39')]);_0x490b7d[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x52d37f[_0xa55c('0x31')],_0x35c9c2['filters']),_0x1cc53e);if(_0x52d37f['query'][_0xa55c('0x3c')]){_0x490b7d['where']=_[_0xa55c('0x3d')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x542d76){if(_0x542d76['type']!=='VIRTUAL'){var _0x3b3308={};_0x3b3308[_0x542d76[_0xa55c('0x28')]]={'$like':'%'+_0x52d37f[_0xa55c('0x31')][_0xa55c('0x3c')]+'%'};return _0x3b3308;}})});}_0x490b7d=_[_0xa55c('0x3d')]({},_0x490b7d,_0x52d37f['options']);var _0x3d52d8={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1d')](_0x3d52d8)[_0xa55c('0x20')](function(_0x23cef5){_0x1d730b['count']=_0x23cef5;if(_0x52d37f[_0xa55c('0x31')]['includeAll']){_0x490b7d['include']=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x3f')](_0x490b7d);})['then'](function(_0x2bd98b){_0x1d730b['rows']=_0x2bd98b;return _0x1d730b;})['then'](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports[_0xa55c('0x41')]=function(_0x1630ac,_0x540337){var _0x1b2708={'raw':!![],'where':{'id':_0x1630ac['params']['id']}},_0xd5a006={};_0xd5a006[_0xa55c('0x30')]=_['keys'](db[_0xa55c('0x3e')][_0xa55c('0x2c')]);_0xd5a006['query']=_[_0xa55c('0x32')](_0x1630ac[_0xa55c('0x31')]);_0xd5a006['filters']=_[_0xa55c('0x33')](_0xd5a006[_0xa55c('0x30')],_0xd5a006[_0xa55c('0x31')]);_0x1b2708['attributes']=_[_0xa55c('0x33')](_0xd5a006['model'],qs[_0xa55c('0x34')](_0x1630ac[_0xa55c('0x31')][_0xa55c('0x34')]));_0x1b2708['attributes']=_0x1b2708[_0xa55c('0x35')][_0xa55c('0x36')]?_0x1b2708['attributes']:_0xd5a006[_0xa55c('0x30')];if(_0x1630ac[_0xa55c('0x31')]['includeAll']){_0x1b2708[_0xa55c('0x42')]=[{'all':!![]}];}_0x1b2708=_[_0xa55c('0x3d')]({},_0x1b2708,_0x1630ac['options']);return db[_0xa55c('0x3e')][_0xa55c('0x43')](_0x1b2708)[_0xa55c('0x20')](handleEntityNotFound(_0x540337,null))[_0xa55c('0x20')](respondWithResult(_0x540337,null))['catch'](handleError(_0x540337,null));};exports[_0xa55c('0x44')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x3e')][_0xa55c('0x44')](_0x58a7ea['body'],{})[_0xa55c('0x20')](function(_0x250b00){var _0x574fe9=_0x58a7ea[_0xa55c('0x45')][_0xa55c('0x21')]({'plain':!![]});if(!_0x574fe9)throw new Error(_0xa55c('0x46'));if(_0x574fe9[_0xa55c('0x47')]===_0xa55c('0x45')){var _0x1c84d9=_0x250b00[_0xa55c('0x21')]({'plain':!![]});var _0x129626=_0xa55c('0x22');return db[_0xa55c('0x48')]['find']({'where':{'name':_0x129626,'userProfileId':_0x574fe9[_0xa55c('0x49')]},'raw':!![]})[_0xa55c('0x20')](function(_0x216de8){if(_0x216de8&&_0x216de8['autoAssociation']===0x0){return db[_0xa55c('0x23')][_0xa55c('0x44')]({'name':_0x1c84d9['name'],'resourceId':_0x1c84d9['id'],'type':_0x216de8[_0xa55c('0x28')],'sectionId':_0x216de8['id']},{})['then'](function(){return _0x250b00;});}else{return _0x250b00;}})[_0xa55c('0x40')](function(_0x228df4){logger[_0xa55c('0x4a')](_0xa55c('0x4b'),_0x228df4);throw _0x228df4;});}return _0x250b00;})[_0xa55c('0x20')](respondWithResult(_0x2157d6,0xc9))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x1f')]=function(_0x4607ca,_0x4b85cc){if(_0x4607ca[_0xa55c('0x4c')]['id']){delete _0x4607ca[_0xa55c('0x4c')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x4607ca['params']['id']}})['then'](handleEntityNotFound(_0x4b85cc,null))[_0xa55c('0x20')](saveUpdates(_0x4607ca[_0xa55c('0x4c')],null))[_0xa55c('0x20')](respondWithResult(_0x4b85cc,null))[_0xa55c('0x40')](handleError(_0x4b85cc,null));};exports['destroy']=function(_0x30c0c9,_0x5ce463){return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x30c0c9[_0xa55c('0x4d')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x5ce463,null))[_0xa55c('0x20')](removeEntity(_0x5ce463,null))['catch'](handleError(_0x5ce463,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 27c214f..779f70a 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 _0x6455=['request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2a3022,_0x2f328c){var _0x366c96=function(_0x264829){while(--_0x264829){_0x2a3022['push'](_0x2a3022['shift']());}};_0x366c96(++_0x2f328c);}(_0x6455,0x97));var _0x5645=function(_0x2b0478,_0x15228a){_0x2b0478=_0x2b0478-0x0;var _0x5a8a71=_0x6455[_0x2b0478];return _0x5a8a71;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require(_0x5645('0x4'));var rp=require(_0x5645('0x5'));var fs=require('fs');var path=require(_0x5645('0x6'));var rimraf=require('rimraf');var config=require(_0x5645('0x7'));var attributes=require(_0x5645('0x8'));module[_0x5645('0x9')]=function(_0x9400a8,_0x3a635d){return _0x9400a8[_0x5645('0xa')](_0x5645('0xb'),attributes,{'tableName':_0x5645('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7de=['../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7de,0x165));var _0xee7d=function(_0x1a01ce,_0x2107bf){_0x1a01ce=_0x1a01ce-0x0;var _0x5ac25e=_0xe7de[_0x1a01ce];return _0x5ac25e;};'use strict';var _=require(_0xee7d('0x0'));var util=require(_0xee7d('0x1'));var logger=require(_0xee7d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xee7d('0x3'));var rp=require(_0xee7d('0x4'));var fs=require('fs');var path=require(_0xee7d('0x5'));var rimraf=require(_0xee7d('0x6'));var config=require(_0xee7d('0x7'));var attributes=require(_0xee7d('0x8'));module[_0xee7d('0x9')]=function(_0x215ba4,_0x401cd0){return _0x215ba4[_0xee7d('0xa')](_0xee7d('0xb'),attributes,{'tableName':_0xee7d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 982220a..b17fb4e 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 _0xe7f8=['error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4c0a0e,_0x2e4b1a){var _0x284bd0=function(_0x3b4f3d){while(--_0x3b4f3d){_0x4c0a0e['push'](_0x4c0a0e['shift']());}};_0x284bd0(++_0x2e4b1a);}(_0xe7f8,0xb7));var _0x8e7f=function(_0x3cae65,_0x55ce92){_0x3cae65=_0x3cae65-0x0;var _0x1620d1=_0xe7f8[_0x3cae65];return _0x1620d1;};'use strict';var _=require(_0x8e7f('0x0'));var util=require(_0x8e7f('0x1'));var moment=require(_0x8e7f('0x2'));var BPromise=require(_0x8e7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e7f('0x4'));var db=require(_0x8e7f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e7f('0x6'))('rpc');var config=require(_0x8e7f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8e7f('0x8')][_0x8e7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x250340,_0x334c22,_0xf5cf98){return new BPromise(function(_0x4a1418,_0x1afaac){return client[_0x8e7f('0xa')](_0x250340,_0xf5cf98)[_0x8e7f('0xb')](function(_0x388d61){logger[_0x8e7f('0xc')](_0x8e7f('0xd'),_0x334c22,_0x8e7f('0xe'));logger[_0x8e7f('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x334c22,'request\x20sent',JSON[_0x8e7f('0x10')](_0x388d61));if(_0x388d61[_0x8e7f('0x11')]){if(_0x388d61[_0x8e7f('0x11')][_0x8e7f('0x12')]===0x1f4){logger[_0x8e7f('0x11')](_0x8e7f('0xd'),_0x334c22,_0x388d61['error'][_0x8e7f('0x13')]);return _0x1afaac(_0x388d61[_0x8e7f('0x11')]['message']);}logger[_0x8e7f('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x334c22,_0x388d61[_0x8e7f('0x11')]['message']);return _0x4a1418(_0x388d61['error'][_0x8e7f('0x13')]);}else{logger['info'](_0x8e7f('0xd'),_0x334c22,_0x8e7f('0xe'));_0x4a1418(_0x388d61['result']['message']);}})['catch'](function(_0x27dd05){logger['error'](_0x8e7f('0xd'),_0x334c22,_0x27dd05);_0x1afaac(_0x27dd05);});});} \ No newline at end of file +var _0xb59a=['client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise'];(function(_0x41b0d4,_0x2d42ea){var _0x539360=function(_0xd28f6f){while(--_0xd28f6f){_0x41b0d4['push'](_0x41b0d4['shift']());}};_0x539360(++_0x2d42ea);}(_0xb59a,0xc0));var _0xab59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb59a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab59('0x0'));var util=require('util');var moment=require(_0xab59('0x1'));var BPromise=require(_0xab59('0x2'));var rs=require(_0xab59('0x3'));var fs=require('fs');var Redis=require(_0xab59('0x4'));var db=require(_0xab59('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xab59('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab59('0x7'));var client=jayson[_0xab59('0x8')][_0xab59('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32f0ac,_0x13e0bb,_0x37497a){return new BPromise(function(_0x5bf84c,_0x55c0fa){return client[_0xab59('0xa')](_0x32f0ac,_0x37497a)[_0xab59('0xb')](function(_0x4e4ba6){logger[_0xab59('0xc')](_0xab59('0xd'),_0x13e0bb,_0xab59('0xe'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x13e0bb,_0xab59('0xe'),JSON[_0xab59('0xf')](_0x4e4ba6));if(_0x4e4ba6[_0xab59('0x10')]){if(_0x4e4ba6[_0xab59('0x10')][_0xab59('0x11')]===0x1f4){logger[_0xab59('0x10')](_0xab59('0xd'),_0x13e0bb,_0x4e4ba6[_0xab59('0x10')][_0xab59('0x12')]);return _0x55c0fa(_0x4e4ba6[_0xab59('0x10')][_0xab59('0x12')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x13e0bb,_0x4e4ba6['error'][_0xab59('0x12')]);return _0x5bf84c(_0x4e4ba6[_0xab59('0x10')][_0xab59('0x12')]);}else{logger['info'](_0xab59('0xd'),_0x13e0bb,_0xab59('0xe'));_0x5bf84c(_0x4e4ba6['result'][_0xab59('0x12')]);}})[_0xab59('0x13')](function(_0x70cdf2){logger[_0xab59('0x10')](_0xab59('0xd'),_0x13e0bb,_0x70cdf2);_0x55c0fa(_0x70cdf2);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 5cd080e..f1b9ebc 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 _0x0d4d=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','post','create'];(function(_0xa1600d,_0xfc6b98){var _0x38ba23=function(_0x2c997d){while(--_0x2c997d){_0xa1600d['push'](_0xa1600d['shift']());}};_0x38ba23(++_0xfc6b98);}(_0x0d4d,0x132));var _0xd0d4=function(_0x48089b,_0x2e6d68){_0x48089b=_0x48089b-0x0;var _0x1eeeaa=_0x0d4d[_0x48089b];return _0x1eeeaa;};'use strict';var multer=require(_0xd0d4('0x0'));var util=require(_0xd0d4('0x1'));var path=require(_0xd0d4('0x2'));var timeout=require(_0xd0d4('0x3'));var express=require(_0xd0d4('0x4'));var router=express[_0xd0d4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd0d4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd0d4('0x7'));var controller=require(_0xd0d4('0x8'));router['get']('/',auth[_0xd0d4('0x9')](),controller[_0xd0d4('0xa')]);router[_0xd0d4('0xb')]('/:id',auth[_0xd0d4('0x9')](),controller['show']);router[_0xd0d4('0xc')]('/',auth['isAuthenticated'](),controller[_0xd0d4('0xd')]);router[_0xd0d4('0xe')](_0xd0d4('0xf'),auth['isAuthenticated'](),controller[_0xd0d4('0x10')]);router[_0xd0d4('0x11')](_0xd0d4('0xf'),auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x12')]);module[_0xd0d4('0x13')]=router; \ No newline at end of file +var _0x891b=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','index','show','post','isAuthenticated','create','put','/:id','delete','destroy','exports','path'];(function(_0x504a3e,_0x220f95){var _0x35996e=function(_0x2ee74c){while(--_0x2ee74c){_0x504a3e['push'](_0x504a3e['shift']());}};_0x35996e(++_0x220f95);}(_0x891b,0xc5));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb891('0x0'));var timeout=require(_0xb891('0x1'));var express=require('express');var router=express[_0xb891('0x2')]();var fs_extra=require(_0xb891('0x3'));var auth=require(_0xb891('0x4'));var interaction=require(_0xb891('0x5'));var config=require('../../config/environment');var controller=require(_0xb891('0x6'));router[_0xb891('0x7')]('/',auth['isAuthenticated'](),controller[_0xb891('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb891('0x9')]);router[_0xb891('0xa')]('/',auth[_0xb891('0xb')](),controller[_0xb891('0xc')]);router[_0xb891('0xd')](_0xb891('0xe'),auth[_0xb891('0xb')](),controller['update']);router[_0xb891('0xf')](_0xb891('0xe'),auth[_0xb891('0xb')](),controller[_0xb891('0x10')]);module[_0xb891('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index c390c66..48b1854 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 _0x07a8=['TEXT','sequelize'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x07a8,0x141));var _0x807a=function(_0x3820ff,_0x17a634){_0x3820ff=_0x3820ff-0x0;var _0x3a0f7f=_0x07a8[_0x3820ff];return _0x3a0f7f;};'use strict';var Sequelize=require(_0x807a('0x0'));module['exports']={'tree':{'type':Sequelize[_0x807a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x6e68=['TEXT','sequelize'];(function(_0xaed60,_0x4e9ee4){var _0x2d7850=function(_0x3d4043){while(--_0x3d4043){_0xaed60['push'](_0xaed60['shift']());}};_0x2d7850(++_0x4e9ee4);}(_0x6e68,0xc3));var _0x86e6=function(_0x2db6ed,_0xf467d9){_0x2db6ed=_0x2db6ed-0x0;var _0x53a474=_0x6e68[_0x2db6ed];return _0x53a474;};'use strict';var Sequelize=require(_0x86e6('0x0'));module['exports']={'tree':{'type':Sequelize[_0x86e6('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 4935f59..cf8b20a 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 _0x92b0=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','AnalyticTreeReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x2b4008,_0x50f999){var _0x4661cd=function(_0x41504c){while(--_0x41504c){_0x2b4008['push'](_0x2b4008['shift']());}};_0x4661cd(++_0x50f999);}(_0x92b0,0x1ee));var _0x092b=function(_0x4fc7bb,_0x105832){_0x4fc7bb=_0x4fc7bb-0x0;var _0x28e655=_0x92b0[_0x4fc7bb];return _0x28e655;};'use strict';var emlformat=require(_0x092b('0x0'));var rimraf=require(_0x092b('0x1'));var zipdir=require(_0x092b('0x2'));var jsonpatch=require(_0x092b('0x3'));var rp=require(_0x092b('0x4'));var moment=require(_0x092b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x092b('0x6'));var util=require(_0x092b('0x7'));var path=require(_0x092b('0x8'));var sox=require(_0x092b('0x9'));var csv=require(_0x092b('0xa'));var ejs=require(_0x092b('0xb'));var fs=require('fs');var fs_extra=require(_0x092b('0xc'));var _=require(_0x092b('0xd'));var squel=require(_0x092b('0xe'));var crypto=require(_0x092b('0xf'));var jsforce=require(_0x092b('0x10'));var deskjs=require(_0x092b('0x11'));var toCsv=require(_0x092b('0xa'));var querystring=require(_0x092b('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x092b('0x13'));var as=require(_0x092b('0x14'));var hardwareService=require(_0x092b('0x15'));var logger=require(_0x092b('0x16'))(_0x092b('0x17'));var utils=require(_0x092b('0x18'));var config=require(_0x092b('0x19'));var licenseUtil=require(_0x092b('0x1a'));var db=require(_0x092b('0x1b'))['db'];function respondWithStatusCode(_0x261b04,_0x20a891){_0x20a891=_0x20a891||0xcc;return function(_0xe67f43){if(_0xe67f43){return _0x261b04[_0x092b('0x1c')](_0x20a891);}return _0x261b04[_0x092b('0x1d')](_0x20a891)[_0x092b('0x1e')]();};}function respondWithResult(_0x511c0b,_0x1e3605){_0x1e3605=_0x1e3605||0xc8;return function(_0x106a0a){if(_0x106a0a){return _0x511c0b[_0x092b('0x1d')](_0x1e3605)[_0x092b('0x1f')](_0x106a0a);}};}function respondWithFilteredResult(_0x5ad749,_0xacd9cb){return function(_0xecaf7c){if(_0xecaf7c){var _0x467503=typeof _0xacd9cb[_0x092b('0x20')]===_0x092b('0x21')&&typeof _0xacd9cb[_0x092b('0x22')]===_0x092b('0x21');var _0xf4ab9c=_0xecaf7c['count'];var _0x299537=_0x467503?0x0:_0xacd9cb[_0x092b('0x20')];var _0x49149d=_0x467503?_0xecaf7c[_0x092b('0x23')]:_0xacd9cb['offset']+_0xacd9cb[_0x092b('0x22')];var _0x103579;if(_0x49149d>=_0xf4ab9c){_0x49149d=_0xf4ab9c;_0x103579=0xc8;}else{_0x103579=0xce;}_0x5ad749[_0x092b('0x1d')](_0x103579);return _0x5ad749['set'](_0x092b('0x24'),_0x299537+'-'+_0x49149d+'/'+_0xf4ab9c)[_0x092b('0x1f')](_0xecaf7c);}return null;};}function patchUpdates(_0x53c44d){return function(_0x3dc9bc){try{jsonpatch[_0x092b('0x25')](_0x3dc9bc,_0x53c44d,!![]);}catch(_0x474de2){return BPromise[_0x092b('0x26')](_0x474de2);}return _0x3dc9bc[_0x092b('0x27')]();};}function saveUpdates(_0x35c85f,_0x2efedf){return function(_0x2cff9f){if(_0x2cff9f){return _0x2cff9f[_0x092b('0x28')](_0x35c85f)[_0x092b('0x29')](function(_0x5cf8e1){return _0x5cf8e1;});}return null;};}function removeEntity(_0x163995,_0x4e2440){return function(_0x948492){if(_0x948492){return _0x948492[_0x092b('0x2a')]()['then'](function(){_0x163995[_0x092b('0x1d')](0xcc)[_0x092b('0x1e')]();});}};}function handleEntityNotFound(_0x1101c9,_0x28408c){return function(_0x4a3420){if(!_0x4a3420){_0x1101c9[_0x092b('0x1c')](0x194);}return _0x4a3420;};}function handleError(_0x43ceb0,_0x2d79e2){_0x2d79e2=_0x2d79e2||0x1f4;return function(_0x29c8ae){logger[_0x092b('0x2b')](_0x29c8ae['stack']);if(_0x29c8ae[_0x092b('0x2c')]){delete _0x29c8ae[_0x092b('0x2c')];}_0x43ceb0[_0x092b('0x1d')](_0x2d79e2)['send'](_0x29c8ae);};}exports['index']=function(_0x4cfdb9,_0x39cbdc){var _0x3362bd={},_0x1bb447={},_0x1bbb1a={'count':0x0,'rows':[]};var _0x3de5c4=_['map'](db[_0x092b('0x2d')][_0x092b('0x2e')],function(_0x385a7e){return{'name':_0x385a7e['fieldName'],'type':_0x385a7e[_0x092b('0x2f')][_0x092b('0x30')]};});_0x1bb447[_0x092b('0x31')]=_['map'](_0x3de5c4,_0x092b('0x2c'));_0x1bb447[_0x092b('0x32')]=_[_0x092b('0x33')](_0x4cfdb9[_0x092b('0x32')]);_0x1bb447[_0x092b('0x34')]=_[_0x092b('0x35')](_0x1bb447['model'],_0x1bb447[_0x092b('0x32')]);_0x3362bd[_0x092b('0x36')]=_[_0x092b('0x35')](_0x1bb447[_0x092b('0x31')],qs[_0x092b('0x37')](_0x4cfdb9[_0x092b('0x32')][_0x092b('0x37')]));_0x3362bd[_0x092b('0x36')]=_0x3362bd[_0x092b('0x36')][_0x092b('0x38')]?_0x3362bd[_0x092b('0x36')]:_0x1bb447[_0x092b('0x31')];if(!_0x4cfdb9['query']['hasOwnProperty'](_0x092b('0x39'))){_0x3362bd[_0x092b('0x22')]=qs['limit'](_0x4cfdb9['query']['limit']);_0x3362bd['offset']=qs[_0x092b('0x20')](_0x4cfdb9[_0x092b('0x32')][_0x092b('0x20')]);}_0x3362bd[_0x092b('0x3a')]=qs[_0x092b('0x3b')](_0x4cfdb9['query']['sort']);_0x3362bd['where']=qs[_0x092b('0x34')](_[_0x092b('0x3c')](_0x4cfdb9[_0x092b('0x32')],_0x1bb447[_0x092b('0x34')]),_0x3de5c4);if(_0x4cfdb9[_0x092b('0x32')][_0x092b('0x3d')]){_0x3362bd[_0x092b('0x3e')]=_[_0x092b('0x3f')](_0x3362bd['where'],{'$or':_['map'](_0x3de5c4,function(_0x2ad4f0){if(_0x2ad4f0[_0x092b('0x2f')]!==_0x092b('0x40')){var _0x7062a8={};_0x7062a8[_0x2ad4f0['name']]={'$like':'%'+_0x4cfdb9[_0x092b('0x32')][_0x092b('0x3d')]+'%'};return _0x7062a8;}})});}_0x3362bd=_['merge']({},_0x3362bd,_0x4cfdb9['options']);var _0x1fde21={'where':_0x3362bd['where']};return db[_0x092b('0x2d')][_0x092b('0x23')](_0x1fde21)['then'](function(_0x47daf9){_0x1bbb1a['count']=_0x47daf9;if(_0x4cfdb9[_0x092b('0x32')][_0x092b('0x41')]){_0x3362bd[_0x092b('0x42')]=[{'all':!![]}];}return db[_0x092b('0x2d')][_0x092b('0x43')](_0x3362bd);})[_0x092b('0x29')](function(_0x302291){_0x1bbb1a['rows']=_0x302291;return _0x1bbb1a;})[_0x092b('0x29')](respondWithFilteredResult(_0x39cbdc,_0x3362bd))[_0x092b('0x44')](handleError(_0x39cbdc,null));};exports[_0x092b('0x45')]=function(_0x1211b5,_0x4f1769){var _0x20a59f={'raw':!![],'where':{'id':_0x1211b5[_0x092b('0x46')]['id']}},_0x1dac16={};_0x1dac16['model']=_[_0x092b('0x33')](db[_0x092b('0x2d')][_0x092b('0x2e')]);_0x1dac16[_0x092b('0x32')]=_[_0x092b('0x33')](_0x1211b5[_0x092b('0x32')]);_0x1dac16[_0x092b('0x34')]=_[_0x092b('0x35')](_0x1dac16[_0x092b('0x31')],_0x1dac16[_0x092b('0x32')]);_0x20a59f['attributes']=_[_0x092b('0x35')](_0x1dac16[_0x092b('0x31')],qs[_0x092b('0x37')](_0x1211b5[_0x092b('0x32')][_0x092b('0x37')]));_0x20a59f[_0x092b('0x36')]=_0x20a59f['attributes'][_0x092b('0x38')]?_0x20a59f['attributes']:_0x1dac16[_0x092b('0x31')];if(_0x1211b5[_0x092b('0x32')][_0x092b('0x41')]){_0x20a59f[_0x092b('0x42')]=[{'all':!![]}];}_0x20a59f=_['merge']({},_0x20a59f,_0x1211b5[_0x092b('0x47')]);return db[_0x092b('0x2d')]['find'](_0x20a59f)[_0x092b('0x29')](handleEntityNotFound(_0x4f1769,null))[_0x092b('0x29')](respondWithResult(_0x4f1769,null))[_0x092b('0x44')](handleError(_0x4f1769,null));};exports['create']=function(_0x1883b4,_0xd840e4){return db[_0x092b('0x2d')][_0x092b('0x48')](_0x1883b4[_0x092b('0x49')],{})['then'](respondWithResult(_0xd840e4,0xc9))[_0x092b('0x44')](handleError(_0xd840e4,null));};exports[_0x092b('0x28')]=function(_0x34e234,_0x3c7dd5){if(_0x34e234[_0x092b('0x49')]['id']){delete _0x34e234['body']['id'];}return db[_0x092b('0x2d')]['find']({'where':{'id':_0x34e234['params']['id']}})[_0x092b('0x29')](handleEntityNotFound(_0x3c7dd5,null))['then'](saveUpdates(_0x34e234[_0x092b('0x49')],null))[_0x092b('0x29')](respondWithResult(_0x3c7dd5,null))[_0x092b('0x44')](handleError(_0x3c7dd5,null));};exports[_0x092b('0x2a')]=function(_0x2001a9,_0x28b88a){return db[_0x092b('0x2d')][_0x092b('0x4a')]({'where':{'id':_0x2001a9[_0x092b('0x46')]['id']}})[_0x092b('0x29')](handleEntityNotFound(_0x28b88a,null))[_0x092b('0x29')](removeEntity(_0x28b88a,null))[_0x092b('0x44')](handleError(_0x28b88a,null));}; \ No newline at end of file +var _0x8159=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','include','findAll','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x56555a,_0x227c9d){var _0x29066e=function(_0x254c44){while(--_0x254c44){_0x56555a['push'](_0x56555a['shift']());}};_0x29066e(++_0x227c9d);}(_0x8159,0x8c));var _0x9815=function(_0x28ec9f,_0xee002f){_0x28ec9f=_0x28ec9f-0x0;var _0x31e62d=_0x8159[_0x28ec9f];return _0x31e62d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9815('0x0'));var zipdir=require(_0x9815('0x1'));var jsonpatch=require(_0x9815('0x2'));var rp=require('request-promise');var moment=require(_0x9815('0x3'));var BPromise=require(_0x9815('0x4'));var Mustache=require(_0x9815('0x5'));var util=require(_0x9815('0x6'));var path=require(_0x9815('0x7'));var sox=require(_0x9815('0x8'));var csv=require(_0x9815('0x9'));var ejs=require(_0x9815('0xa'));var fs=require('fs');var fs_extra=require(_0x9815('0xb'));var _=require(_0x9815('0xc'));var squel=require(_0x9815('0xd'));var crypto=require(_0x9815('0xe'));var jsforce=require(_0x9815('0xf'));var deskjs=require(_0x9815('0x10'));var toCsv=require(_0x9815('0x9'));var querystring=require(_0x9815('0x11'));var Papa=require(_0x9815('0x12'));var Redis=require(_0x9815('0x13'));var authService=require(_0x9815('0x14'));var qs=require(_0x9815('0x15'));var as=require(_0x9815('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9815('0x17'))(_0x9815('0x18'));var utils=require('../../config/utils');var config=require(_0x9815('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x487090,_0x5cccde){_0x5cccde=_0x5cccde||0xcc;return function(_0x85ac11){if(_0x85ac11){return _0x487090['sendStatus'](_0x5cccde);}return _0x487090[_0x9815('0x1a')](_0x5cccde)[_0x9815('0x1b')]();};}function respondWithResult(_0xf662cb,_0x4b67f2){_0x4b67f2=_0x4b67f2||0xc8;return function(_0xa25ac4){if(_0xa25ac4){return _0xf662cb['status'](_0x4b67f2)[_0x9815('0x1c')](_0xa25ac4);}};}function respondWithFilteredResult(_0x5e9ca7,_0x1c776d){return function(_0x474a51){if(_0x474a51){var _0x1e551d=typeof _0x1c776d[_0x9815('0x1d')]==='undefined'&&typeof _0x1c776d[_0x9815('0x1e')]===_0x9815('0x1f');var _0x5d4de9=_0x474a51['count'];var _0x2570aa=_0x1e551d?0x0:_0x1c776d[_0x9815('0x1d')];var _0x23599b=_0x1e551d?_0x474a51[_0x9815('0x20')]:_0x1c776d[_0x9815('0x1d')]+_0x1c776d[_0x9815('0x1e')];var _0x2c6a13;if(_0x23599b>=_0x5d4de9){_0x23599b=_0x5d4de9;_0x2c6a13=0xc8;}else{_0x2c6a13=0xce;}_0x5e9ca7[_0x9815('0x1a')](_0x2c6a13);return _0x5e9ca7['set'](_0x9815('0x21'),_0x2570aa+'-'+_0x23599b+'/'+_0x5d4de9)[_0x9815('0x1c')](_0x474a51);}return null;};}function patchUpdates(_0x33b939){return function(_0x42d081){try{jsonpatch[_0x9815('0x22')](_0x42d081,_0x33b939,!![]);}catch(_0x2ea574){return BPromise[_0x9815('0x23')](_0x2ea574);}return _0x42d081[_0x9815('0x24')]();};}function saveUpdates(_0x1d75a6,_0x57428b){return function(_0x5713d8){if(_0x5713d8){return _0x5713d8[_0x9815('0x25')](_0x1d75a6)[_0x9815('0x26')](function(_0x4e1d40){return _0x4e1d40;});}return null;};}function removeEntity(_0x7d8611,_0x281098){return function(_0x3e489b){if(_0x3e489b){return _0x3e489b[_0x9815('0x27')]()[_0x9815('0x26')](function(){_0x7d8611[_0x9815('0x1a')](0xcc)[_0x9815('0x1b')]();});}};}function handleEntityNotFound(_0x21cc31,_0x6b6cff){return function(_0x50a253){if(!_0x50a253){_0x21cc31[_0x9815('0x28')](0x194);}return _0x50a253;};}function handleError(_0x5b4655,_0x58fcc8){_0x58fcc8=_0x58fcc8||0x1f4;return function(_0x518e82){logger['error'](_0x518e82[_0x9815('0x29')]);if(_0x518e82['name']){delete _0x518e82[_0x9815('0x2a')];}_0x5b4655['status'](_0x58fcc8)[_0x9815('0x2b')](_0x518e82);};}exports[_0x9815('0x2c')]=function(_0x5426dc,_0x2fe93f){var _0x1914e8={},_0x338bc9={},_0x4a58ff={'count':0x0,'rows':[]};var _0xb32697=_[_0x9815('0x2d')](db['AnalyticTreeReport'][_0x9815('0x2e')],function(_0x5b9119){return{'name':_0x5b9119[_0x9815('0x2f')],'type':_0x5b9119[_0x9815('0x30')][_0x9815('0x31')]};});_0x338bc9[_0x9815('0x32')]=_[_0x9815('0x2d')](_0xb32697,_0x9815('0x2a'));_0x338bc9['query']=_['keys'](_0x5426dc[_0x9815('0x33')]);_0x338bc9[_0x9815('0x34')]=_['intersection'](_0x338bc9[_0x9815('0x32')],_0x338bc9['query']);_0x1914e8[_0x9815('0x35')]=_[_0x9815('0x36')](_0x338bc9[_0x9815('0x32')],qs[_0x9815('0x37')](_0x5426dc[_0x9815('0x33')][_0x9815('0x37')]));_0x1914e8['attributes']=_0x1914e8['attributes'][_0x9815('0x38')]?_0x1914e8[_0x9815('0x35')]:_0x338bc9[_0x9815('0x32')];if(!_0x5426dc[_0x9815('0x33')][_0x9815('0x39')](_0x9815('0x3a'))){_0x1914e8[_0x9815('0x1e')]=qs['limit'](_0x5426dc[_0x9815('0x33')][_0x9815('0x1e')]);_0x1914e8[_0x9815('0x1d')]=qs[_0x9815('0x1d')](_0x5426dc['query']['offset']);}_0x1914e8['order']=qs[_0x9815('0x3b')](_0x5426dc[_0x9815('0x33')][_0x9815('0x3b')]);_0x1914e8['where']=qs[_0x9815('0x34')](_[_0x9815('0x3c')](_0x5426dc[_0x9815('0x33')],_0x338bc9[_0x9815('0x34')]),_0xb32697);if(_0x5426dc['query'][_0x9815('0x3d')]){_0x1914e8[_0x9815('0x3e')]=_[_0x9815('0x3f')](_0x1914e8[_0x9815('0x3e')],{'$or':_[_0x9815('0x2d')](_0xb32697,function(_0x59ccd6){if(_0x59ccd6[_0x9815('0x30')]!==_0x9815('0x40')){var _0x5c491e={};_0x5c491e[_0x59ccd6[_0x9815('0x2a')]]={'$like':'%'+_0x5426dc[_0x9815('0x33')][_0x9815('0x3d')]+'%'};return _0x5c491e;}})});}_0x1914e8=_[_0x9815('0x3f')]({},_0x1914e8,_0x5426dc[_0x9815('0x41')]);var _0xac5b8a={'where':_0x1914e8['where']};return db[_0x9815('0x42')]['count'](_0xac5b8a)[_0x9815('0x26')](function(_0x256d4d){_0x4a58ff['count']=_0x256d4d;if(_0x5426dc[_0x9815('0x33')][_0x9815('0x43')]){_0x1914e8[_0x9815('0x44')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x9815('0x45')](_0x1914e8);})[_0x9815('0x26')](function(_0x56509a){_0x4a58ff['rows']=_0x56509a;return _0x4a58ff;})['then'](respondWithFilteredResult(_0x2fe93f,_0x1914e8))[_0x9815('0x46')](handleError(_0x2fe93f,null));};exports[_0x9815('0x47')]=function(_0x4580f7,_0x20feff){var _0x483032={'raw':!![],'where':{'id':_0x4580f7[_0x9815('0x48')]['id']}},_0x16a9d4={};_0x16a9d4[_0x9815('0x32')]=_['keys'](db['AnalyticTreeReport'][_0x9815('0x2e')]);_0x16a9d4[_0x9815('0x33')]=_['keys'](_0x4580f7[_0x9815('0x33')]);_0x16a9d4[_0x9815('0x34')]=_[_0x9815('0x36')](_0x16a9d4['model'],_0x16a9d4[_0x9815('0x33')]);_0x483032[_0x9815('0x35')]=_['intersection'](_0x16a9d4[_0x9815('0x32')],qs['fields'](_0x4580f7[_0x9815('0x33')]['fields']));_0x483032[_0x9815('0x35')]=_0x483032[_0x9815('0x35')][_0x9815('0x38')]?_0x483032[_0x9815('0x35')]:_0x16a9d4[_0x9815('0x32')];if(_0x4580f7[_0x9815('0x33')][_0x9815('0x43')]){_0x483032[_0x9815('0x44')]=[{'all':!![]}];}_0x483032=_[_0x9815('0x3f')]({},_0x483032,_0x4580f7['options']);return db[_0x9815('0x42')][_0x9815('0x49')](_0x483032)['then'](handleEntityNotFound(_0x20feff,null))[_0x9815('0x26')](respondWithResult(_0x20feff,null))[_0x9815('0x46')](handleError(_0x20feff,null));};exports[_0x9815('0x4a')]=function(_0x4bd13e,_0x37287f){return db['AnalyticTreeReport']['create'](_0x4bd13e[_0x9815('0x4b')],{})[_0x9815('0x26')](respondWithResult(_0x37287f,0xc9))['catch'](handleError(_0x37287f,null));};exports[_0x9815('0x25')]=function(_0x1320f5,_0x169371){if(_0x1320f5[_0x9815('0x4b')]['id']){delete _0x1320f5[_0x9815('0x4b')]['id'];}return db['AnalyticTreeReport'][_0x9815('0x49')]({'where':{'id':_0x1320f5[_0x9815('0x48')]['id']}})[_0x9815('0x26')](handleEntityNotFound(_0x169371,null))[_0x9815('0x26')](saveUpdates(_0x1320f5[_0x9815('0x4b')],null))['then'](respondWithResult(_0x169371,null))['catch'](handleError(_0x169371,null));};exports['destroy']=function(_0x5692a9,_0x2ffc96){return db[_0x9815('0x42')][_0x9815('0x49')]({'where':{'id':_0x5692a9[_0x9815('0x48')]['id']}})[_0x9815('0x26')](handleEntityNotFound(_0x2ffc96,null))[_0x9815('0x26')](removeEntity(_0x2ffc96,null))['catch'](handleError(_0x2ffc96,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 0394e69..1439e07 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 _0x8469=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x1fcb64,_0x5021f2){var _0x4fbfa1=function(_0x1153f7){while(--_0x1153f7){_0x1fcb64['push'](_0x1fcb64['shift']());}};_0x4fbfa1(++_0x5021f2);}(_0x8469,0xcf));var _0x9846=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0x8469[_0x7ad123];return _0x37d073;};'use strict';var _=require(_0x9846('0x0'));var util=require(_0x9846('0x1'));var logger=require(_0x9846('0x2'))(_0x9846('0x3'));var moment=require(_0x9846('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9846('0x5'));var rimraf=require(_0x9846('0x6'));var config=require(_0x9846('0x7'));var attributes=require(_0x9846('0x8'));module[_0x9846('0x9')]=function(_0x12177c,_0x3a447a){return _0x12177c[_0x9846('0xa')](_0x9846('0xb'),attributes,{'tableName':_0x9846('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad65=['rimraf','exports','define','AnalyticTreeReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x55c521,_0x13d53f){var _0x3f7228=function(_0x17baba){while(--_0x17baba){_0x55c521['push'](_0x55c521['shift']());}};_0x3f7228(++_0x13d53f);}(_0xad65,0x101));var _0x5ad6=function(_0x2e5e2c,_0x23fd7e){_0x2e5e2c=_0x2e5e2c-0x0;var _0x3a25eb=_0xad65[_0x2e5e2c];return _0x3a25eb;};'use strict';var _=require(_0x5ad6('0x0'));var util=require('util');var logger=require(_0x5ad6('0x1'))(_0x5ad6('0x2'));var moment=require(_0x5ad6('0x3'));var BPromise=require(_0x5ad6('0x4'));var rp=require(_0x5ad6('0x5'));var fs=require('fs');var path=require(_0x5ad6('0x6'));var rimraf=require(_0x5ad6('0x7'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x5ad6('0x8')]=function(_0x1faebf,_0x2f7703){return _0x1faebf[_0x5ad6('0x9')](_0x5ad6('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 6b5e46a..86ce305 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 _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(_0x2acc55,_0x320ac3){var _0x160fb3=function(_0x387e0c){while(--_0x387e0c){_0x2acc55['push'](_0x2acc55['shift']());}};_0x160fb3(++_0x320ac3);}(_0xdb28,0x106));var _0x8db2=function(_0x4a9d11,_0x1c369d){_0x4a9d11=_0x4a9d11-0x0;var _0x867163=_0xdb28[_0x4a9d11];return _0x867163;};'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 +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(_0x1e795d,_0x13c2c4){var _0x11dfda=function(_0xa4523e){while(--_0xa4523e){_0x1e795d['push'](_0x1e795d['shift']());}};_0x11dfda(++_0x13c2c4);}(_0xdb28,0x106));var _0x8db2=function(_0x2f5665,_0x3abcf1){_0x2f5665=_0x2f5665-0x0;var _0x3d7938=_0xdb28[_0x2f5665];return _0x3d7938;};'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 ab336d1..744b90f 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 _0x3ae9=['../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','create','put','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5a474c,_0x3d8725){var _0x5b8361=function(_0x2993f6){while(--_0x2993f6){_0x5a474c['push'](_0x5a474c['shift']());}};_0x5b8361(++_0x3d8725);}(_0x3ae9,0xaa));var _0x93ae=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3ae9[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x93ae('0x0'));var util=require(_0x93ae('0x1'));var path=require('path');var timeout=require(_0x93ae('0x2'));var express=require('express');var router=express[_0x93ae('0x3')]();var fs_extra=require(_0x93ae('0x4'));var auth=require(_0x93ae('0x5'));var interaction=require(_0x93ae('0x6'));var config=require('../../config/environment');var controller=require(_0x93ae('0x7'));router[_0x93ae('0x8')]('/',auth[_0x93ae('0x9')](),controller[_0x93ae('0xa')]);router[_0x93ae('0x8')](_0x93ae('0xb'),auth['isAuthenticated'](),controller[_0x93ae('0xc')]);router['post']('/',auth[_0x93ae('0x9')](),controller[_0x93ae('0xd')]);router[_0x93ae('0xe')](_0x93ae('0xb'),auth[_0x93ae('0x9')](),controller['update']);router['delete'](_0x93ae('0xb'),auth[_0x93ae('0x9')](),controller['destroy']);module[_0x93ae('0xf')]=router; \ No newline at end of file +var _0x7810=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','create','put','delete','destroy','exports','multer','path'];(function(_0x422ed1,_0x5a4e91){var _0x7c9671=function(_0x3c93fc){while(--_0x3c93fc){_0x422ed1['push'](_0x422ed1['shift']());}};_0x7c9671(++_0x5a4e91);}(_0x7810,0x1e4));var _0x0781=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7810[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0781('0x0'));var util=require('util');var path=require(_0x0781('0x1'));var timeout=require(_0x0781('0x2'));var express=require('express');var router=express[_0x0781('0x3')]();var fs_extra=require(_0x0781('0x4'));var auth=require(_0x0781('0x5'));var interaction=require(_0x0781('0x6'));var config=require(_0x0781('0x7'));var controller=require(_0x0781('0x8'));router[_0x0781('0x9')]('/',auth['isAuthenticated'](),controller[_0x0781('0xa')]);router[_0x0781('0x9')](_0x0781('0xb'),auth[_0x0781('0xc')](),controller['show']);router['post']('/',auth[_0x0781('0xc')](),controller[_0x0781('0xd')]);router[_0x0781('0xe')](_0x0781('0xb'),auth[_0x0781('0xc')](),controller['update']);router[_0x0781('0xf')](_0x0781('0xb'),auth[_0x0781('0xc')](),controller[_0x0781('0x10')]);module[_0x0781('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index aa5ace1..d6f495b 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 _0x1542=['exports','STRING','sequelize'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x1542,0x116));var _0x2154=function(_0x4491aa,_0x2f8583){_0x4491aa=_0x4491aa-0x0;var _0x59f133=_0x1542[_0x4491aa];return _0x59f133;};'use strict';var Sequelize=require(_0x2154('0x0'));module[_0x2154('0x1')]={'name':{'type':Sequelize[_0x2154('0x2')]},'basename':{'type':Sequelize[_0x2154('0x2')]},'type':{'type':Sequelize[_0x2154('0x2')]}}; \ No newline at end of file +var _0x5c4a=['STRING','exports'];(function(_0x4d4c99,_0x27de84){var _0x183f4e=function(_0x7ae96){while(--_0x7ae96){_0x4d4c99['push'](_0x4d4c99['shift']());}};_0x183f4e(++_0x27de84);}(_0x5c4a,0xfb));var _0xa5c4=function(_0x397297,_0x537446){_0x397297=_0x397297-0x0;var _0x41fdc9=_0x5c4a[_0x397297];return _0x41fdc9;};'use strict';var Sequelize=require('sequelize');module[_0xa5c4('0x0')]={'name':{'type':Sequelize[_0xa5c4('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa5c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 9e4b468..0233371 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 _0x056a=['catch','clone','get','omit','createdAt','body','create','originalname','basename','file','filename','mimetype','download','findOne','root','offline-chat/','join','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','show','params','find'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x056a,0xc3));var _0xa056=function(_0x5ca77a,_0x1390b6){_0x5ca77a=_0x5ca77a-0x0;var _0x3a8fdc=_0x056a[_0x5ca77a];return _0x3a8fdc;};'use strict';var emlformat=require(_0xa056('0x0'));var rimraf=require(_0xa056('0x1'));var zipdir=require(_0xa056('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa056('0x3'));var moment=require(_0xa056('0x4'));var BPromise=require(_0xa056('0x5'));var Mustache=require(_0xa056('0x6'));var util=require('util');var path=require(_0xa056('0x7'));var sox=require(_0xa056('0x8'));var csv=require(_0xa056('0x9'));var ejs=require(_0xa056('0xa'));var fs=require('fs');var fs_extra=require(_0xa056('0xb'));var _=require(_0xa056('0xc'));var squel=require(_0xa056('0xd'));var crypto=require('crypto');var jsforce=require(_0xa056('0xe'));var deskjs=require(_0xa056('0xf'));var toCsv=require(_0xa056('0x9'));var querystring=require(_0xa056('0x10'));var Papa=require('papaparse');var Redis=require(_0xa056('0x11'));var authService=require(_0xa056('0x12'));var qs=require(_0xa056('0x13'));var as=require(_0xa056('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa056('0x15'))(_0xa056('0x16'));var utils=require(_0xa056('0x17'));var config=require(_0xa056('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa056('0x19'))['db'];function respondWithStatusCode(_0x415d93,_0x26b4e1){_0x26b4e1=_0x26b4e1||0xcc;return function(_0x431088){if(_0x431088){return _0x415d93[_0xa056('0x1a')](_0x26b4e1);}return _0x415d93[_0xa056('0x1b')](_0x26b4e1)[_0xa056('0x1c')]();};}function respondWithResult(_0x529b2f,_0x4fdcb0){_0x4fdcb0=_0x4fdcb0||0xc8;return function(_0x55e22b){if(_0x55e22b){return _0x529b2f[_0xa056('0x1b')](_0x4fdcb0)[_0xa056('0x1d')](_0x55e22b);}};}function respondWithFilteredResult(_0x7a92d4,_0x33a779){return function(_0x50e1d1){if(_0x50e1d1){var _0x30b909=typeof _0x33a779[_0xa056('0x1e')]===_0xa056('0x1f')&&typeof _0x33a779[_0xa056('0x20')]===_0xa056('0x1f');var _0x204ec3=_0x50e1d1[_0xa056('0x21')];var _0x291ef2=_0x30b909?0x0:_0x33a779[_0xa056('0x1e')];var _0x29810d=_0x30b909?_0x50e1d1[_0xa056('0x21')]:_0x33a779[_0xa056('0x1e')]+_0x33a779['limit'];var _0x3c0504;if(_0x29810d>=_0x204ec3){_0x29810d=_0x204ec3;_0x3c0504=0xc8;}else{_0x3c0504=0xce;}_0x7a92d4['status'](_0x3c0504);return _0x7a92d4[_0xa056('0x22')](_0xa056('0x23'),_0x291ef2+'-'+_0x29810d+'/'+_0x204ec3)[_0xa056('0x1d')](_0x50e1d1);}return null;};}function patchUpdates(_0x4a8c12){return function(_0x400ce5){try{jsonpatch[_0xa056('0x24')](_0x400ce5,_0x4a8c12,!![]);}catch(_0x19272a){return BPromise['reject'](_0x19272a);}return _0x400ce5[_0xa056('0x25')]();};}function saveUpdates(_0x402836,_0x1f8857){return function(_0xbbd2c3){if(_0xbbd2c3){return _0xbbd2c3['update'](_0x402836)['then'](function(_0x54c38a){return _0x54c38a;});}return null;};}function removeEntity(_0x3aaafb,_0x2c85df){return function(_0x381f1b){if(_0x381f1b){return _0x381f1b[_0xa056('0x26')]()[_0xa056('0x27')](function(){_0x3aaafb[_0xa056('0x1b')](0xcc)[_0xa056('0x1c')]();});}};}function handleEntityNotFound(_0x250eb6,_0x1c7a6e){return function(_0x5af229){if(!_0x5af229){_0x250eb6[_0xa056('0x1a')](0x194);}return _0x5af229;};}function handleError(_0x274c2f,_0x1db86e){_0x1db86e=_0x1db86e||0x1f4;return function(_0x4b30f0){logger['error'](_0x4b30f0[_0xa056('0x28')]);if(_0x4b30f0['name']){delete _0x4b30f0[_0xa056('0x29')];}_0x274c2f['status'](_0x1db86e)[_0xa056('0x2a')](_0x4b30f0);};}exports[_0xa056('0x2b')]=function(_0x1e2073,_0x842c07){var _0x471c3f={},_0x2a17e3={},_0x16ec4e={'count':0x0,'rows':[]};var _0x5c88d0=_[_0xa056('0x2c')](db[_0xa056('0x2d')][_0xa056('0x2e')],function(_0x5e6838){return{'name':_0x5e6838[_0xa056('0x2f')],'type':_0x5e6838[_0xa056('0x30')][_0xa056('0x31')]};});_0x2a17e3[_0xa056('0x32')]=_[_0xa056('0x2c')](_0x5c88d0,_0xa056('0x29'));_0x2a17e3[_0xa056('0x33')]=_['keys'](_0x1e2073[_0xa056('0x33')]);_0x2a17e3[_0xa056('0x34')]=_[_0xa056('0x35')](_0x2a17e3[_0xa056('0x32')],_0x2a17e3['query']);_0x471c3f[_0xa056('0x36')]=_[_0xa056('0x35')](_0x2a17e3[_0xa056('0x32')],qs[_0xa056('0x37')](_0x1e2073[_0xa056('0x33')][_0xa056('0x37')]));_0x471c3f[_0xa056('0x36')]=_0x471c3f[_0xa056('0x36')][_0xa056('0x38')]?_0x471c3f[_0xa056('0x36')]:_0x2a17e3[_0xa056('0x32')];if(!_0x1e2073[_0xa056('0x33')][_0xa056('0x39')](_0xa056('0x3a'))){_0x471c3f[_0xa056('0x20')]=qs['limit'](_0x1e2073['query'][_0xa056('0x20')]);_0x471c3f[_0xa056('0x1e')]=qs[_0xa056('0x1e')](_0x1e2073[_0xa056('0x33')][_0xa056('0x1e')]);}_0x471c3f[_0xa056('0x3b')]=qs[_0xa056('0x3c')](_0x1e2073['query']['sort']);_0x471c3f[_0xa056('0x3d')]=qs[_0xa056('0x34')](_[_0xa056('0x3e')](_0x1e2073[_0xa056('0x33')],_0x2a17e3[_0xa056('0x34')]),_0x5c88d0);if(_0x1e2073[_0xa056('0x33')]['filter']){_0x471c3f[_0xa056('0x3d')]=_[_0xa056('0x3f')](_0x471c3f[_0xa056('0x3d')],{'$or':_[_0xa056('0x2c')](_0x5c88d0,function(_0x19bb6a){if(_0x19bb6a[_0xa056('0x30')]!=='VIRTUAL'){var _0x24c627={};_0x24c627[_0x19bb6a[_0xa056('0x29')]]={'$like':'%'+_0x1e2073[_0xa056('0x33')][_0xa056('0x40')]+'%'};return _0x24c627;}})});}_0x471c3f=_[_0xa056('0x3f')]({},_0x471c3f,_0x1e2073[_0xa056('0x41')]);var _0x1de6b8={'where':_0x471c3f[_0xa056('0x3d')]};return db['Attachment'][_0xa056('0x21')](_0x1de6b8)[_0xa056('0x27')](function(_0x4203ec){_0x16ec4e[_0xa056('0x21')]=_0x4203ec;if(_0x1e2073['query'][_0xa056('0x42')]){_0x471c3f[_0xa056('0x43')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x471c3f);})['then'](function(_0x5d50c4){_0x16ec4e[_0xa056('0x44')]=_0x5d50c4;return _0x16ec4e;})[_0xa056('0x27')](respondWithFilteredResult(_0x842c07,_0x471c3f))['catch'](handleError(_0x842c07,null));};exports[_0xa056('0x45')]=function(_0x175d8a,_0x33f0c6){var _0x15e704={'raw':!![],'where':{'id':_0x175d8a[_0xa056('0x46')]['id']}},_0xd71257={};_0xd71257[_0xa056('0x32')]=_['keys'](db['Attachment'][_0xa056('0x2e')]);_0xd71257[_0xa056('0x33')]=_['keys'](_0x175d8a[_0xa056('0x33')]);_0xd71257[_0xa056('0x34')]=_[_0xa056('0x35')](_0xd71257['model'],_0xd71257[_0xa056('0x33')]);_0x15e704['attributes']=_['intersection'](_0xd71257[_0xa056('0x32')],qs[_0xa056('0x37')](_0x175d8a[_0xa056('0x33')][_0xa056('0x37')]));_0x15e704[_0xa056('0x36')]=_0x15e704[_0xa056('0x36')][_0xa056('0x38')]?_0x15e704[_0xa056('0x36')]:_0xd71257[_0xa056('0x32')];if(_0x175d8a[_0xa056('0x33')][_0xa056('0x42')]){_0x15e704[_0xa056('0x43')]=[{'all':!![]}];}_0x15e704=_[_0xa056('0x3f')]({},_0x15e704,_0x175d8a[_0xa056('0x41')]);return db[_0xa056('0x2d')][_0xa056('0x47')](_0x15e704)[_0xa056('0x27')](handleEntityNotFound(_0x33f0c6,null))[_0xa056('0x27')](respondWithResult(_0x33f0c6,null))[_0xa056('0x48')](handleError(_0x33f0c6,null));};exports[_0xa056('0x49')]=function(_0xdc4d5d,_0x14e7fd){var _0x3b4eab={'where':{'id':_0xdc4d5d[_0xa056('0x46')]['id']}},_0x13764c={};_0x13764c[_0xa056('0x32')]=_['keys'](db[_0xa056('0x2d')][_0xa056('0x2e')]);_0x3b4eab[_0xa056('0x36')]=_[_0xa056('0x35')](_0x13764c[_0xa056('0x32')],qs['fields'](_0xdc4d5d[_0xa056('0x33')]['fields']));_0x3b4eab[_0xa056('0x36')]=_0x3b4eab['attributes']['length']?_0x3b4eab[_0xa056('0x36')]:_0x13764c[_0xa056('0x32')];if(_0xdc4d5d[_0xa056('0x33')][_0xa056('0x42')]){_0x3b4eab['include']=[{'all':!![]}];}_0x3b4eab=_[_0xa056('0x3f')]({},_0x3b4eab,_0xdc4d5d[_0xa056('0x41')]);return db[_0xa056('0x2d')][_0xa056('0x47')](_0x3b4eab)[_0xa056('0x27')](handleEntityNotFound(_0x14e7fd,null))[_0xa056('0x27')](function(_0x676e94){if(_0x676e94){var _0x49b1b0=_0x676e94[_0xa056('0x4a')]({'plain':!![]});_0x49b1b0=qs[_0xa056('0x4b')](_0x49b1b0,['id',_0xa056('0x4c'),'updatedAt']);_0xdc4d5d[_0xa056('0x4d')]=_[_0xa056('0x4b')](_0xdc4d5d[_0xa056('0x4d')],['id',_0xa056('0x4c'),'updatedAt']);return db['Attachment'][_0xa056('0x4e')](_[_0xa056('0x3f')](_0x49b1b0,_0xdc4d5d['body']),{'include':_0xdc4d5d[_0xa056('0x33')][_0xa056('0x42')]?[{'all':!![]}]:undefined});}})[_0xa056('0x27')](respondWithResult(_0x14e7fd,0xc9))['catch'](handleError(_0x14e7fd,null));};exports['update']=function(_0x17ac97,_0x5d2837){if(_0x17ac97['body']['id']){delete _0x17ac97[_0xa056('0x4d')]['id'];}return db[_0xa056('0x2d')][_0xa056('0x47')]({'where':{'id':_0x17ac97[_0xa056('0x46')]['id']}})[_0xa056('0x27')](handleEntityNotFound(_0x5d2837,null))['then'](saveUpdates(_0x17ac97[_0xa056('0x4d')],null))[_0xa056('0x27')](respondWithResult(_0x5d2837,null))['catch'](handleError(_0x5d2837,null));};exports[_0xa056('0x26')]=function(_0x1deef0,_0x9a1ae0){return db[_0xa056('0x2d')][_0xa056('0x47')]({'where':{'id':_0x1deef0['params']['id']}})[_0xa056('0x27')](handleEntityNotFound(_0x9a1ae0,null))[_0xa056('0x27')](removeEntity(_0x9a1ae0,null))[_0xa056('0x48')](handleError(_0x9a1ae0,null));};exports[_0xa056('0x4e')]=function(_0x178691,_0x44ca76,_0x2174cf){_0x178691['body'][_0xa056('0x29')]=_0x178691['file'][_0xa056('0x4f')];_0x178691['body'][_0xa056('0x50')]=_0x178691[_0xa056('0x51')][_0xa056('0x52')];_0x178691[_0xa056('0x4d')]['type']=_0x178691[_0xa056('0x51')][_0xa056('0x53')];return db['Attachment']['create'](_0x178691['body'])[_0xa056('0x27')](respondWithResult(_0x44ca76,0xc9))[_0xa056('0x48')](handleError(_0x44ca76,null));};exports[_0xa056('0x54')]=function(_0x360b76,_0x520ec3,_0x137401){return db[_0xa056('0x2d')][_0xa056('0x55')]({'where':{'id':_0x360b76[_0xa056('0x46')]['id']},'raw':!![]})[_0xa056('0x27')](handleEntityNotFound(_0x520ec3,null))[_0xa056('0x27')](function(_0x302c95){if(_0x302c95){var _0x5a96f1=_0x302c95['ChatOfflineMessageId']!==null;var _0x54c242=path['join'](config[_0xa056('0x56')],'server/files/attachments/');if(_0x5a96f1){_0x54c242=path['join'](_0x54c242,_0xa056('0x57'));}var _0x16da30=path[_0xa056('0x58')](_0x54c242,_0x302c95[_0xa056('0x50')]);return _0x520ec3['download'](_0x16da30);}})[_0xa056('0x48')](handleError(_0x520ec3,null));}; \ No newline at end of file +var _0x1962=['length','clone','find','get','omit','createdAt','body','updatedAt','create','catch','file','originalname','basename','mimetype','download','ChatOfflineMessageId','server/files/attachments/','offline-chat/','eml-format','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','Attachment','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','show','params'];(function(_0x21213d,_0x36ae13){var _0x184835=function(_0x4079ff){while(--_0x4079ff){_0x21213d['push'](_0x21213d['shift']());}};_0x184835(++_0x36ae13);}(_0x1962,0x166));var _0x2196=function(_0xc298ad,_0xea4dc2){_0xc298ad=_0xc298ad-0x0;var _0x11b2e6=_0x1962[_0xc298ad];return _0x11b2e6;};'use strict';var emlformat=require(_0x2196('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2196('0x1'));var rp=require(_0x2196('0x2'));var moment=require(_0x2196('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2196('0x4'));var path=require('path');var sox=require(_0x2196('0x5'));var csv=require(_0x2196('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2196('0x7'));var _=require('lodash');var squel=require(_0x2196('0x8'));var crypto=require('crypto');var jsforce=require(_0x2196('0x9'));var deskjs=require(_0x2196('0xa'));var toCsv=require(_0x2196('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2196('0xb'));var authService=require(_0x2196('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x2196('0xd'));var hardwareService=require(_0x2196('0xe'));var logger=require(_0x2196('0xf'))(_0x2196('0x10'));var utils=require(_0x2196('0x11'));var config=require(_0x2196('0x12'));var licenseUtil=require(_0x2196('0x13'));var db=require(_0x2196('0x14'))['db'];function respondWithStatusCode(_0x2993cc,_0x5942c5){_0x5942c5=_0x5942c5||0xcc;return function(_0x374032){if(_0x374032){return _0x2993cc[_0x2196('0x15')](_0x5942c5);}return _0x2993cc[_0x2196('0x16')](_0x5942c5)[_0x2196('0x17')]();};}function respondWithResult(_0x20d98,_0xcfc0e){_0xcfc0e=_0xcfc0e||0xc8;return function(_0x27e2e9){if(_0x27e2e9){return _0x20d98[_0x2196('0x16')](_0xcfc0e)[_0x2196('0x18')](_0x27e2e9);}};}function respondWithFilteredResult(_0x3a79d3,_0x2a70a9){return function(_0x5ef816){if(_0x5ef816){var _0x48275d=typeof _0x2a70a9[_0x2196('0x19')]==='undefined'&&typeof _0x2a70a9[_0x2196('0x1a')]===_0x2196('0x1b');var _0x17923b=_0x5ef816[_0x2196('0x1c')];var _0x66fa94=_0x48275d?0x0:_0x2a70a9[_0x2196('0x19')];var _0x59c0a0=_0x48275d?_0x5ef816['count']:_0x2a70a9[_0x2196('0x19')]+_0x2a70a9[_0x2196('0x1a')];var _0x1588b9;if(_0x59c0a0>=_0x17923b){_0x59c0a0=_0x17923b;_0x1588b9=0xc8;}else{_0x1588b9=0xce;}_0x3a79d3[_0x2196('0x16')](_0x1588b9);return _0x3a79d3[_0x2196('0x1d')](_0x2196('0x1e'),_0x66fa94+'-'+_0x59c0a0+'/'+_0x17923b)['json'](_0x5ef816);}return null;};}function patchUpdates(_0x2099e1){return function(_0x328320){try{jsonpatch[_0x2196('0x1f')](_0x328320,_0x2099e1,!![]);}catch(_0x40ba30){return BPromise[_0x2196('0x20')](_0x40ba30);}return _0x328320[_0x2196('0x21')]();};}function saveUpdates(_0x4cf0dd,_0x362435){return function(_0x12b306){if(_0x12b306){return _0x12b306[_0x2196('0x22')](_0x4cf0dd)[_0x2196('0x23')](function(_0x5b063a){return _0x5b063a;});}return null;};}function removeEntity(_0x5a4cb0,_0x211fe0){return function(_0x23d29d){if(_0x23d29d){return _0x23d29d[_0x2196('0x24')]()[_0x2196('0x23')](function(){_0x5a4cb0[_0x2196('0x16')](0xcc)[_0x2196('0x17')]();});}};}function handleEntityNotFound(_0x3c5734,_0x265d86){return function(_0x2d39cd){if(!_0x2d39cd){_0x3c5734[_0x2196('0x15')](0x194);}return _0x2d39cd;};}function handleError(_0x1338f2,_0x191834){_0x191834=_0x191834||0x1f4;return function(_0x62a80c){logger[_0x2196('0x25')](_0x62a80c[_0x2196('0x26')]);if(_0x62a80c[_0x2196('0x27')]){delete _0x62a80c['name'];}_0x1338f2[_0x2196('0x16')](_0x191834)[_0x2196('0x28')](_0x62a80c);};}exports['index']=function(_0x322b4a,_0x296f2f){var _0x566957={},_0xc32cbb={},_0x2914c1={'count':0x0,'rows':[]};var _0x35454b=_[_0x2196('0x29')](db[_0x2196('0x2a')][_0x2196('0x2b')],function(_0x359fac){return{'name':_0x359fac[_0x2196('0x2c')],'type':_0x359fac['type'][_0x2196('0x2d')]};});_0xc32cbb[_0x2196('0x2e')]=_[_0x2196('0x29')](_0x35454b,_0x2196('0x27'));_0xc32cbb[_0x2196('0x2f')]=_['keys'](_0x322b4a[_0x2196('0x2f')]);_0xc32cbb[_0x2196('0x30')]=_[_0x2196('0x31')](_0xc32cbb[_0x2196('0x2e')],_0xc32cbb['query']);_0x566957[_0x2196('0x32')]=_['intersection'](_0xc32cbb[_0x2196('0x2e')],qs[_0x2196('0x33')](_0x322b4a[_0x2196('0x2f')][_0x2196('0x33')]));_0x566957[_0x2196('0x32')]=_0x566957[_0x2196('0x32')]['length']?_0x566957[_0x2196('0x32')]:_0xc32cbb[_0x2196('0x2e')];if(!_0x322b4a[_0x2196('0x2f')]['hasOwnProperty'](_0x2196('0x34'))){_0x566957[_0x2196('0x1a')]=qs[_0x2196('0x1a')](_0x322b4a[_0x2196('0x2f')][_0x2196('0x1a')]);_0x566957[_0x2196('0x19')]=qs[_0x2196('0x19')](_0x322b4a['query'][_0x2196('0x19')]);}_0x566957[_0x2196('0x35')]=qs[_0x2196('0x36')](_0x322b4a['query']['sort']);_0x566957['where']=qs[_0x2196('0x30')](_[_0x2196('0x37')](_0x322b4a['query'],_0xc32cbb[_0x2196('0x30')]),_0x35454b);if(_0x322b4a[_0x2196('0x2f')][_0x2196('0x38')]){_0x566957[_0x2196('0x39')]=_[_0x2196('0x3a')](_0x566957[_0x2196('0x39')],{'$or':_[_0x2196('0x29')](_0x35454b,function(_0x3ea042){if(_0x3ea042[_0x2196('0x3b')]!=='VIRTUAL'){var _0x32d2c2={};_0x32d2c2[_0x3ea042[_0x2196('0x27')]]={'$like':'%'+_0x322b4a['query'][_0x2196('0x38')]+'%'};return _0x32d2c2;}})});}_0x566957=_[_0x2196('0x3a')]({},_0x566957,_0x322b4a[_0x2196('0x3c')]);var _0x24f377={'where':_0x566957[_0x2196('0x39')]};return db[_0x2196('0x2a')][_0x2196('0x1c')](_0x24f377)[_0x2196('0x23')](function(_0x26c6a2){_0x2914c1[_0x2196('0x1c')]=_0x26c6a2;if(_0x322b4a[_0x2196('0x2f')][_0x2196('0x3d')]){_0x566957[_0x2196('0x3e')]=[{'all':!![]}];}return db[_0x2196('0x2a')][_0x2196('0x3f')](_0x566957);})['then'](function(_0x26daa4){_0x2914c1[_0x2196('0x40')]=_0x26daa4;return _0x2914c1;})[_0x2196('0x23')](respondWithFilteredResult(_0x296f2f,_0x566957))['catch'](handleError(_0x296f2f,null));};exports[_0x2196('0x41')]=function(_0xb47fae,_0x182374){var _0x4b29fa={'raw':!![],'where':{'id':_0xb47fae[_0x2196('0x42')]['id']}},_0x568b92={};_0x568b92[_0x2196('0x2e')]=_['keys'](db[_0x2196('0x2a')][_0x2196('0x2b')]);_0x568b92[_0x2196('0x2f')]=_['keys'](_0xb47fae[_0x2196('0x2f')]);_0x568b92[_0x2196('0x30')]=_['intersection'](_0x568b92[_0x2196('0x2e')],_0x568b92['query']);_0x4b29fa['attributes']=_[_0x2196('0x31')](_0x568b92[_0x2196('0x2e')],qs[_0x2196('0x33')](_0xb47fae['query'][_0x2196('0x33')]));_0x4b29fa[_0x2196('0x32')]=_0x4b29fa['attributes'][_0x2196('0x43')]?_0x4b29fa[_0x2196('0x32')]:_0x568b92[_0x2196('0x2e')];if(_0xb47fae[_0x2196('0x2f')]['includeAll']){_0x4b29fa['include']=[{'all':!![]}];}_0x4b29fa=_[_0x2196('0x3a')]({},_0x4b29fa,_0xb47fae[_0x2196('0x3c')]);return db[_0x2196('0x2a')]['find'](_0x4b29fa)[_0x2196('0x23')](handleEntityNotFound(_0x182374,null))[_0x2196('0x23')](respondWithResult(_0x182374,null))['catch'](handleError(_0x182374,null));};exports[_0x2196('0x44')]=function(_0x317078,_0x2150b8){var _0x215dd9={'where':{'id':_0x317078[_0x2196('0x42')]['id']}},_0x18faf7={};_0x18faf7['model']=_['keys'](db['Attachment'][_0x2196('0x2b')]);_0x215dd9[_0x2196('0x32')]=_[_0x2196('0x31')](_0x18faf7[_0x2196('0x2e')],qs[_0x2196('0x33')](_0x317078[_0x2196('0x2f')]['fields']));_0x215dd9[_0x2196('0x32')]=_0x215dd9['attributes']['length']?_0x215dd9['attributes']:_0x18faf7[_0x2196('0x2e')];if(_0x317078[_0x2196('0x2f')][_0x2196('0x3d')]){_0x215dd9['include']=[{'all':!![]}];}_0x215dd9=_[_0x2196('0x3a')]({},_0x215dd9,_0x317078[_0x2196('0x3c')]);return db[_0x2196('0x2a')][_0x2196('0x45')](_0x215dd9)[_0x2196('0x23')](handleEntityNotFound(_0x2150b8,null))['then'](function(_0x458610){if(_0x458610){var _0x54b514=_0x458610[_0x2196('0x46')]({'plain':!![]});_0x54b514=qs[_0x2196('0x47')](_0x54b514,['id',_0x2196('0x48'),'updatedAt']);_0x317078[_0x2196('0x49')]=_[_0x2196('0x47')](_0x317078[_0x2196('0x49')],['id',_0x2196('0x48'),_0x2196('0x4a')]);return db['Attachment'][_0x2196('0x4b')](_[_0x2196('0x3a')](_0x54b514,_0x317078[_0x2196('0x49')]),{'include':_0x317078[_0x2196('0x2f')][_0x2196('0x3d')]?[{'all':!![]}]:undefined});}})[_0x2196('0x23')](respondWithResult(_0x2150b8,0xc9))[_0x2196('0x4c')](handleError(_0x2150b8,null));};exports[_0x2196('0x22')]=function(_0x533561,_0x3d3fe9){if(_0x533561[_0x2196('0x49')]['id']){delete _0x533561[_0x2196('0x49')]['id'];}return db[_0x2196('0x2a')][_0x2196('0x45')]({'where':{'id':_0x533561['params']['id']}})[_0x2196('0x23')](handleEntityNotFound(_0x3d3fe9,null))[_0x2196('0x23')](saveUpdates(_0x533561[_0x2196('0x49')],null))[_0x2196('0x23')](respondWithResult(_0x3d3fe9,null))[_0x2196('0x4c')](handleError(_0x3d3fe9,null));};exports[_0x2196('0x24')]=function(_0x399986,_0x52babf){return db[_0x2196('0x2a')][_0x2196('0x45')]({'where':{'id':_0x399986['params']['id']}})[_0x2196('0x23')](handleEntityNotFound(_0x52babf,null))[_0x2196('0x23')](removeEntity(_0x52babf,null))[_0x2196('0x4c')](handleError(_0x52babf,null));};exports[_0x2196('0x4b')]=function(_0x463d29,_0x1f0a23,_0x285b41){_0x463d29[_0x2196('0x49')]['name']=_0x463d29[_0x2196('0x4d')][_0x2196('0x4e')];_0x463d29[_0x2196('0x49')][_0x2196('0x4f')]=_0x463d29[_0x2196('0x4d')]['filename'];_0x463d29[_0x2196('0x49')][_0x2196('0x3b')]=_0x463d29[_0x2196('0x4d')][_0x2196('0x50')];return db[_0x2196('0x2a')]['create'](_0x463d29[_0x2196('0x49')])[_0x2196('0x23')](respondWithResult(_0x1f0a23,0xc9))[_0x2196('0x4c')](handleError(_0x1f0a23,null));};exports[_0x2196('0x51')]=function(_0x7a82ca,_0x195f6a,_0x2b53dc){return db[_0x2196('0x2a')]['findOne']({'where':{'id':_0x7a82ca[_0x2196('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x195f6a,null))[_0x2196('0x23')](function(_0x19bdd2){if(_0x19bdd2){var _0x8ef08e=_0x19bdd2[_0x2196('0x52')]!==null;var _0x346566=path['join'](config['root'],_0x2196('0x53'));if(_0x8ef08e){_0x346566=path['join'](_0x346566,_0x2196('0x54'));}var _0xcd001e=path['join'](_0x346566,_0x19bdd2[_0x2196('0x4f')]);return _0x195f6a[_0x2196('0x51')](_0xcd001e);}})['catch'](handleError(_0x195f6a,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 8dd9fcd..3c7a64c 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 _0xa03f=['path','rimraf','./attachment.attributes','exports','define','Attachment','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xa03f,0x162));var _0xfa03=function(_0x33ca9f,_0x4e57b7){_0x33ca9f=_0x33ca9f-0x0;var _0x575e19=_0xa03f[_0x33ca9f];return _0x575e19;};'use strict';var _=require(_0xfa03('0x0'));var util=require(_0xfa03('0x1'));var logger=require(_0xfa03('0x2'))(_0xfa03('0x3'));var moment=require(_0xfa03('0x4'));var BPromise=require('bluebird');var rp=require(_0xfa03('0x5'));var fs=require('fs');var path=require(_0xfa03('0x6'));var rimraf=require(_0xfa03('0x7'));var config=require('../../config/environment');var attributes=require(_0xfa03('0x8'));module[_0xfa03('0x9')]=function(_0x272aff,_0x28b39a){return _0x272aff[_0xfa03('0xa')](_0xfa03('0xb'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b6d=['exports','define','Attachment','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x2b6d,0x157));var _0xd2b6=function(_0x59a029,_0x544a34){_0x59a029=_0x59a029-0x0;var _0x278e37=_0x2b6d[_0x59a029];return _0x278e37;};'use strict';var _=require(_0xd2b6('0x0'));var util=require('util');var logger=require(_0xd2b6('0x1'))(_0xd2b6('0x2'));var moment=require(_0xd2b6('0x3'));var BPromise=require(_0xd2b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2b6('0x5'));var rimraf=require('rimraf');var config=require(_0xd2b6('0x6'));var attributes=require('./attachment.attributes');module[_0xd2b6('0x7')]=function(_0x2f027b,_0x2405df){return _0x2f027b[_0xd2b6('0x8')](_0xd2b6('0x9'),attributes,{'tableName':'attachments','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 b3a32c3..8b5abf1 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 _0xde50=['randomstring','ioredis','../../config/utils','rpc','http','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateAttachment','Attachment','create','body','options','raw','moment','bluebird'];(function(_0x449135,_0x461965){var _0x282b71=function(_0xd7ce24){while(--_0xd7ce24){_0x449135['push'](_0x449135['shift']());}};_0x282b71(++_0x461965);}(_0xde50,0x140));var _0x0de5=function(_0x214f6b,_0x21bdd0){_0x214f6b=_0x214f6b-0x0;var _0x20fdb2=_0xde50[_0x214f6b];return _0x20fdb2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0de5('0x0'));var BPromise=require(_0x0de5('0x1'));var rs=require(_0x0de5('0x2'));var fs=require('fs');var Redis=require(_0x0de5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0de5('0x4'));var logger=require('../../config/logger')(_0x0de5('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0de5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2714e3,_0x2a5d94,_0x57410e){return new BPromise(function(_0xe3ac44,_0x4d5f0e){return client['request'](_0x2714e3,_0x57410e)['then'](function(_0x396293){logger[_0x0de5('0x7')](_0x0de5('0x8'),_0x2a5d94,'request\x20sent');logger[_0x0de5('0x9')](_0x0de5('0xa'),_0x2a5d94,'request\x20sent',JSON[_0x0de5('0xb')](_0x396293));if(_0x396293[_0x0de5('0xc')]){if(_0x396293[_0x0de5('0xc')]['code']===0x1f4){logger['error'](_0x0de5('0x8'),_0x2a5d94,_0x396293[_0x0de5('0xc')][_0x0de5('0xd')]);return _0x4d5f0e(_0x396293[_0x0de5('0xc')][_0x0de5('0xd')]);}logger['error'](_0x0de5('0x8'),_0x2a5d94,_0x396293['error']['message']);return _0xe3ac44(_0x396293[_0x0de5('0xc')][_0x0de5('0xd')]);}else{logger[_0x0de5('0x7')](_0x0de5('0x8'),_0x2a5d94,_0x0de5('0xe'));_0xe3ac44(_0x396293[_0x0de5('0xf')]['message']);}})[_0x0de5('0x10')](function(_0xeb58e1){logger[_0x0de5('0xc')](_0x0de5('0x8'),_0x2a5d94,_0xeb58e1);_0x4d5f0e(_0xeb58e1);});});}exports[_0x0de5('0x11')]=function(_0x2860e8){var _0x58ce66=this;return new Promise(function(_0x21e4b6,_0x48ba4e){return db[_0x0de5('0x12')][_0x0de5('0x13')](_0x2860e8[_0x0de5('0x14')],{'raw':_0x2860e8[_0x0de5('0x15')]?_0x2860e8['options'][_0x0de5('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x2a2abc){logger[_0x0de5('0x7')](_0x0de5('0x11'),_0x2860e8);logger['debug'](_0x0de5('0x11'),_0x2860e8,JSON[_0x0de5('0xb')](_0x2a2abc));_0x21e4b6(_0x2a2abc);})[_0x0de5('0x10')](function(_0x224745){logger['error'](_0x0de5('0x11'),_0x224745['message'],_0x2860e8);_0x48ba4e(_0x58ce66[_0x0de5('0xc')](0x1f4,_0x224745[_0x0de5('0xd')]));});});}; \ No newline at end of file +var _0xf53f=['create','options','raw','then','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateAttachment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf53f,0x8d));var _0xff53=function(_0x3fcaad,_0x3c83bf){_0x3fcaad=_0x3fcaad-0x0;var _0x112b23=_0xf53f[_0x3fcaad];return _0x112b23;};'use strict';var _=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var moment=require(_0xff53('0x2'));var BPromise=require(_0xff53('0x3'));var rs=require(_0xff53('0x4'));var fs=require('fs');var Redis=require(_0xff53('0x5'));var db=require(_0xff53('0x6'))['db'];var utils=require(_0xff53('0x7'));var logger=require(_0xff53('0x8'))(_0xff53('0x9'));var config=require(_0xff53('0xa'));var jayson=require(_0xff53('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27b397,_0x5751e7,_0x1c27bb){return new BPromise(function(_0x122746,_0x1bc4b3){return client['request'](_0x27b397,_0x1c27bb)['then'](function(_0x3c001d){logger['info'](_0xff53('0xc'),_0x5751e7,_0xff53('0xd'));logger['debug'](_0xff53('0xe'),_0x5751e7,_0xff53('0xd'),JSON['stringify'](_0x3c001d));if(_0x3c001d[_0xff53('0xf')]){if(_0x3c001d[_0xff53('0xf')][_0xff53('0x10')]===0x1f4){logger['error'](_0xff53('0xc'),_0x5751e7,_0x3c001d[_0xff53('0xf')][_0xff53('0x11')]);return _0x1bc4b3(_0x3c001d['error'][_0xff53('0x11')]);}logger[_0xff53('0xf')]('Attachment,\x20%s,\x20%s',_0x5751e7,_0x3c001d['error']['message']);return _0x122746(_0x3c001d['error'][_0xff53('0x11')]);}else{logger[_0xff53('0x12')](_0xff53('0xc'),_0x5751e7,'request\x20sent');_0x122746(_0x3c001d[_0xff53('0x13')]['message']);}})['catch'](function(_0x12e90b){logger[_0xff53('0xf')](_0xff53('0xc'),_0x5751e7,_0x12e90b);_0x1bc4b3(_0x12e90b);});});}exports[_0xff53('0x14')]=function(_0x38883f){var _0x319ce5=this;return new Promise(function(_0x14b502,_0x5e9ba6){return db['Attachment'][_0xff53('0x15')](_0x38883f['body'],{'raw':_0x38883f[_0xff53('0x16')]?_0x38883f[_0xff53('0x16')][_0xff53('0x17')]===undefined?!![]:![]:!![]})[_0xff53('0x18')](function(_0x39b3d1){logger[_0xff53('0x12')](_0xff53('0x14'),_0x38883f);logger[_0xff53('0x19')](_0xff53('0x14'),_0x38883f,JSON['stringify'](_0x39b3d1));_0x14b502(_0x39b3d1);})[_0xff53('0x1a')](function(_0x5cd878){logger['error']('CreateAttachment',_0x5cd878['message'],_0x38883f);_0x5e9ba6(_0x319ce5[_0xff53('0xf')](0x1f4,_0x5cd878[_0xff53('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 1e4281b..75d8c70 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x2e6d1d,_0x41bc01){_0x2e6d1d=_0x2e6d1d-0x0;var _0xb0f086=_0xdb28[_0x2e6d1d];return _0xb0f086;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x1e6242,_0x5a70a6){var _0x19a588=function(_0x8f70ea){while(--_0x8f70ea){_0x1e6242['push'](_0x1e6242['shift']());}};_0x19a588(++_0x5a70a6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x36c20f,_0x22ff16){_0x36c20f=_0x36c20f-0x0;var _0x5bf69a=_0x5f2f[_0x36c20f];return _0x5bf69a;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 3a8827d..db36ce8 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 _0xe088=['passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','google','/login','profile','email','clientSecret','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','find','emails','admin','user','agent','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','getLicense','lodash'];(function(_0x5bd265,_0x49eadd){var _0x372fdf=function(_0x36069b){while(--_0x36069b){_0x5bd265['push'](_0x5bd265['shift']());}};_0x372fdf(++_0x49eadd);}(_0xe088,0x83));var _0x8e08=function(_0x8958a2,_0x25ec6c){_0x8958a2=_0x8958a2-0x0;var _0x5dca35=_0xe088[_0x8958a2];return _0x5dca35;};'use strict';var _=require(_0x8e08('0x0'));var passport=require(_0x8e08('0x1'));var GoogleStrategy=require(_0x8e08('0x2'))[_0x8e08('0x3')];var moment=require(_0x8e08('0x4'));var db=require(_0x8e08('0x5'))['db'];var config=require(_0x8e08('0x6'));var signToken=require(_0x8e08('0x7'))[_0x8e08('0x8')];var utils=require(_0x8e08('0x9'));exports[_0x8e08('0xa')]=passport['authenticate'](_0x8e08('0xb'),{'failureRedirect':_0x8e08('0xc'),'scope':[_0x8e08('0xd'),_0x8e08('0xe')],'session':![]});exports['callback']=passport['authenticate']('google',{'failureRedirect':'/login','session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x8e08('0xb')]?config[_0x8e08('0xb')]['clientID']:'id','clientSecret':config[_0x8e08('0xb')]?config['google'][_0x8e08('0xf')]:_0x8e08('0x10'),'callbackURL':config[_0x8e08('0xb')]?config[_0x8e08('0xb')][_0x8e08('0x11')]:''},function(_0x591297,_0x5d9401,_0x1b67be,_0x527cce){var _0x378b30,_0x189bf4;return db['Setting'][_0x8e08('0x12')]({'where':{'id':0x1},'attributes':[_0x8e08('0x13'),_0x8e08('0x14')],'raw':!![]})['then'](function(_0x30e9ee){_0x378b30=_0x30e9ee;return db['User'][_0x8e08('0x15')]({'where':{'email':_['map'](_0x1b67be[_0x8e08('0x16')],'value'),'role':{'$or':[_0x8e08('0x17'),_0x8e08('0x18'),_0x8e08('0x19')]}}});})[_0x8e08('0x1a')](function(_0x4dc8ae){_0x189bf4=_0x4dc8ae;if(_0x189bf4){if(_0x189bf4[_0x8e08('0x1b')]){return _0x527cce(_0x8e08('0x1c'));}else if(_0x378b30[_0x8e08('0x14')]>0x0){if(_0x189bf4[_0x8e08('0x1d')]){if(moment(_0x189bf4[_0x8e08('0x1e')])[_0x8e08('0x1f')](_0x378b30[_0x8e08('0x14')],'minutes')>moment()){return _0x527cce(_0x8e08('0x1c'));}else{return utils['clearBlockUser'](_0x189bf4,0x0,![],null)[_0x8e08('0x1a')](function(){return utils['getLicense'](_0x189bf4);})['then'](function(){return _0x527cce(null,_0x189bf4);});}}else{return utils['getLicense'](_0x189bf4)[_0x8e08('0x1a')](function(){return _0x527cce(null,_0x189bf4);});}}else{return utils[_0x8e08('0x20')](_0x189bf4)[_0x8e08('0x1a')](function(){return _0x527cce(null,_0x189bf4);});}}return _0x527cce(_0x8e08('0x1c'));})['catch'](function(_0x45b29f){_0x527cce(_0x45b29f);});})); \ No newline at end of file +var _0xcecc=['blockedAt','add','clearBlockUser','getLicense','lodash','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','email','callback','google','/login','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','admin','user','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked'];(function(_0x3edbec,_0x5ccb04){var _0x2fc51c=function(_0x19257d){while(--_0x19257d){_0x3edbec['push'](_0x3edbec['shift']());}};_0x2fc51c(++_0x5ccb04);}(_0xcecc,0x148));var _0xccec=function(_0xa75234,_0x2e9f29){_0xa75234=_0xa75234-0x0;var _0x596e0f=_0xcecc[_0xa75234];return _0x596e0f;};'use strict';var _=require(_0xccec('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')[_0xccec('0x1')];var moment=require(_0xccec('0x2'));var db=require(_0xccec('0x3'))['db'];var config=require(_0xccec('0x4'));var signToken=require(_0xccec('0x5'))[_0xccec('0x6')];var utils=require(_0xccec('0x7'));exports[_0xccec('0x8')]=passport[_0xccec('0x9')]('google',{'failureRedirect':'/login','scope':['profile',_0xccec('0xa')],'session':![]});exports[_0xccec('0xb')]=passport['authenticate'](_0xccec('0xc'),{'failureRedirect':_0xccec('0xd'),'session':![]});passport[_0xccec('0xe')](new GoogleStrategy({'clientID':config[_0xccec('0xc')]?config[_0xccec('0xc')][_0xccec('0xf')]:'id','clientSecret':config[_0xccec('0xc')]?config[_0xccec('0xc')][_0xccec('0x10')]:_0xccec('0x11'),'callbackURL':config['google']?config[_0xccec('0xc')][_0xccec('0x12')]:''},function(_0x648c9c,_0x45ff0a,_0x4b8af2,_0x39e3e7){var _0x141fbc,_0x3b0e49;return db[_0xccec('0x13')][_0xccec('0x14')]({'where':{'id':0x1},'attributes':[_0xccec('0x15'),_0xccec('0x16')],'raw':!![]})[_0xccec('0x17')](function(_0x1abce6){_0x141fbc=_0x1abce6;return db[_0xccec('0x18')][_0xccec('0x19')]({'where':{'email':_[_0xccec('0x1a')](_0x4b8af2['emails'],'value'),'role':{'$or':[_0xccec('0x1b'),_0xccec('0x1c'),'agent']}}});})[_0xccec('0x17')](function(_0x2f0c95){_0x3b0e49=_0x2f0c95;if(_0x3b0e49){if(_0x3b0e49[_0xccec('0x1d')]){return _0x39e3e7(_0xccec('0x1e'));}else if(_0x141fbc[_0xccec('0x16')]>0x0){if(_0x3b0e49[_0xccec('0x1f')]){if(moment(_0x3b0e49[_0xccec('0x20')])[_0xccec('0x21')](_0x141fbc[_0xccec('0x16')],'minutes')>moment()){return _0x39e3e7(_0xccec('0x1e'));}else{return utils[_0xccec('0x22')](_0x3b0e49,0x0,![],null)[_0xccec('0x17')](function(){return utils[_0xccec('0x23')](_0x3b0e49);})[_0xccec('0x17')](function(){return _0x39e3e7(null,_0x3b0e49);});}}else{return utils['getLicense'](_0x3b0e49)[_0xccec('0x17')](function(){return _0x39e3e7(null,_0x3b0e49);});}}else{return utils['getLicense'](_0x3b0e49)[_0xccec('0x17')](function(){return _0x39e3e7(null,_0x3b0e49);});}}return _0x39e3e7(_0xccec('0x1e'));})['catch'](function(_0x30579a){_0x39e3e7(_0x30579a);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 54d05b8..899fb2c 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 _0xb613=['../user/user.controller.js','../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie','exports','passport','Router','./authGoogle.controller'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xb613,0x152));var _0x3b61=function(_0x4d521e,_0x58ba39){_0x4d521e=_0x4d521e-0x0;var _0x3beb42=_0xb613[_0x4d521e];return _0x3beb42;};'use strict';var express=require('express');var passport=require(_0x3b61('0x0'));var router=express[_0x3b61('0x1')]();var controller=require(_0x3b61('0x2'));var userController=require(_0x3b61('0x3'));var authService=require(_0x3b61('0x4'));router[_0x3b61('0x5')]('/',controller[_0x3b61('0x6')]);router[_0x3b61('0x5')]('/callback',controller[_0x3b61('0x7')],authService[_0x3b61('0x8')],userController[_0x3b61('0x6')],authService[_0x3b61('0x9')]);module[_0x3b61('0xa')]=router; \ No newline at end of file +var _0xb36f=['callback','isMiddleware','setTokenCookie','exports','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback'];(function(_0x35b195,_0x8893d5){var _0x2433bf=function(_0x22be07){while(--_0x22be07){_0x35b195['push'](_0x35b195['shift']());}};_0x2433bf(++_0x8893d5);}(_0xb36f,0x154));var _0xfb36=function(_0x245fda,_0x6e64b3){_0x245fda=_0x245fda-0x0;var _0x2b19cd=_0xb36f[_0x245fda];return _0x2b19cd;};'use strict';var express=require(_0xfb36('0x0'));var passport=require(_0xfb36('0x1'));var router=express['Router']();var controller=require(_0xfb36('0x2'));var userController=require(_0xfb36('0x3'));var authService=require(_0xfb36('0x4'));router[_0xfb36('0x5')]('/',controller[_0xfb36('0x6')]);router[_0xfb36('0x5')](_0xfb36('0x7'),controller[_0xfb36('0x8')],authService[_0xfb36('0x9')],userController[_0xfb36('0x6')],authService[_0xfb36('0xa')]);module[_0xfb36('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index f2bf053..1eaf3ca 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 _0xa047=['message','stringify','status','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','generate','trim','toLowerCase','Setting','This\x20email\x20is\x20not\x20registered.','disabled','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','send','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','findOne','allowedLoginAttempts','then','name','password','blocked','blockedAt','loginAttempts','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','blockDuration','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','pass','merge','format','\x22%s\x22\x20<%s>','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xa047,0x1c5));var _0x7a04=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xa047[_0x68ee8b];return _0x5148f7;};'use strict';var util=require(_0x7a04('0x0'));var passport=require(_0x7a04('0x1'));var LocalStrategy=require(_0x7a04('0x2'))[_0x7a04('0x3')];var jayson=require('jayson/promise');var _=require(_0x7a04('0x4'));var rs=require('randomstring');var moment=require(_0x7a04('0x5'));var db=require(_0x7a04('0x6'))['db'];var authService=require(_0x7a04('0x7'));var utils=require(_0x7a04('0x8'));var client=jayson[_0x7a04('0x9')]['http']({'port':0x232b});function localAuthenticate(_0x12564a,_0x3166ff,_0x1dc89f,_0x5c183c){var _0x10d92f,_0x10faf9;return db['Setting'][_0x7a04('0xa')]({'where':{'id':0x1},'attributes':[_0x7a04('0xb'),'blockDuration'],'raw':!![]})[_0x7a04('0xc')](function(_0x4d21d3){_0x10d92f=_0x4d21d3;return _0x12564a['findOne']({'attributes':['id',_0x7a04('0xd'),_0x7a04('0xe'),'salt','role','disabled',_0x7a04('0xf'),_0x7a04('0x10'),_0x7a04('0x11')],'where':{'name':_0x3166ff,'role':{'$or':[_0x7a04('0x12'),_0x7a04('0x13'),_0x7a04('0x14')]}}});})[_0x7a04('0xc')](function(_0x3a50e9){if(!_0x3a50e9||_0x3a50e9&&_0x3a50e9[_0x7a04('0xd')]!==_0x3166ff){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x10faf9=_0x3a50e9;return _0x10faf9;}})[_0x7a04('0xc')](function(){_0x10faf9[_0x7a04('0x15')](_0x1dc89f,function(_0x26d4bf,_0x377fa1){var _0x2bb838=_0x10faf9[_0x7a04('0x11')]+0x1;if(_0x26d4bf){return _0x5c183c(_0x26d4bf);}else if(!_0x377fa1){if(_0x10faf9['disabled']){return _0x5c183c(null,![],{'message':_0x7a04('0x16')});}else if(_0x10d92f[_0x7a04('0xb')]>0x0){if(_0x10faf9[_0x7a04('0xf')]){if(_0x10d92f['blockDuration']>0x0){if(moment(_0x10faf9['blockedAt'])[_0x7a04('0x17')](_0x10d92f[_0x7a04('0x18')],_0x7a04('0x19'))>moment()){return _0x5c183c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x7a04('0x1a')](_0x10faf9,_0x2bb838,![],null)[_0x7a04('0xc')](function(){return _0x5c183c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x5c183c(null,![],{'message':_0x7a04('0x16')});}}else{if(_0x2bb838>=_0x10d92f['allowedLoginAttempts']){return utils[_0x7a04('0x1a')](_0x10faf9,0x0,!![],moment())['then'](function(){return _0x5c183c(null,![],{'message':_0x7a04('0x16')});});}else{return utils[_0x7a04('0x1a')](_0x10faf9,_0x2bb838,![],null)['then'](function(){return _0x5c183c(null,![],{'message':_0x7a04('0x16')});});}}}else{return _0x5c183c(null,![],{'message':_0x7a04('0x16')});}}else{if(_0x10faf9['disabled']){return _0x5c183c(null,![],{'message':_0x7a04('0x16')});}else if(_0x10d92f[_0x7a04('0xb')]>0x0){if(_0x10faf9['blocked']){if(_0x10d92f[_0x7a04('0x18')]>0x0){if(moment(_0x10faf9[_0x7a04('0x10')])[_0x7a04('0x17')](_0x10d92f[_0x7a04('0x18')],_0x7a04('0x19'))>moment()){return _0x5c183c(null,![],{'message':_0x7a04('0x16')});}else{return utils[_0x7a04('0x1a')](_0x10faf9,0x0,![],null)[_0x7a04('0xc')](function(){return utils['getLicense'](_0x10faf9);})[_0x7a04('0xc')](function(){return _0x5c183c(null,_0x10faf9);});}}else{return _0x5c183c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x7a04('0x1a')](_0x10faf9,0x0,![],null)[_0x7a04('0xc')](function(){return utils[_0x7a04('0x1b')](_0x10faf9);})[_0x7a04('0xc')](function(){return _0x5c183c(null,_0x10faf9);})[_0x7a04('0x1c')](function(_0x1ff41b){return _0x5c183c(null,![],_0x1ff41b);});}}else{if(_0x10faf9[_0x7a04('0xf')]){return _0x5c183c(null,![],{'message':_0x7a04('0x16')});}else{return utils[_0x7a04('0x1b')](_0x10faf9)[_0x7a04('0xc')](function(){return _0x5c183c(null,_0x10faf9);});}}}});})[_0x7a04('0x1c')](function(_0x49a8d0){return _0x5c183c(null,![],_0x49a8d0);});}function sendServiceMail(_0xb9a6fe){return db['MailAccount'][_0x7a04('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x7a04('0xd'),_0x7a04('0x1e')],'include':[{'model':db[_0x7a04('0x1f')],'as':_0x7a04('0x20')}]})[_0x7a04('0xc')](function(_0x4ce6f2){if(!_0x4ce6f2){throw new Error(_0x7a04('0x21'));}var _0x487b74={'tls':{'rejectUnauthorized':![]}};if(_0x4ce6f2[_0x7a04('0x20')][_0x7a04('0x22')]){_0x487b74['service']=_0x4ce6f2[_0x7a04('0x20')][_0x7a04('0x22')];}else{_0x487b74['host']=_0x4ce6f2['Smtp'][_0x7a04('0x23')];_0x487b74[_0x7a04('0x24')]=_0x4ce6f2[_0x7a04('0x20')][_0x7a04('0x24')];_0x487b74[_0x7a04('0x25')]=_0x4ce6f2[_0x7a04('0x20')][_0x7a04('0x25')];}if(_0x4ce6f2[_0x7a04('0x20')]['authentication']){_0x487b74[_0x7a04('0x26')]={'user':_0x4ce6f2[_0x7a04('0x20')]['user'],'pass':_0x4ce6f2[_0x7a04('0x20')][_0x7a04('0x27')]};}var _0x1df634={'account':_0x487b74,'message':_[_0x7a04('0x28')]({'from':util[_0x7a04('0x29')](_0x7a04('0x2a'),_0x4ce6f2[_0x7a04('0xd')],_0x4ce6f2['email']||_0x4ce6f2[_0x7a04('0x20')][_0x7a04('0x13')])},_0xb9a6fe)};return client['request']('SendMail',_0x1df634);})[_0x7a04('0xc')](function(_0x4e10cd){if(_0x4e10cd[_0x7a04('0x2b')]){throw new Error(util['format'](_0x7a04('0x2c'),_0x4e10cd[_0x7a04('0x2b')][_0x7a04('0x2d')]||JSON[_0x7a04('0x2e')](_0x4e10cd[_0x7a04('0x2b')])));}return!![];});}function handleError(_0x6df715,_0x2b2531,_0x39ede8){return _0x6df715[_0x7a04('0x2f')](_0x2b2531||0x1f4)['send']({'message':_0x39ede8?_0x39ede8['message']||_0x39ede8:''});}exports['login']=function(_0x5dd834,_0x37b7bd,_0x564890){passport[_0x7a04('0x15')](_0x7a04('0x30'),function(_0x19f7ec,_0x38cf7d,_0x34f152){var _0x2fb643=_0x19f7ec||_0x34f152;if(_0x2fb643){return handleError(_0x37b7bd,0x191,_0x2fb643);}if(!_0x38cf7d){return handleError(_0x37b7bd,0x194,{'message':_0x7a04('0x31')});}else{var _0x4e7713={'payload':{'id':_0x38cf7d['id'],'role':_0x38cf7d[_0x7a04('0x32')]},'options':{'expiresIn':0x15180}};return authService[_0x7a04('0x33')](_0x4e7713)[_0x7a04('0xc')](function(_0x4fda19){_0x37b7bd[_0x7a04('0x34')]({'id':_0x38cf7d['id'],'token':_0x4fda19,'statusCall':'','isAlreadyLogged':_0x38cf7d[_0x7a04('0x35')]});});}})(_0x5dd834,_0x37b7bd,_0x564890);};exports[_0x7a04('0x36')]=function(_0x17d05c,_0x2dc001,_0x2db53e){if(!_0x17d05c[_0x7a04('0x37')][_0x7a04('0x1e')]){return handleError(_0x2dc001,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x4811b7=rs[_0x7a04('0x38')]();_0x17d05c[_0x7a04('0x37')]['email']=_0x17d05c['body']['email'][_0x7a04('0x39')]()[_0x7a04('0x3a')]();var _0x295c5b;return db[_0x7a04('0x3b')][_0x7a04('0xa')]({'where':{'id':0x1},'attributes':[_0x7a04('0xb'),'blockDuration'],'raw':!![]})[_0x7a04('0xc')](function(_0x220829){_0x295c5b=_0x220829;return db['User']['find']({'where':{'email':_0x17d05c[_0x7a04('0x37')][_0x7a04('0x1e')]}});})[_0x7a04('0xc')](function(_0x27ada9){if(!_0x27ada9){throw new Error(_0x7a04('0x3c'));}if(_0x27ada9[_0x7a04('0x3d')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x27ada9[_0x7a04('0xf')]){if(moment(_0x27ada9[_0x7a04('0x10')])[_0x7a04('0x17')](_0x295c5b[_0x7a04('0x18')],_0x7a04('0x19'))>moment()){throw new Error(_0x7a04('0x3e'));}else{_0x27ada9[_0x7a04('0xf')]=![];_0x27ada9['blockedAt']=null;}}_0x27ada9[_0x7a04('0x3f')]=_0x4811b7;_0x27ada9[_0x7a04('0x40')]=Date['now']()+0x36ee80;return _0x27ada9['save']();})['then'](function(){return sendServiceMail({'to':_0x17d05c[_0x7a04('0x37')][_0x7a04('0x1e')],'subject':_0x7a04('0x41'),'text':_0x7a04('0x42')+_0x7a04('0x43')+'https://'+_0x17d05c['headers'][_0x7a04('0x23')]+_0x7a04('0x44')+_0x4811b7+'\x0a\x0a'+_0x7a04('0x45')});})[_0x7a04('0xc')](function(){_0x2dc001['status'](0xc8)['send']({'message':_0x7a04('0x46')});})['catch'](function(_0x19c1df){return handleError(_0x2dc001,0x1f4,_0x19c1df);});};exports['reset']=function(_0x467fcf,_0x143bcf,_0x41d12b){return db[_0x7a04('0x47')][_0x7a04('0x1d')]({'where':{'resetPasswordToken':_0x467fcf[_0x7a04('0x48')][_0x7a04('0x49')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x3cb8e7){if(!_0x3cb8e7){throw new Error(_0x7a04('0x4a'));}return db[_0x7a04('0x3b')][_0x7a04('0xa')]({'attributes':['id',_0x7a04('0x4b'),_0x7a04('0x4c'),_0x7a04('0x4d')]})[_0x7a04('0xc')](function(_0x5109f6){if(_0x5109f6['securePassword'])authService[_0x7a04('0x4e')](_0x467fcf[_0x7a04('0x37')]['password']);if(!_0x5109f6[_0x7a04('0x4c')]||!_0x3cb8e7['previousPasswords'])return _0x3cb8e7;authService['validatePasswordHistory'](_0x467fcf[_0x7a04('0x37')]['password'],_0x3cb8e7[_0x7a04('0x4f')],_0x5109f6[_0x7a04('0x4d')]);return _0x3cb8e7;})[_0x7a04('0xc')](function(){_0x3cb8e7['password']=_0x467fcf[_0x7a04('0x37')][_0x7a04('0xe')];_0x3cb8e7[_0x7a04('0x3f')]=null;_0x3cb8e7['resetPasswordExpires']=null;return _0x3cb8e7['save']();});})[_0x7a04('0xc')](function(){_0x143bcf[_0x7a04('0x2f')](0xc8)[_0x7a04('0x50')]({'message':_0x7a04('0x51')});})[_0x7a04('0x1c')](function(_0x3bbdd9){return handleError(_0x143bcf,0x1f4,_0x3bbdd9);});};passport[_0x7a04('0x52')](new LocalStrategy({'usernameField':_0x7a04('0xd'),'passwordField':_0x7a04('0xe')},function(_0x515b44,_0xd50a15,_0xdcc457){return localAuthenticate(db[_0x7a04('0x47')],_0x515b44,_0xd50a15,_0xdcc457);})); \ No newline at end of file +var _0x2962=['generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','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://','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','previousPasswords','validatePasswordHistory','resetPasswordToken','resetPasswordExpires','save','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','authenticate','blockDuration','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','MailAccount','find','name','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing'];(function(_0x49456e,_0x5e173f){var _0x304236=function(_0x19da52){while(--_0x19da52){_0x49456e['push'](_0x49456e['shift']());}};_0x304236(++_0x5e173f);}(_0x2962,0xca));var _0x2296=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2962[_0x4b369d];return _0x571a98;};'use strict';var util=require(_0x2296('0x0'));var passport=require(_0x2296('0x1'));var LocalStrategy=require(_0x2296('0x2'))[_0x2296('0x3')];var jayson=require('jayson/promise');var _=require(_0x2296('0x4'));var rs=require('randomstring');var moment=require(_0x2296('0x5'));var db=require(_0x2296('0x6'))['db'];var authService=require(_0x2296('0x7'));var utils=require(_0x2296('0x8'));var client=jayson[_0x2296('0x9')]['http']({'port':0x232b});function localAuthenticate(_0x33bbaf,_0x3442b6,_0x1fc88f,_0x27ee7d){var _0x531ccd,_0xa32808;return db[_0x2296('0xa')][_0x2296('0xb')]({'where':{'id':0x1},'attributes':[_0x2296('0xc'),'blockDuration'],'raw':!![]})['then'](function(_0x20461c){_0x531ccd=_0x20461c;return _0x33bbaf[_0x2296('0xb')]({'attributes':['id','name',_0x2296('0xd'),_0x2296('0xe'),_0x2296('0xf'),_0x2296('0x10'),_0x2296('0x11'),_0x2296('0x12'),_0x2296('0x13')],'where':{'name':_0x3442b6,'role':{'$or':[_0x2296('0x14'),_0x2296('0x15'),_0x2296('0x16')]}}});})[_0x2296('0x17')](function(_0x12945f){if(!_0x12945f||_0x12945f&&_0x12945f['name']!==_0x3442b6){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xa32808=_0x12945f;return _0xa32808;}})[_0x2296('0x17')](function(){_0xa32808[_0x2296('0x18')](_0x1fc88f,function(_0x335e0a,_0x4549b5){var _0x1839fd=_0xa32808[_0x2296('0x13')]+0x1;if(_0x335e0a){return _0x27ee7d(_0x335e0a);}else if(!_0x4549b5){if(_0xa32808[_0x2296('0x10')]){return _0x27ee7d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x531ccd[_0x2296('0xc')]>0x0){if(_0xa32808[_0x2296('0x11')]){if(_0x531ccd[_0x2296('0x19')]>0x0){if(moment(_0xa32808[_0x2296('0x12')])[_0x2296('0x1a')](_0x531ccd[_0x2296('0x19')],_0x2296('0x1b'))>moment()){return _0x27ee7d(null,![],{'message':_0x2296('0x1c')});}else{return utils[_0x2296('0x1d')](_0xa32808,_0x1839fd,![],null)[_0x2296('0x17')](function(){return _0x27ee7d(null,![],{'message':_0x2296('0x1c')});});}}else{return _0x27ee7d(null,![],{'message':_0x2296('0x1c')});}}else{if(_0x1839fd>=_0x531ccd['allowedLoginAttempts']){return utils[_0x2296('0x1d')](_0xa32808,0x0,!![],moment())['then'](function(){return _0x27ee7d(null,![],{'message':_0x2296('0x1c')});});}else{return utils[_0x2296('0x1d')](_0xa32808,_0x1839fd,![],null)[_0x2296('0x17')](function(){return _0x27ee7d(null,![],{'message':_0x2296('0x1c')});});}}}else{return _0x27ee7d(null,![],{'message':_0x2296('0x1c')});}}else{if(_0xa32808[_0x2296('0x10')]){return _0x27ee7d(null,![],{'message':_0x2296('0x1c')});}else if(_0x531ccd[_0x2296('0xc')]>0x0){if(_0xa32808[_0x2296('0x11')]){if(_0x531ccd[_0x2296('0x19')]>0x0){if(moment(_0xa32808[_0x2296('0x12')])[_0x2296('0x1a')](_0x531ccd[_0x2296('0x19')],'minutes')>moment()){return _0x27ee7d(null,![],{'message':_0x2296('0x1c')});}else{return utils[_0x2296('0x1d')](_0xa32808,0x0,![],null)[_0x2296('0x17')](function(){return utils[_0x2296('0x1e')](_0xa32808);})[_0x2296('0x17')](function(){return _0x27ee7d(null,_0xa32808);});}}else{return _0x27ee7d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x2296('0x1d')](_0xa32808,0x0,![],null)[_0x2296('0x17')](function(){return utils[_0x2296('0x1e')](_0xa32808);})[_0x2296('0x17')](function(){return _0x27ee7d(null,_0xa32808);})['catch'](function(_0x3523b4){return _0x27ee7d(null,![],_0x3523b4);});}}else{if(_0xa32808[_0x2296('0x11')]){return _0x27ee7d(null,![],{'message':_0x2296('0x1c')});}else{return utils[_0x2296('0x1e')](_0xa32808)[_0x2296('0x17')](function(){return _0x27ee7d(null,_0xa32808);});}}}});})[_0x2296('0x1f')](function(_0x5e6396){return _0x27ee7d(null,![],_0x5e6396);});}function sendServiceMail(_0x5e8d09){return db[_0x2296('0x20')][_0x2296('0x21')]({'where':{'service':!![]},'attributes':['id',_0x2296('0x22'),_0x2296('0x23')],'include':[{'model':db[_0x2296('0x24')],'as':'Smtp'}]})[_0x2296('0x17')](function(_0x237cd3){if(!_0x237cd3){throw new Error(_0x2296('0x25'));}var _0x3df6b4={'tls':{'rejectUnauthorized':![]}};if(_0x237cd3[_0x2296('0x26')][_0x2296('0x27')]){_0x3df6b4['service']=_0x237cd3[_0x2296('0x26')][_0x2296('0x27')];}else{_0x3df6b4[_0x2296('0x28')]=_0x237cd3['Smtp'][_0x2296('0x28')];_0x3df6b4[_0x2296('0x29')]=_0x237cd3[_0x2296('0x26')]['port'];_0x3df6b4[_0x2296('0x2a')]=_0x237cd3[_0x2296('0x26')][_0x2296('0x2a')];}if(_0x237cd3['Smtp'][_0x2296('0x2b')]){_0x3df6b4[_0x2296('0x2c')]={'user':_0x237cd3['Smtp'][_0x2296('0x15')],'pass':_0x237cd3[_0x2296('0x26')][_0x2296('0x2d')]};}var _0x15ebbf={'account':_0x3df6b4,'message':_[_0x2296('0x2e')]({'from':util[_0x2296('0x2f')](_0x2296('0x30'),_0x237cd3['name'],_0x237cd3[_0x2296('0x23')]||_0x237cd3[_0x2296('0x26')][_0x2296('0x15')])},_0x5e8d09)};return client['request']('SendMail',_0x15ebbf);})[_0x2296('0x17')](function(_0x288a5b){if(_0x288a5b[_0x2296('0x31')]){throw new Error(util[_0x2296('0x2f')](_0x2296('0x32'),_0x288a5b[_0x2296('0x31')][_0x2296('0x33')]||JSON[_0x2296('0x34')](_0x288a5b['error'])));}return!![];});}function handleError(_0x53c2bf,_0x1987eb,_0x3fa4b2){return _0x53c2bf[_0x2296('0x35')](_0x1987eb||0x1f4)[_0x2296('0x36')]({'message':_0x3fa4b2?_0x3fa4b2['message']||_0x3fa4b2:''});}exports['login']=function(_0x158cd8,_0x50637c,_0x26ac06){passport[_0x2296('0x18')](_0x2296('0x37'),function(_0x469f6a,_0x5d1728,_0xc1415b){var _0x6b85a5=_0x469f6a||_0xc1415b;if(_0x6b85a5){return handleError(_0x50637c,0x191,_0x6b85a5);}if(!_0x5d1728){return handleError(_0x50637c,0x194,{'message':_0x2296('0x38')});}else{var _0x5abdea={'payload':{'id':_0x5d1728['id'],'role':_0x5d1728[_0x2296('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x2296('0x39')](_0x5abdea)['then'](function(_0x15f5b9){_0x50637c['json']({'id':_0x5d1728['id'],'token':_0x15f5b9,'statusCall':'','isAlreadyLogged':_0x5d1728[_0x2296('0x3a')]});});}})(_0x158cd8,_0x50637c,_0x26ac06);};exports[_0x2296('0x3b')]=function(_0x3232de,_0x5e6963,_0x49e61d){if(!_0x3232de[_0x2296('0x3c')][_0x2296('0x23')]){return handleError(_0x5e6963,0x1f4,{'message':_0x2296('0x3d')});}var _0x458171=rs[_0x2296('0x3e')]();_0x3232de[_0x2296('0x3c')]['email']=_0x3232de[_0x2296('0x3c')]['email'][_0x2296('0x3f')]()[_0x2296('0x40')]();var _0x4d9824;return db[_0x2296('0xa')][_0x2296('0xb')]({'where':{'id':0x1},'attributes':[_0x2296('0xc'),_0x2296('0x19')],'raw':!![]})[_0x2296('0x17')](function(_0x398a02){_0x4d9824=_0x398a02;return db[_0x2296('0x41')][_0x2296('0x21')]({'where':{'email':_0x3232de['body'][_0x2296('0x23')]}});})[_0x2296('0x17')](function(_0x510a4d){if(!_0x510a4d){throw new Error(_0x2296('0x42'));}if(_0x510a4d[_0x2296('0x10')]){throw new Error(_0x2296('0x43'));}if(_0x510a4d[_0x2296('0x11')]){if(moment(_0x510a4d['blockedAt'])[_0x2296('0x1a')](_0x4d9824[_0x2296('0x19')],'minutes')>moment()){throw new Error(_0x2296('0x44'));}else{_0x510a4d[_0x2296('0x11')]=![];_0x510a4d['blockedAt']=null;}}_0x510a4d['resetPasswordToken']=_0x458171;_0x510a4d['resetPasswordExpires']=Date[_0x2296('0x45')]()+0x36ee80;return _0x510a4d['save']();})[_0x2296('0x17')](function(){return sendServiceMail({'to':_0x3232de[_0x2296('0x3c')][_0x2296('0x23')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x2296('0x46')+_0x2296('0x47')+_0x2296('0x48')+_0x3232de['headers'][_0x2296('0x28')]+'/reset/'+_0x458171+'\x0a\x0a'+_0x2296('0x49')});})[_0x2296('0x17')](function(){_0x5e6963[_0x2296('0x35')](0xc8)[_0x2296('0x36')]({'message':_0x2296('0x4a')});})[_0x2296('0x1f')](function(_0x54b39a){return handleError(_0x5e6963,0x1f4,_0x54b39a);});};exports['reset']=function(_0x59b8f0,_0x51d556,_0x403e88){return db[_0x2296('0x41')][_0x2296('0x21')]({'where':{'resetPasswordToken':_0x59b8f0[_0x2296('0x4b')][_0x2296('0x4c')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x38ca7e){if(!_0x38ca7e){throw new Error(_0x2296('0x4d'));}return db[_0x2296('0xa')]['findOne']({'attributes':['id','securePassword',_0x2296('0x4e'),_0x2296('0x4f')]})[_0x2296('0x17')](function(_0x24dc02){if(_0x24dc02[_0x2296('0x50')])authService['validatePasswordPattern'](_0x59b8f0[_0x2296('0x3c')]['password']);if(!_0x24dc02[_0x2296('0x4e')]||!_0x38ca7e[_0x2296('0x51')])return _0x38ca7e;authService[_0x2296('0x52')](_0x59b8f0[_0x2296('0x3c')][_0x2296('0xd')],_0x38ca7e[_0x2296('0x51')],_0x24dc02[_0x2296('0x4f')]);return _0x38ca7e;})[_0x2296('0x17')](function(){_0x38ca7e[_0x2296('0xd')]=_0x59b8f0[_0x2296('0x3c')][_0x2296('0xd')];_0x38ca7e[_0x2296('0x53')]=null;_0x38ca7e[_0x2296('0x54')]=null;return _0x38ca7e[_0x2296('0x55')]();});})[_0x2296('0x17')](function(){_0x51d556[_0x2296('0x35')](0xc8)['send']({'message':_0x2296('0x56')});})[_0x2296('0x1f')](function(_0x14caca){return handleError(_0x51d556,0x1f4,_0x14caca);});};passport[_0x2296('0x57')](new LocalStrategy({'usernameField':_0x2296('0x22'),'passwordField':_0x2296('0xd')},function(_0x36b5d3,_0x4f4595,_0x3d75c4){return localAuthenticate(db[_0x2296('0x41')],_0x36b5d3,_0x4f4595,_0x3d75c4);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 1c92206..ce8ea3d 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 _0xfd62=['post','/forgot','forgot','express','login'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xfd62,0x16b));var _0x2fd6=function(_0x1cf1e2,_0x4c28af){_0x1cf1e2=_0x1cf1e2-0x0;var _0x207ab9=_0xfd62[_0x1cf1e2];return _0x207ab9;};'use strict';var express=require(_0x2fd6('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router['post']('/',controller[_0x2fd6('0x1')]);router[_0x2fd6('0x2')](_0x2fd6('0x3'),controller[_0x2fd6('0x4')]);router[_0x2fd6('0x2')]('/reset/:token',controller['reset']);module['exports']=router; \ No newline at end of file +var _0x3fff=['express','Router','./authLocal.controller','post','login','forgot','/reset/:token','reset'];(function(_0x3ebff7,_0x31cd5b){var _0x4eac05=function(_0x2e7695){while(--_0x2e7695){_0x3ebff7['push'](_0x3ebff7['shift']());}};_0x4eac05(++_0x31cd5b);}(_0x3fff,0xa8));var _0xf3ff=function(_0x319877,_0x53a027){_0x319877=_0x319877-0x0;var _0x24056d=_0x3fff[_0x319877];return _0x24056d;};'use strict';var express=require(_0xf3ff('0x0'));var router=express[_0xf3ff('0x1')]();var controller=require(_0xf3ff('0x2'));router[_0xf3ff('0x3')]('/',controller[_0xf3ff('0x4')]);router[_0xf3ff('0x3')]('/forgot',controller[_0xf3ff('0x5')]);router['post'](_0xf3ff('0x6'),controller[_0xf3ff('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index f2f2959..d5db5d7 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 _0x9143=['sequelize','exports','STRING'];(function(_0x5d4ca7,_0x19113b){var _0x3efc03=function(_0x59675b){while(--_0x59675b){_0x5d4ca7['push'](_0x5d4ca7['shift']());}};_0x3efc03(++_0x19113b);}(_0x9143,0x1a1));var _0x3914=function(_0xa326bb,_0x3682db){_0xa326bb=_0xa326bb-0x0;var _0x624f88=_0x9143[_0xa326bb];return _0x624f88;};'use strict';var Sequelize=require(_0x3914('0x0'));module[_0x3914('0x1')]={'name':{'type':Sequelize[_0x3914('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x95ae=['STRING','INTEGER','sequelize'];(function(_0x11f2f9,_0x24152b){var _0x226d6b=function(_0x2c196b){while(--_0x2c196b){_0x11f2f9['push'](_0x11f2f9['shift']());}};_0x226d6b(++_0x24152b);}(_0x95ae,0x13a));var _0xe95a=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x95ae[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require(_0xe95a('0x0'));module['exports']={'name':{'type':Sequelize[_0xe95a('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe95a('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 2d800dd..5c63d7e 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 _0xc4c6=['eml-format','rimraf','zip-dir','moment','mustache','util','path','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','Automation','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','params','find','create','body','Condition','addConditions','omit','ids','getConditions','findOne','nolimit','addActions','Action','getActions'];(function(_0x4da4ea,_0x2875d3){var _0x3cc102=function(_0x5549c2){while(--_0x5549c2){_0x4da4ea['push'](_0x4da4ea['shift']());}};_0x3cc102(++_0x2875d3);}(_0xc4c6,0x195));var _0x6c4c=function(_0x2551ad,_0x4d67c){_0x2551ad=_0x2551ad-0x0;var _0x522738=_0xc4c6[_0x2551ad];return _0x522738;};'use strict';var emlformat=require(_0x6c4c('0x0'));var rimraf=require(_0x6c4c('0x1'));var zipdir=require(_0x6c4c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6c4c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6c4c('0x4'));var util=require(_0x6c4c('0x5'));var path=require(_0x6c4c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c4c('0x7'));var squel=require(_0x6c4c('0x8'));var crypto=require(_0x6c4c('0x9'));var jsforce=require(_0x6c4c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6c4c('0xb'));var querystring=require(_0x6c4c('0xc'));var Papa=require(_0x6c4c('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6c4c('0xe'));var as=require(_0x6c4c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c4c('0x10'))(_0x6c4c('0x11'));var utils=require(_0x6c4c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x6c4c('0x13'));var db=require(_0x6c4c('0x14'))['db'];function respondWithStatusCode(_0x58a081,_0x5b28d4){_0x5b28d4=_0x5b28d4||0xcc;return function(_0x26a3af){if(_0x26a3af){return _0x58a081[_0x6c4c('0x15')](_0x5b28d4);}return _0x58a081[_0x6c4c('0x16')](_0x5b28d4)[_0x6c4c('0x17')]();};}function respondWithResult(_0x2867f5,_0x1542ad){_0x1542ad=_0x1542ad||0xc8;return function(_0x111ce1){if(_0x111ce1){return _0x2867f5[_0x6c4c('0x16')](_0x1542ad)[_0x6c4c('0x18')](_0x111ce1);}};}function respondWithFilteredResult(_0x16ab0e,_0x4dd4f7){return function(_0x2a233b){if(_0x2a233b){var _0x18dbc9=typeof _0x4dd4f7[_0x6c4c('0x19')]===_0x6c4c('0x1a')&&typeof _0x4dd4f7['limit']==='undefined';var _0x27aec0=_0x2a233b[_0x6c4c('0x1b')];var _0x32337e=_0x18dbc9?0x0:_0x4dd4f7[_0x6c4c('0x19')];var _0x42194d=_0x18dbc9?_0x2a233b[_0x6c4c('0x1b')]:_0x4dd4f7['offset']+_0x4dd4f7[_0x6c4c('0x1c')];var _0x4fa58d;if(_0x42194d>=_0x27aec0){_0x42194d=_0x27aec0;_0x4fa58d=0xc8;}else{_0x4fa58d=0xce;}_0x16ab0e[_0x6c4c('0x16')](_0x4fa58d);return _0x16ab0e[_0x6c4c('0x1d')](_0x6c4c('0x1e'),_0x32337e+'-'+_0x42194d+'/'+_0x27aec0)[_0x6c4c('0x18')](_0x2a233b);}return null;};}function patchUpdates(_0xf060cb){return function(_0x5999b0){try{jsonpatch[_0x6c4c('0x1f')](_0x5999b0,_0xf060cb,!![]);}catch(_0x23508b){return BPromise[_0x6c4c('0x20')](_0x23508b);}return _0x5999b0[_0x6c4c('0x21')]();};}function saveUpdates(_0x17b402,_0x4a415f){return function(_0x357c7d){if(_0x357c7d){return _0x357c7d[_0x6c4c('0x22')](_0x17b402)[_0x6c4c('0x23')](function(_0x3538cb){return _0x3538cb;});}return null;};}function removeEntity(_0x209b2e,_0x49098b){return function(_0x4e2a31){if(_0x4e2a31){return _0x4e2a31[_0x6c4c('0x24')]()['then'](function(){_0x209b2e[_0x6c4c('0x16')](0xcc)[_0x6c4c('0x17')]();});}};}function handleEntityNotFound(_0x68e88a,_0x221c34){return function(_0x2cb259){if(!_0x2cb259){_0x68e88a[_0x6c4c('0x15')](0x194);}return _0x2cb259;};}function handleError(_0x14294a,_0xc815bc){_0xc815bc=_0xc815bc||0x1f4;return function(_0x2794b7){logger['error'](_0x2794b7[_0x6c4c('0x25')]);if(_0x2794b7[_0x6c4c('0x26')]){delete _0x2794b7[_0x6c4c('0x26')];}_0x14294a['status'](_0xc815bc)[_0x6c4c('0x27')](_0x2794b7);};}exports[_0x6c4c('0x28')]=function(_0x904663,_0x1886d9){var _0x4743f9={},_0x1b36bf={},_0xc41203={'count':0x0,'rows':[]};var _0xb25257=_[_0x6c4c('0x29')](db[_0x6c4c('0x2a')][_0x6c4c('0x2b')],function(_0xb02a20){return{'name':_0xb02a20['fieldName'],'type':_0xb02a20[_0x6c4c('0x2c')][_0x6c4c('0x2d')]};});_0x1b36bf[_0x6c4c('0x2e')]=_[_0x6c4c('0x29')](_0xb25257,_0x6c4c('0x26'));_0x1b36bf['query']=_[_0x6c4c('0x2f')](_0x904663[_0x6c4c('0x30')]);_0x1b36bf['filters']=_[_0x6c4c('0x31')](_0x1b36bf['model'],_0x1b36bf[_0x6c4c('0x30')]);_0x4743f9[_0x6c4c('0x32')]=_[_0x6c4c('0x31')](_0x1b36bf['model'],qs[_0x6c4c('0x33')](_0x904663[_0x6c4c('0x30')]['fields']));_0x4743f9[_0x6c4c('0x32')]=_0x4743f9[_0x6c4c('0x32')][_0x6c4c('0x34')]?_0x4743f9[_0x6c4c('0x32')]:_0x1b36bf[_0x6c4c('0x2e')];if(!_0x904663['query'][_0x6c4c('0x35')]('nolimit')){_0x4743f9['limit']=qs['limit'](_0x904663[_0x6c4c('0x30')][_0x6c4c('0x1c')]);_0x4743f9[_0x6c4c('0x19')]=qs[_0x6c4c('0x19')](_0x904663[_0x6c4c('0x30')][_0x6c4c('0x19')]);}_0x4743f9[_0x6c4c('0x36')]=qs[_0x6c4c('0x37')](_0x904663[_0x6c4c('0x30')]['sort']);_0x4743f9[_0x6c4c('0x38')]=qs['filters'](_[_0x6c4c('0x39')](_0x904663[_0x6c4c('0x30')],_0x1b36bf[_0x6c4c('0x3a')]),_0xb25257);if(_0x904663[_0x6c4c('0x30')][_0x6c4c('0x3b')]){_0x4743f9[_0x6c4c('0x38')]=_[_0x6c4c('0x3c')](_0x4743f9['where'],{'$or':_['map'](_0xb25257,function(_0x5d2295){if(_0x5d2295['type']!==_0x6c4c('0x3d')){var _0x4dfeda={};_0x4dfeda[_0x5d2295['name']]={'$like':'%'+_0x904663[_0x6c4c('0x30')][_0x6c4c('0x3b')]+'%'};return _0x4dfeda;}})});}_0x4743f9=_[_0x6c4c('0x3c')]({},_0x4743f9,_0x904663[_0x6c4c('0x3e')]);var _0x28340a={'where':_0x4743f9['where']};return db[_0x6c4c('0x2a')][_0x6c4c('0x1b')](_0x28340a)[_0x6c4c('0x23')](function(_0x484048){_0xc41203[_0x6c4c('0x1b')]=_0x484048;if(_0x904663[_0x6c4c('0x30')]['includeAll']){_0x4743f9[_0x6c4c('0x3f')]=[{'all':!![]}];}return db[_0x6c4c('0x2a')]['findAll'](_0x4743f9);})[_0x6c4c('0x23')](function(_0x434223){_0xc41203[_0x6c4c('0x40')]=_0x434223;return _0xc41203;})[_0x6c4c('0x23')](respondWithFilteredResult(_0x1886d9,_0x4743f9))[_0x6c4c('0x41')](handleError(_0x1886d9,null));};exports[_0x6c4c('0x42')]=function(_0x55f3bb,_0xaf7a44){var _0x127274={'raw':![],'where':{'id':_0x55f3bb[_0x6c4c('0x43')]['id']}},_0x4420c0={};_0x4420c0[_0x6c4c('0x2e')]=_[_0x6c4c('0x2f')](db[_0x6c4c('0x2a')][_0x6c4c('0x2b')]);_0x4420c0[_0x6c4c('0x30')]=_[_0x6c4c('0x2f')](_0x55f3bb[_0x6c4c('0x30')]);_0x4420c0[_0x6c4c('0x3a')]=_[_0x6c4c('0x31')](_0x4420c0[_0x6c4c('0x2e')],_0x4420c0[_0x6c4c('0x30')]);_0x127274['attributes']=_['intersection'](_0x4420c0[_0x6c4c('0x2e')],qs[_0x6c4c('0x33')](_0x55f3bb[_0x6c4c('0x30')]['fields']));_0x127274['attributes']=_0x127274[_0x6c4c('0x32')]['length']?_0x127274[_0x6c4c('0x32')]:_0x4420c0['model'];if(_0x55f3bb[_0x6c4c('0x30')]['includeAll']){_0x127274[_0x6c4c('0x3f')]=[{'all':!![]}];}_0x127274=_[_0x6c4c('0x3c')]({},_0x127274,_0x55f3bb[_0x6c4c('0x3e')]);return db[_0x6c4c('0x2a')][_0x6c4c('0x44')](_0x127274)[_0x6c4c('0x23')](handleEntityNotFound(_0xaf7a44,null))[_0x6c4c('0x23')](respondWithResult(_0xaf7a44,null))[_0x6c4c('0x41')](handleError(_0xaf7a44,null));};exports[_0x6c4c('0x45')]=function(_0x1a7793,_0x1b69cf){return db[_0x6c4c('0x2a')]['create'](_0x1a7793['body'],{})[_0x6c4c('0x23')](respondWithResult(_0x1b69cf,0xc9))['catch'](handleError(_0x1b69cf,null));};exports[_0x6c4c('0x22')]=function(_0x55d6d2,_0x469b3a){if(_0x55d6d2[_0x6c4c('0x46')]['id']){delete _0x55d6d2[_0x6c4c('0x46')]['id'];}return db[_0x6c4c('0x2a')][_0x6c4c('0x44')]({'where':{'id':_0x55d6d2['params']['id']}})[_0x6c4c('0x23')](handleEntityNotFound(_0x469b3a,null))[_0x6c4c('0x23')](saveUpdates(_0x55d6d2[_0x6c4c('0x46')],null))['then'](respondWithResult(_0x469b3a,null))['catch'](handleError(_0x469b3a,null));};exports[_0x6c4c('0x24')]=function(_0x3e01ab,_0x1d5fdc){return db[_0x6c4c('0x2a')][_0x6c4c('0x44')]({'where':{'id':_0x3e01ab['params']['id']}})[_0x6c4c('0x23')](handleEntityNotFound(_0x1d5fdc,null))[_0x6c4c('0x23')](removeEntity(_0x1d5fdc,null))[_0x6c4c('0x41')](handleError(_0x1d5fdc,null));};exports['addConditions']=function(_0x2efd2a,_0x4a15b0,_0x227117){return db[_0x6c4c('0x47')][_0x6c4c('0x44')]({'where':{'id':_0x2efd2a[_0x6c4c('0x43')]['id']}})[_0x6c4c('0x23')](handleEntityNotFound(_0x4a15b0,null))['then'](function(_0x49e7f2){if(_0x49e7f2){return _0x49e7f2[_0x6c4c('0x48')](_0x2efd2a[_0x6c4c('0x46')]['ids'],_[_0x6c4c('0x49')](_0x2efd2a[_0x6c4c('0x46')],[_0x6c4c('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x4a15b0,null))[_0x6c4c('0x41')](handleError(_0x4a15b0,null));};exports[_0x6c4c('0x4b')]=function(_0x58fe91,_0x43465b,_0x2515b6){var _0x4cb294={};var _0x32ac08={};var _0xc88255;var _0x3534c7;return db[_0x6c4c('0x2a')][_0x6c4c('0x4c')]({'where':{'id':_0x58fe91[_0x6c4c('0x43')]['id']}})[_0x6c4c('0x23')](handleEntityNotFound(_0x43465b,null))['then'](function(_0x9d1cdd){if(_0x9d1cdd){_0xc88255=_0x9d1cdd;_0x32ac08['model']=_[_0x6c4c('0x2f')](db[_0x6c4c('0x47')][_0x6c4c('0x2b')]);_0x32ac08[_0x6c4c('0x30')]=_[_0x6c4c('0x2f')](_0x58fe91[_0x6c4c('0x30')]);_0x32ac08[_0x6c4c('0x3a')]=_[_0x6c4c('0x31')](_0x32ac08['model'],_0x32ac08[_0x6c4c('0x30')]);_0x4cb294[_0x6c4c('0x32')]=_[_0x6c4c('0x31')](_0x32ac08[_0x6c4c('0x2e')],qs['fields'](_0x58fe91[_0x6c4c('0x30')]['fields']));_0x4cb294[_0x6c4c('0x32')]=_0x4cb294[_0x6c4c('0x32')]['length']?_0x4cb294[_0x6c4c('0x32')]:_0x32ac08['model'];_0x4cb294['order']=qs[_0x6c4c('0x37')](_0x58fe91[_0x6c4c('0x30')][_0x6c4c('0x37')]);_0x4cb294[_0x6c4c('0x38')]=qs[_0x6c4c('0x3a')](_[_0x6c4c('0x39')](_0x58fe91[_0x6c4c('0x30')],_0x32ac08['filters']));if(_0x58fe91[_0x6c4c('0x30')][_0x6c4c('0x3b')]){_0x4cb294['where']=_[_0x6c4c('0x3c')](_0x4cb294['where'],{'$or':_[_0x6c4c('0x29')](_0x4cb294[_0x6c4c('0x32')],function(_0x403825){var _0x5c63b6={};_0x5c63b6[_0x403825]={'$like':'%'+_0x58fe91['query'][_0x6c4c('0x3b')]+'%'};return _0x5c63b6;})});}_0x4cb294=_['merge']({},_0x4cb294,_0x58fe91['options']);return _0xc88255[_0x6c4c('0x4b')](_0x4cb294);}})['then'](function(_0x465b41){if(_0x465b41){_0x3534c7=_0x465b41[_0x6c4c('0x34')];if(!_0x58fe91[_0x6c4c('0x30')]['hasOwnProperty'](_0x6c4c('0x4d'))){_0x4cb294[_0x6c4c('0x1c')]=qs[_0x6c4c('0x1c')](_0x58fe91[_0x6c4c('0x30')][_0x6c4c('0x1c')]);_0x4cb294['offset']=qs[_0x6c4c('0x19')](_0x58fe91['query'][_0x6c4c('0x19')]);}return _0xc88255[_0x6c4c('0x4b')](_0x4cb294);}})[_0x6c4c('0x23')](function(_0x5e75f2){if(_0x5e75f2){return _0x5e75f2?{'count':_0x3534c7,'rows':_0x5e75f2}:null;}})['then'](respondWithResult(_0x43465b,null))[_0x6c4c('0x41')](handleError(_0x43465b,null));};exports[_0x6c4c('0x4e')]=function(_0x20f537,_0x58abd0,_0x480d79){return db['Action'][_0x6c4c('0x44')]({'where':{'id':_0x20f537['params']['id']}})[_0x6c4c('0x23')](handleEntityNotFound(_0x58abd0,null))[_0x6c4c('0x23')](function(_0x3b21ed){if(_0x3b21ed){return _0x3b21ed[_0x6c4c('0x4e')](_0x20f537['body']['ids'],_['omit'](_0x20f537['body'],[_0x6c4c('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x58abd0,null))['catch'](handleError(_0x58abd0,null));};exports['getActions']=function(_0x1a8226,_0x40d091,_0x49f85a){var _0x52327a={};var _0x1cc734={};var _0xe1a49c;var _0x10cda0;return db[_0x6c4c('0x2a')][_0x6c4c('0x4c')]({'where':{'id':_0x1a8226[_0x6c4c('0x43')]['id']}})['then'](handleEntityNotFound(_0x40d091,null))['then'](function(_0x344ee2){if(_0x344ee2){_0xe1a49c=_0x344ee2;_0x1cc734['model']=_[_0x6c4c('0x2f')](db[_0x6c4c('0x4f')][_0x6c4c('0x2b')]);_0x1cc734['query']=_[_0x6c4c('0x2f')](_0x1a8226[_0x6c4c('0x30')]);_0x1cc734[_0x6c4c('0x3a')]=_[_0x6c4c('0x31')](_0x1cc734[_0x6c4c('0x2e')],_0x1cc734[_0x6c4c('0x30')]);_0x52327a[_0x6c4c('0x32')]=_[_0x6c4c('0x31')](_0x1cc734['model'],qs[_0x6c4c('0x33')](_0x1a8226[_0x6c4c('0x30')]['fields']));_0x52327a[_0x6c4c('0x32')]=_0x52327a['attributes'][_0x6c4c('0x34')]?_0x52327a['attributes']:_0x1cc734['model'];_0x52327a['order']=qs[_0x6c4c('0x37')](_0x1a8226['query']['sort']);_0x52327a[_0x6c4c('0x38')]=qs[_0x6c4c('0x3a')](_[_0x6c4c('0x39')](_0x1a8226[_0x6c4c('0x30')],_0x1cc734[_0x6c4c('0x3a')]));if(_0x1a8226[_0x6c4c('0x30')][_0x6c4c('0x3b')]){_0x52327a['where']=_[_0x6c4c('0x3c')](_0x52327a[_0x6c4c('0x38')],{'$or':_['map'](_0x52327a['attributes'],function(_0x1ee907){var _0x4573e2={};_0x4573e2[_0x1ee907]={'$like':'%'+_0x1a8226[_0x6c4c('0x30')][_0x6c4c('0x3b')]+'%'};return _0x4573e2;})});}_0x52327a=_[_0x6c4c('0x3c')]({},_0x52327a,_0x1a8226['options']);return _0xe1a49c[_0x6c4c('0x50')](_0x52327a);}})[_0x6c4c('0x23')](function(_0x3b8a2a){if(_0x3b8a2a){_0x10cda0=_0x3b8a2a[_0x6c4c('0x34')];if(!_0x1a8226[_0x6c4c('0x30')][_0x6c4c('0x35')](_0x6c4c('0x4d'))){_0x52327a[_0x6c4c('0x1c')]=qs[_0x6c4c('0x1c')](_0x1a8226[_0x6c4c('0x30')][_0x6c4c('0x1c')]);_0x52327a[_0x6c4c('0x19')]=qs[_0x6c4c('0x19')](_0x1a8226[_0x6c4c('0x30')][_0x6c4c('0x19')]);}return _0xe1a49c['getActions'](_0x52327a);}})[_0x6c4c('0x23')](function(_0x1b936c){if(_0x1b936c){return _0x1b936c?{'count':_0x10cda0,'rows':_0x1b936c}:null;}})['then'](respondWithResult(_0x40d091,null))[_0x6c4c('0x41')](handleError(_0x40d091,null));}; \ No newline at end of file +var _0x9b92=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','Automation','addConditions','Condition','ids','omit','getConditions','findOne','order','Action','addActions','getActions'];(function(_0x4e38fb,_0x414e16){var _0x2b864d=function(_0x33de45){while(--_0x33de45){_0x4e38fb['push'](_0x4e38fb['shift']());}};_0x2b864d(++_0x414e16);}(_0x9b92,0x1ae));var _0x29b9=function(_0x16b53b,_0x245533){_0x16b53b=_0x16b53b-0x0;var _0x25c355=_0x9b92[_0x16b53b];return _0x25c355;};'use strict';var emlformat=require(_0x29b9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x29b9('0x1'));var jsonpatch=require(_0x29b9('0x2'));var rp=require(_0x29b9('0x3'));var moment=require(_0x29b9('0x4'));var BPromise=require(_0x29b9('0x5'));var Mustache=require(_0x29b9('0x6'));var util=require(_0x29b9('0x7'));var path=require('path');var sox=require(_0x29b9('0x8'));var csv=require(_0x29b9('0x9'));var ejs=require(_0x29b9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x29b9('0xb'));var squel=require('squel');var crypto=require(_0x29b9('0xc'));var jsforce=require(_0x29b9('0xd'));var deskjs=require(_0x29b9('0xe'));var toCsv=require(_0x29b9('0x9'));var querystring=require(_0x29b9('0xf'));var Papa=require(_0x29b9('0x10'));var Redis=require(_0x29b9('0x11'));var authService=require(_0x29b9('0x12'));var qs=require(_0x29b9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29b9('0x14'));var logger=require(_0x29b9('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x29b9('0x16'));var licenseUtil=require(_0x29b9('0x17'));var db=require(_0x29b9('0x18'))['db'];function respondWithStatusCode(_0x4b12ba,_0x5a3224){_0x5a3224=_0x5a3224||0xcc;return function(_0x426878){if(_0x426878){return _0x4b12ba['sendStatus'](_0x5a3224);}return _0x4b12ba['status'](_0x5a3224)[_0x29b9('0x19')]();};}function respondWithResult(_0x9287b0,_0x48bd7f){_0x48bd7f=_0x48bd7f||0xc8;return function(_0x58e1e4){if(_0x58e1e4){return _0x9287b0[_0x29b9('0x1a')](_0x48bd7f)['json'](_0x58e1e4);}};}function respondWithFilteredResult(_0x34360b,_0x327a7f){return function(_0x52784d){if(_0x52784d){var _0x11316a=typeof _0x327a7f['offset']===_0x29b9('0x1b')&&typeof _0x327a7f[_0x29b9('0x1c')]===_0x29b9('0x1b');var _0x20041c=_0x52784d[_0x29b9('0x1d')];var _0x341cb9=_0x11316a?0x0:_0x327a7f[_0x29b9('0x1e')];var _0x3711a0=_0x11316a?_0x52784d[_0x29b9('0x1d')]:_0x327a7f[_0x29b9('0x1e')]+_0x327a7f['limit'];var _0x4bd2d8;if(_0x3711a0>=_0x20041c){_0x3711a0=_0x20041c;_0x4bd2d8=0xc8;}else{_0x4bd2d8=0xce;}_0x34360b[_0x29b9('0x1a')](_0x4bd2d8);return _0x34360b[_0x29b9('0x1f')](_0x29b9('0x20'),_0x341cb9+'-'+_0x3711a0+'/'+_0x20041c)[_0x29b9('0x21')](_0x52784d);}return null;};}function patchUpdates(_0x1a6938){return function(_0x26533a){try{jsonpatch[_0x29b9('0x22')](_0x26533a,_0x1a6938,!![]);}catch(_0x192a37){return BPromise[_0x29b9('0x23')](_0x192a37);}return _0x26533a[_0x29b9('0x24')]();};}function saveUpdates(_0x174e5c,_0x11bd76){return function(_0x22994d){if(_0x22994d){return _0x22994d[_0x29b9('0x25')](_0x174e5c)[_0x29b9('0x26')](function(_0x183b30){return _0x183b30;});}return null;};}function removeEntity(_0x1fab48,_0x503396){return function(_0x22b1b6){if(_0x22b1b6){return _0x22b1b6[_0x29b9('0x27')]()[_0x29b9('0x26')](function(){_0x1fab48[_0x29b9('0x1a')](0xcc)[_0x29b9('0x19')]();});}};}function handleEntityNotFound(_0x1919dc,_0x172ad4){return function(_0x1d7b09){if(!_0x1d7b09){_0x1919dc[_0x29b9('0x28')](0x194);}return _0x1d7b09;};}function handleError(_0x2fea69,_0x36762d){_0x36762d=_0x36762d||0x1f4;return function(_0x5cc163){logger[_0x29b9('0x29')](_0x5cc163[_0x29b9('0x2a')]);if(_0x5cc163['name']){delete _0x5cc163[_0x29b9('0x2b')];}_0x2fea69[_0x29b9('0x1a')](_0x36762d)['send'](_0x5cc163);};}exports[_0x29b9('0x2c')]=function(_0x2a1616,_0x56db4e){var _0x571195={},_0x43e83c={},_0x5258a9={'count':0x0,'rows':[]};var _0xb7c3bf=_[_0x29b9('0x2d')](db['Automation'][_0x29b9('0x2e')],function(_0x35b482){return{'name':_0x35b482[_0x29b9('0x2f')],'type':_0x35b482[_0x29b9('0x30')]['key']};});_0x43e83c[_0x29b9('0x31')]=_[_0x29b9('0x2d')](_0xb7c3bf,_0x29b9('0x2b'));_0x43e83c[_0x29b9('0x32')]=_[_0x29b9('0x33')](_0x2a1616[_0x29b9('0x32')]);_0x43e83c['filters']=_[_0x29b9('0x34')](_0x43e83c[_0x29b9('0x31')],_0x43e83c[_0x29b9('0x32')]);_0x571195['attributes']=_['intersection'](_0x43e83c[_0x29b9('0x31')],qs[_0x29b9('0x35')](_0x2a1616['query'][_0x29b9('0x35')]));_0x571195[_0x29b9('0x36')]=_0x571195[_0x29b9('0x36')][_0x29b9('0x37')]?_0x571195[_0x29b9('0x36')]:_0x43e83c[_0x29b9('0x31')];if(!_0x2a1616[_0x29b9('0x32')][_0x29b9('0x38')](_0x29b9('0x39'))){_0x571195['limit']=qs[_0x29b9('0x1c')](_0x2a1616[_0x29b9('0x32')][_0x29b9('0x1c')]);_0x571195[_0x29b9('0x1e')]=qs[_0x29b9('0x1e')](_0x2a1616[_0x29b9('0x32')][_0x29b9('0x1e')]);}_0x571195['order']=qs[_0x29b9('0x3a')](_0x2a1616['query'][_0x29b9('0x3a')]);_0x571195[_0x29b9('0x3b')]=qs['filters'](_[_0x29b9('0x3c')](_0x2a1616['query'],_0x43e83c[_0x29b9('0x3d')]),_0xb7c3bf);if(_0x2a1616['query'][_0x29b9('0x3e')]){_0x571195[_0x29b9('0x3b')]=_['merge'](_0x571195[_0x29b9('0x3b')],{'$or':_[_0x29b9('0x2d')](_0xb7c3bf,function(_0x521376){if(_0x521376['type']!==_0x29b9('0x3f')){var _0x147eca={};_0x147eca[_0x521376[_0x29b9('0x2b')]]={'$like':'%'+_0x2a1616['query'][_0x29b9('0x3e')]+'%'};return _0x147eca;}})});}_0x571195=_[_0x29b9('0x40')]({},_0x571195,_0x2a1616[_0x29b9('0x41')]);var _0x50ab24={'where':_0x571195[_0x29b9('0x3b')]};return db['Automation'][_0x29b9('0x1d')](_0x50ab24)[_0x29b9('0x26')](function(_0x377a4a){_0x5258a9[_0x29b9('0x1d')]=_0x377a4a;if(_0x2a1616[_0x29b9('0x32')][_0x29b9('0x42')]){_0x571195[_0x29b9('0x43')]=[{'all':!![]}];}return db['Automation'][_0x29b9('0x44')](_0x571195);})[_0x29b9('0x26')](function(_0x3d9d06){_0x5258a9['rows']=_0x3d9d06;return _0x5258a9;})[_0x29b9('0x26')](respondWithFilteredResult(_0x56db4e,_0x571195))[_0x29b9('0x45')](handleError(_0x56db4e,null));};exports[_0x29b9('0x46')]=function(_0x46046a,_0x542fce){var _0x49ad49={'raw':![],'where':{'id':_0x46046a[_0x29b9('0x47')]['id']}},_0x2696e9={};_0x2696e9[_0x29b9('0x31')]=_[_0x29b9('0x33')](db['Automation'][_0x29b9('0x2e')]);_0x2696e9['query']=_[_0x29b9('0x33')](_0x46046a[_0x29b9('0x32')]);_0x2696e9[_0x29b9('0x3d')]=_[_0x29b9('0x34')](_0x2696e9[_0x29b9('0x31')],_0x2696e9[_0x29b9('0x32')]);_0x49ad49[_0x29b9('0x36')]=_['intersection'](_0x2696e9[_0x29b9('0x31')],qs['fields'](_0x46046a[_0x29b9('0x32')]['fields']));_0x49ad49[_0x29b9('0x36')]=_0x49ad49[_0x29b9('0x36')]['length']?_0x49ad49[_0x29b9('0x36')]:_0x2696e9[_0x29b9('0x31')];if(_0x46046a['query'][_0x29b9('0x42')]){_0x49ad49[_0x29b9('0x43')]=[{'all':!![]}];}_0x49ad49=_[_0x29b9('0x40')]({},_0x49ad49,_0x46046a[_0x29b9('0x41')]);return db['Automation'][_0x29b9('0x48')](_0x49ad49)[_0x29b9('0x26')](handleEntityNotFound(_0x542fce,null))[_0x29b9('0x26')](respondWithResult(_0x542fce,null))['catch'](handleError(_0x542fce,null));};exports[_0x29b9('0x49')]=function(_0x130cf4,_0x3cfcd1){return db['Automation']['create'](_0x130cf4[_0x29b9('0x4a')],{})[_0x29b9('0x26')](respondWithResult(_0x3cfcd1,0xc9))[_0x29b9('0x45')](handleError(_0x3cfcd1,null));};exports['update']=function(_0x208878,_0x1ce056){if(_0x208878['body']['id']){delete _0x208878[_0x29b9('0x4a')]['id'];}return db[_0x29b9('0x4b')]['find']({'where':{'id':_0x208878[_0x29b9('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ce056,null))[_0x29b9('0x26')](saveUpdates(_0x208878[_0x29b9('0x4a')],null))[_0x29b9('0x26')](respondWithResult(_0x1ce056,null))[_0x29b9('0x45')](handleError(_0x1ce056,null));};exports['destroy']=function(_0x2c35f2,_0x2afff1){return db[_0x29b9('0x4b')][_0x29b9('0x48')]({'where':{'id':_0x2c35f2[_0x29b9('0x47')]['id']}})[_0x29b9('0x26')](handleEntityNotFound(_0x2afff1,null))['then'](removeEntity(_0x2afff1,null))[_0x29b9('0x45')](handleError(_0x2afff1,null));};exports[_0x29b9('0x4c')]=function(_0x176996,_0x568c82,_0x4f87d6){return db[_0x29b9('0x4d')]['find']({'where':{'id':_0x176996[_0x29b9('0x47')]['id']}})[_0x29b9('0x26')](handleEntityNotFound(_0x568c82,null))[_0x29b9('0x26')](function(_0x17ed40){if(_0x17ed40){return _0x17ed40['addConditions'](_0x176996[_0x29b9('0x4a')][_0x29b9('0x4e')],_[_0x29b9('0x4f')](_0x176996['body'],[_0x29b9('0x4e'),'id'])||{});}})[_0x29b9('0x26')](respondWithResult(_0x568c82,null))[_0x29b9('0x45')](handleError(_0x568c82,null));};exports[_0x29b9('0x50')]=function(_0xd4b3ac,_0x39873e,_0x56fdf9){var _0x56e3ec={};var _0x5e9583={};var _0x4d3d93;var _0x38f6e3;return db[_0x29b9('0x4b')][_0x29b9('0x51')]({'where':{'id':_0xd4b3ac[_0x29b9('0x47')]['id']}})['then'](handleEntityNotFound(_0x39873e,null))['then'](function(_0x100953){if(_0x100953){_0x4d3d93=_0x100953;_0x5e9583[_0x29b9('0x31')]=_['keys'](db['Condition'][_0x29b9('0x2e')]);_0x5e9583[_0x29b9('0x32')]=_[_0x29b9('0x33')](_0xd4b3ac['query']);_0x5e9583[_0x29b9('0x3d')]=_['intersection'](_0x5e9583[_0x29b9('0x31')],_0x5e9583[_0x29b9('0x32')]);_0x56e3ec[_0x29b9('0x36')]=_[_0x29b9('0x34')](_0x5e9583['model'],qs[_0x29b9('0x35')](_0xd4b3ac[_0x29b9('0x32')]['fields']));_0x56e3ec[_0x29b9('0x36')]=_0x56e3ec[_0x29b9('0x36')]['length']?_0x56e3ec[_0x29b9('0x36')]:_0x5e9583[_0x29b9('0x31')];_0x56e3ec[_0x29b9('0x52')]=qs['sort'](_0xd4b3ac[_0x29b9('0x32')]['sort']);_0x56e3ec[_0x29b9('0x3b')]=qs[_0x29b9('0x3d')](_[_0x29b9('0x3c')](_0xd4b3ac[_0x29b9('0x32')],_0x5e9583['filters']));if(_0xd4b3ac[_0x29b9('0x32')][_0x29b9('0x3e')]){_0x56e3ec[_0x29b9('0x3b')]=_[_0x29b9('0x40')](_0x56e3ec[_0x29b9('0x3b')],{'$or':_[_0x29b9('0x2d')](_0x56e3ec[_0x29b9('0x36')],function(_0x159ccd){var _0x3d8709={};_0x3d8709[_0x159ccd]={'$like':'%'+_0xd4b3ac[_0x29b9('0x32')]['filter']+'%'};return _0x3d8709;})});}_0x56e3ec=_[_0x29b9('0x40')]({},_0x56e3ec,_0xd4b3ac[_0x29b9('0x41')]);return _0x4d3d93[_0x29b9('0x50')](_0x56e3ec);}})['then'](function(_0x2113a3){if(_0x2113a3){_0x38f6e3=_0x2113a3['length'];if(!_0xd4b3ac[_0x29b9('0x32')][_0x29b9('0x38')]('nolimit')){_0x56e3ec[_0x29b9('0x1c')]=qs['limit'](_0xd4b3ac[_0x29b9('0x32')]['limit']);_0x56e3ec[_0x29b9('0x1e')]=qs[_0x29b9('0x1e')](_0xd4b3ac[_0x29b9('0x32')]['offset']);}return _0x4d3d93['getConditions'](_0x56e3ec);}})[_0x29b9('0x26')](function(_0x410620){if(_0x410620){return _0x410620?{'count':_0x38f6e3,'rows':_0x410620}:null;}})[_0x29b9('0x26')](respondWithResult(_0x39873e,null))[_0x29b9('0x45')](handleError(_0x39873e,null));};exports['addActions']=function(_0x517b6d,_0x142318,_0x517cb0){return db[_0x29b9('0x53')][_0x29b9('0x48')]({'where':{'id':_0x517b6d[_0x29b9('0x47')]['id']}})[_0x29b9('0x26')](handleEntityNotFound(_0x142318,null))[_0x29b9('0x26')](function(_0x7220b8){if(_0x7220b8){return _0x7220b8[_0x29b9('0x54')](_0x517b6d[_0x29b9('0x4a')][_0x29b9('0x4e')],_[_0x29b9('0x4f')](_0x517b6d[_0x29b9('0x4a')],[_0x29b9('0x4e'),'id'])||{});}})[_0x29b9('0x26')](respondWithResult(_0x142318,null))['catch'](handleError(_0x142318,null));};exports[_0x29b9('0x55')]=function(_0x3b31ba,_0x784976,_0x56fe3a){var _0x34292e={};var _0x266824={};var _0x24cad8;var _0x26eac6;return db['Automation']['findOne']({'where':{'id':_0x3b31ba[_0x29b9('0x47')]['id']}})[_0x29b9('0x26')](handleEntityNotFound(_0x784976,null))[_0x29b9('0x26')](function(_0x1ab7e6){if(_0x1ab7e6){_0x24cad8=_0x1ab7e6;_0x266824[_0x29b9('0x31')]=_[_0x29b9('0x33')](db['Action'][_0x29b9('0x2e')]);_0x266824[_0x29b9('0x32')]=_[_0x29b9('0x33')](_0x3b31ba[_0x29b9('0x32')]);_0x266824[_0x29b9('0x3d')]=_[_0x29b9('0x34')](_0x266824[_0x29b9('0x31')],_0x266824[_0x29b9('0x32')]);_0x34292e['attributes']=_[_0x29b9('0x34')](_0x266824[_0x29b9('0x31')],qs[_0x29b9('0x35')](_0x3b31ba[_0x29b9('0x32')][_0x29b9('0x35')]));_0x34292e['attributes']=_0x34292e[_0x29b9('0x36')][_0x29b9('0x37')]?_0x34292e[_0x29b9('0x36')]:_0x266824[_0x29b9('0x31')];_0x34292e[_0x29b9('0x52')]=qs['sort'](_0x3b31ba[_0x29b9('0x32')][_0x29b9('0x3a')]);_0x34292e[_0x29b9('0x3b')]=qs[_0x29b9('0x3d')](_[_0x29b9('0x3c')](_0x3b31ba[_0x29b9('0x32')],_0x266824[_0x29b9('0x3d')]));if(_0x3b31ba['query']['filter']){_0x34292e[_0x29b9('0x3b')]=_[_0x29b9('0x40')](_0x34292e['where'],{'$or':_[_0x29b9('0x2d')](_0x34292e[_0x29b9('0x36')],function(_0x31ed61){var _0x4f0a6a={};_0x4f0a6a[_0x31ed61]={'$like':'%'+_0x3b31ba['query']['filter']+'%'};return _0x4f0a6a;})});}_0x34292e=_['merge']({},_0x34292e,_0x3b31ba[_0x29b9('0x41')]);return _0x24cad8['getActions'](_0x34292e);}})[_0x29b9('0x26')](function(_0x596ec6){if(_0x596ec6){_0x26eac6=_0x596ec6['length'];if(!_0x3b31ba[_0x29b9('0x32')][_0x29b9('0x38')]('nolimit')){_0x34292e[_0x29b9('0x1c')]=qs[_0x29b9('0x1c')](_0x3b31ba[_0x29b9('0x32')][_0x29b9('0x1c')]);_0x34292e[_0x29b9('0x1e')]=qs['offset'](_0x3b31ba[_0x29b9('0x32')]['offset']);}return _0x24cad8[_0x29b9('0x55')](_0x34292e);}})[_0x29b9('0x26')](function(_0x5f07bd){if(_0x5f07bd){return _0x5f07bd?{'count':_0x26eac6,'rows':_0x5f07bd}:null;}})['then'](respondWithResult(_0x784976,null))[_0x29b9('0x45')](handleError(_0x784976,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index e297af0..04463df 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 _0x0c36=['./automation.attributes','exports','define','Automation','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3968e2,_0x384b4f){var _0x14a327=function(_0x1956d6){while(--_0x1956d6){_0x3968e2['push'](_0x3968e2['shift']());}};_0x14a327(++_0x384b4f);}(_0x0c36,0x1f3));var _0x60c3=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0x0c36[_0x2984d0];return _0x2885f2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x60c3('0x0'))(_0x60c3('0x1'));var moment=require(_0x60c3('0x2'));var BPromise=require(_0x60c3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x60c3('0x4'));var rimraf=require(_0x60c3('0x5'));var config=require(_0x60c3('0x6'));var attributes=require(_0x60c3('0x7'));module[_0x60c3('0x8')]=function(_0x1d1a03,_0x28b8ba){return _0x1d1a03[_0x60c3('0x9')](_0x60c3('0xa'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66dc=['request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util','../../config/logger','api','moment','bluebird'];(function(_0x5f2717,_0x4e6e4d){var _0x59abf3=function(_0x4ca208){while(--_0x4ca208){_0x5f2717['push'](_0x5f2717['shift']());}};_0x59abf3(++_0x4e6e4d);}(_0x66dc,0xe9));var _0xc66d=function(_0x5a6eeb,_0x2cff2c){_0x5a6eeb=_0x5a6eeb-0x0;var _0x324916=_0x66dc[_0x5a6eeb];return _0x324916;};'use strict';var _=require('lodash');var util=require(_0xc66d('0x0'));var logger=require(_0xc66d('0x1'))(_0xc66d('0x2'));var moment=require(_0xc66d('0x3'));var BPromise=require(_0xc66d('0x4'));var rp=require(_0xc66d('0x5'));var fs=require('fs');var path=require(_0xc66d('0x6'));var rimraf=require(_0xc66d('0x7'));var config=require(_0xc66d('0x8'));var attributes=require(_0xc66d('0x9'));module[_0xc66d('0xa')]=function(_0x5d83f1,_0x40393e){return _0x5d83f1[_0xc66d('0xb')](_0xc66d('0xc'),attributes,{'tableName':_0xc66d('0xd'),'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 2237a14..77f6a0e 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 _0x5c3c=['Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Automation,\x20%s,\x20%s','request\x20sent'];(function(_0x20f7f3,_0x3237dc){var _0x4e14bf=function(_0x1d661f){while(--_0x1d661f){_0x20f7f3['push'](_0x20f7f3['shift']());}};_0x4e14bf(++_0x3237dc);}(_0x5c3c,0x132));var _0xc5c3=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x5c3c[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});} \ No newline at end of file +var _0xa5d7=['info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','then'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x439a7e,_0x301aa4){_0x439a7e=_0x439a7e-0x0;var _0x369a5f=_0xa5d7[_0x439a7e];return _0x369a5f;};'use strict';var _=require(_0x7a5d('0x0'));var util=require(_0x7a5d('0x1'));var moment=require(_0x7a5d('0x2'));var BPromise=require(_0x7a5d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a5d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a5d('0x5'));var logger=require('../../config/logger')(_0x7a5d('0x6'));var config=require('../../config/environment');var jayson=require(_0x7a5d('0x7'));var client=jayson[_0x7a5d('0x8')][_0x7a5d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cb015,_0x2092de,_0xc34a6a){return new BPromise(function(_0x5e6442,_0x33aeaa){return client['request'](_0x4cb015,_0xc34a6a)[_0x7a5d('0xa')](function(_0x1057e5){logger[_0x7a5d('0xb')]('Automation,\x20%s,\x20%s',_0x2092de,_0x7a5d('0xc'));logger[_0x7a5d('0xd')](_0x7a5d('0xe'),_0x2092de,_0x7a5d('0xc'),JSON[_0x7a5d('0xf')](_0x1057e5));if(_0x1057e5[_0x7a5d('0x10')]){if(_0x1057e5[_0x7a5d('0x10')][_0x7a5d('0x11')]===0x1f4){logger[_0x7a5d('0x10')](_0x7a5d('0x12'),_0x2092de,_0x1057e5[_0x7a5d('0x10')][_0x7a5d('0x13')]);return _0x33aeaa(_0x1057e5['error']['message']);}logger[_0x7a5d('0x10')]('Automation,\x20%s,\x20%s',_0x2092de,_0x1057e5[_0x7a5d('0x10')][_0x7a5d('0x13')]);return _0x5e6442(_0x1057e5[_0x7a5d('0x10')][_0x7a5d('0x13')]);}else{logger[_0x7a5d('0xb')](_0x7a5d('0x12'),_0x2092de,'request\x20sent');_0x5e6442(_0x1057e5[_0x7a5d('0x14')][_0x7a5d('0x13')]);}})[_0x7a5d('0x15')](function(_0xc57403){logger[_0x7a5d('0x10')]('Automation,\x20%s,\x20%s',_0x2092de,_0xc57403);_0x33aeaa(_0xc57403);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index f5a0c74..2ffb104 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 _0xe4ec=['../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','/:id/conditions','getConditions','getActions','post','create','addConditions','/:id/actions','addActions','put','update','delete','exports','util','connect-timeout','express','Router'];(function(_0x2042a4,_0x16f91e){var _0x233995=function(_0x3a864f){while(--_0x3a864f){_0x2042a4['push'](_0x2042a4['shift']());}};_0x233995(++_0x16f91e);}(_0xe4ec,0x11c));var _0xce4e=function(_0x465695,_0x21e3d7){_0x465695=_0x465695-0x0;var _0x201c91=_0xe4ec[_0x465695];return _0x201c91;};'use strict';var multer=require('multer');var util=require(_0xce4e('0x0'));var path=require('path');var timeout=require(_0xce4e('0x1'));var express=require(_0xce4e('0x2'));var router=express[_0xce4e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xce4e('0x4'));var interaction=require(_0xce4e('0x5'));var config=require(_0xce4e('0x6'));var controller=require(_0xce4e('0x7'));router[_0xce4e('0x8')]('/',auth[_0xce4e('0x9')](),controller[_0xce4e('0xa')]);router['get'](_0xce4e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xce4e('0x8')](_0xce4e('0xc'),auth[_0xce4e('0x9')](),controller[_0xce4e('0xd')]);router['get']('/:id/actions',auth['isAuthenticated'](),controller[_0xce4e('0xe')]);router[_0xce4e('0xf')]('/',auth[_0xce4e('0x9')](),controller[_0xce4e('0x10')]);router[_0xce4e('0xf')](_0xce4e('0xc'),auth[_0xce4e('0x9')](),controller[_0xce4e('0x11')]);router['post'](_0xce4e('0x12'),auth[_0xce4e('0x9')](),controller[_0xce4e('0x13')]);router[_0xce4e('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xce4e('0x15')]);router[_0xce4e('0x16')](_0xce4e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xce4e('0x17')]=router; \ No newline at end of file +var _0x7118=['../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','addActions','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7118,0x159));var _0x8711=function(_0x5427ae,_0x2420d5){_0x5427ae=_0x5427ae-0x0;var _0x3daa28=_0x7118[_0x5427ae];return _0x3daa28;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8711('0x0'));var timeout=require(_0x8711('0x1'));var express=require('express');var router=express[_0x8711('0x2')]();var fs_extra=require(_0x8711('0x3'));var auth=require(_0x8711('0x4'));var interaction=require(_0x8711('0x5'));var config=require(_0x8711('0x6'));var controller=require(_0x8711('0x7'));router[_0x8711('0x8')]('/',auth['isAuthenticated'](),controller[_0x8711('0x9')]);router[_0x8711('0x8')](_0x8711('0xa'),auth[_0x8711('0xb')](),controller[_0x8711('0xc')]);router[_0x8711('0x8')](_0x8711('0xd'),auth[_0x8711('0xb')](),controller[_0x8711('0xe')]);router[_0x8711('0x8')](_0x8711('0xf'),auth['isAuthenticated'](),controller['getActions']);router[_0x8711('0x10')]('/',auth[_0x8711('0xb')](),controller[_0x8711('0x11')]);router['post']('/:id/conditions',auth[_0x8711('0xb')](),controller[_0x8711('0x12')]);router['post']('/:id/actions',auth[_0x8711('0xb')](),controller[_0x8711('0x13')]);router[_0x8711('0x14')](_0x8711('0xa'),auth[_0x8711('0xb')](),controller[_0x8711('0x15')]);router[_0x8711('0x16')]('/:id',auth[_0x8711('0xb')](),controller[_0x8711('0x17')]);module[_0x8711('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index c93e00a..a5e9bd9 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 _0x06ef=['#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','STRING','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x162782,_0x24184c){var _0x211ca0=function(_0x44d6ae){while(--_0x44d6ae){_0x162782['push'](_0x162782['shift']());}};_0x211ca0(++_0x24184c);}(_0x06ef,0x185));var _0xf06e=function(_0x5b3dfb,_0x1b629c){_0x5b3dfb=_0x5b3dfb-0x0;var _0x503711=_0x06ef[_0x5b3dfb];return _0x503711;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf06e('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xf06e('0x0')]},'active':{'type':Sequelize[_0xf06e('0x1')],'defaultValue':0x0,'comment':_0xf06e('0x2')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xf06e('0x3')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xf06e('0x4')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xf06e('0x5')](0x3)[_0xf06e('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf06e('0x6')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf06e('0x5')](0x5)[_0xf06e('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xf06e('0x5')](0x3)[_0xf06e('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xf06e('0x5')](0x5)[_0xf06e('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf06e('0x7')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf06e('0x5')](0x3)[_0xf06e('0x3')],'defaultValue':0x3,'comment':_0xf06e('0x8')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf06e('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf06e('0x9')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf06e('0x3')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf06e('0xa')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xf06e('0xb')](_0xf06e('0xc'),_0xf06e('0xd'),'onlyIfOpen'),'defaultValue':_0xf06e('0xc')},'dialAMDActive':{'type':Sequelize[_0xf06e('0x1')],'defaultValue':0x0,'comment':_0xf06e('0xe')},'dialAMDInitialSilence':{'type':Sequelize[_0xf06e('0x5')](0x9)[_0xf06e('0x3')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf06e('0xf')},'dialAMDGreeting':{'type':Sequelize[_0xf06e('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf06e('0x10')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf06e('0x5')](0x9)[_0xf06e('0x3')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf06e('0x11')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf06e('0x12')},'dialAMDMinWordLength':{'type':Sequelize[_0xf06e('0x5')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf06e('0x5')](0x9)[_0xf06e('0x3')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf06e('0x13')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xf06e('0x3')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf06e('0x14')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xf06e('0x3')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf06e('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf06e('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf06e('0x16')},'dialOrderByScheduledAt':{'type':Sequelize[_0xf06e('0xb')](_0xf06e('0x17'),_0xf06e('0x18')),'defaultValue':_0xf06e('0x17')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf06e('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf06e('0x19')},'dialCutDigit':{'type':Sequelize[_0xf06e('0x5')](0x3)[_0xf06e('0x3')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf06e('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf06e('0x5')](0x3)[_0xf06e('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf06e('0x5')](0x5)[_0xf06e('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf06e('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0xf06e('0x5')](0x3)[_0xf06e('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xf06e('0x5')](0x5)[_0xf06e('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf06e('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf06e('0x5')](0x3)[_0xf06e('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf06e('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf06e('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf06e('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0xf06e('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf06e('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0xf06e('0x5')](0x5)[_0xf06e('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf06e('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf06e('0x5')](0x3)[_0xf06e('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf06e('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf06e('0x5')](0x5)[_0xf06e('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xb9c6=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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)','exports','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','STRING','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x383fa1,_0x503849){var _0x20126a=function(_0x284c79){while(--_0x284c79){_0x383fa1['push'](_0x383fa1['shift']());}};_0x20126a(++_0x503849);}(_0xb9c6,0x1c5));var _0x6b9c=function(_0x527379,_0x3ec58d){_0x527379=_0x527379-0x0;var _0x219af0=_0xb9c6[_0x527379];return _0x219af0;};'use strict';var Sequelize=require('sequelize');module[_0x6b9c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6b9c('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x6b9c('0x2')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x6b9c('0x3')],'defaultValue':0x0,'comment':_0x6b9c('0x4')},'limitCalls':{'type':Sequelize[_0x6b9c('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x6b9c('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6b9c('0x7')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6b9c('0x7')]},'dialOriginateTimeout':{'type':Sequelize[_0x6b9c('0x5')](0x3)[_0x6b9c('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b9c('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6b9c('0x5')](0x3)[_0x6b9c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b9c('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6b9c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b9c('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x6b9c('0x5')](0x3)[_0x6b9c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b9c('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6b9c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b9c('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6b9c('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6b9c('0x5')](0x5)[_0x6b9c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b9c('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6b9c('0x5')](0x3)[_0x6b9c('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6b9c('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6b9c('0x7')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x6b9c('0x10')]('always','never',_0x6b9c('0x11')),'defaultValue':_0x6b9c('0x12')},'dialAMDActive':{'type':Sequelize[_0x6b9c('0x3')],'defaultValue':0x0,'comment':_0x6b9c('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x6b9c('0x5')](0x9)[_0x6b9c('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6b9c('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x6b9c('0x5')](0x9)[_0x6b9c('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6b9c('0x5')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6b9c('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6b9c('0x5')](0x9)[_0x6b9c('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6b9c('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x6b9c('0x5')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6b9c('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6b9c('0x5')](0x9)[_0x6b9c('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6b9c('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6b9c('0x5')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x6b9c('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6b9c('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6b9c('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6b9c('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x6b9c('0x10')](_0x6b9c('0x1b'),_0x6b9c('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x6b9c('0x7')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6b9c('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x6b9c('0x5')](0x3)[_0x6b9c('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6b9c('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6b9c('0x5')](0x3)[_0x6b9c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b9c('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6b9c('0x5')](0x5)[_0x6b9c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6b9c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b9c('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x6b9c('0x5')](0x5)[_0x6b9c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b9c('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6b9c('0x5')](0x3)[_0x6b9c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b9c('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b9c('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x6b9c('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x6b9c('0x5')](0x5)[_0x6b9c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b9c('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6b9c('0x5')](0x3)[_0x6b9c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6b9c('0x5')](0x5)[_0x6b9c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 9fa1faa..8b2724b 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 _0xb5a7=['util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Campaign','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','updatedAt','createdAt','UserProfileSection','findOne','CmHopper','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','insert','cm_hopper','phone\x20IS\x20NOT\x20NULL','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','eml-format','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x4aebe0,_0x56bc9b){var _0x21f015=function(_0x400c29){while(--_0x400c29){_0x4aebe0['push'](_0x4aebe0['shift']());}};_0x21f015(++_0x56bc9b);}(_0xb5a7,0x81));var _0x7b5a=function(_0xb2e31e,_0x46710e){_0xb2e31e=_0xb2e31e-0x0;var _0x1fedc0=_0xb5a7[_0xb2e31e];return _0x1fedc0;};'use strict';var emlformat=require(_0x7b5a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b5a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b5a('0x2'));var moment=require(_0x7b5a('0x3'));var BPromise=require(_0x7b5a('0x4'));var Mustache=require(_0x7b5a('0x5'));var util=require(_0x7b5a('0x6'));var path=require('path');var sox=require(_0x7b5a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b5a('0x8'));var squel=require(_0x7b5a('0x9'));var crypto=require(_0x7b5a('0xa'));var jsforce=require(_0x7b5a('0xb'));var deskjs=require(_0x7b5a('0xc'));var toCsv=require(_0x7b5a('0xd'));var querystring=require(_0x7b5a('0xe'));var Papa=require(_0x7b5a('0xf'));var Redis=require(_0x7b5a('0x10'));var authService=require(_0x7b5a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b5a('0x12'));var logger=require(_0x7b5a('0x13'))(_0x7b5a('0x14'));var utils=require('../../config/utils');var config=require(_0x7b5a('0x15'));var licenseUtil=require(_0x7b5a('0x16'));var db=require(_0x7b5a('0x17'))['db'];function respondWithStatusCode(_0x2cec83,_0xbcbf40){_0xbcbf40=_0xbcbf40||0xcc;return function(_0x337fa2){if(_0x337fa2){return _0x2cec83[_0x7b5a('0x18')](_0xbcbf40);}return _0x2cec83[_0x7b5a('0x19')](_0xbcbf40)[_0x7b5a('0x1a')]();};}function respondWithResult(_0xfc1bf1,_0x494a3b){_0x494a3b=_0x494a3b||0xc8;return function(_0xa50528){if(_0xa50528){return _0xfc1bf1[_0x7b5a('0x19')](_0x494a3b)[_0x7b5a('0x1b')](_0xa50528);}};}function respondWithFilteredResult(_0x401ad0,_0x104d12){return function(_0x5e26aa){if(_0x5e26aa){var _0x1ead2a=typeof _0x104d12[_0x7b5a('0x1c')]==='undefined'&&typeof _0x104d12['limit']===_0x7b5a('0x1d');var _0x96c2d8=_0x5e26aa['count'];var _0x104e46=_0x1ead2a?0x0:_0x104d12['offset'];var _0xe6f003=_0x1ead2a?_0x5e26aa[_0x7b5a('0x1e')]:_0x104d12[_0x7b5a('0x1c')]+_0x104d12['limit'];var _0x1929cd;if(_0xe6f003>=_0x96c2d8){_0xe6f003=_0x96c2d8;_0x1929cd=0xc8;}else{_0x1929cd=0xce;}_0x401ad0[_0x7b5a('0x19')](_0x1929cd);return _0x401ad0['set'](_0x7b5a('0x1f'),_0x104e46+'-'+_0xe6f003+'/'+_0x96c2d8)[_0x7b5a('0x1b')](_0x5e26aa);}return null;};}function patchUpdates(_0xd926d8){return function(_0x375f76){try{jsonpatch[_0x7b5a('0x20')](_0x375f76,_0xd926d8,!![]);}catch(_0x3bbb01){return BPromise[_0x7b5a('0x21')](_0x3bbb01);}return _0x375f76[_0x7b5a('0x22')]();};}function saveUpdates(_0x1adc13,_0x29d18f){return function(_0x57cfa4){if(_0x57cfa4){return _0x57cfa4[_0x7b5a('0x23')](_0x1adc13)['then'](function(_0x8127ee){return _0x8127ee;});}return null;};}function removeEntity(_0x13341c,_0x271284){return function(_0x53aba6){if(_0x53aba6){return _0x53aba6[_0x7b5a('0x24')]()['then'](function(){var _0xc10ecb=_0x53aba6[_0x7b5a('0x25')]({'plain':!![]});var _0x2d65fa='IvrCampaigns';return db[_0x7b5a('0x26')]['destroy']({'where':{'type':_0x2d65fa,'resourceId':_0xc10ecb['id']}})[_0x7b5a('0x27')](function(){return _0x53aba6;});})[_0x7b5a('0x27')](function(){_0x13341c[_0x7b5a('0x19')](0xcc)[_0x7b5a('0x1a')]();});}};}function handleEntityNotFound(_0x3f0564,_0x87e653){return function(_0x1600e9){if(!_0x1600e9){_0x3f0564[_0x7b5a('0x18')](0x194);}return _0x1600e9;};}function handleError(_0x244986,_0x34ea63){_0x34ea63=_0x34ea63||0x1f4;return function(_0x121fda){logger[_0x7b5a('0x28')](_0x121fda[_0x7b5a('0x29')]);if(_0x121fda[_0x7b5a('0x2a')]){delete _0x121fda[_0x7b5a('0x2a')];}_0x244986[_0x7b5a('0x19')](_0x34ea63)[_0x7b5a('0x2b')](_0x121fda);};}exports[_0x7b5a('0x2c')]=function(_0xa04a54,_0x452837){var _0x3054f5={},_0x14247a={},_0x168f9a={'count':0x0,'rows':[]};var _0x34e08e=_[_0x7b5a('0x2d')](db['Campaign'][_0x7b5a('0x2e')],function(_0x288d65){return{'name':_0x288d65[_0x7b5a('0x2f')],'type':_0x288d65[_0x7b5a('0x30')]['key']};});_0x14247a[_0x7b5a('0x31')]=_['map'](_0x34e08e,_0x7b5a('0x2a'));_0x14247a[_0x7b5a('0x32')]=_['keys'](_0xa04a54['query']);_0x14247a[_0x7b5a('0x33')]=_['intersection'](_0x14247a[_0x7b5a('0x31')],_0x14247a[_0x7b5a('0x32')]);_0x3054f5[_0x7b5a('0x34')]=_['intersection'](_0x14247a[_0x7b5a('0x31')],qs[_0x7b5a('0x35')](_0xa04a54[_0x7b5a('0x32')]['fields']));_0x3054f5[_0x7b5a('0x34')]=_0x3054f5[_0x7b5a('0x34')]['length']?_0x3054f5['attributes']:_0x14247a['model'];if(!_0xa04a54[_0x7b5a('0x32')][_0x7b5a('0x36')](_0x7b5a('0x37'))){_0x3054f5[_0x7b5a('0x38')]=qs[_0x7b5a('0x38')](_0xa04a54[_0x7b5a('0x32')][_0x7b5a('0x38')]);_0x3054f5[_0x7b5a('0x1c')]=qs['offset'](_0xa04a54[_0x7b5a('0x32')][_0x7b5a('0x1c')]);}_0x3054f5[_0x7b5a('0x39')]=qs[_0x7b5a('0x3a')](_0xa04a54[_0x7b5a('0x32')][_0x7b5a('0x3a')]);_0x3054f5[_0x7b5a('0x3b')]=qs[_0x7b5a('0x33')](_[_0x7b5a('0x3c')](_0xa04a54['query'],_0x14247a['filters']),_0x34e08e);if(_0xa04a54[_0x7b5a('0x32')][_0x7b5a('0x3d')]){_0x3054f5[_0x7b5a('0x3b')]=_[_0x7b5a('0x3e')](_0x3054f5[_0x7b5a('0x3b')],{'$or':_['map'](_0x34e08e,function(_0x15b93e){if(_0x15b93e[_0x7b5a('0x30')]!==_0x7b5a('0x3f')){var _0x18b722={};_0x18b722[_0x15b93e[_0x7b5a('0x2a')]]={'$like':'%'+_0xa04a54[_0x7b5a('0x32')]['filter']+'%'};return _0x18b722;}})});}_0x3054f5=_[_0x7b5a('0x3e')]({},_0x3054f5,_0xa04a54[_0x7b5a('0x40')]);var _0x4ce403={'where':_0x3054f5[_0x7b5a('0x3b')]};return db[_0x7b5a('0x41')][_0x7b5a('0x1e')](_0x4ce403)[_0x7b5a('0x27')](function(_0x46c32a){_0x168f9a[_0x7b5a('0x1e')]=_0x46c32a;if(_0xa04a54[_0x7b5a('0x32')][_0x7b5a('0x42')]){_0x3054f5[_0x7b5a('0x43')]=[{'all':!![]}];}return db['Campaign'][_0x7b5a('0x44')](_0x3054f5);})[_0x7b5a('0x27')](function(_0x2ce3ae){_0x168f9a[_0x7b5a('0x45')]=_0x2ce3ae;return _0x168f9a;})[_0x7b5a('0x27')](respondWithFilteredResult(_0x452837,_0x3054f5))[_0x7b5a('0x46')](handleError(_0x452837,null));};exports[_0x7b5a('0x47')]=function(_0x40cc13,_0x5657f6){var _0x3664c7={'raw':![],'where':{'id':_0x40cc13[_0x7b5a('0x48')]['id']}},_0x5906c8={};_0x5906c8[_0x7b5a('0x31')]=_[_0x7b5a('0x49')](db['Campaign'][_0x7b5a('0x2e')]);_0x5906c8[_0x7b5a('0x32')]=_['keys'](_0x40cc13[_0x7b5a('0x32')]);_0x5906c8[_0x7b5a('0x33')]=_[_0x7b5a('0x4a')](_0x5906c8[_0x7b5a('0x31')],_0x5906c8[_0x7b5a('0x32')]);_0x3664c7['attributes']=_[_0x7b5a('0x4a')](_0x5906c8[_0x7b5a('0x31')],qs['fields'](_0x40cc13[_0x7b5a('0x32')][_0x7b5a('0x35')]));_0x3664c7['attributes']=_0x3664c7[_0x7b5a('0x34')]['length']?_0x3664c7[_0x7b5a('0x34')]:_0x5906c8['model'];if(_0x40cc13[_0x7b5a('0x32')][_0x7b5a('0x42')]){_0x3664c7[_0x7b5a('0x43')]=[{'all':!![]}];}_0x3664c7=_[_0x7b5a('0x3e')]({},_0x3664c7,_0x40cc13[_0x7b5a('0x40')]);return db[_0x7b5a('0x41')][_0x7b5a('0x4b')](_0x3664c7)[_0x7b5a('0x27')](handleEntityNotFound(_0x5657f6,null))['then'](respondWithResult(_0x5657f6,null))['catch'](handleError(_0x5657f6,null));};exports[_0x7b5a('0x4c')]=function(_0xcba375,_0x57a3bb){return db[_0x7b5a('0x41')]['create'](_0xcba375[_0x7b5a('0x4d')],{})[_0x7b5a('0x27')](function(_0x335561){var _0x12868d=_0xcba375[_0x7b5a('0x4e')]['get']({'plain':!![]});if(!_0x12868d)throw new Error(_0x7b5a('0x4f'));if(_0x12868d[_0x7b5a('0x50')]==='user'){var _0x146884=_0x335561[_0x7b5a('0x25')]({'plain':!![]});var _0x1272a6=_0x7b5a('0x51');return db['UserProfileSection']['find']({'where':{'name':_0x1272a6,'userProfileId':_0x12868d[_0x7b5a('0x52')]},'raw':!![]})[_0x7b5a('0x27')](function(_0x1ae6d5){if(_0x1ae6d5&&_0x1ae6d5[_0x7b5a('0x53')]===0x0){return db[_0x7b5a('0x26')]['create']({'name':_0x146884[_0x7b5a('0x2a')],'resourceId':_0x146884['id'],'type':_0x1ae6d5[_0x7b5a('0x2a')],'sectionId':_0x1ae6d5['id']},{})[_0x7b5a('0x27')](function(){return _0x335561;});}else{return _0x335561;}})[_0x7b5a('0x46')](function(_0x570ab2){logger[_0x7b5a('0x28')](_0x7b5a('0x54'),_0x570ab2);throw _0x570ab2;});}return _0x335561;})[_0x7b5a('0x27')](respondWithResult(_0x57a3bb,0xc9))[_0x7b5a('0x46')](handleError(_0x57a3bb,null));};exports[_0x7b5a('0x55')]=function(_0x2f44ce,_0x2dee5b){var _0x5b677a={'where':{'id':_0x2f44ce[_0x7b5a('0x48')]['id']}},_0xff030b={};_0xff030b[_0x7b5a('0x31')]=_[_0x7b5a('0x49')](db[_0x7b5a('0x41')][_0x7b5a('0x2e')]);_0x5b677a[_0x7b5a('0x34')]=_[_0x7b5a('0x4a')](_0xff030b[_0x7b5a('0x31')],qs[_0x7b5a('0x35')](_0x2f44ce[_0x7b5a('0x32')][_0x7b5a('0x35')]));_0x5b677a['attributes']=_0x5b677a[_0x7b5a('0x34')][_0x7b5a('0x56')]?_0x5b677a['attributes']:_0xff030b[_0x7b5a('0x31')];if(_0x2f44ce[_0x7b5a('0x32')][_0x7b5a('0x42')]){_0x5b677a[_0x7b5a('0x43')]=[{'all':!![]}];}_0x5b677a=_['merge']({},_0x5b677a,_0x2f44ce[_0x7b5a('0x40')]);return db[_0x7b5a('0x41')]['find'](_0x5b677a)[_0x7b5a('0x27')](handleEntityNotFound(_0x2dee5b,null))[_0x7b5a('0x27')](function(_0x34cc84){if(_0x34cc84){var _0x56cfc4=_0x34cc84[_0x7b5a('0x25')]({'plain':!![]});_0x56cfc4=qs[_0x7b5a('0x57')](_0x56cfc4,['id','createdAt',_0x7b5a('0x58')]);_0x2f44ce[_0x7b5a('0x4d')]=_['omit'](_0x2f44ce[_0x7b5a('0x4d')],['id',_0x7b5a('0x59'),_0x7b5a('0x58')]);return db[_0x7b5a('0x41')][_0x7b5a('0x4c')](_[_0x7b5a('0x3e')](_0x56cfc4,_0x2f44ce[_0x7b5a('0x4d')]),{'include':_0x2f44ce[_0x7b5a('0x32')][_0x7b5a('0x42')]?[{'all':!![]}]:undefined})[_0x7b5a('0x27')](function(_0x5cc13e){var _0x25d0d9=_0x2f44ce[_0x7b5a('0x4e')][_0x7b5a('0x25')]({'plain':!![]});if(!_0x25d0d9)throw new Error(_0x7b5a('0x4f'));if(_0x25d0d9[_0x7b5a('0x50')]==='user'){var _0x210f1c=_0x5cc13e[_0x7b5a('0x25')]({'plain':!![]});var _0x5639a2=_0x7b5a('0x51');return db[_0x7b5a('0x5a')][_0x7b5a('0x4b')]({'where':{'name':_0x5639a2,'userProfileId':_0x25d0d9[_0x7b5a('0x52')]},'raw':!![]})[_0x7b5a('0x27')](function(_0x2c20bf){if(_0x2c20bf&&_0x2c20bf[_0x7b5a('0x53')]===0x0){return db[_0x7b5a('0x26')][_0x7b5a('0x4c')]({'name':_0x210f1c['name'],'resourceId':_0x210f1c['id'],'type':_0x2c20bf['name'],'sectionId':_0x2c20bf['id']},{})[_0x7b5a('0x27')](function(){return _0x5cc13e;});}else{return _0x5cc13e;}})[_0x7b5a('0x46')](function(_0x2ef26a){logger[_0x7b5a('0x28')](_0x7b5a('0x54'),_0x2ef26a);throw _0x2ef26a;});}return _0x5cc13e;});}})[_0x7b5a('0x27')](respondWithResult(_0x2dee5b,0xc9))[_0x7b5a('0x46')](handleError(_0x2dee5b,null));};exports[_0x7b5a('0x23')]=function(_0x1bb6cb,_0x52851c){if(_0x1bb6cb['body']['id']){delete _0x1bb6cb[_0x7b5a('0x4d')]['id'];}return db[_0x7b5a('0x41')]['find']({'where':{'id':_0x1bb6cb[_0x7b5a('0x48')]['id']}})[_0x7b5a('0x27')](handleEntityNotFound(_0x52851c,null))[_0x7b5a('0x27')](saveUpdates(_0x1bb6cb['body'],null))[_0x7b5a('0x27')](respondWithResult(_0x52851c,null))[_0x7b5a('0x46')](handleError(_0x52851c,null));};exports[_0x7b5a('0x24')]=function(_0x2965a9,_0x316973){return db['Campaign'][_0x7b5a('0x4b')]({'where':{'id':_0x2965a9[_0x7b5a('0x48')]['id']}})[_0x7b5a('0x27')](handleEntityNotFound(_0x316973,null))['then'](removeEntity(_0x316973,null))[_0x7b5a('0x46')](handleError(_0x316973,null));};exports['getHoppers']=function(_0x489978,_0x58e912,_0x19db2c){var _0x5071d8={'raw':!![],'where':{}};var _0x3b4b35={};var _0x20109c={'count':0x0,'rows':[]};return db[_0x7b5a('0x41')][_0x7b5a('0x5b')]({'where':{'id':_0x489978['params']['id']}})[_0x7b5a('0x27')](handleEntityNotFound(_0x58e912,null))[_0x7b5a('0x27')](function(_0x21864b){if(_0x21864b){_0x3b4b35[_0x7b5a('0x31')]=_[_0x7b5a('0x49')](db[_0x7b5a('0x5c')]['rawAttributes']);_0x3b4b35[_0x7b5a('0x32')]=_[_0x7b5a('0x49')](_0x489978[_0x7b5a('0x32')]);_0x3b4b35[_0x7b5a('0x33')]=_[_0x7b5a('0x4a')](_0x3b4b35[_0x7b5a('0x31')],_0x3b4b35[_0x7b5a('0x32')]);_0x5071d8[_0x7b5a('0x34')]=_[_0x7b5a('0x4a')](_0x3b4b35[_0x7b5a('0x31')],qs[_0x7b5a('0x35')](_0x489978[_0x7b5a('0x32')][_0x7b5a('0x35')]));_0x5071d8[_0x7b5a('0x34')]=_0x5071d8['attributes'][_0x7b5a('0x56')]?_0x5071d8[_0x7b5a('0x34')]:_0x3b4b35[_0x7b5a('0x31')];if(!_0x489978[_0x7b5a('0x32')]['hasOwnProperty'](_0x7b5a('0x37'))){_0x5071d8['limit']=qs['limit'](_0x489978[_0x7b5a('0x32')]['limit']);_0x5071d8['offset']=qs[_0x7b5a('0x1c')](_0x489978['query']['offset']);}_0x5071d8[_0x7b5a('0x39')]=qs[_0x7b5a('0x3a')](_0x489978[_0x7b5a('0x32')]['sort']);_0x5071d8['where']=qs[_0x7b5a('0x33')](_['pick'](_0x489978[_0x7b5a('0x32')],_0x3b4b35['filters']));_0x5071d8[_0x7b5a('0x3b')][_0x7b5a('0x5d')]=_0x21864b['id'];if(_0x489978[_0x7b5a('0x32')][_0x7b5a('0x3d')]){_0x5071d8[_0x7b5a('0x3b')]=_[_0x7b5a('0x3e')](_0x5071d8[_0x7b5a('0x3b')],{'$or':_[_0x7b5a('0x2d')](_0x5071d8[_0x7b5a('0x34')],function(_0x351c79){var _0x4e4a27={};_0x4e4a27[_0x351c79]={'$like':'%'+_0x489978[_0x7b5a('0x32')]['filter']+'%'};return _0x4e4a27;})});}_0x5071d8=_['merge']({},_0x5071d8,_0x489978[_0x7b5a('0x40')]);return db[_0x7b5a('0x5c')][_0x7b5a('0x1e')]({'where':_0x5071d8['where']})[_0x7b5a('0x27')](function(_0x426df3){_0x20109c[_0x7b5a('0x1e')]=_0x426df3;if(_0x489978['query'][_0x7b5a('0x42')]){_0x5071d8[_0x7b5a('0x43')]=[{'all':!![]}];}return db[_0x7b5a('0x5c')][_0x7b5a('0x44')](_0x5071d8);})[_0x7b5a('0x27')](function(_0x35d4c8){_0x20109c['rows']=_0x35d4c8;return _0x20109c;});}})[_0x7b5a('0x27')](respondWithFilteredResult(_0x58e912,_0x5071d8))[_0x7b5a('0x46')](handleError(_0x58e912,null));};exports['getHopperHistories']=function(_0x55dddf,_0x5bbd08,_0x1d24ac){var _0x5459b3={'raw':!![],'where':{}};var _0x158802={};var _0x10ce2e={'count':0x0,'rows':[]};return db['Campaign'][_0x7b5a('0x5b')]({'where':{'id':_0x55dddf[_0x7b5a('0x48')]['id']}})[_0x7b5a('0x27')](handleEntityNotFound(_0x5bbd08,null))[_0x7b5a('0x27')](function(_0x3bdd70){if(_0x3bdd70){_0x158802[_0x7b5a('0x31')]=_['keys'](db[_0x7b5a('0x5e')][_0x7b5a('0x2e')]);_0x158802[_0x7b5a('0x32')]=_[_0x7b5a('0x49')](_0x55dddf['query']);_0x158802['filters']=_[_0x7b5a('0x4a')](_0x158802[_0x7b5a('0x31')],_0x158802['query']);_0x5459b3[_0x7b5a('0x34')]=_['intersection'](_0x158802[_0x7b5a('0x31')],qs[_0x7b5a('0x35')](_0x55dddf[_0x7b5a('0x32')][_0x7b5a('0x35')]));_0x5459b3[_0x7b5a('0x34')]=_0x5459b3[_0x7b5a('0x34')][_0x7b5a('0x56')]?_0x5459b3[_0x7b5a('0x34')]:_0x158802['model'];if(!_0x55dddf[_0x7b5a('0x32')][_0x7b5a('0x36')]('nolimit')){_0x5459b3[_0x7b5a('0x38')]=qs[_0x7b5a('0x38')](_0x55dddf[_0x7b5a('0x32')]['limit']);_0x5459b3[_0x7b5a('0x1c')]=qs[_0x7b5a('0x1c')](_0x55dddf[_0x7b5a('0x32')][_0x7b5a('0x1c')]);}_0x5459b3['order']=qs[_0x7b5a('0x3a')](_0x55dddf[_0x7b5a('0x32')][_0x7b5a('0x3a')]);_0x5459b3['where']=qs[_0x7b5a('0x33')](_[_0x7b5a('0x3c')](_0x55dddf[_0x7b5a('0x32')],_0x158802[_0x7b5a('0x33')]));_0x5459b3[_0x7b5a('0x3b')]['CampaignId']=_0x3bdd70['id'];if(_0x55dddf[_0x7b5a('0x32')]['filter']){_0x5459b3[_0x7b5a('0x3b')]=_['merge'](_0x5459b3[_0x7b5a('0x3b')],{'$or':_[_0x7b5a('0x2d')](_0x5459b3['attributes'],function(_0x106ff5){var _0x5977c1={};_0x5977c1[_0x106ff5]={'$like':'%'+_0x55dddf[_0x7b5a('0x32')][_0x7b5a('0x3d')]+'%'};return _0x5977c1;})});}_0x5459b3=_[_0x7b5a('0x3e')]({},_0x5459b3,_0x55dddf['options']);return db[_0x7b5a('0x5e')]['count']({'where':_0x5459b3['where']})[_0x7b5a('0x27')](function(_0xd40acb){_0x10ce2e[_0x7b5a('0x1e')]=_0xd40acb;if(_0x55dddf[_0x7b5a('0x32')][_0x7b5a('0x42')]){_0x5459b3[_0x7b5a('0x43')]=[{'all':!![]}];}return db[_0x7b5a('0x5e')][_0x7b5a('0x44')](_0x5459b3);})[_0x7b5a('0x27')](function(_0x4a9521){_0x10ce2e['rows']=_0x4a9521;return _0x10ce2e;});}})[_0x7b5a('0x27')](respondWithFilteredResult(_0x5bbd08,_0x5459b3))[_0x7b5a('0x46')](handleError(_0x5bbd08,null));};exports[_0x7b5a('0x5f')]=function(_0x25aa66,_0x27a553,_0x2a8f5c){var _0xa48388={'raw':!![],'where':{}};var _0x1ac7ce={};var _0x45ce91={'count':0x0,'rows':[]};return db[_0x7b5a('0x41')][_0x7b5a('0x5b')]({'where':{'id':_0x25aa66[_0x7b5a('0x48')]['id']}})['then'](handleEntityNotFound(_0x27a553,null))['then'](function(_0x5aa46f){if(_0x5aa46f){_0x1ac7ce[_0x7b5a('0x31')]=_[_0x7b5a('0x49')](db['CmHopperFinal']['rawAttributes']);_0x1ac7ce[_0x7b5a('0x32')]=_['keys'](_0x25aa66[_0x7b5a('0x32')]);_0x1ac7ce[_0x7b5a('0x33')]=_[_0x7b5a('0x4a')](_0x1ac7ce['model'],_0x1ac7ce['query']);_0xa48388[_0x7b5a('0x34')]=_['intersection'](_0x1ac7ce[_0x7b5a('0x31')],qs[_0x7b5a('0x35')](_0x25aa66[_0x7b5a('0x32')][_0x7b5a('0x35')]));_0xa48388[_0x7b5a('0x34')]=_0xa48388['attributes'][_0x7b5a('0x56')]?_0xa48388['attributes']:_0x1ac7ce['model'];if(!_0x25aa66[_0x7b5a('0x32')]['hasOwnProperty'](_0x7b5a('0x37'))){_0xa48388['limit']=qs[_0x7b5a('0x38')](_0x25aa66[_0x7b5a('0x32')][_0x7b5a('0x38')]);_0xa48388[_0x7b5a('0x1c')]=qs['offset'](_0x25aa66[_0x7b5a('0x32')][_0x7b5a('0x1c')]);}_0xa48388[_0x7b5a('0x39')]=qs[_0x7b5a('0x3a')](_0x25aa66['query'][_0x7b5a('0x3a')]);_0xa48388[_0x7b5a('0x3b')]=qs['filters'](_[_0x7b5a('0x3c')](_0x25aa66[_0x7b5a('0x32')],_0x1ac7ce[_0x7b5a('0x33')]));_0xa48388['where'][_0x7b5a('0x5d')]=_0x5aa46f['id'];if(_0x25aa66['query'][_0x7b5a('0x3d')]){_0xa48388[_0x7b5a('0x3b')]=_[_0x7b5a('0x3e')](_0xa48388[_0x7b5a('0x3b')],{'$or':_[_0x7b5a('0x2d')](_0xa48388[_0x7b5a('0x34')],function(_0x3b801d){var _0x2526c7={};_0x2526c7[_0x3b801d]={'$like':'%'+_0x25aa66[_0x7b5a('0x32')][_0x7b5a('0x3d')]+'%'};return _0x2526c7;})});}_0xa48388=_[_0x7b5a('0x3e')]({},_0xa48388,_0x25aa66[_0x7b5a('0x40')]);return db[_0x7b5a('0x60')]['count']({'where':_0xa48388[_0x7b5a('0x3b')]})[_0x7b5a('0x27')](function(_0x1b4d5c){_0x45ce91[_0x7b5a('0x1e')]=_0x1b4d5c;if(_0x25aa66[_0x7b5a('0x32')][_0x7b5a('0x42')]){_0xa48388[_0x7b5a('0x43')]=[{'all':!![]}];}return db[_0x7b5a('0x60')]['findAll'](_0xa48388);})[_0x7b5a('0x27')](function(_0x4a88e0){_0x45ce91['rows']=_0x4a88e0;return _0x45ce91;});}})['then'](respondWithFilteredResult(_0x27a553,_0xa48388))[_0x7b5a('0x46')](handleError(_0x27a553,null));};exports['getHopperBlacks']=function(_0x50630d,_0x3ade91,_0x440d5f){var _0x38c087={'raw':!![],'where':{}};var _0x1e3011={};var _0x1a74db={'count':0x0,'rows':[]};return db[_0x7b5a('0x41')][_0x7b5a('0x5b')]({'where':{'id':_0x50630d[_0x7b5a('0x48')]['id']}})[_0x7b5a('0x27')](handleEntityNotFound(_0x3ade91,null))[_0x7b5a('0x27')](function(_0x2a46a6){if(_0x2a46a6){_0x1e3011[_0x7b5a('0x31')]=_[_0x7b5a('0x49')](db['CmHopperBlack'][_0x7b5a('0x2e')]);_0x1e3011['query']=_[_0x7b5a('0x49')](_0x50630d[_0x7b5a('0x32')]);_0x1e3011[_0x7b5a('0x33')]=_[_0x7b5a('0x4a')](_0x1e3011[_0x7b5a('0x31')],_0x1e3011[_0x7b5a('0x32')]);_0x38c087[_0x7b5a('0x34')]=_[_0x7b5a('0x4a')](_0x1e3011[_0x7b5a('0x31')],qs[_0x7b5a('0x35')](_0x50630d['query'][_0x7b5a('0x35')]));_0x38c087[_0x7b5a('0x34')]=_0x38c087[_0x7b5a('0x34')][_0x7b5a('0x56')]?_0x38c087[_0x7b5a('0x34')]:_0x1e3011[_0x7b5a('0x31')];if(!_0x50630d[_0x7b5a('0x32')]['hasOwnProperty'](_0x7b5a('0x37'))){_0x38c087[_0x7b5a('0x38')]=qs['limit'](_0x50630d[_0x7b5a('0x32')]['limit']);_0x38c087[_0x7b5a('0x1c')]=qs['offset'](_0x50630d[_0x7b5a('0x32')]['offset']);}_0x38c087[_0x7b5a('0x39')]=qs[_0x7b5a('0x3a')](_0x50630d[_0x7b5a('0x32')]['sort']);_0x38c087[_0x7b5a('0x3b')]=qs[_0x7b5a('0x33')](_[_0x7b5a('0x3c')](_0x50630d['query'],_0x1e3011[_0x7b5a('0x33')]));_0x38c087[_0x7b5a('0x3b')]['CampaignId']=_0x2a46a6['id'];if(_0x50630d[_0x7b5a('0x32')][_0x7b5a('0x3d')]){_0x38c087[_0x7b5a('0x3b')]=_[_0x7b5a('0x3e')](_0x38c087[_0x7b5a('0x3b')],{'$or':_['map'](_0x38c087[_0x7b5a('0x34')],function(_0x4c2b53){var _0xba0ac3={};_0xba0ac3[_0x4c2b53]={'$like':'%'+_0x50630d[_0x7b5a('0x32')][_0x7b5a('0x3d')]+'%'};return _0xba0ac3;})});}_0x38c087=_[_0x7b5a('0x3e')]({},_0x38c087,_0x50630d['options']);return db['CmHopperBlack'][_0x7b5a('0x1e')]({'where':_0x38c087['where']})[_0x7b5a('0x27')](function(_0x1924ec){_0x1a74db[_0x7b5a('0x1e')]=_0x1924ec;if(_0x50630d[_0x7b5a('0x32')][_0x7b5a('0x42')]){_0x38c087[_0x7b5a('0x43')]=[{'all':!![]}];}return db[_0x7b5a('0x61')][_0x7b5a('0x44')](_0x38c087);})[_0x7b5a('0x27')](function(_0x2b06a9){_0x1a74db[_0x7b5a('0x45')]=_0x2b06a9;return _0x1a74db;});}})[_0x7b5a('0x27')](respondWithFilteredResult(_0x3ade91,_0x38c087))[_0x7b5a('0x46')](handleError(_0x3ade91,null));};exports[_0x7b5a('0x62')]=function(_0x25cdbc,_0x500357,_0x5262c0){var _0x2e5902={};var _0x2bd23f={};var _0x20b6e2;var _0x3e0374;return db[_0x7b5a('0x41')][_0x7b5a('0x5b')]({'where':{'id':_0x25cdbc[_0x7b5a('0x48')]['id']}})[_0x7b5a('0x27')](handleEntityNotFound(_0x500357,null))[_0x7b5a('0x27')](function(_0x5c2f3c){if(_0x5c2f3c){_0x20b6e2=_0x5c2f3c;_0x2bd23f[_0x7b5a('0x31')]=_['keys'](db[_0x7b5a('0x63')][_0x7b5a('0x2e')]);_0x2bd23f[_0x7b5a('0x32')]=_[_0x7b5a('0x49')](_0x25cdbc[_0x7b5a('0x32')]);_0x2bd23f[_0x7b5a('0x33')]=_['intersection'](_0x2bd23f[_0x7b5a('0x31')],_0x2bd23f[_0x7b5a('0x32')]);_0x2e5902[_0x7b5a('0x34')]=_['intersection'](_0x2bd23f[_0x7b5a('0x31')],qs['fields'](_0x25cdbc[_0x7b5a('0x32')][_0x7b5a('0x35')]));_0x2e5902[_0x7b5a('0x34')]=_0x2e5902['attributes'][_0x7b5a('0x56')]?_0x2e5902['attributes']:_0x2bd23f['model'];_0x2e5902[_0x7b5a('0x39')]=qs[_0x7b5a('0x3a')](_0x25cdbc[_0x7b5a('0x32')]['sort']);_0x2e5902[_0x7b5a('0x3b')]=qs[_0x7b5a('0x33')](_[_0x7b5a('0x3c')](_0x25cdbc[_0x7b5a('0x32')],_0x2bd23f[_0x7b5a('0x33')]));if(_0x25cdbc[_0x7b5a('0x32')][_0x7b5a('0x3d')]){_0x2e5902['where']=_[_0x7b5a('0x3e')](_0x2e5902[_0x7b5a('0x3b')],{'$or':_[_0x7b5a('0x2d')](_0x2e5902['attributes'],function(_0xeadc83){var _0x1ced9f={};_0x1ced9f[_0xeadc83]={'$like':'%'+_0x25cdbc['query'][_0x7b5a('0x3d')]+'%'};return _0x1ced9f;})});}_0x2e5902=_['merge']({},_0x2e5902,_0x25cdbc['options']);return _0x20b6e2['getLists'](_0x2e5902);}})[_0x7b5a('0x27')](function(_0x517ec9){if(_0x517ec9){_0x3e0374=_0x517ec9[_0x7b5a('0x56')];if(!_0x25cdbc['query'][_0x7b5a('0x36')](_0x7b5a('0x37'))){_0x2e5902['limit']=qs['limit'](_0x25cdbc['query'][_0x7b5a('0x38')]);_0x2e5902[_0x7b5a('0x1c')]=qs[_0x7b5a('0x1c')](_0x25cdbc['query'][_0x7b5a('0x1c')]);}return _0x20b6e2['getLists'](_0x2e5902);}})[_0x7b5a('0x27')](function(_0x269331){if(_0x269331){return _0x269331?{'count':_0x3e0374,'rows':_0x269331}:null;}})[_0x7b5a('0x27')](respondWithResult(_0x500357,null))[_0x7b5a('0x46')](handleError(_0x500357,null));};exports[_0x7b5a('0x64')]=function(_0x2782b1,_0x2593fe,_0x14e51d){var _0x9572d5,_0x4e5f73;return db[_0x7b5a('0x41')][_0x7b5a('0x4b')]({'where':{'id':_0x2782b1[_0x7b5a('0x48')]['id']}})[_0x7b5a('0x27')](handleEntityNotFound(_0x2593fe,null))[_0x7b5a('0x27')](function(_0x35f21d){if(_0x35f21d){_0x4e5f73=_0x35f21d;return _0x35f21d['addLists'](_0x2782b1[_0x7b5a('0x4d')]['ids'],_[_0x7b5a('0x57')](_0x2782b1['body'],[_0x7b5a('0x65'),'id'])||{});}return null;})[_0x7b5a('0x66')](function(_0x5362f8){var _0x12825c;_0x9572d5=_0x5362f8||[];var _0x2caf6b=[];if(_0x5362f8){for(var _0x5ccd08=0x0;_0x5ccd08<_0x5362f8['length'];_0x5ccd08+=0x1){var _0x120f1e=_0x5362f8[_0x5ccd08][_0x7b5a('0x25')]({'plain':!![]});_0x4e5f73[_0x7b5a('0x67')]=_0x2782b1[_0x7b5a('0x4d')][_0x7b5a('0x67')]?_0x2782b1[_0x7b5a('0x4d')][_0x7b5a('0x67')]:_0x4e5f73[_0x7b5a('0x67')];switch(_0x4e5f73[_0x7b5a('0x67')]){case _0x7b5a('0x68'):_0x12825c=squel['insert']()[_0x7b5a('0x69')]('cm_hopper')[_0x7b5a('0x6a')]([_0x7b5a('0x6b'),'scheduledAt',_0x7b5a('0x6c'),_0x7b5a('0x6d'),'CampaignId',_0x7b5a('0x59'),_0x7b5a('0x58')],squel[_0x7b5a('0x6e')]()[_0x7b5a('0x6f')](_0x7b5a('0x6b'),_0x7b5a('0x6b'))[_0x7b5a('0x6f')](_0x7b5a('0x70'),_0x7b5a('0x71'))[_0x7b5a('0x6f')]('id',_0x7b5a('0x6c'))[_0x7b5a('0x6f')](_0x120f1e[_0x7b5a('0x72')][_0x7b5a('0x73')](),_0x7b5a('0x6d'))[_0x7b5a('0x6f')](_0x2782b1[_0x7b5a('0x48')]['id'][_0x7b5a('0x73')](),'CampaignId')[_0x7b5a('0x6f')]('NOW()',_0x7b5a('0x59'))[_0x7b5a('0x6f')](_0x7b5a('0x70'),_0x7b5a('0x58'))[_0x7b5a('0x74')](_0x7b5a('0x75'))[_0x7b5a('0x3b')](_0x7b5a('0x76'))[_0x7b5a('0x3b')](_0x7b5a('0x77'),_0x120f1e['CmListId']['toString']())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x7b5a('0x78'),squel[_0x7b5a('0x6e')]()[_0x7b5a('0x6f')](_0x7b5a('0x79'))['from']('cm_hopper_final')[_0x7b5a('0x3b')](_0x7b5a('0x7a'),_0x2782b1[_0x7b5a('0x48')]['id']['toString']()))[_0x7b5a('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x7b5a('0x6f')](_0x7b5a('0x7b'))[_0x7b5a('0x74')]('cm_hopper')['where'](_0x7b5a('0x7a'),_0x2782b1['params']['id'][_0x7b5a('0x73')]())))['toString']();break;case'onlyIfOpen':_0x12825c=squel[_0x7b5a('0x7c')]()[_0x7b5a('0x69')](_0x7b5a('0x7d'))[_0x7b5a('0x6a')](['phone',_0x7b5a('0x71'),'ContactId',_0x7b5a('0x6d'),_0x7b5a('0x5d'),_0x7b5a('0x59'),_0x7b5a('0x58')],squel[_0x7b5a('0x6e')]()[_0x7b5a('0x6f')](_0x7b5a('0x6b'),_0x7b5a('0x6b'))['field'](_0x7b5a('0x70'),'scheduledAt')[_0x7b5a('0x6f')]('id',_0x7b5a('0x6c'))[_0x7b5a('0x6f')](_0x120f1e['CmListId'][_0x7b5a('0x73')](),_0x7b5a('0x6d'))[_0x7b5a('0x6f')](_0x2782b1[_0x7b5a('0x48')]['id'][_0x7b5a('0x73')](),_0x7b5a('0x5d'))[_0x7b5a('0x6f')]('NOW()',_0x7b5a('0x59'))[_0x7b5a('0x6f')]('NOW()','updatedAt')[_0x7b5a('0x74')](_0x7b5a('0x75'))[_0x7b5a('0x3b')]('deletedAt\x20IS\x20NULL')[_0x7b5a('0x3b')](_0x7b5a('0x77'),_0x120f1e[_0x7b5a('0x72')]['toString']())[_0x7b5a('0x3b')](_0x7b5a('0x7e'))[_0x7b5a('0x3b')](_0x7b5a('0x78'),squel[_0x7b5a('0x6e')]()[_0x7b5a('0x6f')](_0x7b5a('0x7b'))[_0x7b5a('0x74')](_0x7b5a('0x7d'))[_0x7b5a('0x3b')](_0x7b5a('0x7a'),_0x2782b1[_0x7b5a('0x48')]['id']['toString']())))['toString']();break;default:_0x12825c=squel[_0x7b5a('0x7c')]()['into'](_0x7b5a('0x7d'))['fromQuery'](['phone','scheduledAt',_0x7b5a('0x6c'),'ListId',_0x7b5a('0x5d'),'createdAt',_0x7b5a('0x58')],squel[_0x7b5a('0x6e')]()[_0x7b5a('0x6f')]('phone',_0x7b5a('0x6b'))[_0x7b5a('0x6f')](_0x7b5a('0x70'),'scheduledAt')['field']('id','ContactId')[_0x7b5a('0x6f')](_0x120f1e[_0x7b5a('0x72')][_0x7b5a('0x73')](),'ListId')[_0x7b5a('0x6f')](_0x2782b1[_0x7b5a('0x48')]['id'][_0x7b5a('0x73')](),_0x7b5a('0x5d'))[_0x7b5a('0x6f')](_0x7b5a('0x70'),'createdAt')[_0x7b5a('0x6f')](_0x7b5a('0x70'),_0x7b5a('0x58'))['from'](_0x7b5a('0x75'))['where'](_0x7b5a('0x76'))['where'](_0x7b5a('0x77'),_0x120f1e['CmListId'][_0x7b5a('0x73')]())['where'](_0x7b5a('0x7e')))['toString']();}_0x2caf6b[_0x7b5a('0x7f')](db[_0x7b5a('0x80')]['query'](_0x12825c));}return BPromise['all'](_0x2caf6b);}})[_0x7b5a('0x27')](function(){return _0x9572d5;})[_0x7b5a('0x27')](respondWithResult(_0x2593fe,null))['catch'](handleError(_0x2593fe,null));};exports[_0x7b5a('0x81')]=function(_0x40adde,_0x553464,_0x95bcd7){return db[_0x7b5a('0x41')][_0x7b5a('0x4b')]({'where':{'id':_0x40adde['params']['id']}})['then'](handleEntityNotFound(_0x553464,null))['then'](function(_0x26c571){if(_0x26c571){return _0x26c571[_0x7b5a('0x81')](_0x40adde[_0x7b5a('0x32')][_0x7b5a('0x65')]);}})[_0x7b5a('0x27')](function(_0x511ee9){if(_0x511ee9){return db[_0x7b5a('0x5c')][_0x7b5a('0x24')]({'where':{'ListId':_0x40adde[_0x7b5a('0x32')]['ids'],'CampaignId':_0x40adde[_0x7b5a('0x48')]['id']}})[_0x7b5a('0x27')](function(){return _0x511ee9;});}})[_0x7b5a('0x27')](respondWithStatusCode(_0x553464,null))[_0x7b5a('0x46')](handleError(_0x553464,null));};exports['getBlackLists']=function(_0x1ee95a,_0x27c4f6,_0x544fe5){var _0x53ea3c={};var _0x4ddbeb={};var _0x504776;var _0x156612;return db[_0x7b5a('0x41')][_0x7b5a('0x5b')]({'where':{'id':_0x1ee95a[_0x7b5a('0x48')]['id']}})[_0x7b5a('0x27')](handleEntityNotFound(_0x27c4f6,null))['then'](function(_0x5187b5){if(_0x5187b5){_0x504776=_0x5187b5;_0x4ddbeb[_0x7b5a('0x31')]=_['keys'](db[_0x7b5a('0x63')]['rawAttributes']);_0x4ddbeb[_0x7b5a('0x32')]=_[_0x7b5a('0x49')](_0x1ee95a['query']);_0x4ddbeb[_0x7b5a('0x33')]=_[_0x7b5a('0x4a')](_0x4ddbeb[_0x7b5a('0x31')],_0x4ddbeb[_0x7b5a('0x32')]);_0x53ea3c[_0x7b5a('0x34')]=_['intersection'](_0x4ddbeb[_0x7b5a('0x31')],qs[_0x7b5a('0x35')](_0x1ee95a[_0x7b5a('0x32')][_0x7b5a('0x35')]));_0x53ea3c[_0x7b5a('0x34')]=_0x53ea3c[_0x7b5a('0x34')]['length']?_0x53ea3c[_0x7b5a('0x34')]:_0x4ddbeb[_0x7b5a('0x31')];_0x53ea3c[_0x7b5a('0x39')]=qs[_0x7b5a('0x3a')](_0x1ee95a[_0x7b5a('0x32')][_0x7b5a('0x3a')]);_0x53ea3c[_0x7b5a('0x3b')]=qs[_0x7b5a('0x33')](_[_0x7b5a('0x3c')](_0x1ee95a[_0x7b5a('0x32')],_0x4ddbeb[_0x7b5a('0x33')]));if(_0x1ee95a[_0x7b5a('0x32')][_0x7b5a('0x3d')]){_0x53ea3c[_0x7b5a('0x3b')]=_[_0x7b5a('0x3e')](_0x53ea3c[_0x7b5a('0x3b')],{'$or':_[_0x7b5a('0x2d')](_0x53ea3c['attributes'],function(_0xf88893){var _0x2afb9d={};_0x2afb9d[_0xf88893]={'$like':'%'+_0x1ee95a[_0x7b5a('0x32')][_0x7b5a('0x3d')]+'%'};return _0x2afb9d;})});}_0x53ea3c=_['merge']({},_0x53ea3c,_0x1ee95a[_0x7b5a('0x40')]);return _0x504776[_0x7b5a('0x82')](_0x53ea3c);}})[_0x7b5a('0x27')](function(_0x3cbd53){if(_0x3cbd53){_0x156612=_0x3cbd53[_0x7b5a('0x56')];if(!_0x1ee95a[_0x7b5a('0x32')]['hasOwnProperty'](_0x7b5a('0x37'))){_0x53ea3c[_0x7b5a('0x38')]=qs['limit'](_0x1ee95a[_0x7b5a('0x32')]['limit']);_0x53ea3c[_0x7b5a('0x1c')]=qs[_0x7b5a('0x1c')](_0x1ee95a[_0x7b5a('0x32')][_0x7b5a('0x1c')]);}return _0x504776[_0x7b5a('0x82')](_0x53ea3c);}})['then'](function(_0x4b0266){if(_0x4b0266){return _0x4b0266?{'count':_0x156612,'rows':_0x4b0266}:null;}})[_0x7b5a('0x27')](respondWithResult(_0x27c4f6,null))[_0x7b5a('0x46')](handleError(_0x27c4f6,null));};exports[_0x7b5a('0x83')]=function(_0x5e1f40,_0x4bdd15,_0x14249b){var _0x5e1c03,_0x29c5f9;return db[_0x7b5a('0x41')]['find']({'where':{'id':_0x5e1f40[_0x7b5a('0x48')]['id']}})[_0x7b5a('0x27')](handleEntityNotFound(_0x4bdd15,null))['then'](function(_0x59580e){if(_0x59580e){_0x29c5f9=_0x59580e;return _0x59580e[_0x7b5a('0x83')](_0x5e1f40['body']['ids'],_['omit'](_0x5e1f40['body'],[_0x7b5a('0x65'),'id'])||{});}return null;})[_0x7b5a('0x66')](function(_0x27e78e){var _0x40a777;_0x5e1c03=_0x27e78e||[];var _0x308b52=[];if(_0x27e78e){for(var _0x2bef14=0x0;_0x2bef14<_0x27e78e['length'];_0x2bef14+=0x1){var _0xbc8970=_0x27e78e[_0x2bef14]['get']({'plain':!![]});_0x40a777=squel[_0x7b5a('0x7c')]()[_0x7b5a('0x69')](_0x7b5a('0x84'))[_0x7b5a('0x6a')]([_0x7b5a('0x6b'),_0x7b5a('0x6c'),_0x7b5a('0x6d'),_0x7b5a('0x5d'),_0x7b5a('0x59'),_0x7b5a('0x58')],squel[_0x7b5a('0x6e')]()[_0x7b5a('0x6f')](_0x7b5a('0x6b'),_0x7b5a('0x6b'))[_0x7b5a('0x6f')]('id',_0x7b5a('0x6c'))[_0x7b5a('0x6f')](_0xbc8970['CmListId'][_0x7b5a('0x73')](),_0x7b5a('0x6d'))[_0x7b5a('0x6f')](_0x5e1f40[_0x7b5a('0x48')]['id'][_0x7b5a('0x73')](),_0x7b5a('0x5d'))[_0x7b5a('0x6f')](_0x7b5a('0x70'),_0x7b5a('0x59'))[_0x7b5a('0x6f')](_0x7b5a('0x70'),_0x7b5a('0x58'))[_0x7b5a('0x74')](_0x7b5a('0x75'))[_0x7b5a('0x3b')](_0x7b5a('0x76'))['where'](_0x7b5a('0x77'),_0xbc8970['CmListId'][_0x7b5a('0x73')]())[_0x7b5a('0x3b')](_0x7b5a('0x7e')))[_0x7b5a('0x73')]();_0x308b52[_0x7b5a('0x7f')](db[_0x7b5a('0x80')]['query'](_0x40a777));}return BPromise[_0x7b5a('0x85')](_0x308b52);}})['then'](function(){return _0x5e1c03;})[_0x7b5a('0x27')](respondWithResult(_0x4bdd15,null))[_0x7b5a('0x46')](handleError(_0x4bdd15,null));};exports['removeBlackLists']=function(_0x48cd3c,_0x42df3e,_0x2b1a02){return db[_0x7b5a('0x41')][_0x7b5a('0x4b')]({'where':{'id':_0x48cd3c[_0x7b5a('0x48')]['id']}})['then'](handleEntityNotFound(_0x42df3e,null))[_0x7b5a('0x27')](function(_0x4e04cd){if(_0x4e04cd){return _0x4e04cd[_0x7b5a('0x86')](_0x48cd3c[_0x7b5a('0x32')]['ids']);}})[_0x7b5a('0x27')](function(_0x96f08d){if(_0x96f08d){return db[_0x7b5a('0x61')][_0x7b5a('0x24')]({'where':{'ListId':_0x48cd3c[_0x7b5a('0x32')][_0x7b5a('0x65')],'CampaignId':_0x48cd3c[_0x7b5a('0x48')]['id']}})['then'](function(){return _0x96f08d;});}})[_0x7b5a('0x27')](respondWithStatusCode(_0x42df3e,null))[_0x7b5a('0x46')](handleError(_0x42df3e,null));}; \ No newline at end of file +var _0x2c28=['fromQuery','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','NOW()','select','all','removeLists','getBlackLists','ids','push','sequelize','removeBlackLists','fast-json-patch','moment','bluebird','mustache','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','then','sendStatus','error','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','IvrCampaigns','getHoppers','findOne','CmHopper','CampaignId','filter','getHopperHistories','CmHopperHistory','sort','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','cm_hopper'];(function(_0x1d76c9,_0x51592f){var _0x52278f=function(_0x19b8b9){while(--_0x19b8b9){_0x1d76c9['push'](_0x1d76c9['shift']());}};_0x52278f(++_0x51592f);}(_0x2c28,0x12e));var _0x82c2=function(_0x2ec5b3,_0x43d52a){_0x2ec5b3=_0x2ec5b3-0x0;var _0x182a54=_0x2c28[_0x2ec5b3];return _0x182a54;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x82c2('0x0'));var rp=require('request-promise');var moment=require(_0x82c2('0x1'));var BPromise=require(_0x82c2('0x2'));var Mustache=require(_0x82c2('0x3'));var util=require('util');var path=require(_0x82c2('0x4'));var sox=require(_0x82c2('0x5'));var csv=require(_0x82c2('0x6'));var ejs=require(_0x82c2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82c2('0x8'));var squel=require(_0x82c2('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x82c2('0xa'));var toCsv=require(_0x82c2('0x6'));var querystring=require(_0x82c2('0xb'));var Papa=require(_0x82c2('0xc'));var Redis=require(_0x82c2('0xd'));var authService=require(_0x82c2('0xe'));var qs=require(_0x82c2('0xf'));var as=require(_0x82c2('0x10'));var hardwareService=require(_0x82c2('0x11'));var logger=require(_0x82c2('0x12'))(_0x82c2('0x13'));var utils=require(_0x82c2('0x14'));var config=require(_0x82c2('0x15'));var licenseUtil=require(_0x82c2('0x16'));var db=require(_0x82c2('0x17'))['db'];function respondWithStatusCode(_0x5a7157,_0x386b84){_0x386b84=_0x386b84||0xcc;return function(_0x21273f){if(_0x21273f){return _0x5a7157['sendStatus'](_0x386b84);}return _0x5a7157[_0x82c2('0x18')](_0x386b84)[_0x82c2('0x19')]();};}function respondWithResult(_0x6d2b08,_0x15a885){_0x15a885=_0x15a885||0xc8;return function(_0x4b6f0d){if(_0x4b6f0d){return _0x6d2b08['status'](_0x15a885)['json'](_0x4b6f0d);}};}function respondWithFilteredResult(_0x3e4851,_0x68bb36){return function(_0x32b9b1){if(_0x32b9b1){var _0x5aba1f=typeof _0x68bb36[_0x82c2('0x1a')]==='undefined'&&typeof _0x68bb36[_0x82c2('0x1b')]===_0x82c2('0x1c');var _0xe3ceac=_0x32b9b1[_0x82c2('0x1d')];var _0x4eefb8=_0x5aba1f?0x0:_0x68bb36[_0x82c2('0x1a')];var _0x4104cc=_0x5aba1f?_0x32b9b1[_0x82c2('0x1d')]:_0x68bb36[_0x82c2('0x1a')]+_0x68bb36['limit'];var _0x408d2c;if(_0x4104cc>=_0xe3ceac){_0x4104cc=_0xe3ceac;_0x408d2c=0xc8;}else{_0x408d2c=0xce;}_0x3e4851[_0x82c2('0x18')](_0x408d2c);return _0x3e4851[_0x82c2('0x1e')](_0x82c2('0x1f'),_0x4eefb8+'-'+_0x4104cc+'/'+_0xe3ceac)[_0x82c2('0x20')](_0x32b9b1);}return null;};}function patchUpdates(_0x31e82f){return function(_0x40c328){try{jsonpatch[_0x82c2('0x21')](_0x40c328,_0x31e82f,!![]);}catch(_0x999e6f){return BPromise[_0x82c2('0x22')](_0x999e6f);}return _0x40c328['save']();};}function saveUpdates(_0x1506a9,_0x17e310){return function(_0x57bb4d){if(_0x57bb4d){return _0x57bb4d[_0x82c2('0x23')](_0x1506a9)['then'](function(_0x9ce931){return _0x9ce931;});}return null;};}function removeEntity(_0x487dbb,_0x426492){return function(_0x23c875){if(_0x23c875){return _0x23c875[_0x82c2('0x24')]()[_0x82c2('0x25')](function(){var _0x38e116=_0x23c875['get']({'plain':!![]});var _0x3c1911='IvrCampaigns';return db['UserProfileResource'][_0x82c2('0x24')]({'where':{'type':_0x3c1911,'resourceId':_0x38e116['id']}})[_0x82c2('0x25')](function(){return _0x23c875;});})[_0x82c2('0x25')](function(){_0x487dbb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18610c,_0x58f760){return function(_0x16bc93){if(!_0x16bc93){_0x18610c[_0x82c2('0x26')](0x194);}return _0x16bc93;};}function handleError(_0x1d4eb7,_0x168f37){_0x168f37=_0x168f37||0x1f4;return function(_0x4dc1dd){logger[_0x82c2('0x27')](_0x4dc1dd['stack']);if(_0x4dc1dd[_0x82c2('0x28')]){delete _0x4dc1dd[_0x82c2('0x28')];}_0x1d4eb7[_0x82c2('0x18')](_0x168f37)[_0x82c2('0x29')](_0x4dc1dd);};}exports[_0x82c2('0x2a')]=function(_0x3c0c58,_0x2ad22e){var _0x4e5825={},_0x54a65e={},_0x33e8d6={'count':0x0,'rows':[]};var _0x41584d=_[_0x82c2('0x2b')](db[_0x82c2('0x2c')][_0x82c2('0x2d')],function(_0x369a72){return{'name':_0x369a72[_0x82c2('0x2e')],'type':_0x369a72[_0x82c2('0x2f')][_0x82c2('0x30')]};});_0x54a65e[_0x82c2('0x31')]=_[_0x82c2('0x2b')](_0x41584d,_0x82c2('0x28'));_0x54a65e[_0x82c2('0x32')]=_[_0x82c2('0x33')](_0x3c0c58['query']);_0x54a65e[_0x82c2('0x34')]=_['intersection'](_0x54a65e[_0x82c2('0x31')],_0x54a65e[_0x82c2('0x32')]);_0x4e5825[_0x82c2('0x35')]=_[_0x82c2('0x36')](_0x54a65e['model'],qs[_0x82c2('0x37')](_0x3c0c58[_0x82c2('0x32')][_0x82c2('0x37')]));_0x4e5825['attributes']=_0x4e5825[_0x82c2('0x35')][_0x82c2('0x38')]?_0x4e5825[_0x82c2('0x35')]:_0x54a65e[_0x82c2('0x31')];if(!_0x3c0c58[_0x82c2('0x32')][_0x82c2('0x39')](_0x82c2('0x3a'))){_0x4e5825[_0x82c2('0x1b')]=qs[_0x82c2('0x1b')](_0x3c0c58[_0x82c2('0x32')]['limit']);_0x4e5825['offset']=qs[_0x82c2('0x1a')](_0x3c0c58['query'][_0x82c2('0x1a')]);}_0x4e5825[_0x82c2('0x3b')]=qs['sort'](_0x3c0c58['query']['sort']);_0x4e5825[_0x82c2('0x3c')]=qs[_0x82c2('0x34')](_[_0x82c2('0x3d')](_0x3c0c58[_0x82c2('0x32')],_0x54a65e[_0x82c2('0x34')]),_0x41584d);if(_0x3c0c58[_0x82c2('0x32')]['filter']){_0x4e5825[_0x82c2('0x3c')]=_[_0x82c2('0x3e')](_0x4e5825[_0x82c2('0x3c')],{'$or':_['map'](_0x41584d,function(_0x140b9f){if(_0x140b9f['type']!==_0x82c2('0x3f')){var _0x1e1898={};_0x1e1898[_0x140b9f[_0x82c2('0x28')]]={'$like':'%'+_0x3c0c58[_0x82c2('0x32')]['filter']+'%'};return _0x1e1898;}})});}_0x4e5825=_[_0x82c2('0x3e')]({},_0x4e5825,_0x3c0c58[_0x82c2('0x40')]);var _0x396066={'where':_0x4e5825[_0x82c2('0x3c')]};return db[_0x82c2('0x2c')][_0x82c2('0x1d')](_0x396066)['then'](function(_0x4f19e7){_0x33e8d6[_0x82c2('0x1d')]=_0x4f19e7;if(_0x3c0c58[_0x82c2('0x32')][_0x82c2('0x41')]){_0x4e5825[_0x82c2('0x42')]=[{'all':!![]}];}return db[_0x82c2('0x2c')][_0x82c2('0x43')](_0x4e5825);})[_0x82c2('0x25')](function(_0x392cf8){_0x33e8d6[_0x82c2('0x44')]=_0x392cf8;return _0x33e8d6;})['then'](respondWithFilteredResult(_0x2ad22e,_0x4e5825))[_0x82c2('0x45')](handleError(_0x2ad22e,null));};exports[_0x82c2('0x46')]=function(_0x26bbd0,_0x321a80){var _0xe55b3c={'raw':![],'where':{'id':_0x26bbd0[_0x82c2('0x47')]['id']}},_0xaded8f={};_0xaded8f[_0x82c2('0x31')]=_[_0x82c2('0x33')](db[_0x82c2('0x2c')]['rawAttributes']);_0xaded8f[_0x82c2('0x32')]=_[_0x82c2('0x33')](_0x26bbd0[_0x82c2('0x32')]);_0xaded8f['filters']=_['intersection'](_0xaded8f[_0x82c2('0x31')],_0xaded8f['query']);_0xe55b3c[_0x82c2('0x35')]=_[_0x82c2('0x36')](_0xaded8f[_0x82c2('0x31')],qs['fields'](_0x26bbd0[_0x82c2('0x32')][_0x82c2('0x37')]));_0xe55b3c[_0x82c2('0x35')]=_0xe55b3c[_0x82c2('0x35')][_0x82c2('0x38')]?_0xe55b3c['attributes']:_0xaded8f[_0x82c2('0x31')];if(_0x26bbd0[_0x82c2('0x32')][_0x82c2('0x41')]){_0xe55b3c[_0x82c2('0x42')]=[{'all':!![]}];}_0xe55b3c=_[_0x82c2('0x3e')]({},_0xe55b3c,_0x26bbd0[_0x82c2('0x40')]);return db[_0x82c2('0x2c')]['find'](_0xe55b3c)['then'](handleEntityNotFound(_0x321a80,null))['then'](respondWithResult(_0x321a80,null))[_0x82c2('0x45')](handleError(_0x321a80,null));};exports[_0x82c2('0x48')]=function(_0x209b90,_0x29c9fe){return db['Campaign'][_0x82c2('0x48')](_0x209b90[_0x82c2('0x49')],{})[_0x82c2('0x25')](function(_0x4ce7aa){var _0x5b52aa=_0x209b90[_0x82c2('0x4a')][_0x82c2('0x4b')]({'plain':!![]});if(!_0x5b52aa)throw new Error(_0x82c2('0x4c'));if(_0x5b52aa[_0x82c2('0x4d')]===_0x82c2('0x4a')){var _0x15879d=_0x4ce7aa[_0x82c2('0x4b')]({'plain':!![]});var _0x24c5d5='IvrCampaigns';return db[_0x82c2('0x4e')]['find']({'where':{'name':_0x24c5d5,'userProfileId':_0x5b52aa[_0x82c2('0x4f')]},'raw':!![]})['then'](function(_0x3f9dca){if(_0x3f9dca&&_0x3f9dca[_0x82c2('0x50')]===0x0){return db[_0x82c2('0x51')][_0x82c2('0x48')]({'name':_0x15879d['name'],'resourceId':_0x15879d['id'],'type':_0x3f9dca[_0x82c2('0x28')],'sectionId':_0x3f9dca['id']},{})[_0x82c2('0x25')](function(){return _0x4ce7aa;});}else{return _0x4ce7aa;}})[_0x82c2('0x45')](function(_0xb207e7){logger['error'](_0x82c2('0x52'),_0xb207e7);throw _0xb207e7;});}return _0x4ce7aa;})['then'](respondWithResult(_0x29c9fe,0xc9))['catch'](handleError(_0x29c9fe,null));};exports[_0x82c2('0x53')]=function(_0x5a63f3,_0x32dbe8){var _0x5d09f8={'where':{'id':_0x5a63f3[_0x82c2('0x47')]['id']}},_0x2b57a8={};_0x2b57a8['model']=_[_0x82c2('0x33')](db[_0x82c2('0x2c')]['rawAttributes']);_0x5d09f8[_0x82c2('0x35')]=_['intersection'](_0x2b57a8[_0x82c2('0x31')],qs[_0x82c2('0x37')](_0x5a63f3[_0x82c2('0x32')][_0x82c2('0x37')]));_0x5d09f8['attributes']=_0x5d09f8[_0x82c2('0x35')][_0x82c2('0x38')]?_0x5d09f8[_0x82c2('0x35')]:_0x2b57a8['model'];if(_0x5a63f3[_0x82c2('0x32')]['includeAll']){_0x5d09f8[_0x82c2('0x42')]=[{'all':!![]}];}_0x5d09f8=_[_0x82c2('0x3e')]({},_0x5d09f8,_0x5a63f3['options']);return db[_0x82c2('0x2c')][_0x82c2('0x54')](_0x5d09f8)[_0x82c2('0x25')](handleEntityNotFound(_0x32dbe8,null))[_0x82c2('0x25')](function(_0x4c2920){if(_0x4c2920){var _0x5c7254=_0x4c2920[_0x82c2('0x4b')]({'plain':!![]});_0x5c7254=qs[_0x82c2('0x55')](_0x5c7254,['id',_0x82c2('0x56'),_0x82c2('0x57')]);_0x5a63f3[_0x82c2('0x49')]=_[_0x82c2('0x55')](_0x5a63f3[_0x82c2('0x49')],['id',_0x82c2('0x56'),_0x82c2('0x57')]);return db[_0x82c2('0x2c')]['create'](_[_0x82c2('0x3e')](_0x5c7254,_0x5a63f3[_0x82c2('0x49')]),{'include':_0x5a63f3[_0x82c2('0x32')][_0x82c2('0x41')]?[{'all':!![]}]:undefined})[_0x82c2('0x25')](function(_0x3008ad){var _0x5bb472=_0x5a63f3[_0x82c2('0x4a')]['get']({'plain':!![]});if(!_0x5bb472)throw new Error(_0x82c2('0x4c'));if(_0x5bb472[_0x82c2('0x4d')]===_0x82c2('0x4a')){var _0x3bf3be=_0x3008ad[_0x82c2('0x4b')]({'plain':!![]});var _0x40639b=_0x82c2('0x58');return db['UserProfileSection'][_0x82c2('0x54')]({'where':{'name':_0x40639b,'userProfileId':_0x5bb472['userProfileId']},'raw':!![]})['then'](function(_0x1d5c0a){if(_0x1d5c0a&&_0x1d5c0a[_0x82c2('0x50')]===0x0){return db[_0x82c2('0x51')][_0x82c2('0x48')]({'name':_0x3bf3be['name'],'resourceId':_0x3bf3be['id'],'type':_0x1d5c0a[_0x82c2('0x28')],'sectionId':_0x1d5c0a['id']},{})[_0x82c2('0x25')](function(){return _0x3008ad;});}else{return _0x3008ad;}})[_0x82c2('0x45')](function(_0xccaf79){logger[_0x82c2('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xccaf79);throw _0xccaf79;});}return _0x3008ad;});}})[_0x82c2('0x25')](respondWithResult(_0x32dbe8,0xc9))[_0x82c2('0x45')](handleError(_0x32dbe8,null));};exports[_0x82c2('0x23')]=function(_0x2e6386,_0x31a921){if(_0x2e6386[_0x82c2('0x49')]['id']){delete _0x2e6386[_0x82c2('0x49')]['id'];}return db[_0x82c2('0x2c')][_0x82c2('0x54')]({'where':{'id':_0x2e6386[_0x82c2('0x47')]['id']}})['then'](handleEntityNotFound(_0x31a921,null))['then'](saveUpdates(_0x2e6386[_0x82c2('0x49')],null))[_0x82c2('0x25')](respondWithResult(_0x31a921,null))[_0x82c2('0x45')](handleError(_0x31a921,null));};exports['destroy']=function(_0x34eef5,_0x201f6b){return db[_0x82c2('0x2c')]['find']({'where':{'id':_0x34eef5[_0x82c2('0x47')]['id']}})['then'](handleEntityNotFound(_0x201f6b,null))['then'](removeEntity(_0x201f6b,null))[_0x82c2('0x45')](handleError(_0x201f6b,null));};exports[_0x82c2('0x59')]=function(_0x1caf9e,_0x5a09f8,_0x55e48f){var _0x42a9bc={'raw':!![],'where':{}};var _0x376a74={};var _0x48bb0e={'count':0x0,'rows':[]};return db[_0x82c2('0x2c')][_0x82c2('0x5a')]({'where':{'id':_0x1caf9e['params']['id']}})[_0x82c2('0x25')](handleEntityNotFound(_0x5a09f8,null))[_0x82c2('0x25')](function(_0x9ae841){if(_0x9ae841){_0x376a74[_0x82c2('0x31')]=_[_0x82c2('0x33')](db[_0x82c2('0x5b')]['rawAttributes']);_0x376a74[_0x82c2('0x32')]=_[_0x82c2('0x33')](_0x1caf9e[_0x82c2('0x32')]);_0x376a74[_0x82c2('0x34')]=_['intersection'](_0x376a74[_0x82c2('0x31')],_0x376a74['query']);_0x42a9bc[_0x82c2('0x35')]=_[_0x82c2('0x36')](_0x376a74[_0x82c2('0x31')],qs[_0x82c2('0x37')](_0x1caf9e[_0x82c2('0x32')][_0x82c2('0x37')]));_0x42a9bc[_0x82c2('0x35')]=_0x42a9bc[_0x82c2('0x35')][_0x82c2('0x38')]?_0x42a9bc[_0x82c2('0x35')]:_0x376a74[_0x82c2('0x31')];if(!_0x1caf9e['query']['hasOwnProperty'](_0x82c2('0x3a'))){_0x42a9bc['limit']=qs[_0x82c2('0x1b')](_0x1caf9e[_0x82c2('0x32')]['limit']);_0x42a9bc[_0x82c2('0x1a')]=qs[_0x82c2('0x1a')](_0x1caf9e[_0x82c2('0x32')]['offset']);}_0x42a9bc[_0x82c2('0x3b')]=qs['sort'](_0x1caf9e[_0x82c2('0x32')]['sort']);_0x42a9bc[_0x82c2('0x3c')]=qs['filters'](_['pick'](_0x1caf9e[_0x82c2('0x32')],_0x376a74['filters']));_0x42a9bc[_0x82c2('0x3c')][_0x82c2('0x5c')]=_0x9ae841['id'];if(_0x1caf9e[_0x82c2('0x32')][_0x82c2('0x5d')]){_0x42a9bc[_0x82c2('0x3c')]=_[_0x82c2('0x3e')](_0x42a9bc[_0x82c2('0x3c')],{'$or':_[_0x82c2('0x2b')](_0x42a9bc[_0x82c2('0x35')],function(_0xec74e9){var _0xc72865={};_0xc72865[_0xec74e9]={'$like':'%'+_0x1caf9e[_0x82c2('0x32')]['filter']+'%'};return _0xc72865;})});}_0x42a9bc=_[_0x82c2('0x3e')]({},_0x42a9bc,_0x1caf9e[_0x82c2('0x40')]);return db['CmHopper']['count']({'where':_0x42a9bc[_0x82c2('0x3c')]})[_0x82c2('0x25')](function(_0x2713f7){_0x48bb0e[_0x82c2('0x1d')]=_0x2713f7;if(_0x1caf9e[_0x82c2('0x32')][_0x82c2('0x41')]){_0x42a9bc[_0x82c2('0x42')]=[{'all':!![]}];}return db[_0x82c2('0x5b')][_0x82c2('0x43')](_0x42a9bc);})[_0x82c2('0x25')](function(_0x46ac86){_0x48bb0e[_0x82c2('0x44')]=_0x46ac86;return _0x48bb0e;});}})[_0x82c2('0x25')](respondWithFilteredResult(_0x5a09f8,_0x42a9bc))[_0x82c2('0x45')](handleError(_0x5a09f8,null));};exports[_0x82c2('0x5e')]=function(_0x537914,_0x91699,_0xe341d0){var _0x46e141={'raw':!![],'where':{}};var _0x4809aa={};var _0x499804={'count':0x0,'rows':[]};return db[_0x82c2('0x2c')]['findOne']({'where':{'id':_0x537914['params']['id']}})[_0x82c2('0x25')](handleEntityNotFound(_0x91699,null))[_0x82c2('0x25')](function(_0x2ee2bd){if(_0x2ee2bd){_0x4809aa['model']=_['keys'](db[_0x82c2('0x5f')][_0x82c2('0x2d')]);_0x4809aa[_0x82c2('0x32')]=_[_0x82c2('0x33')](_0x537914[_0x82c2('0x32')]);_0x4809aa[_0x82c2('0x34')]=_[_0x82c2('0x36')](_0x4809aa['model'],_0x4809aa['query']);_0x46e141[_0x82c2('0x35')]=_[_0x82c2('0x36')](_0x4809aa['model'],qs[_0x82c2('0x37')](_0x537914[_0x82c2('0x32')][_0x82c2('0x37')]));_0x46e141['attributes']=_0x46e141[_0x82c2('0x35')][_0x82c2('0x38')]?_0x46e141['attributes']:_0x4809aa['model'];if(!_0x537914['query']['hasOwnProperty']('nolimit')){_0x46e141[_0x82c2('0x1b')]=qs[_0x82c2('0x1b')](_0x537914[_0x82c2('0x32')][_0x82c2('0x1b')]);_0x46e141['offset']=qs[_0x82c2('0x1a')](_0x537914[_0x82c2('0x32')][_0x82c2('0x1a')]);}_0x46e141[_0x82c2('0x3b')]=qs['sort'](_0x537914[_0x82c2('0x32')][_0x82c2('0x60')]);_0x46e141[_0x82c2('0x3c')]=qs[_0x82c2('0x34')](_[_0x82c2('0x3d')](_0x537914[_0x82c2('0x32')],_0x4809aa['filters']));_0x46e141[_0x82c2('0x3c')]['CampaignId']=_0x2ee2bd['id'];if(_0x537914[_0x82c2('0x32')][_0x82c2('0x5d')]){_0x46e141['where']=_[_0x82c2('0x3e')](_0x46e141[_0x82c2('0x3c')],{'$or':_[_0x82c2('0x2b')](_0x46e141[_0x82c2('0x35')],function(_0x553c80){var _0x37e866={};_0x37e866[_0x553c80]={'$like':'%'+_0x537914[_0x82c2('0x32')][_0x82c2('0x5d')]+'%'};return _0x37e866;})});}_0x46e141=_[_0x82c2('0x3e')]({},_0x46e141,_0x537914[_0x82c2('0x40')]);return db[_0x82c2('0x5f')]['count']({'where':_0x46e141['where']})[_0x82c2('0x25')](function(_0x57d589){_0x499804[_0x82c2('0x1d')]=_0x57d589;if(_0x537914[_0x82c2('0x32')]['includeAll']){_0x46e141[_0x82c2('0x42')]=[{'all':!![]}];}return db[_0x82c2('0x5f')][_0x82c2('0x43')](_0x46e141);})[_0x82c2('0x25')](function(_0x41f02b){_0x499804[_0x82c2('0x44')]=_0x41f02b;return _0x499804;});}})[_0x82c2('0x25')](respondWithFilteredResult(_0x91699,_0x46e141))['catch'](handleError(_0x91699,null));};exports[_0x82c2('0x61')]=function(_0xf8cab4,_0xba4db5,_0x46752c){var _0x3e41af={'raw':!![],'where':{}};var _0x124723={};var _0xf85f1d={'count':0x0,'rows':[]};return db[_0x82c2('0x2c')][_0x82c2('0x5a')]({'where':{'id':_0xf8cab4[_0x82c2('0x47')]['id']}})[_0x82c2('0x25')](handleEntityNotFound(_0xba4db5,null))[_0x82c2('0x25')](function(_0x5e3637){if(_0x5e3637){_0x124723[_0x82c2('0x31')]=_['keys'](db[_0x82c2('0x62')][_0x82c2('0x2d')]);_0x124723[_0x82c2('0x32')]=_[_0x82c2('0x33')](_0xf8cab4[_0x82c2('0x32')]);_0x124723[_0x82c2('0x34')]=_['intersection'](_0x124723[_0x82c2('0x31')],_0x124723['query']);_0x3e41af[_0x82c2('0x35')]=_[_0x82c2('0x36')](_0x124723[_0x82c2('0x31')],qs[_0x82c2('0x37')](_0xf8cab4[_0x82c2('0x32')][_0x82c2('0x37')]));_0x3e41af['attributes']=_0x3e41af[_0x82c2('0x35')][_0x82c2('0x38')]?_0x3e41af[_0x82c2('0x35')]:_0x124723[_0x82c2('0x31')];if(!_0xf8cab4['query'][_0x82c2('0x39')](_0x82c2('0x3a'))){_0x3e41af[_0x82c2('0x1b')]=qs['limit'](_0xf8cab4[_0x82c2('0x32')][_0x82c2('0x1b')]);_0x3e41af[_0x82c2('0x1a')]=qs[_0x82c2('0x1a')](_0xf8cab4['query']['offset']);}_0x3e41af[_0x82c2('0x3b')]=qs[_0x82c2('0x60')](_0xf8cab4[_0x82c2('0x32')][_0x82c2('0x60')]);_0x3e41af[_0x82c2('0x3c')]=qs['filters'](_[_0x82c2('0x3d')](_0xf8cab4['query'],_0x124723[_0x82c2('0x34')]));_0x3e41af[_0x82c2('0x3c')]['CampaignId']=_0x5e3637['id'];if(_0xf8cab4['query']['filter']){_0x3e41af[_0x82c2('0x3c')]=_['merge'](_0x3e41af[_0x82c2('0x3c')],{'$or':_[_0x82c2('0x2b')](_0x3e41af[_0x82c2('0x35')],function(_0x15c674){var _0x152907={};_0x152907[_0x15c674]={'$like':'%'+_0xf8cab4[_0x82c2('0x32')][_0x82c2('0x5d')]+'%'};return _0x152907;})});}_0x3e41af=_[_0x82c2('0x3e')]({},_0x3e41af,_0xf8cab4[_0x82c2('0x40')]);return db[_0x82c2('0x62')][_0x82c2('0x1d')]({'where':_0x3e41af[_0x82c2('0x3c')]})[_0x82c2('0x25')](function(_0x585712){_0xf85f1d['count']=_0x585712;if(_0xf8cab4[_0x82c2('0x32')][_0x82c2('0x41')]){_0x3e41af[_0x82c2('0x42')]=[{'all':!![]}];}return db[_0x82c2('0x62')][_0x82c2('0x43')](_0x3e41af);})[_0x82c2('0x25')](function(_0x13ad4b){_0xf85f1d[_0x82c2('0x44')]=_0x13ad4b;return _0xf85f1d;});}})[_0x82c2('0x25')](respondWithFilteredResult(_0xba4db5,_0x3e41af))['catch'](handleError(_0xba4db5,null));};exports[_0x82c2('0x63')]=function(_0x165e17,_0x473660,_0x5a5afe){var _0x5d0dcf={'raw':!![],'where':{}};var _0x18c91e={};var _0x4a7315={'count':0x0,'rows':[]};return db['Campaign'][_0x82c2('0x5a')]({'where':{'id':_0x165e17['params']['id']}})[_0x82c2('0x25')](handleEntityNotFound(_0x473660,null))['then'](function(_0x37da0a){if(_0x37da0a){_0x18c91e['model']=_[_0x82c2('0x33')](db[_0x82c2('0x64')]['rawAttributes']);_0x18c91e[_0x82c2('0x32')]=_[_0x82c2('0x33')](_0x165e17[_0x82c2('0x32')]);_0x18c91e['filters']=_['intersection'](_0x18c91e['model'],_0x18c91e[_0x82c2('0x32')]);_0x5d0dcf[_0x82c2('0x35')]=_[_0x82c2('0x36')](_0x18c91e[_0x82c2('0x31')],qs[_0x82c2('0x37')](_0x165e17[_0x82c2('0x32')]['fields']));_0x5d0dcf[_0x82c2('0x35')]=_0x5d0dcf['attributes']['length']?_0x5d0dcf[_0x82c2('0x35')]:_0x18c91e['model'];if(!_0x165e17[_0x82c2('0x32')][_0x82c2('0x39')](_0x82c2('0x3a'))){_0x5d0dcf[_0x82c2('0x1b')]=qs[_0x82c2('0x1b')](_0x165e17[_0x82c2('0x32')]['limit']);_0x5d0dcf['offset']=qs[_0x82c2('0x1a')](_0x165e17[_0x82c2('0x32')][_0x82c2('0x1a')]);}_0x5d0dcf['order']=qs[_0x82c2('0x60')](_0x165e17[_0x82c2('0x32')][_0x82c2('0x60')]);_0x5d0dcf[_0x82c2('0x3c')]=qs[_0x82c2('0x34')](_[_0x82c2('0x3d')](_0x165e17[_0x82c2('0x32')],_0x18c91e[_0x82c2('0x34')]));_0x5d0dcf[_0x82c2('0x3c')]['CampaignId']=_0x37da0a['id'];if(_0x165e17['query'][_0x82c2('0x5d')]){_0x5d0dcf['where']=_[_0x82c2('0x3e')](_0x5d0dcf[_0x82c2('0x3c')],{'$or':_[_0x82c2('0x2b')](_0x5d0dcf[_0x82c2('0x35')],function(_0x11b785){var _0x49642e={};_0x49642e[_0x11b785]={'$like':'%'+_0x165e17[_0x82c2('0x32')][_0x82c2('0x5d')]+'%'};return _0x49642e;})});}_0x5d0dcf=_[_0x82c2('0x3e')]({},_0x5d0dcf,_0x165e17['options']);return db[_0x82c2('0x64')][_0x82c2('0x1d')]({'where':_0x5d0dcf['where']})[_0x82c2('0x25')](function(_0x32b653){_0x4a7315[_0x82c2('0x1d')]=_0x32b653;if(_0x165e17[_0x82c2('0x32')][_0x82c2('0x41')]){_0x5d0dcf[_0x82c2('0x42')]=[{'all':!![]}];}return db[_0x82c2('0x64')][_0x82c2('0x43')](_0x5d0dcf);})[_0x82c2('0x25')](function(_0x26398d){_0x4a7315['rows']=_0x26398d;return _0x4a7315;});}})[_0x82c2('0x25')](respondWithFilteredResult(_0x473660,_0x5d0dcf))[_0x82c2('0x45')](handleError(_0x473660,null));};exports[_0x82c2('0x65')]=function(_0x339fef,_0x351818,_0x3309cf){var _0x5436ac={};var _0x32f6b8={};var _0x138764;var _0x208f6c;return db[_0x82c2('0x2c')]['findOne']({'where':{'id':_0x339fef[_0x82c2('0x47')]['id']}})[_0x82c2('0x25')](handleEntityNotFound(_0x351818,null))[_0x82c2('0x25')](function(_0x277e09){if(_0x277e09){_0x138764=_0x277e09;_0x32f6b8[_0x82c2('0x31')]=_[_0x82c2('0x33')](db[_0x82c2('0x66')][_0x82c2('0x2d')]);_0x32f6b8[_0x82c2('0x32')]=_[_0x82c2('0x33')](_0x339fef['query']);_0x32f6b8[_0x82c2('0x34')]=_[_0x82c2('0x36')](_0x32f6b8[_0x82c2('0x31')],_0x32f6b8['query']);_0x5436ac[_0x82c2('0x35')]=_[_0x82c2('0x36')](_0x32f6b8['model'],qs[_0x82c2('0x37')](_0x339fef[_0x82c2('0x32')][_0x82c2('0x37')]));_0x5436ac[_0x82c2('0x35')]=_0x5436ac['attributes'][_0x82c2('0x38')]?_0x5436ac['attributes']:_0x32f6b8['model'];_0x5436ac[_0x82c2('0x3b')]=qs[_0x82c2('0x60')](_0x339fef[_0x82c2('0x32')]['sort']);_0x5436ac[_0x82c2('0x3c')]=qs[_0x82c2('0x34')](_[_0x82c2('0x3d')](_0x339fef['query'],_0x32f6b8[_0x82c2('0x34')]));if(_0x339fef['query'][_0x82c2('0x5d')]){_0x5436ac[_0x82c2('0x3c')]=_['merge'](_0x5436ac[_0x82c2('0x3c')],{'$or':_[_0x82c2('0x2b')](_0x5436ac[_0x82c2('0x35')],function(_0x252245){var _0x1e9bf9={};_0x1e9bf9[_0x252245]={'$like':'%'+_0x339fef[_0x82c2('0x32')][_0x82c2('0x5d')]+'%'};return _0x1e9bf9;})});}_0x5436ac=_[_0x82c2('0x3e')]({},_0x5436ac,_0x339fef[_0x82c2('0x40')]);return _0x138764[_0x82c2('0x65')](_0x5436ac);}})[_0x82c2('0x25')](function(_0x4ffbf8){if(_0x4ffbf8){_0x208f6c=_0x4ffbf8[_0x82c2('0x38')];if(!_0x339fef[_0x82c2('0x32')][_0x82c2('0x39')](_0x82c2('0x3a'))){_0x5436ac['limit']=qs[_0x82c2('0x1b')](_0x339fef[_0x82c2('0x32')][_0x82c2('0x1b')]);_0x5436ac[_0x82c2('0x1a')]=qs[_0x82c2('0x1a')](_0x339fef[_0x82c2('0x32')]['offset']);}return _0x138764[_0x82c2('0x65')](_0x5436ac);}})[_0x82c2('0x25')](function(_0x145669){if(_0x145669){return _0x145669?{'count':_0x208f6c,'rows':_0x145669}:null;}})[_0x82c2('0x25')](respondWithResult(_0x351818,null))[_0x82c2('0x45')](handleError(_0x351818,null));};exports[_0x82c2('0x67')]=function(_0x2d9d74,_0x2a9636,_0x5bde5f){var _0x3643d1,_0x2348d7;return db[_0x82c2('0x2c')][_0x82c2('0x54')]({'where':{'id':_0x2d9d74['params']['id']}})['then'](handleEntityNotFound(_0x2a9636,null))[_0x82c2('0x25')](function(_0x2ec5ab){if(_0x2ec5ab){_0x2348d7=_0x2ec5ab;return _0x2ec5ab['addLists'](_0x2d9d74[_0x82c2('0x49')]['ids'],_[_0x82c2('0x55')](_0x2d9d74['body'],['ids','id'])||{});}return null;})[_0x82c2('0x68')](function(_0x387666){var _0x14d9b7;_0x3643d1=_0x387666||[];var _0x3cde40=[];if(_0x387666){for(var _0x447074=0x0;_0x447074<_0x387666[_0x82c2('0x38')];_0x447074+=0x1){var _0x508296=_0x387666[_0x447074][_0x82c2('0x4b')]({'plain':!![]});_0x2348d7[_0x82c2('0x69')]=_0x2d9d74['body'][_0x82c2('0x69')]?_0x2d9d74[_0x82c2('0x49')]['dialCheckDuplicateType']:_0x2348d7[_0x82c2('0x69')];switch(_0x2348d7[_0x82c2('0x69')]){case _0x82c2('0x6a'):_0x14d9b7=squel[_0x82c2('0x6b')]()['into'](_0x82c2('0x6c'))[_0x82c2('0x6d')]([_0x82c2('0x6e'),_0x82c2('0x6f'),_0x82c2('0x70'),_0x82c2('0x71'),'CampaignId','createdAt',_0x82c2('0x57')],squel['select']()['field'](_0x82c2('0x6e'),'phone')[_0x82c2('0x72')]('NOW()',_0x82c2('0x6f'))[_0x82c2('0x72')]('id','ContactId')[_0x82c2('0x72')](_0x508296[_0x82c2('0x73')][_0x82c2('0x74')](),_0x82c2('0x71'))[_0x82c2('0x72')](_0x2d9d74[_0x82c2('0x47')]['id'][_0x82c2('0x74')](),_0x82c2('0x5c'))[_0x82c2('0x72')]('NOW()',_0x82c2('0x56'))[_0x82c2('0x72')]('NOW()','updatedAt')[_0x82c2('0x75')](_0x82c2('0x76'))['where'](_0x82c2('0x77'))[_0x82c2('0x3c')](_0x82c2('0x78'),_0x508296['CmListId'][_0x82c2('0x74')]())[_0x82c2('0x3c')](_0x82c2('0x79'))[_0x82c2('0x3c')](_0x82c2('0x7a'),squel['select']()[_0x82c2('0x72')]('COALESCE(calleridnum,\x27\x27)')[_0x82c2('0x75')](_0x82c2('0x7b'))['where'](_0x82c2('0x7c'),_0x2d9d74['params']['id'][_0x82c2('0x74')]()))[_0x82c2('0x3c')](_0x82c2('0x7a'),squel['select']()[_0x82c2('0x72')](_0x82c2('0x7d'))[_0x82c2('0x75')](_0x82c2('0x6c'))[_0x82c2('0x3c')]('CampaignId\x20=\x20?',_0x2d9d74[_0x82c2('0x47')]['id'][_0x82c2('0x74')]())))[_0x82c2('0x74')]();break;case _0x82c2('0x7e'):_0x14d9b7=squel[_0x82c2('0x6b')]()[_0x82c2('0x7f')](_0x82c2('0x6c'))['fromQuery']([_0x82c2('0x6e'),_0x82c2('0x6f'),_0x82c2('0x70'),'ListId','CampaignId',_0x82c2('0x56'),'updatedAt'],squel['select']()[_0x82c2('0x72')]('phone','phone')[_0x82c2('0x72')](_0x82c2('0x80'),_0x82c2('0x6f'))['field']('id','ContactId')[_0x82c2('0x72')](_0x508296[_0x82c2('0x73')]['toString'](),_0x82c2('0x71'))[_0x82c2('0x72')](_0x2d9d74[_0x82c2('0x47')]['id']['toString'](),_0x82c2('0x5c'))[_0x82c2('0x72')](_0x82c2('0x80'),_0x82c2('0x56'))['field'](_0x82c2('0x80'),_0x82c2('0x57'))[_0x82c2('0x75')](_0x82c2('0x76'))[_0x82c2('0x3c')](_0x82c2('0x77'))[_0x82c2('0x3c')](_0x82c2('0x78'),_0x508296['CmListId']['toString']())[_0x82c2('0x3c')](_0x82c2('0x79'))[_0x82c2('0x3c')](_0x82c2('0x7a'),squel[_0x82c2('0x81')]()[_0x82c2('0x72')](_0x82c2('0x7d'))['from'](_0x82c2('0x6c'))['where']('CampaignId\x20=\x20?',_0x2d9d74[_0x82c2('0x47')]['id'][_0x82c2('0x74')]())))['toString']();break;default:_0x14d9b7=squel[_0x82c2('0x6b')]()[_0x82c2('0x7f')]('cm_hopper')[_0x82c2('0x6d')]([_0x82c2('0x6e'),_0x82c2('0x6f'),_0x82c2('0x70'),_0x82c2('0x71'),_0x82c2('0x5c'),_0x82c2('0x56'),'updatedAt'],squel[_0x82c2('0x81')]()[_0x82c2('0x72')](_0x82c2('0x6e'),_0x82c2('0x6e'))[_0x82c2('0x72')]('NOW()',_0x82c2('0x6f'))[_0x82c2('0x72')]('id',_0x82c2('0x70'))[_0x82c2('0x72')](_0x508296['CmListId'][_0x82c2('0x74')](),_0x82c2('0x71'))[_0x82c2('0x72')](_0x2d9d74[_0x82c2('0x47')]['id']['toString'](),_0x82c2('0x5c'))['field'](_0x82c2('0x80'),'createdAt')[_0x82c2('0x72')]('NOW()',_0x82c2('0x57'))[_0x82c2('0x75')]('cm_contacts')[_0x82c2('0x3c')](_0x82c2('0x77'))[_0x82c2('0x3c')](_0x82c2('0x78'),_0x508296[_0x82c2('0x73')]['toString']())[_0x82c2('0x3c')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x3cde40['push'](db['sequelize'][_0x82c2('0x32')](_0x14d9b7));}return BPromise[_0x82c2('0x82')](_0x3cde40);}})[_0x82c2('0x25')](function(){return _0x3643d1;})[_0x82c2('0x25')](respondWithResult(_0x2a9636,null))[_0x82c2('0x45')](handleError(_0x2a9636,null));};exports['removeLists']=function(_0x1d7e1e,_0x359d9a,_0x490e63){return db[_0x82c2('0x2c')][_0x82c2('0x54')]({'where':{'id':_0x1d7e1e[_0x82c2('0x47')]['id']}})[_0x82c2('0x25')](handleEntityNotFound(_0x359d9a,null))[_0x82c2('0x25')](function(_0xeacab3){if(_0xeacab3){return _0xeacab3[_0x82c2('0x83')](_0x1d7e1e[_0x82c2('0x32')]['ids']);}})[_0x82c2('0x25')](function(_0x77dd0b){if(_0x77dd0b){return db[_0x82c2('0x5b')][_0x82c2('0x24')]({'where':{'ListId':_0x1d7e1e[_0x82c2('0x32')]['ids'],'CampaignId':_0x1d7e1e[_0x82c2('0x47')]['id']}})[_0x82c2('0x25')](function(){return _0x77dd0b;});}})[_0x82c2('0x25')](respondWithStatusCode(_0x359d9a,null))['catch'](handleError(_0x359d9a,null));};exports['getBlackLists']=function(_0x215b9e,_0x134082,_0x5b067b){var _0x14158e={};var _0x4c7ee0={};var _0x2b27df;var _0x345650;return db[_0x82c2('0x2c')][_0x82c2('0x5a')]({'where':{'id':_0x215b9e[_0x82c2('0x47')]['id']}})[_0x82c2('0x25')](handleEntityNotFound(_0x134082,null))[_0x82c2('0x25')](function(_0xf4f4e3){if(_0xf4f4e3){_0x2b27df=_0xf4f4e3;_0x4c7ee0[_0x82c2('0x31')]=_[_0x82c2('0x33')](db[_0x82c2('0x66')][_0x82c2('0x2d')]);_0x4c7ee0[_0x82c2('0x32')]=_[_0x82c2('0x33')](_0x215b9e[_0x82c2('0x32')]);_0x4c7ee0['filters']=_['intersection'](_0x4c7ee0[_0x82c2('0x31')],_0x4c7ee0[_0x82c2('0x32')]);_0x14158e['attributes']=_['intersection'](_0x4c7ee0[_0x82c2('0x31')],qs[_0x82c2('0x37')](_0x215b9e['query'][_0x82c2('0x37')]));_0x14158e[_0x82c2('0x35')]=_0x14158e[_0x82c2('0x35')][_0x82c2('0x38')]?_0x14158e[_0x82c2('0x35')]:_0x4c7ee0[_0x82c2('0x31')];_0x14158e[_0x82c2('0x3b')]=qs[_0x82c2('0x60')](_0x215b9e[_0x82c2('0x32')][_0x82c2('0x60')]);_0x14158e[_0x82c2('0x3c')]=qs[_0x82c2('0x34')](_[_0x82c2('0x3d')](_0x215b9e[_0x82c2('0x32')],_0x4c7ee0[_0x82c2('0x34')]));if(_0x215b9e[_0x82c2('0x32')][_0x82c2('0x5d')]){_0x14158e['where']=_[_0x82c2('0x3e')](_0x14158e['where'],{'$or':_[_0x82c2('0x2b')](_0x14158e[_0x82c2('0x35')],function(_0x285c3f){var _0x1d70dd={};_0x1d70dd[_0x285c3f]={'$like':'%'+_0x215b9e[_0x82c2('0x32')][_0x82c2('0x5d')]+'%'};return _0x1d70dd;})});}_0x14158e=_[_0x82c2('0x3e')]({},_0x14158e,_0x215b9e[_0x82c2('0x40')]);return _0x2b27df[_0x82c2('0x84')](_0x14158e);}})[_0x82c2('0x25')](function(_0x2e5be2){if(_0x2e5be2){_0x345650=_0x2e5be2['length'];if(!_0x215b9e[_0x82c2('0x32')]['hasOwnProperty'](_0x82c2('0x3a'))){_0x14158e[_0x82c2('0x1b')]=qs['limit'](_0x215b9e[_0x82c2('0x32')][_0x82c2('0x1b')]);_0x14158e[_0x82c2('0x1a')]=qs[_0x82c2('0x1a')](_0x215b9e['query'][_0x82c2('0x1a')]);}return _0x2b27df[_0x82c2('0x84')](_0x14158e);}})['then'](function(_0x1aafa5){if(_0x1aafa5){return _0x1aafa5?{'count':_0x345650,'rows':_0x1aafa5}:null;}})[_0x82c2('0x25')](respondWithResult(_0x134082,null))[_0x82c2('0x45')](handleError(_0x134082,null));};exports['addBlackLists']=function(_0x2e4c15,_0x2abafe,_0xe44c0b){var _0x593885,_0x5b24a1;return db[_0x82c2('0x2c')][_0x82c2('0x54')]({'where':{'id':_0x2e4c15[_0x82c2('0x47')]['id']}})[_0x82c2('0x25')](handleEntityNotFound(_0x2abafe,null))[_0x82c2('0x25')](function(_0x2a35a1){if(_0x2a35a1){_0x5b24a1=_0x2a35a1;return _0x2a35a1['addBlackLists'](_0x2e4c15[_0x82c2('0x49')][_0x82c2('0x85')],_[_0x82c2('0x55')](_0x2e4c15['body'],[_0x82c2('0x85'),'id'])||{});}return null;})[_0x82c2('0x68')](function(_0x28d8a4){var _0x1dffb4;_0x593885=_0x28d8a4||[];var _0x378ada=[];if(_0x28d8a4){for(var _0x5edf46=0x0;_0x5edf46<_0x28d8a4[_0x82c2('0x38')];_0x5edf46+=0x1){var _0x3c8f7b=_0x28d8a4[_0x5edf46][_0x82c2('0x4b')]({'plain':!![]});_0x1dffb4=squel[_0x82c2('0x6b')]()[_0x82c2('0x7f')]('cm_hopper_black')[_0x82c2('0x6d')]([_0x82c2('0x6e'),_0x82c2('0x70'),_0x82c2('0x71'),_0x82c2('0x5c'),_0x82c2('0x56'),_0x82c2('0x57')],squel['select']()[_0x82c2('0x72')]('phone','phone')[_0x82c2('0x72')]('id','ContactId')[_0x82c2('0x72')](_0x3c8f7b[_0x82c2('0x73')]['toString'](),_0x82c2('0x71'))[_0x82c2('0x72')](_0x2e4c15[_0x82c2('0x47')]['id'][_0x82c2('0x74')](),'CampaignId')['field'](_0x82c2('0x80'),_0x82c2('0x56'))[_0x82c2('0x72')](_0x82c2('0x80'),_0x82c2('0x57'))['from'](_0x82c2('0x76'))[_0x82c2('0x3c')](_0x82c2('0x77'))[_0x82c2('0x3c')](_0x82c2('0x78'),_0x3c8f7b[_0x82c2('0x73')][_0x82c2('0x74')]())['where'](_0x82c2('0x79')))['toString']();_0x378ada[_0x82c2('0x86')](db[_0x82c2('0x87')]['query'](_0x1dffb4));}return BPromise['all'](_0x378ada);}})['then'](function(){return _0x593885;})[_0x82c2('0x25')](respondWithResult(_0x2abafe,null))[_0x82c2('0x45')](handleError(_0x2abafe,null));};exports[_0x82c2('0x88')]=function(_0x479f3f,_0x3376c3,_0x556900){return db['Campaign'][_0x82c2('0x54')]({'where':{'id':_0x479f3f[_0x82c2('0x47')]['id']}})[_0x82c2('0x25')](handleEntityNotFound(_0x3376c3,null))[_0x82c2('0x25')](function(_0x1e7d4f){if(_0x1e7d4f){return _0x1e7d4f[_0x82c2('0x88')](_0x479f3f[_0x82c2('0x32')][_0x82c2('0x85')]);}})['then'](function(_0x3582da){if(_0x3582da){return db[_0x82c2('0x64')][_0x82c2('0x24')]({'where':{'ListId':_0x479f3f[_0x82c2('0x32')][_0x82c2('0x85')],'CampaignId':_0x479f3f[_0x82c2('0x47')]['id']}})[_0x82c2('0x25')](function(){return _0x3582da;});}})[_0x82c2('0x25')](respondWithStatusCode(_0x3376c3,null))['catch'](handleError(_0x3376c3,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 26e0932..6a999fd 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 00f39aa..1a98ab9 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 _0xa3b9=['Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','Campaign','findAll','raw','where','options','attributes','include','map','model','GetCampaign','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0xa3b9,0x112));var _0x9a3b=function(_0x413da3,_0xac67d4){_0x413da3=_0x413da3-0x0;var _0x14c946=_0xa3b9[_0x413da3];return _0x14c946;};'use strict';var _=require(_0x9a3b('0x0'));var util=require(_0x9a3b('0x1'));var moment=require(_0x9a3b('0x2'));var BPromise=require(_0x9a3b('0x3'));var rs=require(_0x9a3b('0x4'));var fs=require('fs');var Redis=require(_0x9a3b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a3b('0x6'));var logger=require(_0x9a3b('0x7'))(_0x9a3b('0x8'));var config=require(_0x9a3b('0x9'));var jayson=require(_0x9a3b('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a6a0d,_0x2357b8,_0x242fbe){return new BPromise(function(_0x2da1e2,_0x204d1f){return client[_0x9a3b('0xb')](_0x3a6a0d,_0x242fbe)[_0x9a3b('0xc')](function(_0x593fef){logger[_0x9a3b('0xd')](_0x9a3b('0xe'),_0x2357b8,_0x9a3b('0xf'));logger[_0x9a3b('0x10')]('Campaign,\x20%s,\x20%s,\x20%s',_0x2357b8,_0x9a3b('0xf'),JSON[_0x9a3b('0x11')](_0x593fef));if(_0x593fef[_0x9a3b('0x12')]){if(_0x593fef['error']['code']===0x1f4){logger[_0x9a3b('0x12')]('Campaign,\x20%s,\x20%s',_0x2357b8,_0x593fef['error'][_0x9a3b('0x13')]);return _0x204d1f(_0x593fef[_0x9a3b('0x12')]['message']);}logger[_0x9a3b('0x12')]('Campaign,\x20%s,\x20%s',_0x2357b8,_0x593fef[_0x9a3b('0x12')][_0x9a3b('0x13')]);return _0x2da1e2(_0x593fef[_0x9a3b('0x12')]['message']);}else{logger['info'](_0x9a3b('0xe'),_0x2357b8,'request\x20sent');_0x2da1e2(_0x593fef[_0x9a3b('0x14')][_0x9a3b('0x13')]);}})[_0x9a3b('0x15')](function(_0x43126b){logger[_0x9a3b('0x12')]('Campaign,\x20%s,\x20%s',_0x2357b8,_0x43126b);_0x204d1f(_0x43126b);});});}exports['GetCampaign']=function(_0xa2975){var _0x2dbf3b=this;return new Promise(function(_0x5c1af2,_0x22cbbb){return db[_0x9a3b('0x16')][_0x9a3b('0x17')]({'raw':_0xa2975['options']?_0xa2975['options'][_0x9a3b('0x18')]===undefined?!![]:![]:!![],'where':_0xa2975['options']?_0xa2975['options'][_0x9a3b('0x19')]||null:null,'attributes':_0xa2975[_0x9a3b('0x1a')]?_0xa2975[_0x9a3b('0x1a')][_0x9a3b('0x1b')]||null:null,'limit':_0xa2975[_0x9a3b('0x1a')]?_0xa2975[_0x9a3b('0x1a')]['limit']||null:null,'include':_0xa2975[_0x9a3b('0x1a')]?_0xa2975[_0x9a3b('0x1a')][_0x9a3b('0x1c')]?_[_0x9a3b('0x1d')](_0xa2975[_0x9a3b('0x1a')][_0x9a3b('0x1c')],function(_0x3b32d8){return{'model':db[_0x3b32d8[_0x9a3b('0x1e')]],'as':_0x3b32d8['as'],'attributes':_0x3b32d8['attributes'],'include':_0x3b32d8[_0x9a3b('0x1c')]?_[_0x9a3b('0x1d')](_0x3b32d8['include'],function(_0x58648d){return{'model':db[_0x58648d[_0x9a3b('0x1e')]],'as':_0x58648d['as'],'attributes':_0x58648d[_0x9a3b('0x1b')],'include':_0x58648d[_0x9a3b('0x1c')]?_[_0x9a3b('0x1d')](_0x58648d['include'],function(_0x895da0){return{'model':db[_0x895da0[_0x9a3b('0x1e')]],'as':_0x895da0['as'],'attributes':_0x895da0[_0x9a3b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9a3b('0xc')](function(_0x363f75){logger[_0x9a3b('0xd')]('GetCampaign',_0xa2975);logger[_0x9a3b('0x10')](_0x9a3b('0x1f'),_0xa2975,JSON[_0x9a3b('0x11')](_0x363f75));_0x5c1af2(_0x363f75);})[_0x9a3b('0x15')](function(_0x31d542){logger['error'](_0x9a3b('0x1f'),_0x31d542[_0x9a3b('0x13')],_0xa2975);_0x22cbbb(_0x2dbf3b[_0x9a3b('0x12')](0x1f4,_0x31d542[_0x9a3b('0x13')]));});});}; \ No newline at end of file +var _0xc252=['raw','where','attributes','limit','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetCampaign','Campaign','findAll','options'];(function(_0x189a72,_0x4ac342){var _0x2b457a=function(_0x151b57){while(--_0x151b57){_0x189a72['push'](_0x189a72['shift']());}};_0x2b457a(++_0x4ac342);}(_0xc252,0x118));var _0x2c25=function(_0xcd2083,_0x44327f){_0xcd2083=_0xcd2083-0x0;var _0x25e4c5=_0xc252[_0xcd2083];return _0x25e4c5;};'use strict';var _=require(_0x2c25('0x0'));var util=require(_0x2c25('0x1'));var moment=require(_0x2c25('0x2'));var BPromise=require(_0x2c25('0x3'));var rs=require(_0x2c25('0x4'));var fs=require('fs');var Redis=require(_0x2c25('0x5'));var db=require(_0x2c25('0x6'))['db'];var utils=require(_0x2c25('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x2c25('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2c25('0x9')][_0x2c25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39972f,_0x1ec60a,_0x5f1278){return new BPromise(function(_0x491314,_0x16f20){return client[_0x2c25('0xb')](_0x39972f,_0x5f1278)[_0x2c25('0xc')](function(_0x1f927e){logger[_0x2c25('0xd')](_0x2c25('0xe'),_0x1ec60a,_0x2c25('0xf'));logger['debug'](_0x2c25('0x10'),_0x1ec60a,'request\x20sent',JSON[_0x2c25('0x11')](_0x1f927e));if(_0x1f927e['error']){if(_0x1f927e[_0x2c25('0x12')][_0x2c25('0x13')]===0x1f4){logger['error'](_0x2c25('0xe'),_0x1ec60a,_0x1f927e[_0x2c25('0x12')]['message']);return _0x16f20(_0x1f927e['error'][_0x2c25('0x14')]);}logger[_0x2c25('0x12')](_0x2c25('0xe'),_0x1ec60a,_0x1f927e[_0x2c25('0x12')][_0x2c25('0x14')]);return _0x491314(_0x1f927e[_0x2c25('0x12')][_0x2c25('0x14')]);}else{logger[_0x2c25('0xd')](_0x2c25('0xe'),_0x1ec60a,'request\x20sent');_0x491314(_0x1f927e['result'][_0x2c25('0x14')]);}})[_0x2c25('0x15')](function(_0x8b04ce){logger['error'](_0x2c25('0xe'),_0x1ec60a,_0x8b04ce);_0x16f20(_0x8b04ce);});});}exports[_0x2c25('0x16')]=function(_0x28093a){var _0x19ff99=this;return new Promise(function(_0x4bfc1e,_0xe0af6){return db[_0x2c25('0x17')][_0x2c25('0x18')]({'raw':_0x28093a[_0x2c25('0x19')]?_0x28093a['options'][_0x2c25('0x1a')]===undefined?!![]:![]:!![],'where':_0x28093a['options']?_0x28093a['options'][_0x2c25('0x1b')]||null:null,'attributes':_0x28093a['options']?_0x28093a[_0x2c25('0x19')][_0x2c25('0x1c')]||null:null,'limit':_0x28093a[_0x2c25('0x19')]?_0x28093a[_0x2c25('0x19')][_0x2c25('0x1d')]||null:null,'include':_0x28093a[_0x2c25('0x19')]?_0x28093a[_0x2c25('0x19')][_0x2c25('0x1e')]?_[_0x2c25('0x1f')](_0x28093a[_0x2c25('0x19')][_0x2c25('0x1e')],function(_0x516ed1){return{'model':db[_0x516ed1['model']],'as':_0x516ed1['as'],'attributes':_0x516ed1[_0x2c25('0x1c')],'include':_0x516ed1['include']?_[_0x2c25('0x1f')](_0x516ed1[_0x2c25('0x1e')],function(_0x41c26b){return{'model':db[_0x41c26b[_0x2c25('0x20')]],'as':_0x41c26b['as'],'attributes':_0x41c26b[_0x2c25('0x1c')],'include':_0x41c26b['include']?_[_0x2c25('0x1f')](_0x41c26b[_0x2c25('0x1e')],function(_0x3f6906){return{'model':db[_0x3f6906['model']],'as':_0x3f6906['as'],'attributes':_0x3f6906[_0x2c25('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa7cbb6){logger[_0x2c25('0xd')]('GetCampaign',_0x28093a);logger[_0x2c25('0x21')](_0x2c25('0x16'),_0x28093a,JSON['stringify'](_0xa7cbb6));_0x4bfc1e(_0xa7cbb6);})[_0x2c25('0x15')](function(_0x4a8193){logger['error'](_0x2c25('0x16'),_0x4a8193[_0x2c25('0x14')],_0x28093a);_0xe0af6(_0x19ff99[_0x2c25('0x12')](0x1f4,_0x4a8193[_0x2c25('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index fac26dc..96889f8 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 _0x3fb1=['update','delete','destroy','removeLists','removeBlackLists','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','post','create','/:id/clone','clone','/:id/lists','addLists','addBlackLists','put'];(function(_0x6c637d,_0x5e2962){var _0x24f6d1=function(_0x1c933a){while(--_0x1c933a){_0x6c637d['push'](_0x6c637d['shift']());}};_0x24f6d1(++_0x5e2962);}(_0x3fb1,0x15a));var _0x13fb=function(_0x36aa37,_0x3d6792){_0x36aa37=_0x36aa37-0x0;var _0xe63a10=_0x3fb1[_0x36aa37];return _0xe63a10;};'use strict';var multer=require('multer');var util=require(_0x13fb('0x0'));var path=require('path');var timeout=require(_0x13fb('0x1'));var express=require(_0x13fb('0x2'));var router=express['Router']();var fs_extra=require(_0x13fb('0x3'));var auth=require(_0x13fb('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x13fb('0x5'));router[_0x13fb('0x6')]('/',auth[_0x13fb('0x7')](),controller[_0x13fb('0x8')]);router[_0x13fb('0x6')](_0x13fb('0x9'),auth[_0x13fb('0x7')](),controller[_0x13fb('0xa')]);router[_0x13fb('0x6')](_0x13fb('0xb'),auth[_0x13fb('0x7')](),controller[_0x13fb('0xc')]);router['get'](_0x13fb('0xd'),auth[_0x13fb('0x7')](),controller[_0x13fb('0xe')]);router['get']('/:id/hopper_finals',auth[_0x13fb('0x7')](),controller[_0x13fb('0xf')]);router[_0x13fb('0x6')](_0x13fb('0x10'),auth[_0x13fb('0x7')](),controller[_0x13fb('0x11')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0x13fb('0x12')]);router[_0x13fb('0x6')](_0x13fb('0x13'),auth[_0x13fb('0x7')](),controller['getBlackLists']);router[_0x13fb('0x14')]('/',auth[_0x13fb('0x7')](),controller[_0x13fb('0x15')]);router['post'](_0x13fb('0x16'),auth[_0x13fb('0x7')](),controller[_0x13fb('0x17')]);router[_0x13fb('0x14')](_0x13fb('0x18'),auth['isAuthenticated'](),controller[_0x13fb('0x19')]);router[_0x13fb('0x14')](_0x13fb('0x13'),auth[_0x13fb('0x7')](),controller[_0x13fb('0x1a')]);router[_0x13fb('0x1b')](_0x13fb('0x9'),auth['isAuthenticated'](),controller[_0x13fb('0x1c')]);router[_0x13fb('0x1d')](_0x13fb('0x9'),auth[_0x13fb('0x7')](),controller[_0x13fb('0x1e')]);router[_0x13fb('0x1d')](_0x13fb('0x18'),auth['isAuthenticated'](),controller[_0x13fb('0x1f')]);router[_0x13fb('0x1d')](_0x13fb('0x13'),auth['isAuthenticated'](),controller[_0x13fb('0x20')]);module[_0x13fb('0x21')]=router; \ No newline at end of file +var _0x60ac=['addBlackLists','put','update','delete','/:id','destroy','removeBlackLists','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone'];(function(_0xc7a20f,_0x4af53f){var _0x344f6d=function(_0x4a100f){while(--_0x4a100f){_0xc7a20f['push'](_0xc7a20f['shift']());}};_0x344f6d(++_0x4af53f);}(_0x60ac,0xa2));var _0xc60a=function(_0x2cff40,_0x592d6f){_0x2cff40=_0x2cff40-0x0;var _0x43dd60=_0x60ac[_0x2cff40];return _0x43dd60;};'use strict';var multer=require('multer');var util=require(_0xc60a('0x0'));var path=require(_0xc60a('0x1'));var timeout=require(_0xc60a('0x2'));var express=require(_0xc60a('0x3'));var router=express[_0xc60a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc60a('0x5'));var interaction=require(_0xc60a('0x6'));var config=require('../../config/environment');var controller=require(_0xc60a('0x7'));router[_0xc60a('0x8')]('/',auth[_0xc60a('0x9')](),controller[_0xc60a('0xa')]);router[_0xc60a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc60a('0xb')]);router[_0xc60a('0x8')]('/:id/hoppers',auth[_0xc60a('0x9')](),controller[_0xc60a('0xc')]);router[_0xc60a('0x8')](_0xc60a('0xd'),auth[_0xc60a('0x9')](),controller[_0xc60a('0xe')]);router[_0xc60a('0x8')](_0xc60a('0xf'),auth[_0xc60a('0x9')](),controller[_0xc60a('0x10')]);router[_0xc60a('0x8')](_0xc60a('0x11'),auth[_0xc60a('0x9')](),controller['getHopperBlacks']);router[_0xc60a('0x8')](_0xc60a('0x12'),auth[_0xc60a('0x9')](),controller[_0xc60a('0x13')]);router[_0xc60a('0x8')](_0xc60a('0x14'),auth[_0xc60a('0x9')](),controller[_0xc60a('0x15')]);router[_0xc60a('0x16')]('/',auth[_0xc60a('0x9')](),controller['create']);router[_0xc60a('0x16')](_0xc60a('0x17'),auth[_0xc60a('0x9')](),controller['clone']);router[_0xc60a('0x16')](_0xc60a('0x12'),auth[_0xc60a('0x9')](),controller['addLists']);router[_0xc60a('0x16')](_0xc60a('0x14'),auth[_0xc60a('0x9')](),controller[_0xc60a('0x18')]);router[_0xc60a('0x19')]('/:id',auth[_0xc60a('0x9')](),controller[_0xc60a('0x1a')]);router[_0xc60a('0x1b')](_0xc60a('0x1c'),auth[_0xc60a('0x9')](),controller[_0xc60a('0x1d')]);router[_0xc60a('0x1b')](_0xc60a('0x12'),auth[_0xc60a('0x9')](),controller['removeLists']);router[_0xc60a('0x1b')](_0xc60a('0x14'),auth[_0xc60a('0x9')](),controller[_0xc60a('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index b3aa4f3..9592faf 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 _0x858d=['exports','STRING','key'];(function(_0x4a1777,_0x3c949f){var _0x393973=function(_0x945f66){while(--_0x945f66){_0x4a1777['push'](_0x4a1777['shift']());}};_0x393973(++_0x3c949f);}(_0x858d,0x19e));var _0xd858=function(_0x1cb236,_0x364b73){_0x1cb236=_0x1cb236-0x0;var _0x33f8d3=_0x858d[_0x1cb236];return _0x33f8d3;};'use strict';var Sequelize=require('sequelize');module[_0xd858('0x0')]={'key':{'type':Sequelize[_0xd858('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xd858('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xd858('0x2'));}}}; \ No newline at end of file +var _0x4626=['exports','TEXT','STRING','VIRTUAL','key','sequelize'];(function(_0x1d2169,_0x2265f0){var _0x258247=function(_0x406bba){while(--_0x406bba){_0x1d2169['push'](_0x1d2169['shift']());}};_0x258247(++_0x2265f0);}(_0x4626,0xc5));var _0x6462=function(_0x494a3b,_0x3b2ee8){_0x494a3b=_0x494a3b-0x0;var _0x2da31c=_0x4626[_0x494a3b];return _0x2da31c;};'use strict';var Sequelize=require(_0x6462('0x0'));module[_0x6462('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x6462('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6462('0x3')]},'name':{'type':Sequelize[_0x6462('0x4')],'get':function(){return this['getDataValue'](_0x6462('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 8737bc2..6715f9d 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 _0xfdda=['show','params','intersection','length','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','CannedAnswers','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','CannedAnswer','rawAttributes','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xfdda,0xc2));var _0xafdd=function(_0x57f74a,_0x3f8b13){_0x57f74a=_0x57f74a-0x0;var _0x15b677=_0xfdda[_0x57f74a];return _0x15b677;};'use strict';var emlformat=require(_0xafdd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xafdd('0x1'));var moment=require(_0xafdd('0x2'));var BPromise=require(_0xafdd('0x3'));var Mustache=require(_0xafdd('0x4'));var util=require(_0xafdd('0x5'));var path=require(_0xafdd('0x6'));var sox=require(_0xafdd('0x7'));var csv=require(_0xafdd('0x8'));var ejs=require(_0xafdd('0x9'));var fs=require('fs');var fs_extra=require(_0xafdd('0xa'));var _=require(_0xafdd('0xb'));var squel=require(_0xafdd('0xc'));var crypto=require(_0xafdd('0xd'));var jsforce=require(_0xafdd('0xe'));var deskjs=require(_0xafdd('0xf'));var toCsv=require(_0xafdd('0x8'));var querystring=require(_0xafdd('0x10'));var Papa=require(_0xafdd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xafdd('0x12'));var as=require(_0xafdd('0x13'));var hardwareService=require(_0xafdd('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xafdd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xafdd('0x16'));var db=require(_0xafdd('0x17'))['db'];function respondWithStatusCode(_0x56e015,_0x4df36c){_0x4df36c=_0x4df36c||0xcc;return function(_0x5e4fa8){if(_0x5e4fa8){return _0x56e015['sendStatus'](_0x4df36c);}return _0x56e015[_0xafdd('0x18')](_0x4df36c)[_0xafdd('0x19')]();};}function respondWithResult(_0x5411cd,_0x227a6d){_0x227a6d=_0x227a6d||0xc8;return function(_0x2b9ba1){if(_0x2b9ba1){return _0x5411cd[_0xafdd('0x18')](_0x227a6d)[_0xafdd('0x1a')](_0x2b9ba1);}};}function respondWithFilteredResult(_0x2e297e,_0x1fc542){return function(_0x10f07c){if(_0x10f07c){var _0x5cda9c=typeof _0x1fc542['offset']==='undefined'&&typeof _0x1fc542['limit']===_0xafdd('0x1b');var _0x5789d6=_0x10f07c[_0xafdd('0x1c')];var _0x49ae8f=_0x5cda9c?0x0:_0x1fc542[_0xafdd('0x1d')];var _0x585df3=_0x5cda9c?_0x10f07c[_0xafdd('0x1c')]:_0x1fc542['offset']+_0x1fc542[_0xafdd('0x1e')];var _0x11ece3;if(_0x585df3>=_0x5789d6){_0x585df3=_0x5789d6;_0x11ece3=0xc8;}else{_0x11ece3=0xce;}_0x2e297e[_0xafdd('0x18')](_0x11ece3);return _0x2e297e[_0xafdd('0x1f')](_0xafdd('0x20'),_0x49ae8f+'-'+_0x585df3+'/'+_0x5789d6)[_0xafdd('0x1a')](_0x10f07c);}return null;};}function patchUpdates(_0x582b09){return function(_0x2f8978){try{jsonpatch[_0xafdd('0x21')](_0x2f8978,_0x582b09,!![]);}catch(_0xeab8f6){return BPromise[_0xafdd('0x22')](_0xeab8f6);}return _0x2f8978[_0xafdd('0x23')]();};}function saveUpdates(_0x284ed3,_0x3decee){return function(_0x5c29ba){if(_0x5c29ba){return _0x5c29ba[_0xafdd('0x24')](_0x284ed3)[_0xafdd('0x25')](function(_0x1ec6d1){return _0x1ec6d1;});}return null;};}function removeEntity(_0x5c6ae4,_0x3f4302){return function(_0x32ca96){if(_0x32ca96){return _0x32ca96['destroy']()[_0xafdd('0x25')](function(){var _0x3bd928=_0x32ca96['get']({'plain':!![]});var _0x2f9be5=_0xafdd('0x26');return db[_0xafdd('0x27')][_0xafdd('0x28')]({'where':{'type':_0x2f9be5,'resourceId':_0x3bd928['id']}})[_0xafdd('0x25')](function(){return _0x32ca96;});})[_0xafdd('0x25')](function(){_0x5c6ae4[_0xafdd('0x18')](0xcc)[_0xafdd('0x19')]();});}};}function handleEntityNotFound(_0x229c13,_0x56856d){return function(_0x180ec3){if(!_0x180ec3){_0x229c13[_0xafdd('0x29')](0x194);}return _0x180ec3;};}function handleError(_0x334032,_0x1d2130){_0x1d2130=_0x1d2130||0x1f4;return function(_0x1423c5){logger[_0xafdd('0x2a')](_0x1423c5[_0xafdd('0x2b')]);if(_0x1423c5['name']){delete _0x1423c5[_0xafdd('0x2c')];}_0x334032[_0xafdd('0x18')](_0x1d2130)[_0xafdd('0x2d')](_0x1423c5);};}exports[_0xafdd('0x2e')]=function(_0x37943f,_0x562a65){var _0x3fda62={},_0x181c65={},_0x3cd90a={'count':0x0,'rows':[]};var _0x1734b1=_[_0xafdd('0x2f')](db[_0xafdd('0x30')][_0xafdd('0x31')],function(_0xe91dec){return{'name':_0xe91dec['fieldName'],'type':_0xe91dec[_0xafdd('0x32')][_0xafdd('0x33')]};});_0x181c65[_0xafdd('0x34')]=_[_0xafdd('0x2f')](_0x1734b1,_0xafdd('0x2c'));_0x181c65[_0xafdd('0x35')]=_[_0xafdd('0x36')](_0x37943f[_0xafdd('0x35')]);_0x181c65[_0xafdd('0x37')]=_['intersection'](_0x181c65[_0xafdd('0x34')],_0x181c65[_0xafdd('0x35')]);_0x3fda62[_0xafdd('0x38')]=_['intersection'](_0x181c65['model'],qs[_0xafdd('0x39')](_0x37943f[_0xafdd('0x35')]['fields']));_0x3fda62[_0xafdd('0x38')]=_0x3fda62[_0xafdd('0x38')]['length']?_0x3fda62[_0xafdd('0x38')]:_0x181c65['model'];if(!_0x37943f[_0xafdd('0x35')][_0xafdd('0x3a')]('nolimit')){_0x3fda62['limit']=qs[_0xafdd('0x1e')](_0x37943f['query']['limit']);_0x3fda62[_0xafdd('0x1d')]=qs[_0xafdd('0x1d')](_0x37943f['query'][_0xafdd('0x1d')]);}_0x3fda62[_0xafdd('0x3b')]=qs['sort'](_0x37943f[_0xafdd('0x35')]['sort']);_0x3fda62['where']=qs[_0xafdd('0x37')](_[_0xafdd('0x3c')](_0x37943f[_0xafdd('0x35')],_0x181c65[_0xafdd('0x37')]),_0x1734b1);if(_0x37943f[_0xafdd('0x35')][_0xafdd('0x3d')]){_0x3fda62[_0xafdd('0x3e')]=_[_0xafdd('0x3f')](_0x3fda62['where'],{'$or':[{'key':{'$like':'%'+_0x37943f[_0xafdd('0x35')][_0xafdd('0x3d')]+'%'}},{'value':{'$like':'%'+_0x37943f[_0xafdd('0x35')][_0xafdd('0x3d')]+'%'}}]});}_0x3fda62=_[_0xafdd('0x3f')]({},_0x3fda62,_0x37943f[_0xafdd('0x40')]);var _0x17dc25={'where':_0x3fda62['where']};return db['CannedAnswer'][_0xafdd('0x1c')](_0x17dc25)[_0xafdd('0x25')](function(_0x285e2d){_0x3cd90a['count']=_0x285e2d;if(_0x37943f[_0xafdd('0x35')][_0xafdd('0x41')]){_0x3fda62[_0xafdd('0x42')]=[{'all':!![]}];}return db['CannedAnswer'][_0xafdd('0x43')](_0x3fda62);})[_0xafdd('0x25')](function(_0x57175c){_0x3cd90a[_0xafdd('0x44')]=_0x57175c;return _0x3cd90a;})[_0xafdd('0x25')](respondWithFilteredResult(_0x562a65,_0x3fda62))[_0xafdd('0x45')](handleError(_0x562a65,null));};exports[_0xafdd('0x46')]=function(_0x35d144,_0x1cdd4f){var _0x3b80d9={'raw':!![],'where':{'id':_0x35d144[_0xafdd('0x47')]['id']}},_0x315d09={};_0x315d09[_0xafdd('0x34')]=_['keys'](db[_0xafdd('0x30')][_0xafdd('0x31')]);_0x315d09[_0xafdd('0x35')]=_[_0xafdd('0x36')](_0x35d144['query']);_0x315d09[_0xafdd('0x37')]=_[_0xafdd('0x48')](_0x315d09['model'],_0x315d09[_0xafdd('0x35')]);_0x3b80d9[_0xafdd('0x38')]=_[_0xafdd('0x48')](_0x315d09['model'],qs[_0xafdd('0x39')](_0x35d144[_0xafdd('0x35')][_0xafdd('0x39')]));_0x3b80d9[_0xafdd('0x38')]=_0x3b80d9['attributes'][_0xafdd('0x49')]?_0x3b80d9[_0xafdd('0x38')]:_0x315d09['model'];if(_0x35d144[_0xafdd('0x35')]['includeAll']){_0x3b80d9[_0xafdd('0x42')]=[{'all':!![]}];}_0x3b80d9=_['merge']({},_0x3b80d9,_0x35d144['options']);return db[_0xafdd('0x30')][_0xafdd('0x4a')](_0x3b80d9)[_0xafdd('0x25')](handleEntityNotFound(_0x1cdd4f,null))[_0xafdd('0x25')](respondWithResult(_0x1cdd4f,null))['catch'](handleError(_0x1cdd4f,null));};exports[_0xafdd('0x24')]=function(_0x2c0843,_0x47a33d){if(_0x2c0843['body']['id']){delete _0x2c0843['body']['id'];}return db[_0xafdd('0x30')]['find']({'where':{'id':_0x2c0843[_0xafdd('0x47')]['id']}})[_0xafdd('0x25')](handleEntityNotFound(_0x47a33d,null))[_0xafdd('0x25')](saveUpdates(_0x2c0843[_0xafdd('0x4b')],null))[_0xafdd('0x25')](respondWithResult(_0x47a33d,null))[_0xafdd('0x45')](handleError(_0x47a33d,null));};exports[_0xafdd('0x28')]=function(_0x30c713,_0xff52b1){return db['CannedAnswer']['find']({'where':{'id':_0x30c713[_0xafdd('0x47')]['id']}})[_0xafdd('0x25')](handleEntityNotFound(_0xff52b1,null))[_0xafdd('0x25')](removeEntity(_0xff52b1,null))[_0xafdd('0x45')](handleError(_0xff52b1,null));};exports[_0xafdd('0x4c')]=function(_0x2a2038,_0x20b4c0){var _0x30ed27={'key':_0x2a2038[_0xafdd('0x4b')][_0xafdd('0x33')]};if(_0x2a2038[_0xafdd('0x4b')][_0xafdd('0x4d')]){_0x30ed27['MailAccountId']=_0x2a2038[_0xafdd('0x4b')]['MailAccountId'];}else if(_0x2a2038[_0xafdd('0x4b')][_0xafdd('0x4e')]){_0x30ed27[_0xafdd('0x4e')]=_0x2a2038[_0xafdd('0x4b')][_0xafdd('0x4e')];}else if(_0x2a2038[_0xafdd('0x4b')][_0xafdd('0x4f')]){_0x30ed27['OpenchannelAccountId']=_0x2a2038[_0xafdd('0x4b')][_0xafdd('0x4f')];}else if(_0x2a2038[_0xafdd('0x4b')]['ChatWebsiteId']){_0x30ed27[_0xafdd('0x50')]=_0x2a2038[_0xafdd('0x4b')]['ChatWebsiteId'];}return db[_0xafdd('0x30')]['find']({'where':_0x30ed27})[_0xafdd('0x25')](function(_0x47e85c){if(_0x47e85c){throw new db[(_0xafdd('0x51'))]['ValidationError'](_0xafdd('0x52'));}return db[_0xafdd('0x30')]['create'](_0x2a2038[_0xafdd('0x4b')]);})[_0xafdd('0x25')](function(_0x155940){var _0x48488a=_0x2a2038['user'][_0xafdd('0x53')]({'plain':!![]});if(!_0x48488a)throw new Error(_0xafdd('0x54'));if(_0x48488a['role']==='user'){var _0x5b8ed0=_0x155940[_0xafdd('0x53')]({'plain':!![]});return db[_0xafdd('0x55')][_0xafdd('0x4a')]({'where':{'name':'CannedAnswers','userProfileId':_0x48488a[_0xafdd('0x56')]},'raw':!![]})['then'](function(_0x3fd8a6){if(_0x3fd8a6&&_0x3fd8a6[_0xafdd('0x57')]===0x0){return db[_0xafdd('0x27')][_0xafdd('0x4c')]({'name':_0x5b8ed0[_0xafdd('0x2c')],'resourceId':_0x5b8ed0['id'],'type':_0x3fd8a6[_0xafdd('0x2c')],'sectionId':_0x3fd8a6['id']},{})[_0xafdd('0x25')](function(){return _0x155940;});}else{return _0x155940;}})[_0xafdd('0x45')](function(_0x403a8c){logger[_0xafdd('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x403a8c);throw _0x403a8c;});}return _0x155940;})[_0xafdd('0x25')](respondWithResult(_0x20b4c0,0xc9))[_0xafdd('0x45')](handleError(_0x20b4c0,null));}; \ No newline at end of file +var _0x30fe=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','then','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','CannedAnswer','includeAll','include','findAll','rows','catch','show','intersection','length','find','params','create','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x159195,_0x371cc8){var _0x40f274=function(_0x2e00fe){while(--_0x2e00fe){_0x159195['push'](_0x159195['shift']());}};_0x40f274(++_0x371cc8);}(_0x30fe,0x102));var _0xe30f=function(_0x310693,_0x5eb0bf){_0x310693=_0x310693-0x0;var _0x2dd79c=_0x30fe[_0x310693];return _0x2dd79c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe30f('0x0'));var zipdir=require(_0xe30f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe30f('0x2'));var BPromise=require(_0xe30f('0x3'));var Mustache=require(_0xe30f('0x4'));var util=require(_0xe30f('0x5'));var path=require(_0xe30f('0x6'));var sox=require('sox');var csv=require(_0xe30f('0x7'));var ejs=require(_0xe30f('0x8'));var fs=require('fs');var fs_extra=require(_0xe30f('0x9'));var _=require(_0xe30f('0xa'));var squel=require(_0xe30f('0xb'));var crypto=require(_0xe30f('0xc'));var jsforce=require(_0xe30f('0xd'));var deskjs=require(_0xe30f('0xe'));var toCsv=require(_0xe30f('0x7'));var querystring=require(_0xe30f('0xf'));var Papa=require(_0xe30f('0x10'));var Redis=require(_0xe30f('0x11'));var authService=require(_0xe30f('0x12'));var qs=require(_0xe30f('0x13'));var as=require(_0xe30f('0x14'));var hardwareService=require(_0xe30f('0x15'));var logger=require(_0xe30f('0x16'))(_0xe30f('0x17'));var utils=require('../../config/utils');var config=require(_0xe30f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe30f('0x19'))['db'];function respondWithStatusCode(_0x5722ec,_0x363251){_0x363251=_0x363251||0xcc;return function(_0x503a26){if(_0x503a26){return _0x5722ec[_0xe30f('0x1a')](_0x363251);}return _0x5722ec[_0xe30f('0x1b')](_0x363251)[_0xe30f('0x1c')]();};}function respondWithResult(_0x325e11,_0x9134c5){_0x9134c5=_0x9134c5||0xc8;return function(_0x1bfdaf){if(_0x1bfdaf){return _0x325e11[_0xe30f('0x1b')](_0x9134c5)[_0xe30f('0x1d')](_0x1bfdaf);}};}function respondWithFilteredResult(_0x1a54a7,_0x31d703){return function(_0xcb06fe){if(_0xcb06fe){var _0x599993=typeof _0x31d703[_0xe30f('0x1e')]===_0xe30f('0x1f')&&typeof _0x31d703['limit']===_0xe30f('0x1f');var _0x5a877b=_0xcb06fe[_0xe30f('0x20')];var _0x4b56ed=_0x599993?0x0:_0x31d703[_0xe30f('0x1e')];var _0xb958a=_0x599993?_0xcb06fe['count']:_0x31d703[_0xe30f('0x1e')]+_0x31d703[_0xe30f('0x21')];var _0x51184a;if(_0xb958a>=_0x5a877b){_0xb958a=_0x5a877b;_0x51184a=0xc8;}else{_0x51184a=0xce;}_0x1a54a7['status'](_0x51184a);return _0x1a54a7['set'](_0xe30f('0x22'),_0x4b56ed+'-'+_0xb958a+'/'+_0x5a877b)[_0xe30f('0x1d')](_0xcb06fe);}return null;};}function patchUpdates(_0x3ab664){return function(_0x3059a7){try{jsonpatch[_0xe30f('0x23')](_0x3059a7,_0x3ab664,!![]);}catch(_0x17b6f7){return BPromise['reject'](_0x17b6f7);}return _0x3059a7[_0xe30f('0x24')]();};}function saveUpdates(_0x346423,_0x291a36){return function(_0x21eaf9){if(_0x21eaf9){return _0x21eaf9[_0xe30f('0x25')](_0x346423)['then'](function(_0x8aa850){return _0x8aa850;});}return null;};}function removeEntity(_0xcf0c9c,_0xb9b25b){return function(_0x6fb27d){if(_0x6fb27d){return _0x6fb27d[_0xe30f('0x26')]()[_0xe30f('0x27')](function(){var _0x3eb55=_0x6fb27d[_0xe30f('0x28')]({'plain':!![]});var _0x5cc03b=_0xe30f('0x29');return db[_0xe30f('0x2a')][_0xe30f('0x26')]({'where':{'type':_0x5cc03b,'resourceId':_0x3eb55['id']}})[_0xe30f('0x27')](function(){return _0x6fb27d;});})[_0xe30f('0x27')](function(){_0xcf0c9c[_0xe30f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x625417,_0x22cdc1){return function(_0x32a045){if(!_0x32a045){_0x625417[_0xe30f('0x1a')](0x194);}return _0x32a045;};}function handleError(_0x3cd24e,_0x382ee4){_0x382ee4=_0x382ee4||0x1f4;return function(_0x2669d0){logger[_0xe30f('0x2b')](_0x2669d0[_0xe30f('0x2c')]);if(_0x2669d0[_0xe30f('0x2d')]){delete _0x2669d0[_0xe30f('0x2d')];}_0x3cd24e[_0xe30f('0x1b')](_0x382ee4)[_0xe30f('0x2e')](_0x2669d0);};}exports[_0xe30f('0x2f')]=function(_0x2571a9,_0x268a17){var _0x5cb57f={},_0x34d3ce={},_0x2674ee={'count':0x0,'rows':[]};var _0x814ade=_[_0xe30f('0x30')](db['CannedAnswer'][_0xe30f('0x31')],function(_0xa09ca3){return{'name':_0xa09ca3[_0xe30f('0x32')],'type':_0xa09ca3[_0xe30f('0x33')][_0xe30f('0x34')]};});_0x34d3ce[_0xe30f('0x35')]=_['map'](_0x814ade,_0xe30f('0x2d'));_0x34d3ce[_0xe30f('0x36')]=_[_0xe30f('0x37')](_0x2571a9[_0xe30f('0x36')]);_0x34d3ce['filters']=_['intersection'](_0x34d3ce[_0xe30f('0x35')],_0x34d3ce[_0xe30f('0x36')]);_0x5cb57f[_0xe30f('0x38')]=_['intersection'](_0x34d3ce[_0xe30f('0x35')],qs[_0xe30f('0x39')](_0x2571a9['query'][_0xe30f('0x39')]));_0x5cb57f[_0xe30f('0x38')]=_0x5cb57f['attributes']['length']?_0x5cb57f[_0xe30f('0x38')]:_0x34d3ce[_0xe30f('0x35')];if(!_0x2571a9['query'][_0xe30f('0x3a')]('nolimit')){_0x5cb57f[_0xe30f('0x21')]=qs[_0xe30f('0x21')](_0x2571a9['query'][_0xe30f('0x21')]);_0x5cb57f[_0xe30f('0x1e')]=qs[_0xe30f('0x1e')](_0x2571a9[_0xe30f('0x36')]['offset']);}_0x5cb57f[_0xe30f('0x3b')]=qs['sort'](_0x2571a9[_0xe30f('0x36')][_0xe30f('0x3c')]);_0x5cb57f[_0xe30f('0x3d')]=qs[_0xe30f('0x3e')](_[_0xe30f('0x3f')](_0x2571a9['query'],_0x34d3ce[_0xe30f('0x3e')]),_0x814ade);if(_0x2571a9[_0xe30f('0x36')][_0xe30f('0x40')]){_0x5cb57f['where']=_[_0xe30f('0x41')](_0x5cb57f[_0xe30f('0x3d')],{'$or':[{'key':{'$like':'%'+_0x2571a9[_0xe30f('0x36')][_0xe30f('0x40')]+'%'}},{'value':{'$like':'%'+_0x2571a9[_0xe30f('0x36')][_0xe30f('0x40')]+'%'}}]});}_0x5cb57f=_[_0xe30f('0x41')]({},_0x5cb57f,_0x2571a9[_0xe30f('0x42')]);var _0x2126cb={'where':_0x5cb57f[_0xe30f('0x3d')]};return db[_0xe30f('0x43')][_0xe30f('0x20')](_0x2126cb)['then'](function(_0x19b30e){_0x2674ee[_0xe30f('0x20')]=_0x19b30e;if(_0x2571a9['query'][_0xe30f('0x44')]){_0x5cb57f[_0xe30f('0x45')]=[{'all':!![]}];}return db[_0xe30f('0x43')][_0xe30f('0x46')](_0x5cb57f);})[_0xe30f('0x27')](function(_0xbb192){_0x2674ee[_0xe30f('0x47')]=_0xbb192;return _0x2674ee;})['then'](respondWithFilteredResult(_0x268a17,_0x5cb57f))[_0xe30f('0x48')](handleError(_0x268a17,null));};exports[_0xe30f('0x49')]=function(_0x33853d,_0x3f9e0b){var _0x26562a={'raw':!![],'where':{'id':_0x33853d['params']['id']}},_0x55050f={};_0x55050f[_0xe30f('0x35')]=_[_0xe30f('0x37')](db[_0xe30f('0x43')][_0xe30f('0x31')]);_0x55050f[_0xe30f('0x36')]=_['keys'](_0x33853d[_0xe30f('0x36')]);_0x55050f[_0xe30f('0x3e')]=_[_0xe30f('0x4a')](_0x55050f[_0xe30f('0x35')],_0x55050f[_0xe30f('0x36')]);_0x26562a[_0xe30f('0x38')]=_[_0xe30f('0x4a')](_0x55050f[_0xe30f('0x35')],qs[_0xe30f('0x39')](_0x33853d[_0xe30f('0x36')][_0xe30f('0x39')]));_0x26562a['attributes']=_0x26562a[_0xe30f('0x38')][_0xe30f('0x4b')]?_0x26562a[_0xe30f('0x38')]:_0x55050f[_0xe30f('0x35')];if(_0x33853d[_0xe30f('0x36')][_0xe30f('0x44')]){_0x26562a['include']=[{'all':!![]}];}_0x26562a=_[_0xe30f('0x41')]({},_0x26562a,_0x33853d[_0xe30f('0x42')]);return db['CannedAnswer']['find'](_0x26562a)[_0xe30f('0x27')](handleEntityNotFound(_0x3f9e0b,null))[_0xe30f('0x27')](respondWithResult(_0x3f9e0b,null))['catch'](handleError(_0x3f9e0b,null));};exports[_0xe30f('0x25')]=function(_0x1c3091,_0x3a80f2){if(_0x1c3091['body']['id']){delete _0x1c3091['body']['id'];}return db[_0xe30f('0x43')][_0xe30f('0x4c')]({'where':{'id':_0x1c3091['params']['id']}})['then'](handleEntityNotFound(_0x3a80f2,null))[_0xe30f('0x27')](saveUpdates(_0x1c3091['body'],null))[_0xe30f('0x27')](respondWithResult(_0x3a80f2,null))[_0xe30f('0x48')](handleError(_0x3a80f2,null));};exports[_0xe30f('0x26')]=function(_0x343902,_0x396dec){return db['CannedAnswer'][_0xe30f('0x4c')]({'where':{'id':_0x343902[_0xe30f('0x4d')]['id']}})[_0xe30f('0x27')](handleEntityNotFound(_0x396dec,null))['then'](removeEntity(_0x396dec,null))['catch'](handleError(_0x396dec,null));};exports[_0xe30f('0x4e')]=function(_0x930a33,_0x10d9c8){var _0x27669e={'key':_0x930a33['body'][_0xe30f('0x34')]};if(_0x930a33[_0xe30f('0x4f')]['MailAccountId']){_0x27669e[_0xe30f('0x50')]=_0x930a33[_0xe30f('0x4f')][_0xe30f('0x50')];}else if(_0x930a33['body'][_0xe30f('0x51')]){_0x27669e[_0xe30f('0x51')]=_0x930a33[_0xe30f('0x4f')][_0xe30f('0x51')];}else if(_0x930a33[_0xe30f('0x4f')][_0xe30f('0x52')]){_0x27669e[_0xe30f('0x52')]=_0x930a33['body'][_0xe30f('0x52')];}else if(_0x930a33['body'][_0xe30f('0x53')]){_0x27669e[_0xe30f('0x53')]=_0x930a33[_0xe30f('0x4f')][_0xe30f('0x53')];}return db['CannedAnswer'][_0xe30f('0x4c')]({'where':_0x27669e})[_0xe30f('0x27')](function(_0x584ea4){if(_0x584ea4){throw new db[(_0xe30f('0x54'))][(_0xe30f('0x55'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xe30f('0x43')][_0xe30f('0x4e')](_0x930a33[_0xe30f('0x4f')]);})[_0xe30f('0x27')](function(_0x5ce76a){var _0x248420=_0x930a33[_0xe30f('0x56')][_0xe30f('0x28')]({'plain':!![]});if(!_0x248420)throw new Error(_0xe30f('0x57'));if(_0x248420[_0xe30f('0x58')]==='user'){var _0x520478=_0x5ce76a[_0xe30f('0x28')]({'plain':!![]});return db[_0xe30f('0x59')][_0xe30f('0x4c')]({'where':{'name':_0xe30f('0x29'),'userProfileId':_0x248420[_0xe30f('0x5a')]},'raw':!![]})[_0xe30f('0x27')](function(_0x2cd3a3){if(_0x2cd3a3&&_0x2cd3a3['autoAssociation']===0x0){return db['UserProfileResource'][_0xe30f('0x4e')]({'name':_0x520478[_0xe30f('0x2d')],'resourceId':_0x520478['id'],'type':_0x2cd3a3['name'],'sectionId':_0x2cd3a3['id']},{})['then'](function(){return _0x5ce76a;});}else{return _0x5ce76a;}})['catch'](function(_0x55da6a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55da6a);throw _0x55da6a;});}return _0x5ce76a;})[_0xe30f('0x27')](respondWithResult(_0x10d9c8,0xc9))[_0xe30f('0x48')](handleError(_0x10d9c8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 26ac684..ea06fb0 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 _0xd2c2=['moment','path','./cannedAnswer.attributes','exports','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x1efbac,_0x13c2f2){var _0xe9f7b7=function(_0x45bcad){while(--_0x45bcad){_0x1efbac['push'](_0x1efbac['shift']());}};_0xe9f7b7(++_0x13c2f2);}(_0xd2c2,0x1ce));var _0x2d2c=function(_0x45dd86,_0x55aa6d){_0x45dd86=_0x45dd86-0x0;var _0x54c94e=_0xd2c2[_0x45dd86];return _0x54c94e;};'use strict';var _=require('lodash');var util=require(_0x2d2c('0x0'));var logger=require(_0x2d2c('0x1'))('api');var moment=require(_0x2d2c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d2c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2d2c('0x4'));module[_0x2d2c('0x5')]=function(_0x15dd46,_0x233922){return _0x15dd46['define']('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d2c('0x6'),'collate':_0x2d2c('0x7')});}; \ No newline at end of file +var _0x091a=['bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','define','CannedAnswer','utf8mb4','util','../../config/logger','moment'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0x091a,0xc3));var _0xa091=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x091a[_0x23e7c1];return _0x1add43;};'use strict';var _=require('lodash');var util=require(_0xa091('0x0'));var logger=require(_0xa091('0x1'))('api');var moment=require(_0xa091('0x2'));var BPromise=require(_0xa091('0x3'));var rp=require(_0xa091('0x4'));var fs=require('fs');var path=require(_0xa091('0x5'));var rimraf=require(_0xa091('0x6'));var config=require('../../config/environment');var attributes=require(_0xa091('0x7'));module['exports']=function(_0xb80f44,_0x533be7){return _0xb80f44[_0xa091('0x8')](_0xa091('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa091('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index ac2e781..ea9a443 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(_0x35840c,_0x67da0e){var _0x33a43b=function(_0x18c1c6){while(--_0x18c1c6){_0x35840c['push'](_0x35840c['shift']());}};_0x33a43b(++_0x67da0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x332f33,_0x4f2fc8){var _0x5da200=function(_0xf90735){while(--_0xf90735){_0x332f33['push'](_0x332f33['shift']());}};_0x5da200(++_0x4f2fc8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 06a2dfd..90291ae 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 _0x95bd=['put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','show','create'];(function(_0x107df9,_0x4d1825){var _0x2df84a=function(_0x3330ed){while(--_0x3330ed){_0x107df9['push'](_0x107df9['shift']());}};_0x2df84a(++_0x4d1825);}(_0x95bd,0x16a));var _0xd95b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x95bd[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xd95b('0x0'));var util=require(_0xd95b('0x1'));var path=require(_0xd95b('0x2'));var timeout=require(_0xd95b('0x3'));var express=require(_0xd95b('0x4'));var router=express[_0xd95b('0x5')]();var fs_extra=require(_0xd95b('0x6'));var auth=require(_0xd95b('0x7'));var interaction=require(_0xd95b('0x8'));var config=require(_0xd95b('0x9'));var controller=require(_0xd95b('0xa'));router[_0xd95b('0xb')]('/',auth[_0xd95b('0xc')](),controller[_0xd95b('0xd')]);router[_0xd95b('0xb')]('/:id',auth[_0xd95b('0xc')](),controller[_0xd95b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd95b('0xf')]);router[_0xd95b('0x10')](_0xd95b('0x11'),auth[_0xd95b('0xc')](),controller[_0xd95b('0x12')]);router[_0xd95b('0x13')](_0xd95b('0x11'),auth['isAuthenticated'](),controller[_0xd95b('0x14')]);module['exports']=router; \ No newline at end of file +var _0xcc1a=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get','/:id','create','put','update','delete'];(function(_0xbbef15,_0x4c1afe){var _0x361b5c=function(_0x238f3d){while(--_0x238f3d){_0xbbef15['push'](_0xbbef15['shift']());}};_0x361b5c(++_0x4c1afe);}(_0xcc1a,0x87));var _0xacc1=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0xcc1a[_0x319e2e];return _0x302524;};'use strict';var multer=require(_0xacc1('0x0'));var util=require(_0xacc1('0x1'));var path=require(_0xacc1('0x2'));var timeout=require(_0xacc1('0x3'));var express=require(_0xacc1('0x4'));var router=express[_0xacc1('0x5')]();var fs_extra=require(_0xacc1('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xacc1('0x7'));var controller=require(_0xacc1('0x8'));router['get']('/',auth[_0xacc1('0x9')](),controller[_0xacc1('0xa')]);router[_0xacc1('0xb')](_0xacc1('0xc'),auth[_0xacc1('0x9')](),controller['show']);router['post']('/',auth[_0xacc1('0x9')](),controller[_0xacc1('0xd')]);router[_0xacc1('0xe')](_0xacc1('0xc'),auth[_0xacc1('0x9')](),controller[_0xacc1('0xf')]);router[_0xacc1('0x10')](_0xacc1('0xc'),auth[_0xacc1('0x9')](),controller[_0xacc1('0x11')]);module[_0xacc1('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4fdacbb..3f80087 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 _0xd382=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x1ca9eb,_0x99a10b){var _0x2e284e=function(_0x1196a4){while(--_0x1196a4){_0x1ca9eb['push'](_0x1ca9eb['shift']());}};_0x2e284e(++_0x99a10b);}(_0xd382,0x1b6));var _0x2d38=function(_0x14ad51,_0x13b689){_0x14ad51=_0x14ad51-0x0;var _0xc5128d=_0xd382[_0x14ad51];return _0xc5128d;};'use strict';var Sequelize=require(_0x2d38('0x0'));module[_0x2d38('0x1')]={'calldate':{'type':Sequelize[_0x2d38('0x2')],'allowNull':![],'defaultValue':_0x2d38('0x3')},'clid':{'type':Sequelize[_0x2d38('0x4')]},'src':{'type':Sequelize[_0x2d38('0x4')]},'dst':{'type':Sequelize[_0x2d38('0x4')]},'dcontext':{'type':Sequelize[_0x2d38('0x4')]},'channel':{'type':Sequelize[_0x2d38('0x4')]},'dstchannel':{'type':Sequelize[_0x2d38('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2d38('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2d38('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x2d38('0x4')]},'userfield':{'type':Sequelize[_0x2d38('0x4')]},'uniqueid':{'type':Sequelize[_0x2d38('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x2d38('0x4')]},'type':{'type':Sequelize[_0x2d38('0x4')]},'tag':{'type':Sequelize[_0x2d38('0x4')]}}; \ No newline at end of file +var _0x8b4f=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x2675d2,_0x38d27){var _0x49d4c7=function(_0x54438f){while(--_0x54438f){_0x2675d2['push'](_0x2675d2['shift']());}};_0x49d4c7(++_0x38d27);}(_0x8b4f,0x19d));var _0xf8b4=function(_0x26a4ea,_0xa72fb8){_0x26a4ea=_0x26a4ea-0x0;var _0x1b669e=_0x8b4f[_0x26a4ea];return _0x1b669e;};'use strict';var Sequelize=require(_0xf8b4('0x0'));module[_0xf8b4('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xf8b4('0x2')},'clid':{'type':Sequelize[_0xf8b4('0x3')]},'src':{'type':Sequelize[_0xf8b4('0x3')]},'dst':{'type':Sequelize[_0xf8b4('0x3')]},'dcontext':{'type':Sequelize[_0xf8b4('0x3')]},'channel':{'type':Sequelize[_0xf8b4('0x3')]},'dstchannel':{'type':Sequelize[_0xf8b4('0x3')]},'lastapp':{'type':Sequelize[_0xf8b4('0x3')]},'lastdata':{'type':Sequelize[_0xf8b4('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xf8b4('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf8b4('0x3')]},'amaflags':{'type':Sequelize[_0xf8b4('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xf8b4('0x3')]},'uniqueid':{'type':Sequelize[_0xf8b4('0x3')]},'linkedid':{'type':Sequelize[_0xf8b4('0x3')]},'sequence':{'type':Sequelize[_0xf8b4('0x3')]},'peeraccount':{'type':Sequelize[_0xf8b4('0x3')]},'type':{'type':Sequelize[_0xf8b4('0x3')]},'tag':{'type':Sequelize[_0xf8b4('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 0eb0d71..b897f61 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 _0x6eed=['stack','name','index','map','Cdr','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','params','rawAttributes','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','end','error'];(function(_0xc581cc,_0x1e68d2){var _0x35bb90=function(_0x365361){while(--_0x365361){_0xc581cc['push'](_0xc581cc['shift']());}};_0x35bb90(++_0x1e68d2);}(_0x6eed,0xff));var _0xd6ee=function(_0x2e6b07,_0x581517){_0x2e6b07=_0x2e6b07-0x0;var _0x113ea9=_0x6eed[_0x2e6b07];return _0x113ea9;};'use strict';var emlformat=require(_0xd6ee('0x0'));var rimraf=require(_0xd6ee('0x1'));var zipdir=require(_0xd6ee('0x2'));var jsonpatch=require(_0xd6ee('0x3'));var rp=require(_0xd6ee('0x4'));var moment=require('moment');var BPromise=require(_0xd6ee('0x5'));var Mustache=require(_0xd6ee('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd6ee('0x7'));var csv=require(_0xd6ee('0x8'));var ejs=require(_0xd6ee('0x9'));var fs=require('fs');var fs_extra=require(_0xd6ee('0xa'));var _=require(_0xd6ee('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd6ee('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd6ee('0xd'));var Redis=require(_0xd6ee('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd6ee('0xf'));var as=require(_0xd6ee('0x10'));var hardwareService=require(_0xd6ee('0x11'));var logger=require(_0xd6ee('0x12'))('api');var utils=require(_0xd6ee('0x13'));var config=require(_0xd6ee('0x14'));var licenseUtil=require(_0xd6ee('0x15'));var db=require(_0xd6ee('0x16'))['db'];function respondWithStatusCode(_0x268dd1,_0x3fd1df){_0x3fd1df=_0x3fd1df||0xcc;return function(_0x48be63){if(_0x48be63){return _0x268dd1[_0xd6ee('0x17')](_0x3fd1df);}return _0x268dd1[_0xd6ee('0x18')](_0x3fd1df)['end']();};}function respondWithResult(_0x369b4a,_0x15918d){_0x15918d=_0x15918d||0xc8;return function(_0x2bf3b2){if(_0x2bf3b2){return _0x369b4a[_0xd6ee('0x18')](_0x15918d)[_0xd6ee('0x19')](_0x2bf3b2);}};}function respondWithFilteredResult(_0xe66d0d,_0x49bafc){return function(_0x1c2e51){if(_0x1c2e51){var _0xb99b70=typeof _0x49bafc[_0xd6ee('0x1a')]==='undefined'&&typeof _0x49bafc[_0xd6ee('0x1b')]==='undefined';var _0x3a82bf=_0x1c2e51[_0xd6ee('0x1c')];var _0x81d533=_0xb99b70?0x0:_0x49bafc['offset'];var _0x8a2718=_0xb99b70?_0x1c2e51['count']:_0x49bafc[_0xd6ee('0x1a')]+_0x49bafc['limit'];var _0x31ae0f;if(_0x8a2718>=_0x3a82bf){_0x8a2718=_0x3a82bf;_0x31ae0f=0xc8;}else{_0x31ae0f=0xce;}_0xe66d0d[_0xd6ee('0x18')](_0x31ae0f);return _0xe66d0d[_0xd6ee('0x1d')](_0xd6ee('0x1e'),_0x81d533+'-'+_0x8a2718+'/'+_0x3a82bf)[_0xd6ee('0x19')](_0x1c2e51);}return null;};}function patchUpdates(_0x4b33f1){return function(_0xe2f8c4){try{jsonpatch['apply'](_0xe2f8c4,_0x4b33f1,!![]);}catch(_0x17e011){return BPromise[_0xd6ee('0x1f')](_0x17e011);}return _0xe2f8c4[_0xd6ee('0x20')]();};}function saveUpdates(_0x1abedc,_0xec9287){return function(_0x48e6ad){if(_0x48e6ad){return _0x48e6ad['update'](_0x1abedc)[_0xd6ee('0x21')](function(_0x511c18){return _0x511c18;});}return null;};}function removeEntity(_0x2bae66,_0x519373){return function(_0x391844){if(_0x391844){return _0x391844[_0xd6ee('0x22')]()[_0xd6ee('0x21')](function(){_0x2bae66[_0xd6ee('0x18')](0xcc)[_0xd6ee('0x23')]();});}};}function handleEntityNotFound(_0x5476f2,_0x4b1926){return function(_0x2f438c){if(!_0x2f438c){_0x5476f2[_0xd6ee('0x17')](0x194);}return _0x2f438c;};}function handleError(_0x4edb7d,_0x2c9b30){_0x2c9b30=_0x2c9b30||0x1f4;return function(_0xa1e700){logger[_0xd6ee('0x24')](_0xa1e700[_0xd6ee('0x25')]);if(_0xa1e700[_0xd6ee('0x26')]){delete _0xa1e700[_0xd6ee('0x26')];}_0x4edb7d[_0xd6ee('0x18')](_0x2c9b30)['send'](_0xa1e700);};}exports[_0xd6ee('0x27')]=function(_0x124ab7,_0x50b786){var _0x5bcdd6={},_0x1578b3={},_0x4580a7={'count':0x0,'rows':[]};var _0xddca=_[_0xd6ee('0x28')](db[_0xd6ee('0x29')]['rawAttributes'],function(_0x414015){return{'name':_0x414015[_0xd6ee('0x2a')],'type':_0x414015[_0xd6ee('0x2b')]['key']};});_0x1578b3[_0xd6ee('0x2c')]=_[_0xd6ee('0x28')](_0xddca,_0xd6ee('0x26'));_0x1578b3['query']=_[_0xd6ee('0x2d')](_0x124ab7[_0xd6ee('0x2e')]);_0x1578b3[_0xd6ee('0x2f')]=_[_0xd6ee('0x30')](_0x1578b3[_0xd6ee('0x2c')],_0x1578b3[_0xd6ee('0x2e')]);_0x5bcdd6['attributes']=_[_0xd6ee('0x30')](_0x1578b3[_0xd6ee('0x2c')],qs[_0xd6ee('0x31')](_0x124ab7[_0xd6ee('0x2e')]['fields']));_0x5bcdd6[_0xd6ee('0x32')]=_0x5bcdd6[_0xd6ee('0x32')][_0xd6ee('0x33')]?_0x5bcdd6['attributes']:_0x1578b3['model'];if(!_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x34')](_0xd6ee('0x35'))){_0x5bcdd6[_0xd6ee('0x1b')]=qs[_0xd6ee('0x1b')](_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x1b')]);_0x5bcdd6[_0xd6ee('0x1a')]=qs[_0xd6ee('0x1a')](_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x1a')]);}_0x5bcdd6[_0xd6ee('0x36')]=qs[_0xd6ee('0x37')](_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x37')]);_0x5bcdd6['where']=qs[_0xd6ee('0x2f')](_[_0xd6ee('0x38')](_0x124ab7[_0xd6ee('0x2e')],_0x1578b3['filters']),_0xddca);if(_0x124ab7['query']['filter']){_0x5bcdd6['where']=_[_0xd6ee('0x39')](_0x5bcdd6[_0xd6ee('0x3a')],{'$or':_[_0xd6ee('0x28')](_0xddca,function(_0x2a6d2f){if(_0x2a6d2f[_0xd6ee('0x2b')]!==_0xd6ee('0x3b')){var _0x2c975a={};_0x2c975a[_0x2a6d2f['name']]={'$like':'%'+_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x3c')]+'%'};return _0x2c975a;}})});}_0x5bcdd6=_[_0xd6ee('0x39')]({},_0x5bcdd6,_0x124ab7[_0xd6ee('0x3d')]);var _0x407748={'where':_0x5bcdd6[_0xd6ee('0x3a')]};return db[_0xd6ee('0x29')][_0xd6ee('0x1c')](_0x407748)[_0xd6ee('0x21')](function(_0x24a7cb){_0x4580a7['count']=_0x24a7cb;if(_0x124ab7['query']['includeAll']){_0x5bcdd6[_0xd6ee('0x3e')]=[{'all':!![]}];}return db['Cdr'][_0xd6ee('0x3f')](_0x5bcdd6);})[_0xd6ee('0x21')](function(_0x96aa7f){_0x4580a7[_0xd6ee('0x40')]=_0x96aa7f;return _0x4580a7;})[_0xd6ee('0x21')](respondWithFilteredResult(_0x50b786,_0x5bcdd6))['catch'](handleError(_0x50b786,null));};exports['show']=function(_0x4db1e9,_0x557936){var _0x3337a1={'raw':!![],'where':{'id':_0x4db1e9[_0xd6ee('0x41')]['id']}},_0xf38fc4={};_0xf38fc4[_0xd6ee('0x2c')]=_[_0xd6ee('0x2d')](db[_0xd6ee('0x29')][_0xd6ee('0x42')]);_0xf38fc4[_0xd6ee('0x2e')]=_[_0xd6ee('0x2d')](_0x4db1e9['query']);_0xf38fc4[_0xd6ee('0x2f')]=_[_0xd6ee('0x30')](_0xf38fc4['model'],_0xf38fc4[_0xd6ee('0x2e')]);_0x3337a1['attributes']=_['intersection'](_0xf38fc4[_0xd6ee('0x2c')],qs[_0xd6ee('0x31')](_0x4db1e9[_0xd6ee('0x2e')][_0xd6ee('0x31')]));_0x3337a1[_0xd6ee('0x32')]=_0x3337a1[_0xd6ee('0x32')]['length']?_0x3337a1['attributes']:_0xf38fc4[_0xd6ee('0x2c')];if(_0x4db1e9[_0xd6ee('0x2e')]['includeAll']){_0x3337a1[_0xd6ee('0x3e')]=[{'all':!![]}];}_0x3337a1=_['merge']({},_0x3337a1,_0x4db1e9[_0xd6ee('0x3d')]);return db[_0xd6ee('0x29')][_0xd6ee('0x43')](_0x3337a1)[_0xd6ee('0x21')](handleEntityNotFound(_0x557936,null))[_0xd6ee('0x21')](respondWithResult(_0x557936,null))[_0xd6ee('0x44')](handleError(_0x557936,null));};exports[_0xd6ee('0x45')]=function(_0x1b02c4,_0x37c3ba){return db[_0xd6ee('0x29')][_0xd6ee('0x45')](_0x1b02c4['body'],{})[_0xd6ee('0x21')](respondWithResult(_0x37c3ba,0xc9))[_0xd6ee('0x44')](handleError(_0x37c3ba,null));};exports[_0xd6ee('0x46')]=function(_0x360e34,_0x418680){if(_0x360e34[_0xd6ee('0x47')]['id']){delete _0x360e34[_0xd6ee('0x47')]['id'];}return db[_0xd6ee('0x29')][_0xd6ee('0x43')]({'where':{'id':_0x360e34[_0xd6ee('0x41')]['id']}})[_0xd6ee('0x21')](handleEntityNotFound(_0x418680,null))[_0xd6ee('0x21')](saveUpdates(_0x360e34['body'],null))[_0xd6ee('0x21')](respondWithResult(_0x418680,null))[_0xd6ee('0x44')](handleError(_0x418680,null));};exports[_0xd6ee('0x22')]=function(_0x52dfd3,_0x2f1bef){return db['Cdr'][_0xd6ee('0x43')]({'where':{'id':_0x52dfd3['params']['id']}})[_0xd6ee('0x21')](handleEntityNotFound(_0x2f1bef,null))[_0xd6ee('0x21')](removeEntity(_0x2f1bef,null))['catch'](handleError(_0x2f1bef,null));};exports[_0xd6ee('0x48')]=function(_0x164df4,_0xaef499){return db['Cdr'][_0xd6ee('0x48')]()[_0xd6ee('0x21')](respondWithResult(_0xaef499,null))['catch'](handleError(_0xaef499,null));}; \ No newline at end of file +var _0xe0c3=['request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','end','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','Cdr','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch'];(function(_0x35ccc0,_0x10a8fc){var _0xa01659=function(_0x4114fd){while(--_0x4114fd){_0x35ccc0['push'](_0x35ccc0['shift']());}};_0xa01659(++_0x10a8fc);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x3e0c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3e0c('0x1'));var jsonpatch=require(_0x3e0c('0x2'));var rp=require(_0x3e0c('0x3'));var moment=require(_0x3e0c('0x4'));var BPromise=require(_0x3e0c('0x5'));var Mustache=require(_0x3e0c('0x6'));var util=require(_0x3e0c('0x7'));var path=require(_0x3e0c('0x8'));var sox=require(_0x3e0c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e0c('0xa'));var _=require(_0x3e0c('0xb'));var squel=require(_0x3e0c('0xc'));var crypto=require(_0x3e0c('0xd'));var jsforce=require(_0x3e0c('0xe'));var deskjs=require(_0x3e0c('0xf'));var toCsv=require(_0x3e0c('0x10'));var querystring=require(_0x3e0c('0x11'));var Papa=require(_0x3e0c('0x12'));var Redis=require(_0x3e0c('0x13'));var authService=require(_0x3e0c('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e0c('0x15'));var logger=require(_0x3e0c('0x16'))(_0x3e0c('0x17'));var utils=require(_0x3e0c('0x18'));var config=require(_0x3e0c('0x19'));var licenseUtil=require(_0x3e0c('0x1a'));var db=require(_0x3e0c('0x1b'))['db'];function respondWithStatusCode(_0x5dc732,_0x38b416){_0x38b416=_0x38b416||0xcc;return function(_0x491432){if(_0x491432){return _0x5dc732[_0x3e0c('0x1c')](_0x38b416);}return _0x5dc732[_0x3e0c('0x1d')](_0x38b416)['end']();};}function respondWithResult(_0x5f2654,_0x6d9c61){_0x6d9c61=_0x6d9c61||0xc8;return function(_0x409b2c){if(_0x409b2c){return _0x5f2654[_0x3e0c('0x1d')](_0x6d9c61)[_0x3e0c('0x1e')](_0x409b2c);}};}function respondWithFilteredResult(_0x15a269,_0x24fcf9){return function(_0x1947c2){if(_0x1947c2){var _0x274d75=typeof _0x24fcf9[_0x3e0c('0x1f')]===_0x3e0c('0x20')&&typeof _0x24fcf9[_0x3e0c('0x21')]==='undefined';var _0x58c498=_0x1947c2[_0x3e0c('0x22')];var _0x216993=_0x274d75?0x0:_0x24fcf9[_0x3e0c('0x1f')];var _0x41b19f=_0x274d75?_0x1947c2[_0x3e0c('0x22')]:_0x24fcf9[_0x3e0c('0x1f')]+_0x24fcf9['limit'];var _0x2e4a4a;if(_0x41b19f>=_0x58c498){_0x41b19f=_0x58c498;_0x2e4a4a=0xc8;}else{_0x2e4a4a=0xce;}_0x15a269[_0x3e0c('0x1d')](_0x2e4a4a);return _0x15a269[_0x3e0c('0x23')]('Content-Range',_0x216993+'-'+_0x41b19f+'/'+_0x58c498)[_0x3e0c('0x1e')](_0x1947c2);}return null;};}function patchUpdates(_0x5e3a93){return function(_0x479265){try{jsonpatch[_0x3e0c('0x24')](_0x479265,_0x5e3a93,!![]);}catch(_0x1f3bad){return BPromise[_0x3e0c('0x25')](_0x1f3bad);}return _0x479265[_0x3e0c('0x26')]();};}function saveUpdates(_0x4f8d38,_0x4cd447){return function(_0x3320c6){if(_0x3320c6){return _0x3320c6['update'](_0x4f8d38)['then'](function(_0x3fd7de){return _0x3fd7de;});}return null;};}function removeEntity(_0x1769b1,_0x44ce68){return function(_0x5bb7aa){if(_0x5bb7aa){return _0x5bb7aa[_0x3e0c('0x27')]()[_0x3e0c('0x28')](function(){_0x1769b1['status'](0xcc)[_0x3e0c('0x29')]();});}};}function handleEntityNotFound(_0x3de58b,_0x308fd5){return function(_0x1db945){if(!_0x1db945){_0x3de58b['sendStatus'](0x194);}return _0x1db945;};}function handleError(_0x412960,_0xc2f3cc){_0xc2f3cc=_0xc2f3cc||0x1f4;return function(_0x2c5fba){logger[_0x3e0c('0x2a')](_0x2c5fba['stack']);if(_0x2c5fba[_0x3e0c('0x2b')]){delete _0x2c5fba['name'];}_0x412960['status'](_0xc2f3cc)[_0x3e0c('0x2c')](_0x2c5fba);};}exports[_0x3e0c('0x2d')]=function(_0x4d3ce2,_0x16fb92){var _0x3f22b1={},_0x21d7a0={},_0x59c22f={'count':0x0,'rows':[]};var _0x44ecad=_[_0x3e0c('0x2e')](db['Cdr'][_0x3e0c('0x2f')],function(_0x2f31ad){return{'name':_0x2f31ad[_0x3e0c('0x30')],'type':_0x2f31ad[_0x3e0c('0x31')]['key']};});_0x21d7a0[_0x3e0c('0x32')]=_[_0x3e0c('0x2e')](_0x44ecad,_0x3e0c('0x2b'));_0x21d7a0['query']=_[_0x3e0c('0x33')](_0x4d3ce2[_0x3e0c('0x34')]);_0x21d7a0[_0x3e0c('0x35')]=_['intersection'](_0x21d7a0[_0x3e0c('0x32')],_0x21d7a0[_0x3e0c('0x34')]);_0x3f22b1[_0x3e0c('0x36')]=_[_0x3e0c('0x37')](_0x21d7a0[_0x3e0c('0x32')],qs[_0x3e0c('0x38')](_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x38')]));_0x3f22b1[_0x3e0c('0x36')]=_0x3f22b1[_0x3e0c('0x36')][_0x3e0c('0x39')]?_0x3f22b1[_0x3e0c('0x36')]:_0x21d7a0[_0x3e0c('0x32')];if(!_0x4d3ce2[_0x3e0c('0x34')]['hasOwnProperty'](_0x3e0c('0x3a'))){_0x3f22b1[_0x3e0c('0x21')]=qs[_0x3e0c('0x21')](_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x21')]);_0x3f22b1[_0x3e0c('0x1f')]=qs[_0x3e0c('0x1f')](_0x4d3ce2[_0x3e0c('0x34')]['offset']);}_0x3f22b1['order']=qs[_0x3e0c('0x3b')](_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x3b')]);_0x3f22b1[_0x3e0c('0x3c')]=qs[_0x3e0c('0x35')](_[_0x3e0c('0x3d')](_0x4d3ce2['query'],_0x21d7a0[_0x3e0c('0x35')]),_0x44ecad);if(_0x4d3ce2[_0x3e0c('0x34')]['filter']){_0x3f22b1['where']=_['merge'](_0x3f22b1[_0x3e0c('0x3c')],{'$or':_[_0x3e0c('0x2e')](_0x44ecad,function(_0x3d6ed7){if(_0x3d6ed7[_0x3e0c('0x31')]!==_0x3e0c('0x3e')){var _0x45ec69={};_0x45ec69[_0x3d6ed7[_0x3e0c('0x2b')]]={'$like':'%'+_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x3f')]+'%'};return _0x45ec69;}})});}_0x3f22b1=_[_0x3e0c('0x40')]({},_0x3f22b1,_0x4d3ce2[_0x3e0c('0x41')]);var _0x20135d={'where':_0x3f22b1['where']};return db['Cdr']['count'](_0x20135d)[_0x3e0c('0x28')](function(_0x22fcd8){_0x59c22f['count']=_0x22fcd8;if(_0x4d3ce2['query'][_0x3e0c('0x42')]){_0x3f22b1[_0x3e0c('0x43')]=[{'all':!![]}];}return db[_0x3e0c('0x44')][_0x3e0c('0x45')](_0x3f22b1);})['then'](function(_0x2e562f){_0x59c22f[_0x3e0c('0x46')]=_0x2e562f;return _0x59c22f;})[_0x3e0c('0x28')](respondWithFilteredResult(_0x16fb92,_0x3f22b1))[_0x3e0c('0x47')](handleError(_0x16fb92,null));};exports[_0x3e0c('0x48')]=function(_0x4b5638,_0x1bc4b3){var _0x5f4274={'raw':!![],'where':{'id':_0x4b5638[_0x3e0c('0x49')]['id']}},_0x35111f={};_0x35111f['model']=_['keys'](db[_0x3e0c('0x44')][_0x3e0c('0x2f')]);_0x35111f['query']=_[_0x3e0c('0x33')](_0x4b5638[_0x3e0c('0x34')]);_0x35111f[_0x3e0c('0x35')]=_[_0x3e0c('0x37')](_0x35111f[_0x3e0c('0x32')],_0x35111f[_0x3e0c('0x34')]);_0x5f4274['attributes']=_[_0x3e0c('0x37')](_0x35111f[_0x3e0c('0x32')],qs[_0x3e0c('0x38')](_0x4b5638[_0x3e0c('0x34')][_0x3e0c('0x38')]));_0x5f4274[_0x3e0c('0x36')]=_0x5f4274['attributes'][_0x3e0c('0x39')]?_0x5f4274[_0x3e0c('0x36')]:_0x35111f[_0x3e0c('0x32')];if(_0x4b5638['query'][_0x3e0c('0x42')]){_0x5f4274[_0x3e0c('0x43')]=[{'all':!![]}];}_0x5f4274=_['merge']({},_0x5f4274,_0x4b5638[_0x3e0c('0x41')]);return db[_0x3e0c('0x44')][_0x3e0c('0x4a')](_0x5f4274)['then'](handleEntityNotFound(_0x1bc4b3,null))[_0x3e0c('0x28')](respondWithResult(_0x1bc4b3,null))[_0x3e0c('0x47')](handleError(_0x1bc4b3,null));};exports[_0x3e0c('0x4b')]=function(_0x2c7b8c,_0x109078){return db[_0x3e0c('0x44')][_0x3e0c('0x4b')](_0x2c7b8c[_0x3e0c('0x4c')],{})[_0x3e0c('0x28')](respondWithResult(_0x109078,0xc9))[_0x3e0c('0x47')](handleError(_0x109078,null));};exports[_0x3e0c('0x4d')]=function(_0x4efbf2,_0x20c9df){if(_0x4efbf2['body']['id']){delete _0x4efbf2['body']['id'];}return db[_0x3e0c('0x44')]['find']({'where':{'id':_0x4efbf2[_0x3e0c('0x49')]['id']}})[_0x3e0c('0x28')](handleEntityNotFound(_0x20c9df,null))['then'](saveUpdates(_0x4efbf2[_0x3e0c('0x4c')],null))[_0x3e0c('0x28')](respondWithResult(_0x20c9df,null))['catch'](handleError(_0x20c9df,null));};exports[_0x3e0c('0x27')]=function(_0x3e04c9,_0x166203){return db[_0x3e0c('0x44')][_0x3e0c('0x4a')]({'where':{'id':_0x3e04c9[_0x3e0c('0x49')]['id']}})[_0x3e0c('0x28')](handleEntityNotFound(_0x166203,null))[_0x3e0c('0x28')](removeEntity(_0x166203,null))[_0x3e0c('0x47')](handleError(_0x166203,null));};exports[_0x3e0c('0x4e')]=function(_0x4d0f77,_0x3743ae){return db[_0x3e0c('0x44')][_0x3e0c('0x4e')]()[_0x3e0c('0x28')](respondWithResult(_0x3743ae,null))[_0x3e0c('0x47')](handleError(_0x3743ae,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index ea5ad15..456b01a 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x17db91,_0x2214d0){var _0x2f6f51=function(_0x4acb6a){while(--_0x4acb6a){_0x17db91['push'](_0x17db91['shift']());}};_0x2f6f51(++_0x2214d0);}(_0x7a54,0x106));var _0x47a5=function(_0x2ecb26,_0x2a8575){_0x2ecb26=_0x2ecb26-0x0;var _0x4d6651=_0x7a54[_0x2ecb26];return _0x4d6651;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x3c1983,_0x4f1a86){var _0x195b59=function(_0x31aeed){while(--_0x31aeed){_0x3c1983['push'](_0x3c1983['shift']());}};_0x195b59(++_0x4f1a86);}(_0x7a54,0x106));var _0x47a5=function(_0x2bfa24,_0x145243){_0x2bfa24=_0x2bfa24-0x0;var _0x44349d=_0x7a54[_0x2bfa24];return _0x44349d;};'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 15b3220..27ad793 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 _0x555d=['request','Cdr,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x555d,0x1d8));var _0xd555=function(_0x27c4da,_0x524970){_0x27c4da=_0x27c4da-0x0;var _0xdcb26f=_0x555d[_0x27c4da];return _0xdcb26f;};'use strict';var _=require(_0xd555('0x0'));var util=require(_0xd555('0x1'));var moment=require(_0xd555('0x2'));var BPromise=require(_0xd555('0x3'));var rs=require(_0xd555('0x4'));var fs=require('fs');var Redis=require(_0xd555('0x5'));var db=require(_0xd555('0x6'))['db'];var utils=require(_0xd555('0x7'));var logger=require(_0xd555('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd555('0x9'));var client=jayson[_0xd555('0xa')][_0xd555('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1018c5,_0x2c6faf,_0x35c04b){return new BPromise(function(_0x4fac1c,_0x5ed4b3){return client[_0xd555('0xc')](_0x1018c5,_0x35c04b)['then'](function(_0x4d2389){logger['info'](_0xd555('0xd'),_0x2c6faf,_0xd555('0xe'));logger[_0xd555('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x2c6faf,_0xd555('0xe'),JSON['stringify'](_0x4d2389));if(_0x4d2389['error']){if(_0x4d2389[_0xd555('0x10')][_0xd555('0x11')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x2c6faf,_0x4d2389['error'][_0xd555('0x12')]);return _0x5ed4b3(_0x4d2389['error'][_0xd555('0x12')]);}logger[_0xd555('0x10')]('Cdr,\x20%s,\x20%s',_0x2c6faf,_0x4d2389['error'][_0xd555('0x12')]);return _0x4fac1c(_0x4d2389['error'][_0xd555('0x12')]);}else{logger[_0xd555('0x13')]('Cdr,\x20%s,\x20%s',_0x2c6faf,_0xd555('0xe'));_0x4fac1c(_0x4d2389[_0xd555('0x14')][_0xd555('0x12')]);}})[_0xd555('0x15')](function(_0xebcab8){logger[_0xd555('0x10')](_0xd555('0xd'),_0x2c6faf,_0xebcab8);_0x5ed4b3(_0xebcab8);});});} \ No newline at end of file +var _0x9c8a=['client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x291113,_0x28da65){var _0x496e27=function(_0x5aa5de){while(--_0x5aa5de){_0x291113['push'](_0x291113['shift']());}};_0x496e27(++_0x28da65);}(_0x9c8a,0x1e9));var _0xa9c8=function(_0x40b9f6,_0xcdf026){_0x40b9f6=_0x40b9f6-0x0;var _0x229e6f=_0x9c8a[_0x40b9f6];return _0x229e6f;};'use strict';var _=require(_0xa9c8('0x0'));var util=require(_0xa9c8('0x1'));var moment=require(_0xa9c8('0x2'));var BPromise=require(_0xa9c8('0x3'));var rs=require(_0xa9c8('0x4'));var fs=require('fs');var Redis=require(_0xa9c8('0x5'));var db=require(_0xa9c8('0x6'))['db'];var utils=require(_0xa9c8('0x7'));var logger=require(_0xa9c8('0x8'))('rpc');var config=require(_0xa9c8('0x9'));var jayson=require(_0xa9c8('0xa'));var client=jayson[_0xa9c8('0xb')][_0xa9c8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c991d,_0x4d56f5,_0x26c5d5){return new BPromise(function(_0x561562,_0x4ccac9){return client[_0xa9c8('0xd')](_0x2c991d,_0x26c5d5)[_0xa9c8('0xe')](function(_0x23f442){logger[_0xa9c8('0xf')](_0xa9c8('0x10'),_0x4d56f5,_0xa9c8('0x11'));logger['debug'](_0xa9c8('0x12'),_0x4d56f5,_0xa9c8('0x11'),JSON[_0xa9c8('0x13')](_0x23f442));if(_0x23f442[_0xa9c8('0x14')]){if(_0x23f442[_0xa9c8('0x14')][_0xa9c8('0x15')]===0x1f4){logger[_0xa9c8('0x14')]('Cdr,\x20%s,\x20%s',_0x4d56f5,_0x23f442[_0xa9c8('0x14')]['message']);return _0x4ccac9(_0x23f442[_0xa9c8('0x14')][_0xa9c8('0x16')]);}logger[_0xa9c8('0x14')](_0xa9c8('0x10'),_0x4d56f5,_0x23f442[_0xa9c8('0x14')]['message']);return _0x561562(_0x23f442[_0xa9c8('0x14')][_0xa9c8('0x16')]);}else{logger[_0xa9c8('0xf')]('Cdr,\x20%s,\x20%s',_0x4d56f5,_0xa9c8('0x11'));_0x561562(_0x23f442[_0xa9c8('0x17')][_0xa9c8('0x16')]);}})[_0xa9c8('0x18')](function(_0x52ef57){logger[_0xa9c8('0x14')](_0xa9c8('0x10'),_0x4d56f5,_0x52ef57);_0x4ccac9(_0x52ef57);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index dcb494b..6168768 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x5a7d41,_0x4447e2){var _0x98d8fa=function(_0x2ce1cf){while(--_0x2ce1cf){_0x5a7d41['push'](_0x5a7d41['shift']());}};_0x98d8fa(++_0x4447e2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 320c0d1..1c92763 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 _0xbf3b=['INTEGER','STRING','noop','*,*,*,*','exports'];(function(_0x133425,_0x2d60f2){var _0x45c4a4=function(_0x39b453){while(--_0x39b453){_0x133425['push'](_0x133425['shift']());}};_0x45c4a4(++_0x2d60f2);}(_0xbf3b,0xe5));var _0xbbf3=function(_0x27f494,_0x29b540){_0x27f494=_0x27f494-0x0;var _0x41a897=_0xbf3b[_0x27f494];return _0x41a897;};'use strict';var Sequelize=require('sequelize');module[_0xbbf3('0x0')]={'priority':{'type':Sequelize[_0xbbf3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbbf3('0x2')],'allowNull':![],'defaultValue':_0xbbf3('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xbbf3('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbbf3('0x4')}}; \ No newline at end of file +var _0x4d06=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4d06,0xaa));var _0x64d0=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x4d06[_0x81dcac];return _0xc7803b;};'use strict';var Sequelize=require(_0x64d0('0x0'));module[_0x64d0('0x1')]={'priority':{'type':Sequelize[_0x64d0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x64d0('0x3')],'allowNull':![],'defaultValue':_0x64d0('0x4')},'appdata':{'type':Sequelize[_0x64d0('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x64d0('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index e7652bd..7638dc1 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 _0x9a62=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','params','ChatApplication','rawAttributes','query','keys','filters','attributes','intersection','model','fields','length','includeAll','include','merge','options','find','catch','body','destroy','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce'];(function(_0xc242ef,_0x18213a){var _0x425590=function(_0x55049e){while(--_0x55049e){_0xc242ef['push'](_0xc242ef['shift']());}};_0x425590(++_0x18213a);}(_0x9a62,0x1bc));var _0x29a6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9a62[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29a6('0x0'));var zipdir=require(_0x29a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29a6('0x2'));var moment=require(_0x29a6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29a6('0x4'));var path=require(_0x29a6('0x5'));var sox=require(_0x29a6('0x6'));var csv=require(_0x29a6('0x7'));var ejs=require(_0x29a6('0x8'));var fs=require('fs');var fs_extra=require(_0x29a6('0x9'));var _=require(_0x29a6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x29a6('0xb'));var deskjs=require(_0x29a6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x29a6('0xd'));var Redis=require(_0x29a6('0xe'));var authService=require(_0x29a6('0xf'));var qs=require(_0x29a6('0x10'));var as=require(_0x29a6('0x11'));var hardwareService=require(_0x29a6('0x12'));var logger=require(_0x29a6('0x13'))('api');var utils=require(_0x29a6('0x14'));var config=require(_0x29a6('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e918f,_0x1d78fa){_0x1d78fa=_0x1d78fa||0xcc;return function(_0x7acc03){if(_0x7acc03){return _0x4e918f['sendStatus'](_0x1d78fa);}return _0x4e918f[_0x29a6('0x16')](_0x1d78fa)[_0x29a6('0x17')]();};}function respondWithResult(_0x535e3a,_0x50c663){_0x50c663=_0x50c663||0xc8;return function(_0x36d6fd){if(_0x36d6fd){return _0x535e3a[_0x29a6('0x16')](_0x50c663)['json'](_0x36d6fd);}};}function respondWithFilteredResult(_0x389255,_0x22378a){return function(_0x307dd9){if(_0x307dd9){var _0x4fef5c=typeof _0x22378a[_0x29a6('0x18')]===_0x29a6('0x19')&&typeof _0x22378a[_0x29a6('0x1a')]===_0x29a6('0x19');var _0x2ccb06=_0x307dd9[_0x29a6('0x1b')];var _0xa3d845=_0x4fef5c?0x0:_0x22378a[_0x29a6('0x18')];var _0x4c8cbc=_0x4fef5c?_0x307dd9[_0x29a6('0x1b')]:_0x22378a['offset']+_0x22378a[_0x29a6('0x1a')];var _0x35bc3b;if(_0x4c8cbc>=_0x2ccb06){_0x4c8cbc=_0x2ccb06;_0x35bc3b=0xc8;}else{_0x35bc3b=0xce;}_0x389255[_0x29a6('0x16')](_0x35bc3b);return _0x389255['set'](_0x29a6('0x1c'),_0xa3d845+'-'+_0x4c8cbc+'/'+_0x2ccb06)['json'](_0x307dd9);}return null;};}function patchUpdates(_0x4da844){return function(_0x5a8d55){try{jsonpatch[_0x29a6('0x1d')](_0x5a8d55,_0x4da844,!![]);}catch(_0x319573){return BPromise[_0x29a6('0x1e')](_0x319573);}return _0x5a8d55[_0x29a6('0x1f')]();};}function saveUpdates(_0x36c103,_0x552bc7){return function(_0x13341e){if(_0x13341e){return _0x13341e[_0x29a6('0x20')](_0x36c103)[_0x29a6('0x21')](function(_0x3ed7de){return _0x3ed7de;});}return null;};}function removeEntity(_0x46fcc7,_0x2dc6c0){return function(_0xedfa4){if(_0xedfa4){return _0xedfa4['destroy']()[_0x29a6('0x21')](function(){_0x46fcc7[_0x29a6('0x16')](0xcc)[_0x29a6('0x17')]();});}};}function handleEntityNotFound(_0x2280f7,_0x1798dd){return function(_0x17b835){if(!_0x17b835){_0x2280f7[_0x29a6('0x22')](0x194);}return _0x17b835;};}function handleError(_0x4ce577,_0x483d22){_0x483d22=_0x483d22||0x1f4;return function(_0x5a67df){logger[_0x29a6('0x23')](_0x5a67df[_0x29a6('0x24')]);if(_0x5a67df[_0x29a6('0x25')]){delete _0x5a67df[_0x29a6('0x25')];}_0x4ce577[_0x29a6('0x16')](_0x483d22)['send'](_0x5a67df);};}exports['show']=function(_0x31c2e4,_0x3607b3){var _0x4c5cb8={'raw':!![],'where':{'id':_0x31c2e4[_0x29a6('0x26')]['id']}},_0x454df0={};_0x454df0['model']=_['keys'](db[_0x29a6('0x27')][_0x29a6('0x28')]);_0x454df0[_0x29a6('0x29')]=_[_0x29a6('0x2a')](_0x31c2e4[_0x29a6('0x29')]);_0x454df0[_0x29a6('0x2b')]=_['intersection'](_0x454df0['model'],_0x454df0[_0x29a6('0x29')]);_0x4c5cb8[_0x29a6('0x2c')]=_[_0x29a6('0x2d')](_0x454df0[_0x29a6('0x2e')],qs[_0x29a6('0x2f')](_0x31c2e4[_0x29a6('0x29')][_0x29a6('0x2f')]));_0x4c5cb8['attributes']=_0x4c5cb8[_0x29a6('0x2c')][_0x29a6('0x30')]?_0x4c5cb8[_0x29a6('0x2c')]:_0x454df0[_0x29a6('0x2e')];if(_0x31c2e4[_0x29a6('0x29')][_0x29a6('0x31')]){_0x4c5cb8[_0x29a6('0x32')]=[{'all':!![]}];}_0x4c5cb8=_[_0x29a6('0x33')]({},_0x4c5cb8,_0x31c2e4[_0x29a6('0x34')]);return db['ChatApplication'][_0x29a6('0x35')](_0x4c5cb8)[_0x29a6('0x21')](handleEntityNotFound(_0x3607b3,null))[_0x29a6('0x21')](respondWithResult(_0x3607b3,null))[_0x29a6('0x36')](handleError(_0x3607b3,null));};exports[_0x29a6('0x20')]=function(_0x132029,_0x34a515){if(_0x132029['body']['id']){delete _0x132029['body']['id'];}return db['ChatApplication'][_0x29a6('0x35')]({'where':{'id':_0x132029[_0x29a6('0x26')]['id']}})[_0x29a6('0x21')](handleEntityNotFound(_0x34a515,null))[_0x29a6('0x21')](saveUpdates(_0x132029[_0x29a6('0x37')],null))[_0x29a6('0x21')](respondWithResult(_0x34a515,null))['catch'](handleError(_0x34a515,null));};exports[_0x29a6('0x38')]=function(_0x28f0bd,_0x539157){return db[_0x29a6('0x27')][_0x29a6('0x35')]({'where':{'id':_0x28f0bd['params']['id']}})[_0x29a6('0x21')](handleEntityNotFound(_0x539157,null))[_0x29a6('0x21')](removeEntity(_0x539157,null))[_0x29a6('0x36')](handleError(_0x539157,null));}; \ No newline at end of file +var _0x2c54=['fields','length','attributes','includeAll','merge','options','find','catch','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','limit','count','offset','status','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','keys','ChatApplication','query','intersection','model'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x2c54,0x136));var _0x42c5=function(_0x831d2a,_0x47b0b1){_0x831d2a=_0x831d2a-0x0;var _0x779be4=_0x2c54[_0x831d2a];return _0x779be4;};'use strict';var emlformat=require(_0x42c5('0x0'));var rimraf=require(_0x42c5('0x1'));var zipdir=require(_0x42c5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x42c5('0x3'));var moment=require(_0x42c5('0x4'));var BPromise=require(_0x42c5('0x5'));var Mustache=require(_0x42c5('0x6'));var util=require(_0x42c5('0x7'));var path=require(_0x42c5('0x8'));var sox=require('sox');var csv=require(_0x42c5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42c5('0xa'));var squel=require(_0x42c5('0xb'));var crypto=require(_0x42c5('0xc'));var jsforce=require(_0x42c5('0xd'));var deskjs=require(_0x42c5('0xe'));var toCsv=require(_0x42c5('0x9'));var querystring=require(_0x42c5('0xf'));var Papa=require(_0x42c5('0x10'));var Redis=require(_0x42c5('0x11'));var authService=require(_0x42c5('0x12'));var qs=require(_0x42c5('0x13'));var as=require(_0x42c5('0x14'));var hardwareService=require(_0x42c5('0x15'));var logger=require(_0x42c5('0x16'))(_0x42c5('0x17'));var utils=require(_0x42c5('0x18'));var config=require(_0x42c5('0x19'));var licenseUtil=require(_0x42c5('0x1a'));var db=require(_0x42c5('0x1b'))['db'];function respondWithStatusCode(_0x43793e,_0x18faec){_0x18faec=_0x18faec||0xcc;return function(_0x391716){if(_0x391716){return _0x43793e['sendStatus'](_0x18faec);}return _0x43793e['status'](_0x18faec)[_0x42c5('0x1c')]();};}function respondWithResult(_0xc17623,_0x337f2d){_0x337f2d=_0x337f2d||0xc8;return function(_0x1056de){if(_0x1056de){return _0xc17623['status'](_0x337f2d)[_0x42c5('0x1d')](_0x1056de);}};}function respondWithFilteredResult(_0x22d052,_0x5c9ac2){return function(_0x4efb1a){if(_0x4efb1a){var _0x323705=typeof _0x5c9ac2['offset']==='undefined'&&typeof _0x5c9ac2[_0x42c5('0x1e')]==='undefined';var _0x4eda79=_0x4efb1a[_0x42c5('0x1f')];var _0x3a2115=_0x323705?0x0:_0x5c9ac2[_0x42c5('0x20')];var _0x3f4172=_0x323705?_0x4efb1a[_0x42c5('0x1f')]:_0x5c9ac2[_0x42c5('0x20')]+_0x5c9ac2[_0x42c5('0x1e')];var _0x34f31b;if(_0x3f4172>=_0x4eda79){_0x3f4172=_0x4eda79;_0x34f31b=0xc8;}else{_0x34f31b=0xce;}_0x22d052[_0x42c5('0x21')](_0x34f31b);return _0x22d052[_0x42c5('0x22')](_0x42c5('0x23'),_0x3a2115+'-'+_0x3f4172+'/'+_0x4eda79)[_0x42c5('0x1d')](_0x4efb1a);}return null;};}function patchUpdates(_0x11c6e8){return function(_0x15035e){try{jsonpatch['apply'](_0x15035e,_0x11c6e8,!![]);}catch(_0x102294){return BPromise[_0x42c5('0x24')](_0x102294);}return _0x15035e[_0x42c5('0x25')]();};}function saveUpdates(_0x56fc64,_0x245e72){return function(_0x2533ff){if(_0x2533ff){return _0x2533ff['update'](_0x56fc64)[_0x42c5('0x26')](function(_0xd577c8){return _0xd577c8;});}return null;};}function removeEntity(_0x2d8143,_0x3166b5){return function(_0x119580){if(_0x119580){return _0x119580[_0x42c5('0x27')]()['then'](function(){_0x2d8143[_0x42c5('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x325184,_0x2b6ce7){return function(_0x5bd379){if(!_0x5bd379){_0x325184[_0x42c5('0x28')](0x194);}return _0x5bd379;};}function handleError(_0x53e81b,_0x27a6b5){_0x27a6b5=_0x27a6b5||0x1f4;return function(_0x45e9bf){logger[_0x42c5('0x29')](_0x45e9bf[_0x42c5('0x2a')]);if(_0x45e9bf[_0x42c5('0x2b')]){delete _0x45e9bf[_0x42c5('0x2b')];}_0x53e81b['status'](_0x27a6b5)[_0x42c5('0x2c')](_0x45e9bf);};}exports['show']=function(_0x16e198,_0x2daef6){var _0x23894d={'raw':!![],'where':{'id':_0x16e198['params']['id']}},_0x16dc94={};_0x16dc94['model']=_[_0x42c5('0x2d')](db[_0x42c5('0x2e')]['rawAttributes']);_0x16dc94[_0x42c5('0x2f')]=_['keys'](_0x16e198[_0x42c5('0x2f')]);_0x16dc94['filters']=_[_0x42c5('0x30')](_0x16dc94[_0x42c5('0x31')],_0x16dc94[_0x42c5('0x2f')]);_0x23894d['attributes']=_['intersection'](_0x16dc94[_0x42c5('0x31')],qs[_0x42c5('0x32')](_0x16e198[_0x42c5('0x2f')][_0x42c5('0x32')]));_0x23894d['attributes']=_0x23894d['attributes'][_0x42c5('0x33')]?_0x23894d[_0x42c5('0x34')]:_0x16dc94[_0x42c5('0x31')];if(_0x16e198[_0x42c5('0x2f')][_0x42c5('0x35')]){_0x23894d['include']=[{'all':!![]}];}_0x23894d=_[_0x42c5('0x36')]({},_0x23894d,_0x16e198[_0x42c5('0x37')]);return db['ChatApplication'][_0x42c5('0x38')](_0x23894d)['then'](handleEntityNotFound(_0x2daef6,null))[_0x42c5('0x26')](respondWithResult(_0x2daef6,null))[_0x42c5('0x39')](handleError(_0x2daef6,null));};exports['update']=function(_0x53f423,_0x565db6){if(_0x53f423['body']['id']){delete _0x53f423[_0x42c5('0x3a')]['id'];}return db[_0x42c5('0x2e')][_0x42c5('0x38')]({'where':{'id':_0x53f423[_0x42c5('0x3b')]['id']}})['then'](handleEntityNotFound(_0x565db6,null))[_0x42c5('0x26')](saveUpdates(_0x53f423[_0x42c5('0x3a')],null))[_0x42c5('0x26')](respondWithResult(_0x565db6,null))[_0x42c5('0x39')](handleError(_0x565db6,null));};exports['destroy']=function(_0x53dc30,_0x2c4c8d){return db['ChatApplication']['find']({'where':{'id':_0x53dc30['params']['id']}})[_0x42c5('0x26')](handleEntityNotFound(_0x2c4c8d,null))[_0x42c5('0x26')](removeEntity(_0x2c4c8d,null))[_0x42c5('0x39')](handleError(_0x2c4c8d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a313b3c..f283c18 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 _0xa34c=['request-promise','path','rimraf','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa34c,0x111));var _0xca34=function(_0x5c2145,_0x2a0a0a){_0x5c2145=_0x5c2145-0x0;var _0x21e161=_0xa34c[_0x5c2145];return _0x21e161;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xca34('0x0'))(_0xca34('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xca34('0x2'));var fs=require('fs');var path=require(_0xca34('0x3'));var rimraf=require(_0xca34('0x4'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0xca34('0x5')]=function(_0x3b4605,_0x3e44e2){return _0x3b4605[_0xca34('0x6')](_0xca34('0x7'),attributes,{'tableName':_0xca34('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xca34('0x9'),'collate':_0xca34('0xa')});}; \ No newline at end of file +var _0x6478=['bluebird','path','rimraf','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x569fef,_0x49c37a){var _0x11f20b=function(_0x3721d8){while(--_0x3721d8){_0x569fef['push'](_0x569fef['shift']());}};_0x11f20b(++_0x49c37a);}(_0x6478,0x64));var _0x8647=function(_0x441195,_0x304a76){_0x441195=_0x441195-0x0;var _0x8de790=_0x6478[_0x441195];return _0x8de790;};'use strict';var _=require(_0x8647('0x0'));var util=require(_0x8647('0x1'));var logger=require(_0x8647('0x2'))(_0x8647('0x3'));var moment=require('moment');var BPromise=require(_0x8647('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8647('0x5'));var rimraf=require(_0x8647('0x6'));var config=require('../../config/environment');var attributes=require(_0x8647('0x7'));module[_0x8647('0x8')]=function(_0x508131,_0x347eb2){return _0x508131['define'](_0x8647('0x9'),attributes,{'tableName':_0x8647('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8647('0xb'),'collate':_0x8647('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 80f161e..fc961bc 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 _0xacf8=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4d5179,_0x1275a1){var _0xe7d4d1=function(_0x482148){while(--_0x482148){_0x4d5179['push'](_0x4d5179['shift']());}};_0xe7d4d1(++_0x1275a1);}(_0xacf8,0x1b7));var _0x8acf=function(_0x4568a0,_0x3670bb){_0x4568a0=_0x4568a0-0x0;var _0x1bb2de=_0xacf8[_0x4568a0];return _0x1bb2de;};'use strict';var _=require(_0x8acf('0x0'));var util=require('util');var moment=require(_0x8acf('0x1'));var BPromise=require(_0x8acf('0x2'));var rs=require(_0x8acf('0x3'));var fs=require('fs');var Redis=require(_0x8acf('0x4'));var db=require(_0x8acf('0x5'))['db'];var utils=require(_0x8acf('0x6'));var logger=require(_0x8acf('0x7'))(_0x8acf('0x8'));var config=require(_0x8acf('0x9'));var jayson=require(_0x8acf('0xa'));var client=jayson['client'][_0x8acf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a0cfe,_0x44a27a,_0x8c3be9){return new BPromise(function(_0x3c420c,_0xa24d0f){return client[_0x8acf('0xc')](_0x2a0cfe,_0x8c3be9)[_0x8acf('0xd')](function(_0x58e499){logger[_0x8acf('0xe')]('ChatApplication,\x20%s,\x20%s',_0x44a27a,_0x8acf('0xf'));logger[_0x8acf('0x10')](_0x8acf('0x11'),_0x44a27a,'request\x20sent',JSON['stringify'](_0x58e499));if(_0x58e499[_0x8acf('0x12')]){if(_0x58e499['error'][_0x8acf('0x13')]===0x1f4){logger[_0x8acf('0x12')]('ChatApplication,\x20%s,\x20%s',_0x44a27a,_0x58e499['error'][_0x8acf('0x14')]);return _0xa24d0f(_0x58e499[_0x8acf('0x12')]['message']);}logger[_0x8acf('0x12')]('ChatApplication,\x20%s,\x20%s',_0x44a27a,_0x58e499['error'][_0x8acf('0x14')]);return _0x3c420c(_0x58e499['error'][_0x8acf('0x14')]);}else{logger[_0x8acf('0xe')]('ChatApplication,\x20%s,\x20%s',_0x44a27a,_0x8acf('0xf'));_0x3c420c(_0x58e499[_0x8acf('0x15')][_0x8acf('0x14')]);}})[_0x8acf('0x16')](function(_0x356ac1){logger[_0x8acf('0x12')]('ChatApplication,\x20%s,\x20%s',_0x44a27a,_0x356ac1);_0xa24d0f(_0x356ac1);});});} \ No newline at end of file +var _0xfb26=['error','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x1d0d13,_0x261e41){var _0x13c99d=function(_0x354536){while(--_0x354536){_0x1d0d13['push'](_0x1d0d13['shift']());}};_0x13c99d(++_0x261e41);}(_0xfb26,0x120));var _0x6fb2=function(_0x57c029,_0x302ebd){_0x57c029=_0x57c029-0x0;var _0x6b7d44=_0xfb26[_0x57c029];return _0x6b7d44;};'use strict';var _=require(_0x6fb2('0x0'));var util=require(_0x6fb2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6fb2('0x2'));var fs=require('fs');var Redis=require(_0x6fb2('0x3'));var db=require(_0x6fb2('0x4'))['db'];var utils=require(_0x6fb2('0x5'));var logger=require(_0x6fb2('0x6'))('rpc');var config=require(_0x6fb2('0x7'));var jayson=require(_0x6fb2('0x8'));var client=jayson[_0x6fb2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a2da2,_0x27e5ab,_0xe10e3c){return new BPromise(function(_0x54f4cc,_0x30224a){return client['request'](_0x4a2da2,_0xe10e3c)[_0x6fb2('0xa')](function(_0x588493){logger[_0x6fb2('0xb')](_0x6fb2('0xc'),_0x27e5ab,_0x6fb2('0xd'));logger[_0x6fb2('0xe')](_0x6fb2('0xf'),_0x27e5ab,_0x6fb2('0xd'),JSON['stringify'](_0x588493));if(_0x588493[_0x6fb2('0x10')]){if(_0x588493[_0x6fb2('0x10')]['code']===0x1f4){logger[_0x6fb2('0x10')](_0x6fb2('0xc'),_0x27e5ab,_0x588493[_0x6fb2('0x10')][_0x6fb2('0x11')]);return _0x30224a(_0x588493[_0x6fb2('0x10')][_0x6fb2('0x11')]);}logger[_0x6fb2('0x10')](_0x6fb2('0xc'),_0x27e5ab,_0x588493['error'][_0x6fb2('0x11')]);return _0x54f4cc(_0x588493['error'][_0x6fb2('0x11')]);}else{logger[_0x6fb2('0xb')]('ChatApplication,\x20%s,\x20%s',_0x27e5ab,_0x6fb2('0xd'));_0x54f4cc(_0x588493['result'][_0x6fb2('0x11')]);}})[_0x6fb2('0x12')](function(_0x2e7cb6){logger[_0x6fb2('0x10')](_0x6fb2('0xc'),_0x27e5ab,_0x2e7cb6);_0x30224a(_0x2e7cb6);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 93df3ca..0894900 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 _0x1aa5=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','update','exports'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x1aa5,0xc3));var _0x51aa=function(_0x168d1e,_0x23934b){_0x168d1e=_0x168d1e-0x0;var _0x44e1e4=_0x1aa5[_0x168d1e];return _0x44e1e4;};'use strict';var multer=require(_0x51aa('0x0'));var util=require('util');var path=require(_0x51aa('0x1'));var timeout=require(_0x51aa('0x2'));var express=require(_0x51aa('0x3'));var router=express[_0x51aa('0x4')]();var fs_extra=require(_0x51aa('0x5'));var auth=require(_0x51aa('0x6'));var interaction=require(_0x51aa('0x7'));var config=require(_0x51aa('0x8'));var controller=require('./chatApplication.controller');router[_0x51aa('0x9')](_0x51aa('0xa'),auth['isAuthenticated'](),controller[_0x51aa('0xb')]);router['put'](_0x51aa('0xa'),auth[_0x51aa('0xc')](),controller[_0x51aa('0xd')]);router['delete']('/:id',auth[_0x51aa('0xc')](),controller['destroy']);module[_0x51aa('0xe')]=router; \ No newline at end of file +var _0x31bb=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','update','delete'];(function(_0x48d6b0,_0x51fdd2){var _0x238e8c=function(_0xb76765){while(--_0xb76765){_0x48d6b0['push'](_0x48d6b0['shift']());}};_0x238e8c(++_0x51fdd2);}(_0x31bb,0xf2));var _0xb31b=function(_0x5273e5,_0xa79850){_0x5273e5=_0x5273e5-0x0;var _0x33f3b3=_0x31bb[_0x5273e5];return _0x33f3b3;};'use strict';var multer=require('multer');var util=require(_0xb31b('0x0'));var path=require(_0xb31b('0x1'));var timeout=require(_0xb31b('0x2'));var express=require(_0xb31b('0x3'));var router=express[_0xb31b('0x4')]();var fs_extra=require(_0xb31b('0x5'));var auth=require(_0xb31b('0x6'));var interaction=require(_0xb31b('0x7'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0xb31b('0x8')](_0xb31b('0x9'),auth[_0xb31b('0xa')](),controller[_0xb31b('0xb')]);router['put'](_0xb31b('0x9'),auth['isAuthenticated'](),controller[_0xb31b('0xc')]);router[_0xb31b('0xd')]('/:id',auth[_0xb31b('0xa')](),controller[_0xb31b('0xe')]);module[_0xb31b('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index cd78888..0cdd86b 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 _0xd61c=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xd61c,0xb1));var _0xcd61=function(_0x38beb5,_0x2891c3){_0x38beb5=_0x38beb5-0x0;var _0x3f131d=_0xd61c[_0x38beb5];return _0x3f131d;};'use strict';var Sequelize=require(_0xcd61('0x0'));module[_0xcd61('0x1')]={'name':{'type':Sequelize[_0xcd61('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xcd61('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2e09=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5f0179,_0x3777e9){var _0x2ee1d6=function(_0x15c593){while(--_0x15c593){_0x5f0179['push'](_0x5f0179['shift']());}};_0x2ee1d6(++_0x3777e9);}(_0x2e09,0xc8));var _0x92e0=function(_0x4810c3,_0x3cbbd4){_0x4810c3=_0x4810c3-0x0;var _0x3556ad=_0x2e09[_0x4810c3];return _0x3556ad;};'use strict';var Sequelize=require(_0x92e0('0x0'));module[_0x92e0('0x1')]={'name':{'type':Sequelize[_0x92e0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x92e0('0x2')]},'write':{'type':Sequelize[_0x92e0('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index db4803f..0b7f58f 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 _0xce4d=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','User','pick','getMembers','removeMembers','addMessage','findOne','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMessages','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','ChatGroup'];(function(_0x4f697d,_0xbab271){var _0x139b6a=function(_0x541656){while(--_0x541656){_0x4f697d['push'](_0x4f697d['shift']());}};_0x139b6a(++_0xbab271);}(_0xce4d,0x1a7));var _0xdce4=function(_0x3bb6ec,_0x1d80af){_0x3bb6ec=_0x3bb6ec-0x0;var _0x129385=_0xce4d[_0x3bb6ec];return _0x129385;};'use strict';var emlformat=require(_0xdce4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdce4('0x1'));var jsonpatch=require(_0xdce4('0x2'));var rp=require(_0xdce4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdce4('0x4'));var util=require(_0xdce4('0x5'));var path=require(_0xdce4('0x6'));var sox=require(_0xdce4('0x7'));var csv=require(_0xdce4('0x8'));var ejs=require(_0xdce4('0x9'));var fs=require('fs');var fs_extra=require(_0xdce4('0xa'));var _=require(_0xdce4('0xb'));var squel=require('squel');var crypto=require(_0xdce4('0xc'));var jsforce=require(_0xdce4('0xd'));var deskjs=require(_0xdce4('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdce4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdce4('0x10'));var as=require(_0xdce4('0x11'));var hardwareService=require(_0xdce4('0x12'));var logger=require(_0xdce4('0x13'))(_0xdce4('0x14'));var utils=require('../../config/utils');var config=require(_0xdce4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xdce4('0x16'))['db'];config[_0xdce4('0x17')]=_['defaults'](config[_0xdce4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xdce4('0x18'))(new Redis(config[_0xdce4('0x17')]));require(_0xdce4('0x19'))['register'](socket);function respondWithStatusCode(_0x3823ba,_0x458668){_0x458668=_0x458668||0xcc;return function(_0x4ea570){if(_0x4ea570){return _0x3823ba[_0xdce4('0x1a')](_0x458668);}return _0x3823ba['status'](_0x458668)[_0xdce4('0x1b')]();};}function respondWithResult(_0x3ce238,_0x107102){_0x107102=_0x107102||0xc8;return function(_0x5e2842){if(_0x5e2842){return _0x3ce238['status'](_0x107102)[_0xdce4('0x1c')](_0x5e2842);}};}function respondWithFilteredResult(_0x4c05d5,_0x3af9b4){return function(_0x3fe779){if(_0x3fe779){var _0x1a59d3=typeof _0x3af9b4[_0xdce4('0x1d')]===_0xdce4('0x1e')&&typeof _0x3af9b4[_0xdce4('0x1f')]===_0xdce4('0x1e');var _0x467f3a=_0x3fe779[_0xdce4('0x20')];var _0x3d9f96=_0x1a59d3?0x0:_0x3af9b4[_0xdce4('0x1d')];var _0x136974=_0x1a59d3?_0x3fe779[_0xdce4('0x20')]:_0x3af9b4[_0xdce4('0x1d')]+_0x3af9b4[_0xdce4('0x1f')];var _0x31a002;if(_0x136974>=_0x467f3a){_0x136974=_0x467f3a;_0x31a002=0xc8;}else{_0x31a002=0xce;}_0x4c05d5[_0xdce4('0x21')](_0x31a002);return _0x4c05d5[_0xdce4('0x22')](_0xdce4('0x23'),_0x3d9f96+'-'+_0x136974+'/'+_0x467f3a)[_0xdce4('0x1c')](_0x3fe779);}return null;};}function patchUpdates(_0x14d66a){return function(_0x515151){try{jsonpatch[_0xdce4('0x24')](_0x515151,_0x14d66a,!![]);}catch(_0x509e00){return BPromise[_0xdce4('0x25')](_0x509e00);}return _0x515151[_0xdce4('0x26')]();};}function saveUpdates(_0x5049e2,_0x2957fd){return function(_0x4dd996){if(_0x4dd996){return _0x4dd996[_0xdce4('0x27')](_0x5049e2)[_0xdce4('0x28')](function(_0x7825dc){return _0x7825dc;});}return null;};}function removeEntity(_0x382e3a,_0x2835f5){return function(_0x15df4b){if(_0x15df4b){return _0x15df4b[_0xdce4('0x29')]()['then'](function(){_0x382e3a[_0xdce4('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e8c16,_0x11a6a5){return function(_0x27c0ce){if(!_0x27c0ce){_0x2e8c16[_0xdce4('0x1a')](0x194);}return _0x27c0ce;};}function handleError(_0x13f17c,_0x12bf47){_0x12bf47=_0x12bf47||0x1f4;return function(_0x1b309b){logger[_0xdce4('0x2a')](_0x1b309b['stack']);if(_0x1b309b['name']){delete _0x1b309b[_0xdce4('0x2b')];}_0x13f17c[_0xdce4('0x21')](_0x12bf47)['send'](_0x1b309b);};}exports[_0xdce4('0x2c')]=function(_0x50a1f6,_0x220aad){var _0x5d23cb={},_0x447684={},_0x3c5e09={'count':0x0,'rows':[]};var _0x493fdb=_[_0xdce4('0x2d')](db[_0xdce4('0x2e')][_0xdce4('0x2f')],function(_0x294a6e){return{'name':_0x294a6e[_0xdce4('0x30')],'type':_0x294a6e[_0xdce4('0x31')][_0xdce4('0x32')]};});_0x447684[_0xdce4('0x33')]=_[_0xdce4('0x2d')](_0x493fdb,_0xdce4('0x2b'));_0x447684[_0xdce4('0x34')]=_[_0xdce4('0x35')](_0x50a1f6[_0xdce4('0x34')]);_0x447684[_0xdce4('0x36')]=_[_0xdce4('0x37')](_0x447684[_0xdce4('0x33')],_0x447684[_0xdce4('0x34')]);_0x5d23cb['attributes']=_[_0xdce4('0x37')](_0x447684[_0xdce4('0x33')],qs[_0xdce4('0x38')](_0x50a1f6[_0xdce4('0x34')][_0xdce4('0x38')]));_0x5d23cb['attributes']=_0x5d23cb[_0xdce4('0x39')][_0xdce4('0x3a')]?_0x5d23cb[_0xdce4('0x39')]:_0x447684['model'];if(!_0x50a1f6[_0xdce4('0x34')][_0xdce4('0x3b')]('nolimit')){_0x5d23cb[_0xdce4('0x1f')]=qs[_0xdce4('0x1f')](_0x50a1f6[_0xdce4('0x34')][_0xdce4('0x1f')]);_0x5d23cb[_0xdce4('0x1d')]=qs['offset'](_0x50a1f6[_0xdce4('0x34')]['offset']);}_0x5d23cb[_0xdce4('0x3c')]=qs[_0xdce4('0x3d')](_0x50a1f6[_0xdce4('0x34')][_0xdce4('0x3d')]);_0x5d23cb[_0xdce4('0x3e')]=qs[_0xdce4('0x36')](_['pick'](_0x50a1f6[_0xdce4('0x34')],_0x447684['filters']),_0x493fdb);if(_0x50a1f6[_0xdce4('0x34')][_0xdce4('0x3f')]){_0x5d23cb['where']=_[_0xdce4('0x40')](_0x5d23cb[_0xdce4('0x3e')],{'$or':_[_0xdce4('0x2d')](_0x493fdb,function(_0x341b0a){if(_0x341b0a[_0xdce4('0x31')]!=='VIRTUAL'){var _0x4aa5b9={};_0x4aa5b9[_0x341b0a[_0xdce4('0x2b')]]={'$like':'%'+_0x50a1f6[_0xdce4('0x34')][_0xdce4('0x3f')]+'%'};return _0x4aa5b9;}})});}_0x5d23cb=_['merge']({},_0x5d23cb,_0x50a1f6[_0xdce4('0x41')]);var _0x12a162={'where':_0x5d23cb[_0xdce4('0x3e')]};return db[_0xdce4('0x2e')]['count'](_0x12a162)['then'](function(_0x18ad88){_0x3c5e09['count']=_0x18ad88;if(_0x50a1f6[_0xdce4('0x34')][_0xdce4('0x42')]){_0x5d23cb[_0xdce4('0x43')]=[{'all':!![]}];}return db[_0xdce4('0x2e')][_0xdce4('0x44')](_0x5d23cb);})[_0xdce4('0x28')](function(_0x5817c6){_0x3c5e09[_0xdce4('0x45')]=_0x5817c6;return _0x3c5e09;})[_0xdce4('0x28')](respondWithFilteredResult(_0x220aad,_0x5d23cb))[_0xdce4('0x46')](handleError(_0x220aad,null));};exports[_0xdce4('0x47')]=function(_0x296fa8,_0x1d04ce){var _0x20f64c={'raw':!![],'where':{'id':_0x296fa8[_0xdce4('0x48')]['id']}},_0xd703a7={};_0xd703a7[_0xdce4('0x33')]=_[_0xdce4('0x35')](db[_0xdce4('0x2e')][_0xdce4('0x2f')]);_0xd703a7['query']=_[_0xdce4('0x35')](_0x296fa8['query']);_0xd703a7[_0xdce4('0x36')]=_['intersection'](_0xd703a7[_0xdce4('0x33')],_0xd703a7[_0xdce4('0x34')]);_0x20f64c[_0xdce4('0x39')]=_['intersection'](_0xd703a7[_0xdce4('0x33')],qs['fields'](_0x296fa8[_0xdce4('0x34')][_0xdce4('0x38')]));_0x20f64c[_0xdce4('0x39')]=_0x20f64c[_0xdce4('0x39')][_0xdce4('0x3a')]?_0x20f64c[_0xdce4('0x39')]:_0xd703a7[_0xdce4('0x33')];if(_0x296fa8[_0xdce4('0x34')][_0xdce4('0x42')]){_0x20f64c['include']=[{'all':!![]}];}_0x20f64c=_['merge']({},_0x20f64c,_0x296fa8[_0xdce4('0x41')]);return db[_0xdce4('0x2e')][_0xdce4('0x49')](_0x20f64c)[_0xdce4('0x28')](handleEntityNotFound(_0x1d04ce,null))['then'](respondWithResult(_0x1d04ce,null))[_0xdce4('0x46')](handleError(_0x1d04ce,null));};exports[_0xdce4('0x4a')]=function(_0x37b4f6,_0x563c3f){return db[_0xdce4('0x2e')][_0xdce4('0x4a')](_0x37b4f6[_0xdce4('0x4b')],{})['then'](respondWithResult(_0x563c3f,0xc9))[_0xdce4('0x46')](handleError(_0x563c3f,null));};exports['update']=function(_0x23bf34,_0xc8613d){if(_0x23bf34['body']['id']){delete _0x23bf34['body']['id'];}return db[_0xdce4('0x2e')][_0xdce4('0x49')]({'where':{'id':_0x23bf34[_0xdce4('0x48')]['id']}})[_0xdce4('0x28')](handleEntityNotFound(_0xc8613d,null))['then'](saveUpdates(_0x23bf34[_0xdce4('0x4b')],null))[_0xdce4('0x28')](respondWithResult(_0xc8613d,null))['catch'](handleError(_0xc8613d,null));};exports[_0xdce4('0x29')]=function(_0x6eb4bf,_0x1abc70){return db[_0xdce4('0x2e')]['find']({'where':{'id':_0x6eb4bf[_0xdce4('0x48')]['id']}})[_0xdce4('0x28')](handleEntityNotFound(_0x1abc70,null))[_0xdce4('0x28')](removeEntity(_0x1abc70,null))[_0xdce4('0x46')](handleError(_0x1abc70,null));};exports[_0xdce4('0x4c')]=function(_0x72f91e,_0x3b2db9){return db[_0xdce4('0x2e')][_0xdce4('0x4c')]()['then'](respondWithResult(_0x3b2db9,null))[_0xdce4('0x46')](handleError(_0x3b2db9,null));};exports[_0xdce4('0x4d')]=function(_0x1dfa78,_0x396658,_0x1125a2){return db[_0xdce4('0x4e')][_0xdce4('0x20')]({'where':{'ChatGroupId':_0x1dfa78[_0xdce4('0x48')]['id'],'ToId':_0x1dfa78['user']['id'],'read':![]}})['then'](function(_0x46344d){return{'id':_[_0xdce4('0x4f')](_0x1dfa78[_0xdce4('0x48')]['id']),'count':_0x46344d};})[_0xdce4('0x28')](respondWithResult(_0x396658,null))['catch'](handleError(_0x396658,null));};exports[_0xdce4('0x50')]=function(_0x87d4e5,_0x149adf,_0x36833c){return db[_0xdce4('0x2e')][_0xdce4('0x49')]({'where':{'id':_0x87d4e5[_0xdce4('0x48')]['id']}})[_0xdce4('0x28')](handleEntityNotFound(_0x149adf,null))[_0xdce4('0x28')](function(_0x5e7533){if(_0x5e7533){return _0x5e7533[_0xdce4('0x50')](_0x87d4e5[_0xdce4('0x4b')][_0xdce4('0x51')],_[_0xdce4('0x52')](_0x87d4e5[_0xdce4('0x4b')],['ids','id'])||{});}})[_0xdce4('0x28')](respondWithResult(_0x149adf,null))[_0xdce4('0x46')](handleError(_0x149adf,null));};exports['getMembers']=function(_0x344f12,_0x361061,_0x7eba5b){var _0x339642={};var _0xfb25d7={};var _0x430bac;var _0x376415;return db['ChatGroup']['findOne']({'where':{'id':_0x344f12[_0xdce4('0x48')]['id']}})[_0xdce4('0x28')](handleEntityNotFound(_0x361061,null))[_0xdce4('0x28')](function(_0x28c748){if(_0x28c748){_0x430bac=_0x28c748;_0xfb25d7['model']=_[_0xdce4('0x35')](db[_0xdce4('0x53')]['rawAttributes']);_0xfb25d7[_0xdce4('0x34')]=_[_0xdce4('0x35')](_0x344f12[_0xdce4('0x34')]);_0xfb25d7['filters']=_[_0xdce4('0x37')](_0xfb25d7['model'],_0xfb25d7['query']);_0x339642[_0xdce4('0x39')]=_['intersection'](_0xfb25d7['model'],qs['fields'](_0x344f12['query'][_0xdce4('0x38')]));_0x339642['attributes']=_0x339642[_0xdce4('0x39')][_0xdce4('0x3a')]?_0x339642[_0xdce4('0x39')]:_0xfb25d7[_0xdce4('0x33')];_0x339642[_0xdce4('0x3c')]=qs[_0xdce4('0x3d')](_0x344f12[_0xdce4('0x34')][_0xdce4('0x3d')]);_0x339642[_0xdce4('0x3e')]=qs[_0xdce4('0x36')](_[_0xdce4('0x54')](_0x344f12[_0xdce4('0x34')],_0xfb25d7[_0xdce4('0x36')]));if(_0x344f12[_0xdce4('0x34')][_0xdce4('0x3f')]){_0x339642[_0xdce4('0x3e')]=_[_0xdce4('0x40')](_0x339642['where'],{'$or':_[_0xdce4('0x2d')](_0x339642[_0xdce4('0x39')],function(_0x4eb923){var _0x4b824f={};_0x4b824f[_0x4eb923]={'$like':'%'+_0x344f12[_0xdce4('0x34')][_0xdce4('0x3f')]+'%'};return _0x4b824f;})});}_0x339642=_[_0xdce4('0x40')]({},_0x339642,_0x344f12[_0xdce4('0x41')]);return _0x430bac[_0xdce4('0x55')](_0x339642);}})[_0xdce4('0x28')](function(_0x160872){if(_0x160872){_0x376415=_0x160872[_0xdce4('0x3a')];if(!_0x344f12[_0xdce4('0x34')][_0xdce4('0x3b')]('nolimit')){_0x339642[_0xdce4('0x1f')]=qs[_0xdce4('0x1f')](_0x344f12[_0xdce4('0x34')][_0xdce4('0x1f')]);_0x339642[_0xdce4('0x1d')]=qs[_0xdce4('0x1d')](_0x344f12[_0xdce4('0x34')][_0xdce4('0x1d')]);}return _0x430bac[_0xdce4('0x55')](_0x339642);}})[_0xdce4('0x28')](function(_0x47dee4){if(_0x47dee4){return _0x47dee4?{'count':_0x376415,'rows':_0x47dee4}:null;}})['then'](respondWithResult(_0x361061,null))[_0xdce4('0x46')](handleError(_0x361061,null));};exports['removeMembers']=function(_0x125859,_0x524be0,_0x2efe70){return db[_0xdce4('0x2e')]['find']({'where':{'id':_0x125859[_0xdce4('0x48')]['id']}})[_0xdce4('0x28')](handleEntityNotFound(_0x524be0,null))['then'](function(_0x2acc6c){if(_0x2acc6c){return _0x2acc6c[_0xdce4('0x56')](_0x125859[_0xdce4('0x34')][_0xdce4('0x51')]);}})[_0xdce4('0x28')](respondWithStatusCode(_0x524be0,null))[_0xdce4('0x46')](handleError(_0x524be0,null));};exports[_0xdce4('0x57')]=function(_0x5dade9,_0x34cd52,_0x3cd123){if(_0x5dade9[_0xdce4('0x4b')]['id']){delete _0x5dade9[_0xdce4('0x4b')]['id'];}return db[_0xdce4('0x2e')]['find']({'where':{'id':_0x5dade9['params']['id']}})[_0xdce4('0x28')](handleEntityNotFound(_0x34cd52,null))['then'](function(_0x180017){if(_0x180017){_0x5dade9[_0xdce4('0x4b')]['ChatGroupId']=_0x180017['id'];return db[_0xdce4('0x4e')][_0xdce4('0x4a')](_0x5dade9['body']);}})['then'](respondWithResult(_0x34cd52,null))[_0xdce4('0x46')](handleError(_0x34cd52,null));};exports['getMessages']=function(_0x1ce741,_0x180790,_0x4648dc){var _0xc69e07={};var _0x483cea={};var _0x1fecac;var _0x59dc7f;return db['ChatGroup'][_0xdce4('0x58')]({'where':{'id':_0x1ce741['params']['id']}})[_0xdce4('0x28')](handleEntityNotFound(_0x180790,null))[_0xdce4('0x28')](function(_0x399db3){if(_0x399db3){_0x1fecac=_0x399db3;_0x483cea[_0xdce4('0x33')]=_[_0xdce4('0x35')](db[_0xdce4('0x4e')][_0xdce4('0x2f')]);_0x483cea[_0xdce4('0x34')]=_[_0xdce4('0x35')](_0x1ce741['query']);_0x483cea[_0xdce4('0x36')]=_[_0xdce4('0x37')](_0x483cea[_0xdce4('0x33')],_0x483cea[_0xdce4('0x34')]);_0xc69e07[_0xdce4('0x39')]=_['intersection'](_0x483cea[_0xdce4('0x33')],qs[_0xdce4('0x38')](_0x1ce741[_0xdce4('0x34')][_0xdce4('0x38')]));_0xc69e07[_0xdce4('0x39')]=_0xc69e07[_0xdce4('0x39')][_0xdce4('0x3a')]?_0xc69e07[_0xdce4('0x39')]:_0x483cea[_0xdce4('0x33')];_0xc69e07['order']=qs['sort'](_0x1ce741[_0xdce4('0x34')][_0xdce4('0x3d')]);_0xc69e07[_0xdce4('0x3e')]=qs[_0xdce4('0x36')](_[_0xdce4('0x54')](_0x1ce741['query'],_0x483cea[_0xdce4('0x36')]));if(_0x1ce741[_0xdce4('0x34')]['filter']){_0xc69e07[_0xdce4('0x3e')]=_[_0xdce4('0x40')](_0xc69e07['where'],{'$or':_[_0xdce4('0x2d')](_0xc69e07[_0xdce4('0x39')],function(_0x1131c7){var _0x2ed4df={};_0x2ed4df[_0x1131c7]={'$like':'%'+_0x1ce741[_0xdce4('0x34')][_0xdce4('0x3f')]+'%'};return _0x2ed4df;})});}if(_0x1ce741['query'][_0xdce4('0x59')]){var _0x5d4830=_0x1ce741[_0xdce4('0x34')][_0xdce4('0x59')][_0xdce4('0x5a')](',');var _0x21635e={};_0x21635e[_0x5d4830[0x0]]={'$gte':moment(_0x5d4830[0x1])['format'](_0xdce4('0x5b'))};_0xc69e07[_0xdce4('0x3e')]=_[_0xdce4('0x40')](_0xc69e07['where'],_0x21635e);}_0xc69e07=_['merge']({},_0xc69e07,_0x1ce741[_0xdce4('0x41')]);return _0x1fecac[_0xdce4('0x5c')](_0xc69e07);}})[_0xdce4('0x28')](function(_0x264557){if(_0x264557){_0x59dc7f=_0x264557[_0xdce4('0x3a')];if(!_0x1ce741[_0xdce4('0x34')][_0xdce4('0x3b')](_0xdce4('0x5d'))){_0xc69e07[_0xdce4('0x1f')]=qs[_0xdce4('0x1f')](_0x1ce741[_0xdce4('0x34')]['limit']);_0xc69e07[_0xdce4('0x1d')]=qs[_0xdce4('0x1d')](_0x1ce741[_0xdce4('0x34')]['offset']);}return _0x1fecac[_0xdce4('0x5c')](_0xc69e07);}})[_0xdce4('0x28')](function(_0x2e8797){if(_0x2e8797){return _0x2e8797?{'count':_0x59dc7f,'rows':_0x2e8797}:null;}})[_0xdce4('0x28')](respondWithResult(_0x180790,null))[_0xdce4('0x46')](handleError(_0x180790,null));}; \ No newline at end of file +var _0xf3a6=['order','sort','pick','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','merge','options','create','body','find','describe','toInteger','addMembers','ids','omit','getMembers','findOne','User','filter','hasOwnProperty','nolimit','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','name','index','map','ChatGroup','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x4cd2ac,_0x25802a){var _0x294318=function(_0x3ecd7f){while(--_0x3ecd7f){_0x4cd2ac['push'](_0x4cd2ac['shift']());}};_0x294318(++_0x25802a);}(_0xf3a6,0x144));var _0x6f3a=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0xf3a6[_0x4191af];return _0x27bebf;};'use strict';var emlformat=require(_0x6f3a('0x0'));var rimraf=require(_0x6f3a('0x1'));var zipdir=require(_0x6f3a('0x2'));var jsonpatch=require(_0x6f3a('0x3'));var rp=require(_0x6f3a('0x4'));var moment=require(_0x6f3a('0x5'));var BPromise=require(_0x6f3a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6f3a('0x7'));var csv=require(_0x6f3a('0x8'));var ejs=require(_0x6f3a('0x9'));var fs=require('fs');var fs_extra=require(_0x6f3a('0xa'));var _=require(_0x6f3a('0xb'));var squel=require('squel');var crypto=require(_0x6f3a('0xc'));var jsforce=require(_0x6f3a('0xd'));var deskjs=require(_0x6f3a('0xe'));var toCsv=require(_0x6f3a('0x8'));var querystring=require(_0x6f3a('0xf'));var Papa=require('papaparse');var Redis=require(_0x6f3a('0x10'));var authService=require(_0x6f3a('0x11'));var qs=require(_0x6f3a('0x12'));var as=require(_0x6f3a('0x13'));var hardwareService=require(_0x6f3a('0x14'));var logger=require('../../config/logger')(_0x6f3a('0x15'));var utils=require(_0x6f3a('0x16'));var config=require(_0x6f3a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f3a('0x18'))['db'];config[_0x6f3a('0x19')]=_[_0x6f3a('0x1a')](config[_0x6f3a('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f3a('0x19')]));require(_0x6f3a('0x1b'))[_0x6f3a('0x1c')](socket);function respondWithStatusCode(_0x36aa47,_0x1a6314){_0x1a6314=_0x1a6314||0xcc;return function(_0x174855){if(_0x174855){return _0x36aa47[_0x6f3a('0x1d')](_0x1a6314);}return _0x36aa47[_0x6f3a('0x1e')](_0x1a6314)['end']();};}function respondWithResult(_0x5e5b8e,_0x2766a6){_0x2766a6=_0x2766a6||0xc8;return function(_0x4bf6c9){if(_0x4bf6c9){return _0x5e5b8e[_0x6f3a('0x1e')](_0x2766a6)[_0x6f3a('0x1f')](_0x4bf6c9);}};}function respondWithFilteredResult(_0x2c7931,_0x359b16){return function(_0x19cd5c){if(_0x19cd5c){var _0x41880c=typeof _0x359b16[_0x6f3a('0x20')]===_0x6f3a('0x21')&&typeof _0x359b16[_0x6f3a('0x22')]===_0x6f3a('0x21');var _0x3e32d3=_0x19cd5c[_0x6f3a('0x23')];var _0x10f6c5=_0x41880c?0x0:_0x359b16['offset'];var _0x1aa918=_0x41880c?_0x19cd5c['count']:_0x359b16['offset']+_0x359b16['limit'];var _0x30df8e;if(_0x1aa918>=_0x3e32d3){_0x1aa918=_0x3e32d3;_0x30df8e=0xc8;}else{_0x30df8e=0xce;}_0x2c7931[_0x6f3a('0x1e')](_0x30df8e);return _0x2c7931[_0x6f3a('0x24')](_0x6f3a('0x25'),_0x10f6c5+'-'+_0x1aa918+'/'+_0x3e32d3)[_0x6f3a('0x1f')](_0x19cd5c);}return null;};}function patchUpdates(_0x3dc652){return function(_0x35d427){try{jsonpatch[_0x6f3a('0x26')](_0x35d427,_0x3dc652,!![]);}catch(_0x346460){return BPromise[_0x6f3a('0x27')](_0x346460);}return _0x35d427['save']();};}function saveUpdates(_0x49c221,_0x11ebb7){return function(_0x123b41){if(_0x123b41){return _0x123b41[_0x6f3a('0x28')](_0x49c221)[_0x6f3a('0x29')](function(_0x10a89a){return _0x10a89a;});}return null;};}function removeEntity(_0x3f351a,_0x1febe4){return function(_0x356bdf){if(_0x356bdf){return _0x356bdf[_0x6f3a('0x2a')]()['then'](function(){_0x3f351a[_0x6f3a('0x1e')](0xcc)[_0x6f3a('0x2b')]();});}};}function handleEntityNotFound(_0x1dcd41,_0x2c08eb){return function(_0x492f4f){if(!_0x492f4f){_0x1dcd41[_0x6f3a('0x1d')](0x194);}return _0x492f4f;};}function handleError(_0x1894d7,_0x1d089b){_0x1d089b=_0x1d089b||0x1f4;return function(_0x182532){logger[_0x6f3a('0x2c')](_0x182532['stack']);if(_0x182532[_0x6f3a('0x2d')]){delete _0x182532[_0x6f3a('0x2d')];}_0x1894d7[_0x6f3a('0x1e')](_0x1d089b)['send'](_0x182532);};}exports[_0x6f3a('0x2e')]=function(_0x3fce3a,_0x349e53){var _0x1f7103={},_0x5d7125={},_0x4f7e5c={'count':0x0,'rows':[]};var _0x25087d=_[_0x6f3a('0x2f')](db[_0x6f3a('0x30')][_0x6f3a('0x31')],function(_0x3d9d3d){return{'name':_0x3d9d3d[_0x6f3a('0x32')],'type':_0x3d9d3d[_0x6f3a('0x33')]['key']};});_0x5d7125[_0x6f3a('0x34')]=_[_0x6f3a('0x2f')](_0x25087d,_0x6f3a('0x2d'));_0x5d7125[_0x6f3a('0x35')]=_[_0x6f3a('0x36')](_0x3fce3a['query']);_0x5d7125[_0x6f3a('0x37')]=_['intersection'](_0x5d7125[_0x6f3a('0x34')],_0x5d7125['query']);_0x1f7103['attributes']=_[_0x6f3a('0x38')](_0x5d7125[_0x6f3a('0x34')],qs[_0x6f3a('0x39')](_0x3fce3a['query'][_0x6f3a('0x39')]));_0x1f7103[_0x6f3a('0x3a')]=_0x1f7103['attributes'][_0x6f3a('0x3b')]?_0x1f7103[_0x6f3a('0x3a')]:_0x5d7125['model'];if(!_0x3fce3a[_0x6f3a('0x35')]['hasOwnProperty']('nolimit')){_0x1f7103[_0x6f3a('0x22')]=qs[_0x6f3a('0x22')](_0x3fce3a['query'][_0x6f3a('0x22')]);_0x1f7103['offset']=qs[_0x6f3a('0x20')](_0x3fce3a[_0x6f3a('0x35')]['offset']);}_0x1f7103[_0x6f3a('0x3c')]=qs[_0x6f3a('0x3d')](_0x3fce3a['query'][_0x6f3a('0x3d')]);_0x1f7103['where']=qs[_0x6f3a('0x37')](_[_0x6f3a('0x3e')](_0x3fce3a['query'],_0x5d7125[_0x6f3a('0x37')]),_0x25087d);if(_0x3fce3a[_0x6f3a('0x35')]['filter']){_0x1f7103[_0x6f3a('0x3f')]=_['merge'](_0x1f7103[_0x6f3a('0x3f')],{'$or':_[_0x6f3a('0x2f')](_0x25087d,function(_0x473420){if(_0x473420[_0x6f3a('0x33')]!==_0x6f3a('0x40')){var _0x45369e={};_0x45369e[_0x473420[_0x6f3a('0x2d')]]={'$like':'%'+_0x3fce3a['query']['filter']+'%'};return _0x45369e;}})});}_0x1f7103=_['merge']({},_0x1f7103,_0x3fce3a['options']);var _0x4e9968={'where':_0x1f7103[_0x6f3a('0x3f')]};return db[_0x6f3a('0x30')]['count'](_0x4e9968)[_0x6f3a('0x29')](function(_0x233137){_0x4f7e5c[_0x6f3a('0x23')]=_0x233137;if(_0x3fce3a[_0x6f3a('0x35')][_0x6f3a('0x41')]){_0x1f7103['include']=[{'all':!![]}];}return db[_0x6f3a('0x30')][_0x6f3a('0x42')](_0x1f7103);})[_0x6f3a('0x29')](function(_0x427e08){_0x4f7e5c[_0x6f3a('0x43')]=_0x427e08;return _0x4f7e5c;})[_0x6f3a('0x29')](respondWithFilteredResult(_0x349e53,_0x1f7103))[_0x6f3a('0x44')](handleError(_0x349e53,null));};exports[_0x6f3a('0x45')]=function(_0xe27e33,_0x11bef2){var _0x48fe2f={'raw':!![],'where':{'id':_0xe27e33[_0x6f3a('0x46')]['id']}},_0x416816={};_0x416816['model']=_[_0x6f3a('0x36')](db[_0x6f3a('0x30')][_0x6f3a('0x31')]);_0x416816[_0x6f3a('0x35')]=_[_0x6f3a('0x36')](_0xe27e33['query']);_0x416816['filters']=_[_0x6f3a('0x38')](_0x416816['model'],_0x416816[_0x6f3a('0x35')]);_0x48fe2f[_0x6f3a('0x3a')]=_[_0x6f3a('0x38')](_0x416816['model'],qs[_0x6f3a('0x39')](_0xe27e33[_0x6f3a('0x35')][_0x6f3a('0x39')]));_0x48fe2f[_0x6f3a('0x3a')]=_0x48fe2f[_0x6f3a('0x3a')]['length']?_0x48fe2f[_0x6f3a('0x3a')]:_0x416816['model'];if(_0xe27e33[_0x6f3a('0x35')][_0x6f3a('0x41')]){_0x48fe2f[_0x6f3a('0x47')]=[{'all':!![]}];}_0x48fe2f=_[_0x6f3a('0x48')]({},_0x48fe2f,_0xe27e33[_0x6f3a('0x49')]);return db[_0x6f3a('0x30')]['find'](_0x48fe2f)[_0x6f3a('0x29')](handleEntityNotFound(_0x11bef2,null))[_0x6f3a('0x29')](respondWithResult(_0x11bef2,null))[_0x6f3a('0x44')](handleError(_0x11bef2,null));};exports[_0x6f3a('0x4a')]=function(_0x38e708,_0x30ac40){return db[_0x6f3a('0x30')][_0x6f3a('0x4a')](_0x38e708[_0x6f3a('0x4b')],{})[_0x6f3a('0x29')](respondWithResult(_0x30ac40,0xc9))[_0x6f3a('0x44')](handleError(_0x30ac40,null));};exports[_0x6f3a('0x28')]=function(_0x4f96c7,_0x5ee088){if(_0x4f96c7['body']['id']){delete _0x4f96c7[_0x6f3a('0x4b')]['id'];}return db[_0x6f3a('0x30')][_0x6f3a('0x4c')]({'where':{'id':_0x4f96c7[_0x6f3a('0x46')]['id']}})[_0x6f3a('0x29')](handleEntityNotFound(_0x5ee088,null))[_0x6f3a('0x29')](saveUpdates(_0x4f96c7[_0x6f3a('0x4b')],null))['then'](respondWithResult(_0x5ee088,null))[_0x6f3a('0x44')](handleError(_0x5ee088,null));};exports[_0x6f3a('0x2a')]=function(_0x3b5c9c,_0x3df363){return db[_0x6f3a('0x30')][_0x6f3a('0x4c')]({'where':{'id':_0x3b5c9c[_0x6f3a('0x46')]['id']}})['then'](handleEntityNotFound(_0x3df363,null))['then'](removeEntity(_0x3df363,null))[_0x6f3a('0x44')](handleError(_0x3df363,null));};exports[_0x6f3a('0x4d')]=function(_0x144a10,_0xb534b8){return db[_0x6f3a('0x30')][_0x6f3a('0x4d')]()['then'](respondWithResult(_0xb534b8,null))['catch'](handleError(_0xb534b8,null));};exports['getUnread']=function(_0x146963,_0x229c03,_0x728740){return db['ChatInternalMessage'][_0x6f3a('0x23')]({'where':{'ChatGroupId':_0x146963['params']['id'],'ToId':_0x146963['user']['id'],'read':![]}})[_0x6f3a('0x29')](function(_0x29ec26){return{'id':_[_0x6f3a('0x4e')](_0x146963[_0x6f3a('0x46')]['id']),'count':_0x29ec26};})['then'](respondWithResult(_0x229c03,null))[_0x6f3a('0x44')](handleError(_0x229c03,null));};exports[_0x6f3a('0x4f')]=function(_0x4f209c,_0x3f473a,_0x2ce7b3){return db[_0x6f3a('0x30')][_0x6f3a('0x4c')]({'where':{'id':_0x4f209c[_0x6f3a('0x46')]['id']}})[_0x6f3a('0x29')](handleEntityNotFound(_0x3f473a,null))[_0x6f3a('0x29')](function(_0x109c85){if(_0x109c85){return _0x109c85['addMembers'](_0x4f209c[_0x6f3a('0x4b')][_0x6f3a('0x50')],_[_0x6f3a('0x51')](_0x4f209c[_0x6f3a('0x4b')],[_0x6f3a('0x50'),'id'])||{});}})['then'](respondWithResult(_0x3f473a,null))[_0x6f3a('0x44')](handleError(_0x3f473a,null));};exports[_0x6f3a('0x52')]=function(_0xc16605,_0x27a7a8,_0x1552a5){var _0x54bb5a={};var _0x567c39={};var _0x37ddef;var _0x28b900;return db[_0x6f3a('0x30')][_0x6f3a('0x53')]({'where':{'id':_0xc16605[_0x6f3a('0x46')]['id']}})[_0x6f3a('0x29')](handleEntityNotFound(_0x27a7a8,null))[_0x6f3a('0x29')](function(_0x52e410){if(_0x52e410){_0x37ddef=_0x52e410;_0x567c39['model']=_[_0x6f3a('0x36')](db[_0x6f3a('0x54')][_0x6f3a('0x31')]);_0x567c39[_0x6f3a('0x35')]=_[_0x6f3a('0x36')](_0xc16605[_0x6f3a('0x35')]);_0x567c39[_0x6f3a('0x37')]=_[_0x6f3a('0x38')](_0x567c39[_0x6f3a('0x34')],_0x567c39['query']);_0x54bb5a[_0x6f3a('0x3a')]=_['intersection'](_0x567c39['model'],qs[_0x6f3a('0x39')](_0xc16605[_0x6f3a('0x35')][_0x6f3a('0x39')]));_0x54bb5a[_0x6f3a('0x3a')]=_0x54bb5a[_0x6f3a('0x3a')][_0x6f3a('0x3b')]?_0x54bb5a['attributes']:_0x567c39[_0x6f3a('0x34')];_0x54bb5a['order']=qs[_0x6f3a('0x3d')](_0xc16605[_0x6f3a('0x35')][_0x6f3a('0x3d')]);_0x54bb5a[_0x6f3a('0x3f')]=qs[_0x6f3a('0x37')](_['pick'](_0xc16605[_0x6f3a('0x35')],_0x567c39[_0x6f3a('0x37')]));if(_0xc16605[_0x6f3a('0x35')][_0x6f3a('0x55')]){_0x54bb5a['where']=_[_0x6f3a('0x48')](_0x54bb5a[_0x6f3a('0x3f')],{'$or':_[_0x6f3a('0x2f')](_0x54bb5a['attributes'],function(_0x4d7bad){var _0x302035={};_0x302035[_0x4d7bad]={'$like':'%'+_0xc16605[_0x6f3a('0x35')][_0x6f3a('0x55')]+'%'};return _0x302035;})});}_0x54bb5a=_[_0x6f3a('0x48')]({},_0x54bb5a,_0xc16605[_0x6f3a('0x49')]);return _0x37ddef['getMembers'](_0x54bb5a);}})['then'](function(_0x126f14){if(_0x126f14){_0x28b900=_0x126f14['length'];if(!_0xc16605['query'][_0x6f3a('0x56')](_0x6f3a('0x57'))){_0x54bb5a[_0x6f3a('0x22')]=qs[_0x6f3a('0x22')](_0xc16605[_0x6f3a('0x35')]['limit']);_0x54bb5a[_0x6f3a('0x20')]=qs['offset'](_0xc16605[_0x6f3a('0x35')][_0x6f3a('0x20')]);}return _0x37ddef['getMembers'](_0x54bb5a);}})[_0x6f3a('0x29')](function(_0x3c3ca8){if(_0x3c3ca8){return _0x3c3ca8?{'count':_0x28b900,'rows':_0x3c3ca8}:null;}})[_0x6f3a('0x29')](respondWithResult(_0x27a7a8,null))[_0x6f3a('0x44')](handleError(_0x27a7a8,null));};exports['removeMembers']=function(_0x14cbe4,_0x4581ec,_0x605dcc){return db['ChatGroup'][_0x6f3a('0x4c')]({'where':{'id':_0x14cbe4[_0x6f3a('0x46')]['id']}})[_0x6f3a('0x29')](handleEntityNotFound(_0x4581ec,null))['then'](function(_0x2f785d){if(_0x2f785d){return _0x2f785d[_0x6f3a('0x58')](_0x14cbe4['query'][_0x6f3a('0x50')]);}})[_0x6f3a('0x29')](respondWithStatusCode(_0x4581ec,null))['catch'](handleError(_0x4581ec,null));};exports[_0x6f3a('0x59')]=function(_0x178edc,_0xe4ef5e,_0x37c1fe){if(_0x178edc[_0x6f3a('0x4b')]['id']){delete _0x178edc[_0x6f3a('0x4b')]['id'];}return db[_0x6f3a('0x30')][_0x6f3a('0x4c')]({'where':{'id':_0x178edc[_0x6f3a('0x46')]['id']}})[_0x6f3a('0x29')](handleEntityNotFound(_0xe4ef5e,null))[_0x6f3a('0x29')](function(_0x4a2827){if(_0x4a2827){_0x178edc[_0x6f3a('0x4b')][_0x6f3a('0x5a')]=_0x4a2827['id'];return db[_0x6f3a('0x5b')][_0x6f3a('0x4a')](_0x178edc['body']);}})[_0x6f3a('0x29')](respondWithResult(_0xe4ef5e,null))[_0x6f3a('0x44')](handleError(_0xe4ef5e,null));};exports['getMessages']=function(_0x8498d1,_0x5a041a,_0x32c69d){var _0x3d88ce={};var _0xbbeef8={};var _0x2d3bb3;var _0x21f521;return db[_0x6f3a('0x30')][_0x6f3a('0x53')]({'where':{'id':_0x8498d1[_0x6f3a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a041a,null))[_0x6f3a('0x29')](function(_0x1998f3){if(_0x1998f3){_0x2d3bb3=_0x1998f3;_0xbbeef8[_0x6f3a('0x34')]=_[_0x6f3a('0x36')](db[_0x6f3a('0x5b')][_0x6f3a('0x31')]);_0xbbeef8[_0x6f3a('0x35')]=_['keys'](_0x8498d1[_0x6f3a('0x35')]);_0xbbeef8[_0x6f3a('0x37')]=_[_0x6f3a('0x38')](_0xbbeef8['model'],_0xbbeef8['query']);_0x3d88ce['attributes']=_[_0x6f3a('0x38')](_0xbbeef8['model'],qs[_0x6f3a('0x39')](_0x8498d1['query']['fields']));_0x3d88ce[_0x6f3a('0x3a')]=_0x3d88ce[_0x6f3a('0x3a')][_0x6f3a('0x3b')]?_0x3d88ce[_0x6f3a('0x3a')]:_0xbbeef8[_0x6f3a('0x34')];_0x3d88ce[_0x6f3a('0x3c')]=qs['sort'](_0x8498d1[_0x6f3a('0x35')][_0x6f3a('0x3d')]);_0x3d88ce[_0x6f3a('0x3f')]=qs[_0x6f3a('0x37')](_[_0x6f3a('0x3e')](_0x8498d1[_0x6f3a('0x35')],_0xbbeef8['filters']));if(_0x8498d1[_0x6f3a('0x35')]['filter']){_0x3d88ce[_0x6f3a('0x3f')]=_[_0x6f3a('0x48')](_0x3d88ce[_0x6f3a('0x3f')],{'$or':_['map'](_0x3d88ce[_0x6f3a('0x3a')],function(_0x1ae3e5){var _0x550c55={};_0x550c55[_0x1ae3e5]={'$like':'%'+_0x8498d1[_0x6f3a('0x35')]['filter']+'%'};return _0x550c55;})});}if(_0x8498d1['query']['$gte']){var _0x37baf3=_0x8498d1['query'][_0x6f3a('0x5c')][_0x6f3a('0x5d')](',');var _0x4af6b0={};_0x4af6b0[_0x37baf3[0x0]]={'$gte':moment(_0x37baf3[0x1])['format'](_0x6f3a('0x5e'))};_0x3d88ce['where']=_[_0x6f3a('0x48')](_0x3d88ce['where'],_0x4af6b0);}_0x3d88ce=_['merge']({},_0x3d88ce,_0x8498d1['options']);return _0x2d3bb3[_0x6f3a('0x5f')](_0x3d88ce);}})['then'](function(_0x2e55fd){if(_0x2e55fd){_0x21f521=_0x2e55fd[_0x6f3a('0x3b')];if(!_0x8498d1[_0x6f3a('0x35')]['hasOwnProperty'](_0x6f3a('0x57'))){_0x3d88ce[_0x6f3a('0x22')]=qs['limit'](_0x8498d1[_0x6f3a('0x35')][_0x6f3a('0x22')]);_0x3d88ce[_0x6f3a('0x20')]=qs[_0x6f3a('0x20')](_0x8498d1[_0x6f3a('0x35')]['offset']);}return _0x2d3bb3['getMessages'](_0x3d88ce);}})[_0x6f3a('0x29')](function(_0x282ced){if(_0x282ced){return _0x282ced?{'count':_0x21f521,'rows':_0x282ced}:null;}})['then'](respondWithResult(_0x5a041a,null))[_0x6f3a('0x44')](handleError(_0x5a041a,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 8189593..946a9f4 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 _0x3869=['hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x18b125,_0x5e9726){var _0x203201=function(_0x4e21c5){while(--_0x4e21c5){_0x18b125['push'](_0x18b125['shift']());}};_0x203201(++_0x5e9726);}(_0x3869,0x115));var _0x9386=function(_0x3c31d9,_0x1dc694){_0x3c31d9=_0x3c31d9-0x0;var _0x461922=_0x3869[_0x3c31d9];return _0x461922;};'use strict';var EventEmitter=require(_0x9386('0x0'));var ChatGroup=require(_0x9386('0x1'))['db'][_0x9386('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9386('0x3')](0x0);var events={'afterCreate':_0x9386('0x4'),'afterUpdate':_0x9386('0x5'),'afterDestroy':_0x9386('0x6')};function emitEvent(_0x3f7809){return function(_0x410ff8,_0x2afb08,_0x2f739a){ChatGroupEvents[_0x9386('0x7')](_0x3f7809+':'+_0x410ff8['id'],_0x410ff8);ChatGroupEvents[_0x9386('0x7')](_0x3f7809,_0x410ff8);_0x2f739a(null);};}for(var e in events){if(events[_0x9386('0x8')](e)){var event=events[e];ChatGroup[_0x9386('0x9')](e,emitEvent(event));}}module[_0x9386('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0x04d5=['events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x71d2f1,_0xeecdf3){var _0x2a8807=function(_0x14b9e2){while(--_0x14b9e2){_0x71d2f1['push'](_0x71d2f1['shift']());}};_0x2a8807(++_0xeecdf3);}(_0x04d5,0xe1));var _0x504d=function(_0x164096,_0x56429e){_0x164096=_0x164096-0x0;var _0x47fa4d=_0x04d5[_0x164096];return _0x47fa4d;};'use strict';var EventEmitter=require(_0x504d('0x0'));var ChatGroup=require(_0x504d('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x504d('0x2')](0x0);var events={'afterCreate':_0x504d('0x3'),'afterUpdate':_0x504d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x8a595d){return function(_0x219680,_0x2c5833,_0x3d083e){ChatGroupEvents[_0x504d('0x5')](_0x8a595d+':'+_0x219680['id'],_0x219680);ChatGroupEvents['emit'](_0x8a595d,_0x219680);_0x3d083e(null);};}for(var e in events){if(events[_0x504d('0x6')](e)){var event=events[e];ChatGroup[_0x504d('0x7')](e,emitEvent(event));}}module[_0x504d('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 02cbcec..8941d62 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 _0xa7c2=['request-promise','path','./chatGroup.attributes','exports','define','ChatGroup','../../config/logger','api','moment'];(function(_0x21fbb9,_0x3fc1f8){var _0x189ce5=function(_0x55a14b){while(--_0x55a14b){_0x21fbb9['push'](_0x21fbb9['shift']());}};_0x189ce5(++_0x3fc1f8);}(_0xa7c2,0x192));var _0x2a7c=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xa7c2[_0x45f951];return _0x24756c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2a7c('0x0'))(_0x2a7c('0x1'));var moment=require(_0x2a7c('0x2'));var BPromise=require('bluebird');var rp=require(_0x2a7c('0x3'));var fs=require('fs');var path=require(_0x2a7c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2a7c('0x5'));module[_0x2a7c('0x6')]=function(_0x1bccb5,_0x40e3ed){return _0x1bccb5[_0x2a7c('0x7')](_0x2a7c('0x8'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b75=['chat_groups','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define'];(function(_0x36ccd9,_0x38cd05){var _0x2a4ffc=function(_0x545221){while(--_0x545221){_0x36ccd9['push'](_0x36ccd9['shift']());}};_0x2a4ffc(++_0x38cd05);}(_0x3b75,0x194));var _0x53b7=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0x3b75[_0x4bc4c8];return _0x3bb121;};'use strict';var _=require(_0x53b7('0x0'));var util=require(_0x53b7('0x1'));var logger=require(_0x53b7('0x2'))(_0x53b7('0x3'));var moment=require(_0x53b7('0x4'));var BPromise=require('bluebird');var rp=require(_0x53b7('0x5'));var fs=require('fs');var path=require(_0x53b7('0x6'));var rimraf=require(_0x53b7('0x7'));var config=require(_0x53b7('0x8'));var attributes=require(_0x53b7('0x9'));module[_0x53b7('0xa')]=function(_0x222b0f,_0x128483){return _0x222b0f[_0x53b7('0xb')]('ChatGroup',attributes,{'tableName':_0x53b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 501d6f2..f7ae6b1 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 _0x1360=['request\x20sent','debug','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1360,0xd6));var _0x0136=function(_0x15e17c,_0x39f6c8){_0x15e17c=_0x15e17c-0x0;var _0x55d8c7=_0x1360[_0x15e17c];return _0x55d8c7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0136('0x0'));var BPromise=require(_0x0136('0x1'));var rs=require(_0x0136('0x2'));var fs=require('fs');var Redis=require(_0x0136('0x3'));var db=require(_0x0136('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0136('0x5'))(_0x0136('0x6'));var config=require(_0x0136('0x7'));var jayson=require(_0x0136('0x8'));var client=jayson[_0x0136('0x9')][_0x0136('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0136('0xb')],{'host':_0x0136('0xc'),'port':0x18eb});var socket=require(_0x0136('0xd'))(new Redis(config[_0x0136('0xb')]));require(_0x0136('0xe'))[_0x0136('0xf')](socket);function respondWithRpcPromise(_0x1a6998,_0x16c9ee,_0x23bb49){return new BPromise(function(_0x1453f3,_0x5cdd79){return client[_0x0136('0x10')](_0x1a6998,_0x23bb49)[_0x0136('0x11')](function(_0x1f89fb){logger[_0x0136('0x12')](_0x0136('0x13'),_0x16c9ee,_0x0136('0x14'));logger[_0x0136('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x16c9ee,'request\x20sent',JSON['stringify'](_0x1f89fb));if(_0x1f89fb[_0x0136('0x16')]){if(_0x1f89fb[_0x0136('0x16')][_0x0136('0x17')]===0x1f4){logger[_0x0136('0x16')](_0x0136('0x13'),_0x16c9ee,_0x1f89fb[_0x0136('0x16')][_0x0136('0x18')]);return _0x5cdd79(_0x1f89fb[_0x0136('0x16')][_0x0136('0x18')]);}logger[_0x0136('0x16')]('ChatGroup,\x20%s,\x20%s',_0x16c9ee,_0x1f89fb[_0x0136('0x16')][_0x0136('0x18')]);return _0x1453f3(_0x1f89fb['error'][_0x0136('0x18')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x16c9ee,_0x0136('0x14'));_0x1453f3(_0x1f89fb[_0x0136('0x19')]['message']);}})['catch'](function(_0x3d7595){logger['error']('ChatGroup,\x20%s,\x20%s',_0x16c9ee,_0x3d7595);_0x5cdd79(_0x3d7595);});});} \ No newline at end of file +var _0x1061=['code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1061,0x1b5));var _0x1106=function(_0x4be841,_0x1805d1){_0x4be841=_0x4be841-0x0;var _0x479ce8=_0x1061[_0x4be841];return _0x479ce8;};'use strict';var _=require(_0x1106('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1106('0x1'));var fs=require('fs');var Redis=require(_0x1106('0x2'));var db=require(_0x1106('0x3'))['db'];var utils=require(_0x1106('0x4'));var logger=require(_0x1106('0x5'))(_0x1106('0x6'));var config=require(_0x1106('0x7'));var jayson=require(_0x1106('0x8'));var client=jayson['client'][_0x1106('0x9')]({'port':0x232a});config[_0x1106('0xa')]=_['defaults'](config['redis'],{'host':_0x1106('0xb'),'port':0x18eb});var socket=require(_0x1106('0xc'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x1106('0xd')](socket);function respondWithRpcPromise(_0x1058d1,_0x46837b,_0x3f940e){return new BPromise(function(_0x456967,_0x2f9a44){return client[_0x1106('0xe')](_0x1058d1,_0x3f940e)[_0x1106('0xf')](function(_0x362404){logger[_0x1106('0x10')]('ChatGroup,\x20%s,\x20%s',_0x46837b,_0x1106('0x11'));logger[_0x1106('0x12')](_0x1106('0x13'),_0x46837b,_0x1106('0x11'),JSON[_0x1106('0x14')](_0x362404));if(_0x362404[_0x1106('0x15')]){if(_0x362404[_0x1106('0x15')][_0x1106('0x16')]===0x1f4){logger[_0x1106('0x15')](_0x1106('0x17'),_0x46837b,_0x362404[_0x1106('0x15')][_0x1106('0x18')]);return _0x2f9a44(_0x362404[_0x1106('0x15')][_0x1106('0x18')]);}logger[_0x1106('0x15')](_0x1106('0x17'),_0x46837b,_0x362404[_0x1106('0x15')][_0x1106('0x18')]);return _0x456967(_0x362404['error']['message']);}else{logger[_0x1106('0x10')](_0x1106('0x17'),_0x46837b,_0x1106('0x11'));_0x456967(_0x362404[_0x1106('0x19')]['message']);}})[_0x1106('0x1a')](function(_0x3e4b0c){logger[_0x1106('0x15')](_0x1106('0x17'),_0x46837b,_0x3e4b0c);_0x2f9a44(_0x3e4b0c);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index fcdbb97..6caf6c3 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 _0x5cb3=['chatGroup:','./chatGroup.events','remove','update','emit','removeListener','register'];(function(_0x585312,_0x4fa0b2){var _0x98911c=function(_0x56d196){while(--_0x56d196){_0x585312['push'](_0x585312['shift']());}};_0x98911c(++_0x4fa0b2);}(_0x5cb3,0x174));var _0x35cb=function(_0x3969e9,_0xe76b74){_0x3969e9=_0x3969e9-0x0;var _0x2c10be=_0x5cb3[_0x3969e9];return _0x2c10be;};'use strict';var ChatGroupEvents=require(_0x35cb('0x0'));var events=['save',_0x35cb('0x1'),_0x35cb('0x2')];function createListener(_0x2ae752,_0x4708ba){return function(_0x2cb6d6){_0x4708ba[_0x35cb('0x3')](_0x2ae752,_0x2cb6d6);};}function removeListener(_0x4c9c39,_0x4cbaa7){return function(){ChatGroupEvents[_0x35cb('0x4')](_0x4c9c39,_0x4cbaa7);};}exports[_0x35cb('0x5')]=function(_0x461fa0){for(var _0x4983d4=0x0,_0x2de43c=events['length'];_0x4983d4<_0x2de43c;_0x4983d4++){var _0x2431ae=events[_0x4983d4];var _0x5698d7=createListener(_0x35cb('0x6')+_0x2431ae,_0x461fa0);ChatGroupEvents['on'](_0x2431ae,_0x5698d7);}}; \ No newline at end of file +var _0xce5c=['chatGroup:','./chatGroup.events','save','update','emit','register','length'];(function(_0x5029d5,_0x12c3fa){var _0x3f8a29=function(_0x513180){while(--_0x513180){_0x5029d5['push'](_0x5029d5['shift']());}};_0x3f8a29(++_0x12c3fa);}(_0xce5c,0x1dd));var _0xcce5=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0xce5c[_0x478c8a];return _0x3b6b3e;};'use strict';var ChatGroupEvents=require(_0xcce5('0x0'));var events=[_0xcce5('0x1'),'remove',_0xcce5('0x2')];function createListener(_0x3ec7e9,_0xc4ad76){return function(_0x44a05f){_0xc4ad76[_0xcce5('0x3')](_0x3ec7e9,_0x44a05f);};}function removeListener(_0x554d9b,_0x18c801){return function(){ChatGroupEvents['removeListener'](_0x554d9b,_0x18c801);};}exports[_0xcce5('0x4')]=function(_0x1d9e1d){for(var _0x5d7695=0x0,_0x565450=events[_0xcce5('0x5')];_0x5d7695<_0x565450;_0x5d7695++){var _0x482ea9=events[_0x5d7695];var _0x1bddb9=createListener(_0xcce5('0x6')+_0x482ea9,_0x1d9e1d);ChatGroupEvents['on'](_0x482ea9,_0x1bddb9);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 6d555a4..ba12ad0 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 _0x4852=['getMembers','/:id/messages','getMessages','post','addMembers','addMessage','update','destroy','removeMembers','util','path','connect-timeout','express','Router','fs-extra','./chatGroup.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/unread','getUnread','/:id/members'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4852,0x10d));var _0x2485=function(_0x3bd1d4,_0x3fc053){_0x3bd1d4=_0x3bd1d4-0x0;var _0x11a08d=_0x4852[_0x3bd1d4];return _0x11a08d;};'use strict';var multer=require('multer');var util=require(_0x2485('0x0'));var path=require(_0x2485('0x1'));var timeout=require(_0x2485('0x2'));var express=require(_0x2485('0x3'));var router=express[_0x2485('0x4')]();var fs_extra=require(_0x2485('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2485('0x6'));router['get']('/',auth[_0x2485('0x7')](),controller[_0x2485('0x8')]);router['get'](_0x2485('0x9'),auth[_0x2485('0x7')](),controller[_0x2485('0xa')]);router[_0x2485('0xb')](_0x2485('0xc'),auth['isAuthenticated'](),controller[_0x2485('0xd')]);router[_0x2485('0xb')](_0x2485('0xe'),auth[_0x2485('0x7')](),controller[_0x2485('0xf')]);router[_0x2485('0xb')](_0x2485('0x10'),auth[_0x2485('0x7')](),controller[_0x2485('0x11')]);router[_0x2485('0xb')](_0x2485('0x12'),auth[_0x2485('0x7')](),controller[_0x2485('0x13')]);router[_0x2485('0x14')]('/',auth[_0x2485('0x7')](),controller['create']);router['post'](_0x2485('0x10'),auth[_0x2485('0x7')](),controller[_0x2485('0x15')]);router[_0x2485('0x14')]('/:id/messages',auth[_0x2485('0x7')](),controller[_0x2485('0x16')]);router['put'](_0x2485('0xc'),auth[_0x2485('0x7')](),controller[_0x2485('0x17')]);router['delete'](_0x2485('0xc'),auth[_0x2485('0x7')](),controller[_0x2485('0x18')]);router['delete'](_0x2485('0x10'),auth[_0x2485('0x7')](),controller[_0x2485('0x19')]);module['exports']=router; \ No newline at end of file +var _0xd518=['fs-extra','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','update','delete','destroy','exports','path','Router'];(function(_0x12d423,_0x295982){var _0x32a7f5=function(_0x35f0d7){while(--_0x35f0d7){_0x12d423['push'](_0x12d423['shift']());}};_0x32a7f5(++_0x295982);}(_0xd518,0x1c6));var _0x8d51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd518[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8d51('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8d51('0x1')]();var fs_extra=require(_0x8d51('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8d51('0x3'));var controller=require(_0x8d51('0x4'));router[_0x8d51('0x5')]('/',auth[_0x8d51('0x6')](),controller[_0x8d51('0x7')]);router[_0x8d51('0x5')](_0x8d51('0x8'),auth[_0x8d51('0x6')](),controller[_0x8d51('0x9')]);router[_0x8d51('0x5')](_0x8d51('0xa'),auth['isAuthenticated'](),controller[_0x8d51('0xb')]);router[_0x8d51('0x5')]('/:id/unread',auth['isAuthenticated'](),controller['getUnread']);router[_0x8d51('0x5')](_0x8d51('0xc'),auth[_0x8d51('0x6')](),controller[_0x8d51('0xd')]);router[_0x8d51('0x5')](_0x8d51('0xe'),auth[_0x8d51('0x6')](),controller[_0x8d51('0xf')]);router[_0x8d51('0x10')]('/',auth[_0x8d51('0x6')](),controller[_0x8d51('0x11')]);router[_0x8d51('0x10')]('/:id/members',auth[_0x8d51('0x6')](),controller[_0x8d51('0x12')]);router[_0x8d51('0x10')]('/:id/messages',auth[_0x8d51('0x6')](),controller[_0x8d51('0x13')]);router['put'](_0x8d51('0xa'),auth[_0x8d51('0x6')](),controller[_0x8d51('0x14')]);router[_0x8d51('0x15')](_0x8d51('0xa'),auth[_0x8d51('0x6')](),controller[_0x8d51('0x16')]);router[_0x8d51('0x15')](_0x8d51('0xc'),auth[_0x8d51('0x6')](),controller['removeMembers']);module[_0x8d51('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 607c3ae..47fd27c 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 _0xc584=['TEXT','DATE','STRING','long','ENUM','out','exports','BOOLEAN','star'];(function(_0x4a88d5,_0x542d24){var _0x5cbf97=function(_0x4f7309){while(--_0x4f7309){_0x4a88d5['push'](_0x4a88d5['shift']());}};_0x5cbf97(++_0x542d24);}(_0xc584,0xa8));var _0x4c58=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0xc584[_0x3f4dd9];return _0x31c54a;};'use strict';var Sequelize=require('sequelize');module[_0x4c58('0x0')]={'closed':{'type':Sequelize[_0x4c58('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x4c58('0x2'),'thumb'),'defaultValue':_0x4c58('0x2')},'ratingMessage':{'type':Sequelize[_0x4c58('0x3')]},'pathTranscript':{'type':Sequelize[_0x4c58('0x3')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x4c58('0x4')]},'disposition':{'type':Sequelize[_0x4c58('0x5')]},'secondDisposition':{'type':Sequelize[_0x4c58('0x5')]},'thirdDisposition':{'type':Sequelize[_0x4c58('0x5')]},'note':{'type':Sequelize[_0x4c58('0x5')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x4c58('0x5')]},'deviceModel':{'type':Sequelize[_0x4c58('0x5')]},'deviceVendor':{'type':Sequelize[_0x4c58('0x5')]},'deviceType':{'type':Sequelize[_0x4c58('0x5')]},'referer':{'type':Sequelize[_0x4c58('0x3')]},'customerIp':{'type':Sequelize[_0x4c58('0x5')]},'formData':{'type':Sequelize[_0x4c58('0x3')](_0x4c58('0x6'))},'read1stAt':{'type':Sequelize[_0x4c58('0x4')]},'lastMsgAt':{'type':Sequelize[_0x4c58('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x4c58('0x7')]('in',_0x4c58('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x4c58('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x657b=['TEXT','STRING','DATE','long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','thumb','star'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x657b,0x131));var _0xb657=function(_0x9c7979,_0x23ebe3){_0x9c7979=_0x9c7979-0x0;var _0x3feb67=_0x657b[_0x9c7979];return _0x3feb67;};'use strict';var Sequelize=require(_0xb657('0x0'));module[_0xb657('0x1')]={'closed':{'type':Sequelize[_0xb657('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xb657('0x3')]},'ratingType':{'type':Sequelize[_0xb657('0x4')]('star',_0xb657('0x5')),'defaultValue':_0xb657('0x6')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xb657('0x7')]},'mailTranscript':{'type':Sequelize[_0xb657('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xb657('0x9')]},'disposition':{'type':Sequelize[_0xb657('0x8')]},'secondDisposition':{'type':Sequelize[_0xb657('0x8')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb657('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xb657('0x8')]},'osName':{'type':Sequelize[_0xb657('0x8')]},'osVersion':{'type':Sequelize[_0xb657('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xb657('0x8')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xb657('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xb657('0x7')](_0xb657('0xa'))},'read1stAt':{'type':Sequelize[_0xb657('0x9')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb657('0x4')]('in',_0xb657('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xb657('0x8')]},'customerPort':{'type':Sequelize[_0xb657('0x8')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xb657('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 2c72581..ab7e417 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 _0x4fc2=['result','catch','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','map','fullname','TagIds','Tags','split','forEach','push','ChatInteraction','rawAttributes','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','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','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','DESC','t.id\x20IN\x20?','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','params','includeAll','options','create','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','filename','mimetype','Attachment','Unauthorized','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','User','ChatWebsite','%s%d','agentAlias','System','customer','website_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','pick','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','includeAgent','addTags','setTags','spread','Tag','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Account','Owner','mkdirSync','N.A.','closedAt','customerIp','customerPort','existsSync','createWriteStream','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','Chat','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message'];(function(_0x3342da,_0x3238ee){var _0x32ee79=function(_0x4054eb){while(--_0x4054eb){_0x3342da['push'](_0x3342da['shift']());}};_0x32ee79(++_0x3238ee);}(_0x4fc2,0x111));var _0x24fc=function(_0x5d7583,_0x48a446){_0x5d7583=_0x5d7583-0x0;var _0x1e615c=_0x4fc2[_0x5d7583];return _0x1e615c;};'use strict';var emlformat=require(_0x24fc('0x0'));var rimraf=require(_0x24fc('0x1'));var zipdir=require(_0x24fc('0x2'));var jsonpatch=require(_0x24fc('0x3'));var rp=require('request-promise');var moment=require(_0x24fc('0x4'));var BPromise=require(_0x24fc('0x5'));var Mustache=require(_0x24fc('0x6'));var util=require('util');var path=require(_0x24fc('0x7'));var sox=require(_0x24fc('0x8'));var csv=require('to-csv');var ejs=require(_0x24fc('0x9'));var fs=require('fs');var fs_extra=require(_0x24fc('0xa'));var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0xf'));var querystring=require(_0x24fc('0x10'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x11'));var authService=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var as=require(_0x24fc('0x14'));var pdf=require(_0x24fc('0x15'));var hardwareService=require(_0x24fc('0x16'));var logger=require(_0x24fc('0x17'))(_0x24fc('0x18'));var utils=require('../../config/utils');var config=require(_0x24fc('0x19'));var licenseUtil=require(_0x24fc('0x1a'));var db=require('../../mysqldb')['db'];config[_0x24fc('0x1b')]=_[_0x24fc('0x1c')](config[_0x24fc('0x1b')],{'host':_0x24fc('0x1d'),'port':0x18eb});var socket=require(_0x24fc('0x1e'))(new Redis(config[_0x24fc('0x1b')]));require('./chatInteraction.socket')[_0x24fc('0x1f')](socket);var jayson=require(_0x24fc('0x20'));var client=jayson[_0x24fc('0x21')][_0x24fc('0x22')]({'port':0x232b});var client9004=jayson['client'][_0x24fc('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x588543,_0x4af098,_0x3385c7,_0x218fb6){return new BPromise(function(_0x41c593,_0x25cb40){var _0x52a884=_0x218fb6||client;return _0x52a884[_0x24fc('0x23')](_0x588543,_0x3385c7)[_0x24fc('0x24')](function(_0x6cfa0a){logger[_0x24fc('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x4af098,_0x24fc('0x26'));logger[_0x24fc('0x27')](_0x24fc('0x28'),_0x4af098,'request\x20sent',JSON[_0x24fc('0x29')](_0x6cfa0a));if(_0x6cfa0a[_0x24fc('0x2a')]){if(_0x6cfa0a[_0x24fc('0x2a')][_0x24fc('0x2b')]===0x1f4){logger['error'](_0x24fc('0x2c'),_0x4af098,_0x6cfa0a['error'][_0x24fc('0x2d')]);return _0x25cb40(_0x6cfa0a['error'][_0x24fc('0x2d')]);}logger[_0x24fc('0x2a')](_0x24fc('0x2c'),_0x4af098,_0x6cfa0a['error'][_0x24fc('0x2d')]);return _0x41c593(_0x6cfa0a['error'][_0x24fc('0x2d')]);}else{logger[_0x24fc('0x25')](_0x24fc('0x2c'),_0x4af098,_0x24fc('0x26'));_0x41c593(_0x6cfa0a[_0x24fc('0x2e')][_0x24fc('0x2d')]);}})[_0x24fc('0x2f')](function(_0x20192b){logger[_0x24fc('0x2a')](_0x24fc('0x2c'),_0x4af098,_0x20192b);_0x25cb40(_0x20192b);});});}function respondWithStatusCode(_0x568441,_0x11c913){_0x11c913=_0x11c913||0xcc;return function(_0x16f27f){if(_0x16f27f){return _0x568441[_0x24fc('0x30')](_0x11c913);}return _0x568441['status'](_0x11c913)[_0x24fc('0x31')]();};}function respondWithResult(_0x3d1ec8,_0x35f9f9){_0x35f9f9=_0x35f9f9||0xc8;return function(_0x290f84){if(_0x290f84){return _0x3d1ec8[_0x24fc('0x32')](_0x35f9f9)[_0x24fc('0x33')](_0x290f84);}};}function respondWithFilteredResult(_0x5ac1f2,_0x240ae7){return function(_0x29a461){if(_0x29a461){var _0x3c99ed=typeof _0x240ae7[_0x24fc('0x34')]===_0x24fc('0x35')&&typeof _0x240ae7['limit']==='undefined';var _0x4e6f73=_0x29a461[_0x24fc('0x36')];var _0x574ba3=_0x3c99ed?0x0:_0x240ae7[_0x24fc('0x34')];var _0x3e6389=_0x3c99ed?_0x29a461[_0x24fc('0x36')]:_0x240ae7[_0x24fc('0x34')]+_0x240ae7['limit'];var _0x66eec0;if(_0x3e6389>=_0x4e6f73){_0x3e6389=_0x4e6f73;_0x66eec0=0xc8;}else{_0x66eec0=0xce;}_0x5ac1f2[_0x24fc('0x32')](_0x66eec0);return _0x5ac1f2['set'](_0x24fc('0x37'),_0x574ba3+'-'+_0x3e6389+'/'+_0x4e6f73)[_0x24fc('0x33')](_0x29a461);}return null;};}function patchUpdates(_0x4d756f){return function(_0x48c62a){try{jsonpatch[_0x24fc('0x38')](_0x48c62a,_0x4d756f,!![]);}catch(_0x56eae7){return BPromise[_0x24fc('0x39')](_0x56eae7);}return _0x48c62a[_0x24fc('0x3a')]();};}function saveUpdates(_0x5491b0,_0x2ae896){return function(_0x33bbf2){if(_0x33bbf2){return _0x33bbf2[_0x24fc('0x3b')](_0x5491b0)[_0x24fc('0x24')](function(_0x1c5874){return _0x1c5874;});}return null;};}function removeEntity(_0x1e205d,_0x3b3932){return function(_0x2a209d){if(_0x2a209d){return _0x2a209d[_0x24fc('0x3c')]()['then'](function(){_0x1e205d[_0x24fc('0x32')](0xcc)[_0x24fc('0x31')]();});}};}function handleEntityNotFound(_0x2fbe30,_0x316aa2){return function(_0x242bd5){if(!_0x242bd5){_0x2fbe30['sendStatus'](0x194);}return _0x242bd5;};}function handleError(_0x56a9bd,_0xd52d10){_0xd52d10=_0xd52d10||0x1f4;return function(_0x5d48fe){logger[_0x24fc('0x2a')](_0x5d48fe[_0x24fc('0x3d')]);if(_0x5d48fe[_0x24fc('0x3e')]){delete _0x5d48fe[_0x24fc('0x3e')];}_0x56a9bd['status'](_0xd52d10)[_0x24fc('0x3f')](_0x5d48fe);};}function getMustacheRender(_0x4f4ec8,_0x65771d){return Mustache[_0x24fc('0x40')](_0x4f4ec8,_[_0x24fc('0x41')](_0x65771d[_0x24fc('0x42')],{'contact':_0x65771d[_0x24fc('0x43')],'message':_0x65771d['message'],'agent':_0x65771d[_0x24fc('0x44')],'interaction':_0x65771d[_0x24fc('0x45')],'account':_0x65771d[_0x24fc('0x46')]}))||'';}function getInteractionUsers(_0x22a75c,_0x5ceae2){return new BPromise(function(_0x172923,_0x2f0bd9){try{if(_0x5ceae2[_0x22a75c['id']]){_0x22a75c['Users']=_[_0x24fc('0x47')](_0x5ceae2[_0x22a75c['id']],function(_0x52df2e){return{'id':_0x52df2e['id'],'fullname':_0x52df2e[_0x24fc('0x48')]};});}}catch(_0x2fd30d){_0x2f0bd9(_0x2fd30d);}_0x172923(_0x22a75c);});}function getInteractionTags(_0x3a15ab,_0x1e045a){return new BPromise(function(_0x431189,_0x278b18){try{if(_0x3a15ab[_0x24fc('0x49')]){_0x3a15ab[_0x24fc('0x4a')]=[];_0x3a15ab['TagIds'][_0x24fc('0x4b')](',')[_0x24fc('0x4c')](function(_0x32f72c){_0x3a15ab['Tags'][_0x24fc('0x4d')](_0x1e045a[_0x32f72c]);});}delete _0x3a15ab[_0x24fc('0x49')];}catch(_0x4ae4a7){_0x278b18(_0x4ae4a7);}_0x431189(_0x3a15ab);});}function updateChatInteraction(_0x2c4a6c,_0x22f30b,_0x2c598c){return new BPromise(function(_0x5e4e9b,_0x31ddd0){return getInteractionUsers(_0x2c4a6c,_0x2c598c)[_0x24fc('0x24')](function(_0x585e48){return getInteractionTags(_0x585e48,_0x22f30b);})[_0x24fc('0x24')](function(_0x169982){_0x5e4e9b(_0x169982);})[_0x24fc('0x2f')](function(_0x2a0ac4){_0x31ddd0(_0x2a0ac4);});});}exports['index']=function(_0x2eecaf,_0x9bc56a){var _0x3ce7b3={},_0x7b38fa={},_0xbcbcfa={'count':0x0,'rows':[]};var _0x58a950=_[_0x24fc('0x47')](db[_0x24fc('0x4e')][_0x24fc('0x4f')],function(_0x3c6ffb){return{'name':_0x3c6ffb['fieldName'],'type':_0x3c6ffb[_0x24fc('0x50')][_0x24fc('0x51')]};});_0x7b38fa['model']=_['map'](_0x58a950,_0x24fc('0x3e'));_0x7b38fa['query']=_['keys'](_0x2eecaf[_0x24fc('0x52')]);_0x7b38fa['filters']=_[_0x24fc('0x53')](_0x7b38fa[_0x24fc('0x54')],_0x7b38fa[_0x24fc('0x52')]);_0x3ce7b3['attributes']=_[_0x24fc('0x53')](_0x7b38fa[_0x24fc('0x54')],qs[_0x24fc('0x55')](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x55')]));_0x3ce7b3[_0x24fc('0x56')]=_0x3ce7b3[_0x24fc('0x56')][_0x24fc('0x57')]?_0x3ce7b3['attributes']:_0x7b38fa['model'];if(!_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x58')](_0x24fc('0x59'))){_0x3ce7b3['limit']=qs['limit'](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x5a')]);_0x3ce7b3[_0x24fc('0x34')]=qs[_0x24fc('0x34')](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x34')]);}_0x3ce7b3[_0x24fc('0x5b')]=qs[_0x24fc('0x5c')](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x5c')]);_0x3ce7b3[_0x24fc('0x5d')]=qs[_0x24fc('0x5e')](_['pick'](_0x2eecaf[_0x24fc('0x52')],_0x7b38fa[_0x24fc('0x5e')]),_0x58a950);var _0x32a466=[];var _0xb0fc00=squel[_0x24fc('0x5f')]()['field']('id')[_0x24fc('0x60')]('name')[_0x24fc('0x60')](_0x24fc('0x61'))[_0x24fc('0x62')](_0x24fc('0x63'));var _0x40f42b=squel[_0x24fc('0x5f')]()['field'](_0x24fc('0x64'))[_0x24fc('0x60')](_0x24fc('0x65'))[_0x24fc('0x60')](_0x24fc('0x66'))[_0x24fc('0x62')]('user_has_chat_interactions','ui')[_0x24fc('0x67')](_0x24fc('0x68'),'u',_0x24fc('0x69'));var _0x1b69ad=squel[_0x24fc('0x5f')]()[_0x24fc('0x62')](_0x24fc('0x6a'),'i')['left_join'](_0x24fc('0x6b'),'c',_0x24fc('0x6c'))['left_join'](_0x24fc('0x68'),'o',_0x24fc('0x6d'))[_0x24fc('0x67')](_0x24fc('0x6e'),'a',_0x24fc('0x6f'))[_0x24fc('0x67')]('chat_messages','me',_0x24fc('0x70'))['left_join'](_0x24fc('0x71'),'it',_0x24fc('0x72'))['left_join'](_0x24fc('0x63'),'t','t.id\x20=\x20it.TagId');var _0x1c1f74=squel['expr']();var _0xdff811=[];var _0x27b612=squel['expr']();var _0x2edef7;if(_0x2eecaf['query'][_0x24fc('0x73')]){_0x2edef7=as[_0x24fc('0x74')](_0x2eecaf['query'][_0x24fc('0x73')]);var _0x3ec1a8=_0x2edef7[_0x24fc('0x75')];for(var _0x47179d=0x0;_0x47179d<_0x2edef7[_0x24fc('0x76')]['length'];_0x47179d++){var _0x39da59=_0x2edef7[_0x24fc('0x76')][_0x47179d];var _0x2d657a='i';var _0x2b5dca=_[_0x24fc('0x77')](_0x58a950,['name',_0x39da59['field']]);if(!_0x2b5dca){switch(_0x39da59[_0x24fc('0x60')]){case _0x24fc('0x78'):if(_0x39da59['value']==0x1){_0x1b69ad['having']('`'+_0x39da59[_0x24fc('0x60')]+_0x24fc('0x79'));}else{_0x1b69ad[_0x24fc('0x7a')]('`'+_0x39da59[_0x24fc('0x60')]+'`\x20>\x200');}break;case _0x24fc('0x7b'):if(_0x39da59[_0x24fc('0x7c')]===_0x24fc('0x7d')){if(_0x39da59[_0x24fc('0x7e')][_0x24fc('0x4b')]('\x20')[_0x24fc('0x57')]>0x1){_0x1c1f74[_0x3ec1a8](_0x24fc('0x7f'),qs[_0x24fc('0x80')](_0x39da59[_0x24fc('0x7e')]),null);}else{var _0x1f6a71='%'+_0x39da59[_0x24fc('0x7e')]+'%';_0x1c1f74[_0x3ec1a8](_0x24fc('0x81'),_0x1f6a71,_0x1f6a71,_0x1f6a71);}}else{_0x2b5dca=_[_0x24fc('0x77')](_0x58a950,[_0x24fc('0x3e'),_0x24fc('0x82')]);_0x39da59['field']=_0x24fc('0x82');_0x10ef7c=as[_0x24fc('0x83')](_0x2d657a,_0x2b5dca[_0x24fc('0x50')],_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c[_0x24fc('0x84')],_0x10ef7c[_0x24fc('0x7e')][_0x24fc('0x85')],_0x10ef7c[_0x24fc('0x7e')][_0x24fc('0x31')]);}break;case'Tag':var _0x3475b8=_0x39da59[_0x24fc('0x7e')][_0x24fc('0x4b')](',')[_0x24fc('0x47')](function(_0x55fceb){return Number(_0x55fceb);});_0x3475b8[_0x24fc('0x4c')](function(_0x29b381){_0x27b612['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x29b381+',%');});_0xdff811=_['union'](_0xdff811,_0x3475b8);break;case'User':if(_0x39da59[_0x24fc('0x7c')]===_0x24fc('0x7d')){_0x1c1f74[_0x3ec1a8](_0x24fc('0x86'),'%'+_0x39da59[_0x24fc('0x7e')]+'%',null);}else{_0x2b5dca=_[_0x24fc('0x77')](_0x58a950,[_0x24fc('0x3e'),'UserId']);_0x39da59[_0x24fc('0x60')]=_0x24fc('0x87');_0x10ef7c=as['buildExpression'](_0x2d657a,_0x2b5dca['type'],_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c[_0x24fc('0x84')],_0x10ef7c[_0x24fc('0x7e')][_0x24fc('0x85')],_0x10ef7c['value'][_0x24fc('0x31')]);}break;case _0x24fc('0x42'):_0x10ef7c=as[_0x24fc('0x83')]('me',null,_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c['text'],_0x10ef7c['value']['start'],_0x10ef7c['value']['end']);break;}}else{var _0x10ef7c=as[_0x24fc('0x83')](_0x2d657a,_0x2b5dca[_0x24fc('0x50')],_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c[_0x24fc('0x84')],_0x10ef7c['value'][_0x24fc('0x85')],_0x10ef7c['value'][_0x24fc('0x31')]);}}}else{var _0x4e6eec=_(_0x2eecaf[_0x24fc('0x52')])[_0x24fc('0x88')]()[_0x24fc('0x47')](function(_0x4291bd){return _[_0x24fc('0x89')](_0x58a950,[_0x24fc('0x3e'),_0x4291bd])?_0x4291bd:undefined;})[_0x24fc('0x8a')]()['value']();if(!_[_0x24fc('0x8b')](_0x4e6eec)){_0x4e6eec[_0x24fc('0x4c')](function(_0x2de101){if(_0x2de101==='ChatWebsiteId'){_0x1b69ad['where'](_0x24fc('0x8c'),[][_0x24fc('0x8d')](_0x2eecaf['query'][_0x2de101]));}else if(_0x2de101===_0x24fc('0x8e')){var _0x1a2e6d=JSON['parse'](_0x2eecaf[_0x24fc('0x52')][_0x2de101])[_0x24fc('0x8f')];var _0x5249ea=JSON[_0x24fc('0x90')](_0x2eecaf[_0x24fc('0x52')][_0x2de101])[_0x24fc('0x91')];_0x1b69ad[_0x24fc('0x5d')](_0x24fc('0x92'),_0x1a2e6d,_0x5249ea);}else{if(_0x2eecaf[_0x24fc('0x52')][_0x2de101]==='null'){_0x1b69ad['where']('i.'+_0x2de101+_0x24fc('0x93'));}else{_0x1b69ad['where']('i.'+_0x2de101+_0x24fc('0x94'),_0x2eecaf['query'][_0x2de101]);}}});}if(_0x2eecaf['query'][_0x24fc('0x95')]){if(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x95')]==0x1){_0x1b69ad[_0x24fc('0x7a')](_0x24fc('0x96'));}else{_0x1b69ad[_0x24fc('0x7a')](_0x24fc('0x97'));}}if(_0x2eecaf[_0x24fc('0x52')]['tag']){_0xdff811=_[_0x24fc('0x98')](_0x2eecaf[_0x24fc('0x52')]['tag'])?_0x2eecaf['query'][_0x24fc('0x99')]:new Array(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x99')]);_0xdff811[_0x24fc('0x4c')](function(_0xd1e6){_0x27b612['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xd1e6+',%');});}if(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x9a')]){var _0x5ca35b=_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x9a')][_0x24fc('0x9b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x24fc('0x9c')](_0x5ca35b)){_0x1c1f74['or'](_0x24fc('0x9d'),_0x5ca35b+'%');}else{_0x1c1f74['or'](_0x24fc('0x9e'),qs[_0x24fc('0x80')](_0x5ca35b))['or'](_0x24fc('0x9f'),_0x5ca35b+'%');}}}_0x1b69ad[_0x24fc('0x5d')](_0x1c1f74);_0x1b69ad[_0x24fc('0xa0')](_0x24fc('0xa1'));var _0x188edb={'type':db['Sequelize'][_0x24fc('0xa2')][_0x24fc('0xa3')],'raw':!![]};var _0x1dcccf=_0x1b69ad['clone']();_0x1dcccf['field']('i.id');_0x1dcccf[_0x24fc('0x60')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x24fc('0x78'));if(_0x3ce7b3[_0x24fc('0x5b')]){_0x3ce7b3['order'][_0x24fc('0x4c')](function(_0x559692){var _0x41cef7=_0x559692[0x0]==='contactName'?_0x559692[0x0]:'i.'+_0x559692[0x0];_0x1b69ad[_0x24fc('0x5b')](_0x41cef7,_0x559692[0x1]===_0x24fc('0xa4')?![]:!![]);});}if(!_[_0x24fc('0x8b')](_0xdff811)){_0x1b69ad[_0x24fc('0x7a')](_0x27b612);_0x1dcccf[_0x24fc('0x5d')](_0x24fc('0xa5'),_0xdff811);}BPromise['resolve']()[_0x24fc('0x24')](function(){if(!_0x2edef7){if(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0xa6')])return;_0x1dcccf[_0x24fc('0x5d')](_0x24fc('0xa7'));_0x1b69ad[_0x24fc('0x5d')](_0x24fc('0xa7'));return;}if(_0x2eecaf[_0x24fc('0xa8')][_0x24fc('0xa9')]!=='agent')return;return _0x2eecaf[_0x24fc('0xa8')][_0x24fc('0xaa')]({'attributes':['id'],'raw':!![]})[_0x24fc('0x24')](function(_0x30ed50){if(_['isEmpty'](_0x30ed50)){_0x1dcccf[_0x24fc('0x5d')](_0x24fc('0xab'));_0x1b69ad[_0x24fc('0x5d')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x1dcccf[_0x24fc('0x5d')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x30ed50,'id'));_0x1b69ad['where'](_0x24fc('0x8c'),_['map'](_0x30ed50,'id'));}});})[_0x24fc('0x24')](function(){if(_0x2eecaf[_0x24fc('0xa8')][_0x24fc('0xa9')]===_0x24fc('0x44')&&!_0x2edef7&&!_0x2eecaf['query'][_0x24fc('0xa6')])return[];return db[_0x24fc('0xac')][_0x24fc('0x52')](_0x1dcccf[_0x24fc('0xad')](),_0x188edb);})[_0x24fc('0x24')](function(_0x5c80a5){_0xbcbcfa[_0x24fc('0x36')]=_0x5c80a5[_0x24fc('0x57')];if(_0xbcbcfa[_0x24fc('0x36')]===0x0)return[];return db[_0x24fc('0xac')]['query'](_0xb0fc00['toString'](),_0x188edb)[_0x24fc('0x24')](function(_0x4216da){_0x32a466=_[_0x24fc('0xae')](_0x4216da,'id');_0x188edb=_[_0x24fc('0x41')](_0x188edb,{'model':db[_0x24fc('0x4e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2eecaf['query'][_0x24fc('0x55')]){_0x3ce7b3[_0x24fc('0x56')][_0x24fc('0x4c')](function(_0x5d5a59){_0x1b69ad[_0x24fc('0x60')]('i.'+_0x5d5a59);});}else{_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xaf'),_0x24fc('0x78'));_0x1b69ad[_0x24fc('0x60')]('a.key','Account.key');_0x1b69ad['field'](_0x24fc('0xb0'),_0x24fc('0xb1'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb2'),_0x24fc('0xb3'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb4'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb5'),_0x24fc('0xb6'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb7'),'Contact.lastName');_0x1b69ad['field'](_0x24fc('0xb8'),'Contact.email');_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb9'),_0x24fc('0xba'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xbb'),_0x24fc('0xbc'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xbd'),_0x24fc('0xbe'));_0x1b69ad['field'](_0x24fc('0xbf'),_0x24fc('0xc0'));_0x1b69ad['field']('o.internal',_0x24fc('0xc1'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xc2'),_0x24fc('0x49'));}if(_0x3ce7b3[_0x24fc('0x5a')])_0x1b69ad[_0x24fc('0x5a')](_0x3ce7b3['limit']);if(_0x3ce7b3[_0x24fc('0x34')])_0x1b69ad[_0x24fc('0x34')](_0x3ce7b3[_0x24fc('0x34')]);return db[_0x24fc('0xac')]['query'](_0x1b69ad[_0x24fc('0xad')](),_0x188edb);})[_0x24fc('0x24')](function(_0x1506e8){if(_0x1506e8['length']>0x0)_0x40f42b[_0x24fc('0x5d')](_0x24fc('0xc3'),_[_0x24fc('0x47')](_0x1506e8,'id'));return db['sequelize'][_0x24fc('0x52')](_0x40f42b[_0x24fc('0xad')](),_0x188edb)['then'](function(_0x543db4){var _0x283251=_[_0x24fc('0xc4')](_0x543db4,_0x24fc('0xc5'));var _0x2029cd=[];_0x1506e8[_0x24fc('0x4c')](function(_0x3afe80){_0x2029cd['push'](updateChatInteraction(_0x3afe80,_0x32a466,_0x283251));});return BPromise[_0x24fc('0xc6')](_0x2029cd);});});})[_0x24fc('0x24')](function(_0x17a6a9){_0xbcbcfa[_0x24fc('0xc7')]=_0x17a6a9;return _0xbcbcfa;})[_0x24fc('0x24')](respondWithFilteredResult(_0x9bc56a,_0x3ce7b3))[_0x24fc('0x2f')](handleError(_0x9bc56a,null));};exports['show']=function(_0x4018d3,_0x4a2522){var _0x5226aa={'raw':![],'where':{'id':_0x4018d3[_0x24fc('0xc8')]['id']}},_0x260a62={};_0x260a62['model']=_[_0x24fc('0x88')](db[_0x24fc('0x4e')][_0x24fc('0x4f')]);_0x260a62[_0x24fc('0x52')]=_['keys'](_0x4018d3[_0x24fc('0x52')]);_0x260a62[_0x24fc('0x5e')]=_[_0x24fc('0x53')](_0x260a62[_0x24fc('0x54')],_0x260a62[_0x24fc('0x52')]);_0x5226aa[_0x24fc('0x56')]=_['intersection'](_0x260a62['model'],qs['fields'](_0x4018d3[_0x24fc('0x52')][_0x24fc('0x55')]));_0x5226aa['attributes']=_0x5226aa[_0x24fc('0x56')][_0x24fc('0x57')]?_0x5226aa[_0x24fc('0x56')]:_0x260a62['model'];if(_0x4018d3[_0x24fc('0x52')][_0x24fc('0xc9')]){_0x5226aa['include']=[{'all':!![]}];}_0x5226aa=_['merge']({},_0x5226aa,_0x4018d3[_0x24fc('0xca')]);return db[_0x24fc('0x4e')][_0x24fc('0x77')](_0x5226aa)['then'](handleEntityNotFound(_0x4a2522,null))[_0x24fc('0x24')](respondWithResult(_0x4a2522,null))['catch'](handleError(_0x4a2522,null));};exports['create']=function(_0x344c0f,_0x52484a){return db['ChatInteraction'][_0x24fc('0xcb')](_0x344c0f['body'],{})[_0x24fc('0x24')](respondWithResult(_0x52484a,0xc9))[_0x24fc('0x2f')](handleError(_0x52484a,null));};exports[_0x24fc('0x3b')]=function(_0x11eaeb,_0x4ae346){if(_0x11eaeb[_0x24fc('0x42')]['id']){delete _0x11eaeb[_0x24fc('0x42')]['id'];}return db['ChatInteraction'][_0x24fc('0x77')]({'where':{'id':_0x11eaeb[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x4ae346,null))[_0x24fc('0x24')](saveUpdates(_0x11eaeb[_0x24fc('0x42')],null))['then'](respondWithResult(_0x4ae346,null))[_0x24fc('0x2f')](handleError(_0x4ae346,null));};exports[_0x24fc('0x3c')]=function(_0x5793d9,_0x759d35){return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x5793d9[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x759d35,null))['then'](removeEntity(_0x759d35,null))[_0x24fc('0x2f')](handleError(_0x759d35,null));};exports['describe']=function(_0x5c8969,_0x42c158){return db[_0x24fc('0x4e')][_0x24fc('0xcc')]()['then'](respondWithResult(_0x42c158,null))['catch'](handleError(_0x42c158,null));};exports[_0x24fc('0xcd')]=function(_0x38fba8,_0xfa9d58){var _0x353a64=_0x38fba8[_0x24fc('0xc8')]['id'];var _0x4ee1ad;var _0x4875bd;var _0x1efb25;return db['ChatInteraction']['findOne']({'where':{'id':_0x353a64}})[_0x24fc('0x24')](function(_0x484775){_0x4ee1ad=_0x484775;return db['ChatWebsite'][_0x24fc('0xce')]({'where':{'id':_0x484775[_0x24fc('0xa6')]},'attributes':['id',_0x24fc('0xcf'),_0x24fc('0xd0'),_0x24fc('0xd1'),_0x24fc('0xd2'),_0x24fc('0xd3')],'raw':!![]});})['then'](function(_0x3b2891){if(_0x3b2891&&_0x3b2891[_0x24fc('0xcf')]&&_0x3b2891[_0x24fc('0xd0')]){_0x4875bd=_0x3b2891;var _0x6e3447={'interaction':{'id':_0x353a64},'agent':{'id':_0x38fba8[_0x24fc('0xa8')]['id'],'name':_0x38fba8[_0x24fc('0xa8')][_0x24fc('0x3e')],'fullname':_0x38fba8[_0x24fc('0xa8')][_0x24fc('0x48')],'email':_0x38fba8[_0x24fc('0xa8')][_0x24fc('0xd4')]},'contact':_0x38fba8[_0x24fc('0x42')][_0x24fc('0x43')],'account':_0x38fba8[_0x24fc('0x42')][_0x24fc('0x46')]};var _0x38ec08={'rejectUnauthorized':![],'method':_0x24fc('0xd5'),'url':_0x24fc('0xd6'),'headers':{'X-APIKEY':_0x3b2891[_0x24fc('0xcf')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x38fba8[_0x24fc('0xa8')][_0x24fc('0xd4')]],'buttons':null,'topic':_0x4875bd[_0x24fc('0xd1')],'note':_[_0x24fc('0xd7')](_0x4875bd[_0x24fc('0xd2')])?null:getMustacheRender(_0x4875bd[_0x24fc('0xd2')],_0x6e3447),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x24fc('0xd7')](_0x4875bd[_0x24fc('0xd3')])){var _0x1d8a8f=getMustacheRender(_0x4875bd[_0x24fc('0xd3')],_0x6e3447);var _0x534388=JSON['parse'](_0x1d8a8f);_0x38ec08['body'][_0x24fc('0xd8')]=_0x534388;}}catch(_0x5aa947){throw new db[(_0x24fc('0xd9'))]['ValidationError'](_0x24fc('0xda'));}return rp(_0x38ec08);}else{throw new db[(_0x24fc('0xd9'))][(_0x24fc('0xdb'))](_0x24fc('0xdc'));}})[_0x24fc('0x24')](function(_0x468477){_0x1efb25=_0x468477;if(_0x1efb25['id']){var _0x1c4ac1={'body':_0x1efb25[_0x24fc('0xdd')],'ChatWebsiteId':_0x4875bd['id'],'ChatInteractionId':_0x4ee1ad['id'],'direction':'out','UserId':_0x38fba8[_0x24fc('0xa8')]['id']};return db[_0x24fc('0xde')][_0x24fc('0xcb')](_0x1c4ac1,{});}else{throw new db[(_0x24fc('0xd9'))]['ValidationError'](_0x24fc('0xdf'));}})[_0x24fc('0x24')](function(){return _0x4ee1ad[_0x24fc('0xe0')]({'vidaooSessionId':_0x1efb25['id']});})[_0x24fc('0x24')](respondWithResult(_0xfa9d58,null))[_0x24fc('0x2f')](handleError(_0xfa9d58,null));};exports[_0x24fc('0xe1')]=function(_0x17280c,_0x13f9e3){if(_0x17280c[_0x24fc('0x42')]['id']){delete _0x17280c[_0x24fc('0x42')]['id'];}return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x17280c['params']['id']},'include':[{'model':db[_0x24fc('0xe2')],'as':_0x24fc('0x7b')}]})[_0x24fc('0x24')](handleEntityNotFound(_0x13f9e3,null))[_0x24fc('0x24')](saveUpdates(_0x17280c[_0x24fc('0x42')],null))[_0x24fc('0x24')](respondWithResult(_0x13f9e3,null))[_0x24fc('0x2f')](handleError(_0x13f9e3,null));};exports['abandon']=function(_0x2400a3,_0x16368d,_0x5b1fe2){if(_0x2400a3[_0x24fc('0x42')]['id']){delete _0x2400a3[_0x24fc('0x42')]['id'];}return db['ChatInteraction'][_0x24fc('0x77')]({'where':{'id':_0x2400a3['params']['id']}})[_0x24fc('0x24')](function(_0x21d6d3){if(!_0x21d6d3){logger['error'](_0x24fc('0xe3'),_0x24fc('0xe4'),0x194,_0x24fc('0xe5'));_0x16368d[_0x24fc('0x30')](0x194);}else{if(_0x21d6d3[_0x24fc('0x87')]){throw new db[(_0x24fc('0xd9'))][(_0x24fc('0xdb'))](_0x24fc('0xe6'));}}return _0x21d6d3;})[_0x24fc('0x24')](function(_0x2c6ac9){if(_0x2c6ac9){return _0x2c6ac9[_0x24fc('0x3b')]({'closed':_0x2400a3[_0x24fc('0x42')][_0x24fc('0xe7')],'disposition':_0x2400a3[_0x24fc('0x42')][_0x24fc('0xe8')]})[_0x24fc('0x24')](function(_0x2ccd34){return _0x2ccd34;});}})['then'](function(_0x51764e){return respondWithRpcPromise('AbandonInteraction',_0x24fc('0xe4'),_0x2400a3['body'],client9004);})[_0x24fc('0x24')](respondWithResult(_0x16368d,null))[_0x24fc('0x2f')](handleError(_0x16368d,null));};exports[_0x24fc('0xe9')]=function(_0x2d7ecb,_0xf4f427,_0x41fbf1){_0x2d7ecb[_0x24fc('0x42')][_0x24fc('0x3e')]=_0x2d7ecb[_0x24fc('0xea')][_0x24fc('0xeb')];_0x2d7ecb[_0x24fc('0x42')]['basename']=_0x2d7ecb['file'][_0x24fc('0xec')];_0x2d7ecb[_0x24fc('0x42')][_0x24fc('0x50')]=_0x2d7ecb['file'][_0x24fc('0xed')];return db[_0x24fc('0xee')][_0x24fc('0xcb')](_0x2d7ecb[_0x24fc('0x42')])[_0x24fc('0x24')](respondWithResult(_0xf4f427,0xc9))[_0x24fc('0x2f')](handleError(_0xf4f427,null));};exports['attachmentDownload']=function(_0x3c41c1,_0x337fad,_0x525d4f){return db[_0x24fc('0x4e')]['findOne']({'where':{'id':_0x3c41c1['params']['id']},'raw':!![]})[_0x24fc('0x24')](handleEntityNotFound(_0x337fad,null))[_0x24fc('0x24')](function(_0x282848){if(_0x282848){if(_0x282848[_0x24fc('0xe7')]){return _0x337fad['status'](0x193)[_0x24fc('0x33')]({'status':0x193,'message':_0x24fc('0xef')});}return db[_0x24fc('0xee')][_0x24fc('0xce')]({'where':{'id':_0x3c41c1[_0x24fc('0x52')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x337fad,null));}})[_0x24fc('0x24')](function(_0x2cbaa1){if(_0x2cbaa1){var _0xaab85=_0x2cbaa1[_0x24fc('0xf0')]!==null;var _0x42d3ae=path['join'](config[_0x24fc('0xf1')],_0x24fc('0xf2'));if(_0xaab85){_0x42d3ae=path[_0x24fc('0xf3')](_0x42d3ae,_0x24fc('0xf4'));}var _0xc73868=path[_0x24fc('0xf3')](_0x42d3ae,_0x2cbaa1[_0x24fc('0xf5')]);return _0x337fad[_0x24fc('0xf6')](_0xc73868);}})[_0x24fc('0x2f')](handleError(_0x337fad,null));};exports['close']=function(_0x3f0da7,_0x36f9d2){var _0x50a4c5=null;var _0x299fd8=null;var _0x5d01fa=null;var _0x92d51d=null;if(_0x3f0da7[_0x24fc('0x42')]['id']){delete _0x3f0da7['body']['id'];}if(_0x3f0da7['body'][_0x24fc('0xf7')]){_0x92d51d=path['join'](config[_0x24fc('0xf1')],_0x24fc('0xf8'),util[_0x24fc('0xf9')](_0x24fc('0xfa'),Date['now']()));_0x3f0da7[_0x24fc('0x42')][_0x24fc('0xfb')]=_0x92d51d;}return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x3f0da7[_0x24fc('0xc8')]['id']},'include':[{'model':db[_0x24fc('0xde')],'as':_0x24fc('0xfc'),'include':[{'model':db[_0x24fc('0xfd')],'as':_0x24fc('0xfd')}]}]})[_0x24fc('0x24')](handleEntityNotFound(_0x36f9d2,null))[_0x24fc('0x24')](saveUpdates(_0x3f0da7[_0x24fc('0x42')],null))[_0x24fc('0x24')](function(_0x210bc5){if(_0x210bc5){_0x50a4c5=_0x210bc5;return db[_0x24fc('0xfe')][_0x24fc('0x77')]({'where':{'id':_0x50a4c5[_0x24fc('0xa6')]}});}})[_0x24fc('0x24')](function(_0x4dbbf1){if(_0x4dbbf1){_0x5d01fa=_0x4dbbf1;return db[_0x24fc('0xe2')][_0x24fc('0x77')]({'where':{'id':_0x50a4c5[_0x24fc('0x82')]}});}})[_0x24fc('0x24')](function(_0x61a50b){if(_0x61a50b){_0x299fd8=_0x61a50b;if(_0x92d51d){var _0x282e8c=null;for(var _0x47637c=0x1;_0x47637c<_0x50a4c5[_0x24fc('0xfc')]['length'];++_0x47637c){_0x282e8c=_0x50a4c5[_0x24fc('0xfc')][_0x47637c];var _0x36788c=_0x282e8c[_0x24fc('0x87')]?util['format'](_0x24fc('0xff'),_0x5d01fa[_0x24fc('0x100')],_0x282e8c[_0x24fc('0x87')]):_0x24fc('0x101');var _0x1bbfe1=_0x3f0da7[_0x24fc('0x42')][_0x24fc('0x102')]||util[_0x24fc('0xf9')]('%s%d','Visitor',_0x282e8c[_0x24fc('0x82')]);switch(_0x5d01fa['agentIdentifier']){case _0x24fc('0x103'):_0x36788c=_0x282e8c[_0x24fc('0x87')]?util[_0x24fc('0xf9')](_0x24fc('0xff'),_0x5d01fa[_0x24fc('0x100')],_0x282e8c[_0x24fc('0x87')]):_0x24fc('0x101');break;case'agent_alias':_0x36788c=_0x282e8c[_0x24fc('0x87')]?_0x282e8c[_0x24fc('0xfd')][_0x24fc('0x104')]||_0x282e8c['User'][_0x24fc('0x48')]:_0x24fc('0x101');break;case _0x24fc('0x105'):_0x36788c=_0x282e8c['UserId']?_0x282e8c[_0x24fc('0xfd')][_0x24fc('0x48')]:_0x24fc('0x101');break;default:_0x36788c=_0x282e8c[_0x24fc('0x87')]?util[_0x24fc('0xf9')](_0x24fc('0xff'),_0x5d01fa[_0x24fc('0x100')],_0x282e8c[_0x24fc('0x87')]):_0x24fc('0x101');}var _0x3f1c36=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x282e8c[_0x24fc('0x8e')])[_0x24fc('0xf9')](_0x24fc('0x106')),_0x282e8c['direction']==='in'?_0x1bbfe1:_0x36788c,_0x282e8c[_0x24fc('0x42')]);if(!_0x282e8c[_0x24fc('0x107')]){fs[_0x24fc('0x108')](_0x92d51d,_0x3f1c36);}}return db[_0x24fc('0x109')][_0x24fc('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0x24fc('0x10a')],'as':_0x24fc('0x10b'),'raw':!![]}]});}}})[_0x24fc('0x24')](function(_0x18ab28){if(_0x18ab28&&_0x18ab28[_0x24fc('0x10b')]&&_0x3f0da7[_0x24fc('0x42')]){var _0x14b0b5={'tls':{'rejectUnauthorized':![]}};if(_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x10c')]){_0x14b0b5[_0x24fc('0x10c')]=_0x18ab28['Smtp'][_0x24fc('0x10c')];}else{_0x14b0b5[_0x24fc('0x10d')]=_0x18ab28[_0x24fc('0x10b')]['host'];_0x14b0b5[_0x24fc('0x10e')]=_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x10e')];_0x14b0b5[_0x24fc('0x10f')]=_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x10f')];}if(_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x110')]){_0x14b0b5[_0x24fc('0x111')]={'user':_0x18ab28[_0x24fc('0x10b')][_0x24fc('0xa8')],'pass':_0x18ab28[_0x24fc('0x10b')]['pass']};}return respondWithRpcPromise(_0x24fc('0x112'),_0x24fc('0x113'),{'account':_0x14b0b5,'message':{'from':util[_0x24fc('0xf9')](_0x24fc('0x114'),_0x18ab28[_0x24fc('0x3e')],_0x18ab28[_0x24fc('0xd4')]||_0x18ab28['Smtp'][_0x24fc('0xa8')]),'to':_0x3f0da7[_0x24fc('0x42')][_0x24fc('0xf7')],'subject':_0x24fc('0x115'),'text':util[_0x24fc('0xf9')](_0x24fc('0x116'),_0x3f0da7[_0x24fc('0x42')][_0x24fc('0xf7')]),'attachments':[{'path':_0x92d51d}]}})[_0x24fc('0x24')](function(){return _0x50a4c5;})[_0x24fc('0x2f')](function(_0x51ecc4){console['error'](_0x51ecc4);});}else{return _0x50a4c5;}})['then'](respondWithStatusCode(_0x36f9d2,0xc8))[_0x24fc('0x2f')](handleError(_0x36f9d2,null));};exports[_0x24fc('0x117')]=function(_0x21d021,_0x15035b,_0xe5f00){return db[_0x24fc('0xde')][_0x24fc('0x77')]({'where':{'id':_0x21d021[_0x24fc('0xc8')]['id']}})['then'](handleEntityNotFound(_0x15035b,null))[_0x24fc('0x24')](function(_0x263597){if(_0x263597){return _0x263597['addMessage'](_0x21d021[_0x24fc('0x42')][_0x24fc('0x118')],_[_0x24fc('0x119')](_0x21d021[_0x24fc('0x42')],[_0x24fc('0x118'),'id'])||{});}})[_0x24fc('0x24')](respondWithResult(_0x15035b,null))[_0x24fc('0x2f')](handleError(_0x15035b,null));};exports['getMessages']=function(_0xda0576,_0x1a136f,_0x47833f){var _0x59d561={'raw':![],'where':{}};var _0x4614fe={};var _0x7a2cca={'count':0x0,'rows':[]};return db[_0x24fc('0x4e')][_0x24fc('0xce')]({'where':{'id':_0xda0576[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x1a136f,null))['then'](function(_0x14bd08){if(_0x14bd08){_0x4614fe[_0x24fc('0x54')]=_['keys'](db[_0x24fc('0xde')][_0x24fc('0x4f')]);_0x4614fe[_0x24fc('0x52')]=_[_0x24fc('0x88')](_0xda0576[_0x24fc('0x52')]);_0x4614fe[_0x24fc('0x5e')]=_[_0x24fc('0x53')](_0x4614fe[_0x24fc('0x54')],_0x4614fe[_0x24fc('0x52')]);_0x59d561[_0x24fc('0x56')]=_['intersection'](_0x4614fe['model'],qs[_0x24fc('0x55')](_0xda0576[_0x24fc('0x52')]['fields']));_0x59d561[_0x24fc('0x56')]=_0x59d561[_0x24fc('0x56')][_0x24fc('0x57')]?_0x59d561['attributes']:_0x4614fe[_0x24fc('0x54')];if(!_0xda0576[_0x24fc('0x52')][_0x24fc('0x58')](_0x24fc('0x59'))){_0x59d561['limit']=qs[_0x24fc('0x5a')](_0xda0576['query'][_0x24fc('0x5a')]);_0x59d561['offset']=qs[_0x24fc('0x34')](_0xda0576[_0x24fc('0x52')]['offset']);}_0x59d561[_0x24fc('0x5b')]=qs[_0x24fc('0x5c')](_0xda0576[_0x24fc('0x52')]['sort']);_0x59d561[_0x24fc('0x5d')]=qs[_0x24fc('0x5e')](_[_0x24fc('0x11a')](_0xda0576['query'],_0x4614fe[_0x24fc('0x5e')]));_0x59d561[_0x24fc('0x5d')][_0x24fc('0xc5')]=_0x14bd08['id'];if(_0xda0576['query'][_0x24fc('0x9a')]){_0x59d561[_0x24fc('0x5d')]=_[_0x24fc('0x41')](_0x59d561[_0x24fc('0x5d')],{'$or':_[_0x24fc('0x47')](_0x59d561[_0x24fc('0x56')],function(_0x6fa372){var _0x1e5616={};_0x1e5616[_0x6fa372]={'$like':'%'+_0xda0576[_0x24fc('0x52')]['filter']+'%'};return _0x1e5616;})});}if(_0xda0576['query'][_0x24fc('0x8f')]){var _0x59cd3c=_0xda0576[_0x24fc('0x52')]['$gte']['split'](',');var _0x235cd7={};_0x235cd7[_0x59cd3c[0x0]]={'$gte':moment(_0x59cd3c[0x1])['format'](_0x24fc('0x11b'))};_0x59d561[_0x24fc('0x5d')]=_[_0x24fc('0x41')](_0x59d561['where'],_0x235cd7);}_0x59d561=_[_0x24fc('0x41')]({},_0x59d561,_0xda0576[_0x24fc('0xca')]);return db[_0x24fc('0xde')][_0x24fc('0x36')]({'where':_0x59d561[_0x24fc('0x5d')]})[_0x24fc('0x24')](function(_0x3e6fda){_0x7a2cca[_0x24fc('0x36')]=_0x3e6fda;if(_0xda0576[_0x24fc('0x52')][_0x24fc('0xc9')]){_0x59d561[_0x24fc('0x11c')]=[{'all':!![]}];}return db[_0x24fc('0xde')][_0x24fc('0x11d')](_0x59d561);})[_0x24fc('0x24')](function(_0x4f5acf){_0x7a2cca[_0x24fc('0xc7')]=_0x4f5acf;return _0x7a2cca;});}})[_0x24fc('0x24')](respondWithFilteredResult(_0x1a136f,_0x59d561))[_0x24fc('0x2f')](handleError(_0x1a136f,null));};exports[_0x24fc('0x11e')]=function(_0x4ba8de,_0x53e48e,_0x50012d){var _0x1449f2={'where':{}},_0x43492b={},_0x487e55={'count':0x0,'rows':[]};return db[_0x24fc('0x4e')][_0x24fc('0xce')]({'where':{'id':_0x4ba8de['params']['id']}})['then'](handleEntityNotFound(_0x53e48e,null))[_0x24fc('0x24')](function(_0x5a41d8){if(_0x5a41d8){_0x43492b['model']=_['keys'](db[_0x24fc('0xde')][_0x24fc('0x4f')]);_0x43492b[_0x24fc('0x52')]=_[_0x24fc('0x88')](_0x4ba8de[_0x24fc('0x52')]);_0x43492b[_0x24fc('0x5e')]=_[_0x24fc('0x53')](_0x43492b[_0x24fc('0x54')],_0x43492b['query']);_0x1449f2[_0x24fc('0x56')]=_[_0x24fc('0x53')](_0x43492b[_0x24fc('0x54')],qs[_0x24fc('0x55')](_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x55')]));_0x1449f2[_0x24fc('0x56')]=_0x1449f2[_0x24fc('0x56')][_0x24fc('0x57')]?_0x1449f2[_0x24fc('0x56')]:_0x43492b[_0x24fc('0x54')];if(!_0x4ba8de[_0x24fc('0x52')]['hasOwnProperty'](_0x24fc('0x59'))){_0x1449f2[_0x24fc('0x5a')]=qs[_0x24fc('0x5a')](_0x4ba8de[_0x24fc('0x52')]['limit']);_0x1449f2[_0x24fc('0x34')]=qs[_0x24fc('0x34')](_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x34')]);}_0x1449f2['order']=qs['sort'](_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x5c')]);_0x1449f2[_0x24fc('0x5d')]=qs[_0x24fc('0x5e')](_['pick'](_0x4ba8de[_0x24fc('0x52')],_0x43492b['filters']));_0x1449f2[_0x24fc('0x5d')][_0x24fc('0xc5')]=_0x5a41d8['id'];if(_0x4ba8de[_0x24fc('0x52')]['filter']){_0x1449f2[_0x24fc('0x5d')]=_[_0x24fc('0x41')](_0x1449f2[_0x24fc('0x5d')],{'$or':_[_0x24fc('0x47')](_0x1449f2['attributes'],function(_0x4ae822){var _0x545714={};_0x545714[_0x4ae822]={'$like':'%'+_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x9a')]+'%'};return _0x545714;})});}_0x1449f2[_0x24fc('0x5d')]['secret']=![];if(_0x4ba8de[_0x24fc('0x52')]['id']){_0x1449f2[_0x24fc('0x5d')]['id']={'$gt':_0x4ba8de['query']['id']};}_0x1449f2=_[_0x24fc('0x41')]({},_0x1449f2,_0x4ba8de[_0x24fc('0xca')]);return db[_0x24fc('0xde')][_0x24fc('0x36')]({'where':_0x1449f2['where']})['then'](function(_0x12921f){_0x487e55[_0x24fc('0x36')]=_0x12921f;_0x1449f2['include']=[];if(_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x11f')]){_0x1449f2[_0x24fc('0x11c')]['push']({'model':db[_0x24fc('0xfd')],'as':_0x24fc('0xfd'),'attributes':['id','fullname','alias']});}if(_0x4ba8de[_0x24fc('0x52')][_0x24fc('0xc9')]){_0x1449f2[_0x24fc('0x11c')]=[{'all':!![]}];}return db[_0x24fc('0xde')][_0x24fc('0x11d')](_0x1449f2);})[_0x24fc('0x24')](function(_0x214f7d){_0x487e55[_0x24fc('0xc7')]=_0x214f7d;return _0x487e55;});}})[_0x24fc('0x24')](respondWithFilteredResult(_0x53e48e,_0x1449f2))[_0x24fc('0x2f')](handleError(_0x53e48e,null));};exports[_0x24fc('0x120')]=function(_0x1a7f96,_0x59d246,_0x281eed){return db[_0x24fc('0x4e')]['find']({'where':{'id':_0x1a7f96[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x59d246,null))['then'](function(_0x4e2c71){if(_0x4e2c71){return _0x4e2c71[_0x24fc('0x121')](_0x1a7f96['body'][_0x24fc('0x118')],_['omit'](_0x1a7f96[_0x24fc('0x42')],['ids','id'])||{})[_0x24fc('0x122')](function(){return db[_0x24fc('0x123')][_0x24fc('0x11d')]({'attributes':['id',_0x24fc('0x3e'),_0x24fc('0x61')],'where':{'id':_0x1a7f96[_0x24fc('0x42')][_0x24fc('0x118')]}});})[_0x24fc('0x24')](function(_0x3c5996){socket['emit']('chatInteractionTags:save',{'id':Number(_0x1a7f96['params']['id']),'tags':_0x3c5996||[]});return{'id':Number(_0x1a7f96[_0x24fc('0xc8')]['id']),'tags':_0x3c5996||[]};});}})[_0x24fc('0x24')](respondWithResult(_0x59d246,null))[_0x24fc('0x2f')](handleError(_0x59d246,null));};exports['removeTags']=function(_0x8dc31b,_0x5941bd,_0x4d73bb){return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x8dc31b[_0x24fc('0xc8')]['id']}})['then'](handleEntityNotFound(_0x5941bd,null))[_0x24fc('0x24')](function(_0x464057){if(_0x464057){return _0x464057[_0x24fc('0x124')](_0x8dc31b[_0x24fc('0x52')][_0x24fc('0x118')]);}})[_0x24fc('0x24')](respondWithStatusCode(_0x5941bd,null))['catch'](handleError(_0x5941bd,null));};exports[_0x24fc('0xf6')]=function(_0x9c34d9,_0x3e4f49){var _0x231f0b=moment()[_0x24fc('0x125')]()['toString']();var _0x34355e=path[_0x24fc('0xf3')](config[_0x24fc('0xf1')],_0x24fc('0x126'),_0x24fc('0x127'),'tmp');var _0x4d0910=path[_0x24fc('0xf3')](config[_0x24fc('0xf1')],'server','files',_0x24fc('0x128'));var _0x49025e=path[_0x24fc('0xf3')](_0x34355e,_0x231f0b);var _0x2c9a19=util['format'](_0x24fc('0x129'),_0x9c34d9['params']['id'],_0x231f0b);var _0x38ca24=path['join'](_0x34355e,_0x2c9a19);var _0x53a9aa=[];_0x53a9aa['push']({'model':db['User'],'as':_0x24fc('0xfd'),'attributes':['id',_0x24fc('0x48')],'raw':!![]});_0x53a9aa['push']({'model':db[_0x24fc('0xe2')],'as':_0x24fc('0x7b'),'attributes':['id',_0x24fc('0x12a'),_0x24fc('0x12b')],'raw':!![]});if(_0x9c34d9[_0x24fc('0x52')]['attachments']){_0x53a9aa[_0x24fc('0x4d')]({'model':db[_0x24fc('0xee')],'as':_0x24fc('0xee'),'raw':!![]});}var _0x2139e8=[{'model':db[_0x24fc('0xde')],'as':_0x24fc('0xfc'),'attributes':['id',_0x24fc('0x42'),'createdAt',_0x24fc('0x12c'),_0x24fc('0x107'),_0x24fc('0x95')],'include':_0x53a9aa}];_0x2139e8[_0x24fc('0x4d')]({'model':db['ChatWebsite'],'as':_0x24fc('0x12d'),'attributes':['id',_0x24fc('0x3e')]});_0x2139e8[_0x24fc('0x4d')]({'model':db[_0x24fc('0xfd')],'as':_0x24fc('0x12e'),'attributes':['id','fullname']});return db[_0x24fc('0x4e')]['find']({'where':{'id':_0x9c34d9[_0x24fc('0xc8')]['id']},'include':_0x2139e8})[_0x24fc('0x24')](handleEntityNotFound(_0x3e4f49,null))[_0x24fc('0x24')](function(_0x26179a){if(_0x26179a){var _0x6f1617=_0x26179a['get']({'plain':!![]});fs[_0x24fc('0x12f')](_0x49025e);var _0x57dfbc={'channel':'Chat','account':_0x6f1617['Account'][_0x24fc('0x3e')],'agent':_0x6f1617[_0x24fc('0x12e')]?_0x6f1617[_0x24fc('0x12e')][_0x24fc('0x48')]:_0x24fc('0x130'),'createdAt':moment(_0x6f1617[_0x24fc('0x8e')])[_0x24fc('0xf9')](_0x24fc('0x11b'))[_0x24fc('0xad')](),'closedAt':_0x6f1617[_0x24fc('0xe7')]?moment(_0x6f1617[_0x24fc('0x131')])[_0x24fc('0xf9')](_0x24fc('0x11b'))['toString']():'','disposition':_0x6f1617['disposition'],'chatInfo':{'browser':_0x6f1617['browserName'],'os':_0x6f1617['osName'],'referer':_0x6f1617['referer'],'customerIp':_0x6f1617[_0x24fc('0x132')],'customerPort':_0x6f1617[_0x24fc('0x133')]?_0x6f1617[_0x24fc('0x133')]:_0x24fc('0x130')},'messages':_(_0x6f1617['Messages'])['tail']()[_0x24fc('0x9a')]({'secret':![]})[_0x24fc('0x47')](function(_0x2ee9a6){if(_0x2ee9a6[_0x24fc('0xee')]){var _0x40409c=path['join'](_0x4d0910,_0x2ee9a6[_0x24fc('0xee')][_0x24fc('0xf5')]);if(fs[_0x24fc('0x134')](_0x40409c)){fs['createReadStream'](_0x40409c)['pipe'](fs[_0x24fc('0x135')](path[_0x24fc('0xf3')](_0x49025e,_0x2ee9a6[_0x24fc('0xee')][_0x24fc('0xf5')])));}}return{'date':moment(_0x2ee9a6[_0x24fc('0x8e')])[_0x24fc('0xf9')](_0x24fc('0x11b'))['toString'](),'sender':_0x2ee9a6[_0x24fc('0x12c')]===_0x24fc('0x136')?_0x2ee9a6[_0x24fc('0xfd')]?_0x2ee9a6[_0x24fc('0xfd')]['fullname']:'System':_0x2ee9a6['Contact']['firstName']+(_0x2ee9a6['Contact'][_0x24fc('0x12b')]?'\x20'+_0x2ee9a6[_0x24fc('0x7b')]['lastName']:''),'body':_0x2ee9a6[_0x24fc('0xee')]?_0x2ee9a6[_0x24fc('0xee')]['basename']:_0x2ee9a6[_0x24fc('0x42')],'direction':_0x2ee9a6['direction']===_0x24fc('0x136')?'A':'C','secret':_0x2ee9a6[_0x24fc('0x107')],'read':_0x2ee9a6[_0x24fc('0x95')],'attachment':_0x2ee9a6['Attachment']};})[_0x24fc('0x7e')]()};return ejs[_0x24fc('0x137')](path['join'](config[_0x24fc('0xf1')],'server','views',_0x24fc('0x138')),{'interaction':_0x57dfbc})[_0x24fc('0x24')](function(_0x24101d){var _0x5defce=path[_0x24fc('0xf3')](_0x49025e,_0x24fc('0x139')+_0x6f1617['id']+'-'+_0x231f0b+_0x24fc('0x13a'));var _0x187770={'path':_0x5defce,'channel':_0x24fc('0x13b'),'interactionId':_0x6f1617['id']};return pdf['createPdfFromHTML'](_0x24101d,_0x187770);})['then'](function(){return new BPromise(function(_0x3357cb,_0x2b633b){zipdir(_0x49025e,{'saveTo':_0x38ca24},function(_0x4ad7c4,_0x1d8b26){if(_0x4ad7c4)return _0x2b633b(_0x4ad7c4);return _0x3357cb(_0x1d8b26);});})[_0x24fc('0x24')](function(){return new BPromise(function(_0x4b0f8b,_0x59d408){rimraf(_0x49025e,function(_0x547f6b){if(_0x547f6b)_0x59d408(_0x547f6b);return _0x4b0f8b();});});})[_0x24fc('0x24')](function(){return _0x3e4f49[_0x24fc('0xf6')](_0x38ca24,_0x2c9a19,function(_0x3a2ffd){if(_0x3a2ffd){console[_0x24fc('0x13c')](_0x24fc('0x13d'),_0x3a2ffd);}else{fs[_0x24fc('0x13e')](_0x38ca24);}});});});}else{return _0x3e4f49[_0x24fc('0x30')](0xc8);}})['catch'](handleError(_0x3e4f49,null));}; \ No newline at end of file +var _0x4fc2=['result','catch','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','map','fullname','TagIds','Tags','split','forEach','push','ChatInteraction','rawAttributes','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','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','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','DESC','t.id\x20IN\x20?','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','params','includeAll','options','create','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','filename','mimetype','Attachment','Unauthorized','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','User','ChatWebsite','%s%d','agentAlias','System','customer','website_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','pick','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','includeAgent','addTags','setTags','spread','Tag','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Account','Owner','mkdirSync','N.A.','closedAt','customerIp','customerPort','existsSync','createWriteStream','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','Chat','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message'];(function(_0x5d91b6,_0x124e85){var _0x4070bd=function(_0x5e208a){while(--_0x5e208a){_0x5d91b6['push'](_0x5d91b6['shift']());}};_0x4070bd(++_0x124e85);}(_0x4fc2,0x111));var _0x24fc=function(_0x2d1840,_0x5dc27e){_0x2d1840=_0x2d1840-0x0;var _0xd06a88=_0x4fc2[_0x2d1840];return _0xd06a88;};'use strict';var emlformat=require(_0x24fc('0x0'));var rimraf=require(_0x24fc('0x1'));var zipdir=require(_0x24fc('0x2'));var jsonpatch=require(_0x24fc('0x3'));var rp=require('request-promise');var moment=require(_0x24fc('0x4'));var BPromise=require(_0x24fc('0x5'));var Mustache=require(_0x24fc('0x6'));var util=require('util');var path=require(_0x24fc('0x7'));var sox=require(_0x24fc('0x8'));var csv=require('to-csv');var ejs=require(_0x24fc('0x9'));var fs=require('fs');var fs_extra=require(_0x24fc('0xa'));var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0xf'));var querystring=require(_0x24fc('0x10'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x11'));var authService=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var as=require(_0x24fc('0x14'));var pdf=require(_0x24fc('0x15'));var hardwareService=require(_0x24fc('0x16'));var logger=require(_0x24fc('0x17'))(_0x24fc('0x18'));var utils=require('../../config/utils');var config=require(_0x24fc('0x19'));var licenseUtil=require(_0x24fc('0x1a'));var db=require('../../mysqldb')['db'];config[_0x24fc('0x1b')]=_[_0x24fc('0x1c')](config[_0x24fc('0x1b')],{'host':_0x24fc('0x1d'),'port':0x18eb});var socket=require(_0x24fc('0x1e'))(new Redis(config[_0x24fc('0x1b')]));require('./chatInteraction.socket')[_0x24fc('0x1f')](socket);var jayson=require(_0x24fc('0x20'));var client=jayson[_0x24fc('0x21')][_0x24fc('0x22')]({'port':0x232b});var client9004=jayson['client'][_0x24fc('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x588543,_0x4af098,_0x3385c7,_0x218fb6){return new BPromise(function(_0x41c593,_0x25cb40){var _0x52a884=_0x218fb6||client;return _0x52a884[_0x24fc('0x23')](_0x588543,_0x3385c7)[_0x24fc('0x24')](function(_0x6cfa0a){logger[_0x24fc('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x4af098,_0x24fc('0x26'));logger[_0x24fc('0x27')](_0x24fc('0x28'),_0x4af098,'request\x20sent',JSON[_0x24fc('0x29')](_0x6cfa0a));if(_0x6cfa0a[_0x24fc('0x2a')]){if(_0x6cfa0a[_0x24fc('0x2a')][_0x24fc('0x2b')]===0x1f4){logger['error'](_0x24fc('0x2c'),_0x4af098,_0x6cfa0a['error'][_0x24fc('0x2d')]);return _0x25cb40(_0x6cfa0a['error'][_0x24fc('0x2d')]);}logger[_0x24fc('0x2a')](_0x24fc('0x2c'),_0x4af098,_0x6cfa0a['error'][_0x24fc('0x2d')]);return _0x41c593(_0x6cfa0a['error'][_0x24fc('0x2d')]);}else{logger[_0x24fc('0x25')](_0x24fc('0x2c'),_0x4af098,_0x24fc('0x26'));_0x41c593(_0x6cfa0a[_0x24fc('0x2e')][_0x24fc('0x2d')]);}})[_0x24fc('0x2f')](function(_0x20192b){logger[_0x24fc('0x2a')](_0x24fc('0x2c'),_0x4af098,_0x20192b);_0x25cb40(_0x20192b);});});}function respondWithStatusCode(_0x568441,_0x11c913){_0x11c913=_0x11c913||0xcc;return function(_0x16f27f){if(_0x16f27f){return _0x568441[_0x24fc('0x30')](_0x11c913);}return _0x568441['status'](_0x11c913)[_0x24fc('0x31')]();};}function respondWithResult(_0x3d1ec8,_0x35f9f9){_0x35f9f9=_0x35f9f9||0xc8;return function(_0x290f84){if(_0x290f84){return _0x3d1ec8[_0x24fc('0x32')](_0x35f9f9)[_0x24fc('0x33')](_0x290f84);}};}function respondWithFilteredResult(_0x5ac1f2,_0x240ae7){return function(_0x29a461){if(_0x29a461){var _0x3c99ed=typeof _0x240ae7[_0x24fc('0x34')]===_0x24fc('0x35')&&typeof _0x240ae7['limit']==='undefined';var _0x4e6f73=_0x29a461[_0x24fc('0x36')];var _0x574ba3=_0x3c99ed?0x0:_0x240ae7[_0x24fc('0x34')];var _0x3e6389=_0x3c99ed?_0x29a461[_0x24fc('0x36')]:_0x240ae7[_0x24fc('0x34')]+_0x240ae7['limit'];var _0x66eec0;if(_0x3e6389>=_0x4e6f73){_0x3e6389=_0x4e6f73;_0x66eec0=0xc8;}else{_0x66eec0=0xce;}_0x5ac1f2[_0x24fc('0x32')](_0x66eec0);return _0x5ac1f2['set'](_0x24fc('0x37'),_0x574ba3+'-'+_0x3e6389+'/'+_0x4e6f73)[_0x24fc('0x33')](_0x29a461);}return null;};}function patchUpdates(_0x4d756f){return function(_0x48c62a){try{jsonpatch[_0x24fc('0x38')](_0x48c62a,_0x4d756f,!![]);}catch(_0x56eae7){return BPromise[_0x24fc('0x39')](_0x56eae7);}return _0x48c62a[_0x24fc('0x3a')]();};}function saveUpdates(_0x5491b0,_0x2ae896){return function(_0x33bbf2){if(_0x33bbf2){return _0x33bbf2[_0x24fc('0x3b')](_0x5491b0)[_0x24fc('0x24')](function(_0x1c5874){return _0x1c5874;});}return null;};}function removeEntity(_0x1e205d,_0x3b3932){return function(_0x2a209d){if(_0x2a209d){return _0x2a209d[_0x24fc('0x3c')]()['then'](function(){_0x1e205d[_0x24fc('0x32')](0xcc)[_0x24fc('0x31')]();});}};}function handleEntityNotFound(_0x2fbe30,_0x316aa2){return function(_0x242bd5){if(!_0x242bd5){_0x2fbe30['sendStatus'](0x194);}return _0x242bd5;};}function handleError(_0x56a9bd,_0xd52d10){_0xd52d10=_0xd52d10||0x1f4;return function(_0x5d48fe){logger[_0x24fc('0x2a')](_0x5d48fe[_0x24fc('0x3d')]);if(_0x5d48fe[_0x24fc('0x3e')]){delete _0x5d48fe[_0x24fc('0x3e')];}_0x56a9bd['status'](_0xd52d10)[_0x24fc('0x3f')](_0x5d48fe);};}function getMustacheRender(_0x4f4ec8,_0x65771d){return Mustache[_0x24fc('0x40')](_0x4f4ec8,_[_0x24fc('0x41')](_0x65771d[_0x24fc('0x42')],{'contact':_0x65771d[_0x24fc('0x43')],'message':_0x65771d['message'],'agent':_0x65771d[_0x24fc('0x44')],'interaction':_0x65771d[_0x24fc('0x45')],'account':_0x65771d[_0x24fc('0x46')]}))||'';}function getInteractionUsers(_0x22a75c,_0x5ceae2){return new BPromise(function(_0x172923,_0x2f0bd9){try{if(_0x5ceae2[_0x22a75c['id']]){_0x22a75c['Users']=_[_0x24fc('0x47')](_0x5ceae2[_0x22a75c['id']],function(_0x52df2e){return{'id':_0x52df2e['id'],'fullname':_0x52df2e[_0x24fc('0x48')]};});}}catch(_0x2fd30d){_0x2f0bd9(_0x2fd30d);}_0x172923(_0x22a75c);});}function getInteractionTags(_0x3a15ab,_0x1e045a){return new BPromise(function(_0x431189,_0x278b18){try{if(_0x3a15ab[_0x24fc('0x49')]){_0x3a15ab[_0x24fc('0x4a')]=[];_0x3a15ab['TagIds'][_0x24fc('0x4b')](',')[_0x24fc('0x4c')](function(_0x32f72c){_0x3a15ab['Tags'][_0x24fc('0x4d')](_0x1e045a[_0x32f72c]);});}delete _0x3a15ab[_0x24fc('0x49')];}catch(_0x4ae4a7){_0x278b18(_0x4ae4a7);}_0x431189(_0x3a15ab);});}function updateChatInteraction(_0x2c4a6c,_0x22f30b,_0x2c598c){return new BPromise(function(_0x5e4e9b,_0x31ddd0){return getInteractionUsers(_0x2c4a6c,_0x2c598c)[_0x24fc('0x24')](function(_0x585e48){return getInteractionTags(_0x585e48,_0x22f30b);})[_0x24fc('0x24')](function(_0x169982){_0x5e4e9b(_0x169982);})[_0x24fc('0x2f')](function(_0x2a0ac4){_0x31ddd0(_0x2a0ac4);});});}exports['index']=function(_0x2eecaf,_0x9bc56a){var _0x3ce7b3={},_0x7b38fa={},_0xbcbcfa={'count':0x0,'rows':[]};var _0x58a950=_[_0x24fc('0x47')](db[_0x24fc('0x4e')][_0x24fc('0x4f')],function(_0x3c6ffb){return{'name':_0x3c6ffb['fieldName'],'type':_0x3c6ffb[_0x24fc('0x50')][_0x24fc('0x51')]};});_0x7b38fa['model']=_['map'](_0x58a950,_0x24fc('0x3e'));_0x7b38fa['query']=_['keys'](_0x2eecaf[_0x24fc('0x52')]);_0x7b38fa['filters']=_[_0x24fc('0x53')](_0x7b38fa[_0x24fc('0x54')],_0x7b38fa[_0x24fc('0x52')]);_0x3ce7b3['attributes']=_[_0x24fc('0x53')](_0x7b38fa[_0x24fc('0x54')],qs[_0x24fc('0x55')](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x55')]));_0x3ce7b3[_0x24fc('0x56')]=_0x3ce7b3[_0x24fc('0x56')][_0x24fc('0x57')]?_0x3ce7b3['attributes']:_0x7b38fa['model'];if(!_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x58')](_0x24fc('0x59'))){_0x3ce7b3['limit']=qs['limit'](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x5a')]);_0x3ce7b3[_0x24fc('0x34')]=qs[_0x24fc('0x34')](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x34')]);}_0x3ce7b3[_0x24fc('0x5b')]=qs[_0x24fc('0x5c')](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x5c')]);_0x3ce7b3[_0x24fc('0x5d')]=qs[_0x24fc('0x5e')](_['pick'](_0x2eecaf[_0x24fc('0x52')],_0x7b38fa[_0x24fc('0x5e')]),_0x58a950);var _0x32a466=[];var _0xb0fc00=squel[_0x24fc('0x5f')]()['field']('id')[_0x24fc('0x60')]('name')[_0x24fc('0x60')](_0x24fc('0x61'))[_0x24fc('0x62')](_0x24fc('0x63'));var _0x40f42b=squel[_0x24fc('0x5f')]()['field'](_0x24fc('0x64'))[_0x24fc('0x60')](_0x24fc('0x65'))[_0x24fc('0x60')](_0x24fc('0x66'))[_0x24fc('0x62')]('user_has_chat_interactions','ui')[_0x24fc('0x67')](_0x24fc('0x68'),'u',_0x24fc('0x69'));var _0x1b69ad=squel[_0x24fc('0x5f')]()[_0x24fc('0x62')](_0x24fc('0x6a'),'i')['left_join'](_0x24fc('0x6b'),'c',_0x24fc('0x6c'))['left_join'](_0x24fc('0x68'),'o',_0x24fc('0x6d'))[_0x24fc('0x67')](_0x24fc('0x6e'),'a',_0x24fc('0x6f'))[_0x24fc('0x67')]('chat_messages','me',_0x24fc('0x70'))['left_join'](_0x24fc('0x71'),'it',_0x24fc('0x72'))['left_join'](_0x24fc('0x63'),'t','t.id\x20=\x20it.TagId');var _0x1c1f74=squel['expr']();var _0xdff811=[];var _0x27b612=squel['expr']();var _0x2edef7;if(_0x2eecaf['query'][_0x24fc('0x73')]){_0x2edef7=as[_0x24fc('0x74')](_0x2eecaf['query'][_0x24fc('0x73')]);var _0x3ec1a8=_0x2edef7[_0x24fc('0x75')];for(var _0x47179d=0x0;_0x47179d<_0x2edef7[_0x24fc('0x76')]['length'];_0x47179d++){var _0x39da59=_0x2edef7[_0x24fc('0x76')][_0x47179d];var _0x2d657a='i';var _0x2b5dca=_[_0x24fc('0x77')](_0x58a950,['name',_0x39da59['field']]);if(!_0x2b5dca){switch(_0x39da59[_0x24fc('0x60')]){case _0x24fc('0x78'):if(_0x39da59['value']==0x1){_0x1b69ad['having']('`'+_0x39da59[_0x24fc('0x60')]+_0x24fc('0x79'));}else{_0x1b69ad[_0x24fc('0x7a')]('`'+_0x39da59[_0x24fc('0x60')]+'`\x20>\x200');}break;case _0x24fc('0x7b'):if(_0x39da59[_0x24fc('0x7c')]===_0x24fc('0x7d')){if(_0x39da59[_0x24fc('0x7e')][_0x24fc('0x4b')]('\x20')[_0x24fc('0x57')]>0x1){_0x1c1f74[_0x3ec1a8](_0x24fc('0x7f'),qs[_0x24fc('0x80')](_0x39da59[_0x24fc('0x7e')]),null);}else{var _0x1f6a71='%'+_0x39da59[_0x24fc('0x7e')]+'%';_0x1c1f74[_0x3ec1a8](_0x24fc('0x81'),_0x1f6a71,_0x1f6a71,_0x1f6a71);}}else{_0x2b5dca=_[_0x24fc('0x77')](_0x58a950,[_0x24fc('0x3e'),_0x24fc('0x82')]);_0x39da59['field']=_0x24fc('0x82');_0x10ef7c=as[_0x24fc('0x83')](_0x2d657a,_0x2b5dca[_0x24fc('0x50')],_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c[_0x24fc('0x84')],_0x10ef7c[_0x24fc('0x7e')][_0x24fc('0x85')],_0x10ef7c[_0x24fc('0x7e')][_0x24fc('0x31')]);}break;case'Tag':var _0x3475b8=_0x39da59[_0x24fc('0x7e')][_0x24fc('0x4b')](',')[_0x24fc('0x47')](function(_0x55fceb){return Number(_0x55fceb);});_0x3475b8[_0x24fc('0x4c')](function(_0x29b381){_0x27b612['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x29b381+',%');});_0xdff811=_['union'](_0xdff811,_0x3475b8);break;case'User':if(_0x39da59[_0x24fc('0x7c')]===_0x24fc('0x7d')){_0x1c1f74[_0x3ec1a8](_0x24fc('0x86'),'%'+_0x39da59[_0x24fc('0x7e')]+'%',null);}else{_0x2b5dca=_[_0x24fc('0x77')](_0x58a950,[_0x24fc('0x3e'),'UserId']);_0x39da59[_0x24fc('0x60')]=_0x24fc('0x87');_0x10ef7c=as['buildExpression'](_0x2d657a,_0x2b5dca['type'],_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c[_0x24fc('0x84')],_0x10ef7c[_0x24fc('0x7e')][_0x24fc('0x85')],_0x10ef7c['value'][_0x24fc('0x31')]);}break;case _0x24fc('0x42'):_0x10ef7c=as[_0x24fc('0x83')]('me',null,_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c['text'],_0x10ef7c['value']['start'],_0x10ef7c['value']['end']);break;}}else{var _0x10ef7c=as[_0x24fc('0x83')](_0x2d657a,_0x2b5dca[_0x24fc('0x50')],_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c[_0x24fc('0x84')],_0x10ef7c['value'][_0x24fc('0x85')],_0x10ef7c['value'][_0x24fc('0x31')]);}}}else{var _0x4e6eec=_(_0x2eecaf[_0x24fc('0x52')])[_0x24fc('0x88')]()[_0x24fc('0x47')](function(_0x4291bd){return _[_0x24fc('0x89')](_0x58a950,[_0x24fc('0x3e'),_0x4291bd])?_0x4291bd:undefined;})[_0x24fc('0x8a')]()['value']();if(!_[_0x24fc('0x8b')](_0x4e6eec)){_0x4e6eec[_0x24fc('0x4c')](function(_0x2de101){if(_0x2de101==='ChatWebsiteId'){_0x1b69ad['where'](_0x24fc('0x8c'),[][_0x24fc('0x8d')](_0x2eecaf['query'][_0x2de101]));}else if(_0x2de101===_0x24fc('0x8e')){var _0x1a2e6d=JSON['parse'](_0x2eecaf[_0x24fc('0x52')][_0x2de101])[_0x24fc('0x8f')];var _0x5249ea=JSON[_0x24fc('0x90')](_0x2eecaf[_0x24fc('0x52')][_0x2de101])[_0x24fc('0x91')];_0x1b69ad[_0x24fc('0x5d')](_0x24fc('0x92'),_0x1a2e6d,_0x5249ea);}else{if(_0x2eecaf[_0x24fc('0x52')][_0x2de101]==='null'){_0x1b69ad['where']('i.'+_0x2de101+_0x24fc('0x93'));}else{_0x1b69ad['where']('i.'+_0x2de101+_0x24fc('0x94'),_0x2eecaf['query'][_0x2de101]);}}});}if(_0x2eecaf['query'][_0x24fc('0x95')]){if(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x95')]==0x1){_0x1b69ad[_0x24fc('0x7a')](_0x24fc('0x96'));}else{_0x1b69ad[_0x24fc('0x7a')](_0x24fc('0x97'));}}if(_0x2eecaf[_0x24fc('0x52')]['tag']){_0xdff811=_[_0x24fc('0x98')](_0x2eecaf[_0x24fc('0x52')]['tag'])?_0x2eecaf['query'][_0x24fc('0x99')]:new Array(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x99')]);_0xdff811[_0x24fc('0x4c')](function(_0xd1e6){_0x27b612['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xd1e6+',%');});}if(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x9a')]){var _0x5ca35b=_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x9a')][_0x24fc('0x9b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x24fc('0x9c')](_0x5ca35b)){_0x1c1f74['or'](_0x24fc('0x9d'),_0x5ca35b+'%');}else{_0x1c1f74['or'](_0x24fc('0x9e'),qs[_0x24fc('0x80')](_0x5ca35b))['or'](_0x24fc('0x9f'),_0x5ca35b+'%');}}}_0x1b69ad[_0x24fc('0x5d')](_0x1c1f74);_0x1b69ad[_0x24fc('0xa0')](_0x24fc('0xa1'));var _0x188edb={'type':db['Sequelize'][_0x24fc('0xa2')][_0x24fc('0xa3')],'raw':!![]};var _0x1dcccf=_0x1b69ad['clone']();_0x1dcccf['field']('i.id');_0x1dcccf[_0x24fc('0x60')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x24fc('0x78'));if(_0x3ce7b3[_0x24fc('0x5b')]){_0x3ce7b3['order'][_0x24fc('0x4c')](function(_0x559692){var _0x41cef7=_0x559692[0x0]==='contactName'?_0x559692[0x0]:'i.'+_0x559692[0x0];_0x1b69ad[_0x24fc('0x5b')](_0x41cef7,_0x559692[0x1]===_0x24fc('0xa4')?![]:!![]);});}if(!_[_0x24fc('0x8b')](_0xdff811)){_0x1b69ad[_0x24fc('0x7a')](_0x27b612);_0x1dcccf[_0x24fc('0x5d')](_0x24fc('0xa5'),_0xdff811);}BPromise['resolve']()[_0x24fc('0x24')](function(){if(!_0x2edef7){if(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0xa6')])return;_0x1dcccf[_0x24fc('0x5d')](_0x24fc('0xa7'));_0x1b69ad[_0x24fc('0x5d')](_0x24fc('0xa7'));return;}if(_0x2eecaf[_0x24fc('0xa8')][_0x24fc('0xa9')]!=='agent')return;return _0x2eecaf[_0x24fc('0xa8')][_0x24fc('0xaa')]({'attributes':['id'],'raw':!![]})[_0x24fc('0x24')](function(_0x30ed50){if(_['isEmpty'](_0x30ed50)){_0x1dcccf[_0x24fc('0x5d')](_0x24fc('0xab'));_0x1b69ad[_0x24fc('0x5d')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x1dcccf[_0x24fc('0x5d')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x30ed50,'id'));_0x1b69ad['where'](_0x24fc('0x8c'),_['map'](_0x30ed50,'id'));}});})[_0x24fc('0x24')](function(){if(_0x2eecaf[_0x24fc('0xa8')][_0x24fc('0xa9')]===_0x24fc('0x44')&&!_0x2edef7&&!_0x2eecaf['query'][_0x24fc('0xa6')])return[];return db[_0x24fc('0xac')][_0x24fc('0x52')](_0x1dcccf[_0x24fc('0xad')](),_0x188edb);})[_0x24fc('0x24')](function(_0x5c80a5){_0xbcbcfa[_0x24fc('0x36')]=_0x5c80a5[_0x24fc('0x57')];if(_0xbcbcfa[_0x24fc('0x36')]===0x0)return[];return db[_0x24fc('0xac')]['query'](_0xb0fc00['toString'](),_0x188edb)[_0x24fc('0x24')](function(_0x4216da){_0x32a466=_[_0x24fc('0xae')](_0x4216da,'id');_0x188edb=_[_0x24fc('0x41')](_0x188edb,{'model':db[_0x24fc('0x4e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2eecaf['query'][_0x24fc('0x55')]){_0x3ce7b3[_0x24fc('0x56')][_0x24fc('0x4c')](function(_0x5d5a59){_0x1b69ad[_0x24fc('0x60')]('i.'+_0x5d5a59);});}else{_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xaf'),_0x24fc('0x78'));_0x1b69ad[_0x24fc('0x60')]('a.key','Account.key');_0x1b69ad['field'](_0x24fc('0xb0'),_0x24fc('0xb1'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb2'),_0x24fc('0xb3'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb4'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb5'),_0x24fc('0xb6'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb7'),'Contact.lastName');_0x1b69ad['field'](_0x24fc('0xb8'),'Contact.email');_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb9'),_0x24fc('0xba'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xbb'),_0x24fc('0xbc'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xbd'),_0x24fc('0xbe'));_0x1b69ad['field'](_0x24fc('0xbf'),_0x24fc('0xc0'));_0x1b69ad['field']('o.internal',_0x24fc('0xc1'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xc2'),_0x24fc('0x49'));}if(_0x3ce7b3[_0x24fc('0x5a')])_0x1b69ad[_0x24fc('0x5a')](_0x3ce7b3['limit']);if(_0x3ce7b3[_0x24fc('0x34')])_0x1b69ad[_0x24fc('0x34')](_0x3ce7b3[_0x24fc('0x34')]);return db[_0x24fc('0xac')]['query'](_0x1b69ad[_0x24fc('0xad')](),_0x188edb);})[_0x24fc('0x24')](function(_0x1506e8){if(_0x1506e8['length']>0x0)_0x40f42b[_0x24fc('0x5d')](_0x24fc('0xc3'),_[_0x24fc('0x47')](_0x1506e8,'id'));return db['sequelize'][_0x24fc('0x52')](_0x40f42b[_0x24fc('0xad')](),_0x188edb)['then'](function(_0x543db4){var _0x283251=_[_0x24fc('0xc4')](_0x543db4,_0x24fc('0xc5'));var _0x2029cd=[];_0x1506e8[_0x24fc('0x4c')](function(_0x3afe80){_0x2029cd['push'](updateChatInteraction(_0x3afe80,_0x32a466,_0x283251));});return BPromise[_0x24fc('0xc6')](_0x2029cd);});});})[_0x24fc('0x24')](function(_0x17a6a9){_0xbcbcfa[_0x24fc('0xc7')]=_0x17a6a9;return _0xbcbcfa;})[_0x24fc('0x24')](respondWithFilteredResult(_0x9bc56a,_0x3ce7b3))[_0x24fc('0x2f')](handleError(_0x9bc56a,null));};exports['show']=function(_0x4018d3,_0x4a2522){var _0x5226aa={'raw':![],'where':{'id':_0x4018d3[_0x24fc('0xc8')]['id']}},_0x260a62={};_0x260a62['model']=_[_0x24fc('0x88')](db[_0x24fc('0x4e')][_0x24fc('0x4f')]);_0x260a62[_0x24fc('0x52')]=_['keys'](_0x4018d3[_0x24fc('0x52')]);_0x260a62[_0x24fc('0x5e')]=_[_0x24fc('0x53')](_0x260a62[_0x24fc('0x54')],_0x260a62[_0x24fc('0x52')]);_0x5226aa[_0x24fc('0x56')]=_['intersection'](_0x260a62['model'],qs['fields'](_0x4018d3[_0x24fc('0x52')][_0x24fc('0x55')]));_0x5226aa['attributes']=_0x5226aa[_0x24fc('0x56')][_0x24fc('0x57')]?_0x5226aa[_0x24fc('0x56')]:_0x260a62['model'];if(_0x4018d3[_0x24fc('0x52')][_0x24fc('0xc9')]){_0x5226aa['include']=[{'all':!![]}];}_0x5226aa=_['merge']({},_0x5226aa,_0x4018d3[_0x24fc('0xca')]);return db[_0x24fc('0x4e')][_0x24fc('0x77')](_0x5226aa)['then'](handleEntityNotFound(_0x4a2522,null))[_0x24fc('0x24')](respondWithResult(_0x4a2522,null))['catch'](handleError(_0x4a2522,null));};exports['create']=function(_0x344c0f,_0x52484a){return db['ChatInteraction'][_0x24fc('0xcb')](_0x344c0f['body'],{})[_0x24fc('0x24')](respondWithResult(_0x52484a,0xc9))[_0x24fc('0x2f')](handleError(_0x52484a,null));};exports[_0x24fc('0x3b')]=function(_0x11eaeb,_0x4ae346){if(_0x11eaeb[_0x24fc('0x42')]['id']){delete _0x11eaeb[_0x24fc('0x42')]['id'];}return db['ChatInteraction'][_0x24fc('0x77')]({'where':{'id':_0x11eaeb[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x4ae346,null))[_0x24fc('0x24')](saveUpdates(_0x11eaeb[_0x24fc('0x42')],null))['then'](respondWithResult(_0x4ae346,null))[_0x24fc('0x2f')](handleError(_0x4ae346,null));};exports[_0x24fc('0x3c')]=function(_0x5793d9,_0x759d35){return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x5793d9[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x759d35,null))['then'](removeEntity(_0x759d35,null))[_0x24fc('0x2f')](handleError(_0x759d35,null));};exports['describe']=function(_0x5c8969,_0x42c158){return db[_0x24fc('0x4e')][_0x24fc('0xcc')]()['then'](respondWithResult(_0x42c158,null))['catch'](handleError(_0x42c158,null));};exports[_0x24fc('0xcd')]=function(_0x38fba8,_0xfa9d58){var _0x353a64=_0x38fba8[_0x24fc('0xc8')]['id'];var _0x4ee1ad;var _0x4875bd;var _0x1efb25;return db['ChatInteraction']['findOne']({'where':{'id':_0x353a64}})[_0x24fc('0x24')](function(_0x484775){_0x4ee1ad=_0x484775;return db['ChatWebsite'][_0x24fc('0xce')]({'where':{'id':_0x484775[_0x24fc('0xa6')]},'attributes':['id',_0x24fc('0xcf'),_0x24fc('0xd0'),_0x24fc('0xd1'),_0x24fc('0xd2'),_0x24fc('0xd3')],'raw':!![]});})['then'](function(_0x3b2891){if(_0x3b2891&&_0x3b2891[_0x24fc('0xcf')]&&_0x3b2891[_0x24fc('0xd0')]){_0x4875bd=_0x3b2891;var _0x6e3447={'interaction':{'id':_0x353a64},'agent':{'id':_0x38fba8[_0x24fc('0xa8')]['id'],'name':_0x38fba8[_0x24fc('0xa8')][_0x24fc('0x3e')],'fullname':_0x38fba8[_0x24fc('0xa8')][_0x24fc('0x48')],'email':_0x38fba8[_0x24fc('0xa8')][_0x24fc('0xd4')]},'contact':_0x38fba8[_0x24fc('0x42')][_0x24fc('0x43')],'account':_0x38fba8[_0x24fc('0x42')][_0x24fc('0x46')]};var _0x38ec08={'rejectUnauthorized':![],'method':_0x24fc('0xd5'),'url':_0x24fc('0xd6'),'headers':{'X-APIKEY':_0x3b2891[_0x24fc('0xcf')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x38fba8[_0x24fc('0xa8')][_0x24fc('0xd4')]],'buttons':null,'topic':_0x4875bd[_0x24fc('0xd1')],'note':_[_0x24fc('0xd7')](_0x4875bd[_0x24fc('0xd2')])?null:getMustacheRender(_0x4875bd[_0x24fc('0xd2')],_0x6e3447),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x24fc('0xd7')](_0x4875bd[_0x24fc('0xd3')])){var _0x1d8a8f=getMustacheRender(_0x4875bd[_0x24fc('0xd3')],_0x6e3447);var _0x534388=JSON['parse'](_0x1d8a8f);_0x38ec08['body'][_0x24fc('0xd8')]=_0x534388;}}catch(_0x5aa947){throw new db[(_0x24fc('0xd9'))]['ValidationError'](_0x24fc('0xda'));}return rp(_0x38ec08);}else{throw new db[(_0x24fc('0xd9'))][(_0x24fc('0xdb'))](_0x24fc('0xdc'));}})[_0x24fc('0x24')](function(_0x468477){_0x1efb25=_0x468477;if(_0x1efb25['id']){var _0x1c4ac1={'body':_0x1efb25[_0x24fc('0xdd')],'ChatWebsiteId':_0x4875bd['id'],'ChatInteractionId':_0x4ee1ad['id'],'direction':'out','UserId':_0x38fba8[_0x24fc('0xa8')]['id']};return db[_0x24fc('0xde')][_0x24fc('0xcb')](_0x1c4ac1,{});}else{throw new db[(_0x24fc('0xd9'))]['ValidationError'](_0x24fc('0xdf'));}})[_0x24fc('0x24')](function(){return _0x4ee1ad[_0x24fc('0xe0')]({'vidaooSessionId':_0x1efb25['id']});})[_0x24fc('0x24')](respondWithResult(_0xfa9d58,null))[_0x24fc('0x2f')](handleError(_0xfa9d58,null));};exports[_0x24fc('0xe1')]=function(_0x17280c,_0x13f9e3){if(_0x17280c[_0x24fc('0x42')]['id']){delete _0x17280c[_0x24fc('0x42')]['id'];}return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x17280c['params']['id']},'include':[{'model':db[_0x24fc('0xe2')],'as':_0x24fc('0x7b')}]})[_0x24fc('0x24')](handleEntityNotFound(_0x13f9e3,null))[_0x24fc('0x24')](saveUpdates(_0x17280c[_0x24fc('0x42')],null))[_0x24fc('0x24')](respondWithResult(_0x13f9e3,null))[_0x24fc('0x2f')](handleError(_0x13f9e3,null));};exports['abandon']=function(_0x2400a3,_0x16368d,_0x5b1fe2){if(_0x2400a3[_0x24fc('0x42')]['id']){delete _0x2400a3[_0x24fc('0x42')]['id'];}return db['ChatInteraction'][_0x24fc('0x77')]({'where':{'id':_0x2400a3['params']['id']}})[_0x24fc('0x24')](function(_0x21d6d3){if(!_0x21d6d3){logger['error'](_0x24fc('0xe3'),_0x24fc('0xe4'),0x194,_0x24fc('0xe5'));_0x16368d[_0x24fc('0x30')](0x194);}else{if(_0x21d6d3[_0x24fc('0x87')]){throw new db[(_0x24fc('0xd9'))][(_0x24fc('0xdb'))](_0x24fc('0xe6'));}}return _0x21d6d3;})[_0x24fc('0x24')](function(_0x2c6ac9){if(_0x2c6ac9){return _0x2c6ac9[_0x24fc('0x3b')]({'closed':_0x2400a3[_0x24fc('0x42')][_0x24fc('0xe7')],'disposition':_0x2400a3[_0x24fc('0x42')][_0x24fc('0xe8')]})[_0x24fc('0x24')](function(_0x2ccd34){return _0x2ccd34;});}})['then'](function(_0x51764e){return respondWithRpcPromise('AbandonInteraction',_0x24fc('0xe4'),_0x2400a3['body'],client9004);})[_0x24fc('0x24')](respondWithResult(_0x16368d,null))[_0x24fc('0x2f')](handleError(_0x16368d,null));};exports[_0x24fc('0xe9')]=function(_0x2d7ecb,_0xf4f427,_0x41fbf1){_0x2d7ecb[_0x24fc('0x42')][_0x24fc('0x3e')]=_0x2d7ecb[_0x24fc('0xea')][_0x24fc('0xeb')];_0x2d7ecb[_0x24fc('0x42')]['basename']=_0x2d7ecb['file'][_0x24fc('0xec')];_0x2d7ecb[_0x24fc('0x42')][_0x24fc('0x50')]=_0x2d7ecb['file'][_0x24fc('0xed')];return db[_0x24fc('0xee')][_0x24fc('0xcb')](_0x2d7ecb[_0x24fc('0x42')])[_0x24fc('0x24')](respondWithResult(_0xf4f427,0xc9))[_0x24fc('0x2f')](handleError(_0xf4f427,null));};exports['attachmentDownload']=function(_0x3c41c1,_0x337fad,_0x525d4f){return db[_0x24fc('0x4e')]['findOne']({'where':{'id':_0x3c41c1['params']['id']},'raw':!![]})[_0x24fc('0x24')](handleEntityNotFound(_0x337fad,null))[_0x24fc('0x24')](function(_0x282848){if(_0x282848){if(_0x282848[_0x24fc('0xe7')]){return _0x337fad['status'](0x193)[_0x24fc('0x33')]({'status':0x193,'message':_0x24fc('0xef')});}return db[_0x24fc('0xee')][_0x24fc('0xce')]({'where':{'id':_0x3c41c1[_0x24fc('0x52')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x337fad,null));}})[_0x24fc('0x24')](function(_0x2cbaa1){if(_0x2cbaa1){var _0xaab85=_0x2cbaa1[_0x24fc('0xf0')]!==null;var _0x42d3ae=path['join'](config[_0x24fc('0xf1')],_0x24fc('0xf2'));if(_0xaab85){_0x42d3ae=path[_0x24fc('0xf3')](_0x42d3ae,_0x24fc('0xf4'));}var _0xc73868=path[_0x24fc('0xf3')](_0x42d3ae,_0x2cbaa1[_0x24fc('0xf5')]);return _0x337fad[_0x24fc('0xf6')](_0xc73868);}})[_0x24fc('0x2f')](handleError(_0x337fad,null));};exports['close']=function(_0x3f0da7,_0x36f9d2){var _0x50a4c5=null;var _0x299fd8=null;var _0x5d01fa=null;var _0x92d51d=null;if(_0x3f0da7[_0x24fc('0x42')]['id']){delete _0x3f0da7['body']['id'];}if(_0x3f0da7['body'][_0x24fc('0xf7')]){_0x92d51d=path['join'](config[_0x24fc('0xf1')],_0x24fc('0xf8'),util[_0x24fc('0xf9')](_0x24fc('0xfa'),Date['now']()));_0x3f0da7[_0x24fc('0x42')][_0x24fc('0xfb')]=_0x92d51d;}return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x3f0da7[_0x24fc('0xc8')]['id']},'include':[{'model':db[_0x24fc('0xde')],'as':_0x24fc('0xfc'),'include':[{'model':db[_0x24fc('0xfd')],'as':_0x24fc('0xfd')}]}]})[_0x24fc('0x24')](handleEntityNotFound(_0x36f9d2,null))[_0x24fc('0x24')](saveUpdates(_0x3f0da7[_0x24fc('0x42')],null))[_0x24fc('0x24')](function(_0x210bc5){if(_0x210bc5){_0x50a4c5=_0x210bc5;return db[_0x24fc('0xfe')][_0x24fc('0x77')]({'where':{'id':_0x50a4c5[_0x24fc('0xa6')]}});}})[_0x24fc('0x24')](function(_0x4dbbf1){if(_0x4dbbf1){_0x5d01fa=_0x4dbbf1;return db[_0x24fc('0xe2')][_0x24fc('0x77')]({'where':{'id':_0x50a4c5[_0x24fc('0x82')]}});}})[_0x24fc('0x24')](function(_0x61a50b){if(_0x61a50b){_0x299fd8=_0x61a50b;if(_0x92d51d){var _0x282e8c=null;for(var _0x47637c=0x1;_0x47637c<_0x50a4c5[_0x24fc('0xfc')]['length'];++_0x47637c){_0x282e8c=_0x50a4c5[_0x24fc('0xfc')][_0x47637c];var _0x36788c=_0x282e8c[_0x24fc('0x87')]?util['format'](_0x24fc('0xff'),_0x5d01fa[_0x24fc('0x100')],_0x282e8c[_0x24fc('0x87')]):_0x24fc('0x101');var _0x1bbfe1=_0x3f0da7[_0x24fc('0x42')][_0x24fc('0x102')]||util[_0x24fc('0xf9')]('%s%d','Visitor',_0x282e8c[_0x24fc('0x82')]);switch(_0x5d01fa['agentIdentifier']){case _0x24fc('0x103'):_0x36788c=_0x282e8c[_0x24fc('0x87')]?util[_0x24fc('0xf9')](_0x24fc('0xff'),_0x5d01fa[_0x24fc('0x100')],_0x282e8c[_0x24fc('0x87')]):_0x24fc('0x101');break;case'agent_alias':_0x36788c=_0x282e8c[_0x24fc('0x87')]?_0x282e8c[_0x24fc('0xfd')][_0x24fc('0x104')]||_0x282e8c['User'][_0x24fc('0x48')]:_0x24fc('0x101');break;case _0x24fc('0x105'):_0x36788c=_0x282e8c['UserId']?_0x282e8c[_0x24fc('0xfd')][_0x24fc('0x48')]:_0x24fc('0x101');break;default:_0x36788c=_0x282e8c[_0x24fc('0x87')]?util[_0x24fc('0xf9')](_0x24fc('0xff'),_0x5d01fa[_0x24fc('0x100')],_0x282e8c[_0x24fc('0x87')]):_0x24fc('0x101');}var _0x3f1c36=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x282e8c[_0x24fc('0x8e')])[_0x24fc('0xf9')](_0x24fc('0x106')),_0x282e8c['direction']==='in'?_0x1bbfe1:_0x36788c,_0x282e8c[_0x24fc('0x42')]);if(!_0x282e8c[_0x24fc('0x107')]){fs[_0x24fc('0x108')](_0x92d51d,_0x3f1c36);}}return db[_0x24fc('0x109')][_0x24fc('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0x24fc('0x10a')],'as':_0x24fc('0x10b'),'raw':!![]}]});}}})[_0x24fc('0x24')](function(_0x18ab28){if(_0x18ab28&&_0x18ab28[_0x24fc('0x10b')]&&_0x3f0da7[_0x24fc('0x42')]){var _0x14b0b5={'tls':{'rejectUnauthorized':![]}};if(_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x10c')]){_0x14b0b5[_0x24fc('0x10c')]=_0x18ab28['Smtp'][_0x24fc('0x10c')];}else{_0x14b0b5[_0x24fc('0x10d')]=_0x18ab28[_0x24fc('0x10b')]['host'];_0x14b0b5[_0x24fc('0x10e')]=_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x10e')];_0x14b0b5[_0x24fc('0x10f')]=_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x10f')];}if(_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x110')]){_0x14b0b5[_0x24fc('0x111')]={'user':_0x18ab28[_0x24fc('0x10b')][_0x24fc('0xa8')],'pass':_0x18ab28[_0x24fc('0x10b')]['pass']};}return respondWithRpcPromise(_0x24fc('0x112'),_0x24fc('0x113'),{'account':_0x14b0b5,'message':{'from':util[_0x24fc('0xf9')](_0x24fc('0x114'),_0x18ab28[_0x24fc('0x3e')],_0x18ab28[_0x24fc('0xd4')]||_0x18ab28['Smtp'][_0x24fc('0xa8')]),'to':_0x3f0da7[_0x24fc('0x42')][_0x24fc('0xf7')],'subject':_0x24fc('0x115'),'text':util[_0x24fc('0xf9')](_0x24fc('0x116'),_0x3f0da7[_0x24fc('0x42')][_0x24fc('0xf7')]),'attachments':[{'path':_0x92d51d}]}})[_0x24fc('0x24')](function(){return _0x50a4c5;})[_0x24fc('0x2f')](function(_0x51ecc4){console['error'](_0x51ecc4);});}else{return _0x50a4c5;}})['then'](respondWithStatusCode(_0x36f9d2,0xc8))[_0x24fc('0x2f')](handleError(_0x36f9d2,null));};exports[_0x24fc('0x117')]=function(_0x21d021,_0x15035b,_0xe5f00){return db[_0x24fc('0xde')][_0x24fc('0x77')]({'where':{'id':_0x21d021[_0x24fc('0xc8')]['id']}})['then'](handleEntityNotFound(_0x15035b,null))[_0x24fc('0x24')](function(_0x263597){if(_0x263597){return _0x263597['addMessage'](_0x21d021[_0x24fc('0x42')][_0x24fc('0x118')],_[_0x24fc('0x119')](_0x21d021[_0x24fc('0x42')],[_0x24fc('0x118'),'id'])||{});}})[_0x24fc('0x24')](respondWithResult(_0x15035b,null))[_0x24fc('0x2f')](handleError(_0x15035b,null));};exports['getMessages']=function(_0xda0576,_0x1a136f,_0x47833f){var _0x59d561={'raw':![],'where':{}};var _0x4614fe={};var _0x7a2cca={'count':0x0,'rows':[]};return db[_0x24fc('0x4e')][_0x24fc('0xce')]({'where':{'id':_0xda0576[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x1a136f,null))['then'](function(_0x14bd08){if(_0x14bd08){_0x4614fe[_0x24fc('0x54')]=_['keys'](db[_0x24fc('0xde')][_0x24fc('0x4f')]);_0x4614fe[_0x24fc('0x52')]=_[_0x24fc('0x88')](_0xda0576[_0x24fc('0x52')]);_0x4614fe[_0x24fc('0x5e')]=_[_0x24fc('0x53')](_0x4614fe[_0x24fc('0x54')],_0x4614fe[_0x24fc('0x52')]);_0x59d561[_0x24fc('0x56')]=_['intersection'](_0x4614fe['model'],qs[_0x24fc('0x55')](_0xda0576[_0x24fc('0x52')]['fields']));_0x59d561[_0x24fc('0x56')]=_0x59d561[_0x24fc('0x56')][_0x24fc('0x57')]?_0x59d561['attributes']:_0x4614fe[_0x24fc('0x54')];if(!_0xda0576[_0x24fc('0x52')][_0x24fc('0x58')](_0x24fc('0x59'))){_0x59d561['limit']=qs[_0x24fc('0x5a')](_0xda0576['query'][_0x24fc('0x5a')]);_0x59d561['offset']=qs[_0x24fc('0x34')](_0xda0576[_0x24fc('0x52')]['offset']);}_0x59d561[_0x24fc('0x5b')]=qs[_0x24fc('0x5c')](_0xda0576[_0x24fc('0x52')]['sort']);_0x59d561[_0x24fc('0x5d')]=qs[_0x24fc('0x5e')](_[_0x24fc('0x11a')](_0xda0576['query'],_0x4614fe[_0x24fc('0x5e')]));_0x59d561[_0x24fc('0x5d')][_0x24fc('0xc5')]=_0x14bd08['id'];if(_0xda0576['query'][_0x24fc('0x9a')]){_0x59d561[_0x24fc('0x5d')]=_[_0x24fc('0x41')](_0x59d561[_0x24fc('0x5d')],{'$or':_[_0x24fc('0x47')](_0x59d561[_0x24fc('0x56')],function(_0x6fa372){var _0x1e5616={};_0x1e5616[_0x6fa372]={'$like':'%'+_0xda0576[_0x24fc('0x52')]['filter']+'%'};return _0x1e5616;})});}if(_0xda0576['query'][_0x24fc('0x8f')]){var _0x59cd3c=_0xda0576[_0x24fc('0x52')]['$gte']['split'](',');var _0x235cd7={};_0x235cd7[_0x59cd3c[0x0]]={'$gte':moment(_0x59cd3c[0x1])['format'](_0x24fc('0x11b'))};_0x59d561[_0x24fc('0x5d')]=_[_0x24fc('0x41')](_0x59d561['where'],_0x235cd7);}_0x59d561=_[_0x24fc('0x41')]({},_0x59d561,_0xda0576[_0x24fc('0xca')]);return db[_0x24fc('0xde')][_0x24fc('0x36')]({'where':_0x59d561[_0x24fc('0x5d')]})[_0x24fc('0x24')](function(_0x3e6fda){_0x7a2cca[_0x24fc('0x36')]=_0x3e6fda;if(_0xda0576[_0x24fc('0x52')][_0x24fc('0xc9')]){_0x59d561[_0x24fc('0x11c')]=[{'all':!![]}];}return db[_0x24fc('0xde')][_0x24fc('0x11d')](_0x59d561);})[_0x24fc('0x24')](function(_0x4f5acf){_0x7a2cca[_0x24fc('0xc7')]=_0x4f5acf;return _0x7a2cca;});}})[_0x24fc('0x24')](respondWithFilteredResult(_0x1a136f,_0x59d561))[_0x24fc('0x2f')](handleError(_0x1a136f,null));};exports[_0x24fc('0x11e')]=function(_0x4ba8de,_0x53e48e,_0x50012d){var _0x1449f2={'where':{}},_0x43492b={},_0x487e55={'count':0x0,'rows':[]};return db[_0x24fc('0x4e')][_0x24fc('0xce')]({'where':{'id':_0x4ba8de['params']['id']}})['then'](handleEntityNotFound(_0x53e48e,null))[_0x24fc('0x24')](function(_0x5a41d8){if(_0x5a41d8){_0x43492b['model']=_['keys'](db[_0x24fc('0xde')][_0x24fc('0x4f')]);_0x43492b[_0x24fc('0x52')]=_[_0x24fc('0x88')](_0x4ba8de[_0x24fc('0x52')]);_0x43492b[_0x24fc('0x5e')]=_[_0x24fc('0x53')](_0x43492b[_0x24fc('0x54')],_0x43492b['query']);_0x1449f2[_0x24fc('0x56')]=_[_0x24fc('0x53')](_0x43492b[_0x24fc('0x54')],qs[_0x24fc('0x55')](_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x55')]));_0x1449f2[_0x24fc('0x56')]=_0x1449f2[_0x24fc('0x56')][_0x24fc('0x57')]?_0x1449f2[_0x24fc('0x56')]:_0x43492b[_0x24fc('0x54')];if(!_0x4ba8de[_0x24fc('0x52')]['hasOwnProperty'](_0x24fc('0x59'))){_0x1449f2[_0x24fc('0x5a')]=qs[_0x24fc('0x5a')](_0x4ba8de[_0x24fc('0x52')]['limit']);_0x1449f2[_0x24fc('0x34')]=qs[_0x24fc('0x34')](_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x34')]);}_0x1449f2['order']=qs['sort'](_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x5c')]);_0x1449f2[_0x24fc('0x5d')]=qs[_0x24fc('0x5e')](_['pick'](_0x4ba8de[_0x24fc('0x52')],_0x43492b['filters']));_0x1449f2[_0x24fc('0x5d')][_0x24fc('0xc5')]=_0x5a41d8['id'];if(_0x4ba8de[_0x24fc('0x52')]['filter']){_0x1449f2[_0x24fc('0x5d')]=_[_0x24fc('0x41')](_0x1449f2[_0x24fc('0x5d')],{'$or':_[_0x24fc('0x47')](_0x1449f2['attributes'],function(_0x4ae822){var _0x545714={};_0x545714[_0x4ae822]={'$like':'%'+_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x9a')]+'%'};return _0x545714;})});}_0x1449f2[_0x24fc('0x5d')]['secret']=![];if(_0x4ba8de[_0x24fc('0x52')]['id']){_0x1449f2[_0x24fc('0x5d')]['id']={'$gt':_0x4ba8de['query']['id']};}_0x1449f2=_[_0x24fc('0x41')]({},_0x1449f2,_0x4ba8de[_0x24fc('0xca')]);return db[_0x24fc('0xde')][_0x24fc('0x36')]({'where':_0x1449f2['where']})['then'](function(_0x12921f){_0x487e55[_0x24fc('0x36')]=_0x12921f;_0x1449f2['include']=[];if(_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x11f')]){_0x1449f2[_0x24fc('0x11c')]['push']({'model':db[_0x24fc('0xfd')],'as':_0x24fc('0xfd'),'attributes':['id','fullname','alias']});}if(_0x4ba8de[_0x24fc('0x52')][_0x24fc('0xc9')]){_0x1449f2[_0x24fc('0x11c')]=[{'all':!![]}];}return db[_0x24fc('0xde')][_0x24fc('0x11d')](_0x1449f2);})[_0x24fc('0x24')](function(_0x214f7d){_0x487e55[_0x24fc('0xc7')]=_0x214f7d;return _0x487e55;});}})[_0x24fc('0x24')](respondWithFilteredResult(_0x53e48e,_0x1449f2))[_0x24fc('0x2f')](handleError(_0x53e48e,null));};exports[_0x24fc('0x120')]=function(_0x1a7f96,_0x59d246,_0x281eed){return db[_0x24fc('0x4e')]['find']({'where':{'id':_0x1a7f96[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x59d246,null))['then'](function(_0x4e2c71){if(_0x4e2c71){return _0x4e2c71[_0x24fc('0x121')](_0x1a7f96['body'][_0x24fc('0x118')],_['omit'](_0x1a7f96[_0x24fc('0x42')],['ids','id'])||{})[_0x24fc('0x122')](function(){return db[_0x24fc('0x123')][_0x24fc('0x11d')]({'attributes':['id',_0x24fc('0x3e'),_0x24fc('0x61')],'where':{'id':_0x1a7f96[_0x24fc('0x42')][_0x24fc('0x118')]}});})[_0x24fc('0x24')](function(_0x3c5996){socket['emit']('chatInteractionTags:save',{'id':Number(_0x1a7f96['params']['id']),'tags':_0x3c5996||[]});return{'id':Number(_0x1a7f96[_0x24fc('0xc8')]['id']),'tags':_0x3c5996||[]};});}})[_0x24fc('0x24')](respondWithResult(_0x59d246,null))[_0x24fc('0x2f')](handleError(_0x59d246,null));};exports['removeTags']=function(_0x8dc31b,_0x5941bd,_0x4d73bb){return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x8dc31b[_0x24fc('0xc8')]['id']}})['then'](handleEntityNotFound(_0x5941bd,null))[_0x24fc('0x24')](function(_0x464057){if(_0x464057){return _0x464057[_0x24fc('0x124')](_0x8dc31b[_0x24fc('0x52')][_0x24fc('0x118')]);}})[_0x24fc('0x24')](respondWithStatusCode(_0x5941bd,null))['catch'](handleError(_0x5941bd,null));};exports[_0x24fc('0xf6')]=function(_0x9c34d9,_0x3e4f49){var _0x231f0b=moment()[_0x24fc('0x125')]()['toString']();var _0x34355e=path[_0x24fc('0xf3')](config[_0x24fc('0xf1')],_0x24fc('0x126'),_0x24fc('0x127'),'tmp');var _0x4d0910=path[_0x24fc('0xf3')](config[_0x24fc('0xf1')],'server','files',_0x24fc('0x128'));var _0x49025e=path[_0x24fc('0xf3')](_0x34355e,_0x231f0b);var _0x2c9a19=util['format'](_0x24fc('0x129'),_0x9c34d9['params']['id'],_0x231f0b);var _0x38ca24=path['join'](_0x34355e,_0x2c9a19);var _0x53a9aa=[];_0x53a9aa['push']({'model':db['User'],'as':_0x24fc('0xfd'),'attributes':['id',_0x24fc('0x48')],'raw':!![]});_0x53a9aa['push']({'model':db[_0x24fc('0xe2')],'as':_0x24fc('0x7b'),'attributes':['id',_0x24fc('0x12a'),_0x24fc('0x12b')],'raw':!![]});if(_0x9c34d9[_0x24fc('0x52')]['attachments']){_0x53a9aa[_0x24fc('0x4d')]({'model':db[_0x24fc('0xee')],'as':_0x24fc('0xee'),'raw':!![]});}var _0x2139e8=[{'model':db[_0x24fc('0xde')],'as':_0x24fc('0xfc'),'attributes':['id',_0x24fc('0x42'),'createdAt',_0x24fc('0x12c'),_0x24fc('0x107'),_0x24fc('0x95')],'include':_0x53a9aa}];_0x2139e8[_0x24fc('0x4d')]({'model':db['ChatWebsite'],'as':_0x24fc('0x12d'),'attributes':['id',_0x24fc('0x3e')]});_0x2139e8[_0x24fc('0x4d')]({'model':db[_0x24fc('0xfd')],'as':_0x24fc('0x12e'),'attributes':['id','fullname']});return db[_0x24fc('0x4e')]['find']({'where':{'id':_0x9c34d9[_0x24fc('0xc8')]['id']},'include':_0x2139e8})[_0x24fc('0x24')](handleEntityNotFound(_0x3e4f49,null))[_0x24fc('0x24')](function(_0x26179a){if(_0x26179a){var _0x6f1617=_0x26179a['get']({'plain':!![]});fs[_0x24fc('0x12f')](_0x49025e);var _0x57dfbc={'channel':'Chat','account':_0x6f1617['Account'][_0x24fc('0x3e')],'agent':_0x6f1617[_0x24fc('0x12e')]?_0x6f1617[_0x24fc('0x12e')][_0x24fc('0x48')]:_0x24fc('0x130'),'createdAt':moment(_0x6f1617[_0x24fc('0x8e')])[_0x24fc('0xf9')](_0x24fc('0x11b'))[_0x24fc('0xad')](),'closedAt':_0x6f1617[_0x24fc('0xe7')]?moment(_0x6f1617[_0x24fc('0x131')])[_0x24fc('0xf9')](_0x24fc('0x11b'))['toString']():'','disposition':_0x6f1617['disposition'],'chatInfo':{'browser':_0x6f1617['browserName'],'os':_0x6f1617['osName'],'referer':_0x6f1617['referer'],'customerIp':_0x6f1617[_0x24fc('0x132')],'customerPort':_0x6f1617[_0x24fc('0x133')]?_0x6f1617[_0x24fc('0x133')]:_0x24fc('0x130')},'messages':_(_0x6f1617['Messages'])['tail']()[_0x24fc('0x9a')]({'secret':![]})[_0x24fc('0x47')](function(_0x2ee9a6){if(_0x2ee9a6[_0x24fc('0xee')]){var _0x40409c=path['join'](_0x4d0910,_0x2ee9a6[_0x24fc('0xee')][_0x24fc('0xf5')]);if(fs[_0x24fc('0x134')](_0x40409c)){fs['createReadStream'](_0x40409c)['pipe'](fs[_0x24fc('0x135')](path[_0x24fc('0xf3')](_0x49025e,_0x2ee9a6[_0x24fc('0xee')][_0x24fc('0xf5')])));}}return{'date':moment(_0x2ee9a6[_0x24fc('0x8e')])[_0x24fc('0xf9')](_0x24fc('0x11b'))['toString'](),'sender':_0x2ee9a6[_0x24fc('0x12c')]===_0x24fc('0x136')?_0x2ee9a6[_0x24fc('0xfd')]?_0x2ee9a6[_0x24fc('0xfd')]['fullname']:'System':_0x2ee9a6['Contact']['firstName']+(_0x2ee9a6['Contact'][_0x24fc('0x12b')]?'\x20'+_0x2ee9a6[_0x24fc('0x7b')]['lastName']:''),'body':_0x2ee9a6[_0x24fc('0xee')]?_0x2ee9a6[_0x24fc('0xee')]['basename']:_0x2ee9a6[_0x24fc('0x42')],'direction':_0x2ee9a6['direction']===_0x24fc('0x136')?'A':'C','secret':_0x2ee9a6[_0x24fc('0x107')],'read':_0x2ee9a6[_0x24fc('0x95')],'attachment':_0x2ee9a6['Attachment']};})[_0x24fc('0x7e')]()};return ejs[_0x24fc('0x137')](path['join'](config[_0x24fc('0xf1')],'server','views',_0x24fc('0x138')),{'interaction':_0x57dfbc})[_0x24fc('0x24')](function(_0x24101d){var _0x5defce=path[_0x24fc('0xf3')](_0x49025e,_0x24fc('0x139')+_0x6f1617['id']+'-'+_0x231f0b+_0x24fc('0x13a'));var _0x187770={'path':_0x5defce,'channel':_0x24fc('0x13b'),'interactionId':_0x6f1617['id']};return pdf['createPdfFromHTML'](_0x24101d,_0x187770);})['then'](function(){return new BPromise(function(_0x3357cb,_0x2b633b){zipdir(_0x49025e,{'saveTo':_0x38ca24},function(_0x4ad7c4,_0x1d8b26){if(_0x4ad7c4)return _0x2b633b(_0x4ad7c4);return _0x3357cb(_0x1d8b26);});})[_0x24fc('0x24')](function(){return new BPromise(function(_0x4b0f8b,_0x59d408){rimraf(_0x49025e,function(_0x547f6b){if(_0x547f6b)_0x59d408(_0x547f6b);return _0x4b0f8b();});});})[_0x24fc('0x24')](function(){return _0x3e4f49[_0x24fc('0xf6')](_0x38ca24,_0x2c9a19,function(_0x3a2ffd){if(_0x3a2ffd){console[_0x24fc('0x13c')](_0x24fc('0x13d'),_0x3a2ffd);}else{fs[_0x24fc('0x13e')](_0x38ca24);}});});});}else{return _0x3e4f49[_0x24fc('0x30')](0xc8);}})['catch'](handleError(_0x3e4f49,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 39a73e2..84cea7c 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 _0xc2d9=['remove','getUsers','then','Users','map','findAll','setDataValue','length','emit','hasOwnProperty','exports','events','ChatInteraction','../../mysqldb','ChatMessage','save','update'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0xc2d9,0x71));var _0x9c2d=function(_0x5eb58f,_0x2de089){_0x5eb58f=_0x5eb58f-0x0;var _0x539bb6=_0xc2d9[_0x5eb58f];return _0x539bb6;};'use strict';var EventEmitter=require(_0x9c2d('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x9c2d('0x1')];var ChatMessage=require(_0x9c2d('0x2'))['db'][_0x9c2d('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9c2d('0x4'),'afterUpdate':_0x9c2d('0x5'),'afterDestroy':_0x9c2d('0x6')};function emitEvent(_0x3db3f4){return function(_0x3b0ac0,_0x3c0d85,_0x4732c0){_0x3b0ac0[_0x9c2d('0x7')]({'attributes':['id'],'raw':!![]})[_0x9c2d('0x8')](function(_0x26e221){_0x3b0ac0['setDataValue'](_0x9c2d('0x9'),_0x26e221[_0x9c2d('0xa')](function(_0x290d4c){return{'id':_0x290d4c['id']};}));return ChatMessage[_0x9c2d('0xb')]({'where':{'ChatInteractionId':_0x3b0ac0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9c2d('0x8')](function(_0x2f6b12){_0x3b0ac0[_0x9c2d('0xc')]('unreadMessages',_0x2f6b12[_0x9c2d('0xd')]);ChatInteractionEvents['emit'](_0x3db3f4+':'+_0x3b0ac0['id'],_0x3b0ac0);ChatInteractionEvents[_0x9c2d('0xe')](_0x3db3f4,_0x3b0ac0);_0x4732c0(null);})['catch'](_0x4732c0(null));};}for(var e in events){if(events[_0x9c2d('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x9c2d('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xb8fd=['../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','getUsers','then','setDataValue','Users','map','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0xb8fd,0xdc));var _0xdb8f=function(_0x2c3d24,_0x1f5e07){_0x2c3d24=_0x2c3d24-0x0;var _0x14fbef=_0xb8fd[_0x2c3d24];return _0x14fbef;};'use strict';var EventEmitter=require(_0xdb8f('0x0'));var ChatInteraction=require(_0xdb8f('0x1'))['db'][_0xdb8f('0x2')];var ChatMessage=require(_0xdb8f('0x1'))['db'][_0xdb8f('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdb8f('0x4'),'afterUpdate':_0xdb8f('0x5'),'afterDestroy':_0xdb8f('0x6')};function emitEvent(_0x192397){return function(_0x40b96a,_0x3edb4f,_0x1cd887){_0x40b96a[_0xdb8f('0x7')]({'attributes':['id'],'raw':!![]})[_0xdb8f('0x8')](function(_0x11239b){_0x40b96a[_0xdb8f('0x9')](_0xdb8f('0xa'),_0x11239b[_0xdb8f('0xb')](function(_0x384a12){return{'id':_0x384a12['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x40b96a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1a4fad){_0x40b96a['setDataValue']('unreadMessages',_0x1a4fad['length']);ChatInteractionEvents[_0xdb8f('0xc')](_0x192397+':'+_0x40b96a['id'],_0x40b96a);ChatInteractionEvents[_0xdb8f('0xc')](_0x192397,_0x40b96a);_0x1cd887(null);})[_0xdb8f('0xd')](_0x1cd887(null));};}for(var e in events){if(events[_0xdb8f('0xe')](e)){var event=events[e];ChatInteraction[_0xdb8f('0xf')](e,emitEvent(event));}}module[_0xdb8f('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 29ced3f..16fbbce 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 _0xcf4c=['exports','define','ChatInteraction','chat_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0xcf4c,0xd8));var _0xccf4=function(_0x1cb514,_0x4fa2ce){_0x1cb514=_0x1cb514-0x0;var _0x139aed=_0xcf4c[_0x1cb514];return _0x139aed;};'use strict';var _=require('lodash');var util=require(_0xccf4('0x0'));var logger=require(_0xccf4('0x1'))(_0xccf4('0x2'));var moment=require('moment');var BPromise=require(_0xccf4('0x3'));var rp=require(_0xccf4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xccf4('0x5'));var config=require(_0xccf4('0x6'));var attributes=require(_0xccf4('0x7'));module[_0xccf4('0x8')]=function(_0x891393,_0x1b54fb){return _0x891393[_0xccf4('0x9')](_0xccf4('0xa'),attributes,{'tableName':_0xccf4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2828fe,_0x4dd70e,_0x4b1b4d){if(_0x2828fe['changed'](_0xccf4('0xc'))){_0x2828fe['closedAt']=moment()['format'](_0xccf4('0xd'));}_0x4b1b4d(null,_0x2828fe);}},'charset':_0xccf4('0xe'),'collate':_0xccf4('0xf')});}; \ No newline at end of file +var _0x86ed=['moment','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x4c1ec2,_0x4f42b7){var _0x3f6f1c=function(_0xc82652){while(--_0xc82652){_0x4c1ec2['push'](_0x4c1ec2['shift']());}};_0x3f6f1c(++_0x4f42b7);}(_0x86ed,0x9f));var _0xd86e=function(_0x13a7d8,_0x21ac15){_0x13a7d8=_0x13a7d8-0x0;var _0x869238=_0x86ed[_0x13a7d8];return _0x869238;};'use strict';var _=require(_0xd86e('0x0'));var util=require(_0xd86e('0x1'));var logger=require(_0xd86e('0x2'))('api');var moment=require(_0xd86e('0x3'));var BPromise=require(_0xd86e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd86e('0x5'));var rimraf=require(_0xd86e('0x6'));var config=require(_0xd86e('0x7'));var attributes=require(_0xd86e('0x8'));module[_0xd86e('0x9')]=function(_0x425f00,_0x35460e){return _0x425f00[_0xd86e('0xa')](_0xd86e('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4fc512,_0x4531ac,_0x52515b){if(_0x4fc512['changed'](_0xd86e('0xc'))){_0x4fc512[_0xd86e('0xd')]=moment()[_0xd86e('0xe')](_0xd86e('0xf'));}_0x52515b(null,_0x4fc512);}},'charset':_0xd86e('0x10'),'collate':_0xd86e('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index d18a0d3..8ea51e1 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 _0x61b1=['socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','limit','then','catch','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x40a77f,_0x1d5f8d){var _0x415aa1=function(_0x1e45bc){while(--_0x1e45bc){_0x40a77f['push'](_0x40a77f['shift']());}};_0x415aa1(++_0x1d5f8d);}(_0x61b1,0xe7));var _0x161b=function(_0x864393,_0x1b9d2b){_0x864393=_0x864393-0x0;var _0x275730=_0x61b1[_0x864393];return _0x275730;};'use strict';var _=require(_0x161b('0x0'));var util=require(_0x161b('0x1'));var moment=require(_0x161b('0x2'));var BPromise=require(_0x161b('0x3'));var rs=require(_0x161b('0x4'));var fs=require('fs');var Redis=require(_0x161b('0x5'));var db=require(_0x161b('0x6'))['db'];var utils=require(_0x161b('0x7'));var logger=require('../../config/logger')(_0x161b('0x8'));var config=require(_0x161b('0x9'));var jayson=require(_0x161b('0xa'));var client=jayson[_0x161b('0xb')][_0x161b('0xc')]({'port':0x232a});config[_0x161b('0xd')]=_['defaults'](config['redis'],{'host':_0x161b('0xe'),'port':0x18eb});var socket=require(_0x161b('0xf'))(new Redis(config[_0x161b('0xd')]));require(_0x161b('0x10'))[_0x161b('0x11')](socket);function respondWithRpcPromise(_0x284cfd,_0x5da380,_0xaeda42){return new BPromise(function(_0xcd2289,_0x28a128){return client[_0x161b('0x12')](_0x284cfd,_0xaeda42)['then'](function(_0x21de7f){logger[_0x161b('0x13')](_0x161b('0x14'),_0x5da380,_0x161b('0x15'));logger[_0x161b('0x16')](_0x161b('0x17'),_0x5da380,_0x161b('0x15'),JSON[_0x161b('0x18')](_0x21de7f));if(_0x21de7f[_0x161b('0x19')]){if(_0x21de7f[_0x161b('0x19')]['code']===0x1f4){logger[_0x161b('0x19')](_0x161b('0x14'),_0x5da380,_0x21de7f[_0x161b('0x19')]['message']);return _0x28a128(_0x21de7f[_0x161b('0x19')][_0x161b('0x1a')]);}logger[_0x161b('0x19')](_0x161b('0x14'),_0x5da380,_0x21de7f[_0x161b('0x19')][_0x161b('0x1a')]);return _0xcd2289(_0x21de7f['error'][_0x161b('0x1a')]);}else{logger[_0x161b('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x5da380,'request\x20sent');_0xcd2289(_0x21de7f['result']['message']);}})['catch'](function(_0x43b1c0){logger[_0x161b('0x19')](_0x161b('0x14'),_0x5da380,_0x43b1c0);_0x28a128(_0x43b1c0);});});}exports[_0x161b('0x1b')]=function(_0x1324b1){var _0x35bd6b=this;return new Promise(function(_0x3d6bed,_0x3357fe){return db[_0x161b('0x1c')][_0x161b('0x1d')](_0x1324b1[_0x161b('0x1e')],{'raw':_0x1324b1[_0x161b('0x1f')]?_0x1324b1['options'][_0x161b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1324b1['options']?_0x1324b1['options']['where']||null:null,'attributes':_0x1324b1[_0x161b('0x1f')]?_0x1324b1[_0x161b('0x1f')][_0x161b('0x21')]||null:null,'limit':_0x1324b1[_0x161b('0x1f')]?_0x1324b1[_0x161b('0x1f')][_0x161b('0x22')]||null:null})[_0x161b('0x23')](function(_0x444af6){logger[_0x161b('0x13')](_0x161b('0x1b'),_0x1324b1);logger[_0x161b('0x16')](_0x161b('0x1b'),_0x1324b1,JSON[_0x161b('0x18')](_0x444af6));_0x3d6bed(_0x444af6);})[_0x161b('0x24')](function(_0x463451){logger[_0x161b('0x19')](_0x161b('0x1b'),_0x463451[_0x161b('0x1a')],_0x1324b1);_0x3357fe(_0x35bd6b[_0x161b('0x19')](0x1f4,_0x463451['message']));});});};exports['AddTagsToChatInteraction']=function(_0x524b3b){return new Promise(function(_0x7828d9,_0x56b91b){return db[_0x161b('0x1c')]['find']({'where':_0x524b3b[_0x161b('0x1f')]?_0x524b3b[_0x161b('0x1f')]['where']||null:null})[_0x161b('0x23')](function(_0x5e425a){if(_0x5e425a){return _0x5e425a['addTags'](_0x524b3b[_0x161b('0x1e')][_0x161b('0x25')],_[_0x161b('0x26')](_0x524b3b['body'],[_0x161b('0x25'),'id'])||{});}})[_0x161b('0x27')](function(_0x789376){logger[_0x161b('0x13')](_0x161b('0x28'),_0x524b3b);logger['debug'](_0x161b('0x28'),_0x524b3b,JSON['stringify'](_0x789376));_0x7828d9(_0x789376);})[_0x161b('0x24')](function(_0x3b8f04){logger[_0x161b('0x19')]('AddTags',_0x3b8f04[_0x161b('0x1a')],_0x524b3b);_0x56b91b(_this['error'](0x1f4,_0x3b8f04[_0x161b('0x1a')]));});});}; \ No newline at end of file +var _0x04a1=['addTags','omit','ids','spread','AddTags','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','limit'];(function(_0x3b21f3,_0x1ff01a){var _0x346838=function(_0x365589){while(--_0x365589){_0x3b21f3['push'](_0x3b21f3['shift']());}};_0x346838(++_0x1ff01a);}(_0x04a1,0x74));var _0x104a=function(_0xcdf426,_0x4cf680){_0xcdf426=_0xcdf426-0x0;var _0x10c664=_0x04a1[_0xcdf426];return _0x10c664;};'use strict';var _=require('lodash');var util=require(_0x104a('0x0'));var moment=require(_0x104a('0x1'));var BPromise=require(_0x104a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x104a('0x3'))['db'];var utils=require(_0x104a('0x4'));var logger=require(_0x104a('0x5'))(_0x104a('0x6'));var config=require(_0x104a('0x7'));var jayson=require(_0x104a('0x8'));var client=jayson[_0x104a('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x104a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x104a('0xb'))(new Redis(config['redis']));require(_0x104a('0xc'))['register'](socket);function respondWithRpcPromise(_0xa514db,_0x3c3c51,_0x5defd7){return new BPromise(function(_0x4bad64,_0x99f409){return client[_0x104a('0xd')](_0xa514db,_0x5defd7)[_0x104a('0xe')](function(_0x180457){logger[_0x104a('0xf')](_0x104a('0x10'),_0x3c3c51,_0x104a('0x11'));logger[_0x104a('0x12')](_0x104a('0x13'),_0x3c3c51,_0x104a('0x11'),JSON[_0x104a('0x14')](_0x180457));if(_0x180457[_0x104a('0x15')]){if(_0x180457[_0x104a('0x15')][_0x104a('0x16')]===0x1f4){logger[_0x104a('0x15')](_0x104a('0x10'),_0x3c3c51,_0x180457[_0x104a('0x15')][_0x104a('0x17')]);return _0x99f409(_0x180457[_0x104a('0x15')]['message']);}logger['error'](_0x104a('0x10'),_0x3c3c51,_0x180457[_0x104a('0x15')][_0x104a('0x17')]);return _0x4bad64(_0x180457['error']['message']);}else{logger[_0x104a('0xf')](_0x104a('0x10'),_0x3c3c51,_0x104a('0x11'));_0x4bad64(_0x180457['result']['message']);}})[_0x104a('0x18')](function(_0x3a6d38){logger['error'](_0x104a('0x10'),_0x3c3c51,_0x3a6d38);_0x99f409(_0x3a6d38);});});}exports[_0x104a('0x19')]=function(_0x3607c0){var _0x3a4763=this;return new Promise(function(_0xe7d49f,_0x46bbc6){return db[_0x104a('0x1a')]['update'](_0x3607c0[_0x104a('0x1b')],{'raw':_0x3607c0['options']?_0x3607c0[_0x104a('0x1c')][_0x104a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3607c0[_0x104a('0x1c')]?_0x3607c0[_0x104a('0x1c')][_0x104a('0x1e')]||null:null,'attributes':_0x3607c0[_0x104a('0x1c')]?_0x3607c0['options']['attributes']||null:null,'limit':_0x3607c0[_0x104a('0x1c')]?_0x3607c0[_0x104a('0x1c')][_0x104a('0x1f')]||null:null})[_0x104a('0xe')](function(_0x454005){logger[_0x104a('0xf')]('UpdateChatInteraction',_0x3607c0);logger['debug'](_0x104a('0x19'),_0x3607c0,JSON[_0x104a('0x14')](_0x454005));_0xe7d49f(_0x454005);})[_0x104a('0x18')](function(_0xcfa596){logger[_0x104a('0x15')]('UpdateChatInteraction',_0xcfa596['message'],_0x3607c0);_0x46bbc6(_0x3a4763['error'](0x1f4,_0xcfa596[_0x104a('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0x812cd){return new Promise(function(_0x44efef,_0x185a8d){return db['ChatInteraction']['find']({'where':_0x812cd[_0x104a('0x1c')]?_0x812cd[_0x104a('0x1c')][_0x104a('0x1e')]||null:null})[_0x104a('0xe')](function(_0x3cb6a4){if(_0x3cb6a4){return _0x3cb6a4[_0x104a('0x20')](_0x812cd[_0x104a('0x1b')]['ids'],_[_0x104a('0x21')](_0x812cd[_0x104a('0x1b')],[_0x104a('0x22'),'id'])||{});}})[_0x104a('0x23')](function(_0x1d3221){logger[_0x104a('0xf')](_0x104a('0x24'),_0x812cd);logger['debug'](_0x104a('0x24'),_0x812cd,JSON[_0x104a('0x14')](_0x1d3221));_0x44efef(_0x1d3221);})[_0x104a('0x18')](function(_0x1bd8ea){logger[_0x104a('0x15')](_0x104a('0x24'),_0x1bd8ea[_0x104a('0x17')],_0x812cd);_0x185a8d(_this[_0x104a('0x15')](0x1f4,_0x1bd8ea[_0x104a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index d8889c2..b5ff9c1 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 _0x2873=['./chatInteraction.events','save','emit','removeListener','register','length'];(function(_0x27971d,_0x430067){var _0x27494f=function(_0x113fad){while(--_0x113fad){_0x27971d['push'](_0x27971d['shift']());}};_0x27494f(++_0x430067);}(_0x2873,0x168));var _0x3287=function(_0x112a14,_0x5e2cc3){_0x112a14=_0x112a14-0x0;var _0x59a6d1=_0x2873[_0x112a14];return _0x59a6d1;};'use strict';var ChatInteractionEvents=require(_0x3287('0x0'));var events=[_0x3287('0x1'),'remove','update'];function createListener(_0x543915,_0x212577){return function(_0x1774a2){_0x212577[_0x3287('0x2')](_0x543915,_0x1774a2);};}function removeListener(_0x5c311e,_0x2222c3){return function(){ChatInteractionEvents[_0x3287('0x3')](_0x5c311e,_0x2222c3);};}exports[_0x3287('0x4')]=function(_0x21530e){for(var _0x29ffd0=0x0,_0x36b258=events[_0x3287('0x5')];_0x29ffd0<_0x36b258;_0x29ffd0++){var _0x1be785=events[_0x29ffd0];var _0x46789f=createListener('chatInteraction:'+_0x1be785,_0x21530e);ChatInteractionEvents['on'](_0x1be785,_0x46789f);}}; \ No newline at end of file +var _0xa0f4=['register','chatInteraction:','./chatInteraction.events','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0f4,0x11f));var _0x4a0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0f4[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require(_0x4a0f('0x0'));var events=['save',_0x4a0f('0x1'),'update'];function createListener(_0x4262e5,_0x2c6011){return function(_0x76f340){_0x2c6011[_0x4a0f('0x2')](_0x4262e5,_0x76f340);};}function removeListener(_0x556081,_0x46c1fe){return function(){ChatInteractionEvents['removeListener'](_0x556081,_0x46c1fe);};}exports[_0x4a0f('0x3')]=function(_0x2cb4da){for(var _0x492aae=0x0,_0x44dbb8=events['length'];_0x492aae<_0x44dbb8;_0x492aae++){var _0x486c51=events[_0x492aae];var _0x5e892a=createListener(_0x4a0f('0x4')+_0x486c51,_0x2cb4da);ChatInteractionEvents['on'](_0x486c51,_0x5e892a);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 3192155..11659ef 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 _0x4e47=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','isAuthenticated','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','%s-%s','now','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','update','abandon','delete'];(function(_0x20cc6d,_0x4e50ac){var _0x4d3e4f=function(_0x355e52){while(--_0x355e52){_0x20cc6d['push'](_0x20cc6d['shift']());}};_0x4d3e4f(++_0x4e50ac);}(_0x4e47,0x18a));var _0x74e4=function(_0x2eaf70,_0x2ed086){_0x2eaf70=_0x2eaf70-0x0;var _0x36fdad=_0x4e47[_0x2eaf70];return _0x36fdad;};'use strict';var multer=require(_0x74e4('0x0'));var util=require(_0x74e4('0x1'));var path=require('path');var timeout=require(_0x74e4('0x2'));var express=require(_0x74e4('0x3'));var router=express[_0x74e4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x74e4('0x5'));var config=require(_0x74e4('0x6'));var controller=require(_0x74e4('0x7'));router[_0x74e4('0x8')]('/',auth['isAuthenticated'](),controller[_0x74e4('0x9')]);router[_0x74e4('0x8')](_0x74e4('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x74e4('0x8')](_0x74e4('0xb'),auth[_0x74e4('0xc')](),controller[_0x74e4('0xd')]);router[_0x74e4('0x8')](_0x74e4('0xe'),auth[_0x74e4('0xc')](),controller[_0x74e4('0xf')]);router[_0x74e4('0x8')](_0x74e4('0x10'),auth['isAuthenticated'](),controller[_0x74e4('0x11')]);router[_0x74e4('0x8')](_0x74e4('0x12'),auth['isChatInteractionAuthorized'](),controller[_0x74e4('0x13')]);router[_0x74e4('0x8')](_0x74e4('0x14'),auth[_0x74e4('0x15')](),controller[_0x74e4('0x16')]);router[_0x74e4('0x17')]('/',auth[_0x74e4('0x15')](),controller[_0x74e4('0x18')]);router['post'](_0x74e4('0x19'),auth[_0x74e4('0x15')](),controller[_0x74e4('0x1a')]);var upload=multer({'storage':multer[_0x74e4('0x1b')]({'destination':function(_0x17d004,_0x23fe24,_0x220d3d){_0x220d3d(null,path[_0x74e4('0x1c')](config['root'],_0x74e4('0x1d')));},'filename':function(_0x15b186,_0x498515,_0x14945f){_0x14945f(null,util['format'](_0x74e4('0x1e'),Date[_0x74e4('0x1f')](),_0x498515['originalname'][_0x74e4('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x74e4('0x17')](_0x74e4('0x21'),upload[_0x74e4('0x22')](_0x74e4('0x23')),controller[_0x74e4('0x24')]);router[_0x74e4('0x17')](_0x74e4('0x10'),auth[_0x74e4('0xc')](),controller[_0x74e4('0x25')]);router[_0x74e4('0x17')](_0x74e4('0x26'),auth[_0x74e4('0x15')](),interaction['tracked'](_0x74e4('0x27'),_0x74e4('0x28')),controller[_0x74e4('0x29')]);router[_0x74e4('0x2a')]('/:id',auth[_0x74e4('0x15')](),interaction[_0x74e4('0x2b')](_0x74e4('0x27'),'chatinteraction:update'),controller[_0x74e4('0x2c')]);router['put']('/:id/custom_update',controller['customUpdate']);router[_0x74e4('0x2a')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x74e4('0x2d')]);router[_0x74e4('0x2a')]('/:id/close',controller['close']);router[_0x74e4('0x2e')](_0x74e4('0xb'),auth['isAuthenticated'](),interaction[_0x74e4('0x2b')](_0x74e4('0x27'),'chatinteraction:destroy'),controller[_0x74e4('0x2f')]);router[_0x74e4('0x2e')](_0x74e4('0x26'),auth[_0x74e4('0x15')](),controller['removeTags']);module[_0x74e4('0x30')]=router; \ No newline at end of file +var _0xc870=['getMyMessages','/:id/download','post','create','createVidaooSession','diskStorage','root','server/files/attachments/','%s-%s','now','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','tracked','chat','addTags','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','getMessages','/:id/my_messages'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xc870,0x118));var _0x0c87=function(_0x239525,_0x533860){_0x239525=_0x239525-0x0;var _0xe1a43a=_0xc870[_0x239525];return _0xe1a43a;};'use strict';var multer=require(_0x0c87('0x0'));var util=require(_0x0c87('0x1'));var path=require(_0x0c87('0x2'));var timeout=require(_0x0c87('0x3'));var express=require(_0x0c87('0x4'));var router=express[_0x0c87('0x5')]();var fs_extra=require(_0x0c87('0x6'));var auth=require(_0x0c87('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0c87('0x8'));router[_0x0c87('0x9')]('/',auth['isAuthenticated'](),controller[_0x0c87('0xa')]);router['get'](_0x0c87('0xb'),auth[_0x0c87('0xc')](),controller[_0x0c87('0xd')]);router[_0x0c87('0x9')](_0x0c87('0xe'),auth[_0x0c87('0xf')](),controller[_0x0c87('0x10')]);router['get'](_0x0c87('0x11'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0x0c87('0x9')]('/:id/messages',auth[_0x0c87('0xc')](),controller[_0x0c87('0x12')]);router[_0x0c87('0x9')](_0x0c87('0x13'),auth[_0x0c87('0xf')](),controller[_0x0c87('0x14')]);router[_0x0c87('0x9')](_0x0c87('0x15'),auth[_0x0c87('0xc')](),controller['download']);router[_0x0c87('0x16')]('/',auth[_0x0c87('0xc')](),controller[_0x0c87('0x17')]);router[_0x0c87('0x16')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x0c87('0x18')]);var upload=multer({'storage':multer[_0x0c87('0x19')]({'destination':function(_0x4246e5,_0x3f8e38,_0x1882fd){_0x1882fd(null,path['join'](config[_0x0c87('0x1a')],_0x0c87('0x1b')));},'filename':function(_0x3a921e,_0xde4d74,_0x11137b){_0x11137b(null,util['format'](_0x0c87('0x1c'),Date[_0x0c87('0x1d')](),_0xde4d74['originalname'][_0x0c87('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x0c87('0x1f'),upload[_0x0c87('0x20')](_0x0c87('0x21')),controller[_0x0c87('0x22')]);router[_0x0c87('0x16')](_0x0c87('0x23'),auth['isChatInteractionAuthorized'](),controller[_0x0c87('0x24')]);router[_0x0c87('0x16')]('/:id/tags',auth[_0x0c87('0xc')](),interaction[_0x0c87('0x25')](_0x0c87('0x26'),'chatinteraction:addtags'),controller[_0x0c87('0x27')]);router['put']('/:id',auth[_0x0c87('0xc')](),interaction[_0x0c87('0x25')](_0x0c87('0x26'),'chatinteraction:update'),controller['update']);router[_0x0c87('0x28')](_0x0c87('0x29'),controller[_0x0c87('0x2a')]);router[_0x0c87('0x28')](_0x0c87('0x2b'),auth[_0x0c87('0xf')](),controller[_0x0c87('0x2c')]);router[_0x0c87('0x28')]('/:id/close',controller[_0x0c87('0x2d')]);router['delete'](_0x0c87('0xe'),auth['isAuthenticated'](),interaction[_0x0c87('0x25')](_0x0c87('0x26'),'chatinteraction:destroy'),controller[_0x0c87('0x2e')]);router[_0x0c87('0x2f')]('/:id/tags',auth[_0x0c87('0xc')](),controller[_0x0c87('0x30')]);module[_0x0c87('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index d192825..2a099d1 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 _0x4f8f=['BOOLEAN','INTEGER','sequelize','exports','medium'];(function(_0xd7538c,_0x4ae6b8){var _0xab1b7=function(_0x1a1073){while(--_0x1a1073){_0xd7538c['push'](_0xd7538c['shift']());}};_0xab1b7(++_0x4ae6b8);}(_0x4f8f,0x115));var _0xf4f8=function(_0x31e814,_0xaadd33){_0x31e814=_0x31e814-0x0;var _0x344a0f=_0x4f8f[_0x31e814];return _0x344a0f;};'use strict';var Sequelize=require(_0xf4f8('0x0'));module[_0xf4f8('0x1')]={'body':{'type':Sequelize['TEXT'](_0xf4f8('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf4f8('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf4f8('0x4')]}}; \ No newline at end of file +var _0xbd28=['BOOLEAN','exports','TEXT'];(function(_0x59a983,_0x1d74e3){var _0x496598=function(_0x4f7637){while(--_0x4f7637){_0x59a983['push'](_0x59a983['shift']());}};_0x496598(++_0x1d74e3);}(_0xbd28,0xbe));var _0x8bd2=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0xbd28[_0x541a67];return _0x45da2a;};'use strict';var Sequelize=require('sequelize');module[_0x8bd2('0x0')]={'body':{'type':Sequelize[_0x8bd2('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8bd2('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 1bac159..f86a34d 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 _0x316a=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','find','create','body','update','catch','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','role','userpic','online','allowmessenger','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','read','sort','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type'];(function(_0x5bc15d,_0x5ba0dc){var _0x35bd41=function(_0x23941b){while(--_0x23941b){_0x5bc15d['push'](_0x5bc15d['shift']());}};_0x35bd41(++_0x5ba0dc);}(_0x316a,0x180));var _0xa316=function(_0x47c6a2,_0x277274){_0x47c6a2=_0x47c6a2-0x0;var _0x2bc3ef=_0x316a[_0x47c6a2];return _0x2bc3ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa316('0x0'));var zipdir=require(_0xa316('0x1'));var jsonpatch=require(_0xa316('0x2'));var rp=require(_0xa316('0x3'));var moment=require(_0xa316('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa316('0x5'));var path=require(_0xa316('0x6'));var sox=require(_0xa316('0x7'));var csv=require(_0xa316('0x8'));var ejs=require(_0xa316('0x9'));var fs=require('fs');var fs_extra=require(_0xa316('0xa'));var _=require(_0xa316('0xb'));var squel=require(_0xa316('0xc'));var crypto=require(_0xa316('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa316('0xe'));var toCsv=require(_0xa316('0x8'));var querystring=require('querystring');var Papa=require(_0xa316('0xf'));var Redis=require('ioredis');var authService=require(_0xa316('0x10'));var qs=require(_0xa316('0x11'));var as=require(_0xa316('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa316('0x13'))(_0xa316('0x14'));var utils=require(_0xa316('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa316('0x16'));var db=require(_0xa316('0x17'))['db'];config[_0xa316('0x18')]=_['defaults'](config[_0xa316('0x18')],{'host':_0xa316('0x19'),'port':0x18eb});var socket=require(_0xa316('0x1a'))(new Redis(config['redis']));require(_0xa316('0x1b'))['register'](socket);function respondWithStatusCode(_0x503595,_0x3b0edb){_0x3b0edb=_0x3b0edb||0xcc;return function(_0x16ffaa){if(_0x16ffaa){return _0x503595[_0xa316('0x1c')](_0x3b0edb);}return _0x503595[_0xa316('0x1d')](_0x3b0edb)[_0xa316('0x1e')]();};}function respondWithResult(_0x2e108f,_0x18c5e7){_0x18c5e7=_0x18c5e7||0xc8;return function(_0x1229b9){if(_0x1229b9){return _0x2e108f[_0xa316('0x1d')](_0x18c5e7)[_0xa316('0x1f')](_0x1229b9);}};}function respondWithFilteredResult(_0x328769,_0x3dde44){return function(_0x9e3289){if(_0x9e3289){var _0x5a7122=typeof _0x3dde44[_0xa316('0x20')]===_0xa316('0x21')&&typeof _0x3dde44[_0xa316('0x22')]===_0xa316('0x21');var _0x54908c=_0x9e3289['count'];var _0x4a2a37=_0x5a7122?0x0:_0x3dde44['offset'];var _0x32da43=_0x5a7122?_0x9e3289[_0xa316('0x23')]:_0x3dde44['offset']+_0x3dde44[_0xa316('0x22')];var _0x576868;if(_0x32da43>=_0x54908c){_0x32da43=_0x54908c;_0x576868=0xc8;}else{_0x576868=0xce;}_0x328769[_0xa316('0x1d')](_0x576868);return _0x328769[_0xa316('0x24')](_0xa316('0x25'),_0x4a2a37+'-'+_0x32da43+'/'+_0x54908c)[_0xa316('0x1f')](_0x9e3289);}return null;};}function patchUpdates(_0x2f5c4c){return function(_0x54e709){try{jsonpatch[_0xa316('0x26')](_0x54e709,_0x2f5c4c,!![]);}catch(_0x1cb262){return BPromise[_0xa316('0x27')](_0x1cb262);}return _0x54e709[_0xa316('0x28')]();};}function saveUpdates(_0x298132,_0x4a4b42){return function(_0x40426e){if(_0x40426e){return _0x40426e['update'](_0x298132)[_0xa316('0x29')](function(_0x4a8026){return _0x4a8026;});}return null;};}function removeEntity(_0x762b18,_0x21afcb){return function(_0x2a5385){if(_0x2a5385){return _0x2a5385[_0xa316('0x2a')]()[_0xa316('0x29')](function(){_0x762b18['status'](0xcc)[_0xa316('0x1e')]();});}};}function handleEntityNotFound(_0x1dfd68,_0xd50b87){return function(_0x5be9d0){if(!_0x5be9d0){_0x1dfd68[_0xa316('0x1c')](0x194);}return _0x5be9d0;};}function handleError(_0x45e314,_0x4aaaae){_0x4aaaae=_0x4aaaae||0x1f4;return function(_0x282647){logger[_0xa316('0x2b')](_0x282647[_0xa316('0x2c')]);if(_0x282647[_0xa316('0x2d')]){delete _0x282647[_0xa316('0x2d')];}_0x45e314[_0xa316('0x1d')](_0x4aaaae)[_0xa316('0x2e')](_0x282647);};}exports['index']=function(_0x1b2eb6,_0x35e80d){var _0x1e1d98={},_0x16decd={},_0x26505f={'count':0x0,'rows':[]};var _0x134411=_[_0xa316('0x2f')](db[_0xa316('0x30')][_0xa316('0x31')],function(_0x580a69){return{'name':_0x580a69[_0xa316('0x32')],'type':_0x580a69[_0xa316('0x33')][_0xa316('0x34')]};});_0x16decd[_0xa316('0x35')]=_['map'](_0x134411,_0xa316('0x2d'));_0x16decd[_0xa316('0x36')]=_['keys'](_0x1b2eb6[_0xa316('0x36')]);_0x16decd[_0xa316('0x37')]=_[_0xa316('0x38')](_0x16decd[_0xa316('0x35')],_0x16decd[_0xa316('0x36')]);_0x1e1d98[_0xa316('0x39')]=_[_0xa316('0x38')](_0x16decd[_0xa316('0x35')],qs['fields'](_0x1b2eb6[_0xa316('0x36')][_0xa316('0x3a')]));_0x1e1d98['attributes']=_0x1e1d98[_0xa316('0x39')][_0xa316('0x3b')]?_0x1e1d98['attributes']:_0x16decd[_0xa316('0x35')];if(!_0x1b2eb6['query'][_0xa316('0x3c')](_0xa316('0x3d'))){_0x1e1d98['limit']=qs[_0xa316('0x22')](_0x1b2eb6[_0xa316('0x36')][_0xa316('0x22')]);_0x1e1d98[_0xa316('0x20')]=qs[_0xa316('0x20')](_0x1b2eb6[_0xa316('0x36')]['offset']);}_0x1e1d98['order']=qs['sort'](_0x1b2eb6[_0xa316('0x36')]['sort']);_0x1e1d98[_0xa316('0x3e')]=qs[_0xa316('0x37')](_[_0xa316('0x3f')](_0x1b2eb6[_0xa316('0x36')],_0x16decd['filters']),_0x134411);if(_0x1b2eb6['query'][_0xa316('0x40')]){_0x1e1d98[_0xa316('0x3e')]=_[_0xa316('0x41')](_0x1e1d98[_0xa316('0x3e')],{'$or':_[_0xa316('0x2f')](_0x134411,function(_0x5cf61b){if(_0x5cf61b[_0xa316('0x33')]!==_0xa316('0x42')){var _0x40d655={};_0x40d655[_0x5cf61b[_0xa316('0x2d')]]={'$like':'%'+_0x1b2eb6[_0xa316('0x36')][_0xa316('0x40')]+'%'};return _0x40d655;}})});}_0x1e1d98=_[_0xa316('0x41')]({},_0x1e1d98,_0x1b2eb6['options']);var _0x44edb4={'where':_0x1e1d98['where']};return db[_0xa316('0x30')]['count'](_0x44edb4)[_0xa316('0x29')](function(_0x64172){_0x26505f[_0xa316('0x23')]=_0x64172;if(_0x1b2eb6['query'][_0xa316('0x43')]){_0x1e1d98[_0xa316('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xa316('0x45')](_0x1e1d98);})[_0xa316('0x29')](function(_0x1d46b4){_0x26505f[_0xa316('0x46')]=_0x1d46b4;return _0x26505f;})[_0xa316('0x29')](respondWithFilteredResult(_0x35e80d,_0x1e1d98))['catch'](handleError(_0x35e80d,null));};exports['show']=function(_0x5c0650,_0xa3e434){var _0x1a3898={'raw':!![],'where':{'id':_0x5c0650[_0xa316('0x47')]['id']}},_0x3ae92e={};_0x3ae92e[_0xa316('0x35')]=_[_0xa316('0x48')](db[_0xa316('0x30')][_0xa316('0x31')]);_0x3ae92e[_0xa316('0x36')]=_[_0xa316('0x48')](_0x5c0650['query']);_0x3ae92e[_0xa316('0x37')]=_[_0xa316('0x38')](_0x3ae92e[_0xa316('0x35')],_0x3ae92e[_0xa316('0x36')]);_0x1a3898['attributes']=_[_0xa316('0x38')](_0x3ae92e['model'],qs['fields'](_0x5c0650[_0xa316('0x36')][_0xa316('0x3a')]));_0x1a3898[_0xa316('0x39')]=_0x1a3898['attributes'][_0xa316('0x3b')]?_0x1a3898[_0xa316('0x39')]:_0x3ae92e[_0xa316('0x35')];if(_0x5c0650[_0xa316('0x36')][_0xa316('0x43')]){_0x1a3898[_0xa316('0x44')]=[{'all':!![]}];}_0x1a3898=_['merge']({},_0x1a3898,_0x5c0650[_0xa316('0x49')]);return db[_0xa316('0x30')][_0xa316('0x4a')](_0x1a3898)[_0xa316('0x29')](handleEntityNotFound(_0xa3e434,null))['then'](respondWithResult(_0xa3e434,null))['catch'](handleError(_0xa3e434,null));};exports[_0xa316('0x4b')]=function(_0x1514d0,_0x48e785){return db['ChatInternalMessage'][_0xa316('0x4b')](_0x1514d0[_0xa316('0x4c')],{})[_0xa316('0x29')](respondWithResult(_0x48e785,0xc9))['catch'](handleError(_0x48e785,null));};exports[_0xa316('0x4d')]=function(_0x267c0d,_0x728d64){if(_0x267c0d['body']['id']){delete _0x267c0d[_0xa316('0x4c')]['id'];}return db[_0xa316('0x30')]['find']({'where':{'id':_0x267c0d[_0xa316('0x47')]['id']}})[_0xa316('0x29')](handleEntityNotFound(_0x728d64,null))[_0xa316('0x29')](saveUpdates(_0x267c0d[_0xa316('0x4c')],null))[_0xa316('0x29')](respondWithResult(_0x728d64,null))[_0xa316('0x4e')](handleError(_0x728d64,null));};exports[_0xa316('0x2a')]=function(_0x5bbd5d,_0x5c290f){return db[_0xa316('0x30')][_0xa316('0x4a')]({'where':{'id':_0x5bbd5d[_0xa316('0x47')]['id']}})[_0xa316('0x29')](handleEntityNotFound(_0x5c290f,null))[_0xa316('0x29')](removeEntity(_0x5c290f,null))[_0xa316('0x4e')](handleError(_0x5c290f,null));};exports[_0xa316('0x4f')]=function(_0x2b3778,_0x130a69){return db['ChatInternalMessage'][_0xa316('0x4f')]()[_0xa316('0x29')](respondWithResult(_0x130a69,null))['catch'](handleError(_0x130a69,null));};function wrapUser(_0x40d4ce){return function(_0x5a827a){var _0x354157=_0x40d4ce[_0xa316('0x50')]({'plain':!![]});_0x354157[_0xa316('0x51')]=[];if(_0x5a827a){_0x354157[_0xa316('0x52')]=_0x5a827a[_0xa316('0x53')];_0x354157[_0xa316('0x54')]=_0x5a827a;}else{_0x354157[_0xa316('0x52')]=moment(0x0)[_0xa316('0x55')](_0xa316('0x56'));_0x354157[_0xa316('0x54')]={};}return _0x354157;};}exports[_0xa316('0x57')]=function(_0x1cbc05,_0x1f9e26,_0x2fc990){var _0x53bcbc=[];return db[_0xa316('0x58')]['findAll']({'where':{'role':['agent',_0xa316('0x59'),_0xa316('0x5a')]},'attributes':['id','fullname','name',_0xa316('0x5b'),_0xa316('0x5c'),'internal',_0xa316('0x5d'),'lastLoginAt',_0xa316('0x5e'),'showWebBar'],'order':qs['sort']('-online'),'include':[{'model':db[_0xa316('0x5f')],'as':'VoiceQueues','attributes':['id',_0xa316('0x2d'),'type'],'through':{'attributes':[]}}]})['then'](function(_0x2ebe1e){if(_0x2ebe1e){var _0x3b97fe=_0x1cbc05[_0xa316('0x5a')][_0xa316('0x50')]({'plain':!![]});if(!_0x3b97fe)throw new Error(_0xa316('0x60'));if(_0x3b97fe['role']===_0xa316('0x5a')){return db['UserProfileSection'][_0xa316('0x4a')]({'where':{'name':_0xa316('0x61'),'userProfileId':_0x3b97fe['userProfileId']},'raw':!![]})[_0xa316('0x29')](function(_0x16016b){if(_0x16016b){if(_0x16016b[_0xa316('0x62')]===0x0){return db[_0xa316('0x63')][_0xa316('0x45')]({'where':{'sectionId':_0x16016b['id']},'raw':!![]})[_0xa316('0x29')](function(_0x204806){var _0x1668a2=[];if(_[_0xa316('0x64')](_0x204806)){_0x1668a2=_[_0xa316('0x40')](_0x2ebe1e,function(_0x50e0df){if(_0x50e0df['role']!==_0xa316('0x65')){return _0x50e0df;}});return _0x1668a2;}else{for(var _0x35ea69=0x0;_0x35ea69<_0x2ebe1e[_0xa316('0x3b')];_0x35ea69++){var _0x259bbd=_0x2ebe1e[_0x35ea69];if(_0x259bbd['role']===_0xa316('0x65')){var _0x13ef0b=_[_0xa316('0x4a')](_0x204806,function(_0x165ead){return _0x165ead[_0xa316('0x66')]===_0x259bbd['id'];});if(_0x13ef0b)_0x1668a2[_0xa316('0x67')](_0x259bbd);}else{_0x1668a2[_0xa316('0x67')](_0x259bbd);}}return _0x1668a2;}});}else{return _0x2ebe1e;}}else{var _0x497f20=_[_0xa316('0x40')](_0x2ebe1e,function(_0x2e6478){if(_0x2e6478[_0xa316('0x5b')]!==_0xa316('0x65')){return _0x2e6478;}});return _0x497f20;}});}else{return _0x2ebe1e;}}})[_0xa316('0x29')](function(_0x359dd8){var _0x1ed751=[];if(_0x359dd8){_0x53bcbc=_0x359dd8;for(var _0x43d96b=0x0;_0x43d96b<_0x359dd8[_0xa316('0x3b')];_0x43d96b+=0x1){_0x53bcbc[_0x43d96b]['messages']=[];_0x1ed751[_0xa316('0x67')](db[_0xa316('0x30')][_0xa316('0x4a')]({'where':{'FromId':[_0x1cbc05[_0xa316('0x5a')]['id'],_0x359dd8[_0x43d96b]['id']],'ToId':[_0x1cbc05[_0xa316('0x5a')]['id'],_0x359dd8[_0x43d96b]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xa316('0x68'),_0xa316('0x69'),_0xa316('0x6a'),_0xa316('0x4c')],'order':qs[_0xa316('0x6b')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa316('0x29')](wrapUser(_0x359dd8[_0x43d96b])));}return BPromise[_0xa316('0x6c')](_0x1ed751);}return[];})[_0xa316('0x29')](function(_0x3bec56){return{'rows':_0x3bec56,'count':_0x3bec56[_0xa316('0x3b')]};})[_0xa316('0x29')](respondWithResult(_0x1f9e26,null))[_0xa316('0x4e')](handleError(_0x1f9e26,null));}; \ No newline at end of file +var _0x8ad0=['rows','catch','rawAttributes','length','options','find','create','body','params','describe','lastMessageAt','createdAt','lastMessage','format','getUsers','User','agent','admin','fullname','userpic','online','showWebBar','-online','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','messages','FromId','ToId','read','-createdAt','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','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','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','ChatInternalMessage','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','where','merge','filter','includeAll','include','findAll'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8ad0,0x91));var _0x08ad=function(_0x593640,_0x5217e1){_0x593640=_0x593640-0x0;var _0x5a856b=_0x8ad0[_0x593640];return _0x5a856b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x08ad('0x0'));var jsonpatch=require(_0x08ad('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x08ad('0x2'));var Mustache=require(_0x08ad('0x3'));var util=require(_0x08ad('0x4'));var path=require(_0x08ad('0x5'));var sox=require(_0x08ad('0x6'));var csv=require('to-csv');var ejs=require(_0x08ad('0x7'));var fs=require('fs');var fs_extra=require(_0x08ad('0x8'));var _=require(_0x08ad('0x9'));var squel=require('squel');var crypto=require(_0x08ad('0xa'));var jsforce=require(_0x08ad('0xb'));var deskjs=require(_0x08ad('0xc'));var toCsv=require('to-csv');var querystring=require(_0x08ad('0xd'));var Papa=require(_0x08ad('0xe'));var Redis=require(_0x08ad('0xf'));var authService=require(_0x08ad('0x10'));var qs=require(_0x08ad('0x11'));var as=require(_0x08ad('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x08ad('0x13'));var utils=require(_0x08ad('0x14'));var config=require(_0x08ad('0x15'));var licenseUtil=require(_0x08ad('0x16'));var db=require(_0x08ad('0x17'))['db'];config['redis']=_[_0x08ad('0x18')](config[_0x08ad('0x19')],{'host':_0x08ad('0x1a'),'port':0x18eb});var socket=require(_0x08ad('0x1b'))(new Redis(config[_0x08ad('0x19')]));require(_0x08ad('0x1c'))[_0x08ad('0x1d')](socket);function respondWithStatusCode(_0x3b20b8,_0xf6f5b2){_0xf6f5b2=_0xf6f5b2||0xcc;return function(_0x40ab8c){if(_0x40ab8c){return _0x3b20b8[_0x08ad('0x1e')](_0xf6f5b2);}return _0x3b20b8[_0x08ad('0x1f')](_0xf6f5b2)[_0x08ad('0x20')]();};}function respondWithResult(_0x412f6b,_0xcbc425){_0xcbc425=_0xcbc425||0xc8;return function(_0x521251){if(_0x521251){return _0x412f6b[_0x08ad('0x1f')](_0xcbc425)[_0x08ad('0x21')](_0x521251);}};}function respondWithFilteredResult(_0x355082,_0x205a30){return function(_0x52025b){if(_0x52025b){var _0x40dd4b=typeof _0x205a30[_0x08ad('0x22')]===_0x08ad('0x23')&&typeof _0x205a30['limit']==='undefined';var _0x4f5692=_0x52025b[_0x08ad('0x24')];var _0x1778c4=_0x40dd4b?0x0:_0x205a30[_0x08ad('0x22')];var _0x256cdc=_0x40dd4b?_0x52025b[_0x08ad('0x24')]:_0x205a30['offset']+_0x205a30[_0x08ad('0x25')];var _0x386f89;if(_0x256cdc>=_0x4f5692){_0x256cdc=_0x4f5692;_0x386f89=0xc8;}else{_0x386f89=0xce;}_0x355082[_0x08ad('0x1f')](_0x386f89);return _0x355082[_0x08ad('0x26')](_0x08ad('0x27'),_0x1778c4+'-'+_0x256cdc+'/'+_0x4f5692)[_0x08ad('0x21')](_0x52025b);}return null;};}function patchUpdates(_0xf734){return function(_0x506ff9){try{jsonpatch[_0x08ad('0x28')](_0x506ff9,_0xf734,!![]);}catch(_0x5e0ff1){return BPromise['reject'](_0x5e0ff1);}return _0x506ff9['save']();};}function saveUpdates(_0x3579dd,_0x5dcf26){return function(_0x153feb){if(_0x153feb){return _0x153feb[_0x08ad('0x29')](_0x3579dd)[_0x08ad('0x2a')](function(_0xc6e5eb){return _0xc6e5eb;});}return null;};}function removeEntity(_0x1f26b7,_0x5f049d){return function(_0x44719b){if(_0x44719b){return _0x44719b[_0x08ad('0x2b')]()['then'](function(){_0x1f26b7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cad8e,_0x422d69){return function(_0x43631f){if(!_0x43631f){_0x5cad8e[_0x08ad('0x1e')](0x194);}return _0x43631f;};}function handleError(_0x42eef5,_0x454678){_0x454678=_0x454678||0x1f4;return function(_0x4a4cd0){logger[_0x08ad('0x2c')](_0x4a4cd0['stack']);if(_0x4a4cd0[_0x08ad('0x2d')]){delete _0x4a4cd0[_0x08ad('0x2d')];}_0x42eef5['status'](_0x454678)[_0x08ad('0x2e')](_0x4a4cd0);};}exports[_0x08ad('0x2f')]=function(_0x20c9d9,_0x4dd0c8){var _0x3591e7={},_0x5f424a={},_0x20fc78={'count':0x0,'rows':[]};var _0x3dc2e7=_[_0x08ad('0x30')](db[_0x08ad('0x31')]['rawAttributes'],function(_0x1aa6e9){return{'name':_0x1aa6e9['fieldName'],'type':_0x1aa6e9[_0x08ad('0x32')][_0x08ad('0x33')]};});_0x5f424a[_0x08ad('0x34')]=_[_0x08ad('0x30')](_0x3dc2e7,_0x08ad('0x2d'));_0x5f424a['query']=_[_0x08ad('0x35')](_0x20c9d9[_0x08ad('0x36')]);_0x5f424a[_0x08ad('0x37')]=_[_0x08ad('0x38')](_0x5f424a[_0x08ad('0x34')],_0x5f424a['query']);_0x3591e7[_0x08ad('0x39')]=_[_0x08ad('0x38')](_0x5f424a[_0x08ad('0x34')],qs[_0x08ad('0x3a')](_0x20c9d9['query']['fields']));_0x3591e7[_0x08ad('0x39')]=_0x3591e7['attributes']['length']?_0x3591e7[_0x08ad('0x39')]:_0x5f424a['model'];if(!_0x20c9d9[_0x08ad('0x36')]['hasOwnProperty'](_0x08ad('0x3b'))){_0x3591e7[_0x08ad('0x25')]=qs[_0x08ad('0x25')](_0x20c9d9['query'][_0x08ad('0x25')]);_0x3591e7[_0x08ad('0x22')]=qs[_0x08ad('0x22')](_0x20c9d9[_0x08ad('0x36')][_0x08ad('0x22')]);}_0x3591e7[_0x08ad('0x3c')]=qs[_0x08ad('0x3d')](_0x20c9d9[_0x08ad('0x36')][_0x08ad('0x3d')]);_0x3591e7['where']=qs[_0x08ad('0x37')](_[_0x08ad('0x3e')](_0x20c9d9[_0x08ad('0x36')],_0x5f424a['filters']),_0x3dc2e7);if(_0x20c9d9[_0x08ad('0x36')]['filter']){_0x3591e7[_0x08ad('0x3f')]=_[_0x08ad('0x40')](_0x3591e7[_0x08ad('0x3f')],{'$or':_[_0x08ad('0x30')](_0x3dc2e7,function(_0x423622){if(_0x423622[_0x08ad('0x32')]!=='VIRTUAL'){var _0x4566ea={};_0x4566ea[_0x423622[_0x08ad('0x2d')]]={'$like':'%'+_0x20c9d9[_0x08ad('0x36')][_0x08ad('0x41')]+'%'};return _0x4566ea;}})});}_0x3591e7=_[_0x08ad('0x40')]({},_0x3591e7,_0x20c9d9['options']);var _0x5293eb={'where':_0x3591e7[_0x08ad('0x3f')]};return db[_0x08ad('0x31')][_0x08ad('0x24')](_0x5293eb)[_0x08ad('0x2a')](function(_0x3128de){_0x20fc78[_0x08ad('0x24')]=_0x3128de;if(_0x20c9d9[_0x08ad('0x36')][_0x08ad('0x42')]){_0x3591e7[_0x08ad('0x43')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x08ad('0x44')](_0x3591e7);})[_0x08ad('0x2a')](function(_0x599009){_0x20fc78[_0x08ad('0x45')]=_0x599009;return _0x20fc78;})[_0x08ad('0x2a')](respondWithFilteredResult(_0x4dd0c8,_0x3591e7))[_0x08ad('0x46')](handleError(_0x4dd0c8,null));};exports['show']=function(_0x5182fc,_0x210bbe){var _0x5032de={'raw':!![],'where':{'id':_0x5182fc['params']['id']}},_0x4b2e96={};_0x4b2e96[_0x08ad('0x34')]=_[_0x08ad('0x35')](db[_0x08ad('0x31')][_0x08ad('0x47')]);_0x4b2e96[_0x08ad('0x36')]=_[_0x08ad('0x35')](_0x5182fc[_0x08ad('0x36')]);_0x4b2e96['filters']=_[_0x08ad('0x38')](_0x4b2e96[_0x08ad('0x34')],_0x4b2e96['query']);_0x5032de['attributes']=_['intersection'](_0x4b2e96[_0x08ad('0x34')],qs[_0x08ad('0x3a')](_0x5182fc[_0x08ad('0x36')]['fields']));_0x5032de['attributes']=_0x5032de[_0x08ad('0x39')][_0x08ad('0x48')]?_0x5032de[_0x08ad('0x39')]:_0x4b2e96[_0x08ad('0x34')];if(_0x5182fc[_0x08ad('0x36')]['includeAll']){_0x5032de[_0x08ad('0x43')]=[{'all':!![]}];}_0x5032de=_[_0x08ad('0x40')]({},_0x5032de,_0x5182fc[_0x08ad('0x49')]);return db['ChatInternalMessage'][_0x08ad('0x4a')](_0x5032de)[_0x08ad('0x2a')](handleEntityNotFound(_0x210bbe,null))[_0x08ad('0x2a')](respondWithResult(_0x210bbe,null))[_0x08ad('0x46')](handleError(_0x210bbe,null));};exports[_0x08ad('0x4b')]=function(_0x470ba3,_0x32c2ee){return db[_0x08ad('0x31')][_0x08ad('0x4b')](_0x470ba3['body'],{})[_0x08ad('0x2a')](respondWithResult(_0x32c2ee,0xc9))[_0x08ad('0x46')](handleError(_0x32c2ee,null));};exports[_0x08ad('0x29')]=function(_0x3e93f9,_0x245599){if(_0x3e93f9[_0x08ad('0x4c')]['id']){delete _0x3e93f9[_0x08ad('0x4c')]['id'];}return db[_0x08ad('0x31')]['find']({'where':{'id':_0x3e93f9[_0x08ad('0x4d')]['id']}})[_0x08ad('0x2a')](handleEntityNotFound(_0x245599,null))[_0x08ad('0x2a')](saveUpdates(_0x3e93f9[_0x08ad('0x4c')],null))[_0x08ad('0x2a')](respondWithResult(_0x245599,null))[_0x08ad('0x46')](handleError(_0x245599,null));};exports[_0x08ad('0x2b')]=function(_0x591ecf,_0x567897){return db[_0x08ad('0x31')]['find']({'where':{'id':_0x591ecf[_0x08ad('0x4d')]['id']}})['then'](handleEntityNotFound(_0x567897,null))[_0x08ad('0x2a')](removeEntity(_0x567897,null))[_0x08ad('0x46')](handleError(_0x567897,null));};exports[_0x08ad('0x4e')]=function(_0x214548,_0x4cbbf0){return db[_0x08ad('0x31')][_0x08ad('0x4e')]()['then'](respondWithResult(_0x4cbbf0,null))[_0x08ad('0x46')](handleError(_0x4cbbf0,null));};function wrapUser(_0x1faf05){return function(_0x39f055){var _0x53a395=_0x1faf05['get']({'plain':!![]});_0x53a395['messages']=[];if(_0x39f055){_0x53a395[_0x08ad('0x4f')]=_0x39f055[_0x08ad('0x50')];_0x53a395[_0x08ad('0x51')]=_0x39f055;}else{_0x53a395[_0x08ad('0x4f')]=moment(0x0)[_0x08ad('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x53a395[_0x08ad('0x51')]={};}return _0x53a395;};}exports[_0x08ad('0x53')]=function(_0x38286b,_0x2fe7c6,_0x486e4f){var _0x1a1d06=[];return db[_0x08ad('0x54')][_0x08ad('0x44')]({'where':{'role':[_0x08ad('0x55'),_0x08ad('0x56'),'user']},'attributes':['id',_0x08ad('0x57'),'name','role',_0x08ad('0x58'),'internal',_0x08ad('0x59'),'lastLoginAt','allowmessenger',_0x08ad('0x5a')],'order':qs['sort'](_0x08ad('0x5b')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x08ad('0x2d'),'type'],'through':{'attributes':[]}}]})[_0x08ad('0x2a')](function(_0x3f32a8){if(_0x3f32a8){var _0xabc582=_0x38286b[_0x08ad('0x5c')]['get']({'plain':!![]});if(!_0xabc582)throw new Error(_0x08ad('0x5d'));if(_0xabc582[_0x08ad('0x5e')]===_0x08ad('0x5c')){return db[_0x08ad('0x5f')][_0x08ad('0x4a')]({'where':{'name':_0x08ad('0x60'),'userProfileId':_0xabc582[_0x08ad('0x61')]},'raw':!![]})[_0x08ad('0x2a')](function(_0x153090){if(_0x153090){if(_0x153090[_0x08ad('0x62')]===0x0){return db[_0x08ad('0x63')][_0x08ad('0x44')]({'where':{'sectionId':_0x153090['id']},'raw':!![]})[_0x08ad('0x2a')](function(_0x22ba26){var _0x5055fd=[];if(_['isEmpty'](_0x22ba26)){_0x5055fd=_[_0x08ad('0x41')](_0x3f32a8,function(_0x1deab6){if(_0x1deab6[_0x08ad('0x5e')]!==_0x08ad('0x55')){return _0x1deab6;}});return _0x5055fd;}else{for(var _0x2e4e19=0x0;_0x2e4e19<_0x3f32a8['length'];_0x2e4e19++){var _0x34c27f=_0x3f32a8[_0x2e4e19];if(_0x34c27f['role']===_0x08ad('0x55')){var _0x2b5a0e=_[_0x08ad('0x4a')](_0x22ba26,function(_0x4d2edc){return _0x4d2edc[_0x08ad('0x64')]===_0x34c27f['id'];});if(_0x2b5a0e)_0x5055fd[_0x08ad('0x65')](_0x34c27f);}else{_0x5055fd['push'](_0x34c27f);}}return _0x5055fd;}});}else{return _0x3f32a8;}}else{var _0x463ec5=_[_0x08ad('0x41')](_0x3f32a8,function(_0x22a0b2){if(_0x22a0b2[_0x08ad('0x5e')]!=='agent'){return _0x22a0b2;}});return _0x463ec5;}});}else{return _0x3f32a8;}}})[_0x08ad('0x2a')](function(_0x5e23a5){var _0x194865=[];if(_0x5e23a5){_0x1a1d06=_0x5e23a5;for(var _0x4bb4a1=0x0;_0x4bb4a1<_0x5e23a5[_0x08ad('0x48')];_0x4bb4a1+=0x1){_0x1a1d06[_0x4bb4a1][_0x08ad('0x66')]=[];_0x194865[_0x08ad('0x65')](db[_0x08ad('0x31')][_0x08ad('0x4a')]({'where':{'FromId':[_0x38286b['user']['id'],_0x5e23a5[_0x4bb4a1]['id']],'ToId':[_0x38286b[_0x08ad('0x5c')]['id'],_0x5e23a5[_0x4bb4a1]['id']],'ChatGroupId':null},'attributes':['id',_0x08ad('0x50'),_0x08ad('0x67'),_0x08ad('0x68'),_0x08ad('0x69'),_0x08ad('0x4c')],'order':qs[_0x08ad('0x3d')](_0x08ad('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x5e23a5[_0x4bb4a1])));}return BPromise['all'](_0x194865);}return[];})['then'](function(_0x56bd16){return{'rows':_0x56bd16,'count':_0x56bd16['length']};})[_0x08ad('0x2a')](respondWithResult(_0x2fe7c6,null))[_0x08ad('0x46')](handleError(_0x2fe7c6,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 6b92dde..7d25fbb 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 _0x04ca=['ChatInternalMessage','setMaxListeners','emit','hasOwnProperty','hook','exports','events'];(function(_0x1901fa,_0x23a42a){var _0xcf972f=function(_0x3a4120){while(--_0x3a4120){_0x1901fa['push'](_0x1901fa['shift']());}};_0xcf972f(++_0x23a42a);}(_0x04ca,0x1c6));var _0xa04c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x04ca[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xa04c('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xa04c('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xa04c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x84abbc){return function(_0x3a9b6c,_0x322e38,_0x32e254){ChatInternalMessageEvents['emit'](_0x84abbc+':'+_0x3a9b6c['id'],_0x3a9b6c);ChatInternalMessageEvents[_0xa04c('0x3')](_0x84abbc,_0x3a9b6c);_0x32e254(null);};}for(var e in events){if(events[_0xa04c('0x4')](e)){var event=events[e];ChatInternalMessage[_0xa04c('0x5')](e,emitEvent(event));}}module[_0xa04c('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xe5bb=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0xe5bb,0x166));var _0xbe5b=function(_0x346947,_0x101288){_0x346947=_0x346947-0x0;var _0x4965f8=_0xe5bb[_0x346947];return _0x4965f8;};'use strict';var EventEmitter=require(_0xbe5b('0x0'));var ChatInternalMessage=require(_0xbe5b('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xbe5b('0x2')](0x0);var events={'afterCreate':_0xbe5b('0x3'),'afterUpdate':_0xbe5b('0x4'),'afterDestroy':_0xbe5b('0x5')};function emitEvent(_0x49e047){return function(_0x1e1354,_0x149734,_0x337d2a){ChatInternalMessageEvents[_0xbe5b('0x6')](_0x49e047+':'+_0x1e1354['id'],_0x1e1354);ChatInternalMessageEvents['emit'](_0x49e047,_0x1e1354);_0x337d2a(null);};}for(var e in events){if(events[_0xbe5b('0x7')](e)){var event=events[e];ChatInternalMessage[_0xbe5b('0x8')](e,emitEvent(event));}}module[_0xbe5b('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 a9cf5fb..01de2b9 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 _0xb51b=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3395a1,_0x58ddc6){var _0x256656=function(_0x40d4d3){while(--_0x40d4d3){_0x3395a1['push'](_0x3395a1['shift']());}};_0x256656(++_0x58ddc6);}(_0xb51b,0x168));var _0xbb51=function(_0x4f8eb8,_0x3b8216){_0x4f8eb8=_0x4f8eb8-0x0;var _0x22d135=_0xb51b[_0x4f8eb8];return _0x22d135;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbb51('0x0'))(_0xbb51('0x1'));var moment=require(_0xbb51('0x2'));var BPromise=require(_0xbb51('0x3'));var rp=require(_0xbb51('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbb51('0x5'));var attributes=require(_0xbb51('0x6'));module[_0xbb51('0x7')]=function(_0x2f855b,_0x4768c6){return _0x2f855b[_0xbb51('0x8')](_0xbb51('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbb51('0xa'),'collate':_0xbb51('0xb')});}; \ No newline at end of file +var _0x930e=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x2f79d9,_0x2d4a5a){var _0x3fe05b=function(_0x36a0cf){while(--_0x36a0cf){_0x2f79d9['push'](_0x2f79d9['shift']());}};_0x3fe05b(++_0x2d4a5a);}(_0x930e,0x1c6));var _0xe930=function(_0x2c9ba4,_0x3d3852){_0x2c9ba4=_0x2c9ba4-0x0;var _0x445c87=_0x930e[_0x2c9ba4];return _0x445c87;};'use strict';var _=require(_0xe930('0x0'));var util=require(_0xe930('0x1'));var logger=require(_0xe930('0x2'))(_0xe930('0x3'));var moment=require('moment');var BPromise=require(_0xe930('0x4'));var rp=require(_0xe930('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe930('0x6'));var config=require(_0xe930('0x7'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x268e1,_0x5c3920){return _0x268e1[_0xe930('0x8')](_0xe930('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe930('0xa'),'collate':_0xe930('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index c10d6a2..72bdc15 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 _0x032b=['register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x368593,_0x935b0c){var _0x261b29=function(_0x6f7d55){while(--_0x6f7d55){_0x368593['push'](_0x368593['shift']());}};_0x261b29(++_0x935b0c);}(_0x032b,0x183));var _0xb032=function(_0x22193e,_0x2ae001){_0x22193e=_0x22193e-0x0;var _0x10c378=_0x032b[_0x22193e];return _0x10c378;};'use strict';var _=require('lodash');var util=require(_0xb032('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb032('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb032('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb032('0x3'))(_0xb032('0x4'));var config=require(_0xb032('0x5'));var jayson=require(_0xb032('0x6'));var client=jayson[_0xb032('0x7')][_0xb032('0x8')]({'port':0x232a});config['redis']=_[_0xb032('0x9')](config[_0xb032('0xa')],{'host':_0xb032('0xb'),'port':0x18eb});var socket=require(_0xb032('0xc'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xb032('0xd')](socket);function respondWithRpcPromise(_0xf89ca9,_0x463f7a,_0x1d7bb3){return new BPromise(function(_0x2d5abe,_0x3d651b){return client[_0xb032('0xe')](_0xf89ca9,_0x1d7bb3)['then'](function(_0x4988fa){logger[_0xb032('0xf')](_0xb032('0x10'),_0x463f7a,_0xb032('0x11'));logger[_0xb032('0x12')](_0xb032('0x13'),_0x463f7a,'request\x20sent',JSON['stringify'](_0x4988fa));if(_0x4988fa[_0xb032('0x14')]){if(_0x4988fa[_0xb032('0x14')][_0xb032('0x15')]===0x1f4){logger['error'](_0xb032('0x10'),_0x463f7a,_0x4988fa[_0xb032('0x14')][_0xb032('0x16')]);return _0x3d651b(_0x4988fa[_0xb032('0x14')][_0xb032('0x16')]);}logger[_0xb032('0x14')](_0xb032('0x10'),_0x463f7a,_0x4988fa[_0xb032('0x14')][_0xb032('0x16')]);return _0x2d5abe(_0x4988fa[_0xb032('0x14')][_0xb032('0x16')]);}else{logger[_0xb032('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x463f7a,_0xb032('0x11'));_0x2d5abe(_0x4988fa[_0xb032('0x17')]['message']);}})[_0xb032('0x18')](function(_0x25fb0b){logger['error'](_0xb032('0x10'),_0x463f7a,_0x25fb0b);_0x3d651b(_0x25fb0b);});});} \ No newline at end of file +var _0x7a59=['http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','stringify','error','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0xd0f4e2,_0x4963d5){var _0x4fde1e=function(_0x2ce32d){while(--_0x2ce32d){_0xd0f4e2['push'](_0xd0f4e2['shift']());}};_0x4fde1e(++_0x4963d5);}(_0x7a59,0x16e));var _0x97a5=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x7a59[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x97a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x97a5('0x1'));var rs=require(_0x97a5('0x2'));var fs=require('fs');var Redis=require(_0x97a5('0x3'));var db=require(_0x97a5('0x4'))['db'];var utils=require(_0x97a5('0x5'));var logger=require('../../config/logger')(_0x97a5('0x6'));var config=require(_0x97a5('0x7'));var jayson=require(_0x97a5('0x8'));var client=jayson['client'][_0x97a5('0x9')]({'port':0x232a});config[_0x97a5('0xa')]=_[_0x97a5('0xb')](config[_0x97a5('0xa')],{'host':_0x97a5('0xc'),'port':0x18eb});var socket=require(_0x97a5('0xd'))(new Redis(config[_0x97a5('0xa')]));require('./chatInternalMessage.socket')[_0x97a5('0xe')](socket);function respondWithRpcPromise(_0x101c3f,_0xd70b51,_0x388bd7){return new BPromise(function(_0x1fc6b5,_0x4d93a5){return client['request'](_0x101c3f,_0x388bd7)[_0x97a5('0xf')](function(_0x41022d){logger[_0x97a5('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0xd70b51,_0x97a5('0x11'));logger[_0x97a5('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xd70b51,'request\x20sent',JSON[_0x97a5('0x13')](_0x41022d));if(_0x41022d[_0x97a5('0x14')]){if(_0x41022d['error']['code']===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0xd70b51,_0x41022d[_0x97a5('0x14')][_0x97a5('0x15')]);return _0x4d93a5(_0x41022d[_0x97a5('0x14')]['message']);}logger[_0x97a5('0x14')](_0x97a5('0x16'),_0xd70b51,_0x41022d['error'][_0x97a5('0x15')]);return _0x1fc6b5(_0x41022d['error'][_0x97a5('0x15')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0xd70b51,'request\x20sent');_0x1fc6b5(_0x41022d[_0x97a5('0x17')]['message']);}})[_0x97a5('0x18')](function(_0x9863ea){logger[_0x97a5('0x14')](_0x97a5('0x16'),_0xd70b51,_0x9863ea);_0x4d93a5(_0x9863ea);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 0be0859..04fcd87 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 _0x43cf=['emit','removeListener','register','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x1f9ff4,_0x55068d){var _0x43759f=function(_0xceb61b){while(--_0xceb61b){_0x1f9ff4['push'](_0x1f9ff4['shift']());}};_0x43759f(++_0x55068d);}(_0x43cf,0x74));var _0xf43c=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0x43cf[_0x251d9c];return _0x16ae64;};'use strict';var ChatInternalMessageEvents=require(_0xf43c('0x0'));var events=[_0xf43c('0x1'),_0xf43c('0x2'),'update'];function createListener(_0x245953,_0x14dd96){return function(_0xab6326){_0x14dd96[_0xf43c('0x3')](_0x245953,_0xab6326);};}function removeListener(_0x586cc1,_0x46003b){return function(){ChatInternalMessageEvents[_0xf43c('0x4')](_0x586cc1,_0x46003b);};}exports[_0xf43c('0x5')]=function(_0x1ffad9){for(var _0x37c20e=0x0,_0x52842d=events['length'];_0x37c20e<_0x52842d;_0x37c20e++){var _0x429b38=events[_0x37c20e];var _0x2651b7=createListener(_0xf43c('0x6')+_0x429b38,_0x1ffad9);ChatInternalMessageEvents['on'](_0x429b38,_0x2651b7);}}; \ No newline at end of file +var _0xb12c=['removeListener','register','length','save','remove','update','emit'];(function(_0x483312,_0x54fd0e){var _0x5c5e1c=function(_0x33e216){while(--_0x33e216){_0x483312['push'](_0x483312['shift']());}};_0x5c5e1c(++_0x54fd0e);}(_0xb12c,0x1a0));var _0xcb12=function(_0x315020,_0x52c3c1){_0x315020=_0x315020-0x0;var _0xd2f525=_0xb12c[_0x315020];return _0xd2f525;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xcb12('0x0'),_0xcb12('0x1'),_0xcb12('0x2')];function createListener(_0xc998ee,_0x27cdc1){return function(_0x479713){_0x27cdc1[_0xcb12('0x3')](_0xc998ee,_0x479713);};}function removeListener(_0x48a72e,_0x13f168){return function(){ChatInternalMessageEvents[_0xcb12('0x4')](_0x48a72e,_0x13f168);};}exports[_0xcb12('0x5')]=function(_0x3b647e){for(var _0xa5ce63=0x0,_0x541cbf=events[_0xcb12('0x6')];_0xa5ce63<_0x541cbf;_0xa5ce63++){var _0x4bcc32=events[_0xa5ce63];var _0x51f33b=createListener('chatInternalMessage:'+_0x4bcc32,_0x3b647e);ChatInternalMessageEvents['on'](_0x4bcc32,_0x51f33b);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index f289e51..5ec2a61 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 _0xfa41=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','getUsers','/:id','show','post','create','update','delete','destroy','multer'];(function(_0x149f32,_0x4273f7){var _0x11f475=function(_0x18eeef){while(--_0x18eeef){_0x149f32['push'](_0x149f32['shift']());}};_0x11f475(++_0x4273f7);}(_0xfa41,0xb3));var _0x1fa4=function(_0x4bd710,_0x237f88){_0x4bd710=_0x4bd710-0x0;var _0x30f143=_0xfa41[_0x4bd710];return _0x30f143;};'use strict';var multer=require(_0x1fa4('0x0'));var util=require(_0x1fa4('0x1'));var path=require('path');var timeout=require(_0x1fa4('0x2'));var express=require('express');var router=express[_0x1fa4('0x3')]();var fs_extra=require(_0x1fa4('0x4'));var auth=require(_0x1fa4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1fa4('0x6'));var controller=require(_0x1fa4('0x7'));router[_0x1fa4('0x8')]('/',auth[_0x1fa4('0x9')](),controller[_0x1fa4('0xa')]);router['get'](_0x1fa4('0xb'),auth[_0x1fa4('0x9')](),controller['describe']);router[_0x1fa4('0x8')]('/users',auth[_0x1fa4('0x9')](),controller[_0x1fa4('0xc')]);router['get'](_0x1fa4('0xd'),auth['isAuthenticated'](),controller[_0x1fa4('0xe')]);router[_0x1fa4('0xf')]('/',auth['isAuthenticated'](),controller[_0x1fa4('0x10')]);router['put']('/:id',controller[_0x1fa4('0x11')]);router[_0x1fa4('0x12')](_0x1fa4('0xd'),auth[_0x1fa4('0x9')](),controller[_0x1fa4('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6e1c=['/:id','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/users','getUsers','create','put'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x6e1c,0x145));var _0xc6e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e1c[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc6e1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc6e1('0x1'));var express=require('express');var router=express[_0xc6e1('0x2')]();var fs_extra=require(_0xc6e1('0x3'));var auth=require(_0xc6e1('0x4'));var interaction=require(_0xc6e1('0x5'));var config=require(_0xc6e1('0x6'));var controller=require('./chatInternalMessage.controller');router[_0xc6e1('0x7')]('/',auth['isAuthenticated'](),controller[_0xc6e1('0x8')]);router['get']('/describe',auth[_0xc6e1('0x9')](),controller[_0xc6e1('0xa')]);router[_0xc6e1('0x7')](_0xc6e1('0xb'),auth[_0xc6e1('0x9')](),controller[_0xc6e1('0xc')]);router[_0xc6e1('0x7')]('/:id',auth[_0xc6e1('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xc6e1('0xd')]);router[_0xc6e1('0xe')](_0xc6e1('0xf'),controller['update']);router['delete'](_0xc6e1('0xf'),auth[_0xc6e1('0x9')](),controller['destroy']);module[_0xc6e1('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index a9f37b4..b3a87b8 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 _0xfcbb=['ENUM','out','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x373d57,_0x28b78c){var _0x473d0d=function(_0x50631d){while(--_0x50631d){_0x373d57['push'](_0x373d57['shift']());}};_0x473d0d(++_0x28b78c);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x293786,_0x3af279){_0x293786=_0x293786-0x0;var _0x31021c=_0xfcbb[_0x293786];return _0x31021c;};'use strict';var Sequelize=require(_0xbfcb('0x0'));module[_0xbfcb('0x1')]={'body':{'type':Sequelize[_0xbfcb('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xbfcb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbfcb('0x4')]('in',_0xbfcb('0x5')),'defaultValue':_0xbfcb('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbfcb('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xdd6e=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xdd6e,0xa5));var _0xedd6=function(_0x1869ac,_0x1a9506){_0x1869ac=_0x1869ac-0x0;var _0xc2bf7b=_0xdd6e[_0x1869ac];return _0xc2bf7b;};'use strict';var Sequelize=require(_0xedd6('0x0'));module[_0xedd6('0x1')]={'body':{'type':Sequelize[_0xedd6('0x2')](_0xedd6('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xedd6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xedd6('0x5')]('in',_0xedd6('0x6')),'defaultValue':_0xedd6('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 435f695..b7eb0ca 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 _0xd10c=['event','EventManager','acceptmessage','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','rejectMessage','interface','rejectmessage','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','end','status','offset','limit','undefined','count','apply','update','stack','name','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','show','params','includeAll','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','UserId','agent','get','ChatInteraction','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[CHATMESSAGE: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','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel'];(function(_0x21ec8c,_0x1e58c6){var _0x18f950=function(_0x4f08a3){while(--_0x4f08a3){_0x21ec8c['push'](_0x21ec8c['shift']());}};_0x18f950(++_0x1e58c6);}(_0xd10c,0x197));var _0xcd10=function(_0x896a1a,_0x2ecb55){_0x896a1a=_0x896a1a-0x0;var _0x9cc846=_0xd10c[_0x896a1a];return _0x9cc846;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd10('0x0'));var zipdir=require(_0xcd10('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd10('0x2'));var moment=require(_0xcd10('0x3'));var BPromise=require(_0xcd10('0x4'));var Mustache=require('mustache');var util=require(_0xcd10('0x5'));var path=require(_0xcd10('0x6'));var sox=require(_0xcd10('0x7'));var csv=require(_0xcd10('0x8'));var ejs=require(_0xcd10('0x9'));var fs=require('fs');var fs_extra=require(_0xcd10('0xa'));var _=require(_0xcd10('0xb'));var squel=require(_0xcd10('0xc'));var crypto=require(_0xcd10('0xd'));var jsforce=require(_0xcd10('0xe'));var deskjs=require(_0xcd10('0xf'));var toCsv=require(_0xcd10('0x8'));var querystring=require('querystring');var Papa=require(_0xcd10('0x10'));var Redis=require(_0xcd10('0x11'));var authService=require(_0xcd10('0x12'));var qs=require(_0xcd10('0x13'));var as=require(_0xcd10('0x14'));var hardwareService=require(_0xcd10('0x15'));var logger=require(_0xcd10('0x16'))(_0xcd10('0x17'));var utils=require(_0xcd10('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcd10('0x19'));var db=require(_0xcd10('0x1a'))['db'];config[_0xcd10('0x1b')]=_[_0xcd10('0x1c')](config[_0xcd10('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd10('0x1d'))(new Redis(config[_0xcd10('0x1b')]));require(_0xcd10('0x1e'))['register'](socket);var jayson=require(_0xcd10('0x1f'));var client=jayson[_0xcd10('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xcd10('0x20')][_0xcd10('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x12677f,_0xb43d41,_0xa1192a,_0x34df6a){return new BPromise(function(_0x40be36,_0x1fcefb){var _0x4688de=_0x34df6a||client;return _0x4688de[_0xcd10('0x22')](_0x12677f,_0xa1192a)[_0xcd10('0x23')](function(_0x463a76){logger['info'](_0xcd10('0x24'),_0xb43d41,_0xcd10('0x25'));logger[_0xcd10('0x26')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0xb43d41,_0xcd10('0x25'),JSON['stringify'](_0x463a76));if(_0x463a76['error']){if(_0x463a76[_0xcd10('0x27')][_0xcd10('0x28')]===0x1f4){logger[_0xcd10('0x27')](_0xcd10('0x24'),_0xb43d41,_0x463a76[_0xcd10('0x27')][_0xcd10('0x29')]);return _0x1fcefb(_0x463a76[_0xcd10('0x27')][_0xcd10('0x29')]);}logger['error'](_0xcd10('0x24'),_0xb43d41,_0x463a76['error'][_0xcd10('0x29')]);return _0x40be36(_0x463a76['error']['message']);}else{logger['info'](_0xcd10('0x24'),_0xb43d41,'request\x20sent');_0x40be36(_0x463a76[_0xcd10('0x2a')][_0xcd10('0x29')]);}})[_0xcd10('0x2b')](function(_0x9567a5){logger['error']('ChatMessage,\x20%s,\x20%s',_0xb43d41,_0x9567a5);_0x1fcefb(_0x9567a5);});});}function respondWithStatusCode(_0x3f8767,_0x2d177c){_0x2d177c=_0x2d177c||0xcc;return function(_0x31dcb4){if(_0x31dcb4){return _0x3f8767[_0xcd10('0x2c')](_0x2d177c);}return _0x3f8767['status'](_0x2d177c)[_0xcd10('0x2d')]();};}function respondWithResult(_0x450e18,_0xdfecc8){_0xdfecc8=_0xdfecc8||0xc8;return function(_0x456bd0){if(_0x456bd0){return _0x450e18[_0xcd10('0x2e')](_0xdfecc8)['json'](_0x456bd0);}};}function respondWithFilteredResult(_0x489be2,_0x42e4fe){return function(_0x12c991){if(_0x12c991){var _0x45912f=typeof _0x42e4fe[_0xcd10('0x2f')]==='undefined'&&typeof _0x42e4fe[_0xcd10('0x30')]===_0xcd10('0x31');var _0x2ed32f=_0x12c991[_0xcd10('0x32')];var _0x23995a=_0x45912f?0x0:_0x42e4fe[_0xcd10('0x2f')];var _0x9cbf3c=_0x45912f?_0x12c991[_0xcd10('0x32')]:_0x42e4fe['offset']+_0x42e4fe[_0xcd10('0x30')];var _0x3c86bc;if(_0x9cbf3c>=_0x2ed32f){_0x9cbf3c=_0x2ed32f;_0x3c86bc=0xc8;}else{_0x3c86bc=0xce;}_0x489be2[_0xcd10('0x2e')](_0x3c86bc);return _0x489be2['set']('Content-Range',_0x23995a+'-'+_0x9cbf3c+'/'+_0x2ed32f)['json'](_0x12c991);}return null;};}function patchUpdates(_0xd61b72){return function(_0x1ce196){try{jsonpatch[_0xcd10('0x33')](_0x1ce196,_0xd61b72,!![]);}catch(_0x112eb1){return BPromise['reject'](_0x112eb1);}return _0x1ce196['save']();};}function saveUpdates(_0x2b91b1,_0x4bf03a){return function(_0x1b161a){if(_0x1b161a){return _0x1b161a[_0xcd10('0x34')](_0x2b91b1)['then'](function(_0x429986){return _0x429986;});}return null;};}function removeEntity(_0x48d5bb,_0x3910c3){return function(_0x49558b){if(_0x49558b){return _0x49558b['destroy']()['then'](function(){_0x48d5bb[_0xcd10('0x2e')](0xcc)[_0xcd10('0x2d')]();});}};}function handleEntityNotFound(_0x2304b7,_0x4c23ff){return function(_0x1203da){if(!_0x1203da){_0x2304b7['sendStatus'](0x194);}return _0x1203da;};}function handleError(_0x304294,_0xcd7471){_0xcd7471=_0xcd7471||0x1f4;return function(_0x2ee222){logger['error'](_0x2ee222[_0xcd10('0x35')]);if(_0x2ee222[_0xcd10('0x36')]){delete _0x2ee222['name'];}_0x304294[_0xcd10('0x2e')](_0xcd7471)['send'](_0x2ee222);};}exports[_0xcd10('0x37')]=function(_0x31f21f,_0xce194a){var _0x29e79c={},_0x5ec933={},_0x1b77a2={'count':0x0,'rows':[]};var _0x29bc67=_[_0xcd10('0x38')](db[_0xcd10('0x39')][_0xcd10('0x3a')],function(_0x40ec9c){return{'name':_0x40ec9c[_0xcd10('0x3b')],'type':_0x40ec9c[_0xcd10('0x3c')][_0xcd10('0x3d')]};});_0x5ec933[_0xcd10('0x3e')]=_['map'](_0x29bc67,_0xcd10('0x36'));_0x5ec933[_0xcd10('0x3f')]=_[_0xcd10('0x40')](_0x31f21f[_0xcd10('0x3f')]);_0x5ec933[_0xcd10('0x41')]=_['intersection'](_0x5ec933['model'],_0x5ec933[_0xcd10('0x3f')]);_0x29e79c['attributes']=_[_0xcd10('0x42')](_0x5ec933[_0xcd10('0x3e')],qs['fields'](_0x31f21f[_0xcd10('0x3f')][_0xcd10('0x43')]));_0x29e79c[_0xcd10('0x44')]=_0x29e79c[_0xcd10('0x44')][_0xcd10('0x45')]?_0x29e79c[_0xcd10('0x44')]:_0x5ec933[_0xcd10('0x3e')];if(!_0x31f21f[_0xcd10('0x3f')][_0xcd10('0x46')]('nolimit')){_0x29e79c[_0xcd10('0x30')]=qs['limit'](_0x31f21f['query'][_0xcd10('0x30')]);_0x29e79c['offset']=qs[_0xcd10('0x2f')](_0x31f21f[_0xcd10('0x3f')]['offset']);}_0x29e79c[_0xcd10('0x47')]=qs[_0xcd10('0x48')](_0x31f21f[_0xcd10('0x3f')][_0xcd10('0x48')]);_0x29e79c[_0xcd10('0x49')]=qs[_0xcd10('0x41')](_[_0xcd10('0x4a')](_0x31f21f['query'],_0x5ec933[_0xcd10('0x41')]),_0x29bc67);if(_0x31f21f['query'][_0xcd10('0x4b')]){_0x29e79c[_0xcd10('0x49')]=_[_0xcd10('0x4c')](_0x29e79c[_0xcd10('0x49')],{'$or':_[_0xcd10('0x38')](_0x29bc67,function(_0x5c7011){if(_0x5c7011[_0xcd10('0x3c')]!=='VIRTUAL'){var _0x365136={};_0x365136[_0x5c7011[_0xcd10('0x36')]]={'$like':'%'+_0x31f21f['query'][_0xcd10('0x4b')]+'%'};return _0x365136;}})});}_0x29e79c=_['merge']({},_0x29e79c,_0x31f21f['options']);var _0x471a9b={'where':_0x29e79c['where']};return db[_0xcd10('0x39')]['count'](_0x471a9b)['then'](function(_0x2f1387){_0x1b77a2['count']=_0x2f1387;if(_0x31f21f['query']['includeAll']){_0x29e79c[_0xcd10('0x4d')]=[{'all':!![]}];}return db['ChatMessage'][_0xcd10('0x4e')](_0x29e79c);})[_0xcd10('0x23')](function(_0x138918){_0x1b77a2[_0xcd10('0x4f')]=_0x138918;return _0x1b77a2;})[_0xcd10('0x23')](respondWithFilteredResult(_0xce194a,_0x29e79c))[_0xcd10('0x2b')](handleError(_0xce194a,null));};exports[_0xcd10('0x50')]=function(_0x18520d,_0x515d12){var _0x4f382d={'raw':!![],'where':{'id':_0x18520d[_0xcd10('0x51')]['id']}},_0x193fc1={};_0x193fc1[_0xcd10('0x3e')]=_[_0xcd10('0x40')](db[_0xcd10('0x39')]['rawAttributes']);_0x193fc1[_0xcd10('0x3f')]=_[_0xcd10('0x40')](_0x18520d['query']);_0x193fc1[_0xcd10('0x41')]=_['intersection'](_0x193fc1[_0xcd10('0x3e')],_0x193fc1['query']);_0x4f382d[_0xcd10('0x44')]=_['intersection'](_0x193fc1[_0xcd10('0x3e')],qs[_0xcd10('0x43')](_0x18520d[_0xcd10('0x3f')][_0xcd10('0x43')]));_0x4f382d[_0xcd10('0x44')]=_0x4f382d[_0xcd10('0x44')][_0xcd10('0x45')]?_0x4f382d[_0xcd10('0x44')]:_0x193fc1[_0xcd10('0x3e')];if(_0x18520d[_0xcd10('0x3f')][_0xcd10('0x52')]){_0x4f382d['include']=[{'all':!![]}];}_0x4f382d=_[_0xcd10('0x4c')]({},_0x4f382d,_0x18520d['options']);return db[_0xcd10('0x39')][_0xcd10('0x53')](_0x4f382d)['then'](handleEntityNotFound(_0x515d12,null))[_0xcd10('0x23')](respondWithResult(_0x515d12,null))[_0xcd10('0x2b')](handleError(_0x515d12,null));};exports['create']=function(_0x17a293,_0x1a19d4){return db[_0xcd10('0x39')][_0xcd10('0x54')](_0x17a293['body'],{})[_0xcd10('0x23')](respondWithResult(_0x1a19d4,0xc9))['catch'](handleError(_0x1a19d4,null));};exports[_0xcd10('0x34')]=function(_0x5d738c,_0x1894f6){if(_0x5d738c['body']['id']){delete _0x5d738c[_0xcd10('0x55')]['id'];}return db[_0xcd10('0x39')][_0xcd10('0x53')]({'where':{'id':_0x5d738c['params']['id']}})[_0xcd10('0x23')](handleEntityNotFound(_0x1894f6,null))[_0xcd10('0x23')](saveUpdates(_0x5d738c[_0xcd10('0x55')],null))[_0xcd10('0x23')](respondWithResult(_0x1894f6,null))[_0xcd10('0x2b')](handleError(_0x1894f6,null));};exports['destroy']=function(_0x18a4f2,_0x44fe1f){return db[_0xcd10('0x39')][_0xcd10('0x53')]({'where':{'id':_0x18a4f2[_0xcd10('0x51')]['id']}})[_0xcd10('0x23')](handleEntityNotFound(_0x44fe1f,null))[_0xcd10('0x23')](removeEntity(_0x44fe1f,null))[_0xcd10('0x2b')](handleError(_0x44fe1f,null));};exports[_0xcd10('0x56')]=function(_0x426419,_0x470564){return db[_0xcd10('0x39')]['describe']()[_0xcd10('0x23')](respondWithResult(_0x470564,null))[_0xcd10('0x2b')](handleError(_0x470564,null));};var interaction_log=require(_0xcd10('0x16'))(_0xcd10('0x57'));exports[_0xcd10('0x58')]=function(_0x3745fc,_0x2a421c,_0x18d5eb){var _0xb6d660={'agent':{},'channel':_0xcd10('0x59')};if(_0x3745fc[_0xcd10('0x55')]['id']){delete _0x3745fc['body']['id'];}_0x3745fc[_0xcd10('0x55')][_0xcd10('0x5a')]=!![];_0x3745fc[_0xcd10('0x55')][_0xcd10('0x5b')]=moment()[_0xcd10('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3745fc['body'][_0xcd10('0x5d')]=_0x3745fc[_0xcd10('0x55')][_0xcd10('0x5d')]||_0x3745fc['user']['id'];_0xb6d660[_0xcd10('0x5e')]['id']=_0x3745fc['body'][_0xcd10('0x5d')];return db[_0xcd10('0x39')][_0xcd10('0x53')]({'where':{'id':_0x3745fc['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2a421c,null))[_0xcd10('0x23')](saveUpdates(_0x3745fc[_0xcd10('0x55')],null))[_0xcd10('0x23')](function(_0x217e32){if(_0x217e32){_0xb6d660['message']=_0x217e32[_0xcd10('0x5f')]({'plain':!![]});return db[_0xcd10('0x60')]['find']({'where':{'id':_0x217e32[_0xcd10('0x61')]}});}return null;})[_0xcd10('0x23')](handleEntityNotFound(_0x2a421c,null))[_0xcd10('0x23')](function(_0x14742c){if(_0x14742c){return _0x14742c[_0xcd10('0x34')]({'UserId':_0x3745fc[_0xcd10('0x55')][_0xcd10('0x5d')],'read1stAt':_['isNil'](_0x14742c['read1stAt'])?moment()[_0xcd10('0x5c')](_0xcd10('0x62')):undefined});}return null;})[_0xcd10('0x23')](function(_0x375465){if(_0x375465){_0xb6d660[_0xcd10('0x63')]=_0x375465[_0xcd10('0x5f')]({'plain':!![]});interaction_log[_0xcd10('0x64')](_0xcd10('0x65'),_0x3745fc[_0xcd10('0x66')]['id'],_0x3745fc[_0xcd10('0x66')]['name'],_0x3745fc['user'][_0xcd10('0x67')],_0xb6d660[_0xcd10('0x63')]['id'],_0x3745fc[_0xcd10('0x55')]?JSON['stringify'](_0x3745fc[_0xcd10('0x55')]):'null');return respondWithRpcPromise(_0xcd10('0x68'),_0xcd10('0x69'),_0xb6d660);}return null;})['then'](function(_0x40cda4){var _0x28537e=_0xcd10('0x6a')+_0x40cda4[_0xcd10('0x29')][_0xcd10('0x6b')];return db[_0xcd10('0x6c')]['query'](_0x28537e,{'type':db[_0xcd10('0x6d')][_0xcd10('0x6e')][_0xcd10('0x6f')],'raw':!![]})[_0xcd10('0x23')](function(_0xf56f46){return _0xf56f46;});})[_0xcd10('0x23')](function(_0x5af124){if(_0x5af124){_0xb6d660[_0xcd10('0x29')][_0xcd10('0x70')]=_0x5af124[0x0];if(!_0x3745fc[_0xcd10('0x55')][_0xcd10('0x5d')])return;return db[_0xcd10('0x71')][_0xcd10('0x53')]({'where':{'id':_0x3745fc[_0xcd10('0x55')][_0xcd10('0x5d')],'role':'agent'},'attributes':['id',_0xcd10('0x36'),_0xcd10('0x72'),_0xcd10('0x73'),_0xcd10('0x74')],'raw':!![]});}return null;})[_0xcd10('0x23')](function(_0x5124ec){if(!_0x5124ec)return null;_0xb6d660['message']['agent']=_0x5124ec;return _0xb6d660;})[_0xcd10('0x23')](function(_0xa56a5b){if(_0xa56a5b){if(_0x3745fc['body'][_0xcd10('0x75')]){_0xb6d660[_0xcd10('0x29')]['interface']=util['format'](_0xcd10('0x76'),_0x3745fc[_0xcd10('0x66')][_0xcd10('0x36')]);_0xb6d660[_0xcd10('0x29')][_0xcd10('0x77')]=_0xb6d660[_0xcd10('0x77')];_0xb6d660['message'][_0xcd10('0x78')]=_0xb6d660[_0xcd10('0x77')];_0xb6d660[_0xcd10('0x29')][_0xcd10('0x79')]='accept';return respondWithRpcPromise('EventManager',_0xcd10('0x7a'),{'event':_0xcd10('0x7b'),'message':_[_0xcd10('0x4c')](_0xb6d660['message'],JSON['parse'](_0xb6d660['interaction'][_0xcd10('0x7c')]))},client9002)[_0xcd10('0x23')](function(){return _0xb6d660;});}return _0xb6d660;}return null;})[_0xcd10('0x23')](respondWithResult(_0x2a421c,null))['catch'](handleError(_0x2a421c,null));};var interaction_log=require(_0xcd10('0x16'))('chat-interactions');exports[_0xcd10('0x7d')]=function(_0x7b35aa,_0x4d7afc,_0x5745d2){var _0x2bb503={'agent':{},'channel':_0xcd10('0x59')};if(_0x7b35aa[_0xcd10('0x55')]['id']){delete _0x7b35aa[_0xcd10('0x55')]['id'];}_0x7b35aa[_0xcd10('0x55')][_0xcd10('0x5d')]=_0x7b35aa[_0xcd10('0x55')][_0xcd10('0x5d')]||_0x7b35aa[_0xcd10('0x66')]['id'];_0x2bb503[_0xcd10('0x5e')]['id']=_0x7b35aa[_0xcd10('0x55')]['UserId'];return db[_0xcd10('0x39')][_0xcd10('0x53')]({'where':{'id':_0x7b35aa[_0xcd10('0x51')]['id'],'UserId':null}})[_0xcd10('0x23')](handleEntityNotFound(_0x4d7afc,null))['then'](function(_0x272c1e){if(_0x272c1e){_0x2bb503[_0xcd10('0x29')]=_0x272c1e[_0xcd10('0x5f')]({'plain':!![]});return db['ChatInteraction'][_0xcd10('0x53')]({'where':{'id':_0x272c1e[_0xcd10('0x61')]}});}return null;})[_0xcd10('0x23')](handleEntityNotFound(_0x4d7afc,null))[_0xcd10('0x23')](function(_0x9ca8f5){if(_0x9ca8f5){_0x2bb503[_0xcd10('0x63')]=_0x9ca8f5[_0xcd10('0x5f')]({'plain':!![]});interaction_log['info'](_0xcd10('0x7e'),_0x7b35aa[_0xcd10('0x66')]['id'],_0x7b35aa[_0xcd10('0x66')][_0xcd10('0x36')],_0x7b35aa[_0xcd10('0x66')][_0xcd10('0x67')],_0x2bb503[_0xcd10('0x63')]['id'],_0x7b35aa[_0xcd10('0x55')]?JSON[_0xcd10('0x7f')](_0x7b35aa[_0xcd10('0x55')]):_0xcd10('0x80'));return respondWithRpcPromise('RejectMessage',_0xcd10('0x81'),_0x2bb503);}return null;})[_0xcd10('0x23')](function(_0x2d892e){var _0x360040='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2d892e[_0xcd10('0x29')]['ContactId'];return db[_0xcd10('0x6c')][_0xcd10('0x3f')](_0x360040,{'type':db[_0xcd10('0x6d')][_0xcd10('0x6e')]['SELECT'],'raw':!![]})[_0xcd10('0x23')](function(_0x33f58b){return _0x33f58b;});})['then'](function(_0x1b7dc1){if(_0x1b7dc1){_0x2bb503[_0xcd10('0x29')][_0xcd10('0x70')]=_0x1b7dc1[0x0];if(!_0x7b35aa[_0xcd10('0x55')]['UserId'])return;return db[_0xcd10('0x71')]['find']({'where':{'id':_0x7b35aa[_0xcd10('0x55')][_0xcd10('0x5d')],'role':'agent'},'attributes':['id',_0xcd10('0x36'),'fullname','email',_0xcd10('0x74')],'raw':!![]});}return null;})['then'](function(_0x170b98){if(!_0x170b98)return null;_0x2bb503[_0xcd10('0x29')]['agent']=_0x170b98;return _0x2bb503;})[_0xcd10('0x23')](function(_0x47c632){if(_0x47c632){_0x47c632['message'][_0xcd10('0x82')]=util['format'](_0xcd10('0x76'),_0x7b35aa[_0xcd10('0x66')][_0xcd10('0x36')]);_0x47c632[_0xcd10('0x29')][_0xcd10('0x77')]=_0x2bb503['channel'];_0x47c632[_0xcd10('0x29')][_0xcd10('0x78')]=_0x2bb503[_0xcd10('0x77')];_0x47c632[_0xcd10('0x29')][_0xcd10('0x79')]=_0xcd10('0x7d');respondWithRpcPromise(_0xcd10('0x7a'),_0xcd10('0x7a'),{'event':_0xcd10('0x83'),'message':_[_0xcd10('0x4c')](_0x2bb503[_0xcd10('0x29')],JSON['parse'](_0x2bb503[_0xcd10('0x63')]['formData']))},client9002);return _0x2bb503;}return null;})[_0xcd10('0x23')](respondWithResult(_0x4d7afc,null))[_0xcd10('0x2b')](handleError(_0x4d7afc,null));}; \ No newline at end of file +var _0xb844=['interface','channel','motionChannel','event','accept','EventManager','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','contact','email','internal','SIP/%s','reject','rejectmessage','parse','eml-format','zip-dir','fast-json-patch','moment','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','update','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatMessage','includeAll','include','rows','catch','show','params','find','create','body','destroy','describe','chat','read','readAt','format','UserId','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','agent','fullname'];(function(_0x432c80,_0x3ec20a){var _0x53b222=function(_0x509214){while(--_0x509214){_0x432c80['push'](_0x432c80['shift']());}};_0x53b222(++_0x3ec20a);}(_0xb844,0x96));var _0x4b84=function(_0x54214f,_0x16cf23){_0x54214f=_0x54214f-0x0;var _0x49224b=_0xb844[_0x54214f];return _0x49224b;};'use strict';var emlformat=require(_0x4b84('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b84('0x1'));var jsonpatch=require(_0x4b84('0x2'));var rp=require('request-promise');var moment=require(_0x4b84('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4b84('0x4'));var util=require('util');var path=require(_0x4b84('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4b84('0x6'));var fs=require('fs');var fs_extra=require(_0x4b84('0x7'));var _=require(_0x4b84('0x8'));var squel=require('squel');var crypto=require(_0x4b84('0x9'));var jsforce=require(_0x4b84('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4b84('0xb'));var querystring=require('querystring');var Papa=require(_0x4b84('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4b84('0xd'));var hardwareService=require(_0x4b84('0xe'));var logger=require(_0x4b84('0xf'))(_0x4b84('0x10'));var utils=require(_0x4b84('0x11'));var config=require(_0x4b84('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b84('0x13'))['db'];config[_0x4b84('0x14')]=_[_0x4b84('0x15')](config[_0x4b84('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4b84('0x16'))[_0x4b84('0x17')](socket);var jayson=require(_0x4b84('0x18'));var client=jayson[_0x4b84('0x19')][_0x4b84('0x1a')]({'port':0x232c});var client9002=jayson[_0x4b84('0x19')][_0x4b84('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4d219f,_0x1c31fa,_0x4e725c,_0x414211){return new BPromise(function(_0x44fe84,_0x361992){var _0x1a2df3=_0x414211||client;return _0x1a2df3[_0x4b84('0x1b')](_0x4d219f,_0x4e725c)[_0x4b84('0x1c')](function(_0x427345){logger[_0x4b84('0x1d')](_0x4b84('0x1e'),_0x1c31fa,'request\x20sent');logger['debug'](_0x4b84('0x1f'),_0x1c31fa,_0x4b84('0x20'),JSON[_0x4b84('0x21')](_0x427345));if(_0x427345['error']){if(_0x427345[_0x4b84('0x22')]['code']===0x1f4){logger[_0x4b84('0x22')](_0x4b84('0x1e'),_0x1c31fa,_0x427345['error'][_0x4b84('0x23')]);return _0x361992(_0x427345[_0x4b84('0x22')][_0x4b84('0x23')]);}logger[_0x4b84('0x22')](_0x4b84('0x1e'),_0x1c31fa,_0x427345['error'][_0x4b84('0x23')]);return _0x44fe84(_0x427345['error'][_0x4b84('0x23')]);}else{logger[_0x4b84('0x1d')](_0x4b84('0x1e'),_0x1c31fa,'request\x20sent');_0x44fe84(_0x427345[_0x4b84('0x24')]['message']);}})['catch'](function(_0x3e5383){logger[_0x4b84('0x22')]('ChatMessage,\x20%s,\x20%s',_0x1c31fa,_0x3e5383);_0x361992(_0x3e5383);});});}function respondWithStatusCode(_0x3c9c0a,_0x26d1ce){_0x26d1ce=_0x26d1ce||0xcc;return function(_0x3d8ce2){if(_0x3d8ce2){return _0x3c9c0a[_0x4b84('0x25')](_0x26d1ce);}return _0x3c9c0a[_0x4b84('0x26')](_0x26d1ce)[_0x4b84('0x27')]();};}function respondWithResult(_0x192a83,_0x1f1c50){_0x1f1c50=_0x1f1c50||0xc8;return function(_0x40bf58){if(_0x40bf58){return _0x192a83['status'](_0x1f1c50)['json'](_0x40bf58);}};}function respondWithFilteredResult(_0x8094b1,_0x2a440f){return function(_0x527707){if(_0x527707){var _0x436c78=typeof _0x2a440f[_0x4b84('0x28')]==='undefined'&&typeof _0x2a440f['limit']===_0x4b84('0x29');var _0x8224bd=_0x527707[_0x4b84('0x2a')];var _0x6e200a=_0x436c78?0x0:_0x2a440f[_0x4b84('0x28')];var _0x3da3dc=_0x436c78?_0x527707['count']:_0x2a440f[_0x4b84('0x28')]+_0x2a440f[_0x4b84('0x2b')];var _0xf1ce76;if(_0x3da3dc>=_0x8224bd){_0x3da3dc=_0x8224bd;_0xf1ce76=0xc8;}else{_0xf1ce76=0xce;}_0x8094b1['status'](_0xf1ce76);return _0x8094b1[_0x4b84('0x2c')](_0x4b84('0x2d'),_0x6e200a+'-'+_0x3da3dc+'/'+_0x8224bd)[_0x4b84('0x2e')](_0x527707);}return null;};}function patchUpdates(_0x1cb7e8){return function(_0x51c892){try{jsonpatch[_0x4b84('0x2f')](_0x51c892,_0x1cb7e8,!![]);}catch(_0x3c7858){return BPromise['reject'](_0x3c7858);}return _0x51c892['save']();};}function saveUpdates(_0x3dafc1,_0x24cf67){return function(_0x167a0c){if(_0x167a0c){return _0x167a0c[_0x4b84('0x30')](_0x3dafc1)[_0x4b84('0x1c')](function(_0x2cb104){return _0x2cb104;});}return null;};}function removeEntity(_0x31bd88,_0xa60820){return function(_0x37f6ca){if(_0x37f6ca){return _0x37f6ca['destroy']()[_0x4b84('0x1c')](function(){_0x31bd88[_0x4b84('0x26')](0xcc)[_0x4b84('0x27')]();});}};}function handleEntityNotFound(_0x1e56b7,_0x2fc643){return function(_0x3e465e){if(!_0x3e465e){_0x1e56b7[_0x4b84('0x25')](0x194);}return _0x3e465e;};}function handleError(_0x5bce3b,_0x3cdfdb){_0x3cdfdb=_0x3cdfdb||0x1f4;return function(_0x6f3d64){logger[_0x4b84('0x22')](_0x6f3d64[_0x4b84('0x31')]);if(_0x6f3d64[_0x4b84('0x32')]){delete _0x6f3d64[_0x4b84('0x32')];}_0x5bce3b['status'](_0x3cdfdb)[_0x4b84('0x33')](_0x6f3d64);};}exports[_0x4b84('0x34')]=function(_0x210fee,_0xbf9c7b){var _0x24aaa6={},_0x717127={},_0x55a399={'count':0x0,'rows':[]};var _0x47ad4a=_[_0x4b84('0x35')](db['ChatMessage'][_0x4b84('0x36')],function(_0x17d41e){return{'name':_0x17d41e[_0x4b84('0x37')],'type':_0x17d41e[_0x4b84('0x38')]['key']};});_0x717127[_0x4b84('0x39')]=_[_0x4b84('0x35')](_0x47ad4a,_0x4b84('0x32'));_0x717127[_0x4b84('0x3a')]=_[_0x4b84('0x3b')](_0x210fee[_0x4b84('0x3a')]);_0x717127[_0x4b84('0x3c')]=_[_0x4b84('0x3d')](_0x717127['model'],_0x717127[_0x4b84('0x3a')]);_0x24aaa6[_0x4b84('0x3e')]=_[_0x4b84('0x3d')](_0x717127[_0x4b84('0x39')],qs[_0x4b84('0x3f')](_0x210fee['query'][_0x4b84('0x3f')]));_0x24aaa6[_0x4b84('0x3e')]=_0x24aaa6[_0x4b84('0x3e')][_0x4b84('0x40')]?_0x24aaa6[_0x4b84('0x3e')]:_0x717127[_0x4b84('0x39')];if(!_0x210fee[_0x4b84('0x3a')][_0x4b84('0x41')](_0x4b84('0x42'))){_0x24aaa6[_0x4b84('0x2b')]=qs[_0x4b84('0x2b')](_0x210fee[_0x4b84('0x3a')][_0x4b84('0x2b')]);_0x24aaa6['offset']=qs[_0x4b84('0x28')](_0x210fee[_0x4b84('0x3a')][_0x4b84('0x28')]);}_0x24aaa6[_0x4b84('0x43')]=qs[_0x4b84('0x44')](_0x210fee['query']['sort']);_0x24aaa6[_0x4b84('0x45')]=qs[_0x4b84('0x3c')](_[_0x4b84('0x46')](_0x210fee['query'],_0x717127[_0x4b84('0x3c')]),_0x47ad4a);if(_0x210fee[_0x4b84('0x3a')][_0x4b84('0x47')]){_0x24aaa6['where']=_[_0x4b84('0x48')](_0x24aaa6[_0x4b84('0x45')],{'$or':_[_0x4b84('0x35')](_0x47ad4a,function(_0x595231){if(_0x595231[_0x4b84('0x38')]!==_0x4b84('0x49')){var _0x20e05a={};_0x20e05a[_0x595231[_0x4b84('0x32')]]={'$like':'%'+_0x210fee[_0x4b84('0x3a')][_0x4b84('0x47')]+'%'};return _0x20e05a;}})});}_0x24aaa6=_[_0x4b84('0x48')]({},_0x24aaa6,_0x210fee[_0x4b84('0x4a')]);var _0x28a359={'where':_0x24aaa6[_0x4b84('0x45')]};return db[_0x4b84('0x4b')][_0x4b84('0x2a')](_0x28a359)['then'](function(_0xe6b0c1){_0x55a399['count']=_0xe6b0c1;if(_0x210fee[_0x4b84('0x3a')][_0x4b84('0x4c')]){_0x24aaa6[_0x4b84('0x4d')]=[{'all':!![]}];}return db[_0x4b84('0x4b')]['findAll'](_0x24aaa6);})[_0x4b84('0x1c')](function(_0x2cb066){_0x55a399[_0x4b84('0x4e')]=_0x2cb066;return _0x55a399;})[_0x4b84('0x1c')](respondWithFilteredResult(_0xbf9c7b,_0x24aaa6))[_0x4b84('0x4f')](handleError(_0xbf9c7b,null));};exports[_0x4b84('0x50')]=function(_0x3006e7,_0x1679a6){var _0x1f1221={'raw':!![],'where':{'id':_0x3006e7[_0x4b84('0x51')]['id']}},_0x11820a={};_0x11820a[_0x4b84('0x39')]=_['keys'](db[_0x4b84('0x4b')][_0x4b84('0x36')]);_0x11820a[_0x4b84('0x3a')]=_['keys'](_0x3006e7[_0x4b84('0x3a')]);_0x11820a[_0x4b84('0x3c')]=_[_0x4b84('0x3d')](_0x11820a[_0x4b84('0x39')],_0x11820a[_0x4b84('0x3a')]);_0x1f1221[_0x4b84('0x3e')]=_[_0x4b84('0x3d')](_0x11820a[_0x4b84('0x39')],qs[_0x4b84('0x3f')](_0x3006e7['query'][_0x4b84('0x3f')]));_0x1f1221['attributes']=_0x1f1221[_0x4b84('0x3e')]['length']?_0x1f1221[_0x4b84('0x3e')]:_0x11820a[_0x4b84('0x39')];if(_0x3006e7[_0x4b84('0x3a')][_0x4b84('0x4c')]){_0x1f1221[_0x4b84('0x4d')]=[{'all':!![]}];}_0x1f1221=_[_0x4b84('0x48')]({},_0x1f1221,_0x3006e7[_0x4b84('0x4a')]);return db[_0x4b84('0x4b')][_0x4b84('0x52')](_0x1f1221)[_0x4b84('0x1c')](handleEntityNotFound(_0x1679a6,null))[_0x4b84('0x1c')](respondWithResult(_0x1679a6,null))['catch'](handleError(_0x1679a6,null));};exports[_0x4b84('0x53')]=function(_0x386b90,_0x33f0f1){return db[_0x4b84('0x4b')][_0x4b84('0x53')](_0x386b90[_0x4b84('0x54')],{})['then'](respondWithResult(_0x33f0f1,0xc9))[_0x4b84('0x4f')](handleError(_0x33f0f1,null));};exports[_0x4b84('0x30')]=function(_0x15aee2,_0x39efdd){if(_0x15aee2['body']['id']){delete _0x15aee2[_0x4b84('0x54')]['id'];}return db[_0x4b84('0x4b')][_0x4b84('0x52')]({'where':{'id':_0x15aee2['params']['id']}})['then'](handleEntityNotFound(_0x39efdd,null))[_0x4b84('0x1c')](saveUpdates(_0x15aee2[_0x4b84('0x54')],null))[_0x4b84('0x1c')](respondWithResult(_0x39efdd,null))[_0x4b84('0x4f')](handleError(_0x39efdd,null));};exports[_0x4b84('0x55')]=function(_0x86bb0e,_0x55a97a){return db[_0x4b84('0x4b')][_0x4b84('0x52')]({'where':{'id':_0x86bb0e[_0x4b84('0x51')]['id']}})[_0x4b84('0x1c')](handleEntityNotFound(_0x55a97a,null))[_0x4b84('0x1c')](removeEntity(_0x55a97a,null))[_0x4b84('0x4f')](handleError(_0x55a97a,null));};exports[_0x4b84('0x56')]=function(_0x4692d7,_0xf10a9){return db[_0x4b84('0x4b')]['describe']()[_0x4b84('0x1c')](respondWithResult(_0xf10a9,null))[_0x4b84('0x4f')](handleError(_0xf10a9,null));};var interaction_log=require(_0x4b84('0xf'))('chat-interactions');exports['accept']=function(_0x3391b3,_0x51234a,_0x3c169c){var _0x3a084f={'agent':{},'channel':_0x4b84('0x57')};if(_0x3391b3[_0x4b84('0x54')]['id']){delete _0x3391b3[_0x4b84('0x54')]['id'];}_0x3391b3[_0x4b84('0x54')][_0x4b84('0x58')]=!![];_0x3391b3[_0x4b84('0x54')][_0x4b84('0x59')]=moment()[_0x4b84('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x3391b3[_0x4b84('0x54')][_0x4b84('0x5b')]=_0x3391b3[_0x4b84('0x54')][_0x4b84('0x5b')]||_0x3391b3['user']['id'];_0x3a084f['agent']['id']=_0x3391b3[_0x4b84('0x54')][_0x4b84('0x5b')];return db[_0x4b84('0x4b')][_0x4b84('0x52')]({'where':{'id':_0x3391b3['params']['id'],'UserId':null}})[_0x4b84('0x1c')](handleEntityNotFound(_0x51234a,null))['then'](saveUpdates(_0x3391b3[_0x4b84('0x54')],null))[_0x4b84('0x1c')](function(_0x275439){if(_0x275439){_0x3a084f[_0x4b84('0x23')]=_0x275439[_0x4b84('0x5c')]({'plain':!![]});return db[_0x4b84('0x5d')][_0x4b84('0x52')]({'where':{'id':_0x275439[_0x4b84('0x5e')]}});}return null;})[_0x4b84('0x1c')](handleEntityNotFound(_0x51234a,null))[_0x4b84('0x1c')](function(_0x34a480){if(_0x34a480){return _0x34a480[_0x4b84('0x30')]({'UserId':_0x3391b3[_0x4b84('0x54')][_0x4b84('0x5b')],'read1stAt':_[_0x4b84('0x5f')](_0x34a480[_0x4b84('0x60')])?moment()[_0x4b84('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x333f1b){if(_0x333f1b){_0x3a084f[_0x4b84('0x61')]=_0x333f1b[_0x4b84('0x5c')]({'plain':!![]});interaction_log[_0x4b84('0x1d')](_0x4b84('0x62'),_0x3391b3[_0x4b84('0x63')]['id'],_0x3391b3[_0x4b84('0x63')][_0x4b84('0x32')],_0x3391b3['user'][_0x4b84('0x64')],_0x3a084f[_0x4b84('0x61')]['id'],_0x3391b3[_0x4b84('0x54')]?JSON[_0x4b84('0x21')](_0x3391b3[_0x4b84('0x54')]):_0x4b84('0x65'));return respondWithRpcPromise(_0x4b84('0x66'),_0x4b84('0x67'),_0x3a084f);}return null;})[_0x4b84('0x1c')](function(_0x3e553e){var _0x55c6cb=_0x4b84('0x68')+_0x3e553e[_0x4b84('0x23')][_0x4b84('0x69')];return db['sequelize']['query'](_0x55c6cb,{'type':db[_0x4b84('0x6a')][_0x4b84('0x6b')][_0x4b84('0x6c')],'raw':!![]})[_0x4b84('0x1c')](function(_0x8d01f0){return _0x8d01f0;});})[_0x4b84('0x1c')](function(_0x2168ba){if(_0x2168ba){_0x3a084f[_0x4b84('0x23')]['contact']=_0x2168ba[0x0];if(!_0x3391b3[_0x4b84('0x54')][_0x4b84('0x5b')])return;return db[_0x4b84('0x6d')][_0x4b84('0x52')]({'where':{'id':_0x3391b3[_0x4b84('0x54')][_0x4b84('0x5b')],'role':_0x4b84('0x6e')},'attributes':['id',_0x4b84('0x32'),_0x4b84('0x6f'),'email','internal'],'raw':!![]});}return null;})[_0x4b84('0x1c')](function(_0x5a159b){if(!_0x5a159b)return null;_0x3a084f[_0x4b84('0x23')][_0x4b84('0x6e')]=_0x5a159b;return _0x3a084f;})[_0x4b84('0x1c')](function(_0x47b5a4){if(_0x47b5a4){if(_0x3391b3[_0x4b84('0x54')]['manual']){_0x3a084f[_0x4b84('0x23')][_0x4b84('0x70')]=util[_0x4b84('0x5a')]('SIP/%s',_0x3391b3[_0x4b84('0x63')][_0x4b84('0x32')]);_0x3a084f[_0x4b84('0x23')][_0x4b84('0x71')]=_0x3a084f[_0x4b84('0x71')];_0x3a084f[_0x4b84('0x23')][_0x4b84('0x72')]=_0x3a084f[_0x4b84('0x71')];_0x3a084f['message'][_0x4b84('0x73')]=_0x4b84('0x74');return respondWithRpcPromise(_0x4b84('0x75'),_0x4b84('0x75'),{'event':'acceptmessage','message':_[_0x4b84('0x48')](_0x3a084f[_0x4b84('0x23')],JSON['parse'](_0x3a084f[_0x4b84('0x61')][_0x4b84('0x76')]))},client9002)['then'](function(){return _0x3a084f;});}return _0x3a084f;}return null;})['then'](respondWithResult(_0x51234a,null))[_0x4b84('0x4f')](handleError(_0x51234a,null));};var interaction_log=require('../../config/logger')(_0x4b84('0x77'));exports['reject']=function(_0x115492,_0x3343dd,_0x5848b2){var _0x48bfef={'agent':{},'channel':_0x4b84('0x57')};if(_0x115492[_0x4b84('0x54')]['id']){delete _0x115492['body']['id'];}_0x115492[_0x4b84('0x54')][_0x4b84('0x5b')]=_0x115492[_0x4b84('0x54')][_0x4b84('0x5b')]||_0x115492[_0x4b84('0x63')]['id'];_0x48bfef[_0x4b84('0x6e')]['id']=_0x115492[_0x4b84('0x54')][_0x4b84('0x5b')];return db['ChatMessage']['find']({'where':{'id':_0x115492[_0x4b84('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3343dd,null))[_0x4b84('0x1c')](function(_0x10aaa4){if(_0x10aaa4){_0x48bfef[_0x4b84('0x23')]=_0x10aaa4[_0x4b84('0x5c')]({'plain':!![]});return db['ChatInteraction'][_0x4b84('0x52')]({'where':{'id':_0x10aaa4[_0x4b84('0x5e')]}});}return null;})[_0x4b84('0x1c')](handleEntityNotFound(_0x3343dd,null))[_0x4b84('0x1c')](function(_0x20e91f){if(_0x20e91f){_0x48bfef['interaction']=_0x20e91f['get']({'plain':!![]});interaction_log['info'](_0x4b84('0x78'),_0x115492[_0x4b84('0x63')]['id'],_0x115492[_0x4b84('0x63')][_0x4b84('0x32')],_0x115492['user'][_0x4b84('0x64')],_0x48bfef['interaction']['id'],_0x115492[_0x4b84('0x54')]?JSON[_0x4b84('0x21')](_0x115492[_0x4b84('0x54')]):_0x4b84('0x65'));return respondWithRpcPromise(_0x4b84('0x79'),_0x4b84('0x7a'),_0x48bfef);}return null;})['then'](function(_0x24e866){var _0x52b085=_0x4b84('0x68')+_0x24e866[_0x4b84('0x23')][_0x4b84('0x69')];return db[_0x4b84('0x7b')]['query'](_0x52b085,{'type':db[_0x4b84('0x6a')][_0x4b84('0x6b')][_0x4b84('0x6c')],'raw':!![]})[_0x4b84('0x1c')](function(_0x5ad53d){return _0x5ad53d;});})[_0x4b84('0x1c')](function(_0x382448){if(_0x382448){_0x48bfef[_0x4b84('0x23')][_0x4b84('0x7c')]=_0x382448[0x0];if(!_0x115492[_0x4b84('0x54')][_0x4b84('0x5b')])return;return db['User'][_0x4b84('0x52')]({'where':{'id':_0x115492['body'][_0x4b84('0x5b')],'role':_0x4b84('0x6e')},'attributes':['id','name',_0x4b84('0x6f'),_0x4b84('0x7d'),_0x4b84('0x7e')],'raw':!![]});}return null;})['then'](function(_0x4d701b){if(!_0x4d701b)return null;_0x48bfef[_0x4b84('0x23')]['agent']=_0x4d701b;return _0x48bfef;})[_0x4b84('0x1c')](function(_0x82b99d){if(_0x82b99d){_0x82b99d[_0x4b84('0x23')][_0x4b84('0x70')]=util[_0x4b84('0x5a')](_0x4b84('0x7f'),_0x115492[_0x4b84('0x63')][_0x4b84('0x32')]);_0x82b99d[_0x4b84('0x23')][_0x4b84('0x71')]=_0x48bfef['channel'];_0x82b99d['message'][_0x4b84('0x72')]=_0x48bfef[_0x4b84('0x71')];_0x82b99d[_0x4b84('0x23')][_0x4b84('0x73')]=_0x4b84('0x80');respondWithRpcPromise(_0x4b84('0x75'),_0x4b84('0x75'),{'event':_0x4b84('0x81'),'message':_[_0x4b84('0x48')](_0x48bfef[_0x4b84('0x23')],JSON[_0x4b84('0x82')](_0x48bfef['interaction'][_0x4b84('0x76')]))},client9002);return _0x48bfef;}return null;})[_0x4b84('0x1c')](respondWithResult(_0x3343dd,null))['catch'](handleError(_0x3343dd,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index cb4d61c..c4b60a1 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 _0xc015=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x266c53,_0xbb0bad){var _0x30ae9a=function(_0x231a5e){while(--_0x231a5e){_0x266c53['push'](_0x266c53['shift']());}};_0x30ae9a(++_0xbb0bad);}(_0xc015,0x1d0));var _0x5c01=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0xc015[_0x1c8cc6];return _0x522936;};'use strict';var EventEmitter=require(_0x5c01('0x0'));var ChatMessage=require(_0x5c01('0x1'))['db'][_0x5c01('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x5c01('0x3')](0x0);var events={'afterCreate':_0x5c01('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5b271a){return function(_0x336eb6,_0x5dff85,_0x571917){ChatMessageEvents['emit'](_0x5b271a+':'+_0x336eb6['id'],_0x336eb6);ChatMessageEvents[_0x5c01('0x5')](_0x5b271a,_0x336eb6);_0x571917(null);};}for(var e in events){if(events[_0x5c01('0x6')](e)){var event=events[e];ChatMessage[_0x5c01('0x7')](e,emitEvent(event));}}module[_0x5c01('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x9f84=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x9f84,0x137));var _0x49f8=function(_0x5232bb,_0x4fcb6c){_0x5232bb=_0x5232bb-0x0;var _0x2ba6d1=_0x9f84[_0x5232bb];return _0x2ba6d1;};'use strict';var EventEmitter=require(_0x49f8('0x0'));var ChatMessage=require(_0x49f8('0x1'))['db'][_0x49f8('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x49f8('0x3')](0x0);var events={'afterCreate':_0x49f8('0x4'),'afterUpdate':_0x49f8('0x5'),'afterDestroy':_0x49f8('0x6')};function emitEvent(_0x3331af){return function(_0x4bf036,_0x68141,_0x5b85ca){ChatMessageEvents[_0x49f8('0x7')](_0x3331af+':'+_0x4bf036['id'],_0x4bf036);ChatMessageEvents['emit'](_0x3331af,_0x4bf036);_0x5b85ca(null);};}for(var e in events){if(events[_0x49f8('0x8')](e)){var event=events[e];ChatMessage[_0x49f8('0x9')](e,emitEvent(event));}}module[_0x49f8('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 26d3643..b1c627e 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 _0x139c=['chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatMessage.attributes','define'];(function(_0x17bdb5,_0x3269b8){var _0x429b17=function(_0x13be8e){while(--_0x13be8e){_0x17bdb5['push'](_0x17bdb5['shift']());}};_0x429b17(++_0x3269b8);}(_0x139c,0xf2));var _0xc139=function(_0xbd9949,_0x1482b9){_0xbd9949=_0xbd9949-0x0;var _0x2588dd=_0x139c[_0xbd9949];return _0x2588dd;};'use strict';var _=require(_0xc139('0x0'));var util=require(_0xc139('0x1'));var logger=require(_0xc139('0x2'))(_0xc139('0x3'));var moment=require(_0xc139('0x4'));var BPromise=require('bluebird');var rp=require(_0xc139('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc139('0x6'));var config=require(_0xc139('0x7'));var attributes=require(_0xc139('0x8'));module['exports']=function(_0x3face6,_0x1c452f){return _0x3face6[_0xc139('0x9')]('ChatMessage',attributes,{'tableName':_0xc139('0xa'),'paranoid':![],'indexes':[{'name':_0xc139('0xb'),'fields':[_0xc139('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e3157,_0x2c5bdd,_0x48ed08){var _0x4c47c6=_0x3face6[_0xc139('0xd')];var _0x3d8585=_0x1e3157[_0xc139('0xe')]({'plain':!![]});if(_0x3d8585[_0xc139('0xf')][_0xc139('0x10')]()==='in'||_0x3d8585[_0xc139('0xf')][_0xc139('0x10')]()==='out'&&!_0x3d8585[_0xc139('0x11')]&&!_[_0xc139('0x12')](_0x3d8585[_0xc139('0x13')])){_0x4c47c6[_0xc139('0x14')]['findOne']({'where':{'id':_0x3d8585['ChatInteractionId']}})[_0xc139('0x15')](function(_0x32d823){if(_0x32d823){_0x32d823[_0xc139('0x16')]({'lastMsgAt':_0x3d8585[_0xc139('0x17')],'lastMsgDirection':_0x3d8585['direction']['toLowerCase']()});}})[_0xc139('0x18')](function(_0x563531){console[_0xc139('0x19')](_0x563531);});}_0x48ed08();}},'charset':_0xc139('0x1a'),'collate':_0xc139('0x1b')});}; \ No newline at end of file +var _0x1437=['./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x1437,0xbd));var _0x7143=function(_0x4f52bc,_0x3854d9){_0x4f52bc=_0x4f52bc-0x0;var _0x1ed73c=_0x1437[_0x4f52bc];return _0x1ed73c;};'use strict';var _=require(_0x7143('0x0'));var util=require(_0x7143('0x1'));var logger=require(_0x7143('0x2'))('api');var moment=require(_0x7143('0x3'));var BPromise=require('bluebird');var rp=require(_0x7143('0x4'));var fs=require('fs');var path=require(_0x7143('0x5'));var rimraf=require(_0x7143('0x6'));var config=require('../../config/environment');var attributes=require(_0x7143('0x7'));module[_0x7143('0x8')]=function(_0x564472,_0x4452fc){return _0x564472[_0x7143('0x9')](_0x7143('0xa'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x7143('0xb'),'fields':['body'],'type':_0x7143('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xc9270f,_0x2cc672,_0x238f60){var _0x160420=_0x564472[_0x7143('0xd')];var _0x26ffc9=_0xc9270f[_0x7143('0xe')]({'plain':!![]});if(_0x26ffc9[_0x7143('0xf')][_0x7143('0x10')]()==='in'||_0x26ffc9[_0x7143('0xf')]['toLowerCase']()===_0x7143('0x11')&&!_0x26ffc9[_0x7143('0x12')]&&!_[_0x7143('0x13')](_0x26ffc9['UserId'])){_0x160420[_0x7143('0x14')][_0x7143('0x15')]({'where':{'id':_0x26ffc9['ChatInteractionId']}})[_0x7143('0x16')](function(_0x1ba684){if(_0x1ba684){_0x1ba684[_0x7143('0x17')]({'lastMsgAt':_0x26ffc9[_0x7143('0x18')],'lastMsgDirection':_0x26ffc9['direction']['toLowerCase']()});}})[_0x7143('0x19')](function(_0x241644){console['error'](_0x241644);});}_0x238f60();}},'charset':_0x7143('0x1a'),'collate':_0x7143('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 9ed9949..0afa013 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 _0xf2d0=['body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','register','request','then','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','ChatMessage,\x20%s,\x20%s','catch','CreateChatMessage','ChatMessage','create'];(function(_0x41712e,_0xe37424){var _0x4218e6=function(_0x2fda95){while(--_0x2fda95){_0x41712e['push'](_0x41712e['shift']());}};_0x4218e6(++_0xe37424);}(_0xf2d0,0x104));var _0x0f2d=function(_0x9fa71a,_0xc54cfd){_0x9fa71a=_0x9fa71a-0x0;var _0x4b2e72=_0xf2d0[_0x9fa71a];return _0x4b2e72;};'use strict';var _=require(_0x0f2d('0x0'));var util=require(_0x0f2d('0x1'));var moment=require(_0x0f2d('0x2'));var BPromise=require(_0x0f2d('0x3'));var rs=require(_0x0f2d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f2d('0x5'))['db'];var utils=require(_0x0f2d('0x6'));var logger=require(_0x0f2d('0x7'))(_0x0f2d('0x8'));var config=require('../../config/environment');var jayson=require(_0x0f2d('0x9'));var client=jayson[_0x0f2d('0xa')][_0x0f2d('0xb')]({'port':0x232a});config[_0x0f2d('0xc')]=_['defaults'](config[_0x0f2d('0xc')],{'host':_0x0f2d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f2d('0xc')]));require('./chatMessage.socket')[_0x0f2d('0xe')](socket);function respondWithRpcPromise(_0x5424de,_0x110468,_0x2d8ee9){return new BPromise(function(_0xdf45bf,_0x2bf24e){return client[_0x0f2d('0xf')](_0x5424de,_0x2d8ee9)[_0x0f2d('0x10')](function(_0x15e3c2){logger['info']('ChatMessage,\x20%s,\x20%s',_0x110468,_0x0f2d('0x11'));logger['debug'](_0x0f2d('0x12'),_0x110468,_0x0f2d('0x11'),JSON['stringify'](_0x15e3c2));if(_0x15e3c2['error']){if(_0x15e3c2[_0x0f2d('0x13')][_0x0f2d('0x14')]===0x1f4){logger[_0x0f2d('0x13')]('ChatMessage,\x20%s,\x20%s',_0x110468,_0x15e3c2[_0x0f2d('0x13')]['message']);return _0x2bf24e(_0x15e3c2['error'][_0x0f2d('0x15')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x110468,_0x15e3c2['error']['message']);return _0xdf45bf(_0x15e3c2[_0x0f2d('0x13')][_0x0f2d('0x15')]);}else{logger[_0x0f2d('0x16')](_0x0f2d('0x17'),_0x110468,_0x0f2d('0x11'));_0xdf45bf(_0x15e3c2['result'][_0x0f2d('0x15')]);}})[_0x0f2d('0x18')](function(_0x595607){logger[_0x0f2d('0x13')](_0x0f2d('0x17'),_0x110468,_0x595607);_0x2bf24e(_0x595607);});});}exports[_0x0f2d('0x19')]=function(_0x207bfa){var _0x4a799f=this;return new Promise(function(_0x53cadc,_0x163c6f){return db[_0x0f2d('0x1a')][_0x0f2d('0x1b')](_0x207bfa[_0x0f2d('0x1c')],{'raw':_0x207bfa[_0x0f2d('0x1d')]?_0x207bfa[_0x0f2d('0x1d')][_0x0f2d('0x1e')]===undefined?!![]:![]:!![]})[_0x0f2d('0x10')](function(_0x5463c8){logger[_0x0f2d('0x16')](_0x0f2d('0x19'),_0x207bfa);logger['debug'](_0x0f2d('0x19'),_0x207bfa,JSON[_0x0f2d('0x1f')](_0x5463c8));_0x53cadc(_0x5463c8);})[_0x0f2d('0x18')](function(_0x3a8264){logger[_0x0f2d('0x13')]('CreateChatMessage',_0x3a8264['message'],_0x207bfa);_0x163c6f(_0x4a799f[_0x0f2d('0x13')](0x1f4,_0x3a8264[_0x0f2d('0x15')]));});});}; \ No newline at end of file +var _0xbd0e=['localhost','socket.io-emitter','register','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults'];(function(_0x343065,_0x169907){var _0x1d208b=function(_0x5fd86a){while(--_0x5fd86a){_0x343065['push'](_0x343065['shift']());}};_0x1d208b(++_0x169907);}(_0xbd0e,0x187));var _0xebd0=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xbd0e[_0x377a6e];return _0x37f751;};'use strict';var _=require('lodash');var util=require(_0xebd0('0x0'));var moment=require('moment');var BPromise=require(_0xebd0('0x1'));var rs=require(_0xebd0('0x2'));var fs=require('fs');var Redis=require(_0xebd0('0x3'));var db=require(_0xebd0('0x4'))['db'];var utils=require(_0xebd0('0x5'));var logger=require(_0xebd0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xebd0('0x7'));var client=jayson[_0xebd0('0x8')][_0xebd0('0x9')]({'port':0x232a});config[_0xebd0('0xa')]=_[_0xebd0('0xb')](config[_0xebd0('0xa')],{'host':_0xebd0('0xc'),'port':0x18eb});var socket=require(_0xebd0('0xd'))(new Redis(config[_0xebd0('0xa')]));require('./chatMessage.socket')[_0xebd0('0xe')](socket);function respondWithRpcPromise(_0x474bef,_0x2dbee9,_0x54b2a1){return new BPromise(function(_0xbec226,_0x1346d1){return client['request'](_0x474bef,_0x54b2a1)['then'](function(_0xb15b3e){logger[_0xebd0('0xf')](_0xebd0('0x10'),_0x2dbee9,_0xebd0('0x11'));logger[_0xebd0('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2dbee9,_0xebd0('0x11'),JSON[_0xebd0('0x13')](_0xb15b3e));if(_0xb15b3e[_0xebd0('0x14')]){if(_0xb15b3e['error'][_0xebd0('0x15')]===0x1f4){logger[_0xebd0('0x14')](_0xebd0('0x10'),_0x2dbee9,_0xb15b3e[_0xebd0('0x14')][_0xebd0('0x16')]);return _0x1346d1(_0xb15b3e[_0xebd0('0x14')][_0xebd0('0x16')]);}logger[_0xebd0('0x14')](_0xebd0('0x10'),_0x2dbee9,_0xb15b3e[_0xebd0('0x14')][_0xebd0('0x16')]);return _0xbec226(_0xb15b3e[_0xebd0('0x14')][_0xebd0('0x16')]);}else{logger[_0xebd0('0xf')](_0xebd0('0x10'),_0x2dbee9,'request\x20sent');_0xbec226(_0xb15b3e[_0xebd0('0x17')][_0xebd0('0x16')]);}})[_0xebd0('0x18')](function(_0x2834ad){logger['error'](_0xebd0('0x10'),_0x2dbee9,_0x2834ad);_0x1346d1(_0x2834ad);});});}exports[_0xebd0('0x19')]=function(_0x51774c){var _0x22bb7f=this;return new Promise(function(_0x4ef17f,_0x4720d5){return db[_0xebd0('0x1a')][_0xebd0('0x1b')](_0x51774c[_0xebd0('0x1c')],{'raw':_0x51774c['options']?_0x51774c[_0xebd0('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xebd0('0x1e')](function(_0x2d2639){logger[_0xebd0('0xf')]('CreateChatMessage',_0x51774c);logger[_0xebd0('0x12')](_0xebd0('0x19'),_0x51774c,JSON[_0xebd0('0x13')](_0x2d2639));_0x4ef17f(_0x2d2639);})['catch'](function(_0x3f08a8){logger[_0xebd0('0x14')](_0xebd0('0x19'),_0x3f08a8[_0xebd0('0x16')],_0x51774c);_0x4720d5(_0x22bb7f['error'](0x1f4,_0x3f08a8['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 447d121..33226fc 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 _0xe0c3=['removeListener','length','chatMessage:','./chatMessage.events','remove','update','emit'];(function(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0xe0c3,0xea));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var ChatMessageEvents=require(_0x3e0c('0x0'));var events=['save',_0x3e0c('0x1'),_0x3e0c('0x2')];function createListener(_0x3bb243,_0x41c0bf){return function(_0x27e01a){_0x41c0bf[_0x3e0c('0x3')](_0x3bb243,_0x27e01a);};}function removeListener(_0x31851c,_0x26c964){return function(){ChatMessageEvents[_0x3e0c('0x4')](_0x31851c,_0x26c964);};}exports['register']=function(_0x530ebf){for(var _0x163adf=0x0,_0x1e339a=events[_0x3e0c('0x5')];_0x163adf<_0x1e339a;_0x163adf++){var _0x243b5b=events[_0x163adf];var _0x29673d=createListener(_0x3e0c('0x6')+_0x243b5b,_0x530ebf);ChatMessageEvents['on'](_0x243b5b,_0x29673d);}}; \ No newline at end of file +var _0x4300=['length','chatMessage:','./chatMessage.events','emit','register'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0x4300,0x1a6));var _0x0430=function(_0x4baf9a,_0x5e9544){_0x4baf9a=_0x4baf9a-0x0;var _0xd18049=_0x4300[_0x4baf9a];return _0xd18049;};'use strict';var ChatMessageEvents=require(_0x0430('0x0'));var events=['save','remove','update'];function createListener(_0x54a4da,_0x4388ad){return function(_0x1d10be){_0x4388ad[_0x0430('0x1')](_0x54a4da,_0x1d10be);};}function removeListener(_0x2a1e62,_0x1735aa){return function(){ChatMessageEvents['removeListener'](_0x2a1e62,_0x1735aa);};}exports[_0x0430('0x2')]=function(_0x5943c0){for(var _0x16efe3=0x0,_0x5b03ef=events[_0x0430('0x3')];_0x16efe3<_0x5b03ef;_0x16efe3++){var _0xc83312=events[_0x16efe3];var _0x408b14=createListener(_0x0430('0x4')+_0xc83312,_0x5943c0);ChatMessageEvents['on'](_0xc83312,_0x408b14);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index c26fb4d..7dced23 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 _0x5f0e=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','show','post','isAuthenticated','tracked','chat','create','put','update','/:id/accept','/:id/reject','reject','delete','/:id','exports','util'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0x5f0e,0x11f));var _0xe5f0=function(_0x17108e,_0x107c35){_0x17108e=_0x17108e-0x0;var _0x4137fd=_0x5f0e[_0x17108e];return _0x4137fd;};'use strict';var multer=require('multer');var util=require(_0xe5f0('0x0'));var path=require(_0xe5f0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe5f0('0x2'));var router=express[_0xe5f0('0x3')]();var fs_extra=require(_0xe5f0('0x4'));var auth=require(_0xe5f0('0x5'));var interaction=require(_0xe5f0('0x6'));var config=require(_0xe5f0('0x7'));var controller=require(_0xe5f0('0x8'));router[_0xe5f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe5f0('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xe5f0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe5f0('0xa')]);router[_0xe5f0('0xb')]('/',auth[_0xe5f0('0xc')](),interaction[_0xe5f0('0xd')](_0xe5f0('0xe'),'chatmessage:create'),controller[_0xe5f0('0xf')]);router[_0xe5f0('0x10')]('/:id',controller[_0xe5f0('0x11')]);router[_0xe5f0('0x10')](_0xe5f0('0x12'),auth['isAuthenticated'](),controller['accept']);router[_0xe5f0('0x10')](_0xe5f0('0x13'),auth[_0xe5f0('0xc')](),controller[_0xe5f0('0x14')]);router[_0xe5f0('0x15')](_0xe5f0('0x16'),auth[_0xe5f0('0xc')](),controller['destroy']);module[_0xe5f0('0x17')]=router; \ No newline at end of file +var _0x604b=['/describe','describe','show','post','chat','chatmessage:create','create','/:id','update','put','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./chatMessage.controller','get','isAuthenticated','index'];(function(_0x3da9d2,_0x30dbac){var _0x29c883=function(_0x4912a5){while(--_0x4912a5){_0x3da9d2['push'](_0x3da9d2['shift']());}};_0x29c883(++_0x30dbac);}(_0x604b,0xd7));var _0xb604=function(_0x37b3aa,_0x46ae34){_0x37b3aa=_0x37b3aa-0x0;var _0x1a0213=_0x604b[_0x37b3aa];return _0x1a0213;};'use strict';var multer=require(_0xb604('0x0'));var util=require(_0xb604('0x1'));var path=require(_0xb604('0x2'));var timeout=require(_0xb604('0x3'));var express=require(_0xb604('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb604('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb604('0x6'));router[_0xb604('0x7')]('/',auth[_0xb604('0x8')](),controller[_0xb604('0x9')]);router[_0xb604('0x7')](_0xb604('0xa'),auth[_0xb604('0x8')](),controller[_0xb604('0xb')]);router['get']('/:id',auth[_0xb604('0x8')](),controller[_0xb604('0xc')]);router[_0xb604('0xd')]('/',auth[_0xb604('0x8')](),interaction['tracked'](_0xb604('0xe'),_0xb604('0xf')),controller[_0xb604('0x10')]);router['put'](_0xb604('0x11'),controller[_0xb604('0x12')]);router[_0xb604('0x13')]('/:id/accept',auth[_0xb604('0x8')](),controller[_0xb604('0x14')]);router[_0xb604('0x13')](_0xb604('0x15'),auth['isAuthenticated'](),controller['reject']);router[_0xb604('0x16')]('/:id',auth[_0xb604('0x8')](),controller[_0xb604('0x17')]);module[_0xb604('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 868babe..b1401ff 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 _0x3075=['medium','exports','TEXT'];(function(_0x541696,_0x1ce78f){var _0x20886f=function(_0x350f62){while(--_0x350f62){_0x541696['push'](_0x541696['shift']());}};_0x20886f(++_0x1ce78f);}(_0x3075,0xc1));var _0x5307=function(_0x7a10a,_0x4aff91){_0x7a10a=_0x7a10a-0x0;var _0xf3b068=_0x3075[_0x7a10a];return _0xf3b068;};'use strict';var Sequelize=require('sequelize');module[_0x5307('0x0')]={'body':{'type':Sequelize[_0x5307('0x1')](_0x5307('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x5e56=['sequelize','exports'];(function(_0x577df8,_0x17c569){var _0x382059=function(_0x5b87f4){while(--_0x5b87f4){_0x577df8['push'](_0x577df8['shift']());}};_0x382059(++_0x17c569);}(_0x5e56,0x8e));var _0x65e5=function(_0x1370dd,_0x4b2eef){_0x1370dd=_0x1370dd-0x0;var _0x1623ab=_0x5e56[_0x1370dd];return _0x1623ab;};'use strict';var Sequelize=require(_0x65e5('0x0'));module[_0x65e5('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 30a47d6..b973d7f 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x252f34,_0xde255c){var _0x463bf9=function(_0x1f2320){while(--_0x1f2320){_0x252f34['push'](_0x252f34['shift']());}};_0x463bf9(++_0xde255c);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _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(_0xccf736,_0x2ac11b){var _0x58535b=function(_0xa28470){while(--_0xa28470){_0xccf736['push'](_0xccf736['shift']());}};_0x58535b(++_0x2ac11b);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index e14777b..cd9ce92 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 _0x6ec8=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x6ec8,0x13c));var _0x86ec=function(_0x46ab1c,_0x46e561){_0x46ab1c=_0x46ab1c-0x0;var _0x3fb929=_0x6ec8[_0x46ab1c];return _0x3fb929;};'use strict';var _=require(_0x86ec('0x0'));var util=require('util');var logger=require(_0x86ec('0x1'))(_0x86ec('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86ec('0x3'));var fs=require('fs');var path=require(_0x86ec('0x4'));var rimraf=require('rimraf');var config=require(_0x86ec('0x5'));var attributes=require(_0x86ec('0x6'));module[_0x86ec('0x7')]=function(_0x19636f,_0x12019a){return _0x19636f[_0x86ec('0x8')](_0x86ec('0x9'),attributes,{'tableName':_0x86ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x86ec('0xb')});}; \ No newline at end of file +var _0x032c=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x032c,0xc6));var _0xc032=function(_0x4e3ee7,_0x3c3838){_0x4e3ee7=_0x4e3ee7-0x0;var _0x406876=_0x032c[_0x4e3ee7];return _0x406876;};'use strict';var _=require(_0xc032('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc032('0x1'));var moment=require(_0xc032('0x2'));var BPromise=require('bluebird');var rp=require(_0xc032('0x3'));var fs=require('fs');var path=require(_0xc032('0x4'));var rimraf=require(_0xc032('0x5'));var config=require(_0xc032('0x6'));var attributes=require(_0xc032('0x7'));module[_0xc032('0x8')]=function(_0x2d6173,_0x2cf821){return _0x2d6173[_0xc032('0x9')]('ChatOfflineMessage',attributes,{'tableName':_0xc032('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc032('0xb'),'collate':_0xc032('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index dc7cf79..5b813bb 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 _0x6dac=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6dac,0x16e));var _0xc6da=function(_0x2f50a5,_0x484391){_0x2f50a5=_0x2f50a5-0x0;var _0x44d716=_0x6dac[_0x2f50a5];return _0x44d716;};'use strict';var _=require(_0xc6da('0x0'));var util=require(_0xc6da('0x1'));var moment=require(_0xc6da('0x2'));var BPromise=require(_0xc6da('0x3'));var rs=require(_0xc6da('0x4'));var fs=require('fs');var Redis=require(_0xc6da('0x5'));var db=require(_0xc6da('0x6'))['db'];var utils=require(_0xc6da('0x7'));var logger=require(_0xc6da('0x8'))(_0xc6da('0x9'));var config=require(_0xc6da('0xa'));var jayson=require(_0xc6da('0xb'));var client=jayson[_0xc6da('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ebd11,_0x1abd90,_0x5a0d8d){return new BPromise(function(_0x3047d3,_0x2bfaa6){return client[_0xc6da('0xd')](_0x1ebd11,_0x5a0d8d)[_0xc6da('0xe')](function(_0x39a8d8){logger[_0xc6da('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1abd90,_0xc6da('0x10'));logger[_0xc6da('0x11')](_0xc6da('0x12'),_0x1abd90,_0xc6da('0x10'),JSON[_0xc6da('0x13')](_0x39a8d8));if(_0x39a8d8[_0xc6da('0x14')]){if(_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x15')]===0x1f4){logger[_0xc6da('0x14')](_0xc6da('0x16'),_0x1abd90,_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x17')]);return _0x2bfaa6(_0x39a8d8[_0xc6da('0x14')]['message']);}logger[_0xc6da('0x14')](_0xc6da('0x16'),_0x1abd90,_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x17')]);return _0x3047d3(_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x17')]);}else{logger['info'](_0xc6da('0x16'),_0x1abd90,_0xc6da('0x10'));_0x3047d3(_0x39a8d8[_0xc6da('0x18')][_0xc6da('0x17')]);}})[_0xc6da('0x19')](function(_0x5463a1){logger[_0xc6da('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1abd90,_0x5463a1);_0x2bfaa6(_0x5463a1);});});} \ No newline at end of file +var _0x9a14=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x9a14,0xa8));var _0x49a1=function(_0x1e7e57,_0x36aa7a){_0x1e7e57=_0x1e7e57-0x0;var _0x76779e=_0x9a14[_0x1e7e57];return _0x76779e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49a1('0x0'));var BPromise=require(_0x49a1('0x1'));var rs=require(_0x49a1('0x2'));var fs=require('fs');var Redis=require(_0x49a1('0x3'));var db=require(_0x49a1('0x4'))['db'];var utils=require(_0x49a1('0x5'));var logger=require(_0x49a1('0x6'))(_0x49a1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9394fc,_0x2b210c,_0x7ef1ba){return new BPromise(function(_0x592940,_0x6c66e){return client[_0x49a1('0x8')](_0x9394fc,_0x7ef1ba)[_0x49a1('0x9')](function(_0x5445eb){logger[_0x49a1('0xa')](_0x49a1('0xb'),_0x2b210c,'request\x20sent');logger[_0x49a1('0xc')](_0x49a1('0xd'),_0x2b210c,_0x49a1('0xe'),JSON[_0x49a1('0xf')](_0x5445eb));if(_0x5445eb[_0x49a1('0x10')]){if(_0x5445eb['error'][_0x49a1('0x11')]===0x1f4){logger[_0x49a1('0x10')](_0x49a1('0xb'),_0x2b210c,_0x5445eb[_0x49a1('0x10')][_0x49a1('0x12')]);return _0x6c66e(_0x5445eb[_0x49a1('0x10')][_0x49a1('0x12')]);}logger[_0x49a1('0x10')](_0x49a1('0xb'),_0x2b210c,_0x5445eb[_0x49a1('0x10')][_0x49a1('0x12')]);return _0x592940(_0x5445eb[_0x49a1('0x10')][_0x49a1('0x12')]);}else{logger[_0x49a1('0xa')](_0x49a1('0xb'),_0x2b210c,'request\x20sent');_0x592940(_0x5445eb[_0x49a1('0x13')][_0x49a1('0x12')]);}})[_0x49a1('0x14')](function(_0x479ceb){logger[_0x49a1('0x10')](_0x49a1('0xb'),_0x2b210c,_0x479ceb);_0x6c66e(_0x479ceb);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 6f76876..6bfbb6e 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 _0xa251=['exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','/describe','describe','get','show','create','put','/:id','delete','destroy'];(function(_0x453b25,_0xe3ff7f){var _0x158392=function(_0x35c8fb){while(--_0x35c8fb){_0x453b25['push'](_0x453b25['shift']());}};_0x158392(++_0xe3ff7f);}(_0xa251,0x1c3));var _0x1a25=function(_0x5addf7,_0x50785e){_0x5addf7=_0x5addf7-0x0;var _0xb0746a=_0xa251[_0x5addf7];return _0xb0746a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1a25('0x0'));var timeout=require('connect-timeout');var express=require(_0x1a25('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1a25('0x2'));var interaction=require(_0x1a25('0x3'));var config=require(_0x1a25('0x4'));var controller=require(_0x1a25('0x5'));router['get']('/',auth[_0x1a25('0x6')](),controller[_0x1a25('0x7')]);router['get'](_0x1a25('0x8'),auth['isAuthenticated'](),controller[_0x1a25('0x9')]);router[_0x1a25('0xa')]('/:id',auth[_0x1a25('0x6')](),controller[_0x1a25('0xb')]);router['post']('/',auth[_0x1a25('0x6')](),controller[_0x1a25('0xc')]);router[_0x1a25('0xd')](_0x1a25('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1a25('0xf')](_0x1a25('0xe'),auth['isAuthenticated'](),controller[_0x1a25('0x10')]);module[_0x1a25('0x11')]=router; \ No newline at end of file +var _0xce87=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','describe','show','post','create','put','update','delete','/:id','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xce87,0x19e));var _0x7ce8=function(_0x240039,_0x30397b){_0x240039=_0x240039-0x0;var _0x55458=_0xce87[_0x240039];return _0x55458;};'use strict';var multer=require('multer');var util=require(_0x7ce8('0x0'));var path=require(_0x7ce8('0x1'));var timeout=require(_0x7ce8('0x2'));var express=require(_0x7ce8('0x3'));var router=express[_0x7ce8('0x4')]();var fs_extra=require(_0x7ce8('0x5'));var auth=require(_0x7ce8('0x6'));var interaction=require(_0x7ce8('0x7'));var config=require(_0x7ce8('0x8'));var controller=require(_0x7ce8('0x9'));router['get']('/',auth[_0x7ce8('0xa')](),controller['index']);router[_0x7ce8('0xb')](_0x7ce8('0xc'),auth[_0x7ce8('0xa')](),controller[_0x7ce8('0xd')]);router[_0x7ce8('0xb')]('/:id',auth[_0x7ce8('0xa')](),controller[_0x7ce8('0xe')]);router[_0x7ce8('0xf')]('/',auth[_0x7ce8('0xa')](),controller[_0x7ce8('0x10')]);router[_0x7ce8('0x11')]('/:id',auth[_0x7ce8('0xa')](),controller[_0x7ce8('0x12')]);router[_0x7ce8('0x13')](_0x7ce8('0x14'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 73ff1ac..531bb4f 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 _0x2245=['sequelize','exports','STRING','mouseOver','timeout'];(function(_0x50063a,_0x4ac3ee){var _0x1172ac=function(_0x29982f){while(--_0x29982f){_0x50063a['push'](_0x50063a['shift']());}};_0x1172ac(++_0x4ac3ee);}(_0x2245,0x1f4));var _0x5224=function(_0x23417d,_0x4e0b5c){_0x23417d=_0x23417d-0x0;var _0x4d42f1=_0x2245[_0x23417d];return _0x4d42f1;};'use strict';var Sequelize=require(_0x5224('0x0'));module[_0x5224('0x1')]={'name':{'type':Sequelize[_0x5224('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5224('0x3'),_0x5224('0x4')),'defaultValue':_0x5224('0x3')},'selector':{'type':Sequelize[_0x5224('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa8fb=['sequelize','exports','STRING','ENUM','mouseOver'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa8fb,0x1a9));var _0xba8f=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xa8fb[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require(_0xba8f('0x0'));module[_0xba8f('0x1')]={'name':{'type':Sequelize[_0xba8f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xba8f('0x3')](_0xba8f('0x4'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xba8f('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 5c47e61..16b1118 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 _0xb91a=['find','catch','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','includeAll','merge','options'];(function(_0x290b7a,_0x179f9a){var _0x122090=function(_0x557f30){while(--_0x557f30){_0x290b7a['push'](_0x290b7a['shift']());}};_0x122090(++_0x179f9a);}(_0xb91a,0xf4));var _0xab91=function(_0x4b21ab,_0x5f59d6){_0x4b21ab=_0x4b21ab-0x0;var _0x5a60b6=_0xb91a[_0x4b21ab];return _0x5a60b6;};'use strict';var emlformat=require(_0xab91('0x0'));var rimraf=require(_0xab91('0x1'));var zipdir=require(_0xab91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xab91('0x3'));var BPromise=require(_0xab91('0x4'));var Mustache=require(_0xab91('0x5'));var util=require(_0xab91('0x6'));var path=require(_0xab91('0x7'));var sox=require(_0xab91('0x8'));var csv=require(_0xab91('0x9'));var ejs=require(_0xab91('0xa'));var fs=require('fs');var fs_extra=require(_0xab91('0xb'));var _=require(_0xab91('0xc'));var squel=require('squel');var crypto=require(_0xab91('0xd'));var jsforce=require(_0xab91('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xab91('0xf'));var Redis=require(_0xab91('0x10'));var authService=require(_0xab91('0x11'));var qs=require(_0xab91('0x12'));var as=require(_0xab91('0x13'));var hardwareService=require(_0xab91('0x14'));var logger=require(_0xab91('0x15'))(_0xab91('0x16'));var utils=require(_0xab91('0x17'));var config=require(_0xab91('0x18'));var licenseUtil=require(_0xab91('0x19'));var db=require(_0xab91('0x1a'))['db'];function respondWithStatusCode(_0x283c91,_0x542d3f){_0x542d3f=_0x542d3f||0xcc;return function(_0x4f2af6){if(_0x4f2af6){return _0x283c91[_0xab91('0x1b')](_0x542d3f);}return _0x283c91[_0xab91('0x1c')](_0x542d3f)[_0xab91('0x1d')]();};}function respondWithResult(_0x14bded,_0x14b304){_0x14b304=_0x14b304||0xc8;return function(_0xaa6e77){if(_0xaa6e77){return _0x14bded['status'](_0x14b304)['json'](_0xaa6e77);}};}function respondWithFilteredResult(_0x3c102a,_0x3565c0){return function(_0x1b0d61){if(_0x1b0d61){var _0x2d2699=typeof _0x3565c0[_0xab91('0x1e')]===_0xab91('0x1f')&&typeof _0x3565c0[_0xab91('0x20')]===_0xab91('0x1f');var _0x499daf=_0x1b0d61['count'];var _0x1a0b66=_0x2d2699?0x0:_0x3565c0['offset'];var _0x609b8c=_0x2d2699?_0x1b0d61[_0xab91('0x21')]:_0x3565c0[_0xab91('0x1e')]+_0x3565c0['limit'];var _0xe80258;if(_0x609b8c>=_0x499daf){_0x609b8c=_0x499daf;_0xe80258=0xc8;}else{_0xe80258=0xce;}_0x3c102a['status'](_0xe80258);return _0x3c102a[_0xab91('0x22')]('Content-Range',_0x1a0b66+'-'+_0x609b8c+'/'+_0x499daf)['json'](_0x1b0d61);}return null;};}function patchUpdates(_0x13f065){return function(_0x4c5595){try{jsonpatch[_0xab91('0x23')](_0x4c5595,_0x13f065,!![]);}catch(_0x1f5def){return BPromise[_0xab91('0x24')](_0x1f5def);}return _0x4c5595['save']();};}function saveUpdates(_0x49f4d5,_0x40d29a){return function(_0xdedffe){if(_0xdedffe){return _0xdedffe[_0xab91('0x25')](_0x49f4d5)[_0xab91('0x26')](function(_0x1518e4){return _0x1518e4;});}return null;};}function removeEntity(_0xf8db06,_0x57a7e9){return function(_0x5eca53){if(_0x5eca53){return _0x5eca53[_0xab91('0x27')]()['then'](function(){_0xf8db06['status'](0xcc)[_0xab91('0x1d')]();});}};}function handleEntityNotFound(_0x1a0bc2,_0x5586cd){return function(_0x425d39){if(!_0x425d39){_0x1a0bc2['sendStatus'](0x194);}return _0x425d39;};}function handleError(_0x3fe2fc,_0x400134){_0x400134=_0x400134||0x1f4;return function(_0x5a3c05){logger[_0xab91('0x28')](_0x5a3c05[_0xab91('0x29')]);if(_0x5a3c05[_0xab91('0x2a')]){delete _0x5a3c05[_0xab91('0x2a')];}_0x3fe2fc[_0xab91('0x1c')](_0x400134)[_0xab91('0x2b')](_0x5a3c05);};}exports['show']=function(_0x281ede,_0x4c7a87){var _0x152c51={'raw':!![],'where':{'id':_0x281ede[_0xab91('0x2c')]['id']}},_0x197d0c={};_0x197d0c[_0xab91('0x2d')]=_[_0xab91('0x2e')](db[_0xab91('0x2f')]['rawAttributes']);_0x197d0c[_0xab91('0x30')]=_[_0xab91('0x2e')](_0x281ede[_0xab91('0x30')]);_0x197d0c[_0xab91('0x31')]=_[_0xab91('0x32')](_0x197d0c[_0xab91('0x2d')],_0x197d0c['query']);_0x152c51[_0xab91('0x33')]=_[_0xab91('0x32')](_0x197d0c[_0xab91('0x2d')],qs[_0xab91('0x34')](_0x281ede['query'][_0xab91('0x34')]));_0x152c51[_0xab91('0x33')]=_0x152c51[_0xab91('0x33')]['length']?_0x152c51[_0xab91('0x33')]:_0x197d0c['model'];if(_0x281ede[_0xab91('0x30')][_0xab91('0x35')]){_0x152c51['include']=[{'all':!![]}];}_0x152c51=_[_0xab91('0x36')]({},_0x152c51,_0x281ede[_0xab91('0x37')]);return db[_0xab91('0x2f')][_0xab91('0x38')](_0x152c51)[_0xab91('0x26')](handleEntityNotFound(_0x4c7a87,null))[_0xab91('0x26')](respondWithResult(_0x4c7a87,null))[_0xab91('0x39')](handleError(_0x4c7a87,null));};exports['create']=function(_0x584702,_0x17e5bd){return db[_0xab91('0x2f')][_0xab91('0x3a')](_0x584702[_0xab91('0x3b')],{})[_0xab91('0x26')](respondWithResult(_0x17e5bd,0xc9))[_0xab91('0x39')](handleError(_0x17e5bd,null));};exports[_0xab91('0x25')]=function(_0x6ad869,_0x4787f0){if(_0x6ad869[_0xab91('0x3b')]['id']){delete _0x6ad869[_0xab91('0x3b')]['id'];}return db['ChatProactiveAction'][_0xab91('0x38')]({'where':{'id':_0x6ad869['params']['id']}})[_0xab91('0x26')](handleEntityNotFound(_0x4787f0,null))[_0xab91('0x26')](saveUpdates(_0x6ad869[_0xab91('0x3b')],null))[_0xab91('0x26')](respondWithResult(_0x4787f0,null))['catch'](handleError(_0x4787f0,null));};exports['destroy']=function(_0x4de946,_0x427f27){return db[_0xab91('0x2f')]['find']({'where':{'id':_0x4de946[_0xab91('0x2c')]['id']}})[_0xab91('0x26')](handleEntityNotFound(_0x427f27,null))[_0xab91('0x26')](removeEntity(_0x427f27,null))[_0xab91('0x39')](handleError(_0x427f27,null));}; \ No newline at end of file +var _0x5577=['mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','stack','name','send','params','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','eml-format','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0x5577,0x1b4));var _0x7557=function(_0x2cd3d8,_0x5ddfb0){_0x2cd3d8=_0x2cd3d8-0x0;var _0x1ee6e1=_0x5577[_0x2cd3d8];return _0x1ee6e1;};'use strict';var emlformat=require(_0x7557('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7557('0x1'));var jsonpatch=require(_0x7557('0x2'));var rp=require('request-promise');var moment=require(_0x7557('0x3'));var BPromise=require(_0x7557('0x4'));var Mustache=require(_0x7557('0x5'));var util=require(_0x7557('0x6'));var path=require(_0x7557('0x7'));var sox=require(_0x7557('0x8'));var csv=require('to-csv');var ejs=require(_0x7557('0x9'));var fs=require('fs');var fs_extra=require(_0x7557('0xa'));var _=require(_0x7557('0xb'));var squel=require(_0x7557('0xc'));var crypto=require(_0x7557('0xd'));var jsforce=require(_0x7557('0xe'));var deskjs=require(_0x7557('0xf'));var toCsv=require(_0x7557('0x10'));var querystring=require(_0x7557('0x11'));var Papa=require(_0x7557('0x12'));var Redis=require(_0x7557('0x13'));var authService=require(_0x7557('0x14'));var qs=require(_0x7557('0x15'));var as=require(_0x7557('0x16'));var hardwareService=require(_0x7557('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x7557('0x18'));var config=require(_0x7557('0x19'));var licenseUtil=require(_0x7557('0x1a'));var db=require(_0x7557('0x1b'))['db'];function respondWithStatusCode(_0xb6ed30,_0x467ac5){_0x467ac5=_0x467ac5||0xcc;return function(_0x156ac1){if(_0x156ac1){return _0xb6ed30[_0x7557('0x1c')](_0x467ac5);}return _0xb6ed30[_0x7557('0x1d')](_0x467ac5)[_0x7557('0x1e')]();};}function respondWithResult(_0x5468df,_0x276031){_0x276031=_0x276031||0xc8;return function(_0x3fb7a6){if(_0x3fb7a6){return _0x5468df[_0x7557('0x1d')](_0x276031)['json'](_0x3fb7a6);}};}function respondWithFilteredResult(_0x3ad3a1,_0x3c3953){return function(_0x33098f){if(_0x33098f){var _0x325849=typeof _0x3c3953['offset']===_0x7557('0x1f')&&typeof _0x3c3953[_0x7557('0x20')]==='undefined';var _0x4a9cae=_0x33098f[_0x7557('0x21')];var _0x11f186=_0x325849?0x0:_0x3c3953[_0x7557('0x22')];var _0x40a81b=_0x325849?_0x33098f['count']:_0x3c3953[_0x7557('0x22')]+_0x3c3953['limit'];var _0x3e2972;if(_0x40a81b>=_0x4a9cae){_0x40a81b=_0x4a9cae;_0x3e2972=0xc8;}else{_0x3e2972=0xce;}_0x3ad3a1[_0x7557('0x1d')](_0x3e2972);return _0x3ad3a1[_0x7557('0x23')](_0x7557('0x24'),_0x11f186+'-'+_0x40a81b+'/'+_0x4a9cae)['json'](_0x33098f);}return null;};}function patchUpdates(_0x1b60a9){return function(_0x3180cd){try{jsonpatch[_0x7557('0x25')](_0x3180cd,_0x1b60a9,!![]);}catch(_0x34bed5){return BPromise[_0x7557('0x26')](_0x34bed5);}return _0x3180cd['save']();};}function saveUpdates(_0x502e49,_0x4eb212){return function(_0x211fbe){if(_0x211fbe){return _0x211fbe['update'](_0x502e49)[_0x7557('0x27')](function(_0x352b63){return _0x352b63;});}return null;};}function removeEntity(_0x1e97d3,_0x9bbcf6){return function(_0x1533b2){if(_0x1533b2){return _0x1533b2[_0x7557('0x28')]()[_0x7557('0x27')](function(){_0x1e97d3['status'](0xcc)[_0x7557('0x1e')]();});}};}function handleEntityNotFound(_0x5bc953,_0x3daeac){return function(_0x5b2c6a){if(!_0x5b2c6a){_0x5bc953[_0x7557('0x1c')](0x194);}return _0x5b2c6a;};}function handleError(_0x3aa642,_0x4758b9){_0x4758b9=_0x4758b9||0x1f4;return function(_0x42ae94){logger['error'](_0x42ae94[_0x7557('0x29')]);if(_0x42ae94['name']){delete _0x42ae94[_0x7557('0x2a')];}_0x3aa642[_0x7557('0x1d')](_0x4758b9)[_0x7557('0x2b')](_0x42ae94);};}exports['show']=function(_0x3b36eb,_0x2b4ca8){var _0x1c6df9={'raw':!![],'where':{'id':_0x3b36eb[_0x7557('0x2c')]['id']}},_0x1c4649={};_0x1c4649[_0x7557('0x2d')]=_['keys'](db[_0x7557('0x2e')][_0x7557('0x2f')]);_0x1c4649[_0x7557('0x30')]=_[_0x7557('0x31')](_0x3b36eb['query']);_0x1c4649[_0x7557('0x32')]=_[_0x7557('0x33')](_0x1c4649[_0x7557('0x2d')],_0x1c4649[_0x7557('0x30')]);_0x1c6df9[_0x7557('0x34')]=_[_0x7557('0x33')](_0x1c4649[_0x7557('0x2d')],qs[_0x7557('0x35')](_0x3b36eb[_0x7557('0x30')][_0x7557('0x35')]));_0x1c6df9[_0x7557('0x34')]=_0x1c6df9[_0x7557('0x34')][_0x7557('0x36')]?_0x1c6df9[_0x7557('0x34')]:_0x1c4649[_0x7557('0x2d')];if(_0x3b36eb[_0x7557('0x30')][_0x7557('0x37')]){_0x1c6df9[_0x7557('0x38')]=[{'all':!![]}];}_0x1c6df9=_[_0x7557('0x39')]({},_0x1c6df9,_0x3b36eb[_0x7557('0x3a')]);return db[_0x7557('0x2e')][_0x7557('0x3b')](_0x1c6df9)['then'](handleEntityNotFound(_0x2b4ca8,null))[_0x7557('0x27')](respondWithResult(_0x2b4ca8,null))['catch'](handleError(_0x2b4ca8,null));};exports['create']=function(_0x363457,_0x5d3ef6){return db[_0x7557('0x2e')]['create'](_0x363457['body'],{})[_0x7557('0x27')](respondWithResult(_0x5d3ef6,0xc9))[_0x7557('0x3c')](handleError(_0x5d3ef6,null));};exports[_0x7557('0x3d')]=function(_0x52b29f,_0xfd1144){if(_0x52b29f[_0x7557('0x3e')]['id']){delete _0x52b29f[_0x7557('0x3e')]['id'];}return db[_0x7557('0x2e')][_0x7557('0x3b')]({'where':{'id':_0x52b29f[_0x7557('0x2c')]['id']}})[_0x7557('0x27')](handleEntityNotFound(_0xfd1144,null))[_0x7557('0x27')](saveUpdates(_0x52b29f['body'],null))['then'](respondWithResult(_0xfd1144,null))['catch'](handleError(_0xfd1144,null));};exports['destroy']=function(_0x5e0206,_0x4f3c68){return db[_0x7557('0x2e')][_0x7557('0x3b')]({'where':{'id':_0x5e0206[_0x7557('0x2c')]['id']}})[_0x7557('0x27')](handleEntityNotFound(_0x4f3c68,null))['then'](removeEntity(_0x4f3c68,null))['catch'](handleError(_0x4f3c68,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 2e2e91b..38cc50a 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 _0x8d02=['chat_proactive_actions','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','define','ChatProactiveAction'];(function(_0x5e3124,_0x3555db){var _0x76d2bf=function(_0x2ba1c0){while(--_0x2ba1c0){_0x5e3124['push'](_0x5e3124['shift']());}};_0x76d2bf(++_0x3555db);}(_0x8d02,0x173));var _0x28d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8d02[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x28d0('0x0'))('api');var moment=require(_0x28d0('0x1'));var BPromise=require(_0x28d0('0x2'));var rp=require(_0x28d0('0x3'));var fs=require('fs');var path=require(_0x28d0('0x4'));var rimraf=require('rimraf');var config=require(_0x28d0('0x5'));var attributes=require(_0x28d0('0x6'));module['exports']=function(_0x14a4db,_0x4bfbdb){return _0x14a4db[_0x28d0('0x7')](_0x28d0('0x8'),attributes,{'tableName':_0x28d0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77f6=['request-promise','path','../../config/environment','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','moment','bluebird'];(function(_0x45d4bb,_0x1b381e){var _0x2a7b99=function(_0x3ba4b5){while(--_0x3ba4b5){_0x45d4bb['push'](_0x45d4bb['shift']());}};_0x2a7b99(++_0x1b381e);}(_0x77f6,0x15b));var _0x677f=function(_0x272b9d,_0x248267){_0x272b9d=_0x272b9d-0x0;var _0x341e80=_0x77f6[_0x272b9d];return _0x341e80;};'use strict';var _=require(_0x677f('0x0'));var util=require('util');var logger=require(_0x677f('0x1'))('api');var moment=require(_0x677f('0x2'));var BPromise=require(_0x677f('0x3'));var rp=require(_0x677f('0x4'));var fs=require('fs');var path=require(_0x677f('0x5'));var rimraf=require('rimraf');var config=require(_0x677f('0x6'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0xefcbe4,_0x13307a){return _0xefcbe4['define'](_0x677f('0x7'),attributes,{'tableName':_0x677f('0x8'),'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 6a2b753..f98b9f0 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 _0x3f72=['../../config/environment','jayson/promise','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x3f72,0x123));var _0x23f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f72[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x23f7('0x0'));var util=require(_0x23f7('0x1'));var moment=require('moment');var BPromise=require(_0x23f7('0x2'));var rs=require(_0x23f7('0x3'));var fs=require('fs');var Redis=require(_0x23f7('0x4'));var db=require(_0x23f7('0x5'))['db'];var utils=require(_0x23f7('0x6'));var logger=require(_0x23f7('0x7'))('rpc');var config=require(_0x23f7('0x8'));var jayson=require(_0x23f7('0x9'));var client=jayson['client'][_0x23f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7d72c4,_0x21e7ee,_0x19ac03){return new BPromise(function(_0x4d122e,_0x46319c){return client[_0x23f7('0xb')](_0x7d72c4,_0x19ac03)[_0x23f7('0xc')](function(_0xe261b9){logger[_0x23f7('0xd')](_0x23f7('0xe'),_0x21e7ee,'request\x20sent');logger['debug'](_0x23f7('0xf'),_0x21e7ee,_0x23f7('0x10'),JSON[_0x23f7('0x11')](_0xe261b9));if(_0xe261b9[_0x23f7('0x12')]){if(_0xe261b9[_0x23f7('0x12')][_0x23f7('0x13')]===0x1f4){logger[_0x23f7('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x21e7ee,_0xe261b9[_0x23f7('0x12')][_0x23f7('0x14')]);return _0x46319c(_0xe261b9[_0x23f7('0x12')][_0x23f7('0x14')]);}logger[_0x23f7('0x12')](_0x23f7('0xe'),_0x21e7ee,_0xe261b9['error'][_0x23f7('0x14')]);return _0x4d122e(_0xe261b9[_0x23f7('0x12')]['message']);}else{logger['info'](_0x23f7('0xe'),_0x21e7ee,_0x23f7('0x10'));_0x4d122e(_0xe261b9[_0x23f7('0x15')]['message']);}})[_0x23f7('0x16')](function(_0x1d2c9d){logger[_0x23f7('0x12')](_0x23f7('0xe'),_0x21e7ee,_0x1d2c9d);_0x46319c(_0x1d2c9d);});});} \ No newline at end of file +var _0x1fec=['request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x16cdfb,_0xdf0056){var _0x482db4=function(_0x46c03a){while(--_0x46c03a){_0x16cdfb['push'](_0x16cdfb['shift']());}};_0x482db4(++_0xdf0056);}(_0x1fec,0xe8));var _0xc1fe=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1fec[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc1fe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc1fe('0x1'));var fs=require('fs');var Redis=require(_0xc1fe('0x2'));var db=require(_0xc1fe('0x3'))['db'];var utils=require(_0xc1fe('0x4'));var logger=require(_0xc1fe('0x5'))('rpc');var config=require(_0xc1fe('0x6'));var jayson=require(_0xc1fe('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d0630,_0x1760db,_0x517f40){return new BPromise(function(_0x582e5d,_0x16e89e){return client[_0xc1fe('0x8')](_0x2d0630,_0x517f40)[_0xc1fe('0x9')](function(_0x11e990){logger[_0xc1fe('0xa')](_0xc1fe('0xb'),_0x1760db,_0xc1fe('0xc'));logger[_0xc1fe('0xd')](_0xc1fe('0xe'),_0x1760db,_0xc1fe('0xc'),JSON[_0xc1fe('0xf')](_0x11e990));if(_0x11e990['error']){if(_0x11e990[_0xc1fe('0x10')][_0xc1fe('0x11')]===0x1f4){logger[_0xc1fe('0x10')](_0xc1fe('0xb'),_0x1760db,_0x11e990[_0xc1fe('0x10')][_0xc1fe('0x12')]);return _0x16e89e(_0x11e990['error'][_0xc1fe('0x12')]);}logger[_0xc1fe('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x1760db,_0x11e990['error']['message']);return _0x582e5d(_0x11e990['error']['message']);}else{logger[_0xc1fe('0xa')](_0xc1fe('0xb'),_0x1760db,'request\x20sent');_0x582e5d(_0x11e990[_0xc1fe('0x13')][_0xc1fe('0x12')]);}})['catch'](function(_0x2e8896){logger['error'](_0xc1fe('0xb'),_0x1760db,_0x2e8896);_0x16e89e(_0x2e8896);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 552f26a..a7b8a41 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 _0xda19=['post','create','update','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x468a16,_0x41f40d){var _0x1a365c=function(_0x550d58){while(--_0x550d58){_0x468a16['push'](_0x468a16['shift']());}};_0x1a365c(++_0x41f40d);}(_0xda19,0xd5));var _0x9da1=function(_0x5c6dc2,_0x41b63b){_0x5c6dc2=_0x5c6dc2-0x0;var _0x1aa1e3=_0xda19[_0x5c6dc2];return _0x1aa1e3;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var fs_extra=require(_0x9da1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var controller=require(_0x9da1('0x6'));router[_0x9da1('0x7')](_0x9da1('0x8'),auth[_0x9da1('0x9')](),controller[_0x9da1('0xa')]);router[_0x9da1('0xb')]('/',auth[_0x9da1('0x9')](),controller[_0x9da1('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9da1('0xd')]);router['delete'](_0x9da1('0x8'),auth[_0x9da1('0x9')](),controller[_0x9da1('0xe')]);module[_0x9da1('0xf')]=router; \ No newline at end of file +var _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xabce,0x103));var _0xeabc=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xabce[_0x4e9628];return _0x27bc8c;};'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('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 7e29596..31a313e 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 _0x792f=['beepall','STRING','name','rrmemory'];(function(_0x911c70,_0x3fb4f8){var _0x3c3935=function(_0x12f1ba){while(--_0x12f1ba){_0x911c70['push'](_0x911c70['shift']());}};_0x3c3935(++_0x3fb4f8);}(_0x792f,0xf5));var _0xf792=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0x792f[_0x5093e9];return _0x4c9a22;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf792('0x0')],'unique':_0xf792('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf792('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf792('0x2'),_0xf792('0x3'),'roundrobin')}}; \ No newline at end of file +var _0x3d06=['exports','STRING','INTEGER','ENUM','roundrobin','sequelize'];(function(_0x5b1366,_0x51eea6){var _0x25bc61=function(_0x1febe8){while(--_0x1febe8){_0x5b1366['push'](_0x5b1366['shift']());}};_0x25bc61(++_0x51eea6);}(_0x3d06,0x1b5));var _0x63d0=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x3d06[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require(_0x63d0('0x0'));module[_0x63d0('0x1')]={'name':{'type':Sequelize[_0x63d0('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x63d0('0x2')]},'timeout':{'type':Sequelize[_0x63d0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x63d0('0x4')]('rrmemory','beepall',_0x63d0('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 5a7263c..ca0e08c 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 _0xd04a=['find','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','agent','format','%s/%s','SIP','chatPause','createdAt','updatedAt','Team','options','getTeams','addTeams','ids','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','emit','userChatQueue:save','removeTeams','select','field','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','compact','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','jayson/promise','http','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','show'];(function(_0x4e82eb,_0x48201a){var _0x312271=function(_0x15b874){while(--_0x15b874){_0x4e82eb['push'](_0x4e82eb['shift']());}};_0x312271(++_0x48201a);}(_0xd04a,0xd6));var _0xad04=function(_0x36068a,_0x489020){_0x36068a=_0x36068a-0x0;var _0x1c2282=_0xd04a[_0x36068a];return _0x1c2282;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xad04('0x0'));var jsonpatch=require(_0xad04('0x1'));var rp=require('request-promise');var moment=require(_0xad04('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xad04('0x3'));var util=require(_0xad04('0x4'));var path=require(_0xad04('0x5'));var sox=require(_0xad04('0x6'));var csv=require(_0xad04('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad04('0x8'));var _=require(_0xad04('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xad04('0x7'));var querystring=require(_0xad04('0xa'));var Papa=require('papaparse');var Redis=require(_0xad04('0xb'));var authService=require(_0xad04('0xc'));var qs=require(_0xad04('0xd'));var as=require(_0xad04('0xe'));var hardwareService=require(_0xad04('0xf'));var logger=require(_0xad04('0x10'))(_0xad04('0x11'));var utils=require(_0xad04('0x12'));var config=require(_0xad04('0x13'));var licenseUtil=require(_0xad04('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xad04('0x15')],{'host':_0xad04('0x16'),'port':0x18eb});var socket=require(_0xad04('0x17'))(new Redis(config[_0xad04('0x15')]));require('./chatQueue.socket')[_0xad04('0x18')](socket);var jayson=require(_0xad04('0x19'));var client=jayson['client'][_0xad04('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3f207c,_0xf4ff4d,_0xd13025,_0x465167){return new BPromise(function(_0x3bb4aa,_0x2ac132){var _0x319e76=_0x465167||client;return _0x319e76['request'](_0x3f207c,_0xd13025)['then'](function(_0x5c30a5){logger[_0xad04('0x1b')](_0xad04('0x1c'),_0xf4ff4d,'request\x20sent');logger[_0xad04('0x1d')](_0xad04('0x1e'),_0xf4ff4d,_0xad04('0x1f'),JSON[_0xad04('0x20')](_0x5c30a5));if(_0x5c30a5[_0xad04('0x21')]){if(_0x5c30a5[_0xad04('0x21')][_0xad04('0x22')]===0x1f4){logger['error'](_0xad04('0x1c'),_0xf4ff4d,_0x5c30a5[_0xad04('0x21')][_0xad04('0x23')]);return _0x2ac132(_0x5c30a5[_0xad04('0x21')][_0xad04('0x23')]);}logger[_0xad04('0x21')](_0xad04('0x1c'),_0xf4ff4d,_0x5c30a5[_0xad04('0x21')][_0xad04('0x23')]);return _0x3bb4aa(_0x5c30a5[_0xad04('0x21')]['message']);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0xf4ff4d,'request\x20sent');_0x3bb4aa(_0x5c30a5[_0xad04('0x24')]['message']);}})[_0xad04('0x25')](function(_0x3f93c5){logger[_0xad04('0x21')]('ChatQueue,\x20%s,\x20%s',_0xf4ff4d,_0x3f93c5);_0x2ac132(_0x3f93c5);});});}function respondWithStatusCode(_0xdfad6d,_0x15d006){_0x15d006=_0x15d006||0xcc;return function(_0x497576){if(_0x497576){return _0xdfad6d[_0xad04('0x26')](_0x15d006);}return _0xdfad6d[_0xad04('0x27')](_0x15d006)[_0xad04('0x28')]();};}function respondWithResult(_0x425c43,_0x32444e){_0x32444e=_0x32444e||0xc8;return function(_0x4dc9ac){if(_0x4dc9ac){return _0x425c43['status'](_0x32444e)[_0xad04('0x29')](_0x4dc9ac);}};}function respondWithFilteredResult(_0x53efa5,_0x18d24a){return function(_0x5176f6){if(_0x5176f6){var _0x57db11=typeof _0x18d24a[_0xad04('0x2a')]==='undefined'&&typeof _0x18d24a[_0xad04('0x2b')]==='undefined';var _0x26f4f3=_0x5176f6[_0xad04('0x2c')];var _0x116f32=_0x57db11?0x0:_0x18d24a[_0xad04('0x2a')];var _0xf54675=_0x57db11?_0x5176f6[_0xad04('0x2c')]:_0x18d24a[_0xad04('0x2a')]+_0x18d24a[_0xad04('0x2b')];var _0x4c0143;if(_0xf54675>=_0x26f4f3){_0xf54675=_0x26f4f3;_0x4c0143=0xc8;}else{_0x4c0143=0xce;}_0x53efa5[_0xad04('0x27')](_0x4c0143);return _0x53efa5[_0xad04('0x2d')](_0xad04('0x2e'),_0x116f32+'-'+_0xf54675+'/'+_0x26f4f3)['json'](_0x5176f6);}return null;};}function patchUpdates(_0x280b3e){return function(_0x173887){try{jsonpatch[_0xad04('0x2f')](_0x173887,_0x280b3e,!![]);}catch(_0x48ae96){return BPromise[_0xad04('0x30')](_0x48ae96);}return _0x173887[_0xad04('0x31')]();};}function saveUpdates(_0x409421,_0x3dd6a5){return function(_0x3cf953){if(_0x3cf953){return _0x3cf953[_0xad04('0x32')](_0x409421)[_0xad04('0x33')](function(_0x28e610){return _0x28e610;});}return null;};}function removeEntity(_0x5d4115,_0x5c40c5){return function(_0x5799fe){if(_0x5799fe){return _0x5799fe[_0xad04('0x34')]()['then'](function(){var _0x5b863b=_0x5799fe[_0xad04('0x35')]({'plain':!![]});var _0xd6c16d=_0xad04('0x36');return db[_0xad04('0x37')][_0xad04('0x34')]({'where':{'type':_0xd6c16d,'resourceId':_0x5b863b['id']}})[_0xad04('0x33')](function(){return _0x5799fe;});})[_0xad04('0x33')](function(){_0x5d4115[_0xad04('0x27')](0xcc)[_0xad04('0x28')]();});}};}function handleEntityNotFound(_0x592d98,_0x1df9bc){return function(_0x56f405){if(!_0x56f405){_0x592d98['sendStatus'](0x194);}return _0x56f405;};}function handleError(_0x5b4238,_0x351d37){_0x351d37=_0x351d37||0x1f4;return function(_0x3e3f8f){logger['error'](_0x3e3f8f[_0xad04('0x38')]);if(_0x3e3f8f['name']){delete _0x3e3f8f[_0xad04('0x39')];}_0x5b4238[_0xad04('0x27')](_0x351d37)[_0xad04('0x3a')](_0x3e3f8f);};}exports[_0xad04('0x3b')]=function(_0x3b65f1,_0x215531){var _0x492156={},_0x3ab91d={},_0x561106={'count':0x0,'rows':[]};var _0x2a656d=_[_0xad04('0x3c')](db[_0xad04('0x3d')][_0xad04('0x3e')],function(_0x35808e){return{'name':_0x35808e[_0xad04('0x3f')],'type':_0x35808e['type'][_0xad04('0x40')]};});_0x3ab91d[_0xad04('0x41')]=_['map'](_0x2a656d,_0xad04('0x39'));_0x3ab91d['query']=_[_0xad04('0x42')](_0x3b65f1[_0xad04('0x43')]);_0x3ab91d[_0xad04('0x44')]=_['intersection'](_0x3ab91d[_0xad04('0x41')],_0x3ab91d[_0xad04('0x43')]);_0x492156['attributes']=_[_0xad04('0x45')](_0x3ab91d[_0xad04('0x41')],qs['fields'](_0x3b65f1[_0xad04('0x43')][_0xad04('0x46')]));_0x492156['attributes']=_0x492156[_0xad04('0x47')][_0xad04('0x48')]?_0x492156[_0xad04('0x47')]:_0x3ab91d[_0xad04('0x41')];if(!_0x3b65f1[_0xad04('0x43')][_0xad04('0x49')](_0xad04('0x4a'))){_0x492156[_0xad04('0x2b')]=qs['limit'](_0x3b65f1[_0xad04('0x43')][_0xad04('0x2b')]);_0x492156[_0xad04('0x2a')]=qs['offset'](_0x3b65f1['query'][_0xad04('0x2a')]);}_0x492156[_0xad04('0x4b')]=qs[_0xad04('0x4c')](_0x3b65f1['query'][_0xad04('0x4c')]);_0x492156[_0xad04('0x4d')]=qs[_0xad04('0x44')](_[_0xad04('0x4e')](_0x3b65f1['query'],_0x3ab91d[_0xad04('0x44')]),_0x2a656d);if(_0x3b65f1[_0xad04('0x43')][_0xad04('0x4f')]){_0x492156[_0xad04('0x4d')]=_['merge'](_0x492156[_0xad04('0x4d')],{'$or':_[_0xad04('0x3c')](_0x2a656d,function(_0x5574b2){if(_0x5574b2[_0xad04('0x50')]!==_0xad04('0x51')){var _0x37ba3e={};_0x37ba3e[_0x5574b2[_0xad04('0x39')]]={'$like':'%'+_0x3b65f1[_0xad04('0x43')][_0xad04('0x4f')]+'%'};return _0x37ba3e;}})});}_0x492156=_[_0xad04('0x52')]({},_0x492156,_0x3b65f1['options']);var _0x129531={'where':_0x492156['where']};return db['ChatQueue'][_0xad04('0x2c')](_0x129531)[_0xad04('0x33')](function(_0xfb755f){_0x561106[_0xad04('0x2c')]=_0xfb755f;if(_0x3b65f1[_0xad04('0x43')][_0xad04('0x53')]){_0x492156[_0xad04('0x54')]=[{'all':!![]}];}return db[_0xad04('0x3d')][_0xad04('0x55')](_0x492156);})[_0xad04('0x33')](function(_0x15ff88){_0x561106[_0xad04('0x56')]=_0x15ff88;return _0x561106;})[_0xad04('0x33')](respondWithFilteredResult(_0x215531,_0x492156))[_0xad04('0x25')](handleError(_0x215531,null));};exports[_0xad04('0x57')]=function(_0xe0bdd0,_0x46a29c){var _0xc9cab1={'raw':!![],'where':{'id':_0xe0bdd0['params']['id']}},_0x2ed95e={};_0x2ed95e[_0xad04('0x41')]=_[_0xad04('0x42')](db['ChatQueue'][_0xad04('0x3e')]);_0x2ed95e[_0xad04('0x43')]=_['keys'](_0xe0bdd0[_0xad04('0x43')]);_0x2ed95e[_0xad04('0x44')]=_[_0xad04('0x45')](_0x2ed95e[_0xad04('0x41')],_0x2ed95e[_0xad04('0x43')]);_0xc9cab1[_0xad04('0x47')]=_['intersection'](_0x2ed95e['model'],qs[_0xad04('0x46')](_0xe0bdd0[_0xad04('0x43')][_0xad04('0x46')]));_0xc9cab1[_0xad04('0x47')]=_0xc9cab1[_0xad04('0x47')][_0xad04('0x48')]?_0xc9cab1[_0xad04('0x47')]:_0x2ed95e[_0xad04('0x41')];if(_0xe0bdd0[_0xad04('0x43')][_0xad04('0x53')]){_0xc9cab1[_0xad04('0x54')]=[{'all':!![]}];}_0xc9cab1=_['merge']({},_0xc9cab1,_0xe0bdd0['options']);return db[_0xad04('0x3d')][_0xad04('0x58')](_0xc9cab1)[_0xad04('0x33')](handleEntityNotFound(_0x46a29c,null))['then'](respondWithResult(_0x46a29c,null))[_0xad04('0x25')](handleError(_0x46a29c,null));};exports[_0xad04('0x59')]=function(_0x4b1624,_0x4e152e){return db[_0xad04('0x3d')]['create'](_0x4b1624[_0xad04('0x5a')],{})[_0xad04('0x33')](function(_0x50cfeb){var _0x510359=_0x4b1624['user']['get']({'plain':!![]});if(!_0x510359)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x510359[_0xad04('0x5b')]==='user'){var _0x2ff682=_0x50cfeb[_0xad04('0x35')]({'plain':!![]});var _0x36caad=_0xad04('0x36');return db[_0xad04('0x5c')][_0xad04('0x58')]({'where':{'name':_0x36caad,'userProfileId':_0x510359[_0xad04('0x5d')]},'raw':!![]})[_0xad04('0x33')](function(_0x10f63b){if(_0x10f63b&&_0x10f63b[_0xad04('0x5e')]===0x0){return db[_0xad04('0x37')][_0xad04('0x59')]({'name':_0x2ff682[_0xad04('0x39')],'resourceId':_0x2ff682['id'],'type':_0x10f63b[_0xad04('0x39')],'sectionId':_0x10f63b['id']},{})[_0xad04('0x33')](function(){return _0x50cfeb;});}else{return _0x50cfeb;}})['catch'](function(_0x4f362c){logger[_0xad04('0x21')](_0xad04('0x5f'),_0x4f362c);throw _0x4f362c;});}return _0x50cfeb;})[_0xad04('0x33')](respondWithResult(_0x4e152e,0xc9))['catch'](handleError(_0x4e152e,null));};exports[_0xad04('0x32')]=function(_0x42114a,_0x2a9143){if(_0x42114a[_0xad04('0x5a')]['id']){delete _0x42114a[_0xad04('0x5a')]['id'];}return db[_0xad04('0x3d')][_0xad04('0x58')]({'where':{'id':_0x42114a[_0xad04('0x60')]['id']}})[_0xad04('0x33')](handleEntityNotFound(_0x2a9143,null))['then'](saveUpdates(_0x42114a[_0xad04('0x5a')],null))[_0xad04('0x33')](respondWithResult(_0x2a9143,null))[_0xad04('0x25')](handleError(_0x2a9143,null));};exports[_0xad04('0x34')]=function(_0xfbc356,_0x6cf2ad){return db[_0xad04('0x3d')][_0xad04('0x58')]({'where':{'id':_0xfbc356['params']['id']}})['then'](handleEntityNotFound(_0x6cf2ad,null))[_0xad04('0x33')](removeEntity(_0x6cf2ad,null))[_0xad04('0x25')](handleError(_0x6cf2ad,null));};exports[_0xad04('0x61')]=function(_0x4c4beb,_0x3bb218){return db['ChatQueue'][_0xad04('0x61')]()['then'](respondWithResult(_0x3bb218,null))[_0xad04('0x25')](handleError(_0x3bb218,null));};exports[_0xad04('0x62')]=function(_0x19fc67,_0x229363,_0x170e74){var _0x21c3af={'raw':!![],'where':{}},_0x31f67b={},_0x297645;return db[_0xad04('0x3d')][_0xad04('0x63')]({'where':{'id':_0x19fc67[_0xad04('0x60')]['id']}})[_0xad04('0x33')](handleEntityNotFound(_0x229363,null))['then'](function(_0x4c60ec){if(_0x4c60ec){_0x297645=_0x4c60ec[_0xad04('0x35')]({'plain':!![]});_0x31f67b['model']=_['keys'](db[_0xad04('0x64')]['rawAttributes']);_0x31f67b['query']=_['keys'](_0x19fc67['query']);_0x31f67b[_0xad04('0x44')]=_['intersection'](_0x31f67b['model'],_0x31f67b[_0xad04('0x43')]);_0x21c3af[_0xad04('0x47')]=_[_0xad04('0x45')](_0x31f67b[_0xad04('0x41')],qs[_0xad04('0x46')](_0x19fc67[_0xad04('0x43')][_0xad04('0x46')]));_0x21c3af['attributes']=_0x21c3af[_0xad04('0x47')][_0xad04('0x48')]?_0x21c3af[_0xad04('0x47')]:_0x31f67b[_0xad04('0x41')];if(!_0x19fc67['query'][_0xad04('0x49')]('nolimit')){_0x21c3af[_0xad04('0x2b')]=qs[_0xad04('0x2b')](_0x19fc67[_0xad04('0x43')][_0xad04('0x2b')]);_0x21c3af['offset']=qs[_0xad04('0x2a')](_0x19fc67[_0xad04('0x43')]['offset']);}_0x21c3af[_0xad04('0x4b')]=qs['sort'](_0x19fc67[_0xad04('0x43')]['sort']);_0x21c3af[_0xad04('0x4d')]=qs['filters'](_[_0xad04('0x4e')](_0x19fc67[_0xad04('0x43')],_0x31f67b[_0xad04('0x44')]));_0x21c3af[_0xad04('0x4d')][_0xad04('0x65')]=_0x4c60ec['id'];if(_0x19fc67[_0xad04('0x43')][_0xad04('0x4f')]){_0x21c3af[_0xad04('0x4d')]=_[_0xad04('0x52')](_0x21c3af[_0xad04('0x4d')],{'$or':_[_0xad04('0x3c')](_0x21c3af[_0xad04('0x47')],function(_0x408485){var _0x116d39={};_0x116d39[_0x408485]={'$like':'%'+_0x19fc67[_0xad04('0x43')][_0xad04('0x4f')]+'%'};return _0x116d39;})});}_0x21c3af=_[_0xad04('0x52')]({},_0x21c3af,_0x19fc67['options']);return db[_0xad04('0x64')]['findAll'](_0x21c3af);}})[_0xad04('0x33')](function(_0x52445f){if(_0x52445f){return db[_0xad04('0x66')][_0xad04('0x67')]({'where':{'id':_[_0xad04('0x3c')](_0x52445f,_0xad04('0x68')),'role':_0xad04('0x69')},'attributes':['id',_0xad04('0x39'),'chatPause','updatedAt','createdAt']});}})[_0xad04('0x33')](function(_0xde2df3){if(_0xde2df3){return{'count':_0xde2df3[_0xad04('0x2c')],'rows':_['map'](_0xde2df3['rows'],function(_0x39c494){return{'membername':_0x39c494[_0xad04('0x39')],'UserId':_0x39c494['id'],'queue_name':_0x297645[_0xad04('0x39')],'ChatQueueId':_0x297645['id'],'interface':util[_0xad04('0x6a')](_0xad04('0x6b'),_0xad04('0x6c'),_0x39c494[_0xad04('0x39')]),'penalty':0x0,'paused':_0x39c494[_0xad04('0x6d')],'createdAt':_0x39c494[_0xad04('0x6e')],'updatedAt':_0x39c494[_0xad04('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xad04('0x33')](respondWithFilteredResult(_0x229363,_0x21c3af))[_0xad04('0x25')](handleError(_0x229363,null));};exports['getTeams']=function(_0x14f914,_0x341fed,_0x4788c6){var _0x72b6e={};var _0x386517={};var _0x18ff86;var _0x8abe5b;return db['ChatQueue'][_0xad04('0x63')]({'where':{'id':_0x14f914[_0xad04('0x60')]['id']}})['then'](handleEntityNotFound(_0x341fed,null))['then'](function(_0x3b3210){if(_0x3b3210){_0x18ff86=_0x3b3210;_0x386517['model']=_[_0xad04('0x42')](db[_0xad04('0x70')][_0xad04('0x3e')]);_0x386517[_0xad04('0x43')]=_[_0xad04('0x42')](_0x14f914[_0xad04('0x43')]);_0x386517[_0xad04('0x44')]=_[_0xad04('0x45')](_0x386517[_0xad04('0x41')],_0x386517[_0xad04('0x43')]);_0x72b6e[_0xad04('0x47')]=_[_0xad04('0x45')](_0x386517[_0xad04('0x41')],qs['fields'](_0x14f914[_0xad04('0x43')][_0xad04('0x46')]));_0x72b6e[_0xad04('0x47')]=_0x72b6e[_0xad04('0x47')][_0xad04('0x48')]?_0x72b6e['attributes']:_0x386517[_0xad04('0x41')];_0x72b6e[_0xad04('0x4b')]=qs[_0xad04('0x4c')](_0x14f914[_0xad04('0x43')][_0xad04('0x4c')]);_0x72b6e[_0xad04('0x4d')]=qs[_0xad04('0x44')](_[_0xad04('0x4e')](_0x14f914[_0xad04('0x43')],_0x386517[_0xad04('0x44')]));if(_0x14f914[_0xad04('0x43')]['filter']){_0x72b6e[_0xad04('0x4d')]=_['merge'](_0x72b6e['where'],{'$or':_[_0xad04('0x3c')](_0x72b6e[_0xad04('0x47')],function(_0x5fa903){var _0x580bb7={};_0x580bb7[_0x5fa903]={'$like':'%'+_0x14f914[_0xad04('0x43')]['filter']+'%'};return _0x580bb7;})});}_0x72b6e=_['merge']({},_0x72b6e,_0x14f914[_0xad04('0x71')]);return _0x18ff86[_0xad04('0x72')](_0x72b6e);}})[_0xad04('0x33')](function(_0x5a3c1a){if(_0x5a3c1a){_0x8abe5b=_0x5a3c1a[_0xad04('0x48')];if(!_0x14f914['query']['hasOwnProperty'](_0xad04('0x4a'))){_0x72b6e[_0xad04('0x2b')]=qs[_0xad04('0x2b')](_0x14f914[_0xad04('0x43')][_0xad04('0x2b')]);_0x72b6e['offset']=qs[_0xad04('0x2a')](_0x14f914[_0xad04('0x43')][_0xad04('0x2a')]);}return _0x18ff86[_0xad04('0x72')](_0x72b6e);}})[_0xad04('0x33')](function(_0x266d31){if(_0x266d31){return _0x266d31?{'count':_0x8abe5b,'rows':_0x266d31}:null;}})[_0xad04('0x33')](respondWithResult(_0x341fed,null))[_0xad04('0x25')](handleError(_0x341fed,null));};exports[_0xad04('0x73')]=function(_0x436d38,_0x57b4fc,_0x5067e3){var _0x4d852b=_0x436d38[_0xad04('0x5a')][_0xad04('0x74')];return db[_0xad04('0x70')][_0xad04('0x55')]({'where':{'id':_0x4d852b},'attributes':['id'],'include':[{'model':db[_0xad04('0x66')],'as':_0xad04('0x75'),'attributes':['id',_0xad04('0x39'),'online',_0xad04('0x76'),_0xad04('0x77')],'raw':!![]}]})[_0xad04('0x33')](function(_0x148d78){if(_0x148d78){var _0x570b99=_['flatMap'](_0x148d78,function(_0x28f55e){var _0x1ea084=_0x28f55e[_0xad04('0x35')]({'plain':!![]});return _0x1ea084[_0xad04('0x75')];});return db[_0xad04('0x3d')]['find']({'where':{'id':_0x436d38[_0xad04('0x60')]['id']}})[_0xad04('0x33')](function(_0x51f9ea){return db[_0xad04('0x78')][_0xad04('0x79')](function(_0x47c386){return _0x51f9ea[_0xad04('0x73')](_0x4d852b,{'transaction':_0x47c386})['then'](function(){return BPromise[_0xad04('0x7a')](_0x570b99,function(_0x21503a){return db[_0xad04('0x64')][_0xad04('0x7b')]({'where':{'UserId':_0x21503a['id'],'ChatQueueId':_0x436d38['params']['id']},'transaction':_0x47c386});});})[_0xad04('0x33')](function(){_0x570b99['forEach'](function(_0x35eb86){socket[_0xad04('0x7c')](_0xad04('0x7d'),{'UserId':_0x35eb86['id'],'ChatQueueId':_0x51f9ea['id']});});});});});}})['then'](respondWithStatusCode(_0x57b4fc,null))[_0xad04('0x25')](handleError(_0x57b4fc,null));};exports[_0xad04('0x7e')]=function(_0x106ae1,_0x11b603,_0x34d530){return db[_0xad04('0x70')][_0xad04('0x55')]({'where':{'id':_0x106ae1[_0xad04('0x43')][_0xad04('0x74')]},'attributes':['id'],'include':[{'model':db[_0xad04('0x66')],'as':_0xad04('0x75'),'attributes':['id'],'raw':!![]}]})[_0xad04('0x33')](handleEntityNotFound(_0x11b603,null))['then'](function(_0x5b3296){var _0x1750af=_[_0xad04('0x3c')](_0x5b3296,'id');var _0x18ede4=[];var _0x299d44=[];var _0x422363=squel[_0xad04('0x7f')]();_0x422363[_0xad04('0x80')]('tq.TeamId')[_0xad04('0x81')](_0xad04('0x82'),'tq')['join'](_0xad04('0x83'),'ut',_0xad04('0x84'))[_0xad04('0x4d')]('ChatQueueId\x20=\x20?',_0x106ae1[_0xad04('0x60')]['id']);for(var _0x1f0ef0=0x0;_0x1f0ef0<_0x5b3296[_0xad04('0x48')];_0x1f0ef0+=0x1){let _0x2b5aa9=_0x5b3296[_0x1f0ef0];for(var _0x35e9b7=0x0;_0x35e9b7<_0x2b5aa9[_0xad04('0x75')][_0xad04('0x48')];_0x35e9b7+=0x1){let _0x25b6fc=_0x2b5aa9[_0xad04('0x75')][_0x35e9b7];var _0x3b7b2e=_0x422363[_0xad04('0x85')]();_0x3b7b2e[_0xad04('0x4d')](_0xad04('0x86'),_0x25b6fc['id']);_0x299d44[_0xad04('0x87')](db[_0xad04('0x78')][_0xad04('0x43')](_0x3b7b2e[_0xad04('0x88')](),{'type':db[_0xad04('0x78')]['QueryTypes'][_0xad04('0x89')]})[_0xad04('0x33')](function(_0x318b70){if(_0x318b70[_0xad04('0x48')]===0x1){return _0x25b6fc['id'];}else{var _0x12469f=_[_0xad04('0x8a')](_[_0xad04('0x3c')](_0x318b70,_0xad04('0x8b')),function(_0x263369){return _[_0xad04('0x8c')](_0x1750af,_0x263369);});if(_0x12469f){return _0x25b6fc['id'];}}}));}}return BPromise['all'](_0x299d44)[_0xad04('0x33')](function(_0x2fe21b){_0x18ede4=_(_0x18ede4)['union'](_0x2fe21b)[_0xad04('0x8d')]()['value']();return db[_0xad04('0x3d')]['find']({'where':{'id':_0x106ae1[_0xad04('0x60')]['id']}})[_0xad04('0x33')](function(_0x1b2909){return db[_0xad04('0x78')][_0xad04('0x79')](function(_0x1e6f98){return _0x1b2909[_0xad04('0x7e')](_0x106ae1[_0xad04('0x43')][_0xad04('0x74')],{'transaction':_0x1e6f98})[_0xad04('0x33')](function(){if(!_[_0xad04('0x8e')](_0x18ede4)){return _0x1b2909[_0xad04('0x8f')](_0x18ede4,{'transaction':_0x1e6f98});}})[_0xad04('0x33')](function(){_0x18ede4[_0xad04('0x90')](function(_0x1781a6){socket[_0xad04('0x7c')](_0xad04('0x91'),{'UserId':_0x1781a6,'ChatQueueId':_0x1b2909['id']});});});});});});})[_0xad04('0x33')](respondWithStatusCode(_0x11b603,null))[_0xad04('0x25')](handleError(_0x11b603,null));};exports[_0xad04('0x92')]=function(_0x4fb0cf,_0xf177f1,_0x3a4b51){return db['ChatQueue'][_0xad04('0x58')]({'where':{'id':_0x4fb0cf[_0xad04('0x60')]['id']}})[_0xad04('0x33')](handleEntityNotFound(_0xf177f1,null))['then'](function(_0x27c848){if(_0x27c848){return _0x27c848[_0xad04('0x92')](_0x4fb0cf[_0xad04('0x5a')][_0xad04('0x74')],_[_0xad04('0x93')](_0x4fb0cf[_0xad04('0x5a')],['ids','id'])||{})[_0xad04('0x94')](function(_0x2f69f6){for(var _0x4e6ab9=0x0;_0x4e6ab9<_0x4fb0cf[_0xad04('0x5a')]['ids']['length'];_0x4e6ab9+=0x1){socket[_0xad04('0x7c')](_0xad04('0x7d'),{'UserId':Number(_0x4fb0cf[_0xad04('0x5a')][_0xad04('0x74')][_0x4e6ab9]),'ChatQueueId':Number(_0x4fb0cf[_0xad04('0x60')]['id'])});}return _0x2f69f6;});}})[_0xad04('0x33')](respondWithResult(_0xf177f1,null))[_0xad04('0x25')](handleError(_0xf177f1,null));};exports[_0xad04('0x8f')]=function(_0x19ec2c,_0x8b1dec,_0x2fc8ac){return db[_0xad04('0x3d')][_0xad04('0x58')]({'where':{'id':_0x19ec2c[_0xad04('0x60')]['id']}})[_0xad04('0x33')](handleEntityNotFound(_0x8b1dec,null))[_0xad04('0x33')](function(_0x197940){if(_0x197940){return _0x197940['removeAgents'](_0x19ec2c[_0xad04('0x43')]['ids'])[_0xad04('0x33')](function(){if(_[_0xad04('0x95')](_0x19ec2c['query']['ids'])){for(var _0x3f10cd=0x0;_0x3f10cd<_0x19ec2c[_0xad04('0x43')][_0xad04('0x74')][_0xad04('0x48')];_0x3f10cd+=0x1){socket[_0xad04('0x7c')](_0xad04('0x91'),{'UserId':Number(_0x19ec2c[_0xad04('0x43')][_0xad04('0x74')][_0x3f10cd]),'ChatQueueId':Number(_0x19ec2c['params']['id'])});}}else{socket[_0xad04('0x7c')](_0xad04('0x91'),{'UserId':Number(_0x19ec2c[_0xad04('0x43')]['ids']),'ChatQueueId':Number(_0x19ec2c[_0xad04('0x60')]['id'])});}});}})[_0xad04('0x33')](respondWithStatusCode(_0x8b1dec,null))[_0xad04('0x25')](handleError(_0x8b1dec,null));};exports['getAgents']=function(_0x2d4853,_0x261635,_0x40b02d){var _0x1d61d2={};var _0xea7879={};var _0x19452d;var _0x43cc62;return db[_0xad04('0x3d')][_0xad04('0x63')]({'where':{'id':_0x2d4853[_0xad04('0x60')]['id']}})['then'](handleEntityNotFound(_0x261635,null))[_0xad04('0x33')](function(_0x96bc1){if(_0x96bc1){_0x19452d=_0x96bc1;_0xea7879[_0xad04('0x41')]=_[_0xad04('0x42')](db['User'][_0xad04('0x3e')]);_0xea7879[_0xad04('0x43')]=_[_0xad04('0x42')](_0x2d4853[_0xad04('0x43')]);_0xea7879[_0xad04('0x44')]=_[_0xad04('0x45')](_0xea7879['model'],_0xea7879['query']);_0x1d61d2[_0xad04('0x47')]=_[_0xad04('0x45')](_0xea7879[_0xad04('0x41')],qs['fields'](_0x2d4853['query'][_0xad04('0x46')]));_0x1d61d2[_0xad04('0x47')]=_0x1d61d2[_0xad04('0x47')][_0xad04('0x48')]?_0x1d61d2[_0xad04('0x47')]:_0xea7879['model'];_0x1d61d2[_0xad04('0x4b')]=qs[_0xad04('0x4c')](_0x2d4853[_0xad04('0x43')][_0xad04('0x4c')]);_0x1d61d2['where']=qs[_0xad04('0x44')](_[_0xad04('0x4e')](_0x2d4853['query'],_0xea7879[_0xad04('0x44')]));if(_0x2d4853[_0xad04('0x43')]['filter']){_0x1d61d2[_0xad04('0x4d')]=_[_0xad04('0x52')](_0x1d61d2[_0xad04('0x4d')],{'$or':_['map'](_0x1d61d2['attributes'],function(_0x801746){var _0x118f9b={};_0x118f9b[_0x801746]={'$like':'%'+_0x2d4853[_0xad04('0x43')][_0xad04('0x4f')]+'%'};return _0x118f9b;})});}_0x1d61d2=_['merge']({},_0x1d61d2,_0x2d4853[_0xad04('0x71')]);return _0x19452d['getAgents'](_0x1d61d2);}})[_0xad04('0x33')](function(_0x1048da){if(_0x1048da){_0x43cc62=_0x1048da[_0xad04('0x48')];if(!_0x2d4853[_0xad04('0x43')][_0xad04('0x49')](_0xad04('0x4a'))){_0x1d61d2['limit']=qs['limit'](_0x2d4853[_0xad04('0x43')][_0xad04('0x2b')]);_0x1d61d2['offset']=qs[_0xad04('0x2a')](_0x2d4853[_0xad04('0x43')][_0xad04('0x2a')]);}return _0x19452d[_0xad04('0x96')](_0x1d61d2);}})['then'](function(_0x329313){if(_0x329313){return _0x329313?{'count':_0x43cc62,'rows':_0x329313}:null;}})[_0xad04('0x33')](respondWithResult(_0x261635,null))[_0xad04('0x25')](handleError(_0x261635,null));}; \ No newline at end of file +var _0xa361=['debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','ChatQueues','destroy','stack','name','send','ChatQueue','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','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','describe','getMembers','findOne','UserChatQueue','ChatQueueId','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','SIP','createdAt','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','transaction','findOrCreate','forEach','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','includes','all','compact','value','removeAgents','userChatQueue:remove','addAgents','omit','spread','emit','isArray','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','./chatQueue.socket','register','jayson/promise','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x31be28,_0x598de7){var _0x4d23f2=function(_0x53828e){while(--_0x53828e){_0x31be28['push'](_0x31be28['shift']());}};_0x4d23f2(++_0x598de7);}(_0xa361,0x1b5));var _0x1a36=function(_0x4876b5,_0x44b2b6){_0x4876b5=_0x4876b5-0x0;var _0x40c6d7=_0xa361[_0x4876b5];return _0x40c6d7;};'use strict';var emlformat=require(_0x1a36('0x0'));var rimraf=require(_0x1a36('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1a36('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1a36('0x3'));var util=require(_0x1a36('0x4'));var path=require(_0x1a36('0x5'));var sox=require(_0x1a36('0x6'));var csv=require(_0x1a36('0x7'));var ejs=require(_0x1a36('0x8'));var fs=require('fs');var fs_extra=require(_0x1a36('0x9'));var _=require(_0x1a36('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1a36('0xb'));var deskjs=require(_0x1a36('0xc'));var toCsv=require(_0x1a36('0x7'));var querystring=require(_0x1a36('0xd'));var Papa=require(_0x1a36('0xe'));var Redis=require(_0x1a36('0xf'));var authService=require(_0x1a36('0x10'));var qs=require(_0x1a36('0x11'));var as=require(_0x1a36('0x12'));var hardwareService=require(_0x1a36('0x13'));var logger=require(_0x1a36('0x14'))(_0x1a36('0x15'));var utils=require(_0x1a36('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a36('0x17'))['db'];config[_0x1a36('0x18')]=_['defaults'](config[_0x1a36('0x18')],{'host':_0x1a36('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a36('0x18')]));require(_0x1a36('0x1a'))[_0x1a36('0x1b')](socket);var jayson=require(_0x1a36('0x1c'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35e36d,_0x2a105c,_0x2a1a85,_0x3ecb55){return new BPromise(function(_0x1a157c,_0xa16364){var _0x5300a0=_0x3ecb55||client;return _0x5300a0[_0x1a36('0x1d')](_0x35e36d,_0x2a1a85)[_0x1a36('0x1e')](function(_0x391823){logger[_0x1a36('0x1f')](_0x1a36('0x20'),_0x2a105c,_0x1a36('0x21'));logger[_0x1a36('0x22')](_0x1a36('0x23'),_0x2a105c,_0x1a36('0x21'),JSON[_0x1a36('0x24')](_0x391823));if(_0x391823[_0x1a36('0x25')]){if(_0x391823['error'][_0x1a36('0x26')]===0x1f4){logger[_0x1a36('0x25')](_0x1a36('0x20'),_0x2a105c,_0x391823[_0x1a36('0x25')][_0x1a36('0x27')]);return _0xa16364(_0x391823[_0x1a36('0x25')][_0x1a36('0x27')]);}logger['error'](_0x1a36('0x20'),_0x2a105c,_0x391823['error']['message']);return _0x1a157c(_0x391823[_0x1a36('0x25')]['message']);}else{logger['info'](_0x1a36('0x20'),_0x2a105c,_0x1a36('0x21'));_0x1a157c(_0x391823[_0x1a36('0x28')]['message']);}})['catch'](function(_0x24da98){logger[_0x1a36('0x25')](_0x1a36('0x20'),_0x2a105c,_0x24da98);_0xa16364(_0x24da98);});});}function respondWithStatusCode(_0x230296,_0x272421){_0x272421=_0x272421||0xcc;return function(_0x32dbb2){if(_0x32dbb2){return _0x230296[_0x1a36('0x29')](_0x272421);}return _0x230296[_0x1a36('0x2a')](_0x272421)[_0x1a36('0x2b')]();};}function respondWithResult(_0x561223,_0x29cd18){_0x29cd18=_0x29cd18||0xc8;return function(_0x47421d){if(_0x47421d){return _0x561223[_0x1a36('0x2a')](_0x29cd18)[_0x1a36('0x2c')](_0x47421d);}};}function respondWithFilteredResult(_0x29fc28,_0x3c7a8c){return function(_0x53b164){if(_0x53b164){var _0x26d63d=typeof _0x3c7a8c[_0x1a36('0x2d')]===_0x1a36('0x2e')&&typeof _0x3c7a8c[_0x1a36('0x2f')]===_0x1a36('0x2e');var _0x2f8b19=_0x53b164[_0x1a36('0x30')];var _0x47b874=_0x26d63d?0x0:_0x3c7a8c[_0x1a36('0x2d')];var _0x5d86b7=_0x26d63d?_0x53b164[_0x1a36('0x30')]:_0x3c7a8c[_0x1a36('0x2d')]+_0x3c7a8c[_0x1a36('0x2f')];var _0x275dc9;if(_0x5d86b7>=_0x2f8b19){_0x5d86b7=_0x2f8b19;_0x275dc9=0xc8;}else{_0x275dc9=0xce;}_0x29fc28[_0x1a36('0x2a')](_0x275dc9);return _0x29fc28[_0x1a36('0x31')](_0x1a36('0x32'),_0x47b874+'-'+_0x5d86b7+'/'+_0x2f8b19)[_0x1a36('0x2c')](_0x53b164);}return null;};}function patchUpdates(_0x4c1337){return function(_0x3080dc){try{jsonpatch[_0x1a36('0x33')](_0x3080dc,_0x4c1337,!![]);}catch(_0xd11aa9){return BPromise[_0x1a36('0x34')](_0xd11aa9);}return _0x3080dc[_0x1a36('0x35')]();};}function saveUpdates(_0x3bdf55,_0x3f0d48){return function(_0x4d2714){if(_0x4d2714){return _0x4d2714[_0x1a36('0x36')](_0x3bdf55)[_0x1a36('0x1e')](function(_0x2a24ab){return _0x2a24ab;});}return null;};}function removeEntity(_0x20bf40,_0x476988){return function(_0x4aeb7d){if(_0x4aeb7d){return _0x4aeb7d['destroy']()[_0x1a36('0x1e')](function(){var _0x2d79bd=_0x4aeb7d[_0x1a36('0x37')]({'plain':!![]});var _0x4562eb=_0x1a36('0x38');return db['UserProfileResource'][_0x1a36('0x39')]({'where':{'type':_0x4562eb,'resourceId':_0x2d79bd['id']}})[_0x1a36('0x1e')](function(){return _0x4aeb7d;});})[_0x1a36('0x1e')](function(){_0x20bf40[_0x1a36('0x2a')](0xcc)[_0x1a36('0x2b')]();});}};}function handleEntityNotFound(_0x151b4f,_0x37f370){return function(_0x51fa3e){if(!_0x51fa3e){_0x151b4f[_0x1a36('0x29')](0x194);}return _0x51fa3e;};}function handleError(_0x27cf4d,_0x547eff){_0x547eff=_0x547eff||0x1f4;return function(_0x2d9219){logger['error'](_0x2d9219[_0x1a36('0x3a')]);if(_0x2d9219[_0x1a36('0x3b')]){delete _0x2d9219[_0x1a36('0x3b')];}_0x27cf4d[_0x1a36('0x2a')](_0x547eff)[_0x1a36('0x3c')](_0x2d9219);};}exports['index']=function(_0x4c8b8b,_0x280aaf){var _0x279b8d={},_0x5ed5e7={},_0x1e0cba={'count':0x0,'rows':[]};var _0xa3271e=_['map'](db[_0x1a36('0x3d')][_0x1a36('0x3e')],function(_0x7f6584){return{'name':_0x7f6584[_0x1a36('0x3f')],'type':_0x7f6584[_0x1a36('0x40')][_0x1a36('0x41')]};});_0x5ed5e7['model']=_[_0x1a36('0x42')](_0xa3271e,_0x1a36('0x3b'));_0x5ed5e7['query']=_['keys'](_0x4c8b8b[_0x1a36('0x43')]);_0x5ed5e7[_0x1a36('0x44')]=_['intersection'](_0x5ed5e7[_0x1a36('0x45')],_0x5ed5e7[_0x1a36('0x43')]);_0x279b8d[_0x1a36('0x46')]=_[_0x1a36('0x47')](_0x5ed5e7[_0x1a36('0x45')],qs[_0x1a36('0x48')](_0x4c8b8b[_0x1a36('0x43')][_0x1a36('0x48')]));_0x279b8d[_0x1a36('0x46')]=_0x279b8d[_0x1a36('0x46')][_0x1a36('0x49')]?_0x279b8d[_0x1a36('0x46')]:_0x5ed5e7[_0x1a36('0x45')];if(!_0x4c8b8b[_0x1a36('0x43')][_0x1a36('0x4a')](_0x1a36('0x4b'))){_0x279b8d['limit']=qs[_0x1a36('0x2f')](_0x4c8b8b['query']['limit']);_0x279b8d[_0x1a36('0x2d')]=qs[_0x1a36('0x2d')](_0x4c8b8b[_0x1a36('0x43')][_0x1a36('0x2d')]);}_0x279b8d[_0x1a36('0x4c')]=qs[_0x1a36('0x4d')](_0x4c8b8b['query'][_0x1a36('0x4d')]);_0x279b8d['where']=qs[_0x1a36('0x44')](_[_0x1a36('0x4e')](_0x4c8b8b['query'],_0x5ed5e7['filters']),_0xa3271e);if(_0x4c8b8b[_0x1a36('0x43')][_0x1a36('0x4f')]){_0x279b8d['where']=_[_0x1a36('0x50')](_0x279b8d[_0x1a36('0x51')],{'$or':_[_0x1a36('0x42')](_0xa3271e,function(_0x4cb28e){if(_0x4cb28e[_0x1a36('0x40')]!==_0x1a36('0x52')){var _0xa88159={};_0xa88159[_0x4cb28e['name']]={'$like':'%'+_0x4c8b8b['query'][_0x1a36('0x4f')]+'%'};return _0xa88159;}})});}_0x279b8d=_[_0x1a36('0x50')]({},_0x279b8d,_0x4c8b8b[_0x1a36('0x53')]);var _0x136188={'where':_0x279b8d[_0x1a36('0x51')]};return db[_0x1a36('0x3d')][_0x1a36('0x30')](_0x136188)['then'](function(_0x9c4374){_0x1e0cba[_0x1a36('0x30')]=_0x9c4374;if(_0x4c8b8b[_0x1a36('0x43')]['includeAll']){_0x279b8d[_0x1a36('0x54')]=[{'all':!![]}];}return db[_0x1a36('0x3d')][_0x1a36('0x55')](_0x279b8d);})['then'](function(_0x36ceb4){_0x1e0cba[_0x1a36('0x56')]=_0x36ceb4;return _0x1e0cba;})[_0x1a36('0x1e')](respondWithFilteredResult(_0x280aaf,_0x279b8d))[_0x1a36('0x57')](handleError(_0x280aaf,null));};exports[_0x1a36('0x58')]=function(_0x29c1ef,_0x3d3b5f){var _0x4700d8={'raw':!![],'where':{'id':_0x29c1ef[_0x1a36('0x59')]['id']}},_0x52ce4d={};_0x52ce4d[_0x1a36('0x45')]=_['keys'](db[_0x1a36('0x3d')][_0x1a36('0x3e')]);_0x52ce4d[_0x1a36('0x43')]=_[_0x1a36('0x5a')](_0x29c1ef[_0x1a36('0x43')]);_0x52ce4d[_0x1a36('0x44')]=_['intersection'](_0x52ce4d[_0x1a36('0x45')],_0x52ce4d['query']);_0x4700d8[_0x1a36('0x46')]=_['intersection'](_0x52ce4d['model'],qs[_0x1a36('0x48')](_0x29c1ef[_0x1a36('0x43')][_0x1a36('0x48')]));_0x4700d8[_0x1a36('0x46')]=_0x4700d8[_0x1a36('0x46')][_0x1a36('0x49')]?_0x4700d8[_0x1a36('0x46')]:_0x52ce4d[_0x1a36('0x45')];if(_0x29c1ef['query'][_0x1a36('0x5b')]){_0x4700d8['include']=[{'all':!![]}];}_0x4700d8=_[_0x1a36('0x50')]({},_0x4700d8,_0x29c1ef[_0x1a36('0x53')]);return db[_0x1a36('0x3d')][_0x1a36('0x5c')](_0x4700d8)[_0x1a36('0x1e')](handleEntityNotFound(_0x3d3b5f,null))[_0x1a36('0x1e')](respondWithResult(_0x3d3b5f,null))[_0x1a36('0x57')](handleError(_0x3d3b5f,null));};exports[_0x1a36('0x5d')]=function(_0xb53273,_0x19d50f){return db['ChatQueue'][_0x1a36('0x5d')](_0xb53273[_0x1a36('0x5e')],{})[_0x1a36('0x1e')](function(_0x530f01){var _0x5bd30c=_0xb53273['user']['get']({'plain':!![]});if(!_0x5bd30c)throw new Error(_0x1a36('0x5f'));if(_0x5bd30c[_0x1a36('0x60')]===_0x1a36('0x61')){var _0x5d1f42=_0x530f01[_0x1a36('0x37')]({'plain':!![]});var _0x4e5721=_0x1a36('0x38');return db[_0x1a36('0x62')][_0x1a36('0x5c')]({'where':{'name':_0x4e5721,'userProfileId':_0x5bd30c[_0x1a36('0x63')]},'raw':!![]})[_0x1a36('0x1e')](function(_0x1e9eba){if(_0x1e9eba&&_0x1e9eba[_0x1a36('0x64')]===0x0){return db[_0x1a36('0x65')][_0x1a36('0x5d')]({'name':_0x5d1f42[_0x1a36('0x3b')],'resourceId':_0x5d1f42['id'],'type':_0x1e9eba['name'],'sectionId':_0x1e9eba['id']},{})[_0x1a36('0x1e')](function(){return _0x530f01;});}else{return _0x530f01;}})[_0x1a36('0x57')](function(_0x44ff05){logger[_0x1a36('0x25')](_0x1a36('0x66'),_0x44ff05);throw _0x44ff05;});}return _0x530f01;})[_0x1a36('0x1e')](respondWithResult(_0x19d50f,0xc9))[_0x1a36('0x57')](handleError(_0x19d50f,null));};exports[_0x1a36('0x36')]=function(_0xb64a2b,_0x5bab52){if(_0xb64a2b[_0x1a36('0x5e')]['id']){delete _0xb64a2b[_0x1a36('0x5e')]['id'];}return db[_0x1a36('0x3d')][_0x1a36('0x5c')]({'where':{'id':_0xb64a2b[_0x1a36('0x59')]['id']}})[_0x1a36('0x1e')](handleEntityNotFound(_0x5bab52,null))[_0x1a36('0x1e')](saveUpdates(_0xb64a2b[_0x1a36('0x5e')],null))[_0x1a36('0x1e')](respondWithResult(_0x5bab52,null))[_0x1a36('0x57')](handleError(_0x5bab52,null));};exports[_0x1a36('0x39')]=function(_0x2e6c4b,_0x2c181e){return db[_0x1a36('0x3d')][_0x1a36('0x5c')]({'where':{'id':_0x2e6c4b[_0x1a36('0x59')]['id']}})[_0x1a36('0x1e')](handleEntityNotFound(_0x2c181e,null))[_0x1a36('0x1e')](removeEntity(_0x2c181e,null))['catch'](handleError(_0x2c181e,null));};exports[_0x1a36('0x67')]=function(_0x4ad4f7,_0x503a44){return db['ChatQueue']['describe']()['then'](respondWithResult(_0x503a44,null))[_0x1a36('0x57')](handleError(_0x503a44,null));};exports[_0x1a36('0x68')]=function(_0x26d7d1,_0x2018dd,_0x1c4961){var _0x3ecfa2={'raw':!![],'where':{}},_0xa616b8={},_0x349167;return db['ChatQueue'][_0x1a36('0x69')]({'where':{'id':_0x26d7d1[_0x1a36('0x59')]['id']}})['then'](handleEntityNotFound(_0x2018dd,null))[_0x1a36('0x1e')](function(_0x39b4fc){if(_0x39b4fc){_0x349167=_0x39b4fc[_0x1a36('0x37')]({'plain':!![]});_0xa616b8[_0x1a36('0x45')]=_[_0x1a36('0x5a')](db[_0x1a36('0x6a')][_0x1a36('0x3e')]);_0xa616b8['query']=_[_0x1a36('0x5a')](_0x26d7d1[_0x1a36('0x43')]);_0xa616b8[_0x1a36('0x44')]=_[_0x1a36('0x47')](_0xa616b8[_0x1a36('0x45')],_0xa616b8[_0x1a36('0x43')]);_0x3ecfa2['attributes']=_['intersection'](_0xa616b8['model'],qs[_0x1a36('0x48')](_0x26d7d1['query'][_0x1a36('0x48')]));_0x3ecfa2[_0x1a36('0x46')]=_0x3ecfa2[_0x1a36('0x46')][_0x1a36('0x49')]?_0x3ecfa2[_0x1a36('0x46')]:_0xa616b8[_0x1a36('0x45')];if(!_0x26d7d1[_0x1a36('0x43')][_0x1a36('0x4a')](_0x1a36('0x4b'))){_0x3ecfa2[_0x1a36('0x2f')]=qs[_0x1a36('0x2f')](_0x26d7d1[_0x1a36('0x43')][_0x1a36('0x2f')]);_0x3ecfa2[_0x1a36('0x2d')]=qs[_0x1a36('0x2d')](_0x26d7d1[_0x1a36('0x43')]['offset']);}_0x3ecfa2['order']=qs[_0x1a36('0x4d')](_0x26d7d1[_0x1a36('0x43')][_0x1a36('0x4d')]);_0x3ecfa2['where']=qs['filters'](_[_0x1a36('0x4e')](_0x26d7d1[_0x1a36('0x43')],_0xa616b8['filters']));_0x3ecfa2[_0x1a36('0x51')][_0x1a36('0x6b')]=_0x39b4fc['id'];if(_0x26d7d1[_0x1a36('0x43')]['filter']){_0x3ecfa2[_0x1a36('0x51')]=_[_0x1a36('0x50')](_0x3ecfa2['where'],{'$or':_['map'](_0x3ecfa2['attributes'],function(_0x2d2e5c){var _0x53c431={};_0x53c431[_0x2d2e5c]={'$like':'%'+_0x26d7d1['query'][_0x1a36('0x4f')]+'%'};return _0x53c431;})});}_0x3ecfa2=_[_0x1a36('0x50')]({},_0x3ecfa2,_0x26d7d1['options']);return db[_0x1a36('0x6a')][_0x1a36('0x55')](_0x3ecfa2);}})[_0x1a36('0x1e')](function(_0x214d33){if(_0x214d33){return db['User'][_0x1a36('0x6c')]({'where':{'id':_['map'](_0x214d33,_0x1a36('0x6d')),'role':_0x1a36('0x6e')},'attributes':['id','name',_0x1a36('0x6f'),_0x1a36('0x70'),'createdAt']});}})[_0x1a36('0x1e')](function(_0x563fae){if(_0x563fae){return{'count':_0x563fae[_0x1a36('0x30')],'rows':_['map'](_0x563fae[_0x1a36('0x56')],function(_0x5b03dd){return{'membername':_0x5b03dd[_0x1a36('0x3b')],'UserId':_0x5b03dd['id'],'queue_name':_0x349167[_0x1a36('0x3b')],'ChatQueueId':_0x349167['id'],'interface':util[_0x1a36('0x71')](_0x1a36('0x72'),_0x1a36('0x73'),_0x5b03dd[_0x1a36('0x3b')]),'penalty':0x0,'paused':_0x5b03dd[_0x1a36('0x6f')],'createdAt':_0x5b03dd[_0x1a36('0x74')],'updatedAt':_0x5b03dd[_0x1a36('0x70')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2018dd,_0x3ecfa2))[_0x1a36('0x57')](handleError(_0x2018dd,null));};exports['getTeams']=function(_0x26af21,_0x25d98a,_0x300bd5){var _0x57ec30={};var _0x460c2d={};var _0x11408f;var _0xb093fe;return db[_0x1a36('0x3d')][_0x1a36('0x69')]({'where':{'id':_0x26af21[_0x1a36('0x59')]['id']}})['then'](handleEntityNotFound(_0x25d98a,null))['then'](function(_0x118d12){if(_0x118d12){_0x11408f=_0x118d12;_0x460c2d[_0x1a36('0x45')]=_['keys'](db[_0x1a36('0x75')][_0x1a36('0x3e')]);_0x460c2d['query']=_[_0x1a36('0x5a')](_0x26af21[_0x1a36('0x43')]);_0x460c2d[_0x1a36('0x44')]=_[_0x1a36('0x47')](_0x460c2d[_0x1a36('0x45')],_0x460c2d['query']);_0x57ec30[_0x1a36('0x46')]=_[_0x1a36('0x47')](_0x460c2d[_0x1a36('0x45')],qs[_0x1a36('0x48')](_0x26af21[_0x1a36('0x43')][_0x1a36('0x48')]));_0x57ec30['attributes']=_0x57ec30[_0x1a36('0x46')][_0x1a36('0x49')]?_0x57ec30[_0x1a36('0x46')]:_0x460c2d['model'];_0x57ec30['order']=qs['sort'](_0x26af21['query'][_0x1a36('0x4d')]);_0x57ec30['where']=qs[_0x1a36('0x44')](_['pick'](_0x26af21[_0x1a36('0x43')],_0x460c2d['filters']));if(_0x26af21[_0x1a36('0x43')][_0x1a36('0x4f')]){_0x57ec30[_0x1a36('0x51')]=_[_0x1a36('0x50')](_0x57ec30[_0x1a36('0x51')],{'$or':_[_0x1a36('0x42')](_0x57ec30[_0x1a36('0x46')],function(_0x2f6074){var _0x4eeb6a={};_0x4eeb6a[_0x2f6074]={'$like':'%'+_0x26af21[_0x1a36('0x43')][_0x1a36('0x4f')]+'%'};return _0x4eeb6a;})});}_0x57ec30=_[_0x1a36('0x50')]({},_0x57ec30,_0x26af21[_0x1a36('0x53')]);return _0x11408f[_0x1a36('0x76')](_0x57ec30);}})['then'](function(_0x2de479){if(_0x2de479){_0xb093fe=_0x2de479[_0x1a36('0x49')];if(!_0x26af21['query']['hasOwnProperty']('nolimit')){_0x57ec30[_0x1a36('0x2f')]=qs[_0x1a36('0x2f')](_0x26af21[_0x1a36('0x43')][_0x1a36('0x2f')]);_0x57ec30[_0x1a36('0x2d')]=qs[_0x1a36('0x2d')](_0x26af21[_0x1a36('0x43')][_0x1a36('0x2d')]);}return _0x11408f[_0x1a36('0x76')](_0x57ec30);}})['then'](function(_0x581ef5){if(_0x581ef5){return _0x581ef5?{'count':_0xb093fe,'rows':_0x581ef5}:null;}})[_0x1a36('0x1e')](respondWithResult(_0x25d98a,null))[_0x1a36('0x57')](handleError(_0x25d98a,null));};exports[_0x1a36('0x77')]=function(_0x4497ba,_0x179b43,_0x5a2862){var _0x1599ee=_0x4497ba[_0x1a36('0x5e')][_0x1a36('0x78')];return db[_0x1a36('0x75')]['findAll']({'where':{'id':_0x1599ee},'attributes':['id'],'include':[{'model':db[_0x1a36('0x79')],'as':_0x1a36('0x7a'),'attributes':['id',_0x1a36('0x3b'),_0x1a36('0x7b'),_0x1a36('0x7c'),_0x1a36('0x7d')],'raw':!![]}]})['then'](function(_0x535b88){if(_0x535b88){var _0x2f6810=_['flatMap'](_0x535b88,function(_0x582b3f){var _0x435b0e=_0x582b3f[_0x1a36('0x37')]({'plain':!![]});return _0x435b0e[_0x1a36('0x7a')];});return db['ChatQueue'][_0x1a36('0x5c')]({'where':{'id':_0x4497ba['params']['id']}})['then'](function(_0x270293){return db['sequelize'][_0x1a36('0x7e')](function(_0x17ee18){return _0x270293[_0x1a36('0x77')](_0x1599ee,{'transaction':_0x17ee18})['then'](function(){return BPromise['each'](_0x2f6810,function(_0x5a0eeb){return db[_0x1a36('0x6a')][_0x1a36('0x7f')]({'where':{'UserId':_0x5a0eeb['id'],'ChatQueueId':_0x4497ba[_0x1a36('0x59')]['id']},'transaction':_0x17ee18});});})[_0x1a36('0x1e')](function(){_0x2f6810[_0x1a36('0x80')](function(_0x2871fc){socket['emit'](_0x1a36('0x81'),{'UserId':_0x2871fc['id'],'ChatQueueId':_0x270293['id']});});});});});}})['then'](respondWithStatusCode(_0x179b43,null))[_0x1a36('0x57')](handleError(_0x179b43,null));};exports[_0x1a36('0x82')]=function(_0x40ad39,_0x58f26f,_0x30153d){return db[_0x1a36('0x75')][_0x1a36('0x55')]({'where':{'id':_0x40ad39['query'][_0x1a36('0x78')]},'attributes':['id'],'include':[{'model':db[_0x1a36('0x79')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1a36('0x1e')](handleEntityNotFound(_0x58f26f,null))['then'](function(_0x2db58c){var _0x30100a=_['map'](_0x2db58c,'id');var _0x487800=[];var _0x3222f4=[];var _0x44a286=squel[_0x1a36('0x83')]();_0x44a286[_0x1a36('0x84')](_0x1a36('0x85'))[_0x1a36('0x86')](_0x1a36('0x87'),'tq')[_0x1a36('0x88')](_0x1a36('0x89'),'ut',_0x1a36('0x8a'))[_0x1a36('0x51')]('ChatQueueId\x20=\x20?',_0x40ad39[_0x1a36('0x59')]['id']);for(var _0x522264=0x0;_0x522264<_0x2db58c[_0x1a36('0x49')];_0x522264+=0x1){let _0x3e984c=_0x2db58c[_0x522264];for(var _0x3912f0=0x0;_0x3912f0<_0x3e984c['Agents'][_0x1a36('0x49')];_0x3912f0+=0x1){let _0x5388d6=_0x3e984c[_0x1a36('0x7a')][_0x3912f0];var _0x273c87=_0x44a286[_0x1a36('0x8b')]();_0x273c87[_0x1a36('0x51')](_0x1a36('0x8c'),_0x5388d6['id']);_0x3222f4[_0x1a36('0x8d')](db[_0x1a36('0x8e')][_0x1a36('0x43')](_0x273c87['toString'](),{'type':db[_0x1a36('0x8e')][_0x1a36('0x8f')][_0x1a36('0x90')]})['then'](function(_0x3e3bb8){if(_0x3e3bb8['length']===0x1){return _0x5388d6['id'];}else{var _0x12e728=_[_0x1a36('0x91')](_[_0x1a36('0x42')](_0x3e3bb8,'TeamId'),function(_0x2c9b92){return _[_0x1a36('0x92')](_0x30100a,_0x2c9b92);});if(_0x12e728){return _0x5388d6['id'];}}}));}}return BPromise[_0x1a36('0x93')](_0x3222f4)[_0x1a36('0x1e')](function(_0x25008f){_0x487800=_(_0x487800)['union'](_0x25008f)[_0x1a36('0x94')]()[_0x1a36('0x95')]();return db[_0x1a36('0x3d')][_0x1a36('0x5c')]({'where':{'id':_0x40ad39[_0x1a36('0x59')]['id']}})[_0x1a36('0x1e')](function(_0xd590ed){return db['sequelize'][_0x1a36('0x7e')](function(_0x419f0b){return _0xd590ed[_0x1a36('0x82')](_0x40ad39['query'][_0x1a36('0x78')],{'transaction':_0x419f0b})[_0x1a36('0x1e')](function(){if(!_['isEmpty'](_0x487800)){return _0xd590ed[_0x1a36('0x96')](_0x487800,{'transaction':_0x419f0b});}})['then'](function(){_0x487800['forEach'](function(_0x988f89){socket['emit'](_0x1a36('0x97'),{'UserId':_0x988f89,'ChatQueueId':_0xd590ed['id']});});});});});});})[_0x1a36('0x1e')](respondWithStatusCode(_0x58f26f,null))[_0x1a36('0x57')](handleError(_0x58f26f,null));};exports['addAgents']=function(_0x5e66a6,_0x345675,_0x110eb8){return db['ChatQueue'][_0x1a36('0x5c')]({'where':{'id':_0x5e66a6['params']['id']}})[_0x1a36('0x1e')](handleEntityNotFound(_0x345675,null))[_0x1a36('0x1e')](function(_0x1b4eb8){if(_0x1b4eb8){return _0x1b4eb8[_0x1a36('0x98')](_0x5e66a6[_0x1a36('0x5e')][_0x1a36('0x78')],_[_0x1a36('0x99')](_0x5e66a6[_0x1a36('0x5e')],[_0x1a36('0x78'),'id'])||{})[_0x1a36('0x9a')](function(_0x1cb881){for(var _0x321639=0x0;_0x321639<_0x5e66a6[_0x1a36('0x5e')][_0x1a36('0x78')][_0x1a36('0x49')];_0x321639+=0x1){socket[_0x1a36('0x9b')]('userChatQueue:save',{'UserId':Number(_0x5e66a6[_0x1a36('0x5e')][_0x1a36('0x78')][_0x321639]),'ChatQueueId':Number(_0x5e66a6[_0x1a36('0x59')]['id'])});}return _0x1cb881;});}})[_0x1a36('0x1e')](respondWithResult(_0x345675,null))[_0x1a36('0x57')](handleError(_0x345675,null));};exports[_0x1a36('0x96')]=function(_0x455d7e,_0x34dd12,_0xac83f6){return db[_0x1a36('0x3d')][_0x1a36('0x5c')]({'where':{'id':_0x455d7e['params']['id']}})[_0x1a36('0x1e')](handleEntityNotFound(_0x34dd12,null))[_0x1a36('0x1e')](function(_0x40308a){if(_0x40308a){return _0x40308a[_0x1a36('0x96')](_0x455d7e['query'][_0x1a36('0x78')])[_0x1a36('0x1e')](function(){if(_[_0x1a36('0x9c')](_0x455d7e[_0x1a36('0x43')][_0x1a36('0x78')])){for(var _0x574ca3=0x0;_0x574ca3<_0x455d7e[_0x1a36('0x43')]['ids'][_0x1a36('0x49')];_0x574ca3+=0x1){socket[_0x1a36('0x9b')](_0x1a36('0x97'),{'UserId':Number(_0x455d7e[_0x1a36('0x43')]['ids'][_0x574ca3]),'ChatQueueId':Number(_0x455d7e['params']['id'])});}}else{socket[_0x1a36('0x9b')]('userChatQueue:remove',{'UserId':Number(_0x455d7e[_0x1a36('0x43')][_0x1a36('0x78')]),'ChatQueueId':Number(_0x455d7e[_0x1a36('0x59')]['id'])});}});}})[_0x1a36('0x1e')](respondWithStatusCode(_0x34dd12,null))[_0x1a36('0x57')](handleError(_0x34dd12,null));};exports['getAgents']=function(_0x1690af,_0x2b6304,_0x5012f5){var _0x537233={};var _0x5bd3b3={};var _0x25dc30;var _0x5e60b7;return db['ChatQueue']['findOne']({'where':{'id':_0x1690af[_0x1a36('0x59')]['id']}})[_0x1a36('0x1e')](handleEntityNotFound(_0x2b6304,null))['then'](function(_0x4f01fd){if(_0x4f01fd){_0x25dc30=_0x4f01fd;_0x5bd3b3[_0x1a36('0x45')]=_[_0x1a36('0x5a')](db[_0x1a36('0x79')][_0x1a36('0x3e')]);_0x5bd3b3[_0x1a36('0x43')]=_[_0x1a36('0x5a')](_0x1690af[_0x1a36('0x43')]);_0x5bd3b3['filters']=_[_0x1a36('0x47')](_0x5bd3b3[_0x1a36('0x45')],_0x5bd3b3[_0x1a36('0x43')]);_0x537233[_0x1a36('0x46')]=_[_0x1a36('0x47')](_0x5bd3b3[_0x1a36('0x45')],qs[_0x1a36('0x48')](_0x1690af[_0x1a36('0x43')][_0x1a36('0x48')]));_0x537233[_0x1a36('0x46')]=_0x537233['attributes'][_0x1a36('0x49')]?_0x537233[_0x1a36('0x46')]:_0x5bd3b3['model'];_0x537233[_0x1a36('0x4c')]=qs[_0x1a36('0x4d')](_0x1690af[_0x1a36('0x43')][_0x1a36('0x4d')]);_0x537233[_0x1a36('0x51')]=qs[_0x1a36('0x44')](_['pick'](_0x1690af['query'],_0x5bd3b3[_0x1a36('0x44')]));if(_0x1690af[_0x1a36('0x43')][_0x1a36('0x4f')]){_0x537233[_0x1a36('0x51')]=_['merge'](_0x537233[_0x1a36('0x51')],{'$or':_['map'](_0x537233[_0x1a36('0x46')],function(_0x55ce7f){var _0x51d301={};_0x51d301[_0x55ce7f]={'$like':'%'+_0x1690af[_0x1a36('0x43')][_0x1a36('0x4f')]+'%'};return _0x51d301;})});}_0x537233=_[_0x1a36('0x50')]({},_0x537233,_0x1690af[_0x1a36('0x53')]);return _0x25dc30['getAgents'](_0x537233);}})[_0x1a36('0x1e')](function(_0x5f0796){if(_0x5f0796){_0x5e60b7=_0x5f0796[_0x1a36('0x49')];if(!_0x1690af[_0x1a36('0x43')][_0x1a36('0x4a')](_0x1a36('0x4b'))){_0x537233['limit']=qs[_0x1a36('0x2f')](_0x1690af['query'][_0x1a36('0x2f')]);_0x537233['offset']=qs[_0x1a36('0x2d')](_0x1690af[_0x1a36('0x43')][_0x1a36('0x2d')]);}return _0x25dc30['getAgents'](_0x537233);}})[_0x1a36('0x1e')](function(_0x558ca9){if(_0x558ca9){return _0x558ca9?{'count':_0x5e60b7,'rows':_0x558ca9}:null;}})[_0x1a36('0x1e')](respondWithResult(_0x2b6304,null))[_0x1a36('0x57')](handleError(_0x2b6304,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 6848ea1..4202897 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 _0xcef6=['exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x28d91c,_0x3f0c1f){var _0x513ffc=function(_0xbc3ef5){while(--_0xbc3ef5){_0x28d91c['push'](_0x28d91c['shift']());}};_0x513ffc(++_0x3f0c1f);}(_0xcef6,0xa3));var _0x6cef=function(_0x29fc2c,_0x4ff86a){_0x29fc2c=_0x29fc2c-0x0;var _0x1adbc8=_0xcef6[_0x29fc2c];return _0x1adbc8;};'use strict';var EventEmitter=require(_0x6cef('0x0'));var ChatQueue=require(_0x6cef('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6cef('0x2')](0x0);var events={'afterCreate':_0x6cef('0x3'),'afterUpdate':'update','afterDestroy':_0x6cef('0x4')};function emitEvent(_0x1e2d4f){return function(_0x46462a,_0x424cf9,_0x36fd54){ChatQueueEvents[_0x6cef('0x5')](_0x1e2d4f+':'+_0x46462a['id'],_0x46462a);ChatQueueEvents[_0x6cef('0x5')](_0x1e2d4f,_0x46462a);_0x36fd54(null);};}for(var e in events){if(events[_0x6cef('0x6')](e)){var event=events[e];ChatQueue[_0x6cef('0x7')](e,emitEvent(event));}}module[_0x6cef('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xdd92=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x2951b9,_0x4dea6e){var _0x514c7b=function(_0x10c7bc){while(--_0x10c7bc){_0x2951b9['push'](_0x2951b9['shift']());}};_0x514c7b(++_0x4dea6e);}(_0xdd92,0x188));var _0x2dd9=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xdd92[_0x5a776b];return _0xbbef59;};'use strict';var EventEmitter=require(_0x2dd9('0x0'));var ChatQueue=require(_0x2dd9('0x1'))['db'][_0x2dd9('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x2dd9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2dd9('0x4'),'afterDestroy':_0x2dd9('0x5')};function emitEvent(_0x55beb9){return function(_0x439efd,_0x481ac9,_0x1aae6c){ChatQueueEvents[_0x2dd9('0x6')](_0x55beb9+':'+_0x439efd['id'],_0x439efd);ChatQueueEvents[_0x2dd9('0x6')](_0x55beb9,_0x439efd);_0x1aae6c(null);};}for(var e in events){if(events[_0x2dd9('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x2dd9('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 14a1598..f791d37 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 _0x03f9=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','chat_queues','lodash'];(function(_0x2132a3,_0x4639e9){var _0x21890c=function(_0x34b73d){while(--_0x34b73d){_0x2132a3['push'](_0x2132a3['shift']());}};_0x21890c(++_0x4639e9);}(_0x03f9,0x1e9));var _0x903f=function(_0x3986fc,_0x41fd49){_0x3986fc=_0x3986fc-0x0;var _0x514bd1=_0x03f9[_0x3986fc];return _0x514bd1;};'use strict';var _=require(_0x903f('0x0'));var util=require(_0x903f('0x1'));var logger=require(_0x903f('0x2'))(_0x903f('0x3'));var moment=require(_0x903f('0x4'));var BPromise=require('bluebird');var rp=require(_0x903f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x903f('0x6'));var config=require(_0x903f('0x7'));var attributes=require('./chatQueue.attributes');module[_0x903f('0x8')]=function(_0x1acc50,_0x46e110){return _0x1acc50['define']('ChatQueue',attributes,{'tableName':_0x903f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d50=['request-promise','path','rimraf','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','api','moment','bluebird'];(function(_0x4003e2,_0x2233f9){var _0x3d7ed0=function(_0x4e4793){while(--_0x4e4793){_0x4003e2['push'](_0x4003e2['shift']());}};_0x3d7ed0(++_0x2233f9);}(_0x1d50,0xe5));var _0x01d5=function(_0x56b123,_0x21f4ca){_0x56b123=_0x56b123-0x0;var _0x264d98=_0x1d50[_0x56b123];return _0x264d98;};'use strict';var _=require(_0x01d5('0x0'));var util=require(_0x01d5('0x1'));var logger=require('../../config/logger')(_0x01d5('0x2'));var moment=require(_0x01d5('0x3'));var BPromise=require(_0x01d5('0x4'));var rp=require(_0x01d5('0x5'));var fs=require('fs');var path=require(_0x01d5('0x6'));var rimraf=require(_0x01d5('0x7'));var config=require('../../config/environment');var attributes=require(_0x01d5('0x8'));module[_0x01d5('0x9')]=function(_0x34f297,_0x4d359a){return _0x34f297[_0x01d5('0xa')](_0x01d5('0xb'),attributes,{'tableName':_0x01d5('0xc'),'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 5b81574..93cd4f9 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 _0xf485=['./chatQueue.socket','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetChatQueue','findAll','options','attributes','map','include','model','stringify','ShowChatQueue','ChatQueue','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','socket.io-emitter'];(function(_0x1a89bf,_0x769e66){var _0x5ca759=function(_0x1d1f16){while(--_0x1d1f16){_0x1a89bf['push'](_0x1a89bf['shift']());}};_0x5ca759(++_0x769e66);}(_0xf485,0xd1));var _0x5f48=function(_0x268b73,_0x3034c1){_0x268b73=_0x268b73-0x0;var _0x313765=_0xf485[_0x268b73];return _0x313765;};'use strict';var _=require(_0x5f48('0x0'));var util=require(_0x5f48('0x1'));var moment=require(_0x5f48('0x2'));var BPromise=require(_0x5f48('0x3'));var rs=require(_0x5f48('0x4'));var fs=require('fs');var Redis=require(_0x5f48('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f48('0x6'));var logger=require(_0x5f48('0x7'))('rpc');var config=require(_0x5f48('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5f48('0x9')]['http']({'port':0x232a});config[_0x5f48('0xa')]=_[_0x5f48('0xb')](config[_0x5f48('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f48('0xc'))(new Redis(config[_0x5f48('0xa')]));require(_0x5f48('0xd'))['register'](socket);function respondWithRpcPromise(_0x24aead,_0x2b51a2,_0xe7b231){return new BPromise(function(_0x1b1be7,_0x31f25a){return client['request'](_0x24aead,_0xe7b231)[_0x5f48('0xe')](function(_0x2a650e){logger[_0x5f48('0xf')](_0x5f48('0x10'),_0x2b51a2,_0x5f48('0x11'));logger[_0x5f48('0x12')](_0x5f48('0x13'),_0x2b51a2,'request\x20sent',JSON['stringify'](_0x2a650e));if(_0x2a650e['error']){if(_0x2a650e[_0x5f48('0x14')][_0x5f48('0x15')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x2b51a2,_0x2a650e[_0x5f48('0x14')]['message']);return _0x31f25a(_0x2a650e[_0x5f48('0x14')]['message']);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x2b51a2,_0x2a650e['error'][_0x5f48('0x16')]);return _0x1b1be7(_0x2a650e['error'][_0x5f48('0x16')]);}else{logger['info'](_0x5f48('0x10'),_0x2b51a2,_0x5f48('0x11'));_0x1b1be7(_0x2a650e['result'][_0x5f48('0x16')]);}})[_0x5f48('0x17')](function(_0x3acd22){logger['error'](_0x5f48('0x10'),_0x2b51a2,_0x3acd22);_0x31f25a(_0x3acd22);});});}exports[_0x5f48('0x18')]=function(_0x434698){var _0x3fbea5=this;return new Promise(function(_0x54365f,_0x34557d){return db['ChatQueue'][_0x5f48('0x19')]({'raw':_0x434698[_0x5f48('0x1a')]?_0x434698[_0x5f48('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x434698[_0x5f48('0x1a')]?_0x434698[_0x5f48('0x1a')]['where']||null:null,'attributes':_0x434698['options']?_0x434698[_0x5f48('0x1a')][_0x5f48('0x1b')]||null:null,'limit':_0x434698[_0x5f48('0x1a')]?_0x434698[_0x5f48('0x1a')]['limit']||null:null,'include':_0x434698[_0x5f48('0x1a')]?_0x434698[_0x5f48('0x1a')]['include']?_[_0x5f48('0x1c')](_0x434698[_0x5f48('0x1a')][_0x5f48('0x1d')],function(_0x3fbe4a){return{'model':db[_0x3fbe4a[_0x5f48('0x1e')]],'as':_0x3fbe4a['as'],'attributes':_0x3fbe4a['attributes'],'include':_0x3fbe4a[_0x5f48('0x1d')]?_[_0x5f48('0x1c')](_0x3fbe4a[_0x5f48('0x1d')],function(_0x55a9ff){return{'model':db[_0x55a9ff['model']],'as':_0x55a9ff['as'],'attributes':_0x55a9ff[_0x5f48('0x1b')],'include':_0x55a9ff[_0x5f48('0x1d')]?_[_0x5f48('0x1c')](_0x55a9ff[_0x5f48('0x1d')],function(_0x477b9d){return{'model':db[_0x477b9d['model']],'as':_0x477b9d['as'],'attributes':_0x477b9d[_0x5f48('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5f48('0xe')](function(_0x2f4a73){logger[_0x5f48('0xf')](_0x5f48('0x18'),_0x434698);logger[_0x5f48('0x12')](_0x5f48('0x18'),_0x434698,JSON[_0x5f48('0x1f')](_0x2f4a73));_0x54365f(_0x2f4a73);})[_0x5f48('0x17')](function(_0x3cf18f){logger[_0x5f48('0x14')]('GetChatQueue',_0x3cf18f['message'],_0x434698);_0x34557d(_0x3fbea5[_0x5f48('0x14')](0x1f4,_0x3cf18f[_0x5f48('0x16')]));});});};exports[_0x5f48('0x20')]=function(_0x2adc71){var _0x359280=this;return new Promise(function(_0x1a11c0,_0x4aeaea){return db[_0x5f48('0x21')][_0x5f48('0x22')]({'raw':_0x2adc71[_0x5f48('0x1a')]?_0x2adc71['options'][_0x5f48('0x23')]===undefined?!![]:![]:!![],'where':_0x2adc71[_0x5f48('0x1a')]?_0x2adc71[_0x5f48('0x1a')][_0x5f48('0x24')]||null:null,'attributes':_0x2adc71['options']?_0x2adc71[_0x5f48('0x1a')][_0x5f48('0x1b')]||null:null,'include':_0x2adc71[_0x5f48('0x1a')]?_0x2adc71['options'][_0x5f48('0x1d')]?_[_0x5f48('0x1c')](_0x2adc71[_0x5f48('0x1a')][_0x5f48('0x1d')],function(_0x1b3196){return{'model':db[_0x1b3196[_0x5f48('0x1e')]],'as':_0x1b3196['as'],'attributes':_0x1b3196[_0x5f48('0x1b')],'include':_0x1b3196[_0x5f48('0x1d')]?_[_0x5f48('0x1c')](_0x1b3196[_0x5f48('0x1d')],function(_0x329e9b){return{'model':db[_0x329e9b[_0x5f48('0x1e')]],'as':_0x329e9b['as'],'attributes':_0x329e9b[_0x5f48('0x1b')],'include':_0x329e9b[_0x5f48('0x1d')]?_[_0x5f48('0x1c')](_0x329e9b[_0x5f48('0x1d')],function(_0x19f373){return{'model':db[_0x19f373[_0x5f48('0x1e')]],'as':_0x19f373['as'],'attributes':_0x19f373['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f48('0xe')](function(_0x5cd9ac){logger[_0x5f48('0xf')](_0x5f48('0x20'),_0x2adc71);logger[_0x5f48('0x12')](_0x5f48('0x20'),_0x2adc71,JSON['stringify'](_0x5cd9ac));_0x1a11c0(_0x5cd9ac);})['catch'](function(_0x3295ba){logger[_0x5f48('0x14')](_0x5f48('0x20'),_0x3295ba[_0x5f48('0x16')],_0x2adc71);_0x4aeaea(_0x359280[_0x5f48('0x14')](0x1f4,_0x3295ba['message']));});});}; \ No newline at end of file +var _0x5630=['findAll','options','raw','limit','include','model','map','attributes','ShowChatQueue','ChatQueue','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x5630,0xc3));var _0x0563=function(_0x31dc2e,_0x4d06bb){_0x31dc2e=_0x31dc2e-0x0;var _0x69a8c3=_0x5630[_0x31dc2e];return _0x69a8c3;};'use strict';var _=require(_0x0563('0x0'));var util=require(_0x0563('0x1'));var moment=require(_0x0563('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0563('0x3'))['db'];var utils=require(_0x0563('0x4'));var logger=require(_0x0563('0x5'))(_0x0563('0x6'));var config=require(_0x0563('0x7'));var jayson=require(_0x0563('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x0563('0x9')]=_[_0x0563('0xa')](config[_0x0563('0x9')],{'host':_0x0563('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0563('0x9')]));require(_0x0563('0xc'))[_0x0563('0xd')](socket);function respondWithRpcPromise(_0x445068,_0x2ceffe,_0x1f7ac6){return new BPromise(function(_0x715076,_0x38c2b3){return client['request'](_0x445068,_0x1f7ac6)[_0x0563('0xe')](function(_0x15ed13){logger[_0x0563('0xf')](_0x0563('0x10'),_0x2ceffe,_0x0563('0x11'));logger[_0x0563('0x12')](_0x0563('0x13'),_0x2ceffe,_0x0563('0x11'),JSON[_0x0563('0x14')](_0x15ed13));if(_0x15ed13[_0x0563('0x15')]){if(_0x15ed13[_0x0563('0x15')][_0x0563('0x16')]===0x1f4){logger['error'](_0x0563('0x10'),_0x2ceffe,_0x15ed13[_0x0563('0x15')][_0x0563('0x17')]);return _0x38c2b3(_0x15ed13[_0x0563('0x15')]['message']);}logger['error'](_0x0563('0x10'),_0x2ceffe,_0x15ed13['error'][_0x0563('0x17')]);return _0x715076(_0x15ed13[_0x0563('0x15')]['message']);}else{logger[_0x0563('0xf')]('ChatQueue,\x20%s,\x20%s',_0x2ceffe,_0x0563('0x11'));_0x715076(_0x15ed13[_0x0563('0x18')][_0x0563('0x17')]);}})[_0x0563('0x19')](function(_0x5a3ace){logger[_0x0563('0x15')](_0x0563('0x10'),_0x2ceffe,_0x5a3ace);_0x38c2b3(_0x5a3ace);});});}exports[_0x0563('0x1a')]=function(_0x3e6bde){var _0xd8612d=this;return new Promise(function(_0x5f2636,_0x530d4b){return db['ChatQueue'][_0x0563('0x1b')]({'raw':_0x3e6bde[_0x0563('0x1c')]?_0x3e6bde[_0x0563('0x1c')][_0x0563('0x1d')]===undefined?!![]:![]:!![],'where':_0x3e6bde[_0x0563('0x1c')]?_0x3e6bde[_0x0563('0x1c')]['where']||null:null,'attributes':_0x3e6bde['options']?_0x3e6bde['options']['attributes']||null:null,'limit':_0x3e6bde['options']?_0x3e6bde['options'][_0x0563('0x1e')]||null:null,'include':_0x3e6bde[_0x0563('0x1c')]?_0x3e6bde['options']['include']?_['map'](_0x3e6bde[_0x0563('0x1c')][_0x0563('0x1f')],function(_0x592d4d){return{'model':db[_0x592d4d[_0x0563('0x20')]],'as':_0x592d4d['as'],'attributes':_0x592d4d['attributes'],'include':_0x592d4d['include']?_[_0x0563('0x21')](_0x592d4d[_0x0563('0x1f')],function(_0x5449c5){return{'model':db[_0x5449c5[_0x0563('0x20')]],'as':_0x5449c5['as'],'attributes':_0x5449c5[_0x0563('0x22')],'include':_0x5449c5[_0x0563('0x1f')]?_[_0x0563('0x21')](_0x5449c5[_0x0563('0x1f')],function(_0x2944ea){return{'model':db[_0x2944ea['model']],'as':_0x2944ea['as'],'attributes':_0x2944ea[_0x0563('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0563('0xe')](function(_0x59a355){logger['info'](_0x0563('0x1a'),_0x3e6bde);logger['debug'](_0x0563('0x1a'),_0x3e6bde,JSON[_0x0563('0x14')](_0x59a355));_0x5f2636(_0x59a355);})[_0x0563('0x19')](function(_0x2196ff){logger[_0x0563('0x15')](_0x0563('0x1a'),_0x2196ff[_0x0563('0x17')],_0x3e6bde);_0x530d4b(_0xd8612d[_0x0563('0x15')](0x1f4,_0x2196ff[_0x0563('0x17')]));});});};exports[_0x0563('0x23')]=function(_0x1829bb){var _0x13b2fe=this;return new Promise(function(_0x44330b,_0x25301c){return db[_0x0563('0x24')]['find']({'raw':_0x1829bb[_0x0563('0x1c')]?_0x1829bb['options']['raw']===undefined?!![]:![]:!![],'where':_0x1829bb[_0x0563('0x1c')]?_0x1829bb[_0x0563('0x1c')]['where']||null:null,'attributes':_0x1829bb[_0x0563('0x1c')]?_0x1829bb[_0x0563('0x1c')][_0x0563('0x22')]||null:null,'include':_0x1829bb[_0x0563('0x1c')]?_0x1829bb[_0x0563('0x1c')]['include']?_[_0x0563('0x21')](_0x1829bb['options'][_0x0563('0x1f')],function(_0x2186eb){return{'model':db[_0x2186eb[_0x0563('0x20')]],'as':_0x2186eb['as'],'attributes':_0x2186eb[_0x0563('0x22')],'include':_0x2186eb[_0x0563('0x1f')]?_[_0x0563('0x21')](_0x2186eb[_0x0563('0x1f')],function(_0x72c1b9){return{'model':db[_0x72c1b9[_0x0563('0x20')]],'as':_0x72c1b9['as'],'attributes':_0x72c1b9[_0x0563('0x22')],'include':_0x72c1b9['include']?_[_0x0563('0x21')](_0x72c1b9[_0x0563('0x1f')],function(_0x3d8c34){return{'model':db[_0x3d8c34['model']],'as':_0x3d8c34['as'],'attributes':_0x3d8c34[_0x0563('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ddfd5){logger[_0x0563('0xf')](_0x0563('0x23'),_0x1829bb);logger[_0x0563('0x12')](_0x0563('0x23'),_0x1829bb,JSON[_0x0563('0x14')](_0x2ddfd5));_0x44330b(_0x2ddfd5);})['catch'](function(_0x1aa742){logger[_0x0563('0x15')](_0x0563('0x23'),_0x1aa742[_0x0563('0x17')],_0x1829bb);_0x25301c(_0x13b2fe[_0x0563('0x15')](0x1f4,_0x1aa742[_0x0563('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 7b7e567..1d6d821 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 _0x008c=['./chatQueue.events','save','remove','update','emit','removeListener','register','chatQueue:'];(function(_0x211f03,_0x4132a4){var _0x3e2d0c=function(_0x4a4e01){while(--_0x4a4e01){_0x211f03['push'](_0x211f03['shift']());}};_0x3e2d0c(++_0x4132a4);}(_0x008c,0x188));var _0xc008=function(_0x4b48e5,_0xc3c425){_0x4b48e5=_0x4b48e5-0x0;var _0x210b17=_0x008c[_0x4b48e5];return _0x210b17;};'use strict';var ChatQueueEvents=require(_0xc008('0x0'));var events=[_0xc008('0x1'),_0xc008('0x2'),_0xc008('0x3')];function createListener(_0x1d119a,_0x544fdf){return function(_0x3641af){_0x544fdf[_0xc008('0x4')](_0x1d119a,_0x3641af);};}function removeListener(_0x10b33c,_0x163bd9){return function(){ChatQueueEvents[_0xc008('0x5')](_0x10b33c,_0x163bd9);};}exports[_0xc008('0x6')]=function(_0x13aa7){for(var _0x39bb5e=0x0,_0x9c8cb2=events['length'];_0x39bb5e<_0x9c8cb2;_0x39bb5e++){var _0x428fa9=events[_0x39bb5e];var _0x5aa09b=createListener(_0xc008('0x7')+_0x428fa9,_0x13aa7);ChatQueueEvents['on'](_0x428fa9,_0x5aa09b);}}; \ No newline at end of file +var _0x54ef=['remove','emit','removeListener','length','./chatQueue.events','save'];(function(_0x2e2e5d,_0x24f8bf){var _0x5df15e=function(_0x595f2a){while(--_0x595f2a){_0x2e2e5d['push'](_0x2e2e5d['shift']());}};_0x5df15e(++_0x24f8bf);}(_0x54ef,0x112));var _0xf54e=function(_0x55a170,_0x55ffb2){_0x55a170=_0x55a170-0x0;var _0x2e46c9=_0x54ef[_0x55a170];return _0x2e46c9;};'use strict';var ChatQueueEvents=require(_0xf54e('0x0'));var events=[_0xf54e('0x1'),_0xf54e('0x2'),'update'];function createListener(_0xd936f7,_0x18b7d6){return function(_0x18b1cf){_0x18b7d6[_0xf54e('0x3')](_0xd936f7,_0x18b1cf);};}function removeListener(_0x8b6bb6,_0x431e36){return function(){ChatQueueEvents[_0xf54e('0x4')](_0x8b6bb6,_0x431e36);};}exports['register']=function(_0x55e611){for(var _0x18e84e=0x0,_0x99cf9=events[_0xf54e('0x5')];_0x18e84e<_0x99cf9;_0x18e84e++){var _0x561870=events[_0x18e84e];var _0x27e69b=createListener('chatQueue:'+_0x561870,_0x55e611);ChatQueueEvents['on'](_0x561870,_0x27e69b);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 550be93..d3ba913 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 _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x33e263,_0x2d0001){var _0x513d84=function(_0x1b3fa4){while(--_0x1b3fa4){_0x33e263['push'](_0x33e263['shift']());}};_0x513d84(++_0x2d0001);}(_0x814b,0x1a2));var _0xb814=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x814b[_0x5a2d95];return _0x2c3986;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x1ccb2b,_0x2c3a47){var _0x2080ef=function(_0x425a4a){while(--_0x425a4a){_0x1ccb2b['push'](_0x1ccb2b['shift']());}};_0x2080ef(++_0x2c3a47);}(_0x7217,0x19e));var _0x7721=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x7217[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index e8e83a8..229a63d 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 _0x6fe4=['moment','sequelize','exports','STRING','DATE'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x6fe4,0xc8));var _0x46fe=function(_0x585745,_0xe0fa8c){_0x585745=_0x585745-0x0;var _0x584ec4=_0x6fe4[_0x585745];return _0x584ec4;};'use strict';var moment=require(_0x46fe('0x0'));var Sequelize=require(_0x46fe('0x1'));module[_0x46fe('0x2')]={'uniqueid':{'type':Sequelize[_0x46fe('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x46fe('0x3')]},'joinAt':{'type':Sequelize[_0x46fe('0x4')]},'leaveAt':{'type':Sequelize[_0x46fe('0x4')]},'acceptAt':{'type':Sequelize[_0x46fe('0x4')]},'exitAt':{'type':Sequelize[_0x46fe('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe767=['STRING','DATE','sequelize','exports'];(function(_0x4dd9c3,_0x25cdb9){var _0x5b808f=function(_0xfe176f){while(--_0xfe176f){_0x4dd9c3['push'](_0x4dd9c3['shift']());}};_0x5b808f(++_0x25cdb9);}(_0xe767,0x11e));var _0x7e76=function(_0x3652a0,_0x2ab9f8){_0x3652a0=_0x3652a0-0x0;var _0x2fa7d5=_0xe767[_0x3652a0];return _0x2fa7d5;};'use strict';var moment=require('moment');var Sequelize=require(_0x7e76('0x0'));module[_0x7e76('0x1')]={'uniqueid':{'type':Sequelize[_0x7e76('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7e76('0x2')]},'joinAt':{'type':Sequelize[_0x7e76('0x3')]},'leaveAt':{'type':Sequelize[_0x7e76('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7e76('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 53b6aeb..e114d96 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 _0x8212=['order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','ChatQueueReport','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit'];(function(_0x44ace3,_0x2e0ced){var _0x5148db=function(_0x40211b){while(--_0x40211b){_0x44ace3['push'](_0x44ace3['shift']());}};_0x5148db(++_0x2e0ced);}(_0x8212,0xb3));var _0x2821=function(_0x51851c,_0x1a7c28){_0x51851c=_0x51851c-0x0;var _0x2a585b=_0x8212[_0x51851c];return _0x2a585b;};'use strict';var emlformat=require(_0x2821('0x0'));var rimraf=require(_0x2821('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2821('0x2'));var rp=require(_0x2821('0x3'));var moment=require(_0x2821('0x4'));var BPromise=require(_0x2821('0x5'));var Mustache=require(_0x2821('0x6'));var util=require(_0x2821('0x7'));var path=require(_0x2821('0x8'));var sox=require(_0x2821('0x9'));var csv=require('to-csv');var ejs=require(_0x2821('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2821('0xb'));var squel=require(_0x2821('0xc'));var crypto=require('crypto');var jsforce=require(_0x2821('0xd'));var deskjs=require(_0x2821('0xe'));var toCsv=require(_0x2821('0xf'));var querystring=require(_0x2821('0x10'));var Papa=require(_0x2821('0x11'));var Redis=require(_0x2821('0x12'));var authService=require(_0x2821('0x13'));var qs=require(_0x2821('0x14'));var as=require(_0x2821('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2821('0x16'))(_0x2821('0x17'));var utils=require(_0x2821('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c81c1,_0x11d227){_0x11d227=_0x11d227||0xcc;return function(_0x18a2bb){if(_0x18a2bb){return _0x4c81c1[_0x2821('0x19')](_0x11d227);}return _0x4c81c1[_0x2821('0x1a')](_0x11d227)[_0x2821('0x1b')]();};}function respondWithResult(_0x2fbc96,_0x5d5ee5){_0x5d5ee5=_0x5d5ee5||0xc8;return function(_0x3ba091){if(_0x3ba091){return _0x2fbc96['status'](_0x5d5ee5)['json'](_0x3ba091);}};}function respondWithFilteredResult(_0x4142f1,_0xe30acf){return function(_0x243c46){if(_0x243c46){var _0x472238=typeof _0xe30acf['offset']===_0x2821('0x1c')&&typeof _0xe30acf['limit']===_0x2821('0x1c');var _0x2673d2=_0x243c46[_0x2821('0x1d')];var _0x3f1057=_0x472238?0x0:_0xe30acf[_0x2821('0x1e')];var _0x500357=_0x472238?_0x243c46[_0x2821('0x1d')]:_0xe30acf[_0x2821('0x1e')]+_0xe30acf['limit'];var _0x22990a;if(_0x500357>=_0x2673d2){_0x500357=_0x2673d2;_0x22990a=0xc8;}else{_0x22990a=0xce;}_0x4142f1['status'](_0x22990a);return _0x4142f1[_0x2821('0x1f')](_0x2821('0x20'),_0x3f1057+'-'+_0x500357+'/'+_0x2673d2)[_0x2821('0x21')](_0x243c46);}return null;};}function patchUpdates(_0x8ba96e){return function(_0x38d898){try{jsonpatch[_0x2821('0x22')](_0x38d898,_0x8ba96e,!![]);}catch(_0x1c0907){return BPromise[_0x2821('0x23')](_0x1c0907);}return _0x38d898[_0x2821('0x24')]();};}function saveUpdates(_0x1f4e4f,_0x275810){return function(_0x597d8b){if(_0x597d8b){return _0x597d8b['update'](_0x1f4e4f)[_0x2821('0x25')](function(_0x243ff2){return _0x243ff2;});}return null;};}function removeEntity(_0x2838d8,_0x279a46){return function(_0x37c669){if(_0x37c669){return _0x37c669[_0x2821('0x26')]()[_0x2821('0x25')](function(){_0x2838d8[_0x2821('0x1a')](0xcc)[_0x2821('0x1b')]();});}};}function handleEntityNotFound(_0x27cef1,_0x7a49da){return function(_0x1d2c8f){if(!_0x1d2c8f){_0x27cef1[_0x2821('0x19')](0x194);}return _0x1d2c8f;};}function handleError(_0x3ddbe7,_0x14fbd4){_0x14fbd4=_0x14fbd4||0x1f4;return function(_0x2ab3ab){logger[_0x2821('0x27')](_0x2ab3ab[_0x2821('0x28')]);if(_0x2ab3ab[_0x2821('0x29')]){delete _0x2ab3ab[_0x2821('0x29')];}_0x3ddbe7['status'](_0x14fbd4)[_0x2821('0x2a')](_0x2ab3ab);};}exports['index']=function(_0x109262,_0x4402ea){var _0x449e46={},_0x7dfdc3={},_0x5eba60={'count':0x0,'rows':[]};var _0x3ea1de=_[_0x2821('0x2b')](db['ChatQueueReport'][_0x2821('0x2c')],function(_0x2e4395){return{'name':_0x2e4395[_0x2821('0x2d')],'type':_0x2e4395['type'][_0x2821('0x2e')]};});_0x7dfdc3[_0x2821('0x2f')]=_[_0x2821('0x2b')](_0x3ea1de,_0x2821('0x29'));_0x7dfdc3[_0x2821('0x30')]=_[_0x2821('0x31')](_0x109262[_0x2821('0x30')]);_0x7dfdc3['filters']=_[_0x2821('0x32')](_0x7dfdc3[_0x2821('0x2f')],_0x7dfdc3[_0x2821('0x30')]);_0x449e46[_0x2821('0x33')]=_[_0x2821('0x32')](_0x7dfdc3[_0x2821('0x2f')],qs[_0x2821('0x34')](_0x109262[_0x2821('0x30')][_0x2821('0x34')]));_0x449e46[_0x2821('0x33')]=_0x449e46[_0x2821('0x33')]['length']?_0x449e46[_0x2821('0x33')]:_0x7dfdc3[_0x2821('0x2f')];if(!_0x109262[_0x2821('0x30')][_0x2821('0x35')]('nolimit')){_0x449e46[_0x2821('0x36')]=qs[_0x2821('0x36')](_0x109262[_0x2821('0x30')][_0x2821('0x36')]);_0x449e46[_0x2821('0x1e')]=qs[_0x2821('0x1e')](_0x109262[_0x2821('0x30')][_0x2821('0x1e')]);}_0x449e46[_0x2821('0x37')]=qs[_0x2821('0x38')](_0x109262['query'][_0x2821('0x38')]);_0x449e46[_0x2821('0x39')]=qs[_0x2821('0x3a')](_[_0x2821('0x3b')](_0x109262[_0x2821('0x30')],_0x7dfdc3['filters']),_0x3ea1de);if(_0x109262[_0x2821('0x30')]['filter']){_0x449e46['where']=_[_0x2821('0x3c')](_0x449e46[_0x2821('0x39')],{'$or':_[_0x2821('0x2b')](_0x3ea1de,function(_0x276edc){if(_0x276edc[_0x2821('0x3d')]!==_0x2821('0x3e')){var _0x210c60={};_0x210c60[_0x276edc['name']]={'$like':'%'+_0x109262['query'][_0x2821('0x3f')]+'%'};return _0x210c60;}})});}_0x449e46=_[_0x2821('0x3c')]({},_0x449e46,_0x109262[_0x2821('0x40')]);var _0x2737a7={'where':_0x449e46[_0x2821('0x39')]};return db['ChatQueueReport']['count'](_0x2737a7)[_0x2821('0x25')](function(_0x26d389){_0x5eba60[_0x2821('0x1d')]=_0x26d389;if(_0x109262[_0x2821('0x30')][_0x2821('0x41')]){_0x449e46[_0x2821('0x42')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x2821('0x43')](_0x449e46);})[_0x2821('0x25')](function(_0x4fe0cd){_0x5eba60[_0x2821('0x44')]=_0x4fe0cd;return _0x5eba60;})[_0x2821('0x25')](respondWithFilteredResult(_0x4402ea,_0x449e46))[_0x2821('0x45')](handleError(_0x4402ea,null));};exports[_0x2821('0x46')]=function(_0x20c8db,_0x4ffc43){var _0x2b2796={'raw':!![],'where':{'id':_0x20c8db[_0x2821('0x47')]['id']}},_0x8d988a={};_0x8d988a[_0x2821('0x2f')]=_['keys'](db['ChatQueueReport'][_0x2821('0x2c')]);_0x8d988a[_0x2821('0x30')]=_[_0x2821('0x31')](_0x20c8db[_0x2821('0x30')]);_0x8d988a[_0x2821('0x3a')]=_[_0x2821('0x32')](_0x8d988a[_0x2821('0x2f')],_0x8d988a['query']);_0x2b2796['attributes']=_[_0x2821('0x32')](_0x8d988a['model'],qs[_0x2821('0x34')](_0x20c8db[_0x2821('0x30')][_0x2821('0x34')]));_0x2b2796[_0x2821('0x33')]=_0x2b2796[_0x2821('0x33')][_0x2821('0x48')]?_0x2b2796[_0x2821('0x33')]:_0x8d988a['model'];if(_0x20c8db[_0x2821('0x30')][_0x2821('0x41')]){_0x2b2796[_0x2821('0x42')]=[{'all':!![]}];}_0x2b2796=_[_0x2821('0x3c')]({},_0x2b2796,_0x20c8db[_0x2821('0x40')]);return db[_0x2821('0x49')][_0x2821('0x4a')](_0x2b2796)[_0x2821('0x25')](handleEntityNotFound(_0x4ffc43,null))['then'](respondWithResult(_0x4ffc43,null))[_0x2821('0x45')](handleError(_0x4ffc43,null));};exports[_0x2821('0x4b')]=function(_0x175ef3,_0x3f370d){return db['ChatQueueReport'][_0x2821('0x4b')](_0x175ef3[_0x2821('0x4c')],{})[_0x2821('0x25')](respondWithResult(_0x3f370d,0xc9))['catch'](handleError(_0x3f370d,null));};exports['update']=function(_0x5162b3,_0x9721){if(_0x5162b3[_0x2821('0x4c')]['id']){delete _0x5162b3[_0x2821('0x4c')]['id'];}return db['ChatQueueReport'][_0x2821('0x4a')]({'where':{'id':_0x5162b3[_0x2821('0x47')]['id']}})[_0x2821('0x25')](handleEntityNotFound(_0x9721,null))[_0x2821('0x25')](saveUpdates(_0x5162b3[_0x2821('0x4c')],null))[_0x2821('0x25')](respondWithResult(_0x9721,null))['catch'](handleError(_0x9721,null));};exports['destroy']=function(_0x284b28,_0x39fcc9){return db['ChatQueueReport'][_0x2821('0x4a')]({'where':{'id':_0x284b28[_0x2821('0x47')]['id']}})[_0x2821('0x25')](handleEntityNotFound(_0x39fcc9,null))[_0x2821('0x25')](removeEntity(_0x39fcc9,null))[_0x2821('0x45')](handleError(_0x39fcc9,null));};exports[_0x2821('0x4d')]=function(_0x40fecc,_0x2e4a4d){return db[_0x2821('0x49')]['describe']()['then'](respondWithResult(_0x2e4a4d,null))['catch'](handleError(_0x2e4a4d,null));}; \ No newline at end of file +var _0xee87=['limit','count','Content-Range','apply','reject','save','update','then','destroy','name','send','ChatQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../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'];(function(_0xab9bbb,_0x20b4f6){var _0x32db1f=function(_0xe95f4e){while(--_0xe95f4e){_0xab9bbb['push'](_0xab9bbb['shift']());}};_0x32db1f(++_0x20b4f6);}(_0xee87,0x10d));var _0x7ee8=function(_0x320f8e,_0x383adc){_0x320f8e=_0x320f8e-0x0;var _0x19770d=_0xee87[_0x320f8e];return _0x19770d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ee8('0x0'));var zipdir=require(_0x7ee8('0x1'));var jsonpatch=require(_0x7ee8('0x2'));var rp=require(_0x7ee8('0x3'));var moment=require(_0x7ee8('0x4'));var BPromise=require(_0x7ee8('0x5'));var Mustache=require(_0x7ee8('0x6'));var util=require(_0x7ee8('0x7'));var path=require(_0x7ee8('0x8'));var sox=require(_0x7ee8('0x9'));var csv=require('to-csv');var ejs=require(_0x7ee8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ee8('0xb'));var squel=require(_0x7ee8('0xc'));var crypto=require(_0x7ee8('0xd'));var jsforce=require(_0x7ee8('0xe'));var deskjs=require(_0x7ee8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7ee8('0x10'));var Redis=require('ioredis');var authService=require(_0x7ee8('0x11'));var qs=require(_0x7ee8('0x12'));var as=require(_0x7ee8('0x13'));var hardwareService=require(_0x7ee8('0x14'));var logger=require(_0x7ee8('0x15'))(_0x7ee8('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7ee8('0x17'));var db=require(_0x7ee8('0x18'))['db'];function respondWithStatusCode(_0x39a4cd,_0x36e82a){_0x36e82a=_0x36e82a||0xcc;return function(_0xb4a1bc){if(_0xb4a1bc){return _0x39a4cd[_0x7ee8('0x19')](_0x36e82a);}return _0x39a4cd[_0x7ee8('0x1a')](_0x36e82a)[_0x7ee8('0x1b')]();};}function respondWithResult(_0x2a5fa3,_0x46b127){_0x46b127=_0x46b127||0xc8;return function(_0x1669d7){if(_0x1669d7){return _0x2a5fa3[_0x7ee8('0x1a')](_0x46b127)[_0x7ee8('0x1c')](_0x1669d7);}};}function respondWithFilteredResult(_0x12e853,_0x268b93){return function(_0x43f34c){if(_0x43f34c){var _0x192d8c=typeof _0x268b93[_0x7ee8('0x1d')]===_0x7ee8('0x1e')&&typeof _0x268b93[_0x7ee8('0x1f')]===_0x7ee8('0x1e');var _0x124442=_0x43f34c[_0x7ee8('0x20')];var _0x4028a7=_0x192d8c?0x0:_0x268b93[_0x7ee8('0x1d')];var _0x5c1969=_0x192d8c?_0x43f34c[_0x7ee8('0x20')]:_0x268b93['offset']+_0x268b93[_0x7ee8('0x1f')];var _0x459ad1;if(_0x5c1969>=_0x124442){_0x5c1969=_0x124442;_0x459ad1=0xc8;}else{_0x459ad1=0xce;}_0x12e853['status'](_0x459ad1);return _0x12e853['set'](_0x7ee8('0x21'),_0x4028a7+'-'+_0x5c1969+'/'+_0x124442)[_0x7ee8('0x1c')](_0x43f34c);}return null;};}function patchUpdates(_0x298430){return function(_0x15c00f){try{jsonpatch[_0x7ee8('0x22')](_0x15c00f,_0x298430,!![]);}catch(_0x49f7e0){return BPromise[_0x7ee8('0x23')](_0x49f7e0);}return _0x15c00f[_0x7ee8('0x24')]();};}function saveUpdates(_0x334b46,_0x555338){return function(_0x27bff9){if(_0x27bff9){return _0x27bff9[_0x7ee8('0x25')](_0x334b46)[_0x7ee8('0x26')](function(_0x1bcdd9){return _0x1bcdd9;});}return null;};}function removeEntity(_0x57dfaa,_0x40d420){return function(_0x273bbe){if(_0x273bbe){return _0x273bbe[_0x7ee8('0x27')]()['then'](function(){_0x57dfaa[_0x7ee8('0x1a')](0xcc)[_0x7ee8('0x1b')]();});}};}function handleEntityNotFound(_0x3118fe,_0x5ae459){return function(_0x3f9cae){if(!_0x3f9cae){_0x3118fe[_0x7ee8('0x19')](0x194);}return _0x3f9cae;};}function handleError(_0x568ea,_0x52ff5d){_0x52ff5d=_0x52ff5d||0x1f4;return function(_0x27c94c){logger['error'](_0x27c94c['stack']);if(_0x27c94c[_0x7ee8('0x28')]){delete _0x27c94c[_0x7ee8('0x28')];}_0x568ea['status'](_0x52ff5d)[_0x7ee8('0x29')](_0x27c94c);};}exports['index']=function(_0x2e31ed,_0x5e81d7){var _0x76beaa={},_0x547147={},_0xf54bb1={'count':0x0,'rows':[]};var _0x33f20e=_['map'](db[_0x7ee8('0x2a')][_0x7ee8('0x2b')],function(_0x2d8809){return{'name':_0x2d8809[_0x7ee8('0x2c')],'type':_0x2d8809[_0x7ee8('0x2d')][_0x7ee8('0x2e')]};});_0x547147[_0x7ee8('0x2f')]=_['map'](_0x33f20e,_0x7ee8('0x28'));_0x547147['query']=_[_0x7ee8('0x30')](_0x2e31ed[_0x7ee8('0x31')]);_0x547147[_0x7ee8('0x32')]=_[_0x7ee8('0x33')](_0x547147['model'],_0x547147[_0x7ee8('0x31')]);_0x76beaa[_0x7ee8('0x34')]=_['intersection'](_0x547147[_0x7ee8('0x2f')],qs[_0x7ee8('0x35')](_0x2e31ed[_0x7ee8('0x31')][_0x7ee8('0x35')]));_0x76beaa[_0x7ee8('0x34')]=_0x76beaa['attributes'][_0x7ee8('0x36')]?_0x76beaa[_0x7ee8('0x34')]:_0x547147[_0x7ee8('0x2f')];if(!_0x2e31ed['query'][_0x7ee8('0x37')]('nolimit')){_0x76beaa[_0x7ee8('0x1f')]=qs[_0x7ee8('0x1f')](_0x2e31ed['query'][_0x7ee8('0x1f')]);_0x76beaa[_0x7ee8('0x1d')]=qs[_0x7ee8('0x1d')](_0x2e31ed['query'][_0x7ee8('0x1d')]);}_0x76beaa['order']=qs[_0x7ee8('0x38')](_0x2e31ed[_0x7ee8('0x31')][_0x7ee8('0x38')]);_0x76beaa[_0x7ee8('0x39')]=qs[_0x7ee8('0x32')](_[_0x7ee8('0x3a')](_0x2e31ed[_0x7ee8('0x31')],_0x547147[_0x7ee8('0x32')]),_0x33f20e);if(_0x2e31ed[_0x7ee8('0x31')][_0x7ee8('0x3b')]){_0x76beaa[_0x7ee8('0x39')]=_[_0x7ee8('0x3c')](_0x76beaa[_0x7ee8('0x39')],{'$or':_[_0x7ee8('0x3d')](_0x33f20e,function(_0x52c56b){if(_0x52c56b['type']!==_0x7ee8('0x3e')){var _0x4d095f={};_0x4d095f[_0x52c56b[_0x7ee8('0x28')]]={'$like':'%'+_0x2e31ed[_0x7ee8('0x31')][_0x7ee8('0x3b')]+'%'};return _0x4d095f;}})});}_0x76beaa=_[_0x7ee8('0x3c')]({},_0x76beaa,_0x2e31ed[_0x7ee8('0x3f')]);var _0x1c996b={'where':_0x76beaa[_0x7ee8('0x39')]};return db[_0x7ee8('0x2a')][_0x7ee8('0x20')](_0x1c996b)[_0x7ee8('0x26')](function(_0x2017e6){_0xf54bb1[_0x7ee8('0x20')]=_0x2017e6;if(_0x2e31ed[_0x7ee8('0x31')][_0x7ee8('0x40')]){_0x76beaa[_0x7ee8('0x41')]=[{'all':!![]}];}return db[_0x7ee8('0x2a')][_0x7ee8('0x42')](_0x76beaa);})[_0x7ee8('0x26')](function(_0x1074ef){_0xf54bb1[_0x7ee8('0x43')]=_0x1074ef;return _0xf54bb1;})['then'](respondWithFilteredResult(_0x5e81d7,_0x76beaa))[_0x7ee8('0x44')](handleError(_0x5e81d7,null));};exports[_0x7ee8('0x45')]=function(_0x58a461,_0x16bd01){var _0x29e866={'raw':!![],'where':{'id':_0x58a461[_0x7ee8('0x46')]['id']}},_0x509838={};_0x509838[_0x7ee8('0x2f')]=_['keys'](db[_0x7ee8('0x2a')]['rawAttributes']);_0x509838['query']=_['keys'](_0x58a461['query']);_0x509838[_0x7ee8('0x32')]=_[_0x7ee8('0x33')](_0x509838['model'],_0x509838[_0x7ee8('0x31')]);_0x29e866[_0x7ee8('0x34')]=_[_0x7ee8('0x33')](_0x509838[_0x7ee8('0x2f')],qs[_0x7ee8('0x35')](_0x58a461[_0x7ee8('0x31')][_0x7ee8('0x35')]));_0x29e866[_0x7ee8('0x34')]=_0x29e866['attributes'][_0x7ee8('0x36')]?_0x29e866[_0x7ee8('0x34')]:_0x509838['model'];if(_0x58a461[_0x7ee8('0x31')]['includeAll']){_0x29e866['include']=[{'all':!![]}];}_0x29e866=_[_0x7ee8('0x3c')]({},_0x29e866,_0x58a461['options']);return db[_0x7ee8('0x2a')][_0x7ee8('0x47')](_0x29e866)[_0x7ee8('0x26')](handleEntityNotFound(_0x16bd01,null))['then'](respondWithResult(_0x16bd01,null))[_0x7ee8('0x44')](handleError(_0x16bd01,null));};exports['create']=function(_0xf0d68e,_0x45c08b){return db['ChatQueueReport'][_0x7ee8('0x48')](_0xf0d68e[_0x7ee8('0x49')],{})[_0x7ee8('0x26')](respondWithResult(_0x45c08b,0xc9))[_0x7ee8('0x44')](handleError(_0x45c08b,null));};exports['update']=function(_0x4f36d0,_0x46e007){if(_0x4f36d0[_0x7ee8('0x49')]['id']){delete _0x4f36d0['body']['id'];}return db[_0x7ee8('0x2a')]['find']({'where':{'id':_0x4f36d0['params']['id']}})[_0x7ee8('0x26')](handleEntityNotFound(_0x46e007,null))[_0x7ee8('0x26')](saveUpdates(_0x4f36d0[_0x7ee8('0x49')],null))[_0x7ee8('0x26')](respondWithResult(_0x46e007,null))[_0x7ee8('0x44')](handleError(_0x46e007,null));};exports[_0x7ee8('0x27')]=function(_0x34d306,_0x2e228b){return db[_0x7ee8('0x2a')][_0x7ee8('0x47')]({'where':{'id':_0x34d306['params']['id']}})[_0x7ee8('0x26')](handleEntityNotFound(_0x2e228b,null))[_0x7ee8('0x26')](removeEntity(_0x2e228b,null))['catch'](handleError(_0x2e228b,null));};exports[_0x7ee8('0x4a')]=function(_0x2d6bde,_0x5d2e84){return db[_0x7ee8('0x2a')][_0x7ee8('0x4a')]()['then'](respondWithResult(_0x5d2e84,null))['catch'](handleError(_0x5d2e84,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 4882e8f..5b7da1e 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x51426b,_0xecbc25){var _0x2930ed=function(_0x13a6e1){while(--_0x13a6e1){_0x51426b['push'](_0x51426b['shift']());}};_0x2930ed(++_0xecbc25);}(_0xb7e7,0x121));var _0x7b7e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb7e7[_0x20a584];return _0x4b41a8;};'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_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x59342a,_0x16827b){var _0x17abc9=function(_0x2f7bfc){while(--_0x2f7bfc){_0x59342a['push'](_0x59342a['shift']());}};_0x17abc9(++_0x16827b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index a099c96..237bb3b 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 _0xb0ca=['jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','then','UpdateChatQueueReport','update','raw','where','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1cac41,_0x29e5df){var _0x43154f=function(_0x3388f2){while(--_0x3388f2){_0x1cac41['push'](_0x1cac41['shift']());}};_0x43154f(++_0x29e5df);}(_0xb0ca,0x1b2));var _0xab0c=function(_0x5b4bc1,_0x27c600){_0x5b4bc1=_0x5b4bc1-0x0;var _0x358925=_0xb0ca[_0x5b4bc1];return _0x358925;};'use strict';var _=require('lodash');var util=require(_0xab0c('0x0'));var moment=require('moment');var BPromise=require(_0xab0c('0x1'));var rs=require(_0xab0c('0x2'));var fs=require('fs');var Redis=require(_0xab0c('0x3'));var db=require(_0xab0c('0x4'))['db'];var utils=require(_0xab0c('0x5'));var logger=require(_0xab0c('0x6'))(_0xab0c('0x7'));var config=require('../../config/environment');var jayson=require(_0xab0c('0x8'));var client=jayson[_0xab0c('0x9')][_0xab0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x871446,_0x4902a7,_0xbe11d1){return new BPromise(function(_0x50d3de,_0x22ebb5){return client[_0xab0c('0xb')](_0x871446,_0xbe11d1)['then'](function(_0x5172cd){logger[_0xab0c('0xc')](_0xab0c('0xd'),_0x4902a7,_0xab0c('0xe'));logger[_0xab0c('0xf')](_0xab0c('0x10'),_0x4902a7,'request\x20sent',JSON[_0xab0c('0x11')](_0x5172cd));if(_0x5172cd['error']){if(_0x5172cd[_0xab0c('0x12')][_0xab0c('0x13')]===0x1f4){logger[_0xab0c('0x12')](_0xab0c('0xd'),_0x4902a7,_0x5172cd[_0xab0c('0x12')][_0xab0c('0x14')]);return _0x22ebb5(_0x5172cd[_0xab0c('0x12')][_0xab0c('0x14')]);}logger[_0xab0c('0x12')](_0xab0c('0xd'),_0x4902a7,_0x5172cd['error']['message']);return _0x50d3de(_0x5172cd[_0xab0c('0x12')][_0xab0c('0x14')]);}else{logger[_0xab0c('0xc')](_0xab0c('0xd'),_0x4902a7,_0xab0c('0xe'));_0x50d3de(_0x5172cd[_0xab0c('0x15')][_0xab0c('0x14')]);}})[_0xab0c('0x16')](function(_0x3b80db){logger[_0xab0c('0x12')](_0xab0c('0xd'),_0x4902a7,_0x3b80db);_0x22ebb5(_0x3b80db);});});}exports[_0xab0c('0x17')]=function(_0x32931b){var _0x13d657=this;return new Promise(function(_0x3c8e62,_0x433777){return db[_0xab0c('0x18')][_0xab0c('0x19')](_0x32931b[_0xab0c('0x1a')],{'raw':_0x32931b['options']?_0x32931b[_0xab0c('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xab0c('0x1c')](function(_0x870902){logger[_0xab0c('0xc')](_0xab0c('0x17'),_0x32931b);logger[_0xab0c('0xf')](_0xab0c('0x17'),_0x32931b,JSON['stringify'](_0x870902));_0x3c8e62(_0x870902);})[_0xab0c('0x16')](function(_0x1ecd87){logger[_0xab0c('0x12')]('CreateChatQueueReport',_0x1ecd87[_0xab0c('0x14')],_0x32931b);_0x433777(_0x13d657['error'](0x1f4,_0x1ecd87[_0xab0c('0x14')]));});});};exports[_0xab0c('0x1d')]=function(_0x33b76d){var _0x5a734a=this;return new Promise(function(_0xd03d5e,_0x20466c){return db['ChatQueueReport'][_0xab0c('0x1e')](_0x33b76d[_0xab0c('0x1a')],{'raw':_0x33b76d[_0xab0c('0x1b')]?_0x33b76d[_0xab0c('0x1b')][_0xab0c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33b76d[_0xab0c('0x1b')]?_0x33b76d[_0xab0c('0x1b')][_0xab0c('0x20')]||null:null,'attributes':_0x33b76d[_0xab0c('0x1b')]?_0x33b76d[_0xab0c('0x1b')][_0xab0c('0x21')]||null:null,'limit':_0x33b76d[_0xab0c('0x1b')]?_0x33b76d[_0xab0c('0x1b')]['limit']||null:null})[_0xab0c('0x1c')](function(_0x3936c0){logger[_0xab0c('0xc')](_0xab0c('0x1d'),_0x33b76d);logger['debug']('UpdateChatQueueReport',_0x33b76d,JSON['stringify'](_0x3936c0));_0xd03d5e(_0x3936c0);})['catch'](function(_0xdb0d0d){logger[_0xab0c('0x12')](_0xab0c('0x1d'),_0xdb0d0d[_0xab0c('0x14')],_0x33b76d);_0x20466c(_0x5a734a[_0xab0c('0x12')](0x1f4,_0xdb0d0d['message']));});});}; \ No newline at end of file +var _0xf717=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x479d7b,_0x485356){var _0x41330f=function(_0x160bb9){while(--_0x160bb9){_0x479d7b['push'](_0x479d7b['shift']());}};_0x41330f(++_0x485356);}(_0xf717,0x65));var _0x7f71=function(_0xeb1452,_0x1bff5b){_0xeb1452=_0xeb1452-0x0;var _0x1ed85b=_0xf717[_0xeb1452];return _0x1ed85b;};'use strict';var _=require(_0x7f71('0x0'));var util=require(_0x7f71('0x1'));var moment=require(_0x7f71('0x2'));var BPromise=require(_0x7f71('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f71('0x4'));var db=require(_0x7f71('0x5'))['db'];var utils=require(_0x7f71('0x6'));var logger=require(_0x7f71('0x7'))(_0x7f71('0x8'));var config=require(_0x7f71('0x9'));var jayson=require(_0x7f71('0xa'));var client=jayson[_0x7f71('0xb')][_0x7f71('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cdbd4,_0x2cd0ec,_0x185408){return new BPromise(function(_0x32d666,_0x4e4a51){return client['request'](_0x2cdbd4,_0x185408)[_0x7f71('0xd')](function(_0x1b6e4a){logger['info'](_0x7f71('0xe'),_0x2cd0ec,_0x7f71('0xf'));logger[_0x7f71('0x10')](_0x7f71('0x11'),_0x2cd0ec,_0x7f71('0xf'),JSON[_0x7f71('0x12')](_0x1b6e4a));if(_0x1b6e4a[_0x7f71('0x13')]){if(_0x1b6e4a[_0x7f71('0x13')]['code']===0x1f4){logger[_0x7f71('0x13')](_0x7f71('0xe'),_0x2cd0ec,_0x1b6e4a[_0x7f71('0x13')][_0x7f71('0x14')]);return _0x4e4a51(_0x1b6e4a['error'][_0x7f71('0x14')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x2cd0ec,_0x1b6e4a['error'][_0x7f71('0x14')]);return _0x32d666(_0x1b6e4a[_0x7f71('0x13')]['message']);}else{logger[_0x7f71('0x15')](_0x7f71('0xe'),_0x2cd0ec,_0x7f71('0xf'));_0x32d666(_0x1b6e4a[_0x7f71('0x16')][_0x7f71('0x14')]);}})[_0x7f71('0x17')](function(_0x15ae97){logger[_0x7f71('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x2cd0ec,_0x15ae97);_0x4e4a51(_0x15ae97);});});}exports[_0x7f71('0x18')]=function(_0x4fd1b6){var _0x4ca1c3=this;return new Promise(function(_0x55a994,_0x4fbc3a){return db[_0x7f71('0x19')][_0x7f71('0x1a')](_0x4fd1b6[_0x7f71('0x1b')],{'raw':_0x4fd1b6[_0x7f71('0x1c')]?_0x4fd1b6[_0x7f71('0x1c')][_0x7f71('0x1d')]===undefined?!![]:![]:!![]})[_0x7f71('0xd')](function(_0x32b97f){logger[_0x7f71('0x15')](_0x7f71('0x18'),_0x4fd1b6);logger['debug'](_0x7f71('0x18'),_0x4fd1b6,JSON[_0x7f71('0x12')](_0x32b97f));_0x55a994(_0x32b97f);})[_0x7f71('0x17')](function(_0x34f828){logger[_0x7f71('0x13')](_0x7f71('0x18'),_0x34f828[_0x7f71('0x14')],_0x4fd1b6);_0x4fbc3a(_0x4ca1c3[_0x7f71('0x13')](0x1f4,_0x34f828['message']));});});};exports[_0x7f71('0x1e')]=function(_0x5d14fc){var _0x5b87e2=this;return new Promise(function(_0x44475c,_0x568033){return db[_0x7f71('0x19')][_0x7f71('0x1f')](_0x5d14fc[_0x7f71('0x1b')],{'raw':_0x5d14fc[_0x7f71('0x1c')]?_0x5d14fc[_0x7f71('0x1c')][_0x7f71('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d14fc[_0x7f71('0x1c')]?_0x5d14fc[_0x7f71('0x1c')][_0x7f71('0x20')]||null:null,'attributes':_0x5d14fc['options']?_0x5d14fc['options'][_0x7f71('0x21')]||null:null,'limit':_0x5d14fc[_0x7f71('0x1c')]?_0x5d14fc[_0x7f71('0x1c')][_0x7f71('0x22')]||null:null})['then'](function(_0x42de85){logger[_0x7f71('0x15')]('UpdateChatQueueReport',_0x5d14fc);logger[_0x7f71('0x10')]('UpdateChatQueueReport',_0x5d14fc,JSON[_0x7f71('0x12')](_0x42de85));_0x44475c(_0x42de85);})[_0x7f71('0x17')](function(_0x451f48){logger[_0x7f71('0x13')](_0x7f71('0x1e'),_0x451f48[_0x7f71('0x14')],_0x5d14fc);_0x568033(_0x5b87e2[_0x7f71('0x13')](0x1f4,_0x451f48[_0x7f71('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 8227e89..785b81c 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 _0x3927=['show','post','create','put','update','exports','multer','path','connect-timeout','fs-extra','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x23307f,_0x21e6f1){var _0x33556d=function(_0x200810){while(--_0x200810){_0x23307f['push'](_0x23307f['shift']());}};_0x33556d(++_0x21e6f1);}(_0x3927,0x9f));var _0x7392=function(_0x328b35,_0x38a3c3){_0x328b35=_0x328b35-0x0;var _0x2f6a95=_0x3927[_0x328b35];return _0x2f6a95;};'use strict';var multer=require(_0x7392('0x0'));var util=require('util');var path=require(_0x7392('0x1'));var timeout=require(_0x7392('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7392('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7392('0x4'));router[_0x7392('0x5')]('/',auth[_0x7392('0x6')](),controller[_0x7392('0x7')]);router[_0x7392('0x5')](_0x7392('0x8'),auth[_0x7392('0x6')](),controller[_0x7392('0x9')]);router[_0x7392('0x5')](_0x7392('0xa'),auth[_0x7392('0x6')](),controller[_0x7392('0xb')]);router[_0x7392('0xc')]('/',auth['isAuthenticated'](),controller[_0x7392('0xd')]);router[_0x7392('0xe')](_0x7392('0xa'),auth[_0x7392('0x6')](),controller[_0x7392('0xf')]);router['delete']('/:id',auth[_0x7392('0x6')](),controller['destroy']);module[_0x7392('0x10')]=router; \ No newline at end of file +var _0x1e7e=['get','isAuthenticated','index','describe','/:id','show','create','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x55f0b1,_0x275c7a){var _0x3dac04=function(_0x5d9a15){while(--_0x5d9a15){_0x55f0b1['push'](_0x55f0b1['shift']());}};_0x3dac04(++_0x275c7a);}(_0x1e7e,0xdc));var _0xe1e7=function(_0xa3083e,_0x345ff9){_0xa3083e=_0xa3083e-0x0;var _0x3f3023=_0x1e7e[_0xa3083e];return _0x3f3023;};'use strict';var multer=require('multer');var util=require(_0xe1e7('0x0'));var path=require(_0xe1e7('0x1'));var timeout=require(_0xe1e7('0x2'));var express=require('express');var router=express[_0xe1e7('0x3')]();var fs_extra=require(_0xe1e7('0x4'));var auth=require(_0xe1e7('0x5'));var interaction=require(_0xe1e7('0x6'));var config=require(_0xe1e7('0x7'));var controller=require('./chatQueueReport.controller');router[_0xe1e7('0x8')]('/',auth[_0xe1e7('0x9')](),controller[_0xe1e7('0xa')]);router[_0xe1e7('0x8')]('/describe',auth[_0xe1e7('0x9')](),controller[_0xe1e7('0xb')]);router[_0xe1e7('0x8')](_0xe1e7('0xc'),auth[_0xe1e7('0x9')](),controller[_0xe1e7('0xd')]);router['post']('/',auth[_0xe1e7('0x9')](),controller[_0xe1e7('0xe')]);router['put']('/:id',auth[_0xe1e7('0x9')](),controller[_0xe1e7('0xf')]);router[_0xe1e7('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe1e7('0x11')]);module[_0xe1e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 7a75793..003c5c2 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x11cbbd,_0x5d4106){var _0x153af2=function(_0xd8cb94){while(--_0xd8cb94){_0x11cbbd['push'](_0x11cbbd['shift']());}};_0x153af2(++_0x5d4106);}(_0x008c,0x188));var _0xc008=function(_0x3af955,_0x21431c){_0x3af955=_0x3af955-0x0;var _0x167de5=_0x008c[_0x3af955];return _0x167de5;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x3d507e,_0x2151eb){var _0x458c52=function(_0x211626){while(--_0x211626){_0x3d507e['push'](_0x3d507e['shift']());}};_0x458c52(++_0x2151eb);}(_0x00bb,0x1d8));var _0xb00b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x00bb[_0x110c3d];return _0x226d67;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index d4bc2e2..8a2aaa8 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 _0xd968=['then','destroy','stack','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','name','keys','filters','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','update'];(function(_0x5067d7,_0x56c8e5){var _0x367d67=function(_0x267fd4){while(--_0x267fd4){_0x5067d7['push'](_0x5067d7['shift']());}};_0x367d67(++_0x56c8e5);}(_0xd968,0x1d1));var _0x8d96=function(_0x1346db,_0x3b5b3a){_0x1346db=_0x1346db-0x0;var _0x2c600a=_0xd968[_0x1346db];return _0x2c600a;};'use strict';var emlformat=require(_0x8d96('0x0'));var rimraf=require(_0x8d96('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8d96('0x2'));var moment=require(_0x8d96('0x3'));var BPromise=require(_0x8d96('0x4'));var Mustache=require(_0x8d96('0x5'));var util=require(_0x8d96('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8d96('0x7'));var ejs=require(_0x8d96('0x8'));var fs=require('fs');var fs_extra=require(_0x8d96('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8d96('0xa'));var jsforce=require(_0x8d96('0xb'));var deskjs=require(_0x8d96('0xc'));var toCsv=require(_0x8d96('0x7'));var querystring=require(_0x8d96('0xd'));var Papa=require(_0x8d96('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8d96('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d96('0x10'));var logger=require(_0x8d96('0x11'))('api');var utils=require(_0x8d96('0x12'));var config=require(_0x8d96('0x13'));var licenseUtil=require(_0x8d96('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x151562,_0x470138){_0x470138=_0x470138||0xcc;return function(_0x196519){if(_0x196519){return _0x151562[_0x8d96('0x15')](_0x470138);}return _0x151562[_0x8d96('0x16')](_0x470138)[_0x8d96('0x17')]();};}function respondWithResult(_0x40ce3f,_0xbae191){_0xbae191=_0xbae191||0xc8;return function(_0x495130){if(_0x495130){return _0x40ce3f[_0x8d96('0x16')](_0xbae191)[_0x8d96('0x18')](_0x495130);}};}function respondWithFilteredResult(_0x185479,_0x16b017){return function(_0x4218c9){if(_0x4218c9){var _0x874fd0=typeof _0x16b017[_0x8d96('0x19')]===_0x8d96('0x1a')&&typeof _0x16b017['limit']==='undefined';var _0x7df71a=_0x4218c9[_0x8d96('0x1b')];var _0x585228=_0x874fd0?0x0:_0x16b017[_0x8d96('0x19')];var _0x484029=_0x874fd0?_0x4218c9[_0x8d96('0x1b')]:_0x16b017['offset']+_0x16b017['limit'];var _0x13a197;if(_0x484029>=_0x7df71a){_0x484029=_0x7df71a;_0x13a197=0xc8;}else{_0x13a197=0xce;}_0x185479['status'](_0x13a197);return _0x185479['set']('Content-Range',_0x585228+'-'+_0x484029+'/'+_0x7df71a)[_0x8d96('0x18')](_0x4218c9);}return null;};}function patchUpdates(_0x5e6044){return function(_0x3c9ab7){try{jsonpatch[_0x8d96('0x1c')](_0x3c9ab7,_0x5e6044,!![]);}catch(_0x140c00){return BPromise[_0x8d96('0x1d')](_0x140c00);}return _0x3c9ab7[_0x8d96('0x1e')]();};}function saveUpdates(_0xf42b0b,_0x4b3270){return function(_0x54ace2){if(_0x54ace2){return _0x54ace2[_0x8d96('0x1f')](_0xf42b0b)[_0x8d96('0x20')](function(_0x4200e1){return _0x4200e1;});}return null;};}function removeEntity(_0x53a164,_0x3f32f1){return function(_0x2ff3b1){if(_0x2ff3b1){return _0x2ff3b1[_0x8d96('0x21')]()[_0x8d96('0x20')](function(){_0x53a164[_0x8d96('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x242953,_0x4c2969){return function(_0x5e36a9){if(!_0x5e36a9){_0x242953[_0x8d96('0x15')](0x194);}return _0x5e36a9;};}function handleError(_0x45ad76,_0x4d1e70){_0x4d1e70=_0x4d1e70||0x1f4;return function(_0x3a0a52){logger['error'](_0x3a0a52[_0x8d96('0x22')]);if(_0x3a0a52['name']){delete _0x3a0a52['name'];}_0x45ad76[_0x8d96('0x16')](_0x4d1e70)[_0x8d96('0x23')](_0x3a0a52);};}exports[_0x8d96('0x24')]=function(_0x184788,_0x42492f){var _0x2054a8={},_0x1c1190={},_0x3ed3dd={'count':0x0,'rows':[]};var _0x3419bb=_[_0x8d96('0x25')](db[_0x8d96('0x26')][_0x8d96('0x27')],function(_0x38a3b3){return{'name':_0x38a3b3[_0x8d96('0x28')],'type':_0x38a3b3[_0x8d96('0x29')]['key']};});_0x1c1190['model']=_[_0x8d96('0x25')](_0x3419bb,_0x8d96('0x2a'));_0x1c1190['query']=_[_0x8d96('0x2b')](_0x184788['query']);_0x1c1190[_0x8d96('0x2c')]=_[_0x8d96('0x2d')](_0x1c1190[_0x8d96('0x2e')],_0x1c1190[_0x8d96('0x2f')]);_0x2054a8['attributes']=_[_0x8d96('0x2d')](_0x1c1190[_0x8d96('0x2e')],qs[_0x8d96('0x30')](_0x184788[_0x8d96('0x2f')]['fields']));_0x2054a8['attributes']=_0x2054a8['attributes']['length']?_0x2054a8[_0x8d96('0x31')]:_0x1c1190['model'];if(!_0x184788[_0x8d96('0x2f')][_0x8d96('0x32')](_0x8d96('0x33'))){_0x2054a8[_0x8d96('0x34')]=qs[_0x8d96('0x34')](_0x184788[_0x8d96('0x2f')][_0x8d96('0x34')]);_0x2054a8[_0x8d96('0x19')]=qs[_0x8d96('0x19')](_0x184788[_0x8d96('0x2f')][_0x8d96('0x19')]);}_0x2054a8[_0x8d96('0x35')]=qs[_0x8d96('0x36')](_0x184788['query'][_0x8d96('0x36')]);_0x2054a8[_0x8d96('0x37')]=qs[_0x8d96('0x2c')](_[_0x8d96('0x38')](_0x184788[_0x8d96('0x2f')],_0x1c1190[_0x8d96('0x2c')]),_0x3419bb);if(_0x184788['query'][_0x8d96('0x39')]){_0x2054a8['where']=_[_0x8d96('0x3a')](_0x2054a8['where'],{'$or':_[_0x8d96('0x25')](_0x3419bb,function(_0x3e179b){if(_0x3e179b['type']!=='VIRTUAL'){var _0x21980d={};_0x21980d[_0x3e179b['name']]={'$like':'%'+_0x184788[_0x8d96('0x2f')][_0x8d96('0x39')]+'%'};return _0x21980d;}})});}_0x2054a8=_['merge']({},_0x2054a8,_0x184788[_0x8d96('0x3b')]);var _0x2742c4={'where':_0x2054a8[_0x8d96('0x37')]};return db[_0x8d96('0x26')][_0x8d96('0x1b')](_0x2742c4)[_0x8d96('0x20')](function(_0x2ba996){_0x3ed3dd[_0x8d96('0x1b')]=_0x2ba996;if(_0x184788[_0x8d96('0x2f')][_0x8d96('0x3c')]){_0x2054a8[_0x8d96('0x3d')]=[{'all':!![]}];}return db[_0x8d96('0x26')][_0x8d96('0x3e')](_0x2054a8);})[_0x8d96('0x20')](function(_0x3f877d){_0x3ed3dd[_0x8d96('0x3f')]=_0x3f877d;return _0x3ed3dd;})[_0x8d96('0x20')](respondWithFilteredResult(_0x42492f,_0x2054a8))[_0x8d96('0x40')](handleError(_0x42492f,null));};exports['show']=function(_0x5e562e,_0x86e287){var _0x42bc50={'raw':!![],'where':{'id':_0x5e562e[_0x8d96('0x41')]['id']}},_0x1398aa={};_0x1398aa[_0x8d96('0x2e')]=_['keys'](db[_0x8d96('0x26')][_0x8d96('0x27')]);_0x1398aa[_0x8d96('0x2f')]=_['keys'](_0x5e562e[_0x8d96('0x2f')]);_0x1398aa[_0x8d96('0x2c')]=_['intersection'](_0x1398aa['model'],_0x1398aa[_0x8d96('0x2f')]);_0x42bc50[_0x8d96('0x31')]=_['intersection'](_0x1398aa[_0x8d96('0x2e')],qs[_0x8d96('0x30')](_0x5e562e[_0x8d96('0x2f')][_0x8d96('0x30')]));_0x42bc50[_0x8d96('0x31')]=_0x42bc50[_0x8d96('0x31')][_0x8d96('0x42')]?_0x42bc50[_0x8d96('0x31')]:_0x1398aa[_0x8d96('0x2e')];if(_0x5e562e[_0x8d96('0x2f')][_0x8d96('0x3c')]){_0x42bc50[_0x8d96('0x3d')]=[{'all':!![]}];}_0x42bc50=_[_0x8d96('0x3a')]({},_0x42bc50,_0x5e562e[_0x8d96('0x3b')]);return db[_0x8d96('0x26')][_0x8d96('0x43')](_0x42bc50)[_0x8d96('0x20')](handleEntityNotFound(_0x86e287,null))[_0x8d96('0x20')](respondWithResult(_0x86e287,null))['catch'](handleError(_0x86e287,null));};exports[_0x8d96('0x44')]=function(_0x4b4f52,_0x369f14){return db[_0x8d96('0x26')][_0x8d96('0x44')](_0x4b4f52[_0x8d96('0x45')],{})[_0x8d96('0x20')](respondWithResult(_0x369f14,0xc9))['catch'](handleError(_0x369f14,null));};exports[_0x8d96('0x1f')]=function(_0x4b392b,_0x5e3bc8){if(_0x4b392b[_0x8d96('0x45')]['id']){delete _0x4b392b[_0x8d96('0x45')]['id'];}return db['ChatTransferReport'][_0x8d96('0x43')]({'where':{'id':_0x4b392b[_0x8d96('0x41')]['id']}})[_0x8d96('0x20')](handleEntityNotFound(_0x5e3bc8,null))[_0x8d96('0x20')](saveUpdates(_0x4b392b['body'],null))[_0x8d96('0x20')](respondWithResult(_0x5e3bc8,null))[_0x8d96('0x40')](handleError(_0x5e3bc8,null));};exports[_0x8d96('0x21')]=function(_0x4ea0c5,_0x25ec85){return db['ChatTransferReport']['find']({'where':{'id':_0x4ea0c5[_0x8d96('0x41')]['id']}})[_0x8d96('0x20')](handleEntityNotFound(_0x25ec85,null))['then'](removeEntity(_0x25ec85,null))['catch'](handleError(_0x25ec85,null));};exports[_0x8d96('0x46')]=function(_0x3552e1,_0x5871e7){return db[_0x8d96('0x26')][_0x8d96('0x46')]()[_0x8d96('0x20')](respondWithResult(_0x5871e7,null))[_0x8d96('0x40')](handleError(_0x5871e7,null));}; \ No newline at end of file +var _0xdd5a=['options','findAll','rows','catch','show','params','includeAll','include','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','stack','name','send','index','map','ChatTransferReport','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x33ec79,_0x4e7c33){var _0x454584=function(_0x485522){while(--_0x485522){_0x33ec79['push'](_0x33ec79['shift']());}};_0x454584(++_0x4e7c33);}(_0xdd5a,0x9d));var _0xadd5=function(_0x1a1d33,_0x19b3d5){_0x1a1d33=_0x1a1d33-0x0;var _0x14306c=_0xdd5a[_0x1a1d33];return _0x14306c;};'use strict';var emlformat=require(_0xadd5('0x0'));var rimraf=require(_0xadd5('0x1'));var zipdir=require(_0xadd5('0x2'));var jsonpatch=require(_0xadd5('0x3'));var rp=require(_0xadd5('0x4'));var moment=require(_0xadd5('0x5'));var BPromise=require(_0xadd5('0x6'));var Mustache=require(_0xadd5('0x7'));var util=require(_0xadd5('0x8'));var path=require(_0xadd5('0x9'));var sox=require('sox');var csv=require(_0xadd5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xadd5('0xb'));var _=require(_0xadd5('0xc'));var squel=require(_0xadd5('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xadd5('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xadd5('0xf'));var Redis=require('ioredis');var authService=require(_0xadd5('0x10'));var qs=require(_0xadd5('0x11'));var as=require(_0xadd5('0x12'));var hardwareService=require(_0xadd5('0x13'));var logger=require('../../config/logger')(_0xadd5('0x14'));var utils=require(_0xadd5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xadd5('0x16'));var db=require(_0xadd5('0x17'))['db'];function respondWithStatusCode(_0x2807c8,_0x1ff584){_0x1ff584=_0x1ff584||0xcc;return function(_0x37440a){if(_0x37440a){return _0x2807c8['sendStatus'](_0x1ff584);}return _0x2807c8['status'](_0x1ff584)['end']();};}function respondWithResult(_0x5dfafc,_0x267583){_0x267583=_0x267583||0xc8;return function(_0x1378e1){if(_0x1378e1){return _0x5dfafc[_0xadd5('0x18')](_0x267583)[_0xadd5('0x19')](_0x1378e1);}};}function respondWithFilteredResult(_0x5c3dbc,_0x2b4ed6){return function(_0x1d00ef){if(_0x1d00ef){var _0x41b27d=typeof _0x2b4ed6['offset']===_0xadd5('0x1a')&&typeof _0x2b4ed6[_0xadd5('0x1b')]===_0xadd5('0x1a');var _0x1f7289=_0x1d00ef[_0xadd5('0x1c')];var _0x4a3e49=_0x41b27d?0x0:_0x2b4ed6[_0xadd5('0x1d')];var _0x136d22=_0x41b27d?_0x1d00ef[_0xadd5('0x1c')]:_0x2b4ed6[_0xadd5('0x1d')]+_0x2b4ed6[_0xadd5('0x1b')];var _0x5d068d;if(_0x136d22>=_0x1f7289){_0x136d22=_0x1f7289;_0x5d068d=0xc8;}else{_0x5d068d=0xce;}_0x5c3dbc[_0xadd5('0x18')](_0x5d068d);return _0x5c3dbc[_0xadd5('0x1e')](_0xadd5('0x1f'),_0x4a3e49+'-'+_0x136d22+'/'+_0x1f7289)[_0xadd5('0x19')](_0x1d00ef);}return null;};}function patchUpdates(_0x312146){return function(_0x3060cc){try{jsonpatch[_0xadd5('0x20')](_0x3060cc,_0x312146,!![]);}catch(_0x5073bc){return BPromise[_0xadd5('0x21')](_0x5073bc);}return _0x3060cc['save']();};}function saveUpdates(_0x318091,_0x7a06b8){return function(_0x34af66){if(_0x34af66){return _0x34af66[_0xadd5('0x22')](_0x318091)[_0xadd5('0x23')](function(_0x5ef4c3){return _0x5ef4c3;});}return null;};}function removeEntity(_0x3a4d1b,_0x4d99a0){return function(_0x11aa3e){if(_0x11aa3e){return _0x11aa3e[_0xadd5('0x24')]()[_0xadd5('0x23')](function(){_0x3a4d1b['status'](0xcc)[_0xadd5('0x25')]();});}};}function handleEntityNotFound(_0x56472b,_0xf57505){return function(_0x20fb68){if(!_0x20fb68){_0x56472b[_0xadd5('0x26')](0x194);}return _0x20fb68;};}function handleError(_0x3130ec,_0x37a95a){_0x37a95a=_0x37a95a||0x1f4;return function(_0x50c7d1){logger['error'](_0x50c7d1[_0xadd5('0x27')]);if(_0x50c7d1[_0xadd5('0x28')]){delete _0x50c7d1[_0xadd5('0x28')];}_0x3130ec[_0xadd5('0x18')](_0x37a95a)[_0xadd5('0x29')](_0x50c7d1);};}exports[_0xadd5('0x2a')]=function(_0x3413d4,_0x45851d){var _0x5cee88={},_0x202f4d={},_0x2e9f9a={'count':0x0,'rows':[]};var _0x47cd5c=_[_0xadd5('0x2b')](db[_0xadd5('0x2c')]['rawAttributes'],function(_0x2097f4){return{'name':_0x2097f4['fieldName'],'type':_0x2097f4['type'][_0xadd5('0x2d')]};});_0x202f4d[_0xadd5('0x2e')]=_[_0xadd5('0x2b')](_0x47cd5c,'name');_0x202f4d['query']=_[_0xadd5('0x2f')](_0x3413d4[_0xadd5('0x30')]);_0x202f4d[_0xadd5('0x31')]=_[_0xadd5('0x32')](_0x202f4d[_0xadd5('0x2e')],_0x202f4d[_0xadd5('0x30')]);_0x5cee88[_0xadd5('0x33')]=_['intersection'](_0x202f4d[_0xadd5('0x2e')],qs[_0xadd5('0x34')](_0x3413d4[_0xadd5('0x30')][_0xadd5('0x34')]));_0x5cee88[_0xadd5('0x33')]=_0x5cee88[_0xadd5('0x33')][_0xadd5('0x35')]?_0x5cee88[_0xadd5('0x33')]:_0x202f4d[_0xadd5('0x2e')];if(!_0x3413d4['query']['hasOwnProperty'](_0xadd5('0x36'))){_0x5cee88[_0xadd5('0x1b')]=qs[_0xadd5('0x1b')](_0x3413d4['query'][_0xadd5('0x1b')]);_0x5cee88['offset']=qs['offset'](_0x3413d4[_0xadd5('0x30')][_0xadd5('0x1d')]);}_0x5cee88[_0xadd5('0x37')]=qs['sort'](_0x3413d4[_0xadd5('0x30')][_0xadd5('0x38')]);_0x5cee88[_0xadd5('0x39')]=qs[_0xadd5('0x31')](_[_0xadd5('0x3a')](_0x3413d4['query'],_0x202f4d[_0xadd5('0x31')]),_0x47cd5c);if(_0x3413d4[_0xadd5('0x30')][_0xadd5('0x3b')]){_0x5cee88[_0xadd5('0x39')]=_['merge'](_0x5cee88[_0xadd5('0x39')],{'$or':_[_0xadd5('0x2b')](_0x47cd5c,function(_0x2eaf23){if(_0x2eaf23['type']!==_0xadd5('0x3c')){var _0x58a02a={};_0x58a02a[_0x2eaf23[_0xadd5('0x28')]]={'$like':'%'+_0x3413d4[_0xadd5('0x30')]['filter']+'%'};return _0x58a02a;}})});}_0x5cee88=_[_0xadd5('0x3d')]({},_0x5cee88,_0x3413d4[_0xadd5('0x3e')]);var _0x546c72={'where':_0x5cee88[_0xadd5('0x39')]};return db['ChatTransferReport'][_0xadd5('0x1c')](_0x546c72)['then'](function(_0x2e9385){_0x2e9f9a[_0xadd5('0x1c')]=_0x2e9385;if(_0x3413d4[_0xadd5('0x30')]['includeAll']){_0x5cee88['include']=[{'all':!![]}];}return db[_0xadd5('0x2c')][_0xadd5('0x3f')](_0x5cee88);})[_0xadd5('0x23')](function(_0x46afca){_0x2e9f9a[_0xadd5('0x40')]=_0x46afca;return _0x2e9f9a;})['then'](respondWithFilteredResult(_0x45851d,_0x5cee88))[_0xadd5('0x41')](handleError(_0x45851d,null));};exports[_0xadd5('0x42')]=function(_0x14e55a,_0x1f281f){var _0x14771f={'raw':!![],'where':{'id':_0x14e55a[_0xadd5('0x43')]['id']}},_0x34c5c1={};_0x34c5c1[_0xadd5('0x2e')]=_[_0xadd5('0x2f')](db[_0xadd5('0x2c')]['rawAttributes']);_0x34c5c1[_0xadd5('0x30')]=_[_0xadd5('0x2f')](_0x14e55a[_0xadd5('0x30')]);_0x34c5c1[_0xadd5('0x31')]=_[_0xadd5('0x32')](_0x34c5c1[_0xadd5('0x2e')],_0x34c5c1[_0xadd5('0x30')]);_0x14771f[_0xadd5('0x33')]=_[_0xadd5('0x32')](_0x34c5c1['model'],qs[_0xadd5('0x34')](_0x14e55a[_0xadd5('0x30')][_0xadd5('0x34')]));_0x14771f[_0xadd5('0x33')]=_0x14771f[_0xadd5('0x33')][_0xadd5('0x35')]?_0x14771f['attributes']:_0x34c5c1['model'];if(_0x14e55a[_0xadd5('0x30')][_0xadd5('0x44')]){_0x14771f[_0xadd5('0x45')]=[{'all':!![]}];}_0x14771f=_[_0xadd5('0x3d')]({},_0x14771f,_0x14e55a['options']);return db[_0xadd5('0x2c')][_0xadd5('0x46')](_0x14771f)[_0xadd5('0x23')](handleEntityNotFound(_0x1f281f,null))[_0xadd5('0x23')](respondWithResult(_0x1f281f,null))[_0xadd5('0x41')](handleError(_0x1f281f,null));};exports['create']=function(_0x1df9c1,_0x573bd0){return db[_0xadd5('0x2c')]['create'](_0x1df9c1[_0xadd5('0x47')],{})['then'](respondWithResult(_0x573bd0,0xc9))['catch'](handleError(_0x573bd0,null));};exports[_0xadd5('0x22')]=function(_0x4e65a8,_0x48cc56){if(_0x4e65a8[_0xadd5('0x47')]['id']){delete _0x4e65a8[_0xadd5('0x47')]['id'];}return db['ChatTransferReport'][_0xadd5('0x46')]({'where':{'id':_0x4e65a8[_0xadd5('0x43')]['id']}})[_0xadd5('0x23')](handleEntityNotFound(_0x48cc56,null))[_0xadd5('0x23')](saveUpdates(_0x4e65a8['body'],null))[_0xadd5('0x23')](respondWithResult(_0x48cc56,null))[_0xadd5('0x41')](handleError(_0x48cc56,null));};exports['destroy']=function(_0xcb8af4,_0x2aa1de){return db[_0xadd5('0x2c')][_0xadd5('0x46')]({'where':{'id':_0xcb8af4['params']['id']}})[_0xadd5('0x23')](handleEntityNotFound(_0x2aa1de,null))[_0xadd5('0x23')](removeEntity(_0x2aa1de,null))[_0xadd5('0x41')](handleError(_0x2aa1de,null));};exports['describe']=function(_0x502083,_0x150182){return db[_0xadd5('0x2c')][_0xadd5('0x48')]()[_0xadd5('0x23')](respondWithResult(_0x150182,null))['catch'](handleError(_0x150182,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index b11b428..fe1a1cf 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 _0x22c8=['bluebird','request-promise','path','rimraf','ChatTransferReport','uniqueid','util','api'];(function(_0x275137,_0x102c16){var _0x314312=function(_0x3b0d79){while(--_0x3b0d79){_0x275137['push'](_0x275137['shift']());}};_0x314312(++_0x102c16);}(_0x22c8,0xe6));var _0x822c=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0x22c8[_0x644ecd];return _0x1c66ce;};'use strict';var _=require('lodash');var util=require(_0x822c('0x0'));var logger=require('../../config/logger')(_0x822c('0x1'));var moment=require('moment');var BPromise=require(_0x822c('0x2'));var rp=require(_0x822c('0x3'));var fs=require('fs');var path=require(_0x822c('0x4'));var rimraf=require(_0x822c('0x5'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x2d0624,_0x5ef931){return _0x2d0624['define'](_0x822c('0x6'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x822c('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdd36=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./chatTransferReport.attributes','define'];(function(_0x32e7d6,_0x682bc5){var _0x5427cf=function(_0x365c2d){while(--_0x365c2d){_0x32e7d6['push'](_0x32e7d6['shift']());}};_0x5427cf(++_0x682bc5);}(_0xdd36,0x120));var _0x6dd3=function(_0x527a0e,_0x3ee0c0){_0x527a0e=_0x527a0e-0x0;var _0x124a7b=_0xdd36[_0x527a0e];return _0x124a7b;};'use strict';var _=require(_0x6dd3('0x0'));var util=require(_0x6dd3('0x1'));var logger=require(_0x6dd3('0x2'))('api');var moment=require(_0x6dd3('0x3'));var BPromise=require(_0x6dd3('0x4'));var rp=require(_0x6dd3('0x5'));var fs=require('fs');var path=require(_0x6dd3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6dd3('0x7'));module['exports']=function(_0x29f067,_0x757a47){return _0x29f067[_0x6dd3('0x8')]('ChatTransferReport',attributes,{'tableName':_0x6dd3('0x9'),'paranoid':![],'indexes':[{'name':_0x6dd3('0xa'),'fields':[_0x6dd3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index d241435..0b88d12 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 _0x049b=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2967fe,_0x2c839d){var _0x6728a8=function(_0x24dd47){while(--_0x24dd47){_0x2967fe['push'](_0x2967fe['shift']());}};_0x6728a8(++_0x2c839d);}(_0x049b,0x169));var _0xb049=function(_0x4814d2,_0x22c926){_0x4814d2=_0x4814d2-0x0;var _0x2bb7c8=_0x049b[_0x4814d2];return _0x2bb7c8;};'use strict';var _=require(_0xb049('0x0'));var util=require(_0xb049('0x1'));var moment=require(_0xb049('0x2'));var BPromise=require(_0xb049('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb049('0x4'));var db=require(_0xb049('0x5'))['db'];var utils=require(_0xb049('0x6'));var logger=require(_0xb049('0x7'))(_0xb049('0x8'));var config=require(_0xb049('0x9'));var jayson=require(_0xb049('0xa'));var client=jayson[_0xb049('0xb')][_0xb049('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d693d,_0x2d82ee,_0xa04108){return new BPromise(function(_0x48abca,_0x2c2233){return client[_0xb049('0xd')](_0x4d693d,_0xa04108)[_0xb049('0xe')](function(_0x2acdbe){logger[_0xb049('0xf')](_0xb049('0x10'),_0x2d82ee,_0xb049('0x11'));logger[_0xb049('0x12')](_0xb049('0x13'),_0x2d82ee,_0xb049('0x11'),JSON[_0xb049('0x14')](_0x2acdbe));if(_0x2acdbe[_0xb049('0x15')]){if(_0x2acdbe[_0xb049('0x15')][_0xb049('0x16')]===0x1f4){logger[_0xb049('0x15')](_0xb049('0x10'),_0x2d82ee,_0x2acdbe[_0xb049('0x15')][_0xb049('0x17')]);return _0x2c2233(_0x2acdbe[_0xb049('0x15')][_0xb049('0x17')]);}logger[_0xb049('0x15')](_0xb049('0x10'),_0x2d82ee,_0x2acdbe['error'][_0xb049('0x17')]);return _0x48abca(_0x2acdbe[_0xb049('0x15')]['message']);}else{logger[_0xb049('0xf')](_0xb049('0x10'),_0x2d82ee,_0xb049('0x11'));_0x48abca(_0x2acdbe[_0xb049('0x18')][_0xb049('0x17')]);}})[_0xb049('0x19')](function(_0xf01201){logger[_0xb049('0x15')]('ChatTransferReport,\x20%s,\x20%s',_0x2d82ee,_0xf01201);_0x2c2233(_0xf01201);});});} \ No newline at end of file +var _0x25a4=['jayson/promise','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x55a905,_0x970198){var _0x39ae00=function(_0x16beda){while(--_0x16beda){_0x55a905['push'](_0x55a905['shift']());}};_0x39ae00(++_0x970198);}(_0x25a4,0x183));var _0x425a=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0x25a4[_0x919445];return _0x511b3e;};'use strict';var _=require('lodash');var util=require(_0x425a('0x0'));var moment=require(_0x425a('0x1'));var BPromise=require(_0x425a('0x2'));var rs=require(_0x425a('0x3'));var fs=require('fs');var Redis=require(_0x425a('0x4'));var db=require(_0x425a('0x5'))['db'];var utils=require(_0x425a('0x6'));var logger=require('../../config/logger')(_0x425a('0x7'));var config=require(_0x425a('0x8'));var jayson=require(_0x425a('0x9'));var client=jayson['client'][_0x425a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cc7f8,_0x5cf5e4,_0x314992){return new BPromise(function(_0x3a0a45,_0x59195a){return client[_0x425a('0xb')](_0x4cc7f8,_0x314992)[_0x425a('0xc')](function(_0x1cf89d){logger[_0x425a('0xd')](_0x425a('0xe'),_0x5cf5e4,_0x425a('0xf'));logger['debug'](_0x425a('0x10'),_0x5cf5e4,_0x425a('0xf'),JSON[_0x425a('0x11')](_0x1cf89d));if(_0x1cf89d['error']){if(_0x1cf89d['error']['code']===0x1f4){logger[_0x425a('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x5cf5e4,_0x1cf89d['error'][_0x425a('0x13')]);return _0x59195a(_0x1cf89d[_0x425a('0x12')][_0x425a('0x13')]);}logger[_0x425a('0x12')](_0x425a('0xe'),_0x5cf5e4,_0x1cf89d[_0x425a('0x12')][_0x425a('0x13')]);return _0x3a0a45(_0x1cf89d[_0x425a('0x12')][_0x425a('0x13')]);}else{logger[_0x425a('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x5cf5e4,_0x425a('0xf'));_0x3a0a45(_0x1cf89d[_0x425a('0x14')][_0x425a('0x13')]);}})[_0x425a('0x15')](function(_0x433e06){logger[_0x425a('0x12')](_0x425a('0xe'),_0x5cf5e4,_0x433e06);_0x59195a(_0x433e06);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index eebdb06..936a769 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 _0x254a=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x1e41ab,_0x147c75){var _0x42ddad=function(_0x2ef3a6){while(--_0x2ef3a6){_0x1e41ab['push'](_0x1e41ab['shift']());}};_0x42ddad(++_0x147c75);}(_0x254a,0x81));var _0xa254=function(_0x505a7d,_0x25e11f){_0x505a7d=_0x505a7d-0x0;var _0x17d880=_0x254a[_0x505a7d];return _0x17d880;};'use strict';var multer=require(_0xa254('0x0'));var util=require(_0xa254('0x1'));var path=require(_0xa254('0x2'));var timeout=require(_0xa254('0x3'));var express=require(_0xa254('0x4'));var router=express[_0xa254('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa254('0x6'));var controller=require(_0xa254('0x7'));router[_0xa254('0x8')]('/',auth[_0xa254('0x9')](),controller[_0xa254('0xa')]);router[_0xa254('0x8')](_0xa254('0xb'),auth[_0xa254('0x9')](),controller[_0xa254('0xc')]);router[_0xa254('0x8')](_0xa254('0xd'),auth[_0xa254('0x9')](),controller[_0xa254('0xe')]);router[_0xa254('0xf')]('/',auth[_0xa254('0x9')](),controller[_0xa254('0x10')]);router[_0xa254('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa254('0x12')]);router[_0xa254('0x13')](_0xa254('0xd'),auth[_0xa254('0x9')](),controller[_0xa254('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7b79=['get','show','create','put','/:id','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','index','/describe','isAuthenticated'];(function(_0x2d5cae,_0x2edf48){var _0x21df6c=function(_0xbef1cf){while(--_0xbef1cf){_0x2d5cae['push'](_0x2d5cae['shift']());}};_0x21df6c(++_0x2edf48);}(_0x7b79,0xa1));var _0x97b7=function(_0xd18cd,_0x3c155f){_0xd18cd=_0xd18cd-0x0;var _0x190cef=_0x7b79[_0xd18cd];return _0x190cef;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x97b7('0x0'));var timeout=require(_0x97b7('0x1'));var express=require(_0x97b7('0x2'));var router=express[_0x97b7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x97b7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x97b7('0x5'));var controller=require('./chatTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x97b7('0x6')]);router['get'](_0x97b7('0x7'),auth[_0x97b7('0x8')](),controller['describe']);router[_0x97b7('0x9')]('/:id',auth[_0x97b7('0x8')](),controller[_0x97b7('0xa')]);router['post']('/',auth[_0x97b7('0x8')](),controller[_0x97b7('0xb')]);router[_0x97b7('0xc')](_0x97b7('0xd'),auth['isAuthenticated'](),controller[_0x97b7('0xe')]);router['delete'](_0x97b7('0xd'),auth[_0x97b7('0x8')](),controller[_0x97b7('0xf')]);module[_0x97b7('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 9adb59c..8f2917a 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 _0x6f7a=['sequelize','randomstring','exports','address','STRING','email','#011F6A','INTEGER','BOOLEAN','rounded','squared','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!','Skip','ENUM','star','thumb','stringify','name','text','input','parse','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','#fafafa','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}'];(function(_0x39046b,_0x409f7e){var _0x2eb9cf=function(_0x31a5bc){while(--_0x31a5bc){_0x39046b['push'](_0x39046b['shift']());}};_0x2eb9cf(++_0x409f7e);}(_0x6f7a,0xc8));var _0xa6f7=function(_0x3e480e,_0x57bf78){_0x3e480e=_0x3e480e-0x0;var _0x3650b6=_0x6f7a[_0x3e480e];return _0x3650b6;};'use strict';var Sequelize=require(_0xa6f7('0x0'));var rs=require(_0xa6f7('0x1'));module[_0xa6f7('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa6f7('0x3')},'description':{'type':Sequelize[_0xa6f7('0x4')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xa6f7('0x5')},'mapKeyOffline':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0x5')},'key':{'type':Sequelize[_0xa6f7('0x4')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa6f7('0x4')],'allowNull':![],'defaultValue':_0xa6f7('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xa6f7('0x4')],'allowNull':![],'defaultValue':_0xa6f7('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xa6f7('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa6f7('0x4')]},'animation':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xa6f7('0x9'),_0xa6f7('0xa')),'defaultValue':_0xa6f7('0x9')},'header_online':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0xb')},'start_chat_button':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0xc')},'offline_chat_button':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0xd')},'header_offline':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xa6f7('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xa6f7('0x10')]},'closingQuestion':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa6f7('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0x13')},'noteTitle':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0x14')},'placeholderMessage':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0x15')},'closingMessage':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0x16')},'closingMessageButton':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0xd')},'skipMessageButton':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0x17')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xa6f7('0x18')](_0xa6f7('0x19'),_0xa6f7('0x1a')),'defaultValue':_0xa6f7('0x19')},'ratingStarsNumber':{'type':Sequelize[_0xa6f7('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xa6f7('0x10')],'defaultValue':function(){return JSON[_0xa6f7('0x1b')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xa6f7('0x1c'),'type':_0xa6f7('0x1d'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xa6f7('0x1e'),'props':{'title':_0xa6f7('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xa6f7('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0xa6f7('0x1f')](this[_0xa6f7('0x20')](_0xa6f7('0x21'))):{};},'set':function(_0x5d5c4b){return this['setDataValue'](_0xa6f7('0x21'),JSON[_0xa6f7('0x1b')](_0x5d5c4b));}},'offlineForm':{'type':Sequelize[_0xa6f7('0x10')],'defaultValue':function(){return JSON[_0xa6f7('0x1b')]({'items':[{'type':_0xa6f7('0x1e'),'props':{'title':_0xa6f7('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xa6f7('0x5'),'type':_0xa6f7('0x5')},'variable':null},{'type':_0xa6f7('0x22'),'config':{'placeholder':_0xa6f7('0x23')},'props':{'title':_0xa6f7('0x23'),'helpText':_0xa6f7('0x24')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xa6f7('0x25'))?JSON[_0xa6f7('0x1f')](this['getDataValue'](_0xa6f7('0x25'))):{};},'set':function(_0x2e96b1){return this[_0xa6f7('0x26')](_0xa6f7('0x25'),JSON[_0xa6f7('0x1b')](_0x2e96b1));}},'token':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':function(){return rs[_0xa6f7('0x27')]();}},'autoclose':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xa6f7('0x4')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0x28')},'waitingMessage':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0x29')},'offlineMessageBody':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa6f7('0x2b')},'skipUnmanaged':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0x17')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xa6f7('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xa6f7('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa6f7('0x2c');}},'notificationSound':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xa6f7('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':_0xa6f7('0x2d')},'verticalAlignment':{'type':Sequelize[_0xa6f7('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xa6f7('0x4')]},'customerAvatar':{'type':Sequelize[_0xa6f7('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xa6f7('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xa6f7('0x4')],'allowNull':![],'defaultValue':_0xa6f7('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa6f7('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa6f7('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xa6f7('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa6f7('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5bb7aa){if(!_0x5bb7aa)this[_0xa6f7('0x26')](_0xa6f7('0x2f'),null);this[_0xa6f7('0x26')](_0xa6f7('0x30'),_0x5bb7aa);}},'vidaooEscalation':{'type':Sequelize[_0xa6f7('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa6f7('0x4')]},'vidaooTopic':{'type':Sequelize[_0xa6f7('0x4')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':function(){return _0xa6f7('0x31');}},'vidaooMetadata':{'type':Sequelize[_0xa6f7('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xa6f7('0x10')]}}; \ No newline at end of file +var _0x2192=['Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','star','stringify','input','name','text','getDataValue','onlineForm','parse','TEXT','Comments','offlineForm','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Send','Contact\x20us','Form\x20properly\x20submitted','Form\x20submission\x20error'];(function(_0x1a6886,_0x572cdc){var _0x9e7d24=function(_0x594e38){while(--_0x594e38){_0x1a6886['push'](_0x1a6886['shift']());}};_0x9e7d24(++_0x572cdc);}(_0x2192,0x1d1));var _0x2219=function(_0xbbe684,_0x537883){_0xbbe684=_0xbbe684-0x0;var _0x409198=_0x2192[_0xbbe684];return _0x409198;};'use strict';var Sequelize=require(_0x2219('0x0'));var rs=require(_0x2219('0x1'));module[_0x2219('0x2')]={'name':{'type':Sequelize[_0x2219('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2219('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x2219('0x3')],'defaultValue':_0x2219('0x5')},'mapKeyOffline':{'type':Sequelize[_0x2219('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x2219('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2219('0x3')],'defaultValue':_0x2219('0x6')},'customerAlias':{'type':Sequelize[_0x2219('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x2219('0x3')],'allowNull':![],'defaultValue':_0x2219('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x2219('0x3')],'allowNull':![],'defaultValue':_0x2219('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x2219('0x3')],'allowNull':![],'defaultValue':_0x2219('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2219('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2219('0x3')]},'animation':{'type':Sequelize[_0x2219('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x2219('0xb')](_0x2219('0xc'),_0x2219('0xd')),'defaultValue':_0x2219('0xc')},'header_online':{'type':Sequelize[_0x2219('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x2219('0x3')],'defaultValue':_0x2219('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x2219('0xf')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x2219('0x10')},'download_transcript':{'type':Sequelize[_0x2219('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x2219('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x2219('0x3')],'defaultValue':_0x2219('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x2219('0x3')],'defaultValue':_0x2219('0x12')},'noteTitle':{'type':Sequelize[_0x2219('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x2219('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x2219('0x3')],'defaultValue':_0x2219('0x13')},'closingMessageButton':{'type':Sequelize[_0x2219('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x2219('0x3')],'defaultValue':_0x2219('0x14')},'conditionAgreement':{'type':Sequelize[_0x2219('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x2219('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x2219('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x2219('0x3')],'defaultValue':_0x2219('0x15')},'ratingType':{'type':Sequelize[_0x2219('0xb')]('star',_0x2219('0x16')),'defaultValue':_0x2219('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x2219('0x18')]({'items':[{'type':_0x2219('0x19'),'variable':null,'config':{'placeholder':_0x2219('0x1a'),'type':_0x2219('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x2219('0x19'),'props':{'title':_0x2219('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x2219('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2219('0x1c')](_0x2219('0x1d'))?JSON[_0x2219('0x1e')](this[_0x2219('0x1c')]('onlineForm')):{};},'set':function(_0x5a645b){return this['setDataValue'](_0x2219('0x1d'),JSON[_0x2219('0x18')](_0x5a645b));}},'offlineForm':{'type':Sequelize[_0x2219('0x1f')],'defaultValue':function(){return JSON[_0x2219('0x18')]({'items':[{'type':_0x2219('0x19'),'props':{'title':_0x2219('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x2219('0x5'),'type':_0x2219('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x2219('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x2219('0x1c')](_0x2219('0x21'))?JSON[_0x2219('0x1e')](this[_0x2219('0x1c')]('offlineForm')):{};},'set':function(_0xe05d58){return this['setDataValue'](_0x2219('0x21'),JSON[_0x2219('0x18')](_0xe05d58));}},'token':{'type':Sequelize[_0x2219('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x2219('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2219('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2219('0x3')]},'forwardOffline':{'type':Sequelize[_0x2219('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2219('0x3')]},'waitingTitle':{'type':Sequelize[_0x2219('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x2219('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x2219('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x2219('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x2219('0x3')],'defaultValue':_0x2219('0x14')},'sendUnmanaged':{'type':Sequelize[_0x2219('0x3')],'defaultValue':_0x2219('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x2219('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2219('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x2219('0x1f')]},'showAgentAvatar':{'type':Sequelize[_0x2219('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2219('0x3')]},'notificationTemplate':{'type':Sequelize[_0x2219('0x1f')],'defaultValue':function(){return _0x2219('0x22');}},'notificationSound':{'type':Sequelize[_0x2219('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x2219('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x2219('0x23')},'verticalAlignment':{'type':Sequelize[_0x2219('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x2219('0x24')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x2219('0x1f')]},'showCustomerAvatar':{'type':Sequelize[_0x2219('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x2219('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x2219('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2219('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2219('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x2219('0x25')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2219('0x9')],'comment':_0x2219('0x26')},'mandatoryDisposition':{'type':Sequelize[_0x2219('0xa')],'defaultValue':![],'comment':_0x2219('0x27'),'set':function(_0x2ac7f6){if(!_0x2ac7f6)this[_0x2219('0x28')](_0x2219('0x29'),null);this[_0x2219('0x28')]('mandatoryDisposition',_0x2ac7f6);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x2219('0x3')],'allowNull':![],'defaultValue':_0x2219('0x2a')},'vidaooNote':{'type':Sequelize[_0x2219('0x3')],'defaultValue':function(){return _0x2219('0x2b');}},'vidaooMetadata':{'type':Sequelize[_0x2219('0x1f')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x2219('0x1f')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 9e2d400..2d8e1fb 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 _0xd684=['addAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','chat','CmContact','Sequelize','ValidationError','updatedAt','difference','CompanyId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','asc','ListId','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','lastName','x-real-port','browser','format','%s\x20%s','version','unknown','device','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','messageId','created','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','no\x20available\x20attributes','createdAt','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','Chat','NotifyMailAccount','notifyMail','attachments','offline-chat','addInteraction','omit','Owner','fullname','internal','Tags','color','tag','findAll','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','virtual','License','chatLicenseExceeded','push','all','server/files/chat/iframe.ejs','x-real-ip','connection','remoteAddress','referer','replace','alignment','verticalAlignment','textColor','color_button','addApplications','Transaction','READ_COMMITTED','ChatApplication','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','online','false','offlineForm','onlineForm','items','getOfflineMessages','Attachments','addAgents','removeAgents','isArray','userChatWebsite:remove','emit','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','ChatWebsites','end','sendStatus','stack','name','send','index','mandatoryDispositionPause','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatWebsite','includeAll','include','rows','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','Pause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd684,0xc2));var _0x4d68=function(_0x162f62,_0x1a0ab1){_0x162f62=_0x162f62-0x0;var _0x26c56e=_0xd684[_0x162f62];return _0x26c56e;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x4d68('0x0'));var util=require(_0x4d68('0x1'));var path=require(_0x4d68('0x2'));var ejs=require(_0x4d68('0x3'));var fs=require('fs');var fs_extra=require(_0x4d68('0x4'));var _=require(_0x4d68('0x5'));var querystring=require(_0x4d68('0x6'));var Redis=require(_0x4d68('0x7'));var qs=require(_0x4d68('0x8'));var logger=require(_0x4d68('0x9'))(_0x4d68('0xa'));var config=require(_0x4d68('0xb'));var db=require(_0x4d68('0xc'))['db'];config[_0x4d68('0xd')]=_[_0x4d68('0xe')](config['redis'],{'host':_0x4d68('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d68('0xd')]));require(_0x4d68('0x10'))[_0x4d68('0x11')](socket);var jayson=require(_0x4d68('0x12'));var client=jayson[_0x4d68('0x13')][_0x4d68('0x14')]({'port':0x232c});var client9002=jayson['client'][_0x4d68('0x14')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0x4d68('0x13')]['http']({'port':0x2329});function respondWithRpcPromise(_0x56485b,_0x29ec45,_0x171732,_0x327458){return new BPromise(function(_0x31b361,_0x263574){var _0x7e71d=_0x327458||client;return _0x7e71d[_0x4d68('0x15')](_0x56485b,_0x171732)[_0x4d68('0x16')](function(_0x51e00c){logger[_0x4d68('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x29ec45,_0x4d68('0x18'));logger[_0x4d68('0x19')](_0x4d68('0x1a'),_0x29ec45,_0x4d68('0x18'),JSON['stringify'](_0x51e00c));if(_0x51e00c['error']){if(_0x51e00c[_0x4d68('0x1b')]['code']===0x1f4){logger[_0x4d68('0x1b')](_0x4d68('0x1c'),_0x29ec45,_0x51e00c[_0x4d68('0x1b')][_0x4d68('0x1d')]);return _0x263574(_0x51e00c[_0x4d68('0x1b')][_0x4d68('0x1d')]);}logger['error'](_0x4d68('0x1c'),_0x29ec45,_0x51e00c[_0x4d68('0x1b')][_0x4d68('0x1d')]);return _0x31b361(_0x51e00c[_0x4d68('0x1b')]['message']);}else{logger[_0x4d68('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x29ec45,_0x4d68('0x18'));_0x31b361(_0x51e00c[_0x4d68('0x1e')][_0x4d68('0x1d')]);}})[_0x4d68('0x1f')](function(_0x2d043f){logger[_0x4d68('0x1b')](_0x4d68('0x1c'),_0x29ec45,_0x2d043f);_0x263574(_0x2d043f);});});}function respondWithStatusCode(_0x42f1ef,_0xc2ac7c){_0xc2ac7c=_0xc2ac7c||0xcc;return function(_0x4811aa){if(_0x4811aa){return _0x42f1ef['sendStatus'](_0xc2ac7c);}return _0x42f1ef[_0x4d68('0x20')](_0xc2ac7c)['end']();};}function respondWithResult(_0x39e9d9,_0x67ac34){_0x67ac34=_0x67ac34||0xc8;return function(_0x2c40ab){if(_0x2c40ab){return _0x39e9d9[_0x4d68('0x20')](_0x67ac34)[_0x4d68('0x21')](_0x2c40ab);}};}function respondWithFilteredResult(_0x26965f,_0x2e06b7){return function(_0x5e95af){if(_0x5e95af){var _0x5629bd=typeof _0x2e06b7[_0x4d68('0x22')]===_0x4d68('0x23')&&typeof _0x2e06b7[_0x4d68('0x24')]===_0x4d68('0x23');var _0x26ae2f=_0x5e95af['count'];var _0x941632=_0x5629bd?0x0:_0x2e06b7[_0x4d68('0x22')];var _0x1289af=_0x5629bd?_0x5e95af[_0x4d68('0x25')]:_0x2e06b7[_0x4d68('0x22')]+_0x2e06b7['limit'];var _0xf4ec49;if(_0x1289af>=_0x26ae2f){_0x1289af=_0x26ae2f;_0xf4ec49=0xc8;}else{_0xf4ec49=0xce;}_0x26965f[_0x4d68('0x20')](_0xf4ec49);return _0x26965f[_0x4d68('0x26')](_0x4d68('0x27'),_0x941632+'-'+_0x1289af+'/'+_0x26ae2f)[_0x4d68('0x21')](_0x5e95af);}return null;};}function saveUpdates(_0x2a97bd){return function(_0x42663d){if(_0x42663d){return _0x42663d['update'](_0x2a97bd)[_0x4d68('0x16')](function(_0x312764){return _0x312764;});}return null;};}function removeEntity(_0x4a5f95){return function(_0x17995a){if(_0x17995a){return _0x17995a[_0x4d68('0x28')]()[_0x4d68('0x16')](function(){var _0x1880b7=_0x17995a['get']({'plain':!![]});var _0x218b40=_0x4d68('0x29');return db['UserProfileResource'][_0x4d68('0x28')]({'where':{'type':_0x218b40,'resourceId':_0x1880b7['id']}})['then'](function(){return _0x17995a;});})['then'](function(){_0x4a5f95[_0x4d68('0x20')](0xcc)[_0x4d68('0x2a')]();});}};}function handleEntityNotFound(_0x3d09ba){return function(_0x39c4ca){if(!_0x39c4ca){_0x3d09ba[_0x4d68('0x2b')](0x194);}return _0x39c4ca;};}function handleError(_0x29138d,_0x4ac217){_0x4ac217=_0x4ac217||0x1f4;return function(_0x57ab88){logger['error'](_0x57ab88[_0x4d68('0x2c')]);if(_0x57ab88[_0x4d68('0x2d')]){delete _0x57ab88[_0x4d68('0x2d')];}_0x29138d[_0x4d68('0x20')](_0x4ac217)[_0x4d68('0x2e')](_0x57ab88);};}exports[_0x4d68('0x2f')]=function(_0x8836c6,_0x4a2ef4){var _0x4eeda0={'include':[{'model':db['Pause'],'as':_0x4d68('0x30')}]},_0x4f1e4b={},_0x51dac6={'count':0x0,'rows':[]};var _0x20fffa=_['map'](db['ChatWebsite'][_0x4d68('0x31')],function(_0x1d4ff8){return{'name':_0x1d4ff8[_0x4d68('0x32')],'type':_0x1d4ff8[_0x4d68('0x33')]['key']};});_0x4f1e4b['model']=_[_0x4d68('0x34')](_0x20fffa,_0x4d68('0x2d'));_0x4f1e4b[_0x4d68('0x35')]=_[_0x4d68('0x36')](_0x8836c6[_0x4d68('0x35')]);_0x4f1e4b[_0x4d68('0x37')]=_['intersection'](_0x4f1e4b[_0x4d68('0x38')],_0x4f1e4b[_0x4d68('0x35')]);_0x4eeda0[_0x4d68('0x39')]=_[_0x4d68('0x3a')](_0x4f1e4b[_0x4d68('0x38')],qs['fields'](_0x8836c6[_0x4d68('0x35')][_0x4d68('0x3b')]));_0x4eeda0[_0x4d68('0x39')]=_0x4eeda0['attributes'][_0x4d68('0x3c')]?_0x4eeda0[_0x4d68('0x39')]:_0x4f1e4b[_0x4d68('0x38')];if(!_0x8836c6['query'][_0x4d68('0x3d')](_0x4d68('0x3e'))){_0x4eeda0[_0x4d68('0x24')]=qs['limit'](_0x8836c6[_0x4d68('0x35')][_0x4d68('0x24')]);_0x4eeda0[_0x4d68('0x22')]=qs[_0x4d68('0x22')](_0x8836c6[_0x4d68('0x35')][_0x4d68('0x22')]);}_0x4eeda0[_0x4d68('0x3f')]=qs['sort'](_0x8836c6['query'][_0x4d68('0x40')]);_0x4eeda0[_0x4d68('0x41')]=qs[_0x4d68('0x37')](_[_0x4d68('0x42')](_0x8836c6['query'],_0x4f1e4b[_0x4d68('0x37')]),_0x20fffa);if(_0x8836c6['query'][_0x4d68('0x43')]){_0x4eeda0[_0x4d68('0x41')]=_[_0x4d68('0x44')](_0x4eeda0['where'],{'$or':_[_0x4d68('0x34')](_0x20fffa,function(_0x2dd373){if(_0x2dd373['type']!==_0x4d68('0x45')){var _0x4ca548={};_0x4ca548[_0x2dd373[_0x4d68('0x2d')]]={'$like':'%'+_0x8836c6['query'][_0x4d68('0x43')]+'%'};return _0x4ca548;}})});}_0x4eeda0=_[_0x4d68('0x44')]({},_0x4eeda0,_0x8836c6[_0x4d68('0x46')]);var _0x2532fd={'where':_0x4eeda0[_0x4d68('0x41')]};return db[_0x4d68('0x47')][_0x4d68('0x25')](_0x2532fd)[_0x4d68('0x16')](function(_0x1407d0){_0x51dac6[_0x4d68('0x25')]=_0x1407d0;if(_0x8836c6[_0x4d68('0x35')][_0x4d68('0x48')]){_0x4eeda0[_0x4d68('0x49')]=[{'all':!![]}];}return db[_0x4d68('0x47')]['findAll'](_0x4eeda0);})[_0x4d68('0x16')](function(_0x1b6721){_0x51dac6[_0x4d68('0x4a')]=_0x1b6721;return _0x51dac6;})['then'](respondWithFilteredResult(_0x4a2ef4,_0x4eeda0))[_0x4d68('0x1f')](handleError(_0x4a2ef4,null));};exports[_0x4d68('0x4b')]=function(_0x1d6ba1,_0x378a5c){var _0xef97fe={'raw':![],'where':{'id':_0x1d6ba1['params']['id']},'include':[{'model':db['Pause'],'as':_0x4d68('0x30')}]},_0x47fd34={};_0x47fd34[_0x4d68('0x38')]=_[_0x4d68('0x36')](db[_0x4d68('0x47')][_0x4d68('0x31')]);_0x47fd34['query']=_[_0x4d68('0x36')](_0x1d6ba1[_0x4d68('0x35')]);_0x47fd34[_0x4d68('0x37')]=_['intersection'](_0x47fd34[_0x4d68('0x38')],_0x47fd34[_0x4d68('0x35')]);_0xef97fe[_0x4d68('0x39')]=_[_0x4d68('0x3a')](_0x47fd34[_0x4d68('0x38')],qs[_0x4d68('0x3b')](_0x1d6ba1[_0x4d68('0x35')][_0x4d68('0x3b')]));_0xef97fe[_0x4d68('0x39')]=_0xef97fe['attributes'][_0x4d68('0x3c')]?_0xef97fe[_0x4d68('0x39')]:_0x47fd34[_0x4d68('0x38')];if(_0x1d6ba1[_0x4d68('0x35')][_0x4d68('0x48')]){_0xef97fe[_0x4d68('0x49')]=[{'all':!![]}];}_0xef97fe=_[_0x4d68('0x44')]({},_0xef97fe,_0x1d6ba1[_0x4d68('0x46')]);return db['ChatWebsite'][_0x4d68('0x4c')](_0xef97fe)[_0x4d68('0x16')](handleEntityNotFound(_0x378a5c,null))[_0x4d68('0x16')](respondWithResult(_0x378a5c,null))[_0x4d68('0x1f')](handleError(_0x378a5c,null));};exports[_0x4d68('0x4d')]=function(_0x47599d,_0x3e2831){return db[_0x4d68('0x47')][_0x4d68('0x4d')](_0x47599d[_0x4d68('0x4e')],{})[_0x4d68('0x16')](function(_0x33b0d8){var _0x1d8940=_0x47599d[_0x4d68('0x4f')][_0x4d68('0x50')]({'plain':!![]});if(!_0x1d8940)throw new Error(_0x4d68('0x51'));if(_0x1d8940[_0x4d68('0x52')]===_0x4d68('0x4f')){var _0x5c883c=_0x33b0d8['get']({'plain':!![]});var _0x33c0f8=_0x4d68('0x29');return db[_0x4d68('0x53')][_0x4d68('0x4c')]({'where':{'name':_0x33c0f8,'userProfileId':_0x1d8940[_0x4d68('0x54')]},'raw':!![]})[_0x4d68('0x16')](function(_0x101194){if(_0x101194&&_0x101194[_0x4d68('0x55')]===0x0){return db['UserProfileResource'][_0x4d68('0x4d')]({'name':_0x5c883c[_0x4d68('0x2d')],'resourceId':_0x5c883c['id'],'type':_0x101194['name'],'sectionId':_0x101194['id']},{})[_0x4d68('0x16')](function(){return _0x33b0d8;});}else{return _0x33b0d8;}})['catch'](function(_0x59a98e){logger[_0x4d68('0x1b')](_0x4d68('0x56'),_0x59a98e);throw _0x59a98e;});}return _0x33b0d8;})[_0x4d68('0x16')](respondWithResult(_0x3e2831,0xc9))[_0x4d68('0x1f')](handleError(_0x3e2831,null));};exports[_0x4d68('0x57')]=function(_0x51bde5,_0x202c0a){if(_0x51bde5[_0x4d68('0x4e')]['id']){delete _0x51bde5['body']['id'];}return db[_0x4d68('0x47')][_0x4d68('0x4c')]({'where':{'id':_0x51bde5[_0x4d68('0x58')]['id']},'include':[{'model':db[_0x4d68('0x59')],'as':_0x4d68('0x30')}]})[_0x4d68('0x16')](handleEntityNotFound(_0x202c0a,null))[_0x4d68('0x16')](saveUpdates(_0x51bde5[_0x4d68('0x4e')],null))[_0x4d68('0x16')](respondWithResult(_0x202c0a,null))[_0x4d68('0x1f')](handleError(_0x202c0a,null));};exports[_0x4d68('0x28')]=function(_0x145d98,_0x419b3b){return db['ChatWebsite'][_0x4d68('0x4c')]({'where':{'id':_0x145d98[_0x4d68('0x58')]['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0x419b3b,null))['then'](removeEntity(_0x419b3b,null))[_0x4d68('0x1f')](handleError(_0x419b3b,null));};exports['describe']=function(_0x533811,_0x27fef1){return db['ChatWebsite'][_0x4d68('0x5a')]()['then'](respondWithResult(_0x27fef1,null))[_0x4d68('0x1f')](handleError(_0x27fef1,null));};exports[_0x4d68('0x5b')]=function(_0x14797a,_0x5f573d){if(_0x14797a[_0x4d68('0x4e')]['id']){delete _0x14797a[_0x4d68('0x4e')]['id'];}return db[_0x4d68('0x47')][_0x4d68('0x4c')]({'where':{'id':_0x14797a[_0x4d68('0x58')]['id']}})['then'](handleEntityNotFound(_0x5f573d,null))[_0x4d68('0x16')](function(_0x2bb526){if(_0x2bb526){_0x14797a[_0x4d68('0x4e')][_0x4d68('0x5c')]=_0x2bb526['id'];return db[_0x4d68('0x5d')][_0x4d68('0x4d')](_0x14797a[_0x4d68('0x4e')]);}})['then'](respondWithResult(_0x5f573d,null))[_0x4d68('0x1f')](handleError(_0x5f573d,null));};exports[_0x4d68('0x5e')]=function(_0x2c6b7e,_0x52a58d){var _0x3a6c43={'raw':![],'where':{}};var _0x3ad1f6={};var _0xc02f83={'count':0x0,'rows':[]};return db[_0x4d68('0x47')][_0x4d68('0x5f')]({'where':{'id':_0x2c6b7e['params']['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0x52a58d,null))['then'](function(_0x32db2b){if(_0x32db2b){_0x3ad1f6[_0x4d68('0x38')]=_[_0x4d68('0x36')](db[_0x4d68('0x5d')][_0x4d68('0x31')]);_0x3ad1f6[_0x4d68('0x35')]=_['keys'](_0x2c6b7e[_0x4d68('0x35')]);_0x3ad1f6[_0x4d68('0x37')]=_['intersection'](_0x3ad1f6[_0x4d68('0x38')],_0x3ad1f6[_0x4d68('0x35')]);_0x3a6c43[_0x4d68('0x39')]=_[_0x4d68('0x3a')](_0x3ad1f6[_0x4d68('0x38')],qs['fields'](_0x2c6b7e[_0x4d68('0x35')]['fields']));_0x3a6c43[_0x4d68('0x39')]=_0x3a6c43[_0x4d68('0x39')][_0x4d68('0x3c')]?_0x3a6c43[_0x4d68('0x39')]:_0x3ad1f6[_0x4d68('0x38')];if(!_0x2c6b7e['query']['hasOwnProperty'](_0x4d68('0x3e'))){_0x3a6c43[_0x4d68('0x24')]=qs[_0x4d68('0x24')](_0x2c6b7e[_0x4d68('0x35')][_0x4d68('0x24')]);_0x3a6c43[_0x4d68('0x22')]=qs['offset'](_0x2c6b7e[_0x4d68('0x35')]['offset']);}_0x3a6c43[_0x4d68('0x3f')]=qs[_0x4d68('0x40')](_0x2c6b7e[_0x4d68('0x35')][_0x4d68('0x40')]);_0x3a6c43[_0x4d68('0x41')]=qs[_0x4d68('0x37')](_[_0x4d68('0x42')](_0x2c6b7e[_0x4d68('0x35')],_0x3ad1f6[_0x4d68('0x37')]));_0x3a6c43[_0x4d68('0x41')][_0x4d68('0x5c')]=_0x32db2b['id'];if(_0x2c6b7e[_0x4d68('0x35')][_0x4d68('0x43')]){_0x3a6c43[_0x4d68('0x41')]=_[_0x4d68('0x44')](_0x3a6c43[_0x4d68('0x41')],{'$or':_[_0x4d68('0x34')](_0x3a6c43[_0x4d68('0x39')],function(_0x6512fe){var _0x20bef5={};_0x20bef5[_0x6512fe]={'$like':'%'+_0x2c6b7e['query'][_0x4d68('0x43')]+'%'};return _0x20bef5;})});}_0x3a6c43=_['merge']({},_0x3a6c43,_0x2c6b7e[_0x4d68('0x46')]);return db[_0x4d68('0x5d')][_0x4d68('0x25')]({'where':_0x3a6c43[_0x4d68('0x41')]})['then'](function(_0x41836d){_0xc02f83[_0x4d68('0x25')]=_0x41836d;if(_0x2c6b7e['query'][_0x4d68('0x48')]){_0x3a6c43[_0x4d68('0x49')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3a6c43);})['then'](function(_0x51b1c3){_0xc02f83['rows']=_0x51b1c3;return _0xc02f83;});}})['then'](respondWithFilteredResult(_0x52a58d,_0x3a6c43))[_0x4d68('0x1f')](handleError(_0x52a58d,null));};exports[_0x4d68('0x60')]=function(_0x534fb7,_0x27ef14){return db['ChatWebsite'][_0x4d68('0x4c')]({'where':{'id':_0x534fb7[_0x4d68('0x58')]['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0x27ef14,null))['then'](function(_0x3e6a45){if(_0x3e6a45){return _0x3e6a45[_0x4d68('0x60')](_0x534fb7['query'][_0x4d68('0x61')]);}})['then'](respondWithStatusCode(_0x27ef14,null))[_0x4d68('0x1f')](handleError(_0x27ef14,null));};exports[_0x4d68('0x62')]=function(_0x1da0aa,_0x1c957e){if(_0x1da0aa['body']['id']){delete _0x1da0aa[_0x4d68('0x4e')]['id'];}return db[_0x4d68('0x47')][_0x4d68('0x4c')]({'where':{'id':_0x1da0aa[_0x4d68('0x58')]['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0x1c957e,null))['then'](function(_0xf11183){if(_0xf11183){_0x1da0aa[_0x4d68('0x4e')][_0x4d68('0x5c')]=_0xf11183['id'];return db[_0x4d68('0x63')][_0x4d68('0x4d')](_0x1da0aa['body']);}})[_0x4d68('0x16')](respondWithResult(_0x1c957e,null))['catch'](handleError(_0x1c957e,null));};exports[_0x4d68('0x64')]=function(_0x4d34b5,_0x599bde){var _0x33e8cd={'raw':![],'where':{}};var _0x39a80b={};var _0x5c636d={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4d68('0x5f')]({'where':{'id':_0x4d34b5[_0x4d68('0x58')]['id']}})['then'](handleEntityNotFound(_0x599bde,null))['then'](function(_0x3352af){if(_0x3352af){_0x39a80b[_0x4d68('0x38')]=_['keys'](db[_0x4d68('0x63')][_0x4d68('0x31')]);_0x39a80b[_0x4d68('0x35')]=_[_0x4d68('0x36')](_0x4d34b5[_0x4d68('0x35')]);_0x39a80b[_0x4d68('0x37')]=_[_0x4d68('0x3a')](_0x39a80b[_0x4d68('0x38')],_0x39a80b[_0x4d68('0x35')]);_0x33e8cd[_0x4d68('0x39')]=_[_0x4d68('0x3a')](_0x39a80b['model'],qs[_0x4d68('0x3b')](_0x4d34b5[_0x4d68('0x35')]['fields']));_0x33e8cd[_0x4d68('0x39')]=_0x33e8cd[_0x4d68('0x39')][_0x4d68('0x3c')]?_0x33e8cd[_0x4d68('0x39')]:_0x39a80b[_0x4d68('0x38')];if(!_0x4d34b5[_0x4d68('0x35')][_0x4d68('0x3d')](_0x4d68('0x3e'))){_0x33e8cd[_0x4d68('0x24')]=qs[_0x4d68('0x24')](_0x4d34b5['query']['limit']);_0x33e8cd['offset']=qs[_0x4d68('0x22')](_0x4d34b5['query'][_0x4d68('0x22')]);}_0x33e8cd[_0x4d68('0x3f')]=qs[_0x4d68('0x40')](_0x4d34b5[_0x4d68('0x35')][_0x4d68('0x40')]);_0x33e8cd['where']=qs[_0x4d68('0x37')](_[_0x4d68('0x42')](_0x4d34b5[_0x4d68('0x35')],_0x39a80b['filters']));_0x33e8cd[_0x4d68('0x41')]['ChatWebsiteId']=_0x3352af['id'];if(_0x4d34b5['query'][_0x4d68('0x43')]){_0x33e8cd[_0x4d68('0x41')]=_[_0x4d68('0x44')](_0x33e8cd[_0x4d68('0x41')],{'$or':_[_0x4d68('0x34')](_0x33e8cd[_0x4d68('0x39')],function(_0x2009e7){var _0xf614b1={};_0xf614b1[_0x2009e7]={'$like':'%'+_0x4d34b5[_0x4d68('0x35')][_0x4d68('0x43')]+'%'};return _0xf614b1;})});}_0x33e8cd=_[_0x4d68('0x44')]({},_0x33e8cd,_0x4d34b5[_0x4d68('0x46')]);return db[_0x4d68('0x63')][_0x4d68('0x25')]({'where':_0x33e8cd[_0x4d68('0x41')]})[_0x4d68('0x16')](function(_0x342c4e){_0x5c636d[_0x4d68('0x25')]=_0x342c4e;if(_0x4d34b5['query'][_0x4d68('0x48')]){_0x33e8cd[_0x4d68('0x49')]=[{'all':!![]}];}return db[_0x4d68('0x63')]['findAll'](_0x33e8cd);})['then'](function(_0x34340b){_0x5c636d[_0x4d68('0x4a')]=_0x34340b;return _0x5c636d;});}})['then'](respondWithFilteredResult(_0x599bde,_0x33e8cd))['catch'](handleError(_0x599bde,null));};exports[_0x4d68('0x65')]=function(_0x413f87,_0x129f17){return db[_0x4d68('0x47')]['find']({'where':{'id':_0x413f87[_0x4d68('0x58')]['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0x129f17,null))[_0x4d68('0x16')](function(_0x365f6d){if(_0x365f6d){return _0x365f6d[_0x4d68('0x65')](_0x413f87[_0x4d68('0x35')][_0x4d68('0x61')]);}})[_0x4d68('0x16')](respondWithStatusCode(_0x129f17,null))[_0x4d68('0x1f')](handleError(_0x129f17,null));};exports[_0x4d68('0x66')]=function(_0x5a1747,_0x4b864f){_0x5a1747[_0x4d68('0x4e')][_0x4d68('0x67')]=_0x5a1747[_0x4d68('0x68')][_0x4d68('0x69')];return db[_0x4d68('0x47')]['find']({'where':{'id':_0x5a1747['params']['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0x4b864f,null))[_0x4d68('0x16')](saveUpdates(_0x5a1747[_0x4d68('0x4e')],null))['then'](respondWithResult(_0x4b864f,null))['catch'](handleError(_0x4b864f,null));};exports[_0x4d68('0x6a')]=function(_0x423220,_0x394183){_0x423220[_0x4d68('0x4e')]['agentAvatar']=_0x423220[_0x4d68('0x68')][_0x4d68('0x69')];return db[_0x4d68('0x47')]['find']({'where':{'id':_0x423220[_0x4d68('0x58')]['id']}})['then'](handleEntityNotFound(_0x394183,null))[_0x4d68('0x16')](saveUpdates(_0x423220[_0x4d68('0x4e')],null))[_0x4d68('0x16')](respondWithResult(_0x394183,null))[_0x4d68('0x1f')](handleError(_0x394183,null));};exports['addCustomerAvatar']=function(_0xae830d,_0x339aaf){_0xae830d['body'][_0x4d68('0x6b')]=_0xae830d[_0x4d68('0x68')]['filename'];return db[_0x4d68('0x47')][_0x4d68('0x4c')]({'where':{'id':_0xae830d[_0x4d68('0x58')]['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0x339aaf,null))[_0x4d68('0x16')](saveUpdates(_0xae830d['body'],null))[_0x4d68('0x16')](respondWithResult(_0x339aaf,null))[_0x4d68('0x1f')](handleError(_0x339aaf,null));};exports[_0x4d68('0x6c')]=function(_0x14184f,_0x1a279){_0x14184f[_0x4d68('0x4e')][_0x4d68('0x6d')]=_0x14184f[_0x4d68('0x68')][_0x4d68('0x69')];return db['ChatWebsite'][_0x4d68('0x4c')]({'where':{'id':_0x14184f[_0x4d68('0x58')]['id']}})['then'](handleEntityNotFound(_0x1a279,null))[_0x4d68('0x16')](saveUpdates(_0x14184f['body'],null))['then'](respondWithResult(_0x1a279,null))['catch'](handleError(_0x1a279,null));};exports[_0x4d68('0x6e')]=function(_0xdc15fc,_0x539381){var _0x5c15f1=path['join'](config[_0x4d68('0x6f')],_0x4d68('0x70'));var _0x50446b={'where':{'id':_0xdc15fc[_0x4d68('0x58')]['id']},'attributes':['id',_0x4d68('0x67')],'raw':!![]};var _0x48d123=![];return require(_0x4d68('0x71'))[_0x4d68('0x72')]()[_0x4d68('0x16')](function(_0x1ad8b5){if(_0x1ad8b5){_0x48d123=_0x1ad8b5[_0x4d68('0x73')];}})['then'](function(){return db[_0x4d68('0x47')][_0x4d68('0x4c')](_0x50446b);})[_0x4d68('0x16')](handleEntityNotFound(_0x539381,null))[_0x4d68('0x16')](function(_0x54246b){if(_0x54246b){if(!_[_0x4d68('0x74')](_0x54246b[_0x4d68('0x67')])){if(fs[_0x4d68('0x75')](path[_0x4d68('0x76')](config['root'],_0x4d68('0x77'),_0x54246b[_0x4d68('0x67')]))&&_0x48d123){_0x5c15f1=path[_0x4d68('0x76')](config['root'],_0x4d68('0x77'),_0x54246b[_0x4d68('0x67')]);}}return _0x539381[_0x4d68('0x78')](_0x5c15f1);}})[_0x4d68('0x1f')](handleError(_0x539381,null));};exports[_0x4d68('0x79')]=function(_0x393f69,_0x2a2301){var _0x4954ba=path[_0x4d68('0x76')](config[_0x4d68('0x6f')],'server/files/images/avatars/default_avatar.png');var _0x426d17={'where':{'id':_0x393f69[_0x4d68('0x58')]['id']},'attributes':['id',_0x4d68('0x7a')],'raw':!![]};return db[_0x4d68('0x47')][_0x4d68('0x4c')](_0x426d17)[_0x4d68('0x16')](handleEntityNotFound(_0x2a2301,null))[_0x4d68('0x16')](function(_0xce8302){if(_0xce8302){if(!_[_0x4d68('0x74')](_0xce8302['agentAvatar'])){if(fs[_0x4d68('0x75')](path[_0x4d68('0x76')](config[_0x4d68('0x6f')],_0x4d68('0x7b'),_0xce8302['agentAvatar']))){_0x4954ba=path['join'](config['root'],_0x4d68('0x7b'),_0xce8302['agentAvatar']);}}return _0x2a2301['download'](_0x4954ba);}})[_0x4d68('0x1f')](handleError(_0x2a2301,null));};exports[_0x4d68('0x7c')]=function(_0x178eab,_0x39bcb6){var _0x2529ce=path[_0x4d68('0x76')](config['root'],_0x4d68('0x7d'));var _0x1b2227={'where':{'id':_0x178eab['params']['id']},'attributes':['id',_0x4d68('0x6b'),'showCustomerAvatar'],'raw':!![]};return db[_0x4d68('0x47')][_0x4d68('0x4c')](_0x1b2227)[_0x4d68('0x16')](handleEntityNotFound(_0x39bcb6,null))['then'](function(_0x21e9f0){if(_0x21e9f0){if(!_[_0x4d68('0x74')](_0x21e9f0[_0x4d68('0x6b')])){if(fs[_0x4d68('0x75')](path['join'](config[_0x4d68('0x6f')],_0x4d68('0x7b'),_0x21e9f0[_0x4d68('0x6b')]))&&_0x21e9f0[_0x4d68('0x7e')]){_0x2529ce=path[_0x4d68('0x76')](config[_0x4d68('0x6f')],_0x4d68('0x7b'),_0x21e9f0[_0x4d68('0x6b')]);}}return _0x39bcb6['download'](_0x2529ce);}})[_0x4d68('0x1f')](handleError(_0x39bcb6,null));};exports[_0x4d68('0x7f')]=function(_0x28502e,_0x4063ba){var _0x1c3068=path[_0x4d68('0x76')](config[_0x4d68('0x6f')],_0x4d68('0x80'));var _0x2a2a59={'where':{'id':_0x28502e[_0x4d68('0x58')]['id']},'attributes':['id',_0x4d68('0x6d')],'raw':!![]};return db[_0x4d68('0x47')][_0x4d68('0x4c')](_0x2a2a59)[_0x4d68('0x16')](handleEntityNotFound(_0x4063ba,null))[_0x4d68('0x16')](function(_0x482107){if(_0x482107){if(!_[_0x4d68('0x74')](_0x482107[_0x4d68('0x6d')])){if(fs[_0x4d68('0x75')](path[_0x4d68('0x76')](config[_0x4d68('0x6f')],_0x4d68('0x7b'),_0x482107['systemAvatar']))){_0x1c3068=path[_0x4d68('0x76')](config['root'],'server/files/images/avatars/',_0x482107[_0x4d68('0x6d')]);}}return _0x4063ba[_0x4d68('0x78')](_0x1c3068);}})['catch'](handleError(_0x4063ba,null));};exports['notify']=function(_0x2266d9,_0x21b176){var _0x547b4b=require(_0x4d68('0x81'));var _0x12d118=new _0x547b4b();var _0x3cf72e=_0x12d118[_0x4d68('0x82')](_0x2266d9[_0x4d68('0x83')][_0x4d68('0x84')])['getResult']();var _0x444bf9={'body':_0x2266d9[_0x4d68('0x4e')],'channel':_0x4d68('0x85')};var _0x44715a=[];var _0x13994f=[];var _0x1f6388={};var _0x2aec01=![];return db[_0x4d68('0x86')][_0x4d68('0x5a')]()[_0x4d68('0x16')](function(_0x37f72d){if(!_0x37f72d){throw new db[(_0x4d68('0x87'))][(_0x4d68('0x88'))]('no\x20available\x20attributes');}_0x44715a=_['difference'](_[_0x4d68('0x36')](_0x37f72d),['createdAt',_0x4d68('0x89')]);_0x13994f=_[_0x4d68('0x8a')](_['keys'](_0x37f72d),['createdAt',_0x4d68('0x89'),_0x4d68('0x8b'),'ListId']);if(_0x2266d9[_0x4d68('0x4e')]['id']){delete _0x2266d9['body']['id'];}if(_[_0x4d68('0x74')](_0x2266d9[_0x4d68('0x4e')][_0x4d68('0x8c')])){throw new db['Sequelize'][(_0x4d68('0x88'))]('from\x20is\x20mandatory');}if(_[_0x4d68('0x74')](_0x2266d9[_0x4d68('0x4e')][_0x4d68('0x4e')])||_0x2266d9[_0x4d68('0x4e')]['body']===''){throw new db[(_0x4d68('0x87'))][(_0x4d68('0x88'))](_0x4d68('0x8d'));}if(_[_0x4d68('0x74')](_0x2266d9['body'][_0x4d68('0x8e')])){throw new db['Sequelize'][(_0x4d68('0x88'))](_0x4d68('0x8f')+_0x13994f);}if(!_[_0x4d68('0x90')](_0x13994f,_0x2266d9[_0x4d68('0x4e')][_0x4d68('0x8e')])){throw new db[(_0x4d68('0x87'))][(_0x4d68('0x88'))](_0x4d68('0x91')+_0x13994f);}_0x1f6388[_0x2266d9[_0x4d68('0x4e')][_0x4d68('0x8e')]]=_0x2266d9['body']['from'];})['then'](function(){return db['ChatWebsite'][_0x4d68('0x4c')]({'where':{'id':_0x2266d9[_0x4d68('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x4d68('0x92'),'include':[{'model':db[_0x4d68('0x86')],'as':_0x4d68('0x93'),'where':_0x1f6388,'limit':0x1,'order':[[_0x4d68('0x89'),_0x4d68('0x94')]]}]},{'model':db['ChatApplication'],'as':_0x4d68('0x95')}]});})[_0x4d68('0x16')](handleEntityNotFound(_0x21b176,null))[_0x4d68('0x16')](function(_0x2fa3fd){if(_0x2fa3fd&&_0x2fa3fd[_0x4d68('0x92')]){_0x444bf9[_0x4d68('0x96')]=_0x2fa3fd;_0x444bf9[_0x4d68('0x97')]=_0x2fa3fd[_0x4d68('0x95')];_0x444bf9[_0x4d68('0x98')]=_0x2fa3fd[_0x4d68('0x92')];_0x444bf9[_0x4d68('0x97')]=_[_0x4d68('0x99')](_0x444bf9['applications'],[_0x4d68('0x9a')],[_0x4d68('0x9b')]);if(_0x444bf9['account'][_0x4d68('0x95')]){delete _0x444bf9['account']['Applications'];}if(_0x444bf9[_0x4d68('0x96')][_0x4d68('0x92')]&&_0x444bf9[_0x4d68('0x96')][_0x4d68('0x92')][_0x4d68('0x93')]['length']){return _0x444bf9['account'][_0x4d68('0x92')][_0x4d68('0x93')][0x0];}var _0x53303d=_[_0x4d68('0xe')](_0x2266d9[_0x4d68('0x4e')],{'firstName':_0x2266d9[_0x4d68('0x4e')][_0x4d68('0x8c')],'ListId':_0x2fa3fd[_0x4d68('0x9c')]});_0x53303d[_0x2266d9['body'][_0x4d68('0x8e')]]=_0x2266d9[_0x4d68('0x4e')][_0x4d68('0x8c')];return db[_0x4d68('0x86')][_0x4d68('0x4d')](_0x53303d,{'fields':_0x44715a,'raw':!![]});}})['then'](handleEntityNotFound(_0x21b176,null))[_0x4d68('0x16')](function(_0x29af87){_0x444bf9[_0x4d68('0x9d')]=_0x29af87;var _0x39d556=_0x2266d9[_0x4d68('0x4e')][_0x4d68('0x9e')];if(_0x2266d9[_0x4d68('0x83')]['cf-connecting-ip']){_0x39d556=_0x2266d9[_0x4d68('0x83')][_0x4d68('0x9f')];}else if(_0x2266d9[_0x4d68('0x83')]['x-forwarded-for']){_0x39d556=_[_0x4d68('0xa0')](_0x2266d9[_0x4d68('0x83')][_0x4d68('0xa1')][_0x4d68('0xa2')](','));}if(_0x29af87){var _0x5adffa={'ContactId':_0x29af87['id'],'ChatWebsiteId':_0x2266d9[_0x4d68('0x58')]['id'],'from':(_0x29af87['firstName']||'')+'\x20'+(_0x29af87[_0x4d68('0xa3')]||''),'customerIp':_0x39d556,'customerPort':_0x2266d9[_0x4d68('0x83')]['x-real-port']?_0x2266d9[_0x4d68('0x83')][_0x4d68('0xa4')]:null,'referer':_0x2266d9[_0x4d68('0x4e')]['referer'],'browserName':_0x3cf72e[_0x4d68('0xa5')][_0x4d68('0x2d')]&&_0x3cf72e['browser']['version']?util[_0x4d68('0xa6')](_0x4d68('0xa7'),_0x3cf72e[_0x4d68('0xa5')][_0x4d68('0x2d')],_0x3cf72e['browser'][_0x4d68('0xa8')]):_0x4d68('0xa9'),'browserVersion':_0x3cf72e['browser'][_0x4d68('0xa8')]||_0x4d68('0xa9'),'osName':util[_0x4d68('0xa6')](_0x4d68('0xa7'),_0x3cf72e['os']['name'],_0x3cf72e['os'][_0x4d68('0xa8')]),'osVersion':_0x3cf72e['os']['version'],'deviceModel':_0x3cf72e[_0x4d68('0xaa')][_0x4d68('0x38')]&&_0x3cf72e[_0x4d68('0xaa')][_0x4d68('0xab')]?util[_0x4d68('0xa6')]('%s\x20%s\x20%s',_0x3cf72e[_0x4d68('0xaa')][_0x4d68('0x38')],_0x3cf72e[_0x4d68('0xaa')]['vendor'],_0x3cf72e[_0x4d68('0xaa')][_0x4d68('0x33')]):null,'deviceVendor':_0x3cf72e[_0x4d68('0xaa')][_0x4d68('0xab')],'deviceType':_0x3cf72e[_0x4d68('0xaa')][_0x4d68('0x33')],'formData':JSON[_0x4d68('0xac')](_0x2266d9[_0x4d68('0x4e')])};var _0x47858a={'ChatWebsiteId':_0x2266d9[_0x4d68('0x58')]['id'],'closed':![]};if(_0x2266d9[_0x4d68('0x4e')][_0x4d68('0xad')]){_0x47858a['threadId']=_0x2266d9['body']['threadId'];return db[_0x4d68('0xae')][_0x4d68('0x4c')]({'where':_0x47858a})[_0x4d68('0x16')](function(_0x4647ac){if(_0x4647ac){return[_0x4647ac,![]];}_0x5adffa[_0x4d68('0xad')]=_0x2266d9[_0x4d68('0x4e')][_0x4d68('0xad')];_0x5adffa[_0x4d68('0xaf')]=_0x2266d9[_0x4d68('0x4e')][_0x4d68('0xaf')];return db[_0x4d68('0xae')][_0x4d68('0x4d')](_0x5adffa)['then'](function(_0x69195a){return[_0x69195a,!![]];});});}_0x47858a[_0x4d68('0xb0')]=_0x29af87['id'];if(_0x2266d9[_0x4d68('0x4e')]['interaction']&&_0x2266d9['body'][_0x4d68('0xb1')]['id']){_0x47858a['id']=_0x2266d9['body']['interaction']['id'];return db[_0x4d68('0xae')]['find']({'where':_0x47858a})[_0x4d68('0x16')](function(_0x1b1441){if(_0x1b1441){return[_0x1b1441,![]];}return db[_0x4d68('0xae')][_0x4d68('0x4d')](_0x5adffa)[_0x4d68('0x16')](function(_0x20fd1d){return[_0x20fd1d,!![]];});});}return db[_0x4d68('0xae')][_0x4d68('0x4d')](_0x5adffa)[_0x4d68('0x16')](function(_0x2b28a5){return[_0x2b28a5,!![]];});}})[_0x4d68('0xb2')](function(_0x20f813,_0x34f3ab){if(_0x20f813){_0x2aec01=_0x34f3ab;if(!_0x34f3ab){var _0x408bee={'from':(_0x444bf9[_0x4d68('0x9d')][_0x4d68('0xb3')]||'')+'\x20'+(_0x444bf9[_0x4d68('0x9d')][_0x4d68('0xa3')]||'')};if(_0x2266d9['body'][_0x4d68('0xad')]&&_0x2266d9[_0x4d68('0x4e')]['messageId']&&_0x2266d9[_0x4d68('0x4e')][_0x4d68('0xad')]!=_0x2266d9[_0x4d68('0x4e')][_0x4d68('0xb4')]){_0x408bee[_0x4d68('0xad')]=_0x2266d9[_0x4d68('0x4e')]['messageId'];}return _0x20f813[_0x4d68('0x57')](_0x408bee);}else{return _0x20f813;}}})[_0x4d68('0x16')](function(_0x17ca2d){_0x444bf9['interaction']=_0x17ca2d[_0x4d68('0x50')]({'plain':!![]});_0x444bf9[_0x4d68('0xb1')]['created']=_0x2aec01;if(_0x444bf9[_0x4d68('0xb1')][_0x4d68('0xb5')]){if(_0x444bf9[_0x4d68('0x96')]['autoclose']){_0x444bf9[_0x4d68('0x97')]['push']({'id':0x0,'priority':_0x444bf9['applications'][_0x4d68('0x3c')]+0x1,'app':_0x4d68('0xb6'),'appdata':_0x4d68('0xb7'),'interval':_0x4d68('0xb8')});}}return db[_0x4d68('0xb9')]['create']({'body':_0x2266d9[_0x4d68('0x4e')][_0x4d68('0x4e')],'ChatWebsiteId':_0x2266d9['params']['id'],'ChatInteractionId':_0x17ca2d['id'],'direction':'in','ContactId':_0x444bf9[_0x4d68('0x9d')]['id'],'AttachmentId':_0x2266d9[_0x4d68('0x4e')][_0x4d68('0xba')]});})['then'](function(_0x104c80){_0x444bf9[_0x4d68('0x1d')]=_0x104c80;if(_0x444bf9[_0x4d68('0xb1')][_0x4d68('0xbb')]){return db[_0x4d68('0xbc')][_0x4d68('0x4c')]({'attributes':['id','name'],'where':{'id':_0x444bf9[_0x4d68('0xb1')][_0x4d68('0xbb')]}})['then'](function(_0x368ca3){if(_0x368ca3){_0x444bf9['applications'][_0x4d68('0xbd')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x368ca3[_0x4d68('0x2d')]+','+(_0x444bf9[_0x4d68('0x96')][_0x4d68('0xbe')]||0xa),'interval':'*,*,*,*'});_0x444bf9[_0x4d68('0xbf')]=!![];}return respondWithRpcPromise(_0x4d68('0xc0'),_0x4d68('0xc1'),_0x444bf9);});}return respondWithRpcPromise(_0x4d68('0xc0'),_0x4d68('0xc1'),_0x444bf9);})[_0x4d68('0x16')](function(_0x5611c4){respondWithRpcPromise(_0x4d68('0xc2'),_0x4d68('0xc2'),{'event':_0x4d68('0xc3'),'message':_0x5611c4},client9002);return _0x5611c4;})['then'](respondWithResult(_0x21b176,null))[_0x4d68('0x1f')](handleError(_0x21b176,null));};exports[_0x4d68('0xc4')]=function(_0x3ed878,_0x50ba13){var _0x4c15ab,_0x2f3de6,_0x3cd713;var _0x19335d=[];var _0xe0422a={};var _0x48022f=_0x3ed878[_0x4d68('0xc5')]||[];var _0x204b77=[];var _0x13f02d;return db[_0x4d68('0x86')][_0x4d68('0x5a')]()[_0x4d68('0x16')](function(_0x275bd4){if(!_0x275bd4){throw new db[(_0x4d68('0x87'))]['ValidationError'](_0x4d68('0xc6'));}_0x19335d=_[_0x4d68('0x8a')](_[_0x4d68('0x36')](_0x275bd4),[_0x4d68('0xc7'),'updatedAt',_0x4d68('0x8b'),_0x4d68('0x9c')]);if(_0x3ed878[_0x4d68('0x4e')]['id']){delete _0x3ed878['body']['id'];}if(_['isNil'](_0x3ed878['body']['from'])){throw _0x50ba13[_0x4d68('0x20')](0x1f4)['send'](new db[(_0x4d68('0x87'))]['ValidationError'](_0x4d68('0xc8')));}if(_['isNil'](_0x3ed878['body'][_0x4d68('0x4e')])||_0x3ed878['body'][_0x4d68('0x4e')]===''){throw _0x50ba13[_0x4d68('0x20')](0x1f4)[_0x4d68('0x2e')](new db[(_0x4d68('0x87'))][(_0x4d68('0x88'))](_0x4d68('0x8d')));}if(_[_0x4d68('0x74')](_0x3ed878[_0x4d68('0x4e')][_0x4d68('0xc9')])){throw _0x50ba13[_0x4d68('0x20')](0x1f4)[_0x4d68('0x2e')](new db[(_0x4d68('0x87'))][(_0x4d68('0x88'))](_0x4d68('0xca')+_0x19335d));}if(!_['includes'](_0x19335d,_0x3ed878[_0x4d68('0x4e')][_0x4d68('0xc9')])){throw _0x50ba13[_0x4d68('0x20')](0x1f4)[_0x4d68('0x2e')](new db[(_0x4d68('0x87'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x19335d));}_0xe0422a[_0x3ed878[_0x4d68('0x4e')][_0x4d68('0xc9')]]=_0x3ed878[_0x4d68('0x4e')][_0x4d68('0x8c')];})[_0x4d68('0x16')](function(){return db[_0x4d68('0x47')][_0x4d68('0x4c')]({'where':{'id':_0x3ed878[_0x4d68('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x4d68('0x92')},{'model':db[_0x4d68('0xcb')],'as':_0x4d68('0xcb')}]});})[_0x4d68('0x16')](handleEntityNotFound(_0x50ba13,null))[_0x4d68('0x16')](function(_0x448e19){if(_0x448e19&&_0x448e19[_0x4d68('0x92')]){_0x2f3de6=_0x448e19;var _0x4fe7e8=_[_0x4d68('0xe')](_0x3ed878[_0x4d68('0x4e')],{'firstName':_0x3ed878[_0x4d68('0x4e')][_0x4d68('0x8c')],'phone':_0x3ed878['body'][_0x4d68('0x8c')],'ListId':_0x448e19['ListId']});_0x4fe7e8[_0x3ed878[_0x4d68('0x4e')]['mapKeyOffline']]=_0x3ed878[_0x4d68('0x4e')][_0x4d68('0x8c')];return db[_0x4d68('0x86')][_0x4d68('0xcc')]({'where':_0xe0422a,'defaults':_0x4fe7e8});}})[_0x4d68('0xb2')](function(_0xd9580c){if(_0xd9580c){_0x3cd713=_0xd9580c;var _0x537064=fs[_0x4d68('0xcd')](path['join'](config[_0x4d68('0x6f')],'server/files/templates/chatOfflineMessage.ejs'),_0x4d68('0xce'));var _0x4125fc=ejs[_0x4d68('0xcf')](_0x537064,{'body':_[_0x4d68('0xd0')](_0x3ed878[_0x4d68('0x4e')]['body']),'bodyTitle':_0x2f3de6[_0x4d68('0xd1')]});return db[_0x4d68('0xd2')][_0x4d68('0x4d')]({'body':_0x4125fc,'ContactId':_0xd9580c['id'],'ChatWebsiteId':_0x2f3de6['id']});}})['then'](function(_0x55e050){_0x13f02d=_0x55e050;if(_0x48022f['length']){var _0x8eee19=_0x48022f[_0x4d68('0x34')](function(_0x21980d){return{'name':_0x21980d[_0x4d68('0xd3')],'basename':_0x21980d[_0x4d68('0x69')],'type':_0x21980d[_0x4d68('0xd4')],'ChatOfflineMessageId':_0x55e050['id']};});_0x204b77=_0x8eee19[_0x4d68('0x34')](_0x51e692=>{var _0x27e567={'filename':_0x51e692[_0x4d68('0x2d')],'path':path[_0x4d68('0x76')](config['root'],_0x4d68('0xd5'),_0x4d68('0xc5'),'attachments','offline-chat',_0x51e692['basename'])};return _0x27e567;});if(!_0x2f3de6[_0x4d68('0xd6')]){return db[_0x4d68('0xd7')][_0x4d68('0xd8')](function(_0x167c46){return db[_0x4d68('0xd9')][_0x4d68('0xda')](_0x8eee19,{'transaction':_0x167c46});});}}})[_0x4d68('0x16')](function(){if(_0x13f02d){_0x4c15ab=_0x13f02d;return db[_0x4d68('0xcb')][_0x4d68('0x5f')]({'where':{'active':!![]},'include':[{'model':db[_0x4d68('0xdb')],'as':'Smtp','raw':!![]}]});}})[_0x4d68('0x16')](function(_0x2d175e){if(_0x2d175e&&_0x2d175e[_0x4d68('0xdc')]&&_0x2f3de6[_0x4d68('0xdd')]&&_0x2f3de6[_0x4d68('0xde')]){var _0x1cf31f={'tls':{'rejectUnauthorized':![]}};if(_0x2d175e[_0x4d68('0xdc')]['service']){_0x1cf31f['service']=_0x2d175e[_0x4d68('0xdc')][_0x4d68('0xdf')];}else{_0x1cf31f['host']=_0x2d175e[_0x4d68('0xdc')][_0x4d68('0xe0')];_0x1cf31f[_0x4d68('0xe1')]=_0x2d175e[_0x4d68('0xdc')][_0x4d68('0xe1')];_0x1cf31f[_0x4d68('0xe2')]=_0x2d175e['Smtp'][_0x4d68('0xe2')];}if(_0x2d175e[_0x4d68('0xdc')][_0x4d68('0xe3')]){_0x1cf31f['auth']={'user':_0x2d175e['Smtp'][_0x4d68('0x4f')],'pass':_0x2d175e[_0x4d68('0xdc')]['pass']};}return respondWithRpcPromise(_0x4d68('0xe4'),_0x4d68('0xe5'),{'account':_0x1cf31f,'message':{'from':util['format'](_0x4d68('0xe6'),_0x2d175e[_0x4d68('0x2d')],_0x2d175e[_0x4d68('0xe7')]||_0x2d175e[_0x4d68('0xdc')][_0x4d68('0x4f')]),'to':_0x2f3de6[_0x4d68('0xde')],'subject':_0x2f3de6[_0x4d68('0xe8')],'html':_0x4c15ab['body'],'attachments':_0x204b77}},client9003)['then'](function(){return _0x4c15ab;})[_0x4d68('0x1f')](function(_0x396d54){console[_0x4d68('0x1b')](_0x396d54);});}})[_0x4d68('0x16')](function(){if(_0x2f3de6&&_0x2f3de6[_0x4d68('0xd6')]&&_0x2f3de6[_0x4d68('0xe9')]){var _0x23ff2a=[];if(_0x48022f[_0x4d68('0x3c')]){_0x23ff2a=_0x48022f[_0x4d68('0x34')](function(_0x3a06a4){return{'name':_0x3a06a4[_0x4d68('0xd3')],'basename':_0x3a06a4[_0x4d68('0x69')],'type':_0x3a06a4[_0x4d68('0xd4')],'ChatOfflineMessageId':_0x13f02d['id']};});}var _0x435c4e;if(!_['isNil'](_0x2f3de6['subjectOffline'])){var _0x5a0696=_[_0x4d68('0x34')](_0x3ed878[_0x4d68('0x4e')],function(_0xc523e8){return _0xc523e8;});var _0xe49a75=_['toPairsIn'](_0x5a0696)[0x0];var _0x566c63=_['mapValues'](_0xe49a75,function(_0x5016e0){return _0x5016e0;});_0x435c4e=_0x566c63[0x1][_0x2f3de6[_0x4d68('0xea')]];}var _0x2a51ee={'from':_0x3cd713[_0x4d68('0xe7')],'firstName':_0x3cd713[_0x4d68('0xb3')],'lastName':_0x3cd713[_0x4d68('0xa3')],'mapKey':_0x4d68('0xe7'),'message':{'from':_0x3cd713[_0x4d68('0xe7')],'to':_0x2f3de6[_0x4d68('0xcb')][_0x4d68('0xe7')],'cc':'','subject':_['isNil'](_0x435c4e)?_0x2f3de6[_0x4d68('0xe8')]:_0x435c4e,'messageId':'','sentAt':new Date(),'attach':_0x23ff2a[_0x4d68('0x3c')],'attachments':_0x23ff2a,'originChannel':_0x4d68('0xeb'),'ChatWebsiteId':_0x2f3de6['id'],'ChatOfflineMessageId':_0x4c15ab['id'],'originTo':_0x2f3de6['MailAccount'][_0x4d68('0xe7')]},'body':_0x4c15ab['body']};var _0x379567={'account':{'id':_0x2f3de6[_0x4d68('0xe9')]},'body':_0x2a51ee,'log':_0x4d68('0xec')};return respondWithRpcPromise('NotifyMailAccount',_0x4d68('0xed'),_0x379567,client9001)[_0x4d68('0x16')](function(){return _0x4c15ab;})[_0x4d68('0x1f')](function(_0x488eb7){console['error'](_0x488eb7);});}return;})[_0x4d68('0x16')](function(){if(_0x4c15ab){return _0x4c15ab;}})[_0x4d68('0x16')](respondWithResult(_0x50ba13,null))[_0x4d68('0x1f')](function(_0x3038e0){console[_0x4d68('0x1b')](_0x4d68('0x1f'),_0x3038e0);for(var _0x256fc2 of _0x48022f){var _0x5838ea=path[_0x4d68('0x76')](config[_0x4d68('0x6f')],_0x4d68('0xd5'),_0x4d68('0xc5'),_0x4d68('0xee'),_0x4d68('0xef'),_0x256fc2['filename']);fs_extra['remove'](_0x5838ea)[_0x4d68('0x1f')](function(_0x28b2a2){console[_0x4d68('0x1b')]('Could\x20not\x20remove\x20attachment\x20file',_0x5838ea,_0x28b2a2);});}});};exports[_0x4d68('0xf0')]=function(_0x48373c,_0x5d354d){return db[_0x4d68('0xae')][_0x4d68('0x4c')]({'where':{'id':_0x48373c['params']['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0x5d354d,null))[_0x4d68('0x16')](function(_0x27431c){if(_0x27431c){return _0x27431c['addInteraction'](_0x48373c[_0x4d68('0x4e')][_0x4d68('0x61')],_[_0x4d68('0xf1')](_0x48373c['body'],['ids','id'])||{});}})[_0x4d68('0x16')](respondWithResult(_0x5d354d,null))[_0x4d68('0x1f')](handleError(_0x5d354d,null));};exports['getInteractions']=function(_0x2dca38,_0x729f71){var _0x4223b7={'raw':![],'where':{}};var _0x807bc2={};var _0x383e80={'count':0x0,'rows':[]};return db[_0x4d68('0x47')][_0x4d68('0x5f')]({'where':{'id':_0x2dca38[_0x4d68('0x58')]['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0x729f71,null))[_0x4d68('0x16')](function(_0x3923d2){if(_0x3923d2){_0x807bc2[_0x4d68('0x38')]=_[_0x4d68('0x36')](db['ChatInteraction'][_0x4d68('0x31')]);_0x807bc2[_0x4d68('0x35')]=_['keys'](_0x2dca38[_0x4d68('0x35')]);_0x807bc2['filters']=_['intersection'](_0x807bc2[_0x4d68('0x38')],_0x807bc2[_0x4d68('0x35')]);_0x4223b7[_0x4d68('0x39')]=_[_0x4d68('0x3a')](_0x807bc2[_0x4d68('0x38')],qs[_0x4d68('0x3b')](_0x2dca38[_0x4d68('0x35')][_0x4d68('0x3b')]));_0x4223b7[_0x4d68('0x39')]=_0x4223b7[_0x4d68('0x39')][_0x4d68('0x3c')]?_0x4223b7[_0x4d68('0x39')]:_0x807bc2[_0x4d68('0x38')];if(!_0x2dca38[_0x4d68('0x35')]['hasOwnProperty']('nolimit')){_0x4223b7[_0x4d68('0x24')]=qs['limit'](_0x2dca38[_0x4d68('0x35')][_0x4d68('0x24')]);_0x4223b7[_0x4d68('0x22')]=qs[_0x4d68('0x22')](_0x2dca38[_0x4d68('0x35')]['offset']);}_0x4223b7[_0x4d68('0x3f')]=qs[_0x4d68('0x40')](_0x2dca38[_0x4d68('0x35')][_0x4d68('0x40')]);_0x4223b7[_0x4d68('0x41')]=qs['filters'](_[_0x4d68('0x42')](_0x2dca38[_0x4d68('0x35')],_0x807bc2['filters']));_0x4223b7[_0x4d68('0x41')]['ChatWebsiteId']=_0x3923d2['id'];if(_0x2dca38['query'][_0x4d68('0x43')]){_0x4223b7[_0x4d68('0x41')]=_[_0x4d68('0x44')](_0x4223b7[_0x4d68('0x41')],{'$or':_['map'](_0x4223b7[_0x4d68('0x39')],function(_0x14fe55){var _0x2015cd={};_0x2015cd[_0x14fe55]={'$like':'%'+_0x2dca38[_0x4d68('0x35')][_0x4d68('0x43')]+'%'};return _0x2015cd;})});}_0x4223b7=_['merge']({},_0x4223b7,_0x2dca38[_0x4d68('0x46')]);return db['ChatInteraction'][_0x4d68('0x25')]({'where':_0x4223b7[_0x4d68('0x41')]})[_0x4d68('0x16')](function(_0x1a98a6){_0x383e80[_0x4d68('0x25')]=_0x1a98a6;if(_0x2dca38[_0x4d68('0x35')][_0x4d68('0x48')]){_0x4223b7['include']=[{'model':db[_0x4d68('0x86')],'as':'Contact','required':![]},{'model':db[_0x4d68('0xbc')],'as':_0x4d68('0xf2'),'attributes':['name',_0x4d68('0xf3'),_0x4d68('0xf4')],'required':![]},{'model':db['Tag'],'as':_0x4d68('0xf5'),'attributes':['id',_0x4d68('0x2d'),_0x4d68('0xf6')],'where':_0x2dca38[_0x4d68('0x35')][_0x4d68('0xf7')]?{'id':_0x2dca38['query'][_0x4d68('0xf7')]}:undefined,'required':_0x2dca38[_0x4d68('0x35')][_0x4d68('0xf7')]?!![]:![]}];}return db['ChatInteraction'][_0x4d68('0xf8')](_0x4223b7);})[_0x4d68('0x16')](function(_0x1efaec){_0x383e80[_0x4d68('0x4a')]=_0x1efaec;return _0x383e80;});}})[_0x4d68('0x16')](respondWithFilteredResult(_0x729f71,_0x4223b7))[_0x4d68('0x1f')](handleError(_0x729f71,null));};function iftimePromise(_0x1a8f30,_0x2014bc){return respondWithRpcPromise(_0x4d68('0xf9'),_0x4d68('0xfa'),{'command':_0x2014bc[_0x4d68('0xfb')]?util[_0x4d68('0xa6')](_0x4d68('0xfc'),_0x1a8f30[_0x4d68('0xfd')],_0x2014bc[_0x4d68('0xfb')]):util['format'](_0x4d68('0xfe'),_0x1a8f30[_0x4d68('0xfd')])},client9002)[_0x4d68('0x16')](function(_0xd34cc0){var _0x345756=_0xd34cc0&&_0xd34cc0[_0x4d68('0xff')]('true')>=0x0?!![]:![];logger[_0x4d68('0x17')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2014bc['id'],_0x1a8f30['id'],_0x1a8f30[_0x4d68('0xfd')],_0x345756?'ONLINE':_0x4d68('0x100'),_0x2014bc[_0x4d68('0xfb')]?_0x2014bc['timezone']:_0x4d68('0x101'));return _0x345756;})[_0x4d68('0x1f')](function(_0x50c6a0){logger['error'](_0x4d68('0x102'),_0x2014bc['id'],_0x1a8f30['id'],_0x1a8f30[_0x4d68('0xfd')],util[_0x4d68('0x103')](_0x50c6a0,{'showHidden':![],'depth':null}),_0x2014bc[_0x4d68('0xfb')]?_0x2014bc['timezone']:_0x4d68('0x101'));return![];});}exports[_0x4d68('0xfa')]=function(_0x21d07a,_0x3f9e2f){var _0x38d7e7=0x0;var _0x1403c6=0x0;var _0x1854a3=![];var _0x5b27b1;var _0x443b58;return db[_0x4d68('0x47')]['find']({'where':{'id':_0x21d07a['params']['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x4d68('0x104')],'as':_0x4d68('0x105'),'attributes':['id',_0x4d68('0xfd')],'raw':!![]}]}]})[_0x4d68('0x16')](handleEntityNotFound(_0x3f9e2f,null))[_0x4d68('0x16')](function(_0xa48ed6){if(_0xa48ed6){_0x5b27b1=_0xa48ed6;return _0xa48ed6['getProactiveActions']({'raw':!![]});}})[_0x4d68('0x16')](function(_0x22ea53){if(_0x5b27b1){if(_0x22ea53){_0x443b58=_0x22ea53;}}return require(_0x4d68('0x71'))[_0x4d68('0x72')]();})[_0x4d68('0x16')](function(_0x494cbe){if(_0x494cbe){_0x1403c6=_0x494cbe[_0x4d68('0x106')];_0x1854a3=_0x494cbe[_0x4d68('0x73')];}})[_0x4d68('0x16')](function(){return db[_0x4d68('0xae')][_0x4d68('0x25')]({'where':{'closed':![]}});})['then'](function(_0x43a543){_0x38d7e7=_0x43a543;if(_0x1403c6&&_0x43a543>_0x1403c6){return db[_0x4d68('0x107')]['findOne']({'where':{'id':0x1}})[_0x4d68('0x16')](function(_0x25ada4){if(_0x25ada4){_0x25ada4['increment'](_0x4d68('0x108'));}});}})[_0x4d68('0x16')](function(){if(_0x5b27b1['Interval']&&_0x5b27b1[_0x4d68('0x104')][_0x4d68('0x105')]){var _0x37ff64=[];for(var _0x61815f=0x0;_0x61815f<_0x5b27b1[_0x4d68('0x104')][_0x4d68('0x105')]['length'];_0x61815f++){var _0x526ea3=_0x5b27b1['Interval'][_0x4d68('0x105')][_0x61815f][_0x4d68('0x50')]({'plain':!![]});_0x37ff64[_0x4d68('0x109')](iftimePromise(_0x526ea3,_0x5b27b1));}return BPromise[_0x4d68('0x10a')](_0x37ff64)[_0x4d68('0x16')](function(_0x5449f1){return _['some'](_0x5449f1);});}else{return!![];}})['then'](function(_0x656f08){var _0xe1002a=fs['readFileSync'](path[_0x4d68('0x76')](config['root'],_0x4d68('0x10b')),'utf8');var _0x1d0236={'remote':_0x5b27b1['remote'],'query':querystring['stringify'](_[_0x4d68('0x44')](_0x5b27b1[_0x4d68('0x50')]({'plain':!![]}),{'customerIp':_0x21d07a[_0x4d68('0x83')][_0x4d68('0xa1')]||_0x21d07a[_0x4d68('0x83')][_0x4d68('0x10c')]||_0x21d07a[_0x4d68('0x10d')][_0x4d68('0x10e')]||_0x21d07a['ip'],'referer':_0x21d07a[_0x4d68('0x83')][_0x4d68('0x10f')],'openedInteractions':_0x38d7e7,'maxInteractions':_0x1403c6,'virtual':_0x1854a3[_0x4d68('0x106')],'online':_0x656f08,'custom':_0x1854a3}))[_0x4d68('0x110')](/'/g,'\x5c\x27')};_0x3f9e2f[_0x4d68('0x2e')](ejs['render'](Mustache[_0x4d68('0xcf')](_0xe1002a,_0x1d0236),{'proactiveActions':_0x443b58,'alignment':_0x5b27b1[_0x4d68('0x111')],'verticalAlignment':_0x5b27b1[_0x4d68('0x112')],'div_color':_0x5b27b1[_0x4d68('0xf6')],'text_color':_0x5b27b1[_0x4d68('0x113')],'button_color':_0x5b27b1[_0x4d68('0x114')],'background_color':_0x5b27b1['backgroundColor']}));})[_0x4d68('0x1f')](handleError(_0x3f9e2f,null));};exports[_0x4d68('0x115')]=function(_0x39a5f7,_0x39a4a3){var _0x2e072d=_0x39a5f7[_0x4d68('0x58')]['id'];var _0x17c44e=_0x39a5f7[_0x4d68('0x4e')];var _0x35e15a=0xc8;var _0x3b7a0c=null;return db[_0x4d68('0xd7')]['transaction']({'isolationLevel':db[_0x4d68('0xd7')][_0x4d68('0x116')]['ISOLATION_LEVELS'][_0x4d68('0x117')]},function(_0xdacf7c){return db[_0x4d68('0x47')][_0x4d68('0x5f')]({'where':{'id':_0x2e072d},'transaction':_0xdacf7c})[_0x4d68('0x16')](function(_0x47ce6f){if(_0x47ce6f){return db[_0x4d68('0x118')]['destroy']({'where':{'ChatWebsiteId':_0x2e072d},'transaction':_0xdacf7c})['then'](function(){var _0xc4855b=_['map'](_0x17c44e,function(_0x1fdd77){_0x1fdd77[_0x4d68('0x5c')]=_0x2e072d;return _0x1fdd77;});return db[_0x4d68('0x118')][_0x4d68('0xda')](_0xc4855b,{'transaction':_0xdacf7c});});}else{_0x35e15a=0x194;_0x3b7a0c=[];}});})[_0x4d68('0x16')](function(){if(_0x35e15a!==0x194){return db[_0x4d68('0x118')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x2e072d},'order':_0x4d68('0x9a')})[_0x4d68('0x16')](function(_0x1c022f){_0x3b7a0c=_0x1c022f;});}})['catch'](function(_0x27a8a6){_0x35e15a=0x1f4;logger[_0x4d68('0x1b')](_0x27a8a6['stack']);if(_0x27a8a6[_0x4d68('0x2d')]){delete _0x27a8a6['name'];}_0x3b7a0c=_0x27a8a6;})[_0x4d68('0x119')](function(){if(_0x3b7a0c===null){_0x39a4a3['sendStatus'](_0x35e15a);}else{if(_0x35e15a===0x1f4){_0x39a4a3[_0x4d68('0x20')](_0x35e15a)['send'](_0x3b7a0c);}else{_0x39a4a3[_0x4d68('0x20')](_0x35e15a)[_0x4d68('0x21')](_0x3b7a0c);}}});};exports[_0x4d68('0x11a')]=function(_0x1aa22b,_0x39c68b){var _0x3d215a={};var _0x1d9c35={};var _0x63857b;var _0x190143;return db[_0x4d68('0x47')]['findOne']({'where':{'id':_0x1aa22b[_0x4d68('0x58')]['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0x39c68b,null))[_0x4d68('0x16')](function(_0x365ae1){if(_0x365ae1){_0x63857b=_0x365ae1;_0x1d9c35[_0x4d68('0x38')]=_[_0x4d68('0x36')](db[_0x4d68('0x118')]['rawAttributes']);_0x1d9c35[_0x4d68('0x35')]=_[_0x4d68('0x36')](_0x1aa22b[_0x4d68('0x35')]);_0x1d9c35[_0x4d68('0x37')]=_['intersection'](_0x1d9c35[_0x4d68('0x38')],_0x1d9c35[_0x4d68('0x35')]);_0x3d215a[_0x4d68('0x39')]=_[_0x4d68('0x3a')](_0x1d9c35[_0x4d68('0x38')],qs['fields'](_0x1aa22b['query'][_0x4d68('0x3b')]));_0x3d215a[_0x4d68('0x39')]=_0x3d215a[_0x4d68('0x39')][_0x4d68('0x3c')]?_0x3d215a[_0x4d68('0x39')]:_0x1d9c35[_0x4d68('0x38')];_0x3d215a[_0x4d68('0x3f')]=qs[_0x4d68('0x40')](_0x1aa22b[_0x4d68('0x35')][_0x4d68('0x40')]);_0x3d215a[_0x4d68('0x41')]=qs['filters'](_[_0x4d68('0x42')](_0x1aa22b['query'],_0x1d9c35['filters']));if(_0x1aa22b[_0x4d68('0x35')][_0x4d68('0x43')]){_0x3d215a[_0x4d68('0x41')]=_['merge'](_0x3d215a[_0x4d68('0x41')],{'$or':_['map'](_0x3d215a['attributes'],function(_0x4c367c){var _0x400b54={};_0x400b54[_0x4c367c]={'$like':'%'+_0x1aa22b[_0x4d68('0x35')][_0x4d68('0x43')]+'%'};return _0x400b54;})});}_0x3d215a=_[_0x4d68('0x44')]({},_0x3d215a,_0x1aa22b[_0x4d68('0x46')]);return _0x63857b['getApplications'](_0x3d215a);}})['then'](function(_0x2021c8){if(_0x2021c8){_0x190143=_0x2021c8[_0x4d68('0x3c')];if(!_0x1aa22b['query'][_0x4d68('0x3d')](_0x4d68('0x3e'))){_0x3d215a['limit']=qs['limit'](_0x1aa22b[_0x4d68('0x35')][_0x4d68('0x24')]);_0x3d215a['offset']=qs[_0x4d68('0x22')](_0x1aa22b['query']['offset']);}return _0x63857b[_0x4d68('0x11a')](_0x3d215a);}})[_0x4d68('0x16')](function(_0x4075d2){if(_0x4075d2){return _0x4075d2?{'count':_0x190143,'rows':_0x4075d2}:null;}})['then'](respondWithResult(_0x39c68b,null))[_0x4d68('0x1f')](handleError(_0x39c68b,null));};exports[_0x4d68('0x11b')]=function(_0x151568,_0x5e814f){return db[_0x4d68('0x11c')]['find']({'where':{'id':_0x151568[_0x4d68('0x58')]['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0x5e814f,null))[_0x4d68('0x16')](function(_0x395bd7){if(_0x395bd7){return _0x395bd7[_0x4d68('0x11b')](_0x151568[_0x4d68('0x4e')][_0x4d68('0x61')],_[_0x4d68('0xf1')](_0x151568[_0x4d68('0x4e')],['ids','id'])||{});}})[_0x4d68('0x16')](respondWithResult(_0x5e814f,null))[_0x4d68('0x1f')](handleError(_0x5e814f,null));};exports[_0x4d68('0x11d')]=function(_0x275c22,_0x2152ce){var _0xa22064={};var _0xbcba34={};var _0x277522;var _0x377f6b;return db[_0x4d68('0x47')]['findOne']({'where':{'id':_0x275c22[_0x4d68('0x58')]['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0x2152ce,null))[_0x4d68('0x16')](function(_0x3aa34c){if(_0x3aa34c){_0x277522=_0x3aa34c;_0xbcba34[_0x4d68('0x38')]=_[_0x4d68('0x36')](db[_0x4d68('0x11e')][_0x4d68('0x31')]);_0xbcba34[_0x4d68('0x35')]=_['keys'](_0x275c22[_0x4d68('0x35')]);_0xbcba34[_0x4d68('0x37')]=_[_0x4d68('0x3a')](_0xbcba34[_0x4d68('0x38')],_0xbcba34[_0x4d68('0x35')]);_0xa22064[_0x4d68('0x39')]=_['intersection'](_0xbcba34[_0x4d68('0x38')],qs[_0x4d68('0x3b')](_0x275c22[_0x4d68('0x35')][_0x4d68('0x3b')]));_0xa22064[_0x4d68('0x39')]=_0xa22064[_0x4d68('0x39')]['length']?_0xa22064['attributes']:_0xbcba34['model'];_0xa22064[_0x4d68('0x3f')]=qs[_0x4d68('0x40')](_0x275c22[_0x4d68('0x35')]['sort']);_0xa22064[_0x4d68('0x41')]=qs['filters'](_[_0x4d68('0x42')](_0x275c22[_0x4d68('0x35')],_0xbcba34[_0x4d68('0x37')]));if(_0x275c22['query'][_0x4d68('0x43')]){_0xa22064[_0x4d68('0x41')]=_[_0x4d68('0x44')](_0xa22064[_0x4d68('0x41')],{'$or':_[_0x4d68('0x34')](_0xa22064[_0x4d68('0x39')],function(_0x328ae3){var _0x209ce2={};_0x209ce2[_0x328ae3]={'$like':'%'+_0x275c22['query'][_0x4d68('0x43')]+'%'};return _0x209ce2;})});}_0xa22064=_[_0x4d68('0x44')]({},_0xa22064,_0x275c22['options']);return _0x277522[_0x4d68('0x11d')](_0xa22064);}})[_0x4d68('0x16')](function(_0x2c6d63){if(_0x2c6d63){_0x377f6b=_0x2c6d63[_0x4d68('0x3c')];if(!_0x275c22[_0x4d68('0x35')][_0x4d68('0x3d')](_0x4d68('0x3e'))){_0xa22064[_0x4d68('0x24')]=qs[_0x4d68('0x24')](_0x275c22[_0x4d68('0x35')]['limit']);_0xa22064[_0x4d68('0x22')]=qs[_0x4d68('0x22')](_0x275c22['query'][_0x4d68('0x22')]);}return _0x277522[_0x4d68('0x11d')](_0xa22064);}})[_0x4d68('0x16')](function(_0x1cb85a){if(_0x1cb85a){return _0x1cb85a?{'count':_0x377f6b,'rows':_0x1cb85a}:null;}})[_0x4d68('0x16')](respondWithResult(_0x2152ce,null))[_0x4d68('0x1f')](handleError(_0x2152ce,null));};exports['getFields']=function(_0x82864c,_0xb643d8){var _0x3ab71b=_0x82864c[_0x4d68('0x35')][_0x4d68('0x11f')]===_0x4d68('0x120')?_0x4d68('0x121'):_0x4d68('0x122');return db['ChatWebsite'][_0x4d68('0x4c')]({'attributes':['id',_0x3ab71b],'where':{'id':_0x82864c[_0x4d68('0x58')]['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0xb643d8,null))[_0x4d68('0x16')](function(_0x507f3d){if(_0x507f3d){var _0x2c919b=_0x507f3d[_0x3ab71b];var _0x2d94e6=_0x2c919b&&_0x2c919b[_0x4d68('0x123')]?_0x2c919b['items']:[];_0xb643d8[_0x4d68('0x2e')]({'fromKey':_[_0x4d68('0x74')](_0x2c919b['fromKey'])?undefined:_0x2c919b['fromKey'],'count':_0x2d94e6[_0x4d68('0x3c')],'rows':_0x2d94e6});}})['catch'](handleError(_0xb643d8,null));};exports[_0x4d68('0x124')]=function(_0x5f3ec9,_0xec5be5){var _0x42e82e={'raw':![],'where':{}};var _0x3801ac={};var _0x4a5564={'count':0x0,'rows':[]};return db[_0x4d68('0x47')][_0x4d68('0x5f')]({'where':{'id':_0x5f3ec9[_0x4d68('0x58')]['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0xec5be5,null))[_0x4d68('0x16')](function(_0x3e40c0){if(_0x3e40c0){_0x3801ac[_0x4d68('0x38')]=_[_0x4d68('0x36')](db[_0x4d68('0xd2')][_0x4d68('0x31')]);_0x3801ac[_0x4d68('0x35')]=_[_0x4d68('0x36')](_0x5f3ec9[_0x4d68('0x35')]);_0x3801ac[_0x4d68('0x37')]=_[_0x4d68('0x3a')](_0x3801ac[_0x4d68('0x38')],_0x3801ac[_0x4d68('0x35')]);_0x42e82e[_0x4d68('0x39')]=_['intersection'](_0x3801ac[_0x4d68('0x38')],qs[_0x4d68('0x3b')](_0x5f3ec9[_0x4d68('0x35')]['fields']));_0x42e82e['attributes']=_0x42e82e[_0x4d68('0x39')][_0x4d68('0x3c')]?_0x42e82e['attributes']:_0x3801ac[_0x4d68('0x38')];if(!_0x5f3ec9[_0x4d68('0x35')][_0x4d68('0x3d')](_0x4d68('0x3e'))){_0x42e82e[_0x4d68('0x24')]=qs[_0x4d68('0x24')](_0x5f3ec9['query'][_0x4d68('0x24')]);_0x42e82e['offset']=qs[_0x4d68('0x22')](_0x5f3ec9[_0x4d68('0x35')][_0x4d68('0x22')]);}_0x42e82e['order']=qs['sort'](_0x5f3ec9[_0x4d68('0x35')]['sort']);_0x42e82e['where']=qs['filters'](_[_0x4d68('0x42')](_0x5f3ec9['query'],_0x3801ac[_0x4d68('0x37')]));_0x42e82e[_0x4d68('0x41')][_0x4d68('0x5c')]=_0x3e40c0['id'];if(_0x5f3ec9['query'][_0x4d68('0x43')]){_0x42e82e[_0x4d68('0x41')]=_[_0x4d68('0x44')](_0x42e82e[_0x4d68('0x41')],{'$or':_[_0x4d68('0x34')](_0x42e82e[_0x4d68('0x39')],function(_0x2170c0){var _0x248699={};_0x248699[_0x2170c0]={'$like':'%'+_0x5f3ec9[_0x4d68('0x35')][_0x4d68('0x43')]+'%'};return _0x248699;})});}_0x42e82e=_[_0x4d68('0x44')]({},_0x42e82e,_0x5f3ec9[_0x4d68('0x46')]);return db[_0x4d68('0xd2')]['count']({'where':_0x42e82e['where']})[_0x4d68('0x16')](function(_0x4cef04){_0x4a5564[_0x4d68('0x25')]=_0x4cef04;if(_0x5f3ec9[_0x4d68('0x35')][_0x4d68('0x48')]){_0x42e82e['include']=[{'all':!![]}];}else{_0x42e82e[_0x4d68('0x49')]=[{'model':db[_0x4d68('0x86')],'as':'Contact','required':![]},{'model':db[_0x4d68('0xd9')],'as':_0x4d68('0x125'),'required':![]}];}return db[_0x4d68('0xd2')][_0x4d68('0xf8')](_0x42e82e);})[_0x4d68('0x16')](function(_0x52405c){_0x4a5564['rows']=_0x52405c;return _0x4a5564;});}})[_0x4d68('0x16')](respondWithFilteredResult(_0xec5be5,_0x42e82e))[_0x4d68('0x1f')](handleError(_0xec5be5,null));};exports['addAgents']=function(_0x224733,_0x1614cf){return db['ChatWebsite'][_0x4d68('0x4c')]({'where':{'id':_0x224733[_0x4d68('0x58')]['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0x1614cf,null))[_0x4d68('0x16')](function(_0xadd0e6){if(_0xadd0e6){return _0xadd0e6[_0x4d68('0x126')](_0x224733[_0x4d68('0x4e')]['ids'],_[_0x4d68('0xf1')](_0x224733['body'],[_0x4d68('0x61'),'id'])||{})['spread'](function(_0x11e1ea){for(var _0x250827=0x0;_0x250827<_0x224733[_0x4d68('0x4e')][_0x4d68('0x61')][_0x4d68('0x3c')];_0x250827+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x224733[_0x4d68('0x4e')][_0x4d68('0x61')][_0x250827]),'ChatWebsiteId':Number(_0x224733['params']['id'])});}return _0x11e1ea;});}})[_0x4d68('0x16')](respondWithResult(_0x1614cf,null))[_0x4d68('0x1f')](handleError(_0x1614cf,null));};exports['removeAgents']=function(_0x179cd3,_0xf00545){return db[_0x4d68('0x47')][_0x4d68('0x4c')]({'where':{'id':_0x179cd3[_0x4d68('0x58')]['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0xf00545,null))[_0x4d68('0x16')](function(_0x2c3d5f){if(_0x2c3d5f){return _0x2c3d5f[_0x4d68('0x127')](_0x179cd3[_0x4d68('0x35')][_0x4d68('0x61')])[_0x4d68('0x16')](function(){if(_[_0x4d68('0x128')](_0x179cd3[_0x4d68('0x35')][_0x4d68('0x61')])){for(var _0x3e58d5=0x0;_0x3e58d5<_0x179cd3[_0x4d68('0x35')][_0x4d68('0x61')][_0x4d68('0x3c')];_0x3e58d5+=0x1){socket['emit'](_0x4d68('0x129'),{'UserId':Number(_0x179cd3[_0x4d68('0x35')]['ids'][_0x3e58d5]),'ChatWebsiteId':Number(_0x179cd3[_0x4d68('0x58')]['id'])});}}else{socket[_0x4d68('0x12a')](_0x4d68('0x129'),{'UserId':Number(_0x179cd3['query'][_0x4d68('0x61')]),'ChatWebsiteId':Number(_0x179cd3['params']['id'])});}});}})[_0x4d68('0x16')](respondWithStatusCode(_0xf00545,null))[_0x4d68('0x1f')](handleError(_0xf00545,null));};exports[_0x4d68('0x12b')]=function(_0x5b0f3e,_0x4cbd41){var _0x263990={};var _0x8d674e={};var _0x5bde71;var _0x2b5fc3;return db[_0x4d68('0x47')][_0x4d68('0x5f')]({'where':{'id':_0x5b0f3e[_0x4d68('0x58')]['id']}})[_0x4d68('0x16')](handleEntityNotFound(_0x4cbd41,null))[_0x4d68('0x16')](function(_0x3552a9){if(_0x3552a9){_0x5bde71=_0x3552a9;_0x8d674e[_0x4d68('0x38')]=_[_0x4d68('0x36')](db[_0x4d68('0xbc')]['rawAttributes']);_0x8d674e['query']=_[_0x4d68('0x36')](_0x5b0f3e[_0x4d68('0x35')]);_0x8d674e['filters']=_['intersection'](_0x8d674e[_0x4d68('0x38')],_0x8d674e['query']);_0x263990[_0x4d68('0x39')]=_[_0x4d68('0x3a')](_0x8d674e['model'],qs['fields'](_0x5b0f3e[_0x4d68('0x35')][_0x4d68('0x3b')]));_0x263990['attributes']=_0x263990[_0x4d68('0x39')]['length']?_0x263990[_0x4d68('0x39')]:_0x8d674e[_0x4d68('0x38')];_0x263990['order']=qs[_0x4d68('0x40')](_0x5b0f3e[_0x4d68('0x35')][_0x4d68('0x40')]);_0x263990[_0x4d68('0x41')]=qs['filters'](_['pick'](_0x5b0f3e[_0x4d68('0x35')],_0x8d674e[_0x4d68('0x37')]));if(_0x5b0f3e[_0x4d68('0x35')][_0x4d68('0x43')]){_0x263990[_0x4d68('0x41')]=_[_0x4d68('0x44')](_0x263990['where'],{'$or':_['map'](_0x263990[_0x4d68('0x39')],function(_0x34f37c){var _0x3d33e2={};_0x3d33e2[_0x34f37c]={'$like':'%'+_0x5b0f3e['query'][_0x4d68('0x43')]+'%'};return _0x3d33e2;})});}_0x263990=_[_0x4d68('0x44')]({},_0x263990,_0x5b0f3e[_0x4d68('0x46')]);return _0x5bde71[_0x4d68('0x12b')](_0x263990);}})['then'](function(_0x3fe045){if(_0x3fe045){_0x2b5fc3=_0x3fe045[_0x4d68('0x3c')];if(!_0x5b0f3e['query']['hasOwnProperty'](_0x4d68('0x3e'))){_0x263990[_0x4d68('0x24')]=qs[_0x4d68('0x24')](_0x5b0f3e[_0x4d68('0x35')][_0x4d68('0x24')]);_0x263990[_0x4d68('0x22')]=qs[_0x4d68('0x22')](_0x5b0f3e['query'][_0x4d68('0x22')]);}return _0x5bde71['getAgents'](_0x263990);}})[_0x4d68('0x16')](function(_0x41e222){if(_0x41e222){return _0x41e222?{'count':_0x2b5fc3,'rows':_0x41e222}:null;}})[_0x4d68('0x16')](respondWithResult(_0x4cbd41,null))[_0x4d68('0x1f')](handleError(_0x4cbd41,null));}; \ No newline at end of file +var _0xfad6=['catch','status','end','json','undefined','limit','count','offset','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','ChatWebsite','include','rows','show','params','includeAll','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','rawAttributes','findAll','removeDispositions','ids','CannedAnswer','getAnswers','findOne','hasOwnProperty','order','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','List','Contacts','DESC','ChatApplication','Applications','applications','list','orderBy','priority','account','defaults','CmContact','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','vendor','format','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','originalname','server','attachments','basename','openNewInteraction','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','mimetype','subjectOffline','mapValues','email','Chat','MailAccountId','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','iftime\x20%s,%s','interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','connection','remoteAddress','replace','alignment','textColor','color_button','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','sendStatus','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachment','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./chatWebsite.socket','register','jayson/promise','http','client','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x688c0e,_0xc9e8e8){var _0x351de9=function(_0x5ac96d){while(--_0x5ac96d){_0x688c0e['push'](_0x688c0e['shift']());}};_0x351de9(++_0xc9e8e8);}(_0xfad6,0x10a));var _0x6fad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfad6[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x6fad('0x0'));var Mustache=require('mustache');var util=require(_0x6fad('0x1'));var path=require('path');var ejs=require(_0x6fad('0x2'));var fs=require('fs');var fs_extra=require(_0x6fad('0x3'));var _=require(_0x6fad('0x4'));var querystring=require(_0x6fad('0x5'));var Redis=require(_0x6fad('0x6'));var qs=require(_0x6fad('0x7'));var logger=require(_0x6fad('0x8'))(_0x6fad('0x9'));var config=require(_0x6fad('0xa'));var db=require(_0x6fad('0xb'))['db'];config[_0x6fad('0xc')]=_['defaults'](config[_0x6fad('0xc')],{'host':_0x6fad('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6fad('0xc')]));require(_0x6fad('0xe'))[_0x6fad('0xf')](socket);var jayson=require(_0x6fad('0x10'));var client=jayson['client'][_0x6fad('0x11')]({'port':0x232c});var client9002=jayson[_0x6fad('0x12')][_0x6fad('0x11')]({'port':0x232a});var client9003=jayson[_0x6fad('0x12')]['http']({'port':0x232b});var client9001=jayson['client'][_0x6fad('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x5023f5,_0xc7471d,_0x5d6cd6,_0xfb175a){return new BPromise(function(_0x17f911,_0x1740c1){var _0x1b230a=_0xfb175a||client;return _0x1b230a[_0x6fad('0x13')](_0x5023f5,_0x5d6cd6)[_0x6fad('0x14')](function(_0x2d2088){logger['info'](_0x6fad('0x15'),_0xc7471d,_0x6fad('0x16'));logger[_0x6fad('0x17')](_0x6fad('0x18'),_0xc7471d,'request\x20sent',JSON[_0x6fad('0x19')](_0x2d2088));if(_0x2d2088['error']){if(_0x2d2088[_0x6fad('0x1a')][_0x6fad('0x1b')]===0x1f4){logger[_0x6fad('0x1a')](_0x6fad('0x15'),_0xc7471d,_0x2d2088['error']['message']);return _0x1740c1(_0x2d2088[_0x6fad('0x1a')][_0x6fad('0x1c')]);}logger[_0x6fad('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0xc7471d,_0x2d2088[_0x6fad('0x1a')][_0x6fad('0x1c')]);return _0x17f911(_0x2d2088[_0x6fad('0x1a')]['message']);}else{logger[_0x6fad('0x1d')](_0x6fad('0x15'),_0xc7471d,_0x6fad('0x16'));_0x17f911(_0x2d2088[_0x6fad('0x1e')][_0x6fad('0x1c')]);}})[_0x6fad('0x1f')](function(_0x39fe30){logger[_0x6fad('0x1a')](_0x6fad('0x15'),_0xc7471d,_0x39fe30);_0x1740c1(_0x39fe30);});});}function respondWithStatusCode(_0xef1445,_0x48ff18){_0x48ff18=_0x48ff18||0xcc;return function(_0x37b75c){if(_0x37b75c){return _0xef1445['sendStatus'](_0x48ff18);}return _0xef1445[_0x6fad('0x20')](_0x48ff18)[_0x6fad('0x21')]();};}function respondWithResult(_0x13353a,_0x2ae706){_0x2ae706=_0x2ae706||0xc8;return function(_0x105cf1){if(_0x105cf1){return _0x13353a[_0x6fad('0x20')](_0x2ae706)[_0x6fad('0x22')](_0x105cf1);}};}function respondWithFilteredResult(_0x3bfd56,_0x28bfa6){return function(_0x1b4292){if(_0x1b4292){var _0x4f3bee=typeof _0x28bfa6['offset']===_0x6fad('0x23')&&typeof _0x28bfa6[_0x6fad('0x24')]===_0x6fad('0x23');var _0x2bf374=_0x1b4292[_0x6fad('0x25')];var _0x567e71=_0x4f3bee?0x0:_0x28bfa6[_0x6fad('0x26')];var _0x5bcc00=_0x4f3bee?_0x1b4292['count']:_0x28bfa6[_0x6fad('0x26')]+_0x28bfa6['limit'];var _0x697d63;if(_0x5bcc00>=_0x2bf374){_0x5bcc00=_0x2bf374;_0x697d63=0xc8;}else{_0x697d63=0xce;}_0x3bfd56[_0x6fad('0x20')](_0x697d63);return _0x3bfd56['set']('Content-Range',_0x567e71+'-'+_0x5bcc00+'/'+_0x2bf374)[_0x6fad('0x22')](_0x1b4292);}return null;};}function saveUpdates(_0xb2a239){return function(_0x3feac5){if(_0x3feac5){return _0x3feac5['update'](_0xb2a239)['then'](function(_0x23db57){return _0x23db57;});}return null;};}function removeEntity(_0x61cc29){return function(_0x12e1ac){if(_0x12e1ac){return _0x12e1ac[_0x6fad('0x27')]()[_0x6fad('0x14')](function(){var _0x1451bd=_0x12e1ac[_0x6fad('0x28')]({'plain':!![]});var _0x45294a=_0x6fad('0x29');return db[_0x6fad('0x2a')][_0x6fad('0x27')]({'where':{'type':_0x45294a,'resourceId':_0x1451bd['id']}})[_0x6fad('0x14')](function(){return _0x12e1ac;});})[_0x6fad('0x14')](function(){_0x61cc29[_0x6fad('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50afb5){return function(_0x241b52){if(!_0x241b52){_0x50afb5['sendStatus'](0x194);}return _0x241b52;};}function handleError(_0x17935c,_0x226910){_0x226910=_0x226910||0x1f4;return function(_0x3f3226){logger['error'](_0x3f3226[_0x6fad('0x2b')]);if(_0x3f3226['name']){delete _0x3f3226[_0x6fad('0x2c')];}_0x17935c[_0x6fad('0x20')](_0x226910)[_0x6fad('0x2d')](_0x3f3226);};}exports['index']=function(_0xe08ac7,_0x26a3a7){var _0xde83c4={'include':[{'model':db[_0x6fad('0x2e')],'as':_0x6fad('0x2f')}]},_0x3c52fa={},_0x290c0f={'count':0x0,'rows':[]};var _0x1726ae=_[_0x6fad('0x30')](db['ChatWebsite']['rawAttributes'],function(_0x2406c8){return{'name':_0x2406c8[_0x6fad('0x31')],'type':_0x2406c8[_0x6fad('0x32')]['key']};});_0x3c52fa[_0x6fad('0x33')]=_[_0x6fad('0x30')](_0x1726ae,_0x6fad('0x2c'));_0x3c52fa[_0x6fad('0x34')]=_[_0x6fad('0x35')](_0xe08ac7['query']);_0x3c52fa['filters']=_[_0x6fad('0x36')](_0x3c52fa[_0x6fad('0x33')],_0x3c52fa[_0x6fad('0x34')]);_0xde83c4[_0x6fad('0x37')]=_[_0x6fad('0x36')](_0x3c52fa[_0x6fad('0x33')],qs[_0x6fad('0x38')](_0xe08ac7[_0x6fad('0x34')][_0x6fad('0x38')]));_0xde83c4[_0x6fad('0x37')]=_0xde83c4['attributes'][_0x6fad('0x39')]?_0xde83c4[_0x6fad('0x37')]:_0x3c52fa[_0x6fad('0x33')];if(!_0xe08ac7[_0x6fad('0x34')]['hasOwnProperty'](_0x6fad('0x3a'))){_0xde83c4[_0x6fad('0x24')]=qs[_0x6fad('0x24')](_0xe08ac7[_0x6fad('0x34')][_0x6fad('0x24')]);_0xde83c4[_0x6fad('0x26')]=qs[_0x6fad('0x26')](_0xe08ac7[_0x6fad('0x34')]['offset']);}_0xde83c4['order']=qs[_0x6fad('0x3b')](_0xe08ac7[_0x6fad('0x34')][_0x6fad('0x3b')]);_0xde83c4[_0x6fad('0x3c')]=qs[_0x6fad('0x3d')](_[_0x6fad('0x3e')](_0xe08ac7[_0x6fad('0x34')],_0x3c52fa[_0x6fad('0x3d')]),_0x1726ae);if(_0xe08ac7['query'][_0x6fad('0x3f')]){_0xde83c4[_0x6fad('0x3c')]=_['merge'](_0xde83c4[_0x6fad('0x3c')],{'$or':_[_0x6fad('0x30')](_0x1726ae,function(_0xe11370){if(_0xe11370['type']!=='VIRTUAL'){var _0x3cd9df={};_0x3cd9df[_0xe11370['name']]={'$like':'%'+_0xe08ac7['query'][_0x6fad('0x3f')]+'%'};return _0x3cd9df;}})});}_0xde83c4=_[_0x6fad('0x40')]({},_0xde83c4,_0xe08ac7[_0x6fad('0x41')]);var _0x126fbe={'where':_0xde83c4[_0x6fad('0x3c')]};return db[_0x6fad('0x42')]['count'](_0x126fbe)['then'](function(_0x29bed6){_0x290c0f[_0x6fad('0x25')]=_0x29bed6;if(_0xe08ac7[_0x6fad('0x34')]['includeAll']){_0xde83c4[_0x6fad('0x43')]=[{'all':!![]}];}return db[_0x6fad('0x42')]['findAll'](_0xde83c4);})[_0x6fad('0x14')](function(_0x7bbc48){_0x290c0f[_0x6fad('0x44')]=_0x7bbc48;return _0x290c0f;})[_0x6fad('0x14')](respondWithFilteredResult(_0x26a3a7,_0xde83c4))['catch'](handleError(_0x26a3a7,null));};exports[_0x6fad('0x45')]=function(_0x2db5d4,_0x153290){var _0x390362={'raw':![],'where':{'id':_0x2db5d4[_0x6fad('0x46')]['id']},'include':[{'model':db[_0x6fad('0x2e')],'as':'mandatoryDispositionPause'}]},_0xfc28f9={};_0xfc28f9['model']=_['keys'](db[_0x6fad('0x42')]['rawAttributes']);_0xfc28f9['query']=_[_0x6fad('0x35')](_0x2db5d4[_0x6fad('0x34')]);_0xfc28f9[_0x6fad('0x3d')]=_[_0x6fad('0x36')](_0xfc28f9[_0x6fad('0x33')],_0xfc28f9['query']);_0x390362[_0x6fad('0x37')]=_[_0x6fad('0x36')](_0xfc28f9['model'],qs[_0x6fad('0x38')](_0x2db5d4[_0x6fad('0x34')][_0x6fad('0x38')]));_0x390362[_0x6fad('0x37')]=_0x390362[_0x6fad('0x37')]['length']?_0x390362[_0x6fad('0x37')]:_0xfc28f9[_0x6fad('0x33')];if(_0x2db5d4[_0x6fad('0x34')][_0x6fad('0x47')]){_0x390362['include']=[{'all':!![]}];}_0x390362=_['merge']({},_0x390362,_0x2db5d4['options']);return db[_0x6fad('0x42')]['find'](_0x390362)[_0x6fad('0x14')](handleEntityNotFound(_0x153290,null))[_0x6fad('0x14')](respondWithResult(_0x153290,null))[_0x6fad('0x1f')](handleError(_0x153290,null));};exports[_0x6fad('0x48')]=function(_0x1ea5cd,_0x3947c2){return db[_0x6fad('0x42')]['create'](_0x1ea5cd['body'],{})['then'](function(_0x20843e){var _0x38b7ed=_0x1ea5cd[_0x6fad('0x49')][_0x6fad('0x28')]({'plain':!![]});if(!_0x38b7ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38b7ed[_0x6fad('0x4a')]===_0x6fad('0x49')){var _0x47ac65=_0x20843e[_0x6fad('0x28')]({'plain':!![]});var _0x20b9ed=_0x6fad('0x29');return db[_0x6fad('0x4b')][_0x6fad('0x4c')]({'where':{'name':_0x20b9ed,'userProfileId':_0x38b7ed[_0x6fad('0x4d')]},'raw':!![]})['then'](function(_0x644f61){if(_0x644f61&&_0x644f61[_0x6fad('0x4e')]===0x0){return db[_0x6fad('0x2a')][_0x6fad('0x48')]({'name':_0x47ac65[_0x6fad('0x2c')],'resourceId':_0x47ac65['id'],'type':_0x644f61[_0x6fad('0x2c')],'sectionId':_0x644f61['id']},{})['then'](function(){return _0x20843e;});}else{return _0x20843e;}})[_0x6fad('0x1f')](function(_0xc076cd){logger['error'](_0x6fad('0x4f'),_0xc076cd);throw _0xc076cd;});}return _0x20843e;})[_0x6fad('0x14')](respondWithResult(_0x3947c2,0xc9))['catch'](handleError(_0x3947c2,null));};exports[_0x6fad('0x50')]=function(_0x306259,_0x359c0d){if(_0x306259[_0x6fad('0x51')]['id']){delete _0x306259[_0x6fad('0x51')]['id'];}return db[_0x6fad('0x42')]['find']({'where':{'id':_0x306259[_0x6fad('0x46')]['id']},'include':[{'model':db[_0x6fad('0x2e')],'as':_0x6fad('0x2f')}]})[_0x6fad('0x14')](handleEntityNotFound(_0x359c0d,null))[_0x6fad('0x14')](saveUpdates(_0x306259[_0x6fad('0x51')],null))[_0x6fad('0x14')](respondWithResult(_0x359c0d,null))[_0x6fad('0x1f')](handleError(_0x359c0d,null));};exports[_0x6fad('0x27')]=function(_0x2d5c8d,_0x555ac7){return db[_0x6fad('0x42')]['find']({'where':{'id':_0x2d5c8d[_0x6fad('0x46')]['id']}})[_0x6fad('0x14')](handleEntityNotFound(_0x555ac7,null))[_0x6fad('0x14')](removeEntity(_0x555ac7,null))[_0x6fad('0x1f')](handleError(_0x555ac7,null));};exports[_0x6fad('0x52')]=function(_0x56132b,_0x397794){return db['ChatWebsite'][_0x6fad('0x52')]()[_0x6fad('0x14')](respondWithResult(_0x397794,null))['catch'](handleError(_0x397794,null));};exports[_0x6fad('0x53')]=function(_0x19db0a,_0x41c479){if(_0x19db0a[_0x6fad('0x51')]['id']){delete _0x19db0a[_0x6fad('0x51')]['id'];}return db[_0x6fad('0x42')][_0x6fad('0x4c')]({'where':{'id':_0x19db0a['params']['id']}})[_0x6fad('0x14')](handleEntityNotFound(_0x41c479,null))[_0x6fad('0x14')](function(_0xa204b2){if(_0xa204b2){_0x19db0a['body'][_0x6fad('0x54')]=_0xa204b2['id'];return db[_0x6fad('0x55')][_0x6fad('0x48')](_0x19db0a[_0x6fad('0x51')]);}})[_0x6fad('0x14')](respondWithResult(_0x41c479,null))[_0x6fad('0x1f')](handleError(_0x41c479,null));};exports[_0x6fad('0x56')]=function(_0x4e8cdf,_0x2a8438){var _0x3d212d={'raw':![],'where':{}};var _0x34aceb={};var _0x5e0daf={'count':0x0,'rows':[]};return db[_0x6fad('0x42')]['findOne']({'where':{'id':_0x4e8cdf['params']['id']}})[_0x6fad('0x14')](handleEntityNotFound(_0x2a8438,null))[_0x6fad('0x14')](function(_0x4cbf26){if(_0x4cbf26){_0x34aceb[_0x6fad('0x33')]=_['keys'](db[_0x6fad('0x55')][_0x6fad('0x57')]);_0x34aceb[_0x6fad('0x34')]=_[_0x6fad('0x35')](_0x4e8cdf[_0x6fad('0x34')]);_0x34aceb['filters']=_[_0x6fad('0x36')](_0x34aceb[_0x6fad('0x33')],_0x34aceb[_0x6fad('0x34')]);_0x3d212d[_0x6fad('0x37')]=_[_0x6fad('0x36')](_0x34aceb['model'],qs[_0x6fad('0x38')](_0x4e8cdf['query']['fields']));_0x3d212d[_0x6fad('0x37')]=_0x3d212d[_0x6fad('0x37')][_0x6fad('0x39')]?_0x3d212d['attributes']:_0x34aceb[_0x6fad('0x33')];if(!_0x4e8cdf[_0x6fad('0x34')]['hasOwnProperty'](_0x6fad('0x3a'))){_0x3d212d[_0x6fad('0x24')]=qs[_0x6fad('0x24')](_0x4e8cdf['query']['limit']);_0x3d212d[_0x6fad('0x26')]=qs[_0x6fad('0x26')](_0x4e8cdf[_0x6fad('0x34')]['offset']);}_0x3d212d['order']=qs[_0x6fad('0x3b')](_0x4e8cdf[_0x6fad('0x34')][_0x6fad('0x3b')]);_0x3d212d[_0x6fad('0x3c')]=qs['filters'](_[_0x6fad('0x3e')](_0x4e8cdf[_0x6fad('0x34')],_0x34aceb[_0x6fad('0x3d')]));_0x3d212d[_0x6fad('0x3c')]['ChatWebsiteId']=_0x4cbf26['id'];if(_0x4e8cdf[_0x6fad('0x34')][_0x6fad('0x3f')]){_0x3d212d[_0x6fad('0x3c')]=_['merge'](_0x3d212d['where'],{'$or':_[_0x6fad('0x30')](_0x3d212d[_0x6fad('0x37')],function(_0x50cd44){var _0x42ad7c={};_0x42ad7c[_0x50cd44]={'$like':'%'+_0x4e8cdf[_0x6fad('0x34')][_0x6fad('0x3f')]+'%'};return _0x42ad7c;})});}_0x3d212d=_[_0x6fad('0x40')]({},_0x3d212d,_0x4e8cdf['options']);return db[_0x6fad('0x55')][_0x6fad('0x25')]({'where':_0x3d212d[_0x6fad('0x3c')]})[_0x6fad('0x14')](function(_0x3f1bee){_0x5e0daf['count']=_0x3f1bee;if(_0x4e8cdf[_0x6fad('0x34')][_0x6fad('0x47')]){_0x3d212d[_0x6fad('0x43')]=[{'all':!![]}];}return db[_0x6fad('0x55')][_0x6fad('0x58')](_0x3d212d);})['then'](function(_0x2f43cf){_0x5e0daf['rows']=_0x2f43cf;return _0x5e0daf;});}})[_0x6fad('0x14')](respondWithFilteredResult(_0x2a8438,_0x3d212d))['catch'](handleError(_0x2a8438,null));};exports[_0x6fad('0x59')]=function(_0x3d3da1,_0x2b32c8){return db[_0x6fad('0x42')][_0x6fad('0x4c')]({'where':{'id':_0x3d3da1[_0x6fad('0x46')]['id']}})[_0x6fad('0x14')](handleEntityNotFound(_0x2b32c8,null))[_0x6fad('0x14')](function(_0xe9f50a){if(_0xe9f50a){return _0xe9f50a[_0x6fad('0x59')](_0x3d3da1['query'][_0x6fad('0x5a')]);}})['then'](respondWithStatusCode(_0x2b32c8,null))['catch'](handleError(_0x2b32c8,null));};exports['addAnswer']=function(_0x1854c5,_0x3117da){if(_0x1854c5['body']['id']){delete _0x1854c5['body']['id'];}return db[_0x6fad('0x42')][_0x6fad('0x4c')]({'where':{'id':_0x1854c5[_0x6fad('0x46')]['id']}})['then'](handleEntityNotFound(_0x3117da,null))['then'](function(_0x19ce8d){if(_0x19ce8d){_0x1854c5[_0x6fad('0x51')]['ChatWebsiteId']=_0x19ce8d['id'];return db[_0x6fad('0x5b')][_0x6fad('0x48')](_0x1854c5[_0x6fad('0x51')]);}})['then'](respondWithResult(_0x3117da,null))[_0x6fad('0x1f')](handleError(_0x3117da,null));};exports[_0x6fad('0x5c')]=function(_0xc692ca,_0x244fd4){var _0x70d2e9={'raw':![],'where':{}};var _0x29765d={};var _0x47eabd={'count':0x0,'rows':[]};return db[_0x6fad('0x42')][_0x6fad('0x5d')]({'where':{'id':_0xc692ca[_0x6fad('0x46')]['id']}})['then'](handleEntityNotFound(_0x244fd4,null))[_0x6fad('0x14')](function(_0x3b50bd){if(_0x3b50bd){_0x29765d[_0x6fad('0x33')]=_[_0x6fad('0x35')](db[_0x6fad('0x5b')][_0x6fad('0x57')]);_0x29765d[_0x6fad('0x34')]=_['keys'](_0xc692ca[_0x6fad('0x34')]);_0x29765d[_0x6fad('0x3d')]=_[_0x6fad('0x36')](_0x29765d['model'],_0x29765d[_0x6fad('0x34')]);_0x70d2e9[_0x6fad('0x37')]=_[_0x6fad('0x36')](_0x29765d[_0x6fad('0x33')],qs[_0x6fad('0x38')](_0xc692ca[_0x6fad('0x34')][_0x6fad('0x38')]));_0x70d2e9[_0x6fad('0x37')]=_0x70d2e9['attributes'][_0x6fad('0x39')]?_0x70d2e9[_0x6fad('0x37')]:_0x29765d[_0x6fad('0x33')];if(!_0xc692ca[_0x6fad('0x34')][_0x6fad('0x5e')](_0x6fad('0x3a'))){_0x70d2e9[_0x6fad('0x24')]=qs[_0x6fad('0x24')](_0xc692ca[_0x6fad('0x34')]['limit']);_0x70d2e9['offset']=qs[_0x6fad('0x26')](_0xc692ca[_0x6fad('0x34')][_0x6fad('0x26')]);}_0x70d2e9[_0x6fad('0x5f')]=qs['sort'](_0xc692ca['query']['sort']);_0x70d2e9['where']=qs[_0x6fad('0x3d')](_[_0x6fad('0x3e')](_0xc692ca['query'],_0x29765d[_0x6fad('0x3d')]));_0x70d2e9[_0x6fad('0x3c')][_0x6fad('0x54')]=_0x3b50bd['id'];if(_0xc692ca[_0x6fad('0x34')][_0x6fad('0x3f')]){_0x70d2e9[_0x6fad('0x3c')]=_[_0x6fad('0x40')](_0x70d2e9[_0x6fad('0x3c')],{'$or':_[_0x6fad('0x30')](_0x70d2e9[_0x6fad('0x37')],function(_0x542afd){var _0x6f99f={};_0x6f99f[_0x542afd]={'$like':'%'+_0xc692ca[_0x6fad('0x34')][_0x6fad('0x3f')]+'%'};return _0x6f99f;})});}_0x70d2e9=_[_0x6fad('0x40')]({},_0x70d2e9,_0xc692ca['options']);return db[_0x6fad('0x5b')][_0x6fad('0x25')]({'where':_0x70d2e9[_0x6fad('0x3c')]})['then'](function(_0x40e46c){_0x47eabd['count']=_0x40e46c;if(_0xc692ca[_0x6fad('0x34')][_0x6fad('0x47')]){_0x70d2e9[_0x6fad('0x43')]=[{'all':!![]}];}return db[_0x6fad('0x5b')][_0x6fad('0x58')](_0x70d2e9);})[_0x6fad('0x14')](function(_0x3bbb76){_0x47eabd['rows']=_0x3bbb76;return _0x47eabd;});}})[_0x6fad('0x14')](respondWithFilteredResult(_0x244fd4,_0x70d2e9))[_0x6fad('0x1f')](handleError(_0x244fd4,null));};exports[_0x6fad('0x60')]=function(_0x3749dc,_0x1bb70b){return db[_0x6fad('0x42')][_0x6fad('0x4c')]({'where':{'id':_0x3749dc['params']['id']}})[_0x6fad('0x14')](handleEntityNotFound(_0x1bb70b,null))['then'](function(_0x5d1699){if(_0x5d1699){return _0x5d1699[_0x6fad('0x60')](_0x3749dc[_0x6fad('0x34')][_0x6fad('0x5a')]);}})[_0x6fad('0x14')](respondWithStatusCode(_0x1bb70b,null))[_0x6fad('0x1f')](handleError(_0x1bb70b,null));};exports[_0x6fad('0x61')]=function(_0x47ab2f,_0x2162d6){_0x47ab2f[_0x6fad('0x51')][_0x6fad('0x62')]=_0x47ab2f[_0x6fad('0x63')]['filename'];return db[_0x6fad('0x42')][_0x6fad('0x4c')]({'where':{'id':_0x47ab2f['params']['id']}})['then'](handleEntityNotFound(_0x2162d6,null))[_0x6fad('0x14')](saveUpdates(_0x47ab2f['body'],null))[_0x6fad('0x14')](respondWithResult(_0x2162d6,null))[_0x6fad('0x1f')](handleError(_0x2162d6,null));};exports[_0x6fad('0x64')]=function(_0x4158b0,_0x36c8bb){_0x4158b0[_0x6fad('0x51')][_0x6fad('0x65')]=_0x4158b0[_0x6fad('0x63')][_0x6fad('0x66')];return db['ChatWebsite'][_0x6fad('0x4c')]({'where':{'id':_0x4158b0[_0x6fad('0x46')]['id']}})['then'](handleEntityNotFound(_0x36c8bb,null))[_0x6fad('0x14')](saveUpdates(_0x4158b0[_0x6fad('0x51')],null))['then'](respondWithResult(_0x36c8bb,null))[_0x6fad('0x1f')](handleError(_0x36c8bb,null));};exports[_0x6fad('0x67')]=function(_0x22ba06,_0x335b51){_0x22ba06[_0x6fad('0x51')][_0x6fad('0x68')]=_0x22ba06[_0x6fad('0x63')][_0x6fad('0x66')];return db[_0x6fad('0x42')]['find']({'where':{'id':_0x22ba06['params']['id']}})[_0x6fad('0x14')](handleEntityNotFound(_0x335b51,null))[_0x6fad('0x14')](saveUpdates(_0x22ba06['body'],null))['then'](respondWithResult(_0x335b51,null))[_0x6fad('0x1f')](handleError(_0x335b51,null));};exports[_0x6fad('0x69')]=function(_0x4e19ce,_0x14a958){_0x4e19ce[_0x6fad('0x51')][_0x6fad('0x6a')]=_0x4e19ce[_0x6fad('0x63')][_0x6fad('0x66')];return db[_0x6fad('0x42')][_0x6fad('0x4c')]({'where':{'id':_0x4e19ce[_0x6fad('0x46')]['id']}})[_0x6fad('0x14')](handleEntityNotFound(_0x14a958,null))[_0x6fad('0x14')](saveUpdates(_0x4e19ce[_0x6fad('0x51')],null))[_0x6fad('0x14')](respondWithResult(_0x14a958,null))[_0x6fad('0x1f')](handleError(_0x14a958,null));};exports['getLogo']=function(_0x59bc4c,_0x43dfb0){var _0xc5695f=path[_0x6fad('0x6b')](config[_0x6fad('0x6c')],'server/files/images/logos/default_logo.svg');var _0x4afd3e={'where':{'id':_0x59bc4c['params']['id']},'attributes':['id',_0x6fad('0x62')],'raw':!![]};var _0x5a9895=![];return require(_0x6fad('0x6d'))[_0x6fad('0x6e')]()['then'](function(_0x23e130){if(_0x23e130){_0x5a9895=_0x23e130[_0x6fad('0x6f')];}})[_0x6fad('0x14')](function(){return db[_0x6fad('0x42')][_0x6fad('0x4c')](_0x4afd3e);})[_0x6fad('0x14')](handleEntityNotFound(_0x43dfb0,null))[_0x6fad('0x14')](function(_0x4e3872){if(_0x4e3872){if(!_[_0x6fad('0x70')](_0x4e3872[_0x6fad('0x62')])){if(fs[_0x6fad('0x71')](path[_0x6fad('0x6b')](config[_0x6fad('0x6c')],_0x6fad('0x72'),_0x4e3872[_0x6fad('0x62')]))&&_0x5a9895){_0xc5695f=path['join'](config[_0x6fad('0x6c')],_0x6fad('0x72'),_0x4e3872[_0x6fad('0x62')]);}}return _0x43dfb0[_0x6fad('0x73')](_0xc5695f);}})[_0x6fad('0x1f')](handleError(_0x43dfb0,null));};exports['getAvatar']=function(_0x339bed,_0x133b56){var _0xa10019=path[_0x6fad('0x6b')](config[_0x6fad('0x6c')],_0x6fad('0x74'));var _0x21805c={'where':{'id':_0x339bed[_0x6fad('0x46')]['id']},'attributes':['id',_0x6fad('0x65')],'raw':!![]};return db[_0x6fad('0x42')]['find'](_0x21805c)[_0x6fad('0x14')](handleEntityNotFound(_0x133b56,null))['then'](function(_0x1eeda3){if(_0x1eeda3){if(!_[_0x6fad('0x70')](_0x1eeda3[_0x6fad('0x65')])){if(fs['existsSync'](path[_0x6fad('0x6b')](config['root'],'server/files/images/avatars/',_0x1eeda3['agentAvatar']))){_0xa10019=path[_0x6fad('0x6b')](config[_0x6fad('0x6c')],_0x6fad('0x75'),_0x1eeda3['agentAvatar']);}}return _0x133b56['download'](_0xa10019);}})[_0x6fad('0x1f')](handleError(_0x133b56,null));};exports[_0x6fad('0x76')]=function(_0x537ff1,_0x396c0b){var _0x373d42=path[_0x6fad('0x6b')](config['root'],_0x6fad('0x77'));var _0x1d5452={'where':{'id':_0x537ff1[_0x6fad('0x46')]['id']},'attributes':['id',_0x6fad('0x68'),'showCustomerAvatar'],'raw':!![]};return db[_0x6fad('0x42')][_0x6fad('0x4c')](_0x1d5452)['then'](handleEntityNotFound(_0x396c0b,null))[_0x6fad('0x14')](function(_0x5b98f8){if(_0x5b98f8){if(!_[_0x6fad('0x70')](_0x5b98f8[_0x6fad('0x68')])){if(fs[_0x6fad('0x71')](path['join'](config[_0x6fad('0x6c')],'server/files/images/avatars/',_0x5b98f8[_0x6fad('0x68')]))&&_0x5b98f8['showCustomerAvatar']){_0x373d42=path['join'](config[_0x6fad('0x6c')],_0x6fad('0x75'),_0x5b98f8[_0x6fad('0x68')]);}}return _0x396c0b[_0x6fad('0x73')](_0x373d42);}})[_0x6fad('0x1f')](handleError(_0x396c0b,null));};exports[_0x6fad('0x78')]=function(_0x1cdd0b,_0x36b763){var _0x3889c2=path[_0x6fad('0x6b')](config[_0x6fad('0x6c')],_0x6fad('0x79'));var _0x10892d={'where':{'id':_0x1cdd0b[_0x6fad('0x46')]['id']},'attributes':['id',_0x6fad('0x6a')],'raw':!![]};return db[_0x6fad('0x42')][_0x6fad('0x4c')](_0x10892d)[_0x6fad('0x14')](handleEntityNotFound(_0x36b763,null))[_0x6fad('0x14')](function(_0x4c63c5){if(_0x4c63c5){if(!_['isNil'](_0x4c63c5[_0x6fad('0x6a')])){if(fs[_0x6fad('0x71')](path[_0x6fad('0x6b')](config[_0x6fad('0x6c')],_0x6fad('0x75'),_0x4c63c5[_0x6fad('0x6a')]))){_0x3889c2=path[_0x6fad('0x6b')](config[_0x6fad('0x6c')],_0x6fad('0x75'),_0x4c63c5[_0x6fad('0x6a')]);}}return _0x36b763[_0x6fad('0x73')](_0x3889c2);}})[_0x6fad('0x1f')](handleError(_0x36b763,null));};exports[_0x6fad('0x7a')]=function(_0x5d8efd,_0x5914c9){var _0x6d6917=require(_0x6fad('0x7b'));var _0x41c18a=new _0x6d6917();var _0x434fe6=_0x41c18a[_0x6fad('0x7c')](_0x5d8efd['headers']['user-agent'])['getResult']();var _0x3a5747={'body':_0x5d8efd[_0x6fad('0x51')],'channel':'chat'};var _0x28be63=[];var _0x5c7b9a=[];var _0x447a83={};var _0x1f20aa=![];return db['CmContact'][_0x6fad('0x52')]()[_0x6fad('0x14')](function(_0x515910){if(!_0x515910){throw new db[(_0x6fad('0x7d'))][(_0x6fad('0x7e'))](_0x6fad('0x7f'));}_0x28be63=_[_0x6fad('0x80')](_[_0x6fad('0x35')](_0x515910),[_0x6fad('0x81'),_0x6fad('0x82')]);_0x5c7b9a=_['difference'](_[_0x6fad('0x35')](_0x515910),[_0x6fad('0x81'),'updatedAt',_0x6fad('0x83'),_0x6fad('0x84')]);if(_0x5d8efd['body']['id']){delete _0x5d8efd['body']['id'];}if(_[_0x6fad('0x70')](_0x5d8efd[_0x6fad('0x51')][_0x6fad('0x85')])){throw new db['Sequelize'][(_0x6fad('0x7e'))](_0x6fad('0x86'));}if(_['isNil'](_0x5d8efd['body'][_0x6fad('0x51')])||_0x5d8efd[_0x6fad('0x51')][_0x6fad('0x51')]===''){throw new db[(_0x6fad('0x7d'))]['ValidationError'](_0x6fad('0x87'));}if(_[_0x6fad('0x70')](_0x5d8efd[_0x6fad('0x51')][_0x6fad('0x88')])){throw new db['Sequelize'][(_0x6fad('0x7e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5c7b9a);}if(!_[_0x6fad('0x89')](_0x5c7b9a,_0x5d8efd[_0x6fad('0x51')][_0x6fad('0x88')])){throw new db['Sequelize'][(_0x6fad('0x7e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5c7b9a);}_0x447a83[_0x5d8efd['body'][_0x6fad('0x88')]]=_0x5d8efd['body'][_0x6fad('0x85')];})[_0x6fad('0x14')](function(){return db[_0x6fad('0x42')][_0x6fad('0x4c')]({'where':{'id':_0x5d8efd['params']['id']},'include':[{'model':db[_0x6fad('0x8a')],'as':_0x6fad('0x8b'),'include':[{'model':db['CmContact'],'as':_0x6fad('0x8c'),'where':_0x447a83,'limit':0x1,'order':[[_0x6fad('0x82'),_0x6fad('0x8d')]]}]},{'model':db[_0x6fad('0x8e')],'as':_0x6fad('0x8f')}]});})[_0x6fad('0x14')](handleEntityNotFound(_0x5914c9,null))['then'](function(_0x350ea4){if(_0x350ea4&&_0x350ea4[_0x6fad('0x8b')]){_0x3a5747['account']=_0x350ea4;_0x3a5747[_0x6fad('0x90')]=_0x350ea4[_0x6fad('0x8f')];_0x3a5747[_0x6fad('0x91')]=_0x350ea4[_0x6fad('0x8b')];_0x3a5747['applications']=_[_0x6fad('0x92')](_0x3a5747[_0x6fad('0x90')],[_0x6fad('0x93')],['asc']);if(_0x3a5747[_0x6fad('0x94')][_0x6fad('0x8f')]){delete _0x3a5747[_0x6fad('0x94')][_0x6fad('0x8f')];}if(_0x3a5747[_0x6fad('0x94')][_0x6fad('0x8b')]&&_0x3a5747[_0x6fad('0x94')]['List'][_0x6fad('0x8c')][_0x6fad('0x39')]){return _0x3a5747[_0x6fad('0x94')][_0x6fad('0x8b')][_0x6fad('0x8c')][0x0];}var _0x1924c6=_[_0x6fad('0x95')](_0x5d8efd['body'],{'firstName':_0x5d8efd[_0x6fad('0x51')][_0x6fad('0x85')],'ListId':_0x350ea4[_0x6fad('0x84')]});_0x1924c6[_0x5d8efd[_0x6fad('0x51')][_0x6fad('0x88')]]=_0x5d8efd[_0x6fad('0x51')][_0x6fad('0x85')];return db[_0x6fad('0x96')][_0x6fad('0x48')](_0x1924c6,{'fields':_0x28be63,'raw':!![]});}})[_0x6fad('0x14')](handleEntityNotFound(_0x5914c9,null))['then'](function(_0x3ca2ba){_0x3a5747[_0x6fad('0x97')]=_0x3ca2ba;var _0x156577=_0x5d8efd[_0x6fad('0x51')][_0x6fad('0x98')];if(_0x5d8efd[_0x6fad('0x99')][_0x6fad('0x9a')]){_0x156577=_0x5d8efd[_0x6fad('0x99')]['cf-connecting-ip'];}else if(_0x5d8efd['headers'][_0x6fad('0x9b')]){_0x156577=_[_0x6fad('0x9c')](_0x5d8efd[_0x6fad('0x99')][_0x6fad('0x9b')][_0x6fad('0x9d')](','));}if(_0x3ca2ba){var _0x70e51c={'ContactId':_0x3ca2ba['id'],'ChatWebsiteId':_0x5d8efd[_0x6fad('0x46')]['id'],'from':(_0x3ca2ba[_0x6fad('0x9e')]||'')+'\x20'+(_0x3ca2ba[_0x6fad('0x9f')]||''),'customerIp':_0x156577,'customerPort':_0x5d8efd[_0x6fad('0x99')][_0x6fad('0xa0')]?_0x5d8efd[_0x6fad('0x99')][_0x6fad('0xa0')]:null,'referer':_0x5d8efd[_0x6fad('0x51')][_0x6fad('0xa1')],'browserName':_0x434fe6['browser'][_0x6fad('0x2c')]&&_0x434fe6[_0x6fad('0xa2')][_0x6fad('0xa3')]?util['format'](_0x6fad('0xa4'),_0x434fe6[_0x6fad('0xa2')][_0x6fad('0x2c')],_0x434fe6[_0x6fad('0xa2')][_0x6fad('0xa3')]):_0x6fad('0xa5'),'browserVersion':_0x434fe6['browser'][_0x6fad('0xa3')]||_0x6fad('0xa5'),'osName':util['format'](_0x6fad('0xa4'),_0x434fe6['os'][_0x6fad('0x2c')],_0x434fe6['os'][_0x6fad('0xa3')]),'osVersion':_0x434fe6['os'][_0x6fad('0xa3')],'deviceModel':_0x434fe6[_0x6fad('0xa6')][_0x6fad('0x33')]&&_0x434fe6[_0x6fad('0xa6')][_0x6fad('0xa7')]?util[_0x6fad('0xa8')](_0x6fad('0xa9'),_0x434fe6[_0x6fad('0xa6')][_0x6fad('0x33')],_0x434fe6[_0x6fad('0xa6')][_0x6fad('0xa7')],_0x434fe6[_0x6fad('0xa6')][_0x6fad('0x32')]):null,'deviceVendor':_0x434fe6[_0x6fad('0xa6')][_0x6fad('0xa7')],'deviceType':_0x434fe6[_0x6fad('0xa6')][_0x6fad('0x32')],'formData':JSON[_0x6fad('0x19')](_0x5d8efd['body'])};var _0x3573c1={'ChatWebsiteId':_0x5d8efd[_0x6fad('0x46')]['id'],'closed':![]};if(_0x5d8efd[_0x6fad('0x51')][_0x6fad('0xaa')]){_0x3573c1['threadId']=_0x5d8efd[_0x6fad('0x51')][_0x6fad('0xaa')];return db[_0x6fad('0xab')][_0x6fad('0x4c')]({'where':_0x3573c1})[_0x6fad('0x14')](function(_0x3e2a31){if(_0x3e2a31){return[_0x3e2a31,![]];}_0x70e51c['threadId']=_0x5d8efd[_0x6fad('0x51')]['threadId'];_0x70e51c[_0x6fad('0xac')]=_0x5d8efd[_0x6fad('0x51')][_0x6fad('0xac')];return db[_0x6fad('0xab')][_0x6fad('0x48')](_0x70e51c)[_0x6fad('0x14')](function(_0x5b65e2){return[_0x5b65e2,!![]];});});}_0x3573c1[_0x6fad('0xad')]=_0x3ca2ba['id'];if(_0x5d8efd[_0x6fad('0x51')][_0x6fad('0xae')]&&_0x5d8efd[_0x6fad('0x51')][_0x6fad('0xae')]['id']){_0x3573c1['id']=_0x5d8efd[_0x6fad('0x51')][_0x6fad('0xae')]['id'];return db['ChatInteraction'][_0x6fad('0x4c')]({'where':_0x3573c1})[_0x6fad('0x14')](function(_0x251c6a){if(_0x251c6a){return[_0x251c6a,![]];}return db[_0x6fad('0xab')][_0x6fad('0x48')](_0x70e51c)[_0x6fad('0x14')](function(_0x1fc729){return[_0x1fc729,!![]];});});}return db[_0x6fad('0xab')][_0x6fad('0x48')](_0x70e51c)[_0x6fad('0x14')](function(_0x272f16){return[_0x272f16,!![]];});}})[_0x6fad('0xaf')](function(_0x37b3d8,_0x2dc304){if(_0x37b3d8){_0x1f20aa=_0x2dc304;if(!_0x2dc304){var _0x486ef5={'from':(_0x3a5747[_0x6fad('0x97')]['firstName']||'')+'\x20'+(_0x3a5747['contact'][_0x6fad('0x9f')]||'')};if(_0x5d8efd[_0x6fad('0x51')][_0x6fad('0xaa')]&&_0x5d8efd[_0x6fad('0x51')][_0x6fad('0xb0')]&&_0x5d8efd[_0x6fad('0x51')][_0x6fad('0xaa')]!=_0x5d8efd['body'][_0x6fad('0xb0')]){_0x486ef5[_0x6fad('0xaa')]=_0x5d8efd[_0x6fad('0x51')]['messageId'];}return _0x37b3d8[_0x6fad('0x50')](_0x486ef5);}else{return _0x37b3d8;}}})[_0x6fad('0x14')](function(_0x11dfca){_0x3a5747[_0x6fad('0xae')]=_0x11dfca[_0x6fad('0x28')]({'plain':!![]});_0x3a5747[_0x6fad('0xae')]['created']=_0x1f20aa;if(_0x3a5747[_0x6fad('0xae')][_0x6fad('0xb1')]){if(_0x3a5747[_0x6fad('0x94')]['autoclose']){_0x3a5747[_0x6fad('0x90')][_0x6fad('0xb2')]({'id':0x0,'priority':_0x3a5747[_0x6fad('0x90')][_0x6fad('0x39')]+0x1,'app':'close','appdata':_0x6fad('0xb3'),'interval':_0x6fad('0xb4')});}}return db[_0x6fad('0xb5')]['create']({'body':_0x5d8efd[_0x6fad('0x51')][_0x6fad('0x51')],'ChatWebsiteId':_0x5d8efd[_0x6fad('0x46')]['id'],'ChatInteractionId':_0x11dfca['id'],'direction':'in','ContactId':_0x3a5747[_0x6fad('0x97')]['id'],'AttachmentId':_0x5d8efd[_0x6fad('0x51')][_0x6fad('0xb6')]});})['then'](function(_0x4d51b2){_0x3a5747['message']=_0x4d51b2;if(_0x3a5747['interaction']['UserId']){return db[_0x6fad('0xb7')][_0x6fad('0x4c')]({'attributes':['id','name'],'where':{'id':_0x3a5747[_0x6fad('0xae')][_0x6fad('0xb8')]}})['then'](function(_0x11e893){if(_0x11e893){_0x3a5747[_0x6fad('0x90')][_0x6fad('0xb9')]({'id':0x0,'priority':0x0,'app':_0x6fad('0xba'),'appdata':_0x11e893[_0x6fad('0x2c')]+','+(_0x3a5747[_0x6fad('0x94')][_0x6fad('0xbb')]||0xa),'interval':_0x6fad('0xb4')});_0x3a5747[_0x6fad('0xbc')]=!![];}return respondWithRpcPromise(_0x6fad('0xbd'),_0x6fad('0xbe'),_0x3a5747);});}return respondWithRpcPromise(_0x6fad('0xbd'),_0x6fad('0xbe'),_0x3a5747);})[_0x6fad('0x14')](function(_0x40ae0b){respondWithRpcPromise(_0x6fad('0xbf'),_0x6fad('0xbf'),{'event':_0x6fad('0x7a'),'message':_0x40ae0b},client9002);return _0x40ae0b;})['then'](respondWithResult(_0x5914c9,null))[_0x6fad('0x1f')](handleError(_0x5914c9,null));};exports[_0x6fad('0xc0')]=function(_0x574ef7,_0x4c967b){var _0x49982a,_0x3ab968,_0x526973;var _0x533083=[];var _0x3b481f={};var _0x358065=_0x574ef7[_0x6fad('0xc1')]||[];var _0xb7eb0=[];var _0x2846aa;return db['CmContact'][_0x6fad('0x52')]()[_0x6fad('0x14')](function(_0x28f32d){if(!_0x28f32d){throw new db[(_0x6fad('0x7d'))][(_0x6fad('0x7e'))]('no\x20available\x20attributes');}_0x533083=_[_0x6fad('0x80')](_[_0x6fad('0x35')](_0x28f32d),[_0x6fad('0x81'),_0x6fad('0x82'),'CompanyId',_0x6fad('0x84')]);if(_0x574ef7[_0x6fad('0x51')]['id']){delete _0x574ef7[_0x6fad('0x51')]['id'];}if(_[_0x6fad('0x70')](_0x574ef7['body'][_0x6fad('0x85')])){throw _0x4c967b[_0x6fad('0x20')](0x1f4)[_0x6fad('0x2d')](new db['Sequelize'][(_0x6fad('0x7e'))]('from\x20is\x20mandatory'));}if(_[_0x6fad('0x70')](_0x574ef7[_0x6fad('0x51')][_0x6fad('0x51')])||_0x574ef7['body'][_0x6fad('0x51')]===''){throw _0x4c967b[_0x6fad('0x20')](0x1f4)['send'](new db[(_0x6fad('0x7d'))][(_0x6fad('0x7e'))](_0x6fad('0x87')));}if(_[_0x6fad('0x70')](_0x574ef7[_0x6fad('0x51')][_0x6fad('0xc2')])){throw _0x4c967b['status'](0x1f4)['send'](new db[(_0x6fad('0x7d'))][(_0x6fad('0x7e'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x533083));}if(!_['includes'](_0x533083,_0x574ef7[_0x6fad('0x51')][_0x6fad('0xc2')])){throw _0x4c967b[_0x6fad('0x20')](0x1f4)['send'](new db[(_0x6fad('0x7d'))][(_0x6fad('0x7e'))](_0x6fad('0xc3')+_0x533083));}_0x3b481f[_0x574ef7[_0x6fad('0x51')][_0x6fad('0xc2')]]=_0x574ef7[_0x6fad('0x51')][_0x6fad('0x85')];})[_0x6fad('0x14')](function(){return db[_0x6fad('0x42')][_0x6fad('0x4c')]({'where':{'id':_0x574ef7[_0x6fad('0x46')]['id']},'include':[{'model':db[_0x6fad('0x8a')],'as':_0x6fad('0x8b')},{'model':db['MailAccount'],'as':_0x6fad('0xc4')}]});})[_0x6fad('0x14')](handleEntityNotFound(_0x4c967b,null))['then'](function(_0x421c00){if(_0x421c00&&_0x421c00[_0x6fad('0x8b')]){_0x3ab968=_0x421c00;var _0x14110b=_[_0x6fad('0x95')](_0x574ef7[_0x6fad('0x51')],{'firstName':_0x574ef7[_0x6fad('0x51')][_0x6fad('0x85')],'phone':_0x574ef7[_0x6fad('0x51')][_0x6fad('0x85')],'ListId':_0x421c00[_0x6fad('0x84')]});_0x14110b[_0x574ef7[_0x6fad('0x51')]['mapKeyOffline']]=_0x574ef7['body'][_0x6fad('0x85')];return db[_0x6fad('0x96')][_0x6fad('0xc5')]({'where':_0x3b481f,'defaults':_0x14110b});}})[_0x6fad('0xaf')](function(_0x4c5c9c){if(_0x4c5c9c){_0x526973=_0x4c5c9c;var _0x7f83b7=fs[_0x6fad('0xc6')](path[_0x6fad('0x6b')](config[_0x6fad('0x6c')],_0x6fad('0xc7')),_0x6fad('0xc8'));var _0x543faa=ejs[_0x6fad('0xc9')](_0x7f83b7,{'body':_[_0x6fad('0xca')](_0x574ef7[_0x6fad('0x51')][_0x6fad('0x51')]),'bodyTitle':_0x3ab968[_0x6fad('0xcb')]});return db['ChatOfflineMessage']['create']({'body':_0x543faa,'ContactId':_0x4c5c9c['id'],'ChatWebsiteId':_0x3ab968['id']});}})[_0x6fad('0x14')](function(_0x5af875){_0x2846aa=_0x5af875;if(_0x358065[_0x6fad('0x39')]){var _0x570357=_0x358065['map'](function(_0x210a67){return{'name':_0x210a67[_0x6fad('0xcc')],'basename':_0x210a67['filename'],'type':_0x210a67['mimetype'],'ChatOfflineMessageId':_0x5af875['id']};});_0xb7eb0=_0x570357[_0x6fad('0x30')](_0x28a070=>{var _0x49ae4b={'filename':_0x28a070[_0x6fad('0x2c')],'path':path['join'](config[_0x6fad('0x6c')],_0x6fad('0xcd'),_0x6fad('0xc1'),_0x6fad('0xce'),'offline-chat',_0x28a070[_0x6fad('0xcf')])};return _0x49ae4b;});if(!_0x3ab968[_0x6fad('0xd0')]){return db['sequelize']['transaction'](function(_0xed95d1){return db['Attachment'][_0x6fad('0xd1')](_0x570357,{'transaction':_0xed95d1});});}}})[_0x6fad('0x14')](function(){if(_0x2846aa){_0x49982a=_0x2846aa;return db[_0x6fad('0xc4')][_0x6fad('0x5d')]({'where':{'active':!![]},'include':[{'model':db[_0x6fad('0xd2')],'as':_0x6fad('0xd3'),'raw':!![]}]});}})[_0x6fad('0x14')](function(_0x136506){if(_0x136506&&_0x136506[_0x6fad('0xd3')]&&_0x3ab968[_0x6fad('0xd4')]&&_0x3ab968[_0x6fad('0xd5')]){var _0x17af2b={'tls':{'rejectUnauthorized':![]}};if(_0x136506[_0x6fad('0xd3')][_0x6fad('0xd6')]){_0x17af2b[_0x6fad('0xd6')]=_0x136506[_0x6fad('0xd3')][_0x6fad('0xd6')];}else{_0x17af2b['host']=_0x136506[_0x6fad('0xd3')][_0x6fad('0xd7')];_0x17af2b['port']=_0x136506[_0x6fad('0xd3')]['port'];_0x17af2b[_0x6fad('0xd8')]=_0x136506[_0x6fad('0xd3')][_0x6fad('0xd8')];}if(_0x136506[_0x6fad('0xd3')][_0x6fad('0xd9')]){_0x17af2b[_0x6fad('0xda')]={'user':_0x136506[_0x6fad('0xd3')][_0x6fad('0x49')],'pass':_0x136506['Smtp'][_0x6fad('0xdb')]};}return respondWithRpcPromise(_0x6fad('0xdc'),'sendMail',{'account':_0x17af2b,'message':{'from':util['format'](_0x6fad('0xdd'),_0x136506['name'],_0x136506['email']||_0x136506['Smtp'][_0x6fad('0x49')]),'to':_0x3ab968['forwardOfflineAddress'],'subject':_0x3ab968[_0x6fad('0xde')],'html':_0x49982a[_0x6fad('0x51')],'attachments':_0xb7eb0}},client9003)['then'](function(){return _0x49982a;})[_0x6fad('0x1f')](function(_0x139a50){console[_0x6fad('0x1a')](_0x139a50);});}})[_0x6fad('0x14')](function(){if(_0x3ab968&&_0x3ab968[_0x6fad('0xd0')]&&_0x3ab968['MailAccountId']){var _0x5e4229=[];if(_0x358065[_0x6fad('0x39')]){_0x5e4229=_0x358065[_0x6fad('0x30')](function(_0x3b7eb8){return{'name':_0x3b7eb8[_0x6fad('0xcc')],'basename':_0x3b7eb8[_0x6fad('0x66')],'type':_0x3b7eb8[_0x6fad('0xdf')],'ChatOfflineMessageId':_0x2846aa['id']};});}var _0x160ad7;if(!_[_0x6fad('0x70')](_0x3ab968[_0x6fad('0xe0')])){var _0x10851b=_[_0x6fad('0x30')](_0x574ef7[_0x6fad('0x51')],function(_0x171d16){return _0x171d16;});var _0x336bdd=_['toPairsIn'](_0x10851b)[0x0];var _0x4f7fa3=_[_0x6fad('0xe1')](_0x336bdd,function(_0x186d43){return _0x186d43;});_0x160ad7=_0x4f7fa3[0x1][_0x3ab968[_0x6fad('0xe0')]];}var _0x398b12={'from':_0x526973['email'],'firstName':_0x526973[_0x6fad('0x9e')],'lastName':_0x526973[_0x6fad('0x9f')],'mapKey':_0x6fad('0xe2'),'message':{'from':_0x526973['email'],'to':_0x3ab968[_0x6fad('0xc4')][_0x6fad('0xe2')],'cc':'','subject':_[_0x6fad('0x70')](_0x160ad7)?_0x3ab968[_0x6fad('0xde')]:_0x160ad7,'messageId':'','sentAt':new Date(),'attach':_0x5e4229[_0x6fad('0x39')],'attachments':_0x5e4229,'originChannel':_0x6fad('0xe3'),'ChatWebsiteId':_0x3ab968['id'],'ChatOfflineMessageId':_0x49982a['id'],'originTo':_0x3ab968[_0x6fad('0xc4')][_0x6fad('0xe2')]},'body':_0x49982a[_0x6fad('0x51')]};var _0x298635={'account':{'id':_0x3ab968[_0x6fad('0xe4')]},'body':_0x398b12,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x6fad('0xe5'),'notifyMail',_0x298635,client9001)[_0x6fad('0x14')](function(){return _0x49982a;})[_0x6fad('0x1f')](function(_0x387a28){console['error'](_0x387a28);});}return;})['then'](function(){if(_0x49982a){return _0x49982a;}})[_0x6fad('0x14')](respondWithResult(_0x4c967b,null))[_0x6fad('0x1f')](function(_0x5ec10c){console[_0x6fad('0x1a')]('catch',_0x5ec10c);for(var _0x128022 of _0x358065){var _0x10fb80=path[_0x6fad('0x6b')](config[_0x6fad('0x6c')],_0x6fad('0xcd'),_0x6fad('0xc1'),_0x6fad('0xce'),'offline-chat',_0x128022[_0x6fad('0x66')]);fs_extra[_0x6fad('0xe6')](_0x10fb80)[_0x6fad('0x1f')](function(_0x41856e){console[_0x6fad('0x1a')](_0x6fad('0xe7'),_0x10fb80,_0x41856e);});}});};exports['addInteraction']=function(_0x32a3c7,_0x31c929){return db[_0x6fad('0xab')][_0x6fad('0x4c')]({'where':{'id':_0x32a3c7[_0x6fad('0x46')]['id']}})['then'](handleEntityNotFound(_0x31c929,null))[_0x6fad('0x14')](function(_0x5a5b0a){if(_0x5a5b0a){return _0x5a5b0a[_0x6fad('0xe8')](_0x32a3c7[_0x6fad('0x51')][_0x6fad('0x5a')],_[_0x6fad('0xe9')](_0x32a3c7[_0x6fad('0x51')],[_0x6fad('0x5a'),'id'])||{});}})[_0x6fad('0x14')](respondWithResult(_0x31c929,null))[_0x6fad('0x1f')](handleError(_0x31c929,null));};exports[_0x6fad('0xea')]=function(_0x368532,_0x430987){var _0x3d31a8={'raw':![],'where':{}};var _0x163597={};var _0x4542a3={'count':0x0,'rows':[]};return db[_0x6fad('0x42')]['findOne']({'where':{'id':_0x368532[_0x6fad('0x46')]['id']}})[_0x6fad('0x14')](handleEntityNotFound(_0x430987,null))[_0x6fad('0x14')](function(_0x495efd){if(_0x495efd){_0x163597[_0x6fad('0x33')]=_['keys'](db[_0x6fad('0xab')][_0x6fad('0x57')]);_0x163597[_0x6fad('0x34')]=_['keys'](_0x368532['query']);_0x163597[_0x6fad('0x3d')]=_[_0x6fad('0x36')](_0x163597[_0x6fad('0x33')],_0x163597[_0x6fad('0x34')]);_0x3d31a8[_0x6fad('0x37')]=_[_0x6fad('0x36')](_0x163597[_0x6fad('0x33')],qs['fields'](_0x368532[_0x6fad('0x34')][_0x6fad('0x38')]));_0x3d31a8[_0x6fad('0x37')]=_0x3d31a8[_0x6fad('0x37')][_0x6fad('0x39')]?_0x3d31a8[_0x6fad('0x37')]:_0x163597['model'];if(!_0x368532['query']['hasOwnProperty'](_0x6fad('0x3a'))){_0x3d31a8['limit']=qs[_0x6fad('0x24')](_0x368532['query'][_0x6fad('0x24')]);_0x3d31a8[_0x6fad('0x26')]=qs['offset'](_0x368532[_0x6fad('0x34')]['offset']);}_0x3d31a8[_0x6fad('0x5f')]=qs['sort'](_0x368532[_0x6fad('0x34')]['sort']);_0x3d31a8[_0x6fad('0x3c')]=qs['filters'](_[_0x6fad('0x3e')](_0x368532[_0x6fad('0x34')],_0x163597['filters']));_0x3d31a8[_0x6fad('0x3c')][_0x6fad('0x54')]=_0x495efd['id'];if(_0x368532[_0x6fad('0x34')][_0x6fad('0x3f')]){_0x3d31a8['where']=_['merge'](_0x3d31a8[_0x6fad('0x3c')],{'$or':_[_0x6fad('0x30')](_0x3d31a8['attributes'],function(_0x12e910){var _0x4dccc4={};_0x4dccc4[_0x12e910]={'$like':'%'+_0x368532['query']['filter']+'%'};return _0x4dccc4;})});}_0x3d31a8=_[_0x6fad('0x40')]({},_0x3d31a8,_0x368532['options']);return db[_0x6fad('0xab')][_0x6fad('0x25')]({'where':_0x3d31a8['where']})[_0x6fad('0x14')](function(_0x5afa70){_0x4542a3['count']=_0x5afa70;if(_0x368532['query'][_0x6fad('0x47')]){_0x3d31a8[_0x6fad('0x43')]=[{'model':db[_0x6fad('0x96')],'as':_0x6fad('0xeb'),'required':![]},{'model':db[_0x6fad('0xb7')],'as':_0x6fad('0xec'),'attributes':[_0x6fad('0x2c'),_0x6fad('0xed'),_0x6fad('0xee')],'required':![]},{'model':db[_0x6fad('0xef')],'as':_0x6fad('0xf0'),'attributes':['id',_0x6fad('0x2c'),_0x6fad('0xf1')],'where':_0x368532[_0x6fad('0x34')][_0x6fad('0xf2')]?{'id':_0x368532[_0x6fad('0x34')]['tag']}:undefined,'required':_0x368532[_0x6fad('0x34')]['tag']?!![]:![]}];}return db[_0x6fad('0xab')]['findAll'](_0x3d31a8);})[_0x6fad('0x14')](function(_0x29ad22){_0x4542a3[_0x6fad('0x44')]=_0x29ad22;return _0x4542a3;});}})['then'](respondWithFilteredResult(_0x430987,_0x3d31a8))['catch'](handleError(_0x430987,null));};function iftimePromise(_0x222fa8,_0xea459f){return respondWithRpcPromise(_0x6fad('0xf3'),'getSnippet',{'command':_0xea459f['timezone']?util[_0x6fad('0xa8')](_0x6fad('0xf4'),_0x222fa8[_0x6fad('0xf5')],_0xea459f['timezone']):util['format']('iftime\x20%s',_0x222fa8['interval'])},client9002)[_0x6fad('0x14')](function(_0x3333f4){var _0x335651=_0x3333f4&&_0x3333f4[_0x6fad('0xf6')]('true')>=0x0?!![]:![];logger['info'](_0x6fad('0xf7'),_0xea459f['id'],_0x222fa8['id'],_0x222fa8[_0x6fad('0xf5')],_0x335651?_0x6fad('0xf8'):_0x6fad('0xf9'),_0xea459f['timezone']?_0xea459f[_0x6fad('0xfa')]:'No\x20timezone');return _0x335651;})[_0x6fad('0x1f')](function(_0x25f4bf){logger[_0x6fad('0x1a')](_0x6fad('0xf7'),_0xea459f['id'],_0x222fa8['id'],_0x222fa8[_0x6fad('0xf5')],util[_0x6fad('0xfb')](_0x25f4bf,{'showHidden':![],'depth':null}),_0xea459f[_0x6fad('0xfa')]?_0xea459f[_0x6fad('0xfa')]:_0x6fad('0xfc'));return![];});}exports['getSnippet']=function(_0x556ea0,_0x168ae9){var _0x2bcd99=0x0;var _0x1a05aa=0x0;var _0x4a62cb=![];var _0x1e44a0;var _0x2797dd;return db['ChatWebsite']['find']({'where':{'id':_0x556ea0[_0x6fad('0x46')]['id']},'include':[{'model':db['Interval'],'as':_0x6fad('0xfd'),'include':[{'model':db[_0x6fad('0xfd')],'as':_0x6fad('0xfe'),'attributes':['id',_0x6fad('0xf5')],'raw':!![]}]}]})[_0x6fad('0x14')](handleEntityNotFound(_0x168ae9,null))[_0x6fad('0x14')](function(_0x5c02e0){if(_0x5c02e0){_0x1e44a0=_0x5c02e0;return _0x5c02e0[_0x6fad('0xff')]({'raw':!![]});}})[_0x6fad('0x14')](function(_0x4cf45e){if(_0x1e44a0){if(_0x4cf45e){_0x2797dd=_0x4cf45e;}}return require(_0x6fad('0x6d'))[_0x6fad('0x6e')]();})['then'](function(_0xb5db8a){if(_0xb5db8a){_0x1a05aa=_0xb5db8a[_0x6fad('0x100')];_0x4a62cb=_0xb5db8a[_0x6fad('0x6f')];}})[_0x6fad('0x14')](function(){return db[_0x6fad('0xab')][_0x6fad('0x25')]({'where':{'closed':![]}});})[_0x6fad('0x14')](function(_0x7245a5){_0x2bcd99=_0x7245a5;if(_0x1a05aa&&_0x7245a5>_0x1a05aa){return db[_0x6fad('0x101')][_0x6fad('0x5d')]({'where':{'id':0x1}})[_0x6fad('0x14')](function(_0x4d3bdf){if(_0x4d3bdf){_0x4d3bdf[_0x6fad('0x102')](_0x6fad('0x103'));}});}})[_0x6fad('0x14')](function(){if(_0x1e44a0[_0x6fad('0xfd')]&&_0x1e44a0[_0x6fad('0xfd')][_0x6fad('0xfe')]){var _0x5712df=[];for(var _0x4f410c=0x0;_0x4f410c<_0x1e44a0['Interval'][_0x6fad('0xfe')][_0x6fad('0x39')];_0x4f410c++){var _0x4cefb7=_0x1e44a0[_0x6fad('0xfd')][_0x6fad('0xfe')][_0x4f410c][_0x6fad('0x28')]({'plain':!![]});_0x5712df['push'](iftimePromise(_0x4cefb7,_0x1e44a0));}return BPromise[_0x6fad('0x104')](_0x5712df)[_0x6fad('0x14')](function(_0x39dbaf){return _[_0x6fad('0x105')](_0x39dbaf);});}else{return!![];}})[_0x6fad('0x14')](function(_0x8ba65a){var _0x3ffa43=fs['readFileSync'](path['join'](config['root'],_0x6fad('0x106')),'utf8');var _0x51ed27={'remote':_0x1e44a0[_0x6fad('0x107')],'query':querystring['stringify'](_[_0x6fad('0x40')](_0x1e44a0[_0x6fad('0x28')]({'plain':!![]}),{'customerIp':_0x556ea0[_0x6fad('0x99')][_0x6fad('0x9b')]||_0x556ea0[_0x6fad('0x99')]['x-real-ip']||_0x556ea0[_0x6fad('0x108')][_0x6fad('0x109')]||_0x556ea0['ip'],'referer':_0x556ea0[_0x6fad('0x99')][_0x6fad('0xa1')],'openedInteractions':_0x2bcd99,'maxInteractions':_0x1a05aa,'virtual':_0x4a62cb[_0x6fad('0x100')],'online':_0x8ba65a,'custom':_0x4a62cb}))[_0x6fad('0x10a')](/'/g,'\x5c\x27')};_0x168ae9[_0x6fad('0x2d')](ejs[_0x6fad('0xc9')](Mustache[_0x6fad('0xc9')](_0x3ffa43,_0x51ed27),{'proactiveActions':_0x2797dd,'alignment':_0x1e44a0[_0x6fad('0x10b')],'verticalAlignment':_0x1e44a0['verticalAlignment'],'div_color':_0x1e44a0['color'],'text_color':_0x1e44a0[_0x6fad('0x10c')],'button_color':_0x1e44a0[_0x6fad('0x10d')],'background_color':_0x1e44a0['backgroundColor']}));})[_0x6fad('0x1f')](handleError(_0x168ae9,null));};exports['addApplications']=function(_0x5da190,_0x15ff06){var _0x1dfa52=_0x5da190[_0x6fad('0x46')]['id'];var _0x4232f8=_0x5da190[_0x6fad('0x51')];var _0x42fe6b=0xc8;var _0x4edb83=null;return db['sequelize'][_0x6fad('0x10e')]({'isolationLevel':db[_0x6fad('0x10f')]['Transaction'][_0x6fad('0x110')][_0x6fad('0x111')]},function(_0xb2fb39){return db['ChatWebsite'][_0x6fad('0x5d')]({'where':{'id':_0x1dfa52},'transaction':_0xb2fb39})[_0x6fad('0x14')](function(_0x1968e7){if(_0x1968e7){return db['ChatApplication'][_0x6fad('0x27')]({'where':{'ChatWebsiteId':_0x1dfa52},'transaction':_0xb2fb39})[_0x6fad('0x14')](function(){var _0x375051=_[_0x6fad('0x30')](_0x4232f8,function(_0x36a7cf){_0x36a7cf['ChatWebsiteId']=_0x1dfa52;return _0x36a7cf;});return db[_0x6fad('0x8e')][_0x6fad('0xd1')](_0x375051,{'transaction':_0xb2fb39});});}else{_0x42fe6b=0x194;_0x4edb83=[];}});})[_0x6fad('0x14')](function(){if(_0x42fe6b!==0x194){return db[_0x6fad('0x8e')][_0x6fad('0x112')]({'where':{'ChatWebsiteId':_0x1dfa52},'order':'priority'})[_0x6fad('0x14')](function(_0x49c51d){_0x4edb83=_0x49c51d;});}})[_0x6fad('0x1f')](function(_0x34abd5){_0x42fe6b=0x1f4;logger[_0x6fad('0x1a')](_0x34abd5[_0x6fad('0x2b')]);if(_0x34abd5[_0x6fad('0x2c')]){delete _0x34abd5[_0x6fad('0x2c')];}_0x4edb83=_0x34abd5;})[_0x6fad('0x113')](function(){if(_0x4edb83===null){_0x15ff06[_0x6fad('0x114')](_0x42fe6b);}else{if(_0x42fe6b===0x1f4){_0x15ff06[_0x6fad('0x20')](_0x42fe6b)[_0x6fad('0x2d')](_0x4edb83);}else{_0x15ff06[_0x6fad('0x20')](_0x42fe6b)['json'](_0x4edb83);}}});};exports[_0x6fad('0x115')]=function(_0x3808b9,_0x1b1a0f){var _0x387a90={};var _0x38f262={};var _0x292bab;var _0xb27dd0;return db[_0x6fad('0x42')][_0x6fad('0x5d')]({'where':{'id':_0x3808b9[_0x6fad('0x46')]['id']}})[_0x6fad('0x14')](handleEntityNotFound(_0x1b1a0f,null))[_0x6fad('0x14')](function(_0x1a1894){if(_0x1a1894){_0x292bab=_0x1a1894;_0x38f262[_0x6fad('0x33')]=_[_0x6fad('0x35')](db[_0x6fad('0x8e')][_0x6fad('0x57')]);_0x38f262[_0x6fad('0x34')]=_[_0x6fad('0x35')](_0x3808b9['query']);_0x38f262[_0x6fad('0x3d')]=_['intersection'](_0x38f262[_0x6fad('0x33')],_0x38f262[_0x6fad('0x34')]);_0x387a90['attributes']=_[_0x6fad('0x36')](_0x38f262[_0x6fad('0x33')],qs['fields'](_0x3808b9[_0x6fad('0x34')][_0x6fad('0x38')]));_0x387a90['attributes']=_0x387a90[_0x6fad('0x37')][_0x6fad('0x39')]?_0x387a90[_0x6fad('0x37')]:_0x38f262[_0x6fad('0x33')];_0x387a90[_0x6fad('0x5f')]=qs[_0x6fad('0x3b')](_0x3808b9[_0x6fad('0x34')][_0x6fad('0x3b')]);_0x387a90['where']=qs[_0x6fad('0x3d')](_[_0x6fad('0x3e')](_0x3808b9[_0x6fad('0x34')],_0x38f262[_0x6fad('0x3d')]));if(_0x3808b9[_0x6fad('0x34')][_0x6fad('0x3f')]){_0x387a90[_0x6fad('0x3c')]=_[_0x6fad('0x40')](_0x387a90[_0x6fad('0x3c')],{'$or':_[_0x6fad('0x30')](_0x387a90[_0x6fad('0x37')],function(_0x9df242){var _0x282eeb={};_0x282eeb[_0x9df242]={'$like':'%'+_0x3808b9[_0x6fad('0x34')]['filter']+'%'};return _0x282eeb;})});}_0x387a90=_[_0x6fad('0x40')]({},_0x387a90,_0x3808b9['options']);return _0x292bab[_0x6fad('0x115')](_0x387a90);}})[_0x6fad('0x14')](function(_0x56f6e9){if(_0x56f6e9){_0xb27dd0=_0x56f6e9[_0x6fad('0x39')];if(!_0x3808b9[_0x6fad('0x34')][_0x6fad('0x5e')](_0x6fad('0x3a'))){_0x387a90[_0x6fad('0x24')]=qs[_0x6fad('0x24')](_0x3808b9['query'][_0x6fad('0x24')]);_0x387a90['offset']=qs['offset'](_0x3808b9['query'][_0x6fad('0x26')]);}return _0x292bab[_0x6fad('0x115')](_0x387a90);}})['then'](function(_0x27f69b){if(_0x27f69b){return _0x27f69b?{'count':_0xb27dd0,'rows':_0x27f69b}:null;}})[_0x6fad('0x14')](respondWithResult(_0x1b1a0f,null))[_0x6fad('0x1f')](handleError(_0x1b1a0f,null));};exports[_0x6fad('0x116')]=function(_0xeaee1,_0x11edf0){return db[_0x6fad('0x117')][_0x6fad('0x4c')]({'where':{'id':_0xeaee1[_0x6fad('0x46')]['id']}})[_0x6fad('0x14')](handleEntityNotFound(_0x11edf0,null))[_0x6fad('0x14')](function(_0x166962){if(_0x166962){return _0x166962['addProactiveActions'](_0xeaee1[_0x6fad('0x51')][_0x6fad('0x5a')],_[_0x6fad('0xe9')](_0xeaee1['body'],[_0x6fad('0x5a'),'id'])||{});}})['then'](respondWithResult(_0x11edf0,null))[_0x6fad('0x1f')](handleError(_0x11edf0,null));};exports['getProactiveActions']=function(_0x247d51,_0x189e7b){var _0x1819a2={};var _0x5c8f47={};var _0x45596a;var _0xa9da0d;return db[_0x6fad('0x42')][_0x6fad('0x5d')]({'where':{'id':_0x247d51[_0x6fad('0x46')]['id']}})['then'](handleEntityNotFound(_0x189e7b,null))[_0x6fad('0x14')](function(_0xdd896a){if(_0xdd896a){_0x45596a=_0xdd896a;_0x5c8f47[_0x6fad('0x33')]=_[_0x6fad('0x35')](db[_0x6fad('0x118')][_0x6fad('0x57')]);_0x5c8f47[_0x6fad('0x34')]=_[_0x6fad('0x35')](_0x247d51[_0x6fad('0x34')]);_0x5c8f47[_0x6fad('0x3d')]=_[_0x6fad('0x36')](_0x5c8f47[_0x6fad('0x33')],_0x5c8f47['query']);_0x1819a2['attributes']=_[_0x6fad('0x36')](_0x5c8f47['model'],qs['fields'](_0x247d51['query'][_0x6fad('0x38')]));_0x1819a2[_0x6fad('0x37')]=_0x1819a2['attributes'][_0x6fad('0x39')]?_0x1819a2[_0x6fad('0x37')]:_0x5c8f47['model'];_0x1819a2[_0x6fad('0x5f')]=qs[_0x6fad('0x3b')](_0x247d51['query'][_0x6fad('0x3b')]);_0x1819a2[_0x6fad('0x3c')]=qs['filters'](_['pick'](_0x247d51[_0x6fad('0x34')],_0x5c8f47['filters']));if(_0x247d51[_0x6fad('0x34')][_0x6fad('0x3f')]){_0x1819a2[_0x6fad('0x3c')]=_['merge'](_0x1819a2[_0x6fad('0x3c')],{'$or':_[_0x6fad('0x30')](_0x1819a2[_0x6fad('0x37')],function(_0x528a1c){var _0x481a86={};_0x481a86[_0x528a1c]={'$like':'%'+_0x247d51[_0x6fad('0x34')]['filter']+'%'};return _0x481a86;})});}_0x1819a2=_[_0x6fad('0x40')]({},_0x1819a2,_0x247d51[_0x6fad('0x41')]);return _0x45596a[_0x6fad('0xff')](_0x1819a2);}})[_0x6fad('0x14')](function(_0x16b099){if(_0x16b099){_0xa9da0d=_0x16b099[_0x6fad('0x39')];if(!_0x247d51[_0x6fad('0x34')][_0x6fad('0x5e')](_0x6fad('0x3a'))){_0x1819a2['limit']=qs[_0x6fad('0x24')](_0x247d51[_0x6fad('0x34')][_0x6fad('0x24')]);_0x1819a2['offset']=qs[_0x6fad('0x26')](_0x247d51[_0x6fad('0x34')][_0x6fad('0x26')]);}return _0x45596a['getProactiveActions'](_0x1819a2);}})[_0x6fad('0x14')](function(_0x13a0a7){if(_0x13a0a7){return _0x13a0a7?{'count':_0xa9da0d,'rows':_0x13a0a7}:null;}})[_0x6fad('0x14')](respondWithResult(_0x189e7b,null))[_0x6fad('0x1f')](handleError(_0x189e7b,null));};exports[_0x6fad('0x119')]=function(_0x1dec96,_0x57f8c9){var _0x4caca8=_0x1dec96[_0x6fad('0x34')][_0x6fad('0x11a')]===_0x6fad('0x11b')?'offlineForm':_0x6fad('0x11c');return db[_0x6fad('0x42')][_0x6fad('0x4c')]({'attributes':['id',_0x4caca8],'where':{'id':_0x1dec96[_0x6fad('0x46')]['id']}})[_0x6fad('0x14')](handleEntityNotFound(_0x57f8c9,null))[_0x6fad('0x14')](function(_0x449f9c){if(_0x449f9c){var _0x2aaaad=_0x449f9c[_0x4caca8];var _0x297c24=_0x2aaaad&&_0x2aaaad[_0x6fad('0x11d')]?_0x2aaaad[_0x6fad('0x11d')]:[];_0x57f8c9[_0x6fad('0x2d')]({'fromKey':_[_0x6fad('0x70')](_0x2aaaad[_0x6fad('0x11e')])?undefined:_0x2aaaad['fromKey'],'count':_0x297c24['length'],'rows':_0x297c24});}})[_0x6fad('0x1f')](handleError(_0x57f8c9,null));};exports[_0x6fad('0x11f')]=function(_0x2878a0,_0x3bc484){var _0x529d48={'raw':![],'where':{}};var _0x50f963={};var _0x28e314={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x6fad('0x5d')]({'where':{'id':_0x2878a0[_0x6fad('0x46')]['id']}})[_0x6fad('0x14')](handleEntityNotFound(_0x3bc484,null))[_0x6fad('0x14')](function(_0x5b7adf){if(_0x5b7adf){_0x50f963[_0x6fad('0x33')]=_[_0x6fad('0x35')](db[_0x6fad('0x120')][_0x6fad('0x57')]);_0x50f963[_0x6fad('0x34')]=_[_0x6fad('0x35')](_0x2878a0[_0x6fad('0x34')]);_0x50f963[_0x6fad('0x3d')]=_[_0x6fad('0x36')](_0x50f963['model'],_0x50f963[_0x6fad('0x34')]);_0x529d48[_0x6fad('0x37')]=_[_0x6fad('0x36')](_0x50f963[_0x6fad('0x33')],qs[_0x6fad('0x38')](_0x2878a0[_0x6fad('0x34')]['fields']));_0x529d48['attributes']=_0x529d48[_0x6fad('0x37')]['length']?_0x529d48[_0x6fad('0x37')]:_0x50f963['model'];if(!_0x2878a0['query'][_0x6fad('0x5e')](_0x6fad('0x3a'))){_0x529d48[_0x6fad('0x24')]=qs[_0x6fad('0x24')](_0x2878a0[_0x6fad('0x34')][_0x6fad('0x24')]);_0x529d48['offset']=qs[_0x6fad('0x26')](_0x2878a0[_0x6fad('0x34')][_0x6fad('0x26')]);}_0x529d48['order']=qs[_0x6fad('0x3b')](_0x2878a0[_0x6fad('0x34')][_0x6fad('0x3b')]);_0x529d48[_0x6fad('0x3c')]=qs[_0x6fad('0x3d')](_[_0x6fad('0x3e')](_0x2878a0[_0x6fad('0x34')],_0x50f963[_0x6fad('0x3d')]));_0x529d48[_0x6fad('0x3c')][_0x6fad('0x54')]=_0x5b7adf['id'];if(_0x2878a0[_0x6fad('0x34')][_0x6fad('0x3f')]){_0x529d48[_0x6fad('0x3c')]=_['merge'](_0x529d48[_0x6fad('0x3c')],{'$or':_[_0x6fad('0x30')](_0x529d48[_0x6fad('0x37')],function(_0x36054e){var _0x5093ae={};_0x5093ae[_0x36054e]={'$like':'%'+_0x2878a0[_0x6fad('0x34')][_0x6fad('0x3f')]+'%'};return _0x5093ae;})});}_0x529d48=_[_0x6fad('0x40')]({},_0x529d48,_0x2878a0[_0x6fad('0x41')]);return db[_0x6fad('0x120')][_0x6fad('0x25')]({'where':_0x529d48['where']})[_0x6fad('0x14')](function(_0x2abf21){_0x28e314[_0x6fad('0x25')]=_0x2abf21;if(_0x2878a0[_0x6fad('0x34')][_0x6fad('0x47')]){_0x529d48['include']=[{'all':!![]}];}else{_0x529d48[_0x6fad('0x43')]=[{'model':db[_0x6fad('0x96')],'as':_0x6fad('0xeb'),'required':![]},{'model':db[_0x6fad('0x121')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x529d48);})[_0x6fad('0x14')](function(_0x216db7){_0x28e314[_0x6fad('0x44')]=_0x216db7;return _0x28e314;});}})[_0x6fad('0x14')](respondWithFilteredResult(_0x3bc484,_0x529d48))[_0x6fad('0x1f')](handleError(_0x3bc484,null));};exports[_0x6fad('0x122')]=function(_0x4bae06,_0x1eafdb){return db['ChatWebsite'][_0x6fad('0x4c')]({'where':{'id':_0x4bae06['params']['id']}})['then'](handleEntityNotFound(_0x1eafdb,null))[_0x6fad('0x14')](function(_0x36ace9){if(_0x36ace9){return _0x36ace9[_0x6fad('0x122')](_0x4bae06[_0x6fad('0x51')][_0x6fad('0x5a')],_['omit'](_0x4bae06[_0x6fad('0x51')],[_0x6fad('0x5a'),'id'])||{})[_0x6fad('0xaf')](function(_0xf36e4e){for(var _0x169f81=0x0;_0x169f81<_0x4bae06[_0x6fad('0x51')][_0x6fad('0x5a')][_0x6fad('0x39')];_0x169f81+=0x1){socket[_0x6fad('0x123')](_0x6fad('0x124'),{'UserId':Number(_0x4bae06[_0x6fad('0x51')][_0x6fad('0x5a')][_0x169f81]),'ChatWebsiteId':Number(_0x4bae06['params']['id'])});}return _0xf36e4e;});}})[_0x6fad('0x14')](respondWithResult(_0x1eafdb,null))['catch'](handleError(_0x1eafdb,null));};exports[_0x6fad('0x125')]=function(_0x181970,_0x2171ea){return db['ChatWebsite'][_0x6fad('0x4c')]({'where':{'id':_0x181970['params']['id']}})[_0x6fad('0x14')](handleEntityNotFound(_0x2171ea,null))[_0x6fad('0x14')](function(_0x2391e2){if(_0x2391e2){return _0x2391e2[_0x6fad('0x125')](_0x181970[_0x6fad('0x34')][_0x6fad('0x5a')])[_0x6fad('0x14')](function(){if(_[_0x6fad('0x126')](_0x181970[_0x6fad('0x34')][_0x6fad('0x5a')])){for(var _0xc75eb1=0x0;_0xc75eb1<_0x181970[_0x6fad('0x34')]['ids'][_0x6fad('0x39')];_0xc75eb1+=0x1){socket[_0x6fad('0x123')](_0x6fad('0x127'),{'UserId':Number(_0x181970[_0x6fad('0x34')][_0x6fad('0x5a')][_0xc75eb1]),'ChatWebsiteId':Number(_0x181970[_0x6fad('0x46')]['id'])});}}else{socket[_0x6fad('0x123')](_0x6fad('0x127'),{'UserId':Number(_0x181970[_0x6fad('0x34')]['ids']),'ChatWebsiteId':Number(_0x181970[_0x6fad('0x46')]['id'])});}});}})[_0x6fad('0x14')](respondWithStatusCode(_0x2171ea,null))['catch'](handleError(_0x2171ea,null));};exports['getAgents']=function(_0x44d62e,_0x85a5a3){var _0x20c678={};var _0x187d17={};var _0x58891d;var _0x111bbb;return db[_0x6fad('0x42')][_0x6fad('0x5d')]({'where':{'id':_0x44d62e[_0x6fad('0x46')]['id']}})[_0x6fad('0x14')](handleEntityNotFound(_0x85a5a3,null))[_0x6fad('0x14')](function(_0x3cf64b){if(_0x3cf64b){_0x58891d=_0x3cf64b;_0x187d17[_0x6fad('0x33')]=_['keys'](db['User'][_0x6fad('0x57')]);_0x187d17[_0x6fad('0x34')]=_[_0x6fad('0x35')](_0x44d62e[_0x6fad('0x34')]);_0x187d17[_0x6fad('0x3d')]=_['intersection'](_0x187d17[_0x6fad('0x33')],_0x187d17['query']);_0x20c678[_0x6fad('0x37')]=_[_0x6fad('0x36')](_0x187d17[_0x6fad('0x33')],qs['fields'](_0x44d62e[_0x6fad('0x34')][_0x6fad('0x38')]));_0x20c678[_0x6fad('0x37')]=_0x20c678[_0x6fad('0x37')][_0x6fad('0x39')]?_0x20c678[_0x6fad('0x37')]:_0x187d17[_0x6fad('0x33')];_0x20c678['order']=qs[_0x6fad('0x3b')](_0x44d62e[_0x6fad('0x34')]['sort']);_0x20c678[_0x6fad('0x3c')]=qs['filters'](_[_0x6fad('0x3e')](_0x44d62e[_0x6fad('0x34')],_0x187d17[_0x6fad('0x3d')]));if(_0x44d62e[_0x6fad('0x34')]['filter']){_0x20c678[_0x6fad('0x3c')]=_[_0x6fad('0x40')](_0x20c678[_0x6fad('0x3c')],{'$or':_[_0x6fad('0x30')](_0x20c678[_0x6fad('0x37')],function(_0x243dad){var _0x468bbe={};_0x468bbe[_0x243dad]={'$like':'%'+_0x44d62e[_0x6fad('0x34')]['filter']+'%'};return _0x468bbe;})});}_0x20c678=_[_0x6fad('0x40')]({},_0x20c678,_0x44d62e[_0x6fad('0x41')]);return _0x58891d['getAgents'](_0x20c678);}})[_0x6fad('0x14')](function(_0x5016b5){if(_0x5016b5){_0x111bbb=_0x5016b5[_0x6fad('0x39')];if(!_0x44d62e['query'][_0x6fad('0x5e')](_0x6fad('0x3a'))){_0x20c678[_0x6fad('0x24')]=qs[_0x6fad('0x24')](_0x44d62e['query'][_0x6fad('0x24')]);_0x20c678[_0x6fad('0x26')]=qs[_0x6fad('0x26')](_0x44d62e[_0x6fad('0x34')]['offset']);}return _0x58891d[_0x6fad('0x128')](_0x20c678);}})[_0x6fad('0x14')](function(_0x51d15d){if(_0x51d15d){return _0x51d15d?{'count':_0x111bbb,'rows':_0x51d15d}:null;}})[_0x6fad('0x14')](respondWithResult(_0x85a5a3,null))[_0x6fad('0x1f')](handleError(_0x85a5a3,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 349560d..55fc87b 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 _0xec46=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xec46,0x19c));var _0x6ec4=function(_0x4f240d,_0x13a89a){_0x4f240d=_0x4f240d-0x0;var _0x5b92cc=_0xec46[_0x4f240d];return _0x5b92cc;};'use strict';var EventEmitter=require(_0x6ec4('0x0'));var ChatWebsite=require(_0x6ec4('0x1'))['db'][_0x6ec4('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x6ec4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6ec4('0x4')};function emitEvent(_0x157723){return function(_0x86b9f8,_0x53bbed,_0x3471fa){ChatWebsiteEvents[_0x6ec4('0x5')](_0x157723+':'+_0x86b9f8['id'],_0x86b9f8);ChatWebsiteEvents['emit'](_0x157723,_0x86b9f8);_0x3471fa(null);};}for(var e in events){if(events[_0x6ec4('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x6ec4('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xe3c5=['exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1196bd,_0xba4aea){var _0x26014f=function(_0x542a3d){while(--_0x542a3d){_0x1196bd['push'](_0x1196bd['shift']());}};_0x26014f(++_0xba4aea);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0xe3c5[_0x45fc6a];return _0x14bcfd;};'use strict';var EventEmitter=require(_0x5e3c('0x0'));var ChatWebsite=require(_0x5e3c('0x1'))['db'][_0x5e3c('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x5e3c('0x3')](0x0);var events={'afterCreate':_0x5e3c('0x4'),'afterUpdate':_0x5e3c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x46e129){return function(_0x2ef6cd,_0x361936,_0x2a7d7a){ChatWebsiteEvents[_0x5e3c('0x6')](_0x46e129+':'+_0x2ef6cd['id'],_0x2ef6cd);ChatWebsiteEvents[_0x5e3c('0x6')](_0x46e129,_0x2ef6cd);_0x2a7d7a(null);};}for(var e in events){if(events[_0x5e3c('0x7')](e)){var event=events[e];ChatWebsite[_0x5e3c('0x8')](e,emitEvent(event));}}module[_0x5e3c('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 9c38850..c3d1c91 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 _0xfc06=['chat_websites','lodash','bluebird','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite'];(function(_0x26425a,_0x1b4d6f){var _0x12802a=function(_0x5db8a7){while(--_0x5db8a7){_0x26425a['push'](_0x26425a['shift']());}};_0x12802a(++_0x1b4d6f);}(_0xfc06,0x121));var _0x6fc0=function(_0x8bb9c8,_0x4be05e){_0x8bb9c8=_0x8bb9c8-0x0;var _0x38258f=_0xfc06[_0x8bb9c8];return _0x38258f;};'use strict';var _=require(_0x6fc0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6fc0('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6fc0('0x2'));var config=require(_0x6fc0('0x3'));var attributes=require(_0x6fc0('0x4'));module[_0x6fc0('0x5')]=function(_0x3bc8da,_0x4f8f80){return _0x3bc8da[_0x6fc0('0x6')](_0x6fc0('0x7'),attributes,{'tableName':_0x6fc0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43d5=['rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x43d5,0xfd));var _0x543d=function(_0x235e0f,_0x349081){_0x235e0f=_0x235e0f-0x0;var _0x15c4e0=_0x43d5[_0x235e0f];return _0x15c4e0;};'use strict';var _=require('lodash');var util=require(_0x543d('0x0'));var logger=require(_0x543d('0x1'))(_0x543d('0x2'));var moment=require(_0x543d('0x3'));var BPromise=require(_0x543d('0x4'));var rp=require(_0x543d('0x5'));var fs=require('fs');var path=require(_0x543d('0x6'));var rimraf=require(_0x543d('0x7'));var config=require(_0x543d('0x8'));var attributes=require(_0x543d('0x9'));module[_0x543d('0xa')]=function(_0x92eadd,_0x1a5255){return _0x92eadd['define'](_0x543d('0xb'),attributes,{'tableName':_0x543d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 26390b9..1eccc72 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 _0xc57e=['ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5cfcc1,_0x418717){var _0x76fa4c=function(_0x4fc5c1){while(--_0x4fc5c1){_0x5cfcc1['push'](_0x5cfcc1['shift']());}};_0x76fa4c(++_0x418717);}(_0xc57e,0x166));var _0xec57=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc57e[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xec57('0x0'));var util=require(_0xec57('0x1'));var moment=require('moment');var BPromise=require(_0xec57('0x2'));var rs=require(_0xec57('0x3'));var fs=require('fs');var Redis=require(_0xec57('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec57('0x5'));var logger=require(_0xec57('0x6'))('rpc');var config=require(_0xec57('0x7'));var jayson=require(_0xec57('0x8'));var client=jayson['client'][_0xec57('0x9')]({'port':0x232a});config['redis']=_[_0xec57('0xa')](config[_0xec57('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xec57('0xc'))(new Redis(config[_0xec57('0xb')]));require(_0xec57('0xd'))[_0xec57('0xe')](socket);function respondWithRpcPromise(_0x38a69d,_0x5183bd,_0x380728){return new BPromise(function(_0x4901a8,_0x5139da){return client[_0xec57('0xf')](_0x38a69d,_0x380728)['then'](function(_0x29a15e){logger[_0xec57('0x10')](_0xec57('0x11'),_0x5183bd,_0xec57('0x12'));logger[_0xec57('0x13')](_0xec57('0x14'),_0x5183bd,_0xec57('0x12'),JSON[_0xec57('0x15')](_0x29a15e));if(_0x29a15e[_0xec57('0x16')]){if(_0x29a15e[_0xec57('0x16')][_0xec57('0x17')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x5183bd,_0x29a15e[_0xec57('0x16')][_0xec57('0x18')]);return _0x5139da(_0x29a15e[_0xec57('0x16')][_0xec57('0x18')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x5183bd,_0x29a15e[_0xec57('0x16')]['message']);return _0x4901a8(_0x29a15e['error']['message']);}else{logger[_0xec57('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x5183bd,_0xec57('0x12'));_0x4901a8(_0x29a15e[_0xec57('0x19')]['message']);}})[_0xec57('0x1a')](function(_0x422d20){logger['error'](_0xec57('0x11'),_0x5183bd,_0x422d20);_0x5139da(_0x422d20);});});} \ No newline at end of file +var _0x98b6=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','ChatWebsite,\x20%s,\x20%s'];(function(_0x49ac16,_0x601534){var _0x3900b2=function(_0x29b93b){while(--_0x29b93b){_0x49ac16['push'](_0x49ac16['shift']());}};_0x3900b2(++_0x601534);}(_0x98b6,0x17c));var _0x698b=function(_0x2b22c0,_0x4cb8f8){_0x2b22c0=_0x2b22c0-0x0;var _0x45c8ef=_0x98b6[_0x2b22c0];return _0x45c8ef;};'use strict';var _=require(_0x698b('0x0'));var util=require(_0x698b('0x1'));var moment=require(_0x698b('0x2'));var BPromise=require(_0x698b('0x3'));var rs=require(_0x698b('0x4'));var fs=require('fs');var Redis=require(_0x698b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x698b('0x6'))(_0x698b('0x7'));var config=require(_0x698b('0x8'));var jayson=require(_0x698b('0x9'));var client=jayson[_0x698b('0xa')][_0x698b('0xb')]({'port':0x232a});config[_0x698b('0xc')]=_[_0x698b('0xd')](config[_0x698b('0xc')],{'host':_0x698b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x698b('0xc')]));require(_0x698b('0xf'))[_0x698b('0x10')](socket);function respondWithRpcPromise(_0x494e33,_0x1efd57,_0x4d22bb){return new BPromise(function(_0x34030b,_0x1316e8){return client[_0x698b('0x11')](_0x494e33,_0x4d22bb)[_0x698b('0x12')](function(_0x282233){logger[_0x698b('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x1efd57,_0x698b('0x14'));logger[_0x698b('0x15')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1efd57,_0x698b('0x14'),JSON[_0x698b('0x16')](_0x282233));if(_0x282233[_0x698b('0x17')]){if(_0x282233[_0x698b('0x17')][_0x698b('0x18')]===0x1f4){logger[_0x698b('0x17')](_0x698b('0x19'),_0x1efd57,_0x282233[_0x698b('0x17')][_0x698b('0x1a')]);return _0x1316e8(_0x282233[_0x698b('0x17')][_0x698b('0x1a')]);}logger[_0x698b('0x17')](_0x698b('0x19'),_0x1efd57,_0x282233[_0x698b('0x17')][_0x698b('0x1a')]);return _0x34030b(_0x282233[_0x698b('0x17')][_0x698b('0x1a')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1efd57,_0x698b('0x14'));_0x34030b(_0x282233[_0x698b('0x1b')][_0x698b('0x1a')]);}})[_0x698b('0x1c')](function(_0x39423b){logger['error'](_0x698b('0x19'),_0x1efd57,_0x39423b);_0x1316e8(_0x39423b);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 68b907a..226057e 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 _0x8be6=['update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','remove'];(function(_0x46ff04,_0x33b46c){var _0x49f22e=function(_0x465a74){while(--_0x465a74){_0x46ff04['push'](_0x46ff04['shift']());}};_0x49f22e(++_0x33b46c);}(_0x8be6,0xce));var _0x68be=function(_0x267893,_0x48b955){_0x267893=_0x267893-0x0;var _0x13612d=_0x8be6[_0x267893];return _0x13612d;};'use strict';var ChatWebsiteEvents=require(_0x68be('0x0'));var events=['save',_0x68be('0x1'),_0x68be('0x2')];function createListener(_0x5c8571,_0x5ad6a2){return function(_0x302514){_0x5ad6a2[_0x68be('0x3')](_0x5c8571,_0x302514);};}function removeListener(_0x354b6,_0x597132){return function(){ChatWebsiteEvents[_0x68be('0x4')](_0x354b6,_0x597132);};}exports[_0x68be('0x5')]=function(_0x5942ff){for(var _0x29becc=0x0,_0x2a8973=events[_0x68be('0x6')];_0x29becc<_0x2a8973;_0x29becc++){var _0x792a8d=events[_0x29becc];var _0x5568ef=createListener(_0x68be('0x7')+_0x792a8d,_0x5942ff);ChatWebsiteEvents['on'](_0x792a8d,_0x5568ef);}}; \ No newline at end of file +var _0x4f25=['register','length','chatWebsite:','./chatWebsite.events','save','remove','emit'];(function(_0x290dde,_0x367a7e){var _0x398837=function(_0x31d32e){while(--_0x31d32e){_0x290dde['push'](_0x290dde['shift']());}};_0x398837(++_0x367a7e);}(_0x4f25,0x11b));var _0x54f2=function(_0x13342f,_0x3d6303){_0x13342f=_0x13342f-0x0;var _0x2fc1fc=_0x4f25[_0x13342f];return _0x2fc1fc;};'use strict';var ChatWebsiteEvents=require(_0x54f2('0x0'));var events=[_0x54f2('0x1'),_0x54f2('0x2'),'update'];function createListener(_0x3193e1,_0x3a97ea){return function(_0x11413f){_0x3a97ea[_0x54f2('0x3')](_0x3193e1,_0x11413f);};}function removeListener(_0x3d7dae,_0x31a91f){return function(){ChatWebsiteEvents['removeListener'](_0x3d7dae,_0x31a91f);};}exports[_0x54f2('0x4')]=function(_0x4fd791){for(var _0x42bba7=0x0,_0x25a523=events[_0x54f2('0x5')];_0x42bba7<_0x25a523;_0x42bba7++){var _0x3e8905=events[_0x42bba7];var _0x29d2d1=createListener(_0x54f2('0x6')+_0x3e8905,_0x4fd791);ChatWebsiteEvents['on'](_0x3e8905,_0x29d2d1);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index ba6536a..1ec6361 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 _0xebb3=['./chatWebsite.controller','/describe','isAuthenticated','describe','/:id','get','getDispositions','/:id/canned_answers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','join','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','addAvatar','diskStorage','root','server/files/images/avatars/','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x4ed5c1,_0x375104){var _0x174880=function(_0x1dda11){while(--_0x1dda11){_0x4ed5c1['push'](_0x4ed5c1['shift']());}};_0x174880(++_0x375104);}(_0xebb3,0xcb));var _0x3ebb=function(_0x31f0da,_0x2395a6){_0x31f0da=_0x31f0da-0x0;var _0x435567=_0xebb3[_0x31f0da];return _0x435567;};'use strict';var multer=require(_0x3ebb('0x0'));var util=require(_0x3ebb('0x1'));var path=require('path');var timeout=require(_0x3ebb('0x2'));var express=require(_0x3ebb('0x3'));var router=express[_0x3ebb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3ebb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3ebb('0x6'));var controller=require(_0x3ebb('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3ebb('0x8'),auth[_0x3ebb('0x9')](),controller[_0x3ebb('0xa')]);router['get'](_0x3ebb('0xb'),auth[_0x3ebb('0x9')](),controller['show']);router[_0x3ebb('0xc')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3ebb('0xd')]);router[_0x3ebb('0xc')](_0x3ebb('0xe'),auth[_0x3ebb('0x9')](),controller['getAnswers']);router[_0x3ebb('0xc')](_0x3ebb('0xf'),controller['getLogo']);router[_0x3ebb('0xc')](_0x3ebb('0x10'),controller[_0x3ebb('0x11')]);router[_0x3ebb('0xc')](_0x3ebb('0x12'),controller[_0x3ebb('0x13')]);router[_0x3ebb('0xc')](_0x3ebb('0x14'),controller[_0x3ebb('0x15')]);router[_0x3ebb('0xc')](_0x3ebb('0x16'),auth['isAuthenticated'](),controller[_0x3ebb('0x17')]);router[_0x3ebb('0xc')](_0x3ebb('0x18'),controller[_0x3ebb('0x19')]);router['get'](_0x3ebb('0x1a'),auth[_0x3ebb('0x9')](),controller['getApplications']);router[_0x3ebb('0xc')]('/:id/proactive_actions',auth[_0x3ebb('0x9')](),controller['getProactiveActions']);router[_0x3ebb('0xc')](_0x3ebb('0x1b'),controller[_0x3ebb('0x1c')]);router['get'](_0x3ebb('0x1d'),auth[_0x3ebb('0x9')](),controller['getOfflineMessages']);router[_0x3ebb('0xc')](_0x3ebb('0x1e'),auth[_0x3ebb('0x9')](),controller[_0x3ebb('0x1f')]);router[_0x3ebb('0x20')]('/',auth[_0x3ebb('0x9')](),controller[_0x3ebb('0x21')]);router[_0x3ebb('0x20')](_0x3ebb('0x22'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x3ebb('0x20')](_0x3ebb('0xe'),auth[_0x3ebb('0x9')](),controller[_0x3ebb('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x31f967,_0x2cb524,_0x5efdac){_0x5efdac(null,path[_0x3ebb('0x24')](config['root'],_0x3ebb('0x25')));},'filename':function(_0x28684e,_0x131b1f,_0x59a622){_0x59a622(null,util[_0x3ebb('0x26')](_0x3ebb('0x27'),Date[_0x3ebb('0x28')](),_0x131b1f[_0x3ebb('0x29')]));}})});router[_0x3ebb('0x20')]('/:id/logo',upload[_0x3ebb('0x2a')](_0x3ebb('0x2b')),controller[_0x3ebb('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x190f02,_0x352ce3,_0x232d48){_0x232d48(null,path[_0x3ebb('0x24')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x71095d,_0x45fc93,_0x308b8f){_0x308b8f(null,util[_0x3ebb('0x26')](_0x3ebb('0x27'),Date['now'](),_0x45fc93[_0x3ebb('0x29')]));}})});router[_0x3ebb('0x20')](_0x3ebb('0x10'),upload['single'](_0x3ebb('0x2b')),controller[_0x3ebb('0x2d')]);var upload=multer({'storage':multer[_0x3ebb('0x2e')]({'destination':function(_0x312081,_0x40a508,_0x1e778f){_0x1e778f(null,path[_0x3ebb('0x24')](config[_0x3ebb('0x2f')],'server/files/images/avatars/'));},'filename':function(_0x419d07,_0x4d8ce6,_0x28e25f){_0x28e25f(null,util[_0x3ebb('0x26')](_0x3ebb('0x27'),Date[_0x3ebb('0x28')](),_0x4d8ce6[_0x3ebb('0x29')]));}})});router[_0x3ebb('0x20')](_0x3ebb('0x12'),upload['single'](_0x3ebb('0x2b')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x3ebb('0x2e')]({'destination':function(_0x2f3a08,_0x1c8fda,_0x5122fb){_0x5122fb(null,path[_0x3ebb('0x24')](config[_0x3ebb('0x2f')],_0x3ebb('0x30')));},'filename':function(_0xd34f47,_0x208498,_0x6f39e1){_0x6f39e1(null,util[_0x3ebb('0x26')](_0x3ebb('0x27'),Date[_0x3ebb('0x28')](),_0x208498[_0x3ebb('0x29')]));}})});router[_0x3ebb('0x20')](_0x3ebb('0x14'),upload[_0x3ebb('0x2a')](_0x3ebb('0x2b')),controller[_0x3ebb('0x31')]);router[_0x3ebb('0x20')](_0x3ebb('0x32'),controller[_0x3ebb('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0x3ebb('0x2e')]({'destination':function(_0x1355db,_0x5c6efd,_0x3c7403){const _0x2a215e=path[_0x3ebb('0x24')](config[_0x3ebb('0x2f')],_0x3ebb('0x34'),'attachments',_0x3ebb('0x35'));fs_extra[_0x3ebb('0x36')](_0x2a215e,function(){_0x3c7403(null,_0x2a215e);});},'filename':function(_0x109724,_0x2955d4,_0x323425){const _0x19b151=_0x2955d4[_0x3ebb('0x29')][_0x3ebb('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4f98cf=path[_0x3ebb('0x38')](_0x19b151);const _0x242ce1=Date[_0x3ebb('0x28')]()+'-'+_0x19b151['replace'](_0x4f98cf,'')+_0x4f98cf;_0x323425(null,_0x242ce1);}})});router[_0x3ebb('0x20')](_0x3ebb('0x39'),offlineUploadMulter['any'](),controller[_0x3ebb('0x3a')]);router[_0x3ebb('0x20')](_0x3ebb('0x16'),auth[_0x3ebb('0x9')](),controller[_0x3ebb('0x3b')]);router[_0x3ebb('0x20')]('/:id/applications',auth['isAuthenticated'](),controller[_0x3ebb('0x3c')]);router[_0x3ebb('0x20')](_0x3ebb('0x3d'),auth['isAuthenticated'](),controller[_0x3ebb('0x3e')]);router[_0x3ebb('0x20')](_0x3ebb('0x1e'),auth[_0x3ebb('0x9')](),controller[_0x3ebb('0x3f')]);router['put']('/:id',auth[_0x3ebb('0x9')](),controller[_0x3ebb('0x40')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3ebb('0x41')]);router[_0x3ebb('0x42')]('/:id/dispositions',auth[_0x3ebb('0x9')](),controller[_0x3ebb('0x43')]);router[_0x3ebb('0x42')]('/:id/canned_answers',auth[_0x3ebb('0x9')](),controller[_0x3ebb('0x44')]);router[_0x3ebb('0x42')](_0x3ebb('0x1e'),auth['isAuthenticated'](),controller[_0x3ebb('0x45')]);module['exports']=router; \ No newline at end of file +var _0x1e6f=['notify','server/files','attachments','replace','extname','any','offline','addInteraction','/:id/proactive_actions','addProactiveActions','/:id/users','addAgents','put','delete','destroy','removeAnswers','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','join','root','server/files/images/logos/','%s-%s','now','originalname','single','addLogo','server/files/images/avatars/','/:id/avatar','file','addAvatar','diskStorage','format','addCustomerAvatar','/:id/notify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1e6f,0x16a));var _0xf1e6=function(_0xfcac4b,_0x51bad9){_0xfcac4b=_0xfcac4b-0x0;var _0x4d8306=_0x1e6f[_0xfcac4b];return _0x4d8306;};'use strict';var multer=require(_0xf1e6('0x0'));var util=require('util');var path=require(_0xf1e6('0x1'));var timeout=require(_0xf1e6('0x2'));var express=require(_0xf1e6('0x3'));var router=express['Router']();var fs_extra=require(_0xf1e6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf1e6('0x5'));var config=require(_0xf1e6('0x6'));var controller=require(_0xf1e6('0x7'));router[_0xf1e6('0x8')]('/',auth[_0xf1e6('0x9')](),controller[_0xf1e6('0xa')]);router[_0xf1e6('0x8')](_0xf1e6('0xb'),auth[_0xf1e6('0x9')](),controller[_0xf1e6('0xc')]);router[_0xf1e6('0x8')](_0xf1e6('0xd'),auth['isAuthenticated'](),controller[_0xf1e6('0xe')]);router[_0xf1e6('0x8')]('/:id/dispositions',auth[_0xf1e6('0x9')](),controller[_0xf1e6('0xf')]);router['get'](_0xf1e6('0x10'),auth[_0xf1e6('0x9')](),controller[_0xf1e6('0x11')]);router[_0xf1e6('0x8')](_0xf1e6('0x12'),controller[_0xf1e6('0x13')]);router[_0xf1e6('0x8')]('/:id/avatar',controller['getAvatar']);router[_0xf1e6('0x8')](_0xf1e6('0x14'),controller[_0xf1e6('0x15')]);router['get'](_0xf1e6('0x16'),controller[_0xf1e6('0x17')]);router[_0xf1e6('0x8')](_0xf1e6('0x18'),auth[_0xf1e6('0x9')](),controller[_0xf1e6('0x19')]);router[_0xf1e6('0x8')](_0xf1e6('0x1a'),controller['getSnippet']);router[_0xf1e6('0x8')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xf1e6('0x8')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['getProactiveActions']);router[_0xf1e6('0x8')]('/:id/fields',controller[_0xf1e6('0x1b')]);router[_0xf1e6('0x8')](_0xf1e6('0x1c'),auth[_0xf1e6('0x9')](),controller[_0xf1e6('0x1d')]);router[_0xf1e6('0x8')]('/:id/users',auth[_0xf1e6('0x9')](),controller[_0xf1e6('0x1e')]);router[_0xf1e6('0x1f')]('/',auth[_0xf1e6('0x9')](),controller[_0xf1e6('0x20')]);router[_0xf1e6('0x1f')](_0xf1e6('0x21'),auth[_0xf1e6('0x9')](),controller[_0xf1e6('0x22')]);router[_0xf1e6('0x1f')](_0xf1e6('0x10'),auth[_0xf1e6('0x9')](),controller[_0xf1e6('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5603b3,_0x2933bb,_0x4a2cc9){_0x4a2cc9(null,path[_0xf1e6('0x24')](config[_0xf1e6('0x25')],_0xf1e6('0x26')));},'filename':function(_0x47710e,_0x124b06,_0x447faa){_0x447faa(null,util['format'](_0xf1e6('0x27'),Date[_0xf1e6('0x28')](),_0x124b06[_0xf1e6('0x29')]));}})});router[_0xf1e6('0x1f')]('/:id/logo',upload[_0xf1e6('0x2a')]('file'),controller[_0xf1e6('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x362b24,_0x191941,_0x513900){_0x513900(null,path['join'](config[_0xf1e6('0x25')],_0xf1e6('0x2c')));},'filename':function(_0x138b4a,_0x164550,_0x21454b){_0x21454b(null,util['format']('%s-%s',Date[_0xf1e6('0x28')](),_0x164550[_0xf1e6('0x29')]));}})});router[_0xf1e6('0x1f')](_0xf1e6('0x2d'),upload[_0xf1e6('0x2a')](_0xf1e6('0x2e')),controller[_0xf1e6('0x2f')]);var upload=multer({'storage':multer[_0xf1e6('0x30')]({'destination':function(_0x396f6b,_0xb74149,_0x3850e8){_0x3850e8(null,path[_0xf1e6('0x24')](config[_0xf1e6('0x25')],_0xf1e6('0x2c')));},'filename':function(_0x45b303,_0x16fd79,_0x441733){_0x441733(null,util[_0xf1e6('0x31')](_0xf1e6('0x27'),Date[_0xf1e6('0x28')](),_0x16fd79[_0xf1e6('0x29')]));}})});router['post'](_0xf1e6('0x14'),upload['single'](_0xf1e6('0x2e')),controller[_0xf1e6('0x32')]);var upload=multer({'storage':multer[_0xf1e6('0x30')]({'destination':function(_0x2f4ba5,_0x280929,_0x3b9da5){_0x3b9da5(null,path[_0xf1e6('0x24')](config[_0xf1e6('0x25')],_0xf1e6('0x2c')));},'filename':function(_0x5f173c,_0x1dfc19,_0x4cadac){_0x4cadac(null,util['format'](_0xf1e6('0x27'),Date[_0xf1e6('0x28')](),_0x1dfc19[_0xf1e6('0x29')]));}})});router[_0xf1e6('0x1f')](_0xf1e6('0x16'),upload['single'](_0xf1e6('0x2e')),controller['addSystemAvatar']);router[_0xf1e6('0x1f')](_0xf1e6('0x33'),controller[_0xf1e6('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0xf1e6('0x30')]({'destination':function(_0x3276d1,_0xe46222,_0x363015){const _0x5c7157=path[_0xf1e6('0x24')](config[_0xf1e6('0x25')],_0xf1e6('0x35'),_0xf1e6('0x36'),'offline-chat');fs_extra['ensureDir'](_0x5c7157,function(){_0x363015(null,_0x5c7157);});},'filename':function(_0x3a2d42,_0x264ed9,_0x13ccaf){const _0x5c1102=_0x264ed9[_0xf1e6('0x29')][_0xf1e6('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x41ae8c=path[_0xf1e6('0x38')](_0x5c1102);const _0x386452=Date[_0xf1e6('0x28')]()+'-'+_0x5c1102['replace'](_0x41ae8c,'')+_0x41ae8c;_0x13ccaf(null,_0x386452);}})});router[_0xf1e6('0x1f')]('/:id/offline',offlineUploadMulter[_0xf1e6('0x39')](),controller[_0xf1e6('0x3a')]);router[_0xf1e6('0x1f')](_0xf1e6('0x18'),auth[_0xf1e6('0x9')](),controller[_0xf1e6('0x3b')]);router['post']('/:id/applications',auth[_0xf1e6('0x9')](),controller['addApplications']);router[_0xf1e6('0x1f')](_0xf1e6('0x3c'),auth[_0xf1e6('0x9')](),controller[_0xf1e6('0x3d')]);router[_0xf1e6('0x1f')](_0xf1e6('0x3e'),auth['isAuthenticated'](),controller[_0xf1e6('0x3f')]);router[_0xf1e6('0x40')](_0xf1e6('0xd'),auth[_0xf1e6('0x9')](),controller['update']);router[_0xf1e6('0x41')](_0xf1e6('0xd'),auth[_0xf1e6('0x9')](),controller[_0xf1e6('0x42')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xf1e6('0x41')](_0xf1e6('0x10'),auth['isAuthenticated'](),controller[_0xf1e6('0x43')]);router[_0xf1e6('0x41')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xf1e6('0x44')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index dc946ab..5c34072 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 _0x0d4d=['sequelize','exports','STRING','ENUM','AmazonAWS','Google'];(function(_0x3e6734,_0x2892d1){var _0x5c3d4c=function(_0x248d74){while(--_0x248d74){_0x3e6734['push'](_0x3e6734['shift']());}};_0x5c3d4c(++_0x2892d1);}(_0x0d4d,0x132));var _0xd0d4=function(_0x40f899,_0x4c4fc6){_0x40f899=_0x40f899-0x0;var _0x350c04=_0x0d4d[_0x40f899];return _0x350c04;};'use strict';var Sequelize=require(_0xd0d4('0x0'));module[_0xd0d4('0x1')]={'name':{'type':Sequelize[_0xd0d4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd0d4('0x3')](_0xd0d4('0x4'),_0xd0d4('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xd0d4('0x2')]}}; \ No newline at end of file +var _0x7ebb=['exports','STRING','ENUM','AmazonAWS','Google','sequelize'];(function(_0x1cd84f,_0x4d4c50){var _0x389c9f=function(_0x579762){while(--_0x579762){_0x1cd84f['push'](_0x1cd84f['shift']());}};_0x389c9f(++_0x4d4c50);}(_0x7ebb,0x161));var _0xb7eb=function(_0x48fec7,_0x30b839){_0x48fec7=_0x48fec7-0x0;var _0x4f43de=_0x7ebb[_0x48fec7];return _0x4f43de;};'use strict';var Sequelize=require(_0xb7eb('0x0'));module[_0xb7eb('0x1')]={'name':{'type':Sequelize[_0xb7eb('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb7eb('0x3')](_0xb7eb('0x4'),_0xb7eb('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xb7eb('0x2')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index bbcb248..44d51d5 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 _0x0b0e=['hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','CloudProvider','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length'];(function(_0x3aec55,_0x10de7d){var _0x5432b6=function(_0x41705d){while(--_0x41705d){_0x3aec55['push'](_0x3aec55['shift']());}};_0x5432b6(++_0x10de7d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x0b0e[_0x58efa6];return _0x5d643c;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['CloudProvider'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['CloudProvider'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['CloudProvider']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));}; \ No newline at end of file +var _0x5f66=['update','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','CloudProvider','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body'];(function(_0x2fa404,_0x494acd){var _0x11a987=function(_0x24cb00){while(--_0x24cb00){_0x2fa404['push'](_0x2fa404['shift']());}};_0x11a987(++_0x494acd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':!![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['CloudProvider'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index dbfd8bd..4a2e6ca 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 _0xac1c=['lodash','api','moment','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider'];(function(_0x461695,_0x4f6b44){var _0x49fb0a=function(_0x236215){while(--_0x236215){_0x461695['push'](_0x461695['shift']());}};_0x49fb0a(++_0x4f6b44);}(_0xac1c,0xa0));var _0xcac1=function(_0x404cde,_0x27b51c){_0x404cde=_0x404cde-0x0;var _0x139882=_0xac1c[_0x404cde];return _0x139882;};'use strict';var _=require(_0xcac1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcac1('0x1'));var moment=require(_0xcac1('0x2'));var BPromise=require(_0xcac1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcac1('0x4'));var rimraf=require(_0xcac1('0x5'));var config=require(_0xcac1('0x6'));var attributes=require(_0xcac1('0x7'));module['exports']=function(_0x334615,_0x27d0d7){return _0x334615[_0xcac1('0x8')](_0xcac1('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe01d=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','CloudProvider','cloud_providers','lodash'];(function(_0xbcb33c,_0x719e5f){var _0x25898d=function(_0x2caa3a){while(--_0x2caa3a){_0xbcb33c['push'](_0xbcb33c['shift']());}};_0x25898d(++_0x719e5f);}(_0xe01d,0x1c2));var _0xde01=function(_0x4a3ac9,_0x5d6809){_0x4a3ac9=_0x4a3ac9-0x0;var _0x4d7f5b=_0xe01d[_0x4a3ac9];return _0x4d7f5b;};'use strict';var _=require(_0xde01('0x0'));var util=require('util');var logger=require(_0xde01('0x1'))(_0xde01('0x2'));var moment=require(_0xde01('0x3'));var BPromise=require(_0xde01('0x4'));var rp=require(_0xde01('0x5'));var fs=require('fs');var path=require(_0xde01('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0xde01('0x7')]=function(_0x6b7a6a,_0x331de0){return _0x6b7a6a[_0xde01('0x8')](_0xde01('0x9'),attributes,{'tableName':_0xde01('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index c390cca..07a48a9 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 _0xc5df=['message','result','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x460788,_0x3002ff){var _0x44479f=function(_0x1b42de){while(--_0x1b42de){_0x460788['push'](_0x460788['shift']());}};_0x44479f(++_0x3002ff);}(_0xc5df,0x80));var _0xfc5d=function(_0x54441c,_0x63780d){_0x54441c=_0x54441c-0x0;var _0x52c304=_0xc5df[_0x54441c];return _0x52c304;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfc5d('0x0'));var BPromise=require(_0xfc5d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc5d('0x2'))['db'];var utils=require(_0xfc5d('0x3'));var logger=require(_0xfc5d('0x4'))(_0xfc5d('0x5'));var config=require(_0xfc5d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfc5d('0x7')][_0xfc5d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b8b10,_0x535aa7,_0x2a38ce){return new BPromise(function(_0x240ba0,_0x522712){return client[_0xfc5d('0x9')](_0x1b8b10,_0x2a38ce)[_0xfc5d('0xa')](function(_0x4f9a05){logger[_0xfc5d('0xb')](_0xfc5d('0xc'),_0x535aa7,'request\x20sent');logger[_0xfc5d('0xd')](_0xfc5d('0xe'),_0x535aa7,_0xfc5d('0xf'),JSON[_0xfc5d('0x10')](_0x4f9a05));if(_0x4f9a05['error']){if(_0x4f9a05[_0xfc5d('0x11')][_0xfc5d('0x12')]===0x1f4){logger[_0xfc5d('0x11')]('CloudProvider,\x20%s,\x20%s',_0x535aa7,_0x4f9a05[_0xfc5d('0x11')][_0xfc5d('0x13')]);return _0x522712(_0x4f9a05['error'][_0xfc5d('0x13')]);}logger['error'](_0xfc5d('0xc'),_0x535aa7,_0x4f9a05['error'][_0xfc5d('0x13')]);return _0x240ba0(_0x4f9a05[_0xfc5d('0x11')][_0xfc5d('0x13')]);}else{logger[_0xfc5d('0xb')](_0xfc5d('0xc'),_0x535aa7,'request\x20sent');_0x240ba0(_0x4f9a05[_0xfc5d('0x14')][_0xfc5d('0x13')]);}})['catch'](function(_0x26f84a){logger['error'](_0xfc5d('0xc'),_0x535aa7,_0x26f84a);_0x522712(_0x26f84a);});});} \ No newline at end of file +var _0xb5fb=['request','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x415f7e,_0x4630b6){var _0x311ff4=function(_0x19c19d){while(--_0x19c19d){_0x415f7e['push'](_0x415f7e['shift']());}};_0x311ff4(++_0x4630b6);}(_0xb5fb,0x172));var _0xbb5f=function(_0x14977c,_0x2c6d7e){_0x14977c=_0x14977c-0x0;var _0xafe01a=_0xb5fb[_0x14977c];return _0xafe01a;};'use strict';var _=require(_0xbb5f('0x0'));var util=require(_0xbb5f('0x1'));var moment=require(_0xbb5f('0x2'));var BPromise=require(_0xbb5f('0x3'));var rs=require(_0xbb5f('0x4'));var fs=require('fs');var Redis=require(_0xbb5f('0x5'));var db=require(_0xbb5f('0x6'))['db'];var utils=require(_0xbb5f('0x7'));var logger=require(_0xbb5f('0x8'))(_0xbb5f('0x9'));var config=require(_0xbb5f('0xa'));var jayson=require(_0xbb5f('0xb'));var client=jayson[_0xbb5f('0xc')][_0xbb5f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x487a1a,_0x597050,_0x317cd9){return new BPromise(function(_0x5e7943,_0x5b91){return client[_0xbb5f('0xe')](_0x487a1a,_0x317cd9)['then'](function(_0x4f13a9){logger[_0xbb5f('0xf')]('CloudProvider,\x20%s,\x20%s',_0x597050,_0xbb5f('0x10'));logger[_0xbb5f('0x11')](_0xbb5f('0x12'),_0x597050,_0xbb5f('0x10'),JSON[_0xbb5f('0x13')](_0x4f13a9));if(_0x4f13a9[_0xbb5f('0x14')]){if(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x15')]===0x1f4){logger['error'](_0xbb5f('0x16'),_0x597050,_0x4f13a9['error'][_0xbb5f('0x17')]);return _0x5b91(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x17')]);}logger['error'](_0xbb5f('0x16'),_0x597050,_0x4f13a9[_0xbb5f('0x14')]['message']);return _0x5e7943(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x17')]);}else{logger[_0xbb5f('0xf')](_0xbb5f('0x16'),_0x597050,'request\x20sent');_0x5e7943(_0x4f13a9['result'][_0xbb5f('0x17')]);}})['catch'](function(_0xdf4ec8){logger[_0xbb5f('0x14')]('CloudProvider,\x20%s,\x20%s',_0x597050,_0xdf4ec8);_0x5b91(_0xdf4ec8);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index bf571ac..819397e 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 _0x5b64=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0x5b64,0x16f));var _0x45b6=function(_0x19fd77,_0x38b0b6){_0x19fd77=_0x19fd77-0x0;var _0x1f4a0c=_0x5b64[_0x19fd77];return _0x1f4a0c;};'use strict';var multer=require(_0x45b6('0x0'));var util=require(_0x45b6('0x1'));var path=require('path');var timeout=require(_0x45b6('0x2'));var express=require('express');var router=express[_0x45b6('0x3')]();var fs_extra=require(_0x45b6('0x4'));var auth=require(_0x45b6('0x5'));var interaction=require(_0x45b6('0x6'));var config=require(_0x45b6('0x7'));var controller=require('./cloudProvider.controller');router[_0x45b6('0x8')]('/',auth[_0x45b6('0x9')](),controller[_0x45b6('0xa')]);router[_0x45b6('0x8')](_0x45b6('0xb'),auth['isAuthenticated'](),controller[_0x45b6('0xc')]);router['post']('/',auth[_0x45b6('0x9')](),controller[_0x45b6('0xd')]);router[_0x45b6('0xe')](_0x45b6('0xb'),auth[_0x45b6('0x9')](),controller[_0x45b6('0xf')]);router[_0x45b6('0x10')](_0x45b6('0xb'),auth[_0x45b6('0x9')](),controller[_0x45b6('0x11')]);module[_0x45b6('0x12')]=router; \ No newline at end of file +var _0x0df3=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','isAuthenticated','index','get','/:id','show','post','create','put','destroy','exports'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0x0df3,0x98));var _0x30df=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0x0df3[_0x2543d6];return _0x55213c;};'use strict';var multer=require(_0x30df('0x0'));var util=require('util');var path=require(_0x30df('0x1'));var timeout=require('connect-timeout');var express=require(_0x30df('0x2'));var router=express[_0x30df('0x3')]();var fs_extra=require(_0x30df('0x4'));var auth=require(_0x30df('0x5'));var interaction=require(_0x30df('0x6'));var config=require(_0x30df('0x7'));var controller=require(_0x30df('0x8'));router['get']('/',auth[_0x30df('0x9')](),controller[_0x30df('0xa')]);router[_0x30df('0xb')](_0x30df('0xc'),auth['isAuthenticated'](),controller[_0x30df('0xd')]);router[_0x30df('0xe')]('/',auth[_0x30df('0x9')](),controller[_0x30df('0xf')]);router[_0x30df('0x10')]('/:id',auth[_0x30df('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x30df('0x11')]);module[_0x30df('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index e9b97da..edafd11 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 _0x6068=['STRING','name','exports'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0x6068,0x134));var _0x8606=function(_0xfad5d6,_0x54322a){_0xfad5d6=_0xfad5d6-0x0;var _0x3135bf=_0x6068[_0xfad5d6];return _0x3135bf;};'use strict';var Sequelize=require('sequelize');module[_0x8606('0x0')]={'name':{'type':Sequelize[_0x8606('0x1')],'unique':_0x8606('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8606('0x1')]},'companyId':{'type':Sequelize[_0x8606('0x1')]},'website':{'type':Sequelize[_0x8606('0x1')]},'phone':{'type':Sequelize[_0x8606('0x1')]},'fax':{'type':Sequelize[_0x8606('0x1')]},'type':{'type':Sequelize[_0x8606('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x8606('0x1')]},'city':{'type':Sequelize[_0x8606('0x1')]},'country':{'type':Sequelize[_0x8606('0x1')]},'email':{'type':Sequelize[_0x8606('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8606('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x8606('0x1')]},'sCountry':{'type':Sequelize[_0x8606('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7bd3=['sequelize','exports','name','STRING'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0x7bd3,0x1d0));var _0x37bd=function(_0x33091a,_0x26bded){_0x33091a=_0x33091a-0x0;var _0x593c1b=_0x7bd3[_0x33091a];return _0x593c1b;};'use strict';var Sequelize=require(_0x37bd('0x0'));module[_0x37bd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x37bd('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x37bd('0x3')]},'companyId':{'type':Sequelize[_0x37bd('0x3')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x37bd('0x3')]},'type':{'type':Sequelize[_0x37bd('0x3')]},'street':{'type':Sequelize[_0x37bd('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x37bd('0x3')]},'email':{'type':Sequelize[_0x37bd('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x37bd('0x3')]},'sCity':{'type':Sequelize[_0x37bd('0x3')]},'sCountry':{'type':Sequelize[_0x37bd('0x3')]},'description':{'type':Sequelize[_0x37bd('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 5276975..01de456 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 _0x1cc1=['querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','name','send','index','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','filter','merge','options','CmCompany','includeAll','include','findAll','catch','show','rawAttributes','create','body','role','UserProfileSection','find','autoAssociation','error','params','addContacts','ids','getContacts','CmContact','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','jsforce','desk.js','to-csv'];(function(_0x118ed4,_0x2319b1){var _0x417b29=function(_0x1109a4){while(--_0x1109a4){_0x118ed4['push'](_0x118ed4['shift']());}};_0x417b29(++_0x2319b1);}(_0x1cc1,0xe1));var _0x11cc=function(_0x5222f5,_0x3f2dfe){_0x5222f5=_0x5222f5-0x0;var _0x4108d3=_0x1cc1[_0x5222f5];return _0x4108d3;};'use strict';var emlformat=require(_0x11cc('0x0'));var rimraf=require(_0x11cc('0x1'));var zipdir=require(_0x11cc('0x2'));var jsonpatch=require(_0x11cc('0x3'));var rp=require(_0x11cc('0x4'));var moment=require(_0x11cc('0x5'));var BPromise=require(_0x11cc('0x6'));var Mustache=require(_0x11cc('0x7'));var util=require(_0x11cc('0x8'));var path=require(_0x11cc('0x9'));var sox=require(_0x11cc('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11cc('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x11cc('0xc'));var deskjs=require(_0x11cc('0xd'));var toCsv=require(_0x11cc('0xe'));var querystring=require(_0x11cc('0xf'));var Papa=require('papaparse');var Redis=require(_0x11cc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x11cc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x11cc('0x12'))(_0x11cc('0x13'));var utils=require(_0x11cc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x11cc('0x15'));var db=require(_0x11cc('0x16'))['db'];function respondWithStatusCode(_0x218c90,_0x21ede9){_0x21ede9=_0x21ede9||0xcc;return function(_0x4b44ba){if(_0x4b44ba){return _0x218c90[_0x11cc('0x17')](_0x21ede9);}return _0x218c90[_0x11cc('0x18')](_0x21ede9)[_0x11cc('0x19')]();};}function respondWithResult(_0x52a8d6,_0x3650a0){_0x3650a0=_0x3650a0||0xc8;return function(_0x1cf7b7){if(_0x1cf7b7){return _0x52a8d6[_0x11cc('0x18')](_0x3650a0)[_0x11cc('0x1a')](_0x1cf7b7);}};}function respondWithFilteredResult(_0x54cd27,_0x59484){return function(_0x1e1e78){if(_0x1e1e78){var _0x333837=typeof _0x59484['offset']===_0x11cc('0x1b')&&typeof _0x59484['limit']==='undefined';var _0x3863c8=_0x1e1e78['count'];var _0x5523a5=_0x333837?0x0:_0x59484[_0x11cc('0x1c')];var _0x546540=_0x333837?_0x1e1e78[_0x11cc('0x1d')]:_0x59484[_0x11cc('0x1c')]+_0x59484['limit'];var _0x313fa0;if(_0x546540>=_0x3863c8){_0x546540=_0x3863c8;_0x313fa0=0xc8;}else{_0x313fa0=0xce;}_0x54cd27[_0x11cc('0x18')](_0x313fa0);return _0x54cd27[_0x11cc('0x1e')](_0x11cc('0x1f'),_0x5523a5+'-'+_0x546540+'/'+_0x3863c8)['json'](_0x1e1e78);}return null;};}function patchUpdates(_0x142c7){return function(_0x6dd623){try{jsonpatch['apply'](_0x6dd623,_0x142c7,!![]);}catch(_0x702d6){return BPromise[_0x11cc('0x20')](_0x702d6);}return _0x6dd623[_0x11cc('0x21')]();};}function saveUpdates(_0x11c8a1,_0x2e9e48){return function(_0x1581a1){if(_0x1581a1){return _0x1581a1[_0x11cc('0x22')](_0x11c8a1)[_0x11cc('0x23')](function(_0x3896e3){return _0x3896e3;});}return null;};}function removeEntity(_0x22b777,_0x3fb9f8){return function(_0x455252){if(_0x455252){return _0x455252['destroy']()[_0x11cc('0x23')](function(){var _0x228f72=_0x455252[_0x11cc('0x24')]({'plain':!![]});var _0x53f05b='Companies';return db[_0x11cc('0x25')][_0x11cc('0x26')]({'where':{'type':_0x53f05b,'resourceId':_0x228f72['id']}})['then'](function(){return _0x455252;});})[_0x11cc('0x23')](function(){_0x22b777['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x305faa,_0x591155){return function(_0x2381c3){if(!_0x2381c3){_0x305faa['sendStatus'](0x194);}return _0x2381c3;};}function handleError(_0x319eb4,_0x1b7c9b){_0x1b7c9b=_0x1b7c9b||0x1f4;return function(_0x5d03e9){logger['error'](_0x5d03e9['stack']);if(_0x5d03e9[_0x11cc('0x27')]){delete _0x5d03e9[_0x11cc('0x27')];}_0x319eb4[_0x11cc('0x18')](_0x1b7c9b)[_0x11cc('0x28')](_0x5d03e9);};}exports[_0x11cc('0x29')]=function(_0x44aeb7,_0x197c1d){var _0x3355a4={},_0x4d9eb0={},_0x3138d3={'count':0x0,'rows':[]};return db['CmCompany'][_0x11cc('0x2a')]()[_0x11cc('0x23')](function(_0x941073){_0x4d9eb0[_0x11cc('0x2b')]=_[_0x11cc('0x2c')](_0x941073);_0x4d9eb0[_0x11cc('0x2d')]=_['keys'](_0x44aeb7[_0x11cc('0x2d')]);_0x4d9eb0['filters']=_[_0x11cc('0x2e')](_0x4d9eb0[_0x11cc('0x2b')],_0x4d9eb0[_0x11cc('0x2d')]);_0x3355a4[_0x11cc('0x2f')]=_[_0x11cc('0x2e')](_0x4d9eb0['model'],qs[_0x11cc('0x30')](_0x44aeb7[_0x11cc('0x2d')][_0x11cc('0x30')]));_0x3355a4['attributes']=_0x3355a4[_0x11cc('0x2f')][_0x11cc('0x31')]?_0x3355a4[_0x11cc('0x2f')]:_0x4d9eb0[_0x11cc('0x2b')];if(!_0x44aeb7[_0x11cc('0x2d')][_0x11cc('0x32')](_0x11cc('0x33'))){_0x3355a4[_0x11cc('0x34')]=qs[_0x11cc('0x34')](_0x44aeb7['query'][_0x11cc('0x34')]);_0x3355a4[_0x11cc('0x1c')]=qs['offset'](_0x44aeb7[_0x11cc('0x2d')][_0x11cc('0x1c')]);}_0x3355a4['order']=qs[_0x11cc('0x35')](_0x44aeb7['query'][_0x11cc('0x35')]);_0x3355a4[_0x11cc('0x36')]=qs['filters'](_[_0x11cc('0x37')](_0x44aeb7[_0x11cc('0x2d')],_0x4d9eb0[_0x11cc('0x38')]),_0x941073);if(_0x44aeb7[_0x11cc('0x2d')][_0x11cc('0x39')]){_0x3355a4['where']=_[_0x11cc('0x3a')](_0x3355a4['where'],{'$or':_['map'](_0x3355a4[_0x11cc('0x2f')],function(_0x5f1181){var _0x3fca35={};_0x3fca35[_0x5f1181]={'$like':'%'+_0x44aeb7[_0x11cc('0x2d')]['filter']+'%'};return _0x3fca35;})});}_0x3355a4=_[_0x11cc('0x3a')]({},_0x3355a4,_0x44aeb7[_0x11cc('0x3b')]);var _0x3257c5={'where':_0x3355a4[_0x11cc('0x36')]};return db[_0x11cc('0x3c')][_0x11cc('0x1d')](_0x3257c5)[_0x11cc('0x23')](function(_0x4ccdff){_0x3138d3[_0x11cc('0x1d')]=_0x4ccdff;if(_0x44aeb7[_0x11cc('0x2d')][_0x11cc('0x3d')]){_0x3355a4[_0x11cc('0x3e')]=[{'all':!![]}];}return db[_0x11cc('0x3c')][_0x11cc('0x3f')](_0x3355a4);})[_0x11cc('0x23')](function(_0x22e52e){_0x3138d3['rows']=_0x22e52e;return _0x3138d3;})[_0x11cc('0x23')](respondWithFilteredResult(_0x197c1d,_0x3355a4))[_0x11cc('0x40')](handleError(_0x197c1d,null));})[_0x11cc('0x40')](handleError(_0x197c1d,null));};exports[_0x11cc('0x41')]=function(_0x35f4c3,_0x745196){var _0x10f10b={'raw':![],'where':{'id':_0x35f4c3['params']['id']}},_0xd029cf={};_0xd029cf[_0x11cc('0x2b')]=_['keys'](db[_0x11cc('0x3c')][_0x11cc('0x42')]);_0xd029cf[_0x11cc('0x2d')]=_[_0x11cc('0x2c')](_0x35f4c3[_0x11cc('0x2d')]);_0xd029cf['filters']=_[_0x11cc('0x2e')](_0xd029cf[_0x11cc('0x2b')],_0xd029cf['query']);_0x10f10b['attributes']=_[_0x11cc('0x2e')](_0xd029cf[_0x11cc('0x2b')],qs[_0x11cc('0x30')](_0x35f4c3[_0x11cc('0x2d')][_0x11cc('0x30')]));_0x10f10b[_0x11cc('0x2f')]=_0x10f10b[_0x11cc('0x2f')][_0x11cc('0x31')]?_0x10f10b[_0x11cc('0x2f')]:_0xd029cf[_0x11cc('0x2b')];if(_0x35f4c3[_0x11cc('0x2d')][_0x11cc('0x3d')]){_0x10f10b[_0x11cc('0x3e')]=[{'all':!![]}];}_0x10f10b=_[_0x11cc('0x3a')]({},_0x10f10b,_0x35f4c3[_0x11cc('0x3b')]);return db['CmCompany']['find'](_0x10f10b)[_0x11cc('0x23')](handleEntityNotFound(_0x745196,null))[_0x11cc('0x23')](respondWithResult(_0x745196,null))[_0x11cc('0x40')](handleError(_0x745196,null));};exports['create']=function(_0x1c96ea,_0x295aa4){return db[_0x11cc('0x3c')][_0x11cc('0x43')](_0x1c96ea[_0x11cc('0x44')],{})[_0x11cc('0x23')](function(_0x5bad74){var _0x200c71=_0x1c96ea['user']['get']({'plain':!![]});if(!_0x200c71)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x200c71[_0x11cc('0x45')]==='user'){var _0x2bb378=_0x5bad74[_0x11cc('0x24')]({'plain':!![]});var _0x2c775b='Companies';return db[_0x11cc('0x46')][_0x11cc('0x47')]({'where':{'name':_0x2c775b,'userProfileId':_0x200c71['userProfileId']},'raw':!![]})[_0x11cc('0x23')](function(_0x43818e){if(_0x43818e&&_0x43818e[_0x11cc('0x48')]===0x0){return db[_0x11cc('0x25')][_0x11cc('0x43')]({'name':_0x2bb378[_0x11cc('0x27')],'resourceId':_0x2bb378['id'],'type':_0x43818e[_0x11cc('0x27')],'sectionId':_0x43818e['id']},{})[_0x11cc('0x23')](function(){return _0x5bad74;});}else{return _0x5bad74;}})[_0x11cc('0x40')](function(_0x4664f5){logger[_0x11cc('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4664f5);throw _0x4664f5;});}return _0x5bad74;})[_0x11cc('0x23')](respondWithResult(_0x295aa4,0xc9))[_0x11cc('0x40')](handleError(_0x295aa4,null));};exports[_0x11cc('0x22')]=function(_0x253b8f,_0xe29f8a){if(_0x253b8f[_0x11cc('0x44')]['id']){delete _0x253b8f[_0x11cc('0x44')]['id'];}return db[_0x11cc('0x3c')][_0x11cc('0x47')]({'where':{'id':_0x253b8f[_0x11cc('0x4a')]['id']}})[_0x11cc('0x23')](handleEntityNotFound(_0xe29f8a,null))[_0x11cc('0x23')](saveUpdates(_0x253b8f[_0x11cc('0x44')],null))['then'](respondWithResult(_0xe29f8a,null))['catch'](handleError(_0xe29f8a,null));};exports[_0x11cc('0x26')]=function(_0x86f85f,_0x334f77){return db[_0x11cc('0x3c')]['find']({'where':{'id':_0x86f85f[_0x11cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x334f77,null))['then'](removeEntity(_0x334f77,null))[_0x11cc('0x40')](handleError(_0x334f77,null));};exports['describe']=function(_0x4e0018,_0x4082c9){return db['CmCompany'][_0x11cc('0x2a')]()[_0x11cc('0x23')](respondWithResult(_0x4082c9,null))[_0x11cc('0x40')](handleError(_0x4082c9,null));};exports[_0x11cc('0x4b')]=function(_0x23e8b8,_0x28f4ac,_0x46e4f6){return db['CmContact'][_0x11cc('0x47')]({'where':{'id':_0x23e8b8['params']['id']}})['then'](handleEntityNotFound(_0x28f4ac,null))['then'](function(_0x3f5806){if(_0x3f5806){return _0x3f5806[_0x11cc('0x4b')](_0x23e8b8['body'][_0x11cc('0x4c')],_['omit'](_0x23e8b8[_0x11cc('0x44')],[_0x11cc('0x4c'),'id'])||{});}})[_0x11cc('0x23')](respondWithResult(_0x28f4ac,null))['catch'](handleError(_0x28f4ac,null));};exports[_0x11cc('0x4d')]=function(_0x451f07,_0x36e516,_0x21ef05){var _0x3ec689={};var _0x3c59c1={};var _0x458b91;var _0x394bb3;return db[_0x11cc('0x3c')]['findOne']({'where':{'id':_0x451f07[_0x11cc('0x4a')]['id']}})[_0x11cc('0x23')](handleEntityNotFound(_0x36e516,null))[_0x11cc('0x23')](function(_0x425204){if(_0x425204){_0x458b91=_0x425204;_0x3c59c1[_0x11cc('0x2b')]=_['keys'](db[_0x11cc('0x4e')][_0x11cc('0x42')]);_0x3c59c1['query']=_[_0x11cc('0x2c')](_0x451f07[_0x11cc('0x2d')]);_0x3c59c1[_0x11cc('0x38')]=_[_0x11cc('0x2e')](_0x3c59c1['model'],_0x3c59c1[_0x11cc('0x2d')]);_0x3ec689[_0x11cc('0x2f')]=_['intersection'](_0x3c59c1[_0x11cc('0x2b')],qs[_0x11cc('0x30')](_0x451f07[_0x11cc('0x2d')][_0x11cc('0x30')]));_0x3ec689[_0x11cc('0x2f')]=_0x3ec689[_0x11cc('0x2f')][_0x11cc('0x31')]?_0x3ec689['attributes']:_0x3c59c1[_0x11cc('0x2b')];_0x3ec689['order']=qs[_0x11cc('0x35')](_0x451f07[_0x11cc('0x2d')][_0x11cc('0x35')]);_0x3ec689['where']=qs[_0x11cc('0x38')](_[_0x11cc('0x37')](_0x451f07['query'],_0x3c59c1[_0x11cc('0x38')]));if(_0x451f07[_0x11cc('0x2d')]['filter']){_0x3ec689['where']=_[_0x11cc('0x3a')](_0x3ec689[_0x11cc('0x36')],{'$or':_[_0x11cc('0x4f')](_0x3ec689[_0x11cc('0x2f')],function(_0x16324c){var _0x1e8314={};_0x1e8314[_0x16324c]={'$like':'%'+_0x451f07[_0x11cc('0x2d')][_0x11cc('0x39')]+'%'};return _0x1e8314;})});}_0x3ec689=_['merge']({},_0x3ec689,_0x451f07[_0x11cc('0x3b')]);return _0x458b91[_0x11cc('0x4d')](_0x3ec689);}})[_0x11cc('0x23')](function(_0x4b9973){if(_0x4b9973){_0x394bb3=_0x4b9973[_0x11cc('0x31')];if(!_0x451f07[_0x11cc('0x2d')]['hasOwnProperty']('nolimit')){_0x3ec689[_0x11cc('0x34')]=qs[_0x11cc('0x34')](_0x451f07[_0x11cc('0x2d')][_0x11cc('0x34')]);_0x3ec689[_0x11cc('0x1c')]=qs[_0x11cc('0x1c')](_0x451f07['query'][_0x11cc('0x1c')]);}return _0x458b91[_0x11cc('0x4d')](_0x3ec689);}})['then'](function(_0x11246f){if(_0x11246f){return _0x11246f?{'count':_0x394bb3,'rows':_0x11246f}:null;}})[_0x11cc('0x23')](respondWithResult(_0x36e516,null))[_0x11cc('0x40')](handleError(_0x36e516,null));}; \ No newline at end of file +var _0x6bc5=['set','reject','save','update','then','destroy','get','Companies','UserProfileResource','end','error','name','send','describe','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','merge','CmCompany','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','omit','ids','getContacts','findOne','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit','count'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0x6bc5,0x194));var _0x56bc=function(_0x5f23f6,_0x13522a){_0x5f23f6=_0x5f23f6-0x0;var _0x4ab463=_0x6bc5[_0x5f23f6];return _0x4ab463;};'use strict';var emlformat=require(_0x56bc('0x0'));var rimraf=require(_0x56bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x56bc('0x2'));var rp=require(_0x56bc('0x3'));var moment=require('moment');var BPromise=require(_0x56bc('0x4'));var Mustache=require(_0x56bc('0x5'));var util=require('util');var path=require(_0x56bc('0x6'));var sox=require('sox');var csv=require(_0x56bc('0x7'));var ejs=require(_0x56bc('0x8'));var fs=require('fs');var fs_extra=require(_0x56bc('0x9'));var _=require(_0x56bc('0xa'));var squel=require(_0x56bc('0xb'));var crypto=require(_0x56bc('0xc'));var jsforce=require(_0x56bc('0xd'));var deskjs=require(_0x56bc('0xe'));var toCsv=require(_0x56bc('0x7'));var querystring=require('querystring');var Papa=require(_0x56bc('0xf'));var Redis=require(_0x56bc('0x10'));var authService=require(_0x56bc('0x11'));var qs=require(_0x56bc('0x12'));var as=require(_0x56bc('0x13'));var hardwareService=require(_0x56bc('0x14'));var logger=require(_0x56bc('0x15'))(_0x56bc('0x16'));var utils=require(_0x56bc('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x56bc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc91b3e,_0x1a8591){_0x1a8591=_0x1a8591||0xcc;return function(_0x32870b){if(_0x32870b){return _0xc91b3e[_0x56bc('0x19')](_0x1a8591);}return _0xc91b3e[_0x56bc('0x1a')](_0x1a8591)['end']();};}function respondWithResult(_0x10089a,_0x46b5e6){_0x46b5e6=_0x46b5e6||0xc8;return function(_0x484c47){if(_0x484c47){return _0x10089a['status'](_0x46b5e6)['json'](_0x484c47);}};}function respondWithFilteredResult(_0x538302,_0x17bf4a){return function(_0x307bc9){if(_0x307bc9){var _0x445f9f=typeof _0x17bf4a[_0x56bc('0x1b')]===_0x56bc('0x1c')&&typeof _0x17bf4a[_0x56bc('0x1d')]===_0x56bc('0x1c');var _0x54e226=_0x307bc9[_0x56bc('0x1e')];var _0x526741=_0x445f9f?0x0:_0x17bf4a[_0x56bc('0x1b')];var _0x42ec7d=_0x445f9f?_0x307bc9['count']:_0x17bf4a[_0x56bc('0x1b')]+_0x17bf4a[_0x56bc('0x1d')];var _0x401871;if(_0x42ec7d>=_0x54e226){_0x42ec7d=_0x54e226;_0x401871=0xc8;}else{_0x401871=0xce;}_0x538302['status'](_0x401871);return _0x538302[_0x56bc('0x1f')]('Content-Range',_0x526741+'-'+_0x42ec7d+'/'+_0x54e226)['json'](_0x307bc9);}return null;};}function patchUpdates(_0x1f0a7e){return function(_0x1f31d2){try{jsonpatch['apply'](_0x1f31d2,_0x1f0a7e,!![]);}catch(_0x3edc95){return BPromise[_0x56bc('0x20')](_0x3edc95);}return _0x1f31d2[_0x56bc('0x21')]();};}function saveUpdates(_0x331e44,_0x5ac146){return function(_0x5603be){if(_0x5603be){return _0x5603be[_0x56bc('0x22')](_0x331e44)[_0x56bc('0x23')](function(_0x29b5b6){return _0x29b5b6;});}return null;};}function removeEntity(_0x33fbe8,_0x586c56){return function(_0x4b1bf4){if(_0x4b1bf4){return _0x4b1bf4[_0x56bc('0x24')]()[_0x56bc('0x23')](function(){var _0x4f5169=_0x4b1bf4[_0x56bc('0x25')]({'plain':!![]});var _0x1cf72e=_0x56bc('0x26');return db[_0x56bc('0x27')][_0x56bc('0x24')]({'where':{'type':_0x1cf72e,'resourceId':_0x4f5169['id']}})[_0x56bc('0x23')](function(){return _0x4b1bf4;});})[_0x56bc('0x23')](function(){_0x33fbe8[_0x56bc('0x1a')](0xcc)[_0x56bc('0x28')]();});}};}function handleEntityNotFound(_0x3de4d8,_0x273a36){return function(_0x518269){if(!_0x518269){_0x3de4d8['sendStatus'](0x194);}return _0x518269;};}function handleError(_0x33294c,_0x1b9b79){_0x1b9b79=_0x1b9b79||0x1f4;return function(_0x25f756){logger[_0x56bc('0x29')](_0x25f756['stack']);if(_0x25f756[_0x56bc('0x2a')]){delete _0x25f756[_0x56bc('0x2a')];}_0x33294c[_0x56bc('0x1a')](_0x1b9b79)[_0x56bc('0x2b')](_0x25f756);};}exports['index']=function(_0x5d255c,_0x2b99bd){var _0xbb46f0={},_0x38e307={},_0x56e2dd={'count':0x0,'rows':[]};return db['CmCompany'][_0x56bc('0x2c')]()[_0x56bc('0x23')](function(_0x5dc4dc){_0x38e307['model']=_[_0x56bc('0x2d')](_0x5dc4dc);_0x38e307[_0x56bc('0x2e')]=_[_0x56bc('0x2d')](_0x5d255c[_0x56bc('0x2e')]);_0x38e307[_0x56bc('0x2f')]=_[_0x56bc('0x30')](_0x38e307[_0x56bc('0x31')],_0x38e307[_0x56bc('0x2e')]);_0xbb46f0[_0x56bc('0x32')]=_[_0x56bc('0x30')](_0x38e307[_0x56bc('0x31')],qs[_0x56bc('0x33')](_0x5d255c['query'][_0x56bc('0x33')]));_0xbb46f0[_0x56bc('0x32')]=_0xbb46f0[_0x56bc('0x32')][_0x56bc('0x34')]?_0xbb46f0[_0x56bc('0x32')]:_0x38e307[_0x56bc('0x31')];if(!_0x5d255c[_0x56bc('0x2e')][_0x56bc('0x35')](_0x56bc('0x36'))){_0xbb46f0['limit']=qs[_0x56bc('0x1d')](_0x5d255c[_0x56bc('0x2e')][_0x56bc('0x1d')]);_0xbb46f0[_0x56bc('0x1b')]=qs[_0x56bc('0x1b')](_0x5d255c[_0x56bc('0x2e')][_0x56bc('0x1b')]);}_0xbb46f0[_0x56bc('0x37')]=qs[_0x56bc('0x38')](_0x5d255c['query'][_0x56bc('0x38')]);_0xbb46f0['where']=qs[_0x56bc('0x2f')](_[_0x56bc('0x39')](_0x5d255c[_0x56bc('0x2e')],_0x38e307[_0x56bc('0x2f')]),_0x5dc4dc);if(_0x5d255c[_0x56bc('0x2e')][_0x56bc('0x3a')]){_0xbb46f0[_0x56bc('0x3b')]=_['merge'](_0xbb46f0[_0x56bc('0x3b')],{'$or':_[_0x56bc('0x3c')](_0xbb46f0[_0x56bc('0x32')],function(_0x14979a){var _0x254bb9={};_0x254bb9[_0x14979a]={'$like':'%'+_0x5d255c[_0x56bc('0x2e')]['filter']+'%'};return _0x254bb9;})});}_0xbb46f0=_[_0x56bc('0x3d')]({},_0xbb46f0,_0x5d255c['options']);var _0x5d7205={'where':_0xbb46f0[_0x56bc('0x3b')]};return db[_0x56bc('0x3e')][_0x56bc('0x1e')](_0x5d7205)['then'](function(_0x1ac861){_0x56e2dd[_0x56bc('0x1e')]=_0x1ac861;if(_0x5d255c[_0x56bc('0x2e')][_0x56bc('0x3f')]){_0xbb46f0[_0x56bc('0x40')]=[{'all':!![]}];}return db[_0x56bc('0x3e')][_0x56bc('0x41')](_0xbb46f0);})[_0x56bc('0x23')](function(_0x4b2c72){_0x56e2dd[_0x56bc('0x42')]=_0x4b2c72;return _0x56e2dd;})[_0x56bc('0x23')](respondWithFilteredResult(_0x2b99bd,_0xbb46f0))[_0x56bc('0x43')](handleError(_0x2b99bd,null));})[_0x56bc('0x43')](handleError(_0x2b99bd,null));};exports[_0x56bc('0x44')]=function(_0x2c5a7f,_0x39b51a){var _0x2e95e8={'raw':![],'where':{'id':_0x2c5a7f[_0x56bc('0x45')]['id']}},_0x1fe910={};_0x1fe910[_0x56bc('0x31')]=_[_0x56bc('0x2d')](db[_0x56bc('0x3e')][_0x56bc('0x46')]);_0x1fe910[_0x56bc('0x2e')]=_[_0x56bc('0x2d')](_0x2c5a7f[_0x56bc('0x2e')]);_0x1fe910[_0x56bc('0x2f')]=_[_0x56bc('0x30')](_0x1fe910[_0x56bc('0x31')],_0x1fe910[_0x56bc('0x2e')]);_0x2e95e8[_0x56bc('0x32')]=_['intersection'](_0x1fe910['model'],qs[_0x56bc('0x33')](_0x2c5a7f['query'][_0x56bc('0x33')]));_0x2e95e8[_0x56bc('0x32')]=_0x2e95e8[_0x56bc('0x32')]['length']?_0x2e95e8['attributes']:_0x1fe910[_0x56bc('0x31')];if(_0x2c5a7f[_0x56bc('0x2e')]['includeAll']){_0x2e95e8['include']=[{'all':!![]}];}_0x2e95e8=_['merge']({},_0x2e95e8,_0x2c5a7f[_0x56bc('0x47')]);return db[_0x56bc('0x3e')]['find'](_0x2e95e8)[_0x56bc('0x23')](handleEntityNotFound(_0x39b51a,null))[_0x56bc('0x23')](respondWithResult(_0x39b51a,null))[_0x56bc('0x43')](handleError(_0x39b51a,null));};exports['create']=function(_0x3ddc13,_0x51a150){return db[_0x56bc('0x3e')][_0x56bc('0x48')](_0x3ddc13[_0x56bc('0x49')],{})[_0x56bc('0x23')](function(_0x25ab59){var _0x215013=_0x3ddc13[_0x56bc('0x4a')][_0x56bc('0x25')]({'plain':!![]});if(!_0x215013)throw new Error(_0x56bc('0x4b'));if(_0x215013['role']==='user'){var _0x265817=_0x25ab59[_0x56bc('0x25')]({'plain':!![]});var _0x3ed139=_0x56bc('0x26');return db[_0x56bc('0x4c')][_0x56bc('0x4d')]({'where':{'name':_0x3ed139,'userProfileId':_0x215013[_0x56bc('0x4e')]},'raw':!![]})['then'](function(_0x5af578){if(_0x5af578&&_0x5af578[_0x56bc('0x4f')]===0x0){return db[_0x56bc('0x27')][_0x56bc('0x48')]({'name':_0x265817[_0x56bc('0x2a')],'resourceId':_0x265817['id'],'type':_0x5af578[_0x56bc('0x2a')],'sectionId':_0x5af578['id']},{})[_0x56bc('0x23')](function(){return _0x25ab59;});}else{return _0x25ab59;}})[_0x56bc('0x43')](function(_0x40f9a7){logger[_0x56bc('0x29')](_0x56bc('0x50'),_0x40f9a7);throw _0x40f9a7;});}return _0x25ab59;})[_0x56bc('0x23')](respondWithResult(_0x51a150,0xc9))[_0x56bc('0x43')](handleError(_0x51a150,null));};exports[_0x56bc('0x22')]=function(_0x5f1ad6,_0x1c8a8a){if(_0x5f1ad6['body']['id']){delete _0x5f1ad6[_0x56bc('0x49')]['id'];}return db[_0x56bc('0x3e')]['find']({'where':{'id':_0x5f1ad6[_0x56bc('0x45')]['id']}})[_0x56bc('0x23')](handleEntityNotFound(_0x1c8a8a,null))[_0x56bc('0x23')](saveUpdates(_0x5f1ad6[_0x56bc('0x49')],null))['then'](respondWithResult(_0x1c8a8a,null))['catch'](handleError(_0x1c8a8a,null));};exports[_0x56bc('0x24')]=function(_0x1cd14f,_0x5d864e){return db['CmCompany']['find']({'where':{'id':_0x1cd14f[_0x56bc('0x45')]['id']}})[_0x56bc('0x23')](handleEntityNotFound(_0x5d864e,null))[_0x56bc('0x23')](removeEntity(_0x5d864e,null))[_0x56bc('0x43')](handleError(_0x5d864e,null));};exports[_0x56bc('0x2c')]=function(_0x20188d,_0x30f2fd){return db[_0x56bc('0x3e')][_0x56bc('0x2c')]()['then'](respondWithResult(_0x30f2fd,null))[_0x56bc('0x43')](handleError(_0x30f2fd,null));};exports[_0x56bc('0x51')]=function(_0xdee0cb,_0x5d7533,_0x393bde){return db[_0x56bc('0x52')]['find']({'where':{'id':_0xdee0cb[_0x56bc('0x45')]['id']}})[_0x56bc('0x23')](handleEntityNotFound(_0x5d7533,null))[_0x56bc('0x23')](function(_0x1fb9c5){if(_0x1fb9c5){return _0x1fb9c5['addContacts'](_0xdee0cb[_0x56bc('0x49')]['ids'],_[_0x56bc('0x53')](_0xdee0cb[_0x56bc('0x49')],[_0x56bc('0x54'),'id'])||{});}})[_0x56bc('0x23')](respondWithResult(_0x5d7533,null))[_0x56bc('0x43')](handleError(_0x5d7533,null));};exports[_0x56bc('0x55')]=function(_0x1c4208,_0x5d29b7,_0x487587){var _0xe7a182={};var _0xd15f3b={};var _0x560244;var _0x4361aa;return db[_0x56bc('0x3e')][_0x56bc('0x56')]({'where':{'id':_0x1c4208[_0x56bc('0x45')]['id']}})[_0x56bc('0x23')](handleEntityNotFound(_0x5d29b7,null))['then'](function(_0x202fde){if(_0x202fde){_0x560244=_0x202fde;_0xd15f3b[_0x56bc('0x31')]=_[_0x56bc('0x2d')](db['CmContact'][_0x56bc('0x46')]);_0xd15f3b[_0x56bc('0x2e')]=_[_0x56bc('0x2d')](_0x1c4208[_0x56bc('0x2e')]);_0xd15f3b[_0x56bc('0x2f')]=_[_0x56bc('0x30')](_0xd15f3b['model'],_0xd15f3b[_0x56bc('0x2e')]);_0xe7a182[_0x56bc('0x32')]=_['intersection'](_0xd15f3b[_0x56bc('0x31')],qs[_0x56bc('0x33')](_0x1c4208[_0x56bc('0x2e')][_0x56bc('0x33')]));_0xe7a182['attributes']=_0xe7a182[_0x56bc('0x32')][_0x56bc('0x34')]?_0xe7a182[_0x56bc('0x32')]:_0xd15f3b[_0x56bc('0x31')];_0xe7a182[_0x56bc('0x37')]=qs[_0x56bc('0x38')](_0x1c4208['query']['sort']);_0xe7a182[_0x56bc('0x3b')]=qs['filters'](_['pick'](_0x1c4208['query'],_0xd15f3b[_0x56bc('0x2f')]));if(_0x1c4208[_0x56bc('0x2e')][_0x56bc('0x3a')]){_0xe7a182['where']=_['merge'](_0xe7a182[_0x56bc('0x3b')],{'$or':_[_0x56bc('0x3c')](_0xe7a182[_0x56bc('0x32')],function(_0x5350de){var _0x44d569={};_0x44d569[_0x5350de]={'$like':'%'+_0x1c4208[_0x56bc('0x2e')][_0x56bc('0x3a')]+'%'};return _0x44d569;})});}_0xe7a182=_[_0x56bc('0x3d')]({},_0xe7a182,_0x1c4208[_0x56bc('0x47')]);return _0x560244[_0x56bc('0x55')](_0xe7a182);}})['then'](function(_0x4c2fe2){if(_0x4c2fe2){_0x4361aa=_0x4c2fe2[_0x56bc('0x34')];if(!_0x1c4208[_0x56bc('0x2e')][_0x56bc('0x35')](_0x56bc('0x36'))){_0xe7a182['limit']=qs[_0x56bc('0x1d')](_0x1c4208[_0x56bc('0x2e')][_0x56bc('0x1d')]);_0xe7a182[_0x56bc('0x1b')]=qs[_0x56bc('0x1b')](_0x1c4208[_0x56bc('0x2e')][_0x56bc('0x1b')]);}return _0x560244['getContacts'](_0xe7a182);}})[_0x56bc('0x23')](function(_0x524250){if(_0x524250){return _0x524250?{'count':_0x4361aa,'rows':_0x524250}:null;}})[_0x56bc('0x23')](respondWithResult(_0x5d29b7,null))['catch'](handleError(_0x5d29b7,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index e01933f..144def0 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 _0x346d=['cm_companies','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x1a7ae3,_0x2727b9){var _0x4d8d56=function(_0x4a5537){while(--_0x4a5537){_0x1a7ae3['push'](_0x1a7ae3['shift']());}};_0x4d8d56(++_0x2727b9);}(_0x346d,0xa1));var _0xd346=function(_0x465c0b,_0x19197d){_0x465c0b=_0x465c0b-0x0;var _0x151e48=_0x346d[_0x465c0b];return _0x151e48;};'use strict';var _=require(_0xd346('0x0'));var util=require('util');var logger=require(_0xd346('0x1'))('api');var moment=require(_0xd346('0x2'));var BPromise=require(_0xd346('0x3'));var rp=require(_0xd346('0x4'));var fs=require('fs');var path=require(_0xd346('0x5'));var rimraf=require(_0xd346('0x6'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0xd346('0x7')]=function(_0x29a02d,_0x25d736){return _0x29a02d[_0xd346('0x8')]('CmCompany',attributes,{'tableName':_0xd346('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d3a=['lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2d3a,0x9c));var _0xa2d3=function(_0x17784a,_0x42fe44){_0x17784a=_0x17784a-0x0;var _0x41aded=_0x2d3a[_0x17784a];return _0x41aded;};'use strict';var _=require(_0xa2d3('0x0'));var util=require(_0xa2d3('0x1'));var logger=require(_0xa2d3('0x2'))(_0xa2d3('0x3'));var moment=require('moment');var BPromise=require(_0xa2d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa2d3('0x5'));var config=require(_0xa2d3('0x6'));var attributes=require(_0xa2d3('0x7'));module[_0xa2d3('0x8')]=function(_0x1688f6,_0x44eb29){return _0x1688f6[_0xa2d3('0x9')](_0xa2d3('0xa'),attributes,{'tableName':_0xa2d3('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 7d3be1e..c0b1806 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 _0xdd1f=['result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x500aeb,_0x29fdba){var _0x5f3052=function(_0x415fc8){while(--_0x415fc8){_0x500aeb['push'](_0x500aeb['shift']());}};_0x5f3052(++_0x29fdba);}(_0xdd1f,0x166));var _0xfdd1=function(_0x372129,_0x539547){_0x372129=_0x372129-0x0;var _0x2385b4=_0xdd1f[_0x372129];return _0x2385b4;};'use strict';var _=require(_0xfdd1('0x0'));var util=require(_0xfdd1('0x1'));var moment=require(_0xfdd1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdd1('0x3'));var db=require(_0xfdd1('0x4'))['db'];var utils=require(_0xfdd1('0x5'));var logger=require(_0xfdd1('0x6'))('rpc');var config=require(_0xfdd1('0x7'));var jayson=require(_0xfdd1('0x8'));var client=jayson[_0xfdd1('0x9')][_0xfdd1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e3d5d,_0x3b3521,_0x24844e){return new BPromise(function(_0x363d96,_0x200516){return client[_0xfdd1('0xb')](_0x2e3d5d,_0x24844e)['then'](function(_0xa12482){logger[_0xfdd1('0xc')](_0xfdd1('0xd'),_0x3b3521,_0xfdd1('0xe'));logger[_0xfdd1('0xf')](_0xfdd1('0x10'),_0x3b3521,_0xfdd1('0xe'),JSON[_0xfdd1('0x11')](_0xa12482));if(_0xa12482[_0xfdd1('0x12')]){if(_0xa12482['error']['code']===0x1f4){logger[_0xfdd1('0x12')]('CmCompany,\x20%s,\x20%s',_0x3b3521,_0xa12482[_0xfdd1('0x12')][_0xfdd1('0x13')]);return _0x200516(_0xa12482[_0xfdd1('0x12')][_0xfdd1('0x13')]);}logger[_0xfdd1('0x12')](_0xfdd1('0xd'),_0x3b3521,_0xa12482['error'][_0xfdd1('0x13')]);return _0x363d96(_0xa12482[_0xfdd1('0x12')][_0xfdd1('0x13')]);}else{logger[_0xfdd1('0xc')](_0xfdd1('0xd'),_0x3b3521,_0xfdd1('0xe'));_0x363d96(_0xa12482[_0xfdd1('0x14')][_0xfdd1('0x13')]);}})['catch'](function(_0x1dd731){logger['error'](_0xfdd1('0xd'),_0x3b3521,_0x1dd731);_0x200516(_0x1dd731);});});} \ No newline at end of file +var _0x3948=['error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5cc692,_0xec2ea0){var _0x5c6fa4=function(_0x579c96){while(--_0x579c96){_0x5cc692['push'](_0x5cc692['shift']());}};_0x5c6fa4(++_0xec2ea0);}(_0x3948,0x1a3));var _0x8394=function(_0x540a81,_0x4c8bcc){_0x540a81=_0x540a81-0x0;var _0x48e239=_0x3948[_0x540a81];return _0x48e239;};'use strict';var _=require(_0x8394('0x0'));var util=require('util');var moment=require(_0x8394('0x1'));var BPromise=require(_0x8394('0x2'));var rs=require(_0x8394('0x3'));var fs=require('fs');var Redis=require(_0x8394('0x4'));var db=require(_0x8394('0x5'))['db'];var utils=require(_0x8394('0x6'));var logger=require(_0x8394('0x7'))(_0x8394('0x8'));var config=require(_0x8394('0x9'));var jayson=require(_0x8394('0xa'));var client=jayson[_0x8394('0xb')][_0x8394('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x597f77,_0x5ac5e5,_0x12780f){return new BPromise(function(_0x1c957f,_0x31ab46){return client[_0x8394('0xd')](_0x597f77,_0x12780f)['then'](function(_0x1bb4f5){logger['info'](_0x8394('0xe'),_0x5ac5e5,_0x8394('0xf'));logger[_0x8394('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x5ac5e5,_0x8394('0xf'),JSON[_0x8394('0x11')](_0x1bb4f5));if(_0x1bb4f5['error']){if(_0x1bb4f5[_0x8394('0x12')]['code']===0x1f4){logger[_0x8394('0x12')](_0x8394('0xe'),_0x5ac5e5,_0x1bb4f5[_0x8394('0x12')][_0x8394('0x13')]);return _0x31ab46(_0x1bb4f5[_0x8394('0x12')][_0x8394('0x13')]);}logger['error'](_0x8394('0xe'),_0x5ac5e5,_0x1bb4f5['error'][_0x8394('0x13')]);return _0x1c957f(_0x1bb4f5['error'][_0x8394('0x13')]);}else{logger[_0x8394('0x14')](_0x8394('0xe'),_0x5ac5e5,_0x8394('0xf'));_0x1c957f(_0x1bb4f5[_0x8394('0x15')][_0x8394('0x13')]);}})[_0x8394('0x16')](function(_0x5838c6){logger[_0x8394('0x12')](_0x8394('0xe'),_0x5ac5e5,_0x5838c6);_0x31ab46(_0x5838c6);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 3c5f968..fc84a69 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 _0xe091=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','getContacts','post','create','addContacts','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x2a30c9,_0x1ad912){var _0x351340=function(_0x41a2cd){while(--_0x41a2cd){_0x2a30c9['push'](_0x2a30c9['shift']());}};_0x351340(++_0x1ad912);}(_0xe091,0x10f));var _0x1e09=function(_0x43fefa,_0x1fb601){_0x43fefa=_0x43fefa-0x0;var _0x10c0ef=_0xe091[_0x43fefa];return _0x10c0ef;};'use strict';var multer=require('multer');var util=require(_0x1e09('0x0'));var path=require(_0x1e09('0x1'));var timeout=require(_0x1e09('0x2'));var express=require(_0x1e09('0x3'));var router=express['Router']();var fs_extra=require(_0x1e09('0x4'));var auth=require(_0x1e09('0x5'));var interaction=require(_0x1e09('0x6'));var config=require(_0x1e09('0x7'));var controller=require(_0x1e09('0x8'));router['get']('/',auth[_0x1e09('0x9')](),controller[_0x1e09('0xa')]);router['get'](_0x1e09('0xb'),auth['isAuthenticated'](),controller[_0x1e09('0xc')]);router['get'](_0x1e09('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x1e09('0xe'),auth[_0x1e09('0x9')](),controller[_0x1e09('0xf')]);router[_0x1e09('0x10')]('/',auth[_0x1e09('0x9')](),controller[_0x1e09('0x11')]);router['post'](_0x1e09('0xe'),auth[_0x1e09('0x9')](),controller[_0x1e09('0x12')]);router['put'](_0x1e09('0xd'),auth['isAuthenticated'](),controller[_0x1e09('0x13')]);router[_0x1e09('0x14')](_0x1e09('0xd'),auth[_0x1e09('0x9')](),controller[_0x1e09('0x15')]);module[_0x1e09('0x16')]=router; \ No newline at end of file +var _0xb656=['/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','describe'];(function(_0xb12985,_0x16dd76){var _0x387637=function(_0x4625d2){while(--_0x4625d2){_0xb12985['push'](_0xb12985['shift']());}};_0x387637(++_0x16dd76);}(_0xb656,0x1a9));var _0x6b65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb656[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6b65('0x0'));var util=require(_0x6b65('0x1'));var path=require(_0x6b65('0x2'));var timeout=require(_0x6b65('0x3'));var express=require(_0x6b65('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6b65('0x5'));var interaction=require(_0x6b65('0x6'));var config=require('../../config/environment');var controller=require(_0x6b65('0x7'));router[_0x6b65('0x8')]('/',auth[_0x6b65('0x9')](),controller[_0x6b65('0xa')]);router['get']('/describe',auth[_0x6b65('0x9')](),controller[_0x6b65('0xb')]);router[_0x6b65('0x8')](_0x6b65('0xc'),auth[_0x6b65('0x9')](),controller[_0x6b65('0xd')]);router[_0x6b65('0x8')](_0x6b65('0xe'),auth[_0x6b65('0x9')](),controller[_0x6b65('0xf')]);router[_0x6b65('0x10')]('/',auth[_0x6b65('0x9')](),controller[_0x6b65('0x11')]);router[_0x6b65('0x10')](_0x6b65('0xe'),auth[_0x6b65('0x9')](),controller[_0x6b65('0x12')]);router[_0x6b65('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6b65('0x14')]);router[_0x6b65('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x6b65('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index c4e59cc..ede1ede 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 _0xeb44=['lodash','sequelize','exports','STRING','UNSIGNED','NOW'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xeb44,0x168));var _0x4eb4=function(_0x4d8167,_0x2b01cc){_0x4d8167=_0x4d8167-0x0;var _0x2d761c=_0xeb44[_0x4d8167];return _0x2d761c;};'use strict';var _=require(_0x4eb4('0x0'));var Sequelize=require(_0x4eb4('0x1'));module[_0x4eb4('0x2')]={'firstName':{'type':Sequelize[_0x4eb4('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x4eb4('0x3')]},'street':{'type':Sequelize[_0x4eb4('0x3')]},'postalCode':{'type':Sequelize[_0x4eb4('0x3')]},'city':{'type':Sequelize[_0x4eb4('0x3')]},'country':{'type':Sequelize[_0x4eb4('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x4eb4('0x3')]},'mobile':{'type':Sequelize[_0x4eb4('0x3')]},'fax':{'type':Sequelize[_0x4eb4('0x3')]},'email':{'type':Sequelize[_0x4eb4('0x3')]},'url':{'type':Sequelize[_0x4eb4('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x4eb4('0x3')]},'twitter':{'type':Sequelize[_0x4eb4('0x3')]},'skype':{'type':Sequelize[_0x4eb4('0x3')]},'teams':{'type':Sequelize[_0x4eb4('0x3')]},'viber':{'type':Sequelize[_0x4eb4('0x3')]},'line':{'type':Sequelize[_0x4eb4('0x3')]},'wechat':{'type':Sequelize[_0x4eb4('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x4eb4('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x4eb4('0x5')]}}; \ No newline at end of file +var _0xca42=['DATE','NOW','lodash','sequelize','exports','STRING','TEXT','UNSIGNED'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xca42,0x1da));var _0x2ca4=function(_0x36ccc8,_0x17b034){_0x36ccc8=_0x36ccc8-0x0;var _0x1c235b=_0xca42[_0x36ccc8];return _0x1c235b;};'use strict';var _=require(_0x2ca4('0x0'));var Sequelize=require(_0x2ca4('0x1'));module[_0x2ca4('0x2')]={'firstName':{'type':Sequelize[_0x2ca4('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x2ca4('0x3')]},'street':{'type':Sequelize[_0x2ca4('0x3')]},'postalCode':{'type':Sequelize[_0x2ca4('0x3')]},'city':{'type':Sequelize[_0x2ca4('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x2ca4('0x3')]},'description':{'type':Sequelize[_0x2ca4('0x4')]},'phone':{'type':Sequelize[_0x2ca4('0x3')]},'mobile':{'type':Sequelize[_0x2ca4('0x3')]},'fax':{'type':Sequelize[_0x2ca4('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x2ca4('0x3')]},'facebook':{'type':Sequelize[_0x2ca4('0x3')]},'fb_data':{'type':Sequelize[_0x2ca4('0x3')]},'twitter':{'type':Sequelize[_0x2ca4('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x2ca4('0x3')]},'viber':{'type':Sequelize[_0x2ca4('0x3')]},'line':{'type':Sequelize[_0x2ca4('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x2ca4('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x2ca4('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x2ca4('0x6')],'defaultValue':Sequelize[_0x2ca4('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f76eb5d..40b17eb 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 _0xf93d=['having','resolve','user','role','agent','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','merge','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','TagIds','catch','params','tags','startsWith','displayName','findAll','columnName','alias','custom','type','values','body','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','info','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','each','duplicates','$or','findOrCreate','show','color','$and','cf_%d','format','table','setFields','toParam','phone','CmHopper','rawAttributes','options','getTags','nolimit','setTags','ids','getHoppers','ContactId','includeAll','include','rows','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_values','socket_timestamp','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','send','upload','createReadStream','parse','import','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','stringify','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','getJourney','mail','sms','fax','whatsapp','voice','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','callerid','starttime','endtime','note','userDisposition','userSecondDisposition','UserId','fullname','createdAt','startCase','chat','Account','closed','closedAt','thirdDisposition','Owner','Tags','browserName','customerIp','customerPort','osName','ratingMessage','ratingType','ratingValue','referer','substatus','openchannel','externalUrl','threadId','Interaction','findAndCountAll','sortBy','slice','path','lodash','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','undefined','limit','offset','count','set','Content-Range','json','update','then','destroy','status','sendStatus','error','stack','name','CmContact','describe','keys','length','CmCustomField','findOne','trimStart','cf_','all','fieldType','model','query','intersection','fields','attributes','hasOwnProperty','sort','where','filters','pick','select','field','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','conditions','find','Tag','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','text','start','filter','isNil','push','Contact','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','c.id','order','DESC'];(function(_0x49d2f7,_0x4404cb){var _0x4cf79b=function(_0x6a7a30){while(--_0x6a7a30){_0x49d2f7['push'](_0x49d2f7['shift']());}};_0x4cf79b(++_0x4404cb);}(_0xf93d,0x1bc));var _0xdf93=function(_0x16d453,_0x33a458){_0x16d453=_0x16d453-0x0;var _0x34ab6b=_0xf93d[_0x16d453];return _0x34ab6b;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require(_0xdf93('0x0'));var fs=require('fs');var _=require(_0xdf93('0x1'));var squel=require('squel');var Papa=require(_0xdf93('0x2'));var Redis=require(_0xdf93('0x3'));var qs=require(_0xdf93('0x4'));var as=require(_0xdf93('0x5'));var logger=require(_0xdf93('0x6'))(_0xdf93('0x7'));var config=require(_0xdf93('0x8'));var db=require(_0xdf93('0x9'))['db'];config['redis']=_[_0xdf93('0xa')](config[_0xdf93('0xb')],{'host':_0xdf93('0xc'),'port':0x18eb});var socket=require(_0xdf93('0xd'))(new Redis(config[_0xdf93('0xb')]));require('./cmContact.socket')['register'](socket);function respondWithResult(_0x21cae1,_0x42fbf1){_0x42fbf1=_0x42fbf1||0xc8;return function(_0xd1fb61){if(_0xd1fb61){return _0x21cae1['status'](_0x42fbf1)['json'](_0xd1fb61);}};}function respondWithFilteredResult(_0x1576e9,_0x36a158){return function(_0x993fae){if(_0x993fae){var _0xb1424c=typeof _0x36a158['offset']===_0xdf93('0xe')&&typeof _0x36a158[_0xdf93('0xf')]===_0xdf93('0xe');var _0x25c499=_0x993fae['count'];var _0x48eafc=_0xb1424c?0x0:_0x36a158[_0xdf93('0x10')];var _0x30f415=_0xb1424c?_0x993fae[_0xdf93('0x11')]:_0x36a158['offset']+_0x36a158[_0xdf93('0xf')];var _0x381901;if(_0x30f415>=_0x25c499){_0x30f415=_0x25c499;_0x381901=0xc8;}else{_0x381901=0xce;}_0x1576e9['status'](_0x381901);return _0x1576e9[_0xdf93('0x12')](_0xdf93('0x13'),_0x48eafc+'-'+_0x30f415+'/'+_0x25c499)[_0xdf93('0x14')](_0x993fae);}return null;};}function saveUpdates(_0xa1363d){return function(_0x339f13){if(_0x339f13){return _0x339f13[_0xdf93('0x15')](_0xa1363d)[_0xdf93('0x16')](function(_0x137103){return _0x137103;});}return null;};}function removeEntity(_0x2fbb90){return function(_0x3dced7){if(_0x3dced7){return _0x3dced7[_0xdf93('0x17')]()[_0xdf93('0x16')](function(){_0x2fbb90[_0xdf93('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x311693){return function(_0x943cdf){if(!_0x943cdf){_0x311693[_0xdf93('0x19')](0x194);}return _0x943cdf;};}function handleError(_0x553ae6,_0x2b0b55){_0x2b0b55=_0x2b0b55||0x1f4;return function(_0x1bb5ad){logger[_0xdf93('0x1a')](_0x1bb5ad[_0xdf93('0x1b')]);if(_0x1bb5ad[_0xdf93('0x1c')]){delete _0x1bb5ad[_0xdf93('0x1c')];}_0x553ae6['status'](_0x2b0b55)['send'](_0x1bb5ad);};}exports['index']=function(_0x427e95,_0x125ba7){var _0x212b5e={},_0x3914ea={},_0x309dad={'count':0x0,'rows':[]};return db[_0xdf93('0x1d')][_0xdf93('0x1e')]()[_0xdf93('0x16')](function(_0x3d9f31){var _0x369251=[];for(var _0x55e155=0x0;_0x55e1550x1){_0x34b59b['or'](_0xdf93('0x5b'),qs[_0xdf93('0x5c')](_0x328024),null);}else{if(qs['isNumeric'](_0x328024)){_0x34b59b['or'](_0xdf93('0x5d'),_0x328024+'%');_0x34b59b['or'](_0xdf93('0x5e'),_0x328024+'%');_0x34b59b['or']('c.mobile\x20LIKE\x20?',_0x328024+'%');_0x34b59b['or']('c.fax\x20LIKE\x20?',_0x328024+'%');}else if(qs[_0xdf93('0x5f')](_0x328024)){_0x34b59b['or'](_0xdf93('0x60'),_0x328024+'%');}else{_0x34b59b['or'](_0xdf93('0x61'),'%'+_0x328024+'%');_0x34b59b['or']('c.lastName\x20LIKE\x20?','%'+_0x328024+'%');_0x34b59b['or'](_0xdf93('0x60'),'%'+_0x328024+'%');}}}}_0x3dc7a9[_0xdf93('0x2e')](_0x34b59b);_0x3dc7a9[_0xdf93('0x62')]('c.id');var _0x53e4c3={'type':db[_0xdf93('0x63')][_0xdf93('0x64')][_0xdf93('0x65')],'raw':!![]};var _0x555511=_0x3dc7a9[_0xdf93('0x66')]()[_0xdf93('0x32')](_0xdf93('0x67'));if(_0x212b5e['order']){_0x212b5e[_0xdf93('0x68')][_0xdf93('0x44')](function(_0x27ebd1){_0x3dc7a9[_0xdf93('0x68')]('c.'+_0x27ebd1[0x0],_0x27ebd1[0x1]===_0xdf93('0x69')?![]:!![]);});}if(!_[_0xdf93('0x53')](_0xf7e1b9)){_0x3dc7a9[_0xdf93('0x6a')](_0x4bc7a6);_0x555511['where']('t.id\x20IN\x20?',_0xf7e1b9);}BPromise[_0xdf93('0x6b')]()[_0xdf93('0x16')](function(){if(!_0x585553)return;if(_0x427e95[_0xdf93('0x6c')][_0xdf93('0x6d')]!==_0xdf93('0x6e'))return;if(!_['some'](_0x585553[_0xdf93('0x3f')],[_0xdf93('0x32'),_0xdf93('0x47')])){return _0x427e95[_0xdf93('0x6c')][_0xdf93('0x6f')]({'attributes':['id'],'raw':!![]})[_0xdf93('0x16')](function(_0x2ac25a){if(_['isEmpty'](_0x2ac25a)){_0x555511['where'](_0xdf93('0x70'));_0x3dc7a9['where']('c.ListId\x20IS\x20NULL');}else{_0x555511[_0xdf93('0x2e')](_0xdf93('0x71'),_[_0xdf93('0x43')](_0x2ac25a,'id'));_0x3dc7a9[_0xdf93('0x2e')]('c.ListId\x20IN\x20?',_['map'](_0x2ac25a,'id'));}});}})['then'](function(){if(_0x427e95[_0xdf93('0x6c')][_0xdf93('0x6d')]===_0xdf93('0x6e')&&!_0x585553&&!_0x427e95[_0xdf93('0x28')]['ListId'])return[];return db[_0xdf93('0x72')][_0xdf93('0x28')](_0x555511[_0xdf93('0x73')](),_0x53e4c3);})[_0xdf93('0x16')](function(_0x85b0f){_0x309dad[_0xdf93('0x11')]=_0x85b0f[_0xdf93('0x20')];if(_0x309dad[_0xdf93('0x11')]===0x0)return[];return db['sequelize'][_0xdf93('0x28')](_0xc35608[_0xdf93('0x73')](),_0x53e4c3)[_0xdf93('0x16')](function(_0x51848e){_0x5e2902=_[_0xdf93('0x74')](_0x51848e,'id');_0x53e4c3=_[_0xdf93('0x75')](_0x53e4c3,{'model':db[_0xdf93('0x1d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x427e95[_0xdf93('0x28')]['fields']){_0x212b5e[_0xdf93('0x2b')][_0xdf93('0x44')](function(_0x121a33){_0x3dc7a9['field']('c.'+_0x121a33);});}else{_0x3dc7a9[_0xdf93('0x32')](_0xdf93('0x67'));_0x3dc7a9[_0xdf93('0x32')]('c.firstName');_0x3dc7a9[_0xdf93('0x32')](_0xdf93('0x76'));_0x3dc7a9[_0xdf93('0x32')](_0xdf93('0x77'));_0x3dc7a9['field'](_0xdf93('0x78'));_0x3dc7a9[_0xdf93('0x32')](_0xdf93('0x79'));_0x3dc7a9[_0xdf93('0x32')](_0xdf93('0x7a'));_0x3dc7a9[_0xdf93('0x32')](_0xdf93('0x7b'));_0x3dc7a9[_0xdf93('0x32')](_0xdf93('0x7c'));_0x3dc7a9[_0xdf93('0x32')](_0xdf93('0x7d'));_0x3dc7a9['field'](_0xdf93('0x7e'));_0x3dc7a9[_0xdf93('0x32')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x212b5e[_0xdf93('0xf')])_0x3dc7a9['limit'](_0x212b5e[_0xdf93('0xf')]);if(_0x212b5e[_0xdf93('0x10')])_0x3dc7a9[_0xdf93('0x10')](_0x212b5e[_0xdf93('0x10')]);return db[_0xdf93('0x72')]['query'](_0x3dc7a9[_0xdf93('0x73')](),_0x53e4c3);});})['then'](function(_0x9845c5){_0x9845c5[_0xdf93('0x44')](function(_0x77ac9e){if(_0x77ac9e[_0xdf93('0x7f')]){_0x77ac9e['Tags']=[];_0x77ac9e[_0xdf93('0x7f')][_0xdf93('0x5a')](',')[_0xdf93('0x44')](function(_0x1ff640){_0x77ac9e['Tags'][_0xdf93('0x51')](_0x5e2902[_0x1ff640]);});}delete _0x77ac9e[_0xdf93('0x7f')];});_0x309dad['rows']=_0x9845c5;return _0x309dad;})['then'](respondWithFilteredResult(_0x125ba7,_0x212b5e));})[_0xdf93('0x80')](handleError(_0x125ba7,null));};exports['destroy']=function(_0x33093e,_0x269b4c){return db[_0xdf93('0x1d')][_0xdf93('0x40')]({'where':{'id':_0x33093e[_0xdf93('0x81')]['id']}})[_0xdf93('0x16')](handleEntityNotFound(_0x269b4c,null))[_0xdf93('0x16')](removeEntity(_0x269b4c,null))[_0xdf93('0x80')](handleError(_0x269b4c,null));};exports[_0xdf93('0x1e')]=function(_0x186d51,_0x3e0612){return db[_0xdf93('0x1d')][_0xdf93('0x1e')]()[_0xdf93('0x16')](function(_0x56a21a){delete _0x56a21a[_0xdf93('0x82')];for(var _0xcc9fcb=0x0;_0xcc9fcb=_0x206405){_0x541d29=_0x206405;_0x16d1a1=0xc8;}else{_0x16d1a1=0xce;}_0x40e3b0[_0xa339('0x11')](_0x16d1a1);return _0x40e3b0[_0xa339('0x16')](_0xa339('0x17'),_0x55863a+'-'+_0x541d29+'/'+_0x206405)[_0xa339('0x12')](_0x32350a);}return null;};}function saveUpdates(_0x219756){return function(_0x329315){if(_0x329315){return _0x329315[_0xa339('0x18')](_0x219756)['then'](function(_0x1e54fe){return _0x1e54fe;});}return null;};}function removeEntity(_0x1efebd){return function(_0x48d551){if(_0x48d551){return _0x48d551[_0xa339('0x19')]()[_0xa339('0x1a')](function(){_0x1efebd[_0xa339('0x11')](0xcc)[_0xa339('0x1b')]();});}};}function handleEntityNotFound(_0x28c331){return function(_0x17e16e){if(!_0x17e16e){_0x28c331['sendStatus'](0x194);}return _0x17e16e;};}function handleError(_0x3931b3,_0x46a509){_0x46a509=_0x46a509||0x1f4;return function(_0x39ec0f){logger[_0xa339('0x1c')](_0x39ec0f[_0xa339('0x1d')]);if(_0x39ec0f['name']){delete _0x39ec0f[_0xa339('0x1e')];}_0x3931b3['status'](_0x46a509)[_0xa339('0x1f')](_0x39ec0f);};}exports[_0xa339('0x20')]=function(_0xb6cfea,_0x30474d){var _0x42fc65={},_0x2a506e={},_0x220c1a={'count':0x0,'rows':[]};return db[_0xa339('0x21')][_0xa339('0x22')]()['then'](function(_0x25b656){var _0x2cfecd=[];for(var _0x1086f7=0x0;_0x1086f70x1){_0x5016b2['or'](_0xa339('0x5f'),qs[_0xa339('0x60')](_0xda4ee1),null);}else{if(qs['isNumeric'](_0xda4ee1)){_0x5016b2['or'](_0xa339('0x61'),_0xda4ee1+'%');_0x5016b2['or'](_0xa339('0x62'),_0xda4ee1+'%');_0x5016b2['or']('c.mobile\x20LIKE\x20?',_0xda4ee1+'%');_0x5016b2['or']('c.fax\x20LIKE\x20?',_0xda4ee1+'%');}else if(qs[_0xa339('0x63')](_0xda4ee1)){_0x5016b2['or'](_0xa339('0x64'),_0xda4ee1+'%');}else{_0x5016b2['or'](_0xa339('0x65'),'%'+_0xda4ee1+'%');_0x5016b2['or'](_0xa339('0x66'),'%'+_0xda4ee1+'%');_0x5016b2['or']('c.email\x20LIKE\x20?','%'+_0xda4ee1+'%');}}}}_0x37defc[_0xa339('0x35')](_0x5016b2);_0x37defc[_0xa339('0x67')](_0xa339('0x68'));var _0x1a30cc={'type':db[_0xa339('0x69')][_0xa339('0x6a')][_0xa339('0x6b')],'raw':!![]};var _0x453531=_0x37defc[_0xa339('0x6c')]()[_0xa339('0x37')](_0xa339('0x68'));if(_0x42fc65['order']){_0x42fc65[_0xa339('0x33')][_0xa339('0x4a')](function(_0x3b3b23){_0x37defc['order']('c.'+_0x3b3b23[0x0],_0x3b3b23[0x1]===_0xa339('0x6d')?![]:!![]);});}if(!_[_0xa339('0x58')](_0x31f2d8)){_0x37defc[_0xa339('0x6e')](_0x45c676);_0x453531[_0xa339('0x35')](_0xa339('0x6f'),_0x31f2d8);}BPromise[_0xa339('0x70')]()['then'](function(){if(!_0x16a0a7)return;if(_0xb6cfea['user'][_0xa339('0x71')]!==_0xa339('0x72'))return;if(!_['some'](_0x16a0a7[_0xa339('0x46')],[_0xa339('0x37'),_0xa339('0x4d')])){return _0xb6cfea['user'][_0xa339('0x73')]({'attributes':['id'],'raw':!![]})[_0xa339('0x1a')](function(_0x1c1d80){if(_[_0xa339('0x58')](_0x1c1d80)){_0x453531[_0xa339('0x35')](_0xa339('0x74'));_0x37defc[_0xa339('0x35')](_0xa339('0x74'));}else{_0x453531[_0xa339('0x35')]('c.ListId\x20IN\x20?',_['map'](_0x1c1d80,'id'));_0x37defc[_0xa339('0x35')]('c.ListId\x20IN\x20?',_[_0xa339('0x75')](_0x1c1d80,'id'));}});}})['then'](function(){if(_0xb6cfea[_0xa339('0x76')][_0xa339('0x71')]===_0xa339('0x72')&&!_0x16a0a7&&!_0xb6cfea[_0xa339('0x2d')][_0xa339('0x59')])return[];return db['sequelize']['query'](_0x453531[_0xa339('0x77')](),_0x1a30cc);})[_0xa339('0x1a')](function(_0x1d85c1){_0x220c1a[_0xa339('0x15')]=_0x1d85c1[_0xa339('0x24')];if(_0x220c1a[_0xa339('0x15')]===0x0)return[];return db[_0xa339('0x78')]['query'](_0x208617[_0xa339('0x77')](),_0x1a30cc)[_0xa339('0x1a')](function(_0x5d9bc1){_0x1223af=_[_0xa339('0x79')](_0x5d9bc1,'id');_0x1a30cc=_[_0xa339('0x7a')](_0x1a30cc,{'model':db[_0xa339('0x21')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xb6cfea[_0xa339('0x2d')][_0xa339('0x30')]){_0x42fc65['attributes']['forEach'](function(_0x286733){_0x37defc[_0xa339('0x37')]('c.'+_0x286733);});}else{_0x37defc['field'](_0xa339('0x68'));_0x37defc['field'](_0xa339('0x7b'));_0x37defc[_0xa339('0x37')](_0xa339('0x7c'));_0x37defc[_0xa339('0x37')](_0xa339('0x7d'));_0x37defc[_0xa339('0x37')](_0xa339('0x7e'));_0x37defc[_0xa339('0x37')](_0xa339('0x7f'));_0x37defc[_0xa339('0x37')](_0xa339('0x80'));_0x37defc['field'](_0xa339('0x81'));_0x37defc['field'](_0xa339('0x82'));_0x37defc['field'](_0xa339('0x83'));_0x37defc['field'](_0xa339('0x84'));_0x37defc['field'](_0xa339('0x85'),_0xa339('0x86'));}if(_0x42fc65[_0xa339('0x32')])_0x37defc[_0xa339('0x32')](_0x42fc65['limit']);if(_0x42fc65[_0xa339('0x13')])_0x37defc[_0xa339('0x13')](_0x42fc65[_0xa339('0x13')]);return db[_0xa339('0x78')][_0xa339('0x2d')](_0x37defc[_0xa339('0x77')](),_0x1a30cc);});})[_0xa339('0x1a')](function(_0x19bbe7){_0x19bbe7[_0xa339('0x4a')](function(_0x4e87f7){if(_0x4e87f7['TagIds']){_0x4e87f7['Tags']=[];_0x4e87f7['TagIds'][_0xa339('0x49')](',')['forEach'](function(_0x5311a0){_0x4e87f7[_0xa339('0x87')]['push'](_0x1223af[_0x5311a0]);});}delete _0x4e87f7['TagIds'];});_0x220c1a['rows']=_0x19bbe7;return _0x220c1a;})[_0xa339('0x1a')](respondWithFilteredResult(_0x30474d,_0x42fc65));})[_0xa339('0x88')](handleError(_0x30474d,null));};exports['destroy']=function(_0x15fb7a,_0x572240){return db[_0xa339('0x21')]['find']({'where':{'id':_0x15fb7a[_0xa339('0x89')]['id']}})[_0xa339('0x1a')](handleEntityNotFound(_0x572240,null))[_0xa339('0x1a')](removeEntity(_0x572240,null))[_0xa339('0x88')](handleError(_0x572240,null));};exports[_0xa339('0x22')]=function(_0x30619f,_0x2da535){return db[_0xa339('0x21')][_0xa339('0x22')]()[_0xa339('0x1a')](function(_0x43941f){delete _0x43941f['tags'];for(var _0x41b12c=0x0;_0x41b12c{}\s\\|]/g,'-');_0x3a5016(null,util[_0xb9bc('0x21')](_0xb9bc('0x22'),path[_0xb9bc('0x23')](_0x4a02eb[_0xb9bc('0x1f')],path[_0xb9bc('0x24')](_0x4a02eb[_0xb9bc('0x1f')])),Date[_0xb9bc('0x25')](),path[_0xb9bc('0x24')](_0x4a02eb[_0xb9bc('0x1f')])));}})});router[_0xb9bc('0x16')](_0xb9bc('0x26'),upload[_0xb9bc('0x27')]('file'),controller[_0xb9bc('0x28')]);var upload=multer({'storage':multer[_0xb9bc('0x1b')]({'destination':function(_0x263652,_0x1fe68c,_0x99b759){_0x99b759(null,path[_0xb9bc('0x1c')](config[_0xb9bc('0x1d')],'server/files/tmp'));},'filename':function(_0x158a62,_0x1b2aa2,_0x560162){_0x1b2aa2[_0xb9bc('0x1f')]=_0x1b2aa2[_0xb9bc('0x1f')][_0xb9bc('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x560162(null,util[_0xb9bc('0x21')]('%s-%s%s',path['basename'](_0x1b2aa2[_0xb9bc('0x1f')],path[_0xb9bc('0x24')](_0x1b2aa2[_0xb9bc('0x1f')])),Date[_0xb9bc('0x25')](),path[_0xb9bc('0x24')](_0x1b2aa2[_0xb9bc('0x1f')])));}})});router[_0xb9bc('0x16')](_0xb9bc('0x29'),upload[_0xb9bc('0x27')](_0xb9bc('0x2a')),controller[_0xb9bc('0x2b')]);router['post'](_0xb9bc('0x2c'),auth[_0xb9bc('0xb')](),controller['import']);router[_0xb9bc('0x2d')](_0xb9bc('0xd'),auth[_0xb9bc('0xb')](),controller[_0xb9bc('0x2e')]);router[_0xb9bc('0x2f')]('/:id',auth[_0xb9bc('0xb')](),controller[_0xb9bc('0x30')]);module['exports']=router; \ No newline at end of file +var _0xfb07=['originalname','replace','format','%s-%s%s','basename','extname','now','/csv','single','file','uploadCsv','join','/upload','upload','/upload/:id','import','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./cmContact.controller','get','isAuthenticated','describe','/:id','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','create','/create_many','bulkCreate','/:id/tags','setTags','diskStorage','root','server/files/tmp'];(function(_0x15e6fe,_0x1a5c39){var _0x34894d=function(_0x32eec2){while(--_0x32eec2){_0x15e6fe['push'](_0x15e6fe['shift']());}};_0x34894d(++_0x1a5c39);}(_0xfb07,0x1b2));var _0x7fb0=function(_0x5cf8a9,_0x5b327d){_0x5cf8a9=_0x5cf8a9-0x0;var _0x308449=_0xfb07[_0x5cf8a9];return _0x308449;};'use strict';var multer=require(_0x7fb0('0x0'));var util=require(_0x7fb0('0x1'));var path=require(_0x7fb0('0x2'));var timeout=require(_0x7fb0('0x3'));var express=require(_0x7fb0('0x4'));var router=express[_0x7fb0('0x5')]();var fs_extra=require(_0x7fb0('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7fb0('0x7'));var controller=require(_0x7fb0('0x8'));router[_0x7fb0('0x9')]('/',auth[_0x7fb0('0xa')](),controller['index']);router[_0x7fb0('0x9')]('/describe',auth[_0x7fb0('0xa')](),controller[_0x7fb0('0xb')]);router[_0x7fb0('0x9')](_0x7fb0('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7fb0('0x9')]('/:id/tags',auth[_0x7fb0('0xa')](),controller[_0x7fb0('0xd')]);router[_0x7fb0('0x9')](_0x7fb0('0xe'),auth[_0x7fb0('0xa')](),controller[_0x7fb0('0xf')]);router[_0x7fb0('0x9')](_0x7fb0('0x10'),auth[_0x7fb0('0xa')](),controller[_0x7fb0('0x11')]);router[_0x7fb0('0x9')](_0x7fb0('0x12'),auth['isAuthenticated'](),controller[_0x7fb0('0x13')]);router[_0x7fb0('0x9')]('/:id/jscripty_sessions',auth[_0x7fb0('0xa')](),controller[_0x7fb0('0x14')]);router[_0x7fb0('0x9')](_0x7fb0('0x15'),auth[_0x7fb0('0xa')](),controller[_0x7fb0('0x16')]);router[_0x7fb0('0x17')](_0x7fb0('0x18'),auth['isAuthenticated'](),controller[_0x7fb0('0x19')]);router[_0x7fb0('0x17')]('/',auth[_0x7fb0('0xa')](),controller[_0x7fb0('0x1a')]);router['post'](_0x7fb0('0x1b'),auth['isAuthenticated'](),controller[_0x7fb0('0x1c')]);router[_0x7fb0('0x17')](_0x7fb0('0x1d'),auth[_0x7fb0('0xa')](),controller[_0x7fb0('0x1e')]);var upload=multer({'storage':multer[_0x7fb0('0x1f')]({'destination':function(_0x55c4ac,_0x1f6b87,_0x27df5b){_0x27df5b(null,path['join'](config[_0x7fb0('0x20')],_0x7fb0('0x21')));},'filename':function(_0x90d3e2,_0x1d2363,_0x339729){_0x1d2363[_0x7fb0('0x22')]=_0x1d2363['originalname'][_0x7fb0('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x339729(null,util[_0x7fb0('0x24')](_0x7fb0('0x25'),path[_0x7fb0('0x26')](_0x1d2363[_0x7fb0('0x22')],path[_0x7fb0('0x27')](_0x1d2363['originalname'])),Date[_0x7fb0('0x28')](),path[_0x7fb0('0x27')](_0x1d2363[_0x7fb0('0x22')])));}})});router[_0x7fb0('0x17')](_0x7fb0('0x29'),upload[_0x7fb0('0x2a')](_0x7fb0('0x2b')),controller[_0x7fb0('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x8636b4,_0x40b3b4,_0x24a216){_0x24a216(null,path[_0x7fb0('0x2d')](config['root'],_0x7fb0('0x21')));},'filename':function(_0xa07077,_0x42a5b6,_0x6c71dc){_0x42a5b6[_0x7fb0('0x22')]=_0x42a5b6[_0x7fb0('0x22')][_0x7fb0('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x6c71dc(null,util[_0x7fb0('0x24')]('%s-%s%s',path[_0x7fb0('0x26')](_0x42a5b6['originalname'],path[_0x7fb0('0x27')](_0x42a5b6['originalname'])),Date[_0x7fb0('0x28')](),path[_0x7fb0('0x27')](_0x42a5b6[_0x7fb0('0x22')])));}})});router[_0x7fb0('0x17')](_0x7fb0('0x2e'),upload[_0x7fb0('0x2a')](_0x7fb0('0x2b')),controller[_0x7fb0('0x2f')]);router[_0x7fb0('0x17')](_0x7fb0('0x30'),auth[_0x7fb0('0xa')](),controller[_0x7fb0('0x31')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7fb0('0x32')]);router['delete'](_0x7fb0('0xc'),auth[_0x7fb0('0xa')](),controller[_0x7fb0('0x33')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 9747f41..1af020e 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 _0x3781=['parse','values','isArray','BOOLEAN','voice','sequelize','lodash','VIRTUAL','getDataValue','alias','setDataValue','name','long','type','select'];(function(_0x12a2a6,_0x5283cb){var _0x44d66e=function(_0x5eb4be){while(--_0x5eb4be){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x44d66e(++_0x5283cb);}(_0x3781,0x7d));var _0x1378=function(_0x51b255,_0x2a91cf){_0x51b255=_0x51b255-0x0;var _0x43bd02=_0x3781[_0x51b255];return _0x43bd02;};'use strict';var Sequelize=require(_0x1378('0x0'));var _=require(_0x1378('0x1'));module['exports']={'name':{'type':Sequelize[_0x1378('0x2')],'get':function(_0x277f81){return this[_0x1378('0x3')](_0x1378('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x47b509){this[_0x1378('0x5')](_0x1378('0x4'),_0x47b509?_0x47b509:this[_0x1378('0x3')](_0x1378('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x1378('0x7')),'get':function(){if(this['getDataValue'](_0x1378('0x8'))===_0x1378('0x9')){return JSON[_0x1378('0xa')](this[_0x1378('0x3')](_0x1378('0xb')));}else{return this['getDataValue']('values');}},'set':function(_0x4d9cad){if(Array[_0x1378('0xc')](_0x4d9cad)){this[_0x1378('0x5')](_0x1378('0xb'),JSON['stringify'](_0x4d9cad));}else{this[_0x1378('0x5')]('values',_0x4d9cad);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1378('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x1378('0xe'))}}; \ No newline at end of file +var _0xb232=['values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','name','TEXT','long','type','select','parse'];(function(_0xcb19a4,_0x5c14d1){var _0x38ca05=function(_0x2c1ca5){while(--_0x2c1ca5){_0xcb19a4['push'](_0xcb19a4['shift']());}};_0x38ca05(++_0x5c14d1);}(_0xb232,0x6b));var _0x2b23=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0xb232[_0x23c6f2];return _0x4c270b;};'use strict';var Sequelize=require(_0x2b23('0x0'));var _=require(_0x2b23('0x1'));module[_0x2b23('0x2')]={'name':{'type':Sequelize[_0x2b23('0x3')],'get':function(_0x3e252a){return this[_0x2b23('0x4')](_0x2b23('0x5'));}},'alias':{'type':Sequelize[_0x2b23('0x6')],'allowNull':![],'set':function(_0x1b26ec){this['setDataValue'](_0x2b23('0x5'),_0x1b26ec?_0x1b26ec:this[_0x2b23('0x4')](_0x2b23('0x7')));}},'type':{'type':Sequelize[_0x2b23('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x2b23('0x8')](_0x2b23('0x9')),'get':function(){if(this[_0x2b23('0x4')](_0x2b23('0xa'))===_0x2b23('0xb')){return JSON[_0x2b23('0xc')](this[_0x2b23('0x4')]('values'));}else{return this['getDataValue'](_0x2b23('0xd'));}},'set':function(_0xc2fbbe){if(Array[_0x2b23('0xe')](_0xc2fbbe)){this[_0x2b23('0xf')](_0x2b23('0xd'),JSON[_0x2b23('0x10')](_0xc2fbbe));}else{this[_0x2b23('0xf')]('values',_0xc2fbbe);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x2b23('0x11')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x2b23('0x12')](_0x2b23('0x13'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 6082a64..cb4241f 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 _0x8952=['includeAll','include','findAll','rows','show','params','rawAttributes','keys','find','catch','update','body','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','end','undefined','count','offset','limit','status','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','CmCustomField','fieldName','key','model','differenceBy','query','filters','intersection','attributes','fields','length','order','sort','where','type','VIRTUAL','merge','options'];(function(_0x42d2af,_0x3961b5){var _0x1d6d63=function(_0x10833e){while(--_0x10833e){_0x42d2af['push'](_0x42d2af['shift']());}};_0x1d6d63(++_0x3961b5);}(_0x8952,0x71));var _0x2895=function(_0x102efc,_0x2c8323){_0x102efc=_0x102efc-0x0;var _0x35297b=_0x8952[_0x102efc];return _0x35297b;};'use strict';var emlformat=require(_0x2895('0x0'));var rimraf=require(_0x2895('0x1'));var zipdir=require(_0x2895('0x2'));var jsonpatch=require(_0x2895('0x3'));var rp=require(_0x2895('0x4'));var moment=require(_0x2895('0x5'));var BPromise=require(_0x2895('0x6'));var Mustache=require(_0x2895('0x7'));var util=require('util');var path=require(_0x2895('0x8'));var sox=require('sox');var csv=require(_0x2895('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require(_0x2895('0xb'));var squel=require(_0x2895('0xc'));var crypto=require(_0x2895('0xd'));var jsforce=require(_0x2895('0xe'));var deskjs=require(_0x2895('0xf'));var toCsv=require(_0x2895('0x9'));var querystring=require(_0x2895('0x10'));var Papa=require(_0x2895('0x11'));var Redis=require(_0x2895('0x12'));var authService=require(_0x2895('0x13'));var qs=require(_0x2895('0x14'));var as=require(_0x2895('0x15'));var hardwareService=require(_0x2895('0x16'));var logger=require('../../config/logger')(_0x2895('0x17'));var utils=require(_0x2895('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2895('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55ed1d,_0x41ee9e){_0x41ee9e=_0x41ee9e||0xcc;return function(_0x14a77d){if(_0x14a77d){return _0x55ed1d['sendStatus'](_0x41ee9e);}return _0x55ed1d['status'](_0x41ee9e)[_0x2895('0x1a')]();};}function respondWithResult(_0x650e54,_0x51cb27){_0x51cb27=_0x51cb27||0xc8;return function(_0x32c24d){if(_0x32c24d){return _0x650e54['status'](_0x51cb27)['json'](_0x32c24d);}};}function respondWithFilteredResult(_0x63ebf8,_0x2427e5){return function(_0x31557c){if(_0x31557c){var _0xce7951=typeof _0x2427e5['offset']===_0x2895('0x1b')&&typeof _0x2427e5['limit']===_0x2895('0x1b');var _0x2f2019=_0x31557c[_0x2895('0x1c')];var _0x3cf8f1=_0xce7951?0x0:_0x2427e5[_0x2895('0x1d')];var _0x54c98e=_0xce7951?_0x31557c[_0x2895('0x1c')]:_0x2427e5[_0x2895('0x1d')]+_0x2427e5[_0x2895('0x1e')];var _0x390ffc;if(_0x54c98e>=_0x2f2019){_0x54c98e=_0x2f2019;_0x390ffc=0xc8;}else{_0x390ffc=0xce;}_0x63ebf8[_0x2895('0x1f')](_0x390ffc);return _0x63ebf8[_0x2895('0x20')](_0x2895('0x21'),_0x3cf8f1+'-'+_0x54c98e+'/'+_0x2f2019)['json'](_0x31557c);}return null;};}function patchUpdates(_0x49fa53){return function(_0x55467e){try{jsonpatch[_0x2895('0x22')](_0x55467e,_0x49fa53,!![]);}catch(_0x394051){return BPromise[_0x2895('0x23')](_0x394051);}return _0x55467e[_0x2895('0x24')]();};}function saveUpdates(_0x37b593,_0x3991ea){return function(_0x740a48){if(_0x740a48){return _0x740a48['update'](_0x37b593)[_0x2895('0x25')](function(_0x28433e){return _0x28433e;});}return null;};}function removeEntity(_0x262b6b,_0x283121){return function(_0x47c014){if(_0x47c014){return _0x47c014['destroy']()[_0x2895('0x25')](function(){_0x262b6b[_0x2895('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a3725,_0x3a2d44){return function(_0x55d3fc){if(!_0x55d3fc){_0x2a3725[_0x2895('0x26')](0x194);}return _0x55d3fc;};}function handleError(_0x533a9f,_0x8581e){_0x8581e=_0x8581e||0x1f4;return function(_0x5ddff5){logger[_0x2895('0x27')](_0x5ddff5[_0x2895('0x28')]);if(_0x5ddff5[_0x2895('0x29')]){delete _0x5ddff5['name'];}_0x533a9f[_0x2895('0x1f')](_0x8581e)[_0x2895('0x2a')](_0x5ddff5);};}exports[_0x2895('0x2b')]=function(_0x43d07f,_0x349ed7){var _0x2f3c16={},_0x43ee3d={},_0x269da1={'count':0x0,'rows':[]};var _0x1afcbb=_[_0x2895('0x2c')](db[_0x2895('0x2d')]['rawAttributes'],function(_0x30acd7){return{'name':_0x30acd7[_0x2895('0x2e')],'type':_0x30acd7['type'][_0x2895('0x2f')]};});_0x43ee3d[_0x2895('0x30')]=_[_0x2895('0x31')](_[_0x2895('0x2c')](_0x1afcbb,_0x2895('0x29')),[_0x2895('0x29')]);_0x43ee3d[_0x2895('0x32')]=_['keys'](_0x43d07f[_0x2895('0x32')]);_0x43ee3d[_0x2895('0x33')]=_[_0x2895('0x34')](_0x43ee3d[_0x2895('0x30')],_0x43ee3d[_0x2895('0x32')]);_0x2f3c16[_0x2895('0x35')]=_[_0x2895('0x34')](_0x43ee3d[_0x2895('0x30')],qs[_0x2895('0x36')](_0x43d07f[_0x2895('0x32')][_0x2895('0x36')]));_0x2f3c16['attributes']=_0x2f3c16[_0x2895('0x35')][_0x2895('0x37')]?_0x2f3c16['attributes']:_0x43ee3d['model'];if(!_0x43d07f[_0x2895('0x32')]['hasOwnProperty']('nolimit')){_0x2f3c16[_0x2895('0x1e')]=qs['limit'](_0x43d07f[_0x2895('0x32')]['limit']);_0x2f3c16['offset']=qs[_0x2895('0x1d')](_0x43d07f['query'][_0x2895('0x1d')]);}_0x2f3c16[_0x2895('0x38')]=qs[_0x2895('0x39')](_0x43d07f['query']['sort']);_0x2f3c16['where']=qs[_0x2895('0x33')](_['pick'](_0x43d07f[_0x2895('0x32')],_0x43ee3d[_0x2895('0x33')]),_0x1afcbb);if(_0x43d07f[_0x2895('0x32')]['filter']){_0x2f3c16[_0x2895('0x3a')]=_['merge'](_0x2f3c16['where'],{'$or':_[_0x2895('0x2c')](_0x1afcbb,function(_0x1a25d1){if(_0x1a25d1[_0x2895('0x3b')]!==_0x2895('0x3c')){var _0xd5997b={};_0xd5997b[_0x1a25d1[_0x2895('0x29')]]={'$like':'%'+_0x43d07f[_0x2895('0x32')]['filter']+'%'};return _0xd5997b;}})});}_0x2f3c16=_[_0x2895('0x3d')]({},_0x2f3c16,_0x43d07f[_0x2895('0x3e')]);var _0x1e3ad1={'where':_0x2f3c16[_0x2895('0x3a')]};return db[_0x2895('0x2d')][_0x2895('0x1c')](_0x1e3ad1)[_0x2895('0x25')](function(_0x449d72){_0x269da1[_0x2895('0x1c')]=_0x449d72;if(_0x43d07f[_0x2895('0x32')][_0x2895('0x3f')]){_0x2f3c16[_0x2895('0x40')]=[{'all':!![]}];}return db[_0x2895('0x2d')][_0x2895('0x41')](_0x2f3c16);})[_0x2895('0x25')](function(_0x51f0d0){_0x269da1[_0x2895('0x42')]=_0x51f0d0;return _0x269da1;})[_0x2895('0x25')](respondWithFilteredResult(_0x349ed7,_0x2f3c16))['catch'](handleError(_0x349ed7,null));};exports[_0x2895('0x43')]=function(_0x14308c,_0x189319){var _0x20869d={'raw':!![],'where':{'id':_0x14308c[_0x2895('0x44')]['id']}},_0x2063ce={};_0x2063ce[_0x2895('0x30')]=_['keys'](db[_0x2895('0x2d')][_0x2895('0x45')]);_0x2063ce[_0x2895('0x32')]=_[_0x2895('0x46')](_0x14308c[_0x2895('0x32')]);_0x2063ce[_0x2895('0x33')]=_[_0x2895('0x34')](_0x2063ce['model'],_0x2063ce[_0x2895('0x32')]);_0x20869d[_0x2895('0x35')]=_[_0x2895('0x34')](_0x2063ce['model'],qs[_0x2895('0x36')](_0x14308c[_0x2895('0x32')][_0x2895('0x36')]));_0x20869d[_0x2895('0x35')]=_0x20869d[_0x2895('0x35')][_0x2895('0x37')]?_0x20869d[_0x2895('0x35')]:_0x2063ce[_0x2895('0x30')];if(_0x14308c[_0x2895('0x32')][_0x2895('0x3f')]){_0x20869d['include']=[{'all':!![]}];}_0x20869d=_[_0x2895('0x3d')]({},_0x20869d,_0x14308c['options']);return db['CmCustomField'][_0x2895('0x47')](_0x20869d)[_0x2895('0x25')](handleEntityNotFound(_0x189319,null))[_0x2895('0x25')](respondWithResult(_0x189319,null))[_0x2895('0x48')](handleError(_0x189319,null));};exports[_0x2895('0x49')]=function(_0x35e2db,_0x387a5c){if(_0x35e2db[_0x2895('0x4a')]['id']){delete _0x35e2db[_0x2895('0x4a')]['id'];}return db[_0x2895('0x2d')]['find']({'where':{'id':_0x35e2db[_0x2895('0x44')]['id']}})[_0x2895('0x25')](handleEntityNotFound(_0x387a5c,null))[_0x2895('0x25')](saveUpdates(_0x35e2db[_0x2895('0x4a')],null))[_0x2895('0x25')](respondWithResult(_0x387a5c,null))[_0x2895('0x48')](handleError(_0x387a5c,null));};exports['destroy']=function(_0x175b0d,_0x4b7217){return db[_0x2895('0x2d')][_0x2895('0x47')]({'where':{'id':_0x175b0d[_0x2895('0x44')]['id']}})[_0x2895('0x25')](handleEntityNotFound(_0x4b7217,null))[_0x2895('0x25')](removeEntity(_0x4b7217,null))[_0x2895('0x48')](handleError(_0x4b7217,null));};exports[_0x2895('0x4b')]=function(_0x5b82b5,_0x34d93c){var _0x3052a0;return db[_0x2895('0x4c')][_0x2895('0x4d')](function(_0x3d0e64){return db[_0x2895('0x2d')][_0x2895('0x4b')](_0x5b82b5[_0x2895('0x4a')],{'transaction':_0x3d0e64})[_0x2895('0x25')](function(_0x3c7dbb){_0x3052a0=_0x3c7dbb;var _0x130a85={'type':db[_0x2895('0x4e')][_0x2895('0x4f')],'transaction':_0x3d0e64};switch(_0x5b82b5[_0x2895('0x4a')]['type']){case'text':_0x130a85['type']=db[_0x2895('0x4e')][_0x2895('0x4f')];break;case _0x2895('0x50'):_0x130a85[_0x2895('0x3b')]=db[_0x2895('0x4e')][_0x2895('0x51')];break;case'switch':_0x130a85['type']=db[_0x2895('0x4e')][_0x2895('0x52')];_0x130a85['defaultValue']=![];break;default:}return db[_0x2895('0x4c')][_0x2895('0x53')][_0x2895('0x54')](_0x2895('0x55'),util[_0x2895('0x56')](_0x2895('0x57'),_0x3052a0['id']),_0x130a85);})[_0x2895('0x25')](function(){return _0x3052a0;});})['then'](respondWithResult(_0x34d93c,0xc9))['catch'](handleError(_0x34d93c,null));}; \ No newline at end of file +var _0xb6c2=['query','keys','intersection','attributes','fields','length','nolimit','order','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','filters','options','find','body','params','sequelize','transaction','create','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy'];(function(_0x279c80,_0x3c9692){var _0x4e1f5c=function(_0xe42af3){while(--_0xe42af3){_0x279c80['push'](_0x279c80['shift']());}};_0x4e1f5c(++_0x3c9692);}(_0xb6c2,0xd8));var _0x2b6c=function(_0x832e44,_0x34a340){_0x832e44=_0x832e44-0x0;var _0x40d52a=_0xb6c2[_0x832e44];return _0x40d52a;};'use strict';var emlformat=require(_0x2b6c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b6c('0x1'));var jsonpatch=require(_0x2b6c('0x2'));var rp=require(_0x2b6c('0x3'));var moment=require(_0x2b6c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2b6c('0x5'));var util=require(_0x2b6c('0x6'));var path=require(_0x2b6c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2b6c('0x8'));var fs=require('fs');var fs_extra=require(_0x2b6c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b6c('0xa'));var jsforce=require(_0x2b6c('0xb'));var deskjs=require(_0x2b6c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2b6c('0xd'));var Redis=require(_0x2b6c('0xe'));var authService=require(_0x2b6c('0xf'));var qs=require(_0x2b6c('0x10'));var as=require(_0x2b6c('0x11'));var hardwareService=require(_0x2b6c('0x12'));var logger=require('../../config/logger')(_0x2b6c('0x13'));var utils=require(_0x2b6c('0x14'));var config=require(_0x2b6c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b6c('0x16'))['db'];function respondWithStatusCode(_0x321251,_0x8c44cf){_0x8c44cf=_0x8c44cf||0xcc;return function(_0x17f2f4){if(_0x17f2f4){return _0x321251[_0x2b6c('0x17')](_0x8c44cf);}return _0x321251[_0x2b6c('0x18')](_0x8c44cf)['end']();};}function respondWithResult(_0x3bbb20,_0x4c62ef){_0x4c62ef=_0x4c62ef||0xc8;return function(_0x4ebe0f){if(_0x4ebe0f){return _0x3bbb20[_0x2b6c('0x18')](_0x4c62ef)[_0x2b6c('0x19')](_0x4ebe0f);}};}function respondWithFilteredResult(_0x3575c2,_0x4d182d){return function(_0x40d53e){if(_0x40d53e){var _0x4690f2=typeof _0x4d182d['offset']==='undefined'&&typeof _0x4d182d['limit']===_0x2b6c('0x1a');var _0x2c77ca=_0x40d53e[_0x2b6c('0x1b')];var _0x5894ba=_0x4690f2?0x0:_0x4d182d[_0x2b6c('0x1c')];var _0x404c32=_0x4690f2?_0x40d53e['count']:_0x4d182d['offset']+_0x4d182d[_0x2b6c('0x1d')];var _0x3821ea;if(_0x404c32>=_0x2c77ca){_0x404c32=_0x2c77ca;_0x3821ea=0xc8;}else{_0x3821ea=0xce;}_0x3575c2[_0x2b6c('0x18')](_0x3821ea);return _0x3575c2[_0x2b6c('0x1e')](_0x2b6c('0x1f'),_0x5894ba+'-'+_0x404c32+'/'+_0x2c77ca)['json'](_0x40d53e);}return null;};}function patchUpdates(_0x403b9f){return function(_0x36954d){try{jsonpatch[_0x2b6c('0x20')](_0x36954d,_0x403b9f,!![]);}catch(_0x2e3ffe){return BPromise[_0x2b6c('0x21')](_0x2e3ffe);}return _0x36954d[_0x2b6c('0x22')]();};}function saveUpdates(_0x192634,_0x46dead){return function(_0x1637eb){if(_0x1637eb){return _0x1637eb[_0x2b6c('0x23')](_0x192634)[_0x2b6c('0x24')](function(_0x171268){return _0x171268;});}return null;};}function removeEntity(_0x2ade00,_0x4f3280){return function(_0x453cd5){if(_0x453cd5){return _0x453cd5[_0x2b6c('0x25')]()['then'](function(){_0x2ade00[_0x2b6c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x620f90,_0x4ee36d){return function(_0x12909e){if(!_0x12909e){_0x620f90[_0x2b6c('0x17')](0x194);}return _0x12909e;};}function handleError(_0x2121a1,_0x16c519){_0x16c519=_0x16c519||0x1f4;return function(_0x2f9eca){logger[_0x2b6c('0x26')](_0x2f9eca[_0x2b6c('0x27')]);if(_0x2f9eca[_0x2b6c('0x28')]){delete _0x2f9eca[_0x2b6c('0x28')];}_0x2121a1['status'](_0x16c519)[_0x2b6c('0x29')](_0x2f9eca);};}exports[_0x2b6c('0x2a')]=function(_0x22dc98,_0x6c36de){var _0x4f2448={},_0x12ba26={},_0x54dc59={'count':0x0,'rows':[]};var _0x429513=_[_0x2b6c('0x2b')](db[_0x2b6c('0x2c')][_0x2b6c('0x2d')],function(_0x5c0f79){return{'name':_0x5c0f79[_0x2b6c('0x2e')],'type':_0x5c0f79[_0x2b6c('0x2f')][_0x2b6c('0x30')]};});_0x12ba26[_0x2b6c('0x31')]=_[_0x2b6c('0x32')](_[_0x2b6c('0x2b')](_0x429513,_0x2b6c('0x28')),[_0x2b6c('0x28')]);_0x12ba26[_0x2b6c('0x33')]=_[_0x2b6c('0x34')](_0x22dc98['query']);_0x12ba26['filters']=_[_0x2b6c('0x35')](_0x12ba26[_0x2b6c('0x31')],_0x12ba26[_0x2b6c('0x33')]);_0x4f2448[_0x2b6c('0x36')]=_[_0x2b6c('0x35')](_0x12ba26[_0x2b6c('0x31')],qs[_0x2b6c('0x37')](_0x22dc98[_0x2b6c('0x33')]['fields']));_0x4f2448[_0x2b6c('0x36')]=_0x4f2448[_0x2b6c('0x36')][_0x2b6c('0x38')]?_0x4f2448[_0x2b6c('0x36')]:_0x12ba26[_0x2b6c('0x31')];if(!_0x22dc98[_0x2b6c('0x33')]['hasOwnProperty'](_0x2b6c('0x39'))){_0x4f2448[_0x2b6c('0x1d')]=qs[_0x2b6c('0x1d')](_0x22dc98[_0x2b6c('0x33')]['limit']);_0x4f2448['offset']=qs[_0x2b6c('0x1c')](_0x22dc98['query'][_0x2b6c('0x1c')]);}_0x4f2448[_0x2b6c('0x3a')]=qs['sort'](_0x22dc98['query']['sort']);_0x4f2448['where']=qs['filters'](_['pick'](_0x22dc98[_0x2b6c('0x33')],_0x12ba26['filters']),_0x429513);if(_0x22dc98[_0x2b6c('0x33')][_0x2b6c('0x3b')]){_0x4f2448[_0x2b6c('0x3c')]=_[_0x2b6c('0x3d')](_0x4f2448[_0x2b6c('0x3c')],{'$or':_[_0x2b6c('0x2b')](_0x429513,function(_0x4acd2c){if(_0x4acd2c['type']!==_0x2b6c('0x3e')){var _0x1011b4={};_0x1011b4[_0x4acd2c[_0x2b6c('0x28')]]={'$like':'%'+_0x22dc98['query'][_0x2b6c('0x3b')]+'%'};return _0x1011b4;}})});}_0x4f2448=_[_0x2b6c('0x3d')]({},_0x4f2448,_0x22dc98['options']);var _0x3bdae2={'where':_0x4f2448[_0x2b6c('0x3c')]};return db[_0x2b6c('0x2c')][_0x2b6c('0x1b')](_0x3bdae2)['then'](function(_0x41c07a){_0x54dc59[_0x2b6c('0x1b')]=_0x41c07a;if(_0x22dc98['query'][_0x2b6c('0x3f')]){_0x4f2448[_0x2b6c('0x40')]=[{'all':!![]}];}return db[_0x2b6c('0x2c')][_0x2b6c('0x41')](_0x4f2448);})[_0x2b6c('0x24')](function(_0x4b5c75){_0x54dc59[_0x2b6c('0x42')]=_0x4b5c75;return _0x54dc59;})[_0x2b6c('0x24')](respondWithFilteredResult(_0x6c36de,_0x4f2448))[_0x2b6c('0x43')](handleError(_0x6c36de,null));};exports[_0x2b6c('0x44')]=function(_0x20d698,_0x4bd6a8){var _0x38a6f6={'raw':!![],'where':{'id':_0x20d698['params']['id']}},_0x3dee7b={};_0x3dee7b[_0x2b6c('0x31')]=_[_0x2b6c('0x34')](db[_0x2b6c('0x2c')][_0x2b6c('0x2d')]);_0x3dee7b['query']=_['keys'](_0x20d698['query']);_0x3dee7b[_0x2b6c('0x45')]=_[_0x2b6c('0x35')](_0x3dee7b[_0x2b6c('0x31')],_0x3dee7b[_0x2b6c('0x33')]);_0x38a6f6[_0x2b6c('0x36')]=_[_0x2b6c('0x35')](_0x3dee7b[_0x2b6c('0x31')],qs[_0x2b6c('0x37')](_0x20d698[_0x2b6c('0x33')][_0x2b6c('0x37')]));_0x38a6f6['attributes']=_0x38a6f6[_0x2b6c('0x36')][_0x2b6c('0x38')]?_0x38a6f6[_0x2b6c('0x36')]:_0x3dee7b[_0x2b6c('0x31')];if(_0x20d698[_0x2b6c('0x33')]['includeAll']){_0x38a6f6[_0x2b6c('0x40')]=[{'all':!![]}];}_0x38a6f6=_[_0x2b6c('0x3d')]({},_0x38a6f6,_0x20d698[_0x2b6c('0x46')]);return db[_0x2b6c('0x2c')][_0x2b6c('0x47')](_0x38a6f6)[_0x2b6c('0x24')](handleEntityNotFound(_0x4bd6a8,null))[_0x2b6c('0x24')](respondWithResult(_0x4bd6a8,null))[_0x2b6c('0x43')](handleError(_0x4bd6a8,null));};exports[_0x2b6c('0x23')]=function(_0x1517a4,_0x2b87d0){if(_0x1517a4[_0x2b6c('0x48')]['id']){delete _0x1517a4[_0x2b6c('0x48')]['id'];}return db[_0x2b6c('0x2c')][_0x2b6c('0x47')]({'where':{'id':_0x1517a4[_0x2b6c('0x49')]['id']}})[_0x2b6c('0x24')](handleEntityNotFound(_0x2b87d0,null))[_0x2b6c('0x24')](saveUpdates(_0x1517a4[_0x2b6c('0x48')],null))[_0x2b6c('0x24')](respondWithResult(_0x2b87d0,null))[_0x2b6c('0x43')](handleError(_0x2b87d0,null));};exports[_0x2b6c('0x25')]=function(_0x349bbd,_0x1f2c31){return db[_0x2b6c('0x2c')][_0x2b6c('0x47')]({'where':{'id':_0x349bbd[_0x2b6c('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f2c31,null))[_0x2b6c('0x24')](removeEntity(_0x1f2c31,null))['catch'](handleError(_0x1f2c31,null));};exports['create']=function(_0x4433db,_0x1d7a19){var _0x455cd7;return db[_0x2b6c('0x4a')][_0x2b6c('0x4b')](function(_0xfefd38){return db['CmCustomField'][_0x2b6c('0x4c')](_0x4433db[_0x2b6c('0x48')],{'transaction':_0xfefd38})[_0x2b6c('0x24')](function(_0x144b6c){_0x455cd7=_0x144b6c;var _0x1f90fd={'type':db[_0x2b6c('0x4d')][_0x2b6c('0x4e')],'transaction':_0xfefd38};switch(_0x4433db[_0x2b6c('0x48')][_0x2b6c('0x2f')]){case _0x2b6c('0x4f'):_0x1f90fd[_0x2b6c('0x2f')]=db['Sequelize'][_0x2b6c('0x4e')];break;case _0x2b6c('0x50'):_0x1f90fd[_0x2b6c('0x2f')]=db[_0x2b6c('0x4d')]['INTEGER'];break;case _0x2b6c('0x51'):_0x1f90fd[_0x2b6c('0x2f')]=db[_0x2b6c('0x4d')][_0x2b6c('0x52')];_0x1f90fd[_0x2b6c('0x53')]=![];break;default:}return db[_0x2b6c('0x4a')][_0x2b6c('0x54')][_0x2b6c('0x55')](_0x2b6c('0x56'),util[_0x2b6c('0x57')](_0x2b6c('0x58'),_0x455cd7['id']),_0x1f90fd);})[_0x2b6c('0x24')](function(){return _0x455cd7;});})[_0x2b6c('0x24')](respondWithResult(_0x1d7a19,0xc9))[_0x2b6c('0x43')](handleError(_0x1d7a19,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 1f3263a..506c896 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 _0xfaf9=['lodash','util','../../config/logger','api','rimraf','./cmCustomField.attributes','define'];(function(_0x2bd7dd,_0x2a8924){var _0x37b12a=function(_0x2d1f42){while(--_0x2d1f42){_0x2bd7dd['push'](_0x2bd7dd['shift']());}};_0x37b12a(++_0x2a8924);}(_0xfaf9,0x111));var _0x9faf=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xfaf9[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x9faf('0x0'));var util=require(_0x9faf('0x1'));var logger=require(_0x9faf('0x2'))(_0x9faf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9faf('0x4'));var config=require('../../config/environment');var attributes=require(_0x9faf('0x5'));module['exports']=function(_0x5800e7,_0x5be7e7){return _0x5800e7[_0x9faf('0x6')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b8a=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','api','moment','bluebird','rimraf'];(function(_0xad2fa8,_0x3c3b30){var _0x44ccc4=function(_0x473bda){while(--_0x473bda){_0xad2fa8['push'](_0xad2fa8['shift']());}};_0x44ccc4(++_0x3c3b30);}(_0x2b8a,0x10e));var _0xa2b8=function(_0x31b542,_0xd4a67d){_0x31b542=_0x31b542-0x0;var _0x225b8b=_0x2b8a[_0x31b542];return _0x225b8b;};'use strict';var _=require(_0xa2b8('0x0'));var util=require(_0xa2b8('0x1'));var logger=require('../../config/logger')(_0xa2b8('0x2'));var moment=require(_0xa2b8('0x3'));var BPromise=require(_0xa2b8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa2b8('0x5'));var config=require(_0xa2b8('0x6'));var attributes=require(_0xa2b8('0x7'));module[_0xa2b8('0x8')]=function(_0x42a333,_0x2b548e){return _0x42a333[_0xa2b8('0x9')](_0xa2b8('0xa'),attributes,{'tableName':_0xa2b8('0xb'),'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 9721452..497ef98 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 _0x95bb=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x95bb,0x1b2));var _0xb95b=function(_0x1649a0,_0x4c6f8a){_0x1649a0=_0x1649a0-0x0;var _0x573f2d=_0x95bb[_0x1649a0];return _0x573f2d;};'use strict';var _=require(_0xb95b('0x0'));var util=require(_0xb95b('0x1'));var moment=require(_0xb95b('0x2'));var BPromise=require(_0xb95b('0x3'));var rs=require(_0xb95b('0x4'));var fs=require('fs');var Redis=require(_0xb95b('0x5'));var db=require(_0xb95b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb95b('0x7'))('rpc');var config=require(_0xb95b('0x8'));var jayson=require(_0xb95b('0x9'));var client=jayson[_0xb95b('0xa')][_0xb95b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50302a,_0x26aab4,_0x41e01a){return new BPromise(function(_0x54d3db,_0x5ad263){return client[_0xb95b('0xc')](_0x50302a,_0x41e01a)[_0xb95b('0xd')](function(_0xbf53f2){logger[_0xb95b('0xe')](_0xb95b('0xf'),_0x26aab4,_0xb95b('0x10'));logger['debug'](_0xb95b('0x11'),_0x26aab4,_0xb95b('0x10'),JSON[_0xb95b('0x12')](_0xbf53f2));if(_0xbf53f2[_0xb95b('0x13')]){if(_0xbf53f2['error']['code']===0x1f4){logger[_0xb95b('0x13')](_0xb95b('0xf'),_0x26aab4,_0xbf53f2[_0xb95b('0x13')][_0xb95b('0x14')]);return _0x5ad263(_0xbf53f2[_0xb95b('0x13')][_0xb95b('0x14')]);}logger[_0xb95b('0x13')](_0xb95b('0xf'),_0x26aab4,_0xbf53f2[_0xb95b('0x13')][_0xb95b('0x14')]);return _0x54d3db(_0xbf53f2[_0xb95b('0x13')][_0xb95b('0x14')]);}else{logger['info'](_0xb95b('0xf'),_0x26aab4,_0xb95b('0x10'));_0x54d3db(_0xbf53f2['result'][_0xb95b('0x14')]);}})[_0xb95b('0x15')](function(_0xb8b9f5){logger[_0xb95b('0x13')](_0xb95b('0xf'),_0x26aab4,_0xb8b9f5);_0x5ad263(_0xb8b9f5);});});} \ No newline at end of file +var _0x570f=['../../config/utils','../../config/environment','jayson/promise','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x589360,_0xc3802e){var _0xf8b52c=function(_0xac4d16){while(--_0xac4d16){_0x589360['push'](_0x589360['shift']());}};_0xf8b52c(++_0xc3802e);}(_0x570f,0x176));var _0xf570=function(_0x331015,_0x22ef37){_0x331015=_0x331015-0x0;var _0x40f12e=_0x570f[_0x331015];return _0x40f12e;};'use strict';var _=require(_0xf570('0x0'));var util=require(_0xf570('0x1'));var moment=require(_0xf570('0x2'));var BPromise=require(_0xf570('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf570('0x4'));var db=require(_0xf570('0x5'))['db'];var utils=require(_0xf570('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf570('0x7'));var jayson=require(_0xf570('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xdc7411,_0x506f25,_0x2cda82){return new BPromise(function(_0x1954a4,_0x17e054){return client[_0xf570('0x9')](_0xdc7411,_0x2cda82)[_0xf570('0xa')](function(_0x11406a){logger['info'](_0xf570('0xb'),_0x506f25,_0xf570('0xc'));logger[_0xf570('0xd')](_0xf570('0xe'),_0x506f25,_0xf570('0xc'),JSON['stringify'](_0x11406a));if(_0x11406a[_0xf570('0xf')]){if(_0x11406a[_0xf570('0xf')][_0xf570('0x10')]===0x1f4){logger[_0xf570('0xf')](_0xf570('0xb'),_0x506f25,_0x11406a[_0xf570('0xf')]['message']);return _0x17e054(_0x11406a[_0xf570('0xf')][_0xf570('0x11')]);}logger[_0xf570('0xf')]('CmCustomField,\x20%s,\x20%s',_0x506f25,_0x11406a[_0xf570('0xf')]['message']);return _0x1954a4(_0x11406a['error'][_0xf570('0x11')]);}else{logger['info'](_0xf570('0xb'),_0x506f25,'request\x20sent');_0x1954a4(_0x11406a[_0xf570('0x12')]['message']);}})[_0xf570('0x13')](function(_0x3cc1b1){logger['error'](_0xf570('0xb'),_0x506f25,_0x3cc1b1);_0x17e054(_0x3cc1b1);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index acd69b1..3fb10e2 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 _0xdb2a=['isAuthenticated','index','post','create','/:id','update','destroy','multer','util','path','Router','fs-extra','../../components/interaction/service','./cmCustomField.controller','get'];(function(_0x24fd40,_0x312a5e){var _0x3fa698=function(_0x1811b7){while(--_0x1811b7){_0x24fd40['push'](_0x24fd40['shift']());}};_0x3fa698(++_0x312a5e);}(_0xdb2a,0x16f));var _0xadb2=function(_0x1c85b8,_0xb7db82){_0x1c85b8=_0x1c85b8-0x0;var _0x2156a7=_0xdb2a[_0x1c85b8];return _0x2156a7;};'use strict';var multer=require(_0xadb2('0x0'));var util=require(_0xadb2('0x1'));var path=require(_0xadb2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xadb2('0x3')]();var fs_extra=require(_0xadb2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xadb2('0x5'));var config=require('../../config/environment');var controller=require(_0xadb2('0x6'));router[_0xadb2('0x7')]('/',auth[_0xadb2('0x8')](),controller[_0xadb2('0x9')]);router[_0xadb2('0x7')]('/:id',auth[_0xadb2('0x8')](),controller['show']);router[_0xadb2('0xa')]('/',auth[_0xadb2('0x8')](),controller[_0xadb2('0xb')]);router['put'](_0xadb2('0xc'),auth[_0xadb2('0x8')](),controller[_0xadb2('0xd')]);router['delete'](_0xadb2('0xc'),auth['isAuthenticated'](),controller[_0xadb2('0xe')]);module['exports']=router; \ No newline at end of file +var _0xf181=['show','post','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x1f91b5,_0x552cbe){var _0x51ac38=function(_0x5a7c59){while(--_0x5a7c59){_0x1f91b5['push'](_0x1f91b5['shift']());}};_0x51ac38(++_0x552cbe);}(_0xf181,0x6c));var _0x1f18=function(_0x50b15b,_0x71ac13){_0x50b15b=_0x50b15b-0x0;var _0x1334e2=_0xf181[_0x50b15b];return _0x1334e2;};'use strict';var multer=require(_0x1f18('0x0'));var util=require(_0x1f18('0x1'));var path=require(_0x1f18('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1f18('0x3')]();var fs_extra=require(_0x1f18('0x4'));var auth=require(_0x1f18('0x5'));var interaction=require(_0x1f18('0x6'));var config=require(_0x1f18('0x7'));var controller=require('./cmCustomField.controller');router[_0x1f18('0x8')]('/',auth[_0x1f18('0x9')](),controller['index']);router[_0x1f18('0x8')](_0x1f18('0xa'),auth['isAuthenticated'](),controller[_0x1f18('0xb')]);router[_0x1f18('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1f18('0xd')](_0x1f18('0xa'),auth[_0x1f18('0x9')](),controller['update']);router[_0x1f18('0xe')](_0x1f18('0xa'),auth[_0x1f18('0x9')](),controller[_0x1f18('0xf')]);module[_0x1f18('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index a52477e..09b01e5 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 _0xe60b=['sequelize','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment'];(function(_0x1e0825,_0x4c4b2d){var _0x48570b=function(_0x487027){while(--_0x487027){_0x1e0825['push'](_0x1e0825['shift']());}};_0x48570b(++_0x4c4b2d);}(_0xe60b,0x128));var _0xbe60=function(_0x38f8a7,_0x4c56c3){_0x38f8a7=_0x38f8a7-0x0;var _0x39b798=_0xe60b[_0x38f8a7];return _0x39b798;};'use strict';var moment=require(_0xbe60('0x0'));var Sequelize=require(_0xbe60('0x1'));module['exports']={'phone':{'type':Sequelize[_0xbe60('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xbe60('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xbe60('0x4')],'defaultValue':moment()['format'](_0xbe60('0x5'))},'countbusyretry':{'type':Sequelize[_0xbe60('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbe60('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xbe60('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbe60('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbe60('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xbe60('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xbe60('0x6')],'unique':_0xbe60('0x8')},'ListId':{'type':Sequelize[_0xbe60('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xbe60('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xbe60('0x6')],'unique':_0xbe60('0x8')},'CampaignId':{'type':Sequelize[_0xbe60('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xbe60('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbe60('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbe60('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe234=['contactListQueue','moment','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x48756e,_0x5caa3d){var _0x1a17b6=function(_0x5de745){while(--_0x5de745){_0x48756e['push'](_0x48756e['shift']());}};_0x1a17b6(++_0x5caa3d);}(_0xe234,0x105));var _0x4e23=function(_0xf2eb50,_0x15c2c6){_0xf2eb50=_0xf2eb50-0x0;var _0x4fea29=_0xe234[_0xf2eb50];return _0x4fea29;};'use strict';var moment=require(_0x4e23('0x0'));var Sequelize=require('sequelize');module[_0x4e23('0x1')]={'phone':{'type':Sequelize[_0x4e23('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x4e23('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4e23('0x4')],'defaultValue':moment()[_0x4e23('0x5')](_0x4e23('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4e23('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4e23('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4e23('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x4e23('0x7')](0x2)[_0x4e23('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4e23('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4e23('0x7')],'unique':_0x4e23('0x9')},'ListId':{'type':Sequelize[_0x4e23('0x7')],'unique':_0x4e23('0x9')},'UserId':{'type':Sequelize[_0x4e23('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x4e23('0x9')},'CampaignId':{'type':Sequelize[_0x4e23('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x4e23('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4e23('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4e23('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4e23('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index a13be7d..dcd673b 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 _0x894f=['dialOrderByScheduledAt','sequelize','transaction','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','CmCompany','CmList','List','VoiceQueue','Queue','dialActive','update','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','CmHopper','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','includeAll','findAll','catch','params','rawAttributes','create','body','find','describe','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','outbound'];(function(_0x3db882,_0x31e3b7){var _0x34477a=function(_0x5098ae){while(--_0x5098ae){_0x3db882['push'](_0x3db882['shift']());}};_0x34477a(++_0x31e3b7);}(_0x894f,0x14d));var _0xf894=function(_0x334adf,_0x156fab){_0x334adf=_0x334adf-0x0;var _0x50968e=_0x894f[_0x334adf];return _0x50968e;};'use strict';var emlformat=require(_0xf894('0x0'));var rimraf=require(_0xf894('0x1'));var zipdir=require(_0xf894('0x2'));var jsonpatch=require(_0xf894('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf894('0x4'));var Mustache=require(_0xf894('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf894('0x6'));var csv=require(_0xf894('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf894('0x8'));var squel=require(_0xf894('0x9'));var crypto=require('crypto');var jsforce=require(_0xf894('0xa'));var deskjs=require(_0xf894('0xb'));var toCsv=require(_0xf894('0x7'));var querystring=require(_0xf894('0xc'));var Papa=require(_0xf894('0xd'));var Redis=require(_0xf894('0xe'));var authService=require(_0xf894('0xf'));var qs=require(_0xf894('0x10'));var as=require(_0xf894('0x11'));var hardwareService=require(_0xf894('0x12'));var logger=require(_0xf894('0x13'))(_0xf894('0x14'));var utils=require(_0xf894('0x15'));var config=require(_0xf894('0x16'));var licenseUtil=require(_0xf894('0x17'));var db=require(_0xf894('0x18'))['db'];function respondWithStatusCode(_0xd1691a,_0x157964){_0x157964=_0x157964||0xcc;return function(_0x4e674d){if(_0x4e674d){return _0xd1691a[_0xf894('0x19')](_0x157964);}return _0xd1691a[_0xf894('0x1a')](_0x157964)[_0xf894('0x1b')]();};}function respondWithResult(_0x56b168,_0x2c7a23){_0x2c7a23=_0x2c7a23||0xc8;return function(_0x4c75db){if(_0x4c75db){return _0x56b168['status'](_0x2c7a23)[_0xf894('0x1c')](_0x4c75db);}};}function respondWithFilteredResult(_0x131200,_0x171a73){return function(_0x17d5b0){if(_0x17d5b0){var _0x2142cb=typeof _0x171a73['offset']==='undefined'&&typeof _0x171a73[_0xf894('0x1d')]==='undefined';var _0x4d772b=_0x17d5b0[_0xf894('0x1e')];var _0x340345=_0x2142cb?0x0:_0x171a73[_0xf894('0x1f')];var _0x4bd77c=_0x2142cb?_0x17d5b0[_0xf894('0x1e')]:_0x171a73[_0xf894('0x1f')]+_0x171a73[_0xf894('0x1d')];var _0x5bd612;if(_0x4bd77c>=_0x4d772b){_0x4bd77c=_0x4d772b;_0x5bd612=0xc8;}else{_0x5bd612=0xce;}_0x131200['status'](_0x5bd612);return _0x131200[_0xf894('0x20')](_0xf894('0x21'),_0x340345+'-'+_0x4bd77c+'/'+_0x4d772b)[_0xf894('0x1c')](_0x17d5b0);}return null;};}function patchUpdates(_0x3abfd1){return function(_0x22a853){try{jsonpatch[_0xf894('0x22')](_0x22a853,_0x3abfd1,!![]);}catch(_0xdabf8){return BPromise[_0xf894('0x23')](_0xdabf8);}return _0x22a853[_0xf894('0x24')]();};}function saveUpdates(_0x25f67c,_0x1ccbd1){return function(_0xae4d17){if(_0xae4d17){return _0xae4d17['update'](_0x25f67c)[_0xf894('0x25')](function(_0x4f2d38){return _0x4f2d38;});}return null;};}function removeEntity(_0x50f461,_0x1250ec){return function(_0x441ec3){if(_0x441ec3){return _0x441ec3[_0xf894('0x26')]()[_0xf894('0x25')](function(){_0x50f461[_0xf894('0x1a')](0xcc)[_0xf894('0x1b')]();});}};}function handleEntityNotFound(_0x375020,_0x4d4ba3){return function(_0x29c774){if(!_0x29c774){_0x375020[_0xf894('0x19')](0x194);}return _0x29c774;};}function handleError(_0x1487fe,_0x3bf26f){_0x3bf26f=_0x3bf26f||0x1f4;return function(_0x126c39){logger[_0xf894('0x27')](_0x126c39[_0xf894('0x28')]);if(_0x126c39[_0xf894('0x29')]){delete _0x126c39[_0xf894('0x29')];}_0x1487fe[_0xf894('0x1a')](_0x3bf26f)[_0xf894('0x2a')](_0x126c39);};}exports[_0xf894('0x2b')]=function(_0x3c6e2c,_0x4e7312){var _0x211391={},_0x5eaeb9={},_0x1f52ff={'count':0x0,'rows':[]};var _0x14c494=_[_0xf894('0x2c')](db[_0xf894('0x2d')]['rawAttributes'],function(_0x116f4a){return{'name':_0x116f4a[_0xf894('0x2e')],'type':_0x116f4a[_0xf894('0x2f')][_0xf894('0x30')]};});_0x5eaeb9[_0xf894('0x31')]=_[_0xf894('0x2c')](_0x14c494,'name');_0x5eaeb9[_0xf894('0x32')]=_[_0xf894('0x33')](_0x3c6e2c[_0xf894('0x32')]);_0x5eaeb9[_0xf894('0x34')]=_[_0xf894('0x35')](_0x5eaeb9['model'],_0x5eaeb9[_0xf894('0x32')]);_0x5eaeb9['filters']=_[_0xf894('0x36')](_0x5eaeb9[_0xf894('0x34')],[_0xf894('0x37'),_0xf894('0x38'),_0xf894('0x39'),_0xf894('0x3a'),_0xf894('0x3b'),_0xf894('0x3c'),_0xf894('0x3d'),_0xf894('0x3e'),_0xf894('0x3f'),_0xf894('0x40'),'$notBetween',_0xf894('0x41'),_0xf894('0x42'),_0xf894('0x43'),_0xf894('0x44'),_0xf894('0x45'),_0xf894('0x46'),_0xf894('0x43'),_0xf894('0x47'),'$contains',_0xf894('0x48'),_0xf894('0x49')]);_0x211391['attributes']=_[_0xf894('0x35')](_0x5eaeb9[_0xf894('0x31')],qs[_0xf894('0x4a')](_0x3c6e2c[_0xf894('0x32')][_0xf894('0x4a')]));_0x211391[_0xf894('0x4b')]=_0x211391['attributes'][_0xf894('0x4c')]?_0x211391[_0xf894('0x4b')]:_0x5eaeb9[_0xf894('0x31')];if(!_0x3c6e2c['query'][_0xf894('0x4d')]('nolimit')){_0x211391['limit']=qs[_0xf894('0x1d')](_0x3c6e2c['query'][_0xf894('0x1d')]);_0x211391['offset']=qs[_0xf894('0x1f')](_0x3c6e2c[_0xf894('0x32')][_0xf894('0x1f')]);}_0x211391[_0xf894('0x4e')]=qs['sort'](_0x3c6e2c[_0xf894('0x32')]['sort']);_0x211391[_0xf894('0x4f')]=qs[_0xf894('0x34')](_[_0xf894('0x50')](_0x3c6e2c['query'],_0x5eaeb9['filters']),_0x14c494);if(_0x3c6e2c[_0xf894('0x32')]['filter']){_0x211391[_0xf894('0x4f')]=_['merge'](_0x211391['where'],{'$or':_[_0xf894('0x2c')](_0x14c494,function(_0x415420){if(_0x415420[_0xf894('0x2f')]!=='VIRTUAL'){var _0x164f05={};_0x164f05[_0x415420[_0xf894('0x29')]]={'$like':'%'+_0x3c6e2c[_0xf894('0x32')][_0xf894('0x51')]+'%'};return _0x164f05;}})});}_0x211391=_[_0xf894('0x52')]({},_0x211391,_0x3c6e2c['options']);var _0x46d06a={'where':_0x211391[_0xf894('0x4f')]};return db[_0xf894('0x2d')][_0xf894('0x1e')](_0x46d06a)['then'](function(_0x1f52ab){_0x1f52ff[_0xf894('0x1e')]=_0x1f52ab;if(_0x3c6e2c[_0xf894('0x32')][_0xf894('0x53')]){_0x211391['include']=[{'all':!![]}];}return db[_0xf894('0x2d')][_0xf894('0x54')](_0x211391);})['then'](function(_0x4d6d0a){_0x1f52ff['rows']=_0x4d6d0a;return _0x1f52ff;})[_0xf894('0x25')](respondWithFilteredResult(_0x4e7312,_0x211391))[_0xf894('0x55')](handleError(_0x4e7312,null));};exports['show']=function(_0x3cde68,_0x279409){var _0x1482ac={'raw':!![],'where':{'id':_0x3cde68[_0xf894('0x56')]['id']}},_0x43150b={};_0x43150b[_0xf894('0x31')]=_[_0xf894('0x33')](db['CmHopper'][_0xf894('0x57')]);_0x43150b[_0xf894('0x32')]=_['keys'](_0x3cde68[_0xf894('0x32')]);_0x43150b[_0xf894('0x34')]=_[_0xf894('0x35')](_0x43150b[_0xf894('0x31')],_0x43150b[_0xf894('0x32')]);_0x1482ac['attributes']=_['intersection'](_0x43150b[_0xf894('0x31')],qs[_0xf894('0x4a')](_0x3cde68[_0xf894('0x32')][_0xf894('0x4a')]));_0x1482ac[_0xf894('0x4b')]=_0x1482ac[_0xf894('0x4b')][_0xf894('0x4c')]?_0x1482ac[_0xf894('0x4b')]:_0x43150b[_0xf894('0x31')];if(_0x3cde68['query'][_0xf894('0x53')]){_0x1482ac['include']=[{'all':!![]}];}_0x1482ac=_[_0xf894('0x52')]({},_0x1482ac,_0x3cde68['options']);return db[_0xf894('0x2d')]['find'](_0x1482ac)['then'](handleEntityNotFound(_0x279409,null))['then'](respondWithResult(_0x279409,null))[_0xf894('0x55')](handleError(_0x279409,null));};exports[_0xf894('0x58')]=function(_0x5ad114,_0x3bd89d){return db['CmHopper']['create'](_0x5ad114['body'],{})[_0xf894('0x25')](respondWithResult(_0x3bd89d,0xc9))['catch'](handleError(_0x3bd89d,null));};exports['update']=function(_0x2fca25,_0x220d0e){if(_0x2fca25[_0xf894('0x59')]['id']){delete _0x2fca25[_0xf894('0x59')]['id'];}return db[_0xf894('0x2d')][_0xf894('0x5a')]({'where':{'id':_0x2fca25[_0xf894('0x56')]['id']}})[_0xf894('0x25')](handleEntityNotFound(_0x220d0e,null))[_0xf894('0x25')](saveUpdates(_0x2fca25[_0xf894('0x59')],null))[_0xf894('0x25')](respondWithResult(_0x220d0e,null))[_0xf894('0x55')](handleError(_0x220d0e,null));};exports[_0xf894('0x5b')]=function(_0x1a5d90,_0x2df8bb){return db['CmHopper'][_0xf894('0x5b')]()[_0xf894('0x25')](respondWithResult(_0x2df8bb,null))['catch'](handleError(_0x2df8bb,null));};exports[_0xf894('0x26')]=function(_0x52fcc9,_0x2a0380){var _0x5bc7b9;return db['CmHopper'][_0xf894('0x5a')]({'where':{'id':_0x52fcc9[_0xf894('0x56')]['id']}})[_0xf894('0x25')](handleEntityNotFound(_0x2a0380,null))[_0xf894('0x25')](function(_0x5a3a47){if(_0x5a3a47){return _0x5a3a47[_0xf894('0x26')]()[_0xf894('0x25')](function(_0x5ee59d){return _0x5ee59d;});}})[_0xf894('0x25')](function(_0x54ebc2){_0x5bc7b9=_0x54ebc2;if(_0x54ebc2){if(_0x54ebc2[_0xf894('0x5c')]||_0x54ebc2[_0xf894('0x5d')]){return db[_0x54ebc2[_0xf894('0x5c')]?'VoiceQueue':_0xf894('0x5e')][_0xf894('0x5a')]({'where':{'id':_0x54ebc2[_0xf894('0x5c')]?_0x54ebc2['VoiceQueueId']:_0x54ebc2[_0xf894('0x5d')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x56e8b0){var _0x2395d7={};if(_0x56e8b0){_['merge'](_0x2395d7,_[_0xf894('0x5f')](_0x5bc7b9[_0xf894('0x60')],[_0xf894('0x61'),_0xf894('0x62'),'id']));_0x2395d7[_0xf894('0x63')]=0x15;_0x2395d7[_0xf894('0x64')]=_0xf894('0x65');_0x2395d7[_0xf894('0x66')]=_0x56e8b0[_0xf894('0x29')];_0x2395d7[_0xf894('0x67')]=_0x52fcc9[_0xf894('0x68')][_0xf894('0x29')];_0x2395d7[_0xf894('0x69')]=_0x52fcc9[_0xf894('0x68')]['id'];_0x2395d7['deleted']=!![];_0x2395d7[_0xf894('0x6a')]=moment()[_0xf894('0x6b')](_0xf894('0x6c'));_0x2395d7[_0xf894('0x6d')]=_0x5bc7b9['phone'];_0x2395d7[_0xf894('0x6e')]=_0x5bc7b9[_0xf894('0x5c')]?'queue':'ivr';return db[_0xf894('0x6f')]['find']({'where':{'id':_0x2395d7[_0xf894('0x70')]},'attributes':[_0xf894('0x71'),_0xf894('0x72')]})[_0xf894('0x25')](function(_0xae85a2){if(!_[_0xf894('0x73')](_0x2a0380)&&!_['isNil'](_0xae85a2[_0xf894('0x71')])){_0x2395d7[_0xf894('0x74')]=_0xae85a2[_0xf894('0x71')];if(!_['isNil'](_0xae85a2[_0xf894('0x72')])){_0x2395d7[_0xf894('0x74')]+='\x20'+_0xae85a2[_0xf894('0x72')];}}})[_0xf894('0x75')](function(){return db[_0xf894('0x76')]['create'](_0x2395d7);});}})[_0xf894('0x25')](function(){return _0x2a0380[_0xf894('0x1a')](0xcc)['end']();})['catch'](handleError(_0x2a0380,null));};exports['getPreview']=function(_0x2d3e7c,_0x567393,_0x375d1c){var _0x413b95=[];return db['CmContact'][_0xf894('0x5b')]()['then'](function(_0x586f69){_0x413b95=_[_0xf894('0x33')](_0x586f69);return _0x2d3e7c['user']['getVoiceQueues']({'where':{'type':_0xf894('0x77'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xf894('0x78'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0xf894('0x25')](function(_0xfcc2c2){if(_0xfcc2c2&&_0xfcc2c2[_0xf894('0x4c')]){return db[_0xf894('0x79')][_0xf894('0x7a')](function(_0x324498){var _0x23b8b6={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf894('0x6b')](_0xf894('0x6c'))},'VoiceQueueId':{'$in':_[_0xf894('0x2c')](_0xfcc2c2,'id')},'$or':[{'UserId':null},{'UserId':_0x2d3e7c[_0xf894('0x68')]['id']}]};var _0x4cd661={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xfcc2c2)[_0xf894('0x51')]([_0xf894('0x7b'),0x0])[_0xf894('0x2c')]('id')[_0xf894('0x7c')]()},'$or':[{'UserId':null},{'UserId':_0x2d3e7c['user']['id']}]};var _0x1fcd38={'$or':[_0x23b8b6,_0x4cd661]};var _0x4de8c9=[];if(_0x2d3e7c['body']['direction']&&_0x2d3e7c[_0xf894('0x59')][_0xf894('0x7d')]===_0xf894('0x7e')){if(!_[_0xf894('0x7f')](_0x2d3e7c['body']['hopperIds'])){_0x1fcd38['id']={'$in':_0x2d3e7c['body'][_0xf894('0x80')]};}_0x4de8c9=[[_0xf894('0x81'),_0xf894('0x82')],['scheduledAt',_0xfcc2c2[0x0][_0xf894('0x78')]===_0xf894('0x82')?_0xf894('0x83'):_0xf894('0x82')],db['sequelize'][_0xf894('0x84')](_0xf894('0x85')),['id',_0xf894('0x83')]];}else{if(!_[_0xf894('0x7f')](_0x2d3e7c['body']['hopperIds'])){_0x1fcd38['id']={'$notIn':_0x2d3e7c['body'][_0xf894('0x80')]};}_0x4de8c9=[[_0xf894('0x81'),_0xf894('0x83')],[_0xf894('0x86'),_0xfcc2c2[0x0][_0xf894('0x78')]],db[_0xf894('0x79')][_0xf894('0x84')](_0xf894('0x87')),['id',_0xf894('0x82')]];}return db[_0xf894('0x2d')][_0xf894('0x88')]({'attributes':['id',_0xf894('0x89'),_0xf894('0x8a')],'where':_0x1fcd38,'order':_0x4de8c9,'transaction':_0x324498,'lock':_0x324498[_0xf894('0x8b')]['UPDATE'],'include':[{'model':db[_0xf894('0x6f')],'as':'Contact','attributes':_0x413b95,'include':[{'model':db[_0xf894('0x8c')],'as':'Company','attributes':['id',_0xf894('0x29')]}]},{'model':db[_0xf894('0x8d')],'as':_0xf894('0x8e'),'attributes':['id','name']},{'model':db[_0xf894('0x8f')],'as':_0xf894('0x90'),'attributes':['id',_0xf894('0x29'),_0xf894('0x91')]}]})[_0xf894('0x25')](function(_0x3eaacd){if(_0x3eaacd){return _0x3eaacd[_0xf894('0x92')]({'UserId':_0x2d3e7c[_0xf894('0x68')]['id']},{'transaction':_0x324498});}});});}})[_0xf894('0x25')](handleEntityNotFound(_0x567393,null))[_0xf894('0x25')](respondWithResult(_0x567393,null))['catch'](handleError(_0x567393,null));};exports['getOpenContacts']=function(_0x5bb5a7,_0x4bc365,_0x1d14f6){return _0x5bb5a7['user']['getVoiceQueues']({'where':{'type':_0xf894('0x77'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x819bbd){if(_0x819bbd&&_0x819bbd[_0xf894('0x4c')]){return db['CmHopper'][_0xf894('0x1e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf894('0x6b')](_0xf894('0x6c'))},'VoiceQueueId':{'$in':_[_0xf894('0x2c')](_0x819bbd,'id')},'$or':[{'UserId':null},{'UserId':_0x5bb5a7[_0xf894('0x68')]['id']}]}});}return 0x0;})['then'](function(_0x24d819){if(!_[_0xf894('0x73')](_0x24d819)&&_[_0xf894('0x93')](_0x24d819)){return _0x4bc365[_0xf894('0x1a')](0xc8)['json']({'contacts':_0x24d819});}else{logger[_0xf894('0x27')](_0xf894('0x94'),_0xf894('0x95'),0x194,_0xf894('0x96'));_0x4bc365[_0xf894('0x19')](0x194);}})[_0xf894('0x55')](handleError(_0x4bc365,null));}; \ No newline at end of file +var _0xc831=['offset','undefined','count','limit','set','then','error','name','send','index','CmHopper','fieldName','type','key','model','map','query','keys','filters','intersection','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$any','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','create','body','catch','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','omit','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','LOCK','Contact','CmCompany','Company','List','dialActive','update','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xc831,0x103));var _0x1c83=function(_0x2cebbc,_0x4a4937){_0x2cebbc=_0x2cebbc-0x0;var _0x4063a0=_0xc831[_0x2cebbc];return _0x4063a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c83('0x0'));var zipdir=require(_0x1c83('0x1'));var jsonpatch=require(_0x1c83('0x2'));var rp=require(_0x1c83('0x3'));var moment=require(_0x1c83('0x4'));var BPromise=require(_0x1c83('0x5'));var Mustache=require(_0x1c83('0x6'));var util=require(_0x1c83('0x7'));var path=require(_0x1c83('0x8'));var sox=require(_0x1c83('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c83('0xa'));var _=require('lodash');var squel=require(_0x1c83('0xb'));var crypto=require(_0x1c83('0xc'));var jsforce=require(_0x1c83('0xd'));var deskjs=require(_0x1c83('0xe'));var toCsv=require(_0x1c83('0xf'));var querystring=require('querystring');var Papa=require(_0x1c83('0x10'));var Redis=require(_0x1c83('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1c83('0x12'));var hardwareService=require(_0x1c83('0x13'));var logger=require(_0x1c83('0x14'))('api');var utils=require(_0x1c83('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1c83('0x16'))['db'];function respondWithStatusCode(_0x276377,_0x3128ec){_0x3128ec=_0x3128ec||0xcc;return function(_0x20a59f){if(_0x20a59f){return _0x276377[_0x1c83('0x17')](_0x3128ec);}return _0x276377[_0x1c83('0x18')](_0x3128ec)[_0x1c83('0x19')]();};}function respondWithResult(_0x5d5742,_0x43f74e){_0x43f74e=_0x43f74e||0xc8;return function(_0x1be133){if(_0x1be133){return _0x5d5742[_0x1c83('0x18')](_0x43f74e)[_0x1c83('0x1a')](_0x1be133);}};}function respondWithFilteredResult(_0x37ba9b,_0x4e1620){return function(_0x11acf1){if(_0x11acf1){var _0x18a06d=typeof _0x4e1620[_0x1c83('0x1b')]===_0x1c83('0x1c')&&typeof _0x4e1620['limit']===_0x1c83('0x1c');var _0x4a5025=_0x11acf1['count'];var _0x3b3369=_0x18a06d?0x0:_0x4e1620[_0x1c83('0x1b')];var _0x2ec743=_0x18a06d?_0x11acf1[_0x1c83('0x1d')]:_0x4e1620['offset']+_0x4e1620[_0x1c83('0x1e')];var _0x5642aa;if(_0x2ec743>=_0x4a5025){_0x2ec743=_0x4a5025;_0x5642aa=0xc8;}else{_0x5642aa=0xce;}_0x37ba9b[_0x1c83('0x18')](_0x5642aa);return _0x37ba9b[_0x1c83('0x1f')]('Content-Range',_0x3b3369+'-'+_0x2ec743+'/'+_0x4a5025)[_0x1c83('0x1a')](_0x11acf1);}return null;};}function patchUpdates(_0x1b5a71){return function(_0x5aa566){try{jsonpatch['apply'](_0x5aa566,_0x1b5a71,!![]);}catch(_0x4cd6bb){return BPromise['reject'](_0x4cd6bb);}return _0x5aa566['save']();};}function saveUpdates(_0x19abb8,_0x3e216d){return function(_0x5daab4){if(_0x5daab4){return _0x5daab4['update'](_0x19abb8)[_0x1c83('0x20')](function(_0x3c8123){return _0x3c8123;});}return null;};}function removeEntity(_0x2d041f,_0x58a7d5){return function(_0xb21f06){if(_0xb21f06){return _0xb21f06['destroy']()[_0x1c83('0x20')](function(){_0x2d041f[_0x1c83('0x18')](0xcc)[_0x1c83('0x19')]();});}};}function handleEntityNotFound(_0x1096ed,_0x2e452b){return function(_0x2982d3){if(!_0x2982d3){_0x1096ed[_0x1c83('0x17')](0x194);}return _0x2982d3;};}function handleError(_0x2beb2b,_0x2ed4a3){_0x2ed4a3=_0x2ed4a3||0x1f4;return function(_0x578c37){logger[_0x1c83('0x21')](_0x578c37['stack']);if(_0x578c37[_0x1c83('0x22')]){delete _0x578c37['name'];}_0x2beb2b[_0x1c83('0x18')](_0x2ed4a3)[_0x1c83('0x23')](_0x578c37);};}exports[_0x1c83('0x24')]=function(_0x341d8d,_0x3c027b){var _0x282df2={},_0x2671a9={},_0x2fb872={'count':0x0,'rows':[]};var _0x3cf5a2=_['map'](db[_0x1c83('0x25')]['rawAttributes'],function(_0x4af140){return{'name':_0x4af140[_0x1c83('0x26')],'type':_0x4af140[_0x1c83('0x27')][_0x1c83('0x28')]};});_0x2671a9[_0x1c83('0x29')]=_[_0x1c83('0x2a')](_0x3cf5a2,_0x1c83('0x22'));_0x2671a9[_0x1c83('0x2b')]=_[_0x1c83('0x2c')](_0x341d8d['query']);_0x2671a9[_0x1c83('0x2d')]=_[_0x1c83('0x2e')](_0x2671a9[_0x1c83('0x29')],_0x2671a9[_0x1c83('0x2b')]);_0x2671a9[_0x1c83('0x2d')]=_['concat'](_0x2671a9[_0x1c83('0x2d')],[_0x1c83('0x2f'),_0x1c83('0x30'),'$gt',_0x1c83('0x31'),_0x1c83('0x32'),_0x1c83('0x33'),_0x1c83('0x34'),_0x1c83('0x35'),_0x1c83('0x36'),_0x1c83('0x37'),_0x1c83('0x38'),_0x1c83('0x39'),'$notIn',_0x1c83('0x3a'),_0x1c83('0x3b'),_0x1c83('0x3c'),_0x1c83('0x3d'),_0x1c83('0x3a'),'$overlap','$contains','$contained',_0x1c83('0x3e')]);_0x282df2['attributes']=_[_0x1c83('0x2e')](_0x2671a9[_0x1c83('0x29')],qs[_0x1c83('0x3f')](_0x341d8d[_0x1c83('0x2b')][_0x1c83('0x3f')]));_0x282df2['attributes']=_0x282df2['attributes']['length']?_0x282df2[_0x1c83('0x40')]:_0x2671a9[_0x1c83('0x29')];if(!_0x341d8d[_0x1c83('0x2b')][_0x1c83('0x41')](_0x1c83('0x42'))){_0x282df2[_0x1c83('0x1e')]=qs[_0x1c83('0x1e')](_0x341d8d['query']['limit']);_0x282df2[_0x1c83('0x1b')]=qs[_0x1c83('0x1b')](_0x341d8d[_0x1c83('0x2b')][_0x1c83('0x1b')]);}_0x282df2[_0x1c83('0x43')]=qs[_0x1c83('0x44')](_0x341d8d[_0x1c83('0x2b')]['sort']);_0x282df2[_0x1c83('0x45')]=qs[_0x1c83('0x2d')](_[_0x1c83('0x46')](_0x341d8d[_0x1c83('0x2b')],_0x2671a9[_0x1c83('0x2d')]),_0x3cf5a2);if(_0x341d8d[_0x1c83('0x2b')][_0x1c83('0x47')]){_0x282df2[_0x1c83('0x45')]=_[_0x1c83('0x48')](_0x282df2[_0x1c83('0x45')],{'$or':_[_0x1c83('0x2a')](_0x3cf5a2,function(_0x2da758){if(_0x2da758[_0x1c83('0x27')]!==_0x1c83('0x49')){var _0x5a3ae7={};_0x5a3ae7[_0x2da758[_0x1c83('0x22')]]={'$like':'%'+_0x341d8d[_0x1c83('0x2b')]['filter']+'%'};return _0x5a3ae7;}})});}_0x282df2=_[_0x1c83('0x48')]({},_0x282df2,_0x341d8d[_0x1c83('0x4a')]);var _0x1db0d2={'where':_0x282df2[_0x1c83('0x45')]};return db[_0x1c83('0x25')][_0x1c83('0x1d')](_0x1db0d2)[_0x1c83('0x20')](function(_0xf5cd63){_0x2fb872['count']=_0xf5cd63;if(_0x341d8d[_0x1c83('0x2b')][_0x1c83('0x4b')]){_0x282df2[_0x1c83('0x4c')]=[{'all':!![]}];}return db[_0x1c83('0x25')][_0x1c83('0x4d')](_0x282df2);})[_0x1c83('0x20')](function(_0x306408){_0x2fb872[_0x1c83('0x4e')]=_0x306408;return _0x2fb872;})['then'](respondWithFilteredResult(_0x3c027b,_0x282df2))['catch'](handleError(_0x3c027b,null));};exports[_0x1c83('0x4f')]=function(_0x19adeb,_0x40ca6e){var _0x23c975={'raw':!![],'where':{'id':_0x19adeb['params']['id']}},_0x14ed10={};_0x14ed10[_0x1c83('0x29')]=_['keys'](db['CmHopper']['rawAttributes']);_0x14ed10[_0x1c83('0x2b')]=_['keys'](_0x19adeb[_0x1c83('0x2b')]);_0x14ed10[_0x1c83('0x2d')]=_[_0x1c83('0x2e')](_0x14ed10[_0x1c83('0x29')],_0x14ed10[_0x1c83('0x2b')]);_0x23c975[_0x1c83('0x40')]=_[_0x1c83('0x2e')](_0x14ed10[_0x1c83('0x29')],qs['fields'](_0x19adeb[_0x1c83('0x2b')][_0x1c83('0x3f')]));_0x23c975[_0x1c83('0x40')]=_0x23c975[_0x1c83('0x40')][_0x1c83('0x50')]?_0x23c975['attributes']:_0x14ed10['model'];if(_0x19adeb[_0x1c83('0x2b')][_0x1c83('0x4b')]){_0x23c975[_0x1c83('0x4c')]=[{'all':!![]}];}_0x23c975=_[_0x1c83('0x48')]({},_0x23c975,_0x19adeb[_0x1c83('0x4a')]);return db['CmHopper'][_0x1c83('0x51')](_0x23c975)[_0x1c83('0x20')](handleEntityNotFound(_0x40ca6e,null))[_0x1c83('0x20')](respondWithResult(_0x40ca6e,null))['catch'](handleError(_0x40ca6e,null));};exports[_0x1c83('0x52')]=function(_0xe30a50,_0x2aa850){return db[_0x1c83('0x25')][_0x1c83('0x52')](_0xe30a50[_0x1c83('0x53')],{})[_0x1c83('0x20')](respondWithResult(_0x2aa850,0xc9))[_0x1c83('0x54')](handleError(_0x2aa850,null));};exports['update']=function(_0x223234,_0x1c4c63){if(_0x223234[_0x1c83('0x53')]['id']){delete _0x223234['body']['id'];}return db['CmHopper']['find']({'where':{'id':_0x223234[_0x1c83('0x55')]['id']}})[_0x1c83('0x20')](handleEntityNotFound(_0x1c4c63,null))['then'](saveUpdates(_0x223234[_0x1c83('0x53')],null))[_0x1c83('0x20')](respondWithResult(_0x1c4c63,null))[_0x1c83('0x54')](handleError(_0x1c4c63,null));};exports[_0x1c83('0x56')]=function(_0x5f3a0c,_0x452c64){return db[_0x1c83('0x25')][_0x1c83('0x56')]()[_0x1c83('0x20')](respondWithResult(_0x452c64,null))[_0x1c83('0x54')](handleError(_0x452c64,null));};exports['destroy']=function(_0x4eb057,_0x176049){var _0x48186f;return db['CmHopper'][_0x1c83('0x51')]({'where':{'id':_0x4eb057[_0x1c83('0x55')]['id']}})['then'](handleEntityNotFound(_0x176049,null))[_0x1c83('0x20')](function(_0x5173c4){if(_0x5173c4){return _0x5173c4[_0x1c83('0x57')]()['then'](function(_0x27b719){return _0x27b719;});}})[_0x1c83('0x20')](function(_0x12305f){_0x48186f=_0x12305f;if(_0x12305f){if(_0x12305f[_0x1c83('0x58')]||_0x12305f['CampaignId']){return db[_0x12305f['VoiceQueueId']?_0x1c83('0x59'):_0x1c83('0x5a')][_0x1c83('0x51')]({'where':{'id':_0x12305f[_0x1c83('0x58')]?_0x12305f['VoiceQueueId']:_0x12305f['CampaignId']},'attributes':['id',_0x1c83('0x22')],'raw':!![]});}}})['then'](function(_0x2d5d27){var _0x4992d2={};if(_0x2d5d27){_[_0x1c83('0x48')](_0x4992d2,_[_0x1c83('0x5b')](_0x48186f['dataValues'],['createdAt',_0x1c83('0x5c'),'id']));_0x4992d2[_0x1c83('0x5d')]=0x15;_0x4992d2[_0x1c83('0x5e')]=_0x1c83('0x5f');_0x4992d2[_0x1c83('0x60')]=_0x2d5d27['name'];_0x4992d2[_0x1c83('0x61')]=_0x4eb057[_0x1c83('0x62')][_0x1c83('0x22')];_0x4992d2[_0x1c83('0x63')]=_0x4eb057[_0x1c83('0x62')]['id'];_0x4992d2['deleted']=!![];_0x4992d2[_0x1c83('0x64')]=moment()[_0x1c83('0x65')](_0x1c83('0x66'));_0x4992d2[_0x1c83('0x67')]=_0x48186f['phone'];_0x4992d2[_0x1c83('0x68')]=_0x48186f[_0x1c83('0x58')]?_0x1c83('0x69'):_0x1c83('0x6a');return db[_0x1c83('0x6b')]['find']({'where':{'id':_0x4992d2[_0x1c83('0x6c')]},'attributes':[_0x1c83('0x6d'),_0x1c83('0x6e')]})[_0x1c83('0x20')](function(_0xc4103e){if(!_[_0x1c83('0x6f')](_0x176049)&&!_[_0x1c83('0x6f')](_0xc4103e['firstName'])){_0x4992d2[_0x1c83('0x70')]=_0xc4103e['firstName'];if(!_[_0x1c83('0x6f')](_0xc4103e['lastName'])){_0x4992d2['calleridname']+='\x20'+_0xc4103e[_0x1c83('0x6e')];}}})['finally'](function(){return db[_0x1c83('0x71')][_0x1c83('0x52')](_0x4992d2);});}})[_0x1c83('0x20')](function(){return _0x176049[_0x1c83('0x18')](0xcc)['end']();})[_0x1c83('0x54')](handleError(_0x176049,null));};exports[_0x1c83('0x72')]=function(_0x3a61c9,_0x219e18,_0x5d80b4){var _0x5f91b1=[];return db[_0x1c83('0x6b')][_0x1c83('0x56')]()[_0x1c83('0x20')](function(_0x34f235){_0x5f91b1=_[_0x1c83('0x2c')](_0x34f235);return _0x3a61c9[_0x1c83('0x62')]['getVoiceQueues']({'where':{'type':_0x1c83('0x73'),'dialActive':!![],'dialMethod':_0x1c83('0x74')},'attributes':['id',_0x1c83('0x75'),_0x1c83('0x76')],'raw':!![]});})[_0x1c83('0x20')](function(_0x478c1){if(_0x478c1&&_0x478c1[_0x1c83('0x50')]){return db[_0x1c83('0x77')][_0x1c83('0x78')](function(_0x548cd9){var _0x36920e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1c83('0x65')](_0x1c83('0x66'))},'VoiceQueueId':{'$in':_['map'](_0x478c1,'id')},'$or':[{'UserId':null},{'UserId':_0x3a61c9['user']['id']}]};var _0x9a08f7={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x478c1)[_0x1c83('0x47')]([_0x1c83('0x76'),0x0])[_0x1c83('0x2a')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x3a61c9['user']['id']}]};var _0x577ccd={'$or':[_0x36920e,_0x9a08f7]};var _0x8ddae2=[];if(_0x3a61c9[_0x1c83('0x53')][_0x1c83('0x79')]&&_0x3a61c9[_0x1c83('0x53')]['direction']===_0x1c83('0x7a')){if(!_[_0x1c83('0x7b')](_0x3a61c9[_0x1c83('0x53')][_0x1c83('0x7c')])){_0x577ccd['id']={'$in':_0x3a61c9['body'][_0x1c83('0x7c')]};}_0x8ddae2=[[_0x1c83('0x7d'),_0x1c83('0x7e')],[_0x1c83('0x7f'),_0x478c1[0x0][_0x1c83('0x75')]===_0x1c83('0x7e')?'DESC':_0x1c83('0x7e')],db[_0x1c83('0x77')][_0x1c83('0x80')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x1c83('0x81')]];}else{if(!_[_0x1c83('0x7b')](_0x3a61c9[_0x1c83('0x53')][_0x1c83('0x7c')])){_0x577ccd['id']={'$notIn':_0x3a61c9[_0x1c83('0x53')][_0x1c83('0x7c')]};}_0x8ddae2=[['priority',_0x1c83('0x81')],[_0x1c83('0x7f'),_0x478c1[0x0]['dialOrderByScheduledAt']],db[_0x1c83('0x77')][_0x1c83('0x80')](_0x1c83('0x82')),['id','ASC']];}return db['CmHopper']['findOne']({'attributes':['id','scheduledat','recallme'],'where':_0x577ccd,'order':_0x8ddae2,'transaction':_0x548cd9,'lock':_0x548cd9[_0x1c83('0x83')]['UPDATE'],'include':[{'model':db[_0x1c83('0x6b')],'as':_0x1c83('0x84'),'attributes':_0x5f91b1,'include':[{'model':db[_0x1c83('0x85')],'as':_0x1c83('0x86'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x1c83('0x87'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x1c83('0x22'),_0x1c83('0x88')]}]})[_0x1c83('0x20')](function(_0x5ccc9b){if(_0x5ccc9b){return _0x5ccc9b[_0x1c83('0x89')]({'UserId':_0x3a61c9[_0x1c83('0x62')]['id']},{'transaction':_0x548cd9});}});});}})[_0x1c83('0x20')](handleEntityNotFound(_0x219e18,null))[_0x1c83('0x20')](respondWithResult(_0x219e18,null))[_0x1c83('0x54')](handleError(_0x219e18,null));};exports['getOpenContacts']=function(_0x505009,_0x1321b0,_0x3a6817){return _0x505009[_0x1c83('0x62')][_0x1c83('0x8a')]({'where':{'type':_0x1c83('0x73'),'dialActive':!![],'dialMethod':_0x1c83('0x74')},'attributes':['id'],'raw':!![]})[_0x1c83('0x20')](function(_0x1686ef){if(_0x1686ef&&_0x1686ef[_0x1c83('0x50')]){return db[_0x1c83('0x25')][_0x1c83('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1c83('0x65')](_0x1c83('0x66'))},'VoiceQueueId':{'$in':_[_0x1c83('0x2a')](_0x1686ef,'id')},'$or':[{'UserId':null},{'UserId':_0x505009[_0x1c83('0x62')]['id']}]}});}return 0x0;})[_0x1c83('0x20')](function(_0x962579){if(!_['isNil'](_0x962579)&&_[_0x1c83('0x8b')](_0x962579)){return _0x1321b0[_0x1c83('0x18')](0xc8)[_0x1c83('0x1a')]({'contacts':_0x962579});}else{logger[_0x1c83('0x21')](_0x1c83('0x8c'),_0x1c83('0x8d'),0x194,_0x1c83('0x8e'));_0x1321b0[_0x1c83('0x17')](0x194);}})[_0x1c83('0x54')](handleError(_0x1321b0,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 09643d1..ec1de61 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 _0x4819=['request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','CmHopper','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird'];(function(_0x35125c,_0x4747a4){var _0x5cc31b=function(_0x3adb33){while(--_0x3adb33){_0x35125c['push'](_0x35125c['shift']());}};_0x5cc31b(++_0x4747a4);}(_0x4819,0xcd));var _0x9481=function(_0xaaa123,_0x4c23e3){_0xaaa123=_0xaaa123-0x0;var _0x44d6d7=_0x4819[_0xaaa123];return _0x44d6d7;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[{'name':_0x9481('0xc'),'fields':[_0x9481('0xc')]},{'name':_0x9481('0xd'),'fields':['phone']},{'name':_0x9481('0xe'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api'];(function(_0x427fcd,_0x484232){var _0x468197=function(_0x4148eb){while(--_0x4148eb){_0x427fcd['push'](_0x427fcd['shift']());}};_0x468197(++_0x484232);}(_0x7096,0x10c));var _0x6709=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x7096[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x6709('0xd')]},{'name':_0x6709('0xe'),'fields':[_0x6709('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index d4ac291..5ab9bb5 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 _0x66ca=['code','message','result','catch','GetCmHopper','CmHopper','findAll','options','where','limit','include','map','model','attributes','find','raw','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','User','Agent','voicePause','length','UserId','push','update','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','UPDATE','GetContactRecallMe','GetCmHopperPreview','Contact','keys','ResetActiveCalls','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x159520,_0x733bea){var _0x2d25f3=function(_0x29bb3e){while(--_0x29bb3e){_0x159520['push'](_0x159520['shift']());}};_0x2d25f3(++_0x733bea);}(_0x66ca,0xd7));var _0xa66c=function(_0x577077,_0x52f056){_0x577077=_0x577077-0x0;var _0x370769=_0x66ca[_0x577077];return _0x370769;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa66c('0x0'));var rs=require(_0xa66c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa66c('0x2'));var logger=require(_0xa66c('0x3'))(_0xa66c('0x4'));var config=require('../../config/environment');var jayson=require(_0xa66c('0x5'));var client=jayson[_0xa66c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fc162,_0x174030,_0x53ae40){return new BPromise(function(_0x55ab7e,_0x3db16a){return client[_0xa66c('0x7')](_0x2fc162,_0x53ae40)[_0xa66c('0x8')](function(_0x3481e5){logger[_0xa66c('0x9')](_0xa66c('0xa'),_0x174030,_0xa66c('0xb'));logger[_0xa66c('0xc')](_0xa66c('0xd'),_0x174030,_0xa66c('0xb'),JSON[_0xa66c('0xe')](_0x3481e5));if(_0x3481e5[_0xa66c('0xf')]){if(_0x3481e5[_0xa66c('0xf')][_0xa66c('0x10')]===0x1f4){logger[_0xa66c('0xf')](_0xa66c('0xa'),_0x174030,_0x3481e5[_0xa66c('0xf')]['message']);return _0x3db16a(_0x3481e5['error']['message']);}logger['error'](_0xa66c('0xa'),_0x174030,_0x3481e5[_0xa66c('0xf')][_0xa66c('0x11')]);return _0x55ab7e(_0x3481e5[_0xa66c('0xf')][_0xa66c('0x11')]);}else{logger[_0xa66c('0x9')](_0xa66c('0xa'),_0x174030,_0xa66c('0xb'));_0x55ab7e(_0x3481e5[_0xa66c('0x12')]['message']);}})[_0xa66c('0x13')](function(_0x379362){logger[_0xa66c('0xf')](_0xa66c('0xa'),_0x174030,_0x379362);_0x3db16a(_0x379362);});});}exports[_0xa66c('0x14')]=function(_0x119e51){var _0xc03e2e=this;return new Promise(function(_0x3535eb,_0x331d41){return db[_0xa66c('0x15')][_0xa66c('0x16')]({'raw':_0x119e51['options']?_0x119e51[_0xa66c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x119e51[_0xa66c('0x17')]?_0x119e51[_0xa66c('0x17')][_0xa66c('0x18')]||null:null,'attributes':_0x119e51['options']?_0x119e51[_0xa66c('0x17')]['attributes']||null:null,'limit':_0x119e51[_0xa66c('0x17')]?_0x119e51[_0xa66c('0x17')][_0xa66c('0x19')]||null:null,'include':_0x119e51[_0xa66c('0x17')]?_0x119e51[_0xa66c('0x17')][_0xa66c('0x1a')]?_[_0xa66c('0x1b')](_0x119e51[_0xa66c('0x17')][_0xa66c('0x1a')],function(_0x8c92e0){return{'model':db[_0x8c92e0[_0xa66c('0x1c')]],'as':_0x8c92e0['as'],'attributes':_0x8c92e0[_0xa66c('0x1d')],'include':_0x8c92e0['include']?_[_0xa66c('0x1b')](_0x8c92e0[_0xa66c('0x1a')],function(_0x567fee){return{'model':db[_0x567fee['model']],'as':_0x567fee['as'],'attributes':_0x567fee[_0xa66c('0x1d')],'include':_0x567fee['include']?_[_0xa66c('0x1b')](_0x567fee['include'],function(_0x5eea58){return{'model':db[_0x5eea58[_0xa66c('0x1c')]],'as':_0x5eea58['as'],'attributes':_0x5eea58[_0xa66c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa66c('0x8')](function(_0x582d2c){logger[_0xa66c('0x9')](_0xa66c('0x14'),_0x119e51);logger['debug'](_0xa66c('0x14'),_0x119e51,JSON[_0xa66c('0xe')](_0x582d2c));_0x3535eb(_0x582d2c);})[_0xa66c('0x13')](function(_0x2ae412){logger[_0xa66c('0xf')](_0xa66c('0x14'),_0x2ae412[_0xa66c('0x11')],_0x119e51);_0x331d41(_0xc03e2e['error'](0x1f4,_0x2ae412[_0xa66c('0x11')]));});});};exports['ShowCmHopper']=function(_0x488c7f){var _0x13feb5=this;return new Promise(function(_0x5b2bb5,_0x498fef){return db[_0xa66c('0x15')][_0xa66c('0x1e')]({'raw':_0x488c7f[_0xa66c('0x17')]?_0x488c7f['options'][_0xa66c('0x1f')]===undefined?!![]:![]:!![],'where':_0x488c7f[_0xa66c('0x17')]?_0x488c7f[_0xa66c('0x17')][_0xa66c('0x18')]||null:null,'attributes':_0x488c7f[_0xa66c('0x17')]?_0x488c7f[_0xa66c('0x17')]['attributes']||null:null,'include':_0x488c7f[_0xa66c('0x17')]?_0x488c7f[_0xa66c('0x17')][_0xa66c('0x1a')]?_[_0xa66c('0x1b')](_0x488c7f[_0xa66c('0x17')]['include'],function(_0xe47bda){return{'model':db[_0xe47bda[_0xa66c('0x1c')]],'as':_0xe47bda['as'],'attributes':_0xe47bda[_0xa66c('0x1d')],'include':_0xe47bda[_0xa66c('0x1a')]?_['map'](_0xe47bda[_0xa66c('0x1a')],function(_0x37bee6){return{'model':db[_0x37bee6['model']],'as':_0x37bee6['as'],'attributes':_0x37bee6[_0xa66c('0x1d')],'include':_0x37bee6[_0xa66c('0x1a')]?_['map'](_0x37bee6[_0xa66c('0x1a')],function(_0x247425){return{'model':db[_0x247425[_0xa66c('0x1c')]],'as':_0x247425['as'],'attributes':_0x247425['attributes']};}):[]};}):[]};}):[]:[]})[_0xa66c('0x8')](function(_0x1410a2){logger['info'](_0xa66c('0x20'),_0x488c7f);logger[_0xa66c('0xc')](_0xa66c('0x20'),_0x488c7f,JSON[_0xa66c('0xe')](_0x1410a2));_0x5b2bb5(_0x1410a2);})['catch'](function(_0x42cf56){logger[_0xa66c('0xf')](_0xa66c('0x20'),_0x42cf56[_0xa66c('0x11')],_0x488c7f);_0x498fef(_0x13feb5[_0xa66c('0xf')](0x1f4,_0x42cf56[_0xa66c('0x11')]));});});};exports[_0xa66c('0x21')]=function(_0x28c381){var _0x1cb115=this;return new Promise(function(_0x1f8de9,_0x393aa7){return db[_0xa66c('0x15')][_0xa66c('0x22')](_0x28c381[_0xa66c('0x23')],{'raw':_0x28c381[_0xa66c('0x17')]?_0x28c381['options']['raw']===undefined?!![]:![]:!![]})[_0xa66c('0x8')](function(_0x413505){logger[_0xa66c('0x9')](_0xa66c('0x21'),_0x28c381);logger[_0xa66c('0xc')](_0xa66c('0x21'),_0x28c381,JSON[_0xa66c('0xe')](_0x413505));_0x1f8de9(_0x413505);})['catch'](function(_0x48b00c){logger[_0xa66c('0xf')]('CreateCmHopper',_0x48b00c[_0xa66c('0x11')],_0x28c381);_0x393aa7(_0x1cb115[_0xa66c('0xf')](0x1f4,_0x48b00c[_0xa66c('0x11')]));});});};exports[_0xa66c('0x24')]=function(_0xbcf033){var _0x2bca4e=this;return new Promise(function(_0x18fc26,_0x226144){return db['CmHopper']['update'](_0xbcf033['body'],{'raw':_0xbcf033['options']?_0xbcf033[_0xa66c('0x17')][_0xa66c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbcf033[_0xa66c('0x17')]?_0xbcf033[_0xa66c('0x17')][_0xa66c('0x18')]||null:null,'attributes':_0xbcf033[_0xa66c('0x17')]?_0xbcf033[_0xa66c('0x17')][_0xa66c('0x1d')]||null:null,'limit':_0xbcf033[_0xa66c('0x17')]?_0xbcf033[_0xa66c('0x17')][_0xa66c('0x19')]||null:null})[_0xa66c('0x8')](function(_0x2a0d2c){logger[_0xa66c('0x9')]('UpdateCmHopper',_0xbcf033);logger['info'](_0xa66c('0x25'),JSON[_0xa66c('0xe')](_0xbcf033[_0xa66c('0x17')][_0xa66c('0x18')]),_0xbcf033['body']['active']);logger[_0xa66c('0xc')](_0xa66c('0x24'),_0xbcf033,JSON['stringify'](_0x2a0d2c));_0x18fc26(_0x2a0d2c);})[_0xa66c('0x13')](function(_0x43e5f0){logger['error'](_0xa66c('0x24'),_0x43e5f0['message'],_0xbcf033);_0x226144(_0x2bca4e[_0xa66c('0xf')](0x1f4,_0x43e5f0[_0xa66c('0x11')]));});});};exports['DestroyCmHopper']=function(_0x556fc1){var _0x30b8e5=this;return new Promise(function(_0x4f6800,_0x4e6d05){return db['CmHopper'][_0xa66c('0x26')]({'where':_0x556fc1[_0xa66c('0x17')]?_0x556fc1[_0xa66c('0x17')][_0xa66c('0x18')]||null:null})[_0xa66c('0x8')](function(_0x5d7f9e){logger[_0xa66c('0x9')]('DestroyCmHopper',_0x556fc1);logger[_0xa66c('0xc')](_0xa66c('0x27'),_0x556fc1,JSON['stringify'](_0x5d7f9e));_0x4f6800(_0x5d7f9e);})[_0xa66c('0x13')](function(_0x497807){logger[_0xa66c('0xf')](_0xa66c('0x27'),_0x497807[_0xa66c('0x11')],_0x556fc1);_0x4e6d05(_0x30b8e5[_0xa66c('0xf')](0x1f4,_0x497807[_0xa66c('0x11')]));});});};exports[_0xa66c('0x28')]=function(_0x4f405f){var _0x2b8201=this;return new Promise(function(_0xd8aef0,_0x3b3e42){return db[_0xa66c('0x29')][_0xa66c('0x2a')]()[_0xa66c('0x8')](function(_0x24f6c8){return db[_0xa66c('0x2b')][_0xa66c('0x2c')](function(_0xf530d){return db[_0xa66c('0x15')][_0xa66c('0x16')]({'where':_0x4f405f[_0xa66c('0x17')]?_0x4f405f['options']['where']||null:null,'attributes':_0x4f405f[_0xa66c('0x17')]?_0x4f405f['options'][_0xa66c('0x1d')]||null:null,'limit':_0x4f405f['options']?_0x4f405f[_0xa66c('0x17')][_0xa66c('0x19')]||null:null,'order':_0x4f405f[_0xa66c('0x17')]?_0x4f405f[_0xa66c('0x17')][_0xa66c('0x2d')]||null:null,'transaction':_0xf530d,'lock':_0xf530d[_0xa66c('0x2e')]['UPDATE'],'include':[{'model':db[_0xa66c('0x29')],'as':'Contact','attributes':_['keys'](_0x24f6c8)},{'model':db[_0xa66c('0x2f')],'as':_0xa66c('0x30'),'attributes':['id','name',_0xa66c('0x31')]}]})[_0xa66c('0x8')](function(_0x79e9af){var _0xd85391=[];var _0x43e0cb=[];for(var _0x3728fd=0x0;_0x3728fd<_0x79e9af[_0xa66c('0x32')];_0x3728fd+=0x1){var _0x4b40b2=_0x79e9af[_0x3728fd][_0xa66c('0x33')];if(_0x4b40b2===null){_0xd85391[_0xa66c('0x34')](_0x79e9af[_0x3728fd][_0xa66c('0x35')](_0x4f405f[_0xa66c('0x23')],{'transaction':_0xf530d}));}else if(!_0x43e0cb[_0xa66c('0x36')](_0x4b40b2)){_0x43e0cb[_0xa66c('0x34')](_0x4b40b2);_0xd85391[_0xa66c('0x34')](_0x79e9af[_0x3728fd][_0xa66c('0x35')](_0x4f405f[_0xa66c('0x23')],{'transaction':_0xf530d}));}}return BPromise[_0xa66c('0x37')](_0xd85391);});})['then'](function(_0x15cb64){logger[_0xa66c('0x9')]('GetContactDialer',_0x4f405f);if(_0x15cb64['length']>0x0){logger['info'](_0xa66c('0x38'),_0x15cb64[0x0]['dataValues']['id'],_0x15cb64[0x0][_0xa66c('0x39')][_0xa66c('0x3a')],_0x15cb64[0x0][_0xa66c('0x39')]['active']);}logger[_0xa66c('0xc')]('GetContactDialer',_0x4f405f,JSON[_0xa66c('0xe')](_0x15cb64));_0xd8aef0(_0x15cb64);})['catch'](function(_0x1088d0){logger[_0xa66c('0xf')](_0xa66c('0x28'),_0x1088d0['message'],_0x4f405f);_0x3b3e42(_0x2b8201[_0xa66c('0xf')](0x1f4,_0x1088d0[_0xa66c('0x11')]));});});});};exports['MoveContactManagedDialer']=function(_0x40385b){var _0x2c8c0b=this;return new Promise(function(_0x2dff7b,_0x23e043){return db['sequelize']['transaction'](function(_0x147400){return db['CmHopperFinal'][_0xa66c('0x22')](_0x40385b[_0xa66c('0x23')],{'raw':_0x40385b['options']?_0x40385b[_0xa66c('0x17')][_0xa66c('0x1f')]===undefined?!![]:![]:!![],'transaction':_0x147400})[_0xa66c('0x8')](function(){logger[_0xa66c('0x9')](_0xa66c('0x3b'),JSON[_0xa66c('0xe')](_0x40385b[_0xa66c('0x17')][_0xa66c('0x18')]),_0x40385b['options']['where'][_0xa66c('0x3c')]);return db[_0xa66c('0x15')][_0xa66c('0x26')]({'where':_0x40385b[_0xa66c('0x17')]?_0x40385b[_0xa66c('0x17')]['where']||null:null,'transaction':_0x147400});});})['then'](function(_0x57c963){logger[_0xa66c('0x9')]('MoveContactManagedDialer',_0x40385b);logger[_0xa66c('0xc')](_0xa66c('0x3d'),_0x40385b,JSON[_0xa66c('0xe')](_0x57c963));_0x2dff7b(_0x57c963);})[_0xa66c('0x13')](function(_0x1720d4){logger['error'](_0xa66c('0x3d'),_0x1720d4[_0xa66c('0x11')],_0x40385b);_0x23e043(_0x2c8c0b[_0xa66c('0xf')](0x1f4,_0x1720d4[_0xa66c('0x11')]));});});};exports[_0xa66c('0x3e')]=function(_0x311167){var _0xc54f45=this;return new Promise(function(_0x26fcee,_0x482a1c){return db['CmHopper'][_0xa66c('0x16')]({'raw':_0x311167[_0xa66c('0x17')]?_0x311167[_0xa66c('0x17')][_0xa66c('0x1f')]===undefined?!![]:![]:!![],'where':_0x311167[_0xa66c('0x17')]?_0x311167[_0xa66c('0x17')]['where']||null:null,'attributes':[[db[_0xa66c('0x2b')]['fn'](_0xa66c('0x3f'),db['sequelize']['fn']('IF',db['sequelize'][_0xa66c('0x40')](_0xa66c('0x41')+util[_0xa66c('0x42')](_0xa66c('0x43'),moment()[_0xa66c('0x42')](_0xa66c('0x44')))+_0xa66c('0x45')))),_0xa66c('0x46')]]})[_0xa66c('0x8')](function(_0x5d1025){logger[_0xa66c('0x9')]('CountReScheduled',_0x311167);logger[_0xa66c('0xc')](_0xa66c('0x3e'),_0x311167,JSON[_0xa66c('0xe')](_0x5d1025));_0x26fcee(_0x5d1025);})[_0xa66c('0x13')](function(_0x475d1d){logger[_0xa66c('0xf')](_0xa66c('0x3e'),_0x475d1d[_0xa66c('0x11')],_0x311167);_0x482a1c(_0xc54f45[_0xa66c('0xf')](0x1f4,_0x475d1d[_0xa66c('0x11')]));});});};exports['GetContactRecallMe']=function(_0x33e96a){var _0x2e5c33=this;return new Promise(function(_0x42f978,_0x88fd9){return db[_0xa66c('0x29')][_0xa66c('0x2a')]()[_0xa66c('0x8')](function(_0x3f3e1a){return db[_0xa66c('0x2b')]['transaction'](function(_0x873295){return db['CmHopper']['findAll']({'where':_0x33e96a[_0xa66c('0x17')]?_0x33e96a[_0xa66c('0x17')][_0xa66c('0x18')]||null:null,'attributes':_0x33e96a[_0xa66c('0x17')]?_0x33e96a['options']['attributes']||null:null,'limit':0x1,'order':_0x33e96a[_0xa66c('0x17')]?_0x33e96a['options']['order']||null:null,'group':db['CmHopper'][_0xa66c('0x33')],'transaction':_0x873295,'lock':_0x873295[_0xa66c('0x2e')][_0xa66c('0x47')],'include':_0x33e96a[_0xa66c('0x17')]?_0x33e96a['options']['include']?_['map'](_0x33e96a[_0xa66c('0x17')][_0xa66c('0x1a')],function(_0x1ad16a){return{'model':db[_0x1ad16a[_0xa66c('0x1c')]],'as':_0x1ad16a['as'],'attributes':_0x1ad16a[_0xa66c('0x1d')],'include':_0x1ad16a[_0xa66c('0x1a')]?_[_0xa66c('0x1b')](_0x1ad16a['include'],function(_0x200c07){return{'model':db[_0x200c07[_0xa66c('0x1c')]],'as':_0x200c07['as'],'attributes':_0x200c07[_0xa66c('0x1d')],'include':_0x200c07['include']?_[_0xa66c('0x1b')](_0x200c07[_0xa66c('0x1a')],function(_0x403aac){return{'model':db[_0x403aac[_0xa66c('0x1c')]],'as':_0x403aac['as'],'attributes':_0x403aac[_0xa66c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa66c('0x8')](function(_0x4da025){var _0x5a4198=[];for(var _0xf9cdb2=0x0;_0xf9cdb2<_0x4da025['length'];_0xf9cdb2+=0x1){_0x5a4198[_0xa66c('0x34')](_0x4da025[_0xf9cdb2][_0xa66c('0x35')](_0x33e96a[_0xa66c('0x23')],{'transaction':_0x873295}));}return BPromise[_0xa66c('0x37')](_0x5a4198);});})[_0xa66c('0x8')](function(_0x11c3c5){logger[_0xa66c('0x9')](_0xa66c('0x48'),_0x33e96a);logger[_0xa66c('0xc')](_0xa66c('0x48'),_0x33e96a,JSON[_0xa66c('0xe')](_0x11c3c5));_0x42f978(_0x11c3c5);})[_0xa66c('0x13')](function(_0x2d61ca){logger['error'](_0xa66c('0x48'),_0x2d61ca[_0xa66c('0x11')],_0x33e96a);_0x88fd9(_0x2e5c33['error'](0x1f4,_0x2d61ca[_0xa66c('0x11')]));});});});};exports[_0xa66c('0x49')]=function(_0x438917){var _0x969185=this;return new Promise(function(_0xbe757e,_0x4492f3){db[_0xa66c('0x29')][_0xa66c('0x2a')]()['then'](function(_0x252122){return db[_0xa66c('0x15')][_0xa66c('0x16')]({'raw':_0x438917[_0xa66c('0x17')]?_0x438917['options'][_0xa66c('0x1f')]===undefined?!![]:![]:!![],'where':_0x438917[_0xa66c('0x17')]?_0x438917['options'][_0xa66c('0x18')]||null:null,'attributes':_0x438917['options']?_0x438917[_0xa66c('0x17')]['attributes']||null:null,'limit':_0x438917[_0xa66c('0x17')]?_0x438917[_0xa66c('0x17')][_0xa66c('0x19')]||null:null,'include':_0x438917[_0xa66c('0x17')]?_0x438917['options'][_0xa66c('0x1a')]?_[_0xa66c('0x1b')](_0x438917[_0xa66c('0x17')][_0xa66c('0x1a')],function(_0x387bf6){return{'model':db[_0x387bf6[_0xa66c('0x1c')]],'as':_0x387bf6['as'],'attributes':_0x387bf6['as']===_0xa66c('0x4a')?_[_0xa66c('0x4b')](_0x252122):_0x387bf6[_0xa66c('0x1d')],'include':_0x387bf6[_0xa66c('0x1a')]?_[_0xa66c('0x1b')](_0x387bf6[_0xa66c('0x1a')],function(_0x488282){return{'model':db[_0x488282['model']],'as':_0x488282['as'],'attributes':_0x488282[_0xa66c('0x1d')],'include':_0x488282[_0xa66c('0x1a')]?_[_0xa66c('0x1b')](_0x488282[_0xa66c('0x1a')],function(_0x4b633c){return{'model':db[_0x4b633c[_0xa66c('0x1c')]],'as':_0x4b633c['as'],'attributes':_0x4b633c[_0xa66c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa66c('0x8')](function(_0x31ce8e){logger[_0xa66c('0x9')](_0xa66c('0x14'),_0x438917);logger[_0xa66c('0xc')](_0xa66c('0x14'),_0x438917,JSON[_0xa66c('0xe')](_0x31ce8e));_0xbe757e(_0x31ce8e);})[_0xa66c('0x13')](function(_0x563247){logger[_0xa66c('0xf')](_0xa66c('0x14'),_0x563247['message'],_0x438917);_0x4492f3(_0x969185[_0xa66c('0xf')](0x1f4,_0x563247['message']));});});});};exports['ResetActiveCalls']=function(_0x559aa1){var _0x230345=this;return new Promise(function(_0x4adf03,_0x4a8703){return db[_0xa66c('0x2b')][_0xa66c('0x2c')](function(_0x243973){return db[_0xa66c('0x15')][_0xa66c('0x35')]({'active':![]},{'where':{},'transaction':_0x243973})['then'](function(_0x3f16c5){logger[_0xa66c('0x9')]('ResetActiveCalls',_0x559aa1);logger[_0xa66c('0xc')](_0xa66c('0x4c'),_0x559aa1,JSON['stringify'](_0x3f16c5));_0x4adf03(_0x3f16c5);})[_0xa66c('0x13')](function(_0x1a8ab0){logger[_0xa66c('0xf')](_0xa66c('0x4c'),_0x1a8ab0[_0xa66c('0x11')],_0x559aa1);_0x4a8703(_0x230345[_0xa66c('0xf')](0x1f4,_0x1a8ab0['message']));});});});}; \ No newline at end of file +var _0xd590=['destroy','GetContactDialer','CmContact','describe','transaction','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','update','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','all','GetCmHopperPreview','ResetActiveCalls','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper'];(function(_0x33dd45,_0x5c37f8){var _0x2c3b0f=function(_0x295f79){while(--_0x295f79){_0x33dd45['push'](_0x33dd45['shift']());}};_0x2c3b0f(++_0x5c37f8);}(_0xd590,0x166));var _0x0d59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd590[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0d59('0x0'));var util=require(_0x0d59('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0d59('0x2'));var fs=require('fs');var Redis=require(_0x0d59('0x3'));var db=require(_0x0d59('0x4'))['db'];var utils=require(_0x0d59('0x5'));var logger=require(_0x0d59('0x6'))(_0x0d59('0x7'));var config=require(_0x0d59('0x8'));var jayson=require(_0x0d59('0x9'));var client=jayson[_0x0d59('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dff72,_0x24c204,_0x432332){return new BPromise(function(_0x140538,_0x669b33){return client[_0x0d59('0xb')](_0x5dff72,_0x432332)[_0x0d59('0xc')](function(_0x55db5b){logger[_0x0d59('0xd')](_0x0d59('0xe'),_0x24c204,_0x0d59('0xf'));logger[_0x0d59('0x10')](_0x0d59('0x11'),_0x24c204,'request\x20sent',JSON[_0x0d59('0x12')](_0x55db5b));if(_0x55db5b[_0x0d59('0x13')]){if(_0x55db5b[_0x0d59('0x13')][_0x0d59('0x14')]===0x1f4){logger['error'](_0x0d59('0xe'),_0x24c204,_0x55db5b[_0x0d59('0x13')][_0x0d59('0x15')]);return _0x669b33(_0x55db5b['error'][_0x0d59('0x15')]);}logger['error'](_0x0d59('0xe'),_0x24c204,_0x55db5b[_0x0d59('0x13')]['message']);return _0x140538(_0x55db5b[_0x0d59('0x13')]['message']);}else{logger[_0x0d59('0xd')]('CmHopper,\x20%s,\x20%s',_0x24c204,_0x0d59('0xf'));_0x140538(_0x55db5b[_0x0d59('0x16')][_0x0d59('0x15')]);}})['catch'](function(_0x2a6432){logger[_0x0d59('0x13')](_0x0d59('0xe'),_0x24c204,_0x2a6432);_0x669b33(_0x2a6432);});});}exports[_0x0d59('0x17')]=function(_0x5979e3){var _0x307e05=this;return new Promise(function(_0x3875f4,_0x5eae1b){return db[_0x0d59('0x18')][_0x0d59('0x19')]({'raw':_0x5979e3['options']?_0x5979e3[_0x0d59('0x1a')][_0x0d59('0x1b')]===undefined?!![]:![]:!![],'where':_0x5979e3['options']?_0x5979e3[_0x0d59('0x1a')][_0x0d59('0x1c')]||null:null,'attributes':_0x5979e3[_0x0d59('0x1a')]?_0x5979e3[_0x0d59('0x1a')][_0x0d59('0x1d')]||null:null,'limit':_0x5979e3[_0x0d59('0x1a')]?_0x5979e3[_0x0d59('0x1a')][_0x0d59('0x1e')]||null:null,'include':_0x5979e3[_0x0d59('0x1a')]?_0x5979e3[_0x0d59('0x1a')][_0x0d59('0x1f')]?_[_0x0d59('0x20')](_0x5979e3[_0x0d59('0x1a')][_0x0d59('0x1f')],function(_0x106581){return{'model':db[_0x106581['model']],'as':_0x106581['as'],'attributes':_0x106581[_0x0d59('0x1d')],'include':_0x106581[_0x0d59('0x1f')]?_[_0x0d59('0x20')](_0x106581[_0x0d59('0x1f')],function(_0x2f1601){return{'model':db[_0x2f1601[_0x0d59('0x21')]],'as':_0x2f1601['as'],'attributes':_0x2f1601['attributes'],'include':_0x2f1601[_0x0d59('0x1f')]?_[_0x0d59('0x20')](_0x2f1601[_0x0d59('0x1f')],function(_0x5aa1ab){return{'model':db[_0x5aa1ab[_0x0d59('0x21')]],'as':_0x5aa1ab['as'],'attributes':_0x5aa1ab['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x29dd01){logger[_0x0d59('0xd')]('GetCmHopper',_0x5979e3);logger['debug'](_0x0d59('0x17'),_0x5979e3,JSON[_0x0d59('0x12')](_0x29dd01));_0x3875f4(_0x29dd01);})[_0x0d59('0x22')](function(_0x1d0bd3){logger['error'](_0x0d59('0x17'),_0x1d0bd3[_0x0d59('0x15')],_0x5979e3);_0x5eae1b(_0x307e05[_0x0d59('0x13')](0x1f4,_0x1d0bd3[_0x0d59('0x15')]));});});};exports[_0x0d59('0x23')]=function(_0xbd75c7){var _0xecfedb=this;return new Promise(function(_0x1b1ecc,_0x138b16){return db[_0x0d59('0x18')]['find']({'raw':_0xbd75c7[_0x0d59('0x1a')]?_0xbd75c7[_0x0d59('0x1a')][_0x0d59('0x1b')]===undefined?!![]:![]:!![],'where':_0xbd75c7['options']?_0xbd75c7[_0x0d59('0x1a')][_0x0d59('0x1c')]||null:null,'attributes':_0xbd75c7[_0x0d59('0x1a')]?_0xbd75c7[_0x0d59('0x1a')]['attributes']||null:null,'include':_0xbd75c7[_0x0d59('0x1a')]?_0xbd75c7['options'][_0x0d59('0x1f')]?_['map'](_0xbd75c7[_0x0d59('0x1a')][_0x0d59('0x1f')],function(_0x1225bb){return{'model':db[_0x1225bb[_0x0d59('0x21')]],'as':_0x1225bb['as'],'attributes':_0x1225bb['attributes'],'include':_0x1225bb['include']?_[_0x0d59('0x20')](_0x1225bb[_0x0d59('0x1f')],function(_0x41fea8){return{'model':db[_0x41fea8[_0x0d59('0x21')]],'as':_0x41fea8['as'],'attributes':_0x41fea8['attributes'],'include':_0x41fea8[_0x0d59('0x1f')]?_[_0x0d59('0x20')](_0x41fea8[_0x0d59('0x1f')],function(_0x5eb92a){return{'model':db[_0x5eb92a[_0x0d59('0x21')]],'as':_0x5eb92a['as'],'attributes':_0x5eb92a[_0x0d59('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0d59('0xc')](function(_0x54acd1){logger['info'](_0x0d59('0x23'),_0xbd75c7);logger[_0x0d59('0x10')](_0x0d59('0x23'),_0xbd75c7,JSON[_0x0d59('0x12')](_0x54acd1));_0x1b1ecc(_0x54acd1);})[_0x0d59('0x22')](function(_0x22266c){logger['error'](_0x0d59('0x23'),_0x22266c[_0x0d59('0x15')],_0xbd75c7);_0x138b16(_0xecfedb['error'](0x1f4,_0x22266c['message']));});});};exports[_0x0d59('0x24')]=function(_0x1754dd){var _0x370123=this;return new Promise(function(_0x49527e,_0x152ca3){return db[_0x0d59('0x18')][_0x0d59('0x25')](_0x1754dd[_0x0d59('0x26')],{'raw':_0x1754dd[_0x0d59('0x1a')]?_0x1754dd['options']['raw']===undefined?!![]:![]:!![]})[_0x0d59('0xc')](function(_0x3e4710){logger[_0x0d59('0xd')]('CreateCmHopper',_0x1754dd);logger[_0x0d59('0x10')]('CreateCmHopper',_0x1754dd,JSON['stringify'](_0x3e4710));_0x49527e(_0x3e4710);})[_0x0d59('0x22')](function(_0x4c3bd4){logger[_0x0d59('0x13')](_0x0d59('0x24'),_0x4c3bd4[_0x0d59('0x15')],_0x1754dd);_0x152ca3(_0x370123[_0x0d59('0x13')](0x1f4,_0x4c3bd4[_0x0d59('0x15')]));});});};exports[_0x0d59('0x27')]=function(_0x265342){var _0x26bde4=this;return new Promise(function(_0x58b3b6,_0x24d4a0){return db[_0x0d59('0x18')]['update'](_0x265342[_0x0d59('0x26')],{'raw':_0x265342[_0x0d59('0x1a')]?_0x265342[_0x0d59('0x1a')][_0x0d59('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x265342[_0x0d59('0x1a')]?_0x265342[_0x0d59('0x1a')][_0x0d59('0x1c')]||null:null,'attributes':_0x265342[_0x0d59('0x1a')]?_0x265342[_0x0d59('0x1a')][_0x0d59('0x1d')]||null:null,'limit':_0x265342[_0x0d59('0x1a')]?_0x265342[_0x0d59('0x1a')]['limit']||null:null})[_0x0d59('0xc')](function(_0x49884d){logger[_0x0d59('0xd')](_0x0d59('0x27'),_0x265342);logger[_0x0d59('0xd')](_0x0d59('0x28'),JSON['stringify'](_0x265342[_0x0d59('0x1a')][_0x0d59('0x1c')]),_0x265342[_0x0d59('0x26')]['active']);logger[_0x0d59('0x10')](_0x0d59('0x27'),_0x265342,JSON[_0x0d59('0x12')](_0x49884d));_0x58b3b6(_0x49884d);})[_0x0d59('0x22')](function(_0x13f63a){logger[_0x0d59('0x13')](_0x0d59('0x27'),_0x13f63a[_0x0d59('0x15')],_0x265342);_0x24d4a0(_0x26bde4['error'](0x1f4,_0x13f63a[_0x0d59('0x15')]));});});};exports[_0x0d59('0x29')]=function(_0x7a3f57){var _0x17c1ef=this;return new Promise(function(_0x73eb91,_0xacf7a7){return db['CmHopper'][_0x0d59('0x2a')]({'where':_0x7a3f57[_0x0d59('0x1a')]?_0x7a3f57['options'][_0x0d59('0x1c')]||null:null})[_0x0d59('0xc')](function(_0x221ae7){logger[_0x0d59('0xd')]('DestroyCmHopper',_0x7a3f57);logger[_0x0d59('0x10')](_0x0d59('0x29'),_0x7a3f57,JSON[_0x0d59('0x12')](_0x221ae7));_0x73eb91(_0x221ae7);})[_0x0d59('0x22')](function(_0xdd92b2){logger[_0x0d59('0x13')](_0x0d59('0x29'),_0xdd92b2[_0x0d59('0x15')],_0x7a3f57);_0xacf7a7(_0x17c1ef[_0x0d59('0x13')](0x1f4,_0xdd92b2[_0x0d59('0x15')]));});});};exports[_0x0d59('0x2b')]=function(_0x1c8e4b){var _0x7cc0af=this;return new Promise(function(_0xa8aae2,_0x11c22a){return db[_0x0d59('0x2c')][_0x0d59('0x2d')]()[_0x0d59('0xc')](function(_0x1f9f8b){return db['sequelize'][_0x0d59('0x2e')](function(_0x17017c){return db['CmHopper'][_0x0d59('0x19')]({'where':_0x1c8e4b[_0x0d59('0x1a')]?_0x1c8e4b[_0x0d59('0x1a')][_0x0d59('0x1c')]||null:null,'attributes':_0x1c8e4b[_0x0d59('0x1a')]?_0x1c8e4b[_0x0d59('0x1a')][_0x0d59('0x1d')]||null:null,'limit':_0x1c8e4b[_0x0d59('0x1a')]?_0x1c8e4b[_0x0d59('0x1a')]['limit']||null:null,'order':_0x1c8e4b[_0x0d59('0x1a')]?_0x1c8e4b[_0x0d59('0x1a')]['order']||null:null,'transaction':_0x17017c,'lock':_0x17017c[_0x0d59('0x2f')][_0x0d59('0x30')],'include':[{'model':db[_0x0d59('0x2c')],'as':_0x0d59('0x31'),'attributes':_[_0x0d59('0x32')](_0x1f9f8b)},{'model':db[_0x0d59('0x33')],'as':_0x0d59('0x34'),'attributes':['id',_0x0d59('0x35'),_0x0d59('0x36')]}]})[_0x0d59('0xc')](function(_0x4c75c1){var _0x2f3c8d=[];var _0x20aabd=[];for(var _0x4a8e1d=0x0;_0x4a8e1d<_0x4c75c1[_0x0d59('0x37')];_0x4a8e1d+=0x1){var _0x1192ab=_0x4c75c1[_0x4a8e1d]['UserId'];if(_0x1192ab===null){_0x2f3c8d[_0x0d59('0x38')](_0x4c75c1[_0x4a8e1d][_0x0d59('0x39')](_0x1c8e4b['body'],{'transaction':_0x17017c}));}else if(!_0x20aabd['includes'](_0x1192ab)){_0x20aabd[_0x0d59('0x38')](_0x1192ab);_0x2f3c8d['push'](_0x4c75c1[_0x4a8e1d][_0x0d59('0x39')](_0x1c8e4b[_0x0d59('0x26')],{'transaction':_0x17017c}));}}return BPromise['all'](_0x2f3c8d);});})[_0x0d59('0xc')](function(_0x562cad){logger[_0x0d59('0xd')](_0x0d59('0x2b'),_0x1c8e4b);if(_0x562cad[_0x0d59('0x37')]>0x0){logger[_0x0d59('0xd')](_0x0d59('0x3a'),_0x562cad[0x0][_0x0d59('0x3b')]['id'],_0x562cad[0x0][_0x0d59('0x3b')][_0x0d59('0x3c')],_0x562cad[0x0][_0x0d59('0x3b')][_0x0d59('0x3d')]);}logger[_0x0d59('0x10')](_0x0d59('0x2b'),_0x1c8e4b,JSON[_0x0d59('0x12')](_0x562cad));_0xa8aae2(_0x562cad);})[_0x0d59('0x22')](function(_0x310c79){logger[_0x0d59('0x13')](_0x0d59('0x2b'),_0x310c79[_0x0d59('0x15')],_0x1c8e4b);_0x11c22a(_0x7cc0af['error'](0x1f4,_0x310c79[_0x0d59('0x15')]));});});});};exports[_0x0d59('0x3e')]=function(_0x224b57){var _0x44663c=this;return new Promise(function(_0x355544,_0x312023){return db[_0x0d59('0x3f')][_0x0d59('0x2e')](function(_0x23f748){return db[_0x0d59('0x40')]['create'](_0x224b57[_0x0d59('0x26')],{'raw':_0x224b57[_0x0d59('0x1a')]?_0x224b57[_0x0d59('0x1a')][_0x0d59('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x23f748})[_0x0d59('0xc')](function(){logger[_0x0d59('0xd')](_0x0d59('0x41'),JSON[_0x0d59('0x12')](_0x224b57['options'][_0x0d59('0x1c')]),_0x224b57[_0x0d59('0x1a')][_0x0d59('0x1c')][_0x0d59('0x3d')]);return db[_0x0d59('0x18')][_0x0d59('0x2a')]({'where':_0x224b57[_0x0d59('0x1a')]?_0x224b57[_0x0d59('0x1a')][_0x0d59('0x1c')]||null:null,'transaction':_0x23f748});});})[_0x0d59('0xc')](function(_0x151453){logger[_0x0d59('0xd')](_0x0d59('0x3e'),_0x224b57);logger[_0x0d59('0x10')](_0x0d59('0x3e'),_0x224b57,JSON[_0x0d59('0x12')](_0x151453));_0x355544(_0x151453);})['catch'](function(_0xa66a01){logger[_0x0d59('0x13')](_0x0d59('0x3e'),_0xa66a01[_0x0d59('0x15')],_0x224b57);_0x312023(_0x44663c[_0x0d59('0x13')](0x1f4,_0xa66a01['message']));});});};exports[_0x0d59('0x42')]=function(_0x2dc965){var _0x3af219=this;return new Promise(function(_0x23693b,_0x774a84){return db[_0x0d59('0x18')]['findAll']({'raw':_0x2dc965[_0x0d59('0x1a')]?_0x2dc965[_0x0d59('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2dc965[_0x0d59('0x1a')]?_0x2dc965[_0x0d59('0x1a')][_0x0d59('0x1c')]||null:null,'attributes':[[db[_0x0d59('0x3f')]['fn'](_0x0d59('0x43'),db[_0x0d59('0x3f')]['fn']('IF',db[_0x0d59('0x3f')][_0x0d59('0x44')](_0x0d59('0x45')+util['format'](_0x0d59('0x46'),moment()[_0x0d59('0x47')](_0x0d59('0x48')))+_0x0d59('0x49')))),_0x0d59('0x4a')]]})[_0x0d59('0xc')](function(_0x707fdd){logger[_0x0d59('0xd')]('CountReScheduled',_0x2dc965);logger['debug']('CountReScheduled',_0x2dc965,JSON['stringify'](_0x707fdd));_0x23693b(_0x707fdd);})[_0x0d59('0x22')](function(_0x3a9019){logger[_0x0d59('0x13')](_0x0d59('0x42'),_0x3a9019['message'],_0x2dc965);_0x774a84(_0x3af219[_0x0d59('0x13')](0x1f4,_0x3a9019[_0x0d59('0x15')]));});});};exports[_0x0d59('0x4b')]=function(_0x42f8c3){var _0x1eb5d7=this;return new Promise(function(_0x1b9967,_0xbcc2b0){return db[_0x0d59('0x2c')]['describe']()[_0x0d59('0xc')](function(_0x46ae1c){return db['sequelize'][_0x0d59('0x2e')](function(_0x5a20d0){return db[_0x0d59('0x18')][_0x0d59('0x19')]({'where':_0x42f8c3['options']?_0x42f8c3[_0x0d59('0x1a')][_0x0d59('0x1c')]||null:null,'attributes':_0x42f8c3[_0x0d59('0x1a')]?_0x42f8c3[_0x0d59('0x1a')][_0x0d59('0x1d')]||null:null,'limit':0x1,'order':_0x42f8c3[_0x0d59('0x1a')]?_0x42f8c3[_0x0d59('0x1a')]['order']||null:null,'group':db['CmHopper'][_0x0d59('0x4c')],'transaction':_0x5a20d0,'lock':_0x5a20d0[_0x0d59('0x2f')][_0x0d59('0x30')],'include':_0x42f8c3[_0x0d59('0x1a')]?_0x42f8c3[_0x0d59('0x1a')]['include']?_['map'](_0x42f8c3[_0x0d59('0x1a')][_0x0d59('0x1f')],function(_0x4f88dc){return{'model':db[_0x4f88dc[_0x0d59('0x21')]],'as':_0x4f88dc['as'],'attributes':_0x4f88dc[_0x0d59('0x1d')],'include':_0x4f88dc['include']?_[_0x0d59('0x20')](_0x4f88dc[_0x0d59('0x1f')],function(_0x334e92){return{'model':db[_0x334e92[_0x0d59('0x21')]],'as':_0x334e92['as'],'attributes':_0x334e92[_0x0d59('0x1d')],'include':_0x334e92[_0x0d59('0x1f')]?_[_0x0d59('0x20')](_0x334e92['include'],function(_0x15d4dd){return{'model':db[_0x15d4dd[_0x0d59('0x21')]],'as':_0x15d4dd['as'],'attributes':_0x15d4dd[_0x0d59('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32d9ff){var _0x3e6b7d=[];for(var _0x39fe55=0x0;_0x39fe55<_0x32d9ff[_0x0d59('0x37')];_0x39fe55+=0x1){_0x3e6b7d['push'](_0x32d9ff[_0x39fe55]['update'](_0x42f8c3[_0x0d59('0x26')],{'transaction':_0x5a20d0}));}return BPromise[_0x0d59('0x4d')](_0x3e6b7d);});})[_0x0d59('0xc')](function(_0x56514){logger['info'](_0x0d59('0x4b'),_0x42f8c3);logger['debug'](_0x0d59('0x4b'),_0x42f8c3,JSON[_0x0d59('0x12')](_0x56514));_0x1b9967(_0x56514);})[_0x0d59('0x22')](function(_0x1a57e7){logger[_0x0d59('0x13')](_0x0d59('0x4b'),_0x1a57e7[_0x0d59('0x15')],_0x42f8c3);_0xbcc2b0(_0x1eb5d7['error'](0x1f4,_0x1a57e7[_0x0d59('0x15')]));});});});};exports[_0x0d59('0x4e')]=function(_0x2c7459){var _0x3a241a=this;return new Promise(function(_0x4b2ae6,_0x2db625){db[_0x0d59('0x2c')][_0x0d59('0x2d')]()[_0x0d59('0xc')](function(_0x31445f){return db[_0x0d59('0x18')][_0x0d59('0x19')]({'raw':_0x2c7459[_0x0d59('0x1a')]?_0x2c7459[_0x0d59('0x1a')][_0x0d59('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c7459[_0x0d59('0x1a')]?_0x2c7459[_0x0d59('0x1a')][_0x0d59('0x1c')]||null:null,'attributes':_0x2c7459[_0x0d59('0x1a')]?_0x2c7459[_0x0d59('0x1a')]['attributes']||null:null,'limit':_0x2c7459['options']?_0x2c7459[_0x0d59('0x1a')][_0x0d59('0x1e')]||null:null,'include':_0x2c7459[_0x0d59('0x1a')]?_0x2c7459[_0x0d59('0x1a')][_0x0d59('0x1f')]?_['map'](_0x2c7459[_0x0d59('0x1a')]['include'],function(_0x1830e5){return{'model':db[_0x1830e5[_0x0d59('0x21')]],'as':_0x1830e5['as'],'attributes':_0x1830e5['as']==='Contact'?_[_0x0d59('0x32')](_0x31445f):_0x1830e5['attributes'],'include':_0x1830e5[_0x0d59('0x1f')]?_['map'](_0x1830e5[_0x0d59('0x1f')],function(_0x46c5cf){return{'model':db[_0x46c5cf[_0x0d59('0x21')]],'as':_0x46c5cf['as'],'attributes':_0x46c5cf[_0x0d59('0x1d')],'include':_0x46c5cf['include']?_[_0x0d59('0x20')](_0x46c5cf['include'],function(_0x2d748b){return{'model':db[_0x2d748b[_0x0d59('0x21')]],'as':_0x2d748b['as'],'attributes':_0x2d748b[_0x0d59('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0d59('0xc')](function(_0x3277c2){logger[_0x0d59('0xd')]('GetCmHopper',_0x2c7459);logger[_0x0d59('0x10')](_0x0d59('0x17'),_0x2c7459,JSON[_0x0d59('0x12')](_0x3277c2));_0x4b2ae6(_0x3277c2);})[_0x0d59('0x22')](function(_0x112b3d){logger['error']('GetCmHopper',_0x112b3d[_0x0d59('0x15')],_0x2c7459);_0x2db625(_0x3a241a[_0x0d59('0x13')](0x1f4,_0x112b3d[_0x0d59('0x15')]));});});});};exports[_0x0d59('0x4f')]=function(_0x11b94b){var _0x1c1ae6=this;return new Promise(function(_0x571b14,_0x26c0a7){return db[_0x0d59('0x3f')][_0x0d59('0x2e')](function(_0x9a4258){return db[_0x0d59('0x18')][_0x0d59('0x39')]({'active':![]},{'where':{},'transaction':_0x9a4258})[_0x0d59('0xc')](function(_0x1e4afa){logger['info']('ResetActiveCalls',_0x11b94b);logger[_0x0d59('0x10')](_0x0d59('0x4f'),_0x11b94b,JSON[_0x0d59('0x12')](_0x1e4afa));_0x571b14(_0x1e4afa);})[_0x0d59('0x22')](function(_0x39c4d3){logger[_0x0d59('0x13')](_0x0d59('0x4f'),_0x39c4d3[_0x0d59('0x15')],_0x11b94b);_0x26c0a7(_0x1c1ae6[_0x0d59('0x13')](0x1f4,_0x39c4d3['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index c03a54f..8612a88 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 _0x3c54=['getPreview','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','getOpenContacts','/:id','show','post','create','/preview'];(function(_0x4260f3,_0x4988d6){var _0x31b726=function(_0x5a5513){while(--_0x5a5513){_0x4260f3['push'](_0x4260f3['shift']());}};_0x31b726(++_0x4988d6);}(_0x3c54,0x1bf));var _0x43c5=function(_0x375ec5,_0x5e4f49){_0x375ec5=_0x375ec5-0x0;var _0x25037f=_0x3c54[_0x375ec5];return _0x25037f;};'use strict';var multer=require(_0x43c5('0x0'));var util=require(_0x43c5('0x1'));var path=require(_0x43c5('0x2'));var timeout=require(_0x43c5('0x3'));var express=require(_0x43c5('0x4'));var router=express[_0x43c5('0x5')]();var fs_extra=require(_0x43c5('0x6'));var auth=require(_0x43c5('0x7'));var interaction=require(_0x43c5('0x8'));var config=require(_0x43c5('0x9'));var controller=require(_0x43c5('0xa'));router[_0x43c5('0xb')]('/',auth[_0x43c5('0xc')](),controller[_0x43c5('0xd')]);router['get'](_0x43c5('0xe'),auth[_0x43c5('0xc')](),controller['describe']);router[_0x43c5('0xb')]('/opencontacts',auth[_0x43c5('0xc')](),controller[_0x43c5('0xf')]);router[_0x43c5('0xb')](_0x43c5('0x10'),auth[_0x43c5('0xc')](),controller[_0x43c5('0x11')]);router[_0x43c5('0x12')]('/',auth[_0x43c5('0xc')](),controller[_0x43c5('0x13')]);router[_0x43c5('0x12')](_0x43c5('0x14'),auth['isAuthenticated'](),controller[_0x43c5('0x15')]);router[_0x43c5('0x16')](_0x43c5('0x10'),auth[_0x43c5('0xc')](),controller[_0x43c5('0x17')]);router[_0x43c5('0x18')](_0x43c5('0x10'),auth[_0x43c5('0xc')](),controller[_0x43c5('0x19')]);module['exports']=router; \ No newline at end of file +var _0xb967=['get','/describe','isAuthenticated','/opencontacts','/:id','show','post','/preview','getPreview','put','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb967,0x19b));var _0x7b96=function(_0x5745e2,_0x26a4ba){_0x5745e2=_0x5745e2-0x0;var _0x4c2543=_0xb967[_0x5745e2];return _0x4c2543;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7b96('0x0'));var timeout=require(_0x7b96('0x1'));var express=require(_0x7b96('0x2'));var router=express[_0x7b96('0x3')]();var fs_extra=require(_0x7b96('0x4'));var auth=require(_0x7b96('0x5'));var interaction=require(_0x7b96('0x6'));var config=require(_0x7b96('0x7'));var controller=require(_0x7b96('0x8'));router[_0x7b96('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7b96('0xa'),auth[_0x7b96('0xb')](),controller['describe']);router[_0x7b96('0x9')](_0x7b96('0xc'),auth[_0x7b96('0xb')](),controller['getOpenContacts']);router[_0x7b96('0x9')](_0x7b96('0xd'),auth[_0x7b96('0xb')](),controller[_0x7b96('0xe')]);router[_0x7b96('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7b96('0xf')](_0x7b96('0x10'),auth[_0x7b96('0xb')](),controller[_0x7b96('0x11')]);router[_0x7b96('0x12')](_0x7b96('0xd'),auth[_0x7b96('0xb')](),controller[_0x7b96('0x13')]);router['delete'](_0x7b96('0xd'),auth[_0x7b96('0xb')](),controller['destroy']);module[_0x7b96('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 405dbc3..b8f8adf 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 _0xcfeb=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcfeb,0x1b2));var _0xbcfe=function(_0x3fbe35,_0x1e1ee7){_0x3fbe35=_0x3fbe35-0x0;var _0x3fb545=_0xcfeb[_0x3fbe35];return _0x3fb545;};'use strict';var moment=require(_0xbcfe('0x0'));var Sequelize=require(_0xbcfe('0x1'));module[_0xbcfe('0x2')]={'phone':{'type':Sequelize[_0xbcfe('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xbcfe('0x4')],'unique':_0xbcfe('0x5')},'VoiceQueueId':{'type':Sequelize[_0xbcfe('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x448a=['exports','INTEGER','contactListQueue','sequelize'];(function(_0x32da2d,_0x511e26){var _0x409131=function(_0x554897){while(--_0x554897){_0x32da2d['push'](_0x32da2d['shift']());}};_0x409131(++_0x511e26);}(_0x448a,0x1ef));var _0xa448=function(_0x123a36,_0x141bb1){_0x123a36=_0x123a36-0x0;var _0x5b4368=_0x448a[_0x123a36];return _0x5b4368;};'use strict';var moment=require('moment');var Sequelize=require(_0xa448('0x0'));module[_0xa448('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa448('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xa448('0x3')},'VoiceQueueId':{'type':Sequelize[_0xa448('0x2')],'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 3ecb9f3..1388bb8 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 _0xee8f=['body','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperBlack','includeAll','include','rows','catch','show','params','find'];(function(_0x5251ed,_0x59782e){var _0x5ef9ab=function(_0x139d82){while(--_0x139d82){_0x5251ed['push'](_0x5251ed['shift']());}};_0x5ef9ab(++_0x59782e);}(_0xee8f,0x1ed));var _0xfee8=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xee8f[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfee8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfee8('0x1'));var rp=require(_0xfee8('0x2'));var moment=require(_0xfee8('0x3'));var BPromise=require(_0xfee8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xfee8('0x5'));var csv=require(_0xfee8('0x6'));var ejs=require(_0xfee8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfee8('0x8'));var squel=require(_0xfee8('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfee8('0xa'));var toCsv=require(_0xfee8('0x6'));var querystring=require(_0xfee8('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfee8('0xc'));var qs=require(_0xfee8('0xd'));var as=require(_0xfee8('0xe'));var hardwareService=require(_0xfee8('0xf'));var logger=require(_0xfee8('0x10'))(_0xfee8('0x11'));var utils=require(_0xfee8('0x12'));var config=require(_0xfee8('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55023b,_0x3fb040){_0x3fb040=_0x3fb040||0xcc;return function(_0x4493a5){if(_0x4493a5){return _0x55023b[_0xfee8('0x14')](_0x3fb040);}return _0x55023b['status'](_0x3fb040)['end']();};}function respondWithResult(_0x16364d,_0x36230a){_0x36230a=_0x36230a||0xc8;return function(_0x11aeb6){if(_0x11aeb6){return _0x16364d[_0xfee8('0x15')](_0x36230a)[_0xfee8('0x16')](_0x11aeb6);}};}function respondWithFilteredResult(_0x1f85c2,_0x1c285f){return function(_0xc8de11){if(_0xc8de11){var _0x53f517=typeof _0x1c285f[_0xfee8('0x17')]===_0xfee8('0x18')&&typeof _0x1c285f[_0xfee8('0x19')]==='undefined';var _0x4cca60=_0xc8de11[_0xfee8('0x1a')];var _0xe87d73=_0x53f517?0x0:_0x1c285f['offset'];var _0x2c0d1e=_0x53f517?_0xc8de11[_0xfee8('0x1a')]:_0x1c285f['offset']+_0x1c285f[_0xfee8('0x19')];var _0x587c14;if(_0x2c0d1e>=_0x4cca60){_0x2c0d1e=_0x4cca60;_0x587c14=0xc8;}else{_0x587c14=0xce;}_0x1f85c2['status'](_0x587c14);return _0x1f85c2[_0xfee8('0x1b')](_0xfee8('0x1c'),_0xe87d73+'-'+_0x2c0d1e+'/'+_0x4cca60)[_0xfee8('0x16')](_0xc8de11);}return null;};}function patchUpdates(_0x10babd){return function(_0x48e051){try{jsonpatch[_0xfee8('0x1d')](_0x48e051,_0x10babd,!![]);}catch(_0x3308e5){return BPromise[_0xfee8('0x1e')](_0x3308e5);}return _0x48e051[_0xfee8('0x1f')]();};}function saveUpdates(_0x2e9e1b,_0x2401a3){return function(_0xe48425){if(_0xe48425){return _0xe48425[_0xfee8('0x20')](_0x2e9e1b)[_0xfee8('0x21')](function(_0x507656){return _0x507656;});}return null;};}function removeEntity(_0x347787,_0x51d263){return function(_0x21d42c){if(_0x21d42c){return _0x21d42c['destroy']()[_0xfee8('0x21')](function(){_0x347787[_0xfee8('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30e9a0,_0x3fd4cc){return function(_0x57aca6){if(!_0x57aca6){_0x30e9a0[_0xfee8('0x14')](0x194);}return _0x57aca6;};}function handleError(_0x42c44d,_0x23b063){_0x23b063=_0x23b063||0x1f4;return function(_0x343458){logger[_0xfee8('0x22')](_0x343458['stack']);if(_0x343458[_0xfee8('0x23')]){delete _0x343458[_0xfee8('0x23')];}_0x42c44d[_0xfee8('0x15')](_0x23b063)[_0xfee8('0x24')](_0x343458);};}exports[_0xfee8('0x25')]=function(_0x426cdd,_0x452730){var _0x20aa37={},_0x3f5914={},_0x4fdfb3={'count':0x0,'rows':[]};var _0x180f83=_[_0xfee8('0x26')](db['CmHopperBlack'][_0xfee8('0x27')],function(_0x38c28b){return{'name':_0x38c28b['fieldName'],'type':_0x38c28b[_0xfee8('0x28')]['key']};});_0x3f5914['model']=_[_0xfee8('0x26')](_0x180f83,_0xfee8('0x23'));_0x3f5914[_0xfee8('0x29')]=_[_0xfee8('0x2a')](_0x426cdd[_0xfee8('0x29')]);_0x3f5914[_0xfee8('0x2b')]=_['intersection'](_0x3f5914[_0xfee8('0x2c')],_0x3f5914[_0xfee8('0x29')]);_0x20aa37[_0xfee8('0x2d')]=_[_0xfee8('0x2e')](_0x3f5914['model'],qs['fields'](_0x426cdd[_0xfee8('0x29')][_0xfee8('0x2f')]));_0x20aa37[_0xfee8('0x2d')]=_0x20aa37[_0xfee8('0x2d')][_0xfee8('0x30')]?_0x20aa37[_0xfee8('0x2d')]:_0x3f5914[_0xfee8('0x2c')];if(!_0x426cdd[_0xfee8('0x29')][_0xfee8('0x31')](_0xfee8('0x32'))){_0x20aa37['limit']=qs[_0xfee8('0x19')](_0x426cdd['query']['limit']);_0x20aa37['offset']=qs[_0xfee8('0x17')](_0x426cdd[_0xfee8('0x29')][_0xfee8('0x17')]);}_0x20aa37[_0xfee8('0x33')]=qs['sort'](_0x426cdd[_0xfee8('0x29')][_0xfee8('0x34')]);_0x20aa37[_0xfee8('0x35')]=qs[_0xfee8('0x2b')](_[_0xfee8('0x36')](_0x426cdd[_0xfee8('0x29')],_0x3f5914[_0xfee8('0x2b')]),_0x180f83);if(_0x426cdd['query'][_0xfee8('0x37')]){_0x20aa37[_0xfee8('0x35')]=_[_0xfee8('0x38')](_0x20aa37[_0xfee8('0x35')],{'$or':_[_0xfee8('0x26')](_0x180f83,function(_0x1b2531){if(_0x1b2531[_0xfee8('0x28')]!==_0xfee8('0x39')){var _0x528666={};_0x528666[_0x1b2531['name']]={'$like':'%'+_0x426cdd[_0xfee8('0x29')][_0xfee8('0x37')]+'%'};return _0x528666;}})});}_0x20aa37=_[_0xfee8('0x38')]({},_0x20aa37,_0x426cdd[_0xfee8('0x3a')]);var _0x1550a0={'where':_0x20aa37[_0xfee8('0x35')]};return db[_0xfee8('0x3b')]['count'](_0x1550a0)['then'](function(_0xbd818c){_0x4fdfb3[_0xfee8('0x1a')]=_0xbd818c;if(_0x426cdd[_0xfee8('0x29')][_0xfee8('0x3c')]){_0x20aa37[_0xfee8('0x3d')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x20aa37);})[_0xfee8('0x21')](function(_0x31c6b3){_0x4fdfb3[_0xfee8('0x3e')]=_0x31c6b3;return _0x4fdfb3;})[_0xfee8('0x21')](respondWithFilteredResult(_0x452730,_0x20aa37))[_0xfee8('0x3f')](handleError(_0x452730,null));};exports[_0xfee8('0x40')]=function(_0x283617,_0x5cbdb8){var _0x270e29={'raw':!![],'where':{'id':_0x283617[_0xfee8('0x41')]['id']}},_0x52febc={};_0x52febc[_0xfee8('0x2c')]=_[_0xfee8('0x2a')](db[_0xfee8('0x3b')][_0xfee8('0x27')]);_0x52febc[_0xfee8('0x29')]=_[_0xfee8('0x2a')](_0x283617['query']);_0x52febc[_0xfee8('0x2b')]=_['intersection'](_0x52febc[_0xfee8('0x2c')],_0x52febc['query']);_0x270e29[_0xfee8('0x2d')]=_[_0xfee8('0x2e')](_0x52febc[_0xfee8('0x2c')],qs[_0xfee8('0x2f')](_0x283617['query'][_0xfee8('0x2f')]));_0x270e29[_0xfee8('0x2d')]=_0x270e29[_0xfee8('0x2d')][_0xfee8('0x30')]?_0x270e29[_0xfee8('0x2d')]:_0x52febc['model'];if(_0x283617[_0xfee8('0x29')]['includeAll']){_0x270e29[_0xfee8('0x3d')]=[{'all':!![]}];}_0x270e29=_['merge']({},_0x270e29,_0x283617[_0xfee8('0x3a')]);return db[_0xfee8('0x3b')][_0xfee8('0x42')](_0x270e29)[_0xfee8('0x21')](handleEntityNotFound(_0x5cbdb8,null))[_0xfee8('0x21')](respondWithResult(_0x5cbdb8,null))[_0xfee8('0x3f')](handleError(_0x5cbdb8,null));};exports[_0xfee8('0x20')]=function(_0x38e1c8,_0x37bec7){if(_0x38e1c8[_0xfee8('0x43')]['id']){delete _0x38e1c8[_0xfee8('0x43')]['id'];}return db[_0xfee8('0x3b')][_0xfee8('0x42')]({'where':{'id':_0x38e1c8[_0xfee8('0x41')]['id']}})[_0xfee8('0x21')](handleEntityNotFound(_0x37bec7,null))[_0xfee8('0x21')](saveUpdates(_0x38e1c8[_0xfee8('0x43')],null))[_0xfee8('0x21')](respondWithResult(_0x37bec7,null))['catch'](handleError(_0x37bec7,null));};exports[_0xfee8('0x44')]=function(_0x3ba454,_0x57c28d){return db[_0xfee8('0x3b')][_0xfee8('0x42')]({'where':{'id':_0x3ba454[_0xfee8('0x41')]['id']}})[_0xfee8('0x21')](handleEntityNotFound(_0x57c28d,null))[_0xfee8('0x21')](removeEntity(_0x57c28d,null))[_0xfee8('0x3f')](handleError(_0x57c28d,null));};exports[_0xfee8('0x45')]=function(_0x175cfa,_0x3d5cc5){return db[_0xfee8('0x3b')][_0xfee8('0x45')]()[_0xfee8('0x21')](respondWithResult(_0x3d5cc5,null))[_0xfee8('0x3f')](handleError(_0x3d5cc5,null));}; \ No newline at end of file +var _0x96b6=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','send','index','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','options','includeAll','include','CmHopperBlack','findAll','catch','params','keys','rawAttributes','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x128083,_0xe233e6){var _0x417bb4=function(_0x16e14f){while(--_0x16e14f){_0x128083['push'](_0x128083['shift']());}};_0x417bb4(++_0xe233e6);}(_0x96b6,0x15d));var _0x696b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x96b6[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x696b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x696b('0x1'));var jsonpatch=require(_0x696b('0x2'));var rp=require(_0x696b('0x3'));var moment=require(_0x696b('0x4'));var BPromise=require(_0x696b('0x5'));var Mustache=require(_0x696b('0x6'));var util=require('util');var path=require(_0x696b('0x7'));var sox=require('sox');var csv=require(_0x696b('0x8'));var ejs=require(_0x696b('0x9'));var fs=require('fs');var fs_extra=require(_0x696b('0xa'));var _=require(_0x696b('0xb'));var squel=require(_0x696b('0xc'));var crypto=require(_0x696b('0xd'));var jsforce=require(_0x696b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x696b('0x8'));var querystring=require('querystring');var Papa=require(_0x696b('0xf'));var Redis=require(_0x696b('0x10'));var authService=require(_0x696b('0x11'));var qs=require(_0x696b('0x12'));var as=require(_0x696b('0x13'));var hardwareService=require(_0x696b('0x14'));var logger=require(_0x696b('0x15'))(_0x696b('0x16'));var utils=require(_0x696b('0x17'));var config=require(_0x696b('0x18'));var licenseUtil=require(_0x696b('0x19'));var db=require(_0x696b('0x1a'))['db'];function respondWithStatusCode(_0x439de4,_0x582796){_0x582796=_0x582796||0xcc;return function(_0x56a561){if(_0x56a561){return _0x439de4[_0x696b('0x1b')](_0x582796);}return _0x439de4[_0x696b('0x1c')](_0x582796)[_0x696b('0x1d')]();};}function respondWithResult(_0x118c14,_0x2e4b28){_0x2e4b28=_0x2e4b28||0xc8;return function(_0x2a4722){if(_0x2a4722){return _0x118c14[_0x696b('0x1c')](_0x2e4b28)[_0x696b('0x1e')](_0x2a4722);}};}function respondWithFilteredResult(_0x622323,_0x34d9da){return function(_0x43227b){if(_0x43227b){var _0x5ef7c0=typeof _0x34d9da[_0x696b('0x1f')]===_0x696b('0x20')&&typeof _0x34d9da[_0x696b('0x21')]===_0x696b('0x20');var _0x17b044=_0x43227b[_0x696b('0x22')];var _0xb05209=_0x5ef7c0?0x0:_0x34d9da[_0x696b('0x1f')];var _0x45af87=_0x5ef7c0?_0x43227b['count']:_0x34d9da[_0x696b('0x1f')]+_0x34d9da[_0x696b('0x21')];var _0x11b8ce;if(_0x45af87>=_0x17b044){_0x45af87=_0x17b044;_0x11b8ce=0xc8;}else{_0x11b8ce=0xce;}_0x622323['status'](_0x11b8ce);return _0x622323[_0x696b('0x23')]('Content-Range',_0xb05209+'-'+_0x45af87+'/'+_0x17b044)['json'](_0x43227b);}return null;};}function patchUpdates(_0x3d3254){return function(_0x404987){try{jsonpatch['apply'](_0x404987,_0x3d3254,!![]);}catch(_0x4e946b){return BPromise[_0x696b('0x24')](_0x4e946b);}return _0x404987[_0x696b('0x25')]();};}function saveUpdates(_0x32aa99,_0x420878){return function(_0x11f271){if(_0x11f271){return _0x11f271[_0x696b('0x26')](_0x32aa99)['then'](function(_0x1f5744){return _0x1f5744;});}return null;};}function removeEntity(_0x4cd530,_0x2ae09c){return function(_0x3836ac){if(_0x3836ac){return _0x3836ac['destroy']()[_0x696b('0x27')](function(){_0x4cd530[_0x696b('0x1c')](0xcc)[_0x696b('0x1d')]();});}};}function handleEntityNotFound(_0x360493,_0x45e434){return function(_0x41d7e1){if(!_0x41d7e1){_0x360493[_0x696b('0x1b')](0x194);}return _0x41d7e1;};}function handleError(_0x5eaae9,_0x55d03b){_0x55d03b=_0x55d03b||0x1f4;return function(_0x5dd373){logger[_0x696b('0x28')](_0x5dd373[_0x696b('0x29')]);if(_0x5dd373[_0x696b('0x2a')]){delete _0x5dd373[_0x696b('0x2a')];}_0x5eaae9[_0x696b('0x1c')](_0x55d03b)[_0x696b('0x2b')](_0x5dd373);};}exports[_0x696b('0x2c')]=function(_0x40e27f,_0x323530){var _0x40ea41={},_0x4e805d={},_0x225273={'count':0x0,'rows':[]};var _0x57e1fb=_['map'](db['CmHopperBlack']['rawAttributes'],function(_0x5e11ee){return{'name':_0x5e11ee[_0x696b('0x2d')],'type':_0x5e11ee[_0x696b('0x2e')][_0x696b('0x2f')]};});_0x4e805d[_0x696b('0x30')]=_[_0x696b('0x31')](_0x57e1fb,'name');_0x4e805d[_0x696b('0x32')]=_['keys'](_0x40e27f[_0x696b('0x32')]);_0x4e805d['filters']=_[_0x696b('0x33')](_0x4e805d[_0x696b('0x30')],_0x4e805d[_0x696b('0x32')]);_0x40ea41[_0x696b('0x34')]=_[_0x696b('0x33')](_0x4e805d['model'],qs['fields'](_0x40e27f[_0x696b('0x32')][_0x696b('0x35')]));_0x40ea41[_0x696b('0x34')]=_0x40ea41[_0x696b('0x34')][_0x696b('0x36')]?_0x40ea41['attributes']:_0x4e805d[_0x696b('0x30')];if(!_0x40e27f['query'][_0x696b('0x37')](_0x696b('0x38'))){_0x40ea41[_0x696b('0x21')]=qs['limit'](_0x40e27f[_0x696b('0x32')]['limit']);_0x40ea41[_0x696b('0x1f')]=qs['offset'](_0x40e27f[_0x696b('0x32')][_0x696b('0x1f')]);}_0x40ea41['order']=qs[_0x696b('0x39')](_0x40e27f[_0x696b('0x32')][_0x696b('0x39')]);_0x40ea41[_0x696b('0x3a')]=qs[_0x696b('0x3b')](_[_0x696b('0x3c')](_0x40e27f[_0x696b('0x32')],_0x4e805d['filters']),_0x57e1fb);if(_0x40e27f[_0x696b('0x32')]['filter']){_0x40ea41[_0x696b('0x3a')]=_['merge'](_0x40ea41['where'],{'$or':_['map'](_0x57e1fb,function(_0x3d1e2c){if(_0x3d1e2c[_0x696b('0x2e')]!=='VIRTUAL'){var _0x168f87={};_0x168f87[_0x3d1e2c[_0x696b('0x2a')]]={'$like':'%'+_0x40e27f[_0x696b('0x32')]['filter']+'%'};return _0x168f87;}})});}_0x40ea41=_[_0x696b('0x3d')]({},_0x40ea41,_0x40e27f[_0x696b('0x3e')]);var _0x11845e={'where':_0x40ea41[_0x696b('0x3a')]};return db['CmHopperBlack'][_0x696b('0x22')](_0x11845e)['then'](function(_0x14b534){_0x225273[_0x696b('0x22')]=_0x14b534;if(_0x40e27f[_0x696b('0x32')][_0x696b('0x3f')]){_0x40ea41[_0x696b('0x40')]=[{'all':!![]}];}return db[_0x696b('0x41')][_0x696b('0x42')](_0x40ea41);})['then'](function(_0x40846d){_0x225273['rows']=_0x40846d;return _0x225273;})[_0x696b('0x27')](respondWithFilteredResult(_0x323530,_0x40ea41))[_0x696b('0x43')](handleError(_0x323530,null));};exports['show']=function(_0xc4c370,_0x18e139){var _0xba2e6c={'raw':!![],'where':{'id':_0xc4c370[_0x696b('0x44')]['id']}},_0x342620={};_0x342620[_0x696b('0x30')]=_[_0x696b('0x45')](db[_0x696b('0x41')][_0x696b('0x46')]);_0x342620[_0x696b('0x32')]=_['keys'](_0xc4c370[_0x696b('0x32')]);_0x342620[_0x696b('0x3b')]=_[_0x696b('0x33')](_0x342620[_0x696b('0x30')],_0x342620['query']);_0xba2e6c['attributes']=_['intersection'](_0x342620[_0x696b('0x30')],qs[_0x696b('0x35')](_0xc4c370[_0x696b('0x32')][_0x696b('0x35')]));_0xba2e6c['attributes']=_0xba2e6c[_0x696b('0x34')][_0x696b('0x36')]?_0xba2e6c[_0x696b('0x34')]:_0x342620[_0x696b('0x30')];if(_0xc4c370[_0x696b('0x32')]['includeAll']){_0xba2e6c[_0x696b('0x40')]=[{'all':!![]}];}_0xba2e6c=_[_0x696b('0x3d')]({},_0xba2e6c,_0xc4c370[_0x696b('0x3e')]);return db[_0x696b('0x41')][_0x696b('0x47')](_0xba2e6c)[_0x696b('0x27')](handleEntityNotFound(_0x18e139,null))[_0x696b('0x27')](respondWithResult(_0x18e139,null))['catch'](handleError(_0x18e139,null));};exports[_0x696b('0x26')]=function(_0x438be7,_0x48a06b){if(_0x438be7[_0x696b('0x48')]['id']){delete _0x438be7['body']['id'];}return db[_0x696b('0x41')][_0x696b('0x47')]({'where':{'id':_0x438be7[_0x696b('0x44')]['id']}})['then'](handleEntityNotFound(_0x48a06b,null))['then'](saveUpdates(_0x438be7[_0x696b('0x48')],null))[_0x696b('0x27')](respondWithResult(_0x48a06b,null))[_0x696b('0x43')](handleError(_0x48a06b,null));};exports['destroy']=function(_0x5479f1,_0x2568ae){return db['CmHopperBlack'][_0x696b('0x47')]({'where':{'id':_0x5479f1[_0x696b('0x44')]['id']}})['then'](handleEntityNotFound(_0x2568ae,null))['then'](removeEntity(_0x2568ae,null))[_0x696b('0x43')](handleError(_0x2568ae,null));};exports[_0x696b('0x49')]=function(_0x11473e,_0x553a57){return db[_0x696b('0x41')][_0x696b('0x49')]()[_0x696b('0x27')](respondWithResult(_0x553a57,null))[_0x696b('0x43')](handleError(_0x553a57,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index a4217c8..88ca183 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 _0x1f30=['request-promise','path','../../config/environment','./cmHopperBlack.attributes','lodash','util','../../config/logger','api','moment'];(function(_0x57be91,_0x45f2d8){var _0x1e9652=function(_0x2937b6){while(--_0x2937b6){_0x57be91['push'](_0x57be91['shift']());}};_0x1e9652(++_0x45f2d8);}(_0x1f30,0x175));var _0x01f3=function(_0x5251b5,_0x33afd9){_0x5251b5=_0x5251b5-0x0;var _0x2fb8f6=_0x1f30[_0x5251b5];return _0x2fb8f6;};'use strict';var _=require(_0x01f3('0x0'));var util=require(_0x01f3('0x1'));var logger=require(_0x01f3('0x2'))(_0x01f3('0x3'));var moment=require(_0x01f3('0x4'));var BPromise=require('bluebird');var rp=require(_0x01f3('0x5'));var fs=require('fs');var path=require(_0x01f3('0x6'));var rimraf=require('rimraf');var config=require(_0x01f3('0x7'));var attributes=require(_0x01f3('0x8'));module['exports']=function(_0x3a8c75,_0x4ae458){return _0x3a8c75['define']('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ed6=['exports','CmHopperBlack','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes'];(function(_0x26e556,_0x10fc0e){var _0x51ed7e=function(_0x570acf){while(--_0x570acf){_0x26e556['push'](_0x26e556['shift']());}};_0x51ed7e(++_0x10fc0e);}(_0x3ed6,0xda));var _0x63ed=function(_0x4462e3,_0x3f76a3){_0x4462e3=_0x4462e3-0x0;var _0x3c123e=_0x3ed6[_0x4462e3];return _0x3c123e;};'use strict';var _=require(_0x63ed('0x0'));var util=require(_0x63ed('0x1'));var logger=require(_0x63ed('0x2'))(_0x63ed('0x3'));var moment=require(_0x63ed('0x4'));var BPromise=require(_0x63ed('0x5'));var rp=require(_0x63ed('0x6'));var fs=require('fs');var path=require(_0x63ed('0x7'));var rimraf=require('rimraf');var config=require(_0x63ed('0x8'));var attributes=require(_0x63ed('0x9'));module[_0x63ed('0xa')]=function(_0x209657,_0x1d16d3){return _0x209657['define'](_0x63ed('0xb'),attributes,{'tableName':'cm_hopper_black','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 2f8a6bc..1f82a6e 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 _0x425e=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','info','catch','GetCmHopperBlack','options','raw','attributes','limit','include','map','model','then','debug','CmHopperBlack','update','body','where','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy'];(function(_0x118619,_0x76ef02){var _0x201aa1=function(_0x252f1b){while(--_0x252f1b){_0x118619['push'](_0x118619['shift']());}};_0x201aa1(++_0x76ef02);}(_0x425e,0x186));var _0xe425=function(_0x13c285,_0x19a539){_0x13c285=_0x13c285-0x0;var _0x48d17d=_0x425e[_0x13c285];return _0x48d17d;};'use strict';var _=require(_0xe425('0x0'));var util=require(_0xe425('0x1'));var moment=require('moment');var BPromise=require(_0xe425('0x2'));var rs=require(_0xe425('0x3'));var fs=require('fs');var Redis=require(_0xe425('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe425('0x5'));var logger=require(_0xe425('0x6'))(_0xe425('0x7'));var config=require(_0xe425('0x8'));var jayson=require(_0xe425('0x9'));var client=jayson[_0xe425('0xa')][_0xe425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x119d0e,_0x32e565,_0x5440f6){return new BPromise(function(_0x23a021,_0x33d2d6){return client[_0xe425('0xc')](_0x119d0e,_0x5440f6)['then'](function(_0x1f7c55){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x32e565,'request\x20sent');logger['debug'](_0xe425('0xd'),_0x32e565,_0xe425('0xe'),JSON[_0xe425('0xf')](_0x1f7c55));if(_0x1f7c55[_0xe425('0x10')]){if(_0x1f7c55[_0xe425('0x10')][_0xe425('0x11')]===0x1f4){logger[_0xe425('0x10')](_0xe425('0x12'),_0x32e565,_0x1f7c55[_0xe425('0x10')][_0xe425('0x13')]);return _0x33d2d6(_0x1f7c55[_0xe425('0x10')][_0xe425('0x13')]);}logger[_0xe425('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x32e565,_0x1f7c55[_0xe425('0x10')]['message']);return _0x23a021(_0x1f7c55[_0xe425('0x10')][_0xe425('0x13')]);}else{logger[_0xe425('0x14')]('CmHopperBlack,\x20%s,\x20%s',_0x32e565,'request\x20sent');_0x23a021(_0x1f7c55['result'][_0xe425('0x13')]);}})[_0xe425('0x15')](function(_0x4d2280){logger[_0xe425('0x10')](_0xe425('0x12'),_0x32e565,_0x4d2280);_0x33d2d6(_0x4d2280);});});}exports[_0xe425('0x16')]=function(_0x3bfeed){var _0x4101f5=this;return new Promise(function(_0x1a0eaa,_0x179949){return db['CmHopperBlack']['findAll']({'raw':_0x3bfeed[_0xe425('0x17')]?_0x3bfeed[_0xe425('0x17')][_0xe425('0x18')]===undefined?!![]:![]:!![],'where':_0x3bfeed[_0xe425('0x17')]?_0x3bfeed['options']['where']||null:null,'attributes':_0x3bfeed['options']?_0x3bfeed['options'][_0xe425('0x19')]||null:null,'limit':_0x3bfeed[_0xe425('0x17')]?_0x3bfeed['options'][_0xe425('0x1a')]||null:null,'include':_0x3bfeed[_0xe425('0x17')]?_0x3bfeed[_0xe425('0x17')][_0xe425('0x1b')]?_[_0xe425('0x1c')](_0x3bfeed[_0xe425('0x17')][_0xe425('0x1b')],function(_0x37e703){return{'model':db[_0x37e703['model']],'as':_0x37e703['as'],'attributes':_0x37e703[_0xe425('0x19')],'include':_0x37e703['include']?_[_0xe425('0x1c')](_0x37e703[_0xe425('0x1b')],function(_0x12be0c){return{'model':db[_0x12be0c[_0xe425('0x1d')]],'as':_0x12be0c['as'],'attributes':_0x12be0c[_0xe425('0x19')],'include':_0x12be0c[_0xe425('0x1b')]?_[_0xe425('0x1c')](_0x12be0c[_0xe425('0x1b')],function(_0x47f7d9){return{'model':db[_0x47f7d9['model']],'as':_0x47f7d9['as'],'attributes':_0x47f7d9['attributes']};}):[]};}):[]};}):[]:[]})[_0xe425('0x1e')](function(_0x10012c){logger['info']('GetCmHopperBlack',_0x3bfeed);logger[_0xe425('0x1f')](_0xe425('0x16'),_0x3bfeed,JSON[_0xe425('0xf')](_0x10012c));_0x1a0eaa(_0x10012c);})[_0xe425('0x15')](function(_0xdc0707){logger[_0xe425('0x10')]('GetCmHopperBlack',_0xdc0707[_0xe425('0x13')],_0x3bfeed);_0x179949(_0x4101f5['error'](0x1f4,_0xdc0707[_0xe425('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x1077d6){var _0x395957=this;return new Promise(function(_0x8596b1,_0x8b40b5){return db[_0xe425('0x20')][_0xe425('0x21')](_0x1077d6[_0xe425('0x22')],{'raw':_0x1077d6[_0xe425('0x17')]?_0x1077d6['options'][_0xe425('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1077d6['options']?_0x1077d6[_0xe425('0x17')][_0xe425('0x23')]||null:null,'attributes':_0x1077d6[_0xe425('0x17')]?_0x1077d6['options'][_0xe425('0x19')]||null:null,'limit':_0x1077d6[_0xe425('0x17')]?_0x1077d6['options'][_0xe425('0x1a')]||null:null})['then'](function(_0x194a1f){logger[_0xe425('0x14')](_0xe425('0x24'),_0x1077d6);logger[_0xe425('0x1f')](_0xe425('0x24'),_0x1077d6,JSON[_0xe425('0xf')](_0x194a1f));_0x8596b1(_0x194a1f);})[_0xe425('0x15')](function(_0x5b3e3c){logger[_0xe425('0x10')](_0xe425('0x24'),_0x5b3e3c['message'],_0x1077d6);_0x8b40b5(_0x395957['error'](0x1f4,_0x5b3e3c[_0xe425('0x13')]));});});};exports[_0xe425('0x25')]=function(_0x3e2cbe){var _0x5f8ce4=this;return new Promise(function(_0x340bb8,_0x5ed73f){return db[_0xe425('0x20')][_0xe425('0x26')]({'where':_0x3e2cbe[_0xe425('0x17')]?_0x3e2cbe['options'][_0xe425('0x23')]||null:null})[_0xe425('0x1e')](function(_0x284555){logger[_0xe425('0x14')]('DestroyCmHopperBlack',_0x3e2cbe);logger[_0xe425('0x1f')](_0xe425('0x25'),_0x3e2cbe,JSON[_0xe425('0xf')](_0x284555));_0x340bb8(_0x284555);})['catch'](function(_0x6b4887){logger['error'](_0xe425('0x25'),_0x6b4887[_0xe425('0x13')],_0x3e2cbe);_0x5ed73f(_0x5f8ce4['error'](0x1f4,_0x6b4887[_0xe425('0x13')]));});});}; \ No newline at end of file +var _0x7e41=['include','model','then','debug','catch','UpdateCmHopperBlack','update','DestroyCmHopperBlack','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','map'];(function(_0x1c013d,_0x15a3df){var _0xda7764=function(_0x5a8889){while(--_0x5a8889){_0x1c013d['push'](_0x1c013d['shift']());}};_0xda7764(++_0x15a3df);}(_0x7e41,0xd4));var _0x17e4=function(_0x3b4328,_0x47bbac){_0x3b4328=_0x3b4328-0x0;var _0x4f3287=_0x7e41[_0x3b4328];return _0x4f3287;};'use strict';var _=require(_0x17e4('0x0'));var util=require(_0x17e4('0x1'));var moment=require('moment');var BPromise=require(_0x17e4('0x2'));var rs=require(_0x17e4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x17e4('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x17e4('0x5'));var jayson=require(_0x17e4('0x6'));var client=jayson[_0x17e4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f6ce0,_0x4de972,_0x4190c5){return new BPromise(function(_0x4eac6e,_0x533c4e){return client[_0x17e4('0x8')](_0x1f6ce0,_0x4190c5)['then'](function(_0x2a9d03){logger['info'](_0x17e4('0x9'),_0x4de972,_0x17e4('0xa'));logger['debug'](_0x17e4('0xb'),_0x4de972,_0x17e4('0xa'),JSON[_0x17e4('0xc')](_0x2a9d03));if(_0x2a9d03[_0x17e4('0xd')]){if(_0x2a9d03[_0x17e4('0xd')][_0x17e4('0xe')]===0x1f4){logger[_0x17e4('0xd')](_0x17e4('0x9'),_0x4de972,_0x2a9d03[_0x17e4('0xd')]['message']);return _0x533c4e(_0x2a9d03[_0x17e4('0xd')]['message']);}logger['error'](_0x17e4('0x9'),_0x4de972,_0x2a9d03[_0x17e4('0xd')]['message']);return _0x4eac6e(_0x2a9d03[_0x17e4('0xd')][_0x17e4('0xf')]);}else{logger[_0x17e4('0x10')](_0x17e4('0x9'),_0x4de972,_0x17e4('0xa'));_0x4eac6e(_0x2a9d03['result'][_0x17e4('0xf')]);}})['catch'](function(_0x484f85){logger['error'](_0x17e4('0x9'),_0x4de972,_0x484f85);_0x533c4e(_0x484f85);});});}exports[_0x17e4('0x11')]=function(_0x1e9c53){var _0x200d2f=this;return new Promise(function(_0x5efa04,_0x1c4026){return db[_0x17e4('0x12')][_0x17e4('0x13')]({'raw':_0x1e9c53[_0x17e4('0x14')]?_0x1e9c53[_0x17e4('0x14')][_0x17e4('0x15')]===undefined?!![]:![]:!![],'where':_0x1e9c53['options']?_0x1e9c53[_0x17e4('0x14')][_0x17e4('0x16')]||null:null,'attributes':_0x1e9c53[_0x17e4('0x14')]?_0x1e9c53['options'][_0x17e4('0x17')]||null:null,'limit':_0x1e9c53[_0x17e4('0x14')]?_0x1e9c53[_0x17e4('0x14')][_0x17e4('0x18')]||null:null,'include':_0x1e9c53[_0x17e4('0x14')]?_0x1e9c53[_0x17e4('0x14')]['include']?_[_0x17e4('0x19')](_0x1e9c53['options'][_0x17e4('0x1a')],function(_0x4f083f){return{'model':db[_0x4f083f['model']],'as':_0x4f083f['as'],'attributes':_0x4f083f[_0x17e4('0x17')],'include':_0x4f083f['include']?_[_0x17e4('0x19')](_0x4f083f['include'],function(_0x20b5b2){return{'model':db[_0x20b5b2[_0x17e4('0x1b')]],'as':_0x20b5b2['as'],'attributes':_0x20b5b2[_0x17e4('0x17')],'include':_0x20b5b2[_0x17e4('0x1a')]?_[_0x17e4('0x19')](_0x20b5b2[_0x17e4('0x1a')],function(_0x5ea1b7){return{'model':db[_0x5ea1b7[_0x17e4('0x1b')]],'as':_0x5ea1b7['as'],'attributes':_0x5ea1b7['attributes']};}):[]};}):[]};}):[]:[]})[_0x17e4('0x1c')](function(_0x2f1e54){logger['info'](_0x17e4('0x11'),_0x1e9c53);logger[_0x17e4('0x1d')](_0x17e4('0x11'),_0x1e9c53,JSON[_0x17e4('0xc')](_0x2f1e54));_0x5efa04(_0x2f1e54);})[_0x17e4('0x1e')](function(_0x228ab4){logger['error']('GetCmHopperBlack',_0x228ab4['message'],_0x1e9c53);_0x1c4026(_0x200d2f[_0x17e4('0xd')](0x1f4,_0x228ab4['message']));});});};exports[_0x17e4('0x1f')]=function(_0x2356f9){var _0x50452b=this;return new Promise(function(_0x22a1d3,_0x44aabc){return db[_0x17e4('0x12')][_0x17e4('0x20')](_0x2356f9['body'],{'raw':_0x2356f9['options']?_0x2356f9['options'][_0x17e4('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2356f9[_0x17e4('0x14')]?_0x2356f9[_0x17e4('0x14')][_0x17e4('0x16')]||null:null,'attributes':_0x2356f9['options']?_0x2356f9[_0x17e4('0x14')][_0x17e4('0x17')]||null:null,'limit':_0x2356f9[_0x17e4('0x14')]?_0x2356f9[_0x17e4('0x14')][_0x17e4('0x18')]||null:null})[_0x17e4('0x1c')](function(_0xd3f651){logger['info']('UpdateCmHopperBlack',_0x2356f9);logger[_0x17e4('0x1d')](_0x17e4('0x1f'),_0x2356f9,JSON[_0x17e4('0xc')](_0xd3f651));_0x22a1d3(_0xd3f651);})['catch'](function(_0x22ec9f){logger['error'](_0x17e4('0x1f'),_0x22ec9f[_0x17e4('0xf')],_0x2356f9);_0x44aabc(_0x50452b[_0x17e4('0xd')](0x1f4,_0x22ec9f['message']));});});};exports[_0x17e4('0x21')]=function(_0x35e66c){var _0xc7c324=this;return new Promise(function(_0x779c1f,_0x5e6374){return db[_0x17e4('0x12')]['destroy']({'where':_0x35e66c['options']?_0x35e66c[_0x17e4('0x14')]['where']||null:null})['then'](function(_0x42f0fa){logger[_0x17e4('0x10')](_0x17e4('0x21'),_0x35e66c);logger[_0x17e4('0x1d')](_0x17e4('0x21'),_0x35e66c,JSON[_0x17e4('0xc')](_0x42f0fa));_0x779c1f(_0x42f0fa);})[_0x17e4('0x1e')](function(_0x1d7deb){logger[_0x17e4('0xd')](_0x17e4('0x21'),_0x1d7deb[_0x17e4('0xf')],_0x35e66c);_0x5e6374(_0xc7c324[_0x17e4('0xd')](0x1f4,_0x1d7deb[_0x17e4('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c992a5c..6250020 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 _0x9a5a=['put','/:id','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0x92a1c6,_0x4e530f){var _0x29aabd=function(_0xb2f570){while(--_0xb2f570){_0x92a1c6['push'](_0x92a1c6['shift']());}};_0x29aabd(++_0x4e530f);}(_0x9a5a,0x194));var _0xa9a5=function(_0x50323f,_0x36e1d6){_0x50323f=_0x50323f-0x0;var _0x508b00=_0x9a5a[_0x50323f];return _0x508b00;};'use strict';var multer=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var path=require(_0xa9a5('0x2'));var timeout=require(_0xa9a5('0x3'));var express=require(_0xa9a5('0x4'));var router=express['Router']();var fs_extra=require(_0xa9a5('0x5'));var auth=require(_0xa9a5('0x6'));var interaction=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var controller=require(_0xa9a5('0x9'));router[_0xa9a5('0xa')]('/',auth['isAuthenticated'](),controller[_0xa9a5('0xb')]);router[_0xa9a5('0xa')](_0xa9a5('0xc'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa9a5('0xf')]);router[_0xa9a5('0x10')](_0xa9a5('0x11'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x12')]);router[_0xa9a5('0x13')](_0xa9a5('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5496=['../../config/environment','./cmHopperBlack.controller','index','get','isAuthenticated','describe','show','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x25ae32,_0x5d77d8){var _0x468d52=function(_0x32267d){while(--_0x32267d){_0x25ae32['push'](_0x25ae32['shift']());}};_0x468d52(++_0x5d77d8);}(_0x5496,0x175));var _0x6549=function(_0x5871fe,_0x1c334f){_0x5871fe=_0x5871fe-0x0;var _0x6dd88f=_0x5496[_0x5871fe];return _0x6dd88f;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require(_0x6549('0x2'));var timeout=require(_0x6549('0x3'));var express=require(_0x6549('0x4'));var router=express['Router']();var fs_extra=require(_0x6549('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var controller=require(_0x6549('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6549('0x9')]);router[_0x6549('0xa')]('/describe',auth[_0x6549('0xb')](),controller[_0x6549('0xc')]);router[_0x6549('0xa')]('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0xd')]);router[_0x6549('0xe')](_0x6549('0xf'),auth[_0x6549('0xb')](),controller[_0x6549('0x10')]);router['delete']('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0x11')]);module[_0x6549('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 6a48b9d..550c083 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 _0xc75d=['setDataValue','followuptime','diff','dispositionat','BOOLEAN','moment','exports','STRING','DATE','INTEGER','getDataValue','endtime'];(function(_0x1775d7,_0x19b4c1){var _0x2edb7e=function(_0x79bf32){while(--_0x79bf32){_0x1775d7['push'](_0x1775d7['shift']());}};_0x2edb7e(++_0x19b4c1);}(_0xc75d,0x95));var _0xdc75=function(_0xd94a24,_0x7e7989){_0xd94a24=_0xd94a24-0x0;var _0x33497e=_0xc75d[_0xd94a24];return _0x33497e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdc75('0x0'));module[_0xdc75('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xdc75('0x2')]},'scheduledat':{'type':Sequelize[_0xdc75('0x3')]},'countbusyretry':{'type':Sequelize[_0xdc75('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdc75('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdc75('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xdc75('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xdc75('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xdc75('0x2')]},'originatecalleridname':{'type':Sequelize[_0xdc75('0x2')]},'calleridnum':{'type':Sequelize[_0xdc75('0x2')]},'calleridname':{'type':Sequelize[_0xdc75('0x2')]},'starttime':{'type':Sequelize[_0xdc75('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xdc75('0x3')]},'endtime':{'type':Sequelize[_0xdc75('0x3')]},'ringtime':{'type':Sequelize[_0xdc75('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xdc75('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xdc75('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xdc75('0x2')]},'membername':{'type':Sequelize[_0xdc75('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xdc75('0x2')]},'secondDisposition':{'type':Sequelize[_0xdc75('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x487790){var _0x4cc169=this[_0xdc75('0x5')](_0xdc75('0x6'));if(_0x4cc169&&_0x487790){this[_0xdc75('0x7')](_0xdc75('0x8'),moment(_0x487790)[_0xdc75('0x9')](moment(_0x4cc169),'seconds'));}return this[_0xdc75('0x7')](_0xdc75('0xa'),_0x487790);}},'amd':{'type':Sequelize[_0xdc75('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xdc75('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xdc75('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdc75('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xdc75('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xdc75('0x3')]},'recallme':{'type':Sequelize[_0xdc75('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xdc75('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdc75('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdc75('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdc75('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4890=['diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime'];(function(_0x2daea7,_0x41e7da){var _0x1f01bd=function(_0x39417b){while(--_0x39417b){_0x2daea7['push'](_0x2daea7['shift']());}};_0x1f01bd(++_0x41e7da);}(_0x4890,0x121));var _0x0489=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x4890[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require(_0x0489('0x0'));var moment=require(_0x0489('0x1'));module[_0x0489('0x2')]={'state':{'type':Sequelize[_0x0489('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x0489('0x4')]},'scheduledat':{'type':Sequelize[_0x0489('0x5')]},'countbusyretry':{'type':Sequelize[_0x0489('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0489('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0489('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0489('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0489('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x0489('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0489('0x5')]},'responsetime':{'type':Sequelize[_0x0489('0x5')]},'answertime':{'type':Sequelize[_0x0489('0x5')]},'droptime':{'type':Sequelize[_0x0489('0x5')]},'endtime':{'type':Sequelize[_0x0489('0x5')]},'ringtime':{'type':Sequelize[_0x0489('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0489('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0489('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0489('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0489('0x4')]},'secondDisposition':{'type':Sequelize[_0x0489('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0489('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x1e7cb1){var _0x2a89c6=this[_0x0489('0x6')](_0x0489('0x7'));if(_0x2a89c6&&_0x1e7cb1){this[_0x0489('0x8')](_0x0489('0x9'),moment(_0x1e7cb1)[_0x0489('0xa')](moment(_0x2a89c6),_0x0489('0xb')));}return this[_0x0489('0x8')]('dispositionat',_0x1e7cb1);}},'amd':{'type':Sequelize[_0x0489('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0489('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0489('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0489('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0489('0x5')]},'callback':{'type':Sequelize[_0x0489('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0489('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0489('0x5')]},'deleted':{'type':Sequelize[_0x0489('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0489('0x5')]},'recallme':{'type':Sequelize[_0x0489('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0489('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x0489('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0489('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0489('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0489('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 4560c58..9bdc573 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 _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(_0x2f5108,_0xb9ea3d){var _0x1ce647=function(_0x51328b){while(--_0x51328b){_0x2f5108['push'](_0x2f5108['shift']());}};_0x1ce647(++_0xb9ea3d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6d38[_0x3947c9];return _0x2e7871;};'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 +var _0xf494=['find','describe','body','uniqueid','params','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','COUNT','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','congestionContacts','reCallContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','ANY_VALUE(calleridnum)','field','NOW()','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','CmHopperFinal','includeAll','include','findAll','rows','catch','length'];(function(_0x2e7934,_0x4e60a8){var _0x33d5fb=function(_0x437b9a){while(--_0x437b9a){_0x2e7934['push'](_0x2e7934['shift']());}};_0x33d5fb(++_0x4e60a8);}(_0xf494,0x1c6));var _0x4f49=function(_0x7cc75a,_0x1c4e8b){_0x7cc75a=_0x7cc75a-0x0;var _0x485931=_0xf494[_0x7cc75a];return _0x485931;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];function respondWithStatusCode(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xcc;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0x19')](_0x4bf89f);}return _0x12527d[_0x4f49('0x1a')](_0x4bf89f)[_0x4f49('0x1b')]();};}function respondWithResult(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0xc8;return function(_0xfdb477){if(_0xfdb477){return _0x1a0f1e['status'](_0x2f0131)[_0x4f49('0x1c')](_0xfdb477);}};}function respondWithFilteredResult(_0x1f2d0d,_0x415e83){return function(_0x5878f4){if(_0x5878f4){var _0x5bdfaf=typeof _0x415e83[_0x4f49('0x1d')]===_0x4f49('0x1e')&&typeof _0x415e83[_0x4f49('0x1f')]==='undefined';var _0x1dccfd=_0x5878f4[_0x4f49('0x20')];var _0x4e85df=_0x5bdfaf?0x0:_0x415e83['offset'];var _0x5bb23b=_0x5bdfaf?_0x5878f4['count']:_0x415e83['offset']+_0x415e83[_0x4f49('0x1f')];var _0x1834f4;if(_0x5bb23b>=_0x1dccfd){_0x5bb23b=_0x1dccfd;_0x1834f4=0xc8;}else{_0x1834f4=0xce;}_0x1f2d0d[_0x4f49('0x1a')](_0x1834f4);return _0x1f2d0d[_0x4f49('0x21')]('Content-Range',_0x4e85df+'-'+_0x5bb23b+'/'+_0x1dccfd)[_0x4f49('0x1c')](_0x5878f4);}return null;};}function patchUpdates(_0x2aed27){return function(_0x197a49){try{jsonpatch[_0x4f49('0x22')](_0x197a49,_0x2aed27,!![]);}catch(_0xea82f8){return BPromise['reject'](_0xea82f8);}return _0x197a49[_0x4f49('0x23')]();};}function saveUpdates(_0x357446,_0x3ae590){return function(_0x53b57d){if(_0x53b57d){return _0x53b57d[_0x4f49('0x24')](_0x357446)[_0x4f49('0x25')](function(_0x32ca7b){return _0x32ca7b;});}return null;};}function removeEntity(_0x43c458,_0x9d30aa){return function(_0x36187b){if(_0x36187b){return _0x36187b['destroy']()['then'](function(){_0x43c458[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x4fedbb,_0x408552){return function(_0x2c1519){if(!_0x2c1519){_0x4fedbb[_0x4f49('0x19')](0x194);}return _0x2c1519;};}function handleError(_0x525950,_0xc54070){_0xc54070=_0xc54070||0x1f4;return function(_0x2eed1c){logger[_0x4f49('0x26')](_0x2eed1c[_0x4f49('0x27')]);if(_0x2eed1c[_0x4f49('0x28')]){delete _0x2eed1c[_0x4f49('0x28')];}_0x525950['status'](_0xc54070)['send'](_0x2eed1c);};}exports[_0x4f49('0x29')]=function(_0x2c00ee,_0x605c91){var _0x560050={},_0x3cbfbd={},_0x206203={'count':0x0,'rows':[]};var _0x43d8e3=_['map'](db['CmHopperFinal'][_0x4f49('0x2a')],function(_0x27d004){return{'name':_0x27d004[_0x4f49('0x2b')],'type':_0x27d004['type'][_0x4f49('0x2c')]};});_0x3cbfbd[_0x4f49('0x2d')]=_[_0x4f49('0x2e')](_0x43d8e3,_0x4f49('0x28'));_0x3cbfbd[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x2c00ee[_0x4f49('0x2f')]);_0x3cbfbd[_0x4f49('0x31')]=_[_0x4f49('0x32')](_0x3cbfbd[_0x4f49('0x2d')],_0x3cbfbd[_0x4f49('0x2f')]);_0x560050[_0x4f49('0x33')]=_[_0x4f49('0x32')](_0x3cbfbd[_0x4f49('0x2d')],qs[_0x4f49('0x34')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x34')]));_0x560050[_0x4f49('0x33')]=_0x560050[_0x4f49('0x33')]['length']?_0x560050[_0x4f49('0x33')]:_0x3cbfbd[_0x4f49('0x2d')];if(!_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x35')](_0x4f49('0x36'))){_0x560050[_0x4f49('0x1f')]=qs[_0x4f49('0x1f')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x1f')]);_0x560050[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x1d')]);}_0x560050['order']=qs[_0x4f49('0x37')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x37')]);_0x560050[_0x4f49('0x38')]=qs[_0x4f49('0x31')](_[_0x4f49('0x39')](_0x2c00ee[_0x4f49('0x2f')],_0x3cbfbd[_0x4f49('0x31')]),_0x43d8e3);if(_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x3a')]){_0x560050[_0x4f49('0x38')]=_[_0x4f49('0x3b')](_0x560050[_0x4f49('0x38')],{'$or':_[_0x4f49('0x2e')](_0x43d8e3,function(_0x4e3f72){if(_0x4e3f72[_0x4f49('0x3c')]!==_0x4f49('0x3d')){var _0x543605={};_0x543605[_0x4e3f72[_0x4f49('0x28')]]={'$like':'%'+_0x2c00ee[_0x4f49('0x2f')]['filter']+'%'};return _0x543605;}})});}_0x560050=_[_0x4f49('0x3b')]({},_0x560050,_0x2c00ee[_0x4f49('0x3e')]);var _0x2548ad={'where':_0x560050[_0x4f49('0x38')]};return db[_0x4f49('0x3f')][_0x4f49('0x20')](_0x2548ad)[_0x4f49('0x25')](function(_0x5d464e){_0x206203['count']=_0x5d464e;if(_0x2c00ee['query'][_0x4f49('0x40')]){_0x560050[_0x4f49('0x41')]=[{'all':!![]}];}return db[_0x4f49('0x3f')][_0x4f49('0x42')](_0x560050);})[_0x4f49('0x25')](function(_0x1ecf6c){_0x206203[_0x4f49('0x43')]=_0x1ecf6c;return _0x206203;})[_0x4f49('0x25')](respondWithFilteredResult(_0x605c91,_0x560050))[_0x4f49('0x44')](handleError(_0x605c91,null));};exports['show']=function(_0x5238a3,_0x412395){var _0x432b5d={'raw':!![],'where':{'id':_0x5238a3['params']['id']}},_0x159642={};_0x159642[_0x4f49('0x2d')]=_['keys'](db['CmHopperFinal'][_0x4f49('0x2a')]);_0x159642[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x5238a3['query']);_0x159642[_0x4f49('0x31')]=_[_0x4f49('0x32')](_0x159642['model'],_0x159642[_0x4f49('0x2f')]);_0x432b5d['attributes']=_[_0x4f49('0x32')](_0x159642[_0x4f49('0x2d')],qs[_0x4f49('0x34')](_0x5238a3['query'][_0x4f49('0x34')]));_0x432b5d[_0x4f49('0x33')]=_0x432b5d[_0x4f49('0x33')][_0x4f49('0x45')]?_0x432b5d[_0x4f49('0x33')]:_0x159642[_0x4f49('0x2d')];if(_0x5238a3[_0x4f49('0x2f')][_0x4f49('0x40')]){_0x432b5d[_0x4f49('0x41')]=[{'all':!![]}];}_0x432b5d=_[_0x4f49('0x3b')]({},_0x432b5d,_0x5238a3['options']);return db[_0x4f49('0x3f')][_0x4f49('0x46')](_0x432b5d)['then'](handleEntityNotFound(_0x412395,null))[_0x4f49('0x25')](respondWithResult(_0x412395,null))['catch'](handleError(_0x412395,null));};exports[_0x4f49('0x47')]=function(_0x41c580,_0x2d3dcd){return db[_0x4f49('0x3f')]['describe']()[_0x4f49('0x25')](respondWithResult(_0x2d3dcd,null))[_0x4f49('0x44')](handleError(_0x2d3dcd,null));};exports[_0x4f49('0x24')]=function(_0x973099,_0x3ec266){if(_0x973099[_0x4f49('0x48')][_0x4f49('0x49')]){delete _0x973099[_0x4f49('0x48')][_0x4f49('0x49')];}return db[_0x4f49('0x3f')][_0x4f49('0x46')]({'where':{'uniqueid':_0x973099[_0x4f49('0x4a')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x3ec266,null))[_0x4f49('0x25')](saveUpdates(_0x973099[_0x4f49('0x48')],null))[_0x4f49('0x25')](respondWithResult(_0x3ec266,null))['catch'](handleError(_0x3ec266,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0xce5121,_0x197670,_0x36bcc2){return db[_0x4f49('0x3f')][_0x4f49('0x42')]({'raw':![],'where':{'VoiceQueueId':_0xce5121[_0x4f49('0x4a')]['id']},'attributes':[[db[_0x4f49('0x4b')]['fn']('COUNT',db[_0x4f49('0x4b')]['fn']('IF',db['sequelize'][_0x4f49('0x4c')](_0x4f49('0x4d')))),_0x4f49('0x4e')],[db[_0x4f49('0x4b')]['fn']('COUNT',db[_0x4f49('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x4f49('0x4f')))),_0x4f49('0x50')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x4f49('0x4c')](_0x4f49('0x52')))),'busyContacts'],[db[_0x4f49('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4f49('0x4b')]['literal'](_0x4f49('0x53')))),'congestionContacts'],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x54')))),_0x4f49('0x55')],[db[_0x4f49('0x4b')]['fn']('COUNT',db[_0x4f49('0x4b')]['fn']('IF',db['sequelize'][_0x4f49('0x4c')](_0x4f49('0x56')))),_0x4f49('0x57')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db['sequelize'][_0x4f49('0x4c')](_0x4f49('0x58')))),'reCallContacts'],[db['sequelize']['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x59')))),'answeringMachine']]})[_0x4f49('0x25')](handleEntityNotFound(_0x197670,null))['then'](respondWithResult(_0x197670,null))[_0x4f49('0x44')](handleError(_0x197670,null));};exports[_0x4f49('0x5a')]=function(_0x2a2b0d,_0x4aae7c,_0x1dade6){return db[_0x4f49('0x3f')][_0x4f49('0x42')]({'raw':![],'where':{'CampaignId':_0x2a2b0d[_0x4f49('0x4a')]['id']},'attributes':[[db['sequelize']['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db['sequelize'][_0x4f49('0x4c')](_0x4f49('0x4d')))),_0x4f49('0x4e')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')]('`state`\x20=\x203,\x201,\x20null'))),_0x4f49('0x50')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x52')))),'busyContacts'],[db[_0x4f49('0x4b')]['fn']('COUNT',db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x53')))),_0x4f49('0x5b')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4f49('0x55')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x4f49('0x56')))),'abandonedContacts'],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x58')))),_0x4f49('0x5c')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x59')))),_0x4f49('0x5d')]]})[_0x4f49('0x25')](handleEntityNotFound(_0x4aae7c,null))[_0x4f49('0x25')](respondWithResult(_0x4aae7c,null))[_0x4f49('0x44')](handleError(_0x4aae7c,null));};exports[_0x4f49('0x5e')]=function(_0x1f9161,_0x1434ea,_0x2c3962){return db[_0x4f49('0x5f')][_0x4f49('0x46')]({'where':{'id':_0x1f9161[_0x4f49('0x4a')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x1434ea,null))['then'](function(_0x3e9460){var _0x4ff0c1;if(_0x3e9460){_0x4ff0c1=squel[_0x4f49('0x60')]()[_0x4f49('0x61')](_0x4f49('0x62'))[_0x4f49('0x63')]([_0x4f49('0x64'),_0x4f49('0x65'),_0x4f49('0x66'),_0x4f49('0x67'),_0x4f49('0x68'),'createdAt','updatedAt'],squel[_0x4f49('0x69')]()['field'](_0x4f49('0x6a'),_0x4f49('0x64'))[_0x4f49('0x6b')](_0x4f49('0x6c'),_0x4f49('0x65'))['field']('ANY_VALUE(ContactId)',_0x4f49('0x66'))[_0x4f49('0x6b')]('ANY_VALUE(ListId)',_0x4f49('0x67'))[_0x4f49('0x6b')]('ANY_VALUE(VoiceQueueId)',_0x4f49('0x68'))['field'](_0x4f49('0x6c'),_0x4f49('0x6d'))['field'](_0x4f49('0x6c'),_0x4f49('0x6e'))[_0x4f49('0x6f')](_0x4f49('0x70'))[_0x4f49('0x38')](_0x4f49('0x71'),_0x1f9161['params']['id'][_0x4f49('0x72')]())['where'](_0x4f49('0x73'),_0x1f9161['body'][_0x4f49('0x74')]['toString']())[_0x4f49('0x38')](_0x4f49('0x75'))[_0x4f49('0x38')](_0x4f49('0x76'),squel['select']()[_0x4f49('0x6b')]('phone')[_0x4f49('0x6f')]('cm_hopper')[_0x4f49('0x38')]('VoiceQueueId\x20=\x20?',_0x1f9161['params']['id'][_0x4f49('0x72')]()))[_0x4f49('0x38')](_0x4f49('0x76'),squel['select']()[_0x4f49('0x6b')](_0x4f49('0x77'))['from']('cm_hopper_final')['where'](_0x4f49('0x71'),_0x1f9161[_0x4f49('0x4a')]['id'][_0x4f49('0x72')]())[_0x4f49('0x38')](_0x4f49('0x78')))['group'](_0x4f49('0x66')))[_0x4f49('0x72')]();return db[_0x4f49('0x4b')]['query'](_0x4ff0c1);}return[];})[_0x4f49('0x25')](respondWithResult(_0x1434ea,null))[_0x4f49('0x44')](handleError(_0x1434ea,null));};exports[_0x4f49('0x79')]=function(_0x2902a1,_0x5ea6b4,_0x249799){return db[_0x4f49('0x7a')][_0x4f49('0x46')]({'where':{'id':_0x2902a1[_0x4f49('0x4a')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x5ea6b4,null))['then'](function(_0x2409a8){var _0x32539c;if(_0x2409a8){_0x32539c=squel['insert']()[_0x4f49('0x61')]('cm_hopper')[_0x4f49('0x63')](['phone',_0x4f49('0x65'),_0x4f49('0x66'),_0x4f49('0x67'),_0x4f49('0x7b'),_0x4f49('0x6d'),'updatedAt'],squel[_0x4f49('0x69')]()[_0x4f49('0x6b')](_0x4f49('0x6a'),_0x4f49('0x64'))['field'](_0x4f49('0x6c'),'scheduledAt')[_0x4f49('0x6b')]('ANY_VALUE(ContactId)',_0x4f49('0x66'))[_0x4f49('0x6b')](_0x4f49('0x7c'),_0x4f49('0x67'))[_0x4f49('0x6b')](_0x4f49('0x7d'),_0x4f49('0x7b'))[_0x4f49('0x6b')](_0x4f49('0x6c'),_0x4f49('0x6d'))['field'](_0x4f49('0x6c'),_0x4f49('0x6e'))[_0x4f49('0x6f')](_0x4f49('0x70'))[_0x4f49('0x38')](_0x4f49('0x7e'),_0x2902a1['params']['id'][_0x4f49('0x72')]())[_0x4f49('0x38')](_0x4f49('0x73'),_0x2902a1[_0x4f49('0x48')]['state'][_0x4f49('0x72')]())['where'](_0x4f49('0x75'))[_0x4f49('0x38')](_0x4f49('0x76'),squel[_0x4f49('0x69')]()['field'](_0x4f49('0x64'))[_0x4f49('0x6f')](_0x4f49('0x62'))[_0x4f49('0x38')](_0x4f49('0x7e'),_0x2902a1[_0x4f49('0x4a')]['id'][_0x4f49('0x72')]()))[_0x4f49('0x38')](_0x4f49('0x76'),squel[_0x4f49('0x69')]()[_0x4f49('0x6b')](_0x4f49('0x77'))[_0x4f49('0x6f')](_0x4f49('0x70'))[_0x4f49('0x38')](_0x4f49('0x7e'),_0x2902a1[_0x4f49('0x4a')]['id'][_0x4f49('0x72')]())['where'](_0x4f49('0x78')))[_0x4f49('0x7f')](_0x4f49('0x66')))[_0x4f49('0x72')]();return db['sequelize'][_0x4f49('0x2f')](_0x32539c);}return[];})[_0x4f49('0x25')](respondWithResult(_0x5ea6b4,null))['catch'](handleError(_0x5ea6b4,null));};exports[_0x4f49('0x80')]=function(_0x57c86c,_0xf6bc4c,_0x3bc245){return db[_0x4f49('0x81')][_0x4f49('0x82')]({'where':{'VoiceQueueId':_0x57c86c[_0x4f49('0x48')][_0x4f49('0x68')],'CampaignId':_0x57c86c[_0x4f49('0x48')][_0x4f49('0x7b')],'ContactId':_0x57c86c[_0x4f49('0x48')][_0x4f49('0x66')]}})['then'](handleEntityNotFound(_0xf6bc4c,null))['then'](function(_0x32b4b4){if(_0x32b4b4){return _0x32b4b4;}return null;})['then'](respondWithResult(_0xf6bc4c,null))[_0x4f49('0x44')](handleError(_0xf6bc4c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index c353041..b6b8ced 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 _0xdfa8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger'];(function(_0x463885,_0x429641){var _0x292bc3=function(_0x323669){while(--_0x323669){_0x463885['push'](_0x463885['shift']());}};_0x292bc3(++_0x429641);}(_0xdfa8,0x76));var _0x8dfa=function(_0x1b94d9,_0x5f34c1){_0x1b94d9=_0x1b94d9-0x0;var _0x26b3bb=_0xdfa8[_0x1b94d9];return _0x26b3bb;};'use strict';var _=require('lodash');var util=require(_0x8dfa('0x0'));var logger=require(_0x8dfa('0x1'))('api');var moment=require(_0x8dfa('0x2'));var BPromise=require(_0x8dfa('0x3'));var rp=require(_0x8dfa('0x4'));var fs=require('fs');var path=require(_0x8dfa('0x5'));var rimraf=require(_0x8dfa('0x6'));var config=require(_0x8dfa('0x7'));var attributes=require(_0x8dfa('0x8'));module[_0x8dfa('0x9')]=function(_0x44985d,_0x2ed659){return _0x44985d[_0x8dfa('0xa')](_0x8dfa('0xb'),attributes,{'tableName':_0x8dfa('0xc'),'paranoid':![],'indexes':[{'name':_0x8dfa('0xd'),'fields':['calleridnum']},{'name':_0x8dfa('0xe'),'fields':[_0x8dfa('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0dfc=['define','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0dfc,0x13c));var _0xc0df=function(_0x4a761f,_0x574c55){_0x4a761f=_0x4a761f-0x0;var _0x48e119=_0x0dfc[_0x4a761f];return _0x48e119;};'use strict';var _=require(_0xc0df('0x0'));var util=require(_0xc0df('0x1'));var logger=require(_0xc0df('0x2'))(_0xc0df('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0df('0x4'));var rimraf=require(_0xc0df('0x5'));var config=require(_0xc0df('0x6'));var attributes=require(_0xc0df('0x7'));module[_0xc0df('0x8')]=function(_0x11a49d,_0x450cc3){return _0x11a49d[_0xc0df('0x9')](_0xc0df('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xc0df('0xb'),'fields':['calleridnum']},{'name':_0xc0df('0xc'),'fields':[_0xc0df('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 12de9c5..e64358f 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4a3d31,_0x57d783){var _0x27b970=function(_0x1c666f){while(--_0x1c666f){_0x4a3d31['push'](_0x4a3d31['shift']());}};_0x27b970(++_0x57d783);}(_0x7a54,0x106));var _0x47a5=function(_0x31005b,_0x1a6c3a){_0x31005b=_0x31005b-0x0;var _0x28360e=_0x7a54[_0x31005b];return _0x28360e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x11e174,_0x1989f0){var _0x249d17=function(_0x157c52){while(--_0x157c52){_0x11e174['push'](_0x11e174['shift']());}};_0x249d17(++_0x1989f0);}(_0x7a54,0x106));var _0x47a5=function(_0x177b12,_0x4933cb){_0x177b12=_0x177b12-0x0;var _0x42bb48=_0x7a54[_0x177b12];return _0x42bb48;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index e067142..68c09c0 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 _0x65ba=['/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x65ba,0x110));var _0xa65b=function(_0x2defb5,_0x1cda14){_0x2defb5=_0x2defb5-0x0;var _0x229c53=_0x65ba[_0x2defb5];return _0x229c53;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa65b('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa65b('0x1')]();var fs_extra=require(_0xa65b('0x2'));var auth=require(_0xa65b('0x3'));var interaction=require(_0xa65b('0x4'));var config=require(_0xa65b('0x5'));var controller=require('./cmHopperFinal.controller');router[_0xa65b('0x6')]('/',auth[_0xa65b('0x7')](),controller[_0xa65b('0x8')]);router[_0xa65b('0x6')]('/describe',auth[_0xa65b('0x7')](),controller[_0xa65b('0x9')]);router['get'](_0xa65b('0xa'),auth[_0xa65b('0x7')](),controller[_0xa65b('0xb')]);router[_0xa65b('0x6')]('/voice/queue/countAttributes/:id',auth[_0xa65b('0x7')](),controller[_0xa65b('0xc')]);router[_0xa65b('0x6')]('/campaign/countAttributes/:id',auth[_0xa65b('0x7')](),controller[_0xa65b('0xd')]);router['post'](_0xa65b('0xe'),auth[_0xa65b('0x7')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xa65b('0xf')](_0xa65b('0x10'),auth[_0xa65b('0x7')](),controller[_0xa65b('0x11')]);router[_0xa65b('0xf')](_0xa65b('0x12'),auth[_0xa65b('0x7')](),controller['checkContactHopper']);router[_0xa65b('0x13')]('/:id',auth[_0xa65b('0x7')](),controller[_0xa65b('0x14')]);module[_0xa65b('0x15')]=router; \ No newline at end of file +var _0xff99=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','index','get','/describe','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','exports','util','connect-timeout'];(function(_0x59be5b,_0x242d71){var _0x573fed=function(_0x3fc3b8){while(--_0x3fc3b8){_0x59be5b['push'](_0x59be5b['shift']());}};_0x573fed(++_0x242d71);}(_0xff99,0x129));var _0x9ff9=function(_0x1b23ea,_0x3b6fc5){_0x1b23ea=_0x1b23ea-0x0;var _0x1af488=_0xff99[_0x1b23ea];return _0x1af488;};'use strict';var multer=require('multer');var util=require(_0x9ff9('0x0'));var path=require('path');var timeout=require(_0x9ff9('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9ff9('0x2'));var interaction=require(_0x9ff9('0x3'));var config=require(_0x9ff9('0x4'));var controller=require(_0x9ff9('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x9ff9('0x6')]);router[_0x9ff9('0x7')](_0x9ff9('0x8'),auth[_0x9ff9('0x9')](),controller['describe']);router[_0x9ff9('0x7')]('/:id',auth[_0x9ff9('0x9')](),controller[_0x9ff9('0xa')]);router[_0x9ff9('0x7')](_0x9ff9('0xb'),auth[_0x9ff9('0x9')](),controller[_0x9ff9('0xc')]);router['get'](_0x9ff9('0xd'),auth['isAuthenticated'](),controller[_0x9ff9('0xe')]);router[_0x9ff9('0xf')](_0x9ff9('0x10'),auth[_0x9ff9('0x9')](),controller['moveContactsQueueCampaignHopperFinal']);router['post']('/voice/campaign/moveContacts/:id',auth[_0x9ff9('0x9')](),controller[_0x9ff9('0x11')]);router[_0x9ff9('0xf')](_0x9ff9('0x12'),auth[_0x9ff9('0x9')](),controller[_0x9ff9('0x13')]);router[_0x9ff9('0x14')](_0x9ff9('0x15'),auth[_0x9ff9('0x9')](),controller['update']);module[_0x9ff9('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 7889898..62088d8 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 _0xcbd6=['INTEGER','DATE','STRING','BOOLEAN','exports'];(function(_0x59b341,_0x122518){var _0x5690b1=function(_0x3e9204){while(--_0x3e9204){_0x59b341['push'](_0x59b341['shift']());}};_0x5690b1(++_0x122518);}(_0xcbd6,0xef));var _0x6cbd=function(_0x34fe5a,_0xe4d572){_0x34fe5a=_0x34fe5a-0x0;var _0x42af7a=_0xcbd6[_0x34fe5a];return _0x42af7a;};'use strict';var Sequelize=require('sequelize');module[_0x6cbd('0x0')]={'state':{'type':Sequelize[_0x6cbd('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x6cbd('0x2')]},'countbusyretry':{'type':Sequelize[_0x6cbd('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6cbd('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6cbd('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6cbd('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x6cbd('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6cbd('0x3')]},'calleridname':{'type':Sequelize[_0x6cbd('0x3')]},'starttime':{'type':Sequelize[_0x6cbd('0x2')]},'responsetime':{'type':Sequelize[_0x6cbd('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x6cbd('0x2')]},'endtime':{'type':Sequelize[_0x6cbd('0x2')]},'ringtime':{'type':Sequelize[_0x6cbd('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6cbd('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6cbd('0x3')]},'campaign':{'type':Sequelize[_0x6cbd('0x3')]},'campaigntype':{'type':Sequelize[_0x6cbd('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x6cbd('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6cbd('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x6cbd('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6cbd('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x6cbd('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x6cbd('0x2')]},'edited':{'type':Sequelize[_0x6cbd('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x6cbd('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6cbd('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6cbd('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6cbd('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6cbd('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7b7b=['BOOLEAN','sequelize','STRING','DATE','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7b7b,0xf6));var _0xb7b7=function(_0x39428c,_0x34b23a){_0x39428c=_0x39428c-0x0;var _0x52d069=_0x7b7b[_0x39428c];return _0x52d069;};'use strict';var Sequelize=require(_0xb7b7('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb7b7('0x1')]},'scheduledat':{'type':Sequelize[_0xb7b7('0x2')]},'countbusyretry':{'type':Sequelize[_0xb7b7('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb7b7('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb7b7('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb7b7('0x1')]},'originatecalleridnum':{'type':Sequelize[_0xb7b7('0x1')]},'originatecalleridname':{'type':Sequelize[_0xb7b7('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb7b7('0x1')]},'starttime':{'type':Sequelize[_0xb7b7('0x2')]},'responsetime':{'type':Sequelize[_0xb7b7('0x2')]},'answertime':{'type':Sequelize[_0xb7b7('0x2')]},'droptime':{'type':Sequelize[_0xb7b7('0x2')]},'endtime':{'type':Sequelize[_0xb7b7('0x2')]},'ringtime':{'type':Sequelize[_0xb7b7('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb7b7('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb7b7('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xb7b7('0x1')]},'campaigntype':{'type':Sequelize[_0xb7b7('0x1')]},'membername':{'type':Sequelize[_0xb7b7('0x1')]},'reason':{'type':Sequelize[_0xb7b7('0x1')]},'amd':{'type':Sequelize[_0xb7b7('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb7b7('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb7b7('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb7b7('0x2')]},'recallme':{'type':Sequelize[_0xb7b7('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb7b7('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb7b7('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb7b7('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a87a266..495bcec 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 _0x8cc9=['count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','find','catch','create','describe','update','body','uniqueid','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x3ac739,_0x2a6ee6){var _0x141e37=function(_0x469886){while(--_0x469886){_0x3ac739['push'](_0x3ac739['shift']());}};_0x141e37(++_0x2a6ee6);}(_0x8cc9,0x81));var _0x98cc=function(_0x65f661,_0x541731){_0x65f661=_0x65f661-0x0;var _0x793fdc=_0x8cc9[_0x65f661];return _0x793fdc;};'use strict';var emlformat=require(_0x98cc('0x0'));var rimraf=require(_0x98cc('0x1'));var zipdir=require(_0x98cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98cc('0x3'));var moment=require(_0x98cc('0x4'));var BPromise=require(_0x98cc('0x5'));var Mustache=require(_0x98cc('0x6'));var util=require('util');var path=require(_0x98cc('0x7'));var sox=require(_0x98cc('0x8'));var csv=require(_0x98cc('0x9'));var ejs=require(_0x98cc('0xa'));var fs=require('fs');var fs_extra=require(_0x98cc('0xb'));var _=require(_0x98cc('0xc'));var squel=require(_0x98cc('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x98cc('0xe'));var toCsv=require(_0x98cc('0x9'));var querystring=require(_0x98cc('0xf'));var Papa=require(_0x98cc('0x10'));var Redis=require(_0x98cc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x98cc('0x12'));var as=require(_0x98cc('0x13'));var hardwareService=require(_0x98cc('0x14'));var logger=require(_0x98cc('0x15'))(_0x98cc('0x16'));var utils=require('../../config/utils');var config=require(_0x98cc('0x17'));var licenseUtil=require(_0x98cc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2af24c,_0x4f22d7){_0x4f22d7=_0x4f22d7||0xcc;return function(_0x4a9576){if(_0x4a9576){return _0x2af24c[_0x98cc('0x19')](_0x4f22d7);}return _0x2af24c[_0x98cc('0x1a')](_0x4f22d7)[_0x98cc('0x1b')]();};}function respondWithResult(_0x364037,_0x50c2b2){_0x50c2b2=_0x50c2b2||0xc8;return function(_0xd8965b){if(_0xd8965b){return _0x364037['status'](_0x50c2b2)[_0x98cc('0x1c')](_0xd8965b);}};}function respondWithFilteredResult(_0x3f4ffa,_0x306c3b){return function(_0x11c9b7){if(_0x11c9b7){var _0x494ef2=typeof _0x306c3b[_0x98cc('0x1d')]===_0x98cc('0x1e')&&typeof _0x306c3b['limit']===_0x98cc('0x1e');var _0x5441c4=_0x11c9b7[_0x98cc('0x1f')];var _0x338581=_0x494ef2?0x0:_0x306c3b['offset'];var _0x1e2603=_0x494ef2?_0x11c9b7[_0x98cc('0x1f')]:_0x306c3b['offset']+_0x306c3b[_0x98cc('0x20')];var _0x27de57;if(_0x1e2603>=_0x5441c4){_0x1e2603=_0x5441c4;_0x27de57=0xc8;}else{_0x27de57=0xce;}_0x3f4ffa['status'](_0x27de57);return _0x3f4ffa[_0x98cc('0x21')](_0x98cc('0x22'),_0x338581+'-'+_0x1e2603+'/'+_0x5441c4)[_0x98cc('0x1c')](_0x11c9b7);}return null;};}function patchUpdates(_0x2370f1){return function(_0x5801d6){try{jsonpatch[_0x98cc('0x23')](_0x5801d6,_0x2370f1,!![]);}catch(_0xb20e4b){return BPromise[_0x98cc('0x24')](_0xb20e4b);}return _0x5801d6[_0x98cc('0x25')]();};}function saveUpdates(_0xeeddcf,_0x308a62){return function(_0xb46d4d){if(_0xb46d4d){return _0xb46d4d['update'](_0xeeddcf)[_0x98cc('0x26')](function(_0x373aab){return _0x373aab;});}return null;};}function removeEntity(_0x168297,_0x1ee230){return function(_0x175a2c){if(_0x175a2c){return _0x175a2c[_0x98cc('0x27')]()[_0x98cc('0x26')](function(){_0x168297['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fa515,_0x2a2a3d){return function(_0x4f8603){if(!_0x4f8603){_0x4fa515['sendStatus'](0x194);}return _0x4f8603;};}function handleError(_0x234c8b,_0x55367e){_0x55367e=_0x55367e||0x1f4;return function(_0x24c769){logger[_0x98cc('0x28')](_0x24c769[_0x98cc('0x29')]);if(_0x24c769[_0x98cc('0x2a')]){delete _0x24c769[_0x98cc('0x2a')];}_0x234c8b[_0x98cc('0x1a')](_0x55367e)['send'](_0x24c769);};}exports[_0x98cc('0x2b')]=function(_0x5bc283,_0x13d400){var _0x72e3e6={},_0x407136={},_0x270c33={'count':0x0,'rows':[]};var _0x818b3=_[_0x98cc('0x2c')](db[_0x98cc('0x2d')][_0x98cc('0x2e')],function(_0x411770){return{'name':_0x411770[_0x98cc('0x2f')],'type':_0x411770[_0x98cc('0x30')][_0x98cc('0x31')]};});_0x407136['model']=_[_0x98cc('0x2c')](_0x818b3,_0x98cc('0x2a'));_0x407136[_0x98cc('0x32')]=_[_0x98cc('0x33')](_0x5bc283[_0x98cc('0x32')]);_0x407136['filters']=_[_0x98cc('0x34')](_0x407136['model'],_0x407136['query']);_0x72e3e6[_0x98cc('0x35')]=_[_0x98cc('0x34')](_0x407136[_0x98cc('0x36')],qs[_0x98cc('0x37')](_0x5bc283[_0x98cc('0x32')][_0x98cc('0x37')]));_0x72e3e6[_0x98cc('0x35')]=_0x72e3e6[_0x98cc('0x35')][_0x98cc('0x38')]?_0x72e3e6[_0x98cc('0x35')]:_0x407136[_0x98cc('0x36')];if(!_0x5bc283['query'][_0x98cc('0x39')](_0x98cc('0x3a'))){_0x72e3e6[_0x98cc('0x20')]=qs[_0x98cc('0x20')](_0x5bc283[_0x98cc('0x32')]['limit']);_0x72e3e6[_0x98cc('0x1d')]=qs[_0x98cc('0x1d')](_0x5bc283[_0x98cc('0x32')][_0x98cc('0x1d')]);}_0x72e3e6[_0x98cc('0x3b')]=qs[_0x98cc('0x3c')](_0x5bc283[_0x98cc('0x32')][_0x98cc('0x3c')]);_0x72e3e6[_0x98cc('0x3d')]=qs[_0x98cc('0x3e')](_[_0x98cc('0x3f')](_0x5bc283[_0x98cc('0x32')],_0x407136['filters']),_0x818b3);if(_0x5bc283[_0x98cc('0x32')][_0x98cc('0x40')]){_0x72e3e6['where']=_[_0x98cc('0x41')](_0x72e3e6[_0x98cc('0x3d')],{'$or':_['map'](_0x818b3,function(_0x1b9803){if(_0x1b9803[_0x98cc('0x30')]!==_0x98cc('0x42')){var _0x1ecbfe={};_0x1ecbfe[_0x1b9803[_0x98cc('0x2a')]]={'$like':'%'+_0x5bc283[_0x98cc('0x32')][_0x98cc('0x40')]+'%'};return _0x1ecbfe;}})});}_0x72e3e6=_[_0x98cc('0x41')]({},_0x72e3e6,_0x5bc283[_0x98cc('0x43')]);var _0x10e6fb={'where':_0x72e3e6[_0x98cc('0x3d')]};return db[_0x98cc('0x2d')]['count'](_0x10e6fb)[_0x98cc('0x26')](function(_0x10cee5){_0x270c33[_0x98cc('0x1f')]=_0x10cee5;if(_0x5bc283['query'][_0x98cc('0x44')]){_0x72e3e6['include']=[{'all':!![]}];}return db[_0x98cc('0x2d')][_0x98cc('0x45')](_0x72e3e6);})[_0x98cc('0x26')](function(_0x112a20){_0x270c33[_0x98cc('0x46')]=_0x112a20;return _0x270c33;})['then'](respondWithFilteredResult(_0x13d400,_0x72e3e6))['catch'](handleError(_0x13d400,null));};exports['show']=function(_0x2cfdc7,_0x313a2a){var _0xe456ee={'raw':!![],'where':{'id':_0x2cfdc7[_0x98cc('0x47')]['id']}},_0x2dcb7c={};_0x2dcb7c['model']=_['keys'](db[_0x98cc('0x2d')]['rawAttributes']);_0x2dcb7c['query']=_[_0x98cc('0x33')](_0x2cfdc7[_0x98cc('0x32')]);_0x2dcb7c[_0x98cc('0x3e')]=_[_0x98cc('0x34')](_0x2dcb7c[_0x98cc('0x36')],_0x2dcb7c[_0x98cc('0x32')]);_0xe456ee[_0x98cc('0x35')]=_[_0x98cc('0x34')](_0x2dcb7c['model'],qs[_0x98cc('0x37')](_0x2cfdc7['query'][_0x98cc('0x37')]));_0xe456ee[_0x98cc('0x35')]=_0xe456ee[_0x98cc('0x35')][_0x98cc('0x38')]?_0xe456ee[_0x98cc('0x35')]:_0x2dcb7c[_0x98cc('0x36')];if(_0x2cfdc7[_0x98cc('0x32')][_0x98cc('0x44')]){_0xe456ee[_0x98cc('0x48')]=[{'all':!![]}];}_0xe456ee=_[_0x98cc('0x41')]({},_0xe456ee,_0x2cfdc7['options']);return db['CmHopperHistory'][_0x98cc('0x49')](_0xe456ee)[_0x98cc('0x26')](handleEntityNotFound(_0x313a2a,null))[_0x98cc('0x26')](respondWithResult(_0x313a2a,null))[_0x98cc('0x4a')](handleError(_0x313a2a,null));};exports['create']=function(_0x3ab05a,_0x226326){return db[_0x98cc('0x2d')][_0x98cc('0x4b')](_0x3ab05a['body'],{})[_0x98cc('0x26')](respondWithResult(_0x226326,0xc9))['catch'](handleError(_0x226326,null));};exports[_0x98cc('0x4c')]=function(_0x117a56,_0xda0cbc){return db[_0x98cc('0x2d')]['describe']()[_0x98cc('0x26')](respondWithResult(_0xda0cbc,null))[_0x98cc('0x4a')](handleError(_0xda0cbc,null));};exports[_0x98cc('0x4d')]=function(_0x58b3ee,_0x5d4846){if(_0x58b3ee[_0x98cc('0x4e')][_0x98cc('0x4f')]){delete _0x58b3ee[_0x98cc('0x4e')][_0x98cc('0x4f')];}return db[_0x98cc('0x2d')][_0x98cc('0x49')]({'where':{'uniqueid':_0x58b3ee[_0x98cc('0x47')]['id']}})[_0x98cc('0x26')](handleEntityNotFound(_0x5d4846,null))['then'](saveUpdates(_0x58b3ee[_0x98cc('0x4e')],null))[_0x98cc('0x26')](respondWithResult(_0x5d4846,null))['catch'](handleError(_0x5d4846,null));}; \ No newline at end of file +var _0x34b5=['end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','name','status','map','CmHopperHistory','rawAttributes','fieldName','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','rows','show','find','create','catch','describe','body','uniqueid','params','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x328ec5,_0xba24a9){var _0x39a6db=function(_0x27c670){while(--_0x27c670){_0x328ec5['push'](_0x328ec5['shift']());}};_0x39a6db(++_0xba24a9);}(_0x34b5,0x155));var _0x534b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34b5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x534b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x534b('0x1'));var moment=require(_0x534b('0x2'));var BPromise=require(_0x534b('0x3'));var Mustache=require(_0x534b('0x4'));var util=require(_0x534b('0x5'));var path=require(_0x534b('0x6'));var sox=require(_0x534b('0x7'));var csv=require(_0x534b('0x8'));var ejs=require(_0x534b('0x9'));var fs=require('fs');var fs_extra=require(_0x534b('0xa'));var _=require('lodash');var squel=require(_0x534b('0xb'));var crypto=require('crypto');var jsforce=require(_0x534b('0xc'));var deskjs=require(_0x534b('0xd'));var toCsv=require(_0x534b('0x8'));var querystring=require('querystring');var Papa=require(_0x534b('0xe'));var Redis=require(_0x534b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x534b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x534b('0x11'));var logger=require(_0x534b('0x12'))(_0x534b('0x13'));var utils=require('../../config/utils');var config=require(_0x534b('0x14'));var licenseUtil=require(_0x534b('0x15'));var db=require(_0x534b('0x16'))['db'];function respondWithStatusCode(_0x427d4b,_0x5094d1){_0x5094d1=_0x5094d1||0xcc;return function(_0x4d9686){if(_0x4d9686){return _0x427d4b[_0x534b('0x17')](_0x5094d1);}return _0x427d4b['status'](_0x5094d1)[_0x534b('0x18')]();};}function respondWithResult(_0x59cb83,_0x261257){_0x261257=_0x261257||0xc8;return function(_0x569f00){if(_0x569f00){return _0x59cb83['status'](_0x261257)[_0x534b('0x19')](_0x569f00);}};}function respondWithFilteredResult(_0x1116aa,_0x6b734b){return function(_0x1d2730){if(_0x1d2730){var _0x1baeff=typeof _0x6b734b['offset']===_0x534b('0x1a')&&typeof _0x6b734b[_0x534b('0x1b')]===_0x534b('0x1a');var _0x366ffb=_0x1d2730[_0x534b('0x1c')];var _0x5a592b=_0x1baeff?0x0:_0x6b734b['offset'];var _0x51dc5a=_0x1baeff?_0x1d2730[_0x534b('0x1c')]:_0x6b734b[_0x534b('0x1d')]+_0x6b734b[_0x534b('0x1b')];var _0x25742b;if(_0x51dc5a>=_0x366ffb){_0x51dc5a=_0x366ffb;_0x25742b=0xc8;}else{_0x25742b=0xce;}_0x1116aa['status'](_0x25742b);return _0x1116aa[_0x534b('0x1e')](_0x534b('0x1f'),_0x5a592b+'-'+_0x51dc5a+'/'+_0x366ffb)[_0x534b('0x19')](_0x1d2730);}return null;};}function patchUpdates(_0x4511ef){return function(_0x158df2){try{jsonpatch[_0x534b('0x20')](_0x158df2,_0x4511ef,!![]);}catch(_0x5692d0){return BPromise[_0x534b('0x21')](_0x5692d0);}return _0x158df2[_0x534b('0x22')]();};}function saveUpdates(_0xc3fd3e,_0x2ed2de){return function(_0x373229){if(_0x373229){return _0x373229[_0x534b('0x23')](_0xc3fd3e)['then'](function(_0x4d73ce){return _0x4d73ce;});}return null;};}function removeEntity(_0x107a7a,_0x1ac124){return function(_0x9ba027){if(_0x9ba027){return _0x9ba027[_0x534b('0x24')]()[_0x534b('0x25')](function(){_0x107a7a['status'](0xcc)[_0x534b('0x18')]();});}};}function handleEntityNotFound(_0xee4d0a,_0x15c3eb){return function(_0x45c8cb){if(!_0x45c8cb){_0xee4d0a[_0x534b('0x17')](0x194);}return _0x45c8cb;};}function handleError(_0x558c78,_0x4a973e){_0x4a973e=_0x4a973e||0x1f4;return function(_0xd03d1c){logger[_0x534b('0x26')](_0xd03d1c['stack']);if(_0xd03d1c['name']){delete _0xd03d1c[_0x534b('0x27')];}_0x558c78[_0x534b('0x28')](_0x4a973e)['send'](_0xd03d1c);};}exports['index']=function(_0x176b10,_0xa0c2a0){var _0x24fae1={},_0x14fa9a={},_0xbfdf8f={'count':0x0,'rows':[]};var _0x2ea18f=_[_0x534b('0x29')](db[_0x534b('0x2a')][_0x534b('0x2b')],function(_0x96d9b3){return{'name':_0x96d9b3[_0x534b('0x2c')],'type':_0x96d9b3[_0x534b('0x2d')]['key']};});_0x14fa9a['model']=_['map'](_0x2ea18f,_0x534b('0x27'));_0x14fa9a[_0x534b('0x2e')]=_[_0x534b('0x2f')](_0x176b10[_0x534b('0x2e')]);_0x14fa9a['filters']=_[_0x534b('0x30')](_0x14fa9a['model'],_0x14fa9a['query']);_0x24fae1[_0x534b('0x31')]=_[_0x534b('0x30')](_0x14fa9a[_0x534b('0x32')],qs[_0x534b('0x33')](_0x176b10[_0x534b('0x2e')]['fields']));_0x24fae1[_0x534b('0x31')]=_0x24fae1[_0x534b('0x31')][_0x534b('0x34')]?_0x24fae1[_0x534b('0x31')]:_0x14fa9a[_0x534b('0x32')];if(!_0x176b10['query'][_0x534b('0x35')](_0x534b('0x36'))){_0x24fae1[_0x534b('0x1b')]=qs[_0x534b('0x1b')](_0x176b10[_0x534b('0x2e')][_0x534b('0x1b')]);_0x24fae1[_0x534b('0x1d')]=qs[_0x534b('0x1d')](_0x176b10[_0x534b('0x2e')][_0x534b('0x1d')]);}_0x24fae1[_0x534b('0x37')]=qs['sort'](_0x176b10[_0x534b('0x2e')][_0x534b('0x38')]);_0x24fae1[_0x534b('0x39')]=qs[_0x534b('0x3a')](_['pick'](_0x176b10[_0x534b('0x2e')],_0x14fa9a['filters']),_0x2ea18f);if(_0x176b10[_0x534b('0x2e')][_0x534b('0x3b')]){_0x24fae1[_0x534b('0x39')]=_['merge'](_0x24fae1[_0x534b('0x39')],{'$or':_['map'](_0x2ea18f,function(_0x2f7ab3){if(_0x2f7ab3[_0x534b('0x2d')]!==_0x534b('0x3c')){var _0x175e58={};_0x175e58[_0x2f7ab3[_0x534b('0x27')]]={'$like':'%'+_0x176b10['query'][_0x534b('0x3b')]+'%'};return _0x175e58;}})});}_0x24fae1=_[_0x534b('0x3d')]({},_0x24fae1,_0x176b10[_0x534b('0x3e')]);var _0x5f2d8d={'where':_0x24fae1[_0x534b('0x39')]};return db['CmHopperHistory']['count'](_0x5f2d8d)[_0x534b('0x25')](function(_0x46c213){_0xbfdf8f['count']=_0x46c213;if(_0x176b10['query'][_0x534b('0x3f')]){_0x24fae1['include']=[{'all':!![]}];}return db[_0x534b('0x2a')]['findAll'](_0x24fae1);})[_0x534b('0x25')](function(_0x4afb09){_0xbfdf8f[_0x534b('0x40')]=_0x4afb09;return _0xbfdf8f;})[_0x534b('0x25')](respondWithFilteredResult(_0xa0c2a0,_0x24fae1))['catch'](handleError(_0xa0c2a0,null));};exports[_0x534b('0x41')]=function(_0x22cd91,_0x26d4ff){var _0x5b600e={'raw':!![],'where':{'id':_0x22cd91['params']['id']}},_0x3d99f4={};_0x3d99f4[_0x534b('0x32')]=_[_0x534b('0x2f')](db['CmHopperHistory'][_0x534b('0x2b')]);_0x3d99f4[_0x534b('0x2e')]=_['keys'](_0x22cd91[_0x534b('0x2e')]);_0x3d99f4[_0x534b('0x3a')]=_[_0x534b('0x30')](_0x3d99f4['model'],_0x3d99f4[_0x534b('0x2e')]);_0x5b600e[_0x534b('0x31')]=_[_0x534b('0x30')](_0x3d99f4['model'],qs['fields'](_0x22cd91[_0x534b('0x2e')][_0x534b('0x33')]));_0x5b600e[_0x534b('0x31')]=_0x5b600e[_0x534b('0x31')][_0x534b('0x34')]?_0x5b600e[_0x534b('0x31')]:_0x3d99f4[_0x534b('0x32')];if(_0x22cd91[_0x534b('0x2e')]['includeAll']){_0x5b600e['include']=[{'all':!![]}];}_0x5b600e=_[_0x534b('0x3d')]({},_0x5b600e,_0x22cd91['options']);return db[_0x534b('0x2a')][_0x534b('0x42')](_0x5b600e)[_0x534b('0x25')](handleEntityNotFound(_0x26d4ff,null))[_0x534b('0x25')](respondWithResult(_0x26d4ff,null))['catch'](handleError(_0x26d4ff,null));};exports[_0x534b('0x43')]=function(_0x536855,_0x1818fd){return db[_0x534b('0x2a')][_0x534b('0x43')](_0x536855['body'],{})[_0x534b('0x25')](respondWithResult(_0x1818fd,0xc9))[_0x534b('0x44')](handleError(_0x1818fd,null));};exports[_0x534b('0x45')]=function(_0x5ce177,_0x8f2cf7){return db[_0x534b('0x2a')][_0x534b('0x45')]()[_0x534b('0x25')](respondWithResult(_0x8f2cf7,null))[_0x534b('0x44')](handleError(_0x8f2cf7,null));};exports['update']=function(_0x4b55d8,_0xb14fdf){if(_0x4b55d8[_0x534b('0x46')][_0x534b('0x47')]){delete _0x4b55d8[_0x534b('0x46')][_0x534b('0x47')];}return db[_0x534b('0x2a')][_0x534b('0x42')]({'where':{'uniqueid':_0x4b55d8[_0x534b('0x48')]['id']}})['then'](handleEntityNotFound(_0xb14fdf,null))['then'](saveUpdates(_0x4b55d8['body'],null))[_0x534b('0x25')](respondWithResult(_0xb14fdf,null))['catch'](handleError(_0xb14fdf,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index f7cb30b..6510b40 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 _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','lodash','util'];(function(_0x2058f1,_0x56a9b3){var _0x1cff23=function(_0x249bd0){while(--_0x249bd0){_0x2058f1['push'](_0x2058f1['shift']());}};_0x1cff23(++_0x56a9b3);}(_0x1a37,0xb4));var _0x71a3=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x1a37[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./cmHopperHistory.attributes');module[_0x71a3('0xa')]=function(_0x4f6b7a,_0xd09f7){return _0x4f6b7a[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':_0x71a3('0xd'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa282=['define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','api','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xa282,0x1f3));var _0x2a28=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xa282[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0x2a28('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2a28('0x1'));var moment=require('moment');var BPromise=require(_0x2a28('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a28('0x3'));var rimraf=require(_0x2a28('0x4'));var config=require(_0x2a28('0x5'));var attributes=require(_0x2a28('0x6'));module[_0x2a28('0x7')]=function(_0x133fe9,_0x19b6e9){return _0x133fe9[_0x2a28('0x8')](_0x2a28('0x9'),attributes,{'tableName':_0x2a28('0xa'),'paranoid':![],'indexes':[{'name':_0x2a28('0xb'),'fields':[_0x2a28('0xb')]},{'name':_0x2a28('0xc'),'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 d44ab5f..5838f82 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 _0x2557=['`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','options','raw','AvgHandleTime','findAll','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null'];(function(_0x163ea6,_0x572369){var _0x46342e=function(_0x109190){while(--_0x109190){_0x163ea6['push'](_0x163ea6['shift']());}};_0x46342e(++_0x572369);}(_0x2557,0x11e));var _0x7255=function(_0x1ba315,_0x387f05){_0x1ba315=_0x1ba315-0x0;var _0x449782=_0x2557[_0x1ba315];return _0x449782;};'use strict';var _=require(_0x7255('0x0'));var util=require('util');var moment=require(_0x7255('0x1'));var BPromise=require(_0x7255('0x2'));var rs=require(_0x7255('0x3'));var fs=require('fs');var Redis=require(_0x7255('0x4'));var db=require(_0x7255('0x5'))['db'];var utils=require(_0x7255('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7255('0x7'));var client=jayson[_0x7255('0x8')][_0x7255('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x841417,_0x419dc0,_0x2142a5){return new BPromise(function(_0x5b6aa4,_0x3baa49){return client[_0x7255('0xa')](_0x841417,_0x2142a5)[_0x7255('0xb')](function(_0x5388d5){logger[_0x7255('0xc')](_0x7255('0xd'),_0x419dc0,_0x7255('0xe'));logger[_0x7255('0xf')](_0x7255('0x10'),_0x419dc0,_0x7255('0xe'),JSON[_0x7255('0x11')](_0x5388d5));if(_0x5388d5['error']){if(_0x5388d5[_0x7255('0x12')]['code']===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x419dc0,_0x5388d5[_0x7255('0x12')][_0x7255('0x13')]);return _0x3baa49(_0x5388d5[_0x7255('0x12')][_0x7255('0x13')]);}logger[_0x7255('0x12')](_0x7255('0xd'),_0x419dc0,_0x5388d5[_0x7255('0x12')]['message']);return _0x5b6aa4(_0x5388d5[_0x7255('0x12')][_0x7255('0x13')]);}else{logger[_0x7255('0xc')](_0x7255('0xd'),_0x419dc0,_0x7255('0xe'));_0x5b6aa4(_0x5388d5[_0x7255('0x14')][_0x7255('0x13')]);}})[_0x7255('0x15')](function(_0x1dc830){logger[_0x7255('0x12')](_0x7255('0xd'),_0x419dc0,_0x1dc830);_0x3baa49(_0x1dc830);});});}exports[_0x7255('0x16')]=function(_0x19dac1){var _0x2c0cd7=this;return new Promise(function(_0x3db713,_0x33f843){return db[_0x7255('0x17')]['create'](_0x19dac1['body'],{'raw':_0x19dac1[_0x7255('0x18')]?_0x19dac1[_0x7255('0x18')][_0x7255('0x19')]===undefined?!![]:![]:!![]})[_0x7255('0xb')](function(_0x4bff12){logger[_0x7255('0xc')](_0x7255('0x16'),_0x19dac1);logger[_0x7255('0xf')](_0x7255('0x16'),_0x19dac1,JSON[_0x7255('0x11')](_0x4bff12));_0x3db713(_0x4bff12);})[_0x7255('0x15')](function(_0x38f9eb){logger[_0x7255('0x12')]('CreateCmHopperHistory',_0x38f9eb[_0x7255('0x13')],_0x19dac1);_0x33f843(_0x2c0cd7[_0x7255('0x12')](0x1f4,_0x38f9eb[_0x7255('0x13')]));});});};exports[_0x7255('0x1a')]=function(_0x153113){var _0x35dd34=this;return new Promise(function(_0xb518cb,_0x4a62eb){return db[_0x7255('0x17')][_0x7255('0x1b')]({'raw':_0x153113[_0x7255('0x18')]?_0x153113['options'][_0x7255('0x19')]===undefined?!![]:![]:!![],'where':_0x153113['options']?_0x153113[_0x7255('0x18')][_0x7255('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0x7255('0x1d'),db[_0x7255('0x1e')][_0x7255('0x1f')]('id')),_0x7255('0x20')],[db[_0x7255('0x1e')]['fn'](_0x7255('0x1d'),db['sequelize']['fn']('IF',db[_0x7255('0x1e')][_0x7255('0x21')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x7255('0x1e')]['fn'](_0x7255('0x1d'),db[_0x7255('0x1e')]['fn']('IF',db[_0x7255('0x1e')][_0x7255('0x21')](_0x7255('0x22')))),_0x7255('0x23')],[db[_0x7255('0x1e')]['fn']('COUNT',db[_0x7255('0x1e')]['fn']('IF',db['sequelize'][_0x7255('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0x7255('0x24')],[db[_0x7255('0x1e')]['fn'](_0x7255('0x25'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x7255('0x26')))),_0x7255('0x27')],[db[_0x7255('0x1e')]['fn'](_0x7255('0x25'),db[_0x7255('0x1e')]['fn']('IF',db[_0x7255('0x1e')][_0x7255('0x21')](_0x7255('0x28')))),'predictiveIntervalAvgTalktime']]})[_0x7255('0xb')](function(_0x37913a){logger['info'](_0x7255('0x1a'),_0x153113);logger[_0x7255('0xf')](_0x7255('0x1a'),_0x153113,JSON[_0x7255('0x11')](_0x37913a));_0xb518cb(_0x37913a);})[_0x7255('0x15')](function(_0x69524e){logger['error'](_0x7255('0x1a'),_0x69524e[_0x7255('0x13')],_0x153113);_0x4a62eb(_0x35dd34[_0x7255('0x12')](0x1f4,_0x69524e['message']));});});};exports[_0x7255('0x29')]=function(_0x4d71a7){var _0x229ff9=this;return new Promise(function(_0x2d17c1,_0x148dd1){return db[_0x7255('0x17')][_0x7255('0x1b')]({'raw':_0x4d71a7[_0x7255('0x18')]?_0x4d71a7[_0x7255('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d71a7[_0x7255('0x18')]?_0x4d71a7[_0x7255('0x18')][_0x7255('0x1c')]||null:null,'attributes':[[_0x7255('0x2a'),_0x7255('0x2b')],[db[_0x7255('0x1e')]['fn']('COUNT',db[_0x7255('0x1e')]['fn']('IF',db[_0x7255('0x1e')][_0x7255('0x21')](_0x7255('0x2c')))),'outboundNoSuchCallsDay'],[db[_0x7255('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7255('0x1e')]['literal'](_0x7255('0x2d')))),_0x7255('0x2e')],[db['sequelize']['fn'](_0x7255('0x1d'),db[_0x7255('0x1e')]['fn']('IF',db['sequelize'][_0x7255('0x21')](_0x7255('0x2f')))),_0x7255('0x30')],[db[_0x7255('0x1e')]['fn'](_0x7255('0x1d'),db[_0x7255('0x1e')]['fn']('IF',db['sequelize'][_0x7255('0x21')](_0x7255('0x31')))),_0x7255('0x32')],[db[_0x7255('0x1e')]['fn'](_0x7255('0x1d'),db[_0x7255('0x1e')]['fn']('IF',db[_0x7255('0x1e')][_0x7255('0x21')](_0x7255('0x33')))),_0x7255('0x34')],[db['sequelize']['fn'](_0x7255('0x1d'),db['sequelize']['fn']('IF',db[_0x7255('0x1e')][_0x7255('0x21')](_0x7255('0x35')))),'outboundDropCallsDayTimeout'],[db[_0x7255('0x1e')]['fn'](_0x7255('0x1d'),db[_0x7255('0x1e')]['fn']('IF',db[_0x7255('0x1e')][_0x7255('0x21')](_0x7255('0x36')))),_0x7255('0x37')],[db[_0x7255('0x1e')]['fn'](_0x7255('0x1d'),db['sequelize']['fn']('IF',db[_0x7255('0x1e')][_0x7255('0x21')](_0x7255('0x38')))),_0x7255('0x39')],[db[_0x7255('0x1e')]['fn'](_0x7255('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x7255('0x21')](_0x7255('0x3a')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x7255('0x1e')]['fn']('IF',db[_0x7255('0x1e')][_0x7255('0x21')](_0x7255('0x3b')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x7255('0x1e')]['fn']('IF',db['sequelize'][_0x7255('0x21')](_0x7255('0x3c')))),_0x7255('0x3d')],[db['sequelize']['fn'](_0x7255('0x1d'),db[_0x7255('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x7255('0x3e')))),_0x7255('0x3f')],[db['sequelize']['fn'](_0x7255('0x1d'),db['sequelize']['fn']('IF',db[_0x7255('0x1e')]['literal'](_0x7255('0x40')))),_0x7255('0x3d')],[db[_0x7255('0x1e')]['fn'](_0x7255('0x1d'),db[_0x7255('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x7255('0x41')))),'outboundReCallsDay']],'group':[_0x7255('0x2a')]})[_0x7255('0xb')](function(_0x3f532a){logger[_0x7255('0xc')](_0x7255('0x29'),_0x4d71a7);logger[_0x7255('0xf')]('GetVoiceQueueHopperHistory',_0x4d71a7,JSON[_0x7255('0x11')](_0x3f532a));_0x2d17c1(_0x3f532a);})[_0x7255('0x15')](function(_0x53371c){logger['error'](_0x7255('0x29'),_0x53371c[_0x7255('0x13')],_0x4d71a7);_0x148dd1(_0x229ff9[_0x7255('0x12')](0x1f4,_0x53371c['message']));});});};exports['GetCampaignHopperHistory']=function(_0xc0411e){var _0x5ec843=this;return new Promise(function(_0x431026,_0xe5464c){return db[_0x7255('0x17')][_0x7255('0x1b')]({'raw':_0xc0411e[_0x7255('0x18')]?_0xc0411e[_0x7255('0x18')][_0x7255('0x19')]===undefined?!![]:![]:!![],'where':_0xc0411e[_0x7255('0x18')]?_0xc0411e[_0x7255('0x18')][_0x7255('0x1c')]||null:null,'attributes':[[_0x7255('0x2a'),_0x7255('0x2b')],[db[_0x7255('0x1e')]['fn'](_0x7255('0x1d'),db[_0x7255('0x1e')]['col']('id')),'ivrTotalCallsDays'],[db[_0x7255('0x1e')]['fn'](_0x7255('0x1d'),db[_0x7255('0x1e')]['fn']('IF',db[_0x7255('0x1e')][_0x7255('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x7255('0x42')]],'group':[_0x7255('0x2a')]})[_0x7255('0xb')](function(_0x40f3f0){logger[_0x7255('0xc')]('GetCampaignHopperHistory',_0xc0411e);logger['debug'](_0x7255('0x43'),_0xc0411e,JSON[_0x7255('0x11')](_0x40f3f0));_0x431026(_0x40f3f0);})['catch'](function(_0x147815){logger[_0x7255('0x12')](_0x7255('0x43'),_0x147815['message'],_0xc0411e);_0xe5464c(_0x5ec843[_0x7255('0x12')](0x1f4,_0x147815['message']));});});}; \ No newline at end of file +var _0xf46a=['catch','GetVoiceQueueHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','col','ivrTotalCallsDays','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','info','CmHopperHistory','create','options','CreateCmHopperHistory','AvgHandleTime','raw','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime'];(function(_0x272202,_0x569e70){var _0xcad2a7=function(_0x3b39b2){while(--_0x3b39b2){_0x272202['push'](_0x272202['shift']());}};_0xcad2a7(++_0x569e70);}(_0xf46a,0xa4));var _0xaf46=function(_0x1695e5,_0x34443c){_0x1695e5=_0x1695e5-0x0;var _0x1977ed=_0xf46a[_0x1695e5];return _0x1977ed;};'use strict';var _=require(_0xaf46('0x0'));var util=require('util');var moment=require(_0xaf46('0x1'));var BPromise=require(_0xaf46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf46('0x3'));var db=require(_0xaf46('0x4'))['db'];var utils=require(_0xaf46('0x5'));var logger=require(_0xaf46('0x6'))(_0xaf46('0x7'));var config=require(_0xaf46('0x8'));var jayson=require(_0xaf46('0x9'));var client=jayson[_0xaf46('0xa')][_0xaf46('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9e9887,_0x4f76cc,_0xa4a618){return new BPromise(function(_0x105943,_0x328d92){return client['request'](_0x9e9887,_0xa4a618)[_0xaf46('0xc')](function(_0x4e67c0){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x4f76cc,_0xaf46('0xd'));logger[_0xaf46('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4f76cc,_0xaf46('0xd'),JSON[_0xaf46('0xf')](_0x4e67c0));if(_0x4e67c0[_0xaf46('0x10')]){if(_0x4e67c0['error'][_0xaf46('0x11')]===0x1f4){logger['error'](_0xaf46('0x12'),_0x4f76cc,_0x4e67c0['error'][_0xaf46('0x13')]);return _0x328d92(_0x4e67c0['error'][_0xaf46('0x13')]);}logger[_0xaf46('0x10')](_0xaf46('0x12'),_0x4f76cc,_0x4e67c0[_0xaf46('0x10')][_0xaf46('0x13')]);return _0x105943(_0x4e67c0[_0xaf46('0x10')][_0xaf46('0x13')]);}else{logger[_0xaf46('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x4f76cc,'request\x20sent');_0x105943(_0x4e67c0['result'][_0xaf46('0x13')]);}})['catch'](function(_0x498720){logger[_0xaf46('0x10')](_0xaf46('0x12'),_0x4f76cc,_0x498720);_0x328d92(_0x498720);});});}exports['CreateCmHopperHistory']=function(_0x128ad8){var _0x3a26f1=this;return new Promise(function(_0x224413,_0xd1b9ce){return db[_0xaf46('0x15')][_0xaf46('0x16')](_0x128ad8['body'],{'raw':_0x128ad8[_0xaf46('0x17')]?_0x128ad8[_0xaf46('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xaf46('0xc')](function(_0x4459d5){logger['info']('CreateCmHopperHistory',_0x128ad8);logger['debug'](_0xaf46('0x18'),_0x128ad8,JSON[_0xaf46('0xf')](_0x4459d5));_0x224413(_0x4459d5);})['catch'](function(_0x183cb6){logger['error'](_0xaf46('0x18'),_0x183cb6[_0xaf46('0x13')],_0x128ad8);_0xd1b9ce(_0x3a26f1[_0xaf46('0x10')](0x1f4,_0x183cb6[_0xaf46('0x13')]));});});};exports[_0xaf46('0x19')]=function(_0x39946c){var _0x166a0e=this;return new Promise(function(_0x119a98,_0xabed9f){return db[_0xaf46('0x15')]['findAll']({'raw':_0x39946c['options']?_0x39946c[_0xaf46('0x17')][_0xaf46('0x1a')]===undefined?!![]:![]:!![],'where':_0x39946c[_0xaf46('0x17')]?_0x39946c[_0xaf46('0x17')][_0xaf46('0x1b')]||null:null,'attributes':[[db[_0xaf46('0x1c')]['fn'](_0xaf46('0x1d'),db[_0xaf46('0x1c')]['col']('id')),_0xaf46('0x1e')],[db[_0xaf46('0x1c')]['fn']('COUNT',db[_0xaf46('0x1c')]['fn']('IF',db[_0xaf46('0x1c')][_0xaf46('0x1f')](_0xaf46('0x20')))),_0xaf46('0x21')],[db[_0xaf46('0x1c')]['fn']('COUNT',db[_0xaf46('0x1c')]['fn']('IF',db[_0xaf46('0x1c')]['literal'](_0xaf46('0x22')))),_0xaf46('0x23')],[db[_0xaf46('0x1c')]['fn'](_0xaf46('0x1d'),db[_0xaf46('0x1c')]['fn']('IF',db[_0xaf46('0x1c')][_0xaf46('0x1f')](_0xaf46('0x24')))),_0xaf46('0x25')],[db[_0xaf46('0x1c')]['fn'](_0xaf46('0x26'),db['sequelize']['fn']('IF',db[_0xaf46('0x1c')]['literal'](_0xaf46('0x27')))),_0xaf46('0x28')],[db[_0xaf46('0x1c')]['fn'](_0xaf46('0x26'),db['sequelize']['fn']('IF',db[_0xaf46('0x1c')][_0xaf46('0x1f')](_0xaf46('0x29')))),_0xaf46('0x2a')]]})['then'](function(_0x5f31b8){logger[_0xaf46('0x14')](_0xaf46('0x19'),_0x39946c);logger[_0xaf46('0xe')](_0xaf46('0x19'),_0x39946c,JSON['stringify'](_0x5f31b8));_0x119a98(_0x5f31b8);})[_0xaf46('0x2b')](function(_0x2e4e34){logger[_0xaf46('0x10')](_0xaf46('0x19'),_0x2e4e34[_0xaf46('0x13')],_0x39946c);_0xabed9f(_0x166a0e[_0xaf46('0x10')](0x1f4,_0x2e4e34['message']));});});};exports[_0xaf46('0x2c')]=function(_0x4b8adc){var _0x12fcea=this;return new Promise(function(_0x3e84c0,_0x5292ae){return db[_0xaf46('0x15')][_0xaf46('0x2d')]({'raw':_0x4b8adc[_0xaf46('0x17')]?_0x4b8adc[_0xaf46('0x17')][_0xaf46('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b8adc['options']?_0x4b8adc[_0xaf46('0x17')][_0xaf46('0x1b')]||null:null,'attributes':[[_0xaf46('0x2e'),'name'],[db[_0xaf46('0x1c')]['fn']('COUNT',db[_0xaf46('0x1c')]['fn']('IF',db[_0xaf46('0x1c')]['literal'](_0xaf46('0x2f')))),_0xaf46('0x30')],[db[_0xaf46('0x1c')]['fn'](_0xaf46('0x1d'),db[_0xaf46('0x1c')]['fn']('IF',db[_0xaf46('0x1c')][_0xaf46('0x1f')](_0xaf46('0x31')))),_0xaf46('0x32')],[db[_0xaf46('0x1c')]['fn'](_0xaf46('0x1d'),db[_0xaf46('0x1c')]['fn']('IF',db[_0xaf46('0x1c')][_0xaf46('0x1f')](_0xaf46('0x20')))),_0xaf46('0x33')],[db[_0xaf46('0x1c')]['fn'](_0xaf46('0x1d'),db[_0xaf46('0x1c')]['fn']('IF',db[_0xaf46('0x1c')][_0xaf46('0x1f')](_0xaf46('0x34')))),'outboundBusyCallsDay'],[db[_0xaf46('0x1c')]['fn']('COUNT',db[_0xaf46('0x1c')]['fn']('IF',db[_0xaf46('0x1c')][_0xaf46('0x1f')](_0xaf46('0x35')))),_0xaf46('0x36')],[db[_0xaf46('0x1c')]['fn'](_0xaf46('0x1d'),db[_0xaf46('0x1c')]['fn']('IF',db[_0xaf46('0x1c')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0xaf46('0x1c')]['fn'](_0xaf46('0x1d'),db['sequelize']['fn']('IF',db[_0xaf46('0x1c')][_0xaf46('0x1f')](_0xaf46('0x37')))),'outboundDropCallsDayCallersExit'],[db[_0xaf46('0x1c')]['fn'](_0xaf46('0x1d'),db[_0xaf46('0x1c')]['fn']('IF',db[_0xaf46('0x1c')][_0xaf46('0x1f')]('`state`\x20=\x2012,\x201,\x20null'))),_0xaf46('0x38')],[db[_0xaf46('0x1c')]['fn'](_0xaf46('0x1d'),db[_0xaf46('0x1c')]['fn']('IF',db['sequelize'][_0xaf46('0x1f')](_0xaf46('0x39')))),'outboundBlacklistCallsDay'],[db[_0xaf46('0x1c')]['fn'](_0xaf46('0x1d'),db[_0xaf46('0x1c')]['fn']('IF',db['sequelize'][_0xaf46('0x1f')](_0xaf46('0x3a')))),_0xaf46('0x3b')],[db[_0xaf46('0x1c')]['fn'](_0xaf46('0x1d'),db['sequelize']['fn']('IF',db[_0xaf46('0x1c')][_0xaf46('0x1f')]('`state`\x20=\x2018,\x201,\x20null'))),_0xaf46('0x3c')],[db[_0xaf46('0x1c')]['fn'](_0xaf46('0x1d'),db[_0xaf46('0x1c')]['fn']('IF',db[_0xaf46('0x1c')][_0xaf46('0x1f')](_0xaf46('0x3d')))),_0xaf46('0x3e')],[db[_0xaf46('0x1c')]['fn'](_0xaf46('0x1d'),db[_0xaf46('0x1c')]['fn']('IF',db[_0xaf46('0x1c')][_0xaf46('0x1f')](_0xaf46('0x3f')))),_0xaf46('0x3c')],[db[_0xaf46('0x1c')]['fn']('COUNT',db[_0xaf46('0x1c')]['fn']('IF',db[_0xaf46('0x1c')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xaf46('0x40')]],'group':[_0xaf46('0x2e')]})[_0xaf46('0xc')](function(_0x5a819e){logger[_0xaf46('0x14')](_0xaf46('0x2c'),_0x4b8adc);logger[_0xaf46('0xe')]('GetVoiceQueueHopperHistory',_0x4b8adc,JSON[_0xaf46('0xf')](_0x5a819e));_0x3e84c0(_0x5a819e);})[_0xaf46('0x2b')](function(_0x32d900){logger[_0xaf46('0x10')]('GetVoiceQueueHopperHistory',_0x32d900[_0xaf46('0x13')],_0x4b8adc);_0x5292ae(_0x12fcea[_0xaf46('0x10')](0x1f4,_0x32d900[_0xaf46('0x13')]));});});};exports[_0xaf46('0x41')]=function(_0x3802ce){var _0x13ed2b=this;return new Promise(function(_0x48e3e0,_0x340c1a){return db[_0xaf46('0x15')][_0xaf46('0x2d')]({'raw':_0x3802ce[_0xaf46('0x17')]?_0x3802ce[_0xaf46('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3802ce[_0xaf46('0x17')]?_0x3802ce[_0xaf46('0x17')][_0xaf46('0x1b')]||null:null,'attributes':[[_0xaf46('0x2e'),_0xaf46('0x42')],[db['sequelize']['fn']('COUNT',db[_0xaf46('0x1c')][_0xaf46('0x43')]('id')),_0xaf46('0x44')],[db[_0xaf46('0x1c')]['fn']('COUNT',db[_0xaf46('0x1c')]['fn']('IF',db['sequelize']['literal'](_0xaf46('0x20')))),'ivrAnswerCallsDay']],'group':[_0xaf46('0x2e')]})['then'](function(_0x55313e){logger[_0xaf46('0x14')](_0xaf46('0x41'),_0x3802ce);logger[_0xaf46('0xe')]('GetCampaignHopperHistory',_0x3802ce,JSON['stringify'](_0x55313e));_0x48e3e0(_0x55313e);})[_0xaf46('0x2b')](function(_0x45fbc6){logger['error']('GetCampaignHopperHistory',_0x45fbc6[_0xaf46('0x13')],_0x3802ce);_0x340c1a(_0x13ed2b['error'](0x1f4,_0x45fbc6[_0xaf46('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 439d845..4c2e2ed 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 _0xfe28=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','/describe','describe','/:id','isAuthenticated','post','create','put','update','exports'];(function(_0x1ade7d,_0x5c46fd){var _0x3425a2=function(_0x4a933b){while(--_0x4a933b){_0x1ade7d['push'](_0x1ade7d['shift']());}};_0x3425a2(++_0x5c46fd);}(_0xfe28,0x187));var _0x8fe2=function(_0x146bbc,_0x5c21d7){_0x146bbc=_0x146bbc-0x0;var _0x24247e=_0xfe28[_0x146bbc];return _0x24247e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8fe2('0x0'));var timeout=require(_0x8fe2('0x1'));var express=require(_0x8fe2('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8fe2('0x3'));var interaction=require(_0x8fe2('0x4'));var config=require(_0x8fe2('0x5'));var controller=require(_0x8fe2('0x6'));router[_0x8fe2('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8fe2('0x7')](_0x8fe2('0x8'),auth['isAuthenticated'](),controller[_0x8fe2('0x9')]);router['get'](_0x8fe2('0xa'),auth[_0x8fe2('0xb')](),controller['show']);router[_0x8fe2('0xc')]('/',auth[_0x8fe2('0xb')](),controller[_0x8fe2('0xd')]);router[_0x8fe2('0xe')]('/:id',auth[_0x8fe2('0xb')](),controller[_0x8fe2('0xf')]);module[_0x8fe2('0x10')]=router; \ No newline at end of file +var _0x8c0b=['../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x349126,_0x5c340a){var _0x181e61=function(_0x3a5bc6){while(--_0x3a5bc6){_0x349126['push'](_0x349126['shift']());}};_0x181e61(++_0x5c340a);}(_0x8c0b,0xe4));var _0xb8c0=function(_0x5337bf,_0x3df4b9){_0x5337bf=_0x5337bf-0x0;var _0x5d54f9=_0x8c0b[_0x5337bf];return _0x5d54f9;};'use strict';var multer=require(_0xb8c0('0x0'));var util=require(_0xb8c0('0x1'));var path=require('path');var timeout=require(_0xb8c0('0x2'));var express=require(_0xb8c0('0x3'));var router=express[_0xb8c0('0x4')]();var fs_extra=require(_0xb8c0('0x5'));var auth=require(_0xb8c0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb8c0('0x7'));var controller=require(_0xb8c0('0x8'));router[_0xb8c0('0x9')]('/',auth[_0xb8c0('0xa')](),controller['index']);router[_0xb8c0('0x9')](_0xb8c0('0xb'),auth[_0xb8c0('0xa')](),controller[_0xb8c0('0xc')]);router[_0xb8c0('0x9')](_0xb8c0('0xd'),auth[_0xb8c0('0xa')](),controller[_0xb8c0('0xe')]);router['post']('/',auth[_0xb8c0('0xa')](),controller['create']);router[_0xb8c0('0xf')](_0xb8c0('0xd'),auth[_0xb8c0('0xa')](),controller[_0xb8c0('0x10')]);module[_0xb8c0('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index abad396..7a4caa1 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 _0x5b7f=['sequelize','exports','STRING','name'];(function(_0xbb1d83,_0x5dbbf0){var _0x4165d0=function(_0x3ccb9d){while(--_0x3ccb9d){_0xbb1d83['push'](_0xbb1d83['shift']());}};_0x4165d0(++_0x5dbbf0);}(_0x5b7f,0x8c));var _0xf5b7=function(_0x56f2f3,_0x211ecc){_0x56f2f3=_0x56f2f3-0x0;var _0x3624d0=_0x5b7f[_0x56f2f3];return _0x3624d0;};'use strict';var Sequelize=require(_0xf5b7('0x0'));module[_0xf5b7('0x1')]={'name':{'type':Sequelize[_0xf5b7('0x2')],'unique':_0xf5b7('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf5b7('0x2')]},'dialPrefix':{'type':Sequelize[_0xf5b7('0x2')]}}; \ No newline at end of file +var _0x4ab0=['exports','STRING','name'];(function(_0x2bc0a4,_0x3f099d){var _0x9f0359=function(_0x3b2df1){while(--_0x3b2df1){_0x2bc0a4['push'](_0x2bc0a4['shift']());}};_0x9f0359(++_0x3f099d);}(_0x4ab0,0xd5));var _0x04ab=function(_0x2d38b5,_0x497820){_0x2d38b5=_0x2d38b5-0x0;var _0x222409=_0x4ab0[_0x2d38b5];return _0x222409;};'use strict';var Sequelize=require('sequelize');module[_0x04ab('0x0')]={'name':{'type':Sequelize[_0x04ab('0x1')],'unique':_0x04ab('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x04ab('0x1')]},'dialPrefix':{'type':Sequelize[_0x04ab('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 237ecbe..b7ac634 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 _0x2ec4=['queryInterface','cm_contacts','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','catch','options','create','user','role','Lists','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','includeAll','rows','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','isEmpty','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','/tmp/list_%d_%s.csv','transaction','addCustomFields','type','text','TEXT','Sequelize','INTEGER','switch','BOOLEAN'];(function(_0x4d6a26,_0x2c2feb){var _0x2e26f0=function(_0x1e9b4c){while(--_0x1e9b4c){_0x4d6a26['push'](_0x4d6a26['shift']());}};_0x2e26f0(++_0x2c2feb);}(_0x2ec4,0x1b9));var _0x42ec=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2ec4[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x42ec('0x0'));var rimraf=require(_0x42ec('0x1'));var zipdir=require(_0x42ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x42ec('0x3'));var moment=require(_0x42ec('0x4'));var BPromise=require(_0x42ec('0x5'));var Mustache=require(_0x42ec('0x6'));var util=require('util');var path=require(_0x42ec('0x7'));var sox=require(_0x42ec('0x8'));var csv=require(_0x42ec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x42ec('0xa'));var _=require('lodash');var squel=require(_0x42ec('0xb'));var crypto=require('crypto');var jsforce=require(_0x42ec('0xc'));var deskjs=require(_0x42ec('0xd'));var toCsv=require('to-csv');var querystring=require(_0x42ec('0xe'));var Papa=require(_0x42ec('0xf'));var Redis=require(_0x42ec('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x42ec('0x11'));var as=require(_0x42ec('0x12'));var hardwareService=require(_0x42ec('0x13'));var logger=require('../../config/logger')(_0x42ec('0x14'));var utils=require('../../config/utils');var config=require(_0x42ec('0x15'));var licenseUtil=require(_0x42ec('0x16'));var db=require(_0x42ec('0x17'))['db'];config[_0x42ec('0x18')]=_[_0x42ec('0x19')](config[_0x42ec('0x18')],{'host':_0x42ec('0x1a'),'port':0x18eb});var socket=require(_0x42ec('0x1b'))(new Redis(config['redis']));require(_0x42ec('0x1c'))[_0x42ec('0x1d')](socket);function respondWithStatusCode(_0x21db16,_0x59c968){_0x59c968=_0x59c968||0xcc;return function(_0x5ea2b0){if(_0x5ea2b0){return _0x21db16['sendStatus'](_0x59c968);}return _0x21db16[_0x42ec('0x1e')](_0x59c968)[_0x42ec('0x1f')]();};}function respondWithResult(_0x3554db,_0x15678b){_0x15678b=_0x15678b||0xc8;return function(_0x4dfe31){if(_0x4dfe31){return _0x3554db[_0x42ec('0x1e')](_0x15678b)[_0x42ec('0x20')](_0x4dfe31);}};}function respondWithFilteredResult(_0x2bc7a9,_0x2e6882){return function(_0x4f2138){if(_0x4f2138){var _0x53cb1e=typeof _0x2e6882[_0x42ec('0x21')]==='undefined'&&typeof _0x2e6882[_0x42ec('0x22')]===_0x42ec('0x23');var _0x1da95b=_0x4f2138[_0x42ec('0x24')];var _0x48d311=_0x53cb1e?0x0:_0x2e6882['offset'];var _0x1bc3ce=_0x53cb1e?_0x4f2138['count']:_0x2e6882[_0x42ec('0x21')]+_0x2e6882[_0x42ec('0x22')];var _0x5b3ce0;if(_0x1bc3ce>=_0x1da95b){_0x1bc3ce=_0x1da95b;_0x5b3ce0=0xc8;}else{_0x5b3ce0=0xce;}_0x2bc7a9['status'](_0x5b3ce0);return _0x2bc7a9[_0x42ec('0x25')]('Content-Range',_0x48d311+'-'+_0x1bc3ce+'/'+_0x1da95b)['json'](_0x4f2138);}return null;};}function patchUpdates(_0x4ddf1f){return function(_0x5f19b0){try{jsonpatch[_0x42ec('0x26')](_0x5f19b0,_0x4ddf1f,!![]);}catch(_0x398be4){return BPromise[_0x42ec('0x27')](_0x398be4);}return _0x5f19b0[_0x42ec('0x28')]();};}function saveUpdates(_0x5b3ed1,_0x55bb5e){return function(_0x53aaf4){if(_0x53aaf4){return _0x53aaf4[_0x42ec('0x29')](_0x5b3ed1)['then'](function(_0x2830ba){return _0x2830ba;});}return null;};}function removeEntity(_0x3cbef5,_0x2ca993){return function(_0x15de7a){if(_0x15de7a){return _0x15de7a['destroy']()[_0x42ec('0x2a')](function(){var _0x1c7942=_0x15de7a[_0x42ec('0x2b')]({'plain':!![]});var _0x5ba243='Lists';return db[_0x42ec('0x2c')][_0x42ec('0x2d')]({'where':{'type':_0x5ba243,'resourceId':_0x1c7942['id']}})[_0x42ec('0x2a')](function(){return _0x15de7a;});})[_0x42ec('0x2a')](function(){_0x3cbef5[_0x42ec('0x1e')](0xcc)[_0x42ec('0x1f')]();});}};}function handleEntityNotFound(_0x505961,_0x50df5a){return function(_0x3e2d0a){if(!_0x3e2d0a){_0x505961[_0x42ec('0x2e')](0x194);}return _0x3e2d0a;};}function handleError(_0x4d6e31,_0x84eb32){_0x84eb32=_0x84eb32||0x1f4;return function(_0x429aee){logger[_0x42ec('0x2f')](_0x429aee[_0x42ec('0x30')]);if(_0x429aee['name']){delete _0x429aee[_0x42ec('0x31')];}_0x4d6e31['status'](_0x84eb32)[_0x42ec('0x32')](_0x429aee);};}exports[_0x42ec('0x33')]=function(_0x4b75af,_0x524e7c){var _0x4e81ce={},_0x2cb7cd={},_0x2d5aae={'count':0x0,'rows':[]};var _0x19def8=_[_0x42ec('0x34')](db[_0x42ec('0x35')][_0x42ec('0x36')],function(_0x358329){return{'name':_0x358329[_0x42ec('0x37')],'type':_0x358329['type'][_0x42ec('0x38')]};});_0x2cb7cd[_0x42ec('0x39')]=_[_0x42ec('0x34')](_0x19def8,_0x42ec('0x31'));_0x2cb7cd['query']=_[_0x42ec('0x3a')](_0x4b75af[_0x42ec('0x3b')]);_0x2cb7cd[_0x42ec('0x3c')]=_[_0x42ec('0x3d')](_0x2cb7cd[_0x42ec('0x39')],_0x2cb7cd['query']);_0x4e81ce[_0x42ec('0x3e')]=_[_0x42ec('0x3d')](_0x2cb7cd[_0x42ec('0x39')],qs[_0x42ec('0x3f')](_0x4b75af[_0x42ec('0x3b')][_0x42ec('0x3f')]));_0x4e81ce[_0x42ec('0x3e')]=_0x4e81ce[_0x42ec('0x3e')][_0x42ec('0x40')]?_0x4e81ce['attributes']:_0x2cb7cd[_0x42ec('0x39')];if(!_0x4b75af['query'][_0x42ec('0x41')](_0x42ec('0x42'))){_0x4e81ce['limit']=qs[_0x42ec('0x22')](_0x4b75af[_0x42ec('0x3b')][_0x42ec('0x22')]);_0x4e81ce['offset']=qs['offset'](_0x4b75af['query'][_0x42ec('0x21')]);}_0x4e81ce[_0x42ec('0x43')]=qs[_0x42ec('0x44')](_0x4b75af['query']['sort']);_0x4e81ce[_0x42ec('0x45')]=qs[_0x42ec('0x3c')](_[_0x42ec('0x46')](_0x4b75af['query'],_0x2cb7cd['filters']),_0x19def8);if(_0x4b75af[_0x42ec('0x3b')][_0x42ec('0x47')]){_0x4e81ce[_0x42ec('0x45')]=_[_0x42ec('0x48')](_0x4e81ce[_0x42ec('0x45')],{'$or':_[_0x42ec('0x34')](_0x19def8,function(_0x5a6cab){if(_0x5a6cab['type']!=='VIRTUAL'){var _0x412235={};_0x412235[_0x5a6cab[_0x42ec('0x31')]]={'$like':'%'+_0x4b75af['query'][_0x42ec('0x47')]+'%'};return _0x412235;}})});}_0x4e81ce=_[_0x42ec('0x48')]({},_0x4e81ce,_0x4b75af['options']);var _0x2c0f3d={'where':_0x4e81ce[_0x42ec('0x45')]};return db[_0x42ec('0x35')]['count'](_0x2c0f3d)['then'](function(_0x4e1661){_0x2d5aae[_0x42ec('0x24')]=_0x4e1661;if(_0x4b75af[_0x42ec('0x3b')]['includeAll']){_0x4e81ce[_0x42ec('0x49')]=[{'all':!![]}];}return db['CmList'][_0x42ec('0x4a')](_0x4e81ce);})[_0x42ec('0x2a')](function(_0x18326e){_0x2d5aae['rows']=_0x18326e;return _0x2d5aae;})[_0x42ec('0x2a')](respondWithFilteredResult(_0x524e7c,_0x4e81ce))[_0x42ec('0x4b')](handleError(_0x524e7c,null));};exports['show']=function(_0x2c1d1f,_0x5afb32){var _0xc6fac2={'raw':![],'where':{'id':_0x2c1d1f['params']['id']}},_0x5a8c05={};_0x5a8c05[_0x42ec('0x39')]=_[_0x42ec('0x3a')](db[_0x42ec('0x35')]['rawAttributes']);_0x5a8c05[_0x42ec('0x3b')]=_[_0x42ec('0x3a')](_0x2c1d1f[_0x42ec('0x3b')]);_0x5a8c05['filters']=_[_0x42ec('0x3d')](_0x5a8c05['model'],_0x5a8c05[_0x42ec('0x3b')]);_0xc6fac2['attributes']=_['intersection'](_0x5a8c05[_0x42ec('0x39')],qs[_0x42ec('0x3f')](_0x2c1d1f[_0x42ec('0x3b')][_0x42ec('0x3f')]));_0xc6fac2[_0x42ec('0x3e')]=_0xc6fac2['attributes']['length']?_0xc6fac2['attributes']:_0x5a8c05[_0x42ec('0x39')];if(_0x2c1d1f[_0x42ec('0x3b')]['includeAll']){_0xc6fac2[_0x42ec('0x49')]=[{'all':!![]}];}_0xc6fac2=_[_0x42ec('0x48')]({},_0xc6fac2,_0x2c1d1f[_0x42ec('0x4c')]);return db['CmList']['find'](_0xc6fac2)['then'](handleEntityNotFound(_0x5afb32,null))[_0x42ec('0x2a')](respondWithResult(_0x5afb32,null))['catch'](handleError(_0x5afb32,null));};exports[_0x42ec('0x4d')]=function(_0x523760,_0x67979a){return db[_0x42ec('0x35')][_0x42ec('0x4d')](_0x523760['body'],{})[_0x42ec('0x2a')](function(_0x32eb56){var _0x3d5764=_0x523760[_0x42ec('0x4e')][_0x42ec('0x2b')]({'plain':!![]});if(!_0x3d5764)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d5764[_0x42ec('0x4f')]===_0x42ec('0x4e')){var _0x4dd2ce=_0x32eb56[_0x42ec('0x2b')]({'plain':!![]});var _0x13a226=_0x42ec('0x50');return db[_0x42ec('0x51')][_0x42ec('0x52')]({'where':{'name':_0x13a226,'userProfileId':_0x3d5764[_0x42ec('0x53')]},'raw':!![]})[_0x42ec('0x2a')](function(_0x3488ba){if(_0x3488ba&&_0x3488ba['autoAssociation']===0x0){return db[_0x42ec('0x2c')][_0x42ec('0x4d')]({'name':_0x4dd2ce[_0x42ec('0x31')],'resourceId':_0x4dd2ce['id'],'type':_0x3488ba[_0x42ec('0x31')],'sectionId':_0x3488ba['id']},{})[_0x42ec('0x2a')](function(){return _0x32eb56;});}else{return _0x32eb56;}})[_0x42ec('0x4b')](function(_0x15a917){logger[_0x42ec('0x2f')](_0x42ec('0x54'),_0x15a917);throw _0x15a917;});}return _0x32eb56;})[_0x42ec('0x2a')](respondWithResult(_0x67979a,0xc9))[_0x42ec('0x4b')](handleError(_0x67979a,null));};exports['update']=function(_0xe05de4,_0x33c7d5){if(_0xe05de4[_0x42ec('0x55')]['id']){delete _0xe05de4['body']['id'];}return db[_0x42ec('0x35')]['find']({'where':{'id':_0xe05de4[_0x42ec('0x56')]['id']}})['then'](handleEntityNotFound(_0x33c7d5,null))[_0x42ec('0x2a')](saveUpdates(_0xe05de4[_0x42ec('0x55')],null))[_0x42ec('0x2a')](respondWithResult(_0x33c7d5,null))[_0x42ec('0x4b')](handleError(_0x33c7d5,null));};exports[_0x42ec('0x2d')]=function(_0x440bce,_0x177ec4){return db[_0x42ec('0x35')]['find']({'where':{'id':_0x440bce[_0x42ec('0x56')]['id']}})[_0x42ec('0x2a')](handleEntityNotFound(_0x177ec4,null))[_0x42ec('0x2a')](removeEntity(_0x177ec4,null))[_0x42ec('0x4b')](handleError(_0x177ec4,null));};exports[_0x42ec('0x57')]=function(_0x30211c,_0x12cda4){return db[_0x42ec('0x35')][_0x42ec('0x57')]()[_0x42ec('0x2a')](respondWithResult(_0x12cda4,null))[_0x42ec('0x4b')](handleError(_0x12cda4,null));};exports[_0x42ec('0x58')]=function(_0x12aa02,_0x21d693,_0x191fda){if(_0x12aa02['body']['id']){delete _0x12aa02[_0x42ec('0x55')]['id'];}return db[_0x42ec('0x35')][_0x42ec('0x52')]({'where':{'id':_0x12aa02[_0x42ec('0x56')]['id']}})[_0x42ec('0x2a')](handleEntityNotFound(_0x21d693,null))[_0x42ec('0x2a')](function(_0x26cc84){if(_0x26cc84){_0x12aa02['body'][_0x42ec('0x59')]=_0x26cc84['id'];return db[_0x42ec('0x5a')]['create'](_0x12aa02[_0x42ec('0x55')]);}})['then'](respondWithResult(_0x21d693,null))['catch'](handleError(_0x21d693,null));};exports[_0x42ec('0x5b')]=function(_0x21d558,_0x1fe6ad,_0x58a2a6){var _0x38c275={'raw':![],'where':{}};var _0x5dc4e6={};var _0x5cdb03={'count':0x0,'rows':[]};return db['CmList'][_0x42ec('0x5c')]({'where':{'id':_0x21d558[_0x42ec('0x56')]['id']}})[_0x42ec('0x2a')](handleEntityNotFound(_0x1fe6ad,null))[_0x42ec('0x2a')](function(_0x10f76c){if(_0x10f76c){_0x5dc4e6['model']=_['keys'](db['Disposition'][_0x42ec('0x36')]);_0x5dc4e6[_0x42ec('0x3b')]=_[_0x42ec('0x3a')](_0x21d558[_0x42ec('0x3b')]);_0x5dc4e6['filters']=_[_0x42ec('0x3d')](_0x5dc4e6[_0x42ec('0x39')],_0x5dc4e6[_0x42ec('0x3b')]);_0x38c275[_0x42ec('0x3e')]=_['intersection'](_0x5dc4e6[_0x42ec('0x39')],qs['fields'](_0x21d558['query'][_0x42ec('0x3f')]));_0x38c275[_0x42ec('0x3e')]=_0x38c275[_0x42ec('0x3e')][_0x42ec('0x40')]?_0x38c275[_0x42ec('0x3e')]:_0x5dc4e6[_0x42ec('0x39')];if(!_0x21d558[_0x42ec('0x3b')][_0x42ec('0x41')](_0x42ec('0x42'))){_0x38c275[_0x42ec('0x22')]=qs['limit'](_0x21d558[_0x42ec('0x3b')][_0x42ec('0x22')]);_0x38c275[_0x42ec('0x21')]=qs[_0x42ec('0x21')](_0x21d558[_0x42ec('0x3b')]['offset']);}_0x38c275['order']=qs[_0x42ec('0x44')](_0x21d558[_0x42ec('0x3b')][_0x42ec('0x44')]);_0x38c275[_0x42ec('0x45')]=qs['filters'](_[_0x42ec('0x46')](_0x21d558[_0x42ec('0x3b')],_0x5dc4e6['filters']));_0x38c275['where'][_0x42ec('0x59')]=_0x10f76c['id'];if(_0x21d558[_0x42ec('0x3b')][_0x42ec('0x47')]){_0x38c275[_0x42ec('0x45')]=_[_0x42ec('0x48')](_0x38c275['where'],{'$or':_[_0x42ec('0x34')](_0x38c275[_0x42ec('0x3e')],function(_0x18f2c3){var _0x489dcb={};_0x489dcb[_0x18f2c3]={'$like':'%'+_0x21d558[_0x42ec('0x3b')][_0x42ec('0x47')]+'%'};return _0x489dcb;})});}_0x38c275=_[_0x42ec('0x48')]({},_0x38c275,_0x21d558[_0x42ec('0x4c')]);return db['Disposition'][_0x42ec('0x24')]({'where':_0x38c275[_0x42ec('0x45')]})[_0x42ec('0x2a')](function(_0x23ec98){_0x5cdb03[_0x42ec('0x24')]=_0x23ec98;if(_0x21d558[_0x42ec('0x3b')][_0x42ec('0x5d')]){_0x38c275[_0x42ec('0x49')]=[{'all':!![]}];}return db['Disposition'][_0x42ec('0x4a')](_0x38c275);})[_0x42ec('0x2a')](function(_0x40fd63){_0x5cdb03[_0x42ec('0x5e')]=_0x40fd63;return _0x5cdb03;});}})[_0x42ec('0x2a')](respondWithFilteredResult(_0x1fe6ad,_0x38c275))['catch'](handleError(_0x1fe6ad,null));};exports[_0x42ec('0x5f')]=function(_0x5edf31,_0x1df1a8,_0x3c46d3){return db['CmList'][_0x42ec('0x52')]({'where':{'id':_0x5edf31[_0x42ec('0x56')]['id']}})[_0x42ec('0x2a')](handleEntityNotFound(_0x1df1a8,null))[_0x42ec('0x2a')](function(_0x4a2247){if(_0x4a2247){return _0x4a2247[_0x42ec('0x5f')](_0x5edf31['query'][_0x42ec('0x60')]);}})[_0x42ec('0x2a')](respondWithStatusCode(_0x1df1a8,null))[_0x42ec('0x4b')](handleError(_0x1df1a8,null));};exports[_0x42ec('0x61')]=function(_0x207c8e,_0x22b6ab,_0x326f9d){return db[_0x42ec('0x35')]['find']({'where':{'id':_0x207c8e[_0x42ec('0x56')]['id']}})[_0x42ec('0x2a')](handleEntityNotFound(_0x22b6ab,null))[_0x42ec('0x2a')](function(_0xc5c62a){if(_0xc5c62a){var _0x25d9b6=[];var _0x1a400c={'success':[],'errors':[]};return db[_0x42ec('0x62')][_0x42ec('0x57')]()['then'](function(_0x3b9c4e){if(_0x207c8e[_0x42ec('0x55')][_0x42ec('0x63')]&&_[_0x42ec('0x64')](_0x207c8e[_0x42ec('0x55')][_0x42ec('0x63')])){if(_0x207c8e[_0x42ec('0x55')]['tags'][_0x42ec('0x40')]){_0x207c8e[_0x42ec('0x55')]['tags']=_0x207c8e[_0x42ec('0x55')][_0x42ec('0x63')][_0x42ec('0x65')](';')+';';}else{_0x207c8e[_0x42ec('0x55')]['tags']=null;}}else{_0x207c8e['body'][_0x42ec('0x63')]=null;}if(_0x207c8e['body']&&_[_0x42ec('0x64')](_0x207c8e[_0x42ec('0x55')])){for(var _0x4244d1=0x0;_0x4244d1<_0x207c8e[_0x42ec('0x55')]['length'];_0x4244d1+=0x1){_0x207c8e['body'][_0x4244d1][_0x42ec('0x59')]=_0x207c8e['params']['id'];_0x25d9b6[_0x42ec('0x66')](_0x207c8e[_0x42ec('0x55')][_0x4244d1]);}return BPromise[_0x42ec('0x67')](_0x25d9b6,function(_0x29aae1){return db[_0x42ec('0x62')][_0x42ec('0x4d')](_[_0x42ec('0x68')](_0x29aae1,[_0x42ec('0x60'),'id'])||{},{'fields':_[_0x42ec('0x3a')](_0x3b9c4e),'raw':!![]})[_0x42ec('0x2a')](function(_0x385d21){_0x1a400c['success'][_0x42ec('0x66')](_0x385d21['dataValues']);})[_0x42ec('0x4b')](function(_0x104e98){_0x1a400c[_0x42ec('0x69')][_0x42ec('0x66')]({'data':_0x29aae1,'error':_0x104e98['message']});});})[_0x42ec('0x2a')](function(_0x12c759){return _0x1a400c;})['catch'](function(_0x2e225b){return _0x2e225b;});}else{_0x22b6ab[_0x42ec('0x1e')](0x190)[_0x42ec('0x20')]({'message':_0x42ec('0x6a')});}});}})[_0x42ec('0x2a')](respondWithResult(_0x22b6ab,null))[_0x42ec('0x4b')](handleError(_0x22b6ab,null));};exports[_0x42ec('0x6b')]=function(_0x4f4ffc,_0x287916,_0x257154){var _0x533ab4;return db[_0x42ec('0x35')][_0x42ec('0x52')]({'where':{'id':_0x4f4ffc[_0x42ec('0x56')]['id']},'include':[{'model':db[_0x42ec('0x6c')],'as':_0x42ec('0x6d')}]})['then'](handleEntityNotFound(_0x287916,null))[_0x42ec('0x2a')](function(_0x39b59b){if(_0x39b59b){_0x533ab4=_0x39b59b;return db[_0x42ec('0x62')][_0x42ec('0x36')];}})[_0x42ec('0x2a')](function(_0x13dec4){if(_0x13dec4){var _0x1306d1={};var _0xd66c41={};_0xd66c41[_0x42ec('0x39')]=_[_0x42ec('0x6e')](_[_0x42ec('0x3a')](_0x13dec4),_[_0x42ec('0x34')](_0x533ab4[_0x42ec('0x6d')],function(_0x509dbe){return util['format'](_0x42ec('0x6f'),_0x509dbe['id']);}));_0xd66c41[_0x42ec('0x3b')]=_[_0x42ec('0x3a')](_0x4f4ffc['query']);_0xd66c41['filters']=_[_0x42ec('0x3d')](_0xd66c41[_0x42ec('0x39')],_0xd66c41[_0x42ec('0x3b')]);_0x1306d1[_0x42ec('0x3e')]=_[_0x42ec('0x3d')](_0xd66c41[_0x42ec('0x39')],qs[_0x42ec('0x3f')](_0x4f4ffc[_0x42ec('0x3b')][_0x42ec('0x3f')]));_0x1306d1[_0x42ec('0x3e')]=_0x1306d1[_0x42ec('0x3e')][_0x42ec('0x40')]?_0x1306d1[_0x42ec('0x3e')]:_0xd66c41[_0x42ec('0x39')];if(!_0x4f4ffc[_0x42ec('0x3b')][_0x42ec('0x41')](_0x42ec('0x42'))){_0x1306d1[_0x42ec('0x22')]=qs[_0x42ec('0x22')](_0x4f4ffc[_0x42ec('0x3b')][_0x42ec('0x22')]);_0x1306d1[_0x42ec('0x21')]=qs['offset'](_0x4f4ffc[_0x42ec('0x3b')][_0x42ec('0x21')]);}_0x1306d1[_0x42ec('0x43')]=qs[_0x42ec('0x44')](_0x4f4ffc[_0x42ec('0x3b')][_0x42ec('0x44')]);_0x1306d1[_0x42ec('0x45')]=qs[_0x42ec('0x3c')](_[_0x42ec('0x46')](_0x4f4ffc[_0x42ec('0x3b')],_0xd66c41[_0x42ec('0x3c')]));_0x1306d1['raw']=!![];if(_0x4f4ffc[_0x42ec('0x3b')][_0x42ec('0x47')]){_0x1306d1[_0x42ec('0x45')]=_[_0x42ec('0x48')](_0x1306d1[_0x42ec('0x45')],{'$or':_[_0x42ec('0x34')](_0x1306d1[_0x42ec('0x3e')],function(_0x4380d1){var _0x57aa0d={};_0x57aa0d[_0x4380d1]={'$like':'%'+_0x4f4ffc[_0x42ec('0x3b')]['filter']+'%'};return _0x57aa0d;})});}_0x1306d1=_['merge']({},_0x1306d1,_0x4f4ffc['options']);return _0x533ab4[_0x42ec('0x6b')](_0x1306d1);}})[_0x42ec('0x2a')](respondWithResult(_0x287916,null))[_0x42ec('0x4b')](handleError(_0x287916,null));};exports['getContactsCsv']=function(_0x4bdce0,_0x10f54c,_0xc34ad6){var _0x3fde9f;return db[_0x42ec('0x35')][_0x42ec('0x52')]({'where':{'id':_0x4bdce0[_0x42ec('0x56')]['id']},'include':[{'model':db[_0x42ec('0x6c')],'as':_0x42ec('0x6d')}]})[_0x42ec('0x2a')](handleEntityNotFound(_0x10f54c,null))['then'](function(_0x429ceb){if(_0x429ceb){_0x3fde9f=_0x429ceb;return db[_0x42ec('0x62')][_0x42ec('0x36')];}})['then'](function(_0x2367a4){if(_0x2367a4){var _0x8ae788={};var _0x8773b4={};_0x8773b4[_0x42ec('0x39')]=_[_0x42ec('0x6e')](_[_0x42ec('0x3a')](_0x2367a4),_['map'](_0x3fde9f['CustomFields'],function(_0x503067){return util['format'](_0x42ec('0x6f'),_0x503067['id']);}));_0x8773b4[_0x42ec('0x3b')]=_['keys'](_0x4bdce0[_0x42ec('0x3b')]);_0x8773b4[_0x42ec('0x3c')]=_[_0x42ec('0x3d')](_0x8773b4[_0x42ec('0x39')],_0x8773b4[_0x42ec('0x3b')]);_0x8ae788[_0x42ec('0x3e')]=_[_0x42ec('0x3d')](_0x8773b4[_0x42ec('0x39')],qs[_0x42ec('0x3f')](_0x4bdce0[_0x42ec('0x3b')][_0x42ec('0x3f')]));_0x8ae788['attributes']=_0x8ae788['attributes'][_0x42ec('0x40')]?_0x8ae788[_0x42ec('0x3e')]:_0x8773b4[_0x42ec('0x39')];if(!_0x4bdce0['query'][_0x42ec('0x41')](_0x42ec('0x42'))){_0x8ae788[_0x42ec('0x22')]=qs[_0x42ec('0x22')](_0x4bdce0[_0x42ec('0x3b')]['limit']);_0x8ae788[_0x42ec('0x21')]=qs[_0x42ec('0x21')](_0x4bdce0[_0x42ec('0x3b')][_0x42ec('0x21')]);}_0x8ae788[_0x42ec('0x43')]=qs[_0x42ec('0x44')](_0x4bdce0[_0x42ec('0x3b')][_0x42ec('0x44')]);_0x8ae788[_0x42ec('0x45')]=qs['filters'](_['pick'](_0x4bdce0[_0x42ec('0x3b')],_0x8773b4['filters']));_0x8ae788[_0x42ec('0x70')]=!![];if(_0x4bdce0[_0x42ec('0x3b')][_0x42ec('0x47')]){_0x8ae788[_0x42ec('0x45')]=_[_0x42ec('0x48')](_0x8ae788[_0x42ec('0x45')],{'$or':_[_0x42ec('0x34')](_0x8ae788[_0x42ec('0x3e')],function(_0x3e9671){var _0x42e078={};_0x42e078[_0x3e9671]={'$like':'%'+_0x4bdce0[_0x42ec('0x3b')][_0x42ec('0x47')]+'%'};return _0x42e078;})});}_0x8ae788=_['merge']({},_0x8ae788,_0x4bdce0[_0x42ec('0x4c')]);return _0x3fde9f[_0x42ec('0x6b')](_0x8ae788);}})[_0x42ec('0x2a')](function(_0x2e6862){if(!_[_0x42ec('0x71')](_0x2e6862)){var _0x33be29=toCsv(_0x2e6862);var _0x169267=Date['now']();fs[_0x42ec('0x72')](util[_0x42ec('0x73')]('/tmp/list_%d_%s.csv',_0x3fde9f['id'],_0x169267),_0x33be29);_0x10f54c[_0x42ec('0x74')](_0x42ec('0x75'),_0x42ec('0x76')+util['format'](_0x42ec('0x77'),_0x3fde9f['id'],_0x169267));_0x10f54c['setHeader'](_0x42ec('0x78'),'text/csv');return _0x10f54c['download'](util[_0x42ec('0x73')](_0x42ec('0x79'),_0x3fde9f['id'],_0x169267));}else{return _0x10f54c['sendStatus'](0xcc);}})[_0x42ec('0x4b')](handleError(_0x10f54c,null));};exports['addCustomField']=function(_0x11c8f8,_0x32ff2d,_0x246f9c){var _0x3c595a;delete _0x11c8f8[_0x42ec('0x55')]['id'];return db['CmList'][_0x42ec('0x5c')]({'where':{'id':_0x11c8f8[_0x42ec('0x56')]['id']}})['then'](handleEntityNotFound(_0x32ff2d,null))[_0x42ec('0x2a')](function(_0x39063a){if(_0x39063a){return db['sequelize'][_0x42ec('0x7a')](function(_0x1178da){return db[_0x42ec('0x6c')][_0x42ec('0x4d')](_0x11c8f8[_0x42ec('0x55')],{'transaction':_0x1178da})['then'](function(_0x35337e){_0x3c595a=_0x35337e;return _0x39063a[_0x42ec('0x7b')](_0x35337e,{'transaction':_0x1178da});})[_0x42ec('0x2a')](function(){var _0x11ea8b={'type':db['Sequelize']['TEXT'],'transaction':_0x1178da};switch(_0x11c8f8[_0x42ec('0x55')][_0x42ec('0x7c')]){case _0x42ec('0x7d'):_0x11ea8b['type']=db['Sequelize'][_0x42ec('0x7e')];break;case'number':_0x11ea8b[_0x42ec('0x7c')]=db[_0x42ec('0x7f')][_0x42ec('0x80')];break;case _0x42ec('0x81'):_0x11ea8b['type']=db[_0x42ec('0x7f')][_0x42ec('0x82')];_0x11ea8b['defaultValue']=![];break;default:}return db['sequelize'][_0x42ec('0x83')]['addColumn'](_0x42ec('0x84'),util[_0x42ec('0x73')](_0x42ec('0x85'),_0x3c595a['id']),_0x11ea8b);})[_0x42ec('0x2a')](function(){return _0x3c595a;});});}})[_0x42ec('0x2a')](respondWithResult(_0x32ff2d,null))[_0x42ec('0x4b')](handleError(_0x32ff2d,null));};exports['getCustomFields']=function(_0x3135f9,_0xe6c3a2,_0x2a257c){var _0x184647={};var _0x3c8d95={};var _0xb23202;var _0x207703;return db[_0x42ec('0x35')]['findOne']({'where':{'id':_0x3135f9[_0x42ec('0x56')]['id']}})[_0x42ec('0x2a')](handleEntityNotFound(_0xe6c3a2,null))[_0x42ec('0x2a')](function(_0x6c2efd){if(_0x6c2efd){_0xb23202=_0x6c2efd;_0x3c8d95['model']=_['keys'](db['CmCustomField']['rawAttributes']);_0x3c8d95[_0x42ec('0x3b')]=_[_0x42ec('0x3a')](_0x3135f9['query']);_0x3c8d95[_0x42ec('0x3c')]=_[_0x42ec('0x3d')](_0x3c8d95['model'],_0x3c8d95['query']);_0x184647['attributes']=_[_0x42ec('0x3d')](_0x3c8d95[_0x42ec('0x39')],qs[_0x42ec('0x3f')](_0x3135f9[_0x42ec('0x3b')]['fields']));_0x184647[_0x42ec('0x3e')]=_0x184647[_0x42ec('0x3e')][_0x42ec('0x40')]?_0x184647[_0x42ec('0x3e')]:_0x3c8d95[_0x42ec('0x39')];_0x184647[_0x42ec('0x43')]=qs[_0x42ec('0x44')](_0x3135f9['query'][_0x42ec('0x44')]);_0x184647[_0x42ec('0x45')]=qs['filters'](_[_0x42ec('0x46')](_0x3135f9[_0x42ec('0x3b')],_0x3c8d95['filters']));_0x184647[_0x42ec('0x45')]=_[_0x42ec('0x48')](_0x184647[_0x42ec('0x45')],{'$or':[{'ListId':_0x6c2efd['id']},{'ListId':null}]});if(_0x3135f9[_0x42ec('0x3b')][_0x42ec('0x47')]){_0x184647[_0x42ec('0x45')]=_[_0x42ec('0x48')](_0x184647[_0x42ec('0x45')],{'$or':_['map'](_0x184647[_0x42ec('0x3e')],function(_0x46061c){var _0x1e080c={};_0x1e080c[_0x46061c]={'$like':'%'+_0x3135f9[_0x42ec('0x3b')][_0x42ec('0x47')]+'%'};return _0x1e080c;})});}_0x184647=_[_0x42ec('0x48')]({},_0x184647,_0x3135f9[_0x42ec('0x4c')]);return db['CmCustomField'][_0x42ec('0x86')](_0x184647);}})[_0x42ec('0x2a')](respondWithResult(_0xe6c3a2,null))['catch'](handleError(_0xe6c3a2,null));};exports['addAgents']=function(_0x573d6d,_0x5b685b,_0x2b4a7b){return db['CmList']['find']({'where':{'id':_0x573d6d[_0x42ec('0x56')]['id']}})['then'](handleEntityNotFound(_0x5b685b,null))[_0x42ec('0x2a')](function(_0x352a88){if(_0x352a88){return _0x352a88[_0x42ec('0x87')](_0x573d6d[_0x42ec('0x55')][_0x42ec('0x60')],_[_0x42ec('0x68')](_0x573d6d[_0x42ec('0x55')],[_0x42ec('0x60'),'id'])||{})[_0x42ec('0x88')](function(_0x38defd){for(var _0x2b134c=0x0;_0x2b134c<_0x573d6d['body'][_0x42ec('0x60')][_0x42ec('0x40')];_0x2b134c+=0x1){socket[_0x42ec('0x89')](_0x42ec('0x8a'),{'UserId':Number(_0x573d6d[_0x42ec('0x55')]['ids'][_0x2b134c]),'CmListId':Number(_0x573d6d[_0x42ec('0x56')]['id'])});}return _0x38defd;});}})[_0x42ec('0x2a')](respondWithResult(_0x5b685b,null))[_0x42ec('0x4b')](handleError(_0x5b685b,null));};exports['removeAgents']=function(_0x2c4f94,_0x3e048a,_0x3b61ad){return db['CmList'][_0x42ec('0x52')]({'where':{'id':_0x2c4f94[_0x42ec('0x56')]['id']}})[_0x42ec('0x2a')](handleEntityNotFound(_0x3e048a,null))[_0x42ec('0x2a')](function(_0x321826){if(_0x321826){return _0x321826[_0x42ec('0x8b')](_0x2c4f94['query']['ids'])[_0x42ec('0x2a')](function(){if(_[_0x42ec('0x64')](_0x2c4f94[_0x42ec('0x3b')][_0x42ec('0x60')])){for(var _0x337cbd=0x0;_0x337cbd<_0x2c4f94[_0x42ec('0x3b')]['ids'][_0x42ec('0x40')];_0x337cbd+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x2c4f94[_0x42ec('0x3b')][_0x42ec('0x60')][_0x337cbd]),'CmListId':Number(_0x2c4f94['params']['id'])});}}else{socket[_0x42ec('0x89')](_0x42ec('0x8c'),{'UserId':Number(_0x2c4f94['query'][_0x42ec('0x60')]),'CmListId':Number(_0x2c4f94[_0x42ec('0x56')]['id'])});}});}})[_0x42ec('0x2a')](respondWithStatusCode(_0x3e048a,null))[_0x42ec('0x4b')](handleError(_0x3e048a,null));};exports[_0x42ec('0x8d')]=function(_0x34e507,_0x55e3c0,_0x5a46bb){var _0x1a2f6a={};var _0x5d32c9={};var _0x5d1849;var _0x3d5769;return db[_0x42ec('0x35')][_0x42ec('0x5c')]({'where':{'id':_0x34e507[_0x42ec('0x56')]['id']}})[_0x42ec('0x2a')](handleEntityNotFound(_0x55e3c0,null))[_0x42ec('0x2a')](function(_0x2851c1){if(_0x2851c1){_0x5d1849=_0x2851c1;_0x5d32c9[_0x42ec('0x39')]=_[_0x42ec('0x3a')](db[_0x42ec('0x8e')][_0x42ec('0x36')]);_0x5d32c9['query']=_[_0x42ec('0x3a')](_0x34e507[_0x42ec('0x3b')]);_0x5d32c9[_0x42ec('0x3c')]=_[_0x42ec('0x3d')](_0x5d32c9[_0x42ec('0x39')],_0x5d32c9[_0x42ec('0x3b')]);_0x1a2f6a['attributes']=_['intersection'](_0x5d32c9['model'],qs[_0x42ec('0x3f')](_0x34e507[_0x42ec('0x3b')][_0x42ec('0x3f')]));_0x1a2f6a['attributes']=_0x1a2f6a[_0x42ec('0x3e')][_0x42ec('0x40')]?_0x1a2f6a['attributes']:_0x5d32c9['model'];_0x1a2f6a['order']=qs[_0x42ec('0x44')](_0x34e507['query'][_0x42ec('0x44')]);_0x1a2f6a['where']=qs[_0x42ec('0x3c')](_['pick'](_0x34e507[_0x42ec('0x3b')],_0x5d32c9[_0x42ec('0x3c')]));if(_0x34e507[_0x42ec('0x3b')][_0x42ec('0x47')]){_0x1a2f6a[_0x42ec('0x45')]=_[_0x42ec('0x48')](_0x1a2f6a[_0x42ec('0x45')],{'$or':_[_0x42ec('0x34')](_0x1a2f6a['attributes'],function(_0x5a81b8){var _0x3a6210={};_0x3a6210[_0x5a81b8]={'$like':'%'+_0x34e507[_0x42ec('0x3b')][_0x42ec('0x47')]+'%'};return _0x3a6210;})});}_0x1a2f6a=_['merge']({},_0x1a2f6a,_0x34e507[_0x42ec('0x4c')]);return _0x5d1849[_0x42ec('0x8d')](_0x1a2f6a);}})['then'](function(_0x4dd437){if(_0x4dd437){_0x3d5769=_0x4dd437[_0x42ec('0x40')];if(!_0x34e507[_0x42ec('0x3b')][_0x42ec('0x41')](_0x42ec('0x42'))){_0x1a2f6a[_0x42ec('0x22')]=qs[_0x42ec('0x22')](_0x34e507[_0x42ec('0x3b')][_0x42ec('0x22')]);_0x1a2f6a[_0x42ec('0x21')]=qs[_0x42ec('0x21')](_0x34e507[_0x42ec('0x3b')]['offset']);}return _0x5d1849['getAgents'](_0x1a2f6a);}})[_0x42ec('0x2a')](function(_0x16c118){if(_0x16c118){return _0x16c118?{'count':_0x3d5769,'rows':_0x16c118}:null;}})[_0x42ec('0x2a')](respondWithResult(_0x55e3c0,null))[_0x42ec('0x4b')](handleError(_0x55e3c0,null));}; \ No newline at end of file +var _0xc9b7=['tags','join','isArray','each','omit','success','dataValues','errors','push','message','Malformed\x20request\x20syntax','CustomFields','concat','format','raw','getContactsCsv','CmCustomField','cf_%d','getContacts','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','download','addCustomField','findOne','sequelize','transaction','addCustomFields','TEXT','text','number','Sequelize','INTEGER','defaultValue','addColumn','cm_contacts','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','status','json','offset','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Lists','UserProfileResource','end','sendStatus','error','stack','name','send','map','CmList','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','Disposition','getDispositions','ListId','removeDispositions','ids','CmContact'];(function(_0x4cf5f7,_0x80765d){var _0x3edf82=function(_0x28bbc2){while(--_0x28bbc2){_0x4cf5f7['push'](_0x4cf5f7['shift']());}};_0x3edf82(++_0x80765d);}(_0xc9b7,0x1f2));var _0x7c9b=function(_0x56cc19,_0x2fd3a3){_0x56cc19=_0x56cc19-0x0;var _0x19cf03=_0xc9b7[_0x56cc19];return _0x19cf03;};'use strict';var emlformat=require(_0x7c9b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7c9b('0x1'));var jsonpatch=require(_0x7c9b('0x2'));var rp=require(_0x7c9b('0x3'));var moment=require(_0x7c9b('0x4'));var BPromise=require(_0x7c9b('0x5'));var Mustache=require(_0x7c9b('0x6'));var util=require(_0x7c9b('0x7'));var path=require(_0x7c9b('0x8'));var sox=require(_0x7c9b('0x9'));var csv=require(_0x7c9b('0xa'));var ejs=require(_0x7c9b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7c9b('0xc'));var crypto=require(_0x7c9b('0xd'));var jsforce=require(_0x7c9b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7c9b('0xa'));var querystring=require(_0x7c9b('0xf'));var Papa=require('papaparse');var Redis=require(_0x7c9b('0x10'));var authService=require(_0x7c9b('0x11'));var qs=require(_0x7c9b('0x12'));var as=require(_0x7c9b('0x13'));var hardwareService=require(_0x7c9b('0x14'));var logger=require(_0x7c9b('0x15'))(_0x7c9b('0x16'));var utils=require(_0x7c9b('0x17'));var config=require(_0x7c9b('0x18'));var licenseUtil=require(_0x7c9b('0x19'));var db=require(_0x7c9b('0x1a'))['db'];config[_0x7c9b('0x1b')]=_[_0x7c9b('0x1c')](config[_0x7c9b('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c9b('0x1d'))(new Redis(config[_0x7c9b('0x1b')]));require(_0x7c9b('0x1e'))['register'](socket);function respondWithStatusCode(_0x3f2f4f,_0x3ffc57){_0x3ffc57=_0x3ffc57||0xcc;return function(_0x5829b5){if(_0x5829b5){return _0x3f2f4f['sendStatus'](_0x3ffc57);}return _0x3f2f4f[_0x7c9b('0x1f')](_0x3ffc57)['end']();};}function respondWithResult(_0x2b9ea8,_0x4b7582){_0x4b7582=_0x4b7582||0xc8;return function(_0x4be368){if(_0x4be368){return _0x2b9ea8[_0x7c9b('0x1f')](_0x4b7582)[_0x7c9b('0x20')](_0x4be368);}};}function respondWithFilteredResult(_0xfbd2af,_0x47bcb5){return function(_0x3d6506){if(_0x3d6506){var _0x323ad2=typeof _0x47bcb5[_0x7c9b('0x21')]==='undefined'&&typeof _0x47bcb5['limit']==='undefined';var _0x10534d=_0x3d6506[_0x7c9b('0x22')];var _0x14e1aa=_0x323ad2?0x0:_0x47bcb5[_0x7c9b('0x21')];var _0x357c2d=_0x323ad2?_0x3d6506[_0x7c9b('0x22')]:_0x47bcb5[_0x7c9b('0x21')]+_0x47bcb5[_0x7c9b('0x23')];var _0x3d5bed;if(_0x357c2d>=_0x10534d){_0x357c2d=_0x10534d;_0x3d5bed=0xc8;}else{_0x3d5bed=0xce;}_0xfbd2af[_0x7c9b('0x1f')](_0x3d5bed);return _0xfbd2af[_0x7c9b('0x24')](_0x7c9b('0x25'),_0x14e1aa+'-'+_0x357c2d+'/'+_0x10534d)[_0x7c9b('0x20')](_0x3d6506);}return null;};}function patchUpdates(_0x35f11b){return function(_0x80d633){try{jsonpatch[_0x7c9b('0x26')](_0x80d633,_0x35f11b,!![]);}catch(_0x24fef5){return BPromise[_0x7c9b('0x27')](_0x24fef5);}return _0x80d633[_0x7c9b('0x28')]();};}function saveUpdates(_0x25a37d,_0x4a356c){return function(_0x52af90){if(_0x52af90){return _0x52af90['update'](_0x25a37d)[_0x7c9b('0x29')](function(_0xa9298){return _0xa9298;});}return null;};}function removeEntity(_0x45d2be,_0x323e39){return function(_0x269d4f){if(_0x269d4f){return _0x269d4f[_0x7c9b('0x2a')]()[_0x7c9b('0x29')](function(){var _0xc73183=_0x269d4f[_0x7c9b('0x2b')]({'plain':!![]});var _0x24e3f0=_0x7c9b('0x2c');return db[_0x7c9b('0x2d')][_0x7c9b('0x2a')]({'where':{'type':_0x24e3f0,'resourceId':_0xc73183['id']}})[_0x7c9b('0x29')](function(){return _0x269d4f;});})[_0x7c9b('0x29')](function(){_0x45d2be['status'](0xcc)[_0x7c9b('0x2e')]();});}};}function handleEntityNotFound(_0x58e12a,_0x330a97){return function(_0x3b20eb){if(!_0x3b20eb){_0x58e12a[_0x7c9b('0x2f')](0x194);}return _0x3b20eb;};}function handleError(_0x57d0e7,_0x263215){_0x263215=_0x263215||0x1f4;return function(_0x3c5783){logger[_0x7c9b('0x30')](_0x3c5783[_0x7c9b('0x31')]);if(_0x3c5783['name']){delete _0x3c5783[_0x7c9b('0x32')];}_0x57d0e7[_0x7c9b('0x1f')](_0x263215)[_0x7c9b('0x33')](_0x3c5783);};}exports['index']=function(_0x3ecc86,_0x15bcaf){var _0x2816f3={},_0x17cf1f={},_0x4a7f32={'count':0x0,'rows':[]};var _0x4f36eb=_[_0x7c9b('0x34')](db[_0x7c9b('0x35')][_0x7c9b('0x36')],function(_0x4614c6){return{'name':_0x4614c6['fieldName'],'type':_0x4614c6[_0x7c9b('0x37')]['key']};});_0x17cf1f['model']=_['map'](_0x4f36eb,_0x7c9b('0x32'));_0x17cf1f[_0x7c9b('0x38')]=_[_0x7c9b('0x39')](_0x3ecc86[_0x7c9b('0x38')]);_0x17cf1f[_0x7c9b('0x3a')]=_[_0x7c9b('0x3b')](_0x17cf1f[_0x7c9b('0x3c')],_0x17cf1f[_0x7c9b('0x38')]);_0x2816f3[_0x7c9b('0x3d')]=_[_0x7c9b('0x3b')](_0x17cf1f[_0x7c9b('0x3c')],qs[_0x7c9b('0x3e')](_0x3ecc86['query']['fields']));_0x2816f3[_0x7c9b('0x3d')]=_0x2816f3['attributes'][_0x7c9b('0x3f')]?_0x2816f3[_0x7c9b('0x3d')]:_0x17cf1f[_0x7c9b('0x3c')];if(!_0x3ecc86[_0x7c9b('0x38')][_0x7c9b('0x40')](_0x7c9b('0x41'))){_0x2816f3[_0x7c9b('0x23')]=qs[_0x7c9b('0x23')](_0x3ecc86['query'][_0x7c9b('0x23')]);_0x2816f3[_0x7c9b('0x21')]=qs[_0x7c9b('0x21')](_0x3ecc86[_0x7c9b('0x38')][_0x7c9b('0x21')]);}_0x2816f3[_0x7c9b('0x42')]=qs['sort'](_0x3ecc86['query'][_0x7c9b('0x43')]);_0x2816f3[_0x7c9b('0x44')]=qs[_0x7c9b('0x3a')](_[_0x7c9b('0x45')](_0x3ecc86['query'],_0x17cf1f[_0x7c9b('0x3a')]),_0x4f36eb);if(_0x3ecc86['query']['filter']){_0x2816f3[_0x7c9b('0x44')]=_[_0x7c9b('0x46')](_0x2816f3['where'],{'$or':_[_0x7c9b('0x34')](_0x4f36eb,function(_0x28fc6a){if(_0x28fc6a[_0x7c9b('0x37')]!==_0x7c9b('0x47')){var _0x40f09b={};_0x40f09b[_0x28fc6a[_0x7c9b('0x32')]]={'$like':'%'+_0x3ecc86['query'][_0x7c9b('0x48')]+'%'};return _0x40f09b;}})});}_0x2816f3=_[_0x7c9b('0x46')]({},_0x2816f3,_0x3ecc86[_0x7c9b('0x49')]);var _0x9c3832={'where':_0x2816f3[_0x7c9b('0x44')]};return db[_0x7c9b('0x35')][_0x7c9b('0x22')](_0x9c3832)[_0x7c9b('0x29')](function(_0x41005d){_0x4a7f32[_0x7c9b('0x22')]=_0x41005d;if(_0x3ecc86[_0x7c9b('0x38')]['includeAll']){_0x2816f3[_0x7c9b('0x4a')]=[{'all':!![]}];}return db[_0x7c9b('0x35')][_0x7c9b('0x4b')](_0x2816f3);})[_0x7c9b('0x29')](function(_0x485e0b){_0x4a7f32[_0x7c9b('0x4c')]=_0x485e0b;return _0x4a7f32;})['then'](respondWithFilteredResult(_0x15bcaf,_0x2816f3))[_0x7c9b('0x4d')](handleError(_0x15bcaf,null));};exports[_0x7c9b('0x4e')]=function(_0x120b34,_0x4fe50b){var _0x4bd5c2={'raw':![],'where':{'id':_0x120b34['params']['id']}},_0x5d67ff={};_0x5d67ff[_0x7c9b('0x3c')]=_['keys'](db['CmList']['rawAttributes']);_0x5d67ff[_0x7c9b('0x38')]=_[_0x7c9b('0x39')](_0x120b34[_0x7c9b('0x38')]);_0x5d67ff[_0x7c9b('0x3a')]=_[_0x7c9b('0x3b')](_0x5d67ff['model'],_0x5d67ff[_0x7c9b('0x38')]);_0x4bd5c2['attributes']=_[_0x7c9b('0x3b')](_0x5d67ff[_0x7c9b('0x3c')],qs['fields'](_0x120b34[_0x7c9b('0x38')][_0x7c9b('0x3e')]));_0x4bd5c2[_0x7c9b('0x3d')]=_0x4bd5c2['attributes'][_0x7c9b('0x3f')]?_0x4bd5c2['attributes']:_0x5d67ff[_0x7c9b('0x3c')];if(_0x120b34[_0x7c9b('0x38')][_0x7c9b('0x4f')]){_0x4bd5c2[_0x7c9b('0x4a')]=[{'all':!![]}];}_0x4bd5c2=_[_0x7c9b('0x46')]({},_0x4bd5c2,_0x120b34[_0x7c9b('0x49')]);return db[_0x7c9b('0x35')][_0x7c9b('0x50')](_0x4bd5c2)[_0x7c9b('0x29')](handleEntityNotFound(_0x4fe50b,null))[_0x7c9b('0x29')](respondWithResult(_0x4fe50b,null))[_0x7c9b('0x4d')](handleError(_0x4fe50b,null));};exports[_0x7c9b('0x51')]=function(_0x46231f,_0x33c7cf){return db['CmList'][_0x7c9b('0x51')](_0x46231f[_0x7c9b('0x52')],{})[_0x7c9b('0x29')](function(_0x173529){var _0x58e657=_0x46231f[_0x7c9b('0x53')]['get']({'plain':!![]});if(!_0x58e657)throw new Error(_0x7c9b('0x54'));if(_0x58e657[_0x7c9b('0x55')]===_0x7c9b('0x53')){var _0x555ebf=_0x173529['get']({'plain':!![]});var _0x9da16=_0x7c9b('0x2c');return db['UserProfileSection'][_0x7c9b('0x50')]({'where':{'name':_0x9da16,'userProfileId':_0x58e657[_0x7c9b('0x56')]},'raw':!![]})[_0x7c9b('0x29')](function(_0x2b1105){if(_0x2b1105&&_0x2b1105[_0x7c9b('0x57')]===0x0){return db['UserProfileResource'][_0x7c9b('0x51')]({'name':_0x555ebf[_0x7c9b('0x32')],'resourceId':_0x555ebf['id'],'type':_0x2b1105['name'],'sectionId':_0x2b1105['id']},{})[_0x7c9b('0x29')](function(){return _0x173529;});}else{return _0x173529;}})[_0x7c9b('0x4d')](function(_0x4aa83e){logger[_0x7c9b('0x30')](_0x7c9b('0x58'),_0x4aa83e);throw _0x4aa83e;});}return _0x173529;})['then'](respondWithResult(_0x33c7cf,0xc9))['catch'](handleError(_0x33c7cf,null));};exports[_0x7c9b('0x59')]=function(_0x3317e9,_0x422721){if(_0x3317e9['body']['id']){delete _0x3317e9[_0x7c9b('0x52')]['id'];}return db[_0x7c9b('0x35')][_0x7c9b('0x50')]({'where':{'id':_0x3317e9[_0x7c9b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x422721,null))[_0x7c9b('0x29')](saveUpdates(_0x3317e9[_0x7c9b('0x52')],null))[_0x7c9b('0x29')](respondWithResult(_0x422721,null))[_0x7c9b('0x4d')](handleError(_0x422721,null));};exports['destroy']=function(_0x7612ba,_0x212e70){return db[_0x7c9b('0x35')][_0x7c9b('0x50')]({'where':{'id':_0x7612ba['params']['id']}})[_0x7c9b('0x29')](handleEntityNotFound(_0x212e70,null))[_0x7c9b('0x29')](removeEntity(_0x212e70,null))[_0x7c9b('0x4d')](handleError(_0x212e70,null));};exports[_0x7c9b('0x5b')]=function(_0x1b6ed7,_0x1d69d2){return db['CmList'][_0x7c9b('0x5b')]()[_0x7c9b('0x29')](respondWithResult(_0x1d69d2,null))[_0x7c9b('0x4d')](handleError(_0x1d69d2,null));};exports['addDisposition']=function(_0x2d24bd,_0x1b4e1d,_0x4873a9){if(_0x2d24bd[_0x7c9b('0x52')]['id']){delete _0x2d24bd[_0x7c9b('0x52')]['id'];}return db[_0x7c9b('0x35')][_0x7c9b('0x50')]({'where':{'id':_0x2d24bd[_0x7c9b('0x5a')]['id']}})[_0x7c9b('0x29')](handleEntityNotFound(_0x1b4e1d,null))[_0x7c9b('0x29')](function(_0x371262){if(_0x371262){_0x2d24bd[_0x7c9b('0x52')]['ListId']=_0x371262['id'];return db[_0x7c9b('0x5c')][_0x7c9b('0x51')](_0x2d24bd['body']);}})[_0x7c9b('0x29')](respondWithResult(_0x1b4e1d,null))[_0x7c9b('0x4d')](handleError(_0x1b4e1d,null));};exports[_0x7c9b('0x5d')]=function(_0x5969a1,_0x13206a,_0x2be74b){var _0x39a689={'raw':![],'where':{}};var _0x2c1f98={};var _0x72d540={'count':0x0,'rows':[]};return db[_0x7c9b('0x35')]['findOne']({'where':{'id':_0x5969a1[_0x7c9b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x13206a,null))[_0x7c9b('0x29')](function(_0x2d1702){if(_0x2d1702){_0x2c1f98['model']=_[_0x7c9b('0x39')](db[_0x7c9b('0x5c')]['rawAttributes']);_0x2c1f98[_0x7c9b('0x38')]=_[_0x7c9b('0x39')](_0x5969a1[_0x7c9b('0x38')]);_0x2c1f98[_0x7c9b('0x3a')]=_[_0x7c9b('0x3b')](_0x2c1f98[_0x7c9b('0x3c')],_0x2c1f98[_0x7c9b('0x38')]);_0x39a689[_0x7c9b('0x3d')]=_[_0x7c9b('0x3b')](_0x2c1f98[_0x7c9b('0x3c')],qs[_0x7c9b('0x3e')](_0x5969a1[_0x7c9b('0x38')]['fields']));_0x39a689[_0x7c9b('0x3d')]=_0x39a689[_0x7c9b('0x3d')][_0x7c9b('0x3f')]?_0x39a689[_0x7c9b('0x3d')]:_0x2c1f98[_0x7c9b('0x3c')];if(!_0x5969a1[_0x7c9b('0x38')][_0x7c9b('0x40')](_0x7c9b('0x41'))){_0x39a689[_0x7c9b('0x23')]=qs[_0x7c9b('0x23')](_0x5969a1['query'][_0x7c9b('0x23')]);_0x39a689[_0x7c9b('0x21')]=qs[_0x7c9b('0x21')](_0x5969a1['query'][_0x7c9b('0x21')]);}_0x39a689[_0x7c9b('0x42')]=qs[_0x7c9b('0x43')](_0x5969a1[_0x7c9b('0x38')][_0x7c9b('0x43')]);_0x39a689['where']=qs[_0x7c9b('0x3a')](_[_0x7c9b('0x45')](_0x5969a1[_0x7c9b('0x38')],_0x2c1f98[_0x7c9b('0x3a')]));_0x39a689[_0x7c9b('0x44')][_0x7c9b('0x5e')]=_0x2d1702['id'];if(_0x5969a1[_0x7c9b('0x38')][_0x7c9b('0x48')]){_0x39a689[_0x7c9b('0x44')]=_[_0x7c9b('0x46')](_0x39a689[_0x7c9b('0x44')],{'$or':_['map'](_0x39a689[_0x7c9b('0x3d')],function(_0x35878a){var _0x714ee3={};_0x714ee3[_0x35878a]={'$like':'%'+_0x5969a1[_0x7c9b('0x38')][_0x7c9b('0x48')]+'%'};return _0x714ee3;})});}_0x39a689=_[_0x7c9b('0x46')]({},_0x39a689,_0x5969a1[_0x7c9b('0x49')]);return db['Disposition']['count']({'where':_0x39a689[_0x7c9b('0x44')]})[_0x7c9b('0x29')](function(_0x53f65e){_0x72d540[_0x7c9b('0x22')]=_0x53f65e;if(_0x5969a1[_0x7c9b('0x38')][_0x7c9b('0x4f')]){_0x39a689[_0x7c9b('0x4a')]=[{'all':!![]}];}return db[_0x7c9b('0x5c')][_0x7c9b('0x4b')](_0x39a689);})[_0x7c9b('0x29')](function(_0x143ce9){_0x72d540['rows']=_0x143ce9;return _0x72d540;});}})[_0x7c9b('0x29')](respondWithFilteredResult(_0x13206a,_0x39a689))[_0x7c9b('0x4d')](handleError(_0x13206a,null));};exports['removeDispositions']=function(_0x57d62a,_0x11e3f7,_0x3c34ee){return db['CmList'][_0x7c9b('0x50')]({'where':{'id':_0x57d62a[_0x7c9b('0x5a')]['id']}})[_0x7c9b('0x29')](handleEntityNotFound(_0x11e3f7,null))['then'](function(_0x5296f7){if(_0x5296f7){return _0x5296f7[_0x7c9b('0x5f')](_0x57d62a[_0x7c9b('0x38')][_0x7c9b('0x60')]);}})[_0x7c9b('0x29')](respondWithStatusCode(_0x11e3f7,null))['catch'](handleError(_0x11e3f7,null));};exports['addContacts']=function(_0xb7f70d,_0x2be546,_0x1f306d){return db['CmList']['find']({'where':{'id':_0xb7f70d[_0x7c9b('0x5a')]['id']}})[_0x7c9b('0x29')](handleEntityNotFound(_0x2be546,null))[_0x7c9b('0x29')](function(_0x923298){if(_0x923298){var _0x3acec2=[];var _0x540b06={'success':[],'errors':[]};return db[_0x7c9b('0x61')]['describe']()[_0x7c9b('0x29')](function(_0x365eff){if(_0xb7f70d[_0x7c9b('0x52')]['tags']&&_['isArray'](_0xb7f70d['body'][_0x7c9b('0x62')])){if(_0xb7f70d[_0x7c9b('0x52')]['tags'][_0x7c9b('0x3f')]){_0xb7f70d['body'][_0x7c9b('0x62')]=_0xb7f70d[_0x7c9b('0x52')]['tags'][_0x7c9b('0x63')](';')+';';}else{_0xb7f70d[_0x7c9b('0x52')][_0x7c9b('0x62')]=null;}}else{_0xb7f70d[_0x7c9b('0x52')][_0x7c9b('0x62')]=null;}if(_0xb7f70d[_0x7c9b('0x52')]&&_[_0x7c9b('0x64')](_0xb7f70d[_0x7c9b('0x52')])){for(var _0x4aade2=0x0;_0x4aade2<_0xb7f70d[_0x7c9b('0x52')][_0x7c9b('0x3f')];_0x4aade2+=0x1){_0xb7f70d[_0x7c9b('0x52')][_0x4aade2][_0x7c9b('0x5e')]=_0xb7f70d['params']['id'];_0x3acec2['push'](_0xb7f70d[_0x7c9b('0x52')][_0x4aade2]);}return BPromise[_0x7c9b('0x65')](_0x3acec2,function(_0x5e8232){return db[_0x7c9b('0x61')][_0x7c9b('0x51')](_[_0x7c9b('0x66')](_0x5e8232,[_0x7c9b('0x60'),'id'])||{},{'fields':_['keys'](_0x365eff),'raw':!![]})[_0x7c9b('0x29')](function(_0x3f4819){_0x540b06[_0x7c9b('0x67')]['push'](_0x3f4819[_0x7c9b('0x68')]);})[_0x7c9b('0x4d')](function(_0x5cd645){_0x540b06[_0x7c9b('0x69')][_0x7c9b('0x6a')]({'data':_0x5e8232,'error':_0x5cd645[_0x7c9b('0x6b')]});});})[_0x7c9b('0x29')](function(_0x459817){return _0x540b06;})['catch'](function(_0x37ce62){return _0x37ce62;});}else{_0x2be546['status'](0x190)[_0x7c9b('0x20')]({'message':_0x7c9b('0x6c')});}});}})[_0x7c9b('0x29')](respondWithResult(_0x2be546,null))[_0x7c9b('0x4d')](handleError(_0x2be546,null));};exports['getContacts']=function(_0x11a136,_0x5066ae,_0x4b3484){var _0x39a0df;return db[_0x7c9b('0x35')][_0x7c9b('0x50')]({'where':{'id':_0x11a136[_0x7c9b('0x5a')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x7c9b('0x6d')}]})[_0x7c9b('0x29')](handleEntityNotFound(_0x5066ae,null))[_0x7c9b('0x29')](function(_0x43e357){if(_0x43e357){_0x39a0df=_0x43e357;return db['CmContact']['rawAttributes'];}})[_0x7c9b('0x29')](function(_0x4a0b19){if(_0x4a0b19){var _0x75597c={};var _0x42e1d7={};_0x42e1d7[_0x7c9b('0x3c')]=_[_0x7c9b('0x6e')](_[_0x7c9b('0x39')](_0x4a0b19),_['map'](_0x39a0df[_0x7c9b('0x6d')],function(_0x2b9c76){return util[_0x7c9b('0x6f')]('cf_%d',_0x2b9c76['id']);}));_0x42e1d7[_0x7c9b('0x38')]=_['keys'](_0x11a136[_0x7c9b('0x38')]);_0x42e1d7[_0x7c9b('0x3a')]=_[_0x7c9b('0x3b')](_0x42e1d7[_0x7c9b('0x3c')],_0x42e1d7[_0x7c9b('0x38')]);_0x75597c['attributes']=_[_0x7c9b('0x3b')](_0x42e1d7[_0x7c9b('0x3c')],qs[_0x7c9b('0x3e')](_0x11a136[_0x7c9b('0x38')]['fields']));_0x75597c[_0x7c9b('0x3d')]=_0x75597c['attributes'][_0x7c9b('0x3f')]?_0x75597c[_0x7c9b('0x3d')]:_0x42e1d7[_0x7c9b('0x3c')];if(!_0x11a136[_0x7c9b('0x38')][_0x7c9b('0x40')](_0x7c9b('0x41'))){_0x75597c['limit']=qs[_0x7c9b('0x23')](_0x11a136[_0x7c9b('0x38')][_0x7c9b('0x23')]);_0x75597c['offset']=qs['offset'](_0x11a136[_0x7c9b('0x38')][_0x7c9b('0x21')]);}_0x75597c[_0x7c9b('0x42')]=qs[_0x7c9b('0x43')](_0x11a136[_0x7c9b('0x38')][_0x7c9b('0x43')]);_0x75597c[_0x7c9b('0x44')]=qs[_0x7c9b('0x3a')](_['pick'](_0x11a136['query'],_0x42e1d7[_0x7c9b('0x3a')]));_0x75597c[_0x7c9b('0x70')]=!![];if(_0x11a136[_0x7c9b('0x38')][_0x7c9b('0x48')]){_0x75597c['where']=_[_0x7c9b('0x46')](_0x75597c['where'],{'$or':_[_0x7c9b('0x34')](_0x75597c['attributes'],function(_0x3b64a3){var _0x16150b={};_0x16150b[_0x3b64a3]={'$like':'%'+_0x11a136[_0x7c9b('0x38')][_0x7c9b('0x48')]+'%'};return _0x16150b;})});}_0x75597c=_['merge']({},_0x75597c,_0x11a136[_0x7c9b('0x49')]);return _0x39a0df['getContacts'](_0x75597c);}})['then'](respondWithResult(_0x5066ae,null))['catch'](handleError(_0x5066ae,null));};exports[_0x7c9b('0x71')]=function(_0x3ed9ce,_0x2c98f5,_0x5391db){var _0x266b44;return db[_0x7c9b('0x35')]['find']({'where':{'id':_0x3ed9ce['params']['id']},'include':[{'model':db[_0x7c9b('0x72')],'as':_0x7c9b('0x6d')}]})['then'](handleEntityNotFound(_0x2c98f5,null))[_0x7c9b('0x29')](function(_0x369b6c){if(_0x369b6c){_0x266b44=_0x369b6c;return db[_0x7c9b('0x61')][_0x7c9b('0x36')];}})['then'](function(_0x509d13){if(_0x509d13){var _0x20fd55={};var _0x2b8734={};_0x2b8734[_0x7c9b('0x3c')]=_[_0x7c9b('0x6e')](_[_0x7c9b('0x39')](_0x509d13),_['map'](_0x266b44[_0x7c9b('0x6d')],function(_0x475e29){return util[_0x7c9b('0x6f')](_0x7c9b('0x73'),_0x475e29['id']);}));_0x2b8734[_0x7c9b('0x38')]=_['keys'](_0x3ed9ce[_0x7c9b('0x38')]);_0x2b8734[_0x7c9b('0x3a')]=_[_0x7c9b('0x3b')](_0x2b8734[_0x7c9b('0x3c')],_0x2b8734[_0x7c9b('0x38')]);_0x20fd55[_0x7c9b('0x3d')]=_[_0x7c9b('0x3b')](_0x2b8734[_0x7c9b('0x3c')],qs[_0x7c9b('0x3e')](_0x3ed9ce[_0x7c9b('0x38')]['fields']));_0x20fd55[_0x7c9b('0x3d')]=_0x20fd55['attributes'][_0x7c9b('0x3f')]?_0x20fd55['attributes']:_0x2b8734[_0x7c9b('0x3c')];if(!_0x3ed9ce[_0x7c9b('0x38')][_0x7c9b('0x40')](_0x7c9b('0x41'))){_0x20fd55['limit']=qs['limit'](_0x3ed9ce[_0x7c9b('0x38')][_0x7c9b('0x23')]);_0x20fd55[_0x7c9b('0x21')]=qs[_0x7c9b('0x21')](_0x3ed9ce['query'][_0x7c9b('0x21')]);}_0x20fd55[_0x7c9b('0x42')]=qs[_0x7c9b('0x43')](_0x3ed9ce['query'][_0x7c9b('0x43')]);_0x20fd55[_0x7c9b('0x44')]=qs[_0x7c9b('0x3a')](_[_0x7c9b('0x45')](_0x3ed9ce['query'],_0x2b8734[_0x7c9b('0x3a')]));_0x20fd55['raw']=!![];if(_0x3ed9ce[_0x7c9b('0x38')][_0x7c9b('0x48')]){_0x20fd55[_0x7c9b('0x44')]=_[_0x7c9b('0x46')](_0x20fd55['where'],{'$or':_['map'](_0x20fd55[_0x7c9b('0x3d')],function(_0x550f09){var _0x25c419={};_0x25c419[_0x550f09]={'$like':'%'+_0x3ed9ce[_0x7c9b('0x38')][_0x7c9b('0x48')]+'%'};return _0x25c419;})});}_0x20fd55=_[_0x7c9b('0x46')]({},_0x20fd55,_0x3ed9ce[_0x7c9b('0x49')]);return _0x266b44[_0x7c9b('0x74')](_0x20fd55);}})[_0x7c9b('0x29')](function(_0x241007){if(!_[_0x7c9b('0x75')](_0x241007)){var _0x3e8743=toCsv(_0x241007);var _0x36a4b7=Date[_0x7c9b('0x76')]();fs[_0x7c9b('0x77')](util[_0x7c9b('0x6f')](_0x7c9b('0x78'),_0x266b44['id'],_0x36a4b7),_0x3e8743);_0x2c98f5['setHeader']('Content-disposition',_0x7c9b('0x79')+util['format'](_0x7c9b('0x7a'),_0x266b44['id'],_0x36a4b7));_0x2c98f5[_0x7c9b('0x7b')](_0x7c9b('0x7c'),'text/csv');return _0x2c98f5[_0x7c9b('0x7d')](util[_0x7c9b('0x6f')](_0x7c9b('0x78'),_0x266b44['id'],_0x36a4b7));}else{return _0x2c98f5['sendStatus'](0xcc);}})[_0x7c9b('0x4d')](handleError(_0x2c98f5,null));};exports[_0x7c9b('0x7e')]=function(_0x3aa516,_0x1e448b,_0x3c9815){var _0x50084a;delete _0x3aa516[_0x7c9b('0x52')]['id'];return db[_0x7c9b('0x35')][_0x7c9b('0x7f')]({'where':{'id':_0x3aa516[_0x7c9b('0x5a')]['id']}})[_0x7c9b('0x29')](handleEntityNotFound(_0x1e448b,null))[_0x7c9b('0x29')](function(_0x100b97){if(_0x100b97){return db[_0x7c9b('0x80')][_0x7c9b('0x81')](function(_0x522684){return db[_0x7c9b('0x72')][_0x7c9b('0x51')](_0x3aa516[_0x7c9b('0x52')],{'transaction':_0x522684})['then'](function(_0x5747ef){_0x50084a=_0x5747ef;return _0x100b97[_0x7c9b('0x82')](_0x5747ef,{'transaction':_0x522684});})['then'](function(){var _0x5d3378={'type':db['Sequelize'][_0x7c9b('0x83')],'transaction':_0x522684};switch(_0x3aa516['body'][_0x7c9b('0x37')]){case _0x7c9b('0x84'):_0x5d3378[_0x7c9b('0x37')]=db['Sequelize']['TEXT'];break;case _0x7c9b('0x85'):_0x5d3378[_0x7c9b('0x37')]=db[_0x7c9b('0x86')][_0x7c9b('0x87')];break;case'switch':_0x5d3378[_0x7c9b('0x37')]=db[_0x7c9b('0x86')]['BOOLEAN'];_0x5d3378[_0x7c9b('0x88')]=![];break;default:}return db[_0x7c9b('0x80')]['queryInterface'][_0x7c9b('0x89')](_0x7c9b('0x8a'),util['format'](_0x7c9b('0x8b'),_0x50084a['id']),_0x5d3378);})[_0x7c9b('0x29')](function(){return _0x50084a;});});}})[_0x7c9b('0x29')](respondWithResult(_0x1e448b,null))[_0x7c9b('0x4d')](handleError(_0x1e448b,null));};exports['getCustomFields']=function(_0x1eab29,_0x5ed780,_0x477769){var _0x44f1af={};var _0x50b0f1={};var _0x45c7a3;var _0x15289a;return db['CmList'][_0x7c9b('0x7f')]({'where':{'id':_0x1eab29[_0x7c9b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5ed780,null))[_0x7c9b('0x29')](function(_0x317396){if(_0x317396){_0x45c7a3=_0x317396;_0x50b0f1[_0x7c9b('0x3c')]=_[_0x7c9b('0x39')](db[_0x7c9b('0x72')][_0x7c9b('0x36')]);_0x50b0f1['query']=_[_0x7c9b('0x39')](_0x1eab29[_0x7c9b('0x38')]);_0x50b0f1[_0x7c9b('0x3a')]=_[_0x7c9b('0x3b')](_0x50b0f1[_0x7c9b('0x3c')],_0x50b0f1[_0x7c9b('0x38')]);_0x44f1af[_0x7c9b('0x3d')]=_[_0x7c9b('0x3b')](_0x50b0f1[_0x7c9b('0x3c')],qs[_0x7c9b('0x3e')](_0x1eab29['query']['fields']));_0x44f1af['attributes']=_0x44f1af['attributes']['length']?_0x44f1af['attributes']:_0x50b0f1[_0x7c9b('0x3c')];_0x44f1af[_0x7c9b('0x42')]=qs[_0x7c9b('0x43')](_0x1eab29[_0x7c9b('0x38')][_0x7c9b('0x43')]);_0x44f1af[_0x7c9b('0x44')]=qs[_0x7c9b('0x3a')](_[_0x7c9b('0x45')](_0x1eab29[_0x7c9b('0x38')],_0x50b0f1[_0x7c9b('0x3a')]));_0x44f1af['where']=_[_0x7c9b('0x46')](_0x44f1af['where'],{'$or':[{'ListId':_0x317396['id']},{'ListId':null}]});if(_0x1eab29[_0x7c9b('0x38')][_0x7c9b('0x48')]){_0x44f1af['where']=_['merge'](_0x44f1af[_0x7c9b('0x44')],{'$or':_[_0x7c9b('0x34')](_0x44f1af['attributes'],function(_0x4f8551){var _0x5ae582={};_0x5ae582[_0x4f8551]={'$like':'%'+_0x1eab29['query']['filter']+'%'};return _0x5ae582;})});}_0x44f1af=_[_0x7c9b('0x46')]({},_0x44f1af,_0x1eab29[_0x7c9b('0x49')]);return db['CmCustomField'][_0x7c9b('0x8c')](_0x44f1af);}})['then'](respondWithResult(_0x5ed780,null))['catch'](handleError(_0x5ed780,null));};exports[_0x7c9b('0x8d')]=function(_0x3f8696,_0x57e844,_0x34f5a6){return db[_0x7c9b('0x35')]['find']({'where':{'id':_0x3f8696[_0x7c9b('0x5a')]['id']}})[_0x7c9b('0x29')](handleEntityNotFound(_0x57e844,null))[_0x7c9b('0x29')](function(_0x2d5d5c){if(_0x2d5d5c){return _0x2d5d5c[_0x7c9b('0x8d')](_0x3f8696[_0x7c9b('0x52')][_0x7c9b('0x60')],_['omit'](_0x3f8696[_0x7c9b('0x52')],[_0x7c9b('0x60'),'id'])||{})[_0x7c9b('0x8e')](function(_0x509446){for(var _0x21de9c=0x0;_0x21de9c<_0x3f8696['body']['ids'][_0x7c9b('0x3f')];_0x21de9c+=0x1){socket[_0x7c9b('0x8f')](_0x7c9b('0x90'),{'UserId':Number(_0x3f8696['body'][_0x7c9b('0x60')][_0x21de9c]),'CmListId':Number(_0x3f8696[_0x7c9b('0x5a')]['id'])});}return _0x509446;});}})['then'](respondWithResult(_0x57e844,null))['catch'](handleError(_0x57e844,null));};exports[_0x7c9b('0x91')]=function(_0x291a6b,_0x51737c,_0x2d917c){return db[_0x7c9b('0x35')]['find']({'where':{'id':_0x291a6b[_0x7c9b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x51737c,null))[_0x7c9b('0x29')](function(_0x3cb18c){if(_0x3cb18c){return _0x3cb18c[_0x7c9b('0x91')](_0x291a6b['query'][_0x7c9b('0x60')])[_0x7c9b('0x29')](function(){if(_[_0x7c9b('0x64')](_0x291a6b[_0x7c9b('0x38')][_0x7c9b('0x60')])){for(var _0x3773c5=0x0;_0x3773c5<_0x291a6b['query'][_0x7c9b('0x60')][_0x7c9b('0x3f')];_0x3773c5+=0x1){socket[_0x7c9b('0x8f')]('userCmList:remove',{'UserId':Number(_0x291a6b[_0x7c9b('0x38')][_0x7c9b('0x60')][_0x3773c5]),'CmListId':Number(_0x291a6b[_0x7c9b('0x5a')]['id'])});}}else{socket[_0x7c9b('0x8f')](_0x7c9b('0x92'),{'UserId':Number(_0x291a6b[_0x7c9b('0x38')][_0x7c9b('0x60')]),'CmListId':Number(_0x291a6b['params']['id'])});}});}})[_0x7c9b('0x29')](respondWithStatusCode(_0x51737c,null))['catch'](handleError(_0x51737c,null));};exports['getAgents']=function(_0x854e46,_0x48221c,_0x19955e){var _0x49f40e={};var _0xb11b2b={};var _0x59871d;var _0x54486a;return db[_0x7c9b('0x35')][_0x7c9b('0x7f')]({'where':{'id':_0x854e46[_0x7c9b('0x5a')]['id']}})[_0x7c9b('0x29')](handleEntityNotFound(_0x48221c,null))['then'](function(_0xe676a){if(_0xe676a){_0x59871d=_0xe676a;_0xb11b2b[_0x7c9b('0x3c')]=_['keys'](db[_0x7c9b('0x93')][_0x7c9b('0x36')]);_0xb11b2b[_0x7c9b('0x38')]=_[_0x7c9b('0x39')](_0x854e46[_0x7c9b('0x38')]);_0xb11b2b[_0x7c9b('0x3a')]=_[_0x7c9b('0x3b')](_0xb11b2b[_0x7c9b('0x3c')],_0xb11b2b[_0x7c9b('0x38')]);_0x49f40e[_0x7c9b('0x3d')]=_[_0x7c9b('0x3b')](_0xb11b2b[_0x7c9b('0x3c')],qs[_0x7c9b('0x3e')](_0x854e46[_0x7c9b('0x38')][_0x7c9b('0x3e')]));_0x49f40e[_0x7c9b('0x3d')]=_0x49f40e['attributes'][_0x7c9b('0x3f')]?_0x49f40e['attributes']:_0xb11b2b[_0x7c9b('0x3c')];_0x49f40e['order']=qs[_0x7c9b('0x43')](_0x854e46['query'][_0x7c9b('0x43')]);_0x49f40e[_0x7c9b('0x44')]=qs[_0x7c9b('0x3a')](_[_0x7c9b('0x45')](_0x854e46[_0x7c9b('0x38')],_0xb11b2b['filters']));if(_0x854e46[_0x7c9b('0x38')][_0x7c9b('0x48')]){_0x49f40e[_0x7c9b('0x44')]=_['merge'](_0x49f40e['where'],{'$or':_['map'](_0x49f40e[_0x7c9b('0x3d')],function(_0x37e5e1){var _0x5e4f7b={};_0x5e4f7b[_0x37e5e1]={'$like':'%'+_0x854e46[_0x7c9b('0x38')]['filter']+'%'};return _0x5e4f7b;})});}_0x49f40e=_['merge']({},_0x49f40e,_0x854e46[_0x7c9b('0x49')]);return _0x59871d['getAgents'](_0x49f40e);}})[_0x7c9b('0x29')](function(_0x2f7aaf){if(_0x2f7aaf){_0x54486a=_0x2f7aaf[_0x7c9b('0x3f')];if(!_0x854e46[_0x7c9b('0x38')][_0x7c9b('0x40')](_0x7c9b('0x41'))){_0x49f40e[_0x7c9b('0x23')]=qs['limit'](_0x854e46[_0x7c9b('0x38')][_0x7c9b('0x23')]);_0x49f40e[_0x7c9b('0x21')]=qs[_0x7c9b('0x21')](_0x854e46['query'][_0x7c9b('0x21')]);}return _0x59871d[_0x7c9b('0x94')](_0x49f40e);}})['then'](function(_0x128123){if(_0x128123){return _0x128123?{'count':_0x54486a,'rows':_0x128123}:null;}})[_0x7c9b('0x29')](respondWithResult(_0x48221c,null))['catch'](handleError(_0x48221c,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 7b45db0..14ae166 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x18bcb6,_0x2d14d4){_0x18bcb6=_0x18bcb6-0x0;var _0x36ef76=_0x3e74[_0x18bcb6];return _0x36ef76;};'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(_0x3721e4,_0x503db5){_0x3721e4=_0x3721e4-0x0;var _0x1af848=_0x3e74[_0x3721e4];return _0x1af848;};'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 7c78939..7daa8ba 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 _0x153f=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmList.attributes','exports','define','cm_lists','lodash'];(function(_0x20de8b,_0x43396a){var _0x39baf7=function(_0x189f55){while(--_0x189f55){_0x20de8b['push'](_0x20de8b['shift']());}};_0x39baf7(++_0x43396a);}(_0x153f,0x15b));var _0xf153=function(_0x132dff,_0x429e39){_0x132dff=_0x132dff-0x0;var _0x2af58c=_0x153f[_0x132dff];return _0x2af58c;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var logger=require(_0xf153('0x2'))(_0xf153('0x3'));var moment=require(_0xf153('0x4'));var BPromise=require(_0xf153('0x5'));var rp=require(_0xf153('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf153('0x7'));var config=require('../../config/environment');var attributes=require(_0xf153('0x8'));module[_0xf153('0x9')]=function(_0x342a45,_0xafd987){return _0x342a45[_0xf153('0xa')]('CmList',attributes,{'tableName':_0xf153('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f7a=['CmList','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x5c02e1,_0x340095){_0x5c02e1=_0x5c02e1-0x0;var _0x4cc4f8=_0x6f7a[_0x5c02e1];return _0x4cc4f8;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var logger=require(_0xa6f7('0x2'))(_0xa6f7('0x3'));var moment=require('moment');var BPromise=require(_0xa6f7('0x4'));var rp=require(_0xa6f7('0x5'));var fs=require('fs');var path=require(_0xa6f7('0x6'));var rimraf=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var attributes=require(_0xa6f7('0x9'));module[_0xa6f7('0xa')]=function(_0x20cccd,_0x1fdd5f){return _0x20cccd[_0xa6f7('0xb')](_0xa6f7('0xc'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 976e4fd..0fbcd96 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 _0x7e80=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','then','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x25a64c,_0x369397){var _0x805c4c=function(_0xbf7cc){while(--_0xbf7cc){_0x25a64c['push'](_0x25a64c['shift']());}};_0x805c4c(++_0x369397);}(_0x7e80,0x166));var _0x07e8=function(_0x8c0bf5,_0x2456ab){_0x8c0bf5=_0x8c0bf5-0x0;var _0x447387=_0x7e80[_0x8c0bf5];return _0x447387;};'use strict';var _=require(_0x07e8('0x0'));var util=require(_0x07e8('0x1'));var moment=require(_0x07e8('0x2'));var BPromise=require(_0x07e8('0x3'));var rs=require(_0x07e8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07e8('0x5'))['db'];var utils=require(_0x07e8('0x6'));var logger=require(_0x07e8('0x7'))(_0x07e8('0x8'));var config=require(_0x07e8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x07e8('0xa')][_0x07e8('0xb')]({'port':0x232a});config[_0x07e8('0xc')]=_[_0x07e8('0xd')](config[_0x07e8('0xc')],{'host':_0x07e8('0xe'),'port':0x18eb});var socket=require(_0x07e8('0xf'))(new Redis(config[_0x07e8('0xc')]));require(_0x07e8('0x10'))[_0x07e8('0x11')](socket);function respondWithRpcPromise(_0x4a8bcc,_0x245721,_0x1a695f){return new BPromise(function(_0x34237a,_0x5c09c6){return client['request'](_0x4a8bcc,_0x1a695f)[_0x07e8('0x12')](function(_0x11c92d){logger['info'](_0x07e8('0x13'),_0x245721,_0x07e8('0x14'));logger[_0x07e8('0x15')]('CmList,\x20%s,\x20%s,\x20%s',_0x245721,_0x07e8('0x14'),JSON[_0x07e8('0x16')](_0x11c92d));if(_0x11c92d['error']){if(_0x11c92d[_0x07e8('0x17')]['code']===0x1f4){logger[_0x07e8('0x17')](_0x07e8('0x13'),_0x245721,_0x11c92d[_0x07e8('0x17')][_0x07e8('0x18')]);return _0x5c09c6(_0x11c92d['error'][_0x07e8('0x18')]);}logger[_0x07e8('0x17')]('CmList,\x20%s,\x20%s',_0x245721,_0x11c92d['error'][_0x07e8('0x18')]);return _0x34237a(_0x11c92d[_0x07e8('0x17')]['message']);}else{logger['info'](_0x07e8('0x13'),_0x245721,'request\x20sent');_0x34237a(_0x11c92d[_0x07e8('0x19')][_0x07e8('0x18')]);}})['catch'](function(_0x2540ee){logger[_0x07e8('0x17')](_0x07e8('0x13'),_0x245721,_0x2540ee);_0x5c09c6(_0x2540ee);});});} \ No newline at end of file +var _0x1aeb=['then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request'];(function(_0x11b891,_0x48ead1){var _0x1ca79f=function(_0x11b381){while(--_0x11b381){_0x11b891['push'](_0x11b891['shift']());}};_0x1ca79f(++_0x48ead1);}(_0x1aeb,0x12d));var _0xb1ae=function(_0x357b7e,_0x2c32c3){_0x357b7e=_0x357b7e-0x0;var _0x36d375=_0x1aeb[_0x357b7e];return _0x36d375;};'use strict';var _=require(_0xb1ae('0x0'));var util=require(_0xb1ae('0x1'));var moment=require(_0xb1ae('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1ae('0x3'));var fs=require('fs');var Redis=require(_0xb1ae('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1ae('0x5'));var logger=require(_0xb1ae('0x6'))(_0xb1ae('0x7'));var config=require(_0xb1ae('0x8'));var jayson=require(_0xb1ae('0x9'));var client=jayson[_0xb1ae('0xa')]['http']({'port':0x232a});config[_0xb1ae('0xb')]=_[_0xb1ae('0xc')](config[_0xb1ae('0xb')],{'host':_0xb1ae('0xd'),'port':0x18eb});var socket=require(_0xb1ae('0xe'))(new Redis(config[_0xb1ae('0xb')]));require(_0xb1ae('0xf'))[_0xb1ae('0x10')](socket);function respondWithRpcPromise(_0x25fc1a,_0x48b4e0,_0x32cb8c){return new BPromise(function(_0x417450,_0x5df97b){return client[_0xb1ae('0x11')](_0x25fc1a,_0x32cb8c)[_0xb1ae('0x12')](function(_0x5f49df){logger[_0xb1ae('0x13')](_0xb1ae('0x14'),_0x48b4e0,_0xb1ae('0x15'));logger[_0xb1ae('0x16')](_0xb1ae('0x17'),_0x48b4e0,_0xb1ae('0x15'),JSON[_0xb1ae('0x18')](_0x5f49df));if(_0x5f49df[_0xb1ae('0x19')]){if(_0x5f49df['error'][_0xb1ae('0x1a')]===0x1f4){logger[_0xb1ae('0x19')]('CmList,\x20%s,\x20%s',_0x48b4e0,_0x5f49df[_0xb1ae('0x19')]['message']);return _0x5df97b(_0x5f49df[_0xb1ae('0x19')][_0xb1ae('0x1b')]);}logger['error'](_0xb1ae('0x14'),_0x48b4e0,_0x5f49df[_0xb1ae('0x19')]['message']);return _0x417450(_0x5f49df[_0xb1ae('0x19')][_0xb1ae('0x1b')]);}else{logger['info'](_0xb1ae('0x14'),_0x48b4e0,_0xb1ae('0x15'));_0x417450(_0x5f49df[_0xb1ae('0x1c')]['message']);}})['catch'](function(_0x1141cd){logger[_0xb1ae('0x19')](_0xb1ae('0x14'),_0x48b4e0,_0x1141cd);_0x5df97b(_0x1141cd);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index bf8fe07..219da11 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 _0x84f9=['save','remove','update','removeListener','register','length','cmList:','./cmList.events'];(function(_0x3b8d27,_0x2e826c){var _0x7a0055=function(_0x74739c){while(--_0x74739c){_0x3b8d27['push'](_0x3b8d27['shift']());}};_0x7a0055(++_0x2e826c);}(_0x84f9,0xb7));var _0x984f=function(_0xeb38f5,_0x3075ba){_0xeb38f5=_0xeb38f5-0x0;var _0x143a22=_0x84f9[_0xeb38f5];return _0x143a22;};'use strict';var CmListEvents=require(_0x984f('0x0'));var events=[_0x984f('0x1'),_0x984f('0x2'),_0x984f('0x3')];function createListener(_0x7a7b63,_0x3ef9b1){return function(_0x4da3fb){_0x3ef9b1['emit'](_0x7a7b63,_0x4da3fb);};}function removeListener(_0x1f9251,_0x5dd9d0){return function(){CmListEvents[_0x984f('0x4')](_0x1f9251,_0x5dd9d0);};}exports[_0x984f('0x5')]=function(_0x4ed40a){for(var _0x3d88a1=0x0,_0xb0fc7c=events[_0x984f('0x6')];_0x3d88a1<_0xb0fc7c;_0x3d88a1++){var _0x345028=events[_0x3d88a1];var _0x53e936=createListener(_0x984f('0x7')+_0x345028,_0x4ed40a);CmListEvents['on'](_0x345028,_0x53e936);}}; \ No newline at end of file +var _0x1c1d=['remove','update','emit','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x35a184,_0x1f2b6c){var _0x38b840=function(_0xdee95a){while(--_0xdee95a){_0x35a184['push'](_0x35a184['shift']());}};_0x38b840(++_0x1f2b6c);}(_0x1c1d,0x97));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var CmListEvents=require(_0xd1c1('0x0'));var events=[_0xd1c1('0x1'),_0xd1c1('0x2'),_0xd1c1('0x3')];function createListener(_0x215966,_0x2f2d90){return function(_0x28f4af){_0x2f2d90[_0xd1c1('0x4')](_0x215966,_0x28f4af);};}function removeListener(_0x4395ee,_0x415984){return function(){CmListEvents[_0xd1c1('0x5')](_0x4395ee,_0x415984);};}exports[_0xd1c1('0x6')]=function(_0x33d4af){for(var _0x5d627f=0x0,_0x1c1cd7=events[_0xd1c1('0x7')];_0x5d627f<_0x1c1cd7;_0x5d627f++){var _0x5ce064=events[_0x5d627f];var _0x3949a0=createListener(_0xd1c1('0x8')+_0x5ce064,_0x33d4af);CmListEvents['on'](_0x5ce064,_0x3949a0);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 46b8774..6d183f0 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 _0x481d=['getAgents','post','addDisposition','/:id/contacts','addContacts','/:id/users','put','/:id','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getContacts','getContactsCsv','/:id/fields'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x481d,0x81));var _0xd481=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x481d[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xd481('0x0'));var util=require(_0xd481('0x1'));var path=require('path');var timeout=require(_0xd481('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd481('0x3'));var interaction=require(_0xd481('0x4'));var config=require(_0xd481('0x5'));var controller=require(_0xd481('0x6'));router[_0xd481('0x7')]('/',auth[_0xd481('0x8')](),controller[_0xd481('0x9')]);router[_0xd481('0x7')]('/describe',auth[_0xd481('0x8')](),controller[_0xd481('0xa')]);router[_0xd481('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd481('0xb')]);router[_0xd481('0x7')](_0xd481('0xc'),auth[_0xd481('0x8')](),controller['getDispositions']);router[_0xd481('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xd481('0xd')]);router[_0xd481('0x7')]('/:id/contacts/csv',auth[_0xd481('0x8')](),controller[_0xd481('0xe')]);router[_0xd481('0x7')](_0xd481('0xf'),auth[_0xd481('0x8')](),controller['getCustomFields']);router['get']('/:id/users',auth[_0xd481('0x8')](),controller[_0xd481('0x10')]);router[_0xd481('0x11')]('/',auth[_0xd481('0x8')](),controller['create']);router[_0xd481('0x11')](_0xd481('0xc'),auth[_0xd481('0x8')](),controller[_0xd481('0x12')]);router[_0xd481('0x11')](_0xd481('0x13'),auth[_0xd481('0x8')](),controller[_0xd481('0x14')]);router[_0xd481('0x11')]('/:id/fields',auth[_0xd481('0x8')](),controller['addCustomField']);router[_0xd481('0x11')](_0xd481('0x15'),auth[_0xd481('0x8')](),controller['addAgents']);router[_0xd481('0x16')](_0xd481('0x17'),auth[_0xd481('0x8')](),controller[_0xd481('0x18')]);router[_0xd481('0x19')](_0xd481('0x17'),auth[_0xd481('0x8')](),controller[_0xd481('0x1a')]);router['delete'](_0xd481('0xc'),auth[_0xd481('0x8')](),controller['removeDispositions']);router[_0xd481('0x19')](_0xd481('0x15'),auth['isAuthenticated'](),controller[_0xd481('0x1b')]);module[_0xd481('0x1c')]=router; \ No newline at end of file +var _0x181c=['getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields'];(function(_0x1b0289,_0x4bdfb8){var _0x3ac457=function(_0x554ae2){while(--_0x554ae2){_0x1b0289['push'](_0x1b0289['shift']());}};_0x3ac457(++_0x4bdfb8);}(_0x181c,0x14b));var _0xc181=function(_0x4492af,_0x47e25d){_0x4492af=_0x4492af-0x0;var _0x216729=_0x181c[_0x4492af];return _0x216729;};'use strict';var multer=require(_0xc181('0x0'));var util=require(_0xc181('0x1'));var path=require(_0xc181('0x2'));var timeout=require(_0xc181('0x3'));var express=require(_0xc181('0x4'));var router=express['Router']();var fs_extra=require(_0xc181('0x5'));var auth=require(_0xc181('0x6'));var interaction=require(_0xc181('0x7'));var config=require(_0xc181('0x8'));var controller=require('./cmList.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc181('0x9')](_0xc181('0xa'),auth['isAuthenticated'](),controller[_0xc181('0xb')]);router[_0xc181('0x9')](_0xc181('0xc'),auth[_0xc181('0xd')](),controller['show']);router[_0xc181('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc181('0xe')]);router[_0xc181('0x9')](_0xc181('0xf'),auth['isAuthenticated'](),controller['getContacts']);router[_0xc181('0x9')](_0xc181('0x10'),auth[_0xc181('0xd')](),controller[_0xc181('0x11')]);router[_0xc181('0x9')](_0xc181('0x12'),auth[_0xc181('0xd')](),controller[_0xc181('0x13')]);router[_0xc181('0x9')](_0xc181('0x14'),auth['isAuthenticated'](),controller[_0xc181('0x15')]);router[_0xc181('0x16')]('/',auth[_0xc181('0xd')](),controller[_0xc181('0x17')]);router[_0xc181('0x16')](_0xc181('0x18'),auth[_0xc181('0xd')](),controller[_0xc181('0x19')]);router[_0xc181('0x16')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xc181('0x1a')]);router[_0xc181('0x16')](_0xc181('0x12'),auth[_0xc181('0xd')](),controller[_0xc181('0x1b')]);router[_0xc181('0x16')](_0xc181('0x14'),auth[_0xc181('0xd')](),controller[_0xc181('0x1c')]);router[_0xc181('0x1d')](_0xc181('0xc'),auth[_0xc181('0xd')](),controller[_0xc181('0x1e')]);router[_0xc181('0x1f')](_0xc181('0xc'),auth[_0xc181('0xd')](),controller['destroy']);router[_0xc181('0x1f')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc181('0x20')]);router['delete']('/:id/users',auth[_0xc181('0xd')](),controller[_0xc181('0x21')]);module[_0xc181('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 3fa5915..8d9b6ea 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 _0x1bdf=['field','STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x3c618b,_0x159f66){var _0xe8b501=function(_0x1370dc){while(--_0x1370dc){_0x3c618b['push'](_0x3c618b['shift']());}};_0xe8b501(++_0x159f66);}(_0x1bdf,0x152));var _0xf1bd=function(_0x583ddf,_0x3bc3ad){_0x583ddf=_0x583ddf-0x0;var _0x42763c=_0x1bdf[_0x583ddf];return _0x42763c;};'use strict';var Sequelize=require(_0xf1bd('0x0'));module[_0xf1bd('0x1')]={'name':{'type':Sequelize[_0xf1bd('0x2')],'get':function(_0x27e957){return this[_0xf1bd('0x3')](_0xf1bd('0x4'));}},'field':{'type':Sequelize[_0xf1bd('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xf1bd('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0xb6a5=['VIRTUAL','STRING','sequelize'];(function(_0x36ed79,_0x2d27b2){var _0x4dbe28=function(_0x2651d5){while(--_0x2651d5){_0x36ed79['push'](_0x36ed79['shift']());}};_0x4dbe28(++_0x2d27b2);}(_0xb6a5,0xb0));var _0x5b6a=function(_0xbd04d0,_0x476366){_0xbd04d0=_0xbd04d0-0x0;var _0x1bb9c4=_0xb6a5[_0xbd04d0];return _0x1bb9c4;};'use strict';var Sequelize=require(_0x5b6a('0x0'));module['exports']={'name':{'type':Sequelize[_0x5b6a('0x1')],'get':function(_0x4304bd){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x5b6a('0x2')],'allowNull':![]},'operator':{'type':Sequelize[_0x5b6a('0x2')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 459afed..62d3d97 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(_0x4262a4,_0x4c53ff){var _0x529b08=function(_0x136d1d){while(--_0x136d1d){_0x4262a4['push'](_0x4262a4['shift']());}};_0x529b08(++_0x4c53ff);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x1eb3f3,_0x3072b3){var _0x255df1=function(_0x26aa65){while(--_0x26aa65){_0x1eb3f3['push'](_0x1eb3f3['shift']());}};_0x255df1(++_0x3072b3);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index b501e22..7ef9ba9 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 _0x3915=['../../config/environment','./condition.attributes','exports','define','Condition','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x3915,0x164));var _0x5391=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0x3915[_0x33ebf5];return _0x66957b;};'use strict';var _=require(_0x5391('0x0'));var util=require(_0x5391('0x1'));var logger=require(_0x5391('0x2'))(_0x5391('0x3'));var moment=require(_0x5391('0x4'));var BPromise=require(_0x5391('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5391('0x6'));var rimraf=require(_0x5391('0x7'));var config=require(_0x5391('0x8'));var attributes=require(_0x5391('0x9'));module[_0x5391('0xa')]=function(_0x4ad6a2,_0x46c14a){return _0x4ad6a2[_0x5391('0xb')](_0x5391('0xc'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3827=['tools_conditions','../../config/logger','moment','bluebird','path','../../config/environment','./condition.attributes'];(function(_0x5bf35e,_0x4ccc17){var _0x35b3d7=function(_0xefa9e4){while(--_0xefa9e4){_0x5bf35e['push'](_0x5bf35e['shift']());}};_0x35b3d7(++_0x4ccc17);}(_0x3827,0xa2));var _0x7382=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x3827[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7382('0x0'))('api');var moment=require(_0x7382('0x1'));var BPromise=require(_0x7382('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7382('0x3'));var rimraf=require('rimraf');var config=require(_0x7382('0x4'));var attributes=require(_0x7382('0x5'));module['exports']=function(_0x271887,_0x1d6225){return _0x271887['define']('Condition',attributes,{'tableName':_0x7382('0x6'),'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 5447552..264def5 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 _0x33d3=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3c4013,_0x35e8a4){var _0x31f17c=function(_0x4ad5a2){while(--_0x4ad5a2){_0x3c4013['push'](_0x3c4013['shift']());}};_0x31f17c(++_0x35e8a4);}(_0x33d3,0x16c));var _0x333d=function(_0xe38764,_0x28ce79){_0xe38764=_0xe38764-0x0;var _0x5979cf=_0x33d3[_0xe38764];return _0x5979cf;};'use strict';var _=require('lodash');var util=require(_0x333d('0x0'));var moment=require(_0x333d('0x1'));var BPromise=require(_0x333d('0x2'));var rs=require(_0x333d('0x3'));var fs=require('fs');var Redis=require(_0x333d('0x4'));var db=require(_0x333d('0x5'))['db'];var utils=require(_0x333d('0x6'));var logger=require(_0x333d('0x7'))('rpc');var config=require(_0x333d('0x8'));var jayson=require(_0x333d('0x9'));var client=jayson[_0x333d('0xa')][_0x333d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33f4e1,_0x2c840f,_0x2d2696){return new BPromise(function(_0x457418,_0x58573f){return client[_0x333d('0xc')](_0x33f4e1,_0x2d2696)[_0x333d('0xd')](function(_0xfbbfef){logger[_0x333d('0xe')](_0x333d('0xf'),_0x2c840f,_0x333d('0x10'));logger[_0x333d('0x11')]('Condition,\x20%s,\x20%s,\x20%s',_0x2c840f,'request\x20sent',JSON[_0x333d('0x12')](_0xfbbfef));if(_0xfbbfef[_0x333d('0x13')]){if(_0xfbbfef[_0x333d('0x13')][_0x333d('0x14')]===0x1f4){logger[_0x333d('0x13')]('Condition,\x20%s,\x20%s',_0x2c840f,_0xfbbfef[_0x333d('0x13')][_0x333d('0x15')]);return _0x58573f(_0xfbbfef[_0x333d('0x13')][_0x333d('0x15')]);}logger['error']('Condition,\x20%s,\x20%s',_0x2c840f,_0xfbbfef[_0x333d('0x13')][_0x333d('0x15')]);return _0x457418(_0xfbbfef['error'][_0x333d('0x15')]);}else{logger['info'](_0x333d('0xf'),_0x2c840f,_0x333d('0x10'));_0x457418(_0xfbbfef[_0x333d('0x16')][_0x333d('0x15')]);}})[_0x333d('0x17')](function(_0x115239){logger[_0x333d('0x13')](_0x333d('0xf'),_0x2c840f,_0x115239);_0x58573f(_0x115239);});});} \ No newline at end of file +var _0xeecc=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Condition,\x20%s,\x20%s','catch','util','moment','bluebird'];(function(_0x5aa9e2,_0x23eb0a){var _0x278b16=function(_0x4b84a0){while(--_0x4b84a0){_0x5aa9e2['push'](_0x5aa9e2['shift']());}};_0x278b16(++_0x23eb0a);}(_0xeecc,0x1b2));var _0xceec=function(_0x597a70,_0x21be6a){_0x597a70=_0x597a70-0x0;var _0xa0e7cb=_0xeecc[_0x597a70];return _0xa0e7cb;};'use strict';var _=require('lodash');var util=require(_0xceec('0x0'));var moment=require(_0xceec('0x1'));var BPromise=require(_0xceec('0x2'));var rs=require(_0xceec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xceec('0x4'))['db'];var utils=require(_0xceec('0x5'));var logger=require(_0xceec('0x6'))(_0xceec('0x7'));var config=require(_0xceec('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xef942c,_0x5a2de9,_0x8aac2d){return new BPromise(function(_0x44535d,_0x185a08){return client[_0xceec('0x9')](_0xef942c,_0x8aac2d)['then'](function(_0x3bcfa4){logger[_0xceec('0xa')]('Condition,\x20%s,\x20%s',_0x5a2de9,'request\x20sent');logger['debug'](_0xceec('0xb'),_0x5a2de9,_0xceec('0xc'),JSON[_0xceec('0xd')](_0x3bcfa4));if(_0x3bcfa4[_0xceec('0xe')]){if(_0x3bcfa4[_0xceec('0xe')][_0xceec('0xf')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x5a2de9,_0x3bcfa4[_0xceec('0xe')][_0xceec('0x10')]);return _0x185a08(_0x3bcfa4[_0xceec('0xe')]['message']);}logger[_0xceec('0xe')](_0xceec('0x11'),_0x5a2de9,_0x3bcfa4[_0xceec('0xe')][_0xceec('0x10')]);return _0x44535d(_0x3bcfa4['error'][_0xceec('0x10')]);}else{logger[_0xceec('0xa')]('Condition,\x20%s,\x20%s',_0x5a2de9,'request\x20sent');_0x44535d(_0x3bcfa4['result'][_0xceec('0x10')]);}})[_0xceec('0x12')](function(_0x49090){logger[_0xceec('0xe')](_0xceec('0x11'),_0x5a2de9,_0x49090);_0x185a08(_0x49090);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 3a38d80..103da50 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 _0x524b=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy'];(function(_0x1be107,_0x3c59a0){var _0x3ed438=function(_0x5a7e0c){while(--_0x5a7e0c){_0x1be107['push'](_0x1be107['shift']());}};_0x3ed438(++_0x3c59a0);}(_0x524b,0x15f));var _0xb524=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x524b[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require(_0xb524('0x0'));var util=require('util');var path=require(_0xb524('0x1'));var timeout=require('connect-timeout');var express=require(_0xb524('0x2'));var router=express[_0xb524('0x3')]();var fs_extra=require(_0xb524('0x4'));var auth=require(_0xb524('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb524('0x6'));var controller=require(_0xb524('0x7'));router[_0xb524('0x8')](_0xb524('0x9'),auth[_0xb524('0xa')](),controller['update']);router[_0xb524('0xb')]('/:id',auth[_0xb524('0xa')](),controller[_0xb524('0xc')]);module[_0xb524('0xd')]=router; \ No newline at end of file +var _0xd604=['update','delete','/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./condition.controller','put','isAuthenticated'];(function(_0x58d438,_0x2b6991){var _0xf617d6=function(_0x530ead){while(--_0x530ead){_0x58d438['push'](_0x58d438['shift']());}};_0xf617d6(++_0x2b6991);}(_0xd604,0x91));var _0x4d60=function(_0x9cca21,_0xaee881){_0x9cca21=_0x9cca21-0x0;var _0x27ddbf=_0xd604[_0x9cca21];return _0x27ddbf;};'use strict';var multer=require(_0x4d60('0x0'));var util=require('util');var path=require(_0x4d60('0x1'));var timeout=require(_0x4d60('0x2'));var express=require('express');var router=express[_0x4d60('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4d60('0x4'));var interaction=require(_0x4d60('0x5'));var config=require('../../config/environment');var controller=require(_0x4d60('0x6'));router[_0x4d60('0x7')]('/:id',auth[_0x4d60('0x8')](),controller[_0x4d60('0x9')]);router[_0x4d60('0xa')](_0x4d60('0xb'),auth['isAuthenticated'](),controller[_0x4d60('0xc')]);module[_0x4d60('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 44d9004..2cd311a 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x1eda5b,_0x4d2cce){var _0x393f38=function(_0x3adc42){while(--_0x3adc42){_0x1eda5b['push'](_0x1eda5b['shift']());}};_0x393f38(++_0x4d2cce);}(_0x757a,0xde));var _0xa757=function(_0x2bb71f,_0x2dc754){_0x2bb71f=_0x2bb71f-0x0;var _0x932bd8=_0x757a[_0x2bb71f];return _0x932bd8;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x1913bd,_0x1d54d9){var _0x433dfe=function(_0x192671){while(--_0x192671){_0x1913bd['push'](_0x1913bd['shift']());}};_0x433dfe(++_0x1d54d9);}(_0x757a,0xde));var _0xa757=function(_0x252722,_0x224b87){_0x252722=_0x252722-0x0;var _0x1cc2cb=_0x757a[_0x252722];return _0x1cc2cb;};'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 83fedf3..f9206e9 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 _0x3bfa=['updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','iframe','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','pick','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','CustomDashboards','error','send','index','Dashboard','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','VIRTUAL','name','filter','merge','options','includeAll','rows','catch','show','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','omit','createdAt'];(function(_0x10a9f4,_0x528a84){var _0x49860a=function(_0x1a2966){while(--_0x1a2966){_0x10a9f4['push'](_0x10a9f4['shift']());}};_0x49860a(++_0x528a84);}(_0x3bfa,0x1f1));var _0xa3bf=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x3bfa[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0xa3bf('0x0'));var rimraf=require(_0xa3bf('0x1'));var zipdir=require(_0xa3bf('0x2'));var jsonpatch=require(_0xa3bf('0x3'));var rp=require(_0xa3bf('0x4'));var moment=require('moment');var BPromise=require(_0xa3bf('0x5'));var Mustache=require(_0xa3bf('0x6'));var util=require(_0xa3bf('0x7'));var path=require(_0xa3bf('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa3bf('0x9'));var squel=require(_0xa3bf('0xa'));var crypto=require(_0xa3bf('0xb'));var jsforce=require(_0xa3bf('0xc'));var deskjs=require(_0xa3bf('0xd'));var toCsv=require(_0xa3bf('0xe'));var querystring=require(_0xa3bf('0xf'));var Papa=require('papaparse');var Redis=require(_0xa3bf('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3bf('0x11'));var logger=require(_0xa3bf('0x12'))('api');var utils=require(_0xa3bf('0x13'));var config=require(_0xa3bf('0x14'));var licenseUtil=require(_0xa3bf('0x15'));var db=require(_0xa3bf('0x16'))['db'];config['redis']=_['defaults'](config[_0xa3bf('0x17')],{'host':_0xa3bf('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3bf('0x17')]));require('./dashboard.socket')[_0xa3bf('0x19')](socket);function respondWithStatusCode(_0x40c0e4,_0x11e29e){_0x11e29e=_0x11e29e||0xcc;return function(_0x13369d){if(_0x13369d){return _0x40c0e4[_0xa3bf('0x1a')](_0x11e29e);}return _0x40c0e4[_0xa3bf('0x1b')](_0x11e29e)[_0xa3bf('0x1c')]();};}function respondWithResult(_0x30f879,_0xbef54c){_0xbef54c=_0xbef54c||0xc8;return function(_0x28ca71){if(_0x28ca71){return _0x30f879[_0xa3bf('0x1b')](_0xbef54c)[_0xa3bf('0x1d')](_0x28ca71);}};}function respondWithFilteredResult(_0x499f34,_0xf93c49){return function(_0x2544ac){if(_0x2544ac){var _0x32f075=typeof _0xf93c49[_0xa3bf('0x1e')]==='undefined'&&typeof _0xf93c49[_0xa3bf('0x1f')]===_0xa3bf('0x20');var _0x3a5b34=_0x2544ac[_0xa3bf('0x21')];var _0x3901a5=_0x32f075?0x0:_0xf93c49[_0xa3bf('0x1e')];var _0x7efcce=_0x32f075?_0x2544ac[_0xa3bf('0x21')]:_0xf93c49[_0xa3bf('0x1e')]+_0xf93c49[_0xa3bf('0x1f')];var _0x70f03e;if(_0x7efcce>=_0x3a5b34){_0x7efcce=_0x3a5b34;_0x70f03e=0xc8;}else{_0x70f03e=0xce;}_0x499f34[_0xa3bf('0x1b')](_0x70f03e);return _0x499f34[_0xa3bf('0x22')]('Content-Range',_0x3901a5+'-'+_0x7efcce+'/'+_0x3a5b34)[_0xa3bf('0x1d')](_0x2544ac);}return null;};}function patchUpdates(_0xc0e3fa){return function(_0x5baea0){try{jsonpatch[_0xa3bf('0x23')](_0x5baea0,_0xc0e3fa,!![]);}catch(_0x15175e){return BPromise[_0xa3bf('0x24')](_0x15175e);}return _0x5baea0[_0xa3bf('0x25')]();};}function saveUpdates(_0x59d2e9,_0x192f4b){return function(_0xc61165){if(_0xc61165){return _0xc61165[_0xa3bf('0x26')](_0x59d2e9)[_0xa3bf('0x27')](function(_0x4e8fa0){return _0x4e8fa0;});}return null;};}function removeEntity(_0x2c4a56,_0x53a793){return function(_0x5c16cd){if(_0x5c16cd){return _0x5c16cd[_0xa3bf('0x28')]()['then'](function(){var _0x45ee53=_0x5c16cd[_0xa3bf('0x29')]({'plain':!![]});var _0x2eba17=_0xa3bf('0x2a');return db['UserProfileResource'][_0xa3bf('0x28')]({'where':{'type':_0x2eba17,'resourceId':_0x45ee53['id']}})[_0xa3bf('0x27')](function(){return _0x5c16cd;});})['then'](function(){_0x2c4a56[_0xa3bf('0x1b')](0xcc)[_0xa3bf('0x1c')]();});}};}function handleEntityNotFound(_0x5cfc1a,_0x57eb98){return function(_0x44dd58){if(!_0x44dd58){_0x5cfc1a[_0xa3bf('0x1a')](0x194);}return _0x44dd58;};}function handleError(_0x13bc7f,_0x27df46){_0x27df46=_0x27df46||0x1f4;return function(_0x54ee01){logger[_0xa3bf('0x2b')](_0x54ee01['stack']);if(_0x54ee01['name']){delete _0x54ee01['name'];}_0x13bc7f['status'](_0x27df46)[_0xa3bf('0x2c')](_0x54ee01);};}exports[_0xa3bf('0x2d')]=function(_0x1d2719,_0x40023a){var _0x1b05d2={},_0xe31d27={},_0x234475={'count':0x0,'rows':[]};var _0x5e25f4=_['map'](db[_0xa3bf('0x2e')][_0xa3bf('0x2f')],function(_0x77a93c){return{'name':_0x77a93c['fieldName'],'type':_0x77a93c[_0xa3bf('0x30')][_0xa3bf('0x31')]};});_0xe31d27[_0xa3bf('0x32')]=_[_0xa3bf('0x33')](_0x5e25f4,'name');_0xe31d27[_0xa3bf('0x34')]=_[_0xa3bf('0x35')](_0x1d2719[_0xa3bf('0x34')]);_0xe31d27[_0xa3bf('0x36')]=_[_0xa3bf('0x37')](_0xe31d27[_0xa3bf('0x32')],_0xe31d27[_0xa3bf('0x34')]);_0x1b05d2[_0xa3bf('0x38')]=_[_0xa3bf('0x37')](_0xe31d27[_0xa3bf('0x32')],qs[_0xa3bf('0x39')](_0x1d2719['query'][_0xa3bf('0x39')]));_0x1b05d2['attributes']=_0x1b05d2[_0xa3bf('0x38')][_0xa3bf('0x3a')]?_0x1b05d2['attributes']:_0xe31d27[_0xa3bf('0x32')];if(!_0x1d2719['query']['hasOwnProperty']('nolimit')){_0x1b05d2['limit']=qs[_0xa3bf('0x1f')](_0x1d2719[_0xa3bf('0x34')]['limit']);_0x1b05d2['offset']=qs[_0xa3bf('0x1e')](_0x1d2719[_0xa3bf('0x34')][_0xa3bf('0x1e')]);}_0x1b05d2[_0xa3bf('0x3b')]=qs[_0xa3bf('0x3c')](_0x1d2719[_0xa3bf('0x34')][_0xa3bf('0x3c')]);_0x1b05d2['where']=qs['filters'](_['pick'](_0x1d2719[_0xa3bf('0x34')],_0xe31d27[_0xa3bf('0x36')]),_0x5e25f4);if(_0x1d2719['query']['filter']){_0x1b05d2['where']=_['merge'](_0x1b05d2[_0xa3bf('0x3d')],{'$or':_[_0xa3bf('0x33')](_0x5e25f4,function(_0xf69565){if(_0xf69565[_0xa3bf('0x30')]!==_0xa3bf('0x3e')){var _0x58542a={};_0x58542a[_0xf69565[_0xa3bf('0x3f')]]={'$like':'%'+_0x1d2719[_0xa3bf('0x34')][_0xa3bf('0x40')]+'%'};return _0x58542a;}})});}_0x1b05d2=_[_0xa3bf('0x41')]({},_0x1b05d2,_0x1d2719[_0xa3bf('0x42')]);var _0x34cc85={'where':_0x1b05d2[_0xa3bf('0x3d')]};return db[_0xa3bf('0x2e')][_0xa3bf('0x21')](_0x34cc85)[_0xa3bf('0x27')](function(_0x25f0ca){_0x234475[_0xa3bf('0x21')]=_0x25f0ca;if(_0x1d2719[_0xa3bf('0x34')][_0xa3bf('0x43')]){_0x1b05d2['include']=[{'all':!![]}];}return db[_0xa3bf('0x2e')]['findAll'](_0x1b05d2);})[_0xa3bf('0x27')](function(_0x474833){_0x234475[_0xa3bf('0x44')]=_0x474833;return _0x234475;})[_0xa3bf('0x27')](respondWithFilteredResult(_0x40023a,_0x1b05d2))[_0xa3bf('0x45')](handleError(_0x40023a,null));};exports[_0xa3bf('0x46')]=function(_0x99764c,_0x5bb42){var _0x5be8c8={'raw':![],'where':{'id':_0x99764c['params']['id']}},_0x27c8d2={};_0x27c8d2[_0xa3bf('0x32')]=_[_0xa3bf('0x35')](db[_0xa3bf('0x2e')][_0xa3bf('0x2f')]);_0x27c8d2[_0xa3bf('0x34')]=_['keys'](_0x99764c[_0xa3bf('0x34')]);_0x27c8d2[_0xa3bf('0x36')]=_[_0xa3bf('0x37')](_0x27c8d2['model'],_0x27c8d2[_0xa3bf('0x34')]);_0x5be8c8['attributes']=_[_0xa3bf('0x37')](_0x27c8d2[_0xa3bf('0x32')],qs[_0xa3bf('0x39')](_0x99764c[_0xa3bf('0x34')]['fields']));_0x5be8c8[_0xa3bf('0x38')]=_0x5be8c8[_0xa3bf('0x38')]['length']?_0x5be8c8[_0xa3bf('0x38')]:_0x27c8d2[_0xa3bf('0x32')];if(_0x99764c[_0xa3bf('0x34')]['includeAll']){_0x5be8c8[_0xa3bf('0x47')]=[{'all':!![]}];}_0x5be8c8=_[_0xa3bf('0x41')]({},_0x5be8c8,_0x99764c[_0xa3bf('0x42')]);return db['Dashboard'][_0xa3bf('0x48')](_0x5be8c8)[_0xa3bf('0x27')](handleEntityNotFound(_0x5bb42,null))['then'](respondWithResult(_0x5bb42,null))[_0xa3bf('0x45')](handleError(_0x5bb42,null));};exports[_0xa3bf('0x49')]=function(_0x409f55,_0x40bfae){return db[_0xa3bf('0x2e')][_0xa3bf('0x49')](_0x409f55[_0xa3bf('0x4a')],{})['then'](function(_0x15de98){var _0x153167=_0x409f55['user']['get']({'plain':!![]});if(!_0x153167)throw new Error(_0xa3bf('0x4b'));if(_0x153167[_0xa3bf('0x4c')]===_0xa3bf('0x4d')){var _0x27016f=_0x15de98[_0xa3bf('0x29')]({'plain':!![]});var _0x90de0c='CustomDashboards';return db['UserProfileSection'][_0xa3bf('0x48')]({'where':{'name':_0x90de0c,'userProfileId':_0x153167[_0xa3bf('0x4e')]},'raw':!![]})[_0xa3bf('0x27')](function(_0x26cd17){if(_0x26cd17&&_0x26cd17[_0xa3bf('0x4f')]===0x0){return db[_0xa3bf('0x50')][_0xa3bf('0x49')]({'name':_0x27016f[_0xa3bf('0x3f')],'resourceId':_0x27016f['id'],'type':_0x26cd17['name'],'sectionId':_0x26cd17['id']},{})[_0xa3bf('0x27')](function(){return _0x15de98;});}else{return _0x15de98;}})[_0xa3bf('0x45')](function(_0x64a68d){logger[_0xa3bf('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x64a68d);throw _0x64a68d;});}return _0x15de98;})['then'](respondWithResult(_0x40bfae,0xc9))[_0xa3bf('0x45')](handleError(_0x40bfae,null));};exports['clone']=function(_0x2fffd2,_0x55695e){var _0x2ee73d={'where':{'id':_0x2fffd2['params']['id']}},_0x13a03a={};_0x13a03a[_0xa3bf('0x32')]=_[_0xa3bf('0x35')](db[_0xa3bf('0x2e')]['rawAttributes']);_0x2ee73d[_0xa3bf('0x38')]=_[_0xa3bf('0x37')](_0x13a03a[_0xa3bf('0x32')],qs[_0xa3bf('0x39')](_0x2fffd2[_0xa3bf('0x34')][_0xa3bf('0x39')]));_0x2ee73d[_0xa3bf('0x38')]=_0x2ee73d[_0xa3bf('0x38')][_0xa3bf('0x3a')]?_0x2ee73d[_0xa3bf('0x38')]:_0x13a03a[_0xa3bf('0x32')];if(_0x2fffd2[_0xa3bf('0x34')][_0xa3bf('0x43')]){_0x2ee73d[_0xa3bf('0x47')]=[{'all':!![]}];}_0x2ee73d=_[_0xa3bf('0x41')]({},_0x2ee73d,_0x2fffd2[_0xa3bf('0x42')]);return db[_0xa3bf('0x2e')]['find'](_0x2ee73d)['then'](handleEntityNotFound(_0x55695e,null))[_0xa3bf('0x27')](function(_0x2a6c7b){if(_0x2a6c7b){var _0x46b6d8=_0x2a6c7b[_0xa3bf('0x29')]({'plain':!![]});_0x46b6d8=qs[_0xa3bf('0x51')](_0x46b6d8,['id',_0xa3bf('0x52'),_0xa3bf('0x53')]);_0x2fffd2[_0xa3bf('0x4a')]=_[_0xa3bf('0x51')](_0x2fffd2[_0xa3bf('0x4a')],['id',_0xa3bf('0x52'),_0xa3bf('0x53')]);return db[_0xa3bf('0x2e')][_0xa3bf('0x49')](_[_0xa3bf('0x41')](_0x46b6d8,_0x2fffd2[_0xa3bf('0x4a')]),{'include':_0x2fffd2[_0xa3bf('0x34')]['includeAll']?[{'all':!![]}]:undefined})[_0xa3bf('0x27')](function(_0x262624){var _0x445ac4=_0x2fffd2['user'][_0xa3bf('0x29')]({'plain':!![]});if(!_0x445ac4)throw new Error(_0xa3bf('0x4b'));if(_0x445ac4['role']==='user'){var _0x3db379=_0x262624['get']({'plain':!![]});var _0x25c762=_0xa3bf('0x2a');return db['UserProfileSection'][_0xa3bf('0x48')]({'where':{'name':_0x25c762,'userProfileId':_0x445ac4[_0xa3bf('0x4e')]},'raw':!![]})[_0xa3bf('0x27')](function(_0x52c893){if(_0x52c893&&_0x52c893['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3db379[_0xa3bf('0x3f')],'resourceId':_0x3db379['id'],'type':_0x52c893[_0xa3bf('0x3f')],'sectionId':_0x52c893['id']},{})[_0xa3bf('0x27')](function(){return _0x262624;});}else{return _0x262624;}})[_0xa3bf('0x45')](function(_0x202848){logger['error'](_0xa3bf('0x54'),_0x202848);throw _0x202848;});}return _0x262624;});}})[_0xa3bf('0x27')](respondWithResult(_0x55695e,0xc9))[_0xa3bf('0x45')](handleError(_0x55695e,null));};exports[_0xa3bf('0x26')]=function(_0x11bc0a,_0x1ebd1a){if(_0x11bc0a['body']['id']){delete _0x11bc0a[_0xa3bf('0x4a')]['id'];}return db['Dashboard'][_0xa3bf('0x48')]({'where':{'id':_0x11bc0a[_0xa3bf('0x55')]['id']}})[_0xa3bf('0x27')](handleEntityNotFound(_0x1ebd1a,null))[_0xa3bf('0x27')](saveUpdates(_0x11bc0a[_0xa3bf('0x4a')],null))['then'](respondWithResult(_0x1ebd1a,null))[_0xa3bf('0x45')](handleError(_0x1ebd1a,null));};exports[_0xa3bf('0x28')]=function(_0x21ab8a,_0x516faa){return db[_0xa3bf('0x2e')]['find']({'where':{'id':_0x21ab8a['params']['id']}})[_0xa3bf('0x27')](handleEntityNotFound(_0x516faa,null))[_0xa3bf('0x27')](removeEntity(_0x516faa,null))[_0xa3bf('0x45')](handleError(_0x516faa,null));};function widgetAttributes(_0x1a153f){try{switch(_0x1a153f['type']){case _0xa3bf('0x56'):return[{'name':_0xa3bf('0x57'),'value':_0x1a153f[_0xa3bf('0x57')]||(_0x1a153f[_0xa3bf('0x58')]&&_0x1a153f[_0xa3bf('0x58')][0x0]?_0x1a153f[_0xa3bf('0x58')][0x0]['value']:undefined)||_0xa3bf('0x59')}];case _0xa3bf('0x5a'):return[{'name':_0xa3bf('0x5b'),'value':_0x1a153f[_0xa3bf('0x5b')]||(_0x1a153f['attrs']&&_0x1a153f[_0xa3bf('0x58')][0x0]?_0x1a153f['attrs'][0x0][_0xa3bf('0x5c')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x1a153f[_0xa3bf('0x5d')]||(_0x1a153f[_0xa3bf('0x58')]&&_0x1a153f[_0xa3bf('0x58')][0x0]?_0x1a153f['attrs'][0x0][_0xa3bf('0x5c')]:undefined)||'HH:mm:ss'},{'name':_0xa3bf('0x5e'),'value':_0x1a153f[_0xa3bf('0x5e')]||(_0x1a153f[_0xa3bf('0x58')]&&_0x1a153f[_0xa3bf('0x58')][0x1]?_0x1a153f['attrs'][0x1][_0xa3bf('0x5c')]:undefined)||_0xa3bf('0x5f')},{'name':_0xa3bf('0x60'),'value':_0x1a153f[_0xa3bf('0x60')]||(_0x1a153f[_0xa3bf('0x58')]&&_0x1a153f[_0xa3bf('0x58')][0x2]?_0x1a153f['attrs'][0x2][_0xa3bf('0x5c')]:undefined)||0xc}];case'counter':return[{'name':_0xa3bf('0x61'),'value':_0x1a153f[_0xa3bf('0x61')]||(_0x1a153f['attrs']&&_0x1a153f['attrs'][0x0]?_0x1a153f[_0xa3bf('0x58')][0x0][_0xa3bf('0x5c')]:undefined)||_0xa3bf('0x62')},{'name':_0xa3bf('0x63'),'value':_0x1a153f[_0xa3bf('0x63')]||(_0x1a153f[_0xa3bf('0x58')]&&_0x1a153f[_0xa3bf('0x58')][0x1]?_0x1a153f[_0xa3bf('0x58')][0x1][_0xa3bf('0x5c')]:undefined)||[]},{'name':_0xa3bf('0x60'),'value':_0x1a153f['attrFontSize']||(_0x1a153f[_0xa3bf('0x58')]&&_0x1a153f[_0xa3bf('0x58')][0x2]?_0x1a153f['attrs'][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0xa3bf('0x64'):return[{'name':_0xa3bf('0x65'),'value':_0x1a153f[_0xa3bf('0x65')]||(_0x1a153f[_0xa3bf('0x58')]&&_0x1a153f[_0xa3bf('0x58')][0x0]?_0x1a153f[_0xa3bf('0x58')][0x0][_0xa3bf('0x5c')]:undefined)||_0xa3bf('0x62')},{'name':'attrSerie2','value':_0x1a153f[_0xa3bf('0x66')]||(_0x1a153f[_0xa3bf('0x58')]&&_0x1a153f[_0xa3bf('0x58')][0x1]?_0x1a153f[_0xa3bf('0x58')][0x1][_0xa3bf('0x5c')]:undefined)||null},{'name':_0xa3bf('0x67'),'value':_0x1a153f[_0xa3bf('0x67')]||(_0x1a153f['attrs']&&_0x1a153f['attrs'][0x2]?_0x1a153f['attrs'][0x2][_0xa3bf('0x5c')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1a153f[_0xa3bf('0x63')]||(_0x1a153f[_0xa3bf('0x58')]&&_0x1a153f[_0xa3bf('0x58')][0x3]?_0x1a153f[_0xa3bf('0x58')][0x3][_0xa3bf('0x5c')]:undefined)||[]}];case _0xa3bf('0x68'):return[{'name':'attrReport','type':_0x1a153f['reportType']||(_0x1a153f[_0xa3bf('0x58')]&&_0x1a153f[_0xa3bf('0x58')][0x0]?_0x1a153f[_0xa3bf('0x58')][0x0][_0xa3bf('0x30')]:undefined)||null,'value':_0x1a153f[_0xa3bf('0x69')]||(_0x1a153f[_0xa3bf('0x58')]&&_0x1a153f[_0xa3bf('0x58')][0x0]?_0x1a153f['attrs'][0x0][_0xa3bf('0x5c')]:undefined)||null},{'name':_0xa3bf('0x6a'),'value':_0x1a153f['attrRefresh']||(_0x1a153f[_0xa3bf('0x58')]&&_0x1a153f['attrs'][0x1]?_0x1a153f[_0xa3bf('0x58')][0x1][_0xa3bf('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x41d647){logger[_0xa3bf('0x2b')](_0xa3bf('0x6b'),JSON['stringify'](_0x41d647));return[];}}exports[_0xa3bf('0x6c')]=function(_0x3bb952,_0x14b02b,_0x5f1429){if(_0x3bb952[_0xa3bf('0x4a')]['id']){delete _0x3bb952['body']['id'];}return db[_0xa3bf('0x2e')][_0xa3bf('0x48')]({'where':{'id':_0x3bb952[_0xa3bf('0x55')]['id']}})[_0xa3bf('0x27')](handleEntityNotFound(_0x14b02b,null))[_0xa3bf('0x27')](function(_0x96ec04){if(_0x96ec04){_0x3bb952[_0xa3bf('0x4a')][_0xa3bf('0x6d')]=_0x96ec04['id'];_0x3bb952['body'][_0xa3bf('0x58')]=widgetAttributes(_0x3bb952[_0xa3bf('0x4a')]);return db[_0xa3bf('0x6e')][_0xa3bf('0x49')](_0x3bb952['body']);}})[_0xa3bf('0x27')](respondWithResult(_0x14b02b,null))[_0xa3bf('0x45')](handleError(_0x14b02b,null));};exports[_0xa3bf('0x6f')]=function(_0x54477e,_0x5a916e,_0x233b72){var _0x2edbb0={};var _0x25f4b1={};var _0x3dcebc;var _0x57a0bc;return db['Dashboard'][_0xa3bf('0x70')]({'where':{'id':_0x54477e[_0xa3bf('0x55')]['id']}})['then'](handleEntityNotFound(_0x5a916e,null))[_0xa3bf('0x27')](function(_0x4f9aa0){if(_0x4f9aa0){_0x3dcebc=_0x4f9aa0;_0x25f4b1['model']=_[_0xa3bf('0x35')](db[_0xa3bf('0x6e')][_0xa3bf('0x2f')]);_0x25f4b1[_0xa3bf('0x34')]=_[_0xa3bf('0x35')](_0x54477e[_0xa3bf('0x34')]);_0x25f4b1[_0xa3bf('0x36')]=_[_0xa3bf('0x37')](_0x25f4b1[_0xa3bf('0x32')],_0x25f4b1['query']);_0x2edbb0[_0xa3bf('0x38')]=_[_0xa3bf('0x37')](_0x25f4b1[_0xa3bf('0x32')],qs['fields'](_0x54477e[_0xa3bf('0x34')][_0xa3bf('0x39')]));_0x2edbb0[_0xa3bf('0x38')]=_0x2edbb0['attributes'][_0xa3bf('0x3a')]?_0x2edbb0['attributes']:_0x25f4b1[_0xa3bf('0x32')];_0x2edbb0[_0xa3bf('0x3b')]=qs['sort'](_0x54477e['query'][_0xa3bf('0x3c')]);_0x2edbb0[_0xa3bf('0x3d')]=qs[_0xa3bf('0x36')](_[_0xa3bf('0x71')](_0x54477e[_0xa3bf('0x34')],_0x25f4b1[_0xa3bf('0x36')]));if(_0x54477e[_0xa3bf('0x34')][_0xa3bf('0x40')]){_0x2edbb0[_0xa3bf('0x3d')]=_[_0xa3bf('0x41')](_0x2edbb0[_0xa3bf('0x3d')],{'$or':_[_0xa3bf('0x33')](_0x2edbb0[_0xa3bf('0x38')],function(_0x66dd20){var _0x2872fc={};_0x2872fc[_0x66dd20]={'$like':'%'+_0x54477e['query'][_0xa3bf('0x40')]+'%'};return _0x2872fc;})});}_0x2edbb0=_['merge']({},_0x2edbb0,_0x54477e[_0xa3bf('0x42')]);return _0x3dcebc[_0xa3bf('0x6f')](_0x2edbb0);}})[_0xa3bf('0x27')](function(_0x286cce){if(_0x286cce){_0x57a0bc=_0x286cce[_0xa3bf('0x3a')];if(!_0x54477e[_0xa3bf('0x34')][_0xa3bf('0x72')](_0xa3bf('0x73'))){_0x2edbb0['limit']=qs[_0xa3bf('0x1f')](_0x54477e[_0xa3bf('0x34')][_0xa3bf('0x1f')]);_0x2edbb0[_0xa3bf('0x1e')]=qs[_0xa3bf('0x1e')](_0x54477e[_0xa3bf('0x34')][_0xa3bf('0x1e')]);}return _0x3dcebc[_0xa3bf('0x6f')](_0x2edbb0);}})[_0xa3bf('0x27')](function(_0x3a5612){if(_0x3a5612){return _0x3a5612?{'count':_0x57a0bc,'rows':_0x3a5612}:null;}})[_0xa3bf('0x27')](respondWithResult(_0x5a916e,null))['catch'](handleError(_0x5a916e,null));}; \ No newline at end of file +var _0xea02=['options','Dashboard','includeAll','include','findAll','rows','catch','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','clone','params','length','createdAt','updatedAt','user','role','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','addItem','getItems','findOne','DashboardItem','order','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./dashboard.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x533dac,_0x503b80){var _0x3057a9=function(_0x66d06b){while(--_0x66d06b){_0x533dac['push'](_0x533dac['shift']());}};_0x3057a9(++_0x503b80);}(_0xea02,0x12d));var _0x2ea0=function(_0x2da2cd,_0x6f91e5){_0x2da2cd=_0x2da2cd-0x0;var _0x44f270=_0xea02[_0x2da2cd];return _0x44f270;};'use strict';var emlformat=require(_0x2ea0('0x0'));var rimraf=require(_0x2ea0('0x1'));var zipdir=require(_0x2ea0('0x2'));var jsonpatch=require(_0x2ea0('0x3'));var rp=require('request-promise');var moment=require(_0x2ea0('0x4'));var BPromise=require(_0x2ea0('0x5'));var Mustache=require('mustache');var util=require(_0x2ea0('0x6'));var path=require(_0x2ea0('0x7'));var sox=require(_0x2ea0('0x8'));var csv=require(_0x2ea0('0x9'));var ejs=require(_0x2ea0('0xa'));var fs=require('fs');var fs_extra=require(_0x2ea0('0xb'));var _=require(_0x2ea0('0xc'));var squel=require(_0x2ea0('0xd'));var crypto=require(_0x2ea0('0xe'));var jsforce=require(_0x2ea0('0xf'));var deskjs=require(_0x2ea0('0x10'));var toCsv=require(_0x2ea0('0x9'));var querystring=require(_0x2ea0('0x11'));var Papa=require(_0x2ea0('0x12'));var Redis=require(_0x2ea0('0x13'));var authService=require(_0x2ea0('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2ea0('0x15'));var hardwareService=require(_0x2ea0('0x16'));var logger=require('../../config/logger')(_0x2ea0('0x17'));var utils=require(_0x2ea0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2ea0('0x19'));var db=require(_0x2ea0('0x1a'))['db'];config['redis']=_[_0x2ea0('0x1b')](config['redis'],{'host':_0x2ea0('0x1c'),'port':0x18eb});var socket=require(_0x2ea0('0x1d'))(new Redis(config[_0x2ea0('0x1e')]));require(_0x2ea0('0x1f'))['register'](socket);function respondWithStatusCode(_0x59d9b1,_0x58cc60){_0x58cc60=_0x58cc60||0xcc;return function(_0x1ac4ee){if(_0x1ac4ee){return _0x59d9b1[_0x2ea0('0x20')](_0x58cc60);}return _0x59d9b1[_0x2ea0('0x21')](_0x58cc60)[_0x2ea0('0x22')]();};}function respondWithResult(_0x429bc2,_0x2c64dc){_0x2c64dc=_0x2c64dc||0xc8;return function(_0x5e55a7){if(_0x5e55a7){return _0x429bc2[_0x2ea0('0x21')](_0x2c64dc)[_0x2ea0('0x23')](_0x5e55a7);}};}function respondWithFilteredResult(_0x5d725a,_0xb52259){return function(_0x328988){if(_0x328988){var _0x251403=typeof _0xb52259[_0x2ea0('0x24')]===_0x2ea0('0x25')&&typeof _0xb52259[_0x2ea0('0x26')]===_0x2ea0('0x25');var _0x18fc08=_0x328988[_0x2ea0('0x27')];var _0x1e1e9a=_0x251403?0x0:_0xb52259[_0x2ea0('0x24')];var _0x2260ab=_0x251403?_0x328988['count']:_0xb52259[_0x2ea0('0x24')]+_0xb52259[_0x2ea0('0x26')];var _0x5b070a;if(_0x2260ab>=_0x18fc08){_0x2260ab=_0x18fc08;_0x5b070a=0xc8;}else{_0x5b070a=0xce;}_0x5d725a['status'](_0x5b070a);return _0x5d725a['set'](_0x2ea0('0x28'),_0x1e1e9a+'-'+_0x2260ab+'/'+_0x18fc08)[_0x2ea0('0x23')](_0x328988);}return null;};}function patchUpdates(_0x2465c8){return function(_0x2ce7a0){try{jsonpatch[_0x2ea0('0x29')](_0x2ce7a0,_0x2465c8,!![]);}catch(_0x194d41){return BPromise[_0x2ea0('0x2a')](_0x194d41);}return _0x2ce7a0[_0x2ea0('0x2b')]();};}function saveUpdates(_0x68cebc,_0x322a64){return function(_0x45ecb5){if(_0x45ecb5){return _0x45ecb5[_0x2ea0('0x2c')](_0x68cebc)[_0x2ea0('0x2d')](function(_0x5ecf00){return _0x5ecf00;});}return null;};}function removeEntity(_0x3390b9,_0x38ce4e){return function(_0x46d14d){if(_0x46d14d){return _0x46d14d[_0x2ea0('0x2e')]()[_0x2ea0('0x2d')](function(){var _0x430636=_0x46d14d[_0x2ea0('0x2f')]({'plain':!![]});var _0xcb6fc6=_0x2ea0('0x30');return db[_0x2ea0('0x31')]['destroy']({'where':{'type':_0xcb6fc6,'resourceId':_0x430636['id']}})[_0x2ea0('0x2d')](function(){return _0x46d14d;});})[_0x2ea0('0x2d')](function(){_0x3390b9[_0x2ea0('0x21')](0xcc)[_0x2ea0('0x22')]();});}};}function handleEntityNotFound(_0x25b577,_0x395f43){return function(_0x1f6696){if(!_0x1f6696){_0x25b577['sendStatus'](0x194);}return _0x1f6696;};}function handleError(_0x3de691,_0x18f17e){_0x18f17e=_0x18f17e||0x1f4;return function(_0x146147){logger[_0x2ea0('0x32')](_0x146147['stack']);if(_0x146147[_0x2ea0('0x33')]){delete _0x146147['name'];}_0x3de691[_0x2ea0('0x21')](_0x18f17e)[_0x2ea0('0x34')](_0x146147);};}exports[_0x2ea0('0x35')]=function(_0x121cbe,_0x566e49){var _0x258e98={},_0xe23e5c={},_0x508354={'count':0x0,'rows':[]};var _0x51dff7=_[_0x2ea0('0x36')](db['Dashboard'][_0x2ea0('0x37')],function(_0x20d795){return{'name':_0x20d795[_0x2ea0('0x38')],'type':_0x20d795[_0x2ea0('0x39')][_0x2ea0('0x3a')]};});_0xe23e5c['model']=_[_0x2ea0('0x36')](_0x51dff7,_0x2ea0('0x33'));_0xe23e5c[_0x2ea0('0x3b')]=_[_0x2ea0('0x3c')](_0x121cbe[_0x2ea0('0x3b')]);_0xe23e5c[_0x2ea0('0x3d')]=_[_0x2ea0('0x3e')](_0xe23e5c[_0x2ea0('0x3f')],_0xe23e5c['query']);_0x258e98[_0x2ea0('0x40')]=_[_0x2ea0('0x3e')](_0xe23e5c[_0x2ea0('0x3f')],qs['fields'](_0x121cbe['query'][_0x2ea0('0x41')]));_0x258e98[_0x2ea0('0x40')]=_0x258e98[_0x2ea0('0x40')]['length']?_0x258e98[_0x2ea0('0x40')]:_0xe23e5c[_0x2ea0('0x3f')];if(!_0x121cbe[_0x2ea0('0x3b')][_0x2ea0('0x42')](_0x2ea0('0x43'))){_0x258e98[_0x2ea0('0x26')]=qs[_0x2ea0('0x26')](_0x121cbe[_0x2ea0('0x3b')]['limit']);_0x258e98[_0x2ea0('0x24')]=qs['offset'](_0x121cbe['query'][_0x2ea0('0x24')]);}_0x258e98['order']=qs[_0x2ea0('0x44')](_0x121cbe['query'][_0x2ea0('0x44')]);_0x258e98[_0x2ea0('0x45')]=qs[_0x2ea0('0x3d')](_[_0x2ea0('0x46')](_0x121cbe[_0x2ea0('0x3b')],_0xe23e5c[_0x2ea0('0x3d')]),_0x51dff7);if(_0x121cbe[_0x2ea0('0x3b')][_0x2ea0('0x47')]){_0x258e98[_0x2ea0('0x45')]=_['merge'](_0x258e98[_0x2ea0('0x45')],{'$or':_[_0x2ea0('0x36')](_0x51dff7,function(_0x565e3b){if(_0x565e3b[_0x2ea0('0x39')]!==_0x2ea0('0x48')){var _0x243542={};_0x243542[_0x565e3b[_0x2ea0('0x33')]]={'$like':'%'+_0x121cbe[_0x2ea0('0x3b')]['filter']+'%'};return _0x243542;}})});}_0x258e98=_[_0x2ea0('0x49')]({},_0x258e98,_0x121cbe[_0x2ea0('0x4a')]);var _0x1065c0={'where':_0x258e98['where']};return db[_0x2ea0('0x4b')][_0x2ea0('0x27')](_0x1065c0)[_0x2ea0('0x2d')](function(_0x175dad){_0x508354[_0x2ea0('0x27')]=_0x175dad;if(_0x121cbe[_0x2ea0('0x3b')][_0x2ea0('0x4c')]){_0x258e98[_0x2ea0('0x4d')]=[{'all':!![]}];}return db[_0x2ea0('0x4b')][_0x2ea0('0x4e')](_0x258e98);})[_0x2ea0('0x2d')](function(_0x3d8be5){_0x508354[_0x2ea0('0x4f')]=_0x3d8be5;return _0x508354;})[_0x2ea0('0x2d')](respondWithFilteredResult(_0x566e49,_0x258e98))[_0x2ea0('0x50')](handleError(_0x566e49,null));};exports['show']=function(_0xcf7754,_0x5e32f4){var _0x308312={'raw':![],'where':{'id':_0xcf7754['params']['id']}},_0x3d72ef={};_0x3d72ef[_0x2ea0('0x3f')]=_[_0x2ea0('0x3c')](db['Dashboard'][_0x2ea0('0x37')]);_0x3d72ef[_0x2ea0('0x3b')]=_[_0x2ea0('0x3c')](_0xcf7754[_0x2ea0('0x3b')]);_0x3d72ef[_0x2ea0('0x3d')]=_[_0x2ea0('0x3e')](_0x3d72ef[_0x2ea0('0x3f')],_0x3d72ef[_0x2ea0('0x3b')]);_0x308312[_0x2ea0('0x40')]=_[_0x2ea0('0x3e')](_0x3d72ef[_0x2ea0('0x3f')],qs['fields'](_0xcf7754[_0x2ea0('0x3b')][_0x2ea0('0x41')]));_0x308312['attributes']=_0x308312[_0x2ea0('0x40')]['length']?_0x308312['attributes']:_0x3d72ef[_0x2ea0('0x3f')];if(_0xcf7754[_0x2ea0('0x3b')]['includeAll']){_0x308312[_0x2ea0('0x4d')]=[{'all':!![]}];}_0x308312=_[_0x2ea0('0x49')]({},_0x308312,_0xcf7754[_0x2ea0('0x4a')]);return db['Dashboard'][_0x2ea0('0x51')](_0x308312)[_0x2ea0('0x2d')](handleEntityNotFound(_0x5e32f4,null))[_0x2ea0('0x2d')](respondWithResult(_0x5e32f4,null))[_0x2ea0('0x50')](handleError(_0x5e32f4,null));};exports['create']=function(_0x122eb7,_0x4e1b74){return db[_0x2ea0('0x4b')][_0x2ea0('0x52')](_0x122eb7[_0x2ea0('0x53')],{})[_0x2ea0('0x2d')](function(_0x31f75b){var _0x464915=_0x122eb7['user']['get']({'plain':!![]});if(!_0x464915)throw new Error(_0x2ea0('0x54'));if(_0x464915['role']==='user'){var _0x349851=_0x31f75b[_0x2ea0('0x2f')]({'plain':!![]});var _0x5128b6=_0x2ea0('0x30');return db[_0x2ea0('0x55')][_0x2ea0('0x51')]({'where':{'name':_0x5128b6,'userProfileId':_0x464915[_0x2ea0('0x56')]},'raw':!![]})[_0x2ea0('0x2d')](function(_0x4d61e6){if(_0x4d61e6&&_0x4d61e6[_0x2ea0('0x57')]===0x0){return db[_0x2ea0('0x31')][_0x2ea0('0x52')]({'name':_0x349851[_0x2ea0('0x33')],'resourceId':_0x349851['id'],'type':_0x4d61e6[_0x2ea0('0x33')],'sectionId':_0x4d61e6['id']},{})['then'](function(){return _0x31f75b;});}else{return _0x31f75b;}})[_0x2ea0('0x50')](function(_0x5e8bd6){logger[_0x2ea0('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e8bd6);throw _0x5e8bd6;});}return _0x31f75b;})[_0x2ea0('0x2d')](respondWithResult(_0x4e1b74,0xc9))[_0x2ea0('0x50')](handleError(_0x4e1b74,null));};exports[_0x2ea0('0x58')]=function(_0x3e7d89,_0x226823){var _0x5d85bc={'where':{'id':_0x3e7d89[_0x2ea0('0x59')]['id']}},_0x76114d={};_0x76114d[_0x2ea0('0x3f')]=_['keys'](db['Dashboard'][_0x2ea0('0x37')]);_0x5d85bc['attributes']=_[_0x2ea0('0x3e')](_0x76114d['model'],qs[_0x2ea0('0x41')](_0x3e7d89[_0x2ea0('0x3b')][_0x2ea0('0x41')]));_0x5d85bc[_0x2ea0('0x40')]=_0x5d85bc[_0x2ea0('0x40')][_0x2ea0('0x5a')]?_0x5d85bc[_0x2ea0('0x40')]:_0x76114d[_0x2ea0('0x3f')];if(_0x3e7d89[_0x2ea0('0x3b')][_0x2ea0('0x4c')]){_0x5d85bc[_0x2ea0('0x4d')]=[{'all':!![]}];}_0x5d85bc=_[_0x2ea0('0x49')]({},_0x5d85bc,_0x3e7d89[_0x2ea0('0x4a')]);return db[_0x2ea0('0x4b')][_0x2ea0('0x51')](_0x5d85bc)['then'](handleEntityNotFound(_0x226823,null))[_0x2ea0('0x2d')](function(_0x513c87){if(_0x513c87){var _0x2ed373=_0x513c87['get']({'plain':!![]});_0x2ed373=qs['omit'](_0x2ed373,['id',_0x2ea0('0x5b'),'updatedAt']);_0x3e7d89['body']=_['omit'](_0x3e7d89[_0x2ea0('0x53')],['id',_0x2ea0('0x5b'),_0x2ea0('0x5c')]);return db[_0x2ea0('0x4b')][_0x2ea0('0x52')](_[_0x2ea0('0x49')](_0x2ed373,_0x3e7d89[_0x2ea0('0x53')]),{'include':_0x3e7d89['query'][_0x2ea0('0x4c')]?[{'all':!![]}]:undefined})[_0x2ea0('0x2d')](function(_0x2604db){var _0x104bda=_0x3e7d89[_0x2ea0('0x5d')][_0x2ea0('0x2f')]({'plain':!![]});if(!_0x104bda)throw new Error(_0x2ea0('0x54'));if(_0x104bda[_0x2ea0('0x5e')]===_0x2ea0('0x5d')){var _0x47f845=_0x2604db['get']({'plain':!![]});var _0x1205b2=_0x2ea0('0x30');return db['UserProfileSection'][_0x2ea0('0x51')]({'where':{'name':_0x1205b2,'userProfileId':_0x104bda[_0x2ea0('0x56')]},'raw':!![]})['then'](function(_0x3e7ed4){if(_0x3e7ed4&&_0x3e7ed4[_0x2ea0('0x57')]===0x0){return db['UserProfileResource'][_0x2ea0('0x52')]({'name':_0x47f845[_0x2ea0('0x33')],'resourceId':_0x47f845['id'],'type':_0x3e7ed4[_0x2ea0('0x33')],'sectionId':_0x3e7ed4['id']},{})[_0x2ea0('0x2d')](function(){return _0x2604db;});}else{return _0x2604db;}})[_0x2ea0('0x50')](function(_0x1c78a4){logger[_0x2ea0('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c78a4);throw _0x1c78a4;});}return _0x2604db;});}})[_0x2ea0('0x2d')](respondWithResult(_0x226823,0xc9))['catch'](handleError(_0x226823,null));};exports[_0x2ea0('0x2c')]=function(_0x40036b,_0x145f04){if(_0x40036b[_0x2ea0('0x53')]['id']){delete _0x40036b[_0x2ea0('0x53')]['id'];}return db[_0x2ea0('0x4b')][_0x2ea0('0x51')]({'where':{'id':_0x40036b['params']['id']}})[_0x2ea0('0x2d')](handleEntityNotFound(_0x145f04,null))[_0x2ea0('0x2d')](saveUpdates(_0x40036b[_0x2ea0('0x53')],null))[_0x2ea0('0x2d')](respondWithResult(_0x145f04,null))[_0x2ea0('0x50')](handleError(_0x145f04,null));};exports[_0x2ea0('0x2e')]=function(_0x48e98f,_0x35e2b9){return db[_0x2ea0('0x4b')][_0x2ea0('0x51')]({'where':{'id':_0x48e98f[_0x2ea0('0x59')]['id']}})['then'](handleEntityNotFound(_0x35e2b9,null))[_0x2ea0('0x2d')](removeEntity(_0x35e2b9,null))[_0x2ea0('0x50')](handleError(_0x35e2b9,null));};function widgetAttributes(_0x57f28f){try{switch(_0x57f28f[_0x2ea0('0x39')]){case _0x2ea0('0x5f'):return[{'name':_0x2ea0('0x60'),'value':_0x57f28f[_0x2ea0('0x60')]||(_0x57f28f[_0x2ea0('0x61')]&&_0x57f28f['attrs'][0x0]?_0x57f28f[_0x2ea0('0x61')][0x0][_0x2ea0('0x62')]:undefined)||_0x2ea0('0x63')}];case _0x2ea0('0x64'):return[{'name':_0x2ea0('0x65'),'value':_0x57f28f[_0x2ea0('0x65')]||(_0x57f28f[_0x2ea0('0x61')]&&_0x57f28f[_0x2ea0('0x61')][0x0]?_0x57f28f[_0x2ea0('0x61')][0x0]['value']:undefined)||''}];case _0x2ea0('0x66'):return[{'name':_0x2ea0('0x67'),'value':_0x57f28f[_0x2ea0('0x67')]||(_0x57f28f[_0x2ea0('0x61')]&&_0x57f28f[_0x2ea0('0x61')][0x0]?_0x57f28f[_0x2ea0('0x61')][0x0][_0x2ea0('0x62')]:undefined)||_0x2ea0('0x68')},{'name':'attrTimezone','value':_0x57f28f[_0x2ea0('0x69')]||(_0x57f28f[_0x2ea0('0x61')]&&_0x57f28f[_0x2ea0('0x61')][0x1]?_0x57f28f[_0x2ea0('0x61')][0x1][_0x2ea0('0x62')]:undefined)||'0.00'},{'name':_0x2ea0('0x6a'),'value':_0x57f28f[_0x2ea0('0x6a')]||(_0x57f28f[_0x2ea0('0x61')]&&_0x57f28f['attrs'][0x2]?_0x57f28f[_0x2ea0('0x61')][0x2][_0x2ea0('0x62')]:undefined)||0xc}];case _0x2ea0('0x6b'):return[{'name':_0x2ea0('0x6c'),'value':_0x57f28f[_0x2ea0('0x6c')]||(_0x57f28f[_0x2ea0('0x61')]&&_0x57f28f[_0x2ea0('0x61')][0x0]?_0x57f28f[_0x2ea0('0x61')][0x0][_0x2ea0('0x62')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x57f28f[_0x2ea0('0x6d')]||(_0x57f28f[_0x2ea0('0x61')]&&_0x57f28f[_0x2ea0('0x61')][0x1]?_0x57f28f['attrs'][0x1]['value']:undefined)||[]},{'name':_0x2ea0('0x6a'),'value':_0x57f28f[_0x2ea0('0x6a')]||(_0x57f28f['attrs']&&_0x57f28f[_0x2ea0('0x61')][0x2]?_0x57f28f['attrs'][0x2][_0x2ea0('0x62')]:undefined)||0x14}];case _0x2ea0('0x6e'):case _0x2ea0('0x6f'):return[{'name':'attrSerie1','value':_0x57f28f[_0x2ea0('0x70')]||(_0x57f28f[_0x2ea0('0x61')]&&_0x57f28f[_0x2ea0('0x61')][0x0]?_0x57f28f[_0x2ea0('0x61')][0x0][_0x2ea0('0x62')]:undefined)||_0x2ea0('0x71')},{'name':'attrSerie2','value':_0x57f28f[_0x2ea0('0x72')]||(_0x57f28f[_0x2ea0('0x61')]&&_0x57f28f['attrs'][0x1]?_0x57f28f[_0x2ea0('0x61')][0x1][_0x2ea0('0x62')]:undefined)||null},{'name':_0x2ea0('0x73'),'value':_0x57f28f[_0x2ea0('0x73')]||(_0x57f28f[_0x2ea0('0x61')]&&_0x57f28f[_0x2ea0('0x61')][0x2]?_0x57f28f[_0x2ea0('0x61')][0x2][_0x2ea0('0x62')]:undefined)||null},{'name':_0x2ea0('0x6d'),'value':_0x57f28f[_0x2ea0('0x6d')]||(_0x57f28f['attrs']&&_0x57f28f[_0x2ea0('0x61')][0x3]?_0x57f28f[_0x2ea0('0x61')][0x3][_0x2ea0('0x62')]:undefined)||[]}];case'web-report':return[{'name':_0x2ea0('0x74'),'type':_0x57f28f[_0x2ea0('0x75')]||(_0x57f28f['attrs']&&_0x57f28f[_0x2ea0('0x61')][0x0]?_0x57f28f[_0x2ea0('0x61')][0x0][_0x2ea0('0x39')]:undefined)||null,'value':_0x57f28f[_0x2ea0('0x74')]||(_0x57f28f[_0x2ea0('0x61')]&&_0x57f28f[_0x2ea0('0x61')][0x0]?_0x57f28f['attrs'][0x0][_0x2ea0('0x62')]:undefined)||null},{'name':_0x2ea0('0x76'),'value':_0x57f28f['attrRefresh']||(_0x57f28f['attrs']&&_0x57f28f[_0x2ea0('0x61')][0x1]?_0x57f28f[_0x2ea0('0x61')][0x1][_0x2ea0('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x356660){logger['error']('widgetAttributes:\x20%s',JSON[_0x2ea0('0x77')](_0x356660));return[];}}exports[_0x2ea0('0x78')]=function(_0x1e151c,_0x1e9c90,_0x2b7a1d){if(_0x1e151c[_0x2ea0('0x53')]['id']){delete _0x1e151c[_0x2ea0('0x53')]['id'];}return db['Dashboard'][_0x2ea0('0x51')]({'where':{'id':_0x1e151c[_0x2ea0('0x59')]['id']}})[_0x2ea0('0x2d')](handleEntityNotFound(_0x1e9c90,null))[_0x2ea0('0x2d')](function(_0x20009c){if(_0x20009c){_0x1e151c[_0x2ea0('0x53')]['DashboardId']=_0x20009c['id'];_0x1e151c[_0x2ea0('0x53')]['attrs']=widgetAttributes(_0x1e151c[_0x2ea0('0x53')]);return db['DashboardItem'][_0x2ea0('0x52')](_0x1e151c['body']);}})[_0x2ea0('0x2d')](respondWithResult(_0x1e9c90,null))[_0x2ea0('0x50')](handleError(_0x1e9c90,null));};exports[_0x2ea0('0x79')]=function(_0x1b266d,_0x222c97,_0x5966b9){var _0x5d8c9c={};var _0xd67fa0={};var _0x3f61fd;var _0x1caac3;return db[_0x2ea0('0x4b')][_0x2ea0('0x7a')]({'where':{'id':_0x1b266d['params']['id']}})['then'](handleEntityNotFound(_0x222c97,null))[_0x2ea0('0x2d')](function(_0x4e4cd4){if(_0x4e4cd4){_0x3f61fd=_0x4e4cd4;_0xd67fa0[_0x2ea0('0x3f')]=_['keys'](db[_0x2ea0('0x7b')][_0x2ea0('0x37')]);_0xd67fa0[_0x2ea0('0x3b')]=_[_0x2ea0('0x3c')](_0x1b266d[_0x2ea0('0x3b')]);_0xd67fa0[_0x2ea0('0x3d')]=_[_0x2ea0('0x3e')](_0xd67fa0[_0x2ea0('0x3f')],_0xd67fa0['query']);_0x5d8c9c[_0x2ea0('0x40')]=_[_0x2ea0('0x3e')](_0xd67fa0[_0x2ea0('0x3f')],qs[_0x2ea0('0x41')](_0x1b266d[_0x2ea0('0x3b')][_0x2ea0('0x41')]));_0x5d8c9c[_0x2ea0('0x40')]=_0x5d8c9c[_0x2ea0('0x40')][_0x2ea0('0x5a')]?_0x5d8c9c['attributes']:_0xd67fa0['model'];_0x5d8c9c[_0x2ea0('0x7c')]=qs[_0x2ea0('0x44')](_0x1b266d[_0x2ea0('0x3b')]['sort']);_0x5d8c9c[_0x2ea0('0x45')]=qs[_0x2ea0('0x3d')](_[_0x2ea0('0x46')](_0x1b266d[_0x2ea0('0x3b')],_0xd67fa0['filters']));if(_0x1b266d['query'][_0x2ea0('0x47')]){_0x5d8c9c[_0x2ea0('0x45')]=_['merge'](_0x5d8c9c[_0x2ea0('0x45')],{'$or':_['map'](_0x5d8c9c[_0x2ea0('0x40')],function(_0x16be89){var _0xd1a082={};_0xd1a082[_0x16be89]={'$like':'%'+_0x1b266d[_0x2ea0('0x3b')][_0x2ea0('0x47')]+'%'};return _0xd1a082;})});}_0x5d8c9c=_[_0x2ea0('0x49')]({},_0x5d8c9c,_0x1b266d[_0x2ea0('0x4a')]);return _0x3f61fd[_0x2ea0('0x79')](_0x5d8c9c);}})['then'](function(_0x2061e0){if(_0x2061e0){_0x1caac3=_0x2061e0['length'];if(!_0x1b266d[_0x2ea0('0x3b')][_0x2ea0('0x42')]('nolimit')){_0x5d8c9c[_0x2ea0('0x26')]=qs[_0x2ea0('0x26')](_0x1b266d[_0x2ea0('0x3b')]['limit']);_0x5d8c9c[_0x2ea0('0x24')]=qs[_0x2ea0('0x24')](_0x1b266d['query']['offset']);}return _0x3f61fd[_0x2ea0('0x79')](_0x5d8c9c);}})[_0x2ea0('0x2d')](function(_0x536006){if(_0x536006){return _0x536006?{'count':_0x1caac3,'rows':_0x536006}:null;}})[_0x2ea0('0x2d')](respondWithResult(_0x222c97,null))['catch'](handleError(_0x222c97,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7a43774..47006d9 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 _0x9c32=['hasOwnProperty','hook','exports','../../mysqldb','save','update','remove','emit'];(function(_0x30bea1,_0x468ea6){var _0xa2e99c=function(_0x35e440){while(--_0x35e440){_0x30bea1['push'](_0x30bea1['shift']());}};_0xa2e99c(++_0x468ea6);}(_0x9c32,0xbb));var _0x29c3=function(_0x434182,_0x26c884){_0x434182=_0x434182-0x0;var _0x4e1ead=_0x9c32[_0x434182];return _0x4e1ead;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x29c3('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x29c3('0x1'),'afterUpdate':_0x29c3('0x2'),'afterDestroy':_0x29c3('0x3')};function emitEvent(_0x53aaff){return function(_0x34678c,_0x402499,_0x40b2bf){DashboardEvents[_0x29c3('0x4')](_0x53aaff+':'+_0x34678c['id'],_0x34678c);DashboardEvents[_0x29c3('0x4')](_0x53aaff,_0x34678c);_0x40b2bf(null);};}for(var e in events){if(events[_0x29c3('0x5')](e)){var event=events[e];Dashboard[_0x29c3('0x6')](e,emitEvent(event));}}module[_0x29c3('0x7')]=DashboardEvents; \ No newline at end of file +var _0xa18d=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0x3e3754,_0x53267a){var _0x2ab0f2=function(_0x1fa05b){while(--_0x1fa05b){_0x3e3754['push'](_0x3e3754['shift']());}};_0x2ab0f2(++_0x53267a);}(_0xa18d,0x6c));var _0xda18=function(_0xbfd8f2,_0x1fe4ec){_0xbfd8f2=_0xbfd8f2-0x0;var _0x1f6235=_0xa18d[_0xbfd8f2];return _0x1f6235;};'use strict';var EventEmitter=require(_0xda18('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xda18('0x1')](0x0);var events={'afterCreate':_0xda18('0x2'),'afterUpdate':_0xda18('0x3'),'afterDestroy':'remove'};function emitEvent(_0x324944){return function(_0x1b327b,_0x39bc00,_0x9800d0){DashboardEvents[_0xda18('0x4')](_0x324944+':'+_0x1b327b['id'],_0x1b327b);DashboardEvents[_0xda18('0x4')](_0x324944,_0x1b327b);_0x9800d0(null);};}for(var e in events){if(events[_0xda18('0x5')](e)){var event=events[e];Dashboard[_0xda18('0x6')](e,emitEvent(event));}}module[_0xda18('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 2d4376c..f7e7771 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 _0x26f5=['dashboards','lodash','util','../../config/logger','api','bluebird','request-promise','path','./dashboard.attributes','exports','define','Dashboard'];(function(_0x19cde2,_0xf2bd84){var _0x4d1f3d=function(_0x29f2e6){while(--_0x29f2e6){_0x19cde2['push'](_0x19cde2['shift']());}};_0x4d1f3d(++_0xf2bd84);}(_0x26f5,0xe5));var _0x526f=function(_0x53ced7,_0x56ab3d){_0x53ced7=_0x53ced7-0x0;var _0x5c6114=_0x26f5[_0x53ced7];return _0x5c6114;};'use strict';var _=require(_0x526f('0x0'));var util=require(_0x526f('0x1'));var logger=require(_0x526f('0x2'))(_0x526f('0x3'));var moment=require('moment');var BPromise=require(_0x526f('0x4'));var rp=require(_0x526f('0x5'));var fs=require('fs');var path=require(_0x526f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x526f('0x7'));module[_0x526f('0x8')]=function(_0xebd5bd,_0x325027){return _0xebd5bd[_0x526f('0x9')](_0x526f('0xa'),attributes,{'tableName':_0x526f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2171=['bluebird','request-promise','path','../../config/environment','define','Dashboard','lodash','api','moment'];(function(_0x28c61f,_0x55fadc){var _0x4dc378=function(_0x271b83){while(--_0x271b83){_0x28c61f['push'](_0x28c61f['shift']());}};_0x4dc378(++_0x55fadc);}(_0x2171,0x15c));var _0x1217=function(_0x4e1b59,_0x4472c9){_0x4e1b59=_0x4e1b59-0x0;var _0x35efc5=_0x2171[_0x4e1b59];return _0x35efc5;};'use strict';var _=require(_0x1217('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1217('0x1'));var moment=require(_0x1217('0x2'));var BPromise=require(_0x1217('0x3'));var rp=require(_0x1217('0x4'));var fs=require('fs');var path=require(_0x1217('0x5'));var rimraf=require('rimraf');var config=require(_0x1217('0x6'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x2dd1d6,_0x3b58f0){return _0x2dd1d6[_0x1217('0x7')](_0x1217('0x8'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 8f8d987..a9a0a34 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 _0x457e=['localhost','./dashboard.socket','register','request','then','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','result','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','redis','defaults'];(function(_0x129343,_0x4a8eb2){var _0x396f60=function(_0x364e41){while(--_0x364e41){_0x129343['push'](_0x129343['shift']());}};_0x396f60(++_0x4a8eb2);}(_0x457e,0x15f));var _0xe457=function(_0x191eeb,_0x280a1c){_0x191eeb=_0x191eeb-0x0;var _0x426499=_0x457e[_0x191eeb];return _0x426499;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe457('0x0'));var BPromise=require('bluebird');var rs=require(_0xe457('0x1'));var fs=require('fs');var Redis=require(_0xe457('0x2'));var db=require(_0xe457('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe457('0x4'))(_0xe457('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe457('0x6')]['http']({'port':0x232a});config[_0xe457('0x7')]=_[_0xe457('0x8')](config[_0xe457('0x7')],{'host':_0xe457('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe457('0x7')]));require(_0xe457('0xa'))[_0xe457('0xb')](socket);function respondWithRpcPromise(_0x56a2ea,_0x40d444,_0x2d5191){return new BPromise(function(_0x69fbfd,_0x54102d){return client[_0xe457('0xc')](_0x56a2ea,_0x2d5191)[_0xe457('0xd')](function(_0x33f092){logger['info']('Dashboard,\x20%s,\x20%s',_0x40d444,'request\x20sent');logger[_0xe457('0xe')](_0xe457('0xf'),_0x40d444,_0xe457('0x10'),JSON[_0xe457('0x11')](_0x33f092));if(_0x33f092[_0xe457('0x12')]){if(_0x33f092[_0xe457('0x12')][_0xe457('0x13')]===0x1f4){logger[_0xe457('0x12')](_0xe457('0x14'),_0x40d444,_0x33f092[_0xe457('0x12')][_0xe457('0x15')]);return _0x54102d(_0x33f092[_0xe457('0x12')][_0xe457('0x15')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x40d444,_0x33f092['error'][_0xe457('0x15')]);return _0x69fbfd(_0x33f092['error']['message']);}else{logger[_0xe457('0x16')](_0xe457('0x14'),_0x40d444,_0xe457('0x10'));_0x69fbfd(_0x33f092[_0xe457('0x17')][_0xe457('0x15')]);}})['catch'](function(_0xb189d7){logger[_0xe457('0x12')](_0xe457('0x14'),_0x40d444,_0xb189d7);_0x54102d(_0xb189d7);});});} \ No newline at end of file +var _0x7cbd=['stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0x7cbd,0x1f2));var _0xd7cb=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x7cbd[_0x4d1ee9];return _0x9a5456;};'use strict';var _=require(_0xd7cb('0x0'));var util=require(_0xd7cb('0x1'));var moment=require(_0xd7cb('0x2'));var BPromise=require(_0xd7cb('0x3'));var rs=require(_0xd7cb('0x4'));var fs=require('fs');var Redis=require(_0xd7cb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd7cb('0x6'));var logger=require(_0xd7cb('0x7'))(_0xd7cb('0x8'));var config=require(_0xd7cb('0x9'));var jayson=require(_0xd7cb('0xa'));var client=jayson[_0xd7cb('0xb')][_0xd7cb('0xc')]({'port':0x232a});config['redis']=_[_0xd7cb('0xd')](config[_0xd7cb('0xe')],{'host':_0xd7cb('0xf'),'port':0x18eb});var socket=require(_0xd7cb('0x10'))(new Redis(config[_0xd7cb('0xe')]));require(_0xd7cb('0x11'))[_0xd7cb('0x12')](socket);function respondWithRpcPromise(_0x1ee232,_0x6be570,_0x23f790){return new BPromise(function(_0x54d5e0,_0x47c3dd){return client[_0xd7cb('0x13')](_0x1ee232,_0x23f790)[_0xd7cb('0x14')](function(_0x4382d0){logger['info'](_0xd7cb('0x15'),_0x6be570,_0xd7cb('0x16'));logger[_0xd7cb('0x17')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x6be570,_0xd7cb('0x16'),JSON[_0xd7cb('0x18')](_0x4382d0));if(_0x4382d0[_0xd7cb('0x19')]){if(_0x4382d0[_0xd7cb('0x19')][_0xd7cb('0x1a')]===0x1f4){logger[_0xd7cb('0x19')]('Dashboard,\x20%s,\x20%s',_0x6be570,_0x4382d0[_0xd7cb('0x19')][_0xd7cb('0x1b')]);return _0x47c3dd(_0x4382d0['error']['message']);}logger[_0xd7cb('0x19')](_0xd7cb('0x15'),_0x6be570,_0x4382d0[_0xd7cb('0x19')][_0xd7cb('0x1b')]);return _0x54d5e0(_0x4382d0[_0xd7cb('0x19')][_0xd7cb('0x1b')]);}else{logger[_0xd7cb('0x1c')](_0xd7cb('0x15'),_0x6be570,_0xd7cb('0x16'));_0x54d5e0(_0x4382d0['result'][_0xd7cb('0x1b')]);}})['catch'](function(_0xbabd5f){logger[_0xd7cb('0x19')]('Dashboard,\x20%s,\x20%s',_0x6be570,_0xbabd5f);_0x47c3dd(_0xbabd5f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 47bb95e..02e27c5 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 _0xc9cc=['remove','emit','removeListener','register','length','dashboard:','save'];(function(_0x2d6fc4,_0x104653){var _0x4aff9b=function(_0x261cd9){while(--_0x261cd9){_0x2d6fc4['push'](_0x2d6fc4['shift']());}};_0x4aff9b(++_0x104653);}(_0xc9cc,0x164));var _0xcc9c=function(_0x4ebf6a,_0xfd0a40){_0x4ebf6a=_0x4ebf6a-0x0;var _0x1e7a72=_0xc9cc[_0x4ebf6a];return _0x1e7a72;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xcc9c('0x0'),_0xcc9c('0x1'),'update'];function createListener(_0x20c05f,_0x4ad293){return function(_0x326c25){_0x4ad293[_0xcc9c('0x2')](_0x20c05f,_0x326c25);};}function removeListener(_0x2a8c7c,_0x20d110){return function(){DashboardEvents[_0xcc9c('0x3')](_0x2a8c7c,_0x20d110);};}exports[_0xcc9c('0x4')]=function(_0x321240){for(var _0x51802e=0x0,_0x3da842=events[_0xcc9c('0x5')];_0x51802e<_0x3da842;_0x51802e++){var _0x583a75=events[_0x51802e];var _0x441525=createListener(_0xcc9c('0x6')+_0x583a75,_0x321240);DashboardEvents['on'](_0x583a75,_0x441525);}}; \ No newline at end of file +var _0x7e2c=['emit','removeListener','register','dashboard:','./dashboard.events','save'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x7e2c,0x1f0));var _0xc7e2=function(_0xe281d0,_0x39dc35){_0xe281d0=_0xe281d0-0x0;var _0x1da6d3=_0x7e2c[_0xe281d0];return _0x1da6d3;};'use strict';var DashboardEvents=require(_0xc7e2('0x0'));var events=[_0xc7e2('0x1'),'remove','update'];function createListener(_0x592cbc,_0x82b9de){return function(_0x10a5cf){_0x82b9de[_0xc7e2('0x2')](_0x592cbc,_0x10a5cf);};}function removeListener(_0xc5616,_0x163e17){return function(){DashboardEvents[_0xc7e2('0x3')](_0xc5616,_0x163e17);};}exports[_0xc7e2('0x4')]=function(_0x1fdfd9){for(var _0x499241=0x0,_0x112cde=events['length'];_0x499241<_0x112cde;_0x499241++){var _0x24a08a=events[_0x499241];var _0x370525=createListener(_0xc7e2('0x5')+_0x24a08a,_0x1fdfd9);DashboardEvents['on'](_0x24a08a,_0x370525);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index dfa9873..661ff34 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 _0x9e4c=['post','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id/items','create','/:id/clone','clone'];(function(_0x5b1da0,_0x3deb4c){var _0x18c499=function(_0x36a1b5){while(--_0x36a1b5){_0x5b1da0['push'](_0x5b1da0['shift']());}};_0x18c499(++_0x3deb4c);}(_0x9e4c,0x13a));var _0xc9e4=function(_0x49edf6,_0x584ac4){_0x49edf6=_0x49edf6-0x0;var _0x35395a=_0x9e4c[_0x49edf6];return _0x35395a;};'use strict';var multer=require(_0xc9e4('0x0'));var util=require(_0xc9e4('0x1'));var path=require(_0xc9e4('0x2'));var timeout=require('connect-timeout');var express=require(_0xc9e4('0x3'));var router=express[_0xc9e4('0x4')]();var fs_extra=require(_0xc9e4('0x5'));var auth=require(_0xc9e4('0x6'));var interaction=require(_0xc9e4('0x7'));var config=require(_0xc9e4('0x8'));var controller=require(_0xc9e4('0x9'));router[_0xc9e4('0xa')]('/',auth[_0xc9e4('0xb')](),controller['index']);router[_0xc9e4('0xa')]('/:id',auth[_0xc9e4('0xb')](),controller['show']);router[_0xc9e4('0xa')](_0xc9e4('0xc'),auth[_0xc9e4('0xb')](),controller['getItems']);router['post']('/',auth[_0xc9e4('0xb')](),controller[_0xc9e4('0xd')]);router['post'](_0xc9e4('0xe'),auth[_0xc9e4('0xb')](),controller[_0xc9e4('0xf')]);router[_0xc9e4('0x10')](_0xc9e4('0xc'),auth[_0xc9e4('0xb')](),controller['addItem']);router[_0xc9e4('0x11')](_0xc9e4('0x12'),auth[_0xc9e4('0xb')](),controller[_0xc9e4('0x13')]);router['delete'](_0xc9e4('0x12'),auth[_0xc9e4('0xb')](),controller[_0xc9e4('0x14')]);module[_0xc9e4('0x15')]=router; \ No newline at end of file +var _0x1b6a=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','/:id/clone','clone','addItem','put','update','exports','multer'];(function(_0x2fe826,_0x4ec67b){var _0x417a53=function(_0x24eccc){while(--_0x24eccc){_0x2fe826['push'](_0x2fe826['shift']());}};_0x417a53(++_0x4ec67b);}(_0x1b6a,0xb7));var _0xa1b6=function(_0x489a09,_0x5043cc){_0x489a09=_0x489a09-0x0;var _0x1f12ec=_0x1b6a[_0x489a09];return _0x1f12ec;};'use strict';var multer=require(_0xa1b6('0x0'));var util=require(_0xa1b6('0x1'));var path=require('path');var timeout=require(_0xa1b6('0x2'));var express=require('express');var router=express[_0xa1b6('0x3')]();var fs_extra=require(_0xa1b6('0x4'));var auth=require(_0xa1b6('0x5'));var interaction=require(_0xa1b6('0x6'));var config=require(_0xa1b6('0x7'));var controller=require(_0xa1b6('0x8'));router[_0xa1b6('0x9')]('/',auth[_0xa1b6('0xa')](),controller[_0xa1b6('0xb')]);router['get'](_0xa1b6('0xc'),auth['isAuthenticated'](),controller[_0xa1b6('0xd')]);router[_0xa1b6('0x9')](_0xa1b6('0xe'),auth[_0xa1b6('0xa')](),controller[_0xa1b6('0xf')]);router[_0xa1b6('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa1b6('0x10')](_0xa1b6('0x11'),auth[_0xa1b6('0xa')](),controller[_0xa1b6('0x12')]);router[_0xa1b6('0x10')](_0xa1b6('0xe'),auth[_0xa1b6('0xa')](),controller[_0xa1b6('0x13')]);router[_0xa1b6('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xa1b6('0x15')]);router['delete'](_0xa1b6('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xa1b6('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index b2f4d5b..a837fb4 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 _0xeff8=['sequelize','squel','exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x43b9e1,_0x22f2d0){var _0x249f31=function(_0xa9acd0){while(--_0xa9acd0){_0x43b9e1['push'](_0x43b9e1['shift']());}};_0x249f31(++_0x22f2d0);}(_0xeff8,0x186));var _0x8eff=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0xeff8[_0x1d558c];return _0x15767d;};'use strict';var Sequelize=require(_0x8eff('0x0'));var squel=require(_0x8eff('0x1'));var _=require('lodash');module[_0x8eff('0x2')]={'title':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eff('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x8eff('0x4')),'get':function(){try{return JSON[_0x8eff('0x5')](this[_0x8eff('0x6')](_0x8eff('0x7')));}catch(_0x4ac51c){return[];}},'set':function(_0x469641){try{this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')](_0x469641));}catch(_0x491f01){this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x8eff('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x8eff('0xa')]},'background':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![],'defaultValue':_0x8eff('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8eff('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eff('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x5fab=['STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','exports'];(function(_0x2246e7,_0x58391a){var _0x1103e1=function(_0x294956){while(--_0x294956){_0x2246e7['push'](_0x2246e7['shift']());}};_0x1103e1(++_0x58391a);}(_0x5fab,0x177));var _0xb5fa=function(_0x5979e7,_0x2a8391){_0x5979e7=_0x5979e7-0x0;var _0x5b08be=_0x5fab[_0x5979e7];return _0x5b08be;};'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 diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 8375aeb..319881d 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 _0xee44=['error','widgetAttributes:\x20%s','create','body','eml-format','rimraf','moment','util','path','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','send','params','keys','DashboardItem','rawAttributes','query','filters','intersection','model','attributes','length','includeAll','include','merge','find','catch','type','attrUrl','attrs','value','https://','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh'];(function(_0x2284b5,_0x4f426e){var _0x58ce22=function(_0x27c852){while(--_0x27c852){_0x2284b5['push'](_0x2284b5['shift']());}};_0x58ce22(++_0x4f426e);}(_0xee44,0xaa));var _0x4ee4=function(_0x5d7ac5,_0x310d56){_0x5d7ac5=_0x5d7ac5-0x0;var _0x49cde8=_0xee44[_0x5d7ac5];return _0x49cde8;};'use strict';var emlformat=require(_0x4ee4('0x0'));var rimraf=require(_0x4ee4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4ee4('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ee4('0x3'));var path=require(_0x4ee4('0x4'));var sox=require('sox');var csv=require(_0x4ee4('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee4('0x6'));var squel=require(_0x4ee4('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ee4('0x8'));var toCsv=require(_0x4ee4('0x5'));var querystring=require(_0x4ee4('0x9'));var Papa=require(_0x4ee4('0xa'));var Redis=require(_0x4ee4('0xb'));var authService=require(_0x4ee4('0xc'));var qs=require(_0x4ee4('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ee4('0xe'));var logger=require(_0x4ee4('0xf'))(_0x4ee4('0x10'));var utils=require(_0x4ee4('0x11'));var config=require(_0x4ee4('0x12'));var licenseUtil=require(_0x4ee4('0x13'));var db=require(_0x4ee4('0x14'))['db'];config[_0x4ee4('0x15')]=_['defaults'](config['redis'],{'host':_0x4ee4('0x16'),'port':0x18eb});var socket=require(_0x4ee4('0x17'))(new Redis(config['redis']));require(_0x4ee4('0x18'))[_0x4ee4('0x19')](socket);function respondWithStatusCode(_0x267b1b,_0x1e32fb){_0x1e32fb=_0x1e32fb||0xcc;return function(_0x14dda4){if(_0x14dda4){return _0x267b1b[_0x4ee4('0x1a')](_0x1e32fb);}return _0x267b1b[_0x4ee4('0x1b')](_0x1e32fb)[_0x4ee4('0x1c')]();};}function respondWithResult(_0x4c7ee4,_0x27090f){_0x27090f=_0x27090f||0xc8;return function(_0x165852){if(_0x165852){return _0x4c7ee4['status'](_0x27090f)[_0x4ee4('0x1d')](_0x165852);}};}function respondWithFilteredResult(_0x195621,_0x54f701){return function(_0xf03c4e){if(_0xf03c4e){var _0x541dbf=typeof _0x54f701['offset']===_0x4ee4('0x1e')&&typeof _0x54f701[_0x4ee4('0x1f')]===_0x4ee4('0x1e');var _0x52bd2c=_0xf03c4e[_0x4ee4('0x20')];var _0x5efcae=_0x541dbf?0x0:_0x54f701[_0x4ee4('0x21')];var _0x4696be=_0x541dbf?_0xf03c4e[_0x4ee4('0x20')]:_0x54f701['offset']+_0x54f701[_0x4ee4('0x1f')];var _0x35d077;if(_0x4696be>=_0x52bd2c){_0x4696be=_0x52bd2c;_0x35d077=0xc8;}else{_0x35d077=0xce;}_0x195621['status'](_0x35d077);return _0x195621['set'](_0x4ee4('0x22'),_0x5efcae+'-'+_0x4696be+'/'+_0x52bd2c)[_0x4ee4('0x1d')](_0xf03c4e);}return null;};}function patchUpdates(_0x41405b){return function(_0x43b578){try{jsonpatch[_0x4ee4('0x23')](_0x43b578,_0x41405b,!![]);}catch(_0x55f175){return BPromise['reject'](_0x55f175);}return _0x43b578[_0x4ee4('0x24')]();};}function saveUpdates(_0x2cf2c7,_0x150c57){return function(_0x13897c){if(_0x13897c){return _0x13897c[_0x4ee4('0x25')](_0x2cf2c7)[_0x4ee4('0x26')](function(_0x216db0){return _0x216db0;});}return null;};}function removeEntity(_0x572d29,_0x2b6e25){return function(_0x43c7f9){if(_0x43c7f9){return _0x43c7f9[_0x4ee4('0x27')]()[_0x4ee4('0x26')](function(){_0x572d29[_0x4ee4('0x1b')](0xcc)[_0x4ee4('0x1c')]();});}};}function handleEntityNotFound(_0x205bcc,_0x2064c1){return function(_0x5d3e19){if(!_0x5d3e19){_0x205bcc[_0x4ee4('0x1a')](0x194);}return _0x5d3e19;};}function handleError(_0x8dd355,_0x1e64b8){_0x1e64b8=_0x1e64b8||0x1f4;return function(_0x2db03c){logger['error'](_0x2db03c[_0x4ee4('0x28')]);if(_0x2db03c[_0x4ee4('0x29')]){delete _0x2db03c[_0x4ee4('0x29')];}_0x8dd355[_0x4ee4('0x1b')](_0x1e64b8)[_0x4ee4('0x2a')](_0x2db03c);};}exports['show']=function(_0x29d459,_0x146096){var _0x5ed6ca={'raw':![],'where':{'id':_0x29d459[_0x4ee4('0x2b')]['id']}},_0x19624a={};_0x19624a['model']=_[_0x4ee4('0x2c')](db[_0x4ee4('0x2d')][_0x4ee4('0x2e')]);_0x19624a[_0x4ee4('0x2f')]=_['keys'](_0x29d459['query']);_0x19624a[_0x4ee4('0x30')]=_[_0x4ee4('0x31')](_0x19624a[_0x4ee4('0x32')],_0x19624a[_0x4ee4('0x2f')]);_0x5ed6ca[_0x4ee4('0x33')]=_[_0x4ee4('0x31')](_0x19624a['model'],qs['fields'](_0x29d459[_0x4ee4('0x2f')]['fields']));_0x5ed6ca['attributes']=_0x5ed6ca[_0x4ee4('0x33')][_0x4ee4('0x34')]?_0x5ed6ca[_0x4ee4('0x33')]:_0x19624a['model'];if(_0x29d459[_0x4ee4('0x2f')][_0x4ee4('0x35')]){_0x5ed6ca[_0x4ee4('0x36')]=[{'all':!![]}];}_0x5ed6ca=_[_0x4ee4('0x37')]({},_0x5ed6ca,_0x29d459['options']);return db[_0x4ee4('0x2d')][_0x4ee4('0x38')](_0x5ed6ca)[_0x4ee4('0x26')](handleEntityNotFound(_0x146096,null))[_0x4ee4('0x26')](respondWithResult(_0x146096,null))['catch'](handleError(_0x146096,null));};exports[_0x4ee4('0x27')]=function(_0x2e1735,_0x4f322d){return db[_0x4ee4('0x2d')]['find']({'where':{'id':_0x2e1735['params']['id']}})[_0x4ee4('0x26')](handleEntityNotFound(_0x4f322d,null))[_0x4ee4('0x26')](removeEntity(_0x4f322d,null))[_0x4ee4('0x39')](handleError(_0x4f322d,null));};function widgetAttributes(_0xf9180d){try{switch(_0xf9180d[_0x4ee4('0x3a')]){case'iframe':return[{'name':_0x4ee4('0x3b'),'value':_0xf9180d[_0x4ee4('0x3b')]||(_0xf9180d[_0x4ee4('0x3c')]&&_0xf9180d[_0x4ee4('0x3c')][0x0]?_0xf9180d[_0x4ee4('0x3c')][0x0][_0x4ee4('0x3d')]:undefined)||_0x4ee4('0x3e')}];case'custom':return[{'name':'attrPath','value':_0xf9180d['attrPath']||(_0xf9180d[_0x4ee4('0x3c')]&&_0xf9180d[_0x4ee4('0x3c')][0x0]?_0xf9180d[_0x4ee4('0x3c')][0x0]['value']:undefined)||''}];case _0x4ee4('0x3f'):return[{'name':'attrHourFormat','value':_0xf9180d[_0x4ee4('0x40')]||(_0xf9180d['attrs']&&_0xf9180d['attrs'][0x0]?_0xf9180d[_0x4ee4('0x3c')][0x0][_0x4ee4('0x3d')]:undefined)||_0x4ee4('0x41')},{'name':_0x4ee4('0x42'),'value':_0xf9180d[_0x4ee4('0x42')]||(_0xf9180d[_0x4ee4('0x3c')]&&_0xf9180d[_0x4ee4('0x3c')][0x1]?_0xf9180d[_0x4ee4('0x3c')][0x1]['value']:undefined)||'0.00'},{'name':_0x4ee4('0x43'),'value':_0xf9180d[_0x4ee4('0x43')]||(_0xf9180d[_0x4ee4('0x3c')]&&_0xf9180d[_0x4ee4('0x3c')][0x2]?_0xf9180d['attrs'][0x2]['value']:undefined)||0xc}];case _0x4ee4('0x44'):return[{'name':_0x4ee4('0x45'),'value':_0xf9180d[_0x4ee4('0x45')]||(_0xf9180d['attrs']&&_0xf9180d[_0x4ee4('0x3c')][0x0]?_0xf9180d[_0x4ee4('0x3c')][0x0][_0x4ee4('0x3d')]:undefined)||_0x4ee4('0x46')},{'name':_0x4ee4('0x47'),'value':_0xf9180d[_0x4ee4('0x47')]||(_0xf9180d[_0x4ee4('0x3c')]&&_0xf9180d[_0x4ee4('0x3c')][0x1]?_0xf9180d['attrs'][0x1][_0x4ee4('0x3d')]:undefined)||[]},{'name':_0x4ee4('0x43'),'value':_0xf9180d[_0x4ee4('0x43')]||(_0xf9180d['attrs']&&_0xf9180d[_0x4ee4('0x3c')][0x2]?_0xf9180d[_0x4ee4('0x3c')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0x4ee4('0x48'),'value':_0xf9180d[_0x4ee4('0x48')]||(_0xf9180d[_0x4ee4('0x3c')]&&_0xf9180d[_0x4ee4('0x3c')][0x0]?_0xf9180d[_0x4ee4('0x3c')][0x0][_0x4ee4('0x3d')]:undefined)||_0x4ee4('0x46')},{'name':_0x4ee4('0x49'),'value':_0xf9180d[_0x4ee4('0x49')]||(_0xf9180d[_0x4ee4('0x3c')]&&_0xf9180d[_0x4ee4('0x3c')][0x1]?_0xf9180d['attrs'][0x1][_0x4ee4('0x3d')]:undefined)||null},{'name':_0x4ee4('0x4a'),'value':_0xf9180d['attrSerie3']||(_0xf9180d[_0x4ee4('0x3c')]&&_0xf9180d[_0x4ee4('0x3c')][0x2]?_0xf9180d[_0x4ee4('0x3c')][0x2]['value']:undefined)||null},{'name':_0x4ee4('0x47'),'value':_0xf9180d[_0x4ee4('0x47')]||(_0xf9180d[_0x4ee4('0x3c')]&&_0xf9180d[_0x4ee4('0x3c')][0x3]?_0xf9180d['attrs'][0x3][_0x4ee4('0x3d')]:undefined)||[]}];case _0x4ee4('0x4b'):return[{'name':'attrReport','type':_0xf9180d[_0x4ee4('0x4c')]||(_0xf9180d[_0x4ee4('0x3c')]&&_0xf9180d['attrs'][0x0]?_0xf9180d[_0x4ee4('0x3c')][0x0][_0x4ee4('0x3a')]:undefined)||null,'value':_0xf9180d[_0x4ee4('0x4d')]||(_0xf9180d[_0x4ee4('0x3c')]&&_0xf9180d['attrs'][0x0]?_0xf9180d[_0x4ee4('0x3c')][0x0][_0x4ee4('0x3d')]:undefined)||null},{'name':_0x4ee4('0x4e'),'value':_0xf9180d[_0x4ee4('0x4e')]||(_0xf9180d[_0x4ee4('0x3c')]&&_0xf9180d['attrs'][0x1]?_0xf9180d[_0x4ee4('0x3c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x47150f){logger[_0x4ee4('0x4f')](_0x4ee4('0x50'),JSON['stringify'](_0x47150f));return[];}}exports[_0x4ee4('0x51')]=function(_0x2dbced,_0x1e003d){if(_0x2dbced[_0x4ee4('0x52')]){_0x2dbced['body'][_0x4ee4('0x3c')]=widgetAttributes(_0x2dbced[_0x4ee4('0x52')]);}return db['DashboardItem']['create'](_0x2dbced['body'],{})[_0x4ee4('0x26')](respondWithResult(_0x1e003d,0xc9))['catch'](handleError(_0x1e003d,null));};exports[_0x4ee4('0x25')]=function(_0x12b41a,_0x47a342){if(_0x12b41a['body']['id']){delete _0x12b41a['body']['id'];}_0x12b41a['body']['attrs']=widgetAttributes(_0x12b41a[_0x4ee4('0x52')]);return db['DashboardItem'][_0x4ee4('0x38')]({'where':{'id':_0x12b41a['params']['id']}})['then'](handleEntityNotFound(_0x47a342,null))[_0x4ee4('0x26')](saveUpdates(_0x12b41a[_0x4ee4('0x52')],null))[_0x4ee4('0x26')](respondWithResult(_0x47a342,null))[_0x4ee4('0x39')](handleError(_0x47a342,null));}; \ No newline at end of file +var _0xaa2d=['intersection','fields','length','include','options','DashboardItem','find','catch','destroy','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','reportType','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','localhost','redis','./dashboardItem.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','params','model','query','keys','filters','attributes'];(function(_0x58587b,_0x382281){var _0x2567be=function(_0x4eb844){while(--_0x4eb844){_0x58587b['push'](_0x58587b['shift']());}};_0x2567be(++_0x382281);}(_0xaa2d,0xcc));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xdaa2('0x0'));var rimraf=require(_0xdaa2('0x1'));var zipdir=require(_0xdaa2('0x2'));var jsonpatch=require(_0xdaa2('0x3'));var rp=require('request-promise');var moment=require(_0xdaa2('0x4'));var BPromise=require(_0xdaa2('0x5'));var Mustache=require(_0xdaa2('0x6'));var util=require(_0xdaa2('0x7'));var path=require(_0xdaa2('0x8'));var sox=require(_0xdaa2('0x9'));var csv=require(_0xdaa2('0xa'));var ejs=require(_0xdaa2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaa2('0xc'));var squel=require(_0xdaa2('0xd'));var crypto=require(_0xdaa2('0xe'));var jsforce=require(_0xdaa2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdaa2('0x10'));var authService=require(_0xdaa2('0x11'));var qs=require(_0xdaa2('0x12'));var as=require(_0xdaa2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdaa2('0x14'))('api');var utils=require(_0xdaa2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdaa2('0x16'));var db=require(_0xdaa2('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xdaa2('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdaa2('0x19')]));require(_0xdaa2('0x1a'))['register'](socket);function respondWithStatusCode(_0xaa1b93,_0x5838b7){_0x5838b7=_0x5838b7||0xcc;return function(_0x304fbe){if(_0x304fbe){return _0xaa1b93['sendStatus'](_0x5838b7);}return _0xaa1b93[_0xdaa2('0x1b')](_0x5838b7)[_0xdaa2('0x1c')]();};}function respondWithResult(_0x4594b5,_0x196ccd){_0x196ccd=_0x196ccd||0xc8;return function(_0x2bc664){if(_0x2bc664){return _0x4594b5[_0xdaa2('0x1b')](_0x196ccd)[_0xdaa2('0x1d')](_0x2bc664);}};}function respondWithFilteredResult(_0x544854,_0x4cd68d){return function(_0x8f5ca2){if(_0x8f5ca2){var _0x56e1e3=typeof _0x4cd68d[_0xdaa2('0x1e')]===_0xdaa2('0x1f')&&typeof _0x4cd68d[_0xdaa2('0x20')]===_0xdaa2('0x1f');var _0x375715=_0x8f5ca2[_0xdaa2('0x21')];var _0x315033=_0x56e1e3?0x0:_0x4cd68d['offset'];var _0x2197c4=_0x56e1e3?_0x8f5ca2[_0xdaa2('0x21')]:_0x4cd68d[_0xdaa2('0x1e')]+_0x4cd68d[_0xdaa2('0x20')];var _0x384d46;if(_0x2197c4>=_0x375715){_0x2197c4=_0x375715;_0x384d46=0xc8;}else{_0x384d46=0xce;}_0x544854[_0xdaa2('0x1b')](_0x384d46);return _0x544854[_0xdaa2('0x22')](_0xdaa2('0x23'),_0x315033+'-'+_0x2197c4+'/'+_0x375715)[_0xdaa2('0x1d')](_0x8f5ca2);}return null;};}function patchUpdates(_0x3ce52b){return function(_0x191fc2){try{jsonpatch[_0xdaa2('0x24')](_0x191fc2,_0x3ce52b,!![]);}catch(_0xc09c42){return BPromise[_0xdaa2('0x25')](_0xc09c42);}return _0x191fc2[_0xdaa2('0x26')]();};}function saveUpdates(_0x3ebe67,_0x65f920){return function(_0x36fd55){if(_0x36fd55){return _0x36fd55['update'](_0x3ebe67)[_0xdaa2('0x27')](function(_0x5c4279){return _0x5c4279;});}return null;};}function removeEntity(_0x37b757,_0xd866e){return function(_0x817d7f){if(_0x817d7f){return _0x817d7f['destroy']()[_0xdaa2('0x27')](function(){_0x37b757[_0xdaa2('0x1b')](0xcc)[_0xdaa2('0x1c')]();});}};}function handleEntityNotFound(_0x9341b7,_0x6aa21e){return function(_0x5ec851){if(!_0x5ec851){_0x9341b7[_0xdaa2('0x28')](0x194);}return _0x5ec851;};}function handleError(_0xb6a18c,_0x16ca27){_0x16ca27=_0x16ca27||0x1f4;return function(_0x3216c6){logger[_0xdaa2('0x29')](_0x3216c6[_0xdaa2('0x2a')]);if(_0x3216c6['name']){delete _0x3216c6[_0xdaa2('0x2b')];}_0xb6a18c[_0xdaa2('0x1b')](_0x16ca27)[_0xdaa2('0x2c')](_0x3216c6);};}exports['show']=function(_0x38cc4d,_0x378442){var _0x5869cd={'raw':![],'where':{'id':_0x38cc4d[_0xdaa2('0x2d')]['id']}},_0x23ed1f={};_0x23ed1f[_0xdaa2('0x2e')]=_['keys'](db['DashboardItem']['rawAttributes']);_0x23ed1f[_0xdaa2('0x2f')]=_[_0xdaa2('0x30')](_0x38cc4d[_0xdaa2('0x2f')]);_0x23ed1f[_0xdaa2('0x31')]=_['intersection'](_0x23ed1f[_0xdaa2('0x2e')],_0x23ed1f['query']);_0x5869cd[_0xdaa2('0x32')]=_[_0xdaa2('0x33')](_0x23ed1f[_0xdaa2('0x2e')],qs[_0xdaa2('0x34')](_0x38cc4d[_0xdaa2('0x2f')][_0xdaa2('0x34')]));_0x5869cd[_0xdaa2('0x32')]=_0x5869cd[_0xdaa2('0x32')][_0xdaa2('0x35')]?_0x5869cd[_0xdaa2('0x32')]:_0x23ed1f[_0xdaa2('0x2e')];if(_0x38cc4d['query']['includeAll']){_0x5869cd[_0xdaa2('0x36')]=[{'all':!![]}];}_0x5869cd=_['merge']({},_0x5869cd,_0x38cc4d[_0xdaa2('0x37')]);return db[_0xdaa2('0x38')][_0xdaa2('0x39')](_0x5869cd)['then'](handleEntityNotFound(_0x378442,null))[_0xdaa2('0x27')](respondWithResult(_0x378442,null))[_0xdaa2('0x3a')](handleError(_0x378442,null));};exports[_0xdaa2('0x3b')]=function(_0x27165d,_0x5af1ce){return db[_0xdaa2('0x38')]['find']({'where':{'id':_0x27165d[_0xdaa2('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5af1ce,null))['then'](removeEntity(_0x5af1ce,null))[_0xdaa2('0x3a')](handleError(_0x5af1ce,null));};function widgetAttributes(_0x3578c0){try{switch(_0x3578c0[_0xdaa2('0x3c')]){case _0xdaa2('0x3d'):return[{'name':_0xdaa2('0x3e'),'value':_0x3578c0[_0xdaa2('0x3e')]||(_0x3578c0['attrs']&&_0x3578c0[_0xdaa2('0x3f')][0x0]?_0x3578c0[_0xdaa2('0x3f')][0x0][_0xdaa2('0x40')]:undefined)||_0xdaa2('0x41')}];case _0xdaa2('0x42'):return[{'name':_0xdaa2('0x43'),'value':_0x3578c0[_0xdaa2('0x43')]||(_0x3578c0[_0xdaa2('0x3f')]&&_0x3578c0[_0xdaa2('0x3f')][0x0]?_0x3578c0[_0xdaa2('0x3f')][0x0][_0xdaa2('0x40')]:undefined)||''}];case _0xdaa2('0x44'):return[{'name':_0xdaa2('0x45'),'value':_0x3578c0['attrHourFormat']||(_0x3578c0[_0xdaa2('0x3f')]&&_0x3578c0[_0xdaa2('0x3f')][0x0]?_0x3578c0[_0xdaa2('0x3f')][0x0][_0xdaa2('0x40')]:undefined)||'HH:mm:ss'},{'name':_0xdaa2('0x46'),'value':_0x3578c0[_0xdaa2('0x46')]||(_0x3578c0['attrs']&&_0x3578c0[_0xdaa2('0x3f')][0x1]?_0x3578c0['attrs'][0x1][_0xdaa2('0x40')]:undefined)||'0.00'},{'name':_0xdaa2('0x47'),'value':_0x3578c0['attrFontSize']||(_0x3578c0[_0xdaa2('0x3f')]&&_0x3578c0[_0xdaa2('0x3f')][0x2]?_0x3578c0['attrs'][0x2][_0xdaa2('0x40')]:undefined)||0xc}];case _0xdaa2('0x48'):return[{'name':_0xdaa2('0x49'),'value':_0x3578c0['attrMetric']||(_0x3578c0[_0xdaa2('0x3f')]&&_0x3578c0['attrs'][0x0]?_0x3578c0[_0xdaa2('0x3f')][0x0][_0xdaa2('0x40')]:undefined)||'total'},{'name':_0xdaa2('0x4a'),'value':_0x3578c0[_0xdaa2('0x4a')]||(_0x3578c0['attrs']&&_0x3578c0[_0xdaa2('0x3f')][0x1]?_0x3578c0[_0xdaa2('0x3f')][0x1][_0xdaa2('0x40')]:undefined)||[]},{'name':_0xdaa2('0x47'),'value':_0x3578c0[_0xdaa2('0x47')]||(_0x3578c0[_0xdaa2('0x3f')]&&_0x3578c0[_0xdaa2('0x3f')][0x2]?_0x3578c0['attrs'][0x2][_0xdaa2('0x40')]:undefined)||0x14}];case'multibar-chart':case _0xdaa2('0x4b'):return[{'name':_0xdaa2('0x4c'),'value':_0x3578c0['attrSerie1']||(_0x3578c0[_0xdaa2('0x3f')]&&_0x3578c0['attrs'][0x0]?_0x3578c0[_0xdaa2('0x3f')][0x0]['value']:undefined)||_0xdaa2('0x4d')},{'name':_0xdaa2('0x4e'),'value':_0x3578c0[_0xdaa2('0x4e')]||(_0x3578c0[_0xdaa2('0x3f')]&&_0x3578c0[_0xdaa2('0x3f')][0x1]?_0x3578c0[_0xdaa2('0x3f')][0x1][_0xdaa2('0x40')]:undefined)||null},{'name':'attrSerie3','value':_0x3578c0[_0xdaa2('0x4f')]||(_0x3578c0[_0xdaa2('0x3f')]&&_0x3578c0[_0xdaa2('0x3f')][0x2]?_0x3578c0[_0xdaa2('0x3f')][0x2][_0xdaa2('0x40')]:undefined)||null},{'name':_0xdaa2('0x4a'),'value':_0x3578c0['attrVoiceQueues']||(_0x3578c0[_0xdaa2('0x3f')]&&_0x3578c0[_0xdaa2('0x3f')][0x3]?_0x3578c0[_0xdaa2('0x3f')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0xdaa2('0x50'),'type':_0x3578c0[_0xdaa2('0x51')]||(_0x3578c0[_0xdaa2('0x3f')]&&_0x3578c0[_0xdaa2('0x3f')][0x0]?_0x3578c0[_0xdaa2('0x3f')][0x0][_0xdaa2('0x3c')]:undefined)||null,'value':_0x3578c0[_0xdaa2('0x50')]||(_0x3578c0[_0xdaa2('0x3f')]&&_0x3578c0['attrs'][0x0]?_0x3578c0[_0xdaa2('0x3f')][0x0][_0xdaa2('0x40')]:undefined)||null},{'name':'attrRefresh','value':_0x3578c0['attrRefresh']||(_0x3578c0[_0xdaa2('0x3f')]&&_0x3578c0[_0xdaa2('0x3f')][0x1]?_0x3578c0[_0xdaa2('0x3f')][0x1][_0xdaa2('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x55a4b6){logger[_0xdaa2('0x29')]('widgetAttributes:\x20%s',JSON['stringify'](_0x55a4b6));return[];}}exports[_0xdaa2('0x52')]=function(_0x3937bc,_0x1c460c){if(_0x3937bc[_0xdaa2('0x53')]){_0x3937bc['body'][_0xdaa2('0x3f')]=widgetAttributes(_0x3937bc['body']);}return db['DashboardItem'][_0xdaa2('0x52')](_0x3937bc[_0xdaa2('0x53')],{})[_0xdaa2('0x27')](respondWithResult(_0x1c460c,0xc9))[_0xdaa2('0x3a')](handleError(_0x1c460c,null));};exports[_0xdaa2('0x54')]=function(_0x48c4d5,_0x1054db){if(_0x48c4d5[_0xdaa2('0x53')]['id']){delete _0x48c4d5[_0xdaa2('0x53')]['id'];}_0x48c4d5[_0xdaa2('0x53')][_0xdaa2('0x3f')]=widgetAttributes(_0x48c4d5[_0xdaa2('0x53')]);return db[_0xdaa2('0x38')][_0xdaa2('0x39')]({'where':{'id':_0x48c4d5[_0xdaa2('0x2d')]['id']}})['then'](handleEntityNotFound(_0x1054db,null))[_0xdaa2('0x27')](saveUpdates(_0x48c4d5['body'],null))[_0xdaa2('0x27')](respondWithResult(_0x1054db,null))[_0xdaa2('0x3a')](handleError(_0x1054db,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 5a9c5c0..b30a594 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 _0x046b=['hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x046b,0x1ba));var _0xb046=function(_0x237f36,_0x1c5614){_0x237f36=_0x237f36-0x0;var _0x12e837=_0x046b[_0x237f36];return _0x12e837;};'use strict';var EventEmitter=require(_0xb046('0x0'));var DashboardItem=require(_0xb046('0x1'))['db'][_0xb046('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb046('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb046('0x4'),'afterDestroy':_0xb046('0x5')};function emitEvent(_0x599c99){return function(_0x17c796,_0x3f8fe4,_0x645827){DashboardItemEvents[_0xb046('0x6')](_0x599c99+':'+_0x17c796['id'],_0x17c796);DashboardItemEvents[_0xb046('0x6')](_0x599c99,_0x17c796);_0x645827(null);};}for(var e in events){if(events[_0xb046('0x7')](e)){var event=events[e];DashboardItem[_0xb046('0x8')](e,emitEvent(event));}}module[_0xb046('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x4293=['setMaxListeners','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x12faf7,_0x23c078){var _0x550dc8=function(_0x52fca9){while(--_0x52fca9){_0x12faf7['push'](_0x12faf7['shift']());}};_0x550dc8(++_0x23c078);}(_0x4293,0x163));var _0x3429=function(_0x157d79,_0x5a5090){_0x157d79=_0x157d79-0x0;var _0x1fd201=_0x4293[_0x157d79];return _0x1fd201;};'use strict';var EventEmitter=require(_0x3429('0x0'));var DashboardItem=require(_0x3429('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x3429('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3429('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4fb712){return function(_0x1548a8,_0x3e2d2f,_0x4ec54b){DashboardItemEvents[_0x3429('0x4')](_0x4fb712+':'+_0x1548a8['id'],_0x1548a8);DashboardItemEvents[_0x3429('0x4')](_0x4fb712,_0x1548a8);_0x4ec54b(null);};}for(var e in events){if(events[_0x3429('0x5')](e)){var event=events[e];DashboardItem[_0x3429('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 6e0375b..6e6c7a7 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 _0xdc53=['define','DashboardItem','lodash','util','api','moment','bluebird','path','rimraf','exports'];(function(_0x57fc92,_0x59dee6){var _0x16cb7e=function(_0xcf8039){while(--_0xcf8039){_0x57fc92['push'](_0x57fc92['shift']());}};_0x16cb7e(++_0x59dee6);}(_0xdc53,0xa2));var _0x3dc5=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xdc53[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require(_0x3dc5('0x0'));var util=require(_0x3dc5('0x1'));var logger=require('../../config/logger')(_0x3dc5('0x2'));var moment=require(_0x3dc5('0x3'));var BPromise=require(_0x3dc5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3dc5('0x5'));var rimraf=require(_0x3dc5('0x6'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0x3dc5('0x7')]=function(_0x251722,_0x417c22){return _0x251722[_0x3dc5('0x8')](_0x3dc5('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf628=['../../config/environment','exports','define','DashboardItem','lodash','api','moment','bluebird'];(function(_0x353b25,_0xed9913){var _0x111faa=function(_0x689122){while(--_0x689122){_0x353b25['push'](_0x353b25['shift']());}};_0x111faa(++_0xed9913);}(_0xf628,0x114));var _0x8f62=function(_0x2a7095,_0x556324){_0x2a7095=_0x2a7095-0x0;var _0x2bc03a=_0xf628[_0x2a7095];return _0x2bc03a;};'use strict';var _=require(_0x8f62('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8f62('0x1'));var moment=require(_0x8f62('0x2'));var BPromise=require(_0x8f62('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8f62('0x4'));var attributes=require('./dashboardItem.attributes');module[_0x8f62('0x5')]=function(_0x50fde5,_0x34f0ac){return _0x50fde5[_0x8f62('0x6')](_0x8f62('0x7'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 0a8cf3f..daab6b1 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 _0x3deb=['socket.io-emitter','redis','./dashboardItem.socket','register','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost'];(function(_0x31825b,_0x410bce){var _0x3e2224=function(_0x1f18c4){while(--_0x1f18c4){_0x31825b['push'](_0x31825b['shift']());}};_0x3e2224(++_0x410bce);}(_0x3deb,0x195));var _0xb3de=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3deb[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xb3de('0x0'));var util=require(_0xb3de('0x1'));var moment=require(_0xb3de('0x2'));var BPromise=require(_0xb3de('0x3'));var rs=require(_0xb3de('0x4'));var fs=require('fs');var Redis=require(_0xb3de('0x5'));var db=require(_0xb3de('0x6'))['db'];var utils=require(_0xb3de('0x7'));var logger=require(_0xb3de('0x8'))(_0xb3de('0x9'));var config=require(_0xb3de('0xa'));var jayson=require(_0xb3de('0xb'));var client=jayson[_0xb3de('0xc')][_0xb3de('0xd')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xb3de('0xe'),'port':0x18eb});var socket=require(_0xb3de('0xf'))(new Redis(config[_0xb3de('0x10')]));require(_0xb3de('0x11'))[_0xb3de('0x12')](socket);function respondWithRpcPromise(_0x13be5b,_0x9b8629,_0x2f0107){return new BPromise(function(_0x35a58d,_0x11bbc3){return client['request'](_0x13be5b,_0x2f0107)[_0xb3de('0x13')](function(_0xc0e06f){logger['info'](_0xb3de('0x14'),_0x9b8629,_0xb3de('0x15'));logger[_0xb3de('0x16')](_0xb3de('0x17'),_0x9b8629,_0xb3de('0x15'),JSON[_0xb3de('0x18')](_0xc0e06f));if(_0xc0e06f['error']){if(_0xc0e06f[_0xb3de('0x19')]['code']===0x1f4){logger['error'](_0xb3de('0x14'),_0x9b8629,_0xc0e06f[_0xb3de('0x19')]['message']);return _0x11bbc3(_0xc0e06f['error'][_0xb3de('0x1a')]);}logger[_0xb3de('0x19')]('DashboardItem,\x20%s,\x20%s',_0x9b8629,_0xc0e06f[_0xb3de('0x19')][_0xb3de('0x1a')]);return _0x35a58d(_0xc0e06f[_0xb3de('0x19')][_0xb3de('0x1a')]);}else{logger[_0xb3de('0x1b')](_0xb3de('0x14'),_0x9b8629,_0xb3de('0x15'));_0x35a58d(_0xc0e06f[_0xb3de('0x1c')]['message']);}})[_0xb3de('0x1d')](function(_0x4855aa){logger['error'](_0xb3de('0x14'),_0x9b8629,_0x4855aa);_0x11bbc3(_0x4855aa);});});} \ No newline at end of file +var _0xd2c4=['request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s'];(function(_0x57e8f9,_0x1bd8b1){var _0x177365=function(_0x3a6532){while(--_0x3a6532){_0x57e8f9['push'](_0x57e8f9['shift']());}};_0x177365(++_0x1bd8b1);}(_0xd2c4,0x1b9));var _0x4d2c=function(_0x7cdaf1,_0x40e620){_0x7cdaf1=_0x7cdaf1-0x0;var _0xf58e9a=_0xd2c4[_0x7cdaf1];return _0xf58e9a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4d2c('0x0'));var BPromise=require(_0x4d2c('0x1'));var rs=require(_0x4d2c('0x2'));var fs=require('fs');var Redis=require(_0x4d2c('0x3'));var db=require(_0x4d2c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4d2c('0x5'));var config=require(_0x4d2c('0x6'));var jayson=require(_0x4d2c('0x7'));var client=jayson[_0x4d2c('0x8')]['http']({'port':0x232a});config['redis']=_[_0x4d2c('0x9')](config[_0x4d2c('0xa')],{'host':_0x4d2c('0xb'),'port':0x18eb});var socket=require(_0x4d2c('0xc'))(new Redis(config[_0x4d2c('0xa')]));require(_0x4d2c('0xd'))[_0x4d2c('0xe')](socket);function respondWithRpcPromise(_0x23b6fd,_0x48094a,_0x4bf810){return new BPromise(function(_0x1c9051,_0xd0b4c2){return client[_0x4d2c('0xf')](_0x23b6fd,_0x4bf810)[_0x4d2c('0x10')](function(_0x2db5b7){logger['info'](_0x4d2c('0x11'),_0x48094a,_0x4d2c('0x12'));logger[_0x4d2c('0x13')](_0x4d2c('0x14'),_0x48094a,_0x4d2c('0x12'),JSON[_0x4d2c('0x15')](_0x2db5b7));if(_0x2db5b7[_0x4d2c('0x16')]){if(_0x2db5b7['error'][_0x4d2c('0x17')]===0x1f4){logger[_0x4d2c('0x16')](_0x4d2c('0x11'),_0x48094a,_0x2db5b7[_0x4d2c('0x16')][_0x4d2c('0x18')]);return _0xd0b4c2(_0x2db5b7[_0x4d2c('0x16')]['message']);}logger[_0x4d2c('0x16')](_0x4d2c('0x11'),_0x48094a,_0x2db5b7[_0x4d2c('0x16')][_0x4d2c('0x18')]);return _0x1c9051(_0x2db5b7['error']['message']);}else{logger[_0x4d2c('0x19')](_0x4d2c('0x11'),_0x48094a,'request\x20sent');_0x1c9051(_0x2db5b7['result'][_0x4d2c('0x18')]);}})[_0x4d2c('0x1a')](function(_0x505236){logger[_0x4d2c('0x16')](_0x4d2c('0x11'),_0x48094a,_0x505236);_0xd0b4c2(_0x505236);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 09c0e86..1dc50ee 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 _0xc82b=['emit','removeListener','register','dashboardItem:','save'];(function(_0x115f37,_0x490587){var _0x124540=function(_0x3bcb2a){while(--_0x3bcb2a){_0x115f37['push'](_0x115f37['shift']());}};_0x124540(++_0x490587);}(_0xc82b,0xd6));var _0xbc82=function(_0x28fb4c,_0x2a1644){_0x28fb4c=_0x28fb4c-0x0;var _0x5835c1=_0xc82b[_0x28fb4c];return _0x5835c1;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xbc82('0x0'),'remove','update'];function createListener(_0x2d18fa,_0x5b2ec1){return function(_0x12b267){_0x5b2ec1[_0xbc82('0x1')](_0x2d18fa,_0x12b267);};}function removeListener(_0x3a55ae,_0x23c4e5){return function(){DashboardItemEvents[_0xbc82('0x2')](_0x3a55ae,_0x23c4e5);};}exports[_0xbc82('0x3')]=function(_0x51da74){for(var _0x419d7c=0x0,_0x271d73=events['length'];_0x419d7c<_0x271d73;_0x419d7c++){var _0x2e5b2c=events[_0x419d7c];var _0x1e833b=createListener(_0xbc82('0x4')+_0x2e5b2c,_0x51da74);DashboardItemEvents['on'](_0x2e5b2c,_0x1e833b);}}; \ No newline at end of file +var _0xc1eb=['register','length','dashboardItem:','./dashboardItem.events','save','remove','update','removeListener'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0xc1eb,0x83));var _0xbc1e=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0xc1eb[_0x5a5395];return _0x4da43d;};'use strict';var DashboardItemEvents=require(_0xbc1e('0x0'));var events=[_0xbc1e('0x1'),_0xbc1e('0x2'),_0xbc1e('0x3')];function createListener(_0x4b1037,_0x9f0bf){return function(_0x32c790){_0x9f0bf['emit'](_0x4b1037,_0x32c790);};}function removeListener(_0x3391c5,_0x2cb609){return function(){DashboardItemEvents[_0xbc1e('0x4')](_0x3391c5,_0x2cb609);};}exports[_0xbc1e('0x5')]=function(_0x3822ac){for(var _0x167d6a=0x0,_0x12d522=events[_0xbc1e('0x6')];_0x167d6a<_0x12d522;_0x167d6a++){var _0x24a089=events[_0x167d6a];var _0x3ef6cd=createListener(_0xbc1e('0x7')+_0x24a089,_0x3822ac);DashboardItemEvents['on'](_0x24a089,_0x3ef6cd);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 29d6d17..061b990 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 _0xfa77=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x1561cf,_0x1c0144){var _0x284ba2=function(_0x4c454f){while(--_0x4c454f){_0x1561cf['push'](_0x1561cf['shift']());}};_0x284ba2(++_0x1c0144);}(_0xfa77,0x1cf));var _0x7fa7=function(_0x42239c,_0x2f5c1c){_0x42239c=_0x42239c-0x0;var _0x58e12c=_0xfa77[_0x42239c];return _0x58e12c;};'use strict';var multer=require('multer');var util=require(_0x7fa7('0x0'));var path=require(_0x7fa7('0x1'));var timeout=require(_0x7fa7('0x2'));var express=require(_0x7fa7('0x3'));var router=express['Router']();var fs_extra=require(_0x7fa7('0x4'));var auth=require(_0x7fa7('0x5'));var interaction=require(_0x7fa7('0x6'));var config=require(_0x7fa7('0x7'));var controller=require(_0x7fa7('0x8'));router[_0x7fa7('0x9')](_0x7fa7('0xa'),auth[_0x7fa7('0xb')](),controller['show']);router[_0x7fa7('0xc')]('/',auth['isAuthenticated'](),controller[_0x7fa7('0xd')]);router[_0x7fa7('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7fa7('0xf')]);router[_0x7fa7('0x10')](_0x7fa7('0xa'),auth[_0x7fa7('0xb')](),controller['destroy']);module[_0x7fa7('0x11')]=router; \ No newline at end of file +var _0x32c3=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','exports'];(function(_0x211f68,_0x47a58a){var _0x13604e=function(_0x23a402){while(--_0x23a402){_0x211f68['push'](_0x211f68['shift']());}};_0x13604e(++_0x47a58a);}(_0x32c3,0x1ce));var _0x332c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x32c3[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x332c('0x0'));var util=require('util');var path=require(_0x332c('0x1'));var timeout=require(_0x332c('0x2'));var express=require(_0x332c('0x3'));var router=express[_0x332c('0x4')]();var fs_extra=require(_0x332c('0x5'));var auth=require(_0x332c('0x6'));var interaction=require(_0x332c('0x7'));var config=require(_0x332c('0x8'));var controller=require(_0x332c('0x9'));router[_0x332c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x332c('0xb')]);router[_0x332c('0xc')]('/',auth[_0x332c('0xd')](),controller[_0x332c('0xe')]);router[_0x332c('0xf')](_0x332c('0x10'),auth['isAuthenticated'](),controller[_0x332c('0x11')]);router[_0x332c('0x12')](_0x332c('0x10'),auth[_0x332c('0xd')](),controller[_0x332c('0x13')]);module[_0x332c('0x14')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index e022f66..977552a 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 _0xf634=['STRING','ENUM','first','second','sequelize'];(function(_0x31ce3d,_0x581047){var _0x203d95=function(_0x9b9243){while(--_0x9b9243){_0x31ce3d['push'](_0x31ce3d['shift']());}};_0x203d95(++_0x581047);}(_0xf634,0x1df));var _0x4f63=function(_0x3d5c9b,_0xb684a7){_0x3d5c9b=_0x3d5c9b-0x0;var _0x14d944=_0xf634[_0x3d5c9b];return _0x14d944;};'use strict';var Sequelize=require(_0x4f63('0x0'));module['exports']={'name':{'type':Sequelize[_0x4f63('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x4f63('0x2')](_0x4f63('0x3'),_0x4f63('0x4'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x4f63('0x1')]}}; \ No newline at end of file +var _0x6287=['STRING','sequelize','exports','first','second','third'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6287,0x1f3));var _0x7628=function(_0x2e8a70,_0x43d2b0){_0x2e8a70=_0x2e8a70-0x0;var _0x1ffcdf=_0x6287[_0x2e8a70];return _0x1ffcdf;};'use strict';var Sequelize=require(_0x7628('0x0'));module[_0x7628('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x7628('0x2'),_0x7628('0x3'),_0x7628('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x7628('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 3027549..1a9ff4f 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 _0x1c45=['error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','count','includeAll','include','Disposition','rows','catch','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','update','eml-format','rimraf','zip-dir','fast-json-patch','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','then','destroy','get','UserProfileResource'];(function(_0x213a45,_0x22fa7f){var _0x4e3aa9=function(_0x1d401c){while(--_0x1d401c){_0x213a45['push'](_0x213a45['shift']());}};_0x4e3aa9(++_0x22fa7f);}(_0x1c45,0x7f));var _0x51c4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1c45[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x51c4('0x0'));var rimraf=require(_0x51c4('0x1'));var zipdir=require(_0x51c4('0x2'));var jsonpatch=require(_0x51c4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x51c4('0x4'));var sox=require(_0x51c4('0x5'));var csv=require('to-csv');var ejs=require(_0x51c4('0x6'));var fs=require('fs');var fs_extra=require(_0x51c4('0x7'));var _=require(_0x51c4('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x51c4('0x9'));var toCsv=require(_0x51c4('0xa'));var querystring=require(_0x51c4('0xb'));var Papa=require(_0x51c4('0xc'));var Redis=require('ioredis');var authService=require(_0x51c4('0xd'));var qs=require(_0x51c4('0xe'));var as=require(_0x51c4('0xf'));var hardwareService=require(_0x51c4('0x10'));var logger=require(_0x51c4('0x11'))(_0x51c4('0x12'));var utils=require(_0x51c4('0x13'));var config=require(_0x51c4('0x14'));var licenseUtil=require(_0x51c4('0x15'));var db=require(_0x51c4('0x16'))['db'];function respondWithStatusCode(_0x4bd126,_0x40c9ed){_0x40c9ed=_0x40c9ed||0xcc;return function(_0x1de156){if(_0x1de156){return _0x4bd126[_0x51c4('0x17')](_0x40c9ed);}return _0x4bd126[_0x51c4('0x18')](_0x40c9ed)[_0x51c4('0x19')]();};}function respondWithResult(_0x89fe,_0x4278df){_0x4278df=_0x4278df||0xc8;return function(_0x5d5366){if(_0x5d5366){return _0x89fe[_0x51c4('0x18')](_0x4278df)[_0x51c4('0x1a')](_0x5d5366);}};}function respondWithFilteredResult(_0x2f7c46,_0x5bef82){return function(_0x59c9c4){if(_0x59c9c4){var _0x189f7a=typeof _0x5bef82[_0x51c4('0x1b')]===_0x51c4('0x1c')&&typeof _0x5bef82[_0x51c4('0x1d')]===_0x51c4('0x1c');var _0x23843d=_0x59c9c4['count'];var _0x67dd17=_0x189f7a?0x0:_0x5bef82[_0x51c4('0x1b')];var _0x5988dd=_0x189f7a?_0x59c9c4['count']:_0x5bef82['offset']+_0x5bef82[_0x51c4('0x1d')];var _0x2bcb4d;if(_0x5988dd>=_0x23843d){_0x5988dd=_0x23843d;_0x2bcb4d=0xc8;}else{_0x2bcb4d=0xce;}_0x2f7c46['status'](_0x2bcb4d);return _0x2f7c46[_0x51c4('0x1e')](_0x51c4('0x1f'),_0x67dd17+'-'+_0x5988dd+'/'+_0x23843d)[_0x51c4('0x1a')](_0x59c9c4);}return null;};}function patchUpdates(_0x558e14){return function(_0x50e930){try{jsonpatch[_0x51c4('0x20')](_0x50e930,_0x558e14,!![]);}catch(_0x962017){return BPromise['reject'](_0x962017);}return _0x50e930['save']();};}function saveUpdates(_0x1e8d13,_0x4aeae6){return function(_0x2edfc0){if(_0x2edfc0){return _0x2edfc0['update'](_0x1e8d13)[_0x51c4('0x21')](function(_0x2c5221){return _0x2c5221;});}return null;};}function removeEntity(_0x44cdff,_0x1fd981){return function(_0x570678){if(_0x570678){return _0x570678[_0x51c4('0x22')]()[_0x51c4('0x21')](function(){var _0x37dca7=_0x570678[_0x51c4('0x23')]({'plain':!![]});var _0x342c69='Dispositions';return db[_0x51c4('0x24')][_0x51c4('0x22')]({'where':{'type':_0x342c69,'resourceId':_0x37dca7['id']}})[_0x51c4('0x21')](function(){return _0x570678;});})[_0x51c4('0x21')](function(){_0x44cdff[_0x51c4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x72938f,_0x2cdf93){return function(_0x574652){if(!_0x574652){_0x72938f[_0x51c4('0x17')](0x194);}return _0x574652;};}function handleError(_0x5322c9,_0x35891d){_0x35891d=_0x35891d||0x1f4;return function(_0x292a12){logger[_0x51c4('0x25')](_0x292a12[_0x51c4('0x26')]);if(_0x292a12[_0x51c4('0x27')]){delete _0x292a12[_0x51c4('0x27')];}_0x5322c9[_0x51c4('0x18')](_0x35891d)[_0x51c4('0x28')](_0x292a12);};}exports[_0x51c4('0x29')]=function(_0x6960e0,_0x153ff2){var _0x34c99f={},_0x1eeb9f={},_0x2b603b={'count':0x0,'rows':[]};var _0x110ac4=_['map'](db['Disposition'][_0x51c4('0x2a')],function(_0x106886){return{'name':_0x106886[_0x51c4('0x2b')],'type':_0x106886['type'][_0x51c4('0x2c')]};});_0x1eeb9f[_0x51c4('0x2d')]=_[_0x51c4('0x2e')](_0x110ac4,_0x51c4('0x27'));_0x1eeb9f[_0x51c4('0x2f')]=_[_0x51c4('0x30')](_0x6960e0[_0x51c4('0x2f')]);_0x1eeb9f[_0x51c4('0x31')]=_['intersection'](_0x1eeb9f['model'],_0x1eeb9f[_0x51c4('0x2f')]);_0x34c99f['attributes']=_[_0x51c4('0x32')](_0x1eeb9f[_0x51c4('0x2d')],qs[_0x51c4('0x33')](_0x6960e0[_0x51c4('0x2f')][_0x51c4('0x33')]));_0x34c99f[_0x51c4('0x34')]=_0x34c99f[_0x51c4('0x34')][_0x51c4('0x35')]?_0x34c99f[_0x51c4('0x34')]:_0x1eeb9f['model'];if(!_0x6960e0[_0x51c4('0x2f')][_0x51c4('0x36')](_0x51c4('0x37'))){_0x34c99f[_0x51c4('0x1d')]=qs[_0x51c4('0x1d')](_0x6960e0[_0x51c4('0x2f')][_0x51c4('0x1d')]);_0x34c99f[_0x51c4('0x1b')]=qs[_0x51c4('0x1b')](_0x6960e0['query'][_0x51c4('0x1b')]);}_0x34c99f[_0x51c4('0x38')]=qs['sort'](_0x6960e0[_0x51c4('0x2f')][_0x51c4('0x39')]);_0x34c99f[_0x51c4('0x3a')]=qs[_0x51c4('0x31')](_[_0x51c4('0x3b')](_0x6960e0[_0x51c4('0x2f')],_0x1eeb9f[_0x51c4('0x31')]),_0x110ac4);if(_0x6960e0['query'][_0x51c4('0x3c')]){_0x34c99f[_0x51c4('0x3a')]=_['merge'](_0x34c99f[_0x51c4('0x3a')],{'$or':_['map'](_0x110ac4,function(_0x4aee5b){if(_0x4aee5b[_0x51c4('0x3d')]!=='VIRTUAL'){var _0x22eac3={};_0x22eac3[_0x4aee5b[_0x51c4('0x27')]]={'$like':'%'+_0x6960e0[_0x51c4('0x2f')][_0x51c4('0x3c')]+'%'};return _0x22eac3;}})});}_0x34c99f=_[_0x51c4('0x3e')]({},_0x34c99f,_0x6960e0[_0x51c4('0x3f')]);var _0x5b323b={'where':_0x34c99f[_0x51c4('0x3a')]};return db['Disposition'][_0x51c4('0x40')](_0x5b323b)[_0x51c4('0x21')](function(_0x1d8fe7){_0x2b603b[_0x51c4('0x40')]=_0x1d8fe7;if(_0x6960e0[_0x51c4('0x2f')][_0x51c4('0x41')]){_0x34c99f[_0x51c4('0x42')]=[{'all':!![]}];}return db[_0x51c4('0x43')]['findAll'](_0x34c99f);})[_0x51c4('0x21')](function(_0x271ec2){_0x2b603b[_0x51c4('0x44')]=_0x271ec2;return _0x2b603b;})[_0x51c4('0x21')](respondWithFilteredResult(_0x153ff2,_0x34c99f))[_0x51c4('0x45')](handleError(_0x153ff2,null));};exports['show']=function(_0x4c889b,_0x5a56a2){var _0x27bf36={'raw':!![],'where':{'id':_0x4c889b[_0x51c4('0x46')]['id']}},_0x7de9d9={};_0x7de9d9[_0x51c4('0x2d')]=_[_0x51c4('0x30')](db['Disposition'][_0x51c4('0x2a')]);_0x7de9d9[_0x51c4('0x2f')]=_[_0x51c4('0x30')](_0x4c889b[_0x51c4('0x2f')]);_0x7de9d9[_0x51c4('0x31')]=_[_0x51c4('0x32')](_0x7de9d9[_0x51c4('0x2d')],_0x7de9d9[_0x51c4('0x2f')]);_0x27bf36[_0x51c4('0x34')]=_[_0x51c4('0x32')](_0x7de9d9[_0x51c4('0x2d')],qs[_0x51c4('0x33')](_0x4c889b[_0x51c4('0x2f')][_0x51c4('0x33')]));_0x27bf36[_0x51c4('0x34')]=_0x27bf36[_0x51c4('0x34')][_0x51c4('0x35')]?_0x27bf36[_0x51c4('0x34')]:_0x7de9d9[_0x51c4('0x2d')];if(_0x4c889b[_0x51c4('0x2f')][_0x51c4('0x41')]){_0x27bf36['include']=[{'all':!![]}];}_0x27bf36=_['merge']({},_0x27bf36,_0x4c889b[_0x51c4('0x3f')]);return db[_0x51c4('0x43')]['find'](_0x27bf36)[_0x51c4('0x21')](handleEntityNotFound(_0x5a56a2,null))[_0x51c4('0x21')](respondWithResult(_0x5a56a2,null))[_0x51c4('0x45')](handleError(_0x5a56a2,null));};exports['create']=function(_0x328f6e,_0x42343b){return db[_0x51c4('0x43')][_0x51c4('0x47')](_0x328f6e[_0x51c4('0x48')],{})[_0x51c4('0x21')](function(_0x5870c9){var _0x3c2e1d=_0x328f6e['user'][_0x51c4('0x23')]({'plain':!![]});if(!_0x3c2e1d)throw new Error(_0x51c4('0x49'));if(_0x3c2e1d[_0x51c4('0x4a')]===_0x51c4('0x4b')){var _0x450ec7=_0x5870c9[_0x51c4('0x23')]({'plain':!![]});var _0x80de72='Dispositions';return db[_0x51c4('0x4c')][_0x51c4('0x4d')]({'where':{'name':_0x80de72,'userProfileId':_0x3c2e1d[_0x51c4('0x4e')]},'raw':!![]})[_0x51c4('0x21')](function(_0x504a10){if(_0x504a10&&_0x504a10[_0x51c4('0x4f')]===0x0){return db['UserProfileResource'][_0x51c4('0x47')]({'name':_0x450ec7[_0x51c4('0x27')],'resourceId':_0x450ec7['id'],'type':_0x504a10['name'],'sectionId':_0x504a10['id']},{})[_0x51c4('0x21')](function(){return _0x5870c9;});}else{return _0x5870c9;}})[_0x51c4('0x45')](function(_0x1abb79){logger['error'](_0x51c4('0x50'),_0x1abb79);throw _0x1abb79;});}return _0x5870c9;})[_0x51c4('0x21')](respondWithResult(_0x42343b,0xc9))[_0x51c4('0x45')](handleError(_0x42343b,null));};exports[_0x51c4('0x51')]=function(_0x357a9a,_0x5c0331){if(_0x357a9a[_0x51c4('0x48')]['id']){delete _0x357a9a['body']['id'];}return db[_0x51c4('0x43')][_0x51c4('0x4d')]({'where':{'id':_0x357a9a[_0x51c4('0x46')]['id']}})['then'](handleEntityNotFound(_0x5c0331,null))['then'](saveUpdates(_0x357a9a['body'],null))[_0x51c4('0x21')](respondWithResult(_0x5c0331,null))['catch'](handleError(_0x5c0331,null));};exports[_0x51c4('0x22')]=function(_0x170d40,_0x278045){return db[_0x51c4('0x43')][_0x51c4('0x4d')]({'where':{'id':_0x170d40[_0x51c4('0x46')]['id']}})[_0x51c4('0x21')](handleEntityNotFound(_0x278045,null))[_0x51c4('0x21')](removeEntity(_0x278045,null))[_0x51c4('0x45')](handleError(_0x278045,null));}; \ No newline at end of file +var _0x5559=['create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','set','Content-Range','json','apply','reject','save','destroy','then','Dispositions','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','Disposition','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x29e8a5,_0x467be7){var _0x50fe02=function(_0x16ac6a){while(--_0x16ac6a){_0x29e8a5['push'](_0x29e8a5['shift']());}};_0x50fe02(++_0x467be7);}(_0x5559,0x1af));var _0x9555=function(_0x19306b,_0x1da646){_0x19306b=_0x19306b-0x0;var _0x1afd2e=_0x5559[_0x19306b];return _0x1afd2e;};'use strict';var emlformat=require(_0x9555('0x0'));var rimraf=require(_0x9555('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9555('0x2'));var util=require(_0x9555('0x3'));var path=require(_0x9555('0x4'));var sox=require('sox');var csv=require(_0x9555('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9555('0x6'));var squel=require(_0x9555('0x7'));var crypto=require(_0x9555('0x8'));var jsforce=require(_0x9555('0x9'));var deskjs=require(_0x9555('0xa'));var toCsv=require(_0x9555('0x5'));var querystring=require('querystring');var Papa=require(_0x9555('0xb'));var Redis=require(_0x9555('0xc'));var authService=require(_0x9555('0xd'));var qs=require(_0x9555('0xe'));var as=require(_0x9555('0xf'));var hardwareService=require(_0x9555('0x10'));var logger=require(_0x9555('0x11'))('api');var utils=require(_0x9555('0x12'));var config=require(_0x9555('0x13'));var licenseUtil=require(_0x9555('0x14'));var db=require(_0x9555('0x15'))['db'];function respondWithStatusCode(_0x538c7a,_0x1a3008){_0x1a3008=_0x1a3008||0xcc;return function(_0x134375){if(_0x134375){return _0x538c7a[_0x9555('0x16')](_0x1a3008);}return _0x538c7a[_0x9555('0x17')](_0x1a3008)[_0x9555('0x18')]();};}function respondWithResult(_0xff17fc,_0x5ad5d7){_0x5ad5d7=_0x5ad5d7||0xc8;return function(_0x2be887){if(_0x2be887){return _0xff17fc[_0x9555('0x17')](_0x5ad5d7)['json'](_0x2be887);}};}function respondWithFilteredResult(_0x527cfc,_0x2f3f52){return function(_0x1374fc){if(_0x1374fc){var _0x4e640c=typeof _0x2f3f52['offset']==='undefined'&&typeof _0x2f3f52[_0x9555('0x19')]==='undefined';var _0x15be05=_0x1374fc[_0x9555('0x1a')];var _0x38bad0=_0x4e640c?0x0:_0x2f3f52[_0x9555('0x1b')];var _0x40667d=_0x4e640c?_0x1374fc['count']:_0x2f3f52[_0x9555('0x1b')]+_0x2f3f52[_0x9555('0x19')];var _0x3a40e7;if(_0x40667d>=_0x15be05){_0x40667d=_0x15be05;_0x3a40e7=0xc8;}else{_0x3a40e7=0xce;}_0x527cfc[_0x9555('0x17')](_0x3a40e7);return _0x527cfc[_0x9555('0x1c')](_0x9555('0x1d'),_0x38bad0+'-'+_0x40667d+'/'+_0x15be05)[_0x9555('0x1e')](_0x1374fc);}return null;};}function patchUpdates(_0x263317){return function(_0x44a300){try{jsonpatch[_0x9555('0x1f')](_0x44a300,_0x263317,!![]);}catch(_0x385f1d){return BPromise[_0x9555('0x20')](_0x385f1d);}return _0x44a300[_0x9555('0x21')]();};}function saveUpdates(_0x12248a,_0x152c51){return function(_0xb53b82){if(_0xb53b82){return _0xb53b82['update'](_0x12248a)['then'](function(_0x28bd2d){return _0x28bd2d;});}return null;};}function removeEntity(_0x144d64,_0x2ce4e7){return function(_0x217d60){if(_0x217d60){return _0x217d60[_0x9555('0x22')]()[_0x9555('0x23')](function(){var _0x4fac40=_0x217d60['get']({'plain':!![]});var _0x5c408d=_0x9555('0x24');return db[_0x9555('0x25')][_0x9555('0x22')]({'where':{'type':_0x5c408d,'resourceId':_0x4fac40['id']}})[_0x9555('0x23')](function(){return _0x217d60;});})['then'](function(){_0x144d64[_0x9555('0x17')](0xcc)[_0x9555('0x18')]();});}};}function handleEntityNotFound(_0x87d923,_0x47040c){return function(_0x1a24b5){if(!_0x1a24b5){_0x87d923['sendStatus'](0x194);}return _0x1a24b5;};}function handleError(_0x23b4e1,_0x15a92b){_0x15a92b=_0x15a92b||0x1f4;return function(_0x473bd0){logger[_0x9555('0x26')](_0x473bd0[_0x9555('0x27')]);if(_0x473bd0['name']){delete _0x473bd0[_0x9555('0x28')];}_0x23b4e1[_0x9555('0x17')](_0x15a92b)[_0x9555('0x29')](_0x473bd0);};}exports[_0x9555('0x2a')]=function(_0x5b6f50,_0x2b5253){var _0x2f9f8d={},_0x1a7e35={},_0x3f3025={'count':0x0,'rows':[]};var _0x6acace=_[_0x9555('0x2b')](db['Disposition'][_0x9555('0x2c')],function(_0xdb5eb2){return{'name':_0xdb5eb2[_0x9555('0x2d')],'type':_0xdb5eb2[_0x9555('0x2e')][_0x9555('0x2f')]};});_0x1a7e35[_0x9555('0x30')]=_[_0x9555('0x2b')](_0x6acace,_0x9555('0x28'));_0x1a7e35[_0x9555('0x31')]=_[_0x9555('0x32')](_0x5b6f50[_0x9555('0x31')]);_0x1a7e35['filters']=_[_0x9555('0x33')](_0x1a7e35[_0x9555('0x30')],_0x1a7e35[_0x9555('0x31')]);_0x2f9f8d['attributes']=_[_0x9555('0x33')](_0x1a7e35['model'],qs[_0x9555('0x34')](_0x5b6f50[_0x9555('0x31')][_0x9555('0x34')]));_0x2f9f8d[_0x9555('0x35')]=_0x2f9f8d['attributes'][_0x9555('0x36')]?_0x2f9f8d[_0x9555('0x35')]:_0x1a7e35['model'];if(!_0x5b6f50[_0x9555('0x31')][_0x9555('0x37')]('nolimit')){_0x2f9f8d[_0x9555('0x19')]=qs[_0x9555('0x19')](_0x5b6f50[_0x9555('0x31')][_0x9555('0x19')]);_0x2f9f8d[_0x9555('0x1b')]=qs[_0x9555('0x1b')](_0x5b6f50['query'][_0x9555('0x1b')]);}_0x2f9f8d[_0x9555('0x38')]=qs[_0x9555('0x39')](_0x5b6f50[_0x9555('0x31')]['sort']);_0x2f9f8d[_0x9555('0x3a')]=qs[_0x9555('0x3b')](_['pick'](_0x5b6f50[_0x9555('0x31')],_0x1a7e35[_0x9555('0x3b')]),_0x6acace);if(_0x5b6f50[_0x9555('0x31')][_0x9555('0x3c')]){_0x2f9f8d[_0x9555('0x3a')]=_[_0x9555('0x3d')](_0x2f9f8d[_0x9555('0x3a')],{'$or':_[_0x9555('0x2b')](_0x6acace,function(_0x560e29){if(_0x560e29[_0x9555('0x2e')]!==_0x9555('0x3e')){var _0x41c654={};_0x41c654[_0x560e29[_0x9555('0x28')]]={'$like':'%'+_0x5b6f50[_0x9555('0x31')][_0x9555('0x3c')]+'%'};return _0x41c654;}})});}_0x2f9f8d=_[_0x9555('0x3d')]({},_0x2f9f8d,_0x5b6f50[_0x9555('0x3f')]);var _0x4a33be={'where':_0x2f9f8d['where']};return db[_0x9555('0x40')]['count'](_0x4a33be)[_0x9555('0x23')](function(_0x79a53c){_0x3f3025[_0x9555('0x1a')]=_0x79a53c;if(_0x5b6f50[_0x9555('0x31')][_0x9555('0x41')]){_0x2f9f8d[_0x9555('0x42')]=[{'all':!![]}];}return db[_0x9555('0x40')][_0x9555('0x43')](_0x2f9f8d);})[_0x9555('0x23')](function(_0x4acdfc){_0x3f3025[_0x9555('0x44')]=_0x4acdfc;return _0x3f3025;})[_0x9555('0x23')](respondWithFilteredResult(_0x2b5253,_0x2f9f8d))[_0x9555('0x45')](handleError(_0x2b5253,null));};exports[_0x9555('0x46')]=function(_0x115637,_0x4c8dd7){var _0x1cdf9f={'raw':!![],'where':{'id':_0x115637[_0x9555('0x47')]['id']}},_0x51bdc3={};_0x51bdc3['model']=_[_0x9555('0x32')](db[_0x9555('0x40')][_0x9555('0x2c')]);_0x51bdc3['query']=_[_0x9555('0x32')](_0x115637[_0x9555('0x31')]);_0x51bdc3[_0x9555('0x3b')]=_[_0x9555('0x33')](_0x51bdc3[_0x9555('0x30')],_0x51bdc3[_0x9555('0x31')]);_0x1cdf9f['attributes']=_[_0x9555('0x33')](_0x51bdc3[_0x9555('0x30')],qs[_0x9555('0x34')](_0x115637[_0x9555('0x31')][_0x9555('0x34')]));_0x1cdf9f[_0x9555('0x35')]=_0x1cdf9f[_0x9555('0x35')][_0x9555('0x36')]?_0x1cdf9f['attributes']:_0x51bdc3[_0x9555('0x30')];if(_0x115637[_0x9555('0x31')][_0x9555('0x41')]){_0x1cdf9f[_0x9555('0x42')]=[{'all':!![]}];}_0x1cdf9f=_[_0x9555('0x3d')]({},_0x1cdf9f,_0x115637[_0x9555('0x3f')]);return db['Disposition'][_0x9555('0x48')](_0x1cdf9f)[_0x9555('0x23')](handleEntityNotFound(_0x4c8dd7,null))[_0x9555('0x23')](respondWithResult(_0x4c8dd7,null))[_0x9555('0x45')](handleError(_0x4c8dd7,null));};exports[_0x9555('0x49')]=function(_0x54df6d,_0xb89d22){return db[_0x9555('0x40')][_0x9555('0x49')](_0x54df6d['body'],{})[_0x9555('0x23')](function(_0x2e8f08){var _0x57669e=_0x54df6d[_0x9555('0x4a')][_0x9555('0x4b')]({'plain':!![]});if(!_0x57669e)throw new Error(_0x9555('0x4c'));if(_0x57669e[_0x9555('0x4d')]===_0x9555('0x4a')){var _0x452902=_0x2e8f08['get']({'plain':!![]});var _0x295c74='Dispositions';return db[_0x9555('0x4e')][_0x9555('0x48')]({'where':{'name':_0x295c74,'userProfileId':_0x57669e[_0x9555('0x4f')]},'raw':!![]})['then'](function(_0x265595){if(_0x265595&&_0x265595[_0x9555('0x50')]===0x0){return db[_0x9555('0x25')][_0x9555('0x49')]({'name':_0x452902[_0x9555('0x28')],'resourceId':_0x452902['id'],'type':_0x265595[_0x9555('0x28')],'sectionId':_0x265595['id']},{})[_0x9555('0x23')](function(){return _0x2e8f08;});}else{return _0x2e8f08;}})[_0x9555('0x45')](function(_0x36ad0b){logger[_0x9555('0x26')](_0x9555('0x51'),_0x36ad0b);throw _0x36ad0b;});}return _0x2e8f08;})[_0x9555('0x23')](respondWithResult(_0xb89d22,0xc9))['catch'](handleError(_0xb89d22,null));};exports[_0x9555('0x52')]=function(_0xcae75a,_0x4653cf){if(_0xcae75a['body']['id']){delete _0xcae75a[_0x9555('0x53')]['id'];}return db[_0x9555('0x40')][_0x9555('0x48')]({'where':{'id':_0xcae75a[_0x9555('0x47')]['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x4653cf,null))[_0x9555('0x23')](saveUpdates(_0xcae75a['body'],null))[_0x9555('0x23')](respondWithResult(_0x4653cf,null))[_0x9555('0x45')](handleError(_0x4653cf,null));};exports[_0x9555('0x22')]=function(_0x4356ef,_0x3a1758){return db[_0x9555('0x40')][_0x9555('0x48')]({'where':{'id':_0x4356ef[_0x9555('0x47')]['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x3a1758,null))[_0x9555('0x23')](removeEntity(_0x3a1758,null))[_0x9555('0x45')](handleError(_0x3a1758,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2a7d989..3f152c7 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 _0x9202=['name_sms','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','tools_dispositions','name_voice','ListId','name_chat','name','ChatWebsiteId','name_mail','MailAccountId'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9202,0x6e));var _0x2920=function(_0x13b6f7,_0x9585f9){_0x13b6f7=_0x13b6f7-0x0;var _0x333a79=_0x9202[_0x13b6f7];return _0x333a79;};'use strict';var _=require(_0x2920('0x0'));var util=require(_0x2920('0x1'));var logger=require(_0x2920('0x2'))(_0x2920('0x3'));var moment=require(_0x2920('0x4'));var BPromise=require(_0x2920('0x5'));var rp=require(_0x2920('0x6'));var fs=require('fs');var path=require(_0x2920('0x7'));var rimraf=require(_0x2920('0x8'));var config=require(_0x2920('0x9'));var attributes=require('./disposition.attributes');module[_0x2920('0xa')]=function(_0x4e3888,_0x3154da){return _0x4e3888[_0x2920('0xb')]('Disposition',attributes,{'tableName':_0x2920('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2920('0xd'),'fields':['name',_0x2920('0xe')]},{'unique':!![],'name':_0x2920('0xf'),'fields':[_0x2920('0x10'),_0x2920('0x11')]},{'unique':!![],'name':_0x2920('0x12'),'fields':['name',_0x2920('0x13')]},{'unique':!![],'name':_0x2920('0x14'),'fields':[_0x2920('0x10'),'SmsAccountId']},{'unique':!![],'name':_0x2920('0x15'),'fields':['name',_0x2920('0x16')]},{'unique':!![],'name':'name_openchannel','fields':[_0x2920('0x10'),_0x2920('0x17')]},{'unique':!![],'name':_0x2920('0x18'),'fields':[_0x2920('0x10'),_0x2920('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4569=['ChatWebsiteId','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','moment','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0x4569,0xaa));var _0x9456=function(_0x5e5db3,_0x1df6c7){_0x5e5db3=_0x5e5db3-0x0;var _0x2a2536=_0x4569[_0x5e5db3];return _0x2a2536;};'use strict';var _=require('lodash');var util=require(_0x9456('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9456('0x1'));var BPromise=require(_0x9456('0x2'));var rp=require(_0x9456('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9456('0x4'));var config=require(_0x9456('0x5'));var attributes=require(_0x9456('0x6'));module[_0x9456('0x7')]=function(_0x227c0e,_0x2197ab){return _0x227c0e[_0x9456('0x8')](_0x9456('0x9'),attributes,{'tableName':_0x9456('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x9456('0xb'),'fields':[_0x9456('0xc'),_0x9456('0xd')]},{'unique':!![],'name':'name_chat','fields':['name',_0x9456('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0x9456('0xc'),_0x9456('0xf')]},{'unique':!![],'name':_0x9456('0x10'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0x9456('0x11'),'fields':[_0x9456('0xc'),_0x9456('0x12')]},{'unique':!![],'name':_0x9456('0x13'),'fields':[_0x9456('0xc'),_0x9456('0x14')]},{'unique':!![],'name':_0x9456('0x15'),'fields':['name',_0x9456('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index d4ae1c4..b73bcc8 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(_0x4c3e17,_0x444a22){var _0x97fd7f=function(_0x156a00){while(--_0x156a00){_0x4c3e17['push'](_0x4c3e17['shift']());}};_0x97fd7f(++_0x444a22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0xa13dbd,_0x369b3c){var _0x2729c5=function(_0x7f36d1){while(--_0x7f36d1){_0xa13dbd['push'](_0xa13dbd['shift']());}};_0x2729c5(++_0x369b3c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 e8f4395..e6a6016 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 _0x6be5=['show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0x6be5,0x181));var _0x56be=function(_0x272b54,_0x5a2709){_0x272b54=_0x272b54-0x0;var _0x3623f1=_0x6be5[_0x272b54];return _0x3623f1;};'use strict';var multer=require(_0x56be('0x0'));var util=require(_0x56be('0x1'));var path=require(_0x56be('0x2'));var timeout=require(_0x56be('0x3'));var express=require('express');var router=express[_0x56be('0x4')]();var fs_extra=require(_0x56be('0x5'));var auth=require(_0x56be('0x6'));var interaction=require(_0x56be('0x7'));var config=require(_0x56be('0x8'));var controller=require(_0x56be('0x9'));router[_0x56be('0xa')]('/',auth[_0x56be('0xb')](),controller[_0x56be('0xc')]);router[_0x56be('0xa')](_0x56be('0xd'),auth[_0x56be('0xb')](),controller[_0x56be('0xe')]);router['post']('/',auth[_0x56be('0xb')](),controller[_0x56be('0xf')]);router[_0x56be('0x10')](_0x56be('0xd'),auth['isAuthenticated'](),controller[_0x56be('0x11')]);router[_0x56be('0x12')](_0x56be('0xd'),auth[_0x56be('0xb')](),controller[_0x56be('0x13')]);module[_0x56be('0x14')]=router; \ No newline at end of file +var _0xb182=['isAuthenticated','create','put','/:id','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get'];(function(_0x305026,_0x22461b){var _0x1c0b5a=function(_0x10fa0b){while(--_0x10fa0b){_0x305026['push'](_0x305026['shift']());}};_0x1c0b5a(++_0x22461b);}(_0xb182,0x19a));var _0x2b18=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0xb182[_0x31dde9];return _0x1fbf2d;};'use strict';var multer=require(_0x2b18('0x0'));var util=require('util');var path=require(_0x2b18('0x1'));var timeout=require('connect-timeout');var express=require(_0x2b18('0x2'));var router=express[_0x2b18('0x3')]();var fs_extra=require(_0x2b18('0x4'));var auth=require(_0x2b18('0x5'));var interaction=require(_0x2b18('0x6'));var config=require(_0x2b18('0x7'));var controller=require(_0x2b18('0x8'));router[_0x2b18('0x9')]('/',auth[_0x2b18('0xa')](),controller['index']);router[_0x2b18('0x9')]('/:id',auth[_0x2b18('0xa')](),controller['show']);router['post']('/',auth[_0x2b18('0xa')](),controller[_0x2b18('0xb')]);router[_0x2b18('0xc')](_0x2b18('0xd'),auth[_0x2b18('0xa')](),controller['update']);router['delete']('/:id',auth[_0x2b18('0xa')](),controller[_0x2b18('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 4af0aa0..0d51337 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 _0x126b=['KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','yes','2400','4800','7200','12000','9600','14400','INTEGER','SIP'];(function(_0x584da3,_0x388a44){var _0x37aeb9=function(_0x1f5b77){while(--_0x1f5b77){_0x584da3['push'](_0x584da3['shift']());}};_0x37aeb9(++_0x388a44);}(_0x126b,0x171));var _0xb126=function(_0x1e364c,_0x47fe61){_0x1e364c=_0x1e364c-0x0;var _0xa163ff=_0x126b[_0x1e364c];return _0xa163ff;};'use strict';var Sequelize=require(_0xb126('0x0'));module['exports']={'name':{'type':Sequelize[_0xb126('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb126('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0xb126('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xb126('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xb126('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0xb126('0x3'),_0xb126('0x4'),_0xb126('0x5'),'9600',_0xb126('0x6'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0xb126('0x3'),_0xb126('0x4'),_0xb126('0x5'),_0xb126('0x7'),_0xb126('0x6'),'14400'),'defaultValue':_0xb126('0x8')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xb126('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xb126('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xb126('0x9')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xb126('0xa'),'IAX','DADHI',_0xb126('0xb')),'defaultValue':_0xb126('0xa')},'key':{'type':Sequelize[_0xb126('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb126('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb126('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb126('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb126('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb126('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb126('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xb126('0xe')},'mandatoryDisposition':{'type':Sequelize[_0xb126('0xd')],'defaultValue':![],'comment':_0xb126('0xf'),'set':function(_0x31fcf7){if(!_0x31fcf7)this[_0xb126('0x10')](_0xb126('0x11'),null);this[_0xb126('0x10')](_0xb126('0x12'),_0x31fcf7);}}}; \ No newline at end of file +var _0x534e=['IAX','DADHI','SIP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','14400','12000','v17,v27,v29','INTEGER'];(function(_0x1e252a,_0x3872ec){var _0x5bf947=function(_0x5e4eee){while(--_0x5e4eee){_0x1e252a['push'](_0x1e252a['shift']());}};_0x5bf947(++_0x3872ec);}(_0x534e,0x1ec));var _0xe534=function(_0x599c94,_0x464f0e){_0x599c94=_0x599c94-0x0;var _0x34e215=_0x534e[_0x599c94];return _0x34e215;};'use strict';var Sequelize=require(_0xe534('0x0'));module['exports']={'name':{'type':Sequelize[_0xe534('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe534('0x1')]},'ecm':{'type':Sequelize[_0xe534('0x2')](_0xe534('0x3'),'no'),'defaultValue':_0xe534('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xe534('0x4')},'localstationid':{'type':Sequelize[_0xe534('0x1')],'unique':_0xe534('0x5')},'minrate':{'type':Sequelize[_0xe534('0x2')](_0xe534('0x6'),_0xe534('0x7'),_0xe534('0x8'),_0xe534('0x9'),'12000',_0xe534('0xa')),'defaultValue':_0xe534('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0xe534('0x6'),_0xe534('0x7'),'7200',_0xe534('0x9'),_0xe534('0xb'),_0xe534('0xa')),'defaultValue':_0xe534('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xe534('0xc')},'gateway':{'type':Sequelize[_0xe534('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xe534('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xe534('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xe534('0x2')]('SIP',_0xe534('0xe'),_0xe534('0xf'),'KHOMP'),'defaultValue':_0xe534('0x10')},'key':{'type':Sequelize[_0xe534('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe534('0x11');}},'notificationSound':{'type':Sequelize[_0xe534('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe534('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe534('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe534('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe534('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe534('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xe534('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe534('0x14'),'set':function(_0x6fec01){if(!_0x6fec01)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xe534('0x15')](_0xe534('0x16'),_0x6fec01);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index df720c5..2485d8f 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 _0xba7c=['then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','offset','undefined','set','Content-Range','reject','save','update','destroy','FaxAccounts','UserProfileResource','end','sendStatus','name','send','index','Pause','map','FaxAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','show','params','mandatoryDispositionPause','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','describe','addDisposition','FaxAccountId','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','from-voip-provider','localstationid','app','system','Fax\x20Extension','push','Answer','Set','ecm','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','updateAccountApplications','VoiceExtension','omit','tech','createdAt','updatedAt','ListId','findById','FaxMessage','$gte','split','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./faxAccount.socket','register','client','http','request'];(function(_0x4338f6,_0x63194){var _0x47c394=function(_0x22af5c){while(--_0x22af5c){_0x4338f6['push'](_0x4338f6['shift']());}};_0x47c394(++_0x63194);}(_0xba7c,0x166));var _0xcba7=function(_0x3cdf85,_0x448272){_0x3cdf85=_0x3cdf85-0x0;var _0x10262a=_0xba7c[_0x3cdf85];return _0x10262a;};'use strict';var emlformat=require(_0xcba7('0x0'));var rimraf=require(_0xcba7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcba7('0x2'));var moment=require(_0xcba7('0x3'));var BPromise=require(_0xcba7('0x4'));var Mustache=require(_0xcba7('0x5'));var util=require(_0xcba7('0x6'));var path=require(_0xcba7('0x7'));var sox=require('sox');var csv=require(_0xcba7('0x8'));var ejs=require(_0xcba7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcba7('0xa'));var squel=require(_0xcba7('0xb'));var crypto=require('crypto');var jsforce=require(_0xcba7('0xc'));var deskjs=require(_0xcba7('0xd'));var toCsv=require(_0xcba7('0x8'));var querystring=require('querystring');var Papa=require(_0xcba7('0xe'));var Redis=require(_0xcba7('0xf'));var authService=require(_0xcba7('0x10'));var qs=require(_0xcba7('0x11'));var as=require(_0xcba7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcba7('0x13'))('api');var utils=require(_0xcba7('0x14'));var config=require(_0xcba7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcba7('0x16'))['db'];config['redis']=_['defaults'](config[_0xcba7('0x17')],{'host':_0xcba7('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcba7('0x17')]));require(_0xcba7('0x19'))[_0xcba7('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xcba7('0x1b')][_0xcba7('0x1c')]({'port':0x232c});var client9002=jayson[_0xcba7('0x1b')][_0xcba7('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x203fc7,_0x27cb20,_0x1c8433,_0x1b48ae){return new BPromise(function(_0xbb1938,_0x3f3630){var _0x44d6ca=_0x1b48ae||client;return _0x44d6ca[_0xcba7('0x1d')](_0x203fc7,_0x1c8433)[_0xcba7('0x1e')](function(_0x3d3640){logger['info'](_0xcba7('0x1f'),_0x27cb20,_0xcba7('0x20'));logger[_0xcba7('0x21')](_0xcba7('0x22'),_0x27cb20,_0xcba7('0x20'),JSON[_0xcba7('0x23')](_0x3d3640));if(_0x3d3640[_0xcba7('0x24')]){if(_0x3d3640['error'][_0xcba7('0x25')]===0x1f4){logger[_0xcba7('0x24')](_0xcba7('0x1f'),_0x27cb20,_0x3d3640['error'][_0xcba7('0x26')]);return _0x3f3630(_0x3d3640[_0xcba7('0x24')][_0xcba7('0x26')]);}logger[_0xcba7('0x24')](_0xcba7('0x1f'),_0x27cb20,_0x3d3640[_0xcba7('0x24')][_0xcba7('0x26')]);return _0xbb1938(_0x3d3640['error'][_0xcba7('0x26')]);}else{logger[_0xcba7('0x27')](_0xcba7('0x1f'),_0x27cb20,_0xcba7('0x20'));_0xbb1938(_0x3d3640['result'][_0xcba7('0x26')]);}})[_0xcba7('0x28')](function(_0x2b2751){logger[_0xcba7('0x24')](_0xcba7('0x1f'),_0x27cb20,_0x2b2751);_0x3f3630(_0x2b2751);});});}function respondWithStatusCode(_0x48a746,_0x5d03dd){_0x5d03dd=_0x5d03dd||0xcc;return function(_0x54fdf3){if(_0x54fdf3){return _0x48a746['sendStatus'](_0x5d03dd);}return _0x48a746[_0xcba7('0x29')](_0x5d03dd)['end']();};}function respondWithResult(_0x467536,_0x53e2a0){_0x53e2a0=_0x53e2a0||0xc8;return function(_0x1bff65){if(_0x1bff65){return _0x467536[_0xcba7('0x29')](_0x53e2a0)['json'](_0x1bff65);}};}function respondWithFilteredResult(_0x547433,_0x3d0784){return function(_0x3962e9){if(_0x3962e9){var _0x1752ae=typeof _0x3d0784[_0xcba7('0x2a')]===_0xcba7('0x2b')&&typeof _0x3d0784['limit']===_0xcba7('0x2b');var _0x84a19e=_0x3962e9['count'];var _0xfa88bb=_0x1752ae?0x0:_0x3d0784[_0xcba7('0x2a')];var _0x494338=_0x1752ae?_0x3962e9['count']:_0x3d0784['offset']+_0x3d0784['limit'];var _0xa83615;if(_0x494338>=_0x84a19e){_0x494338=_0x84a19e;_0xa83615=0xc8;}else{_0xa83615=0xce;}_0x547433[_0xcba7('0x29')](_0xa83615);return _0x547433[_0xcba7('0x2c')](_0xcba7('0x2d'),_0xfa88bb+'-'+_0x494338+'/'+_0x84a19e)['json'](_0x3962e9);}return null;};}function patchUpdates(_0x4e1f41){return function(_0x2ae484){try{jsonpatch['apply'](_0x2ae484,_0x4e1f41,!![]);}catch(_0x5a2cb8){return BPromise[_0xcba7('0x2e')](_0x5a2cb8);}return _0x2ae484[_0xcba7('0x2f')]();};}function saveUpdates(_0x44232d,_0x389932){return function(_0x3eeac9){if(_0x3eeac9){return _0x3eeac9[_0xcba7('0x30')](_0x44232d)[_0xcba7('0x1e')](function(_0x191639){return _0x191639;});}return null;};}function removeEntity(_0x4cfa3a,_0x4db021){return function(_0xaca773){if(_0xaca773){return _0xaca773[_0xcba7('0x31')]()[_0xcba7('0x1e')](function(){var _0x594fa7=_0xaca773['get']({'plain':!![]});var _0x428411=_0xcba7('0x32');return db[_0xcba7('0x33')][_0xcba7('0x31')]({'where':{'type':_0x428411,'resourceId':_0x594fa7['id']}})[_0xcba7('0x1e')](function(){return _0xaca773;});})[_0xcba7('0x1e')](function(){_0x4cfa3a[_0xcba7('0x29')](0xcc)[_0xcba7('0x34')]();});}};}function handleEntityNotFound(_0x596463,_0x1f217a){return function(_0x31847b){if(!_0x31847b){_0x596463[_0xcba7('0x35')](0x194);}return _0x31847b;};}function handleError(_0x370286,_0x22e7a1){_0x22e7a1=_0x22e7a1||0x1f4;return function(_0xb20c30){logger[_0xcba7('0x24')](_0xb20c30['stack']);if(_0xb20c30['name']){delete _0xb20c30[_0xcba7('0x36')];}_0x370286[_0xcba7('0x29')](_0x22e7a1)[_0xcba7('0x37')](_0xb20c30);};}exports[_0xcba7('0x38')]=function(_0x245f4b,_0x161a73){var _0x1acc16={'include':[{'model':db[_0xcba7('0x39')],'as':'mandatoryDispositionPause'}]},_0x35f1d5={},_0x366645={'count':0x0,'rows':[]};var _0x44f2d4=_[_0xcba7('0x3a')](db[_0xcba7('0x3b')][_0xcba7('0x3c')],function(_0x5a1d35){return{'name':_0x5a1d35[_0xcba7('0x3d')],'type':_0x5a1d35['type']['key']};});_0x35f1d5[_0xcba7('0x3e')]=_[_0xcba7('0x3a')](_0x44f2d4,'name');_0x35f1d5[_0xcba7('0x3f')]=_[_0xcba7('0x40')](_0x245f4b[_0xcba7('0x3f')]);_0x35f1d5[_0xcba7('0x41')]=_[_0xcba7('0x42')](_0x35f1d5[_0xcba7('0x3e')],_0x35f1d5[_0xcba7('0x3f')]);_0x1acc16['attributes']=_['intersection'](_0x35f1d5[_0xcba7('0x3e')],qs[_0xcba7('0x43')](_0x245f4b[_0xcba7('0x3f')][_0xcba7('0x43')]));_0x1acc16[_0xcba7('0x44')]=_0x1acc16['attributes'][_0xcba7('0x45')]?_0x1acc16['attributes']:_0x35f1d5[_0xcba7('0x3e')];if(!_0x245f4b['query']['hasOwnProperty'](_0xcba7('0x46'))){_0x1acc16['limit']=qs[_0xcba7('0x47')](_0x245f4b['query'][_0xcba7('0x47')]);_0x1acc16[_0xcba7('0x2a')]=qs[_0xcba7('0x2a')](_0x245f4b[_0xcba7('0x3f')][_0xcba7('0x2a')]);}_0x1acc16[_0xcba7('0x48')]=qs[_0xcba7('0x49')](_0x245f4b[_0xcba7('0x3f')][_0xcba7('0x49')]);_0x1acc16[_0xcba7('0x4a')]=qs[_0xcba7('0x41')](_[_0xcba7('0x4b')](_0x245f4b[_0xcba7('0x3f')],_0x35f1d5[_0xcba7('0x41')]),_0x44f2d4);if(_0x245f4b[_0xcba7('0x3f')][_0xcba7('0x4c')]){_0x1acc16[_0xcba7('0x4a')]=_[_0xcba7('0x4d')](_0x1acc16[_0xcba7('0x4a')],{'$or':_[_0xcba7('0x3a')](_0x44f2d4,function(_0x1fe6de){if(_0x1fe6de[_0xcba7('0x4e')]!==_0xcba7('0x4f')){var _0x2bdeda={};_0x2bdeda[_0x1fe6de[_0xcba7('0x36')]]={'$like':'%'+_0x245f4b[_0xcba7('0x3f')][_0xcba7('0x4c')]+'%'};return _0x2bdeda;}})});}_0x1acc16=_[_0xcba7('0x4d')]({},_0x1acc16,_0x245f4b[_0xcba7('0x50')]);var _0x42c8fd={'where':_0x1acc16[_0xcba7('0x4a')]};return db[_0xcba7('0x3b')][_0xcba7('0x51')](_0x42c8fd)[_0xcba7('0x1e')](function(_0xa01a96){_0x366645['count']=_0xa01a96;if(_0x245f4b['query'][_0xcba7('0x52')]){_0x1acc16['include']=[{'all':!![]}];}return db[_0xcba7('0x3b')][_0xcba7('0x53')](_0x1acc16);})[_0xcba7('0x1e')](function(_0x347642){_0x366645[_0xcba7('0x54')]=_0x347642;return _0x366645;})[_0xcba7('0x1e')](respondWithFilteredResult(_0x161a73,_0x1acc16))[_0xcba7('0x28')](handleError(_0x161a73,null));};exports[_0xcba7('0x55')]=function(_0x19c12d,_0x10480c){var _0x37c242={'raw':![],'where':{'id':_0x19c12d[_0xcba7('0x56')]['id']},'include':[{'model':db[_0xcba7('0x39')],'as':_0xcba7('0x57')}]},_0x29e25c={};_0x29e25c[_0xcba7('0x3e')]=_[_0xcba7('0x40')](db['FaxAccount'][_0xcba7('0x3c')]);_0x29e25c[_0xcba7('0x3f')]=_[_0xcba7('0x40')](_0x19c12d[_0xcba7('0x3f')]);_0x29e25c[_0xcba7('0x41')]=_[_0xcba7('0x42')](_0x29e25c[_0xcba7('0x3e')],_0x29e25c[_0xcba7('0x3f')]);_0x37c242['attributes']=_[_0xcba7('0x42')](_0x29e25c['model'],qs['fields'](_0x19c12d[_0xcba7('0x3f')][_0xcba7('0x43')]));_0x37c242[_0xcba7('0x44')]=_0x37c242[_0xcba7('0x44')][_0xcba7('0x45')]?_0x37c242[_0xcba7('0x44')]:_0x29e25c[_0xcba7('0x3e')];if(_0x19c12d[_0xcba7('0x3f')][_0xcba7('0x52')]){_0x37c242[_0xcba7('0x58')]=[{'all':!![]}];}_0x37c242=_[_0xcba7('0x4d')]({},_0x37c242,_0x19c12d['options']);return db[_0xcba7('0x3b')][_0xcba7('0x59')](_0x37c242)[_0xcba7('0x1e')](handleEntityNotFound(_0x10480c,null))[_0xcba7('0x1e')](respondWithResult(_0x10480c,null))[_0xcba7('0x28')](handleError(_0x10480c,null));};exports[_0xcba7('0x5a')]=function(_0x5ea941,_0x5dccc6){return db['FaxAccount'][_0xcba7('0x5a')](_0x5ea941[_0xcba7('0x5b')],{})['then'](function(_0x20ccb5){var _0x5b90b2=_0x5ea941['user'][_0xcba7('0x5c')]({'plain':!![]});if(!_0x5b90b2)throw new Error(_0xcba7('0x5d'));if(_0x5b90b2[_0xcba7('0x5e')]===_0xcba7('0x5f')){var _0x6fcdeb=_0x20ccb5[_0xcba7('0x5c')]({'plain':!![]});var _0x135008='FaxAccounts';return db['UserProfileSection'][_0xcba7('0x59')]({'where':{'name':_0x135008,'userProfileId':_0x5b90b2[_0xcba7('0x60')]},'raw':!![]})['then'](function(_0xe31688){if(_0xe31688&&_0xe31688[_0xcba7('0x61')]===0x0){return db[_0xcba7('0x33')][_0xcba7('0x5a')]({'name':_0x6fcdeb[_0xcba7('0x36')],'resourceId':_0x6fcdeb['id'],'type':_0xe31688[_0xcba7('0x36')],'sectionId':_0xe31688['id']},{})['then'](function(){return _0x20ccb5;});}else{return _0x20ccb5;}})[_0xcba7('0x28')](function(_0x2b3075){logger[_0xcba7('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b3075);throw _0x2b3075;});}return _0x20ccb5;})['then'](respondWithResult(_0x5dccc6,0xc9))[_0xcba7('0x28')](handleError(_0x5dccc6,null));};exports[_0xcba7('0x30')]=function(_0x1da566,_0x14ee4c){if(_0x1da566[_0xcba7('0x5b')]['id']){delete _0x1da566[_0xcba7('0x5b')]['id'];}return db[_0xcba7('0x3b')][_0xcba7('0x59')]({'where':{'id':_0x1da566[_0xcba7('0x56')]['id']},'include':[{'model':db[_0xcba7('0x39')],'as':_0xcba7('0x57')}]})[_0xcba7('0x1e')](handleEntityNotFound(_0x14ee4c,null))[_0xcba7('0x1e')](saveUpdates(_0x1da566[_0xcba7('0x5b')],null))[_0xcba7('0x1e')](respondWithResult(_0x14ee4c,null))['catch'](handleError(_0x14ee4c,null));};exports[_0xcba7('0x31')]=function(_0x3130ea,_0x22244f){return db[_0xcba7('0x3b')]['find']({'where':{'id':_0x3130ea['params']['id']}})[_0xcba7('0x1e')](handleEntityNotFound(_0x22244f,null))['then'](removeEntity(_0x22244f,null))[_0xcba7('0x28')](handleError(_0x22244f,null));};exports[_0xcba7('0x62')]=function(_0x2d2809,_0x3ed826){return db['FaxAccount'][_0xcba7('0x62')]()[_0xcba7('0x1e')](respondWithResult(_0x3ed826,null))[_0xcba7('0x28')](handleError(_0x3ed826,null));};exports[_0xcba7('0x63')]=function(_0x42f33d,_0x8e657,_0x8b05ed){if(_0x42f33d['body']['id']){delete _0x42f33d[_0xcba7('0x5b')]['id'];}return db[_0xcba7('0x3b')][_0xcba7('0x59')]({'where':{'id':_0x42f33d[_0xcba7('0x56')]['id']}})[_0xcba7('0x1e')](handleEntityNotFound(_0x8e657,null))[_0xcba7('0x1e')](function(_0x10c53f){if(_0x10c53f){_0x42f33d[_0xcba7('0x5b')][_0xcba7('0x64')]=_0x10c53f['id'];return db[_0xcba7('0x65')][_0xcba7('0x5a')](_0x42f33d[_0xcba7('0x5b')]);}})[_0xcba7('0x1e')](respondWithResult(_0x8e657,null))['catch'](handleError(_0x8e657,null));};exports['getDispositions']=function(_0x5f38d7,_0x22d439,_0x283026){var _0x47bf71={'raw':![],'where':{}};var _0x474642={};var _0x218b17={'count':0x0,'rows':[]};return db[_0xcba7('0x3b')]['findOne']({'where':{'id':_0x5f38d7['params']['id']}})[_0xcba7('0x1e')](handleEntityNotFound(_0x22d439,null))[_0xcba7('0x1e')](function(_0x18f8a2){if(_0x18f8a2){_0x474642[_0xcba7('0x3e')]=_[_0xcba7('0x40')](db[_0xcba7('0x65')][_0xcba7('0x3c')]);_0x474642[_0xcba7('0x3f')]=_[_0xcba7('0x40')](_0x5f38d7[_0xcba7('0x3f')]);_0x474642[_0xcba7('0x41')]=_['intersection'](_0x474642[_0xcba7('0x3e')],_0x474642[_0xcba7('0x3f')]);_0x47bf71[_0xcba7('0x44')]=_[_0xcba7('0x42')](_0x474642['model'],qs['fields'](_0x5f38d7[_0xcba7('0x3f')]['fields']));_0x47bf71[_0xcba7('0x44')]=_0x47bf71['attributes'][_0xcba7('0x45')]?_0x47bf71[_0xcba7('0x44')]:_0x474642['model'];if(!_0x5f38d7[_0xcba7('0x3f')][_0xcba7('0x66')](_0xcba7('0x46'))){_0x47bf71[_0xcba7('0x47')]=qs[_0xcba7('0x47')](_0x5f38d7[_0xcba7('0x3f')][_0xcba7('0x47')]);_0x47bf71['offset']=qs['offset'](_0x5f38d7[_0xcba7('0x3f')][_0xcba7('0x2a')]);}_0x47bf71[_0xcba7('0x48')]=qs[_0xcba7('0x49')](_0x5f38d7[_0xcba7('0x3f')][_0xcba7('0x49')]);_0x47bf71['where']=qs['filters'](_[_0xcba7('0x4b')](_0x5f38d7[_0xcba7('0x3f')],_0x474642[_0xcba7('0x41')]));_0x47bf71[_0xcba7('0x4a')][_0xcba7('0x64')]=_0x18f8a2['id'];if(_0x5f38d7[_0xcba7('0x3f')][_0xcba7('0x4c')]){_0x47bf71['where']=_['merge'](_0x47bf71['where'],{'$or':_[_0xcba7('0x3a')](_0x47bf71[_0xcba7('0x44')],function(_0x4ecf05){var _0x32b418={};_0x32b418[_0x4ecf05]={'$like':'%'+_0x5f38d7[_0xcba7('0x3f')]['filter']+'%'};return _0x32b418;})});}_0x47bf71=_[_0xcba7('0x4d')]({},_0x47bf71,_0x5f38d7['options']);return db[_0xcba7('0x65')][_0xcba7('0x51')]({'where':_0x47bf71[_0xcba7('0x4a')]})[_0xcba7('0x1e')](function(_0x5f2ff6){_0x218b17['count']=_0x5f2ff6;if(_0x5f38d7['query'][_0xcba7('0x52')]){_0x47bf71[_0xcba7('0x58')]=[{'all':!![]}];}return db[_0xcba7('0x65')][_0xcba7('0x53')](_0x47bf71);})[_0xcba7('0x1e')](function(_0x2ae50d){_0x218b17['rows']=_0x2ae50d;return _0x218b17;});}})[_0xcba7('0x1e')](respondWithFilteredResult(_0x22d439,_0x47bf71))['catch'](handleError(_0x22d439,null));};exports[_0xcba7('0x67')]=function(_0x5b37bc,_0x1d9378,_0x5843f4){return db[_0xcba7('0x3b')][_0xcba7('0x59')]({'where':{'id':_0x5b37bc['params']['id']}})[_0xcba7('0x1e')](handleEntityNotFound(_0x1d9378,null))[_0xcba7('0x1e')](function(_0x2b3416){if(_0x2b3416){return _0x2b3416[_0xcba7('0x67')](_0x5b37bc[_0xcba7('0x3f')][_0xcba7('0x68')]);}})[_0xcba7('0x1e')](respondWithStatusCode(_0x1d9378,null))[_0xcba7('0x28')](handleError(_0x1d9378,null));};exports[_0xcba7('0x69')]=function(_0x30149a,_0xb21ede,_0x826181){if(_0x30149a[_0xcba7('0x5b')]['id']){delete _0x30149a[_0xcba7('0x5b')]['id'];}return db[_0xcba7('0x3b')][_0xcba7('0x59')]({'where':{'id':_0x30149a[_0xcba7('0x56')]['id']}})[_0xcba7('0x1e')](handleEntityNotFound(_0xb21ede,null))[_0xcba7('0x1e')](function(_0xa26996){if(_0xa26996){_0x30149a['body'][_0xcba7('0x64')]=_0xa26996['id'];return db[_0xcba7('0x6a')][_0xcba7('0x5a')](_0x30149a[_0xcba7('0x5b')]);}})[_0xcba7('0x1e')](respondWithResult(_0xb21ede,null))[_0xcba7('0x28')](handleError(_0xb21ede,null));};exports[_0xcba7('0x6b')]=function(_0x9c9077,_0x1d42fc,_0x223c00){var _0x38c21a={'raw':![],'where':{}};var _0x3c4017={};var _0x999628={'count':0x0,'rows':[]};return db[_0xcba7('0x3b')][_0xcba7('0x6c')]({'where':{'id':_0x9c9077['params']['id']}})['then'](handleEntityNotFound(_0x1d42fc,null))['then'](function(_0x3eefd6){if(_0x3eefd6){_0x3c4017[_0xcba7('0x3e')]=_[_0xcba7('0x40')](db[_0xcba7('0x6a')][_0xcba7('0x3c')]);_0x3c4017[_0xcba7('0x3f')]=_[_0xcba7('0x40')](_0x9c9077[_0xcba7('0x3f')]);_0x3c4017[_0xcba7('0x41')]=_[_0xcba7('0x42')](_0x3c4017[_0xcba7('0x3e')],_0x3c4017[_0xcba7('0x3f')]);_0x38c21a[_0xcba7('0x44')]=_['intersection'](_0x3c4017[_0xcba7('0x3e')],qs[_0xcba7('0x43')](_0x9c9077['query'][_0xcba7('0x43')]));_0x38c21a['attributes']=_0x38c21a[_0xcba7('0x44')][_0xcba7('0x45')]?_0x38c21a[_0xcba7('0x44')]:_0x3c4017[_0xcba7('0x3e')];if(!_0x9c9077[_0xcba7('0x3f')][_0xcba7('0x66')](_0xcba7('0x46'))){_0x38c21a[_0xcba7('0x47')]=qs['limit'](_0x9c9077[_0xcba7('0x3f')][_0xcba7('0x47')]);_0x38c21a['offset']=qs['offset'](_0x9c9077['query'][_0xcba7('0x2a')]);}_0x38c21a[_0xcba7('0x48')]=qs['sort'](_0x9c9077[_0xcba7('0x3f')]['sort']);_0x38c21a[_0xcba7('0x4a')]=qs[_0xcba7('0x41')](_['pick'](_0x9c9077[_0xcba7('0x3f')],_0x3c4017[_0xcba7('0x41')]));_0x38c21a[_0xcba7('0x4a')][_0xcba7('0x64')]=_0x3eefd6['id'];if(_0x9c9077['query'][_0xcba7('0x4c')]){_0x38c21a[_0xcba7('0x4a')]=_[_0xcba7('0x4d')](_0x38c21a[_0xcba7('0x4a')],{'$or':_[_0xcba7('0x3a')](_0x38c21a[_0xcba7('0x44')],function(_0x493fc3){var _0x2e68df={};_0x2e68df[_0x493fc3]={'$like':'%'+_0x9c9077[_0xcba7('0x3f')][_0xcba7('0x4c')]+'%'};return _0x2e68df;})});}_0x38c21a=_[_0xcba7('0x4d')]({},_0x38c21a,_0x9c9077[_0xcba7('0x50')]);return db[_0xcba7('0x6a')]['count']({'where':_0x38c21a[_0xcba7('0x4a')]})['then'](function(_0x53b0df){_0x999628[_0xcba7('0x51')]=_0x53b0df;if(_0x9c9077[_0xcba7('0x3f')][_0xcba7('0x52')]){_0x38c21a[_0xcba7('0x58')]=[{'all':!![]}];}return db[_0xcba7('0x6a')][_0xcba7('0x53')](_0x38c21a);})[_0xcba7('0x1e')](function(_0x148a86){_0x999628[_0xcba7('0x54')]=_0x148a86;return _0x999628;});}})[_0xcba7('0x1e')](respondWithFilteredResult(_0x1d42fc,_0x38c21a))[_0xcba7('0x28')](handleError(_0x1d42fc,null));};exports[_0xcba7('0x6d')]=function(_0x457082,_0x490ecc,_0x3068de){return db[_0xcba7('0x3b')]['find']({'where':{'id':_0x457082[_0xcba7('0x56')]['id']}})['then'](handleEntityNotFound(_0x490ecc,null))['then'](function(_0x353bee){if(_0x353bee){return _0x353bee[_0xcba7('0x6d')](_0x457082[_0xcba7('0x3f')][_0xcba7('0x68')]);}})[_0xcba7('0x1e')](respondWithStatusCode(_0x490ecc,null))[_0xcba7('0x28')](handleError(_0x490ecc,null));};exports[_0xcba7('0x6e')]=function(_0x3f73d2,_0x564337,_0x4b37e1){return db[_0xcba7('0x6f')][_0xcba7('0x59')]({'where':{'id':_0x3f73d2[_0xcba7('0x56')]['id']}})[_0xcba7('0x1e')](handleEntityNotFound(_0x564337,null))[_0xcba7('0x1e')](function(_0x335505){if(_0x335505){return _0x335505['addInteraction'](_0x3f73d2[_0xcba7('0x5b')]['ids'],_['omit'](_0x3f73d2[_0xcba7('0x5b')],[_0xcba7('0x68'),'id'])||{});}})['then'](respondWithResult(_0x564337,null))[_0xcba7('0x28')](handleError(_0x564337,null));};exports[_0xcba7('0x70')]=function(_0x34d32d,_0x3b8d7e,_0x50663e){var _0x2be4eb={'raw':![],'where':{}};var _0x590589={};var _0x1e4464={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x34d32d[_0xcba7('0x56')]['id']}})[_0xcba7('0x1e')](handleEntityNotFound(_0x3b8d7e,null))[_0xcba7('0x1e')](function(_0x5d12b5){if(_0x5d12b5){_0x590589[_0xcba7('0x3e')]=_[_0xcba7('0x40')](db[_0xcba7('0x6f')][_0xcba7('0x3c')]);_0x590589[_0xcba7('0x3f')]=_[_0xcba7('0x40')](_0x34d32d['query']);_0x590589[_0xcba7('0x41')]=_[_0xcba7('0x42')](_0x590589[_0xcba7('0x3e')],_0x590589[_0xcba7('0x3f')]);_0x2be4eb[_0xcba7('0x44')]=_[_0xcba7('0x42')](_0x590589['model'],qs[_0xcba7('0x43')](_0x34d32d['query'][_0xcba7('0x43')]));_0x2be4eb['attributes']=_0x2be4eb['attributes'][_0xcba7('0x45')]?_0x2be4eb[_0xcba7('0x44')]:_0x590589[_0xcba7('0x3e')];if(!_0x34d32d[_0xcba7('0x3f')][_0xcba7('0x66')]('nolimit')){_0x2be4eb[_0xcba7('0x47')]=qs['limit'](_0x34d32d[_0xcba7('0x3f')]['limit']);_0x2be4eb[_0xcba7('0x2a')]=qs[_0xcba7('0x2a')](_0x34d32d[_0xcba7('0x3f')][_0xcba7('0x2a')]);}_0x2be4eb[_0xcba7('0x48')]=qs[_0xcba7('0x49')](_0x34d32d[_0xcba7('0x3f')]['sort']);_0x2be4eb[_0xcba7('0x4a')]=qs[_0xcba7('0x41')](_[_0xcba7('0x4b')](_0x34d32d[_0xcba7('0x3f')],_0x590589[_0xcba7('0x41')]));_0x2be4eb[_0xcba7('0x4a')][_0xcba7('0x64')]=_0x5d12b5['id'];if(_0x34d32d[_0xcba7('0x3f')][_0xcba7('0x4c')]){_0x2be4eb[_0xcba7('0x4a')]=_['merge'](_0x2be4eb['where'],{'$or':_['map'](_0x2be4eb['attributes'],function(_0x5bbc65){var _0x3b682a={};_0x3b682a[_0x5bbc65]={'$like':'%'+_0x34d32d[_0xcba7('0x3f')][_0xcba7('0x4c')]+'%'};return _0x3b682a;})});}_0x2be4eb=_[_0xcba7('0x4d')]({},_0x2be4eb,_0x34d32d[_0xcba7('0x50')]);return db[_0xcba7('0x6f')]['count']({'where':_0x2be4eb[_0xcba7('0x4a')]})[_0xcba7('0x1e')](function(_0x4626a8){_0x1e4464[_0xcba7('0x51')]=_0x4626a8;if(_0x34d32d[_0xcba7('0x3f')][_0xcba7('0x52')]){_0x2be4eb[_0xcba7('0x58')]=[{'model':db[_0xcba7('0x71')],'as':_0xcba7('0x72'),'required':![]},{'model':db[_0xcba7('0x73')],'as':_0xcba7('0x74'),'attributes':[_0xcba7('0x36'),_0xcba7('0x75'),_0xcba7('0x76')],'required':![]},{'model':db[_0xcba7('0x77')],'as':_0xcba7('0x78'),'attributes':['id','name',_0xcba7('0x79')],'where':_0x34d32d['query'][_0xcba7('0x7a')]?{'id':_0x34d32d['query'][_0xcba7('0x7a')]}:undefined,'required':_0x34d32d['query'][_0xcba7('0x7a')]?!![]:![]}];}return db[_0xcba7('0x6f')]['findAll'](_0x2be4eb);})[_0xcba7('0x1e')](function(_0x5de830){_0x1e4464[_0xcba7('0x54')]=_0x5de830;return _0x1e4464;});}})[_0xcba7('0x1e')](respondWithFilteredResult(_0x3b8d7e,_0x2be4eb))[_0xcba7('0x28')](handleError(_0x3b8d7e,null));};exports['addApplications']=function(_0x527e36,_0x1c9a28){var _0xd9381a=_0x527e36['params']['id'];var _0x2136c6=_0x527e36[_0xcba7('0x5b')];var _0x605d23=0xc8;var _0x4366f6=null;return db[_0xcba7('0x7b')]['transaction']({'isolationLevel':db[_0xcba7('0x7b')][_0xcba7('0x7c')][_0xcba7('0x7d')][_0xcba7('0x7e')]},function(_0x4f8696){return db['FaxAccount'][_0xcba7('0x6c')]({'where':{'id':_0xd9381a},'transaction':_0x4f8696})['then'](function(_0x38062a){if(_0x38062a){return db['FaxApplication'][_0xcba7('0x31')]({'where':{'FaxAccountId':_0xd9381a},'transaction':_0x4f8696})[_0xcba7('0x1e')](function(){var _0x4bf834=_[_0xcba7('0x3a')](_0x2136c6,function(_0x2d9c08){_0x2d9c08[_0xcba7('0x64')]=_0xd9381a;return _0x2d9c08;});return db[_0xcba7('0x7f')][_0xcba7('0x80')](_0x4bf834,{'transaction':_0x4f8696});});}else{_0x605d23=0x194;_0x4366f6=[];}});})[_0xcba7('0x1e')](function(){if(_0x605d23!==0x194){return db[_0xcba7('0x7f')][_0xcba7('0x81')]({'where':{'FaxAccountId':_0xd9381a},'order':_0xcba7('0x82')})['then'](function(_0x292f69){_0x4366f6=_0x292f69;});}})['catch'](function(_0x494275){_0x605d23=0x1f4;logger[_0xcba7('0x24')](_0x494275[_0xcba7('0x83')]);if(_0x494275[_0xcba7('0x36')]){delete _0x494275[_0xcba7('0x36')];}_0x4366f6=_0x494275;})[_0xcba7('0x84')](function(){if(_0x4366f6===null){_0x1c9a28[_0xcba7('0x35')](_0x605d23);}else{if(_0x605d23===0x1f4){_0x1c9a28[_0xcba7('0x29')](_0x605d23)[_0xcba7('0x37')](_0x4366f6);}else{_0x1c9a28['status'](_0x605d23)['json'](_0x4366f6);}}});};exports[_0xcba7('0x85')]=function(_0x594c0d,_0x1c8ec9,_0x51973a){var _0x1101a8={};var _0x35eceb={};var _0x175d9d;var _0x447d81;return db[_0xcba7('0x3b')]['findOne']({'where':{'id':_0x594c0d['params']['id']}})[_0xcba7('0x1e')](handleEntityNotFound(_0x1c8ec9,null))[_0xcba7('0x1e')](function(_0x5157b0){if(_0x5157b0){_0x175d9d=_0x5157b0;_0x35eceb[_0xcba7('0x3e')]=_['keys'](db['FaxApplication'][_0xcba7('0x3c')]);_0x35eceb[_0xcba7('0x3f')]=_[_0xcba7('0x40')](_0x594c0d[_0xcba7('0x3f')]);_0x35eceb['filters']=_[_0xcba7('0x42')](_0x35eceb['model'],_0x35eceb[_0xcba7('0x3f')]);_0x1101a8[_0xcba7('0x44')]=_[_0xcba7('0x42')](_0x35eceb[_0xcba7('0x3e')],qs[_0xcba7('0x43')](_0x594c0d['query'][_0xcba7('0x43')]));_0x1101a8[_0xcba7('0x44')]=_0x1101a8['attributes'][_0xcba7('0x45')]?_0x1101a8[_0xcba7('0x44')]:_0x35eceb[_0xcba7('0x3e')];_0x1101a8['order']=qs['sort'](_0x594c0d[_0xcba7('0x3f')][_0xcba7('0x49')]);_0x1101a8[_0xcba7('0x4a')]=qs[_0xcba7('0x41')](_[_0xcba7('0x4b')](_0x594c0d['query'],_0x35eceb[_0xcba7('0x41')]));if(_0x594c0d['query'][_0xcba7('0x4c')]){_0x1101a8[_0xcba7('0x4a')]=_[_0xcba7('0x4d')](_0x1101a8[_0xcba7('0x4a')],{'$or':_[_0xcba7('0x3a')](_0x1101a8['attributes'],function(_0x27d378){var _0x48e7d2={};_0x48e7d2[_0x27d378]={'$like':'%'+_0x594c0d[_0xcba7('0x3f')][_0xcba7('0x4c')]+'%'};return _0x48e7d2;})});}_0x1101a8=_['merge']({},_0x1101a8,_0x594c0d[_0xcba7('0x50')]);return _0x175d9d[_0xcba7('0x85')](_0x1101a8);}})[_0xcba7('0x1e')](function(_0x200054){if(_0x200054){_0x447d81=_0x200054[_0xcba7('0x45')];if(!_0x594c0d[_0xcba7('0x3f')]['hasOwnProperty'](_0xcba7('0x46'))){_0x1101a8[_0xcba7('0x47')]=qs[_0xcba7('0x47')](_0x594c0d[_0xcba7('0x3f')][_0xcba7('0x47')]);_0x1101a8['offset']=qs[_0xcba7('0x2a')](_0x594c0d['query'][_0xcba7('0x2a')]);}return _0x175d9d[_0xcba7('0x85')](_0x1101a8);}})[_0xcba7('0x1e')](function(_0x4e0f7d){if(_0x4e0f7d){return _0x4e0f7d?{'count':_0x447d81,'rows':_0x4e0f7d}:null;}})[_0xcba7('0x1e')](respondWithResult(_0x1c8ec9,null))[_0xcba7('0x28')](handleError(_0x1c8ec9,null));};function Extension(_0x21464e,_0x5e5908,_0x3230a8,_0x538afd){this['context']=_0xcba7('0x86');this['exten']=_0x21464e[_0xcba7('0x87')];this[_0xcba7('0x88')]=_0x538afd;this[_0xcba7('0x4e')]=_0xcba7('0x89');this['description']=_0xcba7('0x8a');this['FaxAccountId']=_0x21464e['id'];this[_0xcba7('0x82')]=_0x5e5908;this['appdata']=_0x3230a8;}function createExtensionsReciveFax(_0xd05b2e){var _0x433db5=0x1;var _0x25f78d=[];_0x25f78d[_0xcba7('0x8b')](new Extension(_0xd05b2e,_0x433db5,'',_0xcba7('0x8c')));_0x433db5+=0x1;_0x25f78d[_0xcba7('0x8b')](new Extension(_0xd05b2e,_0x433db5,'CDR(type)=inbound-fax',_0xcba7('0x8d')));_0x433db5+=0x1;for(var _0x34e0c2 in _0xd05b2e){if(_0xd05b2e[_0xcba7('0x66')](_0x34e0c2)&&(_0x34e0c2===_0xcba7('0x8e')||_0x34e0c2===_0xcba7('0x87')||_0x34e0c2==='gateway'||_0x34e0c2===_0xcba7('0x8f')||_0x34e0c2===_0xcba7('0x90')||_0x34e0c2===_0xcba7('0x91')||_0x34e0c2===_0xcba7('0x92')||_0x34e0c2===_0xcba7('0x93')||_0x34e0c2==='t38timeout')){_0x25f78d[_0xcba7('0x8b')](new Extension(_0xd05b2e,_0x433db5,_0xcba7('0x94')+_0x34e0c2+')='+_0xd05b2e[_0x34e0c2],_0xcba7('0x8d')));_0x433db5+=0x1;}}_0x25f78d[_0xcba7('0x8b')](new Extension(_0xd05b2e,_0x433db5,'6','Wait'));_0x433db5+=0x1;_0x25f78d[_0xcba7('0x8b')](new Extension(_0xd05b2e,_0x433db5,_0xcba7('0x95'),_0xcba7('0x96')));_0x433db5=0x0;return _0x25f78d;}exports[_0xcba7('0x97')]=function(_0x498f1,_0x2ef7fe,_0xa3f2a3){var _0x54487e;return db[_0xcba7('0x7b')][_0xcba7('0x98')](function(_0x510293){return db[_0xcba7('0x3b')][_0xcba7('0x5a')](_0x498f1[_0xcba7('0x5b')],{'transaction':_0x510293})[_0xcba7('0x1e')](function(_0xeee7e7){_0x54487e=_0xeee7e7[_0xcba7('0x5c')]({'plain':!![]});return db['VoiceExtension'][_0xcba7('0x80')](createExtensionsReciveFax(_0x54487e),{'transaction':_0x510293});});})[_0xcba7('0x1e')](function(){return _0x54487e;})[_0xcba7('0x1e')](respondWithResult(_0x2ef7fe,null))[_0xcba7('0x28')](handleError(_0x2ef7fe,null));};exports[_0xcba7('0x99')]=function(_0x4677d7,_0x1fdf02,_0x191025){var _0x361421;return db[_0xcba7('0x7b')][_0xcba7('0x98')](function(_0x1a6f14){return db[_0xcba7('0x3b')]['update'](_0x4677d7[_0xcba7('0x5b')],{'where':{'id':_0x4677d7[_0xcba7('0x5b')]['id']},'transaction':_0x1a6f14})[_0xcba7('0x1e')](function(_0x4612cd){return db[_0xcba7('0x9a')][_0xcba7('0x31')]({'where':{'FaxAccountId':_0x4677d7[_0xcba7('0x5b')]['id']},'transaction':_0x1a6f14})[_0xcba7('0x1e')](function(_0x5e605a){return db[_0xcba7('0x9a')][_0xcba7('0x80')](createExtensionsReciveFax(_[_0xcba7('0x9b')](_0x4677d7[_0xcba7('0x5b')],[_0xcba7('0x9c'),'key',_0xcba7('0x9d'),_0xcba7('0x9e'),'TrunkId',_0xcba7('0x9f')])),{'transaction':_0x1a6f14});});});})[_0xcba7('0x1e')](function(){return db[_0xcba7('0x3b')][_0xcba7('0xa0')](_0x4677d7[_0xcba7('0x5b')]['id']);})[_0xcba7('0x1e')](respondWithResult(_0x1fdf02,null))['catch'](handleError(_0x1fdf02,null));};exports['getMessages']=function(_0x530433,_0x18e440,_0x5aa446){var _0x544744={'raw':!![],'where':{}};var _0x4d71e8={};var _0x504538={'count':0x0,'rows':[]};return db['FaxAccount'][_0xcba7('0x6c')]({'where':{'id':_0x530433[_0xcba7('0x56')]['id']}})[_0xcba7('0x1e')](handleEntityNotFound(_0x18e440,null))[_0xcba7('0x1e')](function(_0x4aec54){if(_0x4aec54){_0x4d71e8[_0xcba7('0x3e')]=_[_0xcba7('0x40')](db[_0xcba7('0xa1')][_0xcba7('0x3c')]);_0x4d71e8['query']=_[_0xcba7('0x40')](_0x530433[_0xcba7('0x3f')]);_0x4d71e8['filters']=_[_0xcba7('0x42')](_0x4d71e8[_0xcba7('0x3e')],_0x4d71e8[_0xcba7('0x3f')]);_0x544744[_0xcba7('0x44')]=_[_0xcba7('0x42')](_0x4d71e8[_0xcba7('0x3e')],qs[_0xcba7('0x43')](_0x530433[_0xcba7('0x3f')][_0xcba7('0x43')]));_0x544744[_0xcba7('0x44')]=_0x544744[_0xcba7('0x44')][_0xcba7('0x45')]?_0x544744[_0xcba7('0x44')]:_0x4d71e8[_0xcba7('0x3e')];if(!_0x530433[_0xcba7('0x3f')][_0xcba7('0x66')](_0xcba7('0x46'))){_0x544744[_0xcba7('0x47')]=qs[_0xcba7('0x47')](_0x530433['query'][_0xcba7('0x47')]);_0x544744[_0xcba7('0x2a')]=qs[_0xcba7('0x2a')](_0x530433['query'][_0xcba7('0x2a')]);}_0x544744['order']=qs[_0xcba7('0x49')](_0x530433[_0xcba7('0x3f')][_0xcba7('0x49')]);_0x544744[_0xcba7('0x4a')]=qs[_0xcba7('0x41')](_['pick'](_0x530433[_0xcba7('0x3f')],_0x4d71e8[_0xcba7('0x41')]));_0x544744[_0xcba7('0x4a')][_0xcba7('0x64')]=_0x4aec54['id'];if(_0x530433[_0xcba7('0x3f')]['filter']){_0x544744[_0xcba7('0x4a')]=_[_0xcba7('0x4d')](_0x544744['where'],{'$or':_[_0xcba7('0x3a')](_0x544744[_0xcba7('0x44')],function(_0x1d06fa){var _0x18c994={};_0x18c994[_0x1d06fa]={'$like':'%'+_0x530433[_0xcba7('0x3f')][_0xcba7('0x4c')]+'%'};return _0x18c994;})});}if(_0x530433[_0xcba7('0x3f')][_0xcba7('0xa2')]){var _0x5f5d3a=_0x530433['query'][_0xcba7('0xa2')][_0xcba7('0xa3')](',');var _0x565a7c={};_0x565a7c[_0x5f5d3a[0x0]]={'$gte':moment(_0x5f5d3a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x544744[_0xcba7('0x4a')]=_[_0xcba7('0x4d')](_0x544744['where'],_0x565a7c);}_0x544744=_[_0xcba7('0x4d')]({},_0x544744,_0x530433[_0xcba7('0x50')]);return db[_0xcba7('0xa1')][_0xcba7('0x51')]({'where':_0x544744[_0xcba7('0x4a')]})[_0xcba7('0x1e')](function(_0x13c018){_0x504538[_0xcba7('0x51')]=_0x13c018;if(_0x530433[_0xcba7('0x3f')]['includeAll']){_0x544744['include']=[{'all':!![]}];}return db[_0xcba7('0xa1')]['findAll'](_0x544744);})['then'](function(_0x509dcd){_0x504538[_0xcba7('0x54')]=_0x509dcd;return _0x504538;});}})[_0xcba7('0x1e')](respondWithFilteredResult(_0x18e440,_0x544744))[_0xcba7('0x28')](handleError(_0x18e440,null));};exports['send']=function(_0x2534d8,_0x2babcf,_0x2e2d4c){var _0x2a61d3,_0x2206f3={},_0x2fdbc2;if(_0x2534d8['body']['to']){_0x2fdbc2=_0x2534d8[_0xcba7('0x5b')]['to'][0x0];}return db['FaxAccount'][_0xcba7('0x59')]({'where':{'id':_0x2534d8['params']['id']},'include':[{'model':db[_0xcba7('0xa4')],'as':_0xcba7('0xa5'),'include':[{'model':db[_0xcba7('0x71')],'as':_0xcba7('0xa6'),'where':{'fax':_0x2fdbc2},'limit':0x1,'order':[[_0xcba7('0x9e'),'DESC']]}]}]})[_0xcba7('0x1e')](handleEntityNotFound(_0x2babcf,null))[_0xcba7('0x1e')](function(_0x1b3875){_0x2a61d3=_0x1b3875;if(_0x2534d8[_0xcba7('0x5b')]['attachments']&&_0x2534d8[_0xcba7('0x5b')]['attachments'][_0xcba7('0x45')]){for(var _0x1523e4=0x0;_0x1523e4<_0x2534d8['body'][_0xcba7('0xa7')][_0xcba7('0x45')];_0x1523e4+=0x1){_0x2534d8[_0xcba7('0x5b')]['attachments'][_0x1523e4]={'filename':_0x2534d8[_0xcba7('0x5b')][_0xcba7('0xa7')][_0x1523e4]['name'],'id':_0x2534d8[_0xcba7('0x5b')]['attachments'][_0x1523e4]['id'],'path':path[_0xcba7('0xa8')](config[_0xcba7('0xa9')],_0xcba7('0xaa'),_0x2534d8[_0xcba7('0x5b')]['attachments'][_0x1523e4][_0xcba7('0xab')])};}}return respondWithRpcPromise(_0xcba7('0xac'),_0xcba7('0xac'),{'FaxAccountId':_[_0xcba7('0xad')](_0x2534d8['params']['id'])?undefined:_0x2534d8[_0xcba7('0x56')]['id'],'path':_[_0xcba7('0xad')](_0x2534d8[_0xcba7('0x5b')]['attachments'][0x0][_0xcba7('0x7')])?undefined:_0x2534d8[_0xcba7('0x5b')][_0xcba7('0xa7')][0x0][_0xcba7('0x7')],'fax':_['isNil'](_0x2534d8[_0xcba7('0x5b')]['to'][0x0])?undefined:_0x2534d8['body']['to'][0x0]},client9002);})['then'](function(){if(_0x2a61d3){if(_[_0xcba7('0xad')](_0x2534d8[_0xcba7('0x5b')][_0xcba7('0xae')])){_0x2534d8['body']['from']=util['format']('\x22%s\x22\x20<%s>',_0x2a61d3[_0xcba7('0x36')],_0x2a61d3[_0xcba7('0xaf')]);}if(_0x2a61d3['List']){if(_0x2a61d3['List'][_0xcba7('0xa6')][_0xcba7('0x45')]){return _0x2a61d3[_0xcba7('0xa5')]['Contacts'][0x0];}else{return db[_0xcba7('0x71')][_0xcba7('0x5a')](_[_0xcba7('0xb0')](_0x2534d8['body'],{'firstName':_0x2534d8[_0xcba7('0x5b')]['to'][0x0],'phone':_0x2534d8['body']['to'][0x0],'fax':_0x2534d8[_0xcba7('0x5b')]['to'][0x0],'ListId':_0x2a61d3[_0xcba7('0x9f')]}));}}else{throw new Error(_0xcba7('0xb1'));}}else{throw new Error(_0xcba7('0xb2'));}})[_0xcba7('0x1e')](function(_0x4c39de){if(_0x4c39de){return db[_0xcba7('0x6f')][_0xcba7('0x59')]({'where':{'ContactId':_0x4c39de['id'],'closed':![],'FaxAccountId':_0x2a61d3['id']}})[_0xcba7('0x1e')](function(_0x527c3b){if(_0x527c3b){return[_0x527c3b,![]];}return db[_0xcba7('0x6f')]['create']({'UserId':_0x2534d8['user']['id'],'ContactId':_0x4c39de['id'],'FaxAccountId':_0x2a61d3['id'],'fax':_0x2534d8[_0xcba7('0x5b')]['to'][0x0],'firstMsgDirection':_0xcba7('0xb3'),'Messages':[_[_0xcba7('0x4d')](_0x2534d8[_0xcba7('0x5b')],{'read':![],'body':_0x2534d8[_0xcba7('0x5b')][_0xcba7('0xa7')][0x0]['filename'],'FaxAccountId':_0x2a61d3['id'],'UserId':_0x2534d8[_0xcba7('0x5f')]['id'],'ContactId':_0x4c39de['id'],'AttachmentId':_0x2534d8[_0xcba7('0x5b')][_0xcba7('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0xcba7('0xa1')],'as':_0xcba7('0xb4')}]})['then'](function(_0x2b412c){return[_0x2b412c,!![]];});});}else{throw new Error(_0xcba7('0xb5'));}})['spread'](function(_0x29d4fc,_0x4845b6){if(_0x4845b6){return _0x29d4fc;}return db[_0xcba7('0xa1')][_0xcba7('0x5a')]({'direction':_0xcba7('0xb3'),'read':![],'body':_0x2534d8['body'][_0xcba7('0xa7')][0x0]['filename'],'FaxAccountId':_0x2a61d3['id'],'FaxInteractionId':_0x29d4fc['id'],'UserId':_0x2534d8[_0xcba7('0x5f')]['id'],'ContactId':_0x29d4fc[_0xcba7('0xb6')],'AttachmentId':_0x2534d8[_0xcba7('0x5b')][_0xcba7('0xa7')][0x0]['id']})['then'](function(_0x4b7e2b){_0x29d4fc[_0xcba7('0xb7')][_0xcba7('0xb4')]=[];_0x29d4fc[_0xcba7('0xb7')]['Messages'][_0xcba7('0x8b')](_0x4b7e2b[_0xcba7('0xb7')]);return _0x29d4fc;});})[_0xcba7('0x1e')](function(_0x5f2655){respondWithRpcPromise(_0xcba7('0xb8'),'SendFax',{'FaxAccountId':_[_0xcba7('0xad')](_0x2534d8['params']['id'])?undefined:_0x2534d8['params']['id'],'path':_[_0xcba7('0xad')](_0x2534d8[_0xcba7('0x5b')][_0xcba7('0xa7')][0x0]['path'])?undefined:_0x2534d8['body'][_0xcba7('0xa7')][0x0][_0xcba7('0x7')],'fax':_[_0xcba7('0xad')](_0x2534d8[_0xcba7('0x5b')]['to'][0x0])?undefined:_0x2534d8[_0xcba7('0x5b')]['to'][0x0],'AttachmentId':_0x2534d8['body'][_0xcba7('0xa7')][0x0]['id']},client9002)[_0xcba7('0x1e')](function(_0xe487f9){logger[_0xcba7('0x27')](_0xcba7('0xb9'),_0xe487f9);})[_0xcba7('0x28')](function(_0x58d4b0){logger[_0xcba7('0x27')]('SendFaxRpc,\x20%s',_0x58d4b0);});return _0x5f2655;})[_0xcba7('0x1e')](respondWithResult(_0x2babcf,null))[_0xcba7('0x28')](handleError(_0x2babcf,null));};exports[_0xcba7('0xba')]=function(_0x3eb7ff,_0x31b5fd,_0x5292a7){return db[_0xcba7('0x3b')]['find']({'where':{'id':_0x3eb7ff['params']['id']}})[_0xcba7('0x1e')](handleEntityNotFound(_0x31b5fd,null))['then'](function(_0x5d5260){if(_0x5d5260){return _0x5d5260[_0xcba7('0xba')](_0x3eb7ff[_0xcba7('0x5b')][_0xcba7('0x68')],_[_0xcba7('0x9b')](_0x3eb7ff[_0xcba7('0x5b')],[_0xcba7('0x68'),'id'])||{})[_0xcba7('0xbb')](function(_0x52649a){for(var _0x36f38c=0x0;_0x36f38c<_0x3eb7ff[_0xcba7('0x5b')]['ids'][_0xcba7('0x45')];_0x36f38c+=0x1){socket[_0xcba7('0xbc')](_0xcba7('0xbd'),{'UserId':Number(_0x3eb7ff[_0xcba7('0x5b')][_0xcba7('0x68')][_0x36f38c]),'FaxAccountId':Number(_0x3eb7ff[_0xcba7('0x56')]['id'])});}return _0x52649a;});}})[_0xcba7('0x1e')](respondWithResult(_0x31b5fd,null))[_0xcba7('0x28')](handleError(_0x31b5fd,null));};exports[_0xcba7('0xbe')]=function(_0xa45f6a,_0x2bf780,_0x1d8494){return db[_0xcba7('0x3b')][_0xcba7('0x59')]({'where':{'id':_0xa45f6a['params']['id']}})['then'](handleEntityNotFound(_0x2bf780,null))['then'](function(_0x42d9bb){if(_0x42d9bb){return _0x42d9bb['removeAgents'](_0xa45f6a['query']['ids'])[_0xcba7('0x1e')](function(){if(_[_0xcba7('0xbf')](_0xa45f6a[_0xcba7('0x3f')][_0xcba7('0x68')])){for(var _0x5eb017=0x0;_0x5eb017<_0xa45f6a[_0xcba7('0x3f')][_0xcba7('0x68')][_0xcba7('0x45')];_0x5eb017+=0x1){socket[_0xcba7('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0xa45f6a[_0xcba7('0x3f')][_0xcba7('0x68')][_0x5eb017]),'FaxAccountId':Number(_0xa45f6a[_0xcba7('0x56')]['id'])});}}else{socket[_0xcba7('0xbc')](_0xcba7('0xc0'),{'UserId':Number(_0xa45f6a[_0xcba7('0x3f')][_0xcba7('0x68')]),'FaxAccountId':Number(_0xa45f6a[_0xcba7('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x2bf780,null))['catch'](handleError(_0x2bf780,null));};exports[_0xcba7('0xc1')]=function(_0x96dc3b,_0x2e2d7a,_0x5e592a){var _0x1ee83e={};var _0x1a44c4={};var _0x49ea04;var _0x2f0bbf;return db[_0xcba7('0x3b')][_0xcba7('0x6c')]({'where':{'id':_0x96dc3b[_0xcba7('0x56')]['id']}})['then'](handleEntityNotFound(_0x2e2d7a,null))[_0xcba7('0x1e')](function(_0x4ce455){if(_0x4ce455){_0x49ea04=_0x4ce455;_0x1a44c4[_0xcba7('0x3e')]=_[_0xcba7('0x40')](db[_0xcba7('0x73')]['rawAttributes']);_0x1a44c4[_0xcba7('0x3f')]=_[_0xcba7('0x40')](_0x96dc3b[_0xcba7('0x3f')]);_0x1a44c4[_0xcba7('0x41')]=_[_0xcba7('0x42')](_0x1a44c4[_0xcba7('0x3e')],_0x1a44c4[_0xcba7('0x3f')]);_0x1ee83e[_0xcba7('0x44')]=_[_0xcba7('0x42')](_0x1a44c4['model'],qs[_0xcba7('0x43')](_0x96dc3b[_0xcba7('0x3f')]['fields']));_0x1ee83e[_0xcba7('0x44')]=_0x1ee83e[_0xcba7('0x44')][_0xcba7('0x45')]?_0x1ee83e[_0xcba7('0x44')]:_0x1a44c4[_0xcba7('0x3e')];_0x1ee83e[_0xcba7('0x48')]=qs[_0xcba7('0x49')](_0x96dc3b['query'][_0xcba7('0x49')]);_0x1ee83e[_0xcba7('0x4a')]=qs[_0xcba7('0x41')](_[_0xcba7('0x4b')](_0x96dc3b[_0xcba7('0x3f')],_0x1a44c4[_0xcba7('0x41')]));if(_0x96dc3b[_0xcba7('0x3f')][_0xcba7('0x4c')]){_0x1ee83e[_0xcba7('0x4a')]=_[_0xcba7('0x4d')](_0x1ee83e[_0xcba7('0x4a')],{'$or':_[_0xcba7('0x3a')](_0x1ee83e[_0xcba7('0x44')],function(_0x27c483){var _0x439047={};_0x439047[_0x27c483]={'$like':'%'+_0x96dc3b[_0xcba7('0x3f')]['filter']+'%'};return _0x439047;})});}_0x1ee83e=_['merge']({},_0x1ee83e,_0x96dc3b[_0xcba7('0x50')]);return _0x49ea04[_0xcba7('0xc1')](_0x1ee83e);}})[_0xcba7('0x1e')](function(_0x5ba333){if(_0x5ba333){_0x2f0bbf=_0x5ba333[_0xcba7('0x45')];if(!_0x96dc3b[_0xcba7('0x3f')]['hasOwnProperty'](_0xcba7('0x46'))){_0x1ee83e[_0xcba7('0x47')]=qs[_0xcba7('0x47')](_0x96dc3b[_0xcba7('0x3f')][_0xcba7('0x47')]);_0x1ee83e['offset']=qs[_0xcba7('0x2a')](_0x96dc3b[_0xcba7('0x3f')][_0xcba7('0x2a')]);}return _0x49ea04['getAgents'](_0x1ee83e);}})[_0xcba7('0x1e')](function(_0x46d244){if(_0x46d244){return _0x46d244?{'count':_0x2f0bbf,'rows':_0x46d244}:null;}})[_0xcba7('0x1e')](respondWithResult(_0x2e2d7a,null))[_0xcba7('0x28')](handleError(_0x2e2d7a,null));}; \ No newline at end of file +var _0x3698=['isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','jayson/promise','client','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','FaxAccounts','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','where','filter','options','includeAll','include','rows','params','merge','find','create','body','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','Disposition','hasOwnProperty','nolimit','findAll','removeDispositions','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','ids','omit','getInteractions','findOne','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','send','json','getApplications','context','from-voip-provider','localstationid','app','description','Fax\x20Extension','push','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','maxrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','createdAt','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents'];(function(_0x3a1a0e,_0x1e95ae){var _0x370d21=function(_0x42203b){while(--_0x42203b){_0x3a1a0e['push'](_0x3a1a0e['shift']());}};_0x370d21(++_0x1e95ae);}(_0x3698,0x189));var _0x8369=function(_0x345b70,_0x4dc245){_0x345b70=_0x345b70-0x0;var _0x23068c=_0x3698[_0x345b70];return _0x23068c;};'use strict';var emlformat=require(_0x8369('0x0'));var rimraf=require(_0x8369('0x1'));var zipdir=require(_0x8369('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8369('0x3'));var moment=require('moment');var BPromise=require(_0x8369('0x4'));var Mustache=require('mustache');var util=require(_0x8369('0x5'));var path=require(_0x8369('0x6'));var sox=require(_0x8369('0x7'));var csv=require(_0x8369('0x8'));var ejs=require(_0x8369('0x9'));var fs=require('fs');var fs_extra=require(_0x8369('0xa'));var _=require(_0x8369('0xb'));var squel=require(_0x8369('0xc'));var crypto=require(_0x8369('0xd'));var jsforce=require(_0x8369('0xe'));var deskjs=require(_0x8369('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8369('0x10'));var Papa=require('papaparse');var Redis=require(_0x8369('0x11'));var authService=require(_0x8369('0x12'));var qs=require(_0x8369('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8369('0x14'));var logger=require(_0x8369('0x15'))(_0x8369('0x16'));var utils=require(_0x8369('0x17'));var config=require(_0x8369('0x18'));var licenseUtil=require(_0x8369('0x19'));var db=require(_0x8369('0x1a'))['db'];config[_0x8369('0x1b')]=_[_0x8369('0x1c')](config[_0x8369('0x1b')],{'host':_0x8369('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8369('0x1b')]));require(_0x8369('0x1e'))['register'](socket);var jayson=require(_0x8369('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x8369('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20defc,_0x361393,_0x4c3732,_0x45e3db){return new BPromise(function(_0x1dcb8a,_0x3417df){var _0xdb752=_0x45e3db||client;return _0xdb752['request'](_0x20defc,_0x4c3732)['then'](function(_0x567e94){logger[_0x8369('0x21')](_0x8369('0x22'),_0x361393,_0x8369('0x23'));logger[_0x8369('0x24')](_0x8369('0x25'),_0x361393,_0x8369('0x23'),JSON[_0x8369('0x26')](_0x567e94));if(_0x567e94['error']){if(_0x567e94[_0x8369('0x27')][_0x8369('0x28')]===0x1f4){logger[_0x8369('0x27')]('FaxAccount,\x20%s,\x20%s',_0x361393,_0x567e94[_0x8369('0x27')][_0x8369('0x29')]);return _0x3417df(_0x567e94['error']['message']);}logger[_0x8369('0x27')](_0x8369('0x22'),_0x361393,_0x567e94[_0x8369('0x27')][_0x8369('0x29')]);return _0x1dcb8a(_0x567e94[_0x8369('0x27')][_0x8369('0x29')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x361393,_0x8369('0x23'));_0x1dcb8a(_0x567e94[_0x8369('0x2a')][_0x8369('0x29')]);}})[_0x8369('0x2b')](function(_0x360483){logger['error'](_0x8369('0x22'),_0x361393,_0x360483);_0x3417df(_0x360483);});});}function respondWithStatusCode(_0x5891c1,_0x45a670){_0x45a670=_0x45a670||0xcc;return function(_0x263a43){if(_0x263a43){return _0x5891c1[_0x8369('0x2c')](_0x45a670);}return _0x5891c1[_0x8369('0x2d')](_0x45a670)['end']();};}function respondWithResult(_0x59749e,_0x273c6b){_0x273c6b=_0x273c6b||0xc8;return function(_0x2eed29){if(_0x2eed29){return _0x59749e[_0x8369('0x2d')](_0x273c6b)['json'](_0x2eed29);}};}function respondWithFilteredResult(_0x187edb,_0xfa600c){return function(_0x26987f){if(_0x26987f){var _0x27116d=typeof _0xfa600c[_0x8369('0x2e')]===_0x8369('0x2f')&&typeof _0xfa600c[_0x8369('0x30')]==='undefined';var _0xdb8156=_0x26987f[_0x8369('0x31')];var _0x5a8d73=_0x27116d?0x0:_0xfa600c['offset'];var _0x4301f3=_0x27116d?_0x26987f[_0x8369('0x31')]:_0xfa600c[_0x8369('0x2e')]+_0xfa600c[_0x8369('0x30')];var _0x2e548e;if(_0x4301f3>=_0xdb8156){_0x4301f3=_0xdb8156;_0x2e548e=0xc8;}else{_0x2e548e=0xce;}_0x187edb[_0x8369('0x2d')](_0x2e548e);return _0x187edb['set'](_0x8369('0x32'),_0x5a8d73+'-'+_0x4301f3+'/'+_0xdb8156)['json'](_0x26987f);}return null;};}function patchUpdates(_0x5d3755){return function(_0x2f19e2){try{jsonpatch[_0x8369('0x33')](_0x2f19e2,_0x5d3755,!![]);}catch(_0x2b8a49){return BPromise[_0x8369('0x34')](_0x2b8a49);}return _0x2f19e2['save']();};}function saveUpdates(_0x398e5f,_0x5b78f2){return function(_0xff5055){if(_0xff5055){return _0xff5055[_0x8369('0x35')](_0x398e5f)[_0x8369('0x36')](function(_0x470844){return _0x470844;});}return null;};}function removeEntity(_0xa8d111,_0x1f4cd9){return function(_0x34c865){if(_0x34c865){return _0x34c865['destroy']()[_0x8369('0x36')](function(){var _0xf61033=_0x34c865[_0x8369('0x37')]({'plain':!![]});var _0xa088fd=_0x8369('0x38');return db['UserProfileResource'][_0x8369('0x39')]({'where':{'type':_0xa088fd,'resourceId':_0xf61033['id']}})[_0x8369('0x36')](function(){return _0x34c865;});})[_0x8369('0x36')](function(){_0xa8d111[_0x8369('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x202daa,_0xe0563e){return function(_0x189575){if(!_0x189575){_0x202daa['sendStatus'](0x194);}return _0x189575;};}function handleError(_0x4123e4,_0x3159c3){_0x3159c3=_0x3159c3||0x1f4;return function(_0x4666a5){logger[_0x8369('0x27')](_0x4666a5[_0x8369('0x3a')]);if(_0x4666a5[_0x8369('0x3b')]){delete _0x4666a5[_0x8369('0x3b')];}_0x4123e4[_0x8369('0x2d')](_0x3159c3)['send'](_0x4666a5);};}exports[_0x8369('0x3c')]=function(_0x3007ae,_0x583026){var _0x52b39b={'include':[{'model':db[_0x8369('0x3d')],'as':_0x8369('0x3e')}]},_0x577eac={},_0x1814c1={'count':0x0,'rows':[]};var _0x4f0d1d=_[_0x8369('0x3f')](db[_0x8369('0x40')][_0x8369('0x41')],function(_0x3126cc){return{'name':_0x3126cc[_0x8369('0x42')],'type':_0x3126cc[_0x8369('0x43')][_0x8369('0x44')]};});_0x577eac[_0x8369('0x45')]=_['map'](_0x4f0d1d,'name');_0x577eac[_0x8369('0x46')]=_[_0x8369('0x47')](_0x3007ae[_0x8369('0x46')]);_0x577eac[_0x8369('0x48')]=_[_0x8369('0x49')](_0x577eac[_0x8369('0x45')],_0x577eac[_0x8369('0x46')]);_0x52b39b[_0x8369('0x4a')]=_[_0x8369('0x49')](_0x577eac[_0x8369('0x45')],qs[_0x8369('0x4b')](_0x3007ae[_0x8369('0x46')][_0x8369('0x4b')]));_0x52b39b[_0x8369('0x4a')]=_0x52b39b['attributes'][_0x8369('0x4c')]?_0x52b39b[_0x8369('0x4a')]:_0x577eac[_0x8369('0x45')];if(!_0x3007ae[_0x8369('0x46')]['hasOwnProperty']('nolimit')){_0x52b39b[_0x8369('0x30')]=qs[_0x8369('0x30')](_0x3007ae[_0x8369('0x46')][_0x8369('0x30')]);_0x52b39b[_0x8369('0x2e')]=qs['offset'](_0x3007ae[_0x8369('0x46')][_0x8369('0x2e')]);}_0x52b39b[_0x8369('0x4d')]=qs[_0x8369('0x4e')](_0x3007ae[_0x8369('0x46')][_0x8369('0x4e')]);_0x52b39b['where']=qs[_0x8369('0x48')](_[_0x8369('0x4f')](_0x3007ae[_0x8369('0x46')],_0x577eac[_0x8369('0x48')]),_0x4f0d1d);if(_0x3007ae[_0x8369('0x46')]['filter']){_0x52b39b[_0x8369('0x50')]=_['merge'](_0x52b39b[_0x8369('0x50')],{'$or':_[_0x8369('0x3f')](_0x4f0d1d,function(_0x1460a5){if(_0x1460a5['type']!=='VIRTUAL'){var _0x1d2c9b={};_0x1d2c9b[_0x1460a5[_0x8369('0x3b')]]={'$like':'%'+_0x3007ae[_0x8369('0x46')][_0x8369('0x51')]+'%'};return _0x1d2c9b;}})});}_0x52b39b=_['merge']({},_0x52b39b,_0x3007ae[_0x8369('0x52')]);var _0x16460c={'where':_0x52b39b['where']};return db['FaxAccount'][_0x8369('0x31')](_0x16460c)['then'](function(_0x32725f){_0x1814c1[_0x8369('0x31')]=_0x32725f;if(_0x3007ae[_0x8369('0x46')][_0x8369('0x53')]){_0x52b39b[_0x8369('0x54')]=[{'all':!![]}];}return db[_0x8369('0x40')]['findAll'](_0x52b39b);})[_0x8369('0x36')](function(_0xd4ffb8){_0x1814c1[_0x8369('0x55')]=_0xd4ffb8;return _0x1814c1;})[_0x8369('0x36')](respondWithFilteredResult(_0x583026,_0x52b39b))[_0x8369('0x2b')](handleError(_0x583026,null));};exports['show']=function(_0x205f8c,_0x11d9e2){var _0x5933c9={'raw':![],'where':{'id':_0x205f8c[_0x8369('0x56')]['id']},'include':[{'model':db[_0x8369('0x3d')],'as':_0x8369('0x3e')}]},_0x13a2d7={};_0x13a2d7[_0x8369('0x45')]=_['keys'](db[_0x8369('0x40')][_0x8369('0x41')]);_0x13a2d7[_0x8369('0x46')]=_[_0x8369('0x47')](_0x205f8c[_0x8369('0x46')]);_0x13a2d7['filters']=_[_0x8369('0x49')](_0x13a2d7[_0x8369('0x45')],_0x13a2d7['query']);_0x5933c9[_0x8369('0x4a')]=_[_0x8369('0x49')](_0x13a2d7['model'],qs[_0x8369('0x4b')](_0x205f8c[_0x8369('0x46')]['fields']));_0x5933c9[_0x8369('0x4a')]=_0x5933c9[_0x8369('0x4a')]['length']?_0x5933c9[_0x8369('0x4a')]:_0x13a2d7['model'];if(_0x205f8c[_0x8369('0x46')][_0x8369('0x53')]){_0x5933c9[_0x8369('0x54')]=[{'all':!![]}];}_0x5933c9=_[_0x8369('0x57')]({},_0x5933c9,_0x205f8c[_0x8369('0x52')]);return db[_0x8369('0x40')][_0x8369('0x58')](_0x5933c9)[_0x8369('0x36')](handleEntityNotFound(_0x11d9e2,null))[_0x8369('0x36')](respondWithResult(_0x11d9e2,null))[_0x8369('0x2b')](handleError(_0x11d9e2,null));};exports[_0x8369('0x59')]=function(_0x5a0439,_0x3e04ba){return db['FaxAccount']['create'](_0x5a0439[_0x8369('0x5a')],{})[_0x8369('0x36')](function(_0x131862){var _0x31c74c=_0x5a0439['user']['get']({'plain':!![]});if(!_0x31c74c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31c74c['role']===_0x8369('0x5b')){var _0x39611b=_0x131862['get']({'plain':!![]});var _0x58e6f5=_0x8369('0x38');return db[_0x8369('0x5c')][_0x8369('0x58')]({'where':{'name':_0x58e6f5,'userProfileId':_0x31c74c['userProfileId']},'raw':!![]})[_0x8369('0x36')](function(_0x484dea){if(_0x484dea&&_0x484dea[_0x8369('0x5d')]===0x0){return db[_0x8369('0x5e')]['create']({'name':_0x39611b['name'],'resourceId':_0x39611b['id'],'type':_0x484dea[_0x8369('0x3b')],'sectionId':_0x484dea['id']},{})['then'](function(){return _0x131862;});}else{return _0x131862;}})[_0x8369('0x2b')](function(_0x584477){logger[_0x8369('0x27')](_0x8369('0x5f'),_0x584477);throw _0x584477;});}return _0x131862;})['then'](respondWithResult(_0x3e04ba,0xc9))[_0x8369('0x2b')](handleError(_0x3e04ba,null));};exports[_0x8369('0x35')]=function(_0x3ee945,_0x22ce0a){if(_0x3ee945['body']['id']){delete _0x3ee945[_0x8369('0x5a')]['id'];}return db['FaxAccount'][_0x8369('0x58')]({'where':{'id':_0x3ee945[_0x8369('0x56')]['id']},'include':[{'model':db[_0x8369('0x3d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x22ce0a,null))[_0x8369('0x36')](saveUpdates(_0x3ee945[_0x8369('0x5a')],null))['then'](respondWithResult(_0x22ce0a,null))[_0x8369('0x2b')](handleError(_0x22ce0a,null));};exports['destroy']=function(_0x175ce1,_0x5276b4){return db[_0x8369('0x40')][_0x8369('0x58')]({'where':{'id':_0x175ce1[_0x8369('0x56')]['id']}})[_0x8369('0x36')](handleEntityNotFound(_0x5276b4,null))['then'](removeEntity(_0x5276b4,null))[_0x8369('0x2b')](handleError(_0x5276b4,null));};exports['describe']=function(_0x103c5f,_0xc3e4fd){return db[_0x8369('0x40')][_0x8369('0x60')]()[_0x8369('0x36')](respondWithResult(_0xc3e4fd,null))[_0x8369('0x2b')](handleError(_0xc3e4fd,null));};exports[_0x8369('0x61')]=function(_0x16a22c,_0x187180,_0x237e37){if(_0x16a22c[_0x8369('0x5a')]['id']){delete _0x16a22c[_0x8369('0x5a')]['id'];}return db['FaxAccount'][_0x8369('0x58')]({'where':{'id':_0x16a22c[_0x8369('0x56')]['id']}})[_0x8369('0x36')](handleEntityNotFound(_0x187180,null))['then'](function(_0x1d6800){if(_0x1d6800){_0x16a22c[_0x8369('0x5a')][_0x8369('0x62')]=_0x1d6800['id'];return db['Disposition'][_0x8369('0x59')](_0x16a22c['body']);}})[_0x8369('0x36')](respondWithResult(_0x187180,null))[_0x8369('0x2b')](handleError(_0x187180,null));};exports[_0x8369('0x63')]=function(_0x7cd341,_0x20b664,_0x4c0165){var _0xd5bd0c={'raw':![],'where':{}};var _0x35b5da={};var _0x33805a={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x7cd341[_0x8369('0x56')]['id']}})[_0x8369('0x36')](handleEntityNotFound(_0x20b664,null))[_0x8369('0x36')](function(_0x314454){if(_0x314454){_0x35b5da[_0x8369('0x45')]=_[_0x8369('0x47')](db[_0x8369('0x64')]['rawAttributes']);_0x35b5da[_0x8369('0x46')]=_[_0x8369('0x47')](_0x7cd341[_0x8369('0x46')]);_0x35b5da[_0x8369('0x48')]=_[_0x8369('0x49')](_0x35b5da[_0x8369('0x45')],_0x35b5da[_0x8369('0x46')]);_0xd5bd0c[_0x8369('0x4a')]=_['intersection'](_0x35b5da[_0x8369('0x45')],qs[_0x8369('0x4b')](_0x7cd341[_0x8369('0x46')][_0x8369('0x4b')]));_0xd5bd0c['attributes']=_0xd5bd0c['attributes'][_0x8369('0x4c')]?_0xd5bd0c[_0x8369('0x4a')]:_0x35b5da['model'];if(!_0x7cd341[_0x8369('0x46')][_0x8369('0x65')](_0x8369('0x66'))){_0xd5bd0c[_0x8369('0x30')]=qs['limit'](_0x7cd341[_0x8369('0x46')]['limit']);_0xd5bd0c[_0x8369('0x2e')]=qs[_0x8369('0x2e')](_0x7cd341[_0x8369('0x46')][_0x8369('0x2e')]);}_0xd5bd0c[_0x8369('0x4d')]=qs[_0x8369('0x4e')](_0x7cd341[_0x8369('0x46')][_0x8369('0x4e')]);_0xd5bd0c[_0x8369('0x50')]=qs[_0x8369('0x48')](_[_0x8369('0x4f')](_0x7cd341[_0x8369('0x46')],_0x35b5da[_0x8369('0x48')]));_0xd5bd0c[_0x8369('0x50')][_0x8369('0x62')]=_0x314454['id'];if(_0x7cd341[_0x8369('0x46')]['filter']){_0xd5bd0c[_0x8369('0x50')]=_[_0x8369('0x57')](_0xd5bd0c[_0x8369('0x50')],{'$or':_[_0x8369('0x3f')](_0xd5bd0c[_0x8369('0x4a')],function(_0x3e2d52){var _0x49778a={};_0x49778a[_0x3e2d52]={'$like':'%'+_0x7cd341[_0x8369('0x46')][_0x8369('0x51')]+'%'};return _0x49778a;})});}_0xd5bd0c=_[_0x8369('0x57')]({},_0xd5bd0c,_0x7cd341[_0x8369('0x52')]);return db['Disposition'][_0x8369('0x31')]({'where':_0xd5bd0c[_0x8369('0x50')]})[_0x8369('0x36')](function(_0x3196ad){_0x33805a[_0x8369('0x31')]=_0x3196ad;if(_0x7cd341[_0x8369('0x46')][_0x8369('0x53')]){_0xd5bd0c['include']=[{'all':!![]}];}return db[_0x8369('0x64')][_0x8369('0x67')](_0xd5bd0c);})[_0x8369('0x36')](function(_0x3dcb84){_0x33805a[_0x8369('0x55')]=_0x3dcb84;return _0x33805a;});}})[_0x8369('0x36')](respondWithFilteredResult(_0x20b664,_0xd5bd0c))[_0x8369('0x2b')](handleError(_0x20b664,null));};exports['removeDispositions']=function(_0x59bdcc,_0x35a15d,_0x381ee5){return db[_0x8369('0x40')][_0x8369('0x58')]({'where':{'id':_0x59bdcc[_0x8369('0x56')]['id']}})[_0x8369('0x36')](handleEntityNotFound(_0x35a15d,null))[_0x8369('0x36')](function(_0x448764){if(_0x448764){return _0x448764[_0x8369('0x68')](_0x59bdcc[_0x8369('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x35a15d,null))[_0x8369('0x2b')](handleError(_0x35a15d,null));};exports['addAnswer']=function(_0x5f04fc,_0x159342,_0x3643ea){if(_0x5f04fc[_0x8369('0x5a')]['id']){delete _0x5f04fc[_0x8369('0x5a')]['id'];}return db[_0x8369('0x40')][_0x8369('0x58')]({'where':{'id':_0x5f04fc[_0x8369('0x56')]['id']}})[_0x8369('0x36')](handleEntityNotFound(_0x159342,null))[_0x8369('0x36')](function(_0x47a649){if(_0x47a649){_0x5f04fc[_0x8369('0x5a')][_0x8369('0x62')]=_0x47a649['id'];return db['CannedAnswer'][_0x8369('0x59')](_0x5f04fc[_0x8369('0x5a')]);}})['then'](respondWithResult(_0x159342,null))[_0x8369('0x2b')](handleError(_0x159342,null));};exports[_0x8369('0x69')]=function(_0x2a8819,_0xe64b68,_0x5d898d){var _0x31841a={'raw':![],'where':{}};var _0x33b3ad={};var _0x4bceae={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2a8819[_0x8369('0x56')]['id']}})[_0x8369('0x36')](handleEntityNotFound(_0xe64b68,null))[_0x8369('0x36')](function(_0x41120e){if(_0x41120e){_0x33b3ad['model']=_[_0x8369('0x47')](db[_0x8369('0x6a')][_0x8369('0x41')]);_0x33b3ad['query']=_[_0x8369('0x47')](_0x2a8819['query']);_0x33b3ad[_0x8369('0x48')]=_[_0x8369('0x49')](_0x33b3ad['model'],_0x33b3ad[_0x8369('0x46')]);_0x31841a['attributes']=_['intersection'](_0x33b3ad[_0x8369('0x45')],qs[_0x8369('0x4b')](_0x2a8819[_0x8369('0x46')][_0x8369('0x4b')]));_0x31841a['attributes']=_0x31841a[_0x8369('0x4a')][_0x8369('0x4c')]?_0x31841a[_0x8369('0x4a')]:_0x33b3ad[_0x8369('0x45')];if(!_0x2a8819[_0x8369('0x46')][_0x8369('0x65')](_0x8369('0x66'))){_0x31841a[_0x8369('0x30')]=qs[_0x8369('0x30')](_0x2a8819['query'][_0x8369('0x30')]);_0x31841a[_0x8369('0x2e')]=qs['offset'](_0x2a8819[_0x8369('0x46')]['offset']);}_0x31841a['order']=qs[_0x8369('0x4e')](_0x2a8819['query']['sort']);_0x31841a[_0x8369('0x50')]=qs[_0x8369('0x48')](_[_0x8369('0x4f')](_0x2a8819['query'],_0x33b3ad[_0x8369('0x48')]));_0x31841a[_0x8369('0x50')][_0x8369('0x62')]=_0x41120e['id'];if(_0x2a8819[_0x8369('0x46')][_0x8369('0x51')]){_0x31841a[_0x8369('0x50')]=_['merge'](_0x31841a[_0x8369('0x50')],{'$or':_[_0x8369('0x3f')](_0x31841a[_0x8369('0x4a')],function(_0xabc8dd){var _0x223c31={};_0x223c31[_0xabc8dd]={'$like':'%'+_0x2a8819[_0x8369('0x46')]['filter']+'%'};return _0x223c31;})});}_0x31841a=_['merge']({},_0x31841a,_0x2a8819[_0x8369('0x52')]);return db[_0x8369('0x6a')][_0x8369('0x31')]({'where':_0x31841a['where']})[_0x8369('0x36')](function(_0x2e9224){_0x4bceae[_0x8369('0x31')]=_0x2e9224;if(_0x2a8819['query']['includeAll']){_0x31841a[_0x8369('0x54')]=[{'all':!![]}];}return db[_0x8369('0x6a')][_0x8369('0x67')](_0x31841a);})['then'](function(_0xc308ab){_0x4bceae['rows']=_0xc308ab;return _0x4bceae;});}})['then'](respondWithFilteredResult(_0xe64b68,_0x31841a))[_0x8369('0x2b')](handleError(_0xe64b68,null));};exports[_0x8369('0x6b')]=function(_0x34cb37,_0x148e6d,_0x51581d){return db[_0x8369('0x40')][_0x8369('0x58')]({'where':{'id':_0x34cb37['params']['id']}})['then'](handleEntityNotFound(_0x148e6d,null))['then'](function(_0x4e9198){if(_0x4e9198){return _0x4e9198[_0x8369('0x6b')](_0x34cb37[_0x8369('0x46')]['ids']);}})[_0x8369('0x36')](respondWithStatusCode(_0x148e6d,null))[_0x8369('0x2b')](handleError(_0x148e6d,null));};exports[_0x8369('0x6c')]=function(_0x2f8bae,_0x5281c5,_0x38f013){return db[_0x8369('0x6d')][_0x8369('0x58')]({'where':{'id':_0x2f8bae[_0x8369('0x56')]['id']}})['then'](handleEntityNotFound(_0x5281c5,null))[_0x8369('0x36')](function(_0x599f2d){if(_0x599f2d){return _0x599f2d[_0x8369('0x6c')](_0x2f8bae[_0x8369('0x5a')][_0x8369('0x6e')],_[_0x8369('0x6f')](_0x2f8bae[_0x8369('0x5a')],['ids','id'])||{});}})[_0x8369('0x36')](respondWithResult(_0x5281c5,null))[_0x8369('0x2b')](handleError(_0x5281c5,null));};exports[_0x8369('0x70')]=function(_0x409054,_0x520837,_0x145038){var _0x4e84d2={'raw':![],'where':{}};var _0x290a03={};var _0x44230e={'count':0x0,'rows':[]};return db['FaxAccount'][_0x8369('0x71')]({'where':{'id':_0x409054[_0x8369('0x56')]['id']}})[_0x8369('0x36')](handleEntityNotFound(_0x520837,null))[_0x8369('0x36')](function(_0x42c78f){if(_0x42c78f){_0x290a03[_0x8369('0x45')]=_[_0x8369('0x47')](db['FaxInteraction'][_0x8369('0x41')]);_0x290a03[_0x8369('0x46')]=_[_0x8369('0x47')](_0x409054[_0x8369('0x46')]);_0x290a03['filters']=_[_0x8369('0x49')](_0x290a03[_0x8369('0x45')],_0x290a03[_0x8369('0x46')]);_0x4e84d2['attributes']=_[_0x8369('0x49')](_0x290a03[_0x8369('0x45')],qs[_0x8369('0x4b')](_0x409054[_0x8369('0x46')][_0x8369('0x4b')]));_0x4e84d2[_0x8369('0x4a')]=_0x4e84d2['attributes'][_0x8369('0x4c')]?_0x4e84d2['attributes']:_0x290a03[_0x8369('0x45')];if(!_0x409054['query'][_0x8369('0x65')]('nolimit')){_0x4e84d2['limit']=qs['limit'](_0x409054[_0x8369('0x46')]['limit']);_0x4e84d2[_0x8369('0x2e')]=qs[_0x8369('0x2e')](_0x409054[_0x8369('0x46')][_0x8369('0x2e')]);}_0x4e84d2[_0x8369('0x4d')]=qs['sort'](_0x409054[_0x8369('0x46')][_0x8369('0x4e')]);_0x4e84d2['where']=qs[_0x8369('0x48')](_[_0x8369('0x4f')](_0x409054[_0x8369('0x46')],_0x290a03['filters']));_0x4e84d2[_0x8369('0x50')][_0x8369('0x62')]=_0x42c78f['id'];if(_0x409054['query']['filter']){_0x4e84d2['where']=_[_0x8369('0x57')](_0x4e84d2['where'],{'$or':_['map'](_0x4e84d2[_0x8369('0x4a')],function(_0x48e5e3){var _0xbd7fb5={};_0xbd7fb5[_0x48e5e3]={'$like':'%'+_0x409054['query']['filter']+'%'};return _0xbd7fb5;})});}_0x4e84d2=_['merge']({},_0x4e84d2,_0x409054[_0x8369('0x52')]);return db[_0x8369('0x6d')]['count']({'where':_0x4e84d2[_0x8369('0x50')]})[_0x8369('0x36')](function(_0x1cb8ec){_0x44230e[_0x8369('0x31')]=_0x1cb8ec;if(_0x409054[_0x8369('0x46')]['includeAll']){_0x4e84d2[_0x8369('0x54')]=[{'model':db[_0x8369('0x72')],'as':'Contact','required':![]},{'model':db[_0x8369('0x73')],'as':_0x8369('0x74'),'attributes':[_0x8369('0x3b'),_0x8369('0x75'),_0x8369('0x76')],'required':![]},{'model':db[_0x8369('0x77')],'as':_0x8369('0x78'),'attributes':['id',_0x8369('0x3b'),_0x8369('0x79')],'where':_0x409054[_0x8369('0x46')][_0x8369('0x7a')]?{'id':_0x409054['query'][_0x8369('0x7a')]}:undefined,'required':_0x409054['query'][_0x8369('0x7a')]?!![]:![]}];}return db[_0x8369('0x6d')][_0x8369('0x67')](_0x4e84d2);})['then'](function(_0x28fe3b){_0x44230e[_0x8369('0x55')]=_0x28fe3b;return _0x44230e;});}})['then'](respondWithFilteredResult(_0x520837,_0x4e84d2))[_0x8369('0x2b')](handleError(_0x520837,null));};exports[_0x8369('0x7b')]=function(_0x5bd31a,_0x5712f2){var _0x55934e=_0x5bd31a['params']['id'];var _0x4bfb0a=_0x5bd31a[_0x8369('0x5a')];var _0x37e97d=0xc8;var _0xb18c17=null;return db[_0x8369('0x7c')][_0x8369('0x7d')]({'isolationLevel':db[_0x8369('0x7c')]['Transaction'][_0x8369('0x7e')][_0x8369('0x7f')]},function(_0x76398c){return db[_0x8369('0x40')][_0x8369('0x71')]({'where':{'id':_0x55934e},'transaction':_0x76398c})['then'](function(_0x4f8c1b){if(_0x4f8c1b){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x55934e},'transaction':_0x76398c})[_0x8369('0x36')](function(){var _0xdf3894=_[_0x8369('0x3f')](_0x4bfb0a,function(_0x536469){_0x536469[_0x8369('0x62')]=_0x55934e;return _0x536469;});return db[_0x8369('0x80')][_0x8369('0x81')](_0xdf3894,{'transaction':_0x76398c});});}else{_0x37e97d=0x194;_0xb18c17=[];}});})[_0x8369('0x36')](function(){if(_0x37e97d!==0x194){return db[_0x8369('0x80')][_0x8369('0x82')]({'where':{'FaxAccountId':_0x55934e},'order':_0x8369('0x83')})[_0x8369('0x36')](function(_0x13db2e){_0xb18c17=_0x13db2e;});}})[_0x8369('0x2b')](function(_0x17564b){_0x37e97d=0x1f4;logger[_0x8369('0x27')](_0x17564b[_0x8369('0x3a')]);if(_0x17564b[_0x8369('0x3b')]){delete _0x17564b['name'];}_0xb18c17=_0x17564b;})[_0x8369('0x84')](function(){if(_0xb18c17===null){_0x5712f2[_0x8369('0x2c')](_0x37e97d);}else{if(_0x37e97d===0x1f4){_0x5712f2[_0x8369('0x2d')](_0x37e97d)[_0x8369('0x85')](_0xb18c17);}else{_0x5712f2['status'](_0x37e97d)[_0x8369('0x86')](_0xb18c17);}}});};exports[_0x8369('0x87')]=function(_0x4839db,_0x3fb49a,_0x560785){var _0x22c19a={};var _0x233948={};var _0x5cc8c7;var _0x330dc3;return db[_0x8369('0x40')]['findOne']({'where':{'id':_0x4839db[_0x8369('0x56')]['id']}})[_0x8369('0x36')](handleEntityNotFound(_0x3fb49a,null))[_0x8369('0x36')](function(_0x464d5d){if(_0x464d5d){_0x5cc8c7=_0x464d5d;_0x233948[_0x8369('0x45')]=_['keys'](db[_0x8369('0x80')][_0x8369('0x41')]);_0x233948[_0x8369('0x46')]=_[_0x8369('0x47')](_0x4839db[_0x8369('0x46')]);_0x233948[_0x8369('0x48')]=_[_0x8369('0x49')](_0x233948[_0x8369('0x45')],_0x233948[_0x8369('0x46')]);_0x22c19a[_0x8369('0x4a')]=_[_0x8369('0x49')](_0x233948[_0x8369('0x45')],qs[_0x8369('0x4b')](_0x4839db[_0x8369('0x46')][_0x8369('0x4b')]));_0x22c19a[_0x8369('0x4a')]=_0x22c19a[_0x8369('0x4a')][_0x8369('0x4c')]?_0x22c19a['attributes']:_0x233948[_0x8369('0x45')];_0x22c19a[_0x8369('0x4d')]=qs[_0x8369('0x4e')](_0x4839db[_0x8369('0x46')]['sort']);_0x22c19a['where']=qs[_0x8369('0x48')](_['pick'](_0x4839db[_0x8369('0x46')],_0x233948[_0x8369('0x48')]));if(_0x4839db[_0x8369('0x46')]['filter']){_0x22c19a[_0x8369('0x50')]=_[_0x8369('0x57')](_0x22c19a['where'],{'$or':_[_0x8369('0x3f')](_0x22c19a[_0x8369('0x4a')],function(_0x3b0c39){var _0x3b9b1d={};_0x3b9b1d[_0x3b0c39]={'$like':'%'+_0x4839db[_0x8369('0x46')]['filter']+'%'};return _0x3b9b1d;})});}_0x22c19a=_[_0x8369('0x57')]({},_0x22c19a,_0x4839db[_0x8369('0x52')]);return _0x5cc8c7[_0x8369('0x87')](_0x22c19a);}})['then'](function(_0x38c820){if(_0x38c820){_0x330dc3=_0x38c820[_0x8369('0x4c')];if(!_0x4839db['query'][_0x8369('0x65')](_0x8369('0x66'))){_0x22c19a[_0x8369('0x30')]=qs[_0x8369('0x30')](_0x4839db[_0x8369('0x46')][_0x8369('0x30')]);_0x22c19a[_0x8369('0x2e')]=qs['offset'](_0x4839db[_0x8369('0x46')][_0x8369('0x2e')]);}return _0x5cc8c7[_0x8369('0x87')](_0x22c19a);}})['then'](function(_0x30eb0e){if(_0x30eb0e){return _0x30eb0e?{'count':_0x330dc3,'rows':_0x30eb0e}:null;}})['then'](respondWithResult(_0x3fb49a,null))[_0x8369('0x2b')](handleError(_0x3fb49a,null));};function Extension(_0x4b0de3,_0x2a6eb6,_0x2ada3c,_0x4a6455){this[_0x8369('0x88')]=_0x8369('0x89');this['exten']=_0x4b0de3[_0x8369('0x8a')];this[_0x8369('0x8b')]=_0x4a6455;this[_0x8369('0x43')]='system';this[_0x8369('0x8c')]=_0x8369('0x8d');this['FaxAccountId']=_0x4b0de3['id'];this[_0x8369('0x83')]=_0x2a6eb6;this['appdata']=_0x2ada3c;}function createExtensionsReciveFax(_0xf2e3ed){var _0x3f73a5=0x1;var _0x4fe2cd=[];_0x4fe2cd[_0x8369('0x8e')](new Extension(_0xf2e3ed,_0x3f73a5,'','Answer'));_0x3f73a5+=0x1;_0x4fe2cd[_0x8369('0x8e')](new Extension(_0xf2e3ed,_0x3f73a5,_0x8369('0x8f'),_0x8369('0x90')));_0x3f73a5+=0x1;for(var _0x3e0bda in _0xf2e3ed){if(_0xf2e3ed['hasOwnProperty'](_0x3e0bda)&&(_0x3e0bda===_0x8369('0x91')||_0x3e0bda==='localstationid'||_0x3e0bda==='gateway'||_0x3e0bda===_0x8369('0x92')||_0x3e0bda===_0x8369('0x93')||_0x3e0bda===_0x8369('0x94')||_0x3e0bda==='minrate'||_0x3e0bda==='modem'||_0x3e0bda===_0x8369('0x95'))){_0x4fe2cd[_0x8369('0x8e')](new Extension(_0xf2e3ed,_0x3f73a5,_0x8369('0x96')+_0x3e0bda+')='+_0xf2e3ed[_0x3e0bda],_0x8369('0x90')));_0x3f73a5+=0x1;}}_0x4fe2cd[_0x8369('0x8e')](new Extension(_0xf2e3ed,_0x3f73a5,'6',_0x8369('0x97')));_0x3f73a5+=0x1;_0x4fe2cd['push'](new Extension(_0xf2e3ed,_0x3f73a5,_0x8369('0x98'),_0x8369('0x99')));_0x3f73a5=0x0;return _0x4fe2cd;}exports[_0x8369('0x9a')]=function(_0x3c07bd,_0x2b5cb1,_0x2d17f3){var _0x498609;return db['sequelize'][_0x8369('0x7d')](function(_0x4af622){return db['FaxAccount'][_0x8369('0x59')](_0x3c07bd[_0x8369('0x5a')],{'transaction':_0x4af622})[_0x8369('0x36')](function(_0x3a1ac2){_0x498609=_0x3a1ac2[_0x8369('0x37')]({'plain':!![]});return db[_0x8369('0x9b')][_0x8369('0x81')](createExtensionsReciveFax(_0x498609),{'transaction':_0x4af622});});})['then'](function(){return _0x498609;})[_0x8369('0x36')](respondWithResult(_0x2b5cb1,null))['catch'](handleError(_0x2b5cb1,null));};exports[_0x8369('0x9c')]=function(_0x3a45f7,_0x4eb53f,_0x1d66ba){var _0x1ff283;return db[_0x8369('0x7c')][_0x8369('0x7d')](function(_0x31c253){return db[_0x8369('0x40')][_0x8369('0x35')](_0x3a45f7[_0x8369('0x5a')],{'where':{'id':_0x3a45f7[_0x8369('0x5a')]['id']},'transaction':_0x31c253})[_0x8369('0x36')](function(_0x6658f){return db[_0x8369('0x9b')]['destroy']({'where':{'FaxAccountId':_0x3a45f7[_0x8369('0x5a')]['id']},'transaction':_0x31c253})['then'](function(_0x337500){return db[_0x8369('0x9b')][_0x8369('0x81')](createExtensionsReciveFax(_[_0x8369('0x6f')](_0x3a45f7[_0x8369('0x5a')],['tech',_0x8369('0x44'),_0x8369('0x9d'),'updatedAt','TrunkId',_0x8369('0x9e')])),{'transaction':_0x31c253});});});})[_0x8369('0x36')](function(){return db[_0x8369('0x40')]['findById'](_0x3a45f7[_0x8369('0x5a')]['id']);})['then'](respondWithResult(_0x4eb53f,null))[_0x8369('0x2b')](handleError(_0x4eb53f,null));};exports[_0x8369('0x9f')]=function(_0x48971b,_0xec95a3,_0x19f664){var _0x363850={'raw':!![],'where':{}};var _0x4a8c9b={};var _0x11a7b5={'count':0x0,'rows':[]};return db[_0x8369('0x40')][_0x8369('0x71')]({'where':{'id':_0x48971b[_0x8369('0x56')]['id']}})[_0x8369('0x36')](handleEntityNotFound(_0xec95a3,null))['then'](function(_0x121ce6){if(_0x121ce6){_0x4a8c9b[_0x8369('0x45')]=_[_0x8369('0x47')](db[_0x8369('0xa0')]['rawAttributes']);_0x4a8c9b[_0x8369('0x46')]=_['keys'](_0x48971b[_0x8369('0x46')]);_0x4a8c9b[_0x8369('0x48')]=_[_0x8369('0x49')](_0x4a8c9b[_0x8369('0x45')],_0x4a8c9b['query']);_0x363850[_0x8369('0x4a')]=_[_0x8369('0x49')](_0x4a8c9b[_0x8369('0x45')],qs[_0x8369('0x4b')](_0x48971b[_0x8369('0x46')]['fields']));_0x363850[_0x8369('0x4a')]=_0x363850[_0x8369('0x4a')][_0x8369('0x4c')]?_0x363850[_0x8369('0x4a')]:_0x4a8c9b[_0x8369('0x45')];if(!_0x48971b[_0x8369('0x46')]['hasOwnProperty'](_0x8369('0x66'))){_0x363850['limit']=qs[_0x8369('0x30')](_0x48971b[_0x8369('0x46')][_0x8369('0x30')]);_0x363850[_0x8369('0x2e')]=qs[_0x8369('0x2e')](_0x48971b[_0x8369('0x46')]['offset']);}_0x363850[_0x8369('0x4d')]=qs[_0x8369('0x4e')](_0x48971b[_0x8369('0x46')]['sort']);_0x363850['where']=qs[_0x8369('0x48')](_[_0x8369('0x4f')](_0x48971b[_0x8369('0x46')],_0x4a8c9b[_0x8369('0x48')]));_0x363850[_0x8369('0x50')][_0x8369('0x62')]=_0x121ce6['id'];if(_0x48971b['query'][_0x8369('0x51')]){_0x363850['where']=_[_0x8369('0x57')](_0x363850[_0x8369('0x50')],{'$or':_[_0x8369('0x3f')](_0x363850[_0x8369('0x4a')],function(_0x56850f){var _0x4b8836={};_0x4b8836[_0x56850f]={'$like':'%'+_0x48971b[_0x8369('0x46')][_0x8369('0x51')]+'%'};return _0x4b8836;})});}if(_0x48971b['query'][_0x8369('0xa1')]){var _0x349a04=_0x48971b[_0x8369('0x46')]['$gte'][_0x8369('0xa2')](',');var _0xf9dd8b={};_0xf9dd8b[_0x349a04[0x0]]={'$gte':moment(_0x349a04[0x1])[_0x8369('0xa3')](_0x8369('0xa4'))};_0x363850[_0x8369('0x50')]=_['merge'](_0x363850[_0x8369('0x50')],_0xf9dd8b);}_0x363850=_[_0x8369('0x57')]({},_0x363850,_0x48971b[_0x8369('0x52')]);return db[_0x8369('0xa0')][_0x8369('0x31')]({'where':_0x363850[_0x8369('0x50')]})[_0x8369('0x36')](function(_0x5cc94c){_0x11a7b5[_0x8369('0x31')]=_0x5cc94c;if(_0x48971b[_0x8369('0x46')][_0x8369('0x53')]){_0x363850[_0x8369('0x54')]=[{'all':!![]}];}return db[_0x8369('0xa0')][_0x8369('0x67')](_0x363850);})[_0x8369('0x36')](function(_0x5df9c2){_0x11a7b5[_0x8369('0x55')]=_0x5df9c2;return _0x11a7b5;});}})[_0x8369('0x36')](respondWithFilteredResult(_0xec95a3,_0x363850))['catch'](handleError(_0xec95a3,null));};exports[_0x8369('0x85')]=function(_0x951569,_0x56af8a,_0x3b844c){var _0x5173e1,_0x48b397={},_0x637522;if(_0x951569[_0x8369('0x5a')]['to']){_0x637522=_0x951569['body']['to'][0x0];}return db[_0x8369('0x40')][_0x8369('0x58')]({'where':{'id':_0x951569[_0x8369('0x56')]['id']},'include':[{'model':db[_0x8369('0xa5')],'as':_0x8369('0xa6'),'include':[{'model':db[_0x8369('0x72')],'as':'Contacts','where':{'fax':_0x637522},'limit':0x1,'order':[['updatedAt',_0x8369('0xa7')]]}]}]})['then'](handleEntityNotFound(_0x56af8a,null))[_0x8369('0x36')](function(_0x118258){_0x5173e1=_0x118258;if(_0x951569['body'][_0x8369('0xa8')]&&_0x951569['body'][_0x8369('0xa8')][_0x8369('0x4c')]){for(var _0x315f77=0x0;_0x315f77<_0x951569['body']['attachments'][_0x8369('0x4c')];_0x315f77+=0x1){_0x951569['body'][_0x8369('0xa8')][_0x315f77]={'filename':_0x951569[_0x8369('0x5a')][_0x8369('0xa8')][_0x315f77][_0x8369('0x3b')],'id':_0x951569['body'][_0x8369('0xa8')][_0x315f77]['id'],'path':path[_0x8369('0xa9')](config[_0x8369('0xaa')],_0x8369('0xab'),_0x951569['body'][_0x8369('0xa8')][_0x315f77][_0x8369('0xac')])};}}return respondWithRpcPromise(_0x8369('0xad'),_0x8369('0xad'),{'FaxAccountId':_['isNil'](_0x951569[_0x8369('0x56')]['id'])?undefined:_0x951569['params']['id'],'path':_[_0x8369('0xae')](_0x951569[_0x8369('0x5a')]['attachments'][0x0][_0x8369('0x6')])?undefined:_0x951569[_0x8369('0x5a')]['attachments'][0x0]['path'],'fax':_[_0x8369('0xae')](_0x951569[_0x8369('0x5a')]['to'][0x0])?undefined:_0x951569[_0x8369('0x5a')]['to'][0x0]},client9002);})[_0x8369('0x36')](function(){if(_0x5173e1){if(_[_0x8369('0xae')](_0x951569['body'][_0x8369('0xaf')])){_0x951569['body'][_0x8369('0xaf')]=util[_0x8369('0xa3')]('\x22%s\x22\x20<%s>',_0x5173e1[_0x8369('0x3b')],_0x5173e1[_0x8369('0xb0')]);}if(_0x5173e1[_0x8369('0xa6')]){if(_0x5173e1[_0x8369('0xa6')][_0x8369('0xb1')][_0x8369('0x4c')]){return _0x5173e1[_0x8369('0xa6')][_0x8369('0xb1')][0x0];}else{return db['CmContact'][_0x8369('0x59')](_[_0x8369('0x1c')](_0x951569['body'],{'firstName':_0x951569[_0x8369('0x5a')]['to'][0x0],'phone':_0x951569[_0x8369('0x5a')]['to'][0x0],'fax':_0x951569[_0x8369('0x5a')]['to'][0x0],'ListId':_0x5173e1['ListId']}));}}else{throw new Error(_0x8369('0xb2'));}}else{throw new Error(_0x8369('0xb3'));}})[_0x8369('0x36')](function(_0x3428a6){if(_0x3428a6){return db[_0x8369('0x6d')][_0x8369('0x58')]({'where':{'ContactId':_0x3428a6['id'],'closed':![],'FaxAccountId':_0x5173e1['id']}})[_0x8369('0x36')](function(_0x2ba15c){if(_0x2ba15c){return[_0x2ba15c,![]];}return db[_0x8369('0x6d')][_0x8369('0x59')]({'UserId':_0x951569[_0x8369('0x5b')]['id'],'ContactId':_0x3428a6['id'],'FaxAccountId':_0x5173e1['id'],'fax':_0x951569[_0x8369('0x5a')]['to'][0x0],'firstMsgDirection':_0x8369('0xb4'),'Messages':[_[_0x8369('0x57')](_0x951569[_0x8369('0x5a')],{'read':![],'body':_0x951569[_0x8369('0x5a')][_0x8369('0xa8')][0x0][_0x8369('0xb5')],'FaxAccountId':_0x5173e1['id'],'UserId':_0x951569[_0x8369('0x5b')]['id'],'ContactId':_0x3428a6['id'],'AttachmentId':_0x951569[_0x8369('0x5a')][_0x8369('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0x8369('0xa0')],'as':_0x8369('0xb6')}]})[_0x8369('0x36')](function(_0x356a5f){return[_0x356a5f,!![]];});});}else{throw new Error(_0x8369('0xb7'));}})['spread'](function(_0x5e8ac8,_0x3b298c){if(_0x3b298c){return _0x5e8ac8;}return db[_0x8369('0xa0')][_0x8369('0x59')]({'direction':'out','read':![],'body':_0x951569[_0x8369('0x5a')][_0x8369('0xa8')][0x0][_0x8369('0xb5')],'FaxAccountId':_0x5173e1['id'],'FaxInteractionId':_0x5e8ac8['id'],'UserId':_0x951569['user']['id'],'ContactId':_0x5e8ac8[_0x8369('0xb8')],'AttachmentId':_0x951569[_0x8369('0x5a')]['attachments'][0x0]['id']})[_0x8369('0x36')](function(_0x4527f8){_0x5e8ac8[_0x8369('0xb9')][_0x8369('0xb6')]=[];_0x5e8ac8['dataValues'][_0x8369('0xb6')][_0x8369('0x8e')](_0x4527f8[_0x8369('0xb9')]);return _0x5e8ac8;});})[_0x8369('0x36')](function(_0x9254f3){respondWithRpcPromise('SendFax',_0x8369('0xba'),{'FaxAccountId':_[_0x8369('0xae')](_0x951569[_0x8369('0x56')]['id'])?undefined:_0x951569[_0x8369('0x56')]['id'],'path':_['isNil'](_0x951569[_0x8369('0x5a')][_0x8369('0xa8')][0x0][_0x8369('0x6')])?undefined:_0x951569[_0x8369('0x5a')][_0x8369('0xa8')][0x0][_0x8369('0x6')],'fax':_['isNil'](_0x951569[_0x8369('0x5a')]['to'][0x0])?undefined:_0x951569[_0x8369('0x5a')]['to'][0x0],'AttachmentId':_0x951569[_0x8369('0x5a')]['attachments'][0x0]['id']},client9002)[_0x8369('0x36')](function(_0x506fd3){logger[_0x8369('0x21')](_0x8369('0xbb'),_0x506fd3);})['catch'](function(_0x5bdc26){logger[_0x8369('0x21')]('SendFaxRpc,\x20%s',_0x5bdc26);});return _0x9254f3;})[_0x8369('0x36')](respondWithResult(_0x56af8a,null))[_0x8369('0x2b')](handleError(_0x56af8a,null));};exports[_0x8369('0xbc')]=function(_0x267236,_0x28bee8,_0x3bb3ed){return db[_0x8369('0x40')][_0x8369('0x58')]({'where':{'id':_0x267236[_0x8369('0x56')]['id']}})[_0x8369('0x36')](handleEntityNotFound(_0x28bee8,null))[_0x8369('0x36')](function(_0x251ff5){if(_0x251ff5){return _0x251ff5[_0x8369('0xbc')](_0x267236[_0x8369('0x5a')][_0x8369('0x6e')],_[_0x8369('0x6f')](_0x267236[_0x8369('0x5a')],['ids','id'])||{})[_0x8369('0xbd')](function(_0x3d7840){for(var _0x5a68a6=0x0;_0x5a68a6<_0x267236['body']['ids'][_0x8369('0x4c')];_0x5a68a6+=0x1){socket[_0x8369('0xbe')]('userFaxAccount:save',{'UserId':Number(_0x267236[_0x8369('0x5a')][_0x8369('0x6e')][_0x5a68a6]),'FaxAccountId':Number(_0x267236[_0x8369('0x56')]['id'])});}return _0x3d7840;});}})[_0x8369('0x36')](respondWithResult(_0x28bee8,null))[_0x8369('0x2b')](handleError(_0x28bee8,null));};exports['removeAgents']=function(_0x25c873,_0x3061a4,_0x48d31a){return db[_0x8369('0x40')][_0x8369('0x58')]({'where':{'id':_0x25c873[_0x8369('0x56')]['id']}})[_0x8369('0x36')](handleEntityNotFound(_0x3061a4,null))[_0x8369('0x36')](function(_0x133e76){if(_0x133e76){return _0x133e76[_0x8369('0xbf')](_0x25c873[_0x8369('0x46')][_0x8369('0x6e')])[_0x8369('0x36')](function(){if(_[_0x8369('0xc0')](_0x25c873[_0x8369('0x46')][_0x8369('0x6e')])){for(var _0x159f89=0x0;_0x159f89<_0x25c873[_0x8369('0x46')][_0x8369('0x6e')][_0x8369('0x4c')];_0x159f89+=0x1){socket[_0x8369('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x25c873[_0x8369('0x46')]['ids'][_0x159f89]),'FaxAccountId':Number(_0x25c873[_0x8369('0x56')]['id'])});}}else{socket[_0x8369('0xbe')](_0x8369('0xc1'),{'UserId':Number(_0x25c873[_0x8369('0x46')]['ids']),'FaxAccountId':Number(_0x25c873[_0x8369('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x3061a4,null))[_0x8369('0x2b')](handleError(_0x3061a4,null));};exports[_0x8369('0xc2')]=function(_0x4f4ae3,_0x214f40,_0x504ce6){var _0x5a4177={};var _0x2c0604={};var _0x581947;var _0x2da642;return db[_0x8369('0x40')][_0x8369('0x71')]({'where':{'id':_0x4f4ae3[_0x8369('0x56')]['id']}})[_0x8369('0x36')](handleEntityNotFound(_0x214f40,null))[_0x8369('0x36')](function(_0x113116){if(_0x113116){_0x581947=_0x113116;_0x2c0604[_0x8369('0x45')]=_['keys'](db['User'][_0x8369('0x41')]);_0x2c0604['query']=_['keys'](_0x4f4ae3[_0x8369('0x46')]);_0x2c0604[_0x8369('0x48')]=_[_0x8369('0x49')](_0x2c0604[_0x8369('0x45')],_0x2c0604[_0x8369('0x46')]);_0x5a4177['attributes']=_[_0x8369('0x49')](_0x2c0604[_0x8369('0x45')],qs[_0x8369('0x4b')](_0x4f4ae3[_0x8369('0x46')]['fields']));_0x5a4177['attributes']=_0x5a4177[_0x8369('0x4a')]['length']?_0x5a4177[_0x8369('0x4a')]:_0x2c0604[_0x8369('0x45')];_0x5a4177[_0x8369('0x4d')]=qs[_0x8369('0x4e')](_0x4f4ae3['query'][_0x8369('0x4e')]);_0x5a4177[_0x8369('0x50')]=qs[_0x8369('0x48')](_['pick'](_0x4f4ae3[_0x8369('0x46')],_0x2c0604[_0x8369('0x48')]));if(_0x4f4ae3[_0x8369('0x46')][_0x8369('0x51')]){_0x5a4177[_0x8369('0x50')]=_[_0x8369('0x57')](_0x5a4177[_0x8369('0x50')],{'$or':_[_0x8369('0x3f')](_0x5a4177['attributes'],function(_0x4dc4ca){var _0x996450={};_0x996450[_0x4dc4ca]={'$like':'%'+_0x4f4ae3[_0x8369('0x46')][_0x8369('0x51')]+'%'};return _0x996450;})});}_0x5a4177=_[_0x8369('0x57')]({},_0x5a4177,_0x4f4ae3['options']);return _0x581947['getAgents'](_0x5a4177);}})['then'](function(_0x104c46){if(_0x104c46){_0x2da642=_0x104c46[_0x8369('0x4c')];if(!_0x4f4ae3[_0x8369('0x46')][_0x8369('0x65')](_0x8369('0x66'))){_0x5a4177[_0x8369('0x30')]=qs[_0x8369('0x30')](_0x4f4ae3[_0x8369('0x46')][_0x8369('0x30')]);_0x5a4177[_0x8369('0x2e')]=qs[_0x8369('0x2e')](_0x4f4ae3[_0x8369('0x46')]['offset']);}return _0x581947[_0x8369('0xc2')](_0x5a4177);}})[_0x8369('0x36')](function(_0x49fb19){if(_0x49fb19){return _0x49fb19?{'count':_0x2da642,'rows':_0x49fb19}:null;}})[_0x8369('0x36')](respondWithResult(_0x214f40,null))[_0x8369('0x2b')](handleError(_0x214f40,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 2492743..96be4df 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 _0xd081=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','FaxAccount'];(function(_0x32d1a9,_0x1b470c){var _0x50eaf1=function(_0x5cac22){while(--_0x5cac22){_0x32d1a9['push'](_0x32d1a9['shift']());}};_0x50eaf1(++_0x1b470c);}(_0xd081,0x13d));var _0x1d08=function(_0x45c254,_0x2fcdc7){_0x45c254=_0x45c254-0x0;var _0x446d74=_0xd081[_0x45c254];return _0x446d74;};'use strict';var EventEmitter=require(_0x1d08('0x0'));var FaxAccount=require(_0x1d08('0x1'))['db'][_0x1d08('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x1d08('0x3')](0x0);var events={'afterCreate':_0x1d08('0x4'),'afterUpdate':_0x1d08('0x5'),'afterDestroy':_0x1d08('0x6')};function emitEvent(_0x50858f){return function(_0x3aa286,_0x58dcb8,_0x5d9654){FaxAccountEvents['emit'](_0x50858f+':'+_0x3aa286['id'],_0x3aa286);FaxAccountEvents[_0x1d08('0x7')](_0x50858f,_0x3aa286);_0x5d9654(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x1d08('0x8')](e,emitEvent(event));}}module[_0x1d08('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x7ad6=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','emit'];(function(_0x51e0db,_0x529635){var _0x47b425=function(_0x183124){while(--_0x183124){_0x51e0db['push'](_0x51e0db['shift']());}};_0x47b425(++_0x529635);}(_0x7ad6,0x87));var _0x67ad=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x7ad6[_0x55f8b4];return _0x2475f9;};'use strict';var EventEmitter=require(_0x67ad('0x0'));var FaxAccount=require(_0x67ad('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x67ad('0x2')](0x0);var events={'afterCreate':_0x67ad('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x553655){return function(_0x161043,_0x2e1a8d,_0x22dbb2){FaxAccountEvents[_0x67ad('0x4')](_0x553655+':'+_0x161043['id'],_0x161043);FaxAccountEvents[_0x67ad('0x4')](_0x553655,_0x161043);_0x22dbb2(null);};}for(var e in events){if(events[_0x67ad('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x67ad('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index c37f40d..d7f2898 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 _0x4161=['util','../../config/logger','api','moment','bluebird','path','rimraf','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4161,0xa8));var _0x1416=function(_0x33823b,_0x1f2903){_0x33823b=_0x33823b-0x0;var _0x55c21a=_0x4161[_0x33823b];return _0x55c21a;};'use strict';var _=require(_0x1416('0x0'));var util=require(_0x1416('0x1'));var logger=require(_0x1416('0x2'))(_0x1416('0x3'));var moment=require(_0x1416('0x4'));var BPromise=require(_0x1416('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1416('0x6'));var rimraf=require(_0x1416('0x7'));var config=require('../../config/environment');var attributes=require(_0x1416('0x8'));module[_0x1416('0x9')]=function(_0x48e91d,_0x4e263b){return _0x48e91d[_0x1416('0xa')](_0x1416('0xb'),attributes,{'tableName':_0x1416('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70ed=['bluebird','request-promise','path','rimraf','./faxAccount.attributes','FaxAccount','util','api','moment'];(function(_0x2ba6e1,_0x473cad){var _0x5355e6=function(_0x38cf79){while(--_0x38cf79){_0x2ba6e1['push'](_0x2ba6e1['shift']());}};_0x5355e6(++_0x473cad);}(_0x70ed,0xf9));var _0xd70e=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x70ed[_0x1562a2];return _0x39a636;};'use strict';var _=require('lodash');var util=require(_0xd70e('0x0'));var logger=require('../../config/logger')(_0xd70e('0x1'));var moment=require(_0xd70e('0x2'));var BPromise=require(_0xd70e('0x3'));var rp=require(_0xd70e('0x4'));var fs=require('fs');var path=require(_0xd70e('0x5'));var rimraf=require(_0xd70e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd70e('0x7'));module['exports']=function(_0x19ef4a,_0x6cc75a){return _0x19ef4a['define'](_0xd70e('0x8'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index c2aaa84..f3d58a1 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 _0xfeb6=['NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','CompanyId','ListId','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','DESC','FaxApplication','List','get','applications','Applications','list','priority','asc','length','Contacts','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','User','name','UserId','agent','Start','startRouting','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','GetFaxAccount','FaxAccount','findAll','options','raw','where','limit','map','model','attributes','include'];(function(_0x3ca7b4,_0x5de10c){var _0x44f5fb=function(_0x24bec0){while(--_0x24bec0){_0x3ca7b4['push'](_0x3ca7b4['shift']());}};_0x44f5fb(++_0x5de10c);}(_0xfeb6,0x8b));var _0x6feb=function(_0x2a7eac,_0x55569a){_0x2a7eac=_0x2a7eac-0x0;var _0x1cd2c9=_0xfeb6[_0x2a7eac];return _0x1cd2c9;};'use strict';var _=require(_0x6feb('0x0'));var util=require(_0x6feb('0x1'));var moment=require(_0x6feb('0x2'));var BPromise=require('bluebird');var rs=require(_0x6feb('0x3'));var fs=require('fs');var Redis=require(_0x6feb('0x4'));var db=require(_0x6feb('0x5'))['db'];var utils=require(_0x6feb('0x6'));var logger=require(_0x6feb('0x7'))(_0x6feb('0x8'));var config=require('../../config/environment');var jayson=require(_0x6feb('0x9'));var client=jayson[_0x6feb('0xa')][_0x6feb('0xb')]({'port':0x232c});config['redis']=_[_0x6feb('0xc')](config[_0x6feb('0xd')],{'host':_0x6feb('0xe'),'port':0x18eb});var socket=require(_0x6feb('0xf'))(new Redis(config[_0x6feb('0xd')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x1f5ae0,_0x723d83,_0x428d93){return new BPromise(function(_0x5b15ae,_0x208a4b){return client['request'](_0x1f5ae0,_0x428d93)[_0x6feb('0x10')](function(_0x3227a1){logger[_0x6feb('0x11')]('FaxAccount,\x20%s,\x20%s',_0x723d83,_0x6feb('0x12'));logger[_0x6feb('0x13')](_0x6feb('0x14'),_0x723d83,_0x6feb('0x12'),JSON[_0x6feb('0x15')](_0x3227a1));if(_0x3227a1[_0x6feb('0x16')]){if(_0x3227a1[_0x6feb('0x16')][_0x6feb('0x17')]===0x1f4){logger[_0x6feb('0x16')]('FaxAccount,\x20%s,\x20%s',_0x723d83,_0x3227a1[_0x6feb('0x16')]['message']);return _0x208a4b(_0x3227a1[_0x6feb('0x16')][_0x6feb('0x18')]);}logger[_0x6feb('0x16')](_0x6feb('0x19'),_0x723d83,_0x3227a1['error'][_0x6feb('0x18')]);return _0x5b15ae(_0x3227a1[_0x6feb('0x16')][_0x6feb('0x18')]);}else{logger[_0x6feb('0x11')](_0x6feb('0x19'),_0x723d83,_0x6feb('0x12'));_0x5b15ae(_0x3227a1['result'][_0x6feb('0x18')]);}})['catch'](function(_0x18b406){logger['error'](_0x6feb('0x19'),_0x723d83,_0x18b406);_0x208a4b(_0x18b406);});});}exports[_0x6feb('0x1a')]=function(_0x35266c){var _0x29cef5=this;return new Promise(function(_0x185747,_0x38d440){return db[_0x6feb('0x1b')][_0x6feb('0x1c')]({'raw':_0x35266c[_0x6feb('0x1d')]?_0x35266c[_0x6feb('0x1d')][_0x6feb('0x1e')]===undefined?!![]:![]:!![],'where':_0x35266c['options']?_0x35266c[_0x6feb('0x1d')][_0x6feb('0x1f')]||null:null,'attributes':_0x35266c[_0x6feb('0x1d')]?_0x35266c[_0x6feb('0x1d')]['attributes']||null:null,'limit':_0x35266c[_0x6feb('0x1d')]?_0x35266c[_0x6feb('0x1d')][_0x6feb('0x20')]||null:null,'include':_0x35266c[_0x6feb('0x1d')]?_0x35266c['options']['include']?_[_0x6feb('0x21')](_0x35266c[_0x6feb('0x1d')]['include'],function(_0x32c154){return{'model':db[_0x32c154[_0x6feb('0x22')]],'as':_0x32c154['as'],'attributes':_0x32c154[_0x6feb('0x23')],'include':_0x32c154[_0x6feb('0x24')]?_['map'](_0x32c154[_0x6feb('0x24')],function(_0x1516a9){return{'model':db[_0x1516a9[_0x6feb('0x22')]],'as':_0x1516a9['as'],'attributes':_0x1516a9[_0x6feb('0x23')],'include':_0x1516a9[_0x6feb('0x24')]?_['map'](_0x1516a9['include'],function(_0x47bfef){return{'model':db[_0x47bfef[_0x6feb('0x22')]],'as':_0x47bfef['as'],'attributes':_0x47bfef[_0x6feb('0x23')]};}):[]};}):[]};}):[]:[]})[_0x6feb('0x10')](function(_0x5312a9){logger[_0x6feb('0x11')](_0x6feb('0x1a'),_0x35266c);logger[_0x6feb('0x13')](_0x6feb('0x1a'),_0x35266c,JSON[_0x6feb('0x15')](_0x5312a9));_0x185747(_0x5312a9);})['catch'](function(_0x5a4d92){logger['error'](_0x6feb('0x1a'),_0x5a4d92['message'],_0x35266c);_0x38d440(_0x29cef5[_0x6feb('0x16')](0x1f4,_0x5a4d92[_0x6feb('0x18')]));});});};exports[_0x6feb('0x25')]=function(_0xf3f978,_0x4a9f2c,_0x4096e9){var _0x5cc7f8=this;return new Promise(function(_0x801ac0,_0x2a0cd7){var _0x454e06={'body':_0xf3f978[_0x6feb('0x26')],'channel':_0x6feb('0x27')};var _0x296f90=[];var _0x50537e=[];var _0x412168={};return db[_0x6feb('0x28')][_0x6feb('0x29')]()[_0x6feb('0x10')](function(_0x5c03ee){if(!_0x5c03ee){throw new db[(_0x6feb('0x2a'))]['ValidationError'](_0x6feb('0x2b'));}_0x296f90=_[_0x6feb('0x2c')](_[_0x6feb('0x2d')](_0x5c03ee),['createdAt','updatedAt']);_0x50537e=_[_0x6feb('0x2c')](_['keys'](_0x5c03ee),[_0x6feb('0x2e'),'updatedAt',_0x6feb('0x2f'),_0x6feb('0x30')]);if(_0xf3f978['body']['id']){delete _0xf3f978[_0x6feb('0x26')]['id'];}if(_[_0x6feb('0x31')](_0xf3f978['body'][_0x6feb('0x32')])){throw new db[(_0x6feb('0x2a'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x6feb('0x31')](_0xf3f978[_0x6feb('0x26')]['body'])||_0xf3f978[_0x6feb('0x26')][_0x6feb('0x26')]===''){throw new db[(_0x6feb('0x2a'))][(_0x6feb('0x33'))](_0x6feb('0x34'));}if(_[_0x6feb('0x31')](_0xf3f978[_0x6feb('0x26')][_0x6feb('0x35')])){throw new db[(_0x6feb('0x2a'))]['ValidationError'](_0x6feb('0x36')+_0x50537e);}if(!_['includes'](_0x50537e,_0xf3f978[_0x6feb('0x26')][_0x6feb('0x35')])){throw new db[(_0x6feb('0x2a'))][(_0x6feb('0x33'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x50537e);}_0x412168[_0xf3f978[_0x6feb('0x26')][_0x6feb('0x35')]]=_0xf3f978['body'][_0x6feb('0x32')];})['then'](function(){return db['FaxAccount'][_0x6feb('0x37')]({'where':{'id':_0xf3f978[_0x6feb('0x38')]['id']},'include':[{'model':db[_0x6feb('0x39')],'as':'List','include':[{'model':db[_0x6feb('0x28')],'as':'Contacts','where':_0x412168,'limit':0x1,'order':[['updatedAt',_0x6feb('0x3a')]]}]},{'model':db[_0x6feb('0x3b')],'as':'Applications'}]});})[_0x6feb('0x10')](function(_0x51f529){if(_0x51f529&&_0x51f529[_0x6feb('0x3c')]){var _0x1c93d5=_0x51f529[_0x6feb('0x3d')]({'plain':!![]});_0x454e06['account']=_0x1c93d5;_0x454e06[_0x6feb('0x3e')]=_0x1c93d5[_0x6feb('0x3f')];_0x454e06[_0x6feb('0x40')]=_0x1c93d5[_0x6feb('0x3c')];_0x454e06[_0x6feb('0x3e')]=_['orderBy'](_0x454e06[_0x6feb('0x3e')],[_0x6feb('0x41')],[_0x6feb('0x42')]);if(_0x454e06[_0x6feb('0x38')][_0x6feb('0x3f')]){delete _0x454e06[_0x6feb('0x38')][_0x6feb('0x3f')];}if(_0x454e06['account'][_0x6feb('0x3c')]&&_0x454e06['account'][_0x6feb('0x3c')]['Contacts'][_0x6feb('0x43')]){return _0x454e06[_0x6feb('0x38')][_0x6feb('0x3c')][_0x6feb('0x44')][0x0];}var _0x120a28=_[_0x6feb('0xc')](_0xf3f978['body'],{'firstName':_0xf3f978[_0x6feb('0x26')][_0x6feb('0x32')],'ListId':_0x1c93d5[_0x6feb('0x30')]});_0x120a28[_0xf3f978[_0x6feb('0x26')]['mapKey']]=_0xf3f978['body']['from'];return db[_0x6feb('0x28')]['create'](_0x120a28,{'fields':_0x296f90,'raw':!![]});}})[_0x6feb('0x10')](function(_0x32c521){_0x454e06['contact']=_0x32c521;if(_0x32c521){var _0x3c000e={'ContactId':_0x32c521['id'],'FaxAccountId':_0xf3f978[_0x6feb('0x38')]['id'],'fax':_0x32c521[_0x6feb('0x27')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x32c521['id'],'closed':![],'FaxAccountId':_0xf3f978[_0x6feb('0x38')]['id']}})['then'](function(_0x52ccea){if(_0x52ccea){return[_0x52ccea,![]];}return db[_0x6feb('0x45')]['create'](_0x3c000e)[_0x6feb('0x10')](function(_0x1a06ba){return[_0x1a06ba,!![]];});});}else{throw new Error(_0x6feb('0x46'));}})[_0x6feb('0x47')](function(_0x2edc9d,_0x4ebcf5){var _0x104935=_0x2edc9d[_0x6feb('0x3d')]({'plain':!![]});if(_0x4ebcf5){if(_0x454e06['account'][_0x6feb('0x48')]){_0x454e06[_0x6feb('0x3e')][_0x6feb('0x49')]({'id':0x0,'priority':_0x454e06[_0x6feb('0x3e')][_0x6feb('0x43')]+0x1,'app':_0x6feb('0x4a'),'appdata':_0x6feb('0x4b'),'interval':_0x6feb('0x4c')});}_0x104935['created']=!![];}else{_0x104935[_0x6feb('0x4d')]=![];}_0x454e06[_0x6feb('0x4e')]=_0x104935;return db[_0x6feb('0x4f')]['create']({'body':_0xf3f978['body'][_0x6feb('0x26')],'FaxAccountId':_0xf3f978[_0x6feb('0x38')]['id'],'FaxInteractionId':_0x2edc9d['id'],'direction':'in','ContactId':_0x2edc9d[_0x6feb('0x50')],'AttachmentId':_0xf3f978['body']['AttachmentId']});})['then'](function(_0x4c1389){_0x454e06['message']=_0x4c1389;if(_0x454e06[_0x6feb('0x4e')]['UserId']){return db[_0x6feb('0x51')][_0x6feb('0x37')]({'attributes':['id',_0x6feb('0x52')],'where':{'id':_0x454e06[_0x6feb('0x4e')][_0x6feb('0x53')]}})[_0x6feb('0x10')](function(_0x26f113){if(_0x26f113){_0x454e06[_0x6feb('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x6feb('0x54'),'appdata':_0x26f113[_0x6feb('0x52')]+','+(_0x454e06['account']['waitForTheAssignedAgent']||0xa),'interval':_0x6feb('0x4c')});}return respondWithRpcPromise(_0x6feb('0x55'),_0x6feb('0x56'),_0x454e06);});}return respondWithRpcPromise('Start','startRouting',_0x454e06);})[_0x6feb('0x10')](function(_0x13b52f){_0x801ac0(_0x13b52f);})[_0x6feb('0x57')](function(_0x70aed1){_0x2a0cd7(_0x5cc7f8[_0x6feb('0x16')](0x1f4,_0x70aed1['message']));});});}; \ No newline at end of file +var _0x7108=['attributes','limit','include','map','model','stringify','fax','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','from','Sequelize','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmContact','Contacts','FaxApplication','Applications','List','get','applications','orderBy','asc','length','contact','FaxInteraction','create','autoclose','push','close','unmanaged','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','findAll','options'];(function(_0x2517bb,_0x1b5a61){var _0x4e82fd=function(_0x502cbc){while(--_0x502cbc){_0x2517bb['push'](_0x2517bb['shift']());}};_0x4e82fd(++_0x1b5a61);}(_0x7108,0x1db));var _0x8710=function(_0x7be482,_0x3fd68e){_0x7be482=_0x7be482-0x0;var _0x59ea88=_0x7108[_0x7be482];return _0x59ea88;};'use strict';var _=require(_0x8710('0x0'));var util=require(_0x8710('0x1'));var moment=require(_0x8710('0x2'));var BPromise=require(_0x8710('0x3'));var rs=require(_0x8710('0x4'));var fs=require('fs');var Redis=require(_0x8710('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8710('0x6'));var logger=require('../../config/logger')(_0x8710('0x7'));var config=require('../../config/environment');var jayson=require(_0x8710('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0x8710('0x9')]=_[_0x8710('0xa')](config[_0x8710('0x9')],{'host':_0x8710('0xb'),'port':0x18eb});var socket=require(_0x8710('0xc'))(new Redis(config[_0x8710('0x9')]));require(_0x8710('0xd'))[_0x8710('0xe')](socket);function respondWithRpcPromise(_0x438e7e,_0x14f447,_0x5df445){return new BPromise(function(_0x5bb2ef,_0x12a222){return client[_0x8710('0xf')](_0x438e7e,_0x5df445)[_0x8710('0x10')](function(_0x1cd51c){logger[_0x8710('0x11')](_0x8710('0x12'),_0x14f447,_0x8710('0x13'));logger['debug'](_0x8710('0x14'),_0x14f447,_0x8710('0x13'),JSON['stringify'](_0x1cd51c));if(_0x1cd51c['error']){if(_0x1cd51c[_0x8710('0x15')][_0x8710('0x16')]===0x1f4){logger[_0x8710('0x15')]('FaxAccount,\x20%s,\x20%s',_0x14f447,_0x1cd51c[_0x8710('0x15')][_0x8710('0x17')]);return _0x12a222(_0x1cd51c['error']['message']);}logger[_0x8710('0x15')](_0x8710('0x12'),_0x14f447,_0x1cd51c['error'][_0x8710('0x17')]);return _0x5bb2ef(_0x1cd51c[_0x8710('0x15')]['message']);}else{logger[_0x8710('0x11')]('FaxAccount,\x20%s,\x20%s',_0x14f447,_0x8710('0x13'));_0x5bb2ef(_0x1cd51c[_0x8710('0x18')][_0x8710('0x17')]);}})[_0x8710('0x19')](function(_0x22c62c){logger[_0x8710('0x15')](_0x8710('0x12'),_0x14f447,_0x22c62c);_0x12a222(_0x22c62c);});});}exports[_0x8710('0x1a')]=function(_0x5a1615){var _0xb73326=this;return new Promise(function(_0x4146c1,_0x2a29bd){return db['FaxAccount'][_0x8710('0x1b')]({'raw':_0x5a1615['options']?_0x5a1615['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a1615['options']?_0x5a1615[_0x8710('0x1c')]['where']||null:null,'attributes':_0x5a1615['options']?_0x5a1615['options'][_0x8710('0x1d')]||null:null,'limit':_0x5a1615[_0x8710('0x1c')]?_0x5a1615[_0x8710('0x1c')][_0x8710('0x1e')]||null:null,'include':_0x5a1615[_0x8710('0x1c')]?_0x5a1615[_0x8710('0x1c')][_0x8710('0x1f')]?_[_0x8710('0x20')](_0x5a1615[_0x8710('0x1c')][_0x8710('0x1f')],function(_0x240dc1){return{'model':db[_0x240dc1[_0x8710('0x21')]],'as':_0x240dc1['as'],'attributes':_0x240dc1['attributes'],'include':_0x240dc1[_0x8710('0x1f')]?_[_0x8710('0x20')](_0x240dc1[_0x8710('0x1f')],function(_0x97b5f1){return{'model':db[_0x97b5f1[_0x8710('0x21')]],'as':_0x97b5f1['as'],'attributes':_0x97b5f1['attributes'],'include':_0x97b5f1[_0x8710('0x1f')]?_['map'](_0x97b5f1['include'],function(_0x17e08b){return{'model':db[_0x17e08b['model']],'as':_0x17e08b['as'],'attributes':_0x17e08b[_0x8710('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8710('0x10')](function(_0x3712aa){logger[_0x8710('0x11')](_0x8710('0x1a'),_0x5a1615);logger['debug'](_0x8710('0x1a'),_0x5a1615,JSON[_0x8710('0x22')](_0x3712aa));_0x4146c1(_0x3712aa);})['catch'](function(_0x13e122){logger[_0x8710('0x15')]('GetFaxAccount',_0x13e122[_0x8710('0x17')],_0x5a1615);_0x2a29bd(_0xb73326[_0x8710('0x15')](0x1f4,_0x13e122['message']));});});};exports['NotifyFaxAccount']=function(_0x30f74e,_0xc7b980,_0x263dff){var _0x226be8=this;return new Promise(function(_0x442db2,_0x378776){var _0x12ebe3={'body':_0x30f74e['body'],'channel':_0x8710('0x23')};var _0x322828=[];var _0x1a4c23=[];var _0x148200={};return db['CmContact'][_0x8710('0x24')]()[_0x8710('0x10')](function(_0x5ad35c){if(!_0x5ad35c){throw new db['Sequelize'][(_0x8710('0x25'))](_0x8710('0x26'));}_0x322828=_[_0x8710('0x27')](_[_0x8710('0x28')](_0x5ad35c),[_0x8710('0x29'),_0x8710('0x2a')]);_0x1a4c23=_[_0x8710('0x27')](_[_0x8710('0x28')](_0x5ad35c),[_0x8710('0x29'),_0x8710('0x2a'),_0x8710('0x2b'),_0x8710('0x2c')]);if(_0x30f74e['body']['id']){delete _0x30f74e[_0x8710('0x2d')]['id'];}if(_['isNil'](_0x30f74e[_0x8710('0x2d')][_0x8710('0x2e')])){throw new db[(_0x8710('0x2f'))][(_0x8710('0x25'))](_0x8710('0x30'));}if(_[_0x8710('0x31')](_0x30f74e[_0x8710('0x2d')][_0x8710('0x2d')])||_0x30f74e[_0x8710('0x2d')]['body']===''){throw new db[(_0x8710('0x2f'))][(_0x8710('0x25'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x30f74e[_0x8710('0x2d')][_0x8710('0x32')])){throw new db[(_0x8710('0x2f'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1a4c23);}if(!_['includes'](_0x1a4c23,_0x30f74e[_0x8710('0x2d')][_0x8710('0x32')])){throw new db[(_0x8710('0x2f'))][(_0x8710('0x25'))](_0x8710('0x33')+_0x1a4c23);}_0x148200[_0x30f74e['body']['mapKey']]=_0x30f74e['body'][_0x8710('0x2e')];})[_0x8710('0x10')](function(){return db[_0x8710('0x34')][_0x8710('0x35')]({'where':{'id':_0x30f74e[_0x8710('0x36')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8710('0x37')],'as':_0x8710('0x38'),'where':_0x148200,'limit':0x1,'order':[[_0x8710('0x2a'),'DESC']]}]},{'model':db[_0x8710('0x39')],'as':_0x8710('0x3a')}]});})[_0x8710('0x10')](function(_0x39a15c){if(_0x39a15c&&_0x39a15c[_0x8710('0x3b')]){var _0x5e1ff4=_0x39a15c[_0x8710('0x3c')]({'plain':!![]});_0x12ebe3[_0x8710('0x36')]=_0x5e1ff4;_0x12ebe3[_0x8710('0x3d')]=_0x5e1ff4['Applications'];_0x12ebe3['list']=_0x5e1ff4[_0x8710('0x3b')];_0x12ebe3[_0x8710('0x3d')]=_[_0x8710('0x3e')](_0x12ebe3[_0x8710('0x3d')],['priority'],[_0x8710('0x3f')]);if(_0x12ebe3[_0x8710('0x36')][_0x8710('0x3a')]){delete _0x12ebe3[_0x8710('0x36')][_0x8710('0x3a')];}if(_0x12ebe3['account']['List']&&_0x12ebe3[_0x8710('0x36')]['List'][_0x8710('0x38')][_0x8710('0x40')]){return _0x12ebe3[_0x8710('0x36')][_0x8710('0x3b')][_0x8710('0x38')][0x0];}var _0x36de16=_['defaults'](_0x30f74e[_0x8710('0x2d')],{'firstName':_0x30f74e['body']['from'],'ListId':_0x5e1ff4[_0x8710('0x2c')]});_0x36de16[_0x30f74e[_0x8710('0x2d')][_0x8710('0x32')]]=_0x30f74e['body']['from'];return db['CmContact']['create'](_0x36de16,{'fields':_0x322828,'raw':!![]});}})[_0x8710('0x10')](function(_0x1c0733){_0x12ebe3[_0x8710('0x41')]=_0x1c0733;if(_0x1c0733){var _0xffb26f={'ContactId':_0x1c0733['id'],'FaxAccountId':_0x30f74e[_0x8710('0x36')]['id'],'fax':_0x1c0733[_0x8710('0x23')]};return db[_0x8710('0x42')]['find']({'where':{'ContactId':_0x1c0733['id'],'closed':![],'FaxAccountId':_0x30f74e[_0x8710('0x36')]['id']}})[_0x8710('0x10')](function(_0x23a5ec){if(_0x23a5ec){return[_0x23a5ec,![]];}return db[_0x8710('0x42')][_0x8710('0x43')](_0xffb26f)[_0x8710('0x10')](function(_0x16ec68){return[_0x16ec68,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x4c24a1,_0x35fba4){var _0x422a11=_0x4c24a1[_0x8710('0x3c')]({'plain':!![]});if(_0x35fba4){if(_0x12ebe3[_0x8710('0x36')][_0x8710('0x44')]){_0x12ebe3[_0x8710('0x3d')][_0x8710('0x45')]({'id':0x0,'priority':_0x12ebe3[_0x8710('0x3d')]['length']+0x1,'app':_0x8710('0x46'),'appdata':_0x8710('0x47'),'interval':'*,*,*,*'});}_0x422a11[_0x8710('0x48')]=!![];}else{_0x422a11[_0x8710('0x48')]=![];}_0x12ebe3['interaction']=_0x422a11;return db[_0x8710('0x49')][_0x8710('0x43')]({'body':_0x30f74e[_0x8710('0x2d')][_0x8710('0x2d')],'FaxAccountId':_0x30f74e[_0x8710('0x36')]['id'],'FaxInteractionId':_0x4c24a1['id'],'direction':'in','ContactId':_0x4c24a1[_0x8710('0x4a')],'AttachmentId':_0x30f74e[_0x8710('0x2d')][_0x8710('0x4b')]});})[_0x8710('0x10')](function(_0x267fd5){_0x12ebe3[_0x8710('0x17')]=_0x267fd5;if(_0x12ebe3[_0x8710('0x4c')][_0x8710('0x4d')]){return db[_0x8710('0x4e')]['find']({'attributes':['id',_0x8710('0x4f')],'where':{'id':_0x12ebe3[_0x8710('0x4c')][_0x8710('0x4d')]}})[_0x8710('0x10')](function(_0xb5ba94){if(_0xb5ba94){_0x12ebe3['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xb5ba94[_0x8710('0x4f')]+','+(_0x12ebe3[_0x8710('0x36')][_0x8710('0x50')]||0xa),'interval':_0x8710('0x51')});}return respondWithRpcPromise(_0x8710('0x52'),_0x8710('0x53'),_0x12ebe3);});}return respondWithRpcPromise(_0x8710('0x52'),_0x8710('0x53'),_0x12ebe3);})[_0x8710('0x10')](function(_0x7d6c88){_0x442db2(_0x7d6c88);})[_0x8710('0x19')](function(_0x5c9a9e){_0x378776(_0x226be8[_0x8710('0x15')](0x1f4,_0x5c9a9e[_0x8710('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 3c079d0..1c1bb23 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 _0xb4d2=['./faxAccount.events','save','remove','emit','removeListener','register'];(function(_0x417570,_0x414ca3){var _0x11087e=function(_0x1cfec7){while(--_0x1cfec7){_0x417570['push'](_0x417570['shift']());}};_0x11087e(++_0x414ca3);}(_0xb4d2,0x1b0));var _0x2b4d=function(_0x41615e,_0x18950c){_0x41615e=_0x41615e-0x0;var _0xc302ea=_0xb4d2[_0x41615e];return _0xc302ea;};'use strict';var FaxAccountEvents=require(_0x2b4d('0x0'));var events=[_0x2b4d('0x1'),_0x2b4d('0x2'),'update'];function createListener(_0x32054b,_0x2eb136){return function(_0x2188c1){_0x2eb136[_0x2b4d('0x3')](_0x32054b,_0x2188c1);};}function removeListener(_0x43be88,_0x50efe5){return function(){FaxAccountEvents[_0x2b4d('0x4')](_0x43be88,_0x50efe5);};}exports[_0x2b4d('0x5')]=function(_0x3785de){for(var _0x498bc6=0x0,_0x16d412=events['length'];_0x498bc6<_0x16d412;_0x498bc6++){var _0x6a23b5=events[_0x498bc6];var _0x280416=createListener('faxAccount:'+_0x6a23b5,_0x3785de);FaxAccountEvents['on'](_0x6a23b5,_0x280416);}}; \ No newline at end of file +var _0xe9a6=['removeListener','register','length','faxAccount:','./faxAccount.events','save','remove','update','emit'];(function(_0x6d481c,_0x1ac998){var _0x32cd8a=function(_0x55a52f){while(--_0x55a52f){_0x6d481c['push'](_0x6d481c['shift']());}};_0x32cd8a(++_0x1ac998);}(_0xe9a6,0xaf));var _0x6e9a=function(_0xb4411,_0x5d04ac){_0xb4411=_0xb4411-0x0;var _0x481db4=_0xe9a6[_0xb4411];return _0x481db4;};'use strict';var FaxAccountEvents=require(_0x6e9a('0x0'));var events=[_0x6e9a('0x1'),_0x6e9a('0x2'),_0x6e9a('0x3')];function createListener(_0x74d97a,_0x4a79e4){return function(_0x2c3f81){_0x4a79e4[_0x6e9a('0x4')](_0x74d97a,_0x2c3f81);};}function removeListener(_0x432c26,_0x5507c4){return function(){FaxAccountEvents[_0x6e9a('0x5')](_0x432c26,_0x5507c4);};}exports[_0x6e9a('0x6')]=function(_0x264ddf){for(var _0x23d123=0x0,_0x28a2cd=events[_0x6e9a('0x7')];_0x23d123<_0x28a2cd;_0x23d123++){var _0x32624b=events[_0x23d123];var _0x5d3be5=createListener(_0x6e9a('0x8')+_0x32624b,_0x264ddf);FaxAccountEvents['on'](_0x32624b,_0x5d3be5);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 3df0d7d..8b78ebc 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(_0x1ee578,_0x4692ba){var _0x415497=function(_0x52b191){while(--_0x52b191){_0x1ee578['push'](_0x1ee578['shift']());}};_0x415497(++_0x4692ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x4f8cc6,_0x388d28){var _0xb75f62=function(_0x180aba){while(--_0x180aba){_0x4f8cc6['push'](_0x4f8cc6['shift']());}};_0xb75f62(++_0x388d28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 023cb7f..d0529fd 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 _0xbfb9=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x538db1,_0x5650d0){var _0x33c70f=function(_0x28827a){while(--_0x28827a){_0x538db1['push'](_0x538db1['shift']());}};_0x33c70f(++_0x5650d0);}(_0xbfb9,0x7f));var _0x9bfb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbfb9[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x9bfb('0x0'));module[_0x9bfb('0x1')]={'priority':{'type':Sequelize[_0x9bfb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9bfb('0x3')],'allowNull':![],'defaultValue':_0x9bfb('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9bfb('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9bfb('0x5')}}; \ No newline at end of file +var _0x7b0e=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x5271fe,_0x237210){var _0xae6163=function(_0x481e35){while(--_0x481e35){_0x5271fe['push'](_0x5271fe['shift']());}};_0xae6163(++_0x237210);}(_0x7b0e,0x1b9));var _0xe7b0=function(_0x4391ee,_0x363e20){_0x4391ee=_0x4391ee-0x0;var _0x46095e=_0x7b0e[_0x4391ee];return _0x46095e;};'use strict';var Sequelize=require(_0xe7b0('0x0'));module[_0xe7b0('0x1')]={'priority':{'type':Sequelize[_0xe7b0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe7b0('0x3')],'allowNull':![],'defaultValue':_0xe7b0('0x4')},'appdata':{'type':Sequelize[_0xe7b0('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe7b0('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 9c2d1af..bb77265 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 _0x3674=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','length'];(function(_0x4dc671,_0x8ba16b){var _0x7e0a58=function(_0x28bfa9){while(--_0x28bfa9){_0x4dc671['push'](_0x4dc671['shift']());}};_0x7e0a58(++_0x8ba16b);}(_0x3674,0x1ed));var _0x4367=function(_0x58e302,_0x1bb64a){_0x58e302=_0x58e302-0x0;var _0x17306b=_0x3674[_0x58e302];return _0x17306b;};'use strict';var emlformat=require(_0x4367('0x0'));var rimraf=require(_0x4367('0x1'));var zipdir=require(_0x4367('0x2'));var jsonpatch=require(_0x4367('0x3'));var rp=require(_0x4367('0x4'));var moment=require(_0x4367('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4367('0x6'));var util=require(_0x4367('0x7'));var path=require(_0x4367('0x8'));var sox=require(_0x4367('0x9'));var csv=require(_0x4367('0xa'));var ejs=require(_0x4367('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4367('0xc'));var crypto=require(_0x4367('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4367('0xe'));var toCsv=require(_0x4367('0xa'));var querystring=require(_0x4367('0xf'));var Papa=require('papaparse');var Redis=require(_0x4367('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4367('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4367('0x12'));var logger=require(_0x4367('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4367('0x14'));var db=require(_0x4367('0x15'))['db'];function respondWithStatusCode(_0x220103,_0x4992a3){_0x4992a3=_0x4992a3||0xcc;return function(_0x34de36){if(_0x34de36){return _0x220103[_0x4367('0x16')](_0x4992a3);}return _0x220103[_0x4367('0x17')](_0x4992a3)[_0x4367('0x18')]();};}function respondWithResult(_0x2be5fb,_0x3a2133){_0x3a2133=_0x3a2133||0xc8;return function(_0x2766c3){if(_0x2766c3){return _0x2be5fb['status'](_0x3a2133)[_0x4367('0x19')](_0x2766c3);}};}function respondWithFilteredResult(_0x52ba62,_0x5c0fbe){return function(_0x5183ed){if(_0x5183ed){var _0x5bb7db=typeof _0x5c0fbe[_0x4367('0x1a')]===_0x4367('0x1b')&&typeof _0x5c0fbe[_0x4367('0x1c')]===_0x4367('0x1b');var _0x16d75a=_0x5183ed[_0x4367('0x1d')];var _0x452f14=_0x5bb7db?0x0:_0x5c0fbe['offset'];var _0x2cc665=_0x5bb7db?_0x5183ed['count']:_0x5c0fbe['offset']+_0x5c0fbe[_0x4367('0x1c')];var _0x309fe2;if(_0x2cc665>=_0x16d75a){_0x2cc665=_0x16d75a;_0x309fe2=0xc8;}else{_0x309fe2=0xce;}_0x52ba62[_0x4367('0x17')](_0x309fe2);return _0x52ba62[_0x4367('0x1e')](_0x4367('0x1f'),_0x452f14+'-'+_0x2cc665+'/'+_0x16d75a)[_0x4367('0x19')](_0x5183ed);}return null;};}function patchUpdates(_0x3ea04b){return function(_0x400538){try{jsonpatch['apply'](_0x400538,_0x3ea04b,!![]);}catch(_0x3376a4){return BPromise[_0x4367('0x20')](_0x3376a4);}return _0x400538['save']();};}function saveUpdates(_0x340234,_0xbc11d){return function(_0x23d49f){if(_0x23d49f){return _0x23d49f[_0x4367('0x21')](_0x340234)[_0x4367('0x22')](function(_0xd87f3d){return _0xd87f3d;});}return null;};}function removeEntity(_0x2370b5,_0x3b882a){return function(_0x11688d){if(_0x11688d){return _0x11688d[_0x4367('0x23')]()['then'](function(){_0x2370b5[_0x4367('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15dc9b,_0x4dead8){return function(_0x2124c8){if(!_0x2124c8){_0x15dc9b[_0x4367('0x16')](0x194);}return _0x2124c8;};}function handleError(_0x46bc57,_0x59be94){_0x59be94=_0x59be94||0x1f4;return function(_0x3d60f5){logger[_0x4367('0x24')](_0x3d60f5[_0x4367('0x25')]);if(_0x3d60f5['name']){delete _0x3d60f5[_0x4367('0x26')];}_0x46bc57[_0x4367('0x17')](_0x59be94)[_0x4367('0x27')](_0x3d60f5);};}exports[_0x4367('0x28')]=function(_0x214b90,_0x4ea211){var _0x39bc2b={},_0x11f97d={},_0x27eb19={'count':0x0,'rows':[]};var _0x33d687=_[_0x4367('0x29')](db[_0x4367('0x2a')][_0x4367('0x2b')],function(_0x3dd72a){return{'name':_0x3dd72a[_0x4367('0x2c')],'type':_0x3dd72a[_0x4367('0x2d')][_0x4367('0x2e')]};});_0x11f97d[_0x4367('0x2f')]=_[_0x4367('0x29')](_0x33d687,_0x4367('0x26'));_0x11f97d['query']=_[_0x4367('0x30')](_0x214b90[_0x4367('0x31')]);_0x11f97d[_0x4367('0x32')]=_[_0x4367('0x33')](_0x11f97d[_0x4367('0x2f')],_0x11f97d[_0x4367('0x31')]);_0x39bc2b['attributes']=_['intersection'](_0x11f97d[_0x4367('0x2f')],qs[_0x4367('0x34')](_0x214b90[_0x4367('0x31')][_0x4367('0x34')]));_0x39bc2b[_0x4367('0x35')]=_0x39bc2b[_0x4367('0x35')]['length']?_0x39bc2b[_0x4367('0x35')]:_0x11f97d[_0x4367('0x2f')];if(!_0x214b90[_0x4367('0x31')]['hasOwnProperty'](_0x4367('0x36'))){_0x39bc2b[_0x4367('0x1c')]=qs[_0x4367('0x1c')](_0x214b90[_0x4367('0x31')][_0x4367('0x1c')]);_0x39bc2b['offset']=qs[_0x4367('0x1a')](_0x214b90[_0x4367('0x31')][_0x4367('0x1a')]);}_0x39bc2b['order']=qs[_0x4367('0x37')](_0x214b90[_0x4367('0x31')][_0x4367('0x37')]);_0x39bc2b[_0x4367('0x38')]=qs['filters'](_['pick'](_0x214b90[_0x4367('0x31')],_0x11f97d[_0x4367('0x32')]),_0x33d687);if(_0x214b90[_0x4367('0x31')][_0x4367('0x39')]){_0x39bc2b[_0x4367('0x38')]=_[_0x4367('0x3a')](_0x39bc2b[_0x4367('0x38')],{'$or':_[_0x4367('0x29')](_0x33d687,function(_0x528f85){if(_0x528f85[_0x4367('0x2d')]!==_0x4367('0x3b')){var _0x161339={};_0x161339[_0x528f85[_0x4367('0x26')]]={'$like':'%'+_0x214b90[_0x4367('0x31')][_0x4367('0x39')]+'%'};return _0x161339;}})});}_0x39bc2b=_[_0x4367('0x3a')]({},_0x39bc2b,_0x214b90[_0x4367('0x3c')]);var _0x20af0f={'where':_0x39bc2b[_0x4367('0x38')]};return db[_0x4367('0x2a')][_0x4367('0x1d')](_0x20af0f)['then'](function(_0x51492a){_0x27eb19[_0x4367('0x1d')]=_0x51492a;if(_0x214b90[_0x4367('0x31')][_0x4367('0x3d')]){_0x39bc2b[_0x4367('0x3e')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x39bc2b);})[_0x4367('0x22')](function(_0x6018ce){_0x27eb19['rows']=_0x6018ce;return _0x27eb19;})[_0x4367('0x22')](respondWithFilteredResult(_0x4ea211,_0x39bc2b))[_0x4367('0x3f')](handleError(_0x4ea211,null));};exports[_0x4367('0x40')]=function(_0x25834e,_0x1f9cd3){var _0x2476f7={'raw':!![],'where':{'id':_0x25834e[_0x4367('0x41')]['id']}},_0x5e8f7e={};_0x5e8f7e[_0x4367('0x2f')]=_[_0x4367('0x30')](db[_0x4367('0x2a')][_0x4367('0x2b')]);_0x5e8f7e[_0x4367('0x31')]=_[_0x4367('0x30')](_0x25834e[_0x4367('0x31')]);_0x5e8f7e[_0x4367('0x32')]=_[_0x4367('0x33')](_0x5e8f7e[_0x4367('0x2f')],_0x5e8f7e[_0x4367('0x31')]);_0x2476f7[_0x4367('0x35')]=_[_0x4367('0x33')](_0x5e8f7e['model'],qs[_0x4367('0x34')](_0x25834e[_0x4367('0x31')][_0x4367('0x34')]));_0x2476f7[_0x4367('0x35')]=_0x2476f7['attributes'][_0x4367('0x42')]?_0x2476f7[_0x4367('0x35')]:_0x5e8f7e[_0x4367('0x2f')];if(_0x25834e['query'][_0x4367('0x3d')]){_0x2476f7['include']=[{'all':!![]}];}_0x2476f7=_[_0x4367('0x3a')]({},_0x2476f7,_0x25834e['options']);return db[_0x4367('0x2a')][_0x4367('0x43')](_0x2476f7)[_0x4367('0x22')](handleEntityNotFound(_0x1f9cd3,null))['then'](respondWithResult(_0x1f9cd3,null))[_0x4367('0x3f')](handleError(_0x1f9cd3,null));};exports[_0x4367('0x44')]=function(_0x50b364,_0x493cce){return db['FaxApplication'][_0x4367('0x44')](_0x50b364[_0x4367('0x45')],{})[_0x4367('0x22')](respondWithResult(_0x493cce,0xc9))[_0x4367('0x3f')](handleError(_0x493cce,null));};exports[_0x4367('0x21')]=function(_0x2e61c2,_0x174eba){if(_0x2e61c2[_0x4367('0x45')]['id']){delete _0x2e61c2[_0x4367('0x45')]['id'];}return db['FaxApplication'][_0x4367('0x43')]({'where':{'id':_0x2e61c2['params']['id']}})[_0x4367('0x22')](handleEntityNotFound(_0x174eba,null))[_0x4367('0x22')](saveUpdates(_0x2e61c2[_0x4367('0x45')],null))[_0x4367('0x22')](respondWithResult(_0x174eba,null))['catch'](handleError(_0x174eba,null));};exports[_0x4367('0x23')]=function(_0x423f58,_0x3371a4){return db[_0x4367('0x2a')]['find']({'where':{'id':_0x423f58[_0x4367('0x41')]['id']}})['then'](handleEntityNotFound(_0x3371a4,null))[_0x4367('0x22')](removeEntity(_0x3371a4,null))['catch'](handleError(_0x3371a4,null));}; \ No newline at end of file +var _0x14ce=['error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','FaxApplication','includeAll','include','findAll','catch','show','params','find','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x5f19c0,_0x403640){var _0x158f80=function(_0x39ab46){while(--_0x39ab46){_0x5f19c0['push'](_0x5f19c0['shift']());}};_0x158f80(++_0x403640);}(_0x14ce,0x1d4));var _0xe14c=function(_0x5cb751,_0x13ccc2){_0x5cb751=_0x5cb751-0x0;var _0x2e646b=_0x14ce[_0x5cb751];return _0x2e646b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe14c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe14c('0x1'));var rp=require('request-promise');var moment=require(_0xe14c('0x2'));var BPromise=require(_0xe14c('0x3'));var Mustache=require(_0xe14c('0x4'));var util=require(_0xe14c('0x5'));var path=require(_0xe14c('0x6'));var sox=require('sox');var csv=require(_0xe14c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe14c('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe14c('0x9'));var toCsv=require(_0xe14c('0x7'));var querystring=require('querystring');var Papa=require(_0xe14c('0xa'));var Redis=require(_0xe14c('0xb'));var authService=require(_0xe14c('0xc'));var qs=require(_0xe14c('0xd'));var as=require(_0xe14c('0xe'));var hardwareService=require(_0xe14c('0xf'));var logger=require(_0xe14c('0x10'))(_0xe14c('0x11'));var utils=require(_0xe14c('0x12'));var config=require(_0xe14c('0x13'));var licenseUtil=require(_0xe14c('0x14'));var db=require(_0xe14c('0x15'))['db'];function respondWithStatusCode(_0x5a3dba,_0x2387cc){_0x2387cc=_0x2387cc||0xcc;return function(_0x508fc7){if(_0x508fc7){return _0x5a3dba[_0xe14c('0x16')](_0x2387cc);}return _0x5a3dba[_0xe14c('0x17')](_0x2387cc)[_0xe14c('0x18')]();};}function respondWithResult(_0x3dcf9e,_0x147c4e){_0x147c4e=_0x147c4e||0xc8;return function(_0x29d05f){if(_0x29d05f){return _0x3dcf9e['status'](_0x147c4e)['json'](_0x29d05f);}};}function respondWithFilteredResult(_0x65f460,_0x11c0c0){return function(_0x3935a6){if(_0x3935a6){var _0x2a1315=typeof _0x11c0c0[_0xe14c('0x19')]===_0xe14c('0x1a')&&typeof _0x11c0c0[_0xe14c('0x1b')]===_0xe14c('0x1a');var _0x45cc7b=_0x3935a6[_0xe14c('0x1c')];var _0x538280=_0x2a1315?0x0:_0x11c0c0['offset'];var _0x597606=_0x2a1315?_0x3935a6[_0xe14c('0x1c')]:_0x11c0c0[_0xe14c('0x19')]+_0x11c0c0[_0xe14c('0x1b')];var _0x125a0f;if(_0x597606>=_0x45cc7b){_0x597606=_0x45cc7b;_0x125a0f=0xc8;}else{_0x125a0f=0xce;}_0x65f460['status'](_0x125a0f);return _0x65f460[_0xe14c('0x1d')](_0xe14c('0x1e'),_0x538280+'-'+_0x597606+'/'+_0x45cc7b)['json'](_0x3935a6);}return null;};}function patchUpdates(_0x17f884){return function(_0x2ee493){try{jsonpatch[_0xe14c('0x1f')](_0x2ee493,_0x17f884,!![]);}catch(_0x3ecebc){return BPromise[_0xe14c('0x20')](_0x3ecebc);}return _0x2ee493['save']();};}function saveUpdates(_0x349554,_0x480680){return function(_0x1e5752){if(_0x1e5752){return _0x1e5752[_0xe14c('0x21')](_0x349554)[_0xe14c('0x22')](function(_0x53ce71){return _0x53ce71;});}return null;};}function removeEntity(_0x36d341,_0x1f61d2){return function(_0xcc093a){if(_0xcc093a){return _0xcc093a[_0xe14c('0x23')]()[_0xe14c('0x22')](function(){_0x36d341['status'](0xcc)[_0xe14c('0x18')]();});}};}function handleEntityNotFound(_0x4b2a7f,_0x2b0874){return function(_0x394a06){if(!_0x394a06){_0x4b2a7f[_0xe14c('0x16')](0x194);}return _0x394a06;};}function handleError(_0xf6c52a,_0x4ea093){_0x4ea093=_0x4ea093||0x1f4;return function(_0x12c49b){logger[_0xe14c('0x24')](_0x12c49b[_0xe14c('0x25')]);if(_0x12c49b[_0xe14c('0x26')]){delete _0x12c49b[_0xe14c('0x26')];}_0xf6c52a['status'](_0x4ea093)[_0xe14c('0x27')](_0x12c49b);};}exports[_0xe14c('0x28')]=function(_0x1368df,_0x4502f2){var _0x3eb8ed={},_0x4071bc={},_0x3bf829={'count':0x0,'rows':[]};var _0x56030f=_[_0xe14c('0x29')](db['FaxApplication'][_0xe14c('0x2a')],function(_0x281071){return{'name':_0x281071[_0xe14c('0x2b')],'type':_0x281071[_0xe14c('0x2c')][_0xe14c('0x2d')]};});_0x4071bc[_0xe14c('0x2e')]=_[_0xe14c('0x29')](_0x56030f,_0xe14c('0x26'));_0x4071bc['query']=_[_0xe14c('0x2f')](_0x1368df['query']);_0x4071bc['filters']=_[_0xe14c('0x30')](_0x4071bc[_0xe14c('0x2e')],_0x4071bc[_0xe14c('0x31')]);_0x3eb8ed[_0xe14c('0x32')]=_[_0xe14c('0x30')](_0x4071bc[_0xe14c('0x2e')],qs[_0xe14c('0x33')](_0x1368df[_0xe14c('0x31')][_0xe14c('0x33')]));_0x3eb8ed['attributes']=_0x3eb8ed[_0xe14c('0x32')][_0xe14c('0x34')]?_0x3eb8ed[_0xe14c('0x32')]:_0x4071bc[_0xe14c('0x2e')];if(!_0x1368df[_0xe14c('0x31')]['hasOwnProperty'](_0xe14c('0x35'))){_0x3eb8ed['limit']=qs[_0xe14c('0x1b')](_0x1368df[_0xe14c('0x31')]['limit']);_0x3eb8ed[_0xe14c('0x19')]=qs[_0xe14c('0x19')](_0x1368df[_0xe14c('0x31')][_0xe14c('0x19')]);}_0x3eb8ed['order']=qs[_0xe14c('0x36')](_0x1368df[_0xe14c('0x31')]['sort']);_0x3eb8ed[_0xe14c('0x37')]=qs[_0xe14c('0x38')](_[_0xe14c('0x39')](_0x1368df[_0xe14c('0x31')],_0x4071bc[_0xe14c('0x38')]),_0x56030f);if(_0x1368df[_0xe14c('0x31')][_0xe14c('0x3a')]){_0x3eb8ed[_0xe14c('0x37')]=_[_0xe14c('0x3b')](_0x3eb8ed[_0xe14c('0x37')],{'$or':_[_0xe14c('0x29')](_0x56030f,function(_0x17f4d7){if(_0x17f4d7[_0xe14c('0x2c')]!==_0xe14c('0x3c')){var _0x51a43a={};_0x51a43a[_0x17f4d7[_0xe14c('0x26')]]={'$like':'%'+_0x1368df[_0xe14c('0x31')][_0xe14c('0x3a')]+'%'};return _0x51a43a;}})});}_0x3eb8ed=_[_0xe14c('0x3b')]({},_0x3eb8ed,_0x1368df[_0xe14c('0x3d')]);var _0x420fb7={'where':_0x3eb8ed[_0xe14c('0x37')]};return db[_0xe14c('0x3e')][_0xe14c('0x1c')](_0x420fb7)[_0xe14c('0x22')](function(_0x4cd3ef){_0x3bf829[_0xe14c('0x1c')]=_0x4cd3ef;if(_0x1368df['query'][_0xe14c('0x3f')]){_0x3eb8ed[_0xe14c('0x40')]=[{'all':!![]}];}return db[_0xe14c('0x3e')][_0xe14c('0x41')](_0x3eb8ed);})[_0xe14c('0x22')](function(_0x1c05bf){_0x3bf829['rows']=_0x1c05bf;return _0x3bf829;})[_0xe14c('0x22')](respondWithFilteredResult(_0x4502f2,_0x3eb8ed))[_0xe14c('0x42')](handleError(_0x4502f2,null));};exports[_0xe14c('0x43')]=function(_0xd07ac4,_0x112fc9){var _0x5fce9b={'raw':!![],'where':{'id':_0xd07ac4[_0xe14c('0x44')]['id']}},_0x285097={};_0x285097[_0xe14c('0x2e')]=_[_0xe14c('0x2f')](db[_0xe14c('0x3e')][_0xe14c('0x2a')]);_0x285097[_0xe14c('0x31')]=_[_0xe14c('0x2f')](_0xd07ac4[_0xe14c('0x31')]);_0x285097['filters']=_[_0xe14c('0x30')](_0x285097[_0xe14c('0x2e')],_0x285097['query']);_0x5fce9b['attributes']=_[_0xe14c('0x30')](_0x285097[_0xe14c('0x2e')],qs[_0xe14c('0x33')](_0xd07ac4['query'][_0xe14c('0x33')]));_0x5fce9b[_0xe14c('0x32')]=_0x5fce9b[_0xe14c('0x32')][_0xe14c('0x34')]?_0x5fce9b[_0xe14c('0x32')]:_0x285097[_0xe14c('0x2e')];if(_0xd07ac4[_0xe14c('0x31')][_0xe14c('0x3f')]){_0x5fce9b[_0xe14c('0x40')]=[{'all':!![]}];}_0x5fce9b=_[_0xe14c('0x3b')]({},_0x5fce9b,_0xd07ac4['options']);return db[_0xe14c('0x3e')][_0xe14c('0x45')](_0x5fce9b)[_0xe14c('0x22')](handleEntityNotFound(_0x112fc9,null))[_0xe14c('0x22')](respondWithResult(_0x112fc9,null))[_0xe14c('0x42')](handleError(_0x112fc9,null));};exports[_0xe14c('0x46')]=function(_0x3eb9b4,_0x192b25){return db['FaxApplication'][_0xe14c('0x46')](_0x3eb9b4[_0xe14c('0x47')],{})[_0xe14c('0x22')](respondWithResult(_0x192b25,0xc9))[_0xe14c('0x42')](handleError(_0x192b25,null));};exports[_0xe14c('0x21')]=function(_0x26f65f,_0x306db3){if(_0x26f65f['body']['id']){delete _0x26f65f[_0xe14c('0x47')]['id'];}return db[_0xe14c('0x3e')][_0xe14c('0x45')]({'where':{'id':_0x26f65f['params']['id']}})[_0xe14c('0x22')](handleEntityNotFound(_0x306db3,null))[_0xe14c('0x22')](saveUpdates(_0x26f65f['body'],null))[_0xe14c('0x22')](respondWithResult(_0x306db3,null))[_0xe14c('0x42')](handleError(_0x306db3,null));};exports['destroy']=function(_0x4883e9,_0x1ff9d5){return db['FaxApplication'][_0xe14c('0x45')]({'where':{'id':_0x4883e9[_0xe14c('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ff9d5,null))[_0xe14c('0x22')](removeEntity(_0x1ff9d5,null))[_0xe14c('0x42')](handleError(_0x1ff9d5,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 6130387..3c9cd29 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 _0xbe74=['FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','path'];(function(_0x3b53b0,_0x23dc58){var _0x4eddc6=function(_0x46254f){while(--_0x46254f){_0x3b53b0['push'](_0x3b53b0['shift']());}};_0x4eddc6(++_0x23dc58);}(_0xbe74,0xa6));var _0x4be7=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0xbe74[_0x2c0be1];return _0x3d4bd2;};'use strict';var _=require('lodash');var util=require(_0x4be7('0x0'));var logger=require(_0x4be7('0x1'))('api');var moment=require(_0x4be7('0x2'));var BPromise=require('bluebird');var rp=require(_0x4be7('0x3'));var fs=require('fs');var path=require(_0x4be7('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module['exports']=function(_0x57abf4,_0x5a75a9){return _0x57abf4['define'](_0x4be7('0x5'),attributes,{'tableName':_0x4be7('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4be7('0x7'),'collate':_0x4be7('0x8')});}; \ No newline at end of file +var _0xaff9=['exports','define','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes'];(function(_0x4254a2,_0x263c50){var _0x36f1d8=function(_0xc93da6){while(--_0xc93da6){_0x4254a2['push'](_0x4254a2['shift']());}};_0x36f1d8(++_0x263c50);}(_0xaff9,0x1a8));var _0x9aff=function(_0x12ca59,_0x14a3ec){_0x12ca59=_0x12ca59-0x0;var _0x103d6a=_0xaff9[_0x12ca59];return _0x103d6a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9aff('0x0'))(_0x9aff('0x1'));var moment=require(_0x9aff('0x2'));var BPromise=require(_0x9aff('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9aff('0x4'));var rimraf=require(_0x9aff('0x5'));var config=require(_0x9aff('0x6'));var attributes=require(_0x9aff('0x7'));module[_0x9aff('0x8')]=function(_0x5ee8ef,_0x290ee3){return _0x5ee8ef[_0x9aff('0x9')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9aff('0xa'),'collate':_0x9aff('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 09959f3..fce7477 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 _0xac29=['then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','limit','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xac29,0x1b8));var _0x9ac2=function(_0x53c8c8,_0xac50c6){_0x53c8c8=_0x53c8c8-0x0;var _0x4cedcb=_0xac29[_0x53c8c8];return _0x4cedcb;};'use strict';var _=require(_0x9ac2('0x0'));var util=require(_0x9ac2('0x1'));var moment=require('moment');var BPromise=require(_0x9ac2('0x2'));var rs=require(_0x9ac2('0x3'));var fs=require('fs');var Redis=require(_0x9ac2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9ac2('0x5'))(_0x9ac2('0x6'));var config=require('../../config/environment');var jayson=require(_0x9ac2('0x7'));var client=jayson['client'][_0x9ac2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a0f7b,_0x38e73e,_0x24a9c8){return new BPromise(function(_0x426c71,_0xc73524){return client[_0x9ac2('0x9')](_0x4a0f7b,_0x24a9c8)[_0x9ac2('0xa')](function(_0x27aaaa){logger[_0x9ac2('0xb')](_0x9ac2('0xc'),_0x38e73e,_0x9ac2('0xd'));logger['debug'](_0x9ac2('0xe'),_0x38e73e,_0x9ac2('0xd'),JSON['stringify'](_0x27aaaa));if(_0x27aaaa[_0x9ac2('0xf')]){if(_0x27aaaa[_0x9ac2('0xf')][_0x9ac2('0x10')]===0x1f4){logger['error'](_0x9ac2('0xc'),_0x38e73e,_0x27aaaa[_0x9ac2('0xf')][_0x9ac2('0x11')]);return _0xc73524(_0x27aaaa[_0x9ac2('0xf')][_0x9ac2('0x11')]);}logger[_0x9ac2('0xf')](_0x9ac2('0xc'),_0x38e73e,_0x27aaaa[_0x9ac2('0xf')][_0x9ac2('0x11')]);return _0x426c71(_0x27aaaa[_0x9ac2('0xf')][_0x9ac2('0x11')]);}else{logger[_0x9ac2('0xb')](_0x9ac2('0xc'),_0x38e73e,_0x9ac2('0xd'));_0x426c71(_0x27aaaa[_0x9ac2('0x12')][_0x9ac2('0x11')]);}})[_0x9ac2('0x13')](function(_0x49c982){logger['error'](_0x9ac2('0xc'),_0x38e73e,_0x49c982);_0xc73524(_0x49c982);});});}exports[_0x9ac2('0x14')]=function(_0x5eac79){var _0x285044=this;return new Promise(function(_0x313eae,_0x51a731){return db[_0x9ac2('0x15')][_0x9ac2('0x16')](_0x5eac79[_0x9ac2('0x17')],{'raw':_0x5eac79[_0x9ac2('0x18')]?_0x5eac79[_0x9ac2('0x18')][_0x9ac2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eac79[_0x9ac2('0x18')]?_0x5eac79[_0x9ac2('0x18')][_0x9ac2('0x1a')]||null:null,'attributes':_0x5eac79[_0x9ac2('0x18')]?_0x5eac79['options']['attributes']||null:null,'limit':_0x5eac79[_0x9ac2('0x18')]?_0x5eac79[_0x9ac2('0x18')][_0x9ac2('0x1b')]||null:null})[_0x9ac2('0xa')](function(_0x1d3a7f){logger[_0x9ac2('0xb')](_0x9ac2('0x14'),_0x5eac79);logger[_0x9ac2('0x1c')]('UpdateFaxApplication',_0x5eac79,JSON[_0x9ac2('0x1d')](_0x1d3a7f));_0x313eae(_0x1d3a7f);})[_0x9ac2('0x13')](function(_0x5b4cac){logger[_0x9ac2('0xf')]('UpdateFaxApplication',_0x5b4cac[_0x9ac2('0x11')],_0x5eac79);_0x51a731(_0x285044[_0x9ac2('0xf')](0x1f4,_0x5b4cac['message']));});});}; \ No newline at end of file +var _0x5203=['message','result','catch','FaxApplication','body','options','limit','UpdateFaxApplication','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s'];(function(_0x8fd45e,_0x43687a){var _0x985847=function(_0x464b7a){while(--_0x464b7a){_0x8fd45e['push'](_0x8fd45e['shift']());}};_0x985847(++_0x43687a);}(_0x5203,0xd3));var _0x3520=function(_0x2ece5f,_0xf3c01d){_0x2ece5f=_0x2ece5f-0x0;var _0x5dd0f8=_0x5203[_0x2ece5f];return _0x5dd0f8;};'use strict';var _=require(_0x3520('0x0'));var util=require(_0x3520('0x1'));var moment=require(_0x3520('0x2'));var BPromise=require('bluebird');var rs=require(_0x3520('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3520('0x4'));var logger=require(_0x3520('0x5'))(_0x3520('0x6'));var config=require(_0x3520('0x7'));var jayson=require(_0x3520('0x8'));var client=jayson[_0x3520('0x9')][_0x3520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cb627,_0x298acd,_0x5ec2f1){return new BPromise(function(_0x3ad9e4,_0x336612){return client[_0x3520('0xb')](_0x4cb627,_0x5ec2f1)[_0x3520('0xc')](function(_0x3a7ca2){logger[_0x3520('0xd')]('FaxApplication,\x20%s,\x20%s',_0x298acd,_0x3520('0xe'));logger[_0x3520('0xf')](_0x3520('0x10'),_0x298acd,'request\x20sent',JSON[_0x3520('0x11')](_0x3a7ca2));if(_0x3a7ca2['error']){if(_0x3a7ca2[_0x3520('0x12')][_0x3520('0x13')]===0x1f4){logger[_0x3520('0x12')](_0x3520('0x14'),_0x298acd,_0x3a7ca2[_0x3520('0x12')][_0x3520('0x15')]);return _0x336612(_0x3a7ca2[_0x3520('0x12')]['message']);}logger[_0x3520('0x12')](_0x3520('0x14'),_0x298acd,_0x3a7ca2['error']['message']);return _0x3ad9e4(_0x3a7ca2['error'][_0x3520('0x15')]);}else{logger[_0x3520('0xd')](_0x3520('0x14'),_0x298acd,_0x3520('0xe'));_0x3ad9e4(_0x3a7ca2[_0x3520('0x16')][_0x3520('0x15')]);}})[_0x3520('0x17')](function(_0x5156b7){logger[_0x3520('0x12')](_0x3520('0x14'),_0x298acd,_0x5156b7);_0x336612(_0x5156b7);});});}exports['UpdateFaxApplication']=function(_0x122353){var _0x5b69e1=this;return new Promise(function(_0x6e6ec1,_0x5448b0){return db[_0x3520('0x18')]['update'](_0x122353[_0x3520('0x19')],{'raw':_0x122353[_0x3520('0x1a')]?_0x122353[_0x3520('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x122353[_0x3520('0x1a')]?_0x122353[_0x3520('0x1a')]['where']||null:null,'attributes':_0x122353[_0x3520('0x1a')]?_0x122353[_0x3520('0x1a')]['attributes']||null:null,'limit':_0x122353['options']?_0x122353[_0x3520('0x1a')][_0x3520('0x1b')]||null:null})[_0x3520('0xc')](function(_0x4fa581){logger[_0x3520('0xd')](_0x3520('0x1c'),_0x122353);logger[_0x3520('0xf')](_0x3520('0x1c'),_0x122353,JSON[_0x3520('0x11')](_0x4fa581));_0x6e6ec1(_0x4fa581);})[_0x3520('0x17')](function(_0x1a2f4e){logger[_0x3520('0x12')](_0x3520('0x1c'),_0x1a2f4e['message'],_0x122353);_0x5448b0(_0x5b69e1[_0x3520('0x12')](0x1f4,_0x1a2f4e[_0x3520('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index a150a9b..ed95624 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 _0x8603=['../../components/interaction/service','./faxApplication.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x1bcc92,_0x4929b8){var _0x88406a=function(_0x4670f8){while(--_0x4670f8){_0x1bcc92['push'](_0x1bcc92['shift']());}};_0x88406a(++_0x4929b8);}(_0x8603,0x190));var _0x3860=function(_0x59db37,_0x14464c){_0x59db37=_0x59db37-0x0;var _0x3a4d97=_0x8603[_0x59db37];return _0x3a4d97;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file +var _0x4cf8=['show','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated'];(function(_0x489c95,_0x53159c){var _0x10e7a7=function(_0xcb4342){while(--_0xcb4342){_0x489c95['push'](_0x489c95['shift']());}};_0x10e7a7(++_0x53159c);}(_0x4cf8,0x1e1));var _0x84cf=function(_0xbac1ec,_0x2f59dc){_0xbac1ec=_0xbac1ec-0x0;var _0x1d5ce9=_0x4cf8[_0xbac1ec];return _0x1d5ce9;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var fs_extra=require(_0x84cf('0x6'));var auth=require(_0x84cf('0x7'));var interaction=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var controller=require(_0x84cf('0xa'));router[_0x84cf('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x84cf('0xb')]('/:id',auth[_0x84cf('0xc')](),controller[_0x84cf('0xd')]);router['post']('/',auth[_0x84cf('0xc')](),controller[_0x84cf('0xe')]);router['put'](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x10')]);router[_0x84cf('0x11')]('/:id',auth[_0x84cf('0xc')](),controller[_0x84cf('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index d029bef..09d9d5a 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 _0x66d8=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x1cb8dc,_0x49404a){var _0x22d304=function(_0x497972){while(--_0x497972){_0x1cb8dc['push'](_0x1cb8dc['shift']());}};_0x22d304(++_0x49404a);}(_0x66d8,0x143));var _0x866d=function(_0x4b7a20,_0x470a22){_0x4b7a20=_0x4b7a20-0x0;var _0x302aa4=_0x66d8[_0x4b7a20];return _0x302aa4;};'use strict';var Sequelize=require(_0x866d('0x0'));module[_0x866d('0x1')]={'closed':{'type':Sequelize[_0x866d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x866d('0x3')]},'disposition':{'type':Sequelize[_0x866d('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x866d('0x4')]},'note':{'type':Sequelize[_0x866d('0x4')]},'read1stAt':{'type':Sequelize[_0x866d('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x866d('0x5')]('in',_0x866d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x866d('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x8bae=['ENUM','out','sequelize','exports','BOOLEAN','STRING'];(function(_0x2a8b21,_0x5cd96b){var _0x114314=function(_0xd17a7){while(--_0xd17a7){_0x2a8b21['push'](_0x2a8b21['shift']());}};_0x114314(++_0x5cd96b);}(_0x8bae,0x194));var _0xe8ba=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8bae[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0xe8ba('0x0'));module[_0xe8ba('0x1')]={'closed':{'type':Sequelize[_0xe8ba('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe8ba('0x3')]},'secondDisposition':{'type':Sequelize[_0xe8ba('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe8ba('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xe8ba('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe8ba('0x4')]('in',_0xe8ba('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe8ba('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 2a9cac7..1d87860 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 _0xefe5=['from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','length','conditions','find','unreadMessages','value','having','`\x20=\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','body','some','compact','isEmpty','FaxAccountId','concat','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','fields','includeAll','include','options','create','params','describe','addMessage','omit','ids','findOne','FaxMessage','pick','YYYY-MM-DD\x20HH:mm:ss','addTags','spread','findAll','removeTags','unix','join','server','files','tmp','attachments','format','transcript-%d-%s.zip','get','mkdirSync','Messages','Attachment','existsSync','createReadStream','pipe','createWriteStream','download','err','unlinkSync','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','FaxInteraction','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','select','field','color'];(function(_0xbc01d9,_0x54f788){var _0x59668b=function(_0x38a1d6){while(--_0x38a1d6){_0xbc01d9['push'](_0xbc01d9['shift']());}};_0x59668b(++_0x54f788);}(_0xefe5,0x175));var _0x5efe=function(_0x2e0646,_0x23ce05){_0x2e0646=_0x2e0646-0x0;var _0x32926c=_0xefe5[_0x2e0646];return _0x32926c;};'use strict';var emlformat=require(_0x5efe('0x0'));var rimraf=require(_0x5efe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5efe('0x2'));var rp=require('request-promise');var moment=require(_0x5efe('0x3'));var BPromise=require(_0x5efe('0x4'));var Mustache=require(_0x5efe('0x5'));var util=require(_0x5efe('0x6'));var path=require(_0x5efe('0x7'));var sox=require(_0x5efe('0x8'));var csv=require('to-csv');var ejs=require(_0x5efe('0x9'));var fs=require('fs');var fs_extra=require(_0x5efe('0xa'));var _=require(_0x5efe('0xb'));var squel=require('squel');var crypto=require(_0x5efe('0xc'));var jsforce=require(_0x5efe('0xd'));var deskjs=require(_0x5efe('0xe'));var toCsv=require(_0x5efe('0xf'));var querystring=require(_0x5efe('0x10'));var Papa=require(_0x5efe('0x11'));var Redis=require(_0x5efe('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5efe('0x13'));var as=require(_0x5efe('0x14'));var hardwareService=require(_0x5efe('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5efe('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5efe('0x17'))['db'];config['redis']=_[_0x5efe('0x18')](config['redis'],{'host':_0x5efe('0x19'),'port':0x18eb});var socket=require(_0x5efe('0x1a'))(new Redis(config[_0x5efe('0x1b')]));require(_0x5efe('0x1c'))[_0x5efe('0x1d')](socket);function respondWithStatusCode(_0x437029,_0x28730b){_0x28730b=_0x28730b||0xcc;return function(_0x612948){if(_0x612948){return _0x437029[_0x5efe('0x1e')](_0x28730b);}return _0x437029[_0x5efe('0x1f')](_0x28730b)[_0x5efe('0x20')]();};}function respondWithResult(_0x2964f0,_0x227ac9){_0x227ac9=_0x227ac9||0xc8;return function(_0x25c891){if(_0x25c891){return _0x2964f0['status'](_0x227ac9)[_0x5efe('0x21')](_0x25c891);}};}function respondWithFilteredResult(_0x3ae5f7,_0x32532d){return function(_0x51e383){if(_0x51e383){var _0x2c4df4=typeof _0x32532d['offset']===_0x5efe('0x22')&&typeof _0x32532d[_0x5efe('0x23')]===_0x5efe('0x22');var _0x3a95d4=_0x51e383[_0x5efe('0x24')];var _0x16ac58=_0x2c4df4?0x0:_0x32532d[_0x5efe('0x25')];var _0x50de2f=_0x2c4df4?_0x51e383[_0x5efe('0x24')]:_0x32532d[_0x5efe('0x25')]+_0x32532d['limit'];var _0x45824a;if(_0x50de2f>=_0x3a95d4){_0x50de2f=_0x3a95d4;_0x45824a=0xc8;}else{_0x45824a=0xce;}_0x3ae5f7[_0x5efe('0x1f')](_0x45824a);return _0x3ae5f7[_0x5efe('0x26')](_0x5efe('0x27'),_0x16ac58+'-'+_0x50de2f+'/'+_0x3a95d4)[_0x5efe('0x21')](_0x51e383);}return null;};}function patchUpdates(_0x31a53a){return function(_0x32c097){try{jsonpatch[_0x5efe('0x28')](_0x32c097,_0x31a53a,!![]);}catch(_0x59e172){return BPromise[_0x5efe('0x29')](_0x59e172);}return _0x32c097[_0x5efe('0x2a')]();};}function saveUpdates(_0xea10c3,_0x1955ea){return function(_0x1803d0){if(_0x1803d0){return _0x1803d0[_0x5efe('0x2b')](_0xea10c3)[_0x5efe('0x2c')](function(_0x187d21){return _0x187d21;});}return null;};}function removeEntity(_0x5c3b2d,_0x34a86b){return function(_0x5b7616){if(_0x5b7616){return _0x5b7616[_0x5efe('0x2d')]()[_0x5efe('0x2c')](function(){_0x5c3b2d[_0x5efe('0x1f')](0xcc)[_0x5efe('0x20')]();});}};}function handleEntityNotFound(_0x33a876,_0x4897b7){return function(_0x7cbc58){if(!_0x7cbc58){_0x33a876[_0x5efe('0x1e')](0x194);}return _0x7cbc58;};}function handleError(_0x1b10b4,_0x18ce86){_0x18ce86=_0x18ce86||0x1f4;return function(_0x26a2db){logger['error'](_0x26a2db[_0x5efe('0x2e')]);if(_0x26a2db['name']){delete _0x26a2db[_0x5efe('0x2f')];}_0x1b10b4[_0x5efe('0x1f')](_0x18ce86)[_0x5efe('0x30')](_0x26a2db);};}function getInteractionUsers(_0x1a393f,_0x179627){return new BPromise(function(_0x300958,_0x2338e1){try{if(_0x179627[_0x1a393f['id']]){_0x1a393f[_0x5efe('0x31')]=_[_0x5efe('0x32')](_0x179627[_0x1a393f['id']],function(_0x120ac2){return{'id':_0x120ac2['id'],'fullname':_0x120ac2[_0x5efe('0x33')]};});}}catch(_0x4f431e){_0x2338e1(_0x4f431e);}_0x300958(_0x1a393f);});}function getInteractionTags(_0x530b18,_0x163d26){return new BPromise(function(_0x4a25ea,_0x28386a){try{if(_0x530b18[_0x5efe('0x34')]){_0x530b18['Tags']=[];_0x530b18[_0x5efe('0x34')][_0x5efe('0x35')](',')[_0x5efe('0x36')](function(_0x1aa6f2){_0x530b18[_0x5efe('0x37')][_0x5efe('0x38')](_0x163d26[_0x1aa6f2]);});}delete _0x530b18['TagIds'];}catch(_0x2c3976){_0x28386a(_0x2c3976);}_0x4a25ea(_0x530b18);});}function updateFaxInteraction(_0x390718,_0xe8a529,_0x4c4ab2){return new BPromise(function(_0x3337ed,_0x4ec41a){return getInteractionUsers(_0x390718,_0x4c4ab2)['then'](function(_0x20f600){return getInteractionTags(_0x20f600,_0xe8a529);})[_0x5efe('0x2c')](function(_0x3ad37b){_0x3337ed(_0x3ad37b);})[_0x5efe('0x39')](function(_0x20980b){_0x4ec41a(_0x20980b);});});}exports['index']=function(_0x22a33f,_0x5704ec){var _0xfdfde1={},_0x3c03cc={},_0x196a0f={'count':0x0,'rows':[]};var _0x11dd9a=_[_0x5efe('0x32')](db[_0x5efe('0x3a')][_0x5efe('0x3b')],function(_0x165a18){return{'name':_0x165a18['fieldName'],'type':_0x165a18[_0x5efe('0x3c')][_0x5efe('0x3d')]};});_0x3c03cc[_0x5efe('0x3e')]=_[_0x5efe('0x32')](_0x11dd9a,_0x5efe('0x2f'));_0x3c03cc['query']=_[_0x5efe('0x3f')](_0x22a33f[_0x5efe('0x40')]);_0x3c03cc[_0x5efe('0x41')]=_['intersection'](_0x3c03cc[_0x5efe('0x3e')],_0x3c03cc['query']);_0xfdfde1[_0x5efe('0x42')]=_[_0x5efe('0x43')](_0x3c03cc['model'],qs['fields'](_0x22a33f[_0x5efe('0x40')]['fields']));_0xfdfde1[_0x5efe('0x42')]=_0xfdfde1[_0x5efe('0x42')]['length']?_0xfdfde1[_0x5efe('0x42')]:_0x3c03cc['model'];if(!_0x22a33f['query'][_0x5efe('0x44')](_0x5efe('0x45'))){_0xfdfde1['limit']=qs['limit'](_0x22a33f[_0x5efe('0x40')][_0x5efe('0x23')]);_0xfdfde1[_0x5efe('0x25')]=qs[_0x5efe('0x25')](_0x22a33f['query'][_0x5efe('0x25')]);}_0xfdfde1[_0x5efe('0x46')]=qs[_0x5efe('0x47')](_0x22a33f[_0x5efe('0x40')][_0x5efe('0x47')]);_0xfdfde1['where']=qs[_0x5efe('0x41')](_['pick'](_0x22a33f['query'],_0x3c03cc[_0x5efe('0x41')]),_0x11dd9a);var _0x7f7bc9=[];var _0x25d2e1=squel[_0x5efe('0x48')]()[_0x5efe('0x49')]('id')['field'](_0x5efe('0x2f'))[_0x5efe('0x49')](_0x5efe('0x4a'))[_0x5efe('0x4b')](_0x5efe('0x4c'));var _0x11e8b0=squel[_0x5efe('0x48')]()[_0x5efe('0x49')](_0x5efe('0x4d'))[_0x5efe('0x49')](_0x5efe('0x4e'))[_0x5efe('0x49')](_0x5efe('0x4f'))['from'](_0x5efe('0x50'),'ui')[_0x5efe('0x51')](_0x5efe('0x52'),'u',_0x5efe('0x53'));var _0x203b9e=squel['select']()[_0x5efe('0x4b')](_0x5efe('0x54'),'i')[_0x5efe('0x51')](_0x5efe('0x55'),'c',_0x5efe('0x56'))[_0x5efe('0x51')](_0x5efe('0x52'),'o',_0x5efe('0x57'))['left_join'](_0x5efe('0x58'),'a',_0x5efe('0x59'))[_0x5efe('0x51')](_0x5efe('0x5a'),'me',_0x5efe('0x5b'))[_0x5efe('0x51')](_0x5efe('0x5c'),'it',_0x5efe('0x5d'))[_0x5efe('0x51')](_0x5efe('0x4c'),'t','t.id\x20=\x20it.TagId');var _0x55b19e=squel['expr']();var _0x2b35b3=[];var _0x1db28c=squel[_0x5efe('0x5e')]();var _0x558137;if(_0x22a33f[_0x5efe('0x40')][_0x5efe('0x5f')]){_0x558137=as[_0x5efe('0x60')](_0x22a33f[_0x5efe('0x40')][_0x5efe('0x5f')]);var _0x38bfe9=_0x558137[_0x5efe('0x61')];for(var _0x2ebe71=0x0;_0x2ebe71<_0x558137['conditions'][_0x5efe('0x62')];_0x2ebe71++){var _0xe4f4bd=_0x558137[_0x5efe('0x63')][_0x2ebe71];var _0x251c3a='i';var _0x9d16a8=_[_0x5efe('0x64')](_0x11dd9a,['name',_0xe4f4bd[_0x5efe('0x49')]]);if(!_0x9d16a8){switch(_0xe4f4bd[_0x5efe('0x49')]){case _0x5efe('0x65'):if(_0xe4f4bd[_0x5efe('0x66')]==0x1){_0x203b9e[_0x5efe('0x67')]('`'+_0xe4f4bd[_0x5efe('0x49')]+_0x5efe('0x68'));}else{_0x203b9e[_0x5efe('0x67')]('`'+_0xe4f4bd[_0x5efe('0x49')]+'`\x20>\x200');}break;case'Contact':if(_0xe4f4bd[_0x5efe('0x69')]==='$substring'){if(_0xe4f4bd[_0x5efe('0x66')]['split']('\x20')[_0x5efe('0x62')]>0x1){_0x55b19e[_0x38bfe9](_0x5efe('0x6a'),qs[_0x5efe('0x6b')](_0xe4f4bd['value']),null);}else{var _0x21e539='%'+_0xe4f4bd['value']+'%';_0x55b19e[_0x38bfe9](_0x5efe('0x6c'),_0x21e539,_0x21e539,_0x21e539);}}else{_0x9d16a8=_['find'](_0x11dd9a,[_0x5efe('0x2f'),_0x5efe('0x6d')]);_0xe4f4bd[_0x5efe('0x49')]=_0x5efe('0x6d');_0xd4fc2e=as[_0x5efe('0x6e')](_0x251c3a,_0x9d16a8[_0x5efe('0x3c')],_0xe4f4bd);_0x55b19e[_0x38bfe9](_0xd4fc2e['text'],_0xd4fc2e[_0x5efe('0x66')]['start'],_0xd4fc2e[_0x5efe('0x66')][_0x5efe('0x20')]);}break;case _0x5efe('0x6f'):var _0x40981a=_0xe4f4bd['value'][_0x5efe('0x35')](',')[_0x5efe('0x32')](function(_0x1e7a19){return Number(_0x1e7a19);});_0x40981a[_0x5efe('0x36')](function(_0x25cb6f){_0x1db28c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x25cb6f+',%');});_0x2b35b3=_[_0x5efe('0x70')](_0x2b35b3,_0x40981a);break;case'User':if(_0xe4f4bd[_0x5efe('0x69')]===_0x5efe('0x71')){_0x55b19e[_0x38bfe9](_0x5efe('0x72'),'%'+_0xe4f4bd[_0x5efe('0x66')]+'%',null);}else{_0x9d16a8=_[_0x5efe('0x64')](_0x11dd9a,[_0x5efe('0x2f'),'UserId']);_0xe4f4bd[_0x5efe('0x49')]=_0x5efe('0x73');_0xd4fc2e=as[_0x5efe('0x6e')](_0x251c3a,_0x9d16a8['type'],_0xe4f4bd);_0x55b19e[_0x38bfe9](_0xd4fc2e[_0x5efe('0x74')],_0xd4fc2e['value'][_0x5efe('0x75')],_0xd4fc2e[_0x5efe('0x66')][_0x5efe('0x20')]);}break;case _0x5efe('0x76'):_0xd4fc2e=as['buildExpression']('me',null,_0xe4f4bd);_0x55b19e[_0x38bfe9](_0xd4fc2e[_0x5efe('0x74')],_0xd4fc2e[_0x5efe('0x66')][_0x5efe('0x75')],_0xd4fc2e[_0x5efe('0x66')][_0x5efe('0x20')]);break;}}else{var _0xd4fc2e=as['buildExpression'](_0x251c3a,_0x9d16a8[_0x5efe('0x3c')],_0xe4f4bd);_0x55b19e[_0x38bfe9](_0xd4fc2e[_0x5efe('0x74')],_0xd4fc2e['value']['start'],_0xd4fc2e[_0x5efe('0x66')]['end']);}}}else{var _0x577128=_(_0x22a33f[_0x5efe('0x40')])[_0x5efe('0x3f')]()[_0x5efe('0x32')](function(_0x1dfea5){return _[_0x5efe('0x77')](_0x11dd9a,[_0x5efe('0x2f'),_0x1dfea5])?_0x1dfea5:undefined;})[_0x5efe('0x78')]()[_0x5efe('0x66')]();if(!_[_0x5efe('0x79')](_0x577128)){_0x577128[_0x5efe('0x36')](function(_0x38372d){if(_0x38372d===_0x5efe('0x7a')){_0x203b9e['where']('i.FaxAccountId\x20IN\x20?',[][_0x5efe('0x7b')](_0x22a33f[_0x5efe('0x40')][_0x38372d]));}else if(_0x38372d===_0x5efe('0x7c')){var _0x3ed78d=JSON[_0x5efe('0x7d')](_0x22a33f[_0x5efe('0x40')][_0x38372d])[_0x5efe('0x7e')];var _0x5138c8=JSON['parse'](_0x22a33f[_0x5efe('0x40')][_0x38372d])[_0x5efe('0x7f')];_0x203b9e[_0x5efe('0x80')](_0x5efe('0x81'),_0x3ed78d,_0x5138c8);}else{if(_0x22a33f[_0x5efe('0x40')][_0x38372d]===_0x5efe('0x82')){_0x203b9e[_0x5efe('0x80')]('i.'+_0x38372d+_0x5efe('0x83'));}else{_0x203b9e[_0x5efe('0x80')]('i.'+_0x38372d+_0x5efe('0x84'),_0x22a33f[_0x5efe('0x40')][_0x38372d]);}}});}if(_0x22a33f['query'][_0x5efe('0x85')]){if(_0x22a33f[_0x5efe('0x40')][_0x5efe('0x85')]==0x1){_0x203b9e[_0x5efe('0x67')](_0x5efe('0x86'));}else{_0x203b9e[_0x5efe('0x67')](_0x5efe('0x87'));}}if(_0x22a33f[_0x5efe('0x40')][_0x5efe('0x88')]){_0x2b35b3=_[_0x5efe('0x89')](_0x22a33f['query'][_0x5efe('0x88')])?_0x22a33f[_0x5efe('0x40')][_0x5efe('0x88')]:new Array(_0x22a33f[_0x5efe('0x40')]['tag']);_0x2b35b3[_0x5efe('0x36')](function(_0x185eae){_0x1db28c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x185eae+',%');});}if(_0x22a33f['query'][_0x5efe('0x8a')]){var _0xf734f1=_0x22a33f[_0x5efe('0x40')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x5efe('0x8b')](_0xf734f1)){_0x55b19e['or'](_0x5efe('0x8c'),_0xf734f1+'%')['or'](_0x5efe('0x8d'),_0xf734f1+'%');}_0x55b19e['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xf734f1+'%');}}_0x203b9e['where'](_0x55b19e);_0x203b9e[_0x5efe('0x8e')](_0x5efe('0x8f'));var _0x1f574f={'type':db['Sequelize'][_0x5efe('0x90')][_0x5efe('0x91')],'raw':!![]};var _0x45b24d=_0x203b9e[_0x5efe('0x92')]();_0x45b24d[_0x5efe('0x49')]('i.id');_0x45b24d['field'](_0x5efe('0x93'),_0x5efe('0x65'));if(_0xfdfde1[_0x5efe('0x46')]){_0xfdfde1['order'][_0x5efe('0x36')](function(_0x365f69){var _0x377423=_0x365f69[0x0]===_0x5efe('0x94')?_0x365f69[0x0]:'i.'+_0x365f69[0x0];_0x203b9e[_0x5efe('0x46')](_0x377423,_0x365f69[0x1]===_0x5efe('0x95')?![]:!![]);});}if(!_['isEmpty'](_0x2b35b3)){_0x203b9e[_0x5efe('0x67')](_0x1db28c);_0x45b24d[_0x5efe('0x80')]('t.id\x20IN\x20?',_0x2b35b3);}BPromise['resolve']()[_0x5efe('0x2c')](function(){if(!_0x558137){if(_0x22a33f[_0x5efe('0x40')][_0x5efe('0x7a')])return;_0x45b24d[_0x5efe('0x80')](_0x5efe('0x96'));_0x203b9e[_0x5efe('0x80')](_0x5efe('0x96'));return;}if(_0x22a33f['user'][_0x5efe('0x97')]!==_0x5efe('0x98'))return;return _0x22a33f[_0x5efe('0x99')][_0x5efe('0x9a')]({'attributes':['id'],'raw':!![]})[_0x5efe('0x2c')](function(_0x5b6297){if(_[_0x5efe('0x79')](_0x5b6297)){_0x45b24d[_0x5efe('0x80')](_0x5efe('0x9b'));_0x203b9e[_0x5efe('0x80')](_0x5efe('0x9b'));}else{_0x45b24d[_0x5efe('0x80')](_0x5efe('0x9c'),_[_0x5efe('0x32')](_0x5b6297,'id'));_0x203b9e[_0x5efe('0x80')](_0x5efe('0x9c'),_[_0x5efe('0x32')](_0x5b6297,'id'));}});})['then'](function(){if(_0x22a33f[_0x5efe('0x99')][_0x5efe('0x97')]===_0x5efe('0x98')&&!_0x558137&&!_0x22a33f[_0x5efe('0x40')][_0x5efe('0x7a')])return[];return db['sequelize'][_0x5efe('0x40')](_0x45b24d[_0x5efe('0x9d')](),_0x1f574f);})[_0x5efe('0x2c')](function(_0x24012f){_0x196a0f[_0x5efe('0x24')]=_0x24012f['length'];if(_0x196a0f['count']===0x0)return[];return db[_0x5efe('0x9e')][_0x5efe('0x40')](_0x25d2e1['toString'](),_0x1f574f)['then'](function(_0x1cced9){_0x7f7bc9=_[_0x5efe('0x9f')](_0x1cced9,'id');_0x1f574f=_[_0x5efe('0xa0')](_0x1f574f,{'model':db[_0x5efe('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x22a33f[_0x5efe('0x40')]['fields']){_0xfdfde1[_0x5efe('0x42')]['forEach'](function(_0x5107af){_0x203b9e[_0x5efe('0x49')]('i.'+_0x5107af);});}else{_0x203b9e[_0x5efe('0x49')](_0x5efe('0x93'),_0x5efe('0x65'));_0x203b9e[_0x5efe('0x49')](_0x5efe('0xa1'),_0x5efe('0xa2'));_0x203b9e[_0x5efe('0x49')](_0x5efe('0xa3'),_0x5efe('0xa4'));_0x203b9e[_0x5efe('0x49')](_0x5efe('0xa5'),_0x5efe('0x94'));_0x203b9e[_0x5efe('0x49')](_0x5efe('0xa6'));_0x203b9e[_0x5efe('0x49')](_0x5efe('0xa7'),_0x5efe('0xa8'));_0x203b9e['field'](_0x5efe('0xa9'),_0x5efe('0xaa'));_0x203b9e[_0x5efe('0x49')](_0x5efe('0xab'),_0x5efe('0xac'));_0x203b9e[_0x5efe('0x49')](_0x5efe('0xad'),_0x5efe('0xae'));_0x203b9e[_0x5efe('0x49')](_0x5efe('0xaf'),_0x5efe('0xb0'));_0x203b9e[_0x5efe('0x49')](_0x5efe('0xb1'),_0x5efe('0xb2'));_0x203b9e[_0x5efe('0x49')](_0x5efe('0xb3'),'Owner.fullname');_0x203b9e[_0x5efe('0x49')]('o.internal','Owner.internal');_0x203b9e[_0x5efe('0x49')](_0x5efe('0xb4'),_0x5efe('0x34'));}if(_0xfdfde1[_0x5efe('0x23')])_0x203b9e['limit'](_0xfdfde1['limit']);if(_0xfdfde1[_0x5efe('0x25')])_0x203b9e['offset'](_0xfdfde1['offset']);return db[_0x5efe('0x9e')][_0x5efe('0x40')](_0x203b9e['toString'](),_0x1f574f);})[_0x5efe('0x2c')](function(_0x561226){if(_0x561226['length']>0x0)_0x11e8b0[_0x5efe('0x80')](_0x5efe('0xb5'),_[_0x5efe('0x32')](_0x561226,'id'));return db[_0x5efe('0x9e')][_0x5efe('0x40')](_0x11e8b0[_0x5efe('0x9d')](),_0x1f574f)['then'](function(_0x13b9d3){var _0x53840=_[_0x5efe('0xb6')](_0x13b9d3,_0x5efe('0xb7'));var _0x5e85ac=[];_0x561226['forEach'](function(_0x309ee0){_0x5e85ac['push'](updateFaxInteraction(_0x309ee0,_0x7f7bc9,_0x53840));});return BPromise[_0x5efe('0xb8')](_0x5e85ac);});});})[_0x5efe('0x2c')](function(_0xe9bf59){_0x196a0f[_0x5efe('0xb9')]=_0xe9bf59;return _0x196a0f;})['then'](respondWithFilteredResult(_0x5704ec,_0xfdfde1))[_0x5efe('0x39')](handleError(_0x5704ec,null));};exports[_0x5efe('0xba')]=function(_0x286e7c,_0x147fe3){var _0x4d8b83={'raw':![],'where':{'id':_0x286e7c['params']['id']}},_0x1b7550={};_0x1b7550[_0x5efe('0x3e')]=_[_0x5efe('0x3f')](db[_0x5efe('0x3a')][_0x5efe('0x3b')]);_0x1b7550[_0x5efe('0x40')]=_[_0x5efe('0x3f')](_0x286e7c['query']);_0x1b7550[_0x5efe('0x41')]=_[_0x5efe('0x43')](_0x1b7550['model'],_0x1b7550[_0x5efe('0x40')]);_0x4d8b83[_0x5efe('0x42')]=_[_0x5efe('0x43')](_0x1b7550[_0x5efe('0x3e')],qs['fields'](_0x286e7c[_0x5efe('0x40')][_0x5efe('0xbb')]));_0x4d8b83[_0x5efe('0x42')]=_0x4d8b83[_0x5efe('0x42')][_0x5efe('0x62')]?_0x4d8b83['attributes']:_0x1b7550['model'];if(_0x286e7c['query'][_0x5efe('0xbc')]){_0x4d8b83[_0x5efe('0xbd')]=[{'all':!![]}];}_0x4d8b83=_[_0x5efe('0xa0')]({},_0x4d8b83,_0x286e7c[_0x5efe('0xbe')]);return db[_0x5efe('0x3a')][_0x5efe('0x64')](_0x4d8b83)[_0x5efe('0x2c')](handleEntityNotFound(_0x147fe3,null))[_0x5efe('0x2c')](respondWithResult(_0x147fe3,null))['catch'](handleError(_0x147fe3,null));};exports[_0x5efe('0xbf')]=function(_0x1365af,_0x2a2bed){return db[_0x5efe('0x3a')][_0x5efe('0xbf')](_0x1365af[_0x5efe('0x76')],{})['then'](respondWithResult(_0x2a2bed,0xc9))[_0x5efe('0x39')](handleError(_0x2a2bed,null));};exports[_0x5efe('0x2b')]=function(_0x3fd173,_0x1bf12b){if(_0x3fd173['body']['id']){delete _0x3fd173[_0x5efe('0x76')]['id'];}return db[_0x5efe('0x3a')][_0x5efe('0x64')]({'where':{'id':_0x3fd173['params']['id']}})[_0x5efe('0x2c')](handleEntityNotFound(_0x1bf12b,null))[_0x5efe('0x2c')](saveUpdates(_0x3fd173['body'],null))[_0x5efe('0x2c')](respondWithResult(_0x1bf12b,null))[_0x5efe('0x39')](handleError(_0x1bf12b,null));};exports['destroy']=function(_0x491b0d,_0x48e4b9){return db[_0x5efe('0x3a')][_0x5efe('0x64')]({'where':{'id':_0x491b0d[_0x5efe('0xc0')]['id']}})['then'](handleEntityNotFound(_0x48e4b9,null))[_0x5efe('0x2c')](removeEntity(_0x48e4b9,null))[_0x5efe('0x39')](handleError(_0x48e4b9,null));};exports[_0x5efe('0xc1')]=function(_0x4bd51c,_0x198292){return db[_0x5efe('0x3a')][_0x5efe('0xc1')]()[_0x5efe('0x2c')](respondWithResult(_0x198292,null))[_0x5efe('0x39')](handleError(_0x198292,null));};exports[_0x5efe('0xc2')]=function(_0x4363bb,_0x25ca96,_0x3b4f79){return db['FaxMessage'][_0x5efe('0x64')]({'where':{'id':_0x4363bb['params']['id']}})[_0x5efe('0x2c')](handleEntityNotFound(_0x25ca96,null))[_0x5efe('0x2c')](function(_0x24928d){if(_0x24928d){return _0x24928d[_0x5efe('0xc2')](_0x4363bb[_0x5efe('0x76')]['ids'],_[_0x5efe('0xc3')](_0x4363bb[_0x5efe('0x76')],[_0x5efe('0xc4'),'id'])||{});}})['then'](respondWithResult(_0x25ca96,null))['catch'](handleError(_0x25ca96,null));};exports['getMessages']=function(_0x2a716c,_0x2e05d5,_0xb6ebe4){var _0x537efd={'raw':![],'where':{}};var _0x59976e={};var _0xd71f69={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x5efe('0xc5')]({'where':{'id':_0x2a716c[_0x5efe('0xc0')]['id']}})[_0x5efe('0x2c')](handleEntityNotFound(_0x2e05d5,null))[_0x5efe('0x2c')](function(_0x388f05){if(_0x388f05){_0x59976e[_0x5efe('0x3e')]=_['keys'](db[_0x5efe('0xc6')]['rawAttributes']);_0x59976e[_0x5efe('0x40')]=_['keys'](_0x2a716c[_0x5efe('0x40')]);_0x59976e[_0x5efe('0x41')]=_[_0x5efe('0x43')](_0x59976e[_0x5efe('0x3e')],_0x59976e[_0x5efe('0x40')]);_0x537efd[_0x5efe('0x42')]=_[_0x5efe('0x43')](_0x59976e[_0x5efe('0x3e')],qs[_0x5efe('0xbb')](_0x2a716c[_0x5efe('0x40')][_0x5efe('0xbb')]));_0x537efd[_0x5efe('0x42')]=_0x537efd[_0x5efe('0x42')][_0x5efe('0x62')]?_0x537efd[_0x5efe('0x42')]:_0x59976e[_0x5efe('0x3e')];if(!_0x2a716c[_0x5efe('0x40')]['hasOwnProperty'](_0x5efe('0x45'))){_0x537efd['limit']=qs[_0x5efe('0x23')](_0x2a716c[_0x5efe('0x40')]['limit']);_0x537efd[_0x5efe('0x25')]=qs['offset'](_0x2a716c[_0x5efe('0x40')]['offset']);}_0x537efd[_0x5efe('0x46')]=qs['sort'](_0x2a716c[_0x5efe('0x40')][_0x5efe('0x47')]);_0x537efd['where']=qs[_0x5efe('0x41')](_[_0x5efe('0xc7')](_0x2a716c['query'],_0x59976e[_0x5efe('0x41')]));_0x537efd[_0x5efe('0x80')][_0x5efe('0xb7')]=_0x388f05['id'];if(_0x2a716c[_0x5efe('0x40')][_0x5efe('0x8a')]){_0x537efd['where']=_[_0x5efe('0xa0')](_0x537efd['where'],{'$or':_[_0x5efe('0x32')](_0x537efd['attributes'],function(_0x9f9a58){var _0x56a76c={};_0x56a76c[_0x9f9a58]={'$like':'%'+_0x2a716c[_0x5efe('0x40')][_0x5efe('0x8a')]+'%'};return _0x56a76c;})});}if(_0x2a716c[_0x5efe('0x40')][_0x5efe('0x7e')]){var _0x19dddc=_0x2a716c[_0x5efe('0x40')][_0x5efe('0x7e')][_0x5efe('0x35')](',');var _0x3fec7f={};_0x3fec7f[_0x19dddc[0x0]]={'$gte':moment(_0x19dddc[0x1])['format'](_0x5efe('0xc8'))};_0x537efd[_0x5efe('0x80')]=_[_0x5efe('0xa0')](_0x537efd['where'],_0x3fec7f);}_0x537efd=_[_0x5efe('0xa0')]({},_0x537efd,_0x2a716c[_0x5efe('0xbe')]);return db['FaxMessage'][_0x5efe('0x24')]({'where':_0x537efd['where']})[_0x5efe('0x2c')](function(_0x2bb4d7){_0xd71f69[_0x5efe('0x24')]=_0x2bb4d7;if(_0x2a716c['query']['includeAll']){_0x537efd[_0x5efe('0xbd')]=[{'all':!![]}];}return db[_0x5efe('0xc6')]['findAll'](_0x537efd);})['then'](function(_0x94e5d5){_0xd71f69[_0x5efe('0xb9')]=_0x94e5d5;return _0xd71f69;});}})[_0x5efe('0x2c')](respondWithFilteredResult(_0x2e05d5,_0x537efd))[_0x5efe('0x39')](handleError(_0x2e05d5,null));};exports[_0x5efe('0xc9')]=function(_0x1afd41,_0x50230e,_0x238136){return db[_0x5efe('0x3a')][_0x5efe('0x64')]({'where':{'id':_0x1afd41[_0x5efe('0xc0')]['id']}})['then'](handleEntityNotFound(_0x50230e,null))[_0x5efe('0x2c')](function(_0x596124){if(_0x596124){return _0x596124['setTags'](_0x1afd41[_0x5efe('0x76')][_0x5efe('0xc4')],_['omit'](_0x1afd41[_0x5efe('0x76')],['ids','id'])||{})[_0x5efe('0xca')](function(){return db['Tag'][_0x5efe('0xcb')]({'attributes':['id',_0x5efe('0x2f'),_0x5efe('0x4a')],'where':{'id':_0x1afd41[_0x5efe('0x76')][_0x5efe('0xc4')]}});})['then'](function(_0x4866cd){socket['emit']('faxInteractionTags:save',{'id':Number(_0x1afd41[_0x5efe('0xc0')]['id']),'tags':_0x4866cd||[]});return{'id':Number(_0x1afd41[_0x5efe('0xc0')]['id']),'tags':_0x4866cd||[]};});}})['then'](respondWithResult(_0x50230e,null))[_0x5efe('0x39')](handleError(_0x50230e,null));};exports['removeTags']=function(_0xcfda4a,_0x54bd4f,_0x4b4fe8){return db[_0x5efe('0x3a')]['find']({'where':{'id':_0xcfda4a['params']['id']}})[_0x5efe('0x2c')](handleEntityNotFound(_0x54bd4f,null))[_0x5efe('0x2c')](function(_0x5e68de){if(_0x5e68de){return _0x5e68de[_0x5efe('0xcc')](_0xcfda4a[_0x5efe('0x40')]['ids']);}})[_0x5efe('0x2c')](respondWithStatusCode(_0x54bd4f,null))[_0x5efe('0x39')](handleError(_0x54bd4f,null));};exports['download']=function(_0x366086,_0x19e5e7){var _0x2b6d18=moment()[_0x5efe('0xcd')]()[_0x5efe('0x9d')]();var _0x3cadd8=path[_0x5efe('0xce')](config['root'],_0x5efe('0xcf'),_0x5efe('0xd0'),_0x5efe('0xd1'));var _0x5d980b=path[_0x5efe('0xce')](config['root'],'server','files',_0x5efe('0xd2'));var _0x45c0d6=path[_0x5efe('0xce')](_0x3cadd8,_0x2b6d18);var _0x179c96=util[_0x5efe('0xd3')](_0x5efe('0xd4'),_0x366086['params']['id'],_0x2b6d18);var _0x4c8f2b=path[_0x5efe('0xce')](_0x3cadd8,_0x179c96);var _0x139594=[];_0x139594[_0x5efe('0x38')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x41d835=[{'model':db[_0x5efe('0xc6')],'as':'Messages','attributes':['id',_0x5efe('0x76'),_0x5efe('0x7c')],'include':_0x139594}];return db[_0x5efe('0x3a')]['find']({'where':{'id':_0x366086[_0x5efe('0xc0')]['id']},'include':_0x41d835})[_0x5efe('0x2c')](handleEntityNotFound(_0x19e5e7,null))['then'](function(_0x38037c){if(_0x38037c&&_0x38037c['Messages']){var _0x49b8bb=_0x38037c[_0x5efe('0xd5')]({'plain':!![]});fs[_0x5efe('0xd6')](_0x45c0d6);for(var _0x2359fd=0x0;_0x2359fd<_0x49b8bb[_0x5efe('0xd7')][_0x5efe('0x62')];_0x2359fd++){var _0x3e7a20=_0x49b8bb[_0x5efe('0xd7')][_0x2359fd][_0x5efe('0xd8')];if(_0x3e7a20){var _0x269514=path[_0x5efe('0xce')](_0x5d980b,_0x3e7a20['basename']);if(fs[_0x5efe('0xd9')](_0x269514)){fs[_0x5efe('0xda')](_0x269514)[_0x5efe('0xdb')](fs[_0x5efe('0xdc')](path[_0x5efe('0xce')](_0x45c0d6,_0x3e7a20['basename'])));}}}return BPromise['resolve']()[_0x5efe('0x2c')](function(){return new BPromise(function(_0xd68354,_0x4cfded){zipdir(_0x45c0d6,{'saveTo':_0x4c8f2b},function(_0x134615,_0xfc3ce0){if(_0x134615)return _0x4cfded(_0x134615);return _0xd68354(_0xfc3ce0);});})[_0x5efe('0x2c')](function(){return new BPromise(function(_0x13beb3,_0x524e28){rimraf(_0x45c0d6,function(_0x328c74){if(_0x328c74)_0x524e28(_0x328c74);return _0x13beb3();});});})[_0x5efe('0x2c')](function(){return _0x19e5e7[_0x5efe('0xdd')](_0x4c8f2b,_0x179c96,function(_0x48e33e){if(_0x48e33e){console['log'](_0x5efe('0xde'),_0x48e33e);}else{fs[_0x5efe('0xdf')](_0x4c8f2b);}});});});}else{return _0x19e5e7[_0x5efe('0x1e')](0xc8);}})['catch'](handleError(_0x19e5e7,null));}; \ No newline at end of file +var _0x165f=['Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','start','some','where','i.FaxAccountId\x20IN\x20?','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','FaxAccountId','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','toString','merge','FaxInteraction','unreadMessages','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','includeAll','include','options','catch','create','params','describe','FaxMessage','addMessage','ids','omit','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','spread','emit','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','createdAt','Messages','get','mkdirSync','createReadStream','createWriteStream','resolve','download','log','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','split','push','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','select','field','color','from','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text'];(function(_0x18500b,_0x59d002){var _0x39ee1a=function(_0x3c9603){while(--_0x3c9603){_0x18500b['push'](_0x18500b['shift']());}};_0x39ee1a(++_0x59d002);}(_0x165f,0x69));var _0xf165=function(_0x3b676e,_0x566438){_0x3b676e=_0x3b676e-0x0;var _0x3182b5=_0x165f[_0x3b676e];return _0x3182b5;};'use strict';var emlformat=require(_0xf165('0x0'));var rimraf=require(_0xf165('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf165('0x2'));var rp=require(_0xf165('0x3'));var moment=require(_0xf165('0x4'));var BPromise=require(_0xf165('0x5'));var Mustache=require(_0xf165('0x6'));var util=require(_0xf165('0x7'));var path=require(_0xf165('0x8'));var sox=require(_0xf165('0x9'));var csv=require(_0xf165('0xa'));var ejs=require(_0xf165('0xb'));var fs=require('fs');var fs_extra=require(_0xf165('0xc'));var _=require(_0xf165('0xd'));var squel=require(_0xf165('0xe'));var crypto=require(_0xf165('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf165('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf165('0x11'));var Papa=require('papaparse');var Redis=require(_0xf165('0x12'));var authService=require(_0xf165('0x13'));var qs=require(_0xf165('0x14'));var as=require(_0xf165('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf165('0x16'))(_0xf165('0x17'));var utils=require('../../config/utils');var config=require(_0xf165('0x18'));var licenseUtil=require(_0xf165('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf165('0x1a')](config[_0xf165('0x1b')],{'host':_0xf165('0x1c'),'port':0x18eb});var socket=require(_0xf165('0x1d'))(new Redis(config[_0xf165('0x1b')]));require(_0xf165('0x1e'))['register'](socket);function respondWithStatusCode(_0x577edf,_0x22b8d2){_0x22b8d2=_0x22b8d2||0xcc;return function(_0x524c68){if(_0x524c68){return _0x577edf[_0xf165('0x1f')](_0x22b8d2);}return _0x577edf['status'](_0x22b8d2)[_0xf165('0x20')]();};}function respondWithResult(_0x563e57,_0x16d885){_0x16d885=_0x16d885||0xc8;return function(_0x16049e){if(_0x16049e){return _0x563e57[_0xf165('0x21')](_0x16d885)[_0xf165('0x22')](_0x16049e);}};}function respondWithFilteredResult(_0x43f9df,_0x16d395){return function(_0x4aa640){if(_0x4aa640){var _0x34ad7b=typeof _0x16d395[_0xf165('0x23')]===_0xf165('0x24')&&typeof _0x16d395[_0xf165('0x25')]===_0xf165('0x24');var _0x3848b8=_0x4aa640[_0xf165('0x26')];var _0xd7f83d=_0x34ad7b?0x0:_0x16d395[_0xf165('0x23')];var _0x3a1daf=_0x34ad7b?_0x4aa640[_0xf165('0x26')]:_0x16d395[_0xf165('0x23')]+_0x16d395['limit'];var _0x10521f;if(_0x3a1daf>=_0x3848b8){_0x3a1daf=_0x3848b8;_0x10521f=0xc8;}else{_0x10521f=0xce;}_0x43f9df['status'](_0x10521f);return _0x43f9df[_0xf165('0x27')](_0xf165('0x28'),_0xd7f83d+'-'+_0x3a1daf+'/'+_0x3848b8)['json'](_0x4aa640);}return null;};}function patchUpdates(_0x4546d2){return function(_0x255802){try{jsonpatch[_0xf165('0x29')](_0x255802,_0x4546d2,!![]);}catch(_0x44598d){return BPromise[_0xf165('0x2a')](_0x44598d);}return _0x255802[_0xf165('0x2b')]();};}function saveUpdates(_0x4a0976,_0x268e56){return function(_0x5a0d93){if(_0x5a0d93){return _0x5a0d93[_0xf165('0x2c')](_0x4a0976)[_0xf165('0x2d')](function(_0x4db609){return _0x4db609;});}return null;};}function removeEntity(_0x5f2b0c,_0x56dee9){return function(_0x34a2f7){if(_0x34a2f7){return _0x34a2f7[_0xf165('0x2e')]()[_0xf165('0x2d')](function(){_0x5f2b0c[_0xf165('0x21')](0xcc)[_0xf165('0x20')]();});}};}function handleEntityNotFound(_0x59a6b5,_0x5cb30f){return function(_0x233dc9){if(!_0x233dc9){_0x59a6b5[_0xf165('0x1f')](0x194);}return _0x233dc9;};}function handleError(_0x16cbad,_0x3ceb2a){_0x3ceb2a=_0x3ceb2a||0x1f4;return function(_0x4f851b){logger[_0xf165('0x2f')](_0x4f851b[_0xf165('0x30')]);if(_0x4f851b[_0xf165('0x31')]){delete _0x4f851b[_0xf165('0x31')];}_0x16cbad['status'](_0x3ceb2a)[_0xf165('0x32')](_0x4f851b);};}function getInteractionUsers(_0xd0994c,_0x3b9569){return new BPromise(function(_0x154192,_0x4d609e){try{if(_0x3b9569[_0xd0994c['id']]){_0xd0994c[_0xf165('0x33')]=_[_0xf165('0x34')](_0x3b9569[_0xd0994c['id']],function(_0x5e9d7b){return{'id':_0x5e9d7b['id'],'fullname':_0x5e9d7b['fullname']};});}}catch(_0x3761fb){_0x4d609e(_0x3761fb);}_0x154192(_0xd0994c);});}function getInteractionTags(_0x1e9025,_0x37bd0e){return new BPromise(function(_0x5a1261,_0x45fc2b){try{if(_0x1e9025[_0xf165('0x35')]){_0x1e9025[_0xf165('0x36')]=[];_0x1e9025[_0xf165('0x35')][_0xf165('0x37')](',')['forEach'](function(_0x387631){_0x1e9025['Tags'][_0xf165('0x38')](_0x37bd0e[_0x387631]);});}delete _0x1e9025[_0xf165('0x35')];}catch(_0x49e97d){_0x45fc2b(_0x49e97d);}_0x5a1261(_0x1e9025);});}function updateFaxInteraction(_0x35d623,_0x2aabc9,_0x445177){return new BPromise(function(_0x131d0d,_0x45f281){return getInteractionUsers(_0x35d623,_0x445177)[_0xf165('0x2d')](function(_0x3e85b8){return getInteractionTags(_0x3e85b8,_0x2aabc9);})[_0xf165('0x2d')](function(_0x144d49){_0x131d0d(_0x144d49);})['catch'](function(_0x783bd9){_0x45f281(_0x783bd9);});});}exports[_0xf165('0x39')]=function(_0x60eef0,_0x53c6a0){var _0x5da899={},_0x432855={},_0x16fa4c={'count':0x0,'rows':[]};var _0x1d2bc7=_[_0xf165('0x34')](db['FaxInteraction'][_0xf165('0x3a')],function(_0x14cca2){return{'name':_0x14cca2[_0xf165('0x3b')],'type':_0x14cca2[_0xf165('0x3c')][_0xf165('0x3d')]};});_0x432855[_0xf165('0x3e')]=_[_0xf165('0x34')](_0x1d2bc7,'name');_0x432855[_0xf165('0x3f')]=_[_0xf165('0x40')](_0x60eef0[_0xf165('0x3f')]);_0x432855['filters']=_[_0xf165('0x41')](_0x432855[_0xf165('0x3e')],_0x432855[_0xf165('0x3f')]);_0x5da899[_0xf165('0x42')]=_['intersection'](_0x432855[_0xf165('0x3e')],qs[_0xf165('0x43')](_0x60eef0[_0xf165('0x3f')][_0xf165('0x43')]));_0x5da899[_0xf165('0x42')]=_0x5da899[_0xf165('0x42')][_0xf165('0x44')]?_0x5da899[_0xf165('0x42')]:_0x432855['model'];if(!_0x60eef0['query'][_0xf165('0x45')](_0xf165('0x46'))){_0x5da899[_0xf165('0x25')]=qs[_0xf165('0x25')](_0x60eef0[_0xf165('0x3f')][_0xf165('0x25')]);_0x5da899[_0xf165('0x23')]=qs[_0xf165('0x23')](_0x60eef0[_0xf165('0x3f')][_0xf165('0x23')]);}_0x5da899['order']=qs[_0xf165('0x47')](_0x60eef0[_0xf165('0x3f')]['sort']);_0x5da899['where']=qs['filters'](_[_0xf165('0x48')](_0x60eef0[_0xf165('0x3f')],_0x432855[_0xf165('0x49')]),_0x1d2bc7);var _0x181d43=[];var _0x3507e3=squel[_0xf165('0x4a')]()[_0xf165('0x4b')]('id')[_0xf165('0x4b')]('name')['field'](_0xf165('0x4c'))[_0xf165('0x4d')]('tools_tags');var _0x18f073=squel[_0xf165('0x4a')]()[_0xf165('0x4b')]('u.id')['field'](_0xf165('0x4e'))['field'](_0xf165('0x4f'))[_0xf165('0x4d')](_0xf165('0x50'),'ui')[_0xf165('0x51')](_0xf165('0x52'),'u',_0xf165('0x53'));var _0x3692f9=squel[_0xf165('0x4a')]()['from'](_0xf165('0x54'),'i')[_0xf165('0x51')](_0xf165('0x55'),'c',_0xf165('0x56'))[_0xf165('0x51')]('users','o',_0xf165('0x57'))['left_join'](_0xf165('0x58'),'a',_0xf165('0x59'))[_0xf165('0x51')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')[_0xf165('0x51')](_0xf165('0x5a'),'it',_0xf165('0x5b'))[_0xf165('0x51')](_0xf165('0x5c'),'t',_0xf165('0x5d'));var _0x45ea6b=squel[_0xf165('0x5e')]();var _0xad9140=[];var _0x302d71=squel[_0xf165('0x5e')]();var _0x213684;if(_0x60eef0['query']['search']){_0x213684=as['parseSearch'](_0x60eef0[_0xf165('0x3f')][_0xf165('0x5f')]);var _0x103008=_0x213684[_0xf165('0x60')];for(var _0x26fd9b=0x0;_0x26fd9b<_0x213684['conditions'][_0xf165('0x44')];_0x26fd9b++){var _0x134e6a=_0x213684[_0xf165('0x61')][_0x26fd9b];var _0x247b6e='i';var _0x298410=_[_0xf165('0x62')](_0x1d2bc7,['name',_0x134e6a[_0xf165('0x4b')]]);if(!_0x298410){switch(_0x134e6a[_0xf165('0x4b')]){case'unreadMessages':if(_0x134e6a[_0xf165('0x63')]==0x1){_0x3692f9[_0xf165('0x64')]('`'+_0x134e6a['field']+'`\x20=\x200');}else{_0x3692f9[_0xf165('0x64')]('`'+_0x134e6a[_0xf165('0x4b')]+_0xf165('0x65'));}break;case _0xf165('0x66'):if(_0x134e6a[_0xf165('0x67')]===_0xf165('0x68')){if(_0x134e6a['value']['split']('\x20')[_0xf165('0x44')]>0x1){_0x45ea6b[_0x103008](_0xf165('0x69'),qs[_0xf165('0x6a')](_0x134e6a[_0xf165('0x63')]),null);}else{var _0x4a4d29='%'+_0x134e6a[_0xf165('0x63')]+'%';_0x45ea6b[_0x103008]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4a4d29,_0x4a4d29,_0x4a4d29);}}else{_0x298410=_[_0xf165('0x62')](_0x1d2bc7,['name',_0xf165('0x6b')]);_0x134e6a[_0xf165('0x4b')]=_0xf165('0x6b');_0x53a053=as[_0xf165('0x6c')](_0x247b6e,_0x298410['type'],_0x134e6a);_0x45ea6b[_0x103008](_0x53a053[_0xf165('0x6d')],_0x53a053[_0xf165('0x63')]['start'],_0x53a053[_0xf165('0x63')][_0xf165('0x20')]);}break;case _0xf165('0x6e'):var _0x3f0c31=_0x134e6a['value'][_0xf165('0x37')](',')[_0xf165('0x34')](function(_0x43e362){return Number(_0x43e362);});_0x3f0c31[_0xf165('0x6f')](function(_0x302690){_0x302d71['or'](_0xf165('0x70'),'%,'+_0x302690+',%');});_0xad9140=_[_0xf165('0x71')](_0xad9140,_0x3f0c31);break;case _0xf165('0x72'):if(_0x134e6a['operator']===_0xf165('0x68')){_0x45ea6b[_0x103008](_0xf165('0x73'),'%'+_0x134e6a[_0xf165('0x63')]+'%',null);}else{_0x298410=_['find'](_0x1d2bc7,['name',_0xf165('0x74')]);_0x134e6a[_0xf165('0x4b')]='UserId';_0x53a053=as[_0xf165('0x6c')](_0x247b6e,_0x298410[_0xf165('0x3c')],_0x134e6a);_0x45ea6b[_0x103008](_0x53a053[_0xf165('0x6d')],_0x53a053[_0xf165('0x63')]['start'],_0x53a053['value'][_0xf165('0x20')]);}break;case _0xf165('0x75'):_0x53a053=as['buildExpression']('me',null,_0x134e6a);_0x45ea6b[_0x103008](_0x53a053['text'],_0x53a053[_0xf165('0x63')][_0xf165('0x76')],_0x53a053[_0xf165('0x63')]['end']);break;}}else{var _0x53a053=as[_0xf165('0x6c')](_0x247b6e,_0x298410['type'],_0x134e6a);_0x45ea6b[_0x103008](_0x53a053[_0xf165('0x6d')],_0x53a053['value'][_0xf165('0x76')],_0x53a053[_0xf165('0x63')][_0xf165('0x20')]);}}}else{var _0x326108=_(_0x60eef0['query'])[_0xf165('0x40')]()[_0xf165('0x34')](function(_0x2b8c75){return _[_0xf165('0x77')](_0x1d2bc7,[_0xf165('0x31'),_0x2b8c75])?_0x2b8c75:undefined;})['compact']()[_0xf165('0x63')]();if(!_['isEmpty'](_0x326108)){_0x326108[_0xf165('0x6f')](function(_0x57c5b7){if(_0x57c5b7==='FaxAccountId'){_0x3692f9[_0xf165('0x78')](_0xf165('0x79'),[]['concat'](_0x60eef0[_0xf165('0x3f')][_0x57c5b7]));}else if(_0x57c5b7==='createdAt'){var _0x552531=JSON[_0xf165('0x7a')](_0x60eef0[_0xf165('0x3f')][_0x57c5b7])['$gte'];var _0x42f6d8=JSON['parse'](_0x60eef0[_0xf165('0x3f')][_0x57c5b7])['$lte'];_0x3692f9[_0xf165('0x78')](_0xf165('0x7b'),_0x552531,_0x42f6d8);}else{if(_0x60eef0['query'][_0x57c5b7]===_0xf165('0x7c')){_0x3692f9[_0xf165('0x78')]('i.'+_0x57c5b7+_0xf165('0x7d'));}else{_0x3692f9[_0xf165('0x78')]('i.'+_0x57c5b7+_0xf165('0x7e'),_0x60eef0[_0xf165('0x3f')][_0x57c5b7]);}}});}if(_0x60eef0['query'][_0xf165('0x7f')]){if(_0x60eef0[_0xf165('0x3f')][_0xf165('0x7f')]==0x1){_0x3692f9['having'](_0xf165('0x80'));}else{_0x3692f9[_0xf165('0x64')](_0xf165('0x81'));}}if(_0x60eef0[_0xf165('0x3f')][_0xf165('0x82')]){_0xad9140=_[_0xf165('0x83')](_0x60eef0[_0xf165('0x3f')][_0xf165('0x82')])?_0x60eef0['query'][_0xf165('0x82')]:new Array(_0x60eef0[_0xf165('0x3f')][_0xf165('0x82')]);_0xad9140[_0xf165('0x6f')](function(_0x115b4b){_0x302d71['or'](_0xf165('0x70'),'%,'+_0x115b4b+',%');});}if(_0x60eef0[_0xf165('0x3f')][_0xf165('0x84')]){var _0x22cae0=_0x60eef0[_0xf165('0x3f')][_0xf165('0x84')][_0xf165('0x85')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x22cae0)){_0x45ea6b['or'](_0xf165('0x86'),_0x22cae0+'%')['or']('i.fax\x20LIKE\x20?',_0x22cae0+'%');}_0x45ea6b['or'](_0xf165('0x87'),_0x22cae0+'%');}}_0x3692f9[_0xf165('0x78')](_0x45ea6b);_0x3692f9[_0xf165('0x88')]('i.id');var _0x3281a3={'type':db['Sequelize']['QueryTypes'][_0xf165('0x89')],'raw':!![]};var _0xe6b6cd=_0x3692f9[_0xf165('0x8a')]();_0xe6b6cd[_0xf165('0x4b')](_0xf165('0x8b'));_0xe6b6cd[_0xf165('0x4b')](_0xf165('0x8c'),'unreadMessages');if(_0x5da899['order']){_0x5da899[_0xf165('0x8d')][_0xf165('0x6f')](function(_0x4eb0d7){var _0x8b99c4=_0x4eb0d7[0x0]===_0xf165('0x8e')?_0x4eb0d7[0x0]:'i.'+_0x4eb0d7[0x0];_0x3692f9[_0xf165('0x8d')](_0x8b99c4,_0x4eb0d7[0x1]===_0xf165('0x8f')?![]:!![]);});}if(!_[_0xf165('0x90')](_0xad9140)){_0x3692f9[_0xf165('0x64')](_0x302d71);_0xe6b6cd[_0xf165('0x78')](_0xf165('0x91'),_0xad9140);}BPromise['resolve']()[_0xf165('0x2d')](function(){if(!_0x213684){if(_0x60eef0['query'][_0xf165('0x92')])return;_0xe6b6cd['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x3692f9['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x60eef0[_0xf165('0x93')][_0xf165('0x94')]!=='agent')return;return _0x60eef0['user'][_0xf165('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5357f4){if(_[_0xf165('0x90')](_0x5357f4)){_0xe6b6cd[_0xf165('0x78')](_0xf165('0x96'));_0x3692f9[_0xf165('0x78')](_0xf165('0x96'));}else{_0xe6b6cd[_0xf165('0x78')](_0xf165('0x79'),_[_0xf165('0x34')](_0x5357f4,'id'));_0x3692f9[_0xf165('0x78')](_0xf165('0x79'),_[_0xf165('0x34')](_0x5357f4,'id'));}});})['then'](function(){if(_0x60eef0['user'][_0xf165('0x94')]===_0xf165('0x97')&&!_0x213684&&!_0x60eef0['query'][_0xf165('0x92')])return[];return db['sequelize'][_0xf165('0x3f')](_0xe6b6cd['toString'](),_0x3281a3);})[_0xf165('0x2d')](function(_0x16cf25){_0x16fa4c['count']=_0x16cf25['length'];if(_0x16fa4c[_0xf165('0x26')]===0x0)return[];return db[_0xf165('0x98')][_0xf165('0x3f')](_0x3507e3[_0xf165('0x99')](),_0x3281a3)[_0xf165('0x2d')](function(_0x59f833){_0x181d43=_['keyBy'](_0x59f833,'id');_0x3281a3=_[_0xf165('0x9a')](_0x3281a3,{'model':db[_0xf165('0x9b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x60eef0[_0xf165('0x3f')][_0xf165('0x43')]){_0x5da899[_0xf165('0x42')]['forEach'](function(_0x4e66fb){_0x3692f9[_0xf165('0x4b')]('i.'+_0x4e66fb);});}else{_0x3692f9[_0xf165('0x4b')](_0xf165('0x8c'),_0xf165('0x9c'));_0x3692f9[_0xf165('0x4b')](_0xf165('0x9d'),'Account.key');_0x3692f9[_0xf165('0x4b')](_0xf165('0x9e'),_0xf165('0x9f'));_0x3692f9[_0xf165('0x4b')]('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',_0xf165('0x8e'));_0x3692f9['field'](_0xf165('0xa0'));_0x3692f9[_0xf165('0x4b')](_0xf165('0xa1'),_0xf165('0xa2'));_0x3692f9[_0xf165('0x4b')](_0xf165('0xa3'),_0xf165('0xa4'));_0x3692f9[_0xf165('0x4b')]('c.email',_0xf165('0xa5'));_0x3692f9[_0xf165('0x4b')]('c.phone',_0xf165('0xa6'));_0x3692f9[_0xf165('0x4b')](_0xf165('0xa7'),_0xf165('0xa8'));_0x3692f9[_0xf165('0x4b')]('c.fax',_0xf165('0xa9'));_0x3692f9['field']('o.fullname',_0xf165('0xaa'));_0x3692f9[_0xf165('0x4b')]('o.internal',_0xf165('0xab'));_0x3692f9['field'](_0xf165('0xac'),'TagIds');}if(_0x5da899[_0xf165('0x25')])_0x3692f9[_0xf165('0x25')](_0x5da899[_0xf165('0x25')]);if(_0x5da899[_0xf165('0x23')])_0x3692f9['offset'](_0x5da899[_0xf165('0x23')]);return db[_0xf165('0x98')]['query'](_0x3692f9[_0xf165('0x99')](),_0x3281a3);})[_0xf165('0x2d')](function(_0x525f92){if(_0x525f92['length']>0x0)_0x18f073['where'](_0xf165('0xad'),_[_0xf165('0x34')](_0x525f92,'id'));return db[_0xf165('0x98')][_0xf165('0x3f')](_0x18f073['toString'](),_0x3281a3)['then'](function(_0x1ffc6d){var _0x586a98=_[_0xf165('0xae')](_0x1ffc6d,_0xf165('0xaf'));var _0x32dc38=[];_0x525f92[_0xf165('0x6f')](function(_0x1ef1ea){_0x32dc38[_0xf165('0x38')](updateFaxInteraction(_0x1ef1ea,_0x181d43,_0x586a98));});return BPromise[_0xf165('0xb0')](_0x32dc38);});});})['then'](function(_0x2dca41){_0x16fa4c['rows']=_0x2dca41;return _0x16fa4c;})[_0xf165('0x2d')](respondWithFilteredResult(_0x53c6a0,_0x5da899))['catch'](handleError(_0x53c6a0,null));};exports['show']=function(_0x1b3966,_0x5d3289){var _0x14720e={'raw':![],'where':{'id':_0x1b3966['params']['id']}},_0x38b805={};_0x38b805['model']=_[_0xf165('0x40')](db['FaxInteraction'][_0xf165('0x3a')]);_0x38b805[_0xf165('0x3f')]=_[_0xf165('0x40')](_0x1b3966['query']);_0x38b805[_0xf165('0x49')]=_[_0xf165('0x41')](_0x38b805['model'],_0x38b805[_0xf165('0x3f')]);_0x14720e[_0xf165('0x42')]=_[_0xf165('0x41')](_0x38b805[_0xf165('0x3e')],qs['fields'](_0x1b3966[_0xf165('0x3f')][_0xf165('0x43')]));_0x14720e[_0xf165('0x42')]=_0x14720e[_0xf165('0x42')]['length']?_0x14720e[_0xf165('0x42')]:_0x38b805[_0xf165('0x3e')];if(_0x1b3966['query'][_0xf165('0xb1')]){_0x14720e[_0xf165('0xb2')]=[{'all':!![]}];}_0x14720e=_['merge']({},_0x14720e,_0x1b3966[_0xf165('0xb3')]);return db[_0xf165('0x9b')][_0xf165('0x62')](_0x14720e)['then'](handleEntityNotFound(_0x5d3289,null))['then'](respondWithResult(_0x5d3289,null))[_0xf165('0xb4')](handleError(_0x5d3289,null));};exports['create']=function(_0xd30935,_0x4fa887){return db[_0xf165('0x9b')][_0xf165('0xb5')](_0xd30935[_0xf165('0x75')],{})[_0xf165('0x2d')](respondWithResult(_0x4fa887,0xc9))[_0xf165('0xb4')](handleError(_0x4fa887,null));};exports[_0xf165('0x2c')]=function(_0x566bc5,_0x51e650){if(_0x566bc5[_0xf165('0x75')]['id']){delete _0x566bc5['body']['id'];}return db[_0xf165('0x9b')][_0xf165('0x62')]({'where':{'id':_0x566bc5['params']['id']}})[_0xf165('0x2d')](handleEntityNotFound(_0x51e650,null))[_0xf165('0x2d')](saveUpdates(_0x566bc5[_0xf165('0x75')],null))['then'](respondWithResult(_0x51e650,null))[_0xf165('0xb4')](handleError(_0x51e650,null));};exports[_0xf165('0x2e')]=function(_0x46032b,_0x557dd6){return db[_0xf165('0x9b')][_0xf165('0x62')]({'where':{'id':_0x46032b[_0xf165('0xb6')]['id']}})[_0xf165('0x2d')](handleEntityNotFound(_0x557dd6,null))[_0xf165('0x2d')](removeEntity(_0x557dd6,null))[_0xf165('0xb4')](handleError(_0x557dd6,null));};exports[_0xf165('0xb7')]=function(_0x776853,_0x231174){return db[_0xf165('0x9b')][_0xf165('0xb7')]()['then'](respondWithResult(_0x231174,null))[_0xf165('0xb4')](handleError(_0x231174,null));};exports['addMessage']=function(_0x4ce06f,_0x53496e,_0xc6b86b){return db[_0xf165('0xb8')][_0xf165('0x62')]({'where':{'id':_0x4ce06f['params']['id']}})[_0xf165('0x2d')](handleEntityNotFound(_0x53496e,null))[_0xf165('0x2d')](function(_0x2da0e8){if(_0x2da0e8){return _0x2da0e8[_0xf165('0xb9')](_0x4ce06f[_0xf165('0x75')][_0xf165('0xba')],_[_0xf165('0xbb')](_0x4ce06f[_0xf165('0x75')],[_0xf165('0xba'),'id'])||{});}})[_0xf165('0x2d')](respondWithResult(_0x53496e,null))[_0xf165('0xb4')](handleError(_0x53496e,null));};exports[_0xf165('0xbc')]=function(_0x3df5c0,_0x14e6fc,_0x22c98a){var _0x27c87d={'raw':![],'where':{}};var _0x1da8c7={};var _0x3bac54={'count':0x0,'rows':[]};return db[_0xf165('0x9b')]['findOne']({'where':{'id':_0x3df5c0['params']['id']}})[_0xf165('0x2d')](handleEntityNotFound(_0x14e6fc,null))[_0xf165('0x2d')](function(_0x5b40a1){if(_0x5b40a1){_0x1da8c7[_0xf165('0x3e')]=_[_0xf165('0x40')](db[_0xf165('0xb8')]['rawAttributes']);_0x1da8c7['query']=_[_0xf165('0x40')](_0x3df5c0[_0xf165('0x3f')]);_0x1da8c7['filters']=_[_0xf165('0x41')](_0x1da8c7[_0xf165('0x3e')],_0x1da8c7[_0xf165('0x3f')]);_0x27c87d[_0xf165('0x42')]=_['intersection'](_0x1da8c7['model'],qs[_0xf165('0x43')](_0x3df5c0[_0xf165('0x3f')][_0xf165('0x43')]));_0x27c87d[_0xf165('0x42')]=_0x27c87d['attributes'][_0xf165('0x44')]?_0x27c87d[_0xf165('0x42')]:_0x1da8c7[_0xf165('0x3e')];if(!_0x3df5c0['query'][_0xf165('0x45')]('nolimit')){_0x27c87d[_0xf165('0x25')]=qs[_0xf165('0x25')](_0x3df5c0[_0xf165('0x3f')][_0xf165('0x25')]);_0x27c87d['offset']=qs[_0xf165('0x23')](_0x3df5c0[_0xf165('0x3f')][_0xf165('0x23')]);}_0x27c87d[_0xf165('0x8d')]=qs[_0xf165('0x47')](_0x3df5c0[_0xf165('0x3f')][_0xf165('0x47')]);_0x27c87d[_0xf165('0x78')]=qs['filters'](_[_0xf165('0x48')](_0x3df5c0[_0xf165('0x3f')],_0x1da8c7[_0xf165('0x49')]));_0x27c87d[_0xf165('0x78')][_0xf165('0xaf')]=_0x5b40a1['id'];if(_0x3df5c0[_0xf165('0x3f')]['filter']){_0x27c87d[_0xf165('0x78')]=_['merge'](_0x27c87d[_0xf165('0x78')],{'$or':_[_0xf165('0x34')](_0x27c87d[_0xf165('0x42')],function(_0x17cc95){var _0x3afb84={};_0x3afb84[_0x17cc95]={'$like':'%'+_0x3df5c0[_0xf165('0x3f')]['filter']+'%'};return _0x3afb84;})});}if(_0x3df5c0[_0xf165('0x3f')]['$gte']){var _0x335f4b=_0x3df5c0[_0xf165('0x3f')][_0xf165('0xbd')][_0xf165('0x37')](',');var _0x47d56d={};_0x47d56d[_0x335f4b[0x0]]={'$gte':moment(_0x335f4b[0x1])[_0xf165('0xbe')](_0xf165('0xbf'))};_0x27c87d['where']=_['merge'](_0x27c87d[_0xf165('0x78')],_0x47d56d);}_0x27c87d=_[_0xf165('0x9a')]({},_0x27c87d,_0x3df5c0[_0xf165('0xb3')]);return db[_0xf165('0xb8')][_0xf165('0x26')]({'where':_0x27c87d[_0xf165('0x78')]})[_0xf165('0x2d')](function(_0x19b6cd){_0x3bac54[_0xf165('0x26')]=_0x19b6cd;if(_0x3df5c0[_0xf165('0x3f')][_0xf165('0xb1')]){_0x27c87d[_0xf165('0xb2')]=[{'all':!![]}];}return db[_0xf165('0xb8')][_0xf165('0xc0')](_0x27c87d);})[_0xf165('0x2d')](function(_0x184011){_0x3bac54[_0xf165('0xc1')]=_0x184011;return _0x3bac54;});}})[_0xf165('0x2d')](respondWithFilteredResult(_0x14e6fc,_0x27c87d))[_0xf165('0xb4')](handleError(_0x14e6fc,null));};exports[_0xf165('0xc2')]=function(_0x31a6b7,_0x253113,_0x5bc1a){return db[_0xf165('0x9b')][_0xf165('0x62')]({'where':{'id':_0x31a6b7['params']['id']}})[_0xf165('0x2d')](handleEntityNotFound(_0x253113,null))[_0xf165('0x2d')](function(_0x33cb72){if(_0x33cb72){return _0x33cb72['setTags'](_0x31a6b7[_0xf165('0x75')][_0xf165('0xba')],_['omit'](_0x31a6b7[_0xf165('0x75')],[_0xf165('0xba'),'id'])||{})[_0xf165('0xc3')](function(){return db[_0xf165('0x6e')]['findAll']({'attributes':['id',_0xf165('0x31'),'color'],'where':{'id':_0x31a6b7[_0xf165('0x75')]['ids']}});})[_0xf165('0x2d')](function(_0xd2122b){socket[_0xf165('0xc4')]('faxInteractionTags:save',{'id':Number(_0x31a6b7['params']['id']),'tags':_0xd2122b||[]});return{'id':Number(_0x31a6b7[_0xf165('0xb6')]['id']),'tags':_0xd2122b||[]};});}})[_0xf165('0x2d')](respondWithResult(_0x253113,null))[_0xf165('0xb4')](handleError(_0x253113,null));};exports['removeTags']=function(_0xfb10a1,_0xe57356,_0x172afd){return db[_0xf165('0x9b')][_0xf165('0x62')]({'where':{'id':_0xfb10a1[_0xf165('0xb6')]['id']}})['then'](handleEntityNotFound(_0xe57356,null))['then'](function(_0x408177){if(_0x408177){return _0x408177[_0xf165('0xc5')](_0xfb10a1[_0xf165('0x3f')]['ids']);}})[_0xf165('0x2d')](respondWithStatusCode(_0xe57356,null))[_0xf165('0xb4')](handleError(_0xe57356,null));};exports['download']=function(_0x53d804,_0x9729c7){var _0x3a57f1=moment()[_0xf165('0xc6')]()[_0xf165('0x99')]();var _0xe3dd31=path[_0xf165('0xc7')](config[_0xf165('0xc8')],_0xf165('0xc9'),_0xf165('0xca'),'tmp');var _0x44651b=path[_0xf165('0xc7')](config['root'],_0xf165('0xc9'),_0xf165('0xca'),_0xf165('0xcb'));var _0x5719ce=path['join'](_0xe3dd31,_0x3a57f1);var _0x229ceb=util[_0xf165('0xbe')](_0xf165('0xcc'),_0x53d804[_0xf165('0xb6')]['id'],_0x3a57f1);var _0x1c0185=path[_0xf165('0xc7')](_0xe3dd31,_0x229ceb);var _0x4a0fe9=[];_0x4a0fe9[_0xf165('0x38')]({'model':db['Attachment'],'as':_0xf165('0xcd'),'raw':!![]});var _0x135ce1=[{'model':db[_0xf165('0xb8')],'as':'Messages','attributes':['id','body',_0xf165('0xce')],'include':_0x4a0fe9}];return db['FaxInteraction'][_0xf165('0x62')]({'where':{'id':_0x53d804[_0xf165('0xb6')]['id']},'include':_0x135ce1})[_0xf165('0x2d')](handleEntityNotFound(_0x9729c7,null))[_0xf165('0x2d')](function(_0x4612c2){if(_0x4612c2&&_0x4612c2[_0xf165('0xcf')]){var _0x4266bc=_0x4612c2[_0xf165('0xd0')]({'plain':!![]});fs[_0xf165('0xd1')](_0x5719ce);for(var _0x67b225=0x0;_0x67b225<_0x4266bc[_0xf165('0xcf')][_0xf165('0x44')];_0x67b225++){var _0x98d663=_0x4266bc[_0xf165('0xcf')][_0x67b225][_0xf165('0xcd')];if(_0x98d663){var _0x872a77=path[_0xf165('0xc7')](_0x44651b,_0x98d663['basename']);if(fs['existsSync'](_0x872a77)){fs[_0xf165('0xd2')](_0x872a77)['pipe'](fs[_0xf165('0xd3')](path[_0xf165('0xc7')](_0x5719ce,_0x98d663['basename'])));}}}return BPromise[_0xf165('0xd4')]()[_0xf165('0x2d')](function(){return new BPromise(function(_0x37d7ed,_0x1bc877){zipdir(_0x5719ce,{'saveTo':_0x1c0185},function(_0xb6921b,_0x3b0de2){if(_0xb6921b)return _0x1bc877(_0xb6921b);return _0x37d7ed(_0x3b0de2);});})[_0xf165('0x2d')](function(){return new BPromise(function(_0x1920b9,_0x205e67){rimraf(_0x5719ce,function(_0x1a031d){if(_0x1a031d)_0x205e67(_0x1a031d);return _0x1920b9();});});})[_0xf165('0x2d')](function(){return _0x9729c7[_0xf165('0xd5')](_0x1c0185,_0x229ceb,function(_0x322d2e){if(_0x322d2e){console[_0xf165('0xd6')]('err',_0x322d2e);}else{fs['unlinkSync'](_0x1c0185);}});});});}else{return _0x9729c7[_0xf165('0x1f')](0xc8);}})[_0xf165('0xb4')](handleError(_0x9729c7,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 2d0593c..8944dcb 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 _0xee46=['FaxMessage','save','update','getUsers','then','Users','map','findAll','unreadMessages','length','emit','catch','events','../../mysqldb'];(function(_0x5b13ef,_0x2acc7d){var _0x5bd040=function(_0x156059){while(--_0x156059){_0x5b13ef['push'](_0x5b13ef['shift']());}};_0x5bd040(++_0x2acc7d);}(_0xee46,0x194));var _0x6ee4=function(_0x246672,_0x2c010d){_0x246672=_0x246672-0x0;var _0x482f96=_0xee46[_0x246672];return _0x482f96;};'use strict';var EventEmitter=require(_0x6ee4('0x0'));var FaxInteraction=require(_0x6ee4('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x6ee4('0x1'))['db'][_0x6ee4('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6ee4('0x3'),'afterUpdate':_0x6ee4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x542c48){return function(_0x3d6fb5,_0x2d9e5f,_0x12f082){_0x3d6fb5[_0x6ee4('0x5')]({'attributes':['id'],'raw':!![]})[_0x6ee4('0x6')](function(_0x5005cc){_0x3d6fb5['setDataValue'](_0x6ee4('0x7'),_0x5005cc[_0x6ee4('0x8')](function(_0x5e6305){return{'id':_0x5e6305['id']};}));return FaxMessage[_0x6ee4('0x9')]({'where':{'FaxInteractionId':_0x3d6fb5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6ee4('0x6')](function(_0x507403){_0x3d6fb5['setDataValue'](_0x6ee4('0xa'),_0x507403[_0x6ee4('0xb')]);FaxInteractionEvents[_0x6ee4('0xc')](_0x542c48+':'+_0x3d6fb5['id'],_0x3d6fb5);FaxInteractionEvents[_0x6ee4('0xc')](_0x542c48,_0x3d6fb5);_0x12f082(null);})[_0x6ee4('0xd')](_0x12f082(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x22f3=['update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hook','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x1047a0,_0x4685ab){var _0xa30177=function(_0x1c72ff){while(--_0x1c72ff){_0x1047a0['push'](_0x1047a0['shift']());}};_0xa30177(++_0x4685ab);}(_0x22f3,0x187));var _0x322f=function(_0x89cf24,_0x217ee8){_0x89cf24=_0x89cf24-0x0;var _0x42a9fd=_0x22f3[_0x89cf24];return _0x42a9fd;};'use strict';var EventEmitter=require(_0x322f('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x322f('0x1')];var FaxMessage=require(_0x322f('0x2'))['db'][_0x322f('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x322f('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x322f('0x5'),'afterDestroy':_0x322f('0x6')};function emitEvent(_0x1d24fd){return function(_0x57098d,_0x3e7173,_0xc0a77a){_0x57098d[_0x322f('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x403b5e){_0x57098d[_0x322f('0x8')](_0x322f('0x9'),_0x403b5e[_0x322f('0xa')](function(_0x4e12db){return{'id':_0x4e12db['id']};}));return FaxMessage[_0x322f('0xb')]({'where':{'FaxInteractionId':_0x57098d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x322f('0xc')](function(_0x35bec0){_0x57098d[_0x322f('0x8')](_0x322f('0xd'),_0x35bec0[_0x322f('0xe')]);FaxInteractionEvents[_0x322f('0xf')](_0x1d24fd+':'+_0x57098d['id'],_0x57098d);FaxInteractionEvents[_0x322f('0xf')](_0x1d24fd,_0x57098d);_0xc0a77a(null);})[_0x322f('0x10')](_0xc0a77a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x322f('0x11')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 431f29a..ec1491a 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 _0x020a=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed'];(function(_0x45cb02,_0x460efa){var _0x38ab16=function(_0x514546){while(--_0x514546){_0x45cb02['push'](_0x45cb02['shift']());}};_0x38ab16(++_0x460efa);}(_0x020a,0xc9));var _0xa020=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0x020a[_0x2d2ca2];return _0x48489d;};'use strict';var _=require(_0xa020('0x0'));var util=require(_0xa020('0x1'));var logger=require(_0xa020('0x2'))('api');var moment=require(_0xa020('0x3'));var BPromise=require(_0xa020('0x4'));var rp=require(_0xa020('0x5'));var fs=require('fs');var path=require(_0xa020('0x6'));var rimraf=require(_0xa020('0x7'));var config=require(_0xa020('0x8'));var attributes=require(_0xa020('0x9'));module[_0xa020('0xa')]=function(_0x46be7a,_0xd8d116){return _0x46be7a['define'](_0xa020('0xb'),attributes,{'tableName':_0xa020('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x14823b,_0x240a3f,_0x504f83){if(_0x14823b[_0xa020('0xd')](_0xa020('0xe'))){_0x14823b[_0xa020('0xf')]=moment()[_0xa020('0x10')](_0xa020('0x11'));}_0x504f83(null,_0x14823b);}}});}; \ No newline at end of file +var _0xbb3e=['rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x59c17e,_0x4d7ea5){var _0x36bde1=function(_0x4678e2){while(--_0x4678e2){_0x59c17e['push'](_0x59c17e['shift']());}};_0x36bde1(++_0x4d7ea5);}(_0xbb3e,0x181));var _0xebb3=function(_0x1bce50,_0x10078e){_0x1bce50=_0x1bce50-0x0;var _0x101586=_0xbb3e[_0x1bce50];return _0x101586;};'use strict';var _=require(_0xebb3('0x0'));var util=require(_0xebb3('0x1'));var logger=require(_0xebb3('0x2'))(_0xebb3('0x3'));var moment=require('moment');var BPromise=require(_0xebb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xebb3('0x5'));var rimraf=require(_0xebb3('0x6'));var config=require(_0xebb3('0x7'));var attributes=require(_0xebb3('0x8'));module[_0xebb3('0x9')]=function(_0x112b0b,_0x225d4b){return _0x112b0b[_0xebb3('0xa')](_0xebb3('0xb'),attributes,{'tableName':_0xebb3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a907a,_0x9d4c5a,_0x396ce9){if(_0x1a907a[_0xebb3('0xd')](_0xebb3('0xe'))){_0x1a907a[_0xebb3('0xf')]=moment()[_0xebb3('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x396ce9(null,_0x1a907a);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index eec7597..36ddb2a 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 _0xbd11=['attributes','UpdateFaxInteraction','debug','catch','AddTagsToFaxInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FaxInteraction','body','options','raw'];(function(_0x162f92,_0xfd42de){var _0x4709b8=function(_0x4e60ae){while(--_0x4e60ae){_0x162f92['push'](_0x162f92['shift']());}};_0x4709b8(++_0xfd42de);}(_0xbd11,0x108));var _0x1bd1=function(_0x1ed010,_0x734e0b){_0x1ed010=_0x1ed010-0x0;var _0x6e22bf=_0xbd11[_0x1ed010];return _0x6e22bf;};'use strict';var _=require(_0x1bd1('0x0'));var util=require(_0x1bd1('0x1'));var moment=require(_0x1bd1('0x2'));var BPromise=require(_0x1bd1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1bd1('0x4'))['db'];var utils=require(_0x1bd1('0x5'));var logger=require(_0x1bd1('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1bd1('0x7'));var client=jayson[_0x1bd1('0x8')][_0x1bd1('0x9')]({'port':0x232a});config['redis']=_[_0x1bd1('0xa')](config[_0x1bd1('0xb')],{'host':_0x1bd1('0xc'),'port':0x18eb});var socket=require(_0x1bd1('0xd'))(new Redis(config[_0x1bd1('0xb')]));require(_0x1bd1('0xe'))['register'](socket);function respondWithRpcPromise(_0xb9ac44,_0x1656ce,_0x81d3a1){return new BPromise(function(_0x790b4a,_0x427cef){return client[_0x1bd1('0xf')](_0xb9ac44,_0x81d3a1)[_0x1bd1('0x10')](function(_0x4bdce5){logger[_0x1bd1('0x11')](_0x1bd1('0x12'),_0x1656ce,_0x1bd1('0x13'));logger['debug'](_0x1bd1('0x14'),_0x1656ce,_0x1bd1('0x13'),JSON[_0x1bd1('0x15')](_0x4bdce5));if(_0x4bdce5[_0x1bd1('0x16')]){if(_0x4bdce5[_0x1bd1('0x16')][_0x1bd1('0x17')]===0x1f4){logger[_0x1bd1('0x16')](_0x1bd1('0x12'),_0x1656ce,_0x4bdce5[_0x1bd1('0x16')][_0x1bd1('0x18')]);return _0x427cef(_0x4bdce5[_0x1bd1('0x16')][_0x1bd1('0x18')]);}logger[_0x1bd1('0x16')](_0x1bd1('0x12'),_0x1656ce,_0x4bdce5[_0x1bd1('0x16')][_0x1bd1('0x18')]);return _0x790b4a(_0x4bdce5['error'][_0x1bd1('0x18')]);}else{logger[_0x1bd1('0x11')](_0x1bd1('0x12'),_0x1656ce,_0x1bd1('0x13'));_0x790b4a(_0x4bdce5[_0x1bd1('0x19')][_0x1bd1('0x18')]);}})['catch'](function(_0x2bdc84){logger[_0x1bd1('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x1656ce,_0x2bdc84);_0x427cef(_0x2bdc84);});});}exports['UpdateFaxInteraction']=function(_0x36696e){var _0x17c877=this;return new Promise(function(_0x555101,_0x599ebc){return db[_0x1bd1('0x1a')]['update'](_0x36696e[_0x1bd1('0x1b')],{'raw':_0x36696e[_0x1bd1('0x1c')]?_0x36696e[_0x1bd1('0x1c')][_0x1bd1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36696e[_0x1bd1('0x1c')]?_0x36696e[_0x1bd1('0x1c')]['where']||null:null,'attributes':_0x36696e[_0x1bd1('0x1c')]?_0x36696e['options'][_0x1bd1('0x1e')]||null:null,'limit':_0x36696e[_0x1bd1('0x1c')]?_0x36696e['options']['limit']||null:null})[_0x1bd1('0x10')](function(_0x3c89f9){logger['info'](_0x1bd1('0x1f'),_0x36696e);logger[_0x1bd1('0x20')]('UpdateFaxInteraction',_0x36696e,JSON[_0x1bd1('0x15')](_0x3c89f9));_0x555101(_0x3c89f9);})[_0x1bd1('0x21')](function(_0x455528){logger[_0x1bd1('0x16')](_0x1bd1('0x1f'),_0x455528[_0x1bd1('0x18')],_0x36696e);_0x599ebc(_0x17c877[_0x1bd1('0x16')](0x1f4,_0x455528[_0x1bd1('0x18')]));});});};exports[_0x1bd1('0x22')]=function(_0x5df615){return new Promise(function(_0x59d668,_0x3ba1b8){return db['FaxInteraction'][_0x1bd1('0x23')]({'where':_0x5df615[_0x1bd1('0x1c')]?_0x5df615[_0x1bd1('0x1c')][_0x1bd1('0x24')]||null:null})['then'](function(_0x18b685){if(_0x18b685){return _0x18b685[_0x1bd1('0x25')](_0x5df615[_0x1bd1('0x1b')][_0x1bd1('0x26')],_[_0x1bd1('0x27')](_0x5df615[_0x1bd1('0x1b')],[_0x1bd1('0x26'),'id'])||{});}})[_0x1bd1('0x28')](function(_0x4215c4){logger[_0x1bd1('0x11')](_0x1bd1('0x29'),_0x5df615);logger[_0x1bd1('0x20')](_0x1bd1('0x29'),_0x5df615,JSON[_0x1bd1('0x15')](_0x4215c4));_0x59d668(_0x4215c4);})[_0x1bd1('0x21')](function(_0x50fb5c){logger[_0x1bd1('0x16')]('AddTags',_0x50fb5c['message'],_0x5df615);_0x3ba1b8(_this[_0x1bd1('0x16')](0x1f4,_0x50fb5c['message']));});});}; \ No newline at end of file +var _0xdf14=['FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','stringify','AddTags','lodash','util','moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdf14,0x166));var _0x4df1=function(_0x1d93f0,_0x29aa07){_0x1d93f0=_0x1d93f0-0x0;var _0x2e755d=_0xdf14[_0x1d93f0];return _0x2e755d;};'use strict';var _=require(_0x4df1('0x0'));var util=require(_0x4df1('0x1'));var moment=require(_0x4df1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4df1('0x3'))['db'];var utils=require(_0x4df1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4df1('0x5'));var jayson=require(_0x4df1('0x6'));var client=jayson[_0x4df1('0x7')][_0x4df1('0x8')]({'port':0x232a});config[_0x4df1('0x9')]=_['defaults'](config[_0x4df1('0x9')],{'host':_0x4df1('0xa'),'port':0x18eb});var socket=require(_0x4df1('0xb'))(new Redis(config[_0x4df1('0x9')]));require(_0x4df1('0xc'))[_0x4df1('0xd')](socket);function respondWithRpcPromise(_0x1a00a7,_0x34db23,_0x225ea6){return new BPromise(function(_0x4e586c,_0xf4ce4){return client[_0x4df1('0xe')](_0x1a00a7,_0x225ea6)[_0x4df1('0xf')](function(_0x1bf0f4){logger[_0x4df1('0x10')](_0x4df1('0x11'),_0x34db23,_0x4df1('0x12'));logger[_0x4df1('0x13')](_0x4df1('0x14'),_0x34db23,_0x4df1('0x12'),JSON['stringify'](_0x1bf0f4));if(_0x1bf0f4[_0x4df1('0x15')]){if(_0x1bf0f4[_0x4df1('0x15')]['code']===0x1f4){logger[_0x4df1('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x34db23,_0x1bf0f4['error']['message']);return _0xf4ce4(_0x1bf0f4['error'][_0x4df1('0x16')]);}logger[_0x4df1('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x34db23,_0x1bf0f4[_0x4df1('0x15')][_0x4df1('0x16')]);return _0x4e586c(_0x1bf0f4[_0x4df1('0x15')]['message']);}else{logger[_0x4df1('0x10')](_0x4df1('0x11'),_0x34db23,_0x4df1('0x12'));_0x4e586c(_0x1bf0f4[_0x4df1('0x17')][_0x4df1('0x16')]);}})[_0x4df1('0x18')](function(_0x4abc8f){logger['error'](_0x4df1('0x11'),_0x34db23,_0x4abc8f);_0xf4ce4(_0x4abc8f);});});}exports[_0x4df1('0x19')]=function(_0x2bf05f){var _0x1a926d=this;return new Promise(function(_0x4e20e1,_0x1494a7){return db[_0x4df1('0x1a')][_0x4df1('0x1b')](_0x2bf05f[_0x4df1('0x1c')],{'raw':_0x2bf05f[_0x4df1('0x1d')]?_0x2bf05f[_0x4df1('0x1d')][_0x4df1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bf05f[_0x4df1('0x1d')]?_0x2bf05f[_0x4df1('0x1d')][_0x4df1('0x1f')]||null:null,'attributes':_0x2bf05f['options']?_0x2bf05f[_0x4df1('0x1d')][_0x4df1('0x20')]||null:null,'limit':_0x2bf05f['options']?_0x2bf05f[_0x4df1('0x1d')][_0x4df1('0x21')]||null:null})[_0x4df1('0xf')](function(_0x49b4bc){logger['info'](_0x4df1('0x19'),_0x2bf05f);logger['debug']('UpdateFaxInteraction',_0x2bf05f,JSON['stringify'](_0x49b4bc));_0x4e20e1(_0x49b4bc);})[_0x4df1('0x18')](function(_0x395e00){logger['error']('UpdateFaxInteraction',_0x395e00[_0x4df1('0x16')],_0x2bf05f);_0x1494a7(_0x1a926d[_0x4df1('0x15')](0x1f4,_0x395e00[_0x4df1('0x16')]));});});};exports[_0x4df1('0x22')]=function(_0x9256c8){return new Promise(function(_0x35d562,_0x6238b5){return db[_0x4df1('0x1a')][_0x4df1('0x23')]({'where':_0x9256c8['options']?_0x9256c8[_0x4df1('0x1d')][_0x4df1('0x1f')]||null:null})['then'](function(_0x5b7bfe){if(_0x5b7bfe){return _0x5b7bfe[_0x4df1('0x24')](_0x9256c8[_0x4df1('0x1c')][_0x4df1('0x25')],_[_0x4df1('0x26')](_0x9256c8[_0x4df1('0x1c')],[_0x4df1('0x25'),'id'])||{});}})[_0x4df1('0x27')](function(_0x16703c){logger[_0x4df1('0x10')]('AddTags',_0x9256c8);logger['debug']('AddTags',_0x9256c8,JSON[_0x4df1('0x28')](_0x16703c));_0x35d562(_0x16703c);})[_0x4df1('0x18')](function(_0x47c195){logger[_0x4df1('0x15')](_0x4df1('0x29'),_0x47c195[_0x4df1('0x16')],_0x9256c8);_0x6238b5(_this[_0x4df1('0x15')](0x1f4,_0x47c195[_0x4df1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 0c2a5c6..cc68f9c 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 _0x7666=['emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0x31bad1,_0x163160){var _0x30c64e=function(_0x1c0df5){while(--_0x1c0df5){_0x31bad1['push'](_0x31bad1['shift']());}};_0x30c64e(++_0x163160);}(_0x7666,0x115));var _0x6766=function(_0x5c2743,_0x180def){_0x5c2743=_0x5c2743-0x0;var _0x417f47=_0x7666[_0x5c2743];return _0x417f47;};'use strict';var FaxInteractionEvents=require(_0x6766('0x0'));var events=[_0x6766('0x1'),_0x6766('0x2'),'update'];function createListener(_0x3f5565,_0x45282f){return function(_0x1b9fde){_0x45282f[_0x6766('0x3')](_0x3f5565,_0x1b9fde);};}function removeListener(_0x4894e5,_0x2078b4){return function(){FaxInteractionEvents[_0x6766('0x4')](_0x4894e5,_0x2078b4);};}exports[_0x6766('0x5')]=function(_0x50dd33){for(var _0x13574b=0x0,_0x31e0de=events[_0x6766('0x6')];_0x13574b<_0x31e0de;_0x13574b++){var _0x8ebefe=events[_0x13574b];var _0x227f34=createListener(_0x6766('0x7')+_0x8ebefe,_0x50dd33);FaxInteractionEvents['on'](_0x8ebefe,_0x227f34);}}; \ No newline at end of file +var _0x1206=['length','faxInteraction:','./faxInteraction.events','save','remove','removeListener'];(function(_0x10b8a1,_0x52e86a){var _0x15fc80=function(_0x34dd47){while(--_0x34dd47){_0x10b8a1['push'](_0x10b8a1['shift']());}};_0x15fc80(++_0x52e86a);}(_0x1206,0xe6));var _0x6120=function(_0x1c9e1d,_0x43aef3){_0x1c9e1d=_0x1c9e1d-0x0;var _0x1241fd=_0x1206[_0x1c9e1d];return _0x1241fd;};'use strict';var FaxInteractionEvents=require(_0x6120('0x0'));var events=[_0x6120('0x1'),_0x6120('0x2'),'update'];function createListener(_0x5ec254,_0x50516d){return function(_0x4f068d){_0x50516d['emit'](_0x5ec254,_0x4f068d);};}function removeListener(_0x2a9cf3,_0x37811f){return function(){FaxInteractionEvents[_0x6120('0x3')](_0x2a9cf3,_0x37811f);};}exports['register']=function(_0x32bcfd){for(var _0x2ace7c=0x0,_0x49b8a9=events[_0x6120('0x4')];_0x2ace7c<_0x49b8a9;_0x2ace7c++){var _0x21191f=events[_0x2ace7c];var _0x2dc67b=createListener(_0x6120('0x5')+_0x21191f,_0x32bcfd);FaxInteractionEvents['on'](_0x21191f,_0x2dc67b);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 71ff07c..40a65fd 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 _0x1472=['path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','addTags','put','delete','fax','faxinteraction:destroy','destroy','exports','multer'];(function(_0x5969fc,_0x11a977){var _0x56a22a=function(_0x4bcee0){while(--_0x4bcee0){_0x5969fc['push'](_0x5969fc['shift']());}};_0x56a22a(++_0x11a977);}(_0x1472,0xe9));var _0x2147=function(_0x2967c1,_0x202a72){_0x2967c1=_0x2967c1-0x0;var _0x103397=_0x1472[_0x2967c1];return _0x103397;};'use strict';var multer=require(_0x2147('0x0'));var util=require('util');var path=require(_0x2147('0x1'));var timeout=require(_0x2147('0x2'));var express=require('express');var router=express[_0x2147('0x3')]();var fs_extra=require(_0x2147('0x4'));var auth=require(_0x2147('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0x2147('0x6')]('/',auth[_0x2147('0x7')](),controller[_0x2147('0x8')]);router['get']('/describe',auth[_0x2147('0x7')](),controller[_0x2147('0x9')]);router[_0x2147('0x6')](_0x2147('0xa'),auth[_0x2147('0x7')](),controller[_0x2147('0xb')]);router[_0x2147('0x6')](_0x2147('0xc'),auth[_0x2147('0x7')](),controller[_0x2147('0xd')]);router[_0x2147('0x6')](_0x2147('0xe'),auth[_0x2147('0x7')](),controller['download']);router[_0x2147('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2147('0xf')](_0x2147('0xc'),auth[_0x2147('0x7')](),controller[_0x2147('0x10')]);router[_0x2147('0xf')](_0x2147('0x11'),auth['isAuthenticated'](),interaction[_0x2147('0x12')]('fax','faxinteraction:addtags'),controller[_0x2147('0x13')]);router[_0x2147('0x14')](_0x2147('0xa'),auth[_0x2147('0x7')](),interaction[_0x2147('0x12')]('fax','faxinteraction:update'),controller['update']);router[_0x2147('0x15')](_0x2147('0xa'),auth['isAuthenticated'](),interaction[_0x2147('0x12')](_0x2147('0x16'),_0x2147('0x17')),controller[_0x2147('0x18')]);router[_0x2147('0x15')](_0x2147('0x11'),auth[_0x2147('0x7')](),controller['removeTags']);module[_0x2147('0x19')]=router; \ No newline at end of file +var _0x02ba=['download','post','create','/:id/messages','/:id/tags','tracked','faxinteraction:addtags','put','fax','update','faxinteraction:destroy','destroy','delete','removeTags','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x114949,_0x5889c1){var _0x1a7763=function(_0x52570d){while(--_0x52570d){_0x114949['push'](_0x114949['shift']());}};_0x1a7763(++_0x5889c1);}(_0x02ba,0x9b));var _0xa02b=function(_0x157f9e,_0x3261e8){_0x157f9e=_0x157f9e-0x0;var _0x210c2c=_0x02ba[_0x157f9e];return _0x210c2c;};'use strict';var multer=require(_0xa02b('0x0'));var util=require(_0xa02b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa02b('0x2'));var router=express[_0xa02b('0x3')]();var fs_extra=require(_0xa02b('0x4'));var auth=require(_0xa02b('0x5'));var interaction=require(_0xa02b('0x6'));var config=require(_0xa02b('0x7'));var controller=require('./faxInteraction.controller');router[_0xa02b('0x8')]('/',auth[_0xa02b('0x9')](),controller[_0xa02b('0xa')]);router[_0xa02b('0x8')]('/describe',auth[_0xa02b('0x9')](),controller['describe']);router['get'](_0xa02b('0xb'),auth[_0xa02b('0x9')](),controller[_0xa02b('0xc')]);router[_0xa02b('0x8')]('/:id/messages',auth[_0xa02b('0x9')](),controller['getMessages']);router[_0xa02b('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xa02b('0xd')]);router[_0xa02b('0xe')]('/',auth[_0xa02b('0x9')](),controller[_0xa02b('0xf')]);router[_0xa02b('0xe')](_0xa02b('0x10'),auth[_0xa02b('0x9')](),controller['addMessage']);router['post'](_0xa02b('0x11'),auth['isAuthenticated'](),interaction[_0xa02b('0x12')]('fax',_0xa02b('0x13')),controller['addTags']);router[_0xa02b('0x14')](_0xa02b('0xb'),auth[_0xa02b('0x9')](),interaction[_0xa02b('0x12')](_0xa02b('0x15'),'faxinteraction:update'),controller[_0xa02b('0x16')]);router['delete'](_0xa02b('0xb'),auth[_0xa02b('0x9')](),interaction[_0xa02b('0x12')](_0xa02b('0x15'),_0xa02b('0x17')),controller[_0xa02b('0x18')]);router[_0xa02b('0x19')](_0xa02b('0x11'),auth[_0xa02b('0x9')](),controller[_0xa02b('0x1a')]);module[_0xa02b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 6ce0461..00589e6 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 _0x6c84=['TEXT','medium','BOOLEAN','out','sequelize','exports'];(function(_0x15c627,_0x212b8f){var _0x5103b0=function(_0x4b84b3){while(--_0x4b84b3){_0x15c627['push'](_0x15c627['shift']());}};_0x5103b0(++_0x212b8f);}(_0x6c84,0x112));var _0x46c8=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6c84[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x46c8('0x0'));module[_0x46c8('0x1')]={'body':{'type':Sequelize[_0x46c8('0x2')](_0x46c8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x46c8('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x46c8('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x46c8('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xeb5d=['medium','BOOLEAN','out','exports','TEXT'];(function(_0x2e4b84,_0x19ad5a){var _0x3a0444=function(_0x2a86db){while(--_0x2a86db){_0x2e4b84['push'](_0x2e4b84['shift']());}};_0x3a0444(++_0x19ad5a);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xeb5d[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require('sequelize');module[_0xdeb5('0x0')]={'body':{'type':Sequelize[_0xdeb5('0x1')](_0xdeb5('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdeb5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xdeb5('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xdeb5('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 29320b9..04f2111 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 _0x509f=['stack','name','index','FaxMessage','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','map','type','VIRTUAL','options','includeAll','include','params','body','find','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','get','FaxInteractionId','update','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','fullname','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','User','internal','create','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','join','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','info','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x509f,0xd5));var _0xf509=function(_0x40edfc,_0x5cda1d){_0x40edfc=_0x40edfc-0x0;var _0x180c8d=_0x509f[_0x40edfc];return _0x180c8d;};'use strict';var emlformat=require(_0xf509('0x0'));var rimraf=require(_0xf509('0x1'));var zipdir=require(_0xf509('0x2'));var jsonpatch=require(_0xf509('0x3'));var rp=require('request-promise');var moment=require(_0xf509('0x4'));var BPromise=require(_0xf509('0x5'));var Mustache=require('mustache');var util=require(_0xf509('0x6'));var path=require(_0xf509('0x7'));var sox=require(_0xf509('0x8'));var csv=require('to-csv');var ejs=require(_0xf509('0x9'));var fs=require('fs');var fs_extra=require(_0xf509('0xa'));var _=require(_0xf509('0xb'));var squel=require(_0xf509('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf509('0xd'));var querystring=require('querystring');var Papa=require(_0xf509('0xe'));var Redis=require(_0xf509('0xf'));var authService=require(_0xf509('0x10'));var qs=require(_0xf509('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf509('0x12'));var logger=require(_0xf509('0x13'))('api');var utils=require(_0xf509('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf509('0x15'));var db=require('../../mysqldb')['db'];config[_0xf509('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf509('0x17'))(new Redis(config[_0xf509('0x16')]));require(_0xf509('0x18'))[_0xf509('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf509('0x1a')][_0xf509('0x1b')]({'port':0x232c});var client9002=jayson[_0xf509('0x1a')][_0xf509('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x54cefa,_0x3e1608,_0x46c73b,_0x3d6043){return new BPromise(function(_0x21f8bd,_0x262e56){var _0x41b425=_0x3d6043||client;return _0x41b425[_0xf509('0x1c')](_0x54cefa,_0x46c73b)[_0xf509('0x1d')](function(_0x595e6f){logger[_0xf509('0x1e')]('FaxMessage,\x20%s,\x20%s',_0x3e1608,'request\x20sent');logger[_0xf509('0x1f')](_0xf509('0x20'),_0x3e1608,_0xf509('0x21'),JSON['stringify'](_0x595e6f));if(_0x595e6f[_0xf509('0x22')]){if(_0x595e6f['error'][_0xf509('0x23')]===0x1f4){logger[_0xf509('0x22')](_0xf509('0x24'),_0x3e1608,_0x595e6f[_0xf509('0x22')][_0xf509('0x25')]);return _0x262e56(_0x595e6f['error'][_0xf509('0x25')]);}logger[_0xf509('0x22')]('FaxMessage,\x20%s,\x20%s',_0x3e1608,_0x595e6f[_0xf509('0x22')]['message']);return _0x21f8bd(_0x595e6f[_0xf509('0x22')][_0xf509('0x25')]);}else{logger['info'](_0xf509('0x24'),_0x3e1608,_0xf509('0x21'));_0x21f8bd(_0x595e6f[_0xf509('0x26')][_0xf509('0x25')]);}})[_0xf509('0x27')](function(_0x5905d5){logger['error'](_0xf509('0x24'),_0x3e1608,_0x5905d5);_0x262e56(_0x5905d5);});});}function respondWithStatusCode(_0x3fff65,_0x2224ee){_0x2224ee=_0x2224ee||0xcc;return function(_0x5611a4){if(_0x5611a4){return _0x3fff65[_0xf509('0x28')](_0x2224ee);}return _0x3fff65['status'](_0x2224ee)['end']();};}function respondWithResult(_0x3c16bc,_0x4e8753){_0x4e8753=_0x4e8753||0xc8;return function(_0x49fb23){if(_0x49fb23){return _0x3c16bc[_0xf509('0x29')](_0x4e8753)[_0xf509('0x2a')](_0x49fb23);}};}function respondWithFilteredResult(_0x5fb303,_0x5669d6){return function(_0x4995cc){if(_0x4995cc){var _0x141d41=typeof _0x5669d6[_0xf509('0x2b')]===_0xf509('0x2c')&&typeof _0x5669d6[_0xf509('0x2d')]===_0xf509('0x2c');var _0xa33aac=_0x4995cc['count'];var _0x15fe1e=_0x141d41?0x0:_0x5669d6[_0xf509('0x2b')];var _0x1c6143=_0x141d41?_0x4995cc[_0xf509('0x2e')]:_0x5669d6['offset']+_0x5669d6[_0xf509('0x2d')];var _0x512894;if(_0x1c6143>=_0xa33aac){_0x1c6143=_0xa33aac;_0x512894=0xc8;}else{_0x512894=0xce;}_0x5fb303[_0xf509('0x29')](_0x512894);return _0x5fb303[_0xf509('0x2f')](_0xf509('0x30'),_0x15fe1e+'-'+_0x1c6143+'/'+_0xa33aac)[_0xf509('0x2a')](_0x4995cc);}return null;};}function patchUpdates(_0x44d806){return function(_0x120cd4){try{jsonpatch[_0xf509('0x31')](_0x120cd4,_0x44d806,!![]);}catch(_0xbecd70){return BPromise['reject'](_0xbecd70);}return _0x120cd4[_0xf509('0x32')]();};}function saveUpdates(_0x2abd7e,_0x4c6853){return function(_0x482ed0){if(_0x482ed0){return _0x482ed0['update'](_0x2abd7e)[_0xf509('0x1d')](function(_0x3c9308){return _0x3c9308;});}return null;};}function removeEntity(_0x30c19f,_0x2a5ac6){return function(_0x23a388){if(_0x23a388){return _0x23a388['destroy']()['then'](function(){_0x30c19f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c70ed,_0x36cf96){return function(_0x962a44){if(!_0x962a44){_0x4c70ed['sendStatus'](0x194);}return _0x962a44;};}function handleError(_0x4b7ef7,_0x3f91ca){_0x3f91ca=_0x3f91ca||0x1f4;return function(_0x113fc4){logger['error'](_0x113fc4[_0xf509('0x33')]);if(_0x113fc4[_0xf509('0x34')]){delete _0x113fc4[_0xf509('0x34')];}_0x4b7ef7['status'](_0x3f91ca)['send'](_0x113fc4);};}exports[_0xf509('0x35')]=function(_0x59306c,_0x5565aa){var _0x4f6c56={},_0x3d080f={},_0x5a7379={'count':0x0,'rows':[]};var _0x1bb4a0=_['map'](db[_0xf509('0x36')][_0xf509('0x37')],function(_0x5026e0){return{'name':_0x5026e0[_0xf509('0x38')],'type':_0x5026e0['type']['key']};});_0x3d080f[_0xf509('0x39')]=_['map'](_0x1bb4a0,'name');_0x3d080f['query']=_[_0xf509('0x3a')](_0x59306c[_0xf509('0x3b')]);_0x3d080f[_0xf509('0x3c')]=_[_0xf509('0x3d')](_0x3d080f['model'],_0x3d080f[_0xf509('0x3b')]);_0x4f6c56[_0xf509('0x3e')]=_[_0xf509('0x3d')](_0x3d080f[_0xf509('0x39')],qs[_0xf509('0x3f')](_0x59306c[_0xf509('0x3b')][_0xf509('0x3f')]));_0x4f6c56[_0xf509('0x3e')]=_0x4f6c56[_0xf509('0x3e')][_0xf509('0x40')]?_0x4f6c56['attributes']:_0x3d080f['model'];if(!_0x59306c[_0xf509('0x3b')][_0xf509('0x41')]('nolimit')){_0x4f6c56[_0xf509('0x2d')]=qs[_0xf509('0x2d')](_0x59306c[_0xf509('0x3b')][_0xf509('0x2d')]);_0x4f6c56['offset']=qs[_0xf509('0x2b')](_0x59306c[_0xf509('0x3b')][_0xf509('0x2b')]);}_0x4f6c56['order']=qs[_0xf509('0x42')](_0x59306c['query']['sort']);_0x4f6c56[_0xf509('0x43')]=qs['filters'](_['pick'](_0x59306c[_0xf509('0x3b')],_0x3d080f[_0xf509('0x3c')]),_0x1bb4a0);if(_0x59306c['query'][_0xf509('0x44')]){_0x4f6c56[_0xf509('0x43')]=_[_0xf509('0x45')](_0x4f6c56['where'],{'$or':_[_0xf509('0x46')](_0x1bb4a0,function(_0x39d023){if(_0x39d023[_0xf509('0x47')]!==_0xf509('0x48')){var _0x18d02e={};_0x18d02e[_0x39d023[_0xf509('0x34')]]={'$like':'%'+_0x59306c['query'][_0xf509('0x44')]+'%'};return _0x18d02e;}})});}_0x4f6c56=_[_0xf509('0x45')]({},_0x4f6c56,_0x59306c[_0xf509('0x49')]);var _0x107e66={'where':_0x4f6c56[_0xf509('0x43')]};return db[_0xf509('0x36')][_0xf509('0x2e')](_0x107e66)[_0xf509('0x1d')](function(_0x4638e7){_0x5a7379[_0xf509('0x2e')]=_0x4638e7;if(_0x59306c[_0xf509('0x3b')][_0xf509('0x4a')]){_0x4f6c56[_0xf509('0x4b')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x4f6c56);})[_0xf509('0x1d')](function(_0x5930b1){_0x5a7379['rows']=_0x5930b1;return _0x5a7379;})[_0xf509('0x1d')](respondWithFilteredResult(_0x5565aa,_0x4f6c56))[_0xf509('0x27')](handleError(_0x5565aa,null));};exports['show']=function(_0x59b7e1,_0x47afd0){var _0x50106e={'raw':!![],'where':{'id':_0x59b7e1[_0xf509('0x4c')]['id']}},_0x3a04b8={};_0x3a04b8[_0xf509('0x39')]=_[_0xf509('0x3a')](db['FaxMessage'][_0xf509('0x37')]);_0x3a04b8['query']=_['keys'](_0x59b7e1[_0xf509('0x3b')]);_0x3a04b8['filters']=_['intersection'](_0x3a04b8['model'],_0x3a04b8['query']);_0x50106e[_0xf509('0x3e')]=_['intersection'](_0x3a04b8[_0xf509('0x39')],qs[_0xf509('0x3f')](_0x59b7e1['query'][_0xf509('0x3f')]));_0x50106e[_0xf509('0x3e')]=_0x50106e[_0xf509('0x3e')]['length']?_0x50106e[_0xf509('0x3e')]:_0x3a04b8[_0xf509('0x39')];if(_0x59b7e1['query'][_0xf509('0x4a')]){_0x50106e[_0xf509('0x4b')]=[{'all':!![]}];}_0x50106e=_[_0xf509('0x45')]({},_0x50106e,_0x59b7e1[_0xf509('0x49')]);return db['FaxMessage']['find'](_0x50106e)[_0xf509('0x1d')](handleEntityNotFound(_0x47afd0,null))['then'](respondWithResult(_0x47afd0,null))[_0xf509('0x27')](handleError(_0x47afd0,null));};exports['update']=function(_0x32bd0e,_0x3f0f5b){if(_0x32bd0e[_0xf509('0x4d')]['id']){delete _0x32bd0e[_0xf509('0x4d')]['id'];}return db[_0xf509('0x36')][_0xf509('0x4e')]({'where':{'id':_0x32bd0e[_0xf509('0x4c')]['id']}})[_0xf509('0x1d')](handleEntityNotFound(_0x3f0f5b,null))['then'](saveUpdates(_0x32bd0e['body'],null))['then'](respondWithResult(_0x3f0f5b,null))[_0xf509('0x27')](handleError(_0x3f0f5b,null));};exports['destroy']=function(_0x31cc55,_0x44eac7){return db[_0xf509('0x36')][_0xf509('0x4e')]({'where':{'id':_0x31cc55[_0xf509('0x4c')]['id']}})[_0xf509('0x1d')](handleEntityNotFound(_0x44eac7,null))[_0xf509('0x1d')](removeEntity(_0x44eac7,null))[_0xf509('0x27')](handleError(_0x44eac7,null));};exports[_0xf509('0x4f')]=function(_0x463b8e,_0x3fb5fa){return db[_0xf509('0x36')]['describe']()[_0xf509('0x1d')](respondWithResult(_0x3fb5fa,null))[_0xf509('0x27')](handleError(_0x3fb5fa,null));};var interaction_log=require(_0xf509('0x13'))(_0xf509('0x50'));exports[_0xf509('0x51')]=function(_0x3bc8f,_0x71f1bf,_0x16323){var _0x371c83={'agent':{},'channel':_0xf509('0x52')};if(_0x3bc8f[_0xf509('0x4d')]['id']){delete _0x3bc8f[_0xf509('0x4d')]['id'];}_0x3bc8f[_0xf509('0x4d')][_0xf509('0x53')]=!![];_0x3bc8f['body'][_0xf509('0x54')]=moment()[_0xf509('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bc8f[_0xf509('0x4d')][_0xf509('0x56')]=_0x3bc8f[_0xf509('0x4d')]['UserId']||_0x3bc8f[_0xf509('0x57')]['id'];_0x371c83['agent']['id']=_0x3bc8f[_0xf509('0x4d')][_0xf509('0x56')];return db['FaxMessage'][_0xf509('0x4e')]({'where':{'id':_0x3bc8f['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x71f1bf,null))['then'](saveUpdates(_0x3bc8f[_0xf509('0x4d')],null))[_0xf509('0x1d')](function(_0x37207b){if(_0x37207b){_0x371c83[_0xf509('0x25')]=_0x37207b[_0xf509('0x58')]({'plain':!![]});return db['FaxInteraction'][_0xf509('0x4e')]({'where':{'id':_0x37207b[_0xf509('0x59')]}});}return null;})['then'](handleEntityNotFound(_0x71f1bf,null))[_0xf509('0x1d')](function(_0x5f8b70){if(_0x5f8b70){return _0x5f8b70[_0xf509('0x5a')]({'UserId':_0x3bc8f[_0xf509('0x4d')]['UserId'],'read1stAt':_[_0xf509('0x5b')](_0x5f8b70['read1stAt'])?moment()['format'](_0xf509('0x5c')):undefined});}return null;})[_0xf509('0x1d')](function(_0x292986){if(_0x292986){_0x371c83[_0xf509('0x5d')]=_0x292986[_0xf509('0x58')]({'plain':!![]});interaction_log[_0xf509('0x1e')](_0xf509('0x5e'),_0x3bc8f[_0xf509('0x57')]['id'],_0x3bc8f[_0xf509('0x57')][_0xf509('0x34')],_0x3bc8f[_0xf509('0x57')]['role'],_0x371c83[_0xf509('0x5d')]['id'],_0x3bc8f[_0xf509('0x4d')]?JSON[_0xf509('0x5f')](_0x3bc8f[_0xf509('0x4d')]):_0xf509('0x60'));return respondWithRpcPromise(_0xf509('0x61'),_0xf509('0x62'),_0x371c83);}return null;})['then'](function(_0x3fb3a5){var _0x11da9d=_0xf509('0x63')+_0x3fb3a5[_0xf509('0x25')][_0xf509('0x64')];return db[_0xf509('0x65')][_0xf509('0x3b')](_0x11da9d,{'type':db[_0xf509('0x66')][_0xf509('0x67')][_0xf509('0x68')],'raw':!![]})[_0xf509('0x1d')](function(_0x423c9b){return _0x423c9b;});})[_0xf509('0x1d')](function(_0x451117){if(_0x451117){_0x371c83[_0xf509('0x25')][_0xf509('0x69')]=_0x451117[0x0];if(!_0x3bc8f[_0xf509('0x4d')]['UserId'])return;return db['User'][_0xf509('0x4e')]({'where':{'id':_0x3bc8f[_0xf509('0x4d')][_0xf509('0x56')],'role':_0xf509('0x6a')},'attributes':['id',_0xf509('0x34'),_0xf509('0x6b'),'email','internal'],'raw':!![]});}return null;})[_0xf509('0x1d')](function(_0x432ed4){if(!_0x432ed4)return null;_0x371c83[_0xf509('0x25')][_0xf509('0x6a')]=_0x432ed4;return _0x371c83;})[_0xf509('0x1d')](function(_0x183b94){if(_0x183b94){if(_0x3bc8f[_0xf509('0x4d')][_0xf509('0x6c')]){_0x371c83[_0xf509('0x25')][_0xf509('0x6d')]=util[_0xf509('0x55')](_0xf509('0x6e'),_0x3bc8f[_0xf509('0x57')][_0xf509('0x34')]);_0x371c83[_0xf509('0x25')]['channel']=_0x371c83['channel'];_0x371c83[_0xf509('0x25')]['motionChannel']=_0x371c83[_0xf509('0x6f')];_0x371c83[_0xf509('0x25')][_0xf509('0x70')]=_0xf509('0x51');return respondWithRpcPromise('EventManager',_0xf509('0x71'),{'event':_0xf509('0x72'),'message':_0x371c83[_0xf509('0x25')]},client9002)[_0xf509('0x1d')](function(){return _0x371c83;});}return _0x371c83;}return null;})[_0xf509('0x1d')](respondWithResult(_0x71f1bf,null))[_0xf509('0x27')](handleError(_0x71f1bf,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xf509('0x73')]=function(_0x4db32a,_0x401ea6,_0x40c727){var _0x2b779d={'agent':{},'channel':_0xf509('0x52')};if(_0x4db32a['body']['id']){delete _0x4db32a['body']['id'];}_0x4db32a[_0xf509('0x4d')][_0xf509('0x56')]=_0x4db32a['body']['UserId']||_0x4db32a['user']['id'];_0x2b779d[_0xf509('0x6a')]['id']=_0x4db32a[_0xf509('0x4d')][_0xf509('0x56')];return db[_0xf509('0x36')]['find']({'where':{'id':_0x4db32a[_0xf509('0x4c')]['id'],'UserId':null}})[_0xf509('0x1d')](handleEntityNotFound(_0x401ea6,null))['then'](function(_0x131c78){if(_0x131c78){_0x2b779d['message']=_0x131c78[_0xf509('0x58')]({'plain':!![]});return db[_0xf509('0x74')]['find']({'where':{'id':_0x131c78[_0xf509('0x59')]}});}return null;})[_0xf509('0x1d')](handleEntityNotFound(_0x401ea6,null))[_0xf509('0x1d')](function(_0x1c6ed2){if(_0x1c6ed2){_0x2b779d[_0xf509('0x5d')]=_0x1c6ed2['get']({'plain':!![]});interaction_log[_0xf509('0x1e')](_0xf509('0x75'),_0x4db32a[_0xf509('0x57')]['id'],_0x4db32a[_0xf509('0x57')][_0xf509('0x34')],_0x4db32a[_0xf509('0x57')]['role'],_0x2b779d[_0xf509('0x5d')]['id'],_0x4db32a['body']?JSON[_0xf509('0x5f')](_0x4db32a[_0xf509('0x4d')]):_0xf509('0x60'));return respondWithRpcPromise('RejectMessage',_0xf509('0x76'),_0x2b779d);}return null;})['then'](function(_0x4aecd9){var _0x4c12c8=_0xf509('0x63')+_0x4aecd9[_0xf509('0x25')][_0xf509('0x64')];return db[_0xf509('0x65')][_0xf509('0x3b')](_0x4c12c8,{'type':db['Sequelize'][_0xf509('0x67')][_0xf509('0x68')],'raw':!![]})[_0xf509('0x1d')](function(_0xd7a904){return _0xd7a904;});})[_0xf509('0x1d')](function(_0x25cd6f){if(_0x25cd6f){_0x2b779d[_0xf509('0x25')][_0xf509('0x69')]=_0x25cd6f[0x0];if(!_0x4db32a[_0xf509('0x4d')]['UserId'])return;return db[_0xf509('0x77')]['find']({'where':{'id':_0x4db32a['body'][_0xf509('0x56')],'role':_0xf509('0x6a')},'attributes':['id',_0xf509('0x34'),_0xf509('0x6b'),'email',_0xf509('0x78')],'raw':!![]});}return null;})[_0xf509('0x1d')](function(_0x2a6653){if(!_0x2a6653)return null;_0x2b779d[_0xf509('0x25')][_0xf509('0x6a')]=_0x2a6653;return _0x2b779d;})[_0xf509('0x1d')](function(_0x30477e){if(_0x30477e){_0x30477e[_0xf509('0x25')][_0xf509('0x6d')]=util[_0xf509('0x55')](_0xf509('0x6e'),_0x4db32a[_0xf509('0x57')][_0xf509('0x34')]);_0x30477e[_0xf509('0x25')]['channel']=_0x2b779d[_0xf509('0x6f')];_0x30477e[_0xf509('0x25')]['motionChannel']=_0x2b779d[_0xf509('0x6f')];_0x30477e[_0xf509('0x25')]['event']=_0xf509('0x73');respondWithRpcPromise('EventManager',_0xf509('0x71'),{'event':'rejectmessage','message':_0x30477e[_0xf509('0x25')]},client9002);return _0x2b779d;}return null;})[_0xf509('0x1d')](respondWithResult(_0x401ea6,null))['catch'](handleError(_0x401ea6,null));};exports[_0xf509('0x79')]=function(_0x5646fa,_0x32cced){var _0x5adaf4;return db['FaxMessage'][_0xf509('0x79')](_0x5646fa[_0xf509('0x4d')],{})[_0xf509('0x1d')](function(_0x513acf){_0x5adaf4=_0x513acf;return db['CmContact']['findOne']({'where':{'id':_0x5adaf4['ContactId']}});})[_0xf509('0x1d')](function(_0x464ccc){if(_[_0xf509('0x5b')](_0x464ccc)){return;}else{_0x5adaf4[_0xf509('0x52')]=_0x464ccc['fax'];return db[_0xf509('0x7a')]['findOne']({'where':{'id':_0x5adaf4[_0xf509('0x7b')]}});}})[_0xf509('0x1d')](function(_0xd6581){return respondWithRpcPromise('SendFax',_0xf509('0x7c'),{'FaxAccountId':_[_0xf509('0x5b')](_0x5646fa[_0xf509('0x4d')])?undefined:_0x5646fa['body'][_0xf509('0x7d')],'path':_[_0xf509('0x5b')](_0xd6581)?undefined:util[_0xf509('0x55')]('/var/opt/motion2/server/files/attachments/%s',_0xd6581[_0xf509('0x7e')]),'fax':_[_0xf509('0x5b')](_0x5adaf4[_0xf509('0x52')])?undefined:_0x5adaf4[_0xf509('0x52')],'AttachmentId':_0x5adaf4[_0xf509('0x7b')]},client9002);})['then'](respondWithResult(_0x32cced,0xc9))[_0xf509('0x27')](handleError(_0x32cced,null));};exports[_0xf509('0x7f')]=function(_0x5b7cae,_0x3746f0){var _0x345f42=path[_0xf509('0x80')](config['root'],_0xf509('0x81'),_0xf509('0x82'),_0xf509('0x83'));return db[_0xf509('0x36')]['find']({'where':{'id':_0x5b7cae[_0xf509('0x4c')]['id']},'include':[{'model':db[_0xf509('0x7a')],'as':_0xf509('0x7a')}]})['then'](handleEntityNotFound(_0x3746f0,null))[_0xf509('0x1d')](function(_0x5e914f){if(_0x5e914f){return _0x3746f0['download'](path['join'](_0x345f42,_0x5e914f[_0xf509('0x7a')][_0xf509('0x7e')]));}})[_0xf509('0x27')](handleError(_0x3746f0,null));}; \ No newline at end of file +var _0xdaa1=['name','send','index','map','FaxMessage','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','keys','include','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','SIP/%s','channel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','email','interface','motionChannel','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack'];(function(_0x1054c9,_0x5d6fd2){var _0x31e22e=function(_0x541b2a){while(--_0x541b2a){_0x1054c9['push'](_0x1054c9['shift']());}};_0x31e22e(++_0x5d6fd2);}(_0xdaa1,0xec));var _0x1daa=function(_0x223451,_0xf4b0c3){_0x223451=_0x223451-0x0;var _0x3c0101=_0xdaa1[_0x223451];return _0x3c0101;};'use strict';var emlformat=require(_0x1daa('0x0'));var rimraf=require(_0x1daa('0x1'));var zipdir=require(_0x1daa('0x2'));var jsonpatch=require(_0x1daa('0x3'));var rp=require(_0x1daa('0x4'));var moment=require(_0x1daa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1daa('0x6'));var util=require(_0x1daa('0x7'));var path=require(_0x1daa('0x8'));var sox=require(_0x1daa('0x9'));var csv=require(_0x1daa('0xa'));var ejs=require(_0x1daa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1daa('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1daa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1daa('0xa'));var querystring=require(_0x1daa('0xe'));var Papa=require(_0x1daa('0xf'));var Redis=require(_0x1daa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1daa('0x11'));var as=require(_0x1daa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1daa('0x13'))('api');var utils=require(_0x1daa('0x14'));var config=require(_0x1daa('0x15'));var licenseUtil=require(_0x1daa('0x16'));var db=require(_0x1daa('0x17'))['db'];config[_0x1daa('0x18')]=_[_0x1daa('0x19')](config['redis'],{'host':_0x1daa('0x1a'),'port':0x18eb});var socket=require(_0x1daa('0x1b'))(new Redis(config[_0x1daa('0x18')]));require(_0x1daa('0x1c'))[_0x1daa('0x1d')](socket);var jayson=require(_0x1daa('0x1e'));var client=jayson[_0x1daa('0x1f')][_0x1daa('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x41af76,_0x4c558f,_0x1908d4,_0x2418c7){return new BPromise(function(_0xa5fc61,_0x205a63){var _0x3033a1=_0x2418c7||client;return _0x3033a1[_0x1daa('0x21')](_0x41af76,_0x1908d4)[_0x1daa('0x22')](function(_0x5b6878){logger[_0x1daa('0x23')](_0x1daa('0x24'),_0x4c558f,'request\x20sent');logger[_0x1daa('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4c558f,_0x1daa('0x26'),JSON[_0x1daa('0x27')](_0x5b6878));if(_0x5b6878['error']){if(_0x5b6878['error'][_0x1daa('0x28')]===0x1f4){logger[_0x1daa('0x29')](_0x1daa('0x24'),_0x4c558f,_0x5b6878[_0x1daa('0x29')]['message']);return _0x205a63(_0x5b6878[_0x1daa('0x29')][_0x1daa('0x2a')]);}logger[_0x1daa('0x29')](_0x1daa('0x24'),_0x4c558f,_0x5b6878[_0x1daa('0x29')][_0x1daa('0x2a')]);return _0xa5fc61(_0x5b6878[_0x1daa('0x29')][_0x1daa('0x2a')]);}else{logger[_0x1daa('0x23')](_0x1daa('0x24'),_0x4c558f,_0x1daa('0x26'));_0xa5fc61(_0x5b6878[_0x1daa('0x2b')][_0x1daa('0x2a')]);}})['catch'](function(_0x553877){logger['error'](_0x1daa('0x24'),_0x4c558f,_0x553877);_0x205a63(_0x553877);});});}function respondWithStatusCode(_0x31bac2,_0x4d35b3){_0x4d35b3=_0x4d35b3||0xcc;return function(_0x1302f9){if(_0x1302f9){return _0x31bac2[_0x1daa('0x2c')](_0x4d35b3);}return _0x31bac2[_0x1daa('0x2d')](_0x4d35b3)[_0x1daa('0x2e')]();};}function respondWithResult(_0x287382,_0xa11b46){_0xa11b46=_0xa11b46||0xc8;return function(_0x1cecd6){if(_0x1cecd6){return _0x287382['status'](_0xa11b46)[_0x1daa('0x2f')](_0x1cecd6);}};}function respondWithFilteredResult(_0x487594,_0x34eea1){return function(_0x591109){if(_0x591109){var _0x482371=typeof _0x34eea1['offset']===_0x1daa('0x30')&&typeof _0x34eea1['limit']==='undefined';var _0x5f1518=_0x591109['count'];var _0x2e7338=_0x482371?0x0:_0x34eea1[_0x1daa('0x31')];var _0x22fb39=_0x482371?_0x591109[_0x1daa('0x32')]:_0x34eea1['offset']+_0x34eea1[_0x1daa('0x33')];var _0x5731a8;if(_0x22fb39>=_0x5f1518){_0x22fb39=_0x5f1518;_0x5731a8=0xc8;}else{_0x5731a8=0xce;}_0x487594[_0x1daa('0x2d')](_0x5731a8);return _0x487594[_0x1daa('0x34')](_0x1daa('0x35'),_0x2e7338+'-'+_0x22fb39+'/'+_0x5f1518)['json'](_0x591109);}return null;};}function patchUpdates(_0x535f7f){return function(_0x4a9ba1){try{jsonpatch[_0x1daa('0x36')](_0x4a9ba1,_0x535f7f,!![]);}catch(_0xc7969b){return BPromise[_0x1daa('0x37')](_0xc7969b);}return _0x4a9ba1[_0x1daa('0x38')]();};}function saveUpdates(_0x62aae1,_0x504308){return function(_0x29a637){if(_0x29a637){return _0x29a637[_0x1daa('0x39')](_0x62aae1)[_0x1daa('0x22')](function(_0x1398d0){return _0x1398d0;});}return null;};}function removeEntity(_0x3f9390,_0x562a40){return function(_0x50b483){if(_0x50b483){return _0x50b483[_0x1daa('0x3a')]()[_0x1daa('0x22')](function(){_0x3f9390['status'](0xcc)[_0x1daa('0x2e')]();});}};}function handleEntityNotFound(_0x1fd1c1,_0x1bbaf3){return function(_0x5103f1){if(!_0x5103f1){_0x1fd1c1[_0x1daa('0x2c')](0x194);}return _0x5103f1;};}function handleError(_0x425f1d,_0x4cf0b4){_0x4cf0b4=_0x4cf0b4||0x1f4;return function(_0x12b312){logger['error'](_0x12b312[_0x1daa('0x3b')]);if(_0x12b312[_0x1daa('0x3c')]){delete _0x12b312[_0x1daa('0x3c')];}_0x425f1d[_0x1daa('0x2d')](_0x4cf0b4)[_0x1daa('0x3d')](_0x12b312);};}exports[_0x1daa('0x3e')]=function(_0x2b178f,_0x3a930a){var _0x5114a8={},_0x3394a5={},_0x17a7fd={'count':0x0,'rows':[]};var _0x2c03ac=_[_0x1daa('0x3f')](db[_0x1daa('0x40')]['rawAttributes'],function(_0x237efc){return{'name':_0x237efc[_0x1daa('0x41')],'type':_0x237efc['type'][_0x1daa('0x42')]};});_0x3394a5[_0x1daa('0x43')]=_['map'](_0x2c03ac,'name');_0x3394a5[_0x1daa('0x44')]=_['keys'](_0x2b178f['query']);_0x3394a5[_0x1daa('0x45')]=_[_0x1daa('0x46')](_0x3394a5[_0x1daa('0x43')],_0x3394a5[_0x1daa('0x44')]);_0x5114a8[_0x1daa('0x47')]=_['intersection'](_0x3394a5['model'],qs[_0x1daa('0x48')](_0x2b178f[_0x1daa('0x44')][_0x1daa('0x48')]));_0x5114a8[_0x1daa('0x47')]=_0x5114a8[_0x1daa('0x47')][_0x1daa('0x49')]?_0x5114a8['attributes']:_0x3394a5['model'];if(!_0x2b178f[_0x1daa('0x44')]['hasOwnProperty'](_0x1daa('0x4a'))){_0x5114a8[_0x1daa('0x33')]=qs[_0x1daa('0x33')](_0x2b178f['query'][_0x1daa('0x33')]);_0x5114a8[_0x1daa('0x31')]=qs[_0x1daa('0x31')](_0x2b178f[_0x1daa('0x44')]['offset']);}_0x5114a8[_0x1daa('0x4b')]=qs[_0x1daa('0x4c')](_0x2b178f[_0x1daa('0x44')][_0x1daa('0x4c')]);_0x5114a8[_0x1daa('0x4d')]=qs[_0x1daa('0x45')](_[_0x1daa('0x4e')](_0x2b178f['query'],_0x3394a5[_0x1daa('0x45')]),_0x2c03ac);if(_0x2b178f['query'][_0x1daa('0x4f')]){_0x5114a8[_0x1daa('0x4d')]=_[_0x1daa('0x50')](_0x5114a8['where'],{'$or':_[_0x1daa('0x3f')](_0x2c03ac,function(_0x36ad81){if(_0x36ad81[_0x1daa('0x51')]!==_0x1daa('0x52')){var _0xfa43f2={};_0xfa43f2[_0x36ad81[_0x1daa('0x3c')]]={'$like':'%'+_0x2b178f[_0x1daa('0x44')][_0x1daa('0x4f')]+'%'};return _0xfa43f2;}})});}_0x5114a8=_[_0x1daa('0x50')]({},_0x5114a8,_0x2b178f[_0x1daa('0x53')]);var _0x418e60={'where':_0x5114a8['where']};return db[_0x1daa('0x40')]['count'](_0x418e60)[_0x1daa('0x22')](function(_0x3d5671){_0x17a7fd['count']=_0x3d5671;if(_0x2b178f[_0x1daa('0x44')][_0x1daa('0x54')]){_0x5114a8['include']=[{'all':!![]}];}return db[_0x1daa('0x40')]['findAll'](_0x5114a8);})[_0x1daa('0x22')](function(_0x1717d0){_0x17a7fd[_0x1daa('0x55')]=_0x1717d0;return _0x17a7fd;})[_0x1daa('0x22')](respondWithFilteredResult(_0x3a930a,_0x5114a8))[_0x1daa('0x56')](handleError(_0x3a930a,null));};exports[_0x1daa('0x57')]=function(_0x375934,_0xb281a0){var _0x43dfe5={'raw':!![],'where':{'id':_0x375934[_0x1daa('0x58')]['id']}},_0x2b1816={};_0x2b1816[_0x1daa('0x43')]=_['keys'](db[_0x1daa('0x40')]['rawAttributes']);_0x2b1816[_0x1daa('0x44')]=_[_0x1daa('0x59')](_0x375934[_0x1daa('0x44')]);_0x2b1816[_0x1daa('0x45')]=_[_0x1daa('0x46')](_0x2b1816['model'],_0x2b1816['query']);_0x43dfe5[_0x1daa('0x47')]=_['intersection'](_0x2b1816[_0x1daa('0x43')],qs[_0x1daa('0x48')](_0x375934['query']['fields']));_0x43dfe5[_0x1daa('0x47')]=_0x43dfe5[_0x1daa('0x47')][_0x1daa('0x49')]?_0x43dfe5[_0x1daa('0x47')]:_0x2b1816[_0x1daa('0x43')];if(_0x375934[_0x1daa('0x44')][_0x1daa('0x54')]){_0x43dfe5[_0x1daa('0x5a')]=[{'all':!![]}];}_0x43dfe5=_[_0x1daa('0x50')]({},_0x43dfe5,_0x375934['options']);return db['FaxMessage'][_0x1daa('0x5b')](_0x43dfe5)['then'](handleEntityNotFound(_0xb281a0,null))[_0x1daa('0x22')](respondWithResult(_0xb281a0,null))['catch'](handleError(_0xb281a0,null));};exports[_0x1daa('0x39')]=function(_0x3f9b00,_0x5cac4c){if(_0x3f9b00[_0x1daa('0x5c')]['id']){delete _0x3f9b00[_0x1daa('0x5c')]['id'];}return db[_0x1daa('0x40')][_0x1daa('0x5b')]({'where':{'id':_0x3f9b00[_0x1daa('0x58')]['id']}})['then'](handleEntityNotFound(_0x5cac4c,null))[_0x1daa('0x22')](saveUpdates(_0x3f9b00[_0x1daa('0x5c')],null))['then'](respondWithResult(_0x5cac4c,null))[_0x1daa('0x56')](handleError(_0x5cac4c,null));};exports[_0x1daa('0x3a')]=function(_0x2f9abd,_0x4f51b6){return db[_0x1daa('0x40')][_0x1daa('0x5b')]({'where':{'id':_0x2f9abd[_0x1daa('0x58')]['id']}})[_0x1daa('0x22')](handleEntityNotFound(_0x4f51b6,null))[_0x1daa('0x22')](removeEntity(_0x4f51b6,null))[_0x1daa('0x56')](handleError(_0x4f51b6,null));};exports[_0x1daa('0x5d')]=function(_0x444da0,_0x410c8d){return db[_0x1daa('0x40')][_0x1daa('0x5d')]()[_0x1daa('0x22')](respondWithResult(_0x410c8d,null))[_0x1daa('0x56')](handleError(_0x410c8d,null));};var interaction_log=require(_0x1daa('0x13'))(_0x1daa('0x5e'));exports[_0x1daa('0x5f')]=function(_0x6eadbb,_0x390f14,_0x290194){var _0x9fd1f9={'agent':{},'channel':_0x1daa('0x60')};if(_0x6eadbb['body']['id']){delete _0x6eadbb[_0x1daa('0x5c')]['id'];}_0x6eadbb[_0x1daa('0x5c')][_0x1daa('0x61')]=!![];_0x6eadbb[_0x1daa('0x5c')][_0x1daa('0x62')]=moment()[_0x1daa('0x63')](_0x1daa('0x64'));_0x6eadbb[_0x1daa('0x5c')][_0x1daa('0x65')]=_0x6eadbb[_0x1daa('0x5c')][_0x1daa('0x65')]||_0x6eadbb[_0x1daa('0x66')]['id'];_0x9fd1f9['agent']['id']=_0x6eadbb['body'][_0x1daa('0x65')];return db[_0x1daa('0x40')][_0x1daa('0x5b')]({'where':{'id':_0x6eadbb[_0x1daa('0x58')]['id'],'UserId':null}})[_0x1daa('0x22')](handleEntityNotFound(_0x390f14,null))[_0x1daa('0x22')](saveUpdates(_0x6eadbb[_0x1daa('0x5c')],null))['then'](function(_0x2f0ef8){if(_0x2f0ef8){_0x9fd1f9[_0x1daa('0x2a')]=_0x2f0ef8[_0x1daa('0x67')]({'plain':!![]});return db['FaxInteraction'][_0x1daa('0x5b')]({'where':{'id':_0x2f0ef8['FaxInteractionId']}});}return null;})[_0x1daa('0x22')](handleEntityNotFound(_0x390f14,null))[_0x1daa('0x22')](function(_0x18fd1e){if(_0x18fd1e){return _0x18fd1e[_0x1daa('0x39')]({'UserId':_0x6eadbb['body']['UserId'],'read1stAt':_[_0x1daa('0x68')](_0x18fd1e[_0x1daa('0x69')])?moment()[_0x1daa('0x63')](_0x1daa('0x64')):undefined});}return null;})[_0x1daa('0x22')](function(_0x394f19){if(_0x394f19){_0x9fd1f9['interaction']=_0x394f19[_0x1daa('0x67')]({'plain':!![]});interaction_log['info'](_0x1daa('0x6a'),_0x6eadbb[_0x1daa('0x66')]['id'],_0x6eadbb[_0x1daa('0x66')][_0x1daa('0x3c')],_0x6eadbb[_0x1daa('0x66')][_0x1daa('0x6b')],_0x9fd1f9[_0x1daa('0x6c')]['id'],_0x6eadbb['body']?JSON['stringify'](_0x6eadbb[_0x1daa('0x5c')]):'null');return respondWithRpcPromise(_0x1daa('0x6d'),_0x1daa('0x6e'),_0x9fd1f9);}return null;})[_0x1daa('0x22')](function(_0x4c4d6f){var _0x667b24='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4c4d6f[_0x1daa('0x2a')][_0x1daa('0x6f')];return db[_0x1daa('0x70')][_0x1daa('0x44')](_0x667b24,{'type':db['Sequelize'][_0x1daa('0x71')][_0x1daa('0x72')],'raw':!![]})['then'](function(_0x22b8ec){return _0x22b8ec;});})['then'](function(_0x2d3cba){if(_0x2d3cba){_0x9fd1f9[_0x1daa('0x2a')][_0x1daa('0x73')]=_0x2d3cba[0x0];if(!_0x6eadbb[_0x1daa('0x5c')][_0x1daa('0x65')])return;return db[_0x1daa('0x74')]['find']({'where':{'id':_0x6eadbb[_0x1daa('0x5c')][_0x1daa('0x65')],'role':_0x1daa('0x75')},'attributes':['id',_0x1daa('0x3c'),_0x1daa('0x76'),'email',_0x1daa('0x77')],'raw':!![]});}return null;})[_0x1daa('0x22')](function(_0x452a5f){if(!_0x452a5f)return null;_0x9fd1f9[_0x1daa('0x2a')][_0x1daa('0x75')]=_0x452a5f;return _0x9fd1f9;})['then'](function(_0x54c80d){if(_0x54c80d){if(_0x6eadbb[_0x1daa('0x5c')][_0x1daa('0x78')]){_0x9fd1f9[_0x1daa('0x2a')]['interface']=util[_0x1daa('0x63')](_0x1daa('0x79'),_0x6eadbb[_0x1daa('0x66')][_0x1daa('0x3c')]);_0x9fd1f9[_0x1daa('0x2a')][_0x1daa('0x7a')]=_0x9fd1f9[_0x1daa('0x7a')];_0x9fd1f9[_0x1daa('0x2a')]['motionChannel']=_0x9fd1f9['channel'];_0x9fd1f9[_0x1daa('0x2a')][_0x1daa('0x7b')]=_0x1daa('0x5f');return respondWithRpcPromise('EventManager',_0x1daa('0x7c'),{'event':'acceptmessage','message':_0x9fd1f9[_0x1daa('0x2a')]},client9002)[_0x1daa('0x22')](function(){return _0x9fd1f9;});}return _0x9fd1f9;}return null;})[_0x1daa('0x22')](respondWithResult(_0x390f14,null))[_0x1daa('0x56')](handleError(_0x390f14,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x1daa('0x37')]=function(_0x3edd24,_0x1ee37d,_0x4ac800){var _0x39e925={'agent':{},'channel':_0x1daa('0x60')};if(_0x3edd24[_0x1daa('0x5c')]['id']){delete _0x3edd24[_0x1daa('0x5c')]['id'];}_0x3edd24[_0x1daa('0x5c')][_0x1daa('0x65')]=_0x3edd24[_0x1daa('0x5c')][_0x1daa('0x65')]||_0x3edd24[_0x1daa('0x66')]['id'];_0x39e925['agent']['id']=_0x3edd24[_0x1daa('0x5c')][_0x1daa('0x65')];return db[_0x1daa('0x40')][_0x1daa('0x5b')]({'where':{'id':_0x3edd24[_0x1daa('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1ee37d,null))[_0x1daa('0x22')](function(_0x85707){if(_0x85707){_0x39e925[_0x1daa('0x2a')]=_0x85707[_0x1daa('0x67')]({'plain':!![]});return db['FaxInteraction'][_0x1daa('0x5b')]({'where':{'id':_0x85707['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1ee37d,null))['then'](function(_0x5bf9c4){if(_0x5bf9c4){_0x39e925['interaction']=_0x5bf9c4['get']({'plain':!![]});interaction_log[_0x1daa('0x23')](_0x1daa('0x7d'),_0x3edd24[_0x1daa('0x66')]['id'],_0x3edd24[_0x1daa('0x66')]['name'],_0x3edd24[_0x1daa('0x66')]['role'],_0x39e925[_0x1daa('0x6c')]['id'],_0x3edd24[_0x1daa('0x5c')]?JSON[_0x1daa('0x27')](_0x3edd24[_0x1daa('0x5c')]):_0x1daa('0x7e'));return respondWithRpcPromise(_0x1daa('0x7f'),_0x1daa('0x80'),_0x39e925);}return null;})[_0x1daa('0x22')](function(_0xb5090b){var _0x1944ca=_0x1daa('0x81')+_0xb5090b[_0x1daa('0x2a')]['ContactId'];return db['sequelize']['query'](_0x1944ca,{'type':db[_0x1daa('0x82')][_0x1daa('0x71')][_0x1daa('0x72')],'raw':!![]})[_0x1daa('0x22')](function(_0x4b09d3){return _0x4b09d3;});})['then'](function(_0x21828f){if(_0x21828f){_0x39e925[_0x1daa('0x2a')][_0x1daa('0x73')]=_0x21828f[0x0];if(!_0x3edd24[_0x1daa('0x5c')][_0x1daa('0x65')])return;return db[_0x1daa('0x74')][_0x1daa('0x5b')]({'where':{'id':_0x3edd24[_0x1daa('0x5c')][_0x1daa('0x65')],'role':'agent'},'attributes':['id',_0x1daa('0x3c'),_0x1daa('0x76'),_0x1daa('0x83'),_0x1daa('0x77')],'raw':!![]});}return null;})[_0x1daa('0x22')](function(_0x2fff75){if(!_0x2fff75)return null;_0x39e925[_0x1daa('0x2a')][_0x1daa('0x75')]=_0x2fff75;return _0x39e925;})[_0x1daa('0x22')](function(_0x38cadc){if(_0x38cadc){_0x38cadc['message'][_0x1daa('0x84')]=util['format'](_0x1daa('0x79'),_0x3edd24[_0x1daa('0x66')]['name']);_0x38cadc[_0x1daa('0x2a')][_0x1daa('0x7a')]=_0x39e925[_0x1daa('0x7a')];_0x38cadc[_0x1daa('0x2a')][_0x1daa('0x85')]=_0x39e925['channel'];_0x38cadc[_0x1daa('0x2a')][_0x1daa('0x7b')]='reject';respondWithRpcPromise('EventManager',_0x1daa('0x7c'),{'event':_0x1daa('0x86'),'message':_0x38cadc[_0x1daa('0x2a')]},client9002);return _0x39e925;}return null;})[_0x1daa('0x22')](respondWithResult(_0x1ee37d,null))[_0x1daa('0x56')](handleError(_0x1ee37d,null));};exports[_0x1daa('0x87')]=function(_0x585b8a,_0x1ebef3){var _0x4bb2eb;return db[_0x1daa('0x40')]['create'](_0x585b8a[_0x1daa('0x5c')],{})[_0x1daa('0x22')](function(_0x324224){_0x4bb2eb=_0x324224;return db['CmContact'][_0x1daa('0x88')]({'where':{'id':_0x4bb2eb[_0x1daa('0x6f')]}});})[_0x1daa('0x22')](function(_0x50fb04){if(_[_0x1daa('0x68')](_0x50fb04)){return;}else{_0x4bb2eb[_0x1daa('0x60')]=_0x50fb04[_0x1daa('0x60')];return db[_0x1daa('0x89')]['findOne']({'where':{'id':_0x4bb2eb[_0x1daa('0x8a')]}});}})[_0x1daa('0x22')](function(_0x16ac17){return respondWithRpcPromise(_0x1daa('0x8b'),'SendFax',{'FaxAccountId':_['isNil'](_0x585b8a[_0x1daa('0x5c')])?undefined:_0x585b8a['body'][_0x1daa('0x8c')],'path':_[_0x1daa('0x68')](_0x16ac17)?undefined:util['format'](_0x1daa('0x8d'),_0x16ac17[_0x1daa('0x8e')]),'fax':_[_0x1daa('0x68')](_0x4bb2eb['fax'])?undefined:_0x4bb2eb[_0x1daa('0x60')],'AttachmentId':_0x4bb2eb[_0x1daa('0x8a')]},client9002);})[_0x1daa('0x22')](respondWithResult(_0x1ebef3,0xc9))[_0x1daa('0x56')](handleError(_0x1ebef3,null));};exports[_0x1daa('0x8f')]=function(_0x195540,_0x58f05e){var _0x10c7d0=path[_0x1daa('0x90')](config[_0x1daa('0x91')],_0x1daa('0x92'),'files',_0x1daa('0x93'));return db[_0x1daa('0x40')]['find']({'where':{'id':_0x195540['params']['id']},'include':[{'model':db[_0x1daa('0x89')],'as':_0x1daa('0x89')}]})['then'](handleEntityNotFound(_0x58f05e,null))['then'](function(_0x194cd5){if(_0x194cd5){return _0x58f05e[_0x1daa('0x8f')](path['join'](_0x10c7d0,_0x194cd5[_0x1daa('0x89')][_0x1daa('0x8e')]));}})[_0x1daa('0x56')](handleError(_0x58f05e,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 6f3f945..d34dd52 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 _0xf417=['FaxMessage','setMaxListeners','update','hasOwnProperty','exports','../../mysqldb'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xf417,0x8f));var _0x7f41=function(_0x34217f,_0x4954d9){_0x34217f=_0x34217f-0x0;var _0x533721=_0xf417[_0x34217f];return _0x533721;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x7f41('0x0'))['db'][_0x7f41('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7f41('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7f41('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4c7081){return function(_0x2b7d4c,_0x5170ec,_0x51b0cb){FaxMessageEvents['emit'](_0x4c7081+':'+_0x2b7d4c['id'],_0x2b7d4c);FaxMessageEvents['emit'](_0x4c7081,_0x2b7d4c);_0x51b0cb(null);};}for(var e in events){if(events[_0x7f41('0x4')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x7f41('0x5')]=FaxMessageEvents; \ No newline at end of file +var _0xde3a=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x4ed15b,_0x498255){var _0x52459a=function(_0x28f20d){while(--_0x28f20d){_0x4ed15b['push'](_0x4ed15b['shift']());}};_0x52459a(++_0x498255);}(_0xde3a,0x140));var _0xade3=function(_0x43d621,_0x3978e3){_0x43d621=_0x43d621-0x0;var _0x39c561=_0xde3a[_0x43d621];return _0x39c561;};'use strict';var EventEmitter=require(_0xade3('0x0'));var FaxMessage=require(_0xade3('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xade3('0x2'),'afterDestroy':_0xade3('0x3')};function emitEvent(_0x103750){return function(_0x13794b,_0x2641cb,_0x2a7184){FaxMessageEvents[_0xade3('0x4')](_0x103750+':'+_0x13794b['id'],_0x13794b);FaxMessageEvents[_0xade3('0x4')](_0x103750,_0x13794b);_0x2a7184(null);};}for(var e in events){if(events[_0xade3('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xade3('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 52cdf7d..0c8f825 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 _0xcba4=['toLowerCase','out','UserId','FaxInteraction','findOne','then','update','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction'];(function(_0x5a06ac,_0x72c5a5){var _0x54b98b=function(_0x81bc62){while(--_0x81bc62){_0x5a06ac['push'](_0x5a06ac['shift']());}};_0x54b98b(++_0x72c5a5);}(_0xcba4,0x183));var _0x4cba=function(_0x1659b6,_0xd5b65d){_0x1659b6=_0x1659b6-0x0;var _0x140a63=_0xcba4[_0x1659b6];return _0x140a63;};'use strict';var _=require(_0x4cba('0x0'));var util=require(_0x4cba('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4cba('0x2'));var BPromise=require(_0x4cba('0x3'));var rp=require(_0x4cba('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4cba('0x5'));var config=require(_0x4cba('0x6'));var attributes=require(_0x4cba('0x7'));module[_0x4cba('0x8')]=function(_0x1f8f16,_0x3c2f8d){return _0x1f8f16[_0x4cba('0x9')](_0x4cba('0xa'),attributes,{'tableName':_0x4cba('0xb'),'paranoid':![],'indexes':[{'name':_0x4cba('0xc'),'fields':[_0x4cba('0xd')],'type':_0x4cba('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x344551,_0x2df518,_0x1ab362){var _0x49418a=_0x1f8f16[_0x4cba('0xf')];var _0x268025=_0x344551[_0x4cba('0x10')]({'plain':!![]});if(_0x268025[_0x4cba('0x11')][_0x4cba('0x12')]()==='in'||_0x268025[_0x4cba('0x11')][_0x4cba('0x12')]()===_0x4cba('0x13')&&!_0x268025['secret']&&!_['isNil'](_0x268025[_0x4cba('0x14')])){_0x49418a[_0x4cba('0x15')][_0x4cba('0x16')]({'where':{'id':_0x268025['FaxInteractionId']}})[_0x4cba('0x17')](function(_0x4897e7){if(_0x4897e7){_0x4897e7[_0x4cba('0x18')]({'lastMsgAt':_0x268025['createdAt'],'lastMsgDirection':_0x268025['direction'][_0x4cba('0x12')]()});}})['catch'](function(_0x5d86af){console['error'](_0x5d86af);});}_0x1ab362();}},'charset':_0x4cba('0x19'),'collate':_0x4cba('0x1a')});}; \ No newline at end of file +var _0xccfa=['bluebird','request-promise','path','rimraf','../../config/environment','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','direction','secret','isNil','UserId','findOne','then','toLowerCase','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x584f4e,_0x5c3950){var _0x23bc8=function(_0x3f106b){while(--_0x3f106b){_0x584f4e['push'](_0x584f4e['shift']());}};_0x23bc8(++_0x5c3950);}(_0xccfa,0x1cf));var _0xaccf=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xccfa[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0xaccf('0x0'));var util=require(_0xaccf('0x1'));var logger=require(_0xaccf('0x2'))(_0xaccf('0x3'));var moment=require(_0xaccf('0x4'));var BPromise=require(_0xaccf('0x5'));var rp=require(_0xaccf('0x6'));var fs=require('fs');var path=require(_0xaccf('0x7'));var rimraf=require(_0xaccf('0x8'));var config=require(_0xaccf('0x9'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x4382cd,_0x3d6e86){return _0x4382cd[_0xaccf('0xa')](_0xaccf('0xb'),attributes,{'tableName':_0xaccf('0xc'),'paranoid':![],'indexes':[{'name':_0xaccf('0xd'),'fields':['body'],'type':_0xaccf('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x58babc,_0x2ad0f4,_0x4cd38c){var _0x588c20=_0x4382cd[_0xaccf('0xf')];var _0x2817e2=_0x58babc['get']({'plain':!![]});if(_0x2817e2[_0xaccf('0x10')]['toLowerCase']()==='in'||_0x2817e2[_0xaccf('0x10')]['toLowerCase']()==='out'&&!_0x2817e2[_0xaccf('0x11')]&&!_[_0xaccf('0x12')](_0x2817e2[_0xaccf('0x13')])){_0x588c20['FaxInteraction'][_0xaccf('0x14')]({'where':{'id':_0x2817e2['FaxInteractionId']}})[_0xaccf('0x15')](function(_0x5ed0e7){if(_0x5ed0e7){_0x5ed0e7['update']({'lastMsgAt':_0x2817e2['createdAt'],'lastMsgDirection':_0x2817e2[_0xaccf('0x10')][_0xaccf('0x16')]()});}})[_0xaccf('0x17')](function(_0x1c5849){console[_0xaccf('0x18')](_0x1c5849);});}_0x4cd38c();}},'charset':_0xaccf('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 97fbeca..1e563cc 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 _0x9957=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','body','options','raw','CreateFaxMessage','catch','UpdateFaxMessage','FaxMessage','where','attributes','lodash'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_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 moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});config[_0x7995('0xc')]=_[_0x7995('0xd')](config['redis'],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require(_0x7995('0xf'))(new Redis(config['redis']));require(_0x7995('0x10'))[_0x7995('0x11')](socket);function respondWithRpcPromise(_0x18c8a3,_0x35b5fe,_0x3c1d19){return new BPromise(function(_0x1e400a,_0x341672){return client['request'](_0x18c8a3,_0x3c1d19)[_0x7995('0x12')](function(_0x41c652){logger['info'](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x35b5fe,_0x7995('0x14'),JSON[_0x7995('0x17')](_0x41c652));if(_0x41c652[_0x7995('0x18')]){if(_0x41c652['error']['code']===0x1f4){logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);return _0x341672(_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);}logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652['error'][_0x7995('0x19')]);return _0x1e400a(_0x41c652['error'][_0x7995('0x19')]);}else{logger[_0x7995('0x1a')](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));_0x1e400a(_0x41c652[_0x7995('0x1b')][_0x7995('0x19')]);}})['catch'](function(_0x54c9ae){logger[_0x7995('0x18')]('FaxMessage,\x20%s,\x20%s',_0x35b5fe,_0x54c9ae);_0x341672(_0x54c9ae);});});}exports['CreateFaxMessage']=function(_0x3ec178){var _0x3d463e=this;return new Promise(function(_0x4cbe10,_0x3a9b54){return db['FaxMessage']['create'](_0x3ec178[_0x7995('0x1c')],{'raw':_0x3ec178[_0x7995('0x1d')]?_0x3ec178[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![]})[_0x7995('0x12')](function(_0x1c278a){logger['info'](_0x7995('0x1f'),_0x3ec178);logger[_0x7995('0x15')](_0x7995('0x1f'),_0x3ec178,JSON[_0x7995('0x17')](_0x1c278a));_0x4cbe10(_0x1c278a);})[_0x7995('0x20')](function(_0x13bc35){logger[_0x7995('0x18')](_0x7995('0x1f'),_0x13bc35['message'],_0x3ec178);_0x3a9b54(_0x3d463e[_0x7995('0x18')](0x1f4,_0x13bc35[_0x7995('0x19')]));});});};exports[_0x7995('0x21')]=function(_0x268ce7){var _0x3a3fcf=this;return new Promise(function(_0x2a307e,_0x56691a){return db[_0x7995('0x22')]['update'](_0x268ce7[_0x7995('0x1c')],{'raw':_0x268ce7[_0x7995('0x1d')]?_0x268ce7[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options'][_0x7995('0x23')]||null:null,'attributes':_0x268ce7['options']?_0x268ce7[_0x7995('0x1d')][_0x7995('0x24')]||null:null,'limit':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options']['limit']||null:null})['then'](function(_0x3573be){logger[_0x7995('0x1a')](_0x7995('0x21'),_0x268ce7);logger[_0x7995('0x15')](_0x7995('0x21'),_0x268ce7,JSON[_0x7995('0x17')](_0x3573be));_0x2a307e(_0x3573be);})['catch'](function(_0x481c74){logger[_0x7995('0x18')]('UpdateFaxMessage',_0x481c74[_0x7995('0x19')],_0x268ce7);_0x56691a(_0x3a3fcf[_0x7995('0x18')](0x1f4,_0x481c74[_0x7995('0x19')]));});});}; \ No newline at end of file +var _0xac9d=['then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxMessage','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request'];(function(_0x3c9029,_0x430b59){var _0x32fc83=function(_0x56011a){while(--_0x56011a){_0x3c9029['push'](_0x3c9029['shift']());}};_0x32fc83(++_0x430b59);}(_0xac9d,0x14d));var _0xdac9=function(_0x3d2511,_0x2938e7){_0x3d2511=_0x3d2511-0x0;var _0x1cc3c0=_0xac9d[_0x3d2511];return _0x1cc3c0;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});}exports['CreateFaxMessage']=function(_0x520369){var _0x4029fc=this;return new Promise(function(_0x20ece3,_0x2b9d91){return db[_0xdac9('0x1d')]['create'](_0x520369[_0xdac9('0x1e')],{'raw':_0x520369[_0xdac9('0x1f')]?_0x520369[_0xdac9('0x1f')][_0xdac9('0x20')]===undefined?!![]:![]:!![]})[_0xdac9('0x12')](function(_0x42317c){logger[_0xdac9('0x13')](_0xdac9('0x21'),_0x520369);logger[_0xdac9('0x15')](_0xdac9('0x21'),_0x520369,JSON['stringify'](_0x42317c));_0x20ece3(_0x42317c);})[_0xdac9('0x1c')](function(_0x11f4fd){logger[_0xdac9('0x18')](_0xdac9('0x21'),_0x11f4fd['message'],_0x520369);_0x2b9d91(_0x4029fc[_0xdac9('0x18')](0x1f4,_0x11f4fd['message']));});});};exports[_0xdac9('0x22')]=function(_0x2fce71){var _0x566d8c=this;return new Promise(function(_0x433be9,_0x5105f1){return db[_0xdac9('0x1d')][_0xdac9('0x23')](_0x2fce71[_0xdac9('0x1e')],{'raw':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')]['where']||null:null,'attributes':_0x2fce71['options']?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x24')]||null:null,'limit':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x25')]||null:null})[_0xdac9('0x12')](function(_0xed99f9){logger[_0xdac9('0x13')](_0xdac9('0x22'),_0x2fce71);logger[_0xdac9('0x15')](_0xdac9('0x22'),_0x2fce71,JSON[_0xdac9('0x26')](_0xed99f9));_0x433be9(_0xed99f9);})[_0xdac9('0x1c')](function(_0x336fd5){logger[_0xdac9('0x18')](_0xdac9('0x22'),_0x336fd5[_0xdac9('0x1a')],_0x2fce71);_0x5105f1(_0x566d8c[_0xdac9('0x18')](0x1f4,_0x336fd5[_0xdac9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 5d39488..d25b7ac 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 _0x3639=['length','faxMessage:','save','remove','update','emit','removeListener','register'];(function(_0x55fd40,_0x225b77){var _0x7979f1=function(_0x1d21c1){while(--_0x1d21c1){_0x55fd40['push'](_0x55fd40['shift']());}};_0x7979f1(++_0x225b77);}(_0x3639,0x1b2));var _0x9363=function(_0x4720c2,_0x1f9346){_0x4720c2=_0x4720c2-0x0;var _0x4cf143=_0x3639[_0x4720c2];return _0x4cf143;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x9363('0x0'),_0x9363('0x1'),_0x9363('0x2')];function createListener(_0x2fef18,_0x15a4d4){return function(_0x41282f){_0x15a4d4[_0x9363('0x3')](_0x2fef18,_0x41282f);};}function removeListener(_0x2803c7,_0x4c6253){return function(){FaxMessageEvents[_0x9363('0x4')](_0x2803c7,_0x4c6253);};}exports[_0x9363('0x5')]=function(_0x3bda88){for(var _0x31483c=0x0,_0x802bf7=events[_0x9363('0x6')];_0x31483c<_0x802bf7;_0x31483c++){var _0x47e21c=events[_0x31483c];var _0x5a02a9=createListener(_0x9363('0x7')+_0x47e21c,_0x3bda88);FaxMessageEvents['on'](_0x47e21c,_0x5a02a9);}}; \ No newline at end of file +var _0xdf5d=['register','faxMessage:','./faxMessage.events','save','update','emit','removeListener'];(function(_0x3ff987,_0x5df063){var _0x22268=function(_0x54749a){while(--_0x54749a){_0x3ff987['push'](_0x3ff987['shift']());}};_0x22268(++_0x5df063);}(_0xdf5d,0x87));var _0xddf5=function(_0x2b1b90,_0x2ec880){_0x2b1b90=_0x2b1b90-0x0;var _0x5108b5=_0xdf5d[_0x2b1b90];return _0x5108b5;};'use strict';var FaxMessageEvents=require(_0xddf5('0x0'));var events=[_0xddf5('0x1'),'remove',_0xddf5('0x2')];function createListener(_0x29122f,_0x247f89){return function(_0x512b5a){_0x247f89[_0xddf5('0x3')](_0x29122f,_0x512b5a);};}function removeListener(_0x142940,_0x262128){return function(){FaxMessageEvents[_0xddf5('0x4')](_0x142940,_0x262128);};}exports[_0xddf5('0x5')]=function(_0x1b3991){for(var _0x46693d=0x0,_0x119b5e=events['length'];_0x46693d<_0x119b5e;_0x46693d++){var _0xb7e41d=events[_0x46693d];var _0x2f1b4c=createListener(_0xddf5('0x6')+_0xb7e41d,_0x1b3991);FaxMessageEvents['on'](_0xb7e41d,_0x2f1b4c);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 45406e5..ea071d6 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 _0xd8b0=['tracked','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/download','download','post'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./faxMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth['isAuthenticated'](),interaction[_0x0d8b('0x10')]('fax',_0x0d8b('0x11')),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x13')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x13')](_0x0d8b('0x17'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x19')]);module[_0x0d8b('0x1a')]=router; \ No newline at end of file +var _0x16d2=['./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0x16d2,0x123));var _0x216d=function(_0x4aafa7,_0x5c8164){_0x4aafa7=_0x4aafa7-0x0;var _0x50ca96=_0x16d2[_0x4aafa7];return _0x50ca96;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var fs_extra=require(_0x216d('0x6'));var auth=require(_0x216d('0x7'));var interaction=require(_0x216d('0x8'));var config=require('../../config/environment');var controller=require(_0x216d('0x9'));router[_0x216d('0xa')]('/',auth[_0x216d('0xb')](),controller[_0x216d('0xc')]);router[_0x216d('0xa')](_0x216d('0xd'),auth[_0x216d('0xb')](),controller[_0x216d('0xe')]);router['get'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x10')]);router[_0x216d('0xa')](_0x216d('0x11'),auth[_0x216d('0xb')](),controller['download']);router[_0x216d('0x12')]('/',auth['isAuthenticated'](),interaction[_0x216d('0x13')](_0x216d('0x14'),_0x216d('0x15')),controller[_0x216d('0x16')]);router[_0x216d('0x17')](_0x216d('0xf'),auth['isAuthenticated'](),controller[_0x216d('0x18')]);router['put'](_0x216d('0x19'),auth[_0x216d('0xb')](),controller['accept']);router[_0x216d('0x17')](_0x216d('0x1a'),auth['isAuthenticated'](),controller[_0x216d('0x1b')]);router['delete'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x1c')]);module[_0x216d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 7e77c9a..d2c54d1 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 _0xa72d=['name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4b2b00,_0xafcd24){var _0x7a7031=function(_0x1a6efe){while(--_0x1a6efe){_0x4b2b00['push'](_0x4b2b00['shift']());}};_0x7a7031(++_0xafcd24);}(_0xa72d,0x1bf));var _0xda72=function(_0x54341d,_0x55d840){_0x54341d=_0x54341d-0x0;var _0x3fb42f=_0xa72d[_0x54341d];return _0x3fb42f;};'use strict';var Sequelize=require(_0xda72('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xda72('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xda72('0x2')]},'timeout':{'type':Sequelize[_0xda72('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xda72('0x4')](_0xda72('0x5'),_0xda72('0x6'),_0xda72('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xda72('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe5a2=['STRING','name','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x306f38,_0xe6d160){var _0x19c407=function(_0x1b9795){while(--_0x1b9795){_0x306f38['push'](_0x306f38['shift']());}};_0x19c407(++_0xe6d160);}(_0xe5a2,0x98));var _0x2e5a=function(_0x4fe9a8,_0x5643fb){_0x4fe9a8=_0x4fe9a8-0x0;var _0x38d09c=_0xe5a2[_0x4fe9a8];return _0x38d09c;};'use strict';var Sequelize=require(_0x2e5a('0x0'));module[_0x2e5a('0x1')]={'name':{'type':Sequelize[_0x2e5a('0x2')],'unique':_0x2e5a('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2e5a('0x4'),_0x2e5a('0x5'),_0x2e5a('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 2e6fe4f..5d6dc13 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 _0x93ae=['reject','save','then','get','FaxQueues','destroy','error','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','FaxQueue','findAll','rows','catch','rawAttributes','include','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','params','describe','getMembers','findOne','UserFaxQueue','order','pick','FaxQueueId','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','getTeams','addTeams','Team','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','ids','select','field','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','sequelize','QueryTypes','SELECT','TeamId','all','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','apply'];(function(_0x32c607,_0x48fa2e){var _0x17727e=function(_0x267e51){while(--_0x267e51){_0x32c607['push'](_0x32c607['shift']());}};_0x17727e(++_0x48fa2e);}(_0x93ae,0x18d));var _0xe93a=function(_0x3ab732,_0x55322d){_0x3ab732=_0x3ab732-0x0;var _0x47e4ae=_0x93ae[_0x3ab732];return _0x47e4ae;};'use strict';var emlformat=require(_0xe93a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe93a('0x1'));var jsonpatch=require(_0xe93a('0x2'));var rp=require(_0xe93a('0x3'));var moment=require('moment');var BPromise=require(_0xe93a('0x4'));var Mustache=require(_0xe93a('0x5'));var util=require(_0xe93a('0x6'));var path=require(_0xe93a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe93a('0x8'));var fs=require('fs');var fs_extra=require(_0xe93a('0x9'));var _=require(_0xe93a('0xa'));var squel=require(_0xe93a('0xb'));var crypto=require(_0xe93a('0xc'));var jsforce=require(_0xe93a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe93a('0xe'));var Papa=require('papaparse');var Redis=require(_0xe93a('0xf'));var authService=require(_0xe93a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe93a('0x11'));var logger=require(_0xe93a('0x12'))(_0xe93a('0x13'));var utils=require(_0xe93a('0x14'));var config=require(_0xe93a('0x15'));var licenseUtil=require(_0xe93a('0x16'));var db=require(_0xe93a('0x17'))['db'];config[_0xe93a('0x18')]=_['defaults'](config[_0xe93a('0x18')],{'host':_0xe93a('0x19'),'port':0x18eb});var socket=require(_0xe93a('0x1a'))(new Redis(config[_0xe93a('0x18')]));require(_0xe93a('0x1b'))[_0xe93a('0x1c')](socket);function respondWithStatusCode(_0x1e6afc,_0x34c665){_0x34c665=_0x34c665||0xcc;return function(_0xe7ab68){if(_0xe7ab68){return _0x1e6afc[_0xe93a('0x1d')](_0x34c665);}return _0x1e6afc['status'](_0x34c665)[_0xe93a('0x1e')]();};}function respondWithResult(_0x5c9253,_0x370767){_0x370767=_0x370767||0xc8;return function(_0x930d97){if(_0x930d97){return _0x5c9253[_0xe93a('0x1f')](_0x370767)[_0xe93a('0x20')](_0x930d97);}};}function respondWithFilteredResult(_0x305d8b,_0x550bc6){return function(_0x33a3bd){if(_0x33a3bd){var _0x4edbc9=typeof _0x550bc6[_0xe93a('0x21')]==='undefined'&&typeof _0x550bc6[_0xe93a('0x22')]===_0xe93a('0x23');var _0x1c2844=_0x33a3bd[_0xe93a('0x24')];var _0x4d00e8=_0x4edbc9?0x0:_0x550bc6[_0xe93a('0x21')];var _0x3facd3=_0x4edbc9?_0x33a3bd[_0xe93a('0x24')]:_0x550bc6[_0xe93a('0x21')]+_0x550bc6[_0xe93a('0x22')];var _0x52dd11;if(_0x3facd3>=_0x1c2844){_0x3facd3=_0x1c2844;_0x52dd11=0xc8;}else{_0x52dd11=0xce;}_0x305d8b[_0xe93a('0x1f')](_0x52dd11);return _0x305d8b['set']('Content-Range',_0x4d00e8+'-'+_0x3facd3+'/'+_0x1c2844)[_0xe93a('0x20')](_0x33a3bd);}return null;};}function patchUpdates(_0x28dcfa){return function(_0x4c0bcb){try{jsonpatch[_0xe93a('0x25')](_0x4c0bcb,_0x28dcfa,!![]);}catch(_0x2f198d){return BPromise[_0xe93a('0x26')](_0x2f198d);}return _0x4c0bcb[_0xe93a('0x27')]();};}function saveUpdates(_0x4b0483,_0x5b723f){return function(_0x122a39){if(_0x122a39){return _0x122a39['update'](_0x4b0483)[_0xe93a('0x28')](function(_0x183ea6){return _0x183ea6;});}return null;};}function removeEntity(_0x95ba13,_0x3be176){return function(_0x4e5837){if(_0x4e5837){return _0x4e5837['destroy']()[_0xe93a('0x28')](function(){var _0x49f501=_0x4e5837[_0xe93a('0x29')]({'plain':!![]});var _0x4cad3a=_0xe93a('0x2a');return db['UserProfileResource'][_0xe93a('0x2b')]({'where':{'type':_0x4cad3a,'resourceId':_0x49f501['id']}})[_0xe93a('0x28')](function(){return _0x4e5837;});})[_0xe93a('0x28')](function(){_0x95ba13['status'](0xcc)[_0xe93a('0x1e')]();});}};}function handleEntityNotFound(_0x3a3334,_0x395fb2){return function(_0x39864a){if(!_0x39864a){_0x3a3334['sendStatus'](0x194);}return _0x39864a;};}function handleError(_0x2fa14b,_0x1415f0){_0x1415f0=_0x1415f0||0x1f4;return function(_0x251802){logger[_0xe93a('0x2c')](_0x251802[_0xe93a('0x2d')]);if(_0x251802['name']){delete _0x251802[_0xe93a('0x2e')];}_0x2fa14b[_0xe93a('0x1f')](_0x1415f0)[_0xe93a('0x2f')](_0x251802);};}exports['index']=function(_0x1214e9,_0x2af405){var _0xb0cae5={},_0x59ace2={},_0x140c92={'count':0x0,'rows':[]};var _0x1ec2af=_[_0xe93a('0x30')](db['FaxQueue']['rawAttributes'],function(_0x16425f){return{'name':_0x16425f[_0xe93a('0x31')],'type':_0x16425f[_0xe93a('0x32')][_0xe93a('0x33')]};});_0x59ace2[_0xe93a('0x34')]=_[_0xe93a('0x30')](_0x1ec2af,_0xe93a('0x2e'));_0x59ace2['query']=_[_0xe93a('0x35')](_0x1214e9[_0xe93a('0x36')]);_0x59ace2[_0xe93a('0x37')]=_[_0xe93a('0x38')](_0x59ace2[_0xe93a('0x34')],_0x59ace2[_0xe93a('0x36')]);_0xb0cae5[_0xe93a('0x39')]=_['intersection'](_0x59ace2[_0xe93a('0x34')],qs[_0xe93a('0x3a')](_0x1214e9['query'][_0xe93a('0x3a')]));_0xb0cae5[_0xe93a('0x39')]=_0xb0cae5['attributes'][_0xe93a('0x3b')]?_0xb0cae5['attributes']:_0x59ace2[_0xe93a('0x34')];if(!_0x1214e9[_0xe93a('0x36')][_0xe93a('0x3c')](_0xe93a('0x3d'))){_0xb0cae5[_0xe93a('0x22')]=qs['limit'](_0x1214e9[_0xe93a('0x36')][_0xe93a('0x22')]);_0xb0cae5[_0xe93a('0x21')]=qs[_0xe93a('0x21')](_0x1214e9[_0xe93a('0x36')][_0xe93a('0x21')]);}_0xb0cae5['order']=qs[_0xe93a('0x3e')](_0x1214e9['query']['sort']);_0xb0cae5[_0xe93a('0x3f')]=qs['filters'](_['pick'](_0x1214e9['query'],_0x59ace2[_0xe93a('0x37')]),_0x1ec2af);if(_0x1214e9[_0xe93a('0x36')]['filter']){_0xb0cae5[_0xe93a('0x3f')]=_[_0xe93a('0x40')](_0xb0cae5['where'],{'$or':_['map'](_0x1ec2af,function(_0xf7c8dd){if(_0xf7c8dd[_0xe93a('0x32')]!==_0xe93a('0x41')){var _0xfb3ec1={};_0xfb3ec1[_0xf7c8dd['name']]={'$like':'%'+_0x1214e9['query'][_0xe93a('0x42')]+'%'};return _0xfb3ec1;}})});}_0xb0cae5=_[_0xe93a('0x40')]({},_0xb0cae5,_0x1214e9[_0xe93a('0x43')]);var _0x454c3a={'where':_0xb0cae5['where']};return db['FaxQueue'][_0xe93a('0x24')](_0x454c3a)[_0xe93a('0x28')](function(_0x2c8d94){_0x140c92[_0xe93a('0x24')]=_0x2c8d94;if(_0x1214e9[_0xe93a('0x36')][_0xe93a('0x44')]){_0xb0cae5['include']=[{'all':!![]}];}return db[_0xe93a('0x45')][_0xe93a('0x46')](_0xb0cae5);})[_0xe93a('0x28')](function(_0x3ee6cd){_0x140c92[_0xe93a('0x47')]=_0x3ee6cd;return _0x140c92;})[_0xe93a('0x28')](respondWithFilteredResult(_0x2af405,_0xb0cae5))[_0xe93a('0x48')](handleError(_0x2af405,null));};exports['show']=function(_0x2c5da1,_0x35f6e8){var _0x1effb3={'raw':!![],'where':{'id':_0x2c5da1['params']['id']}},_0x1da360={};_0x1da360['model']=_[_0xe93a('0x35')](db['FaxQueue'][_0xe93a('0x49')]);_0x1da360['query']=_[_0xe93a('0x35')](_0x2c5da1['query']);_0x1da360[_0xe93a('0x37')]=_[_0xe93a('0x38')](_0x1da360[_0xe93a('0x34')],_0x1da360[_0xe93a('0x36')]);_0x1effb3[_0xe93a('0x39')]=_[_0xe93a('0x38')](_0x1da360[_0xe93a('0x34')],qs[_0xe93a('0x3a')](_0x2c5da1[_0xe93a('0x36')][_0xe93a('0x3a')]));_0x1effb3['attributes']=_0x1effb3[_0xe93a('0x39')][_0xe93a('0x3b')]?_0x1effb3[_0xe93a('0x39')]:_0x1da360['model'];if(_0x2c5da1[_0xe93a('0x36')]['includeAll']){_0x1effb3[_0xe93a('0x4a')]=[{'all':!![]}];}_0x1effb3=_['merge']({},_0x1effb3,_0x2c5da1['options']);return db['FaxQueue'][_0xe93a('0x4b')](_0x1effb3)['then'](handleEntityNotFound(_0x35f6e8,null))[_0xe93a('0x28')](respondWithResult(_0x35f6e8,null))[_0xe93a('0x48')](handleError(_0x35f6e8,null));};exports[_0xe93a('0x4c')]=function(_0x7c4de7,_0x5491ab){return db[_0xe93a('0x45')]['create'](_0x7c4de7[_0xe93a('0x4d')],{})[_0xe93a('0x28')](function(_0x5330ee){var _0x3273bc=_0x7c4de7[_0xe93a('0x4e')]['get']({'plain':!![]});if(!_0x3273bc)throw new Error(_0xe93a('0x4f'));if(_0x3273bc[_0xe93a('0x50')]===_0xe93a('0x4e')){var _0x43c74d=_0x5330ee['get']({'plain':!![]});var _0x429d9d='FaxQueues';return db[_0xe93a('0x51')][_0xe93a('0x4b')]({'where':{'name':_0x429d9d,'userProfileId':_0x3273bc[_0xe93a('0x52')]},'raw':!![]})['then'](function(_0x142065){if(_0x142065&&_0x142065[_0xe93a('0x53')]===0x0){return db[_0xe93a('0x54')][_0xe93a('0x4c')]({'name':_0x43c74d[_0xe93a('0x2e')],'resourceId':_0x43c74d['id'],'type':_0x142065[_0xe93a('0x2e')],'sectionId':_0x142065['id']},{})['then'](function(){return _0x5330ee;});}else{return _0x5330ee;}})[_0xe93a('0x48')](function(_0x3e9d13){logger['error'](_0xe93a('0x55'),_0x3e9d13);throw _0x3e9d13;});}return _0x5330ee;})[_0xe93a('0x28')](respondWithResult(_0x5491ab,0xc9))[_0xe93a('0x48')](handleError(_0x5491ab,null));};exports['update']=function(_0x8ca6ab,_0x148762){if(_0x8ca6ab['body']['id']){delete _0x8ca6ab['body']['id'];}return db[_0xe93a('0x45')][_0xe93a('0x4b')]({'where':{'id':_0x8ca6ab[_0xe93a('0x56')]['id']}})['then'](handleEntityNotFound(_0x148762,null))[_0xe93a('0x28')](saveUpdates(_0x8ca6ab[_0xe93a('0x4d')],null))[_0xe93a('0x28')](respondWithResult(_0x148762,null))['catch'](handleError(_0x148762,null));};exports[_0xe93a('0x2b')]=function(_0x59a955,_0x2c34c1){return db['FaxQueue'][_0xe93a('0x4b')]({'where':{'id':_0x59a955[_0xe93a('0x56')]['id']}})[_0xe93a('0x28')](handleEntityNotFound(_0x2c34c1,null))[_0xe93a('0x28')](removeEntity(_0x2c34c1,null))[_0xe93a('0x48')](handleError(_0x2c34c1,null));};exports[_0xe93a('0x57')]=function(_0x3a16f6,_0x186624){return db[_0xe93a('0x45')]['describe']()['then'](respondWithResult(_0x186624,null))[_0xe93a('0x48')](handleError(_0x186624,null));};exports[_0xe93a('0x58')]=function(_0x3a0fd4,_0x3a5eb3,_0x3aa178){var _0x21172a={'raw':!![],'where':{}},_0x32d0f0={},_0x4cbf94;return db[_0xe93a('0x45')][_0xe93a('0x59')]({'where':{'id':_0x3a0fd4[_0xe93a('0x56')]['id']}})[_0xe93a('0x28')](handleEntityNotFound(_0x3a5eb3,null))[_0xe93a('0x28')](function(_0x3200bf){if(_0x3200bf){_0x4cbf94=_0x3200bf[_0xe93a('0x29')]({'plain':!![]});_0x32d0f0['model']=_[_0xe93a('0x35')](db[_0xe93a('0x5a')][_0xe93a('0x49')]);_0x32d0f0[_0xe93a('0x36')]=_[_0xe93a('0x35')](_0x3a0fd4[_0xe93a('0x36')]);_0x32d0f0['filters']=_['intersection'](_0x32d0f0['model'],_0x32d0f0[_0xe93a('0x36')]);_0x21172a[_0xe93a('0x39')]=_[_0xe93a('0x38')](_0x32d0f0[_0xe93a('0x34')],qs[_0xe93a('0x3a')](_0x3a0fd4[_0xe93a('0x36')][_0xe93a('0x3a')]));_0x21172a[_0xe93a('0x39')]=_0x21172a[_0xe93a('0x39')]['length']?_0x21172a['attributes']:_0x32d0f0[_0xe93a('0x34')];if(!_0x3a0fd4[_0xe93a('0x36')][_0xe93a('0x3c')](_0xe93a('0x3d'))){_0x21172a[_0xe93a('0x22')]=qs[_0xe93a('0x22')](_0x3a0fd4[_0xe93a('0x36')][_0xe93a('0x22')]);_0x21172a['offset']=qs[_0xe93a('0x21')](_0x3a0fd4[_0xe93a('0x36')]['offset']);}_0x21172a[_0xe93a('0x5b')]=qs[_0xe93a('0x3e')](_0x3a0fd4[_0xe93a('0x36')][_0xe93a('0x3e')]);_0x21172a['where']=qs['filters'](_[_0xe93a('0x5c')](_0x3a0fd4['query'],_0x32d0f0[_0xe93a('0x37')]));_0x21172a[_0xe93a('0x3f')][_0xe93a('0x5d')]=_0x3200bf['id'];if(_0x3a0fd4['query'][_0xe93a('0x42')]){_0x21172a['where']=_[_0xe93a('0x40')](_0x21172a[_0xe93a('0x3f')],{'$or':_[_0xe93a('0x30')](_0x21172a['attributes'],function(_0x1b66bb){var _0x3fb23e={};_0x3fb23e[_0x1b66bb]={'$like':'%'+_0x3a0fd4[_0xe93a('0x36')][_0xe93a('0x42')]+'%'};return _0x3fb23e;})});}_0x21172a=_['merge']({},_0x21172a,_0x3a0fd4[_0xe93a('0x43')]);return db[_0xe93a('0x5a')][_0xe93a('0x46')](_0x21172a);}})['then'](function(_0x493011){if(_0x493011){return db[_0xe93a('0x5e')][_0xe93a('0x5f')]({'where':{'id':_[_0xe93a('0x30')](_0x493011,_0xe93a('0x60')),'role':'agent'},'attributes':['id',_0xe93a('0x2e'),_0xe93a('0x61'),_0xe93a('0x62'),_0xe93a('0x63')]});}})[_0xe93a('0x28')](function(_0x418f72){if(_0x418f72){return{'count':_0x418f72['count'],'rows':_[_0xe93a('0x30')](_0x418f72[_0xe93a('0x47')],function(_0x2a949d){return{'membername':_0x2a949d[_0xe93a('0x2e')],'UserId':_0x2a949d['id'],'queue_name':_0x4cbf94[_0xe93a('0x2e')],'FaxQueueId':_0x4cbf94['id'],'interface':util[_0xe93a('0x64')](_0xe93a('0x65'),'SIP',_0x2a949d[_0xe93a('0x2e')]),'penalty':0x0,'paused':_0x2a949d[_0xe93a('0x61')],'createdAt':_0x2a949d[_0xe93a('0x63')],'updatedAt':_0x2a949d[_0xe93a('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe93a('0x28')](respondWithFilteredResult(_0x3a5eb3,_0x21172a))[_0xe93a('0x48')](handleError(_0x3a5eb3,null));};exports[_0xe93a('0x66')]=function(_0x5e01bf,_0x5030fd,_0x245728){var _0x4f556d={};var _0x29246f={};var _0x4df313;var _0x31cb05;return db[_0xe93a('0x45')][_0xe93a('0x59')]({'where':{'id':_0x5e01bf[_0xe93a('0x56')]['id']}})[_0xe93a('0x28')](handleEntityNotFound(_0x5030fd,null))[_0xe93a('0x28')](function(_0x43176e){if(_0x43176e){_0x4df313=_0x43176e;_0x29246f[_0xe93a('0x34')]=_['keys'](db['Team'][_0xe93a('0x49')]);_0x29246f[_0xe93a('0x36')]=_['keys'](_0x5e01bf[_0xe93a('0x36')]);_0x29246f[_0xe93a('0x37')]=_[_0xe93a('0x38')](_0x29246f[_0xe93a('0x34')],_0x29246f['query']);_0x4f556d[_0xe93a('0x39')]=_[_0xe93a('0x38')](_0x29246f[_0xe93a('0x34')],qs['fields'](_0x5e01bf[_0xe93a('0x36')]['fields']));_0x4f556d[_0xe93a('0x39')]=_0x4f556d['attributes']['length']?_0x4f556d[_0xe93a('0x39')]:_0x29246f[_0xe93a('0x34')];_0x4f556d[_0xe93a('0x5b')]=qs[_0xe93a('0x3e')](_0x5e01bf[_0xe93a('0x36')][_0xe93a('0x3e')]);_0x4f556d[_0xe93a('0x3f')]=qs[_0xe93a('0x37')](_[_0xe93a('0x5c')](_0x5e01bf[_0xe93a('0x36')],_0x29246f['filters']));if(_0x5e01bf[_0xe93a('0x36')][_0xe93a('0x42')]){_0x4f556d['where']=_[_0xe93a('0x40')](_0x4f556d[_0xe93a('0x3f')],{'$or':_['map'](_0x4f556d[_0xe93a('0x39')],function(_0x3be2a0){var _0x38ea70={};_0x38ea70[_0x3be2a0]={'$like':'%'+_0x5e01bf['query']['filter']+'%'};return _0x38ea70;})});}_0x4f556d=_[_0xe93a('0x40')]({},_0x4f556d,_0x5e01bf[_0xe93a('0x43')]);return _0x4df313[_0xe93a('0x66')](_0x4f556d);}})['then'](function(_0x456a81){if(_0x456a81){_0x31cb05=_0x456a81['length'];if(!_0x5e01bf['query'][_0xe93a('0x3c')]('nolimit')){_0x4f556d['limit']=qs[_0xe93a('0x22')](_0x5e01bf[_0xe93a('0x36')][_0xe93a('0x22')]);_0x4f556d[_0xe93a('0x21')]=qs['offset'](_0x5e01bf[_0xe93a('0x36')][_0xe93a('0x21')]);}return _0x4df313[_0xe93a('0x66')](_0x4f556d);}})[_0xe93a('0x28')](function(_0xb4c88d){if(_0xb4c88d){return _0xb4c88d?{'count':_0x31cb05,'rows':_0xb4c88d}:null;}})[_0xe93a('0x28')](respondWithResult(_0x5030fd,null))['catch'](handleError(_0x5030fd,null));};exports[_0xe93a('0x67')]=function(_0x514bf9,_0x1d8732,_0x5a6cc2){var _0x4077bf=_0x514bf9[_0xe93a('0x4d')]['ids'];return db[_0xe93a('0x68')][_0xe93a('0x46')]({'where':{'id':_0x4077bf},'attributes':['id'],'include':[{'model':db[_0xe93a('0x5e')],'as':_0xe93a('0x69'),'attributes':['id',_0xe93a('0x2e'),_0xe93a('0x6a'),_0xe93a('0x6b'),_0xe93a('0x6c')],'raw':!![]}]})[_0xe93a('0x28')](function(_0x270628){if(_0x270628){var _0x1304ec=_[_0xe93a('0x6d')](_0x270628,function(_0x340d0e){var _0x2e8cdd=_0x340d0e[_0xe93a('0x29')]({'plain':!![]});return _0x2e8cdd[_0xe93a('0x69')];});return db[_0xe93a('0x45')]['find']({'where':{'id':_0x514bf9[_0xe93a('0x56')]['id']}})[_0xe93a('0x28')](function(_0x211b40){return db['sequelize'][_0xe93a('0x6e')](function(_0x51c558){return _0x211b40[_0xe93a('0x67')](_0x4077bf,{'transaction':_0x51c558})['then'](function(){return BPromise[_0xe93a('0x6f')](_0x1304ec,function(_0x45361c){return db['UserFaxQueue'][_0xe93a('0x70')]({'where':{'UserId':_0x45361c['id'],'FaxQueueId':_0x514bf9[_0xe93a('0x56')]['id']},'transaction':_0x51c558});});})[_0xe93a('0x28')](function(){_0x1304ec[_0xe93a('0x71')](function(_0x1efd1f){socket[_0xe93a('0x72')](_0xe93a('0x73'),{'UserId':_0x1efd1f['id'],'FaxQueueId':_0x211b40['id']});});});});});}})[_0xe93a('0x28')](respondWithStatusCode(_0x1d8732,null))['catch'](handleError(_0x1d8732,null));};exports[_0xe93a('0x74')]=function(_0x59ee86,_0x4492a2,_0x269374){return db['Team'][_0xe93a('0x46')]({'where':{'id':_0x59ee86['query'][_0xe93a('0x75')]},'attributes':['id'],'include':[{'model':db[_0xe93a('0x5e')],'as':_0xe93a('0x69'),'attributes':['id'],'raw':!![]}]})[_0xe93a('0x28')](handleEntityNotFound(_0x4492a2,null))['then'](function(_0x576e16){var _0x5aeaee=_[_0xe93a('0x30')](_0x576e16,'id');var _0x22f280=[];var _0x15b7fb=[];var _0x2a5a4a=squel[_0xe93a('0x76')]();_0x2a5a4a[_0xe93a('0x77')](_0xe93a('0x78'))[_0xe93a('0x79')](_0xe93a('0x7a'),'tq')[_0xe93a('0x7b')](_0xe93a('0x7c'),'ut',_0xe93a('0x7d'))['where'](_0xe93a('0x7e'),_0x59ee86[_0xe93a('0x56')]['id']);for(var _0x45e7a9=0x0;_0x45e7a9<_0x576e16[_0xe93a('0x3b')];_0x45e7a9+=0x1){let _0x22b885=_0x576e16[_0x45e7a9];for(var _0xb15b20=0x0;_0xb15b20<_0x22b885['Agents'][_0xe93a('0x3b')];_0xb15b20+=0x1){let _0x4d0851=_0x22b885[_0xe93a('0x69')][_0xb15b20];var _0x9f3514=_0x2a5a4a[_0xe93a('0x7f')]();_0x9f3514[_0xe93a('0x3f')](_0xe93a('0x80'),_0x4d0851['id']);_0x15b7fb[_0xe93a('0x81')](db[_0xe93a('0x82')][_0xe93a('0x36')](_0x9f3514['toString'](),{'type':db['sequelize'][_0xe93a('0x83')][_0xe93a('0x84')]})[_0xe93a('0x28')](function(_0x3bbaea){if(_0x3bbaea[_0xe93a('0x3b')]===0x1){return _0x4d0851['id'];}else{var _0xcbf68e=_['every'](_[_0xe93a('0x30')](_0x3bbaea,_0xe93a('0x85')),function(_0x5018f1){return _['includes'](_0x5aeaee,_0x5018f1);});if(_0xcbf68e){return _0x4d0851['id'];}}}));}}return BPromise[_0xe93a('0x86')](_0x15b7fb)[_0xe93a('0x28')](function(_0x19a5f7){_0x22f280=_(_0x22f280)['union'](_0x19a5f7)[_0xe93a('0x87')]()[_0xe93a('0x88')]();return db[_0xe93a('0x45')][_0xe93a('0x4b')]({'where':{'id':_0x59ee86[_0xe93a('0x56')]['id']}})[_0xe93a('0x28')](function(_0x3f71b8){return db[_0xe93a('0x82')]['transaction'](function(_0x3747b7){return _0x3f71b8[_0xe93a('0x74')](_0x59ee86[_0xe93a('0x36')][_0xe93a('0x75')],{'transaction':_0x3747b7})[_0xe93a('0x28')](function(){if(!_[_0xe93a('0x89')](_0x22f280)){return _0x3f71b8[_0xe93a('0x8a')](_0x22f280,{'transaction':_0x3747b7});}})[_0xe93a('0x28')](function(){_0x22f280[_0xe93a('0x71')](function(_0x3f7108){socket[_0xe93a('0x72')](_0xe93a('0x8b'),{'UserId':_0x3f7108,'FaxQueueId':_0x3f71b8['id']});});});});});});})['then'](respondWithStatusCode(_0x4492a2,null))[_0xe93a('0x48')](handleError(_0x4492a2,null));};exports[_0xe93a('0x8c')]=function(_0x21ae6b,_0x23c709,_0x6aa2b7){return db[_0xe93a('0x45')][_0xe93a('0x4b')]({'where':{'id':_0x21ae6b[_0xe93a('0x56')]['id']}})[_0xe93a('0x28')](handleEntityNotFound(_0x23c709,null))[_0xe93a('0x28')](function(_0x4ffc58){if(_0x4ffc58){return _0x4ffc58[_0xe93a('0x8c')](_0x21ae6b[_0xe93a('0x4d')][_0xe93a('0x75')],_[_0xe93a('0x8d')](_0x21ae6b['body'],['ids','id'])||{})[_0xe93a('0x8e')](function(_0x3add53){for(var _0x766d01=0x0;_0x766d01<_0x21ae6b[_0xe93a('0x4d')][_0xe93a('0x75')]['length'];_0x766d01+=0x1){socket[_0xe93a('0x72')](_0xe93a('0x73'),{'UserId':Number(_0x21ae6b['body'][_0xe93a('0x75')][_0x766d01]),'FaxQueueId':Number(_0x21ae6b[_0xe93a('0x56')]['id'])});}return _0x3add53;});}})[_0xe93a('0x28')](respondWithResult(_0x23c709,null))[_0xe93a('0x48')](handleError(_0x23c709,null));};exports[_0xe93a('0x8a')]=function(_0xdabb5d,_0x53441e,_0x5afe4e){return db[_0xe93a('0x45')][_0xe93a('0x4b')]({'where':{'id':_0xdabb5d[_0xe93a('0x56')]['id']}})[_0xe93a('0x28')](handleEntityNotFound(_0x53441e,null))[_0xe93a('0x28')](function(_0x449f83){if(_0x449f83){return _0x449f83['removeAgents'](_0xdabb5d[_0xe93a('0x36')][_0xe93a('0x75')])['then'](function(){if(_[_0xe93a('0x8f')](_0xdabb5d['query']['ids'])){for(var _0x600c76=0x0;_0x600c76<_0xdabb5d[_0xe93a('0x36')][_0xe93a('0x75')]['length'];_0x600c76+=0x1){socket[_0xe93a('0x72')](_0xe93a('0x8b'),{'UserId':Number(_0xdabb5d[_0xe93a('0x36')][_0xe93a('0x75')][_0x600c76]),'FaxQueueId':Number(_0xdabb5d[_0xe93a('0x56')]['id'])});}}else{socket[_0xe93a('0x72')](_0xe93a('0x8b'),{'UserId':Number(_0xdabb5d[_0xe93a('0x36')][_0xe93a('0x75')]),'FaxQueueId':Number(_0xdabb5d[_0xe93a('0x56')]['id'])});}});}})[_0xe93a('0x28')](respondWithStatusCode(_0x53441e,null))['catch'](handleError(_0x53441e,null));};exports['getAgents']=function(_0x1bde67,_0x122d62,_0x264723){var _0x1dbcf0={};var _0x2bb3ba={};var _0x24dedb;var _0x1668d4;return db[_0xe93a('0x45')][_0xe93a('0x59')]({'where':{'id':_0x1bde67[_0xe93a('0x56')]['id']}})[_0xe93a('0x28')](handleEntityNotFound(_0x122d62,null))[_0xe93a('0x28')](function(_0x35d021){if(_0x35d021){_0x24dedb=_0x35d021;_0x2bb3ba[_0xe93a('0x34')]=_[_0xe93a('0x35')](db[_0xe93a('0x5e')][_0xe93a('0x49')]);_0x2bb3ba['query']=_[_0xe93a('0x35')](_0x1bde67[_0xe93a('0x36')]);_0x2bb3ba[_0xe93a('0x37')]=_[_0xe93a('0x38')](_0x2bb3ba[_0xe93a('0x34')],_0x2bb3ba[_0xe93a('0x36')]);_0x1dbcf0[_0xe93a('0x39')]=_['intersection'](_0x2bb3ba[_0xe93a('0x34')],qs[_0xe93a('0x3a')](_0x1bde67['query']['fields']));_0x1dbcf0[_0xe93a('0x39')]=_0x1dbcf0[_0xe93a('0x39')][_0xe93a('0x3b')]?_0x1dbcf0[_0xe93a('0x39')]:_0x2bb3ba[_0xe93a('0x34')];_0x1dbcf0[_0xe93a('0x5b')]=qs[_0xe93a('0x3e')](_0x1bde67['query']['sort']);_0x1dbcf0[_0xe93a('0x3f')]=qs[_0xe93a('0x37')](_[_0xe93a('0x5c')](_0x1bde67['query'],_0x2bb3ba[_0xe93a('0x37')]));if(_0x1bde67[_0xe93a('0x36')][_0xe93a('0x42')]){_0x1dbcf0[_0xe93a('0x3f')]=_[_0xe93a('0x40')](_0x1dbcf0['where'],{'$or':_[_0xe93a('0x30')](_0x1dbcf0[_0xe93a('0x39')],function(_0x3ec0f3){var _0x45bbc8={};_0x45bbc8[_0x3ec0f3]={'$like':'%'+_0x1bde67['query'][_0xe93a('0x42')]+'%'};return _0x45bbc8;})});}_0x1dbcf0=_[_0xe93a('0x40')]({},_0x1dbcf0,_0x1bde67[_0xe93a('0x43')]);return _0x24dedb[_0xe93a('0x90')](_0x1dbcf0);}})[_0xe93a('0x28')](function(_0x2fcc16){if(_0x2fcc16){_0x1668d4=_0x2fcc16['length'];if(!_0x1bde67[_0xe93a('0x36')][_0xe93a('0x3c')]('nolimit')){_0x1dbcf0[_0xe93a('0x22')]=qs[_0xe93a('0x22')](_0x1bde67[_0xe93a('0x36')][_0xe93a('0x22')]);_0x1dbcf0[_0xe93a('0x21')]=qs[_0xe93a('0x21')](_0x1bde67[_0xe93a('0x36')][_0xe93a('0x21')]);}return _0x24dedb['getAgents'](_0x1dbcf0);}})[_0xe93a('0x28')](function(_0x1b7fc2){if(_0x1b7fc2){return _0x1b7fc2?{'count':_0x1668d4,'rows':_0x1b7fc2}:null;}})[_0xe93a('0x28')](respondWithResult(_0x122d62,null))['catch'](handleError(_0x122d62,null));}; \ No newline at end of file +var _0x5aef=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','order','FaxQueueId','findAll','User','UserId','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','select','tq.TeamId','from','team_has_fax_queues','join','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','emit','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','params','FaxQueue','rawAttributes','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation'];(function(_0x2c8abf,_0x4334ee){var _0x1b4f83=function(_0x55c338){while(--_0x55c338){_0x2c8abf['push'](_0x2c8abf['shift']());}};_0x1b4f83(++_0x4334ee);}(_0x5aef,0x1cf));var _0xf5ae=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0x5aef[_0x3fe6df];return _0x372a0e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf5ae('0x0'));var rp=require(_0xf5ae('0x1'));var moment=require(_0xf5ae('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf5ae('0x3'));var path=require(_0xf5ae('0x4'));var sox=require('sox');var csv=require(_0xf5ae('0x5'));var ejs=require(_0xf5ae('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf5ae('0x7'));var squel=require(_0xf5ae('0x8'));var crypto=require(_0xf5ae('0x9'));var jsforce=require(_0xf5ae('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf5ae('0x5'));var querystring=require(_0xf5ae('0xb'));var Papa=require(_0xf5ae('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf5ae('0xd'));var as=require(_0xf5ae('0xe'));var hardwareService=require(_0xf5ae('0xf'));var logger=require(_0xf5ae('0x10'))('api');var utils=require(_0xf5ae('0x11'));var config=require(_0xf5ae('0x12'));var licenseUtil=require(_0xf5ae('0x13'));var db=require(_0xf5ae('0x14'))['db'];config[_0xf5ae('0x15')]=_['defaults'](config[_0xf5ae('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xf5ae('0x16'))(new Redis(config[_0xf5ae('0x15')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x2d72c6,_0x5e3d27){_0x5e3d27=_0x5e3d27||0xcc;return function(_0x1cb9a8){if(_0x1cb9a8){return _0x2d72c6[_0xf5ae('0x17')](_0x5e3d27);}return _0x2d72c6['status'](_0x5e3d27)[_0xf5ae('0x18')]();};}function respondWithResult(_0x5a9d13,_0x5ab2db){_0x5ab2db=_0x5ab2db||0xc8;return function(_0x1b32bd){if(_0x1b32bd){return _0x5a9d13[_0xf5ae('0x19')](_0x5ab2db)[_0xf5ae('0x1a')](_0x1b32bd);}};}function respondWithFilteredResult(_0xb15dcf,_0x3973c0){return function(_0x753949){if(_0x753949){var _0x5ee2f6=typeof _0x3973c0[_0xf5ae('0x1b')]===_0xf5ae('0x1c')&&typeof _0x3973c0[_0xf5ae('0x1d')]===_0xf5ae('0x1c');var _0x1738ed=_0x753949[_0xf5ae('0x1e')];var _0x5f1d1a=_0x5ee2f6?0x0:_0x3973c0[_0xf5ae('0x1b')];var _0x1e0c23=_0x5ee2f6?_0x753949[_0xf5ae('0x1e')]:_0x3973c0[_0xf5ae('0x1b')]+_0x3973c0[_0xf5ae('0x1d')];var _0x288c5d;if(_0x1e0c23>=_0x1738ed){_0x1e0c23=_0x1738ed;_0x288c5d=0xc8;}else{_0x288c5d=0xce;}_0xb15dcf[_0xf5ae('0x19')](_0x288c5d);return _0xb15dcf[_0xf5ae('0x1f')](_0xf5ae('0x20'),_0x5f1d1a+'-'+_0x1e0c23+'/'+_0x1738ed)[_0xf5ae('0x1a')](_0x753949);}return null;};}function patchUpdates(_0xe53ff8){return function(_0x5a7b2b){try{jsonpatch['apply'](_0x5a7b2b,_0xe53ff8,!![]);}catch(_0x3b3439){return BPromise[_0xf5ae('0x21')](_0x3b3439);}return _0x5a7b2b[_0xf5ae('0x22')]();};}function saveUpdates(_0x1963c0,_0x46fb15){return function(_0x20a368){if(_0x20a368){return _0x20a368[_0xf5ae('0x23')](_0x1963c0)[_0xf5ae('0x24')](function(_0x32ceba){return _0x32ceba;});}return null;};}function removeEntity(_0x300857,_0x15011d){return function(_0x5b8c70){if(_0x5b8c70){return _0x5b8c70[_0xf5ae('0x25')]()['then'](function(){var _0x325dd6=_0x5b8c70[_0xf5ae('0x26')]({'plain':!![]});var _0x372a25=_0xf5ae('0x27');return db[_0xf5ae('0x28')][_0xf5ae('0x25')]({'where':{'type':_0x372a25,'resourceId':_0x325dd6['id']}})['then'](function(){return _0x5b8c70;});})[_0xf5ae('0x24')](function(){_0x300857[_0xf5ae('0x19')](0xcc)[_0xf5ae('0x18')]();});}};}function handleEntityNotFound(_0x84d6f6,_0x273f61){return function(_0x12a569){if(!_0x12a569){_0x84d6f6[_0xf5ae('0x17')](0x194);}return _0x12a569;};}function handleError(_0x136fe7,_0x40257b){_0x40257b=_0x40257b||0x1f4;return function(_0x11cff1){logger[_0xf5ae('0x29')](_0x11cff1[_0xf5ae('0x2a')]);if(_0x11cff1[_0xf5ae('0x2b')]){delete _0x11cff1['name'];}_0x136fe7['status'](_0x40257b)[_0xf5ae('0x2c')](_0x11cff1);};}exports[_0xf5ae('0x2d')]=function(_0x363cb6,_0x109494){var _0x4586ce={},_0x19b51a={},_0x1f25ef={'count':0x0,'rows':[]};var _0x46ab51=_[_0xf5ae('0x2e')](db['FaxQueue']['rawAttributes'],function(_0x33b6ff){return{'name':_0x33b6ff['fieldName'],'type':_0x33b6ff['type'][_0xf5ae('0x2f')]};});_0x19b51a[_0xf5ae('0x30')]=_[_0xf5ae('0x2e')](_0x46ab51,_0xf5ae('0x2b'));_0x19b51a[_0xf5ae('0x31')]=_[_0xf5ae('0x32')](_0x363cb6['query']);_0x19b51a[_0xf5ae('0x33')]=_[_0xf5ae('0x34')](_0x19b51a[_0xf5ae('0x30')],_0x19b51a[_0xf5ae('0x31')]);_0x4586ce[_0xf5ae('0x35')]=_['intersection'](_0x19b51a['model'],qs[_0xf5ae('0x36')](_0x363cb6[_0xf5ae('0x31')][_0xf5ae('0x36')]));_0x4586ce[_0xf5ae('0x35')]=_0x4586ce[_0xf5ae('0x35')]['length']?_0x4586ce[_0xf5ae('0x35')]:_0x19b51a[_0xf5ae('0x30')];if(!_0x363cb6[_0xf5ae('0x31')][_0xf5ae('0x37')](_0xf5ae('0x38'))){_0x4586ce[_0xf5ae('0x1d')]=qs[_0xf5ae('0x1d')](_0x363cb6[_0xf5ae('0x31')]['limit']);_0x4586ce[_0xf5ae('0x1b')]=qs[_0xf5ae('0x1b')](_0x363cb6['query']['offset']);}_0x4586ce['order']=qs[_0xf5ae('0x39')](_0x363cb6[_0xf5ae('0x31')]['sort']);_0x4586ce[_0xf5ae('0x3a')]=qs[_0xf5ae('0x33')](_[_0xf5ae('0x3b')](_0x363cb6[_0xf5ae('0x31')],_0x19b51a[_0xf5ae('0x33')]),_0x46ab51);if(_0x363cb6[_0xf5ae('0x31')][_0xf5ae('0x3c')]){_0x4586ce[_0xf5ae('0x3a')]=_[_0xf5ae('0x3d')](_0x4586ce[_0xf5ae('0x3a')],{'$or':_[_0xf5ae('0x2e')](_0x46ab51,function(_0x2048da){if(_0x2048da[_0xf5ae('0x3e')]!==_0xf5ae('0x3f')){var _0x5a475={};_0x5a475[_0x2048da[_0xf5ae('0x2b')]]={'$like':'%'+_0x363cb6[_0xf5ae('0x31')][_0xf5ae('0x3c')]+'%'};return _0x5a475;}})});}_0x4586ce=_[_0xf5ae('0x3d')]({},_0x4586ce,_0x363cb6['options']);var _0x1f4522={'where':_0x4586ce[_0xf5ae('0x3a')]};return db['FaxQueue'][_0xf5ae('0x1e')](_0x1f4522)[_0xf5ae('0x24')](function(_0x1d9fd0){_0x1f25ef[_0xf5ae('0x1e')]=_0x1d9fd0;if(_0x363cb6[_0xf5ae('0x31')][_0xf5ae('0x40')]){_0x4586ce[_0xf5ae('0x41')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x4586ce);})['then'](function(_0x586260){_0x1f25ef[_0xf5ae('0x42')]=_0x586260;return _0x1f25ef;})['then'](respondWithFilteredResult(_0x109494,_0x4586ce))[_0xf5ae('0x43')](handleError(_0x109494,null));};exports['show']=function(_0x333742,_0x5f2516){var _0x22e5a8={'raw':!![],'where':{'id':_0x333742[_0xf5ae('0x44')]['id']}},_0x37eef5={};_0x37eef5['model']=_[_0xf5ae('0x32')](db[_0xf5ae('0x45')][_0xf5ae('0x46')]);_0x37eef5[_0xf5ae('0x31')]=_[_0xf5ae('0x32')](_0x333742['query']);_0x37eef5[_0xf5ae('0x33')]=_['intersection'](_0x37eef5[_0xf5ae('0x30')],_0x37eef5[_0xf5ae('0x31')]);_0x22e5a8[_0xf5ae('0x35')]=_[_0xf5ae('0x34')](_0x37eef5[_0xf5ae('0x30')],qs['fields'](_0x333742[_0xf5ae('0x31')]['fields']));_0x22e5a8[_0xf5ae('0x35')]=_0x22e5a8[_0xf5ae('0x35')][_0xf5ae('0x47')]?_0x22e5a8[_0xf5ae('0x35')]:_0x37eef5['model'];if(_0x333742[_0xf5ae('0x31')]['includeAll']){_0x22e5a8[_0xf5ae('0x41')]=[{'all':!![]}];}_0x22e5a8=_[_0xf5ae('0x3d')]({},_0x22e5a8,_0x333742[_0xf5ae('0x48')]);return db[_0xf5ae('0x45')][_0xf5ae('0x49')](_0x22e5a8)['then'](handleEntityNotFound(_0x5f2516,null))[_0xf5ae('0x24')](respondWithResult(_0x5f2516,null))[_0xf5ae('0x43')](handleError(_0x5f2516,null));};exports['create']=function(_0x46557f,_0x292683){return db['FaxQueue'][_0xf5ae('0x4a')](_0x46557f[_0xf5ae('0x4b')],{})[_0xf5ae('0x24')](function(_0x4f60ef){var _0x3f32fa=_0x46557f[_0xf5ae('0x4c')][_0xf5ae('0x26')]({'plain':!![]});if(!_0x3f32fa)throw new Error(_0xf5ae('0x4d'));if(_0x3f32fa['role']===_0xf5ae('0x4c')){var _0x71be44=_0x4f60ef['get']({'plain':!![]});var _0x5ddb81=_0xf5ae('0x27');return db[_0xf5ae('0x4e')][_0xf5ae('0x49')]({'where':{'name':_0x5ddb81,'userProfileId':_0x3f32fa[_0xf5ae('0x4f')]},'raw':!![]})[_0xf5ae('0x24')](function(_0x41e838){if(_0x41e838&&_0x41e838[_0xf5ae('0x50')]===0x0){return db[_0xf5ae('0x28')][_0xf5ae('0x4a')]({'name':_0x71be44['name'],'resourceId':_0x71be44['id'],'type':_0x41e838[_0xf5ae('0x2b')],'sectionId':_0x41e838['id']},{})['then'](function(){return _0x4f60ef;});}else{return _0x4f60ef;}})[_0xf5ae('0x43')](function(_0x160862){logger[_0xf5ae('0x29')](_0xf5ae('0x51'),_0x160862);throw _0x160862;});}return _0x4f60ef;})[_0xf5ae('0x24')](respondWithResult(_0x292683,0xc9))['catch'](handleError(_0x292683,null));};exports[_0xf5ae('0x23')]=function(_0x5123ab,_0x509315){if(_0x5123ab[_0xf5ae('0x4b')]['id']){delete _0x5123ab[_0xf5ae('0x4b')]['id'];}return db[_0xf5ae('0x45')]['find']({'where':{'id':_0x5123ab['params']['id']}})[_0xf5ae('0x24')](handleEntityNotFound(_0x509315,null))['then'](saveUpdates(_0x5123ab['body'],null))['then'](respondWithResult(_0x509315,null))['catch'](handleError(_0x509315,null));};exports[_0xf5ae('0x25')]=function(_0x2e867f,_0x25eafc){return db['FaxQueue']['find']({'where':{'id':_0x2e867f['params']['id']}})['then'](handleEntityNotFound(_0x25eafc,null))['then'](removeEntity(_0x25eafc,null))[_0xf5ae('0x43')](handleError(_0x25eafc,null));};exports[_0xf5ae('0x52')]=function(_0x5d8ff9,_0x10bbb6){return db[_0xf5ae('0x45')][_0xf5ae('0x52')]()[_0xf5ae('0x24')](respondWithResult(_0x10bbb6,null))['catch'](handleError(_0x10bbb6,null));};exports['getMembers']=function(_0x11e4b9,_0x2f778a,_0x596bdd){var _0x59fdd6={'raw':!![],'where':{}},_0x588dc5={},_0x5e5adc;return db[_0xf5ae('0x45')][_0xf5ae('0x53')]({'where':{'id':_0x11e4b9['params']['id']}})[_0xf5ae('0x24')](handleEntityNotFound(_0x2f778a,null))[_0xf5ae('0x24')](function(_0x26e962){if(_0x26e962){_0x5e5adc=_0x26e962[_0xf5ae('0x26')]({'plain':!![]});_0x588dc5[_0xf5ae('0x30')]=_['keys'](db[_0xf5ae('0x54')][_0xf5ae('0x46')]);_0x588dc5[_0xf5ae('0x31')]=_[_0xf5ae('0x32')](_0x11e4b9['query']);_0x588dc5[_0xf5ae('0x33')]=_[_0xf5ae('0x34')](_0x588dc5[_0xf5ae('0x30')],_0x588dc5[_0xf5ae('0x31')]);_0x59fdd6[_0xf5ae('0x35')]=_[_0xf5ae('0x34')](_0x588dc5[_0xf5ae('0x30')],qs['fields'](_0x11e4b9[_0xf5ae('0x31')][_0xf5ae('0x36')]));_0x59fdd6[_0xf5ae('0x35')]=_0x59fdd6[_0xf5ae('0x35')][_0xf5ae('0x47')]?_0x59fdd6['attributes']:_0x588dc5[_0xf5ae('0x30')];if(!_0x11e4b9['query'][_0xf5ae('0x37')](_0xf5ae('0x38'))){_0x59fdd6[_0xf5ae('0x1d')]=qs[_0xf5ae('0x1d')](_0x11e4b9[_0xf5ae('0x31')][_0xf5ae('0x1d')]);_0x59fdd6[_0xf5ae('0x1b')]=qs['offset'](_0x11e4b9[_0xf5ae('0x31')][_0xf5ae('0x1b')]);}_0x59fdd6[_0xf5ae('0x55')]=qs[_0xf5ae('0x39')](_0x11e4b9[_0xf5ae('0x31')][_0xf5ae('0x39')]);_0x59fdd6[_0xf5ae('0x3a')]=qs[_0xf5ae('0x33')](_[_0xf5ae('0x3b')](_0x11e4b9['query'],_0x588dc5[_0xf5ae('0x33')]));_0x59fdd6[_0xf5ae('0x3a')][_0xf5ae('0x56')]=_0x26e962['id'];if(_0x11e4b9['query']['filter']){_0x59fdd6[_0xf5ae('0x3a')]=_['merge'](_0x59fdd6['where'],{'$or':_[_0xf5ae('0x2e')](_0x59fdd6['attributes'],function(_0xc29e6c){var _0x339346={};_0x339346[_0xc29e6c]={'$like':'%'+_0x11e4b9[_0xf5ae('0x31')][_0xf5ae('0x3c')]+'%'};return _0x339346;})});}_0x59fdd6=_['merge']({},_0x59fdd6,_0x11e4b9[_0xf5ae('0x48')]);return db[_0xf5ae('0x54')][_0xf5ae('0x57')](_0x59fdd6);}})[_0xf5ae('0x24')](function(_0x2b86e8){if(_0x2b86e8){return db[_0xf5ae('0x58')]['findAndCountAll']({'where':{'id':_[_0xf5ae('0x2e')](_0x2b86e8,_0xf5ae('0x59')),'role':'agent'},'attributes':['id',_0xf5ae('0x2b'),_0xf5ae('0x5a'),'updatedAt',_0xf5ae('0x5b')]});}})[_0xf5ae('0x24')](function(_0x7de3d3){if(_0x7de3d3){return{'count':_0x7de3d3['count'],'rows':_[_0xf5ae('0x2e')](_0x7de3d3['rows'],function(_0x4a4175){return{'membername':_0x4a4175[_0xf5ae('0x2b')],'UserId':_0x4a4175['id'],'queue_name':_0x5e5adc['name'],'FaxQueueId':_0x5e5adc['id'],'interface':util[_0xf5ae('0x5c')](_0xf5ae('0x5d'),_0xf5ae('0x5e'),_0x4a4175[_0xf5ae('0x2b')]),'penalty':0x0,'paused':_0x4a4175[_0xf5ae('0x5a')],'createdAt':_0x4a4175[_0xf5ae('0x5b')],'updatedAt':_0x4a4175[_0xf5ae('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5ae('0x24')](respondWithFilteredResult(_0x2f778a,_0x59fdd6))[_0xf5ae('0x43')](handleError(_0x2f778a,null));};exports[_0xf5ae('0x60')]=function(_0x1c49c5,_0x189fea,_0x3cb454){var _0x3a7fb1={};var _0x29eefd={};var _0x2e7192;var _0x2a7605;return db[_0xf5ae('0x45')]['findOne']({'where':{'id':_0x1c49c5[_0xf5ae('0x44')]['id']}})['then'](handleEntityNotFound(_0x189fea,null))[_0xf5ae('0x24')](function(_0x768ecd){if(_0x768ecd){_0x2e7192=_0x768ecd;_0x29eefd[_0xf5ae('0x30')]=_[_0xf5ae('0x32')](db[_0xf5ae('0x61')][_0xf5ae('0x46')]);_0x29eefd[_0xf5ae('0x31')]=_['keys'](_0x1c49c5['query']);_0x29eefd[_0xf5ae('0x33')]=_[_0xf5ae('0x34')](_0x29eefd[_0xf5ae('0x30')],_0x29eefd[_0xf5ae('0x31')]);_0x3a7fb1[_0xf5ae('0x35')]=_[_0xf5ae('0x34')](_0x29eefd[_0xf5ae('0x30')],qs[_0xf5ae('0x36')](_0x1c49c5['query']['fields']));_0x3a7fb1[_0xf5ae('0x35')]=_0x3a7fb1['attributes']['length']?_0x3a7fb1[_0xf5ae('0x35')]:_0x29eefd[_0xf5ae('0x30')];_0x3a7fb1['order']=qs[_0xf5ae('0x39')](_0x1c49c5[_0xf5ae('0x31')][_0xf5ae('0x39')]);_0x3a7fb1[_0xf5ae('0x3a')]=qs[_0xf5ae('0x33')](_[_0xf5ae('0x3b')](_0x1c49c5['query'],_0x29eefd['filters']));if(_0x1c49c5[_0xf5ae('0x31')][_0xf5ae('0x3c')]){_0x3a7fb1['where']=_['merge'](_0x3a7fb1[_0xf5ae('0x3a')],{'$or':_[_0xf5ae('0x2e')](_0x3a7fb1[_0xf5ae('0x35')],function(_0x2a6478){var _0x2f37a5={};_0x2f37a5[_0x2a6478]={'$like':'%'+_0x1c49c5[_0xf5ae('0x31')][_0xf5ae('0x3c')]+'%'};return _0x2f37a5;})});}_0x3a7fb1=_[_0xf5ae('0x3d')]({},_0x3a7fb1,_0x1c49c5['options']);return _0x2e7192['getTeams'](_0x3a7fb1);}})[_0xf5ae('0x24')](function(_0x2ebb70){if(_0x2ebb70){_0x2a7605=_0x2ebb70[_0xf5ae('0x47')];if(!_0x1c49c5[_0xf5ae('0x31')][_0xf5ae('0x37')](_0xf5ae('0x38'))){_0x3a7fb1[_0xf5ae('0x1d')]=qs[_0xf5ae('0x1d')](_0x1c49c5[_0xf5ae('0x31')]['limit']);_0x3a7fb1[_0xf5ae('0x1b')]=qs[_0xf5ae('0x1b')](_0x1c49c5['query'][_0xf5ae('0x1b')]);}return _0x2e7192[_0xf5ae('0x60')](_0x3a7fb1);}})[_0xf5ae('0x24')](function(_0x5283ea){if(_0x5283ea){return _0x5283ea?{'count':_0x2a7605,'rows':_0x5283ea}:null;}})[_0xf5ae('0x24')](respondWithResult(_0x189fea,null))[_0xf5ae('0x43')](handleError(_0x189fea,null));};exports[_0xf5ae('0x62')]=function(_0x363c67,_0xb52746,_0x3b49ef){var _0x2626b0=_0x363c67[_0xf5ae('0x4b')][_0xf5ae('0x63')];return db['Team'][_0xf5ae('0x57')]({'where':{'id':_0x2626b0},'attributes':['id'],'include':[{'model':db[_0xf5ae('0x58')],'as':_0xf5ae('0x64'),'attributes':['id',_0xf5ae('0x2b'),_0xf5ae('0x65'),_0xf5ae('0x66'),_0xf5ae('0x67')],'raw':!![]}]})[_0xf5ae('0x24')](function(_0x35b161){if(_0x35b161){var _0x5d2d4a=_[_0xf5ae('0x68')](_0x35b161,function(_0x314e78){var _0x1e901b=_0x314e78[_0xf5ae('0x26')]({'plain':!![]});return _0x1e901b[_0xf5ae('0x64')];});return db['FaxQueue'][_0xf5ae('0x49')]({'where':{'id':_0x363c67[_0xf5ae('0x44')]['id']}})[_0xf5ae('0x24')](function(_0x2cc44e){return db[_0xf5ae('0x69')][_0xf5ae('0x6a')](function(_0x421f03){return _0x2cc44e[_0xf5ae('0x62')](_0x2626b0,{'transaction':_0x421f03})[_0xf5ae('0x24')](function(){return BPromise[_0xf5ae('0x6b')](_0x5d2d4a,function(_0x287463){return db[_0xf5ae('0x54')][_0xf5ae('0x6c')]({'where':{'UserId':_0x287463['id'],'FaxQueueId':_0x363c67['params']['id']},'transaction':_0x421f03});});})[_0xf5ae('0x24')](function(){_0x5d2d4a[_0xf5ae('0x6d')](function(_0x493a9e){socket['emit'](_0xf5ae('0x6e'),{'UserId':_0x493a9e['id'],'FaxQueueId':_0x2cc44e['id']});});});});});}})[_0xf5ae('0x24')](respondWithStatusCode(_0xb52746,null))[_0xf5ae('0x43')](handleError(_0xb52746,null));};exports['removeTeams']=function(_0x262520,_0x596d52,_0x40d842){return db[_0xf5ae('0x61')][_0xf5ae('0x57')]({'where':{'id':_0x262520[_0xf5ae('0x31')][_0xf5ae('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf5ae('0x64'),'attributes':['id'],'raw':!![]}]})[_0xf5ae('0x24')](handleEntityNotFound(_0x596d52,null))['then'](function(_0x6f3b1f){var _0x540481=_[_0xf5ae('0x2e')](_0x6f3b1f,'id');var _0x619065=[];var _0xcfc437=[];var _0x404d67=squel[_0xf5ae('0x6f')]();_0x404d67['field'](_0xf5ae('0x70'))[_0xf5ae('0x71')](_0xf5ae('0x72'),'tq')[_0xf5ae('0x73')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5ae('0x3a')](_0xf5ae('0x74'),_0x262520[_0xf5ae('0x44')]['id']);for(var _0x2ae1ff=0x0;_0x2ae1ff<_0x6f3b1f[_0xf5ae('0x47')];_0x2ae1ff+=0x1){let _0x5e3aeb=_0x6f3b1f[_0x2ae1ff];for(var _0x49f351=0x0;_0x49f351<_0x5e3aeb[_0xf5ae('0x64')][_0xf5ae('0x47')];_0x49f351+=0x1){let _0x5c61a0=_0x5e3aeb[_0xf5ae('0x64')][_0x49f351];var _0x3caf81=_0x404d67['clone']();_0x3caf81[_0xf5ae('0x3a')](_0xf5ae('0x75'),_0x5c61a0['id']);_0xcfc437[_0xf5ae('0x76')](db[_0xf5ae('0x69')]['query'](_0x3caf81['toString'](),{'type':db[_0xf5ae('0x69')]['QueryTypes'][_0xf5ae('0x77')]})[_0xf5ae('0x24')](function(_0x1faad7){if(_0x1faad7[_0xf5ae('0x47')]===0x1){return _0x5c61a0['id'];}else{var _0x315f3a=_[_0xf5ae('0x78')](_[_0xf5ae('0x2e')](_0x1faad7,_0xf5ae('0x79')),function(_0x1cf14f){return _[_0xf5ae('0x7a')](_0x540481,_0x1cf14f);});if(_0x315f3a){return _0x5c61a0['id'];}}}));}}return BPromise['all'](_0xcfc437)[_0xf5ae('0x24')](function(_0x3de4e1){_0x619065=_(_0x619065)[_0xf5ae('0x7b')](_0x3de4e1)[_0xf5ae('0x7c')]()[_0xf5ae('0x7d')]();return db[_0xf5ae('0x45')][_0xf5ae('0x49')]({'where':{'id':_0x262520[_0xf5ae('0x44')]['id']}})['then'](function(_0x321901){return db[_0xf5ae('0x69')][_0xf5ae('0x6a')](function(_0x5340c7){return _0x321901[_0xf5ae('0x7e')](_0x262520[_0xf5ae('0x31')][_0xf5ae('0x63')],{'transaction':_0x5340c7})[_0xf5ae('0x24')](function(){if(!_[_0xf5ae('0x7f')](_0x619065)){return _0x321901['removeAgents'](_0x619065,{'transaction':_0x5340c7});}})[_0xf5ae('0x24')](function(){_0x619065[_0xf5ae('0x6d')](function(_0x22ed88){socket[_0xf5ae('0x80')](_0xf5ae('0x81'),{'UserId':_0x22ed88,'FaxQueueId':_0x321901['id']});});});});});});})[_0xf5ae('0x24')](respondWithStatusCode(_0x596d52,null))[_0xf5ae('0x43')](handleError(_0x596d52,null));};exports[_0xf5ae('0x82')]=function(_0x519cd2,_0x233924,_0xcba561){return db[_0xf5ae('0x45')][_0xf5ae('0x49')]({'where':{'id':_0x519cd2[_0xf5ae('0x44')]['id']}})[_0xf5ae('0x24')](handleEntityNotFound(_0x233924,null))[_0xf5ae('0x24')](function(_0x15233d){if(_0x15233d){return _0x15233d['addAgents'](_0x519cd2[_0xf5ae('0x4b')][_0xf5ae('0x63')],_[_0xf5ae('0x83')](_0x519cd2['body'],[_0xf5ae('0x63'),'id'])||{})[_0xf5ae('0x84')](function(_0x4710f6){for(var _0x1c9b59=0x0;_0x1c9b59<_0x519cd2[_0xf5ae('0x4b')][_0xf5ae('0x63')][_0xf5ae('0x47')];_0x1c9b59+=0x1){socket[_0xf5ae('0x80')](_0xf5ae('0x6e'),{'UserId':Number(_0x519cd2[_0xf5ae('0x4b')][_0xf5ae('0x63')][_0x1c9b59]),'FaxQueueId':Number(_0x519cd2['params']['id'])});}return _0x4710f6;});}})[_0xf5ae('0x24')](respondWithResult(_0x233924,null))[_0xf5ae('0x43')](handleError(_0x233924,null));};exports[_0xf5ae('0x85')]=function(_0x5905a9,_0x139872,_0x5d0b5e){return db[_0xf5ae('0x45')][_0xf5ae('0x49')]({'where':{'id':_0x5905a9[_0xf5ae('0x44')]['id']}})['then'](handleEntityNotFound(_0x139872,null))['then'](function(_0x91e7f7){if(_0x91e7f7){return _0x91e7f7['removeAgents'](_0x5905a9['query'][_0xf5ae('0x63')])[_0xf5ae('0x24')](function(){if(_[_0xf5ae('0x86')](_0x5905a9[_0xf5ae('0x31')][_0xf5ae('0x63')])){for(var _0x59d8aa=0x0;_0x59d8aa<_0x5905a9[_0xf5ae('0x31')][_0xf5ae('0x63')][_0xf5ae('0x47')];_0x59d8aa+=0x1){socket[_0xf5ae('0x80')](_0xf5ae('0x81'),{'UserId':Number(_0x5905a9['query'][_0xf5ae('0x63')][_0x59d8aa]),'FaxQueueId':Number(_0x5905a9[_0xf5ae('0x44')]['id'])});}}else{socket[_0xf5ae('0x80')](_0xf5ae('0x81'),{'UserId':Number(_0x5905a9[_0xf5ae('0x31')][_0xf5ae('0x63')]),'FaxQueueId':Number(_0x5905a9[_0xf5ae('0x44')]['id'])});}});}})['then'](respondWithStatusCode(_0x139872,null))[_0xf5ae('0x43')](handleError(_0x139872,null));};exports[_0xf5ae('0x87')]=function(_0x2f6d2e,_0x1fac2a,_0x4e49c8){var _0x3096cd={};var _0x439817={};var _0x2b457d;var _0x24b334;return db[_0xf5ae('0x45')][_0xf5ae('0x53')]({'where':{'id':_0x2f6d2e[_0xf5ae('0x44')]['id']}})[_0xf5ae('0x24')](handleEntityNotFound(_0x1fac2a,null))[_0xf5ae('0x24')](function(_0xbb942b){if(_0xbb942b){_0x2b457d=_0xbb942b;_0x439817[_0xf5ae('0x30')]=_['keys'](db[_0xf5ae('0x58')]['rawAttributes']);_0x439817[_0xf5ae('0x31')]=_[_0xf5ae('0x32')](_0x2f6d2e[_0xf5ae('0x31')]);_0x439817[_0xf5ae('0x33')]=_[_0xf5ae('0x34')](_0x439817['model'],_0x439817[_0xf5ae('0x31')]);_0x3096cd['attributes']=_[_0xf5ae('0x34')](_0x439817['model'],qs[_0xf5ae('0x36')](_0x2f6d2e[_0xf5ae('0x31')][_0xf5ae('0x36')]));_0x3096cd[_0xf5ae('0x35')]=_0x3096cd['attributes']['length']?_0x3096cd[_0xf5ae('0x35')]:_0x439817[_0xf5ae('0x30')];_0x3096cd['order']=qs[_0xf5ae('0x39')](_0x2f6d2e[_0xf5ae('0x31')][_0xf5ae('0x39')]);_0x3096cd[_0xf5ae('0x3a')]=qs['filters'](_[_0xf5ae('0x3b')](_0x2f6d2e[_0xf5ae('0x31')],_0x439817[_0xf5ae('0x33')]));if(_0x2f6d2e[_0xf5ae('0x31')]['filter']){_0x3096cd[_0xf5ae('0x3a')]=_[_0xf5ae('0x3d')](_0x3096cd[_0xf5ae('0x3a')],{'$or':_[_0xf5ae('0x2e')](_0x3096cd['attributes'],function(_0x38d382){var _0x1aa505={};_0x1aa505[_0x38d382]={'$like':'%'+_0x2f6d2e[_0xf5ae('0x31')][_0xf5ae('0x3c')]+'%'};return _0x1aa505;})});}_0x3096cd=_[_0xf5ae('0x3d')]({},_0x3096cd,_0x2f6d2e['options']);return _0x2b457d[_0xf5ae('0x87')](_0x3096cd);}})[_0xf5ae('0x24')](function(_0x4a58a8){if(_0x4a58a8){_0x24b334=_0x4a58a8[_0xf5ae('0x47')];if(!_0x2f6d2e[_0xf5ae('0x31')][_0xf5ae('0x37')](_0xf5ae('0x38'))){_0x3096cd[_0xf5ae('0x1d')]=qs[_0xf5ae('0x1d')](_0x2f6d2e[_0xf5ae('0x31')]['limit']);_0x3096cd['offset']=qs[_0xf5ae('0x1b')](_0x2f6d2e[_0xf5ae('0x31')]['offset']);}return _0x2b457d[_0xf5ae('0x87')](_0x3096cd);}})[_0xf5ae('0x24')](function(_0x340b23){if(_0x340b23){return _0x340b23?{'count':_0x24b334,'rows':_0x340b23}:null;}})[_0xf5ae('0x24')](respondWithResult(_0x1fac2a,null))[_0xf5ae('0x43')](handleError(_0x1fac2a,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 572365a..a811197 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 _0xdad0=['hasOwnProperty','exports','events','../../mysqldb','FaxQueue','setMaxListeners','update','remove','emit'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0xdad0,0x18e));var _0x0dad=function(_0x30051a,_0x547ffc){_0x30051a=_0x30051a-0x0;var _0x114eae=_0xdad0[_0x30051a];return _0x114eae;};'use strict';var EventEmitter=require(_0x0dad('0x0'));var FaxQueue=require(_0x0dad('0x1'))['db'][_0x0dad('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0dad('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0dad('0x4'),'afterDestroy':_0x0dad('0x5')};function emitEvent(_0x311118){return function(_0x4d31b0,_0x20e887,_0xcd7771){FaxQueueEvents[_0x0dad('0x6')](_0x311118+':'+_0x4d31b0['id'],_0x4d31b0);FaxQueueEvents['emit'](_0x311118,_0x4d31b0);_0xcd7771(null);};}for(var e in events){if(events[_0x0dad('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x0dad('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xc6c2=['FaxQueue','save','update','remove','emit','exports','events'];(function(_0x551e34,_0x1178f4){var _0x481cce=function(_0x3531ef){while(--_0x3531ef){_0x551e34['push'](_0x551e34['shift']());}};_0x481cce(++_0x1178f4);}(_0xc6c2,0x1a3));var _0x2c6c=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0xc6c2[_0x695b76];return _0x1dc21f;};'use strict';var EventEmitter=require(_0x2c6c('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x2c6c('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2c6c('0x2'),'afterUpdate':_0x2c6c('0x3'),'afterDestroy':_0x2c6c('0x4')};function emitEvent(_0xb5898b){return function(_0x2263af,_0x39152a,_0x56d1c5){FaxQueueEvents[_0x2c6c('0x5')](_0xb5898b+':'+_0x2263af['id'],_0x2263af);FaxQueueEvents['emit'](_0xb5898b,_0x2263af);_0x56d1c5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x2c6c('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 408b13d..b0f02ca 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 _0xeed8=['../../config/logger','api','request-promise','path','./faxQueue.attributes','exports','fax_queues','lodash','util'];(function(_0x5d9449,_0x5382b7){var _0x583cf7=function(_0x30464f){while(--_0x30464f){_0x5d9449['push'](_0x5d9449['shift']());}};_0x583cf7(++_0x5382b7);}(_0xeed8,0x6a));var _0x8eed=function(_0x5af410,_0x4e9ee4){_0x5af410=_0x5af410-0x0;var _0x170c35=_0xeed8[_0x5af410];return _0x170c35;};'use strict';var _=require(_0x8eed('0x0'));var util=require(_0x8eed('0x1'));var logger=require(_0x8eed('0x2'))(_0x8eed('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8eed('0x4'));var fs=require('fs');var path=require(_0x8eed('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8eed('0x6'));module[_0x8eed('0x7')]=function(_0xdafaf3,_0x4d42da){return _0xdafaf3['define']('FaxQueue',attributes,{'tableName':_0x8eed('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f80=['../../config/logger','request-promise','path','../../config/environment','./faxQueue.attributes','exports','fax_queues','util'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x9f80,0x1ef));var _0x09f8=function(_0x34c256,_0x43205f){_0x34c256=_0x34c256-0x0;var _0x2c2950=_0x9f80[_0x34c256];return _0x2c2950;};'use strict';var _=require('lodash');var util=require(_0x09f8('0x0'));var logger=require(_0x09f8('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x09f8('0x2'));var fs=require('fs');var path=require(_0x09f8('0x3'));var rimraf=require('rimraf');var config=require(_0x09f8('0x4'));var attributes=require(_0x09f8('0x5'));module[_0x09f8('0x6')]=function(_0x29a028,_0x135c32){return _0x29a028['define']('FaxQueue',attributes,{'tableName':_0x09f8('0x7'),'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 31aeaa4..b5b3cf8 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 _0x4283=['../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3a87d1,_0x584e71){var _0x3aa6d8=function(_0x1e1417){while(--_0x1e1417){_0x3a87d1['push'](_0x3a87d1['shift']());}};_0x3aa6d8(++_0x584e71);}(_0x4283,0x141));var _0x3428=function(_0x24330f,_0x265524){_0x24330f=_0x24330f-0x0;var _0x976ca3=_0x4283[_0x24330f];return _0x976ca3;};'use strict';var _=require(_0x3428('0x0'));var util=require(_0x3428('0x1'));var moment=require(_0x3428('0x2'));var BPromise=require(_0x3428('0x3'));var rs=require(_0x3428('0x4'));var fs=require('fs');var Redis=require(_0x3428('0x5'));var db=require(_0x3428('0x6'))['db'];var utils=require(_0x3428('0x7'));var logger=require('../../config/logger')(_0x3428('0x8'));var config=require('../../config/environment');var jayson=require(_0x3428('0x9'));var client=jayson[_0x3428('0xa')][_0x3428('0xb')]({'port':0x232a});config['redis']=_[_0x3428('0xc')](config[_0x3428('0xd')],{'host':_0x3428('0xe'),'port':0x18eb});var socket=require(_0x3428('0xf'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x3428('0x10')](socket);function respondWithRpcPromise(_0x425392,_0x5918d2,_0x2e8cd1){return new BPromise(function(_0x39c598,_0xbf11a9){return client[_0x3428('0x11')](_0x425392,_0x2e8cd1)[_0x3428('0x12')](function(_0x36f425){logger[_0x3428('0x13')](_0x3428('0x14'),_0x5918d2,_0x3428('0x15'));logger[_0x3428('0x16')](_0x3428('0x17'),_0x5918d2,_0x3428('0x15'),JSON[_0x3428('0x18')](_0x36f425));if(_0x36f425['error']){if(_0x36f425[_0x3428('0x19')][_0x3428('0x1a')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x5918d2,_0x36f425[_0x3428('0x19')][_0x3428('0x1b')]);return _0xbf11a9(_0x36f425[_0x3428('0x19')]['message']);}logger[_0x3428('0x19')](_0x3428('0x14'),_0x5918d2,_0x36f425[_0x3428('0x19')][_0x3428('0x1b')]);return _0x39c598(_0x36f425['error'][_0x3428('0x1b')]);}else{logger[_0x3428('0x13')](_0x3428('0x14'),_0x5918d2,_0x3428('0x15'));_0x39c598(_0x36f425['result']['message']);}})[_0x3428('0x1c')](function(_0x5980e6){logger[_0x3428('0x19')](_0x3428('0x14'),_0x5918d2,_0x5980e6);_0xbf11a9(_0x5980e6);});});}exports[_0x3428('0x1d')]=function(_0x5d3485){var _0x489812=this;return new Promise(function(_0x20d562,_0x2f4f67){return db[_0x3428('0x1e')]['findAll']({'raw':_0x5d3485[_0x3428('0x1f')]?_0x5d3485[_0x3428('0x1f')][_0x3428('0x20')]===undefined?!![]:![]:!![],'where':_0x5d3485[_0x3428('0x1f')]?_0x5d3485[_0x3428('0x1f')][_0x3428('0x21')]||null:null,'attributes':_0x5d3485[_0x3428('0x1f')]?_0x5d3485[_0x3428('0x1f')][_0x3428('0x22')]||null:null,'limit':_0x5d3485[_0x3428('0x1f')]?_0x5d3485[_0x3428('0x1f')][_0x3428('0x23')]||null:null,'include':_0x5d3485[_0x3428('0x1f')]?_0x5d3485['options'][_0x3428('0x24')]?_[_0x3428('0x25')](_0x5d3485[_0x3428('0x1f')][_0x3428('0x24')],function(_0x402838){return{'model':db[_0x402838[_0x3428('0x26')]],'as':_0x402838['as'],'attributes':_0x402838[_0x3428('0x22')],'include':_0x402838[_0x3428('0x24')]?_[_0x3428('0x25')](_0x402838[_0x3428('0x24')],function(_0x5547cf){return{'model':db[_0x5547cf[_0x3428('0x26')]],'as':_0x5547cf['as'],'attributes':_0x5547cf['attributes'],'include':_0x5547cf[_0x3428('0x24')]?_[_0x3428('0x25')](_0x5547cf['include'],function(_0x521dec){return{'model':db[_0x521dec[_0x3428('0x26')]],'as':_0x521dec['as'],'attributes':_0x521dec[_0x3428('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3428('0x12')](function(_0x514468){logger['info'](_0x3428('0x1d'),_0x5d3485);logger[_0x3428('0x16')](_0x3428('0x1d'),_0x5d3485,JSON[_0x3428('0x18')](_0x514468));_0x20d562(_0x514468);})[_0x3428('0x1c')](function(_0x309e8b){logger[_0x3428('0x19')](_0x3428('0x1d'),_0x309e8b[_0x3428('0x1b')],_0x5d3485);_0x2f4f67(_0x489812[_0x3428('0x19')](0x1f4,_0x309e8b[_0x3428('0x1b')]));});});};exports[_0x3428('0x27')]=function(_0x1c4298){var _0x331cbc=this;return new Promise(function(_0x2a066b,_0x35aa41){return db[_0x3428('0x1e')][_0x3428('0x28')]({'raw':_0x1c4298['options']?_0x1c4298['options'][_0x3428('0x20')]===undefined?!![]:![]:!![],'where':_0x1c4298[_0x3428('0x1f')]?_0x1c4298[_0x3428('0x1f')][_0x3428('0x21')]||null:null,'attributes':_0x1c4298[_0x3428('0x1f')]?_0x1c4298['options'][_0x3428('0x22')]||null:null,'include':_0x1c4298[_0x3428('0x1f')]?_0x1c4298[_0x3428('0x1f')][_0x3428('0x24')]?_[_0x3428('0x25')](_0x1c4298[_0x3428('0x1f')]['include'],function(_0x55b557){return{'model':db[_0x55b557['model']],'as':_0x55b557['as'],'attributes':_0x55b557[_0x3428('0x22')],'include':_0x55b557['include']?_[_0x3428('0x25')](_0x55b557[_0x3428('0x24')],function(_0x273fe2){return{'model':db[_0x273fe2[_0x3428('0x26')]],'as':_0x273fe2['as'],'attributes':_0x273fe2[_0x3428('0x22')],'include':_0x273fe2[_0x3428('0x24')]?_['map'](_0x273fe2['include'],function(_0x33c39b){return{'model':db[_0x33c39b[_0x3428('0x26')]],'as':_0x33c39b['as'],'attributes':_0x33c39b['attributes']};}):[]};}):[]};}):[]:[]})[_0x3428('0x12')](function(_0x1e9cf8){logger[_0x3428('0x13')](_0x3428('0x27'),_0x1c4298);logger[_0x3428('0x16')](_0x3428('0x27'),_0x1c4298,JSON['stringify'](_0x1e9cf8));_0x2a066b(_0x1e9cf8);})[_0x3428('0x1c')](function(_0x4ebf33){logger[_0x3428('0x19')](_0x3428('0x27'),_0x4ebf33[_0x3428('0x1b')],_0x1c4298);_0x35aa41(_0x331cbc[_0x3428('0x19')](0x1f4,_0x4ebf33[_0x3428('0x1b')]));});});}; \ No newline at end of file +var _0xdaab=['stringify','error','FaxQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','FaxQueue','findAll','options','raw','attributes','include','map','model','GetFaxQueue','ShowFaxQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','then','info','debug','FaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x16fe43,_0x1cd9db){var _0x52695c=function(_0x45f4be){while(--_0x45f4be){_0x16fe43['push'](_0x16fe43['shift']());}};_0x52695c(++_0x1cd9db);}(_0xdaab,0xbb));var _0xbdaa=function(_0x154c59,_0x1343e0){_0x154c59=_0x154c59-0x0;var _0x562a80=_0xdaab[_0x154c59];return _0x562a80;};'use strict';var _=require(_0xbdaa('0x0'));var util=require(_0xbdaa('0x1'));var moment=require(_0xbdaa('0x2'));var BPromise=require(_0xbdaa('0x3'));var rs=require(_0xbdaa('0x4'));var fs=require('fs');var Redis=require(_0xbdaa('0x5'));var db=require(_0xbdaa('0x6'))['db'];var utils=require(_0xbdaa('0x7'));var logger=require(_0xbdaa('0x8'))(_0xbdaa('0x9'));var config=require(_0xbdaa('0xa'));var jayson=require(_0xbdaa('0xb'));var client=jayson[_0xbdaa('0xc')][_0xbdaa('0xd')]({'port':0x232a});config[_0xbdaa('0xe')]=_[_0xbdaa('0xf')](config[_0xbdaa('0xe')],{'host':_0xbdaa('0x10'),'port':0x18eb});var socket=require(_0xbdaa('0x11'))(new Redis(config[_0xbdaa('0xe')]));require(_0xbdaa('0x12'))['register'](socket);function respondWithRpcPromise(_0x39aaec,_0x46cfda,_0x4b317a){return new BPromise(function(_0x4f2919,_0x469583){return client['request'](_0x39aaec,_0x4b317a)[_0xbdaa('0x13')](function(_0x1b0744){logger[_0xbdaa('0x14')]('FaxQueue,\x20%s,\x20%s',_0x46cfda,'request\x20sent');logger[_0xbdaa('0x15')](_0xbdaa('0x16'),_0x46cfda,'request\x20sent',JSON[_0xbdaa('0x17')](_0x1b0744));if(_0x1b0744[_0xbdaa('0x18')]){if(_0x1b0744[_0xbdaa('0x18')]['code']===0x1f4){logger[_0xbdaa('0x18')](_0xbdaa('0x19'),_0x46cfda,_0x1b0744[_0xbdaa('0x18')]['message']);return _0x469583(_0x1b0744[_0xbdaa('0x18')][_0xbdaa('0x1a')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x46cfda,_0x1b0744[_0xbdaa('0x18')]['message']);return _0x4f2919(_0x1b0744[_0xbdaa('0x18')][_0xbdaa('0x1a')]);}else{logger[_0xbdaa('0x14')](_0xbdaa('0x19'),_0x46cfda,_0xbdaa('0x1b'));_0x4f2919(_0x1b0744[_0xbdaa('0x1c')][_0xbdaa('0x1a')]);}})[_0xbdaa('0x1d')](function(_0x20614f){logger[_0xbdaa('0x18')](_0xbdaa('0x19'),_0x46cfda,_0x20614f);_0x469583(_0x20614f);});});}exports['GetFaxQueue']=function(_0x1eee3b){var _0x2bf418=this;return new Promise(function(_0x431598,_0x2c37a8){return db[_0xbdaa('0x1e')][_0xbdaa('0x1f')]({'raw':_0x1eee3b[_0xbdaa('0x20')]?_0x1eee3b['options'][_0xbdaa('0x21')]===undefined?!![]:![]:!![],'where':_0x1eee3b[_0xbdaa('0x20')]?_0x1eee3b['options']['where']||null:null,'attributes':_0x1eee3b['options']?_0x1eee3b[_0xbdaa('0x20')][_0xbdaa('0x22')]||null:null,'limit':_0x1eee3b[_0xbdaa('0x20')]?_0x1eee3b['options']['limit']||null:null,'include':_0x1eee3b[_0xbdaa('0x20')]?_0x1eee3b['options'][_0xbdaa('0x23')]?_[_0xbdaa('0x24')](_0x1eee3b[_0xbdaa('0x20')][_0xbdaa('0x23')],function(_0x5d5972){return{'model':db[_0x5d5972['model']],'as':_0x5d5972['as'],'attributes':_0x5d5972[_0xbdaa('0x22')],'include':_0x5d5972[_0xbdaa('0x23')]?_['map'](_0x5d5972['include'],function(_0x27e5f6){return{'model':db[_0x27e5f6[_0xbdaa('0x25')]],'as':_0x27e5f6['as'],'attributes':_0x27e5f6[_0xbdaa('0x22')],'include':_0x27e5f6[_0xbdaa('0x23')]?_['map'](_0x27e5f6[_0xbdaa('0x23')],function(_0xa59769){return{'model':db[_0xa59769[_0xbdaa('0x25')]],'as':_0xa59769['as'],'attributes':_0xa59769[_0xbdaa('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbdaa('0x13')](function(_0x20fab8){logger[_0xbdaa('0x14')](_0xbdaa('0x26'),_0x1eee3b);logger['debug'](_0xbdaa('0x26'),_0x1eee3b,JSON[_0xbdaa('0x17')](_0x20fab8));_0x431598(_0x20fab8);})[_0xbdaa('0x1d')](function(_0x25e24d){logger['error'](_0xbdaa('0x26'),_0x25e24d[_0xbdaa('0x1a')],_0x1eee3b);_0x2c37a8(_0x2bf418['error'](0x1f4,_0x25e24d[_0xbdaa('0x1a')]));});});};exports[_0xbdaa('0x27')]=function(_0x5ac69f){var _0x56b3ac=this;return new Promise(function(_0x43e43f,_0xa7a576){return db[_0xbdaa('0x1e')][_0xbdaa('0x28')]({'raw':_0x5ac69f[_0xbdaa('0x20')]?_0x5ac69f[_0xbdaa('0x20')][_0xbdaa('0x21')]===undefined?!![]:![]:!![],'where':_0x5ac69f[_0xbdaa('0x20')]?_0x5ac69f['options'][_0xbdaa('0x29')]||null:null,'attributes':_0x5ac69f[_0xbdaa('0x20')]?_0x5ac69f['options'][_0xbdaa('0x22')]||null:null,'include':_0x5ac69f['options']?_0x5ac69f[_0xbdaa('0x20')]['include']?_['map'](_0x5ac69f['options'][_0xbdaa('0x23')],function(_0x1feef2){return{'model':db[_0x1feef2[_0xbdaa('0x25')]],'as':_0x1feef2['as'],'attributes':_0x1feef2['attributes'],'include':_0x1feef2[_0xbdaa('0x23')]?_[_0xbdaa('0x24')](_0x1feef2['include'],function(_0x57725c){return{'model':db[_0x57725c[_0xbdaa('0x25')]],'as':_0x57725c['as'],'attributes':_0x57725c['attributes'],'include':_0x57725c[_0xbdaa('0x23')]?_[_0xbdaa('0x24')](_0x57725c[_0xbdaa('0x23')],function(_0x32c400){return{'model':db[_0x32c400[_0xbdaa('0x25')]],'as':_0x32c400['as'],'attributes':_0x32c400[_0xbdaa('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57ea72){logger['info'](_0xbdaa('0x27'),_0x5ac69f);logger[_0xbdaa('0x15')](_0xbdaa('0x27'),_0x5ac69f,JSON[_0xbdaa('0x17')](_0x57ea72));_0x43e43f(_0x57ea72);})[_0xbdaa('0x1d')](function(_0x6739dc){logger['error'](_0xbdaa('0x27'),_0x6739dc[_0xbdaa('0x1a')],_0x5ac69f);_0xa7a576(_0x56b3ac[_0xbdaa('0x18')](0x1f4,_0x6739dc[_0xbdaa('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 008c866..aa145a5 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 _0x060c=['emit','removeListener','register','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x423258,_0x2960d2){var _0x1ea61b=function(_0x4d4745){while(--_0x4d4745){_0x423258['push'](_0x423258['shift']());}};_0x1ea61b(++_0x2960d2);}(_0x060c,0x1e4));var _0xc060=function(_0x4351be,_0x3e5443){_0x4351be=_0x4351be-0x0;var _0x5e38e6=_0x060c[_0x4351be];return _0x5e38e6;};'use strict';var FaxQueueEvents=require(_0xc060('0x0'));var events=[_0xc060('0x1'),_0xc060('0x2'),_0xc060('0x3')];function createListener(_0x5dcc88,_0x23b03e){return function(_0x10f6da){_0x23b03e[_0xc060('0x4')](_0x5dcc88,_0x10f6da);};}function removeListener(_0x1f7ac2,_0x381314){return function(){FaxQueueEvents[_0xc060('0x5')](_0x1f7ac2,_0x381314);};}exports[_0xc060('0x6')]=function(_0x8a57f3){for(var _0x3edf4e=0x0,_0x3d24ec=events['length'];_0x3edf4e<_0x3d24ec;_0x3edf4e++){var _0x570e34=events[_0x3edf4e];var _0x3b727b=createListener(_0xc060('0x7')+_0x570e34,_0x8a57f3);FaxQueueEvents['on'](_0x570e34,_0x3b727b);}}; \ No newline at end of file +var _0xcf7f=['length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0xcf7f,0x77));var _0xfcf7=function(_0x5667cd,_0x232918){_0x5667cd=_0x5667cd-0x0;var _0x1b2a2f=_0xcf7f[_0x5667cd];return _0x1b2a2f;};'use strict';var FaxQueueEvents=require(_0xfcf7('0x0'));var events=[_0xfcf7('0x1'),_0xfcf7('0x2'),_0xfcf7('0x3')];function createListener(_0x59f95a,_0x2b2e3b){return function(_0x1ea50d){_0x2b2e3b[_0xfcf7('0x4')](_0x59f95a,_0x1ea50d);};}function removeListener(_0x17afa4,_0x336761){return function(){FaxQueueEvents[_0xfcf7('0x5')](_0x17afa4,_0x336761);};}exports[_0xfcf7('0x6')]=function(_0x3e989f){for(var _0x4a9239=0x0,_0x294ec9=events[_0xfcf7('0x7')];_0x4a9239<_0x294ec9;_0x4a9239++){var _0x37affe=events[_0x4a9239];var _0x4e853a=createListener(_0xfcf7('0x8')+_0x37affe,_0x3e989f);FaxQueueEvents['on'](_0x37affe,_0x4e853a);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 28d9466..5f419eb 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 _0x8cad=['./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xae5660,_0x17c117){var _0x152c74=function(_0x2c7332){while(--_0x2c7332){_0xae5660['push'](_0xae5660['shift']());}};_0x152c74(++_0x17c117);}(_0x8cad,0xfe));var _0xd8ca=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x8cad[_0x1589dd];return _0x1bddd1;};'use strict';var multer=require(_0xd8ca('0x0'));var util=require(_0xd8ca('0x1'));var path=require(_0xd8ca('0x2'));var timeout=require(_0xd8ca('0x3'));var express=require(_0xd8ca('0x4'));var router=express[_0xd8ca('0x5')]();var fs_extra=require(_0xd8ca('0x6'));var auth=require(_0xd8ca('0x7'));var interaction=require(_0xd8ca('0x8'));var config=require(_0xd8ca('0x9'));var controller=require(_0xd8ca('0xa'));router[_0xd8ca('0xb')]('/',auth[_0xd8ca('0xc')](),controller[_0xd8ca('0xd')]);router['get'](_0xd8ca('0xe'),auth[_0xd8ca('0xc')](),controller[_0xd8ca('0xf')]);router[_0xd8ca('0xb')](_0xd8ca('0x10'),auth['isAuthenticated'](),controller[_0xd8ca('0x11')]);router['get'](_0xd8ca('0x12'),auth[_0xd8ca('0xc')](),controller[_0xd8ca('0x13')]);router[_0xd8ca('0xb')](_0xd8ca('0x14'),auth[_0xd8ca('0xc')](),controller['getTeams']);router[_0xd8ca('0xb')](_0xd8ca('0x15'),auth[_0xd8ca('0xc')](),controller[_0xd8ca('0x16')]);router[_0xd8ca('0x17')]('/',auth[_0xd8ca('0xc')](),controller[_0xd8ca('0x18')]);router[_0xd8ca('0x17')](_0xd8ca('0x14'),auth['isAuthenticated'](),controller[_0xd8ca('0x19')]);router[_0xd8ca('0x17')](_0xd8ca('0x15'),auth[_0xd8ca('0xc')](),controller[_0xd8ca('0x1a')]);router[_0xd8ca('0x1b')](_0xd8ca('0x10'),auth[_0xd8ca('0xc')](),controller[_0xd8ca('0x1c')]);router[_0xd8ca('0x1d')]('/:id',auth[_0xd8ca('0xc')](),controller[_0xd8ca('0x1e')]);router[_0xd8ca('0x1d')](_0xd8ca('0x14'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xd8ca('0x1d')]('/:id/users',auth[_0xd8ca('0xc')](),controller[_0xd8ca('0x1f')]);module[_0xd8ca('0x20')]=router; \ No newline at end of file +var _0xdf55=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','delete','destroy','removeTeams'];(function(_0x50fd1a,_0x268673){var _0xc8a5d9=function(_0x3f4d3a){while(--_0x3f4d3a){_0x50fd1a['push'](_0x50fd1a['shift']());}};_0xc8a5d9(++_0x268673);}(_0xdf55,0x83));var _0x5df5=function(_0x20410e,_0x11ea83){_0x20410e=_0x20410e-0x0;var _0x18e1cc=_0xdf55[_0x20410e];return _0x18e1cc;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require('path');var timeout=require(_0x5df5('0x2'));var express=require(_0x5df5('0x3'));var router=express['Router']();var fs_extra=require(_0x5df5('0x4'));var auth=require(_0x5df5('0x5'));var interaction=require(_0x5df5('0x6'));var config=require('../../config/environment');var controller=require(_0x5df5('0x7'));router[_0x5df5('0x8')]('/',auth[_0x5df5('0x9')](),controller[_0x5df5('0xa')]);router[_0x5df5('0x8')](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xc')]);router['get'](_0x5df5('0xd'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xe')]);router['get']('/:id/members',auth[_0x5df5('0x9')](),controller['getMembers']);router[_0x5df5('0x8')](_0x5df5('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0x5df5('0x8')](_0x5df5('0x10'),auth[_0x5df5('0x9')](),controller[_0x5df5('0x11')]);router[_0x5df5('0x12')]('/',auth[_0x5df5('0x9')](),controller[_0x5df5('0x13')]);router[_0x5df5('0x12')](_0x5df5('0xf'),auth[_0x5df5('0x9')](),controller['addTeams']);router[_0x5df5('0x12')]('/:id/users',auth[_0x5df5('0x9')](),controller[_0x5df5('0x14')]);router[_0x5df5('0x15')](_0x5df5('0xd'),auth[_0x5df5('0x9')](),controller['update']);router[_0x5df5('0x16')](_0x5df5('0xd'),auth['isAuthenticated'](),controller[_0x5df5('0x17')]);router[_0x5df5('0x16')](_0x5df5('0xf'),auth[_0x5df5('0x9')](),controller[_0x5df5('0x18')]);router['delete']('/:id/users',auth[_0x5df5('0x9')](),controller['removeAgents']);module[_0x5df5('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 89d7980..ea1dcac 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 _0x8598=['exports','STRING','DATE','moment','sequelize'];(function(_0x55fc07,_0x110f12){var _0x51400a=function(_0x479856){while(--_0x479856){_0x55fc07['push'](_0x55fc07['shift']());}};_0x51400a(++_0x110f12);}(_0x8598,0x17f));var _0x8859=function(_0x18f020,_0x438e3f){_0x18f020=_0x18f020-0x0;var _0x44a72c=_0x8598[_0x18f020];return _0x44a72c;};'use strict';var moment=require(_0x8859('0x0'));var Sequelize=require(_0x8859('0x1'));module[_0x8859('0x2')]={'uniqueid':{'type':Sequelize[_0x8859('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8859('0x3')]},'joinAt':{'type':Sequelize[_0x8859('0x4')]},'leaveAt':{'type':Sequelize[_0x8859('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8859('0x3')]}}; \ No newline at end of file +var _0x1d5f=['STRING','DATE','sequelize','exports'];(function(_0x4ed0fc,_0x3091ee){var _0x22cef9=function(_0x364fde){while(--_0x364fde){_0x4ed0fc['push'](_0x4ed0fc['shift']());}};_0x22cef9(++_0x3091ee);}(_0x1d5f,0x8a));var _0xf1d5=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0x1d5f[_0x1f71d8];return _0x10b045;};'use strict';var moment=require('moment');var Sequelize=require(_0xf1d5('0x0'));module[_0xf1d5('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf1d5('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf1d5('0x3')]},'acceptAt':{'type':Sequelize[_0xf1d5('0x3')]},'exitAt':{'type':Sequelize[_0xf1d5('0x3')]},'reason':{'type':Sequelize[_0xf1d5('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index c77d1ad..d75f3db 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 _0xcd4e=['Content-Range','apply','save','update','destroy','then','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','FaxQueueReport','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set'];(function(_0x1d20b5,_0x19a3c6){var _0xdbbd2d=function(_0x4e40b0){while(--_0x4e40b0){_0x1d20b5['push'](_0x1d20b5['shift']());}};_0xdbbd2d(++_0x19a3c6);}(_0xcd4e,0x187));var _0xecd4=function(_0x446a56,_0x443f71){_0x446a56=_0x446a56-0x0;var _0x488bd6=_0xcd4e[_0x446a56];return _0x488bd6;};'use strict';var emlformat=require(_0xecd4('0x0'));var rimraf=require(_0xecd4('0x1'));var zipdir=require(_0xecd4('0x2'));var jsonpatch=require(_0xecd4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xecd4('0x4'));var Mustache=require(_0xecd4('0x5'));var util=require('util');var path=require(_0xecd4('0x6'));var sox=require('sox');var csv=require(_0xecd4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xecd4('0x8'));var _=require(_0xecd4('0x9'));var squel=require(_0xecd4('0xa'));var crypto=require(_0xecd4('0xb'));var jsforce=require(_0xecd4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xecd4('0x7'));var querystring=require(_0xecd4('0xd'));var Papa=require('papaparse');var Redis=require(_0xecd4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xecd4('0xf'));var as=require(_0xecd4('0x10'));var hardwareService=require(_0xecd4('0x11'));var logger=require('../../config/logger')(_0xecd4('0x12'));var utils=require(_0xecd4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xecd4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ccd07,_0x1a5f58){_0x1a5f58=_0x1a5f58||0xcc;return function(_0x425de2){if(_0x425de2){return _0x3ccd07[_0xecd4('0x15')](_0x1a5f58);}return _0x3ccd07[_0xecd4('0x16')](_0x1a5f58)['end']();};}function respondWithResult(_0x3645d1,_0x21cb7b){_0x21cb7b=_0x21cb7b||0xc8;return function(_0x15dddc){if(_0x15dddc){return _0x3645d1[_0xecd4('0x16')](_0x21cb7b)[_0xecd4('0x17')](_0x15dddc);}};}function respondWithFilteredResult(_0x1b69a2,_0x2add6f){return function(_0x39d681){if(_0x39d681){var _0x1fb460=typeof _0x2add6f['offset']===_0xecd4('0x18')&&typeof _0x2add6f[_0xecd4('0x19')]===_0xecd4('0x18');var _0x2b542c=_0x39d681[_0xecd4('0x1a')];var _0x2470ec=_0x1fb460?0x0:_0x2add6f['offset'];var _0x703bb4=_0x1fb460?_0x39d681['count']:_0x2add6f[_0xecd4('0x1b')]+_0x2add6f[_0xecd4('0x19')];var _0x38eb18;if(_0x703bb4>=_0x2b542c){_0x703bb4=_0x2b542c;_0x38eb18=0xc8;}else{_0x38eb18=0xce;}_0x1b69a2[_0xecd4('0x16')](_0x38eb18);return _0x1b69a2[_0xecd4('0x1c')](_0xecd4('0x1d'),_0x2470ec+'-'+_0x703bb4+'/'+_0x2b542c)[_0xecd4('0x17')](_0x39d681);}return null;};}function patchUpdates(_0x26bb76){return function(_0x21d7d1){try{jsonpatch[_0xecd4('0x1e')](_0x21d7d1,_0x26bb76,!![]);}catch(_0x14d24c){return BPromise['reject'](_0x14d24c);}return _0x21d7d1[_0xecd4('0x1f')]();};}function saveUpdates(_0x353f13,_0x269451){return function(_0x588f0b){if(_0x588f0b){return _0x588f0b[_0xecd4('0x20')](_0x353f13)['then'](function(_0x57ae55){return _0x57ae55;});}return null;};}function removeEntity(_0x2e5a0a,_0x11c791){return function(_0x104507){if(_0x104507){return _0x104507[_0xecd4('0x21')]()[_0xecd4('0x22')](function(){_0x2e5a0a[_0xecd4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2910e1,_0x38b6da){return function(_0x1b76d7){if(!_0x1b76d7){_0x2910e1['sendStatus'](0x194);}return _0x1b76d7;};}function handleError(_0x2d0a43,_0x3941d4){_0x3941d4=_0x3941d4||0x1f4;return function(_0x3ccb67){logger['error'](_0x3ccb67[_0xecd4('0x23')]);if(_0x3ccb67[_0xecd4('0x24')]){delete _0x3ccb67['name'];}_0x2d0a43[_0xecd4('0x16')](_0x3941d4)['send'](_0x3ccb67);};}exports[_0xecd4('0x25')]=function(_0x40b76f,_0x40d0a2){var _0x5e509a={},_0x3b1ef0={},_0x48e059={'count':0x0,'rows':[]};var _0x220ec5=_[_0xecd4('0x26')](db['FaxQueueReport'][_0xecd4('0x27')],function(_0x46696e){return{'name':_0x46696e[_0xecd4('0x28')],'type':_0x46696e[_0xecd4('0x29')][_0xecd4('0x2a')]};});_0x3b1ef0[_0xecd4('0x2b')]=_['map'](_0x220ec5,_0xecd4('0x24'));_0x3b1ef0[_0xecd4('0x2c')]=_['keys'](_0x40b76f[_0xecd4('0x2c')]);_0x3b1ef0[_0xecd4('0x2d')]=_['intersection'](_0x3b1ef0[_0xecd4('0x2b')],_0x3b1ef0[_0xecd4('0x2c')]);_0x5e509a[_0xecd4('0x2e')]=_[_0xecd4('0x2f')](_0x3b1ef0[_0xecd4('0x2b')],qs[_0xecd4('0x30')](_0x40b76f[_0xecd4('0x2c')][_0xecd4('0x30')]));_0x5e509a[_0xecd4('0x2e')]=_0x5e509a['attributes'][_0xecd4('0x31')]?_0x5e509a[_0xecd4('0x2e')]:_0x3b1ef0[_0xecd4('0x2b')];if(!_0x40b76f['query'][_0xecd4('0x32')](_0xecd4('0x33'))){_0x5e509a['limit']=qs['limit'](_0x40b76f[_0xecd4('0x2c')]['limit']);_0x5e509a['offset']=qs[_0xecd4('0x1b')](_0x40b76f[_0xecd4('0x2c')][_0xecd4('0x1b')]);}_0x5e509a['order']=qs['sort'](_0x40b76f[_0xecd4('0x2c')][_0xecd4('0x34')]);_0x5e509a[_0xecd4('0x35')]=qs[_0xecd4('0x2d')](_[_0xecd4('0x36')](_0x40b76f[_0xecd4('0x2c')],_0x3b1ef0['filters']),_0x220ec5);if(_0x40b76f['query'][_0xecd4('0x37')]){_0x5e509a[_0xecd4('0x35')]=_['merge'](_0x5e509a[_0xecd4('0x35')],{'$or':_[_0xecd4('0x26')](_0x220ec5,function(_0x43c32d){if(_0x43c32d[_0xecd4('0x29')]!=='VIRTUAL'){var _0x4794fa={};_0x4794fa[_0x43c32d[_0xecd4('0x24')]]={'$like':'%'+_0x40b76f[_0xecd4('0x2c')][_0xecd4('0x37')]+'%'};return _0x4794fa;}})});}_0x5e509a=_[_0xecd4('0x38')]({},_0x5e509a,_0x40b76f[_0xecd4('0x39')]);var _0x32c1db={'where':_0x5e509a['where']};return db['FaxQueueReport']['count'](_0x32c1db)[_0xecd4('0x22')](function(_0x4a0009){_0x48e059[_0xecd4('0x1a')]=_0x4a0009;if(_0x40b76f['query'][_0xecd4('0x3a')]){_0x5e509a[_0xecd4('0x3b')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x5e509a);})[_0xecd4('0x22')](function(_0x107dcb){_0x48e059[_0xecd4('0x3c')]=_0x107dcb;return _0x48e059;})['then'](respondWithFilteredResult(_0x40d0a2,_0x5e509a))[_0xecd4('0x3d')](handleError(_0x40d0a2,null));};exports[_0xecd4('0x3e')]=function(_0xbf419,_0x4aaf66){var _0x256612={'raw':!![],'where':{'id':_0xbf419[_0xecd4('0x3f')]['id']}},_0xd732a1={};_0xd732a1[_0xecd4('0x2b')]=_[_0xecd4('0x40')](db[_0xecd4('0x41')]['rawAttributes']);_0xd732a1[_0xecd4('0x2c')]=_[_0xecd4('0x40')](_0xbf419[_0xecd4('0x2c')]);_0xd732a1['filters']=_[_0xecd4('0x2f')](_0xd732a1[_0xecd4('0x2b')],_0xd732a1['query']);_0x256612[_0xecd4('0x2e')]=_['intersection'](_0xd732a1[_0xecd4('0x2b')],qs[_0xecd4('0x30')](_0xbf419[_0xecd4('0x2c')][_0xecd4('0x30')]));_0x256612[_0xecd4('0x2e')]=_0x256612[_0xecd4('0x2e')][_0xecd4('0x31')]?_0x256612[_0xecd4('0x2e')]:_0xd732a1['model'];if(_0xbf419['query'][_0xecd4('0x3a')]){_0x256612[_0xecd4('0x3b')]=[{'all':!![]}];}_0x256612=_[_0xecd4('0x38')]({},_0x256612,_0xbf419[_0xecd4('0x39')]);return db[_0xecd4('0x41')][_0xecd4('0x42')](_0x256612)[_0xecd4('0x22')](handleEntityNotFound(_0x4aaf66,null))[_0xecd4('0x22')](respondWithResult(_0x4aaf66,null))[_0xecd4('0x3d')](handleError(_0x4aaf66,null));};exports[_0xecd4('0x43')]=function(_0x1a29a,_0x234b0a){return db['FaxQueueReport']['create'](_0x1a29a[_0xecd4('0x44')],{})[_0xecd4('0x22')](respondWithResult(_0x234b0a,0xc9))[_0xecd4('0x3d')](handleError(_0x234b0a,null));};exports[_0xecd4('0x20')]=function(_0x161ec3,_0x34d09a){if(_0x161ec3[_0xecd4('0x44')]['id']){delete _0x161ec3[_0xecd4('0x44')]['id'];}return db[_0xecd4('0x41')]['find']({'where':{'id':_0x161ec3['params']['id']}})[_0xecd4('0x22')](handleEntityNotFound(_0x34d09a,null))[_0xecd4('0x22')](saveUpdates(_0x161ec3[_0xecd4('0x44')],null))[_0xecd4('0x22')](respondWithResult(_0x34d09a,null))[_0xecd4('0x3d')](handleError(_0x34d09a,null));};exports['destroy']=function(_0x3f5f8c,_0x247ab5){return db[_0xecd4('0x41')][_0xecd4('0x42')]({'where':{'id':_0x3f5f8c[_0xecd4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x247ab5,null))['then'](removeEntity(_0x247ab5,null))['catch'](handleError(_0x247ab5,null));};exports['describe']=function(_0x2f50bc,_0x5c45c8){return db[_0xecd4('0x41')][_0xecd4('0x45')]()[_0xecd4('0x22')](respondWithResult(_0x5c45c8,null))[_0xecd4('0x3d')](handleError(_0x5c45c8,null));}; \ No newline at end of file +var _0x710e=['type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','keys','length','includeAll','find','body','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x710e,0xb6));var _0xe710=function(_0x2341fc,_0x159c85){_0x2341fc=_0x2341fc-0x0;var _0x18fb53=_0x710e[_0x2341fc];return _0x18fb53;};'use strict';var emlformat=require(_0xe710('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe710('0x1'));var rp=require(_0xe710('0x2'));var moment=require(_0xe710('0x3'));var BPromise=require(_0xe710('0x4'));var Mustache=require(_0xe710('0x5'));var util=require('util');var path=require(_0xe710('0x6'));var sox=require(_0xe710('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe710('0x8'));var _=require(_0xe710('0x9'));var squel=require(_0xe710('0xa'));var crypto=require(_0xe710('0xb'));var jsforce=require(_0xe710('0xc'));var deskjs=require(_0xe710('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe710('0xe'));var authService=require(_0xe710('0xf'));var qs=require(_0xe710('0x10'));var as=require(_0xe710('0x11'));var hardwareService=require(_0xe710('0x12'));var logger=require(_0xe710('0x13'))(_0xe710('0x14'));var utils=require(_0xe710('0x15'));var config=require(_0xe710('0x16'));var licenseUtil=require(_0xe710('0x17'));var db=require(_0xe710('0x18'))['db'];function respondWithStatusCode(_0x25cef4,_0x2061a1){_0x2061a1=_0x2061a1||0xcc;return function(_0x546c5a){if(_0x546c5a){return _0x25cef4['sendStatus'](_0x2061a1);}return _0x25cef4[_0xe710('0x19')](_0x2061a1)[_0xe710('0x1a')]();};}function respondWithResult(_0x1af2ff,_0x183334){_0x183334=_0x183334||0xc8;return function(_0x422a84){if(_0x422a84){return _0x1af2ff[_0xe710('0x19')](_0x183334)['json'](_0x422a84);}};}function respondWithFilteredResult(_0x1a3def,_0xac5508){return function(_0x329590){if(_0x329590){var _0x145312=typeof _0xac5508[_0xe710('0x1b')]===_0xe710('0x1c')&&typeof _0xac5508[_0xe710('0x1d')]===_0xe710('0x1c');var _0x3daac1=_0x329590[_0xe710('0x1e')];var _0x417afd=_0x145312?0x0:_0xac5508[_0xe710('0x1b')];var _0x2b4efb=_0x145312?_0x329590['count']:_0xac5508[_0xe710('0x1b')]+_0xac5508['limit'];var _0x496b3a;if(_0x2b4efb>=_0x3daac1){_0x2b4efb=_0x3daac1;_0x496b3a=0xc8;}else{_0x496b3a=0xce;}_0x1a3def['status'](_0x496b3a);return _0x1a3def['set']('Content-Range',_0x417afd+'-'+_0x2b4efb+'/'+_0x3daac1)[_0xe710('0x1f')](_0x329590);}return null;};}function patchUpdates(_0x1d6a27){return function(_0x1c3d82){try{jsonpatch['apply'](_0x1c3d82,_0x1d6a27,!![]);}catch(_0x33597a){return BPromise['reject'](_0x33597a);}return _0x1c3d82[_0xe710('0x20')]();};}function saveUpdates(_0xf6a255,_0x2568e9){return function(_0x21b6b9){if(_0x21b6b9){return _0x21b6b9[_0xe710('0x21')](_0xf6a255)[_0xe710('0x22')](function(_0x41d924){return _0x41d924;});}return null;};}function removeEntity(_0x4de0fa,_0x54084a){return function(_0x2401ac){if(_0x2401ac){return _0x2401ac[_0xe710('0x23')]()['then'](function(){_0x4de0fa[_0xe710('0x19')](0xcc)[_0xe710('0x1a')]();});}};}function handleEntityNotFound(_0x34ab78,_0x3ce2ec){return function(_0x538063){if(!_0x538063){_0x34ab78[_0xe710('0x24')](0x194);}return _0x538063;};}function handleError(_0x191dbd,_0x3a6f1b){_0x3a6f1b=_0x3a6f1b||0x1f4;return function(_0x3e9998){logger[_0xe710('0x25')](_0x3e9998[_0xe710('0x26')]);if(_0x3e9998[_0xe710('0x27')]){delete _0x3e9998[_0xe710('0x27')];}_0x191dbd[_0xe710('0x19')](_0x3a6f1b)[_0xe710('0x28')](_0x3e9998);};}exports[_0xe710('0x29')]=function(_0x2d808c,_0x5df3fe){var _0x20cf73={},_0x2a620c={},_0xd4864a={'count':0x0,'rows':[]};var _0x469f7b=_[_0xe710('0x2a')](db[_0xe710('0x2b')][_0xe710('0x2c')],function(_0x15360f){return{'name':_0x15360f[_0xe710('0x2d')],'type':_0x15360f[_0xe710('0x2e')][_0xe710('0x2f')]};});_0x2a620c[_0xe710('0x30')]=_[_0xe710('0x2a')](_0x469f7b,'name');_0x2a620c[_0xe710('0x31')]=_['keys'](_0x2d808c['query']);_0x2a620c[_0xe710('0x32')]=_[_0xe710('0x33')](_0x2a620c['model'],_0x2a620c[_0xe710('0x31')]);_0x20cf73[_0xe710('0x34')]=_[_0xe710('0x33')](_0x2a620c[_0xe710('0x30')],qs[_0xe710('0x35')](_0x2d808c[_0xe710('0x31')][_0xe710('0x35')]));_0x20cf73[_0xe710('0x34')]=_0x20cf73['attributes']['length']?_0x20cf73[_0xe710('0x34')]:_0x2a620c[_0xe710('0x30')];if(!_0x2d808c['query'][_0xe710('0x36')](_0xe710('0x37'))){_0x20cf73[_0xe710('0x1d')]=qs[_0xe710('0x1d')](_0x2d808c[_0xe710('0x31')]['limit']);_0x20cf73[_0xe710('0x1b')]=qs[_0xe710('0x1b')](_0x2d808c[_0xe710('0x31')][_0xe710('0x1b')]);}_0x20cf73[_0xe710('0x38')]=qs['sort'](_0x2d808c[_0xe710('0x31')][_0xe710('0x39')]);_0x20cf73[_0xe710('0x3a')]=qs[_0xe710('0x32')](_[_0xe710('0x3b')](_0x2d808c['query'],_0x2a620c[_0xe710('0x32')]),_0x469f7b);if(_0x2d808c[_0xe710('0x31')]['filter']){_0x20cf73[_0xe710('0x3a')]=_[_0xe710('0x3c')](_0x20cf73[_0xe710('0x3a')],{'$or':_[_0xe710('0x2a')](_0x469f7b,function(_0x19932d){if(_0x19932d[_0xe710('0x2e')]!==_0xe710('0x3d')){var _0x424b40={};_0x424b40[_0x19932d[_0xe710('0x27')]]={'$like':'%'+_0x2d808c[_0xe710('0x31')][_0xe710('0x3e')]+'%'};return _0x424b40;}})});}_0x20cf73=_[_0xe710('0x3c')]({},_0x20cf73,_0x2d808c[_0xe710('0x3f')]);var _0x1b4d4b={'where':_0x20cf73[_0xe710('0x3a')]};return db[_0xe710('0x2b')][_0xe710('0x1e')](_0x1b4d4b)[_0xe710('0x22')](function(_0x28d1a6){_0xd4864a[_0xe710('0x1e')]=_0x28d1a6;if(_0x2d808c[_0xe710('0x31')]['includeAll']){_0x20cf73[_0xe710('0x40')]=[{'all':!![]}];}return db[_0xe710('0x2b')][_0xe710('0x41')](_0x20cf73);})[_0xe710('0x22')](function(_0x559c8c){_0xd4864a[_0xe710('0x42')]=_0x559c8c;return _0xd4864a;})[_0xe710('0x22')](respondWithFilteredResult(_0x5df3fe,_0x20cf73))[_0xe710('0x43')](handleError(_0x5df3fe,null));};exports[_0xe710('0x44')]=function(_0x17262b,_0x1455eb){var _0x5dcf48={'raw':!![],'where':{'id':_0x17262b['params']['id']}},_0x3d6f00={};_0x3d6f00[_0xe710('0x30')]=_[_0xe710('0x45')](db['FaxQueueReport'][_0xe710('0x2c')]);_0x3d6f00['query']=_[_0xe710('0x45')](_0x17262b[_0xe710('0x31')]);_0x3d6f00[_0xe710('0x32')]=_[_0xe710('0x33')](_0x3d6f00['model'],_0x3d6f00[_0xe710('0x31')]);_0x5dcf48[_0xe710('0x34')]=_[_0xe710('0x33')](_0x3d6f00[_0xe710('0x30')],qs[_0xe710('0x35')](_0x17262b[_0xe710('0x31')][_0xe710('0x35')]));_0x5dcf48['attributes']=_0x5dcf48[_0xe710('0x34')][_0xe710('0x46')]?_0x5dcf48[_0xe710('0x34')]:_0x3d6f00[_0xe710('0x30')];if(_0x17262b[_0xe710('0x31')][_0xe710('0x47')]){_0x5dcf48[_0xe710('0x40')]=[{'all':!![]}];}_0x5dcf48=_['merge']({},_0x5dcf48,_0x17262b[_0xe710('0x3f')]);return db[_0xe710('0x2b')][_0xe710('0x48')](_0x5dcf48)['then'](handleEntityNotFound(_0x1455eb,null))['then'](respondWithResult(_0x1455eb,null))[_0xe710('0x43')](handleError(_0x1455eb,null));};exports['create']=function(_0x4ad532,_0x31b39c){return db[_0xe710('0x2b')]['create'](_0x4ad532['body'],{})[_0xe710('0x22')](respondWithResult(_0x31b39c,0xc9))[_0xe710('0x43')](handleError(_0x31b39c,null));};exports['update']=function(_0x12310f,_0x6a906b){if(_0x12310f['body']['id']){delete _0x12310f[_0xe710('0x49')]['id'];}return db[_0xe710('0x2b')][_0xe710('0x48')]({'where':{'id':_0x12310f[_0xe710('0x4a')]['id']}})[_0xe710('0x22')](handleEntityNotFound(_0x6a906b,null))[_0xe710('0x22')](saveUpdates(_0x12310f[_0xe710('0x49')],null))[_0xe710('0x22')](respondWithResult(_0x6a906b,null))['catch'](handleError(_0x6a906b,null));};exports['destroy']=function(_0x35376a,_0x2f87f9){return db['FaxQueueReport'][_0xe710('0x48')]({'where':{'id':_0x35376a[_0xe710('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2f87f9,null))['then'](removeEntity(_0x2f87f9,null))[_0xe710('0x43')](handleError(_0x2f87f9,null));};exports[_0xe710('0x4b')]=function(_0x4ab705,_0x115419){return db[_0xe710('0x2b')][_0xe710('0x4b')]()['then'](respondWithResult(_0x115419,null))[_0xe710('0x43')](handleError(_0x115419,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 311ac6c..3acb730 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x26e174,_0x3aa675){var _0xa2d360=function(_0x4f5218){while(--_0x4f5218){_0x26e174['push'](_0x26e174['shift']());}};_0xa2d360(++_0x3aa675);}(_0x7a54,0x106));var _0x47a5=function(_0x7f900d,_0x47023d){_0x7f900d=_0x7f900d-0x0;var _0x222a70=_0x7a54[_0x7f900d];return _0x222a70;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x151f1f,_0xcf72ae){var _0x282397=function(_0x3de6d5){while(--_0x3de6d5){_0x151f1f['push'](_0x151f1f['shift']());}};_0x282397(++_0xcf72ae);}(_0xabce,0x103));var _0xeabc=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xabce[_0x15bc81];return _0x59440e;};'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 diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 6aa1eb8..66ac24e 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 _0xbdcc=['jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','body','options','catch','UpdateFaxQueueReport','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2247af,_0x533f1b){var _0x574a30=function(_0x459b06){while(--_0x459b06){_0x2247af['push'](_0x2247af['shift']());}};_0x574a30(++_0x533f1b);}(_0xbdcc,0xa4));var _0xcbdc=function(_0xc9c847,_0x35a25d){_0xc9c847=_0xc9c847-0x0;var _0x48dcb5=_0xbdcc[_0xc9c847];return _0x48dcb5;};'use strict';var _=require(_0xcbdc('0x0'));var util=require(_0xcbdc('0x1'));var moment=require(_0xcbdc('0x2'));var BPromise=require(_0xcbdc('0x3'));var rs=require(_0xcbdc('0x4'));var fs=require('fs');var Redis=require(_0xcbdc('0x5'));var db=require(_0xcbdc('0x6'))['db'];var utils=require(_0xcbdc('0x7'));var logger=require(_0xcbdc('0x8'))(_0xcbdc('0x9'));var config=require(_0xcbdc('0xa'));var jayson=require(_0xcbdc('0xb'));var client=jayson[_0xcbdc('0xc')][_0xcbdc('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1a3df9,_0x2f0019,_0x59beeb){return new BPromise(function(_0x2edc90,_0x572a19){return client[_0xcbdc('0xe')](_0x1a3df9,_0x59beeb)[_0xcbdc('0xf')](function(_0x3e83be){logger[_0xcbdc('0x10')](_0xcbdc('0x11'),_0x2f0019,_0xcbdc('0x12'));logger[_0xcbdc('0x13')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x2f0019,'request\x20sent',JSON[_0xcbdc('0x14')](_0x3e83be));if(_0x3e83be[_0xcbdc('0x15')]){if(_0x3e83be[_0xcbdc('0x15')][_0xcbdc('0x16')]===0x1f4){logger[_0xcbdc('0x15')]('FaxQueueReport,\x20%s,\x20%s',_0x2f0019,_0x3e83be[_0xcbdc('0x15')][_0xcbdc('0x17')]);return _0x572a19(_0x3e83be[_0xcbdc('0x15')]['message']);}logger[_0xcbdc('0x15')](_0xcbdc('0x11'),_0x2f0019,_0x3e83be[_0xcbdc('0x15')][_0xcbdc('0x17')]);return _0x2edc90(_0x3e83be['error'][_0xcbdc('0x17')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x2f0019,_0xcbdc('0x12'));_0x2edc90(_0x3e83be[_0xcbdc('0x18')][_0xcbdc('0x17')]);}})['catch'](function(_0x250e56){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x2f0019,_0x250e56);_0x572a19(_0x250e56);});});}exports[_0xcbdc('0x19')]=function(_0x1b2d9a){var _0x350526=this;return new Promise(function(_0x11a647,_0x243e25){return db[_0xcbdc('0x1a')]['create'](_0x1b2d9a[_0xcbdc('0x1b')],{'raw':_0x1b2d9a[_0xcbdc('0x1c')]?_0x1b2d9a[_0xcbdc('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xcbdc('0xf')](function(_0x4d01f2){logger['info'](_0xcbdc('0x19'),_0x1b2d9a);logger[_0xcbdc('0x13')](_0xcbdc('0x19'),_0x1b2d9a,JSON[_0xcbdc('0x14')](_0x4d01f2));_0x11a647(_0x4d01f2);})[_0xcbdc('0x1d')](function(_0x5d88fd){logger['error'](_0xcbdc('0x19'),_0x5d88fd[_0xcbdc('0x17')],_0x1b2d9a);_0x243e25(_0x350526[_0xcbdc('0x15')](0x1f4,_0x5d88fd[_0xcbdc('0x17')]));});});};exports[_0xcbdc('0x1e')]=function(_0x4aad55){var _0xa87011=this;return new Promise(function(_0x294c0c,_0x3942c2){return db[_0xcbdc('0x1a')]['update'](_0x4aad55[_0xcbdc('0x1b')],{'raw':_0x4aad55[_0xcbdc('0x1c')]?_0x4aad55[_0xcbdc('0x1c')][_0xcbdc('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4aad55[_0xcbdc('0x1c')]?_0x4aad55[_0xcbdc('0x1c')][_0xcbdc('0x20')]||null:null,'attributes':_0x4aad55[_0xcbdc('0x1c')]?_0x4aad55['options'][_0xcbdc('0x21')]||null:null,'limit':_0x4aad55[_0xcbdc('0x1c')]?_0x4aad55[_0xcbdc('0x1c')][_0xcbdc('0x22')]||null:null})[_0xcbdc('0xf')](function(_0x118205){logger[_0xcbdc('0x10')](_0xcbdc('0x1e'),_0x4aad55);logger[_0xcbdc('0x13')](_0xcbdc('0x1e'),_0x4aad55,JSON[_0xcbdc('0x14')](_0x118205));_0x294c0c(_0x118205);})[_0xcbdc('0x1d')](function(_0x1c5045){logger[_0xcbdc('0x15')](_0xcbdc('0x1e'),_0x1c5045[_0xcbdc('0x17')],_0x4aad55);_0x3942c2(_0xa87011[_0xcbdc('0x15')](0x1f4,_0x1c5045[_0xcbdc('0x17')]));});});}; \ No newline at end of file +var _0x91a6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxQueueReport','create','body','options','raw','then','CreateFaxQueueReport','UpdateFaxQueueReport','update','where','attributes','limit','lodash','moment'];(function(_0x2d7211,_0x2bf55d){var _0x5d896e=function(_0x393ea3){while(--_0x393ea3){_0x2d7211['push'](_0x2d7211['shift']());}};_0x5d896e(++_0x2bf55d);}(_0x91a6,0x101));var _0x691a=function(_0x3ebf3b,_0x159569){_0x3ebf3b=_0x3ebf3b-0x0;var _0x41e101=_0x91a6[_0x3ebf3b];return _0x41e101;};'use strict';var _=require(_0x691a('0x0'));var util=require('util');var moment=require(_0x691a('0x1'));var BPromise=require(_0x691a('0x2'));var rs=require(_0x691a('0x3'));var fs=require('fs');var Redis=require(_0x691a('0x4'));var db=require(_0x691a('0x5'))['db'];var utils=require(_0x691a('0x6'));var logger=require(_0x691a('0x7'))(_0x691a('0x8'));var config=require(_0x691a('0x9'));var jayson=require(_0x691a('0xa'));var client=jayson[_0x691a('0xb')][_0x691a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49a4b6,_0x580ee6,_0x845f9a){return new BPromise(function(_0x163ec9,_0x39f571){return client[_0x691a('0xd')](_0x49a4b6,_0x845f9a)['then'](function(_0x3c02a4){logger[_0x691a('0xe')](_0x691a('0xf'),_0x580ee6,_0x691a('0x10'));logger[_0x691a('0x11')](_0x691a('0x12'),_0x580ee6,_0x691a('0x10'),JSON[_0x691a('0x13')](_0x3c02a4));if(_0x3c02a4[_0x691a('0x14')]){if(_0x3c02a4[_0x691a('0x14')][_0x691a('0x15')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x580ee6,_0x3c02a4[_0x691a('0x14')][_0x691a('0x16')]);return _0x39f571(_0x3c02a4[_0x691a('0x14')][_0x691a('0x16')]);}logger[_0x691a('0x14')](_0x691a('0xf'),_0x580ee6,_0x3c02a4[_0x691a('0x14')][_0x691a('0x16')]);return _0x163ec9(_0x3c02a4['error']['message']);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x580ee6,'request\x20sent');_0x163ec9(_0x3c02a4[_0x691a('0x17')][_0x691a('0x16')]);}})[_0x691a('0x18')](function(_0x4fc206){logger['error'](_0x691a('0xf'),_0x580ee6,_0x4fc206);_0x39f571(_0x4fc206);});});}exports['CreateFaxQueueReport']=function(_0x34d5d1){var _0x4c3850=this;return new Promise(function(_0x3d9b41,_0x297ffc){return db[_0x691a('0x19')][_0x691a('0x1a')](_0x34d5d1[_0x691a('0x1b')],{'raw':_0x34d5d1[_0x691a('0x1c')]?_0x34d5d1[_0x691a('0x1c')][_0x691a('0x1d')]===undefined?!![]:![]:!![]})[_0x691a('0x1e')](function(_0x171c8a){logger[_0x691a('0xe')](_0x691a('0x1f'),_0x34d5d1);logger['debug'](_0x691a('0x1f'),_0x34d5d1,JSON[_0x691a('0x13')](_0x171c8a));_0x3d9b41(_0x171c8a);})[_0x691a('0x18')](function(_0x2020f7){logger['error'](_0x691a('0x1f'),_0x2020f7['message'],_0x34d5d1);_0x297ffc(_0x4c3850[_0x691a('0x14')](0x1f4,_0x2020f7[_0x691a('0x16')]));});});};exports[_0x691a('0x20')]=function(_0x36c132){var _0x11bebc=this;return new Promise(function(_0x2bf6d1,_0x3317c6){return db[_0x691a('0x19')][_0x691a('0x21')](_0x36c132[_0x691a('0x1b')],{'raw':_0x36c132[_0x691a('0x1c')]?_0x36c132[_0x691a('0x1c')][_0x691a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36c132[_0x691a('0x1c')]?_0x36c132[_0x691a('0x1c')][_0x691a('0x22')]||null:null,'attributes':_0x36c132[_0x691a('0x1c')]?_0x36c132[_0x691a('0x1c')][_0x691a('0x23')]||null:null,'limit':_0x36c132['options']?_0x36c132[_0x691a('0x1c')][_0x691a('0x24')]||null:null})[_0x691a('0x1e')](function(_0x2d6084){logger[_0x691a('0xe')](_0x691a('0x20'),_0x36c132);logger[_0x691a('0x11')](_0x691a('0x20'),_0x36c132,JSON[_0x691a('0x13')](_0x2d6084));_0x2bf6d1(_0x2d6084);})[_0x691a('0x18')](function(_0x4ed8c6){logger['error'](_0x691a('0x20'),_0x4ed8c6[_0x691a('0x16')],_0x36c132);_0x3317c6(_0x11bebc[_0x691a('0x14')](0x1f4,_0x4ed8c6['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index b053e65..f68af14 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 _0xfaa3=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','/:id','delete'];(function(_0x23c33e,_0x5afc20){var _0x59120f=function(_0x41b269){while(--_0x41b269){_0x23c33e['push'](_0x23c33e['shift']());}};_0x59120f(++_0x5afc20);}(_0xfaa3,0x66));var _0x3faa=function(_0x21fd86,_0x15ad59){_0x21fd86=_0x21fd86-0x0;var _0x3daed5=_0xfaa3[_0x21fd86];return _0x3daed5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3faa('0x0'));var timeout=require(_0x3faa('0x1'));var express=require(_0x3faa('0x2'));var router=express[_0x3faa('0x3')]();var fs_extra=require(_0x3faa('0x4'));var auth=require(_0x3faa('0x5'));var interaction=require(_0x3faa('0x6'));var config=require(_0x3faa('0x7'));var controller=require(_0x3faa('0x8'));router[_0x3faa('0x9')]('/',auth[_0x3faa('0xa')](),controller[_0x3faa('0xb')]);router[_0x3faa('0x9')](_0x3faa('0xc'),auth['isAuthenticated'](),controller[_0x3faa('0xd')]);router[_0x3faa('0x9')]('/:id',auth[_0x3faa('0xa')](),controller[_0x3faa('0xe')]);router[_0x3faa('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3faa('0x10'),auth[_0x3faa('0xa')](),controller['update']);router[_0x3faa('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3faa('0x12')]);module[_0x3faa('0x13')]=router; \ No newline at end of file +var _0x5d2a=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x5d2a,0x1e3));var _0xa5d2=function(_0x2f60be,_0x33f613){_0x2f60be=_0x2f60be-0x0;var _0x189231=_0x5d2a[_0x2f60be];return _0x189231;};'use strict';var multer=require(_0xa5d2('0x0'));var util=require(_0xa5d2('0x1'));var path=require(_0xa5d2('0x2'));var timeout=require(_0xa5d2('0x3'));var express=require(_0xa5d2('0x4'));var router=express[_0xa5d2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa5d2('0x6'));var interaction=require(_0xa5d2('0x7'));var config=require(_0xa5d2('0x8'));var controller=require(_0xa5d2('0x9'));router[_0xa5d2('0xa')]('/',auth[_0xa5d2('0xb')](),controller[_0xa5d2('0xc')]);router[_0xa5d2('0xa')](_0xa5d2('0xd'),auth[_0xa5d2('0xb')](),controller['describe']);router['get'](_0xa5d2('0xe'),auth[_0xa5d2('0xb')](),controller[_0xa5d2('0xf')]);router[_0xa5d2('0x10')]('/',auth[_0xa5d2('0xb')](),controller[_0xa5d2('0x11')]);router['put'](_0xa5d2('0xe'),auth[_0xa5d2('0xb')](),controller[_0xa5d2('0x12')]);router[_0xa5d2('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xa5d2('0x14')]);module[_0xa5d2('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 5837ab0..6dc7b2d 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x5030c4,_0x129ef7){var _0x4dd659=function(_0x2228c0){while(--_0x2228c0){_0x5030c4['push'](_0x5030c4['shift']());}};_0x4dd659(++_0x129ef7);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2c01e9,_0x352585){_0x2c01e9=_0x2c01e9-0x0;var _0x224176=_0xf4eb[_0x2c01e9];return _0x224176;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x27abcf,_0x133351){var _0x1701b7=function(_0x69ded5){while(--_0x69ded5){_0x27abcf['push'](_0x27abcf['shift']());}};_0x1701b7(++_0x133351);}(_0xaa88,0x137));var _0x8aa8=function(_0x8b631b,_0x386724){_0x8b631b=_0x8b631b-0x0;var _0x3e6832=_0xaa88[_0x8b631b];return _0x3e6832;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index f384955..b9944de 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 _0x24ba=['index','map','FaxTransferReport','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x24ba,0x153));var _0xa24b=function(_0x3f610f,_0x37b88d){_0x3f610f=_0x3f610f-0x0;var _0xe60ea3=_0x24ba[_0x3f610f];return _0xe60ea3;};'use strict';var emlformat=require(_0xa24b('0x0'));var rimraf=require(_0xa24b('0x1'));var zipdir=require(_0xa24b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa24b('0x3'));var moment=require(_0xa24b('0x4'));var BPromise=require(_0xa24b('0x5'));var Mustache=require(_0xa24b('0x6'));var util=require(_0xa24b('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa24b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa24b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa24b('0xa'));var deskjs=require(_0xa24b('0xb'));var toCsv=require(_0xa24b('0xc'));var querystring=require('querystring');var Papa=require(_0xa24b('0xd'));var Redis=require(_0xa24b('0xe'));var authService=require(_0xa24b('0xf'));var qs=require(_0xa24b('0x10'));var as=require(_0xa24b('0x11'));var hardwareService=require(_0xa24b('0x12'));var logger=require('../../config/logger')(_0xa24b('0x13'));var utils=require('../../config/utils');var config=require(_0xa24b('0x14'));var licenseUtil=require(_0xa24b('0x15'));var db=require(_0xa24b('0x16'))['db'];function respondWithStatusCode(_0x21154b,_0xc5221d){_0xc5221d=_0xc5221d||0xcc;return function(_0x217b97){if(_0x217b97){return _0x21154b[_0xa24b('0x17')](_0xc5221d);}return _0x21154b[_0xa24b('0x18')](_0xc5221d)[_0xa24b('0x19')]();};}function respondWithResult(_0x631809,_0x4108b5){_0x4108b5=_0x4108b5||0xc8;return function(_0x341edc){if(_0x341edc){return _0x631809[_0xa24b('0x18')](_0x4108b5)[_0xa24b('0x1a')](_0x341edc);}};}function respondWithFilteredResult(_0x33ce80,_0x38fdef){return function(_0x51ede5){if(_0x51ede5){var _0x570ed9=typeof _0x38fdef[_0xa24b('0x1b')]==='undefined'&&typeof _0x38fdef['limit']==='undefined';var _0x19f615=_0x51ede5[_0xa24b('0x1c')];var _0x162fb0=_0x570ed9?0x0:_0x38fdef[_0xa24b('0x1b')];var _0x3ee709=_0x570ed9?_0x51ede5[_0xa24b('0x1c')]:_0x38fdef[_0xa24b('0x1b')]+_0x38fdef[_0xa24b('0x1d')];var _0x4525a5;if(_0x3ee709>=_0x19f615){_0x3ee709=_0x19f615;_0x4525a5=0xc8;}else{_0x4525a5=0xce;}_0x33ce80[_0xa24b('0x18')](_0x4525a5);return _0x33ce80[_0xa24b('0x1e')](_0xa24b('0x1f'),_0x162fb0+'-'+_0x3ee709+'/'+_0x19f615)['json'](_0x51ede5);}return null;};}function patchUpdates(_0x3d9f2d){return function(_0x33930d){try{jsonpatch[_0xa24b('0x20')](_0x33930d,_0x3d9f2d,!![]);}catch(_0x17c2a8){return BPromise[_0xa24b('0x21')](_0x17c2a8);}return _0x33930d['save']();};}function saveUpdates(_0x106537,_0x318abc){return function(_0x47528e){if(_0x47528e){return _0x47528e[_0xa24b('0x22')](_0x106537)[_0xa24b('0x23')](function(_0x429aa3){return _0x429aa3;});}return null;};}function removeEntity(_0x4ecaa4,_0x2eebac){return function(_0x49f97d){if(_0x49f97d){return _0x49f97d[_0xa24b('0x24')]()[_0xa24b('0x23')](function(){_0x4ecaa4[_0xa24b('0x18')](0xcc)[_0xa24b('0x19')]();});}};}function handleEntityNotFound(_0x4ef551,_0x41a419){return function(_0x55ce24){if(!_0x55ce24){_0x4ef551[_0xa24b('0x17')](0x194);}return _0x55ce24;};}function handleError(_0x2ebbfd,_0x5e9324){_0x5e9324=_0x5e9324||0x1f4;return function(_0x2ec730){logger[_0xa24b('0x25')](_0x2ec730[_0xa24b('0x26')]);if(_0x2ec730[_0xa24b('0x27')]){delete _0x2ec730[_0xa24b('0x27')];}_0x2ebbfd[_0xa24b('0x18')](_0x5e9324)[_0xa24b('0x28')](_0x2ec730);};}exports[_0xa24b('0x29')]=function(_0xa5717d,_0x2cb023){var _0x297c4c={},_0x12d2d1={},_0x1e7a07={'count':0x0,'rows':[]};var _0x622283=_[_0xa24b('0x2a')](db[_0xa24b('0x2b')][_0xa24b('0x2c')],function(_0x100835){return{'name':_0x100835[_0xa24b('0x2d')],'type':_0x100835['type'][_0xa24b('0x2e')]};});_0x12d2d1[_0xa24b('0x2f')]=_['map'](_0x622283,_0xa24b('0x27'));_0x12d2d1[_0xa24b('0x30')]=_['keys'](_0xa5717d[_0xa24b('0x30')]);_0x12d2d1[_0xa24b('0x31')]=_['intersection'](_0x12d2d1[_0xa24b('0x2f')],_0x12d2d1[_0xa24b('0x30')]);_0x297c4c[_0xa24b('0x32')]=_[_0xa24b('0x33')](_0x12d2d1[_0xa24b('0x2f')],qs['fields'](_0xa5717d[_0xa24b('0x30')]['fields']));_0x297c4c[_0xa24b('0x32')]=_0x297c4c[_0xa24b('0x32')][_0xa24b('0x34')]?_0x297c4c[_0xa24b('0x32')]:_0x12d2d1[_0xa24b('0x2f')];if(!_0xa5717d[_0xa24b('0x30')][_0xa24b('0x35')](_0xa24b('0x36'))){_0x297c4c[_0xa24b('0x1d')]=qs[_0xa24b('0x1d')](_0xa5717d['query'][_0xa24b('0x1d')]);_0x297c4c[_0xa24b('0x1b')]=qs[_0xa24b('0x1b')](_0xa5717d[_0xa24b('0x30')][_0xa24b('0x1b')]);}_0x297c4c[_0xa24b('0x37')]=qs[_0xa24b('0x38')](_0xa5717d[_0xa24b('0x30')][_0xa24b('0x38')]);_0x297c4c[_0xa24b('0x39')]=qs['filters'](_[_0xa24b('0x3a')](_0xa5717d[_0xa24b('0x30')],_0x12d2d1[_0xa24b('0x31')]),_0x622283);if(_0xa5717d[_0xa24b('0x30')][_0xa24b('0x3b')]){_0x297c4c[_0xa24b('0x39')]=_[_0xa24b('0x3c')](_0x297c4c['where'],{'$or':_[_0xa24b('0x2a')](_0x622283,function(_0x4cba54){if(_0x4cba54[_0xa24b('0x3d')]!==_0xa24b('0x3e')){var _0x492ceb={};_0x492ceb[_0x4cba54[_0xa24b('0x27')]]={'$like':'%'+_0xa5717d[_0xa24b('0x30')][_0xa24b('0x3b')]+'%'};return _0x492ceb;}})});}_0x297c4c=_[_0xa24b('0x3c')]({},_0x297c4c,_0xa5717d[_0xa24b('0x3f')]);var _0x13f697={'where':_0x297c4c[_0xa24b('0x39')]};return db[_0xa24b('0x2b')]['count'](_0x13f697)[_0xa24b('0x23')](function(_0x2bd66f){_0x1e7a07[_0xa24b('0x1c')]=_0x2bd66f;if(_0xa5717d[_0xa24b('0x30')][_0xa24b('0x40')]){_0x297c4c[_0xa24b('0x41')]=[{'all':!![]}];}return db[_0xa24b('0x2b')][_0xa24b('0x42')](_0x297c4c);})[_0xa24b('0x23')](function(_0x505749){_0x1e7a07[_0xa24b('0x43')]=_0x505749;return _0x1e7a07;})['then'](respondWithFilteredResult(_0x2cb023,_0x297c4c))[_0xa24b('0x44')](handleError(_0x2cb023,null));};exports[_0xa24b('0x45')]=function(_0x5dd921,_0x1133a8){var _0x31680d={'raw':!![],'where':{'id':_0x5dd921[_0xa24b('0x46')]['id']}},_0x2cae2d={};_0x2cae2d['model']=_[_0xa24b('0x47')](db['FaxTransferReport']['rawAttributes']);_0x2cae2d['query']=_['keys'](_0x5dd921['query']);_0x2cae2d['filters']=_[_0xa24b('0x33')](_0x2cae2d[_0xa24b('0x2f')],_0x2cae2d[_0xa24b('0x30')]);_0x31680d[_0xa24b('0x32')]=_[_0xa24b('0x33')](_0x2cae2d[_0xa24b('0x2f')],qs['fields'](_0x5dd921[_0xa24b('0x30')]['fields']));_0x31680d['attributes']=_0x31680d[_0xa24b('0x32')][_0xa24b('0x34')]?_0x31680d['attributes']:_0x2cae2d[_0xa24b('0x2f')];if(_0x5dd921['query']['includeAll']){_0x31680d['include']=[{'all':!![]}];}_0x31680d=_[_0xa24b('0x3c')]({},_0x31680d,_0x5dd921['options']);return db[_0xa24b('0x2b')][_0xa24b('0x48')](_0x31680d)['then'](handleEntityNotFound(_0x1133a8,null))[_0xa24b('0x23')](respondWithResult(_0x1133a8,null))['catch'](handleError(_0x1133a8,null));};exports[_0xa24b('0x49')]=function(_0x2f1a9d,_0x20517b){return db[_0xa24b('0x2b')][_0xa24b('0x49')](_0x2f1a9d[_0xa24b('0x4a')],{})[_0xa24b('0x23')](respondWithResult(_0x20517b,0xc9))['catch'](handleError(_0x20517b,null));};exports[_0xa24b('0x22')]=function(_0x75ec54,_0x4b9546){if(_0x75ec54['body']['id']){delete _0x75ec54['body']['id'];}return db[_0xa24b('0x2b')]['find']({'where':{'id':_0x75ec54['params']['id']}})[_0xa24b('0x23')](handleEntityNotFound(_0x4b9546,null))['then'](saveUpdates(_0x75ec54[_0xa24b('0x4a')],null))[_0xa24b('0x23')](respondWithResult(_0x4b9546,null))[_0xa24b('0x44')](handleError(_0x4b9546,null));};exports[_0xa24b('0x24')]=function(_0x1e7041,_0x34834b){return db[_0xa24b('0x2b')][_0xa24b('0x48')]({'where':{'id':_0x1e7041['params']['id']}})[_0xa24b('0x23')](handleEntityNotFound(_0x34834b,null))['then'](removeEntity(_0x34834b,null))[_0xa24b('0x44')](handleError(_0x34834b,null));};exports[_0xa24b('0x4b')]=function(_0x2f4af8,_0x479625){return db[_0xa24b('0x2b')][_0xa24b('0x4b')]()[_0xa24b('0x23')](respondWithResult(_0x479625,null))[_0xa24b('0x44')](handleError(_0x479625,null));}; \ No newline at end of file +var _0xd29a=['ejs','fs-extra','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','status','end','stack','name','send','index','map','FaxTransferReport','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x3244c0,_0x3d8bf5){var _0x3fe89c=function(_0x4748b5){while(--_0x4748b5){_0x3244c0['push'](_0x3244c0['shift']());}};_0x3fe89c(++_0x3d8bf5);}(_0xd29a,0x86));var _0xad29=function(_0x4e45fa,_0x421030){_0x4e45fa=_0x4e45fa-0x0;var _0x3f1b45=_0xd29a[_0x4e45fa];return _0x3f1b45;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xad29('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad29('0x1'));var moment=require(_0xad29('0x2'));var BPromise=require(_0xad29('0x3'));var Mustache=require(_0xad29('0x4'));var util=require(_0xad29('0x5'));var path=require('path');var sox=require(_0xad29('0x6'));var csv=require(_0xad29('0x7'));var ejs=require(_0xad29('0x8'));var fs=require('fs');var fs_extra=require(_0xad29('0x9'));var _=require(_0xad29('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xad29('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xad29('0x7'));var querystring=require('querystring');var Papa=require(_0xad29('0xc'));var Redis=require('ioredis');var authService=require(_0xad29('0xd'));var qs=require(_0xad29('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad29('0xf'));var logger=require('../../config/logger')(_0xad29('0x10'));var utils=require(_0xad29('0x11'));var config=require(_0xad29('0x12'));var licenseUtil=require(_0xad29('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57186b,_0x149d32){_0x149d32=_0x149d32||0xcc;return function(_0x209622){if(_0x209622){return _0x57186b[_0xad29('0x14')](_0x149d32);}return _0x57186b['status'](_0x149d32)['end']();};}function respondWithResult(_0x9ecfab,_0x33ecd6){_0x33ecd6=_0x33ecd6||0xc8;return function(_0x15316a){if(_0x15316a){return _0x9ecfab['status'](_0x33ecd6)[_0xad29('0x15')](_0x15316a);}};}function respondWithFilteredResult(_0x7e24d1,_0x8decfc){return function(_0x34fcba){if(_0x34fcba){var _0x4c2f68=typeof _0x8decfc[_0xad29('0x16')]==='undefined'&&typeof _0x8decfc[_0xad29('0x17')]===_0xad29('0x18');var _0x4c38b0=_0x34fcba[_0xad29('0x19')];var _0x27fe77=_0x4c2f68?0x0:_0x8decfc[_0xad29('0x16')];var _0x4d543b=_0x4c2f68?_0x34fcba[_0xad29('0x19')]:_0x8decfc[_0xad29('0x16')]+_0x8decfc[_0xad29('0x17')];var _0x28d380;if(_0x4d543b>=_0x4c38b0){_0x4d543b=_0x4c38b0;_0x28d380=0xc8;}else{_0x28d380=0xce;}_0x7e24d1['status'](_0x28d380);return _0x7e24d1[_0xad29('0x1a')]('Content-Range',_0x27fe77+'-'+_0x4d543b+'/'+_0x4c38b0)[_0xad29('0x15')](_0x34fcba);}return null;};}function patchUpdates(_0x34d386){return function(_0x53afeb){try{jsonpatch['apply'](_0x53afeb,_0x34d386,!![]);}catch(_0x29ecc6){return BPromise[_0xad29('0x1b')](_0x29ecc6);}return _0x53afeb[_0xad29('0x1c')]();};}function saveUpdates(_0xc65434,_0x2835d){return function(_0x1e36cb){if(_0x1e36cb){return _0x1e36cb[_0xad29('0x1d')](_0xc65434)[_0xad29('0x1e')](function(_0x4fd85d){return _0x4fd85d;});}return null;};}function removeEntity(_0x48392f,_0x43d90b){return function(_0x386a43){if(_0x386a43){return _0x386a43[_0xad29('0x1f')]()[_0xad29('0x1e')](function(){_0x48392f[_0xad29('0x20')](0xcc)[_0xad29('0x21')]();});}};}function handleEntityNotFound(_0x2e95e2,_0x19e4b2){return function(_0x174e7e){if(!_0x174e7e){_0x2e95e2['sendStatus'](0x194);}return _0x174e7e;};}function handleError(_0x22c157,_0x557134){_0x557134=_0x557134||0x1f4;return function(_0x3a4a83){logger['error'](_0x3a4a83[_0xad29('0x22')]);if(_0x3a4a83[_0xad29('0x23')]){delete _0x3a4a83['name'];}_0x22c157[_0xad29('0x20')](_0x557134)[_0xad29('0x24')](_0x3a4a83);};}exports[_0xad29('0x25')]=function(_0x178688,_0x5c21ba){var _0x2b5d2a={},_0x3b23ee={},_0x435f8e={'count':0x0,'rows':[]};var _0x103c78=_[_0xad29('0x26')](db[_0xad29('0x27')]['rawAttributes'],function(_0x47b5eb){return{'name':_0x47b5eb[_0xad29('0x28')],'type':_0x47b5eb[_0xad29('0x29')][_0xad29('0x2a')]};});_0x3b23ee['model']=_[_0xad29('0x26')](_0x103c78,'name');_0x3b23ee[_0xad29('0x2b')]=_['keys'](_0x178688[_0xad29('0x2b')]);_0x3b23ee[_0xad29('0x2c')]=_[_0xad29('0x2d')](_0x3b23ee['model'],_0x3b23ee[_0xad29('0x2b')]);_0x2b5d2a[_0xad29('0x2e')]=_[_0xad29('0x2d')](_0x3b23ee[_0xad29('0x2f')],qs['fields'](_0x178688[_0xad29('0x2b')][_0xad29('0x30')]));_0x2b5d2a[_0xad29('0x2e')]=_0x2b5d2a[_0xad29('0x2e')][_0xad29('0x31')]?_0x2b5d2a[_0xad29('0x2e')]:_0x3b23ee[_0xad29('0x2f')];if(!_0x178688[_0xad29('0x2b')]['hasOwnProperty'](_0xad29('0x32'))){_0x2b5d2a['limit']=qs[_0xad29('0x17')](_0x178688[_0xad29('0x2b')][_0xad29('0x17')]);_0x2b5d2a[_0xad29('0x16')]=qs[_0xad29('0x16')](_0x178688[_0xad29('0x2b')][_0xad29('0x16')]);}_0x2b5d2a[_0xad29('0x33')]=qs['sort'](_0x178688[_0xad29('0x2b')][_0xad29('0x34')]);_0x2b5d2a['where']=qs[_0xad29('0x2c')](_[_0xad29('0x35')](_0x178688[_0xad29('0x2b')],_0x3b23ee[_0xad29('0x2c')]),_0x103c78);if(_0x178688['query'][_0xad29('0x36')]){_0x2b5d2a[_0xad29('0x37')]=_['merge'](_0x2b5d2a[_0xad29('0x37')],{'$or':_['map'](_0x103c78,function(_0x34f932){if(_0x34f932['type']!=='VIRTUAL'){var _0x598190={};_0x598190[_0x34f932[_0xad29('0x23')]]={'$like':'%'+_0x178688[_0xad29('0x2b')][_0xad29('0x36')]+'%'};return _0x598190;}})});}_0x2b5d2a=_[_0xad29('0x38')]({},_0x2b5d2a,_0x178688[_0xad29('0x39')]);var _0x4d6fdf={'where':_0x2b5d2a[_0xad29('0x37')]};return db[_0xad29('0x27')][_0xad29('0x19')](_0x4d6fdf)[_0xad29('0x1e')](function(_0x2ced3a){_0x435f8e['count']=_0x2ced3a;if(_0x178688[_0xad29('0x2b')][_0xad29('0x3a')]){_0x2b5d2a[_0xad29('0x3b')]=[{'all':!![]}];}return db[_0xad29('0x27')][_0xad29('0x3c')](_0x2b5d2a);})['then'](function(_0x129015){_0x435f8e[_0xad29('0x3d')]=_0x129015;return _0x435f8e;})[_0xad29('0x1e')](respondWithFilteredResult(_0x5c21ba,_0x2b5d2a))[_0xad29('0x3e')](handleError(_0x5c21ba,null));};exports[_0xad29('0x3f')]=function(_0x539620,_0x5ec3ab){var _0x49ec1f={'raw':!![],'where':{'id':_0x539620[_0xad29('0x40')]['id']}},_0x15dc70={};_0x15dc70['model']=_[_0xad29('0x41')](db[_0xad29('0x27')][_0xad29('0x42')]);_0x15dc70['query']=_[_0xad29('0x41')](_0x539620[_0xad29('0x2b')]);_0x15dc70[_0xad29('0x2c')]=_[_0xad29('0x2d')](_0x15dc70['model'],_0x15dc70[_0xad29('0x2b')]);_0x49ec1f[_0xad29('0x2e')]=_[_0xad29('0x2d')](_0x15dc70['model'],qs[_0xad29('0x30')](_0x539620[_0xad29('0x2b')][_0xad29('0x30')]));_0x49ec1f[_0xad29('0x2e')]=_0x49ec1f[_0xad29('0x2e')][_0xad29('0x31')]?_0x49ec1f[_0xad29('0x2e')]:_0x15dc70[_0xad29('0x2f')];if(_0x539620[_0xad29('0x2b')][_0xad29('0x3a')]){_0x49ec1f['include']=[{'all':!![]}];}_0x49ec1f=_[_0xad29('0x38')]({},_0x49ec1f,_0x539620['options']);return db[_0xad29('0x27')][_0xad29('0x43')](_0x49ec1f)['then'](handleEntityNotFound(_0x5ec3ab,null))[_0xad29('0x1e')](respondWithResult(_0x5ec3ab,null))[_0xad29('0x3e')](handleError(_0x5ec3ab,null));};exports[_0xad29('0x44')]=function(_0x55589d,_0x4c9275){return db[_0xad29('0x27')]['create'](_0x55589d['body'],{})[_0xad29('0x1e')](respondWithResult(_0x4c9275,0xc9))['catch'](handleError(_0x4c9275,null));};exports['update']=function(_0x350040,_0x28b1f2){if(_0x350040[_0xad29('0x45')]['id']){delete _0x350040[_0xad29('0x45')]['id'];}return db['FaxTransferReport'][_0xad29('0x43')]({'where':{'id':_0x350040[_0xad29('0x40')]['id']}})[_0xad29('0x1e')](handleEntityNotFound(_0x28b1f2,null))['then'](saveUpdates(_0x350040[_0xad29('0x45')],null))['then'](respondWithResult(_0x28b1f2,null))[_0xad29('0x3e')](handleError(_0x28b1f2,null));};exports[_0xad29('0x1f')]=function(_0x478b06,_0x39c465){return db[_0xad29('0x27')][_0xad29('0x43')]({'where':{'id':_0x478b06['params']['id']}})['then'](handleEntityNotFound(_0x39c465,null))['then'](removeEntity(_0x39c465,null))[_0xad29('0x3e')](handleError(_0x39c465,null));};exports[_0xad29('0x46')]=function(_0x20a2b4,_0x379606){return db[_0xad29('0x27')][_0xad29('0x46')]()['then'](respondWithResult(_0x379606,null))[_0xad29('0x3e')](handleError(_0x379606,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 82c8fda..c6cdcf0 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 _0xfbe6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfbe6,0x6d));var _0x6fbe=function(_0x3441e2,_0x57b820){_0x3441e2=_0x3441e2-0x0;var _0x1a129b=_0xfbe6[_0x3441e2];return _0x1a129b;};'use strict';var _=require(_0x6fbe('0x0'));var util=require(_0x6fbe('0x1'));var logger=require(_0x6fbe('0x2'))('api');var moment=require(_0x6fbe('0x3'));var BPromise=require(_0x6fbe('0x4'));var rp=require(_0x6fbe('0x5'));var fs=require('fs');var path=require(_0x6fbe('0x6'));var rimraf=require(_0x6fbe('0x7'));var config=require(_0x6fbe('0x8'));var attributes=require(_0x6fbe('0x9'));module[_0x6fbe('0xa')]=function(_0x46b337,_0x120352){return _0x46b337['define'](_0x6fbe('0xb'),attributes,{'tableName':_0x6fbe('0xc'),'paranoid':![],'indexes':[{'name':_0x6fbe('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf226=['api','moment','bluebird','request-promise','path','rimraf','exports','report_fax_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf226,0x141));var _0x6f22=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf226[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6f22('0x0'));var util=require(_0x6f22('0x1'));var logger=require(_0x6f22('0x2'))(_0x6f22('0x3'));var moment=require(_0x6f22('0x4'));var BPromise=require(_0x6f22('0x5'));var rp=require(_0x6f22('0x6'));var fs=require('fs');var path=require(_0x6f22('0x7'));var rimraf=require(_0x6f22('0x8'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0x6f22('0x9')]=function(_0x460d11,_0x51625d){return _0x460d11['define']('FaxTransferReport',attributes,{'tableName':_0x6f22('0xa'),'paranoid':![],'indexes':[{'name':_0x6f22('0xb'),'fields':[_0x6f22('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 35afeb0..79b9246 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 _0xf592=['request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','then','FaxTransferReport,\x20%s,\x20%s'];(function(_0x3f11f6,_0x2fd669){var _0x4f37d2=function(_0x4ab6dd){while(--_0x4ab6dd){_0x3f11f6['push'](_0x3f11f6['shift']());}};_0x4f37d2(++_0x2fd669);}(_0xf592,0xab));var _0x2f59=function(_0x1e1a63,_0x59ccb0){_0x1e1a63=_0x1e1a63-0x0;var _0x12f388=_0xf592[_0x1e1a63];return _0x12f388;};'use strict';var _=require(_0x2f59('0x0'));var util=require('util');var moment=require(_0x2f59('0x1'));var BPromise=require(_0x2f59('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f59('0x3'));var db=require(_0x2f59('0x4'))['db'];var utils=require(_0x2f59('0x5'));var logger=require(_0x2f59('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x57273e,_0x1f5cee,_0x3b0162){return new BPromise(function(_0x440265,_0x2b7956){return client['request'](_0x57273e,_0x3b0162)[_0x2f59('0x7')](function(_0x1e9bf8){logger['info'](_0x2f59('0x8'),_0x1f5cee,_0x2f59('0x9'));logger[_0x2f59('0xa')](_0x2f59('0xb'),_0x1f5cee,_0x2f59('0x9'),JSON[_0x2f59('0xc')](_0x1e9bf8));if(_0x1e9bf8[_0x2f59('0xd')]){if(_0x1e9bf8[_0x2f59('0xd')]['code']===0x1f4){logger['error'](_0x2f59('0x8'),_0x1f5cee,_0x1e9bf8[_0x2f59('0xd')][_0x2f59('0xe')]);return _0x2b7956(_0x1e9bf8[_0x2f59('0xd')]['message']);}logger[_0x2f59('0xd')](_0x2f59('0x8'),_0x1f5cee,_0x1e9bf8['error']['message']);return _0x440265(_0x1e9bf8[_0x2f59('0xd')][_0x2f59('0xe')]);}else{logger[_0x2f59('0xf')](_0x2f59('0x8'),_0x1f5cee,_0x2f59('0x9'));_0x440265(_0x1e9bf8[_0x2f59('0x10')]['message']);}})[_0x2f59('0x11')](function(_0x159438){logger[_0x2f59('0xd')](_0x2f59('0x8'),_0x1f5cee,_0x159438);_0x2b7956(_0x159438);});});} \ No newline at end of file +var _0xaee6=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xaee6,0xfc));var _0x6aee=function(_0x39fc60,_0x262cd0){_0x39fc60=_0x39fc60-0x0;var _0x2ee7bf=_0xaee6[_0x39fc60];return _0x2ee7bf;};'use strict';var _=require(_0x6aee('0x0'));var util=require(_0x6aee('0x1'));var moment=require('moment');var BPromise=require(_0x6aee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6aee('0x3'));var db=require(_0x6aee('0x4'))['db'];var utils=require(_0x6aee('0x5'));var logger=require(_0x6aee('0x6'))(_0x6aee('0x7'));var config=require(_0x6aee('0x8'));var jayson=require(_0x6aee('0x9'));var client=jayson['client'][_0x6aee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d85b6,_0x15f1c4,_0x2a8921){return new BPromise(function(_0x2d2851,_0x1af755){return client[_0x6aee('0xb')](_0x3d85b6,_0x2a8921)[_0x6aee('0xc')](function(_0x480acd){logger[_0x6aee('0xd')](_0x6aee('0xe'),_0x15f1c4,_0x6aee('0xf'));logger['debug'](_0x6aee('0x10'),_0x15f1c4,_0x6aee('0xf'),JSON['stringify'](_0x480acd));if(_0x480acd[_0x6aee('0x11')]){if(_0x480acd['error'][_0x6aee('0x12')]===0x1f4){logger[_0x6aee('0x11')](_0x6aee('0xe'),_0x15f1c4,_0x480acd[_0x6aee('0x11')][_0x6aee('0x13')]);return _0x1af755(_0x480acd[_0x6aee('0x11')]['message']);}logger[_0x6aee('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x15f1c4,_0x480acd[_0x6aee('0x11')][_0x6aee('0x13')]);return _0x2d2851(_0x480acd[_0x6aee('0x11')]['message']);}else{logger[_0x6aee('0xd')](_0x6aee('0xe'),_0x15f1c4,_0x6aee('0xf'));_0x2d2851(_0x480acd[_0x6aee('0x14')][_0x6aee('0x13')]);}})['catch'](function(_0x3e1bcc){logger[_0x6aee('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x15f1c4,_0x3e1bcc);_0x1af755(_0x3e1bcc);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 3398521..7758c79 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 _0x9929=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','index','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x2b2fbf,_0x2c73df){var _0x196431=function(_0x507802){while(--_0x507802){_0x2b2fbf['push'](_0x2b2fbf['shift']());}};_0x196431(++_0x2c73df);}(_0x9929,0x1b5));var _0x9992=function(_0x3550a5,_0x426f1a){_0x3550a5=_0x3550a5-0x0;var _0x2cae4a=_0x9929[_0x3550a5];return _0x2cae4a;};'use strict';var multer=require('multer');var util=require(_0x9992('0x0'));var path=require(_0x9992('0x1'));var timeout=require(_0x9992('0x2'));var express=require(_0x9992('0x3'));var router=express[_0x9992('0x4')]();var fs_extra=require(_0x9992('0x5'));var auth=require(_0x9992('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9992('0x7'));var controller=require(_0x9992('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9992('0x9')]);router[_0x9992('0xa')](_0x9992('0xb'),auth[_0x9992('0xc')](),controller['describe']);router['get'](_0x9992('0xd'),auth[_0x9992('0xc')](),controller[_0x9992('0xe')]);router[_0x9992('0xf')]('/',auth[_0x9992('0xc')](),controller[_0x9992('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9992('0x11')]);router[_0x9992('0x12')](_0x9992('0xd'),auth[_0x9992('0xc')](),controller[_0x9992('0x13')]);module[_0x9992('0x14')]=router; \ No newline at end of file +var _0xc78a=['../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xc78a,0x1c6));var _0xac78=function(_0x17249c,_0x168d62){_0x17249c=_0x17249c-0x0;var _0x324e7b=_0xc78a[_0x17249c];return _0x324e7b;};'use strict';var multer=require(_0xac78('0x0'));var util=require(_0xac78('0x1'));var path=require(_0xac78('0x2'));var timeout=require(_0xac78('0x3'));var express=require(_0xac78('0x4'));var router=express[_0xac78('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xac78('0x6'));var interaction=require(_0xac78('0x7'));var config=require(_0xac78('0x8'));var controller=require(_0xac78('0x9'));router[_0xac78('0xa')]('/',auth['isAuthenticated'](),controller[_0xac78('0xb')]);router[_0xac78('0xa')](_0xac78('0xc'),auth[_0xac78('0xd')](),controller[_0xac78('0xe')]);router[_0xac78('0xa')](_0xac78('0xf'),auth[_0xac78('0xd')](),controller[_0xac78('0x10')]);router['post']('/',auth[_0xac78('0xd')](),controller['create']);router[_0xac78('0x11')](_0xac78('0xf'),auth[_0xac78('0xd')](),controller['update']);router[_0xac78('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xac78('0x13')]);module[_0xac78('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index f89df7a..5d55879 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 _0x4e0e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','getFields','create','post','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e0e,0x15f));var _0xe4e0=function(_0x3329c0,_0x622ba3){_0x3329c0=_0x3329c0-0x0;var _0x25702e=_0x4e0e[_0x3329c0];return _0x25702e;};'use strict';var multer=require('multer');var util=require(_0xe4e0('0x0'));var path=require(_0xe4e0('0x1'));var timeout=require(_0xe4e0('0x2'));var express=require(_0xe4e0('0x3'));var router=express[_0xe4e0('0x4')]();var fs_extra=require(_0xe4e0('0x5'));var auth=require(_0xe4e0('0x6'));var interaction=require(_0xe4e0('0x7'));var config=require(_0xe4e0('0x8'));var controller=require('./intDeskAccount.controller');router[_0xe4e0('0x9')]('/',auth[_0xe4e0('0xa')](),controller['index']);router[_0xe4e0('0x9')](_0xe4e0('0xb'),auth[_0xe4e0('0xa')](),controller['show']);router[_0xe4e0('0x9')](_0xe4e0('0xc'),auth['isAuthenticated'](),controller[_0xe4e0('0xd')]);router['get']('/:id/fields',auth[_0xe4e0('0xa')](),controller[_0xe4e0('0xe')]);router['post']('/',auth[_0xe4e0('0xa')](),controller[_0xe4e0('0xf')]);router[_0xe4e0('0x10')](_0xe4e0('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xe4e0('0x11')](_0xe4e0('0xb'),auth['isAuthenticated'](),controller[_0xe4e0('0x12')]);router[_0xe4e0('0x13')](_0xe4e0('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xe4e0('0x14')]=router; \ No newline at end of file +var _0x975f=['delete','destroy','exports','path','connect-timeout','express','Router','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','update'];(function(_0x36b556,_0x3cbc3a){var _0x532f56=function(_0x3540dc){while(--_0x3540dc){_0x36b556['push'](_0x36b556['shift']());}};_0x532f56(++_0x3cbc3a);}(_0x975f,0x18f));var _0xf975=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0x975f[_0x1e1965];return _0x1a2e96;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf975('0x0'));var timeout=require(_0xf975('0x1'));var express=require(_0xf975('0x2'));var router=express[_0xf975('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf975('0x4'));router[_0xf975('0x5')]('/',auth[_0xf975('0x6')](),controller[_0xf975('0x7')]);router[_0xf975('0x5')]('/:id',auth[_0xf975('0x6')](),controller[_0xf975('0x8')]);router[_0xf975('0x5')](_0xf975('0x9'),auth[_0xf975('0x6')](),controller[_0xf975('0xa')]);router[_0xf975('0x5')](_0xf975('0xb'),auth[_0xf975('0x6')](),controller[_0xf975('0xc')]);router['post']('/',auth[_0xf975('0x6')](),controller[_0xf975('0xd')]);router[_0xf975('0xe')](_0xf975('0x9'),auth[_0xf975('0x6')](),controller[_0xf975('0xf')]);router[_0xf975('0x10')](_0xf975('0x11'),auth[_0xf975('0x6')](),controller[_0xf975('0x12')]);router[_0xf975('0x13')]('/:id',auth[_0xf975('0x6')](),controller[_0xf975('0x14')]);module[_0xf975('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 6cf2564..573e606 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 _0x4e50=['STRING','basic','ENUM','integrationTab','newTab','sequelize'];(function(_0x2595a6,_0x48fc45){var _0x460197=function(_0x18f9db){while(--_0x18f9db){_0x2595a6['push'](_0x2595a6['shift']());}};_0x460197(++_0x48fc45);}(_0x4e50,0xd1));var _0x04e5=function(_0x4aa75a,_0x10c5cd){_0x4aa75a=_0x4aa75a-0x0;var _0x4396d7=_0x4e50[_0x4aa75a];return _0x4396d7;};'use strict';var Sequelize=require(_0x04e5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x04e5('0x1')]},'username':{'type':Sequelize[_0x04e5('0x1')]},'remoteUri':{'type':Sequelize[_0x04e5('0x1')]},'authType':{'type':Sequelize['ENUM'](_0x04e5('0x2')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x04e5('0x1')]},'consumerKey':{'type':Sequelize[_0x04e5('0x1')]},'consumerSecret':{'type':Sequelize[_0x04e5('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x04e5('0x1')]},'serverUrl':{'type':Sequelize[_0x04e5('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x04e5('0x3')](_0x04e5('0x4'),_0x04e5('0x5')),'defaultValue':_0x04e5('0x4')}}; \ No newline at end of file +var _0x4027=['STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4027,0x19d));var _0x7402=function(_0x2a543e,_0x283978){_0x2a543e=_0x2a543e-0x0;var _0x5ac599=_0x4027[_0x2a543e];return _0x5ac599;};'use strict';var Sequelize=require(_0x7402('0x0'));module['exports']={'name':{'type':Sequelize[_0x7402('0x1')]},'description':{'type':Sequelize[_0x7402('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7402('0x1')]},'authType':{'type':Sequelize[_0x7402('0x2')](_0x7402('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x7402('0x1')]},'consumerKey':{'type':Sequelize[_0x7402('0x1')]},'consumerSecret':{'type':Sequelize[_0x7402('0x1')]},'token':{'type':Sequelize[_0x7402('0x1')]},'tokenSecret':{'type':Sequelize[_0x7402('0x1')]},'serverUrl':{'type':Sequelize[_0x7402('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7402('0x2')](_0x7402('0x4'),_0x7402('0x5')),'defaultValue':_0x7402('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 5675fb3..fb2fea8 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 _0x8382=['create','body','update','params','catch','getConfigurations','findOne','DeskConfiguration','length','nolimit','addConfiguration','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerSecret','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','Authorization','format','Basic\x20%s','toString','base64','concat','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','name','send','map','DeskAccount','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find'];(function(_0x2ce9c3,_0x20a165){var _0x109b3a=function(_0xfd90e2){while(--_0xfd90e2){_0x2ce9c3['push'](_0x2ce9c3['shift']());}};_0x109b3a(++_0x20a165);}(_0x8382,0x113));var _0x2838=function(_0x12d906,_0x264c2f){_0x12d906=_0x12d906-0x0;var _0x113a02=_0x8382[_0x12d906];return _0x113a02;};'use strict';var emlformat=require(_0x2838('0x0'));var rimraf=require(_0x2838('0x1'));var zipdir=require(_0x2838('0x2'));var jsonpatch=require(_0x2838('0x3'));var rp=require(_0x2838('0x4'));var moment=require(_0x2838('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2838('0x6'));var util=require('util');var path=require(_0x2838('0x7'));var sox=require(_0x2838('0x8'));var csv=require(_0x2838('0x9'));var ejs=require(_0x2838('0xa'));var fs=require('fs');var fs_extra=require(_0x2838('0xb'));var _=require(_0x2838('0xc'));var squel=require('squel');var crypto=require(_0x2838('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2838('0xe'));var toCsv=require(_0x2838('0x9'));var querystring=require('querystring');var Papa=require(_0x2838('0xf'));var Redis=require(_0x2838('0x10'));var authService=require(_0x2838('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2838('0x12'));var hardwareService=require(_0x2838('0x13'));var logger=require(_0x2838('0x14'))(_0x2838('0x15'));var utils=require(_0x2838('0x16'));var config=require(_0x2838('0x17'));var licenseUtil=require(_0x2838('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2838('0x19'));function respondWithStatusCode(_0x43c1eb,_0x1ccea1){_0x1ccea1=_0x1ccea1||0xcc;return function(_0x2253db){if(_0x2253db){return _0x43c1eb[_0x2838('0x1a')](_0x1ccea1);}return _0x43c1eb[_0x2838('0x1b')](_0x1ccea1)[_0x2838('0x1c')]();};}function respondWithResult(_0x597ab9,_0x2e7be1){_0x2e7be1=_0x2e7be1||0xc8;return function(_0x6079a4){if(_0x6079a4){return _0x597ab9[_0x2838('0x1b')](_0x2e7be1)[_0x2838('0x1d')](_0x6079a4);}};}function respondWithFilteredResult(_0x20e2b0,_0x2a2d3d){return function(_0x29375c){if(_0x29375c){var _0x5972d6=typeof _0x2a2d3d[_0x2838('0x1e')]===_0x2838('0x1f')&&typeof _0x2a2d3d['limit']===_0x2838('0x1f');var _0x48ccf0=_0x29375c[_0x2838('0x20')];var _0x28aabc=_0x5972d6?0x0:_0x2a2d3d[_0x2838('0x1e')];var _0x2b18f9=_0x5972d6?_0x29375c[_0x2838('0x20')]:_0x2a2d3d[_0x2838('0x1e')]+_0x2a2d3d[_0x2838('0x21')];var _0x2b59a7;if(_0x2b18f9>=_0x48ccf0){_0x2b18f9=_0x48ccf0;_0x2b59a7=0xc8;}else{_0x2b59a7=0xce;}_0x20e2b0[_0x2838('0x1b')](_0x2b59a7);return _0x20e2b0[_0x2838('0x22')](_0x2838('0x23'),_0x28aabc+'-'+_0x2b18f9+'/'+_0x48ccf0)['json'](_0x29375c);}return null;};}function patchUpdates(_0x2432ed){return function(_0x476738){try{jsonpatch[_0x2838('0x24')](_0x476738,_0x2432ed,!![]);}catch(_0x590b8a){return BPromise[_0x2838('0x25')](_0x590b8a);}return _0x476738[_0x2838('0x26')]();};}function saveUpdates(_0x250f9f,_0xe3670e){return function(_0x30b550){if(_0x30b550){return _0x30b550['update'](_0x250f9f)[_0x2838('0x27')](function(_0x7ce6e0){return _0x7ce6e0;});}return null;};}function removeEntity(_0x8c6bb1,_0x1d1da3){return function(_0x3629ca){if(_0x3629ca){return _0x3629ca[_0x2838('0x28')]()[_0x2838('0x27')](function(){_0x8c6bb1[_0x2838('0x1b')](0xcc)[_0x2838('0x1c')]();});}};}function handleEntityNotFound(_0x345937,_0x40047a){return function(_0x10cb78){if(!_0x10cb78){_0x345937[_0x2838('0x1a')](0x194);}return _0x10cb78;};}function handleError(_0x371054,_0x40a083){_0x40a083=_0x40a083||0x1f4;return function(_0x3aacd7){logger['error'](_0x3aacd7['stack']);if(_0x3aacd7[_0x2838('0x29')]){delete _0x3aacd7[_0x2838('0x29')];}_0x371054[_0x2838('0x1b')](_0x40a083)[_0x2838('0x2a')](_0x3aacd7);};}exports['index']=function(_0x5e0bb5,_0x2bf2b3){var _0x5966e6={},_0x4a7cf1={},_0x1a57fc={'count':0x0,'rows':[]};var _0x40dd63=_[_0x2838('0x2b')](db[_0x2838('0x2c')][_0x2838('0x2d')],function(_0x312bf1){return{'name':_0x312bf1[_0x2838('0x2e')],'type':_0x312bf1['type'][_0x2838('0x2f')]};});_0x4a7cf1[_0x2838('0x30')]=_[_0x2838('0x2b')](_0x40dd63,'name');_0x4a7cf1[_0x2838('0x31')]=_['keys'](_0x5e0bb5[_0x2838('0x31')]);_0x4a7cf1[_0x2838('0x32')]=_['intersection'](_0x4a7cf1[_0x2838('0x30')],_0x4a7cf1[_0x2838('0x31')]);_0x5966e6[_0x2838('0x33')]=_[_0x2838('0x34')](_0x4a7cf1[_0x2838('0x30')],qs[_0x2838('0x35')](_0x5e0bb5[_0x2838('0x31')]['fields']));_0x5966e6['attributes']=_0x5966e6[_0x2838('0x33')]['length']?_0x5966e6['attributes']:_0x4a7cf1['model'];if(!_0x5e0bb5[_0x2838('0x31')][_0x2838('0x36')]('nolimit')){_0x5966e6[_0x2838('0x21')]=qs['limit'](_0x5e0bb5[_0x2838('0x31')][_0x2838('0x21')]);_0x5966e6[_0x2838('0x1e')]=qs['offset'](_0x5e0bb5[_0x2838('0x31')][_0x2838('0x1e')]);}_0x5966e6[_0x2838('0x37')]=qs[_0x2838('0x38')](_0x5e0bb5[_0x2838('0x31')][_0x2838('0x38')]);_0x5966e6[_0x2838('0x39')]=qs[_0x2838('0x32')](_[_0x2838('0x3a')](_0x5e0bb5['query'],_0x4a7cf1['filters']),_0x40dd63);if(_0x5e0bb5[_0x2838('0x31')][_0x2838('0x3b')]){_0x5966e6['where']=_[_0x2838('0x3c')](_0x5966e6[_0x2838('0x39')],{'$or':_[_0x2838('0x2b')](_0x40dd63,function(_0x30f571){if(_0x30f571['type']!==_0x2838('0x3d')){var _0x24e121={};_0x24e121[_0x30f571[_0x2838('0x29')]]={'$like':'%'+_0x5e0bb5[_0x2838('0x31')][_0x2838('0x3b')]+'%'};return _0x24e121;}})});}_0x5966e6=_['merge']({},_0x5966e6,_0x5e0bb5[_0x2838('0x3e')]);var _0x5741b7={'where':_0x5966e6['where']};return db[_0x2838('0x2c')][_0x2838('0x20')](_0x5741b7)[_0x2838('0x27')](function(_0x43eb0f){_0x1a57fc[_0x2838('0x20')]=_0x43eb0f;if(_0x5e0bb5[_0x2838('0x31')][_0x2838('0x3f')]){_0x5966e6[_0x2838('0x40')]=[{'all':!![]}];}return db['DeskAccount'][_0x2838('0x41')](_0x5966e6);})[_0x2838('0x27')](function(_0x478cc5){_0x1a57fc[_0x2838('0x42')]=_0x478cc5;return _0x1a57fc;})[_0x2838('0x27')](respondWithFilteredResult(_0x2bf2b3,_0x5966e6))['catch'](handleError(_0x2bf2b3,null));};exports[_0x2838('0x43')]=function(_0x2bf909,_0x27bf82){var _0x489436={'raw':![],'where':{'id':_0x2bf909['params']['id']}},_0x8d763e={};_0x8d763e[_0x2838('0x30')]=_[_0x2838('0x44')](db[_0x2838('0x2c')][_0x2838('0x2d')]);_0x8d763e[_0x2838('0x31')]=_[_0x2838('0x44')](_0x2bf909[_0x2838('0x31')]);_0x8d763e[_0x2838('0x32')]=_[_0x2838('0x34')](_0x8d763e[_0x2838('0x30')],_0x8d763e[_0x2838('0x31')]);_0x489436[_0x2838('0x33')]=_['intersection'](_0x8d763e[_0x2838('0x30')],qs['fields'](_0x2bf909[_0x2838('0x31')][_0x2838('0x35')]));_0x489436['attributes']=_0x489436['attributes']['length']?_0x489436[_0x2838('0x33')]:_0x8d763e[_0x2838('0x30')];if(_0x2bf909[_0x2838('0x31')][_0x2838('0x3f')]){_0x489436['include']=[{'all':!![]}];}_0x489436=_[_0x2838('0x3c')]({},_0x489436,_0x2bf909['options']);return db['DeskAccount'][_0x2838('0x45')](_0x489436)[_0x2838('0x27')](handleEntityNotFound(_0x27bf82,null))[_0x2838('0x27')](respondWithResult(_0x27bf82,null))['catch'](handleError(_0x27bf82,null));};exports[_0x2838('0x46')]=function(_0x7a2e86,_0x498215){return db[_0x2838('0x2c')][_0x2838('0x46')](_0x7a2e86[_0x2838('0x47')],{})[_0x2838('0x27')](respondWithResult(_0x498215,0xc9))['catch'](handleError(_0x498215,null));};exports[_0x2838('0x48')]=function(_0x21b121,_0x35a3e6){if(_0x21b121['body']['id']){delete _0x21b121[_0x2838('0x47')]['id'];}return db[_0x2838('0x2c')]['find']({'where':{'id':_0x21b121[_0x2838('0x49')]['id']}})[_0x2838('0x27')](handleEntityNotFound(_0x35a3e6,null))[_0x2838('0x27')](saveUpdates(_0x21b121[_0x2838('0x47')],null))[_0x2838('0x27')](respondWithResult(_0x35a3e6,null))['catch'](handleError(_0x35a3e6,null));};exports[_0x2838('0x28')]=function(_0x5bf3e6,_0x48da25){return db[_0x2838('0x2c')][_0x2838('0x45')]({'where':{'id':_0x5bf3e6['params']['id']}})[_0x2838('0x27')](handleEntityNotFound(_0x48da25,null))[_0x2838('0x27')](removeEntity(_0x48da25,null))[_0x2838('0x4a')](handleError(_0x48da25,null));};exports[_0x2838('0x4b')]=function(_0x55bd7a,_0x5eeafd,_0x48be03){var _0x1636ae={};var _0x3d62e3={};var _0x4e61ac;var _0x100c6b;return db[_0x2838('0x2c')][_0x2838('0x4c')]({'where':{'id':_0x55bd7a[_0x2838('0x49')]['id']}})[_0x2838('0x27')](handleEntityNotFound(_0x5eeafd,null))['then'](function(_0x8cdaf1){if(_0x8cdaf1){_0x4e61ac=_0x8cdaf1;_0x3d62e3[_0x2838('0x30')]=_[_0x2838('0x44')](db[_0x2838('0x4d')][_0x2838('0x2d')]);_0x3d62e3['query']=_['keys'](_0x55bd7a[_0x2838('0x31')]);_0x3d62e3[_0x2838('0x32')]=_[_0x2838('0x34')](_0x3d62e3[_0x2838('0x30')],_0x3d62e3[_0x2838('0x31')]);_0x1636ae[_0x2838('0x33')]=_[_0x2838('0x34')](_0x3d62e3[_0x2838('0x30')],qs[_0x2838('0x35')](_0x55bd7a['query'][_0x2838('0x35')]));_0x1636ae[_0x2838('0x33')]=_0x1636ae[_0x2838('0x33')]['length']?_0x1636ae[_0x2838('0x33')]:_0x3d62e3[_0x2838('0x30')];_0x1636ae[_0x2838('0x37')]=qs[_0x2838('0x38')](_0x55bd7a[_0x2838('0x31')][_0x2838('0x38')]);_0x1636ae[_0x2838('0x39')]=qs[_0x2838('0x32')](_['pick'](_0x55bd7a[_0x2838('0x31')],_0x3d62e3[_0x2838('0x32')]));if(_0x55bd7a[_0x2838('0x31')]['filter']){_0x1636ae['where']=_[_0x2838('0x3c')](_0x1636ae[_0x2838('0x39')],{'$or':_[_0x2838('0x2b')](_0x1636ae[_0x2838('0x33')],function(_0x33066a){var _0x5af150={};_0x5af150[_0x33066a]={'$like':'%'+_0x55bd7a[_0x2838('0x31')][_0x2838('0x3b')]+'%'};return _0x5af150;})});}_0x1636ae=_[_0x2838('0x3c')]({},_0x1636ae,_0x55bd7a[_0x2838('0x3e')]);return _0x4e61ac[_0x2838('0x4b')](_0x1636ae);}})[_0x2838('0x27')](function(_0x2accd9){if(_0x2accd9){_0x100c6b=_0x2accd9[_0x2838('0x4e')];if(!_0x55bd7a[_0x2838('0x31')]['hasOwnProperty'](_0x2838('0x4f'))){_0x1636ae['limit']=qs[_0x2838('0x21')](_0x55bd7a[_0x2838('0x31')][_0x2838('0x21')]);_0x1636ae[_0x2838('0x1e')]=qs[_0x2838('0x1e')](_0x55bd7a['query'][_0x2838('0x1e')]);}return _0x4e61ac[_0x2838('0x4b')](_0x1636ae);}})[_0x2838('0x27')](function(_0x174ea0){if(_0x174ea0){return _0x174ea0?{'count':_0x100c6b,'rows':_0x174ea0}:null;}})[_0x2838('0x27')](respondWithResult(_0x5eeafd,null))['catch'](handleError(_0x5eeafd,null));};exports[_0x2838('0x50')]=function(_0x189dc7,_0x21da6d,_0x52b9a8){if(_0x189dc7[_0x2838('0x47')]['id']){delete _0x189dc7['body']['id'];}return db['DeskAccount'][_0x2838('0x4c')]({'where':{'id':_0x189dc7[_0x2838('0x49')]['id']}})['then'](handleEntityNotFound(_0x21da6d,null))[_0x2838('0x27')](function(_0x100376){if(_0x100376){_0x189dc7[_0x2838('0x47')]['AccountId']=_0x100376['id'];_0x189dc7['body'][_0x2838('0x51')]=integrations[_0x2838('0x52')](_0x189dc7[_0x2838('0x47')][_0x2838('0x53')],_0x189dc7[_0x2838('0x47')][_0x2838('0x54')]);_0x189dc7[_0x2838('0x47')][_0x2838('0x55')]=integrations[_0x2838('0x56')](_0x189dc7[_0x2838('0x47')][_0x2838('0x53')],_0x189dc7[_0x2838('0x47')][_0x2838('0x54')]);return db[_0x2838('0x4d')][_0x2838('0x46')](_0x189dc7[_0x2838('0x47')],{'include':[{'model':db[_0x2838('0x57')],'as':_0x2838('0x51')},{'model':db[_0x2838('0x57')],'as':_0x2838('0x55')}]});}return null;})['then'](respondWithResult(_0x21da6d,null))['catch'](handleError(_0x21da6d,null));};exports[_0x2838('0x58')]=function(_0x5217ae,_0x529fd4,_0x1fccf0){var _0x5c3a8f=[{'name':_0x2838('0x59'),'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 _0x3e7994='';return db[_0x2838('0x2c')][_0x2838('0x4c')]({'where':{'id':_0x5217ae[_0x2838('0x49')]['id']},'attributes':['id',_0x2838('0x5a'),_0x2838('0x5b'),_0x2838('0x5c'),_0x2838('0x5d'),'consumerKey',_0x2838('0x5e'),'token',_0x2838('0x5f')]})[_0x2838('0x27')](handleEntityNotFound(_0x529fd4,null))[_0x2838('0x27')](function(_0xd96331){if(_0xd96331){_0x3e7994=_0xd96331[_0x2838('0x5a')];var _0x17fb98=_0x3e7994[_0x2838('0x60')](-0x1);if(_0x17fb98==='/'){_0x3e7994=_0x3e7994[_0x2838('0x61')](0x0,_0x3e7994[_0x2838('0x62')](_0x17fb98));}var _0x1a82a7={'method':_0x2838('0x63'),'uri':util['format'](_0x2838('0x64'),_0x3e7994),'headers':{'Content-Type':'application/json','Accept':_0x2838('0x65')},'json':!![]};if(_0xd96331[_0x2838('0x5b')]==='basic'){_0x1a82a7['headers'][_0x2838('0x66')]=util[_0x2838('0x67')](_0x2838('0x68'),new Buffer(util[_0x2838('0x67')]('%s:%s',_0xd96331[_0x2838('0x5c')],_0xd96331[_0x2838('0x5d')]))[_0x2838('0x69')](_0x2838('0x6a')));}return rp(_0x1a82a7)[_0x2838('0x27')](function(_0x39700f){return _0x5c3a8f[_0x2838('0x6b')](_[_0x2838('0x2b')](_0x39700f['_embedded'][_0x2838('0x6c')],function(_0x2f6682){return{'id':_0x2f6682[_0x2838('0x29')],'name':_0x2f6682[_0x2838('0x29')],'type':_0x2f6682[_0x2838('0x54')],'active':_0x2f6682['active'],'label':_0x2f6682[_0x2838('0x6d')],'custom':!![]};}));});}})[_0x2838('0x27')](function(_0x38f55d){return{'count':_0x38f55d[_0x2838('0x4e')],'rows':_0x38f55d};})[_0x2838('0x27')](respondWithResult(_0x529fd4,null))['catch'](function(_0x256333){var _0x5ce313=_0x5217ae[_0x2838('0x31')]['test']?0x1f4:_0x256333[_0x2838('0x6e')]||0x1f4;logger['error'](_0x2838('0x6f'),_0x2838('0x58'),_0x5ce313,JSON[_0x2838('0x70')](_0x256333));delete _0x256333[_0x2838('0x29')];if(_0x5ce313===0x191){_0x5ce313=0x190;}_0x529fd4[_0x2838('0x1b')](_0x5ce313)['send'](_0x5217ae['query'][_0x2838('0x71')]?{'message':_0x2838('0x72'),'statusCode':_0x256333[_0x2838('0x6e')]}:_0x256333);});}; \ No newline at end of file +var _0x4c6b=['substring','lastIndexOf','format','application/json','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','_embedded','active','test','statusCode','getFields','stringify','send','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','end','error','stack','name','index','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','DeskAccount','options','create','body','find','getConfigurations','order','addConfiguration','findOne','Subjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','priority','remoteUri','authType','username','password','consumerSecret','token','tokenSecret','slice'];(function(_0x48c860,_0x590a1f){var _0x4e598b=function(_0x1eea88){while(--_0x1eea88){_0x48c860['push'](_0x48c860['shift']());}};_0x4e598b(++_0x590a1f);}(_0x4c6b,0x15c));var _0xb4c6=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x4c6b[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0xb4c6('0x0'));var rimraf=require(_0xb4c6('0x1'));var zipdir=require(_0xb4c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb4c6('0x3'));var moment=require(_0xb4c6('0x4'));var BPromise=require(_0xb4c6('0x5'));var Mustache=require('mustache');var util=require(_0xb4c6('0x6'));var path=require(_0xb4c6('0x7'));var sox=require('sox');var csv=require(_0xb4c6('0x8'));var ejs=require(_0xb4c6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb4c6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb4c6('0xb'));var toCsv=require(_0xb4c6('0x8'));var querystring=require(_0xb4c6('0xc'));var Papa=require(_0xb4c6('0xd'));var Redis=require(_0xb4c6('0xe'));var authService=require(_0xb4c6('0xf'));var qs=require(_0xb4c6('0x10'));var as=require(_0xb4c6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4c6('0x12'))(_0xb4c6('0x13'));var utils=require(_0xb4c6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb4c6('0x15'));var db=require(_0xb4c6('0x16'))['db'];var integrations=require(_0xb4c6('0x17'));function respondWithStatusCode(_0x470b23,_0x247224){_0x247224=_0x247224||0xcc;return function(_0x2ca900){if(_0x2ca900){return _0x470b23[_0xb4c6('0x18')](_0x247224);}return _0x470b23[_0xb4c6('0x19')](_0x247224)['end']();};}function respondWithResult(_0x34fd68,_0x3c1ee7){_0x3c1ee7=_0x3c1ee7||0xc8;return function(_0x5508db){if(_0x5508db){return _0x34fd68[_0xb4c6('0x19')](_0x3c1ee7)[_0xb4c6('0x1a')](_0x5508db);}};}function respondWithFilteredResult(_0xe4d531,_0x292d7f){return function(_0x2adc71){if(_0x2adc71){var _0x2a9079=typeof _0x292d7f[_0xb4c6('0x1b')]===_0xb4c6('0x1c')&&typeof _0x292d7f[_0xb4c6('0x1d')]===_0xb4c6('0x1c');var _0xd651d0=_0x2adc71['count'];var _0x26bc26=_0x2a9079?0x0:_0x292d7f[_0xb4c6('0x1b')];var _0x3b8c3e=_0x2a9079?_0x2adc71[_0xb4c6('0x1e')]:_0x292d7f[_0xb4c6('0x1b')]+_0x292d7f[_0xb4c6('0x1d')];var _0x3d843a;if(_0x3b8c3e>=_0xd651d0){_0x3b8c3e=_0xd651d0;_0x3d843a=0xc8;}else{_0x3d843a=0xce;}_0xe4d531[_0xb4c6('0x19')](_0x3d843a);return _0xe4d531[_0xb4c6('0x1f')](_0xb4c6('0x20'),_0x26bc26+'-'+_0x3b8c3e+'/'+_0xd651d0)[_0xb4c6('0x1a')](_0x2adc71);}return null;};}function patchUpdates(_0x1fbdc6){return function(_0x37fc2b){try{jsonpatch['apply'](_0x37fc2b,_0x1fbdc6,!![]);}catch(_0x518cba){return BPromise[_0xb4c6('0x21')](_0x518cba);}return _0x37fc2b[_0xb4c6('0x22')]();};}function saveUpdates(_0xf7dda2,_0x3539c5){return function(_0x2377ea){if(_0x2377ea){return _0x2377ea['update'](_0xf7dda2)['then'](function(_0x349733){return _0x349733;});}return null;};}function removeEntity(_0x51d6ab,_0x43f69f){return function(_0x172949){if(_0x172949){return _0x172949[_0xb4c6('0x23')]()[_0xb4c6('0x24')](function(){_0x51d6ab['status'](0xcc)[_0xb4c6('0x25')]();});}};}function handleEntityNotFound(_0x3f086f,_0x190b9b){return function(_0x1b5d82){if(!_0x1b5d82){_0x3f086f['sendStatus'](0x194);}return _0x1b5d82;};}function handleError(_0x46cdad,_0x3db77c){_0x3db77c=_0x3db77c||0x1f4;return function(_0x3c0b79){logger[_0xb4c6('0x26')](_0x3c0b79[_0xb4c6('0x27')]);if(_0x3c0b79[_0xb4c6('0x28')]){delete _0x3c0b79['name'];}_0x46cdad[_0xb4c6('0x19')](_0x3db77c)['send'](_0x3c0b79);};}exports[_0xb4c6('0x29')]=function(_0x2792ca,_0x1a0b82){var _0x25fdea={},_0x516580={},_0x4aa44f={'count':0x0,'rows':[]};var _0x1280ed=_[_0xb4c6('0x2a')](db['DeskAccount'][_0xb4c6('0x2b')],function(_0x5500ae){return{'name':_0x5500ae['fieldName'],'type':_0x5500ae['type'][_0xb4c6('0x2c')]};});_0x516580['model']=_[_0xb4c6('0x2a')](_0x1280ed,_0xb4c6('0x28'));_0x516580[_0xb4c6('0x2d')]=_[_0xb4c6('0x2e')](_0x2792ca['query']);_0x516580[_0xb4c6('0x2f')]=_[_0xb4c6('0x30')](_0x516580[_0xb4c6('0x31')],_0x516580[_0xb4c6('0x2d')]);_0x25fdea[_0xb4c6('0x32')]=_[_0xb4c6('0x30')](_0x516580['model'],qs[_0xb4c6('0x33')](_0x2792ca[_0xb4c6('0x2d')][_0xb4c6('0x33')]));_0x25fdea['attributes']=_0x25fdea[_0xb4c6('0x32')][_0xb4c6('0x34')]?_0x25fdea['attributes']:_0x516580['model'];if(!_0x2792ca[_0xb4c6('0x2d')][_0xb4c6('0x35')](_0xb4c6('0x36'))){_0x25fdea[_0xb4c6('0x1d')]=qs[_0xb4c6('0x1d')](_0x2792ca[_0xb4c6('0x2d')][_0xb4c6('0x1d')]);_0x25fdea[_0xb4c6('0x1b')]=qs[_0xb4c6('0x1b')](_0x2792ca[_0xb4c6('0x2d')]['offset']);}_0x25fdea['order']=qs[_0xb4c6('0x37')](_0x2792ca[_0xb4c6('0x2d')]['sort']);_0x25fdea['where']=qs[_0xb4c6('0x2f')](_[_0xb4c6('0x38')](_0x2792ca[_0xb4c6('0x2d')],_0x516580[_0xb4c6('0x2f')]),_0x1280ed);if(_0x2792ca[_0xb4c6('0x2d')][_0xb4c6('0x39')]){_0x25fdea[_0xb4c6('0x3a')]=_[_0xb4c6('0x3b')](_0x25fdea[_0xb4c6('0x3a')],{'$or':_[_0xb4c6('0x2a')](_0x1280ed,function(_0x559fbf){if(_0x559fbf[_0xb4c6('0x3c')]!==_0xb4c6('0x3d')){var _0x20f389={};_0x20f389[_0x559fbf[_0xb4c6('0x28')]]={'$like':'%'+_0x2792ca[_0xb4c6('0x2d')][_0xb4c6('0x39')]+'%'};return _0x20f389;}})});}_0x25fdea=_['merge']({},_0x25fdea,_0x2792ca['options']);var _0x14a1e6={'where':_0x25fdea[_0xb4c6('0x3a')]};return db['DeskAccount'][_0xb4c6('0x1e')](_0x14a1e6)[_0xb4c6('0x24')](function(_0x3b76cc){_0x4aa44f[_0xb4c6('0x1e')]=_0x3b76cc;if(_0x2792ca[_0xb4c6('0x2d')][_0xb4c6('0x3e')]){_0x25fdea['include']=[{'all':!![]}];}return db['DeskAccount'][_0xb4c6('0x3f')](_0x25fdea);})['then'](function(_0x337547){_0x4aa44f[_0xb4c6('0x40')]=_0x337547;return _0x4aa44f;})['then'](respondWithFilteredResult(_0x1a0b82,_0x25fdea))[_0xb4c6('0x41')](handleError(_0x1a0b82,null));};exports[_0xb4c6('0x42')]=function(_0x4dc68b,_0x1933e7){var _0x3084b4={'raw':![],'where':{'id':_0x4dc68b[_0xb4c6('0x43')]['id']}},_0x48e2d3={};_0x48e2d3[_0xb4c6('0x31')]=_[_0xb4c6('0x2e')](db[_0xb4c6('0x44')]['rawAttributes']);_0x48e2d3[_0xb4c6('0x2d')]=_[_0xb4c6('0x2e')](_0x4dc68b[_0xb4c6('0x2d')]);_0x48e2d3['filters']=_[_0xb4c6('0x30')](_0x48e2d3[_0xb4c6('0x31')],_0x48e2d3[_0xb4c6('0x2d')]);_0x3084b4[_0xb4c6('0x32')]=_[_0xb4c6('0x30')](_0x48e2d3[_0xb4c6('0x31')],qs[_0xb4c6('0x33')](_0x4dc68b[_0xb4c6('0x2d')][_0xb4c6('0x33')]));_0x3084b4[_0xb4c6('0x32')]=_0x3084b4['attributes'][_0xb4c6('0x34')]?_0x3084b4[_0xb4c6('0x32')]:_0x48e2d3['model'];if(_0x4dc68b[_0xb4c6('0x2d')][_0xb4c6('0x3e')]){_0x3084b4['include']=[{'all':!![]}];}_0x3084b4=_['merge']({},_0x3084b4,_0x4dc68b[_0xb4c6('0x45')]);return db[_0xb4c6('0x44')]['find'](_0x3084b4)[_0xb4c6('0x24')](handleEntityNotFound(_0x1933e7,null))['then'](respondWithResult(_0x1933e7,null))[_0xb4c6('0x41')](handleError(_0x1933e7,null));};exports[_0xb4c6('0x46')]=function(_0x461304,_0x23e441){return db[_0xb4c6('0x44')][_0xb4c6('0x46')](_0x461304['body'],{})[_0xb4c6('0x24')](respondWithResult(_0x23e441,0xc9))[_0xb4c6('0x41')](handleError(_0x23e441,null));};exports['update']=function(_0x5c55e3,_0x372122){if(_0x5c55e3['body']['id']){delete _0x5c55e3[_0xb4c6('0x47')]['id'];}return db[_0xb4c6('0x44')]['find']({'where':{'id':_0x5c55e3[_0xb4c6('0x43')]['id']}})[_0xb4c6('0x24')](handleEntityNotFound(_0x372122,null))[_0xb4c6('0x24')](saveUpdates(_0x5c55e3[_0xb4c6('0x47')],null))['then'](respondWithResult(_0x372122,null))[_0xb4c6('0x41')](handleError(_0x372122,null));};exports['destroy']=function(_0x5f29f9,_0x38b250){return db[_0xb4c6('0x44')][_0xb4c6('0x48')]({'where':{'id':_0x5f29f9[_0xb4c6('0x43')]['id']}})[_0xb4c6('0x24')](handleEntityNotFound(_0x38b250,null))[_0xb4c6('0x24')](removeEntity(_0x38b250,null))['catch'](handleError(_0x38b250,null));};exports[_0xb4c6('0x49')]=function(_0x5b043d,_0x5127bb,_0x20ed13){var _0x313eb5={};var _0x55f30c={};var _0x417295;var _0x35371c;return db[_0xb4c6('0x44')]['findOne']({'where':{'id':_0x5b043d[_0xb4c6('0x43')]['id']}})[_0xb4c6('0x24')](handleEntityNotFound(_0x5127bb,null))['then'](function(_0xfd5f5e){if(_0xfd5f5e){_0x417295=_0xfd5f5e;_0x55f30c[_0xb4c6('0x31')]=_['keys'](db['DeskConfiguration'][_0xb4c6('0x2b')]);_0x55f30c[_0xb4c6('0x2d')]=_[_0xb4c6('0x2e')](_0x5b043d['query']);_0x55f30c[_0xb4c6('0x2f')]=_['intersection'](_0x55f30c['model'],_0x55f30c[_0xb4c6('0x2d')]);_0x313eb5[_0xb4c6('0x32')]=_[_0xb4c6('0x30')](_0x55f30c[_0xb4c6('0x31')],qs[_0xb4c6('0x33')](_0x5b043d[_0xb4c6('0x2d')]['fields']));_0x313eb5['attributes']=_0x313eb5[_0xb4c6('0x32')]['length']?_0x313eb5[_0xb4c6('0x32')]:_0x55f30c[_0xb4c6('0x31')];_0x313eb5[_0xb4c6('0x4a')]=qs[_0xb4c6('0x37')](_0x5b043d[_0xb4c6('0x2d')][_0xb4c6('0x37')]);_0x313eb5[_0xb4c6('0x3a')]=qs[_0xb4c6('0x2f')](_[_0xb4c6('0x38')](_0x5b043d[_0xb4c6('0x2d')],_0x55f30c[_0xb4c6('0x2f')]));if(_0x5b043d[_0xb4c6('0x2d')][_0xb4c6('0x39')]){_0x313eb5[_0xb4c6('0x3a')]=_[_0xb4c6('0x3b')](_0x313eb5[_0xb4c6('0x3a')],{'$or':_[_0xb4c6('0x2a')](_0x313eb5[_0xb4c6('0x32')],function(_0x59dab3){var _0xdec41d={};_0xdec41d[_0x59dab3]={'$like':'%'+_0x5b043d[_0xb4c6('0x2d')][_0xb4c6('0x39')]+'%'};return _0xdec41d;})});}_0x313eb5=_[_0xb4c6('0x3b')]({},_0x313eb5,_0x5b043d[_0xb4c6('0x45')]);return _0x417295[_0xb4c6('0x49')](_0x313eb5);}})[_0xb4c6('0x24')](function(_0x1a8c41){if(_0x1a8c41){_0x35371c=_0x1a8c41[_0xb4c6('0x34')];if(!_0x5b043d[_0xb4c6('0x2d')][_0xb4c6('0x35')](_0xb4c6('0x36'))){_0x313eb5[_0xb4c6('0x1d')]=qs[_0xb4c6('0x1d')](_0x5b043d[_0xb4c6('0x2d')][_0xb4c6('0x1d')]);_0x313eb5[_0xb4c6('0x1b')]=qs[_0xb4c6('0x1b')](_0x5b043d[_0xb4c6('0x2d')][_0xb4c6('0x1b')]);}return _0x417295['getConfigurations'](_0x313eb5);}})[_0xb4c6('0x24')](function(_0x4357c2){if(_0x4357c2){return _0x4357c2?{'count':_0x35371c,'rows':_0x4357c2}:null;}})[_0xb4c6('0x24')](respondWithResult(_0x5127bb,null))[_0xb4c6('0x41')](handleError(_0x5127bb,null));};exports[_0xb4c6('0x4b')]=function(_0x5ae93c,_0x3798a3,_0x646749){if(_0x5ae93c[_0xb4c6('0x47')]['id']){delete _0x5ae93c['body']['id'];}return db[_0xb4c6('0x44')][_0xb4c6('0x4c')]({'where':{'id':_0x5ae93c['params']['id']}})[_0xb4c6('0x24')](handleEntityNotFound(_0x3798a3,null))[_0xb4c6('0x24')](function(_0x2357d1){if(_0x2357d1){_0x5ae93c[_0xb4c6('0x47')]['AccountId']=_0x2357d1['id'];_0x5ae93c[_0xb4c6('0x47')][_0xb4c6('0x4d')]=integrations['getSubjects'](_0x5ae93c[_0xb4c6('0x47')][_0xb4c6('0x4e')],_0x5ae93c['body'][_0xb4c6('0x3c')]);_0x5ae93c[_0xb4c6('0x47')][_0xb4c6('0x4f')]=integrations[_0xb4c6('0x50')](_0x5ae93c[_0xb4c6('0x47')]['channel'],_0x5ae93c[_0xb4c6('0x47')]['type']);return db[_0xb4c6('0x51')][_0xb4c6('0x46')](_0x5ae93c[_0xb4c6('0x47')],{'include':[{'model':db[_0xb4c6('0x52')],'as':_0xb4c6('0x4d')},{'model':db[_0xb4c6('0x52')],'as':_0xb4c6('0x4f')}]});}return null;})[_0xb4c6('0x24')](respondWithResult(_0x3798a3,null))[_0xb4c6('0x41')](handleError(_0x3798a3,null));};exports['getFields']=function(_0x22f8f1,_0x1dddbd,_0x2aebe2){var _0xe685c1=[{'name':'priority','label':_0xb4c6('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 _0x543715='';return db[_0xb4c6('0x44')][_0xb4c6('0x4c')]({'where':{'id':_0x22f8f1[_0xb4c6('0x43')]['id']},'attributes':['id',_0xb4c6('0x54'),_0xb4c6('0x55'),_0xb4c6('0x56'),_0xb4c6('0x57'),'consumerKey',_0xb4c6('0x58'),_0xb4c6('0x59'),_0xb4c6('0x5a')]})[_0xb4c6('0x24')](handleEntityNotFound(_0x1dddbd,null))[_0xb4c6('0x24')](function(_0x2b4e6e){if(_0x2b4e6e){_0x543715=_0x2b4e6e[_0xb4c6('0x54')];var _0x13354e=_0x543715[_0xb4c6('0x5b')](-0x1);if(_0x13354e==='/'){_0x543715=_0x543715[_0xb4c6('0x5c')](0x0,_0x543715[_0xb4c6('0x5d')](_0x13354e));}var _0x3b87a6={'method':'GET','uri':util[_0xb4c6('0x5e')]('%s/custom_fields',_0x543715),'headers':{'Content-Type':_0xb4c6('0x5f'),'Accept':_0xb4c6('0x5f')},'json':!![]};if(_0x2b4e6e[_0xb4c6('0x55')]===_0xb4c6('0x60')){_0x3b87a6[_0xb4c6('0x61')][_0xb4c6('0x62')]=util[_0xb4c6('0x5e')](_0xb4c6('0x63'),new Buffer(util[_0xb4c6('0x5e')]('%s:%s',_0x2b4e6e[_0xb4c6('0x56')],_0x2b4e6e[_0xb4c6('0x57')]))[_0xb4c6('0x64')](_0xb4c6('0x65')));}return rp(_0x3b87a6)['then'](function(_0x416c04){return _0xe685c1[_0xb4c6('0x66')](_[_0xb4c6('0x2a')](_0x416c04[_0xb4c6('0x67')]['entries'],function(_0x16a73f){return{'id':_0x16a73f['name'],'name':_0x16a73f[_0xb4c6('0x28')],'type':_0x16a73f[_0xb4c6('0x3c')],'active':_0x16a73f[_0xb4c6('0x68')],'label':_0x16a73f['label'],'custom':!![]};}));});}})[_0xb4c6('0x24')](function(_0xda5117){return{'count':_0xda5117[_0xb4c6('0x34')],'rows':_0xda5117};})[_0xb4c6('0x24')](respondWithResult(_0x1dddbd,null))[_0xb4c6('0x41')](function(_0x4b9827){var _0x49fa49=_0x22f8f1[_0xb4c6('0x2d')][_0xb4c6('0x69')]?0x1f4:_0x4b9827[_0xb4c6('0x6a')]||0x1f4;logger[_0xb4c6('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xb4c6('0x6b'),_0x49fa49,JSON[_0xb4c6('0x6c')](_0x4b9827));delete _0x4b9827['name'];if(_0x49fa49===0x191){_0x49fa49=0x190;}_0x1dddbd[_0xb4c6('0x19')](_0x49fa49)[_0xb4c6('0x6d')](_0x22f8f1[_0xb4c6('0x2d')][_0xb4c6('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x4b9827['statusCode']}:_0x4b9827);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index ce8cf2b..4b16ae8 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 _0x3097=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash'];(function(_0x183b97,_0x2d297c){var _0x629cf7=function(_0x4ffd24){while(--_0x4ffd24){_0x183b97['push'](_0x183b97['shift']());}};_0x629cf7(++_0x2d297c);}(_0x3097,0x1ed));var _0x7309=function(_0x5bc0f6,_0x372a6b){_0x5bc0f6=_0x5bc0f6-0x0;var _0x50ef27=_0x3097[_0x5bc0f6];return _0x50ef27;};'use strict';var _=require(_0x7309('0x0'));var util=require('util');var logger=require(_0x7309('0x1'))(_0x7309('0x2'));var moment=require('moment');var BPromise=require(_0x7309('0x3'));var rp=require(_0x7309('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7309('0x5'));var config=require(_0x7309('0x6'));var attributes=require(_0x7309('0x7'));var integrations=require(_0x7309('0x8'));module[_0x7309('0x9')]=function(_0x5d0539,_0xb12c2e){return _0x5d0539[_0x7309('0xa')](_0x7309('0xb'),attributes,{'tableName':_0x7309('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7aa1=['bluebird','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','lodash','util','../../config/logger','api'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x7aa1,0x104));var _0x17aa=function(_0x4c69d9,_0x4c0df0){_0x4c69d9=_0x4c69d9-0x0;var _0x52f8eb=_0x7aa1[_0x4c69d9];return _0x52f8eb;};'use strict';var _=require(_0x17aa('0x0'));var util=require(_0x17aa('0x1'));var logger=require(_0x17aa('0x2'))(_0x17aa('0x3'));var moment=require('moment');var BPromise=require(_0x17aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17aa('0x5'));var rimraf=require('rimraf');var config=require(_0x17aa('0x6'));var attributes=require(_0x17aa('0x7'));var integrations=require(_0x17aa('0x8'));module['exports']=function(_0x272ffc,_0x2b0027){return _0x272ffc[_0x17aa('0x9')]('DeskAccount',attributes,{'tableName':_0x17aa('0xa'),'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 054f1c0..8c9e24d 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 _0xf9fe=['catch','GetDeskAccount','DeskAccount','options','raw','where','limit','include','map','attributes','model','ShowDeskAccount','find','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x1eb5e9,_0x236491){var _0xf405cf=function(_0x14b486){while(--_0x14b486){_0x1eb5e9['push'](_0x1eb5e9['shift']());}};_0xf405cf(++_0x236491);}(_0xf9fe,0xc7));var _0xef9f=function(_0x395693,_0x4325ba){_0x395693=_0x395693-0x0;var _0x363b0b=_0xf9fe[_0x395693];return _0x363b0b;};'use strict';var _=require('lodash');var util=require(_0xef9f('0x0'));var moment=require('moment');var BPromise=require(_0xef9f('0x1'));var rs=require(_0xef9f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xef9f('0x3'));var logger=require(_0xef9f('0x4'))('rpc');var config=require(_0xef9f('0x5'));var jayson=require(_0xef9f('0x6'));var client=jayson[_0xef9f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4af4d5,_0x1ae61e,_0x2985bb){return new BPromise(function(_0x527862,_0x1f4d51){return client[_0xef9f('0x8')](_0x4af4d5,_0x2985bb)[_0xef9f('0x9')](function(_0x191702){logger['info'](_0xef9f('0xa'),_0x1ae61e,_0xef9f('0xb'));logger[_0xef9f('0xc')](_0xef9f('0xd'),_0x1ae61e,_0xef9f('0xb'),JSON[_0xef9f('0xe')](_0x191702));if(_0x191702['error']){if(_0x191702['error']['code']===0x1f4){logger[_0xef9f('0xf')](_0xef9f('0xa'),_0x1ae61e,_0x191702['error'][_0xef9f('0x10')]);return _0x1f4d51(_0x191702['error']['message']);}logger['error'](_0xef9f('0xa'),_0x1ae61e,_0x191702[_0xef9f('0xf')][_0xef9f('0x10')]);return _0x527862(_0x191702['error'][_0xef9f('0x10')]);}else{logger[_0xef9f('0x11')](_0xef9f('0xa'),_0x1ae61e,_0xef9f('0xb'));_0x527862(_0x191702['result']['message']);}})[_0xef9f('0x12')](function(_0x2c86a2){logger[_0xef9f('0xf')]('DeskAccount,\x20%s,\x20%s',_0x1ae61e,_0x2c86a2);_0x1f4d51(_0x2c86a2);});});}exports[_0xef9f('0x13')]=function(_0x4680a7){var _0x4a3631=this;return new Promise(function(_0x20f1cc,_0x5368d1){return db[_0xef9f('0x14')]['findAll']({'raw':_0x4680a7[_0xef9f('0x15')]?_0x4680a7['options'][_0xef9f('0x16')]===undefined?!![]:![]:!![],'where':_0x4680a7[_0xef9f('0x15')]?_0x4680a7[_0xef9f('0x15')][_0xef9f('0x17')]||null:null,'attributes':_0x4680a7[_0xef9f('0x15')]?_0x4680a7[_0xef9f('0x15')]['attributes']||null:null,'limit':_0x4680a7['options']?_0x4680a7[_0xef9f('0x15')][_0xef9f('0x18')]||null:null,'include':_0x4680a7[_0xef9f('0x15')]?_0x4680a7[_0xef9f('0x15')][_0xef9f('0x19')]?_[_0xef9f('0x1a')](_0x4680a7[_0xef9f('0x15')][_0xef9f('0x19')],function(_0x5bc169){return{'model':db[_0x5bc169['model']],'as':_0x5bc169['as'],'attributes':_0x5bc169[_0xef9f('0x1b')],'include':_0x5bc169[_0xef9f('0x19')]?_[_0xef9f('0x1a')](_0x5bc169[_0xef9f('0x19')],function(_0x11d8a7){return{'model':db[_0x11d8a7[_0xef9f('0x1c')]],'as':_0x11d8a7['as'],'attributes':_0x11d8a7[_0xef9f('0x1b')],'include':_0x11d8a7[_0xef9f('0x19')]?_[_0xef9f('0x1a')](_0x11d8a7['include'],function(_0x583df0){return{'model':db[_0x583df0['model']],'as':_0x583df0['as'],'attributes':_0x583df0['attributes']};}):[]};}):[]};}):[]:[]})[_0xef9f('0x9')](function(_0x50ea74){logger[_0xef9f('0x11')](_0xef9f('0x13'),_0x4680a7);logger[_0xef9f('0xc')](_0xef9f('0x13'),_0x4680a7,JSON['stringify'](_0x50ea74));_0x20f1cc(_0x50ea74);})[_0xef9f('0x12')](function(_0x8585af){logger[_0xef9f('0xf')](_0xef9f('0x13'),_0x8585af[_0xef9f('0x10')],_0x4680a7);_0x5368d1(_0x4a3631[_0xef9f('0xf')](0x1f4,_0x8585af[_0xef9f('0x10')]));});});};exports[_0xef9f('0x1d')]=function(_0x3187ef){var _0xafa71f=this;return new Promise(function(_0x5be8c4,_0x48870f){return db[_0xef9f('0x14')][_0xef9f('0x1e')]({'raw':_0x3187ef['options']?_0x3187ef['options'][_0xef9f('0x16')]===undefined?!![]:![]:!![],'where':_0x3187ef[_0xef9f('0x15')]?_0x3187ef[_0xef9f('0x15')][_0xef9f('0x17')]||null:null,'attributes':_0x3187ef[_0xef9f('0x15')]?_0x3187ef[_0xef9f('0x15')][_0xef9f('0x1b')]||null:null,'include':_0x3187ef[_0xef9f('0x15')]?_0x3187ef[_0xef9f('0x15')]['include']?_['map'](_0x3187ef[_0xef9f('0x15')][_0xef9f('0x19')],function(_0x3ee1e4){return{'model':db[_0x3ee1e4[_0xef9f('0x1c')]],'as':_0x3ee1e4['as'],'attributes':_0x3ee1e4[_0xef9f('0x1b')],'include':_0x3ee1e4[_0xef9f('0x19')]?_['map'](_0x3ee1e4[_0xef9f('0x19')],function(_0x14c569){return{'model':db[_0x14c569['model']],'as':_0x14c569['as'],'attributes':_0x14c569[_0xef9f('0x1b')],'include':_0x14c569[_0xef9f('0x19')]?_[_0xef9f('0x1a')](_0x14c569[_0xef9f('0x19')],function(_0x4f6f15){return{'model':db[_0x4f6f15['model']],'as':_0x4f6f15['as'],'attributes':_0x4f6f15[_0xef9f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xef9f('0x9')](function(_0x51d391){logger[_0xef9f('0x11')]('ShowDeskAccount',_0x3187ef);logger[_0xef9f('0xc')](_0xef9f('0x1d'),_0x3187ef,JSON[_0xef9f('0xe')](_0x51d391));_0x5be8c4(_0x51d391);})['catch'](function(_0x4318d5){logger[_0xef9f('0xf')](_0xef9f('0x1d'),_0x4318d5['message'],_0x3187ef);_0x48870f(_0xafa71f[_0xef9f('0xf')](0x1f4,_0x4318d5[_0xef9f('0x10')]));});});}; \ No newline at end of file +var _0x6826=['message','result','catch','GetDeskAccount','DeskAccount','findAll','raw','options','where','attributes','include','map','model','ShowDeskAccount','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s'];(function(_0x3d4018,_0x391736){var _0x58c984=function(_0x38b068){while(--_0x38b068){_0x3d4018['push'](_0x3d4018['shift']());}};_0x58c984(++_0x391736);}(_0x6826,0xce));var _0x6682=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0x6826[_0x2bf888];return _0x3038d6;};'use strict';var _=require(_0x6682('0x0'));var util=require(_0x6682('0x1'));var moment=require(_0x6682('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6682('0x3'));var db=require(_0x6682('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6682('0x5'));var config=require(_0x6682('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6682('0x7')][_0x6682('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e76dc,_0x53b020,_0x4db1d8){return new BPromise(function(_0x48981c,_0x2f40bc){return client['request'](_0x1e76dc,_0x4db1d8)[_0x6682('0x9')](function(_0x162d0a){logger[_0x6682('0xa')]('DeskAccount,\x20%s,\x20%s',_0x53b020,'request\x20sent');logger[_0x6682('0xb')](_0x6682('0xc'),_0x53b020,_0x6682('0xd'),JSON[_0x6682('0xe')](_0x162d0a));if(_0x162d0a[_0x6682('0xf')]){if(_0x162d0a[_0x6682('0xf')][_0x6682('0x10')]===0x1f4){logger[_0x6682('0xf')](_0x6682('0x11'),_0x53b020,_0x162d0a[_0x6682('0xf')][_0x6682('0x12')]);return _0x2f40bc(_0x162d0a['error'][_0x6682('0x12')]);}logger[_0x6682('0xf')](_0x6682('0x11'),_0x53b020,_0x162d0a[_0x6682('0xf')]['message']);return _0x48981c(_0x162d0a[_0x6682('0xf')]['message']);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x53b020,'request\x20sent');_0x48981c(_0x162d0a[_0x6682('0x13')]['message']);}})[_0x6682('0x14')](function(_0x16868e){logger[_0x6682('0xf')](_0x6682('0x11'),_0x53b020,_0x16868e);_0x2f40bc(_0x16868e);});});}exports[_0x6682('0x15')]=function(_0x401707){var _0x5eaf8a=this;return new Promise(function(_0x5b37c8,_0x5a2d5a){return db[_0x6682('0x16')][_0x6682('0x17')]({'raw':_0x401707['options']?_0x401707['options'][_0x6682('0x18')]===undefined?!![]:![]:!![],'where':_0x401707[_0x6682('0x19')]?_0x401707[_0x6682('0x19')][_0x6682('0x1a')]||null:null,'attributes':_0x401707[_0x6682('0x19')]?_0x401707[_0x6682('0x19')][_0x6682('0x1b')]||null:null,'limit':_0x401707[_0x6682('0x19')]?_0x401707[_0x6682('0x19')]['limit']||null:null,'include':_0x401707[_0x6682('0x19')]?_0x401707['options'][_0x6682('0x1c')]?_[_0x6682('0x1d')](_0x401707[_0x6682('0x19')][_0x6682('0x1c')],function(_0x1f1d04){return{'model':db[_0x1f1d04[_0x6682('0x1e')]],'as':_0x1f1d04['as'],'attributes':_0x1f1d04['attributes'],'include':_0x1f1d04[_0x6682('0x1c')]?_[_0x6682('0x1d')](_0x1f1d04[_0x6682('0x1c')],function(_0x3b958f){return{'model':db[_0x3b958f[_0x6682('0x1e')]],'as':_0x3b958f['as'],'attributes':_0x3b958f[_0x6682('0x1b')],'include':_0x3b958f[_0x6682('0x1c')]?_['map'](_0x3b958f[_0x6682('0x1c')],function(_0x31ff80){return{'model':db[_0x31ff80['model']],'as':_0x31ff80['as'],'attributes':_0x31ff80['attributes']};}):[]};}):[]};}):[]:[]})[_0x6682('0x9')](function(_0x1ddbe5){logger['info']('GetDeskAccount',_0x401707);logger[_0x6682('0xb')](_0x6682('0x15'),_0x401707,JSON[_0x6682('0xe')](_0x1ddbe5));_0x5b37c8(_0x1ddbe5);})[_0x6682('0x14')](function(_0x109af8){logger[_0x6682('0xf')]('GetDeskAccount',_0x109af8[_0x6682('0x12')],_0x401707);_0x5a2d5a(_0x5eaf8a['error'](0x1f4,_0x109af8[_0x6682('0x12')]));});});};exports['ShowDeskAccount']=function(_0x304a0d){var _0x1e2543=this;return new Promise(function(_0x1ac88,_0x49ff13){return db[_0x6682('0x16')]['find']({'raw':_0x304a0d[_0x6682('0x19')]?_0x304a0d[_0x6682('0x19')][_0x6682('0x18')]===undefined?!![]:![]:!![],'where':_0x304a0d[_0x6682('0x19')]?_0x304a0d[_0x6682('0x19')][_0x6682('0x1a')]||null:null,'attributes':_0x304a0d[_0x6682('0x19')]?_0x304a0d[_0x6682('0x19')][_0x6682('0x1b')]||null:null,'include':_0x304a0d[_0x6682('0x19')]?_0x304a0d['options'][_0x6682('0x1c')]?_[_0x6682('0x1d')](_0x304a0d[_0x6682('0x19')][_0x6682('0x1c')],function(_0x5c7013){return{'model':db[_0x5c7013[_0x6682('0x1e')]],'as':_0x5c7013['as'],'attributes':_0x5c7013[_0x6682('0x1b')],'include':_0x5c7013['include']?_['map'](_0x5c7013[_0x6682('0x1c')],function(_0x4f2430){return{'model':db[_0x4f2430['model']],'as':_0x4f2430['as'],'attributes':_0x4f2430[_0x6682('0x1b')],'include':_0x4f2430[_0x6682('0x1c')]?_['map'](_0x4f2430[_0x6682('0x1c')],function(_0x2a361f){return{'model':db[_0x2a361f[_0x6682('0x1e')]],'as':_0x2a361f['as'],'attributes':_0x2a361f[_0x6682('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6682('0x9')](function(_0x361a5c){logger[_0x6682('0xa')](_0x6682('0x1f'),_0x304a0d);logger[_0x6682('0xb')](_0x6682('0x1f'),_0x304a0d,JSON[_0x6682('0xe')](_0x361a5c));_0x1ac88(_0x361a5c);})[_0x6682('0x14')](function(_0xcd04ee){logger[_0x6682('0xf')](_0x6682('0x1f'),_0xcd04ee['message'],_0x304a0d);_0x49ff13(_0x1e2543[_0x6682('0xf')](0x1f4,_0xcd04ee['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 8f0c6d7..6d19744 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 _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x1d6322,_0x4e720e){var _0x150498=function(_0x3fe969){while(--_0x3fe969){_0x1d6322['push'](_0x1d6322['shift']());}};_0x150498(++_0x4e720e);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x5805d7,_0x3d584a){var _0x170fe4=function(_0x3b9b73){while(--_0x3b9b73){_0x5805d7['push'](_0x5805d7['shift']());}};_0x170fe4(++_0x3d584a);}(_0x55ca,0x126));var _0xa55c=function(_0x5566b7,_0x4e9e2c){_0x5566b7=_0x5566b7-0x0;var _0x1c7ea7=_0x55ca[_0x5566b7];return _0x1c7ea7;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 01381ad..560eeb5 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 _0x9642=['sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9642,0x138));var _0x2964=function(_0x2a5e80,_0x1fc07e){_0x2a5e80=_0x2a5e80-0x0;var _0x3f1584=_0x9642[_0x2a5e80];return _0x3f1584;};'use strict';var Sequelize=require(_0x2964('0x0'));module[_0x2964('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcfbc=['STRING'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xcfbc,0xc1));var _0xccfb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcfbc[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xccfb('0x0')]},'description':{'type':Sequelize[_0xccfb('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index d86a137..4b738ab 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 _0x202e=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','DeskConfiguration','includeAll','include','findAll','show','params','find','create','catch','getFields','findOne','pick','getSubjects','DeskField','getDescriptions','getTags','Tag','options','setTags','body','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x54f64e,_0x618269){var _0x27722f=function(_0x45aa24){while(--_0x45aa24){_0x54f64e['push'](_0x54f64e['shift']());}};_0x27722f(++_0x618269);}(_0x202e,0x18a));var _0xe202=function(_0x69017c,_0x11ee94){_0x69017c=_0x69017c-0x0;var _0x157143=_0x202e[_0x69017c];return _0x157143;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe202('0x0'));var zipdir=require(_0xe202('0x1'));var jsonpatch=require(_0xe202('0x2'));var rp=require(_0xe202('0x3'));var moment=require(_0xe202('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe202('0x5'));var path=require('path');var sox=require(_0xe202('0x6'));var csv=require(_0xe202('0x7'));var ejs=require(_0xe202('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe202('0x9'));var squel=require(_0xe202('0xa'));var crypto=require(_0xe202('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe202('0xc'));var toCsv=require(_0xe202('0x7'));var querystring=require(_0xe202('0xd'));var Papa=require(_0xe202('0xe'));var Redis=require('ioredis');var authService=require(_0xe202('0xf'));var qs=require(_0xe202('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe202('0x11'))(_0xe202('0x12'));var utils=require(_0xe202('0x13'));var config=require(_0xe202('0x14'));var licenseUtil=require(_0xe202('0x15'));var db=require(_0xe202('0x16'))['db'];function respondWithStatusCode(_0x47e700,_0x32eac3){_0x32eac3=_0x32eac3||0xcc;return function(_0x48436f){if(_0x48436f){return _0x47e700[_0xe202('0x17')](_0x32eac3);}return _0x47e700['status'](_0x32eac3)[_0xe202('0x18')]();};}function respondWithResult(_0x9d56d9,_0x16080d){_0x16080d=_0x16080d||0xc8;return function(_0x433fe2){if(_0x433fe2){return _0x9d56d9[_0xe202('0x19')](_0x16080d)[_0xe202('0x1a')](_0x433fe2);}};}function respondWithFilteredResult(_0x1f6caf,_0x33b2a4){return function(_0x387720){if(_0x387720){var _0x1d4142=typeof _0x33b2a4[_0xe202('0x1b')]===_0xe202('0x1c')&&typeof _0x33b2a4['limit']==='undefined';var _0xbb32b2=_0x387720['count'];var _0x1d3f33=_0x1d4142?0x0:_0x33b2a4[_0xe202('0x1b')];var _0x4c0a3f=_0x1d4142?_0x387720[_0xe202('0x1d')]:_0x33b2a4['offset']+_0x33b2a4[_0xe202('0x1e')];var _0x476a15;if(_0x4c0a3f>=_0xbb32b2){_0x4c0a3f=_0xbb32b2;_0x476a15=0xc8;}else{_0x476a15=0xce;}_0x1f6caf[_0xe202('0x19')](_0x476a15);return _0x1f6caf[_0xe202('0x1f')](_0xe202('0x20'),_0x1d3f33+'-'+_0x4c0a3f+'/'+_0xbb32b2)[_0xe202('0x1a')](_0x387720);}return null;};}function patchUpdates(_0x29f50c){return function(_0x682584){try{jsonpatch[_0xe202('0x21')](_0x682584,_0x29f50c,!![]);}catch(_0x3cc9f7){return BPromise['reject'](_0x3cc9f7);}return _0x682584[_0xe202('0x22')]();};}function saveUpdates(_0x4c50d8,_0x350977){return function(_0x51c8d8){if(_0x51c8d8){return _0x51c8d8[_0xe202('0x23')](_0x4c50d8)['then'](function(_0x5096cd){return _0x5096cd;});}return null;};}function removeEntity(_0x5ccb51,_0x4f19cc){return function(_0x56cfa8){if(_0x56cfa8){return _0x56cfa8[_0xe202('0x24')]()[_0xe202('0x25')](function(){_0x5ccb51[_0xe202('0x19')](0xcc)[_0xe202('0x18')]();});}};}function handleEntityNotFound(_0x31cdd0,_0x3922e5){return function(_0x4e5a3c){if(!_0x4e5a3c){_0x31cdd0[_0xe202('0x17')](0x194);}return _0x4e5a3c;};}function handleError(_0x3fd0c7,_0x3fdfe5){_0x3fdfe5=_0x3fdfe5||0x1f4;return function(_0x1b4811){logger[_0xe202('0x26')](_0x1b4811[_0xe202('0x27')]);if(_0x1b4811[_0xe202('0x28')]){delete _0x1b4811[_0xe202('0x28')];}_0x3fd0c7[_0xe202('0x19')](_0x3fdfe5)['send'](_0x1b4811);};}exports[_0xe202('0x29')]=function(_0x34ebd5,_0x294bd2){var _0x28685a={},_0x544de4={},_0x1fd5c0={'count':0x0,'rows':[]};var _0x575125=_['map'](db['DeskConfiguration'][_0xe202('0x2a')],function(_0x2ae37e){return{'name':_0x2ae37e[_0xe202('0x2b')],'type':_0x2ae37e[_0xe202('0x2c')]['key']};});_0x544de4[_0xe202('0x2d')]=_[_0xe202('0x2e')](_0x575125,_0xe202('0x28'));_0x544de4[_0xe202('0x2f')]=_[_0xe202('0x30')](_0x34ebd5[_0xe202('0x2f')]);_0x544de4[_0xe202('0x31')]=_['intersection'](_0x544de4[_0xe202('0x2d')],_0x544de4[_0xe202('0x2f')]);_0x28685a[_0xe202('0x32')]=_[_0xe202('0x33')](_0x544de4[_0xe202('0x2d')],qs[_0xe202('0x34')](_0x34ebd5['query'][_0xe202('0x34')]));_0x28685a[_0xe202('0x32')]=_0x28685a[_0xe202('0x32')][_0xe202('0x35')]?_0x28685a[_0xe202('0x32')]:_0x544de4['model'];if(!_0x34ebd5['query'][_0xe202('0x36')](_0xe202('0x37'))){_0x28685a[_0xe202('0x1e')]=qs[_0xe202('0x1e')](_0x34ebd5['query'][_0xe202('0x1e')]);_0x28685a[_0xe202('0x1b')]=qs['offset'](_0x34ebd5['query'][_0xe202('0x1b')]);}_0x28685a[_0xe202('0x38')]=qs[_0xe202('0x39')](_0x34ebd5[_0xe202('0x2f')][_0xe202('0x39')]);_0x28685a[_0xe202('0x3a')]=qs[_0xe202('0x31')](_['pick'](_0x34ebd5[_0xe202('0x2f')],_0x544de4['filters']),_0x575125);if(_0x34ebd5['query']['filter']){_0x28685a[_0xe202('0x3a')]=_[_0xe202('0x3b')](_0x28685a[_0xe202('0x3a')],{'$or':_[_0xe202('0x2e')](_0x575125,function(_0x543d16){if(_0x543d16['type']!==_0xe202('0x3c')){var _0x322678={};_0x322678[_0x543d16[_0xe202('0x28')]]={'$like':'%'+_0x34ebd5['query'][_0xe202('0x3d')]+'%'};return _0x322678;}})});}_0x28685a=_[_0xe202('0x3b')]({},_0x28685a,_0x34ebd5['options']);var _0x16c390={'where':_0x28685a[_0xe202('0x3a')]};return db[_0xe202('0x3e')][_0xe202('0x1d')](_0x16c390)[_0xe202('0x25')](function(_0x5f5394){_0x1fd5c0['count']=_0x5f5394;if(_0x34ebd5['query'][_0xe202('0x3f')]){_0x28685a[_0xe202('0x40')]=[{'all':!![]}];}return db[_0xe202('0x3e')][_0xe202('0x41')](_0x28685a);})[_0xe202('0x25')](function(_0x599169){_0x1fd5c0['rows']=_0x599169;return _0x1fd5c0;})[_0xe202('0x25')](respondWithFilteredResult(_0x294bd2,_0x28685a))['catch'](handleError(_0x294bd2,null));};exports[_0xe202('0x42')]=function(_0x646ae6,_0x156298){var _0x14b5ac={'raw':![],'where':{'id':_0x646ae6[_0xe202('0x43')]['id']}},_0x25f237={};_0x25f237[_0xe202('0x2d')]=_['keys'](db[_0xe202('0x3e')]['rawAttributes']);_0x25f237['query']=_[_0xe202('0x30')](_0x646ae6[_0xe202('0x2f')]);_0x25f237[_0xe202('0x31')]=_[_0xe202('0x33')](_0x25f237[_0xe202('0x2d')],_0x25f237[_0xe202('0x2f')]);_0x14b5ac[_0xe202('0x32')]=_[_0xe202('0x33')](_0x25f237[_0xe202('0x2d')],qs[_0xe202('0x34')](_0x646ae6[_0xe202('0x2f')][_0xe202('0x34')]));_0x14b5ac[_0xe202('0x32')]=_0x14b5ac[_0xe202('0x32')][_0xe202('0x35')]?_0x14b5ac['attributes']:_0x25f237[_0xe202('0x2d')];if(_0x646ae6['query'][_0xe202('0x3f')]){_0x14b5ac[_0xe202('0x40')]=[{'all':!![]}];}_0x14b5ac=_['merge']({},_0x14b5ac,_0x646ae6['options']);return db['DeskConfiguration'][_0xe202('0x44')](_0x14b5ac)[_0xe202('0x25')](handleEntityNotFound(_0x156298,null))[_0xe202('0x25')](respondWithResult(_0x156298,null))['catch'](handleError(_0x156298,null));};exports['create']=function(_0x4f47ca,_0x4519c1){return db[_0xe202('0x3e')][_0xe202('0x45')](_0x4f47ca['body'],{})[_0xe202('0x25')](respondWithResult(_0x4519c1,0xc9))['catch'](handleError(_0x4519c1,null));};exports[_0xe202('0x23')]=function(_0x3a0774,_0x3cf3de){if(_0x3a0774['body']['id']){delete _0x3a0774['body']['id'];}return db[_0xe202('0x3e')][_0xe202('0x44')]({'where':{'id':_0x3a0774[_0xe202('0x43')]['id']}})['then'](handleEntityNotFound(_0x3cf3de,null))['then'](saveUpdates(_0x3a0774['body'],null))[_0xe202('0x25')](respondWithResult(_0x3cf3de,null))[_0xe202('0x46')](handleError(_0x3cf3de,null));};exports[_0xe202('0x24')]=function(_0x36bc48,_0x305679){return db[_0xe202('0x3e')][_0xe202('0x44')]({'where':{'id':_0x36bc48[_0xe202('0x43')]['id']}})[_0xe202('0x25')](handleEntityNotFound(_0x305679,null))['then'](removeEntity(_0x305679,null))[_0xe202('0x46')](handleError(_0x305679,null));};exports[_0xe202('0x47')]=function(_0x30d46f,_0x5b7659,_0x557e27){var _0x94b1={};var _0x559f45={};var _0x13a5b2;var _0x38719e;return db[_0xe202('0x3e')][_0xe202('0x48')]({'where':{'id':_0x30d46f[_0xe202('0x43')]['id']}})[_0xe202('0x25')](handleEntityNotFound(_0x5b7659,null))[_0xe202('0x25')](function(_0x3966f8){if(_0x3966f8){_0x13a5b2=_0x3966f8;_0x559f45[_0xe202('0x2d')]=_['keys'](db['DeskField'][_0xe202('0x2a')]);_0x559f45[_0xe202('0x2f')]=_[_0xe202('0x30')](_0x30d46f[_0xe202('0x2f')]);_0x559f45[_0xe202('0x31')]=_[_0xe202('0x33')](_0x559f45[_0xe202('0x2d')],_0x559f45[_0xe202('0x2f')]);_0x94b1['attributes']=_['intersection'](_0x559f45[_0xe202('0x2d')],qs[_0xe202('0x34')](_0x30d46f[_0xe202('0x2f')][_0xe202('0x34')]));_0x94b1['attributes']=_0x94b1[_0xe202('0x32')][_0xe202('0x35')]?_0x94b1[_0xe202('0x32')]:_0x559f45[_0xe202('0x2d')];_0x94b1['order']=qs[_0xe202('0x39')](_0x30d46f[_0xe202('0x2f')]['sort']);_0x94b1[_0xe202('0x3a')]=qs[_0xe202('0x31')](_[_0xe202('0x49')](_0x30d46f[_0xe202('0x2f')],_0x559f45[_0xe202('0x31')]));if(_0x30d46f[_0xe202('0x2f')][_0xe202('0x3d')]){_0x94b1[_0xe202('0x3a')]=_[_0xe202('0x3b')](_0x94b1['where'],{'$or':_['map'](_0x94b1[_0xe202('0x32')],function(_0x592216){var _0x492a08={};_0x492a08[_0x592216]={'$like':'%'+_0x30d46f[_0xe202('0x2f')]['filter']+'%'};return _0x492a08;})});}_0x94b1=_[_0xe202('0x3b')]({},_0x94b1,_0x30d46f['options']);return _0x13a5b2[_0xe202('0x47')](_0x94b1);}})[_0xe202('0x25')](function(_0x4b7be3){if(_0x4b7be3){_0x38719e=_0x4b7be3[_0xe202('0x35')];if(!_0x30d46f[_0xe202('0x2f')][_0xe202('0x36')](_0xe202('0x37'))){_0x94b1[_0xe202('0x1e')]=qs[_0xe202('0x1e')](_0x30d46f[_0xe202('0x2f')][_0xe202('0x1e')]);_0x94b1[_0xe202('0x1b')]=qs[_0xe202('0x1b')](_0x30d46f[_0xe202('0x2f')][_0xe202('0x1b')]);}return _0x13a5b2[_0xe202('0x47')](_0x94b1);}})['then'](function(_0x431f8e){if(_0x431f8e){return _0x431f8e?{'count':_0x38719e,'rows':_0x431f8e}:null;}})[_0xe202('0x25')](respondWithResult(_0x5b7659,null))[_0xe202('0x46')](handleError(_0x5b7659,null));};exports[_0xe202('0x4a')]=function(_0x4903f0,_0x53c532,_0x2ff817){var _0x8164e1={};var _0x36e6fb={};var _0x31e3c1;var _0x4b4c1c;return db['DeskConfiguration'][_0xe202('0x48')]({'where':{'id':_0x4903f0[_0xe202('0x43')]['id']}})[_0xe202('0x25')](handleEntityNotFound(_0x53c532,null))['then'](function(_0x300328){if(_0x300328){_0x31e3c1=_0x300328;_0x36e6fb[_0xe202('0x2d')]=_[_0xe202('0x30')](db[_0xe202('0x4b')][_0xe202('0x2a')]);_0x36e6fb['query']=_[_0xe202('0x30')](_0x4903f0[_0xe202('0x2f')]);_0x36e6fb[_0xe202('0x31')]=_[_0xe202('0x33')](_0x36e6fb[_0xe202('0x2d')],_0x36e6fb[_0xe202('0x2f')]);_0x8164e1['attributes']=_['intersection'](_0x36e6fb[_0xe202('0x2d')],qs[_0xe202('0x34')](_0x4903f0['query'][_0xe202('0x34')]));_0x8164e1[_0xe202('0x32')]=_0x8164e1['attributes']['length']?_0x8164e1['attributes']:_0x36e6fb[_0xe202('0x2d')];_0x8164e1[_0xe202('0x38')]=qs['sort'](_0x4903f0[_0xe202('0x2f')][_0xe202('0x39')]);_0x8164e1[_0xe202('0x3a')]=qs[_0xe202('0x31')](_['pick'](_0x4903f0[_0xe202('0x2f')],_0x36e6fb[_0xe202('0x31')]));if(_0x4903f0[_0xe202('0x2f')][_0xe202('0x3d')]){_0x8164e1[_0xe202('0x3a')]=_[_0xe202('0x3b')](_0x8164e1['where'],{'$or':_[_0xe202('0x2e')](_0x8164e1[_0xe202('0x32')],function(_0x237f16){var _0xc11bb5={};_0xc11bb5[_0x237f16]={'$like':'%'+_0x4903f0[_0xe202('0x2f')]['filter']+'%'};return _0xc11bb5;})});}_0x8164e1=_['merge']({},_0x8164e1,_0x4903f0['options']);return _0x31e3c1['getSubjects'](_0x8164e1);}})[_0xe202('0x25')](function(_0x50a6ba){if(_0x50a6ba){_0x4b4c1c=_0x50a6ba['length'];if(!_0x4903f0[_0xe202('0x2f')][_0xe202('0x36')]('nolimit')){_0x8164e1[_0xe202('0x1e')]=qs['limit'](_0x4903f0[_0xe202('0x2f')]['limit']);_0x8164e1[_0xe202('0x1b')]=qs[_0xe202('0x1b')](_0x4903f0['query'][_0xe202('0x1b')]);}return _0x31e3c1[_0xe202('0x4a')](_0x8164e1);}})[_0xe202('0x25')](function(_0x39f6b8){if(_0x39f6b8){return _0x39f6b8?{'count':_0x4b4c1c,'rows':_0x39f6b8}:null;}})[_0xe202('0x25')](respondWithResult(_0x53c532,null))['catch'](handleError(_0x53c532,null));};exports[_0xe202('0x4c')]=function(_0x3a015a,_0xaddd9c,_0x33609a){var _0x4799a1={};var _0x1c87d6={};var _0x3cdd78;var _0x2c2ee0;return db[_0xe202('0x3e')][_0xe202('0x48')]({'where':{'id':_0x3a015a[_0xe202('0x43')]['id']}})[_0xe202('0x25')](handleEntityNotFound(_0xaddd9c,null))[_0xe202('0x25')](function(_0x575e6d){if(_0x575e6d){_0x3cdd78=_0x575e6d;_0x1c87d6[_0xe202('0x2d')]=_[_0xe202('0x30')](db[_0xe202('0x4b')]['rawAttributes']);_0x1c87d6[_0xe202('0x2f')]=_['keys'](_0x3a015a[_0xe202('0x2f')]);_0x1c87d6[_0xe202('0x31')]=_['intersection'](_0x1c87d6[_0xe202('0x2d')],_0x1c87d6['query']);_0x4799a1[_0xe202('0x32')]=_[_0xe202('0x33')](_0x1c87d6[_0xe202('0x2d')],qs[_0xe202('0x34')](_0x3a015a[_0xe202('0x2f')]['fields']));_0x4799a1[_0xe202('0x32')]=_0x4799a1[_0xe202('0x32')][_0xe202('0x35')]?_0x4799a1[_0xe202('0x32')]:_0x1c87d6['model'];_0x4799a1[_0xe202('0x38')]=qs[_0xe202('0x39')](_0x3a015a[_0xe202('0x2f')]['sort']);_0x4799a1[_0xe202('0x3a')]=qs[_0xe202('0x31')](_[_0xe202('0x49')](_0x3a015a[_0xe202('0x2f')],_0x1c87d6[_0xe202('0x31')]));if(_0x3a015a[_0xe202('0x2f')][_0xe202('0x3d')]){_0x4799a1[_0xe202('0x3a')]=_[_0xe202('0x3b')](_0x4799a1[_0xe202('0x3a')],{'$or':_[_0xe202('0x2e')](_0x4799a1[_0xe202('0x32')],function(_0x5ab447){var _0xa04dfc={};_0xa04dfc[_0x5ab447]={'$like':'%'+_0x3a015a[_0xe202('0x2f')]['filter']+'%'};return _0xa04dfc;})});}_0x4799a1=_['merge']({},_0x4799a1,_0x3a015a['options']);return _0x3cdd78[_0xe202('0x4c')](_0x4799a1);}})[_0xe202('0x25')](function(_0x370fdf){if(_0x370fdf){_0x2c2ee0=_0x370fdf[_0xe202('0x35')];if(!_0x3a015a[_0xe202('0x2f')]['hasOwnProperty'](_0xe202('0x37'))){_0x4799a1[_0xe202('0x1e')]=qs['limit'](_0x3a015a['query'][_0xe202('0x1e')]);_0x4799a1['offset']=qs[_0xe202('0x1b')](_0x3a015a['query'][_0xe202('0x1b')]);}return _0x3cdd78[_0xe202('0x4c')](_0x4799a1);}})['then'](function(_0x5e4cad){if(_0x5e4cad){return _0x5e4cad?{'count':_0x2c2ee0,'rows':_0x5e4cad}:null;}})[_0xe202('0x25')](respondWithResult(_0xaddd9c,null))[_0xe202('0x46')](handleError(_0xaddd9c,null));};exports[_0xe202('0x4d')]=function(_0x2a6ca8,_0x346b4b,_0x45854e){var _0x4867a9={};var _0x477cfd={};var _0x1e82d0;var _0x3886df;return db[_0xe202('0x3e')][_0xe202('0x48')]({'where':{'id':_0x2a6ca8[_0xe202('0x43')]['id']}})['then'](handleEntityNotFound(_0x346b4b,null))[_0xe202('0x25')](function(_0xe3be33){if(_0xe3be33){_0x1e82d0=_0xe3be33;_0x477cfd[_0xe202('0x2d')]=_['keys'](db[_0xe202('0x4e')]['rawAttributes']);_0x477cfd[_0xe202('0x2f')]=_['keys'](_0x2a6ca8['query']);_0x477cfd[_0xe202('0x31')]=_['intersection'](_0x477cfd['model'],_0x477cfd[_0xe202('0x2f')]);_0x4867a9[_0xe202('0x32')]=_[_0xe202('0x33')](_0x477cfd['model'],qs[_0xe202('0x34')](_0x2a6ca8[_0xe202('0x2f')][_0xe202('0x34')]));_0x4867a9[_0xe202('0x32')]=_0x4867a9[_0xe202('0x32')][_0xe202('0x35')]?_0x4867a9[_0xe202('0x32')]:_0x477cfd[_0xe202('0x2d')];_0x4867a9[_0xe202('0x38')]=qs[_0xe202('0x39')](_0x2a6ca8[_0xe202('0x2f')][_0xe202('0x39')]);_0x4867a9[_0xe202('0x3a')]=qs[_0xe202('0x31')](_['pick'](_0x2a6ca8['query'],_0x477cfd[_0xe202('0x31')]));if(_0x2a6ca8[_0xe202('0x2f')]['filter']){_0x4867a9[_0xe202('0x3a')]=_[_0xe202('0x3b')](_0x4867a9[_0xe202('0x3a')],{'$or':_[_0xe202('0x2e')](_0x4867a9['attributes'],function(_0x21f804){var _0x556c5f={};_0x556c5f[_0x21f804]={'$like':'%'+_0x2a6ca8[_0xe202('0x2f')][_0xe202('0x3d')]+'%'};return _0x556c5f;})});}_0x4867a9=_['merge']({},_0x4867a9,_0x2a6ca8[_0xe202('0x4f')]);return _0x1e82d0['getTags'](_0x4867a9);}})[_0xe202('0x25')](function(_0x163059){if(_0x163059){_0x3886df=_0x163059['length'];if(!_0x2a6ca8[_0xe202('0x2f')]['hasOwnProperty'](_0xe202('0x37'))){_0x4867a9[_0xe202('0x1e')]=qs[_0xe202('0x1e')](_0x2a6ca8[_0xe202('0x2f')][_0xe202('0x1e')]);_0x4867a9[_0xe202('0x1b')]=qs[_0xe202('0x1b')](_0x2a6ca8[_0xe202('0x2f')]['offset']);}return _0x1e82d0[_0xe202('0x4d')](_0x4867a9);}})[_0xe202('0x25')](function(_0x357d37){if(_0x357d37){return _0x357d37?{'count':_0x3886df,'rows':_0x357d37}:null;}})['then'](respondWithResult(_0x346b4b,null))[_0xe202('0x46')](handleError(_0x346b4b,null));};exports[_0xe202('0x50')]=function(_0x4be513,_0x5b220e,_0x195fd7){if(_0x4be513[_0xe202('0x51')]['id']){delete _0x4be513[_0xe202('0x51')]['id'];}return db[_0xe202('0x3e')][_0xe202('0x48')]({'where':{'id':_0x4be513['params']['id']}})['then'](handleEntityNotFound(_0x5b220e,null))['then'](function(_0x13a4ef){if(_0x13a4ef){return _0x13a4ef[_0xe202('0x50')](_0x4be513[_0xe202('0x51')][_0xe202('0x52')]||[]);}return null;})[_0xe202('0x25')](respondWithResult(_0x5b220e,null))['catch'](handleError(_0x5b220e,null));}; \ No newline at end of file +var _0x5d5a=['find','create','body','update','params','getFields','findOne','DeskField','hasOwnProperty','getSubjects','getDescriptions','order','getTags','setTags','ids','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','findAll','catch','show','include'];(function(_0x19d8b8,_0x398f75){var _0x2ade7c=function(_0x5a268d){while(--_0x5a268d){_0x19d8b8['push'](_0x19d8b8['shift']());}};_0x2ade7c(++_0x398f75);}(_0x5d5a,0x15b));var _0xa5d5=function(_0x40f041,_0x4e355f){_0x40f041=_0x40f041-0x0;var _0x323789=_0x5d5a[_0x40f041];return _0x323789;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5d5('0x0'));var zipdir=require(_0xa5d5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa5d5('0x2'));var BPromise=require(_0xa5d5('0x3'));var Mustache=require(_0xa5d5('0x4'));var util=require(_0xa5d5('0x5'));var path=require(_0xa5d5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa5d5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5d5('0x8'));var squel=require(_0xa5d5('0x9'));var crypto=require(_0xa5d5('0xa'));var jsforce=require(_0xa5d5('0xb'));var deskjs=require(_0xa5d5('0xc'));var toCsv=require(_0xa5d5('0xd'));var querystring=require(_0xa5d5('0xe'));var Papa=require(_0xa5d5('0xf'));var Redis=require('ioredis');var authService=require(_0xa5d5('0x10'));var qs=require(_0xa5d5('0x11'));var as=require(_0xa5d5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5d5('0x13'))(_0xa5d5('0x14'));var utils=require(_0xa5d5('0x15'));var config=require(_0xa5d5('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40d6ba,_0x1cff66){_0x1cff66=_0x1cff66||0xcc;return function(_0x4de13b){if(_0x4de13b){return _0x40d6ba[_0xa5d5('0x17')](_0x1cff66);}return _0x40d6ba[_0xa5d5('0x18')](_0x1cff66)[_0xa5d5('0x19')]();};}function respondWithResult(_0xfdaadb,_0x5de90b){_0x5de90b=_0x5de90b||0xc8;return function(_0xbead67){if(_0xbead67){return _0xfdaadb[_0xa5d5('0x18')](_0x5de90b)[_0xa5d5('0x1a')](_0xbead67);}};}function respondWithFilteredResult(_0x42fd89,_0x1e4061){return function(_0x37a9ee){if(_0x37a9ee){var _0x5af75f=typeof _0x1e4061['offset']===_0xa5d5('0x1b')&&typeof _0x1e4061[_0xa5d5('0x1c')]===_0xa5d5('0x1b');var _0x74e19c=_0x37a9ee[_0xa5d5('0x1d')];var _0x4edf88=_0x5af75f?0x0:_0x1e4061[_0xa5d5('0x1e')];var _0x25c7c7=_0x5af75f?_0x37a9ee[_0xa5d5('0x1d')]:_0x1e4061[_0xa5d5('0x1e')]+_0x1e4061[_0xa5d5('0x1c')];var _0x69d296;if(_0x25c7c7>=_0x74e19c){_0x25c7c7=_0x74e19c;_0x69d296=0xc8;}else{_0x69d296=0xce;}_0x42fd89[_0xa5d5('0x18')](_0x69d296);return _0x42fd89[_0xa5d5('0x1f')](_0xa5d5('0x20'),_0x4edf88+'-'+_0x25c7c7+'/'+_0x74e19c)[_0xa5d5('0x1a')](_0x37a9ee);}return null;};}function patchUpdates(_0x28f2cd){return function(_0x4a5779){try{jsonpatch[_0xa5d5('0x21')](_0x4a5779,_0x28f2cd,!![]);}catch(_0x104c9a){return BPromise[_0xa5d5('0x22')](_0x104c9a);}return _0x4a5779[_0xa5d5('0x23')]();};}function saveUpdates(_0x300aa0,_0x251fce){return function(_0x3df39e){if(_0x3df39e){return _0x3df39e['update'](_0x300aa0)[_0xa5d5('0x24')](function(_0x24d243){return _0x24d243;});}return null;};}function removeEntity(_0x3f4078,_0x3b680d){return function(_0x19955a){if(_0x19955a){return _0x19955a['destroy']()['then'](function(){_0x3f4078[_0xa5d5('0x18')](0xcc)[_0xa5d5('0x19')]();});}};}function handleEntityNotFound(_0x42dc09,_0x11f33f){return function(_0x139c1d){if(!_0x139c1d){_0x42dc09['sendStatus'](0x194);}return _0x139c1d;};}function handleError(_0x4fe371,_0x1dde7f){_0x1dde7f=_0x1dde7f||0x1f4;return function(_0x31691a){logger[_0xa5d5('0x25')](_0x31691a[_0xa5d5('0x26')]);if(_0x31691a[_0xa5d5('0x27')]){delete _0x31691a[_0xa5d5('0x27')];}_0x4fe371[_0xa5d5('0x18')](_0x1dde7f)['send'](_0x31691a);};}exports[_0xa5d5('0x28')]=function(_0x415ce2,_0x1507c3){var _0x4810d0={},_0x4e1864={},_0x26d51d={'count':0x0,'rows':[]};var _0x47c0d7=_[_0xa5d5('0x29')](db['DeskConfiguration'][_0xa5d5('0x2a')],function(_0x1973be){return{'name':_0x1973be[_0xa5d5('0x2b')],'type':_0x1973be[_0xa5d5('0x2c')][_0xa5d5('0x2d')]};});_0x4e1864[_0xa5d5('0x2e')]=_[_0xa5d5('0x29')](_0x47c0d7,_0xa5d5('0x27'));_0x4e1864[_0xa5d5('0x2f')]=_[_0xa5d5('0x30')](_0x415ce2[_0xa5d5('0x2f')]);_0x4e1864['filters']=_[_0xa5d5('0x31')](_0x4e1864['model'],_0x4e1864['query']);_0x4810d0[_0xa5d5('0x32')]=_[_0xa5d5('0x31')](_0x4e1864[_0xa5d5('0x2e')],qs['fields'](_0x415ce2[_0xa5d5('0x2f')][_0xa5d5('0x33')]));_0x4810d0['attributes']=_0x4810d0[_0xa5d5('0x32')][_0xa5d5('0x34')]?_0x4810d0[_0xa5d5('0x32')]:_0x4e1864[_0xa5d5('0x2e')];if(!_0x415ce2[_0xa5d5('0x2f')]['hasOwnProperty'](_0xa5d5('0x35'))){_0x4810d0[_0xa5d5('0x1c')]=qs[_0xa5d5('0x1c')](_0x415ce2[_0xa5d5('0x2f')][_0xa5d5('0x1c')]);_0x4810d0['offset']=qs['offset'](_0x415ce2[_0xa5d5('0x2f')]['offset']);}_0x4810d0['order']=qs[_0xa5d5('0x36')](_0x415ce2[_0xa5d5('0x2f')][_0xa5d5('0x36')]);_0x4810d0[_0xa5d5('0x37')]=qs[_0xa5d5('0x38')](_[_0xa5d5('0x39')](_0x415ce2[_0xa5d5('0x2f')],_0x4e1864[_0xa5d5('0x38')]),_0x47c0d7);if(_0x415ce2['query'][_0xa5d5('0x3a')]){_0x4810d0['where']=_[_0xa5d5('0x3b')](_0x4810d0['where'],{'$or':_[_0xa5d5('0x29')](_0x47c0d7,function(_0x2e5c3a){if(_0x2e5c3a[_0xa5d5('0x2c')]!==_0xa5d5('0x3c')){var _0x5a4799={};_0x5a4799[_0x2e5c3a['name']]={'$like':'%'+_0x415ce2['query'][_0xa5d5('0x3a')]+'%'};return _0x5a4799;}})});}_0x4810d0=_['merge']({},_0x4810d0,_0x415ce2[_0xa5d5('0x3d')]);var _0x146847={'where':_0x4810d0['where']};return db[_0xa5d5('0x3e')][_0xa5d5('0x1d')](_0x146847)[_0xa5d5('0x24')](function(_0x6bd90e){_0x26d51d[_0xa5d5('0x1d')]=_0x6bd90e;if(_0x415ce2['query'][_0xa5d5('0x3f')]){_0x4810d0['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0xa5d5('0x40')](_0x4810d0);})['then'](function(_0x54270c){_0x26d51d['rows']=_0x54270c;return _0x26d51d;})['then'](respondWithFilteredResult(_0x1507c3,_0x4810d0))[_0xa5d5('0x41')](handleError(_0x1507c3,null));};exports[_0xa5d5('0x42')]=function(_0x3e6dbe,_0x43aab4){var _0x1023ce={'raw':![],'where':{'id':_0x3e6dbe['params']['id']}},_0x5cd345={};_0x5cd345['model']=_[_0xa5d5('0x30')](db[_0xa5d5('0x3e')][_0xa5d5('0x2a')]);_0x5cd345[_0xa5d5('0x2f')]=_['keys'](_0x3e6dbe[_0xa5d5('0x2f')]);_0x5cd345[_0xa5d5('0x38')]=_['intersection'](_0x5cd345[_0xa5d5('0x2e')],_0x5cd345[_0xa5d5('0x2f')]);_0x1023ce[_0xa5d5('0x32')]=_[_0xa5d5('0x31')](_0x5cd345[_0xa5d5('0x2e')],qs[_0xa5d5('0x33')](_0x3e6dbe[_0xa5d5('0x2f')][_0xa5d5('0x33')]));_0x1023ce[_0xa5d5('0x32')]=_0x1023ce[_0xa5d5('0x32')][_0xa5d5('0x34')]?_0x1023ce[_0xa5d5('0x32')]:_0x5cd345['model'];if(_0x3e6dbe[_0xa5d5('0x2f')][_0xa5d5('0x3f')]){_0x1023ce[_0xa5d5('0x43')]=[{'all':!![]}];}_0x1023ce=_[_0xa5d5('0x3b')]({},_0x1023ce,_0x3e6dbe[_0xa5d5('0x3d')]);return db[_0xa5d5('0x3e')][_0xa5d5('0x44')](_0x1023ce)[_0xa5d5('0x24')](handleEntityNotFound(_0x43aab4,null))[_0xa5d5('0x24')](respondWithResult(_0x43aab4,null))[_0xa5d5('0x41')](handleError(_0x43aab4,null));};exports[_0xa5d5('0x45')]=function(_0x352bd5,_0x2cb753){return db[_0xa5d5('0x3e')][_0xa5d5('0x45')](_0x352bd5[_0xa5d5('0x46')],{})[_0xa5d5('0x24')](respondWithResult(_0x2cb753,0xc9))[_0xa5d5('0x41')](handleError(_0x2cb753,null));};exports[_0xa5d5('0x47')]=function(_0x1b2b25,_0x3e85a1){if(_0x1b2b25[_0xa5d5('0x46')]['id']){delete _0x1b2b25[_0xa5d5('0x46')]['id'];}return db['DeskConfiguration'][_0xa5d5('0x44')]({'where':{'id':_0x1b2b25[_0xa5d5('0x48')]['id']}})[_0xa5d5('0x24')](handleEntityNotFound(_0x3e85a1,null))[_0xa5d5('0x24')](saveUpdates(_0x1b2b25[_0xa5d5('0x46')],null))[_0xa5d5('0x24')](respondWithResult(_0x3e85a1,null))[_0xa5d5('0x41')](handleError(_0x3e85a1,null));};exports['destroy']=function(_0x502866,_0x42acaf){return db[_0xa5d5('0x3e')][_0xa5d5('0x44')]({'where':{'id':_0x502866[_0xa5d5('0x48')]['id']}})[_0xa5d5('0x24')](handleEntityNotFound(_0x42acaf,null))[_0xa5d5('0x24')](removeEntity(_0x42acaf,null))['catch'](handleError(_0x42acaf,null));};exports[_0xa5d5('0x49')]=function(_0xc30afc,_0x3b6577,_0xff030){var _0x2c4b28={};var _0x526d78={};var _0xe25253;var _0x3abe1d;return db[_0xa5d5('0x3e')][_0xa5d5('0x4a')]({'where':{'id':_0xc30afc[_0xa5d5('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b6577,null))[_0xa5d5('0x24')](function(_0x1dd7ac){if(_0x1dd7ac){_0xe25253=_0x1dd7ac;_0x526d78['model']=_[_0xa5d5('0x30')](db[_0xa5d5('0x4b')][_0xa5d5('0x2a')]);_0x526d78[_0xa5d5('0x2f')]=_[_0xa5d5('0x30')](_0xc30afc['query']);_0x526d78[_0xa5d5('0x38')]=_['intersection'](_0x526d78[_0xa5d5('0x2e')],_0x526d78[_0xa5d5('0x2f')]);_0x2c4b28[_0xa5d5('0x32')]=_[_0xa5d5('0x31')](_0x526d78['model'],qs[_0xa5d5('0x33')](_0xc30afc['query'][_0xa5d5('0x33')]));_0x2c4b28[_0xa5d5('0x32')]=_0x2c4b28[_0xa5d5('0x32')]['length']?_0x2c4b28[_0xa5d5('0x32')]:_0x526d78[_0xa5d5('0x2e')];_0x2c4b28['order']=qs[_0xa5d5('0x36')](_0xc30afc[_0xa5d5('0x2f')][_0xa5d5('0x36')]);_0x2c4b28[_0xa5d5('0x37')]=qs[_0xa5d5('0x38')](_[_0xa5d5('0x39')](_0xc30afc['query'],_0x526d78[_0xa5d5('0x38')]));if(_0xc30afc[_0xa5d5('0x2f')][_0xa5d5('0x3a')]){_0x2c4b28[_0xa5d5('0x37')]=_[_0xa5d5('0x3b')](_0x2c4b28[_0xa5d5('0x37')],{'$or':_['map'](_0x2c4b28[_0xa5d5('0x32')],function(_0x5b13e3){var _0x416a30={};_0x416a30[_0x5b13e3]={'$like':'%'+_0xc30afc[_0xa5d5('0x2f')][_0xa5d5('0x3a')]+'%'};return _0x416a30;})});}_0x2c4b28=_[_0xa5d5('0x3b')]({},_0x2c4b28,_0xc30afc['options']);return _0xe25253[_0xa5d5('0x49')](_0x2c4b28);}})['then'](function(_0x2d9c84){if(_0x2d9c84){_0x3abe1d=_0x2d9c84['length'];if(!_0xc30afc[_0xa5d5('0x2f')][_0xa5d5('0x4c')](_0xa5d5('0x35'))){_0x2c4b28[_0xa5d5('0x1c')]=qs[_0xa5d5('0x1c')](_0xc30afc['query'][_0xa5d5('0x1c')]);_0x2c4b28[_0xa5d5('0x1e')]=qs[_0xa5d5('0x1e')](_0xc30afc[_0xa5d5('0x2f')][_0xa5d5('0x1e')]);}return _0xe25253[_0xa5d5('0x49')](_0x2c4b28);}})[_0xa5d5('0x24')](function(_0x3953a4){if(_0x3953a4){return _0x3953a4?{'count':_0x3abe1d,'rows':_0x3953a4}:null;}})[_0xa5d5('0x24')](respondWithResult(_0x3b6577,null))[_0xa5d5('0x41')](handleError(_0x3b6577,null));};exports['getSubjects']=function(_0x5b1277,_0x4ebea7,_0x2e5946){var _0x5c1020={};var _0x245420={};var _0x488a43;var _0x255480;return db[_0xa5d5('0x3e')][_0xa5d5('0x4a')]({'where':{'id':_0x5b1277[_0xa5d5('0x48')]['id']}})[_0xa5d5('0x24')](handleEntityNotFound(_0x4ebea7,null))[_0xa5d5('0x24')](function(_0x249de8){if(_0x249de8){_0x488a43=_0x249de8;_0x245420[_0xa5d5('0x2e')]=_[_0xa5d5('0x30')](db[_0xa5d5('0x4b')]['rawAttributes']);_0x245420[_0xa5d5('0x2f')]=_[_0xa5d5('0x30')](_0x5b1277[_0xa5d5('0x2f')]);_0x245420[_0xa5d5('0x38')]=_[_0xa5d5('0x31')](_0x245420[_0xa5d5('0x2e')],_0x245420[_0xa5d5('0x2f')]);_0x5c1020[_0xa5d5('0x32')]=_[_0xa5d5('0x31')](_0x245420['model'],qs[_0xa5d5('0x33')](_0x5b1277[_0xa5d5('0x2f')][_0xa5d5('0x33')]));_0x5c1020[_0xa5d5('0x32')]=_0x5c1020[_0xa5d5('0x32')]['length']?_0x5c1020[_0xa5d5('0x32')]:_0x245420[_0xa5d5('0x2e')];_0x5c1020['order']=qs[_0xa5d5('0x36')](_0x5b1277[_0xa5d5('0x2f')][_0xa5d5('0x36')]);_0x5c1020[_0xa5d5('0x37')]=qs[_0xa5d5('0x38')](_[_0xa5d5('0x39')](_0x5b1277['query'],_0x245420[_0xa5d5('0x38')]));if(_0x5b1277['query'][_0xa5d5('0x3a')]){_0x5c1020[_0xa5d5('0x37')]=_[_0xa5d5('0x3b')](_0x5c1020[_0xa5d5('0x37')],{'$or':_['map'](_0x5c1020['attributes'],function(_0x53b9a5){var _0x544e7c={};_0x544e7c[_0x53b9a5]={'$like':'%'+_0x5b1277[_0xa5d5('0x2f')][_0xa5d5('0x3a')]+'%'};return _0x544e7c;})});}_0x5c1020=_['merge']({},_0x5c1020,_0x5b1277[_0xa5d5('0x3d')]);return _0x488a43[_0xa5d5('0x4d')](_0x5c1020);}})['then'](function(_0x1ee29a){if(_0x1ee29a){_0x255480=_0x1ee29a[_0xa5d5('0x34')];if(!_0x5b1277[_0xa5d5('0x2f')][_0xa5d5('0x4c')](_0xa5d5('0x35'))){_0x5c1020[_0xa5d5('0x1c')]=qs[_0xa5d5('0x1c')](_0x5b1277[_0xa5d5('0x2f')][_0xa5d5('0x1c')]);_0x5c1020['offset']=qs['offset'](_0x5b1277[_0xa5d5('0x2f')][_0xa5d5('0x1e')]);}return _0x488a43[_0xa5d5('0x4d')](_0x5c1020);}})['then'](function(_0x3e3240){if(_0x3e3240){return _0x3e3240?{'count':_0x255480,'rows':_0x3e3240}:null;}})['then'](respondWithResult(_0x4ebea7,null))[_0xa5d5('0x41')](handleError(_0x4ebea7,null));};exports[_0xa5d5('0x4e')]=function(_0x4b5828,_0x3b3b87,_0x3b997b){var _0x24eb05={};var _0x3022fd={};var _0xc10612;var _0xe0724c;return db['DeskConfiguration'][_0xa5d5('0x4a')]({'where':{'id':_0x4b5828[_0xa5d5('0x48')]['id']}})[_0xa5d5('0x24')](handleEntityNotFound(_0x3b3b87,null))['then'](function(_0x2c90e3){if(_0x2c90e3){_0xc10612=_0x2c90e3;_0x3022fd[_0xa5d5('0x2e')]=_[_0xa5d5('0x30')](db['DeskField']['rawAttributes']);_0x3022fd[_0xa5d5('0x2f')]=_[_0xa5d5('0x30')](_0x4b5828[_0xa5d5('0x2f')]);_0x3022fd['filters']=_[_0xa5d5('0x31')](_0x3022fd[_0xa5d5('0x2e')],_0x3022fd[_0xa5d5('0x2f')]);_0x24eb05[_0xa5d5('0x32')]=_[_0xa5d5('0x31')](_0x3022fd[_0xa5d5('0x2e')],qs[_0xa5d5('0x33')](_0x4b5828['query']['fields']));_0x24eb05[_0xa5d5('0x32')]=_0x24eb05[_0xa5d5('0x32')]['length']?_0x24eb05[_0xa5d5('0x32')]:_0x3022fd[_0xa5d5('0x2e')];_0x24eb05[_0xa5d5('0x4f')]=qs['sort'](_0x4b5828[_0xa5d5('0x2f')][_0xa5d5('0x36')]);_0x24eb05['where']=qs['filters'](_[_0xa5d5('0x39')](_0x4b5828[_0xa5d5('0x2f')],_0x3022fd[_0xa5d5('0x38')]));if(_0x4b5828[_0xa5d5('0x2f')][_0xa5d5('0x3a')]){_0x24eb05['where']=_[_0xa5d5('0x3b')](_0x24eb05[_0xa5d5('0x37')],{'$or':_[_0xa5d5('0x29')](_0x24eb05[_0xa5d5('0x32')],function(_0x1441a0){var _0x8e7628={};_0x8e7628[_0x1441a0]={'$like':'%'+_0x4b5828[_0xa5d5('0x2f')][_0xa5d5('0x3a')]+'%'};return _0x8e7628;})});}_0x24eb05=_[_0xa5d5('0x3b')]({},_0x24eb05,_0x4b5828[_0xa5d5('0x3d')]);return _0xc10612[_0xa5d5('0x4e')](_0x24eb05);}})[_0xa5d5('0x24')](function(_0x507c3a){if(_0x507c3a){_0xe0724c=_0x507c3a[_0xa5d5('0x34')];if(!_0x4b5828[_0xa5d5('0x2f')][_0xa5d5('0x4c')](_0xa5d5('0x35'))){_0x24eb05[_0xa5d5('0x1c')]=qs[_0xa5d5('0x1c')](_0x4b5828[_0xa5d5('0x2f')][_0xa5d5('0x1c')]);_0x24eb05[_0xa5d5('0x1e')]=qs['offset'](_0x4b5828[_0xa5d5('0x2f')][_0xa5d5('0x1e')]);}return _0xc10612[_0xa5d5('0x4e')](_0x24eb05);}})['then'](function(_0x441bbb){if(_0x441bbb){return _0x441bbb?{'count':_0xe0724c,'rows':_0x441bbb}:null;}})[_0xa5d5('0x24')](respondWithResult(_0x3b3b87,null))[_0xa5d5('0x41')](handleError(_0x3b3b87,null));};exports[_0xa5d5('0x50')]=function(_0x31722d,_0x5d6e71,_0x125a15){var _0x168a39={};var _0x3199c0={};var _0x504187;var _0x2e5715;return db[_0xa5d5('0x3e')][_0xa5d5('0x4a')]({'where':{'id':_0x31722d[_0xa5d5('0x48')]['id']}})[_0xa5d5('0x24')](handleEntityNotFound(_0x5d6e71,null))[_0xa5d5('0x24')](function(_0x464aec){if(_0x464aec){_0x504187=_0x464aec;_0x3199c0[_0xa5d5('0x2e')]=_[_0xa5d5('0x30')](db['Tag'][_0xa5d5('0x2a')]);_0x3199c0[_0xa5d5('0x2f')]=_[_0xa5d5('0x30')](_0x31722d[_0xa5d5('0x2f')]);_0x3199c0['filters']=_[_0xa5d5('0x31')](_0x3199c0[_0xa5d5('0x2e')],_0x3199c0[_0xa5d5('0x2f')]);_0x168a39[_0xa5d5('0x32')]=_[_0xa5d5('0x31')](_0x3199c0[_0xa5d5('0x2e')],qs[_0xa5d5('0x33')](_0x31722d[_0xa5d5('0x2f')][_0xa5d5('0x33')]));_0x168a39[_0xa5d5('0x32')]=_0x168a39['attributes'][_0xa5d5('0x34')]?_0x168a39['attributes']:_0x3199c0['model'];_0x168a39[_0xa5d5('0x4f')]=qs['sort'](_0x31722d['query']['sort']);_0x168a39[_0xa5d5('0x37')]=qs['filters'](_[_0xa5d5('0x39')](_0x31722d[_0xa5d5('0x2f')],_0x3199c0[_0xa5d5('0x38')]));if(_0x31722d['query'][_0xa5d5('0x3a')]){_0x168a39[_0xa5d5('0x37')]=_[_0xa5d5('0x3b')](_0x168a39[_0xa5d5('0x37')],{'$or':_['map'](_0x168a39[_0xa5d5('0x32')],function(_0x198aca){var _0x2b5b41={};_0x2b5b41[_0x198aca]={'$like':'%'+_0x31722d[_0xa5d5('0x2f')][_0xa5d5('0x3a')]+'%'};return _0x2b5b41;})});}_0x168a39=_['merge']({},_0x168a39,_0x31722d[_0xa5d5('0x3d')]);return _0x504187[_0xa5d5('0x50')](_0x168a39);}})[_0xa5d5('0x24')](function(_0x46f691){if(_0x46f691){_0x2e5715=_0x46f691[_0xa5d5('0x34')];if(!_0x31722d[_0xa5d5('0x2f')][_0xa5d5('0x4c')](_0xa5d5('0x35'))){_0x168a39[_0xa5d5('0x1c')]=qs[_0xa5d5('0x1c')](_0x31722d[_0xa5d5('0x2f')]['limit']);_0x168a39[_0xa5d5('0x1e')]=qs[_0xa5d5('0x1e')](_0x31722d[_0xa5d5('0x2f')][_0xa5d5('0x1e')]);}return _0x504187[_0xa5d5('0x50')](_0x168a39);}})[_0xa5d5('0x24')](function(_0x4414c7){if(_0x4414c7){return _0x4414c7?{'count':_0x2e5715,'rows':_0x4414c7}:null;}})['then'](respondWithResult(_0x5d6e71,null))[_0xa5d5('0x41')](handleError(_0x5d6e71,null));};exports[_0xa5d5('0x51')]=function(_0xe2faed,_0x29faa3,_0x44aa05){if(_0xe2faed[_0xa5d5('0x46')]['id']){delete _0xe2faed[_0xa5d5('0x46')]['id'];}return db[_0xa5d5('0x3e')]['findOne']({'where':{'id':_0xe2faed[_0xa5d5('0x48')]['id']}})[_0xa5d5('0x24')](handleEntityNotFound(_0x29faa3,null))['then'](function(_0x3c97a8){if(_0x3c97a8){return _0x3c97a8[_0xa5d5('0x51')](_0xe2faed[_0xa5d5('0x46')][_0xa5d5('0x52')]||[]);}return null;})[_0xa5d5('0x24')](respondWithResult(_0x29faa3,null))[_0xa5d5('0x41')](handleError(_0x29faa3,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 1b05fd4..b7127cf 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 _0x22b3=['exports','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5426a7,_0x1b0b27){var _0x216b6c=function(_0x370f07){while(--_0x370f07){_0x5426a7['push'](_0x5426a7['shift']());}};_0x216b6c(++_0x1b0b27);}(_0x22b3,0x189));var _0x322b=function(_0x1f5563,_0x391057){_0x1f5563=_0x1f5563-0x0;var _0x2ebd56=_0x22b3[_0x1f5563];return _0x2ebd56;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x322b('0x0'))(_0x322b('0x1'));var moment=require(_0x322b('0x2'));var BPromise=require(_0x322b('0x3'));var rp=require(_0x322b('0x4'));var fs=require('fs');var path=require(_0x322b('0x5'));var rimraf=require('rimraf');var config=require(_0x322b('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x322b('0x7')]=function(_0xd6f2a,_0x36d64a){return _0xd6f2a['define']('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0028=['request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util','api','moment','bluebird'];(function(_0x290986,_0x1719af){var _0x3b894e=function(_0x2b19a7){while(--_0x2b19a7){_0x290986['push'](_0x290986['shift']());}};_0x3b894e(++_0x1719af);}(_0x0028,0x15b));var _0x8002=function(_0x2f3b86,_0x1fffad){_0x2f3b86=_0x2f3b86-0x0;var _0x9741a0=_0x0028[_0x2f3b86];return _0x9741a0;};'use strict';var _=require('lodash');var util=require(_0x8002('0x0'));var logger=require('../../config/logger')(_0x8002('0x1'));var moment=require(_0x8002('0x2'));var BPromise=require(_0x8002('0x3'));var rp=require(_0x8002('0x4'));var fs=require('fs');var path=require(_0x8002('0x5'));var rimraf=require(_0x8002('0x6'));var config=require(_0x8002('0x7'));var attributes=require(_0x8002('0x8'));module[_0x8002('0x9')]=function(_0x57d062,_0x42df7f){return _0x57d062[_0x8002('0xa')](_0x8002('0xb'),attributes,{'tableName':_0x8002('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 941ff82..4e7614d 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 _0x6af6=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x6af6,0x176));var _0x66af=function(_0x193dcb,_0x2daa38){_0x193dcb=_0x193dcb-0x0;var _0x1654c9=_0x6af6[_0x193dcb];return _0x1654c9;};'use strict';var _=require(_0x66af('0x0'));var util=require(_0x66af('0x1'));var moment=require(_0x66af('0x2'));var BPromise=require(_0x66af('0x3'));var rs=require(_0x66af('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66af('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x66af('0x6'))(_0x66af('0x7'));var config=require(_0x66af('0x8'));var jayson=require(_0x66af('0x9'));var client=jayson['client'][_0x66af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4989a5,_0x45bd30,_0xcf9131){return new BPromise(function(_0x132168,_0x3da3cf){return client[_0x66af('0xb')](_0x4989a5,_0xcf9131)['then'](function(_0x230dd1){logger[_0x66af('0xc')](_0x66af('0xd'),_0x45bd30,_0x66af('0xe'));logger[_0x66af('0xf')](_0x66af('0x10'),_0x45bd30,_0x66af('0xe'),JSON[_0x66af('0x11')](_0x230dd1));if(_0x230dd1[_0x66af('0x12')]){if(_0x230dd1[_0x66af('0x12')][_0x66af('0x13')]===0x1f4){logger[_0x66af('0x12')](_0x66af('0xd'),_0x45bd30,_0x230dd1[_0x66af('0x12')][_0x66af('0x14')]);return _0x3da3cf(_0x230dd1[_0x66af('0x12')][_0x66af('0x14')]);}logger['error'](_0x66af('0xd'),_0x45bd30,_0x230dd1[_0x66af('0x12')]['message']);return _0x132168(_0x230dd1[_0x66af('0x12')]['message']);}else{logger[_0x66af('0xc')](_0x66af('0xd'),_0x45bd30,'request\x20sent');_0x132168(_0x230dd1[_0x66af('0x15')][_0x66af('0x14')]);}})[_0x66af('0x16')](function(_0x1547a5){logger['error'](_0x66af('0xd'),_0x45bd30,_0x1547a5);_0x3da3cf(_0x1547a5);});});} \ No newline at end of file +var _0x7156=['then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request'];(function(_0x3645cc,_0x25ba47){var _0x351979=function(_0x5829a0){while(--_0x5829a0){_0x3645cc['push'](_0x3645cc['shift']());}};_0x351979(++_0x25ba47);}(_0x7156,0x122));var _0x6715=function(_0x5856f5,_0x3a56b3){_0x5856f5=_0x5856f5-0x0;var _0x78da32=_0x7156[_0x5856f5];return _0x78da32;};'use strict';var _=require('lodash');var util=require(_0x6715('0x0'));var moment=require(_0x6715('0x1'));var BPromise=require('bluebird');var rs=require(_0x6715('0x2'));var fs=require('fs');var Redis=require(_0x6715('0x3'));var db=require(_0x6715('0x4'))['db'];var utils=require(_0x6715('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6715('0x6'));var jayson=require(_0x6715('0x7'));var client=jayson[_0x6715('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dab2e,_0x2a0cf1,_0x214573){return new BPromise(function(_0x428331,_0x528720){return client[_0x6715('0x9')](_0x3dab2e,_0x214573)[_0x6715('0xa')](function(_0x1c418a){logger['info'](_0x6715('0xb'),_0x2a0cf1,_0x6715('0xc'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2a0cf1,'request\x20sent',JSON[_0x6715('0xd')](_0x1c418a));if(_0x1c418a['error']){if(_0x1c418a[_0x6715('0xe')][_0x6715('0xf')]===0x1f4){logger[_0x6715('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x2a0cf1,_0x1c418a[_0x6715('0xe')][_0x6715('0x10')]);return _0x528720(_0x1c418a[_0x6715('0xe')][_0x6715('0x10')]);}logger[_0x6715('0xe')](_0x6715('0xb'),_0x2a0cf1,_0x1c418a[_0x6715('0xe')]['message']);return _0x428331(_0x1c418a['error']['message']);}else{logger[_0x6715('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x2a0cf1,'request\x20sent');_0x428331(_0x1c418a[_0x6715('0x12')]['message']);}})[_0x6715('0x13')](function(_0x8cb2){logger[_0x6715('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x2a0cf1,_0x8cb2);_0x528720(_0x8cb2);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 18a16bf..05af906 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 _0x2a75=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x3678aa,_0xb12d8f){var _0x36647f=function(_0x569fe5){while(--_0x569fe5){_0x3678aa['push'](_0x3678aa['shift']());}};_0x36647f(++_0xb12d8f);}(_0x2a75,0x1cd));var _0x52a7=function(_0x38d1cb,_0x5a2a02){_0x38d1cb=_0x38d1cb-0x0;var _0x369162=_0x2a75[_0x38d1cb];return _0x369162;};'use strict';var multer=require('multer');var util=require(_0x52a7('0x0'));var path=require(_0x52a7('0x1'));var timeout=require(_0x52a7('0x2'));var express=require(_0x52a7('0x3'));var router=express[_0x52a7('0x4')]();var fs_extra=require(_0x52a7('0x5'));var auth=require(_0x52a7('0x6'));var interaction=require(_0x52a7('0x7'));var config=require('../../config/environment');var controller=require(_0x52a7('0x8'));router[_0x52a7('0x9')]('/',auth[_0x52a7('0xa')](),controller[_0x52a7('0xb')]);router[_0x52a7('0x9')](_0x52a7('0xc'),auth[_0x52a7('0xa')](),controller[_0x52a7('0xd')]);router[_0x52a7('0xe')]('/',auth[_0x52a7('0xa')](),controller[_0x52a7('0xf')]);router[_0x52a7('0x10')]('/:id',auth[_0x52a7('0xa')](),controller[_0x52a7('0x11')]);router[_0x52a7('0x12')]('/:id',auth[_0x52a7('0xa')](),controller[_0x52a7('0x13')]);module[_0x52a7('0x14')]=router; \ No newline at end of file +var _0xef0b=['delete','destroy','exports','multer','path','express','Router','../../components/auth/service','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xef0b,0x1d7));var _0xbef0=function(_0x4e7be8,_0x2d8f98){_0x4e7be8=_0x4e7be8-0x0;var _0x5cd9f6=_0xef0b[_0x4e7be8];return _0x5cd9f6;};'use strict';var multer=require(_0xbef0('0x0'));var util=require('util');var path=require(_0xbef0('0x1'));var timeout=require('connect-timeout');var express=require(_0xbef0('0x2'));var router=express[_0xbef0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbef0('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbef0('0x5'));router[_0xbef0('0x6')]('/',auth[_0xbef0('0x7')](),controller[_0xbef0('0x8')]);router[_0xbef0('0x6')](_0xbef0('0x9'),auth[_0xbef0('0x7')](),controller[_0xbef0('0xa')]);router[_0xbef0('0xb')]('/',auth['isAuthenticated'](),controller[_0xbef0('0xc')]);router[_0xbef0('0xd')](_0xbef0('0x9'),auth[_0xbef0('0x7')](),controller[_0xbef0('0xe')]);router[_0xbef0('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xbef0('0x10')]);module[_0xbef0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 67ae408..c377471 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 _0x48cf=['string','STRING','BOOLEAN','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x969407,_0x4b07cd){var _0x1df001=function(_0x33a0f8){while(--_0x33a0f8){_0x969407['push'](_0x969407['shift']());}};_0x1df001(++_0x4b07cd);}(_0x48cf,0xae));var _0xf48c=function(_0x57f032,_0x49f5df){_0x57f032=_0x57f032-0x0;var _0xbf510f=_0x48cf[_0x57f032];return _0xbf510f;};'use strict';var Sequelize=require('sequelize');module[_0xf48c('0x0')]={'type':{'type':Sequelize[_0xf48c('0x1')]('string',_0xf48c('0x2'),_0xf48c('0x3'),_0xf48c('0x4'),_0xf48c('0x5')),'defaultValue':_0xf48c('0x6')},'content':{'type':Sequelize[_0xf48c('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xf48c('0x6'),_0xf48c('0x2'),_0xf48c('0x3'))},'keyContent':{'type':Sequelize[_0xf48c('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf48c('0x7')]},'customField':{'type':Sequelize[_0xf48c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf48c('0x7')]}}; \ No newline at end of file +var _0x5501=['STRING','BOOLEAN','sequelize','exports','customVariable','keyValue','picklist','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5501,0x7a));var _0x1550=function(_0x3f2491,_0x33e11a){_0x3f2491=_0x3f2491-0x0;var _0x7ab71a=_0x5501[_0x3f2491];return _0x7ab71a;};'use strict';var Sequelize=require(_0x1550('0x0'));module[_0x1550('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x1550('0x2'),_0x1550('0x3'),_0x1550('0x4')),'defaultValue':_0x1550('0x5')},'content':{'type':Sequelize[_0x1550('0x6')]},'key':{'type':Sequelize[_0x1550('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1550('0x6')]},'nameField':{'type':Sequelize[_0x1550('0x6')]},'customField':{'type':Sequelize[_0x1550('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1550('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 527a870..824d729 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 _0x510e=['model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','DeskField','rawAttributes','fieldName','type','key'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x510e,0x1ed));var _0xe510=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x510e[_0x22f8ab];return _0x2a70e5;};'use strict';var emlformat=require(_0xe510('0x0'));var rimraf=require(_0xe510('0x1'));var zipdir=require(_0xe510('0x2'));var jsonpatch=require(_0xe510('0x3'));var rp=require(_0xe510('0x4'));var moment=require(_0xe510('0x5'));var BPromise=require(_0xe510('0x6'));var Mustache=require(_0xe510('0x7'));var util=require(_0xe510('0x8'));var path=require('path');var sox=require(_0xe510('0x9'));var csv=require(_0xe510('0xa'));var ejs=require(_0xe510('0xb'));var fs=require('fs');var fs_extra=require(_0xe510('0xc'));var _=require(_0xe510('0xd'));var squel=require(_0xe510('0xe'));var crypto=require(_0xe510('0xf'));var jsforce=require(_0xe510('0x10'));var deskjs=require(_0xe510('0x11'));var toCsv=require(_0xe510('0xa'));var querystring=require(_0xe510('0x12'));var Papa=require(_0xe510('0x13'));var Redis=require(_0xe510('0x14'));var authService=require(_0xe510('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xe510('0x16'));var hardwareService=require(_0xe510('0x17'));var logger=require(_0xe510('0x18'))(_0xe510('0x19'));var utils=require(_0xe510('0x1a'));var config=require(_0xe510('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xe510('0x1c'))['db'];function respondWithStatusCode(_0x2168b2,_0x55ee64){_0x55ee64=_0x55ee64||0xcc;return function(_0x261832){if(_0x261832){return _0x2168b2[_0xe510('0x1d')](_0x55ee64);}return _0x2168b2[_0xe510('0x1e')](_0x55ee64)[_0xe510('0x1f')]();};}function respondWithResult(_0x351376,_0x1b399f){_0x1b399f=_0x1b399f||0xc8;return function(_0x3af96e){if(_0x3af96e){return _0x351376[_0xe510('0x1e')](_0x1b399f)[_0xe510('0x20')](_0x3af96e);}};}function respondWithFilteredResult(_0x538d55,_0x8150a7){return function(_0x52feea){if(_0x52feea){var _0x574ce5=typeof _0x8150a7[_0xe510('0x21')]===_0xe510('0x22')&&typeof _0x8150a7[_0xe510('0x23')]===_0xe510('0x22');var _0x9b92b0=_0x52feea[_0xe510('0x24')];var _0x268736=_0x574ce5?0x0:_0x8150a7[_0xe510('0x21')];var _0x48e676=_0x574ce5?_0x52feea[_0xe510('0x24')]:_0x8150a7[_0xe510('0x21')]+_0x8150a7[_0xe510('0x23')];var _0x4dd3d8;if(_0x48e676>=_0x9b92b0){_0x48e676=_0x9b92b0;_0x4dd3d8=0xc8;}else{_0x4dd3d8=0xce;}_0x538d55[_0xe510('0x1e')](_0x4dd3d8);return _0x538d55[_0xe510('0x25')](_0xe510('0x26'),_0x268736+'-'+_0x48e676+'/'+_0x9b92b0)['json'](_0x52feea);}return null;};}function patchUpdates(_0xd3237){return function(_0x212e3e){try{jsonpatch['apply'](_0x212e3e,_0xd3237,!![]);}catch(_0x269596){return BPromise[_0xe510('0x27')](_0x269596);}return _0x212e3e['save']();};}function saveUpdates(_0x25b523,_0x460d28){return function(_0x4a0c3d){if(_0x4a0c3d){return _0x4a0c3d[_0xe510('0x28')](_0x25b523)[_0xe510('0x29')](function(_0x2ba74a){return _0x2ba74a;});}return null;};}function removeEntity(_0x2ea51b,_0xc6ffae){return function(_0x4c034f){if(_0x4c034f){return _0x4c034f[_0xe510('0x2a')]()['then'](function(){_0x2ea51b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4425ee,_0x26988f){return function(_0x5abf44){if(!_0x5abf44){_0x4425ee[_0xe510('0x1d')](0x194);}return _0x5abf44;};}function handleError(_0x59d10b,_0x11ed03){_0x11ed03=_0x11ed03||0x1f4;return function(_0x45ea1e){logger[_0xe510('0x2b')](_0x45ea1e[_0xe510('0x2c')]);if(_0x45ea1e[_0xe510('0x2d')]){delete _0x45ea1e[_0xe510('0x2d')];}_0x59d10b[_0xe510('0x1e')](_0x11ed03)[_0xe510('0x2e')](_0x45ea1e);};}exports[_0xe510('0x2f')]=function(_0x2aff62,_0x92bfa3){var _0x5dcdb3={},_0xf5a2fb={},_0x1ea081={'count':0x0,'rows':[]};var _0x49a33f=_['map'](db[_0xe510('0x30')][_0xe510('0x31')],function(_0x538e31){return{'name':_0x538e31[_0xe510('0x32')],'type':_0x538e31[_0xe510('0x33')][_0xe510('0x34')]};});_0xf5a2fb[_0xe510('0x35')]=_[_0xe510('0x36')](_0x49a33f,'name');_0xf5a2fb[_0xe510('0x37')]=_[_0xe510('0x38')](_0x2aff62[_0xe510('0x37')]);_0xf5a2fb[_0xe510('0x39')]=_[_0xe510('0x3a')](_0xf5a2fb[_0xe510('0x35')],_0xf5a2fb[_0xe510('0x37')]);_0x5dcdb3[_0xe510('0x3b')]=_[_0xe510('0x3a')](_0xf5a2fb[_0xe510('0x35')],qs['fields'](_0x2aff62[_0xe510('0x37')][_0xe510('0x3c')]));_0x5dcdb3[_0xe510('0x3b')]=_0x5dcdb3[_0xe510('0x3b')][_0xe510('0x3d')]?_0x5dcdb3[_0xe510('0x3b')]:_0xf5a2fb[_0xe510('0x35')];if(!_0x2aff62[_0xe510('0x37')][_0xe510('0x3e')](_0xe510('0x3f'))){_0x5dcdb3[_0xe510('0x23')]=qs[_0xe510('0x23')](_0x2aff62[_0xe510('0x37')][_0xe510('0x23')]);_0x5dcdb3[_0xe510('0x21')]=qs[_0xe510('0x21')](_0x2aff62[_0xe510('0x37')]['offset']);}_0x5dcdb3[_0xe510('0x40')]=qs[_0xe510('0x41')](_0x2aff62['query'][_0xe510('0x41')]);_0x5dcdb3[_0xe510('0x42')]=qs['filters'](_['pick'](_0x2aff62[_0xe510('0x37')],_0xf5a2fb[_0xe510('0x39')]),_0x49a33f);if(_0x2aff62[_0xe510('0x37')][_0xe510('0x43')]){_0x5dcdb3['where']=_[_0xe510('0x44')](_0x5dcdb3['where'],{'$or':_[_0xe510('0x36')](_0x49a33f,function(_0x2bec4b){if(_0x2bec4b[_0xe510('0x33')]!=='VIRTUAL'){var _0x31ef35={};_0x31ef35[_0x2bec4b[_0xe510('0x2d')]]={'$like':'%'+_0x2aff62[_0xe510('0x37')][_0xe510('0x43')]+'%'};return _0x31ef35;}})});}_0x5dcdb3=_[_0xe510('0x44')]({},_0x5dcdb3,_0x2aff62[_0xe510('0x45')]);var _0x266f2a={'where':_0x5dcdb3[_0xe510('0x42')]};return db[_0xe510('0x30')][_0xe510('0x24')](_0x266f2a)[_0xe510('0x29')](function(_0x1e3912){_0x1ea081[_0xe510('0x24')]=_0x1e3912;if(_0x2aff62[_0xe510('0x37')][_0xe510('0x46')]){_0x5dcdb3[_0xe510('0x47')]=[{'all':!![]}];}return db[_0xe510('0x30')][_0xe510('0x48')](_0x5dcdb3);})[_0xe510('0x29')](function(_0x5a92f4){_0x1ea081['rows']=_0x5a92f4;return _0x1ea081;})['then'](respondWithFilteredResult(_0x92bfa3,_0x5dcdb3))[_0xe510('0x49')](handleError(_0x92bfa3,null));};exports[_0xe510('0x4a')]=function(_0x198615,_0x251e86){var _0x58f6af={'raw':!![],'where':{'id':_0x198615[_0xe510('0x4b')]['id']}},_0x59a603={};_0x59a603[_0xe510('0x35')]=_['keys'](db[_0xe510('0x30')][_0xe510('0x31')]);_0x59a603['query']=_[_0xe510('0x38')](_0x198615[_0xe510('0x37')]);_0x59a603[_0xe510('0x39')]=_[_0xe510('0x3a')](_0x59a603['model'],_0x59a603[_0xe510('0x37')]);_0x58f6af[_0xe510('0x3b')]=_[_0xe510('0x3a')](_0x59a603['model'],qs[_0xe510('0x3c')](_0x198615[_0xe510('0x37')]['fields']));_0x58f6af[_0xe510('0x3b')]=_0x58f6af[_0xe510('0x3b')][_0xe510('0x3d')]?_0x58f6af['attributes']:_0x59a603[_0xe510('0x35')];if(_0x198615['query'][_0xe510('0x46')]){_0x58f6af[_0xe510('0x47')]=[{'all':!![]}];}_0x58f6af=_[_0xe510('0x44')]({},_0x58f6af,_0x198615[_0xe510('0x45')]);return db['DeskField'][_0xe510('0x4c')](_0x58f6af)['then'](handleEntityNotFound(_0x251e86,null))[_0xe510('0x29')](respondWithResult(_0x251e86,null))['catch'](handleError(_0x251e86,null));};exports['create']=function(_0x5acee9,_0x684d19){return db['DeskField']['create'](_0x5acee9['body'],{})[_0xe510('0x29')](respondWithResult(_0x684d19,0xc9))[_0xe510('0x49')](handleError(_0x684d19,null));};exports[_0xe510('0x28')]=function(_0x38ccc1,_0x4cce42){if(_0x38ccc1[_0xe510('0x4d')]['id']){delete _0x38ccc1[_0xe510('0x4d')]['id'];}return db[_0xe510('0x30')][_0xe510('0x4c')]({'where':{'id':_0x38ccc1['params']['id']}})['then'](handleEntityNotFound(_0x4cce42,null))['then'](saveUpdates(_0x38ccc1[_0xe510('0x4d')],null))[_0xe510('0x29')](respondWithResult(_0x4cce42,null))[_0xe510('0x49')](handleError(_0x4cce42,null));};exports[_0xe510('0x2a')]=function(_0x992fa4,_0x4f1d42){return db[_0xe510('0x30')]['find']({'where':{'id':_0x992fa4[_0xe510('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4f1d42,null))['then'](removeEntity(_0x4f1d42,null))[_0xe510('0x49')](handleError(_0x4f1d42,null));}; \ No newline at end of file +var _0x3274=['fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','intersection','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','save','update','then','destroy','error','stack','name','index','map','DeskField','rawAttributes'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x3274,0x134));var _0x4327=function(_0x306b49,_0x92aa){_0x306b49=_0x306b49-0x0;var _0x50b90d=_0x3274[_0x306b49];return _0x50b90d;};'use strict';var emlformat=require(_0x4327('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4327('0x1'));var jsonpatch=require(_0x4327('0x2'));var rp=require('request-promise');var moment=require(_0x4327('0x3'));var BPromise=require(_0x4327('0x4'));var Mustache=require(_0x4327('0x5'));var util=require(_0x4327('0x6'));var path=require(_0x4327('0x7'));var sox=require(_0x4327('0x8'));var csv=require('to-csv');var ejs=require(_0x4327('0x9'));var fs=require('fs');var fs_extra=require(_0x4327('0xa'));var _=require('lodash');var squel=require(_0x4327('0xb'));var crypto=require(_0x4327('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4327('0xd'));var toCsv=require(_0x4327('0xe'));var querystring=require('querystring');var Papa=require(_0x4327('0xf'));var Redis=require('ioredis');var authService=require(_0x4327('0x10'));var qs=require(_0x4327('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4327('0x12'));var logger=require('../../config/logger')(_0x4327('0x13'));var utils=require(_0x4327('0x14'));var config=require(_0x4327('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4327('0x16'))['db'];function respondWithStatusCode(_0x15ccbc,_0x3a40ca){_0x3a40ca=_0x3a40ca||0xcc;return function(_0x51c55d){if(_0x51c55d){return _0x15ccbc[_0x4327('0x17')](_0x3a40ca);}return _0x15ccbc[_0x4327('0x18')](_0x3a40ca)[_0x4327('0x19')]();};}function respondWithResult(_0x4b66f6,_0xe5f57e){_0xe5f57e=_0xe5f57e||0xc8;return function(_0x3ab628){if(_0x3ab628){return _0x4b66f6[_0x4327('0x18')](_0xe5f57e)[_0x4327('0x1a')](_0x3ab628);}};}function respondWithFilteredResult(_0x4b3585,_0x368f05){return function(_0x15264b){if(_0x15264b){var _0x34ddfe=typeof _0x368f05[_0x4327('0x1b')]===_0x4327('0x1c')&&typeof _0x368f05[_0x4327('0x1d')]===_0x4327('0x1c');var _0x3a1eb4=_0x15264b['count'];var _0x1884eb=_0x34ddfe?0x0:_0x368f05[_0x4327('0x1b')];var _0x3e0430=_0x34ddfe?_0x15264b['count']:_0x368f05[_0x4327('0x1b')]+_0x368f05[_0x4327('0x1d')];var _0x26c03a;if(_0x3e0430>=_0x3a1eb4){_0x3e0430=_0x3a1eb4;_0x26c03a=0xc8;}else{_0x26c03a=0xce;}_0x4b3585['status'](_0x26c03a);return _0x4b3585[_0x4327('0x1e')]('Content-Range',_0x1884eb+'-'+_0x3e0430+'/'+_0x3a1eb4)[_0x4327('0x1a')](_0x15264b);}return null;};}function patchUpdates(_0x2564f1){return function(_0xee6580){try{jsonpatch['apply'](_0xee6580,_0x2564f1,!![]);}catch(_0x45c4fc){return BPromise['reject'](_0x45c4fc);}return _0xee6580[_0x4327('0x1f')]();};}function saveUpdates(_0x408f9a,_0x127070){return function(_0x117833){if(_0x117833){return _0x117833[_0x4327('0x20')](_0x408f9a)[_0x4327('0x21')](function(_0x54fe69){return _0x54fe69;});}return null;};}function removeEntity(_0x536253,_0x2c21f4){return function(_0x45be28){if(_0x45be28){return _0x45be28[_0x4327('0x22')]()['then'](function(){_0x536253['status'](0xcc)[_0x4327('0x19')]();});}};}function handleEntityNotFound(_0x4a32a8,_0x5299c6){return function(_0x4e6453){if(!_0x4e6453){_0x4a32a8['sendStatus'](0x194);}return _0x4e6453;};}function handleError(_0x1fd4a2,_0x2fbc77){_0x2fbc77=_0x2fbc77||0x1f4;return function(_0x20af0a){logger[_0x4327('0x23')](_0x20af0a[_0x4327('0x24')]);if(_0x20af0a[_0x4327('0x25')]){delete _0x20af0a[_0x4327('0x25')];}_0x1fd4a2['status'](_0x2fbc77)['send'](_0x20af0a);};}exports[_0x4327('0x26')]=function(_0x5258d3,_0x566dcd){var _0x5462e6={},_0x5b255a={},_0x3683fc={'count':0x0,'rows':[]};var _0x50412f=_[_0x4327('0x27')](db[_0x4327('0x28')][_0x4327('0x29')],function(_0x487200){return{'name':_0x487200[_0x4327('0x2a')],'type':_0x487200[_0x4327('0x2b')][_0x4327('0x2c')]};});_0x5b255a[_0x4327('0x2d')]=_[_0x4327('0x27')](_0x50412f,_0x4327('0x25'));_0x5b255a[_0x4327('0x2e')]=_[_0x4327('0x2f')](_0x5258d3[_0x4327('0x2e')]);_0x5b255a[_0x4327('0x30')]=_['intersection'](_0x5b255a['model'],_0x5b255a['query']);_0x5462e6[_0x4327('0x31')]=_['intersection'](_0x5b255a[_0x4327('0x2d')],qs[_0x4327('0x32')](_0x5258d3[_0x4327('0x2e')]['fields']));_0x5462e6['attributes']=_0x5462e6[_0x4327('0x31')][_0x4327('0x33')]?_0x5462e6[_0x4327('0x31')]:_0x5b255a[_0x4327('0x2d')];if(!_0x5258d3[_0x4327('0x2e')]['hasOwnProperty'](_0x4327('0x34'))){_0x5462e6[_0x4327('0x1d')]=qs[_0x4327('0x1d')](_0x5258d3[_0x4327('0x2e')][_0x4327('0x1d')]);_0x5462e6[_0x4327('0x1b')]=qs['offset'](_0x5258d3[_0x4327('0x2e')][_0x4327('0x1b')]);}_0x5462e6['order']=qs[_0x4327('0x35')](_0x5258d3['query'][_0x4327('0x35')]);_0x5462e6[_0x4327('0x36')]=qs[_0x4327('0x30')](_[_0x4327('0x37')](_0x5258d3[_0x4327('0x2e')],_0x5b255a[_0x4327('0x30')]),_0x50412f);if(_0x5258d3['query'][_0x4327('0x38')]){_0x5462e6[_0x4327('0x36')]=_[_0x4327('0x39')](_0x5462e6[_0x4327('0x36')],{'$or':_[_0x4327('0x27')](_0x50412f,function(_0xb7262){if(_0xb7262[_0x4327('0x2b')]!==_0x4327('0x3a')){var _0x26e06c={};_0x26e06c[_0xb7262[_0x4327('0x25')]]={'$like':'%'+_0x5258d3[_0x4327('0x2e')][_0x4327('0x38')]+'%'};return _0x26e06c;}})});}_0x5462e6=_['merge']({},_0x5462e6,_0x5258d3[_0x4327('0x3b')]);var _0xbe987f={'where':_0x5462e6[_0x4327('0x36')]};return db[_0x4327('0x28')][_0x4327('0x3c')](_0xbe987f)[_0x4327('0x21')](function(_0x17fa08){_0x3683fc[_0x4327('0x3c')]=_0x17fa08;if(_0x5258d3[_0x4327('0x2e')][_0x4327('0x3d')]){_0x5462e6[_0x4327('0x3e')]=[{'all':!![]}];}return db[_0x4327('0x28')][_0x4327('0x3f')](_0x5462e6);})[_0x4327('0x21')](function(_0x4c6423){_0x3683fc['rows']=_0x4c6423;return _0x3683fc;})[_0x4327('0x21')](respondWithFilteredResult(_0x566dcd,_0x5462e6))[_0x4327('0x40')](handleError(_0x566dcd,null));};exports['show']=function(_0xf64a4e,_0x133896){var _0x5861aa={'raw':!![],'where':{'id':_0xf64a4e['params']['id']}},_0x16cc73={};_0x16cc73['model']=_[_0x4327('0x2f')](db[_0x4327('0x28')]['rawAttributes']);_0x16cc73[_0x4327('0x2e')]=_[_0x4327('0x2f')](_0xf64a4e[_0x4327('0x2e')]);_0x16cc73[_0x4327('0x30')]=_['intersection'](_0x16cc73[_0x4327('0x2d')],_0x16cc73[_0x4327('0x2e')]);_0x5861aa[_0x4327('0x31')]=_[_0x4327('0x41')](_0x16cc73[_0x4327('0x2d')],qs[_0x4327('0x32')](_0xf64a4e[_0x4327('0x2e')][_0x4327('0x32')]));_0x5861aa[_0x4327('0x31')]=_0x5861aa[_0x4327('0x31')][_0x4327('0x33')]?_0x5861aa[_0x4327('0x31')]:_0x16cc73[_0x4327('0x2d')];if(_0xf64a4e[_0x4327('0x2e')][_0x4327('0x3d')]){_0x5861aa[_0x4327('0x3e')]=[{'all':!![]}];}_0x5861aa=_['merge']({},_0x5861aa,_0xf64a4e[_0x4327('0x3b')]);return db['DeskField'][_0x4327('0x42')](_0x5861aa)[_0x4327('0x21')](handleEntityNotFound(_0x133896,null))[_0x4327('0x21')](respondWithResult(_0x133896,null))[_0x4327('0x40')](handleError(_0x133896,null));};exports[_0x4327('0x43')]=function(_0x3d2550,_0x3e9954){return db[_0x4327('0x28')]['create'](_0x3d2550[_0x4327('0x44')],{})[_0x4327('0x21')](respondWithResult(_0x3e9954,0xc9))[_0x4327('0x40')](handleError(_0x3e9954,null));};exports[_0x4327('0x20')]=function(_0x2d9114,_0x202537){if(_0x2d9114[_0x4327('0x44')]['id']){delete _0x2d9114[_0x4327('0x44')]['id'];}return db[_0x4327('0x28')][_0x4327('0x42')]({'where':{'id':_0x2d9114[_0x4327('0x45')]['id']}})[_0x4327('0x21')](handleEntityNotFound(_0x202537,null))[_0x4327('0x21')](saveUpdates(_0x2d9114[_0x4327('0x44')],null))[_0x4327('0x21')](respondWithResult(_0x202537,null))['catch'](handleError(_0x202537,null));};exports[_0x4327('0x22')]=function(_0x321c62,_0x4098ce){return db[_0x4327('0x28')][_0x4327('0x42')]({'where':{'id':_0x321c62[_0x4327('0x45')]['id']}})[_0x4327('0x21')](handleEntityNotFound(_0x4098ce,null))['then'](removeEntity(_0x4098ce,null))[_0x4327('0x40')](handleError(_0x4098ce,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d010647..3a2e2d7 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 _0x7e4d=['int_desk_fields','desk_unique_index','lodash','../../config/logger','api','moment','bluebird','rimraf','./intDeskField.attributes','DeskField'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x7e4d,0x70));var _0xd7e4=function(_0x51c95b,_0x232e1b){_0x51c95b=_0x51c95b-0x0;var _0x175a8e=_0x7e4d[_0x51c95b];return _0x175a8e;};'use strict';var _=require(_0xd7e4('0x0'));var util=require('util');var logger=require(_0xd7e4('0x1'))(_0xd7e4('0x2'));var moment=require(_0xd7e4('0x3'));var BPromise=require(_0xd7e4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd7e4('0x5'));var config=require('../../config/environment');var attributes=require(_0xd7e4('0x6'));module['exports']=function(_0x48e47a,_0x3d358b){return _0x48e47a['define'](_0xd7e4('0x7'),attributes,{'tableName':_0xd7e4('0x8'),'paranoid':![],'indexes':[{'name':_0xd7e4('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6eb7=['request-promise','path','rimraf','./intDeskField.attributes','exports','define','desk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x22c1ce,_0x509980){var _0x2bc290=function(_0x13ffe5){while(--_0x13ffe5){_0x22c1ce['push'](_0x22c1ce['shift']());}};_0x2bc290(++_0x509980);}(_0x6eb7,0x191));var _0x76eb=function(_0x3cb741,_0x36e418){_0x3cb741=_0x3cb741-0x0;var _0x219d71=_0x6eb7[_0x3cb741];return _0x219d71;};'use strict';var _=require(_0x76eb('0x0'));var util=require('util');var logger=require(_0x76eb('0x1'))(_0x76eb('0x2'));var moment=require(_0x76eb('0x3'));var BPromise=require(_0x76eb('0x4'));var rp=require(_0x76eb('0x5'));var fs=require('fs');var path=require(_0x76eb('0x6'));var rimraf=require(_0x76eb('0x7'));var config=require('../../config/environment');var attributes=require(_0x76eb('0x8'));module[_0x76eb('0x9')]=function(_0x4556e9,_0x1c41d5){return _0x4556e9[_0x76eb('0xa')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x76eb('0xb'),'fields':[_0x76eb('0xc'),_0x76eb('0xd')],'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 3b17733..5959b84 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 _0x401d=['lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','DeskField,\x20%s,\x20%s','message'];(function(_0x2a708e,_0x5ee473){var _0x1af04d=function(_0x2ebec7){while(--_0x2ebec7){_0x2a708e['push'](_0x2a708e['shift']());}};_0x1af04d(++_0x5ee473);}(_0x401d,0x159));var _0xd401=function(_0x30cfd6,_0x343894){_0x30cfd6=_0x30cfd6-0x0;var _0x5b3b80=_0x401d[_0x30cfd6];return _0x5b3b80;};'use strict';var _=require(_0xd401('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd401('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd401('0x2'))['db'];var utils=require(_0xd401('0x3'));var logger=require(_0xd401('0x4'))('rpc');var config=require(_0xd401('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd401('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2de2fc,_0x365452,_0xb27e06){return new BPromise(function(_0x40c985,_0x20d19c){return client[_0xd401('0x7')](_0x2de2fc,_0xb27e06)[_0xd401('0x8')](function(_0x310638){logger[_0xd401('0x9')]('DeskField,\x20%s,\x20%s',_0x365452,_0xd401('0xa'));logger['debug'](_0xd401('0xb'),_0x365452,'request\x20sent',JSON['stringify'](_0x310638));if(_0x310638[_0xd401('0xc')]){if(_0x310638[_0xd401('0xc')]['code']===0x1f4){logger['error'](_0xd401('0xd'),_0x365452,_0x310638['error'][_0xd401('0xe')]);return _0x20d19c(_0x310638[_0xd401('0xc')][_0xd401('0xe')]);}logger[_0xd401('0xc')](_0xd401('0xd'),_0x365452,_0x310638[_0xd401('0xc')][_0xd401('0xe')]);return _0x40c985(_0x310638[_0xd401('0xc')][_0xd401('0xe')]);}else{logger[_0xd401('0x9')](_0xd401('0xd'),_0x365452,_0xd401('0xa'));_0x40c985(_0x310638['result']['message']);}})['catch'](function(_0x496afa){logger[_0xd401('0xc')](_0xd401('0xd'),_0x365452,_0x496afa);_0x20d19c(_0x496afa);});});} \ No newline at end of file +var _0xe39f=['../../config/environment','jayson/promise','client','http','then','info','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','DeskField,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x44716f,_0x53d004){var _0x426b32=function(_0x141bc7){while(--_0x141bc7){_0x44716f['push'](_0x44716f['shift']());}};_0x426b32(++_0x53d004);}(_0xe39f,0x1c5));var _0xfe39=function(_0x109db8,_0xf0e481){_0x109db8=_0x109db8-0x0;var _0x3448f7=_0xe39f[_0x109db8];return _0x3448f7;};'use strict';var _=require(_0xfe39('0x0'));var util=require(_0xfe39('0x1'));var moment=require('moment');var BPromise=require(_0xfe39('0x2'));var rs=require(_0xfe39('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe39('0x4'))['db'];var utils=require(_0xfe39('0x5'));var logger=require(_0xfe39('0x6'))('rpc');var config=require(_0xfe39('0x7'));var jayson=require(_0xfe39('0x8'));var client=jayson[_0xfe39('0x9')][_0xfe39('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e298,_0x583ccf,_0x3478f7){return new BPromise(function(_0x498387,_0x184be5){return client['request'](_0x45e298,_0x3478f7)[_0xfe39('0xb')](function(_0x33075a){logger[_0xfe39('0xc')]('DeskField,\x20%s,\x20%s',_0x583ccf,'request\x20sent');logger[_0xfe39('0xd')](_0xfe39('0xe'),_0x583ccf,'request\x20sent',JSON['stringify'](_0x33075a));if(_0x33075a[_0xfe39('0xf')]){if(_0x33075a[_0xfe39('0xf')][_0xfe39('0x10')]===0x1f4){logger['error'](_0xfe39('0x11'),_0x583ccf,_0x33075a[_0xfe39('0xf')][_0xfe39('0x12')]);return _0x184be5(_0x33075a['error']['message']);}logger[_0xfe39('0xf')](_0xfe39('0x11'),_0x583ccf,_0x33075a[_0xfe39('0xf')]['message']);return _0x498387(_0x33075a[_0xfe39('0xf')][_0xfe39('0x12')]);}else{logger['info'](_0xfe39('0x11'),_0x583ccf,'request\x20sent');_0x498387(_0x33075a['result']['message']);}})[_0xfe39('0x13')](function(_0x1350e7){logger[_0xfe39('0xf')](_0xfe39('0x11'),_0x583ccf,_0x1350e7);_0x184be5(_0x1350e7);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 92c8b7a..fd0a633 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 _0x5331=['/:id','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration'];(function(_0x5108bf,_0x1e9b2a){var _0x343c7e=function(_0xebcba1){while(--_0xebcba1){_0x5108bf['push'](_0x5108bf['shift']());}};_0x343c7e(++_0x1e9b2a);}(_0x5331,0x122));var _0x1533=function(_0x803be2,_0x36a167){_0x803be2=_0x803be2-0x0;var _0x369d39=_0x5331[_0x803be2];return _0x369d39;};'use strict';var multer=require('multer');var util=require(_0x1533('0x0'));var path=require(_0x1533('0x1'));var timeout=require('connect-timeout');var express=require(_0x1533('0x2'));var router=express[_0x1533('0x3')]();var fs_extra=require(_0x1533('0x4'));var auth=require(_0x1533('0x5'));var interaction=require(_0x1533('0x6'));var config=require('../../config/environment');var controller=require(_0x1533('0x7'));router[_0x1533('0x8')]('/',auth[_0x1533('0x9')](),controller[_0x1533('0xa')]);router[_0x1533('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1533('0xb')]);router[_0x1533('0x8')](_0x1533('0xc'),auth[_0x1533('0x9')](),controller[_0x1533('0xd')]);router[_0x1533('0x8')](_0x1533('0xe'),auth['isAuthenticated'](),controller[_0x1533('0xf')]);router[_0x1533('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1533('0x10')](_0x1533('0xc'),auth['isAuthenticated'](),controller[_0x1533('0x11')]);router['put'](_0x1533('0x12'),auth[_0x1533('0x9')](),controller[_0x1533('0x13')]);router['delete'](_0x1533('0x12'),auth['isAuthenticated'](),controller[_0x1533('0x14')]);module[_0x1533('0x15')]=router; \ No newline at end of file +var _0xe7f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','index','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','/:id','destroy','exports'];(function(_0x20c3ea,_0x2bfdd4){var _0x571918=function(_0x4f6481){while(--_0x4f6481){_0x20c3ea['push'](_0x20c3ea['shift']());}};_0x571918(++_0x2bfdd4);}(_0xe7f4,0x170));var _0x4e7f=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xe7f4[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require(_0x4e7f('0x0'));var util=require(_0x4e7f('0x1'));var path=require(_0x4e7f('0x2'));var timeout=require(_0x4e7f('0x3'));var express=require('express');var router=express[_0x4e7f('0x4')]();var fs_extra=require(_0x4e7f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4e7f('0x6'));var config=require(_0x4e7f('0x7'));var controller=require(_0x4e7f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4e7f('0x9')]);router[_0x4e7f('0xa')]('/:id',auth[_0x4e7f('0xb')](),controller[_0x4e7f('0xc')]);router[_0x4e7f('0xa')](_0x4e7f('0xd'),auth[_0x4e7f('0xb')](),controller[_0x4e7f('0xe')]);router[_0x4e7f('0xa')](_0x4e7f('0xf'),auth['isAuthenticated'](),controller[_0x4e7f('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4e7f('0x11')](_0x4e7f('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4e7f('0x12')]('/:id',auth[_0x4e7f('0xb')](),controller[_0x4e7f('0x13')]);router['delete'](_0x4e7f('0x14'),auth['isAuthenticated'](),controller[_0x4e7f('0x15')]);module[_0x4e7f('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 7dcd74e..7341fbe 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 _0x694a=['STRING','sequelize','exports'];(function(_0x58e34d,_0x46e1ef){var _0x4d30d0=function(_0x1af022){while(--_0x1af022){_0x58e34d['push'](_0x58e34d['shift']());}};_0x4d30d0(++_0x46e1ef);}(_0x694a,0x13f));var _0xa694=function(_0x4361b6,_0x414635){_0x4361b6=_0x4361b6-0x0;var _0x4c6878=_0x694a[_0x4361b6];return _0x4c6878;};'use strict';var Sequelize=require(_0xa694('0x0'));module[_0xa694('0x1')]={'name':{'type':Sequelize[_0xa694('0x2')]},'username':{'type':Sequelize[_0xa694('0x2')]},'password':{'type':Sequelize[_0xa694('0x2')]},'remoteUri':{'type':Sequelize[_0xa694('0x2')]},'tenantId':{'type':Sequelize[_0xa694('0x2')]},'clientId':{'type':Sequelize[_0xa694('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa694('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3330=['exports','STRING','sequelize'];(function(_0x2e5001,_0x8871e6){var _0x5580a4=function(_0x4625d6){while(--_0x4625d6){_0x2e5001['push'](_0x2e5001['shift']());}};_0x5580a4(++_0x8871e6);}(_0x3330,0x1b5));var _0x0333=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x3330[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0x0333('0x0'));module[_0x0333('0x1')]={'name':{'type':Sequelize[_0x0333('0x2')]},'username':{'type':Sequelize[_0x0333('0x2')]},'password':{'type':Sequelize[_0x0333('0x2')]},'remoteUri':{'type':Sequelize[_0x0333('0x2')]},'tenantId':{'type':Sequelize[_0x0333('0x2')]},'clientId':{'type':Sequelize[_0x0333('0x2')]},'clientSecret':{'type':Sequelize[_0x0333('0x2')]},'serverUrl':{'type':Sequelize[_0x0333('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0333('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index d3e246e..69ddacc 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 _0xc999=['Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','Dynamics365Account','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','incident','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','rimraf','zip-dir','fast-json-patch','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xc999,0x176));var _0x9c99=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0xc999[_0x5275b8];return _0x568a9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c99('0x0'));var zipdir=require(_0x9c99('0x1'));var jsonpatch=require(_0x9c99('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9c99('0x3'));var path=require('path');var sox=require(_0x9c99('0x4'));var csv=require('to-csv');var ejs=require(_0x9c99('0x5'));var fs=require('fs');var fs_extra=require(_0x9c99('0x6'));var _=require(_0x9c99('0x7'));var squel=require('squel');var crypto=require(_0x9c99('0x8'));var jsforce=require(_0x9c99('0x9'));var deskjs=require(_0x9c99('0xa'));var toCsv=require(_0x9c99('0xb'));var querystring=require(_0x9c99('0xc'));var Papa=require(_0x9c99('0xd'));var Redis=require('ioredis');var authService=require(_0x9c99('0xe'));var qs=require(_0x9c99('0xf'));var as=require(_0x9c99('0x10'));var hardwareService=require(_0x9c99('0x11'));var logger=require('../../config/logger')(_0x9c99('0x12'));var utils=require(_0x9c99('0x13'));var config=require(_0x9c99('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c99('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4f0e8e,_0x2185bb){_0x2185bb=_0x2185bb||0xcc;return function(_0x2e754b){if(_0x2e754b){return _0x4f0e8e[_0x9c99('0x16')](_0x2185bb);}return _0x4f0e8e[_0x9c99('0x17')](_0x2185bb)['end']();};}function respondWithResult(_0x3246b,_0x5bc391){_0x5bc391=_0x5bc391||0xc8;return function(_0x5db87b){if(_0x5db87b){return _0x3246b['status'](_0x5bc391)[_0x9c99('0x18')](_0x5db87b);}};}function respondWithFilteredResult(_0x4dab0b,_0x534ef1){return function(_0x27425b){if(_0x27425b){var _0x52d565=typeof _0x534ef1['offset']===_0x9c99('0x19')&&typeof _0x534ef1[_0x9c99('0x1a')]==='undefined';var _0x34a89d=_0x27425b[_0x9c99('0x1b')];var _0x5eaa11=_0x52d565?0x0:_0x534ef1[_0x9c99('0x1c')];var _0x1cc5ea=_0x52d565?_0x27425b['count']:_0x534ef1['offset']+_0x534ef1['limit'];var _0x4f6e6d;if(_0x1cc5ea>=_0x34a89d){_0x1cc5ea=_0x34a89d;_0x4f6e6d=0xc8;}else{_0x4f6e6d=0xce;}_0x4dab0b[_0x9c99('0x17')](_0x4f6e6d);return _0x4dab0b[_0x9c99('0x1d')](_0x9c99('0x1e'),_0x5eaa11+'-'+_0x1cc5ea+'/'+_0x34a89d)[_0x9c99('0x18')](_0x27425b);}return null;};}function patchUpdates(_0x3628ba){return function(_0x271093){try{jsonpatch['apply'](_0x271093,_0x3628ba,!![]);}catch(_0x174610){return BPromise[_0x9c99('0x1f')](_0x174610);}return _0x271093[_0x9c99('0x20')]();};}function saveUpdates(_0x2c299e,_0x371a3a){return function(_0x248d93){if(_0x248d93){return _0x248d93[_0x9c99('0x21')](_0x2c299e)[_0x9c99('0x22')](function(_0x3a0f59){return _0x3a0f59;});}return null;};}function removeEntity(_0x38106a,_0x358b43){return function(_0x10c771){if(_0x10c771){return _0x10c771[_0x9c99('0x23')]()[_0x9c99('0x22')](function(){_0x38106a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x271224,_0x58e9fc){return function(_0x3081e6){if(!_0x3081e6){_0x271224['sendStatus'](0x194);}return _0x3081e6;};}function handleError(_0x24298e,_0x392f6d){_0x392f6d=_0x392f6d||0x1f4;return function(_0x1e33c9){logger[_0x9c99('0x24')](_0x1e33c9[_0x9c99('0x25')]);if(_0x1e33c9['name']){delete _0x1e33c9[_0x9c99('0x26')];}_0x24298e['status'](_0x392f6d)['send'](_0x1e33c9);};}exports[_0x9c99('0x27')]=function(_0xfe5d3a,_0x1ea282){var _0x14e0d4={},_0x236929={},_0x3027ef={'count':0x0,'rows':[]};var _0x4e765f=_[_0x9c99('0x28')](db['Dynamics365Account'][_0x9c99('0x29')],function(_0x5ee60c){return{'name':_0x5ee60c[_0x9c99('0x2a')],'type':_0x5ee60c[_0x9c99('0x2b')][_0x9c99('0x2c')]};});_0x236929[_0x9c99('0x2d')]=_[_0x9c99('0x28')](_0x4e765f,_0x9c99('0x26'));_0x236929[_0x9c99('0x2e')]=_[_0x9c99('0x2f')](_0xfe5d3a[_0x9c99('0x2e')]);_0x236929[_0x9c99('0x30')]=_[_0x9c99('0x31')](_0x236929[_0x9c99('0x2d')],_0x236929[_0x9c99('0x2e')]);_0x14e0d4[_0x9c99('0x32')]=_[_0x9c99('0x31')](_0x236929['model'],qs[_0x9c99('0x33')](_0xfe5d3a['query'][_0x9c99('0x33')]));_0x14e0d4[_0x9c99('0x32')]=_0x14e0d4['attributes'][_0x9c99('0x34')]?_0x14e0d4['attributes']:_0x236929[_0x9c99('0x2d')];if(!_0xfe5d3a[_0x9c99('0x2e')][_0x9c99('0x35')](_0x9c99('0x36'))){_0x14e0d4[_0x9c99('0x1a')]=qs[_0x9c99('0x1a')](_0xfe5d3a[_0x9c99('0x2e')][_0x9c99('0x1a')]);_0x14e0d4['offset']=qs['offset'](_0xfe5d3a[_0x9c99('0x2e')]['offset']);}_0x14e0d4['order']=qs[_0x9c99('0x37')](_0xfe5d3a[_0x9c99('0x2e')][_0x9c99('0x37')]);_0x14e0d4['where']=qs[_0x9c99('0x30')](_[_0x9c99('0x38')](_0xfe5d3a[_0x9c99('0x2e')],_0x236929['filters']),_0x4e765f);if(_0xfe5d3a[_0x9c99('0x2e')][_0x9c99('0x39')]){_0x14e0d4[_0x9c99('0x3a')]=_['merge'](_0x14e0d4[_0x9c99('0x3a')],{'$or':_[_0x9c99('0x28')](_0x4e765f,function(_0x581252){if(_0x581252[_0x9c99('0x2b')]!==_0x9c99('0x3b')){var _0x53ce81={};_0x53ce81[_0x581252['name']]={'$like':'%'+_0xfe5d3a[_0x9c99('0x2e')]['filter']+'%'};return _0x53ce81;}})});}_0x14e0d4=_[_0x9c99('0x3c')]({},_0x14e0d4,_0xfe5d3a[_0x9c99('0x3d')]);var _0x1b3134={'where':_0x14e0d4['where']};return db[_0x9c99('0x3e')][_0x9c99('0x1b')](_0x1b3134)[_0x9c99('0x22')](function(_0x5bbbaf){_0x3027ef['count']=_0x5bbbaf;if(_0xfe5d3a['query'][_0x9c99('0x3f')]){_0x14e0d4[_0x9c99('0x40')]=[{'all':!![]}];}return db[_0x9c99('0x3e')][_0x9c99('0x41')](_0x14e0d4);})[_0x9c99('0x22')](function(_0x3df966){_0x3027ef[_0x9c99('0x42')]=_0x3df966;return _0x3027ef;})[_0x9c99('0x22')](respondWithFilteredResult(_0x1ea282,_0x14e0d4))[_0x9c99('0x43')](handleError(_0x1ea282,null));};exports['show']=function(_0x45e65e,_0x33cee1){var _0x27e1d6={'raw':![],'where':{'id':_0x45e65e[_0x9c99('0x44')]['id']}},_0x3834d4={};_0x3834d4[_0x9c99('0x2d')]=_[_0x9c99('0x2f')](db[_0x9c99('0x3e')][_0x9c99('0x29')]);_0x3834d4[_0x9c99('0x2e')]=_[_0x9c99('0x2f')](_0x45e65e[_0x9c99('0x2e')]);_0x3834d4[_0x9c99('0x30')]=_[_0x9c99('0x31')](_0x3834d4[_0x9c99('0x2d')],_0x3834d4[_0x9c99('0x2e')]);_0x27e1d6['attributes']=_['intersection'](_0x3834d4['model'],qs['fields'](_0x45e65e[_0x9c99('0x2e')]['fields']));_0x27e1d6[_0x9c99('0x32')]=_0x27e1d6[_0x9c99('0x32')][_0x9c99('0x34')]?_0x27e1d6[_0x9c99('0x32')]:_0x3834d4[_0x9c99('0x2d')];if(_0x45e65e['query'][_0x9c99('0x3f')]){_0x27e1d6[_0x9c99('0x40')]=[{'all':!![]}];}_0x27e1d6=_[_0x9c99('0x3c')]({},_0x27e1d6,_0x45e65e[_0x9c99('0x3d')]);return db[_0x9c99('0x3e')][_0x9c99('0x45')](_0x27e1d6)['then'](handleEntityNotFound(_0x33cee1,null))[_0x9c99('0x22')](respondWithResult(_0x33cee1,null))[_0x9c99('0x43')](handleError(_0x33cee1,null));};exports[_0x9c99('0x46')]=function(_0x20baa2,_0x1ddda7){return db[_0x9c99('0x3e')][_0x9c99('0x46')](_0x20baa2[_0x9c99('0x47')],{})[_0x9c99('0x22')](respondWithResult(_0x1ddda7,0xc9))[_0x9c99('0x43')](handleError(_0x1ddda7,null));};exports[_0x9c99('0x21')]=function(_0x3212cc,_0x4b4630){if(_0x3212cc[_0x9c99('0x47')]['id']){delete _0x3212cc[_0x9c99('0x47')]['id'];}return db[_0x9c99('0x3e')][_0x9c99('0x45')]({'where':{'id':_0x3212cc['params']['id']}})[_0x9c99('0x22')](handleEntityNotFound(_0x4b4630,null))[_0x9c99('0x22')](saveUpdates(_0x3212cc['body'],null))[_0x9c99('0x22')](respondWithResult(_0x4b4630,null))[_0x9c99('0x43')](handleError(_0x4b4630,null));};exports[_0x9c99('0x23')]=function(_0x13fed8,_0x387735){return db['Dynamics365Account'][_0x9c99('0x45')]({'where':{'id':_0x13fed8['params']['id']}})[_0x9c99('0x22')](handleEntityNotFound(_0x387735,null))['then'](removeEntity(_0x387735,null))['catch'](handleError(_0x387735,null));};exports[_0x9c99('0x48')]=function(_0x4cfbec,_0x14c745,_0x54c543){var _0x30bd63={};var _0x35733c={};var _0x5699cf;var _0x306a09;return db[_0x9c99('0x3e')][_0x9c99('0x49')]({'where':{'id':_0x4cfbec[_0x9c99('0x44')]['id']}})[_0x9c99('0x22')](handleEntityNotFound(_0x14c745,null))[_0x9c99('0x22')](function(_0x594f3c){if(_0x594f3c){_0x5699cf=_0x594f3c;_0x35733c[_0x9c99('0x2d')]=_[_0x9c99('0x2f')](db['Dynamics365Configuration'][_0x9c99('0x29')]);_0x35733c['query']=_[_0x9c99('0x2f')](_0x4cfbec['query']);_0x35733c[_0x9c99('0x30')]=_[_0x9c99('0x31')](_0x35733c[_0x9c99('0x2d')],_0x35733c['query']);_0x30bd63[_0x9c99('0x32')]=_['intersection'](_0x35733c[_0x9c99('0x2d')],qs[_0x9c99('0x33')](_0x4cfbec['query'][_0x9c99('0x33')]));_0x30bd63['attributes']=_0x30bd63[_0x9c99('0x32')][_0x9c99('0x34')]?_0x30bd63[_0x9c99('0x32')]:_0x35733c[_0x9c99('0x2d')];_0x30bd63[_0x9c99('0x4a')]=qs[_0x9c99('0x37')](_0x4cfbec[_0x9c99('0x2e')][_0x9c99('0x37')]);_0x30bd63[_0x9c99('0x3a')]=qs[_0x9c99('0x30')](_[_0x9c99('0x38')](_0x4cfbec[_0x9c99('0x2e')],_0x35733c[_0x9c99('0x30')]));if(_0x4cfbec['query'][_0x9c99('0x39')]){_0x30bd63[_0x9c99('0x3a')]=_['merge'](_0x30bd63[_0x9c99('0x3a')],{'$or':_[_0x9c99('0x28')](_0x30bd63[_0x9c99('0x32')],function(_0x261e69){var _0x430719={};_0x430719[_0x261e69]={'$like':'%'+_0x4cfbec['query']['filter']+'%'};return _0x430719;})});}_0x30bd63=_[_0x9c99('0x3c')]({},_0x30bd63,_0x4cfbec['options']);return _0x5699cf['getConfigurations'](_0x30bd63);}})[_0x9c99('0x22')](function(_0x533d29){if(_0x533d29){_0x306a09=_0x533d29['length'];if(!_0x4cfbec['query']['hasOwnProperty']('nolimit')){_0x30bd63[_0x9c99('0x1a')]=qs['limit'](_0x4cfbec[_0x9c99('0x2e')][_0x9c99('0x1a')]);_0x30bd63[_0x9c99('0x1c')]=qs[_0x9c99('0x1c')](_0x4cfbec[_0x9c99('0x2e')][_0x9c99('0x1c')]);}return _0x5699cf[_0x9c99('0x48')](_0x30bd63);}})['then'](function(_0x480e3c){if(_0x480e3c){return _0x480e3c?{'count':_0x306a09,'rows':_0x480e3c}:null;}})['then'](respondWithResult(_0x14c745,null))[_0x9c99('0x43')](handleError(_0x14c745,null));};exports[_0x9c99('0x4b')]=function(_0x397002,_0x2725ec,_0x96d187){if(_0x397002[_0x9c99('0x47')]['id']){delete _0x397002[_0x9c99('0x47')]['id'];}return db[_0x9c99('0x3e')][_0x9c99('0x49')]({'where':{'id':_0x397002['params']['id']}})[_0x9c99('0x22')](handleEntityNotFound(_0x2725ec,null))[_0x9c99('0x22')](function(_0xc97193){if(_0xc97193){_0x397002['body'][_0x9c99('0x4c')]=_0xc97193['id'];_0x397002['body'][_0x9c99('0x4d')]=integrations['getSubjects'](_0x397002[_0x9c99('0x47')][_0x9c99('0x4e')],_0x397002['body'][_0x9c99('0x2b')]);_0x397002[_0x9c99('0x47')][_0x9c99('0x4f')]=integrations[_0x9c99('0x50')](_0x397002['body'][_0x9c99('0x4e')],_0x397002[_0x9c99('0x47')][_0x9c99('0x2b')]);return db['Dynamics365Configuration']['create'](_0x397002[_0x9c99('0x47')],{'include':[{'model':db[_0x9c99('0x51')],'as':_0x9c99('0x4d')},{'model':db[_0x9c99('0x51')],'as':'Descriptions'}]});}return null;})[_0x9c99('0x22')](respondWithResult(_0x2725ec,null))['catch'](handleError(_0x2725ec,null));};exports['getFields']=function(_0x54355b,_0x55646b,_0x40a942){var _0xe7b8eb=_0x54355b['query']['ticketType'];var _0x4786fb=_0xe7b8eb===_0x9c99('0x52')?_0x9c99('0x53'):_0x9c99('0x54');var _0x3211f1='';var _0x55e5c2='';var _0xa617aa='';var _0x1e3f10='';var _0x405f55='';var _0x2a7776='';var _0x3dcc8b='';var _0x4ca9e5='';var _0x2c8ef7=[_0x9c99('0x55'),_0x9c99('0x56'),'customerid',_0x9c99('0x57'),_0x9c99('0x58'),_0x9c99('0x59'),'phonenumber','regardingobjectid',_0x9c99('0x5a'),_0x9c99('0x5b')];var _0x2a6048=['accountidname',_0x9c99('0x5c'),_0x9c99('0x5d'),_0x9c99('0x5e'),'contactidname','contactidyominame',_0x9c99('0x5f'),_0x9c99('0x60'),'createdbyexternalpartyname',_0x9c99('0x61'),_0x9c99('0x62'),'createdbyyominame',_0x9c99('0x63'),'createdonbehalfbyname',_0x9c99('0x64'),'customeridname',_0x9c99('0x65'),'customeridyominame',_0x9c99('0x66'),_0x9c99('0x67'),_0x9c99('0x68'),_0x9c99('0x69'),_0x9c99('0x6a'),_0x9c99('0x6b'),_0x9c99('0x6c'),_0x9c99('0x6d'),_0x9c99('0x6e'),_0x9c99('0x6f'),'kbarticleidname','lastonholdtime',_0x9c99('0x70'),'modifiedbyexternalpartyname',_0x9c99('0x71'),_0x9c99('0x72'),_0x9c99('0x73'),_0x9c99('0x74'),'modifiedonbehalfbyname',_0x9c99('0x75'),_0x9c99('0x76'),_0x9c99('0x77'),_0x9c99('0x78'),_0x9c99('0x79'),_0x9c99('0x7a'),'owneridname',_0x9c99('0x7b'),'owneridyominame',_0x9c99('0x7c'),_0x9c99('0x7d'),_0x9c99('0x7e'),_0x9c99('0x7f'),_0x9c99('0x80'),_0x9c99('0x81'),_0x9c99('0x82'),_0x9c99('0x83'),_0x9c99('0x84'),_0x9c99('0x85'),_0x9c99('0x86'),_0x9c99('0x87'),_0x9c99('0x88'),_0x9c99('0x89'),'socialprofileidname','statecode',_0x9c99('0x8a'),_0x9c99('0x8b'),_0x9c99('0x8c'),_0x9c99('0x8d'),_0x9c99('0x8e'),'traversedpath',_0x9c99('0x8f'),_0x9c99('0x90')];var _0x349f3a=_0x2c8ef7[_0x9c99('0x91')](_0x2a6048);return db[_0x9c99('0x3e')][_0x9c99('0x49')]({'where':{'id':_0x54355b['params']['id']},'attributes':['id',_0x9c99('0x92'),_0x9c99('0x93'),_0x9c99('0x94'),_0x9c99('0x95'),'clientId',_0x9c99('0x96')]})[_0x9c99('0x22')](handleEntityNotFound(_0x55646b,null))[_0x9c99('0x22')](function(_0x43eba9){if(_0x43eba9){_0x4ca9e5=_0x43eba9[_0x9c99('0x94')];var _0x51a01f=_0x4ca9e5[_0x9c99('0x97')](-0x1);if(_0x51a01f==='/'){_0x4ca9e5=_0x4ca9e5['substring'](0x0,_0x4ca9e5[_0x9c99('0x98')](_0x51a01f));}_0x3dcc8b=util[_0x9c99('0x99')](_0x9c99('0x9a'),_0x4ca9e5);var _0x3e3b9c={'method':_0x9c99('0x9b'),'uri':'https://login.microsoftonline.com/'+_0x43eba9[_0x9c99('0x95')]+'/oauth2/token','form':{'client_id':_0x43eba9[_0x9c99('0x9c')],'resource':_0x4ca9e5,'username':_0x43eba9['username'],'password':_0x43eba9[_0x9c99('0x93')],'grant_type':_0x9c99('0x93'),'client_secret':_0x43eba9[_0x9c99('0x96')]},'json':!![]};return rp(_0x3e3b9c);}})[_0x9c99('0x22')](function(_0x4878cf){_0x2a7776=_0x4878cf['access_token'];var _0x3fc8c5={'method':_0x9c99('0x9d'),'uri':encodeURI(_0x3dcc8b+_0x9c99('0x9e')+_0x4786fb+'\x27'),'headers':{'Authorization':_0x9c99('0x9f')+_0x2a7776,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3fc8c5);})[_0x9c99('0x22')](function(_0x2d2bce){var _0x56ad39=_0x2d2bce[_0x9c99('0xa0')][0x0];var _0x5ad3d2=_0x56ad39[_0x9c99('0xa1')];var _0x34dba2={'method':'GET','uri':_0x3dcc8b+_0x9c99('0xa2')+_0x5ad3d2+_0x9c99('0xa3'),'headers':{'Authorization':_0x9c99('0x9f')+_0x2a7776,'If-None-Match':null,'OData-Version':_0x9c99('0xa4')},'json':!![]};return rp(_0x34dba2);})[_0x9c99('0x22')](function(_0x4d4011){_0x3211f1=_0x4d4011;_0x55e5c2=_0x3211f1['Attributes'];_0x55e5c2=_['remove'](_0x55e5c2,function(_0x1ad9ae){return!_0x349f3a[_0x9c99('0xa5')](_0x1ad9ae[_0x9c99('0xa6')]);});var _0x33e5cc=[];var _0x2a4f4a=[];_0x55e5c2[_0x9c99('0xa7')](function(_0x29c536){if(_0x29c536['@odata.type']){var _0x45938b=_0x29c536[_0x9c99('0xa8')][_0x9c99('0xa9')](_0x29c536[_0x9c99('0xa8')]['lastIndexOf']('.')+0x1);if(_0x45938b===_0x9c99('0xaa')){_0x33e5cc[_0x9c99('0xab')](getSelectList(_0x3dcc8b,_0xe7b8eb,_0x2a4f4a,_0x3211f1['MetadataId'],_0x29c536[_0x9c99('0xa1')],_0x2a7776));}}});return Promise[_0x9c99('0xac')](_0x33e5cc);})[_0x9c99('0x22')](function(_0x5b1dfc){_0xa617aa=_0x5b1dfc[0x0];var _0xf4f9fa=[];var _0x3b51c1=[];_0x55e5c2[_0x9c99('0xa7')](function(_0x2b1f8d){if(!_[_0x9c99('0xad')](_0x2b1f8d[_0x9c99('0xa8')])){var _0x1138a6=_0x2b1f8d['@odata.type'][_0x9c99('0xa9')](_0x2b1f8d['@odata.type'][_0x9c99('0x98')]('.')+0x1);if(_0x1138a6===_0x9c99('0xae')){_0xf4f9fa[_0x9c99('0xab')](getBooleanList(_0x3dcc8b,_0xe7b8eb,_0x3b51c1,_0x3211f1['MetadataId'],_0x2b1f8d[_0x9c99('0xa1')],_0x2a7776));}}});return Promise[_0x9c99('0xac')](_0xf4f9fa);})[_0x9c99('0x22')](function(_0x34da53){_0x1e3f10=_0x34da53[0x0];var _0xe76db8=[];var _0x243bb7=[];_0x55e5c2['forEach'](function(_0x5cd2e3){if(_0x5cd2e3[_0x9c99('0xa8')]){var _0xa2f2fd=_0x5cd2e3[_0x9c99('0xa8')][_0x9c99('0xa9')](_0x5cd2e3[_0x9c99('0xa8')]['lastIndexOf']('.')+0x1);if(_0xa2f2fd===_0x9c99('0xaf')||_0xa2f2fd===_0x9c99('0xb0')||_0xa2f2fd===_0x9c99('0xb1')||_0xa2f2fd==='IntegerAttributeMetadata'||_0xa2f2fd===_0x9c99('0xb2')||_0xa2f2fd===_0x9c99('0xb3')||_0xa2f2fd===_0x9c99('0xb4')||_0xa2f2fd===_0x9c99('0xb5')||_0xa2f2fd===_0x9c99('0xb6')||_0xa2f2fd===_0x9c99('0xb7')){_0xe76db8[_0x9c99('0xab')](getInputList(_0x3dcc8b,_0xe7b8eb,_0xa2f2fd,_0x243bb7,_0x3211f1[_0x9c99('0xa1')],_0x5cd2e3['MetadataId'],_0x2a7776));}}});return Promise[_0x9c99('0xac')](_0xe76db8);})[_0x9c99('0x22')](function(_0x289339){_0x405f55=_0x289339[0x0];var _0x55a011=_0xa617aa[_0x9c99('0x91')](_0x1e3f10)['concat'](_0x405f55);var _0x3e07f1={'count':_0x55a011[_0x9c99('0x34')],'rows':_0x55a011};return _0x3e07f1;})['then'](respondWithResult(_0x55646b,null))[_0x9c99('0x43')](function(_0x2f116a){var _0x26778e=_0x54355b[_0x9c99('0x2e')][_0x9c99('0xb8')]?0x1f4:_0x2f116a[_0x9c99('0xb9')]||0x1f4;logger[_0x9c99('0x24')](_0x2f116a[_0x9c99('0x25')]);delete _0x2f116a[_0x9c99('0x26')];if(_0x26778e===0x191){_0x26778e=0x190;}_0x55646b['status'](_0x26778e)[_0x9c99('0xba')](_0x54355b[_0x9c99('0x2e')][_0x9c99('0xb8')]?{'message':_0x9c99('0xbb'),'statusCode':_0x2f116a[_0x9c99('0xb9')]}:_0x2f116a);});};function getSelectList(_0x3182a8,_0x4f7a9e,_0x5675ea,_0x2935e8,_0x49e507,_0x4bea7e){var _0x62c53c={'method':_0x9c99('0x9d'),'uri':_0x3182a8+'EntityDefinitions('+_0x2935e8+_0x9c99('0xbc')+_0x49e507+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x9c99('0xbd'),'headers':{'Authorization':_0x9c99('0x9f')+_0x4bea7e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x62c53c)[_0x9c99('0x22')](function(_0x6dcfa2){var _0x120ea6=[];var _0xe32d18=_0x6dcfa2['OptionSet'][_0x9c99('0xbe')];_0xe32d18['forEach'](function(_0x482910){_0x120ea6[_0x9c99('0xab')]({'name':_0x482910[_0x9c99('0xbf')][_0x9c99('0xc0')][_0x9c99('0xbf')],'value':String(_0x482910[_0x9c99('0xc1')])});});var _0x31dd6c={'id':_0x4f7a9e+'_'+_0x6dcfa2['LogicalName'],'name':_0x6dcfa2['DisplayName'][_0x9c99('0xc0')][_0x9c99('0xbf')],'custom':![],'options':_0x120ea6};_0x5675ea[_0x9c99('0xab')](_0x31dd6c);return _0x5675ea;});}function getBooleanList(_0x39df45,_0x1b4bd4,_0x4ba2e3,_0x1fff9d,_0x21c500,_0x453654){var _0x5b640a={'method':'GET','uri':_0x39df45+'EntityDefinitions('+_0x1fff9d+')/Attributes('+_0x21c500+_0x9c99('0xc2'),'headers':{'Authorization':_0x9c99('0x9f')+_0x453654,'If-None-Match':null,'OData-Version':_0x9c99('0xa4')},'json':!![]};return rp(_0x5b640a)[_0x9c99('0x22')](function(_0x479b82){var _0x31b219=[];_0x31b219['push']({'name':_0x479b82[_0x9c99('0xc3')][_0x9c99('0xc4')][_0x9c99('0xbf')]['UserLocalizedLabel'][_0x9c99('0xbf')],'value':_0x9c99('0xc5')},{'name':_0x479b82[_0x9c99('0xc3')][_0x9c99('0xc6')][_0x9c99('0xbf')][_0x9c99('0xc0')][_0x9c99('0xbf')],'value':'false'});var _0x36a003={'id':_0x1b4bd4+'_'+_0x479b82['LogicalName'],'name':_0x479b82[_0x9c99('0xc7')][_0x9c99('0xc0')][_0x9c99('0xbf')],'custom':![],'options':_0x31b219};_0x4ba2e3[_0x9c99('0xab')](_0x36a003);return _0x4ba2e3;});}function getInputList(_0x33b888,_0x310ead,_0x4967b1,_0x13d307,_0x44a677,_0xd4ba1b,_0xaf0f1){var _0x5ad136={'method':_0x9c99('0x9d'),'uri':_0x33b888+_0x9c99('0xa2')+_0x44a677+_0x9c99('0xbc')+_0xd4ba1b+_0x9c99('0xc8')+_0x4967b1+_0x9c99('0xc9'),'headers':{'Authorization':_0x9c99('0x9f')+_0xaf0f1,'If-None-Match':null,'OData-Version':_0x9c99('0xa4')},'json':!![]};return rp(_0x5ad136)[_0x9c99('0x22')](function(_0x10000d){var _0x4f7435={'id':_0x310ead+'_'+_0x10000d['LogicalName'],'name':_0x10000d['DisplayName'][_0x9c99('0xc0')]?_0x10000d['DisplayName'][_0x9c99('0xc0')][_0x9c99('0xbf')]:_0x10000d[_0x9c99('0xa6')],'custom':![],'options':[]};_0x13d307['push'](_0x4f7435);return _0x13d307;});} \ No newline at end of file +var _0xc1c4=['username','password','remoteUri','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','tenantId','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','LogicalName','true','FalseOption','?$select=DisplayName,LogicalName','DisplayName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Dynamics365Account','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidyominame','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat'];(function(_0x39a5bb,_0x4cf0e8){var _0x85661f=function(_0x4d8d72){while(--_0x4d8d72){_0x39a5bb['push'](_0x39a5bb['shift']());}};_0x85661f(++_0x4cf0e8);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x9fbde1,_0x5940af){_0x9fbde1=_0x9fbde1-0x0;var _0x3c1d8b=_0xc1c4[_0x9fbde1];return _0x3c1d8b;};'use strict';var emlformat=require(_0x4c1c('0x0'));var rimraf=require(_0x4c1c('0x1'));var zipdir=require(_0x4c1c('0x2'));var jsonpatch=require(_0x4c1c('0x3'));var rp=require(_0x4c1c('0x4'));var moment=require(_0x4c1c('0x5'));var BPromise=require(_0x4c1c('0x6'));var Mustache=require('mustache');var util=require(_0x4c1c('0x7'));var path=require(_0x4c1c('0x8'));var sox=require(_0x4c1c('0x9'));var csv=require(_0x4c1c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c1c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4c1c('0xc'));var jsforce=require(_0x4c1c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4c1c('0xa'));var querystring=require(_0x4c1c('0xe'));var Papa=require(_0x4c1c('0xf'));var Redis=require(_0x4c1c('0x10'));var authService=require(_0x4c1c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c1c('0x12'));var logger=require(_0x4c1c('0x13'))(_0x4c1c('0x14'));var utils=require(_0x4c1c('0x15'));var config=require(_0x4c1c('0x16'));var licenseUtil=require(_0x4c1c('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x7fbeb0,_0x18c3e7){_0x18c3e7=_0x18c3e7||0xcc;return function(_0x24eb14){if(_0x24eb14){return _0x7fbeb0[_0x4c1c('0x18')](_0x18c3e7);}return _0x7fbeb0[_0x4c1c('0x19')](_0x18c3e7)['end']();};}function respondWithResult(_0x160ee0,_0x53123e){_0x53123e=_0x53123e||0xc8;return function(_0x4deafc){if(_0x4deafc){return _0x160ee0[_0x4c1c('0x19')](_0x53123e)[_0x4c1c('0x1a')](_0x4deafc);}};}function respondWithFilteredResult(_0x3e37a7,_0x3fde68){return function(_0x3b71de){if(_0x3b71de){var _0x25eec0=typeof _0x3fde68[_0x4c1c('0x1b')]===_0x4c1c('0x1c')&&typeof _0x3fde68[_0x4c1c('0x1d')]===_0x4c1c('0x1c');var _0x26b407=_0x3b71de['count'];var _0x1fad89=_0x25eec0?0x0:_0x3fde68[_0x4c1c('0x1b')];var _0x64fe4b=_0x25eec0?_0x3b71de[_0x4c1c('0x1e')]:_0x3fde68[_0x4c1c('0x1b')]+_0x3fde68[_0x4c1c('0x1d')];var _0x22b52a;if(_0x64fe4b>=_0x26b407){_0x64fe4b=_0x26b407;_0x22b52a=0xc8;}else{_0x22b52a=0xce;}_0x3e37a7[_0x4c1c('0x19')](_0x22b52a);return _0x3e37a7[_0x4c1c('0x1f')](_0x4c1c('0x20'),_0x1fad89+'-'+_0x64fe4b+'/'+_0x26b407)['json'](_0x3b71de);}return null;};}function patchUpdates(_0x5a22be){return function(_0x3652e7){try{jsonpatch['apply'](_0x3652e7,_0x5a22be,!![]);}catch(_0x469def){return BPromise[_0x4c1c('0x21')](_0x469def);}return _0x3652e7['save']();};}function saveUpdates(_0x23377c,_0x4956e0){return function(_0x51cac7){if(_0x51cac7){return _0x51cac7[_0x4c1c('0x22')](_0x23377c)[_0x4c1c('0x23')](function(_0x33b41b){return _0x33b41b;});}return null;};}function removeEntity(_0x13c2a1,_0x3117d2){return function(_0x5cb64e){if(_0x5cb64e){return _0x5cb64e[_0x4c1c('0x24')]()[_0x4c1c('0x23')](function(){_0x13c2a1[_0x4c1c('0x19')](0xcc)[_0x4c1c('0x25')]();});}};}function handleEntityNotFound(_0x27f648,_0x4a1e7c){return function(_0x577e68){if(!_0x577e68){_0x27f648[_0x4c1c('0x18')](0x194);}return _0x577e68;};}function handleError(_0x4c9b2c,_0x1104d4){_0x1104d4=_0x1104d4||0x1f4;return function(_0x4e96b7){logger[_0x4c1c('0x26')](_0x4e96b7[_0x4c1c('0x27')]);if(_0x4e96b7[_0x4c1c('0x28')]){delete _0x4e96b7['name'];}_0x4c9b2c[_0x4c1c('0x19')](_0x1104d4)[_0x4c1c('0x29')](_0x4e96b7);};}exports[_0x4c1c('0x2a')]=function(_0xb1e9b5,_0xd9122d){var _0x281286={},_0x3ab2cb={},_0x20e2b8={'count':0x0,'rows':[]};var _0x4966a0=_['map'](db['Dynamics365Account']['rawAttributes'],function(_0x595f1b){return{'name':_0x595f1b[_0x4c1c('0x2b')],'type':_0x595f1b[_0x4c1c('0x2c')]['key']};});_0x3ab2cb[_0x4c1c('0x2d')]=_[_0x4c1c('0x2e')](_0x4966a0,'name');_0x3ab2cb['query']=_[_0x4c1c('0x2f')](_0xb1e9b5[_0x4c1c('0x30')]);_0x3ab2cb[_0x4c1c('0x31')]=_['intersection'](_0x3ab2cb['model'],_0x3ab2cb[_0x4c1c('0x30')]);_0x281286[_0x4c1c('0x32')]=_[_0x4c1c('0x33')](_0x3ab2cb[_0x4c1c('0x2d')],qs[_0x4c1c('0x34')](_0xb1e9b5['query'][_0x4c1c('0x34')]));_0x281286[_0x4c1c('0x32')]=_0x281286['attributes'][_0x4c1c('0x35')]?_0x281286[_0x4c1c('0x32')]:_0x3ab2cb['model'];if(!_0xb1e9b5[_0x4c1c('0x30')][_0x4c1c('0x36')](_0x4c1c('0x37'))){_0x281286[_0x4c1c('0x1d')]=qs['limit'](_0xb1e9b5['query']['limit']);_0x281286[_0x4c1c('0x1b')]=qs[_0x4c1c('0x1b')](_0xb1e9b5[_0x4c1c('0x30')]['offset']);}_0x281286[_0x4c1c('0x38')]=qs['sort'](_0xb1e9b5[_0x4c1c('0x30')][_0x4c1c('0x39')]);_0x281286[_0x4c1c('0x3a')]=qs[_0x4c1c('0x31')](_[_0x4c1c('0x3b')](_0xb1e9b5[_0x4c1c('0x30')],_0x3ab2cb[_0x4c1c('0x31')]),_0x4966a0);if(_0xb1e9b5[_0x4c1c('0x30')][_0x4c1c('0x3c')]){_0x281286[_0x4c1c('0x3a')]=_[_0x4c1c('0x3d')](_0x281286[_0x4c1c('0x3a')],{'$or':_[_0x4c1c('0x2e')](_0x4966a0,function(_0x12fbd1){if(_0x12fbd1[_0x4c1c('0x2c')]!==_0x4c1c('0x3e')){var _0x55434e={};_0x55434e[_0x12fbd1['name']]={'$like':'%'+_0xb1e9b5[_0x4c1c('0x30')]['filter']+'%'};return _0x55434e;}})});}_0x281286=_[_0x4c1c('0x3d')]({},_0x281286,_0xb1e9b5[_0x4c1c('0x3f')]);var _0x2f39a0={'where':_0x281286[_0x4c1c('0x3a')]};return db['Dynamics365Account'][_0x4c1c('0x1e')](_0x2f39a0)[_0x4c1c('0x23')](function(_0x24576a){_0x20e2b8['count']=_0x24576a;if(_0xb1e9b5[_0x4c1c('0x30')][_0x4c1c('0x40')]){_0x281286[_0x4c1c('0x41')]=[{'all':!![]}];}return db[_0x4c1c('0x42')][_0x4c1c('0x43')](_0x281286);})[_0x4c1c('0x23')](function(_0x25ddea){_0x20e2b8[_0x4c1c('0x44')]=_0x25ddea;return _0x20e2b8;})['then'](respondWithFilteredResult(_0xd9122d,_0x281286))[_0x4c1c('0x45')](handleError(_0xd9122d,null));};exports[_0x4c1c('0x46')]=function(_0x203c61,_0x16f95c){var _0x5d775e={'raw':![],'where':{'id':_0x203c61[_0x4c1c('0x47')]['id']}},_0x752da9={};_0x752da9[_0x4c1c('0x2d')]=_[_0x4c1c('0x2f')](db['Dynamics365Account']['rawAttributes']);_0x752da9[_0x4c1c('0x30')]=_['keys'](_0x203c61[_0x4c1c('0x30')]);_0x752da9[_0x4c1c('0x31')]=_[_0x4c1c('0x33')](_0x752da9['model'],_0x752da9[_0x4c1c('0x30')]);_0x5d775e[_0x4c1c('0x32')]=_[_0x4c1c('0x33')](_0x752da9['model'],qs[_0x4c1c('0x34')](_0x203c61[_0x4c1c('0x30')][_0x4c1c('0x34')]));_0x5d775e[_0x4c1c('0x32')]=_0x5d775e[_0x4c1c('0x32')]['length']?_0x5d775e[_0x4c1c('0x32')]:_0x752da9['model'];if(_0x203c61[_0x4c1c('0x30')][_0x4c1c('0x40')]){_0x5d775e[_0x4c1c('0x41')]=[{'all':!![]}];}_0x5d775e=_[_0x4c1c('0x3d')]({},_0x5d775e,_0x203c61[_0x4c1c('0x3f')]);return db['Dynamics365Account'][_0x4c1c('0x48')](_0x5d775e)['then'](handleEntityNotFound(_0x16f95c,null))['then'](respondWithResult(_0x16f95c,null))[_0x4c1c('0x45')](handleError(_0x16f95c,null));};exports[_0x4c1c('0x49')]=function(_0x545529,_0x59e41a){return db[_0x4c1c('0x42')][_0x4c1c('0x49')](_0x545529[_0x4c1c('0x4a')],{})['then'](respondWithResult(_0x59e41a,0xc9))[_0x4c1c('0x45')](handleError(_0x59e41a,null));};exports['update']=function(_0x32117a,_0x2dde8f){if(_0x32117a[_0x4c1c('0x4a')]['id']){delete _0x32117a[_0x4c1c('0x4a')]['id'];}return db['Dynamics365Account'][_0x4c1c('0x48')]({'where':{'id':_0x32117a[_0x4c1c('0x47')]['id']}})[_0x4c1c('0x23')](handleEntityNotFound(_0x2dde8f,null))[_0x4c1c('0x23')](saveUpdates(_0x32117a['body'],null))['then'](respondWithResult(_0x2dde8f,null))['catch'](handleError(_0x2dde8f,null));};exports[_0x4c1c('0x24')]=function(_0x37e8d8,_0x3888b5){return db[_0x4c1c('0x42')][_0x4c1c('0x48')]({'where':{'id':_0x37e8d8[_0x4c1c('0x47')]['id']}})[_0x4c1c('0x23')](handleEntityNotFound(_0x3888b5,null))[_0x4c1c('0x23')](removeEntity(_0x3888b5,null))['catch'](handleError(_0x3888b5,null));};exports[_0x4c1c('0x4b')]=function(_0x3eda79,_0x2fbaee,_0xbe15e){var _0x451ed6={};var _0x49eb80={};var _0x131ba4;var _0x5ab8bb;return db[_0x4c1c('0x42')][_0x4c1c('0x4c')]({'where':{'id':_0x3eda79[_0x4c1c('0x47')]['id']}})[_0x4c1c('0x23')](handleEntityNotFound(_0x2fbaee,null))[_0x4c1c('0x23')](function(_0x295d2f){if(_0x295d2f){_0x131ba4=_0x295d2f;_0x49eb80['model']=_['keys'](db[_0x4c1c('0x4d')][_0x4c1c('0x4e')]);_0x49eb80['query']=_['keys'](_0x3eda79[_0x4c1c('0x30')]);_0x49eb80[_0x4c1c('0x31')]=_[_0x4c1c('0x33')](_0x49eb80[_0x4c1c('0x2d')],_0x49eb80[_0x4c1c('0x30')]);_0x451ed6[_0x4c1c('0x32')]=_[_0x4c1c('0x33')](_0x49eb80[_0x4c1c('0x2d')],qs['fields'](_0x3eda79[_0x4c1c('0x30')]['fields']));_0x451ed6['attributes']=_0x451ed6['attributes'][_0x4c1c('0x35')]?_0x451ed6['attributes']:_0x49eb80['model'];_0x451ed6['order']=qs[_0x4c1c('0x39')](_0x3eda79[_0x4c1c('0x30')][_0x4c1c('0x39')]);_0x451ed6[_0x4c1c('0x3a')]=qs['filters'](_['pick'](_0x3eda79[_0x4c1c('0x30')],_0x49eb80[_0x4c1c('0x31')]));if(_0x3eda79[_0x4c1c('0x30')]['filter']){_0x451ed6[_0x4c1c('0x3a')]=_[_0x4c1c('0x3d')](_0x451ed6[_0x4c1c('0x3a')],{'$or':_[_0x4c1c('0x2e')](_0x451ed6[_0x4c1c('0x32')],function(_0x4638ee){var _0x357767={};_0x357767[_0x4638ee]={'$like':'%'+_0x3eda79[_0x4c1c('0x30')][_0x4c1c('0x3c')]+'%'};return _0x357767;})});}_0x451ed6=_[_0x4c1c('0x3d')]({},_0x451ed6,_0x3eda79[_0x4c1c('0x3f')]);return _0x131ba4[_0x4c1c('0x4b')](_0x451ed6);}})[_0x4c1c('0x23')](function(_0x1e0bf7){if(_0x1e0bf7){_0x5ab8bb=_0x1e0bf7[_0x4c1c('0x35')];if(!_0x3eda79[_0x4c1c('0x30')][_0x4c1c('0x36')]('nolimit')){_0x451ed6[_0x4c1c('0x1d')]=qs['limit'](_0x3eda79['query']['limit']);_0x451ed6[_0x4c1c('0x1b')]=qs[_0x4c1c('0x1b')](_0x3eda79[_0x4c1c('0x30')][_0x4c1c('0x1b')]);}return _0x131ba4[_0x4c1c('0x4b')](_0x451ed6);}})[_0x4c1c('0x23')](function(_0x564054){if(_0x564054){return _0x564054?{'count':_0x5ab8bb,'rows':_0x564054}:null;}})[_0x4c1c('0x23')](respondWithResult(_0x2fbaee,null))['catch'](handleError(_0x2fbaee,null));};exports[_0x4c1c('0x4f')]=function(_0x379991,_0xf0c699,_0x5afa48){if(_0x379991[_0x4c1c('0x4a')]['id']){delete _0x379991['body']['id'];}return db[_0x4c1c('0x42')]['findOne']({'where':{'id':_0x379991['params']['id']}})[_0x4c1c('0x23')](handleEntityNotFound(_0xf0c699,null))[_0x4c1c('0x23')](function(_0x232b01){if(_0x232b01){_0x379991[_0x4c1c('0x4a')][_0x4c1c('0x50')]=_0x232b01['id'];_0x379991[_0x4c1c('0x4a')][_0x4c1c('0x51')]=integrations[_0x4c1c('0x52')](_0x379991[_0x4c1c('0x4a')]['channel'],_0x379991['body'][_0x4c1c('0x2c')]);_0x379991[_0x4c1c('0x4a')][_0x4c1c('0x53')]=integrations[_0x4c1c('0x54')](_0x379991[_0x4c1c('0x4a')][_0x4c1c('0x55')],_0x379991[_0x4c1c('0x4a')][_0x4c1c('0x2c')]);return db[_0x4c1c('0x4d')][_0x4c1c('0x49')](_0x379991[_0x4c1c('0x4a')],{'include':[{'model':db[_0x4c1c('0x56')],'as':_0x4c1c('0x51')},{'model':db[_0x4c1c('0x56')],'as':_0x4c1c('0x53')}]});}return null;})[_0x4c1c('0x23')](respondWithResult(_0xf0c699,null))[_0x4c1c('0x45')](handleError(_0xf0c699,null));};exports[_0x4c1c('0x57')]=function(_0x3812a3,_0x3bf255,_0x33c228){var _0x1bc57b=_0x3812a3['query'][_0x4c1c('0x58')];var _0x51b6ad=_0x1bc57b===_0x4c1c('0x59')?_0x4c1c('0x5a'):_0x4c1c('0x5b');var _0x3c5365='';var _0x3598c5='';var _0x4e9c87='';var _0x42844a='';var _0x5929e6='';var _0x569da7='';var _0x37925f='';var _0x21c1ea='';var _0x4d24bb=[_0x4c1c('0x5c'),_0x4c1c('0x5d'),'customerid','ownerid',_0x4c1c('0x5e'),_0x4c1c('0x5f'),'phonenumber','regardingobjectid',_0x4c1c('0x60'),_0x4c1c('0x61')];var _0x5b0189=[_0x4c1c('0x62'),_0x4c1c('0x63'),'actualserviceunits',_0x4c1c('0x64'),_0x4c1c('0x65'),_0x4c1c('0x66'),_0x4c1c('0x67'),_0x4c1c('0x68'),'createdbyexternalpartyname',_0x4c1c('0x69'),_0x4c1c('0x6a'),_0x4c1c('0x6b'),_0x4c1c('0x6c'),_0x4c1c('0x6d'),_0x4c1c('0x6e'),_0x4c1c('0x6f'),_0x4c1c('0x70'),_0x4c1c('0x71'),'emailaddress',_0x4c1c('0x72'),'entityimage_timestamp',_0x4c1c('0x73'),_0x4c1c('0x74'),'exchangerate',_0x4c1c('0x75'),_0x4c1c('0x76'),_0x4c1c('0x77'),_0x4c1c('0x78'),_0x4c1c('0x79'),'lastonholdtime',_0x4c1c('0x7a'),_0x4c1c('0x7b'),'modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame',_0x4c1c('0x7c'),'modifiedonbehalfbyname',_0x4c1c('0x7d'),_0x4c1c('0x7e'),_0x4c1c('0x7f'),_0x4c1c('0x80'),'onholdtime',_0x4c1c('0x81'),_0x4c1c('0x82'),_0x4c1c('0x83'),_0x4c1c('0x84'),_0x4c1c('0x85'),_0x4c1c('0x86'),_0x4c1c('0x87'),_0x4c1c('0x88'),'productidname',_0x4c1c('0x89'),_0x4c1c('0x8a'),_0x4c1c('0x8b'),'responseby','responsiblecontactidname',_0x4c1c('0x8c'),'sentimentvalue',_0x4c1c('0x8d'),_0x4c1c('0x8e'),'socialprofileidname',_0x4c1c('0x8f'),_0x4c1c('0x90'),_0x4c1c('0x91'),_0x4c1c('0x92'),'timezoneruleversionnumber','transactioncurrencyidname',_0x4c1c('0x93'),_0x4c1c('0x94'),_0x4c1c('0x95')];var _0x1284e4=_0x4d24bb[_0x4c1c('0x96')](_0x5b0189);return db[_0x4c1c('0x42')][_0x4c1c('0x4c')]({'where':{'id':_0x3812a3[_0x4c1c('0x47')]['id']},'attributes':['id',_0x4c1c('0x97'),_0x4c1c('0x98'),_0x4c1c('0x99'),'tenantId',_0x4c1c('0x9a'),_0x4c1c('0x9b')]})[_0x4c1c('0x23')](handleEntityNotFound(_0x3bf255,null))[_0x4c1c('0x23')](function(_0x23b9c9){if(_0x23b9c9){_0x21c1ea=_0x23b9c9['remoteUri'];var _0x591805=_0x21c1ea[_0x4c1c('0x9c')](-0x1);if(_0x591805==='/'){_0x21c1ea=_0x21c1ea[_0x4c1c('0x9d')](0x0,_0x21c1ea[_0x4c1c('0x9e')](_0x591805));}_0x37925f=util[_0x4c1c('0x9f')](_0x4c1c('0xa0'),_0x21c1ea);var _0x2536eb={'method':'POST','uri':_0x4c1c('0xa1')+_0x23b9c9[_0x4c1c('0xa2')]+_0x4c1c('0xa3'),'form':{'client_id':_0x23b9c9[_0x4c1c('0x9a')],'resource':_0x21c1ea,'username':_0x23b9c9[_0x4c1c('0x97')],'password':_0x23b9c9[_0x4c1c('0x98')],'grant_type':_0x4c1c('0x98'),'client_secret':_0x23b9c9[_0x4c1c('0x9b')]},'json':!![]};return rp(_0x2536eb);}})[_0x4c1c('0x23')](function(_0x469f61){_0x569da7=_0x469f61['access_token'];var _0x5a613a={'method':_0x4c1c('0xa4'),'uri':encodeURI(_0x37925f+_0x4c1c('0xa5')+_0x51b6ad+'\x27'),'headers':{'Authorization':_0x4c1c('0xa6')+_0x569da7,'If-None-Match':null,'OData-Version':_0x4c1c('0xa7')},'json':!![]};return rp(_0x5a613a);})[_0x4c1c('0x23')](function(_0x4aff06){var _0x14142f=_0x4aff06[_0x4c1c('0xa8')][0x0];var _0x42955e=_0x14142f[_0x4c1c('0xa9')];var _0x26319d={'method':_0x4c1c('0xa4'),'uri':_0x37925f+_0x4c1c('0xaa')+_0x42955e+_0x4c1c('0xab'),'headers':{'Authorization':'Bearer\x20'+_0x569da7,'If-None-Match':null,'OData-Version':_0x4c1c('0xa7')},'json':!![]};return rp(_0x26319d);})[_0x4c1c('0x23')](function(_0x135d5f){_0x3c5365=_0x135d5f;_0x3598c5=_0x3c5365[_0x4c1c('0xac')];_0x3598c5=_[_0x4c1c('0xad')](_0x3598c5,function(_0x518f31){return!_0x1284e4[_0x4c1c('0xae')](_0x518f31['LogicalName']);});var _0x46363f=[];var _0x3d4edf=[];_0x3598c5[_0x4c1c('0xaf')](function(_0x2df3db){if(_0x2df3db[_0x4c1c('0xb0')]){var _0x585e28=_0x2df3db[_0x4c1c('0xb0')][_0x4c1c('0x9d')](_0x2df3db[_0x4c1c('0xb0')][_0x4c1c('0x9e')]('.')+0x1);if(_0x585e28===_0x4c1c('0xb1')){_0x46363f[_0x4c1c('0xb2')](getSelectList(_0x37925f,_0x1bc57b,_0x3d4edf,_0x3c5365[_0x4c1c('0xa9')],_0x2df3db[_0x4c1c('0xa9')],_0x569da7));}}});return Promise[_0x4c1c('0xb3')](_0x46363f);})[_0x4c1c('0x23')](function(_0x5d6362){_0x4e9c87=_0x5d6362[0x0];var _0x466bf5=[];var _0x7fe011=[];_0x3598c5[_0x4c1c('0xaf')](function(_0x362c20){if(!_[_0x4c1c('0xb4')](_0x362c20[_0x4c1c('0xb0')])){var _0x4693b8=_0x362c20['@odata.type'][_0x4c1c('0x9d')](_0x362c20[_0x4c1c('0xb0')][_0x4c1c('0x9e')]('.')+0x1);if(_0x4693b8==='BooleanAttributeMetadata'){_0x466bf5[_0x4c1c('0xb2')](getBooleanList(_0x37925f,_0x1bc57b,_0x7fe011,_0x3c5365[_0x4c1c('0xa9')],_0x362c20['MetadataId'],_0x569da7));}}});return Promise[_0x4c1c('0xb3')](_0x466bf5);})[_0x4c1c('0x23')](function(_0x3e0d49){_0x42844a=_0x3e0d49[0x0];var _0xd6d748=[];var _0xac1afe=[];_0x3598c5[_0x4c1c('0xaf')](function(_0x5a85a7){if(_0x5a85a7[_0x4c1c('0xb0')]){var _0x2dac9d=_0x5a85a7['@odata.type'][_0x4c1c('0x9d')](_0x5a85a7['@odata.type'][_0x4c1c('0x9e')]('.')+0x1);if(_0x2dac9d===_0x4c1c('0xb5')||_0x2dac9d===_0x4c1c('0xb6')||_0x2dac9d===_0x4c1c('0xb7')||_0x2dac9d===_0x4c1c('0xb8')||_0x2dac9d==='MemoAttributeMetadata'||_0x2dac9d===_0x4c1c('0xb9')||_0x2dac9d==='StatusAttributeMetadata'||_0x2dac9d===_0x4c1c('0xba')||_0x2dac9d==='StateAttributeMetadata'||_0x2dac9d===_0x4c1c('0xbb')){_0xd6d748[_0x4c1c('0xb2')](getInputList(_0x37925f,_0x1bc57b,_0x2dac9d,_0xac1afe,_0x3c5365[_0x4c1c('0xa9')],_0x5a85a7['MetadataId'],_0x569da7));}}});return Promise['all'](_0xd6d748);})[_0x4c1c('0x23')](function(_0x4914dc){_0x5929e6=_0x4914dc[0x0];var _0x289fd2=_0x4e9c87['concat'](_0x42844a)['concat'](_0x5929e6);var _0x4ec71d={'count':_0x289fd2[_0x4c1c('0x35')],'rows':_0x289fd2};return _0x4ec71d;})[_0x4c1c('0x23')](respondWithResult(_0x3bf255,null))[_0x4c1c('0x45')](function(_0x4c6b72){var _0x4ba05c=_0x3812a3[_0x4c1c('0x30')][_0x4c1c('0xbc')]?0x1f4:_0x4c6b72['statusCode']||0x1f4;logger[_0x4c1c('0x26')](_0x4c6b72[_0x4c1c('0x27')]);delete _0x4c6b72[_0x4c1c('0x28')];if(_0x4ba05c===0x191){_0x4ba05c=0x190;}_0x3bf255[_0x4c1c('0x19')](_0x4ba05c)[_0x4c1c('0x29')](_0x3812a3[_0x4c1c('0x30')][_0x4c1c('0xbc')]?{'message':_0x4c1c('0xbd'),'statusCode':_0x4c6b72[_0x4c1c('0xbe')]}:_0x4c6b72);});};function getSelectList(_0xbf9a15,_0x2a42ac,_0x57b870,_0x949087,_0x1dd210,_0xf19fea){var _0x5265dd={'method':_0x4c1c('0xa4'),'uri':_0xbf9a15+_0x4c1c('0xaa')+_0x949087+_0x4c1c('0xbf')+_0x1dd210+_0x4c1c('0xc0')+_0x4c1c('0xc1'),'headers':{'Authorization':_0x4c1c('0xa6')+_0xf19fea,'If-None-Match':null,'OData-Version':_0x4c1c('0xa7')},'json':!![]};return rp(_0x5265dd)[_0x4c1c('0x23')](function(_0x2d1ef4){var _0x480298=[];var _0x56f41f=_0x2d1ef4[_0x4c1c('0xc2')]['Options'];_0x56f41f[_0x4c1c('0xaf')](function(_0x470db0){_0x480298['push']({'name':_0x470db0[_0x4c1c('0xc3')][_0x4c1c('0xc4')]['Label'],'value':String(_0x470db0['Value'])});});var _0x757a78={'id':_0x2a42ac+'_'+_0x2d1ef4[_0x4c1c('0xc5')],'name':_0x2d1ef4['DisplayName'][_0x4c1c('0xc4')][_0x4c1c('0xc3')],'custom':![],'options':_0x480298};_0x57b870['push'](_0x757a78);return _0x57b870;});}function getBooleanList(_0x4fe1ed,_0x2ce26a,_0x51d405,_0x105e83,_0x12aa9d,_0x2750ce){var _0x192192={'method':_0x4c1c('0xa4'),'uri':_0x4fe1ed+_0x4c1c('0xaa')+_0x105e83+_0x4c1c('0xbf')+_0x12aa9d+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x4c1c('0xa6')+_0x2750ce,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x192192)[_0x4c1c('0x23')](function(_0x124530){var _0x2066c5=[];_0x2066c5[_0x4c1c('0xb2')]({'name':_0x124530[_0x4c1c('0xc2')]['TrueOption'][_0x4c1c('0xc3')][_0x4c1c('0xc4')][_0x4c1c('0xc3')],'value':_0x4c1c('0xc6')},{'name':_0x124530[_0x4c1c('0xc2')][_0x4c1c('0xc7')][_0x4c1c('0xc3')][_0x4c1c('0xc4')][_0x4c1c('0xc3')],'value':'false'});var _0x37f375={'id':_0x2ce26a+'_'+_0x124530['LogicalName'],'name':_0x124530['DisplayName']['UserLocalizedLabel'][_0x4c1c('0xc3')],'custom':![],'options':_0x2066c5};_0x51d405['push'](_0x37f375);return _0x51d405;});}function getInputList(_0x4aea2c,_0x4dd301,_0x397d46,_0x4e8c40,_0x415257,_0x1487a2,_0x29d1e0){var _0x30f1a4={'method':_0x4c1c('0xa4'),'uri':_0x4aea2c+'EntityDefinitions('+_0x415257+_0x4c1c('0xbf')+_0x1487a2+')/Microsoft.Dynamics.CRM.'+_0x397d46+_0x4c1c('0xc8'),'headers':{'Authorization':'Bearer\x20'+_0x29d1e0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x30f1a4)[_0x4c1c('0x23')](function(_0x5d51ce){var _0x5d6851={'id':_0x4dd301+'_'+_0x5d51ce[_0x4c1c('0xc5')],'name':_0x5d51ce[_0x4c1c('0xc9')]['UserLocalizedLabel']?_0x5d51ce[_0x4c1c('0xc9')][_0x4c1c('0xc4')][_0x4c1c('0xc3')]:_0x5d51ce[_0x4c1c('0xc5')],'custom':![],'options':[]};_0x4e8c40[_0x4c1c('0xb2')](_0x5d6851);return _0x4e8c40;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index dacab7f..ddbc420 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x2fd69d,_0xeb1037){var _0x5d5ef3=function(_0xa9ea9e){while(--_0xa9ea9e){_0x2fd69d['push'](_0x2fd69d['shift']());}};_0x5d5ef3(++_0xeb1037);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x344faa,_0x7ed84b){var _0x11dde1=function(_0x4bbef5){while(--_0x4bbef5){_0x344faa['push'](_0x344faa['shift']());}};_0x11dde1(++_0x7ed84b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 0ca7c68..4de6300 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 _0x7258=['GetDynamics365Account','find','ShowDynamics365Account','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','Dynamics365Account','options','raw','where','attributes','include','map','model'];(function(_0x374684,_0x3a2b8a){var _0x322a81=function(_0x57c85b){while(--_0x57c85b){_0x374684['push'](_0x374684['shift']());}};_0x322a81(++_0x3a2b8a);}(_0x7258,0x1ed));var _0x8725=function(_0x5c2ecf,_0x28a46f){_0x5c2ecf=_0x5c2ecf-0x0;var _0x5b51b2=_0x7258[_0x5c2ecf];return _0x5b51b2;};'use strict';var _=require(_0x8725('0x0'));var util=require(_0x8725('0x1'));var moment=require(_0x8725('0x2'));var BPromise=require('bluebird');var rs=require(_0x8725('0x3'));var fs=require('fs');var Redis=require(_0x8725('0x4'));var db=require(_0x8725('0x5'))['db'];var utils=require(_0x8725('0x6'));var logger=require(_0x8725('0x7'))(_0x8725('0x8'));var config=require(_0x8725('0x9'));var jayson=require(_0x8725('0xa'));var client=jayson[_0x8725('0xb')][_0x8725('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b1187,_0x2e1cc8,_0x3343a1){return new BPromise(function(_0x135a24,_0x3df3cd){return client[_0x8725('0xd')](_0x1b1187,_0x3343a1)[_0x8725('0xe')](function(_0x38f2ad){logger[_0x8725('0xf')](_0x8725('0x10'),_0x2e1cc8,_0x8725('0x11'));logger[_0x8725('0x12')](_0x8725('0x13'),_0x2e1cc8,'request\x20sent',JSON[_0x8725('0x14')](_0x38f2ad));if(_0x38f2ad[_0x8725('0x15')]){if(_0x38f2ad[_0x8725('0x15')]['code']===0x1f4){logger[_0x8725('0x15')]('Dynamics365Account,\x20%s,\x20%s',_0x2e1cc8,_0x38f2ad['error'][_0x8725('0x16')]);return _0x3df3cd(_0x38f2ad[_0x8725('0x15')][_0x8725('0x16')]);}logger[_0x8725('0x15')]('Dynamics365Account,\x20%s,\x20%s',_0x2e1cc8,_0x38f2ad[_0x8725('0x15')][_0x8725('0x16')]);return _0x135a24(_0x38f2ad[_0x8725('0x15')][_0x8725('0x16')]);}else{logger[_0x8725('0xf')](_0x8725('0x10'),_0x2e1cc8,'request\x20sent');_0x135a24(_0x38f2ad['result'][_0x8725('0x16')]);}})[_0x8725('0x17')](function(_0x1d5de1){logger[_0x8725('0x15')](_0x8725('0x10'),_0x2e1cc8,_0x1d5de1);_0x3df3cd(_0x1d5de1);});});}exports['GetDynamics365Account']=function(_0x3b7f08){var _0x28afdc=this;return new Promise(function(_0x2e2199,_0x32354f){return db[_0x8725('0x18')]['findAll']({'raw':_0x3b7f08[_0x8725('0x19')]?_0x3b7f08[_0x8725('0x19')][_0x8725('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b7f08['options']?_0x3b7f08[_0x8725('0x19')][_0x8725('0x1b')]||null:null,'attributes':_0x3b7f08[_0x8725('0x19')]?_0x3b7f08['options'][_0x8725('0x1c')]||null:null,'limit':_0x3b7f08[_0x8725('0x19')]?_0x3b7f08['options']['limit']||null:null,'include':_0x3b7f08[_0x8725('0x19')]?_0x3b7f08[_0x8725('0x19')][_0x8725('0x1d')]?_[_0x8725('0x1e')](_0x3b7f08[_0x8725('0x19')][_0x8725('0x1d')],function(_0x1b1fdc){return{'model':db[_0x1b1fdc[_0x8725('0x1f')]],'as':_0x1b1fdc['as'],'attributes':_0x1b1fdc[_0x8725('0x1c')],'include':_0x1b1fdc[_0x8725('0x1d')]?_[_0x8725('0x1e')](_0x1b1fdc[_0x8725('0x1d')],function(_0x577f79){return{'model':db[_0x577f79[_0x8725('0x1f')]],'as':_0x577f79['as'],'attributes':_0x577f79[_0x8725('0x1c')],'include':_0x577f79[_0x8725('0x1d')]?_[_0x8725('0x1e')](_0x577f79[_0x8725('0x1d')],function(_0x7d219c){return{'model':db[_0x7d219c['model']],'as':_0x7d219c['as'],'attributes':_0x7d219c[_0x8725('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8725('0xe')](function(_0x53d832){logger['info'](_0x8725('0x20'),_0x3b7f08);logger[_0x8725('0x12')]('GetDynamics365Account',_0x3b7f08,JSON['stringify'](_0x53d832));_0x2e2199(_0x53d832);})[_0x8725('0x17')](function(_0x3615a6){logger[_0x8725('0x15')](_0x8725('0x20'),_0x3615a6['message'],_0x3b7f08);_0x32354f(_0x28afdc[_0x8725('0x15')](0x1f4,_0x3615a6[_0x8725('0x16')]));});});};exports['ShowDynamics365Account']=function(_0x1da8c8){var _0x2539e4=this;return new Promise(function(_0x3041a0,_0x12916e){return db[_0x8725('0x18')][_0x8725('0x21')]({'raw':_0x1da8c8[_0x8725('0x19')]?_0x1da8c8[_0x8725('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1da8c8[_0x8725('0x19')]?_0x1da8c8[_0x8725('0x19')][_0x8725('0x1b')]||null:null,'attributes':_0x1da8c8[_0x8725('0x19')]?_0x1da8c8[_0x8725('0x19')][_0x8725('0x1c')]||null:null,'include':_0x1da8c8['options']?_0x1da8c8[_0x8725('0x19')][_0x8725('0x1d')]?_[_0x8725('0x1e')](_0x1da8c8[_0x8725('0x19')][_0x8725('0x1d')],function(_0x537690){return{'model':db[_0x537690[_0x8725('0x1f')]],'as':_0x537690['as'],'attributes':_0x537690['attributes'],'include':_0x537690[_0x8725('0x1d')]?_[_0x8725('0x1e')](_0x537690[_0x8725('0x1d')],function(_0x238033){return{'model':db[_0x238033['model']],'as':_0x238033['as'],'attributes':_0x238033[_0x8725('0x1c')],'include':_0x238033[_0x8725('0x1d')]?_[_0x8725('0x1e')](_0x238033['include'],function(_0x2a23b0){return{'model':db[_0x2a23b0['model']],'as':_0x2a23b0['as'],'attributes':_0x2a23b0[_0x8725('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8725('0xe')](function(_0x42c4c7){logger[_0x8725('0xf')](_0x8725('0x22'),_0x1da8c8);logger[_0x8725('0x12')](_0x8725('0x22'),_0x1da8c8,JSON[_0x8725('0x14')](_0x42c4c7));_0x3041a0(_0x42c4c7);})[_0x8725('0x17')](function(_0x3f5b9e){logger['error'](_0x8725('0x22'),_0x3f5b9e['message'],_0x1da8c8);_0x12916e(_0x2539e4[_0x8725('0x15')](0x1f4,_0x3f5b9e[_0x8725('0x16')]));});});}; \ No newline at end of file +var _0x8c04=['catch','GetDynamics365Account','findAll','options','raw','where','attributes','map','include','model','debug','stringify','ShowDynamics365Account','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','error','message','result'];(function(_0x15470d,_0x5ef3be){var _0x2f97a3=function(_0x32be60){while(--_0x32be60){_0x15470d['push'](_0x15470d['shift']());}};_0x2f97a3(++_0x5ef3be);}(_0x8c04,0x1e9));var _0x48c0=function(_0x57b0de,_0x2ab36d){_0x57b0de=_0x57b0de-0x0;var _0x7e5914=_0x8c04[_0x57b0de];return _0x7e5914;};'use strict';var _=require(_0x48c0('0x0'));var util=require(_0x48c0('0x1'));var moment=require(_0x48c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x48c0('0x3'));var fs=require('fs');var Redis=require(_0x48c0('0x4'));var db=require(_0x48c0('0x5'))['db'];var utils=require(_0x48c0('0x6'));var logger=require(_0x48c0('0x7'))(_0x48c0('0x8'));var config=require(_0x48c0('0x9'));var jayson=require(_0x48c0('0xa'));var client=jayson[_0x48c0('0xb')][_0x48c0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5756f8,_0x1ce1c3,_0x39803f){return new BPromise(function(_0x39dcfc,_0x1cbd1a){return client[_0x48c0('0xd')](_0x5756f8,_0x39803f)[_0x48c0('0xe')](function(_0x53ec59){logger[_0x48c0('0xf')](_0x48c0('0x10'),_0x1ce1c3,_0x48c0('0x11'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x1ce1c3,_0x48c0('0x11'),JSON['stringify'](_0x53ec59));if(_0x53ec59['error']){if(_0x53ec59[_0x48c0('0x12')]['code']===0x1f4){logger[_0x48c0('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x1ce1c3,_0x53ec59[_0x48c0('0x12')][_0x48c0('0x13')]);return _0x1cbd1a(_0x53ec59[_0x48c0('0x12')][_0x48c0('0x13')]);}logger['error'](_0x48c0('0x10'),_0x1ce1c3,_0x53ec59['error']['message']);return _0x39dcfc(_0x53ec59['error'][_0x48c0('0x13')]);}else{logger['info'](_0x48c0('0x10'),_0x1ce1c3,'request\x20sent');_0x39dcfc(_0x53ec59[_0x48c0('0x14')][_0x48c0('0x13')]);}})[_0x48c0('0x15')](function(_0x1c5a68){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x1ce1c3,_0x1c5a68);_0x1cbd1a(_0x1c5a68);});});}exports[_0x48c0('0x16')]=function(_0xbd094c){var _0x1399e5=this;return new Promise(function(_0x9f5608,_0xa4d02f){return db['Dynamics365Account'][_0x48c0('0x17')]({'raw':_0xbd094c[_0x48c0('0x18')]?_0xbd094c['options'][_0x48c0('0x19')]===undefined?!![]:![]:!![],'where':_0xbd094c[_0x48c0('0x18')]?_0xbd094c[_0x48c0('0x18')][_0x48c0('0x1a')]||null:null,'attributes':_0xbd094c[_0x48c0('0x18')]?_0xbd094c[_0x48c0('0x18')][_0x48c0('0x1b')]||null:null,'limit':_0xbd094c[_0x48c0('0x18')]?_0xbd094c[_0x48c0('0x18')]['limit']||null:null,'include':_0xbd094c[_0x48c0('0x18')]?_0xbd094c['options']['include']?_[_0x48c0('0x1c')](_0xbd094c['options'][_0x48c0('0x1d')],function(_0x1963d8){return{'model':db[_0x1963d8[_0x48c0('0x1e')]],'as':_0x1963d8['as'],'attributes':_0x1963d8[_0x48c0('0x1b')],'include':_0x1963d8[_0x48c0('0x1d')]?_['map'](_0x1963d8[_0x48c0('0x1d')],function(_0x34687a){return{'model':db[_0x34687a['model']],'as':_0x34687a['as'],'attributes':_0x34687a[_0x48c0('0x1b')],'include':_0x34687a[_0x48c0('0x1d')]?_[_0x48c0('0x1c')](_0x34687a['include'],function(_0x5dc46f){return{'model':db[_0x5dc46f[_0x48c0('0x1e')]],'as':_0x5dc46f['as'],'attributes':_0x5dc46f[_0x48c0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x48c0('0xe')](function(_0x247361){logger['info'](_0x48c0('0x16'),_0xbd094c);logger[_0x48c0('0x1f')]('GetDynamics365Account',_0xbd094c,JSON[_0x48c0('0x20')](_0x247361));_0x9f5608(_0x247361);})[_0x48c0('0x15')](function(_0x942ec9){logger['error'](_0x48c0('0x16'),_0x942ec9['message'],_0xbd094c);_0xa4d02f(_0x1399e5['error'](0x1f4,_0x942ec9[_0x48c0('0x13')]));});});};exports['ShowDynamics365Account']=function(_0xe429ae){var _0x70c83e=this;return new Promise(function(_0xb6185,_0xbea119){return db['Dynamics365Account']['find']({'raw':_0xe429ae[_0x48c0('0x18')]?_0xe429ae[_0x48c0('0x18')][_0x48c0('0x19')]===undefined?!![]:![]:!![],'where':_0xe429ae[_0x48c0('0x18')]?_0xe429ae['options'][_0x48c0('0x1a')]||null:null,'attributes':_0xe429ae[_0x48c0('0x18')]?_0xe429ae[_0x48c0('0x18')][_0x48c0('0x1b')]||null:null,'include':_0xe429ae['options']?_0xe429ae[_0x48c0('0x18')][_0x48c0('0x1d')]?_['map'](_0xe429ae[_0x48c0('0x18')][_0x48c0('0x1d')],function(_0x19e0a2){return{'model':db[_0x19e0a2[_0x48c0('0x1e')]],'as':_0x19e0a2['as'],'attributes':_0x19e0a2['attributes'],'include':_0x19e0a2['include']?_[_0x48c0('0x1c')](_0x19e0a2['include'],function(_0x43adfe){return{'model':db[_0x43adfe[_0x48c0('0x1e')]],'as':_0x43adfe['as'],'attributes':_0x43adfe[_0x48c0('0x1b')],'include':_0x43adfe['include']?_[_0x48c0('0x1c')](_0x43adfe['include'],function(_0x10df1f){return{'model':db[_0x10df1f[_0x48c0('0x1e')]],'as':_0x10df1f['as'],'attributes':_0x10df1f[_0x48c0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x48c0('0xe')](function(_0x4a2b75){logger[_0x48c0('0xf')](_0x48c0('0x21'),_0xe429ae);logger[_0x48c0('0x1f')](_0x48c0('0x21'),_0xe429ae,JSON['stringify'](_0x4a2b75));_0xb6185(_0x4a2b75);})[_0x48c0('0x15')](function(_0x2aafa6){logger[_0x48c0('0x12')](_0x48c0('0x21'),_0x2aafa6[_0x48c0('0x13')],_0xe429ae);_0xbea119(_0x70c83e[_0x48c0('0x12')](0x1f4,_0x2aafa6[_0x48c0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 973fc8c..5a716d4 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 _0x1f20=['post','put','update','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x300fef,_0x32a0c3){var _0x1fe185=function(_0x31f4fa){while(--_0x31f4fa){_0x300fef['push'](_0x300fef['shift']());}};_0x1fe185(++_0x32a0c3);}(_0x1f20,0x11c));var _0x01f2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1f20[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x01f2('0x0'));var util=require(_0x01f2('0x1'));var path=require('path');var timeout=require(_0x01f2('0x2'));var express=require('express');var router=express[_0x01f2('0x3')]();var fs_extra=require(_0x01f2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x01f2('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x01f2('0x6')]('/',auth[_0x01f2('0x7')](),controller[_0x01f2('0x8')]);router[_0x01f2('0x6')](_0x01f2('0x9'),auth[_0x01f2('0x7')](),controller[_0x01f2('0xa')]);router[_0x01f2('0x6')](_0x01f2('0xb'),auth[_0x01f2('0x7')](),controller[_0x01f2('0xc')]);router[_0x01f2('0x6')](_0x01f2('0xd'),auth['isAuthenticated'](),controller[_0x01f2('0xe')]);router['get']('/:id/descriptions',auth[_0x01f2('0x7')](),controller[_0x01f2('0xf')]);router[_0x01f2('0x10')]('/',auth[_0x01f2('0x7')](),controller['create']);router[_0x01f2('0x11')](_0x01f2('0x9'),auth[_0x01f2('0x7')](),controller[_0x01f2('0x12')]);router['delete'](_0x01f2('0x9'),auth[_0x01f2('0x7')](),controller[_0x01f2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4c41=['isAuthenticated','/:id/fields','getFields','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','util','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x1d1e8a,_0x5e21e5){var _0x34b904=function(_0x2d3519){while(--_0x2d3519){_0x1d1e8a['push'](_0x1d1e8a['shift']());}};_0x34b904(++_0x5e21e5);}(_0x4c41,0xf7));var _0x14c4=function(_0x4a0cb8,_0x4d697c){_0x4a0cb8=_0x4a0cb8-0x0;var _0x162d71=_0x4c41[_0x4a0cb8];return _0x162d71;};'use strict';var multer=require('multer');var util=require(_0x14c4('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x14c4('0x1'));var auth=require(_0x14c4('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x14c4('0x3'));var controller=require(_0x14c4('0x4'));router['get']('/',auth[_0x14c4('0x5')](),controller['index']);router['get']('/:id',auth[_0x14c4('0x5')](),controller['show']);router['get'](_0x14c4('0x6'),auth['isAuthenticated'](),controller[_0x14c4('0x7')]);router[_0x14c4('0x8')](_0x14c4('0x9'),auth[_0x14c4('0x5')](),controller[_0x14c4('0xa')]);router['get'](_0x14c4('0xb'),auth['isAuthenticated'](),controller[_0x14c4('0xc')]);router[_0x14c4('0xd')]('/',auth[_0x14c4('0x5')](),controller[_0x14c4('0xe')]);router[_0x14c4('0xf')](_0x14c4('0x10'),auth[_0x14c4('0x5')](),controller[_0x14c4('0x11')]);router[_0x14c4('0x12')](_0x14c4('0x10'),auth[_0x14c4('0x5')](),controller[_0x14c4('0x13')]);module[_0x14c4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index b5cc785..32a30ab 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 _0x45fc=['ENUM','incident','phonecall','exports','STRING'];(function(_0x489b4a,_0xcb5284){var _0x30e27e=function(_0x50f08a){while(--_0x50f08a){_0x489b4a['push'](_0x489b4a['shift']());}};_0x30e27e(++_0xcb5284);}(_0x45fc,0x6c));var _0xc45f=function(_0x5c0d68,_0x4abfcb){_0x5c0d68=_0x5c0d68-0x0;var _0x2c49fe=_0x45fc[_0x5c0d68];return _0x2c49fe;};'use strict';var Sequelize=require('sequelize');module[_0xc45f('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc45f('0x1')]},'ticketType':{'type':Sequelize[_0xc45f('0x2')](_0xc45f('0x3'),_0xc45f('0x4')),'defaultValue':_0xc45f('0x3')}}; \ No newline at end of file +var _0xe199=['STRING','sequelize','exports'];(function(_0x6995d1,_0x4e627a){var _0x4fef4d=function(_0x4bef46){while(--_0x4bef46){_0x6995d1['push'](_0x6995d1['shift']());}};_0x4fef4d(++_0x4e627a);}(_0xe199,0x109));var _0x9e19=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe199[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x9e19('0x0'));module[_0x9e19('0x1')]={'name':{'type':Sequelize[_0x9e19('0x2')]},'description':{'type':Sequelize[_0x9e19('0x2')]},'ticketType':{'type':Sequelize['ENUM']('incident','phonecall'),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index d5938d5..4700099 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 _0x4988=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','end','stack','name','send','index','Dynamics365Configuration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','params','find','create','catch','body','getFields','findOne','Dynamics365Field','pick','map','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x35a6d8,_0x1d87d2){var _0x1c51c=function(_0xc8d84f){while(--_0xc8d84f){_0x35a6d8['push'](_0x35a6d8['shift']());}};_0x1c51c(++_0x1d87d2);}(_0x4988,0xea));var _0x8498=function(_0x7ea619,_0x18be48){_0x7ea619=_0x7ea619-0x0;var _0x66da19=_0x4988[_0x7ea619];return _0x66da19;};'use strict';var emlformat=require(_0x8498('0x0'));var rimraf=require(_0x8498('0x1'));var zipdir=require(_0x8498('0x2'));var jsonpatch=require(_0x8498('0x3'));var rp=require('request-promise');var moment=require(_0x8498('0x4'));var BPromise=require(_0x8498('0x5'));var Mustache=require(_0x8498('0x6'));var util=require('util');var path=require(_0x8498('0x7'));var sox=require(_0x8498('0x8'));var csv=require(_0x8498('0x9'));var ejs=require(_0x8498('0xa'));var fs=require('fs');var fs_extra=require(_0x8498('0xb'));var _=require(_0x8498('0xc'));var squel=require(_0x8498('0xd'));var crypto=require(_0x8498('0xe'));var jsforce=require(_0x8498('0xf'));var deskjs=require(_0x8498('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8498('0x11'));var Papa=require('papaparse');var Redis=require(_0x8498('0x12'));var authService=require(_0x8498('0x13'));var qs=require(_0x8498('0x14'));var as=require(_0x8498('0x15'));var hardwareService=require(_0x8498('0x16'));var logger=require(_0x8498('0x17'))(_0x8498('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8498('0x19'));var db=require(_0x8498('0x1a'))['db'];function respondWithStatusCode(_0x508796,_0x4deade){_0x4deade=_0x4deade||0xcc;return function(_0x30f011){if(_0x30f011){return _0x508796[_0x8498('0x1b')](_0x4deade);}return _0x508796[_0x8498('0x1c')](_0x4deade)['end']();};}function respondWithResult(_0x1f112e,_0x41bd97){_0x41bd97=_0x41bd97||0xc8;return function(_0x1e43e1){if(_0x1e43e1){return _0x1f112e[_0x8498('0x1c')](_0x41bd97)[_0x8498('0x1d')](_0x1e43e1);}};}function respondWithFilteredResult(_0x28557b,_0x3a992e){return function(_0x4775b3){if(_0x4775b3){var _0x41dcd6=typeof _0x3a992e[_0x8498('0x1e')]===_0x8498('0x1f')&&typeof _0x3a992e[_0x8498('0x20')]===_0x8498('0x1f');var _0x1fc2e8=_0x4775b3[_0x8498('0x21')];var _0x2aa0ba=_0x41dcd6?0x0:_0x3a992e['offset'];var _0x178baf=_0x41dcd6?_0x4775b3[_0x8498('0x21')]:_0x3a992e['offset']+_0x3a992e[_0x8498('0x20')];var _0x483e08;if(_0x178baf>=_0x1fc2e8){_0x178baf=_0x1fc2e8;_0x483e08=0xc8;}else{_0x483e08=0xce;}_0x28557b[_0x8498('0x1c')](_0x483e08);return _0x28557b['set'](_0x8498('0x22'),_0x2aa0ba+'-'+_0x178baf+'/'+_0x1fc2e8)['json'](_0x4775b3);}return null;};}function patchUpdates(_0x37e877){return function(_0x5797dc){try{jsonpatch[_0x8498('0x23')](_0x5797dc,_0x37e877,!![]);}catch(_0x230c20){return BPromise[_0x8498('0x24')](_0x230c20);}return _0x5797dc['save']();};}function saveUpdates(_0x55611e,_0x204ee0){return function(_0x4503df){if(_0x4503df){return _0x4503df[_0x8498('0x25')](_0x55611e)[_0x8498('0x26')](function(_0x28d9be){return _0x28d9be;});}return null;};}function removeEntity(_0x433ccc,_0x25a45c){return function(_0x1f9c64){if(_0x1f9c64){return _0x1f9c64['destroy']()[_0x8498('0x26')](function(){_0x433ccc[_0x8498('0x1c')](0xcc)[_0x8498('0x27')]();});}};}function handleEntityNotFound(_0x3fb68b,_0x2ed5a5){return function(_0x1d49aa){if(!_0x1d49aa){_0x3fb68b[_0x8498('0x1b')](0x194);}return _0x1d49aa;};}function handleError(_0x37d6d5,_0x13ecd3){_0x13ecd3=_0x13ecd3||0x1f4;return function(_0x571183){logger['error'](_0x571183[_0x8498('0x28')]);if(_0x571183[_0x8498('0x29')]){delete _0x571183[_0x8498('0x29')];}_0x37d6d5['status'](_0x13ecd3)[_0x8498('0x2a')](_0x571183);};}exports[_0x8498('0x2b')]=function(_0x2ef2b1,_0x4ba85d){var _0x16a0ea={},_0x5b15ea={},_0x15cae0={'count':0x0,'rows':[]};var _0x2c9686=_['map'](db[_0x8498('0x2c')][_0x8498('0x2d')],function(_0x34c5db){return{'name':_0x34c5db['fieldName'],'type':_0x34c5db[_0x8498('0x2e')][_0x8498('0x2f')]};});_0x5b15ea['model']=_['map'](_0x2c9686,_0x8498('0x29'));_0x5b15ea[_0x8498('0x30')]=_[_0x8498('0x31')](_0x2ef2b1[_0x8498('0x30')]);_0x5b15ea[_0x8498('0x32')]=_[_0x8498('0x33')](_0x5b15ea[_0x8498('0x34')],_0x5b15ea[_0x8498('0x30')]);_0x16a0ea[_0x8498('0x35')]=_[_0x8498('0x33')](_0x5b15ea['model'],qs['fields'](_0x2ef2b1[_0x8498('0x30')][_0x8498('0x36')]));_0x16a0ea[_0x8498('0x35')]=_0x16a0ea[_0x8498('0x35')][_0x8498('0x37')]?_0x16a0ea[_0x8498('0x35')]:_0x5b15ea[_0x8498('0x34')];if(!_0x2ef2b1[_0x8498('0x30')][_0x8498('0x38')](_0x8498('0x39'))){_0x16a0ea[_0x8498('0x20')]=qs[_0x8498('0x20')](_0x2ef2b1['query'][_0x8498('0x20')]);_0x16a0ea[_0x8498('0x1e')]=qs[_0x8498('0x1e')](_0x2ef2b1[_0x8498('0x30')][_0x8498('0x1e')]);}_0x16a0ea[_0x8498('0x3a')]=qs[_0x8498('0x3b')](_0x2ef2b1['query'][_0x8498('0x3b')]);_0x16a0ea[_0x8498('0x3c')]=qs[_0x8498('0x32')](_['pick'](_0x2ef2b1[_0x8498('0x30')],_0x5b15ea['filters']),_0x2c9686);if(_0x2ef2b1[_0x8498('0x30')]['filter']){_0x16a0ea[_0x8498('0x3c')]=_[_0x8498('0x3d')](_0x16a0ea[_0x8498('0x3c')],{'$or':_['map'](_0x2c9686,function(_0x2d3458){if(_0x2d3458[_0x8498('0x2e')]!==_0x8498('0x3e')){var _0x2765b3={};_0x2765b3[_0x2d3458[_0x8498('0x29')]]={'$like':'%'+_0x2ef2b1[_0x8498('0x30')][_0x8498('0x3f')]+'%'};return _0x2765b3;}})});}_0x16a0ea=_[_0x8498('0x3d')]({},_0x16a0ea,_0x2ef2b1[_0x8498('0x40')]);var _0x4a2ea2={'where':_0x16a0ea[_0x8498('0x3c')]};return db[_0x8498('0x2c')][_0x8498('0x21')](_0x4a2ea2)[_0x8498('0x26')](function(_0x4fd258){_0x15cae0[_0x8498('0x21')]=_0x4fd258;if(_0x2ef2b1[_0x8498('0x30')][_0x8498('0x41')]){_0x16a0ea[_0x8498('0x42')]=[{'all':!![]}];}return db[_0x8498('0x2c')]['findAll'](_0x16a0ea);})[_0x8498('0x26')](function(_0x112cd3){_0x15cae0[_0x8498('0x43')]=_0x112cd3;return _0x15cae0;})[_0x8498('0x26')](respondWithFilteredResult(_0x4ba85d,_0x16a0ea))['catch'](handleError(_0x4ba85d,null));};exports['show']=function(_0x7f7e0e,_0x34bcc8){var _0x5dcef0={'raw':![],'where':{'id':_0x7f7e0e[_0x8498('0x44')]['id']}},_0xba5397={};_0xba5397[_0x8498('0x34')]=_[_0x8498('0x31')](db['Dynamics365Configuration'][_0x8498('0x2d')]);_0xba5397[_0x8498('0x30')]=_[_0x8498('0x31')](_0x7f7e0e['query']);_0xba5397['filters']=_[_0x8498('0x33')](_0xba5397[_0x8498('0x34')],_0xba5397[_0x8498('0x30')]);_0x5dcef0[_0x8498('0x35')]=_[_0x8498('0x33')](_0xba5397['model'],qs['fields'](_0x7f7e0e['query'][_0x8498('0x36')]));_0x5dcef0['attributes']=_0x5dcef0[_0x8498('0x35')][_0x8498('0x37')]?_0x5dcef0[_0x8498('0x35')]:_0xba5397[_0x8498('0x34')];if(_0x7f7e0e['query'][_0x8498('0x41')]){_0x5dcef0[_0x8498('0x42')]=[{'all':!![]}];}_0x5dcef0=_[_0x8498('0x3d')]({},_0x5dcef0,_0x7f7e0e[_0x8498('0x40')]);return db['Dynamics365Configuration'][_0x8498('0x45')](_0x5dcef0)[_0x8498('0x26')](handleEntityNotFound(_0x34bcc8,null))[_0x8498('0x26')](respondWithResult(_0x34bcc8,null))['catch'](handleError(_0x34bcc8,null));};exports[_0x8498('0x46')]=function(_0x162ef2,_0x206768){return db[_0x8498('0x2c')][_0x8498('0x46')](_0x162ef2['body'],{})[_0x8498('0x26')](respondWithResult(_0x206768,0xc9))[_0x8498('0x47')](handleError(_0x206768,null));};exports[_0x8498('0x25')]=function(_0x1506b1,_0x3b8269){if(_0x1506b1[_0x8498('0x48')]['id']){delete _0x1506b1['body']['id'];}return db[_0x8498('0x2c')][_0x8498('0x45')]({'where':{'id':_0x1506b1[_0x8498('0x44')]['id']}})[_0x8498('0x26')](handleEntityNotFound(_0x3b8269,null))['then'](saveUpdates(_0x1506b1[_0x8498('0x48')],null))[_0x8498('0x26')](respondWithResult(_0x3b8269,null))[_0x8498('0x47')](handleError(_0x3b8269,null));};exports['destroy']=function(_0x173725,_0x201868){return db[_0x8498('0x2c')][_0x8498('0x45')]({'where':{'id':_0x173725[_0x8498('0x44')]['id']}})[_0x8498('0x26')](handleEntityNotFound(_0x201868,null))[_0x8498('0x26')](removeEntity(_0x201868,null))[_0x8498('0x47')](handleError(_0x201868,null));};exports[_0x8498('0x49')]=function(_0x4b41ce,_0x56688b,_0x1843c7){var _0x435e02={};var _0x376237={};var _0x1b7c64;var _0x2719fb;return db['Dynamics365Configuration'][_0x8498('0x4a')]({'where':{'id':_0x4b41ce['params']['id']}})[_0x8498('0x26')](handleEntityNotFound(_0x56688b,null))[_0x8498('0x26')](function(_0x696ec5){if(_0x696ec5){_0x1b7c64=_0x696ec5;_0x376237[_0x8498('0x34')]=_[_0x8498('0x31')](db[_0x8498('0x4b')][_0x8498('0x2d')]);_0x376237[_0x8498('0x30')]=_[_0x8498('0x31')](_0x4b41ce['query']);_0x376237[_0x8498('0x32')]=_['intersection'](_0x376237['model'],_0x376237[_0x8498('0x30')]);_0x435e02[_0x8498('0x35')]=_[_0x8498('0x33')](_0x376237['model'],qs['fields'](_0x4b41ce[_0x8498('0x30')][_0x8498('0x36')]));_0x435e02['attributes']=_0x435e02[_0x8498('0x35')][_0x8498('0x37')]?_0x435e02[_0x8498('0x35')]:_0x376237[_0x8498('0x34')];_0x435e02[_0x8498('0x3a')]=qs[_0x8498('0x3b')](_0x4b41ce[_0x8498('0x30')][_0x8498('0x3b')]);_0x435e02[_0x8498('0x3c')]=qs[_0x8498('0x32')](_[_0x8498('0x4c')](_0x4b41ce[_0x8498('0x30')],_0x376237[_0x8498('0x32')]));if(_0x4b41ce[_0x8498('0x30')][_0x8498('0x3f')]){_0x435e02[_0x8498('0x3c')]=_['merge'](_0x435e02['where'],{'$or':_[_0x8498('0x4d')](_0x435e02[_0x8498('0x35')],function(_0x34d8bc){var _0x35590f={};_0x35590f[_0x34d8bc]={'$like':'%'+_0x4b41ce[_0x8498('0x30')][_0x8498('0x3f')]+'%'};return _0x35590f;})});}_0x435e02=_['merge']({},_0x435e02,_0x4b41ce['options']);return _0x1b7c64[_0x8498('0x49')](_0x435e02);}})[_0x8498('0x26')](function(_0x1e973a){if(_0x1e973a){_0x2719fb=_0x1e973a[_0x8498('0x37')];if(!_0x4b41ce[_0x8498('0x30')]['hasOwnProperty']('nolimit')){_0x435e02['limit']=qs[_0x8498('0x20')](_0x4b41ce[_0x8498('0x30')][_0x8498('0x20')]);_0x435e02[_0x8498('0x1e')]=qs[_0x8498('0x1e')](_0x4b41ce[_0x8498('0x30')][_0x8498('0x1e')]);}return _0x1b7c64['getFields'](_0x435e02);}})[_0x8498('0x26')](function(_0x5227c8){if(_0x5227c8){return _0x5227c8?{'count':_0x2719fb,'rows':_0x5227c8}:null;}})['then'](respondWithResult(_0x56688b,null))[_0x8498('0x47')](handleError(_0x56688b,null));};exports[_0x8498('0x4e')]=function(_0x1f2c9a,_0x497eb4,_0x2e4078){var _0x208800={};var _0xbf6c07={};var _0x526ad8;var _0x1b20fb;return db[_0x8498('0x2c')][_0x8498('0x4a')]({'where':{'id':_0x1f2c9a[_0x8498('0x44')]['id']}})['then'](handleEntityNotFound(_0x497eb4,null))['then'](function(_0x1b5c18){if(_0x1b5c18){_0x526ad8=_0x1b5c18;_0xbf6c07['model']=_[_0x8498('0x31')](db[_0x8498('0x4b')][_0x8498('0x2d')]);_0xbf6c07[_0x8498('0x30')]=_[_0x8498('0x31')](_0x1f2c9a['query']);_0xbf6c07[_0x8498('0x32')]=_['intersection'](_0xbf6c07['model'],_0xbf6c07[_0x8498('0x30')]);_0x208800[_0x8498('0x35')]=_[_0x8498('0x33')](_0xbf6c07[_0x8498('0x34')],qs[_0x8498('0x36')](_0x1f2c9a[_0x8498('0x30')][_0x8498('0x36')]));_0x208800[_0x8498('0x35')]=_0x208800['attributes'][_0x8498('0x37')]?_0x208800[_0x8498('0x35')]:_0xbf6c07[_0x8498('0x34')];_0x208800[_0x8498('0x3a')]=qs['sort'](_0x1f2c9a[_0x8498('0x30')][_0x8498('0x3b')]);_0x208800[_0x8498('0x3c')]=qs[_0x8498('0x32')](_[_0x8498('0x4c')](_0x1f2c9a[_0x8498('0x30')],_0xbf6c07[_0x8498('0x32')]));if(_0x1f2c9a[_0x8498('0x30')][_0x8498('0x3f')]){_0x208800[_0x8498('0x3c')]=_[_0x8498('0x3d')](_0x208800['where'],{'$or':_[_0x8498('0x4d')](_0x208800['attributes'],function(_0x3ecfa8){var _0x3b6b71={};_0x3b6b71[_0x3ecfa8]={'$like':'%'+_0x1f2c9a['query'][_0x8498('0x3f')]+'%'};return _0x3b6b71;})});}_0x208800=_['merge']({},_0x208800,_0x1f2c9a[_0x8498('0x40')]);return _0x526ad8[_0x8498('0x4e')](_0x208800);}})['then'](function(_0x13d496){if(_0x13d496){_0x1b20fb=_0x13d496[_0x8498('0x37')];if(!_0x1f2c9a[_0x8498('0x30')]['hasOwnProperty'](_0x8498('0x39'))){_0x208800[_0x8498('0x20')]=qs[_0x8498('0x20')](_0x1f2c9a['query'][_0x8498('0x20')]);_0x208800[_0x8498('0x1e')]=qs[_0x8498('0x1e')](_0x1f2c9a['query'][_0x8498('0x1e')]);}return _0x526ad8[_0x8498('0x4e')](_0x208800);}})[_0x8498('0x26')](function(_0x48a98f){if(_0x48a98f){return _0x48a98f?{'count':_0x1b20fb,'rows':_0x48a98f}:null;}})[_0x8498('0x26')](respondWithResult(_0x497eb4,null))['catch'](handleError(_0x497eb4,null));};exports[_0x8498('0x4f')]=function(_0x1dd1ca,_0x39bb5b,_0xcfed0d){var _0x49b5cb={};var _0x4d3bae={};var _0x300f6c;var _0x4052e7;return db[_0x8498('0x2c')][_0x8498('0x4a')]({'where':{'id':_0x1dd1ca[_0x8498('0x44')]['id']}})[_0x8498('0x26')](handleEntityNotFound(_0x39bb5b,null))[_0x8498('0x26')](function(_0x5d93ae){if(_0x5d93ae){_0x300f6c=_0x5d93ae;_0x4d3bae['model']=_['keys'](db[_0x8498('0x4b')][_0x8498('0x2d')]);_0x4d3bae['query']=_[_0x8498('0x31')](_0x1dd1ca[_0x8498('0x30')]);_0x4d3bae[_0x8498('0x32')]=_[_0x8498('0x33')](_0x4d3bae[_0x8498('0x34')],_0x4d3bae[_0x8498('0x30')]);_0x49b5cb[_0x8498('0x35')]=_[_0x8498('0x33')](_0x4d3bae[_0x8498('0x34')],qs[_0x8498('0x36')](_0x1dd1ca['query'][_0x8498('0x36')]));_0x49b5cb[_0x8498('0x35')]=_0x49b5cb[_0x8498('0x35')][_0x8498('0x37')]?_0x49b5cb[_0x8498('0x35')]:_0x4d3bae[_0x8498('0x34')];_0x49b5cb[_0x8498('0x3a')]=qs[_0x8498('0x3b')](_0x1dd1ca[_0x8498('0x30')][_0x8498('0x3b')]);_0x49b5cb[_0x8498('0x3c')]=qs[_0x8498('0x32')](_[_0x8498('0x4c')](_0x1dd1ca['query'],_0x4d3bae['filters']));if(_0x1dd1ca[_0x8498('0x30')][_0x8498('0x3f')]){_0x49b5cb[_0x8498('0x3c')]=_[_0x8498('0x3d')](_0x49b5cb[_0x8498('0x3c')],{'$or':_[_0x8498('0x4d')](_0x49b5cb[_0x8498('0x35')],function(_0x320b6d){var _0x464ff6={};_0x464ff6[_0x320b6d]={'$like':'%'+_0x1dd1ca[_0x8498('0x30')][_0x8498('0x3f')]+'%'};return _0x464ff6;})});}_0x49b5cb=_['merge']({},_0x49b5cb,_0x1dd1ca[_0x8498('0x40')]);return _0x300f6c[_0x8498('0x4f')](_0x49b5cb);}})['then'](function(_0x37dbd9){if(_0x37dbd9){_0x4052e7=_0x37dbd9[_0x8498('0x37')];if(!_0x1dd1ca[_0x8498('0x30')]['hasOwnProperty'](_0x8498('0x39'))){_0x49b5cb[_0x8498('0x20')]=qs['limit'](_0x1dd1ca['query'][_0x8498('0x20')]);_0x49b5cb[_0x8498('0x1e')]=qs['offset'](_0x1dd1ca[_0x8498('0x30')][_0x8498('0x1e')]);}return _0x300f6c[_0x8498('0x4f')](_0x49b5cb);}})[_0x8498('0x26')](function(_0x24a67f){if(_0x24a67f){return _0x24a67f?{'count':_0x4052e7,'rows':_0x24a67f}:null;}})[_0x8498('0x26')](respondWithResult(_0x39bb5b,null))[_0x8498('0x47')](handleError(_0x39bb5b,null));}; \ No newline at end of file +var _0xbfbf=['../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','sort','where','filters','filter','options','includeAll','rows','catch','show','length','include','find','create','body','params','getFields','findOne','order','pick','merge','nolimit','getSubjects','Dynamics365Field','getDescriptions','eml-format','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xbfbf,0x1b0));var _0xfbfb=function(_0x12cdad,_0x37201d){_0x12cdad=_0x12cdad-0x0;var _0x502336=_0xbfbf[_0x12cdad];return _0x502336;};'use strict';var emlformat=require(_0xfbfb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfbfb('0x1'));var rp=require('request-promise');var moment=require(_0xfbfb('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfbfb('0x3'));var path=require(_0xfbfb('0x4'));var sox=require(_0xfbfb('0x5'));var csv=require(_0xfbfb('0x6'));var ejs=require(_0xfbfb('0x7'));var fs=require('fs');var fs_extra=require(_0xfbfb('0x8'));var _=require(_0xfbfb('0x9'));var squel=require(_0xfbfb('0xa'));var crypto=require(_0xfbfb('0xb'));var jsforce=require(_0xfbfb('0xc'));var deskjs=require(_0xfbfb('0xd'));var toCsv=require(_0xfbfb('0x6'));var querystring=require('querystring');var Papa=require(_0xfbfb('0xe'));var Redis=require('ioredis');var authService=require(_0xfbfb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfbfb('0x10'));var hardwareService=require(_0xfbfb('0x11'));var logger=require(_0xfbfb('0x12'))('api');var utils=require(_0xfbfb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfbfb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b2748,_0x148491){_0x148491=_0x148491||0xcc;return function(_0x90773c){if(_0x90773c){return _0x1b2748[_0xfbfb('0x15')](_0x148491);}return _0x1b2748[_0xfbfb('0x16')](_0x148491)[_0xfbfb('0x17')]();};}function respondWithResult(_0x2c7b66,_0x4f2420){_0x4f2420=_0x4f2420||0xc8;return function(_0x5a47cd){if(_0x5a47cd){return _0x2c7b66[_0xfbfb('0x16')](_0x4f2420)[_0xfbfb('0x18')](_0x5a47cd);}};}function respondWithFilteredResult(_0x3e2854,_0x4f3e14){return function(_0x384fe9){if(_0x384fe9){var _0x2f69eb=typeof _0x4f3e14[_0xfbfb('0x19')]===_0xfbfb('0x1a')&&typeof _0x4f3e14[_0xfbfb('0x1b')]===_0xfbfb('0x1a');var _0x173913=_0x384fe9[_0xfbfb('0x1c')];var _0x1b5f55=_0x2f69eb?0x0:_0x4f3e14['offset'];var _0x532a30=_0x2f69eb?_0x384fe9[_0xfbfb('0x1c')]:_0x4f3e14[_0xfbfb('0x19')]+_0x4f3e14[_0xfbfb('0x1b')];var _0x25e33a;if(_0x532a30>=_0x173913){_0x532a30=_0x173913;_0x25e33a=0xc8;}else{_0x25e33a=0xce;}_0x3e2854['status'](_0x25e33a);return _0x3e2854[_0xfbfb('0x1d')](_0xfbfb('0x1e'),_0x1b5f55+'-'+_0x532a30+'/'+_0x173913)[_0xfbfb('0x18')](_0x384fe9);}return null;};}function patchUpdates(_0x1de10d){return function(_0x1b672f){try{jsonpatch['apply'](_0x1b672f,_0x1de10d,!![]);}catch(_0x17d86e){return BPromise[_0xfbfb('0x1f')](_0x17d86e);}return _0x1b672f[_0xfbfb('0x20')]();};}function saveUpdates(_0x21143f,_0x213994){return function(_0x5eedeb){if(_0x5eedeb){return _0x5eedeb[_0xfbfb('0x21')](_0x21143f)[_0xfbfb('0x22')](function(_0x5ded83){return _0x5ded83;});}return null;};}function removeEntity(_0x17996a,_0x2720fa){return function(_0x26859b){if(_0x26859b){return _0x26859b['destroy']()[_0xfbfb('0x22')](function(){_0x17996a[_0xfbfb('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a6b2,_0x5bf2b0){return function(_0x1274fc){if(!_0x1274fc){_0x45a6b2[_0xfbfb('0x15')](0x194);}return _0x1274fc;};}function handleError(_0xdaae49,_0x334d36){_0x334d36=_0x334d36||0x1f4;return function(_0x246298){logger[_0xfbfb('0x23')](_0x246298[_0xfbfb('0x24')]);if(_0x246298[_0xfbfb('0x25')]){delete _0x246298[_0xfbfb('0x25')];}_0xdaae49[_0xfbfb('0x16')](_0x334d36)['send'](_0x246298);};}exports['index']=function(_0x2ef663,_0x47c566){var _0x50899e={},_0x53d0ce={},_0x294d78={'count':0x0,'rows':[]};var _0x245365=_[_0xfbfb('0x26')](db[_0xfbfb('0x27')][_0xfbfb('0x28')],function(_0x3f5357){return{'name':_0x3f5357[_0xfbfb('0x29')],'type':_0x3f5357[_0xfbfb('0x2a')][_0xfbfb('0x2b')]};});_0x53d0ce['model']=_[_0xfbfb('0x26')](_0x245365,_0xfbfb('0x25'));_0x53d0ce['query']=_[_0xfbfb('0x2c')](_0x2ef663[_0xfbfb('0x2d')]);_0x53d0ce['filters']=_[_0xfbfb('0x2e')](_0x53d0ce[_0xfbfb('0x2f')],_0x53d0ce['query']);_0x50899e[_0xfbfb('0x30')]=_[_0xfbfb('0x2e')](_0x53d0ce[_0xfbfb('0x2f')],qs[_0xfbfb('0x31')](_0x2ef663['query'][_0xfbfb('0x31')]));_0x50899e[_0xfbfb('0x30')]=_0x50899e[_0xfbfb('0x30')]['length']?_0x50899e[_0xfbfb('0x30')]:_0x53d0ce[_0xfbfb('0x2f')];if(!_0x2ef663[_0xfbfb('0x2d')][_0xfbfb('0x32')]('nolimit')){_0x50899e['limit']=qs[_0xfbfb('0x1b')](_0x2ef663[_0xfbfb('0x2d')][_0xfbfb('0x1b')]);_0x50899e[_0xfbfb('0x19')]=qs['offset'](_0x2ef663['query'][_0xfbfb('0x19')]);}_0x50899e['order']=qs[_0xfbfb('0x33')](_0x2ef663[_0xfbfb('0x2d')][_0xfbfb('0x33')]);_0x50899e[_0xfbfb('0x34')]=qs['filters'](_['pick'](_0x2ef663[_0xfbfb('0x2d')],_0x53d0ce[_0xfbfb('0x35')]),_0x245365);if(_0x2ef663['query'][_0xfbfb('0x36')]){_0x50899e[_0xfbfb('0x34')]=_['merge'](_0x50899e['where'],{'$or':_[_0xfbfb('0x26')](_0x245365,function(_0x334f89){if(_0x334f89['type']!=='VIRTUAL'){var _0x2dcc61={};_0x2dcc61[_0x334f89[_0xfbfb('0x25')]]={'$like':'%'+_0x2ef663[_0xfbfb('0x2d')][_0xfbfb('0x36')]+'%'};return _0x2dcc61;}})});}_0x50899e=_['merge']({},_0x50899e,_0x2ef663[_0xfbfb('0x37')]);var _0x3d8920={'where':_0x50899e['where']};return db[_0xfbfb('0x27')][_0xfbfb('0x1c')](_0x3d8920)['then'](function(_0x5be5b9){_0x294d78[_0xfbfb('0x1c')]=_0x5be5b9;if(_0x2ef663[_0xfbfb('0x2d')][_0xfbfb('0x38')]){_0x50899e['include']=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x50899e);})[_0xfbfb('0x22')](function(_0x54d26a){_0x294d78[_0xfbfb('0x39')]=_0x54d26a;return _0x294d78;})[_0xfbfb('0x22')](respondWithFilteredResult(_0x47c566,_0x50899e))[_0xfbfb('0x3a')](handleError(_0x47c566,null));};exports[_0xfbfb('0x3b')]=function(_0x59d6c8,_0x55d6fa){var _0x134dfb={'raw':![],'where':{'id':_0x59d6c8['params']['id']}},_0x450cae={};_0x450cae[_0xfbfb('0x2f')]=_[_0xfbfb('0x2c')](db[_0xfbfb('0x27')][_0xfbfb('0x28')]);_0x450cae[_0xfbfb('0x2d')]=_[_0xfbfb('0x2c')](_0x59d6c8[_0xfbfb('0x2d')]);_0x450cae['filters']=_[_0xfbfb('0x2e')](_0x450cae[_0xfbfb('0x2f')],_0x450cae[_0xfbfb('0x2d')]);_0x134dfb[_0xfbfb('0x30')]=_['intersection'](_0x450cae[_0xfbfb('0x2f')],qs['fields'](_0x59d6c8[_0xfbfb('0x2d')]['fields']));_0x134dfb[_0xfbfb('0x30')]=_0x134dfb[_0xfbfb('0x30')][_0xfbfb('0x3c')]?_0x134dfb[_0xfbfb('0x30')]:_0x450cae[_0xfbfb('0x2f')];if(_0x59d6c8[_0xfbfb('0x2d')][_0xfbfb('0x38')]){_0x134dfb[_0xfbfb('0x3d')]=[{'all':!![]}];}_0x134dfb=_['merge']({},_0x134dfb,_0x59d6c8[_0xfbfb('0x37')]);return db[_0xfbfb('0x27')][_0xfbfb('0x3e')](_0x134dfb)[_0xfbfb('0x22')](handleEntityNotFound(_0x55d6fa,null))['then'](respondWithResult(_0x55d6fa,null))['catch'](handleError(_0x55d6fa,null));};exports['create']=function(_0x387f88,_0xb5446c){return db['Dynamics365Configuration'][_0xfbfb('0x3f')](_0x387f88[_0xfbfb('0x40')],{})[_0xfbfb('0x22')](respondWithResult(_0xb5446c,0xc9))[_0xfbfb('0x3a')](handleError(_0xb5446c,null));};exports[_0xfbfb('0x21')]=function(_0x10f5de,_0xf3292){if(_0x10f5de[_0xfbfb('0x40')]['id']){delete _0x10f5de[_0xfbfb('0x40')]['id'];}return db['Dynamics365Configuration'][_0xfbfb('0x3e')]({'where':{'id':_0x10f5de[_0xfbfb('0x41')]['id']}})['then'](handleEntityNotFound(_0xf3292,null))[_0xfbfb('0x22')](saveUpdates(_0x10f5de[_0xfbfb('0x40')],null))[_0xfbfb('0x22')](respondWithResult(_0xf3292,null))['catch'](handleError(_0xf3292,null));};exports['destroy']=function(_0x68a23a,_0x5c7700){return db[_0xfbfb('0x27')][_0xfbfb('0x3e')]({'where':{'id':_0x68a23a[_0xfbfb('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c7700,null))[_0xfbfb('0x22')](removeEntity(_0x5c7700,null))['catch'](handleError(_0x5c7700,null));};exports[_0xfbfb('0x42')]=function(_0x1ad48e,_0x4a5cbe,_0x5b2de6){var _0x1aedc1={};var _0x2fa87c={};var _0x59ac23;var _0x75ff12;return db[_0xfbfb('0x27')][_0xfbfb('0x43')]({'where':{'id':_0x1ad48e['params']['id']}})[_0xfbfb('0x22')](handleEntityNotFound(_0x4a5cbe,null))[_0xfbfb('0x22')](function(_0x161049){if(_0x161049){_0x59ac23=_0x161049;_0x2fa87c[_0xfbfb('0x2f')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x2fa87c[_0xfbfb('0x2d')]=_[_0xfbfb('0x2c')](_0x1ad48e[_0xfbfb('0x2d')]);_0x2fa87c[_0xfbfb('0x35')]=_[_0xfbfb('0x2e')](_0x2fa87c[_0xfbfb('0x2f')],_0x2fa87c[_0xfbfb('0x2d')]);_0x1aedc1[_0xfbfb('0x30')]=_[_0xfbfb('0x2e')](_0x2fa87c[_0xfbfb('0x2f')],qs['fields'](_0x1ad48e['query']['fields']));_0x1aedc1[_0xfbfb('0x30')]=_0x1aedc1[_0xfbfb('0x30')][_0xfbfb('0x3c')]?_0x1aedc1[_0xfbfb('0x30')]:_0x2fa87c[_0xfbfb('0x2f')];_0x1aedc1[_0xfbfb('0x44')]=qs['sort'](_0x1ad48e[_0xfbfb('0x2d')]['sort']);_0x1aedc1[_0xfbfb('0x34')]=qs['filters'](_[_0xfbfb('0x45')](_0x1ad48e[_0xfbfb('0x2d')],_0x2fa87c[_0xfbfb('0x35')]));if(_0x1ad48e['query'][_0xfbfb('0x36')]){_0x1aedc1['where']=_['merge'](_0x1aedc1['where'],{'$or':_[_0xfbfb('0x26')](_0x1aedc1[_0xfbfb('0x30')],function(_0x1ab96a){var _0xb35831={};_0xb35831[_0x1ab96a]={'$like':'%'+_0x1ad48e[_0xfbfb('0x2d')]['filter']+'%'};return _0xb35831;})});}_0x1aedc1=_[_0xfbfb('0x46')]({},_0x1aedc1,_0x1ad48e[_0xfbfb('0x37')]);return _0x59ac23[_0xfbfb('0x42')](_0x1aedc1);}})[_0xfbfb('0x22')](function(_0x1a8315){if(_0x1a8315){_0x75ff12=_0x1a8315[_0xfbfb('0x3c')];if(!_0x1ad48e[_0xfbfb('0x2d')]['hasOwnProperty'](_0xfbfb('0x47'))){_0x1aedc1[_0xfbfb('0x1b')]=qs[_0xfbfb('0x1b')](_0x1ad48e[_0xfbfb('0x2d')][_0xfbfb('0x1b')]);_0x1aedc1['offset']=qs[_0xfbfb('0x19')](_0x1ad48e[_0xfbfb('0x2d')][_0xfbfb('0x19')]);}return _0x59ac23[_0xfbfb('0x42')](_0x1aedc1);}})[_0xfbfb('0x22')](function(_0x10b44f){if(_0x10b44f){return _0x10b44f?{'count':_0x75ff12,'rows':_0x10b44f}:null;}})['then'](respondWithResult(_0x4a5cbe,null))[_0xfbfb('0x3a')](handleError(_0x4a5cbe,null));};exports[_0xfbfb('0x48')]=function(_0x48c7ce,_0x3f1505,_0x152fd1){var _0x436318={};var _0x5dff97={};var _0x166552;var _0x5cab3c;return db[_0xfbfb('0x27')][_0xfbfb('0x43')]({'where':{'id':_0x48c7ce[_0xfbfb('0x41')]['id']}})[_0xfbfb('0x22')](handleEntityNotFound(_0x3f1505,null))['then'](function(_0x3ed92d){if(_0x3ed92d){_0x166552=_0x3ed92d;_0x5dff97[_0xfbfb('0x2f')]=_[_0xfbfb('0x2c')](db[_0xfbfb('0x49')]['rawAttributes']);_0x5dff97['query']=_[_0xfbfb('0x2c')](_0x48c7ce[_0xfbfb('0x2d')]);_0x5dff97[_0xfbfb('0x35')]=_[_0xfbfb('0x2e')](_0x5dff97['model'],_0x5dff97[_0xfbfb('0x2d')]);_0x436318[_0xfbfb('0x30')]=_['intersection'](_0x5dff97[_0xfbfb('0x2f')],qs[_0xfbfb('0x31')](_0x48c7ce[_0xfbfb('0x2d')][_0xfbfb('0x31')]));_0x436318[_0xfbfb('0x30')]=_0x436318['attributes']['length']?_0x436318[_0xfbfb('0x30')]:_0x5dff97[_0xfbfb('0x2f')];_0x436318[_0xfbfb('0x44')]=qs[_0xfbfb('0x33')](_0x48c7ce[_0xfbfb('0x2d')]['sort']);_0x436318[_0xfbfb('0x34')]=qs[_0xfbfb('0x35')](_[_0xfbfb('0x45')](_0x48c7ce[_0xfbfb('0x2d')],_0x5dff97['filters']));if(_0x48c7ce[_0xfbfb('0x2d')]['filter']){_0x436318[_0xfbfb('0x34')]=_[_0xfbfb('0x46')](_0x436318['where'],{'$or':_[_0xfbfb('0x26')](_0x436318[_0xfbfb('0x30')],function(_0x47264b){var _0x345e28={};_0x345e28[_0x47264b]={'$like':'%'+_0x48c7ce[_0xfbfb('0x2d')][_0xfbfb('0x36')]+'%'};return _0x345e28;})});}_0x436318=_[_0xfbfb('0x46')]({},_0x436318,_0x48c7ce['options']);return _0x166552[_0xfbfb('0x48')](_0x436318);}})[_0xfbfb('0x22')](function(_0x4e4d6){if(_0x4e4d6){_0x5cab3c=_0x4e4d6[_0xfbfb('0x3c')];if(!_0x48c7ce[_0xfbfb('0x2d')]['hasOwnProperty']('nolimit')){_0x436318[_0xfbfb('0x1b')]=qs['limit'](_0x48c7ce[_0xfbfb('0x2d')][_0xfbfb('0x1b')]);_0x436318[_0xfbfb('0x19')]=qs[_0xfbfb('0x19')](_0x48c7ce[_0xfbfb('0x2d')]['offset']);}return _0x166552['getSubjects'](_0x436318);}})[_0xfbfb('0x22')](function(_0x50b0a1){if(_0x50b0a1){return _0x50b0a1?{'count':_0x5cab3c,'rows':_0x50b0a1}:null;}})[_0xfbfb('0x22')](respondWithResult(_0x3f1505,null))[_0xfbfb('0x3a')](handleError(_0x3f1505,null));};exports[_0xfbfb('0x4a')]=function(_0x2ba7ee,_0xf0a31e,_0x701045){var _0x3a2257={};var _0x55a206={};var _0x3c1b2f;var _0x4c0956;return db[_0xfbfb('0x27')][_0xfbfb('0x43')]({'where':{'id':_0x2ba7ee[_0xfbfb('0x41')]['id']}})[_0xfbfb('0x22')](handleEntityNotFound(_0xf0a31e,null))[_0xfbfb('0x22')](function(_0x2b2c07){if(_0x2b2c07){_0x3c1b2f=_0x2b2c07;_0x55a206[_0xfbfb('0x2f')]=_[_0xfbfb('0x2c')](db[_0xfbfb('0x49')][_0xfbfb('0x28')]);_0x55a206[_0xfbfb('0x2d')]=_[_0xfbfb('0x2c')](_0x2ba7ee['query']);_0x55a206['filters']=_['intersection'](_0x55a206['model'],_0x55a206[_0xfbfb('0x2d')]);_0x3a2257[_0xfbfb('0x30')]=_[_0xfbfb('0x2e')](_0x55a206[_0xfbfb('0x2f')],qs[_0xfbfb('0x31')](_0x2ba7ee[_0xfbfb('0x2d')][_0xfbfb('0x31')]));_0x3a2257['attributes']=_0x3a2257['attributes'][_0xfbfb('0x3c')]?_0x3a2257[_0xfbfb('0x30')]:_0x55a206[_0xfbfb('0x2f')];_0x3a2257[_0xfbfb('0x44')]=qs[_0xfbfb('0x33')](_0x2ba7ee[_0xfbfb('0x2d')]['sort']);_0x3a2257[_0xfbfb('0x34')]=qs['filters'](_[_0xfbfb('0x45')](_0x2ba7ee['query'],_0x55a206[_0xfbfb('0x35')]));if(_0x2ba7ee[_0xfbfb('0x2d')][_0xfbfb('0x36')]){_0x3a2257[_0xfbfb('0x34')]=_[_0xfbfb('0x46')](_0x3a2257[_0xfbfb('0x34')],{'$or':_['map'](_0x3a2257[_0xfbfb('0x30')],function(_0x2d8fd4){var _0x5afaa3={};_0x5afaa3[_0x2d8fd4]={'$like':'%'+_0x2ba7ee[_0xfbfb('0x2d')]['filter']+'%'};return _0x5afaa3;})});}_0x3a2257=_['merge']({},_0x3a2257,_0x2ba7ee['options']);return _0x3c1b2f['getDescriptions'](_0x3a2257);}})[_0xfbfb('0x22')](function(_0x293b16){if(_0x293b16){_0x4c0956=_0x293b16[_0xfbfb('0x3c')];if(!_0x2ba7ee['query'][_0xfbfb('0x32')](_0xfbfb('0x47'))){_0x3a2257[_0xfbfb('0x1b')]=qs['limit'](_0x2ba7ee[_0xfbfb('0x2d')][_0xfbfb('0x1b')]);_0x3a2257[_0xfbfb('0x19')]=qs[_0xfbfb('0x19')](_0x2ba7ee['query']['offset']);}return _0x3c1b2f[_0xfbfb('0x4a')](_0x3a2257);}})[_0xfbfb('0x22')](function(_0x3459e9){if(_0x3459e9){return _0x3459e9?{'count':_0x4c0956,'rows':_0x3459e9}:null;}})[_0xfbfb('0x22')](respondWithResult(_0xf0a31e,null))[_0xfbfb('0x3a')](handleError(_0xf0a31e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a22d47d..244ce4e 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 _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x2a565d,_0x3de579){var _0x6af3ca=function(_0x21e618){while(--_0x21e618){_0x2a565d['push'](_0x2a565d['shift']());}};_0x6af3ca(++_0x3de579);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x00bb[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x13485b,_0x29fb3e){_0x13485b=_0x13485b-0x0;var _0x4ae5e8=_0x6f0d[_0x13485b];return _0x4ae5e8;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'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 c5f057f..a482895 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 _0x2e71=['http','request','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5ac326,_0x14849f){var _0x4792b2=function(_0x1db610){while(--_0x1db610){_0x5ac326['push'](_0x5ac326['shift']());}};_0x4792b2(++_0x14849f);}(_0x2e71,0xc7));var _0x12e7=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x2e71[_0x40b3f2];return _0x4ce90c;};'use strict';var _=require(_0x12e7('0x0'));var util=require(_0x12e7('0x1'));var moment=require(_0x12e7('0x2'));var BPromise=require('bluebird');var rs=require(_0x12e7('0x3'));var fs=require('fs');var Redis=require(_0x12e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x12e7('0x5'));var logger=require(_0x12e7('0x6'))(_0x12e7('0x7'));var config=require(_0x12e7('0x8'));var jayson=require(_0x12e7('0x9'));var client=jayson[_0x12e7('0xa')][_0x12e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ba2f3,_0x59bcfd,_0x33eb1b){return new BPromise(function(_0x392f98,_0x4b2dfb){return client[_0x12e7('0xc')](_0x4ba2f3,_0x33eb1b)['then'](function(_0x568049){logger['info'](_0x12e7('0xd'),_0x59bcfd,'request\x20sent');logger[_0x12e7('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x59bcfd,_0x12e7('0xf'),JSON[_0x12e7('0x10')](_0x568049));if(_0x568049[_0x12e7('0x11')]){if(_0x568049[_0x12e7('0x11')][_0x12e7('0x12')]===0x1f4){logger['error'](_0x12e7('0xd'),_0x59bcfd,_0x568049[_0x12e7('0x11')]['message']);return _0x4b2dfb(_0x568049[_0x12e7('0x11')][_0x12e7('0x13')]);}logger[_0x12e7('0x11')](_0x12e7('0xd'),_0x59bcfd,_0x568049[_0x12e7('0x11')][_0x12e7('0x13')]);return _0x392f98(_0x568049['error'][_0x12e7('0x13')]);}else{logger['info'](_0x12e7('0xd'),_0x59bcfd,_0x12e7('0xf'));_0x392f98(_0x568049[_0x12e7('0x14')][_0x12e7('0x13')]);}})['catch'](function(_0x201878){logger[_0x12e7('0x11')](_0x12e7('0xd'),_0x59bcfd,_0x201878);_0x4b2dfb(_0x201878);});});} \ No newline at end of file +var _0x3994=['request\x20sent','debug','stringify','error','code','result','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x10d304,_0x1c2738){var _0x4edfdb=function(_0x473c87){while(--_0x473c87){_0x10d304['push'](_0x10d304['shift']());}};_0x4edfdb(++_0x1c2738);}(_0x3994,0xda));var _0x4399=function(_0x1c4fd8,_0x49d3b7){_0x1c4fd8=_0x1c4fd8-0x0;var _0x2cfb08=_0x3994[_0x1c4fd8];return _0x2cfb08;};'use strict';var _=require(_0x4399('0x0'));var util=require(_0x4399('0x1'));var moment=require(_0x4399('0x2'));var BPromise=require('bluebird');var rs=require(_0x4399('0x3'));var fs=require('fs');var Redis=require(_0x4399('0x4'));var db=require(_0x4399('0x5'))['db'];var utils=require(_0x4399('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4399('0x7')][_0x4399('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x524ad1,_0x220e05,_0x2973be){return new BPromise(function(_0x4b3bc3,_0x8566c2){return client[_0x4399('0x9')](_0x524ad1,_0x2973be)[_0x4399('0xa')](function(_0x415dcd){logger[_0x4399('0xb')](_0x4399('0xc'),_0x220e05,_0x4399('0xd'));logger[_0x4399('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x220e05,_0x4399('0xd'),JSON[_0x4399('0xf')](_0x415dcd));if(_0x415dcd[_0x4399('0x10')]){if(_0x415dcd[_0x4399('0x10')][_0x4399('0x11')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x220e05,_0x415dcd['error']['message']);return _0x8566c2(_0x415dcd['error']['message']);}logger[_0x4399('0x10')](_0x4399('0xc'),_0x220e05,_0x415dcd[_0x4399('0x10')]['message']);return _0x4b3bc3(_0x415dcd[_0x4399('0x10')]['message']);}else{logger[_0x4399('0xb')](_0x4399('0xc'),_0x220e05,_0x4399('0xd'));_0x4b3bc3(_0x415dcd[_0x4399('0x12')][_0x4399('0x13')]);}})[_0x4399('0x14')](function(_0x39f37b){logger[_0x4399('0x10')](_0x4399('0xc'),_0x220e05,_0x39f37b);_0x8566c2(_0x39f37b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index ebbc371..5981f0d 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 _0x11e0=['get','index','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller'];(function(_0x1d93fc,_0x188ff6){var _0x55dd2a=function(_0x5e3040){while(--_0x5e3040){_0x1d93fc['push'](_0x1d93fc['shift']());}};_0x55dd2a(++_0x188ff6);}(_0x11e0,0x173));var _0x011e=function(_0x22a66d,_0x2fb906){_0x22a66d=_0x22a66d-0x0;var _0x554732=_0x11e0[_0x22a66d];return _0x554732;};'use strict';var multer=require(_0x011e('0x0'));var util=require(_0x011e('0x1'));var path=require('path');var timeout=require(_0x011e('0x2'));var express=require(_0x011e('0x3'));var router=express['Router']();var fs_extra=require(_0x011e('0x4'));var auth=require(_0x011e('0x5'));var interaction=require(_0x011e('0x6'));var config=require(_0x011e('0x7'));var controller=require(_0x011e('0x8'));router[_0x011e('0x9')]('/',auth['isAuthenticated'](),controller[_0x011e('0xa')]);router['get'](_0x011e('0xb'),auth[_0x011e('0xc')](),controller[_0x011e('0xd')]);router['post']('/',auth[_0x011e('0xc')](),controller['create']);router[_0x011e('0xe')](_0x011e('0xb'),auth[_0x011e('0xc')](),controller[_0x011e('0xf')]);router[_0x011e('0x10')](_0x011e('0xb'),auth[_0x011e('0xc')](),controller[_0x011e('0x11')]);module[_0x011e('0x12')]=router; \ No newline at end of file +var _0x7c01=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x41f917,_0x159455){var _0x2cae71=function(_0x10b364){while(--_0x10b364){_0x41f917['push'](_0x41f917['shift']());}};_0x2cae71(++_0x159455);}(_0x7c01,0x16b));var _0x17c0=function(_0xaf670,_0xa1c276){_0xaf670=_0xaf670-0x0;var _0x5790e8=_0x7c01[_0xaf670];return _0x5790e8;};'use strict';var multer=require(_0x17c0('0x0'));var util=require(_0x17c0('0x1'));var path=require('path');var timeout=require(_0x17c0('0x2'));var express=require(_0x17c0('0x3'));var router=express[_0x17c0('0x4')]();var fs_extra=require(_0x17c0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x17c0('0x6'));var config=require(_0x17c0('0x7'));var controller=require(_0x17c0('0x8'));router[_0x17c0('0x9')]('/',auth[_0x17c0('0xa')](),controller[_0x17c0('0xb')]);router['get'](_0x17c0('0xc'),auth[_0x17c0('0xa')](),controller[_0x17c0('0xd')]);router[_0x17c0('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x17c0('0xf')](_0x17c0('0xc'),auth[_0x17c0('0xa')](),controller[_0x17c0('0x10')]);router[_0x17c0('0x11')](_0x17c0('0xc'),auth[_0x17c0('0xa')](),controller[_0x17c0('0x12')]);module[_0x17c0('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 50f0757..e786bcf 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 _0x2da8=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x477314,_0x3c18f3){var _0x41ab14=function(_0x4997f2){while(--_0x4997f2){_0x477314['push'](_0x477314['shift']());}};_0x41ab14(++_0x3c18f3);}(_0x2da8,0x126));var _0x82da=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2da8[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x82da('0x0'));module[_0x82da('0x1')]={'type':{'type':Sequelize[_0x82da('0x2')](_0x82da('0x3'),_0x82da('0x4'),_0x82da('0x5'),'keyValue',_0x82da('0x6')),'defaultValue':_0x82da('0x3')},'content':{'type':Sequelize[_0x82da('0x7')]},'key':{'type':Sequelize[_0x82da('0x7')]},'keyType':{'type':Sequelize[_0x82da('0x2')](_0x82da('0x3'),_0x82da('0x4'),_0x82da('0x5'))},'keyContent':{'type':Sequelize[_0x82da('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x82da('0x7')]},'customField':{'type':Sequelize[_0x82da('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2681=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x37aece,_0x543142){var _0x4ae063=function(_0x3ad3ac){while(--_0x3ad3ac){_0x37aece['push'](_0x37aece['shift']());}};_0x4ae063(++_0x543142);}(_0x2681,0x188));var _0x1268=function(_0x4624eb,_0x1585e8){_0x4624eb=_0x4624eb-0x0;var _0x18fa8c=_0x2681[_0x4624eb];return _0x18fa8c;};'use strict';var Sequelize=require(_0x1268('0x0'));module[_0x1268('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1268('0x2'),_0x1268('0x3'),_0x1268('0x4'),_0x1268('0x5'),_0x1268('0x6')),'defaultValue':_0x1268('0x2')},'content':{'type':Sequelize[_0x1268('0x7')]},'key':{'type':Sequelize[_0x1268('0x7')]},'keyType':{'type':Sequelize[_0x1268('0x8')](_0x1268('0x2'),_0x1268('0x3'),_0x1268('0x4'))},'keyContent':{'type':Sequelize[_0x1268('0x7')]},'idField':{'type':Sequelize[_0x1268('0x7')]},'nameField':{'type':Sequelize[_0x1268('0x7')]},'customField':{'type':Sequelize[_0x1268('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1268('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index c614dbe..1a1ec28 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 _0x93bb=['limit','count','set','json','apply','update','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','query','keys','attributes','intersection','fields','model','hasOwnProperty','nolimit','order','sort','filters','pick','where','type','VIRTUAL','filter','merge','options','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','eml-format','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x1818b4,_0x413b3a){var _0x214d1d=function(_0x27ae0f){while(--_0x27ae0f){_0x1818b4['push'](_0x1818b4['shift']());}};_0x214d1d(++_0x413b3a);}(_0x93bb,0x1eb));var _0xb93b=function(_0x3f62a5,_0x101c18){_0x3f62a5=_0x3f62a5-0x0;var _0x1943c0=_0x93bb[_0x3f62a5];return _0x1943c0;};'use strict';var emlformat=require(_0xb93b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb93b('0x1'));var rp=require('request-promise');var moment=require(_0xb93b('0x2'));var BPromise=require(_0xb93b('0x3'));var Mustache=require(_0xb93b('0x4'));var util=require('util');var path=require(_0xb93b('0x5'));var sox=require('sox');var csv=require(_0xb93b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb93b('0x7'));var _=require('lodash');var squel=require(_0xb93b('0x8'));var crypto=require(_0xb93b('0x9'));var jsforce=require(_0xb93b('0xa'));var deskjs=require(_0xb93b('0xb'));var toCsv=require(_0xb93b('0x6'));var querystring=require(_0xb93b('0xc'));var Papa=require(_0xb93b('0xd'));var Redis=require(_0xb93b('0xe'));var authService=require(_0xb93b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb93b('0x10'));var logger=require(_0xb93b('0x11'))(_0xb93b('0x12'));var utils=require(_0xb93b('0x13'));var config=require(_0xb93b('0x14'));var licenseUtil=require(_0xb93b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b094c,_0x3e6ac3){_0x3e6ac3=_0x3e6ac3||0xcc;return function(_0x246545){if(_0x246545){return _0x3b094c[_0xb93b('0x16')](_0x3e6ac3);}return _0x3b094c[_0xb93b('0x17')](_0x3e6ac3)[_0xb93b('0x18')]();};}function respondWithResult(_0x4a0d15,_0x239457){_0x239457=_0x239457||0xc8;return function(_0x1d7a93){if(_0x1d7a93){return _0x4a0d15['status'](_0x239457)['json'](_0x1d7a93);}};}function respondWithFilteredResult(_0x1cbaac,_0x3a462f){return function(_0x538d5f){if(_0x538d5f){var _0x3d6572=typeof _0x3a462f[_0xb93b('0x19')]===_0xb93b('0x1a')&&typeof _0x3a462f[_0xb93b('0x1b')]===_0xb93b('0x1a');var _0x559ab3=_0x538d5f[_0xb93b('0x1c')];var _0xebeff=_0x3d6572?0x0:_0x3a462f['offset'];var _0x19030c=_0x3d6572?_0x538d5f[_0xb93b('0x1c')]:_0x3a462f[_0xb93b('0x19')]+_0x3a462f[_0xb93b('0x1b')];var _0x58ace8;if(_0x19030c>=_0x559ab3){_0x19030c=_0x559ab3;_0x58ace8=0xc8;}else{_0x58ace8=0xce;}_0x1cbaac['status'](_0x58ace8);return _0x1cbaac[_0xb93b('0x1d')]('Content-Range',_0xebeff+'-'+_0x19030c+'/'+_0x559ab3)[_0xb93b('0x1e')](_0x538d5f);}return null;};}function patchUpdates(_0x48cbdb){return function(_0x485a65){try{jsonpatch[_0xb93b('0x1f')](_0x485a65,_0x48cbdb,!![]);}catch(_0xfc6e63){return BPromise['reject'](_0xfc6e63);}return _0x485a65['save']();};}function saveUpdates(_0x4ca9db,_0x56721d){return function(_0x516d4e){if(_0x516d4e){return _0x516d4e[_0xb93b('0x20')](_0x4ca9db)[_0xb93b('0x21')](function(_0x404533){return _0x404533;});}return null;};}function removeEntity(_0x490c88,_0x294d97){return function(_0x52ed2b){if(_0x52ed2b){return _0x52ed2b[_0xb93b('0x22')]()[_0xb93b('0x21')](function(){_0x490c88[_0xb93b('0x17')](0xcc)[_0xb93b('0x18')]();});}};}function handleEntityNotFound(_0x360543,_0x1d154e){return function(_0x203069){if(!_0x203069){_0x360543[_0xb93b('0x16')](0x194);}return _0x203069;};}function handleError(_0x7604c0,_0x4a9dd7){_0x4a9dd7=_0x4a9dd7||0x1f4;return function(_0x35d9f4){logger[_0xb93b('0x23')](_0x35d9f4[_0xb93b('0x24')]);if(_0x35d9f4['name']){delete _0x35d9f4[_0xb93b('0x25')];}_0x7604c0['status'](_0x4a9dd7)[_0xb93b('0x26')](_0x35d9f4);};}exports[_0xb93b('0x27')]=function(_0x13ce97,_0x289329){var _0x47c010={},_0xb4f6b8={},_0x5e7d13={'count':0x0,'rows':[]};var _0x4e6cfd=_[_0xb93b('0x28')](db[_0xb93b('0x29')][_0xb93b('0x2a')],function(_0x3308e7){return{'name':_0x3308e7[_0xb93b('0x2b')],'type':_0x3308e7['type'][_0xb93b('0x2c')]};});_0xb4f6b8['model']=_[_0xb93b('0x28')](_0x4e6cfd,_0xb93b('0x25'));_0xb4f6b8[_0xb93b('0x2d')]=_[_0xb93b('0x2e')](_0x13ce97['query']);_0xb4f6b8['filters']=_['intersection'](_0xb4f6b8['model'],_0xb4f6b8[_0xb93b('0x2d')]);_0x47c010[_0xb93b('0x2f')]=_[_0xb93b('0x30')](_0xb4f6b8['model'],qs['fields'](_0x13ce97[_0xb93b('0x2d')][_0xb93b('0x31')]));_0x47c010[_0xb93b('0x2f')]=_0x47c010[_0xb93b('0x2f')]['length']?_0x47c010[_0xb93b('0x2f')]:_0xb4f6b8[_0xb93b('0x32')];if(!_0x13ce97[_0xb93b('0x2d')][_0xb93b('0x33')](_0xb93b('0x34'))){_0x47c010[_0xb93b('0x1b')]=qs[_0xb93b('0x1b')](_0x13ce97[_0xb93b('0x2d')][_0xb93b('0x1b')]);_0x47c010['offset']=qs[_0xb93b('0x19')](_0x13ce97[_0xb93b('0x2d')][_0xb93b('0x19')]);}_0x47c010[_0xb93b('0x35')]=qs[_0xb93b('0x36')](_0x13ce97[_0xb93b('0x2d')][_0xb93b('0x36')]);_0x47c010['where']=qs[_0xb93b('0x37')](_[_0xb93b('0x38')](_0x13ce97[_0xb93b('0x2d')],_0xb4f6b8[_0xb93b('0x37')]),_0x4e6cfd);if(_0x13ce97[_0xb93b('0x2d')]['filter']){_0x47c010[_0xb93b('0x39')]=_['merge'](_0x47c010[_0xb93b('0x39')],{'$or':_[_0xb93b('0x28')](_0x4e6cfd,function(_0x29f6fd){if(_0x29f6fd[_0xb93b('0x3a')]!==_0xb93b('0x3b')){var _0x38eac7={};_0x38eac7[_0x29f6fd[_0xb93b('0x25')]]={'$like':'%'+_0x13ce97[_0xb93b('0x2d')][_0xb93b('0x3c')]+'%'};return _0x38eac7;}})});}_0x47c010=_[_0xb93b('0x3d')]({},_0x47c010,_0x13ce97[_0xb93b('0x3e')]);var _0x246f6a={'where':_0x47c010['where']};return db[_0xb93b('0x29')][_0xb93b('0x1c')](_0x246f6a)['then'](function(_0x2f333a){_0x5e7d13[_0xb93b('0x1c')]=_0x2f333a;if(_0x13ce97['query']['includeAll']){_0x47c010[_0xb93b('0x3f')]=[{'all':!![]}];}return db['Dynamics365Field'][_0xb93b('0x40')](_0x47c010);})[_0xb93b('0x21')](function(_0x29fd44){_0x5e7d13[_0xb93b('0x41')]=_0x29fd44;return _0x5e7d13;})[_0xb93b('0x21')](respondWithFilteredResult(_0x289329,_0x47c010))['catch'](handleError(_0x289329,null));};exports[_0xb93b('0x42')]=function(_0x40ca9,_0x160599){var _0x4c7dc5={'raw':!![],'where':{'id':_0x40ca9[_0xb93b('0x43')]['id']}},_0x4d7cfd={};_0x4d7cfd[_0xb93b('0x32')]=_['keys'](db[_0xb93b('0x29')][_0xb93b('0x2a')]);_0x4d7cfd[_0xb93b('0x2d')]=_[_0xb93b('0x2e')](_0x40ca9[_0xb93b('0x2d')]);_0x4d7cfd['filters']=_[_0xb93b('0x30')](_0x4d7cfd[_0xb93b('0x32')],_0x4d7cfd['query']);_0x4c7dc5[_0xb93b('0x2f')]=_[_0xb93b('0x30')](_0x4d7cfd[_0xb93b('0x32')],qs[_0xb93b('0x31')](_0x40ca9['query'][_0xb93b('0x31')]));_0x4c7dc5[_0xb93b('0x2f')]=_0x4c7dc5[_0xb93b('0x2f')][_0xb93b('0x44')]?_0x4c7dc5[_0xb93b('0x2f')]:_0x4d7cfd[_0xb93b('0x32')];if(_0x40ca9['query'][_0xb93b('0x45')]){_0x4c7dc5['include']=[{'all':!![]}];}_0x4c7dc5=_[_0xb93b('0x3d')]({},_0x4c7dc5,_0x40ca9[_0xb93b('0x3e')]);return db[_0xb93b('0x29')][_0xb93b('0x46')](_0x4c7dc5)[_0xb93b('0x21')](handleEntityNotFound(_0x160599,null))[_0xb93b('0x21')](respondWithResult(_0x160599,null))[_0xb93b('0x47')](handleError(_0x160599,null));};exports[_0xb93b('0x48')]=function(_0x37ecab,_0x2b2357){return db[_0xb93b('0x29')][_0xb93b('0x48')](_0x37ecab[_0xb93b('0x49')],{})['then'](respondWithResult(_0x2b2357,0xc9))[_0xb93b('0x47')](handleError(_0x2b2357,null));};exports['update']=function(_0x5038ec,_0x5906b1){if(_0x5038ec[_0xb93b('0x49')]['id']){delete _0x5038ec['body']['id'];}return db[_0xb93b('0x29')][_0xb93b('0x46')]({'where':{'id':_0x5038ec[_0xb93b('0x43')]['id']}})[_0xb93b('0x21')](handleEntityNotFound(_0x5906b1,null))['then'](saveUpdates(_0x5038ec[_0xb93b('0x49')],null))['then'](respondWithResult(_0x5906b1,null))['catch'](handleError(_0x5906b1,null));};exports[_0xb93b('0x22')]=function(_0x5a1f41,_0x15f0b6){return db['Dynamics365Field']['find']({'where':{'id':_0x5a1f41['params']['id']}})[_0xb93b('0x21')](handleEntityNotFound(_0x15f0b6,null))[_0xb93b('0x21')](removeEntity(_0x15f0b6,null))[_0xb93b('0x47')](handleError(_0x15f0b6,null));}; \ No newline at end of file +var _0xdaf5=['save','update','destroy','stack','name','send','map','Dynamics365Field','rawAttributes','model','query','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','then','includeAll','findAll','catch','show','params','keys','intersection','length','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','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','set','Content-Range','reject'];(function(_0x424e44,_0x402be9){var _0x49b69f=function(_0x2f751a){while(--_0x2f751a){_0x424e44['push'](_0x424e44['shift']());}};_0x49b69f(++_0x402be9);}(_0xdaf5,0x14e));var _0x5daf=function(_0x5dfe9b,_0x318b85){_0x5dfe9b=_0x5dfe9b-0x0;var _0x3bb0f4=_0xdaf5[_0x5dfe9b];return _0x3bb0f4;};'use strict';var emlformat=require(_0x5daf('0x0'));var rimraf=require(_0x5daf('0x1'));var zipdir=require(_0x5daf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5daf('0x3'));var moment=require(_0x5daf('0x4'));var BPromise=require(_0x5daf('0x5'));var Mustache=require(_0x5daf('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5daf('0x7'));var csv=require(_0x5daf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5daf('0x9'));var _=require('lodash');var squel=require(_0x5daf('0xa'));var crypto=require(_0x5daf('0xb'));var jsforce=require(_0x5daf('0xc'));var deskjs=require(_0x5daf('0xd'));var toCsv=require(_0x5daf('0x8'));var querystring=require(_0x5daf('0xe'));var Papa=require(_0x5daf('0xf'));var Redis=require(_0x5daf('0x10'));var authService=require(_0x5daf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5daf('0x12'));var hardwareService=require(_0x5daf('0x13'));var logger=require(_0x5daf('0x14'))(_0x5daf('0x15'));var utils=require(_0x5daf('0x16'));var config=require(_0x5daf('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5daf('0x18'))['db'];function respondWithStatusCode(_0x34a0a1,_0x5ae7c0){_0x5ae7c0=_0x5ae7c0||0xcc;return function(_0x28eb72){if(_0x28eb72){return _0x34a0a1[_0x5daf('0x19')](_0x5ae7c0);}return _0x34a0a1[_0x5daf('0x1a')](_0x5ae7c0)[_0x5daf('0x1b')]();};}function respondWithResult(_0x269cd6,_0x6143dc){_0x6143dc=_0x6143dc||0xc8;return function(_0x3e7e4b){if(_0x3e7e4b){return _0x269cd6[_0x5daf('0x1a')](_0x6143dc)[_0x5daf('0x1c')](_0x3e7e4b);}};}function respondWithFilteredResult(_0xc10c15,_0x37b4ca){return function(_0x46187a){if(_0x46187a){var _0x219413=typeof _0x37b4ca[_0x5daf('0x1d')]===_0x5daf('0x1e')&&typeof _0x37b4ca[_0x5daf('0x1f')]==='undefined';var _0x271c5e=_0x46187a['count'];var _0xe13cfb=_0x219413?0x0:_0x37b4ca['offset'];var _0x4e85c7=_0x219413?_0x46187a[_0x5daf('0x20')]:_0x37b4ca[_0x5daf('0x1d')]+_0x37b4ca['limit'];var _0xd25f13;if(_0x4e85c7>=_0x271c5e){_0x4e85c7=_0x271c5e;_0xd25f13=0xc8;}else{_0xd25f13=0xce;}_0xc10c15[_0x5daf('0x1a')](_0xd25f13);return _0xc10c15[_0x5daf('0x21')](_0x5daf('0x22'),_0xe13cfb+'-'+_0x4e85c7+'/'+_0x271c5e)['json'](_0x46187a);}return null;};}function patchUpdates(_0x25e989){return function(_0x222987){try{jsonpatch['apply'](_0x222987,_0x25e989,!![]);}catch(_0x25b5b5){return BPromise[_0x5daf('0x23')](_0x25b5b5);}return _0x222987[_0x5daf('0x24')]();};}function saveUpdates(_0x2a5603,_0x2d5c23){return function(_0x584353){if(_0x584353){return _0x584353[_0x5daf('0x25')](_0x2a5603)['then'](function(_0x5bc9b7){return _0x5bc9b7;});}return null;};}function removeEntity(_0x439b8b,_0x1ed65d){return function(_0xd850a){if(_0xd850a){return _0xd850a[_0x5daf('0x26')]()['then'](function(){_0x439b8b[_0x5daf('0x1a')](0xcc)[_0x5daf('0x1b')]();});}};}function handleEntityNotFound(_0x1ae61b,_0x40545f){return function(_0x110b49){if(!_0x110b49){_0x1ae61b[_0x5daf('0x19')](0x194);}return _0x110b49;};}function handleError(_0x112bf7,_0x624871){_0x624871=_0x624871||0x1f4;return function(_0x38d456){logger['error'](_0x38d456[_0x5daf('0x27')]);if(_0x38d456['name']){delete _0x38d456[_0x5daf('0x28')];}_0x112bf7['status'](_0x624871)[_0x5daf('0x29')](_0x38d456);};}exports['index']=function(_0x55c56a,_0x1169c1){var _0x5e9024={},_0x45cf5e={},_0x267bc5={'count':0x0,'rows':[]};var _0x5e4b39=_[_0x5daf('0x2a')](db[_0x5daf('0x2b')][_0x5daf('0x2c')],function(_0x1c62a7){return{'name':_0x1c62a7['fieldName'],'type':_0x1c62a7['type']['key']};});_0x45cf5e[_0x5daf('0x2d')]=_['map'](_0x5e4b39,'name');_0x45cf5e['query']=_['keys'](_0x55c56a[_0x5daf('0x2e')]);_0x45cf5e[_0x5daf('0x2f')]=_['intersection'](_0x45cf5e[_0x5daf('0x2d')],_0x45cf5e[_0x5daf('0x2e')]);_0x5e9024['attributes']=_['intersection'](_0x45cf5e[_0x5daf('0x2d')],qs['fields'](_0x55c56a[_0x5daf('0x2e')][_0x5daf('0x30')]));_0x5e9024[_0x5daf('0x31')]=_0x5e9024[_0x5daf('0x31')]['length']?_0x5e9024['attributes']:_0x45cf5e[_0x5daf('0x2d')];if(!_0x55c56a['query'][_0x5daf('0x32')](_0x5daf('0x33'))){_0x5e9024[_0x5daf('0x1f')]=qs[_0x5daf('0x1f')](_0x55c56a[_0x5daf('0x2e')][_0x5daf('0x1f')]);_0x5e9024[_0x5daf('0x1d')]=qs['offset'](_0x55c56a[_0x5daf('0x2e')][_0x5daf('0x1d')]);}_0x5e9024[_0x5daf('0x34')]=qs[_0x5daf('0x35')](_0x55c56a[_0x5daf('0x2e')][_0x5daf('0x35')]);_0x5e9024['where']=qs[_0x5daf('0x2f')](_[_0x5daf('0x36')](_0x55c56a[_0x5daf('0x2e')],_0x45cf5e[_0x5daf('0x2f')]),_0x5e4b39);if(_0x55c56a[_0x5daf('0x2e')][_0x5daf('0x37')]){_0x5e9024[_0x5daf('0x38')]=_['merge'](_0x5e9024[_0x5daf('0x38')],{'$or':_[_0x5daf('0x2a')](_0x5e4b39,function(_0x62e102){if(_0x62e102[_0x5daf('0x39')]!==_0x5daf('0x3a')){var _0x44dc45={};_0x44dc45[_0x62e102['name']]={'$like':'%'+_0x55c56a[_0x5daf('0x2e')][_0x5daf('0x37')]+'%'};return _0x44dc45;}})});}_0x5e9024=_[_0x5daf('0x3b')]({},_0x5e9024,_0x55c56a[_0x5daf('0x3c')]);var _0x759e47={'where':_0x5e9024[_0x5daf('0x38')]};return db[_0x5daf('0x2b')][_0x5daf('0x20')](_0x759e47)[_0x5daf('0x3d')](function(_0x3a6303){_0x267bc5['count']=_0x3a6303;if(_0x55c56a['query'][_0x5daf('0x3e')]){_0x5e9024['include']=[{'all':!![]}];}return db[_0x5daf('0x2b')][_0x5daf('0x3f')](_0x5e9024);})[_0x5daf('0x3d')](function(_0x53ebea){_0x267bc5['rows']=_0x53ebea;return _0x267bc5;})[_0x5daf('0x3d')](respondWithFilteredResult(_0x1169c1,_0x5e9024))[_0x5daf('0x40')](handleError(_0x1169c1,null));};exports[_0x5daf('0x41')]=function(_0x8389bd,_0x5685cd){var _0x1e1ed6={'raw':!![],'where':{'id':_0x8389bd[_0x5daf('0x42')]['id']}},_0x1c4225={};_0x1c4225[_0x5daf('0x2d')]=_[_0x5daf('0x43')](db[_0x5daf('0x2b')]['rawAttributes']);_0x1c4225[_0x5daf('0x2e')]=_[_0x5daf('0x43')](_0x8389bd[_0x5daf('0x2e')]);_0x1c4225[_0x5daf('0x2f')]=_[_0x5daf('0x44')](_0x1c4225[_0x5daf('0x2d')],_0x1c4225[_0x5daf('0x2e')]);_0x1e1ed6[_0x5daf('0x31')]=_[_0x5daf('0x44')](_0x1c4225[_0x5daf('0x2d')],qs['fields'](_0x8389bd['query']['fields']));_0x1e1ed6[_0x5daf('0x31')]=_0x1e1ed6[_0x5daf('0x31')][_0x5daf('0x45')]?_0x1e1ed6[_0x5daf('0x31')]:_0x1c4225[_0x5daf('0x2d')];if(_0x8389bd[_0x5daf('0x2e')][_0x5daf('0x3e')]){_0x1e1ed6[_0x5daf('0x46')]=[{'all':!![]}];}_0x1e1ed6=_[_0x5daf('0x3b')]({},_0x1e1ed6,_0x8389bd[_0x5daf('0x3c')]);return db[_0x5daf('0x2b')][_0x5daf('0x47')](_0x1e1ed6)['then'](handleEntityNotFound(_0x5685cd,null))[_0x5daf('0x3d')](respondWithResult(_0x5685cd,null))[_0x5daf('0x40')](handleError(_0x5685cd,null));};exports[_0x5daf('0x48')]=function(_0x402452,_0x1ce037){return db['Dynamics365Field'][_0x5daf('0x48')](_0x402452['body'],{})['then'](respondWithResult(_0x1ce037,0xc9))['catch'](handleError(_0x1ce037,null));};exports[_0x5daf('0x25')]=function(_0x1bd946,_0x111f3d){if(_0x1bd946[_0x5daf('0x49')]['id']){delete _0x1bd946[_0x5daf('0x49')]['id'];}return db['Dynamics365Field'][_0x5daf('0x47')]({'where':{'id':_0x1bd946[_0x5daf('0x42')]['id']}})[_0x5daf('0x3d')](handleEntityNotFound(_0x111f3d,null))[_0x5daf('0x3d')](saveUpdates(_0x1bd946['body'],null))[_0x5daf('0x3d')](respondWithResult(_0x111f3d,null))[_0x5daf('0x40')](handleError(_0x111f3d,null));};exports[_0x5daf('0x26')]=function(_0x5eb112,_0x409755){return db[_0x5daf('0x2b')][_0x5daf('0x47')]({'where':{'id':_0x5eb112[_0x5daf('0x42')]['id']}})[_0x5daf('0x3d')](handleEntityNotFound(_0x409755,null))[_0x5daf('0x3d')](removeEntity(_0x409755,null))[_0x5daf('0x40')](handleError(_0x409755,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 4e1ee79..856102b 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 _0x16e1=['dynamics365_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','define','Dynamics365Field'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0x16e1,0x18e));var _0x116e=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0x16e1[_0x903228];return _0xcec81d;};'use strict';var _=require(_0x116e('0x0'));var util=require(_0x116e('0x1'));var logger=require(_0x116e('0x2'))('api');var moment=require(_0x116e('0x3'));var BPromise=require(_0x116e('0x4'));var rp=require(_0x116e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x116e('0x6'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x2e3954,_0x2476be){return _0x2e3954[_0x116e('0x7')](_0x116e('0x8'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x116e('0x9'),'fields':['idField',_0x116e('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb30=['exports','define','int_dynamics365_fields','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x5ded6f,_0x50694d){var _0x1bdd0e=function(_0x4785e6){while(--_0x4785e6){_0x5ded6f['push'](_0x5ded6f['shift']());}};_0x1bdd0e(++_0x50694d);}(_0xeb30,0x8c));var _0x0eb3=function(_0x5c8a12,_0x11711c){_0x5c8a12=_0x5c8a12-0x0;var _0x520cf1=_0xeb30[_0x5c8a12];return _0x520cf1;};'use strict';var _=require(_0x0eb3('0x0'));var util=require(_0x0eb3('0x1'));var logger=require('../../config/logger')(_0x0eb3('0x2'));var moment=require(_0x0eb3('0x3'));var BPromise=require(_0x0eb3('0x4'));var rp=require(_0x0eb3('0x5'));var fs=require('fs');var path=require(_0x0eb3('0x6'));var rimraf=require(_0x0eb3('0x7'));var config=require(_0x0eb3('0x8'));var attributes=require(_0x0eb3('0x9'));module[_0x0eb3('0xa')]=function(_0x25e883,_0x458888){return _0x25e883[_0x0eb3('0xb')]('Dynamics365Field',attributes,{'tableName':_0x0eb3('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x0eb3('0xd'),_0x0eb3('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 57a24dc..074cbd3 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 _0x6b18=['moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x5c965e,_0x2556b7){var _0x1e1e49=function(_0x4b717c){while(--_0x4b717c){_0x5c965e['push'](_0x5c965e['shift']());}};_0x1e1e49(++_0x2556b7);}(_0x6b18,0x132));var _0x86b1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6b18[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x86b1('0x0'));var util=require(_0x86b1('0x1'));var moment=require(_0x86b1('0x2'));var BPromise=require(_0x86b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86b1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x86b1('0x5'))(_0x86b1('0x6'));var config=require(_0x86b1('0x7'));var jayson=require(_0x86b1('0x8'));var client=jayson[_0x86b1('0x9')][_0x86b1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4855dc,_0x11b153,_0x412ca3){return new BPromise(function(_0x5419c7,_0x49120b){return client[_0x86b1('0xb')](_0x4855dc,_0x412ca3)['then'](function(_0x19e1e2){logger[_0x86b1('0xc')](_0x86b1('0xd'),_0x11b153,_0x86b1('0xe'));logger[_0x86b1('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x11b153,'request\x20sent',JSON[_0x86b1('0x10')](_0x19e1e2));if(_0x19e1e2['error']){if(_0x19e1e2[_0x86b1('0x11')][_0x86b1('0x12')]===0x1f4){logger[_0x86b1('0x11')](_0x86b1('0xd'),_0x11b153,_0x19e1e2[_0x86b1('0x11')][_0x86b1('0x13')]);return _0x49120b(_0x19e1e2[_0x86b1('0x11')][_0x86b1('0x13')]);}logger[_0x86b1('0x11')](_0x86b1('0xd'),_0x11b153,_0x19e1e2[_0x86b1('0x11')]['message']);return _0x5419c7(_0x19e1e2[_0x86b1('0x11')][_0x86b1('0x13')]);}else{logger[_0x86b1('0xc')](_0x86b1('0xd'),_0x11b153,_0x86b1('0xe'));_0x5419c7(_0x19e1e2[_0x86b1('0x14')][_0x86b1('0x13')]);}})[_0x86b1('0x15')](function(_0x2d2901){logger['error'](_0x86b1('0xd'),_0x11b153,_0x2d2901);_0x49120b(_0x2d2901);});});} \ No newline at end of file +var _0xdded=['../../config/environment','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','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x26fbdb,_0x1ed4aa){var _0x2ebfb4=function(_0x553f35){while(--_0x553f35){_0x26fbdb['push'](_0x26fbdb['shift']());}};_0x2ebfb4(++_0x1ed4aa);}(_0xdded,0x177));var _0xddde=function(_0x10e451,_0x50890a){_0x10e451=_0x10e451-0x0;var _0x3f104c=_0xdded[_0x10e451];return _0x3f104c;};'use strict';var _=require(_0xddde('0x0'));var util=require('util');var moment=require(_0xddde('0x1'));var BPromise=require(_0xddde('0x2'));var rs=require(_0xddde('0x3'));var fs=require('fs');var Redis=require(_0xddde('0x4'));var db=require(_0xddde('0x5'))['db'];var utils=require(_0xddde('0x6'));var logger=require(_0xddde('0x7'))(_0xddde('0x8'));var config=require(_0xddde('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xddde('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a2da1,_0x742230,_0x526af8){return new BPromise(function(_0x3c68f5,_0x1e41a5){return client[_0xddde('0xb')](_0x1a2da1,_0x526af8)[_0xddde('0xc')](function(_0x373a87){logger[_0xddde('0xd')](_0xddde('0xe'),_0x742230,_0xddde('0xf'));logger[_0xddde('0x10')](_0xddde('0x11'),_0x742230,_0xddde('0xf'),JSON[_0xddde('0x12')](_0x373a87));if(_0x373a87[_0xddde('0x13')]){if(_0x373a87[_0xddde('0x13')][_0xddde('0x14')]===0x1f4){logger[_0xddde('0x13')](_0xddde('0xe'),_0x742230,_0x373a87[_0xddde('0x13')][_0xddde('0x15')]);return _0x1e41a5(_0x373a87[_0xddde('0x13')][_0xddde('0x15')]);}logger[_0xddde('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x742230,_0x373a87[_0xddde('0x13')][_0xddde('0x15')]);return _0x3c68f5(_0x373a87[_0xddde('0x13')][_0xddde('0x15')]);}else{logger[_0xddde('0xd')](_0xddde('0xe'),_0x742230,_0xddde('0xf'));_0x3c68f5(_0x373a87[_0xddde('0x16')][_0xddde('0x15')]);}})[_0xddde('0x17')](function(_0x327d0f){logger['error'](_0xddde('0xe'),_0x742230,_0x327d0f);_0x1e41a5(_0x327d0f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 8a722f5..89d4d86 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 _0xc429=['./intFreshdeskAccount.controller','get','index','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','/:id','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0xcd4d8e,_0x1fc2fd){var _0x1c3c61=function(_0x293f3c){while(--_0x293f3c){_0xcd4d8e['push'](_0xcd4d8e['shift']());}};_0x1c3c61(++_0x1fc2fd);}(_0xc429,0x1c5));var _0x9c42=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0xc429[_0x594e11];return _0x5418ad;};'use strict';var multer=require(_0x9c42('0x0'));var util=require(_0x9c42('0x1'));var path=require(_0x9c42('0x2'));var timeout=require(_0x9c42('0x3'));var express=require('express');var router=express[_0x9c42('0x4')]();var fs_extra=require(_0x9c42('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9c42('0x6'));var controller=require(_0x9c42('0x7'));router[_0x9c42('0x8')]('/',auth['isAuthenticated'](),controller[_0x9c42('0x9')]);router['get']('/:id',auth[_0x9c42('0xa')](),controller[_0x9c42('0xb')]);router['get']('/:id/configurations',auth[_0x9c42('0xa')](),controller[_0x9c42('0xc')]);router[_0x9c42('0x8')](_0x9c42('0xd'),auth[_0x9c42('0xa')](),controller[_0x9c42('0xe')]);router[_0x9c42('0xf')]('/',auth[_0x9c42('0xa')](),controller[_0x9c42('0x10')]);router[_0x9c42('0xf')](_0x9c42('0x11'),auth[_0x9c42('0xa')](),controller[_0x9c42('0x12')]);router[_0x9c42('0x13')]('/:id',auth[_0x9c42('0xa')](),controller['update']);router[_0x9c42('0x14')](_0x9c42('0x15'),auth['isAuthenticated'](),controller[_0x9c42('0x16')]);module['exports']=router; \ No newline at end of file +var _0xcdb1=['create','addConfiguration','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post'];(function(_0x5c1e19,_0x45a4db){var _0xbdc160=function(_0x41f7fc){while(--_0x41f7fc){_0x5c1e19['push'](_0x5c1e19['shift']());}};_0xbdc160(++_0x45a4db);}(_0xcdb1,0xb5));var _0x1cdb=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcdb1[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x1cdb('0x0'));var util=require(_0x1cdb('0x1'));var path=require('path');var timeout=require(_0x1cdb('0x2'));var express=require(_0x1cdb('0x3'));var router=express[_0x1cdb('0x4')]();var fs_extra=require(_0x1cdb('0x5'));var auth=require(_0x1cdb('0x6'));var interaction=require(_0x1cdb('0x7'));var config=require(_0x1cdb('0x8'));var controller=require(_0x1cdb('0x9'));router[_0x1cdb('0xa')]('/',auth[_0x1cdb('0xb')](),controller[_0x1cdb('0xc')]);router[_0x1cdb('0xa')](_0x1cdb('0xd'),auth[_0x1cdb('0xb')](),controller[_0x1cdb('0xe')]);router[_0x1cdb('0xa')](_0x1cdb('0xf'),auth[_0x1cdb('0xb')](),controller[_0x1cdb('0x10')]);router['get']('/:id/fields',auth[_0x1cdb('0xb')](),controller[_0x1cdb('0x11')]);router[_0x1cdb('0x12')]('/',auth[_0x1cdb('0xb')](),controller[_0x1cdb('0x13')]);router[_0x1cdb('0x12')](_0x1cdb('0xf'),auth[_0x1cdb('0xb')](),controller[_0x1cdb('0x14')]);router[_0x1cdb('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1cdb('0x16')]);router[_0x1cdb('0x17')](_0x1cdb('0xd'),auth[_0x1cdb('0xb')](),controller['destroy']);module[_0x1cdb('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 178d462..738f982 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 _0x2a07=['sequelize','exports','STRING','remoteUri'];(function(_0x40b046,_0x27857f){var _0x1558d4=function(_0xbfd78f){while(--_0xbfd78f){_0x40b046['push'](_0x40b046['shift']());}};_0x1558d4(++_0x27857f);}(_0x2a07,0x74));var _0x72a0=function(_0x3ed430,_0x5fafab){_0x3ed430=_0x3ed430-0x0;var _0xae4a10=_0x2a07[_0x3ed430];return _0xae4a10;};'use strict';var Sequelize=require(_0x72a0('0x0'));module[_0x72a0('0x1')]={'name':{'type':Sequelize[_0x72a0('0x2')]},'description':{'type':Sequelize[_0x72a0('0x2')]},'username':{'type':Sequelize[_0x72a0('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x72a0('0x2')]},'remoteUri':{'type':Sequelize[_0x72a0('0x2')],'unique':_0x72a0('0x3')},'serverUrl':{'type':Sequelize[_0x72a0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xcf2f=['exports','STRING','remoteUri','sequelize'];(function(_0x44aa75,_0x48f63c){var _0x58fae2=function(_0x4b46ad){while(--_0x4b46ad){_0x44aa75['push'](_0x44aa75['shift']());}};_0x58fae2(++_0x48f63c);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x3031c3,_0x259b58){_0x3031c3=_0x3031c3-0x0;var _0x3c5362=_0xcf2f[_0x3031c3];return _0x3c5362;};'use strict';var Sequelize=require(_0xfcf2('0x0'));module[_0xfcf2('0x1')]={'name':{'type':Sequelize[_0xfcf2('0x2')]},'description':{'type':Sequelize[_0xfcf2('0x2')]},'username':{'type':Sequelize[_0xfcf2('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfcf2('0x2')]},'remoteUri':{'type':Sequelize[_0xfcf2('0x2')],'unique':_0xfcf2('0x3')},'serverUrl':{'type':Sequelize[_0xfcf2('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 63977d1..12ad4ba 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 _0x7e05=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','map','fieldName','type','model','query','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','FreshdeskAccount','includeAll','include','findAll','params','rawAttributes','keys','intersection','find','catch','create','body','getConfigurations','findOne','length','addConfiguration','Subjects','getSubjects','Descriptions','channel','FreshdeskField','getFields','remoteUri','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x5cd09c,_0x3a35d8){var _0x53c867=function(_0x22aecf){while(--_0x22aecf){_0x5cd09c['push'](_0x5cd09c['shift']());}};_0x53c867(++_0x3a35d8);}(_0x7e05,0x69));var _0x57e0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e05[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x57e0('0x0'));var rimraf=require(_0x57e0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x57e0('0x2'));var rp=require('request-promise');var moment=require(_0x57e0('0x3'));var BPromise=require(_0x57e0('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x57e0('0x5'));var sox=require(_0x57e0('0x6'));var csv=require(_0x57e0('0x7'));var ejs=require(_0x57e0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57e0('0x9'));var squel=require('squel');var crypto=require(_0x57e0('0xa'));var jsforce=require(_0x57e0('0xb'));var deskjs=require(_0x57e0('0xc'));var toCsv=require(_0x57e0('0x7'));var querystring=require(_0x57e0('0xd'));var Papa=require(_0x57e0('0xe'));var Redis=require(_0x57e0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x57e0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57e0('0x11'));var logger=require('../../config/logger')(_0x57e0('0x12'));var utils=require(_0x57e0('0x13'));var config=require(_0x57e0('0x14'));var licenseUtil=require(_0x57e0('0x15'));var db=require(_0x57e0('0x16'))['db'];var integrations=require(_0x57e0('0x17'));function respondWithStatusCode(_0x142d1f,_0x114d14){_0x114d14=_0x114d14||0xcc;return function(_0x1ce916){if(_0x1ce916){return _0x142d1f['sendStatus'](_0x114d14);}return _0x142d1f[_0x57e0('0x18')](_0x114d14)[_0x57e0('0x19')]();};}function respondWithResult(_0x4a4562,_0x32babd){_0x32babd=_0x32babd||0xc8;return function(_0x5d56e3){if(_0x5d56e3){return _0x4a4562[_0x57e0('0x18')](_0x32babd)[_0x57e0('0x1a')](_0x5d56e3);}};}function respondWithFilteredResult(_0x746a9d,_0x2e0beb){return function(_0x304ec4){if(_0x304ec4){var _0x489fa2=typeof _0x2e0beb[_0x57e0('0x1b')]===_0x57e0('0x1c')&&typeof _0x2e0beb[_0x57e0('0x1d')]===_0x57e0('0x1c');var _0x11a289=_0x304ec4['count'];var _0xf7b54a=_0x489fa2?0x0:_0x2e0beb[_0x57e0('0x1b')];var _0x240c6d=_0x489fa2?_0x304ec4[_0x57e0('0x1e')]:_0x2e0beb[_0x57e0('0x1b')]+_0x2e0beb[_0x57e0('0x1d')];var _0x6065c6;if(_0x240c6d>=_0x11a289){_0x240c6d=_0x11a289;_0x6065c6=0xc8;}else{_0x6065c6=0xce;}_0x746a9d['status'](_0x6065c6);return _0x746a9d[_0x57e0('0x1f')](_0x57e0('0x20'),_0xf7b54a+'-'+_0x240c6d+'/'+_0x11a289)[_0x57e0('0x1a')](_0x304ec4);}return null;};}function patchUpdates(_0x3814a3){return function(_0x5c7214){try{jsonpatch[_0x57e0('0x21')](_0x5c7214,_0x3814a3,!![]);}catch(_0x373100){return BPromise[_0x57e0('0x22')](_0x373100);}return _0x5c7214[_0x57e0('0x23')]();};}function saveUpdates(_0x5d83c6,_0xc5b15){return function(_0x45acbd){if(_0x45acbd){return _0x45acbd[_0x57e0('0x24')](_0x5d83c6)['then'](function(_0x595696){return _0x595696;});}return null;};}function removeEntity(_0x44e84c,_0x3a6a14){return function(_0x41a8c9){if(_0x41a8c9){return _0x41a8c9[_0x57e0('0x25')]()[_0x57e0('0x26')](function(){_0x44e84c[_0x57e0('0x18')](0xcc)[_0x57e0('0x19')]();});}};}function handleEntityNotFound(_0x257e51,_0x34b9a4){return function(_0x5962ca){if(!_0x5962ca){_0x257e51[_0x57e0('0x27')](0x194);}return _0x5962ca;};}function handleError(_0x541c24,_0x12a4ec){_0x12a4ec=_0x12a4ec||0x1f4;return function(_0x16b550){logger['error'](_0x16b550[_0x57e0('0x28')]);if(_0x16b550[_0x57e0('0x29')]){delete _0x16b550['name'];}_0x541c24[_0x57e0('0x18')](_0x12a4ec)['send'](_0x16b550);};}exports['index']=function(_0x1a5402,_0x1b7d9c){var _0x2cef3e={},_0x4fa9f4={},_0x5e3e1a={'count':0x0,'rows':[]};var _0x34acd2=_[_0x57e0('0x2a')](db['FreshdeskAccount']['rawAttributes'],function(_0x50c156){return{'name':_0x50c156[_0x57e0('0x2b')],'type':_0x50c156[_0x57e0('0x2c')]['key']};});_0x4fa9f4[_0x57e0('0x2d')]=_[_0x57e0('0x2a')](_0x34acd2,_0x57e0('0x29'));_0x4fa9f4[_0x57e0('0x2e')]=_['keys'](_0x1a5402[_0x57e0('0x2e')]);_0x4fa9f4[_0x57e0('0x2f')]=_['intersection'](_0x4fa9f4['model'],_0x4fa9f4['query']);_0x2cef3e['attributes']=_['intersection'](_0x4fa9f4[_0x57e0('0x2d')],qs[_0x57e0('0x30')](_0x1a5402[_0x57e0('0x2e')][_0x57e0('0x30')]));_0x2cef3e[_0x57e0('0x31')]=_0x2cef3e['attributes']['length']?_0x2cef3e[_0x57e0('0x31')]:_0x4fa9f4[_0x57e0('0x2d')];if(!_0x1a5402[_0x57e0('0x2e')][_0x57e0('0x32')](_0x57e0('0x33'))){_0x2cef3e[_0x57e0('0x1d')]=qs[_0x57e0('0x1d')](_0x1a5402[_0x57e0('0x2e')][_0x57e0('0x1d')]);_0x2cef3e[_0x57e0('0x1b')]=qs[_0x57e0('0x1b')](_0x1a5402['query'][_0x57e0('0x1b')]);}_0x2cef3e[_0x57e0('0x34')]=qs['sort'](_0x1a5402['query'][_0x57e0('0x35')]);_0x2cef3e['where']=qs[_0x57e0('0x2f')](_[_0x57e0('0x36')](_0x1a5402['query'],_0x4fa9f4['filters']),_0x34acd2);if(_0x1a5402[_0x57e0('0x2e')][_0x57e0('0x37')]){_0x2cef3e[_0x57e0('0x38')]=_[_0x57e0('0x39')](_0x2cef3e[_0x57e0('0x38')],{'$or':_[_0x57e0('0x2a')](_0x34acd2,function(_0x5ea589){if(_0x5ea589[_0x57e0('0x2c')]!==_0x57e0('0x3a')){var _0x2308fb={};_0x2308fb[_0x5ea589['name']]={'$like':'%'+_0x1a5402[_0x57e0('0x2e')][_0x57e0('0x37')]+'%'};return _0x2308fb;}})});}_0x2cef3e=_[_0x57e0('0x39')]({},_0x2cef3e,_0x1a5402[_0x57e0('0x3b')]);var _0x4df606={'where':_0x2cef3e[_0x57e0('0x38')]};return db[_0x57e0('0x3c')][_0x57e0('0x1e')](_0x4df606)[_0x57e0('0x26')](function(_0x1d35ca){_0x5e3e1a[_0x57e0('0x1e')]=_0x1d35ca;if(_0x1a5402[_0x57e0('0x2e')][_0x57e0('0x3d')]){_0x2cef3e[_0x57e0('0x3e')]=[{'all':!![]}];}return db[_0x57e0('0x3c')][_0x57e0('0x3f')](_0x2cef3e);})[_0x57e0('0x26')](function(_0x113cb7){_0x5e3e1a['rows']=_0x113cb7;return _0x5e3e1a;})[_0x57e0('0x26')](respondWithFilteredResult(_0x1b7d9c,_0x2cef3e))['catch'](handleError(_0x1b7d9c,null));};exports['show']=function(_0xd800d9,_0xb28c93){var _0x424a06={'raw':![],'where':{'id':_0xd800d9[_0x57e0('0x40')]['id']}},_0x26ca30={};_0x26ca30[_0x57e0('0x2d')]=_['keys'](db[_0x57e0('0x3c')][_0x57e0('0x41')]);_0x26ca30[_0x57e0('0x2e')]=_[_0x57e0('0x42')](_0xd800d9[_0x57e0('0x2e')]);_0x26ca30[_0x57e0('0x2f')]=_['intersection'](_0x26ca30['model'],_0x26ca30[_0x57e0('0x2e')]);_0x424a06[_0x57e0('0x31')]=_[_0x57e0('0x43')](_0x26ca30[_0x57e0('0x2d')],qs[_0x57e0('0x30')](_0xd800d9[_0x57e0('0x2e')][_0x57e0('0x30')]));_0x424a06[_0x57e0('0x31')]=_0x424a06['attributes']['length']?_0x424a06[_0x57e0('0x31')]:_0x26ca30['model'];if(_0xd800d9[_0x57e0('0x2e')]['includeAll']){_0x424a06[_0x57e0('0x3e')]=[{'all':!![]}];}_0x424a06=_['merge']({},_0x424a06,_0xd800d9[_0x57e0('0x3b')]);return db[_0x57e0('0x3c')][_0x57e0('0x44')](_0x424a06)['then'](handleEntityNotFound(_0xb28c93,null))[_0x57e0('0x26')](respondWithResult(_0xb28c93,null))[_0x57e0('0x45')](handleError(_0xb28c93,null));};exports[_0x57e0('0x46')]=function(_0x2ddd3a,_0x198b5c){return db[_0x57e0('0x3c')][_0x57e0('0x46')](_0x2ddd3a[_0x57e0('0x47')],{})[_0x57e0('0x26')](respondWithResult(_0x198b5c,0xc9))['catch'](handleError(_0x198b5c,null));};exports[_0x57e0('0x24')]=function(_0x33dbdd,_0x2d8848){if(_0x33dbdd[_0x57e0('0x47')]['id']){delete _0x33dbdd[_0x57e0('0x47')]['id'];}return db[_0x57e0('0x3c')][_0x57e0('0x44')]({'where':{'id':_0x33dbdd[_0x57e0('0x40')]['id']}})[_0x57e0('0x26')](handleEntityNotFound(_0x2d8848,null))[_0x57e0('0x26')](saveUpdates(_0x33dbdd[_0x57e0('0x47')],null))[_0x57e0('0x26')](respondWithResult(_0x2d8848,null))[_0x57e0('0x45')](handleError(_0x2d8848,null));};exports['destroy']=function(_0x41461f,_0x5c0ce0){return db[_0x57e0('0x3c')][_0x57e0('0x44')]({'where':{'id':_0x41461f[_0x57e0('0x40')]['id']}})[_0x57e0('0x26')](handleEntityNotFound(_0x5c0ce0,null))['then'](removeEntity(_0x5c0ce0,null))['catch'](handleError(_0x5c0ce0,null));};exports[_0x57e0('0x48')]=function(_0x585e76,_0x1441b2,_0xa1f946){var _0x364131={};var _0x4f1cba={};var _0x1536cb;var _0x7a9807;return db[_0x57e0('0x3c')][_0x57e0('0x49')]({'where':{'id':_0x585e76[_0x57e0('0x40')]['id']}})[_0x57e0('0x26')](handleEntityNotFound(_0x1441b2,null))[_0x57e0('0x26')](function(_0x1ee94a){if(_0x1ee94a){_0x1536cb=_0x1ee94a;_0x4f1cba[_0x57e0('0x2d')]=_[_0x57e0('0x42')](db['FreshdeskConfiguration'][_0x57e0('0x41')]);_0x4f1cba['query']=_[_0x57e0('0x42')](_0x585e76[_0x57e0('0x2e')]);_0x4f1cba[_0x57e0('0x2f')]=_[_0x57e0('0x43')](_0x4f1cba[_0x57e0('0x2d')],_0x4f1cba[_0x57e0('0x2e')]);_0x364131[_0x57e0('0x31')]=_[_0x57e0('0x43')](_0x4f1cba[_0x57e0('0x2d')],qs[_0x57e0('0x30')](_0x585e76['query']['fields']));_0x364131['attributes']=_0x364131['attributes'][_0x57e0('0x4a')]?_0x364131[_0x57e0('0x31')]:_0x4f1cba[_0x57e0('0x2d')];_0x364131[_0x57e0('0x34')]=qs['sort'](_0x585e76['query'][_0x57e0('0x35')]);_0x364131['where']=qs[_0x57e0('0x2f')](_[_0x57e0('0x36')](_0x585e76[_0x57e0('0x2e')],_0x4f1cba[_0x57e0('0x2f')]));if(_0x585e76['query'][_0x57e0('0x37')]){_0x364131[_0x57e0('0x38')]=_[_0x57e0('0x39')](_0x364131[_0x57e0('0x38')],{'$or':_[_0x57e0('0x2a')](_0x364131[_0x57e0('0x31')],function(_0x233d4e){var _0x4e1dd0={};_0x4e1dd0[_0x233d4e]={'$like':'%'+_0x585e76[_0x57e0('0x2e')][_0x57e0('0x37')]+'%'};return _0x4e1dd0;})});}_0x364131=_[_0x57e0('0x39')]({},_0x364131,_0x585e76[_0x57e0('0x3b')]);return _0x1536cb[_0x57e0('0x48')](_0x364131);}})['then'](function(_0x5879d8){if(_0x5879d8){_0x7a9807=_0x5879d8[_0x57e0('0x4a')];if(!_0x585e76[_0x57e0('0x2e')][_0x57e0('0x32')]('nolimit')){_0x364131[_0x57e0('0x1d')]=qs[_0x57e0('0x1d')](_0x585e76[_0x57e0('0x2e')]['limit']);_0x364131[_0x57e0('0x1b')]=qs[_0x57e0('0x1b')](_0x585e76[_0x57e0('0x2e')]['offset']);}return _0x1536cb[_0x57e0('0x48')](_0x364131);}})[_0x57e0('0x26')](function(_0x5f5a1d){if(_0x5f5a1d){return _0x5f5a1d?{'count':_0x7a9807,'rows':_0x5f5a1d}:null;}})[_0x57e0('0x26')](respondWithResult(_0x1441b2,null))[_0x57e0('0x45')](handleError(_0x1441b2,null));};exports[_0x57e0('0x4b')]=function(_0x3f3e7e,_0x5d6dc1,_0x573917){if(_0x3f3e7e[_0x57e0('0x47')]['id']){delete _0x3f3e7e[_0x57e0('0x47')]['id'];}return db[_0x57e0('0x3c')]['findOne']({'where':{'id':_0x3f3e7e[_0x57e0('0x40')]['id']}})[_0x57e0('0x26')](handleEntityNotFound(_0x5d6dc1,null))[_0x57e0('0x26')](function(_0x3c76ad){if(_0x3c76ad){_0x3f3e7e[_0x57e0('0x47')]['AccountId']=_0x3c76ad['id'];_0x3f3e7e[_0x57e0('0x47')][_0x57e0('0x4c')]=integrations[_0x57e0('0x4d')](_0x3f3e7e['body']['channel'],_0x3f3e7e[_0x57e0('0x47')][_0x57e0('0x2c')]);_0x3f3e7e[_0x57e0('0x47')][_0x57e0('0x4e')]=integrations['getDescriptions'](_0x3f3e7e['body'][_0x57e0('0x4f')],_0x3f3e7e[_0x57e0('0x47')][_0x57e0('0x2c')]);return db['FreshdeskConfiguration'][_0x57e0('0x46')](_0x3f3e7e[_0x57e0('0x47')],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db[_0x57e0('0x50')],'as':_0x57e0('0x4e')}]});}return null;})[_0x57e0('0x26')](respondWithResult(_0x5d6dc1,null))[_0x57e0('0x45')](handleError(_0x5d6dc1,null));};exports[_0x57e0('0x51')]=function(_0x49f2fb,_0xcf36bb,_0xe208a0){var _0x2ca417='';return db[_0x57e0('0x3c')][_0x57e0('0x49')]({'where':{'id':_0x49f2fb['params']['id']},'attributes':['id','remoteUri','apiKey']})[_0x57e0('0x26')](handleEntityNotFound(_0xcf36bb,null))[_0x57e0('0x26')](function(_0x40f970){if(_0x40f970){_0x2ca417=_0x40f970[_0x57e0('0x52')];var _0x969f69=_0x2ca417['slice'](-0x1);if(_0x969f69==='/'){_0x2ca417=_0x2ca417[_0x57e0('0x53')](0x0,_0x2ca417[_0x57e0('0x54')](_0x969f69));}return rp({'method':_0x57e0('0x55'),'uri':util[_0x57e0('0x56')](_0x57e0('0x57'),_0x2ca417,_0x57e0('0x58')),'headers':{'Authorization':util[_0x57e0('0x56')](_0x57e0('0x59'),new Buffer(util[_0x57e0('0x56')](_0x57e0('0x5a'),_0x40f970['apiKey']))[_0x57e0('0x5b')](_0x57e0('0x5c')))},'json':!![]});}})[_0x57e0('0x26')](function(_0x42787e){if(_0x42787e){var _0x315afb=[_0x57e0('0x5d'),_0x57e0('0x5e'),_0x57e0('0x5f'),_0x57e0('0x60'),'status',_0x57e0('0x61'),_0x57e0('0x62'),_0x57e0('0x63'),_0x57e0('0x64'),'group',_0x57e0('0x65')];_[_0x57e0('0x66')](_0x42787e,function(_0x111766){return _0x315afb[_0x57e0('0x67')](_0x111766[_0x57e0('0x29')])||!_0x111766[_0x57e0('0x68')]&&_0x111766[_0x57e0('0x2c')]!==_0x57e0('0x69')&&_0x111766[_0x57e0('0x2c')]!==_0x57e0('0x6a');});return{'count':_0x42787e[_0x57e0('0x4a')],'rows':_['map'](_0x42787e,function(_0x5f6f42){return{'id':_0x5f6f42[_0x57e0('0x29')],'name':_0x5f6f42[_0x57e0('0x6b')],'custom':!_0x5f6f42[_0x57e0('0x68')],'options':_0x5f6f42[_0x57e0('0x6c')]?_[_0x57e0('0x2a')](_0x5f6f42['choices'],function(_0x2401b0){return{'name':_[_0x57e0('0x6d')](_0x2401b0),'value':_0x2401b0};}):[]};})};}})[_0x57e0('0x26')](respondWithResult(_0xcf36bb,null))[_0x57e0('0x45')](function(_0xa4554d){var _0xb4711a=_0x49f2fb[_0x57e0('0x2e')]['test']?0x1f4:_0xa4554d[_0x57e0('0x6e')]||0x1f4;logger[_0x57e0('0x6f')](_0x57e0('0x70'),_0x57e0('0x51'),_0xb4711a,JSON[_0x57e0('0x71')](_0xa4554d));delete _0xa4554d[_0x57e0('0x29')];if(_0xb4711a===0x191){_0xb4711a=0x190;}_0xcf36bb[_0x57e0('0x18')](_0xb4711a)[_0x57e0('0x72')](_0x49f2fb['query'][_0x57e0('0x73')]?{'message':_0x57e0('0x74'),'statusCode':_0xa4554d[_0x57e0('0x6e')]}:_0xa4554d);});}; \ No newline at end of file +var _0x2ca5=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','rows','params','find','catch','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','group','source','remove','includes','default','custom_dropdown','label','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x2ca5,0x108));var _0x52ca=function(_0x3c9f56,_0x198760){_0x3c9f56=_0x3c9f56-0x0;var _0x33f1be=_0x2ca5[_0x3c9f56];return _0x33f1be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x52ca('0x0'));var zipdir=require(_0x52ca('0x1'));var jsonpatch=require(_0x52ca('0x2'));var rp=require('request-promise');var moment=require(_0x52ca('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x52ca('0x4'));var path=require(_0x52ca('0x5'));var sox=require(_0x52ca('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x52ca('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x52ca('0x8'));var deskjs=require(_0x52ca('0x9'));var toCsv=require(_0x52ca('0xa'));var querystring=require(_0x52ca('0xb'));var Papa=require(_0x52ca('0xc'));var Redis=require(_0x52ca('0xd'));var authService=require(_0x52ca('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x52ca('0xf'));var hardwareService=require(_0x52ca('0x10'));var logger=require(_0x52ca('0x11'))(_0x52ca('0x12'));var utils=require(_0x52ca('0x13'));var config=require(_0x52ca('0x14'));var licenseUtil=require(_0x52ca('0x15'));var db=require(_0x52ca('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x630ea2,_0x3471f8){_0x3471f8=_0x3471f8||0xcc;return function(_0x31a9a8){if(_0x31a9a8){return _0x630ea2[_0x52ca('0x17')](_0x3471f8);}return _0x630ea2[_0x52ca('0x18')](_0x3471f8)[_0x52ca('0x19')]();};}function respondWithResult(_0x12982b,_0x42ec50){_0x42ec50=_0x42ec50||0xc8;return function(_0x36d0e8){if(_0x36d0e8){return _0x12982b['status'](_0x42ec50)['json'](_0x36d0e8);}};}function respondWithFilteredResult(_0x26e83b,_0x83f3bb){return function(_0x10f302){if(_0x10f302){var _0x8d230=typeof _0x83f3bb[_0x52ca('0x1a')]===_0x52ca('0x1b')&&typeof _0x83f3bb[_0x52ca('0x1c')]===_0x52ca('0x1b');var _0x3442f1=_0x10f302[_0x52ca('0x1d')];var _0x390cef=_0x8d230?0x0:_0x83f3bb['offset'];var _0x328ae3=_0x8d230?_0x10f302[_0x52ca('0x1d')]:_0x83f3bb[_0x52ca('0x1a')]+_0x83f3bb[_0x52ca('0x1c')];var _0x3fc685;if(_0x328ae3>=_0x3442f1){_0x328ae3=_0x3442f1;_0x3fc685=0xc8;}else{_0x3fc685=0xce;}_0x26e83b[_0x52ca('0x18')](_0x3fc685);return _0x26e83b[_0x52ca('0x1e')](_0x52ca('0x1f'),_0x390cef+'-'+_0x328ae3+'/'+_0x3442f1)[_0x52ca('0x20')](_0x10f302);}return null;};}function patchUpdates(_0x9b383a){return function(_0x4492ca){try{jsonpatch['apply'](_0x4492ca,_0x9b383a,!![]);}catch(_0x2d139f){return BPromise[_0x52ca('0x21')](_0x2d139f);}return _0x4492ca[_0x52ca('0x22')]();};}function saveUpdates(_0x1e5d58,_0x42bf69){return function(_0x2ea090){if(_0x2ea090){return _0x2ea090[_0x52ca('0x23')](_0x1e5d58)['then'](function(_0x3d100a){return _0x3d100a;});}return null;};}function removeEntity(_0xc2a75f,_0x3719ad){return function(_0x18f919){if(_0x18f919){return _0x18f919[_0x52ca('0x24')]()[_0x52ca('0x25')](function(){_0xc2a75f[_0x52ca('0x18')](0xcc)[_0x52ca('0x19')]();});}};}function handleEntityNotFound(_0x54b05e,_0x4f9ed4){return function(_0x303464){if(!_0x303464){_0x54b05e['sendStatus'](0x194);}return _0x303464;};}function handleError(_0x27cc1f,_0x1b67d8){_0x1b67d8=_0x1b67d8||0x1f4;return function(_0x5c4abc){logger[_0x52ca('0x26')](_0x5c4abc[_0x52ca('0x27')]);if(_0x5c4abc[_0x52ca('0x28')]){delete _0x5c4abc[_0x52ca('0x28')];}_0x27cc1f['status'](_0x1b67d8)[_0x52ca('0x29')](_0x5c4abc);};}exports[_0x52ca('0x2a')]=function(_0x551dea,_0x4e9a2a){var _0x25ea10={},_0x55f177={},_0x1b1d8f={'count':0x0,'rows':[]};var _0x18fea7=_[_0x52ca('0x2b')](db[_0x52ca('0x2c')][_0x52ca('0x2d')],function(_0x161e78){return{'name':_0x161e78[_0x52ca('0x2e')],'type':_0x161e78[_0x52ca('0x2f')][_0x52ca('0x30')]};});_0x55f177['model']=_[_0x52ca('0x2b')](_0x18fea7,_0x52ca('0x28'));_0x55f177[_0x52ca('0x31')]=_[_0x52ca('0x32')](_0x551dea['query']);_0x55f177[_0x52ca('0x33')]=_[_0x52ca('0x34')](_0x55f177[_0x52ca('0x35')],_0x55f177[_0x52ca('0x31')]);_0x25ea10[_0x52ca('0x36')]=_['intersection'](_0x55f177[_0x52ca('0x35')],qs[_0x52ca('0x37')](_0x551dea[_0x52ca('0x31')][_0x52ca('0x37')]));_0x25ea10[_0x52ca('0x36')]=_0x25ea10['attributes'][_0x52ca('0x38')]?_0x25ea10[_0x52ca('0x36')]:_0x55f177[_0x52ca('0x35')];if(!_0x551dea[_0x52ca('0x31')][_0x52ca('0x39')](_0x52ca('0x3a'))){_0x25ea10[_0x52ca('0x1c')]=qs['limit'](_0x551dea[_0x52ca('0x31')]['limit']);_0x25ea10[_0x52ca('0x1a')]=qs[_0x52ca('0x1a')](_0x551dea[_0x52ca('0x31')][_0x52ca('0x1a')]);}_0x25ea10[_0x52ca('0x3b')]=qs['sort'](_0x551dea[_0x52ca('0x31')][_0x52ca('0x3c')]);_0x25ea10[_0x52ca('0x3d')]=qs['filters'](_[_0x52ca('0x3e')](_0x551dea[_0x52ca('0x31')],_0x55f177[_0x52ca('0x33')]),_0x18fea7);if(_0x551dea[_0x52ca('0x31')][_0x52ca('0x3f')]){_0x25ea10[_0x52ca('0x3d')]=_['merge'](_0x25ea10[_0x52ca('0x3d')],{'$or':_[_0x52ca('0x2b')](_0x18fea7,function(_0x4c9d69){if(_0x4c9d69[_0x52ca('0x2f')]!==_0x52ca('0x40')){var _0x2d892c={};_0x2d892c[_0x4c9d69[_0x52ca('0x28')]]={'$like':'%'+_0x551dea[_0x52ca('0x31')][_0x52ca('0x3f')]+'%'};return _0x2d892c;}})});}_0x25ea10=_[_0x52ca('0x41')]({},_0x25ea10,_0x551dea[_0x52ca('0x42')]);var _0xea976c={'where':_0x25ea10['where']};return db[_0x52ca('0x2c')]['count'](_0xea976c)[_0x52ca('0x25')](function(_0x110ca7){_0x1b1d8f[_0x52ca('0x1d')]=_0x110ca7;if(_0x551dea[_0x52ca('0x31')]['includeAll']){_0x25ea10['include']=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x25ea10);})[_0x52ca('0x25')](function(_0x3b6954){_0x1b1d8f[_0x52ca('0x43')]=_0x3b6954;return _0x1b1d8f;})[_0x52ca('0x25')](respondWithFilteredResult(_0x4e9a2a,_0x25ea10))['catch'](handleError(_0x4e9a2a,null));};exports['show']=function(_0x1e8d16,_0x2c5787){var _0xd756d9={'raw':![],'where':{'id':_0x1e8d16[_0x52ca('0x44')]['id']}},_0x2afa53={};_0x2afa53[_0x52ca('0x35')]=_[_0x52ca('0x32')](db[_0x52ca('0x2c')][_0x52ca('0x2d')]);_0x2afa53[_0x52ca('0x31')]=_[_0x52ca('0x32')](_0x1e8d16['query']);_0x2afa53[_0x52ca('0x33')]=_['intersection'](_0x2afa53['model'],_0x2afa53[_0x52ca('0x31')]);_0xd756d9[_0x52ca('0x36')]=_[_0x52ca('0x34')](_0x2afa53['model'],qs[_0x52ca('0x37')](_0x1e8d16[_0x52ca('0x31')][_0x52ca('0x37')]));_0xd756d9[_0x52ca('0x36')]=_0xd756d9['attributes'][_0x52ca('0x38')]?_0xd756d9[_0x52ca('0x36')]:_0x2afa53['model'];if(_0x1e8d16[_0x52ca('0x31')]['includeAll']){_0xd756d9['include']=[{'all':!![]}];}_0xd756d9=_['merge']({},_0xd756d9,_0x1e8d16['options']);return db[_0x52ca('0x2c')][_0x52ca('0x45')](_0xd756d9)[_0x52ca('0x25')](handleEntityNotFound(_0x2c5787,null))['then'](respondWithResult(_0x2c5787,null))[_0x52ca('0x46')](handleError(_0x2c5787,null));};exports[_0x52ca('0x47')]=function(_0x2070f1,_0x471e35){return db[_0x52ca('0x2c')][_0x52ca('0x47')](_0x2070f1[_0x52ca('0x48')],{})[_0x52ca('0x25')](respondWithResult(_0x471e35,0xc9))[_0x52ca('0x46')](handleError(_0x471e35,null));};exports[_0x52ca('0x23')]=function(_0x1f65e2,_0x4cf6b1){if(_0x1f65e2[_0x52ca('0x48')]['id']){delete _0x1f65e2[_0x52ca('0x48')]['id'];}return db[_0x52ca('0x2c')][_0x52ca('0x45')]({'where':{'id':_0x1f65e2[_0x52ca('0x44')]['id']}})[_0x52ca('0x25')](handleEntityNotFound(_0x4cf6b1,null))[_0x52ca('0x25')](saveUpdates(_0x1f65e2[_0x52ca('0x48')],null))['then'](respondWithResult(_0x4cf6b1,null))['catch'](handleError(_0x4cf6b1,null));};exports['destroy']=function(_0x580cad,_0x4f5d18){return db[_0x52ca('0x2c')][_0x52ca('0x45')]({'where':{'id':_0x580cad[_0x52ca('0x44')]['id']}})[_0x52ca('0x25')](handleEntityNotFound(_0x4f5d18,null))['then'](removeEntity(_0x4f5d18,null))[_0x52ca('0x46')](handleError(_0x4f5d18,null));};exports[_0x52ca('0x49')]=function(_0x3e4b9e,_0x570b60,_0x264693){var _0x47cdc9={};var _0x465776={};var _0xd2957e;var _0x43d750;return db[_0x52ca('0x2c')]['findOne']({'where':{'id':_0x3e4b9e['params']['id']}})[_0x52ca('0x25')](handleEntityNotFound(_0x570b60,null))[_0x52ca('0x25')](function(_0x2d1a93){if(_0x2d1a93){_0xd2957e=_0x2d1a93;_0x465776[_0x52ca('0x35')]=_[_0x52ca('0x32')](db['FreshdeskConfiguration'][_0x52ca('0x2d')]);_0x465776[_0x52ca('0x31')]=_[_0x52ca('0x32')](_0x3e4b9e[_0x52ca('0x31')]);_0x465776[_0x52ca('0x33')]=_['intersection'](_0x465776['model'],_0x465776[_0x52ca('0x31')]);_0x47cdc9['attributes']=_['intersection'](_0x465776[_0x52ca('0x35')],qs[_0x52ca('0x37')](_0x3e4b9e[_0x52ca('0x31')][_0x52ca('0x37')]));_0x47cdc9[_0x52ca('0x36')]=_0x47cdc9[_0x52ca('0x36')][_0x52ca('0x38')]?_0x47cdc9[_0x52ca('0x36')]:_0x465776[_0x52ca('0x35')];_0x47cdc9[_0x52ca('0x3b')]=qs['sort'](_0x3e4b9e[_0x52ca('0x31')][_0x52ca('0x3c')]);_0x47cdc9[_0x52ca('0x3d')]=qs[_0x52ca('0x33')](_[_0x52ca('0x3e')](_0x3e4b9e[_0x52ca('0x31')],_0x465776[_0x52ca('0x33')]));if(_0x3e4b9e[_0x52ca('0x31')][_0x52ca('0x3f')]){_0x47cdc9[_0x52ca('0x3d')]=_['merge'](_0x47cdc9['where'],{'$or':_[_0x52ca('0x2b')](_0x47cdc9[_0x52ca('0x36')],function(_0x9de4e8){var _0x32bf1c={};_0x32bf1c[_0x9de4e8]={'$like':'%'+_0x3e4b9e[_0x52ca('0x31')]['filter']+'%'};return _0x32bf1c;})});}_0x47cdc9=_[_0x52ca('0x41')]({},_0x47cdc9,_0x3e4b9e[_0x52ca('0x42')]);return _0xd2957e['getConfigurations'](_0x47cdc9);}})['then'](function(_0x4ed6b5){if(_0x4ed6b5){_0x43d750=_0x4ed6b5[_0x52ca('0x38')];if(!_0x3e4b9e[_0x52ca('0x31')][_0x52ca('0x39')](_0x52ca('0x3a'))){_0x47cdc9[_0x52ca('0x1c')]=qs[_0x52ca('0x1c')](_0x3e4b9e[_0x52ca('0x31')]['limit']);_0x47cdc9[_0x52ca('0x1a')]=qs[_0x52ca('0x1a')](_0x3e4b9e[_0x52ca('0x31')][_0x52ca('0x1a')]);}return _0xd2957e[_0x52ca('0x49')](_0x47cdc9);}})[_0x52ca('0x25')](function(_0x411505){if(_0x411505){return _0x411505?{'count':_0x43d750,'rows':_0x411505}:null;}})['then'](respondWithResult(_0x570b60,null))[_0x52ca('0x46')](handleError(_0x570b60,null));};exports[_0x52ca('0x4a')]=function(_0x355a23,_0x172dd3,_0xe83173){if(_0x355a23[_0x52ca('0x48')]['id']){delete _0x355a23[_0x52ca('0x48')]['id'];}return db[_0x52ca('0x2c')][_0x52ca('0x4b')]({'where':{'id':_0x355a23['params']['id']}})[_0x52ca('0x25')](handleEntityNotFound(_0x172dd3,null))['then'](function(_0x4599b9){if(_0x4599b9){_0x355a23[_0x52ca('0x48')][_0x52ca('0x4c')]=_0x4599b9['id'];_0x355a23[_0x52ca('0x48')][_0x52ca('0x4d')]=integrations[_0x52ca('0x4e')](_0x355a23[_0x52ca('0x48')][_0x52ca('0x4f')],_0x355a23[_0x52ca('0x48')][_0x52ca('0x2f')]);_0x355a23['body'][_0x52ca('0x50')]=integrations['getDescriptions'](_0x355a23[_0x52ca('0x48')][_0x52ca('0x4f')],_0x355a23[_0x52ca('0x48')][_0x52ca('0x2f')]);return db['FreshdeskConfiguration']['create'](_0x355a23[_0x52ca('0x48')],{'include':[{'model':db['FreshdeskField'],'as':_0x52ca('0x4d')},{'model':db[_0x52ca('0x51')],'as':_0x52ca('0x50')}]});}return null;})[_0x52ca('0x25')](respondWithResult(_0x172dd3,null))[_0x52ca('0x46')](handleError(_0x172dd3,null));};exports[_0x52ca('0x52')]=function(_0x47c88a,_0x5b4a94,_0x36c7ce){var _0x2681b0='';return db[_0x52ca('0x2c')][_0x52ca('0x4b')]({'where':{'id':_0x47c88a[_0x52ca('0x44')]['id']},'attributes':['id',_0x52ca('0x53'),_0x52ca('0x54')]})[_0x52ca('0x25')](handleEntityNotFound(_0x5b4a94,null))[_0x52ca('0x25')](function(_0xab57b0){if(_0xab57b0){_0x2681b0=_0xab57b0['remoteUri'];var _0x1588a5=_0x2681b0[_0x52ca('0x55')](-0x1);if(_0x1588a5==='/'){_0x2681b0=_0x2681b0['substring'](0x0,_0x2681b0[_0x52ca('0x56')](_0x1588a5));}return rp({'method':'GET','uri':util[_0x52ca('0x57')]('%s/%s',_0x2681b0,_0x52ca('0x58')),'headers':{'Authorization':util[_0x52ca('0x57')](_0x52ca('0x59'),new Buffer(util[_0x52ca('0x57')](_0x52ca('0x5a'),_0xab57b0[_0x52ca('0x54')]))[_0x52ca('0x5b')](_0x52ca('0x5c')))},'json':!![]});}})['then'](function(_0x1ec0da){if(_0x1ec0da){var _0x1b208a=['requester','subject','agent','description',_0x52ca('0x18'),'priority',_0x52ca('0x5d'),_0x52ca('0x5e'),'ticket_type',_0x52ca('0x5d'),'company'];_[_0x52ca('0x5f')](_0x1ec0da,function(_0x3259f3){return _0x1b208a[_0x52ca('0x60')](_0x3259f3[_0x52ca('0x28')])||!_0x3259f3[_0x52ca('0x61')]&&_0x3259f3[_0x52ca('0x2f')]!=='custom_text'&&_0x3259f3[_0x52ca('0x2f')]!==_0x52ca('0x62');});return{'count':_0x1ec0da[_0x52ca('0x38')],'rows':_[_0x52ca('0x2b')](_0x1ec0da,function(_0x268088){return{'id':_0x268088[_0x52ca('0x28')],'name':_0x268088[_0x52ca('0x63')],'custom':!_0x268088['default'],'options':_0x268088[_0x52ca('0x64')]?_[_0x52ca('0x2b')](_0x268088[_0x52ca('0x64')],function(_0xfca5fd){return{'name':_[_0x52ca('0x65')](_0xfca5fd),'value':_0xfca5fd};}):[]};})};}})[_0x52ca('0x25')](respondWithResult(_0x5b4a94,null))['catch'](function(_0x159cee){var _0x5ba5e1=_0x47c88a['query']['test']?0x1f4:_0x159cee['statusCode']||0x1f4;logger[_0x52ca('0x26')](_0x52ca('0x66'),_0x52ca('0x52'),_0x5ba5e1,JSON['stringify'](_0x159cee));delete _0x159cee['name'];if(_0x5ba5e1===0x191){_0x5ba5e1=0x190;}_0x5b4a94[_0x52ca('0x18')](_0x5ba5e1)[_0x52ca('0x29')](_0x47c88a[_0x52ca('0x31')][_0x52ca('0x67')]?{'message':_0x52ca('0x68'),'statusCode':_0x159cee[_0x52ca('0x69')]}:_0x159cee);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index f356be9..06e11df 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 _0xa9a4=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','define','FreshdeskAccount'];(function(_0x2af75c,_0x4a0f4a){var _0x223afb=function(_0x1e2c23){while(--_0x1e2c23){_0x2af75c['push'](_0x2af75c['shift']());}};_0x223afb(++_0x4a0f4a);}(_0xa9a4,0xbb));var _0x4a9a=function(_0x39f3df,_0x1256c8){_0x39f3df=_0x39f3df-0x0;var _0x1259b6=_0xa9a4[_0x39f3df];return _0x1259b6;};'use strict';var _=require('lodash');var util=require(_0x4a9a('0x0'));var logger=require(_0x4a9a('0x1'))(_0x4a9a('0x2'));var moment=require(_0x4a9a('0x3'));var BPromise=require(_0x4a9a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a9a('0x5'));var rimraf=require(_0x4a9a('0x6'));var config=require(_0x4a9a('0x7'));var attributes=require(_0x4a9a('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1b76be,_0x5a1e54){return _0x1b76be[_0x4a9a('0x9')](_0x4a9a('0xa'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b90=['../../components/integrations/configuration','exports','define','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x3c2d7d,_0x442480){var _0x35c682=function(_0xdb8bec){while(--_0xdb8bec){_0x3c2d7d['push'](_0x3c2d7d['shift']());}};_0x35c682(++_0x442480);}(_0x6b90,0xc4));var _0x06b9=function(_0x280438,_0x1a2b94){_0x280438=_0x280438-0x0;var _0x26c9d6=_0x6b90[_0x280438];return _0x26c9d6;};'use strict';var _=require(_0x06b9('0x0'));var util=require(_0x06b9('0x1'));var logger=require(_0x06b9('0x2'))(_0x06b9('0x3'));var moment=require(_0x06b9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x06b9('0x5'));var rimraf=require(_0x06b9('0x6'));var config=require(_0x06b9('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x06b9('0x8'));module[_0x06b9('0x9')]=function(_0x2512cc,_0x54f872){return _0x2512cc[_0x06b9('0xa')]('FreshdeskAccount',attributes,{'tableName':_0x06b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 5f8a1c9..fe46365 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 _0x9d89=['ShowFreshdeskAccount','find','info','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','include','model','map'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9d89,0xd5));var _0x99d8=function(_0x20893b,_0x48e4fb){_0x20893b=_0x20893b-0x0;var _0x30e3bf=_0x9d89[_0x20893b];return _0x30e3bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x99d8('0x0'));var BPromise=require('bluebird');var rs=require(_0x99d8('0x1'));var fs=require('fs');var Redis=require(_0x99d8('0x2'));var db=require(_0x99d8('0x3'))['db'];var utils=require(_0x99d8('0x4'));var logger=require(_0x99d8('0x5'))(_0x99d8('0x6'));var config=require(_0x99d8('0x7'));var jayson=require(_0x99d8('0x8'));var client=jayson[_0x99d8('0x9')][_0x99d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34f4d4,_0x737e16,_0x18e11b){return new BPromise(function(_0x336de3,_0xec064d){return client[_0x99d8('0xb')](_0x34f4d4,_0x18e11b)[_0x99d8('0xc')](function(_0x585a97){logger['info'](_0x99d8('0xd'),_0x737e16,_0x99d8('0xe'));logger[_0x99d8('0xf')](_0x99d8('0x10'),_0x737e16,_0x99d8('0xe'),JSON[_0x99d8('0x11')](_0x585a97));if(_0x585a97[_0x99d8('0x12')]){if(_0x585a97[_0x99d8('0x12')]['code']===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x737e16,_0x585a97[_0x99d8('0x12')][_0x99d8('0x13')]);return _0xec064d(_0x585a97[_0x99d8('0x12')][_0x99d8('0x13')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x737e16,_0x585a97[_0x99d8('0x12')][_0x99d8('0x13')]);return _0x336de3(_0x585a97[_0x99d8('0x12')][_0x99d8('0x13')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x737e16,_0x99d8('0xe'));_0x336de3(_0x585a97[_0x99d8('0x14')][_0x99d8('0x13')]);}})[_0x99d8('0x15')](function(_0x550d1b){logger[_0x99d8('0x12')](_0x99d8('0xd'),_0x737e16,_0x550d1b);_0xec064d(_0x550d1b);});});}exports[_0x99d8('0x16')]=function(_0x4409a3){var _0x32af41=this;return new Promise(function(_0x5ee475,_0xb67833){return db[_0x99d8('0x17')][_0x99d8('0x18')]({'raw':_0x4409a3[_0x99d8('0x19')]?_0x4409a3[_0x99d8('0x19')][_0x99d8('0x1a')]===undefined?!![]:![]:!![],'where':_0x4409a3[_0x99d8('0x19')]?_0x4409a3[_0x99d8('0x19')][_0x99d8('0x1b')]||null:null,'attributes':_0x4409a3[_0x99d8('0x19')]?_0x4409a3[_0x99d8('0x19')][_0x99d8('0x1c')]||null:null,'limit':_0x4409a3[_0x99d8('0x19')]?_0x4409a3[_0x99d8('0x19')]['limit']||null:null,'include':_0x4409a3[_0x99d8('0x19')]?_0x4409a3[_0x99d8('0x19')][_0x99d8('0x1d')]?_['map'](_0x4409a3[_0x99d8('0x19')][_0x99d8('0x1d')],function(_0x28f8fc){return{'model':db[_0x28f8fc[_0x99d8('0x1e')]],'as':_0x28f8fc['as'],'attributes':_0x28f8fc['attributes'],'include':_0x28f8fc['include']?_[_0x99d8('0x1f')](_0x28f8fc[_0x99d8('0x1d')],function(_0x362796){return{'model':db[_0x362796[_0x99d8('0x1e')]],'as':_0x362796['as'],'attributes':_0x362796[_0x99d8('0x1c')],'include':_0x362796[_0x99d8('0x1d')]?_[_0x99d8('0x1f')](_0x362796[_0x99d8('0x1d')],function(_0x2d323e){return{'model':db[_0x2d323e[_0x99d8('0x1e')]],'as':_0x2d323e['as'],'attributes':_0x2d323e[_0x99d8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x99d8('0xc')](function(_0x110ba3){logger['info'](_0x99d8('0x16'),_0x4409a3);logger['debug'](_0x99d8('0x16'),_0x4409a3,JSON[_0x99d8('0x11')](_0x110ba3));_0x5ee475(_0x110ba3);})[_0x99d8('0x15')](function(_0x5d2d19){logger['error'](_0x99d8('0x16'),_0x5d2d19[_0x99d8('0x13')],_0x4409a3);_0xb67833(_0x32af41[_0x99d8('0x12')](0x1f4,_0x5d2d19[_0x99d8('0x13')]));});});};exports[_0x99d8('0x20')]=function(_0x364458){var _0x435625=this;return new Promise(function(_0x2434f4,_0x179ba8){return db[_0x99d8('0x17')][_0x99d8('0x21')]({'raw':_0x364458[_0x99d8('0x19')]?_0x364458[_0x99d8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x364458[_0x99d8('0x19')]?_0x364458[_0x99d8('0x19')][_0x99d8('0x1b')]||null:null,'attributes':_0x364458[_0x99d8('0x19')]?_0x364458[_0x99d8('0x19')][_0x99d8('0x1c')]||null:null,'include':_0x364458['options']?_0x364458[_0x99d8('0x19')][_0x99d8('0x1d')]?_[_0x99d8('0x1f')](_0x364458[_0x99d8('0x19')][_0x99d8('0x1d')],function(_0x1e203f){return{'model':db[_0x1e203f[_0x99d8('0x1e')]],'as':_0x1e203f['as'],'attributes':_0x1e203f[_0x99d8('0x1c')],'include':_0x1e203f[_0x99d8('0x1d')]?_[_0x99d8('0x1f')](_0x1e203f[_0x99d8('0x1d')],function(_0x320e1f){return{'model':db[_0x320e1f[_0x99d8('0x1e')]],'as':_0x320e1f['as'],'attributes':_0x320e1f[_0x99d8('0x1c')],'include':_0x320e1f[_0x99d8('0x1d')]?_[_0x99d8('0x1f')](_0x320e1f[_0x99d8('0x1d')],function(_0x55fe18){return{'model':db[_0x55fe18[_0x99d8('0x1e')]],'as':_0x55fe18['as'],'attributes':_0x55fe18[_0x99d8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a6c4f){logger[_0x99d8('0x22')](_0x99d8('0x20'),_0x364458);logger[_0x99d8('0xf')]('ShowFreshdeskAccount',_0x364458,JSON['stringify'](_0x2a6c4f));_0x2434f4(_0x2a6c4f);})[_0x99d8('0x15')](function(_0xbf2df9){logger[_0x99d8('0x12')](_0x99d8('0x20'),_0xbf2df9[_0x99d8('0x13')],_0x364458);_0x179ba8(_0x435625[_0x99d8('0x12')](0x1f4,_0xbf2df9['message']));});});}; \ No newline at end of file +var _0x3e25=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','code','error','message','GetFreshdeskAccount','FreshdeskAccount','options','where','attributes','limit','include','model','map','catch','ShowFreshdeskAccount','find','raw','stringify','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x55c1a7,_0x1d5001){var _0x1755d7=function(_0x4de7c0){while(--_0x4de7c0){_0x55c1a7['push'](_0x55c1a7['shift']());}};_0x1755d7(++_0x1d5001);}(_0x3e25,0x14f));var _0x53e2=function(_0x4bf0da,_0x34670d){_0x4bf0da=_0x4bf0da-0x0;var _0x148e8e=_0x3e25[_0x4bf0da];return _0x148e8e;};'use strict';var _=require(_0x53e2('0x0'));var util=require(_0x53e2('0x1'));var moment=require(_0x53e2('0x2'));var BPromise=require('bluebird');var rs=require(_0x53e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53e2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x53e2('0x5'))(_0x53e2('0x6'));var config=require(_0x53e2('0x7'));var jayson=require(_0x53e2('0x8'));var client=jayson[_0x53e2('0x9')][_0x53e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1905b4,_0x31c0fa,_0x431bee){return new BPromise(function(_0x1be9ef,_0xf13761){return client[_0x53e2('0xb')](_0x1905b4,_0x431bee)[_0x53e2('0xc')](function(_0x1570dc){logger[_0x53e2('0xd')](_0x53e2('0xe'),_0x31c0fa,_0x53e2('0xf'));logger[_0x53e2('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x31c0fa,_0x53e2('0xf'),JSON['stringify'](_0x1570dc));if(_0x1570dc['error']){if(_0x1570dc['error'][_0x53e2('0x11')]===0x1f4){logger[_0x53e2('0x12')](_0x53e2('0xe'),_0x31c0fa,_0x1570dc[_0x53e2('0x12')][_0x53e2('0x13')]);return _0xf13761(_0x1570dc[_0x53e2('0x12')][_0x53e2('0x13')]);}logger[_0x53e2('0x12')](_0x53e2('0xe'),_0x31c0fa,_0x1570dc['error'][_0x53e2('0x13')]);return _0x1be9ef(_0x1570dc[_0x53e2('0x12')][_0x53e2('0x13')]);}else{logger[_0x53e2('0xd')](_0x53e2('0xe'),_0x31c0fa,_0x53e2('0xf'));_0x1be9ef(_0x1570dc['result'][_0x53e2('0x13')]);}})['catch'](function(_0x33b1cb){logger[_0x53e2('0x12')](_0x53e2('0xe'),_0x31c0fa,_0x33b1cb);_0xf13761(_0x33b1cb);});});}exports[_0x53e2('0x14')]=function(_0x52bae6){var _0x4213d0=this;return new Promise(function(_0x323e53,_0x4f313a){return db[_0x53e2('0x15')]['findAll']({'raw':_0x52bae6[_0x53e2('0x16')]?_0x52bae6['options']['raw']===undefined?!![]:![]:!![],'where':_0x52bae6[_0x53e2('0x16')]?_0x52bae6[_0x53e2('0x16')][_0x53e2('0x17')]||null:null,'attributes':_0x52bae6[_0x53e2('0x16')]?_0x52bae6['options'][_0x53e2('0x18')]||null:null,'limit':_0x52bae6[_0x53e2('0x16')]?_0x52bae6['options'][_0x53e2('0x19')]||null:null,'include':_0x52bae6['options']?_0x52bae6[_0x53e2('0x16')][_0x53e2('0x1a')]?_['map'](_0x52bae6[_0x53e2('0x16')][_0x53e2('0x1a')],function(_0x9c5566){return{'model':db[_0x9c5566[_0x53e2('0x1b')]],'as':_0x9c5566['as'],'attributes':_0x9c5566[_0x53e2('0x18')],'include':_0x9c5566[_0x53e2('0x1a')]?_[_0x53e2('0x1c')](_0x9c5566[_0x53e2('0x1a')],function(_0x4e5101){return{'model':db[_0x4e5101[_0x53e2('0x1b')]],'as':_0x4e5101['as'],'attributes':_0x4e5101['attributes'],'include':_0x4e5101[_0x53e2('0x1a')]?_['map'](_0x4e5101['include'],function(_0x477f9f){return{'model':db[_0x477f9f[_0x53e2('0x1b')]],'as':_0x477f9f['as'],'attributes':_0x477f9f['attributes']};}):[]};}):[]};}):[]:[]})[_0x53e2('0xc')](function(_0x9ad531){logger['info'](_0x53e2('0x14'),_0x52bae6);logger[_0x53e2('0x10')](_0x53e2('0x14'),_0x52bae6,JSON['stringify'](_0x9ad531));_0x323e53(_0x9ad531);})[_0x53e2('0x1d')](function(_0x23ec9d){logger[_0x53e2('0x12')]('GetFreshdeskAccount',_0x23ec9d['message'],_0x52bae6);_0x4f313a(_0x4213d0['error'](0x1f4,_0x23ec9d['message']));});});};exports[_0x53e2('0x1e')]=function(_0x472925){var _0x4b915a=this;return new Promise(function(_0x264c70,_0x2768d1){return db['FreshdeskAccount'][_0x53e2('0x1f')]({'raw':_0x472925[_0x53e2('0x16')]?_0x472925['options'][_0x53e2('0x20')]===undefined?!![]:![]:!![],'where':_0x472925[_0x53e2('0x16')]?_0x472925[_0x53e2('0x16')]['where']||null:null,'attributes':_0x472925[_0x53e2('0x16')]?_0x472925[_0x53e2('0x16')][_0x53e2('0x18')]||null:null,'include':_0x472925[_0x53e2('0x16')]?_0x472925['options'][_0x53e2('0x1a')]?_['map'](_0x472925[_0x53e2('0x16')]['include'],function(_0x597a69){return{'model':db[_0x597a69['model']],'as':_0x597a69['as'],'attributes':_0x597a69[_0x53e2('0x18')],'include':_0x597a69['include']?_['map'](_0x597a69[_0x53e2('0x1a')],function(_0x442723){return{'model':db[_0x442723[_0x53e2('0x1b')]],'as':_0x442723['as'],'attributes':_0x442723['attributes'],'include':_0x442723[_0x53e2('0x1a')]?_[_0x53e2('0x1c')](_0x442723['include'],function(_0x38188f){return{'model':db[_0x38188f[_0x53e2('0x1b')]],'as':_0x38188f['as'],'attributes':_0x38188f[_0x53e2('0x18')]};}):[]};}):[]};}):[]:[]})[_0x53e2('0xc')](function(_0x3e4324){logger[_0x53e2('0xd')](_0x53e2('0x1e'),_0x472925);logger[_0x53e2('0x10')](_0x53e2('0x1e'),_0x472925,JSON[_0x53e2('0x21')](_0x3e4324));_0x264c70(_0x3e4324);})[_0x53e2('0x1d')](function(_0x145663){logger['error']('ShowFreshdeskAccount',_0x145663[_0x53e2('0x13')],_0x472925);_0x2768d1(_0x4b915a['error'](0x1f4,_0x145663[_0x53e2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index f52268d..20380bf 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 _0x2fac=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','delete','destroy','exports','util'];(function(_0x282aff,_0x2b0666){var _0x413a5b=function(_0x17e4d8){while(--_0x17e4d8){_0x282aff['push'](_0x282aff['shift']());}};_0x413a5b(++_0x2b0666);}(_0x2fac,0x8f));var _0xc2fa=function(_0x345cc2,_0x210154){_0x345cc2=_0x345cc2-0x0;var _0x4c1693=_0x2fac[_0x345cc2];return _0x4c1693;};'use strict';var multer=require('multer');var util=require(_0xc2fa('0x0'));var path=require(_0xc2fa('0x1'));var timeout=require('connect-timeout');var express=require(_0xc2fa('0x2'));var router=express['Router']();var fs_extra=require(_0xc2fa('0x3'));var auth=require(_0xc2fa('0x4'));var interaction=require(_0xc2fa('0x5'));var config=require('../../config/environment');var controller=require(_0xc2fa('0x6'));router[_0xc2fa('0x7')]('/',auth[_0xc2fa('0x8')](),controller[_0xc2fa('0x9')]);router[_0xc2fa('0x7')]('/:id',auth[_0xc2fa('0x8')](),controller[_0xc2fa('0xa')]);router[_0xc2fa('0x7')]('/:id/fields',auth[_0xc2fa('0x8')](),controller['getFields']);router[_0xc2fa('0x7')]('/:id/subjects',auth[_0xc2fa('0x8')](),controller[_0xc2fa('0xb')]);router[_0xc2fa('0x7')](_0xc2fa('0xc'),auth[_0xc2fa('0x8')](),controller[_0xc2fa('0xd')]);router[_0xc2fa('0x7')](_0xc2fa('0xe'),auth[_0xc2fa('0x8')](),controller[_0xc2fa('0xf')]);router['post']('/',auth[_0xc2fa('0x8')](),controller[_0xc2fa('0x10')]);router[_0xc2fa('0x11')](_0xc2fa('0xe'),auth[_0xc2fa('0x8')](),controller[_0xc2fa('0x12')]);router[_0xc2fa('0x13')](_0xc2fa('0x14'),auth[_0xc2fa('0x8')](),controller['update']);router[_0xc2fa('0x15')](_0xc2fa('0x14'),auth[_0xc2fa('0x8')](),controller[_0xc2fa('0x16')]);module[_0xc2fa('0x17')]=router; \ No newline at end of file +var _0x8a79=['put','update','delete','destroy','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','index','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','setTags'];(function(_0x5b0163,_0x2393ea){var _0x15ef9e=function(_0x954c25){while(--_0x954c25){_0x5b0163['push'](_0x5b0163['shift']());}};_0x15ef9e(++_0x2393ea);}(_0x8a79,0x7c));var _0x98a7=function(_0x14e64f,_0x4fc3f7){_0x14e64f=_0x14e64f-0x0;var _0x49f49f=_0x8a79[_0x14e64f];return _0x49f49f;};'use strict';var multer=require('multer');var util=require(_0x98a7('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x98a7('0x1'));var router=express[_0x98a7('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x98a7('0x3'));var interaction=require(_0x98a7('0x4'));var config=require(_0x98a7('0x5'));var controller=require(_0x98a7('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x98a7('0x7')]);router[_0x98a7('0x8')]('/:id',auth[_0x98a7('0x9')](),controller[_0x98a7('0xa')]);router[_0x98a7('0x8')](_0x98a7('0xb'),auth[_0x98a7('0x9')](),controller[_0x98a7('0xc')]);router[_0x98a7('0x8')](_0x98a7('0xd'),auth['isAuthenticated'](),controller[_0x98a7('0xe')]);router[_0x98a7('0x8')](_0x98a7('0xf'),auth[_0x98a7('0x9')](),controller[_0x98a7('0x10')]);router[_0x98a7('0x8')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0x98a7('0x11')]('/',auth['isAuthenticated'](),controller[_0x98a7('0x12')]);router['post']('/:id/tags',auth[_0x98a7('0x9')](),controller[_0x98a7('0x13')]);router[_0x98a7('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x98a7('0x15')]);router[_0x98a7('0x16')]('/:id',auth[_0x98a7('0x9')](),controller[_0x98a7('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index a688135..8e50fff 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1d3d=['sequelize','exports','STRING'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x1d3d,0xcc));var _0xd1d3=function(_0x26dcae,_0x5be1cd){_0x26dcae=_0x26dcae-0x0;var _0x28fde8=_0x1d3d[_0x26dcae];return _0x28fde8;};'use strict';var Sequelize=require(_0xd1d3('0x0'));module[_0xd1d3('0x1')]={'name':{'type':Sequelize[_0xd1d3('0x2')]},'description':{'type':Sequelize[_0xd1d3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 6c44563..fb3139c 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 _0x577f=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','update','destroy','error','stack','name','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','then','rows','catch','show','params','keys','find','create','body','getFields','findOne','getSubjects','getDescriptions','FreshdeskField','getTags','setTags','ids','eml-format','zip-dir','request-promise','moment','bluebird','util'];(function(_0x42dbb1,_0x538cd9){var _0x3f5d65=function(_0xec5080){while(--_0xec5080){_0x42dbb1['push'](_0x42dbb1['shift']());}};_0x3f5d65(++_0x538cd9);}(_0x577f,0x1ce));var _0xf577=function(_0x1fbbc6,_0x50d7d4){_0x1fbbc6=_0x1fbbc6-0x0;var _0x548bda=_0x577f[_0x1fbbc6];return _0x548bda;};'use strict';var emlformat=require(_0xf577('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf577('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf577('0x2'));var moment=require(_0xf577('0x3'));var BPromise=require(_0xf577('0x4'));var Mustache=require('mustache');var util=require(_0xf577('0x5'));var path=require('path');var sox=require(_0xf577('0x6'));var csv=require(_0xf577('0x7'));var ejs=require(_0xf577('0x8'));var fs=require('fs');var fs_extra=require(_0xf577('0x9'));var _=require(_0xf577('0xa'));var squel=require('squel');var crypto=require(_0xf577('0xb'));var jsforce=require(_0xf577('0xc'));var deskjs=require(_0xf577('0xd'));var toCsv=require(_0xf577('0x7'));var querystring=require(_0xf577('0xe'));var Papa=require('papaparse');var Redis=require(_0xf577('0xf'));var authService=require(_0xf577('0x10'));var qs=require(_0xf577('0x11'));var as=require(_0xf577('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf577('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf577('0x14'));var db=require(_0xf577('0x15'))['db'];function respondWithStatusCode(_0x1e75cd,_0x33f141){_0x33f141=_0x33f141||0xcc;return function(_0x58dd5c){if(_0x58dd5c){return _0x1e75cd[_0xf577('0x16')](_0x33f141);}return _0x1e75cd['status'](_0x33f141)['end']();};}function respondWithResult(_0x8853e8,_0x1e6432){_0x1e6432=_0x1e6432||0xc8;return function(_0x15db74){if(_0x15db74){return _0x8853e8[_0xf577('0x17')](_0x1e6432)[_0xf577('0x18')](_0x15db74);}};}function respondWithFilteredResult(_0x464146,_0x23a076){return function(_0x24f28e){if(_0x24f28e){var _0x580be6=typeof _0x23a076[_0xf577('0x19')]==='undefined'&&typeof _0x23a076[_0xf577('0x1a')]==='undefined';var _0x5f28f5=_0x24f28e[_0xf577('0x1b')];var _0x208891=_0x580be6?0x0:_0x23a076[_0xf577('0x19')];var _0x12636b=_0x580be6?_0x24f28e[_0xf577('0x1b')]:_0x23a076[_0xf577('0x19')]+_0x23a076[_0xf577('0x1a')];var _0x3660ff;if(_0x12636b>=_0x5f28f5){_0x12636b=_0x5f28f5;_0x3660ff=0xc8;}else{_0x3660ff=0xce;}_0x464146['status'](_0x3660ff);return _0x464146[_0xf577('0x1c')](_0xf577('0x1d'),_0x208891+'-'+_0x12636b+'/'+_0x5f28f5)[_0xf577('0x18')](_0x24f28e);}return null;};}function patchUpdates(_0x5f23ff){return function(_0x22f0f3){try{jsonpatch['apply'](_0x22f0f3,_0x5f23ff,!![]);}catch(_0x528b79){return BPromise['reject'](_0x528b79);}return _0x22f0f3['save']();};}function saveUpdates(_0x50dd89,_0x2d85c0){return function(_0x31f380){if(_0x31f380){return _0x31f380[_0xf577('0x1e')](_0x50dd89)['then'](function(_0x340bb7){return _0x340bb7;});}return null;};}function removeEntity(_0x3202cd,_0x130ae1){return function(_0xa192a7){if(_0xa192a7){return _0xa192a7[_0xf577('0x1f')]()['then'](function(){_0x3202cd[_0xf577('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xee8726,_0x17947a){return function(_0x517fbb){if(!_0x517fbb){_0xee8726['sendStatus'](0x194);}return _0x517fbb;};}function handleError(_0x4fa074,_0x5906ec){_0x5906ec=_0x5906ec||0x1f4;return function(_0x19a879){logger[_0xf577('0x20')](_0x19a879[_0xf577('0x21')]);if(_0x19a879[_0xf577('0x22')]){delete _0x19a879[_0xf577('0x22')];}_0x4fa074[_0xf577('0x17')](_0x5906ec)['send'](_0x19a879);};}exports[_0xf577('0x23')]=function(_0x308c60,_0x3418f7){var _0x39325e={},_0x222316={},_0x130c0b={'count':0x0,'rows':[]};var _0x4eb42d=_['map'](db[_0xf577('0x24')][_0xf577('0x25')],function(_0x1a6a9b){return{'name':_0x1a6a9b[_0xf577('0x26')],'type':_0x1a6a9b[_0xf577('0x27')][_0xf577('0x28')]};});_0x222316['model']=_['map'](_0x4eb42d,'name');_0x222316[_0xf577('0x29')]=_['keys'](_0x308c60[_0xf577('0x29')]);_0x222316[_0xf577('0x2a')]=_[_0xf577('0x2b')](_0x222316[_0xf577('0x2c')],_0x222316['query']);_0x39325e[_0xf577('0x2d')]=_[_0xf577('0x2b')](_0x222316[_0xf577('0x2c')],qs[_0xf577('0x2e')](_0x308c60[_0xf577('0x29')]['fields']));_0x39325e[_0xf577('0x2d')]=_0x39325e[_0xf577('0x2d')][_0xf577('0x2f')]?_0x39325e[_0xf577('0x2d')]:_0x222316[_0xf577('0x2c')];if(!_0x308c60[_0xf577('0x29')][_0xf577('0x30')](_0xf577('0x31'))){_0x39325e[_0xf577('0x1a')]=qs['limit'](_0x308c60[_0xf577('0x29')][_0xf577('0x1a')]);_0x39325e[_0xf577('0x19')]=qs[_0xf577('0x19')](_0x308c60[_0xf577('0x29')][_0xf577('0x19')]);}_0x39325e[_0xf577('0x32')]=qs[_0xf577('0x33')](_0x308c60[_0xf577('0x29')][_0xf577('0x33')]);_0x39325e[_0xf577('0x34')]=qs['filters'](_[_0xf577('0x35')](_0x308c60[_0xf577('0x29')],_0x222316[_0xf577('0x2a')]),_0x4eb42d);if(_0x308c60[_0xf577('0x29')][_0xf577('0x36')]){_0x39325e[_0xf577('0x34')]=_[_0xf577('0x37')](_0x39325e['where'],{'$or':_[_0xf577('0x38')](_0x4eb42d,function(_0x2fcc84){if(_0x2fcc84['type']!=='VIRTUAL'){var _0x36ee2d={};_0x36ee2d[_0x2fcc84[_0xf577('0x22')]]={'$like':'%'+_0x308c60['query'][_0xf577('0x36')]+'%'};return _0x36ee2d;}})});}_0x39325e=_[_0xf577('0x37')]({},_0x39325e,_0x308c60[_0xf577('0x39')]);var _0x75a92f={'where':_0x39325e['where']};return db['FreshdeskConfiguration'][_0xf577('0x1b')](_0x75a92f)['then'](function(_0x1c6660){_0x130c0b[_0xf577('0x1b')]=_0x1c6660;if(_0x308c60[_0xf577('0x29')][_0xf577('0x3a')]){_0x39325e[_0xf577('0x3b')]=[{'all':!![]}];}return db[_0xf577('0x24')][_0xf577('0x3c')](_0x39325e);})[_0xf577('0x3d')](function(_0x23b3da){_0x130c0b[_0xf577('0x3e')]=_0x23b3da;return _0x130c0b;})[_0xf577('0x3d')](respondWithFilteredResult(_0x3418f7,_0x39325e))[_0xf577('0x3f')](handleError(_0x3418f7,null));};exports[_0xf577('0x40')]=function(_0x5adcda,_0xf4f37d){var _0x1e29b7={'raw':![],'where':{'id':_0x5adcda[_0xf577('0x41')]['id']}},_0x20e3bb={};_0x20e3bb[_0xf577('0x2c')]=_[_0xf577('0x42')](db['FreshdeskConfiguration']['rawAttributes']);_0x20e3bb[_0xf577('0x29')]=_[_0xf577('0x42')](_0x5adcda['query']);_0x20e3bb['filters']=_[_0xf577('0x2b')](_0x20e3bb[_0xf577('0x2c')],_0x20e3bb[_0xf577('0x29')]);_0x1e29b7[_0xf577('0x2d')]=_[_0xf577('0x2b')](_0x20e3bb[_0xf577('0x2c')],qs['fields'](_0x5adcda[_0xf577('0x29')][_0xf577('0x2e')]));_0x1e29b7[_0xf577('0x2d')]=_0x1e29b7[_0xf577('0x2d')][_0xf577('0x2f')]?_0x1e29b7[_0xf577('0x2d')]:_0x20e3bb['model'];if(_0x5adcda[_0xf577('0x29')][_0xf577('0x3a')]){_0x1e29b7[_0xf577('0x3b')]=[{'all':!![]}];}_0x1e29b7=_[_0xf577('0x37')]({},_0x1e29b7,_0x5adcda[_0xf577('0x39')]);return db[_0xf577('0x24')][_0xf577('0x43')](_0x1e29b7)['then'](handleEntityNotFound(_0xf4f37d,null))[_0xf577('0x3d')](respondWithResult(_0xf4f37d,null))['catch'](handleError(_0xf4f37d,null));};exports[_0xf577('0x44')]=function(_0x360c96,_0x186e4f){return db['FreshdeskConfiguration'][_0xf577('0x44')](_0x360c96[_0xf577('0x45')],{})[_0xf577('0x3d')](respondWithResult(_0x186e4f,0xc9))['catch'](handleError(_0x186e4f,null));};exports['update']=function(_0x6f02ff,_0x4abe93){if(_0x6f02ff[_0xf577('0x45')]['id']){delete _0x6f02ff[_0xf577('0x45')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x6f02ff[_0xf577('0x41')]['id']}})[_0xf577('0x3d')](handleEntityNotFound(_0x4abe93,null))[_0xf577('0x3d')](saveUpdates(_0x6f02ff['body'],null))[_0xf577('0x3d')](respondWithResult(_0x4abe93,null))[_0xf577('0x3f')](handleError(_0x4abe93,null));};exports[_0xf577('0x1f')]=function(_0x428c50,_0xdeffe8){return db[_0xf577('0x24')]['find']({'where':{'id':_0x428c50[_0xf577('0x41')]['id']}})[_0xf577('0x3d')](handleEntityNotFound(_0xdeffe8,null))[_0xf577('0x3d')](removeEntity(_0xdeffe8,null))[_0xf577('0x3f')](handleError(_0xdeffe8,null));};exports[_0xf577('0x46')]=function(_0x9d71c,_0x540b99,_0x3fb5d1){var _0x4cbe3c={};var _0x4d4234={};var _0x2f5a50;var _0x2d404e;return db[_0xf577('0x24')][_0xf577('0x47')]({'where':{'id':_0x9d71c['params']['id']}})[_0xf577('0x3d')](handleEntityNotFound(_0x540b99,null))['then'](function(_0xda8e9){if(_0xda8e9){_0x2f5a50=_0xda8e9;_0x4d4234['model']=_['keys'](db['FreshdeskField'][_0xf577('0x25')]);_0x4d4234['query']=_['keys'](_0x9d71c[_0xf577('0x29')]);_0x4d4234[_0xf577('0x2a')]=_[_0xf577('0x2b')](_0x4d4234[_0xf577('0x2c')],_0x4d4234['query']);_0x4cbe3c[_0xf577('0x2d')]=_[_0xf577('0x2b')](_0x4d4234[_0xf577('0x2c')],qs[_0xf577('0x2e')](_0x9d71c[_0xf577('0x29')][_0xf577('0x2e')]));_0x4cbe3c[_0xf577('0x2d')]=_0x4cbe3c[_0xf577('0x2d')][_0xf577('0x2f')]?_0x4cbe3c[_0xf577('0x2d')]:_0x4d4234[_0xf577('0x2c')];_0x4cbe3c[_0xf577('0x32')]=qs['sort'](_0x9d71c[_0xf577('0x29')][_0xf577('0x33')]);_0x4cbe3c['where']=qs[_0xf577('0x2a')](_[_0xf577('0x35')](_0x9d71c[_0xf577('0x29')],_0x4d4234['filters']));if(_0x9d71c['query'][_0xf577('0x36')]){_0x4cbe3c['where']=_[_0xf577('0x37')](_0x4cbe3c[_0xf577('0x34')],{'$or':_['map'](_0x4cbe3c[_0xf577('0x2d')],function(_0x5e014b){var _0x27c805={};_0x27c805[_0x5e014b]={'$like':'%'+_0x9d71c[_0xf577('0x29')][_0xf577('0x36')]+'%'};return _0x27c805;})});}_0x4cbe3c=_[_0xf577('0x37')]({},_0x4cbe3c,_0x9d71c[_0xf577('0x39')]);return _0x2f5a50['getFields'](_0x4cbe3c);}})[_0xf577('0x3d')](function(_0x3e0f89){if(_0x3e0f89){_0x2d404e=_0x3e0f89['length'];if(!_0x9d71c[_0xf577('0x29')][_0xf577('0x30')](_0xf577('0x31'))){_0x4cbe3c[_0xf577('0x1a')]=qs[_0xf577('0x1a')](_0x9d71c[_0xf577('0x29')][_0xf577('0x1a')]);_0x4cbe3c[_0xf577('0x19')]=qs[_0xf577('0x19')](_0x9d71c[_0xf577('0x29')]['offset']);}return _0x2f5a50['getFields'](_0x4cbe3c);}})[_0xf577('0x3d')](function(_0xda9b09){if(_0xda9b09){return _0xda9b09?{'count':_0x2d404e,'rows':_0xda9b09}:null;}})[_0xf577('0x3d')](respondWithResult(_0x540b99,null))[_0xf577('0x3f')](handleError(_0x540b99,null));};exports[_0xf577('0x48')]=function(_0x53c0ff,_0x25725d,_0x5a28ed){var _0x592d27={};var _0x27e611={};var _0x42b4c6;var _0x21e95f;return db[_0xf577('0x24')][_0xf577('0x47')]({'where':{'id':_0x53c0ff[_0xf577('0x41')]['id']}})[_0xf577('0x3d')](handleEntityNotFound(_0x25725d,null))['then'](function(_0x5e53f2){if(_0x5e53f2){_0x42b4c6=_0x5e53f2;_0x27e611['model']=_['keys'](db['FreshdeskField']['rawAttributes']);_0x27e611['query']=_[_0xf577('0x42')](_0x53c0ff['query']);_0x27e611[_0xf577('0x2a')]=_[_0xf577('0x2b')](_0x27e611[_0xf577('0x2c')],_0x27e611[_0xf577('0x29')]);_0x592d27[_0xf577('0x2d')]=_[_0xf577('0x2b')](_0x27e611['model'],qs[_0xf577('0x2e')](_0x53c0ff[_0xf577('0x29')][_0xf577('0x2e')]));_0x592d27[_0xf577('0x2d')]=_0x592d27[_0xf577('0x2d')][_0xf577('0x2f')]?_0x592d27[_0xf577('0x2d')]:_0x27e611['model'];_0x592d27['order']=qs[_0xf577('0x33')](_0x53c0ff[_0xf577('0x29')]['sort']);_0x592d27[_0xf577('0x34')]=qs[_0xf577('0x2a')](_['pick'](_0x53c0ff[_0xf577('0x29')],_0x27e611[_0xf577('0x2a')]));if(_0x53c0ff[_0xf577('0x29')][_0xf577('0x36')]){_0x592d27['where']=_[_0xf577('0x37')](_0x592d27[_0xf577('0x34')],{'$or':_[_0xf577('0x38')](_0x592d27[_0xf577('0x2d')],function(_0x17b933){var _0x1062b4={};_0x1062b4[_0x17b933]={'$like':'%'+_0x53c0ff[_0xf577('0x29')][_0xf577('0x36')]+'%'};return _0x1062b4;})});}_0x592d27=_['merge']({},_0x592d27,_0x53c0ff[_0xf577('0x39')]);return _0x42b4c6[_0xf577('0x48')](_0x592d27);}})[_0xf577('0x3d')](function(_0x415d0e){if(_0x415d0e){_0x21e95f=_0x415d0e[_0xf577('0x2f')];if(!_0x53c0ff[_0xf577('0x29')][_0xf577('0x30')](_0xf577('0x31'))){_0x592d27['limit']=qs['limit'](_0x53c0ff[_0xf577('0x29')]['limit']);_0x592d27[_0xf577('0x19')]=qs['offset'](_0x53c0ff[_0xf577('0x29')][_0xf577('0x19')]);}return _0x42b4c6[_0xf577('0x48')](_0x592d27);}})[_0xf577('0x3d')](function(_0x3c67c0){if(_0x3c67c0){return _0x3c67c0?{'count':_0x21e95f,'rows':_0x3c67c0}:null;}})[_0xf577('0x3d')](respondWithResult(_0x25725d,null))['catch'](handleError(_0x25725d,null));};exports[_0xf577('0x49')]=function(_0x429bca,_0x227dd9,_0xc6e472){var _0x1ea09a={};var _0x4f573e={};var _0x51e072;var _0x303a5e;return db[_0xf577('0x24')][_0xf577('0x47')]({'where':{'id':_0x429bca[_0xf577('0x41')]['id']}})[_0xf577('0x3d')](handleEntityNotFound(_0x227dd9,null))[_0xf577('0x3d')](function(_0x8c8da1){if(_0x8c8da1){_0x51e072=_0x8c8da1;_0x4f573e[_0xf577('0x2c')]=_[_0xf577('0x42')](db[_0xf577('0x4a')]['rawAttributes']);_0x4f573e[_0xf577('0x29')]=_['keys'](_0x429bca[_0xf577('0x29')]);_0x4f573e[_0xf577('0x2a')]=_[_0xf577('0x2b')](_0x4f573e[_0xf577('0x2c')],_0x4f573e['query']);_0x1ea09a[_0xf577('0x2d')]=_['intersection'](_0x4f573e[_0xf577('0x2c')],qs[_0xf577('0x2e')](_0x429bca[_0xf577('0x29')][_0xf577('0x2e')]));_0x1ea09a[_0xf577('0x2d')]=_0x1ea09a[_0xf577('0x2d')][_0xf577('0x2f')]?_0x1ea09a[_0xf577('0x2d')]:_0x4f573e[_0xf577('0x2c')];_0x1ea09a[_0xf577('0x32')]=qs['sort'](_0x429bca[_0xf577('0x29')]['sort']);_0x1ea09a[_0xf577('0x34')]=qs[_0xf577('0x2a')](_['pick'](_0x429bca[_0xf577('0x29')],_0x4f573e[_0xf577('0x2a')]));if(_0x429bca[_0xf577('0x29')]['filter']){_0x1ea09a['where']=_[_0xf577('0x37')](_0x1ea09a[_0xf577('0x34')],{'$or':_['map'](_0x1ea09a[_0xf577('0x2d')],function(_0x3dc2ff){var _0x4c0b5e={};_0x4c0b5e[_0x3dc2ff]={'$like':'%'+_0x429bca['query'][_0xf577('0x36')]+'%'};return _0x4c0b5e;})});}_0x1ea09a=_['merge']({},_0x1ea09a,_0x429bca[_0xf577('0x39')]);return _0x51e072[_0xf577('0x49')](_0x1ea09a);}})[_0xf577('0x3d')](function(_0x2cbc5d){if(_0x2cbc5d){_0x303a5e=_0x2cbc5d['length'];if(!_0x429bca[_0xf577('0x29')]['hasOwnProperty'](_0xf577('0x31'))){_0x1ea09a[_0xf577('0x1a')]=qs[_0xf577('0x1a')](_0x429bca['query'][_0xf577('0x1a')]);_0x1ea09a[_0xf577('0x19')]=qs[_0xf577('0x19')](_0x429bca['query'][_0xf577('0x19')]);}return _0x51e072[_0xf577('0x49')](_0x1ea09a);}})['then'](function(_0x24eb1c){if(_0x24eb1c){return _0x24eb1c?{'count':_0x303a5e,'rows':_0x24eb1c}:null;}})[_0xf577('0x3d')](respondWithResult(_0x227dd9,null))[_0xf577('0x3f')](handleError(_0x227dd9,null));};exports[_0xf577('0x4b')]=function(_0x5684fc,_0x7c6d82,_0x50cf8e){var _0x4ebb17={};var _0x4642d6={};var _0xa82065;var _0x307d3d;return db[_0xf577('0x24')][_0xf577('0x47')]({'where':{'id':_0x5684fc[_0xf577('0x41')]['id']}})['then'](handleEntityNotFound(_0x7c6d82,null))['then'](function(_0x5b0ac3){if(_0x5b0ac3){_0xa82065=_0x5b0ac3;_0x4642d6['model']=_['keys'](db['Tag']['rawAttributes']);_0x4642d6['query']=_[_0xf577('0x42')](_0x5684fc[_0xf577('0x29')]);_0x4642d6[_0xf577('0x2a')]=_[_0xf577('0x2b')](_0x4642d6[_0xf577('0x2c')],_0x4642d6[_0xf577('0x29')]);_0x4ebb17['attributes']=_[_0xf577('0x2b')](_0x4642d6[_0xf577('0x2c')],qs[_0xf577('0x2e')](_0x5684fc['query']['fields']));_0x4ebb17[_0xf577('0x2d')]=_0x4ebb17[_0xf577('0x2d')]['length']?_0x4ebb17[_0xf577('0x2d')]:_0x4642d6['model'];_0x4ebb17['order']=qs[_0xf577('0x33')](_0x5684fc[_0xf577('0x29')]['sort']);_0x4ebb17[_0xf577('0x34')]=qs[_0xf577('0x2a')](_[_0xf577('0x35')](_0x5684fc[_0xf577('0x29')],_0x4642d6['filters']));if(_0x5684fc['query'][_0xf577('0x36')]){_0x4ebb17[_0xf577('0x34')]=_[_0xf577('0x37')](_0x4ebb17[_0xf577('0x34')],{'$or':_[_0xf577('0x38')](_0x4ebb17[_0xf577('0x2d')],function(_0x2d00dc){var _0x1fb9bf={};_0x1fb9bf[_0x2d00dc]={'$like':'%'+_0x5684fc[_0xf577('0x29')][_0xf577('0x36')]+'%'};return _0x1fb9bf;})});}_0x4ebb17=_[_0xf577('0x37')]({},_0x4ebb17,_0x5684fc[_0xf577('0x39')]);return _0xa82065['getTags'](_0x4ebb17);}})[_0xf577('0x3d')](function(_0x34847b){if(_0x34847b){_0x307d3d=_0x34847b['length'];if(!_0x5684fc[_0xf577('0x29')][_0xf577('0x30')]('nolimit')){_0x4ebb17[_0xf577('0x1a')]=qs['limit'](_0x5684fc['query'][_0xf577('0x1a')]);_0x4ebb17[_0xf577('0x19')]=qs[_0xf577('0x19')](_0x5684fc[_0xf577('0x29')][_0xf577('0x19')]);}return _0xa82065[_0xf577('0x4b')](_0x4ebb17);}})[_0xf577('0x3d')](function(_0x3d67e6){if(_0x3d67e6){return _0x3d67e6?{'count':_0x307d3d,'rows':_0x3d67e6}:null;}})['then'](respondWithResult(_0x7c6d82,null))['catch'](handleError(_0x7c6d82,null));};exports[_0xf577('0x4c')]=function(_0x329830,_0x350ee9,_0x1bc3c1){if(_0x329830[_0xf577('0x45')]['id']){delete _0x329830[_0xf577('0x45')]['id'];}return db[_0xf577('0x24')][_0xf577('0x47')]({'where':{'id':_0x329830['params']['id']}})[_0xf577('0x3d')](handleEntityNotFound(_0x350ee9,null))[_0xf577('0x3d')](function(_0x55773a){if(_0x55773a){return _0x55773a[_0xf577('0x4c')](_0x329830['body'][_0xf577('0x4d')]||[]);}return null;})[_0xf577('0x3d')](respondWithResult(_0x350ee9,null))[_0xf577('0x3f')](handleError(_0x350ee9,null));}; \ No newline at end of file +var _0xfafb=['findOne','getSubjects','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','getFields','FreshdeskField'];(function(_0x144246,_0x3fb46e){var _0x12fcc3=function(_0x2d82a5){while(--_0x2d82a5){_0x144246['push'](_0x144246['shift']());}};_0x12fcc3(++_0x3fb46e);}(_0xfafb,0x10b));var _0xbfaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfafb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbfaf('0x0'));var rimraf=require(_0xbfaf('0x1'));var zipdir=require(_0xbfaf('0x2'));var jsonpatch=require(_0xbfaf('0x3'));var rp=require(_0xbfaf('0x4'));var moment=require(_0xbfaf('0x5'));var BPromise=require(_0xbfaf('0x6'));var Mustache=require(_0xbfaf('0x7'));var util=require(_0xbfaf('0x8'));var path=require(_0xbfaf('0x9'));var sox=require(_0xbfaf('0xa'));var csv=require(_0xbfaf('0xb'));var ejs=require(_0xbfaf('0xc'));var fs=require('fs');var fs_extra=require(_0xbfaf('0xd'));var _=require(_0xbfaf('0xe'));var squel=require(_0xbfaf('0xf'));var crypto=require('crypto');var jsforce=require(_0xbfaf('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xbfaf('0xb'));var querystring=require(_0xbfaf('0x11'));var Papa=require('papaparse');var Redis=require(_0xbfaf('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbfaf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbfaf('0x14'));var logger=require(_0xbfaf('0x15'))(_0xbfaf('0x16'));var utils=require(_0xbfaf('0x17'));var config=require(_0xbfaf('0x18'));var licenseUtil=require(_0xbfaf('0x19'));var db=require(_0xbfaf('0x1a'))['db'];function respondWithStatusCode(_0x161154,_0x291bb9){_0x291bb9=_0x291bb9||0xcc;return function(_0x1bf53f){if(_0x1bf53f){return _0x161154[_0xbfaf('0x1b')](_0x291bb9);}return _0x161154['status'](_0x291bb9)['end']();};}function respondWithResult(_0x5e5180,_0x3504d6){_0x3504d6=_0x3504d6||0xc8;return function(_0x9ba9ec){if(_0x9ba9ec){return _0x5e5180[_0xbfaf('0x1c')](_0x3504d6)[_0xbfaf('0x1d')](_0x9ba9ec);}};}function respondWithFilteredResult(_0x26e029,_0x20da1c){return function(_0x59a616){if(_0x59a616){var _0x4074cf=typeof _0x20da1c[_0xbfaf('0x1e')]===_0xbfaf('0x1f')&&typeof _0x20da1c[_0xbfaf('0x20')]==='undefined';var _0x49610f=_0x59a616[_0xbfaf('0x21')];var _0x4752df=_0x4074cf?0x0:_0x20da1c[_0xbfaf('0x1e')];var _0x4ee3d1=_0x4074cf?_0x59a616[_0xbfaf('0x21')]:_0x20da1c[_0xbfaf('0x1e')]+_0x20da1c[_0xbfaf('0x20')];var _0x1a42af;if(_0x4ee3d1>=_0x49610f){_0x4ee3d1=_0x49610f;_0x1a42af=0xc8;}else{_0x1a42af=0xce;}_0x26e029[_0xbfaf('0x1c')](_0x1a42af);return _0x26e029[_0xbfaf('0x22')]('Content-Range',_0x4752df+'-'+_0x4ee3d1+'/'+_0x49610f)[_0xbfaf('0x1d')](_0x59a616);}return null;};}function patchUpdates(_0x893a71){return function(_0xd4337c){try{jsonpatch[_0xbfaf('0x23')](_0xd4337c,_0x893a71,!![]);}catch(_0x8aa17c){return BPromise[_0xbfaf('0x24')](_0x8aa17c);}return _0xd4337c[_0xbfaf('0x25')]();};}function saveUpdates(_0x1e02ef,_0x33b4b9){return function(_0x151b6e){if(_0x151b6e){return _0x151b6e[_0xbfaf('0x26')](_0x1e02ef)['then'](function(_0x189832){return _0x189832;});}return null;};}function removeEntity(_0x265bea,_0x34a06f){return function(_0x3951ad){if(_0x3951ad){return _0x3951ad[_0xbfaf('0x27')]()[_0xbfaf('0x28')](function(){_0x265bea['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fd109,_0x1e2839){return function(_0x260f7e){if(!_0x260f7e){_0x4fd109[_0xbfaf('0x1b')](0x194);}return _0x260f7e;};}function handleError(_0x563553,_0x33a60a){_0x33a60a=_0x33a60a||0x1f4;return function(_0xbd6a1){logger[_0xbfaf('0x29')](_0xbd6a1[_0xbfaf('0x2a')]);if(_0xbd6a1[_0xbfaf('0x2b')]){delete _0xbd6a1[_0xbfaf('0x2b')];}_0x563553[_0xbfaf('0x1c')](_0x33a60a)[_0xbfaf('0x2c')](_0xbd6a1);};}exports[_0xbfaf('0x2d')]=function(_0x27c670,_0x11c551){var _0x4d35cc={},_0x1d6855={},_0x2f25c2={'count':0x0,'rows':[]};var _0x5a67b0=_['map'](db[_0xbfaf('0x2e')][_0xbfaf('0x2f')],function(_0x1839fd){return{'name':_0x1839fd[_0xbfaf('0x30')],'type':_0x1839fd[_0xbfaf('0x31')][_0xbfaf('0x32')]};});_0x1d6855[_0xbfaf('0x33')]=_[_0xbfaf('0x34')](_0x5a67b0,'name');_0x1d6855[_0xbfaf('0x35')]=_[_0xbfaf('0x36')](_0x27c670[_0xbfaf('0x35')]);_0x1d6855[_0xbfaf('0x37')]=_[_0xbfaf('0x38')](_0x1d6855[_0xbfaf('0x33')],_0x1d6855[_0xbfaf('0x35')]);_0x4d35cc[_0xbfaf('0x39')]=_[_0xbfaf('0x38')](_0x1d6855[_0xbfaf('0x33')],qs[_0xbfaf('0x3a')](_0x27c670['query'][_0xbfaf('0x3a')]));_0x4d35cc[_0xbfaf('0x39')]=_0x4d35cc[_0xbfaf('0x39')][_0xbfaf('0x3b')]?_0x4d35cc[_0xbfaf('0x39')]:_0x1d6855[_0xbfaf('0x33')];if(!_0x27c670[_0xbfaf('0x35')][_0xbfaf('0x3c')](_0xbfaf('0x3d'))){_0x4d35cc[_0xbfaf('0x20')]=qs[_0xbfaf('0x20')](_0x27c670[_0xbfaf('0x35')][_0xbfaf('0x20')]);_0x4d35cc[_0xbfaf('0x1e')]=qs[_0xbfaf('0x1e')](_0x27c670[_0xbfaf('0x35')][_0xbfaf('0x1e')]);}_0x4d35cc[_0xbfaf('0x3e')]=qs['sort'](_0x27c670[_0xbfaf('0x35')][_0xbfaf('0x3f')]);_0x4d35cc[_0xbfaf('0x40')]=qs[_0xbfaf('0x37')](_[_0xbfaf('0x41')](_0x27c670['query'],_0x1d6855['filters']),_0x5a67b0);if(_0x27c670[_0xbfaf('0x35')][_0xbfaf('0x42')]){_0x4d35cc[_0xbfaf('0x40')]=_[_0xbfaf('0x43')](_0x4d35cc[_0xbfaf('0x40')],{'$or':_[_0xbfaf('0x34')](_0x5a67b0,function(_0x500ace){if(_0x500ace[_0xbfaf('0x31')]!=='VIRTUAL'){var _0x316818={};_0x316818[_0x500ace[_0xbfaf('0x2b')]]={'$like':'%'+_0x27c670[_0xbfaf('0x35')][_0xbfaf('0x42')]+'%'};return _0x316818;}})});}_0x4d35cc=_[_0xbfaf('0x43')]({},_0x4d35cc,_0x27c670[_0xbfaf('0x44')]);var _0x1427bc={'where':_0x4d35cc[_0xbfaf('0x40')]};return db[_0xbfaf('0x2e')][_0xbfaf('0x21')](_0x1427bc)[_0xbfaf('0x28')](function(_0x26c6ce){_0x2f25c2['count']=_0x26c6ce;if(_0x27c670[_0xbfaf('0x35')][_0xbfaf('0x45')]){_0x4d35cc['include']=[{'all':!![]}];}return db[_0xbfaf('0x2e')][_0xbfaf('0x46')](_0x4d35cc);})[_0xbfaf('0x28')](function(_0x408170){_0x2f25c2[_0xbfaf('0x47')]=_0x408170;return _0x2f25c2;})['then'](respondWithFilteredResult(_0x11c551,_0x4d35cc))['catch'](handleError(_0x11c551,null));};exports[_0xbfaf('0x48')]=function(_0x50803d,_0x559f19){var _0x4f2fd6={'raw':![],'where':{'id':_0x50803d[_0xbfaf('0x49')]['id']}},_0x2e342b={};_0x2e342b[_0xbfaf('0x33')]=_[_0xbfaf('0x36')](db[_0xbfaf('0x2e')][_0xbfaf('0x2f')]);_0x2e342b[_0xbfaf('0x35')]=_[_0xbfaf('0x36')](_0x50803d[_0xbfaf('0x35')]);_0x2e342b[_0xbfaf('0x37')]=_['intersection'](_0x2e342b[_0xbfaf('0x33')],_0x2e342b['query']);_0x4f2fd6['attributes']=_[_0xbfaf('0x38')](_0x2e342b[_0xbfaf('0x33')],qs[_0xbfaf('0x3a')](_0x50803d[_0xbfaf('0x35')][_0xbfaf('0x3a')]));_0x4f2fd6['attributes']=_0x4f2fd6[_0xbfaf('0x39')]['length']?_0x4f2fd6[_0xbfaf('0x39')]:_0x2e342b['model'];if(_0x50803d[_0xbfaf('0x35')]['includeAll']){_0x4f2fd6[_0xbfaf('0x4a')]=[{'all':!![]}];}_0x4f2fd6=_[_0xbfaf('0x43')]({},_0x4f2fd6,_0x50803d[_0xbfaf('0x44')]);return db[_0xbfaf('0x2e')][_0xbfaf('0x4b')](_0x4f2fd6)[_0xbfaf('0x28')](handleEntityNotFound(_0x559f19,null))[_0xbfaf('0x28')](respondWithResult(_0x559f19,null))[_0xbfaf('0x4c')](handleError(_0x559f19,null));};exports[_0xbfaf('0x4d')]=function(_0x243609,_0x1d2cba){return db['FreshdeskConfiguration'][_0xbfaf('0x4d')](_0x243609['body'],{})['then'](respondWithResult(_0x1d2cba,0xc9))[_0xbfaf('0x4c')](handleError(_0x1d2cba,null));};exports['update']=function(_0x1093aa,_0x42d9c4){if(_0x1093aa[_0xbfaf('0x4e')]['id']){delete _0x1093aa[_0xbfaf('0x4e')]['id'];}return db[_0xbfaf('0x2e')][_0xbfaf('0x4b')]({'where':{'id':_0x1093aa[_0xbfaf('0x49')]['id']}})[_0xbfaf('0x28')](handleEntityNotFound(_0x42d9c4,null))['then'](saveUpdates(_0x1093aa[_0xbfaf('0x4e')],null))['then'](respondWithResult(_0x42d9c4,null))[_0xbfaf('0x4c')](handleError(_0x42d9c4,null));};exports[_0xbfaf('0x27')]=function(_0x2aa4d5,_0x16d08e){return db['FreshdeskConfiguration'][_0xbfaf('0x4b')]({'where':{'id':_0x2aa4d5['params']['id']}})[_0xbfaf('0x28')](handleEntityNotFound(_0x16d08e,null))[_0xbfaf('0x28')](removeEntity(_0x16d08e,null))[_0xbfaf('0x4c')](handleError(_0x16d08e,null));};exports[_0xbfaf('0x4f')]=function(_0x40bd9a,_0xbefcd7,_0x1e08ab){var _0x380fd0={};var _0x584816={};var _0x4f4650;var _0x44aefb;return db[_0xbfaf('0x2e')]['findOne']({'where':{'id':_0x40bd9a[_0xbfaf('0x49')]['id']}})[_0xbfaf('0x28')](handleEntityNotFound(_0xbefcd7,null))[_0xbfaf('0x28')](function(_0x2a93f0){if(_0x2a93f0){_0x4f4650=_0x2a93f0;_0x584816['model']=_[_0xbfaf('0x36')](db[_0xbfaf('0x50')][_0xbfaf('0x2f')]);_0x584816[_0xbfaf('0x35')]=_['keys'](_0x40bd9a[_0xbfaf('0x35')]);_0x584816[_0xbfaf('0x37')]=_['intersection'](_0x584816[_0xbfaf('0x33')],_0x584816[_0xbfaf('0x35')]);_0x380fd0[_0xbfaf('0x39')]=_['intersection'](_0x584816['model'],qs['fields'](_0x40bd9a[_0xbfaf('0x35')]['fields']));_0x380fd0[_0xbfaf('0x39')]=_0x380fd0['attributes'][_0xbfaf('0x3b')]?_0x380fd0[_0xbfaf('0x39')]:_0x584816[_0xbfaf('0x33')];_0x380fd0['order']=qs[_0xbfaf('0x3f')](_0x40bd9a[_0xbfaf('0x35')][_0xbfaf('0x3f')]);_0x380fd0[_0xbfaf('0x40')]=qs[_0xbfaf('0x37')](_['pick'](_0x40bd9a[_0xbfaf('0x35')],_0x584816[_0xbfaf('0x37')]));if(_0x40bd9a[_0xbfaf('0x35')][_0xbfaf('0x42')]){_0x380fd0[_0xbfaf('0x40')]=_[_0xbfaf('0x43')](_0x380fd0[_0xbfaf('0x40')],{'$or':_[_0xbfaf('0x34')](_0x380fd0[_0xbfaf('0x39')],function(_0x56e69f){var _0x270e26={};_0x270e26[_0x56e69f]={'$like':'%'+_0x40bd9a[_0xbfaf('0x35')][_0xbfaf('0x42')]+'%'};return _0x270e26;})});}_0x380fd0=_[_0xbfaf('0x43')]({},_0x380fd0,_0x40bd9a[_0xbfaf('0x44')]);return _0x4f4650[_0xbfaf('0x4f')](_0x380fd0);}})[_0xbfaf('0x28')](function(_0x1d9162){if(_0x1d9162){_0x44aefb=_0x1d9162[_0xbfaf('0x3b')];if(!_0x40bd9a[_0xbfaf('0x35')]['hasOwnProperty'](_0xbfaf('0x3d'))){_0x380fd0['limit']=qs[_0xbfaf('0x20')](_0x40bd9a[_0xbfaf('0x35')][_0xbfaf('0x20')]);_0x380fd0[_0xbfaf('0x1e')]=qs['offset'](_0x40bd9a[_0xbfaf('0x35')]['offset']);}return _0x4f4650['getFields'](_0x380fd0);}})[_0xbfaf('0x28')](function(_0x20cf08){if(_0x20cf08){return _0x20cf08?{'count':_0x44aefb,'rows':_0x20cf08}:null;}})[_0xbfaf('0x28')](respondWithResult(_0xbefcd7,null))[_0xbfaf('0x4c')](handleError(_0xbefcd7,null));};exports['getSubjects']=function(_0x57fc65,_0x3677c3,_0x3b2d75){var _0x113fa2={};var _0x300bf0={};var _0x4dba88;var _0x2324f9;return db['FreshdeskConfiguration'][_0xbfaf('0x51')]({'where':{'id':_0x57fc65[_0xbfaf('0x49')]['id']}})['then'](handleEntityNotFound(_0x3677c3,null))[_0xbfaf('0x28')](function(_0x2d1937){if(_0x2d1937){_0x4dba88=_0x2d1937;_0x300bf0[_0xbfaf('0x33')]=_[_0xbfaf('0x36')](db[_0xbfaf('0x50')]['rawAttributes']);_0x300bf0[_0xbfaf('0x35')]=_['keys'](_0x57fc65['query']);_0x300bf0[_0xbfaf('0x37')]=_[_0xbfaf('0x38')](_0x300bf0[_0xbfaf('0x33')],_0x300bf0[_0xbfaf('0x35')]);_0x113fa2['attributes']=_['intersection'](_0x300bf0[_0xbfaf('0x33')],qs[_0xbfaf('0x3a')](_0x57fc65['query'][_0xbfaf('0x3a')]));_0x113fa2['attributes']=_0x113fa2[_0xbfaf('0x39')][_0xbfaf('0x3b')]?_0x113fa2[_0xbfaf('0x39')]:_0x300bf0[_0xbfaf('0x33')];_0x113fa2[_0xbfaf('0x3e')]=qs[_0xbfaf('0x3f')](_0x57fc65[_0xbfaf('0x35')][_0xbfaf('0x3f')]);_0x113fa2[_0xbfaf('0x40')]=qs[_0xbfaf('0x37')](_['pick'](_0x57fc65[_0xbfaf('0x35')],_0x300bf0[_0xbfaf('0x37')]));if(_0x57fc65[_0xbfaf('0x35')][_0xbfaf('0x42')]){_0x113fa2['where']=_[_0xbfaf('0x43')](_0x113fa2[_0xbfaf('0x40')],{'$or':_[_0xbfaf('0x34')](_0x113fa2[_0xbfaf('0x39')],function(_0x1ed9ce){var _0x169ee2={};_0x169ee2[_0x1ed9ce]={'$like':'%'+_0x57fc65[_0xbfaf('0x35')][_0xbfaf('0x42')]+'%'};return _0x169ee2;})});}_0x113fa2=_[_0xbfaf('0x43')]({},_0x113fa2,_0x57fc65[_0xbfaf('0x44')]);return _0x4dba88[_0xbfaf('0x52')](_0x113fa2);}})[_0xbfaf('0x28')](function(_0x1e2f64){if(_0x1e2f64){_0x2324f9=_0x1e2f64[_0xbfaf('0x3b')];if(!_0x57fc65[_0xbfaf('0x35')][_0xbfaf('0x3c')](_0xbfaf('0x3d'))){_0x113fa2[_0xbfaf('0x20')]=qs['limit'](_0x57fc65['query'][_0xbfaf('0x20')]);_0x113fa2[_0xbfaf('0x1e')]=qs[_0xbfaf('0x1e')](_0x57fc65[_0xbfaf('0x35')][_0xbfaf('0x1e')]);}return _0x4dba88['getSubjects'](_0x113fa2);}})[_0xbfaf('0x28')](function(_0x1e479d){if(_0x1e479d){return _0x1e479d?{'count':_0x2324f9,'rows':_0x1e479d}:null;}})['then'](respondWithResult(_0x3677c3,null))[_0xbfaf('0x4c')](handleError(_0x3677c3,null));};exports[_0xbfaf('0x53')]=function(_0x1818c2,_0x3a97e4,_0x8004eb){var _0x29f395={};var _0x1dfbb7={};var _0x4d3ace;var _0xa60be8;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x1818c2[_0xbfaf('0x49')]['id']}})['then'](handleEntityNotFound(_0x3a97e4,null))[_0xbfaf('0x28')](function(_0x2fdcc8){if(_0x2fdcc8){_0x4d3ace=_0x2fdcc8;_0x1dfbb7[_0xbfaf('0x33')]=_[_0xbfaf('0x36')](db[_0xbfaf('0x50')][_0xbfaf('0x2f')]);_0x1dfbb7[_0xbfaf('0x35')]=_[_0xbfaf('0x36')](_0x1818c2[_0xbfaf('0x35')]);_0x1dfbb7['filters']=_[_0xbfaf('0x38')](_0x1dfbb7[_0xbfaf('0x33')],_0x1dfbb7[_0xbfaf('0x35')]);_0x29f395[_0xbfaf('0x39')]=_['intersection'](_0x1dfbb7[_0xbfaf('0x33')],qs[_0xbfaf('0x3a')](_0x1818c2['query'][_0xbfaf('0x3a')]));_0x29f395[_0xbfaf('0x39')]=_0x29f395[_0xbfaf('0x39')][_0xbfaf('0x3b')]?_0x29f395[_0xbfaf('0x39')]:_0x1dfbb7[_0xbfaf('0x33')];_0x29f395[_0xbfaf('0x3e')]=qs['sort'](_0x1818c2[_0xbfaf('0x35')]['sort']);_0x29f395['where']=qs[_0xbfaf('0x37')](_['pick'](_0x1818c2['query'],_0x1dfbb7[_0xbfaf('0x37')]));if(_0x1818c2[_0xbfaf('0x35')][_0xbfaf('0x42')]){_0x29f395[_0xbfaf('0x40')]=_[_0xbfaf('0x43')](_0x29f395[_0xbfaf('0x40')],{'$or':_[_0xbfaf('0x34')](_0x29f395[_0xbfaf('0x39')],function(_0x585aeb){var _0x495eae={};_0x495eae[_0x585aeb]={'$like':'%'+_0x1818c2[_0xbfaf('0x35')][_0xbfaf('0x42')]+'%'};return _0x495eae;})});}_0x29f395=_[_0xbfaf('0x43')]({},_0x29f395,_0x1818c2[_0xbfaf('0x44')]);return _0x4d3ace[_0xbfaf('0x53')](_0x29f395);}})[_0xbfaf('0x28')](function(_0x5dd63b){if(_0x5dd63b){_0xa60be8=_0x5dd63b['length'];if(!_0x1818c2[_0xbfaf('0x35')][_0xbfaf('0x3c')](_0xbfaf('0x3d'))){_0x29f395[_0xbfaf('0x20')]=qs[_0xbfaf('0x20')](_0x1818c2[_0xbfaf('0x35')][_0xbfaf('0x20')]);_0x29f395[_0xbfaf('0x1e')]=qs['offset'](_0x1818c2[_0xbfaf('0x35')][_0xbfaf('0x1e')]);}return _0x4d3ace[_0xbfaf('0x53')](_0x29f395);}})[_0xbfaf('0x28')](function(_0xcdb3ee){if(_0xcdb3ee){return _0xcdb3ee?{'count':_0xa60be8,'rows':_0xcdb3ee}:null;}})[_0xbfaf('0x28')](respondWithResult(_0x3a97e4,null))[_0xbfaf('0x4c')](handleError(_0x3a97e4,null));};exports[_0xbfaf('0x54')]=function(_0x293d57,_0x37830e,_0x421f4b){var _0x15121e={};var _0x2df11b={};var _0x18eb1f;var _0x5ceca6;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x293d57[_0xbfaf('0x49')]['id']}})['then'](handleEntityNotFound(_0x37830e,null))[_0xbfaf('0x28')](function(_0x5f3582){if(_0x5f3582){_0x18eb1f=_0x5f3582;_0x2df11b[_0xbfaf('0x33')]=_[_0xbfaf('0x36')](db[_0xbfaf('0x55')][_0xbfaf('0x2f')]);_0x2df11b[_0xbfaf('0x35')]=_[_0xbfaf('0x36')](_0x293d57[_0xbfaf('0x35')]);_0x2df11b[_0xbfaf('0x37')]=_[_0xbfaf('0x38')](_0x2df11b[_0xbfaf('0x33')],_0x2df11b[_0xbfaf('0x35')]);_0x15121e[_0xbfaf('0x39')]=_[_0xbfaf('0x38')](_0x2df11b[_0xbfaf('0x33')],qs[_0xbfaf('0x3a')](_0x293d57[_0xbfaf('0x35')]['fields']));_0x15121e[_0xbfaf('0x39')]=_0x15121e[_0xbfaf('0x39')]['length']?_0x15121e[_0xbfaf('0x39')]:_0x2df11b[_0xbfaf('0x33')];_0x15121e[_0xbfaf('0x3e')]=qs['sort'](_0x293d57[_0xbfaf('0x35')][_0xbfaf('0x3f')]);_0x15121e[_0xbfaf('0x40')]=qs[_0xbfaf('0x37')](_[_0xbfaf('0x41')](_0x293d57['query'],_0x2df11b[_0xbfaf('0x37')]));if(_0x293d57[_0xbfaf('0x35')][_0xbfaf('0x42')]){_0x15121e[_0xbfaf('0x40')]=_[_0xbfaf('0x43')](_0x15121e[_0xbfaf('0x40')],{'$or':_[_0xbfaf('0x34')](_0x15121e[_0xbfaf('0x39')],function(_0x499a81){var _0x2f9849={};_0x2f9849[_0x499a81]={'$like':'%'+_0x293d57['query'][_0xbfaf('0x42')]+'%'};return _0x2f9849;})});}_0x15121e=_[_0xbfaf('0x43')]({},_0x15121e,_0x293d57[_0xbfaf('0x44')]);return _0x18eb1f[_0xbfaf('0x54')](_0x15121e);}})[_0xbfaf('0x28')](function(_0x168447){if(_0x168447){_0x5ceca6=_0x168447['length'];if(!_0x293d57['query']['hasOwnProperty'](_0xbfaf('0x3d'))){_0x15121e[_0xbfaf('0x20')]=qs[_0xbfaf('0x20')](_0x293d57['query'][_0xbfaf('0x20')]);_0x15121e[_0xbfaf('0x1e')]=qs[_0xbfaf('0x1e')](_0x293d57[_0xbfaf('0x35')]['offset']);}return _0x18eb1f[_0xbfaf('0x54')](_0x15121e);}})[_0xbfaf('0x28')](function(_0x371854){if(_0x371854){return _0x371854?{'count':_0x5ceca6,'rows':_0x371854}:null;}})[_0xbfaf('0x28')](respondWithResult(_0x37830e,null))['catch'](handleError(_0x37830e,null));};exports['setTags']=function(_0x31a84b,_0x3c29ca,_0x27d7fe){if(_0x31a84b['body']['id']){delete _0x31a84b['body']['id'];}return db[_0xbfaf('0x2e')][_0xbfaf('0x51')]({'where':{'id':_0x31a84b[_0xbfaf('0x49')]['id']}})[_0xbfaf('0x28')](handleEntityNotFound(_0x3c29ca,null))[_0xbfaf('0x28')](function(_0x5052da){if(_0x5052da){return _0x5052da['setTags'](_0x31a84b['body'][_0xbfaf('0x56')]||[]);}return null;})[_0xbfaf('0x28')](respondWithResult(_0x3c29ca,null))[_0xbfaf('0x4c')](handleError(_0x3c29ca,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 8802162..743895b 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 _0x1482=['bluebird','request-promise','path','./intFreshdeskConfiguration.attributes','exports','define','lodash','util','moment'];(function(_0x3ab293,_0x2d162a){var _0x2744ec=function(_0x57d471){while(--_0x57d471){_0x3ab293['push'](_0x3ab293['shift']());}};_0x2744ec(++_0x2d162a);}(_0x1482,0x192));var _0x2148=function(_0x40652b,_0x4fd446){_0x40652b=_0x40652b-0x0;var _0x4b6323=_0x1482[_0x40652b];return _0x4b6323;};'use strict';var _=require(_0x2148('0x0'));var util=require(_0x2148('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2148('0x2'));var BPromise=require(_0x2148('0x3'));var rp=require(_0x2148('0x4'));var fs=require('fs');var path=require(_0x2148('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2148('0x6'));module[_0x2148('0x7')]=function(_0x21cbaa,_0x38d6f2){return _0x21cbaa[_0x2148('0x8')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc702=['request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','define','util','../../config/logger','api','bluebird'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc702,0x1a0));var _0x2c70=function(_0x37663c,_0x1ed61d){_0x37663c=_0x37663c-0x0;var _0x5295f2=_0xc702[_0x37663c];return _0x5295f2;};'use strict';var _=require('lodash');var util=require(_0x2c70('0x0'));var logger=require(_0x2c70('0x1'))(_0x2c70('0x2'));var moment=require('moment');var BPromise=require(_0x2c70('0x3'));var rp=require(_0x2c70('0x4'));var fs=require('fs');var path=require(_0x2c70('0x5'));var rimraf=require(_0x2c70('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c70('0x7'));module[_0x2c70('0x8')]=function(_0x4f1b8d,_0x4ed4e4){return _0x4f1b8d[_0x2c70('0x9')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','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 44d16f3..204f48f 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 _0x99de=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','code','error','message','info','catch','lodash','util','moment'];(function(_0x51c408,_0x413648){var _0x58af3a=function(_0x15d0b6){while(--_0x15d0b6){_0x51c408['push'](_0x51c408['shift']());}};_0x58af3a(++_0x413648);}(_0x99de,0x123));var _0xe99d=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x99de[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0xe99d('0x0'));var util=require(_0xe99d('0x1'));var moment=require(_0xe99d('0x2'));var BPromise=require(_0xe99d('0x3'));var rs=require(_0xe99d('0x4'));var fs=require('fs');var Redis=require(_0xe99d('0x5'));var db=require(_0xe99d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe99d('0x7'))(_0xe99d('0x8'));var config=require(_0xe99d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe99d('0xa')][_0xe99d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23ef4b,_0x94f9eb,_0x23000d){return new BPromise(function(_0x7e53d4,_0x20f77f){return client['request'](_0x23ef4b,_0x23000d)[_0xe99d('0xc')](function(_0x466123){logger['info'](_0xe99d('0xd'),_0x94f9eb,_0xe99d('0xe'));logger[_0xe99d('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x94f9eb,_0xe99d('0xe'),JSON['stringify'](_0x466123));if(_0x466123['error']){if(_0x466123['error'][_0xe99d('0x10')]===0x1f4){logger[_0xe99d('0x11')](_0xe99d('0xd'),_0x94f9eb,_0x466123[_0xe99d('0x11')][_0xe99d('0x12')]);return _0x20f77f(_0x466123[_0xe99d('0x11')]['message']);}logger[_0xe99d('0x11')](_0xe99d('0xd'),_0x94f9eb,_0x466123[_0xe99d('0x11')][_0xe99d('0x12')]);return _0x7e53d4(_0x466123[_0xe99d('0x11')][_0xe99d('0x12')]);}else{logger[_0xe99d('0x13')](_0xe99d('0xd'),_0x94f9eb,_0xe99d('0xe'));_0x7e53d4(_0x466123['result']['message']);}})[_0xe99d('0x14')](function(_0x652752){logger[_0xe99d('0x11')](_0xe99d('0xd'),_0x94f9eb,_0x652752);_0x20f77f(_0x652752);});});} \ No newline at end of file +var _0x135c=['error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xd5c0ad,_0x182031){var _0x19fc6b=function(_0x4cee84){while(--_0x4cee84){_0xd5c0ad['push'](_0xd5c0ad['shift']());}};_0x19fc6b(++_0x182031);}(_0x135c,0x1d3));var _0xc135=function(_0x2ae7b4,_0x6188f3){_0x2ae7b4=_0x2ae7b4-0x0;var _0x4c01db=_0x135c[_0x2ae7b4];return _0x4c01db;};'use strict';var _=require(_0xc135('0x0'));var util=require(_0xc135('0x1'));var moment=require(_0xc135('0x2'));var BPromise=require(_0xc135('0x3'));var rs=require(_0xc135('0x4'));var fs=require('fs');var Redis=require(_0xc135('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc135('0x6'));var config=require(_0xc135('0x7'));var jayson=require(_0xc135('0x8'));var client=jayson[_0xc135('0x9')][_0xc135('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58f026,_0x21bea7,_0xfc9f62){return new BPromise(function(_0x59de72,_0x422d97){return client[_0xc135('0xb')](_0x58f026,_0xfc9f62)[_0xc135('0xc')](function(_0x80b936){logger['info'](_0xc135('0xd'),_0x21bea7,_0xc135('0xe'));logger[_0xc135('0xf')](_0xc135('0x10'),_0x21bea7,_0xc135('0xe'),JSON['stringify'](_0x80b936));if(_0x80b936[_0xc135('0x11')]){if(_0x80b936[_0xc135('0x11')][_0xc135('0x12')]===0x1f4){logger[_0xc135('0x11')](_0xc135('0xd'),_0x21bea7,_0x80b936[_0xc135('0x11')][_0xc135('0x13')]);return _0x422d97(_0x80b936[_0xc135('0x11')][_0xc135('0x13')]);}logger[_0xc135('0x11')](_0xc135('0xd'),_0x21bea7,_0x80b936[_0xc135('0x11')]['message']);return _0x59de72(_0x80b936['error'][_0xc135('0x13')]);}else{logger[_0xc135('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x21bea7,_0xc135('0xe'));_0x59de72(_0x80b936[_0xc135('0x15')][_0xc135('0x13')]);}})['catch'](function(_0x58f50e){logger['error'](_0xc135('0xd'),_0x21bea7,_0x58f50e);_0x422d97(_0x58f50e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 5ffb3c6..cb3ee15 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 _0x4655=['delete','multer','util','connect-timeout','express','fs-extra','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','show','post','put','/:id','update'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x4655,0x171));var _0x5465=function(_0x59ab73,_0x575f9e){_0x59ab73=_0x59ab73-0x0;var _0x2f891a=_0x4655[_0x59ab73];return _0x2f891a;};'use strict';var multer=require(_0x5465('0x0'));var util=require(_0x5465('0x1'));var path=require('path');var timeout=require(_0x5465('0x2'));var express=require(_0x5465('0x3'));var router=express['Router']();var fs_extra=require(_0x5465('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5465('0x5'));var controller=require(_0x5465('0x6'));router['get']('/',auth[_0x5465('0x7')](),controller[_0x5465('0x8')]);router[_0x5465('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5465('0xa')]);router[_0x5465('0xb')]('/',auth[_0x5465('0x7')](),controller['create']);router[_0x5465('0xc')](_0x5465('0xd'),auth[_0x5465('0x7')](),controller[_0x5465('0xe')]);router[_0x5465('0xf')](_0x5465('0xd'),auth[_0x5465('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbae9=['../../components/auth/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x756326,_0x4005bb){var _0x11e2ca=function(_0x3a2afe){while(--_0x3a2afe){_0x756326['push'](_0x756326['shift']());}};_0x11e2ca(++_0x4005bb);}(_0xbae9,0xf6));var _0x9bae=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0xbae9[_0x43444b];return _0x392fe5;};'use strict';var multer=require(_0x9bae('0x0'));var util=require(_0x9bae('0x1'));var path=require(_0x9bae('0x2'));var timeout=require(_0x9bae('0x3'));var express=require(_0x9bae('0x4'));var router=express['Router']();var fs_extra=require(_0x9bae('0x5'));var auth=require(_0x9bae('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9bae('0x7'));var controller=require(_0x9bae('0x8'));router['get']('/',auth[_0x9bae('0x9')](),controller[_0x9bae('0xa')]);router[_0x9bae('0xb')](_0x9bae('0xc'),auth[_0x9bae('0x9')](),controller[_0x9bae('0xd')]);router[_0x9bae('0xe')]('/',auth[_0x9bae('0x9')](),controller[_0x9bae('0xf')]);router[_0x9bae('0x10')](_0x9bae('0xc'),auth[_0x9bae('0x9')](),controller[_0x9bae('0x11')]);router[_0x9bae('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9bae('0x13')]);module[_0x9bae('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 78cc92a..5c7706d 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 _0x07f3=['string','variable','keyValue','picklist','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports'];(function(_0x5a9896,_0x29fb94){var _0x4c5295=function(_0x12739c){while(--_0x12739c){_0x5a9896['push'](_0x5a9896['shift']());}};_0x4c5295(++_0x29fb94);}(_0x07f3,0x80));var _0x307f=function(_0x3a60b8,_0x47caab){_0x3a60b8=_0x3a60b8-0x0;var _0x4eb583=_0x07f3[_0x3a60b8];return _0x4eb583;};'use strict';var Sequelize=require(_0x307f('0x0'));module[_0x307f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x307f('0x2'),_0x307f('0x3'),'customVariable',_0x307f('0x4'),_0x307f('0x5')),'defaultValue':_0x307f('0x2')},'content':{'type':Sequelize[_0x307f('0x6')]},'key':{'type':Sequelize[_0x307f('0x6')]},'keyType':{'type':Sequelize[_0x307f('0x7')]('string',_0x307f('0x3'),_0x307f('0x8'))},'keyContent':{'type':Sequelize[_0x307f('0x6')]},'idField':{'type':Sequelize[_0x307f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x307f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x307f('0x6')]}}; \ No newline at end of file +var _0xef61=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xef61,0x125));var _0x1ef6=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0xef61[_0x12d951];return _0x44de17;};'use strict';var Sequelize=require(_0x1ef6('0x0'));module[_0x1ef6('0x1')]={'type':{'type':Sequelize[_0x1ef6('0x2')](_0x1ef6('0x3'),_0x1ef6('0x4'),_0x1ef6('0x5'),'keyValue',_0x1ef6('0x6')),'defaultValue':_0x1ef6('0x3')},'content':{'type':Sequelize[_0x1ef6('0x7')]},'key':{'type':Sequelize[_0x1ef6('0x7')]},'keyType':{'type':Sequelize[_0x1ef6('0x2')](_0x1ef6('0x3'),_0x1ef6('0x4'),_0x1ef6('0x5'))},'keyContent':{'type':Sequelize[_0x1ef6('0x7')]},'idField':{'type':Sequelize[_0x1ef6('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1ef6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1ef6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f06c0b4..3c7157d 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 _0xa45c=['update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','eml-format','rimraf','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','reject','save'];(function(_0x3969ea,_0x462e29){var _0x33de28=function(_0x424a7b){while(--_0x424a7b){_0x3969ea['push'](_0x3969ea['shift']());}};_0x33de28(++_0x462e29);}(_0xa45c,0x6d));var _0xca45=function(_0x523ea8,_0x219da7){_0x523ea8=_0x523ea8-0x0;var _0x50b43c=_0xa45c[_0x523ea8];return _0x50b43c;};'use strict';var emlformat=require(_0xca45('0x0'));var rimraf=require(_0xca45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xca45('0x2'));var moment=require('moment');var BPromise=require(_0xca45('0x3'));var Mustache=require('mustache');var util=require(_0xca45('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xca45('0x5'));var ejs=require(_0xca45('0x6'));var fs=require('fs');var fs_extra=require(_0xca45('0x7'));var _=require(_0xca45('0x8'));var squel=require('squel');var crypto=require(_0xca45('0x9'));var jsforce=require(_0xca45('0xa'));var deskjs=require(_0xca45('0xb'));var toCsv=require(_0xca45('0x5'));var querystring=require(_0xca45('0xc'));var Papa=require('papaparse');var Redis=require(_0xca45('0xd'));var authService=require(_0xca45('0xe'));var qs=require(_0xca45('0xf'));var as=require(_0xca45('0x10'));var hardwareService=require(_0xca45('0x11'));var logger=require(_0xca45('0x12'))(_0xca45('0x13'));var utils=require('../../config/utils');var config=require(_0xca45('0x14'));var licenseUtil=require(_0xca45('0x15'));var db=require(_0xca45('0x16'))['db'];function respondWithStatusCode(_0x17ebf7,_0x580c43){_0x580c43=_0x580c43||0xcc;return function(_0x3044b1){if(_0x3044b1){return _0x17ebf7[_0xca45('0x17')](_0x580c43);}return _0x17ebf7[_0xca45('0x18')](_0x580c43)['end']();};}function respondWithResult(_0x214939,_0x569ba6){_0x569ba6=_0x569ba6||0xc8;return function(_0x22ce19){if(_0x22ce19){return _0x214939[_0xca45('0x18')](_0x569ba6)[_0xca45('0x19')](_0x22ce19);}};}function respondWithFilteredResult(_0x1c822d,_0x35b130){return function(_0x323b19){if(_0x323b19){var _0x18dd61=typeof _0x35b130['offset']===_0xca45('0x1a')&&typeof _0x35b130['limit']==='undefined';var _0x213986=_0x323b19[_0xca45('0x1b')];var _0x553af4=_0x18dd61?0x0:_0x35b130[_0xca45('0x1c')];var _0x184bbf=_0x18dd61?_0x323b19['count']:_0x35b130[_0xca45('0x1c')]+_0x35b130[_0xca45('0x1d')];var _0x446243;if(_0x184bbf>=_0x213986){_0x184bbf=_0x213986;_0x446243=0xc8;}else{_0x446243=0xce;}_0x1c822d[_0xca45('0x18')](_0x446243);return _0x1c822d['set'](_0xca45('0x1e'),_0x553af4+'-'+_0x184bbf+'/'+_0x213986)[_0xca45('0x19')](_0x323b19);}return null;};}function patchUpdates(_0x1a16f1){return function(_0xdea7de){try{jsonpatch['apply'](_0xdea7de,_0x1a16f1,!![]);}catch(_0x2c0a39){return BPromise[_0xca45('0x1f')](_0x2c0a39);}return _0xdea7de[_0xca45('0x20')]();};}function saveUpdates(_0x34bb8d,_0x2068df){return function(_0x3e8068){if(_0x3e8068){return _0x3e8068[_0xca45('0x21')](_0x34bb8d)[_0xca45('0x22')](function(_0x14cd25){return _0x14cd25;});}return null;};}function removeEntity(_0x4998b5,_0x3d9007){return function(_0x1acb89){if(_0x1acb89){return _0x1acb89[_0xca45('0x23')]()[_0xca45('0x22')](function(){_0x4998b5[_0xca45('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5927e2,_0x4d4869){return function(_0x28d9f1){if(!_0x28d9f1){_0x5927e2['sendStatus'](0x194);}return _0x28d9f1;};}function handleError(_0x5c36c7,_0x3547cd){_0x3547cd=_0x3547cd||0x1f4;return function(_0x3e3b03){logger[_0xca45('0x24')](_0x3e3b03[_0xca45('0x25')]);if(_0x3e3b03[_0xca45('0x26')]){delete _0x3e3b03['name'];}_0x5c36c7[_0xca45('0x18')](_0x3547cd)[_0xca45('0x27')](_0x3e3b03);};}exports[_0xca45('0x28')]=function(_0x4d546c,_0x4da9b6){var _0x592ad2={},_0x430591={},_0x2e51b1={'count':0x0,'rows':[]};var _0x5cb991=_[_0xca45('0x29')](db[_0xca45('0x2a')][_0xca45('0x2b')],function(_0x3e1693){return{'name':_0x3e1693['fieldName'],'type':_0x3e1693['type']['key']};});_0x430591[_0xca45('0x2c')]=_['map'](_0x5cb991,'name');_0x430591['query']=_[_0xca45('0x2d')](_0x4d546c['query']);_0x430591['filters']=_[_0xca45('0x2e')](_0x430591[_0xca45('0x2c')],_0x430591[_0xca45('0x2f')]);_0x592ad2['attributes']=_[_0xca45('0x2e')](_0x430591[_0xca45('0x2c')],qs['fields'](_0x4d546c[_0xca45('0x2f')][_0xca45('0x30')]));_0x592ad2[_0xca45('0x31')]=_0x592ad2[_0xca45('0x31')][_0xca45('0x32')]?_0x592ad2[_0xca45('0x31')]:_0x430591[_0xca45('0x2c')];if(!_0x4d546c[_0xca45('0x2f')][_0xca45('0x33')](_0xca45('0x34'))){_0x592ad2[_0xca45('0x1d')]=qs[_0xca45('0x1d')](_0x4d546c[_0xca45('0x2f')]['limit']);_0x592ad2['offset']=qs['offset'](_0x4d546c[_0xca45('0x2f')][_0xca45('0x1c')]);}_0x592ad2['order']=qs['sort'](_0x4d546c[_0xca45('0x2f')]['sort']);_0x592ad2[_0xca45('0x35')]=qs['filters'](_[_0xca45('0x36')](_0x4d546c[_0xca45('0x2f')],_0x430591[_0xca45('0x37')]),_0x5cb991);if(_0x4d546c[_0xca45('0x2f')][_0xca45('0x38')]){_0x592ad2['where']=_[_0xca45('0x39')](_0x592ad2['where'],{'$or':_[_0xca45('0x29')](_0x5cb991,function(_0x370e8b){if(_0x370e8b[_0xca45('0x3a')]!==_0xca45('0x3b')){var _0x4e9b06={};_0x4e9b06[_0x370e8b[_0xca45('0x26')]]={'$like':'%'+_0x4d546c[_0xca45('0x2f')][_0xca45('0x38')]+'%'};return _0x4e9b06;}})});}_0x592ad2=_['merge']({},_0x592ad2,_0x4d546c['options']);var _0x39a76a={'where':_0x592ad2[_0xca45('0x35')]};return db[_0xca45('0x2a')][_0xca45('0x1b')](_0x39a76a)[_0xca45('0x22')](function(_0x27317f){_0x2e51b1[_0xca45('0x1b')]=_0x27317f;if(_0x4d546c[_0xca45('0x2f')][_0xca45('0x3c')]){_0x592ad2[_0xca45('0x3d')]=[{'all':!![]}];}return db[_0xca45('0x2a')][_0xca45('0x3e')](_0x592ad2);})[_0xca45('0x22')](function(_0x44a60a){_0x2e51b1[_0xca45('0x3f')]=_0x44a60a;return _0x2e51b1;})[_0xca45('0x22')](respondWithFilteredResult(_0x4da9b6,_0x592ad2))[_0xca45('0x40')](handleError(_0x4da9b6,null));};exports[_0xca45('0x41')]=function(_0x4788b1,_0x266a05){var _0x3273e8={'raw':!![],'where':{'id':_0x4788b1['params']['id']}},_0x2ae7a2={};_0x2ae7a2[_0xca45('0x2c')]=_[_0xca45('0x2d')](db[_0xca45('0x2a')][_0xca45('0x2b')]);_0x2ae7a2['query']=_[_0xca45('0x2d')](_0x4788b1[_0xca45('0x2f')]);_0x2ae7a2[_0xca45('0x37')]=_[_0xca45('0x2e')](_0x2ae7a2[_0xca45('0x2c')],_0x2ae7a2[_0xca45('0x2f')]);_0x3273e8[_0xca45('0x31')]=_[_0xca45('0x2e')](_0x2ae7a2[_0xca45('0x2c')],qs[_0xca45('0x30')](_0x4788b1[_0xca45('0x2f')][_0xca45('0x30')]));_0x3273e8[_0xca45('0x31')]=_0x3273e8[_0xca45('0x31')][_0xca45('0x32')]?_0x3273e8[_0xca45('0x31')]:_0x2ae7a2[_0xca45('0x2c')];if(_0x4788b1[_0xca45('0x2f')][_0xca45('0x3c')]){_0x3273e8['include']=[{'all':!![]}];}_0x3273e8=_[_0xca45('0x39')]({},_0x3273e8,_0x4788b1[_0xca45('0x42')]);return db[_0xca45('0x2a')][_0xca45('0x43')](_0x3273e8)[_0xca45('0x22')](handleEntityNotFound(_0x266a05,null))[_0xca45('0x22')](respondWithResult(_0x266a05,null))[_0xca45('0x40')](handleError(_0x266a05,null));};exports[_0xca45('0x44')]=function(_0x28516f,_0x427bf5){return db[_0xca45('0x2a')][_0xca45('0x44')](_0x28516f[_0xca45('0x45')],{})[_0xca45('0x22')](respondWithResult(_0x427bf5,0xc9))['catch'](handleError(_0x427bf5,null));};exports[_0xca45('0x21')]=function(_0x457008,_0x2c6ed1){if(_0x457008[_0xca45('0x45')]['id']){delete _0x457008[_0xca45('0x45')]['id'];}return db[_0xca45('0x2a')][_0xca45('0x43')]({'where':{'id':_0x457008[_0xca45('0x46')]['id']}})[_0xca45('0x22')](handleEntityNotFound(_0x2c6ed1,null))[_0xca45('0x22')](saveUpdates(_0x457008[_0xca45('0x45')],null))['then'](respondWithResult(_0x2c6ed1,null))['catch'](handleError(_0x2c6ed1,null));};exports[_0xca45('0x23')]=function(_0x1b15be,_0x56c0c0){return db[_0xca45('0x2a')][_0xca45('0x43')]({'where':{'id':_0x1b15be[_0xca45('0x46')]['id']}})[_0xca45('0x22')](handleEntityNotFound(_0x56c0c0,null))[_0xca45('0x22')](removeEntity(_0x56c0c0,null))[_0xca45('0x40')](handleError(_0x56c0c0,null));}; \ No newline at end of file +var _0x702d=['nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x34fe39,_0x4b1934){var _0x2cd2e8=function(_0x2a4e57){while(--_0x2a4e57){_0x34fe39['push'](_0x34fe39['shift']());}};_0x2cd2e8(++_0x4b1934);}(_0x702d,0x147));var _0xd702=function(_0x314878,_0x33da66){_0x314878=_0x314878-0x0;var _0x9272c2=_0x702d[_0x314878];return _0x9272c2;};'use strict';var emlformat=require(_0xd702('0x0'));var rimraf=require(_0xd702('0x1'));var zipdir=require(_0xd702('0x2'));var jsonpatch=require(_0xd702('0x3'));var rp=require(_0xd702('0x4'));var moment=require('moment');var BPromise=require(_0xd702('0x5'));var Mustache=require(_0xd702('0x6'));var util=require(_0xd702('0x7'));var path=require(_0xd702('0x8'));var sox=require('sox');var csv=require(_0xd702('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd702('0xa'));var _=require(_0xd702('0xb'));var squel=require(_0xd702('0xc'));var crypto=require('crypto');var jsforce=require(_0xd702('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd702('0x9'));var querystring=require(_0xd702('0xe'));var Papa=require(_0xd702('0xf'));var Redis=require(_0xd702('0x10'));var authService=require(_0xd702('0x11'));var qs=require(_0xd702('0x12'));var as=require(_0xd702('0x13'));var hardwareService=require(_0xd702('0x14'));var logger=require(_0xd702('0x15'))(_0xd702('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd702('0x17'));var db=require(_0xd702('0x18'))['db'];function respondWithStatusCode(_0x273577,_0x5c0dad){_0x5c0dad=_0x5c0dad||0xcc;return function(_0x13ee5a){if(_0x13ee5a){return _0x273577[_0xd702('0x19')](_0x5c0dad);}return _0x273577[_0xd702('0x1a')](_0x5c0dad)[_0xd702('0x1b')]();};}function respondWithResult(_0x3948f8,_0x181ff2){_0x181ff2=_0x181ff2||0xc8;return function(_0x59dd33){if(_0x59dd33){return _0x3948f8[_0xd702('0x1a')](_0x181ff2)[_0xd702('0x1c')](_0x59dd33);}};}function respondWithFilteredResult(_0x5d7978,_0x707b9){return function(_0x4922f8){if(_0x4922f8){var _0x268c66=typeof _0x707b9[_0xd702('0x1d')]==='undefined'&&typeof _0x707b9[_0xd702('0x1e')]===_0xd702('0x1f');var _0x2a87f2=_0x4922f8['count'];var _0x5b3b1d=_0x268c66?0x0:_0x707b9[_0xd702('0x1d')];var _0x5a296e=_0x268c66?_0x4922f8[_0xd702('0x20')]:_0x707b9[_0xd702('0x1d')]+_0x707b9[_0xd702('0x1e')];var _0x265b1b;if(_0x5a296e>=_0x2a87f2){_0x5a296e=_0x2a87f2;_0x265b1b=0xc8;}else{_0x265b1b=0xce;}_0x5d7978[_0xd702('0x1a')](_0x265b1b);return _0x5d7978[_0xd702('0x21')](_0xd702('0x22'),_0x5b3b1d+'-'+_0x5a296e+'/'+_0x2a87f2)['json'](_0x4922f8);}return null;};}function patchUpdates(_0x4be140){return function(_0x536ca8){try{jsonpatch[_0xd702('0x23')](_0x536ca8,_0x4be140,!![]);}catch(_0x109284){return BPromise['reject'](_0x109284);}return _0x536ca8[_0xd702('0x24')]();};}function saveUpdates(_0x5d91fd,_0xc4c246){return function(_0x5824ec){if(_0x5824ec){return _0x5824ec['update'](_0x5d91fd)['then'](function(_0x21c00e){return _0x21c00e;});}return null;};}function removeEntity(_0xeec2e4,_0x459184){return function(_0x49761c){if(_0x49761c){return _0x49761c[_0xd702('0x25')]()[_0xd702('0x26')](function(){_0xeec2e4[_0xd702('0x1a')](0xcc)[_0xd702('0x1b')]();});}};}function handleEntityNotFound(_0x1200ed,_0x146f35){return function(_0x94c58d){if(!_0x94c58d){_0x1200ed[_0xd702('0x19')](0x194);}return _0x94c58d;};}function handleError(_0x22328a,_0x50d7ad){_0x50d7ad=_0x50d7ad||0x1f4;return function(_0x116b2f){logger[_0xd702('0x27')](_0x116b2f[_0xd702('0x28')]);if(_0x116b2f[_0xd702('0x29')]){delete _0x116b2f[_0xd702('0x29')];}_0x22328a[_0xd702('0x1a')](_0x50d7ad)[_0xd702('0x2a')](_0x116b2f);};}exports[_0xd702('0x2b')]=function(_0x5f1084,_0x47c9a2){var _0x1870b7={},_0x43cd38={},_0x56bc8d={'count':0x0,'rows':[]};var _0x45cd22=_[_0xd702('0x2c')](db[_0xd702('0x2d')][_0xd702('0x2e')],function(_0x56e9cd){return{'name':_0x56e9cd[_0xd702('0x2f')],'type':_0x56e9cd[_0xd702('0x30')][_0xd702('0x31')]};});_0x43cd38[_0xd702('0x32')]=_[_0xd702('0x2c')](_0x45cd22,'name');_0x43cd38[_0xd702('0x33')]=_[_0xd702('0x34')](_0x5f1084[_0xd702('0x33')]);_0x43cd38['filters']=_[_0xd702('0x35')](_0x43cd38['model'],_0x43cd38['query']);_0x1870b7[_0xd702('0x36')]=_[_0xd702('0x35')](_0x43cd38[_0xd702('0x32')],qs['fields'](_0x5f1084[_0xd702('0x33')][_0xd702('0x37')]));_0x1870b7['attributes']=_0x1870b7[_0xd702('0x36')][_0xd702('0x38')]?_0x1870b7[_0xd702('0x36')]:_0x43cd38[_0xd702('0x32')];if(!_0x5f1084[_0xd702('0x33')][_0xd702('0x39')](_0xd702('0x3a'))){_0x1870b7[_0xd702('0x1e')]=qs[_0xd702('0x1e')](_0x5f1084[_0xd702('0x33')][_0xd702('0x1e')]);_0x1870b7[_0xd702('0x1d')]=qs[_0xd702('0x1d')](_0x5f1084['query'][_0xd702('0x1d')]);}_0x1870b7[_0xd702('0x3b')]=qs[_0xd702('0x3c')](_0x5f1084[_0xd702('0x33')][_0xd702('0x3c')]);_0x1870b7[_0xd702('0x3d')]=qs[_0xd702('0x3e')](_['pick'](_0x5f1084['query'],_0x43cd38[_0xd702('0x3e')]),_0x45cd22);if(_0x5f1084[_0xd702('0x33')]['filter']){_0x1870b7['where']=_[_0xd702('0x3f')](_0x1870b7[_0xd702('0x3d')],{'$or':_['map'](_0x45cd22,function(_0x3a7aee){if(_0x3a7aee[_0xd702('0x30')]!==_0xd702('0x40')){var _0x4822d9={};_0x4822d9[_0x3a7aee[_0xd702('0x29')]]={'$like':'%'+_0x5f1084[_0xd702('0x33')][_0xd702('0x41')]+'%'};return _0x4822d9;}})});}_0x1870b7=_['merge']({},_0x1870b7,_0x5f1084[_0xd702('0x42')]);var _0x512854={'where':_0x1870b7[_0xd702('0x3d')]};return db[_0xd702('0x2d')][_0xd702('0x20')](_0x512854)[_0xd702('0x26')](function(_0x6af8d6){_0x56bc8d[_0xd702('0x20')]=_0x6af8d6;if(_0x5f1084[_0xd702('0x33')][_0xd702('0x43')]){_0x1870b7['include']=[{'all':!![]}];}return db[_0xd702('0x2d')][_0xd702('0x44')](_0x1870b7);})[_0xd702('0x26')](function(_0x3d703e){_0x56bc8d[_0xd702('0x45')]=_0x3d703e;return _0x56bc8d;})['then'](respondWithFilteredResult(_0x47c9a2,_0x1870b7))[_0xd702('0x46')](handleError(_0x47c9a2,null));};exports[_0xd702('0x47')]=function(_0x3424a3,_0x4c56ae){var _0xd48ad0={'raw':!![],'where':{'id':_0x3424a3[_0xd702('0x48')]['id']}},_0x3a1ed5={};_0x3a1ed5[_0xd702('0x32')]=_['keys'](db[_0xd702('0x2d')][_0xd702('0x2e')]);_0x3a1ed5[_0xd702('0x33')]=_[_0xd702('0x34')](_0x3424a3[_0xd702('0x33')]);_0x3a1ed5['filters']=_[_0xd702('0x35')](_0x3a1ed5[_0xd702('0x32')],_0x3a1ed5['query']);_0xd48ad0['attributes']=_[_0xd702('0x35')](_0x3a1ed5[_0xd702('0x32')],qs[_0xd702('0x37')](_0x3424a3[_0xd702('0x33')][_0xd702('0x37')]));_0xd48ad0[_0xd702('0x36')]=_0xd48ad0[_0xd702('0x36')][_0xd702('0x38')]?_0xd48ad0[_0xd702('0x36')]:_0x3a1ed5['model'];if(_0x3424a3['query'][_0xd702('0x43')]){_0xd48ad0['include']=[{'all':!![]}];}_0xd48ad0=_[_0xd702('0x3f')]({},_0xd48ad0,_0x3424a3['options']);return db[_0xd702('0x2d')]['find'](_0xd48ad0)[_0xd702('0x26')](handleEntityNotFound(_0x4c56ae,null))['then'](respondWithResult(_0x4c56ae,null))[_0xd702('0x46')](handleError(_0x4c56ae,null));};exports[_0xd702('0x49')]=function(_0x543b8f,_0x160f5e){return db[_0xd702('0x2d')][_0xd702('0x49')](_0x543b8f[_0xd702('0x4a')],{})[_0xd702('0x26')](respondWithResult(_0x160f5e,0xc9))['catch'](handleError(_0x160f5e,null));};exports[_0xd702('0x4b')]=function(_0x14c1db,_0x2d09be){if(_0x14c1db['body']['id']){delete _0x14c1db[_0xd702('0x4a')]['id'];}return db['FreshdeskField'][_0xd702('0x4c')]({'where':{'id':_0x14c1db[_0xd702('0x48')]['id']}})[_0xd702('0x26')](handleEntityNotFound(_0x2d09be,null))['then'](saveUpdates(_0x14c1db['body'],null))[_0xd702('0x26')](respondWithResult(_0x2d09be,null))[_0xd702('0x46')](handleError(_0x2d09be,null));};exports[_0xd702('0x25')]=function(_0x397e91,_0x16e59b){return db[_0xd702('0x2d')][_0xd702('0x4c')]({'where':{'id':_0x397e91[_0xd702('0x48')]['id']}})[_0xd702('0x26')](handleEntityNotFound(_0x16e59b,null))[_0xd702('0x26')](removeEntity(_0x16e59b,null))['catch'](handleError(_0x16e59b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index abed46d..799dfc7 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 _0x87e7=['lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','idField'];(function(_0xc9c0d5,_0x13266d){var _0x45cef3=function(_0x1a79d2){while(--_0x1a79d2){_0xc9c0d5['push'](_0xc9c0d5['shift']());}};_0x45cef3(++_0x13266d);}(_0x87e7,0x11e));var _0x787e=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0x87e7[_0x43fdf8];return _0x1160c6;};'use strict';var _=require(_0x787e('0x0'));var util=require('util');var logger=require(_0x787e('0x1'))(_0x787e('0x2'));var moment=require('moment');var BPromise=require(_0x787e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x787e('0x4'));var rimraf=require(_0x787e('0x5'));var config=require(_0x787e('0x6'));var attributes=require(_0x787e('0x7'));module[_0x787e('0x8')]=function(_0x189256,_0x14b6bf){return _0x189256[_0x787e('0x9')](_0x787e('0xa'),attributes,{'tableName':_0x787e('0xb'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x787e('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1841=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util'];(function(_0x27f49f,_0x267fef){var _0x33fd6c=function(_0x587bfc){while(--_0x587bfc){_0x27f49f['push'](_0x27f49f['shift']());}};_0x33fd6c(++_0x267fef);}(_0x1841,0xdf));var _0x1184=function(_0x34e91d,_0x30f912){_0x34e91d=_0x34e91d-0x0;var _0x1abab2=_0x1841[_0x34e91d];return _0x1abab2;};'use strict';var _=require('lodash');var util=require(_0x1184('0x0'));var logger=require(_0x1184('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1184('0x2'));var rp=require(_0x1184('0x3'));var fs=require('fs');var path=require(_0x1184('0x4'));var rimraf=require(_0x1184('0x5'));var config=require(_0x1184('0x6'));var attributes=require('./intFreshdeskField.attributes');module[_0x1184('0x7')]=function(_0x22d7c6,_0x3e5b3d){return _0x22d7c6[_0x1184('0x8')](_0x1184('0x9'),attributes,{'tableName':_0x1184('0xa'),'paranoid':![],'indexes':[{'name':_0x1184('0xb'),'fields':[_0x1184('0xc'),_0x1184('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 7cfdfee..7b43808 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 _0xb1f7=['debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x30d689,_0x271db8){var _0xc9d7a3=function(_0xafad8e){while(--_0xafad8e){_0x30d689['push'](_0x30d689['shift']());}};_0xc9d7a3(++_0x271db8);}(_0xb1f7,0x160));var _0x7b1f=function(_0x5d959f,_0x497da4){_0x5d959f=_0x5d959f-0x0;var _0xdb15ac=_0xb1f7[_0x5d959f];return _0xdb15ac;};'use strict';var _=require(_0x7b1f('0x0'));var util=require(_0x7b1f('0x1'));var moment=require(_0x7b1f('0x2'));var BPromise=require(_0x7b1f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b1f('0x4'));var db=require(_0x7b1f('0x5'))['db'];var utils=require(_0x7b1f('0x6'));var logger=require(_0x7b1f('0x7'))(_0x7b1f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7b1f('0x9')][_0x7b1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x211182,_0x130e48,_0x3ec6d7){return new BPromise(function(_0x3a1581,_0x5a0aea){return client[_0x7b1f('0xb')](_0x211182,_0x3ec6d7)[_0x7b1f('0xc')](function(_0x279354){logger[_0x7b1f('0xd')](_0x7b1f('0xe'),_0x130e48,_0x7b1f('0xf'));logger[_0x7b1f('0x10')](_0x7b1f('0x11'),_0x130e48,'request\x20sent',JSON['stringify'](_0x279354));if(_0x279354[_0x7b1f('0x12')]){if(_0x279354[_0x7b1f('0x12')][_0x7b1f('0x13')]===0x1f4){logger[_0x7b1f('0x12')](_0x7b1f('0xe'),_0x130e48,_0x279354[_0x7b1f('0x12')][_0x7b1f('0x14')]);return _0x5a0aea(_0x279354['error'][_0x7b1f('0x14')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x130e48,_0x279354[_0x7b1f('0x12')][_0x7b1f('0x14')]);return _0x3a1581(_0x279354[_0x7b1f('0x12')][_0x7b1f('0x14')]);}else{logger[_0x7b1f('0xd')](_0x7b1f('0xe'),_0x130e48,_0x7b1f('0xf'));_0x3a1581(_0x279354[_0x7b1f('0x15')][_0x7b1f('0x14')]);}})[_0x7b1f('0x16')](function(_0x4f7b3a){logger[_0x7b1f('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x130e48,_0x4f7b3a);_0x5a0aea(_0x4f7b3a);});});} \ No newline at end of file +var _0xcfe2=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','catch','lodash'];(function(_0x1da811,_0x2e30db){var _0x53858b=function(_0x4e70ce){while(--_0x4e70ce){_0x1da811['push'](_0x1da811['shift']());}};_0x53858b(++_0x2e30db);}(_0xcfe2,0x137));var _0x2cfe=function(_0x2a16fc,_0x158426){_0x2a16fc=_0x2a16fc-0x0;var _0x560d11=_0xcfe2[_0x2a16fc];return _0x560d11;};'use strict';var _=require(_0x2cfe('0x0'));var util=require(_0x2cfe('0x1'));var moment=require(_0x2cfe('0x2'));var BPromise=require(_0x2cfe('0x3'));var rs=require(_0x2cfe('0x4'));var fs=require('fs');var Redis=require(_0x2cfe('0x5'));var db=require(_0x2cfe('0x6'))['db'];var utils=require(_0x2cfe('0x7'));var logger=require(_0x2cfe('0x8'))(_0x2cfe('0x9'));var config=require(_0x2cfe('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2cfe('0xb')][_0x2cfe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24cade,_0x4d3b4c,_0x706c49){return new BPromise(function(_0x43e0b8,_0xc817d1){return client[_0x2cfe('0xd')](_0x24cade,_0x706c49)[_0x2cfe('0xe')](function(_0x2f3366){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x4d3b4c,_0x2cfe('0xf'));logger[_0x2cfe('0x10')](_0x2cfe('0x11'),_0x4d3b4c,'request\x20sent',JSON[_0x2cfe('0x12')](_0x2f3366));if(_0x2f3366[_0x2cfe('0x13')]){if(_0x2f3366['error'][_0x2cfe('0x14')]===0x1f4){logger[_0x2cfe('0x13')](_0x2cfe('0x15'),_0x4d3b4c,_0x2f3366[_0x2cfe('0x13')][_0x2cfe('0x16')]);return _0xc817d1(_0x2f3366[_0x2cfe('0x13')][_0x2cfe('0x16')]);}logger[_0x2cfe('0x13')](_0x2cfe('0x15'),_0x4d3b4c,_0x2f3366[_0x2cfe('0x13')]['message']);return _0x43e0b8(_0x2f3366[_0x2cfe('0x13')]['message']);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x4d3b4c,'request\x20sent');_0x43e0b8(_0x2f3366['result'][_0x2cfe('0x16')]);}})[_0x2cfe('0x17')](function(_0x4e16d9){logger['error'](_0x2cfe('0x15'),_0x4d3b4c,_0x4e16d9);_0xc817d1(_0x4e16d9);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 9c6fbaa..dda21c9 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 _0x96cc=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x343e44,_0x519af9){var _0xa5130e=function(_0xae1fa0){while(--_0xae1fa0){_0x343e44['push'](_0x343e44['shift']());}};_0xa5130e(++_0x519af9);}(_0x96cc,0x16c));var _0xc96c=function(_0x5e84bd,_0xd485f7){_0x5e84bd=_0x5e84bd-0x0;var _0x110526=_0x96cc[_0x5e84bd];return _0x110526;};'use strict';var multer=require(_0xc96c('0x0'));var util=require('util');var path=require(_0xc96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc96c('0x2'));var router=express[_0xc96c('0x3')]();var fs_extra=require(_0xc96c('0x4'));var auth=require(_0xc96c('0x5'));var interaction=require(_0xc96c('0x6'));var config=require(_0xc96c('0x7'));var controller=require(_0xc96c('0x8'));router[_0xc96c('0x9')]('/',auth[_0xc96c('0xa')](),controller['index']);router[_0xc96c('0x9')](_0xc96c('0xb'),auth[_0xc96c('0xa')](),controller[_0xc96c('0xc')]);router[_0xc96c('0x9')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller['getConfigurations']);router[_0xc96c('0x9')](_0xc96c('0xe'),auth[_0xc96c('0xa')](),controller['getFields']);router[_0xc96c('0xf')]('/',auth['isAuthenticated'](),controller[_0xc96c('0x10')]);router['post'](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller[_0xc96c('0x11')]);router[_0xc96c('0x12')]('/:id',auth[_0xc96c('0xa')](),controller[_0xc96c('0x13')]);router[_0xc96c('0x14')](_0xc96c('0xb'),auth['isAuthenticated'](),controller[_0xc96c('0x15')]);module[_0xc96c('0x16')]=router; \ No newline at end of file +var _0xf4eb=['getFields','create','put','update','delete','/:id','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x4abf1f,_0x518f84){var _0x11db1f=function(_0x19b73c){while(--_0x19b73c){_0x4abf1f['push'](_0x4abf1f['shift']());}};_0x11db1f(++_0x518f84);}(_0xf4eb,0xec));var _0xbf4e=function(_0x7a4aa4,_0x14503c){_0x7a4aa4=_0x7a4aa4-0x0;var _0x3c878b=_0xf4eb[_0x7a4aa4];return _0x3c878b;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/:id',auth[_0xbf4e('0x6')](),controller['show']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0xc')]);router['post'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller['addConfiguration']);router[_0xbf4e('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0xe')]);router[_0xbf4e('0xf')](_0xbf4e('0x10'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x11')]);module[_0xbf4e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index adfc610..b11b6e9 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 _0xaebd=['remoteUri','sequelize','STRING','username'];(function(_0x593683,_0x2b3213){var _0x44cc39=function(_0x5f085d){while(--_0x5f085d){_0x593683['push'](_0x593683['shift']());}};_0x44cc39(++_0x2b3213);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x4da839,_0x19ed43){_0x4da839=_0x4da839-0x0;var _0x3607e4=_0xaebd[_0x4da839];return _0x3607e4;};'use strict';var Sequelize=require(_0xdaeb('0x0'));module['exports']={'name':{'type':Sequelize[_0xdaeb('0x1')]},'description':{'type':Sequelize[_0xdaeb('0x1')]},'username':{'type':Sequelize[_0xdaeb('0x1')],'unique':_0xdaeb('0x2')},'apiKey':{'type':Sequelize[_0xdaeb('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xdaeb('0x3')},'serverUrl':{'type':Sequelize[_0xdaeb('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7708=['sequelize','exports','STRING','remoteUri'];(function(_0x1834f2,_0x41b76d){var _0x10dd78=function(_0x567dce){while(--_0x567dce){_0x1834f2['push'](_0x1834f2['shift']());}};_0x10dd78(++_0x41b76d);}(_0x7708,0x188));var _0x8770=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0x7708[_0x2389bc];return _0x170548;};'use strict';var Sequelize=require(_0x8770('0x0'));module[_0x8770('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8770('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8770('0x3')},'serverUrl':{'type':Sequelize[_0x8770('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 d2520cd..76d9517 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 _0x31c0=['Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','FreshsalesAccount','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','length','find','create','body','findOne','FreshsalesConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','apiKey','lastIndexOf','GET','format','/api/selector/owners'];(function(_0x3a2798,_0x2e2ec6){var _0x2c5a84=function(_0x5f3e94){while(--_0x5f3e94){_0x3a2798['push'](_0x3a2798['shift']());}};_0x2c5a84(++_0x2e2ec6);}(_0x31c0,0x1a2));var _0x031c=function(_0x3ba4f2,_0x28daaa){_0x3ba4f2=_0x3ba4f2-0x0;var _0x17c8a7=_0x31c0[_0x3ba4f2];return _0x17c8a7;};'use strict';var emlformat=require(_0x031c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x031c('0x1'));var rp=require(_0x031c('0x2'));var moment=require(_0x031c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x031c('0x4'));var util=require(_0x031c('0x5'));var path=require(_0x031c('0x6'));var sox=require(_0x031c('0x7'));var csv=require(_0x031c('0x8'));var ejs=require(_0x031c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031c('0xa'));var squel=require(_0x031c('0xb'));var crypto=require(_0x031c('0xc'));var jsforce=require(_0x031c('0xd'));var deskjs=require(_0x031c('0xe'));var toCsv=require(_0x031c('0x8'));var querystring=require('querystring');var Papa=require(_0x031c('0xf'));var Redis=require(_0x031c('0x10'));var authService=require(_0x031c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x031c('0x12'));var hardwareService=require(_0x031c('0x13'));var logger=require(_0x031c('0x14'))(_0x031c('0x15'));var utils=require(_0x031c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x031c('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x031c('0x18'));function respondWithStatusCode(_0x42b47b,_0x57c3e4){_0x57c3e4=_0x57c3e4||0xcc;return function(_0x2f0b07){if(_0x2f0b07){return _0x42b47b[_0x031c('0x19')](_0x57c3e4);}return _0x42b47b[_0x031c('0x1a')](_0x57c3e4)[_0x031c('0x1b')]();};}function respondWithResult(_0x3c2758,_0x3f4c1a){_0x3f4c1a=_0x3f4c1a||0xc8;return function(_0x798d5d){if(_0x798d5d){return _0x3c2758[_0x031c('0x1a')](_0x3f4c1a)[_0x031c('0x1c')](_0x798d5d);}};}function respondWithFilteredResult(_0x981f2f,_0x12a92e){return function(_0x4b0a2c){if(_0x4b0a2c){var _0x5d77a5=typeof _0x12a92e[_0x031c('0x1d')]===_0x031c('0x1e')&&typeof _0x12a92e[_0x031c('0x1f')]===_0x031c('0x1e');var _0x662c81=_0x4b0a2c['count'];var _0x6dc3b6=_0x5d77a5?0x0:_0x12a92e[_0x031c('0x1d')];var _0x2921a7=_0x5d77a5?_0x4b0a2c[_0x031c('0x20')]:_0x12a92e['offset']+_0x12a92e['limit'];var _0x276bf9;if(_0x2921a7>=_0x662c81){_0x2921a7=_0x662c81;_0x276bf9=0xc8;}else{_0x276bf9=0xce;}_0x981f2f['status'](_0x276bf9);return _0x981f2f['set'](_0x031c('0x21'),_0x6dc3b6+'-'+_0x2921a7+'/'+_0x662c81)[_0x031c('0x1c')](_0x4b0a2c);}return null;};}function patchUpdates(_0x1581e0){return function(_0x500629){try{jsonpatch[_0x031c('0x22')](_0x500629,_0x1581e0,!![]);}catch(_0x31f0e1){return BPromise[_0x031c('0x23')](_0x31f0e1);}return _0x500629['save']();};}function saveUpdates(_0x4b5974,_0x3e242d){return function(_0x11dcb9){if(_0x11dcb9){return _0x11dcb9[_0x031c('0x24')](_0x4b5974)['then'](function(_0x64f16a){return _0x64f16a;});}return null;};}function removeEntity(_0x3bdb68,_0x48b544){return function(_0x5a9541){if(_0x5a9541){return _0x5a9541[_0x031c('0x25')]()[_0x031c('0x26')](function(){_0x3bdb68[_0x031c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c7f4c,_0x1bb874){return function(_0x1a905a){if(!_0x1a905a){_0x3c7f4c[_0x031c('0x19')](0x194);}return _0x1a905a;};}function handleError(_0xa63954,_0x1c3e90){_0x1c3e90=_0x1c3e90||0x1f4;return function(_0x326789){logger[_0x031c('0x27')](_0x326789[_0x031c('0x28')]);if(_0x326789[_0x031c('0x29')]){delete _0x326789['name'];}_0xa63954[_0x031c('0x1a')](_0x1c3e90)[_0x031c('0x2a')](_0x326789);};}exports[_0x031c('0x2b')]=function(_0x5d7e40,_0x559c87){var _0x20d529={},_0x6031b9={},_0x21b5ae={'count':0x0,'rows':[]};var _0x3b273e=_[_0x031c('0x2c')](db[_0x031c('0x2d')]['rawAttributes'],function(_0x2a7942){return{'name':_0x2a7942[_0x031c('0x2e')],'type':_0x2a7942['type']['key']};});_0x6031b9[_0x031c('0x2f')]=_[_0x031c('0x2c')](_0x3b273e,'name');_0x6031b9[_0x031c('0x30')]=_[_0x031c('0x31')](_0x5d7e40[_0x031c('0x30')]);_0x6031b9[_0x031c('0x32')]=_['intersection'](_0x6031b9[_0x031c('0x2f')],_0x6031b9[_0x031c('0x30')]);_0x20d529['attributes']=_[_0x031c('0x33')](_0x6031b9[_0x031c('0x2f')],qs[_0x031c('0x34')](_0x5d7e40['query']['fields']));_0x20d529[_0x031c('0x35')]=_0x20d529[_0x031c('0x35')]['length']?_0x20d529['attributes']:_0x6031b9['model'];if(!_0x5d7e40[_0x031c('0x30')][_0x031c('0x36')]('nolimit')){_0x20d529[_0x031c('0x1f')]=qs[_0x031c('0x1f')](_0x5d7e40[_0x031c('0x30')]['limit']);_0x20d529[_0x031c('0x1d')]=qs[_0x031c('0x1d')](_0x5d7e40[_0x031c('0x30')][_0x031c('0x1d')]);}_0x20d529[_0x031c('0x37')]=qs[_0x031c('0x38')](_0x5d7e40['query'][_0x031c('0x38')]);_0x20d529[_0x031c('0x39')]=qs[_0x031c('0x32')](_[_0x031c('0x3a')](_0x5d7e40['query'],_0x6031b9[_0x031c('0x32')]),_0x3b273e);if(_0x5d7e40[_0x031c('0x30')][_0x031c('0x3b')]){_0x20d529[_0x031c('0x39')]=_[_0x031c('0x3c')](_0x20d529['where'],{'$or':_[_0x031c('0x2c')](_0x3b273e,function(_0x21c73d){if(_0x21c73d['type']!==_0x031c('0x3d')){var _0x9b1960={};_0x9b1960[_0x21c73d[_0x031c('0x29')]]={'$like':'%'+_0x5d7e40['query'][_0x031c('0x3b')]+'%'};return _0x9b1960;}})});}_0x20d529=_[_0x031c('0x3c')]({},_0x20d529,_0x5d7e40[_0x031c('0x3e')]);var _0x50039b={'where':_0x20d529[_0x031c('0x39')]};return db[_0x031c('0x2d')]['count'](_0x50039b)[_0x031c('0x26')](function(_0x3bf10f){_0x21b5ae['count']=_0x3bf10f;if(_0x5d7e40[_0x031c('0x30')][_0x031c('0x3f')]){_0x20d529['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x031c('0x40')](_0x20d529);})[_0x031c('0x26')](function(_0xad450e){_0x21b5ae['rows']=_0xad450e;return _0x21b5ae;})[_0x031c('0x26')](respondWithFilteredResult(_0x559c87,_0x20d529))[_0x031c('0x41')](handleError(_0x559c87,null));};exports[_0x031c('0x42')]=function(_0x1ed1c5,_0x1c7b20){var _0x2195ac={'raw':![],'where':{'id':_0x1ed1c5[_0x031c('0x43')]['id']}},_0x248d24={};_0x248d24[_0x031c('0x2f')]=_['keys'](db[_0x031c('0x2d')][_0x031c('0x44')]);_0x248d24[_0x031c('0x30')]=_[_0x031c('0x31')](_0x1ed1c5[_0x031c('0x30')]);_0x248d24[_0x031c('0x32')]=_['intersection'](_0x248d24[_0x031c('0x2f')],_0x248d24[_0x031c('0x30')]);_0x2195ac[_0x031c('0x35')]=_['intersection'](_0x248d24[_0x031c('0x2f')],qs[_0x031c('0x34')](_0x1ed1c5[_0x031c('0x30')][_0x031c('0x34')]));_0x2195ac[_0x031c('0x35')]=_0x2195ac[_0x031c('0x35')][_0x031c('0x45')]?_0x2195ac['attributes']:_0x248d24['model'];if(_0x1ed1c5[_0x031c('0x30')][_0x031c('0x3f')]){_0x2195ac['include']=[{'all':!![]}];}_0x2195ac=_[_0x031c('0x3c')]({},_0x2195ac,_0x1ed1c5[_0x031c('0x3e')]);return db[_0x031c('0x2d')][_0x031c('0x46')](_0x2195ac)[_0x031c('0x26')](handleEntityNotFound(_0x1c7b20,null))[_0x031c('0x26')](respondWithResult(_0x1c7b20,null))[_0x031c('0x41')](handleError(_0x1c7b20,null));};exports[_0x031c('0x47')]=function(_0x23f28d,_0x10c57b){return db[_0x031c('0x2d')][_0x031c('0x47')](_0x23f28d[_0x031c('0x48')],{})[_0x031c('0x26')](respondWithResult(_0x10c57b,0xc9))[_0x031c('0x41')](handleError(_0x10c57b,null));};exports[_0x031c('0x24')]=function(_0x38d78d,_0x43c45a){if(_0x38d78d[_0x031c('0x48')]['id']){delete _0x38d78d[_0x031c('0x48')]['id'];}return db[_0x031c('0x2d')][_0x031c('0x46')]({'where':{'id':_0x38d78d[_0x031c('0x43')]['id']}})[_0x031c('0x26')](handleEntityNotFound(_0x43c45a,null))[_0x031c('0x26')](saveUpdates(_0x38d78d[_0x031c('0x48')],null))[_0x031c('0x26')](respondWithResult(_0x43c45a,null))[_0x031c('0x41')](handleError(_0x43c45a,null));};exports[_0x031c('0x25')]=function(_0x23c5a9,_0x2eb23a){return db[_0x031c('0x2d')]['find']({'where':{'id':_0x23c5a9['params']['id']}})[_0x031c('0x26')](handleEntityNotFound(_0x2eb23a,null))[_0x031c('0x26')](removeEntity(_0x2eb23a,null))[_0x031c('0x41')](handleError(_0x2eb23a,null));};exports['getConfigurations']=function(_0x391889,_0x11f2dd,_0x24e86e){var _0x4c8802={};var _0x57524f={};var _0x1dbe47;var _0x467964;return db['FreshsalesAccount'][_0x031c('0x49')]({'where':{'id':_0x391889[_0x031c('0x43')]['id']}})[_0x031c('0x26')](handleEntityNotFound(_0x11f2dd,null))[_0x031c('0x26')](function(_0xe43561){if(_0xe43561){_0x1dbe47=_0xe43561;_0x57524f[_0x031c('0x2f')]=_[_0x031c('0x31')](db[_0x031c('0x4a')]['rawAttributes']);_0x57524f['query']=_[_0x031c('0x31')](_0x391889[_0x031c('0x30')]);_0x57524f['filters']=_['intersection'](_0x57524f['model'],_0x57524f[_0x031c('0x30')]);_0x4c8802[_0x031c('0x35')]=_['intersection'](_0x57524f[_0x031c('0x2f')],qs[_0x031c('0x34')](_0x391889[_0x031c('0x30')][_0x031c('0x34')]));_0x4c8802[_0x031c('0x35')]=_0x4c8802[_0x031c('0x35')]['length']?_0x4c8802[_0x031c('0x35')]:_0x57524f[_0x031c('0x2f')];_0x4c8802[_0x031c('0x37')]=qs[_0x031c('0x38')](_0x391889['query']['sort']);_0x4c8802['where']=qs[_0x031c('0x32')](_[_0x031c('0x3a')](_0x391889[_0x031c('0x30')],_0x57524f[_0x031c('0x32')]));if(_0x391889[_0x031c('0x30')][_0x031c('0x3b')]){_0x4c8802[_0x031c('0x39')]=_[_0x031c('0x3c')](_0x4c8802['where'],{'$or':_[_0x031c('0x2c')](_0x4c8802[_0x031c('0x35')],function(_0x10147c){var _0x42735d={};_0x42735d[_0x10147c]={'$like':'%'+_0x391889[_0x031c('0x30')][_0x031c('0x3b')]+'%'};return _0x42735d;})});}_0x4c8802=_[_0x031c('0x3c')]({},_0x4c8802,_0x391889['options']);return _0x1dbe47[_0x031c('0x4b')](_0x4c8802);}})[_0x031c('0x26')](function(_0xdb7dce){if(_0xdb7dce){_0x467964=_0xdb7dce[_0x031c('0x45')];if(!_0x391889['query'][_0x031c('0x36')]('nolimit')){_0x4c8802[_0x031c('0x1f')]=qs[_0x031c('0x1f')](_0x391889[_0x031c('0x30')][_0x031c('0x1f')]);_0x4c8802['offset']=qs[_0x031c('0x1d')](_0x391889['query']['offset']);}return _0x1dbe47['getConfigurations'](_0x4c8802);}})['then'](function(_0x2070da){if(_0x2070da){return _0x2070da?{'count':_0x467964,'rows':_0x2070da}:null;}})[_0x031c('0x26')](respondWithResult(_0x11f2dd,null))[_0x031c('0x41')](handleError(_0x11f2dd,null));};exports[_0x031c('0x4c')]=function(_0x10a46a,_0xb5e408,_0x1662a2){if(_0x10a46a[_0x031c('0x48')]['id']){delete _0x10a46a['body']['id'];}return db[_0x031c('0x2d')][_0x031c('0x49')]({'where':{'id':_0x10a46a[_0x031c('0x43')]['id']}})[_0x031c('0x26')](handleEntityNotFound(_0xb5e408,null))[_0x031c('0x26')](function(_0x13041d){if(_0x13041d){_0x10a46a[_0x031c('0x48')][_0x031c('0x4d')]=_0x13041d['id'];_0x10a46a['body'][_0x031c('0x4e')]=integrations[_0x031c('0x4f')](_0x10a46a['body'][_0x031c('0x50')],_0x10a46a[_0x031c('0x48')][_0x031c('0x51')]);_0x10a46a[_0x031c('0x48')][_0x031c('0x52')]=integrations[_0x031c('0x53')](_0x10a46a[_0x031c('0x48')][_0x031c('0x50')],_0x10a46a[_0x031c('0x48')][_0x031c('0x51')]);return db['FreshsalesConfiguration'][_0x031c('0x47')](_0x10a46a[_0x031c('0x48')],{'include':[{'model':db[_0x031c('0x54')],'as':_0x031c('0x4e')},{'model':db[_0x031c('0x54')],'as':'Descriptions'}]});}return null;})[_0x031c('0x26')](respondWithResult(_0xb5e408,null))[_0x031c('0x41')](handleError(_0xb5e408,null));};exports['getFields']=function(_0x2ba153,_0x5b86b5,_0x144edb){var _0x1b8792='';var _0x234f53='';return db[_0x031c('0x2d')][_0x031c('0x49')]({'where':{'id':_0x2ba153[_0x031c('0x43')]['id']},'attributes':['id',_0x031c('0x55'),_0x031c('0x56'),_0x031c('0x57')]})['then'](handleEntityNotFound(_0x5b86b5,null))[_0x031c('0x26')](function(_0x5e8b20){if(_0x5e8b20){_0x234f53=_0x5e8b20[_0x031c('0x55')];_0x1b8792=_0x5e8b20[_0x031c('0x56')];var _0xe5369d=_0x5e8b20[_0x031c('0x56')]['slice'](-0x1);if(_0xe5369d==='/'){_0x1b8792=_0x1b8792['substring'](0x0,_0x1b8792[_0x031c('0x58')](_0xe5369d));}return rp({'method':_0x031c('0x59'),'uri':util[_0x031c('0x5a')]('%s%s',_0x1b8792,_0x031c('0x5b')),'headers':{'Authorization':_0x031c('0x5c')+_0x5e8b20[_0x031c('0x57')]},'json':!![]});}})[_0x031c('0x26')](function(_0x90d946){if(_0x90d946){var _0x35f989=_0x90d946[_0x031c('0x5d')];var _0x4afcd8=![];var _0x16b1e8=null;for(_0x16b1e8=0x0;_0x16b1e8<_0x35f989[_0x031c('0x45')];_0x16b1e8++){if(_0x35f989[_0x16b1e8][_0x031c('0x5e')]===_0x234f53){_0x4afcd8=!![];}}if(_0x4afcd8){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x031c('0x5f')});}}})['then'](respondWithResult(_0x5b86b5,null))[_0x031c('0x41')](function(_0x13d000){var _0x20b089=_0x2ba153['query']['test']?0x1f4:_0x13d000[_0x031c('0x60')]||0x1f4;logger[_0x031c('0x27')](_0x031c('0x61'),_0x031c('0x62'),_0x20b089,JSON[_0x031c('0x63')](_0x13d000));delete _0x13d000[_0x031c('0x29')];if(_0x20b089===0x191){_0x20b089=0x190;}_0x5b86b5[_0x031c('0x1a')](_0x20b089)[_0x031c('0x2a')](_0x2ba153[_0x031c('0x30')][_0x031c('0x64')]?{'message':_0x031c('0x65'),'statusCode':_0x13d000[_0x031c('0x60')]}:_0x13d000);});}; \ No newline at end of file +var _0x6602=['getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','send','index','map','FreshsalesAccount','rawAttributes','model','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','name','merge','options','count','includeAll','findAll','rows','catch','params','keys','fields','include','find','create','body','findOne','FreshsalesConfiguration','pick','getConfigurations','Subjects','getDescriptions','channel','FreshsalesField','Descriptions','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','test'];(function(_0x58f7f8,_0xc1f830){var _0xba41e2=function(_0x54c604){while(--_0x54c604){_0x58f7f8['push'](_0x58f7f8['shift']());}};_0xba41e2(++_0xc1f830);}(_0x6602,0x1a0));var _0x2660=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6602[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x2660('0x0'));var rimraf=require(_0x2660('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2660('0x2'));var rp=require('request-promise');var moment=require(_0x2660('0x3'));var BPromise=require(_0x2660('0x4'));var Mustache=require('mustache');var util=require(_0x2660('0x5'));var path=require(_0x2660('0x6'));var sox=require(_0x2660('0x7'));var csv=require(_0x2660('0x8'));var ejs=require(_0x2660('0x9'));var fs=require('fs');var fs_extra=require(_0x2660('0xa'));var _=require(_0x2660('0xb'));var squel=require(_0x2660('0xc'));var crypto=require(_0x2660('0xd'));var jsforce=require(_0x2660('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2660('0x8'));var querystring=require(_0x2660('0xf'));var Papa=require(_0x2660('0x10'));var Redis=require(_0x2660('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2660('0x12'));var as=require(_0x2660('0x13'));var hardwareService=require(_0x2660('0x14'));var logger=require(_0x2660('0x15'))('api');var utils=require(_0x2660('0x16'));var config=require(_0x2660('0x17'));var licenseUtil=require(_0x2660('0x18'));var db=require(_0x2660('0x19'))['db'];var integrations=require(_0x2660('0x1a'));function respondWithStatusCode(_0x1dd63f,_0x1988d3){_0x1988d3=_0x1988d3||0xcc;return function(_0x38fe19){if(_0x38fe19){return _0x1dd63f[_0x2660('0x1b')](_0x1988d3);}return _0x1dd63f[_0x2660('0x1c')](_0x1988d3)['end']();};}function respondWithResult(_0x30e1e7,_0x236e87){_0x236e87=_0x236e87||0xc8;return function(_0x59f5a5){if(_0x59f5a5){return _0x30e1e7[_0x2660('0x1c')](_0x236e87)[_0x2660('0x1d')](_0x59f5a5);}};}function respondWithFilteredResult(_0x3f9280,_0x59628d){return function(_0x1d09d4){if(_0x1d09d4){var _0x144f0a=typeof _0x59628d['offset']===_0x2660('0x1e')&&typeof _0x59628d[_0x2660('0x1f')]===_0x2660('0x1e');var _0x34ea9a=_0x1d09d4['count'];var _0x11f2d2=_0x144f0a?0x0:_0x59628d[_0x2660('0x20')];var _0x16d578=_0x144f0a?_0x1d09d4['count']:_0x59628d[_0x2660('0x20')]+_0x59628d['limit'];var _0x40cee6;if(_0x16d578>=_0x34ea9a){_0x16d578=_0x34ea9a;_0x40cee6=0xc8;}else{_0x40cee6=0xce;}_0x3f9280[_0x2660('0x1c')](_0x40cee6);return _0x3f9280[_0x2660('0x21')](_0x2660('0x22'),_0x11f2d2+'-'+_0x16d578+'/'+_0x34ea9a)[_0x2660('0x1d')](_0x1d09d4);}return null;};}function patchUpdates(_0x55414c){return function(_0x94ea6b){try{jsonpatch[_0x2660('0x23')](_0x94ea6b,_0x55414c,!![]);}catch(_0x4d33c7){return BPromise[_0x2660('0x24')](_0x4d33c7);}return _0x94ea6b['save']();};}function saveUpdates(_0x41e3eb,_0x528ea1){return function(_0x127ba4){if(_0x127ba4){return _0x127ba4[_0x2660('0x25')](_0x41e3eb)['then'](function(_0x8a11d9){return _0x8a11d9;});}return null;};}function removeEntity(_0x46a426,_0x4b8cb1){return function(_0x5c6e3c){if(_0x5c6e3c){return _0x5c6e3c[_0x2660('0x26')]()[_0x2660('0x27')](function(){_0x46a426[_0x2660('0x1c')](0xcc)[_0x2660('0x28')]();});}};}function handleEntityNotFound(_0x330991,_0x2c41e4){return function(_0x5edecb){if(!_0x5edecb){_0x330991[_0x2660('0x1b')](0x194);}return _0x5edecb;};}function handleError(_0x3956ff,_0x3cab23){_0x3cab23=_0x3cab23||0x1f4;return function(_0x548ede){logger[_0x2660('0x29')](_0x548ede[_0x2660('0x2a')]);if(_0x548ede['name']){delete _0x548ede['name'];}_0x3956ff['status'](_0x3cab23)[_0x2660('0x2b')](_0x548ede);};}exports[_0x2660('0x2c')]=function(_0xaf5bc8,_0x5aa74a){var _0x55bb48={},_0x2db20f={},_0x32da81={'count':0x0,'rows':[]};var _0x26a984=_[_0x2660('0x2d')](db[_0x2660('0x2e')][_0x2660('0x2f')],function(_0x22f748){return{'name':_0x22f748['fieldName'],'type':_0x22f748['type']['key']};});_0x2db20f[_0x2660('0x30')]=_['map'](_0x26a984,'name');_0x2db20f['query']=_['keys'](_0xaf5bc8['query']);_0x2db20f[_0x2660('0x31')]=_[_0x2660('0x32')](_0x2db20f['model'],_0x2db20f[_0x2660('0x33')]);_0x55bb48[_0x2660('0x34')]=_[_0x2660('0x32')](_0x2db20f['model'],qs['fields'](_0xaf5bc8['query']['fields']));_0x55bb48[_0x2660('0x34')]=_0x55bb48[_0x2660('0x34')][_0x2660('0x35')]?_0x55bb48[_0x2660('0x34')]:_0x2db20f[_0x2660('0x30')];if(!_0xaf5bc8[_0x2660('0x33')][_0x2660('0x36')](_0x2660('0x37'))){_0x55bb48[_0x2660('0x1f')]=qs[_0x2660('0x1f')](_0xaf5bc8[_0x2660('0x33')][_0x2660('0x1f')]);_0x55bb48[_0x2660('0x20')]=qs['offset'](_0xaf5bc8[_0x2660('0x33')]['offset']);}_0x55bb48['order']=qs[_0x2660('0x38')](_0xaf5bc8['query'][_0x2660('0x38')]);_0x55bb48[_0x2660('0x39')]=qs['filters'](_['pick'](_0xaf5bc8[_0x2660('0x33')],_0x2db20f['filters']),_0x26a984);if(_0xaf5bc8[_0x2660('0x33')][_0x2660('0x3a')]){_0x55bb48[_0x2660('0x39')]=_['merge'](_0x55bb48[_0x2660('0x39')],{'$or':_[_0x2660('0x2d')](_0x26a984,function(_0x13428b){if(_0x13428b[_0x2660('0x3b')]!==_0x2660('0x3c')){var _0x1d881e={};_0x1d881e[_0x13428b[_0x2660('0x3d')]]={'$like':'%'+_0xaf5bc8[_0x2660('0x33')]['filter']+'%'};return _0x1d881e;}})});}_0x55bb48=_[_0x2660('0x3e')]({},_0x55bb48,_0xaf5bc8[_0x2660('0x3f')]);var _0x4f83ac={'where':_0x55bb48[_0x2660('0x39')]};return db[_0x2660('0x2e')][_0x2660('0x40')](_0x4f83ac)[_0x2660('0x27')](function(_0xe08537){_0x32da81[_0x2660('0x40')]=_0xe08537;if(_0xaf5bc8[_0x2660('0x33')][_0x2660('0x41')]){_0x55bb48['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x2660('0x42')](_0x55bb48);})[_0x2660('0x27')](function(_0x5e1d97){_0x32da81[_0x2660('0x43')]=_0x5e1d97;return _0x32da81;})[_0x2660('0x27')](respondWithFilteredResult(_0x5aa74a,_0x55bb48))[_0x2660('0x44')](handleError(_0x5aa74a,null));};exports['show']=function(_0x44778e,_0x75ec6){var _0x34f341={'raw':![],'where':{'id':_0x44778e[_0x2660('0x45')]['id']}},_0x4163fa={};_0x4163fa[_0x2660('0x30')]=_[_0x2660('0x46')](db[_0x2660('0x2e')][_0x2660('0x2f')]);_0x4163fa[_0x2660('0x33')]=_['keys'](_0x44778e[_0x2660('0x33')]);_0x4163fa[_0x2660('0x31')]=_['intersection'](_0x4163fa['model'],_0x4163fa[_0x2660('0x33')]);_0x34f341['attributes']=_[_0x2660('0x32')](_0x4163fa[_0x2660('0x30')],qs['fields'](_0x44778e[_0x2660('0x33')][_0x2660('0x47')]));_0x34f341[_0x2660('0x34')]=_0x34f341['attributes'][_0x2660('0x35')]?_0x34f341[_0x2660('0x34')]:_0x4163fa[_0x2660('0x30')];if(_0x44778e[_0x2660('0x33')][_0x2660('0x41')]){_0x34f341[_0x2660('0x48')]=[{'all':!![]}];}_0x34f341=_[_0x2660('0x3e')]({},_0x34f341,_0x44778e['options']);return db['FreshsalesAccount'][_0x2660('0x49')](_0x34f341)['then'](handleEntityNotFound(_0x75ec6,null))[_0x2660('0x27')](respondWithResult(_0x75ec6,null))['catch'](handleError(_0x75ec6,null));};exports[_0x2660('0x4a')]=function(_0x2c6f8c,_0x5b2698){return db[_0x2660('0x2e')]['create'](_0x2c6f8c[_0x2660('0x4b')],{})['then'](respondWithResult(_0x5b2698,0xc9))[_0x2660('0x44')](handleError(_0x5b2698,null));};exports[_0x2660('0x25')]=function(_0x2dff0d,_0x1522f7){if(_0x2dff0d[_0x2660('0x4b')]['id']){delete _0x2dff0d[_0x2660('0x4b')]['id'];}return db[_0x2660('0x2e')][_0x2660('0x49')]({'where':{'id':_0x2dff0d[_0x2660('0x45')]['id']}})['then'](handleEntityNotFound(_0x1522f7,null))['then'](saveUpdates(_0x2dff0d['body'],null))[_0x2660('0x27')](respondWithResult(_0x1522f7,null))[_0x2660('0x44')](handleError(_0x1522f7,null));};exports[_0x2660('0x26')]=function(_0x3d3788,_0x4ce95e){return db[_0x2660('0x2e')][_0x2660('0x49')]({'where':{'id':_0x3d3788['params']['id']}})['then'](handleEntityNotFound(_0x4ce95e,null))['then'](removeEntity(_0x4ce95e,null))['catch'](handleError(_0x4ce95e,null));};exports['getConfigurations']=function(_0x3a59bd,_0x4cb782,_0x132586){var _0x572c21={};var _0x3e9566={};var _0x24496f;var _0x42d2e4;return db['FreshsalesAccount'][_0x2660('0x4c')]({'where':{'id':_0x3a59bd['params']['id']}})[_0x2660('0x27')](handleEntityNotFound(_0x4cb782,null))['then'](function(_0x5b700c){if(_0x5b700c){_0x24496f=_0x5b700c;_0x3e9566['model']=_[_0x2660('0x46')](db[_0x2660('0x4d')][_0x2660('0x2f')]);_0x3e9566[_0x2660('0x33')]=_[_0x2660('0x46')](_0x3a59bd['query']);_0x3e9566[_0x2660('0x31')]=_[_0x2660('0x32')](_0x3e9566['model'],_0x3e9566['query']);_0x572c21[_0x2660('0x34')]=_['intersection'](_0x3e9566[_0x2660('0x30')],qs['fields'](_0x3a59bd[_0x2660('0x33')][_0x2660('0x47')]));_0x572c21[_0x2660('0x34')]=_0x572c21[_0x2660('0x34')][_0x2660('0x35')]?_0x572c21[_0x2660('0x34')]:_0x3e9566[_0x2660('0x30')];_0x572c21['order']=qs[_0x2660('0x38')](_0x3a59bd[_0x2660('0x33')][_0x2660('0x38')]);_0x572c21['where']=qs[_0x2660('0x31')](_[_0x2660('0x4e')](_0x3a59bd[_0x2660('0x33')],_0x3e9566[_0x2660('0x31')]));if(_0x3a59bd[_0x2660('0x33')][_0x2660('0x3a')]){_0x572c21[_0x2660('0x39')]=_[_0x2660('0x3e')](_0x572c21[_0x2660('0x39')],{'$or':_[_0x2660('0x2d')](_0x572c21[_0x2660('0x34')],function(_0x4db4f1){var _0x3ef665={};_0x3ef665[_0x4db4f1]={'$like':'%'+_0x3a59bd['query'][_0x2660('0x3a')]+'%'};return _0x3ef665;})});}_0x572c21=_['merge']({},_0x572c21,_0x3a59bd[_0x2660('0x3f')]);return _0x24496f[_0x2660('0x4f')](_0x572c21);}})['then'](function(_0x1f3f6c){if(_0x1f3f6c){_0x42d2e4=_0x1f3f6c[_0x2660('0x35')];if(!_0x3a59bd[_0x2660('0x33')][_0x2660('0x36')]('nolimit')){_0x572c21[_0x2660('0x1f')]=qs[_0x2660('0x1f')](_0x3a59bd['query'][_0x2660('0x1f')]);_0x572c21[_0x2660('0x20')]=qs[_0x2660('0x20')](_0x3a59bd[_0x2660('0x33')][_0x2660('0x20')]);}return _0x24496f[_0x2660('0x4f')](_0x572c21);}})[_0x2660('0x27')](function(_0x5a0359){if(_0x5a0359){return _0x5a0359?{'count':_0x42d2e4,'rows':_0x5a0359}:null;}})[_0x2660('0x27')](respondWithResult(_0x4cb782,null))[_0x2660('0x44')](handleError(_0x4cb782,null));};exports['addConfiguration']=function(_0x1690bb,_0x5f4f7b,_0x34ded5){if(_0x1690bb[_0x2660('0x4b')]['id']){delete _0x1690bb[_0x2660('0x4b')]['id'];}return db[_0x2660('0x2e')][_0x2660('0x4c')]({'where':{'id':_0x1690bb['params']['id']}})[_0x2660('0x27')](handleEntityNotFound(_0x5f4f7b,null))[_0x2660('0x27')](function(_0x4c924d){if(_0x4c924d){_0x1690bb[_0x2660('0x4b')]['AccountId']=_0x4c924d['id'];_0x1690bb['body'][_0x2660('0x50')]=integrations['getSubjects'](_0x1690bb[_0x2660('0x4b')]['channel'],_0x1690bb['body']['type']);_0x1690bb['body']['Descriptions']=integrations[_0x2660('0x51')](_0x1690bb[_0x2660('0x4b')][_0x2660('0x52')],_0x1690bb[_0x2660('0x4b')][_0x2660('0x3b')]);return db[_0x2660('0x4d')]['create'](_0x1690bb[_0x2660('0x4b')],{'include':[{'model':db[_0x2660('0x53')],'as':_0x2660('0x50')},{'model':db['FreshsalesField'],'as':_0x2660('0x54')}]});}return null;})[_0x2660('0x27')](respondWithResult(_0x5f4f7b,null))[_0x2660('0x44')](handleError(_0x5f4f7b,null));};exports['getFields']=function(_0x327228,_0x475592,_0x403cd8){var _0x3f66b2='';var _0x53c50a='';return db[_0x2660('0x2e')][_0x2660('0x4c')]({'where':{'id':_0x327228[_0x2660('0x45')]['id']},'attributes':['id',_0x2660('0x55'),'remoteUri','apiKey']})[_0x2660('0x27')](handleEntityNotFound(_0x475592,null))[_0x2660('0x27')](function(_0x428203){if(_0x428203){_0x53c50a=_0x428203[_0x2660('0x55')];_0x3f66b2=_0x428203['remoteUri'];var _0x537655=_0x428203[_0x2660('0x56')][_0x2660('0x57')](-0x1);if(_0x537655==='/'){_0x3f66b2=_0x3f66b2[_0x2660('0x58')](0x0,_0x3f66b2[_0x2660('0x59')](_0x537655));}return rp({'method':_0x2660('0x5a'),'uri':util[_0x2660('0x5b')](_0x2660('0x5c'),_0x3f66b2,_0x2660('0x5d')),'headers':{'Authorization':_0x2660('0x5e')+_0x428203[_0x2660('0x5f')]},'json':!![]});}})['then'](function(_0xc3b54e){if(_0xc3b54e){var _0x48b07e=_0xc3b54e[_0x2660('0x60')];var _0x703fd0=![];var _0x46b90a=null;for(_0x46b90a=0x0;_0x46b90a<_0x48b07e['length'];_0x46b90a++){if(_0x48b07e[_0x46b90a][_0x2660('0x61')]===_0x53c50a){_0x703fd0=!![];}}if(_0x703fd0){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x475592,null))['catch'](function(_0x25b649){var _0x1463e8=_0x327228['query'][_0x2660('0x62')]?0x1f4:_0x25b649['statusCode']||0x1f4;logger[_0x2660('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x2660('0x63'),_0x1463e8,JSON[_0x2660('0x64')](_0x25b649));delete _0x25b649[_0x2660('0x3d')];if(_0x1463e8===0x191){_0x1463e8=0x190;}_0x475592['status'](_0x1463e8)[_0x2660('0x2b')](_0x327228['query'][_0x2660('0x62')]?{'message':_0x2660('0x65'),'statusCode':_0x25b649[_0x2660('0x66')]}:_0x25b649);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 622c9d6..86fe4c8 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 _0x6050=['moment','bluebird','path','rimraf','../../config/environment','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0xe84289,_0x4bd209){var _0x2920f3=function(_0x3a9e04){while(--_0x3a9e04){_0xe84289['push'](_0xe84289['shift']());}};_0x2920f3(++_0x4bd209);}(_0x6050,0x196));var _0x0605=function(_0x38171b,_0x2651a9){_0x38171b=_0x38171b-0x0;var _0x4c34d9=_0x6050[_0x38171b];return _0x4c34d9;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xd78d96,_0x578623){return _0xd78d96['define']('FreshsalesAccount',attributes,{'tableName':_0x0605('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa46e=['api','moment','bluebird','path','../../config/environment','../../components/integrations/configuration','FreshsalesAccount','int_freshsales_accounts','lodash','util'];(function(_0x43e97d,_0x35c7ba){var _0x385d12=function(_0x5182b3){while(--_0x5182b3){_0x43e97d['push'](_0x43e97d['shift']());}};_0x385d12(++_0x35c7ba);}(_0xa46e,0x8a));var _0xea46=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xa46e[_0x5cbf0e];return _0x1c76f8;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xea46('0x7'));module['exports']=function(_0x10bee5,_0x3dc26f){return _0x10bee5['define'](_0xea46('0x8'),attributes,{'tableName':_0xea46('0x9'),'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 31dac01..94453a2 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 _0x82c4=['findAll','options','raw','attributes','include','map','model','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x82c4,0x1ca));var _0x482c=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0x82c4[_0x483d8b];return _0x6500f1;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x7'))('rpc');var config=require(_0x482c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfdb92,_0x32a503,_0x35cdab){return new BPromise(function(_0x1c10f2,_0x3846d8){return client['request'](_0xfdb92,_0x35cdab)[_0x482c('0xa')](function(_0x135cc1){logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));logger[_0x482c('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x32a503,_0x482c('0xd'),JSON[_0x482c('0xf')](_0x135cc1));if(_0x135cc1[_0x482c('0x10')]){if(_0x135cc1['error'][_0x482c('0x11')]===0x1f4){logger[_0x482c('0x10')](_0x482c('0xc'),_0x32a503,_0x135cc1['error']['message']);return _0x3846d8(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x32a503,_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);return _0x1c10f2(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}else{logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));_0x1c10f2(_0x135cc1[_0x482c('0x13')][_0x482c('0x12')]);}})[_0x482c('0x14')](function(_0x363403){logger[_0x482c('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x32a503,_0x363403);_0x3846d8(_0x363403);});});}exports[_0x482c('0x15')]=function(_0x5b6f7e){var _0x3aed45=this;return new Promise(function(_0x258148,_0x4af05a){return db['FreshsalesAccount'][_0x482c('0x16')]({'raw':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['where']||null:null,'attributes':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x19')]||null:null,'limit':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['limit']||null:null,'include':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x5b6f7e['options'][_0x482c('0x1a')],function(_0x579d2f){return{'model':db[_0x579d2f[_0x482c('0x1c')]],'as':_0x579d2f['as'],'attributes':_0x579d2f[_0x482c('0x19')],'include':_0x579d2f['include']?_[_0x482c('0x1b')](_0x579d2f['include'],function(_0x589bc6){return{'model':db[_0x589bc6[_0x482c('0x1c')]],'as':_0x589bc6['as'],'attributes':_0x589bc6[_0x482c('0x19')],'include':_0x589bc6[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x589bc6[_0x482c('0x1a')],function(_0x215826){return{'model':db[_0x215826[_0x482c('0x1c')]],'as':_0x215826['as'],'attributes':_0x215826['attributes']};}):[]};}):[]};}):[]:[]})[_0x482c('0xa')](function(_0x255417){logger['info'](_0x482c('0x15'),_0x5b6f7e);logger['debug']('GetFreshsalesAccount',_0x5b6f7e,JSON[_0x482c('0xf')](_0x255417));_0x258148(_0x255417);})['catch'](function(_0x1ac1c4){logger[_0x482c('0x10')](_0x482c('0x15'),_0x1ac1c4[_0x482c('0x12')],_0x5b6f7e);_0x4af05a(_0x3aed45[_0x482c('0x10')](0x1f4,_0x1ac1c4[_0x482c('0x12')]));});});};exports[_0x482c('0x1d')]=function(_0x3e9b22){var _0x24b4df=this;return new Promise(function(_0x2d3800,_0x3135a7){return db[_0x482c('0x1e')][_0x482c('0x1f')]({'raw':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')]['where']||null:null,'attributes':_0x3e9b22['options']?_0x3e9b22['options'][_0x482c('0x19')]||null:null,'include':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x1a')]?_['map'](_0x3e9b22[_0x482c('0x17')]['include'],function(_0x31428c){return{'model':db[_0x31428c[_0x482c('0x1c')]],'as':_0x31428c['as'],'attributes':_0x31428c[_0x482c('0x19')],'include':_0x31428c[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x31428c[_0x482c('0x1a')],function(_0x129a31){return{'model':db[_0x129a31[_0x482c('0x1c')]],'as':_0x129a31['as'],'attributes':_0x129a31['attributes'],'include':_0x129a31['include']?_[_0x482c('0x1b')](_0x129a31['include'],function(_0xe62a02){return{'model':db[_0xe62a02[_0x482c('0x1c')]],'as':_0xe62a02['as'],'attributes':_0xe62a02[_0x482c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29cbaa){logger[_0x482c('0xb')](_0x482c('0x1d'),_0x3e9b22);logger[_0x482c('0xe')]('ShowFreshsalesAccount',_0x3e9b22,JSON[_0x482c('0xf')](_0x29cbaa));_0x2d3800(_0x29cbaa);})['catch'](function(_0x1de7f4){logger['error'](_0x482c('0x1d'),_0x1de7f4['message'],_0x3e9b22);_0x3135a7(_0x24b4df[_0x482c('0x10')](0x1f4,_0x1de7f4[_0x482c('0x12')]));});});}; \ No newline at end of file +var _0x5496=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','FreshsalesAccount','find','ShowFreshsalesAccount','lodash'];(function(_0xba7444,_0x432283){var _0x414752=function(_0x239b86){while(--_0x239b86){_0xba7444['push'](_0xba7444['shift']());}};_0x414752(++_0x432283);}(_0x5496,0x175));var _0x6549=function(_0x9824e4,_0x2e2557){_0x9824e4=_0x9824e4-0x0;var _0x1dec81=_0x5496[_0x9824e4];return _0x1dec81;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});}exports[_0x6549('0x15')]=function(_0x53b12b){var _0x5d61a0=this;return new Promise(function(_0x26a212,_0x48f037){return db['FreshsalesAccount'][_0x6549('0x16')]({'raw':_0x53b12b[_0x6549('0x17')]?_0x53b12b[_0x6549('0x17')][_0x6549('0x18')]===undefined?!![]:![]:!![],'where':_0x53b12b[_0x6549('0x17')]?_0x53b12b['options'][_0x6549('0x19')]||null:null,'attributes':_0x53b12b['options']?_0x53b12b[_0x6549('0x17')][_0x6549('0x1a')]||null:null,'limit':_0x53b12b[_0x6549('0x17')]?_0x53b12b[_0x6549('0x17')][_0x6549('0x1b')]||null:null,'include':_0x53b12b[_0x6549('0x17')]?_0x53b12b[_0x6549('0x17')][_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x53b12b[_0x6549('0x17')][_0x6549('0x1c')],function(_0x1fbfa4){return{'model':db[_0x1fbfa4[_0x6549('0x1e')]],'as':_0x1fbfa4['as'],'attributes':_0x1fbfa4['attributes'],'include':_0x1fbfa4[_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x1fbfa4['include'],function(_0x126967){return{'model':db[_0x126967[_0x6549('0x1e')]],'as':_0x126967['as'],'attributes':_0x126967[_0x6549('0x1a')],'include':_0x126967['include']?_[_0x6549('0x1d')](_0x126967[_0x6549('0x1c')],function(_0x14de1f){return{'model':db[_0x14de1f[_0x6549('0x1e')]],'as':_0x14de1f['as'],'attributes':_0x14de1f[_0x6549('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6549('0xa')](function(_0x2f58f7){logger[_0x6549('0xb')]('GetFreshsalesAccount',_0x53b12b);logger[_0x6549('0xe')](_0x6549('0x15'),_0x53b12b,JSON[_0x6549('0xf')](_0x2f58f7));_0x26a212(_0x2f58f7);})['catch'](function(_0x3f1502){logger['error']('GetFreshsalesAccount',_0x3f1502['message'],_0x53b12b);_0x48f037(_0x5d61a0[_0x6549('0x10')](0x1f4,_0x3f1502[_0x6549('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x30aac6){var _0x194ae7=this;return new Promise(function(_0x2e481f,_0x102a21){return db[_0x6549('0x1f')][_0x6549('0x20')]({'raw':_0x30aac6[_0x6549('0x17')]?_0x30aac6['options'][_0x6549('0x18')]===undefined?!![]:![]:!![],'where':_0x30aac6[_0x6549('0x17')]?_0x30aac6[_0x6549('0x17')][_0x6549('0x19')]||null:null,'attributes':_0x30aac6[_0x6549('0x17')]?_0x30aac6[_0x6549('0x17')]['attributes']||null:null,'include':_0x30aac6[_0x6549('0x17')]?_0x30aac6['options'][_0x6549('0x1c')]?_['map'](_0x30aac6[_0x6549('0x17')][_0x6549('0x1c')],function(_0x3d9e9e){return{'model':db[_0x3d9e9e['model']],'as':_0x3d9e9e['as'],'attributes':_0x3d9e9e[_0x6549('0x1a')],'include':_0x3d9e9e[_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x3d9e9e[_0x6549('0x1c')],function(_0x5b8624){return{'model':db[_0x5b8624['model']],'as':_0x5b8624['as'],'attributes':_0x5b8624['attributes'],'include':_0x5b8624[_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x5b8624['include'],function(_0x43220f){return{'model':db[_0x43220f[_0x6549('0x1e')]],'as':_0x43220f['as'],'attributes':_0x43220f[_0x6549('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6549('0xa')](function(_0x3741f5){logger['info']('ShowFreshsalesAccount',_0x30aac6);logger[_0x6549('0xe')](_0x6549('0x21'),_0x30aac6,JSON[_0x6549('0xf')](_0x3741f5));_0x2e481f(_0x3741f5);})[_0x6549('0x14')](function(_0xa96598){logger[_0x6549('0x10')](_0x6549('0x21'),_0xa96598[_0x6549('0x12')],_0x30aac6);_0x102a21(_0x194ae7[_0x6549('0x10')](0x1f4,_0xa96598[_0x6549('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 67256bd..37e00ea 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 _0x6481=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','put','delete','destroy','exports'];(function(_0x4e7696,_0x2cbc82){var _0x3a52c4=function(_0x3a10a2){while(--_0x3a10a2){_0x4e7696['push'](_0x4e7696['shift']());}};_0x3a52c4(++_0x2cbc82);}(_0x6481,0x1c2));var _0x1648=function(_0x276824,_0x3f49d2){_0x276824=_0x276824-0x0;var _0x3866d5=_0x6481[_0x276824];return _0x3866d5;};'use strict';var multer=require(_0x1648('0x0'));var util=require(_0x1648('0x1'));var path=require(_0x1648('0x2'));var timeout=require('connect-timeout');var express=require(_0x1648('0x3'));var router=express[_0x1648('0x4')]();var fs_extra=require(_0x1648('0x5'));var auth=require(_0x1648('0x6'));var interaction=require(_0x1648('0x7'));var config=require(_0x1648('0x8'));var controller=require(_0x1648('0x9'));router[_0x1648('0xa')]('/',auth[_0x1648('0xb')](),controller[_0x1648('0xc')]);router[_0x1648('0xa')](_0x1648('0xd'),auth[_0x1648('0xb')](),controller[_0x1648('0xe')]);router[_0x1648('0xa')](_0x1648('0xf'),auth[_0x1648('0xb')](),controller[_0x1648('0x10')]);router[_0x1648('0xa')](_0x1648('0x11'),auth['isAuthenticated'](),controller[_0x1648('0x12')]);router[_0x1648('0xa')](_0x1648('0x13'),auth[_0x1648('0xb')](),controller[_0x1648('0x14')]);router['post']('/',auth[_0x1648('0xb')](),controller['create']);router[_0x1648('0x15')](_0x1648('0xd'),auth[_0x1648('0xb')](),controller['update']);router[_0x1648('0x16')](_0x1648('0xd'),auth[_0x1648('0xb')](),controller[_0x1648('0x17')]);module[_0x1648('0x18')]=router; \ No newline at end of file +var _0xbffa=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3d0473,_0x2fb9c9){var _0x4fbfcb=function(_0xf4e4ba){while(--_0xf4e4ba){_0x3d0473['push'](_0x3d0473['shift']());}};_0x4fbfcb(++_0x2fb9c9);}(_0xbffa,0xdb));var _0xabff=function(_0xade3fb,_0x3894d3){_0xade3fb=_0xade3fb-0x0;var _0x258e93=_0xbffa[_0xade3fb];return _0x258e93;};'use strict';var multer=require(_0xabff('0x0'));var util=require(_0xabff('0x1'));var path=require(_0xabff('0x2'));var timeout=require(_0xabff('0x3'));var express=require(_0xabff('0x4'));var router=express[_0xabff('0x5')]();var fs_extra=require(_0xabff('0x6'));var auth=require(_0xabff('0x7'));var interaction=require(_0xabff('0x8'));var config=require(_0xabff('0x9'));var controller=require(_0xabff('0xa'));router['get']('/',auth[_0xabff('0xb')](),controller[_0xabff('0xc')]);router[_0xabff('0xd')](_0xabff('0xe'),auth['isAuthenticated'](),controller[_0xabff('0xf')]);router[_0xabff('0xd')](_0xabff('0x10'),auth[_0xabff('0xb')](),controller[_0xabff('0x11')]);router[_0xabff('0xd')](_0xabff('0x12'),auth['isAuthenticated'](),controller[_0xabff('0x13')]);router['get'](_0xabff('0x14'),auth['isAuthenticated'](),controller[_0xabff('0x15')]);router[_0xabff('0x16')]('/',auth[_0xabff('0xb')](),controller[_0xabff('0x17')]);router[_0xabff('0x18')](_0xabff('0xe'),auth[_0xabff('0xb')](),controller[_0xabff('0x19')]);router['delete'](_0xabff('0xe'),auth[_0xabff('0xb')](),controller[_0xabff('0x1a')]);module[_0xabff('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index dd328ab..c17a650 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 _0x7f98=['sequelize','exports','STRING'];(function(_0x305291,_0x1a4846){var _0x2e1eb8=function(_0x21af41){while(--_0x21af41){_0x305291['push'](_0x305291['shift']());}};_0x2e1eb8(++_0x1a4846);}(_0x7f98,0x69));var _0x87f9=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x7f98[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0x87f9('0x0'));module[_0x87f9('0x1')]={'name':{'type':Sequelize[_0x87f9('0x2')]},'description':{'type':Sequelize[_0x87f9('0x2')]}}; \ No newline at end of file +var _0xc6cb=['STRING'];(function(_0x470ff2,_0x553a47){var _0x766eb6=function(_0xa5a4fc){while(--_0xa5a4fc){_0x470ff2['push'](_0x470ff2['shift']());}};_0x766eb6(++_0x553a47);}(_0xc6cb,0x1e7));var _0xbc6c=function(_0x28fd96,_0x230c33){_0x28fd96=_0x28fd96-0x0;var _0x31b940=_0xc6cb[_0x28fd96];return _0x31b940;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbc6c('0x0')]},'description':{'type':Sequelize[_0xbc6c('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index d53e7bb..e08b813 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 _0x8522=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getSubjects','findOne','keys','FreshsalesField','order','hasOwnProperty','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','filters','intersection','model','query','attributes','fields','length','nolimit'];(function(_0x46b090,_0x10c40a){var _0x12abc8=function(_0x178f99){while(--_0x178f99){_0x46b090['push'](_0x46b090['shift']());}};_0x12abc8(++_0x10c40a);}(_0x8522,0x158));var _0x2852=function(_0x5b8310,_0x77ea6f){_0x5b8310=_0x5b8310-0x0;var _0xd3ebc1=_0x8522[_0x5b8310];return _0xd3ebc1;};'use strict';var emlformat=require(_0x2852('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2852('0x1'));var jsonpatch=require(_0x2852('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2852('0x3'));var util=require(_0x2852('0x4'));var path=require(_0x2852('0x5'));var sox=require(_0x2852('0x6'));var csv=require('to-csv');var ejs=require(_0x2852('0x7'));var fs=require('fs');var fs_extra=require(_0x2852('0x8'));var _=require(_0x2852('0x9'));var squel=require(_0x2852('0xa'));var crypto=require(_0x2852('0xb'));var jsforce=require(_0x2852('0xc'));var deskjs=require(_0x2852('0xd'));var toCsv=require(_0x2852('0xe'));var querystring=require(_0x2852('0xf'));var Papa=require(_0x2852('0x10'));var Redis=require('ioredis');var authService=require(_0x2852('0x11'));var qs=require(_0x2852('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2852('0x13'));var logger=require(_0x2852('0x14'))(_0x2852('0x15'));var utils=require(_0x2852('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2852('0x17'))['db'];function respondWithStatusCode(_0x320aba,_0x360b89){_0x360b89=_0x360b89||0xcc;return function(_0x6248f5){if(_0x6248f5){return _0x320aba[_0x2852('0x18')](_0x360b89);}return _0x320aba[_0x2852('0x19')](_0x360b89)[_0x2852('0x1a')]();};}function respondWithResult(_0x72953a,_0x3e01f8){_0x3e01f8=_0x3e01f8||0xc8;return function(_0x47ec03){if(_0x47ec03){return _0x72953a[_0x2852('0x19')](_0x3e01f8)[_0x2852('0x1b')](_0x47ec03);}};}function respondWithFilteredResult(_0xfba1ff,_0x3d7b1d){return function(_0xa99014){if(_0xa99014){var _0x22ad63=typeof _0x3d7b1d[_0x2852('0x1c')]===_0x2852('0x1d')&&typeof _0x3d7b1d[_0x2852('0x1e')]==='undefined';var _0x32099d=_0xa99014[_0x2852('0x1f')];var _0x47d79d=_0x22ad63?0x0:_0x3d7b1d['offset'];var _0x2962f6=_0x22ad63?_0xa99014['count']:_0x3d7b1d['offset']+_0x3d7b1d[_0x2852('0x1e')];var _0x2e2362;if(_0x2962f6>=_0x32099d){_0x2962f6=_0x32099d;_0x2e2362=0xc8;}else{_0x2e2362=0xce;}_0xfba1ff[_0x2852('0x19')](_0x2e2362);return _0xfba1ff[_0x2852('0x20')]('Content-Range',_0x47d79d+'-'+_0x2962f6+'/'+_0x32099d)[_0x2852('0x1b')](_0xa99014);}return null;};}function patchUpdates(_0x3763e9){return function(_0x32ddd9){try{jsonpatch[_0x2852('0x21')](_0x32ddd9,_0x3763e9,!![]);}catch(_0x4c3085){return BPromise['reject'](_0x4c3085);}return _0x32ddd9[_0x2852('0x22')]();};}function saveUpdates(_0x200ee9,_0x37b96c){return function(_0x1da776){if(_0x1da776){return _0x1da776[_0x2852('0x23')](_0x200ee9)['then'](function(_0x881500){return _0x881500;});}return null;};}function removeEntity(_0x1184e1,_0x44f15a){return function(_0x3e9172){if(_0x3e9172){return _0x3e9172[_0x2852('0x24')]()[_0x2852('0x25')](function(){_0x1184e1[_0x2852('0x19')](0xcc)[_0x2852('0x1a')]();});}};}function handleEntityNotFound(_0x5a4dfd,_0x3edad6){return function(_0x3fd99f){if(!_0x3fd99f){_0x5a4dfd[_0x2852('0x18')](0x194);}return _0x3fd99f;};}function handleError(_0x5532be,_0x23a412){_0x23a412=_0x23a412||0x1f4;return function(_0x1fff15){logger[_0x2852('0x26')](_0x1fff15[_0x2852('0x27')]);if(_0x1fff15['name']){delete _0x1fff15[_0x2852('0x28')];}_0x5532be[_0x2852('0x19')](_0x23a412)[_0x2852('0x29')](_0x1fff15);};}exports[_0x2852('0x2a')]=function(_0x4f73d2,_0x438f31){var _0x1a46ac={},_0x41a89c={},_0x5ab48d={'count':0x0,'rows':[]};var _0x6a42af=_[_0x2852('0x2b')](db[_0x2852('0x2c')][_0x2852('0x2d')],function(_0x5b9b70){return{'name':_0x5b9b70[_0x2852('0x2e')],'type':_0x5b9b70['type'][_0x2852('0x2f')]};});_0x41a89c['model']=_['map'](_0x6a42af,_0x2852('0x28'));_0x41a89c['query']=_['keys'](_0x4f73d2['query']);_0x41a89c[_0x2852('0x30')]=_[_0x2852('0x31')](_0x41a89c[_0x2852('0x32')],_0x41a89c[_0x2852('0x33')]);_0x1a46ac[_0x2852('0x34')]=_[_0x2852('0x31')](_0x41a89c[_0x2852('0x32')],qs[_0x2852('0x35')](_0x4f73d2['query'][_0x2852('0x35')]));_0x1a46ac[_0x2852('0x34')]=_0x1a46ac['attributes'][_0x2852('0x36')]?_0x1a46ac[_0x2852('0x34')]:_0x41a89c[_0x2852('0x32')];if(!_0x4f73d2[_0x2852('0x33')]['hasOwnProperty'](_0x2852('0x37'))){_0x1a46ac[_0x2852('0x1e')]=qs[_0x2852('0x1e')](_0x4f73d2[_0x2852('0x33')]['limit']);_0x1a46ac['offset']=qs[_0x2852('0x1c')](_0x4f73d2[_0x2852('0x33')]['offset']);}_0x1a46ac['order']=qs['sort'](_0x4f73d2[_0x2852('0x33')][_0x2852('0x38')]);_0x1a46ac[_0x2852('0x39')]=qs['filters'](_[_0x2852('0x3a')](_0x4f73d2[_0x2852('0x33')],_0x41a89c[_0x2852('0x30')]),_0x6a42af);if(_0x4f73d2[_0x2852('0x33')][_0x2852('0x3b')]){_0x1a46ac[_0x2852('0x39')]=_[_0x2852('0x3c')](_0x1a46ac[_0x2852('0x39')],{'$or':_['map'](_0x6a42af,function(_0x3df258){if(_0x3df258['type']!=='VIRTUAL'){var _0x1adff7={};_0x1adff7[_0x3df258[_0x2852('0x28')]]={'$like':'%'+_0x4f73d2['query']['filter']+'%'};return _0x1adff7;}})});}_0x1a46ac=_[_0x2852('0x3c')]({},_0x1a46ac,_0x4f73d2[_0x2852('0x3d')]);var _0xa6c15e={'where':_0x1a46ac[_0x2852('0x39')]};return db[_0x2852('0x2c')][_0x2852('0x1f')](_0xa6c15e)['then'](function(_0xb2d3bf){_0x5ab48d[_0x2852('0x1f')]=_0xb2d3bf;if(_0x4f73d2[_0x2852('0x33')][_0x2852('0x3e')]){_0x1a46ac[_0x2852('0x3f')]=[{'all':!![]}];}return db[_0x2852('0x2c')][_0x2852('0x40')](_0x1a46ac);})['then'](function(_0x1cfd96){_0x5ab48d[_0x2852('0x41')]=_0x1cfd96;return _0x5ab48d;})[_0x2852('0x25')](respondWithFilteredResult(_0x438f31,_0x1a46ac))[_0x2852('0x42')](handleError(_0x438f31,null));};exports[_0x2852('0x43')]=function(_0x3a29c1,_0x46d4b9){var _0x3bce3={'raw':![],'where':{'id':_0x3a29c1[_0x2852('0x44')]['id']}},_0x350a1c={};_0x350a1c[_0x2852('0x32')]=_['keys'](db[_0x2852('0x2c')][_0x2852('0x2d')]);_0x350a1c['query']=_['keys'](_0x3a29c1[_0x2852('0x33')]);_0x350a1c[_0x2852('0x30')]=_[_0x2852('0x31')](_0x350a1c['model'],_0x350a1c[_0x2852('0x33')]);_0x3bce3[_0x2852('0x34')]=_['intersection'](_0x350a1c[_0x2852('0x32')],qs[_0x2852('0x35')](_0x3a29c1[_0x2852('0x33')]['fields']));_0x3bce3[_0x2852('0x34')]=_0x3bce3[_0x2852('0x34')][_0x2852('0x36')]?_0x3bce3[_0x2852('0x34')]:_0x350a1c[_0x2852('0x32')];if(_0x3a29c1[_0x2852('0x33')]['includeAll']){_0x3bce3[_0x2852('0x3f')]=[{'all':!![]}];}_0x3bce3=_[_0x2852('0x3c')]({},_0x3bce3,_0x3a29c1[_0x2852('0x3d')]);return db[_0x2852('0x2c')][_0x2852('0x45')](_0x3bce3)[_0x2852('0x25')](handleEntityNotFound(_0x46d4b9,null))['then'](respondWithResult(_0x46d4b9,null))[_0x2852('0x42')](handleError(_0x46d4b9,null));};exports[_0x2852('0x46')]=function(_0x47d5de,_0x16a94d){return db['FreshsalesConfiguration'][_0x2852('0x46')](_0x47d5de['body'],{})[_0x2852('0x25')](respondWithResult(_0x16a94d,0xc9))['catch'](handleError(_0x16a94d,null));};exports[_0x2852('0x23')]=function(_0xa18b9e,_0x5aee15){if(_0xa18b9e[_0x2852('0x47')]['id']){delete _0xa18b9e[_0x2852('0x47')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0xa18b9e['params']['id']}})[_0x2852('0x25')](handleEntityNotFound(_0x5aee15,null))[_0x2852('0x25')](saveUpdates(_0xa18b9e[_0x2852('0x47')],null))[_0x2852('0x25')](respondWithResult(_0x5aee15,null))[_0x2852('0x42')](handleError(_0x5aee15,null));};exports['destroy']=function(_0x5e9f2f,_0x2445db){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x5e9f2f[_0x2852('0x44')]['id']}})['then'](handleEntityNotFound(_0x2445db,null))[_0x2852('0x25')](removeEntity(_0x2445db,null))[_0x2852('0x42')](handleError(_0x2445db,null));};exports[_0x2852('0x48')]=function(_0x2906d6,_0x3f33f2,_0x198b18){var _0x12e97a={};var _0x55c7b8={};var _0x354e56;var _0x2983c5;return db[_0x2852('0x2c')][_0x2852('0x49')]({'where':{'id':_0x2906d6[_0x2852('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f33f2,null))[_0x2852('0x25')](function(_0x43a4ff){if(_0x43a4ff){_0x354e56=_0x43a4ff;_0x55c7b8['model']=_[_0x2852('0x4a')](db[_0x2852('0x4b')][_0x2852('0x2d')]);_0x55c7b8['query']=_[_0x2852('0x4a')](_0x2906d6[_0x2852('0x33')]);_0x55c7b8['filters']=_[_0x2852('0x31')](_0x55c7b8[_0x2852('0x32')],_0x55c7b8[_0x2852('0x33')]);_0x12e97a[_0x2852('0x34')]=_['intersection'](_0x55c7b8[_0x2852('0x32')],qs[_0x2852('0x35')](_0x2906d6[_0x2852('0x33')][_0x2852('0x35')]));_0x12e97a[_0x2852('0x34')]=_0x12e97a[_0x2852('0x34')][_0x2852('0x36')]?_0x12e97a[_0x2852('0x34')]:_0x55c7b8[_0x2852('0x32')];_0x12e97a[_0x2852('0x4c')]=qs[_0x2852('0x38')](_0x2906d6[_0x2852('0x33')]['sort']);_0x12e97a[_0x2852('0x39')]=qs[_0x2852('0x30')](_[_0x2852('0x3a')](_0x2906d6[_0x2852('0x33')],_0x55c7b8[_0x2852('0x30')]));if(_0x2906d6[_0x2852('0x33')][_0x2852('0x3b')]){_0x12e97a[_0x2852('0x39')]=_[_0x2852('0x3c')](_0x12e97a[_0x2852('0x39')],{'$or':_[_0x2852('0x2b')](_0x12e97a['attributes'],function(_0x2ffbb8){var _0x1e4383={};_0x1e4383[_0x2ffbb8]={'$like':'%'+_0x2906d6[_0x2852('0x33')][_0x2852('0x3b')]+'%'};return _0x1e4383;})});}_0x12e97a=_[_0x2852('0x3c')]({},_0x12e97a,_0x2906d6[_0x2852('0x3d')]);return _0x354e56[_0x2852('0x48')](_0x12e97a);}})[_0x2852('0x25')](function(_0xc856fa){if(_0xc856fa){_0x2983c5=_0xc856fa[_0x2852('0x36')];if(!_0x2906d6[_0x2852('0x33')][_0x2852('0x4d')](_0x2852('0x37'))){_0x12e97a[_0x2852('0x1e')]=qs['limit'](_0x2906d6['query'][_0x2852('0x1e')]);_0x12e97a[_0x2852('0x1c')]=qs[_0x2852('0x1c')](_0x2906d6[_0x2852('0x33')]['offset']);}return _0x354e56['getSubjects'](_0x12e97a);}})['then'](function(_0x57f7fa){if(_0x57f7fa){return _0x57f7fa?{'count':_0x2983c5,'rows':_0x57f7fa}:null;}})[_0x2852('0x25')](respondWithResult(_0x3f33f2,null))[_0x2852('0x42')](handleError(_0x3f33f2,null));};exports[_0x2852('0x4e')]=function(_0x526092,_0x123e54,_0xdcc972){var _0x5b0195={};var _0x4cd69f={};var _0x4787ac;var _0x1c3a20;return db[_0x2852('0x2c')][_0x2852('0x49')]({'where':{'id':_0x526092['params']['id']}})[_0x2852('0x25')](handleEntityNotFound(_0x123e54,null))[_0x2852('0x25')](function(_0x59058f){if(_0x59058f){_0x4787ac=_0x59058f;_0x4cd69f[_0x2852('0x32')]=_['keys'](db[_0x2852('0x4b')][_0x2852('0x2d')]);_0x4cd69f[_0x2852('0x33')]=_[_0x2852('0x4a')](_0x526092[_0x2852('0x33')]);_0x4cd69f[_0x2852('0x30')]=_[_0x2852('0x31')](_0x4cd69f[_0x2852('0x32')],_0x4cd69f[_0x2852('0x33')]);_0x5b0195[_0x2852('0x34')]=_[_0x2852('0x31')](_0x4cd69f[_0x2852('0x32')],qs[_0x2852('0x35')](_0x526092['query']['fields']));_0x5b0195['attributes']=_0x5b0195['attributes']['length']?_0x5b0195[_0x2852('0x34')]:_0x4cd69f[_0x2852('0x32')];_0x5b0195['order']=qs[_0x2852('0x38')](_0x526092[_0x2852('0x33')][_0x2852('0x38')]);_0x5b0195[_0x2852('0x39')]=qs[_0x2852('0x30')](_[_0x2852('0x3a')](_0x526092['query'],_0x4cd69f[_0x2852('0x30')]));if(_0x526092['query'][_0x2852('0x3b')]){_0x5b0195[_0x2852('0x39')]=_[_0x2852('0x3c')](_0x5b0195[_0x2852('0x39')],{'$or':_[_0x2852('0x2b')](_0x5b0195[_0x2852('0x34')],function(_0x103e29){var _0x3c3eaf={};_0x3c3eaf[_0x103e29]={'$like':'%'+_0x526092[_0x2852('0x33')][_0x2852('0x3b')]+'%'};return _0x3c3eaf;})});}_0x5b0195=_[_0x2852('0x3c')]({},_0x5b0195,_0x526092[_0x2852('0x3d')]);return _0x4787ac[_0x2852('0x4e')](_0x5b0195);}})[_0x2852('0x25')](function(_0x2be8a3){if(_0x2be8a3){_0x1c3a20=_0x2be8a3[_0x2852('0x36')];if(!_0x526092['query'][_0x2852('0x4d')]('nolimit')){_0x5b0195[_0x2852('0x1e')]=qs['limit'](_0x526092['query'][_0x2852('0x1e')]);_0x5b0195['offset']=qs['offset'](_0x526092[_0x2852('0x33')][_0x2852('0x1c')]);}return _0x4787ac[_0x2852('0x4e')](_0x5b0195);}})[_0x2852('0x25')](function(_0x241a1d){if(_0x241a1d){return _0x241a1d?{'count':_0x1c3a20,'rows':_0x241a1d}:null;}})[_0x2852('0x25')](respondWithResult(_0x123e54,null))[_0x2852('0x42')](handleError(_0x123e54,null));};exports['getFields']=function(_0x8f19fd,_0x418d58,_0x176b40){var _0xbac117={};var _0x463b93={};var _0xcaa0bd;var _0xd2a488;return db[_0x2852('0x2c')][_0x2852('0x49')]({'where':{'id':_0x8f19fd[_0x2852('0x44')]['id']}})[_0x2852('0x25')](handleEntityNotFound(_0x418d58,null))['then'](function(_0x346482){if(_0x346482){_0xcaa0bd=_0x346482;_0x463b93['model']=_['keys'](db[_0x2852('0x4b')][_0x2852('0x2d')]);_0x463b93[_0x2852('0x33')]=_[_0x2852('0x4a')](_0x8f19fd['query']);_0x463b93[_0x2852('0x30')]=_[_0x2852('0x31')](_0x463b93['model'],_0x463b93[_0x2852('0x33')]);_0xbac117[_0x2852('0x34')]=_[_0x2852('0x31')](_0x463b93[_0x2852('0x32')],qs[_0x2852('0x35')](_0x8f19fd[_0x2852('0x33')][_0x2852('0x35')]));_0xbac117['attributes']=_0xbac117[_0x2852('0x34')]['length']?_0xbac117[_0x2852('0x34')]:_0x463b93['model'];_0xbac117[_0x2852('0x4c')]=qs[_0x2852('0x38')](_0x8f19fd[_0x2852('0x33')][_0x2852('0x38')]);_0xbac117[_0x2852('0x39')]=qs['filters'](_[_0x2852('0x3a')](_0x8f19fd['query'],_0x463b93[_0x2852('0x30')]));if(_0x8f19fd[_0x2852('0x33')]['filter']){_0xbac117[_0x2852('0x39')]=_[_0x2852('0x3c')](_0xbac117[_0x2852('0x39')],{'$or':_[_0x2852('0x2b')](_0xbac117[_0x2852('0x34')],function(_0x47b0ca){var _0x2c113c={};_0x2c113c[_0x47b0ca]={'$like':'%'+_0x8f19fd[_0x2852('0x33')][_0x2852('0x3b')]+'%'};return _0x2c113c;})});}_0xbac117=_[_0x2852('0x3c')]({},_0xbac117,_0x8f19fd['options']);return _0xcaa0bd['getFields'](_0xbac117);}})[_0x2852('0x25')](function(_0x25a6eb){if(_0x25a6eb){_0xd2a488=_0x25a6eb[_0x2852('0x36')];if(!_0x8f19fd[_0x2852('0x33')][_0x2852('0x4d')]('nolimit')){_0xbac117[_0x2852('0x1e')]=qs[_0x2852('0x1e')](_0x8f19fd['query'][_0x2852('0x1e')]);_0xbac117[_0x2852('0x1c')]=qs['offset'](_0x8f19fd[_0x2852('0x33')][_0x2852('0x1c')]);}return _0xcaa0bd[_0x2852('0x4f')](_0xbac117);}})[_0x2852('0x25')](function(_0x3d032f){if(_0x3d032f){return _0x3d032f?{'count':_0xd2a488,'rows':_0x3d032f}:null;}})[_0x2852('0x25')](respondWithResult(_0x418d58,null))[_0x2852('0x42')](handleError(_0x418d58,null));}; \ No newline at end of file +var _0x6d13=['bluebird','mustache','util','path','sox','lodash','crypto','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','offset','limit','undefined','count','Content-Range','json','save','update','then','error','stack','name','map','FreshsalesConfiguration','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','rawAttributes','include','create','body','destroy','getSubjects','FreshsalesField','filters','getDescriptions','findOne','pick','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x317dd1,_0x32a0d8){var _0xe62cc5=function(_0x4b8207){while(--_0x4b8207){_0x317dd1['push'](_0x317dd1['shift']());}};_0xe62cc5(++_0x32a0d8);}(_0x6d13,0xe4));var _0x36d1=function(_0x4b3d13,_0x1993d5){_0x4b3d13=_0x4b3d13-0x0;var _0xf64dd8=_0x6d13[_0x4b3d13];return _0xf64dd8;};'use strict';var emlformat=require(_0x36d1('0x0'));var rimraf=require(_0x36d1('0x1'));var zipdir=require(_0x36d1('0x2'));var jsonpatch=require(_0x36d1('0x3'));var rp=require(_0x36d1('0x4'));var moment=require(_0x36d1('0x5'));var BPromise=require(_0x36d1('0x6'));var Mustache=require(_0x36d1('0x7'));var util=require(_0x36d1('0x8'));var path=require(_0x36d1('0x9'));var sox=require(_0x36d1('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x36d1('0xb'));var squel=require('squel');var crypto=require(_0x36d1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x36d1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x36d1('0xe'));var Papa=require(_0x36d1('0xf'));var Redis=require(_0x36d1('0x10'));var authService=require(_0x36d1('0x11'));var qs=require(_0x36d1('0x12'));var as=require(_0x36d1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x36d1('0x14'));var utils=require(_0x36d1('0x15'));var config=require(_0x36d1('0x16'));var licenseUtil=require(_0x36d1('0x17'));var db=require(_0x36d1('0x18'))['db'];function respondWithStatusCode(_0x26dc21,_0x804e8f){_0x804e8f=_0x804e8f||0xcc;return function(_0x5915f9){if(_0x5915f9){return _0x26dc21[_0x36d1('0x19')](_0x804e8f);}return _0x26dc21[_0x36d1('0x1a')](_0x804e8f)[_0x36d1('0x1b')]();};}function respondWithResult(_0x68fd5d,_0x575b65){_0x575b65=_0x575b65||0xc8;return function(_0x3f6035){if(_0x3f6035){return _0x68fd5d[_0x36d1('0x1a')](_0x575b65)['json'](_0x3f6035);}};}function respondWithFilteredResult(_0x252498,_0x2722a0){return function(_0x3df5f5){if(_0x3df5f5){var _0x4238cc=typeof _0x2722a0[_0x36d1('0x1c')]==='undefined'&&typeof _0x2722a0[_0x36d1('0x1d')]===_0x36d1('0x1e');var _0x5e540f=_0x3df5f5[_0x36d1('0x1f')];var _0x19ed9f=_0x4238cc?0x0:_0x2722a0[_0x36d1('0x1c')];var _0xb8fb99=_0x4238cc?_0x3df5f5['count']:_0x2722a0[_0x36d1('0x1c')]+_0x2722a0[_0x36d1('0x1d')];var _0x4f0e76;if(_0xb8fb99>=_0x5e540f){_0xb8fb99=_0x5e540f;_0x4f0e76=0xc8;}else{_0x4f0e76=0xce;}_0x252498[_0x36d1('0x1a')](_0x4f0e76);return _0x252498['set'](_0x36d1('0x20'),_0x19ed9f+'-'+_0xb8fb99+'/'+_0x5e540f)[_0x36d1('0x21')](_0x3df5f5);}return null;};}function patchUpdates(_0x36093b){return function(_0x4c4c5c){try{jsonpatch['apply'](_0x4c4c5c,_0x36093b,!![]);}catch(_0x1311d1){return BPromise['reject'](_0x1311d1);}return _0x4c4c5c[_0x36d1('0x22')]();};}function saveUpdates(_0x123e79,_0x48fc8f){return function(_0x39feed){if(_0x39feed){return _0x39feed[_0x36d1('0x23')](_0x123e79)[_0x36d1('0x24')](function(_0x292c1f){return _0x292c1f;});}return null;};}function removeEntity(_0x26eba0,_0x451e1b){return function(_0x3507ba){if(_0x3507ba){return _0x3507ba['destroy']()[_0x36d1('0x24')](function(){_0x26eba0[_0x36d1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7e44e3,_0x118a96){return function(_0x4526d5){if(!_0x4526d5){_0x7e44e3[_0x36d1('0x19')](0x194);}return _0x4526d5;};}function handleError(_0x1829e3,_0x6bb275){_0x6bb275=_0x6bb275||0x1f4;return function(_0x20e9f1){logger[_0x36d1('0x25')](_0x20e9f1[_0x36d1('0x26')]);if(_0x20e9f1[_0x36d1('0x27')]){delete _0x20e9f1[_0x36d1('0x27')];}_0x1829e3[_0x36d1('0x1a')](_0x6bb275)['send'](_0x20e9f1);};}exports['index']=function(_0x3121a9,_0x37f066){var _0x167d6f={},_0x3735ee={},_0x59955e={'count':0x0,'rows':[]};var _0xd12e83=_[_0x36d1('0x28')](db[_0x36d1('0x29')]['rawAttributes'],function(_0x37ad8a){return{'name':_0x37ad8a[_0x36d1('0x2a')],'type':_0x37ad8a[_0x36d1('0x2b')][_0x36d1('0x2c')]};});_0x3735ee[_0x36d1('0x2d')]=_[_0x36d1('0x28')](_0xd12e83,_0x36d1('0x27'));_0x3735ee[_0x36d1('0x2e')]=_[_0x36d1('0x2f')](_0x3121a9['query']);_0x3735ee['filters']=_[_0x36d1('0x30')](_0x3735ee['model'],_0x3735ee[_0x36d1('0x2e')]);_0x167d6f[_0x36d1('0x31')]=_['intersection'](_0x3735ee['model'],qs[_0x36d1('0x32')](_0x3121a9[_0x36d1('0x2e')]['fields']));_0x167d6f[_0x36d1('0x31')]=_0x167d6f[_0x36d1('0x31')][_0x36d1('0x33')]?_0x167d6f['attributes']:_0x3735ee['model'];if(!_0x3121a9['query'][_0x36d1('0x34')](_0x36d1('0x35'))){_0x167d6f[_0x36d1('0x1d')]=qs[_0x36d1('0x1d')](_0x3121a9[_0x36d1('0x2e')][_0x36d1('0x1d')]);_0x167d6f[_0x36d1('0x1c')]=qs['offset'](_0x3121a9[_0x36d1('0x2e')][_0x36d1('0x1c')]);}_0x167d6f[_0x36d1('0x36')]=qs[_0x36d1('0x37')](_0x3121a9[_0x36d1('0x2e')]['sort']);_0x167d6f[_0x36d1('0x38')]=qs['filters'](_['pick'](_0x3121a9[_0x36d1('0x2e')],_0x3735ee['filters']),_0xd12e83);if(_0x3121a9[_0x36d1('0x2e')]['filter']){_0x167d6f[_0x36d1('0x38')]=_[_0x36d1('0x39')](_0x167d6f[_0x36d1('0x38')],{'$or':_[_0x36d1('0x28')](_0xd12e83,function(_0x458f50){if(_0x458f50[_0x36d1('0x2b')]!==_0x36d1('0x3a')){var _0x1049b9={};_0x1049b9[_0x458f50['name']]={'$like':'%'+_0x3121a9[_0x36d1('0x2e')][_0x36d1('0x3b')]+'%'};return _0x1049b9;}})});}_0x167d6f=_['merge']({},_0x167d6f,_0x3121a9[_0x36d1('0x3c')]);var _0x557bb8={'where':_0x167d6f[_0x36d1('0x38')]};return db['FreshsalesConfiguration'][_0x36d1('0x1f')](_0x557bb8)['then'](function(_0x4e7ba1){_0x59955e[_0x36d1('0x1f')]=_0x4e7ba1;if(_0x3121a9[_0x36d1('0x2e')][_0x36d1('0x3d')]){_0x167d6f['include']=[{'all':!![]}];}return db[_0x36d1('0x29')]['findAll'](_0x167d6f);})[_0x36d1('0x24')](function(_0x81ed24){_0x59955e[_0x36d1('0x3e')]=_0x81ed24;return _0x59955e;})[_0x36d1('0x24')](respondWithFilteredResult(_0x37f066,_0x167d6f))[_0x36d1('0x3f')](handleError(_0x37f066,null));};exports[_0x36d1('0x40')]=function(_0x58d37d,_0x24a12b){var _0x201e6c={'raw':![],'where':{'id':_0x58d37d[_0x36d1('0x41')]['id']}},_0x1c7400={};_0x1c7400[_0x36d1('0x2d')]=_[_0x36d1('0x2f')](db[_0x36d1('0x29')][_0x36d1('0x42')]);_0x1c7400[_0x36d1('0x2e')]=_[_0x36d1('0x2f')](_0x58d37d[_0x36d1('0x2e')]);_0x1c7400['filters']=_[_0x36d1('0x30')](_0x1c7400[_0x36d1('0x2d')],_0x1c7400[_0x36d1('0x2e')]);_0x201e6c[_0x36d1('0x31')]=_['intersection'](_0x1c7400['model'],qs[_0x36d1('0x32')](_0x58d37d[_0x36d1('0x2e')][_0x36d1('0x32')]));_0x201e6c[_0x36d1('0x31')]=_0x201e6c[_0x36d1('0x31')][_0x36d1('0x33')]?_0x201e6c[_0x36d1('0x31')]:_0x1c7400[_0x36d1('0x2d')];if(_0x58d37d[_0x36d1('0x2e')][_0x36d1('0x3d')]){_0x201e6c[_0x36d1('0x43')]=[{'all':!![]}];}_0x201e6c=_['merge']({},_0x201e6c,_0x58d37d['options']);return db[_0x36d1('0x29')]['find'](_0x201e6c)[_0x36d1('0x24')](handleEntityNotFound(_0x24a12b,null))[_0x36d1('0x24')](respondWithResult(_0x24a12b,null))[_0x36d1('0x3f')](handleError(_0x24a12b,null));};exports[_0x36d1('0x44')]=function(_0x483f87,_0x4c841e){return db['FreshsalesConfiguration']['create'](_0x483f87[_0x36d1('0x45')],{})[_0x36d1('0x24')](respondWithResult(_0x4c841e,0xc9))[_0x36d1('0x3f')](handleError(_0x4c841e,null));};exports['update']=function(_0x79e3df,_0x530fed){if(_0x79e3df[_0x36d1('0x45')]['id']){delete _0x79e3df['body']['id'];}return db[_0x36d1('0x29')]['find']({'where':{'id':_0x79e3df[_0x36d1('0x41')]['id']}})['then'](handleEntityNotFound(_0x530fed,null))[_0x36d1('0x24')](saveUpdates(_0x79e3df[_0x36d1('0x45')],null))[_0x36d1('0x24')](respondWithResult(_0x530fed,null))[_0x36d1('0x3f')](handleError(_0x530fed,null));};exports[_0x36d1('0x46')]=function(_0x2acd78,_0x1419d6){return db[_0x36d1('0x29')]['find']({'where':{'id':_0x2acd78[_0x36d1('0x41')]['id']}})[_0x36d1('0x24')](handleEntityNotFound(_0x1419d6,null))[_0x36d1('0x24')](removeEntity(_0x1419d6,null))[_0x36d1('0x3f')](handleError(_0x1419d6,null));};exports[_0x36d1('0x47')]=function(_0x4b5f8b,_0x5ded96,_0x272289){var _0x26b2a7={};var _0x1f5215={};var _0x42c1b8;var _0x12599f;return db[_0x36d1('0x29')]['findOne']({'where':{'id':_0x4b5f8b['params']['id']}})['then'](handleEntityNotFound(_0x5ded96,null))[_0x36d1('0x24')](function(_0x4f3566){if(_0x4f3566){_0x42c1b8=_0x4f3566;_0x1f5215[_0x36d1('0x2d')]=_[_0x36d1('0x2f')](db[_0x36d1('0x48')][_0x36d1('0x42')]);_0x1f5215[_0x36d1('0x2e')]=_['keys'](_0x4b5f8b[_0x36d1('0x2e')]);_0x1f5215[_0x36d1('0x49')]=_[_0x36d1('0x30')](_0x1f5215[_0x36d1('0x2d')],_0x1f5215[_0x36d1('0x2e')]);_0x26b2a7[_0x36d1('0x31')]=_[_0x36d1('0x30')](_0x1f5215[_0x36d1('0x2d')],qs['fields'](_0x4b5f8b[_0x36d1('0x2e')][_0x36d1('0x32')]));_0x26b2a7[_0x36d1('0x31')]=_0x26b2a7['attributes'][_0x36d1('0x33')]?_0x26b2a7[_0x36d1('0x31')]:_0x1f5215[_0x36d1('0x2d')];_0x26b2a7['order']=qs[_0x36d1('0x37')](_0x4b5f8b[_0x36d1('0x2e')][_0x36d1('0x37')]);_0x26b2a7[_0x36d1('0x38')]=qs[_0x36d1('0x49')](_['pick'](_0x4b5f8b[_0x36d1('0x2e')],_0x1f5215[_0x36d1('0x49')]));if(_0x4b5f8b[_0x36d1('0x2e')][_0x36d1('0x3b')]){_0x26b2a7[_0x36d1('0x38')]=_['merge'](_0x26b2a7[_0x36d1('0x38')],{'$or':_[_0x36d1('0x28')](_0x26b2a7[_0x36d1('0x31')],function(_0x326c62){var _0x97f66={};_0x97f66[_0x326c62]={'$like':'%'+_0x4b5f8b[_0x36d1('0x2e')][_0x36d1('0x3b')]+'%'};return _0x97f66;})});}_0x26b2a7=_[_0x36d1('0x39')]({},_0x26b2a7,_0x4b5f8b[_0x36d1('0x3c')]);return _0x42c1b8[_0x36d1('0x47')](_0x26b2a7);}})['then'](function(_0x5bc3a2){if(_0x5bc3a2){_0x12599f=_0x5bc3a2[_0x36d1('0x33')];if(!_0x4b5f8b[_0x36d1('0x2e')][_0x36d1('0x34')](_0x36d1('0x35'))){_0x26b2a7['limit']=qs[_0x36d1('0x1d')](_0x4b5f8b['query'][_0x36d1('0x1d')]);_0x26b2a7[_0x36d1('0x1c')]=qs[_0x36d1('0x1c')](_0x4b5f8b[_0x36d1('0x2e')][_0x36d1('0x1c')]);}return _0x42c1b8[_0x36d1('0x47')](_0x26b2a7);}})[_0x36d1('0x24')](function(_0x32bf4c){if(_0x32bf4c){return _0x32bf4c?{'count':_0x12599f,'rows':_0x32bf4c}:null;}})[_0x36d1('0x24')](respondWithResult(_0x5ded96,null))[_0x36d1('0x3f')](handleError(_0x5ded96,null));};exports[_0x36d1('0x4a')]=function(_0x4068d4,_0x2afd2c,_0x3a359d){var _0x2b3fa4={};var _0x39d52a={};var _0x298132;var _0x4dc1f7;return db[_0x36d1('0x29')][_0x36d1('0x4b')]({'where':{'id':_0x4068d4['params']['id']}})['then'](handleEntityNotFound(_0x2afd2c,null))[_0x36d1('0x24')](function(_0x7d67fe){if(_0x7d67fe){_0x298132=_0x7d67fe;_0x39d52a[_0x36d1('0x2d')]=_[_0x36d1('0x2f')](db['FreshsalesField'][_0x36d1('0x42')]);_0x39d52a[_0x36d1('0x2e')]=_[_0x36d1('0x2f')](_0x4068d4[_0x36d1('0x2e')]);_0x39d52a[_0x36d1('0x49')]=_[_0x36d1('0x30')](_0x39d52a[_0x36d1('0x2d')],_0x39d52a[_0x36d1('0x2e')]);_0x2b3fa4[_0x36d1('0x31')]=_[_0x36d1('0x30')](_0x39d52a[_0x36d1('0x2d')],qs[_0x36d1('0x32')](_0x4068d4[_0x36d1('0x2e')][_0x36d1('0x32')]));_0x2b3fa4[_0x36d1('0x31')]=_0x2b3fa4[_0x36d1('0x31')][_0x36d1('0x33')]?_0x2b3fa4[_0x36d1('0x31')]:_0x39d52a[_0x36d1('0x2d')];_0x2b3fa4[_0x36d1('0x36')]=qs[_0x36d1('0x37')](_0x4068d4[_0x36d1('0x2e')][_0x36d1('0x37')]);_0x2b3fa4['where']=qs['filters'](_[_0x36d1('0x4c')](_0x4068d4[_0x36d1('0x2e')],_0x39d52a[_0x36d1('0x49')]));if(_0x4068d4[_0x36d1('0x2e')][_0x36d1('0x3b')]){_0x2b3fa4[_0x36d1('0x38')]=_[_0x36d1('0x39')](_0x2b3fa4['where'],{'$or':_[_0x36d1('0x28')](_0x2b3fa4[_0x36d1('0x31')],function(_0xf5f207){var _0x36f2f7={};_0x36f2f7[_0xf5f207]={'$like':'%'+_0x4068d4['query'][_0x36d1('0x3b')]+'%'};return _0x36f2f7;})});}_0x2b3fa4=_['merge']({},_0x2b3fa4,_0x4068d4[_0x36d1('0x3c')]);return _0x298132[_0x36d1('0x4a')](_0x2b3fa4);}})['then'](function(_0x9238e8){if(_0x9238e8){_0x4dc1f7=_0x9238e8[_0x36d1('0x33')];if(!_0x4068d4['query'][_0x36d1('0x34')](_0x36d1('0x35'))){_0x2b3fa4['limit']=qs[_0x36d1('0x1d')](_0x4068d4[_0x36d1('0x2e')][_0x36d1('0x1d')]);_0x2b3fa4[_0x36d1('0x1c')]=qs[_0x36d1('0x1c')](_0x4068d4[_0x36d1('0x2e')][_0x36d1('0x1c')]);}return _0x298132['getDescriptions'](_0x2b3fa4);}})[_0x36d1('0x24')](function(_0x541210){if(_0x541210){return _0x541210?{'count':_0x4dc1f7,'rows':_0x541210}:null;}})[_0x36d1('0x24')](respondWithResult(_0x2afd2c,null))[_0x36d1('0x3f')](handleError(_0x2afd2c,null));};exports[_0x36d1('0x4d')]=function(_0x1f4fd8,_0x36a9f0,_0x3eb7df){var _0x1bac9b={};var _0x12dd1d={};var _0x37f95d;var _0x431ba4;return db[_0x36d1('0x29')][_0x36d1('0x4b')]({'where':{'id':_0x1f4fd8[_0x36d1('0x41')]['id']}})[_0x36d1('0x24')](handleEntityNotFound(_0x36a9f0,null))[_0x36d1('0x24')](function(_0x2313dd){if(_0x2313dd){_0x37f95d=_0x2313dd;_0x12dd1d['model']=_[_0x36d1('0x2f')](db[_0x36d1('0x48')][_0x36d1('0x42')]);_0x12dd1d[_0x36d1('0x2e')]=_[_0x36d1('0x2f')](_0x1f4fd8[_0x36d1('0x2e')]);_0x12dd1d[_0x36d1('0x49')]=_[_0x36d1('0x30')](_0x12dd1d['model'],_0x12dd1d[_0x36d1('0x2e')]);_0x1bac9b[_0x36d1('0x31')]=_[_0x36d1('0x30')](_0x12dd1d[_0x36d1('0x2d')],qs[_0x36d1('0x32')](_0x1f4fd8[_0x36d1('0x2e')][_0x36d1('0x32')]));_0x1bac9b[_0x36d1('0x31')]=_0x1bac9b[_0x36d1('0x31')][_0x36d1('0x33')]?_0x1bac9b[_0x36d1('0x31')]:_0x12dd1d[_0x36d1('0x2d')];_0x1bac9b[_0x36d1('0x36')]=qs[_0x36d1('0x37')](_0x1f4fd8['query'][_0x36d1('0x37')]);_0x1bac9b[_0x36d1('0x38')]=qs[_0x36d1('0x49')](_[_0x36d1('0x4c')](_0x1f4fd8[_0x36d1('0x2e')],_0x12dd1d['filters']));if(_0x1f4fd8[_0x36d1('0x2e')]['filter']){_0x1bac9b[_0x36d1('0x38')]=_[_0x36d1('0x39')](_0x1bac9b[_0x36d1('0x38')],{'$or':_[_0x36d1('0x28')](_0x1bac9b[_0x36d1('0x31')],function(_0x9ebcc8){var _0xbb9a30={};_0xbb9a30[_0x9ebcc8]={'$like':'%'+_0x1f4fd8[_0x36d1('0x2e')][_0x36d1('0x3b')]+'%'};return _0xbb9a30;})});}_0x1bac9b=_[_0x36d1('0x39')]({},_0x1bac9b,_0x1f4fd8[_0x36d1('0x3c')]);return _0x37f95d[_0x36d1('0x4d')](_0x1bac9b);}})[_0x36d1('0x24')](function(_0x154b9c){if(_0x154b9c){_0x431ba4=_0x154b9c[_0x36d1('0x33')];if(!_0x1f4fd8[_0x36d1('0x2e')][_0x36d1('0x34')](_0x36d1('0x35'))){_0x1bac9b[_0x36d1('0x1d')]=qs[_0x36d1('0x1d')](_0x1f4fd8[_0x36d1('0x2e')][_0x36d1('0x1d')]);_0x1bac9b[_0x36d1('0x1c')]=qs[_0x36d1('0x1c')](_0x1f4fd8[_0x36d1('0x2e')][_0x36d1('0x1c')]);}return _0x37f95d[_0x36d1('0x4d')](_0x1bac9b);}})[_0x36d1('0x24')](function(_0x24f80f){if(_0x24f80f){return _0x24f80f?{'count':_0x431ba4,'rows':_0x24f80f}:null;}})[_0x36d1('0x24')](respondWithResult(_0x36a9f0,null))[_0x36d1('0x3f')](handleError(_0x36a9f0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 0c2d7c1..7c6fa90 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 _0xed4c=['bluebird','request-promise','path','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x3c5e81,_0x3ab8d6){var _0x99a905=function(_0x3b72c2){while(--_0x3b72c2){_0x3c5e81['push'](_0x3c5e81['shift']());}};_0x99a905(++_0x3ab8d6);}(_0xed4c,0x1f3));var _0xced4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xed4c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xced4('0x0'));var util=require(_0xced4('0x1'));var logger=require(_0xced4('0x2'))(_0xced4('0x3'));var moment=require(_0xced4('0x4'));var BPromise=require(_0xced4('0x5'));var rp=require(_0xced4('0x6'));var fs=require('fs');var path=require(_0xced4('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xced4('0x8'));module[_0xced4('0x9')]=function(_0x1a2768,_0x2c5a39){return _0x1a2768[_0xced4('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0xced4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c0a=['request-promise','path','rimraf','exports','define','util','api','moment','bluebird'];(function(_0xde5ba5,_0x49ec1a){var _0x22e063=function(_0x1ca680){while(--_0x1ca680){_0xde5ba5['push'](_0xde5ba5['shift']());}};_0x22e063(++_0x49ec1a);}(_0x4c0a,0x101));var _0xa4c0=function(_0x371bd2,_0x817ef8){_0x371bd2=_0x371bd2-0x0;var _0x4539c1=_0x4c0a[_0x371bd2];return _0x4539c1;};'use strict';var _=require('lodash');var util=require(_0xa4c0('0x0'));var logger=require('../../config/logger')(_0xa4c0('0x1'));var moment=require(_0xa4c0('0x2'));var BPromise=require(_0xa4c0('0x3'));var rp=require(_0xa4c0('0x4'));var fs=require('fs');var path=require(_0xa4c0('0x5'));var rimraf=require(_0xa4c0('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xa4c0('0x7')]=function(_0x38fdc6,_0x4aa84b){return _0x38fdc6[_0xa4c0('0x8')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','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 a7752df..eddd585 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 _0xcee2=['then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x5202e8,_0x2446f9){var _0x2d9ee9=function(_0x250018){while(--_0x250018){_0x5202e8['push'](_0x5202e8['shift']());}};_0x2d9ee9(++_0x2446f9);}(_0xcee2,0x11e));var _0x2cee=function(_0x3d5d45,_0x307246){_0x3d5d45=_0x3d5d45-0x0;var _0x6c04cb=_0xcee2[_0x3d5d45];return _0x6c04cb;};'use strict';var _=require('lodash');var util=require(_0x2cee('0x0'));var moment=require(_0x2cee('0x1'));var BPromise=require(_0x2cee('0x2'));var rs=require(_0x2cee('0x3'));var fs=require('fs');var Redis=require(_0x2cee('0x4'));var db=require(_0x2cee('0x5'))['db'];var utils=require(_0x2cee('0x6'));var logger=require(_0x2cee('0x7'))(_0x2cee('0x8'));var config=require('../../config/environment');var jayson=require(_0x2cee('0x9'));var client=jayson[_0x2cee('0xa')][_0x2cee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x129a2a,_0x16046d,_0x587b78){return new BPromise(function(_0x31574b,_0x57f2e3){return client[_0x2cee('0xc')](_0x129a2a,_0x587b78)[_0x2cee('0xd')](function(_0x3a00fd){logger[_0x2cee('0xe')](_0x2cee('0xf'),_0x16046d,_0x2cee('0x10'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x16046d,_0x2cee('0x10'),JSON[_0x2cee('0x11')](_0x3a00fd));if(_0x3a00fd['error']){if(_0x3a00fd[_0x2cee('0x12')][_0x2cee('0x13')]===0x1f4){logger[_0x2cee('0x12')](_0x2cee('0xf'),_0x16046d,_0x3a00fd[_0x2cee('0x12')][_0x2cee('0x14')]);return _0x57f2e3(_0x3a00fd['error'][_0x2cee('0x14')]);}logger[_0x2cee('0x12')](_0x2cee('0xf'),_0x16046d,_0x3a00fd[_0x2cee('0x12')][_0x2cee('0x14')]);return _0x31574b(_0x3a00fd[_0x2cee('0x12')][_0x2cee('0x14')]);}else{logger[_0x2cee('0xe')](_0x2cee('0xf'),_0x16046d,'request\x20sent');_0x31574b(_0x3a00fd[_0x2cee('0x15')][_0x2cee('0x14')]);}})[_0x2cee('0x16')](function(_0x249588){logger['error'](_0x2cee('0xf'),_0x16046d,_0x249588);_0x57f2e3(_0x249588);});});} \ No newline at end of file +var _0xdccc=['catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x5b93c2,_0x3a4382){var _0x1e731c=function(_0x9964af){while(--_0x9964af){_0x5b93c2['push'](_0x5b93c2['shift']());}};_0x1e731c(++_0x3a4382);}(_0xdccc,0x79));var _0xcdcc=function(_0x3a0fb6,_0x16a72c){_0x3a0fb6=_0x3a0fb6-0x0;var _0x3313ae=_0xdccc[_0x3a0fb6];return _0x3313ae;};'use strict';var _=require(_0xcdcc('0x0'));var util=require('util');var moment=require(_0xcdcc('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdcc('0x2'));var db=require(_0xcdcc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdcc('0x4'))(_0xcdcc('0x5'));var config=require(_0xcdcc('0x6'));var jayson=require(_0xcdcc('0x7'));var client=jayson['client'][_0xcdcc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14ef40,_0x137e9f,_0x4ad068){return new BPromise(function(_0x324b69,_0x3c31fc){return client['request'](_0x14ef40,_0x4ad068)[_0xcdcc('0x9')](function(_0x271e19){logger['info'](_0xcdcc('0xa'),_0x137e9f,_0xcdcc('0xb'));logger[_0xcdcc('0xc')](_0xcdcc('0xd'),_0x137e9f,_0xcdcc('0xb'),JSON['stringify'](_0x271e19));if(_0x271e19[_0xcdcc('0xe')]){if(_0x271e19[_0xcdcc('0xe')][_0xcdcc('0xf')]===0x1f4){logger[_0xcdcc('0xe')](_0xcdcc('0xa'),_0x137e9f,_0x271e19[_0xcdcc('0xe')][_0xcdcc('0x10')]);return _0x3c31fc(_0x271e19[_0xcdcc('0xe')][_0xcdcc('0x10')]);}logger[_0xcdcc('0xe')](_0xcdcc('0xa'),_0x137e9f,_0x271e19['error'][_0xcdcc('0x10')]);return _0x324b69(_0x271e19[_0xcdcc('0xe')][_0xcdcc('0x10')]);}else{logger[_0xcdcc('0x11')](_0xcdcc('0xa'),_0x137e9f,_0xcdcc('0xb'));_0x324b69(_0x271e19[_0xcdcc('0x12')][_0xcdcc('0x10')]);}})[_0xcdcc('0x13')](function(_0x41ee7d){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x137e9f,_0x41ee7d);_0x3c31fc(_0x41ee7d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 61ab909..c96bf55 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 _0x33a4=['delete','util','connect-timeout','express','Router','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x45ad09,_0x521ab1){var _0x2084fd=function(_0x6fd212){while(--_0x6fd212){_0x45ad09['push'](_0x45ad09['shift']());}};_0x2084fd(++_0x521ab1);}(_0x33a4,0x88));var _0x433a=function(_0x5d8248,_0x672698){_0x5d8248=_0x5d8248-0x0;var _0x1e9ea9=_0x33a4[_0x5d8248];return _0x1e9ea9;};'use strict';var multer=require('multer');var util=require(_0x433a('0x0'));var path=require('path');var timeout=require(_0x433a('0x1'));var express=require(_0x433a('0x2'));var router=express[_0x433a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x433a('0x4'));var controller=require(_0x433a('0x5'));router[_0x433a('0x6')]('/',auth[_0x433a('0x7')](),controller[_0x433a('0x8')]);router['get'](_0x433a('0x9'),auth['isAuthenticated'](),controller[_0x433a('0xa')]);router[_0x433a('0xb')]('/',auth[_0x433a('0x7')](),controller[_0x433a('0xc')]);router['put']('/:id',auth[_0x433a('0x7')](),controller[_0x433a('0xd')]);router[_0x433a('0xe')](_0x433a('0x9'),auth[_0x433a('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2f68=['create','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post'];(function(_0xe472df,_0x3b9d41){var _0x2dccc7=function(_0x410388){while(--_0x410388){_0xe472df['push'](_0xe472df['shift']());}};_0x2dccc7(++_0x3b9d41);}(_0x2f68,0x9a));var _0x82f6=function(_0x1df18b,_0x22aabc){_0x1df18b=_0x1df18b-0x0;var _0x188619=_0x2f68[_0x1df18b];return _0x188619;};'use strict';var multer=require('multer');var util=require(_0x82f6('0x0'));var path=require(_0x82f6('0x1'));var timeout=require(_0x82f6('0x2'));var express=require(_0x82f6('0x3'));var router=express['Router']();var fs_extra=require(_0x82f6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x82f6('0x5'));var config=require(_0x82f6('0x6'));var controller=require('./intFreshsalesField.controller');router[_0x82f6('0x7')]('/',auth[_0x82f6('0x8')](),controller['index']);router['get'](_0x82f6('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x82f6('0xa')]('/',auth[_0x82f6('0x8')](),controller[_0x82f6('0xb')]);router['put'](_0x82f6('0x9'),auth[_0x82f6('0x8')](),controller['update']);router[_0x82f6('0xc')](_0x82f6('0x9'),auth[_0x82f6('0x8')](),controller[_0x82f6('0xd')]);module[_0x82f6('0xe')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 71c81bf..1d7fc64 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 _0x29f1=['string','variable','picklist','STRING','sequelize','exports','ENUM'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x29f1,0xa5));var _0x129f=function(_0x3db857,_0xf401b6){_0x3db857=_0x3db857-0x0;var _0xb74de0=_0x29f1[_0x3db857];return _0xb74de0;};'use strict';var Sequelize=require(_0x129f('0x0'));module[_0x129f('0x1')]={'type':{'type':Sequelize[_0x129f('0x2')](_0x129f('0x3'),_0x129f('0x4'),'customVariable','keyValue',_0x129f('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x129f('0x6')]},'key':{'type':Sequelize[_0x129f('0x6')]},'keyType':{'type':Sequelize[_0x129f('0x2')](_0x129f('0x3'),_0x129f('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x129f('0x6')]},'nameField':{'type':Sequelize[_0x129f('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x129f('0x6')]}}; \ No newline at end of file +var _0x3e4d=['string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','ENUM'];(function(_0x483385,_0x437c03){var _0x1b4449=function(_0x5768ee){while(--_0x5768ee){_0x483385['push'](_0x483385['shift']());}};_0x1b4449(++_0x437c03);}(_0x3e4d,0xbf));var _0xd3e4=function(_0x225877,_0x39cc77){_0x225877=_0x225877-0x0;var _0x5b72d3=_0x3e4d[_0x225877];return _0x5b72d3;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xd3e4('0x0')](_0xd3e4('0x1'),'variable',_0xd3e4('0x2'),_0xd3e4('0x3'),_0xd3e4('0x4')),'defaultValue':_0xd3e4('0x1')},'content':{'type':Sequelize[_0xd3e4('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd3e4('0x0')](_0xd3e4('0x1'),_0xd3e4('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xd3e4('0x5')]},'idField':{'type':Sequelize[_0xd3e4('0x5')]},'nameField':{'type':Sequelize[_0xd3e4('0x5')]},'customField':{'type':Sequelize[_0xd3e4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd3e4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 660137e..9ca58f5 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 _0x444c=['apply','reject','save','update','destroy','then','end','name','index','map','FreshsalesField','rawAttributes','fieldName','key','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','show','find','catch','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x339fa0,_0x3c17b2){var _0x4a473a=function(_0x41d657){while(--_0x41d657){_0x339fa0['push'](_0x339fa0['shift']());}};_0x4a473a(++_0x3c17b2);}(_0x444c,0x154));var _0xc444=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x444c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc444('0x0'));var zipdir=require(_0xc444('0x1'));var jsonpatch=require(_0xc444('0x2'));var rp=require(_0xc444('0x3'));var moment=require(_0xc444('0x4'));var BPromise=require(_0xc444('0x5'));var Mustache=require(_0xc444('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc444('0x7'));var csv=require(_0xc444('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc444('0x9'));var _=require(_0xc444('0xa'));var squel=require(_0xc444('0xb'));var crypto=require(_0xc444('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc444('0xd'));var toCsv=require(_0xc444('0x8'));var querystring=require(_0xc444('0xe'));var Papa=require(_0xc444('0xf'));var Redis=require(_0xc444('0x10'));var authService=require(_0xc444('0x11'));var qs=require(_0xc444('0x12'));var as=require(_0xc444('0x13'));var hardwareService=require(_0xc444('0x14'));var logger=require(_0xc444('0x15'))(_0xc444('0x16'));var utils=require(_0xc444('0x17'));var config=require(_0xc444('0x18'));var licenseUtil=require(_0xc444('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1669ec,_0x1abc5f){_0x1abc5f=_0x1abc5f||0xcc;return function(_0x7def62){if(_0x7def62){return _0x1669ec[_0xc444('0x1a')](_0x1abc5f);}return _0x1669ec['status'](_0x1abc5f)['end']();};}function respondWithResult(_0x4ce745,_0x4b29cb){_0x4b29cb=_0x4b29cb||0xc8;return function(_0x3350fa){if(_0x3350fa){return _0x4ce745[_0xc444('0x1b')](_0x4b29cb)[_0xc444('0x1c')](_0x3350fa);}};}function respondWithFilteredResult(_0xe4907d,_0x6abd89){return function(_0x59a0c2){if(_0x59a0c2){var _0x1ce569=typeof _0x6abd89[_0xc444('0x1d')]===_0xc444('0x1e')&&typeof _0x6abd89['limit']==='undefined';var _0x3af4c1=_0x59a0c2[_0xc444('0x1f')];var _0x274194=_0x1ce569?0x0:_0x6abd89[_0xc444('0x1d')];var _0x313417=_0x1ce569?_0x59a0c2[_0xc444('0x1f')]:_0x6abd89['offset']+_0x6abd89[_0xc444('0x20')];var _0x449f77;if(_0x313417>=_0x3af4c1){_0x313417=_0x3af4c1;_0x449f77=0xc8;}else{_0x449f77=0xce;}_0xe4907d[_0xc444('0x1b')](_0x449f77);return _0xe4907d[_0xc444('0x21')](_0xc444('0x22'),_0x274194+'-'+_0x313417+'/'+_0x3af4c1)[_0xc444('0x1c')](_0x59a0c2);}return null;};}function patchUpdates(_0x5212dd){return function(_0x2e35c3){try{jsonpatch[_0xc444('0x23')](_0x2e35c3,_0x5212dd,!![]);}catch(_0x1339c7){return BPromise[_0xc444('0x24')](_0x1339c7);}return _0x2e35c3[_0xc444('0x25')]();};}function saveUpdates(_0x557912,_0x327b2b){return function(_0x43325b){if(_0x43325b){return _0x43325b[_0xc444('0x26')](_0x557912)['then'](function(_0x39f183){return _0x39f183;});}return null;};}function removeEntity(_0x198e6d,_0x294390){return function(_0x5ec667){if(_0x5ec667){return _0x5ec667[_0xc444('0x27')]()[_0xc444('0x28')](function(){_0x198e6d[_0xc444('0x1b')](0xcc)[_0xc444('0x29')]();});}};}function handleEntityNotFound(_0x24aaed,_0xbd5341){return function(_0x2b04aa){if(!_0x2b04aa){_0x24aaed[_0xc444('0x1a')](0x194);}return _0x2b04aa;};}function handleError(_0x242eba,_0x5af120){_0x5af120=_0x5af120||0x1f4;return function(_0xadc64d){logger['error'](_0xadc64d['stack']);if(_0xadc64d[_0xc444('0x2a')]){delete _0xadc64d[_0xc444('0x2a')];}_0x242eba[_0xc444('0x1b')](_0x5af120)['send'](_0xadc64d);};}exports[_0xc444('0x2b')]=function(_0x1b8d27,_0x337eec){var _0x26e6c5={},_0x5979bc={},_0x14bc7d={'count':0x0,'rows':[]};var _0x3b27f4=_[_0xc444('0x2c')](db[_0xc444('0x2d')][_0xc444('0x2e')],function(_0xaf7a41){return{'name':_0xaf7a41[_0xc444('0x2f')],'type':_0xaf7a41['type'][_0xc444('0x30')]};});_0x5979bc[_0xc444('0x31')]=_[_0xc444('0x2c')](_0x3b27f4,_0xc444('0x2a'));_0x5979bc['query']=_[_0xc444('0x32')](_0x1b8d27['query']);_0x5979bc[_0xc444('0x33')]=_['intersection'](_0x5979bc[_0xc444('0x31')],_0x5979bc[_0xc444('0x34')]);_0x26e6c5['attributes']=_[_0xc444('0x35')](_0x5979bc['model'],qs['fields'](_0x1b8d27[_0xc444('0x34')][_0xc444('0x36')]));_0x26e6c5[_0xc444('0x37')]=_0x26e6c5['attributes'][_0xc444('0x38')]?_0x26e6c5[_0xc444('0x37')]:_0x5979bc[_0xc444('0x31')];if(!_0x1b8d27[_0xc444('0x34')][_0xc444('0x39')](_0xc444('0x3a'))){_0x26e6c5[_0xc444('0x20')]=qs[_0xc444('0x20')](_0x1b8d27[_0xc444('0x34')][_0xc444('0x20')]);_0x26e6c5[_0xc444('0x1d')]=qs['offset'](_0x1b8d27['query'][_0xc444('0x1d')]);}_0x26e6c5['order']=qs[_0xc444('0x3b')](_0x1b8d27[_0xc444('0x34')][_0xc444('0x3b')]);_0x26e6c5[_0xc444('0x3c')]=qs[_0xc444('0x33')](_[_0xc444('0x3d')](_0x1b8d27[_0xc444('0x34')],_0x5979bc[_0xc444('0x33')]),_0x3b27f4);if(_0x1b8d27['query'][_0xc444('0x3e')]){_0x26e6c5[_0xc444('0x3c')]=_[_0xc444('0x3f')](_0x26e6c5[_0xc444('0x3c')],{'$or':_['map'](_0x3b27f4,function(_0x24689f){if(_0x24689f[_0xc444('0x40')]!==_0xc444('0x41')){var _0x2aada7={};_0x2aada7[_0x24689f[_0xc444('0x2a')]]={'$like':'%'+_0x1b8d27[_0xc444('0x34')]['filter']+'%'};return _0x2aada7;}})});}_0x26e6c5=_[_0xc444('0x3f')]({},_0x26e6c5,_0x1b8d27[_0xc444('0x42')]);var _0x42c04d={'where':_0x26e6c5[_0xc444('0x3c')]};return db['FreshsalesField']['count'](_0x42c04d)[_0xc444('0x28')](function(_0x5d6bd2){_0x14bc7d[_0xc444('0x1f')]=_0x5d6bd2;if(_0x1b8d27[_0xc444('0x34')][_0xc444('0x43')]){_0x26e6c5[_0xc444('0x44')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x26e6c5);})[_0xc444('0x28')](function(_0x2f5a29){_0x14bc7d['rows']=_0x2f5a29;return _0x14bc7d;})['then'](respondWithFilteredResult(_0x337eec,_0x26e6c5))['catch'](handleError(_0x337eec,null));};exports[_0xc444('0x45')]=function(_0x4d3d54,_0x392233){var _0x133c8b={'raw':!![],'where':{'id':_0x4d3d54['params']['id']}},_0x47af84={};_0x47af84['model']=_[_0xc444('0x32')](db[_0xc444('0x2d')][_0xc444('0x2e')]);_0x47af84['query']=_[_0xc444('0x32')](_0x4d3d54[_0xc444('0x34')]);_0x47af84['filters']=_['intersection'](_0x47af84[_0xc444('0x31')],_0x47af84['query']);_0x133c8b['attributes']=_[_0xc444('0x35')](_0x47af84['model'],qs['fields'](_0x4d3d54[_0xc444('0x34')][_0xc444('0x36')]));_0x133c8b[_0xc444('0x37')]=_0x133c8b[_0xc444('0x37')][_0xc444('0x38')]?_0x133c8b[_0xc444('0x37')]:_0x47af84[_0xc444('0x31')];if(_0x4d3d54['query'][_0xc444('0x43')]){_0x133c8b[_0xc444('0x44')]=[{'all':!![]}];}_0x133c8b=_[_0xc444('0x3f')]({},_0x133c8b,_0x4d3d54['options']);return db['FreshsalesField'][_0xc444('0x46')](_0x133c8b)['then'](handleEntityNotFound(_0x392233,null))[_0xc444('0x28')](respondWithResult(_0x392233,null))[_0xc444('0x47')](handleError(_0x392233,null));};exports[_0xc444('0x48')]=function(_0xb090ad,_0x5e23c4){return db[_0xc444('0x2d')][_0xc444('0x48')](_0xb090ad[_0xc444('0x49')],{})[_0xc444('0x28')](respondWithResult(_0x5e23c4,0xc9))[_0xc444('0x47')](handleError(_0x5e23c4,null));};exports[_0xc444('0x26')]=function(_0x9e8b33,_0x3d9ebf){if(_0x9e8b33[_0xc444('0x49')]['id']){delete _0x9e8b33[_0xc444('0x49')]['id'];}return db[_0xc444('0x2d')]['find']({'where':{'id':_0x9e8b33[_0xc444('0x4a')]['id']}})[_0xc444('0x28')](handleEntityNotFound(_0x3d9ebf,null))[_0xc444('0x28')](saveUpdates(_0x9e8b33[_0xc444('0x49')],null))[_0xc444('0x28')](respondWithResult(_0x3d9ebf,null))[_0xc444('0x47')](handleError(_0x3d9ebf,null));};exports[_0xc444('0x27')]=function(_0x464bbc,_0xd727f8){return db[_0xc444('0x2d')]['find']({'where':{'id':_0x464bbc['params']['id']}})['then'](handleEntityNotFound(_0xd727f8,null))['then'](removeEntity(_0xd727f8,null))[_0xc444('0x47')](handleError(_0xd727f8,null));}; \ No newline at end of file +var _0x4bb2=['params','options','find','create','body','catch','destroy','eml-format','rimraf','moment','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','FreshsalesField','include','findAll','rows','show'];(function(_0x290d6d,_0x5ed258){var _0x5861a8=function(_0x363f8f){while(--_0x363f8f){_0x290d6d['push'](_0x290d6d['shift']());}};_0x5861a8(++_0x5ed258);}(_0x4bb2,0x16f));var _0x24bb=function(_0x432668,_0x356f30){_0x432668=_0x432668-0x0;var _0x43fe50=_0x4bb2[_0x432668];return _0x43fe50;};'use strict';var emlformat=require(_0x24bb('0x0'));var rimraf=require(_0x24bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x24bb('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x24bb('0x3'));var path=require(_0x24bb('0x4'));var sox=require(_0x24bb('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x24bb('0x6'));var _=require(_0x24bb('0x7'));var squel=require(_0x24bb('0x8'));var crypto=require('crypto');var jsforce=require(_0x24bb('0x9'));var deskjs=require(_0x24bb('0xa'));var toCsv=require(_0x24bb('0xb'));var querystring=require(_0x24bb('0xc'));var Papa=require(_0x24bb('0xd'));var Redis=require(_0x24bb('0xe'));var authService=require(_0x24bb('0xf'));var qs=require(_0x24bb('0x10'));var as=require(_0x24bb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x24bb('0x12'))('api');var utils=require(_0x24bb('0x13'));var config=require(_0x24bb('0x14'));var licenseUtil=require(_0x24bb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fa670,_0x11b70c){_0x11b70c=_0x11b70c||0xcc;return function(_0x287a7c){if(_0x287a7c){return _0x3fa670[_0x24bb('0x16')](_0x11b70c);}return _0x3fa670[_0x24bb('0x17')](_0x11b70c)[_0x24bb('0x18')]();};}function respondWithResult(_0x3c8b94,_0x3dc0ad){_0x3dc0ad=_0x3dc0ad||0xc8;return function(_0x429cea){if(_0x429cea){return _0x3c8b94['status'](_0x3dc0ad)['json'](_0x429cea);}};}function respondWithFilteredResult(_0x5dc6f7,_0x131865){return function(_0x39d987){if(_0x39d987){var _0x10140f=typeof _0x131865[_0x24bb('0x19')]==='undefined'&&typeof _0x131865[_0x24bb('0x1a')]===_0x24bb('0x1b');var _0x2e3e3b=_0x39d987[_0x24bb('0x1c')];var _0x1bb42b=_0x10140f?0x0:_0x131865[_0x24bb('0x19')];var _0x562a3b=_0x10140f?_0x39d987['count']:_0x131865[_0x24bb('0x19')]+_0x131865[_0x24bb('0x1a')];var _0x29c583;if(_0x562a3b>=_0x2e3e3b){_0x562a3b=_0x2e3e3b;_0x29c583=0xc8;}else{_0x29c583=0xce;}_0x5dc6f7[_0x24bb('0x17')](_0x29c583);return _0x5dc6f7[_0x24bb('0x1d')](_0x24bb('0x1e'),_0x1bb42b+'-'+_0x562a3b+'/'+_0x2e3e3b)['json'](_0x39d987);}return null;};}function patchUpdates(_0x50cdab){return function(_0x3c26f4){try{jsonpatch[_0x24bb('0x1f')](_0x3c26f4,_0x50cdab,!![]);}catch(_0x4792f2){return BPromise[_0x24bb('0x20')](_0x4792f2);}return _0x3c26f4[_0x24bb('0x21')]();};}function saveUpdates(_0x3d83d7,_0x11d65){return function(_0x2783c0){if(_0x2783c0){return _0x2783c0['update'](_0x3d83d7)[_0x24bb('0x22')](function(_0x5ce51a){return _0x5ce51a;});}return null;};}function removeEntity(_0x2b9b98,_0x41e510){return function(_0x299f84){if(_0x299f84){return _0x299f84['destroy']()['then'](function(){_0x2b9b98['status'](0xcc)[_0x24bb('0x18')]();});}};}function handleEntityNotFound(_0x3d501e,_0x23d17d){return function(_0x2772c7){if(!_0x2772c7){_0x3d501e[_0x24bb('0x16')](0x194);}return _0x2772c7;};}function handleError(_0x4deba5,_0x3b9208){_0x3b9208=_0x3b9208||0x1f4;return function(_0x3b4a7a){logger[_0x24bb('0x23')](_0x3b4a7a[_0x24bb('0x24')]);if(_0x3b4a7a['name']){delete _0x3b4a7a[_0x24bb('0x25')];}_0x4deba5[_0x24bb('0x17')](_0x3b9208)[_0x24bb('0x26')](_0x3b4a7a);};}exports[_0x24bb('0x27')]=function(_0x180cc1,_0x577ae0){var _0x4d125e={},_0x22f3e6={},_0x195324={'count':0x0,'rows':[]};var _0x2c1c2b=_[_0x24bb('0x28')](db['FreshsalesField'][_0x24bb('0x29')],function(_0x58009b){return{'name':_0x58009b['fieldName'],'type':_0x58009b[_0x24bb('0x2a')][_0x24bb('0x2b')]};});_0x22f3e6[_0x24bb('0x2c')]=_['map'](_0x2c1c2b,_0x24bb('0x25'));_0x22f3e6[_0x24bb('0x2d')]=_[_0x24bb('0x2e')](_0x180cc1[_0x24bb('0x2d')]);_0x22f3e6[_0x24bb('0x2f')]=_[_0x24bb('0x30')](_0x22f3e6[_0x24bb('0x2c')],_0x22f3e6[_0x24bb('0x2d')]);_0x4d125e['attributes']=_[_0x24bb('0x30')](_0x22f3e6[_0x24bb('0x2c')],qs['fields'](_0x180cc1[_0x24bb('0x2d')][_0x24bb('0x31')]));_0x4d125e[_0x24bb('0x32')]=_0x4d125e[_0x24bb('0x32')][_0x24bb('0x33')]?_0x4d125e[_0x24bb('0x32')]:_0x22f3e6['model'];if(!_0x180cc1[_0x24bb('0x2d')][_0x24bb('0x34')](_0x24bb('0x35'))){_0x4d125e[_0x24bb('0x1a')]=qs['limit'](_0x180cc1[_0x24bb('0x2d')]['limit']);_0x4d125e[_0x24bb('0x19')]=qs['offset'](_0x180cc1[_0x24bb('0x2d')][_0x24bb('0x19')]);}_0x4d125e[_0x24bb('0x36')]=qs[_0x24bb('0x37')](_0x180cc1['query'][_0x24bb('0x37')]);_0x4d125e[_0x24bb('0x38')]=qs[_0x24bb('0x2f')](_[_0x24bb('0x39')](_0x180cc1['query'],_0x22f3e6['filters']),_0x2c1c2b);if(_0x180cc1[_0x24bb('0x2d')]['filter']){_0x4d125e[_0x24bb('0x38')]=_[_0x24bb('0x3a')](_0x4d125e[_0x24bb('0x38')],{'$or':_[_0x24bb('0x28')](_0x2c1c2b,function(_0x1cc01a){if(_0x1cc01a[_0x24bb('0x2a')]!==_0x24bb('0x3b')){var _0x4f829c={};_0x4f829c[_0x1cc01a['name']]={'$like':'%'+_0x180cc1[_0x24bb('0x2d')]['filter']+'%'};return _0x4f829c;}})});}_0x4d125e=_['merge']({},_0x4d125e,_0x180cc1['options']);var _0x312a28={'where':_0x4d125e[_0x24bb('0x38')]};return db[_0x24bb('0x3c')][_0x24bb('0x1c')](_0x312a28)[_0x24bb('0x22')](function(_0x59680f){_0x195324[_0x24bb('0x1c')]=_0x59680f;if(_0x180cc1[_0x24bb('0x2d')]['includeAll']){_0x4d125e[_0x24bb('0x3d')]=[{'all':!![]}];}return db[_0x24bb('0x3c')][_0x24bb('0x3e')](_0x4d125e);})['then'](function(_0x3bc339){_0x195324[_0x24bb('0x3f')]=_0x3bc339;return _0x195324;})[_0x24bb('0x22')](respondWithFilteredResult(_0x577ae0,_0x4d125e))['catch'](handleError(_0x577ae0,null));};exports[_0x24bb('0x40')]=function(_0x1f5ffe,_0x4b35bb){var _0x23a662={'raw':!![],'where':{'id':_0x1f5ffe[_0x24bb('0x41')]['id']}},_0x1d9d75={};_0x1d9d75[_0x24bb('0x2c')]=_[_0x24bb('0x2e')](db[_0x24bb('0x3c')][_0x24bb('0x29')]);_0x1d9d75[_0x24bb('0x2d')]=_['keys'](_0x1f5ffe['query']);_0x1d9d75[_0x24bb('0x2f')]=_[_0x24bb('0x30')](_0x1d9d75[_0x24bb('0x2c')],_0x1d9d75[_0x24bb('0x2d')]);_0x23a662[_0x24bb('0x32')]=_[_0x24bb('0x30')](_0x1d9d75['model'],qs[_0x24bb('0x31')](_0x1f5ffe[_0x24bb('0x2d')][_0x24bb('0x31')]));_0x23a662[_0x24bb('0x32')]=_0x23a662['attributes']['length']?_0x23a662[_0x24bb('0x32')]:_0x1d9d75['model'];if(_0x1f5ffe['query']['includeAll']){_0x23a662[_0x24bb('0x3d')]=[{'all':!![]}];}_0x23a662=_[_0x24bb('0x3a')]({},_0x23a662,_0x1f5ffe[_0x24bb('0x42')]);return db[_0x24bb('0x3c')][_0x24bb('0x43')](_0x23a662)[_0x24bb('0x22')](handleEntityNotFound(_0x4b35bb,null))['then'](respondWithResult(_0x4b35bb,null))['catch'](handleError(_0x4b35bb,null));};exports[_0x24bb('0x44')]=function(_0x4d38ad,_0x58d95d){return db[_0x24bb('0x3c')][_0x24bb('0x44')](_0x4d38ad[_0x24bb('0x45')],{})['then'](respondWithResult(_0x58d95d,0xc9))[_0x24bb('0x46')](handleError(_0x58d95d,null));};exports['update']=function(_0x5571e2,_0x2b173e){if(_0x5571e2['body']['id']){delete _0x5571e2[_0x24bb('0x45')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x5571e2['params']['id']}})['then'](handleEntityNotFound(_0x2b173e,null))[_0x24bb('0x22')](saveUpdates(_0x5571e2[_0x24bb('0x45')],null))[_0x24bb('0x22')](respondWithResult(_0x2b173e,null))[_0x24bb('0x46')](handleError(_0x2b173e,null));};exports[_0x24bb('0x47')]=function(_0x26cbd5,_0x3667ff){return db[_0x24bb('0x3c')]['find']({'where':{'id':_0x26cbd5[_0x24bb('0x41')]['id']}})[_0x24bb('0x22')](handleEntityNotFound(_0x3667ff,null))[_0x24bb('0x22')](removeEntity(_0x3667ff,null))[_0x24bb('0x46')](handleError(_0x3667ff,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7d3bcb2..8dbbe78 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 _0xaaee=['FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','idField'];(function(_0x4f1587,_0x48d4dd){var _0x4c61f4=function(_0x563795){while(--_0x563795){_0x4f1587['push'](_0x4f1587['shift']());}};_0x4c61f4(++_0x48d4dd);}(_0xaaee,0xa9));var _0xeaae=function(_0x193f35,_0x396347){_0x193f35=_0x193f35-0x0;var _0x3d7a28=_0xaaee[_0x193f35];return _0x3d7a28;};'use strict';var _=require(_0xeaae('0x0'));var util=require('util');var logger=require(_0xeaae('0x1'))(_0xeaae('0x2'));var moment=require('moment');var BPromise=require(_0xeaae('0x3'));var rp=require(_0xeaae('0x4'));var fs=require('fs');var path=require(_0xeaae('0x5'));var rimraf=require(_0xeaae('0x6'));var config=require('../../config/environment');var attributes=require(_0xeaae('0x7'));module[_0xeaae('0x8')]=function(_0x213422,_0x45c104){return _0x213422[_0xeaae('0x9')](_0xeaae('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xeaae('0xb'),'fields':[_0xeaae('0xc'),_0xeaae('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd027=['idField','FieldId','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x5cb798,_0x211e34){var _0x5e134f=function(_0x2defc6){while(--_0x2defc6){_0x5cb798['push'](_0x5cb798['shift']());}};_0x5e134f(++_0x211e34);}(_0xd027,0x197));var _0x7d02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd027[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7d02('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7d02('0x1'));var BPromise=require(_0x7d02('0x2'));var rp=require(_0x7d02('0x3'));var fs=require('fs');var path=require(_0x7d02('0x4'));var rimraf=require(_0x7d02('0x5'));var config=require(_0x7d02('0x6'));var attributes=require(_0x7d02('0x7'));module[_0x7d02('0x8')]=function(_0x50824f,_0x1e75e2){return _0x50824f[_0x7d02('0x9')](_0x7d02('0xa'),attributes,{'tableName':_0x7d02('0xb'),'paranoid':![],'indexes':[{'name':_0x7d02('0xc'),'fields':[_0x7d02('0xd'),_0x7d02('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 8cb095d..c08d2d9 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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x53ec,0x192));var _0xc53e=function(_0x358125,_0x45326f){_0x358125=_0x358125-0x0;var _0x118f28=_0x53ec[_0x358125];return _0x118f28;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0x2542=['info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x356f4b,_0x3bd961){var _0x137ddd=function(_0x36b03f){while(--_0x36b03f){_0x356f4b['push'](_0x356f4b['shift']());}};_0x137ddd(++_0x3bd961);}(_0x2542,0x169));var _0x2254=function(_0xf40252,_0x488947){_0xf40252=_0xf40252-0x0;var _0x1bfd48=_0x2542[_0xf40252];return _0x1bfd48;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index bf874e7..00755fb 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(_0x23afb5,_0x437dac){var _0x5833e2=function(_0x306d01){while(--_0x306d01){_0x23afb5['push'](_0x23afb5['shift']());}};_0x5833e2(++_0x437dac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4782c0,_0x2762aa){var _0x14aebe=function(_0x485b87){while(--_0x485b87){_0x4782c0['push'](_0x4782c0['shift']());}};_0x14aebe(++_0x2762aa);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index b3f69cd..63bbfe1 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 _0x9512=['STRING','username','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x57f3bc,_0x402bee){var _0x1085ec=function(_0x151461){while(--_0x151461){_0x57f3bc['push'](_0x57f3bc['shift']());}};_0x1085ec(++_0x402bee);}(_0x9512,0x75));var _0x2951=function(_0x363f05,_0x4b6f15){_0x363f05=_0x363f05-0x0;var _0x2f86d3=_0x9512[_0x363f05];return _0x2f86d3;};'use strict';var Sequelize=require(_0x2951('0x0'));module[_0x2951('0x1')]={'name':{'type':Sequelize[_0x2951('0x2')]},'description':{'type':Sequelize[_0x2951('0x2')]},'username':{'type':Sequelize[_0x2951('0x2')],'unique':_0x2951('0x3')},'remoteUri':{'type':Sequelize[_0x2951('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2951('0x2')]},'clientSecret':{'type':Sequelize[_0x2951('0x2')]},'securityToken':{'type':Sequelize[_0x2951('0x2')]},'serverUrl':{'type':Sequelize[_0x2951('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2951('0x4')](_0x2951('0x5'),_0x2951('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x3f3c=['exports','STRING','username','ENUM','integrationTab'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0x3f3c,0x1e0));var _0xc3f3=function(_0x2242dd,_0x2b4a96){_0x2242dd=_0x2242dd-0x0;var _0x3831a4=_0x3f3c[_0x2242dd];return _0x3831a4;};'use strict';var Sequelize=require('sequelize');module[_0xc3f3('0x0')]={'name':{'type':Sequelize[_0xc3f3('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc3f3('0x1')],'unique':_0xc3f3('0x2')},'remoteUri':{'type':Sequelize[_0xc3f3('0x1')]},'password':{'type':Sequelize[_0xc3f3('0x1')]},'clientId':{'type':Sequelize[_0xc3f3('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xc3f3('0x1')]},'serverUrl':{'type':Sequelize[_0xc3f3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc3f3('0x3')]('integrationTab','newTab'),'defaultValue':_0xc3f3('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 506400a..963bfee 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 _0x6010=['key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','addConfiguration','AccountId','channel','Descriptions','Subjects','SalesforceField','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','lastIndexOf','Connection','username','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','email','phone','remove','includes','custom','picklistValues','label','value','boolean','True','true','False','false','getFields,\x20%s,\x20%s,\x20%s','stringify','test','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type'];(function(_0x528497,_0x147e87){var _0x392d59=function(_0x47d9ec){while(--_0x47d9ec){_0x528497['push'](_0x528497['shift']());}};_0x392d59(++_0x147e87);}(_0x6010,0xca));var _0x0601=function(_0x586c4a,_0x348fb5){_0x586c4a=_0x586c4a-0x0;var _0x9612b2=_0x6010[_0x586c4a];return _0x9612b2;};'use strict';var emlformat=require(_0x0601('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0601('0x1'));var jsonpatch=require(_0x0601('0x2'));var rp=require(_0x0601('0x3'));var moment=require(_0x0601('0x4'));var BPromise=require(_0x0601('0x5'));var Mustache=require(_0x0601('0x6'));var util=require(_0x0601('0x7'));var path=require(_0x0601('0x8'));var sox=require(_0x0601('0x9'));var csv=require(_0x0601('0xa'));var ejs=require(_0x0601('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0601('0xc'));var crypto=require(_0x0601('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0601('0xe'));var toCsv=require(_0x0601('0xa'));var querystring=require('querystring');var Papa=require(_0x0601('0xf'));var Redis=require('ioredis');var authService=require(_0x0601('0x10'));var qs=require(_0x0601('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0601('0x12'));var logger=require('../../config/logger')(_0x0601('0x13'));var utils=require(_0x0601('0x14'));var config=require(_0x0601('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x8e62af,_0x4e20e7){_0x4e20e7=_0x4e20e7||0xcc;return function(_0x10ca96){if(_0x10ca96){return _0x8e62af[_0x0601('0x16')](_0x4e20e7);}return _0x8e62af[_0x0601('0x17')](_0x4e20e7)[_0x0601('0x18')]();};}function respondWithResult(_0x1129a1,_0x4a11e4){_0x4a11e4=_0x4a11e4||0xc8;return function(_0x302c90){if(_0x302c90){return _0x1129a1['status'](_0x4a11e4)['json'](_0x302c90);}};}function respondWithFilteredResult(_0x1f2e32,_0x28421f){return function(_0x2a6676){if(_0x2a6676){var _0x3a45af=typeof _0x28421f['offset']==='undefined'&&typeof _0x28421f[_0x0601('0x19')]===_0x0601('0x1a');var _0x61da1a=_0x2a6676[_0x0601('0x1b')];var _0x39d95a=_0x3a45af?0x0:_0x28421f['offset'];var _0x38d6b6=_0x3a45af?_0x2a6676[_0x0601('0x1b')]:_0x28421f[_0x0601('0x1c')]+_0x28421f[_0x0601('0x19')];var _0x2a8590;if(_0x38d6b6>=_0x61da1a){_0x38d6b6=_0x61da1a;_0x2a8590=0xc8;}else{_0x2a8590=0xce;}_0x1f2e32[_0x0601('0x17')](_0x2a8590);return _0x1f2e32[_0x0601('0x1d')](_0x0601('0x1e'),_0x39d95a+'-'+_0x38d6b6+'/'+_0x61da1a)[_0x0601('0x1f')](_0x2a6676);}return null;};}function patchUpdates(_0x1060ba){return function(_0x53e008){try{jsonpatch[_0x0601('0x20')](_0x53e008,_0x1060ba,!![]);}catch(_0x2cef59){return BPromise['reject'](_0x2cef59);}return _0x53e008[_0x0601('0x21')]();};}function saveUpdates(_0x4b90ba,_0x2692c0){return function(_0x2e2640){if(_0x2e2640){return _0x2e2640[_0x0601('0x22')](_0x4b90ba)[_0x0601('0x23')](function(_0x5f7f9c){return _0x5f7f9c;});}return null;};}function removeEntity(_0x249712,_0x52b5b0){return function(_0x415fd8){if(_0x415fd8){return _0x415fd8[_0x0601('0x24')]()[_0x0601('0x23')](function(){_0x249712[_0x0601('0x17')](0xcc)[_0x0601('0x18')]();});}};}function handleEntityNotFound(_0x8860eb,_0xe0e168){return function(_0x4a62af){if(!_0x4a62af){_0x8860eb[_0x0601('0x16')](0x194);}return _0x4a62af;};}function handleError(_0x3bcd16,_0x41126b){_0x41126b=_0x41126b||0x1f4;return function(_0x466a3e){logger['error'](_0x466a3e[_0x0601('0x25')]);if(_0x466a3e[_0x0601('0x26')]){delete _0x466a3e[_0x0601('0x26')];}_0x3bcd16[_0x0601('0x17')](_0x41126b)[_0x0601('0x27')](_0x466a3e);};}exports[_0x0601('0x28')]=function(_0x578689,_0x2c08f3){var _0x547d9c={},_0x234ae4={},_0xff96db={'count':0x0,'rows':[]};var _0x4a7332=_[_0x0601('0x29')](db[_0x0601('0x2a')][_0x0601('0x2b')],function(_0xf470c2){return{'name':_0xf470c2[_0x0601('0x2c')],'type':_0xf470c2[_0x0601('0x2d')][_0x0601('0x2e')]};});_0x234ae4[_0x0601('0x2f')]=_[_0x0601('0x29')](_0x4a7332,'name');_0x234ae4[_0x0601('0x30')]=_[_0x0601('0x31')](_0x578689['query']);_0x234ae4[_0x0601('0x32')]=_[_0x0601('0x33')](_0x234ae4[_0x0601('0x2f')],_0x234ae4[_0x0601('0x30')]);_0x547d9c[_0x0601('0x34')]=_[_0x0601('0x33')](_0x234ae4[_0x0601('0x2f')],qs[_0x0601('0x35')](_0x578689[_0x0601('0x30')][_0x0601('0x35')]));_0x547d9c['attributes']=_0x547d9c[_0x0601('0x34')]['length']?_0x547d9c[_0x0601('0x34')]:_0x234ae4['model'];if(!_0x578689[_0x0601('0x30')][_0x0601('0x36')](_0x0601('0x37'))){_0x547d9c[_0x0601('0x19')]=qs[_0x0601('0x19')](_0x578689[_0x0601('0x30')][_0x0601('0x19')]);_0x547d9c[_0x0601('0x1c')]=qs['offset'](_0x578689[_0x0601('0x30')][_0x0601('0x1c')]);}_0x547d9c[_0x0601('0x38')]=qs[_0x0601('0x39')](_0x578689[_0x0601('0x30')][_0x0601('0x39')]);_0x547d9c[_0x0601('0x3a')]=qs[_0x0601('0x32')](_['pick'](_0x578689['query'],_0x234ae4['filters']),_0x4a7332);if(_0x578689[_0x0601('0x30')][_0x0601('0x3b')]){_0x547d9c[_0x0601('0x3a')]=_['merge'](_0x547d9c[_0x0601('0x3a')],{'$or':_[_0x0601('0x29')](_0x4a7332,function(_0x4b2e7a){if(_0x4b2e7a[_0x0601('0x2d')]!==_0x0601('0x3c')){var _0x3e7bf7={};_0x3e7bf7[_0x4b2e7a['name']]={'$like':'%'+_0x578689[_0x0601('0x30')]['filter']+'%'};return _0x3e7bf7;}})});}_0x547d9c=_[_0x0601('0x3d')]({},_0x547d9c,_0x578689[_0x0601('0x3e')]);var _0x214f0f={'where':_0x547d9c[_0x0601('0x3a')]};return db[_0x0601('0x2a')]['count'](_0x214f0f)[_0x0601('0x23')](function(_0x452851){_0xff96db[_0x0601('0x1b')]=_0x452851;if(_0x578689['query']['includeAll']){_0x547d9c[_0x0601('0x3f')]=[{'all':!![]}];}return db[_0x0601('0x2a')][_0x0601('0x40')](_0x547d9c);})['then'](function(_0x4664ab){_0xff96db[_0x0601('0x41')]=_0x4664ab;return _0xff96db;})[_0x0601('0x23')](respondWithFilteredResult(_0x2c08f3,_0x547d9c))['catch'](handleError(_0x2c08f3,null));};exports[_0x0601('0x42')]=function(_0x19d347,_0x56a849){var _0x29a986={'raw':![],'where':{'id':_0x19d347[_0x0601('0x43')]['id']}},_0x262831={};_0x262831[_0x0601('0x2f')]=_[_0x0601('0x31')](db[_0x0601('0x2a')][_0x0601('0x2b')]);_0x262831[_0x0601('0x30')]=_[_0x0601('0x31')](_0x19d347['query']);_0x262831[_0x0601('0x32')]=_['intersection'](_0x262831[_0x0601('0x2f')],_0x262831[_0x0601('0x30')]);_0x29a986[_0x0601('0x34')]=_[_0x0601('0x33')](_0x262831[_0x0601('0x2f')],qs['fields'](_0x19d347[_0x0601('0x30')][_0x0601('0x35')]));_0x29a986[_0x0601('0x34')]=_0x29a986[_0x0601('0x34')][_0x0601('0x44')]?_0x29a986[_0x0601('0x34')]:_0x262831[_0x0601('0x2f')];if(_0x19d347['query'][_0x0601('0x45')]){_0x29a986[_0x0601('0x3f')]=[{'all':!![]}];}_0x29a986=_[_0x0601('0x3d')]({},_0x29a986,_0x19d347[_0x0601('0x3e')]);return db[_0x0601('0x2a')][_0x0601('0x46')](_0x29a986)[_0x0601('0x23')](handleEntityNotFound(_0x56a849,null))['then'](respondWithResult(_0x56a849,null))[_0x0601('0x47')](handleError(_0x56a849,null));};exports[_0x0601('0x48')]=function(_0x5c1463,_0x5b02d9){return db['SalesforceAccount'][_0x0601('0x48')](_0x5c1463[_0x0601('0x49')],{})[_0x0601('0x23')](respondWithResult(_0x5b02d9,0xc9))[_0x0601('0x47')](handleError(_0x5b02d9,null));};exports[_0x0601('0x22')]=function(_0x1641ed,_0xc1c6f7){if(_0x1641ed['body']['id']){delete _0x1641ed[_0x0601('0x49')]['id'];}return db[_0x0601('0x2a')][_0x0601('0x46')]({'where':{'id':_0x1641ed[_0x0601('0x43')]['id']}})[_0x0601('0x23')](handleEntityNotFound(_0xc1c6f7,null))[_0x0601('0x23')](saveUpdates(_0x1641ed['body'],null))[_0x0601('0x23')](respondWithResult(_0xc1c6f7,null))[_0x0601('0x47')](handleError(_0xc1c6f7,null));};exports[_0x0601('0x24')]=function(_0x167922,_0x344340){return db[_0x0601('0x2a')][_0x0601('0x46')]({'where':{'id':_0x167922[_0x0601('0x43')]['id']}})[_0x0601('0x23')](handleEntityNotFound(_0x344340,null))[_0x0601('0x23')](removeEntity(_0x344340,null))[_0x0601('0x47')](handleError(_0x344340,null));};exports[_0x0601('0x4a')]=function(_0x5b55dc,_0x522e15,_0x17462d){var _0x30c8ab={};var _0x8bdc30={};var _0xdf2fef;var _0x13ec37;return db[_0x0601('0x2a')][_0x0601('0x4b')]({'where':{'id':_0x5b55dc['params']['id']}})[_0x0601('0x23')](handleEntityNotFound(_0x522e15,null))['then'](function(_0x67148){if(_0x67148){_0xdf2fef=_0x67148;_0x8bdc30[_0x0601('0x2f')]=_[_0x0601('0x31')](db[_0x0601('0x4c')]['rawAttributes']);_0x8bdc30[_0x0601('0x30')]=_[_0x0601('0x31')](_0x5b55dc[_0x0601('0x30')]);_0x8bdc30[_0x0601('0x32')]=_[_0x0601('0x33')](_0x8bdc30['model'],_0x8bdc30['query']);_0x30c8ab['attributes']=_[_0x0601('0x33')](_0x8bdc30[_0x0601('0x2f')],qs[_0x0601('0x35')](_0x5b55dc[_0x0601('0x30')]['fields']));_0x30c8ab['attributes']=_0x30c8ab[_0x0601('0x34')]['length']?_0x30c8ab[_0x0601('0x34')]:_0x8bdc30[_0x0601('0x2f')];_0x30c8ab[_0x0601('0x38')]=qs[_0x0601('0x39')](_0x5b55dc[_0x0601('0x30')][_0x0601('0x39')]);_0x30c8ab['where']=qs['filters'](_[_0x0601('0x4d')](_0x5b55dc[_0x0601('0x30')],_0x8bdc30[_0x0601('0x32')]));if(_0x5b55dc[_0x0601('0x30')]['filter']){_0x30c8ab[_0x0601('0x3a')]=_[_0x0601('0x3d')](_0x30c8ab[_0x0601('0x3a')],{'$or':_[_0x0601('0x29')](_0x30c8ab[_0x0601('0x34')],function(_0x425016){var _0x9035e2={};_0x9035e2[_0x425016]={'$like':'%'+_0x5b55dc[_0x0601('0x30')]['filter']+'%'};return _0x9035e2;})});}_0x30c8ab=_[_0x0601('0x3d')]({},_0x30c8ab,_0x5b55dc[_0x0601('0x3e')]);return _0xdf2fef[_0x0601('0x4a')](_0x30c8ab);}})['then'](function(_0x15763b){if(_0x15763b){_0x13ec37=_0x15763b['length'];if(!_0x5b55dc['query'][_0x0601('0x36')](_0x0601('0x37'))){_0x30c8ab['limit']=qs[_0x0601('0x19')](_0x5b55dc[_0x0601('0x30')][_0x0601('0x19')]);_0x30c8ab['offset']=qs[_0x0601('0x1c')](_0x5b55dc['query']['offset']);}return _0xdf2fef[_0x0601('0x4a')](_0x30c8ab);}})[_0x0601('0x23')](function(_0x254946){if(_0x254946){return _0x254946?{'count':_0x13ec37,'rows':_0x254946}:null;}})[_0x0601('0x23')](respondWithResult(_0x522e15,null))[_0x0601('0x47')](handleError(_0x522e15,null));};exports[_0x0601('0x4e')]=function(_0x52f18d,_0x594db5,_0x55fe70){if(_0x52f18d[_0x0601('0x49')]['id']){delete _0x52f18d['body']['id'];}return db[_0x0601('0x2a')][_0x0601('0x4b')]({'where':{'id':_0x52f18d['params']['id']}})[_0x0601('0x23')](handleEntityNotFound(_0x594db5,null))[_0x0601('0x23')](function(_0x31eaea){if(_0x31eaea){_0x52f18d['body'][_0x0601('0x4f')]=_0x31eaea['id'];_0x52f18d['body']['Subjects']=integrations['getSubjects'](_0x52f18d[_0x0601('0x49')][_0x0601('0x50')],_0x52f18d['body'][_0x0601('0x2d')]);_0x52f18d[_0x0601('0x49')][_0x0601('0x51')]=integrations['getDescriptions'](_0x52f18d[_0x0601('0x49')][_0x0601('0x50')],_0x52f18d['body']['type']);return db[_0x0601('0x4c')]['create'](_0x52f18d['body'],{'include':[{'model':db['SalesforceField'],'as':_0x0601('0x52')},{'model':db[_0x0601('0x53')],'as':_0x0601('0x51')}]});}return null;})[_0x0601('0x23')](respondWithResult(_0x594db5,null))[_0x0601('0x47')](handleError(_0x594db5,null));};exports['getFields']=function(_0x20d94f,_0x1fe6ab,_0x240d99){var _0x1be173;var _0x39c054='';var _0x2696df=_0x0601('0x54');return db[_0x0601('0x2a')][_0x0601('0x4b')]({'where':{'id':_0x20d94f[_0x0601('0x43')]['id']},'attributes':['id',_0x0601('0x55'),_0x0601('0x56'),_0x0601('0x57'),'username',_0x0601('0x58'),_0x0601('0x59')]})[_0x0601('0x23')](handleEntityNotFound(_0x1fe6ab,null))[_0x0601('0x23')](function(_0x40f43e){if(_0x40f43e){_0x39c054=_0x40f43e[_0x0601('0x55')];var _0x3f65c1=_0x39c054[_0x0601('0x5a')](-0x1);if(_0x3f65c1==='/'){_0x39c054=_0x39c054[_0x0601('0x5b')](0x0,_0x39c054[_0x0601('0x5c')](_0x3f65c1));}_0x1be173=new jsforce[(_0x0601('0x5d'))]({'oauth2':{'loginUrl':_0x39c054,'clientId':_0x40f43e['clientId'],'clientSecret':_0x40f43e[_0x0601('0x57')]}});return _0x1be173['login'](_0x40f43e[_0x0601('0x5e')],_0x40f43e[_0x0601('0x58')]['concat'](_0x40f43e['securityToken']));}})[_0x0601('0x23')](function(_0x538bda){if(_0x538bda){if(!_[_0x0601('0x5f')](_0x20d94f[_0x0601('0x30')]['ticketType'])){_0x2696df=_0x20d94f[_0x0601('0x30')][_0x0601('0x60')];}return _0x1be173[_0x0601('0x61')](_0x2696df)[_0x0601('0x62')]();}})[_0x0601('0x23')](function(_0x1f904d){var _0x4745d4=[_0x0601('0x63'),_0x0601('0x64'),_0x0601('0x65'),_0x0601('0x66'),_0x0601('0x67'),_0x0601('0x68')];var _0x3f9f9e=[_0x0601('0x69'),'int',_0x0601('0x6a'),'boolean',_0x0601('0x6b'),'textarea',_0x0601('0x6c')];if(_0x1f904d){_[_0x0601('0x6d')](_0x1f904d[_0x0601('0x35')],function(_0x2f27a5){return _0x4745d4[_0x0601('0x6e')](_0x2f27a5['name'])||!_0x3f9f9e[_0x0601('0x6e')](_0x2f27a5['type']);});return{'count':_0x1f904d[_0x0601('0x35')][_0x0601('0x44')],'rows':_['map'](_0x1f904d[_0x0601('0x35')],function(_0x13173a){return{'id':_0x13173a[_0x0601('0x26')],'name':_0x13173a['label'],'custom':_0x13173a[_0x0601('0x6f')],'options':_0x13173a[_0x0601('0x70')][_0x0601('0x44')]>0x0?_[_0x0601('0x29')](_0x13173a[_0x0601('0x70')],function(_0x1ba0a5){return{'name':_0x1ba0a5[_0x0601('0x71')],'value':_0x1ba0a5[_0x0601('0x72')]};}):_0x13173a['type']==_0x0601('0x73')?[{'name':_0x0601('0x74'),'value':_0x0601('0x75')},{'name':_0x0601('0x76'),'value':_0x0601('0x77')}]:[]};})};}})[_0x0601('0x23')](respondWithResult(_0x1fe6ab,null))[_0x0601('0x47')](function(_0x50e014){var _0x1c6dc2=_0x20d94f[_0x0601('0x30')]['test']?0x1f4:_0x50e014['statusCode']||0x1f4;logger['error'](_0x0601('0x78'),'getFields',_0x1c6dc2,JSON[_0x0601('0x79')](_0x50e014));delete _0x50e014['name'];if(_0x1c6dc2===0x191){_0x1c6dc2=0x190;}_0x1fe6ab[_0x0601('0x17')](_0x1c6dc2)[_0x0601('0x27')](_0x20d94f['query'][_0x0601('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x50e014[_0x0601('0x7b')]}:_0x50e014);});}; \ No newline at end of file +var _0xec25=['../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SalesforceAccount','type','key','model','keys','filters','query','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','show','params','rawAttributes','includeAll','find','catch','create','body','getConfigurations','SalesforceConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','string','picklist','boolean','email','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x227b05,_0x2897c2){var _0x22b2c0=function(_0x37d6ca){while(--_0x37d6ca){_0x227b05['push'](_0x227b05['shift']());}};_0x22b2c0(++_0x2897c2);}(_0xec25,0xe2));var _0x5ec2=function(_0x278e46,_0x5c27e4){_0x278e46=_0x278e46-0x0;var _0x2c77cf=_0xec25[_0x278e46];return _0x2c77cf;};'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(_0x5ec2('0x0'));var moment=require(_0x5ec2('0x1'));var BPromise=require(_0x5ec2('0x2'));var Mustache=require(_0x5ec2('0x3'));var util=require(_0x5ec2('0x4'));var path=require(_0x5ec2('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5ec2('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ec2('0x7'));var squel=require(_0x5ec2('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5ec2('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5ec2('0xa'));var Redis=require(_0x5ec2('0xb'));var authService=require(_0x5ec2('0xc'));var qs=require(_0x5ec2('0xd'));var as=require(_0x5ec2('0xe'));var hardwareService=require(_0x5ec2('0xf'));var logger=require(_0x5ec2('0x10'))(_0x5ec2('0x11'));var utils=require('../../config/utils');var config=require(_0x5ec2('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5ec2('0x13'))['db'];var integrations=require(_0x5ec2('0x14'));function respondWithStatusCode(_0x51431e,_0x541744){_0x541744=_0x541744||0xcc;return function(_0xaa416d){if(_0xaa416d){return _0x51431e[_0x5ec2('0x15')](_0x541744);}return _0x51431e['status'](_0x541744)['end']();};}function respondWithResult(_0x31b98b,_0x318d7e){_0x318d7e=_0x318d7e||0xc8;return function(_0x5f7e6b){if(_0x5f7e6b){return _0x31b98b['status'](_0x318d7e)[_0x5ec2('0x16')](_0x5f7e6b);}};}function respondWithFilteredResult(_0x2edcb3,_0x478024){return function(_0x24dfc9){if(_0x24dfc9){var _0x491787=typeof _0x478024[_0x5ec2('0x17')]===_0x5ec2('0x18')&&typeof _0x478024[_0x5ec2('0x19')]===_0x5ec2('0x18');var _0x29fff9=_0x24dfc9[_0x5ec2('0x1a')];var _0x47ec40=_0x491787?0x0:_0x478024[_0x5ec2('0x17')];var _0x3fe44c=_0x491787?_0x24dfc9['count']:_0x478024[_0x5ec2('0x17')]+_0x478024[_0x5ec2('0x19')];var _0x4b4fa1;if(_0x3fe44c>=_0x29fff9){_0x3fe44c=_0x29fff9;_0x4b4fa1=0xc8;}else{_0x4b4fa1=0xce;}_0x2edcb3[_0x5ec2('0x1b')](_0x4b4fa1);return _0x2edcb3[_0x5ec2('0x1c')](_0x5ec2('0x1d'),_0x47ec40+'-'+_0x3fe44c+'/'+_0x29fff9)[_0x5ec2('0x16')](_0x24dfc9);}return null;};}function patchUpdates(_0x594855){return function(_0x5cf65b){try{jsonpatch[_0x5ec2('0x1e')](_0x5cf65b,_0x594855,!![]);}catch(_0x126fa7){return BPromise[_0x5ec2('0x1f')](_0x126fa7);}return _0x5cf65b[_0x5ec2('0x20')]();};}function saveUpdates(_0x48ab2a,_0x4bb256){return function(_0x4a2d90){if(_0x4a2d90){return _0x4a2d90[_0x5ec2('0x21')](_0x48ab2a)[_0x5ec2('0x22')](function(_0xe61692){return _0xe61692;});}return null;};}function removeEntity(_0x1d0a9e,_0x5b0204){return function(_0x1e8e59){if(_0x1e8e59){return _0x1e8e59[_0x5ec2('0x23')]()['then'](function(){_0x1d0a9e[_0x5ec2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b6d8e,_0x8d3a75){return function(_0x4e29a0){if(!_0x4e29a0){_0x5b6d8e[_0x5ec2('0x15')](0x194);}return _0x4e29a0;};}function handleError(_0x572ba9,_0x2e4da8){_0x2e4da8=_0x2e4da8||0x1f4;return function(_0x5809b3){logger[_0x5ec2('0x24')](_0x5809b3[_0x5ec2('0x25')]);if(_0x5809b3['name']){delete _0x5809b3[_0x5ec2('0x26')];}_0x572ba9[_0x5ec2('0x1b')](_0x2e4da8)['send'](_0x5809b3);};}exports[_0x5ec2('0x27')]=function(_0x192241,_0x8b5808){var _0x3c20d6={},_0x27e7ee={},_0x2caaa0={'count':0x0,'rows':[]};var _0xb3dc27=_[_0x5ec2('0x28')](db[_0x5ec2('0x29')]['rawAttributes'],function(_0x41082f){return{'name':_0x41082f['fieldName'],'type':_0x41082f[_0x5ec2('0x2a')][_0x5ec2('0x2b')]};});_0x27e7ee[_0x5ec2('0x2c')]=_[_0x5ec2('0x28')](_0xb3dc27,_0x5ec2('0x26'));_0x27e7ee['query']=_[_0x5ec2('0x2d')](_0x192241['query']);_0x27e7ee[_0x5ec2('0x2e')]=_['intersection'](_0x27e7ee['model'],_0x27e7ee[_0x5ec2('0x2f')]);_0x3c20d6['attributes']=_[_0x5ec2('0x30')](_0x27e7ee['model'],qs[_0x5ec2('0x31')](_0x192241[_0x5ec2('0x2f')]['fields']));_0x3c20d6[_0x5ec2('0x32')]=_0x3c20d6[_0x5ec2('0x32')][_0x5ec2('0x33')]?_0x3c20d6[_0x5ec2('0x32')]:_0x27e7ee[_0x5ec2('0x2c')];if(!_0x192241[_0x5ec2('0x2f')]['hasOwnProperty'](_0x5ec2('0x34'))){_0x3c20d6['limit']=qs[_0x5ec2('0x19')](_0x192241['query'][_0x5ec2('0x19')]);_0x3c20d6[_0x5ec2('0x17')]=qs[_0x5ec2('0x17')](_0x192241[_0x5ec2('0x2f')][_0x5ec2('0x17')]);}_0x3c20d6[_0x5ec2('0x35')]=qs['sort'](_0x192241[_0x5ec2('0x2f')][_0x5ec2('0x36')]);_0x3c20d6['where']=qs['filters'](_[_0x5ec2('0x37')](_0x192241['query'],_0x27e7ee[_0x5ec2('0x2e')]),_0xb3dc27);if(_0x192241[_0x5ec2('0x2f')]['filter']){_0x3c20d6[_0x5ec2('0x38')]=_[_0x5ec2('0x39')](_0x3c20d6[_0x5ec2('0x38')],{'$or':_[_0x5ec2('0x28')](_0xb3dc27,function(_0x5541cc){if(_0x5541cc[_0x5ec2('0x2a')]!==_0x5ec2('0x3a')){var _0x459a08={};_0x459a08[_0x5541cc[_0x5ec2('0x26')]]={'$like':'%'+_0x192241[_0x5ec2('0x2f')][_0x5ec2('0x3b')]+'%'};return _0x459a08;}})});}_0x3c20d6=_[_0x5ec2('0x39')]({},_0x3c20d6,_0x192241[_0x5ec2('0x3c')]);var _0x5f551a={'where':_0x3c20d6[_0x5ec2('0x38')]};return db[_0x5ec2('0x29')][_0x5ec2('0x1a')](_0x5f551a)[_0x5ec2('0x22')](function(_0x4bf6a3){_0x2caaa0[_0x5ec2('0x1a')]=_0x4bf6a3;if(_0x192241[_0x5ec2('0x2f')]['includeAll']){_0x3c20d6[_0x5ec2('0x3d')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x5ec2('0x3e')](_0x3c20d6);})[_0x5ec2('0x22')](function(_0x4e9688){_0x2caaa0['rows']=_0x4e9688;return _0x2caaa0;})[_0x5ec2('0x22')](respondWithFilteredResult(_0x8b5808,_0x3c20d6))['catch'](handleError(_0x8b5808,null));};exports[_0x5ec2('0x3f')]=function(_0x356d7f,_0x20d09f){var _0x4cf786={'raw':![],'where':{'id':_0x356d7f[_0x5ec2('0x40')]['id']}},_0x27c1ae={};_0x27c1ae['model']=_[_0x5ec2('0x2d')](db[_0x5ec2('0x29')][_0x5ec2('0x41')]);_0x27c1ae[_0x5ec2('0x2f')]=_[_0x5ec2('0x2d')](_0x356d7f['query']);_0x27c1ae[_0x5ec2('0x2e')]=_[_0x5ec2('0x30')](_0x27c1ae[_0x5ec2('0x2c')],_0x27c1ae['query']);_0x4cf786[_0x5ec2('0x32')]=_['intersection'](_0x27c1ae[_0x5ec2('0x2c')],qs[_0x5ec2('0x31')](_0x356d7f['query']['fields']));_0x4cf786[_0x5ec2('0x32')]=_0x4cf786[_0x5ec2('0x32')]['length']?_0x4cf786['attributes']:_0x27c1ae['model'];if(_0x356d7f[_0x5ec2('0x2f')][_0x5ec2('0x42')]){_0x4cf786[_0x5ec2('0x3d')]=[{'all':!![]}];}_0x4cf786=_[_0x5ec2('0x39')]({},_0x4cf786,_0x356d7f[_0x5ec2('0x3c')]);return db[_0x5ec2('0x29')][_0x5ec2('0x43')](_0x4cf786)['then'](handleEntityNotFound(_0x20d09f,null))[_0x5ec2('0x22')](respondWithResult(_0x20d09f,null))[_0x5ec2('0x44')](handleError(_0x20d09f,null));};exports[_0x5ec2('0x45')]=function(_0x22cd73,_0x1a7373){return db[_0x5ec2('0x29')][_0x5ec2('0x45')](_0x22cd73[_0x5ec2('0x46')],{})[_0x5ec2('0x22')](respondWithResult(_0x1a7373,0xc9))[_0x5ec2('0x44')](handleError(_0x1a7373,null));};exports['update']=function(_0x148a1c,_0x47e8a9){if(_0x148a1c[_0x5ec2('0x46')]['id']){delete _0x148a1c['body']['id'];}return db[_0x5ec2('0x29')]['find']({'where':{'id':_0x148a1c['params']['id']}})[_0x5ec2('0x22')](handleEntityNotFound(_0x47e8a9,null))[_0x5ec2('0x22')](saveUpdates(_0x148a1c[_0x5ec2('0x46')],null))[_0x5ec2('0x22')](respondWithResult(_0x47e8a9,null))[_0x5ec2('0x44')](handleError(_0x47e8a9,null));};exports[_0x5ec2('0x23')]=function(_0x23996a,_0x5bbf1f){return db[_0x5ec2('0x29')][_0x5ec2('0x43')]({'where':{'id':_0x23996a['params']['id']}})[_0x5ec2('0x22')](handleEntityNotFound(_0x5bbf1f,null))[_0x5ec2('0x22')](removeEntity(_0x5bbf1f,null))[_0x5ec2('0x44')](handleError(_0x5bbf1f,null));};exports[_0x5ec2('0x47')]=function(_0x2254bc,_0x2f60bb,_0x20ce1d){var _0x6fd728={};var _0x41ef09={};var _0x4144bb;var _0x995433;return db['SalesforceAccount']['findOne']({'where':{'id':_0x2254bc[_0x5ec2('0x40')]['id']}})[_0x5ec2('0x22')](handleEntityNotFound(_0x2f60bb,null))['then'](function(_0x30ce47){if(_0x30ce47){_0x4144bb=_0x30ce47;_0x41ef09[_0x5ec2('0x2c')]=_[_0x5ec2('0x2d')](db[_0x5ec2('0x48')][_0x5ec2('0x41')]);_0x41ef09['query']=_[_0x5ec2('0x2d')](_0x2254bc[_0x5ec2('0x2f')]);_0x41ef09['filters']=_[_0x5ec2('0x30')](_0x41ef09[_0x5ec2('0x2c')],_0x41ef09[_0x5ec2('0x2f')]);_0x6fd728['attributes']=_[_0x5ec2('0x30')](_0x41ef09[_0x5ec2('0x2c')],qs['fields'](_0x2254bc['query']['fields']));_0x6fd728[_0x5ec2('0x32')]=_0x6fd728[_0x5ec2('0x32')][_0x5ec2('0x33')]?_0x6fd728[_0x5ec2('0x32')]:_0x41ef09[_0x5ec2('0x2c')];_0x6fd728[_0x5ec2('0x35')]=qs[_0x5ec2('0x36')](_0x2254bc[_0x5ec2('0x2f')][_0x5ec2('0x36')]);_0x6fd728[_0x5ec2('0x38')]=qs[_0x5ec2('0x2e')](_['pick'](_0x2254bc[_0x5ec2('0x2f')],_0x41ef09[_0x5ec2('0x2e')]));if(_0x2254bc[_0x5ec2('0x2f')][_0x5ec2('0x3b')]){_0x6fd728[_0x5ec2('0x38')]=_[_0x5ec2('0x39')](_0x6fd728['where'],{'$or':_[_0x5ec2('0x28')](_0x6fd728['attributes'],function(_0xe95ff2){var _0x5a1259={};_0x5a1259[_0xe95ff2]={'$like':'%'+_0x2254bc[_0x5ec2('0x2f')]['filter']+'%'};return _0x5a1259;})});}_0x6fd728=_[_0x5ec2('0x39')]({},_0x6fd728,_0x2254bc[_0x5ec2('0x3c')]);return _0x4144bb[_0x5ec2('0x47')](_0x6fd728);}})[_0x5ec2('0x22')](function(_0x37d024){if(_0x37d024){_0x995433=_0x37d024[_0x5ec2('0x33')];if(!_0x2254bc[_0x5ec2('0x2f')][_0x5ec2('0x49')](_0x5ec2('0x34'))){_0x6fd728['limit']=qs[_0x5ec2('0x19')](_0x2254bc[_0x5ec2('0x2f')]['limit']);_0x6fd728[_0x5ec2('0x17')]=qs[_0x5ec2('0x17')](_0x2254bc['query'][_0x5ec2('0x17')]);}return _0x4144bb[_0x5ec2('0x47')](_0x6fd728);}})[_0x5ec2('0x22')](function(_0x2d7192){if(_0x2d7192){return _0x2d7192?{'count':_0x995433,'rows':_0x2d7192}:null;}})[_0x5ec2('0x22')](respondWithResult(_0x2f60bb,null))[_0x5ec2('0x44')](handleError(_0x2f60bb,null));};exports[_0x5ec2('0x4a')]=function(_0x1f6d36,_0x3ea8b4,_0x3cac50){if(_0x1f6d36[_0x5ec2('0x46')]['id']){delete _0x1f6d36[_0x5ec2('0x46')]['id'];}return db['SalesforceAccount'][_0x5ec2('0x4b')]({'where':{'id':_0x1f6d36[_0x5ec2('0x40')]['id']}})[_0x5ec2('0x22')](handleEntityNotFound(_0x3ea8b4,null))[_0x5ec2('0x22')](function(_0x341486){if(_0x341486){_0x1f6d36[_0x5ec2('0x46')][_0x5ec2('0x4c')]=_0x341486['id'];_0x1f6d36['body'][_0x5ec2('0x4d')]=integrations[_0x5ec2('0x4e')](_0x1f6d36[_0x5ec2('0x46')][_0x5ec2('0x4f')],_0x1f6d36['body'][_0x5ec2('0x2a')]);_0x1f6d36[_0x5ec2('0x46')][_0x5ec2('0x50')]=integrations[_0x5ec2('0x51')](_0x1f6d36['body'][_0x5ec2('0x4f')],_0x1f6d36['body'][_0x5ec2('0x2a')]);return db['SalesforceConfiguration'][_0x5ec2('0x45')](_0x1f6d36[_0x5ec2('0x46')],{'include':[{'model':db[_0x5ec2('0x52')],'as':_0x5ec2('0x4d')},{'model':db[_0x5ec2('0x52')],'as':_0x5ec2('0x50')}]});}return null;})[_0x5ec2('0x22')](respondWithResult(_0x3ea8b4,null))[_0x5ec2('0x44')](handleError(_0x3ea8b4,null));};exports['getFields']=function(_0xc0188b,_0x29a706,_0x2c0e11){var _0x3cb9c6;var _0x1df6dc='';var _0x39f62f=_0x5ec2('0x53');return db['SalesforceAccount'][_0x5ec2('0x4b')]({'where':{'id':_0xc0188b['params']['id']},'attributes':['id',_0x5ec2('0x54'),_0x5ec2('0x55'),_0x5ec2('0x56'),_0x5ec2('0x57'),_0x5ec2('0x58'),_0x5ec2('0x59')]})[_0x5ec2('0x22')](handleEntityNotFound(_0x29a706,null))[_0x5ec2('0x22')](function(_0x37be91){if(_0x37be91){_0x1df6dc=_0x37be91['remoteUri'];var _0x2904f1=_0x1df6dc['slice'](-0x1);if(_0x2904f1==='/'){_0x1df6dc=_0x1df6dc[_0x5ec2('0x5a')](0x0,_0x1df6dc[_0x5ec2('0x5b')](_0x2904f1));}_0x3cb9c6=new jsforce[(_0x5ec2('0x5c'))]({'oauth2':{'loginUrl':_0x1df6dc,'clientId':_0x37be91['clientId'],'clientSecret':_0x37be91[_0x5ec2('0x56')]}});return _0x3cb9c6[_0x5ec2('0x5d')](_0x37be91[_0x5ec2('0x57')],_0x37be91[_0x5ec2('0x58')][_0x5ec2('0x5e')](_0x37be91[_0x5ec2('0x59')]));}})[_0x5ec2('0x22')](function(_0x3a12c3){if(_0x3a12c3){if(!_[_0x5ec2('0x5f')](_0xc0188b[_0x5ec2('0x2f')][_0x5ec2('0x60')])){_0x39f62f=_0xc0188b[_0x5ec2('0x2f')]['ticketType'];}return _0x3cb9c6[_0x5ec2('0x61')](_0x39f62f)[_0x5ec2('0x62')]();}})['then'](function(_0x4aa032){var _0x43c602=[_0x5ec2('0x63'),_0x5ec2('0x64'),_0x5ec2('0x65'),_0x5ec2('0x66'),'Subject',_0x5ec2('0x67')];var _0x3dfad3=[_0x5ec2('0x68'),'int',_0x5ec2('0x69'),_0x5ec2('0x6a'),_0x5ec2('0x6b'),'textarea','phone'];if(_0x4aa032){_[_0x5ec2('0x6c')](_0x4aa032[_0x5ec2('0x31')],function(_0x3dfe0b){return _0x43c602[_0x5ec2('0x6d')](_0x3dfe0b['name'])||!_0x3dfad3[_0x5ec2('0x6d')](_0x3dfe0b[_0x5ec2('0x2a')]);});return{'count':_0x4aa032[_0x5ec2('0x31')][_0x5ec2('0x33')],'rows':_[_0x5ec2('0x28')](_0x4aa032[_0x5ec2('0x31')],function(_0x49a68b){return{'id':_0x49a68b[_0x5ec2('0x26')],'name':_0x49a68b[_0x5ec2('0x6e')],'custom':_0x49a68b[_0x5ec2('0x6f')],'options':_0x49a68b[_0x5ec2('0x70')][_0x5ec2('0x33')]>0x0?_[_0x5ec2('0x28')](_0x49a68b[_0x5ec2('0x70')],function(_0xd3820e){return{'name':_0xd3820e[_0x5ec2('0x6e')],'value':_0xd3820e[_0x5ec2('0x71')]};}):_0x49a68b[_0x5ec2('0x2a')]=='boolean'?[{'name':_0x5ec2('0x72'),'value':_0x5ec2('0x73')},{'name':_0x5ec2('0x74'),'value':_0x5ec2('0x75')}]:[]};})};}})[_0x5ec2('0x22')](respondWithResult(_0x29a706,null))['catch'](function(_0x471c5f){var _0x12c41f=_0xc0188b[_0x5ec2('0x2f')][_0x5ec2('0x76')]?0x1f4:_0x471c5f[_0x5ec2('0x77')]||0x1f4;logger[_0x5ec2('0x24')](_0x5ec2('0x78'),'getFields',_0x12c41f,JSON[_0x5ec2('0x79')](_0x471c5f));delete _0x471c5f[_0x5ec2('0x26')];if(_0x12c41f===0x191){_0x12c41f=0x190;}_0x29a706['status'](_0x12c41f)['send'](_0xc0188b[_0x5ec2('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x471c5f[_0x5ec2('0x77')]}:_0x471c5f);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index cb54439..d9bb2bf 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 _0x7aaa=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','util'];(function(_0x1c6d25,_0x4f911b){var _0x452347=function(_0x181795){while(--_0x181795){_0x1c6d25['push'](_0x1c6d25['shift']());}};_0x452347(++_0x4f911b);}(_0x7aaa,0xcf));var _0xa7aa=function(_0x52a0e4,_0x9c292f){_0x52a0e4=_0x52a0e4-0x0;var _0x28b930=_0x7aaa[_0x52a0e4];return _0x28b930;};'use strict';var _=require('lodash');var util=require(_0xa7aa('0x0'));var logger=require(_0xa7aa('0x1'))(_0xa7aa('0x2'));var moment=require('moment');var BPromise=require(_0xa7aa('0x3'));var rp=require(_0xa7aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa7aa('0x5'));var config=require(_0xa7aa('0x6'));var attributes=require(_0xa7aa('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xf6a433,_0x15306b){return _0xf6a433['define']('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbdc=['api','moment','bluebird','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util'];(function(_0x27a624,_0x3c2ef9){var _0x52b443=function(_0xabe589){while(--_0xabe589){_0x27a624['push'](_0x27a624['shift']());}};_0x52b443(++_0x3c2ef9);}(_0xbbdc,0xca));var _0xcbbd=function(_0x10b317,_0x2adf32){_0x10b317=_0x10b317-0x0;var _0x1e3054=_0xbbdc[_0x10b317];return _0x1e3054;};'use strict';var _=require(_0xcbbd('0x0'));var util=require(_0xcbbd('0x1'));var logger=require('../../config/logger')(_0xcbbd('0x2'));var moment=require(_0xcbbd('0x3'));var BPromise=require(_0xcbbd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcbbd('0x5'));var config=require(_0xcbbd('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xcbbd('0x7'));module[_0xcbbd('0x8')]=function(_0xa774b9,_0x1724f4){return _0xa774b9[_0xcbbd('0x9')](_0xcbbd('0xa'),attributes,{'tableName':_0xcbbd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index e2c9d81..a0d6e0a 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 _0x175b=['result','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model','catch','find','raw','then','ShowSalesforceAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x175b,0x141));var _0xb175=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x175b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xb175('0x0'));var util=require(_0xb175('0x1'));var moment=require(_0xb175('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb175('0x3'));var db=require(_0xb175('0x4'))['db'];var utils=require(_0xb175('0x5'));var logger=require(_0xb175('0x6'))(_0xb175('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb175('0x8')][_0xb175('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a464c,_0x46d00a,_0x24a0b2){return new BPromise(function(_0x7ffdd0,_0x4c28c0){return client[_0xb175('0xa')](_0x4a464c,_0x24a0b2)['then'](function(_0x51c8f1){logger[_0xb175('0xb')](_0xb175('0xc'),_0x46d00a,_0xb175('0xd'));logger[_0xb175('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x46d00a,_0xb175('0xd'),JSON[_0xb175('0xf')](_0x51c8f1));if(_0x51c8f1['error']){if(_0x51c8f1[_0xb175('0x10')][_0xb175('0x11')]===0x1f4){logger['error'](_0xb175('0xc'),_0x46d00a,_0x51c8f1[_0xb175('0x10')][_0xb175('0x12')]);return _0x4c28c0(_0x51c8f1[_0xb175('0x10')][_0xb175('0x12')]);}logger[_0xb175('0x10')](_0xb175('0xc'),_0x46d00a,_0x51c8f1['error'][_0xb175('0x12')]);return _0x7ffdd0(_0x51c8f1[_0xb175('0x10')]['message']);}else{logger[_0xb175('0xb')](_0xb175('0xc'),_0x46d00a,'request\x20sent');_0x7ffdd0(_0x51c8f1[_0xb175('0x13')][_0xb175('0x12')]);}})['catch'](function(_0x13d4de){logger[_0xb175('0x10')](_0xb175('0xc'),_0x46d00a,_0x13d4de);_0x4c28c0(_0x13d4de);});});}exports['GetSalesforceAccount']=function(_0x4dc439){var _0x54b7d0=this;return new Promise(function(_0x3b3a75,_0xf10080){return db[_0xb175('0x14')][_0xb175('0x15')]({'raw':_0x4dc439[_0xb175('0x16')]?_0x4dc439[_0xb175('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4dc439[_0xb175('0x16')]?_0x4dc439[_0xb175('0x16')][_0xb175('0x17')]||null:null,'attributes':_0x4dc439[_0xb175('0x16')]?_0x4dc439['options'][_0xb175('0x18')]||null:null,'limit':_0x4dc439[_0xb175('0x16')]?_0x4dc439[_0xb175('0x16')][_0xb175('0x19')]||null:null,'include':_0x4dc439['options']?_0x4dc439[_0xb175('0x16')][_0xb175('0x1a')]?_[_0xb175('0x1b')](_0x4dc439['options']['include'],function(_0x30d02e){return{'model':db[_0x30d02e['model']],'as':_0x30d02e['as'],'attributes':_0x30d02e[_0xb175('0x18')],'include':_0x30d02e[_0xb175('0x1a')]?_[_0xb175('0x1b')](_0x30d02e['include'],function(_0x21b703){return{'model':db[_0x21b703[_0xb175('0x1c')]],'as':_0x21b703['as'],'attributes':_0x21b703[_0xb175('0x18')],'include':_0x21b703[_0xb175('0x1a')]?_['map'](_0x21b703[_0xb175('0x1a')],function(_0x32ebfa){return{'model':db[_0x32ebfa[_0xb175('0x1c')]],'as':_0x32ebfa['as'],'attributes':_0x32ebfa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cc2c5){logger[_0xb175('0xb')]('GetSalesforceAccount',_0x4dc439);logger[_0xb175('0xe')]('GetSalesforceAccount',_0x4dc439,JSON[_0xb175('0xf')](_0x3cc2c5));_0x3b3a75(_0x3cc2c5);})[_0xb175('0x1d')](function(_0xf8811b){logger[_0xb175('0x10')]('GetSalesforceAccount',_0xf8811b['message'],_0x4dc439);_0xf10080(_0x54b7d0[_0xb175('0x10')](0x1f4,_0xf8811b[_0xb175('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x4d3892){var _0x15f5dd=this;return new Promise(function(_0x516223,_0x30a3f1){return db[_0xb175('0x14')][_0xb175('0x1e')]({'raw':_0x4d3892[_0xb175('0x16')]?_0x4d3892[_0xb175('0x16')][_0xb175('0x1f')]===undefined?!![]:![]:!![],'where':_0x4d3892['options']?_0x4d3892[_0xb175('0x16')][_0xb175('0x17')]||null:null,'attributes':_0x4d3892[_0xb175('0x16')]?_0x4d3892['options']['attributes']||null:null,'include':_0x4d3892[_0xb175('0x16')]?_0x4d3892[_0xb175('0x16')][_0xb175('0x1a')]?_['map'](_0x4d3892[_0xb175('0x16')][_0xb175('0x1a')],function(_0x195331){return{'model':db[_0x195331['model']],'as':_0x195331['as'],'attributes':_0x195331['attributes'],'include':_0x195331[_0xb175('0x1a')]?_[_0xb175('0x1b')](_0x195331['include'],function(_0x4f1c26){return{'model':db[_0x4f1c26['model']],'as':_0x4f1c26['as'],'attributes':_0x4f1c26['attributes'],'include':_0x4f1c26[_0xb175('0x1a')]?_['map'](_0x4f1c26[_0xb175('0x1a')],function(_0xbc4e21){return{'model':db[_0xbc4e21['model']],'as':_0xbc4e21['as'],'attributes':_0xbc4e21[_0xb175('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb175('0x20')](function(_0x8ebbee){logger['info'](_0xb175('0x21'),_0x4d3892);logger[_0xb175('0xe')]('ShowSalesforceAccount',_0x4d3892,JSON[_0xb175('0xf')](_0x8ebbee));_0x516223(_0x8ebbee);})[_0xb175('0x1d')](function(_0x829c78){logger[_0xb175('0x10')](_0xb175('0x21'),_0x829c78[_0xb175('0x12')],_0x4d3892);_0x30a3f1(_0x15f5dd[_0xb175('0x10')](0x1f4,_0x829c78[_0xb175('0x12')]));});});}; \ No newline at end of file +var _0x929e=['info','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceAccount,\x20%s,\x20%s','result','catch','GetSalesforceAccount','options','raw','where','attributes','limit','include','map','model','then','debug','ShowSalesforceAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3f32b0,_0x43869d){var _0x487060=function(_0x37dddf){while(--_0x37dddf){_0x3f32b0['push'](_0x3f32b0['shift']());}};_0x487060(++_0x43869d);}(_0x929e,0x76));var _0xe929=function(_0xae4e5e,_0x522b99){_0xae4e5e=_0xae4e5e-0x0;var _0x456240=_0x929e[_0xae4e5e];return _0x456240;};'use strict';var _=require('lodash');var util=require(_0xe929('0x0'));var moment=require(_0xe929('0x1'));var BPromise=require('bluebird');var rs=require(_0xe929('0x2'));var fs=require('fs');var Redis=require(_0xe929('0x3'));var db=require(_0xe929('0x4'))['db'];var utils=require(_0xe929('0x5'));var logger=require('../../config/logger')(_0xe929('0x6'));var config=require(_0xe929('0x7'));var jayson=require(_0xe929('0x8'));var client=jayson[_0xe929('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x142304,_0x21fb25,_0x552c62){return new BPromise(function(_0x5e2f13,_0x18e87f){return client['request'](_0x142304,_0x552c62)['then'](function(_0x435b2b){logger[_0xe929('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0x21fb25,_0xe929('0xb'));logger['debug'](_0xe929('0xc'),_0x21fb25,_0xe929('0xb'),JSON[_0xe929('0xd')](_0x435b2b));if(_0x435b2b[_0xe929('0xe')]){if(_0x435b2b['error'][_0xe929('0xf')]===0x1f4){logger[_0xe929('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x21fb25,_0x435b2b['error']['message']);return _0x18e87f(_0x435b2b['error'][_0xe929('0x10')]);}logger[_0xe929('0xe')](_0xe929('0x11'),_0x21fb25,_0x435b2b['error'][_0xe929('0x10')]);return _0x5e2f13(_0x435b2b[_0xe929('0xe')]['message']);}else{logger[_0xe929('0xa')](_0xe929('0x11'),_0x21fb25,_0xe929('0xb'));_0x5e2f13(_0x435b2b[_0xe929('0x12')][_0xe929('0x10')]);}})[_0xe929('0x13')](function(_0x1ac9b9){logger[_0xe929('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x21fb25,_0x1ac9b9);_0x18e87f(_0x1ac9b9);});});}exports[_0xe929('0x14')]=function(_0x540d5e){var _0x33ac59=this;return new Promise(function(_0x226238,_0x320385){return db['SalesforceAccount']['findAll']({'raw':_0x540d5e[_0xe929('0x15')]?_0x540d5e[_0xe929('0x15')][_0xe929('0x16')]===undefined?!![]:![]:!![],'where':_0x540d5e[_0xe929('0x15')]?_0x540d5e[_0xe929('0x15')][_0xe929('0x17')]||null:null,'attributes':_0x540d5e[_0xe929('0x15')]?_0x540d5e[_0xe929('0x15')][_0xe929('0x18')]||null:null,'limit':_0x540d5e['options']?_0x540d5e[_0xe929('0x15')][_0xe929('0x19')]||null:null,'include':_0x540d5e['options']?_0x540d5e[_0xe929('0x15')][_0xe929('0x1a')]?_[_0xe929('0x1b')](_0x540d5e[_0xe929('0x15')][_0xe929('0x1a')],function(_0x30fa44){return{'model':db[_0x30fa44['model']],'as':_0x30fa44['as'],'attributes':_0x30fa44['attributes'],'include':_0x30fa44[_0xe929('0x1a')]?_[_0xe929('0x1b')](_0x30fa44[_0xe929('0x1a')],function(_0x502de5){return{'model':db[_0x502de5[_0xe929('0x1c')]],'as':_0x502de5['as'],'attributes':_0x502de5['attributes'],'include':_0x502de5[_0xe929('0x1a')]?_[_0xe929('0x1b')](_0x502de5['include'],function(_0x35eda4){return{'model':db[_0x35eda4['model']],'as':_0x35eda4['as'],'attributes':_0x35eda4['attributes']};}):[]};}):[]};}):[]:[]})[_0xe929('0x1d')](function(_0x556629){logger['info'](_0xe929('0x14'),_0x540d5e);logger[_0xe929('0x1e')](_0xe929('0x14'),_0x540d5e,JSON['stringify'](_0x556629));_0x226238(_0x556629);})[_0xe929('0x13')](function(_0x213216){logger[_0xe929('0xe')](_0xe929('0x14'),_0x213216[_0xe929('0x10')],_0x540d5e);_0x320385(_0x33ac59[_0xe929('0xe')](0x1f4,_0x213216[_0xe929('0x10')]));});});};exports[_0xe929('0x1f')]=function(_0x505bd1){var _0x4b2959=this;return new Promise(function(_0x357b95,_0x4bb431){return db['SalesforceAccount']['find']({'raw':_0x505bd1[_0xe929('0x15')]?_0x505bd1[_0xe929('0x15')][_0xe929('0x16')]===undefined?!![]:![]:!![],'where':_0x505bd1[_0xe929('0x15')]?_0x505bd1[_0xe929('0x15')][_0xe929('0x17')]||null:null,'attributes':_0x505bd1[_0xe929('0x15')]?_0x505bd1['options']['attributes']||null:null,'include':_0x505bd1[_0xe929('0x15')]?_0x505bd1[_0xe929('0x15')][_0xe929('0x1a')]?_[_0xe929('0x1b')](_0x505bd1['options']['include'],function(_0x477317){return{'model':db[_0x477317['model']],'as':_0x477317['as'],'attributes':_0x477317[_0xe929('0x18')],'include':_0x477317[_0xe929('0x1a')]?_[_0xe929('0x1b')](_0x477317['include'],function(_0x795142){return{'model':db[_0x795142[_0xe929('0x1c')]],'as':_0x795142['as'],'attributes':_0x795142[_0xe929('0x18')],'include':_0x795142[_0xe929('0x1a')]?_[_0xe929('0x1b')](_0x795142['include'],function(_0x4c3c7e){return{'model':db[_0x4c3c7e[_0xe929('0x1c')]],'as':_0x4c3c7e['as'],'attributes':_0x4c3c7e[_0xe929('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x153e6d){logger['info'](_0xe929('0x1f'),_0x505bd1);logger[_0xe929('0x1e')](_0xe929('0x1f'),_0x505bd1,JSON['stringify'](_0x153e6d));_0x357b95(_0x153e6d);})[_0xe929('0x13')](function(_0x388a09){logger[_0xe929('0xe')]('ShowSalesforceAccount',_0x388a09[_0xe929('0x10')],_0x505bd1);_0x4bb431(_0x4b2959['error'](0x1f4,_0x388a09[_0xe929('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index ca9777f..155fea2 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 _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x0b0e[_0x54b283];return _0x2462b3;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x25f6c4,_0x33bdb9){var _0x36c516=function(_0x124728){while(--_0x124728){_0x25f6c4['push'](_0x25f6c4['shift']());}};_0x36c516(++_0x33bdb9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index a6e7d60..b616d82 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 _0xaf67=['STRING','ENUM','Task','contact_lead','account_contact_lead','contact','account','lead','sequelize','exports'];(function(_0x4d8b12,_0x29c0a7){var _0xb889bc=function(_0x2f2f65){while(--_0x2f2f65){_0x4d8b12['push'](_0x4d8b12['shift']());}};_0xb889bc(++_0x29c0a7);}(_0xaf67,0x1f2));var _0x7af6=function(_0xb3dea5,_0x2383d5){_0xb3dea5=_0xb3dea5-0x0;var _0x471610=_0xaf67[_0xb3dea5];return _0x471610;};'use strict';var Sequelize=require(_0x7af6('0x0'));module[_0x7af6('0x1')]={'name':{'type':Sequelize[_0x7af6('0x2')]},'description':{'type':Sequelize[_0x7af6('0x2')]},'ticketType':{'type':Sequelize[_0x7af6('0x3')](_0x7af6('0x4'),'Case'),'defaultValue':_0x7af6('0x4')},'moduleSearch':{'type':Sequelize[_0x7af6('0x3')](_0x7af6('0x5'),'contact','lead',_0x7af6('0x6'),'account'),'defaultValue':_0x7af6('0x5')},'moduleCreate':{'type':Sequelize[_0x7af6('0x3')]('nothing',_0x7af6('0x7'),'lead',_0x7af6('0x8')),'defaultValue':_0x7af6('0x9')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x7af6('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x7af6('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x7af6('0x2')]}}; \ No newline at end of file +var _0xd33c=['ENUM','Case','contact_lead','contact','lead','account_contact_lead','nothing','sequelize','exports','STRING'];(function(_0x203e89,_0x41cf77){var _0x5a2251=function(_0x45b376){while(--_0x45b376){_0x203e89['push'](_0x203e89['shift']());}};_0x5a2251(++_0x41cf77);}(_0xd33c,0x115));var _0xcd33=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xd33c[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0xcd33('0x0'));module[_0xcd33('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcd33('0x2')]},'ticketType':{'type':Sequelize[_0xcd33('0x3')]('Task',_0xcd33('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xcd33('0x3')](_0xcd33('0x5'),_0xcd33('0x6'),_0xcd33('0x7'),_0xcd33('0x8'),'account'),'defaultValue':_0xcd33('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0xcd33('0x9'),'contact','lead','account'),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xcd33('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xcd33('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xcd33('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xcd33('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 633946c..20faa0d 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 _0xe62a=['body','find','getFields','SalesforceField','findOne','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','includeAll','include','findAll','catch','params','length','create'];(function(_0x4ed31d,_0x55c9a6){var _0x558c90=function(_0x513a26){while(--_0x513a26){_0x4ed31d['push'](_0x4ed31d['shift']());}};_0x558c90(++_0x55c9a6);}(_0xe62a,0x16b));var _0xae62=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe62a[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0xae62('0x0'));var rimraf=require(_0xae62('0x1'));var zipdir=require(_0xae62('0x2'));var jsonpatch=require(_0xae62('0x3'));var rp=require(_0xae62('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xae62('0x5'));var util=require(_0xae62('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xae62('0x7'));var ejs=require(_0xae62('0x8'));var fs=require('fs');var fs_extra=require(_0xae62('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xae62('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xae62('0x7'));var querystring=require(_0xae62('0xb'));var Papa=require(_0xae62('0xc'));var Redis=require(_0xae62('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae62('0xe'));var logger=require(_0xae62('0xf'))('api');var utils=require(_0xae62('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27e5f3,_0x1bf251){_0x1bf251=_0x1bf251||0xcc;return function(_0x425609){if(_0x425609){return _0x27e5f3[_0xae62('0x11')](_0x1bf251);}return _0x27e5f3[_0xae62('0x12')](_0x1bf251)[_0xae62('0x13')]();};}function respondWithResult(_0x397856,_0x5223d4){_0x5223d4=_0x5223d4||0xc8;return function(_0x194a00){if(_0x194a00){return _0x397856[_0xae62('0x12')](_0x5223d4)[_0xae62('0x14')](_0x194a00);}};}function respondWithFilteredResult(_0x11bec6,_0x4c6bf4){return function(_0xd6c4b9){if(_0xd6c4b9){var _0x93c0e=typeof _0x4c6bf4[_0xae62('0x15')]===_0xae62('0x16')&&typeof _0x4c6bf4[_0xae62('0x17')]===_0xae62('0x16');var _0x18251a=_0xd6c4b9[_0xae62('0x18')];var _0x128aa9=_0x93c0e?0x0:_0x4c6bf4[_0xae62('0x15')];var _0x58d1d8=_0x93c0e?_0xd6c4b9['count']:_0x4c6bf4[_0xae62('0x15')]+_0x4c6bf4[_0xae62('0x17')];var _0x320939;if(_0x58d1d8>=_0x18251a){_0x58d1d8=_0x18251a;_0x320939=0xc8;}else{_0x320939=0xce;}_0x11bec6['status'](_0x320939);return _0x11bec6[_0xae62('0x19')]('Content-Range',_0x128aa9+'-'+_0x58d1d8+'/'+_0x18251a)['json'](_0xd6c4b9);}return null;};}function patchUpdates(_0x3d1959){return function(_0x2c7566){try{jsonpatch['apply'](_0x2c7566,_0x3d1959,!![]);}catch(_0x42250d){return BPromise[_0xae62('0x1a')](_0x42250d);}return _0x2c7566[_0xae62('0x1b')]();};}function saveUpdates(_0x4834af,_0x437c69){return function(_0x56334c){if(_0x56334c){return _0x56334c[_0xae62('0x1c')](_0x4834af)[_0xae62('0x1d')](function(_0x2dd228){return _0x2dd228;});}return null;};}function removeEntity(_0x5d7566,_0x339c6d){return function(_0x526791){if(_0x526791){return _0x526791[_0xae62('0x1e')]()[_0xae62('0x1d')](function(){_0x5d7566[_0xae62('0x12')](0xcc)[_0xae62('0x13')]();});}};}function handleEntityNotFound(_0x375cbf,_0x5a976a){return function(_0x2459b7){if(!_0x2459b7){_0x375cbf[_0xae62('0x11')](0x194);}return _0x2459b7;};}function handleError(_0x27a2b5,_0x4b2dd0){_0x4b2dd0=_0x4b2dd0||0x1f4;return function(_0x2358e7){logger[_0xae62('0x1f')](_0x2358e7[_0xae62('0x20')]);if(_0x2358e7[_0xae62('0x21')]){delete _0x2358e7[_0xae62('0x21')];}_0x27a2b5[_0xae62('0x12')](_0x4b2dd0)[_0xae62('0x22')](_0x2358e7);};}exports[_0xae62('0x23')]=function(_0x35a2ef,_0x15dc40){var _0x111d28={},_0x1e8445={},_0x24f4bc={'count':0x0,'rows':[]};var _0x3fb0a9=_[_0xae62('0x24')](db[_0xae62('0x25')][_0xae62('0x26')],function(_0x534a37){return{'name':_0x534a37['fieldName'],'type':_0x534a37['type'][_0xae62('0x27')]};});_0x1e8445[_0xae62('0x28')]=_[_0xae62('0x24')](_0x3fb0a9,_0xae62('0x21'));_0x1e8445[_0xae62('0x29')]=_[_0xae62('0x2a')](_0x35a2ef[_0xae62('0x29')]);_0x1e8445[_0xae62('0x2b')]=_[_0xae62('0x2c')](_0x1e8445[_0xae62('0x28')],_0x1e8445['query']);_0x111d28[_0xae62('0x2d')]=_[_0xae62('0x2c')](_0x1e8445['model'],qs['fields'](_0x35a2ef['query'][_0xae62('0x2e')]));_0x111d28[_0xae62('0x2d')]=_0x111d28[_0xae62('0x2d')]['length']?_0x111d28[_0xae62('0x2d')]:_0x1e8445[_0xae62('0x28')];if(!_0x35a2ef[_0xae62('0x29')][_0xae62('0x2f')](_0xae62('0x30'))){_0x111d28[_0xae62('0x17')]=qs['limit'](_0x35a2ef[_0xae62('0x29')][_0xae62('0x17')]);_0x111d28[_0xae62('0x15')]=qs[_0xae62('0x15')](_0x35a2ef[_0xae62('0x29')][_0xae62('0x15')]);}_0x111d28[_0xae62('0x31')]=qs[_0xae62('0x32')](_0x35a2ef[_0xae62('0x29')]['sort']);_0x111d28[_0xae62('0x33')]=qs['filters'](_['pick'](_0x35a2ef[_0xae62('0x29')],_0x1e8445[_0xae62('0x2b')]),_0x3fb0a9);if(_0x35a2ef['query']['filter']){_0x111d28['where']=_[_0xae62('0x34')](_0x111d28['where'],{'$or':_[_0xae62('0x24')](_0x3fb0a9,function(_0x486477){if(_0x486477[_0xae62('0x35')]!=='VIRTUAL'){var _0xec0198={};_0xec0198[_0x486477['name']]={'$like':'%'+_0x35a2ef['query'][_0xae62('0x36')]+'%'};return _0xec0198;}})});}_0x111d28=_['merge']({},_0x111d28,_0x35a2ef[_0xae62('0x37')]);var _0x3c1eb4={'where':_0x111d28[_0xae62('0x33')]};return db['SalesforceConfiguration'][_0xae62('0x18')](_0x3c1eb4)[_0xae62('0x1d')](function(_0x44948f){_0x24f4bc[_0xae62('0x18')]=_0x44948f;if(_0x35a2ef[_0xae62('0x29')][_0xae62('0x38')]){_0x111d28[_0xae62('0x39')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xae62('0x3a')](_0x111d28);})[_0xae62('0x1d')](function(_0x87917e){_0x24f4bc['rows']=_0x87917e;return _0x24f4bc;})[_0xae62('0x1d')](respondWithFilteredResult(_0x15dc40,_0x111d28))[_0xae62('0x3b')](handleError(_0x15dc40,null));};exports['show']=function(_0x20d6d7,_0x71565b){var _0x117a80={'raw':![],'where':{'id':_0x20d6d7[_0xae62('0x3c')]['id']}},_0x40b3a5={};_0x40b3a5[_0xae62('0x28')]=_['keys'](db[_0xae62('0x25')][_0xae62('0x26')]);_0x40b3a5[_0xae62('0x29')]=_[_0xae62('0x2a')](_0x20d6d7['query']);_0x40b3a5['filters']=_[_0xae62('0x2c')](_0x40b3a5['model'],_0x40b3a5[_0xae62('0x29')]);_0x117a80[_0xae62('0x2d')]=_[_0xae62('0x2c')](_0x40b3a5[_0xae62('0x28')],qs['fields'](_0x20d6d7[_0xae62('0x29')][_0xae62('0x2e')]));_0x117a80[_0xae62('0x2d')]=_0x117a80[_0xae62('0x2d')][_0xae62('0x3d')]?_0x117a80['attributes']:_0x40b3a5[_0xae62('0x28')];if(_0x20d6d7[_0xae62('0x29')][_0xae62('0x38')]){_0x117a80[_0xae62('0x39')]=[{'all':!![]}];}_0x117a80=_['merge']({},_0x117a80,_0x20d6d7[_0xae62('0x37')]);return db['SalesforceConfiguration']['find'](_0x117a80)['then'](handleEntityNotFound(_0x71565b,null))[_0xae62('0x1d')](respondWithResult(_0x71565b,null))[_0xae62('0x3b')](handleError(_0x71565b,null));};exports['create']=function(_0x4c5a81,_0x29d3f7){return db[_0xae62('0x25')][_0xae62('0x3e')](_0x4c5a81[_0xae62('0x3f')],{})[_0xae62('0x1d')](respondWithResult(_0x29d3f7,0xc9))['catch'](handleError(_0x29d3f7,null));};exports[_0xae62('0x1c')]=function(_0xc2faa2,_0x2e00db){if(_0xc2faa2['body']['id']){delete _0xc2faa2[_0xae62('0x3f')]['id'];}return db[_0xae62('0x25')][_0xae62('0x40')]({'where':{'id':_0xc2faa2[_0xae62('0x3c')]['id']}})[_0xae62('0x1d')](handleEntityNotFound(_0x2e00db,null))[_0xae62('0x1d')](saveUpdates(_0xc2faa2[_0xae62('0x3f')],null))['then'](respondWithResult(_0x2e00db,null))[_0xae62('0x3b')](handleError(_0x2e00db,null));};exports['destroy']=function(_0x2b7508,_0x27a37a){return db[_0xae62('0x25')][_0xae62('0x40')]({'where':{'id':_0x2b7508[_0xae62('0x3c')]['id']}})[_0xae62('0x1d')](handleEntityNotFound(_0x27a37a,null))[_0xae62('0x1d')](removeEntity(_0x27a37a,null))[_0xae62('0x3b')](handleError(_0x27a37a,null));};exports[_0xae62('0x41')]=function(_0x273c3d,_0x4f665b,_0x501b13){var _0x32b383={};var _0xd3b4ef={};var _0x263c70;var _0x434f70;return db[_0xae62('0x25')]['findOne']({'where':{'id':_0x273c3d[_0xae62('0x3c')]['id']}})[_0xae62('0x1d')](handleEntityNotFound(_0x4f665b,null))[_0xae62('0x1d')](function(_0x15ae6a){if(_0x15ae6a){_0x263c70=_0x15ae6a;_0xd3b4ef[_0xae62('0x28')]=_[_0xae62('0x2a')](db[_0xae62('0x42')]['rawAttributes']);_0xd3b4ef['query']=_[_0xae62('0x2a')](_0x273c3d[_0xae62('0x29')]);_0xd3b4ef['filters']=_[_0xae62('0x2c')](_0xd3b4ef[_0xae62('0x28')],_0xd3b4ef[_0xae62('0x29')]);_0x32b383['attributes']=_[_0xae62('0x2c')](_0xd3b4ef[_0xae62('0x28')],qs['fields'](_0x273c3d[_0xae62('0x29')][_0xae62('0x2e')]));_0x32b383['attributes']=_0x32b383['attributes'][_0xae62('0x3d')]?_0x32b383['attributes']:_0xd3b4ef[_0xae62('0x28')];_0x32b383[_0xae62('0x31')]=qs[_0xae62('0x32')](_0x273c3d['query'][_0xae62('0x32')]);_0x32b383['where']=qs['filters'](_['pick'](_0x273c3d[_0xae62('0x29')],_0xd3b4ef[_0xae62('0x2b')]));if(_0x273c3d[_0xae62('0x29')][_0xae62('0x36')]){_0x32b383[_0xae62('0x33')]=_[_0xae62('0x34')](_0x32b383[_0xae62('0x33')],{'$or':_[_0xae62('0x24')](_0x32b383[_0xae62('0x2d')],function(_0x578464){var _0x139a13={};_0x139a13[_0x578464]={'$like':'%'+_0x273c3d[_0xae62('0x29')][_0xae62('0x36')]+'%'};return _0x139a13;})});}_0x32b383=_[_0xae62('0x34')]({},_0x32b383,_0x273c3d['options']);return _0x263c70[_0xae62('0x41')](_0x32b383);}})[_0xae62('0x1d')](function(_0x2941df){if(_0x2941df){_0x434f70=_0x2941df[_0xae62('0x3d')];if(!_0x273c3d[_0xae62('0x29')][_0xae62('0x2f')](_0xae62('0x30'))){_0x32b383[_0xae62('0x17')]=qs[_0xae62('0x17')](_0x273c3d['query'][_0xae62('0x17')]);_0x32b383[_0xae62('0x15')]=qs[_0xae62('0x15')](_0x273c3d[_0xae62('0x29')][_0xae62('0x15')]);}return _0x263c70[_0xae62('0x41')](_0x32b383);}})[_0xae62('0x1d')](function(_0x3b4b3a){if(_0x3b4b3a){return _0x3b4b3a?{'count':_0x434f70,'rows':_0x3b4b3a}:null;}})[_0xae62('0x1d')](respondWithResult(_0x4f665b,null))['catch'](handleError(_0x4f665b,null));};exports['getSubjects']=function(_0x3f9446,_0x3197b6,_0x549271){var _0x119d21={};var _0x4f8625={};var _0x203388;var _0x344b13;return db[_0xae62('0x25')][_0xae62('0x43')]({'where':{'id':_0x3f9446[_0xae62('0x3c')]['id']}})[_0xae62('0x1d')](handleEntityNotFound(_0x3197b6,null))[_0xae62('0x1d')](function(_0x4e66dd){if(_0x4e66dd){_0x203388=_0x4e66dd;_0x4f8625[_0xae62('0x28')]=_['keys'](db[_0xae62('0x42')][_0xae62('0x26')]);_0x4f8625[_0xae62('0x29')]=_[_0xae62('0x2a')](_0x3f9446[_0xae62('0x29')]);_0x4f8625[_0xae62('0x2b')]=_[_0xae62('0x2c')](_0x4f8625[_0xae62('0x28')],_0x4f8625[_0xae62('0x29')]);_0x119d21[_0xae62('0x2d')]=_[_0xae62('0x2c')](_0x4f8625[_0xae62('0x28')],qs[_0xae62('0x2e')](_0x3f9446[_0xae62('0x29')][_0xae62('0x2e')]));_0x119d21[_0xae62('0x2d')]=_0x119d21[_0xae62('0x2d')]['length']?_0x119d21[_0xae62('0x2d')]:_0x4f8625[_0xae62('0x28')];_0x119d21['order']=qs['sort'](_0x3f9446['query'][_0xae62('0x32')]);_0x119d21['where']=qs[_0xae62('0x2b')](_[_0xae62('0x44')](_0x3f9446[_0xae62('0x29')],_0x4f8625['filters']));if(_0x3f9446['query'][_0xae62('0x36')]){_0x119d21[_0xae62('0x33')]=_[_0xae62('0x34')](_0x119d21[_0xae62('0x33')],{'$or':_['map'](_0x119d21[_0xae62('0x2d')],function(_0x207d5e){var _0x2bd37a={};_0x2bd37a[_0x207d5e]={'$like':'%'+_0x3f9446[_0xae62('0x29')][_0xae62('0x36')]+'%'};return _0x2bd37a;})});}_0x119d21=_[_0xae62('0x34')]({},_0x119d21,_0x3f9446[_0xae62('0x37')]);return _0x203388['getSubjects'](_0x119d21);}})[_0xae62('0x1d')](function(_0x96bf58){if(_0x96bf58){_0x344b13=_0x96bf58[_0xae62('0x3d')];if(!_0x3f9446[_0xae62('0x29')]['hasOwnProperty'](_0xae62('0x30'))){_0x119d21[_0xae62('0x17')]=qs['limit'](_0x3f9446['query'][_0xae62('0x17')]);_0x119d21[_0xae62('0x15')]=qs[_0xae62('0x15')](_0x3f9446['query']['offset']);}return _0x203388[_0xae62('0x45')](_0x119d21);}})[_0xae62('0x1d')](function(_0x5beb8f){if(_0x5beb8f){return _0x5beb8f?{'count':_0x344b13,'rows':_0x5beb8f}:null;}})['then'](respondWithResult(_0x3197b6,null))[_0xae62('0x3b')](handleError(_0x3197b6,null));};exports[_0xae62('0x46')]=function(_0x3eae1c,_0x361b3c,_0x66bffc){var _0x349d7e={};var _0x1682d6={};var _0x459f3e;var _0x30001b;return db[_0xae62('0x25')][_0xae62('0x43')]({'where':{'id':_0x3eae1c['params']['id']}})[_0xae62('0x1d')](handleEntityNotFound(_0x361b3c,null))[_0xae62('0x1d')](function(_0x1f0bed){if(_0x1f0bed){_0x459f3e=_0x1f0bed;_0x1682d6[_0xae62('0x28')]=_[_0xae62('0x2a')](db[_0xae62('0x42')][_0xae62('0x26')]);_0x1682d6['query']=_[_0xae62('0x2a')](_0x3eae1c['query']);_0x1682d6['filters']=_[_0xae62('0x2c')](_0x1682d6[_0xae62('0x28')],_0x1682d6['query']);_0x349d7e[_0xae62('0x2d')]=_[_0xae62('0x2c')](_0x1682d6[_0xae62('0x28')],qs[_0xae62('0x2e')](_0x3eae1c[_0xae62('0x29')][_0xae62('0x2e')]));_0x349d7e[_0xae62('0x2d')]=_0x349d7e[_0xae62('0x2d')]['length']?_0x349d7e[_0xae62('0x2d')]:_0x1682d6['model'];_0x349d7e[_0xae62('0x31')]=qs[_0xae62('0x32')](_0x3eae1c[_0xae62('0x29')]['sort']);_0x349d7e['where']=qs[_0xae62('0x2b')](_['pick'](_0x3eae1c[_0xae62('0x29')],_0x1682d6[_0xae62('0x2b')]));if(_0x3eae1c[_0xae62('0x29')]['filter']){_0x349d7e[_0xae62('0x33')]=_[_0xae62('0x34')](_0x349d7e[_0xae62('0x33')],{'$or':_['map'](_0x349d7e[_0xae62('0x2d')],function(_0x281ddf){var _0x57db13={};_0x57db13[_0x281ddf]={'$like':'%'+_0x3eae1c['query']['filter']+'%'};return _0x57db13;})});}_0x349d7e=_['merge']({},_0x349d7e,_0x3eae1c[_0xae62('0x37')]);return _0x459f3e[_0xae62('0x46')](_0x349d7e);}})[_0xae62('0x1d')](function(_0x25f980){if(_0x25f980){_0x30001b=_0x25f980[_0xae62('0x3d')];if(!_0x3eae1c[_0xae62('0x29')]['hasOwnProperty'](_0xae62('0x30'))){_0x349d7e[_0xae62('0x17')]=qs[_0xae62('0x17')](_0x3eae1c[_0xae62('0x29')]['limit']);_0x349d7e['offset']=qs[_0xae62('0x15')](_0x3eae1c['query'][_0xae62('0x15')]);}return _0x459f3e[_0xae62('0x46')](_0x349d7e);}})['then'](function(_0x567f7a){if(_0x567f7a){return _0x567f7a?{'count':_0x30001b,'rows':_0x567f7a}:null;}})[_0xae62('0x1d')](respondWithResult(_0x361b3c,null))['catch'](handleError(_0x361b3c,null));}; \ No newline at end of file +var _0x853e=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','rows','show','params','includeAll','find','create','body','catch','update','getFields','SalesforceField','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir'];(function(_0x596bd0,_0x455638){var _0x254c85=function(_0x4c2dc6){while(--_0x4c2dc6){_0x596bd0['push'](_0x596bd0['shift']());}};_0x254c85(++_0x455638);}(_0x853e,0xea));var _0xe853=function(_0x394443,_0x68d8dd){_0x394443=_0x394443-0x0;var _0x101792=_0x853e[_0x394443];return _0x101792;};'use strict';var emlformat=require(_0xe853('0x0'));var rimraf=require(_0xe853('0x1'));var zipdir=require(_0xe853('0x2'));var jsonpatch=require(_0xe853('0x3'));var rp=require(_0xe853('0x4'));var moment=require('moment');var BPromise=require(_0xe853('0x5'));var Mustache=require(_0xe853('0x6'));var util=require(_0xe853('0x7'));var path=require(_0xe853('0x8'));var sox=require(_0xe853('0x9'));var csv=require(_0xe853('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe853('0xb'));var crypto=require(_0xe853('0xc'));var jsforce=require(_0xe853('0xd'));var deskjs=require(_0xe853('0xe'));var toCsv=require(_0xe853('0xa'));var querystring=require('querystring');var Papa=require(_0xe853('0xf'));var Redis=require(_0xe853('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe853('0x11'));var hardwareService=require(_0xe853('0x12'));var logger=require(_0xe853('0x13'))(_0xe853('0x14'));var utils=require(_0xe853('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe853('0x16'));var db=require(_0xe853('0x17'))['db'];function respondWithStatusCode(_0x1254e1,_0xbcff88){_0xbcff88=_0xbcff88||0xcc;return function(_0x13f307){if(_0x13f307){return _0x1254e1[_0xe853('0x18')](_0xbcff88);}return _0x1254e1[_0xe853('0x19')](_0xbcff88)[_0xe853('0x1a')]();};}function respondWithResult(_0x142937,_0x12cd23){_0x12cd23=_0x12cd23||0xc8;return function(_0x2b27f2){if(_0x2b27f2){return _0x142937['status'](_0x12cd23)['json'](_0x2b27f2);}};}function respondWithFilteredResult(_0x39e9e6,_0x410596){return function(_0x5104b5){if(_0x5104b5){var _0x1fc95d=typeof _0x410596[_0xe853('0x1b')]===_0xe853('0x1c')&&typeof _0x410596[_0xe853('0x1d')]===_0xe853('0x1c');var _0x321353=_0x5104b5[_0xe853('0x1e')];var _0x1a50d8=_0x1fc95d?0x0:_0x410596[_0xe853('0x1b')];var _0xe2659b=_0x1fc95d?_0x5104b5[_0xe853('0x1e')]:_0x410596[_0xe853('0x1b')]+_0x410596[_0xe853('0x1d')];var _0x3203f8;if(_0xe2659b>=_0x321353){_0xe2659b=_0x321353;_0x3203f8=0xc8;}else{_0x3203f8=0xce;}_0x39e9e6[_0xe853('0x19')](_0x3203f8);return _0x39e9e6[_0xe853('0x1f')](_0xe853('0x20'),_0x1a50d8+'-'+_0xe2659b+'/'+_0x321353)['json'](_0x5104b5);}return null;};}function patchUpdates(_0x17ee69){return function(_0xf50d82){try{jsonpatch[_0xe853('0x21')](_0xf50d82,_0x17ee69,!![]);}catch(_0x210c57){return BPromise[_0xe853('0x22')](_0x210c57);}return _0xf50d82[_0xe853('0x23')]();};}function saveUpdates(_0x39ab6d,_0x3cecb2){return function(_0x49465f){if(_0x49465f){return _0x49465f['update'](_0x39ab6d)['then'](function(_0x577272){return _0x577272;});}return null;};}function removeEntity(_0x40586c,_0x313962){return function(_0x10f8ea){if(_0x10f8ea){return _0x10f8ea['destroy']()[_0xe853('0x24')](function(){_0x40586c['status'](0xcc)[_0xe853('0x1a')]();});}};}function handleEntityNotFound(_0x559fbd,_0x32fccb){return function(_0x5ed970){if(!_0x5ed970){_0x559fbd[_0xe853('0x18')](0x194);}return _0x5ed970;};}function handleError(_0x591e0e,_0x2de094){_0x2de094=_0x2de094||0x1f4;return function(_0x295b19){logger[_0xe853('0x25')](_0x295b19[_0xe853('0x26')]);if(_0x295b19[_0xe853('0x27')]){delete _0x295b19[_0xe853('0x27')];}_0x591e0e['status'](_0x2de094)['send'](_0x295b19);};}exports[_0xe853('0x28')]=function(_0x197b42,_0x39d5c5){var _0x2b700f={},_0x57f82a={},_0x463639={'count':0x0,'rows':[]};var _0x30073d=_[_0xe853('0x29')](db[_0xe853('0x2a')][_0xe853('0x2b')],function(_0xd79e37){return{'name':_0xd79e37[_0xe853('0x2c')],'type':_0xd79e37[_0xe853('0x2d')][_0xe853('0x2e')]};});_0x57f82a[_0xe853('0x2f')]=_[_0xe853('0x29')](_0x30073d,'name');_0x57f82a['query']=_[_0xe853('0x30')](_0x197b42[_0xe853('0x31')]);_0x57f82a['filters']=_[_0xe853('0x32')](_0x57f82a[_0xe853('0x2f')],_0x57f82a['query']);_0x2b700f[_0xe853('0x33')]=_[_0xe853('0x32')](_0x57f82a[_0xe853('0x2f')],qs[_0xe853('0x34')](_0x197b42['query'][_0xe853('0x34')]));_0x2b700f['attributes']=_0x2b700f[_0xe853('0x33')][_0xe853('0x35')]?_0x2b700f[_0xe853('0x33')]:_0x57f82a[_0xe853('0x2f')];if(!_0x197b42['query'][_0xe853('0x36')](_0xe853('0x37'))){_0x2b700f['limit']=qs[_0xe853('0x1d')](_0x197b42[_0xe853('0x31')][_0xe853('0x1d')]);_0x2b700f[_0xe853('0x1b')]=qs[_0xe853('0x1b')](_0x197b42['query']['offset']);}_0x2b700f[_0xe853('0x38')]=qs[_0xe853('0x39')](_0x197b42['query'][_0xe853('0x39')]);_0x2b700f[_0xe853('0x3a')]=qs[_0xe853('0x3b')](_[_0xe853('0x3c')](_0x197b42[_0xe853('0x31')],_0x57f82a['filters']),_0x30073d);if(_0x197b42[_0xe853('0x31')][_0xe853('0x3d')]){_0x2b700f['where']=_['merge'](_0x2b700f['where'],{'$or':_['map'](_0x30073d,function(_0x152d93){if(_0x152d93[_0xe853('0x2d')]!=='VIRTUAL'){var _0x15a830={};_0x15a830[_0x152d93[_0xe853('0x27')]]={'$like':'%'+_0x197b42[_0xe853('0x31')][_0xe853('0x3d')]+'%'};return _0x15a830;}})});}_0x2b700f=_[_0xe853('0x3e')]({},_0x2b700f,_0x197b42[_0xe853('0x3f')]);var _0xe9a2ec={'where':_0x2b700f['where']};return db[_0xe853('0x2a')]['count'](_0xe9a2ec)[_0xe853('0x24')](function(_0x138254){_0x463639[_0xe853('0x1e')]=_0x138254;if(_0x197b42['query']['includeAll']){_0x2b700f[_0xe853('0x40')]=[{'all':!![]}];}return db[_0xe853('0x2a')]['findAll'](_0x2b700f);})['then'](function(_0x3ded09){_0x463639[_0xe853('0x41')]=_0x3ded09;return _0x463639;})[_0xe853('0x24')](respondWithFilteredResult(_0x39d5c5,_0x2b700f))['catch'](handleError(_0x39d5c5,null));};exports[_0xe853('0x42')]=function(_0xc4c522,_0x30ee2c){var _0x2f8d9d={'raw':![],'where':{'id':_0xc4c522[_0xe853('0x43')]['id']}},_0x12b11a={};_0x12b11a['model']=_[_0xe853('0x30')](db[_0xe853('0x2a')]['rawAttributes']);_0x12b11a['query']=_[_0xe853('0x30')](_0xc4c522[_0xe853('0x31')]);_0x12b11a[_0xe853('0x3b')]=_[_0xe853('0x32')](_0x12b11a[_0xe853('0x2f')],_0x12b11a[_0xe853('0x31')]);_0x2f8d9d[_0xe853('0x33')]=_['intersection'](_0x12b11a[_0xe853('0x2f')],qs[_0xe853('0x34')](_0xc4c522[_0xe853('0x31')][_0xe853('0x34')]));_0x2f8d9d[_0xe853('0x33')]=_0x2f8d9d['attributes'][_0xe853('0x35')]?_0x2f8d9d[_0xe853('0x33')]:_0x12b11a[_0xe853('0x2f')];if(_0xc4c522[_0xe853('0x31')][_0xe853('0x44')]){_0x2f8d9d['include']=[{'all':!![]}];}_0x2f8d9d=_[_0xe853('0x3e')]({},_0x2f8d9d,_0xc4c522['options']);return db['SalesforceConfiguration'][_0xe853('0x45')](_0x2f8d9d)[_0xe853('0x24')](handleEntityNotFound(_0x30ee2c,null))[_0xe853('0x24')](respondWithResult(_0x30ee2c,null))['catch'](handleError(_0x30ee2c,null));};exports[_0xe853('0x46')]=function(_0x383a3e,_0x152ca1){return db[_0xe853('0x2a')]['create'](_0x383a3e[_0xe853('0x47')],{})[_0xe853('0x24')](respondWithResult(_0x152ca1,0xc9))[_0xe853('0x48')](handleError(_0x152ca1,null));};exports[_0xe853('0x49')]=function(_0x7b5ec6,_0x3e6822){if(_0x7b5ec6[_0xe853('0x47')]['id']){delete _0x7b5ec6[_0xe853('0x47')]['id'];}return db[_0xe853('0x2a')]['find']({'where':{'id':_0x7b5ec6[_0xe853('0x43')]['id']}})[_0xe853('0x24')](handleEntityNotFound(_0x3e6822,null))[_0xe853('0x24')](saveUpdates(_0x7b5ec6['body'],null))[_0xe853('0x24')](respondWithResult(_0x3e6822,null))[_0xe853('0x48')](handleError(_0x3e6822,null));};exports['destroy']=function(_0x4df899,_0x596152){return db[_0xe853('0x2a')]['find']({'where':{'id':_0x4df899[_0xe853('0x43')]['id']}})[_0xe853('0x24')](handleEntityNotFound(_0x596152,null))[_0xe853('0x24')](removeEntity(_0x596152,null))['catch'](handleError(_0x596152,null));};exports[_0xe853('0x4a')]=function(_0x12b69e,_0x6bab18,_0x3f25e9){var _0x42b620={};var _0x2137e9={};var _0x75e118;var _0x41b3e3;return db[_0xe853('0x2a')]['findOne']({'where':{'id':_0x12b69e[_0xe853('0x43')]['id']}})[_0xe853('0x24')](handleEntityNotFound(_0x6bab18,null))['then'](function(_0x35c8f6){if(_0x35c8f6){_0x75e118=_0x35c8f6;_0x2137e9[_0xe853('0x2f')]=_[_0xe853('0x30')](db[_0xe853('0x4b')]['rawAttributes']);_0x2137e9[_0xe853('0x31')]=_['keys'](_0x12b69e[_0xe853('0x31')]);_0x2137e9[_0xe853('0x3b')]=_[_0xe853('0x32')](_0x2137e9[_0xe853('0x2f')],_0x2137e9[_0xe853('0x31')]);_0x42b620[_0xe853('0x33')]=_[_0xe853('0x32')](_0x2137e9[_0xe853('0x2f')],qs[_0xe853('0x34')](_0x12b69e[_0xe853('0x31')][_0xe853('0x34')]));_0x42b620[_0xe853('0x33')]=_0x42b620['attributes']['length']?_0x42b620[_0xe853('0x33')]:_0x2137e9['model'];_0x42b620[_0xe853('0x38')]=qs[_0xe853('0x39')](_0x12b69e[_0xe853('0x31')][_0xe853('0x39')]);_0x42b620['where']=qs['filters'](_[_0xe853('0x3c')](_0x12b69e[_0xe853('0x31')],_0x2137e9['filters']));if(_0x12b69e[_0xe853('0x31')]['filter']){_0x42b620['where']=_[_0xe853('0x3e')](_0x42b620['where'],{'$or':_[_0xe853('0x29')](_0x42b620['attributes'],function(_0x4478f1){var _0x30e89a={};_0x30e89a[_0x4478f1]={'$like':'%'+_0x12b69e[_0xe853('0x31')]['filter']+'%'};return _0x30e89a;})});}_0x42b620=_['merge']({},_0x42b620,_0x12b69e[_0xe853('0x3f')]);return _0x75e118['getFields'](_0x42b620);}})[_0xe853('0x24')](function(_0x31afa1){if(_0x31afa1){_0x41b3e3=_0x31afa1[_0xe853('0x35')];if(!_0x12b69e[_0xe853('0x31')]['hasOwnProperty'](_0xe853('0x37'))){_0x42b620[_0xe853('0x1d')]=qs[_0xe853('0x1d')](_0x12b69e[_0xe853('0x31')][_0xe853('0x1d')]);_0x42b620[_0xe853('0x1b')]=qs[_0xe853('0x1b')](_0x12b69e[_0xe853('0x31')][_0xe853('0x1b')]);}return _0x75e118[_0xe853('0x4a')](_0x42b620);}})[_0xe853('0x24')](function(_0x158703){if(_0x158703){return _0x158703?{'count':_0x41b3e3,'rows':_0x158703}:null;}})['then'](respondWithResult(_0x6bab18,null))[_0xe853('0x48')](handleError(_0x6bab18,null));};exports['getSubjects']=function(_0x187ace,_0x237f01,_0x31ab0c){var _0x56d1d4={};var _0x7898ae={};var _0x430962;var _0x1e95d8;return db[_0xe853('0x2a')][_0xe853('0x4c')]({'where':{'id':_0x187ace[_0xe853('0x43')]['id']}})['then'](handleEntityNotFound(_0x237f01,null))[_0xe853('0x24')](function(_0x459c35){if(_0x459c35){_0x430962=_0x459c35;_0x7898ae[_0xe853('0x2f')]=_[_0xe853('0x30')](db['SalesforceField'][_0xe853('0x2b')]);_0x7898ae[_0xe853('0x31')]=_[_0xe853('0x30')](_0x187ace['query']);_0x7898ae[_0xe853('0x3b')]=_[_0xe853('0x32')](_0x7898ae[_0xe853('0x2f')],_0x7898ae[_0xe853('0x31')]);_0x56d1d4['attributes']=_[_0xe853('0x32')](_0x7898ae[_0xe853('0x2f')],qs[_0xe853('0x34')](_0x187ace[_0xe853('0x31')]['fields']));_0x56d1d4[_0xe853('0x33')]=_0x56d1d4[_0xe853('0x33')][_0xe853('0x35')]?_0x56d1d4['attributes']:_0x7898ae[_0xe853('0x2f')];_0x56d1d4['order']=qs[_0xe853('0x39')](_0x187ace[_0xe853('0x31')][_0xe853('0x39')]);_0x56d1d4['where']=qs[_0xe853('0x3b')](_[_0xe853('0x3c')](_0x187ace[_0xe853('0x31')],_0x7898ae[_0xe853('0x3b')]));if(_0x187ace[_0xe853('0x31')][_0xe853('0x3d')]){_0x56d1d4[_0xe853('0x3a')]=_['merge'](_0x56d1d4['where'],{'$or':_[_0xe853('0x29')](_0x56d1d4['attributes'],function(_0x241778){var _0x94b9aa={};_0x94b9aa[_0x241778]={'$like':'%'+_0x187ace[_0xe853('0x31')][_0xe853('0x3d')]+'%'};return _0x94b9aa;})});}_0x56d1d4=_[_0xe853('0x3e')]({},_0x56d1d4,_0x187ace[_0xe853('0x3f')]);return _0x430962[_0xe853('0x4d')](_0x56d1d4);}})[_0xe853('0x24')](function(_0x1525d4){if(_0x1525d4){_0x1e95d8=_0x1525d4['length'];if(!_0x187ace[_0xe853('0x31')][_0xe853('0x36')](_0xe853('0x37'))){_0x56d1d4[_0xe853('0x1d')]=qs[_0xe853('0x1d')](_0x187ace[_0xe853('0x31')][_0xe853('0x1d')]);_0x56d1d4[_0xe853('0x1b')]=qs[_0xe853('0x1b')](_0x187ace['query'][_0xe853('0x1b')]);}return _0x430962[_0xe853('0x4d')](_0x56d1d4);}})[_0xe853('0x24')](function(_0x3e872c){if(_0x3e872c){return _0x3e872c?{'count':_0x1e95d8,'rows':_0x3e872c}:null;}})['then'](respondWithResult(_0x237f01,null))[_0xe853('0x48')](handleError(_0x237f01,null));};exports['getDescriptions']=function(_0x4f3538,_0x1a2fd1,_0x476880){var _0x2b0958={};var _0xfddf0c={};var _0x4ec66e;var _0x4fa0bb;return db[_0xe853('0x2a')]['findOne']({'where':{'id':_0x4f3538[_0xe853('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a2fd1,null))['then'](function(_0x19cf89){if(_0x19cf89){_0x4ec66e=_0x19cf89;_0xfddf0c[_0xe853('0x2f')]=_[_0xe853('0x30')](db[_0xe853('0x4b')][_0xe853('0x2b')]);_0xfddf0c[_0xe853('0x31')]=_[_0xe853('0x30')](_0x4f3538[_0xe853('0x31')]);_0xfddf0c['filters']=_['intersection'](_0xfddf0c[_0xe853('0x2f')],_0xfddf0c['query']);_0x2b0958[_0xe853('0x33')]=_['intersection'](_0xfddf0c[_0xe853('0x2f')],qs['fields'](_0x4f3538[_0xe853('0x31')][_0xe853('0x34')]));_0x2b0958[_0xe853('0x33')]=_0x2b0958[_0xe853('0x33')][_0xe853('0x35')]?_0x2b0958['attributes']:_0xfddf0c[_0xe853('0x2f')];_0x2b0958[_0xe853('0x38')]=qs[_0xe853('0x39')](_0x4f3538['query'][_0xe853('0x39')]);_0x2b0958[_0xe853('0x3a')]=qs[_0xe853('0x3b')](_['pick'](_0x4f3538[_0xe853('0x31')],_0xfddf0c[_0xe853('0x3b')]));if(_0x4f3538[_0xe853('0x31')][_0xe853('0x3d')]){_0x2b0958[_0xe853('0x3a')]=_['merge'](_0x2b0958[_0xe853('0x3a')],{'$or':_[_0xe853('0x29')](_0x2b0958[_0xe853('0x33')],function(_0x2b3cfb){var _0x49175b={};_0x49175b[_0x2b3cfb]={'$like':'%'+_0x4f3538[_0xe853('0x31')]['filter']+'%'};return _0x49175b;})});}_0x2b0958=_[_0xe853('0x3e')]({},_0x2b0958,_0x4f3538[_0xe853('0x3f')]);return _0x4ec66e[_0xe853('0x4e')](_0x2b0958);}})[_0xe853('0x24')](function(_0x5874d4){if(_0x5874d4){_0x4fa0bb=_0x5874d4['length'];if(!_0x4f3538[_0xe853('0x31')][_0xe853('0x36')](_0xe853('0x37'))){_0x2b0958[_0xe853('0x1d')]=qs['limit'](_0x4f3538[_0xe853('0x31')]['limit']);_0x2b0958[_0xe853('0x1b')]=qs[_0xe853('0x1b')](_0x4f3538[_0xe853('0x31')][_0xe853('0x1b')]);}return _0x4ec66e[_0xe853('0x4e')](_0x2b0958);}})[_0xe853('0x24')](function(_0x9032f0){if(_0x9032f0){return _0x9032f0?{'count':_0x4fa0bb,'rows':_0x9032f0}:null;}})[_0xe853('0x24')](respondWithResult(_0x1a2fd1,null))[_0xe853('0x48')](handleError(_0x1a2fd1,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index b2fc150..b4748e2 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 _0xdf9e=['request-promise','rimraf','SalesforceConfiguration','lodash','util','../../config/logger','bluebird'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0xdf9e,0xab));var _0xedf9=function(_0xe2de17,_0x231830){_0xe2de17=_0xe2de17-0x0;var _0x29d8f7=_0xdf9e[_0xe2de17];return _0x29d8f7;};'use strict';var _=require(_0xedf9('0x0'));var util=require(_0xedf9('0x1'));var logger=require(_0xedf9('0x2'))('api');var moment=require('moment');var BPromise=require(_0xedf9('0x3'));var rp=require(_0xedf9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xedf9('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x112ae0,_0x1dc4f4){return _0x112ae0['define'](_0xedf9('0x6'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa060=['api','bluebird','rimraf','../../config/environment','exports','SalesforceConfiguration','lodash','util','../../config/logger'];(function(_0x2efea2,_0x45d53f){var _0x485407=function(_0x409ee8){while(--_0x409ee8){_0x2efea2['push'](_0x2efea2['shift']());}};_0x485407(++_0x45d53f);}(_0xa060,0x114));var _0x0a06=function(_0x391811,_0x14b330){_0x391811=_0x391811-0x0;var _0x251059=_0xa060[_0x391811];return _0x251059;};'use strict';var _=require(_0x0a06('0x0'));var util=require(_0x0a06('0x1'));var logger=require(_0x0a06('0x2'))(_0x0a06('0x3'));var moment=require('moment');var BPromise=require(_0x0a06('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0a06('0x5'));var config=require(_0x0a06('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x0a06('0x7')]=function(_0x1e3ba7,_0x1f74b7){return _0x1e3ba7['define'](_0x0a06('0x8'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index e908fcf..0b6f6a7 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 _0x00a5=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x438da0,_0x45dfce){var _0x1a826f=function(_0x39aa3a){while(--_0x39aa3a){_0x438da0['push'](_0x438da0['shift']());}};_0x1a826f(++_0x45dfce);}(_0x00a5,0xb2));var _0x500a=function(_0x5971c0,_0x10de71){_0x5971c0=_0x5971c0-0x0;var _0x162ca4=_0x00a5[_0x5971c0];return _0x162ca4;};'use strict';var _=require('lodash');var util=require(_0x500a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x500a('0x1'));var fs=require('fs');var Redis=require(_0x500a('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x500a('0x3'))(_0x500a('0x4'));var config=require(_0x500a('0x5'));var jayson=require(_0x500a('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30f5ba,_0xcf1f73,_0x5387e3){return new BPromise(function(_0x3f6814,_0x236863){return client[_0x500a('0x7')](_0x30f5ba,_0x5387e3)[_0x500a('0x8')](function(_0x2a664c){logger['info'](_0x500a('0x9'),_0xcf1f73,_0x500a('0xa'));logger['debug'](_0x500a('0xb'),_0xcf1f73,_0x500a('0xa'),JSON[_0x500a('0xc')](_0x2a664c));if(_0x2a664c[_0x500a('0xd')]){if(_0x2a664c[_0x500a('0xd')][_0x500a('0xe')]===0x1f4){logger[_0x500a('0xd')](_0x500a('0x9'),_0xcf1f73,_0x2a664c['error'][_0x500a('0xf')]);return _0x236863(_0x2a664c[_0x500a('0xd')][_0x500a('0xf')]);}logger['error'](_0x500a('0x9'),_0xcf1f73,_0x2a664c['error'][_0x500a('0xf')]);return _0x3f6814(_0x2a664c[_0x500a('0xd')][_0x500a('0xf')]);}else{logger['info'](_0x500a('0x9'),_0xcf1f73,'request\x20sent');_0x3f6814(_0x2a664c[_0x500a('0x10')]['message']);}})['catch'](function(_0x37816f){logger[_0x500a('0xd')](_0x500a('0x9'),_0xcf1f73,_0x37816f);_0x236863(_0x37816f);});});} \ No newline at end of file +var _0x74ea=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x124a10,_0x1b857c){var _0x26c5fc=function(_0x1fa15a){while(--_0x1fa15a){_0x124a10['push'](_0x124a10['shift']());}};_0x26c5fc(++_0x1b857c);}(_0x74ea,0x19a));var _0xa74e=function(_0x2871a,_0x5e6001){_0x2871a=_0x2871a-0x0;var _0x2e75fb=_0x74ea[_0x2871a];return _0x2e75fb;};'use strict';var _=require('lodash');var util=require(_0xa74e('0x0'));var moment=require(_0xa74e('0x1'));var BPromise=require(_0xa74e('0x2'));var rs=require(_0xa74e('0x3'));var fs=require('fs');var Redis=require(_0xa74e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa74e('0x5'));var logger=require(_0xa74e('0x6'))(_0xa74e('0x7'));var config=require('../../config/environment');var jayson=require(_0xa74e('0x8'));var client=jayson[_0xa74e('0x9')][_0xa74e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58f544,_0x4542f2,_0x6a2006){return new BPromise(function(_0x5e9324,_0x2e6239){return client[_0xa74e('0xb')](_0x58f544,_0x6a2006)[_0xa74e('0xc')](function(_0x2e3ff2){logger[_0xa74e('0xd')](_0xa74e('0xe'),_0x4542f2,_0xa74e('0xf'));logger[_0xa74e('0x10')](_0xa74e('0x11'),_0x4542f2,_0xa74e('0xf'),JSON['stringify'](_0x2e3ff2));if(_0x2e3ff2[_0xa74e('0x12')]){if(_0x2e3ff2[_0xa74e('0x12')][_0xa74e('0x13')]===0x1f4){logger[_0xa74e('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4542f2,_0x2e3ff2[_0xa74e('0x12')][_0xa74e('0x14')]);return _0x2e6239(_0x2e3ff2[_0xa74e('0x12')]['message']);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4542f2,_0x2e3ff2[_0xa74e('0x12')][_0xa74e('0x14')]);return _0x5e9324(_0x2e3ff2['error'][_0xa74e('0x14')]);}else{logger[_0xa74e('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4542f2,'request\x20sent');_0x5e9324(_0x2e3ff2[_0xa74e('0x15')][_0xa74e('0x14')]);}})[_0xa74e('0x16')](function(_0x1f2c0e){logger['error'](_0xa74e('0xe'),_0x4542f2,_0x1f2c0e);_0x2e6239(_0x1f2c0e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 83bca87..0fc632e 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 _0x1988=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util'];(function(_0x18cf74,_0x1b6eb6){var _0x2f6f1f=function(_0x29ca10){while(--_0x29ca10){_0x18cf74['push'](_0x18cf74['shift']());}};_0x2f6f1f(++_0x1b6eb6);}(_0x1988,0x1cc));var _0x8198=function(_0xfa2beb,_0x5727d3){_0xfa2beb=_0xfa2beb-0x0;var _0x432c07=_0x1988[_0xfa2beb];return _0x432c07;};'use strict';var multer=require(_0x8198('0x0'));var util=require(_0x8198('0x1'));var path=require(_0x8198('0x2'));var timeout=require(_0x8198('0x3'));var express=require(_0x8198('0x4'));var router=express[_0x8198('0x5')]();var fs_extra=require(_0x8198('0x6'));var auth=require(_0x8198('0x7'));var interaction=require(_0x8198('0x8'));var config=require(_0x8198('0x9'));var controller=require(_0x8198('0xa'));router[_0x8198('0xb')]('/',auth[_0x8198('0xc')](),controller[_0x8198('0xd')]);router[_0x8198('0xb')](_0x8198('0xe'),auth['isAuthenticated'](),controller[_0x8198('0xf')]);router['post']('/',auth[_0x8198('0xc')](),controller['create']);router[_0x8198('0x10')]('/:id',auth[_0x8198('0xc')](),controller[_0x8198('0x11')]);router[_0x8198('0x12')]('/:id',auth[_0x8198('0xc')](),controller[_0x8198('0x13')]);module[_0x8198('0x14')]=router; \ No newline at end of file +var _0x5e89=['isAuthenticated','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceField.controller'];(function(_0x8ecc2,_0x19dd6f){var _0x595889=function(_0x11990e){while(--_0x11990e){_0x8ecc2['push'](_0x8ecc2['shift']());}};_0x595889(++_0x19dd6f);}(_0x5e89,0x1bb));var _0x95e8=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5e89[_0x580576];return _0x3f55a0;};'use strict';var multer=require('multer');var util=require(_0x95e8('0x0'));var path=require('path');var timeout=require(_0x95e8('0x1'));var express=require(_0x95e8('0x2'));var router=express[_0x95e8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x95e8('0x4'));var config=require(_0x95e8('0x5'));var controller=require(_0x95e8('0x6'));router['get']('/',auth[_0x95e8('0x7')](),controller['index']);router['get']('/:id',auth[_0x95e8('0x7')](),controller['show']);router['post']('/',auth[_0x95e8('0x7')](),controller[_0x95e8('0x8')]);router[_0x95e8('0x9')](_0x95e8('0xa'),auth[_0x95e8('0x7')](),controller[_0x95e8('0xb')]);router[_0x95e8('0xc')](_0x95e8('0xa'),auth['isAuthenticated'](),controller[_0x95e8('0xd')]);module[_0x95e8('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index aaa02a7..58a39fe 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 _0x7fb5=['STRING','variable','customVariable','exports','ENUM','string','keyValue','picklist'];(function(_0x124f81,_0x5b8ec3){var _0x12c055=function(_0x7c41bd){while(--_0x7c41bd){_0x124f81['push'](_0x124f81['shift']());}};_0x12c055(++_0x5b8ec3);}(_0x7fb5,0x1cb));var _0x57fb=function(_0x36f9eb,_0x175bc4){_0x36f9eb=_0x36f9eb-0x0;var _0x45d85e=_0x7fb5[_0x36f9eb];return _0x45d85e;};'use strict';var Sequelize=require('sequelize');module[_0x57fb('0x0')]={'type':{'type':Sequelize[_0x57fb('0x1')](_0x57fb('0x2'),'variable','customVariable',_0x57fb('0x3'),_0x57fb('0x4')),'defaultValue':_0x57fb('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x57fb('0x5')]},'keyType':{'type':Sequelize[_0x57fb('0x1')](_0x57fb('0x2'),_0x57fb('0x6'),_0x57fb('0x7'))},'keyContent':{'type':Sequelize[_0x57fb('0x5')]},'idField':{'type':Sequelize[_0x57fb('0x5')]},'variableName':{'type':Sequelize[_0x57fb('0x5')]}}; \ No newline at end of file +var _0x15a8=['string','customVariable','keyValue','picklist','STRING','variable','sequelize','ENUM'];(function(_0x2c9509,_0x10ccaa){var _0x412190=function(_0x18cca4){while(--_0x18cca4){_0x2c9509['push'](_0x2c9509['shift']());}};_0x412190(++_0x10ccaa);}(_0x15a8,0x126));var _0x815a=function(_0x4940c4,_0x44bf9e){_0x4940c4=_0x4940c4-0x0;var _0x1f8347=_0x15a8[_0x4940c4];return _0x1f8347;};'use strict';var Sequelize=require(_0x815a('0x0'));module['exports']={'type':{'type':Sequelize[_0x815a('0x1')](_0x815a('0x2'),'variable',_0x815a('0x3'),_0x815a('0x4'),_0x815a('0x5')),'defaultValue':_0x815a('0x2')},'content':{'type':Sequelize[_0x815a('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x815a('0x1')](_0x815a('0x2'),_0x815a('0x7'),_0x815a('0x3'))},'keyContent':{'type':Sequelize[_0x815a('0x6')]},'idField':{'type':Sequelize[_0x815a('0x6')]},'variableName':{'type':Sequelize[_0x815a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index caf23f1..7cfcd5c 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 _0xe66b=['name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','options','include','rows','catch','show','params','create','body','find','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','end','stack'];(function(_0x506002,_0x17ad62){var _0x5a020c=function(_0xf907bc){while(--_0xf907bc){_0x506002['push'](_0x506002['shift']());}};_0x5a020c(++_0x17ad62);}(_0xe66b,0x65));var _0xbe66=function(_0x3d1f94,_0x5aa44a){_0x3d1f94=_0x3d1f94-0x0;var _0x11a88a=_0xe66b[_0x3d1f94];return _0x11a88a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbe66('0x0'));var jsonpatch=require(_0xbe66('0x1'));var rp=require(_0xbe66('0x2'));var moment=require(_0xbe66('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe66('0x4'));var util=require(_0xbe66('0x5'));var path=require(_0xbe66('0x6'));var sox=require('sox');var csv=require(_0xbe66('0x7'));var ejs=require(_0xbe66('0x8'));var fs=require('fs');var fs_extra=require(_0xbe66('0x9'));var _=require(_0xbe66('0xa'));var squel=require(_0xbe66('0xb'));var crypto=require(_0xbe66('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbe66('0xd'));var toCsv=require(_0xbe66('0x7'));var querystring=require(_0xbe66('0xe'));var Papa=require(_0xbe66('0xf'));var Redis=require('ioredis');var authService=require(_0xbe66('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbe66('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbe66('0x12'));var utils=require(_0xbe66('0x13'));var config=require(_0xbe66('0x14'));var licenseUtil=require(_0xbe66('0x15'));var db=require(_0xbe66('0x16'))['db'];function respondWithStatusCode(_0x454c5d,_0x1c395f){_0x1c395f=_0x1c395f||0xcc;return function(_0x12382c){if(_0x12382c){return _0x454c5d['sendStatus'](_0x1c395f);}return _0x454c5d[_0xbe66('0x17')](_0x1c395f)['end']();};}function respondWithResult(_0x1728ea,_0x5dc761){_0x5dc761=_0x5dc761||0xc8;return function(_0x2b95d7){if(_0x2b95d7){return _0x1728ea[_0xbe66('0x17')](_0x5dc761)[_0xbe66('0x18')](_0x2b95d7);}};}function respondWithFilteredResult(_0x2432b8,_0xd35052){return function(_0x2d91ea){if(_0x2d91ea){var _0x5e7f1f=typeof _0xd35052[_0xbe66('0x19')]===_0xbe66('0x1a')&&typeof _0xd35052[_0xbe66('0x1b')]==='undefined';var _0x277786=_0x2d91ea[_0xbe66('0x1c')];var _0x76717a=_0x5e7f1f?0x0:_0xd35052[_0xbe66('0x19')];var _0x23bc5a=_0x5e7f1f?_0x2d91ea[_0xbe66('0x1c')]:_0xd35052['offset']+_0xd35052[_0xbe66('0x1b')];var _0x2f7ffc;if(_0x23bc5a>=_0x277786){_0x23bc5a=_0x277786;_0x2f7ffc=0xc8;}else{_0x2f7ffc=0xce;}_0x2432b8[_0xbe66('0x17')](_0x2f7ffc);return _0x2432b8[_0xbe66('0x1d')](_0xbe66('0x1e'),_0x76717a+'-'+_0x23bc5a+'/'+_0x277786)[_0xbe66('0x18')](_0x2d91ea);}return null;};}function patchUpdates(_0x5b1e7f){return function(_0x1fbcae){try{jsonpatch['apply'](_0x1fbcae,_0x5b1e7f,!![]);}catch(_0x1eae01){return BPromise['reject'](_0x1eae01);}return _0x1fbcae[_0xbe66('0x1f')]();};}function saveUpdates(_0xc98735,_0x16b295){return function(_0x46081d){if(_0x46081d){return _0x46081d[_0xbe66('0x20')](_0xc98735)['then'](function(_0x3015ec){return _0x3015ec;});}return null;};}function removeEntity(_0xb6744a,_0x1ce5d6){return function(_0x48700c){if(_0x48700c){return _0x48700c[_0xbe66('0x21')]()[_0xbe66('0x22')](function(){_0xb6744a[_0xbe66('0x17')](0xcc)[_0xbe66('0x23')]();});}};}function handleEntityNotFound(_0x45bb40,_0x26e6a4){return function(_0x57390f){if(!_0x57390f){_0x45bb40['sendStatus'](0x194);}return _0x57390f;};}function handleError(_0xb37a00,_0x2f9325){_0x2f9325=_0x2f9325||0x1f4;return function(_0xed5496){logger['error'](_0xed5496[_0xbe66('0x24')]);if(_0xed5496[_0xbe66('0x25')]){delete _0xed5496[_0xbe66('0x25')];}_0xb37a00[_0xbe66('0x17')](_0x2f9325)[_0xbe66('0x26')](_0xed5496);};}exports[_0xbe66('0x27')]=function(_0x329b93,_0x84f39b){var _0x35d6db={},_0x3df376={},_0x56eac6={'count':0x0,'rows':[]};var _0x23adfe=_[_0xbe66('0x28')](db[_0xbe66('0x29')][_0xbe66('0x2a')],function(_0x1d7ae2){return{'name':_0x1d7ae2[_0xbe66('0x2b')],'type':_0x1d7ae2[_0xbe66('0x2c')][_0xbe66('0x2d')]};});_0x3df376['model']=_[_0xbe66('0x28')](_0x23adfe,_0xbe66('0x25'));_0x3df376[_0xbe66('0x2e')]=_[_0xbe66('0x2f')](_0x329b93[_0xbe66('0x2e')]);_0x3df376[_0xbe66('0x30')]=_['intersection'](_0x3df376[_0xbe66('0x31')],_0x3df376[_0xbe66('0x2e')]);_0x35d6db['attributes']=_[_0xbe66('0x32')](_0x3df376['model'],qs[_0xbe66('0x33')](_0x329b93[_0xbe66('0x2e')][_0xbe66('0x33')]));_0x35d6db[_0xbe66('0x34')]=_0x35d6db[_0xbe66('0x34')][_0xbe66('0x35')]?_0x35d6db['attributes']:_0x3df376[_0xbe66('0x31')];if(!_0x329b93[_0xbe66('0x2e')]['hasOwnProperty'](_0xbe66('0x36'))){_0x35d6db[_0xbe66('0x1b')]=qs['limit'](_0x329b93[_0xbe66('0x2e')]['limit']);_0x35d6db[_0xbe66('0x19')]=qs[_0xbe66('0x19')](_0x329b93[_0xbe66('0x2e')][_0xbe66('0x19')]);}_0x35d6db[_0xbe66('0x37')]=qs[_0xbe66('0x38')](_0x329b93[_0xbe66('0x2e')][_0xbe66('0x38')]);_0x35d6db[_0xbe66('0x39')]=qs[_0xbe66('0x30')](_['pick'](_0x329b93[_0xbe66('0x2e')],_0x3df376[_0xbe66('0x30')]),_0x23adfe);if(_0x329b93['query']['filter']){_0x35d6db['where']=_[_0xbe66('0x3a')](_0x35d6db[_0xbe66('0x39')],{'$or':_[_0xbe66('0x28')](_0x23adfe,function(_0x5df799){if(_0x5df799[_0xbe66('0x2c')]!==_0xbe66('0x3b')){var _0x23b060={};_0x23b060[_0x5df799['name']]={'$like':'%'+_0x329b93['query']['filter']+'%'};return _0x23b060;}})});}_0x35d6db=_[_0xbe66('0x3a')]({},_0x35d6db,_0x329b93[_0xbe66('0x3c')]);var _0x22b697={'where':_0x35d6db[_0xbe66('0x39')]};return db[_0xbe66('0x29')][_0xbe66('0x1c')](_0x22b697)[_0xbe66('0x22')](function(_0x4ad6d8){_0x56eac6[_0xbe66('0x1c')]=_0x4ad6d8;if(_0x329b93[_0xbe66('0x2e')]['includeAll']){_0x35d6db[_0xbe66('0x3d')]=[{'all':!![]}];}return db[_0xbe66('0x29')]['findAll'](_0x35d6db);})['then'](function(_0x25a4fc){_0x56eac6[_0xbe66('0x3e')]=_0x25a4fc;return _0x56eac6;})[_0xbe66('0x22')](respondWithFilteredResult(_0x84f39b,_0x35d6db))[_0xbe66('0x3f')](handleError(_0x84f39b,null));};exports[_0xbe66('0x40')]=function(_0x5c49f9,_0xaaaa9b){var _0x3c6749={'raw':!![],'where':{'id':_0x5c49f9[_0xbe66('0x41')]['id']}},_0x39e442={};_0x39e442[_0xbe66('0x31')]=_[_0xbe66('0x2f')](db['SalesforceField'][_0xbe66('0x2a')]);_0x39e442[_0xbe66('0x2e')]=_[_0xbe66('0x2f')](_0x5c49f9[_0xbe66('0x2e')]);_0x39e442[_0xbe66('0x30')]=_['intersection'](_0x39e442[_0xbe66('0x31')],_0x39e442[_0xbe66('0x2e')]);_0x3c6749[_0xbe66('0x34')]=_['intersection'](_0x39e442['model'],qs['fields'](_0x5c49f9[_0xbe66('0x2e')][_0xbe66('0x33')]));_0x3c6749[_0xbe66('0x34')]=_0x3c6749['attributes']['length']?_0x3c6749[_0xbe66('0x34')]:_0x39e442[_0xbe66('0x31')];if(_0x5c49f9[_0xbe66('0x2e')]['includeAll']){_0x3c6749[_0xbe66('0x3d')]=[{'all':!![]}];}_0x3c6749=_[_0xbe66('0x3a')]({},_0x3c6749,_0x5c49f9[_0xbe66('0x3c')]);return db['SalesforceField']['find'](_0x3c6749)[_0xbe66('0x22')](handleEntityNotFound(_0xaaaa9b,null))[_0xbe66('0x22')](respondWithResult(_0xaaaa9b,null))['catch'](handleError(_0xaaaa9b,null));};exports[_0xbe66('0x42')]=function(_0x2e7b28,_0x39ba07){return db[_0xbe66('0x29')][_0xbe66('0x42')](_0x2e7b28[_0xbe66('0x43')],{})[_0xbe66('0x22')](respondWithResult(_0x39ba07,0xc9))[_0xbe66('0x3f')](handleError(_0x39ba07,null));};exports['update']=function(_0x2669e9,_0x3e3456){if(_0x2669e9[_0xbe66('0x43')]['id']){delete _0x2669e9[_0xbe66('0x43')]['id'];}return db[_0xbe66('0x29')][_0xbe66('0x44')]({'where':{'id':_0x2669e9[_0xbe66('0x41')]['id']}})[_0xbe66('0x22')](handleEntityNotFound(_0x3e3456,null))[_0xbe66('0x22')](saveUpdates(_0x2669e9[_0xbe66('0x43')],null))[_0xbe66('0x22')](respondWithResult(_0x3e3456,null))[_0xbe66('0x3f')](handleError(_0x3e3456,null));};exports[_0xbe66('0x21')]=function(_0x3a0176,_0x113537){return db[_0xbe66('0x29')]['find']({'where':{'id':_0x3a0176[_0xbe66('0x41')]['id']}})[_0xbe66('0x22')](handleEntityNotFound(_0x113537,null))[_0xbe66('0x22')](removeEntity(_0x113537,null))['catch'](handleError(_0x113537,null));}; \ No newline at end of file +var _0xe141=['catch','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','options','SalesforceField','includeAll','include','findAll','rows'];(function(_0x2efd1d,_0x44f696){var _0x1ef3f6=function(_0x25da5f){while(--_0x25da5f){_0x2efd1d['push'](_0x2efd1d['shift']());}};_0x1ef3f6(++_0x44f696);}(_0xe141,0x169));var _0x1e14=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0xe141[_0x56fe98];return _0x212f4f;};'use strict';var emlformat=require(_0x1e14('0x0'));var rimraf=require(_0x1e14('0x1'));var zipdir=require(_0x1e14('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e14('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1e14('0x4'));var util=require(_0x1e14('0x5'));var path=require(_0x1e14('0x6'));var sox=require(_0x1e14('0x7'));var csv=require(_0x1e14('0x8'));var ejs=require(_0x1e14('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e14('0xa'));var squel=require(_0x1e14('0xb'));var crypto=require('crypto');var jsforce=require(_0x1e14('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1e14('0x8'));var querystring=require(_0x1e14('0xd'));var Papa=require(_0x1e14('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1e14('0xf'));var hardwareService=require(_0x1e14('0x10'));var logger=require(_0x1e14('0x11'))(_0x1e14('0x12'));var utils=require(_0x1e14('0x13'));var config=require(_0x1e14('0x14'));var licenseUtil=require(_0x1e14('0x15'));var db=require(_0x1e14('0x16'))['db'];function respondWithStatusCode(_0x2a5916,_0x5ce0f4){_0x5ce0f4=_0x5ce0f4||0xcc;return function(_0x54632a){if(_0x54632a){return _0x2a5916['sendStatus'](_0x5ce0f4);}return _0x2a5916[_0x1e14('0x17')](_0x5ce0f4)[_0x1e14('0x18')]();};}function respondWithResult(_0x406351,_0x4b5c78){_0x4b5c78=_0x4b5c78||0xc8;return function(_0x151149){if(_0x151149){return _0x406351[_0x1e14('0x17')](_0x4b5c78)[_0x1e14('0x19')](_0x151149);}};}function respondWithFilteredResult(_0x52edff,_0x7b0309){return function(_0x3474df){if(_0x3474df){var _0x4d819b=typeof _0x7b0309[_0x1e14('0x1a')]===_0x1e14('0x1b')&&typeof _0x7b0309['limit']===_0x1e14('0x1b');var _0x3d93d8=_0x3474df[_0x1e14('0x1c')];var _0xfd0649=_0x4d819b?0x0:_0x7b0309[_0x1e14('0x1a')];var _0x517477=_0x4d819b?_0x3474df[_0x1e14('0x1c')]:_0x7b0309[_0x1e14('0x1a')]+_0x7b0309['limit'];var _0x5703ae;if(_0x517477>=_0x3d93d8){_0x517477=_0x3d93d8;_0x5703ae=0xc8;}else{_0x5703ae=0xce;}_0x52edff['status'](_0x5703ae);return _0x52edff[_0x1e14('0x1d')]('Content-Range',_0xfd0649+'-'+_0x517477+'/'+_0x3d93d8)[_0x1e14('0x19')](_0x3474df);}return null;};}function patchUpdates(_0x427337){return function(_0x271c64){try{jsonpatch[_0x1e14('0x1e')](_0x271c64,_0x427337,!![]);}catch(_0x2b0119){return BPromise['reject'](_0x2b0119);}return _0x271c64[_0x1e14('0x1f')]();};}function saveUpdates(_0x35e90a,_0x57a4f0){return function(_0x37a8a2){if(_0x37a8a2){return _0x37a8a2[_0x1e14('0x20')](_0x35e90a)[_0x1e14('0x21')](function(_0x194320){return _0x194320;});}return null;};}function removeEntity(_0x5c925b,_0x2f4e5f){return function(_0x4844e1){if(_0x4844e1){return _0x4844e1[_0x1e14('0x22')]()[_0x1e14('0x21')](function(){_0x5c925b[_0x1e14('0x17')](0xcc)[_0x1e14('0x18')]();});}};}function handleEntityNotFound(_0x3e40fb,_0x328709){return function(_0x35f70f){if(!_0x35f70f){_0x3e40fb[_0x1e14('0x23')](0x194);}return _0x35f70f;};}function handleError(_0x4b7fc1,_0x511964){_0x511964=_0x511964||0x1f4;return function(_0x2547fd){logger[_0x1e14('0x24')](_0x2547fd['stack']);if(_0x2547fd[_0x1e14('0x25')]){delete _0x2547fd[_0x1e14('0x25')];}_0x4b7fc1[_0x1e14('0x17')](_0x511964)[_0x1e14('0x26')](_0x2547fd);};}exports[_0x1e14('0x27')]=function(_0x44e572,_0x5b375a){var _0x3e4175={},_0x323fdc={},_0x37aecc={'count':0x0,'rows':[]};var _0x5a47b6=_['map'](db['SalesforceField']['rawAttributes'],function(_0x3b575d){return{'name':_0x3b575d[_0x1e14('0x28')],'type':_0x3b575d[_0x1e14('0x29')]['key']};});_0x323fdc[_0x1e14('0x2a')]=_[_0x1e14('0x2b')](_0x5a47b6,_0x1e14('0x25'));_0x323fdc[_0x1e14('0x2c')]=_[_0x1e14('0x2d')](_0x44e572[_0x1e14('0x2c')]);_0x323fdc[_0x1e14('0x2e')]=_[_0x1e14('0x2f')](_0x323fdc[_0x1e14('0x2a')],_0x323fdc['query']);_0x3e4175[_0x1e14('0x30')]=_['intersection'](_0x323fdc[_0x1e14('0x2a')],qs[_0x1e14('0x31')](_0x44e572[_0x1e14('0x2c')][_0x1e14('0x31')]));_0x3e4175[_0x1e14('0x30')]=_0x3e4175[_0x1e14('0x30')][_0x1e14('0x32')]?_0x3e4175[_0x1e14('0x30')]:_0x323fdc['model'];if(!_0x44e572['query']['hasOwnProperty'](_0x1e14('0x33'))){_0x3e4175[_0x1e14('0x34')]=qs[_0x1e14('0x34')](_0x44e572['query'][_0x1e14('0x34')]);_0x3e4175[_0x1e14('0x1a')]=qs['offset'](_0x44e572[_0x1e14('0x2c')][_0x1e14('0x1a')]);}_0x3e4175[_0x1e14('0x35')]=qs['sort'](_0x44e572[_0x1e14('0x2c')][_0x1e14('0x36')]);_0x3e4175['where']=qs[_0x1e14('0x2e')](_[_0x1e14('0x37')](_0x44e572[_0x1e14('0x2c')],_0x323fdc[_0x1e14('0x2e')]),_0x5a47b6);if(_0x44e572['query'][_0x1e14('0x38')]){_0x3e4175[_0x1e14('0x39')]=_['merge'](_0x3e4175[_0x1e14('0x39')],{'$or':_['map'](_0x5a47b6,function(_0x4b4592){if(_0x4b4592[_0x1e14('0x29')]!=='VIRTUAL'){var _0x558e5f={};_0x558e5f[_0x4b4592[_0x1e14('0x25')]]={'$like':'%'+_0x44e572['query'][_0x1e14('0x38')]+'%'};return _0x558e5f;}})});}_0x3e4175=_[_0x1e14('0x3a')]({},_0x3e4175,_0x44e572[_0x1e14('0x3b')]);var _0x31cf06={'where':_0x3e4175[_0x1e14('0x39')]};return db[_0x1e14('0x3c')]['count'](_0x31cf06)['then'](function(_0x446f80){_0x37aecc[_0x1e14('0x1c')]=_0x446f80;if(_0x44e572[_0x1e14('0x2c')][_0x1e14('0x3d')]){_0x3e4175[_0x1e14('0x3e')]=[{'all':!![]}];}return db[_0x1e14('0x3c')][_0x1e14('0x3f')](_0x3e4175);})[_0x1e14('0x21')](function(_0x25630a){_0x37aecc[_0x1e14('0x40')]=_0x25630a;return _0x37aecc;})[_0x1e14('0x21')](respondWithFilteredResult(_0x5b375a,_0x3e4175))[_0x1e14('0x41')](handleError(_0x5b375a,null));};exports['show']=function(_0x54dbfd,_0x2c7bce){var _0x3babc1={'raw':!![],'where':{'id':_0x54dbfd[_0x1e14('0x42')]['id']}},_0x2e27bb={};_0x2e27bb[_0x1e14('0x2a')]=_['keys'](db[_0x1e14('0x3c')][_0x1e14('0x43')]);_0x2e27bb['query']=_[_0x1e14('0x2d')](_0x54dbfd[_0x1e14('0x2c')]);_0x2e27bb[_0x1e14('0x2e')]=_[_0x1e14('0x2f')](_0x2e27bb[_0x1e14('0x2a')],_0x2e27bb[_0x1e14('0x2c')]);_0x3babc1[_0x1e14('0x30')]=_[_0x1e14('0x2f')](_0x2e27bb[_0x1e14('0x2a')],qs[_0x1e14('0x31')](_0x54dbfd[_0x1e14('0x2c')][_0x1e14('0x31')]));_0x3babc1[_0x1e14('0x30')]=_0x3babc1[_0x1e14('0x30')][_0x1e14('0x32')]?_0x3babc1[_0x1e14('0x30')]:_0x2e27bb[_0x1e14('0x2a')];if(_0x54dbfd[_0x1e14('0x2c')][_0x1e14('0x3d')]){_0x3babc1[_0x1e14('0x3e')]=[{'all':!![]}];}_0x3babc1=_[_0x1e14('0x3a')]({},_0x3babc1,_0x54dbfd[_0x1e14('0x3b')]);return db[_0x1e14('0x3c')][_0x1e14('0x44')](_0x3babc1)[_0x1e14('0x21')](handleEntityNotFound(_0x2c7bce,null))[_0x1e14('0x21')](respondWithResult(_0x2c7bce,null))[_0x1e14('0x41')](handleError(_0x2c7bce,null));};exports[_0x1e14('0x45')]=function(_0x356bc5,_0x1bb67f){return db[_0x1e14('0x3c')]['create'](_0x356bc5[_0x1e14('0x46')],{})['then'](respondWithResult(_0x1bb67f,0xc9))[_0x1e14('0x41')](handleError(_0x1bb67f,null));};exports['update']=function(_0x39b79c,_0x245ac9){if(_0x39b79c[_0x1e14('0x46')]['id']){delete _0x39b79c[_0x1e14('0x46')]['id'];}return db[_0x1e14('0x3c')]['find']({'where':{'id':_0x39b79c[_0x1e14('0x42')]['id']}})[_0x1e14('0x21')](handleEntityNotFound(_0x245ac9,null))[_0x1e14('0x21')](saveUpdates(_0x39b79c[_0x1e14('0x46')],null))['then'](respondWithResult(_0x245ac9,null))[_0x1e14('0x41')](handleError(_0x245ac9,null));};exports[_0x1e14('0x22')]=function(_0x108db0,_0x1c18ba){return db[_0x1e14('0x3c')][_0x1e14('0x44')]({'where':{'id':_0x108db0[_0x1e14('0x42')]['id']}})[_0x1e14('0x21')](handleEntityNotFound(_0x1c18ba,null))[_0x1e14('0x21')](removeEntity(_0x1c18ba,null))[_0x1e14('0x41')](handleError(_0x1c18ba,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 12054f4..3ee049b 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 _0x8030=['./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x23394b,_0xc24402){var _0x2f3683=function(_0x47142a){while(--_0x47142a){_0x23394b['push'](_0x23394b['shift']());}};_0x2f3683(++_0xc24402);}(_0x8030,0x123));var _0x0803=function(_0x13b621,_0x121dee){_0x13b621=_0x13b621-0x0;var _0x3b9df5=_0x8030[_0x13b621];return _0x3b9df5;};'use strict';var _=require(_0x0803('0x0'));var util=require(_0x0803('0x1'));var logger=require(_0x0803('0x2'))('api');var moment=require(_0x0803('0x3'));var BPromise=require(_0x0803('0x4'));var rp=require(_0x0803('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0803('0x6'));var config=require(_0x0803('0x7'));var attributes=require(_0x0803('0x8'));module['exports']=function(_0x54fae2,_0xd4a4d5){return _0x54fae2[_0x0803('0x9')](_0x0803('0xa'),attributes,{'tableName':_0x0803('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x0803('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb591=['define','int_salesforce_fields','FieldId','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0x2aa8bd,_0x3c759d){var _0x3be418=function(_0x13fd0b){while(--_0x13fd0b){_0x2aa8bd['push'](_0x2aa8bd['shift']());}};_0x3be418(++_0x3c759d);}(_0xb591,0x1d7));var _0x1b59=function(_0x23aea4,_0x3c50ca){_0x23aea4=_0x23aea4-0x0;var _0x59a250=_0xb591[_0x23aea4];return _0x59a250;};'use strict';var _=require(_0x1b59('0x0'));var util=require('util');var logger=require(_0x1b59('0x1'))(_0x1b59('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1b59('0x3'));var fs=require('fs');var path=require(_0x1b59('0x4'));var rimraf=require(_0x1b59('0x5'));var config=require(_0x1b59('0x6'));var attributes=require(_0x1b59('0x7'));module[_0x1b59('0x8')]=function(_0x3c3fcf,_0x1c9743){return _0x3c3fcf[_0x1b59('0x9')]('SalesforceField',attributes,{'tableName':_0x1b59('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0x1b59('0xb')],'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 e7c1e43..6201b4d 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 _0xb56f=['request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3e6bef,_0x927374){var _0x363206=function(_0x34dad6){while(--_0x34dad6){_0x3e6bef['push'](_0x3e6bef['shift']());}};_0x363206(++_0x927374);}(_0xb56f,0x156));var _0xfb56=function(_0x55d580,_0x304cb3){_0x55d580=_0x55d580-0x0;var _0x1a822e=_0xb56f[_0x55d580];return _0x1a822e;};'use strict';var _=require(_0xfb56('0x0'));var util=require(_0xfb56('0x1'));var moment=require(_0xfb56('0x2'));var BPromise=require(_0xfb56('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb56('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfb56('0x5'))(_0xfb56('0x6'));var config=require(_0xfb56('0x7'));var jayson=require(_0xfb56('0x8'));var client=jayson[_0xfb56('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43fba1,_0x543374,_0x1076d9){return new BPromise(function(_0x141216,_0x5015e1){return client[_0xfb56('0xa')](_0x43fba1,_0x1076d9)[_0xfb56('0xb')](function(_0x6e4d36){logger['info'](_0xfb56('0xc'),_0x543374,_0xfb56('0xd'));logger[_0xfb56('0xe')](_0xfb56('0xf'),_0x543374,_0xfb56('0xd'),JSON[_0xfb56('0x10')](_0x6e4d36));if(_0x6e4d36[_0xfb56('0x11')]){if(_0x6e4d36[_0xfb56('0x11')][_0xfb56('0x12')]===0x1f4){logger[_0xfb56('0x11')]('SalesforceField,\x20%s,\x20%s',_0x543374,_0x6e4d36[_0xfb56('0x11')]['message']);return _0x5015e1(_0x6e4d36[_0xfb56('0x11')]['message']);}logger[_0xfb56('0x11')](_0xfb56('0xc'),_0x543374,_0x6e4d36[_0xfb56('0x11')][_0xfb56('0x13')]);return _0x141216(_0x6e4d36[_0xfb56('0x11')][_0xfb56('0x13')]);}else{logger['info'](_0xfb56('0xc'),_0x543374,_0xfb56('0xd'));_0x141216(_0x6e4d36[_0xfb56('0x14')][_0xfb56('0x13')]);}})[_0xfb56('0x15')](function(_0x1ba7df){logger['error'](_0xfb56('0xc'),_0x543374,_0x1ba7df);_0x5015e1(_0x1ba7df);});});} \ No newline at end of file +var _0xe129=['SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x52bb0e,_0x780c22){var _0x3097e9=function(_0x792500){while(--_0x792500){_0x52bb0e['push'](_0x52bb0e['shift']());}};_0x3097e9(++_0x780c22);}(_0xe129,0x176));var _0x9e12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe129[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9e12('0x0'));var util=require(_0x9e12('0x1'));var moment=require(_0x9e12('0x2'));var BPromise=require(_0x9e12('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e12('0x4'));var db=require(_0x9e12('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e12('0x6'))(_0x9e12('0x7'));var config=require(_0x9e12('0x8'));var jayson=require(_0x9e12('0x9'));var client=jayson[_0x9e12('0xa')][_0x9e12('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c0af1,_0x5cae25,_0x1d9530){return new BPromise(function(_0x36c112,_0x14c880){return client[_0x9e12('0xc')](_0x4c0af1,_0x1d9530)['then'](function(_0x5b8a33){logger[_0x9e12('0xd')](_0x9e12('0xe'),_0x5cae25,_0x9e12('0xf'));logger[_0x9e12('0x10')](_0x9e12('0x11'),_0x5cae25,_0x9e12('0xf'),JSON[_0x9e12('0x12')](_0x5b8a33));if(_0x5b8a33[_0x9e12('0x13')]){if(_0x5b8a33['error'][_0x9e12('0x14')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x5cae25,_0x5b8a33[_0x9e12('0x13')][_0x9e12('0x15')]);return _0x14c880(_0x5b8a33['error'][_0x9e12('0x15')]);}logger[_0x9e12('0x13')](_0x9e12('0xe'),_0x5cae25,_0x5b8a33[_0x9e12('0x13')][_0x9e12('0x15')]);return _0x36c112(_0x5b8a33[_0x9e12('0x13')]['message']);}else{logger[_0x9e12('0xd')](_0x9e12('0xe'),_0x5cae25,'request\x20sent');_0x36c112(_0x5b8a33[_0x9e12('0x16')]['message']);}})['catch'](function(_0x5409a7){logger['error'](_0x9e12('0xe'),_0x5cae25,_0x5409a7);_0x14c880(_0x5409a7);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 42fa107..c3e883c 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 _0x47e1=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','multer','util'];(function(_0x381ba2,_0x35f9a3){var _0xaf63a3=function(_0x44edcf){while(--_0x44edcf){_0x381ba2['push'](_0x381ba2['shift']());}};_0xaf63a3(++_0x35f9a3);}(_0x47e1,0x76));var _0x147e=function(_0x5dc9db,_0x2aa098){_0x5dc9db=_0x5dc9db-0x0;var _0x27fd96=_0x47e1[_0x5dc9db];return _0x27fd96;};'use strict';var multer=require(_0x147e('0x0'));var util=require(_0x147e('0x1'));var path=require(_0x147e('0x2'));var timeout=require(_0x147e('0x3'));var express=require(_0x147e('0x4'));var router=express[_0x147e('0x5')]();var fs_extra=require(_0x147e('0x6'));var auth=require(_0x147e('0x7'));var interaction=require(_0x147e('0x8'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0x147e('0x9')]('/',auth[_0x147e('0xa')](),controller[_0x147e('0xb')]);router['get'](_0x147e('0xc'),auth[_0x147e('0xa')](),controller[_0x147e('0xd')]);router[_0x147e('0x9')](_0x147e('0xe'),auth[_0x147e('0xa')](),controller[_0x147e('0xf')]);router[_0x147e('0x9')](_0x147e('0x10'),auth[_0x147e('0xa')](),controller[_0x147e('0x11')]);router[_0x147e('0x12')]('/',auth[_0x147e('0xa')](),controller[_0x147e('0x13')]);router['post'](_0x147e('0xe'),auth[_0x147e('0xa')](),controller['addConfiguration']);router[_0x147e('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x147e('0x15')]);router[_0x147e('0x16')]('/:id',auth[_0x147e('0xa')](),controller[_0x147e('0x17')]);module['exports']=router; \ No newline at end of file +var _0xf662=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update'];(function(_0x49253a,_0x4883d1){var _0x471008=function(_0x2c6210){while(--_0x2c6210){_0x49253a['push'](_0x49253a['shift']());}};_0x471008(++_0x4883d1);}(_0xf662,0x116));var _0x2f66=function(_0x9e1d73,_0xcf6479){_0x9e1d73=_0x9e1d73-0x0;var _0x1ba603=_0xf662[_0x9e1d73];return _0x1ba603;};'use strict';var multer=require(_0x2f66('0x0'));var util=require('util');var path=require(_0x2f66('0x1'));var timeout=require(_0x2f66('0x2'));var express=require(_0x2f66('0x3'));var router=express['Router']();var fs_extra=require(_0x2f66('0x4'));var auth=require(_0x2f66('0x5'));var interaction=require(_0x2f66('0x6'));var config=require(_0x2f66('0x7'));var controller=require(_0x2f66('0x8'));router['get']('/',auth[_0x2f66('0x9')](),controller[_0x2f66('0xa')]);router[_0x2f66('0xb')](_0x2f66('0xc'),auth['isAuthenticated'](),controller[_0x2f66('0xd')]);router[_0x2f66('0xb')](_0x2f66('0xe'),auth[_0x2f66('0x9')](),controller[_0x2f66('0xf')]);router['get'](_0x2f66('0x10'),auth['isAuthenticated'](),controller[_0x2f66('0x11')]);router[_0x2f66('0x12')]('/',auth[_0x2f66('0x9')](),controller['create']);router[_0x2f66('0x12')]('/:id/configurations',auth[_0x2f66('0x9')](),controller[_0x2f66('0x13')]);router[_0x2f66('0x14')](_0x2f66('0xc'),auth['isAuthenticated'](),controller[_0x2f66('0x15')]);router[_0x2f66('0x16')]('/:id',auth[_0x2f66('0x9')](),controller[_0x2f66('0x17')]);module[_0x2f66('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 8080b3b..2f71634 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 _0xfd14=['STRING','username','sequelize','exports'];(function(_0xd9f498,_0x1552fd){var _0x56bf87=function(_0x3f7ac1){while(--_0x3f7ac1){_0xd9f498['push'](_0xd9f498['shift']());}};_0x56bf87(++_0x1552fd);}(_0xfd14,0x6e));var _0x4fd1=function(_0x5a3eb8,_0x3c0509){_0x5a3eb8=_0x5a3eb8-0x0;var _0x3e5688=_0xfd14[_0x5a3eb8];return _0x3e5688;};'use strict';var Sequelize=require(_0x4fd1('0x0'));module[_0x4fd1('0x1')]={'name':{'type':Sequelize[_0x4fd1('0x2')]},'description':{'type':Sequelize[_0x4fd1('0x2')]},'username':{'type':Sequelize[_0x4fd1('0x2')],'unique':_0x4fd1('0x3')},'password':{'type':Sequelize[_0x4fd1('0x2')]},'email':{'type':Sequelize[_0x4fd1('0x2')]},'remoteUri':{'type':Sequelize[_0x4fd1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4fd1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6ecc=['username','exports','STRING'];(function(_0x1fa65c,_0x19c550){var _0xe65329=function(_0x3c5973){while(--_0x3c5973){_0x1fa65c['push'](_0x1fa65c['shift']());}};_0xe65329(++_0x19c550);}(_0x6ecc,0x16c));var _0xc6ec=function(_0x26973a,_0xb594ff){_0x26973a=_0x26973a-0x0;var _0x111c7b=_0x6ecc[_0x26973a];return _0x111c7b;};'use strict';var Sequelize=require('sequelize');module[_0xc6ec('0x0')]={'name':{'type':Sequelize[_0xc6ec('0x1')]},'description':{'type':Sequelize[_0xc6ec('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xc6ec('0x2')},'password':{'type':Sequelize[_0xc6ec('0x1')]},'email':{'type':Sequelize[_0xc6ec('0x1')]},'remoteUri':{'type':Sequelize[_0xc6ec('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc6ec('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 4034868..5c93685 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 _0x6b87=['addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','made_sla','subcategory','close_code','incident_state','severity','parent','child_incidents','hold_reason','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','cmdb_ci','impact','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','description','close_notes','follow_up','contact_type','problem_id','company','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','category','username','password','email','serverUrl','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','includes','forEach','internalType','label','push','all','assign','log','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','True','false','inactive','value','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','filter','where','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','ServicenowConfiguration','sort','pick'];(function(_0x10d276,_0x497004){var _0x220f87=function(_0x318ca2){while(--_0x318ca2){_0x10d276['push'](_0x10d276['shift']());}};_0x220f87(++_0x497004);}(_0x6b87,0x1b9));var _0x76b8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6b87[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x76b8('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76b8('0x1'));var moment=require(_0x76b8('0x2'));var BPromise=require(_0x76b8('0x3'));var Mustache=require(_0x76b8('0x4'));var util=require('util');var path=require(_0x76b8('0x5'));var sox=require(_0x76b8('0x6'));var csv=require(_0x76b8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76b8('0x8'));var squel=require(_0x76b8('0x9'));var crypto=require(_0x76b8('0xa'));var jsforce=require(_0x76b8('0xb'));var deskjs=require(_0x76b8('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x76b8('0xd'));var Redis=require('ioredis');var authService=require(_0x76b8('0xe'));var qs=require(_0x76b8('0xf'));var as=require(_0x76b8('0x10'));var hardwareService=require(_0x76b8('0x11'));var logger=require(_0x76b8('0x12'))(_0x76b8('0x13'));var utils=require(_0x76b8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x76b8('0x15'));var db=require(_0x76b8('0x16'))['db'];var integrations=require(_0x76b8('0x17'));function respondWithStatusCode(_0x3a1b64,_0x3882a8){_0x3882a8=_0x3882a8||0xcc;return function(_0x7f96a2){if(_0x7f96a2){return _0x3a1b64[_0x76b8('0x18')](_0x3882a8);}return _0x3a1b64[_0x76b8('0x19')](_0x3882a8)[_0x76b8('0x1a')]();};}function respondWithResult(_0x4797cf,_0x530487){_0x530487=_0x530487||0xc8;return function(_0x5667eb){if(_0x5667eb){return _0x4797cf[_0x76b8('0x19')](_0x530487)[_0x76b8('0x1b')](_0x5667eb);}};}function respondWithFilteredResult(_0x592f57,_0x4630b9){return function(_0x35c52b){if(_0x35c52b){var _0x3b34e4=typeof _0x4630b9[_0x76b8('0x1c')]===_0x76b8('0x1d')&&typeof _0x4630b9['limit']===_0x76b8('0x1d');var _0x355067=_0x35c52b['count'];var _0x3fb2cd=_0x3b34e4?0x0:_0x4630b9[_0x76b8('0x1c')];var _0x6be225=_0x3b34e4?_0x35c52b[_0x76b8('0x1e')]:_0x4630b9[_0x76b8('0x1c')]+_0x4630b9[_0x76b8('0x1f')];var _0x44f8df;if(_0x6be225>=_0x355067){_0x6be225=_0x355067;_0x44f8df=0xc8;}else{_0x44f8df=0xce;}_0x592f57['status'](_0x44f8df);return _0x592f57[_0x76b8('0x20')](_0x76b8('0x21'),_0x3fb2cd+'-'+_0x6be225+'/'+_0x355067)[_0x76b8('0x1b')](_0x35c52b);}return null;};}function patchUpdates(_0x7455bc){return function(_0x58fbff){try{jsonpatch[_0x76b8('0x22')](_0x58fbff,_0x7455bc,!![]);}catch(_0x31c235){return BPromise[_0x76b8('0x23')](_0x31c235);}return _0x58fbff[_0x76b8('0x24')]();};}function saveUpdates(_0x2ced19,_0x2a3938){return function(_0x26731f){if(_0x26731f){return _0x26731f['update'](_0x2ced19)[_0x76b8('0x25')](function(_0x1d2d82){return _0x1d2d82;});}return null;};}function removeEntity(_0x5db8e7,_0x2d2808){return function(_0xf1db1a){if(_0xf1db1a){return _0xf1db1a[_0x76b8('0x26')]()['then'](function(){_0x5db8e7[_0x76b8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8636a,_0x1e3751){return function(_0x58f75c){if(!_0x58f75c){_0x8636a['sendStatus'](0x194);}return _0x58f75c;};}function handleError(_0x160f04,_0x3c70b2){_0x3c70b2=_0x3c70b2||0x1f4;return function(_0x5af0c8){logger[_0x76b8('0x27')](_0x5af0c8[_0x76b8('0x28')]);if(_0x5af0c8[_0x76b8('0x29')]){delete _0x5af0c8[_0x76b8('0x29')];}_0x160f04[_0x76b8('0x19')](_0x3c70b2)['send'](_0x5af0c8);};}exports[_0x76b8('0x2a')]=function(_0x8d7369,_0x446e85){var _0x511a57={},_0x10f1f6={},_0x5d50ae={'count':0x0,'rows':[]};var _0x10f017=_[_0x76b8('0x2b')](db[_0x76b8('0x2c')][_0x76b8('0x2d')],function(_0x18dd6d){return{'name':_0x18dd6d[_0x76b8('0x2e')],'type':_0x18dd6d[_0x76b8('0x2f')][_0x76b8('0x30')]};});_0x10f1f6[_0x76b8('0x31')]=_[_0x76b8('0x2b')](_0x10f017,_0x76b8('0x29'));_0x10f1f6['query']=_[_0x76b8('0x32')](_0x8d7369[_0x76b8('0x33')]);_0x10f1f6[_0x76b8('0x34')]=_[_0x76b8('0x35')](_0x10f1f6[_0x76b8('0x31')],_0x10f1f6['query']);_0x511a57[_0x76b8('0x36')]=_[_0x76b8('0x35')](_0x10f1f6['model'],qs[_0x76b8('0x37')](_0x8d7369[_0x76b8('0x33')]['fields']));_0x511a57[_0x76b8('0x36')]=_0x511a57[_0x76b8('0x36')]['length']?_0x511a57[_0x76b8('0x36')]:_0x10f1f6[_0x76b8('0x31')];if(!_0x8d7369[_0x76b8('0x33')][_0x76b8('0x38')](_0x76b8('0x39'))){_0x511a57[_0x76b8('0x1f')]=qs[_0x76b8('0x1f')](_0x8d7369['query'][_0x76b8('0x1f')]);_0x511a57[_0x76b8('0x1c')]=qs['offset'](_0x8d7369[_0x76b8('0x33')][_0x76b8('0x1c')]);}_0x511a57[_0x76b8('0x3a')]=qs['sort'](_0x8d7369[_0x76b8('0x33')]['sort']);_0x511a57['where']=qs['filters'](_['pick'](_0x8d7369['query'],_0x10f1f6[_0x76b8('0x34')]),_0x10f017);if(_0x8d7369[_0x76b8('0x33')][_0x76b8('0x3b')]){_0x511a57[_0x76b8('0x3c')]=_[_0x76b8('0x3d')](_0x511a57[_0x76b8('0x3c')],{'$or':_['map'](_0x10f017,function(_0x3183f4){if(_0x3183f4[_0x76b8('0x2f')]!=='VIRTUAL'){var _0x46fb49={};_0x46fb49[_0x3183f4[_0x76b8('0x29')]]={'$like':'%'+_0x8d7369[_0x76b8('0x33')][_0x76b8('0x3b')]+'%'};return _0x46fb49;}})});}_0x511a57=_['merge']({},_0x511a57,_0x8d7369[_0x76b8('0x3e')]);var _0x12e09c={'where':_0x511a57[_0x76b8('0x3c')]};return db['ServicenowAccount'][_0x76b8('0x1e')](_0x12e09c)[_0x76b8('0x25')](function(_0x2e7ac4){_0x5d50ae[_0x76b8('0x1e')]=_0x2e7ac4;if(_0x8d7369[_0x76b8('0x33')][_0x76b8('0x3f')]){_0x511a57[_0x76b8('0x40')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x511a57);})[_0x76b8('0x25')](function(_0x193b7d){_0x5d50ae[_0x76b8('0x41')]=_0x193b7d;return _0x5d50ae;})['then'](respondWithFilteredResult(_0x446e85,_0x511a57))[_0x76b8('0x42')](handleError(_0x446e85,null));};exports[_0x76b8('0x43')]=function(_0x5cfae7,_0x4e3634){var _0x3bc072={'raw':![],'where':{'id':_0x5cfae7[_0x76b8('0x44')]['id']}},_0x560c8b={};_0x560c8b[_0x76b8('0x31')]=_['keys'](db[_0x76b8('0x2c')][_0x76b8('0x2d')]);_0x560c8b[_0x76b8('0x33')]=_[_0x76b8('0x32')](_0x5cfae7[_0x76b8('0x33')]);_0x560c8b[_0x76b8('0x34')]=_['intersection'](_0x560c8b[_0x76b8('0x31')],_0x560c8b['query']);_0x3bc072[_0x76b8('0x36')]=_[_0x76b8('0x35')](_0x560c8b['model'],qs[_0x76b8('0x37')](_0x5cfae7[_0x76b8('0x33')][_0x76b8('0x37')]));_0x3bc072[_0x76b8('0x36')]=_0x3bc072['attributes'][_0x76b8('0x45')]?_0x3bc072[_0x76b8('0x36')]:_0x560c8b[_0x76b8('0x31')];if(_0x5cfae7[_0x76b8('0x33')][_0x76b8('0x3f')]){_0x3bc072[_0x76b8('0x40')]=[{'all':!![]}];}_0x3bc072=_['merge']({},_0x3bc072,_0x5cfae7[_0x76b8('0x3e')]);return db[_0x76b8('0x2c')][_0x76b8('0x46')](_0x3bc072)['then'](handleEntityNotFound(_0x4e3634,null))[_0x76b8('0x25')](respondWithResult(_0x4e3634,null))['catch'](handleError(_0x4e3634,null));};exports[_0x76b8('0x47')]=function(_0x235a0e,_0x575510){return db[_0x76b8('0x2c')][_0x76b8('0x47')](_0x235a0e[_0x76b8('0x48')],{})[_0x76b8('0x25')](respondWithResult(_0x575510,0xc9))[_0x76b8('0x42')](handleError(_0x575510,null));};exports['update']=function(_0x4d787b,_0xabe2bd){if(_0x4d787b['body']['id']){delete _0x4d787b[_0x76b8('0x48')]['id'];}return db[_0x76b8('0x2c')][_0x76b8('0x46')]({'where':{'id':_0x4d787b[_0x76b8('0x44')]['id']}})[_0x76b8('0x25')](handleEntityNotFound(_0xabe2bd,null))['then'](saveUpdates(_0x4d787b[_0x76b8('0x48')],null))['then'](respondWithResult(_0xabe2bd,null))[_0x76b8('0x42')](handleError(_0xabe2bd,null));};exports[_0x76b8('0x26')]=function(_0x5d3cfb,_0x176b11){return db[_0x76b8('0x2c')][_0x76b8('0x46')]({'where':{'id':_0x5d3cfb[_0x76b8('0x44')]['id']}})['then'](handleEntityNotFound(_0x176b11,null))[_0x76b8('0x25')](removeEntity(_0x176b11,null))['catch'](handleError(_0x176b11,null));};exports[_0x76b8('0x49')]=function(_0x4ac7f6,_0x213761,_0x1d86e4){var _0xc8e21={};var _0x4593c0={};var _0x40f804;var _0x22a535;return db[_0x76b8('0x2c')][_0x76b8('0x4a')]({'where':{'id':_0x4ac7f6[_0x76b8('0x44')]['id']}})['then'](handleEntityNotFound(_0x213761,null))[_0x76b8('0x25')](function(_0x557335){if(_0x557335){_0x40f804=_0x557335;_0x4593c0[_0x76b8('0x31')]=_[_0x76b8('0x32')](db[_0x76b8('0x4b')][_0x76b8('0x2d')]);_0x4593c0[_0x76b8('0x33')]=_[_0x76b8('0x32')](_0x4ac7f6[_0x76b8('0x33')]);_0x4593c0['filters']=_[_0x76b8('0x35')](_0x4593c0[_0x76b8('0x31')],_0x4593c0['query']);_0xc8e21[_0x76b8('0x36')]=_['intersection'](_0x4593c0[_0x76b8('0x31')],qs[_0x76b8('0x37')](_0x4ac7f6[_0x76b8('0x33')]['fields']));_0xc8e21['attributes']=_0xc8e21[_0x76b8('0x36')]['length']?_0xc8e21[_0x76b8('0x36')]:_0x4593c0[_0x76b8('0x31')];_0xc8e21[_0x76b8('0x3a')]=qs[_0x76b8('0x4c')](_0x4ac7f6['query'][_0x76b8('0x4c')]);_0xc8e21[_0x76b8('0x3c')]=qs[_0x76b8('0x34')](_[_0x76b8('0x4d')](_0x4ac7f6[_0x76b8('0x33')],_0x4593c0[_0x76b8('0x34')]));if(_0x4ac7f6[_0x76b8('0x33')][_0x76b8('0x3b')]){_0xc8e21[_0x76b8('0x3c')]=_['merge'](_0xc8e21['where'],{'$or':_[_0x76b8('0x2b')](_0xc8e21[_0x76b8('0x36')],function(_0x17f973){var _0x2c5c1c={};_0x2c5c1c[_0x17f973]={'$like':'%'+_0x4ac7f6[_0x76b8('0x33')][_0x76b8('0x3b')]+'%'};return _0x2c5c1c;})});}_0xc8e21=_[_0x76b8('0x3d')]({},_0xc8e21,_0x4ac7f6[_0x76b8('0x3e')]);return _0x40f804[_0x76b8('0x49')](_0xc8e21);}})[_0x76b8('0x25')](function(_0x2055b9){if(_0x2055b9){_0x22a535=_0x2055b9['length'];if(!_0x4ac7f6[_0x76b8('0x33')][_0x76b8('0x38')](_0x76b8('0x39'))){_0xc8e21['limit']=qs[_0x76b8('0x1f')](_0x4ac7f6[_0x76b8('0x33')][_0x76b8('0x1f')]);_0xc8e21[_0x76b8('0x1c')]=qs[_0x76b8('0x1c')](_0x4ac7f6[_0x76b8('0x33')][_0x76b8('0x1c')]);}return _0x40f804['getConfigurations'](_0xc8e21);}})[_0x76b8('0x25')](function(_0x47a621){if(_0x47a621){return _0x47a621?{'count':_0x22a535,'rows':_0x47a621}:null;}})[_0x76b8('0x25')](respondWithResult(_0x213761,null))[_0x76b8('0x42')](handleError(_0x213761,null));};exports[_0x76b8('0x4e')]=function(_0x29b50c,_0xa68e9e,_0x2c4025){if(_0x29b50c['body']['id']){delete _0x29b50c[_0x76b8('0x48')]['id'];}return db[_0x76b8('0x2c')][_0x76b8('0x4a')]({'where':{'id':_0x29b50c[_0x76b8('0x44')]['id']}})['then'](handleEntityNotFound(_0xa68e9e,null))[_0x76b8('0x25')](function(_0x7a0ad3){if(_0x7a0ad3){_0x29b50c[_0x76b8('0x48')][_0x76b8('0x4f')]=_0x7a0ad3['id'];_0x29b50c[_0x76b8('0x48')][_0x76b8('0x50')]=integrations[_0x76b8('0x51')](_0x29b50c[_0x76b8('0x48')]['channel'],_0x29b50c['body'][_0x76b8('0x2f')]);_0x29b50c[_0x76b8('0x48')][_0x76b8('0x52')]=integrations[_0x76b8('0x53')](_0x29b50c[_0x76b8('0x48')][_0x76b8('0x54')],_0x29b50c[_0x76b8('0x48')]['type']);return db[_0x76b8('0x4b')][_0x76b8('0x47')](_0x29b50c[_0x76b8('0x48')],{'include':[{'model':db[_0x76b8('0x55')],'as':'Subjects'},{'model':db[_0x76b8('0x55')],'as':_0x76b8('0x52')}]});}return null;})['then'](respondWithResult(_0xa68e9e,null))['catch'](handleError(_0xa68e9e,null));};exports['getFields']=function(_0x519db8,_0x2996a9,_0x55c507){var _0x4cb2be=[_0x76b8('0x56'),'hold_reason','knowledge',_0x76b8('0x57'),_0x76b8('0x58'),'notify',_0x76b8('0x59'),_0x76b8('0x5a'),'category'];var _0x337b5d=[_0x76b8('0x5b'),_0x76b8('0x56'),'caused_by','watch_list','upon_reject','sys_updated_on',_0x76b8('0x5c'),_0x76b8('0x5d'),'approval_history',_0x76b8('0x5e'),_0x76b8('0x5f'),_0x76b8('0x60'),_0x76b8('0x61'),_0x76b8('0x62'),_0x76b8('0x63'),_0x76b8('0x64'),'state',_0x76b8('0x65'),'knowledge','order','calendar_stc','closed_at',_0x76b8('0x66'),'delivery_plan',_0x76b8('0x67'),'active',_0x76b8('0x68'),_0x76b8('0x69'),'priority',_0x76b8('0x6a'),_0x76b8('0x6b'),_0x76b8('0x6c'),_0x76b8('0x6d'),_0x76b8('0x6e'),_0x76b8('0x6f'),_0x76b8('0x70'),'work_end',_0x76b8('0x71'),_0x76b8('0x72'),_0x76b8('0x73'),'approval_set',_0x76b8('0x57'),'work_notes',_0x76b8('0x74'),_0x76b8('0x58'),_0x76b8('0x75'),'delivery_task',_0x76b8('0x76'),_0x76b8('0x77'),_0x76b8('0x78'),_0x76b8('0x79'),_0x76b8('0x7a'),'calendar_duration','notify','sys_class_name',_0x76b8('0x7b'),'closed_by',_0x76b8('0x7c'),'parent_incident','sys_id',_0x76b8('0x7d'),'reopened_by',_0x76b8('0x59'),'urgency',_0x76b8('0x7e'),_0x76b8('0x7f'),'reassignment_count','activity_due',_0x76b8('0x80'),_0x76b8('0x5a'),_0x76b8('0x81'),_0x76b8('0x82'),_0x76b8('0x83'),'comments_and_work_notes',_0x76b8('0x84'),_0x76b8('0x85'),_0x76b8('0x86'),_0x76b8('0x87'),_0x76b8('0x88'),_0x76b8('0x89'),_0x76b8('0x8a'),_0x76b8('0x8b'),_0x76b8('0x8c')];var _0x444e93='';var _0x5a3005='';var _0x1c5d8c=[];var _0x45537c='';var _0x134235='';var _0x2a0aa6=[];var _0xc0bb3e='';var _0x36ebe6='';var _0x1757eb={};var _0x49f125='';return db['ServicenowAccount'][_0x76b8('0x4a')]({'where':{'id':_0x519db8[_0x76b8('0x44')]['id']},'attributes':['id',_0x76b8('0x8d'),_0x76b8('0x8e'),_0x76b8('0x8f'),'remoteUri',_0x76b8('0x90')]})[_0x76b8('0x25')](handleEntityNotFound(_0x2996a9,null))[_0x76b8('0x25')](function(_0x212b82){if(_0x212b82){_0x49f125=_0x212b82[_0x76b8('0x91')];var _0x3cfe74=_0x49f125[_0x76b8('0x92')](-0x1);if(_0x3cfe74==='/'){_0x49f125=_0x49f125['substring'](0x0,_0x49f125[_0x76b8('0x93')](_0x3cfe74));}_0x36ebe6=util[_0x76b8('0x94')](_0x76b8('0x95'),_0x49f125);_0xc0bb3e=util[_0x76b8('0x94')]('%s/api/now/table/',_0x49f125);_0x1757eb={'user':_0x212b82[_0x76b8('0x8d')],'pass':_0x212b82[_0x76b8('0x8e')]};var _0x189af6={'method':_0x76b8('0x96'),'uri':_0x36ebe6+_0x76b8('0x97'),'auth':_0x1757eb,'json':!![]};return rp(_0x189af6);}})['then'](function(_0x3e8c84){if(_0x3e8c84[_0x76b8('0x98')][_0x76b8('0x45')]>0x0){_0x444e93=_0x3e8c84[_0x76b8('0x98')];}console['log'](_0x76b8('0x99'),_0x444e93);_0x2a0aa6=[];_0x5a3005=Object['assign']([],_0x444e93);_['remove'](_0x5a3005,function(_0x2156aa){return!_0x4cb2be[_0x76b8('0x9a')](_0x2156aa[_0x76b8('0x29')]);});_0x5a3005[_0x76b8('0x9b')](function(_0x5f1cf1){var _0x3c3ab5=createFieldObject(_0xc0bb3e,_0x1757eb,_0x5f1cf1[_0x76b8('0x9c')],_0x5f1cf1[_0x76b8('0x29')],_0x5f1cf1[_0x76b8('0x9d')],![]);_0x2a0aa6[_0x76b8('0x9e')](_0x3c3ab5);});return Promise[_0x76b8('0x9f')](_0x2a0aa6);})[_0x76b8('0x25')](function(_0x331fb7){_0x1c5d8c=_0x331fb7;_0x45537c=Object[_0x76b8('0xa0')]([],_0x444e93);console[_0x76b8('0xa1')](_0x76b8('0xa2'),_0x444e93);_[_0x76b8('0xa3')](_0x45537c,function(_0x5cbbf6){return _0x337b5d[_0x76b8('0x9a')](_0x5cbbf6[_0x76b8('0x29')]);});console[_0x76b8('0xa1')](_0x76b8('0xa4'),_0x45537c);_0x2a0aa6=[];_0x45537c[_0x76b8('0x9b')](function(_0x385799){var _0x5adb7b=createFieldObject(_0xc0bb3e,_0x1757eb,_0x385799[_0x76b8('0x9c')],_0x385799[_0x76b8('0x29')],_0x385799[_0x76b8('0x9d')],!![]);_0x2a0aa6['push'](_0x5adb7b);});return Promise[_0x76b8('0x9f')](_0x2a0aa6);})[_0x76b8('0x25')](function(_0x255ee3){_0x134235=_0x255ee3;var _0x276740=_0x1c5d8c['concat'](_0x134235);return{'count':_0x276740[_0x76b8('0x45')],'rows':_0x276740};})[_0x76b8('0x25')](respondWithResult(_0x2996a9,null))[_0x76b8('0x42')](function(_0x224781){console[_0x76b8('0xa1')](_0x76b8('0xa5')+_0x224781);var _0x1de414=_0x519db8['query'][_0x76b8('0xa6')]?0x1f4:_0x224781[_0x76b8('0xa7')]||0x1f4;logger['error'](_0x224781[_0x76b8('0x28')]);delete _0x224781[_0x76b8('0x29')];if(_0x1de414===0x191){_0x1de414=0x190;}_0x2996a9[_0x76b8('0x19')](_0x1de414)['send'](_0x519db8['query'][_0x76b8('0xa6')]?{'message':_0x76b8('0xa8'),'statusCode':_0x224781[_0x76b8('0xa7')]}:_0x224781);});};function createFieldObject(_0x586aac,_0xfe3d99,_0x395fcb,_0x233fe9,_0x2b9e43,_0x428ddd){return new Promise(function(_0x130ae7,_0xbbea24){var _0x265104={'id':_0x233fe9,'name':_0x2b9e43,'custom':_0x428ddd};if(_0x395fcb==='boolean'){_0x265104[_0x76b8('0x3e')]=[{'name':_0x76b8('0xa9'),'value':'true'},{'name':'False','value':_0x76b8('0xaa')}];_0x130ae7(_0x265104);}else{var _0x4898e1={'method':_0x76b8('0x96'),'uri':_0x586aac+'sys_choice?sysparm_query=name=incident^element='+_0x233fe9,'auth':_0xfe3d99,'json':!![]};return rp(_0x4898e1)[_0x76b8('0x25')](function(_0x35a3b2){var _0x51e5ae=[];if(_0x35a3b2[_0x76b8('0x98')][_0x76b8('0x45')]>0x0){_0x35a3b2[_0x76b8('0x98')][_0x76b8('0x9b')](function(_0x4c91b2){if(_0x4c91b2[_0x76b8('0xab')]==='false'){var _0x504fe1={'name':_0x4c91b2[_0x76b8('0x9d')],'value':_0x4c91b2[_0x76b8('0xac')]};_0x51e5ae[_0x76b8('0x9e')](_0x504fe1);}});}_0x265104[_0x76b8('0x3e')]=_0x51e5ae;if(_0x265104[_0x76b8('0x3e')]['length']>0x0){_0x130ae7(_0x265104);}else{if(_0x428ddd==![]){_0x130ae7();}else{_0x130ae7(_0x265104);}}});}});} \ No newline at end of file +var _0x5a3f=['filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','findOne','ServicenowConfiguration','getConfigurations','AccountId','getDescriptions','channel','Subjects','ServicenowField','Descriptions','made_sla','hold_reason','knowledge','subcategory','close_code','caused_by','upon_reject','child_incidents','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','time_worked','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','notify','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','sla_due','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','category','username','password','email','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','Wrong\x20credentials','statusCode','True','true','false','label','value','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4acf22,_0x37d479){var _0x594cdf=function(_0x5b54fc){while(--_0x5b54fc){_0x4acf22['push'](_0x4acf22['shift']());}};_0x594cdf(++_0x37d479);}(_0x5a3f,0x76));var _0xf5a3=function(_0x41fbc6,_0x1436b9){_0x41fbc6=_0x41fbc6-0x0;var _0x3399ff=_0x5a3f[_0x41fbc6];return _0x3399ff;};'use strict';var emlformat=require(_0xf5a3('0x0'));var rimraf=require(_0xf5a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf5a3('0x2'));var rp=require('request-promise');var moment=require(_0xf5a3('0x3'));var BPromise=require(_0xf5a3('0x4'));var Mustache=require(_0xf5a3('0x5'));var util=require('util');var path=require(_0xf5a3('0x6'));var sox=require(_0xf5a3('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf5a3('0x8'));var _=require(_0xf5a3('0x9'));var squel=require(_0xf5a3('0xa'));var crypto=require(_0xf5a3('0xb'));var jsforce=require(_0xf5a3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf5a3('0xd'));var querystring=require(_0xf5a3('0xe'));var Papa=require(_0xf5a3('0xf'));var Redis=require(_0xf5a3('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf5a3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5a3('0x12'))('api');var utils=require(_0xf5a3('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf5a3('0x14'))['db'];var integrations=require(_0xf5a3('0x15'));function respondWithStatusCode(_0x2adb6a,_0x30a7e7){_0x30a7e7=_0x30a7e7||0xcc;return function(_0x9cfa35){if(_0x9cfa35){return _0x2adb6a[_0xf5a3('0x16')](_0x30a7e7);}return _0x2adb6a[_0xf5a3('0x17')](_0x30a7e7)[_0xf5a3('0x18')]();};}function respondWithResult(_0x12bb7e,_0xc9a654){_0xc9a654=_0xc9a654||0xc8;return function(_0x2fa4c3){if(_0x2fa4c3){return _0x12bb7e['status'](_0xc9a654)[_0xf5a3('0x19')](_0x2fa4c3);}};}function respondWithFilteredResult(_0x5c972b,_0x36bddf){return function(_0x263e85){if(_0x263e85){var _0x5a0e2c=typeof _0x36bddf[_0xf5a3('0x1a')]===_0xf5a3('0x1b')&&typeof _0x36bddf[_0xf5a3('0x1c')]==='undefined';var _0x38dab0=_0x263e85['count'];var _0x263ff4=_0x5a0e2c?0x0:_0x36bddf['offset'];var _0x515951=_0x5a0e2c?_0x263e85[_0xf5a3('0x1d')]:_0x36bddf[_0xf5a3('0x1a')]+_0x36bddf['limit'];var _0x4ffcbb;if(_0x515951>=_0x38dab0){_0x515951=_0x38dab0;_0x4ffcbb=0xc8;}else{_0x4ffcbb=0xce;}_0x5c972b['status'](_0x4ffcbb);return _0x5c972b[_0xf5a3('0x1e')](_0xf5a3('0x1f'),_0x263ff4+'-'+_0x515951+'/'+_0x38dab0)[_0xf5a3('0x19')](_0x263e85);}return null;};}function patchUpdates(_0x2a560d){return function(_0x449d93){try{jsonpatch['apply'](_0x449d93,_0x2a560d,!![]);}catch(_0x3da71){return BPromise[_0xf5a3('0x20')](_0x3da71);}return _0x449d93['save']();};}function saveUpdates(_0x2bfb75,_0x4dca13){return function(_0x29f637){if(_0x29f637){return _0x29f637[_0xf5a3('0x21')](_0x2bfb75)[_0xf5a3('0x22')](function(_0x22a609){return _0x22a609;});}return null;};}function removeEntity(_0x4c1ab0,_0x3df06b){return function(_0x558d5a){if(_0x558d5a){return _0x558d5a['destroy']()[_0xf5a3('0x22')](function(){_0x4c1ab0[_0xf5a3('0x17')](0xcc)[_0xf5a3('0x18')]();});}};}function handleEntityNotFound(_0x5a4916,_0x3f2151){return function(_0x188cdb){if(!_0x188cdb){_0x5a4916[_0xf5a3('0x16')](0x194);}return _0x188cdb;};}function handleError(_0x4840b3,_0x56e3bb){_0x56e3bb=_0x56e3bb||0x1f4;return function(_0x39fecc){logger[_0xf5a3('0x23')](_0x39fecc[_0xf5a3('0x24')]);if(_0x39fecc[_0xf5a3('0x25')]){delete _0x39fecc[_0xf5a3('0x25')];}_0x4840b3[_0xf5a3('0x17')](_0x56e3bb)[_0xf5a3('0x26')](_0x39fecc);};}exports['index']=function(_0x2a1c76,_0x40dfbf){var _0x34546e={},_0x54d4f6={},_0x33dd3e={'count':0x0,'rows':[]};var _0x1ba3d1=_[_0xf5a3('0x27')](db[_0xf5a3('0x28')][_0xf5a3('0x29')],function(_0x688edb){return{'name':_0x688edb[_0xf5a3('0x2a')],'type':_0x688edb[_0xf5a3('0x2b')][_0xf5a3('0x2c')]};});_0x54d4f6[_0xf5a3('0x2d')]=_['map'](_0x1ba3d1,_0xf5a3('0x25'));_0x54d4f6['query']=_[_0xf5a3('0x2e')](_0x2a1c76[_0xf5a3('0x2f')]);_0x54d4f6[_0xf5a3('0x30')]=_[_0xf5a3('0x31')](_0x54d4f6[_0xf5a3('0x2d')],_0x54d4f6[_0xf5a3('0x2f')]);_0x34546e[_0xf5a3('0x32')]=_['intersection'](_0x54d4f6['model'],qs[_0xf5a3('0x33')](_0x2a1c76[_0xf5a3('0x2f')]['fields']));_0x34546e[_0xf5a3('0x32')]=_0x34546e[_0xf5a3('0x32')][_0xf5a3('0x34')]?_0x34546e[_0xf5a3('0x32')]:_0x54d4f6[_0xf5a3('0x2d')];if(!_0x2a1c76[_0xf5a3('0x2f')][_0xf5a3('0x35')](_0xf5a3('0x36'))){_0x34546e[_0xf5a3('0x1c')]=qs[_0xf5a3('0x1c')](_0x2a1c76['query'][_0xf5a3('0x1c')]);_0x34546e[_0xf5a3('0x1a')]=qs[_0xf5a3('0x1a')](_0x2a1c76[_0xf5a3('0x2f')][_0xf5a3('0x1a')]);}_0x34546e[_0xf5a3('0x37')]=qs[_0xf5a3('0x38')](_0x2a1c76['query'][_0xf5a3('0x38')]);_0x34546e[_0xf5a3('0x39')]=qs[_0xf5a3('0x30')](_[_0xf5a3('0x3a')](_0x2a1c76['query'],_0x54d4f6[_0xf5a3('0x30')]),_0x1ba3d1);if(_0x2a1c76['query'][_0xf5a3('0x3b')]){_0x34546e[_0xf5a3('0x39')]=_[_0xf5a3('0x3c')](_0x34546e[_0xf5a3('0x39')],{'$or':_[_0xf5a3('0x27')](_0x1ba3d1,function(_0x889806){if(_0x889806[_0xf5a3('0x2b')]!==_0xf5a3('0x3d')){var _0x5b45e2={};_0x5b45e2[_0x889806[_0xf5a3('0x25')]]={'$like':'%'+_0x2a1c76[_0xf5a3('0x2f')][_0xf5a3('0x3b')]+'%'};return _0x5b45e2;}})});}_0x34546e=_[_0xf5a3('0x3c')]({},_0x34546e,_0x2a1c76[_0xf5a3('0x3e')]);var _0x1275bd={'where':_0x34546e['where']};return db[_0xf5a3('0x28')][_0xf5a3('0x1d')](_0x1275bd)[_0xf5a3('0x22')](function(_0x4f58d0){_0x33dd3e[_0xf5a3('0x1d')]=_0x4f58d0;if(_0x2a1c76[_0xf5a3('0x2f')][_0xf5a3('0x3f')]){_0x34546e['include']=[{'all':!![]}];}return db['ServicenowAccount'][_0xf5a3('0x40')](_0x34546e);})[_0xf5a3('0x22')](function(_0xe4bc74){_0x33dd3e[_0xf5a3('0x41')]=_0xe4bc74;return _0x33dd3e;})['then'](respondWithFilteredResult(_0x40dfbf,_0x34546e))[_0xf5a3('0x42')](handleError(_0x40dfbf,null));};exports[_0xf5a3('0x43')]=function(_0x5dec2e,_0x2d5fc0){var _0x47c9eb={'raw':![],'where':{'id':_0x5dec2e[_0xf5a3('0x44')]['id']}},_0x321455={};_0x321455['model']=_[_0xf5a3('0x2e')](db[_0xf5a3('0x28')]['rawAttributes']);_0x321455[_0xf5a3('0x2f')]=_[_0xf5a3('0x2e')](_0x5dec2e[_0xf5a3('0x2f')]);_0x321455[_0xf5a3('0x30')]=_['intersection'](_0x321455[_0xf5a3('0x2d')],_0x321455['query']);_0x47c9eb[_0xf5a3('0x32')]=_['intersection'](_0x321455[_0xf5a3('0x2d')],qs[_0xf5a3('0x33')](_0x5dec2e[_0xf5a3('0x2f')][_0xf5a3('0x33')]));_0x47c9eb[_0xf5a3('0x32')]=_0x47c9eb[_0xf5a3('0x32')][_0xf5a3('0x34')]?_0x47c9eb[_0xf5a3('0x32')]:_0x321455[_0xf5a3('0x2d')];if(_0x5dec2e[_0xf5a3('0x2f')]['includeAll']){_0x47c9eb[_0xf5a3('0x45')]=[{'all':!![]}];}_0x47c9eb=_[_0xf5a3('0x3c')]({},_0x47c9eb,_0x5dec2e[_0xf5a3('0x3e')]);return db[_0xf5a3('0x28')][_0xf5a3('0x46')](_0x47c9eb)[_0xf5a3('0x22')](handleEntityNotFound(_0x2d5fc0,null))['then'](respondWithResult(_0x2d5fc0,null))[_0xf5a3('0x42')](handleError(_0x2d5fc0,null));};exports[_0xf5a3('0x47')]=function(_0x4a3353,_0x109120){return db[_0xf5a3('0x28')]['create'](_0x4a3353[_0xf5a3('0x48')],{})[_0xf5a3('0x22')](respondWithResult(_0x109120,0xc9))[_0xf5a3('0x42')](handleError(_0x109120,null));};exports[_0xf5a3('0x21')]=function(_0x524c0e,_0x4d138b){if(_0x524c0e[_0xf5a3('0x48')]['id']){delete _0x524c0e[_0xf5a3('0x48')]['id'];}return db[_0xf5a3('0x28')][_0xf5a3('0x46')]({'where':{'id':_0x524c0e[_0xf5a3('0x44')]['id']}})[_0xf5a3('0x22')](handleEntityNotFound(_0x4d138b,null))[_0xf5a3('0x22')](saveUpdates(_0x524c0e['body'],null))[_0xf5a3('0x22')](respondWithResult(_0x4d138b,null))[_0xf5a3('0x42')](handleError(_0x4d138b,null));};exports[_0xf5a3('0x49')]=function(_0x119392,_0x182376){return db[_0xf5a3('0x28')][_0xf5a3('0x46')]({'where':{'id':_0x119392['params']['id']}})[_0xf5a3('0x22')](handleEntityNotFound(_0x182376,null))['then'](removeEntity(_0x182376,null))[_0xf5a3('0x42')](handleError(_0x182376,null));};exports['getConfigurations']=function(_0x52f042,_0x2b0730,_0x5f39e9){var _0x4f60bb={};var _0x6f1f8={};var _0x4582ee;var _0x1b8bfa;return db['ServicenowAccount'][_0xf5a3('0x4a')]({'where':{'id':_0x52f042[_0xf5a3('0x44')]['id']}})[_0xf5a3('0x22')](handleEntityNotFound(_0x2b0730,null))[_0xf5a3('0x22')](function(_0x3b37bb){if(_0x3b37bb){_0x4582ee=_0x3b37bb;_0x6f1f8[_0xf5a3('0x2d')]=_['keys'](db[_0xf5a3('0x4b')][_0xf5a3('0x29')]);_0x6f1f8[_0xf5a3('0x2f')]=_[_0xf5a3('0x2e')](_0x52f042['query']);_0x6f1f8[_0xf5a3('0x30')]=_[_0xf5a3('0x31')](_0x6f1f8[_0xf5a3('0x2d')],_0x6f1f8[_0xf5a3('0x2f')]);_0x4f60bb[_0xf5a3('0x32')]=_['intersection'](_0x6f1f8[_0xf5a3('0x2d')],qs[_0xf5a3('0x33')](_0x52f042[_0xf5a3('0x2f')][_0xf5a3('0x33')]));_0x4f60bb[_0xf5a3('0x32')]=_0x4f60bb[_0xf5a3('0x32')][_0xf5a3('0x34')]?_0x4f60bb[_0xf5a3('0x32')]:_0x6f1f8[_0xf5a3('0x2d')];_0x4f60bb[_0xf5a3('0x37')]=qs[_0xf5a3('0x38')](_0x52f042[_0xf5a3('0x2f')][_0xf5a3('0x38')]);_0x4f60bb[_0xf5a3('0x39')]=qs[_0xf5a3('0x30')](_['pick'](_0x52f042['query'],_0x6f1f8[_0xf5a3('0x30')]));if(_0x52f042['query'][_0xf5a3('0x3b')]){_0x4f60bb[_0xf5a3('0x39')]=_['merge'](_0x4f60bb[_0xf5a3('0x39')],{'$or':_[_0xf5a3('0x27')](_0x4f60bb['attributes'],function(_0x354983){var _0x35421c={};_0x35421c[_0x354983]={'$like':'%'+_0x52f042[_0xf5a3('0x2f')][_0xf5a3('0x3b')]+'%'};return _0x35421c;})});}_0x4f60bb=_[_0xf5a3('0x3c')]({},_0x4f60bb,_0x52f042['options']);return _0x4582ee[_0xf5a3('0x4c')](_0x4f60bb);}})[_0xf5a3('0x22')](function(_0x3365b7){if(_0x3365b7){_0x1b8bfa=_0x3365b7['length'];if(!_0x52f042['query'][_0xf5a3('0x35')](_0xf5a3('0x36'))){_0x4f60bb[_0xf5a3('0x1c')]=qs[_0xf5a3('0x1c')](_0x52f042[_0xf5a3('0x2f')][_0xf5a3('0x1c')]);_0x4f60bb[_0xf5a3('0x1a')]=qs['offset'](_0x52f042['query']['offset']);}return _0x4582ee[_0xf5a3('0x4c')](_0x4f60bb);}})[_0xf5a3('0x22')](function(_0x559dde){if(_0x559dde){return _0x559dde?{'count':_0x1b8bfa,'rows':_0x559dde}:null;}})[_0xf5a3('0x22')](respondWithResult(_0x2b0730,null))['catch'](handleError(_0x2b0730,null));};exports['addConfiguration']=function(_0x2eb3e9,_0x491b3d,_0x3e1606){if(_0x2eb3e9['body']['id']){delete _0x2eb3e9[_0xf5a3('0x48')]['id'];}return db[_0xf5a3('0x28')][_0xf5a3('0x4a')]({'where':{'id':_0x2eb3e9[_0xf5a3('0x44')]['id']}})[_0xf5a3('0x22')](handleEntityNotFound(_0x491b3d,null))[_0xf5a3('0x22')](function(_0x1ecc82){if(_0x1ecc82){_0x2eb3e9['body'][_0xf5a3('0x4d')]=_0x1ecc82['id'];_0x2eb3e9[_0xf5a3('0x48')]['Subjects']=integrations['getSubjects'](_0x2eb3e9[_0xf5a3('0x48')]['channel'],_0x2eb3e9[_0xf5a3('0x48')][_0xf5a3('0x2b')]);_0x2eb3e9[_0xf5a3('0x48')]['Descriptions']=integrations[_0xf5a3('0x4e')](_0x2eb3e9[_0xf5a3('0x48')][_0xf5a3('0x4f')],_0x2eb3e9[_0xf5a3('0x48')][_0xf5a3('0x2b')]);return db[_0xf5a3('0x4b')][_0xf5a3('0x47')](_0x2eb3e9[_0xf5a3('0x48')],{'include':[{'model':db['ServicenowField'],'as':_0xf5a3('0x50')},{'model':db[_0xf5a3('0x51')],'as':_0xf5a3('0x52')}]});}return null;})[_0xf5a3('0x22')](respondWithResult(_0x491b3d,null))['catch'](handleError(_0x491b3d,null));};exports['getFields']=function(_0x3eebae,_0x4d503f,_0x49b0be){var _0x4eac4e=[_0xf5a3('0x53'),_0xf5a3('0x54'),_0xf5a3('0x55'),_0xf5a3('0x56'),_0xf5a3('0x57'),'notify','incident_state','severity','category'];var _0x1afb91=['parent',_0xf5a3('0x53'),_0xf5a3('0x58'),'watch_list',_0xf5a3('0x59'),'sys_updated_on',_0xf5a3('0x5a'),_0xf5a3('0x54'),'approval_history','number','resolved_by','sys_updated_by',_0xf5a3('0x5b'),_0xf5a3('0x5c'),_0xf5a3('0x5d'),'sys_domain',_0xf5a3('0x5e'),_0xf5a3('0x5f'),'knowledge',_0xf5a3('0x37'),_0xf5a3('0x60'),_0xf5a3('0x61'),'cmdb_ci',_0xf5a3('0x62'),_0xf5a3('0x63'),_0xf5a3('0x64'),_0xf5a3('0x65'),_0xf5a3('0x66'),'priority',_0xf5a3('0x67'),_0xf5a3('0x68'),_0xf5a3('0x69'),'expected_start','opened_at',_0xf5a3('0x6a'),_0xf5a3('0x6b'),_0xf5a3('0x6c'),_0xf5a3('0x6d'),_0xf5a3('0x6e'),_0xf5a3('0x6f'),_0xf5a3('0x70'),_0xf5a3('0x56'),_0xf5a3('0x71'),_0xf5a3('0x72'),_0xf5a3('0x57'),'correlation_display',_0xf5a3('0x73'),_0xf5a3('0x74'),_0xf5a3('0x75'),_0xf5a3('0x76'),_0xf5a3('0x77'),'description','calendar_duration',_0xf5a3('0x78'),'sys_class_name',_0xf5a3('0x79'),_0xf5a3('0x7a'),_0xf5a3('0x7b'),_0xf5a3('0x7c'),_0xf5a3('0x7d'),_0xf5a3('0x7e'),_0xf5a3('0x7f'),'incident_state',_0xf5a3('0x80'),_0xf5a3('0x81'),_0xf5a3('0x82'),_0xf5a3('0x83'),_0xf5a3('0x84'),_0xf5a3('0x85'),_0xf5a3('0x86'),'comments',_0xf5a3('0x87'),'approval','comments_and_work_notes',_0xf5a3('0x88'),_0xf5a3('0x89'),_0xf5a3('0x8a'),_0xf5a3('0x8b'),_0xf5a3('0x8c'),_0xf5a3('0x8d'),_0xf5a3('0x8e'),_0xf5a3('0x8f'),_0xf5a3('0x90')];var _0x3aaefe='';var _0x1cdfe1='';var _0x5d27f4=[];var _0x46cbf4='';var _0x48ed50='';var _0x24bfcc=[];var _0x1fb357='';var _0x3f0c71='';var _0x1e1c4b={};var _0x4ad6ea='';return db[_0xf5a3('0x28')]['findOne']({'where':{'id':_0x3eebae['params']['id']},'attributes':['id',_0xf5a3('0x91'),_0xf5a3('0x92'),_0xf5a3('0x93'),_0xf5a3('0x94'),_0xf5a3('0x95')]})[_0xf5a3('0x22')](handleEntityNotFound(_0x4d503f,null))['then'](function(_0x59a411){if(_0x59a411){_0x4ad6ea=_0x59a411[_0xf5a3('0x94')];var _0x3bd0e5=_0x4ad6ea[_0xf5a3('0x96')](-0x1);if(_0x3bd0e5==='/'){_0x4ad6ea=_0x4ad6ea[_0xf5a3('0x97')](0x0,_0x4ad6ea['lastIndexOf'](_0x3bd0e5));}_0x3f0c71=util[_0xf5a3('0x98')](_0xf5a3('0x99'),_0x4ad6ea);_0x1fb357=util[_0xf5a3('0x98')](_0xf5a3('0x9a'),_0x4ad6ea);_0x1e1c4b={'user':_0x59a411[_0xf5a3('0x91')],'pass':_0x59a411[_0xf5a3('0x92')]};var _0x5545ea={'method':_0xf5a3('0x9b'),'uri':_0x3f0c71+_0xf5a3('0x9c'),'auth':_0x1e1c4b,'json':!![]};return rp(_0x5545ea);}})[_0xf5a3('0x22')](function(_0x1b1d0e){if(_0x1b1d0e[_0xf5a3('0x9d')][_0xf5a3('0x34')]>0x0){_0x3aaefe=_0x1b1d0e[_0xf5a3('0x9d')];}console[_0xf5a3('0x9e')](_0xf5a3('0x9f'),_0x3aaefe);_0x24bfcc=[];_0x1cdfe1=Object[_0xf5a3('0xa0')]([],_0x3aaefe);_[_0xf5a3('0xa1')](_0x1cdfe1,function(_0x10403d){return!_0x4eac4e[_0xf5a3('0xa2')](_0x10403d[_0xf5a3('0x25')]);});_0x1cdfe1[_0xf5a3('0xa3')](function(_0x10b023){var _0x58f519=createFieldObject(_0x1fb357,_0x1e1c4b,_0x10b023[_0xf5a3('0xa4')],_0x10b023[_0xf5a3('0x25')],_0x10b023['label'],![]);_0x24bfcc[_0xf5a3('0xa5')](_0x58f519);});return Promise[_0xf5a3('0xa6')](_0x24bfcc);})[_0xf5a3('0x22')](function(_0x4f5041){_0x5d27f4=_0x4f5041;_0x46cbf4=Object[_0xf5a3('0xa0')]([],_0x3aaefe);console[_0xf5a3('0x9e')](_0xf5a3('0xa7'),_0x3aaefe);_['remove'](_0x46cbf4,function(_0x1fbef6){return _0x1afb91[_0xf5a3('0xa2')](_0x1fbef6[_0xf5a3('0x25')]);});console[_0xf5a3('0x9e')](_0xf5a3('0xa8'),_0x46cbf4);_0x24bfcc=[];_0x46cbf4[_0xf5a3('0xa3')](function(_0x432952){var _0x23dfe6=createFieldObject(_0x1fb357,_0x1e1c4b,_0x432952[_0xf5a3('0xa4')],_0x432952[_0xf5a3('0x25')],_0x432952['label'],!![]);_0x24bfcc[_0xf5a3('0xa5')](_0x23dfe6);});return Promise[_0xf5a3('0xa6')](_0x24bfcc);})['then'](function(_0x15cf78){_0x48ed50=_0x15cf78;var _0x12d2cd=_0x5d27f4['concat'](_0x48ed50);return{'count':_0x12d2cd[_0xf5a3('0x34')],'rows':_0x12d2cd};})[_0xf5a3('0x22')](respondWithResult(_0x4d503f,null))[_0xf5a3('0x42')](function(_0x4a06ae){console['log'](_0xf5a3('0xa9')+_0x4a06ae);var _0x538d66=_0x3eebae[_0xf5a3('0x2f')]['test']?0x1f4:_0x4a06ae['statusCode']||0x1f4;logger[_0xf5a3('0x23')](_0x4a06ae[_0xf5a3('0x24')]);delete _0x4a06ae['name'];if(_0x538d66===0x191){_0x538d66=0x190;}_0x4d503f[_0xf5a3('0x17')](_0x538d66)[_0xf5a3('0x26')](_0x3eebae[_0xf5a3('0x2f')]['test']?{'message':_0xf5a3('0xaa'),'statusCode':_0x4a06ae[_0xf5a3('0xab')]}:_0x4a06ae);});};function createFieldObject(_0x47d535,_0x23711a,_0x563d71,_0x4bae23,_0x4addb8,_0x3e212d){return new Promise(function(_0x4b7332,_0x572bd4){var _0x26070a={'id':_0x4bae23,'name':_0x4addb8,'custom':_0x3e212d};if(_0x563d71==='boolean'){_0x26070a[_0xf5a3('0x3e')]=[{'name':_0xf5a3('0xac'),'value':_0xf5a3('0xad')},{'name':'False','value':_0xf5a3('0xae')}];_0x4b7332(_0x26070a);}else{var _0x11c857={'method':_0xf5a3('0x9b'),'uri':_0x47d535+'sys_choice?sysparm_query=name=incident^element='+_0x4bae23,'auth':_0x23711a,'json':!![]};return rp(_0x11c857)[_0xf5a3('0x22')](function(_0x3d3d9e){var _0x4d50c1=[];if(_0x3d3d9e[_0xf5a3('0x9d')][_0xf5a3('0x34')]>0x0){_0x3d3d9e['result']['forEach'](function(_0x53169f){if(_0x53169f['inactive']===_0xf5a3('0xae')){var _0x5b3d0e={'name':_0x53169f[_0xf5a3('0xaf')],'value':_0x53169f[_0xf5a3('0xb0')]};_0x4d50c1['push'](_0x5b3d0e);}});}_0x26070a[_0xf5a3('0x3e')]=_0x4d50c1;if(_0x26070a[_0xf5a3('0x3e')][_0xf5a3('0x34')]>0x0){_0x4b7332(_0x26070a);}else{if(_0x3e212d==![]){_0x4b7332();}else{_0x4b7332(_0x26070a);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 9e319fe..be23254 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 _0xe2fe=['define','int_servicenow_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0xcf3146,_0xacc370){var _0x560906=function(_0x3ef58c){while(--_0x3ef58c){_0xcf3146['push'](_0xcf3146['shift']());}};_0x560906(++_0xacc370);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('ServicenowAccount',attributes,{'tableName':_0xee2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dfd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x1a95c5,_0x1aa82f){var _0x2bfdb6=function(_0x475a73){while(--_0x475a73){_0x1a95c5['push'](_0x1a95c5['shift']());}};_0x2bfdb6(++_0x1aa82f);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var moment=require(_0xd7df('0x4'));var BPromise=require(_0xd7df('0x5'));var rp=require(_0xd7df('0x6'));var fs=require('fs');var path=require(_0xd7df('0x7'));var rimraf=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var attributes=require(_0xd7df('0xa'));var integrations=require(_0xd7df('0xb'));module[_0xd7df('0xc')]=function(_0x39ce98,_0x354ea7){return _0x39ce98[_0xd7df('0xd')](_0xd7df('0xe'),attributes,{'tableName':'int_servicenow_accounts','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 f9b40c7..3d167e9 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 _0x65e6=['GetServicenowAccount','options','raw','where','attributes','limit','include','map','model','stringify','ShowServicenowAccount','ServicenowAccount','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','result'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x65e6,0x12e));var _0x665e=function(_0x2fbd51,_0x37683d){_0x2fbd51=_0x2fbd51-0x0;var _0x174711=_0x65e6[_0x2fbd51];return _0x174711;};'use strict';var _=require(_0x665e('0x0'));var util=require(_0x665e('0x1'));var moment=require(_0x665e('0x2'));var BPromise=require(_0x665e('0x3'));var rs=require(_0x665e('0x4'));var fs=require('fs');var Redis=require(_0x665e('0x5'));var db=require(_0x665e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x665e('0x7'))(_0x665e('0x8'));var config=require(_0x665e('0x9'));var jayson=require(_0x665e('0xa'));var client=jayson[_0x665e('0xb')][_0x665e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cdc8f,_0x5285e7,_0x5a27a3){return new BPromise(function(_0x1939cb,_0x593420){return client[_0x665e('0xd')](_0x4cdc8f,_0x5a27a3)[_0x665e('0xe')](function(_0x1a7f50){logger['info'](_0x665e('0xf'),_0x5285e7,_0x665e('0x10'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5285e7,_0x665e('0x10'),JSON['stringify'](_0x1a7f50));if(_0x1a7f50[_0x665e('0x11')]){if(_0x1a7f50[_0x665e('0x11')][_0x665e('0x12')]===0x1f4){logger['error'](_0x665e('0xf'),_0x5285e7,_0x1a7f50[_0x665e('0x11')]['message']);return _0x593420(_0x1a7f50['error']['message']);}logger[_0x665e('0x11')](_0x665e('0xf'),_0x5285e7,_0x1a7f50[_0x665e('0x11')][_0x665e('0x13')]);return _0x1939cb(_0x1a7f50[_0x665e('0x11')][_0x665e('0x13')]);}else{logger[_0x665e('0x14')](_0x665e('0xf'),_0x5285e7,'request\x20sent');_0x1939cb(_0x1a7f50[_0x665e('0x15')][_0x665e('0x13')]);}})['catch'](function(_0x448937){logger[_0x665e('0x11')](_0x665e('0xf'),_0x5285e7,_0x448937);_0x593420(_0x448937);});});}exports[_0x665e('0x16')]=function(_0x51e9e5){var _0x20d24f=this;return new Promise(function(_0x3e75c2,_0x339205){return db['ServicenowAccount']['findAll']({'raw':_0x51e9e5[_0x665e('0x17')]?_0x51e9e5['options'][_0x665e('0x18')]===undefined?!![]:![]:!![],'where':_0x51e9e5['options']?_0x51e9e5['options'][_0x665e('0x19')]||null:null,'attributes':_0x51e9e5['options']?_0x51e9e5[_0x665e('0x17')][_0x665e('0x1a')]||null:null,'limit':_0x51e9e5[_0x665e('0x17')]?_0x51e9e5[_0x665e('0x17')][_0x665e('0x1b')]||null:null,'include':_0x51e9e5[_0x665e('0x17')]?_0x51e9e5[_0x665e('0x17')][_0x665e('0x1c')]?_[_0x665e('0x1d')](_0x51e9e5[_0x665e('0x17')][_0x665e('0x1c')],function(_0x439ab9){return{'model':db[_0x439ab9['model']],'as':_0x439ab9['as'],'attributes':_0x439ab9[_0x665e('0x1a')],'include':_0x439ab9[_0x665e('0x1c')]?_[_0x665e('0x1d')](_0x439ab9[_0x665e('0x1c')],function(_0x4f3258){return{'model':db[_0x4f3258[_0x665e('0x1e')]],'as':_0x4f3258['as'],'attributes':_0x4f3258[_0x665e('0x1a')],'include':_0x4f3258[_0x665e('0x1c')]?_[_0x665e('0x1d')](_0x4f3258[_0x665e('0x1c')],function(_0xc29aa4){return{'model':db[_0xc29aa4['model']],'as':_0xc29aa4['as'],'attributes':_0xc29aa4[_0x665e('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18bc3f){logger[_0x665e('0x14')](_0x665e('0x16'),_0x51e9e5);logger['debug'](_0x665e('0x16'),_0x51e9e5,JSON[_0x665e('0x1f')](_0x18bc3f));_0x3e75c2(_0x18bc3f);})['catch'](function(_0x40d4f9){logger[_0x665e('0x11')](_0x665e('0x16'),_0x40d4f9['message'],_0x51e9e5);_0x339205(_0x20d24f[_0x665e('0x11')](0x1f4,_0x40d4f9[_0x665e('0x13')]));});});};exports[_0x665e('0x20')]=function(_0x564139){var _0x1fdd86=this;return new Promise(function(_0x4c77a7,_0x35d7f9){return db[_0x665e('0x21')][_0x665e('0x22')]({'raw':_0x564139[_0x665e('0x17')]?_0x564139[_0x665e('0x17')][_0x665e('0x18')]===undefined?!![]:![]:!![],'where':_0x564139[_0x665e('0x17')]?_0x564139[_0x665e('0x17')][_0x665e('0x19')]||null:null,'attributes':_0x564139['options']?_0x564139['options'][_0x665e('0x1a')]||null:null,'include':_0x564139['options']?_0x564139[_0x665e('0x17')][_0x665e('0x1c')]?_['map'](_0x564139[_0x665e('0x17')][_0x665e('0x1c')],function(_0x152e10){return{'model':db[_0x152e10[_0x665e('0x1e')]],'as':_0x152e10['as'],'attributes':_0x152e10[_0x665e('0x1a')],'include':_0x152e10[_0x665e('0x1c')]?_[_0x665e('0x1d')](_0x152e10[_0x665e('0x1c')],function(_0x284149){return{'model':db[_0x284149['model']],'as':_0x284149['as'],'attributes':_0x284149[_0x665e('0x1a')],'include':_0x284149['include']?_['map'](_0x284149['include'],function(_0x1759d6){return{'model':db[_0x1759d6[_0x665e('0x1e')]],'as':_0x1759d6['as'],'attributes':_0x1759d6[_0x665e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x665e('0xe')](function(_0x27155a){logger['info'](_0x665e('0x20'),_0x564139);logger[_0x665e('0x23')](_0x665e('0x20'),_0x564139,JSON[_0x665e('0x1f')](_0x27155a));_0x4c77a7(_0x27155a);})['catch'](function(_0x10dcf1){logger[_0x665e('0x11')](_0x665e('0x20'),_0x10dcf1[_0x665e('0x13')],_0x564139);_0x35d7f9(_0x1fdd86['error'](0x1f4,_0x10dcf1[_0x665e('0x13')]));});});}; \ No newline at end of file +var _0x7851=['attributes','limit','map','include','model','info','where','ShowServicenowAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw'];(function(_0x4b2bb1,_0x5b99f4){var _0x36808d=function(_0x5d7774){while(--_0x5d7774){_0x4b2bb1['push'](_0x4b2bb1['shift']());}};_0x36808d(++_0x5b99f4);}(_0x7851,0x90));var _0x1785=function(_0x1a24a2,_0x446358){_0x1a24a2=_0x1a24a2-0x0;var _0x1ccaf3=_0x7851[_0x1a24a2];return _0x1ccaf3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1785('0x0'));var BPromise=require(_0x1785('0x1'));var rs=require(_0x1785('0x2'));var fs=require('fs');var Redis=require(_0x1785('0x3'));var db=require(_0x1785('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1785('0x5'));var config=require(_0x1785('0x6'));var jayson=require(_0x1785('0x7'));var client=jayson[_0x1785('0x8')][_0x1785('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57f7e5,_0x345f0d,_0x416832){return new BPromise(function(_0x38e653,_0x19713e){return client[_0x1785('0xa')](_0x57f7e5,_0x416832)[_0x1785('0xb')](function(_0xb68eab){logger['info'](_0x1785('0xc'),_0x345f0d,'request\x20sent');logger[_0x1785('0xd')](_0x1785('0xe'),_0x345f0d,_0x1785('0xf'),JSON[_0x1785('0x10')](_0xb68eab));if(_0xb68eab[_0x1785('0x11')]){if(_0xb68eab[_0x1785('0x11')]['code']===0x1f4){logger[_0x1785('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x345f0d,_0xb68eab[_0x1785('0x11')][_0x1785('0x12')]);return _0x19713e(_0xb68eab[_0x1785('0x11')][_0x1785('0x12')]);}logger[_0x1785('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x345f0d,_0xb68eab[_0x1785('0x11')][_0x1785('0x12')]);return _0x38e653(_0xb68eab[_0x1785('0x11')][_0x1785('0x12')]);}else{logger['info'](_0x1785('0xc'),_0x345f0d,'request\x20sent');_0x38e653(_0xb68eab[_0x1785('0x13')][_0x1785('0x12')]);}})[_0x1785('0x14')](function(_0x1ea05f){logger[_0x1785('0x11')](_0x1785('0xc'),_0x345f0d,_0x1ea05f);_0x19713e(_0x1ea05f);});});}exports[_0x1785('0x15')]=function(_0x1d4e45){var _0x4a8364=this;return new Promise(function(_0x545d3f,_0x51dd05){return db[_0x1785('0x16')][_0x1785('0x17')]({'raw':_0x1d4e45[_0x1785('0x18')]?_0x1d4e45[_0x1785('0x18')][_0x1785('0x19')]===undefined?!![]:![]:!![],'where':_0x1d4e45[_0x1785('0x18')]?_0x1d4e45[_0x1785('0x18')]['where']||null:null,'attributes':_0x1d4e45[_0x1785('0x18')]?_0x1d4e45[_0x1785('0x18')][_0x1785('0x1a')]||null:null,'limit':_0x1d4e45[_0x1785('0x18')]?_0x1d4e45[_0x1785('0x18')][_0x1785('0x1b')]||null:null,'include':_0x1d4e45[_0x1785('0x18')]?_0x1d4e45['options']['include']?_[_0x1785('0x1c')](_0x1d4e45[_0x1785('0x18')][_0x1785('0x1d')],function(_0x1a5409){return{'model':db[_0x1a5409[_0x1785('0x1e')]],'as':_0x1a5409['as'],'attributes':_0x1a5409[_0x1785('0x1a')],'include':_0x1a5409[_0x1785('0x1d')]?_[_0x1785('0x1c')](_0x1a5409[_0x1785('0x1d')],function(_0xae62b){return{'model':db[_0xae62b['model']],'as':_0xae62b['as'],'attributes':_0xae62b['attributes'],'include':_0xae62b[_0x1785('0x1d')]?_[_0x1785('0x1c')](_0xae62b[_0x1785('0x1d')],function(_0x3c2a00){return{'model':db[_0x3c2a00[_0x1785('0x1e')]],'as':_0x3c2a00['as'],'attributes':_0x3c2a00[_0x1785('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1785('0xb')](function(_0x3b3c5f){logger[_0x1785('0x1f')](_0x1785('0x15'),_0x1d4e45);logger[_0x1785('0xd')](_0x1785('0x15'),_0x1d4e45,JSON[_0x1785('0x10')](_0x3b3c5f));_0x545d3f(_0x3b3c5f);})[_0x1785('0x14')](function(_0x49cc25){logger[_0x1785('0x11')](_0x1785('0x15'),_0x49cc25[_0x1785('0x12')],_0x1d4e45);_0x51dd05(_0x4a8364[_0x1785('0x11')](0x1f4,_0x49cc25['message']));});});};exports['ShowServicenowAccount']=function(_0x212d19){var _0x52eb85=this;return new Promise(function(_0xd8310c,_0x54b48a){return db[_0x1785('0x16')]['find']({'raw':_0x212d19[_0x1785('0x18')]?_0x212d19[_0x1785('0x18')][_0x1785('0x19')]===undefined?!![]:![]:!![],'where':_0x212d19[_0x1785('0x18')]?_0x212d19['options'][_0x1785('0x20')]||null:null,'attributes':_0x212d19[_0x1785('0x18')]?_0x212d19['options'][_0x1785('0x1a')]||null:null,'include':_0x212d19[_0x1785('0x18')]?_0x212d19['options']['include']?_[_0x1785('0x1c')](_0x212d19[_0x1785('0x18')]['include'],function(_0x296d19){return{'model':db[_0x296d19[_0x1785('0x1e')]],'as':_0x296d19['as'],'attributes':_0x296d19[_0x1785('0x1a')],'include':_0x296d19[_0x1785('0x1d')]?_[_0x1785('0x1c')](_0x296d19['include'],function(_0xcdca5b){return{'model':db[_0xcdca5b[_0x1785('0x1e')]],'as':_0xcdca5b['as'],'attributes':_0xcdca5b[_0x1785('0x1a')],'include':_0xcdca5b[_0x1785('0x1d')]?_[_0x1785('0x1c')](_0xcdca5b[_0x1785('0x1d')],function(_0x559107){return{'model':db[_0x559107[_0x1785('0x1e')]],'as':_0x559107['as'],'attributes':_0x559107[_0x1785('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1785('0xb')](function(_0x319a91){logger[_0x1785('0x1f')](_0x1785('0x21'),_0x212d19);logger[_0x1785('0xd')](_0x1785('0x21'),_0x212d19,JSON[_0x1785('0x10')](_0x319a91));_0xd8310c(_0x319a91);})[_0x1785('0x14')](function(_0x36c60d){logger[_0x1785('0x11')](_0x1785('0x21'),_0x36c60d[_0x1785('0x12')],_0x212d19);_0x54b48a(_0x52eb85[_0x1785('0x11')](0x1f4,_0x36c60d[_0x1785('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 15c0800..d7cab4e 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 _0xbdb2=['/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','getSubjects'];(function(_0x282ad2,_0x48f983){var _0x5a54f7=function(_0x2cefb6){while(--_0x2cefb6){_0x282ad2['push'](_0x282ad2['shift']());}};_0x5a54f7(++_0x48f983);}(_0xbdb2,0x1d4));var _0x2bdb=function(_0x1e2a87,_0x534515){_0x1e2a87=_0x1e2a87-0x0;var _0xb88a8d=_0xbdb2[_0x1e2a87];return _0xb88a8d;};'use strict';var multer=require(_0x2bdb('0x0'));var util=require(_0x2bdb('0x1'));var path=require(_0x2bdb('0x2'));var timeout=require('connect-timeout');var express=require(_0x2bdb('0x3'));var router=express[_0x2bdb('0x4')]();var fs_extra=require(_0x2bdb('0x5'));var auth=require(_0x2bdb('0x6'));var interaction=require(_0x2bdb('0x7'));var config=require(_0x2bdb('0x8'));var controller=require(_0x2bdb('0x9'));router['get']('/',auth[_0x2bdb('0xa')](),controller[_0x2bdb('0xb')]);router[_0x2bdb('0xc')](_0x2bdb('0xd'),auth[_0x2bdb('0xa')](),controller[_0x2bdb('0xe')]);router[_0x2bdb('0xc')](_0x2bdb('0xf'),auth[_0x2bdb('0xa')](),controller[_0x2bdb('0x10')]);router[_0x2bdb('0xc')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x2bdb('0x11')]);router['get'](_0x2bdb('0x12'),auth[_0x2bdb('0xa')](),controller[_0x2bdb('0x13')]);router[_0x2bdb('0x14')]('/',auth['isAuthenticated'](),controller[_0x2bdb('0x15')]);router[_0x2bdb('0x16')](_0x2bdb('0xd'),auth['isAuthenticated'](),controller[_0x2bdb('0x17')]);router[_0x2bdb('0x18')](_0x2bdb('0xd'),auth['isAuthenticated'](),controller[_0x2bdb('0x19')]);module[_0x2bdb('0x1a')]=router; \ No newline at end of file +var _0x5e85=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','update','delete','multer','util'];(function(_0x31f7f7,_0x5eee5f){var _0x1529b7=function(_0x42df87){while(--_0x42df87){_0x31f7f7['push'](_0x31f7f7['shift']());}};_0x1529b7(++_0x5eee5f);}(_0x5e85,0x129));var _0x55e8=function(_0x1acf43,_0x4781f2){_0x1acf43=_0x1acf43-0x0;var _0x505a8b=_0x5e85[_0x1acf43];return _0x505a8b;};'use strict';var multer=require(_0x55e8('0x0'));var util=require(_0x55e8('0x1'));var path=require(_0x55e8('0x2'));var timeout=require('connect-timeout');var express=require(_0x55e8('0x3'));var router=express[_0x55e8('0x4')]();var fs_extra=require(_0x55e8('0x5'));var auth=require(_0x55e8('0x6'));var interaction=require(_0x55e8('0x7'));var config=require(_0x55e8('0x8'));var controller=require(_0x55e8('0x9'));router[_0x55e8('0xa')]('/',auth[_0x55e8('0xb')](),controller[_0x55e8('0xc')]);router[_0x55e8('0xa')](_0x55e8('0xd'),auth['isAuthenticated'](),controller[_0x55e8('0xe')]);router[_0x55e8('0xa')](_0x55e8('0xf'),auth[_0x55e8('0xb')](),controller[_0x55e8('0x10')]);router[_0x55e8('0xa')](_0x55e8('0x11'),auth['isAuthenticated'](),controller[_0x55e8('0x12')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x55e8('0x13')]);router['post']('/',auth[_0x55e8('0xb')](),controller[_0x55e8('0x14')]);router['put'](_0x55e8('0xd'),auth[_0x55e8('0xb')](),controller[_0x55e8('0x15')]);router[_0x55e8('0x16')](_0x55e8('0xd'),auth[_0x55e8('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index b99c109..a5b8959 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 _0xb905=['sequelize','exports','STRING'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xb905,0x1bf));var _0x5b90=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xb905[_0x24061a];return _0x82054e;};'use strict';var Sequelize=require(_0x5b90('0x0'));module[_0x5b90('0x1')]={'name':{'type':Sequelize[_0x5b90('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb2e9=['STRING','sequelize'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xb2e9,0x1ed));var _0x9b2e=function(_0xe4ffe5,_0x14c876){_0xe4ffe5=_0xe4ffe5-0x0;var _0x23dd76=_0xb2e9[_0xe4ffe5];return _0x23dd76;};'use strict';var Sequelize=require(_0x9b2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b2e('0x1')]},'description':{'type':Sequelize[_0x9b2e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index bb1042f..56f73a8 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 _0x4912=['desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','name','send','index','map','ServicenowConfiguration','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','type','filter','options','includeAll','include','rows','catch','show','params','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','ServicenowField','rawAttributes','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x1bbe38,_0x2bff53){var _0x49eb7c=function(_0x4a4db3){while(--_0x4a4db3){_0x1bbe38['push'](_0x1bbe38['shift']());}};_0x49eb7c(++_0x2bff53);}(_0x4912,0x1c0));var _0x2491=function(_0x1fa42c,_0x24a969){_0x1fa42c=_0x1fa42c-0x0;var _0x4d05e7=_0x4912[_0x1fa42c];return _0x4d05e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2491('0x0'));var zipdir=require(_0x2491('0x1'));var jsonpatch=require(_0x2491('0x2'));var rp=require(_0x2491('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2491('0x4'));var util=require(_0x2491('0x5'));var path=require(_0x2491('0x6'));var sox=require(_0x2491('0x7'));var csv=require(_0x2491('0x8'));var ejs=require(_0x2491('0x9'));var fs=require('fs');var fs_extra=require(_0x2491('0xa'));var _=require(_0x2491('0xb'));var squel=require('squel');var crypto=require(_0x2491('0xc'));var jsforce=require(_0x2491('0xd'));var deskjs=require(_0x2491('0xe'));var toCsv=require(_0x2491('0x8'));var querystring=require(_0x2491('0xf'));var Papa=require('papaparse');var Redis=require(_0x2491('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2491('0x11'));var as=require(_0x2491('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2491('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2491('0x14'))['db'];function respondWithStatusCode(_0x250cb3,_0x27f5a3){_0x27f5a3=_0x27f5a3||0xcc;return function(_0x311ccb){if(_0x311ccb){return _0x250cb3[_0x2491('0x15')](_0x27f5a3);}return _0x250cb3['status'](_0x27f5a3)['end']();};}function respondWithResult(_0x1a43ab,_0x5d0ca3){_0x5d0ca3=_0x5d0ca3||0xc8;return function(_0x2281c7){if(_0x2281c7){return _0x1a43ab[_0x2491('0x16')](_0x5d0ca3)['json'](_0x2281c7);}};}function respondWithFilteredResult(_0x6585e1,_0x181c11){return function(_0x2ecdde){if(_0x2ecdde){var _0x4702e9=typeof _0x181c11[_0x2491('0x17')]===_0x2491('0x18')&&typeof _0x181c11[_0x2491('0x19')]==='undefined';var _0xcdf811=_0x2ecdde[_0x2491('0x1a')];var _0x95e6c5=_0x4702e9?0x0:_0x181c11[_0x2491('0x17')];var _0x46bb64=_0x4702e9?_0x2ecdde[_0x2491('0x1a')]:_0x181c11[_0x2491('0x17')]+_0x181c11[_0x2491('0x19')];var _0x3260a5;if(_0x46bb64>=_0xcdf811){_0x46bb64=_0xcdf811;_0x3260a5=0xc8;}else{_0x3260a5=0xce;}_0x6585e1[_0x2491('0x16')](_0x3260a5);return _0x6585e1[_0x2491('0x1b')](_0x2491('0x1c'),_0x95e6c5+'-'+_0x46bb64+'/'+_0xcdf811)[_0x2491('0x1d')](_0x2ecdde);}return null;};}function patchUpdates(_0x502cd1){return function(_0x194152){try{jsonpatch[_0x2491('0x1e')](_0x194152,_0x502cd1,!![]);}catch(_0x36511e){return BPromise[_0x2491('0x1f')](_0x36511e);}return _0x194152['save']();};}function saveUpdates(_0x21f97f,_0x168db2){return function(_0x34f6e6){if(_0x34f6e6){return _0x34f6e6[_0x2491('0x20')](_0x21f97f)[_0x2491('0x21')](function(_0x533962){return _0x533962;});}return null;};}function removeEntity(_0x2a4513,_0x5e4c38){return function(_0xe6d064){if(_0xe6d064){return _0xe6d064[_0x2491('0x22')]()[_0x2491('0x21')](function(){_0x2a4513[_0x2491('0x16')](0xcc)[_0x2491('0x23')]();});}};}function handleEntityNotFound(_0xe0fe4c,_0x2c5b2d){return function(_0x371545){if(!_0x371545){_0xe0fe4c[_0x2491('0x15')](0x194);}return _0x371545;};}function handleError(_0x5cad08,_0x3aa452){_0x3aa452=_0x3aa452||0x1f4;return function(_0x283276){logger[_0x2491('0x24')](_0x283276['stack']);if(_0x283276[_0x2491('0x25')]){delete _0x283276[_0x2491('0x25')];}_0x5cad08[_0x2491('0x16')](_0x3aa452)[_0x2491('0x26')](_0x283276);};}exports[_0x2491('0x27')]=function(_0x5a0bf0,_0x1192ae){var _0xe69986={},_0x4c8bb0={},_0x284be8={'count':0x0,'rows':[]};var _0x1050fa=_[_0x2491('0x28')](db[_0x2491('0x29')]['rawAttributes'],function(_0x42f470){return{'name':_0x42f470[_0x2491('0x2a')],'type':_0x42f470['type'][_0x2491('0x2b')]};});_0x4c8bb0[_0x2491('0x2c')]=_[_0x2491('0x28')](_0x1050fa,_0x2491('0x25'));_0x4c8bb0[_0x2491('0x2d')]=_[_0x2491('0x2e')](_0x5a0bf0[_0x2491('0x2d')]);_0x4c8bb0['filters']=_[_0x2491('0x2f')](_0x4c8bb0[_0x2491('0x2c')],_0x4c8bb0[_0x2491('0x2d')]);_0xe69986[_0x2491('0x30')]=_['intersection'](_0x4c8bb0['model'],qs[_0x2491('0x31')](_0x5a0bf0['query'][_0x2491('0x31')]));_0xe69986[_0x2491('0x30')]=_0xe69986[_0x2491('0x30')][_0x2491('0x32')]?_0xe69986['attributes']:_0x4c8bb0[_0x2491('0x2c')];if(!_0x5a0bf0['query']['hasOwnProperty'](_0x2491('0x33'))){_0xe69986[_0x2491('0x19')]=qs[_0x2491('0x19')](_0x5a0bf0[_0x2491('0x2d')][_0x2491('0x19')]);_0xe69986[_0x2491('0x17')]=qs[_0x2491('0x17')](_0x5a0bf0[_0x2491('0x2d')]['offset']);}_0xe69986[_0x2491('0x34')]=qs[_0x2491('0x35')](_0x5a0bf0[_0x2491('0x2d')]['sort']);_0xe69986['where']=qs[_0x2491('0x36')](_[_0x2491('0x37')](_0x5a0bf0[_0x2491('0x2d')],_0x4c8bb0[_0x2491('0x36')]),_0x1050fa);if(_0x5a0bf0[_0x2491('0x2d')]['filter']){_0xe69986[_0x2491('0x38')]=_[_0x2491('0x39')](_0xe69986[_0x2491('0x38')],{'$or':_[_0x2491('0x28')](_0x1050fa,function(_0x24d77a){if(_0x24d77a[_0x2491('0x3a')]!=='VIRTUAL'){var _0x3c2fc6={};_0x3c2fc6[_0x24d77a[_0x2491('0x25')]]={'$like':'%'+_0x5a0bf0[_0x2491('0x2d')][_0x2491('0x3b')]+'%'};return _0x3c2fc6;}})});}_0xe69986=_[_0x2491('0x39')]({},_0xe69986,_0x5a0bf0[_0x2491('0x3c')]);var _0x54dbaf={'where':_0xe69986[_0x2491('0x38')]};return db[_0x2491('0x29')][_0x2491('0x1a')](_0x54dbaf)[_0x2491('0x21')](function(_0x2cbf56){_0x284be8[_0x2491('0x1a')]=_0x2cbf56;if(_0x5a0bf0[_0x2491('0x2d')][_0x2491('0x3d')]){_0xe69986[_0x2491('0x3e')]=[{'all':!![]}];}return db[_0x2491('0x29')]['findAll'](_0xe69986);})['then'](function(_0x1e2467){_0x284be8[_0x2491('0x3f')]=_0x1e2467;return _0x284be8;})[_0x2491('0x21')](respondWithFilteredResult(_0x1192ae,_0xe69986))[_0x2491('0x40')](handleError(_0x1192ae,null));};exports[_0x2491('0x41')]=function(_0x4713ea,_0x22b3c1){var _0x139d95={'raw':![],'where':{'id':_0x4713ea[_0x2491('0x42')]['id']}},_0x478067={};_0x478067['model']=_['keys'](db[_0x2491('0x29')]['rawAttributes']);_0x478067[_0x2491('0x2d')]=_[_0x2491('0x2e')](_0x4713ea[_0x2491('0x2d')]);_0x478067[_0x2491('0x36')]=_[_0x2491('0x2f')](_0x478067[_0x2491('0x2c')],_0x478067['query']);_0x139d95[_0x2491('0x30')]=_[_0x2491('0x2f')](_0x478067['model'],qs[_0x2491('0x31')](_0x4713ea[_0x2491('0x2d')][_0x2491('0x31')]));_0x139d95[_0x2491('0x30')]=_0x139d95[_0x2491('0x30')][_0x2491('0x32')]?_0x139d95[_0x2491('0x30')]:_0x478067[_0x2491('0x2c')];if(_0x4713ea[_0x2491('0x2d')][_0x2491('0x3d')]){_0x139d95[_0x2491('0x3e')]=[{'all':!![]}];}_0x139d95=_['merge']({},_0x139d95,_0x4713ea['options']);return db['ServicenowConfiguration'][_0x2491('0x43')](_0x139d95)['then'](handleEntityNotFound(_0x22b3c1,null))[_0x2491('0x21')](respondWithResult(_0x22b3c1,null))[_0x2491('0x40')](handleError(_0x22b3c1,null));};exports[_0x2491('0x44')]=function(_0x5e3874,_0x515143){return db['ServicenowConfiguration'][_0x2491('0x44')](_0x5e3874[_0x2491('0x45')],{})['then'](respondWithResult(_0x515143,0xc9))[_0x2491('0x40')](handleError(_0x515143,null));};exports[_0x2491('0x20')]=function(_0x5e6698,_0x12cd88){if(_0x5e6698[_0x2491('0x45')]['id']){delete _0x5e6698['body']['id'];}return db[_0x2491('0x29')][_0x2491('0x43')]({'where':{'id':_0x5e6698[_0x2491('0x42')]['id']}})[_0x2491('0x21')](handleEntityNotFound(_0x12cd88,null))[_0x2491('0x21')](saveUpdates(_0x5e6698[_0x2491('0x45')],null))[_0x2491('0x21')](respondWithResult(_0x12cd88,null))[_0x2491('0x40')](handleError(_0x12cd88,null));};exports['destroy']=function(_0x48b9f1,_0xceb26a){return db[_0x2491('0x29')][_0x2491('0x43')]({'where':{'id':_0x48b9f1[_0x2491('0x42')]['id']}})[_0x2491('0x21')](handleEntityNotFound(_0xceb26a,null))[_0x2491('0x21')](removeEntity(_0xceb26a,null))[_0x2491('0x40')](handleError(_0xceb26a,null));};exports[_0x2491('0x46')]=function(_0x1a5924,_0x5ba1a4,_0xeae962){var _0x4456aa={};var _0x4f9137={};var _0x63ec19;var _0xa8ca14;return db[_0x2491('0x29')][_0x2491('0x47')]({'where':{'id':_0x1a5924[_0x2491('0x42')]['id']}})[_0x2491('0x21')](handleEntityNotFound(_0x5ba1a4,null))['then'](function(_0x252e10){if(_0x252e10){_0x63ec19=_0x252e10;_0x4f9137[_0x2491('0x2c')]=_[_0x2491('0x2e')](db['ServicenowField']['rawAttributes']);_0x4f9137[_0x2491('0x2d')]=_[_0x2491('0x2e')](_0x1a5924[_0x2491('0x2d')]);_0x4f9137[_0x2491('0x36')]=_[_0x2491('0x2f')](_0x4f9137['model'],_0x4f9137[_0x2491('0x2d')]);_0x4456aa[_0x2491('0x30')]=_['intersection'](_0x4f9137[_0x2491('0x2c')],qs['fields'](_0x1a5924[_0x2491('0x2d')][_0x2491('0x31')]));_0x4456aa[_0x2491('0x30')]=_0x4456aa['attributes'][_0x2491('0x32')]?_0x4456aa[_0x2491('0x30')]:_0x4f9137[_0x2491('0x2c')];_0x4456aa['order']=qs[_0x2491('0x35')](_0x1a5924[_0x2491('0x2d')][_0x2491('0x35')]);_0x4456aa[_0x2491('0x38')]=qs[_0x2491('0x36')](_[_0x2491('0x37')](_0x1a5924[_0x2491('0x2d')],_0x4f9137['filters']));if(_0x1a5924[_0x2491('0x2d')][_0x2491('0x3b')]){_0x4456aa[_0x2491('0x38')]=_['merge'](_0x4456aa[_0x2491('0x38')],{'$or':_['map'](_0x4456aa[_0x2491('0x30')],function(_0x390467){var _0x2b7a42={};_0x2b7a42[_0x390467]={'$like':'%'+_0x1a5924[_0x2491('0x2d')][_0x2491('0x3b')]+'%'};return _0x2b7a42;})});}_0x4456aa=_['merge']({},_0x4456aa,_0x1a5924[_0x2491('0x3c')]);return _0x63ec19[_0x2491('0x46')](_0x4456aa);}})['then'](function(_0xadf37f){if(_0xadf37f){_0xa8ca14=_0xadf37f[_0x2491('0x32')];if(!_0x1a5924['query'][_0x2491('0x48')](_0x2491('0x33'))){_0x4456aa[_0x2491('0x19')]=qs[_0x2491('0x19')](_0x1a5924[_0x2491('0x2d')]['limit']);_0x4456aa[_0x2491('0x17')]=qs['offset'](_0x1a5924[_0x2491('0x2d')]['offset']);}return _0x63ec19['getFields'](_0x4456aa);}})[_0x2491('0x21')](function(_0x4264df){if(_0x4264df){return _0x4264df?{'count':_0xa8ca14,'rows':_0x4264df}:null;}})[_0x2491('0x21')](respondWithResult(_0x5ba1a4,null))[_0x2491('0x40')](handleError(_0x5ba1a4,null));};exports[_0x2491('0x49')]=function(_0x5bb799,_0x56dd1b,_0x2de422){var _0x59c969={};var _0x4200b8={};var _0x1643aa;var _0x5065bf;return db[_0x2491('0x29')]['findOne']({'where':{'id':_0x5bb799[_0x2491('0x42')]['id']}})[_0x2491('0x21')](handleEntityNotFound(_0x56dd1b,null))[_0x2491('0x21')](function(_0x3247d7){if(_0x3247d7){_0x1643aa=_0x3247d7;_0x4200b8[_0x2491('0x2c')]=_[_0x2491('0x2e')](db[_0x2491('0x4a')][_0x2491('0x4b')]);_0x4200b8[_0x2491('0x2d')]=_[_0x2491('0x2e')](_0x5bb799[_0x2491('0x2d')]);_0x4200b8[_0x2491('0x36')]=_['intersection'](_0x4200b8[_0x2491('0x2c')],_0x4200b8[_0x2491('0x2d')]);_0x59c969[_0x2491('0x30')]=_[_0x2491('0x2f')](_0x4200b8['model'],qs[_0x2491('0x31')](_0x5bb799[_0x2491('0x2d')][_0x2491('0x31')]));_0x59c969[_0x2491('0x30')]=_0x59c969['attributes'][_0x2491('0x32')]?_0x59c969['attributes']:_0x4200b8[_0x2491('0x2c')];_0x59c969[_0x2491('0x34')]=qs[_0x2491('0x35')](_0x5bb799[_0x2491('0x2d')]['sort']);_0x59c969[_0x2491('0x38')]=qs[_0x2491('0x36')](_[_0x2491('0x37')](_0x5bb799[_0x2491('0x2d')],_0x4200b8[_0x2491('0x36')]));if(_0x5bb799[_0x2491('0x2d')][_0x2491('0x3b')]){_0x59c969[_0x2491('0x38')]=_['merge'](_0x59c969['where'],{'$or':_['map'](_0x59c969[_0x2491('0x30')],function(_0x48d6df){var _0x25e804={};_0x25e804[_0x48d6df]={'$like':'%'+_0x5bb799[_0x2491('0x2d')][_0x2491('0x3b')]+'%'};return _0x25e804;})});}_0x59c969=_[_0x2491('0x39')]({},_0x59c969,_0x5bb799[_0x2491('0x3c')]);return _0x1643aa[_0x2491('0x49')](_0x59c969);}})[_0x2491('0x21')](function(_0x2b59cc){if(_0x2b59cc){_0x5065bf=_0x2b59cc['length'];if(!_0x5bb799[_0x2491('0x2d')][_0x2491('0x48')](_0x2491('0x33'))){_0x59c969[_0x2491('0x19')]=qs[_0x2491('0x19')](_0x5bb799['query']['limit']);_0x59c969[_0x2491('0x17')]=qs['offset'](_0x5bb799[_0x2491('0x2d')][_0x2491('0x17')]);}return _0x1643aa[_0x2491('0x49')](_0x59c969);}})[_0x2491('0x21')](function(_0x1ec3d5){if(_0x1ec3d5){return _0x1ec3d5?{'count':_0x5065bf,'rows':_0x1ec3d5}:null;}})[_0x2491('0x21')](respondWithResult(_0x56dd1b,null))[_0x2491('0x40')](handleError(_0x56dd1b,null));};exports[_0x2491('0x4c')]=function(_0x19666c,_0x915a76,_0x418339){var _0x193ebc={};var _0x3d04a8={};var _0x171f8a;var _0x2fcc59;return db[_0x2491('0x29')][_0x2491('0x47')]({'where':{'id':_0x19666c[_0x2491('0x42')]['id']}})['then'](handleEntityNotFound(_0x915a76,null))['then'](function(_0x22fb01){if(_0x22fb01){_0x171f8a=_0x22fb01;_0x3d04a8[_0x2491('0x2c')]=_[_0x2491('0x2e')](db['ServicenowField'][_0x2491('0x4b')]);_0x3d04a8[_0x2491('0x2d')]=_[_0x2491('0x2e')](_0x19666c[_0x2491('0x2d')]);_0x3d04a8[_0x2491('0x36')]=_['intersection'](_0x3d04a8[_0x2491('0x2c')],_0x3d04a8[_0x2491('0x2d')]);_0x193ebc[_0x2491('0x30')]=_[_0x2491('0x2f')](_0x3d04a8[_0x2491('0x2c')],qs[_0x2491('0x31')](_0x19666c[_0x2491('0x2d')][_0x2491('0x31')]));_0x193ebc['attributes']=_0x193ebc['attributes']['length']?_0x193ebc[_0x2491('0x30')]:_0x3d04a8[_0x2491('0x2c')];_0x193ebc[_0x2491('0x34')]=qs[_0x2491('0x35')](_0x19666c['query'][_0x2491('0x35')]);_0x193ebc[_0x2491('0x38')]=qs[_0x2491('0x36')](_[_0x2491('0x37')](_0x19666c[_0x2491('0x2d')],_0x3d04a8['filters']));if(_0x19666c['query'][_0x2491('0x3b')]){_0x193ebc[_0x2491('0x38')]=_[_0x2491('0x39')](_0x193ebc[_0x2491('0x38')],{'$or':_[_0x2491('0x28')](_0x193ebc[_0x2491('0x30')],function(_0x26e4f7){var _0x5430fe={};_0x5430fe[_0x26e4f7]={'$like':'%'+_0x19666c[_0x2491('0x2d')][_0x2491('0x3b')]+'%'};return _0x5430fe;})});}_0x193ebc=_[_0x2491('0x39')]({},_0x193ebc,_0x19666c[_0x2491('0x3c')]);return _0x171f8a[_0x2491('0x4c')](_0x193ebc);}})[_0x2491('0x21')](function(_0x9659ad){if(_0x9659ad){_0x2fcc59=_0x9659ad[_0x2491('0x32')];if(!_0x19666c[_0x2491('0x2d')][_0x2491('0x48')]('nolimit')){_0x193ebc[_0x2491('0x19')]=qs[_0x2491('0x19')](_0x19666c[_0x2491('0x2d')]['limit']);_0x193ebc['offset']=qs[_0x2491('0x17')](_0x19666c['query'][_0x2491('0x17')]);}return _0x171f8a[_0x2491('0x4c')](_0x193ebc);}})[_0x2491('0x21')](function(_0x2c69db){if(_0x2c69db){return _0x2c69db?{'count':_0x2fcc59,'rows':_0x2c69db}:null;}})[_0x2491('0x21')](respondWithResult(_0x915a76,null))[_0x2491('0x40')](handleError(_0x915a76,null));}; \ No newline at end of file +var _0x499a=['includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','update','getFields','findOne','ServicenowField','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','ServicenowConfiguration','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','type','merge','options'];(function(_0x2ee676,_0x5bf353){var _0x1bd42a=function(_0x20a303){while(--_0x20a303){_0x2ee676['push'](_0x2ee676['shift']());}};_0x1bd42a(++_0x5bf353);}(_0x499a,0xbb));var _0xa499=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x499a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa499('0x0'));var rimraf=require(_0xa499('0x1'));var zipdir=require(_0xa499('0x2'));var jsonpatch=require(_0xa499('0x3'));var rp=require(_0xa499('0x4'));var moment=require(_0xa499('0x5'));var BPromise=require(_0xa499('0x6'));var Mustache=require(_0xa499('0x7'));var util=require(_0xa499('0x8'));var path=require('path');var sox=require(_0xa499('0x9'));var csv=require(_0xa499('0xa'));var ejs=require(_0xa499('0xb'));var fs=require('fs');var fs_extra=require(_0xa499('0xc'));var _=require(_0xa499('0xd'));var squel=require('squel');var crypto=require(_0xa499('0xe'));var jsforce=require(_0xa499('0xf'));var deskjs=require(_0xa499('0x10'));var toCsv=require(_0xa499('0xa'));var querystring=require(_0xa499('0x11'));var Papa=require(_0xa499('0x12'));var Redis=require(_0xa499('0x13'));var authService=require(_0xa499('0x14'));var qs=require(_0xa499('0x15'));var as=require(_0xa499('0x16'));var hardwareService=require(_0xa499('0x17'));var logger=require('../../config/logger')(_0xa499('0x18'));var utils=require('../../config/utils');var config=require(_0xa499('0x19'));var licenseUtil=require(_0xa499('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e59f7,_0x116bd3){_0x116bd3=_0x116bd3||0xcc;return function(_0x27ca19){if(_0x27ca19){return _0x1e59f7['sendStatus'](_0x116bd3);}return _0x1e59f7[_0xa499('0x1b')](_0x116bd3)[_0xa499('0x1c')]();};}function respondWithResult(_0x562d38,_0x523e08){_0x523e08=_0x523e08||0xc8;return function(_0x29f4a5){if(_0x29f4a5){return _0x562d38['status'](_0x523e08)['json'](_0x29f4a5);}};}function respondWithFilteredResult(_0x364a00,_0x1a34f0){return function(_0x4de70e){if(_0x4de70e){var _0x2d3f72=typeof _0x1a34f0[_0xa499('0x1d')]===_0xa499('0x1e')&&typeof _0x1a34f0[_0xa499('0x1f')]===_0xa499('0x1e');var _0x9db498=_0x4de70e[_0xa499('0x20')];var _0x5e1515=_0x2d3f72?0x0:_0x1a34f0[_0xa499('0x1d')];var _0x36e67e=_0x2d3f72?_0x4de70e['count']:_0x1a34f0[_0xa499('0x1d')]+_0x1a34f0[_0xa499('0x1f')];var _0x3728f2;if(_0x36e67e>=_0x9db498){_0x36e67e=_0x9db498;_0x3728f2=0xc8;}else{_0x3728f2=0xce;}_0x364a00[_0xa499('0x1b')](_0x3728f2);return _0x364a00[_0xa499('0x21')](_0xa499('0x22'),_0x5e1515+'-'+_0x36e67e+'/'+_0x9db498)[_0xa499('0x23')](_0x4de70e);}return null;};}function patchUpdates(_0x41e0c6){return function(_0xee3c9a){try{jsonpatch[_0xa499('0x24')](_0xee3c9a,_0x41e0c6,!![]);}catch(_0x152d01){return BPromise[_0xa499('0x25')](_0x152d01);}return _0xee3c9a[_0xa499('0x26')]();};}function saveUpdates(_0x5cc373,_0x15f227){return function(_0x5126d9){if(_0x5126d9){return _0x5126d9['update'](_0x5cc373)[_0xa499('0x27')](function(_0x22f081){return _0x22f081;});}return null;};}function removeEntity(_0x3ce405,_0x38af7f){return function(_0xbb2c8f){if(_0xbb2c8f){return _0xbb2c8f[_0xa499('0x28')]()[_0xa499('0x27')](function(){_0x3ce405[_0xa499('0x1b')](0xcc)[_0xa499('0x1c')]();});}};}function handleEntityNotFound(_0x2a9190,_0x568114){return function(_0x2cc8fc){if(!_0x2cc8fc){_0x2a9190[_0xa499('0x29')](0x194);}return _0x2cc8fc;};}function handleError(_0x33fd0d,_0x292add){_0x292add=_0x292add||0x1f4;return function(_0x1612f2){logger[_0xa499('0x2a')](_0x1612f2[_0xa499('0x2b')]);if(_0x1612f2[_0xa499('0x2c')]){delete _0x1612f2[_0xa499('0x2c')];}_0x33fd0d[_0xa499('0x1b')](_0x292add)['send'](_0x1612f2);};}exports['index']=function(_0x22ea91,_0x2eb353){var _0x587405={},_0x3bd80b={},_0x1c24e7={'count':0x0,'rows':[]};var _0x537dac=_['map'](db[_0xa499('0x2d')][_0xa499('0x2e')],function(_0xa2cc2b){return{'name':_0xa2cc2b[_0xa499('0x2f')],'type':_0xa2cc2b['type'][_0xa499('0x30')]};});_0x3bd80b[_0xa499('0x31')]=_[_0xa499('0x32')](_0x537dac,_0xa499('0x2c'));_0x3bd80b['query']=_['keys'](_0x22ea91[_0xa499('0x33')]);_0x3bd80b[_0xa499('0x34')]=_[_0xa499('0x35')](_0x3bd80b[_0xa499('0x31')],_0x3bd80b['query']);_0x587405[_0xa499('0x36')]=_[_0xa499('0x35')](_0x3bd80b[_0xa499('0x31')],qs[_0xa499('0x37')](_0x22ea91[_0xa499('0x33')][_0xa499('0x37')]));_0x587405[_0xa499('0x36')]=_0x587405[_0xa499('0x36')][_0xa499('0x38')]?_0x587405[_0xa499('0x36')]:_0x3bd80b[_0xa499('0x31')];if(!_0x22ea91['query']['hasOwnProperty'](_0xa499('0x39'))){_0x587405[_0xa499('0x1f')]=qs[_0xa499('0x1f')](_0x22ea91[_0xa499('0x33')][_0xa499('0x1f')]);_0x587405[_0xa499('0x1d')]=qs[_0xa499('0x1d')](_0x22ea91[_0xa499('0x33')][_0xa499('0x1d')]);}_0x587405['order']=qs[_0xa499('0x3a')](_0x22ea91['query'][_0xa499('0x3a')]);_0x587405[_0xa499('0x3b')]=qs[_0xa499('0x34')](_[_0xa499('0x3c')](_0x22ea91['query'],_0x3bd80b['filters']),_0x537dac);if(_0x22ea91[_0xa499('0x33')][_0xa499('0x3d')]){_0x587405[_0xa499('0x3b')]=_['merge'](_0x587405[_0xa499('0x3b')],{'$or':_[_0xa499('0x32')](_0x537dac,function(_0x458934){if(_0x458934[_0xa499('0x3e')]!=='VIRTUAL'){var _0xee281f={};_0xee281f[_0x458934[_0xa499('0x2c')]]={'$like':'%'+_0x22ea91[_0xa499('0x33')][_0xa499('0x3d')]+'%'};return _0xee281f;}})});}_0x587405=_[_0xa499('0x3f')]({},_0x587405,_0x22ea91[_0xa499('0x40')]);var _0x59674a={'where':_0x587405[_0xa499('0x3b')]};return db[_0xa499('0x2d')][_0xa499('0x20')](_0x59674a)[_0xa499('0x27')](function(_0x5d2d22){_0x1c24e7[_0xa499('0x20')]=_0x5d2d22;if(_0x22ea91[_0xa499('0x33')][_0xa499('0x41')]){_0x587405[_0xa499('0x42')]=[{'all':!![]}];}return db[_0xa499('0x2d')][_0xa499('0x43')](_0x587405);})[_0xa499('0x27')](function(_0x54626d){_0x1c24e7[_0xa499('0x44')]=_0x54626d;return _0x1c24e7;})[_0xa499('0x27')](respondWithFilteredResult(_0x2eb353,_0x587405))['catch'](handleError(_0x2eb353,null));};exports[_0xa499('0x45')]=function(_0x33375e,_0x551252){var _0x69907d={'raw':![],'where':{'id':_0x33375e[_0xa499('0x46')]['id']}},_0x15bc95={};_0x15bc95[_0xa499('0x31')]=_[_0xa499('0x47')](db['ServicenowConfiguration'][_0xa499('0x2e')]);_0x15bc95[_0xa499('0x33')]=_[_0xa499('0x47')](_0x33375e['query']);_0x15bc95[_0xa499('0x34')]=_[_0xa499('0x35')](_0x15bc95[_0xa499('0x31')],_0x15bc95[_0xa499('0x33')]);_0x69907d[_0xa499('0x36')]=_['intersection'](_0x15bc95[_0xa499('0x31')],qs['fields'](_0x33375e['query'][_0xa499('0x37')]));_0x69907d[_0xa499('0x36')]=_0x69907d['attributes']['length']?_0x69907d[_0xa499('0x36')]:_0x15bc95[_0xa499('0x31')];if(_0x33375e[_0xa499('0x33')][_0xa499('0x41')]){_0x69907d['include']=[{'all':!![]}];}_0x69907d=_[_0xa499('0x3f')]({},_0x69907d,_0x33375e[_0xa499('0x40')]);return db[_0xa499('0x2d')][_0xa499('0x48')](_0x69907d)[_0xa499('0x27')](handleEntityNotFound(_0x551252,null))[_0xa499('0x27')](respondWithResult(_0x551252,null))['catch'](handleError(_0x551252,null));};exports[_0xa499('0x49')]=function(_0x40f422,_0x44182a){return db[_0xa499('0x2d')]['create'](_0x40f422[_0xa499('0x4a')],{})['then'](respondWithResult(_0x44182a,0xc9))[_0xa499('0x4b')](handleError(_0x44182a,null));};exports[_0xa499('0x4c')]=function(_0x3432b5,_0x6fc02f){if(_0x3432b5[_0xa499('0x4a')]['id']){delete _0x3432b5['body']['id'];}return db['ServicenowConfiguration'][_0xa499('0x48')]({'where':{'id':_0x3432b5[_0xa499('0x46')]['id']}})[_0xa499('0x27')](handleEntityNotFound(_0x6fc02f,null))[_0xa499('0x27')](saveUpdates(_0x3432b5[_0xa499('0x4a')],null))['then'](respondWithResult(_0x6fc02f,null))[_0xa499('0x4b')](handleError(_0x6fc02f,null));};exports[_0xa499('0x28')]=function(_0x5cf35d,_0x2d6296){return db['ServicenowConfiguration']['find']({'where':{'id':_0x5cf35d[_0xa499('0x46')]['id']}})[_0xa499('0x27')](handleEntityNotFound(_0x2d6296,null))[_0xa499('0x27')](removeEntity(_0x2d6296,null))[_0xa499('0x4b')](handleError(_0x2d6296,null));};exports[_0xa499('0x4d')]=function(_0x257917,_0x1056ef,_0x4d0bae){var _0x4b28c8={};var _0x265225={};var _0x2ecb38;var _0x559de1;return db[_0xa499('0x2d')][_0xa499('0x4e')]({'where':{'id':_0x257917[_0xa499('0x46')]['id']}})[_0xa499('0x27')](handleEntityNotFound(_0x1056ef,null))[_0xa499('0x27')](function(_0x3c6401){if(_0x3c6401){_0x2ecb38=_0x3c6401;_0x265225[_0xa499('0x31')]=_[_0xa499('0x47')](db[_0xa499('0x4f')][_0xa499('0x2e')]);_0x265225[_0xa499('0x33')]=_[_0xa499('0x47')](_0x257917[_0xa499('0x33')]);_0x265225[_0xa499('0x34')]=_[_0xa499('0x35')](_0x265225[_0xa499('0x31')],_0x265225['query']);_0x4b28c8['attributes']=_[_0xa499('0x35')](_0x265225['model'],qs[_0xa499('0x37')](_0x257917['query'][_0xa499('0x37')]));_0x4b28c8['attributes']=_0x4b28c8[_0xa499('0x36')][_0xa499('0x38')]?_0x4b28c8[_0xa499('0x36')]:_0x265225[_0xa499('0x31')];_0x4b28c8[_0xa499('0x50')]=qs['sort'](_0x257917['query'][_0xa499('0x3a')]);_0x4b28c8[_0xa499('0x3b')]=qs['filters'](_[_0xa499('0x3c')](_0x257917['query'],_0x265225[_0xa499('0x34')]));if(_0x257917[_0xa499('0x33')][_0xa499('0x3d')]){_0x4b28c8['where']=_[_0xa499('0x3f')](_0x4b28c8[_0xa499('0x3b')],{'$or':_['map'](_0x4b28c8[_0xa499('0x36')],function(_0x430978){var _0x393b15={};_0x393b15[_0x430978]={'$like':'%'+_0x257917['query'][_0xa499('0x3d')]+'%'};return _0x393b15;})});}_0x4b28c8=_['merge']({},_0x4b28c8,_0x257917['options']);return _0x2ecb38[_0xa499('0x4d')](_0x4b28c8);}})['then'](function(_0x33c6ca){if(_0x33c6ca){_0x559de1=_0x33c6ca['length'];if(!_0x257917[_0xa499('0x33')][_0xa499('0x51')](_0xa499('0x39'))){_0x4b28c8[_0xa499('0x1f')]=qs[_0xa499('0x1f')](_0x257917['query'][_0xa499('0x1f')]);_0x4b28c8[_0xa499('0x1d')]=qs['offset'](_0x257917[_0xa499('0x33')]['offset']);}return _0x2ecb38[_0xa499('0x4d')](_0x4b28c8);}})[_0xa499('0x27')](function(_0x527b68){if(_0x527b68){return _0x527b68?{'count':_0x559de1,'rows':_0x527b68}:null;}})[_0xa499('0x27')](respondWithResult(_0x1056ef,null))[_0xa499('0x4b')](handleError(_0x1056ef,null));};exports[_0xa499('0x52')]=function(_0x32ef7b,_0x210c0e,_0x14777a){var _0x4a9a89={};var _0x161796={};var _0x190477;var _0x4bb0df;return db[_0xa499('0x2d')]['findOne']({'where':{'id':_0x32ef7b['params']['id']}})[_0xa499('0x27')](handleEntityNotFound(_0x210c0e,null))['then'](function(_0x343e03){if(_0x343e03){_0x190477=_0x343e03;_0x161796[_0xa499('0x31')]=_[_0xa499('0x47')](db[_0xa499('0x4f')][_0xa499('0x2e')]);_0x161796[_0xa499('0x33')]=_[_0xa499('0x47')](_0x32ef7b[_0xa499('0x33')]);_0x161796['filters']=_[_0xa499('0x35')](_0x161796[_0xa499('0x31')],_0x161796['query']);_0x4a9a89[_0xa499('0x36')]=_['intersection'](_0x161796['model'],qs[_0xa499('0x37')](_0x32ef7b[_0xa499('0x33')][_0xa499('0x37')]));_0x4a9a89[_0xa499('0x36')]=_0x4a9a89[_0xa499('0x36')]['length']?_0x4a9a89[_0xa499('0x36')]:_0x161796[_0xa499('0x31')];_0x4a9a89[_0xa499('0x50')]=qs[_0xa499('0x3a')](_0x32ef7b[_0xa499('0x33')][_0xa499('0x3a')]);_0x4a9a89[_0xa499('0x3b')]=qs['filters'](_[_0xa499('0x3c')](_0x32ef7b[_0xa499('0x33')],_0x161796[_0xa499('0x34')]));if(_0x32ef7b[_0xa499('0x33')][_0xa499('0x3d')]){_0x4a9a89[_0xa499('0x3b')]=_[_0xa499('0x3f')](_0x4a9a89['where'],{'$or':_['map'](_0x4a9a89[_0xa499('0x36')],function(_0x27ed24){var _0x300b44={};_0x300b44[_0x27ed24]={'$like':'%'+_0x32ef7b[_0xa499('0x33')][_0xa499('0x3d')]+'%'};return _0x300b44;})});}_0x4a9a89=_[_0xa499('0x3f')]({},_0x4a9a89,_0x32ef7b[_0xa499('0x40')]);return _0x190477[_0xa499('0x52')](_0x4a9a89);}})[_0xa499('0x27')](function(_0x455cfe){if(_0x455cfe){_0x4bb0df=_0x455cfe[_0xa499('0x38')];if(!_0x32ef7b[_0xa499('0x33')][_0xa499('0x51')](_0xa499('0x39'))){_0x4a9a89[_0xa499('0x1f')]=qs['limit'](_0x32ef7b[_0xa499('0x33')][_0xa499('0x1f')]);_0x4a9a89['offset']=qs[_0xa499('0x1d')](_0x32ef7b[_0xa499('0x33')]['offset']);}return _0x190477['getSubjects'](_0x4a9a89);}})['then'](function(_0x6d698e){if(_0x6d698e){return _0x6d698e?{'count':_0x4bb0df,'rows':_0x6d698e}:null;}})[_0xa499('0x27')](respondWithResult(_0x210c0e,null))[_0xa499('0x4b')](handleError(_0x210c0e,null));};exports['getDescriptions']=function(_0x42a6d3,_0x9aeaae,_0x3221e0){var _0x4a9c16={};var _0x382ab8={};var _0x5c027c;var _0x24a81;return db[_0xa499('0x2d')][_0xa499('0x4e')]({'where':{'id':_0x42a6d3['params']['id']}})[_0xa499('0x27')](handleEntityNotFound(_0x9aeaae,null))[_0xa499('0x27')](function(_0xf847a6){if(_0xf847a6){_0x5c027c=_0xf847a6;_0x382ab8[_0xa499('0x31')]=_[_0xa499('0x47')](db['ServicenowField'][_0xa499('0x2e')]);_0x382ab8['query']=_[_0xa499('0x47')](_0x42a6d3[_0xa499('0x33')]);_0x382ab8[_0xa499('0x34')]=_[_0xa499('0x35')](_0x382ab8[_0xa499('0x31')],_0x382ab8[_0xa499('0x33')]);_0x4a9c16[_0xa499('0x36')]=_[_0xa499('0x35')](_0x382ab8[_0xa499('0x31')],qs['fields'](_0x42a6d3['query'][_0xa499('0x37')]));_0x4a9c16['attributes']=_0x4a9c16[_0xa499('0x36')][_0xa499('0x38')]?_0x4a9c16['attributes']:_0x382ab8[_0xa499('0x31')];_0x4a9c16[_0xa499('0x50')]=qs[_0xa499('0x3a')](_0x42a6d3[_0xa499('0x33')]['sort']);_0x4a9c16['where']=qs[_0xa499('0x34')](_[_0xa499('0x3c')](_0x42a6d3[_0xa499('0x33')],_0x382ab8['filters']));if(_0x42a6d3[_0xa499('0x33')]['filter']){_0x4a9c16[_0xa499('0x3b')]=_[_0xa499('0x3f')](_0x4a9c16[_0xa499('0x3b')],{'$or':_[_0xa499('0x32')](_0x4a9c16[_0xa499('0x36')],function(_0x58bc5b){var _0x3c5122={};_0x3c5122[_0x58bc5b]={'$like':'%'+_0x42a6d3[_0xa499('0x33')][_0xa499('0x3d')]+'%'};return _0x3c5122;})});}_0x4a9c16=_[_0xa499('0x3f')]({},_0x4a9c16,_0x42a6d3['options']);return _0x5c027c[_0xa499('0x53')](_0x4a9c16);}})[_0xa499('0x27')](function(_0x2ab258){if(_0x2ab258){_0x24a81=_0x2ab258[_0xa499('0x38')];if(!_0x42a6d3[_0xa499('0x33')][_0xa499('0x51')](_0xa499('0x39'))){_0x4a9c16[_0xa499('0x1f')]=qs[_0xa499('0x1f')](_0x42a6d3[_0xa499('0x33')][_0xa499('0x1f')]);_0x4a9c16[_0xa499('0x1d')]=qs[_0xa499('0x1d')](_0x42a6d3[_0xa499('0x33')][_0xa499('0x1d')]);}return _0x5c027c['getDescriptions'](_0x4a9c16);}})[_0xa499('0x27')](function(_0x4d0bd9){if(_0x4d0bd9){return _0x4d0bd9?{'count':_0x24a81,'rows':_0x4d0bd9}:null;}})[_0xa499('0x27')](respondWithResult(_0x9aeaae,null))['catch'](handleError(_0x9aeaae,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 7e4e210..d96e3f1 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 _0x7e74=['moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','../../config/logger','api'];(function(_0x5a709c,_0x1e6cfe){var _0x719025=function(_0x1ddba3){while(--_0x1ddba3){_0x5a709c['push'](_0x5a709c['shift']());}};_0x719025(++_0x1e6cfe);}(_0x7e74,0xbd));var _0x47e7=function(_0x45f138,_0x32d783){_0x45f138=_0x45f138-0x0;var _0x514a5b=_0x7e74[_0x45f138];return _0x514a5b;};'use strict';var _=require(_0x47e7('0x0'));var util=require('util');var logger=require(_0x47e7('0x1'))(_0x47e7('0x2'));var moment=require(_0x47e7('0x3'));var BPromise=require(_0x47e7('0x4'));var rp=require(_0x47e7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47e7('0x6'));var config=require(_0x47e7('0x7'));var attributes=require(_0x47e7('0x8'));module[_0x47e7('0x9')]=function(_0xe300cf,_0x14c1b9){return _0xe300cf[_0x47e7('0xa')]('ServicenowConfiguration',attributes,{'tableName':_0x47e7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x119c=['../../config/environment','exports','ServicenowConfiguration','int_servicenow_configurations','util','api','moment','bluebird','path','rimraf'];(function(_0x518c89,_0x42ad66){var _0x4aee9d=function(_0xe5a064){while(--_0xe5a064){_0x518c89['push'](_0x518c89['shift']());}};_0x4aee9d(++_0x42ad66);}(_0x119c,0xea));var _0xc119=function(_0x122481,_0x4ab9ec){_0x122481=_0x122481-0x0;var _0x8f8026=_0x119c[_0x122481];return _0x8f8026;};'use strict';var _=require('lodash');var util=require(_0xc119('0x0'));var logger=require('../../config/logger')(_0xc119('0x1'));var moment=require(_0xc119('0x2'));var BPromise=require(_0xc119('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc119('0x4'));var rimraf=require(_0xc119('0x5'));var config=require(_0xc119('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xc119('0x7')]=function(_0x55a01a,_0x38be76){return _0x55a01a['define'](_0xc119('0x8'),attributes,{'tableName':_0xc119('0x9'),'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 e9b2543..c0aa3b6 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 _0x018f=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','ServicenowConfiguration,\x20%s,\x20%s','debug'];(function(_0x53dcc7,_0x56e2e1){var _0x57a3c2=function(_0x3c7f51){while(--_0x3c7f51){_0x53dcc7['push'](_0x53dcc7['shift']());}};_0x57a3c2(++_0x56e2e1);}(_0x018f,0x93));var _0xf018=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0x018f[_0x547456];return _0xc1fd7b;};'use strict';var _=require(_0xf018('0x0'));var util=require(_0xf018('0x1'));var moment=require(_0xf018('0x2'));var BPromise=require(_0xf018('0x3'));var rs=require(_0xf018('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf018('0x5'))['db'];var utils=require(_0xf018('0x6'));var logger=require(_0xf018('0x7'))(_0xf018('0x8'));var config=require(_0xf018('0x9'));var jayson=require(_0xf018('0xa'));var client=jayson['client'][_0xf018('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10037a,_0x2b3e5a,_0x331734){return new BPromise(function(_0x31f22b,_0x32e80b){return client['request'](_0x10037a,_0x331734)['then'](function(_0x3e2b58){logger['info'](_0xf018('0xc'),_0x2b3e5a,'request\x20sent');logger[_0xf018('0xd')](_0xf018('0xe'),_0x2b3e5a,_0xf018('0xf'),JSON[_0xf018('0x10')](_0x3e2b58));if(_0x3e2b58[_0xf018('0x11')]){if(_0x3e2b58['error'][_0xf018('0x12')]===0x1f4){logger[_0xf018('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2b3e5a,_0x3e2b58[_0xf018('0x11')][_0xf018('0x13')]);return _0x32e80b(_0x3e2b58[_0xf018('0x11')]['message']);}logger[_0xf018('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2b3e5a,_0x3e2b58[_0xf018('0x11')]['message']);return _0x31f22b(_0x3e2b58[_0xf018('0x11')][_0xf018('0x13')]);}else{logger[_0xf018('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2b3e5a,_0xf018('0xf'));_0x31f22b(_0x3e2b58[_0xf018('0x15')]['message']);}})[_0xf018('0x16')](function(_0x45360f){logger['error'](_0xf018('0xc'),_0x2b3e5a,_0x45360f);_0x32e80b(_0x45360f);});});} \ No newline at end of file +var _0xd09b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','ServicenowConfiguration,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xd09b,0x1da));var _0xbd09=function(_0x10a2af,_0xdcda83){_0x10a2af=_0x10a2af-0x0;var _0x17fea6=_0xd09b[_0x10a2af];return _0x17fea6;};'use strict';var _=require(_0xbd09('0x0'));var util=require(_0xbd09('0x1'));var moment=require(_0xbd09('0x2'));var BPromise=require(_0xbd09('0x3'));var rs=require(_0xbd09('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd09('0x5'))['db'];var utils=require(_0xbd09('0x6'));var logger=require(_0xbd09('0x7'))(_0xbd09('0x8'));var config=require(_0xbd09('0x9'));var jayson=require(_0xbd09('0xa'));var client=jayson[_0xbd09('0xb')][_0xbd09('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39ea37,_0x7bcae8,_0x3609f4){return new BPromise(function(_0x1fe4d8,_0xe2400d){return client[_0xbd09('0xd')](_0x39ea37,_0x3609f4)[_0xbd09('0xe')](function(_0x2329a4){logger[_0xbd09('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x7bcae8,_0xbd09('0x10'));logger[_0xbd09('0x11')](_0xbd09('0x12'),_0x7bcae8,_0xbd09('0x10'),JSON['stringify'](_0x2329a4));if(_0x2329a4[_0xbd09('0x13')]){if(_0x2329a4['error'][_0xbd09('0x14')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x7bcae8,_0x2329a4['error'][_0xbd09('0x15')]);return _0xe2400d(_0x2329a4['error']['message']);}logger[_0xbd09('0x13')](_0xbd09('0x16'),_0x7bcae8,_0x2329a4[_0xbd09('0x13')][_0xbd09('0x15')]);return _0x1fe4d8(_0x2329a4['error'][_0xbd09('0x15')]);}else{logger[_0xbd09('0xf')](_0xbd09('0x16'),_0x7bcae8,_0xbd09('0x10'));_0x1fe4d8(_0x2329a4['result'][_0xbd09('0x15')]);}})[_0xbd09('0x17')](function(_0x520edc){logger[_0xbd09('0x13')](_0xbd09('0x16'),_0x7bcae8,_0x520edc);_0xe2400d(_0x520edc);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 18178eb..3a26769 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 _0xd1ed=['isAuthenticated','/:id','show','post','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get'];(function(_0x30c07c,_0x5d7b29){var _0xf02854=function(_0x1ac52f){while(--_0x1ac52f){_0x30c07c['push'](_0x30c07c['shift']());}};_0xf02854(++_0x5d7b29);}(_0xd1ed,0x14a));var _0xdd1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd1ed[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xdd1e('0x0'));var path=require(_0xdd1e('0x1'));var timeout=require(_0xdd1e('0x2'));var express=require(_0xdd1e('0x3'));var router=express['Router']();var fs_extra=require(_0xdd1e('0x4'));var auth=require(_0xdd1e('0x5'));var interaction=require(_0xdd1e('0x6'));var config=require(_0xdd1e('0x7'));var controller=require(_0xdd1e('0x8'));router[_0xdd1e('0x9')]('/',auth[_0xdd1e('0xa')](),controller['index']);router[_0xdd1e('0x9')](_0xdd1e('0xb'),auth[_0xdd1e('0xa')](),controller[_0xdd1e('0xc')]);router[_0xdd1e('0xd')]('/',auth[_0xdd1e('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdd1e('0xe')]);router['delete'](_0xdd1e('0xb'),auth[_0xdd1e('0xa')](),controller[_0xdd1e('0xf')]);module[_0xdd1e('0x10')]=router; \ No newline at end of file +var _0x9f3d=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0x9f3d,0xfb));var _0xd9f3=function(_0x1afe00,_0x3fac5d){_0x1afe00=_0x1afe00-0x0;var _0x23bb95=_0x9f3d[_0x1afe00];return _0x23bb95;};'use strict';var multer=require(_0xd9f3('0x0'));var util=require(_0xd9f3('0x1'));var path=require(_0xd9f3('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9f3('0x3'));var router=express[_0xd9f3('0x4')]();var fs_extra=require(_0xd9f3('0x5'));var auth=require(_0xd9f3('0x6'));var interaction=require(_0xd9f3('0x7'));var config=require(_0xd9f3('0x8'));var controller=require(_0xd9f3('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xd9f3('0xa')]);router[_0xd9f3('0xb')](_0xd9f3('0xc'),auth[_0xd9f3('0xd')](),controller[_0xd9f3('0xe')]);router[_0xd9f3('0xf')]('/',auth[_0xd9f3('0xd')](),controller[_0xd9f3('0x10')]);router[_0xd9f3('0x11')](_0xd9f3('0xc'),auth['isAuthenticated'](),controller[_0xd9f3('0x12')]);router[_0xd9f3('0x13')](_0xd9f3('0xc'),auth['isAuthenticated'](),controller[_0xd9f3('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index e98e036..676822a 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 _0xb9d3=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0xb9d3,0x14c));var _0x3b9d=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xb9d3[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require(_0x3b9d('0x0'));module[_0x3b9d('0x1')]={'type':{'type':Sequelize[_0x3b9d('0x2')](_0x3b9d('0x3'),_0x3b9d('0x4'),_0x3b9d('0x5'),_0x3b9d('0x6'),_0x3b9d('0x7')),'defaultValue':_0x3b9d('0x3')},'content':{'type':Sequelize[_0x3b9d('0x8')]},'key':{'type':Sequelize[_0x3b9d('0x8')]},'keyType':{'type':Sequelize[_0x3b9d('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x3b9d('0x8')]},'idField':{'type':Sequelize[_0x3b9d('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3b9d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1e24=['variable','picklist','STRING','string','customVariable','BOOLEAN','sequelize','exports'];(function(_0x374165,_0x27fa1d){var _0x2f442b=function(_0x530f92){while(--_0x530f92){_0x374165['push'](_0x374165['shift']());}};_0x2f442b(++_0x27fa1d);}(_0x1e24,0x1d6));var _0x41e2=function(_0x601481,_0x2f72de){_0x601481=_0x601481-0x0;var _0x4060a7=_0x1e24[_0x601481];return _0x4060a7;};'use strict';var Sequelize=require(_0x41e2('0x0'));module[_0x41e2('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x41e2('0x2'),'customVariable','keyValue',_0x41e2('0x3')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x41e2('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x41e2('0x5'),'variable',_0x41e2('0x6'))},'keyContent':{'type':Sequelize[_0x41e2('0x4')]},'idField':{'type':Sequelize[_0x41e2('0x4')]},'nameField':{'type':Sequelize[_0x41e2('0x4')]},'customField':{'type':Sequelize[_0x41e2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x41e2('0x4')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 6f2a106..2ad1137 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 _0xe166=['destroy','stack','name','send','index','map','ServicenowField','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../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'];(function(_0xa59914,_0x365cfd){var _0x44d11e=function(_0x3d95a1){while(--_0x3d95a1){_0xa59914['push'](_0xa59914['shift']());}};_0x44d11e(++_0x365cfd);}(_0xe166,0x182));var _0x6e16=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xe166[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6e16('0x0'));var jsonpatch=require(_0x6e16('0x1'));var rp=require(_0x6e16('0x2'));var moment=require(_0x6e16('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6e16('0x4'));var util=require('util');var path=require(_0x6e16('0x5'));var sox=require(_0x6e16('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e16('0x7'));var _=require(_0x6e16('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6e16('0x9'));var deskjs=require(_0x6e16('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6e16('0xb'));var Redis=require(_0x6e16('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x6e16('0xd'));var as=require(_0x6e16('0xe'));var hardwareService=require(_0x6e16('0xf'));var logger=require('../../config/logger')(_0x6e16('0x10'));var utils=require(_0x6e16('0x11'));var config=require(_0x6e16('0x12'));var licenseUtil=require(_0x6e16('0x13'));var db=require(_0x6e16('0x14'))['db'];function respondWithStatusCode(_0x2082e3,_0x1a8c70){_0x1a8c70=_0x1a8c70||0xcc;return function(_0x23985f){if(_0x23985f){return _0x2082e3['sendStatus'](_0x1a8c70);}return _0x2082e3[_0x6e16('0x15')](_0x1a8c70)[_0x6e16('0x16')]();};}function respondWithResult(_0x16cbf5,_0x17d378){_0x17d378=_0x17d378||0xc8;return function(_0x397b4a){if(_0x397b4a){return _0x16cbf5[_0x6e16('0x15')](_0x17d378)[_0x6e16('0x17')](_0x397b4a);}};}function respondWithFilteredResult(_0x2dfbf6,_0xd6f727){return function(_0x5e732a){if(_0x5e732a){var _0xbad34b=typeof _0xd6f727[_0x6e16('0x18')]===_0x6e16('0x19')&&typeof _0xd6f727[_0x6e16('0x1a')]===_0x6e16('0x19');var _0x4a4544=_0x5e732a['count'];var _0x58b528=_0xbad34b?0x0:_0xd6f727[_0x6e16('0x18')];var _0x6fcca4=_0xbad34b?_0x5e732a[_0x6e16('0x1b')]:_0xd6f727[_0x6e16('0x18')]+_0xd6f727[_0x6e16('0x1a')];var _0x537c64;if(_0x6fcca4>=_0x4a4544){_0x6fcca4=_0x4a4544;_0x537c64=0xc8;}else{_0x537c64=0xce;}_0x2dfbf6[_0x6e16('0x15')](_0x537c64);return _0x2dfbf6[_0x6e16('0x1c')](_0x6e16('0x1d'),_0x58b528+'-'+_0x6fcca4+'/'+_0x4a4544)['json'](_0x5e732a);}return null;};}function patchUpdates(_0x11a912){return function(_0x132573){try{jsonpatch['apply'](_0x132573,_0x11a912,!![]);}catch(_0x21b6b8){return BPromise[_0x6e16('0x1e')](_0x21b6b8);}return _0x132573[_0x6e16('0x1f')]();};}function saveUpdates(_0x55ab76,_0x5c0775){return function(_0x176a32){if(_0x176a32){return _0x176a32[_0x6e16('0x20')](_0x55ab76)[_0x6e16('0x21')](function(_0x27f58c){return _0x27f58c;});}return null;};}function removeEntity(_0x4add0a,_0x30be6b){return function(_0x3ea01e){if(_0x3ea01e){return _0x3ea01e[_0x6e16('0x22')]()[_0x6e16('0x21')](function(){_0x4add0a[_0x6e16('0x15')](0xcc)[_0x6e16('0x16')]();});}};}function handleEntityNotFound(_0x50d2f9,_0x2ddfa5){return function(_0x4f04d9){if(!_0x4f04d9){_0x50d2f9['sendStatus'](0x194);}return _0x4f04d9;};}function handleError(_0x371e88,_0x5799ce){_0x5799ce=_0x5799ce||0x1f4;return function(_0x1b458b){logger['error'](_0x1b458b[_0x6e16('0x23')]);if(_0x1b458b[_0x6e16('0x24')]){delete _0x1b458b[_0x6e16('0x24')];}_0x371e88[_0x6e16('0x15')](_0x5799ce)[_0x6e16('0x25')](_0x1b458b);};}exports[_0x6e16('0x26')]=function(_0x393249,_0x41ae7a){var _0x76561a={},_0x24e368={},_0x39757f={'count':0x0,'rows':[]};var _0x200993=_[_0x6e16('0x27')](db[_0x6e16('0x28')][_0x6e16('0x29')],function(_0x41dac4){return{'name':_0x41dac4['fieldName'],'type':_0x41dac4[_0x6e16('0x2a')]['key']};});_0x24e368[_0x6e16('0x2b')]=_[_0x6e16('0x27')](_0x200993,'name');_0x24e368[_0x6e16('0x2c')]=_[_0x6e16('0x2d')](_0x393249[_0x6e16('0x2c')]);_0x24e368[_0x6e16('0x2e')]=_[_0x6e16('0x2f')](_0x24e368['model'],_0x24e368[_0x6e16('0x2c')]);_0x76561a['attributes']=_['intersection'](_0x24e368[_0x6e16('0x2b')],qs[_0x6e16('0x30')](_0x393249[_0x6e16('0x2c')]['fields']));_0x76561a[_0x6e16('0x31')]=_0x76561a[_0x6e16('0x31')][_0x6e16('0x32')]?_0x76561a['attributes']:_0x24e368['model'];if(!_0x393249[_0x6e16('0x2c')][_0x6e16('0x33')](_0x6e16('0x34'))){_0x76561a[_0x6e16('0x1a')]=qs['limit'](_0x393249[_0x6e16('0x2c')]['limit']);_0x76561a[_0x6e16('0x18')]=qs[_0x6e16('0x18')](_0x393249[_0x6e16('0x2c')][_0x6e16('0x18')]);}_0x76561a[_0x6e16('0x35')]=qs[_0x6e16('0x36')](_0x393249[_0x6e16('0x2c')]['sort']);_0x76561a[_0x6e16('0x37')]=qs['filters'](_[_0x6e16('0x38')](_0x393249[_0x6e16('0x2c')],_0x24e368[_0x6e16('0x2e')]),_0x200993);if(_0x393249[_0x6e16('0x2c')]['filter']){_0x76561a[_0x6e16('0x37')]=_['merge'](_0x76561a[_0x6e16('0x37')],{'$or':_[_0x6e16('0x27')](_0x200993,function(_0x257787){if(_0x257787['type']!==_0x6e16('0x39')){var _0x32c4ab={};_0x32c4ab[_0x257787[_0x6e16('0x24')]]={'$like':'%'+_0x393249[_0x6e16('0x2c')]['filter']+'%'};return _0x32c4ab;}})});}_0x76561a=_[_0x6e16('0x3a')]({},_0x76561a,_0x393249['options']);var _0xa5cb11={'where':_0x76561a['where']};return db[_0x6e16('0x28')][_0x6e16('0x1b')](_0xa5cb11)['then'](function(_0x1a9eb2){_0x39757f['count']=_0x1a9eb2;if(_0x393249['query'][_0x6e16('0x3b')]){_0x76561a[_0x6e16('0x3c')]=[{'all':!![]}];}return db[_0x6e16('0x28')][_0x6e16('0x3d')](_0x76561a);})[_0x6e16('0x21')](function(_0x116077){_0x39757f[_0x6e16('0x3e')]=_0x116077;return _0x39757f;})[_0x6e16('0x21')](respondWithFilteredResult(_0x41ae7a,_0x76561a))[_0x6e16('0x3f')](handleError(_0x41ae7a,null));};exports[_0x6e16('0x40')]=function(_0x1eee35,_0x3bc05b){var _0x1717c1={'raw':!![],'where':{'id':_0x1eee35[_0x6e16('0x41')]['id']}},_0x5c0cbc={};_0x5c0cbc[_0x6e16('0x2b')]=_['keys'](db['ServicenowField'][_0x6e16('0x29')]);_0x5c0cbc[_0x6e16('0x2c')]=_[_0x6e16('0x2d')](_0x1eee35[_0x6e16('0x2c')]);_0x5c0cbc[_0x6e16('0x2e')]=_[_0x6e16('0x2f')](_0x5c0cbc[_0x6e16('0x2b')],_0x5c0cbc['query']);_0x1717c1[_0x6e16('0x31')]=_['intersection'](_0x5c0cbc['model'],qs['fields'](_0x1eee35['query'][_0x6e16('0x30')]));_0x1717c1[_0x6e16('0x31')]=_0x1717c1['attributes'][_0x6e16('0x32')]?_0x1717c1[_0x6e16('0x31')]:_0x5c0cbc[_0x6e16('0x2b')];if(_0x1eee35['query'][_0x6e16('0x3b')]){_0x1717c1['include']=[{'all':!![]}];}_0x1717c1=_['merge']({},_0x1717c1,_0x1eee35[_0x6e16('0x42')]);return db[_0x6e16('0x28')]['find'](_0x1717c1)[_0x6e16('0x21')](handleEntityNotFound(_0x3bc05b,null))[_0x6e16('0x21')](respondWithResult(_0x3bc05b,null))[_0x6e16('0x3f')](handleError(_0x3bc05b,null));};exports[_0x6e16('0x43')]=function(_0x335fc2,_0x5491b3){return db[_0x6e16('0x28')]['create'](_0x335fc2[_0x6e16('0x44')],{})[_0x6e16('0x21')](respondWithResult(_0x5491b3,0xc9))[_0x6e16('0x3f')](handleError(_0x5491b3,null));};exports[_0x6e16('0x20')]=function(_0xf67443,_0x316d0d){if(_0xf67443[_0x6e16('0x44')]['id']){delete _0xf67443[_0x6e16('0x44')]['id'];}return db[_0x6e16('0x28')]['find']({'where':{'id':_0xf67443[_0x6e16('0x41')]['id']}})[_0x6e16('0x21')](handleEntityNotFound(_0x316d0d,null))[_0x6e16('0x21')](saveUpdates(_0xf67443[_0x6e16('0x44')],null))[_0x6e16('0x21')](respondWithResult(_0x316d0d,null))[_0x6e16('0x3f')](handleError(_0x316d0d,null));};exports[_0x6e16('0x22')]=function(_0xc1f314,_0x2aface){return db[_0x6e16('0x28')][_0x6e16('0x45')]({'where':{'id':_0xc1f314[_0x6e16('0x41')]['id']}})[_0x6e16('0x21')](handleEntityNotFound(_0x2aface,null))['then'](removeEntity(_0x2aface,null))[_0x6e16('0x3f')](handleError(_0x2aface,null));}; \ No newline at end of file +var _0xc351=['Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','ServicenowField','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset'];(function(_0x10c2fd,_0x369c07){var _0x87f4d8=function(_0x411896){while(--_0x411896){_0x10c2fd['push'](_0x10c2fd['shift']());}};_0x87f4d8(++_0x369c07);}(_0xc351,0x6e));var _0x1c35=function(_0x4f8072,_0x490a73){_0x4f8072=_0x4f8072-0x0;var _0xb2d4ba=_0xc351[_0x4f8072];return _0xb2d4ba;};'use strict';var emlformat=require(_0x1c35('0x0'));var rimraf=require(_0x1c35('0x1'));var zipdir=require(_0x1c35('0x2'));var jsonpatch=require(_0x1c35('0x3'));var rp=require('request-promise');var moment=require(_0x1c35('0x4'));var BPromise=require(_0x1c35('0x5'));var Mustache=require(_0x1c35('0x6'));var util=require('util');var path=require(_0x1c35('0x7'));var sox=require(_0x1c35('0x8'));var csv=require('to-csv');var ejs=require(_0x1c35('0x9'));var fs=require('fs');var fs_extra=require(_0x1c35('0xa'));var _=require(_0x1c35('0xb'));var squel=require(_0x1c35('0xc'));var crypto=require('crypto');var jsforce=require(_0x1c35('0xd'));var deskjs=require(_0x1c35('0xe'));var toCsv=require(_0x1c35('0xf'));var querystring=require(_0x1c35('0x10'));var Papa=require(_0x1c35('0x11'));var Redis=require('ioredis');var authService=require(_0x1c35('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c35('0x13'));var logger=require('../../config/logger')(_0x1c35('0x14'));var utils=require(_0x1c35('0x15'));var config=require(_0x1c35('0x16'));var licenseUtil=require(_0x1c35('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x556662,_0x2540c4){_0x2540c4=_0x2540c4||0xcc;return function(_0xf0cc05){if(_0xf0cc05){return _0x556662[_0x1c35('0x18')](_0x2540c4);}return _0x556662[_0x1c35('0x19')](_0x2540c4)[_0x1c35('0x1a')]();};}function respondWithResult(_0x4ee09b,_0x1a0ea2){_0x1a0ea2=_0x1a0ea2||0xc8;return function(_0x57edf1){if(_0x57edf1){return _0x4ee09b['status'](_0x1a0ea2)[_0x1c35('0x1b')](_0x57edf1);}};}function respondWithFilteredResult(_0x54008b,_0x2f9f71){return function(_0x4bfa29){if(_0x4bfa29){var _0x3b2d6c=typeof _0x2f9f71['offset']==='undefined'&&typeof _0x2f9f71[_0x1c35('0x1c')]===_0x1c35('0x1d');var _0x48da77=_0x4bfa29[_0x1c35('0x1e')];var _0x411907=_0x3b2d6c?0x0:_0x2f9f71[_0x1c35('0x1f')];var _0x42dd51=_0x3b2d6c?_0x4bfa29[_0x1c35('0x1e')]:_0x2f9f71['offset']+_0x2f9f71[_0x1c35('0x1c')];var _0x1eb925;if(_0x42dd51>=_0x48da77){_0x42dd51=_0x48da77;_0x1eb925=0xc8;}else{_0x1eb925=0xce;}_0x54008b[_0x1c35('0x19')](_0x1eb925);return _0x54008b['set'](_0x1c35('0x20'),_0x411907+'-'+_0x42dd51+'/'+_0x48da77)['json'](_0x4bfa29);}return null;};}function patchUpdates(_0xedc810){return function(_0x32a37d){try{jsonpatch['apply'](_0x32a37d,_0xedc810,!![]);}catch(_0x401635){return BPromise[_0x1c35('0x21')](_0x401635);}return _0x32a37d[_0x1c35('0x22')]();};}function saveUpdates(_0x4dac22,_0x4424c2){return function(_0x4e79ed){if(_0x4e79ed){return _0x4e79ed[_0x1c35('0x23')](_0x4dac22)[_0x1c35('0x24')](function(_0xd7b748){return _0xd7b748;});}return null;};}function removeEntity(_0x1ee0fb,_0x3ac758){return function(_0x35df80){if(_0x35df80){return _0x35df80[_0x1c35('0x25')]()['then'](function(){_0x1ee0fb['status'](0xcc)[_0x1c35('0x1a')]();});}};}function handleEntityNotFound(_0x14183d,_0x84049d){return function(_0x25c4a1){if(!_0x25c4a1){_0x14183d['sendStatus'](0x194);}return _0x25c4a1;};}function handleError(_0x106c65,_0x5da879){_0x5da879=_0x5da879||0x1f4;return function(_0x466b16){logger['error'](_0x466b16[_0x1c35('0x26')]);if(_0x466b16[_0x1c35('0x27')]){delete _0x466b16[_0x1c35('0x27')];}_0x106c65[_0x1c35('0x19')](_0x5da879)[_0x1c35('0x28')](_0x466b16);};}exports[_0x1c35('0x29')]=function(_0x358aa9,_0x1a8313){var _0x2c32b8={},_0x3e41a5={},_0x4fa506={'count':0x0,'rows':[]};var _0x4ba4b5=_[_0x1c35('0x2a')](db[_0x1c35('0x2b')][_0x1c35('0x2c')],function(_0x8e57d8){return{'name':_0x8e57d8['fieldName'],'type':_0x8e57d8['type'][_0x1c35('0x2d')]};});_0x3e41a5['model']=_[_0x1c35('0x2a')](_0x4ba4b5,_0x1c35('0x27'));_0x3e41a5[_0x1c35('0x2e')]=_['keys'](_0x358aa9['query']);_0x3e41a5[_0x1c35('0x2f')]=_[_0x1c35('0x30')](_0x3e41a5[_0x1c35('0x31')],_0x3e41a5[_0x1c35('0x2e')]);_0x2c32b8[_0x1c35('0x32')]=_[_0x1c35('0x30')](_0x3e41a5[_0x1c35('0x31')],qs[_0x1c35('0x33')](_0x358aa9[_0x1c35('0x2e')]['fields']));_0x2c32b8['attributes']=_0x2c32b8[_0x1c35('0x32')][_0x1c35('0x34')]?_0x2c32b8[_0x1c35('0x32')]:_0x3e41a5[_0x1c35('0x31')];if(!_0x358aa9[_0x1c35('0x2e')][_0x1c35('0x35')](_0x1c35('0x36'))){_0x2c32b8[_0x1c35('0x1c')]=qs[_0x1c35('0x1c')](_0x358aa9[_0x1c35('0x2e')][_0x1c35('0x1c')]);_0x2c32b8[_0x1c35('0x1f')]=qs[_0x1c35('0x1f')](_0x358aa9[_0x1c35('0x2e')][_0x1c35('0x1f')]);}_0x2c32b8['order']=qs['sort'](_0x358aa9['query']['sort']);_0x2c32b8[_0x1c35('0x37')]=qs[_0x1c35('0x2f')](_[_0x1c35('0x38')](_0x358aa9[_0x1c35('0x2e')],_0x3e41a5[_0x1c35('0x2f')]),_0x4ba4b5);if(_0x358aa9[_0x1c35('0x2e')][_0x1c35('0x39')]){_0x2c32b8['where']=_['merge'](_0x2c32b8[_0x1c35('0x37')],{'$or':_[_0x1c35('0x2a')](_0x4ba4b5,function(_0x43d8d6){if(_0x43d8d6['type']!==_0x1c35('0x3a')){var _0x26f547={};_0x26f547[_0x43d8d6['name']]={'$like':'%'+_0x358aa9[_0x1c35('0x2e')]['filter']+'%'};return _0x26f547;}})});}_0x2c32b8=_['merge']({},_0x2c32b8,_0x358aa9[_0x1c35('0x3b')]);var _0x37e605={'where':_0x2c32b8['where']};return db[_0x1c35('0x2b')][_0x1c35('0x1e')](_0x37e605)[_0x1c35('0x24')](function(_0x4b3c9c){_0x4fa506['count']=_0x4b3c9c;if(_0x358aa9[_0x1c35('0x2e')][_0x1c35('0x3c')]){_0x2c32b8[_0x1c35('0x3d')]=[{'all':!![]}];}return db[_0x1c35('0x2b')]['findAll'](_0x2c32b8);})[_0x1c35('0x24')](function(_0x4a8adf){_0x4fa506[_0x1c35('0x3e')]=_0x4a8adf;return _0x4fa506;})[_0x1c35('0x24')](respondWithFilteredResult(_0x1a8313,_0x2c32b8))[_0x1c35('0x3f')](handleError(_0x1a8313,null));};exports[_0x1c35('0x40')]=function(_0x3e6836,_0x102bbb){var _0x226745={'raw':!![],'where':{'id':_0x3e6836[_0x1c35('0x41')]['id']}},_0x4e5137={};_0x4e5137['model']=_[_0x1c35('0x42')](db[_0x1c35('0x2b')][_0x1c35('0x2c')]);_0x4e5137['query']=_[_0x1c35('0x42')](_0x3e6836['query']);_0x4e5137[_0x1c35('0x2f')]=_[_0x1c35('0x30')](_0x4e5137[_0x1c35('0x31')],_0x4e5137['query']);_0x226745[_0x1c35('0x32')]=_[_0x1c35('0x30')](_0x4e5137[_0x1c35('0x31')],qs[_0x1c35('0x33')](_0x3e6836[_0x1c35('0x2e')][_0x1c35('0x33')]));_0x226745['attributes']=_0x226745[_0x1c35('0x32')][_0x1c35('0x34')]?_0x226745[_0x1c35('0x32')]:_0x4e5137[_0x1c35('0x31')];if(_0x3e6836[_0x1c35('0x2e')][_0x1c35('0x3c')]){_0x226745[_0x1c35('0x3d')]=[{'all':!![]}];}_0x226745=_[_0x1c35('0x43')]({},_0x226745,_0x3e6836[_0x1c35('0x3b')]);return db['ServicenowField'][_0x1c35('0x44')](_0x226745)[_0x1c35('0x24')](handleEntityNotFound(_0x102bbb,null))['then'](respondWithResult(_0x102bbb,null))[_0x1c35('0x3f')](handleError(_0x102bbb,null));};exports['create']=function(_0x28431a,_0x4e6840){return db[_0x1c35('0x2b')][_0x1c35('0x45')](_0x28431a[_0x1c35('0x46')],{})[_0x1c35('0x24')](respondWithResult(_0x4e6840,0xc9))[_0x1c35('0x3f')](handleError(_0x4e6840,null));};exports[_0x1c35('0x23')]=function(_0x3cff00,_0x341d58){if(_0x3cff00[_0x1c35('0x46')]['id']){delete _0x3cff00[_0x1c35('0x46')]['id'];}return db[_0x1c35('0x2b')][_0x1c35('0x44')]({'where':{'id':_0x3cff00[_0x1c35('0x41')]['id']}})[_0x1c35('0x24')](handleEntityNotFound(_0x341d58,null))['then'](saveUpdates(_0x3cff00[_0x1c35('0x46')],null))[_0x1c35('0x24')](respondWithResult(_0x341d58,null))['catch'](handleError(_0x341d58,null));};exports[_0x1c35('0x25')]=function(_0x2bbc28,_0x49fa86){return db[_0x1c35('0x2b')]['find']({'where':{'id':_0x2bbc28[_0x1c35('0x41')]['id']}})[_0x1c35('0x24')](handleEntityNotFound(_0x49fa86,null))[_0x1c35('0x24')](removeEntity(_0x49fa86,null))['catch'](handleError(_0x49fa86,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 0878f6f..ae2e73a 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 _0x6f0f=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','../../config/logger','api','bluebird','rimraf','../../config/environment','./intServicenowField.attributes','ServicenowField'];(function(_0x5b0f8a,_0x40d7a0){var _0xff6569=function(_0x117a13){while(--_0x117a13){_0x5b0f8a['push'](_0x5b0f8a['shift']());}};_0xff6569(++_0x40d7a0);}(_0x6f0f,0x88));var _0xf6f0=function(_0x845304,_0x154c0f){_0x845304=_0x845304-0x0;var _0x51c06d=_0x6f0f[_0x845304];return _0x51c06d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf6f0('0x0'))(_0xf6f0('0x1'));var moment=require('moment');var BPromise=require(_0xf6f0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf6f0('0x3'));var config=require(_0xf6f0('0x4'));var attributes=require(_0xf6f0('0x5'));module['exports']=function(_0x5372e7,_0x36359b){return _0x5372e7['define'](_0xf6f0('0x6'),attributes,{'tableName':_0xf6f0('0x7'),'paranoid':![],'indexes':[{'name':_0xf6f0('0x8'),'fields':[_0xf6f0('0x9'),_0xf6f0('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x971a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','util'];(function(_0x55a205,_0x290468){var _0x2639f1=function(_0x46dd2a){while(--_0x46dd2a){_0x55a205['push'](_0x55a205['shift']());}};_0x2639f1(++_0x290468);}(_0x971a,0x184));var _0xa971=function(_0x115a89,_0x24c57d){_0x115a89=_0x115a89-0x0;var _0x5945d9=_0x971a[_0x115a89];return _0x5945d9;};'use strict';var _=require(_0xa971('0x0'));var util=require(_0xa971('0x1'));var logger=require(_0xa971('0x2'))(_0xa971('0x3'));var moment=require(_0xa971('0x4'));var BPromise=require(_0xa971('0x5'));var rp=require(_0xa971('0x6'));var fs=require('fs');var path=require(_0xa971('0x7'));var rimraf=require(_0xa971('0x8'));var config=require('../../config/environment');var attributes=require(_0xa971('0x9'));module[_0xa971('0xa')]=function(_0x8afa,_0x4ee78d){return _0x8afa['define'](_0xa971('0xb'),attributes,{'tableName':_0xa971('0xc'),'paranoid':![],'indexes':[{'name':_0xa971('0xd'),'fields':[_0xa971('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 30962fb..a5dc927 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 _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4faa58,_0x23b9f8){var _0x5474ff=function(_0x48a1cb){while(--_0x48a1cb){_0x4faa58['push'](_0x4faa58['shift']());}};_0x5474ff(++_0x23b9f8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x547a55,_0x501f7e){var _0x29edd4=function(_0x5d2406){while(--_0x5d2406){_0x547a55['push'](_0x547a55['shift']());}};_0x29edd4(++_0x501f7e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0xcb91[_0x4d8a8f];return _0xfc4adc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 7e7bac3..f66e3cb 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(_0x2b78ab,_0x71efdf){var _0x59a3ec=function(_0x53f8df){while(--_0x53f8df){_0x2b78ab['push'](_0x2b78ab['shift']());}};_0x59a3ec(++_0x71efdf);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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(_0x40cf6a,_0x5e1e75){var _0x3b576b=function(_0x476d1d){while(--_0x476d1d){_0x40cf6a['push'](_0x40cf6a['shift']());}};_0x3b576b(++_0x5e1e75);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 55b2fdd..216efcf 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(_0x2a5b1e,_0x46af12){var _0x2387cf=function(_0x4465ab){while(--_0x4465ab){_0x2a5b1e['push'](_0x2a5b1e['shift']());}};_0x2387cf(++_0x46af12);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x354b2a,_0x4f8201){var _0xa57840=function(_0x48ee15){while(--_0x48ee15){_0x354b2a['push'](_0x354b2a['shift']());}};_0xa57840(++_0x4f8201);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 4e883dd..f5342f6 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 _0xdb75=['length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','intersection','include','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','includes','label','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','SugarcrmAccount','type','key','model','map','query','attributes','fields'];(function(_0x54c94b,_0x31b163){var _0x1852f3=function(_0x456399){while(--_0x456399){_0x54c94b['push'](_0x54c94b['shift']());}};_0x1852f3(++_0x31b163);}(_0xdb75,0x1ac));var _0x5db7=function(_0x4b66e8,_0x33f1f2){_0x4b66e8=_0x4b66e8-0x0;var _0x28ff72=_0xdb75[_0x4b66e8];return _0x28ff72;};'use strict';var emlformat=require(_0x5db7('0x0'));var rimraf=require(_0x5db7('0x1'));var zipdir=require(_0x5db7('0x2'));var jsonpatch=require(_0x5db7('0x3'));var rp=require(_0x5db7('0x4'));var moment=require(_0x5db7('0x5'));var BPromise=require(_0x5db7('0x6'));var Mustache=require(_0x5db7('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5db7('0x8'));var csv=require(_0x5db7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5db7('0xa'));var _=require(_0x5db7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5db7('0x9'));var querystring=require(_0x5db7('0xc'));var Papa=require(_0x5db7('0xd'));var Redis=require('ioredis');var authService=require(_0x5db7('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5db7('0xf'));var hardwareService=require(_0x5db7('0x10'));var logger=require(_0x5db7('0x11'))('api');var utils=require(_0x5db7('0x12'));var config=require(_0x5db7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5db7('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4adddd,_0x5110b3){_0x5110b3=_0x5110b3||0xcc;return function(_0x21ca29){if(_0x21ca29){return _0x4adddd[_0x5db7('0x15')](_0x5110b3);}return _0x4adddd['status'](_0x5110b3)[_0x5db7('0x16')]();};}function respondWithResult(_0x1aea75,_0xc3eea0){_0xc3eea0=_0xc3eea0||0xc8;return function(_0x191ee0){if(_0x191ee0){return _0x1aea75[_0x5db7('0x17')](_0xc3eea0)[_0x5db7('0x18')](_0x191ee0);}};}function respondWithFilteredResult(_0x3fb145,_0x2092be){return function(_0x3a70df){if(_0x3a70df){var _0x5b051d=typeof _0x2092be[_0x5db7('0x19')]===_0x5db7('0x1a')&&typeof _0x2092be[_0x5db7('0x1b')]===_0x5db7('0x1a');var _0x850d1e=_0x3a70df['count'];var _0x1ce748=_0x5b051d?0x0:_0x2092be[_0x5db7('0x19')];var _0x7e6f69=_0x5b051d?_0x3a70df[_0x5db7('0x1c')]:_0x2092be[_0x5db7('0x19')]+_0x2092be['limit'];var _0x12df3e;if(_0x7e6f69>=_0x850d1e){_0x7e6f69=_0x850d1e;_0x12df3e=0xc8;}else{_0x12df3e=0xce;}_0x3fb145[_0x5db7('0x17')](_0x12df3e);return _0x3fb145[_0x5db7('0x1d')](_0x5db7('0x1e'),_0x1ce748+'-'+_0x7e6f69+'/'+_0x850d1e)[_0x5db7('0x18')](_0x3a70df);}return null;};}function patchUpdates(_0x1663d1){return function(_0x5a4708){try{jsonpatch[_0x5db7('0x1f')](_0x5a4708,_0x1663d1,!![]);}catch(_0x1b8001){return BPromise['reject'](_0x1b8001);}return _0x5a4708['save']();};}function saveUpdates(_0x201fdb,_0x60de52){return function(_0xc69526){if(_0xc69526){return _0xc69526[_0x5db7('0x20')](_0x201fdb)['then'](function(_0xfe336d){return _0xfe336d;});}return null;};}function removeEntity(_0x423a78,_0x196c94){return function(_0xd74ca6){if(_0xd74ca6){return _0xd74ca6[_0x5db7('0x21')]()[_0x5db7('0x22')](function(){_0x423a78[_0x5db7('0x17')](0xcc)[_0x5db7('0x16')]();});}};}function handleEntityNotFound(_0x29aee3,_0x58f4a1){return function(_0x5a9222){if(!_0x5a9222){_0x29aee3[_0x5db7('0x15')](0x194);}return _0x5a9222;};}function handleError(_0x32a0df,_0x1749cc){_0x1749cc=_0x1749cc||0x1f4;return function(_0x24246f){logger[_0x5db7('0x23')](_0x24246f[_0x5db7('0x24')]);if(_0x24246f['name']){delete _0x24246f[_0x5db7('0x25')];}_0x32a0df[_0x5db7('0x17')](_0x1749cc)[_0x5db7('0x26')](_0x24246f);};}exports[_0x5db7('0x27')]=function(_0x15eacc,_0x451e35){var _0x3bb386={},_0x2b4af0={},_0x403870={'count':0x0,'rows':[]};var _0x3872fd=_['map'](db[_0x5db7('0x28')]['rawAttributes'],function(_0x10df46){return{'name':_0x10df46['fieldName'],'type':_0x10df46[_0x5db7('0x29')][_0x5db7('0x2a')]};});_0x2b4af0[_0x5db7('0x2b')]=_[_0x5db7('0x2c')](_0x3872fd,'name');_0x2b4af0[_0x5db7('0x2d')]=_['keys'](_0x15eacc['query']);_0x2b4af0['filters']=_['intersection'](_0x2b4af0[_0x5db7('0x2b')],_0x2b4af0[_0x5db7('0x2d')]);_0x3bb386[_0x5db7('0x2e')]=_['intersection'](_0x2b4af0[_0x5db7('0x2b')],qs[_0x5db7('0x2f')](_0x15eacc[_0x5db7('0x2d')][_0x5db7('0x2f')]));_0x3bb386['attributes']=_0x3bb386[_0x5db7('0x2e')][_0x5db7('0x30')]?_0x3bb386[_0x5db7('0x2e')]:_0x2b4af0[_0x5db7('0x2b')];if(!_0x15eacc[_0x5db7('0x2d')]['hasOwnProperty'](_0x5db7('0x31'))){_0x3bb386['limit']=qs[_0x5db7('0x1b')](_0x15eacc[_0x5db7('0x2d')][_0x5db7('0x1b')]);_0x3bb386['offset']=qs[_0x5db7('0x19')](_0x15eacc[_0x5db7('0x2d')][_0x5db7('0x19')]);}_0x3bb386[_0x5db7('0x32')]=qs[_0x5db7('0x33')](_0x15eacc['query'][_0x5db7('0x33')]);_0x3bb386[_0x5db7('0x34')]=qs[_0x5db7('0x35')](_[_0x5db7('0x36')](_0x15eacc[_0x5db7('0x2d')],_0x2b4af0[_0x5db7('0x35')]),_0x3872fd);if(_0x15eacc['query']['filter']){_0x3bb386[_0x5db7('0x34')]=_[_0x5db7('0x37')](_0x3bb386[_0x5db7('0x34')],{'$or':_[_0x5db7('0x2c')](_0x3872fd,function(_0x331363){if(_0x331363['type']!==_0x5db7('0x38')){var _0x382ea5={};_0x382ea5[_0x331363[_0x5db7('0x25')]]={'$like':'%'+_0x15eacc['query'][_0x5db7('0x39')]+'%'};return _0x382ea5;}})});}_0x3bb386=_['merge']({},_0x3bb386,_0x15eacc[_0x5db7('0x3a')]);var _0x98e20c={'where':_0x3bb386[_0x5db7('0x34')]};return db[_0x5db7('0x28')][_0x5db7('0x1c')](_0x98e20c)['then'](function(_0x27f77e){_0x403870[_0x5db7('0x1c')]=_0x27f77e;if(_0x15eacc[_0x5db7('0x2d')][_0x5db7('0x3b')]){_0x3bb386['include']=[{'all':!![]}];}return db[_0x5db7('0x28')][_0x5db7('0x3c')](_0x3bb386);})[_0x5db7('0x22')](function(_0x52f399){_0x403870[_0x5db7('0x3d')]=_0x52f399;return _0x403870;})['then'](respondWithFilteredResult(_0x451e35,_0x3bb386))[_0x5db7('0x3e')](handleError(_0x451e35,null));};exports[_0x5db7('0x3f')]=function(_0x1954ad,_0x1ffd63){var _0x4f4c29={'raw':![],'where':{'id':_0x1954ad[_0x5db7('0x40')]['id']}},_0x4e1078={};_0x4e1078['model']=_[_0x5db7('0x41')](db[_0x5db7('0x28')][_0x5db7('0x42')]);_0x4e1078['query']=_['keys'](_0x1954ad['query']);_0x4e1078[_0x5db7('0x35')]=_[_0x5db7('0x43')](_0x4e1078[_0x5db7('0x2b')],_0x4e1078[_0x5db7('0x2d')]);_0x4f4c29[_0x5db7('0x2e')]=_[_0x5db7('0x43')](_0x4e1078[_0x5db7('0x2b')],qs[_0x5db7('0x2f')](_0x1954ad[_0x5db7('0x2d')]['fields']));_0x4f4c29[_0x5db7('0x2e')]=_0x4f4c29[_0x5db7('0x2e')][_0x5db7('0x30')]?_0x4f4c29[_0x5db7('0x2e')]:_0x4e1078[_0x5db7('0x2b')];if(_0x1954ad['query'][_0x5db7('0x3b')]){_0x4f4c29[_0x5db7('0x44')]=[{'all':!![]}];}_0x4f4c29=_['merge']({},_0x4f4c29,_0x1954ad[_0x5db7('0x3a')]);return db[_0x5db7('0x28')][_0x5db7('0x45')](_0x4f4c29)[_0x5db7('0x22')](handleEntityNotFound(_0x1ffd63,null))[_0x5db7('0x22')](respondWithResult(_0x1ffd63,null))[_0x5db7('0x3e')](handleError(_0x1ffd63,null));};exports[_0x5db7('0x46')]=function(_0x50833c,_0x11189c){return db['SugarcrmAccount']['create'](_0x50833c[_0x5db7('0x47')],{})['then'](respondWithResult(_0x11189c,0xc9))['catch'](handleError(_0x11189c,null));};exports[_0x5db7('0x20')]=function(_0x4e61a8,_0x4627e5){if(_0x4e61a8['body']['id']){delete _0x4e61a8[_0x5db7('0x47')]['id'];}return db[_0x5db7('0x28')][_0x5db7('0x45')]({'where':{'id':_0x4e61a8['params']['id']}})[_0x5db7('0x22')](handleEntityNotFound(_0x4627e5,null))[_0x5db7('0x22')](saveUpdates(_0x4e61a8[_0x5db7('0x47')],null))['then'](respondWithResult(_0x4627e5,null))[_0x5db7('0x3e')](handleError(_0x4627e5,null));};exports[_0x5db7('0x21')]=function(_0x4557e6,_0x140491){return db[_0x5db7('0x28')][_0x5db7('0x45')]({'where':{'id':_0x4557e6['params']['id']}})['then'](handleEntityNotFound(_0x140491,null))[_0x5db7('0x22')](removeEntity(_0x140491,null))[_0x5db7('0x3e')](handleError(_0x140491,null));};exports[_0x5db7('0x48')]=function(_0x780c47,_0x28bde3,_0x943211){var _0x176e87={};var _0xce1f33={};var _0x218ef8;var _0x176436;return db['SugarcrmAccount'][_0x5db7('0x49')]({'where':{'id':_0x780c47[_0x5db7('0x40')]['id']}})['then'](handleEntityNotFound(_0x28bde3,null))[_0x5db7('0x22')](function(_0x8a4c9c){if(_0x8a4c9c){_0x218ef8=_0x8a4c9c;_0xce1f33[_0x5db7('0x2b')]=_[_0x5db7('0x41')](db[_0x5db7('0x4a')][_0x5db7('0x42')]);_0xce1f33['query']=_[_0x5db7('0x41')](_0x780c47[_0x5db7('0x2d')]);_0xce1f33[_0x5db7('0x35')]=_[_0x5db7('0x43')](_0xce1f33[_0x5db7('0x2b')],_0xce1f33[_0x5db7('0x2d')]);_0x176e87[_0x5db7('0x2e')]=_['intersection'](_0xce1f33[_0x5db7('0x2b')],qs[_0x5db7('0x2f')](_0x780c47[_0x5db7('0x2d')][_0x5db7('0x2f')]));_0x176e87[_0x5db7('0x2e')]=_0x176e87['attributes'][_0x5db7('0x30')]?_0x176e87[_0x5db7('0x2e')]:_0xce1f33['model'];_0x176e87[_0x5db7('0x32')]=qs[_0x5db7('0x33')](_0x780c47[_0x5db7('0x2d')][_0x5db7('0x33')]);_0x176e87[_0x5db7('0x34')]=qs[_0x5db7('0x35')](_[_0x5db7('0x36')](_0x780c47[_0x5db7('0x2d')],_0xce1f33[_0x5db7('0x35')]));if(_0x780c47[_0x5db7('0x2d')][_0x5db7('0x39')]){_0x176e87['where']=_[_0x5db7('0x37')](_0x176e87[_0x5db7('0x34')],{'$or':_[_0x5db7('0x2c')](_0x176e87['attributes'],function(_0x197efe){var _0x2eab76={};_0x2eab76[_0x197efe]={'$like':'%'+_0x780c47[_0x5db7('0x2d')][_0x5db7('0x39')]+'%'};return _0x2eab76;})});}_0x176e87=_[_0x5db7('0x37')]({},_0x176e87,_0x780c47[_0x5db7('0x3a')]);return _0x218ef8[_0x5db7('0x48')](_0x176e87);}})[_0x5db7('0x22')](function(_0x3dc56f){if(_0x3dc56f){_0x176436=_0x3dc56f[_0x5db7('0x30')];if(!_0x780c47[_0x5db7('0x2d')][_0x5db7('0x4b')]('nolimit')){_0x176e87['limit']=qs[_0x5db7('0x1b')](_0x780c47['query'][_0x5db7('0x1b')]);_0x176e87[_0x5db7('0x19')]=qs[_0x5db7('0x19')](_0x780c47[_0x5db7('0x2d')][_0x5db7('0x19')]);}return _0x218ef8['getConfigurations'](_0x176e87);}})[_0x5db7('0x22')](function(_0x2a9cc9){if(_0x2a9cc9){return _0x2a9cc9?{'count':_0x176436,'rows':_0x2a9cc9}:null;}})[_0x5db7('0x22')](respondWithResult(_0x28bde3,null))[_0x5db7('0x3e')](handleError(_0x28bde3,null));};exports[_0x5db7('0x4c')]=function(_0x2ce1b4,_0x102671,_0x31afde){if(_0x2ce1b4[_0x5db7('0x47')]['id']){delete _0x2ce1b4[_0x5db7('0x47')]['id'];}return db[_0x5db7('0x28')][_0x5db7('0x49')]({'where':{'id':_0x2ce1b4[_0x5db7('0x40')]['id']}})[_0x5db7('0x22')](handleEntityNotFound(_0x102671,null))[_0x5db7('0x22')](function(_0x6a2a51){if(_0x6a2a51){_0x2ce1b4['body'][_0x5db7('0x4d')]=_0x6a2a51['id'];_0x2ce1b4[_0x5db7('0x47')]['Subjects']=integrations[_0x5db7('0x4e')](_0x2ce1b4[_0x5db7('0x47')][_0x5db7('0x4f')],_0x2ce1b4[_0x5db7('0x47')]['type']);_0x2ce1b4[_0x5db7('0x47')][_0x5db7('0x50')]=integrations[_0x5db7('0x51')](_0x2ce1b4[_0x5db7('0x47')][_0x5db7('0x4f')],_0x2ce1b4[_0x5db7('0x47')][_0x5db7('0x29')]);return db[_0x5db7('0x4a')]['create'](_0x2ce1b4[_0x5db7('0x47')],{'include':[{'model':db[_0x5db7('0x52')],'as':_0x5db7('0x53')},{'model':db['SugarcrmField'],'as':_0x5db7('0x50')}]});}return null;})['then'](respondWithResult(_0x102671,null))[_0x5db7('0x3e')](handleError(_0x102671,null));};exports['getFields']=function(_0x46652e,_0xa0dd20,_0x1b0182){var _0x5eb25e='';var _0xdf5e66=['id','name','assigned_user_id','created_by',_0x5db7('0x54'),_0x5db7('0x55'),_0x5db7('0x56'),_0x5db7('0x57'),_0x5db7('0x58'),_0x5db7('0x59'),_0x5db7('0x5a'),_0x5db7('0x5b')];return db[_0x5db7('0x28')][_0x5db7('0x49')]({'where':{'id':_0x46652e[_0x5db7('0x40')]['id']},'attributes':['id',_0x5db7('0x5c'),_0x5db7('0x5d'),_0x5db7('0x5e')]})['then'](handleEntityNotFound(_0xa0dd20,null))[_0x5db7('0x22')](function(_0x40ea67){if(_0x40ea67){_0x5eb25e=_0x40ea67[_0x5db7('0x5e')];var _0x23b9e9=_0x5eb25e[_0x5db7('0x5f')](-0x1);if(_0x23b9e9==='/'){_0x5eb25e=_0x5eb25e[_0x5db7('0x60')](0x0,_0x5eb25e[_0x5db7('0x61')](_0x23b9e9));}return rp({'method':_0x5db7('0x62'),'uri':util[_0x5db7('0x63')](_0x5db7('0x64'),_0x5eb25e,_0x5db7('0x65')),'json':!![],'form':{'method':'login','input_type':_0x5db7('0x66'),'response_type':_0x5db7('0x66'),'rest_data':JSON[_0x5db7('0x67')]({'user_auth':{'user_name':_0x40ea67[_0x5db7('0x5c')],'password':_0x40ea67['password'],'encryption':'PLAIN'},'application':_0x5db7('0x68')})}});}})[_0x5db7('0x22')](function(_0x4508d5){if(_0x4508d5&&_0x4508d5[_0x5db7('0x25')]!==_0x5db7('0x69')&&_0x4508d5[_0x5db7('0x25')]!==_0x5db7('0x6a')){return rp({'method':_0x5db7('0x62'),'uri':util[_0x5db7('0x63')](_0x5db7('0x64'),_0x5eb25e,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x5db7('0x6b'),'input_type':_0x5db7('0x66'),'response_type':_0x5db7('0x66'),'rest_data':JSON[_0x5db7('0x67')]({'session':_0x4508d5['id'],'module_name':_0x5db7('0x6c')})}})[_0x5db7('0x22')](function(_0x3e373b){if(_0x3e373b){var _0x4e00b6=_[_0x5db7('0x6d')](_0x3e373b[_0x5db7('0x6e')]);_['remove'](_0x4e00b6,function(_0x2caf4c){return _0xdf5e66[_0x5db7('0x6f')](_0x2caf4c[_0x5db7('0x25')]);});return{'count':_0x4e00b6[_0x5db7('0x30')],'rows':_[_0x5db7('0x2c')](_0x4e00b6,function(_0x211e50){return{'id':_0x211e50[_0x5db7('0x25')],'name':_0x211e50[_0x5db7('0x70')],'custom':_[_0x5db7('0x71')](_0x211e50['name'],'_c')?!![]:![],'options':_0x211e50[_0x5db7('0x3a')]?_[_0x5db7('0x2c')](_[_0x5db7('0x6d')](_0x211e50[_0x5db7('0x3a')]),function(_0x293daf){return{'name':_0x293daf[_0x5db7('0x72')],'value':_0x293daf[_0x5db7('0x25')]};}):[]};})};}})[_0x5db7('0x22')](respondWithResult(_0xa0dd20,null))[_0x5db7('0x3e')](function(_0x29d2e0){var _0xefea9b=_0x46652e[_0x5db7('0x2d')][_0x5db7('0x73')]?0x1f4:_0x29d2e0['statusCode']||0x1f4;logger['error'](_0x5db7('0x74'),_0x5db7('0x75'),_0xefea9b,JSON[_0x5db7('0x67')](_0x29d2e0));delete _0x29d2e0['name'];if(_0xefea9b===0x191){_0xefea9b=0x190;}_0xa0dd20['status'](_0xefea9b)[_0x5db7('0x26')](_0x46652e[_0x5db7('0x2d')][_0x5db7('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x29d2e0['statusCode']}:_0x29d2e0);});}else{var _0x7d408=0x1f4;_0xa0dd20[_0x5db7('0x17')](_0x7d408)['send']({'message':_0x5db7('0x76'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xb5ba=['sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','reject','save','update','destroy','then','stack','name','send','SugarcrmAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','sort','where','pick','merge','map','VIRTUAL','filter','findAll','catch','show','params','rawAttributes','length','includeAll','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','options','hasOwnProperty','nolimit','channel','getDescriptions','Subjects','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','Invalid\x20Login','Password\x20Expired','get_module_fields','stringify','values','remove','includes','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x33f7a5,_0x478baf){var _0x4f258d=function(_0x4a4caf){while(--_0x4a4caf){_0x33f7a5['push'](_0x33f7a5['shift']());}};_0x4f258d(++_0x478baf);}(_0xb5ba,0x69));var _0xab5b=function(_0x5bd1a9,_0x313714){_0x5bd1a9=_0x5bd1a9-0x0;var _0x2ba345=_0xb5ba[_0x5bd1a9];return _0x2ba345;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab5b('0x0'));var zipdir=require(_0xab5b('0x1'));var jsonpatch=require(_0xab5b('0x2'));var rp=require(_0xab5b('0x3'));var moment=require('moment');var BPromise=require(_0xab5b('0x4'));var Mustache=require(_0xab5b('0x5'));var util=require(_0xab5b('0x6'));var path=require('path');var sox=require(_0xab5b('0x7'));var csv=require(_0xab5b('0x8'));var ejs=require(_0xab5b('0x9'));var fs=require('fs');var fs_extra=require(_0xab5b('0xa'));var _=require('lodash');var squel=require(_0xab5b('0xb'));var crypto=require(_0xab5b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xab5b('0xd'));var toCsv=require(_0xab5b('0x8'));var querystring=require('querystring');var Papa=require(_0xab5b('0xe'));var Redis=require(_0xab5b('0xf'));var authService=require(_0xab5b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xab5b('0x11'));var hardwareService=require(_0xab5b('0x12'));var logger=require(_0xab5b('0x13'))('api');var utils=require(_0xab5b('0x14'));var config=require(_0xab5b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xab5b('0x16'))['db'];var integrations=require(_0xab5b('0x17'));function respondWithStatusCode(_0x204f7d,_0x26414c){_0x26414c=_0x26414c||0xcc;return function(_0x354a57){if(_0x354a57){return _0x204f7d[_0xab5b('0x18')](_0x26414c);}return _0x204f7d['status'](_0x26414c)[_0xab5b('0x19')]();};}function respondWithResult(_0x2a8f6e,_0x3938f2){_0x3938f2=_0x3938f2||0xc8;return function(_0x10d10c){if(_0x10d10c){return _0x2a8f6e[_0xab5b('0x1a')](_0x3938f2)[_0xab5b('0x1b')](_0x10d10c);}};}function respondWithFilteredResult(_0x3d3a0d,_0x12da2d){return function(_0x43e2e9){if(_0x43e2e9){var _0x4a7f34=typeof _0x12da2d['offset']===_0xab5b('0x1c')&&typeof _0x12da2d[_0xab5b('0x1d')]===_0xab5b('0x1c');var _0x3b8177=_0x43e2e9[_0xab5b('0x1e')];var _0x1cedf2=_0x4a7f34?0x0:_0x12da2d[_0xab5b('0x1f')];var _0x328946=_0x4a7f34?_0x43e2e9['count']:_0x12da2d[_0xab5b('0x1f')]+_0x12da2d[_0xab5b('0x1d')];var _0x48aa46;if(_0x328946>=_0x3b8177){_0x328946=_0x3b8177;_0x48aa46=0xc8;}else{_0x48aa46=0xce;}_0x3d3a0d[_0xab5b('0x1a')](_0x48aa46);return _0x3d3a0d['set']('Content-Range',_0x1cedf2+'-'+_0x328946+'/'+_0x3b8177)['json'](_0x43e2e9);}return null;};}function patchUpdates(_0x4c6fcd){return function(_0x405c54){try{jsonpatch['apply'](_0x405c54,_0x4c6fcd,!![]);}catch(_0xd4c295){return BPromise[_0xab5b('0x20')](_0xd4c295);}return _0x405c54[_0xab5b('0x21')]();};}function saveUpdates(_0x2217be,_0x329edb){return function(_0x5a7cc7){if(_0x5a7cc7){return _0x5a7cc7[_0xab5b('0x22')](_0x2217be)['then'](function(_0x2c0a46){return _0x2c0a46;});}return null;};}function removeEntity(_0xf3bcdb,_0x512179){return function(_0x3df50a){if(_0x3df50a){return _0x3df50a[_0xab5b('0x23')]()[_0xab5b('0x24')](function(){_0xf3bcdb['status'](0xcc)[_0xab5b('0x19')]();});}};}function handleEntityNotFound(_0x61ccde,_0x351782){return function(_0x2b6ba4){if(!_0x2b6ba4){_0x61ccde[_0xab5b('0x18')](0x194);}return _0x2b6ba4;};}function handleError(_0x19d55c,_0x2d26a8){_0x2d26a8=_0x2d26a8||0x1f4;return function(_0x3cb638){logger['error'](_0x3cb638[_0xab5b('0x25')]);if(_0x3cb638['name']){delete _0x3cb638[_0xab5b('0x26')];}_0x19d55c[_0xab5b('0x1a')](_0x2d26a8)[_0xab5b('0x27')](_0x3cb638);};}exports['index']=function(_0x3dcc79,_0x240b03){var _0x30c005={},_0x3b3ea5={},_0x1cd418={'count':0x0,'rows':[]};var _0x3f6124=_['map'](db[_0xab5b('0x28')]['rawAttributes'],function(_0x232b54){return{'name':_0x232b54[_0xab5b('0x29')],'type':_0x232b54[_0xab5b('0x2a')]['key']};});_0x3b3ea5[_0xab5b('0x2b')]=_['map'](_0x3f6124,_0xab5b('0x26'));_0x3b3ea5[_0xab5b('0x2c')]=_[_0xab5b('0x2d')](_0x3dcc79[_0xab5b('0x2c')]);_0x3b3ea5[_0xab5b('0x2e')]=_[_0xab5b('0x2f')](_0x3b3ea5[_0xab5b('0x2b')],_0x3b3ea5[_0xab5b('0x2c')]);_0x30c005[_0xab5b('0x30')]=_[_0xab5b('0x2f')](_0x3b3ea5['model'],qs['fields'](_0x3dcc79[_0xab5b('0x2c')][_0xab5b('0x31')]));_0x30c005[_0xab5b('0x30')]=_0x30c005['attributes']['length']?_0x30c005['attributes']:_0x3b3ea5[_0xab5b('0x2b')];if(!_0x3dcc79[_0xab5b('0x2c')]['hasOwnProperty']('nolimit')){_0x30c005[_0xab5b('0x1d')]=qs[_0xab5b('0x1d')](_0x3dcc79[_0xab5b('0x2c')][_0xab5b('0x1d')]);_0x30c005[_0xab5b('0x1f')]=qs['offset'](_0x3dcc79[_0xab5b('0x2c')][_0xab5b('0x1f')]);}_0x30c005['order']=qs[_0xab5b('0x32')](_0x3dcc79['query'][_0xab5b('0x32')]);_0x30c005[_0xab5b('0x33')]=qs[_0xab5b('0x2e')](_[_0xab5b('0x34')](_0x3dcc79['query'],_0x3b3ea5[_0xab5b('0x2e')]),_0x3f6124);if(_0x3dcc79[_0xab5b('0x2c')]['filter']){_0x30c005['where']=_[_0xab5b('0x35')](_0x30c005[_0xab5b('0x33')],{'$or':_[_0xab5b('0x36')](_0x3f6124,function(_0x27b9bd){if(_0x27b9bd[_0xab5b('0x2a')]!==_0xab5b('0x37')){var _0x7f37cd={};_0x7f37cd[_0x27b9bd['name']]={'$like':'%'+_0x3dcc79[_0xab5b('0x2c')][_0xab5b('0x38')]+'%'};return _0x7f37cd;}})});}_0x30c005=_['merge']({},_0x30c005,_0x3dcc79['options']);var _0x2021a6={'where':_0x30c005['where']};return db['SugarcrmAccount'][_0xab5b('0x1e')](_0x2021a6)[_0xab5b('0x24')](function(_0x2cbe4c){_0x1cd418[_0xab5b('0x1e')]=_0x2cbe4c;if(_0x3dcc79[_0xab5b('0x2c')]['includeAll']){_0x30c005['include']=[{'all':!![]}];}return db[_0xab5b('0x28')][_0xab5b('0x39')](_0x30c005);})[_0xab5b('0x24')](function(_0x5a0962){_0x1cd418['rows']=_0x5a0962;return _0x1cd418;})[_0xab5b('0x24')](respondWithFilteredResult(_0x240b03,_0x30c005))[_0xab5b('0x3a')](handleError(_0x240b03,null));};exports[_0xab5b('0x3b')]=function(_0x22c78c,_0x166d52){var _0x1492ab={'raw':![],'where':{'id':_0x22c78c[_0xab5b('0x3c')]['id']}},_0x1025c8={};_0x1025c8[_0xab5b('0x2b')]=_[_0xab5b('0x2d')](db[_0xab5b('0x28')][_0xab5b('0x3d')]);_0x1025c8[_0xab5b('0x2c')]=_['keys'](_0x22c78c[_0xab5b('0x2c')]);_0x1025c8[_0xab5b('0x2e')]=_[_0xab5b('0x2f')](_0x1025c8['model'],_0x1025c8[_0xab5b('0x2c')]);_0x1492ab[_0xab5b('0x30')]=_[_0xab5b('0x2f')](_0x1025c8['model'],qs[_0xab5b('0x31')](_0x22c78c[_0xab5b('0x2c')][_0xab5b('0x31')]));_0x1492ab[_0xab5b('0x30')]=_0x1492ab[_0xab5b('0x30')][_0xab5b('0x3e')]?_0x1492ab[_0xab5b('0x30')]:_0x1025c8[_0xab5b('0x2b')];if(_0x22c78c[_0xab5b('0x2c')][_0xab5b('0x3f')]){_0x1492ab['include']=[{'all':!![]}];}_0x1492ab=_['merge']({},_0x1492ab,_0x22c78c['options']);return db[_0xab5b('0x28')]['find'](_0x1492ab)['then'](handleEntityNotFound(_0x166d52,null))['then'](respondWithResult(_0x166d52,null))[_0xab5b('0x3a')](handleError(_0x166d52,null));};exports['create']=function(_0x5da224,_0x2a7c15){return db[_0xab5b('0x28')][_0xab5b('0x40')](_0x5da224['body'],{})[_0xab5b('0x24')](respondWithResult(_0x2a7c15,0xc9))['catch'](handleError(_0x2a7c15,null));};exports[_0xab5b('0x22')]=function(_0x2fc7c9,_0x225fb4){if(_0x2fc7c9['body']['id']){delete _0x2fc7c9['body']['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x2fc7c9[_0xab5b('0x3c')]['id']}})[_0xab5b('0x24')](handleEntityNotFound(_0x225fb4,null))[_0xab5b('0x24')](saveUpdates(_0x2fc7c9[_0xab5b('0x41')],null))['then'](respondWithResult(_0x225fb4,null))[_0xab5b('0x3a')](handleError(_0x225fb4,null));};exports[_0xab5b('0x23')]=function(_0x4e668d,_0x2f5366){return db[_0xab5b('0x28')][_0xab5b('0x42')]({'where':{'id':_0x4e668d[_0xab5b('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2f5366,null))[_0xab5b('0x24')](removeEntity(_0x2f5366,null))[_0xab5b('0x3a')](handleError(_0x2f5366,null));};exports[_0xab5b('0x43')]=function(_0x2344d4,_0x5745fa,_0x4e1ce4){var _0x2a4221={};var _0xb8c40c={};var _0x282569;var _0x4c2979;return db[_0xab5b('0x28')][_0xab5b('0x44')]({'where':{'id':_0x2344d4['params']['id']}})[_0xab5b('0x24')](handleEntityNotFound(_0x5745fa,null))[_0xab5b('0x24')](function(_0x3691ec){if(_0x3691ec){_0x282569=_0x3691ec;_0xb8c40c[_0xab5b('0x2b')]=_[_0xab5b('0x2d')](db[_0xab5b('0x45')][_0xab5b('0x3d')]);_0xb8c40c[_0xab5b('0x2c')]=_[_0xab5b('0x2d')](_0x2344d4[_0xab5b('0x2c')]);_0xb8c40c[_0xab5b('0x2e')]=_[_0xab5b('0x2f')](_0xb8c40c[_0xab5b('0x2b')],_0xb8c40c[_0xab5b('0x2c')]);_0x2a4221['attributes']=_[_0xab5b('0x2f')](_0xb8c40c[_0xab5b('0x2b')],qs[_0xab5b('0x31')](_0x2344d4['query']['fields']));_0x2a4221[_0xab5b('0x30')]=_0x2a4221['attributes']['length']?_0x2a4221[_0xab5b('0x30')]:_0xb8c40c[_0xab5b('0x2b')];_0x2a4221['order']=qs['sort'](_0x2344d4['query'][_0xab5b('0x32')]);_0x2a4221[_0xab5b('0x33')]=qs[_0xab5b('0x2e')](_[_0xab5b('0x34')](_0x2344d4[_0xab5b('0x2c')],_0xb8c40c[_0xab5b('0x2e')]));if(_0x2344d4[_0xab5b('0x2c')]['filter']){_0x2a4221[_0xab5b('0x33')]=_[_0xab5b('0x35')](_0x2a4221[_0xab5b('0x33')],{'$or':_[_0xab5b('0x36')](_0x2a4221[_0xab5b('0x30')],function(_0xe8ff0){var _0x3ed630={};_0x3ed630[_0xe8ff0]={'$like':'%'+_0x2344d4[_0xab5b('0x2c')]['filter']+'%'};return _0x3ed630;})});}_0x2a4221=_['merge']({},_0x2a4221,_0x2344d4[_0xab5b('0x46')]);return _0x282569[_0xab5b('0x43')](_0x2a4221);}})[_0xab5b('0x24')](function(_0x419b61){if(_0x419b61){_0x4c2979=_0x419b61['length'];if(!_0x2344d4['query'][_0xab5b('0x47')](_0xab5b('0x48'))){_0x2a4221[_0xab5b('0x1d')]=qs[_0xab5b('0x1d')](_0x2344d4[_0xab5b('0x2c')][_0xab5b('0x1d')]);_0x2a4221[_0xab5b('0x1f')]=qs['offset'](_0x2344d4[_0xab5b('0x2c')]['offset']);}return _0x282569['getConfigurations'](_0x2a4221);}})[_0xab5b('0x24')](function(_0x901bbd){if(_0x901bbd){return _0x901bbd?{'count':_0x4c2979,'rows':_0x901bbd}:null;}})[_0xab5b('0x24')](respondWithResult(_0x5745fa,null))[_0xab5b('0x3a')](handleError(_0x5745fa,null));};exports['addConfiguration']=function(_0x5e98a6,_0x5c305c,_0x2e2ea7){if(_0x5e98a6[_0xab5b('0x41')]['id']){delete _0x5e98a6[_0xab5b('0x41')]['id'];}return db[_0xab5b('0x28')]['findOne']({'where':{'id':_0x5e98a6[_0xab5b('0x3c')]['id']}})[_0xab5b('0x24')](handleEntityNotFound(_0x5c305c,null))['then'](function(_0x22e069){if(_0x22e069){_0x5e98a6[_0xab5b('0x41')]['AccountId']=_0x22e069['id'];_0x5e98a6[_0xab5b('0x41')]['Subjects']=integrations['getSubjects'](_0x5e98a6[_0xab5b('0x41')][_0xab5b('0x49')],_0x5e98a6[_0xab5b('0x41')]['type']);_0x5e98a6[_0xab5b('0x41')]['Descriptions']=integrations[_0xab5b('0x4a')](_0x5e98a6[_0xab5b('0x41')][_0xab5b('0x49')],_0x5e98a6[_0xab5b('0x41')][_0xab5b('0x2a')]);return db[_0xab5b('0x45')][_0xab5b('0x40')](_0x5e98a6['body'],{'include':[{'model':db['SugarcrmField'],'as':_0xab5b('0x4b')},{'model':db[_0xab5b('0x4c')],'as':_0xab5b('0x4d')}]});}return null;})[_0xab5b('0x24')](respondWithResult(_0x5c305c,null))[_0xab5b('0x3a')](handleError(_0x5c305c,null));};exports[_0xab5b('0x4e')]=function(_0x44f799,_0x30d3ef,_0x447921){var _0x4baf20='';var _0x4e087c=['id',_0xab5b('0x26'),_0xab5b('0x4f'),_0xab5b('0x50'),_0xab5b('0x51'),_0xab5b('0x52'),_0xab5b('0x53'),_0xab5b('0x54'),_0xab5b('0x55'),_0xab5b('0x56'),_0xab5b('0x57'),_0xab5b('0x58')];return db['SugarcrmAccount'][_0xab5b('0x44')]({'where':{'id':_0x44f799[_0xab5b('0x3c')]['id']},'attributes':['id',_0xab5b('0x59'),'password',_0xab5b('0x5a')]})[_0xab5b('0x24')](handleEntityNotFound(_0x30d3ef,null))[_0xab5b('0x24')](function(_0x514090){if(_0x514090){_0x4baf20=_0x514090[_0xab5b('0x5a')];var _0x55576e=_0x4baf20['slice'](-0x1);if(_0x55576e==='/'){_0x4baf20=_0x4baf20[_0xab5b('0x5b')](0x0,_0x4baf20['lastIndexOf'](_0x55576e));}return rp({'method':_0xab5b('0x5c'),'uri':util[_0xab5b('0x5d')](_0xab5b('0x5e'),_0x4baf20,_0xab5b('0x5f')),'json':!![],'form':{'method':_0xab5b('0x60'),'input_type':_0xab5b('0x61'),'response_type':_0xab5b('0x61'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x514090['username'],'password':_0x514090['password'],'encryption':_0xab5b('0x62')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x4a61ed){if(_0x4a61ed&&_0x4a61ed[_0xab5b('0x26')]!==_0xab5b('0x63')&&_0x4a61ed[_0xab5b('0x26')]!==_0xab5b('0x64')){return rp({'method':_0xab5b('0x5c'),'uri':util[_0xab5b('0x5d')]('%s%s',_0x4baf20,_0xab5b('0x5f')),'json':!![],'form':{'method':_0xab5b('0x65'),'input_type':'JSON','response_type':_0xab5b('0x61'),'rest_data':JSON[_0xab5b('0x66')]({'session':_0x4a61ed['id'],'module_name':'Calls'})}})['then'](function(_0x19c236){if(_0x19c236){var _0x22eaee=_[_0xab5b('0x67')](_0x19c236['module_fields']);_[_0xab5b('0x68')](_0x22eaee,function(_0x227f57){return _0x4e087c[_0xab5b('0x69')](_0x227f57['name']);});return{'count':_0x22eaee[_0xab5b('0x3e')],'rows':_[_0xab5b('0x36')](_0x22eaee,function(_0x5677bc){return{'id':_0x5677bc[_0xab5b('0x26')],'name':_0x5677bc[_0xab5b('0x6a')],'custom':_['endsWith'](_0x5677bc[_0xab5b('0x26')],'_c')?!![]:![],'options':_0x5677bc[_0xab5b('0x46')]?_['map'](_[_0xab5b('0x67')](_0x5677bc['options']),function(_0x396830){return{'name':_0x396830[_0xab5b('0x6b')],'value':_0x396830[_0xab5b('0x26')]};}):[]};})};}})[_0xab5b('0x24')](respondWithResult(_0x30d3ef,null))[_0xab5b('0x3a')](function(_0x5667d9){var _0x4679b9=_0x44f799['query']['test']?0x1f4:_0x5667d9[_0xab5b('0x6c')]||0x1f4;logger['error'](_0xab5b('0x6d'),_0xab5b('0x4e'),_0x4679b9,JSON['stringify'](_0x5667d9));delete _0x5667d9[_0xab5b('0x26')];if(_0x4679b9===0x191){_0x4679b9=0x190;}_0x30d3ef['status'](_0x4679b9)[_0xab5b('0x27')](_0x44f799[_0xab5b('0x2c')][_0xab5b('0x6e')]?{'message':_0xab5b('0x6f'),'statusCode':_0x5667d9[_0xab5b('0x6c')]}:_0x5667d9);});}else{var _0x8dca51=0x1f4;_0x30d3ef[_0xab5b('0x1a')](_0x8dca51)[_0xab5b('0x27')]({'message':_0xab5b('0x6f'),'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 3ad261d..0a93a58 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 _0xf1a2=['rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0xf1a2,0x1f0));var _0x2f1a=function(_0x1d6564,_0x53da96){_0x1d6564=_0x1d6564-0x0;var _0x25c718=_0xf1a2[_0x1d6564];return _0x25c718;};'use strict';var _=require(_0x2f1a('0x0'));var util=require(_0x2f1a('0x1'));var logger=require(_0x2f1a('0x2'))(_0x2f1a('0x3'));var moment=require(_0x2f1a('0x4'));var BPromise=require(_0x2f1a('0x5'));var rp=require(_0x2f1a('0x6'));var fs=require('fs');var path=require(_0x2f1a('0x7'));var rimraf=require(_0x2f1a('0x8'));var config=require('../../config/environment');var attributes=require(_0x2f1a('0x9'));var integrations=require(_0x2f1a('0xa'));module[_0x2f1a('0xb')]=function(_0x3ac923,_0xde0f39){return _0x3ac923[_0x2f1a('0xc')]('SugarcrmAccount',attributes,{'tableName':_0x2f1a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc09e=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x31a8b3,_0x4c15b7){var _0x3c068=function(_0x50b5ff){while(--_0x50b5ff){_0x31a8b3['push'](_0x31a8b3['shift']());}};_0x3c068(++_0x4c15b7);}(_0xc09e,0x6f));var _0xec09=function(_0x330818,_0x3b9bb6){_0x330818=_0x330818-0x0;var _0x504815=_0xc09e[_0x330818];return _0x504815;};'use strict';var _=require(_0xec09('0x0'));var util=require('util');var logger=require(_0xec09('0x1'))(_0xec09('0x2'));var moment=require(_0xec09('0x3'));var BPromise=require(_0xec09('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec09('0x5'));var rimraf=require('rimraf');var config=require(_0xec09('0x6'));var attributes=require(_0xec09('0x7'));var integrations=require(_0xec09('0x8'));module[_0xec09('0x9')]=function(_0x551bda,_0xa9a183){return _0x551bda[_0xec09('0xa')](_0xec09('0xb'),attributes,{'tableName':_0xec09('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 79bde61..3e719f8 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 _0x552c=['SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','where','attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','find','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1faea3,_0x5e79e6){var _0x11092f=function(_0x134680){while(--_0x134680){_0x1faea3['push'](_0x1faea3['shift']());}};_0x11092f(++_0x5e79e6);}(_0x552c,0x82));var _0xc552=function(_0x3d1f54,_0x32451b){_0x3d1f54=_0x3d1f54-0x0;var _0x1f3fdb=_0x552c[_0x3d1f54];return _0x1f3fdb;};'use strict';var _=require('lodash');var util=require(_0xc552('0x0'));var moment=require(_0xc552('0x1'));var BPromise=require(_0xc552('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc552('0x3'));var db=require(_0xc552('0x4'))['db'];var utils=require(_0xc552('0x5'));var logger=require(_0xc552('0x6'))(_0xc552('0x7'));var config=require(_0xc552('0x8'));var jayson=require(_0xc552('0x9'));var client=jayson[_0xc552('0xa')][_0xc552('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b17a2,_0x445344,_0x1aa1cd){return new BPromise(function(_0xd57eea,_0x41951e){return client[_0xc552('0xc')](_0x2b17a2,_0x1aa1cd)[_0xc552('0xd')](function(_0x50337b){logger[_0xc552('0xe')](_0xc552('0xf'),_0x445344,_0xc552('0x10'));logger[_0xc552('0x11')](_0xc552('0x12'),_0x445344,'request\x20sent',JSON[_0xc552('0x13')](_0x50337b));if(_0x50337b[_0xc552('0x14')]){if(_0x50337b[_0xc552('0x14')][_0xc552('0x15')]===0x1f4){logger[_0xc552('0x14')](_0xc552('0xf'),_0x445344,_0x50337b[_0xc552('0x14')][_0xc552('0x16')]);return _0x41951e(_0x50337b['error'][_0xc552('0x16')]);}logger[_0xc552('0x14')](_0xc552('0xf'),_0x445344,_0x50337b['error'][_0xc552('0x16')]);return _0xd57eea(_0x50337b[_0xc552('0x14')]['message']);}else{logger[_0xc552('0xe')](_0xc552('0xf'),_0x445344,_0xc552('0x10'));_0xd57eea(_0x50337b['result'][_0xc552('0x16')]);}})[_0xc552('0x17')](function(_0x2431fa){logger[_0xc552('0x14')](_0xc552('0xf'),_0x445344,_0x2431fa);_0x41951e(_0x2431fa);});});}exports['GetSugarcrmAccount']=function(_0x2d4816){var _0x52a6a9=this;return new Promise(function(_0x12f712,_0x523455){return db['SugarcrmAccount'][_0xc552('0x18')]({'raw':_0x2d4816[_0xc552('0x19')]?_0x2d4816[_0xc552('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2d4816[_0xc552('0x19')]?_0x2d4816[_0xc552('0x19')][_0xc552('0x1a')]||null:null,'attributes':_0x2d4816[_0xc552('0x19')]?_0x2d4816[_0xc552('0x19')][_0xc552('0x1b')]||null:null,'limit':_0x2d4816[_0xc552('0x19')]?_0x2d4816[_0xc552('0x19')][_0xc552('0x1c')]||null:null,'include':_0x2d4816[_0xc552('0x19')]?_0x2d4816[_0xc552('0x19')][_0xc552('0x1d')]?_[_0xc552('0x1e')](_0x2d4816['options'][_0xc552('0x1d')],function(_0x3b233b){return{'model':db[_0x3b233b[_0xc552('0x1f')]],'as':_0x3b233b['as'],'attributes':_0x3b233b[_0xc552('0x1b')],'include':_0x3b233b['include']?_[_0xc552('0x1e')](_0x3b233b[_0xc552('0x1d')],function(_0x3c93a2){return{'model':db[_0x3c93a2[_0xc552('0x1f')]],'as':_0x3c93a2['as'],'attributes':_0x3c93a2[_0xc552('0x1b')],'include':_0x3c93a2[_0xc552('0x1d')]?_[_0xc552('0x1e')](_0x3c93a2['include'],function(_0x48ff96){return{'model':db[_0x48ff96[_0xc552('0x1f')]],'as':_0x48ff96['as'],'attributes':_0x48ff96[_0xc552('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32c7cd){logger['info'](_0xc552('0x20'),_0x2d4816);logger[_0xc552('0x11')](_0xc552('0x20'),_0x2d4816,JSON[_0xc552('0x13')](_0x32c7cd));_0x12f712(_0x32c7cd);})['catch'](function(_0xdc8ea1){logger[_0xc552('0x14')](_0xc552('0x20'),_0xdc8ea1['message'],_0x2d4816);_0x523455(_0x52a6a9[_0xc552('0x14')](0x1f4,_0xdc8ea1[_0xc552('0x16')]));});});};exports[_0xc552('0x21')]=function(_0x8c57b7){var _0x3a9bf9=this;return new Promise(function(_0x5b4597,_0x4b8211){return db[_0xc552('0x22')][_0xc552('0x23')]({'raw':_0x8c57b7[_0xc552('0x19')]?_0x8c57b7[_0xc552('0x19')][_0xc552('0x24')]===undefined?!![]:![]:!![],'where':_0x8c57b7[_0xc552('0x19')]?_0x8c57b7[_0xc552('0x19')][_0xc552('0x1a')]||null:null,'attributes':_0x8c57b7['options']?_0x8c57b7[_0xc552('0x19')][_0xc552('0x1b')]||null:null,'include':_0x8c57b7[_0xc552('0x19')]?_0x8c57b7[_0xc552('0x19')][_0xc552('0x1d')]?_[_0xc552('0x1e')](_0x8c57b7['options'][_0xc552('0x1d')],function(_0x49e966){return{'model':db[_0x49e966[_0xc552('0x1f')]],'as':_0x49e966['as'],'attributes':_0x49e966[_0xc552('0x1b')],'include':_0x49e966['include']?_[_0xc552('0x1e')](_0x49e966['include'],function(_0x38687a){return{'model':db[_0x38687a[_0xc552('0x1f')]],'as':_0x38687a['as'],'attributes':_0x38687a['attributes'],'include':_0x38687a[_0xc552('0x1d')]?_[_0xc552('0x1e')](_0x38687a[_0xc552('0x1d')],function(_0x163ac6){return{'model':db[_0x163ac6[_0xc552('0x1f')]],'as':_0x163ac6['as'],'attributes':_0x163ac6[_0xc552('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc552('0xd')](function(_0x394e3a){logger[_0xc552('0xe')]('ShowSugarcrmAccount',_0x8c57b7);logger[_0xc552('0x11')]('ShowSugarcrmAccount',_0x8c57b7,JSON['stringify'](_0x394e3a));_0x5b4597(_0x394e3a);})[_0xc552('0x17')](function(_0x17e162){logger[_0xc552('0x14')](_0xc552('0x21'),_0x17e162[_0xc552('0x16')],_0x8c57b7);_0x4b8211(_0x3a9bf9[_0xc552('0x14')](0x1f4,_0x17e162[_0xc552('0x16')]));});});}; \ No newline at end of file +var _0xd8cb=['map','model','debug','ShowSugarcrmAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','include'];(function(_0x1e6d55,_0x3b4985){var _0x44ea73=function(_0x5b2cb2){while(--_0x5b2cb2){_0x1e6d55['push'](_0x1e6d55['shift']());}};_0x44ea73(++_0x3b4985);}(_0xd8cb,0xfc));var _0xbd8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbd8c('0x0'));var util=require('util');var moment=require(_0xbd8c('0x1'));var BPromise=require(_0xbd8c('0x2'));var rs=require(_0xbd8c('0x3'));var fs=require('fs');var Redis=require(_0xbd8c('0x4'));var db=require(_0xbd8c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd8c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbd8c('0x7'));var client=jayson[_0xbd8c('0x8')][_0xbd8c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d3e82,_0x18a0fb,_0x32928a){return new BPromise(function(_0x50774d,_0x205de3){return client[_0xbd8c('0xa')](_0x4d3e82,_0x32928a)[_0xbd8c('0xb')](function(_0x143cc8){logger[_0xbd8c('0xc')](_0xbd8c('0xd'),_0x18a0fb,'request\x20sent');logger['debug'](_0xbd8c('0xe'),_0x18a0fb,_0xbd8c('0xf'),JSON[_0xbd8c('0x10')](_0x143cc8));if(_0x143cc8[_0xbd8c('0x11')]){if(_0x143cc8['error']['code']===0x1f4){logger[_0xbd8c('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x18a0fb,_0x143cc8[_0xbd8c('0x11')][_0xbd8c('0x12')]);return _0x205de3(_0x143cc8['error'][_0xbd8c('0x12')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x18a0fb,_0x143cc8[_0xbd8c('0x11')]['message']);return _0x50774d(_0x143cc8['error'][_0xbd8c('0x12')]);}else{logger[_0xbd8c('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x18a0fb,_0xbd8c('0xf'));_0x50774d(_0x143cc8['result'][_0xbd8c('0x12')]);}})[_0xbd8c('0x13')](function(_0x59e878){logger[_0xbd8c('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x18a0fb,_0x59e878);_0x205de3(_0x59e878);});});}exports[_0xbd8c('0x14')]=function(_0x4cf41d){var _0x2788f8=this;return new Promise(function(_0x19bca,_0x254a5b){return db[_0xbd8c('0x15')][_0xbd8c('0x16')]({'raw':_0x4cf41d[_0xbd8c('0x17')]?_0x4cf41d[_0xbd8c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4cf41d[_0xbd8c('0x17')]?_0x4cf41d[_0xbd8c('0x17')][_0xbd8c('0x18')]||null:null,'attributes':_0x4cf41d[_0xbd8c('0x17')]?_0x4cf41d[_0xbd8c('0x17')][_0xbd8c('0x19')]||null:null,'limit':_0x4cf41d['options']?_0x4cf41d[_0xbd8c('0x17')]['limit']||null:null,'include':_0x4cf41d[_0xbd8c('0x17')]?_0x4cf41d[_0xbd8c('0x17')][_0xbd8c('0x1a')]?_['map'](_0x4cf41d[_0xbd8c('0x17')][_0xbd8c('0x1a')],function(_0x479c71){return{'model':db[_0x479c71['model']],'as':_0x479c71['as'],'attributes':_0x479c71['attributes'],'include':_0x479c71[_0xbd8c('0x1a')]?_[_0xbd8c('0x1b')](_0x479c71[_0xbd8c('0x1a')],function(_0x21e7be){return{'model':db[_0x21e7be[_0xbd8c('0x1c')]],'as':_0x21e7be['as'],'attributes':_0x21e7be[_0xbd8c('0x19')],'include':_0x21e7be[_0xbd8c('0x1a')]?_[_0xbd8c('0x1b')](_0x21e7be[_0xbd8c('0x1a')],function(_0xfa0e4f){return{'model':db[_0xfa0e4f[_0xbd8c('0x1c')]],'as':_0xfa0e4f['as'],'attributes':_0xfa0e4f[_0xbd8c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x349fa9){logger[_0xbd8c('0xc')](_0xbd8c('0x14'),_0x4cf41d);logger[_0xbd8c('0x1d')](_0xbd8c('0x14'),_0x4cf41d,JSON[_0xbd8c('0x10')](_0x349fa9));_0x19bca(_0x349fa9);})[_0xbd8c('0x13')](function(_0x29bd55){logger[_0xbd8c('0x11')]('GetSugarcrmAccount',_0x29bd55['message'],_0x4cf41d);_0x254a5b(_0x2788f8[_0xbd8c('0x11')](0x1f4,_0x29bd55['message']));});});};exports[_0xbd8c('0x1e')]=function(_0x8879c8){var _0x3a3a22=this;return new Promise(function(_0x2bfc98,_0x218b96){return db[_0xbd8c('0x15')]['find']({'raw':_0x8879c8['options']?_0x8879c8[_0xbd8c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x8879c8['options']?_0x8879c8[_0xbd8c('0x17')]['where']||null:null,'attributes':_0x8879c8[_0xbd8c('0x17')]?_0x8879c8[_0xbd8c('0x17')][_0xbd8c('0x19')]||null:null,'include':_0x8879c8['options']?_0x8879c8[_0xbd8c('0x17')]['include']?_['map'](_0x8879c8['options'][_0xbd8c('0x1a')],function(_0x38fcf0){return{'model':db[_0x38fcf0['model']],'as':_0x38fcf0['as'],'attributes':_0x38fcf0['attributes'],'include':_0x38fcf0[_0xbd8c('0x1a')]?_[_0xbd8c('0x1b')](_0x38fcf0[_0xbd8c('0x1a')],function(_0x23d6d5){return{'model':db[_0x23d6d5[_0xbd8c('0x1c')]],'as':_0x23d6d5['as'],'attributes':_0x23d6d5[_0xbd8c('0x19')],'include':_0x23d6d5[_0xbd8c('0x1a')]?_[_0xbd8c('0x1b')](_0x23d6d5['include'],function(_0x143556){return{'model':db[_0x143556['model']],'as':_0x143556['as'],'attributes':_0x143556[_0xbd8c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbd8c('0xb')](function(_0x116ad0){logger[_0xbd8c('0xc')]('ShowSugarcrmAccount',_0x8879c8);logger[_0xbd8c('0x1d')](_0xbd8c('0x1e'),_0x8879c8,JSON['stringify'](_0x116ad0));_0x2bfc98(_0x116ad0);})[_0xbd8c('0x13')](function(_0x4b3af1){logger[_0xbd8c('0x11')](_0xbd8c('0x1e'),_0x4b3af1['message'],_0x8879c8);_0x218b96(_0x3a3a22[_0xbd8c('0x11')](0x1f4,_0x4b3af1[_0xbd8c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 64f5b59..c51ab2b 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 _0xf54c=['get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1d200a,_0x1ac78b){var _0x5e075a=function(_0x22e2c2){while(--_0x22e2c2){_0x1d200a['push'](_0x1d200a['shift']());}};_0x5e075a(++_0x1ac78b);}(_0xf54c,0x6c));var _0xcf54=function(_0x36b828,_0x4acdc4){_0x36b828=_0x36b828-0x0;var _0x3a083b=_0xf54c[_0x36b828];return _0x3a083b;};'use strict';var multer=require(_0xcf54('0x0'));var util=require(_0xcf54('0x1'));var path=require(_0xcf54('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcf54('0x3')]();var fs_extra=require(_0xcf54('0x4'));var auth=require(_0xcf54('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcf54('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xcf54('0x7')]('/',auth[_0xcf54('0x8')](),controller['index']);router[_0xcf54('0x7')](_0xcf54('0x9'),auth[_0xcf54('0x8')](),controller[_0xcf54('0xa')]);router[_0xcf54('0x7')](_0xcf54('0xb'),auth[_0xcf54('0x8')](),controller[_0xcf54('0xc')]);router['get'](_0xcf54('0xd'),auth[_0xcf54('0x8')](),controller[_0xcf54('0xe')]);router[_0xcf54('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xcf54('0xf')]);router[_0xcf54('0x10')]('/',auth[_0xcf54('0x8')](),controller[_0xcf54('0x11')]);router[_0xcf54('0x12')]('/:id',auth[_0xcf54('0x8')](),controller[_0xcf54('0x13')]);router[_0xcf54('0x14')](_0xcf54('0x9'),auth[_0xcf54('0x8')](),controller[_0xcf54('0x15')]);module[_0xcf54('0x16')]=router; \ No newline at end of file +var _0xabcd=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update'];(function(_0x7a887f,_0x1a0994){var _0x578d17=function(_0x54ebe5){while(--_0x54ebe5){_0x7a887f['push'](_0x7a887f['shift']());}};_0x578d17(++_0x1a0994);}(_0xabcd,0x199));var _0xdabc=function(_0x4f1a18,_0x5ef254){_0x4f1a18=_0x4f1a18-0x0;var _0x3f970a=_0xabcd[_0x4f1a18];return _0x3f970a;};'use strict';var multer=require(_0xdabc('0x0'));var util=require(_0xdabc('0x1'));var path=require(_0xdabc('0x2'));var timeout=require(_0xdabc('0x3'));var express=require(_0xdabc('0x4'));var router=express[_0xdabc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdabc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdabc('0x7'));var controller=require(_0xdabc('0x8'));router[_0xdabc('0x9')]('/',auth[_0xdabc('0xa')](),controller[_0xdabc('0xb')]);router['get'](_0xdabc('0xc'),auth[_0xdabc('0xa')](),controller[_0xdabc('0xd')]);router[_0xdabc('0x9')](_0xdabc('0xe'),auth['isAuthenticated'](),controller[_0xdabc('0xf')]);router[_0xdabc('0x9')](_0xdabc('0x10'),auth[_0xdabc('0xa')](),controller[_0xdabc('0x11')]);router[_0xdabc('0x9')](_0xdabc('0x12'),auth['isAuthenticated'](),controller[_0xdabc('0x13')]);router['post']('/',auth[_0xdabc('0xa')](),controller[_0xdabc('0x14')]);router[_0xdabc('0x15')](_0xdabc('0xc'),auth[_0xdabc('0xa')](),controller[_0xdabc('0x16')]);router['delete'](_0xdabc('0xc'),auth[_0xdabc('0xa')](),controller[_0xdabc('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 8f0c338..bc4dd4c 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 _0x9a20=['exports','STRING','sequelize'];(function(_0xc9c4c9,_0x4d1f6b){var _0xcc9f64=function(_0x539abb){while(--_0x539abb){_0xc9c4c9['push'](_0xc9c4c9['shift']());}};_0xcc9f64(++_0x4d1f6b);}(_0x9a20,0xad));var _0x09a2=function(_0x200c25,_0x35743a){_0x200c25=_0x200c25-0x0;var _0x33b243=_0x9a20[_0x200c25];return _0x33b243;};'use strict';var Sequelize=require(_0x09a2('0x0'));module[_0x09a2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x09a2('0x2')]}}; \ No newline at end of file +var _0x05fd=['sequelize','STRING'];(function(_0x378d52,_0xdce0c4){var _0x1d8745=function(_0x4b2840){while(--_0x4b2840){_0x378d52['push'](_0x378d52['shift']());}};_0x1d8745(++_0xdce0c4);}(_0x05fd,0x1b6));var _0xd05f=function(_0x60e3c6,_0x1d4554){_0x60e3c6=_0x60e3c6-0x0;var _0x51477b=_0x05fd[_0x60e3c6];return _0x51477b;};'use strict';var Sequelize=require(_0xd05f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd05f('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index fdb6d76..f8e0d8e 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 _0x63aa=['mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','SugarcrmField','getFields','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x38300c,_0x4618b9){var _0x591bf6=function(_0x3595d9){while(--_0x3595d9){_0x38300c['push'](_0x38300c['shift']());}};_0x591bf6(++_0x4618b9);}(_0x63aa,0x152));var _0xa63a=function(_0x285029,_0x441f84){_0x285029=_0x285029-0x0;var _0xa32619=_0x63aa[_0x285029];return _0xa32619;};'use strict';var emlformat=require(_0xa63a('0x0'));var rimraf=require(_0xa63a('0x1'));var zipdir=require(_0xa63a('0x2'));var jsonpatch=require(_0xa63a('0x3'));var rp=require('request-promise');var moment=require(_0xa63a('0x4'));var BPromise=require(_0xa63a('0x5'));var Mustache=require(_0xa63a('0x6'));var util=require(_0xa63a('0x7'));var path=require(_0xa63a('0x8'));var sox=require('sox');var csv=require(_0xa63a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa63a('0xa'));var _=require(_0xa63a('0xb'));var squel=require(_0xa63a('0xc'));var crypto=require(_0xa63a('0xd'));var jsforce=require(_0xa63a('0xe'));var deskjs=require(_0xa63a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa63a('0x10'));var Papa=require(_0xa63a('0x11'));var Redis=require(_0xa63a('0x12'));var authService=require(_0xa63a('0x13'));var qs=require(_0xa63a('0x14'));var as=require(_0xa63a('0x15'));var hardwareService=require(_0xa63a('0x16'));var logger=require(_0xa63a('0x17'))(_0xa63a('0x18'));var utils=require('../../config/utils');var config=require(_0xa63a('0x19'));var licenseUtil=require(_0xa63a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x71cf38,_0x87428f){_0x87428f=_0x87428f||0xcc;return function(_0x32ab4a){if(_0x32ab4a){return _0x71cf38[_0xa63a('0x1b')](_0x87428f);}return _0x71cf38['status'](_0x87428f)[_0xa63a('0x1c')]();};}function respondWithResult(_0x37cb3b,_0x3b74b1){_0x3b74b1=_0x3b74b1||0xc8;return function(_0x324036){if(_0x324036){return _0x37cb3b[_0xa63a('0x1d')](_0x3b74b1)[_0xa63a('0x1e')](_0x324036);}};}function respondWithFilteredResult(_0x59f121,_0xe6a123){return function(_0x3c037f){if(_0x3c037f){var _0x242ae4=typeof _0xe6a123[_0xa63a('0x1f')]==='undefined'&&typeof _0xe6a123[_0xa63a('0x20')]==='undefined';var _0x24b53f=_0x3c037f['count'];var _0x532f84=_0x242ae4?0x0:_0xe6a123[_0xa63a('0x1f')];var _0x1d8628=_0x242ae4?_0x3c037f[_0xa63a('0x21')]:_0xe6a123['offset']+_0xe6a123[_0xa63a('0x20')];var _0x74cace;if(_0x1d8628>=_0x24b53f){_0x1d8628=_0x24b53f;_0x74cace=0xc8;}else{_0x74cace=0xce;}_0x59f121['status'](_0x74cace);return _0x59f121[_0xa63a('0x22')](_0xa63a('0x23'),_0x532f84+'-'+_0x1d8628+'/'+_0x24b53f)[_0xa63a('0x1e')](_0x3c037f);}return null;};}function patchUpdates(_0x3978cf){return function(_0x1ab7ba){try{jsonpatch[_0xa63a('0x24')](_0x1ab7ba,_0x3978cf,!![]);}catch(_0x4b44f1){return BPromise[_0xa63a('0x25')](_0x4b44f1);}return _0x1ab7ba[_0xa63a('0x26')]();};}function saveUpdates(_0x32c5ee,_0x299327){return function(_0x3d1c3a){if(_0x3d1c3a){return _0x3d1c3a[_0xa63a('0x27')](_0x32c5ee)['then'](function(_0x28c142){return _0x28c142;});}return null;};}function removeEntity(_0x193fb6,_0x3679e8){return function(_0x46982d){if(_0x46982d){return _0x46982d[_0xa63a('0x28')]()[_0xa63a('0x29')](function(){_0x193fb6[_0xa63a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ef49e,_0x130c14){return function(_0x17407b){if(!_0x17407b){_0x1ef49e['sendStatus'](0x194);}return _0x17407b;};}function handleError(_0x5abba9,_0x549294){_0x549294=_0x549294||0x1f4;return function(_0x382518){logger[_0xa63a('0x2a')](_0x382518[_0xa63a('0x2b')]);if(_0x382518[_0xa63a('0x2c')]){delete _0x382518[_0xa63a('0x2c')];}_0x5abba9[_0xa63a('0x1d')](_0x549294)[_0xa63a('0x2d')](_0x382518);};}exports[_0xa63a('0x2e')]=function(_0x1e1609,_0x73ffd9){var _0x412ef5={},_0x49124e={},_0xaa5a2a={'count':0x0,'rows':[]};var _0x3247ee=_[_0xa63a('0x2f')](db[_0xa63a('0x30')][_0xa63a('0x31')],function(_0x7bf31d){return{'name':_0x7bf31d[_0xa63a('0x32')],'type':_0x7bf31d[_0xa63a('0x33')][_0xa63a('0x34')]};});_0x49124e[_0xa63a('0x35')]=_[_0xa63a('0x2f')](_0x3247ee,_0xa63a('0x2c'));_0x49124e[_0xa63a('0x36')]=_[_0xa63a('0x37')](_0x1e1609[_0xa63a('0x36')]);_0x49124e['filters']=_[_0xa63a('0x38')](_0x49124e['model'],_0x49124e['query']);_0x412ef5[_0xa63a('0x39')]=_[_0xa63a('0x38')](_0x49124e[_0xa63a('0x35')],qs[_0xa63a('0x3a')](_0x1e1609[_0xa63a('0x36')]['fields']));_0x412ef5[_0xa63a('0x39')]=_0x412ef5[_0xa63a('0x39')][_0xa63a('0x3b')]?_0x412ef5['attributes']:_0x49124e[_0xa63a('0x35')];if(!_0x1e1609[_0xa63a('0x36')][_0xa63a('0x3c')](_0xa63a('0x3d'))){_0x412ef5[_0xa63a('0x20')]=qs[_0xa63a('0x20')](_0x1e1609['query'][_0xa63a('0x20')]);_0x412ef5[_0xa63a('0x1f')]=qs[_0xa63a('0x1f')](_0x1e1609['query'][_0xa63a('0x1f')]);}_0x412ef5[_0xa63a('0x3e')]=qs['sort'](_0x1e1609[_0xa63a('0x36')][_0xa63a('0x3f')]);_0x412ef5[_0xa63a('0x40')]=qs[_0xa63a('0x41')](_[_0xa63a('0x42')](_0x1e1609['query'],_0x49124e[_0xa63a('0x41')]),_0x3247ee);if(_0x1e1609[_0xa63a('0x36')]['filter']){_0x412ef5['where']=_[_0xa63a('0x43')](_0x412ef5[_0xa63a('0x40')],{'$or':_[_0xa63a('0x2f')](_0x3247ee,function(_0x3770e0){if(_0x3770e0[_0xa63a('0x33')]!==_0xa63a('0x44')){var _0x1548eb={};_0x1548eb[_0x3770e0[_0xa63a('0x2c')]]={'$like':'%'+_0x1e1609[_0xa63a('0x36')][_0xa63a('0x45')]+'%'};return _0x1548eb;}})});}_0x412ef5=_[_0xa63a('0x43')]({},_0x412ef5,_0x1e1609[_0xa63a('0x46')]);var _0x235726={'where':_0x412ef5[_0xa63a('0x40')]};return db[_0xa63a('0x30')][_0xa63a('0x21')](_0x235726)[_0xa63a('0x29')](function(_0x88e34c){_0xaa5a2a[_0xa63a('0x21')]=_0x88e34c;if(_0x1e1609[_0xa63a('0x36')][_0xa63a('0x47')]){_0x412ef5[_0xa63a('0x48')]=[{'all':!![]}];}return db[_0xa63a('0x30')][_0xa63a('0x49')](_0x412ef5);})[_0xa63a('0x29')](function(_0x1e82e3){_0xaa5a2a[_0xa63a('0x4a')]=_0x1e82e3;return _0xaa5a2a;})[_0xa63a('0x29')](respondWithFilteredResult(_0x73ffd9,_0x412ef5))[_0xa63a('0x4b')](handleError(_0x73ffd9,null));};exports[_0xa63a('0x4c')]=function(_0x46ad67,_0x152b94){var _0x41d231={'raw':![],'where':{'id':_0x46ad67[_0xa63a('0x4d')]['id']}},_0x56aaf9={};_0x56aaf9[_0xa63a('0x35')]=_[_0xa63a('0x37')](db[_0xa63a('0x30')]['rawAttributes']);_0x56aaf9[_0xa63a('0x36')]=_[_0xa63a('0x37')](_0x46ad67[_0xa63a('0x36')]);_0x56aaf9[_0xa63a('0x41')]=_['intersection'](_0x56aaf9[_0xa63a('0x35')],_0x56aaf9['query']);_0x41d231[_0xa63a('0x39')]=_['intersection'](_0x56aaf9['model'],qs[_0xa63a('0x3a')](_0x46ad67['query'][_0xa63a('0x3a')]));_0x41d231[_0xa63a('0x39')]=_0x41d231[_0xa63a('0x39')][_0xa63a('0x3b')]?_0x41d231[_0xa63a('0x39')]:_0x56aaf9[_0xa63a('0x35')];if(_0x46ad67[_0xa63a('0x36')][_0xa63a('0x47')]){_0x41d231[_0xa63a('0x48')]=[{'all':!![]}];}_0x41d231=_[_0xa63a('0x43')]({},_0x41d231,_0x46ad67[_0xa63a('0x46')]);return db[_0xa63a('0x30')][_0xa63a('0x4e')](_0x41d231)['then'](handleEntityNotFound(_0x152b94,null))[_0xa63a('0x29')](respondWithResult(_0x152b94,null))[_0xa63a('0x4b')](handleError(_0x152b94,null));};exports[_0xa63a('0x4f')]=function(_0xbaba24,_0x5a024c){return db[_0xa63a('0x30')]['create'](_0xbaba24[_0xa63a('0x50')],{})[_0xa63a('0x29')](respondWithResult(_0x5a024c,0xc9))[_0xa63a('0x4b')](handleError(_0x5a024c,null));};exports[_0xa63a('0x27')]=function(_0x5b8f3d,_0x3dc7d4){if(_0x5b8f3d[_0xa63a('0x50')]['id']){delete _0x5b8f3d[_0xa63a('0x50')]['id'];}return db[_0xa63a('0x30')][_0xa63a('0x4e')]({'where':{'id':_0x5b8f3d[_0xa63a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3dc7d4,null))['then'](saveUpdates(_0x5b8f3d[_0xa63a('0x50')],null))[_0xa63a('0x29')](respondWithResult(_0x3dc7d4,null))[_0xa63a('0x4b')](handleError(_0x3dc7d4,null));};exports[_0xa63a('0x28')]=function(_0x22e7e6,_0x3cb8f8){return db[_0xa63a('0x30')][_0xa63a('0x4e')]({'where':{'id':_0x22e7e6['params']['id']}})['then'](handleEntityNotFound(_0x3cb8f8,null))[_0xa63a('0x29')](removeEntity(_0x3cb8f8,null))[_0xa63a('0x4b')](handleError(_0x3cb8f8,null));};exports['getFields']=function(_0x10f980,_0x369d7e,_0xd95c7d){var _0x55202c={};var _0x48c0db={};var _0xe24070;var _0x3a03ae;return db[_0xa63a('0x30')]['findOne']({'where':{'id':_0x10f980[_0xa63a('0x4d')]['id']}})[_0xa63a('0x29')](handleEntityNotFound(_0x369d7e,null))[_0xa63a('0x29')](function(_0x29d3b4){if(_0x29d3b4){_0xe24070=_0x29d3b4;_0x48c0db[_0xa63a('0x35')]=_[_0xa63a('0x37')](db[_0xa63a('0x51')]['rawAttributes']);_0x48c0db['query']=_[_0xa63a('0x37')](_0x10f980[_0xa63a('0x36')]);_0x48c0db['filters']=_[_0xa63a('0x38')](_0x48c0db['model'],_0x48c0db[_0xa63a('0x36')]);_0x55202c[_0xa63a('0x39')]=_[_0xa63a('0x38')](_0x48c0db[_0xa63a('0x35')],qs[_0xa63a('0x3a')](_0x10f980[_0xa63a('0x36')][_0xa63a('0x3a')]));_0x55202c[_0xa63a('0x39')]=_0x55202c[_0xa63a('0x39')][_0xa63a('0x3b')]?_0x55202c[_0xa63a('0x39')]:_0x48c0db[_0xa63a('0x35')];_0x55202c[_0xa63a('0x3e')]=qs['sort'](_0x10f980['query'][_0xa63a('0x3f')]);_0x55202c[_0xa63a('0x40')]=qs[_0xa63a('0x41')](_[_0xa63a('0x42')](_0x10f980['query'],_0x48c0db[_0xa63a('0x41')]));if(_0x10f980[_0xa63a('0x36')]['filter']){_0x55202c[_0xa63a('0x40')]=_[_0xa63a('0x43')](_0x55202c[_0xa63a('0x40')],{'$or':_[_0xa63a('0x2f')](_0x55202c[_0xa63a('0x39')],function(_0x95721d){var _0x127aaa={};_0x127aaa[_0x95721d]={'$like':'%'+_0x10f980['query'][_0xa63a('0x45')]+'%'};return _0x127aaa;})});}_0x55202c=_[_0xa63a('0x43')]({},_0x55202c,_0x10f980[_0xa63a('0x46')]);return _0xe24070[_0xa63a('0x52')](_0x55202c);}})[_0xa63a('0x29')](function(_0x32cdab){if(_0x32cdab){_0x3a03ae=_0x32cdab[_0xa63a('0x3b')];if(!_0x10f980[_0xa63a('0x36')]['hasOwnProperty'](_0xa63a('0x3d'))){_0x55202c[_0xa63a('0x20')]=qs[_0xa63a('0x20')](_0x10f980[_0xa63a('0x36')][_0xa63a('0x20')]);_0x55202c['offset']=qs[_0xa63a('0x1f')](_0x10f980[_0xa63a('0x36')][_0xa63a('0x1f')]);}return _0xe24070[_0xa63a('0x52')](_0x55202c);}})['then'](function(_0x23b0ab){if(_0x23b0ab){return _0x23b0ab?{'count':_0x3a03ae,'rows':_0x23b0ab}:null;}})[_0xa63a('0x29')](respondWithResult(_0x369d7e,null))[_0xa63a('0x4b')](handleError(_0x369d7e,null));};exports[_0xa63a('0x53')]=function(_0x408d44,_0x30a227,_0x25228f){var _0x28b59e={};var _0x4c1dc3={};var _0x25e0ce;var _0x123591;return db[_0xa63a('0x30')]['findOne']({'where':{'id':_0x408d44['params']['id']}})['then'](handleEntityNotFound(_0x30a227,null))[_0xa63a('0x29')](function(_0x52cc45){if(_0x52cc45){_0x25e0ce=_0x52cc45;_0x4c1dc3['model']=_[_0xa63a('0x37')](db[_0xa63a('0x51')][_0xa63a('0x31')]);_0x4c1dc3[_0xa63a('0x36')]=_[_0xa63a('0x37')](_0x408d44[_0xa63a('0x36')]);_0x4c1dc3[_0xa63a('0x41')]=_[_0xa63a('0x38')](_0x4c1dc3['model'],_0x4c1dc3[_0xa63a('0x36')]);_0x28b59e[_0xa63a('0x39')]=_[_0xa63a('0x38')](_0x4c1dc3[_0xa63a('0x35')],qs['fields'](_0x408d44[_0xa63a('0x36')][_0xa63a('0x3a')]));_0x28b59e['attributes']=_0x28b59e[_0xa63a('0x39')][_0xa63a('0x3b')]?_0x28b59e['attributes']:_0x4c1dc3['model'];_0x28b59e[_0xa63a('0x3e')]=qs['sort'](_0x408d44[_0xa63a('0x36')][_0xa63a('0x3f')]);_0x28b59e[_0xa63a('0x40')]=qs[_0xa63a('0x41')](_[_0xa63a('0x42')](_0x408d44[_0xa63a('0x36')],_0x4c1dc3[_0xa63a('0x41')]));if(_0x408d44['query'][_0xa63a('0x45')]){_0x28b59e[_0xa63a('0x40')]=_[_0xa63a('0x43')](_0x28b59e[_0xa63a('0x40')],{'$or':_[_0xa63a('0x2f')](_0x28b59e[_0xa63a('0x39')],function(_0x5a1a62){var _0x545dd5={};_0x545dd5[_0x5a1a62]={'$like':'%'+_0x408d44['query']['filter']+'%'};return _0x545dd5;})});}_0x28b59e=_['merge']({},_0x28b59e,_0x408d44[_0xa63a('0x46')]);return _0x25e0ce['getSubjects'](_0x28b59e);}})[_0xa63a('0x29')](function(_0x1bf1f5){if(_0x1bf1f5){_0x123591=_0x1bf1f5[_0xa63a('0x3b')];if(!_0x408d44[_0xa63a('0x36')][_0xa63a('0x3c')](_0xa63a('0x3d'))){_0x28b59e['limit']=qs[_0xa63a('0x20')](_0x408d44[_0xa63a('0x36')][_0xa63a('0x20')]);_0x28b59e[_0xa63a('0x1f')]=qs['offset'](_0x408d44[_0xa63a('0x36')][_0xa63a('0x1f')]);}return _0x25e0ce['getSubjects'](_0x28b59e);}})[_0xa63a('0x29')](function(_0x53ab8e){if(_0x53ab8e){return _0x53ab8e?{'count':_0x123591,'rows':_0x53ab8e}:null;}})['then'](respondWithResult(_0x30a227,null))[_0xa63a('0x4b')](handleError(_0x30a227,null));};exports[_0xa63a('0x54')]=function(_0x153d3d,_0x10b3e8,_0x15b651){var _0x16068f={};var _0x233d68={};var _0x2597bd;var _0x2efafd;return db[_0xa63a('0x30')][_0xa63a('0x55')]({'where':{'id':_0x153d3d[_0xa63a('0x4d')]['id']}})[_0xa63a('0x29')](handleEntityNotFound(_0x10b3e8,null))['then'](function(_0x556207){if(_0x556207){_0x2597bd=_0x556207;_0x233d68[_0xa63a('0x35')]=_[_0xa63a('0x37')](db[_0xa63a('0x51')]['rawAttributes']);_0x233d68['query']=_[_0xa63a('0x37')](_0x153d3d[_0xa63a('0x36')]);_0x233d68[_0xa63a('0x41')]=_['intersection'](_0x233d68['model'],_0x233d68[_0xa63a('0x36')]);_0x16068f['attributes']=_[_0xa63a('0x38')](_0x233d68[_0xa63a('0x35')],qs['fields'](_0x153d3d[_0xa63a('0x36')][_0xa63a('0x3a')]));_0x16068f[_0xa63a('0x39')]=_0x16068f[_0xa63a('0x39')][_0xa63a('0x3b')]?_0x16068f[_0xa63a('0x39')]:_0x233d68[_0xa63a('0x35')];_0x16068f['order']=qs[_0xa63a('0x3f')](_0x153d3d[_0xa63a('0x36')][_0xa63a('0x3f')]);_0x16068f[_0xa63a('0x40')]=qs['filters'](_['pick'](_0x153d3d[_0xa63a('0x36')],_0x233d68[_0xa63a('0x41')]));if(_0x153d3d[_0xa63a('0x36')][_0xa63a('0x45')]){_0x16068f[_0xa63a('0x40')]=_['merge'](_0x16068f[_0xa63a('0x40')],{'$or':_[_0xa63a('0x2f')](_0x16068f[_0xa63a('0x39')],function(_0x533a8d){var _0x4e3045={};_0x4e3045[_0x533a8d]={'$like':'%'+_0x153d3d['query'][_0xa63a('0x45')]+'%'};return _0x4e3045;})});}_0x16068f=_[_0xa63a('0x43')]({},_0x16068f,_0x153d3d[_0xa63a('0x46')]);return _0x2597bd['getDescriptions'](_0x16068f);}})[_0xa63a('0x29')](function(_0x1b3c26){if(_0x1b3c26){_0x2efafd=_0x1b3c26['length'];if(!_0x153d3d[_0xa63a('0x36')][_0xa63a('0x3c')](_0xa63a('0x3d'))){_0x16068f[_0xa63a('0x20')]=qs[_0xa63a('0x20')](_0x153d3d[_0xa63a('0x36')][_0xa63a('0x20')]);_0x16068f[_0xa63a('0x1f')]=qs['offset'](_0x153d3d[_0xa63a('0x36')]['offset']);}return _0x2597bd['getDescriptions'](_0x16068f);}})[_0xa63a('0x29')](function(_0x1c8573){if(_0x1c8573){return _0x1c8573?{'count':_0x2efafd,'rows':_0x1c8573}:null;}})[_0xa63a('0x29')](respondWithResult(_0x10b3e8,null))[_0xa63a('0x4b')](handleError(_0x10b3e8,null));}; \ No newline at end of file +var _0x1cc9=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','catch','params','include','create','body','find','getFields','SugarcrmField','findOne','getDescriptions','rimraf','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'];(function(_0x3d8a41,_0x2b0fbe){var _0x28675e=function(_0x222859){while(--_0x222859){_0x3d8a41['push'](_0x3d8a41['shift']());}};_0x28675e(++_0x2b0fbe);}(_0x1cc9,0x12e));var _0x91cc=function(_0x2867a7,_0x5dc488){_0x2867a7=_0x2867a7-0x0;var _0x411774=_0x1cc9[_0x2867a7];return _0x411774;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x91cc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x91cc('0x1'));var rp=require(_0x91cc('0x2'));var moment=require(_0x91cc('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x91cc('0x4'));var path=require('path');var sox=require(_0x91cc('0x5'));var csv=require(_0x91cc('0x6'));var ejs=require(_0x91cc('0x7'));var fs=require('fs');var fs_extra=require(_0x91cc('0x8'));var _=require(_0x91cc('0x9'));var squel=require(_0x91cc('0xa'));var crypto=require(_0x91cc('0xb'));var jsforce=require(_0x91cc('0xc'));var deskjs=require(_0x91cc('0xd'));var toCsv=require(_0x91cc('0x6'));var querystring=require(_0x91cc('0xe'));var Papa=require(_0x91cc('0xf'));var Redis=require(_0x91cc('0x10'));var authService=require(_0x91cc('0x11'));var qs=require(_0x91cc('0x12'));var as=require(_0x91cc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x91cc('0x14'))(_0x91cc('0x15'));var utils=require(_0x91cc('0x16'));var config=require(_0x91cc('0x17'));var licenseUtil=require(_0x91cc('0x18'));var db=require(_0x91cc('0x19'))['db'];function respondWithStatusCode(_0x595fd1,_0x3587c9){_0x3587c9=_0x3587c9||0xcc;return function(_0xf36c9){if(_0xf36c9){return _0x595fd1[_0x91cc('0x1a')](_0x3587c9);}return _0x595fd1[_0x91cc('0x1b')](_0x3587c9)['end']();};}function respondWithResult(_0x54ec47,_0x48c173){_0x48c173=_0x48c173||0xc8;return function(_0x44e092){if(_0x44e092){return _0x54ec47[_0x91cc('0x1b')](_0x48c173)[_0x91cc('0x1c')](_0x44e092);}};}function respondWithFilteredResult(_0x56d025,_0x9dbe43){return function(_0x2f983b){if(_0x2f983b){var _0x40da74=typeof _0x9dbe43[_0x91cc('0x1d')]===_0x91cc('0x1e')&&typeof _0x9dbe43['limit']===_0x91cc('0x1e');var _0x5d3af9=_0x2f983b['count'];var _0x49c1da=_0x40da74?0x0:_0x9dbe43[_0x91cc('0x1d')];var _0x342f50=_0x40da74?_0x2f983b['count']:_0x9dbe43[_0x91cc('0x1d')]+_0x9dbe43[_0x91cc('0x1f')];var _0x319e7d;if(_0x342f50>=_0x5d3af9){_0x342f50=_0x5d3af9;_0x319e7d=0xc8;}else{_0x319e7d=0xce;}_0x56d025[_0x91cc('0x1b')](_0x319e7d);return _0x56d025[_0x91cc('0x20')](_0x91cc('0x21'),_0x49c1da+'-'+_0x342f50+'/'+_0x5d3af9)[_0x91cc('0x1c')](_0x2f983b);}return null;};}function patchUpdates(_0x239ae6){return function(_0x30a635){try{jsonpatch[_0x91cc('0x22')](_0x30a635,_0x239ae6,!![]);}catch(_0x49fffc){return BPromise['reject'](_0x49fffc);}return _0x30a635[_0x91cc('0x23')]();};}function saveUpdates(_0x27d97f,_0x5c35ae){return function(_0x121683){if(_0x121683){return _0x121683[_0x91cc('0x24')](_0x27d97f)['then'](function(_0x133252){return _0x133252;});}return null;};}function removeEntity(_0x3b6030,_0x452ddd){return function(_0x3f622e){if(_0x3f622e){return _0x3f622e[_0x91cc('0x25')]()[_0x91cc('0x26')](function(){_0x3b6030[_0x91cc('0x1b')](0xcc)[_0x91cc('0x27')]();});}};}function handleEntityNotFound(_0xd5c6a7,_0x507a62){return function(_0x2e93a4){if(!_0x2e93a4){_0xd5c6a7[_0x91cc('0x1a')](0x194);}return _0x2e93a4;};}function handleError(_0x36acd1,_0x47a3f3){_0x47a3f3=_0x47a3f3||0x1f4;return function(_0x4056c6){logger[_0x91cc('0x28')](_0x4056c6[_0x91cc('0x29')]);if(_0x4056c6[_0x91cc('0x2a')]){delete _0x4056c6[_0x91cc('0x2a')];}_0x36acd1[_0x91cc('0x1b')](_0x47a3f3)[_0x91cc('0x2b')](_0x4056c6);};}exports[_0x91cc('0x2c')]=function(_0x5de942,_0x6f4cf6){var _0x1baadb={},_0x1c1f8d={},_0x2ad8d9={'count':0x0,'rows':[]};var _0x224ee6=_[_0x91cc('0x2d')](db[_0x91cc('0x2e')][_0x91cc('0x2f')],function(_0x1dcf38){return{'name':_0x1dcf38['fieldName'],'type':_0x1dcf38[_0x91cc('0x30')]['key']};});_0x1c1f8d[_0x91cc('0x31')]=_[_0x91cc('0x2d')](_0x224ee6,_0x91cc('0x2a'));_0x1c1f8d['query']=_[_0x91cc('0x32')](_0x5de942[_0x91cc('0x33')]);_0x1c1f8d['filters']=_[_0x91cc('0x34')](_0x1c1f8d[_0x91cc('0x31')],_0x1c1f8d[_0x91cc('0x33')]);_0x1baadb[_0x91cc('0x35')]=_['intersection'](_0x1c1f8d[_0x91cc('0x31')],qs[_0x91cc('0x36')](_0x5de942['query']['fields']));_0x1baadb[_0x91cc('0x35')]=_0x1baadb[_0x91cc('0x35')][_0x91cc('0x37')]?_0x1baadb[_0x91cc('0x35')]:_0x1c1f8d[_0x91cc('0x31')];if(!_0x5de942[_0x91cc('0x33')][_0x91cc('0x38')](_0x91cc('0x39'))){_0x1baadb['limit']=qs[_0x91cc('0x1f')](_0x5de942[_0x91cc('0x33')][_0x91cc('0x1f')]);_0x1baadb[_0x91cc('0x1d')]=qs[_0x91cc('0x1d')](_0x5de942[_0x91cc('0x33')]['offset']);}_0x1baadb[_0x91cc('0x3a')]=qs[_0x91cc('0x3b')](_0x5de942[_0x91cc('0x33')][_0x91cc('0x3b')]);_0x1baadb[_0x91cc('0x3c')]=qs[_0x91cc('0x3d')](_[_0x91cc('0x3e')](_0x5de942[_0x91cc('0x33')],_0x1c1f8d[_0x91cc('0x3d')]),_0x224ee6);if(_0x5de942[_0x91cc('0x33')]['filter']){_0x1baadb[_0x91cc('0x3c')]=_[_0x91cc('0x3f')](_0x1baadb[_0x91cc('0x3c')],{'$or':_[_0x91cc('0x2d')](_0x224ee6,function(_0x50dcf8){if(_0x50dcf8['type']!==_0x91cc('0x40')){var _0x5f1525={};_0x5f1525[_0x50dcf8[_0x91cc('0x2a')]]={'$like':'%'+_0x5de942[_0x91cc('0x33')][_0x91cc('0x41')]+'%'};return _0x5f1525;}})});}_0x1baadb=_['merge']({},_0x1baadb,_0x5de942[_0x91cc('0x42')]);var _0x4665c4={'where':_0x1baadb[_0x91cc('0x3c')]};return db[_0x91cc('0x2e')]['count'](_0x4665c4)['then'](function(_0x20c254){_0x2ad8d9[_0x91cc('0x43')]=_0x20c254;if(_0x5de942[_0x91cc('0x33')][_0x91cc('0x44')]){_0x1baadb['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x91cc('0x45')](_0x1baadb);})[_0x91cc('0x26')](function(_0x225691){_0x2ad8d9['rows']=_0x225691;return _0x2ad8d9;})[_0x91cc('0x26')](respondWithFilteredResult(_0x6f4cf6,_0x1baadb))[_0x91cc('0x46')](handleError(_0x6f4cf6,null));};exports['show']=function(_0x3227af,_0x38ee1f){var _0x4c1fb={'raw':![],'where':{'id':_0x3227af[_0x91cc('0x47')]['id']}},_0x10bdce={};_0x10bdce[_0x91cc('0x31')]=_[_0x91cc('0x32')](db['SugarcrmConfiguration']['rawAttributes']);_0x10bdce[_0x91cc('0x33')]=_[_0x91cc('0x32')](_0x3227af[_0x91cc('0x33')]);_0x10bdce[_0x91cc('0x3d')]=_[_0x91cc('0x34')](_0x10bdce[_0x91cc('0x31')],_0x10bdce[_0x91cc('0x33')]);_0x4c1fb[_0x91cc('0x35')]=_['intersection'](_0x10bdce[_0x91cc('0x31')],qs['fields'](_0x3227af[_0x91cc('0x33')][_0x91cc('0x36')]));_0x4c1fb['attributes']=_0x4c1fb['attributes'][_0x91cc('0x37')]?_0x4c1fb['attributes']:_0x10bdce[_0x91cc('0x31')];if(_0x3227af[_0x91cc('0x33')][_0x91cc('0x44')]){_0x4c1fb[_0x91cc('0x48')]=[{'all':!![]}];}_0x4c1fb=_[_0x91cc('0x3f')]({},_0x4c1fb,_0x3227af[_0x91cc('0x42')]);return db[_0x91cc('0x2e')]['find'](_0x4c1fb)[_0x91cc('0x26')](handleEntityNotFound(_0x38ee1f,null))['then'](respondWithResult(_0x38ee1f,null))[_0x91cc('0x46')](handleError(_0x38ee1f,null));};exports[_0x91cc('0x49')]=function(_0x8641b6,_0x2d0b37){return db[_0x91cc('0x2e')][_0x91cc('0x49')](_0x8641b6[_0x91cc('0x4a')],{})[_0x91cc('0x26')](respondWithResult(_0x2d0b37,0xc9))[_0x91cc('0x46')](handleError(_0x2d0b37,null));};exports[_0x91cc('0x24')]=function(_0x15b217,_0x54efa2){if(_0x15b217[_0x91cc('0x4a')]['id']){delete _0x15b217['body']['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x15b217[_0x91cc('0x47')]['id']}})[_0x91cc('0x26')](handleEntityNotFound(_0x54efa2,null))['then'](saveUpdates(_0x15b217[_0x91cc('0x4a')],null))[_0x91cc('0x26')](respondWithResult(_0x54efa2,null))[_0x91cc('0x46')](handleError(_0x54efa2,null));};exports[_0x91cc('0x25')]=function(_0x5d5df1,_0x344327){return db[_0x91cc('0x2e')][_0x91cc('0x4b')]({'where':{'id':_0x5d5df1[_0x91cc('0x47')]['id']}})[_0x91cc('0x26')](handleEntityNotFound(_0x344327,null))['then'](removeEntity(_0x344327,null))[_0x91cc('0x46')](handleError(_0x344327,null));};exports[_0x91cc('0x4c')]=function(_0x4a4fc7,_0x3b2ef5,_0x5664e5){var _0x281ea5={};var _0x42c218={};var _0x53a9b5;var _0xab61ff;return db[_0x91cc('0x2e')]['findOne']({'where':{'id':_0x4a4fc7[_0x91cc('0x47')]['id']}})[_0x91cc('0x26')](handleEntityNotFound(_0x3b2ef5,null))[_0x91cc('0x26')](function(_0x377bca){if(_0x377bca){_0x53a9b5=_0x377bca;_0x42c218[_0x91cc('0x31')]=_[_0x91cc('0x32')](db[_0x91cc('0x4d')][_0x91cc('0x2f')]);_0x42c218[_0x91cc('0x33')]=_[_0x91cc('0x32')](_0x4a4fc7[_0x91cc('0x33')]);_0x42c218[_0x91cc('0x3d')]=_[_0x91cc('0x34')](_0x42c218[_0x91cc('0x31')],_0x42c218[_0x91cc('0x33')]);_0x281ea5[_0x91cc('0x35')]=_[_0x91cc('0x34')](_0x42c218[_0x91cc('0x31')],qs[_0x91cc('0x36')](_0x4a4fc7[_0x91cc('0x33')][_0x91cc('0x36')]));_0x281ea5[_0x91cc('0x35')]=_0x281ea5[_0x91cc('0x35')][_0x91cc('0x37')]?_0x281ea5[_0x91cc('0x35')]:_0x42c218['model'];_0x281ea5[_0x91cc('0x3a')]=qs[_0x91cc('0x3b')](_0x4a4fc7[_0x91cc('0x33')]['sort']);_0x281ea5[_0x91cc('0x3c')]=qs[_0x91cc('0x3d')](_['pick'](_0x4a4fc7['query'],_0x42c218['filters']));if(_0x4a4fc7[_0x91cc('0x33')]['filter']){_0x281ea5[_0x91cc('0x3c')]=_[_0x91cc('0x3f')](_0x281ea5[_0x91cc('0x3c')],{'$or':_[_0x91cc('0x2d')](_0x281ea5['attributes'],function(_0x52162c){var _0x2a8902={};_0x2a8902[_0x52162c]={'$like':'%'+_0x4a4fc7[_0x91cc('0x33')]['filter']+'%'};return _0x2a8902;})});}_0x281ea5=_[_0x91cc('0x3f')]({},_0x281ea5,_0x4a4fc7[_0x91cc('0x42')]);return _0x53a9b5['getFields'](_0x281ea5);}})[_0x91cc('0x26')](function(_0x202cc9){if(_0x202cc9){_0xab61ff=_0x202cc9[_0x91cc('0x37')];if(!_0x4a4fc7[_0x91cc('0x33')][_0x91cc('0x38')](_0x91cc('0x39'))){_0x281ea5[_0x91cc('0x1f')]=qs[_0x91cc('0x1f')](_0x4a4fc7[_0x91cc('0x33')][_0x91cc('0x1f')]);_0x281ea5[_0x91cc('0x1d')]=qs[_0x91cc('0x1d')](_0x4a4fc7[_0x91cc('0x33')][_0x91cc('0x1d')]);}return _0x53a9b5[_0x91cc('0x4c')](_0x281ea5);}})[_0x91cc('0x26')](function(_0x42b88e){if(_0x42b88e){return _0x42b88e?{'count':_0xab61ff,'rows':_0x42b88e}:null;}})['then'](respondWithResult(_0x3b2ef5,null))[_0x91cc('0x46')](handleError(_0x3b2ef5,null));};exports['getSubjects']=function(_0x434e48,_0x1ae3bd,_0x9aa9a9){var _0x440e2d={};var _0x9321e9={};var _0x1e5ada;var _0x1c2651;return db['SugarcrmConfiguration'][_0x91cc('0x4e')]({'where':{'id':_0x434e48[_0x91cc('0x47')]['id']}})[_0x91cc('0x26')](handleEntityNotFound(_0x1ae3bd,null))[_0x91cc('0x26')](function(_0x327a24){if(_0x327a24){_0x1e5ada=_0x327a24;_0x9321e9[_0x91cc('0x31')]=_['keys'](db[_0x91cc('0x4d')][_0x91cc('0x2f')]);_0x9321e9[_0x91cc('0x33')]=_[_0x91cc('0x32')](_0x434e48['query']);_0x9321e9[_0x91cc('0x3d')]=_[_0x91cc('0x34')](_0x9321e9[_0x91cc('0x31')],_0x9321e9['query']);_0x440e2d[_0x91cc('0x35')]=_[_0x91cc('0x34')](_0x9321e9[_0x91cc('0x31')],qs[_0x91cc('0x36')](_0x434e48[_0x91cc('0x33')][_0x91cc('0x36')]));_0x440e2d['attributes']=_0x440e2d[_0x91cc('0x35')][_0x91cc('0x37')]?_0x440e2d['attributes']:_0x9321e9[_0x91cc('0x31')];_0x440e2d['order']=qs['sort'](_0x434e48[_0x91cc('0x33')][_0x91cc('0x3b')]);_0x440e2d[_0x91cc('0x3c')]=qs[_0x91cc('0x3d')](_[_0x91cc('0x3e')](_0x434e48[_0x91cc('0x33')],_0x9321e9[_0x91cc('0x3d')]));if(_0x434e48['query'][_0x91cc('0x41')]){_0x440e2d[_0x91cc('0x3c')]=_[_0x91cc('0x3f')](_0x440e2d['where'],{'$or':_[_0x91cc('0x2d')](_0x440e2d['attributes'],function(_0x31d215){var _0x505d87={};_0x505d87[_0x31d215]={'$like':'%'+_0x434e48[_0x91cc('0x33')]['filter']+'%'};return _0x505d87;})});}_0x440e2d=_[_0x91cc('0x3f')]({},_0x440e2d,_0x434e48['options']);return _0x1e5ada['getSubjects'](_0x440e2d);}})[_0x91cc('0x26')](function(_0x24e71e){if(_0x24e71e){_0x1c2651=_0x24e71e['length'];if(!_0x434e48[_0x91cc('0x33')][_0x91cc('0x38')](_0x91cc('0x39'))){_0x440e2d[_0x91cc('0x1f')]=qs[_0x91cc('0x1f')](_0x434e48['query'][_0x91cc('0x1f')]);_0x440e2d[_0x91cc('0x1d')]=qs[_0x91cc('0x1d')](_0x434e48[_0x91cc('0x33')][_0x91cc('0x1d')]);}return _0x1e5ada['getSubjects'](_0x440e2d);}})[_0x91cc('0x26')](function(_0x257305){if(_0x257305){return _0x257305?{'count':_0x1c2651,'rows':_0x257305}:null;}})[_0x91cc('0x26')](respondWithResult(_0x1ae3bd,null))[_0x91cc('0x46')](handleError(_0x1ae3bd,null));};exports[_0x91cc('0x4f')]=function(_0x199cbf,_0x5b17b5,_0x51fbf6){var _0x1796ff={};var _0x3c7660={};var _0xc3386f;var _0x93570f;return db[_0x91cc('0x2e')][_0x91cc('0x4e')]({'where':{'id':_0x199cbf[_0x91cc('0x47')]['id']}})[_0x91cc('0x26')](handleEntityNotFound(_0x5b17b5,null))[_0x91cc('0x26')](function(_0x3e15b1){if(_0x3e15b1){_0xc3386f=_0x3e15b1;_0x3c7660[_0x91cc('0x31')]=_[_0x91cc('0x32')](db[_0x91cc('0x4d')]['rawAttributes']);_0x3c7660[_0x91cc('0x33')]=_[_0x91cc('0x32')](_0x199cbf['query']);_0x3c7660['filters']=_[_0x91cc('0x34')](_0x3c7660[_0x91cc('0x31')],_0x3c7660['query']);_0x1796ff[_0x91cc('0x35')]=_['intersection'](_0x3c7660['model'],qs[_0x91cc('0x36')](_0x199cbf[_0x91cc('0x33')]['fields']));_0x1796ff[_0x91cc('0x35')]=_0x1796ff[_0x91cc('0x35')][_0x91cc('0x37')]?_0x1796ff[_0x91cc('0x35')]:_0x3c7660[_0x91cc('0x31')];_0x1796ff['order']=qs['sort'](_0x199cbf['query'][_0x91cc('0x3b')]);_0x1796ff[_0x91cc('0x3c')]=qs[_0x91cc('0x3d')](_[_0x91cc('0x3e')](_0x199cbf[_0x91cc('0x33')],_0x3c7660[_0x91cc('0x3d')]));if(_0x199cbf[_0x91cc('0x33')][_0x91cc('0x41')]){_0x1796ff[_0x91cc('0x3c')]=_[_0x91cc('0x3f')](_0x1796ff[_0x91cc('0x3c')],{'$or':_[_0x91cc('0x2d')](_0x1796ff[_0x91cc('0x35')],function(_0xdeddd8){var _0x2edd1a={};_0x2edd1a[_0xdeddd8]={'$like':'%'+_0x199cbf[_0x91cc('0x33')][_0x91cc('0x41')]+'%'};return _0x2edd1a;})});}_0x1796ff=_[_0x91cc('0x3f')]({},_0x1796ff,_0x199cbf['options']);return _0xc3386f[_0x91cc('0x4f')](_0x1796ff);}})[_0x91cc('0x26')](function(_0x4d4239){if(_0x4d4239){_0x93570f=_0x4d4239[_0x91cc('0x37')];if(!_0x199cbf[_0x91cc('0x33')][_0x91cc('0x38')]('nolimit')){_0x1796ff['limit']=qs[_0x91cc('0x1f')](_0x199cbf['query'][_0x91cc('0x1f')]);_0x1796ff['offset']=qs[_0x91cc('0x1d')](_0x199cbf['query'][_0x91cc('0x1d')]);}return _0xc3386f['getDescriptions'](_0x1796ff);}})['then'](function(_0x3ae46c){if(_0x3ae46c){return _0x3ae46c?{'count':_0x93570f,'rows':_0x3ae46c}:null;}})[_0x91cc('0x26')](respondWithResult(_0x5b17b5,null))['catch'](handleError(_0x5b17b5,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 70d0872..bbd651d 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 _0x8f80=['./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x5d84ac,_0x42f37b){var _0x3639b2=function(_0x5f33f0){while(--_0x5f33f0){_0x5d84ac['push'](_0x5d84ac['shift']());}};_0x3639b2(++_0x42f37b);}(_0x8f80,0xa4));var _0x08f8=function(_0x5d3e5f,_0x2cb9b1){_0x5d3e5f=_0x5d3e5f-0x0;var _0x4e7f76=_0x8f80[_0x5d3e5f];return _0x4e7f76;};'use strict';var _=require('lodash');var util=require(_0x08f8('0x0'));var logger=require(_0x08f8('0x1'))('api');var moment=require(_0x08f8('0x2'));var BPromise=require(_0x08f8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x08f8('0x4'));var rimraf=require('rimraf');var config=require(_0x08f8('0x5'));var attributes=require(_0x08f8('0x6'));module['exports']=function(_0x581f91,_0x294809){return _0x581f91[_0x08f8('0x7')](_0x08f8('0x8'),attributes,{'tableName':_0x08f8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ff4=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3ff4,0x79));var _0x43ff=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x3ff4[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x43ff('0x0'));var util=require(_0x43ff('0x1'));var logger=require(_0x43ff('0x2'))('api');var moment=require(_0x43ff('0x3'));var BPromise=require(_0x43ff('0x4'));var rp=require(_0x43ff('0x5'));var fs=require('fs');var path=require(_0x43ff('0x6'));var rimraf=require('rimraf');var config=require(_0x43ff('0x7'));var attributes=require(_0x43ff('0x8'));module['exports']=function(_0xbf79a1,_0xfd454e){return _0xbf79a1['define'](_0x43ff('0x9'),attributes,{'tableName':_0x43ff('0xa'),'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 38c78a4..36be849 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 _0x5866=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x38b6e4,_0xb3ff93){var _0x368e87=function(_0x8e20e2){while(--_0x8e20e2){_0x38b6e4['push'](_0x38b6e4['shift']());}};_0x368e87(++_0xb3ff93);}(_0x5866,0x71));var _0x6586=function(_0x23921e,_0xb87db1){_0x23921e=_0x23921e-0x0;var _0x41a9c0=_0x5866[_0x23921e];return _0x41a9c0;};'use strict';var _=require(_0x6586('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6586('0x1'));var rs=require(_0x6586('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6586('0x3'))['db'];var utils=require(_0x6586('0x4'));var logger=require(_0x6586('0x5'))('rpc');var config=require(_0x6586('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6586('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4768fd,_0x238101,_0x21dab7){return new BPromise(function(_0x489363,_0x50dab0){return client[_0x6586('0x8')](_0x4768fd,_0x21dab7)[_0x6586('0x9')](function(_0x3a3040){logger[_0x6586('0xa')](_0x6586('0xb'),_0x238101,_0x6586('0xc'));logger[_0x6586('0xd')](_0x6586('0xe'),_0x238101,_0x6586('0xc'),JSON[_0x6586('0xf')](_0x3a3040));if(_0x3a3040[_0x6586('0x10')]){if(_0x3a3040[_0x6586('0x10')][_0x6586('0x11')]===0x1f4){logger[_0x6586('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x238101,_0x3a3040[_0x6586('0x10')][_0x6586('0x12')]);return _0x50dab0(_0x3a3040[_0x6586('0x10')][_0x6586('0x12')]);}logger[_0x6586('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x238101,_0x3a3040[_0x6586('0x10')]['message']);return _0x489363(_0x3a3040[_0x6586('0x10')][_0x6586('0x12')]);}else{logger[_0x6586('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x238101,_0x6586('0xc'));_0x489363(_0x3a3040[_0x6586('0x13')]['message']);}})[_0x6586('0x14')](function(_0xda6849){logger[_0x6586('0x10')](_0x6586('0xb'),_0x238101,_0xda6849);_0x50dab0(_0xda6849);});});} \ No newline at end of file +var _0x2560=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash'];(function(_0x5e2cb4,_0x592c64){var _0x282902=function(_0x1c1836){while(--_0x1c1836){_0x5e2cb4['push'](_0x5e2cb4['shift']());}};_0x282902(++_0x592c64);}(_0x2560,0x83));var _0x0256=function(_0x7a1e6b,_0x551951){_0x7a1e6b=_0x7a1e6b-0x0;var _0x3512ca=_0x2560[_0x7a1e6b];return _0x3512ca;};'use strict';var _=require(_0x0256('0x0'));var util=require('util');var moment=require(_0x0256('0x1'));var BPromise=require('bluebird');var rs=require(_0x0256('0x2'));var fs=require('fs');var Redis=require(_0x0256('0x3'));var db=require(_0x0256('0x4'))['db'];var utils=require(_0x0256('0x5'));var logger=require(_0x0256('0x6'))(_0x0256('0x7'));var config=require(_0x0256('0x8'));var jayson=require(_0x0256('0x9'));var client=jayson[_0x0256('0xa')][_0x0256('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1de967,_0xf71c6b,_0x1d480c){return new BPromise(function(_0x2b650b,_0x5125ee){return client[_0x0256('0xc')](_0x1de967,_0x1d480c)[_0x0256('0xd')](function(_0x1e9c6e){logger[_0x0256('0xe')](_0x0256('0xf'),_0xf71c6b,'request\x20sent');logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0xf71c6b,'request\x20sent',JSON[_0x0256('0x10')](_0x1e9c6e));if(_0x1e9c6e[_0x0256('0x11')]){if(_0x1e9c6e[_0x0256('0x11')][_0x0256('0x12')]===0x1f4){logger['error'](_0x0256('0xf'),_0xf71c6b,_0x1e9c6e['error'][_0x0256('0x13')]);return _0x5125ee(_0x1e9c6e[_0x0256('0x11')][_0x0256('0x13')]);}logger[_0x0256('0x11')](_0x0256('0xf'),_0xf71c6b,_0x1e9c6e[_0x0256('0x11')][_0x0256('0x13')]);return _0x2b650b(_0x1e9c6e[_0x0256('0x11')][_0x0256('0x13')]);}else{logger['info'](_0x0256('0xf'),_0xf71c6b,_0x0256('0x14'));_0x2b650b(_0x1e9c6e[_0x0256('0x15')][_0x0256('0x13')]);}})['catch'](function(_0x335464){logger[_0x0256('0x11')](_0x0256('0xf'),_0xf71c6b,_0x335464);_0x5125ee(_0x335464);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 13888d0..e983d58 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 _0x283b=['destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','delete'];(function(_0x429509,_0x5583c8){var _0x270127=function(_0x45f059){while(--_0x45f059){_0x429509['push'](_0x429509['shift']());}};_0x270127(++_0x5583c8);}(_0x283b,0x73));var _0xb283=function(_0x3a8e8f,_0x27ae2d){_0x3a8e8f=_0x3a8e8f-0x0;var _0x15845=_0x283b[_0x3a8e8f];return _0x15845;};'use strict';var multer=require(_0xb283('0x0'));var util=require(_0xb283('0x1'));var path=require(_0xb283('0x2'));var timeout=require('connect-timeout');var express=require(_0xb283('0x3'));var router=express[_0xb283('0x4')]();var fs_extra=require(_0xb283('0x5'));var auth=require(_0xb283('0x6'));var interaction=require(_0xb283('0x7'));var config=require(_0xb283('0x8'));var controller=require('./intSugarcrmField.controller');router[_0xb283('0x9')]('/',auth[_0xb283('0xa')](),controller[_0xb283('0xb')]);router[_0xb283('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb283('0xc')]);router[_0xb283('0xd')]('/',auth[_0xb283('0xa')](),controller[_0xb283('0xe')]);router[_0xb283('0xf')](_0xb283('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xb283('0x11')]('/:id',auth[_0xb283('0xa')](),controller[_0xb283('0x12')]);module['exports']=router; \ No newline at end of file +var _0xec85=['index','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x589bee,_0x3e06b9){var _0x58f126=function(_0x41b491){while(--_0x41b491){_0x589bee['push'](_0x589bee['shift']());}};_0x58f126(++_0x3e06b9);}(_0xec85,0x1d4));var _0x5ec8=function(_0x3a75ef,_0x237766){_0x3a75ef=_0x3a75ef-0x0;var _0x2a48e8=_0xec85[_0x3a75ef];return _0x2a48e8;};'use strict';var multer=require(_0x5ec8('0x0'));var util=require(_0x5ec8('0x1'));var path=require('path');var timeout=require(_0x5ec8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5ec8('0x3'));var auth=require(_0x5ec8('0x4'));var interaction=require(_0x5ec8('0x5'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0x5ec8('0x6')]('/',auth[_0x5ec8('0x7')](),controller[_0x5ec8('0x8')]);router[_0x5ec8('0x6')](_0x5ec8('0x9'),auth[_0x5ec8('0x7')](),controller[_0x5ec8('0xa')]);router['post']('/',auth[_0x5ec8('0x7')](),controller[_0x5ec8('0xb')]);router[_0x5ec8('0xc')](_0x5ec8('0x9'),auth[_0x5ec8('0x7')](),controller[_0x5ec8('0xd')]);router[_0x5ec8('0xe')](_0x5ec8('0x9'),auth[_0x5ec8('0x7')](),controller[_0x5ec8('0xf')]);module[_0x5ec8('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index c7154eb..8d80a0e 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 _0x8b98=['exports','variable','keyValue','picklist','STRING','ENUM','string','customVariable','sequelize'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x8b98,0x182));var _0x88b9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8b98[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x88b9('0x0'));module[_0x88b9('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x88b9('0x2'),'customVariable',_0x88b9('0x3'),_0x88b9('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x88b9('0x5')]},'key':{'type':Sequelize[_0x88b9('0x5')]},'keyType':{'type':Sequelize[_0x88b9('0x6')](_0x88b9('0x7'),_0x88b9('0x2'),_0x88b9('0x8'))},'keyContent':{'type':Sequelize[_0x88b9('0x5')]},'idField':{'type':Sequelize[_0x88b9('0x5')]},'nameField':{'type':Sequelize[_0x88b9('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x88b9('0x5')]}}; \ No newline at end of file +var _0x0fee=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x2c1b71,_0x386104){var _0x5efe6d=function(_0x561e92){while(--_0x561e92){_0x2c1b71['push'](_0x2c1b71['shift']());}};_0x5efe6d(++_0x386104);}(_0x0fee,0x1a3));var _0xe0fe=function(_0x815251,_0x267b8c){_0x815251=_0x815251-0x0;var _0x58201f=_0x0fee[_0x815251];return _0x58201f;};'use strict';var Sequelize=require(_0xe0fe('0x0'));module[_0xe0fe('0x1')]={'type':{'type':Sequelize[_0xe0fe('0x2')](_0xe0fe('0x3'),_0xe0fe('0x4'),_0xe0fe('0x5'),_0xe0fe('0x6'),'picklist'),'defaultValue':_0xe0fe('0x3')},'content':{'type':Sequelize[_0xe0fe('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xe0fe('0x3'),_0xe0fe('0x4'),_0xe0fe('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe0fe('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe0fe('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 2bd9176..6f56854 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 _0x36d9=['rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','SugarcrmField'];(function(_0x42fba1,_0x56485b){var _0x389e1c=function(_0x6f2bf9){while(--_0x6f2bf9){_0x42fba1['push'](_0x42fba1['shift']());}};_0x389e1c(++_0x56485b);}(_0x36d9,0x107));var _0x936d=function(_0x5512f2,_0x143d28){_0x5512f2=_0x5512f2-0x0;var _0x2abc87=_0x36d9[_0x5512f2];return _0x2abc87;};'use strict';var emlformat=require(_0x936d('0x0'));var rimraf=require(_0x936d('0x1'));var zipdir=require(_0x936d('0x2'));var jsonpatch=require(_0x936d('0x3'));var rp=require(_0x936d('0x4'));var moment=require(_0x936d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x936d('0x6'));var util=require(_0x936d('0x7'));var path=require(_0x936d('0x8'));var sox=require(_0x936d('0x9'));var csv=require(_0x936d('0xa'));var ejs=require(_0x936d('0xb'));var fs=require('fs');var fs_extra=require(_0x936d('0xc'));var _=require(_0x936d('0xd'));var squel=require('squel');var crypto=require(_0x936d('0xe'));var jsforce=require(_0x936d('0xf'));var deskjs=require(_0x936d('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x936d('0x11'));var Redis=require(_0x936d('0x12'));var authService=require(_0x936d('0x13'));var qs=require(_0x936d('0x14'));var as=require(_0x936d('0x15'));var hardwareService=require(_0x936d('0x16'));var logger=require(_0x936d('0x17'))(_0x936d('0x18'));var utils=require(_0x936d('0x19'));var config=require(_0x936d('0x1a'));var licenseUtil=require(_0x936d('0x1b'));var db=require(_0x936d('0x1c'))['db'];function respondWithStatusCode(_0x3b87aa,_0x8afa00){_0x8afa00=_0x8afa00||0xcc;return function(_0x56e116){if(_0x56e116){return _0x3b87aa['sendStatus'](_0x8afa00);}return _0x3b87aa['status'](_0x8afa00)[_0x936d('0x1d')]();};}function respondWithResult(_0x1cd323,_0x17c98c){_0x17c98c=_0x17c98c||0xc8;return function(_0x12ddca){if(_0x12ddca){return _0x1cd323[_0x936d('0x1e')](_0x17c98c)[_0x936d('0x1f')](_0x12ddca);}};}function respondWithFilteredResult(_0x35f896,_0x31db9f){return function(_0x2c133e){if(_0x2c133e){var _0x51b7c6=typeof _0x31db9f[_0x936d('0x20')]===_0x936d('0x21')&&typeof _0x31db9f['limit']===_0x936d('0x21');var _0x3a61d7=_0x2c133e[_0x936d('0x22')];var _0x3c0905=_0x51b7c6?0x0:_0x31db9f[_0x936d('0x20')];var _0x5138ad=_0x51b7c6?_0x2c133e[_0x936d('0x22')]:_0x31db9f[_0x936d('0x20')]+_0x31db9f[_0x936d('0x23')];var _0x5f03fe;if(_0x5138ad>=_0x3a61d7){_0x5138ad=_0x3a61d7;_0x5f03fe=0xc8;}else{_0x5f03fe=0xce;}_0x35f896[_0x936d('0x1e')](_0x5f03fe);return _0x35f896[_0x936d('0x24')]('Content-Range',_0x3c0905+'-'+_0x5138ad+'/'+_0x3a61d7)['json'](_0x2c133e);}return null;};}function patchUpdates(_0x1206cf){return function(_0x418e5d){try{jsonpatch[_0x936d('0x25')](_0x418e5d,_0x1206cf,!![]);}catch(_0x4e6300){return BPromise[_0x936d('0x26')](_0x4e6300);}return _0x418e5d['save']();};}function saveUpdates(_0x1d03fb,_0x281859){return function(_0xa76b0e){if(_0xa76b0e){return _0xa76b0e[_0x936d('0x27')](_0x1d03fb)[_0x936d('0x28')](function(_0x29f718){return _0x29f718;});}return null;};}function removeEntity(_0x31a07b,_0x3c5869){return function(_0x54a67b){if(_0x54a67b){return _0x54a67b[_0x936d('0x29')]()[_0x936d('0x28')](function(){_0x31a07b[_0x936d('0x1e')](0xcc)[_0x936d('0x1d')]();});}};}function handleEntityNotFound(_0xa23c25,_0x2714ce){return function(_0x4b60a7){if(!_0x4b60a7){_0xa23c25['sendStatus'](0x194);}return _0x4b60a7;};}function handleError(_0x202816,_0x471b58){_0x471b58=_0x471b58||0x1f4;return function(_0x2add35){logger[_0x936d('0x2a')](_0x2add35[_0x936d('0x2b')]);if(_0x2add35['name']){delete _0x2add35[_0x936d('0x2c')];}_0x202816['status'](_0x471b58)[_0x936d('0x2d')](_0x2add35);};}exports[_0x936d('0x2e')]=function(_0x472b13,_0x50f33b){var _0x302cad={},_0x787c95={},_0x2a2cc5={'count':0x0,'rows':[]};var _0x1f2ca9=_[_0x936d('0x2f')](db[_0x936d('0x30')][_0x936d('0x31')],function(_0x343d92){return{'name':_0x343d92[_0x936d('0x32')],'type':_0x343d92[_0x936d('0x33')][_0x936d('0x34')]};});_0x787c95[_0x936d('0x35')]=_['map'](_0x1f2ca9,_0x936d('0x2c'));_0x787c95['query']=_[_0x936d('0x36')](_0x472b13[_0x936d('0x37')]);_0x787c95[_0x936d('0x38')]=_[_0x936d('0x39')](_0x787c95[_0x936d('0x35')],_0x787c95[_0x936d('0x37')]);_0x302cad['attributes']=_[_0x936d('0x39')](_0x787c95[_0x936d('0x35')],qs[_0x936d('0x3a')](_0x472b13[_0x936d('0x37')]['fields']));_0x302cad['attributes']=_0x302cad[_0x936d('0x3b')][_0x936d('0x3c')]?_0x302cad['attributes']:_0x787c95[_0x936d('0x35')];if(!_0x472b13[_0x936d('0x37')][_0x936d('0x3d')]('nolimit')){_0x302cad[_0x936d('0x23')]=qs[_0x936d('0x23')](_0x472b13[_0x936d('0x37')][_0x936d('0x23')]);_0x302cad['offset']=qs[_0x936d('0x20')](_0x472b13[_0x936d('0x37')][_0x936d('0x20')]);}_0x302cad[_0x936d('0x3e')]=qs[_0x936d('0x3f')](_0x472b13[_0x936d('0x37')][_0x936d('0x3f')]);_0x302cad[_0x936d('0x40')]=qs[_0x936d('0x38')](_[_0x936d('0x41')](_0x472b13[_0x936d('0x37')],_0x787c95[_0x936d('0x38')]),_0x1f2ca9);if(_0x472b13['query'][_0x936d('0x42')]){_0x302cad[_0x936d('0x40')]=_[_0x936d('0x43')](_0x302cad['where'],{'$or':_['map'](_0x1f2ca9,function(_0xf86742){if(_0xf86742['type']!==_0x936d('0x44')){var _0x1ccc5a={};_0x1ccc5a[_0xf86742[_0x936d('0x2c')]]={'$like':'%'+_0x472b13[_0x936d('0x37')]['filter']+'%'};return _0x1ccc5a;}})});}_0x302cad=_[_0x936d('0x43')]({},_0x302cad,_0x472b13[_0x936d('0x45')]);var _0x1c8e84={'where':_0x302cad[_0x936d('0x40')]};return db['SugarcrmField'][_0x936d('0x22')](_0x1c8e84)['then'](function(_0x5e30a3){_0x2a2cc5['count']=_0x5e30a3;if(_0x472b13[_0x936d('0x37')][_0x936d('0x46')]){_0x302cad['include']=[{'all':!![]}];}return db[_0x936d('0x30')][_0x936d('0x47')](_0x302cad);})['then'](function(_0x1abd31){_0x2a2cc5[_0x936d('0x48')]=_0x1abd31;return _0x2a2cc5;})[_0x936d('0x28')](respondWithFilteredResult(_0x50f33b,_0x302cad))[_0x936d('0x49')](handleError(_0x50f33b,null));};exports['show']=function(_0x5924d8,_0x8421fd){var _0x1ceae0={'raw':!![],'where':{'id':_0x5924d8[_0x936d('0x4a')]['id']}},_0x281c95={};_0x281c95[_0x936d('0x35')]=_['keys'](db[_0x936d('0x30')]['rawAttributes']);_0x281c95[_0x936d('0x37')]=_[_0x936d('0x36')](_0x5924d8[_0x936d('0x37')]);_0x281c95[_0x936d('0x38')]=_[_0x936d('0x39')](_0x281c95[_0x936d('0x35')],_0x281c95[_0x936d('0x37')]);_0x1ceae0[_0x936d('0x3b')]=_[_0x936d('0x39')](_0x281c95[_0x936d('0x35')],qs[_0x936d('0x3a')](_0x5924d8['query']['fields']));_0x1ceae0['attributes']=_0x1ceae0[_0x936d('0x3b')][_0x936d('0x3c')]?_0x1ceae0[_0x936d('0x3b')]:_0x281c95[_0x936d('0x35')];if(_0x5924d8[_0x936d('0x37')][_0x936d('0x46')]){_0x1ceae0['include']=[{'all':!![]}];}_0x1ceae0=_[_0x936d('0x43')]({},_0x1ceae0,_0x5924d8[_0x936d('0x45')]);return db[_0x936d('0x30')][_0x936d('0x4b')](_0x1ceae0)[_0x936d('0x28')](handleEntityNotFound(_0x8421fd,null))[_0x936d('0x28')](respondWithResult(_0x8421fd,null))['catch'](handleError(_0x8421fd,null));};exports[_0x936d('0x4c')]=function(_0xda8d88,_0x338c2a){return db['SugarcrmField'][_0x936d('0x4c')](_0xda8d88[_0x936d('0x4d')],{})['then'](respondWithResult(_0x338c2a,0xc9))[_0x936d('0x49')](handleError(_0x338c2a,null));};exports[_0x936d('0x27')]=function(_0x2bf0a1,_0x200011){if(_0x2bf0a1[_0x936d('0x4d')]['id']){delete _0x2bf0a1[_0x936d('0x4d')]['id'];}return db[_0x936d('0x30')][_0x936d('0x4b')]({'where':{'id':_0x2bf0a1[_0x936d('0x4a')]['id']}})[_0x936d('0x28')](handleEntityNotFound(_0x200011,null))[_0x936d('0x28')](saveUpdates(_0x2bf0a1[_0x936d('0x4d')],null))[_0x936d('0x28')](respondWithResult(_0x200011,null))[_0x936d('0x49')](handleError(_0x200011,null));};exports[_0x936d('0x29')]=function(_0x558a73,_0x4c5fa8){return db[_0x936d('0x30')][_0x936d('0x4b')]({'where':{'id':_0x558a73['params']['id']}})[_0x936d('0x28')](handleEntityNotFound(_0x4c5fa8,null))[_0x936d('0x28')](removeEntity(_0x4c5fa8,null))[_0x936d('0x49')](handleError(_0x4c5fa8,null));}; \ No newline at end of file +var _0xdafe=['reject','save','then','destroy','error','stack','send','map','SugarcrmField','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','include','findAll','catch','params','includeAll','create','body','find','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xdafe,0xad));var _0xedaf=function(_0x4a70d8,_0x80e111){_0x4a70d8=_0x4a70d8-0x0;var _0x2f03a5=_0xdafe[_0x4a70d8];return _0x2f03a5;};'use strict';var emlformat=require(_0xedaf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedaf('0x1'));var jsonpatch=require(_0xedaf('0x2'));var rp=require('request-promise');var moment=require(_0xedaf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xedaf('0x4'));var util=require(_0xedaf('0x5'));var path=require('path');var sox=require(_0xedaf('0x6'));var csv=require(_0xedaf('0x7'));var ejs=require(_0xedaf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xedaf('0x9'));var squel=require(_0xedaf('0xa'));var crypto=require(_0xedaf('0xb'));var jsforce=require(_0xedaf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xedaf('0x7'));var querystring=require('querystring');var Papa=require(_0xedaf('0xd'));var Redis=require('ioredis');var authService=require(_0xedaf('0xe'));var qs=require(_0xedaf('0xf'));var as=require(_0xedaf('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xedaf('0x11'))('api');var utils=require(_0xedaf('0x12'));var config=require(_0xedaf('0x13'));var licenseUtil=require(_0xedaf('0x14'));var db=require(_0xedaf('0x15'))['db'];function respondWithStatusCode(_0x519d9f,_0x49a402){_0x49a402=_0x49a402||0xcc;return function(_0x3fb09f){if(_0x3fb09f){return _0x519d9f[_0xedaf('0x16')](_0x49a402);}return _0x519d9f['status'](_0x49a402)['end']();};}function respondWithResult(_0x29d547,_0x1146de){_0x1146de=_0x1146de||0xc8;return function(_0x2d36d1){if(_0x2d36d1){return _0x29d547['status'](_0x1146de)[_0xedaf('0x17')](_0x2d36d1);}};}function respondWithFilteredResult(_0xc72a28,_0x5518f8){return function(_0x215741){if(_0x215741){var _0x78ecd3=typeof _0x5518f8[_0xedaf('0x18')]===_0xedaf('0x19')&&typeof _0x5518f8[_0xedaf('0x1a')]===_0xedaf('0x19');var _0x5dda67=_0x215741[_0xedaf('0x1b')];var _0x4848e1=_0x78ecd3?0x0:_0x5518f8[_0xedaf('0x18')];var _0x8e32b9=_0x78ecd3?_0x215741[_0xedaf('0x1b')]:_0x5518f8[_0xedaf('0x18')]+_0x5518f8[_0xedaf('0x1a')];var _0x30f23e;if(_0x8e32b9>=_0x5dda67){_0x8e32b9=_0x5dda67;_0x30f23e=0xc8;}else{_0x30f23e=0xce;}_0xc72a28[_0xedaf('0x1c')](_0x30f23e);return _0xc72a28[_0xedaf('0x1d')](_0xedaf('0x1e'),_0x4848e1+'-'+_0x8e32b9+'/'+_0x5dda67)[_0xedaf('0x17')](_0x215741);}return null;};}function patchUpdates(_0x2f25e3){return function(_0x4a4efb){try{jsonpatch['apply'](_0x4a4efb,_0x2f25e3,!![]);}catch(_0x2135a7){return BPromise[_0xedaf('0x1f')](_0x2135a7);}return _0x4a4efb[_0xedaf('0x20')]();};}function saveUpdates(_0x40b441,_0x86e2a9){return function(_0x2295cb){if(_0x2295cb){return _0x2295cb['update'](_0x40b441)[_0xedaf('0x21')](function(_0x4b8ccf){return _0x4b8ccf;});}return null;};}function removeEntity(_0x57f4b0,_0x115939){return function(_0x293264){if(_0x293264){return _0x293264[_0xedaf('0x22')]()['then'](function(){_0x57f4b0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3054c4,_0x15ad3f){return function(_0xc7c015){if(!_0xc7c015){_0x3054c4[_0xedaf('0x16')](0x194);}return _0xc7c015;};}function handleError(_0x5d8d61,_0x1fe0a1){_0x1fe0a1=_0x1fe0a1||0x1f4;return function(_0x48a442){logger[_0xedaf('0x23')](_0x48a442[_0xedaf('0x24')]);if(_0x48a442['name']){delete _0x48a442['name'];}_0x5d8d61['status'](_0x1fe0a1)[_0xedaf('0x25')](_0x48a442);};}exports['index']=function(_0xd2320d,_0x1b754b){var _0xfebf2f={},_0xe1c72f={},_0x4dd370={'count':0x0,'rows':[]};var _0x4bae2f=_[_0xedaf('0x26')](db[_0xedaf('0x27')][_0xedaf('0x28')],function(_0x40cdd0){return{'name':_0x40cdd0[_0xedaf('0x29')],'type':_0x40cdd0[_0xedaf('0x2a')]['key']};});_0xe1c72f[_0xedaf('0x2b')]=_[_0xedaf('0x26')](_0x4bae2f,_0xedaf('0x2c'));_0xe1c72f[_0xedaf('0x2d')]=_[_0xedaf('0x2e')](_0xd2320d[_0xedaf('0x2d')]);_0xe1c72f[_0xedaf('0x2f')]=_[_0xedaf('0x30')](_0xe1c72f[_0xedaf('0x2b')],_0xe1c72f[_0xedaf('0x2d')]);_0xfebf2f[_0xedaf('0x31')]=_['intersection'](_0xe1c72f[_0xedaf('0x2b')],qs['fields'](_0xd2320d[_0xedaf('0x2d')][_0xedaf('0x32')]));_0xfebf2f['attributes']=_0xfebf2f[_0xedaf('0x31')][_0xedaf('0x33')]?_0xfebf2f['attributes']:_0xe1c72f[_0xedaf('0x2b')];if(!_0xd2320d[_0xedaf('0x2d')][_0xedaf('0x34')]('nolimit')){_0xfebf2f['limit']=qs[_0xedaf('0x1a')](_0xd2320d['query'][_0xedaf('0x1a')]);_0xfebf2f['offset']=qs['offset'](_0xd2320d[_0xedaf('0x2d')][_0xedaf('0x18')]);}_0xfebf2f[_0xedaf('0x35')]=qs[_0xedaf('0x36')](_0xd2320d[_0xedaf('0x2d')]['sort']);_0xfebf2f[_0xedaf('0x37')]=qs[_0xedaf('0x2f')](_[_0xedaf('0x38')](_0xd2320d['query'],_0xe1c72f[_0xedaf('0x2f')]),_0x4bae2f);if(_0xd2320d[_0xedaf('0x2d')]['filter']){_0xfebf2f['where']=_[_0xedaf('0x39')](_0xfebf2f[_0xedaf('0x37')],{'$or':_[_0xedaf('0x26')](_0x4bae2f,function(_0x30f785){if(_0x30f785[_0xedaf('0x2a')]!=='VIRTUAL'){var _0x1a87c7={};_0x1a87c7[_0x30f785[_0xedaf('0x2c')]]={'$like':'%'+_0xd2320d[_0xedaf('0x2d')][_0xedaf('0x3a')]+'%'};return _0x1a87c7;}})});}_0xfebf2f=_['merge']({},_0xfebf2f,_0xd2320d[_0xedaf('0x3b')]);var _0x1d00d1={'where':_0xfebf2f[_0xedaf('0x37')]};return db[_0xedaf('0x27')][_0xedaf('0x1b')](_0x1d00d1)[_0xedaf('0x21')](function(_0x1b5ca7){_0x4dd370['count']=_0x1b5ca7;if(_0xd2320d[_0xedaf('0x2d')]['includeAll']){_0xfebf2f[_0xedaf('0x3c')]=[{'all':!![]}];}return db[_0xedaf('0x27')][_0xedaf('0x3d')](_0xfebf2f);})[_0xedaf('0x21')](function(_0x51ce46){_0x4dd370['rows']=_0x51ce46;return _0x4dd370;})[_0xedaf('0x21')](respondWithFilteredResult(_0x1b754b,_0xfebf2f))[_0xedaf('0x3e')](handleError(_0x1b754b,null));};exports['show']=function(_0x4fdbe7,_0x5b5709){var _0x56ad01={'raw':!![],'where':{'id':_0x4fdbe7[_0xedaf('0x3f')]['id']}},_0x13cd43={};_0x13cd43[_0xedaf('0x2b')]=_['keys'](db['SugarcrmField'][_0xedaf('0x28')]);_0x13cd43[_0xedaf('0x2d')]=_[_0xedaf('0x2e')](_0x4fdbe7[_0xedaf('0x2d')]);_0x13cd43[_0xedaf('0x2f')]=_[_0xedaf('0x30')](_0x13cd43['model'],_0x13cd43[_0xedaf('0x2d')]);_0x56ad01[_0xedaf('0x31')]=_['intersection'](_0x13cd43[_0xedaf('0x2b')],qs[_0xedaf('0x32')](_0x4fdbe7['query']['fields']));_0x56ad01['attributes']=_0x56ad01[_0xedaf('0x31')][_0xedaf('0x33')]?_0x56ad01[_0xedaf('0x31')]:_0x13cd43['model'];if(_0x4fdbe7[_0xedaf('0x2d')][_0xedaf('0x40')]){_0x56ad01[_0xedaf('0x3c')]=[{'all':!![]}];}_0x56ad01=_['merge']({},_0x56ad01,_0x4fdbe7[_0xedaf('0x3b')]);return db['SugarcrmField']['find'](_0x56ad01)[_0xedaf('0x21')](handleEntityNotFound(_0x5b5709,null))[_0xedaf('0x21')](respondWithResult(_0x5b5709,null))['catch'](handleError(_0x5b5709,null));};exports[_0xedaf('0x41')]=function(_0x29a797,_0x2e497f){return db[_0xedaf('0x27')][_0xedaf('0x41')](_0x29a797['body'],{})[_0xedaf('0x21')](respondWithResult(_0x2e497f,0xc9))[_0xedaf('0x3e')](handleError(_0x2e497f,null));};exports['update']=function(_0x194e46,_0x1ba833){if(_0x194e46[_0xedaf('0x42')]['id']){delete _0x194e46['body']['id'];}return db['SugarcrmField'][_0xedaf('0x43')]({'where':{'id':_0x194e46[_0xedaf('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1ba833,null))[_0xedaf('0x21')](saveUpdates(_0x194e46[_0xedaf('0x42')],null))[_0xedaf('0x21')](respondWithResult(_0x1ba833,null))[_0xedaf('0x3e')](handleError(_0x1ba833,null));};exports['destroy']=function(_0x35d30a,_0x42bc29){return db[_0xedaf('0x27')][_0xedaf('0x43')]({'where':{'id':_0x35d30a[_0xedaf('0x3f')]['id']}})[_0xedaf('0x21')](handleEntityNotFound(_0x42bc29,null))['then'](removeEntity(_0x42bc29,null))[_0xedaf('0x3e')](handleError(_0x42bc29,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index dbf8865..bd498f5 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 _0x55c8=['request-promise','path','./intSugarcrmField.attributes','define','SugarcrmField','sugarcrm_unique_index','FieldId','../../config/logger','api','moment'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x55c8,0x1c9));var _0x855c=function(_0x245a97,_0x56e624){_0x245a97=_0x245a97-0x0;var _0x207c07=_0x55c8[_0x245a97];return _0x207c07;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x855c('0x0'))(_0x855c('0x1'));var moment=require(_0x855c('0x2'));var BPromise=require('bluebird');var rp=require(_0x855c('0x3'));var fs=require('fs');var path=require(_0x855c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x855c('0x5'));module['exports']=function(_0x36f024,_0xc44fb2){return _0x36f024[_0x855c('0x6')](_0x855c('0x7'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x855c('0x8'),'fields':['idField',_0x855c('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x409d=['path','exports','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise'];(function(_0x48c5ca,_0x161b86){var _0x2eed15=function(_0x2d4e13){while(--_0x2d4e13){_0x48c5ca['push'](_0x48c5ca['shift']());}};_0x2eed15(++_0x161b86);}(_0x409d,0x74));var _0xd409=function(_0x50e5d1,_0x53b411){_0x50e5d1=_0x50e5d1-0x0;var _0x5bf46a=_0x409d[_0x50e5d1];return _0x5bf46a;};'use strict';var _=require(_0xd409('0x0'));var util=require(_0xd409('0x1'));var logger=require(_0xd409('0x2'))(_0xd409('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd409('0x4'));var fs=require('fs');var path=require(_0xd409('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0xd409('0x6')]=function(_0x3da0ae,_0x164886){return _0x3da0ae['define']('SugarcrmField',attributes,{'tableName':_0xd409('0x7'),'paranoid':![],'indexes':[{'name':_0xd409('0x8'),'fields':[_0xd409('0x9'),_0xd409('0xa')],'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 91f5186..0cf1344 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 _0x4184=['code','message','result','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4184,0xae));var _0x4418=function(_0x2f3c2f,_0x5f52c4){_0x2f3c2f=_0x2f3c2f-0x0;var _0x25e560=_0x4184[_0x2f3c2f];return _0x25e560;};'use strict';var _=require(_0x4418('0x0'));var util=require(_0x4418('0x1'));var moment=require('moment');var BPromise=require(_0x4418('0x2'));var rs=require(_0x4418('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4418('0x4'))(_0x4418('0x5'));var config=require(_0x4418('0x6'));var jayson=require(_0x4418('0x7'));var client=jayson['client'][_0x4418('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ebdd4,_0x59aaf7,_0x51ef37){return new BPromise(function(_0x4e95b9,_0x579b7c){return client[_0x4418('0x9')](_0x1ebdd4,_0x51ef37)['then'](function(_0x5b8f0d){logger[_0x4418('0xa')](_0x4418('0xb'),_0x59aaf7,'request\x20sent');logger['debug'](_0x4418('0xc'),_0x59aaf7,_0x4418('0xd'),JSON[_0x4418('0xe')](_0x5b8f0d));if(_0x5b8f0d[_0x4418('0xf')]){if(_0x5b8f0d[_0x4418('0xf')][_0x4418('0x10')]===0x1f4){logger[_0x4418('0xf')](_0x4418('0xb'),_0x59aaf7,_0x5b8f0d[_0x4418('0xf')]['message']);return _0x579b7c(_0x5b8f0d[_0x4418('0xf')]['message']);}logger[_0x4418('0xf')](_0x4418('0xb'),_0x59aaf7,_0x5b8f0d[_0x4418('0xf')][_0x4418('0x11')]);return _0x4e95b9(_0x5b8f0d[_0x4418('0xf')]['message']);}else{logger[_0x4418('0xa')](_0x4418('0xb'),_0x59aaf7,_0x4418('0xd'));_0x4e95b9(_0x5b8f0d[_0x4418('0x12')][_0x4418('0x11')]);}})['catch'](function(_0x4eac9a){logger[_0x4418('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x59aaf7,_0x4eac9a);_0x579b7c(_0x4eac9a);});});} \ No newline at end of file +var _0xf400=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4cba50,_0x567d96){var _0x34f920=function(_0x6cb539){while(--_0x6cb539){_0x4cba50['push'](_0x4cba50['shift']());}};_0x34f920(++_0x567d96);}(_0xf400,0x9e));var _0x0f40=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xf400[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x0f40('0x0'));var util=require(_0x0f40('0x1'));var moment=require(_0x0f40('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f40('0x3'));var fs=require('fs');var Redis=require(_0x0f40('0x4'));var db=require(_0x0f40('0x5'))['db'];var utils=require(_0x0f40('0x6'));var logger=require('../../config/logger')(_0x0f40('0x7'));var config=require('../../config/environment');var jayson=require(_0x0f40('0x8'));var client=jayson['client'][_0x0f40('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a0cda,_0x80d052,_0x567bf7){return new BPromise(function(_0x246faa,_0x117db3){return client['request'](_0x3a0cda,_0x567bf7)[_0x0f40('0xa')](function(_0x992de2){logger[_0x0f40('0xb')](_0x0f40('0xc'),_0x80d052,_0x0f40('0xd'));logger[_0x0f40('0xe')](_0x0f40('0xf'),_0x80d052,'request\x20sent',JSON[_0x0f40('0x10')](_0x992de2));if(_0x992de2[_0x0f40('0x11')]){if(_0x992de2[_0x0f40('0x11')][_0x0f40('0x12')]===0x1f4){logger[_0x0f40('0x11')](_0x0f40('0xc'),_0x80d052,_0x992de2[_0x0f40('0x11')][_0x0f40('0x13')]);return _0x117db3(_0x992de2[_0x0f40('0x11')][_0x0f40('0x13')]);}logger[_0x0f40('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x80d052,_0x992de2[_0x0f40('0x11')][_0x0f40('0x13')]);return _0x246faa(_0x992de2[_0x0f40('0x11')][_0x0f40('0x13')]);}else{logger[_0x0f40('0xb')](_0x0f40('0xc'),_0x80d052,_0x0f40('0xd'));_0x246faa(_0x992de2[_0x0f40('0x14')][_0x0f40('0x13')]);}})[_0x0f40('0x15')](function(_0x4784c9){logger[_0x0f40('0x11')](_0x0f40('0xc'),_0x80d052,_0x4784c9);_0x117db3(_0x4784c9);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 69b2df9..c25483e 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 _0x7fb0=['./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x7fb0,0x99));var _0x07fb=function(_0x1d14f6,_0x26e04d){_0x1d14f6=_0x1d14f6-0x0;var _0x4974cc=_0x7fb0[_0x1d14f6];return _0x4974cc;};'use strict';var multer=require(_0x07fb('0x0'));var util=require(_0x07fb('0x1'));var path=require(_0x07fb('0x2'));var timeout=require(_0x07fb('0x3'));var express=require(_0x07fb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x07fb('0x5'));var interaction=require(_0x07fb('0x6'));var config=require(_0x07fb('0x7'));var controller=require(_0x07fb('0x8'));router[_0x07fb('0x9')]('/',auth[_0x07fb('0xa')](),controller['index']);router[_0x07fb('0x9')](_0x07fb('0xb'),auth[_0x07fb('0xa')](),controller[_0x07fb('0xc')]);router[_0x07fb('0x9')](_0x07fb('0xd'),auth[_0x07fb('0xa')](),controller[_0x07fb('0xe')]);router['get'](_0x07fb('0xf'),auth[_0x07fb('0xa')](),controller[_0x07fb('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x07fb('0x11')]);router[_0x07fb('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x07fb('0x13')]);router[_0x07fb('0x14')](_0x07fb('0xb'),auth[_0x07fb('0xa')](),controller['update']);router[_0x07fb('0x15')]('/:id',auth[_0x07fb('0xa')](),controller['destroy']);module[_0x07fb('0x16')]=router; \ No newline at end of file +var _0x6737=['addConfiguration','put','/:id','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','getConfigurations','/:id/fields','getFields','create','/:id/configurations'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0x6737,0xe2));var _0x7673=function(_0x9f3b7b,_0x26591e){_0x9f3b7b=_0x9f3b7b-0x0;var _0x2a66a0=_0x6737[_0x9f3b7b];return _0x2a66a0;};'use strict';var multer=require('multer');var util=require(_0x7673('0x0'));var path=require(_0x7673('0x1'));var timeout=require('connect-timeout');var express=require(_0x7673('0x2'));var router=express[_0x7673('0x3')]();var fs_extra=require(_0x7673('0x4'));var auth=require(_0x7673('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7673('0x6'));var controller=require(_0x7673('0x7'));router['get']('/',auth[_0x7673('0x8')](),controller[_0x7673('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7673('0xa')]('/:id/configurations',auth[_0x7673('0x8')](),controller[_0x7673('0xb')]);router['get'](_0x7673('0xc'),auth[_0x7673('0x8')](),controller[_0x7673('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7673('0xe')]);router['post'](_0x7673('0xf'),auth[_0x7673('0x8')](),controller[_0x7673('0x10')]);router[_0x7673('0x11')](_0x7673('0x12'),auth[_0x7673('0x8')](),controller[_0x7673('0x13')]);router[_0x7673('0x14')](_0x7673('0x12'),auth[_0x7673('0x8')](),controller['destroy']);module[_0x7673('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 54ac1ce..b531601 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 _0xf264=['exports','STRING','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf264,0x191));var _0x4f26=function(_0x31d012,_0x46b6f7){_0x31d012=_0x31d012-0x0;var _0x340687=_0xf264[_0x31d012];return _0x340687;};'use strict';var Sequelize=require(_0x4f26('0x0'));module[_0x4f26('0x1')]={'name':{'type':Sequelize[_0x4f26('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4f26('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x4f26('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x9f21=['STRING','HelpDesk','sequelize'];(function(_0x1626ca,_0x5240dc){var _0x50bde0=function(_0x48af16){while(--_0x48af16){_0x1626ca['push'](_0x1626ca['shift']());}};_0x50bde0(++_0x5240dc);}(_0x9f21,0xf8));var _0x19f2=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0x9f21[_0x609988];return _0x159984;};'use strict';var Sequelize=require(_0x19f2('0x0'));module['exports']={'name':{'type':Sequelize[_0x19f2('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x19f2('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x19f2('0x2')},'remoteUri':{'type':Sequelize[_0x19f2('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x19f2('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index aa64c7b..e01f558 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 _0xed49=['offset','undefined','count','limit','set','apply','reject','update','then','destroy','end','error','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','findOne','VtigerConfiguration','order','merge','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','channel','VtigerField','md5','username','description','moduleName','serverUrl','accessKey','slice','lastIndexOf','format','GET','getchallenge','success','POST','login','token','result','autogenerated','reference','owner','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status'];(function(_0x43b21d,_0x5d5677){var _0x1de400=function(_0x405b75){while(--_0x405b75){_0x43b21d['push'](_0x43b21d['shift']());}};_0x1de400(++_0x5d5677);}(_0xed49,0xd3));var _0x9ed4=function(_0x4d4418,_0x18a5f8){_0x4d4418=_0x4d4418-0x0;var _0x5a3ab4=_0xed49[_0x4d4418];return _0x5a3ab4;};'use strict';var emlformat=require(_0x9ed4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ed4('0x1'));var jsonpatch=require(_0x9ed4('0x2'));var rp=require(_0x9ed4('0x3'));var moment=require(_0x9ed4('0x4'));var BPromise=require(_0x9ed4('0x5'));var Mustache=require(_0x9ed4('0x6'));var util=require(_0x9ed4('0x7'));var path=require(_0x9ed4('0x8'));var sox=require('sox');var csv=require(_0x9ed4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ed4('0xa'));var _=require(_0x9ed4('0xb'));var squel=require(_0x9ed4('0xc'));var crypto=require(_0x9ed4('0xd'));var jsforce=require(_0x9ed4('0xe'));var deskjs=require(_0x9ed4('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9ed4('0x10'));var Redis=require('ioredis');var authService=require(_0x9ed4('0x11'));var qs=require(_0x9ed4('0x12'));var as=require(_0x9ed4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ed4('0x14'))(_0x9ed4('0x15'));var utils=require(_0x9ed4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9ed4('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9ed4('0x18'));function respondWithStatusCode(_0x5989ac,_0x52c164){_0x52c164=_0x52c164||0xcc;return function(_0xde976){if(_0xde976){return _0x5989ac[_0x9ed4('0x19')](_0x52c164);}return _0x5989ac[_0x9ed4('0x1a')](_0x52c164)['end']();};}function respondWithResult(_0x3d8fa6,_0xf9f731){_0xf9f731=_0xf9f731||0xc8;return function(_0x1707d7){if(_0x1707d7){return _0x3d8fa6[_0x9ed4('0x1a')](_0xf9f731)['json'](_0x1707d7);}};}function respondWithFilteredResult(_0x3fa4aa,_0x1beaba){return function(_0x364973){if(_0x364973){var _0x29337c=typeof _0x1beaba[_0x9ed4('0x1b')]===_0x9ed4('0x1c')&&typeof _0x1beaba['limit']===_0x9ed4('0x1c');var _0x4734f4=_0x364973[_0x9ed4('0x1d')];var _0x103d5e=_0x29337c?0x0:_0x1beaba[_0x9ed4('0x1b')];var _0x43dcc2=_0x29337c?_0x364973[_0x9ed4('0x1d')]:_0x1beaba[_0x9ed4('0x1b')]+_0x1beaba[_0x9ed4('0x1e')];var _0x922376;if(_0x43dcc2>=_0x4734f4){_0x43dcc2=_0x4734f4;_0x922376=0xc8;}else{_0x922376=0xce;}_0x3fa4aa[_0x9ed4('0x1a')](_0x922376);return _0x3fa4aa[_0x9ed4('0x1f')]('Content-Range',_0x103d5e+'-'+_0x43dcc2+'/'+_0x4734f4)['json'](_0x364973);}return null;};}function patchUpdates(_0xfadaec){return function(_0x3d4c00){try{jsonpatch[_0x9ed4('0x20')](_0x3d4c00,_0xfadaec,!![]);}catch(_0x448ee3){return BPromise[_0x9ed4('0x21')](_0x448ee3);}return _0x3d4c00['save']();};}function saveUpdates(_0x5d966f,_0x560213){return function(_0x670f10){if(_0x670f10){return _0x670f10[_0x9ed4('0x22')](_0x5d966f)[_0x9ed4('0x23')](function(_0xc93d14){return _0xc93d14;});}return null;};}function removeEntity(_0x218ce3,_0x236315){return function(_0x557720){if(_0x557720){return _0x557720[_0x9ed4('0x24')]()[_0x9ed4('0x23')](function(){_0x218ce3['status'](0xcc)[_0x9ed4('0x25')]();});}};}function handleEntityNotFound(_0x2b7a22,_0x557e29){return function(_0x380863){if(!_0x380863){_0x2b7a22['sendStatus'](0x194);}return _0x380863;};}function handleError(_0x34fd47,_0xdbccfc){_0xdbccfc=_0xdbccfc||0x1f4;return function(_0x2049f9){logger[_0x9ed4('0x26')](_0x2049f9['stack']);if(_0x2049f9[_0x9ed4('0x27')]){delete _0x2049f9[_0x9ed4('0x27')];}_0x34fd47[_0x9ed4('0x1a')](_0xdbccfc)[_0x9ed4('0x28')](_0x2049f9);};}exports[_0x9ed4('0x29')]=function(_0x5b5803,_0x53bbc2){var _0x213f35={},_0x30a01a={},_0xb10b3d={'count':0x0,'rows':[]};var _0x21af94=_[_0x9ed4('0x2a')](db[_0x9ed4('0x2b')][_0x9ed4('0x2c')],function(_0x4aa4e9){return{'name':_0x4aa4e9[_0x9ed4('0x2d')],'type':_0x4aa4e9[_0x9ed4('0x2e')][_0x9ed4('0x2f')]};});_0x30a01a['model']=_[_0x9ed4('0x2a')](_0x21af94,_0x9ed4('0x27'));_0x30a01a[_0x9ed4('0x30')]=_[_0x9ed4('0x31')](_0x5b5803[_0x9ed4('0x30')]);_0x30a01a['filters']=_[_0x9ed4('0x32')](_0x30a01a[_0x9ed4('0x33')],_0x30a01a[_0x9ed4('0x30')]);_0x213f35[_0x9ed4('0x34')]=_[_0x9ed4('0x32')](_0x30a01a[_0x9ed4('0x33')],qs[_0x9ed4('0x35')](_0x5b5803[_0x9ed4('0x30')]['fields']));_0x213f35[_0x9ed4('0x34')]=_0x213f35[_0x9ed4('0x34')][_0x9ed4('0x36')]?_0x213f35[_0x9ed4('0x34')]:_0x30a01a[_0x9ed4('0x33')];if(!_0x5b5803[_0x9ed4('0x30')][_0x9ed4('0x37')](_0x9ed4('0x38'))){_0x213f35[_0x9ed4('0x1e')]=qs[_0x9ed4('0x1e')](_0x5b5803[_0x9ed4('0x30')][_0x9ed4('0x1e')]);_0x213f35[_0x9ed4('0x1b')]=qs[_0x9ed4('0x1b')](_0x5b5803[_0x9ed4('0x30')][_0x9ed4('0x1b')]);}_0x213f35['order']=qs[_0x9ed4('0x39')](_0x5b5803[_0x9ed4('0x30')][_0x9ed4('0x39')]);_0x213f35[_0x9ed4('0x3a')]=qs[_0x9ed4('0x3b')](_['pick'](_0x5b5803[_0x9ed4('0x30')],_0x30a01a[_0x9ed4('0x3b')]),_0x21af94);if(_0x5b5803[_0x9ed4('0x30')][_0x9ed4('0x3c')]){_0x213f35[_0x9ed4('0x3a')]=_['merge'](_0x213f35[_0x9ed4('0x3a')],{'$or':_['map'](_0x21af94,function(_0xb51772){if(_0xb51772[_0x9ed4('0x2e')]!==_0x9ed4('0x3d')){var _0xcfa3b4={};_0xcfa3b4[_0xb51772[_0x9ed4('0x27')]]={'$like':'%'+_0x5b5803[_0x9ed4('0x30')][_0x9ed4('0x3c')]+'%'};return _0xcfa3b4;}})});}_0x213f35=_['merge']({},_0x213f35,_0x5b5803['options']);var _0x450b7f={'where':_0x213f35[_0x9ed4('0x3a')]};return db[_0x9ed4('0x2b')]['count'](_0x450b7f)[_0x9ed4('0x23')](function(_0x527dd0){_0xb10b3d[_0x9ed4('0x1d')]=_0x527dd0;if(_0x5b5803['query'][_0x9ed4('0x3e')]){_0x213f35[_0x9ed4('0x3f')]=[{'all':!![]}];}return db[_0x9ed4('0x2b')][_0x9ed4('0x40')](_0x213f35);})['then'](function(_0x434736){_0xb10b3d['rows']=_0x434736;return _0xb10b3d;})[_0x9ed4('0x23')](respondWithFilteredResult(_0x53bbc2,_0x213f35))[_0x9ed4('0x41')](handleError(_0x53bbc2,null));};exports[_0x9ed4('0x42')]=function(_0x40c6cc,_0x150492){var _0x3e857c={'raw':![],'where':{'id':_0x40c6cc[_0x9ed4('0x43')]['id']}},_0x4b758b={};_0x4b758b[_0x9ed4('0x33')]=_[_0x9ed4('0x31')](db[_0x9ed4('0x2b')][_0x9ed4('0x2c')]);_0x4b758b[_0x9ed4('0x30')]=_[_0x9ed4('0x31')](_0x40c6cc[_0x9ed4('0x30')]);_0x4b758b['filters']=_['intersection'](_0x4b758b[_0x9ed4('0x33')],_0x4b758b['query']);_0x3e857c['attributes']=_['intersection'](_0x4b758b['model'],qs[_0x9ed4('0x35')](_0x40c6cc[_0x9ed4('0x30')][_0x9ed4('0x35')]));_0x3e857c['attributes']=_0x3e857c[_0x9ed4('0x34')][_0x9ed4('0x36')]?_0x3e857c[_0x9ed4('0x34')]:_0x4b758b[_0x9ed4('0x33')];if(_0x40c6cc[_0x9ed4('0x30')][_0x9ed4('0x3e')]){_0x3e857c['include']=[{'all':!![]}];}_0x3e857c=_['merge']({},_0x3e857c,_0x40c6cc[_0x9ed4('0x44')]);return db[_0x9ed4('0x2b')][_0x9ed4('0x45')](_0x3e857c)[_0x9ed4('0x23')](handleEntityNotFound(_0x150492,null))[_0x9ed4('0x23')](respondWithResult(_0x150492,null))[_0x9ed4('0x41')](handleError(_0x150492,null));};exports[_0x9ed4('0x46')]=function(_0xe6561f,_0x428839){return db[_0x9ed4('0x2b')][_0x9ed4('0x46')](_0xe6561f[_0x9ed4('0x47')],{})[_0x9ed4('0x23')](respondWithResult(_0x428839,0xc9))['catch'](handleError(_0x428839,null));};exports[_0x9ed4('0x22')]=function(_0x3b9efc,_0x38f6ae){if(_0x3b9efc['body']['id']){delete _0x3b9efc[_0x9ed4('0x47')]['id'];}return db[_0x9ed4('0x2b')][_0x9ed4('0x45')]({'where':{'id':_0x3b9efc['params']['id']}})[_0x9ed4('0x23')](handleEntityNotFound(_0x38f6ae,null))[_0x9ed4('0x23')](saveUpdates(_0x3b9efc[_0x9ed4('0x47')],null))['then'](respondWithResult(_0x38f6ae,null))['catch'](handleError(_0x38f6ae,null));};exports[_0x9ed4('0x24')]=function(_0x15e6f0,_0x55c5dd){return db[_0x9ed4('0x2b')][_0x9ed4('0x45')]({'where':{'id':_0x15e6f0['params']['id']}})['then'](handleEntityNotFound(_0x55c5dd,null))[_0x9ed4('0x23')](removeEntity(_0x55c5dd,null))[_0x9ed4('0x41')](handleError(_0x55c5dd,null));};exports['getConfigurations']=function(_0x7d659a,_0x3a3c56,_0x2fe51b){var _0x1f35e6={};var _0x2043cf={};var _0x133bab;var _0x3a4691;return db['VtigerAccount'][_0x9ed4('0x48')]({'where':{'id':_0x7d659a[_0x9ed4('0x43')]['id']}})[_0x9ed4('0x23')](handleEntityNotFound(_0x3a3c56,null))[_0x9ed4('0x23')](function(_0x543170){if(_0x543170){_0x133bab=_0x543170;_0x2043cf[_0x9ed4('0x33')]=_[_0x9ed4('0x31')](db[_0x9ed4('0x49')][_0x9ed4('0x2c')]);_0x2043cf[_0x9ed4('0x30')]=_[_0x9ed4('0x31')](_0x7d659a[_0x9ed4('0x30')]);_0x2043cf[_0x9ed4('0x3b')]=_[_0x9ed4('0x32')](_0x2043cf['model'],_0x2043cf['query']);_0x1f35e6[_0x9ed4('0x34')]=_[_0x9ed4('0x32')](_0x2043cf['model'],qs['fields'](_0x7d659a[_0x9ed4('0x30')]['fields']));_0x1f35e6['attributes']=_0x1f35e6['attributes']['length']?_0x1f35e6[_0x9ed4('0x34')]:_0x2043cf[_0x9ed4('0x33')];_0x1f35e6[_0x9ed4('0x4a')]=qs[_0x9ed4('0x39')](_0x7d659a[_0x9ed4('0x30')][_0x9ed4('0x39')]);_0x1f35e6[_0x9ed4('0x3a')]=qs[_0x9ed4('0x3b')](_['pick'](_0x7d659a['query'],_0x2043cf['filters']));if(_0x7d659a['query'][_0x9ed4('0x3c')]){_0x1f35e6['where']=_[_0x9ed4('0x4b')](_0x1f35e6[_0x9ed4('0x3a')],{'$or':_[_0x9ed4('0x2a')](_0x1f35e6[_0x9ed4('0x34')],function(_0x312642){var _0x591490={};_0x591490[_0x312642]={'$like':'%'+_0x7d659a['query']['filter']+'%'};return _0x591490;})});}_0x1f35e6=_['merge']({},_0x1f35e6,_0x7d659a[_0x9ed4('0x44')]);return _0x133bab[_0x9ed4('0x4c')](_0x1f35e6);}})[_0x9ed4('0x23')](function(_0x307c0a){if(_0x307c0a){_0x3a4691=_0x307c0a[_0x9ed4('0x36')];if(!_0x7d659a['query'][_0x9ed4('0x37')](_0x9ed4('0x38'))){_0x1f35e6[_0x9ed4('0x1e')]=qs[_0x9ed4('0x1e')](_0x7d659a[_0x9ed4('0x30')][_0x9ed4('0x1e')]);_0x1f35e6['offset']=qs[_0x9ed4('0x1b')](_0x7d659a[_0x9ed4('0x30')][_0x9ed4('0x1b')]);}return _0x133bab[_0x9ed4('0x4c')](_0x1f35e6);}})[_0x9ed4('0x23')](function(_0x49e524){if(_0x49e524){return _0x49e524?{'count':_0x3a4691,'rows':_0x49e524}:null;}})['then'](respondWithResult(_0x3a3c56,null))[_0x9ed4('0x41')](handleError(_0x3a3c56,null));};exports[_0x9ed4('0x4d')]=function(_0x196571,_0x40eca4,_0x2c9e03){if(_0x196571[_0x9ed4('0x47')]['id']){delete _0x196571[_0x9ed4('0x47')]['id'];}return db[_0x9ed4('0x2b')][_0x9ed4('0x48')]({'where':{'id':_0x196571[_0x9ed4('0x43')]['id']}})['then'](handleEntityNotFound(_0x40eca4,null))['then'](function(_0x1a9829){if(_0x1a9829){_0x196571[_0x9ed4('0x47')]['AccountId']=_0x1a9829['id'];_0x196571['body'][_0x9ed4('0x4e')]=integrations[_0x9ed4('0x4f')](_0x196571[_0x9ed4('0x47')]['channel'],_0x196571[_0x9ed4('0x47')][_0x9ed4('0x2e')]);_0x196571[_0x9ed4('0x47')][_0x9ed4('0x50')]=integrations['getDescriptions'](_0x196571[_0x9ed4('0x47')][_0x9ed4('0x51')],_0x196571[_0x9ed4('0x47')][_0x9ed4('0x2e')]);return db[_0x9ed4('0x49')][_0x9ed4('0x46')](_0x196571[_0x9ed4('0x47')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0x9ed4('0x52')],'as':'Descriptions'}]});}return null;})[_0x9ed4('0x23')](respondWithResult(_0x40eca4,null))[_0x9ed4('0x41')](handleError(_0x40eca4,null));};var md5=require(_0x9ed4('0x53'));exports['getFields']=function(_0xf14a53,_0x5958cb,_0x39ac25){var _0x45221c=null;var _0x8677c9=null;var _0x47b812=null;var _0x2f7ede=null;var _0x2706b1='';return db[_0x9ed4('0x2b')]['findOne']({'where':{'id':_0xf14a53['params']['id']},'attributes':['id',_0x9ed4('0x27'),_0x9ed4('0x54'),_0x9ed4('0x55'),_0x9ed4('0x56'),'remoteUri',_0x9ed4('0x57'),_0x9ed4('0x58')]})[_0x9ed4('0x23')](handleEntityNotFound(_0x5958cb,null))[_0x9ed4('0x23')](function(_0x15bb04){if(_0x15bb04){_0x45221c=_0x15bb04['username'];_0x8677c9=_0x15bb04['accessKey'];_0x47b812=_0x15bb04[_0x9ed4('0x56')];_0x2706b1=_0x15bb04['remoteUri'];var _0x551eba=_0x2706b1[_0x9ed4('0x59')](-0x1);if(_0x551eba==='/'){_0x2706b1=_0x2706b1['substring'](0x0,_0x2706b1[_0x9ed4('0x5a')](_0x551eba));}_0x2f7ede=util[_0x9ed4('0x5b')]('%s/webservice.php',_0x2706b1);var _0x24a918={'method':_0x9ed4('0x5c'),'uri':_0x2f7ede,'qs':{'operation':_0x9ed4('0x5d'),'username':_0x15bb04[_0x9ed4('0x54')]},'json':!![]};return rp(_0x24a918);}})[_0x9ed4('0x23')](function(_0x17d485){if(_0x17d485[_0x9ed4('0x5e')]){var _0x37cee6={'method':_0x9ed4('0x5f'),'uri':_0x2f7ede,'form':{'operation':_0x9ed4('0x60'),'username':_0x45221c,'accessKey':md5(_0x17d485['result'][_0x9ed4('0x61')]+_0x8677c9)},'json':!![]};return rp(_0x37cee6);}})['then'](function(_0x23a120){if(_0x23a120[_0x9ed4('0x5e')]){var _0x3e4c8a={'method':_0x9ed4('0x5c'),'uri':_0x2f7ede,'qs':{'operation':'describe','username':_0x45221c,'sessionName':_0x23a120[_0x9ed4('0x62')]['sessionName'],'elementType':_0x47b812},'json':!![]};return rp(_0x3e4c8a);}})[_0x9ed4('0x23')](function(_0x5ad5f8){if(_0x5ad5f8[_0x9ed4('0x5e')]){var _0x132b07=[_0x9ed4('0x63'),_0x9ed4('0x64'),_0x9ed4('0x65')];_['remove'](_0x5ad5f8['result'][_0x9ed4('0x35')],function(_0x2c5151){return _0x132b07[_0x9ed4('0x66')](_0x2c5151[_0x9ed4('0x2e')][_0x9ed4('0x27')]);});_[_0x9ed4('0x67')](_0x5ad5f8[_0x9ed4('0x62')][_0x9ed4('0x35')],function(_0x1b17f9){return _0x1b17f9[_0x9ed4('0x68')]===_0x9ed4('0x69');});return{'count':_0x5ad5f8[_0x9ed4('0x62')][_0x9ed4('0x35')][_0x9ed4('0x36')],'rows':_['map'](_0x5ad5f8[_0x9ed4('0x62')][_0x9ed4('0x35')],function(_0x67d213){return{'id':_0x67d213[_0x9ed4('0x27')],'name':_0x67d213[_0x9ed4('0x6a')],'custom':_[_0x9ed4('0x6b')](_0x67d213['name'],_0x9ed4('0x6c'))?!![]:![],'options':_0x67d213[_0x9ed4('0x2e')]['name']===_0x9ed4('0x6d')&&_0x67d213['type'][_0x9ed4('0x6e')][_0x9ed4('0x36')]>0x0?_['map'](_0x67d213['type'][_0x9ed4('0x6e')],function(_0x1ac1ad){return{'name':_0x1ac1ad[_0x9ed4('0x6a')],'value':_0x1ac1ad[_0x9ed4('0x6f')]};}):[]};})};}})[_0x9ed4('0x23')](respondWithResult(_0x5958cb,null))[_0x9ed4('0x41')](function(_0x1bcdc1){console[_0x9ed4('0x70')](_0x9ed4('0x71')+_0x1bcdc1);var _0x5c24fc=_0xf14a53['query']['test']?0x1f4:_0x1bcdc1[_0x9ed4('0x72')]||0x1f4;logger[_0x9ed4('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x9ed4('0x73'),_0x5c24fc,JSON[_0x9ed4('0x74')](_0x1bcdc1));delete _0x1bcdc1[_0x9ed4('0x27')];if(_0x5c24fc===0x191){_0x5c24fc=0x190;}_0x5958cb['status'](_0x5c24fc)[_0x9ed4('0x28')](_0xf14a53['query'][_0x9ed4('0x75')]?{'message':_0x9ed4('0x76'),'statusCode':_0x1bcdc1[_0x9ed4('0x72')]}:_0x1bcdc1);});}; \ No newline at end of file +var _0xad37=['Descriptions','getDescriptions','VtigerField','getFields','description','moduleName','accessKey','username','slice','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','POST','result','token','success','describe','sessionName','reference','owner','includes','remove','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','VtigerAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','find','catch','create','body','params','getConfigurations','findOne','keys','VtigerConfiguration','length','order','pick','nolimit','addConfiguration','Subjects','getSubjects','channel'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xad37,0x110));var _0x7ad3=function(_0x379e2c,_0x2713e5){_0x379e2c=_0x379e2c-0x0;var _0x29ec02=_0xad37[_0x379e2c];return _0x29ec02;};'use strict';var emlformat=require(_0x7ad3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7ad3('0x1'));var jsonpatch=require(_0x7ad3('0x2'));var rp=require(_0x7ad3('0x3'));var moment=require(_0x7ad3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7ad3('0x5'));var util=require(_0x7ad3('0x6'));var path=require(_0x7ad3('0x7'));var sox=require(_0x7ad3('0x8'));var csv=require(_0x7ad3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7ad3('0xa'));var jsforce=require(_0x7ad3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7ad3('0x9'));var querystring=require(_0x7ad3('0xc'));var Papa=require(_0x7ad3('0xd'));var Redis=require(_0x7ad3('0xe'));var authService=require(_0x7ad3('0xf'));var qs=require(_0x7ad3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ad3('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x7ad3('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7ad3('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5c7630,_0x453853){_0x453853=_0x453853||0xcc;return function(_0x57ae87){if(_0x57ae87){return _0x5c7630['sendStatus'](_0x453853);}return _0x5c7630[_0x7ad3('0x14')](_0x453853)[_0x7ad3('0x15')]();};}function respondWithResult(_0x121a6e,_0x54fe76){_0x54fe76=_0x54fe76||0xc8;return function(_0x55abcf){if(_0x55abcf){return _0x121a6e[_0x7ad3('0x14')](_0x54fe76)['json'](_0x55abcf);}};}function respondWithFilteredResult(_0x2d4394,_0x5051d7){return function(_0x1f9d26){if(_0x1f9d26){var _0x1e57fb=typeof _0x5051d7[_0x7ad3('0x16')]===_0x7ad3('0x17')&&typeof _0x5051d7['limit']===_0x7ad3('0x17');var _0x319e3f=_0x1f9d26['count'];var _0x35915e=_0x1e57fb?0x0:_0x5051d7['offset'];var _0x334993=_0x1e57fb?_0x1f9d26[_0x7ad3('0x18')]:_0x5051d7[_0x7ad3('0x16')]+_0x5051d7[_0x7ad3('0x19')];var _0x10bf1a;if(_0x334993>=_0x319e3f){_0x334993=_0x319e3f;_0x10bf1a=0xc8;}else{_0x10bf1a=0xce;}_0x2d4394[_0x7ad3('0x14')](_0x10bf1a);return _0x2d4394[_0x7ad3('0x1a')](_0x7ad3('0x1b'),_0x35915e+'-'+_0x334993+'/'+_0x319e3f)[_0x7ad3('0x1c')](_0x1f9d26);}return null;};}function patchUpdates(_0x59fcec){return function(_0x11b5ac){try{jsonpatch[_0x7ad3('0x1d')](_0x11b5ac,_0x59fcec,!![]);}catch(_0x5d190e){return BPromise[_0x7ad3('0x1e')](_0x5d190e);}return _0x11b5ac['save']();};}function saveUpdates(_0x3c6fbf,_0x4a5d9e){return function(_0x27a837){if(_0x27a837){return _0x27a837[_0x7ad3('0x1f')](_0x3c6fbf)[_0x7ad3('0x20')](function(_0x49e875){return _0x49e875;});}return null;};}function removeEntity(_0x12d5bc,_0x3fcea2){return function(_0xed4c2b){if(_0xed4c2b){return _0xed4c2b[_0x7ad3('0x21')]()[_0x7ad3('0x20')](function(){_0x12d5bc[_0x7ad3('0x14')](0xcc)[_0x7ad3('0x15')]();});}};}function handleEntityNotFound(_0x4f6d51,_0x11733d){return function(_0x35dc8d){if(!_0x35dc8d){_0x4f6d51[_0x7ad3('0x22')](0x194);}return _0x35dc8d;};}function handleError(_0x4419a8,_0x4194ef){_0x4194ef=_0x4194ef||0x1f4;return function(_0x437298){logger[_0x7ad3('0x23')](_0x437298[_0x7ad3('0x24')]);if(_0x437298[_0x7ad3('0x25')]){delete _0x437298[_0x7ad3('0x25')];}_0x4419a8['status'](_0x4194ef)['send'](_0x437298);};}exports[_0x7ad3('0x26')]=function(_0x4b81a5,_0x5da012){var _0x58da16={},_0x2a7555={},_0x5554fe={'count':0x0,'rows':[]};var _0x29d736=_[_0x7ad3('0x27')](db[_0x7ad3('0x28')][_0x7ad3('0x29')],function(_0x1ad2f6){return{'name':_0x1ad2f6[_0x7ad3('0x2a')],'type':_0x1ad2f6[_0x7ad3('0x2b')]['key']};});_0x2a7555[_0x7ad3('0x2c')]=_[_0x7ad3('0x27')](_0x29d736,_0x7ad3('0x25'));_0x2a7555['query']=_['keys'](_0x4b81a5[_0x7ad3('0x2d')]);_0x2a7555[_0x7ad3('0x2e')]=_[_0x7ad3('0x2f')](_0x2a7555[_0x7ad3('0x2c')],_0x2a7555['query']);_0x58da16[_0x7ad3('0x30')]=_[_0x7ad3('0x2f')](_0x2a7555[_0x7ad3('0x2c')],qs['fields'](_0x4b81a5[_0x7ad3('0x2d')][_0x7ad3('0x31')]));_0x58da16[_0x7ad3('0x30')]=_0x58da16[_0x7ad3('0x30')]['length']?_0x58da16[_0x7ad3('0x30')]:_0x2a7555[_0x7ad3('0x2c')];if(!_0x4b81a5[_0x7ad3('0x2d')][_0x7ad3('0x32')]('nolimit')){_0x58da16[_0x7ad3('0x19')]=qs['limit'](_0x4b81a5[_0x7ad3('0x2d')][_0x7ad3('0x19')]);_0x58da16[_0x7ad3('0x16')]=qs[_0x7ad3('0x16')](_0x4b81a5[_0x7ad3('0x2d')][_0x7ad3('0x16')]);}_0x58da16['order']=qs[_0x7ad3('0x33')](_0x4b81a5['query'][_0x7ad3('0x33')]);_0x58da16[_0x7ad3('0x34')]=qs['filters'](_['pick'](_0x4b81a5[_0x7ad3('0x2d')],_0x2a7555[_0x7ad3('0x2e')]),_0x29d736);if(_0x4b81a5[_0x7ad3('0x2d')][_0x7ad3('0x35')]){_0x58da16['where']=_[_0x7ad3('0x36')](_0x58da16[_0x7ad3('0x34')],{'$or':_[_0x7ad3('0x27')](_0x29d736,function(_0x1d5994){if(_0x1d5994[_0x7ad3('0x2b')]!==_0x7ad3('0x37')){var _0x3b84c6={};_0x3b84c6[_0x1d5994['name']]={'$like':'%'+_0x4b81a5[_0x7ad3('0x2d')]['filter']+'%'};return _0x3b84c6;}})});}_0x58da16=_['merge']({},_0x58da16,_0x4b81a5[_0x7ad3('0x38')]);var _0x381fcf={'where':_0x58da16[_0x7ad3('0x34')]};return db[_0x7ad3('0x28')][_0x7ad3('0x18')](_0x381fcf)[_0x7ad3('0x20')](function(_0x1bd286){_0x5554fe[_0x7ad3('0x18')]=_0x1bd286;if(_0x4b81a5[_0x7ad3('0x2d')]['includeAll']){_0x58da16[_0x7ad3('0x39')]=[{'all':!![]}];}return db['VtigerAccount'][_0x7ad3('0x3a')](_0x58da16);})[_0x7ad3('0x20')](function(_0x467b57){_0x5554fe[_0x7ad3('0x3b')]=_0x467b57;return _0x5554fe;})[_0x7ad3('0x20')](respondWithFilteredResult(_0x5da012,_0x58da16))['catch'](handleError(_0x5da012,null));};exports[_0x7ad3('0x3c')]=function(_0x20518d,_0x59af3e){var _0x2f6902={'raw':![],'where':{'id':_0x20518d['params']['id']}},_0x5e9dfe={};_0x5e9dfe[_0x7ad3('0x2c')]=_['keys'](db[_0x7ad3('0x28')][_0x7ad3('0x29')]);_0x5e9dfe[_0x7ad3('0x2d')]=_['keys'](_0x20518d[_0x7ad3('0x2d')]);_0x5e9dfe['filters']=_['intersection'](_0x5e9dfe[_0x7ad3('0x2c')],_0x5e9dfe[_0x7ad3('0x2d')]);_0x2f6902[_0x7ad3('0x30')]=_[_0x7ad3('0x2f')](_0x5e9dfe['model'],qs['fields'](_0x20518d['query'][_0x7ad3('0x31')]));_0x2f6902[_0x7ad3('0x30')]=_0x2f6902[_0x7ad3('0x30')]['length']?_0x2f6902[_0x7ad3('0x30')]:_0x5e9dfe[_0x7ad3('0x2c')];if(_0x20518d[_0x7ad3('0x2d')][_0x7ad3('0x3d')]){_0x2f6902[_0x7ad3('0x39')]=[{'all':!![]}];}_0x2f6902=_['merge']({},_0x2f6902,_0x20518d[_0x7ad3('0x38')]);return db[_0x7ad3('0x28')][_0x7ad3('0x3e')](_0x2f6902)[_0x7ad3('0x20')](handleEntityNotFound(_0x59af3e,null))[_0x7ad3('0x20')](respondWithResult(_0x59af3e,null))[_0x7ad3('0x3f')](handleError(_0x59af3e,null));};exports[_0x7ad3('0x40')]=function(_0x1f26fb,_0xa2fa8a){return db[_0x7ad3('0x28')][_0x7ad3('0x40')](_0x1f26fb[_0x7ad3('0x41')],{})['then'](respondWithResult(_0xa2fa8a,0xc9))[_0x7ad3('0x3f')](handleError(_0xa2fa8a,null));};exports['update']=function(_0x23d231,_0x5a4cbf){if(_0x23d231[_0x7ad3('0x41')]['id']){delete _0x23d231['body']['id'];}return db[_0x7ad3('0x28')]['find']({'where':{'id':_0x23d231['params']['id']}})[_0x7ad3('0x20')](handleEntityNotFound(_0x5a4cbf,null))['then'](saveUpdates(_0x23d231[_0x7ad3('0x41')],null))['then'](respondWithResult(_0x5a4cbf,null))[_0x7ad3('0x3f')](handleError(_0x5a4cbf,null));};exports[_0x7ad3('0x21')]=function(_0xe4579f,_0x137cb2){return db[_0x7ad3('0x28')][_0x7ad3('0x3e')]({'where':{'id':_0xe4579f[_0x7ad3('0x42')]['id']}})[_0x7ad3('0x20')](handleEntityNotFound(_0x137cb2,null))['then'](removeEntity(_0x137cb2,null))[_0x7ad3('0x3f')](handleError(_0x137cb2,null));};exports[_0x7ad3('0x43')]=function(_0x2a51b6,_0x3031dc,_0x5d2699){var _0x1dfc66={};var _0x1050b0={};var _0x1f9f7c;var _0x1bdc9d;return db['VtigerAccount'][_0x7ad3('0x44')]({'where':{'id':_0x2a51b6[_0x7ad3('0x42')]['id']}})[_0x7ad3('0x20')](handleEntityNotFound(_0x3031dc,null))[_0x7ad3('0x20')](function(_0x1ee1cb){if(_0x1ee1cb){_0x1f9f7c=_0x1ee1cb;_0x1050b0[_0x7ad3('0x2c')]=_[_0x7ad3('0x45')](db[_0x7ad3('0x46')][_0x7ad3('0x29')]);_0x1050b0[_0x7ad3('0x2d')]=_[_0x7ad3('0x45')](_0x2a51b6[_0x7ad3('0x2d')]);_0x1050b0['filters']=_[_0x7ad3('0x2f')](_0x1050b0[_0x7ad3('0x2c')],_0x1050b0[_0x7ad3('0x2d')]);_0x1dfc66[_0x7ad3('0x30')]=_[_0x7ad3('0x2f')](_0x1050b0[_0x7ad3('0x2c')],qs['fields'](_0x2a51b6[_0x7ad3('0x2d')]['fields']));_0x1dfc66[_0x7ad3('0x30')]=_0x1dfc66['attributes'][_0x7ad3('0x47')]?_0x1dfc66[_0x7ad3('0x30')]:_0x1050b0[_0x7ad3('0x2c')];_0x1dfc66[_0x7ad3('0x48')]=qs[_0x7ad3('0x33')](_0x2a51b6['query'][_0x7ad3('0x33')]);_0x1dfc66['where']=qs[_0x7ad3('0x2e')](_[_0x7ad3('0x49')](_0x2a51b6['query'],_0x1050b0['filters']));if(_0x2a51b6[_0x7ad3('0x2d')][_0x7ad3('0x35')]){_0x1dfc66['where']=_[_0x7ad3('0x36')](_0x1dfc66['where'],{'$or':_[_0x7ad3('0x27')](_0x1dfc66[_0x7ad3('0x30')],function(_0xd3cec7){var _0x22d914={};_0x22d914[_0xd3cec7]={'$like':'%'+_0x2a51b6[_0x7ad3('0x2d')][_0x7ad3('0x35')]+'%'};return _0x22d914;})});}_0x1dfc66=_[_0x7ad3('0x36')]({},_0x1dfc66,_0x2a51b6[_0x7ad3('0x38')]);return _0x1f9f7c[_0x7ad3('0x43')](_0x1dfc66);}})[_0x7ad3('0x20')](function(_0x6a30b2){if(_0x6a30b2){_0x1bdc9d=_0x6a30b2[_0x7ad3('0x47')];if(!_0x2a51b6[_0x7ad3('0x2d')]['hasOwnProperty'](_0x7ad3('0x4a'))){_0x1dfc66['limit']=qs[_0x7ad3('0x19')](_0x2a51b6[_0x7ad3('0x2d')][_0x7ad3('0x19')]);_0x1dfc66[_0x7ad3('0x16')]=qs[_0x7ad3('0x16')](_0x2a51b6[_0x7ad3('0x2d')][_0x7ad3('0x16')]);}return _0x1f9f7c[_0x7ad3('0x43')](_0x1dfc66);}})['then'](function(_0x3db50b){if(_0x3db50b){return _0x3db50b?{'count':_0x1bdc9d,'rows':_0x3db50b}:null;}})[_0x7ad3('0x20')](respondWithResult(_0x3031dc,null))[_0x7ad3('0x3f')](handleError(_0x3031dc,null));};exports[_0x7ad3('0x4b')]=function(_0x81cf5d,_0x2f8a43,_0x3577c3){if(_0x81cf5d[_0x7ad3('0x41')]['id']){delete _0x81cf5d['body']['id'];}return db[_0x7ad3('0x28')][_0x7ad3('0x44')]({'where':{'id':_0x81cf5d[_0x7ad3('0x42')]['id']}})['then'](handleEntityNotFound(_0x2f8a43,null))[_0x7ad3('0x20')](function(_0x1a9b16){if(_0x1a9b16){_0x81cf5d[_0x7ad3('0x41')]['AccountId']=_0x1a9b16['id'];_0x81cf5d[_0x7ad3('0x41')][_0x7ad3('0x4c')]=integrations[_0x7ad3('0x4d')](_0x81cf5d[_0x7ad3('0x41')][_0x7ad3('0x4e')],_0x81cf5d[_0x7ad3('0x41')][_0x7ad3('0x2b')]);_0x81cf5d['body'][_0x7ad3('0x4f')]=integrations[_0x7ad3('0x50')](_0x81cf5d[_0x7ad3('0x41')]['channel'],_0x81cf5d['body'][_0x7ad3('0x2b')]);return db[_0x7ad3('0x46')][_0x7ad3('0x40')](_0x81cf5d[_0x7ad3('0x41')],{'include':[{'model':db[_0x7ad3('0x51')],'as':_0x7ad3('0x4c')},{'model':db['VtigerField'],'as':_0x7ad3('0x4f')}]});}return null;})[_0x7ad3('0x20')](respondWithResult(_0x2f8a43,null))[_0x7ad3('0x3f')](handleError(_0x2f8a43,null));};var md5=require('md5');exports[_0x7ad3('0x52')]=function(_0x3264db,_0x4423b8,_0x65004f){var _0x16774e=null;var _0x235b9d=null;var _0x1a7325=null;var _0x189a19=null;var _0x598422='';return db[_0x7ad3('0x28')][_0x7ad3('0x44')]({'where':{'id':_0x3264db[_0x7ad3('0x42')]['id']},'attributes':['id',_0x7ad3('0x25'),'username',_0x7ad3('0x53'),_0x7ad3('0x54'),'remoteUri','serverUrl',_0x7ad3('0x55')]})[_0x7ad3('0x20')](handleEntityNotFound(_0x4423b8,null))[_0x7ad3('0x20')](function(_0xedfd13){if(_0xedfd13){_0x16774e=_0xedfd13[_0x7ad3('0x56')];_0x235b9d=_0xedfd13[_0x7ad3('0x55')];_0x1a7325=_0xedfd13[_0x7ad3('0x54')];_0x598422=_0xedfd13['remoteUri'];var _0x536fb0=_0x598422[_0x7ad3('0x57')](-0x1);if(_0x536fb0==='/'){_0x598422=_0x598422[_0x7ad3('0x58')](0x0,_0x598422[_0x7ad3('0x59')](_0x536fb0));}_0x189a19=util['format'](_0x7ad3('0x5a'),_0x598422);var _0x3a23e6={'method':_0x7ad3('0x5b'),'uri':_0x189a19,'qs':{'operation':_0x7ad3('0x5c'),'username':_0xedfd13['username']},'json':!![]};return rp(_0x3a23e6);}})[_0x7ad3('0x20')](function(_0x26d272){if(_0x26d272['success']){var _0x564a61={'method':_0x7ad3('0x5d'),'uri':_0x189a19,'form':{'operation':'login','username':_0x16774e,'accessKey':md5(_0x26d272[_0x7ad3('0x5e')][_0x7ad3('0x5f')]+_0x235b9d)},'json':!![]};return rp(_0x564a61);}})['then'](function(_0x24bef2){if(_0x24bef2[_0x7ad3('0x60')]){var _0x652ea4={'method':_0x7ad3('0x5b'),'uri':_0x189a19,'qs':{'operation':_0x7ad3('0x61'),'username':_0x16774e,'sessionName':_0x24bef2[_0x7ad3('0x5e')][_0x7ad3('0x62')],'elementType':_0x1a7325},'json':!![]};return rp(_0x652ea4);}})[_0x7ad3('0x20')](function(_0x3c9677){if(_0x3c9677[_0x7ad3('0x60')]){var _0x2adcba=['autogenerated',_0x7ad3('0x63'),_0x7ad3('0x64')];_['remove'](_0x3c9677[_0x7ad3('0x5e')][_0x7ad3('0x31')],function(_0x4367fb){return _0x2adcba[_0x7ad3('0x65')](_0x4367fb[_0x7ad3('0x2b')][_0x7ad3('0x25')]);});_[_0x7ad3('0x66')](_0x3c9677['result']['fields'],function(_0x2a2efb){return _0x2a2efb['editable']==='false';});return{'count':_0x3c9677[_0x7ad3('0x5e')]['fields'][_0x7ad3('0x47')],'rows':_['map'](_0x3c9677[_0x7ad3('0x5e')]['fields'],function(_0x58cc87){return{'id':_0x58cc87[_0x7ad3('0x25')],'name':_0x58cc87[_0x7ad3('0x67')],'custom':_[_0x7ad3('0x68')](_0x58cc87[_0x7ad3('0x25')],_0x7ad3('0x69'))?!![]:![],'options':_0x58cc87['type'][_0x7ad3('0x25')]===_0x7ad3('0x6a')&&_0x58cc87['type'][_0x7ad3('0x6b')]['length']>0x0?_[_0x7ad3('0x27')](_0x58cc87[_0x7ad3('0x2b')][_0x7ad3('0x6b')],function(_0x453e86){return{'name':_0x453e86['label'],'value':_0x453e86[_0x7ad3('0x6c')]};}):[]};})};}})['then'](respondWithResult(_0x4423b8,null))['catch'](function(_0x3e3083){console[_0x7ad3('0x6d')](_0x7ad3('0x6e')+_0x3e3083);var _0x1f25e8=_0x3264db[_0x7ad3('0x2d')][_0x7ad3('0x6f')]?0x1f4:_0x3e3083[_0x7ad3('0x70')]||0x1f4;logger[_0x7ad3('0x23')](_0x7ad3('0x71'),_0x7ad3('0x52'),_0x1f25e8,JSON[_0x7ad3('0x72')](_0x3e3083));delete _0x3e3083[_0x7ad3('0x25')];if(_0x1f25e8===0x191){_0x1f25e8=0x190;}_0x4423b8[_0x7ad3('0x14')](_0x1f25e8)[_0x7ad3('0x73')](_0x3264db[_0x7ad3('0x2d')][_0x7ad3('0x6f')]?{'message':_0x7ad3('0x74'),'statusCode':_0x3e3083['statusCode']}:_0x3e3083);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index e50aa49..fd9ef8f 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 _0x9bc8=['api','moment','bluebird','request-promise','path','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bc8,0xa6));var _0x89bc=function(_0xe1e126,_0x4d5bec){_0xe1e126=_0xe1e126-0x0;var _0x48250d=_0x9bc8[_0xe1e126];return _0x48250d;};'use strict';var _=require(_0x89bc('0x0'));var util=require(_0x89bc('0x1'));var logger=require(_0x89bc('0x2'))(_0x89bc('0x3'));var moment=require(_0x89bc('0x4'));var BPromise=require(_0x89bc('0x5'));var rp=require(_0x89bc('0x6'));var fs=require('fs');var path=require(_0x89bc('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x89bc('0x8'));module[_0x89bc('0x9')]=function(_0x49c366,_0x24ab05){return _0x49c366[_0x89bc('0xa')](_0x89bc('0xb'),attributes,{'tableName':_0x89bc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0247=['../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x249dfe,_0x21f85c){var _0xc7c7be=function(_0x3d0837){while(--_0x3d0837){_0x249dfe['push'](_0x249dfe['shift']());}};_0xc7c7be(++_0x21f85c);}(_0x0247,0x9e));var _0x7024=function(_0xd754a7,_0x12c22e){_0xd754a7=_0xd754a7-0x0;var _0x4a5808=_0x0247[_0xd754a7];return _0x4a5808;};'use strict';var _=require(_0x7024('0x0'));var util=require(_0x7024('0x1'));var logger=require(_0x7024('0x2'))(_0x7024('0x3'));var moment=require('moment');var BPromise=require(_0x7024('0x4'));var rp=require(_0x7024('0x5'));var fs=require('fs');var path=require(_0x7024('0x6'));var rimraf=require(_0x7024('0x7'));var config=require(_0x7024('0x8'));var attributes=require(_0x7024('0x9'));var integrations=require(_0x7024('0xa'));module['exports']=function(_0x4338ea,_0x23b9cc){return _0x4338ea[_0x7024('0xb')](_0x7024('0xc'),attributes,{'tableName':_0x7024('0xd'),'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 15963e4..c08d9a2 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 _0xe511=['find','attributes','ShowVtigerAccount','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','options','raw','where','include','map','model','then'];(function(_0x1d3906,_0x551f8c){var _0x90e496=function(_0x13e6ac){while(--_0x13e6ac){_0x1d3906['push'](_0x1d3906['shift']());}};_0x90e496(++_0x551f8c);}(_0xe511,0x16f));var _0x1e51=function(_0x3b6acd,_0x40895c){_0x3b6acd=_0x3b6acd-0x0;var _0x394f74=_0xe511[_0x3b6acd];return _0x394f74;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e51('0x3'));var db=require(_0x1e51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e51('0x5'))(_0x1e51('0x6'));var config=require(_0x1e51('0x7'));var jayson=require(_0x1e51('0x8'));var client=jayson['client'][_0x1e51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21ed6b,_0x5c4590,_0x4fa2ba){return new BPromise(function(_0x394ad8,_0x133021){return client['request'](_0x21ed6b,_0x4fa2ba)['then'](function(_0x658941){logger[_0x1e51('0xa')](_0x1e51('0xb'),_0x5c4590,_0x1e51('0xc'));logger[_0x1e51('0xd')](_0x1e51('0xe'),_0x5c4590,'request\x20sent',JSON[_0x1e51('0xf')](_0x658941));if(_0x658941[_0x1e51('0x10')]){if(_0x658941[_0x1e51('0x10')][_0x1e51('0x11')]===0x1f4){logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941['error'][_0x1e51('0x12')]);return _0x133021(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);return _0x394ad8(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}else{logger[_0x1e51('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x5c4590,_0x1e51('0xc'));_0x394ad8(_0x658941[_0x1e51('0x13')][_0x1e51('0x12')]);}})['catch'](function(_0xa3b410){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x5c4590,_0xa3b410);_0x133021(_0xa3b410);});});}exports[_0x1e51('0x14')]=function(_0x27dcad){var _0x40ae4c=this;return new Promise(function(_0x4785a5,_0x4d1aae){return db[_0x1e51('0x15')]['findAll']({'raw':_0x27dcad[_0x1e51('0x16')]?_0x27dcad['options'][_0x1e51('0x17')]===undefined?!![]:![]:!![],'where':_0x27dcad[_0x1e51('0x16')]?_0x27dcad[_0x1e51('0x16')][_0x1e51('0x18')]||null:null,'attributes':_0x27dcad['options']?_0x27dcad['options']['attributes']||null:null,'limit':_0x27dcad['options']?_0x27dcad[_0x1e51('0x16')]['limit']||null:null,'include':_0x27dcad[_0x1e51('0x16')]?_0x27dcad[_0x1e51('0x16')][_0x1e51('0x19')]?_[_0x1e51('0x1a')](_0x27dcad[_0x1e51('0x16')][_0x1e51('0x19')],function(_0x270adf){return{'model':db[_0x270adf[_0x1e51('0x1b')]],'as':_0x270adf['as'],'attributes':_0x270adf['attributes'],'include':_0x270adf['include']?_[_0x1e51('0x1a')](_0x270adf[_0x1e51('0x19')],function(_0x2e42b1){return{'model':db[_0x2e42b1[_0x1e51('0x1b')]],'as':_0x2e42b1['as'],'attributes':_0x2e42b1['attributes'],'include':_0x2e42b1['include']?_['map'](_0x2e42b1[_0x1e51('0x19')],function(_0x2a1561){return{'model':db[_0x2a1561[_0x1e51('0x1b')]],'as':_0x2a1561['as'],'attributes':_0x2a1561['attributes']};}):[]};}):[]};}):[]:[]})[_0x1e51('0x1c')](function(_0x49c507){logger['info'](_0x1e51('0x14'),_0x27dcad);logger['debug'](_0x1e51('0x14'),_0x27dcad,JSON[_0x1e51('0xf')](_0x49c507));_0x4785a5(_0x49c507);})['catch'](function(_0x3e6ef2){logger[_0x1e51('0x10')](_0x1e51('0x14'),_0x3e6ef2[_0x1e51('0x12')],_0x27dcad);_0x4d1aae(_0x40ae4c['error'](0x1f4,_0x3e6ef2['message']));});});};exports['ShowVtigerAccount']=function(_0x20eb9b){var _0x288b50=this;return new Promise(function(_0x1ba84a,_0x36dabe){return db[_0x1e51('0x15')][_0x1e51('0x1d')]({'raw':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')][_0x1e51('0x17')]===undefined?!![]:![]:!![],'where':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')]['where']||null:null,'attributes':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')][_0x1e51('0x1e')]||null:null,'include':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')]['include']?_[_0x1e51('0x1a')](_0x20eb9b['options'][_0x1e51('0x19')],function(_0x3fb57e){return{'model':db[_0x3fb57e[_0x1e51('0x1b')]],'as':_0x3fb57e['as'],'attributes':_0x3fb57e['attributes'],'include':_0x3fb57e[_0x1e51('0x19')]?_['map'](_0x3fb57e[_0x1e51('0x19')],function(_0x4e0187){return{'model':db[_0x4e0187['model']],'as':_0x4e0187['as'],'attributes':_0x4e0187[_0x1e51('0x1e')],'include':_0x4e0187[_0x1e51('0x19')]?_[_0x1e51('0x1a')](_0x4e0187['include'],function(_0x42ac30){return{'model':db[_0x42ac30['model']],'as':_0x42ac30['as'],'attributes':_0x42ac30[_0x1e51('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1e51('0x1c')](function(_0x5760ba){logger[_0x1e51('0xa')](_0x1e51('0x1f'),_0x20eb9b);logger[_0x1e51('0xd')](_0x1e51('0x1f'),_0x20eb9b,JSON[_0x1e51('0xf')](_0x5760ba));_0x1ba84a(_0x5760ba);})[_0x1e51('0x20')](function(_0x5c57a6){logger['error'](_0x1e51('0x1f'),_0x5c57a6['message'],_0x20eb9b);_0x36dabe(_0x288b50[_0x1e51('0x10')](0x1f4,_0x5c57a6[_0x1e51('0x12')]));});});}; \ No newline at end of file +var _0xbdb7=['model','map','ShowVtigerAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','attributes','limit','include'];(function(_0x118bb2,_0x57a6db){var _0x4be656=function(_0x585f26){while(--_0x585f26){_0x118bb2['push'](_0x118bb2['shift']());}};_0x4be656(++_0x57a6db);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x36d2e4,_0x49819a){_0x36d2e4=_0x36d2e4-0x0;var _0x3c32ae=_0xbdb7[_0x36d2e4];return _0x3c32ae;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});}exports[_0x7bdb('0x15')]=function(_0x5723f4){var _0x2aff6a=this;return new Promise(function(_0x4ffd4b,_0x41f540){return db[_0x7bdb('0x16')]['findAll']({'raw':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x18')]===undefined?!![]:![]:!![],'where':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')]['where']||null:null,'attributes':_0x5723f4['options']?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x19')]||null:null,'limit':_0x5723f4['options']?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1a')]||null:null,'include':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1b')]?_['map'](_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1b')],function(_0x40c447){return{'model':db[_0x40c447[_0x7bdb('0x1c')]],'as':_0x40c447['as'],'attributes':_0x40c447['attributes'],'include':_0x40c447['include']?_[_0x7bdb('0x1d')](_0x40c447['include'],function(_0x47abaf){return{'model':db[_0x47abaf['model']],'as':_0x47abaf['as'],'attributes':_0x47abaf[_0x7bdb('0x19')],'include':_0x47abaf['include']?_[_0x7bdb('0x1d')](_0x47abaf[_0x7bdb('0x1b')],function(_0x3ec129){return{'model':db[_0x3ec129[_0x7bdb('0x1c')]],'as':_0x3ec129['as'],'attributes':_0x3ec129[_0x7bdb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10e818){logger[_0x7bdb('0xb')](_0x7bdb('0x15'),_0x5723f4);logger[_0x7bdb('0xe')](_0x7bdb('0x15'),_0x5723f4,JSON[_0x7bdb('0x10')](_0x10e818));_0x4ffd4b(_0x10e818);})[_0x7bdb('0x14')](function(_0xd2d7be){logger[_0x7bdb('0x11')](_0x7bdb('0x15'),_0xd2d7be[_0x7bdb('0x12')],_0x5723f4);_0x41f540(_0x2aff6a[_0x7bdb('0x11')](0x1f4,_0xd2d7be['message']));});});};exports[_0x7bdb('0x1e')]=function(_0x23fc3a){var _0x8f7672=this;return new Promise(function(_0x9f5c1,_0x29eac5){return db['VtigerAccount'][_0x7bdb('0x1f')]({'raw':_0x23fc3a[_0x7bdb('0x17')]?_0x23fc3a[_0x7bdb('0x17')][_0x7bdb('0x18')]===undefined?!![]:![]:!![],'where':_0x23fc3a['options']?_0x23fc3a['options']['where']||null:null,'attributes':_0x23fc3a[_0x7bdb('0x17')]?_0x23fc3a['options'][_0x7bdb('0x19')]||null:null,'include':_0x23fc3a['options']?_0x23fc3a[_0x7bdb('0x17')][_0x7bdb('0x1b')]?_[_0x7bdb('0x1d')](_0x23fc3a['options'][_0x7bdb('0x1b')],function(_0x514713){return{'model':db[_0x514713['model']],'as':_0x514713['as'],'attributes':_0x514713[_0x7bdb('0x19')],'include':_0x514713['include']?_[_0x7bdb('0x1d')](_0x514713['include'],function(_0x5ee47d){return{'model':db[_0x5ee47d[_0x7bdb('0x1c')]],'as':_0x5ee47d['as'],'attributes':_0x5ee47d[_0x7bdb('0x19')],'include':_0x5ee47d[_0x7bdb('0x1b')]?_[_0x7bdb('0x1d')](_0x5ee47d[_0x7bdb('0x1b')],function(_0x2bb28a){return{'model':db[_0x2bb28a['model']],'as':_0x2bb28a['as'],'attributes':_0x2bb28a[_0x7bdb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7bdb('0x20')](function(_0x329ecf){logger[_0x7bdb('0xb')](_0x7bdb('0x1e'),_0x23fc3a);logger[_0x7bdb('0xe')](_0x7bdb('0x1e'),_0x23fc3a,JSON[_0x7bdb('0x10')](_0x329ecf));_0x9f5c1(_0x329ecf);})[_0x7bdb('0x14')](function(_0x4e1c97){logger['error'](_0x7bdb('0x1e'),_0x4e1c97[_0x7bdb('0x12')],_0x23fc3a);_0x29eac5(_0x8f7672[_0x7bdb('0x11')](0x1f4,_0x4e1c97[_0x7bdb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index fc5ecbb..b0ac9f0 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 _0x10a5=['isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get'];(function(_0x17202e,_0x418895){var _0x454e44=function(_0x2a1e27){while(--_0x2a1e27){_0x17202e['push'](_0x17202e['shift']());}};_0x454e44(++_0x418895);}(_0x10a5,0x15e));var _0x510a=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0x10a5[_0x3b6652];return _0x14d39f;};'use strict';var multer=require('multer');var util=require(_0x510a('0x0'));var path=require(_0x510a('0x1'));var timeout=require(_0x510a('0x2'));var express=require('express');var router=express[_0x510a('0x3')]();var fs_extra=require(_0x510a('0x4'));var auth=require(_0x510a('0x5'));var interaction=require(_0x510a('0x6'));var config=require(_0x510a('0x7'));var controller=require(_0x510a('0x8'));router[_0x510a('0x9')]('/',auth[_0x510a('0xa')](),controller['index']);router[_0x510a('0x9')](_0x510a('0xb'),auth[_0x510a('0xa')](),controller[_0x510a('0xc')]);router[_0x510a('0x9')](_0x510a('0xd'),auth[_0x510a('0xa')](),controller[_0x510a('0xe')]);router[_0x510a('0x9')](_0x510a('0xf'),auth[_0x510a('0xa')](),controller[_0x510a('0x10')]);router['get']('/:id/descriptions',auth[_0x510a('0xa')](),controller[_0x510a('0x11')]);router[_0x510a('0x12')]('/',auth['isAuthenticated'](),controller[_0x510a('0x13')]);router[_0x510a('0x14')](_0x510a('0xb'),auth[_0x510a('0xa')](),controller[_0x510a('0x15')]);router['delete']('/:id',auth[_0x510a('0xa')](),controller[_0x510a('0x16')]);module[_0x510a('0x17')]=router; \ No newline at end of file +var _0x9e2d=['/:id/fields','getFields','/:id/subjects','getSubjects','post','create','put','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9e2d,0xc1));var _0xd9e2=function(_0xc2c89e,_0x30e0cf){_0xc2c89e=_0xc2c89e-0x0;var _0x275fa7=_0x9e2d[_0xc2c89e];return _0x275fa7;};'use strict';var multer=require(_0xd9e2('0x0'));var util=require(_0xd9e2('0x1'));var path=require(_0xd9e2('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9e2('0x3'));var router=express[_0xd9e2('0x4')]();var fs_extra=require(_0xd9e2('0x5'));var auth=require(_0xd9e2('0x6'));var interaction=require(_0xd9e2('0x7'));var config=require('../../config/environment');var controller=require(_0xd9e2('0x8'));router[_0xd9e2('0x9')]('/',auth[_0xd9e2('0xa')](),controller[_0xd9e2('0xb')]);router['get'](_0xd9e2('0xc'),auth[_0xd9e2('0xa')](),controller[_0xd9e2('0xd')]);router[_0xd9e2('0x9')](_0xd9e2('0xe'),auth[_0xd9e2('0xa')](),controller[_0xd9e2('0xf')]);router[_0xd9e2('0x9')](_0xd9e2('0x10'),auth[_0xd9e2('0xa')](),controller[_0xd9e2('0x11')]);router['get']('/:id/descriptions',auth[_0xd9e2('0xa')](),controller['getDescriptions']);router[_0xd9e2('0x12')]('/',auth['isAuthenticated'](),controller[_0xd9e2('0x13')]);router[_0xd9e2('0x14')](_0xd9e2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd9e2('0x15')]('/:id',auth[_0xd9e2('0xa')](),controller[_0xd9e2('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 2c711dc..fd63b97 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 _0x47e8=['exports','STRING'];(function(_0x419a9e,_0x283d06){var _0x18105d=function(_0x37c434){while(--_0x37c434){_0x419a9e['push'](_0x419a9e['shift']());}};_0x18105d(++_0x283d06);}(_0x47e8,0x11e));var _0x847e=function(_0x2f5fcb,_0x4df21e){_0x2f5fcb=_0x2f5fcb-0x0;var _0x2fc15e=_0x47e8[_0x2f5fcb];return _0x2fc15e;};'use strict';var Sequelize=require('sequelize');module[_0x847e('0x0')]={'name':{'type':Sequelize[_0x847e('0x1')]},'description':{'type':Sequelize[_0x847e('0x1')]}}; \ No newline at end of file +var _0xb7cf=['STRING','exports'];(function(_0x3d092e,_0x24f686){var _0x45135d=function(_0x1ae2e7){while(--_0x1ae2e7){_0x3d092e['push'](_0x3d092e['shift']());}};_0x45135d(++_0x24f686);}(_0xb7cf,0x19d));var _0xfb7c=function(_0x22074d,_0x33df85){_0x22074d=_0x22074d-0x0;var _0x3a24ce=_0xb7cf[_0x22074d];return _0x3a24ce;};'use strict';var Sequelize=require('sequelize');module[_0xfb7c('0x0')]={'name':{'type':Sequelize[_0xfb7c('0x1')]},'description':{'type':Sequelize[_0xfb7c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 6739c2e..f0fa10e 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 _0x9114=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','VtigerField','getSubjects','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','VtigerConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x9114,0x72));var _0x4911=function(_0x49a2ac,_0x2e5df1){_0x49a2ac=_0x49a2ac-0x0;var _0x3113d2=_0x9114[_0x49a2ac];return _0x3113d2;};'use strict';var emlformat=require(_0x4911('0x0'));var rimraf=require(_0x4911('0x1'));var zipdir=require(_0x4911('0x2'));var jsonpatch=require(_0x4911('0x3'));var rp=require('request-promise');var moment=require(_0x4911('0x4'));var BPromise=require(_0x4911('0x5'));var Mustache=require(_0x4911('0x6'));var util=require(_0x4911('0x7'));var path=require(_0x4911('0x8'));var sox=require(_0x4911('0x9'));var csv=require(_0x4911('0xa'));var ejs=require(_0x4911('0xb'));var fs=require('fs');var fs_extra=require(_0x4911('0xc'));var _=require('lodash');var squel=require(_0x4911('0xd'));var crypto=require(_0x4911('0xe'));var jsforce=require(_0x4911('0xf'));var deskjs=require(_0x4911('0x10'));var toCsv=require(_0x4911('0xa'));var querystring=require(_0x4911('0x11'));var Papa=require(_0x4911('0x12'));var Redis=require(_0x4911('0x13'));var authService=require(_0x4911('0x14'));var qs=require(_0x4911('0x15'));var as=require(_0x4911('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4911('0x17'))(_0x4911('0x18'));var utils=require(_0x4911('0x19'));var config=require(_0x4911('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x4911('0x1b'))['db'];function respondWithStatusCode(_0x5abf3d,_0x4ca386){_0x4ca386=_0x4ca386||0xcc;return function(_0x4d620b){if(_0x4d620b){return _0x5abf3d[_0x4911('0x1c')](_0x4ca386);}return _0x5abf3d['status'](_0x4ca386)[_0x4911('0x1d')]();};}function respondWithResult(_0x3098f6,_0x2de3ac){_0x2de3ac=_0x2de3ac||0xc8;return function(_0x38de3e){if(_0x38de3e){return _0x3098f6[_0x4911('0x1e')](_0x2de3ac)[_0x4911('0x1f')](_0x38de3e);}};}function respondWithFilteredResult(_0x5f1624,_0x152da4){return function(_0x3f4c8a){if(_0x3f4c8a){var _0x5220ac=typeof _0x152da4[_0x4911('0x20')]==='undefined'&&typeof _0x152da4['limit']===_0x4911('0x21');var _0x41e0c2=_0x3f4c8a[_0x4911('0x22')];var _0x3f179c=_0x5220ac?0x0:_0x152da4[_0x4911('0x20')];var _0x51bda4=_0x5220ac?_0x3f4c8a[_0x4911('0x22')]:_0x152da4[_0x4911('0x20')]+_0x152da4['limit'];var _0x9c5b48;if(_0x51bda4>=_0x41e0c2){_0x51bda4=_0x41e0c2;_0x9c5b48=0xc8;}else{_0x9c5b48=0xce;}_0x5f1624[_0x4911('0x1e')](_0x9c5b48);return _0x5f1624[_0x4911('0x23')](_0x4911('0x24'),_0x3f179c+'-'+_0x51bda4+'/'+_0x41e0c2)['json'](_0x3f4c8a);}return null;};}function patchUpdates(_0xdd837c){return function(_0x1a9c9c){try{jsonpatch['apply'](_0x1a9c9c,_0xdd837c,!![]);}catch(_0xe72e89){return BPromise['reject'](_0xe72e89);}return _0x1a9c9c[_0x4911('0x25')]();};}function saveUpdates(_0x452c94,_0x596a6f){return function(_0xcfe614){if(_0xcfe614){return _0xcfe614[_0x4911('0x26')](_0x452c94)[_0x4911('0x27')](function(_0x2dc786){return _0x2dc786;});}return null;};}function removeEntity(_0x42e9fc,_0x1e0a79){return function(_0x40ca91){if(_0x40ca91){return _0x40ca91[_0x4911('0x28')]()[_0x4911('0x27')](function(){_0x42e9fc[_0x4911('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aca60,_0xbf2014){return function(_0xcba32e){if(!_0xcba32e){_0x3aca60[_0x4911('0x1c')](0x194);}return _0xcba32e;};}function handleError(_0x3e1561,_0x5047f5){_0x5047f5=_0x5047f5||0x1f4;return function(_0x366a6b){logger[_0x4911('0x29')](_0x366a6b[_0x4911('0x2a')]);if(_0x366a6b['name']){delete _0x366a6b[_0x4911('0x2b')];}_0x3e1561[_0x4911('0x1e')](_0x5047f5)[_0x4911('0x2c')](_0x366a6b);};}exports['index']=function(_0x1b9ae9,_0x3f84e6){var _0x26a0fd={},_0x3ff2d1={},_0x24ad04={'count':0x0,'rows':[]};var _0x2ddf0d=_['map'](db[_0x4911('0x2d')][_0x4911('0x2e')],function(_0x465006){return{'name':_0x465006[_0x4911('0x2f')],'type':_0x465006[_0x4911('0x30')][_0x4911('0x31')]};});_0x3ff2d1['model']=_[_0x4911('0x32')](_0x2ddf0d,_0x4911('0x2b'));_0x3ff2d1[_0x4911('0x33')]=_[_0x4911('0x34')](_0x1b9ae9[_0x4911('0x33')]);_0x3ff2d1[_0x4911('0x35')]=_[_0x4911('0x36')](_0x3ff2d1[_0x4911('0x37')],_0x3ff2d1['query']);_0x26a0fd[_0x4911('0x38')]=_[_0x4911('0x36')](_0x3ff2d1[_0x4911('0x37')],qs[_0x4911('0x39')](_0x1b9ae9[_0x4911('0x33')]['fields']));_0x26a0fd[_0x4911('0x38')]=_0x26a0fd[_0x4911('0x38')][_0x4911('0x3a')]?_0x26a0fd[_0x4911('0x38')]:_0x3ff2d1[_0x4911('0x37')];if(!_0x1b9ae9[_0x4911('0x33')][_0x4911('0x3b')](_0x4911('0x3c'))){_0x26a0fd[_0x4911('0x3d')]=qs[_0x4911('0x3d')](_0x1b9ae9[_0x4911('0x33')]['limit']);_0x26a0fd[_0x4911('0x20')]=qs[_0x4911('0x20')](_0x1b9ae9[_0x4911('0x33')][_0x4911('0x20')]);}_0x26a0fd[_0x4911('0x3e')]=qs['sort'](_0x1b9ae9[_0x4911('0x33')][_0x4911('0x3f')]);_0x26a0fd[_0x4911('0x40')]=qs[_0x4911('0x35')](_[_0x4911('0x41')](_0x1b9ae9[_0x4911('0x33')],_0x3ff2d1['filters']),_0x2ddf0d);if(_0x1b9ae9[_0x4911('0x33')][_0x4911('0x42')]){_0x26a0fd[_0x4911('0x40')]=_['merge'](_0x26a0fd[_0x4911('0x40')],{'$or':_['map'](_0x2ddf0d,function(_0xfa19c8){if(_0xfa19c8[_0x4911('0x30')]!==_0x4911('0x43')){var _0x3fa35e={};_0x3fa35e[_0xfa19c8['name']]={'$like':'%'+_0x1b9ae9[_0x4911('0x33')][_0x4911('0x42')]+'%'};return _0x3fa35e;}})});}_0x26a0fd=_[_0x4911('0x44')]({},_0x26a0fd,_0x1b9ae9[_0x4911('0x45')]);var _0x11c55a={'where':_0x26a0fd[_0x4911('0x40')]};return db[_0x4911('0x2d')][_0x4911('0x22')](_0x11c55a)[_0x4911('0x27')](function(_0x3fe6f5){_0x24ad04[_0x4911('0x22')]=_0x3fe6f5;if(_0x1b9ae9[_0x4911('0x33')][_0x4911('0x46')]){_0x26a0fd[_0x4911('0x47')]=[{'all':!![]}];}return db[_0x4911('0x2d')][_0x4911('0x48')](_0x26a0fd);})[_0x4911('0x27')](function(_0x589427){_0x24ad04[_0x4911('0x49')]=_0x589427;return _0x24ad04;})[_0x4911('0x27')](respondWithFilteredResult(_0x3f84e6,_0x26a0fd))[_0x4911('0x4a')](handleError(_0x3f84e6,null));};exports[_0x4911('0x4b')]=function(_0x1bafb3,_0xb80c54){var _0x1e0b62={'raw':![],'where':{'id':_0x1bafb3[_0x4911('0x4c')]['id']}},_0x32f6da={};_0x32f6da[_0x4911('0x37')]=_[_0x4911('0x34')](db['VtigerConfiguration'][_0x4911('0x2e')]);_0x32f6da[_0x4911('0x33')]=_['keys'](_0x1bafb3[_0x4911('0x33')]);_0x32f6da[_0x4911('0x35')]=_[_0x4911('0x36')](_0x32f6da[_0x4911('0x37')],_0x32f6da[_0x4911('0x33')]);_0x1e0b62[_0x4911('0x38')]=_['intersection'](_0x32f6da[_0x4911('0x37')],qs[_0x4911('0x39')](_0x1bafb3[_0x4911('0x33')]['fields']));_0x1e0b62[_0x4911('0x38')]=_0x1e0b62[_0x4911('0x38')][_0x4911('0x3a')]?_0x1e0b62[_0x4911('0x38')]:_0x32f6da[_0x4911('0x37')];if(_0x1bafb3[_0x4911('0x33')][_0x4911('0x46')]){_0x1e0b62[_0x4911('0x47')]=[{'all':!![]}];}_0x1e0b62=_[_0x4911('0x44')]({},_0x1e0b62,_0x1bafb3[_0x4911('0x45')]);return db[_0x4911('0x2d')][_0x4911('0x4d')](_0x1e0b62)[_0x4911('0x27')](handleEntityNotFound(_0xb80c54,null))[_0x4911('0x27')](respondWithResult(_0xb80c54,null))['catch'](handleError(_0xb80c54,null));};exports[_0x4911('0x4e')]=function(_0x2c448d,_0x14962e){return db[_0x4911('0x2d')]['create'](_0x2c448d[_0x4911('0x4f')],{})[_0x4911('0x27')](respondWithResult(_0x14962e,0xc9))[_0x4911('0x4a')](handleError(_0x14962e,null));};exports[_0x4911('0x26')]=function(_0x34992b,_0x37ad31){if(_0x34992b[_0x4911('0x4f')]['id']){delete _0x34992b[_0x4911('0x4f')]['id'];}return db[_0x4911('0x2d')]['find']({'where':{'id':_0x34992b[_0x4911('0x4c')]['id']}})[_0x4911('0x27')](handleEntityNotFound(_0x37ad31,null))[_0x4911('0x27')](saveUpdates(_0x34992b[_0x4911('0x4f')],null))['then'](respondWithResult(_0x37ad31,null))[_0x4911('0x4a')](handleError(_0x37ad31,null));};exports['destroy']=function(_0x2a167d,_0xb937fa){return db[_0x4911('0x2d')][_0x4911('0x4d')]({'where':{'id':_0x2a167d[_0x4911('0x4c')]['id']}})[_0x4911('0x27')](handleEntityNotFound(_0xb937fa,null))[_0x4911('0x27')](removeEntity(_0xb937fa,null))['catch'](handleError(_0xb937fa,null));};exports[_0x4911('0x50')]=function(_0x16be28,_0xf7e799,_0x25cfd3){var _0xbeeab2={};var _0x5a9e60={};var _0x22e093;var _0x5f1909;return db[_0x4911('0x2d')][_0x4911('0x51')]({'where':{'id':_0x16be28[_0x4911('0x4c')]['id']}})['then'](handleEntityNotFound(_0xf7e799,null))[_0x4911('0x27')](function(_0x4be6e6){if(_0x4be6e6){_0x22e093=_0x4be6e6;_0x5a9e60['model']=_[_0x4911('0x34')](db[_0x4911('0x52')]['rawAttributes']);_0x5a9e60['query']=_[_0x4911('0x34')](_0x16be28[_0x4911('0x33')]);_0x5a9e60[_0x4911('0x35')]=_[_0x4911('0x36')](_0x5a9e60['model'],_0x5a9e60[_0x4911('0x33')]);_0xbeeab2[_0x4911('0x38')]=_['intersection'](_0x5a9e60[_0x4911('0x37')],qs[_0x4911('0x39')](_0x16be28[_0x4911('0x33')][_0x4911('0x39')]));_0xbeeab2[_0x4911('0x38')]=_0xbeeab2[_0x4911('0x38')][_0x4911('0x3a')]?_0xbeeab2[_0x4911('0x38')]:_0x5a9e60[_0x4911('0x37')];_0xbeeab2['order']=qs[_0x4911('0x3f')](_0x16be28['query'][_0x4911('0x3f')]);_0xbeeab2[_0x4911('0x40')]=qs[_0x4911('0x35')](_[_0x4911('0x41')](_0x16be28[_0x4911('0x33')],_0x5a9e60[_0x4911('0x35')]));if(_0x16be28[_0x4911('0x33')]['filter']){_0xbeeab2[_0x4911('0x40')]=_[_0x4911('0x44')](_0xbeeab2['where'],{'$or':_[_0x4911('0x32')](_0xbeeab2[_0x4911('0x38')],function(_0x108734){var _0x5ce998={};_0x5ce998[_0x108734]={'$like':'%'+_0x16be28['query'][_0x4911('0x42')]+'%'};return _0x5ce998;})});}_0xbeeab2=_['merge']({},_0xbeeab2,_0x16be28['options']);return _0x22e093[_0x4911('0x50')](_0xbeeab2);}})[_0x4911('0x27')](function(_0x21e5a8){if(_0x21e5a8){_0x5f1909=_0x21e5a8['length'];if(!_0x16be28[_0x4911('0x33')][_0x4911('0x3b')]('nolimit')){_0xbeeab2[_0x4911('0x3d')]=qs[_0x4911('0x3d')](_0x16be28[_0x4911('0x33')]['limit']);_0xbeeab2[_0x4911('0x20')]=qs[_0x4911('0x20')](_0x16be28[_0x4911('0x33')][_0x4911('0x20')]);}return _0x22e093[_0x4911('0x50')](_0xbeeab2);}})[_0x4911('0x27')](function(_0xf7863f){if(_0xf7863f){return _0xf7863f?{'count':_0x5f1909,'rows':_0xf7863f}:null;}})[_0x4911('0x27')](respondWithResult(_0xf7e799,null))[_0x4911('0x4a')](handleError(_0xf7e799,null));};exports[_0x4911('0x53')]=function(_0x3ab8c6,_0x2f4afc,_0x258d53){var _0x810f6e={};var _0x402dfc={};var _0x57346d;var _0x1a7084;return db[_0x4911('0x2d')]['findOne']({'where':{'id':_0x3ab8c6[_0x4911('0x4c')]['id']}})[_0x4911('0x27')](handleEntityNotFound(_0x2f4afc,null))['then'](function(_0x131ccb){if(_0x131ccb){_0x57346d=_0x131ccb;_0x402dfc[_0x4911('0x37')]=_[_0x4911('0x34')](db[_0x4911('0x52')][_0x4911('0x2e')]);_0x402dfc[_0x4911('0x33')]=_[_0x4911('0x34')](_0x3ab8c6[_0x4911('0x33')]);_0x402dfc[_0x4911('0x35')]=_['intersection'](_0x402dfc[_0x4911('0x37')],_0x402dfc['query']);_0x810f6e['attributes']=_[_0x4911('0x36')](_0x402dfc[_0x4911('0x37')],qs[_0x4911('0x39')](_0x3ab8c6[_0x4911('0x33')][_0x4911('0x39')]));_0x810f6e['attributes']=_0x810f6e['attributes'][_0x4911('0x3a')]?_0x810f6e[_0x4911('0x38')]:_0x402dfc[_0x4911('0x37')];_0x810f6e[_0x4911('0x3e')]=qs['sort'](_0x3ab8c6[_0x4911('0x33')]['sort']);_0x810f6e[_0x4911('0x40')]=qs['filters'](_[_0x4911('0x41')](_0x3ab8c6[_0x4911('0x33')],_0x402dfc[_0x4911('0x35')]));if(_0x3ab8c6['query'][_0x4911('0x42')]){_0x810f6e[_0x4911('0x40')]=_[_0x4911('0x44')](_0x810f6e[_0x4911('0x40')],{'$or':_[_0x4911('0x32')](_0x810f6e['attributes'],function(_0x3e71c8){var _0x2ee5df={};_0x2ee5df[_0x3e71c8]={'$like':'%'+_0x3ab8c6[_0x4911('0x33')]['filter']+'%'};return _0x2ee5df;})});}_0x810f6e=_[_0x4911('0x44')]({},_0x810f6e,_0x3ab8c6[_0x4911('0x45')]);return _0x57346d['getSubjects'](_0x810f6e);}})[_0x4911('0x27')](function(_0xf70a9a){if(_0xf70a9a){_0x1a7084=_0xf70a9a[_0x4911('0x3a')];if(!_0x3ab8c6['query'][_0x4911('0x3b')](_0x4911('0x3c'))){_0x810f6e[_0x4911('0x3d')]=qs['limit'](_0x3ab8c6[_0x4911('0x33')][_0x4911('0x3d')]);_0x810f6e[_0x4911('0x20')]=qs[_0x4911('0x20')](_0x3ab8c6[_0x4911('0x33')]['offset']);}return _0x57346d[_0x4911('0x53')](_0x810f6e);}})['then'](function(_0x4fcb01){if(_0x4fcb01){return _0x4fcb01?{'count':_0x1a7084,'rows':_0x4fcb01}:null;}})[_0x4911('0x27')](respondWithResult(_0x2f4afc,null))['catch'](handleError(_0x2f4afc,null));};exports['getDescriptions']=function(_0x54e8ee,_0x23ddf1,_0x394a08){var _0x55bb6a={};var _0x541827={};var _0xd2732a;var _0xc419f6;return db[_0x4911('0x2d')][_0x4911('0x51')]({'where':{'id':_0x54e8ee['params']['id']}})['then'](handleEntityNotFound(_0x23ddf1,null))[_0x4911('0x27')](function(_0x51d704){if(_0x51d704){_0xd2732a=_0x51d704;_0x541827['model']=_[_0x4911('0x34')](db[_0x4911('0x52')][_0x4911('0x2e')]);_0x541827['query']=_[_0x4911('0x34')](_0x54e8ee['query']);_0x541827[_0x4911('0x35')]=_[_0x4911('0x36')](_0x541827['model'],_0x541827[_0x4911('0x33')]);_0x55bb6a['attributes']=_[_0x4911('0x36')](_0x541827[_0x4911('0x37')],qs[_0x4911('0x39')](_0x54e8ee[_0x4911('0x33')][_0x4911('0x39')]));_0x55bb6a['attributes']=_0x55bb6a[_0x4911('0x38')][_0x4911('0x3a')]?_0x55bb6a[_0x4911('0x38')]:_0x541827[_0x4911('0x37')];_0x55bb6a[_0x4911('0x3e')]=qs[_0x4911('0x3f')](_0x54e8ee[_0x4911('0x33')]['sort']);_0x55bb6a[_0x4911('0x40')]=qs[_0x4911('0x35')](_['pick'](_0x54e8ee['query'],_0x541827[_0x4911('0x35')]));if(_0x54e8ee[_0x4911('0x33')][_0x4911('0x42')]){_0x55bb6a[_0x4911('0x40')]=_[_0x4911('0x44')](_0x55bb6a[_0x4911('0x40')],{'$or':_[_0x4911('0x32')](_0x55bb6a['attributes'],function(_0xcf9bfb){var _0x467c50={};_0x467c50[_0xcf9bfb]={'$like':'%'+_0x54e8ee[_0x4911('0x33')][_0x4911('0x42')]+'%'};return _0x467c50;})});}_0x55bb6a=_['merge']({},_0x55bb6a,_0x54e8ee[_0x4911('0x45')]);return _0xd2732a['getDescriptions'](_0x55bb6a);}})['then'](function(_0x29abfc){if(_0x29abfc){_0xc419f6=_0x29abfc[_0x4911('0x3a')];if(!_0x54e8ee['query'][_0x4911('0x3b')]('nolimit')){_0x55bb6a[_0x4911('0x3d')]=qs[_0x4911('0x3d')](_0x54e8ee[_0x4911('0x33')]['limit']);_0x55bb6a[_0x4911('0x20')]=qs[_0x4911('0x20')](_0x54e8ee[_0x4911('0x33')]['offset']);}return _0xd2732a['getDescriptions'](_0x55bb6a);}})['then'](function(_0x10e097){if(_0x10e097){return _0x10e097?{'count':_0xc419f6,'rows':_0x10e097}:null;}})[_0x4911('0x27')](respondWithResult(_0x23ddf1,null))['catch'](handleError(_0x23ddf1,null));}; \ No newline at end of file +var _0x9fa9=['papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','VtigerConfiguration','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','filters','merge','options','find','create','body','update','getFields','findOne','VtigerField','sort','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','crypto','jsforce'];(function(_0x2a2da8,_0x3ee467){var _0x5bbfba=function(_0x44a5f9){while(--_0x44a5f9){_0x2a2da8['push'](_0x2a2da8['shift']());}};_0x5bbfba(++_0x3ee467);}(_0x9fa9,0x1c7));var _0x99fa=function(_0x5e4eed,_0x13c56a){_0x5e4eed=_0x5e4eed-0x0;var _0x5b367a=_0x9fa9[_0x5e4eed];return _0x5b367a;};'use strict';var emlformat=require(_0x99fa('0x0'));var rimraf=require(_0x99fa('0x1'));var zipdir=require(_0x99fa('0x2'));var jsonpatch=require(_0x99fa('0x3'));var rp=require(_0x99fa('0x4'));var moment=require(_0x99fa('0x5'));var BPromise=require(_0x99fa('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x99fa('0x7'));var sox=require(_0x99fa('0x8'));var csv=require(_0x99fa('0x9'));var ejs=require(_0x99fa('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x99fa('0xb'));var jsforce=require(_0x99fa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x99fa('0x9'));var querystring=require('querystring');var Papa=require(_0x99fa('0xd'));var Redis=require(_0x99fa('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x99fa('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x99fa('0x10'));var utils=require(_0x99fa('0x11'));var config=require(_0x99fa('0x12'));var licenseUtil=require(_0x99fa('0x13'));var db=require(_0x99fa('0x14'))['db'];function respondWithStatusCode(_0xd5483a,_0x115b1b){_0x115b1b=_0x115b1b||0xcc;return function(_0x47ed90){if(_0x47ed90){return _0xd5483a[_0x99fa('0x15')](_0x115b1b);}return _0xd5483a[_0x99fa('0x16')](_0x115b1b)[_0x99fa('0x17')]();};}function respondWithResult(_0x40b93a,_0x4ca185){_0x4ca185=_0x4ca185||0xc8;return function(_0xd06dd9){if(_0xd06dd9){return _0x40b93a[_0x99fa('0x16')](_0x4ca185)[_0x99fa('0x18')](_0xd06dd9);}};}function respondWithFilteredResult(_0x19120a,_0x34966a){return function(_0x4c1a12){if(_0x4c1a12){var _0x9876a6=typeof _0x34966a[_0x99fa('0x19')]==='undefined'&&typeof _0x34966a['limit']===_0x99fa('0x1a');var _0x38a6b2=_0x4c1a12['count'];var _0x4f1720=_0x9876a6?0x0:_0x34966a[_0x99fa('0x19')];var _0xeea973=_0x9876a6?_0x4c1a12[_0x99fa('0x1b')]:_0x34966a['offset']+_0x34966a[_0x99fa('0x1c')];var _0xa29aa1;if(_0xeea973>=_0x38a6b2){_0xeea973=_0x38a6b2;_0xa29aa1=0xc8;}else{_0xa29aa1=0xce;}_0x19120a[_0x99fa('0x16')](_0xa29aa1);return _0x19120a[_0x99fa('0x1d')](_0x99fa('0x1e'),_0x4f1720+'-'+_0xeea973+'/'+_0x38a6b2)[_0x99fa('0x18')](_0x4c1a12);}return null;};}function patchUpdates(_0xdb22d9){return function(_0xbbdf9b){try{jsonpatch[_0x99fa('0x1f')](_0xbbdf9b,_0xdb22d9,!![]);}catch(_0x1f1a04){return BPromise[_0x99fa('0x20')](_0x1f1a04);}return _0xbbdf9b[_0x99fa('0x21')]();};}function saveUpdates(_0x361726,_0x1413dc){return function(_0x3e8ae2){if(_0x3e8ae2){return _0x3e8ae2['update'](_0x361726)[_0x99fa('0x22')](function(_0x160a19){return _0x160a19;});}return null;};}function removeEntity(_0x39ae15,_0x46c052){return function(_0x462d7f){if(_0x462d7f){return _0x462d7f['destroy']()[_0x99fa('0x22')](function(){_0x39ae15[_0x99fa('0x16')](0xcc)[_0x99fa('0x17')]();});}};}function handleEntityNotFound(_0x541605,_0x2270f9){return function(_0x45ca52){if(!_0x45ca52){_0x541605['sendStatus'](0x194);}return _0x45ca52;};}function handleError(_0x3f29dd,_0x492c32){_0x492c32=_0x492c32||0x1f4;return function(_0x53793e){logger[_0x99fa('0x23')](_0x53793e[_0x99fa('0x24')]);if(_0x53793e[_0x99fa('0x25')]){delete _0x53793e[_0x99fa('0x25')];}_0x3f29dd[_0x99fa('0x16')](_0x492c32)[_0x99fa('0x26')](_0x53793e);};}exports['index']=function(_0x5eeeb1,_0x2bc5a1){var _0x243e9f={},_0x176523={},_0x3d0656={'count':0x0,'rows':[]};var _0x189061=_[_0x99fa('0x27')](db[_0x99fa('0x28')]['rawAttributes'],function(_0x302350){return{'name':_0x302350[_0x99fa('0x29')],'type':_0x302350[_0x99fa('0x2a')]['key']};});_0x176523[_0x99fa('0x2b')]=_[_0x99fa('0x27')](_0x189061,_0x99fa('0x25'));_0x176523[_0x99fa('0x2c')]=_['keys'](_0x5eeeb1[_0x99fa('0x2c')]);_0x176523['filters']=_[_0x99fa('0x2d')](_0x176523[_0x99fa('0x2b')],_0x176523[_0x99fa('0x2c')]);_0x243e9f['attributes']=_['intersection'](_0x176523[_0x99fa('0x2b')],qs[_0x99fa('0x2e')](_0x5eeeb1[_0x99fa('0x2c')][_0x99fa('0x2e')]));_0x243e9f[_0x99fa('0x2f')]=_0x243e9f['attributes'][_0x99fa('0x30')]?_0x243e9f[_0x99fa('0x2f')]:_0x176523['model'];if(!_0x5eeeb1[_0x99fa('0x2c')][_0x99fa('0x31')](_0x99fa('0x32'))){_0x243e9f[_0x99fa('0x1c')]=qs[_0x99fa('0x1c')](_0x5eeeb1['query']['limit']);_0x243e9f[_0x99fa('0x19')]=qs[_0x99fa('0x19')](_0x5eeeb1[_0x99fa('0x2c')][_0x99fa('0x19')]);}_0x243e9f[_0x99fa('0x33')]=qs['sort'](_0x5eeeb1[_0x99fa('0x2c')]['sort']);_0x243e9f[_0x99fa('0x34')]=qs['filters'](_[_0x99fa('0x35')](_0x5eeeb1[_0x99fa('0x2c')],_0x176523['filters']),_0x189061);if(_0x5eeeb1[_0x99fa('0x2c')]['filter']){_0x243e9f[_0x99fa('0x34')]=_['merge'](_0x243e9f[_0x99fa('0x34')],{'$or':_[_0x99fa('0x27')](_0x189061,function(_0x576883){if(_0x576883[_0x99fa('0x2a')]!==_0x99fa('0x36')){var _0x282c91={};_0x282c91[_0x576883['name']]={'$like':'%'+_0x5eeeb1[_0x99fa('0x2c')]['filter']+'%'};return _0x282c91;}})});}_0x243e9f=_['merge']({},_0x243e9f,_0x5eeeb1['options']);var _0x342532={'where':_0x243e9f[_0x99fa('0x34')]};return db[_0x99fa('0x28')]['count'](_0x342532)[_0x99fa('0x22')](function(_0x1fe508){_0x3d0656['count']=_0x1fe508;if(_0x5eeeb1[_0x99fa('0x2c')][_0x99fa('0x37')]){_0x243e9f[_0x99fa('0x38')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x99fa('0x39')](_0x243e9f);})[_0x99fa('0x22')](function(_0x243bf6){_0x3d0656[_0x99fa('0x3a')]=_0x243bf6;return _0x3d0656;})['then'](respondWithFilteredResult(_0x2bc5a1,_0x243e9f))[_0x99fa('0x3b')](handleError(_0x2bc5a1,null));};exports[_0x99fa('0x3c')]=function(_0x343106,_0x197e4b){var _0x139e97={'raw':![],'where':{'id':_0x343106[_0x99fa('0x3d')]['id']}},_0x3c0a99={};_0x3c0a99[_0x99fa('0x2b')]=_[_0x99fa('0x3e')](db['VtigerConfiguration'][_0x99fa('0x3f')]);_0x3c0a99[_0x99fa('0x2c')]=_[_0x99fa('0x3e')](_0x343106['query']);_0x3c0a99[_0x99fa('0x40')]=_['intersection'](_0x3c0a99[_0x99fa('0x2b')],_0x3c0a99[_0x99fa('0x2c')]);_0x139e97[_0x99fa('0x2f')]=_[_0x99fa('0x2d')](_0x3c0a99[_0x99fa('0x2b')],qs[_0x99fa('0x2e')](_0x343106[_0x99fa('0x2c')]['fields']));_0x139e97['attributes']=_0x139e97[_0x99fa('0x2f')][_0x99fa('0x30')]?_0x139e97['attributes']:_0x3c0a99[_0x99fa('0x2b')];if(_0x343106['query'][_0x99fa('0x37')]){_0x139e97['include']=[{'all':!![]}];}_0x139e97=_[_0x99fa('0x41')]({},_0x139e97,_0x343106[_0x99fa('0x42')]);return db[_0x99fa('0x28')][_0x99fa('0x43')](_0x139e97)['then'](handleEntityNotFound(_0x197e4b,null))[_0x99fa('0x22')](respondWithResult(_0x197e4b,null))['catch'](handleError(_0x197e4b,null));};exports['create']=function(_0x1e4f47,_0x5dc3d4){return db[_0x99fa('0x28')][_0x99fa('0x44')](_0x1e4f47[_0x99fa('0x45')],{})[_0x99fa('0x22')](respondWithResult(_0x5dc3d4,0xc9))[_0x99fa('0x3b')](handleError(_0x5dc3d4,null));};exports[_0x99fa('0x46')]=function(_0x2bd0a0,_0x4f6226){if(_0x2bd0a0[_0x99fa('0x45')]['id']){delete _0x2bd0a0[_0x99fa('0x45')]['id'];}return db[_0x99fa('0x28')][_0x99fa('0x43')]({'where':{'id':_0x2bd0a0[_0x99fa('0x3d')]['id']}})[_0x99fa('0x22')](handleEntityNotFound(_0x4f6226,null))[_0x99fa('0x22')](saveUpdates(_0x2bd0a0[_0x99fa('0x45')],null))[_0x99fa('0x22')](respondWithResult(_0x4f6226,null))[_0x99fa('0x3b')](handleError(_0x4f6226,null));};exports['destroy']=function(_0x2dff8c,_0x3a9e80){return db['VtigerConfiguration'][_0x99fa('0x43')]({'where':{'id':_0x2dff8c[_0x99fa('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3a9e80,null))[_0x99fa('0x22')](removeEntity(_0x3a9e80,null))[_0x99fa('0x3b')](handleError(_0x3a9e80,null));};exports[_0x99fa('0x47')]=function(_0x4a05ed,_0x20a879,_0x2b540e){var _0x179d58={};var _0x576385={};var _0x37f4fc;var _0x240ae1;return db[_0x99fa('0x28')][_0x99fa('0x48')]({'where':{'id':_0x4a05ed['params']['id']}})[_0x99fa('0x22')](handleEntityNotFound(_0x20a879,null))[_0x99fa('0x22')](function(_0x3f3a90){if(_0x3f3a90){_0x37f4fc=_0x3f3a90;_0x576385[_0x99fa('0x2b')]=_[_0x99fa('0x3e')](db[_0x99fa('0x49')][_0x99fa('0x3f')]);_0x576385[_0x99fa('0x2c')]=_[_0x99fa('0x3e')](_0x4a05ed['query']);_0x576385[_0x99fa('0x40')]=_[_0x99fa('0x2d')](_0x576385[_0x99fa('0x2b')],_0x576385[_0x99fa('0x2c')]);_0x179d58[_0x99fa('0x2f')]=_[_0x99fa('0x2d')](_0x576385[_0x99fa('0x2b')],qs[_0x99fa('0x2e')](_0x4a05ed['query'][_0x99fa('0x2e')]));_0x179d58[_0x99fa('0x2f')]=_0x179d58[_0x99fa('0x2f')]['length']?_0x179d58[_0x99fa('0x2f')]:_0x576385[_0x99fa('0x2b')];_0x179d58[_0x99fa('0x33')]=qs[_0x99fa('0x4a')](_0x4a05ed[_0x99fa('0x2c')][_0x99fa('0x4a')]);_0x179d58['where']=qs[_0x99fa('0x40')](_[_0x99fa('0x35')](_0x4a05ed[_0x99fa('0x2c')],_0x576385[_0x99fa('0x40')]));if(_0x4a05ed[_0x99fa('0x2c')][_0x99fa('0x4b')]){_0x179d58['where']=_[_0x99fa('0x41')](_0x179d58['where'],{'$or':_[_0x99fa('0x27')](_0x179d58[_0x99fa('0x2f')],function(_0x58fc84){var _0x2ade73={};_0x2ade73[_0x58fc84]={'$like':'%'+_0x4a05ed[_0x99fa('0x2c')][_0x99fa('0x4b')]+'%'};return _0x2ade73;})});}_0x179d58=_['merge']({},_0x179d58,_0x4a05ed['options']);return _0x37f4fc[_0x99fa('0x47')](_0x179d58);}})[_0x99fa('0x22')](function(_0x74af76){if(_0x74af76){_0x240ae1=_0x74af76[_0x99fa('0x30')];if(!_0x4a05ed[_0x99fa('0x2c')]['hasOwnProperty']('nolimit')){_0x179d58[_0x99fa('0x1c')]=qs['limit'](_0x4a05ed[_0x99fa('0x2c')][_0x99fa('0x1c')]);_0x179d58['offset']=qs['offset'](_0x4a05ed['query']['offset']);}return _0x37f4fc['getFields'](_0x179d58);}})['then'](function(_0x1cd2cc){if(_0x1cd2cc){return _0x1cd2cc?{'count':_0x240ae1,'rows':_0x1cd2cc}:null;}})[_0x99fa('0x22')](respondWithResult(_0x20a879,null))['catch'](handleError(_0x20a879,null));};exports[_0x99fa('0x4c')]=function(_0x377026,_0x29f9d2,_0x5ecce0){var _0xb41cb9={};var _0x23bb83={};var _0x271ba7;var _0x20eac2;return db[_0x99fa('0x28')][_0x99fa('0x48')]({'where':{'id':_0x377026[_0x99fa('0x3d')]['id']}})['then'](handleEntityNotFound(_0x29f9d2,null))['then'](function(_0x262223){if(_0x262223){_0x271ba7=_0x262223;_0x23bb83[_0x99fa('0x2b')]=_[_0x99fa('0x3e')](db[_0x99fa('0x49')]['rawAttributes']);_0x23bb83['query']=_[_0x99fa('0x3e')](_0x377026[_0x99fa('0x2c')]);_0x23bb83[_0x99fa('0x40')]=_[_0x99fa('0x2d')](_0x23bb83['model'],_0x23bb83[_0x99fa('0x2c')]);_0xb41cb9[_0x99fa('0x2f')]=_[_0x99fa('0x2d')](_0x23bb83[_0x99fa('0x2b')],qs[_0x99fa('0x2e')](_0x377026['query']['fields']));_0xb41cb9['attributes']=_0xb41cb9['attributes'][_0x99fa('0x30')]?_0xb41cb9['attributes']:_0x23bb83['model'];_0xb41cb9[_0x99fa('0x33')]=qs['sort'](_0x377026[_0x99fa('0x2c')][_0x99fa('0x4a')]);_0xb41cb9['where']=qs[_0x99fa('0x40')](_[_0x99fa('0x35')](_0x377026['query'],_0x23bb83[_0x99fa('0x40')]));if(_0x377026['query'][_0x99fa('0x4b')]){_0xb41cb9[_0x99fa('0x34')]=_[_0x99fa('0x41')](_0xb41cb9['where'],{'$or':_[_0x99fa('0x27')](_0xb41cb9[_0x99fa('0x2f')],function(_0x31c204){var _0xcc57cd={};_0xcc57cd[_0x31c204]={'$like':'%'+_0x377026[_0x99fa('0x2c')][_0x99fa('0x4b')]+'%'};return _0xcc57cd;})});}_0xb41cb9=_[_0x99fa('0x41')]({},_0xb41cb9,_0x377026[_0x99fa('0x42')]);return _0x271ba7['getSubjects'](_0xb41cb9);}})[_0x99fa('0x22')](function(_0x457b9d){if(_0x457b9d){_0x20eac2=_0x457b9d[_0x99fa('0x30')];if(!_0x377026['query']['hasOwnProperty'](_0x99fa('0x32'))){_0xb41cb9['limit']=qs[_0x99fa('0x1c')](_0x377026[_0x99fa('0x2c')][_0x99fa('0x1c')]);_0xb41cb9[_0x99fa('0x19')]=qs[_0x99fa('0x19')](_0x377026['query'][_0x99fa('0x19')]);}return _0x271ba7['getSubjects'](_0xb41cb9);}})['then'](function(_0x4e5517){if(_0x4e5517){return _0x4e5517?{'count':_0x20eac2,'rows':_0x4e5517}:null;}})['then'](respondWithResult(_0x29f9d2,null))[_0x99fa('0x3b')](handleError(_0x29f9d2,null));};exports['getDescriptions']=function(_0x3459ab,_0x12c010,_0x2ce94c){var _0x18bf43={};var _0x2f6426={};var _0x405edc;var _0x3fc021;return db[_0x99fa('0x28')][_0x99fa('0x48')]({'where':{'id':_0x3459ab[_0x99fa('0x3d')]['id']}})['then'](handleEntityNotFound(_0x12c010,null))[_0x99fa('0x22')](function(_0x5366b3){if(_0x5366b3){_0x405edc=_0x5366b3;_0x2f6426[_0x99fa('0x2b')]=_[_0x99fa('0x3e')](db[_0x99fa('0x49')][_0x99fa('0x3f')]);_0x2f6426[_0x99fa('0x2c')]=_['keys'](_0x3459ab[_0x99fa('0x2c')]);_0x2f6426[_0x99fa('0x40')]=_['intersection'](_0x2f6426[_0x99fa('0x2b')],_0x2f6426[_0x99fa('0x2c')]);_0x18bf43['attributes']=_[_0x99fa('0x2d')](_0x2f6426[_0x99fa('0x2b')],qs[_0x99fa('0x2e')](_0x3459ab[_0x99fa('0x2c')][_0x99fa('0x2e')]));_0x18bf43[_0x99fa('0x2f')]=_0x18bf43[_0x99fa('0x2f')][_0x99fa('0x30')]?_0x18bf43[_0x99fa('0x2f')]:_0x2f6426[_0x99fa('0x2b')];_0x18bf43[_0x99fa('0x33')]=qs[_0x99fa('0x4a')](_0x3459ab[_0x99fa('0x2c')][_0x99fa('0x4a')]);_0x18bf43[_0x99fa('0x34')]=qs[_0x99fa('0x40')](_[_0x99fa('0x35')](_0x3459ab['query'],_0x2f6426['filters']));if(_0x3459ab['query'][_0x99fa('0x4b')]){_0x18bf43['where']=_[_0x99fa('0x41')](_0x18bf43['where'],{'$or':_['map'](_0x18bf43[_0x99fa('0x2f')],function(_0x3f74a4){var _0x115f0e={};_0x115f0e[_0x3f74a4]={'$like':'%'+_0x3459ab['query'][_0x99fa('0x4b')]+'%'};return _0x115f0e;})});}_0x18bf43=_[_0x99fa('0x41')]({},_0x18bf43,_0x3459ab[_0x99fa('0x42')]);return _0x405edc[_0x99fa('0x4d')](_0x18bf43);}})[_0x99fa('0x22')](function(_0x5126c6){if(_0x5126c6){_0x3fc021=_0x5126c6['length'];if(!_0x3459ab[_0x99fa('0x2c')][_0x99fa('0x31')](_0x99fa('0x32'))){_0x18bf43[_0x99fa('0x1c')]=qs[_0x99fa('0x1c')](_0x3459ab[_0x99fa('0x2c')][_0x99fa('0x1c')]);_0x18bf43[_0x99fa('0x19')]=qs[_0x99fa('0x19')](_0x3459ab[_0x99fa('0x2c')][_0x99fa('0x19')]);}return _0x405edc['getDescriptions'](_0x18bf43);}})[_0x99fa('0x22')](function(_0x422f90){if(_0x422f90){return _0x422f90?{'count':_0x3fc021,'rows':_0x422f90}:null;}})['then'](respondWithResult(_0x12c010,null))['catch'](handleError(_0x12c010,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 2ff9611..1472b6d 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 _0xe37e=['exports','define','int_vtiger_configurations','lodash','util','api','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x1281c7,_0x46ef70){var _0x570b17=function(_0x1303ae){while(--_0x1303ae){_0x1281c7['push'](_0x1281c7['shift']());}};_0x570b17(++_0x46ef70);}(_0xe37e,0x19a));var _0xee37=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xe37e[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0xee37('0x0'));var util=require(_0xee37('0x1'));var logger=require('../../config/logger')(_0xee37('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xee37('0x3'));var fs=require('fs');var path=require(_0xee37('0x4'));var rimraf=require(_0xee37('0x5'));var config=require(_0xee37('0x6'));var attributes=require(_0xee37('0x7'));module[_0xee37('0x8')]=function(_0x78f286,_0x4f1515){return _0x78f286[_0xee37('0x9')]('VtigerConfiguration',attributes,{'tableName':_0xee37('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb657=['../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb657,0x179));var _0x7b65=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xb657[_0x26462c];return _0x509a42;};'use strict';var _=require(_0x7b65('0x0'));var util=require(_0x7b65('0x1'));var logger=require(_0x7b65('0x2'))(_0x7b65('0x3'));var moment=require('moment');var BPromise=require(_0x7b65('0x4'));var rp=require(_0x7b65('0x5'));var fs=require('fs');var path=require(_0x7b65('0x6'));var rimraf=require('rimraf');var config=require(_0x7b65('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x7b65('0x8')]=function(_0x5235d7,_0x358829){return _0x5235d7[_0x7b65('0x9')](_0x7b65('0xa'),attributes,{'tableName':_0x7b65('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 5165677..ab5e6b9 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 _0x61c4=['moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x49d9db,_0x41347b){var _0x5f049d=function(_0x2fb1ac){while(--_0x2fb1ac){_0x49d9db['push'](_0x49d9db['shift']());}};_0x5f049d(++_0x41347b);}(_0x61c4,0x1de));var _0x461c=function(_0x4d17fe,_0x5c4ac8){_0x4d17fe=_0x4d17fe-0x0;var _0x39fb4c=_0x61c4[_0x4d17fe];return _0x39fb4c;};'use strict';var _=require(_0x461c('0x0'));var util=require(_0x461c('0x1'));var moment=require(_0x461c('0x2'));var BPromise=require('bluebird');var rs=require(_0x461c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x461c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x461c('0x5'));var config=require(_0x461c('0x6'));var jayson=require(_0x461c('0x7'));var client=jayson[_0x461c('0x8')][_0x461c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x315617,_0x13bf33,_0x2e0baa){return new BPromise(function(_0x50ab3a,_0x68e78c){return client['request'](_0x315617,_0x2e0baa)[_0x461c('0xa')](function(_0x1ab0ff){logger[_0x461c('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x13bf33,_0x461c('0xc'));logger[_0x461c('0xd')](_0x461c('0xe'),_0x13bf33,'request\x20sent',JSON['stringify'](_0x1ab0ff));if(_0x1ab0ff[_0x461c('0xf')]){if(_0x1ab0ff[_0x461c('0xf')][_0x461c('0x10')]===0x1f4){logger[_0x461c('0xf')](_0x461c('0x11'),_0x13bf33,_0x1ab0ff[_0x461c('0xf')][_0x461c('0x12')]);return _0x68e78c(_0x1ab0ff[_0x461c('0xf')][_0x461c('0x12')]);}logger[_0x461c('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x13bf33,_0x1ab0ff[_0x461c('0xf')][_0x461c('0x12')]);return _0x50ab3a(_0x1ab0ff['error'][_0x461c('0x12')]);}else{logger[_0x461c('0xb')](_0x461c('0x11'),_0x13bf33,'request\x20sent');_0x50ab3a(_0x1ab0ff[_0x461c('0x13')][_0x461c('0x12')]);}})['catch'](function(_0x3c5862){logger[_0x461c('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x13bf33,_0x3c5862);_0x68e78c(_0x3c5862);});});} \ No newline at end of file +var _0xd819=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0xb4818b,_0x465911){var _0x3f9188=function(_0x4a81f9){while(--_0x4a81f9){_0xb4818b['push'](_0xb4818b['shift']());}};_0x3f9188(++_0x465911);}(_0xd819,0x154));var _0x9d81=function(_0x12c076,_0x5bef17){_0x12c076=_0x12c076-0x0;var _0x2ddd18=_0xd819[_0x12c076];return _0x2ddd18;};'use strict';var _=require(_0x9d81('0x0'));var util=require(_0x9d81('0x1'));var moment=require('moment');var BPromise=require(_0x9d81('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d81('0x3'));var db=require(_0x9d81('0x4'))['db'];var utils=require(_0x9d81('0x5'));var logger=require(_0x9d81('0x6'))(_0x9d81('0x7'));var config=require(_0x9d81('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d81('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5849d3,_0x4b2783,_0x126dd0){return new BPromise(function(_0x1db0b8,_0x1ef9f0){return client[_0x9d81('0xa')](_0x5849d3,_0x126dd0)[_0x9d81('0xb')](function(_0x4ccd3b){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x4b2783,'request\x20sent');logger['debug'](_0x9d81('0xc'),_0x4b2783,_0x9d81('0xd'),JSON[_0x9d81('0xe')](_0x4ccd3b));if(_0x4ccd3b['error']){if(_0x4ccd3b[_0x9d81('0xf')][_0x9d81('0x10')]===0x1f4){logger[_0x9d81('0xf')](_0x9d81('0x11'),_0x4b2783,_0x4ccd3b['error']['message']);return _0x1ef9f0(_0x4ccd3b[_0x9d81('0xf')][_0x9d81('0x12')]);}logger[_0x9d81('0xf')](_0x9d81('0x11'),_0x4b2783,_0x4ccd3b[_0x9d81('0xf')][_0x9d81('0x12')]);return _0x1db0b8(_0x4ccd3b['error'][_0x9d81('0x12')]);}else{logger[_0x9d81('0x13')](_0x9d81('0x11'),_0x4b2783,_0x9d81('0xd'));_0x1db0b8(_0x4ccd3b[_0x9d81('0x14')][_0x9d81('0x12')]);}})[_0x9d81('0x15')](function(_0x5b2abb){logger[_0x9d81('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x4b2783,_0x5b2abb);_0x1ef9f0(_0x5b2abb);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 2b0e628..841d4f9 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 _0x563e=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id','isAuthenticated','show','put','destroy'];(function(_0x36375a,_0x43ede3){var _0xe646d0=function(_0x4e9ea2){while(--_0x4e9ea2){_0x36375a['push'](_0x36375a['shift']());}};_0xe646d0(++_0x43ede3);}(_0x563e,0x78));var _0xe563=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x563e[_0xbeb808];return _0x5d6909;};'use strict';var multer=require(_0xe563('0x0'));var util=require(_0xe563('0x1'));var path=require(_0xe563('0x2'));var timeout=require(_0xe563('0x3'));var express=require('express');var router=express[_0xe563('0x4')]();var fs_extra=require(_0xe563('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe563('0x6'));var config=require(_0xe563('0x7'));var controller=require(_0xe563('0x8'));router[_0xe563('0x9')]('/',auth['isAuthenticated'](),controller[_0xe563('0xa')]);router[_0xe563('0x9')](_0xe563('0xb'),auth[_0xe563('0xc')](),controller[_0xe563('0xd')]);router['post']('/',auth[_0xe563('0xc')](),controller['create']);router[_0xe563('0xe')]('/:id',auth[_0xe563('0xc')](),controller['update']);router['delete'](_0xe563('0xb'),auth['isAuthenticated'](),controller[_0xe563('0xf')]);module[_0xe563('0x10')]=router; \ No newline at end of file +var _0x835d=['../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','post','create','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x835d,0x171));var _0xd835=function(_0x985775,_0x2d4d27){_0x985775=_0x985775-0x0;var _0x1dcc3a=_0x835d[_0x985775];return _0x1dcc3a;};'use strict';var multer=require(_0xd835('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd835('0x1'));var express=require(_0xd835('0x2'));var router=express[_0xd835('0x3')]();var fs_extra=require(_0xd835('0x4'));var auth=require(_0xd835('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd835('0x6'));var controller=require(_0xd835('0x7'));router[_0xd835('0x8')]('/',auth[_0xd835('0x9')](),controller['index']);router['get'](_0xd835('0xa'),auth[_0xd835('0x9')](),controller['show']);router[_0xd835('0xb')]('/',auth['isAuthenticated'](),controller[_0xd835('0xc')]);router[_0xd835('0xd')](_0xd835('0xa'),auth[_0xd835('0x9')](),controller[_0xd835('0xe')]);router['delete'](_0xd835('0xa'),auth[_0xd835('0x9')](),controller[_0xd835('0xf')]);module[_0xd835('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c4527b5..6fe9b8f 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 _0x662f=['ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports'];(function(_0x311baf,_0x2bfe98){var _0x2dcfb0=function(_0x47e8d2){while(--_0x47e8d2){_0x311baf['push'](_0x311baf['shift']());}};_0x2dcfb0(++_0x2bfe98);}(_0x662f,0xb2));var _0xf662=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x662f[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xf662('0x0'));module[_0xf662('0x1')]={'type':{'type':Sequelize[_0xf662('0x2')]('string',_0xf662('0x3'),_0xf662('0x4'),_0xf662('0x5'),_0xf662('0x6')),'defaultValue':_0xf662('0x7')},'content':{'type':Sequelize[_0xf662('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf662('0x2')](_0xf662('0x7'),'variable',_0xf662('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf662('0x8')]},'nameField':{'type':Sequelize[_0xf662('0x8')]},'customField':{'type':Sequelize[_0xf662('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf662('0x8')]}}; \ No newline at end of file +var _0xe986=['customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x9e797,_0x3202e4){var _0xb84cd0=function(_0x21a94b){while(--_0x21a94b){_0x9e797['push'](_0x9e797['shift']());}};_0xb84cd0(++_0x3202e4);}(_0xe986,0x16c));var _0x6e98=function(_0x4f5eb1,_0x3710a5){_0x4f5eb1=_0x4f5eb1-0x0;var _0xd59aec=_0xe986[_0x4f5eb1];return _0xd59aec;};'use strict';var Sequelize=require(_0x6e98('0x0'));module[_0x6e98('0x1')]={'type':{'type':Sequelize[_0x6e98('0x2')](_0x6e98('0x3'),_0x6e98('0x4'),_0x6e98('0x5'),'keyValue',_0x6e98('0x6')),'defaultValue':_0x6e98('0x3')},'content':{'type':Sequelize[_0x6e98('0x7')]},'key':{'type':Sequelize[_0x6e98('0x7')]},'keyType':{'type':Sequelize[_0x6e98('0x2')](_0x6e98('0x3'),'variable',_0x6e98('0x5'))},'keyContent':{'type':Sequelize[_0x6e98('0x7')]},'idField':{'type':Sequelize[_0x6e98('0x7')]},'nameField':{'type':Sequelize[_0x6e98('0x7')]},'customField':{'type':Sequelize[_0x6e98('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 8a76bf4..3fe460c 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 _0xaeba=['error','stack','send','map','VtigerField','rawAttributes','fieldName','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','show','include','find','catch','create','body','update','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy'];(function(_0x3ed128,_0x4b8e07){var _0x27d634=function(_0x204667){while(--_0x204667){_0x3ed128['push'](_0x3ed128['shift']());}};_0x27d634(++_0x4b8e07);}(_0xaeba,0x1cc));var _0xaaeb=function(_0x510bbc,_0x5c4903){_0x510bbc=_0x510bbc-0x0;var _0x34a6ae=_0xaeba[_0x510bbc];return _0x34a6ae;};'use strict';var emlformat=require(_0xaaeb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaaeb('0x1'));var rp=require('request-promise');var moment=require(_0xaaeb('0x2'));var BPromise=require(_0xaaeb('0x3'));var Mustache=require(_0xaaeb('0x4'));var util=require(_0xaaeb('0x5'));var path=require('path');var sox=require(_0xaaeb('0x6'));var csv=require('to-csv');var ejs=require(_0xaaeb('0x7'));var fs=require('fs');var fs_extra=require(_0xaaeb('0x8'));var _=require('lodash');var squel=require(_0xaaeb('0x9'));var crypto=require(_0xaaeb('0xa'));var jsforce=require(_0xaaeb('0xb'));var deskjs=require(_0xaaeb('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaaeb('0xd'));var Papa=require(_0xaaeb('0xe'));var Redis=require(_0xaaeb('0xf'));var authService=require(_0xaaeb('0x10'));var qs=require(_0xaaeb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaaeb('0x12'))(_0xaaeb('0x13'));var utils=require(_0xaaeb('0x14'));var config=require(_0xaaeb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xaaeb('0x16'))['db'];function respondWithStatusCode(_0x565553,_0x1f4d0a){_0x1f4d0a=_0x1f4d0a||0xcc;return function(_0x2600d6){if(_0x2600d6){return _0x565553[_0xaaeb('0x17')](_0x1f4d0a);}return _0x565553[_0xaaeb('0x18')](_0x1f4d0a)[_0xaaeb('0x19')]();};}function respondWithResult(_0x1cb30f,_0x188b34){_0x188b34=_0x188b34||0xc8;return function(_0x40b9e1){if(_0x40b9e1){return _0x1cb30f['status'](_0x188b34)[_0xaaeb('0x1a')](_0x40b9e1);}};}function respondWithFilteredResult(_0x2f433e,_0x18b231){return function(_0x16b071){if(_0x16b071){var _0x258e8b=typeof _0x18b231[_0xaaeb('0x1b')]==='undefined'&&typeof _0x18b231[_0xaaeb('0x1c')]===_0xaaeb('0x1d');var _0x3c5f18=_0x16b071[_0xaaeb('0x1e')];var _0x203c97=_0x258e8b?0x0:_0x18b231[_0xaaeb('0x1b')];var _0x457cc7=_0x258e8b?_0x16b071[_0xaaeb('0x1e')]:_0x18b231['offset']+_0x18b231['limit'];var _0xad2375;if(_0x457cc7>=_0x3c5f18){_0x457cc7=_0x3c5f18;_0xad2375=0xc8;}else{_0xad2375=0xce;}_0x2f433e['status'](_0xad2375);return _0x2f433e[_0xaaeb('0x1f')](_0xaaeb('0x20'),_0x203c97+'-'+_0x457cc7+'/'+_0x3c5f18)[_0xaaeb('0x1a')](_0x16b071);}return null;};}function patchUpdates(_0x4f38e9){return function(_0x5a8a98){try{jsonpatch[_0xaaeb('0x21')](_0x5a8a98,_0x4f38e9,!![]);}catch(_0x4572a2){return BPromise['reject'](_0x4572a2);}return _0x5a8a98[_0xaaeb('0x22')]();};}function saveUpdates(_0x3ef5f1,_0x48c730){return function(_0x5e0d8e){if(_0x5e0d8e){return _0x5e0d8e['update'](_0x3ef5f1)[_0xaaeb('0x23')](function(_0x47bb12){return _0x47bb12;});}return null;};}function removeEntity(_0x56921e,_0x4face9){return function(_0x119b48){if(_0x119b48){return _0x119b48[_0xaaeb('0x24')]()['then'](function(){_0x56921e[_0xaaeb('0x18')](0xcc)[_0xaaeb('0x19')]();});}};}function handleEntityNotFound(_0x40edd5,_0x61fa3a){return function(_0x66ac67){if(!_0x66ac67){_0x40edd5[_0xaaeb('0x17')](0x194);}return _0x66ac67;};}function handleError(_0x37f483,_0x8c7917){_0x8c7917=_0x8c7917||0x1f4;return function(_0x6b158f){logger[_0xaaeb('0x25')](_0x6b158f[_0xaaeb('0x26')]);if(_0x6b158f['name']){delete _0x6b158f['name'];}_0x37f483[_0xaaeb('0x18')](_0x8c7917)[_0xaaeb('0x27')](_0x6b158f);};}exports['index']=function(_0x5b49ac,_0x6b93b9){var _0x31c94f={},_0x9c085d={},_0x6c289f={'count':0x0,'rows':[]};var _0x28bb27=_[_0xaaeb('0x28')](db[_0xaaeb('0x29')][_0xaaeb('0x2a')],function(_0x4e35d6){return{'name':_0x4e35d6[_0xaaeb('0x2b')],'type':_0x4e35d6['type']['key']};});_0x9c085d[_0xaaeb('0x2c')]=_[_0xaaeb('0x28')](_0x28bb27,_0xaaeb('0x2d'));_0x9c085d[_0xaaeb('0x2e')]=_[_0xaaeb('0x2f')](_0x5b49ac['query']);_0x9c085d['filters']=_[_0xaaeb('0x30')](_0x9c085d[_0xaaeb('0x2c')],_0x9c085d['query']);_0x31c94f[_0xaaeb('0x31')]=_['intersection'](_0x9c085d[_0xaaeb('0x2c')],qs[_0xaaeb('0x32')](_0x5b49ac[_0xaaeb('0x2e')][_0xaaeb('0x32')]));_0x31c94f['attributes']=_0x31c94f[_0xaaeb('0x31')][_0xaaeb('0x33')]?_0x31c94f[_0xaaeb('0x31')]:_0x9c085d[_0xaaeb('0x2c')];if(!_0x5b49ac[_0xaaeb('0x2e')][_0xaaeb('0x34')](_0xaaeb('0x35'))){_0x31c94f[_0xaaeb('0x1c')]=qs[_0xaaeb('0x1c')](_0x5b49ac['query'][_0xaaeb('0x1c')]);_0x31c94f[_0xaaeb('0x1b')]=qs[_0xaaeb('0x1b')](_0x5b49ac['query'][_0xaaeb('0x1b')]);}_0x31c94f[_0xaaeb('0x36')]=qs[_0xaaeb('0x37')](_0x5b49ac['query'][_0xaaeb('0x37')]);_0x31c94f[_0xaaeb('0x38')]=qs['filters'](_[_0xaaeb('0x39')](_0x5b49ac['query'],_0x9c085d[_0xaaeb('0x3a')]),_0x28bb27);if(_0x5b49ac[_0xaaeb('0x2e')][_0xaaeb('0x3b')]){_0x31c94f[_0xaaeb('0x38')]=_[_0xaaeb('0x3c')](_0x31c94f[_0xaaeb('0x38')],{'$or':_['map'](_0x28bb27,function(_0x16a14a){if(_0x16a14a['type']!==_0xaaeb('0x3d')){var _0x5664c0={};_0x5664c0[_0x16a14a[_0xaaeb('0x2d')]]={'$like':'%'+_0x5b49ac['query'][_0xaaeb('0x3b')]+'%'};return _0x5664c0;}})});}_0x31c94f=_[_0xaaeb('0x3c')]({},_0x31c94f,_0x5b49ac[_0xaaeb('0x3e')]);var _0xaf4640={'where':_0x31c94f[_0xaaeb('0x38')]};return db['VtigerField'][_0xaaeb('0x1e')](_0xaf4640)[_0xaaeb('0x23')](function(_0x25a837){_0x6c289f[_0xaaeb('0x1e')]=_0x25a837;if(_0x5b49ac[_0xaaeb('0x2e')][_0xaaeb('0x3f')]){_0x31c94f['include']=[{'all':!![]}];}return db[_0xaaeb('0x29')]['findAll'](_0x31c94f);})[_0xaaeb('0x23')](function(_0xbfdbe){_0x6c289f['rows']=_0xbfdbe;return _0x6c289f;})[_0xaaeb('0x23')](respondWithFilteredResult(_0x6b93b9,_0x31c94f))['catch'](handleError(_0x6b93b9,null));};exports[_0xaaeb('0x40')]=function(_0x3e37b3,_0x2bdac0){var _0x33d715={'raw':!![],'where':{'id':_0x3e37b3['params']['id']}},_0x721825={};_0x721825[_0xaaeb('0x2c')]=_[_0xaaeb('0x2f')](db[_0xaaeb('0x29')][_0xaaeb('0x2a')]);_0x721825['query']=_[_0xaaeb('0x2f')](_0x3e37b3[_0xaaeb('0x2e')]);_0x721825[_0xaaeb('0x3a')]=_[_0xaaeb('0x30')](_0x721825[_0xaaeb('0x2c')],_0x721825[_0xaaeb('0x2e')]);_0x33d715[_0xaaeb('0x31')]=_[_0xaaeb('0x30')](_0x721825[_0xaaeb('0x2c')],qs['fields'](_0x3e37b3[_0xaaeb('0x2e')][_0xaaeb('0x32')]));_0x33d715[_0xaaeb('0x31')]=_0x33d715['attributes'][_0xaaeb('0x33')]?_0x33d715[_0xaaeb('0x31')]:_0x721825[_0xaaeb('0x2c')];if(_0x3e37b3[_0xaaeb('0x2e')][_0xaaeb('0x3f')]){_0x33d715[_0xaaeb('0x41')]=[{'all':!![]}];}_0x33d715=_[_0xaaeb('0x3c')]({},_0x33d715,_0x3e37b3[_0xaaeb('0x3e')]);return db[_0xaaeb('0x29')][_0xaaeb('0x42')](_0x33d715)['then'](handleEntityNotFound(_0x2bdac0,null))[_0xaaeb('0x23')](respondWithResult(_0x2bdac0,null))[_0xaaeb('0x43')](handleError(_0x2bdac0,null));};exports[_0xaaeb('0x44')]=function(_0xfdb6d6,_0x161a53){return db[_0xaaeb('0x29')]['create'](_0xfdb6d6[_0xaaeb('0x45')],{})['then'](respondWithResult(_0x161a53,0xc9))[_0xaaeb('0x43')](handleError(_0x161a53,null));};exports[_0xaaeb('0x46')]=function(_0x547d87,_0x1e3350){if(_0x547d87['body']['id']){delete _0x547d87[_0xaaeb('0x45')]['id'];}return db['VtigerField'][_0xaaeb('0x42')]({'where':{'id':_0x547d87['params']['id']}})['then'](handleEntityNotFound(_0x1e3350,null))[_0xaaeb('0x23')](saveUpdates(_0x547d87[_0xaaeb('0x45')],null))['then'](respondWithResult(_0x1e3350,null))[_0xaaeb('0x43')](handleError(_0x1e3350,null));};exports[_0xaaeb('0x24')]=function(_0x37a5b2,_0x1ccef7){return db[_0xaaeb('0x29')][_0xaaeb('0x42')]({'where':{'id':_0x37a5b2['params']['id']}})[_0xaaeb('0x23')](handleEntityNotFound(_0x1ccef7,null))[_0xaaeb('0x23')](removeEntity(_0x1ccef7,null))[_0xaaeb('0x43')](handleError(_0x1ccef7,null));}; \ No newline at end of file +var _0x83a4=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','offset','undefined','limit','set','Content-Range','apply','reject','update','then','end','error','stack','name','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','include','rows','catch','show','length','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x233441,_0x51e6cd){var _0x20c825=function(_0x5add2e){while(--_0x5add2e){_0x233441['push'](_0x233441['shift']());}};_0x20c825(++_0x51e6cd);}(_0x83a4,0x165));var _0x483a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x83a4[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x483a('0x0'));var rimraf=require(_0x483a('0x1'));var zipdir=require(_0x483a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x483a('0x3'));var moment=require(_0x483a('0x4'));var BPromise=require(_0x483a('0x5'));var Mustache=require(_0x483a('0x6'));var util=require(_0x483a('0x7'));var path=require(_0x483a('0x8'));var sox=require(_0x483a('0x9'));var csv=require(_0x483a('0xa'));var ejs=require(_0x483a('0xb'));var fs=require('fs');var fs_extra=require(_0x483a('0xc'));var _=require(_0x483a('0xd'));var squel=require(_0x483a('0xe'));var crypto=require(_0x483a('0xf'));var jsforce=require(_0x483a('0x10'));var deskjs=require(_0x483a('0x11'));var toCsv=require(_0x483a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x483a('0x12'));var authService=require(_0x483a('0x13'));var qs=require(_0x483a('0x14'));var as=require(_0x483a('0x15'));var hardwareService=require(_0x483a('0x16'));var logger=require(_0x483a('0x17'))(_0x483a('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x483a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15ab90,_0x50e242){_0x50e242=_0x50e242||0xcc;return function(_0x499ea6){if(_0x499ea6){return _0x15ab90[_0x483a('0x1a')](_0x50e242);}return _0x15ab90['status'](_0x50e242)['end']();};}function respondWithResult(_0x3891f3,_0x43713c){_0x43713c=_0x43713c||0xc8;return function(_0x150b72){if(_0x150b72){return _0x3891f3[_0x483a('0x1b')](_0x43713c)['json'](_0x150b72);}};}function respondWithFilteredResult(_0x1277ac,_0x4d9b02){return function(_0x111daf){if(_0x111daf){var _0x5d80b4=typeof _0x4d9b02[_0x483a('0x1c')]===_0x483a('0x1d')&&typeof _0x4d9b02[_0x483a('0x1e')]===_0x483a('0x1d');var _0x350554=_0x111daf['count'];var _0x51e1b7=_0x5d80b4?0x0:_0x4d9b02[_0x483a('0x1c')];var _0x46d255=_0x5d80b4?_0x111daf['count']:_0x4d9b02[_0x483a('0x1c')]+_0x4d9b02[_0x483a('0x1e')];var _0x5da510;if(_0x46d255>=_0x350554){_0x46d255=_0x350554;_0x5da510=0xc8;}else{_0x5da510=0xce;}_0x1277ac[_0x483a('0x1b')](_0x5da510);return _0x1277ac[_0x483a('0x1f')](_0x483a('0x20'),_0x51e1b7+'-'+_0x46d255+'/'+_0x350554)['json'](_0x111daf);}return null;};}function patchUpdates(_0x513e7b){return function(_0x294d19){try{jsonpatch[_0x483a('0x21')](_0x294d19,_0x513e7b,!![]);}catch(_0x365674){return BPromise[_0x483a('0x22')](_0x365674);}return _0x294d19['save']();};}function saveUpdates(_0x30dbee,_0x4acf35){return function(_0x59e34c){if(_0x59e34c){return _0x59e34c[_0x483a('0x23')](_0x30dbee)['then'](function(_0x19cb3a){return _0x19cb3a;});}return null;};}function removeEntity(_0x2119f8,_0x3064e0){return function(_0x4075f7){if(_0x4075f7){return _0x4075f7['destroy']()[_0x483a('0x24')](function(){_0x2119f8[_0x483a('0x1b')](0xcc)[_0x483a('0x25')]();});}};}function handleEntityNotFound(_0x3e60bd,_0x59fa6c){return function(_0x4440eb){if(!_0x4440eb){_0x3e60bd[_0x483a('0x1a')](0x194);}return _0x4440eb;};}function handleError(_0xf818c8,_0x138200){_0x138200=_0x138200||0x1f4;return function(_0x52919b){logger[_0x483a('0x26')](_0x52919b[_0x483a('0x27')]);if(_0x52919b[_0x483a('0x28')]){delete _0x52919b['name'];}_0xf818c8[_0x483a('0x1b')](_0x138200)['send'](_0x52919b);};}exports['index']=function(_0x5caf3e,_0x2d9d96){var _0x1e254e={},_0x263dd9={},_0x85f805={'count':0x0,'rows':[]};var _0x166f27=_['map'](db[_0x483a('0x29')][_0x483a('0x2a')],function(_0x398634){return{'name':_0x398634[_0x483a('0x2b')],'type':_0x398634[_0x483a('0x2c')][_0x483a('0x2d')]};});_0x263dd9[_0x483a('0x2e')]=_['map'](_0x166f27,_0x483a('0x28'));_0x263dd9[_0x483a('0x2f')]=_[_0x483a('0x30')](_0x5caf3e['query']);_0x263dd9[_0x483a('0x31')]=_['intersection'](_0x263dd9[_0x483a('0x2e')],_0x263dd9[_0x483a('0x2f')]);_0x1e254e[_0x483a('0x32')]=_[_0x483a('0x33')](_0x263dd9[_0x483a('0x2e')],qs[_0x483a('0x34')](_0x5caf3e[_0x483a('0x2f')][_0x483a('0x34')]));_0x1e254e['attributes']=_0x1e254e[_0x483a('0x32')]['length']?_0x1e254e['attributes']:_0x263dd9['model'];if(!_0x5caf3e['query'][_0x483a('0x35')](_0x483a('0x36'))){_0x1e254e['limit']=qs[_0x483a('0x1e')](_0x5caf3e[_0x483a('0x2f')][_0x483a('0x1e')]);_0x1e254e['offset']=qs['offset'](_0x5caf3e['query'][_0x483a('0x1c')]);}_0x1e254e['order']=qs[_0x483a('0x37')](_0x5caf3e['query']['sort']);_0x1e254e['where']=qs[_0x483a('0x31')](_[_0x483a('0x38')](_0x5caf3e[_0x483a('0x2f')],_0x263dd9[_0x483a('0x31')]),_0x166f27);if(_0x5caf3e[_0x483a('0x2f')][_0x483a('0x39')]){_0x1e254e[_0x483a('0x3a')]=_[_0x483a('0x3b')](_0x1e254e[_0x483a('0x3a')],{'$or':_['map'](_0x166f27,function(_0x57f9ee){if(_0x57f9ee[_0x483a('0x2c')]!==_0x483a('0x3c')){var _0x436174={};_0x436174[_0x57f9ee[_0x483a('0x28')]]={'$like':'%'+_0x5caf3e[_0x483a('0x2f')][_0x483a('0x39')]+'%'};return _0x436174;}})});}_0x1e254e=_[_0x483a('0x3b')]({},_0x1e254e,_0x5caf3e[_0x483a('0x3d')]);var _0x412d8a={'where':_0x1e254e['where']};return db[_0x483a('0x29')][_0x483a('0x3e')](_0x412d8a)[_0x483a('0x24')](function(_0x306951){_0x85f805[_0x483a('0x3e')]=_0x306951;if(_0x5caf3e['query']['includeAll']){_0x1e254e[_0x483a('0x3f')]=[{'all':!![]}];}return db[_0x483a('0x29')]['findAll'](_0x1e254e);})['then'](function(_0x1051d4){_0x85f805[_0x483a('0x40')]=_0x1051d4;return _0x85f805;})[_0x483a('0x24')](respondWithFilteredResult(_0x2d9d96,_0x1e254e))[_0x483a('0x41')](handleError(_0x2d9d96,null));};exports[_0x483a('0x42')]=function(_0x53e41e,_0x2f7258){var _0x2c6b83={'raw':!![],'where':{'id':_0x53e41e['params']['id']}},_0x29b64b={};_0x29b64b[_0x483a('0x2e')]=_['keys'](db[_0x483a('0x29')]['rawAttributes']);_0x29b64b[_0x483a('0x2f')]=_[_0x483a('0x30')](_0x53e41e[_0x483a('0x2f')]);_0x29b64b[_0x483a('0x31')]=_[_0x483a('0x33')](_0x29b64b['model'],_0x29b64b[_0x483a('0x2f')]);_0x2c6b83['attributes']=_['intersection'](_0x29b64b[_0x483a('0x2e')],qs['fields'](_0x53e41e[_0x483a('0x2f')][_0x483a('0x34')]));_0x2c6b83['attributes']=_0x2c6b83[_0x483a('0x32')][_0x483a('0x43')]?_0x2c6b83[_0x483a('0x32')]:_0x29b64b[_0x483a('0x2e')];if(_0x53e41e[_0x483a('0x2f')][_0x483a('0x44')]){_0x2c6b83['include']=[{'all':!![]}];}_0x2c6b83=_[_0x483a('0x3b')]({},_0x2c6b83,_0x53e41e[_0x483a('0x3d')]);return db['VtigerField'][_0x483a('0x45')](_0x2c6b83)[_0x483a('0x24')](handleEntityNotFound(_0x2f7258,null))[_0x483a('0x24')](respondWithResult(_0x2f7258,null))[_0x483a('0x41')](handleError(_0x2f7258,null));};exports[_0x483a('0x46')]=function(_0x4664fb,_0x539168){return db[_0x483a('0x29')][_0x483a('0x46')](_0x4664fb[_0x483a('0x47')],{})['then'](respondWithResult(_0x539168,0xc9))['catch'](handleError(_0x539168,null));};exports[_0x483a('0x23')]=function(_0x36e6e0,_0x34fcff){if(_0x36e6e0[_0x483a('0x47')]['id']){delete _0x36e6e0[_0x483a('0x47')]['id'];}return db[_0x483a('0x29')]['find']({'where':{'id':_0x36e6e0[_0x483a('0x48')]['id']}})['then'](handleEntityNotFound(_0x34fcff,null))[_0x483a('0x24')](saveUpdates(_0x36e6e0[_0x483a('0x47')],null))[_0x483a('0x24')](respondWithResult(_0x34fcff,null))[_0x483a('0x41')](handleError(_0x34fcff,null));};exports['destroy']=function(_0x4b3aed,_0xc565de){return db[_0x483a('0x29')]['find']({'where':{'id':_0x4b3aed[_0x483a('0x48')]['id']}})[_0x483a('0x24')](handleEntityNotFound(_0xc565de,null))[_0x483a('0x24')](removeEntity(_0xc565de,null))[_0x483a('0x41')](handleError(_0xc565de,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 80da862..d35d0be 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 _0x5ea8=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','VtigerField','int_vtiger_fields','idField','FieldId','lodash'];(function(_0x46d050,_0x5a9807){var _0x46c9a7=function(_0x1c46d1){while(--_0x1c46d1){_0x46d050['push'](_0x46d050['shift']());}};_0x46c9a7(++_0x5a9807);}(_0x5ea8,0x86));var _0x85ea=function(_0x4f8822,_0x55ad97){_0x4f8822=_0x4f8822-0x0;var _0x4fd4e2=_0x5ea8[_0x4f8822];return _0x4fd4e2;};'use strict';var _=require(_0x85ea('0x0'));var util=require(_0x85ea('0x1'));var logger=require(_0x85ea('0x2'))(_0x85ea('0x3'));var moment=require(_0x85ea('0x4'));var BPromise=require(_0x85ea('0x5'));var rp=require(_0x85ea('0x6'));var fs=require('fs');var path=require(_0x85ea('0x7'));var rimraf=require(_0x85ea('0x8'));var config=require(_0x85ea('0x9'));var attributes=require(_0x85ea('0xa'));module['exports']=function(_0x59a5c7,_0x3f6db2){return _0x59a5c7['define'](_0x85ea('0xb'),attributes,{'tableName':_0x85ea('0xc'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x85ea('0xd'),_0x85ea('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8cdc=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util'];(function(_0x4d9475,_0x1a6c26){var _0x23aa82=function(_0x24f470){while(--_0x24f470){_0x4d9475['push'](_0x4d9475['shift']());}};_0x23aa82(++_0x1a6c26);}(_0x8cdc,0x97));var _0xc8cd=function(_0x1a93dc,_0x2d9863){_0x1a93dc=_0x1a93dc-0x0;var _0x448cf6=_0x8cdc[_0x1a93dc];return _0x448cf6;};'use strict';var _=require(_0xc8cd('0x0'));var util=require(_0xc8cd('0x1'));var logger=require(_0xc8cd('0x2'))(_0xc8cd('0x3'));var moment=require(_0xc8cd('0x4'));var BPromise=require(_0xc8cd('0x5'));var rp=require(_0xc8cd('0x6'));var fs=require('fs');var path=require(_0xc8cd('0x7'));var rimraf=require(_0xc8cd('0x8'));var config=require(_0xc8cd('0x9'));var attributes=require('./intVtigerField.attributes');module[_0xc8cd('0xa')]=function(_0x408011,_0x17eea9){return _0x408011[_0xc8cd('0xb')](_0xc8cd('0xc'),attributes,{'tableName':_0xc8cd('0xd'),'paranoid':![],'indexes':[{'name':_0xc8cd('0xe'),'fields':[_0xc8cd('0xf'),_0xc8cd('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 2778fb1..3122511 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 _0x30fc=['bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x13923a,_0xab86a4){var _0x3821b2=function(_0x49f8f4){while(--_0x49f8f4){_0x13923a['push'](_0x13923a['shift']());}};_0x3821b2(++_0xab86a4);}(_0x30fc,0xfa));var _0xc30f=function(_0x4d6675,_0x23beaa){_0x4d6675=_0x4d6675-0x0;var _0x2bd5bc=_0x30fc[_0x4d6675];return _0x2bd5bc;};'use strict';var _=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var moment=require('moment');var BPromise=require(_0xc30f('0x2'));var rs=require(_0xc30f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc30f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc30f('0x5'));var config=require(_0xc30f('0x6'));var jayson=require(_0xc30f('0x7'));var client=jayson[_0xc30f('0x8')][_0xc30f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x118f1c,_0xe59627,_0x432136){return new BPromise(function(_0x541b6c,_0x1cb9a7){return client['request'](_0x118f1c,_0x432136)[_0xc30f('0xa')](function(_0x17d112){logger[_0xc30f('0xb')](_0xc30f('0xc'),_0xe59627,_0xc30f('0xd'));logger[_0xc30f('0xe')](_0xc30f('0xf'),_0xe59627,_0xc30f('0xd'),JSON[_0xc30f('0x10')](_0x17d112));if(_0x17d112['error']){if(_0x17d112['error']['code']===0x1f4){logger[_0xc30f('0x11')](_0xc30f('0xc'),_0xe59627,_0x17d112['error'][_0xc30f('0x12')]);return _0x1cb9a7(_0x17d112[_0xc30f('0x11')]['message']);}logger['error'](_0xc30f('0xc'),_0xe59627,_0x17d112['error'][_0xc30f('0x12')]);return _0x541b6c(_0x17d112['error'][_0xc30f('0x12')]);}else{logger['info'](_0xc30f('0xc'),_0xe59627,_0xc30f('0xd'));_0x541b6c(_0x17d112[_0xc30f('0x13')][_0xc30f('0x12')]);}})[_0xc30f('0x14')](function(_0x240763){logger[_0xc30f('0x11')](_0xc30f('0xc'),_0xe59627,_0x240763);_0x1cb9a7(_0x240763);});});} \ No newline at end of file +var _0x33a3=['../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','VtigerField,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x46aae1,_0x130f4e){var _0xc42a8e=function(_0x2847f4){while(--_0x2847f4){_0x46aae1['push'](_0x46aae1['shift']());}};_0xc42a8e(++_0x130f4e);}(_0x33a3,0x1ad));var _0x333a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x33a3[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x333a('0x0'));var util=require(_0x333a('0x1'));var moment=require(_0x333a('0x2'));var BPromise=require(_0x333a('0x3'));var rs=require(_0x333a('0x4'));var fs=require('fs');var Redis=require(_0x333a('0x5'));var db=require(_0x333a('0x6'))['db'];var utils=require(_0x333a('0x7'));var logger=require(_0x333a('0x8'))(_0x333a('0x9'));var config=require(_0x333a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x333a('0xb')][_0x333a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cb24b,_0x364fb2,_0x1f2889){return new BPromise(function(_0x4002c3,_0x354c17){return client[_0x333a('0xd')](_0x2cb24b,_0x1f2889)['then'](function(_0x3b8bcc){logger[_0x333a('0xe')]('VtigerField,\x20%s,\x20%s',_0x364fb2,_0x333a('0xf'));logger[_0x333a('0x10')](_0x333a('0x11'),_0x364fb2,_0x333a('0xf'),JSON[_0x333a('0x12')](_0x3b8bcc));if(_0x3b8bcc['error']){if(_0x3b8bcc[_0x333a('0x13')]['code']===0x1f4){logger[_0x333a('0x13')]('VtigerField,\x20%s,\x20%s',_0x364fb2,_0x3b8bcc[_0x333a('0x13')][_0x333a('0x14')]);return _0x354c17(_0x3b8bcc[_0x333a('0x13')][_0x333a('0x14')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x364fb2,_0x3b8bcc[_0x333a('0x13')][_0x333a('0x14')]);return _0x4002c3(_0x3b8bcc['error'][_0x333a('0x14')]);}else{logger[_0x333a('0xe')](_0x333a('0x15'),_0x364fb2,_0x333a('0xf'));_0x4002c3(_0x3b8bcc[_0x333a('0x16')][_0x333a('0x14')]);}})['catch'](function(_0x4a6a83){logger[_0x333a('0x13')](_0x333a('0x15'),_0x364fb2,_0x4a6a83);_0x354c17(_0x4a6a83);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 656a559..71d73fa 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 _0x74d4=['addConfiguration','put','/:id','delete','multer','util','path','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0x157c25,_0x27684b){var _0x1ce993=function(_0x1516e0){while(--_0x1516e0){_0x157c25['push'](_0x157c25['shift']());}};_0x1ce993(++_0x27684b);}(_0x74d4,0x112));var _0x474d=function(_0x5e229a,_0x46a0ca){_0x5e229a=_0x5e229a-0x0;var _0x6c1399=_0x74d4[_0x5e229a];return _0x6c1399;};'use strict';var multer=require(_0x474d('0x0'));var util=require(_0x474d('0x1'));var path=require(_0x474d('0x2'));var timeout=require('connect-timeout');var express=require(_0x474d('0x3'));var router=express['Router']();var fs_extra=require(_0x474d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x474d('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0x474d('0x6')]('/',auth[_0x474d('0x7')](),controller[_0x474d('0x8')]);router[_0x474d('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x474d('0x9')]);router[_0x474d('0x6')](_0x474d('0xa'),auth['isAuthenticated'](),controller[_0x474d('0xb')]);router[_0x474d('0x6')](_0x474d('0xc'),auth[_0x474d('0x7')](),controller['getFields']);router[_0x474d('0xd')]('/',auth[_0x474d('0x7')](),controller['create']);router[_0x474d('0xd')](_0x474d('0xa'),auth[_0x474d('0x7')](),controller[_0x474d('0xe')]);router[_0x474d('0xf')](_0x474d('0x10'),auth[_0x474d('0x7')](),controller['update']);router[_0x474d('0x11')](_0x474d('0x10'),auth[_0x474d('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x56cd=['show','/:id/configurations','/:id/fields','post','addConfiguration','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x4a892f,_0xe1f72c){var _0x2ad873=function(_0x1082ac){while(--_0x1082ac){_0x4a892f['push'](_0x4a892f['shift']());}};_0x2ad873(++_0xe1f72c);}(_0x56cd,0x77));var _0xd56c=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x56cd[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0xd56c('0x0'));var util=require(_0xd56c('0x1'));var path=require('path');var timeout=require(_0xd56c('0x2'));var express=require(_0xd56c('0x3'));var router=express[_0xd56c('0x4')]();var fs_extra=require(_0xd56c('0x5'));var auth=require(_0xd56c('0x6'));var interaction=require(_0xd56c('0x7'));var config=require(_0xd56c('0x8'));var controller=require('./intZendeskAccount.controller');router[_0xd56c('0x9')]('/',auth[_0xd56c('0xa')](),controller[_0xd56c('0xb')]);router[_0xd56c('0x9')](_0xd56c('0xc'),auth[_0xd56c('0xa')](),controller[_0xd56c('0xd')]);router[_0xd56c('0x9')](_0xd56c('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xd56c('0x9')](_0xd56c('0xf'),auth[_0xd56c('0xa')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd56c('0x10')](_0xd56c('0xe'),auth[_0xd56c('0xa')](),controller[_0xd56c('0x11')]);router[_0xd56c('0x12')](_0xd56c('0xc'),auth[_0xd56c('0xa')](),controller[_0xd56c('0x13')]);router[_0xd56c('0x14')](_0xd56c('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xd56c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index c2c1409..21bc150 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 _0xacc6=['sequelize','exports','STRING','ENUM','token','password','newTab','integrationTab'];(function(_0x97a3dd,_0x5e62b6){var _0x194854=function(_0x5b5a94){while(--_0x5b5a94){_0x97a3dd['push'](_0x97a3dd['shift']());}};_0x194854(++_0x5e62b6);}(_0xacc6,0x150));var _0x6acc=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xacc6[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x6acc('0x0'));module[_0x6acc('0x1')]={'name':{'type':Sequelize[_0x6acc('0x2')]},'description':{'type':Sequelize[_0x6acc('0x2')]},'username':{'type':Sequelize[_0x6acc('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x6acc('0x2')]},'token':{'type':Sequelize[_0x6acc('0x2')]},'remoteUri':{'type':Sequelize[_0x6acc('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x6acc('0x3')]('password',_0x6acc('0x4')),'defaultValue':_0x6acc('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6acc('0x3')]('integrationTab',_0x6acc('0x6')),'defaultValue':_0x6acc('0x7')}}; \ No newline at end of file +var _0xbc36=['newTab','sequelize','STRING','username','remoteUri','ENUM','token','password','integrationTab'];(function(_0x6acb69,_0xd36dbf){var _0x29a021=function(_0x374293){while(--_0x374293){_0x6acb69['push'](_0x6acb69['shift']());}};_0x29a021(++_0xd36dbf);}(_0xbc36,0x169));var _0x6bc3=function(_0x16f867,_0x5bc5ca){_0x16f867=_0x16f867-0x0;var _0x161d1c=_0xbc36[_0x16f867];return _0x161d1c;};'use strict';var Sequelize=require(_0x6bc3('0x0'));module['exports']={'name':{'type':Sequelize[_0x6bc3('0x1')]},'description':{'type':Sequelize[_0x6bc3('0x1')]},'username':{'type':Sequelize[_0x6bc3('0x1')],'unique':_0x6bc3('0x2')},'password':{'type':Sequelize[_0x6bc3('0x1')]},'token':{'type':Sequelize[_0x6bc3('0x1')]},'remoteUri':{'type':Sequelize[_0x6bc3('0x1')],'unique':_0x6bc3('0x3')},'authType':{'type':Sequelize[_0x6bc3('0x4')]('password',_0x6bc3('0x5')),'defaultValue':_0x6bc3('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6bc3('0x4')](_0x6bc3('0x7'),_0x6bc3('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 72e7dd0..a54b7c6 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 _0x7916=['hasOwnProperty','order','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','update','body','getConfigurations','ZendeskConfiguration','sort','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','findOne','password','token','remoteUri','slice','substring','GET','format','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','username','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','count','limit','status','set','apply','save','then','destroy','error','name','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes'];(function(_0x1fe899,_0x147fec){var _0x2d84c1=function(_0x21bea9){while(--_0x21bea9){_0x1fe899['push'](_0x1fe899['shift']());}};_0x2d84c1(++_0x147fec);}(_0x7916,0x128));var _0x6791=function(_0x4ab62a,_0x18bc01){_0x4ab62a=_0x4ab62a-0x0;var _0x56f8fe=_0x7916[_0x4ab62a];return _0x56f8fe;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];var integrations=require(_0x6791('0x17'));function respondWithStatusCode(_0x16c62b,_0x423e22){_0x423e22=_0x423e22||0xcc;return function(_0x11c730){if(_0x11c730){return _0x16c62b[_0x6791('0x18')](_0x423e22);}return _0x16c62b['status'](_0x423e22)['end']();};}function respondWithResult(_0x34b28d,_0x5122f9){_0x5122f9=_0x5122f9||0xc8;return function(_0x2a9151){if(_0x2a9151){return _0x34b28d['status'](_0x5122f9)[_0x6791('0x19')](_0x2a9151);}};}function respondWithFilteredResult(_0x163898,_0x517910){return function(_0x3e4792){if(_0x3e4792){var _0x4b80ed=typeof _0x517910[_0x6791('0x1a')]===_0x6791('0x1b')&&typeof _0x517910['limit']===_0x6791('0x1b');var _0x36d7a1=_0x3e4792['count'];var _0x1872f5=_0x4b80ed?0x0:_0x517910['offset'];var _0xe55dba=_0x4b80ed?_0x3e4792[_0x6791('0x1c')]:_0x517910[_0x6791('0x1a')]+_0x517910[_0x6791('0x1d')];var _0x25adbc;if(_0xe55dba>=_0x36d7a1){_0xe55dba=_0x36d7a1;_0x25adbc=0xc8;}else{_0x25adbc=0xce;}_0x163898[_0x6791('0x1e')](_0x25adbc);return _0x163898[_0x6791('0x1f')]('Content-Range',_0x1872f5+'-'+_0xe55dba+'/'+_0x36d7a1)[_0x6791('0x19')](_0x3e4792);}return null;};}function patchUpdates(_0x306acb){return function(_0x51368e){try{jsonpatch[_0x6791('0x20')](_0x51368e,_0x306acb,!![]);}catch(_0x3b57f0){return BPromise['reject'](_0x3b57f0);}return _0x51368e[_0x6791('0x21')]();};}function saveUpdates(_0x309610,_0x15b9ab){return function(_0x12d83b){if(_0x12d83b){return _0x12d83b['update'](_0x309610)[_0x6791('0x22')](function(_0x1b516d){return _0x1b516d;});}return null;};}function removeEntity(_0x4a8717,_0x53bb44){return function(_0x4b23bc){if(_0x4b23bc){return _0x4b23bc[_0x6791('0x23')]()['then'](function(){_0x4a8717[_0x6791('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a092,_0x496273){return function(_0x5cadc){if(!_0x5cadc){_0x54a092[_0x6791('0x18')](0x194);}return _0x5cadc;};}function handleError(_0xd49b84,_0x56a74e){_0x56a74e=_0x56a74e||0x1f4;return function(_0x3def2e){logger[_0x6791('0x24')](_0x3def2e['stack']);if(_0x3def2e[_0x6791('0x25')]){delete _0x3def2e['name'];}_0xd49b84[_0x6791('0x1e')](_0x56a74e)['send'](_0x3def2e);};}exports['index']=function(_0x270a1d,_0x551718){var _0x2f56a2={},_0x34b006={},_0x483d6c={'count':0x0,'rows':[]};var _0x240a9f=_[_0x6791('0x26')](db[_0x6791('0x27')][_0x6791('0x28')],function(_0x5d9d54){return{'name':_0x5d9d54['fieldName'],'type':_0x5d9d54[_0x6791('0x29')]['key']};});_0x34b006[_0x6791('0x2a')]=_[_0x6791('0x26')](_0x240a9f,_0x6791('0x25'));_0x34b006[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x270a1d[_0x6791('0x2b')]);_0x34b006[_0x6791('0x2d')]=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],_0x34b006[_0x6791('0x2b')]);_0x2f56a2['attributes']=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x2f')]));_0x2f56a2[_0x6791('0x30')]=_0x2f56a2['attributes']['length']?_0x2f56a2['attributes']:_0x34b006[_0x6791('0x2a')];if(!_0x270a1d[_0x6791('0x2b')][_0x6791('0x31')]('nolimit')){_0x2f56a2['limit']=qs[_0x6791('0x1d')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1d')]);_0x2f56a2[_0x6791('0x1a')]=qs['offset'](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1a')]);}_0x2f56a2[_0x6791('0x32')]=qs['sort'](_0x270a1d[_0x6791('0x2b')]['sort']);_0x2f56a2['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x270a1d['query'],_0x34b006[_0x6791('0x2d')]),_0x240a9f);if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x34')]){_0x2f56a2[_0x6791('0x35')]=_[_0x6791('0x36')](_0x2f56a2['where'],{'$or':_[_0x6791('0x26')](_0x240a9f,function(_0xc95516){if(_0xc95516[_0x6791('0x29')]!=='VIRTUAL'){var _0x3a6062={};_0x3a6062[_0xc95516[_0x6791('0x25')]]={'$like':'%'+_0x270a1d[_0x6791('0x2b')]['filter']+'%'};return _0x3a6062;}})});}_0x2f56a2=_[_0x6791('0x36')]({},_0x2f56a2,_0x270a1d[_0x6791('0x37')]);var _0x13be81={'where':_0x2f56a2[_0x6791('0x35')]};return db['ZendeskAccount'][_0x6791('0x1c')](_0x13be81)[_0x6791('0x22')](function(_0x3e95b6){_0x483d6c[_0x6791('0x1c')]=_0x3e95b6;if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x38')]){_0x2f56a2[_0x6791('0x39')]=[{'all':!![]}];}return db[_0x6791('0x27')][_0x6791('0x3a')](_0x2f56a2);})['then'](function(_0x52c03a){_0x483d6c[_0x6791('0x3b')]=_0x52c03a;return _0x483d6c;})[_0x6791('0x22')](respondWithFilteredResult(_0x551718,_0x2f56a2))['catch'](handleError(_0x551718,null));};exports[_0x6791('0x3c')]=function(_0x1c9913,_0x1c6803){var _0x3edb86={'raw':![],'where':{'id':_0x1c9913[_0x6791('0x3d')]['id']}},_0x1a922e={};_0x1a922e[_0x6791('0x2a')]=_['keys'](db[_0x6791('0x27')]['rawAttributes']);_0x1a922e[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x1c9913[_0x6791('0x2b')]);_0x1a922e[_0x6791('0x2d')]=_['intersection'](_0x1a922e[_0x6791('0x2a')],_0x1a922e[_0x6791('0x2b')]);_0x3edb86[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x1a922e[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x1c9913[_0x6791('0x2b')][_0x6791('0x2f')]));_0x3edb86['attributes']=_0x3edb86[_0x6791('0x30')][_0x6791('0x3e')]?_0x3edb86[_0x6791('0x30')]:_0x1a922e[_0x6791('0x2a')];if(_0x1c9913['query'][_0x6791('0x38')]){_0x3edb86[_0x6791('0x39')]=[{'all':!![]}];}_0x3edb86=_['merge']({},_0x3edb86,_0x1c9913[_0x6791('0x37')]);return db['ZendeskAccount'][_0x6791('0x3f')](_0x3edb86)[_0x6791('0x22')](handleEntityNotFound(_0x1c6803,null))[_0x6791('0x22')](respondWithResult(_0x1c6803,null))[_0x6791('0x40')](handleError(_0x1c6803,null));};exports[_0x6791('0x41')]=function(_0xb2a2,_0x4163f5){return db[_0x6791('0x27')][_0x6791('0x41')](_0xb2a2['body'],{})[_0x6791('0x22')](respondWithResult(_0x4163f5,0xc9))['catch'](handleError(_0x4163f5,null));};exports[_0x6791('0x42')]=function(_0x2bb86a,_0x276002){if(_0x2bb86a[_0x6791('0x43')]['id']){delete _0x2bb86a[_0x6791('0x43')]['id'];}return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x2bb86a[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x276002,null))[_0x6791('0x22')](saveUpdates(_0x2bb86a[_0x6791('0x43')],null))['then'](respondWithResult(_0x276002,null))[_0x6791('0x40')](handleError(_0x276002,null));};exports[_0x6791('0x23')]=function(_0x4ff9f4,_0x3df699){return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x4ff9f4[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x3df699,null))[_0x6791('0x22')](removeEntity(_0x3df699,null))['catch'](handleError(_0x3df699,null));};exports[_0x6791('0x44')]=function(_0x243faf,_0x5655c8,_0x189b22){var _0x4370ab={};var _0x3a895b={};var _0x5df56e;var _0x355e97;return db[_0x6791('0x27')]['findOne']({'where':{'id':_0x243faf[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5655c8,null))['then'](function(_0x169531){if(_0x169531){_0x5df56e=_0x169531;_0x3a895b[_0x6791('0x2a')]=_[_0x6791('0x2c')](db[_0x6791('0x45')]['rawAttributes']);_0x3a895b[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x243faf[_0x6791('0x2b')]);_0x3a895b['filters']=_['intersection'](_0x3a895b[_0x6791('0x2a')],_0x3a895b[_0x6791('0x2b')]);_0x4370ab[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x3a895b[_0x6791('0x2a')],qs['fields'](_0x243faf['query'][_0x6791('0x2f')]));_0x4370ab['attributes']=_0x4370ab['attributes'][_0x6791('0x3e')]?_0x4370ab[_0x6791('0x30')]:_0x3a895b[_0x6791('0x2a')];_0x4370ab[_0x6791('0x32')]=qs[_0x6791('0x46')](_0x243faf[_0x6791('0x2b')]['sort']);_0x4370ab['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x243faf['query'],_0x3a895b[_0x6791('0x2d')]));if(_0x243faf['query'][_0x6791('0x34')]){_0x4370ab[_0x6791('0x35')]=_['merge'](_0x4370ab[_0x6791('0x35')],{'$or':_[_0x6791('0x26')](_0x4370ab[_0x6791('0x30')],function(_0x49ed65){var _0x3ba679={};_0x3ba679[_0x49ed65]={'$like':'%'+_0x243faf[_0x6791('0x2b')][_0x6791('0x34')]+'%'};return _0x3ba679;})});}_0x4370ab=_[_0x6791('0x36')]({},_0x4370ab,_0x243faf[_0x6791('0x37')]);return _0x5df56e['getConfigurations'](_0x4370ab);}})['then'](function(_0x1a9acd){if(_0x1a9acd){_0x355e97=_0x1a9acd[_0x6791('0x3e')];if(!_0x243faf['query'][_0x6791('0x31')](_0x6791('0x47'))){_0x4370ab[_0x6791('0x1d')]=qs[_0x6791('0x1d')](_0x243faf[_0x6791('0x2b')][_0x6791('0x1d')]);_0x4370ab[_0x6791('0x1a')]=qs[_0x6791('0x1a')](_0x243faf['query'][_0x6791('0x1a')]);}return _0x5df56e[_0x6791('0x44')](_0x4370ab);}})[_0x6791('0x22')](function(_0x1a9a2e){if(_0x1a9a2e){return _0x1a9a2e?{'count':_0x355e97,'rows':_0x1a9a2e}:null;}})['then'](respondWithResult(_0x5655c8,null))[_0x6791('0x40')](handleError(_0x5655c8,null));};exports[_0x6791('0x48')]=function(_0xa8a8dd,_0x5ca809,_0x205320){if(_0xa8a8dd[_0x6791('0x43')]['id']){delete _0xa8a8dd[_0x6791('0x43')]['id'];}return db[_0x6791('0x27')]['findOne']({'where':{'id':_0xa8a8dd[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5ca809,null))['then'](function(_0x1114d4){if(_0x1114d4){_0xa8a8dd[_0x6791('0x43')][_0x6791('0x49')]=_0x1114d4['id'];_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4a')]=integrations[_0x6791('0x4b')](_0xa8a8dd['body'][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);_0xa8a8dd['body'][_0x6791('0x4d')]=integrations['getDescriptions'](_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);return db[_0x6791('0x45')]['create'](_0xa8a8dd[_0x6791('0x43')],{'include':[{'model':db[_0x6791('0x4e')],'as':_0x6791('0x4a')},{'model':db[_0x6791('0x4e')],'as':'Descriptions'}]});}return null;})[_0x6791('0x22')](respondWithResult(_0x5ca809,null))[_0x6791('0x40')](handleError(_0x5ca809,null));};exports['getFields']=function(_0x34691c,_0x1fa44a,_0x567302){var _0x201465='';return db[_0x6791('0x27')][_0x6791('0x4f')]({'where':{'id':_0x34691c[_0x6791('0x3d')]['id']},'attributes':['id','username',_0x6791('0x50'),_0x6791('0x51'),'authType',_0x6791('0x52')]})[_0x6791('0x22')](handleEntityNotFound(_0x1fa44a,null))[_0x6791('0x22')](function(_0x20c736){if(_0x20c736){_0x201465=_0x20c736[_0x6791('0x52')];var _0x4ecf62=_0x201465[_0x6791('0x53')](-0x1);if(_0x4ecf62==='/'){_0x201465=_0x201465[_0x6791('0x54')](0x0,_0x201465['lastIndexOf'](_0x4ecf62));}var _0x4463ef={'method':_0x6791('0x55'),'uri':util[_0x6791('0x56')]('%s/%s',_0x201465,_0x6791('0x57')),'json':!![]};switch(_0x20c736[_0x6791('0x58')]){case _0x6791('0x50'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')](_0x6791('0x5a'),new Buffer(util[_0x6791('0x56')](_0x6791('0x5b'),_0x20c736['username'],_0x20c736[_0x6791('0x50')]))[_0x6791('0x5c')]('base64'))};break;case _0x6791('0x51'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')]('Basic\x20%s',new Buffer(util[_0x6791('0x56')]('%s/token:%s',_0x20c736[_0x6791('0x5d')],_0x20c736[_0x6791('0x51')]))[_0x6791('0x5c')](_0x6791('0x5e')))};break;default:throw new db[(_0x6791('0x5f'))][(_0x6791('0x60'))](_0x6791('0x61'));}return rp(_0x4463ef);}})[_0x6791('0x22')](function(_0x23e0d3){if(_0x23e0d3){var _0x1fa853=[_0x6791('0x62'),_0x6791('0x63'),_0x6791('0x64'),_0x6791('0x65')];_[_0x6791('0x66')](_0x23e0d3[_0x6791('0x57')],function(_0x3b53b8){return _0x1fa853[_0x6791('0x67')](_0x3b53b8[_0x6791('0x29')]);});return{'count':_0x23e0d3['ticket_fields']['length'],'rows':_['map'](_0x23e0d3[_0x6791('0x57')],function(_0x31c1a8){return{'id':_0x31c1a8['id'],'name':_0x31c1a8[_0x6791('0x68')]>0x7?_0x31c1a8[_0x6791('0x69')]:_0x31c1a8[_0x6791('0x29')],'custom':_0x31c1a8[_0x6791('0x68')]>0x7?!![]:![],'options':_0x31c1a8[_0x6791('0x6a')]?_0x31c1a8[_0x6791('0x6a')]:_0x31c1a8[_0x6791('0x6b')]?_0x31c1a8[_0x6791('0x6b')]:[]};})};}})[_0x6791('0x22')](respondWithResult(_0x1fa44a,null))[_0x6791('0x40')](function(_0x44ec4d){var _0x4047b6=_0x34691c[_0x6791('0x2b')][_0x6791('0x6c')]?0x1f4:_0x44ec4d[_0x6791('0x6d')]||0x1f4;logger[_0x6791('0x24')](_0x6791('0x6e'),_0x6791('0x6f'),_0x4047b6,JSON[_0x6791('0x70')](_0x44ec4d));delete _0x44ec4d[_0x6791('0x25')];if(_0x4047b6===0x191){_0x4047b6=0x190;}_0x1fa44a[_0x6791('0x1e')](_0x4047b6)[_0x6791('0x71')](_0x34691c[_0x6791('0x2b')]['test']?{'message':_0x6791('0x72'),'statusCode':_0x44ec4d['statusCode']}:_0x44ec4d);});}; \ No newline at end of file +var _0x63a5=['username','password','token','remoteUri','substring','lastIndexOf','GET','%s/%s','ticket_fields','authType','headers','format','toString','base64','Basic\x20%s','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','ZendeskAccount','count','includeAll','rows','params','length','include','find','catch','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','getFields'];(function(_0x26698d,_0x33f50b){var _0x23f110=function(_0x7bc46d){while(--_0x7bc46d){_0x26698d['push'](_0x26698d['shift']());}};_0x23f110(++_0x33f50b);}(_0x63a5,0x18e));var _0x563a=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x63a5[_0x4e7d25];return _0x526fe6;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x563a('0x19'));function respondWithStatusCode(_0x214f42,_0x10de2e){_0x10de2e=_0x10de2e||0xcc;return function(_0x27034c){if(_0x27034c){return _0x214f42[_0x563a('0x1a')](_0x10de2e);}return _0x214f42[_0x563a('0x1b')](_0x10de2e)['end']();};}function respondWithResult(_0x2cf052,_0x3045ac){_0x3045ac=_0x3045ac||0xc8;return function(_0x8c3727){if(_0x8c3727){return _0x2cf052[_0x563a('0x1b')](_0x3045ac)['json'](_0x8c3727);}};}function respondWithFilteredResult(_0x504cb7,_0x414535){return function(_0x2ad667){if(_0x2ad667){var _0x5b291f=typeof _0x414535[_0x563a('0x1c')]===_0x563a('0x1d')&&typeof _0x414535[_0x563a('0x1e')]===_0x563a('0x1d');var _0x4f947d=_0x2ad667['count'];var _0xe3d2bd=_0x5b291f?0x0:_0x414535[_0x563a('0x1c')];var _0x54a3b4=_0x5b291f?_0x2ad667['count']:_0x414535['offset']+_0x414535['limit'];var _0x4c15c1;if(_0x54a3b4>=_0x4f947d){_0x54a3b4=_0x4f947d;_0x4c15c1=0xc8;}else{_0x4c15c1=0xce;}_0x504cb7[_0x563a('0x1b')](_0x4c15c1);return _0x504cb7[_0x563a('0x1f')](_0x563a('0x20'),_0xe3d2bd+'-'+_0x54a3b4+'/'+_0x4f947d)[_0x563a('0x21')](_0x2ad667);}return null;};}function patchUpdates(_0x562fce){return function(_0x4e3b67){try{jsonpatch[_0x563a('0x22')](_0x4e3b67,_0x562fce,!![]);}catch(_0x9f8b29){return BPromise[_0x563a('0x23')](_0x9f8b29);}return _0x4e3b67[_0x563a('0x24')]();};}function saveUpdates(_0x1bf502,_0x2dc7e2){return function(_0x44b460){if(_0x44b460){return _0x44b460[_0x563a('0x25')](_0x1bf502)['then'](function(_0xd59ba8){return _0xd59ba8;});}return null;};}function removeEntity(_0x5422f6,_0x44e2c1){return function(_0xd3e0ae){if(_0xd3e0ae){return _0xd3e0ae[_0x563a('0x26')]()[_0x563a('0x27')](function(){_0x5422f6[_0x563a('0x1b')](0xcc)[_0x563a('0x28')]();});}};}function handleEntityNotFound(_0x3642b3,_0x173990){return function(_0x4de4c3){if(!_0x4de4c3){_0x3642b3[_0x563a('0x1a')](0x194);}return _0x4de4c3;};}function handleError(_0x2b688e,_0x2311f2){_0x2311f2=_0x2311f2||0x1f4;return function(_0x3d79ac){logger[_0x563a('0x29')](_0x3d79ac[_0x563a('0x2a')]);if(_0x3d79ac[_0x563a('0x2b')]){delete _0x3d79ac[_0x563a('0x2b')];}_0x2b688e[_0x563a('0x1b')](_0x2311f2)[_0x563a('0x2c')](_0x3d79ac);};}exports[_0x563a('0x2d')]=function(_0x24d1a8,_0x1bdfb0){var _0x7696c2={},_0x579cb5={},_0x43379c={'count':0x0,'rows':[]};var _0x3c16d0=_[_0x563a('0x2e')](db['ZendeskAccount'][_0x563a('0x2f')],function(_0x2e5c4b){return{'name':_0x2e5c4b[_0x563a('0x30')],'type':_0x2e5c4b[_0x563a('0x31')][_0x563a('0x32')]};});_0x579cb5[_0x563a('0x33')]=_[_0x563a('0x2e')](_0x3c16d0,'name');_0x579cb5[_0x563a('0x34')]=_[_0x563a('0x35')](_0x24d1a8[_0x563a('0x34')]);_0x579cb5[_0x563a('0x36')]=_[_0x563a('0x37')](_0x579cb5['model'],_0x579cb5['query']);_0x7696c2['attributes']=_['intersection'](_0x579cb5[_0x563a('0x33')],qs[_0x563a('0x38')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x38')]));_0x7696c2[_0x563a('0x39')]=_0x7696c2[_0x563a('0x39')]['length']?_0x7696c2['attributes']:_0x579cb5[_0x563a('0x33')];if(!_0x24d1a8[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x7696c2[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x1e')]);_0x7696c2[_0x563a('0x1c')]=qs[_0x563a('0x1c')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x1c')]);}_0x7696c2[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x3d')]);_0x7696c2['where']=qs[_0x563a('0x36')](_[_0x563a('0x3e')](_0x24d1a8[_0x563a('0x34')],_0x579cb5['filters']),_0x3c16d0);if(_0x24d1a8[_0x563a('0x34')]['filter']){_0x7696c2[_0x563a('0x3f')]=_[_0x563a('0x40')](_0x7696c2['where'],{'$or':_['map'](_0x3c16d0,function(_0x1b48f1){if(_0x1b48f1['type']!==_0x563a('0x41')){var _0x92bd6={};_0x92bd6[_0x1b48f1[_0x563a('0x2b')]]={'$like':'%'+_0x24d1a8[_0x563a('0x34')]['filter']+'%'};return _0x92bd6;}})});}_0x7696c2=_['merge']({},_0x7696c2,_0x24d1a8[_0x563a('0x42')]);var _0x598ee3={'where':_0x7696c2[_0x563a('0x3f')]};return db[_0x563a('0x43')][_0x563a('0x44')](_0x598ee3)[_0x563a('0x27')](function(_0x3a2eb0){_0x43379c[_0x563a('0x44')]=_0x3a2eb0;if(_0x24d1a8[_0x563a('0x34')][_0x563a('0x45')]){_0x7696c2['include']=[{'all':!![]}];}return db[_0x563a('0x43')]['findAll'](_0x7696c2);})[_0x563a('0x27')](function(_0x3de697){_0x43379c[_0x563a('0x46')]=_0x3de697;return _0x43379c;})[_0x563a('0x27')](respondWithFilteredResult(_0x1bdfb0,_0x7696c2))['catch'](handleError(_0x1bdfb0,null));};exports['show']=function(_0x54ac1e,_0x2221d4){var _0x1255da={'raw':![],'where':{'id':_0x54ac1e[_0x563a('0x47')]['id']}},_0x19b18f={};_0x19b18f[_0x563a('0x33')]=_[_0x563a('0x35')](db[_0x563a('0x43')][_0x563a('0x2f')]);_0x19b18f[_0x563a('0x34')]=_[_0x563a('0x35')](_0x54ac1e[_0x563a('0x34')]);_0x19b18f[_0x563a('0x36')]=_[_0x563a('0x37')](_0x19b18f[_0x563a('0x33')],_0x19b18f[_0x563a('0x34')]);_0x1255da[_0x563a('0x39')]=_[_0x563a('0x37')](_0x19b18f[_0x563a('0x33')],qs[_0x563a('0x38')](_0x54ac1e['query']['fields']));_0x1255da[_0x563a('0x39')]=_0x1255da[_0x563a('0x39')][_0x563a('0x48')]?_0x1255da[_0x563a('0x39')]:_0x19b18f[_0x563a('0x33')];if(_0x54ac1e[_0x563a('0x34')][_0x563a('0x45')]){_0x1255da[_0x563a('0x49')]=[{'all':!![]}];}_0x1255da=_['merge']({},_0x1255da,_0x54ac1e['options']);return db[_0x563a('0x43')][_0x563a('0x4a')](_0x1255da)[_0x563a('0x27')](handleEntityNotFound(_0x2221d4,null))[_0x563a('0x27')](respondWithResult(_0x2221d4,null))[_0x563a('0x4b')](handleError(_0x2221d4,null));};exports[_0x563a('0x4c')]=function(_0x2689b5,_0x276642){return db['ZendeskAccount'][_0x563a('0x4c')](_0x2689b5[_0x563a('0x4d')],{})['then'](respondWithResult(_0x276642,0xc9))[_0x563a('0x4b')](handleError(_0x276642,null));};exports['update']=function(_0x3ea787,_0xab7b16){if(_0x3ea787[_0x563a('0x4d')]['id']){delete _0x3ea787['body']['id'];}return db[_0x563a('0x43')][_0x563a('0x4a')]({'where':{'id':_0x3ea787[_0x563a('0x47')]['id']}})[_0x563a('0x27')](handleEntityNotFound(_0xab7b16,null))[_0x563a('0x27')](saveUpdates(_0x3ea787[_0x563a('0x4d')],null))[_0x563a('0x27')](respondWithResult(_0xab7b16,null))[_0x563a('0x4b')](handleError(_0xab7b16,null));};exports[_0x563a('0x26')]=function(_0x2008d4,_0x3c98d5){return db[_0x563a('0x43')][_0x563a('0x4a')]({'where':{'id':_0x2008d4['params']['id']}})['then'](handleEntityNotFound(_0x3c98d5,null))[_0x563a('0x27')](removeEntity(_0x3c98d5,null))[_0x563a('0x4b')](handleError(_0x3c98d5,null));};exports[_0x563a('0x4e')]=function(_0x4a807f,_0x5ae08f,_0x13530f){var _0x1fc4d2={};var _0x50ebde={};var _0x4b6ba9;var _0x51e142;return db[_0x563a('0x43')][_0x563a('0x4f')]({'where':{'id':_0x4a807f[_0x563a('0x47')]['id']}})[_0x563a('0x27')](handleEntityNotFound(_0x5ae08f,null))[_0x563a('0x27')](function(_0x2805eb){if(_0x2805eb){_0x4b6ba9=_0x2805eb;_0x50ebde['model']=_['keys'](db[_0x563a('0x50')]['rawAttributes']);_0x50ebde[_0x563a('0x34')]=_[_0x563a('0x35')](_0x4a807f[_0x563a('0x34')]);_0x50ebde[_0x563a('0x36')]=_[_0x563a('0x37')](_0x50ebde[_0x563a('0x33')],_0x50ebde[_0x563a('0x34')]);_0x1fc4d2['attributes']=_[_0x563a('0x37')](_0x50ebde[_0x563a('0x33')],qs['fields'](_0x4a807f[_0x563a('0x34')][_0x563a('0x38')]));_0x1fc4d2[_0x563a('0x39')]=_0x1fc4d2[_0x563a('0x39')][_0x563a('0x48')]?_0x1fc4d2[_0x563a('0x39')]:_0x50ebde[_0x563a('0x33')];_0x1fc4d2[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x4a807f[_0x563a('0x34')]['sort']);_0x1fc4d2[_0x563a('0x3f')]=qs[_0x563a('0x36')](_['pick'](_0x4a807f['query'],_0x50ebde[_0x563a('0x36')]));if(_0x4a807f[_0x563a('0x34')]['filter']){_0x1fc4d2[_0x563a('0x3f')]=_['merge'](_0x1fc4d2[_0x563a('0x3f')],{'$or':_[_0x563a('0x2e')](_0x1fc4d2[_0x563a('0x39')],function(_0xbe9fff){var _0x7fa423={};_0x7fa423[_0xbe9fff]={'$like':'%'+_0x4a807f['query']['filter']+'%'};return _0x7fa423;})});}_0x1fc4d2=_['merge']({},_0x1fc4d2,_0x4a807f['options']);return _0x4b6ba9[_0x563a('0x4e')](_0x1fc4d2);}})['then'](function(_0x111444){if(_0x111444){_0x51e142=_0x111444['length'];if(!_0x4a807f[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x1fc4d2[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4a807f['query'][_0x563a('0x1e')]);_0x1fc4d2['offset']=qs['offset'](_0x4a807f[_0x563a('0x34')][_0x563a('0x1c')]);}return _0x4b6ba9[_0x563a('0x4e')](_0x1fc4d2);}})[_0x563a('0x27')](function(_0x1c8ad7){if(_0x1c8ad7){return _0x1c8ad7?{'count':_0x51e142,'rows':_0x1c8ad7}:null;}})['then'](respondWithResult(_0x5ae08f,null))[_0x563a('0x4b')](handleError(_0x5ae08f,null));};exports[_0x563a('0x51')]=function(_0x20bd36,_0x3bbe7c,_0x36d40c){if(_0x20bd36['body']['id']){delete _0x20bd36[_0x563a('0x4d')]['id'];}return db['ZendeskAccount'][_0x563a('0x4f')]({'where':{'id':_0x20bd36[_0x563a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3bbe7c,null))[_0x563a('0x27')](function(_0x30bf2b){if(_0x30bf2b){_0x20bd36[_0x563a('0x4d')][_0x563a('0x52')]=_0x30bf2b['id'];_0x20bd36[_0x563a('0x4d')][_0x563a('0x53')]=integrations[_0x563a('0x54')](_0x20bd36[_0x563a('0x4d')]['channel'],_0x20bd36[_0x563a('0x4d')][_0x563a('0x31')]);_0x20bd36[_0x563a('0x4d')][_0x563a('0x55')]=integrations[_0x563a('0x56')](_0x20bd36[_0x563a('0x4d')][_0x563a('0x57')],_0x20bd36['body'][_0x563a('0x31')]);return db['ZendeskConfiguration']['create'](_0x20bd36['body'],{'include':[{'model':db[_0x563a('0x58')],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x563a('0x55')}]});}return null;})[_0x563a('0x27')](respondWithResult(_0x3bbe7c,null))[_0x563a('0x4b')](handleError(_0x3bbe7c,null));};exports[_0x563a('0x59')]=function(_0x2e442f,_0x51220c,_0x4814b3){var _0x4c9ad7='';return db[_0x563a('0x43')][_0x563a('0x4f')]({'where':{'id':_0x2e442f[_0x563a('0x47')]['id']},'attributes':['id',_0x563a('0x5a'),_0x563a('0x5b'),_0x563a('0x5c'),'authType',_0x563a('0x5d')]})[_0x563a('0x27')](handleEntityNotFound(_0x51220c,null))['then'](function(_0x1983e5){if(_0x1983e5){_0x4c9ad7=_0x1983e5[_0x563a('0x5d')];var _0x15e9ce=_0x4c9ad7['slice'](-0x1);if(_0x15e9ce==='/'){_0x4c9ad7=_0x4c9ad7[_0x563a('0x5e')](0x0,_0x4c9ad7[_0x563a('0x5f')](_0x15e9ce));}var _0x332428={'method':_0x563a('0x60'),'uri':util['format'](_0x563a('0x61'),_0x4c9ad7,_0x563a('0x62')),'json':!![]};switch(_0x1983e5[_0x563a('0x63')]){case _0x563a('0x5b'):_0x332428[_0x563a('0x64')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x563a('0x65')]('%s:%s',_0x1983e5[_0x563a('0x5a')],_0x1983e5[_0x563a('0x5b')]))[_0x563a('0x66')](_0x563a('0x67')))};break;case _0x563a('0x5c'):_0x332428[_0x563a('0x64')]={'Authorization':util[_0x563a('0x65')](_0x563a('0x68'),new Buffer(util[_0x563a('0x65')](_0x563a('0x69'),_0x1983e5['username'],_0x1983e5[_0x563a('0x5c')]))['toString'](_0x563a('0x67')))};break;default:throw new db[(_0x563a('0x6a'))]['ValidationError'](_0x563a('0x6b'));}return rp(_0x332428);}})['then'](function(_0x41f530){if(_0x41f530){var _0x42c448=['subject',_0x563a('0x6c'),_0x563a('0x6d'),_0x563a('0x6e')];_[_0x563a('0x6f')](_0x41f530['ticket_fields'],function(_0x418646){return _0x42c448[_0x563a('0x70')](_0x418646[_0x563a('0x31')]);});return{'count':_0x41f530[_0x563a('0x62')][_0x563a('0x48')],'rows':_[_0x563a('0x2e')](_0x41f530[_0x563a('0x62')],function(_0x137d52){return{'id':_0x137d52['id'],'name':_0x137d52[_0x563a('0x71')]>0x7?_0x137d52[_0x563a('0x72')]:_0x137d52['type'],'custom':_0x137d52[_0x563a('0x71')]>0x7?!![]:![],'options':_0x137d52[_0x563a('0x73')]?_0x137d52[_0x563a('0x73')]:_0x137d52['custom_field_options']?_0x137d52[_0x563a('0x74')]:[]};})};}})[_0x563a('0x27')](respondWithResult(_0x51220c,null))[_0x563a('0x4b')](function(_0xe27e02){var _0x2cca62=_0x2e442f[_0x563a('0x34')][_0x563a('0x75')]?0x1f4:_0xe27e02[_0x563a('0x76')]||0x1f4;logger[_0x563a('0x29')](_0x563a('0x77'),_0x563a('0x59'),_0x2cca62,JSON[_0x563a('0x78')](_0xe27e02));delete _0xe27e02[_0x563a('0x2b')];if(_0x2cca62===0x191){_0x2cca62=0x190;}_0x51220c['status'](_0x2cca62)[_0x563a('0x2c')](_0x2e442f[_0x563a('0x34')]['test']?{'message':_0x563a('0x79'),'statusCode':_0xe27e02[_0x563a('0x76')]}:_0xe27e02);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 4b1cb49..48a940e 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 _0x1907=['../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0x1907,0x109));var _0x7190=function(_0x49af67,_0x2c9f8d){_0x49af67=_0x49af67-0x0;var _0x5e6a9f=_0x1907[_0x49af67];return _0x5e6a9f;};'use strict';var _=require(_0x7190('0x0'));var util=require(_0x7190('0x1'));var logger=require(_0x7190('0x2'))(_0x7190('0x3'));var moment=require(_0x7190('0x4'));var BPromise=require(_0x7190('0x5'));var rp=require(_0x7190('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7190('0x7'));var config=require(_0x7190('0x8'));var attributes=require(_0x7190('0x9'));var integrations=require(_0x7190('0xa'));module['exports']=function(_0x2b5476,_0x3144b1){return _0x2b5476['define'](_0x7190('0xb'),attributes,{'tableName':_0x7190('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x599a=['exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x15bbf1,_0x40ef96){var _0x5c4b47=function(_0x303b4f){while(--_0x303b4f){_0x15bbf1['push'](_0x15bbf1['shift']());}};_0x5c4b47(++_0x40ef96);}(_0x599a,0x1ee));var _0xa599=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0x599a[_0x287a47];return _0x3fb726;};'use strict';var _=require('lodash');var util=require(_0xa599('0x0'));var logger=require(_0xa599('0x1'))(_0xa599('0x2'));var moment=require('moment');var BPromise=require(_0xa599('0x3'));var rp=require(_0xa599('0x4'));var fs=require('fs');var path=require(_0xa599('0x5'));var rimraf=require(_0xa599('0x6'));var config=require(_0xa599('0x7'));var attributes=require(_0xa599('0x8'));var integrations=require(_0xa599('0x9'));module[_0xa599('0xa')]=function(_0x1e5738,_0x4df2fb){return _0x1e5738[_0xa599('0xb')](_0xa599('0xc'),attributes,{'tableName':_0xa599('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 4dbf80d..f679cbb 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 _0x6ece=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll','options','attributes','limit','map','include','model','ShowZendeskAccount','ZendeskAccount','debug','stringify','lodash'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x6ece,0xbf));var _0xe6ec=function(_0x16bda7,_0x4cbbcf){_0x16bda7=_0x16bda7-0x0;var _0x1167f4=_0x6ece[_0x16bda7];return _0x1167f4;};'use strict';var _=require(_0xe6ec('0x0'));var util=require(_0xe6ec('0x1'));var moment=require(_0xe6ec('0x2'));var BPromise=require('bluebird');var rs=require(_0xe6ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe6ec('0x4'));var logger=require(_0xe6ec('0x5'))(_0xe6ec('0x6'));var config=require(_0xe6ec('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe6ec('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b6f56,_0x4d6626,_0x5cfcad){return new BPromise(function(_0x1969d3,_0x2b7199){return client[_0xe6ec('0x9')](_0x2b6f56,_0x5cfcad)[_0xe6ec('0xa')](function(_0x1c194f){logger[_0xe6ec('0xb')](_0xe6ec('0xc'),_0x4d6626,_0xe6ec('0xd'));logger['debug'](_0xe6ec('0xe'),_0x4d6626,'request\x20sent',JSON['stringify'](_0x1c194f));if(_0x1c194f[_0xe6ec('0xf')]){if(_0x1c194f[_0xe6ec('0xf')][_0xe6ec('0x10')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x4d6626,_0x1c194f[_0xe6ec('0xf')]['message']);return _0x2b7199(_0x1c194f['error'][_0xe6ec('0x11')]);}logger[_0xe6ec('0xf')](_0xe6ec('0xc'),_0x4d6626,_0x1c194f[_0xe6ec('0xf')][_0xe6ec('0x11')]);return _0x1969d3(_0x1c194f[_0xe6ec('0xf')][_0xe6ec('0x11')]);}else{logger[_0xe6ec('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x4d6626,'request\x20sent');_0x1969d3(_0x1c194f[_0xe6ec('0x12')][_0xe6ec('0x11')]);}})[_0xe6ec('0x13')](function(_0x25d2b4){logger[_0xe6ec('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x4d6626,_0x25d2b4);_0x2b7199(_0x25d2b4);});});}exports[_0xe6ec('0x14')]=function(_0x22a5c2){var _0xe36045=this;return new Promise(function(_0xb9b830,_0x4ebe47){return db['ZendeskAccount'][_0xe6ec('0x15')]({'raw':_0x22a5c2['options']?_0x22a5c2[_0xe6ec('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x22a5c2['options']?_0x22a5c2[_0xe6ec('0x16')]['where']||null:null,'attributes':_0x22a5c2['options']?_0x22a5c2[_0xe6ec('0x16')][_0xe6ec('0x17')]||null:null,'limit':_0x22a5c2[_0xe6ec('0x16')]?_0x22a5c2[_0xe6ec('0x16')][_0xe6ec('0x18')]||null:null,'include':_0x22a5c2['options']?_0x22a5c2[_0xe6ec('0x16')]['include']?_[_0xe6ec('0x19')](_0x22a5c2[_0xe6ec('0x16')][_0xe6ec('0x1a')],function(_0x84b913){return{'model':db[_0x84b913[_0xe6ec('0x1b')]],'as':_0x84b913['as'],'attributes':_0x84b913[_0xe6ec('0x17')],'include':_0x84b913[_0xe6ec('0x1a')]?_['map'](_0x84b913[_0xe6ec('0x1a')],function(_0x5f375c){return{'model':db[_0x5f375c['model']],'as':_0x5f375c['as'],'attributes':_0x5f375c[_0xe6ec('0x17')],'include':_0x5f375c[_0xe6ec('0x1a')]?_[_0xe6ec('0x19')](_0x5f375c['include'],function(_0x5a92c0){return{'model':db[_0x5a92c0[_0xe6ec('0x1b')]],'as':_0x5a92c0['as'],'attributes':_0x5a92c0['attributes']};}):[]};}):[]};}):[]:[]})[_0xe6ec('0xa')](function(_0x21e0bb){logger['info'](_0xe6ec('0x14'),_0x22a5c2);logger['debug'](_0xe6ec('0x14'),_0x22a5c2,JSON['stringify'](_0x21e0bb));_0xb9b830(_0x21e0bb);})['catch'](function(_0x1a83e0){logger[_0xe6ec('0xf')](_0xe6ec('0x14'),_0x1a83e0[_0xe6ec('0x11')],_0x22a5c2);_0x4ebe47(_0xe36045[_0xe6ec('0xf')](0x1f4,_0x1a83e0['message']));});});};exports[_0xe6ec('0x1c')]=function(_0x3c7fec){var _0x13eeda=this;return new Promise(function(_0x2c733d,_0x45e95e){return db[_0xe6ec('0x1d')]['find']({'raw':_0x3c7fec[_0xe6ec('0x16')]?_0x3c7fec[_0xe6ec('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3c7fec[_0xe6ec('0x16')]?_0x3c7fec[_0xe6ec('0x16')]['where']||null:null,'attributes':_0x3c7fec[_0xe6ec('0x16')]?_0x3c7fec[_0xe6ec('0x16')][_0xe6ec('0x17')]||null:null,'include':_0x3c7fec[_0xe6ec('0x16')]?_0x3c7fec[_0xe6ec('0x16')][_0xe6ec('0x1a')]?_['map'](_0x3c7fec[_0xe6ec('0x16')][_0xe6ec('0x1a')],function(_0x5b717a){return{'model':db[_0x5b717a[_0xe6ec('0x1b')]],'as':_0x5b717a['as'],'attributes':_0x5b717a['attributes'],'include':_0x5b717a[_0xe6ec('0x1a')]?_[_0xe6ec('0x19')](_0x5b717a[_0xe6ec('0x1a')],function(_0x47bb2b){return{'model':db[_0x47bb2b[_0xe6ec('0x1b')]],'as':_0x47bb2b['as'],'attributes':_0x47bb2b['attributes'],'include':_0x47bb2b['include']?_['map'](_0x47bb2b[_0xe6ec('0x1a')],function(_0xb4bf9e){return{'model':db[_0xb4bf9e[_0xe6ec('0x1b')]],'as':_0xb4bf9e['as'],'attributes':_0xb4bf9e[_0xe6ec('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe6ec('0xa')](function(_0x5f2875){logger[_0xe6ec('0xb')](_0xe6ec('0x1c'),_0x3c7fec);logger[_0xe6ec('0x1e')](_0xe6ec('0x1c'),_0x3c7fec,JSON[_0xe6ec('0x1f')](_0x5f2875));_0x2c733d(_0x5f2875);})[_0xe6ec('0x13')](function(_0x47381f){logger[_0xe6ec('0xf')](_0xe6ec('0x1c'),_0x47381f[_0xe6ec('0x11')],_0x3c7fec);_0x45e95e(_0x13eeda[_0xe6ec('0xf')](0x1f4,_0x47381f[_0xe6ec('0x11')]));});});}; \ No newline at end of file +var _0x15a0=['stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','find','where'];(function(_0x12c66e,_0xea7b4){var _0x19481a=function(_0x5a77aa){while(--_0x5a77aa){_0x12c66e['push'](_0x12c66e['shift']());}};_0x19481a(++_0xea7b4);}(_0x15a0,0x8d));var _0x015a=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x15a0[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0x015a('0x0'));var util=require('util');var moment=require(_0x015a('0x1'));var BPromise=require(_0x015a('0x2'));var rs=require(_0x015a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x015a('0x4'))['db'];var utils=require(_0x015a('0x5'));var logger=require('../../config/logger')(_0x015a('0x6'));var config=require(_0x015a('0x7'));var jayson=require(_0x015a('0x8'));var client=jayson[_0x015a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4062cf,_0x5cc03f,_0x3c83fb){return new BPromise(function(_0x50f1f3,_0x53edba){return client[_0x015a('0xa')](_0x4062cf,_0x3c83fb)[_0x015a('0xb')](function(_0x293a02){logger[_0x015a('0xc')](_0x015a('0xd'),_0x5cc03f,'request\x20sent');logger[_0x015a('0xe')](_0x015a('0xf'),_0x5cc03f,_0x015a('0x10'),JSON['stringify'](_0x293a02));if(_0x293a02[_0x015a('0x11')]){if(_0x293a02[_0x015a('0x11')][_0x015a('0x12')]===0x1f4){logger[_0x015a('0x11')](_0x015a('0xd'),_0x5cc03f,_0x293a02[_0x015a('0x11')][_0x015a('0x13')]);return _0x53edba(_0x293a02[_0x015a('0x11')]['message']);}logger[_0x015a('0x11')](_0x015a('0xd'),_0x5cc03f,_0x293a02[_0x015a('0x11')][_0x015a('0x13')]);return _0x50f1f3(_0x293a02[_0x015a('0x11')][_0x015a('0x13')]);}else{logger['info'](_0x015a('0xd'),_0x5cc03f,'request\x20sent');_0x50f1f3(_0x293a02['result'][_0x015a('0x13')]);}})[_0x015a('0x14')](function(_0x211e6a){logger[_0x015a('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x5cc03f,_0x211e6a);_0x53edba(_0x211e6a);});});}exports[_0x015a('0x15')]=function(_0x59876c){var _0x2f0f3d=this;return new Promise(function(_0x1e2092,_0x34f587){return db[_0x015a('0x16')][_0x015a('0x17')]({'raw':_0x59876c[_0x015a('0x18')]?_0x59876c[_0x015a('0x18')][_0x015a('0x19')]===undefined?!![]:![]:!![],'where':_0x59876c['options']?_0x59876c[_0x015a('0x18')]['where']||null:null,'attributes':_0x59876c[_0x015a('0x18')]?_0x59876c[_0x015a('0x18')][_0x015a('0x1a')]||null:null,'limit':_0x59876c[_0x015a('0x18')]?_0x59876c[_0x015a('0x18')][_0x015a('0x1b')]||null:null,'include':_0x59876c[_0x015a('0x18')]?_0x59876c[_0x015a('0x18')][_0x015a('0x1c')]?_[_0x015a('0x1d')](_0x59876c[_0x015a('0x18')]['include'],function(_0x226d90){return{'model':db[_0x226d90['model']],'as':_0x226d90['as'],'attributes':_0x226d90['attributes'],'include':_0x226d90[_0x015a('0x1c')]?_[_0x015a('0x1d')](_0x226d90['include'],function(_0x479223){return{'model':db[_0x479223[_0x015a('0x1e')]],'as':_0x479223['as'],'attributes':_0x479223[_0x015a('0x1a')],'include':_0x479223[_0x015a('0x1c')]?_[_0x015a('0x1d')](_0x479223[_0x015a('0x1c')],function(_0x2e99eb){return{'model':db[_0x2e99eb['model']],'as':_0x2e99eb['as'],'attributes':_0x2e99eb[_0x015a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x015a('0xb')](function(_0x3a0bb9){logger[_0x015a('0xc')]('GetZendeskAccount',_0x59876c);logger['debug'](_0x015a('0x15'),_0x59876c,JSON['stringify'](_0x3a0bb9));_0x1e2092(_0x3a0bb9);})[_0x015a('0x14')](function(_0x556ac2){logger[_0x015a('0x11')](_0x015a('0x15'),_0x556ac2[_0x015a('0x13')],_0x59876c);_0x34f587(_0x2f0f3d[_0x015a('0x11')](0x1f4,_0x556ac2[_0x015a('0x13')]));});});};exports[_0x015a('0x1f')]=function(_0x167819){var _0x93ff41=this;return new Promise(function(_0x27aaf5,_0x203be5){return db[_0x015a('0x16')][_0x015a('0x20')]({'raw':_0x167819[_0x015a('0x18')]?_0x167819['options'][_0x015a('0x19')]===undefined?!![]:![]:!![],'where':_0x167819['options']?_0x167819[_0x015a('0x18')][_0x015a('0x21')]||null:null,'attributes':_0x167819['options']?_0x167819['options'][_0x015a('0x1a')]||null:null,'include':_0x167819[_0x015a('0x18')]?_0x167819[_0x015a('0x18')][_0x015a('0x1c')]?_[_0x015a('0x1d')](_0x167819[_0x015a('0x18')]['include'],function(_0x2752e0){return{'model':db[_0x2752e0[_0x015a('0x1e')]],'as':_0x2752e0['as'],'attributes':_0x2752e0['attributes'],'include':_0x2752e0[_0x015a('0x1c')]?_[_0x015a('0x1d')](_0x2752e0[_0x015a('0x1c')],function(_0x36f8af){return{'model':db[_0x36f8af[_0x015a('0x1e')]],'as':_0x36f8af['as'],'attributes':_0x36f8af['attributes'],'include':_0x36f8af[_0x015a('0x1c')]?_['map'](_0x36f8af['include'],function(_0x1101e){return{'model':db[_0x1101e[_0x015a('0x1e')]],'as':_0x1101e['as'],'attributes':_0x1101e['attributes']};}):[]};}):[]};}):[]:[]})[_0x015a('0xb')](function(_0x93f178){logger[_0x015a('0xc')](_0x015a('0x1f'),_0x167819);logger[_0x015a('0xe')]('ShowZendeskAccount',_0x167819,JSON[_0x015a('0x22')](_0x93f178));_0x27aaf5(_0x93f178);})[_0x015a('0x14')](function(_0xe64c8f){logger[_0x015a('0x11')](_0x015a('0x1f'),_0xe64c8f[_0x015a('0x13')],_0x167819);_0x203be5(_0x93ff41['error'](0x1f4,_0xe64c8f[_0x015a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 9ef4313..c747d63 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 _0xbdb7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index','get','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getTags','/:id/tags','update','delete','/:id'];(function(_0x3a7e01,_0x51204c){var _0x5b8398=function(_0x4dcfab){while(--_0x4dcfab){_0x3a7e01['push'](_0x3a7e01['shift']());}};_0x5b8398(++_0x51204c);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x225b4e,_0x179ee4){_0x225b4e=_0x225b4e-0x0;var _0x24237a=_0xbdb7[_0x225b4e];return _0x24237a;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0xb')](_0x7bdb('0x11'),auth[_0x7bdb('0xf')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x12')]);router['post']('/',auth[_0x7bdb('0xf')](),controller['create']);router['post'](_0x7bdb('0x13'),auth[_0x7bdb('0xf')](),controller['setTags']);router['put']('/:id',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x14')]);router[_0x7bdb('0x15')](_0x7bdb('0x16'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x17')]);module[_0x7bdb('0x18')]=router; \ No newline at end of file +var _0x91a7=['util','path','connect-timeout','Router','../../components/auth/service','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','put','update','destroy','exports'];(function(_0x1f5e11,_0x4f7fbc){var _0x4bdc59=function(_0x186993){while(--_0x186993){_0x1f5e11['push'](_0x1f5e11['shift']());}};_0x4bdc59(++_0x4f7fbc);}(_0x91a7,0xe7));var _0x791a=function(_0x55d911,_0x2b768c){_0x55d911=_0x55d911-0x0;var _0x3104c2=_0x91a7[_0x55d911];return _0x3104c2;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/subjects',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['get'](_0x791a('0xd'),auth[_0x791a('0x9')](),controller[_0x791a('0xe')]);router[_0x791a('0x6')](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['getTags']);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['post'](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['setTags']);router[_0x791a('0x11')](_0x791a('0x8'),auth[_0x791a('0x9')](),controller[_0x791a('0x12')]);router['delete'](_0x791a('0x8'),auth['isAuthenticated'](),controller[_0x791a('0x13')]);module[_0x791a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index b3deb18..f10f147 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 _0x942d=['exports','STRING','sequelize'];(function(_0x145d05,_0xfa7441){var _0x39710d=function(_0x565177){while(--_0x565177){_0x145d05['push'](_0x145d05['shift']());}};_0x39710d(++_0xfa7441);}(_0x942d,0x89));var _0xd942=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x942d[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0xd942('0x0'));module[_0xd942('0x1')]={'name':{'type':Sequelize[_0xd942('0x2')]},'description':{'type':Sequelize[_0xd942('0x2')]}}; \ No newline at end of file +var _0xa3fe=['sequelize','exports','STRING'];(function(_0x1dbc21,_0x474057){var _0x5ed607=function(_0x304a34){while(--_0x304a34){_0x1dbc21['push'](_0x1dbc21['shift']());}};_0x5ed607(++_0x474057);}(_0xa3fe,0xd5));var _0xea3f=function(_0x55b503,_0x224426){_0x55b503=_0x55b503-0x0;var _0x54756d=_0xa3fe[_0x55b503];return _0x54756d;};'use strict';var Sequelize=require(_0xea3f('0x0'));module[_0xea3f('0x1')]={'name':{'type':Sequelize[_0xea3f('0x2')]},'description':{'type':Sequelize[_0xea3f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 7b78dc8..80f44a9 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 _0x0456=['filter','type','merge','options','includeAll','include','ZendeskConfiguration','findAll','rows','show','intersection','create','body','catch','update','find','params','getFields','sort','pick','getSubjects','findOne','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where'];(function(_0x5e536e,_0x254747){var _0x18cf81=function(_0x37766f){while(--_0x37766f){_0x5e536e['push'](_0x5e536e['shift']());}};_0x18cf81(++_0x254747);}(_0x0456,0x11e));var _0x6045=function(_0x2d1dc8,_0x292724){_0x2d1dc8=_0x2d1dc8-0x0;var _0x51fef1=_0x0456[_0x2d1dc8];return _0x51fef1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6045('0x0'));var zipdir=require(_0x6045('0x1'));var jsonpatch=require(_0x6045('0x2'));var rp=require(_0x6045('0x3'));var moment=require(_0x6045('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6045('0x5'));var util=require(_0x6045('0x6'));var path=require(_0x6045('0x7'));var sox=require(_0x6045('0x8'));var csv=require(_0x6045('0x9'));var ejs=require(_0x6045('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6045('0xb'));var crypto=require(_0x6045('0xc'));var jsforce=require(_0x6045('0xd'));var deskjs=require(_0x6045('0xe'));var toCsv=require(_0x6045('0x9'));var querystring=require(_0x6045('0xf'));var Papa=require(_0x6045('0x10'));var Redis=require(_0x6045('0x11'));var authService=require(_0x6045('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6045('0x13'));var hardwareService=require(_0x6045('0x14'));var logger=require(_0x6045('0x15'))(_0x6045('0x16'));var utils=require(_0x6045('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6045('0x18'));var db=require(_0x6045('0x19'))['db'];function respondWithStatusCode(_0x3aa2d1,_0x2200cc){_0x2200cc=_0x2200cc||0xcc;return function(_0x5941d8){if(_0x5941d8){return _0x3aa2d1['sendStatus'](_0x2200cc);}return _0x3aa2d1[_0x6045('0x1a')](_0x2200cc)[_0x6045('0x1b')]();};}function respondWithResult(_0xdc19f0,_0x141977){_0x141977=_0x141977||0xc8;return function(_0x49e843){if(_0x49e843){return _0xdc19f0[_0x6045('0x1a')](_0x141977)['json'](_0x49e843);}};}function respondWithFilteredResult(_0x5958c0,_0x8c11ce){return function(_0x4b10e6){if(_0x4b10e6){var _0x837912=typeof _0x8c11ce[_0x6045('0x1c')]===_0x6045('0x1d')&&typeof _0x8c11ce[_0x6045('0x1e')]==='undefined';var _0x3cb274=_0x4b10e6[_0x6045('0x1f')];var _0x5f25fd=_0x837912?0x0:_0x8c11ce[_0x6045('0x1c')];var _0x511084=_0x837912?_0x4b10e6[_0x6045('0x1f')]:_0x8c11ce['offset']+_0x8c11ce['limit'];var _0xe2c6d1;if(_0x511084>=_0x3cb274){_0x511084=_0x3cb274;_0xe2c6d1=0xc8;}else{_0xe2c6d1=0xce;}_0x5958c0[_0x6045('0x1a')](_0xe2c6d1);return _0x5958c0[_0x6045('0x20')](_0x6045('0x21'),_0x5f25fd+'-'+_0x511084+'/'+_0x3cb274)[_0x6045('0x22')](_0x4b10e6);}return null;};}function patchUpdates(_0x4f7e54){return function(_0x5e6a34){try{jsonpatch[_0x6045('0x23')](_0x5e6a34,_0x4f7e54,!![]);}catch(_0xeea71c){return BPromise[_0x6045('0x24')](_0xeea71c);}return _0x5e6a34['save']();};}function saveUpdates(_0x4d29cc,_0x50a82b){return function(_0xb22e81){if(_0xb22e81){return _0xb22e81['update'](_0x4d29cc)['then'](function(_0x594fc3){return _0x594fc3;});}return null;};}function removeEntity(_0x223992,_0x15c402){return function(_0xcc7524){if(_0xcc7524){return _0xcc7524[_0x6045('0x25')]()[_0x6045('0x26')](function(){_0x223992[_0x6045('0x1a')](0xcc)[_0x6045('0x1b')]();});}};}function handleEntityNotFound(_0x25520f,_0x55d274){return function(_0x1b193b){if(!_0x1b193b){_0x25520f[_0x6045('0x27')](0x194);}return _0x1b193b;};}function handleError(_0x37568a,_0x15f7f4){_0x15f7f4=_0x15f7f4||0x1f4;return function(_0x1f4811){logger['error'](_0x1f4811[_0x6045('0x28')]);if(_0x1f4811['name']){delete _0x1f4811[_0x6045('0x29')];}_0x37568a[_0x6045('0x1a')](_0x15f7f4)[_0x6045('0x2a')](_0x1f4811);};}exports[_0x6045('0x2b')]=function(_0x37a1e5,_0x822fe7){var _0xb2347e={},_0x54fc0d={},_0x5c276f={'count':0x0,'rows':[]};var _0x3d7dda=_[_0x6045('0x2c')](db['ZendeskConfiguration'][_0x6045('0x2d')],function(_0x58d22c){return{'name':_0x58d22c['fieldName'],'type':_0x58d22c['type'][_0x6045('0x2e')]};});_0x54fc0d[_0x6045('0x2f')]=_['map'](_0x3d7dda,_0x6045('0x29'));_0x54fc0d[_0x6045('0x30')]=_[_0x6045('0x31')](_0x37a1e5['query']);_0x54fc0d[_0x6045('0x32')]=_['intersection'](_0x54fc0d[_0x6045('0x2f')],_0x54fc0d[_0x6045('0x30')]);_0xb2347e[_0x6045('0x33')]=_['intersection'](_0x54fc0d[_0x6045('0x2f')],qs[_0x6045('0x34')](_0x37a1e5['query'][_0x6045('0x34')]));_0xb2347e['attributes']=_0xb2347e[_0x6045('0x33')][_0x6045('0x35')]?_0xb2347e[_0x6045('0x33')]:_0x54fc0d[_0x6045('0x2f')];if(!_0x37a1e5['query'][_0x6045('0x36')](_0x6045('0x37'))){_0xb2347e[_0x6045('0x1e')]=qs['limit'](_0x37a1e5['query'][_0x6045('0x1e')]);_0xb2347e[_0x6045('0x1c')]=qs[_0x6045('0x1c')](_0x37a1e5[_0x6045('0x30')][_0x6045('0x1c')]);}_0xb2347e[_0x6045('0x38')]=qs['sort'](_0x37a1e5[_0x6045('0x30')]['sort']);_0xb2347e[_0x6045('0x39')]=qs[_0x6045('0x32')](_['pick'](_0x37a1e5['query'],_0x54fc0d[_0x6045('0x32')]),_0x3d7dda);if(_0x37a1e5['query'][_0x6045('0x3a')]){_0xb2347e[_0x6045('0x39')]=_['merge'](_0xb2347e['where'],{'$or':_[_0x6045('0x2c')](_0x3d7dda,function(_0x252be1){if(_0x252be1[_0x6045('0x3b')]!=='VIRTUAL'){var _0x4fbe24={};_0x4fbe24[_0x252be1[_0x6045('0x29')]]={'$like':'%'+_0x37a1e5[_0x6045('0x30')]['filter']+'%'};return _0x4fbe24;}})});}_0xb2347e=_[_0x6045('0x3c')]({},_0xb2347e,_0x37a1e5[_0x6045('0x3d')]);var _0x49f640={'where':_0xb2347e[_0x6045('0x39')]};return db['ZendeskConfiguration']['count'](_0x49f640)[_0x6045('0x26')](function(_0x1acae3){_0x5c276f[_0x6045('0x1f')]=_0x1acae3;if(_0x37a1e5['query'][_0x6045('0x3e')]){_0xb2347e[_0x6045('0x3f')]=[{'all':!![]}];}return db[_0x6045('0x40')][_0x6045('0x41')](_0xb2347e);})['then'](function(_0x4aa75c){_0x5c276f[_0x6045('0x42')]=_0x4aa75c;return _0x5c276f;})[_0x6045('0x26')](respondWithFilteredResult(_0x822fe7,_0xb2347e))['catch'](handleError(_0x822fe7,null));};exports[_0x6045('0x43')]=function(_0x159ccb,_0x19f336){var _0x19da1e={'raw':![],'where':{'id':_0x159ccb['params']['id']}},_0x413713={};_0x413713[_0x6045('0x2f')]=_[_0x6045('0x31')](db['ZendeskConfiguration'][_0x6045('0x2d')]);_0x413713[_0x6045('0x30')]=_[_0x6045('0x31')](_0x159ccb[_0x6045('0x30')]);_0x413713[_0x6045('0x32')]=_[_0x6045('0x44')](_0x413713[_0x6045('0x2f')],_0x413713[_0x6045('0x30')]);_0x19da1e['attributes']=_['intersection'](_0x413713[_0x6045('0x2f')],qs[_0x6045('0x34')](_0x159ccb[_0x6045('0x30')][_0x6045('0x34')]));_0x19da1e[_0x6045('0x33')]=_0x19da1e[_0x6045('0x33')][_0x6045('0x35')]?_0x19da1e[_0x6045('0x33')]:_0x413713['model'];if(_0x159ccb[_0x6045('0x30')][_0x6045('0x3e')]){_0x19da1e['include']=[{'all':!![]}];}_0x19da1e=_[_0x6045('0x3c')]({},_0x19da1e,_0x159ccb['options']);return db[_0x6045('0x40')]['find'](_0x19da1e)[_0x6045('0x26')](handleEntityNotFound(_0x19f336,null))[_0x6045('0x26')](respondWithResult(_0x19f336,null))['catch'](handleError(_0x19f336,null));};exports[_0x6045('0x45')]=function(_0x183b30,_0x50ad0d){return db[_0x6045('0x40')][_0x6045('0x45')](_0x183b30[_0x6045('0x46')],{})[_0x6045('0x26')](respondWithResult(_0x50ad0d,0xc9))[_0x6045('0x47')](handleError(_0x50ad0d,null));};exports[_0x6045('0x48')]=function(_0x50f5dc,_0x47ce53){if(_0x50f5dc[_0x6045('0x46')]['id']){delete _0x50f5dc[_0x6045('0x46')]['id'];}return db[_0x6045('0x40')][_0x6045('0x49')]({'where':{'id':_0x50f5dc['params']['id']}})['then'](handleEntityNotFound(_0x47ce53,null))[_0x6045('0x26')](saveUpdates(_0x50f5dc[_0x6045('0x46')],null))[_0x6045('0x26')](respondWithResult(_0x47ce53,null))['catch'](handleError(_0x47ce53,null));};exports[_0x6045('0x25')]=function(_0x2ee3e4,_0x1611c9){return db[_0x6045('0x40')][_0x6045('0x49')]({'where':{'id':_0x2ee3e4[_0x6045('0x4a')]['id']}})[_0x6045('0x26')](handleEntityNotFound(_0x1611c9,null))[_0x6045('0x26')](removeEntity(_0x1611c9,null))['catch'](handleError(_0x1611c9,null));};exports[_0x6045('0x4b')]=function(_0x5d3a2a,_0x24d606,_0x4f5c8d){var _0x45d41a={};var _0x41896d={};var _0x3e9b26;var _0x185d4e;return db[_0x6045('0x40')]['findOne']({'where':{'id':_0x5d3a2a['params']['id']}})[_0x6045('0x26')](handleEntityNotFound(_0x24d606,null))[_0x6045('0x26')](function(_0xc6fe5){if(_0xc6fe5){_0x3e9b26=_0xc6fe5;_0x41896d[_0x6045('0x2f')]=_[_0x6045('0x31')](db['ZendeskField'][_0x6045('0x2d')]);_0x41896d[_0x6045('0x30')]=_[_0x6045('0x31')](_0x5d3a2a['query']);_0x41896d[_0x6045('0x32')]=_[_0x6045('0x44')](_0x41896d[_0x6045('0x2f')],_0x41896d[_0x6045('0x30')]);_0x45d41a['attributes']=_['intersection'](_0x41896d[_0x6045('0x2f')],qs[_0x6045('0x34')](_0x5d3a2a[_0x6045('0x30')][_0x6045('0x34')]));_0x45d41a[_0x6045('0x33')]=_0x45d41a[_0x6045('0x33')][_0x6045('0x35')]?_0x45d41a['attributes']:_0x41896d[_0x6045('0x2f')];_0x45d41a[_0x6045('0x38')]=qs[_0x6045('0x4c')](_0x5d3a2a[_0x6045('0x30')]['sort']);_0x45d41a[_0x6045('0x39')]=qs[_0x6045('0x32')](_[_0x6045('0x4d')](_0x5d3a2a[_0x6045('0x30')],_0x41896d[_0x6045('0x32')]));if(_0x5d3a2a['query']['filter']){_0x45d41a[_0x6045('0x39')]=_[_0x6045('0x3c')](_0x45d41a[_0x6045('0x39')],{'$or':_['map'](_0x45d41a[_0x6045('0x33')],function(_0x47ab73){var _0x158c55={};_0x158c55[_0x47ab73]={'$like':'%'+_0x5d3a2a[_0x6045('0x30')]['filter']+'%'};return _0x158c55;})});}_0x45d41a=_[_0x6045('0x3c')]({},_0x45d41a,_0x5d3a2a[_0x6045('0x3d')]);return _0x3e9b26['getFields'](_0x45d41a);}})['then'](function(_0x5496ec){if(_0x5496ec){_0x185d4e=_0x5496ec['length'];if(!_0x5d3a2a['query']['hasOwnProperty']('nolimit')){_0x45d41a[_0x6045('0x1e')]=qs[_0x6045('0x1e')](_0x5d3a2a[_0x6045('0x30')][_0x6045('0x1e')]);_0x45d41a[_0x6045('0x1c')]=qs['offset'](_0x5d3a2a['query'][_0x6045('0x1c')]);}return _0x3e9b26[_0x6045('0x4b')](_0x45d41a);}})[_0x6045('0x26')](function(_0x2702a8){if(_0x2702a8){return _0x2702a8?{'count':_0x185d4e,'rows':_0x2702a8}:null;}})['then'](respondWithResult(_0x24d606,null))[_0x6045('0x47')](handleError(_0x24d606,null));};exports[_0x6045('0x4e')]=function(_0x434179,_0x2f991e,_0x1e4bd4){var _0x159500={};var _0x171229={};var _0x937068;var _0x44ca08;return db[_0x6045('0x40')][_0x6045('0x4f')]({'where':{'id':_0x434179['params']['id']}})[_0x6045('0x26')](handleEntityNotFound(_0x2f991e,null))['then'](function(_0x2daaf7){if(_0x2daaf7){_0x937068=_0x2daaf7;_0x171229['model']=_[_0x6045('0x31')](db[_0x6045('0x50')][_0x6045('0x2d')]);_0x171229[_0x6045('0x30')]=_['keys'](_0x434179['query']);_0x171229[_0x6045('0x32')]=_[_0x6045('0x44')](_0x171229['model'],_0x171229[_0x6045('0x30')]);_0x159500['attributes']=_[_0x6045('0x44')](_0x171229[_0x6045('0x2f')],qs[_0x6045('0x34')](_0x434179['query'][_0x6045('0x34')]));_0x159500[_0x6045('0x33')]=_0x159500[_0x6045('0x33')][_0x6045('0x35')]?_0x159500[_0x6045('0x33')]:_0x171229[_0x6045('0x2f')];_0x159500['order']=qs[_0x6045('0x4c')](_0x434179[_0x6045('0x30')][_0x6045('0x4c')]);_0x159500[_0x6045('0x39')]=qs['filters'](_[_0x6045('0x4d')](_0x434179[_0x6045('0x30')],_0x171229['filters']));if(_0x434179[_0x6045('0x30')][_0x6045('0x3a')]){_0x159500[_0x6045('0x39')]=_[_0x6045('0x3c')](_0x159500[_0x6045('0x39')],{'$or':_[_0x6045('0x2c')](_0x159500['attributes'],function(_0x218e15){var _0x3cdc48={};_0x3cdc48[_0x218e15]={'$like':'%'+_0x434179[_0x6045('0x30')][_0x6045('0x3a')]+'%'};return _0x3cdc48;})});}_0x159500=_[_0x6045('0x3c')]({},_0x159500,_0x434179[_0x6045('0x3d')]);return _0x937068['getSubjects'](_0x159500);}})['then'](function(_0x2c68a7){if(_0x2c68a7){_0x44ca08=_0x2c68a7[_0x6045('0x35')];if(!_0x434179[_0x6045('0x30')][_0x6045('0x36')](_0x6045('0x37'))){_0x159500[_0x6045('0x1e')]=qs[_0x6045('0x1e')](_0x434179[_0x6045('0x30')][_0x6045('0x1e')]);_0x159500['offset']=qs['offset'](_0x434179[_0x6045('0x30')]['offset']);}return _0x937068['getSubjects'](_0x159500);}})[_0x6045('0x26')](function(_0x441793){if(_0x441793){return _0x441793?{'count':_0x44ca08,'rows':_0x441793}:null;}})['then'](respondWithResult(_0x2f991e,null))[_0x6045('0x47')](handleError(_0x2f991e,null));};exports[_0x6045('0x51')]=function(_0x3fac13,_0x1bd743,_0x55defd){var _0x4e0bc5={};var _0xfd6946={};var _0x4e5cbe;var _0x302ef0;return db[_0x6045('0x40')]['findOne']({'where':{'id':_0x3fac13[_0x6045('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1bd743,null))[_0x6045('0x26')](function(_0x5dab61){if(_0x5dab61){_0x4e5cbe=_0x5dab61;_0xfd6946[_0x6045('0x2f')]=_[_0x6045('0x31')](db[_0x6045('0x50')][_0x6045('0x2d')]);_0xfd6946[_0x6045('0x30')]=_[_0x6045('0x31')](_0x3fac13['query']);_0xfd6946['filters']=_['intersection'](_0xfd6946[_0x6045('0x2f')],_0xfd6946[_0x6045('0x30')]);_0x4e0bc5[_0x6045('0x33')]=_[_0x6045('0x44')](_0xfd6946[_0x6045('0x2f')],qs['fields'](_0x3fac13[_0x6045('0x30')][_0x6045('0x34')]));_0x4e0bc5[_0x6045('0x33')]=_0x4e0bc5[_0x6045('0x33')]['length']?_0x4e0bc5[_0x6045('0x33')]:_0xfd6946[_0x6045('0x2f')];_0x4e0bc5[_0x6045('0x38')]=qs[_0x6045('0x4c')](_0x3fac13['query'][_0x6045('0x4c')]);_0x4e0bc5[_0x6045('0x39')]=qs[_0x6045('0x32')](_['pick'](_0x3fac13['query'],_0xfd6946[_0x6045('0x32')]));if(_0x3fac13[_0x6045('0x30')][_0x6045('0x3a')]){_0x4e0bc5[_0x6045('0x39')]=_['merge'](_0x4e0bc5[_0x6045('0x39')],{'$or':_['map'](_0x4e0bc5[_0x6045('0x33')],function(_0x2ed454){var _0x24642c={};_0x24642c[_0x2ed454]={'$like':'%'+_0x3fac13['query'][_0x6045('0x3a')]+'%'};return _0x24642c;})});}_0x4e0bc5=_['merge']({},_0x4e0bc5,_0x3fac13[_0x6045('0x3d')]);return _0x4e5cbe['getDescriptions'](_0x4e0bc5);}})[_0x6045('0x26')](function(_0x30a18c){if(_0x30a18c){_0x302ef0=_0x30a18c[_0x6045('0x35')];if(!_0x3fac13[_0x6045('0x30')][_0x6045('0x36')](_0x6045('0x37'))){_0x4e0bc5['limit']=qs[_0x6045('0x1e')](_0x3fac13[_0x6045('0x30')][_0x6045('0x1e')]);_0x4e0bc5['offset']=qs[_0x6045('0x1c')](_0x3fac13[_0x6045('0x30')][_0x6045('0x1c')]);}return _0x4e5cbe[_0x6045('0x51')](_0x4e0bc5);}})['then'](function(_0x2f76e9){if(_0x2f76e9){return _0x2f76e9?{'count':_0x302ef0,'rows':_0x2f76e9}:null;}})['then'](respondWithResult(_0x1bd743,null))[_0x6045('0x47')](handleError(_0x1bd743,null));};exports[_0x6045('0x52')]=function(_0x475e88,_0x40922f,_0x480338){var _0x7d8f3f={};var _0x39720b={};var _0x4d560c;var _0x30a0f9;return db[_0x6045('0x40')][_0x6045('0x4f')]({'where':{'id':_0x475e88[_0x6045('0x4a')]['id']}})[_0x6045('0x26')](handleEntityNotFound(_0x40922f,null))[_0x6045('0x26')](function(_0x26fa4e){if(_0x26fa4e){_0x4d560c=_0x26fa4e;_0x39720b['model']=_['keys'](db[_0x6045('0x53')][_0x6045('0x2d')]);_0x39720b['query']=_[_0x6045('0x31')](_0x475e88[_0x6045('0x30')]);_0x39720b[_0x6045('0x32')]=_[_0x6045('0x44')](_0x39720b[_0x6045('0x2f')],_0x39720b[_0x6045('0x30')]);_0x7d8f3f[_0x6045('0x33')]=_[_0x6045('0x44')](_0x39720b['model'],qs[_0x6045('0x34')](_0x475e88['query']['fields']));_0x7d8f3f[_0x6045('0x33')]=_0x7d8f3f[_0x6045('0x33')]['length']?_0x7d8f3f['attributes']:_0x39720b[_0x6045('0x2f')];_0x7d8f3f['order']=qs[_0x6045('0x4c')](_0x475e88[_0x6045('0x30')][_0x6045('0x4c')]);_0x7d8f3f['where']=qs[_0x6045('0x32')](_[_0x6045('0x4d')](_0x475e88[_0x6045('0x30')],_0x39720b['filters']));if(_0x475e88[_0x6045('0x30')][_0x6045('0x3a')]){_0x7d8f3f['where']=_[_0x6045('0x3c')](_0x7d8f3f[_0x6045('0x39')],{'$or':_['map'](_0x7d8f3f[_0x6045('0x33')],function(_0x19f2f3){var _0x47795b={};_0x47795b[_0x19f2f3]={'$like':'%'+_0x475e88[_0x6045('0x30')][_0x6045('0x3a')]+'%'};return _0x47795b;})});}_0x7d8f3f=_[_0x6045('0x3c')]({},_0x7d8f3f,_0x475e88['options']);return _0x4d560c[_0x6045('0x52')](_0x7d8f3f);}})['then'](function(_0x3b77d7){if(_0x3b77d7){_0x30a0f9=_0x3b77d7[_0x6045('0x35')];if(!_0x475e88['query']['hasOwnProperty'](_0x6045('0x37'))){_0x7d8f3f['limit']=qs[_0x6045('0x1e')](_0x475e88[_0x6045('0x30')]['limit']);_0x7d8f3f[_0x6045('0x1c')]=qs[_0x6045('0x1c')](_0x475e88[_0x6045('0x30')]['offset']);}return _0x4d560c[_0x6045('0x52')](_0x7d8f3f);}})[_0x6045('0x26')](function(_0x388fa3){if(_0x388fa3){return _0x388fa3?{'count':_0x30a0f9,'rows':_0x388fa3}:null;}})['then'](respondWithResult(_0x40922f,null))['catch'](handleError(_0x40922f,null));};exports['setTags']=function(_0x210847,_0x5302e5,_0x34c2ce){if(_0x210847[_0x6045('0x46')]['id']){delete _0x210847[_0x6045('0x46')]['id'];}return db[_0x6045('0x40')][_0x6045('0x4f')]({'where':{'id':_0x210847[_0x6045('0x4a')]['id']}})[_0x6045('0x26')](handleEntityNotFound(_0x5302e5,null))['then'](function(_0x54b6d5){if(_0x54b6d5){return _0x54b6d5[_0x6045('0x54')](_0x210847[_0x6045('0x46')][_0x6045('0x55')]||[]);}return null;})[_0x6045('0x26')](respondWithResult(_0x5302e5,null))[_0x6045('0x47')](handleError(_0x5302e5,null));}; \ No newline at end of file +var _0xb403=['rows','params','include','find','catch','create','body','getFields','findOne','ZendeskField','rawAttributes','order','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','ZendeskConfiguration','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll'];(function(_0x23f58f,_0x5bb87c){var _0x139153=function(_0x3c9971){while(--_0x3c9971){_0x23f58f['push'](_0x23f58f['shift']());}};_0x139153(++_0x5bb87c);}(_0xb403,0x15e));var _0x3b40=function(_0x273517,_0x50b234){_0x273517=_0x273517-0x0;var _0x2c6334=_0xb403[_0x273517];return _0x2c6334;};'use strict';var emlformat=require(_0x3b40('0x0'));var rimraf=require(_0x3b40('0x1'));var zipdir=require(_0x3b40('0x2'));var jsonpatch=require(_0x3b40('0x3'));var rp=require(_0x3b40('0x4'));var moment=require(_0x3b40('0x5'));var BPromise=require(_0x3b40('0x6'));var Mustache=require(_0x3b40('0x7'));var util=require(_0x3b40('0x8'));var path=require('path');var sox=require(_0x3b40('0x9'));var csv=require(_0x3b40('0xa'));var ejs=require(_0x3b40('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3b40('0xc'));var crypto=require(_0x3b40('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3b40('0xa'));var querystring=require(_0x3b40('0xe'));var Papa=require(_0x3b40('0xf'));var Redis=require(_0x3b40('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3b40('0x11'));var as=require(_0x3b40('0x12'));var hardwareService=require(_0x3b40('0x13'));var logger=require(_0x3b40('0x14'))(_0x3b40('0x15'));var utils=require(_0x3b40('0x16'));var config=require(_0x3b40('0x17'));var licenseUtil=require(_0x3b40('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x542016,_0x2e207e){_0x2e207e=_0x2e207e||0xcc;return function(_0x33a0ec){if(_0x33a0ec){return _0x542016['sendStatus'](_0x2e207e);}return _0x542016[_0x3b40('0x19')](_0x2e207e)[_0x3b40('0x1a')]();};}function respondWithResult(_0x25dd5c,_0x558bc1){_0x558bc1=_0x558bc1||0xc8;return function(_0x44ee2f){if(_0x44ee2f){return _0x25dd5c[_0x3b40('0x19')](_0x558bc1)[_0x3b40('0x1b')](_0x44ee2f);}};}function respondWithFilteredResult(_0x58a962,_0x232f8b){return function(_0x106f75){if(_0x106f75){var _0x30cc14=typeof _0x232f8b[_0x3b40('0x1c')]===_0x3b40('0x1d')&&typeof _0x232f8b['limit']===_0x3b40('0x1d');var _0x37254d=_0x106f75[_0x3b40('0x1e')];var _0x1039e2=_0x30cc14?0x0:_0x232f8b[_0x3b40('0x1c')];var _0x479cca=_0x30cc14?_0x106f75[_0x3b40('0x1e')]:_0x232f8b['offset']+_0x232f8b[_0x3b40('0x1f')];var _0x48fac4;if(_0x479cca>=_0x37254d){_0x479cca=_0x37254d;_0x48fac4=0xc8;}else{_0x48fac4=0xce;}_0x58a962['status'](_0x48fac4);return _0x58a962[_0x3b40('0x20')](_0x3b40('0x21'),_0x1039e2+'-'+_0x479cca+'/'+_0x37254d)[_0x3b40('0x1b')](_0x106f75);}return null;};}function patchUpdates(_0x11781e){return function(_0x33b509){try{jsonpatch['apply'](_0x33b509,_0x11781e,!![]);}catch(_0x1b3e66){return BPromise[_0x3b40('0x22')](_0x1b3e66);}return _0x33b509[_0x3b40('0x23')]();};}function saveUpdates(_0x426471,_0x2d9a64){return function(_0x247a9c){if(_0x247a9c){return _0x247a9c[_0x3b40('0x24')](_0x426471)[_0x3b40('0x25')](function(_0x4d7f2f){return _0x4d7f2f;});}return null;};}function removeEntity(_0xbc24cc,_0x5a7089){return function(_0x25d1e4){if(_0x25d1e4){return _0x25d1e4[_0x3b40('0x26')]()[_0x3b40('0x25')](function(){_0xbc24cc['status'](0xcc)[_0x3b40('0x1a')]();});}};}function handleEntityNotFound(_0x420e45,_0x356b6b){return function(_0x48048b){if(!_0x48048b){_0x420e45['sendStatus'](0x194);}return _0x48048b;};}function handleError(_0x449ced,_0x59121d){_0x59121d=_0x59121d||0x1f4;return function(_0x41c33b){logger['error'](_0x41c33b[_0x3b40('0x27')]);if(_0x41c33b[_0x3b40('0x28')]){delete _0x41c33b[_0x3b40('0x28')];}_0x449ced['status'](_0x59121d)['send'](_0x41c33b);};}exports[_0x3b40('0x29')]=function(_0x4da1a9,_0x1bd8d5){var _0xb6e348={},_0x2814f2={},_0x4d6540={'count':0x0,'rows':[]};var _0xdfbcd5=_[_0x3b40('0x2a')](db[_0x3b40('0x2b')]['rawAttributes'],function(_0x2f5568){return{'name':_0x2f5568[_0x3b40('0x2c')],'type':_0x2f5568[_0x3b40('0x2d')][_0x3b40('0x2e')]};});_0x2814f2['model']=_[_0x3b40('0x2a')](_0xdfbcd5,'name');_0x2814f2[_0x3b40('0x2f')]=_[_0x3b40('0x30')](_0x4da1a9[_0x3b40('0x2f')]);_0x2814f2['filters']=_[_0x3b40('0x31')](_0x2814f2[_0x3b40('0x32')],_0x2814f2[_0x3b40('0x2f')]);_0xb6e348[_0x3b40('0x33')]=_[_0x3b40('0x31')](_0x2814f2[_0x3b40('0x32')],qs[_0x3b40('0x34')](_0x4da1a9[_0x3b40('0x2f')][_0x3b40('0x34')]));_0xb6e348[_0x3b40('0x33')]=_0xb6e348[_0x3b40('0x33')][_0x3b40('0x35')]?_0xb6e348[_0x3b40('0x33')]:_0x2814f2[_0x3b40('0x32')];if(!_0x4da1a9['query']['hasOwnProperty'](_0x3b40('0x36'))){_0xb6e348[_0x3b40('0x1f')]=qs[_0x3b40('0x1f')](_0x4da1a9[_0x3b40('0x2f')]['limit']);_0xb6e348[_0x3b40('0x1c')]=qs[_0x3b40('0x1c')](_0x4da1a9[_0x3b40('0x2f')][_0x3b40('0x1c')]);}_0xb6e348['order']=qs['sort'](_0x4da1a9[_0x3b40('0x2f')][_0x3b40('0x37')]);_0xb6e348['where']=qs[_0x3b40('0x38')](_[_0x3b40('0x39')](_0x4da1a9[_0x3b40('0x2f')],_0x2814f2[_0x3b40('0x38')]),_0xdfbcd5);if(_0x4da1a9[_0x3b40('0x2f')]['filter']){_0xb6e348[_0x3b40('0x3a')]=_['merge'](_0xb6e348[_0x3b40('0x3a')],{'$or':_[_0x3b40('0x2a')](_0xdfbcd5,function(_0x39abed){if(_0x39abed['type']!==_0x3b40('0x3b')){var _0x59a0ee={};_0x59a0ee[_0x39abed['name']]={'$like':'%'+_0x4da1a9[_0x3b40('0x2f')][_0x3b40('0x3c')]+'%'};return _0x59a0ee;}})});}_0xb6e348=_[_0x3b40('0x3d')]({},_0xb6e348,_0x4da1a9[_0x3b40('0x3e')]);var _0x140d1c={'where':_0xb6e348[_0x3b40('0x3a')]};return db['ZendeskConfiguration'][_0x3b40('0x1e')](_0x140d1c)[_0x3b40('0x25')](function(_0x37e0fb){_0x4d6540[_0x3b40('0x1e')]=_0x37e0fb;if(_0x4da1a9[_0x3b40('0x2f')][_0x3b40('0x3f')]){_0xb6e348['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x3b40('0x40')](_0xb6e348);})[_0x3b40('0x25')](function(_0x548a04){_0x4d6540[_0x3b40('0x41')]=_0x548a04;return _0x4d6540;})['then'](respondWithFilteredResult(_0x1bd8d5,_0xb6e348))['catch'](handleError(_0x1bd8d5,null));};exports['show']=function(_0x37a9e7,_0x49b4d4){var _0x3823cd={'raw':![],'where':{'id':_0x37a9e7[_0x3b40('0x42')]['id']}},_0x4f8eb8={};_0x4f8eb8[_0x3b40('0x32')]=_[_0x3b40('0x30')](db[_0x3b40('0x2b')]['rawAttributes']);_0x4f8eb8['query']=_[_0x3b40('0x30')](_0x37a9e7[_0x3b40('0x2f')]);_0x4f8eb8[_0x3b40('0x38')]=_['intersection'](_0x4f8eb8[_0x3b40('0x32')],_0x4f8eb8[_0x3b40('0x2f')]);_0x3823cd[_0x3b40('0x33')]=_[_0x3b40('0x31')](_0x4f8eb8[_0x3b40('0x32')],qs[_0x3b40('0x34')](_0x37a9e7['query'][_0x3b40('0x34')]));_0x3823cd[_0x3b40('0x33')]=_0x3823cd['attributes'][_0x3b40('0x35')]?_0x3823cd[_0x3b40('0x33')]:_0x4f8eb8[_0x3b40('0x32')];if(_0x37a9e7[_0x3b40('0x2f')][_0x3b40('0x3f')]){_0x3823cd[_0x3b40('0x43')]=[{'all':!![]}];}_0x3823cd=_[_0x3b40('0x3d')]({},_0x3823cd,_0x37a9e7[_0x3b40('0x3e')]);return db[_0x3b40('0x2b')][_0x3b40('0x44')](_0x3823cd)[_0x3b40('0x25')](handleEntityNotFound(_0x49b4d4,null))[_0x3b40('0x25')](respondWithResult(_0x49b4d4,null))[_0x3b40('0x45')](handleError(_0x49b4d4,null));};exports[_0x3b40('0x46')]=function(_0x23f3c0,_0x1b7823){return db['ZendeskConfiguration']['create'](_0x23f3c0[_0x3b40('0x47')],{})[_0x3b40('0x25')](respondWithResult(_0x1b7823,0xc9))[_0x3b40('0x45')](handleError(_0x1b7823,null));};exports[_0x3b40('0x24')]=function(_0x564190,_0x51c158){if(_0x564190[_0x3b40('0x47')]['id']){delete _0x564190[_0x3b40('0x47')]['id'];}return db[_0x3b40('0x2b')][_0x3b40('0x44')]({'where':{'id':_0x564190['params']['id']}})['then'](handleEntityNotFound(_0x51c158,null))[_0x3b40('0x25')](saveUpdates(_0x564190[_0x3b40('0x47')],null))['then'](respondWithResult(_0x51c158,null))[_0x3b40('0x45')](handleError(_0x51c158,null));};exports[_0x3b40('0x26')]=function(_0x5f04ad,_0x316471){return db[_0x3b40('0x2b')]['find']({'where':{'id':_0x5f04ad['params']['id']}})['then'](handleEntityNotFound(_0x316471,null))[_0x3b40('0x25')](removeEntity(_0x316471,null))['catch'](handleError(_0x316471,null));};exports[_0x3b40('0x48')]=function(_0x41d3fd,_0x5ec61f,_0x3dc792){var _0x47d976={};var _0x2d158e={};var _0x5497c2;var _0xdfb150;return db[_0x3b40('0x2b')][_0x3b40('0x49')]({'where':{'id':_0x41d3fd[_0x3b40('0x42')]['id']}})[_0x3b40('0x25')](handleEntityNotFound(_0x5ec61f,null))['then'](function(_0x1d768b){if(_0x1d768b){_0x5497c2=_0x1d768b;_0x2d158e[_0x3b40('0x32')]=_[_0x3b40('0x30')](db[_0x3b40('0x4a')][_0x3b40('0x4b')]);_0x2d158e['query']=_[_0x3b40('0x30')](_0x41d3fd['query']);_0x2d158e[_0x3b40('0x38')]=_['intersection'](_0x2d158e[_0x3b40('0x32')],_0x2d158e[_0x3b40('0x2f')]);_0x47d976[_0x3b40('0x33')]=_['intersection'](_0x2d158e[_0x3b40('0x32')],qs[_0x3b40('0x34')](_0x41d3fd['query']['fields']));_0x47d976[_0x3b40('0x33')]=_0x47d976[_0x3b40('0x33')]['length']?_0x47d976[_0x3b40('0x33')]:_0x2d158e[_0x3b40('0x32')];_0x47d976[_0x3b40('0x4c')]=qs[_0x3b40('0x37')](_0x41d3fd[_0x3b40('0x2f')][_0x3b40('0x37')]);_0x47d976[_0x3b40('0x3a')]=qs[_0x3b40('0x38')](_['pick'](_0x41d3fd[_0x3b40('0x2f')],_0x2d158e['filters']));if(_0x41d3fd[_0x3b40('0x2f')][_0x3b40('0x3c')]){_0x47d976['where']=_['merge'](_0x47d976['where'],{'$or':_['map'](_0x47d976[_0x3b40('0x33')],function(_0x36738a){var _0x438a72={};_0x438a72[_0x36738a]={'$like':'%'+_0x41d3fd[_0x3b40('0x2f')][_0x3b40('0x3c')]+'%'};return _0x438a72;})});}_0x47d976=_[_0x3b40('0x3d')]({},_0x47d976,_0x41d3fd[_0x3b40('0x3e')]);return _0x5497c2['getFields'](_0x47d976);}})['then'](function(_0x4479b6){if(_0x4479b6){_0xdfb150=_0x4479b6[_0x3b40('0x35')];if(!_0x41d3fd[_0x3b40('0x2f')][_0x3b40('0x4d')]('nolimit')){_0x47d976[_0x3b40('0x1f')]=qs[_0x3b40('0x1f')](_0x41d3fd[_0x3b40('0x2f')][_0x3b40('0x1f')]);_0x47d976[_0x3b40('0x1c')]=qs[_0x3b40('0x1c')](_0x41d3fd[_0x3b40('0x2f')][_0x3b40('0x1c')]);}return _0x5497c2['getFields'](_0x47d976);}})[_0x3b40('0x25')](function(_0x17aa97){if(_0x17aa97){return _0x17aa97?{'count':_0xdfb150,'rows':_0x17aa97}:null;}})[_0x3b40('0x25')](respondWithResult(_0x5ec61f,null))[_0x3b40('0x45')](handleError(_0x5ec61f,null));};exports[_0x3b40('0x4e')]=function(_0x41df0d,_0x3c03ad,_0x3af9eb){var _0x365e95={};var _0x1b76e3={};var _0x4b9bc5;var _0x41412f;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x41df0d[_0x3b40('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c03ad,null))['then'](function(_0x44a8e8){if(_0x44a8e8){_0x4b9bc5=_0x44a8e8;_0x1b76e3[_0x3b40('0x32')]=_['keys'](db[_0x3b40('0x4a')][_0x3b40('0x4b')]);_0x1b76e3[_0x3b40('0x2f')]=_[_0x3b40('0x30')](_0x41df0d['query']);_0x1b76e3[_0x3b40('0x38')]=_['intersection'](_0x1b76e3[_0x3b40('0x32')],_0x1b76e3[_0x3b40('0x2f')]);_0x365e95[_0x3b40('0x33')]=_[_0x3b40('0x31')](_0x1b76e3[_0x3b40('0x32')],qs[_0x3b40('0x34')](_0x41df0d['query'][_0x3b40('0x34')]));_0x365e95[_0x3b40('0x33')]=_0x365e95[_0x3b40('0x33')][_0x3b40('0x35')]?_0x365e95['attributes']:_0x1b76e3[_0x3b40('0x32')];_0x365e95[_0x3b40('0x4c')]=qs[_0x3b40('0x37')](_0x41df0d['query'][_0x3b40('0x37')]);_0x365e95['where']=qs[_0x3b40('0x38')](_['pick'](_0x41df0d[_0x3b40('0x2f')],_0x1b76e3[_0x3b40('0x38')]));if(_0x41df0d['query'][_0x3b40('0x3c')]){_0x365e95[_0x3b40('0x3a')]=_[_0x3b40('0x3d')](_0x365e95[_0x3b40('0x3a')],{'$or':_[_0x3b40('0x2a')](_0x365e95['attributes'],function(_0x1a4fa9){var _0x3b75c8={};_0x3b75c8[_0x1a4fa9]={'$like':'%'+_0x41df0d[_0x3b40('0x2f')][_0x3b40('0x3c')]+'%'};return _0x3b75c8;})});}_0x365e95=_[_0x3b40('0x3d')]({},_0x365e95,_0x41df0d['options']);return _0x4b9bc5['getSubjects'](_0x365e95);}})[_0x3b40('0x25')](function(_0x2e9160){if(_0x2e9160){_0x41412f=_0x2e9160['length'];if(!_0x41df0d['query'][_0x3b40('0x4d')]('nolimit')){_0x365e95[_0x3b40('0x1f')]=qs['limit'](_0x41df0d[_0x3b40('0x2f')]['limit']);_0x365e95[_0x3b40('0x1c')]=qs['offset'](_0x41df0d[_0x3b40('0x2f')][_0x3b40('0x1c')]);}return _0x4b9bc5[_0x3b40('0x4e')](_0x365e95);}})[_0x3b40('0x25')](function(_0x184f9e){if(_0x184f9e){return _0x184f9e?{'count':_0x41412f,'rows':_0x184f9e}:null;}})[_0x3b40('0x25')](respondWithResult(_0x3c03ad,null))['catch'](handleError(_0x3c03ad,null));};exports[_0x3b40('0x4f')]=function(_0x3e5be5,_0x5378bb,_0x5b467a){var _0x135d31={};var _0x35e218={};var _0x435a2a;var _0x2f80bf;return db[_0x3b40('0x2b')][_0x3b40('0x49')]({'where':{'id':_0x3e5be5[_0x3b40('0x42')]['id']}})[_0x3b40('0x25')](handleEntityNotFound(_0x5378bb,null))['then'](function(_0x482458){if(_0x482458){_0x435a2a=_0x482458;_0x35e218[_0x3b40('0x32')]=_[_0x3b40('0x30')](db[_0x3b40('0x4a')][_0x3b40('0x4b')]);_0x35e218[_0x3b40('0x2f')]=_['keys'](_0x3e5be5[_0x3b40('0x2f')]);_0x35e218[_0x3b40('0x38')]=_[_0x3b40('0x31')](_0x35e218[_0x3b40('0x32')],_0x35e218[_0x3b40('0x2f')]);_0x135d31[_0x3b40('0x33')]=_[_0x3b40('0x31')](_0x35e218['model'],qs['fields'](_0x3e5be5['query'][_0x3b40('0x34')]));_0x135d31[_0x3b40('0x33')]=_0x135d31[_0x3b40('0x33')][_0x3b40('0x35')]?_0x135d31[_0x3b40('0x33')]:_0x35e218[_0x3b40('0x32')];_0x135d31[_0x3b40('0x4c')]=qs[_0x3b40('0x37')](_0x3e5be5[_0x3b40('0x2f')][_0x3b40('0x37')]);_0x135d31[_0x3b40('0x3a')]=qs[_0x3b40('0x38')](_[_0x3b40('0x39')](_0x3e5be5[_0x3b40('0x2f')],_0x35e218[_0x3b40('0x38')]));if(_0x3e5be5[_0x3b40('0x2f')][_0x3b40('0x3c')]){_0x135d31[_0x3b40('0x3a')]=_[_0x3b40('0x3d')](_0x135d31['where'],{'$or':_[_0x3b40('0x2a')](_0x135d31['attributes'],function(_0x4cc8ac){var _0x73b36b={};_0x73b36b[_0x4cc8ac]={'$like':'%'+_0x3e5be5['query'][_0x3b40('0x3c')]+'%'};return _0x73b36b;})});}_0x135d31=_[_0x3b40('0x3d')]({},_0x135d31,_0x3e5be5['options']);return _0x435a2a[_0x3b40('0x4f')](_0x135d31);}})[_0x3b40('0x25')](function(_0x3254a4){if(_0x3254a4){_0x2f80bf=_0x3254a4['length'];if(!_0x3e5be5['query'][_0x3b40('0x4d')](_0x3b40('0x36'))){_0x135d31[_0x3b40('0x1f')]=qs[_0x3b40('0x1f')](_0x3e5be5[_0x3b40('0x2f')]['limit']);_0x135d31[_0x3b40('0x1c')]=qs[_0x3b40('0x1c')](_0x3e5be5[_0x3b40('0x2f')][_0x3b40('0x1c')]);}return _0x435a2a['getDescriptions'](_0x135d31);}})[_0x3b40('0x25')](function(_0x3e15d7){if(_0x3e15d7){return _0x3e15d7?{'count':_0x2f80bf,'rows':_0x3e15d7}:null;}})[_0x3b40('0x25')](respondWithResult(_0x5378bb,null))[_0x3b40('0x45')](handleError(_0x5378bb,null));};exports['getTags']=function(_0x21dac6,_0x563b87,_0xb47bf3){var _0x1b4954={};var _0xc862c={};var _0x350f9c;var _0x20a022;return db['ZendeskConfiguration'][_0x3b40('0x49')]({'where':{'id':_0x21dac6[_0x3b40('0x42')]['id']}})[_0x3b40('0x25')](handleEntityNotFound(_0x563b87,null))[_0x3b40('0x25')](function(_0x64101){if(_0x64101){_0x350f9c=_0x64101;_0xc862c['model']=_[_0x3b40('0x30')](db[_0x3b40('0x50')][_0x3b40('0x4b')]);_0xc862c[_0x3b40('0x2f')]=_[_0x3b40('0x30')](_0x21dac6[_0x3b40('0x2f')]);_0xc862c[_0x3b40('0x38')]=_[_0x3b40('0x31')](_0xc862c[_0x3b40('0x32')],_0xc862c[_0x3b40('0x2f')]);_0x1b4954[_0x3b40('0x33')]=_[_0x3b40('0x31')](_0xc862c[_0x3b40('0x32')],qs[_0x3b40('0x34')](_0x21dac6['query'][_0x3b40('0x34')]));_0x1b4954[_0x3b40('0x33')]=_0x1b4954[_0x3b40('0x33')][_0x3b40('0x35')]?_0x1b4954[_0x3b40('0x33')]:_0xc862c[_0x3b40('0x32')];_0x1b4954['order']=qs[_0x3b40('0x37')](_0x21dac6['query'][_0x3b40('0x37')]);_0x1b4954[_0x3b40('0x3a')]=qs[_0x3b40('0x38')](_[_0x3b40('0x39')](_0x21dac6[_0x3b40('0x2f')],_0xc862c['filters']));if(_0x21dac6['query'][_0x3b40('0x3c')]){_0x1b4954['where']=_[_0x3b40('0x3d')](_0x1b4954[_0x3b40('0x3a')],{'$or':_[_0x3b40('0x2a')](_0x1b4954[_0x3b40('0x33')],function(_0x392a6d){var _0x45fffd={};_0x45fffd[_0x392a6d]={'$like':'%'+_0x21dac6['query'][_0x3b40('0x3c')]+'%'};return _0x45fffd;})});}_0x1b4954=_[_0x3b40('0x3d')]({},_0x1b4954,_0x21dac6[_0x3b40('0x3e')]);return _0x350f9c[_0x3b40('0x51')](_0x1b4954);}})[_0x3b40('0x25')](function(_0x255a43){if(_0x255a43){_0x20a022=_0x255a43[_0x3b40('0x35')];if(!_0x21dac6['query'][_0x3b40('0x4d')]('nolimit')){_0x1b4954['limit']=qs[_0x3b40('0x1f')](_0x21dac6['query'][_0x3b40('0x1f')]);_0x1b4954[_0x3b40('0x1c')]=qs[_0x3b40('0x1c')](_0x21dac6['query']['offset']);}return _0x350f9c[_0x3b40('0x51')](_0x1b4954);}})['then'](function(_0x2ae3dc){if(_0x2ae3dc){return _0x2ae3dc?{'count':_0x20a022,'rows':_0x2ae3dc}:null;}})[_0x3b40('0x25')](respondWithResult(_0x563b87,null))['catch'](handleError(_0x563b87,null));};exports[_0x3b40('0x52')]=function(_0x28a99b,_0x1c355f,_0x475185){if(_0x28a99b[_0x3b40('0x47')]['id']){delete _0x28a99b[_0x3b40('0x47')]['id'];}return db['ZendeskConfiguration'][_0x3b40('0x49')]({'where':{'id':_0x28a99b[_0x3b40('0x42')]['id']}})[_0x3b40('0x25')](handleEntityNotFound(_0x1c355f,null))[_0x3b40('0x25')](function(_0x2bc3f4){if(_0x2bc3f4){return _0x2bc3f4[_0x3b40('0x52')](_0x28a99b['body']['ids']||[]);}return null;})[_0x3b40('0x25')](respondWithResult(_0x1c355f,null))[_0x3b40('0x45')](handleError(_0x1c355f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index b291231..cb2e07d 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 _0x0abf=['define','int_zendesk_configurations','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports'];(function(_0x462ef1,_0x470651){var _0x4b3ad2=function(_0x5a5942){while(--_0x5a5942){_0x462ef1['push'](_0x462ef1['shift']());}};_0x4b3ad2(++_0x470651);}(_0x0abf,0xe8));var _0xf0ab=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0abf[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var logger=require(_0xf0ab('0x1'))(_0xf0ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf0ab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var attributes=require(_0xf0ab('0x6'));module[_0xf0ab('0x7')]=function(_0x2ab7d6,_0x4d2ea8){return _0x2ab7d6[_0xf0ab('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0xf0ab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb574=['./intZendeskConfiguration.attributes','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xe0b135,_0x3aa9df){var _0xd4bf72=function(_0x47db37){while(--_0x47db37){_0xe0b135['push'](_0xe0b135['shift']());}};_0xd4bf72(++_0x3aa9df);}(_0xb574,0x106));var _0x4b57=function(_0x8bd8bd,_0x44a177){_0x8bd8bd=_0x8bd8bd-0x0;var _0x1ef722=_0xb574[_0x8bd8bd];return _0x1ef722;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var logger=require('../../config/logger')(_0x4b57('0x2'));var moment=require(_0x4b57('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b57('0x4'));var fs=require('fs');var path=require(_0x4b57('0x5'));var rimraf=require(_0x4b57('0x6'));var config=require(_0x4b57('0x7'));var attributes=require(_0x4b57('0x8'));module['exports']=function(_0x4eb019,_0x1c97e5){return _0x4eb019['define']('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','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 04c6b74..0688a15 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 _0xa941=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0xa941,0x15e));var _0x1a94=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa941[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x1a94('0x0'));var moment=require(_0x1a94('0x1'));var BPromise=require(_0x1a94('0x2'));var rs=require(_0x1a94('0x3'));var fs=require('fs');var Redis=require(_0x1a94('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a94('0x5'));var config=require(_0x1a94('0x6'));var jayson=require(_0x1a94('0x7'));var client=jayson[_0x1a94('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x144396,_0x46c7cb,_0x571c96){return new BPromise(function(_0xf221fc,_0x3b2f50){return client[_0x1a94('0x9')](_0x144396,_0x571c96)['then'](function(_0xa6e7c8){logger['info'](_0x1a94('0xa'),_0x46c7cb,_0x1a94('0xb'));logger[_0x1a94('0xc')](_0x1a94('0xd'),_0x46c7cb,'request\x20sent',JSON[_0x1a94('0xe')](_0xa6e7c8));if(_0xa6e7c8[_0x1a94('0xf')]){if(_0xa6e7c8[_0x1a94('0xf')]['code']===0x1f4){logger['error'](_0x1a94('0xa'),_0x46c7cb,_0xa6e7c8[_0x1a94('0xf')][_0x1a94('0x10')]);return _0x3b2f50(_0xa6e7c8['error'][_0x1a94('0x10')]);}logger[_0x1a94('0xf')](_0x1a94('0xa'),_0x46c7cb,_0xa6e7c8[_0x1a94('0xf')]['message']);return _0xf221fc(_0xa6e7c8[_0x1a94('0xf')][_0x1a94('0x10')]);}else{logger[_0x1a94('0x11')](_0x1a94('0xa'),_0x46c7cb,'request\x20sent');_0xf221fc(_0xa6e7c8['result']['message']);}})['catch'](function(_0x41a314){logger['error'](_0x1a94('0xa'),_0x46c7cb,_0x41a314);_0x3b2f50(_0x41a314);});});} \ No newline at end of file +var _0x6ed7=['stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x52dacb,_0x3e6fa4){var _0x505aaf=function(_0x44af63){while(--_0x44af63){_0x52dacb['push'](_0x52dacb['shift']());}};_0x505aaf(++_0x3e6fa4);}(_0x6ed7,0x1bf));var _0x76ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ed7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x76ed('0x0'));var util=require(_0x76ed('0x1'));var moment=require(_0x76ed('0x2'));var BPromise=require(_0x76ed('0x3'));var rs=require(_0x76ed('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76ed('0x5'))['db'];var utils=require(_0x76ed('0x6'));var logger=require(_0x76ed('0x7'))(_0x76ed('0x8'));var config=require('../../config/environment');var jayson=require(_0x76ed('0x9'));var client=jayson[_0x76ed('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55019,_0x3b63a6,_0x2f1440){return new BPromise(function(_0x3adf8d,_0x492e9e){return client['request'](_0x55019,_0x2f1440)['then'](function(_0x8523ba){logger['info'](_0x76ed('0xb'),_0x3b63a6,_0x76ed('0xc'));logger[_0x76ed('0xd')](_0x76ed('0xe'),_0x3b63a6,_0x76ed('0xc'),JSON[_0x76ed('0xf')](_0x8523ba));if(_0x8523ba[_0x76ed('0x10')]){if(_0x8523ba[_0x76ed('0x10')][_0x76ed('0x11')]===0x1f4){logger['error'](_0x76ed('0xb'),_0x3b63a6,_0x8523ba[_0x76ed('0x10')][_0x76ed('0x12')]);return _0x492e9e(_0x8523ba[_0x76ed('0x10')][_0x76ed('0x12')]);}logger[_0x76ed('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3b63a6,_0x8523ba[_0x76ed('0x10')]['message']);return _0x3adf8d(_0x8523ba[_0x76ed('0x10')]['message']);}else{logger[_0x76ed('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3b63a6,_0x76ed('0xc'));_0x3adf8d(_0x8523ba[_0x76ed('0x14')]['message']);}})['catch'](function(_0x1044a3){logger[_0x76ed('0x10')](_0x76ed('0xb'),_0x3b63a6,_0x1044a3);_0x492e9e(_0x1044a3);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index f1b70bb..c46f717 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 _0x8a8f=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','put','/:id','delete','destroy','exports','multer'];(function(_0x508bd3,_0x42c604){var _0x130d13=function(_0x2d3804){while(--_0x2d3804){_0x508bd3['push'](_0x508bd3['shift']());}};_0x130d13(++_0x42c604);}(_0x8a8f,0x1b1));var _0xf8a8=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x8a8f[_0x11c573];return _0x6b72de;};'use strict';var multer=require(_0xf8a8('0x0'));var util=require('util');var path=require(_0xf8a8('0x1'));var timeout=require(_0xf8a8('0x2'));var express=require('express');var router=express[_0xf8a8('0x3')]();var fs_extra=require(_0xf8a8('0x4'));var auth=require(_0xf8a8('0x5'));var interaction=require(_0xf8a8('0x6'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0xf8a8('0x7')]('/',auth[_0xf8a8('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf8a8('0x9')](_0xf8a8('0xa'),auth[_0xf8a8('0x8')](),controller['update']);router[_0xf8a8('0xb')](_0xf8a8('0xa'),auth['isAuthenticated'](),controller[_0xf8a8('0xc')]);module[_0xf8a8('0xd')]=router; \ No newline at end of file +var _0xc458=['destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x5b9f5d,_0x142778){var _0x555e11=function(_0x2da12d){while(--_0x2da12d){_0x5b9f5d['push'](_0x5b9f5d['shift']());}};_0x555e11(++_0x142778);}(_0xc458,0x66));var _0x8c45=function(_0x1ae971,_0x2cdfc8){_0x1ae971=_0x1ae971-0x0;var _0x4b0b9d=_0xc458[_0x1ae971];return _0x4b0b9d;};'use strict';var multer=require('multer');var util=require(_0x8c45('0x0'));var path=require(_0x8c45('0x1'));var timeout=require(_0x8c45('0x2'));var express=require(_0x8c45('0x3'));var router=express['Router']();var fs_extra=require(_0x8c45('0x4'));var auth=require(_0x8c45('0x5'));var interaction=require(_0x8c45('0x6'));var config=require(_0x8c45('0x7'));var controller=require(_0x8c45('0x8'));router[_0x8c45('0x9')]('/',auth['isAuthenticated'](),controller[_0x8c45('0xa')]);router[_0x8c45('0x9')](_0x8c45('0xb'),auth[_0x8c45('0xc')](),controller[_0x8c45('0xd')]);router[_0x8c45('0xe')]('/',auth[_0x8c45('0xc')](),controller['create']);router[_0x8c45('0xf')](_0x8c45('0xb'),auth[_0x8c45('0xc')](),controller[_0x8c45('0x10')]);router[_0x8c45('0x11')](_0x8c45('0xb'),auth['isAuthenticated'](),controller[_0x8c45('0x12')]);module[_0x8c45('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 8839063..b7fb36e 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 _0x8392=['BOOLEAN','sequelize','customVariable','keyValue','picklist','string','STRING','ENUM'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x8392,0x171));var _0x2839=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8392[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x2839('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x2839('0x1'),_0x2839('0x2'),_0x2839('0x3')),'defaultValue':_0x2839('0x4')},'content':{'type':Sequelize[_0x2839('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2839('0x6')]('string','variable',_0x2839('0x1'))},'keyContent':{'type':Sequelize[_0x2839('0x5')]},'idField':{'type':Sequelize[_0x2839('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2839('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7282=['string','STRING','BOOLEAN','exports','ENUM','variable'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x7282,0x87));var _0x2728=function(_0x44b249,_0x5b4811){_0x44b249=_0x44b249-0x0;var _0x23b853=_0x7282[_0x44b249];return _0x23b853;};'use strict';var Sequelize=require('sequelize');module[_0x2728('0x0')]={'type':{'type':Sequelize[_0x2728('0x1')]('string',_0x2728('0x2'),'customVariable','keyValue','picklist'),'defaultValue':_0x2728('0x3')},'content':{'type':Sequelize[_0x2728('0x4')]},'key':{'type':Sequelize[_0x2728('0x4')]},'keyType':{'type':Sequelize[_0x2728('0x1')]('string',_0x2728('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x2728('0x4')]},'idField':{'type':Sequelize[_0x2728('0x4')]},'nameField':{'type':Sequelize[_0x2728('0x4')]},'customField':{'type':Sequelize[_0x2728('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2728('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index eda7391..e5dc9bd 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 _0x78f0=['apply','reject','save','update','then','error','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','length','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set'];(function(_0x2a5658,_0xc977f5){var _0x1a6b67=function(_0x86bc98){while(--_0x86bc98){_0x2a5658['push'](_0x2a5658['shift']());}};_0x1a6b67(++_0xc977f5);}(_0x78f0,0x15d));var _0x078f=function(_0x1334c9,_0x5aa760){_0x1334c9=_0x1334c9-0x0;var _0x547d36=_0x78f0[_0x1334c9];return _0x547d36;};'use strict';var emlformat=require(_0x078f('0x0'));var rimraf=require(_0x078f('0x1'));var zipdir=require(_0x078f('0x2'));var jsonpatch=require(_0x078f('0x3'));var rp=require(_0x078f('0x4'));var moment=require(_0x078f('0x5'));var BPromise=require(_0x078f('0x6'));var Mustache=require(_0x078f('0x7'));var util=require('util');var path=require(_0x078f('0x8'));var sox=require(_0x078f('0x9'));var csv=require(_0x078f('0xa'));var ejs=require(_0x078f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x078f('0xc'));var squel=require(_0x078f('0xd'));var crypto=require('crypto');var jsforce=require(_0x078f('0xe'));var deskjs=require(_0x078f('0xf'));var toCsv=require(_0x078f('0xa'));var querystring=require(_0x078f('0x10'));var Papa=require(_0x078f('0x11'));var Redis=require(_0x078f('0x12'));var authService=require(_0x078f('0x13'));var qs=require(_0x078f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x078f('0x15'));var logger=require(_0x078f('0x16'))('api');var utils=require(_0x078f('0x17'));var config=require(_0x078f('0x18'));var licenseUtil=require(_0x078f('0x19'));var db=require(_0x078f('0x1a'))['db'];function respondWithStatusCode(_0x5b6b5a,_0x5de876){_0x5de876=_0x5de876||0xcc;return function(_0xe740c0){if(_0xe740c0){return _0x5b6b5a[_0x078f('0x1b')](_0x5de876);}return _0x5b6b5a[_0x078f('0x1c')](_0x5de876)[_0x078f('0x1d')]();};}function respondWithResult(_0x5df646,_0x36670d){_0x36670d=_0x36670d||0xc8;return function(_0x2d29f8){if(_0x2d29f8){return _0x5df646['status'](_0x36670d)[_0x078f('0x1e')](_0x2d29f8);}};}function respondWithFilteredResult(_0x1a44f1,_0x21fc72){return function(_0x363dfd){if(_0x363dfd){var _0x247de9=typeof _0x21fc72[_0x078f('0x1f')]==='undefined'&&typeof _0x21fc72['limit']===_0x078f('0x20');var _0x1e32c0=_0x363dfd[_0x078f('0x21')];var _0x19a182=_0x247de9?0x0:_0x21fc72[_0x078f('0x1f')];var _0x25bb2d=_0x247de9?_0x363dfd[_0x078f('0x21')]:_0x21fc72[_0x078f('0x1f')]+_0x21fc72[_0x078f('0x22')];var _0x276442;if(_0x25bb2d>=_0x1e32c0){_0x25bb2d=_0x1e32c0;_0x276442=0xc8;}else{_0x276442=0xce;}_0x1a44f1[_0x078f('0x1c')](_0x276442);return _0x1a44f1[_0x078f('0x23')]('Content-Range',_0x19a182+'-'+_0x25bb2d+'/'+_0x1e32c0)[_0x078f('0x1e')](_0x363dfd);}return null;};}function patchUpdates(_0x52c74f){return function(_0x567d26){try{jsonpatch[_0x078f('0x24')](_0x567d26,_0x52c74f,!![]);}catch(_0x3c70c2){return BPromise[_0x078f('0x25')](_0x3c70c2);}return _0x567d26[_0x078f('0x26')]();};}function saveUpdates(_0x712d52,_0x2c6db4){return function(_0x104eeb){if(_0x104eeb){return _0x104eeb[_0x078f('0x27')](_0x712d52)[_0x078f('0x28')](function(_0x4b8d12){return _0x4b8d12;});}return null;};}function removeEntity(_0x1f6b98,_0x14ad5c){return function(_0x363cce){if(_0x363cce){return _0x363cce['destroy']()['then'](function(){_0x1f6b98[_0x078f('0x1c')](0xcc)[_0x078f('0x1d')]();});}};}function handleEntityNotFound(_0x3d9d08,_0x240fb4){return function(_0x25fe4f){if(!_0x25fe4f){_0x3d9d08[_0x078f('0x1b')](0x194);}return _0x25fe4f;};}function handleError(_0x186fe3,_0x4e738b){_0x4e738b=_0x4e738b||0x1f4;return function(_0x1f6596){logger[_0x078f('0x29')](_0x1f6596['stack']);if(_0x1f6596[_0x078f('0x2a')]){delete _0x1f6596[_0x078f('0x2a')];}_0x186fe3[_0x078f('0x1c')](_0x4e738b)[_0x078f('0x2b')](_0x1f6596);};}exports[_0x078f('0x2c')]=function(_0xd57307,_0x1a8530){var _0xe41e2e={},_0x1f0ad6={},_0x29d306={'count':0x0,'rows':[]};var _0x3dcd96=_[_0x078f('0x2d')](db[_0x078f('0x2e')][_0x078f('0x2f')],function(_0x2ff6e6){return{'name':_0x2ff6e6[_0x078f('0x30')],'type':_0x2ff6e6[_0x078f('0x31')][_0x078f('0x32')]};});_0x1f0ad6['model']=_[_0x078f('0x2d')](_0x3dcd96,'name');_0x1f0ad6['query']=_[_0x078f('0x33')](_0xd57307[_0x078f('0x34')]);_0x1f0ad6[_0x078f('0x35')]=_[_0x078f('0x36')](_0x1f0ad6['model'],_0x1f0ad6[_0x078f('0x34')]);_0xe41e2e[_0x078f('0x37')]=_[_0x078f('0x36')](_0x1f0ad6[_0x078f('0x38')],qs[_0x078f('0x39')](_0xd57307['query'][_0x078f('0x39')]));_0xe41e2e[_0x078f('0x37')]=_0xe41e2e['attributes']['length']?_0xe41e2e[_0x078f('0x37')]:_0x1f0ad6[_0x078f('0x38')];if(!_0xd57307['query'][_0x078f('0x3a')](_0x078f('0x3b'))){_0xe41e2e[_0x078f('0x22')]=qs['limit'](_0xd57307[_0x078f('0x34')][_0x078f('0x22')]);_0xe41e2e[_0x078f('0x1f')]=qs[_0x078f('0x1f')](_0xd57307[_0x078f('0x34')][_0x078f('0x1f')]);}_0xe41e2e['order']=qs[_0x078f('0x3c')](_0xd57307[_0x078f('0x34')][_0x078f('0x3c')]);_0xe41e2e[_0x078f('0x3d')]=qs['filters'](_[_0x078f('0x3e')](_0xd57307[_0x078f('0x34')],_0x1f0ad6[_0x078f('0x35')]),_0x3dcd96);if(_0xd57307[_0x078f('0x34')][_0x078f('0x3f')]){_0xe41e2e[_0x078f('0x3d')]=_[_0x078f('0x40')](_0xe41e2e[_0x078f('0x3d')],{'$or':_[_0x078f('0x2d')](_0x3dcd96,function(_0x2c2614){if(_0x2c2614[_0x078f('0x31')]!==_0x078f('0x41')){var _0x44daf0={};_0x44daf0[_0x2c2614[_0x078f('0x2a')]]={'$like':'%'+_0xd57307[_0x078f('0x34')][_0x078f('0x3f')]+'%'};return _0x44daf0;}})});}_0xe41e2e=_['merge']({},_0xe41e2e,_0xd57307['options']);var _0x5ca9da={'where':_0xe41e2e[_0x078f('0x3d')]};return db['ZendeskField'][_0x078f('0x21')](_0x5ca9da)[_0x078f('0x28')](function(_0x43dad6){_0x29d306[_0x078f('0x21')]=_0x43dad6;if(_0xd57307['query'][_0x078f('0x42')]){_0xe41e2e['include']=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0xe41e2e);})[_0x078f('0x28')](function(_0x249c1a){_0x29d306[_0x078f('0x43')]=_0x249c1a;return _0x29d306;})[_0x078f('0x28')](respondWithFilteredResult(_0x1a8530,_0xe41e2e))[_0x078f('0x44')](handleError(_0x1a8530,null));};exports[_0x078f('0x45')]=function(_0x691f90,_0x9da51){var _0x3cd3e6={'raw':!![],'where':{'id':_0x691f90[_0x078f('0x46')]['id']}},_0x48e1fd={};_0x48e1fd['model']=_['keys'](db[_0x078f('0x2e')]['rawAttributes']);_0x48e1fd[_0x078f('0x34')]=_[_0x078f('0x33')](_0x691f90[_0x078f('0x34')]);_0x48e1fd[_0x078f('0x35')]=_[_0x078f('0x36')](_0x48e1fd[_0x078f('0x38')],_0x48e1fd[_0x078f('0x34')]);_0x3cd3e6[_0x078f('0x37')]=_['intersection'](_0x48e1fd[_0x078f('0x38')],qs['fields'](_0x691f90[_0x078f('0x34')]['fields']));_0x3cd3e6[_0x078f('0x37')]=_0x3cd3e6[_0x078f('0x37')][_0x078f('0x47')]?_0x3cd3e6[_0x078f('0x37')]:_0x48e1fd[_0x078f('0x38')];if(_0x691f90[_0x078f('0x34')][_0x078f('0x42')]){_0x3cd3e6[_0x078f('0x48')]=[{'all':!![]}];}_0x3cd3e6=_[_0x078f('0x40')]({},_0x3cd3e6,_0x691f90['options']);return db[_0x078f('0x2e')][_0x078f('0x49')](_0x3cd3e6)['then'](handleEntityNotFound(_0x9da51,null))[_0x078f('0x28')](respondWithResult(_0x9da51,null))[_0x078f('0x44')](handleError(_0x9da51,null));};exports[_0x078f('0x4a')]=function(_0x2e2726,_0x5ca787){return db[_0x078f('0x2e')][_0x078f('0x4a')](_0x2e2726[_0x078f('0x4b')],{})['then'](respondWithResult(_0x5ca787,0xc9))[_0x078f('0x44')](handleError(_0x5ca787,null));};exports[_0x078f('0x27')]=function(_0xb7e269,_0x1dca0e){if(_0xb7e269[_0x078f('0x4b')]['id']){delete _0xb7e269['body']['id'];}return db[_0x078f('0x2e')][_0x078f('0x49')]({'where':{'id':_0xb7e269['params']['id']}})[_0x078f('0x28')](handleEntityNotFound(_0x1dca0e,null))[_0x078f('0x28')](saveUpdates(_0xb7e269['body'],null))[_0x078f('0x28')](respondWithResult(_0x1dca0e,null))[_0x078f('0x44')](handleError(_0x1dca0e,null));};exports[_0x078f('0x4c')]=function(_0x2efae0,_0x35025c){return db[_0x078f('0x2e')][_0x078f('0x49')]({'where':{'id':_0x2efae0[_0x078f('0x46')]['id']}})[_0x078f('0x28')](handleEntityNotFound(_0x35025c,null))['then'](removeEntity(_0x35025c,null))[_0x078f('0x44')](handleError(_0x35025c,null));}; \ No newline at end of file +var _0xfecd=['count','apply','reject','save','update','then','destroy','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','include','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x4d8732,_0x498d60){var _0x3f545f=function(_0x28aff5){while(--_0x28aff5){_0x4d8732['push'](_0x4d8732['shift']());}};_0x3f545f(++_0x498d60);}(_0xfecd,0x107));var _0xdfec=function(_0x16ffb8,_0x17d477){_0x16ffb8=_0x16ffb8-0x0;var _0x2b63b2=_0xfecd[_0x16ffb8];return _0x2b63b2;};'use strict';var emlformat=require(_0xdfec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdfec('0x1'));var jsonpatch=require(_0xdfec('0x2'));var rp=require('request-promise');var moment=require(_0xdfec('0x3'));var BPromise=require(_0xdfec('0x4'));var Mustache=require('mustache');var util=require(_0xdfec('0x5'));var path=require('path');var sox=require(_0xdfec('0x6'));var csv=require(_0xdfec('0x7'));var ejs=require(_0xdfec('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfec('0x9'));var squel=require(_0xdfec('0xa'));var crypto=require(_0xdfec('0xb'));var jsforce=require(_0xdfec('0xc'));var deskjs=require(_0xdfec('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfec('0xe'));var Papa=require(_0xdfec('0xf'));var Redis=require(_0xdfec('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdfec('0x11'));var hardwareService=require(_0xdfec('0x12'));var logger=require('../../config/logger')(_0xdfec('0x13'));var utils=require(_0xdfec('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdfec('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21371b,_0x367a3c){_0x367a3c=_0x367a3c||0xcc;return function(_0x2384f5){if(_0x2384f5){return _0x21371b[_0xdfec('0x16')](_0x367a3c);}return _0x21371b[_0xdfec('0x17')](_0x367a3c)[_0xdfec('0x18')]();};}function respondWithResult(_0x28ef24,_0x2ccc89){_0x2ccc89=_0x2ccc89||0xc8;return function(_0x4d7c6e){if(_0x4d7c6e){return _0x28ef24[_0xdfec('0x17')](_0x2ccc89)[_0xdfec('0x19')](_0x4d7c6e);}};}function respondWithFilteredResult(_0x493d12,_0x420e3b){return function(_0x53ef23){if(_0x53ef23){var _0x2fbbbb=typeof _0x420e3b[_0xdfec('0x1a')]===_0xdfec('0x1b')&&typeof _0x420e3b[_0xdfec('0x1c')]==='undefined';var _0x443d2f=_0x53ef23[_0xdfec('0x1d')];var _0x336abf=_0x2fbbbb?0x0:_0x420e3b[_0xdfec('0x1a')];var _0x10c44c=_0x2fbbbb?_0x53ef23['count']:_0x420e3b['offset']+_0x420e3b[_0xdfec('0x1c')];var _0x171377;if(_0x10c44c>=_0x443d2f){_0x10c44c=_0x443d2f;_0x171377=0xc8;}else{_0x171377=0xce;}_0x493d12[_0xdfec('0x17')](_0x171377);return _0x493d12['set']('Content-Range',_0x336abf+'-'+_0x10c44c+'/'+_0x443d2f)['json'](_0x53ef23);}return null;};}function patchUpdates(_0x4b9614){return function(_0xce9faf){try{jsonpatch[_0xdfec('0x1e')](_0xce9faf,_0x4b9614,!![]);}catch(_0x577a69){return BPromise[_0xdfec('0x1f')](_0x577a69);}return _0xce9faf[_0xdfec('0x20')]();};}function saveUpdates(_0x58f088,_0x23c8fd){return function(_0x4fb633){if(_0x4fb633){return _0x4fb633[_0xdfec('0x21')](_0x58f088)[_0xdfec('0x22')](function(_0x43d004){return _0x43d004;});}return null;};}function removeEntity(_0x1e1c81,_0x405aae){return function(_0x3e29aa){if(_0x3e29aa){return _0x3e29aa[_0xdfec('0x23')]()[_0xdfec('0x22')](function(){_0x1e1c81[_0xdfec('0x17')](0xcc)[_0xdfec('0x18')]();});}};}function handleEntityNotFound(_0x488212,_0x16c6a7){return function(_0x511574){if(!_0x511574){_0x488212[_0xdfec('0x16')](0x194);}return _0x511574;};}function handleError(_0x21722a,_0x314f98){_0x314f98=_0x314f98||0x1f4;return function(_0x3b96f1){logger[_0xdfec('0x24')](_0x3b96f1[_0xdfec('0x25')]);if(_0x3b96f1[_0xdfec('0x26')]){delete _0x3b96f1['name'];}_0x21722a[_0xdfec('0x17')](_0x314f98)[_0xdfec('0x27')](_0x3b96f1);};}exports['index']=function(_0x19a66a,_0x58c46b){var _0x5051bd={},_0x71aeae={},_0x289b42={'count':0x0,'rows':[]};var _0x39b113=_[_0xdfec('0x28')](db[_0xdfec('0x29')][_0xdfec('0x2a')],function(_0x10c31d){return{'name':_0x10c31d[_0xdfec('0x2b')],'type':_0x10c31d[_0xdfec('0x2c')][_0xdfec('0x2d')]};});_0x71aeae[_0xdfec('0x2e')]=_[_0xdfec('0x28')](_0x39b113,'name');_0x71aeae[_0xdfec('0x2f')]=_[_0xdfec('0x30')](_0x19a66a[_0xdfec('0x2f')]);_0x71aeae[_0xdfec('0x31')]=_[_0xdfec('0x32')](_0x71aeae[_0xdfec('0x2e')],_0x71aeae[_0xdfec('0x2f')]);_0x5051bd[_0xdfec('0x33')]=_[_0xdfec('0x32')](_0x71aeae['model'],qs['fields'](_0x19a66a[_0xdfec('0x2f')][_0xdfec('0x34')]));_0x5051bd[_0xdfec('0x33')]=_0x5051bd[_0xdfec('0x33')][_0xdfec('0x35')]?_0x5051bd[_0xdfec('0x33')]:_0x71aeae['model'];if(!_0x19a66a['query'][_0xdfec('0x36')](_0xdfec('0x37'))){_0x5051bd[_0xdfec('0x1c')]=qs[_0xdfec('0x1c')](_0x19a66a[_0xdfec('0x2f')][_0xdfec('0x1c')]);_0x5051bd[_0xdfec('0x1a')]=qs[_0xdfec('0x1a')](_0x19a66a[_0xdfec('0x2f')][_0xdfec('0x1a')]);}_0x5051bd[_0xdfec('0x38')]=qs['sort'](_0x19a66a[_0xdfec('0x2f')][_0xdfec('0x39')]);_0x5051bd[_0xdfec('0x3a')]=qs['filters'](_[_0xdfec('0x3b')](_0x19a66a['query'],_0x71aeae[_0xdfec('0x31')]),_0x39b113);if(_0x19a66a[_0xdfec('0x2f')]['filter']){_0x5051bd[_0xdfec('0x3a')]=_[_0xdfec('0x3c')](_0x5051bd[_0xdfec('0x3a')],{'$or':_[_0xdfec('0x28')](_0x39b113,function(_0x311b09){if(_0x311b09[_0xdfec('0x2c')]!==_0xdfec('0x3d')){var _0x2d4317={};_0x2d4317[_0x311b09[_0xdfec('0x26')]]={'$like':'%'+_0x19a66a[_0xdfec('0x2f')][_0xdfec('0x3e')]+'%'};return _0x2d4317;}})});}_0x5051bd=_[_0xdfec('0x3c')]({},_0x5051bd,_0x19a66a[_0xdfec('0x3f')]);var _0x534f8e={'where':_0x5051bd[_0xdfec('0x3a')]};return db[_0xdfec('0x29')][_0xdfec('0x1d')](_0x534f8e)['then'](function(_0x936257){_0x289b42[_0xdfec('0x1d')]=_0x936257;if(_0x19a66a[_0xdfec('0x2f')]['includeAll']){_0x5051bd['include']=[{'all':!![]}];}return db[_0xdfec('0x29')][_0xdfec('0x40')](_0x5051bd);})[_0xdfec('0x22')](function(_0x50a096){_0x289b42[_0xdfec('0x41')]=_0x50a096;return _0x289b42;})['then'](respondWithFilteredResult(_0x58c46b,_0x5051bd))[_0xdfec('0x42')](handleError(_0x58c46b,null));};exports[_0xdfec('0x43')]=function(_0x47dd3f,_0x3b7dea){var _0x3623bf={'raw':!![],'where':{'id':_0x47dd3f[_0xdfec('0x44')]['id']}},_0x4bf045={};_0x4bf045[_0xdfec('0x2e')]=_[_0xdfec('0x30')](db[_0xdfec('0x29')][_0xdfec('0x2a')]);_0x4bf045[_0xdfec('0x2f')]=_['keys'](_0x47dd3f[_0xdfec('0x2f')]);_0x4bf045[_0xdfec('0x31')]=_[_0xdfec('0x32')](_0x4bf045[_0xdfec('0x2e')],_0x4bf045[_0xdfec('0x2f')]);_0x3623bf[_0xdfec('0x33')]=_[_0xdfec('0x32')](_0x4bf045[_0xdfec('0x2e')],qs[_0xdfec('0x34')](_0x47dd3f[_0xdfec('0x2f')][_0xdfec('0x34')]));_0x3623bf[_0xdfec('0x33')]=_0x3623bf[_0xdfec('0x33')][_0xdfec('0x35')]?_0x3623bf['attributes']:_0x4bf045[_0xdfec('0x2e')];if(_0x47dd3f[_0xdfec('0x2f')]['includeAll']){_0x3623bf[_0xdfec('0x45')]=[{'all':!![]}];}_0x3623bf=_[_0xdfec('0x3c')]({},_0x3623bf,_0x47dd3f[_0xdfec('0x3f')]);return db[_0xdfec('0x29')][_0xdfec('0x46')](_0x3623bf)['then'](handleEntityNotFound(_0x3b7dea,null))[_0xdfec('0x22')](respondWithResult(_0x3b7dea,null))['catch'](handleError(_0x3b7dea,null));};exports[_0xdfec('0x47')]=function(_0x5efe7b,_0x44dfd){return db[_0xdfec('0x29')][_0xdfec('0x47')](_0x5efe7b[_0xdfec('0x48')],{})['then'](respondWithResult(_0x44dfd,0xc9))[_0xdfec('0x42')](handleError(_0x44dfd,null));};exports[_0xdfec('0x21')]=function(_0x462e61,_0x3eed23){if(_0x462e61[_0xdfec('0x48')]['id']){delete _0x462e61[_0xdfec('0x48')]['id'];}return db[_0xdfec('0x29')][_0xdfec('0x46')]({'where':{'id':_0x462e61[_0xdfec('0x44')]['id']}})[_0xdfec('0x22')](handleEntityNotFound(_0x3eed23,null))[_0xdfec('0x22')](saveUpdates(_0x462e61[_0xdfec('0x48')],null))[_0xdfec('0x22')](respondWithResult(_0x3eed23,null))[_0xdfec('0x42')](handleError(_0x3eed23,null));};exports[_0xdfec('0x23')]=function(_0x5938fd,_0x339330){return db[_0xdfec('0x29')][_0xdfec('0x46')]({'where':{'id':_0x5938fd[_0xdfec('0x44')]['id']}})['then'](handleEntityNotFound(_0x339330,null))[_0xdfec('0x22')](removeEntity(_0x339330,null))[_0xdfec('0x42')](handleError(_0x339330,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 0b829ba..9ffd4f9 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 _0x6ae5=['int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./intZendeskField.attributes','exports'];(function(_0x38d45e,_0x119966){var _0x33c94d=function(_0x2267b2){while(--_0x2267b2){_0x38d45e['push'](_0x38d45e['shift']());}};_0x33c94d(++_0x119966);}(_0x6ae5,0x93));var _0x56ae=function(_0x2c6e22,_0x583370){_0x2c6e22=_0x2c6e22-0x0;var _0x46ae6c=_0x6ae5[_0x2c6e22];return _0x46ae6c;};'use strict';var _=require(_0x56ae('0x0'));var util=require(_0x56ae('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x56ae('0x2'));var BPromise=require(_0x56ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56ae('0x4'));var rimraf=require(_0x56ae('0x5'));var config=require(_0x56ae('0x6'));var attributes=require(_0x56ae('0x7'));module[_0x56ae('0x8')]=function(_0x1693d2,_0x5cf60c){return _0x1693d2['define']('ZendeskField',attributes,{'tableName':_0x56ae('0x9'),'paranoid':![],'indexes':[{'name':_0x56ae('0xa'),'fields':['idField',_0x56ae('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4622=['exports','define','int_zendesk_fields','zendesk_unique_index','FieldId','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4622,0x1b2));var _0x2462=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0x4622[_0x4c3ffe];return _0x28d3eb;};'use strict';var _=require('lodash');var util=require(_0x2462('0x0'));var logger=require(_0x2462('0x1'))(_0x2462('0x2'));var moment=require('moment');var BPromise=require(_0x2462('0x3'));var rp=require(_0x2462('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2462('0x5'));var config=require(_0x2462('0x6'));var attributes=require(_0x2462('0x7'));module[_0x2462('0x8')]=function(_0x10c6e3,_0x5e6d13){return _0x10c6e3[_0x2462('0x9')]('ZendeskField',attributes,{'tableName':_0x2462('0xa'),'paranoid':![],'indexes':[{'name':_0x2462('0xb'),'fields':['idField',_0x2462('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index a46af6b..82806fa 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 _0xf606=['info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x568160,_0x47d2f2){var _0x5c2c69=function(_0x4090cc){while(--_0x4090cc){_0x568160['push'](_0x568160['shift']());}};_0x5c2c69(++_0x47d2f2);}(_0xf606,0x111));var _0x6f60=function(_0x304de9,_0x5a9858){_0x304de9=_0x304de9-0x0;var _0x1bde63=_0xf606[_0x304de9];return _0x1bde63;};'use strict';var _=require(_0x6f60('0x0'));var util=require('util');var moment=require(_0x6f60('0x1'));var BPromise=require(_0x6f60('0x2'));var rs=require(_0x6f60('0x3'));var fs=require('fs');var Redis=require(_0x6f60('0x4'));var db=require(_0x6f60('0x5'))['db'];var utils=require(_0x6f60('0x6'));var logger=require(_0x6f60('0x7'))(_0x6f60('0x8'));var config=require(_0x6f60('0x9'));var jayson=require(_0x6f60('0xa'));var client=jayson[_0x6f60('0xb')][_0x6f60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6fd9b5,_0x1fa610,_0x1773de){return new BPromise(function(_0x20dd6b,_0x340f7c){return client[_0x6f60('0xd')](_0x6fd9b5,_0x1773de)[_0x6f60('0xe')](function(_0x336dfe){logger[_0x6f60('0xf')](_0x6f60('0x10'),_0x1fa610,_0x6f60('0x11'));logger['debug'](_0x6f60('0x12'),_0x1fa610,_0x6f60('0x11'),JSON[_0x6f60('0x13')](_0x336dfe));if(_0x336dfe[_0x6f60('0x14')]){if(_0x336dfe[_0x6f60('0x14')]['code']===0x1f4){logger[_0x6f60('0x14')](_0x6f60('0x10'),_0x1fa610,_0x336dfe[_0x6f60('0x14')][_0x6f60('0x15')]);return _0x340f7c(_0x336dfe[_0x6f60('0x14')][_0x6f60('0x15')]);}logger['error'](_0x6f60('0x10'),_0x1fa610,_0x336dfe[_0x6f60('0x14')][_0x6f60('0x15')]);return _0x20dd6b(_0x336dfe[_0x6f60('0x14')][_0x6f60('0x15')]);}else{logger[_0x6f60('0xf')](_0x6f60('0x10'),_0x1fa610,'request\x20sent');_0x20dd6b(_0x336dfe[_0x6f60('0x16')][_0x6f60('0x15')]);}})[_0x6f60('0x17')](function(_0x56b999){logger[_0x6f60('0x14')]('ZendeskField,\x20%s,\x20%s',_0x1fa610,_0x56b999);_0x340f7c(_0x56b999);});});} \ No newline at end of file +var _0xa3f9=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','util','bluebird','../../mysqldb'];(function(_0x4acd36,_0x5aee49){var _0x1ffcf4=function(_0x5c96f9){while(--_0x5c96f9){_0x4acd36['push'](_0x4acd36['shift']());}};_0x1ffcf4(++_0x5aee49);}(_0xa3f9,0x7b));var _0x9a3f=function(_0x47655b,_0x370d89){_0x47655b=_0x47655b-0x0;var _0x57e73b=_0xa3f9[_0x47655b];return _0x57e73b;};'use strict';var _=require('lodash');var util=require(_0x9a3f('0x0'));var moment=require('moment');var BPromise=require(_0x9a3f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a3f('0x2'))['db'];var utils=require(_0x9a3f('0x3'));var logger=require(_0x9a3f('0x4'))(_0x9a3f('0x5'));var config=require(_0x9a3f('0x6'));var jayson=require(_0x9a3f('0x7'));var client=jayson[_0x9a3f('0x8')][_0x9a3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2db48a,_0x1eb281,_0x188162){return new BPromise(function(_0x3f65b4,_0x798ce4){return client[_0x9a3f('0xa')](_0x2db48a,_0x188162)[_0x9a3f('0xb')](function(_0x3015a7){logger['info'](_0x9a3f('0xc'),_0x1eb281,'request\x20sent');logger[_0x9a3f('0xd')](_0x9a3f('0xe'),_0x1eb281,_0x9a3f('0xf'),JSON['stringify'](_0x3015a7));if(_0x3015a7[_0x9a3f('0x10')]){if(_0x3015a7[_0x9a3f('0x10')][_0x9a3f('0x11')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x1eb281,_0x3015a7[_0x9a3f('0x10')]['message']);return _0x798ce4(_0x3015a7[_0x9a3f('0x10')][_0x9a3f('0x12')]);}logger[_0x9a3f('0x10')](_0x9a3f('0xc'),_0x1eb281,_0x3015a7[_0x9a3f('0x10')][_0x9a3f('0x12')]);return _0x3f65b4(_0x3015a7[_0x9a3f('0x10')][_0x9a3f('0x12')]);}else{logger[_0x9a3f('0x13')]('ZendeskField,\x20%s,\x20%s',_0x1eb281,_0x9a3f('0xf'));_0x3f65b4(_0x3015a7[_0x9a3f('0x14')][_0x9a3f('0x12')]);}})['catch'](function(_0x18cd76){logger[_0x9a3f('0x10')](_0x9a3f('0xc'),_0x1eb281,_0x18cd76);_0x798ce4(_0x18cd76);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 11fe2d8..b1bcf6b 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 _0xd6f3=['isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get'];(function(_0x1582a3,_0x142ded){var _0x11cac2=function(_0x25137a){while(--_0x25137a){_0x1582a3['push'](_0x1582a3['shift']());}};_0x11cac2(++_0x142ded);}(_0xd6f3,0x72));var _0x3d6f=function(_0x3a9412,_0x3f6b61){_0x3a9412=_0x3a9412-0x0;var _0x59e99d=_0xd6f3[_0x3a9412];return _0x59e99d;};'use strict';var multer=require(_0x3d6f('0x0'));var util=require(_0x3d6f('0x1'));var path=require(_0x3d6f('0x2'));var timeout=require(_0x3d6f('0x3'));var express=require(_0x3d6f('0x4'));var router=express[_0x3d6f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3d6f('0x6'));var interaction=require(_0x3d6f('0x7'));var config=require(_0x3d6f('0x8'));var controller=require(_0x3d6f('0x9'));router[_0x3d6f('0xa')]('/',auth[_0x3d6f('0xb')](),controller[_0x3d6f('0xc')]);router[_0x3d6f('0xa')]('/:id',auth[_0x3d6f('0xb')](),controller[_0x3d6f('0xd')]);router[_0x3d6f('0xa')]('/:id/configurations',auth[_0x3d6f('0xb')](),controller[_0x3d6f('0xe')]);router[_0x3d6f('0xa')](_0x3d6f('0xf'),auth[_0x3d6f('0xb')](),controller[_0x3d6f('0x10')]);router[_0x3d6f('0x11')]('/',auth[_0x3d6f('0xb')](),controller[_0x3d6f('0x12')]);router[_0x3d6f('0x11')]('/:id/configurations',auth[_0x3d6f('0xb')](),controller[_0x3d6f('0x13')]);router[_0x3d6f('0x14')](_0x3d6f('0x15'),auth[_0x3d6f('0xb')](),controller[_0x3d6f('0x16')]);router['delete'](_0x3d6f('0x15'),auth[_0x3d6f('0xb')](),controller[_0x3d6f('0x17')]);module[_0x3d6f('0x18')]=router; \ No newline at end of file +var _0x39bc=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update'];(function(_0x4706e7,_0x4d8196){var _0x451263=function(_0x4f7e64){while(--_0x4f7e64){_0x4706e7['push'](_0x4706e7['shift']());}};_0x451263(++_0x4d8196);}(_0x39bc,0x1e6));var _0xc39b=function(_0x1377c8,_0x3713c2){_0x1377c8=_0x1377c8-0x0;var _0x4b5411=_0x39bc[_0x1377c8];return _0x4b5411;};'use strict';var multer=require(_0xc39b('0x0'));var util=require('util');var path=require(_0xc39b('0x1'));var timeout=require(_0xc39b('0x2'));var express=require(_0xc39b('0x3'));var router=express['Router']();var fs_extra=require(_0xc39b('0x4'));var auth=require(_0xc39b('0x5'));var interaction=require(_0xc39b('0x6'));var config=require(_0xc39b('0x7'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0xc39b('0x8')](),controller['index']);router[_0xc39b('0x9')]('/:id',auth[_0xc39b('0x8')](),controller[_0xc39b('0xa')]);router['get'](_0xc39b('0xb'),auth[_0xc39b('0x8')](),controller[_0xc39b('0xc')]);router[_0xc39b('0x9')](_0xc39b('0xd'),auth[_0xc39b('0x8')](),controller[_0xc39b('0xe')]);router[_0xc39b('0xf')]('/',auth['isAuthenticated'](),controller[_0xc39b('0x10')]);router[_0xc39b('0xf')](_0xc39b('0xb'),auth['isAuthenticated'](),controller[_0xc39b('0x11')]);router['put'](_0xc39b('0x12'),auth[_0xc39b('0x8')](),controller[_0xc39b('0x13')]);router[_0xc39b('0x14')](_0xc39b('0x12'),auth[_0xc39b('0x8')](),controller[_0xc39b('0x15')]);module[_0xc39b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index a79191f..6c3ffe9 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 _0x22fb=['STRING'];(function(_0x3ffb22,_0x59a7be){var _0x53d441=function(_0x3cfd1e){while(--_0x3cfd1e){_0x3ffb22['push'](_0x3ffb22['shift']());}};_0x53d441(++_0x59a7be);}(_0x22fb,0x192));var _0xb22f=function(_0x17fb89,_0x543af5){_0x17fb89=_0x17fb89-0x0;var _0x320741=_0x22fb[_0x17fb89];return _0x320741;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb22f('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb22f('0x0')]},'zone':{'type':Sequelize[_0xb22f('0x0')]},'clientId':{'type':Sequelize[_0xb22f('0x0')]},'clientSecret':{'type':Sequelize[_0xb22f('0x0')]},'serverUrl':{'type':Sequelize[_0xb22f('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb22f('0x0')]}}; \ No newline at end of file +var _0xec56=['STRING','sequelize'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xec56,0x1bd));var _0x6ec5=function(_0x40ca79,_0x438529){_0x40ca79=_0x40ca79-0x0;var _0x35687b=_0xec56[_0x40ca79];return _0x35687b;};'use strict';var Sequelize=require(_0x6ec5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6ec5('0x1')]},'host':{'type':Sequelize[_0x6ec5('0x1')]},'zone':{'type':Sequelize[_0x6ec5('0x1')]},'clientId':{'type':Sequelize[_0x6ec5('0x1')]},'clientSecret':{'type':Sequelize[_0x6ec5('0x1')]},'serverUrl':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x6ec5('0x1')]},'refreshToken':{'type':Sequelize[_0x6ec5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 6bf63cf..aa159e0 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 _0x5b9a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','name','options','ZohoAccount','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','addConfiguration','Descriptions','getDescriptions','channel','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientId','clientSecret','access_token','getFields','serverUrl','host','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','Call_Result','Call_Start_Time','remove','includes','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x335eab,_0x2e2a1d){var _0x33f82d=function(_0x5afe8a){while(--_0x5afe8a){_0x335eab['push'](_0x335eab['shift']());}};_0x33f82d(++_0x2e2a1d);}(_0x5b9a,0x16b));var _0xa5b9=function(_0x1a1993,_0x4c15f7){_0x1a1993=_0x1a1993-0x0;var _0x126b8e=_0x5b9a[_0x1a1993];return _0x126b8e;};'use strict';var emlformat=require(_0xa5b9('0x0'));var rimraf=require(_0xa5b9('0x1'));var zipdir=require(_0xa5b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5b9('0x3'));var moment=require(_0xa5b9('0x4'));var BPromise=require(_0xa5b9('0x5'));var Mustache=require('mustache');var util=require(_0xa5b9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa5b9('0x7'));var ejs=require(_0xa5b9('0x8'));var fs=require('fs');var fs_extra=require(_0xa5b9('0x9'));var _=require(_0xa5b9('0xa'));var squel=require(_0xa5b9('0xb'));var crypto=require(_0xa5b9('0xc'));var jsforce=require(_0xa5b9('0xd'));var deskjs=require(_0xa5b9('0xe'));var toCsv=require(_0xa5b9('0x7'));var querystring=require(_0xa5b9('0xf'));var Papa=require(_0xa5b9('0x10'));var Redis=require(_0xa5b9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa5b9('0x12'));var as=require(_0xa5b9('0x13'));var hardwareService=require(_0xa5b9('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa5b9('0x15'));var licenseUtil=require(_0xa5b9('0x16'));var db=require(_0xa5b9('0x17'))['db'];var integrations=require(_0xa5b9('0x18'));function respondWithStatusCode(_0x3aa6c9,_0x2b5663){_0x2b5663=_0x2b5663||0xcc;return function(_0x51aca7){if(_0x51aca7){return _0x3aa6c9[_0xa5b9('0x19')](_0x2b5663);}return _0x3aa6c9[_0xa5b9('0x1a')](_0x2b5663)[_0xa5b9('0x1b')]();};}function respondWithResult(_0x92fd24,_0x14c037){_0x14c037=_0x14c037||0xc8;return function(_0xae1f97){if(_0xae1f97){return _0x92fd24[_0xa5b9('0x1a')](_0x14c037)[_0xa5b9('0x1c')](_0xae1f97);}};}function respondWithFilteredResult(_0x33d9d2,_0x5a1cbe){return function(_0x3b08d6){if(_0x3b08d6){var _0x541a63=typeof _0x5a1cbe[_0xa5b9('0x1d')]===_0xa5b9('0x1e')&&typeof _0x5a1cbe[_0xa5b9('0x1f')]==='undefined';var _0x8d0dc2=_0x3b08d6[_0xa5b9('0x20')];var _0xda596e=_0x541a63?0x0:_0x5a1cbe['offset'];var _0x8121e1=_0x541a63?_0x3b08d6['count']:_0x5a1cbe[_0xa5b9('0x1d')]+_0x5a1cbe[_0xa5b9('0x1f')];var _0x1927e1;if(_0x8121e1>=_0x8d0dc2){_0x8121e1=_0x8d0dc2;_0x1927e1=0xc8;}else{_0x1927e1=0xce;}_0x33d9d2[_0xa5b9('0x1a')](_0x1927e1);return _0x33d9d2[_0xa5b9('0x21')](_0xa5b9('0x22'),_0xda596e+'-'+_0x8121e1+'/'+_0x8d0dc2)[_0xa5b9('0x1c')](_0x3b08d6);}return null;};}function patchUpdates(_0x4989e0){return function(_0x4eb2bb){try{jsonpatch[_0xa5b9('0x23')](_0x4eb2bb,_0x4989e0,!![]);}catch(_0x3b5432){return BPromise['reject'](_0x3b5432);}return _0x4eb2bb[_0xa5b9('0x24')]();};}function saveUpdates(_0x98e569,_0x330806){return function(_0x4bdf16){if(_0x4bdf16){return _0x4bdf16[_0xa5b9('0x25')](_0x98e569)[_0xa5b9('0x26')](function(_0x54ac98){return _0x54ac98;});}return null;};}function removeEntity(_0xee6224,_0xea1797){return function(_0x2c46a5){if(_0x2c46a5){return _0x2c46a5[_0xa5b9('0x27')]()[_0xa5b9('0x26')](function(){_0xee6224[_0xa5b9('0x1a')](0xcc)[_0xa5b9('0x1b')]();});}};}function handleEntityNotFound(_0x211c1e,_0xf8ae1f){return function(_0x3685c8){if(!_0x3685c8){_0x211c1e[_0xa5b9('0x19')](0x194);}return _0x3685c8;};}function handleError(_0x237271,_0xab2b56){_0xab2b56=_0xab2b56||0x1f4;return function(_0x375fbc){logger[_0xa5b9('0x28')](_0x375fbc[_0xa5b9('0x29')]);if(_0x375fbc['name']){delete _0x375fbc['name'];}_0x237271[_0xa5b9('0x1a')](_0xab2b56)[_0xa5b9('0x2a')](_0x375fbc);};}exports['index']=function(_0x3bd41c,_0x6b06e0){var _0x3aab13={},_0x595299={},_0x4288d9={'count':0x0,'rows':[]};var _0x15319a=_[_0xa5b9('0x2b')](db['ZohoAccount'][_0xa5b9('0x2c')],function(_0x4e6dfc){return{'name':_0x4e6dfc[_0xa5b9('0x2d')],'type':_0x4e6dfc[_0xa5b9('0x2e')][_0xa5b9('0x2f')]};});_0x595299[_0xa5b9('0x30')]=_[_0xa5b9('0x2b')](_0x15319a,'name');_0x595299['query']=_[_0xa5b9('0x31')](_0x3bd41c[_0xa5b9('0x32')]);_0x595299[_0xa5b9('0x33')]=_['intersection'](_0x595299['model'],_0x595299[_0xa5b9('0x32')]);_0x3aab13['attributes']=_[_0xa5b9('0x34')](_0x595299['model'],qs[_0xa5b9('0x35')](_0x3bd41c['query'][_0xa5b9('0x35')]));_0x3aab13[_0xa5b9('0x36')]=_0x3aab13[_0xa5b9('0x36')][_0xa5b9('0x37')]?_0x3aab13[_0xa5b9('0x36')]:_0x595299['model'];if(!_0x3bd41c[_0xa5b9('0x32')]['hasOwnProperty'](_0xa5b9('0x38'))){_0x3aab13['limit']=qs['limit'](_0x3bd41c['query']['limit']);_0x3aab13['offset']=qs['offset'](_0x3bd41c[_0xa5b9('0x32')][_0xa5b9('0x1d')]);}_0x3aab13[_0xa5b9('0x39')]=qs[_0xa5b9('0x3a')](_0x3bd41c['query']['sort']);_0x3aab13[_0xa5b9('0x3b')]=qs['filters'](_[_0xa5b9('0x3c')](_0x3bd41c[_0xa5b9('0x32')],_0x595299[_0xa5b9('0x33')]),_0x15319a);if(_0x3bd41c[_0xa5b9('0x32')][_0xa5b9('0x3d')]){_0x3aab13[_0xa5b9('0x3b')]=_[_0xa5b9('0x3e')](_0x3aab13['where'],{'$or':_[_0xa5b9('0x2b')](_0x15319a,function(_0x519ca3){if(_0x519ca3[_0xa5b9('0x2e')]!=='VIRTUAL'){var _0x507572={};_0x507572[_0x519ca3[_0xa5b9('0x3f')]]={'$like':'%'+_0x3bd41c[_0xa5b9('0x32')][_0xa5b9('0x3d')]+'%'};return _0x507572;}})});}_0x3aab13=_['merge']({},_0x3aab13,_0x3bd41c[_0xa5b9('0x40')]);var _0x19ce74={'where':_0x3aab13[_0xa5b9('0x3b')]};return db[_0xa5b9('0x41')][_0xa5b9('0x20')](_0x19ce74)[_0xa5b9('0x26')](function(_0x2a6500){_0x4288d9[_0xa5b9('0x20')]=_0x2a6500;if(_0x3bd41c[_0xa5b9('0x32')][_0xa5b9('0x42')]){_0x3aab13[_0xa5b9('0x43')]=[{'all':!![]}];}return db['ZohoAccount'][_0xa5b9('0x44')](_0x3aab13);})['then'](function(_0x51f653){_0x4288d9[_0xa5b9('0x45')]=_0x51f653;return _0x4288d9;})['then'](respondWithFilteredResult(_0x6b06e0,_0x3aab13))[_0xa5b9('0x46')](handleError(_0x6b06e0,null));};exports[_0xa5b9('0x47')]=function(_0x6a6970,_0x3b2dc8){var _0xeb9fc9={'raw':![],'where':{'id':_0x6a6970['params']['id']}},_0xb1c833={};_0xb1c833[_0xa5b9('0x30')]=_['keys'](db[_0xa5b9('0x41')][_0xa5b9('0x2c')]);_0xb1c833['query']=_[_0xa5b9('0x31')](_0x6a6970[_0xa5b9('0x32')]);_0xb1c833[_0xa5b9('0x33')]=_[_0xa5b9('0x34')](_0xb1c833[_0xa5b9('0x30')],_0xb1c833['query']);_0xeb9fc9[_0xa5b9('0x36')]=_[_0xa5b9('0x34')](_0xb1c833['model'],qs['fields'](_0x6a6970[_0xa5b9('0x32')][_0xa5b9('0x35')]));_0xeb9fc9['attributes']=_0xeb9fc9[_0xa5b9('0x36')][_0xa5b9('0x37')]?_0xeb9fc9[_0xa5b9('0x36')]:_0xb1c833[_0xa5b9('0x30')];if(_0x6a6970[_0xa5b9('0x32')][_0xa5b9('0x42')]){_0xeb9fc9[_0xa5b9('0x43')]=[{'all':!![]}];}_0xeb9fc9=_[_0xa5b9('0x3e')]({},_0xeb9fc9,_0x6a6970[_0xa5b9('0x40')]);return db[_0xa5b9('0x41')][_0xa5b9('0x48')](_0xeb9fc9)['then'](handleEntityNotFound(_0x3b2dc8,null))[_0xa5b9('0x26')](respondWithResult(_0x3b2dc8,null))[_0xa5b9('0x46')](handleError(_0x3b2dc8,null));};exports['create']=function(_0x402690,_0xb9e8e3){return db[_0xa5b9('0x41')][_0xa5b9('0x49')](_0x402690[_0xa5b9('0x4a')],{})[_0xa5b9('0x26')](respondWithResult(_0xb9e8e3,0xc9))[_0xa5b9('0x46')](handleError(_0xb9e8e3,null));};exports[_0xa5b9('0x25')]=function(_0x1f22f6,_0x472de1){if(_0x1f22f6[_0xa5b9('0x4a')]['id']){delete _0x1f22f6[_0xa5b9('0x4a')]['id'];}return db[_0xa5b9('0x41')][_0xa5b9('0x48')]({'where':{'id':_0x1f22f6[_0xa5b9('0x4b')]['id']}})[_0xa5b9('0x26')](handleEntityNotFound(_0x472de1,null))[_0xa5b9('0x26')](saveUpdates(_0x1f22f6[_0xa5b9('0x4a')],null))[_0xa5b9('0x26')](respondWithResult(_0x472de1,null))[_0xa5b9('0x46')](handleError(_0x472de1,null));};exports[_0xa5b9('0x27')]=function(_0x30160f,_0x29e182){return db[_0xa5b9('0x41')]['find']({'where':{'id':_0x30160f[_0xa5b9('0x4b')]['id']}})[_0xa5b9('0x26')](handleEntityNotFound(_0x29e182,null))[_0xa5b9('0x26')](removeEntity(_0x29e182,null))[_0xa5b9('0x46')](handleError(_0x29e182,null));};exports[_0xa5b9('0x4c')]=function(_0x53df28,_0x39a176,_0x4b1169){var _0x572295={};var _0x2819dd={};var _0xcc0537;var _0x2ea9b5;return db[_0xa5b9('0x41')][_0xa5b9('0x4d')]({'where':{'id':_0x53df28[_0xa5b9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x39a176,null))[_0xa5b9('0x26')](function(_0x2a561b){if(_0x2a561b){_0xcc0537=_0x2a561b;_0x2819dd[_0xa5b9('0x30')]=_[_0xa5b9('0x31')](db[_0xa5b9('0x4e')][_0xa5b9('0x2c')]);_0x2819dd[_0xa5b9('0x32')]=_[_0xa5b9('0x31')](_0x53df28[_0xa5b9('0x32')]);_0x2819dd[_0xa5b9('0x33')]=_[_0xa5b9('0x34')](_0x2819dd[_0xa5b9('0x30')],_0x2819dd['query']);_0x572295[_0xa5b9('0x36')]=_['intersection'](_0x2819dd['model'],qs[_0xa5b9('0x35')](_0x53df28[_0xa5b9('0x32')][_0xa5b9('0x35')]));_0x572295['attributes']=_0x572295[_0xa5b9('0x36')][_0xa5b9('0x37')]?_0x572295[_0xa5b9('0x36')]:_0x2819dd['model'];_0x572295[_0xa5b9('0x39')]=qs['sort'](_0x53df28['query']['sort']);_0x572295[_0xa5b9('0x3b')]=qs[_0xa5b9('0x33')](_[_0xa5b9('0x3c')](_0x53df28[_0xa5b9('0x32')],_0x2819dd['filters']));if(_0x53df28[_0xa5b9('0x32')][_0xa5b9('0x3d')]){_0x572295[_0xa5b9('0x3b')]=_[_0xa5b9('0x3e')](_0x572295[_0xa5b9('0x3b')],{'$or':_[_0xa5b9('0x2b')](_0x572295[_0xa5b9('0x36')],function(_0x37ab5d){var _0x3c231a={};_0x3c231a[_0x37ab5d]={'$like':'%'+_0x53df28[_0xa5b9('0x32')][_0xa5b9('0x3d')]+'%'};return _0x3c231a;})});}_0x572295=_[_0xa5b9('0x3e')]({},_0x572295,_0x53df28['options']);return _0xcc0537['getConfigurations'](_0x572295);}})[_0xa5b9('0x26')](function(_0x2f5f33){if(_0x2f5f33){_0x2ea9b5=_0x2f5f33[_0xa5b9('0x37')];if(!_0x53df28[_0xa5b9('0x32')]['hasOwnProperty'](_0xa5b9('0x38'))){_0x572295[_0xa5b9('0x1f')]=qs[_0xa5b9('0x1f')](_0x53df28[_0xa5b9('0x32')][_0xa5b9('0x1f')]);_0x572295[_0xa5b9('0x1d')]=qs[_0xa5b9('0x1d')](_0x53df28[_0xa5b9('0x32')][_0xa5b9('0x1d')]);}return _0xcc0537[_0xa5b9('0x4c')](_0x572295);}})['then'](function(_0x1b2103){if(_0x1b2103){return _0x1b2103?{'count':_0x2ea9b5,'rows':_0x1b2103}:null;}})[_0xa5b9('0x26')](respondWithResult(_0x39a176,null))['catch'](handleError(_0x39a176,null));};exports[_0xa5b9('0x4f')]=function(_0x51f459,_0x3c54c5,_0x1cb996){if(_0x51f459[_0xa5b9('0x4a')]['id']){delete _0x51f459[_0xa5b9('0x4a')]['id'];}return db[_0xa5b9('0x41')][_0xa5b9('0x4d')]({'where':{'id':_0x51f459['params']['id']}})['then'](handleEntityNotFound(_0x3c54c5,null))['then'](function(_0xcf03a3){if(_0xcf03a3){_0x51f459['body']['AccountId']=_0xcf03a3['id'];_0x51f459[_0xa5b9('0x4a')]['Subjects']=integrations['getSubjects'](_0x51f459[_0xa5b9('0x4a')]['channel'],_0x51f459[_0xa5b9('0x4a')][_0xa5b9('0x2e')]);_0x51f459[_0xa5b9('0x4a')][_0xa5b9('0x50')]=integrations[_0xa5b9('0x51')](_0x51f459['body'][_0xa5b9('0x52')],_0x51f459[_0xa5b9('0x4a')]['type']);return db['ZohoConfiguration'][_0xa5b9('0x49')](_0x51f459[_0xa5b9('0x4a')],{'include':[{'model':db[_0xa5b9('0x53')],'as':_0xa5b9('0x54')},{'model':db[_0xa5b9('0x53')],'as':'Descriptions'}]});}return null;})[_0xa5b9('0x26')](respondWithResult(_0x3c54c5,null))[_0xa5b9('0x46')](handleError(_0x3c54c5,null));};function getAccessToken(_0x59cfce){return new Promise(function(_0x3ad106,_0xc679b4){var _0x17cb71;switch(_0x59cfce[_0xa5b9('0x55')]){case'US':_0x17cb71=_0xa5b9('0x56');break;case'AU':_0x17cb71=_0xa5b9('0x57');break;case'EU':_0x17cb71=_0xa5b9('0x58');break;case'IN':_0x17cb71=_0xa5b9('0x59');break;case'CN':_0x17cb71=_0xa5b9('0x5a');break;default:_0x17cb71=_0xa5b9('0x58');break;}var _0x460b81={'method':'POST','uri':_0x17cb71+'/oauth/v2/token','qs':{'refresh_token':_0x59cfce[_0xa5b9('0x5b')],'client_id':_0x59cfce[_0xa5b9('0x5c')],'client_secret':_0x59cfce[_0xa5b9('0x5d')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x460b81)[_0xa5b9('0x26')](function(_0x72aacb){if(_0x72aacb[_0xa5b9('0x5e')]){_0x3ad106(_0x72aacb[_0xa5b9('0x5e')]);}else{_0xc679b4('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xa5b9('0x46')](function(_0xaafa48){_0xc679b4(_0xaafa48);});});}exports[_0xa5b9('0x5f')]=function(_0x2311a8,_0x434f3a,_0x58744a){var _0x3040f1,_0x3ff6c1,_0x90f10b,_0x51ef19,_0x19dc28;return db[_0xa5b9('0x41')][_0xa5b9('0x4d')]({'where':{'id':_0x2311a8[_0xa5b9('0x4b')]['id']},'attributes':['id','host','zone','clientId',_0xa5b9('0x5d'),_0xa5b9('0x60'),'code',_0xa5b9('0x5b')]})[_0xa5b9('0x26')](handleEntityNotFound(_0x434f3a,null))[_0xa5b9('0x26')](function(_0x301f48){_0x19dc28=_0x301f48;_0x3040f1=_0x19dc28[_0xa5b9('0x61')];_0x3ff6c1=_0x3040f1===_0xa5b9('0x62')?'eu':_0xa5b9('0x63');_0x90f10b=_0x19dc28['serverUrl'];var _0x219f70=_0x90f10b[_0xa5b9('0x64')](-0x1);if(_0x219f70==='/'||_0x219f70==='\x5c'||_0x219f70===':'){_0x90f10b=_0x90f10b['substring'](0x0,_0x90f10b[_0xa5b9('0x65')](_0x219f70));}if(!_0x19dc28[_0xa5b9('0x5b')]){throw new Error(_0xa5b9('0x66'));}return getAccessToken(_0x19dc28);})['then'](function(_0x2fd17b){if(_0x2fd17b){return rp({'method':_0xa5b9('0x67'),'uri':util['format'](_0xa5b9('0x68'),_0x3ff6c1),'qs':{'module':_0xa5b9('0x69')},'headers':{'Authorization':_0xa5b9('0x6a')+_0x2fd17b},'json':!![]});}})[_0xa5b9('0x26')](function(_0x3b856c){if(_0x3b856c){if(_0x3b856c[_0xa5b9('0x6b')]&&_0x3b856c['response']['error']){throw new Error(_0x3b856c[_0xa5b9('0x6b')]['error'][_0xa5b9('0x6c')]);}var _0x47f3ca=[];var _0x4c5398=[];var _0x4fe917=[_0xa5b9('0x6d'),_0xa5b9('0x6e'),_0xa5b9('0x6f'),'WhoId','Call_Duration',_0xa5b9('0x70'),_0xa5b9('0x71'),'Call_Type'];_0x4c5398=_[_0xa5b9('0x72')](_0x3b856c[_0xa5b9('0x35')],function(_0x40f68e){return _0x4fe917[_0xa5b9('0x73')](_0x40f68e['api_name']);});for(var _0xacffe9=0x0;_0xacffe9<_0x4c5398[_0xa5b9('0x37')];_0xacffe9++){if(_0x4c5398[_0xacffe9][_0xa5b9('0x74')]===![]){_0x47f3ca[_0xa5b9('0x75')]({'id':_0x4c5398[_0xacffe9]['id'],'name':_0x4c5398[_0xacffe9][_0xa5b9('0x76')],'custom':_0x4c5398[_0xacffe9][_0xa5b9('0x77')],'options':_0x4c5398[_0xacffe9][_0xa5b9('0x78')]==='picklist'&&_0x4c5398[_0xacffe9][_0xa5b9('0x79')][_0xa5b9('0x37')]>-0x1?_[_0xa5b9('0x2b')](_0x4c5398[_0xacffe9][_0xa5b9('0x79')],function(_0x187a82){return{'name':_0x187a82,'value':_0x187a82};}):[]});}}return{'count':_0x47f3ca[_0xa5b9('0x37')],'rows':_0x47f3ca};}else{return{'count':0x0,'rows':[]};}})[_0xa5b9('0x26')](respondWithResult(_0x434f3a,null))[_0xa5b9('0x46')](function(_0x44fac0){var _0x5135a3=_0x2311a8[_0xa5b9('0x32')]['test']?0x1f4:_0x44fac0[_0xa5b9('0x7a')]||0x1f4;logger['error'](_0xa5b9('0x7b'),_0xa5b9('0x5f'),_0x5135a3,JSON[_0xa5b9('0x7c')](_0x44fac0));delete _0x44fac0[_0xa5b9('0x3f')];if(_0x5135a3===0x191){_0x5135a3=0x190;}_0x434f3a['status'](_0x5135a3)['send'](_0x2311a8[_0xa5b9('0x32')][_0xa5b9('0x7d')]?{'message':_0xa5b9('0x7e'),'statusCode':_0x44fac0[_0xa5b9('0x7a')]}:_0x44fac0);});}; \ No newline at end of file +var _0x9398=['fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','count','status','apply','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','limit','order','sort','pick','filter','where','merge','includeAll','include','ZohoAccount','findAll','then','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','substring','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','error','Owner','Subject','Description','Call_Duration','Call_Start_Time','Call_Type','api_name','system_mandatory','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','zip-dir'];(function(_0x3a37a3,_0x3a74e6){var _0x19434d=function(_0x1f2a7f){while(--_0x1f2a7f){_0x3a37a3['push'](_0x3a37a3['shift']());}};_0x19434d(++_0x3a74e6);}(_0x9398,0x17e));var _0x8939=function(_0x3b3a4b,_0x3514b0){_0x3b3a4b=_0x3b3a4b-0x0;var _0x272baf=_0x9398[_0x3b3a4b];return _0x272baf;};'use strict';var emlformat=require(_0x8939('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8939('0x1'));var jsonpatch=require(_0x8939('0x2'));var rp=require('request-promise');var moment=require(_0x8939('0x3'));var BPromise=require(_0x8939('0x4'));var Mustache=require(_0x8939('0x5'));var util=require(_0x8939('0x6'));var path=require(_0x8939('0x7'));var sox=require(_0x8939('0x8'));var csv=require('to-csv');var ejs=require(_0x8939('0x9'));var fs=require('fs');var fs_extra=require(_0x8939('0xa'));var _=require(_0x8939('0xb'));var squel=require(_0x8939('0xc'));var crypto=require(_0x8939('0xd'));var jsforce=require(_0x8939('0xe'));var deskjs=require(_0x8939('0xf'));var toCsv=require(_0x8939('0x10'));var querystring=require(_0x8939('0x11'));var Papa=require(_0x8939('0x12'));var Redis=require('ioredis');var authService=require(_0x8939('0x13'));var qs=require(_0x8939('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8939('0x15'));var logger=require(_0x8939('0x16'))(_0x8939('0x17'));var utils=require(_0x8939('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8939('0x19'));var db=require(_0x8939('0x1a'))['db'];var integrations=require(_0x8939('0x1b'));function respondWithStatusCode(_0x1d1069,_0x42bceb){_0x42bceb=_0x42bceb||0xcc;return function(_0xda8454){if(_0xda8454){return _0x1d1069[_0x8939('0x1c')](_0x42bceb);}return _0x1d1069['status'](_0x42bceb)[_0x8939('0x1d')]();};}function respondWithResult(_0x43250d,_0x1ff8be){_0x1ff8be=_0x1ff8be||0xc8;return function(_0x2765a0){if(_0x2765a0){return _0x43250d['status'](_0x1ff8be)[_0x8939('0x1e')](_0x2765a0);}};}function respondWithFilteredResult(_0x260207,_0x50d989){return function(_0x4d43f7){if(_0x4d43f7){var _0x2db068=typeof _0x50d989[_0x8939('0x1f')]==='undefined'&&typeof _0x50d989['limit']==='undefined';var _0x3225c5=_0x4d43f7[_0x8939('0x20')];var _0x26d5bf=_0x2db068?0x0:_0x50d989[_0x8939('0x1f')];var _0x3b9fc1=_0x2db068?_0x4d43f7[_0x8939('0x20')]:_0x50d989['offset']+_0x50d989['limit'];var _0x4f6403;if(_0x3b9fc1>=_0x3225c5){_0x3b9fc1=_0x3225c5;_0x4f6403=0xc8;}else{_0x4f6403=0xce;}_0x260207[_0x8939('0x21')](_0x4f6403);return _0x260207['set']('Content-Range',_0x26d5bf+'-'+_0x3b9fc1+'/'+_0x3225c5)[_0x8939('0x1e')](_0x4d43f7);}return null;};}function patchUpdates(_0x5d969f){return function(_0x436be9){try{jsonpatch[_0x8939('0x22')](_0x436be9,_0x5d969f,!![]);}catch(_0x3e9408){return BPromise['reject'](_0x3e9408);}return _0x436be9[_0x8939('0x23')]();};}function saveUpdates(_0x57e247,_0x4f9c4b){return function(_0x3e1094){if(_0x3e1094){return _0x3e1094[_0x8939('0x24')](_0x57e247)['then'](function(_0x5d8732){return _0x5d8732;});}return null;};}function removeEntity(_0x33a51c,_0x4bf2b1){return function(_0x454c70){if(_0x454c70){return _0x454c70[_0x8939('0x25')]()['then'](function(){_0x33a51c[_0x8939('0x21')](0xcc)[_0x8939('0x1d')]();});}};}function handleEntityNotFound(_0x32e5dd,_0x4f141c){return function(_0x252f17){if(!_0x252f17){_0x32e5dd[_0x8939('0x1c')](0x194);}return _0x252f17;};}function handleError(_0x27d8f9,_0x1b8a53){_0x1b8a53=_0x1b8a53||0x1f4;return function(_0x29eb48){logger['error'](_0x29eb48[_0x8939('0x26')]);if(_0x29eb48[_0x8939('0x27')]){delete _0x29eb48[_0x8939('0x27')];}_0x27d8f9['status'](_0x1b8a53)[_0x8939('0x28')](_0x29eb48);};}exports[_0x8939('0x29')]=function(_0x31a4a9,_0x2bd19f){var _0x23f9a4={},_0x3424bc={},_0x34037b={'count':0x0,'rows':[]};var _0x44b0ab=_[_0x8939('0x2a')](db['ZohoAccount'][_0x8939('0x2b')],function(_0x1893d1){return{'name':_0x1893d1[_0x8939('0x2c')],'type':_0x1893d1[_0x8939('0x2d')][_0x8939('0x2e')]};});_0x3424bc['model']=_['map'](_0x44b0ab,_0x8939('0x27'));_0x3424bc[_0x8939('0x2f')]=_[_0x8939('0x30')](_0x31a4a9[_0x8939('0x2f')]);_0x3424bc[_0x8939('0x31')]=_[_0x8939('0x32')](_0x3424bc[_0x8939('0x33')],_0x3424bc[_0x8939('0x2f')]);_0x23f9a4[_0x8939('0x34')]=_[_0x8939('0x32')](_0x3424bc[_0x8939('0x33')],qs[_0x8939('0x35')](_0x31a4a9[_0x8939('0x2f')][_0x8939('0x35')]));_0x23f9a4[_0x8939('0x34')]=_0x23f9a4[_0x8939('0x34')][_0x8939('0x36')]?_0x23f9a4[_0x8939('0x34')]:_0x3424bc[_0x8939('0x33')];if(!_0x31a4a9['query']['hasOwnProperty']('nolimit')){_0x23f9a4['limit']=qs[_0x8939('0x37')](_0x31a4a9[_0x8939('0x2f')]['limit']);_0x23f9a4['offset']=qs[_0x8939('0x1f')](_0x31a4a9[_0x8939('0x2f')][_0x8939('0x1f')]);}_0x23f9a4[_0x8939('0x38')]=qs['sort'](_0x31a4a9[_0x8939('0x2f')][_0x8939('0x39')]);_0x23f9a4['where']=qs[_0x8939('0x31')](_[_0x8939('0x3a')](_0x31a4a9['query'],_0x3424bc[_0x8939('0x31')]),_0x44b0ab);if(_0x31a4a9[_0x8939('0x2f')][_0x8939('0x3b')]){_0x23f9a4[_0x8939('0x3c')]=_[_0x8939('0x3d')](_0x23f9a4[_0x8939('0x3c')],{'$or':_[_0x8939('0x2a')](_0x44b0ab,function(_0x3c5a12){if(_0x3c5a12[_0x8939('0x2d')]!=='VIRTUAL'){var _0x3f348c={};_0x3f348c[_0x3c5a12[_0x8939('0x27')]]={'$like':'%'+_0x31a4a9[_0x8939('0x2f')]['filter']+'%'};return _0x3f348c;}})});}_0x23f9a4=_[_0x8939('0x3d')]({},_0x23f9a4,_0x31a4a9['options']);var _0x53e3a2={'where':_0x23f9a4[_0x8939('0x3c')]};return db['ZohoAccount']['count'](_0x53e3a2)['then'](function(_0x610144){_0x34037b[_0x8939('0x20')]=_0x610144;if(_0x31a4a9['query'][_0x8939('0x3e')]){_0x23f9a4[_0x8939('0x3f')]=[{'all':!![]}];}return db[_0x8939('0x40')][_0x8939('0x41')](_0x23f9a4);})[_0x8939('0x42')](function(_0x1b0ce2){_0x34037b[_0x8939('0x43')]=_0x1b0ce2;return _0x34037b;})[_0x8939('0x42')](respondWithFilteredResult(_0x2bd19f,_0x23f9a4))[_0x8939('0x44')](handleError(_0x2bd19f,null));};exports[_0x8939('0x45')]=function(_0x11ca46,_0x2dd48e){var _0x3de86e={'raw':![],'where':{'id':_0x11ca46[_0x8939('0x46')]['id']}},_0x2e6b6f={};_0x2e6b6f[_0x8939('0x33')]=_[_0x8939('0x30')](db[_0x8939('0x40')]['rawAttributes']);_0x2e6b6f[_0x8939('0x2f')]=_['keys'](_0x11ca46[_0x8939('0x2f')]);_0x2e6b6f[_0x8939('0x31')]=_[_0x8939('0x32')](_0x2e6b6f[_0x8939('0x33')],_0x2e6b6f[_0x8939('0x2f')]);_0x3de86e[_0x8939('0x34')]=_[_0x8939('0x32')](_0x2e6b6f['model'],qs[_0x8939('0x35')](_0x11ca46[_0x8939('0x2f')][_0x8939('0x35')]));_0x3de86e[_0x8939('0x34')]=_0x3de86e[_0x8939('0x34')][_0x8939('0x36')]?_0x3de86e[_0x8939('0x34')]:_0x2e6b6f[_0x8939('0x33')];if(_0x11ca46[_0x8939('0x2f')]['includeAll']){_0x3de86e[_0x8939('0x3f')]=[{'all':!![]}];}_0x3de86e=_['merge']({},_0x3de86e,_0x11ca46[_0x8939('0x47')]);return db[_0x8939('0x40')][_0x8939('0x48')](_0x3de86e)[_0x8939('0x42')](handleEntityNotFound(_0x2dd48e,null))['then'](respondWithResult(_0x2dd48e,null))[_0x8939('0x44')](handleError(_0x2dd48e,null));};exports[_0x8939('0x49')]=function(_0xe92824,_0x4a5bc6){return db[_0x8939('0x40')][_0x8939('0x49')](_0xe92824[_0x8939('0x4a')],{})[_0x8939('0x42')](respondWithResult(_0x4a5bc6,0xc9))[_0x8939('0x44')](handleError(_0x4a5bc6,null));};exports['update']=function(_0x4420dd,_0x1c7434){if(_0x4420dd['body']['id']){delete _0x4420dd[_0x8939('0x4a')]['id'];}return db[_0x8939('0x40')][_0x8939('0x48')]({'where':{'id':_0x4420dd[_0x8939('0x46')]['id']}})[_0x8939('0x42')](handleEntityNotFound(_0x1c7434,null))['then'](saveUpdates(_0x4420dd[_0x8939('0x4a')],null))[_0x8939('0x42')](respondWithResult(_0x1c7434,null))[_0x8939('0x44')](handleError(_0x1c7434,null));};exports['destroy']=function(_0x572fb5,_0x37d825){return db[_0x8939('0x40')][_0x8939('0x48')]({'where':{'id':_0x572fb5['params']['id']}})['then'](handleEntityNotFound(_0x37d825,null))[_0x8939('0x42')](removeEntity(_0x37d825,null))[_0x8939('0x44')](handleError(_0x37d825,null));};exports[_0x8939('0x4b')]=function(_0x37aa5e,_0x1a340e,_0x1985b7){var _0x1c0480={};var _0x164d6e={};var _0x38ba73;var _0x4c6a51;return db[_0x8939('0x40')][_0x8939('0x4c')]({'where':{'id':_0x37aa5e['params']['id']}})['then'](handleEntityNotFound(_0x1a340e,null))['then'](function(_0x1a0506){if(_0x1a0506){_0x38ba73=_0x1a0506;_0x164d6e[_0x8939('0x33')]=_[_0x8939('0x30')](db[_0x8939('0x4d')][_0x8939('0x2b')]);_0x164d6e[_0x8939('0x2f')]=_['keys'](_0x37aa5e[_0x8939('0x2f')]);_0x164d6e[_0x8939('0x31')]=_[_0x8939('0x32')](_0x164d6e[_0x8939('0x33')],_0x164d6e['query']);_0x1c0480[_0x8939('0x34')]=_[_0x8939('0x32')](_0x164d6e[_0x8939('0x33')],qs['fields'](_0x37aa5e[_0x8939('0x2f')][_0x8939('0x35')]));_0x1c0480[_0x8939('0x34')]=_0x1c0480[_0x8939('0x34')]['length']?_0x1c0480[_0x8939('0x34')]:_0x164d6e[_0x8939('0x33')];_0x1c0480['order']=qs[_0x8939('0x39')](_0x37aa5e[_0x8939('0x2f')]['sort']);_0x1c0480[_0x8939('0x3c')]=qs[_0x8939('0x31')](_['pick'](_0x37aa5e[_0x8939('0x2f')],_0x164d6e['filters']));if(_0x37aa5e['query']['filter']){_0x1c0480['where']=_[_0x8939('0x3d')](_0x1c0480['where'],{'$or':_[_0x8939('0x2a')](_0x1c0480[_0x8939('0x34')],function(_0x2abf9f){var _0x11caa1={};_0x11caa1[_0x2abf9f]={'$like':'%'+_0x37aa5e[_0x8939('0x2f')]['filter']+'%'};return _0x11caa1;})});}_0x1c0480=_['merge']({},_0x1c0480,_0x37aa5e[_0x8939('0x47')]);return _0x38ba73[_0x8939('0x4b')](_0x1c0480);}})[_0x8939('0x42')](function(_0x1542e8){if(_0x1542e8){_0x4c6a51=_0x1542e8[_0x8939('0x36')];if(!_0x37aa5e[_0x8939('0x2f')]['hasOwnProperty']('nolimit')){_0x1c0480[_0x8939('0x37')]=qs['limit'](_0x37aa5e[_0x8939('0x2f')][_0x8939('0x37')]);_0x1c0480[_0x8939('0x1f')]=qs[_0x8939('0x1f')](_0x37aa5e[_0x8939('0x2f')][_0x8939('0x1f')]);}return _0x38ba73[_0x8939('0x4b')](_0x1c0480);}})[_0x8939('0x42')](function(_0x20b97d){if(_0x20b97d){return _0x20b97d?{'count':_0x4c6a51,'rows':_0x20b97d}:null;}})[_0x8939('0x42')](respondWithResult(_0x1a340e,null))[_0x8939('0x44')](handleError(_0x1a340e,null));};exports[_0x8939('0x4e')]=function(_0x460e5a,_0x40a28b,_0x309bf8){if(_0x460e5a['body']['id']){delete _0x460e5a['body']['id'];}return db[_0x8939('0x40')][_0x8939('0x4c')]({'where':{'id':_0x460e5a[_0x8939('0x46')]['id']}})[_0x8939('0x42')](handleEntityNotFound(_0x40a28b,null))[_0x8939('0x42')](function(_0x49f11b){if(_0x49f11b){_0x460e5a[_0x8939('0x4a')][_0x8939('0x4f')]=_0x49f11b['id'];_0x460e5a['body'][_0x8939('0x50')]=integrations[_0x8939('0x51')](_0x460e5a[_0x8939('0x4a')][_0x8939('0x52')],_0x460e5a[_0x8939('0x4a')][_0x8939('0x2d')]);_0x460e5a[_0x8939('0x4a')][_0x8939('0x53')]=integrations[_0x8939('0x54')](_0x460e5a[_0x8939('0x4a')]['channel'],_0x460e5a[_0x8939('0x4a')][_0x8939('0x2d')]);return db[_0x8939('0x4d')][_0x8939('0x49')](_0x460e5a[_0x8939('0x4a')],{'include':[{'model':db[_0x8939('0x55')],'as':_0x8939('0x50')},{'model':db['ZohoField'],'as':_0x8939('0x53')}]});}return null;})['then'](respondWithResult(_0x40a28b,null))[_0x8939('0x44')](handleError(_0x40a28b,null));};function getAccessToken(_0x422bcb){return new Promise(function(_0x50f681,_0x34fefc){var _0x1701ac;switch(_0x422bcb[_0x8939('0x56')]){case'US':_0x1701ac=_0x8939('0x57');break;case'AU':_0x1701ac=_0x8939('0x58');break;case'EU':_0x1701ac=_0x8939('0x59');break;case'IN':_0x1701ac='https://accounts.zoho.in';break;case'CN':_0x1701ac=_0x8939('0x5a');break;default:_0x1701ac=_0x8939('0x59');break;}var _0x3c2eeb={'method':_0x8939('0x5b'),'uri':_0x1701ac+_0x8939('0x5c'),'qs':{'refresh_token':_0x422bcb[_0x8939('0x5d')],'client_id':_0x422bcb[_0x8939('0x5e')],'client_secret':_0x422bcb[_0x8939('0x5f')],'grant_type':_0x8939('0x60')},'json':!![]};return rp(_0x3c2eeb)['then'](function(_0x1484dd){if(_0x1484dd[_0x8939('0x61')]){_0x50f681(_0x1484dd[_0x8939('0x61')]);}else{_0x34fefc(_0x8939('0x62'));}})['catch'](function(_0x5d371d){_0x34fefc(_0x5d371d);});});}exports[_0x8939('0x63')]=function(_0x44e25a,_0x54025f,_0x4839be){var _0x4cbc0c,_0x28d2ed,_0x331998,_0x55c19f,_0x534131;return db[_0x8939('0x40')][_0x8939('0x4c')]({'where':{'id':_0x44e25a['params']['id']},'attributes':['id',_0x8939('0x64'),_0x8939('0x56'),_0x8939('0x5e'),_0x8939('0x5f'),_0x8939('0x65'),_0x8939('0x66'),_0x8939('0x5d')]})[_0x8939('0x42')](handleEntityNotFound(_0x54025f,null))[_0x8939('0x42')](function(_0x589043){_0x534131=_0x589043;_0x4cbc0c=_0x534131[_0x8939('0x64')];_0x28d2ed=_0x4cbc0c===_0x8939('0x67')?'eu':_0x8939('0x68');_0x331998=_0x534131['serverUrl'];var _0x59c1dc=_0x331998['slice'](-0x1);if(_0x59c1dc==='/'||_0x59c1dc==='\x5c'||_0x59c1dc===':'){_0x331998=_0x331998[_0x8939('0x69')](0x0,_0x331998[_0x8939('0x6a')](_0x59c1dc));}if(!_0x534131['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x534131);})[_0x8939('0x42')](function(_0x12808){if(_0x12808){return rp({'method':_0x8939('0x6b'),'uri':util['format'](_0x8939('0x6c'),_0x28d2ed),'qs':{'module':'Calls'},'headers':{'Authorization':_0x8939('0x6d')+_0x12808},'json':!![]});}})[_0x8939('0x42')](function(_0xfe14a4){if(_0xfe14a4){if(_0xfe14a4[_0x8939('0x6e')]&&_0xfe14a4['response'][_0x8939('0x6f')]){throw new Error(_0xfe14a4['response'][_0x8939('0x6f')]['message']);}var _0x18e140=[];var _0x2e10ed=[];var _0x44e4cb=[_0x8939('0x70'),_0x8939('0x71'),_0x8939('0x72'),'WhoId',_0x8939('0x73'),'Call_Result',_0x8939('0x74'),_0x8939('0x75')];_0x2e10ed=_['remove'](_0xfe14a4[_0x8939('0x35')],function(_0x2ff529){return _0x44e4cb['includes'](_0x2ff529[_0x8939('0x76')]);});for(var _0x4292b2=0x0;_0x4292b2<_0x2e10ed['length'];_0x4292b2++){if(_0x2e10ed[_0x4292b2][_0x8939('0x77')]===![]){_0x18e140['push']({'id':_0x2e10ed[_0x4292b2]['id'],'name':_0x2e10ed[_0x4292b2][_0x8939('0x78')],'custom':_0x2e10ed[_0x4292b2][_0x8939('0x79')],'options':_0x2e10ed[_0x4292b2][_0x8939('0x7a')]==='picklist'&&_0x2e10ed[_0x4292b2]['pick_list_values'][_0x8939('0x36')]>-0x1?_[_0x8939('0x2a')](_0x2e10ed[_0x4292b2][_0x8939('0x7b')],function(_0x2fcc80){return{'name':_0x2fcc80,'value':_0x2fcc80};}):[]});}}return{'count':_0x18e140[_0x8939('0x36')],'rows':_0x18e140};}else{return{'count':0x0,'rows':[]};}})[_0x8939('0x42')](respondWithResult(_0x54025f,null))['catch'](function(_0x1158d9){var _0x3f6140=_0x44e25a[_0x8939('0x2f')]['test']?0x1f4:_0x1158d9[_0x8939('0x7c')]||0x1f4;logger[_0x8939('0x6f')](_0x8939('0x7d'),_0x8939('0x63'),_0x3f6140,JSON['stringify'](_0x1158d9));delete _0x1158d9[_0x8939('0x27')];if(_0x3f6140===0x191){_0x3f6140=0x190;}_0x54025f[_0x8939('0x21')](_0x3f6140)[_0x8939('0x28')](_0x44e25a[_0x8939('0x2f')][_0x8939('0x7e')]?{'message':_0x8939('0x7f'),'statusCode':_0x1158d9[_0x8939('0x7c')]}:_0x1158d9);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 7b4fbd7..4401db2 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 _0x1507=['then','parse','refresh_token','refreshToken','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','slice','substring','https://accounts.zoho.in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','zone','serverUrl','clientId','changed','code','host','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1507,0x67));var _0x7150=function(_0x5c2bef,_0x16806e){_0x5c2bef=_0x5c2bef-0x0;var _0xd60cc1=_0x1507[_0x5c2bef];return _0xd60cc1;};'use strict';var _=require(_0x7150('0x0'));var util=require(_0x7150('0x1'));var logger=require(_0x7150('0x2'))(_0x7150('0x3'));var moment=require(_0x7150('0x4'));var BPromise=require(_0x7150('0x5'));var rp=require(_0x7150('0x6'));var fs=require('fs');var path=require(_0x7150('0x7'));var rimraf=require('rimraf');var config=require(_0x7150('0x8'));var attributes=require(_0x7150('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7150('0xa')]=function(_0x217a86,_0x1efff0){return _0x217a86['define'](_0x7150('0xb'),attributes,{'tableName':_0x7150('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5cb81e,_0x5dcf73,_0x53dd18){if(_0x5cb81e['changed'](_0x7150('0xd'))||_0x5cb81e['changed'](_0x7150('0xe'))||_0x5cb81e['changed'](_0x7150('0xf'))||_0x5cb81e['changed']('clientSecret')||_0x5cb81e[_0x7150('0x10')](_0x7150('0x11'))||_0x5cb81e['changed'](_0x7150('0x12'))){var _0x12dc42,_0x32e5b4;_0x12dc42=_0x5cb81e['serverUrl'];var _0x595eed=_0x12dc42['slice'](-0x1);if(_0x595eed==='/'||_0x595eed==='\x5c'||_0x595eed===':'){_0x12dc42=_0x12dc42['substring'](0x0,_0x12dc42[_0x7150('0x13')](_0x595eed));}switch(_0x5cb81e[_0x7150('0xd')]){case'US':_0x32e5b4=_0x7150('0x14');break;case'AU':_0x32e5b4=_0x7150('0x15');break;case'IN':_0x32e5b4='https://accounts.zoho.in';break;case'CN':_0x32e5b4=_0x7150('0x16');break;default:_0x32e5b4=_0x7150('0x17');break;}var _0x19300f={'method':_0x7150('0x18'),'uri':_0x32e5b4+_0x7150('0x19'),'form':{'grant_type':_0x7150('0x1a'),'client_id':_0x5cb81e[_0x7150('0xf')],'client_secret':_0x5cb81e[_0x7150('0x1b')],'redirect_uri':_0x5cb81e['serverUrl'],'code':_0x5cb81e[_0x7150('0x11')]},'headers':{'Content-Type':_0x7150('0x1c')}};return rp(_0x19300f)[_0x7150('0x1d')](function(_0x5ab33d){var _0x291844=JSON[_0x7150('0x1e')](_0x5ab33d);if(_0x291844[_0x7150('0x1f')]){_0x5cb81e[_0x7150('0x20')]=_0x291844[_0x7150('0x1f')];logger[_0x7150('0x21')](util[_0x7150('0x22')](_0x7150('0x23'),_0x5cb81e[_0x7150('0x24')],_0x5cb81e['id']));}else{logger['error'](util[_0x7150('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5cb81e['name'],_0x5cb81e['id']),util[_0x7150('0x25')](_0x291844,{'showHidden':![],'depth':null}));}return _0x53dd18(null,_0x5dcf73);})[_0x7150('0x26')](function(_0x799be8){logger[_0x7150('0x27')](util[_0x7150('0x22')](_0x7150('0x28'),_0x5cb81e[_0x7150('0x24')],_0x5cb81e['id']),util[_0x7150('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x53dd18(_0x799be8);});}else{return _0x53dd18(null,_0x5dcf73);}},'beforeUpdate':function(_0x7f1cc,_0x1e522f,_0x5978f0){if(_0x7f1cc['changed'](_0x7150('0xd'))||_0x7f1cc[_0x7150('0x10')]('serverUrl')||_0x7f1cc[_0x7150('0x10')](_0x7150('0xf'))||_0x7f1cc[_0x7150('0x10')]('clientSecret')||_0x7f1cc[_0x7150('0x10')](_0x7150('0x11'))||_0x7f1cc['changed'](_0x7150('0x12'))){var _0x15f6bd,_0x4fe164;_0x15f6bd=_0x7f1cc[_0x7150('0xe')];var _0x5148e1=_0x15f6bd[_0x7150('0x29')](-0x1);if(_0x5148e1==='/'||_0x5148e1==='\x5c'||_0x5148e1===':'){_0x15f6bd=_0x15f6bd[_0x7150('0x2a')](0x0,_0x15f6bd[_0x7150('0x13')](_0x5148e1));}switch(_0x7f1cc[_0x7150('0xd')]){case'US':_0x4fe164='https://accounts.zoho.com';break;case'AU':_0x4fe164=_0x7150('0x15');break;case'IN':_0x4fe164=_0x7150('0x2b');break;case'CN':_0x4fe164=_0x7150('0x16');break;default:_0x4fe164=_0x7150('0x17');break;}var _0x51d315={'method':'POST','uri':_0x4fe164+_0x7150('0x19'),'form':{'grant_type':_0x7150('0x1a'),'client_id':_0x7f1cc[_0x7150('0xf')],'client_secret':_0x7f1cc['clientSecret'],'redirect_uri':_0x7f1cc['serverUrl'],'code':_0x7f1cc[_0x7150('0x11')]},'headers':{'Content-Type':_0x7150('0x1c')}};return rp(_0x51d315)[_0x7150('0x1d')](function(_0x2fae54){var _0x333f4c=JSON[_0x7150('0x1e')](_0x2fae54);if(_0x333f4c[_0x7150('0x1f')]){_0x7f1cc[_0x7150('0x20')]=_0x333f4c[_0x7150('0x1f')];logger[_0x7150('0x21')](util['format'](_0x7150('0x23'),_0x7f1cc[_0x7150('0x24')],_0x7f1cc['id']));}else{logger['error'](util[_0x7150('0x22')](_0x7150('0x28'),_0x7f1cc['name'],_0x7f1cc['id']),util[_0x7150('0x25')](_0x333f4c,{'showHidden':![],'depth':null}));}return _0x5978f0(null,_0x1e522f);})[_0x7150('0x26')](function(_0x1a7ed5){logger['error'](util[_0x7150('0x22')](_0x7150('0x28'),_0x7f1cc[_0x7150('0x24')],_0x7f1cc['id']),util[_0x7150('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x5978f0(_0x1a7ed5);});}else{return _0x5978f0(null,_0x1e522f);}}}});}; \ No newline at end of file +var _0x6bd6=['ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','clientId','clientSecret','code','host','serverUrl','slice','substring','lastIndexOf','zone','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','then','parse','refreshToken','refresh_token','info'];(function(_0x4ecffb,_0x58d337){var _0x34c6c5=function(_0x14448a){while(--_0x14448a){_0x4ecffb['push'](_0x4ecffb['shift']());}};_0x34c6c5(++_0x58d337);}(_0x6bd6,0x15f));var _0x66bd=function(_0x37b0e1,_0x5f3934){_0x37b0e1=_0x37b0e1-0x0;var _0x24e3b2=_0x6bd6[_0x37b0e1];return _0x24e3b2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x66bd('0x0'))(_0x66bd('0x1'));var moment=require(_0x66bd('0x2'));var BPromise=require(_0x66bd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x66bd('0x4'));var rimraf=require(_0x66bd('0x5'));var config=require(_0x66bd('0x6'));var attributes=require(_0x66bd('0x7'));var integrations=require(_0x66bd('0x8'));module[_0x66bd('0x9')]=function(_0x2ff640,_0x55407b){return _0x2ff640[_0x66bd('0xa')](_0x66bd('0xb'),attributes,{'tableName':_0x66bd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x46ec45,_0xec21ad,_0x3692a8){if(_0x46ec45[_0x66bd('0xd')]('zone')||_0x46ec45[_0x66bd('0xd')]('serverUrl')||_0x46ec45[_0x66bd('0xd')](_0x66bd('0xe'))||_0x46ec45['changed'](_0x66bd('0xf'))||_0x46ec45['changed'](_0x66bd('0x10'))||_0x46ec45[_0x66bd('0xd')](_0x66bd('0x11'))){var _0x541499,_0xc56574;_0x541499=_0x46ec45[_0x66bd('0x12')];var _0xce200=_0x541499[_0x66bd('0x13')](-0x1);if(_0xce200==='/'||_0xce200==='\x5c'||_0xce200===':'){_0x541499=_0x541499[_0x66bd('0x14')](0x0,_0x541499[_0x66bd('0x15')](_0xce200));}switch(_0x46ec45[_0x66bd('0x16')]){case'US':_0xc56574=_0x66bd('0x17');break;case'AU':_0xc56574=_0x66bd('0x18');break;case'IN':_0xc56574=_0x66bd('0x19');break;case'CN':_0xc56574=_0x66bd('0x1a');break;default:_0xc56574=_0x66bd('0x1b');break;}var _0x53ed4f={'method':_0x66bd('0x1c'),'uri':_0xc56574+_0x66bd('0x1d'),'form':{'grant_type':_0x66bd('0x1e'),'client_id':_0x46ec45[_0x66bd('0xe')],'client_secret':_0x46ec45['clientSecret'],'redirect_uri':_0x46ec45['serverUrl'],'code':_0x46ec45[_0x66bd('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x53ed4f)[_0x66bd('0x1f')](function(_0x132203){var _0x19bc4e=JSON[_0x66bd('0x20')](_0x132203);if(_0x19bc4e['refresh_token']){_0x46ec45[_0x66bd('0x21')]=_0x19bc4e[_0x66bd('0x22')];logger[_0x66bd('0x23')](util['format'](_0x66bd('0x24'),_0x46ec45['name'],_0x46ec45['id']));}else{logger[_0x66bd('0x25')](util[_0x66bd('0x26')](_0x66bd('0x27'),_0x46ec45[_0x66bd('0x28')],_0x46ec45['id']),util[_0x66bd('0x29')](_0x19bc4e,{'showHidden':![],'depth':null}));}return _0x3692a8(null,_0xec21ad);})[_0x66bd('0x2a')](function(_0x4618f3){logger[_0x66bd('0x25')](util['format'](_0x66bd('0x27'),_0x46ec45[_0x66bd('0x28')],_0x46ec45['id']),util[_0x66bd('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x3692a8(_0x4618f3);});}else{return _0x3692a8(null,_0xec21ad);}},'beforeUpdate':function(_0x51a7be,_0x2d93f0,_0x49dc86){if(_0x51a7be['changed']('zone')||_0x51a7be[_0x66bd('0xd')](_0x66bd('0x12'))||_0x51a7be[_0x66bd('0xd')]('clientId')||_0x51a7be['changed'](_0x66bd('0xf'))||_0x51a7be['changed']('code')||_0x51a7be[_0x66bd('0xd')](_0x66bd('0x11'))){var _0x49ff8e,_0x19a8da;_0x49ff8e=_0x51a7be[_0x66bd('0x12')];var _0x2871f8=_0x49ff8e[_0x66bd('0x13')](-0x1);if(_0x2871f8==='/'||_0x2871f8==='\x5c'||_0x2871f8===':'){_0x49ff8e=_0x49ff8e[_0x66bd('0x14')](0x0,_0x49ff8e[_0x66bd('0x15')](_0x2871f8));}switch(_0x51a7be['zone']){case'US':_0x19a8da=_0x66bd('0x17');break;case'AU':_0x19a8da=_0x66bd('0x18');break;case'IN':_0x19a8da='https://accounts.zoho.in';break;case'CN':_0x19a8da=_0x66bd('0x1a');break;default:_0x19a8da='https://accounts.zoho.eu';break;}var _0x14c502={'method':'POST','uri':_0x19a8da+_0x66bd('0x1d'),'form':{'grant_type':'authorization_code','client_id':_0x51a7be[_0x66bd('0xe')],'client_secret':_0x51a7be[_0x66bd('0xf')],'redirect_uri':_0x51a7be[_0x66bd('0x12')],'code':_0x51a7be['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x14c502)[_0x66bd('0x1f')](function(_0x71b3a0){var _0x5d69e2=JSON[_0x66bd('0x20')](_0x71b3a0);if(_0x5d69e2['refresh_token']){_0x51a7be['refreshToken']=_0x5d69e2[_0x66bd('0x22')];logger[_0x66bd('0x23')](util[_0x66bd('0x26')](_0x66bd('0x24'),_0x51a7be[_0x66bd('0x28')],_0x51a7be['id']));}else{logger[_0x66bd('0x25')](util[_0x66bd('0x26')](_0x66bd('0x27'),_0x51a7be[_0x66bd('0x28')],_0x51a7be['id']),util[_0x66bd('0x29')](_0x5d69e2,{'showHidden':![],'depth':null}));}return _0x49dc86(null,_0x2d93f0);})[_0x66bd('0x2a')](function(_0x56dc8a){logger['error'](util[_0x66bd('0x26')](_0x66bd('0x27'),_0x51a7be[_0x66bd('0x28')],_0x51a7be['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x49dc86(_0x56dc8a);});}else{return _0x49dc86(null,_0x2d93f0);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 720699f..1e7b97d 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 _0xdf94=['http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','stringify','ShowZohoAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x157a62,_0x1749db){var _0x31dc98=function(_0x5b5dc1){while(--_0x5b5dc1){_0x157a62['push'](_0x157a62['shift']());}};_0x31dc98(++_0x1749db);}(_0xdf94,0xad));var _0x4df9=function(_0x2fcff0,_0x3d04d6){_0x2fcff0=_0x2fcff0-0x0;var _0x3ca71b=_0xdf94[_0x2fcff0];return _0x3ca71b;};'use strict';var _=require('lodash');var util=require(_0x4df9('0x0'));var moment=require(_0x4df9('0x1'));var BPromise=require(_0x4df9('0x2'));var rs=require(_0x4df9('0x3'));var fs=require('fs');var Redis=require(_0x4df9('0x4'));var db=require(_0x4df9('0x5'))['db'];var utils=require(_0x4df9('0x6'));var logger=require(_0x4df9('0x7'))(_0x4df9('0x8'));var config=require(_0x4df9('0x9'));var jayson=require(_0x4df9('0xa'));var client=jayson[_0x4df9('0xb')][_0x4df9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f46e3,_0x34faba,_0x2fac37){return new BPromise(function(_0x39ebc3,_0xf808f0){return client['request'](_0x2f46e3,_0x2fac37)[_0x4df9('0xd')](function(_0x3eaca1){logger[_0x4df9('0xe')](_0x4df9('0xf'),_0x34faba,_0x4df9('0x10'));logger[_0x4df9('0x11')](_0x4df9('0x12'),_0x34faba,'request\x20sent',JSON['stringify'](_0x3eaca1));if(_0x3eaca1[_0x4df9('0x13')]){if(_0x3eaca1['error'][_0x4df9('0x14')]===0x1f4){logger[_0x4df9('0x13')](_0x4df9('0xf'),_0x34faba,_0x3eaca1[_0x4df9('0x13')]['message']);return _0xf808f0(_0x3eaca1[_0x4df9('0x13')][_0x4df9('0x15')]);}logger[_0x4df9('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x34faba,_0x3eaca1[_0x4df9('0x13')][_0x4df9('0x15')]);return _0x39ebc3(_0x3eaca1[_0x4df9('0x13')]['message']);}else{logger[_0x4df9('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x34faba,_0x4df9('0x10'));_0x39ebc3(_0x3eaca1[_0x4df9('0x16')][_0x4df9('0x15')]);}})[_0x4df9('0x17')](function(_0x5d2910){logger[_0x4df9('0x13')](_0x4df9('0xf'),_0x34faba,_0x5d2910);_0xf808f0(_0x5d2910);});});}exports[_0x4df9('0x18')]=function(_0x59d4e9){var _0xa9d338=this;return new Promise(function(_0x5a807f,_0x41e662){return db[_0x4df9('0x19')][_0x4df9('0x1a')]({'raw':_0x59d4e9[_0x4df9('0x1b')]?_0x59d4e9[_0x4df9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x59d4e9['options']?_0x59d4e9['options'][_0x4df9('0x1c')]||null:null,'attributes':_0x59d4e9[_0x4df9('0x1b')]?_0x59d4e9[_0x4df9('0x1b')][_0x4df9('0x1d')]||null:null,'limit':_0x59d4e9[_0x4df9('0x1b')]?_0x59d4e9[_0x4df9('0x1b')][_0x4df9('0x1e')]||null:null,'include':_0x59d4e9['options']?_0x59d4e9[_0x4df9('0x1b')][_0x4df9('0x1f')]?_[_0x4df9('0x20')](_0x59d4e9[_0x4df9('0x1b')][_0x4df9('0x1f')],function(_0x56fd4b){return{'model':db[_0x56fd4b[_0x4df9('0x21')]],'as':_0x56fd4b['as'],'attributes':_0x56fd4b[_0x4df9('0x1d')],'include':_0x56fd4b['include']?_['map'](_0x56fd4b[_0x4df9('0x1f')],function(_0x2ba01c){return{'model':db[_0x2ba01c['model']],'as':_0x2ba01c['as'],'attributes':_0x2ba01c[_0x4df9('0x1d')],'include':_0x2ba01c[_0x4df9('0x1f')]?_[_0x4df9('0x20')](_0x2ba01c[_0x4df9('0x1f')],function(_0x233150){return{'model':db[_0x233150[_0x4df9('0x21')]],'as':_0x233150['as'],'attributes':_0x233150['attributes']};}):[]};}):[]};}):[]:[]})[_0x4df9('0xd')](function(_0x38c7a9){logger['info'](_0x4df9('0x18'),_0x59d4e9);logger[_0x4df9('0x11')](_0x4df9('0x18'),_0x59d4e9,JSON[_0x4df9('0x22')](_0x38c7a9));_0x5a807f(_0x38c7a9);})['catch'](function(_0x441f30){logger[_0x4df9('0x13')](_0x4df9('0x18'),_0x441f30[_0x4df9('0x15')],_0x59d4e9);_0x41e662(_0xa9d338[_0x4df9('0x13')](0x1f4,_0x441f30[_0x4df9('0x15')]));});});};exports[_0x4df9('0x23')]=function(_0x42aa30){var _0x52b346=this;return new Promise(function(_0x150b6a,_0x3079f4){return db[_0x4df9('0x19')][_0x4df9('0x24')]({'raw':_0x42aa30['options']?_0x42aa30[_0x4df9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x42aa30[_0x4df9('0x1b')]?_0x42aa30[_0x4df9('0x1b')][_0x4df9('0x1c')]||null:null,'attributes':_0x42aa30['options']?_0x42aa30['options']['attributes']||null:null,'include':_0x42aa30['options']?_0x42aa30[_0x4df9('0x1b')][_0x4df9('0x1f')]?_['map'](_0x42aa30['options'][_0x4df9('0x1f')],function(_0x4da4d2){return{'model':db[_0x4da4d2[_0x4df9('0x21')]],'as':_0x4da4d2['as'],'attributes':_0x4da4d2['attributes'],'include':_0x4da4d2[_0x4df9('0x1f')]?_[_0x4df9('0x20')](_0x4da4d2['include'],function(_0x5b84c8){return{'model':db[_0x5b84c8[_0x4df9('0x21')]],'as':_0x5b84c8['as'],'attributes':_0x5b84c8[_0x4df9('0x1d')],'include':_0x5b84c8[_0x4df9('0x1f')]?_[_0x4df9('0x20')](_0x5b84c8[_0x4df9('0x1f')],function(_0x514fb1){return{'model':db[_0x514fb1['model']],'as':_0x514fb1['as'],'attributes':_0x514fb1[_0x4df9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4df9('0xd')](function(_0xa5655d){logger[_0x4df9('0xe')](_0x4df9('0x23'),_0x42aa30);logger[_0x4df9('0x11')](_0x4df9('0x23'),_0x42aa30,JSON[_0x4df9('0x22')](_0xa5655d));_0x150b6a(_0xa5655d);})['catch'](function(_0x7f96cf){logger[_0x4df9('0x13')](_0x4df9('0x23'),_0x7f96cf[_0x4df9('0x15')],_0x42aa30);_0x3079f4(_0x52b346[_0x4df9('0x13')](0x1f4,_0x7f96cf[_0x4df9('0x15')]));});});}; \ No newline at end of file +var _0xfa25=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','ZohoAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','GetZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','ShowZohoAccount','ZohoAccount','find','util'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfa25,0xd1));var _0x5fa2=function(_0xdf1c7a,_0x230eab){_0xdf1c7a=_0xdf1c7a-0x0;var _0x58789b=_0xfa25[_0xdf1c7a];return _0x58789b;};'use strict';var _=require('lodash');var util=require(_0x5fa2('0x0'));var moment=require(_0x5fa2('0x1'));var BPromise=require(_0x5fa2('0x2'));var rs=require(_0x5fa2('0x3'));var fs=require('fs');var Redis=require(_0x5fa2('0x4'));var db=require(_0x5fa2('0x5'))['db'];var utils=require(_0x5fa2('0x6'));var logger=require(_0x5fa2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5fa2('0x8'));var client=jayson[_0x5fa2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53a560,_0x2a9a69,_0x4b04ea){return new BPromise(function(_0x35c145,_0x9c9f1c){return client[_0x5fa2('0xa')](_0x53a560,_0x4b04ea)['then'](function(_0x36778e){logger[_0x5fa2('0xb')](_0x5fa2('0xc'),_0x2a9a69,'request\x20sent');logger[_0x5fa2('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x2a9a69,'request\x20sent',JSON[_0x5fa2('0xe')](_0x36778e));if(_0x36778e[_0x5fa2('0xf')]){if(_0x36778e['error'][_0x5fa2('0x10')]===0x1f4){logger[_0x5fa2('0xf')](_0x5fa2('0xc'),_0x2a9a69,_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);return _0x9c9f1c(_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);}logger[_0x5fa2('0xf')](_0x5fa2('0xc'),_0x2a9a69,_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);return _0x35c145(_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);}else{logger[_0x5fa2('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x2a9a69,_0x5fa2('0x12'));_0x35c145(_0x36778e[_0x5fa2('0x13')][_0x5fa2('0x11')]);}})['catch'](function(_0x4e20d1){logger[_0x5fa2('0xf')](_0x5fa2('0xc'),_0x2a9a69,_0x4e20d1);_0x9c9f1c(_0x4e20d1);});});}exports[_0x5fa2('0x14')]=function(_0x522f1c){var _0x427205=this;return new Promise(function(_0x593815,_0x41be51){return db['ZohoAccount'][_0x5fa2('0x15')]({'raw':_0x522f1c[_0x5fa2('0x16')]?_0x522f1c['options'][_0x5fa2('0x17')]===undefined?!![]:![]:!![],'where':_0x522f1c[_0x5fa2('0x16')]?_0x522f1c[_0x5fa2('0x16')][_0x5fa2('0x18')]||null:null,'attributes':_0x522f1c['options']?_0x522f1c[_0x5fa2('0x16')][_0x5fa2('0x19')]||null:null,'limit':_0x522f1c[_0x5fa2('0x16')]?_0x522f1c[_0x5fa2('0x16')][_0x5fa2('0x1a')]||null:null,'include':_0x522f1c[_0x5fa2('0x16')]?_0x522f1c[_0x5fa2('0x16')][_0x5fa2('0x1b')]?_[_0x5fa2('0x1c')](_0x522f1c[_0x5fa2('0x16')][_0x5fa2('0x1b')],function(_0x2cac01){return{'model':db[_0x2cac01[_0x5fa2('0x1d')]],'as':_0x2cac01['as'],'attributes':_0x2cac01['attributes'],'include':_0x2cac01[_0x5fa2('0x1b')]?_[_0x5fa2('0x1c')](_0x2cac01[_0x5fa2('0x1b')],function(_0x45af15){return{'model':db[_0x45af15['model']],'as':_0x45af15['as'],'attributes':_0x45af15['attributes'],'include':_0x45af15[_0x5fa2('0x1b')]?_[_0x5fa2('0x1c')](_0x45af15['include'],function(_0x12b99b){return{'model':db[_0x12b99b[_0x5fa2('0x1d')]],'as':_0x12b99b['as'],'attributes':_0x12b99b[_0x5fa2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5fa2('0x1e')](function(_0x18cbd7){logger[_0x5fa2('0xb')]('GetZohoAccount',_0x522f1c);logger[_0x5fa2('0xd')](_0x5fa2('0x14'),_0x522f1c,JSON[_0x5fa2('0xe')](_0x18cbd7));_0x593815(_0x18cbd7);})[_0x5fa2('0x1f')](function(_0x4fd561){logger[_0x5fa2('0xf')](_0x5fa2('0x14'),_0x4fd561['message'],_0x522f1c);_0x41be51(_0x427205['error'](0x1f4,_0x4fd561['message']));});});};exports[_0x5fa2('0x20')]=function(_0xc5a40c){var _0x5a0d50=this;return new Promise(function(_0x22f054,_0x3d1d41){return db[_0x5fa2('0x21')][_0x5fa2('0x22')]({'raw':_0xc5a40c[_0x5fa2('0x16')]?_0xc5a40c['options'][_0x5fa2('0x17')]===undefined?!![]:![]:!![],'where':_0xc5a40c[_0x5fa2('0x16')]?_0xc5a40c[_0x5fa2('0x16')][_0x5fa2('0x18')]||null:null,'attributes':_0xc5a40c[_0x5fa2('0x16')]?_0xc5a40c['options'][_0x5fa2('0x19')]||null:null,'include':_0xc5a40c[_0x5fa2('0x16')]?_0xc5a40c['options']['include']?_['map'](_0xc5a40c[_0x5fa2('0x16')][_0x5fa2('0x1b')],function(_0x293948){return{'model':db[_0x293948['model']],'as':_0x293948['as'],'attributes':_0x293948[_0x5fa2('0x19')],'include':_0x293948[_0x5fa2('0x1b')]?_['map'](_0x293948['include'],function(_0x3ba30e){return{'model':db[_0x3ba30e['model']],'as':_0x3ba30e['as'],'attributes':_0x3ba30e[_0x5fa2('0x19')],'include':_0x3ba30e[_0x5fa2('0x1b')]?_['map'](_0x3ba30e[_0x5fa2('0x1b')],function(_0x5e7419){return{'model':db[_0x5e7419[_0x5fa2('0x1d')]],'as':_0x5e7419['as'],'attributes':_0x5e7419['attributes']};}):[]};}):[]};}):[]:[]})[_0x5fa2('0x1e')](function(_0x2e9614){logger['info'](_0x5fa2('0x20'),_0xc5a40c);logger[_0x5fa2('0xd')](_0x5fa2('0x20'),_0xc5a40c,JSON[_0x5fa2('0xe')](_0x2e9614));_0x22f054(_0x2e9614);})[_0x5fa2('0x1f')](function(_0x2e0a26){logger[_0x5fa2('0xf')](_0x5fa2('0x20'),_0x2e0a26[_0x5fa2('0x11')],_0xc5a40c);_0x3d1d41(_0x5a0d50[_0x5fa2('0xf')](0x1f4,_0x2e0a26[_0x5fa2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 7bc85e2..7d7614a 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 _0x836e=['getDescriptions','put','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','getFields','getSubjects','/:id/descriptions'];(function(_0x5280a4,_0x31a82b){var _0x60dd06=function(_0x2633c1){while(--_0x2633c1){_0x5280a4['push'](_0x5280a4['shift']());}};_0x60dd06(++_0x31a82b);}(_0x836e,0xa5));var _0xe836=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x836e[_0x4fbfd9];return _0x31dc94;};'use strict';var multer=require(_0xe836('0x0'));var util=require('util');var path=require(_0xe836('0x1'));var timeout=require('connect-timeout');var express=require(_0xe836('0x2'));var router=express[_0xe836('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe836('0x4'));var interaction=require(_0xe836('0x5'));var config=require(_0xe836('0x6'));var controller=require(_0xe836('0x7'));router['get']('/',auth[_0xe836('0x8')](),controller[_0xe836('0x9')]);router[_0xe836('0xa')](_0xe836('0xb'),auth[_0xe836('0x8')](),controller['show']);router[_0xe836('0xa')]('/:id/fields',auth[_0xe836('0x8')](),controller[_0xe836('0xc')]);router[_0xe836('0xa')]('/:id/subjects',auth[_0xe836('0x8')](),controller[_0xe836('0xd')]);router['get'](_0xe836('0xe'),auth[_0xe836('0x8')](),controller[_0xe836('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe836('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe836('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe836('0x12')]);module[_0xe836('0x13')]=router; \ No newline at end of file +var _0x2800=['create','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x3a2e7a,_0x5b380b){var _0xcefc4c=function(_0x2c8f14){while(--_0x2c8f14){_0x3a2e7a['push'](_0x3a2e7a['shift']());}};_0xcefc4c(++_0x5b380b);}(_0x2800,0x12f));var _0x0280=function(_0xc6f068,_0x21c01b){_0xc6f068=_0xc6f068-0x0;var _0xa5609c=_0x2800[_0xc6f068];return _0xa5609c;};'use strict';var multer=require('multer');var util=require(_0x0280('0x0'));var path=require(_0x0280('0x1'));var timeout=require(_0x0280('0x2'));var express=require(_0x0280('0x3'));var router=express[_0x0280('0x4')]();var fs_extra=require(_0x0280('0x5'));var auth=require(_0x0280('0x6'));var interaction=require(_0x0280('0x7'));var config=require(_0x0280('0x8'));var controller=require(_0x0280('0x9'));router[_0x0280('0xa')]('/',auth[_0x0280('0xb')](),controller[_0x0280('0xc')]);router[_0x0280('0xa')](_0x0280('0xd'),auth['isAuthenticated'](),controller[_0x0280('0xe')]);router[_0x0280('0xa')]('/:id/fields',auth[_0x0280('0xb')](),controller[_0x0280('0xf')]);router['get']('/:id/subjects',auth[_0x0280('0xb')](),controller[_0x0280('0x10')]);router[_0x0280('0xa')](_0x0280('0x11'),auth[_0x0280('0xb')](),controller[_0x0280('0x12')]);router['post']('/',auth[_0x0280('0xb')](),controller[_0x0280('0x13')]);router['put'](_0x0280('0xd'),auth[_0x0280('0xb')](),controller[_0x0280('0x14')]);router['delete'](_0x0280('0xd'),auth[_0x0280('0xb')](),controller[_0x0280('0x15')]);module[_0x0280('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index db75c71..1124852 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 _0x6fe4=['ENUM','lead','contact','nothing','sequelize','exports','STRING'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0x6fe4,0xc8));var _0x46fe=function(_0x42fe1a,_0x5db843){_0x42fe1a=_0x42fe1a-0x0;var _0x1cb3e3=_0x6fe4[_0x42fe1a];return _0x1cb3e3;};'use strict';var Sequelize=require(_0x46fe('0x0'));module[_0x46fe('0x1')]={'name':{'type':Sequelize[_0x46fe('0x2')]},'moduleCreate':{'type':Sequelize[_0x46fe('0x3')](_0x46fe('0x4'),_0x46fe('0x5'),_0x46fe('0x6')),'defaultValue':_0x46fe('0x4')},'moduleSearch':{'type':Sequelize[_0x46fe('0x3')]('contact_lead',_0x46fe('0x5'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x596e=['nothing','lead','sequelize','exports','STRING','ENUM','contact'];(function(_0x380707,_0x30175a){var _0x55e3ed=function(_0x292722){while(--_0x292722){_0x380707['push'](_0x380707['shift']());}};_0x55e3ed(++_0x30175a);}(_0x596e,0xb1));var _0xe596=function(_0x4b4cb8,_0x1b54b2){_0x4b4cb8=_0x4b4cb8-0x0;var _0x37b949=_0x596e[_0x4b4cb8];return _0x37b949;};'use strict';var Sequelize=require(_0xe596('0x0'));module[_0xe596('0x1')]={'name':{'type':Sequelize[_0xe596('0x2')]},'moduleCreate':{'type':Sequelize[_0xe596('0x3')]('lead',_0xe596('0x4'),_0xe596('0x5')),'defaultValue':_0xe596('0x6')},'moduleSearch':{'type':Sequelize[_0xe596('0x3')]('contact_lead',_0xe596('0x4'),_0xe596('0x6')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xe596('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 7e8d4bd..f159aee 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 _0x387c=['sort','filters','pick','filter','merge','where','VIRTUAL','options','ZohoConfiguration','includeAll','include','rows','catch','show','params','keys','length','body','find','getFields','findOne','getSubjects','ZohoField','getDescriptions','eml-format','fast-json-patch','request-promise','moment','mustache','util','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0xfd9f,_0x360d0d){var _0x1d96ff=function(_0x12a5ca){while(--_0x12a5ca){_0xfd9f['push'](_0xfd9f['shift']());}};_0x1d96ff(++_0x360d0d);}(_0x387c,0x199));var _0xc387=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0x387c[_0x5e28c2];return _0x1a8cc6;};'use strict';var emlformat=require(_0xc387('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc387('0x1'));var rp=require(_0xc387('0x2'));var moment=require(_0xc387('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc387('0x4'));var util=require(_0xc387('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc387('0x6'));var _=require(_0xc387('0x7'));var squel=require(_0xc387('0x8'));var crypto=require(_0xc387('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc387('0xa'));var toCsv=require(_0xc387('0xb'));var querystring=require(_0xc387('0xc'));var Papa=require(_0xc387('0xd'));var Redis=require(_0xc387('0xe'));var authService=require(_0xc387('0xf'));var qs=require(_0xc387('0x10'));var as=require(_0xc387('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc387('0x12'))(_0xc387('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc387('0x14'));var db=require(_0xc387('0x15'))['db'];function respondWithStatusCode(_0x806ace,_0x3cb517){_0x3cb517=_0x3cb517||0xcc;return function(_0x366166){if(_0x366166){return _0x806ace[_0xc387('0x16')](_0x3cb517);}return _0x806ace[_0xc387('0x17')](_0x3cb517)[_0xc387('0x18')]();};}function respondWithResult(_0x5bb552,_0x3408d8){_0x3408d8=_0x3408d8||0xc8;return function(_0x3a4629){if(_0x3a4629){return _0x5bb552[_0xc387('0x17')](_0x3408d8)['json'](_0x3a4629);}};}function respondWithFilteredResult(_0x253983,_0x1a7a88){return function(_0x19ebae){if(_0x19ebae){var _0x2e3623=typeof _0x1a7a88[_0xc387('0x19')]==='undefined'&&typeof _0x1a7a88['limit']===_0xc387('0x1a');var _0xac6455=_0x19ebae[_0xc387('0x1b')];var _0x257971=_0x2e3623?0x0:_0x1a7a88[_0xc387('0x19')];var _0xe6420e=_0x2e3623?_0x19ebae[_0xc387('0x1b')]:_0x1a7a88[_0xc387('0x19')]+_0x1a7a88[_0xc387('0x1c')];var _0x3011a7;if(_0xe6420e>=_0xac6455){_0xe6420e=_0xac6455;_0x3011a7=0xc8;}else{_0x3011a7=0xce;}_0x253983['status'](_0x3011a7);return _0x253983['set'](_0xc387('0x1d'),_0x257971+'-'+_0xe6420e+'/'+_0xac6455)[_0xc387('0x1e')](_0x19ebae);}return null;};}function patchUpdates(_0x2a9bf2){return function(_0x12912d){try{jsonpatch[_0xc387('0x1f')](_0x12912d,_0x2a9bf2,!![]);}catch(_0x509fd9){return BPromise[_0xc387('0x20')](_0x509fd9);}return _0x12912d[_0xc387('0x21')]();};}function saveUpdates(_0x87bea,_0x4c4656){return function(_0x31f736){if(_0x31f736){return _0x31f736[_0xc387('0x22')](_0x87bea)['then'](function(_0x5c145b){return _0x5c145b;});}return null;};}function removeEntity(_0x4f88cd,_0x33afad){return function(_0x51ccac){if(_0x51ccac){return _0x51ccac[_0xc387('0x23')]()[_0xc387('0x24')](function(){_0x4f88cd[_0xc387('0x17')](0xcc)[_0xc387('0x18')]();});}};}function handleEntityNotFound(_0x507088,_0x245957){return function(_0x28243b){if(!_0x28243b){_0x507088[_0xc387('0x16')](0x194);}return _0x28243b;};}function handleError(_0x5d41cf,_0x43d2c4){_0x43d2c4=_0x43d2c4||0x1f4;return function(_0x26d820){logger['error'](_0x26d820[_0xc387('0x25')]);if(_0x26d820[_0xc387('0x26')]){delete _0x26d820[_0xc387('0x26')];}_0x5d41cf[_0xc387('0x17')](_0x43d2c4)[_0xc387('0x27')](_0x26d820);};}exports[_0xc387('0x28')]=function(_0x360539,_0x27e130){var _0x554e8b={},_0x334184={},_0x375b29={'count':0x0,'rows':[]};var _0x6bab75=_[_0xc387('0x29')](db['ZohoConfiguration'][_0xc387('0x2a')],function(_0x10a59c){return{'name':_0x10a59c['fieldName'],'type':_0x10a59c[_0xc387('0x2b')][_0xc387('0x2c')]};});_0x334184[_0xc387('0x2d')]=_['map'](_0x6bab75,_0xc387('0x26'));_0x334184[_0xc387('0x2e')]=_['keys'](_0x360539[_0xc387('0x2e')]);_0x334184['filters']=_[_0xc387('0x2f')](_0x334184[_0xc387('0x2d')],_0x334184[_0xc387('0x2e')]);_0x554e8b[_0xc387('0x30')]=_[_0xc387('0x2f')](_0x334184[_0xc387('0x2d')],qs[_0xc387('0x31')](_0x360539[_0xc387('0x2e')][_0xc387('0x31')]));_0x554e8b[_0xc387('0x30')]=_0x554e8b[_0xc387('0x30')]['length']?_0x554e8b['attributes']:_0x334184[_0xc387('0x2d')];if(!_0x360539['query'][_0xc387('0x32')](_0xc387('0x33'))){_0x554e8b[_0xc387('0x1c')]=qs[_0xc387('0x1c')](_0x360539[_0xc387('0x2e')][_0xc387('0x1c')]);_0x554e8b[_0xc387('0x19')]=qs[_0xc387('0x19')](_0x360539[_0xc387('0x2e')][_0xc387('0x19')]);}_0x554e8b[_0xc387('0x34')]=qs['sort'](_0x360539[_0xc387('0x2e')][_0xc387('0x35')]);_0x554e8b['where']=qs[_0xc387('0x36')](_[_0xc387('0x37')](_0x360539['query'],_0x334184[_0xc387('0x36')]),_0x6bab75);if(_0x360539[_0xc387('0x2e')][_0xc387('0x38')]){_0x554e8b['where']=_[_0xc387('0x39')](_0x554e8b[_0xc387('0x3a')],{'$or':_['map'](_0x6bab75,function(_0x2200cd){if(_0x2200cd['type']!==_0xc387('0x3b')){var _0x2e677f={};_0x2e677f[_0x2200cd[_0xc387('0x26')]]={'$like':'%'+_0x360539[_0xc387('0x2e')]['filter']+'%'};return _0x2e677f;}})});}_0x554e8b=_[_0xc387('0x39')]({},_0x554e8b,_0x360539[_0xc387('0x3c')]);var _0xd5df79={'where':_0x554e8b[_0xc387('0x3a')]};return db[_0xc387('0x3d')]['count'](_0xd5df79)[_0xc387('0x24')](function(_0x19fb98){_0x375b29['count']=_0x19fb98;if(_0x360539[_0xc387('0x2e')][_0xc387('0x3e')]){_0x554e8b[_0xc387('0x3f')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x554e8b);})[_0xc387('0x24')](function(_0x24c267){_0x375b29[_0xc387('0x40')]=_0x24c267;return _0x375b29;})[_0xc387('0x24')](respondWithFilteredResult(_0x27e130,_0x554e8b))[_0xc387('0x41')](handleError(_0x27e130,null));};exports[_0xc387('0x42')]=function(_0x3124e8,_0x3f010b){var _0x2112aa={'raw':![],'where':{'id':_0x3124e8[_0xc387('0x43')]['id']}},_0x2cc5f5={};_0x2cc5f5[_0xc387('0x2d')]=_[_0xc387('0x44')](db[_0xc387('0x3d')][_0xc387('0x2a')]);_0x2cc5f5[_0xc387('0x2e')]=_['keys'](_0x3124e8[_0xc387('0x2e')]);_0x2cc5f5[_0xc387('0x36')]=_['intersection'](_0x2cc5f5['model'],_0x2cc5f5[_0xc387('0x2e')]);_0x2112aa[_0xc387('0x30')]=_[_0xc387('0x2f')](_0x2cc5f5[_0xc387('0x2d')],qs['fields'](_0x3124e8[_0xc387('0x2e')]['fields']));_0x2112aa[_0xc387('0x30')]=_0x2112aa[_0xc387('0x30')][_0xc387('0x45')]?_0x2112aa[_0xc387('0x30')]:_0x2cc5f5['model'];if(_0x3124e8[_0xc387('0x2e')][_0xc387('0x3e')]){_0x2112aa[_0xc387('0x3f')]=[{'all':!![]}];}_0x2112aa=_['merge']({},_0x2112aa,_0x3124e8[_0xc387('0x3c')]);return db[_0xc387('0x3d')]['find'](_0x2112aa)['then'](handleEntityNotFound(_0x3f010b,null))['then'](respondWithResult(_0x3f010b,null))[_0xc387('0x41')](handleError(_0x3f010b,null));};exports['create']=function(_0x3adeb8,_0xca41a4){return db['ZohoConfiguration']['create'](_0x3adeb8[_0xc387('0x46')],{})[_0xc387('0x24')](respondWithResult(_0xca41a4,0xc9))[_0xc387('0x41')](handleError(_0xca41a4,null));};exports[_0xc387('0x22')]=function(_0x4a6d11,_0x501eb2){if(_0x4a6d11[_0xc387('0x46')]['id']){delete _0x4a6d11[_0xc387('0x46')]['id'];}return db[_0xc387('0x3d')][_0xc387('0x47')]({'where':{'id':_0x4a6d11[_0xc387('0x43')]['id']}})[_0xc387('0x24')](handleEntityNotFound(_0x501eb2,null))[_0xc387('0x24')](saveUpdates(_0x4a6d11[_0xc387('0x46')],null))[_0xc387('0x24')](respondWithResult(_0x501eb2,null))[_0xc387('0x41')](handleError(_0x501eb2,null));};exports[_0xc387('0x23')]=function(_0x188996,_0x2d223e){return db['ZohoConfiguration'][_0xc387('0x47')]({'where':{'id':_0x188996[_0xc387('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d223e,null))[_0xc387('0x24')](removeEntity(_0x2d223e,null))['catch'](handleError(_0x2d223e,null));};exports[_0xc387('0x48')]=function(_0x118dc4,_0x6339b4,_0x4f4ce4){var _0x532948={};var _0x4fb6c3={};var _0x5dc6bd;var _0x519c48;return db[_0xc387('0x3d')][_0xc387('0x49')]({'where':{'id':_0x118dc4[_0xc387('0x43')]['id']}})[_0xc387('0x24')](handleEntityNotFound(_0x6339b4,null))[_0xc387('0x24')](function(_0x59abee){if(_0x59abee){_0x5dc6bd=_0x59abee;_0x4fb6c3['model']=_[_0xc387('0x44')](db['ZohoField'][_0xc387('0x2a')]);_0x4fb6c3[_0xc387('0x2e')]=_['keys'](_0x118dc4[_0xc387('0x2e')]);_0x4fb6c3[_0xc387('0x36')]=_[_0xc387('0x2f')](_0x4fb6c3[_0xc387('0x2d')],_0x4fb6c3[_0xc387('0x2e')]);_0x532948[_0xc387('0x30')]=_['intersection'](_0x4fb6c3[_0xc387('0x2d')],qs['fields'](_0x118dc4[_0xc387('0x2e')][_0xc387('0x31')]));_0x532948['attributes']=_0x532948[_0xc387('0x30')][_0xc387('0x45')]?_0x532948[_0xc387('0x30')]:_0x4fb6c3[_0xc387('0x2d')];_0x532948['order']=qs[_0xc387('0x35')](_0x118dc4[_0xc387('0x2e')][_0xc387('0x35')]);_0x532948[_0xc387('0x3a')]=qs[_0xc387('0x36')](_[_0xc387('0x37')](_0x118dc4[_0xc387('0x2e')],_0x4fb6c3[_0xc387('0x36')]));if(_0x118dc4[_0xc387('0x2e')][_0xc387('0x38')]){_0x532948['where']=_[_0xc387('0x39')](_0x532948[_0xc387('0x3a')],{'$or':_[_0xc387('0x29')](_0x532948[_0xc387('0x30')],function(_0x53269a){var _0x28164c={};_0x28164c[_0x53269a]={'$like':'%'+_0x118dc4['query'][_0xc387('0x38')]+'%'};return _0x28164c;})});}_0x532948=_[_0xc387('0x39')]({},_0x532948,_0x118dc4['options']);return _0x5dc6bd['getFields'](_0x532948);}})[_0xc387('0x24')](function(_0x37f1c5){if(_0x37f1c5){_0x519c48=_0x37f1c5[_0xc387('0x45')];if(!_0x118dc4['query']['hasOwnProperty'](_0xc387('0x33'))){_0x532948[_0xc387('0x1c')]=qs['limit'](_0x118dc4[_0xc387('0x2e')][_0xc387('0x1c')]);_0x532948[_0xc387('0x19')]=qs['offset'](_0x118dc4['query'][_0xc387('0x19')]);}return _0x5dc6bd[_0xc387('0x48')](_0x532948);}})[_0xc387('0x24')](function(_0x31120e){if(_0x31120e){return _0x31120e?{'count':_0x519c48,'rows':_0x31120e}:null;}})[_0xc387('0x24')](respondWithResult(_0x6339b4,null))['catch'](handleError(_0x6339b4,null));};exports[_0xc387('0x4a')]=function(_0x1388fd,_0x5b8362,_0xe9692){var _0x4c6933={};var _0x4008de={};var _0x35d3e9;var _0x375962;return db[_0xc387('0x3d')]['findOne']({'where':{'id':_0x1388fd[_0xc387('0x43')]['id']}})[_0xc387('0x24')](handleEntityNotFound(_0x5b8362,null))['then'](function(_0x2152d4){if(_0x2152d4){_0x35d3e9=_0x2152d4;_0x4008de['model']=_[_0xc387('0x44')](db[_0xc387('0x4b')][_0xc387('0x2a')]);_0x4008de[_0xc387('0x2e')]=_[_0xc387('0x44')](_0x1388fd[_0xc387('0x2e')]);_0x4008de[_0xc387('0x36')]=_[_0xc387('0x2f')](_0x4008de[_0xc387('0x2d')],_0x4008de['query']);_0x4c6933[_0xc387('0x30')]=_[_0xc387('0x2f')](_0x4008de[_0xc387('0x2d')],qs['fields'](_0x1388fd['query'][_0xc387('0x31')]));_0x4c6933['attributes']=_0x4c6933[_0xc387('0x30')][_0xc387('0x45')]?_0x4c6933['attributes']:_0x4008de[_0xc387('0x2d')];_0x4c6933[_0xc387('0x34')]=qs['sort'](_0x1388fd['query'][_0xc387('0x35')]);_0x4c6933[_0xc387('0x3a')]=qs[_0xc387('0x36')](_[_0xc387('0x37')](_0x1388fd[_0xc387('0x2e')],_0x4008de['filters']));if(_0x1388fd[_0xc387('0x2e')][_0xc387('0x38')]){_0x4c6933[_0xc387('0x3a')]=_[_0xc387('0x39')](_0x4c6933[_0xc387('0x3a')],{'$or':_[_0xc387('0x29')](_0x4c6933[_0xc387('0x30')],function(_0x47ebf7){var _0x312b2c={};_0x312b2c[_0x47ebf7]={'$like':'%'+_0x1388fd[_0xc387('0x2e')][_0xc387('0x38')]+'%'};return _0x312b2c;})});}_0x4c6933=_['merge']({},_0x4c6933,_0x1388fd[_0xc387('0x3c')]);return _0x35d3e9[_0xc387('0x4a')](_0x4c6933);}})['then'](function(_0x3ccdba){if(_0x3ccdba){_0x375962=_0x3ccdba[_0xc387('0x45')];if(!_0x1388fd[_0xc387('0x2e')][_0xc387('0x32')](_0xc387('0x33'))){_0x4c6933[_0xc387('0x1c')]=qs['limit'](_0x1388fd[_0xc387('0x2e')][_0xc387('0x1c')]);_0x4c6933['offset']=qs[_0xc387('0x19')](_0x1388fd[_0xc387('0x2e')][_0xc387('0x19')]);}return _0x35d3e9[_0xc387('0x4a')](_0x4c6933);}})[_0xc387('0x24')](function(_0x3b27d9){if(_0x3b27d9){return _0x3b27d9?{'count':_0x375962,'rows':_0x3b27d9}:null;}})[_0xc387('0x24')](respondWithResult(_0x5b8362,null))[_0xc387('0x41')](handleError(_0x5b8362,null));};exports[_0xc387('0x4c')]=function(_0x50fdfa,_0x558ee5,_0x4ea73d){var _0x3fc503={};var _0x37f2c7={};var _0xf9ede0;var _0x5c514e;return db[_0xc387('0x3d')][_0xc387('0x49')]({'where':{'id':_0x50fdfa[_0xc387('0x43')]['id']}})[_0xc387('0x24')](handleEntityNotFound(_0x558ee5,null))['then'](function(_0x197bf1){if(_0x197bf1){_0xf9ede0=_0x197bf1;_0x37f2c7['model']=_['keys'](db[_0xc387('0x4b')][_0xc387('0x2a')]);_0x37f2c7[_0xc387('0x2e')]=_[_0xc387('0x44')](_0x50fdfa['query']);_0x37f2c7[_0xc387('0x36')]=_[_0xc387('0x2f')](_0x37f2c7[_0xc387('0x2d')],_0x37f2c7[_0xc387('0x2e')]);_0x3fc503[_0xc387('0x30')]=_['intersection'](_0x37f2c7[_0xc387('0x2d')],qs[_0xc387('0x31')](_0x50fdfa[_0xc387('0x2e')]['fields']));_0x3fc503[_0xc387('0x30')]=_0x3fc503[_0xc387('0x30')][_0xc387('0x45')]?_0x3fc503['attributes']:_0x37f2c7[_0xc387('0x2d')];_0x3fc503[_0xc387('0x34')]=qs[_0xc387('0x35')](_0x50fdfa['query']['sort']);_0x3fc503['where']=qs[_0xc387('0x36')](_[_0xc387('0x37')](_0x50fdfa[_0xc387('0x2e')],_0x37f2c7[_0xc387('0x36')]));if(_0x50fdfa[_0xc387('0x2e')][_0xc387('0x38')]){_0x3fc503[_0xc387('0x3a')]=_[_0xc387('0x39')](_0x3fc503[_0xc387('0x3a')],{'$or':_[_0xc387('0x29')](_0x3fc503[_0xc387('0x30')],function(_0x1b64e0){var _0x5158c6={};_0x5158c6[_0x1b64e0]={'$like':'%'+_0x50fdfa[_0xc387('0x2e')][_0xc387('0x38')]+'%'};return _0x5158c6;})});}_0x3fc503=_[_0xc387('0x39')]({},_0x3fc503,_0x50fdfa[_0xc387('0x3c')]);return _0xf9ede0['getDescriptions'](_0x3fc503);}})[_0xc387('0x24')](function(_0x11455c){if(_0x11455c){_0x5c514e=_0x11455c[_0xc387('0x45')];if(!_0x50fdfa[_0xc387('0x2e')]['hasOwnProperty'](_0xc387('0x33'))){_0x3fc503[_0xc387('0x1c')]=qs['limit'](_0x50fdfa[_0xc387('0x2e')]['limit']);_0x3fc503[_0xc387('0x19')]=qs[_0xc387('0x19')](_0x50fdfa[_0xc387('0x2e')]['offset']);}return _0xf9ede0['getDescriptions'](_0x3fc503);}})[_0xc387('0x24')](function(_0x396fd0){if(_0x396fd0){return _0x396fd0?{'count':_0x5c514e,'rows':_0x396fd0}:null;}})[_0xc387('0x24')](respondWithResult(_0x558ee5,null))[_0xc387('0x41')](handleError(_0x558ee5,null));}; \ No newline at end of file +var _0x8fab=['rows','catch','show','find','create','body','params','getFields','findOne','pick','nolimit','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','merge','where','filter','options','includeAll','include','findAll'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x8fab,0x15e));var _0xb8fa=function(_0x2b1f51,_0x2ed63b){_0x2b1f51=_0x2b1f51-0x0;var _0x18715b=_0x8fab[_0x2b1f51];return _0x18715b;};'use strict';var emlformat=require(_0xb8fa('0x0'));var rimraf=require(_0xb8fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb8fa('0x2'));var moment=require('moment');var BPromise=require(_0xb8fa('0x3'));var Mustache=require('mustache');var util=require(_0xb8fa('0x4'));var path=require(_0xb8fa('0x5'));var sox=require(_0xb8fa('0x6'));var csv=require(_0xb8fa('0x7'));var ejs=require(_0xb8fa('0x8'));var fs=require('fs');var fs_extra=require(_0xb8fa('0x9'));var _=require(_0xb8fa('0xa'));var squel=require(_0xb8fa('0xb'));var crypto=require(_0xb8fa('0xc'));var jsforce=require(_0xb8fa('0xd'));var deskjs=require(_0xb8fa('0xe'));var toCsv=require(_0xb8fa('0x7'));var querystring=require(_0xb8fa('0xf'));var Papa=require(_0xb8fa('0x10'));var Redis=require(_0xb8fa('0x11'));var authService=require(_0xb8fa('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb8fa('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8fa('0x14'))(_0xb8fa('0x15'));var utils=require(_0xb8fa('0x16'));var config=require(_0xb8fa('0x17'));var licenseUtil=require(_0xb8fa('0x18'));var db=require(_0xb8fa('0x19'))['db'];function respondWithStatusCode(_0x32b5ed,_0x43a934){_0x43a934=_0x43a934||0xcc;return function(_0x57dd2b){if(_0x57dd2b){return _0x32b5ed[_0xb8fa('0x1a')](_0x43a934);}return _0x32b5ed[_0xb8fa('0x1b')](_0x43a934)[_0xb8fa('0x1c')]();};}function respondWithResult(_0x1f57cc,_0x434811){_0x434811=_0x434811||0xc8;return function(_0x1b50f7){if(_0x1b50f7){return _0x1f57cc['status'](_0x434811)[_0xb8fa('0x1d')](_0x1b50f7);}};}function respondWithFilteredResult(_0x1bd491,_0x2ff2e5){return function(_0x260a2b){if(_0x260a2b){var _0x52d04c=typeof _0x2ff2e5[_0xb8fa('0x1e')]==='undefined'&&typeof _0x2ff2e5['limit']===_0xb8fa('0x1f');var _0x1dcbdc=_0x260a2b[_0xb8fa('0x20')];var _0x1b8624=_0x52d04c?0x0:_0x2ff2e5[_0xb8fa('0x1e')];var _0x24a9ef=_0x52d04c?_0x260a2b['count']:_0x2ff2e5[_0xb8fa('0x1e')]+_0x2ff2e5[_0xb8fa('0x21')];var _0x3037a1;if(_0x24a9ef>=_0x1dcbdc){_0x24a9ef=_0x1dcbdc;_0x3037a1=0xc8;}else{_0x3037a1=0xce;}_0x1bd491[_0xb8fa('0x1b')](_0x3037a1);return _0x1bd491[_0xb8fa('0x22')](_0xb8fa('0x23'),_0x1b8624+'-'+_0x24a9ef+'/'+_0x1dcbdc)[_0xb8fa('0x1d')](_0x260a2b);}return null;};}function patchUpdates(_0x115fd5){return function(_0x549621){try{jsonpatch[_0xb8fa('0x24')](_0x549621,_0x115fd5,!![]);}catch(_0x12a381){return BPromise[_0xb8fa('0x25')](_0x12a381);}return _0x549621[_0xb8fa('0x26')]();};}function saveUpdates(_0x1a9633,_0x53464d){return function(_0x23f730){if(_0x23f730){return _0x23f730[_0xb8fa('0x27')](_0x1a9633)[_0xb8fa('0x28')](function(_0x3873be){return _0x3873be;});}return null;};}function removeEntity(_0x4d2eeb,_0x453df8){return function(_0x241635){if(_0x241635){return _0x241635[_0xb8fa('0x29')]()['then'](function(){_0x4d2eeb[_0xb8fa('0x1b')](0xcc)[_0xb8fa('0x1c')]();});}};}function handleEntityNotFound(_0x5a95ed,_0x1c3bb6){return function(_0x2f3829){if(!_0x2f3829){_0x5a95ed[_0xb8fa('0x1a')](0x194);}return _0x2f3829;};}function handleError(_0x3b598a,_0x4367b8){_0x4367b8=_0x4367b8||0x1f4;return function(_0x199c80){logger[_0xb8fa('0x2a')](_0x199c80[_0xb8fa('0x2b')]);if(_0x199c80[_0xb8fa('0x2c')]){delete _0x199c80[_0xb8fa('0x2c')];}_0x3b598a[_0xb8fa('0x1b')](_0x4367b8)[_0xb8fa('0x2d')](_0x199c80);};}exports[_0xb8fa('0x2e')]=function(_0x386981,_0x55255a){var _0x21d1ce={},_0x20d804={},_0x4e83db={'count':0x0,'rows':[]};var _0x4fc41f=_[_0xb8fa('0x2f')](db[_0xb8fa('0x30')][_0xb8fa('0x31')],function(_0x51fdf8){return{'name':_0x51fdf8[_0xb8fa('0x32')],'type':_0x51fdf8[_0xb8fa('0x33')]['key']};});_0x20d804[_0xb8fa('0x34')]=_[_0xb8fa('0x2f')](_0x4fc41f,'name');_0x20d804[_0xb8fa('0x35')]=_[_0xb8fa('0x36')](_0x386981[_0xb8fa('0x35')]);_0x20d804[_0xb8fa('0x37')]=_[_0xb8fa('0x38')](_0x20d804['model'],_0x20d804[_0xb8fa('0x35')]);_0x21d1ce[_0xb8fa('0x39')]=_[_0xb8fa('0x38')](_0x20d804[_0xb8fa('0x34')],qs[_0xb8fa('0x3a')](_0x386981[_0xb8fa('0x35')]['fields']));_0x21d1ce[_0xb8fa('0x39')]=_0x21d1ce[_0xb8fa('0x39')][_0xb8fa('0x3b')]?_0x21d1ce[_0xb8fa('0x39')]:_0x20d804[_0xb8fa('0x34')];if(!_0x386981[_0xb8fa('0x35')][_0xb8fa('0x3c')]('nolimit')){_0x21d1ce[_0xb8fa('0x21')]=qs[_0xb8fa('0x21')](_0x386981[_0xb8fa('0x35')][_0xb8fa('0x21')]);_0x21d1ce[_0xb8fa('0x1e')]=qs[_0xb8fa('0x1e')](_0x386981[_0xb8fa('0x35')][_0xb8fa('0x1e')]);}_0x21d1ce[_0xb8fa('0x3d')]=qs['sort'](_0x386981[_0xb8fa('0x35')][_0xb8fa('0x3e')]);_0x21d1ce['where']=qs[_0xb8fa('0x37')](_['pick'](_0x386981[_0xb8fa('0x35')],_0x20d804[_0xb8fa('0x37')]),_0x4fc41f);if(_0x386981[_0xb8fa('0x35')]['filter']){_0x21d1ce['where']=_[_0xb8fa('0x3f')](_0x21d1ce[_0xb8fa('0x40')],{'$or':_[_0xb8fa('0x2f')](_0x4fc41f,function(_0x1cc53c){if(_0x1cc53c[_0xb8fa('0x33')]!=='VIRTUAL'){var _0x4c38da={};_0x4c38da[_0x1cc53c['name']]={'$like':'%'+_0x386981[_0xb8fa('0x35')][_0xb8fa('0x41')]+'%'};return _0x4c38da;}})});}_0x21d1ce=_[_0xb8fa('0x3f')]({},_0x21d1ce,_0x386981[_0xb8fa('0x42')]);var _0x4db3f7={'where':_0x21d1ce[_0xb8fa('0x40')]};return db['ZohoConfiguration'][_0xb8fa('0x20')](_0x4db3f7)[_0xb8fa('0x28')](function(_0x26b811){_0x4e83db[_0xb8fa('0x20')]=_0x26b811;if(_0x386981['query'][_0xb8fa('0x43')]){_0x21d1ce[_0xb8fa('0x44')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xb8fa('0x45')](_0x21d1ce);})[_0xb8fa('0x28')](function(_0x18f96d){_0x4e83db[_0xb8fa('0x46')]=_0x18f96d;return _0x4e83db;})[_0xb8fa('0x28')](respondWithFilteredResult(_0x55255a,_0x21d1ce))[_0xb8fa('0x47')](handleError(_0x55255a,null));};exports[_0xb8fa('0x48')]=function(_0x37587c,_0x543187){var _0x19a8d3={'raw':![],'where':{'id':_0x37587c['params']['id']}},_0x2e557c={};_0x2e557c[_0xb8fa('0x34')]=_[_0xb8fa('0x36')](db[_0xb8fa('0x30')]['rawAttributes']);_0x2e557c['query']=_[_0xb8fa('0x36')](_0x37587c[_0xb8fa('0x35')]);_0x2e557c[_0xb8fa('0x37')]=_[_0xb8fa('0x38')](_0x2e557c[_0xb8fa('0x34')],_0x2e557c['query']);_0x19a8d3[_0xb8fa('0x39')]=_[_0xb8fa('0x38')](_0x2e557c['model'],qs[_0xb8fa('0x3a')](_0x37587c[_0xb8fa('0x35')][_0xb8fa('0x3a')]));_0x19a8d3['attributes']=_0x19a8d3[_0xb8fa('0x39')][_0xb8fa('0x3b')]?_0x19a8d3[_0xb8fa('0x39')]:_0x2e557c[_0xb8fa('0x34')];if(_0x37587c['query'][_0xb8fa('0x43')]){_0x19a8d3[_0xb8fa('0x44')]=[{'all':!![]}];}_0x19a8d3=_[_0xb8fa('0x3f')]({},_0x19a8d3,_0x37587c[_0xb8fa('0x42')]);return db[_0xb8fa('0x30')][_0xb8fa('0x49')](_0x19a8d3)['then'](handleEntityNotFound(_0x543187,null))[_0xb8fa('0x28')](respondWithResult(_0x543187,null))[_0xb8fa('0x47')](handleError(_0x543187,null));};exports[_0xb8fa('0x4a')]=function(_0x43bab9,_0x156c21){return db[_0xb8fa('0x30')][_0xb8fa('0x4a')](_0x43bab9[_0xb8fa('0x4b')],{})[_0xb8fa('0x28')](respondWithResult(_0x156c21,0xc9))[_0xb8fa('0x47')](handleError(_0x156c21,null));};exports['update']=function(_0x129d2f,_0x12e574){if(_0x129d2f['body']['id']){delete _0x129d2f[_0xb8fa('0x4b')]['id'];}return db[_0xb8fa('0x30')][_0xb8fa('0x49')]({'where':{'id':_0x129d2f[_0xb8fa('0x4c')]['id']}})[_0xb8fa('0x28')](handleEntityNotFound(_0x12e574,null))['then'](saveUpdates(_0x129d2f[_0xb8fa('0x4b')],null))[_0xb8fa('0x28')](respondWithResult(_0x12e574,null))[_0xb8fa('0x47')](handleError(_0x12e574,null));};exports[_0xb8fa('0x29')]=function(_0x3842d8,_0x3592fb){return db[_0xb8fa('0x30')]['find']({'where':{'id':_0x3842d8[_0xb8fa('0x4c')]['id']}})[_0xb8fa('0x28')](handleEntityNotFound(_0x3592fb,null))['then'](removeEntity(_0x3592fb,null))['catch'](handleError(_0x3592fb,null));};exports[_0xb8fa('0x4d')]=function(_0x3d6218,_0x3056cf,_0x329e5d){var _0x426e5f={};var _0x2d7a2c={};var _0x3e8df2;var _0x5e2ef7;return db[_0xb8fa('0x30')][_0xb8fa('0x4e')]({'where':{'id':_0x3d6218[_0xb8fa('0x4c')]['id']}})[_0xb8fa('0x28')](handleEntityNotFound(_0x3056cf,null))[_0xb8fa('0x28')](function(_0x5a99f2){if(_0x5a99f2){_0x3e8df2=_0x5a99f2;_0x2d7a2c['model']=_[_0xb8fa('0x36')](db['ZohoField']['rawAttributes']);_0x2d7a2c[_0xb8fa('0x35')]=_['keys'](_0x3d6218[_0xb8fa('0x35')]);_0x2d7a2c['filters']=_[_0xb8fa('0x38')](_0x2d7a2c[_0xb8fa('0x34')],_0x2d7a2c[_0xb8fa('0x35')]);_0x426e5f[_0xb8fa('0x39')]=_[_0xb8fa('0x38')](_0x2d7a2c[_0xb8fa('0x34')],qs[_0xb8fa('0x3a')](_0x3d6218[_0xb8fa('0x35')][_0xb8fa('0x3a')]));_0x426e5f['attributes']=_0x426e5f[_0xb8fa('0x39')]['length']?_0x426e5f[_0xb8fa('0x39')]:_0x2d7a2c[_0xb8fa('0x34')];_0x426e5f[_0xb8fa('0x3d')]=qs[_0xb8fa('0x3e')](_0x3d6218[_0xb8fa('0x35')]['sort']);_0x426e5f[_0xb8fa('0x40')]=qs[_0xb8fa('0x37')](_[_0xb8fa('0x4f')](_0x3d6218[_0xb8fa('0x35')],_0x2d7a2c['filters']));if(_0x3d6218[_0xb8fa('0x35')][_0xb8fa('0x41')]){_0x426e5f[_0xb8fa('0x40')]=_['merge'](_0x426e5f[_0xb8fa('0x40')],{'$or':_['map'](_0x426e5f[_0xb8fa('0x39')],function(_0x23b475){var _0x410ed6={};_0x410ed6[_0x23b475]={'$like':'%'+_0x3d6218[_0xb8fa('0x35')][_0xb8fa('0x41')]+'%'};return _0x410ed6;})});}_0x426e5f=_[_0xb8fa('0x3f')]({},_0x426e5f,_0x3d6218[_0xb8fa('0x42')]);return _0x3e8df2['getFields'](_0x426e5f);}})[_0xb8fa('0x28')](function(_0x3f2d95){if(_0x3f2d95){_0x5e2ef7=_0x3f2d95[_0xb8fa('0x3b')];if(!_0x3d6218[_0xb8fa('0x35')][_0xb8fa('0x3c')](_0xb8fa('0x50'))){_0x426e5f['limit']=qs[_0xb8fa('0x21')](_0x3d6218[_0xb8fa('0x35')][_0xb8fa('0x21')]);_0x426e5f[_0xb8fa('0x1e')]=qs[_0xb8fa('0x1e')](_0x3d6218[_0xb8fa('0x35')][_0xb8fa('0x1e')]);}return _0x3e8df2[_0xb8fa('0x4d')](_0x426e5f);}})[_0xb8fa('0x28')](function(_0x65b49c){if(_0x65b49c){return _0x65b49c?{'count':_0x5e2ef7,'rows':_0x65b49c}:null;}})['then'](respondWithResult(_0x3056cf,null))['catch'](handleError(_0x3056cf,null));};exports[_0xb8fa('0x51')]=function(_0x27243f,_0x34439b,_0x21aee0){var _0x5c1215={};var _0x590dd1={};var _0xfeb09;var _0x50804b;return db[_0xb8fa('0x30')][_0xb8fa('0x4e')]({'where':{'id':_0x27243f[_0xb8fa('0x4c')]['id']}})[_0xb8fa('0x28')](handleEntityNotFound(_0x34439b,null))['then'](function(_0x56c4d1){if(_0x56c4d1){_0xfeb09=_0x56c4d1;_0x590dd1['model']=_[_0xb8fa('0x36')](db[_0xb8fa('0x52')][_0xb8fa('0x31')]);_0x590dd1[_0xb8fa('0x35')]=_['keys'](_0x27243f[_0xb8fa('0x35')]);_0x590dd1[_0xb8fa('0x37')]=_[_0xb8fa('0x38')](_0x590dd1['model'],_0x590dd1[_0xb8fa('0x35')]);_0x5c1215[_0xb8fa('0x39')]=_['intersection'](_0x590dd1[_0xb8fa('0x34')],qs[_0xb8fa('0x3a')](_0x27243f[_0xb8fa('0x35')][_0xb8fa('0x3a')]));_0x5c1215[_0xb8fa('0x39')]=_0x5c1215[_0xb8fa('0x39')][_0xb8fa('0x3b')]?_0x5c1215[_0xb8fa('0x39')]:_0x590dd1[_0xb8fa('0x34')];_0x5c1215[_0xb8fa('0x3d')]=qs[_0xb8fa('0x3e')](_0x27243f[_0xb8fa('0x35')]['sort']);_0x5c1215[_0xb8fa('0x40')]=qs[_0xb8fa('0x37')](_[_0xb8fa('0x4f')](_0x27243f[_0xb8fa('0x35')],_0x590dd1[_0xb8fa('0x37')]));if(_0x27243f['query'][_0xb8fa('0x41')]){_0x5c1215[_0xb8fa('0x40')]=_[_0xb8fa('0x3f')](_0x5c1215['where'],{'$or':_[_0xb8fa('0x2f')](_0x5c1215['attributes'],function(_0x187000){var _0x26af59={};_0x26af59[_0x187000]={'$like':'%'+_0x27243f['query'][_0xb8fa('0x41')]+'%'};return _0x26af59;})});}_0x5c1215=_[_0xb8fa('0x3f')]({},_0x5c1215,_0x27243f['options']);return _0xfeb09[_0xb8fa('0x51')](_0x5c1215);}})['then'](function(_0x388b5e){if(_0x388b5e){_0x50804b=_0x388b5e[_0xb8fa('0x3b')];if(!_0x27243f[_0xb8fa('0x35')][_0xb8fa('0x3c')]('nolimit')){_0x5c1215['limit']=qs[_0xb8fa('0x21')](_0x27243f[_0xb8fa('0x35')][_0xb8fa('0x21')]);_0x5c1215['offset']=qs['offset'](_0x27243f[_0xb8fa('0x35')][_0xb8fa('0x1e')]);}return _0xfeb09['getSubjects'](_0x5c1215);}})['then'](function(_0x244e93){if(_0x244e93){return _0x244e93?{'count':_0x50804b,'rows':_0x244e93}:null;}})[_0xb8fa('0x28')](respondWithResult(_0x34439b,null))[_0xb8fa('0x47')](handleError(_0x34439b,null));};exports[_0xb8fa('0x53')]=function(_0xa006bb,_0x218aae,_0x5742e9){var _0x5e5d7c={};var _0x3a8b27={};var _0x8811a1;var _0x2cb28d;return db[_0xb8fa('0x30')][_0xb8fa('0x4e')]({'where':{'id':_0xa006bb['params']['id']}})[_0xb8fa('0x28')](handleEntityNotFound(_0x218aae,null))[_0xb8fa('0x28')](function(_0x1c1960){if(_0x1c1960){_0x8811a1=_0x1c1960;_0x3a8b27[_0xb8fa('0x34')]=_[_0xb8fa('0x36')](db[_0xb8fa('0x52')][_0xb8fa('0x31')]);_0x3a8b27[_0xb8fa('0x35')]=_[_0xb8fa('0x36')](_0xa006bb['query']);_0x3a8b27[_0xb8fa('0x37')]=_[_0xb8fa('0x38')](_0x3a8b27[_0xb8fa('0x34')],_0x3a8b27[_0xb8fa('0x35')]);_0x5e5d7c[_0xb8fa('0x39')]=_[_0xb8fa('0x38')](_0x3a8b27[_0xb8fa('0x34')],qs[_0xb8fa('0x3a')](_0xa006bb['query'][_0xb8fa('0x3a')]));_0x5e5d7c[_0xb8fa('0x39')]=_0x5e5d7c[_0xb8fa('0x39')][_0xb8fa('0x3b')]?_0x5e5d7c[_0xb8fa('0x39')]:_0x3a8b27['model'];_0x5e5d7c[_0xb8fa('0x3d')]=qs[_0xb8fa('0x3e')](_0xa006bb[_0xb8fa('0x35')][_0xb8fa('0x3e')]);_0x5e5d7c[_0xb8fa('0x40')]=qs['filters'](_[_0xb8fa('0x4f')](_0xa006bb[_0xb8fa('0x35')],_0x3a8b27['filters']));if(_0xa006bb[_0xb8fa('0x35')]['filter']){_0x5e5d7c['where']=_[_0xb8fa('0x3f')](_0x5e5d7c[_0xb8fa('0x40')],{'$or':_[_0xb8fa('0x2f')](_0x5e5d7c['attributes'],function(_0x29310d){var _0x211e70={};_0x211e70[_0x29310d]={'$like':'%'+_0xa006bb[_0xb8fa('0x35')][_0xb8fa('0x41')]+'%'};return _0x211e70;})});}_0x5e5d7c=_[_0xb8fa('0x3f')]({},_0x5e5d7c,_0xa006bb[_0xb8fa('0x42')]);return _0x8811a1[_0xb8fa('0x53')](_0x5e5d7c);}})[_0xb8fa('0x28')](function(_0x32a102){if(_0x32a102){_0x2cb28d=_0x32a102[_0xb8fa('0x3b')];if(!_0xa006bb[_0xb8fa('0x35')][_0xb8fa('0x3c')](_0xb8fa('0x50'))){_0x5e5d7c[_0xb8fa('0x21')]=qs[_0xb8fa('0x21')](_0xa006bb[_0xb8fa('0x35')]['limit']);_0x5e5d7c[_0xb8fa('0x1e')]=qs[_0xb8fa('0x1e')](_0xa006bb[_0xb8fa('0x35')][_0xb8fa('0x1e')]);}return _0x8811a1[_0xb8fa('0x53')](_0x5e5d7c);}})[_0xb8fa('0x28')](function(_0x554fba){if(_0x554fba){return _0x554fba?{'count':_0x2cb28d,'rows':_0x554fba}:null;}})['then'](respondWithResult(_0x218aae,null))[_0xb8fa('0x47')](handleError(_0x218aae,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 55d28c9..7991b72 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 _0x7af3=['request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','moment'];(function(_0x427aa5,_0x4ab418){var _0x518615=function(_0x2f187b){while(--_0x2f187b){_0x427aa5['push'](_0x427aa5['shift']());}};_0x518615(++_0x4ab418);}(_0x7af3,0x11b));var _0x37af=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x7af3[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require(_0x37af('0x0'));var logger=require(_0x37af('0x1'))('api');var moment=require(_0x37af('0x2'));var BPromise=require('bluebird');var rp=require(_0x37af('0x3'));var fs=require('fs');var path=require(_0x37af('0x4'));var rimraf=require(_0x37af('0x5'));var config=require('../../config/environment');var attributes=require(_0x37af('0x6'));module[_0x37af('0x7')]=function(_0x43cc71,_0x58d9e0){return _0x43cc71[_0x37af('0x8')](_0x37af('0x9'),attributes,{'tableName':_0x37af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd715=['../../config/environment','./intZohoConfiguration.attributes','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x4c4a83,_0x13843b){var _0x3c1b68=function(_0x3200a0){while(--_0x3200a0){_0x4c4a83['push'](_0x4c4a83['shift']());}};_0x3c1b68(++_0x13843b);}(_0xd715,0x11a));var _0x5d71=function(_0x40d232,_0x5b567e){_0x40d232=_0x40d232-0x0;var _0x683f38=_0xd715[_0x40d232];return _0x683f38;};'use strict';var _=require(_0x5d71('0x0'));var util=require(_0x5d71('0x1'));var logger=require(_0x5d71('0x2'))(_0x5d71('0x3'));var moment=require('moment');var BPromise=require(_0x5d71('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d71('0x5'));var rimraf=require('rimraf');var config=require(_0x5d71('0x6'));var attributes=require(_0x5d71('0x7'));module['exports']=function(_0x1149b1,_0x3ae0f9){return _0x1149b1['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','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 4d36e3d..413ba17 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 _0xcf8a=['jayson/promise','client','http','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ZohoConfiguration,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x245c79,_0x5dc5a5){var _0x456457=function(_0x372797){while(--_0x372797){_0x245c79['push'](_0x245c79['shift']());}};_0x456457(++_0x5dc5a5);}(_0xcf8a,0x1c5));var _0xacf8=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcf8a[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xacf8('0x0'));var util=require(_0xacf8('0x1'));var moment=require('moment');var BPromise=require(_0xacf8('0x2'));var rs=require(_0xacf8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xacf8('0x4'));var logger=require(_0xacf8('0x5'))(_0xacf8('0x6'));var config=require('../../config/environment');var jayson=require(_0xacf8('0x7'));var client=jayson[_0xacf8('0x8')][_0xacf8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a5902,_0x2c7f71,_0x170007){return new BPromise(function(_0x2a61ea,_0x277284){return client[_0xacf8('0xa')](_0x2a5902,_0x170007)[_0xacf8('0xb')](function(_0xcbf6e7){logger[_0xacf8('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x2c7f71,'request\x20sent');logger[_0xacf8('0xd')](_0xacf8('0xe'),_0x2c7f71,_0xacf8('0xf'),JSON['stringify'](_0xcbf6e7));if(_0xcbf6e7[_0xacf8('0x10')]){if(_0xcbf6e7[_0xacf8('0x10')][_0xacf8('0x11')]===0x1f4){logger[_0xacf8('0x10')](_0xacf8('0x12'),_0x2c7f71,_0xcbf6e7[_0xacf8('0x10')][_0xacf8('0x13')]);return _0x277284(_0xcbf6e7[_0xacf8('0x10')][_0xacf8('0x13')]);}logger[_0xacf8('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x2c7f71,_0xcbf6e7[_0xacf8('0x10')]['message']);return _0x2a61ea(_0xcbf6e7['error'][_0xacf8('0x13')]);}else{logger[_0xacf8('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x2c7f71,'request\x20sent');_0x2a61ea(_0xcbf6e7['result'][_0xacf8('0x13')]);}})['catch'](function(_0x2f9b20){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x2c7f71,_0x2f9b20);_0x277284(_0x2f9b20);});});} \ No newline at end of file +var _0x8d61=['http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0x8d61,0x14b));var _0x18d6=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x8d61[_0x26462c];return _0x509a42;};'use strict';var _=require(_0x18d6('0x0'));var util=require(_0x18d6('0x1'));var moment=require('moment');var BPromise=require(_0x18d6('0x2'));var rs=require(_0x18d6('0x3'));var fs=require('fs');var Redis=require(_0x18d6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x18d6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x18d6('0x6'));var jayson=require(_0x18d6('0x7'));var client=jayson[_0x18d6('0x8')][_0x18d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x357873,_0x596f5a,_0x3dbc70){return new BPromise(function(_0x2469df,_0x4347fd){return client[_0x18d6('0xa')](_0x357873,_0x3dbc70)['then'](function(_0x4a0006){logger[_0x18d6('0xb')](_0x18d6('0xc'),_0x596f5a,_0x18d6('0xd'));logger[_0x18d6('0xe')](_0x18d6('0xf'),_0x596f5a,'request\x20sent',JSON['stringify'](_0x4a0006));if(_0x4a0006['error']){if(_0x4a0006['error'][_0x18d6('0x10')]===0x1f4){logger[_0x18d6('0x11')](_0x18d6('0xc'),_0x596f5a,_0x4a0006[_0x18d6('0x11')]['message']);return _0x4347fd(_0x4a0006[_0x18d6('0x11')][_0x18d6('0x12')]);}logger[_0x18d6('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x596f5a,_0x4a0006['error'][_0x18d6('0x12')]);return _0x2469df(_0x4a0006[_0x18d6('0x11')][_0x18d6('0x12')]);}else{logger['info'](_0x18d6('0xc'),_0x596f5a,_0x18d6('0xd'));_0x2469df(_0x4a0006['result'][_0x18d6('0x12')]);}})[_0x18d6('0x13')](function(_0x1594df){logger[_0x18d6('0x11')](_0x18d6('0xc'),_0x596f5a,_0x1594df);_0x4347fd(_0x1594df);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 22945e5..51ab4d1 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 _0xe789=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','Router'];(function(_0x6309c9,_0x36e553){var _0x12bf70=function(_0x539db4){while(--_0x539db4){_0x6309c9['push'](_0x6309c9['shift']());}};_0x12bf70(++_0x36e553);}(_0xe789,0x74));var _0x9e78=function(_0x1b07d1,_0x3ad57c){_0x1b07d1=_0x1b07d1-0x0;var _0x16691f=_0xe789[_0x1b07d1];return _0x16691f;};'use strict';var multer=require(_0x9e78('0x0'));var util=require(_0x9e78('0x1'));var path=require('path');var timeout=require(_0x9e78('0x2'));var express=require('express');var router=express[_0x9e78('0x3')]();var fs_extra=require(_0x9e78('0x4'));var auth=require(_0x9e78('0x5'));var interaction=require(_0x9e78('0x6'));var config=require(_0x9e78('0x7'));var controller=require(_0x9e78('0x8'));router[_0x9e78('0x9')]('/',auth[_0x9e78('0xa')](),controller[_0x9e78('0xb')]);router[_0x9e78('0x9')](_0x9e78('0xc'),auth[_0x9e78('0xa')](),controller[_0x9e78('0xd')]);router[_0x9e78('0xe')]('/',auth[_0x9e78('0xa')](),controller[_0x9e78('0xf')]);router[_0x9e78('0x10')]('/:id',auth[_0x9e78('0xa')](),controller[_0x9e78('0x11')]);router[_0x9e78('0x12')](_0x9e78('0xc'),auth[_0x9e78('0xa')](),controller[_0x9e78('0x13')]);module['exports']=router; \ No newline at end of file +var _0xfb94=['index','/:id','post','create','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated'];(function(_0x179e0d,_0x283326){var _0x3ff29a=function(_0x5c8423){while(--_0x5c8423){_0x179e0d['push'](_0x179e0d['shift']());}};_0x3ff29a(++_0x283326);}(_0xfb94,0x7a));var _0x4fb9=function(_0x3c6d7b,_0x229e7e){_0x3c6d7b=_0x3c6d7b-0x0;var _0x5132cb=_0xfb94[_0x3c6d7b];return _0x5132cb;};'use strict';var multer=require(_0x4fb9('0x0'));var util=require(_0x4fb9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4fb9('0x2'));var router=express[_0x4fb9('0x3')]();var fs_extra=require(_0x4fb9('0x4'));var auth=require(_0x4fb9('0x5'));var interaction=require(_0x4fb9('0x6'));var config=require(_0x4fb9('0x7'));var controller=require(_0x4fb9('0x8'));router[_0x4fb9('0x9')]('/',auth[_0x4fb9('0xa')](),controller[_0x4fb9('0xb')]);router[_0x4fb9('0x9')](_0x4fb9('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4fb9('0xd')]('/',auth[_0x4fb9('0xa')](),controller[_0x4fb9('0xe')]);router[_0x4fb9('0xf')](_0x4fb9('0xc'),auth['isAuthenticated'](),controller[_0x4fb9('0x10')]);router[_0x4fb9('0x11')](_0x4fb9('0xc'),auth[_0x4fb9('0xa')](),controller['destroy']);module[_0x4fb9('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index e7e8b97..93eb294 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 _0x7c74=['picklist','string','STRING','ENUM','BOOLEAN','variable','customVariable','keyValue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7c74,0x185));var _0x47c7=function(_0x4fd109,_0x33c503){_0x4fd109=_0x4fd109-0x0;var _0x30f0a6=_0x7c74[_0x4fd109];return _0x30f0a6;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x47c7('0x0'),_0x47c7('0x1'),_0x47c7('0x2'),_0x47c7('0x3')),'defaultValue':_0x47c7('0x4')},'content':{'type':Sequelize[_0x47c7('0x5')]},'key':{'type':Sequelize[_0x47c7('0x5')]},'keyType':{'type':Sequelize[_0x47c7('0x6')](_0x47c7('0x4'),'variable',_0x47c7('0x1'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x47c7('0x5')]},'nameField':{'type':Sequelize[_0x47c7('0x5')]},'customField':{'type':Sequelize[_0x47c7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x47c7('0x5')]}}; \ No newline at end of file +var _0x6334=['string','picklist','STRING','ENUM','variable','customVariable','sequelize','exports'];(function(_0x2aec7c,_0x276e7d){var _0x4c9738=function(_0x427691){while(--_0x427691){_0x2aec7c['push'](_0x2aec7c['shift']());}};_0x4c9738(++_0x276e7d);}(_0x6334,0x1a6));var _0x4633=function(_0x15cae3,_0x458cb9){_0x15cae3=_0x15cae3-0x0;var _0x20596f=_0x6334[_0x15cae3];return _0x20596f;};'use strict';var Sequelize=require(_0x4633('0x0'));module[_0x4633('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4633('0x2'),'variable','customVariable','keyValue',_0x4633('0x3')),'defaultValue':_0x4633('0x2')},'content':{'type':Sequelize[_0x4633('0x4')]},'key':{'type':Sequelize[_0x4633('0x4')]},'keyType':{'type':Sequelize[_0x4633('0x5')](_0x4633('0x2'),_0x4633('0x6'),_0x4633('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4633('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4633('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index a58ee1c..62064c8 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 _0x3333=['pick','merge','VIRTUAL','filter','includeAll','ZohoField','findAll','rows','catch','params','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2e5a33,_0x2e768c){var _0x1f5221=function(_0x29f9df){while(--_0x29f9df){_0x2e5a33['push'](_0x2e5a33['shift']());}};_0x1f5221(++_0x2e768c);}(_0x3333,0x1dd));var _0x3333=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x3333[_0x2ff238];return _0x204a56;};'use strict';var emlformat=require(_0x3333('0x0'));var rimraf=require(_0x3333('0x1'));var zipdir=require(_0x3333('0x2'));var jsonpatch=require(_0x3333('0x3'));var rp=require(_0x3333('0x4'));var moment=require('moment');var BPromise=require(_0x3333('0x5'));var Mustache=require(_0x3333('0x6'));var util=require(_0x3333('0x7'));var path=require(_0x3333('0x8'));var sox=require(_0x3333('0x9'));var csv=require('to-csv');var ejs=require(_0x3333('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3333('0xb'));var squel=require(_0x3333('0xc'));var crypto=require('crypto');var jsforce=require(_0x3333('0xd'));var deskjs=require(_0x3333('0xe'));var toCsv=require(_0x3333('0xf'));var querystring=require(_0x3333('0x10'));var Papa=require(_0x3333('0x11'));var Redis=require(_0x3333('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3333('0x13'));var as=require(_0x3333('0x14'));var hardwareService=require(_0x3333('0x15'));var logger=require(_0x3333('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x3333('0x17'));var licenseUtil=require(_0x3333('0x18'));var db=require(_0x3333('0x19'))['db'];function respondWithStatusCode(_0x25a36b,_0x411e26){_0x411e26=_0x411e26||0xcc;return function(_0x15e152){if(_0x15e152){return _0x25a36b['sendStatus'](_0x411e26);}return _0x25a36b['status'](_0x411e26)[_0x3333('0x1a')]();};}function respondWithResult(_0x375c87,_0xa15fab){_0xa15fab=_0xa15fab||0xc8;return function(_0x1c1b67){if(_0x1c1b67){return _0x375c87[_0x3333('0x1b')](_0xa15fab)[_0x3333('0x1c')](_0x1c1b67);}};}function respondWithFilteredResult(_0x2be023,_0x3a4c7c){return function(_0x49aa4e){if(_0x49aa4e){var _0x5df09d=typeof _0x3a4c7c[_0x3333('0x1d')]===_0x3333('0x1e')&&typeof _0x3a4c7c[_0x3333('0x1f')]===_0x3333('0x1e');var _0x35e47c=_0x49aa4e[_0x3333('0x20')];var _0x2dd692=_0x5df09d?0x0:_0x3a4c7c[_0x3333('0x1d')];var _0x2fb6e6=_0x5df09d?_0x49aa4e[_0x3333('0x20')]:_0x3a4c7c['offset']+_0x3a4c7c[_0x3333('0x1f')];var _0x2a46e9;if(_0x2fb6e6>=_0x35e47c){_0x2fb6e6=_0x35e47c;_0x2a46e9=0xc8;}else{_0x2a46e9=0xce;}_0x2be023[_0x3333('0x1b')](_0x2a46e9);return _0x2be023[_0x3333('0x21')](_0x3333('0x22'),_0x2dd692+'-'+_0x2fb6e6+'/'+_0x35e47c)[_0x3333('0x1c')](_0x49aa4e);}return null;};}function patchUpdates(_0xcc05a1){return function(_0x4f9a8a){try{jsonpatch[_0x3333('0x23')](_0x4f9a8a,_0xcc05a1,!![]);}catch(_0x38bfe5){return BPromise['reject'](_0x38bfe5);}return _0x4f9a8a[_0x3333('0x24')]();};}function saveUpdates(_0x1250eb,_0x5bd520){return function(_0x35d74b){if(_0x35d74b){return _0x35d74b[_0x3333('0x25')](_0x1250eb)[_0x3333('0x26')](function(_0x18d493){return _0x18d493;});}return null;};}function removeEntity(_0xc78356,_0x2e21ad){return function(_0x3652fb){if(_0x3652fb){return _0x3652fb[_0x3333('0x27')]()[_0x3333('0x26')](function(){_0xc78356[_0x3333('0x1b')](0xcc)[_0x3333('0x1a')]();});}};}function handleEntityNotFound(_0x20f743,_0x5d4f13){return function(_0x6d9445){if(!_0x6d9445){_0x20f743[_0x3333('0x28')](0x194);}return _0x6d9445;};}function handleError(_0x36885b,_0x4a1dcf){_0x4a1dcf=_0x4a1dcf||0x1f4;return function(_0x395855){logger[_0x3333('0x29')](_0x395855['stack']);if(_0x395855['name']){delete _0x395855[_0x3333('0x2a')];}_0x36885b['status'](_0x4a1dcf)[_0x3333('0x2b')](_0x395855);};}exports[_0x3333('0x2c')]=function(_0xd2c3a1,_0x1658d9){var _0x1360e3={},_0x24d3be={},_0x9736ca={'count':0x0,'rows':[]};var _0x4adc04=_[_0x3333('0x2d')](db['ZohoField'][_0x3333('0x2e')],function(_0x203352){return{'name':_0x203352['fieldName'],'type':_0x203352[_0x3333('0x2f')][_0x3333('0x30')]};});_0x24d3be[_0x3333('0x31')]=_['map'](_0x4adc04,_0x3333('0x2a'));_0x24d3be[_0x3333('0x32')]=_[_0x3333('0x33')](_0xd2c3a1[_0x3333('0x32')]);_0x24d3be[_0x3333('0x34')]=_[_0x3333('0x35')](_0x24d3be['model'],_0x24d3be['query']);_0x1360e3[_0x3333('0x36')]=_[_0x3333('0x35')](_0x24d3be['model'],qs[_0x3333('0x37')](_0xd2c3a1[_0x3333('0x32')][_0x3333('0x37')]));_0x1360e3['attributes']=_0x1360e3['attributes'][_0x3333('0x38')]?_0x1360e3[_0x3333('0x36')]:_0x24d3be[_0x3333('0x31')];if(!_0xd2c3a1[_0x3333('0x32')][_0x3333('0x39')](_0x3333('0x3a'))){_0x1360e3[_0x3333('0x1f')]=qs[_0x3333('0x1f')](_0xd2c3a1['query'][_0x3333('0x1f')]);_0x1360e3[_0x3333('0x1d')]=qs[_0x3333('0x1d')](_0xd2c3a1[_0x3333('0x32')]['offset']);}_0x1360e3[_0x3333('0x3b')]=qs['sort'](_0xd2c3a1['query'][_0x3333('0x3c')]);_0x1360e3[_0x3333('0x3d')]=qs['filters'](_[_0x3333('0x3e')](_0xd2c3a1[_0x3333('0x32')],_0x24d3be[_0x3333('0x34')]),_0x4adc04);if(_0xd2c3a1['query']['filter']){_0x1360e3['where']=_[_0x3333('0x3f')](_0x1360e3[_0x3333('0x3d')],{'$or':_[_0x3333('0x2d')](_0x4adc04,function(_0x17edc4){if(_0x17edc4[_0x3333('0x2f')]!==_0x3333('0x40')){var _0x34ea14={};_0x34ea14[_0x17edc4['name']]={'$like':'%'+_0xd2c3a1['query'][_0x3333('0x41')]+'%'};return _0x34ea14;}})});}_0x1360e3=_['merge']({},_0x1360e3,_0xd2c3a1['options']);var _0x26a1a8={'where':_0x1360e3[_0x3333('0x3d')]};return db['ZohoField'][_0x3333('0x20')](_0x26a1a8)[_0x3333('0x26')](function(_0x3a7807){_0x9736ca[_0x3333('0x20')]=_0x3a7807;if(_0xd2c3a1[_0x3333('0x32')][_0x3333('0x42')]){_0x1360e3['include']=[{'all':!![]}];}return db[_0x3333('0x43')][_0x3333('0x44')](_0x1360e3);})[_0x3333('0x26')](function(_0x4a8241){_0x9736ca[_0x3333('0x45')]=_0x4a8241;return _0x9736ca;})[_0x3333('0x26')](respondWithFilteredResult(_0x1658d9,_0x1360e3))[_0x3333('0x46')](handleError(_0x1658d9,null));};exports['show']=function(_0x2e3e5d,_0x1084fa){var _0xddaab2={'raw':!![],'where':{'id':_0x2e3e5d[_0x3333('0x47')]['id']}},_0x5a3f2c={};_0x5a3f2c[_0x3333('0x31')]=_[_0x3333('0x33')](db['ZohoField'][_0x3333('0x2e')]);_0x5a3f2c[_0x3333('0x32')]=_[_0x3333('0x33')](_0x2e3e5d[_0x3333('0x32')]);_0x5a3f2c['filters']=_[_0x3333('0x35')](_0x5a3f2c[_0x3333('0x31')],_0x5a3f2c['query']);_0xddaab2[_0x3333('0x36')]=_[_0x3333('0x35')](_0x5a3f2c[_0x3333('0x31')],qs[_0x3333('0x37')](_0x2e3e5d[_0x3333('0x32')][_0x3333('0x37')]));_0xddaab2[_0x3333('0x36')]=_0xddaab2[_0x3333('0x36')][_0x3333('0x38')]?_0xddaab2[_0x3333('0x36')]:_0x5a3f2c[_0x3333('0x31')];if(_0x2e3e5d[_0x3333('0x32')][_0x3333('0x42')]){_0xddaab2[_0x3333('0x48')]=[{'all':!![]}];}_0xddaab2=_[_0x3333('0x3f')]({},_0xddaab2,_0x2e3e5d[_0x3333('0x49')]);return db[_0x3333('0x43')][_0x3333('0x4a')](_0xddaab2)['then'](handleEntityNotFound(_0x1084fa,null))['then'](respondWithResult(_0x1084fa,null))[_0x3333('0x46')](handleError(_0x1084fa,null));};exports[_0x3333('0x4b')]=function(_0x313964,_0x3d92a0){return db['ZohoField'][_0x3333('0x4b')](_0x313964[_0x3333('0x4c')],{})[_0x3333('0x26')](respondWithResult(_0x3d92a0,0xc9))[_0x3333('0x46')](handleError(_0x3d92a0,null));};exports['update']=function(_0xc787ea,_0x4dccfc){if(_0xc787ea[_0x3333('0x4c')]['id']){delete _0xc787ea[_0x3333('0x4c')]['id'];}return db['ZohoField'][_0x3333('0x4a')]({'where':{'id':_0xc787ea['params']['id']}})[_0x3333('0x26')](handleEntityNotFound(_0x4dccfc,null))[_0x3333('0x26')](saveUpdates(_0xc787ea[_0x3333('0x4c')],null))[_0x3333('0x26')](respondWithResult(_0x4dccfc,null))[_0x3333('0x46')](handleError(_0x4dccfc,null));};exports['destroy']=function(_0xe3ff31,_0x419061){return db[_0x3333('0x43')]['find']({'where':{'id':_0xe3ff31[_0x3333('0x47')]['id']}})[_0x3333('0x26')](handleEntityNotFound(_0x419061,null))['then'](removeEntity(_0x419061,null))[_0x3333('0x46')](handleError(_0x419061,null));}; \ No newline at end of file +var _0x1a15=['json','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','ZohoField','include','findAll','catch','show','params','includeAll','find','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','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','limit','count','Content-Range'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0x1a15,0x103));var _0x51a1=function(_0x3948d6,_0x2441b5){_0x3948d6=_0x3948d6-0x0;var _0x24147a=_0x1a15[_0x3948d6];return _0x24147a;};'use strict';var emlformat=require(_0x51a1('0x0'));var rimraf=require(_0x51a1('0x1'));var zipdir=require(_0x51a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51a1('0x3'));var moment=require(_0x51a1('0x4'));var BPromise=require(_0x51a1('0x5'));var Mustache=require(_0x51a1('0x6'));var util=require(_0x51a1('0x7'));var path=require('path');var sox=require(_0x51a1('0x8'));var csv=require(_0x51a1('0x9'));var ejs=require(_0x51a1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x51a1('0xb'));var squel=require(_0x51a1('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x51a1('0xd'));var toCsv=require(_0x51a1('0x9'));var querystring=require(_0x51a1('0xe'));var Papa=require(_0x51a1('0xf'));var Redis=require('ioredis');var authService=require(_0x51a1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x51a1('0x11'));var hardwareService=require(_0x51a1('0x12'));var logger=require(_0x51a1('0x13'))(_0x51a1('0x14'));var utils=require(_0x51a1('0x15'));var config=require(_0x51a1('0x16'));var licenseUtil=require(_0x51a1('0x17'));var db=require(_0x51a1('0x18'))['db'];function respondWithStatusCode(_0x4bcdec,_0x5c9d37){_0x5c9d37=_0x5c9d37||0xcc;return function(_0x3e3fa0){if(_0x3e3fa0){return _0x4bcdec[_0x51a1('0x19')](_0x5c9d37);}return _0x4bcdec[_0x51a1('0x1a')](_0x5c9d37)[_0x51a1('0x1b')]();};}function respondWithResult(_0x113745,_0x5984cd){_0x5984cd=_0x5984cd||0xc8;return function(_0x3c24ea){if(_0x3c24ea){return _0x113745['status'](_0x5984cd)['json'](_0x3c24ea);}};}function respondWithFilteredResult(_0x2b73ae,_0x164cd1){return function(_0x1b0f32){if(_0x1b0f32){var _0x1b9c36=typeof _0x164cd1[_0x51a1('0x1c')]===_0x51a1('0x1d')&&typeof _0x164cd1[_0x51a1('0x1e')]===_0x51a1('0x1d');var _0x328d2e=_0x1b0f32[_0x51a1('0x1f')];var _0x2452da=_0x1b9c36?0x0:_0x164cd1[_0x51a1('0x1c')];var _0x3c85ef=_0x1b9c36?_0x1b0f32[_0x51a1('0x1f')]:_0x164cd1[_0x51a1('0x1c')]+_0x164cd1[_0x51a1('0x1e')];var _0x2a87cd;if(_0x3c85ef>=_0x328d2e){_0x3c85ef=_0x328d2e;_0x2a87cd=0xc8;}else{_0x2a87cd=0xce;}_0x2b73ae[_0x51a1('0x1a')](_0x2a87cd);return _0x2b73ae['set'](_0x51a1('0x20'),_0x2452da+'-'+_0x3c85ef+'/'+_0x328d2e)[_0x51a1('0x21')](_0x1b0f32);}return null;};}function patchUpdates(_0xd6117c){return function(_0xefcf35){try{jsonpatch['apply'](_0xefcf35,_0xd6117c,!![]);}catch(_0xeec20d){return BPromise[_0x51a1('0x22')](_0xeec20d);}return _0xefcf35['save']();};}function saveUpdates(_0x58f1f3,_0x4a0a3d){return function(_0x39bf5f){if(_0x39bf5f){return _0x39bf5f[_0x51a1('0x23')](_0x58f1f3)[_0x51a1('0x24')](function(_0x5cc3db){return _0x5cc3db;});}return null;};}function removeEntity(_0x387611,_0x12405b){return function(_0x2ff936){if(_0x2ff936){return _0x2ff936[_0x51a1('0x25')]()[_0x51a1('0x24')](function(){_0x387611[_0x51a1('0x1a')](0xcc)[_0x51a1('0x1b')]();});}};}function handleEntityNotFound(_0x2547c8,_0x55a206){return function(_0x3d9b71){if(!_0x3d9b71){_0x2547c8[_0x51a1('0x19')](0x194);}return _0x3d9b71;};}function handleError(_0x126f13,_0xc2467e){_0xc2467e=_0xc2467e||0x1f4;return function(_0x2b99c1){logger[_0x51a1('0x26')](_0x2b99c1[_0x51a1('0x27')]);if(_0x2b99c1['name']){delete _0x2b99c1[_0x51a1('0x28')];}_0x126f13[_0x51a1('0x1a')](_0xc2467e)[_0x51a1('0x29')](_0x2b99c1);};}exports[_0x51a1('0x2a')]=function(_0x21face,_0x2fd1db){var _0x318ca6={},_0x434682={},_0x3a0abf={'count':0x0,'rows':[]};var _0x2b9cbe=_[_0x51a1('0x2b')](db['ZohoField'][_0x51a1('0x2c')],function(_0x438b72){return{'name':_0x438b72['fieldName'],'type':_0x438b72[_0x51a1('0x2d')][_0x51a1('0x2e')]};});_0x434682[_0x51a1('0x2f')]=_[_0x51a1('0x2b')](_0x2b9cbe,_0x51a1('0x28'));_0x434682['query']=_[_0x51a1('0x30')](_0x21face[_0x51a1('0x31')]);_0x434682['filters']=_['intersection'](_0x434682['model'],_0x434682[_0x51a1('0x31')]);_0x318ca6[_0x51a1('0x32')]=_[_0x51a1('0x33')](_0x434682[_0x51a1('0x2f')],qs[_0x51a1('0x34')](_0x21face[_0x51a1('0x31')][_0x51a1('0x34')]));_0x318ca6[_0x51a1('0x32')]=_0x318ca6[_0x51a1('0x32')][_0x51a1('0x35')]?_0x318ca6['attributes']:_0x434682[_0x51a1('0x2f')];if(!_0x21face[_0x51a1('0x31')][_0x51a1('0x36')](_0x51a1('0x37'))){_0x318ca6[_0x51a1('0x1e')]=qs[_0x51a1('0x1e')](_0x21face[_0x51a1('0x31')][_0x51a1('0x1e')]);_0x318ca6['offset']=qs[_0x51a1('0x1c')](_0x21face['query']['offset']);}_0x318ca6['order']=qs[_0x51a1('0x38')](_0x21face[_0x51a1('0x31')]['sort']);_0x318ca6[_0x51a1('0x39')]=qs[_0x51a1('0x3a')](_[_0x51a1('0x3b')](_0x21face['query'],_0x434682['filters']),_0x2b9cbe);if(_0x21face['query'][_0x51a1('0x3c')]){_0x318ca6[_0x51a1('0x39')]=_[_0x51a1('0x3d')](_0x318ca6[_0x51a1('0x39')],{'$or':_[_0x51a1('0x2b')](_0x2b9cbe,function(_0x3ed638){if(_0x3ed638[_0x51a1('0x2d')]!==_0x51a1('0x3e')){var _0x1f7d76={};_0x1f7d76[_0x3ed638[_0x51a1('0x28')]]={'$like':'%'+_0x21face[_0x51a1('0x31')][_0x51a1('0x3c')]+'%'};return _0x1f7d76;}})});}_0x318ca6=_['merge']({},_0x318ca6,_0x21face[_0x51a1('0x3f')]);var _0x5cfd0a={'where':_0x318ca6['where']};return db[_0x51a1('0x40')][_0x51a1('0x1f')](_0x5cfd0a)[_0x51a1('0x24')](function(_0x20eb05){_0x3a0abf['count']=_0x20eb05;if(_0x21face['query']['includeAll']){_0x318ca6[_0x51a1('0x41')]=[{'all':!![]}];}return db['ZohoField'][_0x51a1('0x42')](_0x318ca6);})[_0x51a1('0x24')](function(_0x20b602){_0x3a0abf['rows']=_0x20b602;return _0x3a0abf;})[_0x51a1('0x24')](respondWithFilteredResult(_0x2fd1db,_0x318ca6))[_0x51a1('0x43')](handleError(_0x2fd1db,null));};exports[_0x51a1('0x44')]=function(_0x1c7ade,_0x2b25ed){var _0x4cec3d={'raw':!![],'where':{'id':_0x1c7ade[_0x51a1('0x45')]['id']}},_0x470df7={};_0x470df7[_0x51a1('0x2f')]=_['keys'](db[_0x51a1('0x40')][_0x51a1('0x2c')]);_0x470df7[_0x51a1('0x31')]=_[_0x51a1('0x30')](_0x1c7ade[_0x51a1('0x31')]);_0x470df7[_0x51a1('0x3a')]=_[_0x51a1('0x33')](_0x470df7[_0x51a1('0x2f')],_0x470df7[_0x51a1('0x31')]);_0x4cec3d[_0x51a1('0x32')]=_[_0x51a1('0x33')](_0x470df7['model'],qs[_0x51a1('0x34')](_0x1c7ade['query'][_0x51a1('0x34')]));_0x4cec3d[_0x51a1('0x32')]=_0x4cec3d[_0x51a1('0x32')][_0x51a1('0x35')]?_0x4cec3d[_0x51a1('0x32')]:_0x470df7[_0x51a1('0x2f')];if(_0x1c7ade[_0x51a1('0x31')][_0x51a1('0x46')]){_0x4cec3d['include']=[{'all':!![]}];}_0x4cec3d=_[_0x51a1('0x3d')]({},_0x4cec3d,_0x1c7ade[_0x51a1('0x3f')]);return db['ZohoField'][_0x51a1('0x47')](_0x4cec3d)[_0x51a1('0x24')](handleEntityNotFound(_0x2b25ed,null))[_0x51a1('0x24')](respondWithResult(_0x2b25ed,null))[_0x51a1('0x43')](handleError(_0x2b25ed,null));};exports['create']=function(_0x5de213,_0x4edb7f){return db[_0x51a1('0x40')]['create'](_0x5de213[_0x51a1('0x48')],{})[_0x51a1('0x24')](respondWithResult(_0x4edb7f,0xc9))[_0x51a1('0x43')](handleError(_0x4edb7f,null));};exports[_0x51a1('0x23')]=function(_0x5c94b7,_0xb30edc){if(_0x5c94b7[_0x51a1('0x48')]['id']){delete _0x5c94b7[_0x51a1('0x48')]['id'];}return db[_0x51a1('0x40')][_0x51a1('0x47')]({'where':{'id':_0x5c94b7[_0x51a1('0x45')]['id']}})[_0x51a1('0x24')](handleEntityNotFound(_0xb30edc,null))['then'](saveUpdates(_0x5c94b7[_0x51a1('0x48')],null))[_0x51a1('0x24')](respondWithResult(_0xb30edc,null))['catch'](handleError(_0xb30edc,null));};exports[_0x51a1('0x25')]=function(_0x5dcde6,_0x3ee8e6){return db['ZohoField']['find']({'where':{'id':_0x5dcde6[_0x51a1('0x45')]['id']}})[_0x51a1('0x24')](handleEntityNotFound(_0x3ee8e6,null))[_0x51a1('0x24')](removeEntity(_0x3ee8e6,null))[_0x51a1('0x43')](handleError(_0x3ee8e6,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 2df912a..c7370fa 100644 --- a/server/api/intZohoField/intZohoField.model.js +++ b/server/api/intZohoField/intZohoField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2e3=['request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xf2e3[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var logger=require(_0x3f2e('0x1'))(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var rp=require(_0x3f2e('0x5'));var fs=require('fs');var path=require(_0x3f2e('0x6'));var rimraf=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var attributes=require(_0x3f2e('0x9'));module['exports']=function(_0x33a3b7,_0xdd6b3e){return _0x33a3b7[_0x3f2e('0xa')](_0x3f2e('0xb'),attributes,{'tableName':_0x3f2e('0xc'),'paranoid':![],'indexes':[{'name':_0x3f2e('0xd'),'fields':[_0x3f2e('0xe'),_0x3f2e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x524e=['define','ZohoField','zoho_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports'];(function(_0x2390bd,_0x212fbd){var _0x3a969d=function(_0x3dd049){while(--_0x3dd049){_0x2390bd['push'](_0x2390bd['shift']());}};_0x3a969d(++_0x212fbd);}(_0x524e,0x15e));var _0xe524=function(_0x1abe89,_0xe519b4){_0x1abe89=_0x1abe89-0x0;var _0x2de32a=_0x524e[_0x1abe89];return _0x2de32a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));module[_0xe524('0x9')]=function(_0x4f75d6,_0xaaeaa9){return _0x4f75d6[_0xe524('0xa')](_0xe524('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xe524('0xc'),'fields':[_0xe524('0xd'),_0xe524('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index cc9a501..d20892e 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 _0xe865=['client','request','then','ZohoField,\x20%s,\x20%s','debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x28ad0a,_0x1c7181){var _0x1d1116=function(_0x23606e){while(--_0x23606e){_0x28ad0a['push'](_0x28ad0a['shift']());}};_0x1d1116(++_0x1c7181);}(_0xe865,0xdc));var _0x5e86=function(_0x9f05d9,_0x2ff1ca){_0x9f05d9=_0x9f05d9-0x0;var _0x5028a1=_0xe865[_0x9f05d9];return _0x5028a1;};'use strict';var _=require('lodash');var util=require(_0x5e86('0x0'));var moment=require(_0x5e86('0x1'));var BPromise=require(_0x5e86('0x2'));var rs=require(_0x5e86('0x3'));var fs=require('fs');var Redis=require(_0x5e86('0x4'));var db=require(_0x5e86('0x5'))['db'];var utils=require(_0x5e86('0x6'));var logger=require(_0x5e86('0x7'))(_0x5e86('0x8'));var config=require(_0x5e86('0x9'));var jayson=require(_0x5e86('0xa'));var client=jayson[_0x5e86('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x268a4a,_0x42b354,_0x3538a7){return new BPromise(function(_0x3491a4,_0x5d1514){return client[_0x5e86('0xc')](_0x268a4a,_0x3538a7)[_0x5e86('0xd')](function(_0xaa41f0){logger['info'](_0x5e86('0xe'),_0x42b354,'request\x20sent');logger[_0x5e86('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x42b354,'request\x20sent',JSON[_0x5e86('0x10')](_0xaa41f0));if(_0xaa41f0[_0x5e86('0x11')]){if(_0xaa41f0[_0x5e86('0x11')][_0x5e86('0x12')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x42b354,_0xaa41f0[_0x5e86('0x11')]['message']);return _0x5d1514(_0xaa41f0[_0x5e86('0x11')]['message']);}logger[_0x5e86('0x11')]('ZohoField,\x20%s,\x20%s',_0x42b354,_0xaa41f0['error'][_0x5e86('0x13')]);return _0x3491a4(_0xaa41f0[_0x5e86('0x11')]['message']);}else{logger['info'](_0x5e86('0xe'),_0x42b354,'request\x20sent');_0x3491a4(_0xaa41f0['result'][_0x5e86('0x13')]);}})[_0x5e86('0x14')](function(_0x5bac66){logger[_0x5e86('0x11')](_0x5e86('0xe'),_0x42b354,_0x5bac66);_0x5d1514(_0x5bac66);});});} \ No newline at end of file +var _0x76ad=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x76ad,0x12f));var _0xd76a=function(_0x2e17ee,_0x2ca16d){_0x2e17ee=_0x2e17ee-0x0;var _0x3155ba=_0x76ad[_0x2e17ee];return _0x3155ba;};'use strict';var _=require('lodash');var util=require(_0xd76a('0x0'));var moment=require(_0xd76a('0x1'));var BPromise=require(_0xd76a('0x2'));var rs=require(_0xd76a('0x3'));var fs=require('fs');var Redis=require(_0xd76a('0x4'));var db=require(_0xd76a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd76a('0x6'))(_0xd76a('0x7'));var config=require(_0xd76a('0x8'));var jayson=require(_0xd76a('0x9'));var client=jayson[_0xd76a('0xa')][_0xd76a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x947ab,_0x384c8d,_0x3626cf){return new BPromise(function(_0x34a803,_0x4fc316){return client['request'](_0x947ab,_0x3626cf)[_0xd76a('0xc')](function(_0x272f32){logger[_0xd76a('0xd')](_0xd76a('0xe'),_0x384c8d,_0xd76a('0xf'));logger[_0xd76a('0x10')](_0xd76a('0x11'),_0x384c8d,_0xd76a('0xf'),JSON['stringify'](_0x272f32));if(_0x272f32[_0xd76a('0x12')]){if(_0x272f32[_0xd76a('0x12')]['code']===0x1f4){logger[_0xd76a('0x12')](_0xd76a('0xe'),_0x384c8d,_0x272f32[_0xd76a('0x12')][_0xd76a('0x13')]);return _0x4fc316(_0x272f32[_0xd76a('0x12')][_0xd76a('0x13')]);}logger[_0xd76a('0x12')](_0xd76a('0xe'),_0x384c8d,_0x272f32['error']['message']);return _0x34a803(_0x272f32[_0xd76a('0x12')]['message']);}else{logger[_0xd76a('0xd')]('ZohoField,\x20%s,\x20%s',_0x384c8d,'request\x20sent');_0x34a803(_0x272f32[_0xd76a('0x14')][_0xd76a('0x13')]);}})[_0xd76a('0x15')](function(_0x110c7e){logger['error'](_0xd76a('0xe'),_0x384c8d,_0x110c7e);_0x4fc316(_0x110c7e);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index c8abfe8..8e0cfcf 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(_0x21d3b1,_0x8853b4){var _0x522484=function(_0x49b72c){while(--_0x49b72c){_0x21d3b1['push'](_0x21d3b1['shift']());}};_0x522484(++_0x8853b4);}(_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(_0x479060,_0x4712e6){var _0x2eab27=function(_0x2711bf){while(--_0x2711bf){_0x479060['push'](_0x479060['shift']());}};_0x2eab27(++_0x4712e6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xcb91[_0x1928c9];return _0x51b5fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index b637191..582c5a9 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 _0x7c35=['app.js','INTEGER','state','exports','STRING','unique_name_and_version'];(function(_0x587cd2,_0x4e9ce5){var _0x45dfd0=function(_0x57f5f0){while(--_0x57f5f0){_0x587cd2['push'](_0x587cd2['shift']());}};_0x45dfd0(++_0x4e9ce5);}(_0x7c35,0x135));var _0x57c3=function(_0x23e8e9,_0xc1bc79){_0x23e8e9=_0x23e8e9-0x0;var _0x3ce8f6=_0x7c35[_0x23e8e9];return _0x3ce8f6;};'use strict';var Sequelize=require('sequelize');module[_0x57c3('0x0')]={'name':{'type':Sequelize[_0x57c3('0x1')],'allowNull':![],'unique':_0x57c3('0x2')},'version':{'type':Sequelize[_0x57c3('0x1')],'allowNull':![],'unique':_0x57c3('0x2')},'main':{'type':Sequelize[_0x57c3('0x1')],'defaultValue':_0x57c3('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x57c3('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x57c3('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x57c3('0x1')]},'state':{'type':Sequelize[_0x57c3('0x1')],'unique':_0x57c3('0x5')},'description':{'type':Sequelize[_0x57c3('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x57c3('0x1')]},'link':{'type':Sequelize[_0x57c3('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xe6c4=['app.js','sequelize','exports','STRING','unique_name_and_version'];(function(_0x5daa07,_0x3610e7){var _0xdacc94=function(_0x56468f){while(--_0x56468f){_0x5daa07['push'](_0x5daa07['shift']());}};_0xdacc94(++_0x3610e7);}(_0xe6c4,0x1dc));var _0x4e6c=function(_0x29d5c0,_0x40e8b3){_0x29d5c0=_0x29d5c0-0x0;var _0x5f8071=_0xe6c4[_0x29d5c0];return _0x5f8071;};'use strict';var Sequelize=require(_0x4e6c('0x0'));module[_0x4e6c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x4e6c('0x2')],'allowNull':![],'unique':_0x4e6c('0x3')},'main':{'type':Sequelize[_0x4e6c('0x2')],'defaultValue':_0x4e6c('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x4e6c('0x2')]},'type':{'type':Sequelize[_0x4e6c('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x4e6c('0x2')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x4e6c('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x4e6c('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 1945df2..f59c64c 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 _0xe3da=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','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','jsforce','desk.js','papaparse'];(function(_0x1faa3d,_0x55fc7a){var _0x44e078=function(_0x1f3ea5){while(--_0x1f3ea5){_0x1faa3d['push'](_0x1faa3d['shift']());}};_0x44e078(++_0x55fc7a);}(_0xe3da,0x1cd));var _0xae3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe3da[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));}; \ No newline at end of file +var _0xc4aa=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Integration','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index d3c249b..40d56a7 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 _0xca4f=['api','moment','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash','../../config/logger'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0xca4f,0x12a));var _0xfca4=function(_0x3e4d0c,_0x2dc4be){_0x3e4d0c=_0x3e4d0c-0x0;var _0x16ccae=_0xca4f[_0x3e4d0c];return _0x16ccae;};'use strict';var _=require(_0xfca4('0x0'));var util=require('util');var logger=require(_0xfca4('0x1'))(_0xfca4('0x2'));var moment=require(_0xfca4('0x3'));var BPromise=require('bluebird');var rp=require(_0xfca4('0x4'));var fs=require('fs');var path=require(_0xfca4('0x5'));var rimraf=require(_0xfca4('0x6'));var config=require(_0xfca4('0x7'));var attributes=require(_0xfca4('0x8'));module[_0xfca4('0x9')]=function(_0x2f728a,_0x316578){return _0x2f728a['define'](_0xfca4('0xa'),attributes,{'tableName':_0xfca4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ec8=['integrations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','define'];(function(_0x3707b3,_0x40b491){var _0x3e9651=function(_0x4a5e02){while(--_0x4a5e02){_0x3707b3['push'](_0x3707b3['shift']());}};_0x3e9651(++_0x40b491);}(_0x0ec8,0x91));var _0x80ec=function(_0x52477b,_0x99d0c9){_0x52477b=_0x52477b-0x0;var _0x5501cb=_0x0ec8[_0x52477b];return _0x5501cb;};'use strict';var _=require(_0x80ec('0x0'));var util=require(_0x80ec('0x1'));var logger=require('../../config/logger')(_0x80ec('0x2'));var moment=require(_0x80ec('0x3'));var BPromise=require(_0x80ec('0x4'));var rp=require(_0x80ec('0x5'));var fs=require('fs');var path=require(_0x80ec('0x6'));var rimraf=require(_0x80ec('0x7'));var config=require(_0x80ec('0x8'));var attributes=require(_0x80ec('0x9'));module['exports']=function(_0x59520b,_0x52c97d){return _0x59520b[_0x80ec('0xa')]('Integration',attributes,{'tableName':_0x80ec('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 66f0815..d7a3051 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 _0x57ca=['client','http','request','info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2c485d,_0x287efa){var _0x2e6bca=function(_0x1ec7e5){while(--_0x1ec7e5){_0x2c485d['push'](_0x2c485d['shift']());}};_0x2e6bca(++_0x287efa);}(_0x57ca,0x108));var _0xa57c=function(_0xfd43d9,_0x581a81){_0xfd43d9=_0xfd43d9-0x0;var _0x149c92=_0x57ca[_0xfd43d9];return _0x149c92;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('Integration,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('Integration,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x549ae0,_0x321990){var _0x36bc5d=function(_0x4e3285){while(--_0x4e3285){_0x549ae0['push'](_0x549ae0['shift']());}};_0x36bc5d(++_0x321990);}(_0x1a85,0x178));var _0x51a8=function(_0x5c6469,_0x54afe8){_0x5c6469=_0x5c6469-0x0;var _0x4a85d0=_0x1a85[_0x5c6469];return _0x4a85d0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Integration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 45df20a..01a2804 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x14462f,_0x2202e3){var _0x5a3c14=function(_0x339a5c){while(--_0x339a5c){_0x14462f['push'](_0x14462f['shift']());}};_0x5a3c14(++_0x2202e3);}(_0x4975,0x86));var _0x5497=function(_0x101511,_0xb0cec4){_0x101511=_0x101511-0x0;var _0x2c0973=_0x4975[_0x101511];return _0x2c0973;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0xda2d=['show','create','put','/:id','update','delete','util','path','connect-timeout','express','Router','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xda2d,0x102));var _0xdda2=function(_0x32c7b9,_0x11d3ac){_0x32c7b9=_0x32c7b9-0x0;var _0x1dc7ed=_0xda2d[_0x32c7b9];return _0x1dc7ed;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0x7')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xc')]);router['post']('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x11')](_0xdda2('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 43364e6..bb16567 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 _0x6f18=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x21c680,_0x33ba7b){var _0x375c39=function(_0x28e022){while(--_0x28e022){_0x21c680['push'](_0x21c680['shift']());}};_0x375c39(++_0x33ba7b);}(_0x6f18,0x174));var _0x86f1=function(_0x269034,_0x5407f1){_0x269034=_0x269034-0x0;var _0x1258a4=_0x6f18[_0x269034];return _0x1258a4;};'use strict';var Sequelize=require(_0x86f1('0x0'));module[_0x86f1('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x86f1('0x2')]},'exitStatus':{'type':Sequelize[_0x86f1('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x86f1('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x86f1('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x86f1('0x2')]},'queue':{'type':Sequelize[_0x86f1('0x2')]},'interface':{'type':Sequelize[_0x86f1('0x2')]},'membername':{'type':Sequelize[_0x86f1('0x2')]},'agentcalledAt':{'type':Sequelize[_0x86f1('0x4')]},'agentconnectAt':{'type':Sequelize[_0x86f1('0x4')]},'holdtime':{'type':Sequelize[_0x86f1('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x86f1('0x4')]},'talktime':{'type':Sequelize[_0x86f1('0x3')]},'agentacw':{'type':Sequelize[_0x86f1('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x86f1('0x3')]},'reason':{'type':Sequelize[_0x86f1('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x86f1('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x86f1('0x4')]},'lastevent':{'type':Sequelize[_0x86f1('0x2')]},'channel':{'type':Sequelize[_0x86f1('0x2')]},'channelstate':{'type':Sequelize[_0x86f1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x86f1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x86f1('0x2')]},'connectedlinename':{'type':Sequelize[_0x86f1('0x2')]},'language':{'type':Sequelize[_0x86f1('0x2')]},'accountcode':{'type':Sequelize[_0x86f1('0x2')]},'context':{'type':Sequelize[_0x86f1('0x2')]},'exten':{'type':Sequelize[_0x86f1('0x2')]},'priority':{'type':Sequelize[_0x86f1('0x2')]},'destchannel':{'type':Sequelize[_0x86f1('0x2')]},'destchannelstate':{'type':Sequelize[_0x86f1('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x86f1('0x2')]},'destcalleridname':{'type':Sequelize[_0x86f1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x86f1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x86f1('0x2')]},'destlanguage':{'type':Sequelize[_0x86f1('0x2')]},'destaccountcode':{'type':Sequelize[_0x86f1('0x2')]},'destcontext':{'type':Sequelize[_0x86f1('0x2')]},'destexten':{'type':Sequelize[_0x86f1('0x2')]},'destpriority':{'type':Sequelize[_0x86f1('0x2')]},'destuniqueid':{'type':Sequelize[_0x86f1('0x2')]},'messageId':{'type':Sequelize[_0x86f1('0x2')]},'inReplyTo':{'type':Sequelize[_0x86f1('0x2')]},'subject':{'type':Sequelize[_0x86f1('0x2')]},'from':{'type':Sequelize[_0x86f1('0x2')]},'to':{'type':Sequelize[_0x86f1('0x2')]},'cc':{'type':Sequelize[_0x86f1('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x86f1('0x6')]},'text':{'type':Sequelize[_0x86f1('0x6')]},'status':{'type':Sequelize[_0x86f1('0x7')]('SENT','SENDING',_0x86f1('0x8'),_0x86f1('0x9'))},'url':{'type':Sequelize[_0x86f1('0x2')]},'app':{'type':Sequelize[_0x86f1('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x86f1('0x3')]}}; \ No newline at end of file +var _0x2eaf=['SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM'];(function(_0xd673c1,_0x44ea77){var _0x44bd5f=function(_0x191d4e){while(--_0x191d4e){_0xd673c1['push'](_0xd673c1['shift']());}};_0x44bd5f(++_0x44ea77);}(_0x2eaf,0x100));var _0xf2ea=function(_0xb0c11d,_0x3cefe9){_0xb0c11d=_0xb0c11d-0x0;var _0x7f6999=_0x2eaf[_0xb0c11d];return _0x7f6999;};'use strict';var Sequelize=require(_0xf2ea('0x0'));module[_0xf2ea('0x1')]={'integration':{'type':Sequelize[_0xf2ea('0x2')]},'eventChannel':{'type':Sequelize[_0xf2ea('0x2')]},'exitStatus':{'type':Sequelize[_0xf2ea('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xf2ea('0x2')]},'uniqueid':{'type':Sequelize[_0xf2ea('0x2')]},'calleridnum':{'type':Sequelize[_0xf2ea('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf2ea('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xf2ea('0x3')]},'holdtime':{'type':Sequelize[_0xf2ea('0x4')]},'agentcomplete':{'type':Sequelize[_0xf2ea('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xf2ea('0x4')]},'agentacw':{'type':Sequelize[_0xf2ea('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf2ea('0x4')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xf2ea('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xf2ea('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf2ea('0x3')]},'lastevent':{'type':Sequelize[_0xf2ea('0x2')]},'channel':{'type':Sequelize[_0xf2ea('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf2ea('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf2ea('0x2')]},'priority':{'type':Sequelize[_0xf2ea('0x2')]},'destchannel':{'type':Sequelize[_0xf2ea('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf2ea('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf2ea('0x2')]},'destcalleridname':{'type':Sequelize[_0xf2ea('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xf2ea('0x2')]},'destlanguage':{'type':Sequelize[_0xf2ea('0x2')]},'destaccountcode':{'type':Sequelize[_0xf2ea('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf2ea('0x2')]},'destpriority':{'type':Sequelize[_0xf2ea('0x2')]},'destuniqueid':{'type':Sequelize[_0xf2ea('0x2')]},'messageId':{'type':Sequelize[_0xf2ea('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xf2ea('0x2')]},'from':{'type':Sequelize[_0xf2ea('0x2')]},'to':{'type':Sequelize[_0xf2ea('0x2')]},'cc':{'type':Sequelize[_0xf2ea('0x2')]},'attachment':{'type':Sequelize[_0xf2ea('0x6')]},'html':{'type':Sequelize[_0xf2ea('0x6')]},'text':{'type':Sequelize[_0xf2ea('0x6')]},'status':{'type':Sequelize[_0xf2ea('0x7')](_0xf2ea('0x8'),_0xf2ea('0x9'),_0xf2ea('0xa'),_0xf2ea('0xb'))},'url':{'type':Sequelize[_0xf2ea('0x2')]},'app':{'type':Sequelize[_0xf2ea('0x2')]},'appdata':{'type':Sequelize[_0xf2ea('0x2')]},'projectId':{'type':Sequelize[_0xf2ea('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 0b0c362..5352b15 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 _0x311a=['bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','destroy','then','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','type','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'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x311a,0xde));var _0xa311=function(_0x5d0b34,_0x44716a){_0x5d0b34=_0x5d0b34-0x0;var _0x24306d=_0x311a[_0x5d0b34];return _0x24306d;};'use strict';var emlformat=require(_0xa311('0x0'));var rimraf=require(_0xa311('0x1'));var zipdir=require(_0xa311('0x2'));var jsonpatch=require(_0xa311('0x3'));var rp=require(_0xa311('0x4'));var moment=require(_0xa311('0x5'));var BPromise=require(_0xa311('0x6'));var Mustache=require(_0xa311('0x7'));var util=require(_0xa311('0x8'));var path=require('path');var sox=require(_0xa311('0x9'));var csv=require(_0xa311('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa311('0xb'));var squel=require(_0xa311('0xc'));var crypto=require(_0xa311('0xd'));var jsforce=require(_0xa311('0xe'));var deskjs=require(_0xa311('0xf'));var toCsv=require(_0xa311('0xa'));var querystring=require(_0xa311('0x10'));var Papa=require(_0xa311('0x11'));var Redis=require(_0xa311('0x12'));var authService=require(_0xa311('0x13'));var qs=require(_0xa311('0x14'));var as=require(_0xa311('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa311('0x16'));var config=require(_0xa311('0x17'));var licenseUtil=require(_0xa311('0x18'));var db=require(_0xa311('0x19'))['db'];function respondWithStatusCode(_0x4b13bc,_0x109579){_0x109579=_0x109579||0xcc;return function(_0x15ccac){if(_0x15ccac){return _0x4b13bc['sendStatus'](_0x109579);}return _0x4b13bc[_0xa311('0x1a')](_0x109579)[_0xa311('0x1b')]();};}function respondWithResult(_0x459e6b,_0x1f22cd){_0x1f22cd=_0x1f22cd||0xc8;return function(_0x354216){if(_0x354216){return _0x459e6b[_0xa311('0x1a')](_0x1f22cd)[_0xa311('0x1c')](_0x354216);}};}function respondWithFilteredResult(_0x580883,_0x5aa904){return function(_0x19b110){if(_0x19b110){var _0x306834=typeof _0x5aa904['offset']===_0xa311('0x1d')&&typeof _0x5aa904['limit']===_0xa311('0x1d');var _0x585b4b=_0x19b110[_0xa311('0x1e')];var _0x129ae0=_0x306834?0x0:_0x5aa904[_0xa311('0x1f')];var _0xafe94c=_0x306834?_0x19b110[_0xa311('0x1e')]:_0x5aa904[_0xa311('0x1f')]+_0x5aa904[_0xa311('0x20')];var _0x11a270;if(_0xafe94c>=_0x585b4b){_0xafe94c=_0x585b4b;_0x11a270=0xc8;}else{_0x11a270=0xce;}_0x580883['status'](_0x11a270);return _0x580883[_0xa311('0x21')]('Content-Range',_0x129ae0+'-'+_0xafe94c+'/'+_0x585b4b)[_0xa311('0x1c')](_0x19b110);}return null;};}function patchUpdates(_0x4e1366){return function(_0x552636){try{jsonpatch[_0xa311('0x22')](_0x552636,_0x4e1366,!![]);}catch(_0x5e6574){return BPromise[_0xa311('0x23')](_0x5e6574);}return _0x552636[_0xa311('0x24')]();};}function saveUpdates(_0x3e6643,_0x3ab126){return function(_0x49ad40){if(_0x49ad40){return _0x49ad40[_0xa311('0x25')](_0x3e6643)['then'](function(_0x56c052){return _0x56c052;});}return null;};}function removeEntity(_0xc22b55,_0x10033f){return function(_0x335739){if(_0x335739){return _0x335739[_0xa311('0x26')]()[_0xa311('0x27')](function(){_0xc22b55[_0xa311('0x1a')](0xcc)[_0xa311('0x1b')]();});}};}function handleEntityNotFound(_0x50bdd9,_0x3e0435){return function(_0x35833b){if(!_0x35833b){_0x50bdd9['sendStatus'](0x194);}return _0x35833b;};}function handleError(_0x228259,_0x140e93){_0x140e93=_0x140e93||0x1f4;return function(_0x15e2d7){logger['error'](_0x15e2d7[_0xa311('0x28')]);if(_0x15e2d7[_0xa311('0x29')]){delete _0x15e2d7[_0xa311('0x29')];}_0x228259[_0xa311('0x1a')](_0x140e93)['send'](_0x15e2d7);};}exports[_0xa311('0x2a')]=function(_0x2606c1,_0x137bb8){var _0x91d69e={},_0x4909d3={},_0x469b27={'count':0x0,'rows':[]};var _0xd45d1a=_[_0xa311('0x2b')](db[_0xa311('0x2c')][_0xa311('0x2d')],function(_0x5f3a66){return{'name':_0x5f3a66[_0xa311('0x2e')],'type':_0x5f3a66['type']['key']};});_0x4909d3[_0xa311('0x2f')]=_[_0xa311('0x2b')](_0xd45d1a,_0xa311('0x29'));_0x4909d3[_0xa311('0x30')]=_[_0xa311('0x31')](_0x2606c1[_0xa311('0x30')]);_0x4909d3[_0xa311('0x32')]=_[_0xa311('0x33')](_0x4909d3[_0xa311('0x2f')],_0x4909d3[_0xa311('0x30')]);_0x91d69e['attributes']=_[_0xa311('0x33')](_0x4909d3[_0xa311('0x2f')],qs['fields'](_0x2606c1[_0xa311('0x30')][_0xa311('0x34')]));_0x91d69e[_0xa311('0x35')]=_0x91d69e[_0xa311('0x35')][_0xa311('0x36')]?_0x91d69e[_0xa311('0x35')]:_0x4909d3[_0xa311('0x2f')];if(!_0x2606c1[_0xa311('0x30')]['hasOwnProperty'](_0xa311('0x37'))){_0x91d69e[_0xa311('0x20')]=qs[_0xa311('0x20')](_0x2606c1[_0xa311('0x30')][_0xa311('0x20')]);_0x91d69e[_0xa311('0x1f')]=qs['offset'](_0x2606c1['query'][_0xa311('0x1f')]);}_0x91d69e[_0xa311('0x38')]=qs[_0xa311('0x39')](_0x2606c1['query']['sort']);_0x91d69e[_0xa311('0x3a')]=qs[_0xa311('0x32')](_[_0xa311('0x3b')](_0x2606c1['query'],_0x4909d3[_0xa311('0x32')]),_0xd45d1a);if(_0x2606c1[_0xa311('0x30')][_0xa311('0x3c')]){_0x91d69e[_0xa311('0x3a')]=_['merge'](_0x91d69e[_0xa311('0x3a')],{'$or':_[_0xa311('0x2b')](_0xd45d1a,function(_0x5e5612){if(_0x5e5612[_0xa311('0x3d')]!==_0xa311('0x3e')){var _0x283be7={};_0x283be7[_0x5e5612[_0xa311('0x29')]]={'$like':'%'+_0x2606c1[_0xa311('0x30')][_0xa311('0x3c')]+'%'};return _0x283be7;}})});}_0x91d69e=_[_0xa311('0x3f')]({},_0x91d69e,_0x2606c1[_0xa311('0x40')]);var _0x2edcce={'where':_0x91d69e[_0xa311('0x3a')]};return db[_0xa311('0x2c')]['count'](_0x2edcce)[_0xa311('0x27')](function(_0x252ead){_0x469b27[_0xa311('0x1e')]=_0x252ead;if(_0x2606c1[_0xa311('0x30')][_0xa311('0x41')]){_0x91d69e[_0xa311('0x42')]=[{'all':!![]}];}return db[_0xa311('0x2c')][_0xa311('0x43')](_0x91d69e);})['then'](function(_0x38ba83){_0x469b27[_0xa311('0x44')]=_0x38ba83;return _0x469b27;})[_0xa311('0x27')](respondWithFilteredResult(_0x137bb8,_0x91d69e))[_0xa311('0x45')](handleError(_0x137bb8,null));};exports[_0xa311('0x46')]=function(_0x5ec3e9,_0x4407fc){var _0x292c5b={'raw':![],'where':{'id':_0x5ec3e9[_0xa311('0x47')]['id']}},_0x88c170={};_0x88c170[_0xa311('0x2f')]=_[_0xa311('0x31')](db['IntegrationReport'][_0xa311('0x2d')]);_0x88c170['query']=_[_0xa311('0x31')](_0x5ec3e9[_0xa311('0x30')]);_0x88c170['filters']=_[_0xa311('0x33')](_0x88c170[_0xa311('0x2f')],_0x88c170[_0xa311('0x30')]);_0x292c5b[_0xa311('0x35')]=_[_0xa311('0x33')](_0x88c170[_0xa311('0x2f')],qs[_0xa311('0x34')](_0x5ec3e9[_0xa311('0x30')]['fields']));_0x292c5b[_0xa311('0x35')]=_0x292c5b[_0xa311('0x35')][_0xa311('0x36')]?_0x292c5b[_0xa311('0x35')]:_0x88c170['model'];if(_0x5ec3e9[_0xa311('0x30')]['includeAll']){_0x292c5b[_0xa311('0x42')]=[{'all':!![]}];}_0x292c5b=_[_0xa311('0x3f')]({},_0x292c5b,_0x5ec3e9[_0xa311('0x40')]);return db[_0xa311('0x2c')][_0xa311('0x48')](_0x292c5b)[_0xa311('0x27')](handleEntityNotFound(_0x4407fc,null))[_0xa311('0x27')](respondWithResult(_0x4407fc,null))[_0xa311('0x45')](handleError(_0x4407fc,null));};exports[_0xa311('0x49')]=function(_0x28ccc2,_0x430e32){return db[_0xa311('0x2c')][_0xa311('0x49')](_0x28ccc2['body'],{})[_0xa311('0x27')](respondWithResult(_0x430e32,0xc9))['catch'](handleError(_0x430e32,null));};exports[_0xa311('0x25')]=function(_0x3ad97d,_0x385bad){if(_0x3ad97d[_0xa311('0x4a')]['id']){delete _0x3ad97d[_0xa311('0x4a')]['id'];}return db[_0xa311('0x2c')][_0xa311('0x48')]({'where':{'id':_0x3ad97d['params']['id']}})['then'](handleEntityNotFound(_0x385bad,null))['then'](saveUpdates(_0x3ad97d[_0xa311('0x4a')],null))[_0xa311('0x27')](respondWithResult(_0x385bad,null))['catch'](handleError(_0x385bad,null));};exports[_0xa311('0x26')]=function(_0x395693,_0x3f39dc){return db['IntegrationReport']['find']({'where':{'id':_0x395693[_0xa311('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f39dc,null))['then'](removeEntity(_0x3f39dc,null))[_0xa311('0x45')](handleError(_0x3f39dc,null));};exports[_0xa311('0x4b')]=function(_0x5917b8,_0x4d1ff9){return db[_0xa311('0x2c')][_0xa311('0x4b')]()['then'](respondWithResult(_0x4d1ff9,null))['catch'](handleError(_0x4d1ff9,null));}; \ No newline at end of file +var _0xae3f=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','error','stack','name','index','fieldName','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','IntegrationReport','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','options','find'];(function(_0xeb1b84,_0x292621){var _0x131cd9=function(_0x2a6d64){while(--_0x2a6d64){_0xeb1b84['push'](_0xeb1b84['shift']());}};_0x131cd9(++_0x292621);}(_0xae3f,0x1b9));var _0xfae3=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xae3f[_0x1589dd];return _0x1bddd1;};'use strict';var emlformat=require(_0xfae3('0x0'));var rimraf=require(_0xfae3('0x1'));var zipdir=require(_0xfae3('0x2'));var jsonpatch=require(_0xfae3('0x3'));var rp=require(_0xfae3('0x4'));var moment=require(_0xfae3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfae3('0x6'));var util=require('util');var path=require(_0xfae3('0x7'));var sox=require(_0xfae3('0x8'));var csv=require(_0xfae3('0x9'));var ejs=require(_0xfae3('0xa'));var fs=require('fs');var fs_extra=require(_0xfae3('0xb'));var _=require(_0xfae3('0xc'));var squel=require(_0xfae3('0xd'));var crypto=require(_0xfae3('0xe'));var jsforce=require(_0xfae3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfae3('0x10'));var Papa=require('papaparse');var Redis=require(_0xfae3('0x11'));var authService=require(_0xfae3('0x12'));var qs=require(_0xfae3('0x13'));var as=require(_0xfae3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfae3('0x15'))(_0xfae3('0x16'));var utils=require('../../config/utils');var config=require(_0xfae3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfae3('0x18'))['db'];function respondWithStatusCode(_0x5008be,_0x46b027){_0x46b027=_0x46b027||0xcc;return function(_0x27a0b1){if(_0x27a0b1){return _0x5008be[_0xfae3('0x19')](_0x46b027);}return _0x5008be[_0xfae3('0x1a')](_0x46b027)['end']();};}function respondWithResult(_0x4641fe,_0x3a0730){_0x3a0730=_0x3a0730||0xc8;return function(_0x8aa6bf){if(_0x8aa6bf){return _0x4641fe[_0xfae3('0x1a')](_0x3a0730)[_0xfae3('0x1b')](_0x8aa6bf);}};}function respondWithFilteredResult(_0x4c8998,_0x52ee66){return function(_0x14ab72){if(_0x14ab72){var _0x2bee75=typeof _0x52ee66[_0xfae3('0x1c')]==='undefined'&&typeof _0x52ee66['limit']===_0xfae3('0x1d');var _0x399bb2=_0x14ab72[_0xfae3('0x1e')];var _0x2c065b=_0x2bee75?0x0:_0x52ee66[_0xfae3('0x1c')];var _0x432cf2=_0x2bee75?_0x14ab72[_0xfae3('0x1e')]:_0x52ee66[_0xfae3('0x1c')]+_0x52ee66[_0xfae3('0x1f')];var _0xa70cc6;if(_0x432cf2>=_0x399bb2){_0x432cf2=_0x399bb2;_0xa70cc6=0xc8;}else{_0xa70cc6=0xce;}_0x4c8998['status'](_0xa70cc6);return _0x4c8998['set'](_0xfae3('0x20'),_0x2c065b+'-'+_0x432cf2+'/'+_0x399bb2)[_0xfae3('0x1b')](_0x14ab72);}return null;};}function patchUpdates(_0x1c616f){return function(_0x1662ce){try{jsonpatch['apply'](_0x1662ce,_0x1c616f,!![]);}catch(_0x51f360){return BPromise[_0xfae3('0x21')](_0x51f360);}return _0x1662ce[_0xfae3('0x22')]();};}function saveUpdates(_0x3cc233,_0x403056){return function(_0xa7c9bd){if(_0xa7c9bd){return _0xa7c9bd[_0xfae3('0x23')](_0x3cc233)[_0xfae3('0x24')](function(_0x5a8c8d){return _0x5a8c8d;});}return null;};}function removeEntity(_0x27d393,_0x4cca80){return function(_0x4b422f){if(_0x4b422f){return _0x4b422f['destroy']()[_0xfae3('0x24')](function(){_0x27d393[_0xfae3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17f270,_0x5283a3){return function(_0x410783){if(!_0x410783){_0x17f270[_0xfae3('0x19')](0x194);}return _0x410783;};}function handleError(_0x4a3107,_0x30c304){_0x30c304=_0x30c304||0x1f4;return function(_0xed2108){logger[_0xfae3('0x25')](_0xed2108[_0xfae3('0x26')]);if(_0xed2108['name']){delete _0xed2108[_0xfae3('0x27')];}_0x4a3107[_0xfae3('0x1a')](_0x30c304)['send'](_0xed2108);};}exports[_0xfae3('0x28')]=function(_0x2b89e3,_0xe55702){var _0x1621c9={},_0x3828dc={},_0x26dd6f={'count':0x0,'rows':[]};var _0x16f627=_['map'](db['IntegrationReport']['rawAttributes'],function(_0x4ad615){return{'name':_0x4ad615[_0xfae3('0x29')],'type':_0x4ad615['type'][_0xfae3('0x2a')]};});_0x3828dc[_0xfae3('0x2b')]=_[_0xfae3('0x2c')](_0x16f627,'name');_0x3828dc[_0xfae3('0x2d')]=_[_0xfae3('0x2e')](_0x2b89e3['query']);_0x3828dc['filters']=_[_0xfae3('0x2f')](_0x3828dc[_0xfae3('0x2b')],_0x3828dc['query']);_0x1621c9['attributes']=_[_0xfae3('0x2f')](_0x3828dc[_0xfae3('0x2b')],qs[_0xfae3('0x30')](_0x2b89e3[_0xfae3('0x2d')][_0xfae3('0x30')]));_0x1621c9[_0xfae3('0x31')]=_0x1621c9['attributes']['length']?_0x1621c9[_0xfae3('0x31')]:_0x3828dc[_0xfae3('0x2b')];if(!_0x2b89e3[_0xfae3('0x2d')][_0xfae3('0x32')]('nolimit')){_0x1621c9[_0xfae3('0x1f')]=qs[_0xfae3('0x1f')](_0x2b89e3[_0xfae3('0x2d')]['limit']);_0x1621c9[_0xfae3('0x1c')]=qs['offset'](_0x2b89e3[_0xfae3('0x2d')][_0xfae3('0x1c')]);}_0x1621c9[_0xfae3('0x33')]=qs[_0xfae3('0x34')](_0x2b89e3[_0xfae3('0x2d')][_0xfae3('0x34')]);_0x1621c9[_0xfae3('0x35')]=qs[_0xfae3('0x36')](_['pick'](_0x2b89e3[_0xfae3('0x2d')],_0x3828dc[_0xfae3('0x36')]),_0x16f627);if(_0x2b89e3[_0xfae3('0x2d')][_0xfae3('0x37')]){_0x1621c9[_0xfae3('0x35')]=_['merge'](_0x1621c9[_0xfae3('0x35')],{'$or':_[_0xfae3('0x2c')](_0x16f627,function(_0x544a7f){if(_0x544a7f['type']!==_0xfae3('0x38')){var _0x29fcbb={};_0x29fcbb[_0x544a7f[_0xfae3('0x27')]]={'$like':'%'+_0x2b89e3['query'][_0xfae3('0x37')]+'%'};return _0x29fcbb;}})});}_0x1621c9=_[_0xfae3('0x39')]({},_0x1621c9,_0x2b89e3['options']);var _0x9759cf={'where':_0x1621c9[_0xfae3('0x35')]};return db[_0xfae3('0x3a')][_0xfae3('0x1e')](_0x9759cf)[_0xfae3('0x24')](function(_0x14abe2){_0x26dd6f[_0xfae3('0x1e')]=_0x14abe2;if(_0x2b89e3['query']['includeAll']){_0x1621c9[_0xfae3('0x3b')]=[{'all':!![]}];}return db[_0xfae3('0x3a')][_0xfae3('0x3c')](_0x1621c9);})[_0xfae3('0x24')](function(_0x1e050d){_0x26dd6f[_0xfae3('0x3d')]=_0x1e050d;return _0x26dd6f;})['then'](respondWithFilteredResult(_0xe55702,_0x1621c9))[_0xfae3('0x3e')](handleError(_0xe55702,null));};exports[_0xfae3('0x3f')]=function(_0x39dd8f,_0x59aa0f){var _0x54227c={'raw':![],'where':{'id':_0x39dd8f[_0xfae3('0x40')]['id']}},_0x217088={};_0x217088[_0xfae3('0x2b')]=_[_0xfae3('0x2e')](db['IntegrationReport'][_0xfae3('0x41')]);_0x217088['query']=_[_0xfae3('0x2e')](_0x39dd8f[_0xfae3('0x2d')]);_0x217088[_0xfae3('0x36')]=_[_0xfae3('0x2f')](_0x217088[_0xfae3('0x2b')],_0x217088[_0xfae3('0x2d')]);_0x54227c[_0xfae3('0x31')]=_[_0xfae3('0x2f')](_0x217088[_0xfae3('0x2b')],qs[_0xfae3('0x30')](_0x39dd8f[_0xfae3('0x2d')][_0xfae3('0x30')]));_0x54227c['attributes']=_0x54227c['attributes'][_0xfae3('0x42')]?_0x54227c[_0xfae3('0x31')]:_0x217088[_0xfae3('0x2b')];if(_0x39dd8f[_0xfae3('0x2d')][_0xfae3('0x43')]){_0x54227c['include']=[{'all':!![]}];}_0x54227c=_['merge']({},_0x54227c,_0x39dd8f[_0xfae3('0x44')]);return db[_0xfae3('0x3a')][_0xfae3('0x45')](_0x54227c)[_0xfae3('0x24')](handleEntityNotFound(_0x59aa0f,null))[_0xfae3('0x24')](respondWithResult(_0x59aa0f,null))[_0xfae3('0x3e')](handleError(_0x59aa0f,null));};exports[_0xfae3('0x46')]=function(_0xba26aa,_0x46289e){return db[_0xfae3('0x3a')]['create'](_0xba26aa['body'],{})['then'](respondWithResult(_0x46289e,0xc9))[_0xfae3('0x3e')](handleError(_0x46289e,null));};exports[_0xfae3('0x23')]=function(_0x490e8f,_0x582fb5){if(_0x490e8f['body']['id']){delete _0x490e8f[_0xfae3('0x47')]['id'];}return db[_0xfae3('0x3a')][_0xfae3('0x45')]({'where':{'id':_0x490e8f[_0xfae3('0x40')]['id']}})[_0xfae3('0x24')](handleEntityNotFound(_0x582fb5,null))[_0xfae3('0x24')](saveUpdates(_0x490e8f[_0xfae3('0x47')],null))[_0xfae3('0x24')](respondWithResult(_0x582fb5,null))[_0xfae3('0x3e')](handleError(_0x582fb5,null));};exports['destroy']=function(_0x348945,_0x23194a){return db[_0xfae3('0x3a')][_0xfae3('0x45')]({'where':{'id':_0x348945[_0xfae3('0x40')]['id']}})[_0xfae3('0x24')](handleEntityNotFound(_0x23194a,null))[_0xfae3('0x24')](removeEntity(_0x23194a,null))[_0xfae3('0x3e')](handleError(_0x23194a,null));};exports['describe']=function(_0x483b8f,_0x406f85){return db[_0xfae3('0x3a')][_0xfae3('0x48')]()[_0xfae3('0x24')](respondWithResult(_0x406f85,null))[_0xfae3('0x3e')](handleError(_0x406f85,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index d959aac..bcc2df5 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 _0xa8a2=['./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x31bb5f,_0x52a513){var _0x4ecf68=function(_0x58df0f){while(--_0x58df0f){_0x31bb5f['push'](_0x31bb5f['shift']());}};_0x4ecf68(++_0x52a513);}(_0xa8a2,0x163));var _0x2a8a=function(_0x12bfbd,_0x22e758){_0x12bfbd=_0x12bfbd-0x0;var _0x454299=_0xa8a2[_0x12bfbd];return _0x454299;};'use strict';var _=require(_0x2a8a('0x0'));var util=require('util');var logger=require(_0x2a8a('0x1'))(_0x2a8a('0x2'));var moment=require(_0x2a8a('0x3'));var BPromise=require(_0x2a8a('0x4'));var rp=require(_0x2a8a('0x5'));var fs=require('fs');var path=require(_0x2a8a('0x6'));var rimraf=require(_0x2a8a('0x7'));var config=require(_0x2a8a('0x8'));var attributes=require(_0x2a8a('0x9'));module[_0x2a8a('0xa')]=function(_0x87a5bf,_0x3212d8){return _0x87a5bf['define'](_0x2a8a('0xb'),attributes,{'tableName':_0x2a8a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed75=['IntegrationReport','report_integration','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./integrationReport.attributes','exports'];(function(_0x307c57,_0x2ff9e5){var _0x232faa=function(_0xef7f){while(--_0xef7f){_0x307c57['push'](_0x307c57['shift']());}};_0x232faa(++_0x2ff9e5);}(_0xed75,0x10a));var _0x5ed7=function(_0x38b909,_0x2c14f1){_0x38b909=_0x38b909-0x0;var _0x856a8f=_0xed75[_0x38b909];return _0x856a8f;};'use strict';var _=require(_0x5ed7('0x0'));var util=require(_0x5ed7('0x1'));var logger=require(_0x5ed7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5ed7('0x3'));var rp=require(_0x5ed7('0x4'));var fs=require('fs');var path=require(_0x5ed7('0x5'));var rimraf=require(_0x5ed7('0x6'));var config=require('../../config/environment');var attributes=require(_0x5ed7('0x7'));module[_0x5ed7('0x8')]=function(_0x150ee9,_0x4606f0){return _0x150ee9['define'](_0x5ed7('0x9'),attributes,{'tableName':_0x5ed7('0xa'),'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 73b8a43..001e009 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x2da45d,_0x35397b){var _0x1012a0=function(_0x2babc3){while(--_0x2babc3){_0x2da45d['push'](_0x2da45d['shift']());}};_0x1012a0(++_0x35397b);}(_0x524e,0x15e));var _0xe524=function(_0x5140e8,_0x4da400){_0x5140e8=_0x5140e8-0x0;var _0x352d7f=_0x524e[_0x5140e8];return _0x352d7f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x584035,_0x47cb19){var _0x4ea938=function(_0x3f082c){while(--_0x3f082c){_0x584035['push'](_0x584035['shift']());}};_0x4ea938(++_0x47cb19);}(_0xdb28,0x106));var _0x8db2=function(_0x407c36,_0x3a0533){_0x407c36=_0x407c36-0x0;var _0x26b4bf=_0xdb28[_0x407c36];return _0x26b4bf;};'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')]('IntegrationReport,\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/interval/index.js b/server/api/interval/index.js index 5187629..94ab277 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 _0x6a3b=['update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0x6a3b,0x16b));var _0xb6a3=function(_0x20affb,_0x7b989c){_0x20affb=_0x20affb-0x0;var _0x2db945=_0x6a3b[_0x20affb];return _0x2db945;};'use strict';var multer=require(_0xb6a3('0x0'));var util=require(_0xb6a3('0x1'));var path=require('path');var timeout=require(_0xb6a3('0x2'));var express=require('express');var router=express[_0xb6a3('0x3')]();var fs_extra=require(_0xb6a3('0x4'));var auth=require(_0xb6a3('0x5'));var interaction=require(_0xb6a3('0x6'));var config=require(_0xb6a3('0x7'));var controller=require(_0xb6a3('0x8'));router[_0xb6a3('0x9')]('/',auth['isAuthenticated'](),controller[_0xb6a3('0xa')]);router[_0xb6a3('0x9')](_0xb6a3('0xb'),auth[_0xb6a3('0xc')](),controller[_0xb6a3('0xd')]);router[_0xb6a3('0x9')](_0xb6a3('0xe'),auth[_0xb6a3('0xc')](),controller[_0xb6a3('0xf')]);router[_0xb6a3('0x10')]('/',auth[_0xb6a3('0xc')](),controller[_0xb6a3('0x11')]);router[_0xb6a3('0x10')](_0xb6a3('0xe'),auth[_0xb6a3('0xc')](),controller[_0xb6a3('0x12')]);router[_0xb6a3('0x10')](_0xb6a3('0x13'),auth[_0xb6a3('0xc')](),controller[_0xb6a3('0x14')]);router['put'](_0xb6a3('0xb'),auth[_0xb6a3('0xc')](),controller[_0xb6a3('0x15')]);router[_0xb6a3('0x16')](_0xb6a3('0xb'),auth[_0xb6a3('0xc')](),controller[_0xb6a3('0x17')]);module['exports']=router; \ No newline at end of file +var _0x2c24=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','post','create','/:id/sub_intervals/create_many','delete'];(function(_0x4e0a03,_0x5eb6b0){var _0x2478fc=function(_0x59afcc){while(--_0x59afcc){_0x4e0a03['push'](_0x4e0a03['shift']());}};_0x2478fc(++_0x5eb6b0);}(_0x2c24,0x1e6));var _0x42c2=function(_0x4964a4,_0x330311){_0x4964a4=_0x4964a4-0x0;var _0x529903=_0x2c24[_0x4964a4];return _0x529903;};'use strict';var multer=require(_0x42c2('0x0'));var util=require(_0x42c2('0x1'));var path=require(_0x42c2('0x2'));var timeout=require(_0x42c2('0x3'));var express=require(_0x42c2('0x4'));var router=express[_0x42c2('0x5')]();var fs_extra=require(_0x42c2('0x6'));var auth=require(_0x42c2('0x7'));var interaction=require(_0x42c2('0x8'));var config=require('../../config/environment');var controller=require(_0x42c2('0x9'));router[_0x42c2('0xa')]('/',auth['isAuthenticated'](),controller[_0x42c2('0xb')]);router[_0x42c2('0xa')](_0x42c2('0xc'),auth[_0x42c2('0xd')](),controller[_0x42c2('0xe')]);router[_0x42c2('0xa')](_0x42c2('0xf'),auth['isAuthenticated'](),controller['getIntervals']);router[_0x42c2('0x10')]('/',auth[_0x42c2('0xd')](),controller[_0x42c2('0x11')]);router['post'](_0x42c2('0xf'),auth[_0x42c2('0xd')](),controller['addInterval']);router['post'](_0x42c2('0x12'),auth[_0x42c2('0xd')](),controller['addIntervals']);router['put'](_0x42c2('0xc'),auth[_0x42c2('0xd')](),controller['update']);router[_0x42c2('0x13')](_0x42c2('0xc'),auth[_0x42c2('0xd')](),controller[_0x42c2('0x14')]);module[_0x42c2('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 24c4e2c..94e0537 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 _0x3d38=['STRING','sequelize'];(function(_0x37572f,_0x48b00e){var _0x1bcbce=function(_0x5d8e95){while(--_0x5d8e95){_0x37572f['push'](_0x37572f['shift']());}};_0x1bcbce(++_0x48b00e);}(_0x3d38,0x1c3));var _0x83d3=function(_0x1e48d3,_0x5d8c43){_0x1e48d3=_0x1e48d3-0x0;var _0x2852b1=_0x3d38[_0x1e48d3];return _0x2852b1;};'use strict';var Sequelize=require(_0x83d3('0x0'));module['exports']={'name':{'type':Sequelize[_0x83d3('0x1')]},'description':{'type':Sequelize[_0x83d3('0x1')]},'interval':{'type':Sequelize[_0x83d3('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xb90b=['exports','STRING','sequelize'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xb90b,0xf8));var _0xbb90=function(_0x2994d3,_0x37a212){_0x2994d3=_0x2994d3-0x0;var _0x580604=_0xb90b[_0x2994d3];return _0x580604;};'use strict';var Sequelize=require(_0xbb90('0x0'));module[_0xbb90('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbb90('0x2')]},'interval':{'type':Sequelize[_0xbb90('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 4230f32..ee67810 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 _0x4f4f=['addIntervals','transaction','IntervalId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','querystring','ioredis','../../config/license/hardware','api','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','reject','then','get','Intervals','UserProfileResource','destroy','end','error','stack','name','send','map','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Interval','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','find','addInterval','getIntervals'];(function(_0x2f60fd,_0x251931){var _0x36fcce=function(_0x4a5a5b){while(--_0x4a5a5b){_0x2f60fd['push'](_0x2f60fd['shift']());}};_0x36fcce(++_0x251931);}(_0x4f4f,0x19d));var _0xf4f4=function(_0x4dea87,_0x151a3d){_0x4dea87=_0x4dea87-0x0;var _0x3a59f6=_0x4f4f[_0x4dea87];return _0x3a59f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf4f4('0x0'));var zipdir=require(_0xf4f4('0x1'));var jsonpatch=require(_0xf4f4('0x2'));var rp=require(_0xf4f4('0x3'));var moment=require(_0xf4f4('0x4'));var BPromise=require(_0xf4f4('0x5'));var Mustache=require(_0xf4f4('0x6'));var util=require(_0xf4f4('0x7'));var path=require(_0xf4f4('0x8'));var sox=require('sox');var csv=require(_0xf4f4('0x9'));var ejs=require(_0xf4f4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf4f4('0xb'));var crypto=require('crypto');var jsforce=require(_0xf4f4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf4f4('0xd'));var Papa=require('papaparse');var Redis=require(_0xf4f4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4f4('0xf'));var logger=require('../../config/logger')(_0xf4f4('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf4f4('0x11'));var db=require(_0xf4f4('0x12'))['db'];var extensions=require(_0xf4f4('0x13'));function respondWithStatusCode(_0x18e92f,_0x49daeb){_0x49daeb=_0x49daeb||0xcc;return function(_0x49b2f4){if(_0x49b2f4){return _0x18e92f[_0xf4f4('0x14')](_0x49daeb);}return _0x18e92f['status'](_0x49daeb)['end']();};}function respondWithResult(_0xd8dcd7,_0xc9875a){_0xc9875a=_0xc9875a||0xc8;return function(_0x7b5dff){if(_0x7b5dff){return _0xd8dcd7[_0xf4f4('0x15')](_0xc9875a)['json'](_0x7b5dff);}};}function respondWithFilteredResult(_0x103e3c,_0x545937){return function(_0x2c9bba){if(_0x2c9bba){var _0x350d9d=typeof _0x545937[_0xf4f4('0x16')]===_0xf4f4('0x17')&&typeof _0x545937['limit']===_0xf4f4('0x17');var _0x56c20d=_0x2c9bba[_0xf4f4('0x18')];var _0x22e8ff=_0x350d9d?0x0:_0x545937[_0xf4f4('0x16')];var _0x980e1b=_0x350d9d?_0x2c9bba[_0xf4f4('0x18')]:_0x545937['offset']+_0x545937[_0xf4f4('0x19')];var _0x2c6317;if(_0x980e1b>=_0x56c20d){_0x980e1b=_0x56c20d;_0x2c6317=0xc8;}else{_0x2c6317=0xce;}_0x103e3c['status'](_0x2c6317);return _0x103e3c['set'](_0xf4f4('0x1a'),_0x22e8ff+'-'+_0x980e1b+'/'+_0x56c20d)[_0xf4f4('0x1b')](_0x2c9bba);}return null;};}function patchUpdates(_0x3c5d86){return function(_0xbe345a){try{jsonpatch[_0xf4f4('0x1c')](_0xbe345a,_0x3c5d86,!![]);}catch(_0x557ec0){return BPromise[_0xf4f4('0x1d')](_0x557ec0);}return _0xbe345a['save']();};}function saveUpdates(_0x443027,_0x483e95){return function(_0x191a4e){if(_0x191a4e){return _0x191a4e['update'](_0x443027)[_0xf4f4('0x1e')](function(_0x1394ff){return _0x1394ff;});}return null;};}function removeEntity(_0x11b129,_0x444189){return function(_0x2d2552){if(_0x2d2552){return _0x2d2552['destroy']()[_0xf4f4('0x1e')](function(){var _0x3ba186=_0x2d2552[_0xf4f4('0x1f')]({'plain':!![]});var _0x112f7f=_0xf4f4('0x20');return db[_0xf4f4('0x21')][_0xf4f4('0x22')]({'where':{'type':_0x112f7f,'resourceId':_0x3ba186['id']}})[_0xf4f4('0x1e')](function(){return _0x2d2552;});})['then'](function(){_0x11b129[_0xf4f4('0x15')](0xcc)[_0xf4f4('0x23')]();});}};}function handleEntityNotFound(_0x1da96b,_0x667217){return function(_0x562411){if(!_0x562411){_0x1da96b[_0xf4f4('0x14')](0x194);}return _0x562411;};}function handleError(_0x32e0fa,_0x1d0ae4){_0x1d0ae4=_0x1d0ae4||0x1f4;return function(_0x44ccd7){logger[_0xf4f4('0x24')](_0x44ccd7[_0xf4f4('0x25')]);if(_0x44ccd7[_0xf4f4('0x26')]){delete _0x44ccd7[_0xf4f4('0x26')];}_0x32e0fa[_0xf4f4('0x15')](_0x1d0ae4)[_0xf4f4('0x27')](_0x44ccd7);};}exports['index']=function(_0x14c9cc,_0x2ee27a){var _0x436857={},_0x11e895={},_0x3d3c78={'count':0x0,'rows':[]};var _0x49435c=_[_0xf4f4('0x28')](db['Interval']['rawAttributes'],function(_0x4340d6){return{'name':_0x4340d6[_0xf4f4('0x29')],'type':_0x4340d6['type'][_0xf4f4('0x2a')]};});_0x11e895['model']=_['map'](_0x49435c,_0xf4f4('0x26'));_0x11e895[_0xf4f4('0x2b')]=_[_0xf4f4('0x2c')](_0x14c9cc[_0xf4f4('0x2b')]);_0x11e895[_0xf4f4('0x2d')]=_[_0xf4f4('0x2e')](_0x11e895[_0xf4f4('0x2f')],_0x11e895['query']);_0x436857[_0xf4f4('0x30')]=_[_0xf4f4('0x2e')](_0x11e895[_0xf4f4('0x2f')],qs[_0xf4f4('0x31')](_0x14c9cc[_0xf4f4('0x2b')]['fields']));_0x436857[_0xf4f4('0x30')]=_0x436857[_0xf4f4('0x30')][_0xf4f4('0x32')]?_0x436857[_0xf4f4('0x30')]:_0x11e895[_0xf4f4('0x2f')];if(!_0x14c9cc[_0xf4f4('0x2b')][_0xf4f4('0x33')](_0xf4f4('0x34'))){_0x436857['limit']=qs[_0xf4f4('0x19')](_0x14c9cc[_0xf4f4('0x2b')]['limit']);_0x436857[_0xf4f4('0x16')]=qs[_0xf4f4('0x16')](_0x14c9cc[_0xf4f4('0x2b')][_0xf4f4('0x16')]);}_0x436857[_0xf4f4('0x35')]=qs['sort'](_0x14c9cc[_0xf4f4('0x2b')][_0xf4f4('0x36')]);_0x436857[_0xf4f4('0x37')]=qs['filters'](_[_0xf4f4('0x38')](_0x14c9cc[_0xf4f4('0x2b')],_0x11e895['filters']),_0x49435c);if(_0x14c9cc[_0xf4f4('0x2b')][_0xf4f4('0x39')]){_0x436857['where']=_[_0xf4f4('0x3a')](_0x436857[_0xf4f4('0x37')],{'$or':_[_0xf4f4('0x28')](_0x49435c,function(_0x616ef2){if(_0x616ef2[_0xf4f4('0x3b')]!==_0xf4f4('0x3c')){var _0x275563={};_0x275563[_0x616ef2[_0xf4f4('0x26')]]={'$like':'%'+_0x14c9cc[_0xf4f4('0x2b')][_0xf4f4('0x39')]+'%'};return _0x275563;}})});}_0x436857=_[_0xf4f4('0x3a')]({},_0x436857,_0x14c9cc[_0xf4f4('0x3d')]);var _0x1b04ff={'where':_0x436857['where']};return db['Interval'][_0xf4f4('0x18')](_0x1b04ff)[_0xf4f4('0x1e')](function(_0x228c4d){_0x3d3c78['count']=_0x228c4d;if(_0x14c9cc[_0xf4f4('0x2b')][_0xf4f4('0x3e')]){_0x436857[_0xf4f4('0x3f')]=[{'all':!![]}];}return db[_0xf4f4('0x40')][_0xf4f4('0x41')](_0x436857);})[_0xf4f4('0x1e')](function(_0x30f353){_0x3d3c78['rows']=_0x30f353;return _0x3d3c78;})[_0xf4f4('0x1e')](respondWithFilteredResult(_0x2ee27a,_0x436857))[_0xf4f4('0x42')](handleError(_0x2ee27a,null));};exports[_0xf4f4('0x43')]=function(_0x473330,_0x427ee2){var _0x4ed21a={'raw':!![],'where':{'id':_0x473330[_0xf4f4('0x44')]['id']}},_0x2f89a0={};_0x2f89a0[_0xf4f4('0x2f')]=_['keys'](db[_0xf4f4('0x40')]['rawAttributes']);_0x2f89a0['query']=_[_0xf4f4('0x2c')](_0x473330[_0xf4f4('0x2b')]);_0x2f89a0[_0xf4f4('0x2d')]=_['intersection'](_0x2f89a0[_0xf4f4('0x2f')],_0x2f89a0['query']);_0x4ed21a[_0xf4f4('0x30')]=_[_0xf4f4('0x2e')](_0x2f89a0['model'],qs[_0xf4f4('0x31')](_0x473330[_0xf4f4('0x2b')][_0xf4f4('0x31')]));_0x4ed21a['attributes']=_0x4ed21a[_0xf4f4('0x30')][_0xf4f4('0x32')]?_0x4ed21a[_0xf4f4('0x30')]:_0x2f89a0[_0xf4f4('0x2f')];if(_0x473330[_0xf4f4('0x2b')][_0xf4f4('0x3e')]){_0x4ed21a[_0xf4f4('0x3f')]=[{'all':!![]}];}_0x4ed21a=_[_0xf4f4('0x3a')]({},_0x4ed21a,_0x473330[_0xf4f4('0x3d')]);return db['Interval']['find'](_0x4ed21a)['then'](handleEntityNotFound(_0x427ee2,null))[_0xf4f4('0x1e')](respondWithResult(_0x427ee2,null))[_0xf4f4('0x42')](handleError(_0x427ee2,null));};exports[_0xf4f4('0x45')]=function(_0x4c4092,_0x11239d){return db[_0xf4f4('0x40')][_0xf4f4('0x45')](_0x4c4092[_0xf4f4('0x46')],{})[_0xf4f4('0x1e')](function(_0x46d010){var _0x40b38b=_0x4c4092[_0xf4f4('0x47')][_0xf4f4('0x1f')]({'plain':!![]});if(!_0x40b38b)throw new Error(_0xf4f4('0x48'));if(_0x40b38b[_0xf4f4('0x49')]===_0xf4f4('0x47')){var _0x1ff54c=_0x46d010[_0xf4f4('0x1f')]({'plain':!![]});var _0x5874b0=_0xf4f4('0x20');return db['UserProfileSection']['find']({'where':{'name':_0x5874b0,'userProfileId':_0x40b38b[_0xf4f4('0x4a')]},'raw':!![]})[_0xf4f4('0x1e')](function(_0x1690d7){if(_0x1690d7&&_0x1690d7[_0xf4f4('0x4b')]===0x0){return db[_0xf4f4('0x21')]['create']({'name':_0x1ff54c['name'],'resourceId':_0x1ff54c['id'],'type':_0x1690d7[_0xf4f4('0x26')],'sectionId':_0x1690d7['id']},{})[_0xf4f4('0x1e')](function(){return _0x46d010;});}else{return _0x46d010;}})[_0xf4f4('0x42')](function(_0x2ecd0f){logger[_0xf4f4('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ecd0f);throw _0x2ecd0f;});}return _0x46d010;})[_0xf4f4('0x1e')](respondWithResult(_0x11239d,0xc9))[_0xf4f4('0x42')](handleError(_0x11239d,null));};exports['update']=function(_0x532fc4,_0x56fe6f){if(_0x532fc4[_0xf4f4('0x46')]['id']){delete _0x532fc4[_0xf4f4('0x46')]['id'];}return db[_0xf4f4('0x40')][_0xf4f4('0x4c')]({'where':{'id':_0x532fc4[_0xf4f4('0x44')]['id']}})[_0xf4f4('0x1e')](handleEntityNotFound(_0x56fe6f,null))[_0xf4f4('0x1e')](saveUpdates(_0x532fc4['body'],null))['then'](respondWithResult(_0x56fe6f,null))[_0xf4f4('0x42')](handleError(_0x56fe6f,null));};exports[_0xf4f4('0x22')]=function(_0x6e7d7e,_0x4bcb36){return db[_0xf4f4('0x40')][_0xf4f4('0x4c')]({'where':{'id':_0x6e7d7e[_0xf4f4('0x44')]['id']}})[_0xf4f4('0x1e')](handleEntityNotFound(_0x4bcb36,null))[_0xf4f4('0x1e')](removeEntity(_0x4bcb36,null))['catch'](handleError(_0x4bcb36,null));};exports[_0xf4f4('0x4d')]=function(_0x4a22a3,_0x283405,_0x357273){if(_0x4a22a3[_0xf4f4('0x46')]['id']){delete _0x4a22a3['body']['id'];}return db['Interval'][_0xf4f4('0x4c')]({'where':{'id':_0x4a22a3[_0xf4f4('0x44')]['id']}})[_0xf4f4('0x1e')](handleEntityNotFound(_0x283405,null))[_0xf4f4('0x1e')](function(_0x19d501){if(_0x19d501){_0x4a22a3[_0xf4f4('0x46')]['IntervalId']=_0x19d501['id'];return db[_0xf4f4('0x40')][_0xf4f4('0x45')](_0x4a22a3['body']);}})[_0xf4f4('0x1e')](respondWithResult(_0x283405,null))[_0xf4f4('0x42')](handleError(_0x283405,null));};exports[_0xf4f4('0x4e')]=function(_0x5e05a4,_0xf01078,_0xe63a84){var _0x292ebd={};var _0x56f74e={};var _0x38575a;var _0x4d0505;return db[_0xf4f4('0x40')]['findOne']({'where':{'id':_0x5e05a4['params']['id']}})[_0xf4f4('0x1e')](handleEntityNotFound(_0xf01078,null))['then'](function(_0x52122a){if(_0x52122a){_0x38575a=_0x52122a;_0x56f74e['model']=_['keys'](db[_0xf4f4('0x40')]['rawAttributes']);_0x56f74e['query']=_[_0xf4f4('0x2c')](_0x5e05a4[_0xf4f4('0x2b')]);_0x56f74e[_0xf4f4('0x2d')]=_['intersection'](_0x56f74e[_0xf4f4('0x2f')],_0x56f74e[_0xf4f4('0x2b')]);_0x292ebd[_0xf4f4('0x30')]=_[_0xf4f4('0x2e')](_0x56f74e[_0xf4f4('0x2f')],qs[_0xf4f4('0x31')](_0x5e05a4['query']['fields']));_0x292ebd[_0xf4f4('0x30')]=_0x292ebd[_0xf4f4('0x30')][_0xf4f4('0x32')]?_0x292ebd['attributes']:_0x56f74e[_0xf4f4('0x2f')];_0x292ebd['order']=qs[_0xf4f4('0x36')](_0x5e05a4[_0xf4f4('0x2b')]['sort']);_0x292ebd['where']=qs['filters'](_[_0xf4f4('0x38')](_0x5e05a4[_0xf4f4('0x2b')],_0x56f74e['filters']));if(_0x5e05a4['query'][_0xf4f4('0x39')]){_0x292ebd[_0xf4f4('0x37')]=_[_0xf4f4('0x3a')](_0x292ebd[_0xf4f4('0x37')],{'$or':_['map'](_0x292ebd['attributes'],function(_0x3f97d7){var _0x36f613={};_0x36f613[_0x3f97d7]={'$like':'%'+_0x5e05a4[_0xf4f4('0x2b')][_0xf4f4('0x39')]+'%'};return _0x36f613;})});}_0x292ebd=_['merge']({},_0x292ebd,_0x5e05a4['options']);return _0x38575a['getIntervals'](_0x292ebd);}})['then'](function(_0x327137){if(_0x327137){_0x4d0505=_0x327137['length'];if(!_0x5e05a4[_0xf4f4('0x2b')][_0xf4f4('0x33')]('nolimit')){_0x292ebd['limit']=qs[_0xf4f4('0x19')](_0x5e05a4[_0xf4f4('0x2b')][_0xf4f4('0x19')]);_0x292ebd['offset']=qs['offset'](_0x5e05a4[_0xf4f4('0x2b')][_0xf4f4('0x16')]);}return _0x38575a[_0xf4f4('0x4e')](_0x292ebd);}})['then'](function(_0x54a995){if(_0x54a995){return _0x54a995?{'count':_0x4d0505,'rows':_0x54a995}:null;}})[_0xf4f4('0x1e')](respondWithResult(_0xf01078,null))['catch'](handleError(_0xf01078,null));};exports[_0xf4f4('0x4f')]=function(_0xe52315,_0x4db1a9,_0x5f3b0b){return db['Interval']['findOne']({'where':{'id':_0xe52315[_0xf4f4('0x44')]['id']}})[_0xf4f4('0x1e')](handleEntityNotFound(_0x4db1a9,null))['then'](function(_0x327f3f){if(_0x327f3f){return db['sequelize'][_0xf4f4('0x50')](function(_0x3c18f6){return db[_0xf4f4('0x40')][_0xf4f4('0x22')]({'where':{'IntervalId':_0xe52315[_0xf4f4('0x44')]['id']},'transaction':_0x3c18f6})[_0xf4f4('0x1e')](function(_0x4d3f63){var _0x17c3d0=_[_0xf4f4('0x28')](_0xe52315[_0xf4f4('0x46')],function(_0x18cc23){delete _0x18cc23['id'];_0x18cc23[_0xf4f4('0x51')]=_0xe52315['params']['id'];return _0x18cc23;});return db[_0xf4f4('0x40')]['bulkCreate'](_0x17c3d0,{'transaction':_0x3c18f6});});})['then'](function(){return db[_0xf4f4('0x40')][_0xf4f4('0x41')]({'where':{'IntervalId':_0xe52315[_0xf4f4('0x44')]['id']}});});}})['then'](respondWithResult(_0x4db1a9,null))['catch'](handleError(_0x4db1a9,null));}; \ No newline at end of file +var _0xddf0=['pick','filters','filter','where','VIRTUAL','merge','options','include','findAll','rows','show','intersection','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','catch','IntervalId','findOne','getIntervals','nolimit','addIntervals','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Intervals','end','sendStatus','error','stack','send','index','map','Interval','rawAttributes','fieldName','type','key','name','query','keys','model','attributes','fields','hasOwnProperty','order','sort'];(function(_0x478d06,_0x49ca1a){var _0x588936=function(_0x51a3a8){while(--_0x51a3a8){_0x478d06['push'](_0x478d06['shift']());}};_0x588936(++_0x49ca1a);}(_0xddf0,0x81));var _0x0ddf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xddf0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0ddf('0x0'));var rimraf=require(_0x0ddf('0x1'));var zipdir=require(_0x0ddf('0x2'));var jsonpatch=require(_0x0ddf('0x3'));var rp=require(_0x0ddf('0x4'));var moment=require(_0x0ddf('0x5'));var BPromise=require(_0x0ddf('0x6'));var Mustache=require(_0x0ddf('0x7'));var util=require(_0x0ddf('0x8'));var path=require(_0x0ddf('0x9'));var sox=require(_0x0ddf('0xa'));var csv=require(_0x0ddf('0xb'));var ejs=require(_0x0ddf('0xc'));var fs=require('fs');var fs_extra=require(_0x0ddf('0xd'));var _=require('lodash');var squel=require(_0x0ddf('0xe'));var crypto=require(_0x0ddf('0xf'));var jsforce=require(_0x0ddf('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x0ddf('0xb'));var querystring=require(_0x0ddf('0x11'));var Papa=require(_0x0ddf('0x12'));var Redis=require(_0x0ddf('0x13'));var authService=require(_0x0ddf('0x14'));var qs=require(_0x0ddf('0x15'));var as=require(_0x0ddf('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0ddf('0x17'));var utils=require(_0x0ddf('0x18'));var config=require(_0x0ddf('0x19'));var licenseUtil=require(_0x0ddf('0x1a'));var db=require(_0x0ddf('0x1b'))['db'];var extensions=require(_0x0ddf('0x1c'));function respondWithStatusCode(_0x3590f9,_0x4368bc){_0x4368bc=_0x4368bc||0xcc;return function(_0x5aa523){if(_0x5aa523){return _0x3590f9['sendStatus'](_0x4368bc);}return _0x3590f9[_0x0ddf('0x1d')](_0x4368bc)['end']();};}function respondWithResult(_0x342f74,_0x54506a){_0x54506a=_0x54506a||0xc8;return function(_0x34dd16){if(_0x34dd16){return _0x342f74[_0x0ddf('0x1d')](_0x54506a)[_0x0ddf('0x1e')](_0x34dd16);}};}function respondWithFilteredResult(_0x312dc9,_0x466905){return function(_0x3f29f1){if(_0x3f29f1){var _0x56d404=typeof _0x466905[_0x0ddf('0x1f')]===_0x0ddf('0x20')&&typeof _0x466905[_0x0ddf('0x21')]===_0x0ddf('0x20');var _0x50a5cb=_0x3f29f1[_0x0ddf('0x22')];var _0x45726c=_0x56d404?0x0:_0x466905[_0x0ddf('0x1f')];var _0x5a5614=_0x56d404?_0x3f29f1[_0x0ddf('0x22')]:_0x466905[_0x0ddf('0x1f')]+_0x466905[_0x0ddf('0x21')];var _0x3b35a5;if(_0x5a5614>=_0x50a5cb){_0x5a5614=_0x50a5cb;_0x3b35a5=0xc8;}else{_0x3b35a5=0xce;}_0x312dc9[_0x0ddf('0x1d')](_0x3b35a5);return _0x312dc9[_0x0ddf('0x23')](_0x0ddf('0x24'),_0x45726c+'-'+_0x5a5614+'/'+_0x50a5cb)[_0x0ddf('0x1e')](_0x3f29f1);}return null;};}function patchUpdates(_0xaf1e68){return function(_0x108b09){try{jsonpatch[_0x0ddf('0x25')](_0x108b09,_0xaf1e68,!![]);}catch(_0x301950){return BPromise[_0x0ddf('0x26')](_0x301950);}return _0x108b09[_0x0ddf('0x27')]();};}function saveUpdates(_0x500fbf,_0x4921e9){return function(_0x584c8a){if(_0x584c8a){return _0x584c8a[_0x0ddf('0x28')](_0x500fbf)[_0x0ddf('0x29')](function(_0x44906f){return _0x44906f;});}return null;};}function removeEntity(_0x1d7478,_0x4c727f){return function(_0x442a5b){if(_0x442a5b){return _0x442a5b[_0x0ddf('0x2a')]()[_0x0ddf('0x29')](function(){var _0x283533=_0x442a5b['get']({'plain':!![]});var _0x226467=_0x0ddf('0x2b');return db['UserProfileResource'][_0x0ddf('0x2a')]({'where':{'type':_0x226467,'resourceId':_0x283533['id']}})[_0x0ddf('0x29')](function(){return _0x442a5b;});})['then'](function(){_0x1d7478['status'](0xcc)[_0x0ddf('0x2c')]();});}};}function handleEntityNotFound(_0x39d020,_0x52c3d5){return function(_0x3583b7){if(!_0x3583b7){_0x39d020[_0x0ddf('0x2d')](0x194);}return _0x3583b7;};}function handleError(_0x2636ba,_0xff9ff2){_0xff9ff2=_0xff9ff2||0x1f4;return function(_0x9e6fcc){logger[_0x0ddf('0x2e')](_0x9e6fcc[_0x0ddf('0x2f')]);if(_0x9e6fcc['name']){delete _0x9e6fcc['name'];}_0x2636ba[_0x0ddf('0x1d')](_0xff9ff2)[_0x0ddf('0x30')](_0x9e6fcc);};}exports[_0x0ddf('0x31')]=function(_0x94aa42,_0x13896b){var _0x4a9547={},_0x1b3394={},_0x5671bd={'count':0x0,'rows':[]};var _0x5d044b=_[_0x0ddf('0x32')](db[_0x0ddf('0x33')][_0x0ddf('0x34')],function(_0x4d0e95){return{'name':_0x4d0e95[_0x0ddf('0x35')],'type':_0x4d0e95[_0x0ddf('0x36')][_0x0ddf('0x37')]};});_0x1b3394['model']=_['map'](_0x5d044b,_0x0ddf('0x38'));_0x1b3394[_0x0ddf('0x39')]=_[_0x0ddf('0x3a')](_0x94aa42[_0x0ddf('0x39')]);_0x1b3394['filters']=_['intersection'](_0x1b3394[_0x0ddf('0x3b')],_0x1b3394[_0x0ddf('0x39')]);_0x4a9547[_0x0ddf('0x3c')]=_['intersection'](_0x1b3394['model'],qs['fields'](_0x94aa42[_0x0ddf('0x39')][_0x0ddf('0x3d')]));_0x4a9547[_0x0ddf('0x3c')]=_0x4a9547[_0x0ddf('0x3c')]['length']?_0x4a9547['attributes']:_0x1b3394[_0x0ddf('0x3b')];if(!_0x94aa42[_0x0ddf('0x39')][_0x0ddf('0x3e')]('nolimit')){_0x4a9547[_0x0ddf('0x21')]=qs[_0x0ddf('0x21')](_0x94aa42['query'][_0x0ddf('0x21')]);_0x4a9547[_0x0ddf('0x1f')]=qs[_0x0ddf('0x1f')](_0x94aa42['query']['offset']);}_0x4a9547[_0x0ddf('0x3f')]=qs[_0x0ddf('0x40')](_0x94aa42[_0x0ddf('0x39')]['sort']);_0x4a9547['where']=qs['filters'](_[_0x0ddf('0x41')](_0x94aa42[_0x0ddf('0x39')],_0x1b3394[_0x0ddf('0x42')]),_0x5d044b);if(_0x94aa42[_0x0ddf('0x39')][_0x0ddf('0x43')]){_0x4a9547[_0x0ddf('0x44')]=_['merge'](_0x4a9547[_0x0ddf('0x44')],{'$or':_['map'](_0x5d044b,function(_0x4f700b){if(_0x4f700b['type']!==_0x0ddf('0x45')){var _0x135686={};_0x135686[_0x4f700b[_0x0ddf('0x38')]]={'$like':'%'+_0x94aa42['query'][_0x0ddf('0x43')]+'%'};return _0x135686;}})});}_0x4a9547=_[_0x0ddf('0x46')]({},_0x4a9547,_0x94aa42[_0x0ddf('0x47')]);var _0x599d68={'where':_0x4a9547['where']};return db[_0x0ddf('0x33')][_0x0ddf('0x22')](_0x599d68)[_0x0ddf('0x29')](function(_0x130d18){_0x5671bd['count']=_0x130d18;if(_0x94aa42['query']['includeAll']){_0x4a9547[_0x0ddf('0x48')]=[{'all':!![]}];}return db['Interval'][_0x0ddf('0x49')](_0x4a9547);})['then'](function(_0x495791){_0x5671bd[_0x0ddf('0x4a')]=_0x495791;return _0x5671bd;})['then'](respondWithFilteredResult(_0x13896b,_0x4a9547))['catch'](handleError(_0x13896b,null));};exports[_0x0ddf('0x4b')]=function(_0x4bd1ff,_0x45a224){var _0x4d112c={'raw':!![],'where':{'id':_0x4bd1ff['params']['id']}},_0x129a70={};_0x129a70[_0x0ddf('0x3b')]=_['keys'](db['Interval'][_0x0ddf('0x34')]);_0x129a70[_0x0ddf('0x39')]=_[_0x0ddf('0x3a')](_0x4bd1ff[_0x0ddf('0x39')]);_0x129a70[_0x0ddf('0x42')]=_[_0x0ddf('0x4c')](_0x129a70[_0x0ddf('0x3b')],_0x129a70[_0x0ddf('0x39')]);_0x4d112c['attributes']=_[_0x0ddf('0x4c')](_0x129a70[_0x0ddf('0x3b')],qs[_0x0ddf('0x3d')](_0x4bd1ff[_0x0ddf('0x39')]['fields']));_0x4d112c[_0x0ddf('0x3c')]=_0x4d112c[_0x0ddf('0x3c')][_0x0ddf('0x4d')]?_0x4d112c['attributes']:_0x129a70[_0x0ddf('0x3b')];if(_0x4bd1ff[_0x0ddf('0x39')][_0x0ddf('0x4e')]){_0x4d112c[_0x0ddf('0x48')]=[{'all':!![]}];}_0x4d112c=_[_0x0ddf('0x46')]({},_0x4d112c,_0x4bd1ff[_0x0ddf('0x47')]);return db['Interval'][_0x0ddf('0x4f')](_0x4d112c)['then'](handleEntityNotFound(_0x45a224,null))['then'](respondWithResult(_0x45a224,null))['catch'](handleError(_0x45a224,null));};exports[_0x0ddf('0x50')]=function(_0x5c0b52,_0x5560d6){return db[_0x0ddf('0x33')]['create'](_0x5c0b52[_0x0ddf('0x51')],{})[_0x0ddf('0x29')](function(_0x351822){var _0x15ec9f=_0x5c0b52[_0x0ddf('0x52')][_0x0ddf('0x53')]({'plain':!![]});if(!_0x15ec9f)throw new Error(_0x0ddf('0x54'));if(_0x15ec9f[_0x0ddf('0x55')]==='user'){var _0x27eb7d=_0x351822[_0x0ddf('0x53')]({'plain':!![]});var _0x2aac9c=_0x0ddf('0x2b');return db[_0x0ddf('0x56')][_0x0ddf('0x4f')]({'where':{'name':_0x2aac9c,'userProfileId':_0x15ec9f[_0x0ddf('0x57')]},'raw':!![]})[_0x0ddf('0x29')](function(_0x51179f){if(_0x51179f&&_0x51179f[_0x0ddf('0x58')]===0x0){return db['UserProfileResource'][_0x0ddf('0x50')]({'name':_0x27eb7d[_0x0ddf('0x38')],'resourceId':_0x27eb7d['id'],'type':_0x51179f[_0x0ddf('0x38')],'sectionId':_0x51179f['id']},{})[_0x0ddf('0x29')](function(){return _0x351822;});}else{return _0x351822;}})['catch'](function(_0x4c0d45){logger[_0x0ddf('0x2e')](_0x0ddf('0x59'),_0x4c0d45);throw _0x4c0d45;});}return _0x351822;})[_0x0ddf('0x29')](respondWithResult(_0x5560d6,0xc9))['catch'](handleError(_0x5560d6,null));};exports[_0x0ddf('0x28')]=function(_0x5c75e0,_0x1f72f8){if(_0x5c75e0['body']['id']){delete _0x5c75e0[_0x0ddf('0x51')]['id'];}return db[_0x0ddf('0x33')][_0x0ddf('0x4f')]({'where':{'id':_0x5c75e0[_0x0ddf('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1f72f8,null))[_0x0ddf('0x29')](saveUpdates(_0x5c75e0[_0x0ddf('0x51')],null))[_0x0ddf('0x29')](respondWithResult(_0x1f72f8,null))[_0x0ddf('0x5b')](handleError(_0x1f72f8,null));};exports['destroy']=function(_0x3cfd1,_0x1de013){return db['Interval'][_0x0ddf('0x4f')]({'where':{'id':_0x3cfd1[_0x0ddf('0x5a')]['id']}})[_0x0ddf('0x29')](handleEntityNotFound(_0x1de013,null))[_0x0ddf('0x29')](removeEntity(_0x1de013,null))[_0x0ddf('0x5b')](handleError(_0x1de013,null));};exports['addInterval']=function(_0x25854a,_0x24a02c,_0x5cb01f){if(_0x25854a[_0x0ddf('0x51')]['id']){delete _0x25854a[_0x0ddf('0x51')]['id'];}return db[_0x0ddf('0x33')][_0x0ddf('0x4f')]({'where':{'id':_0x25854a[_0x0ddf('0x5a')]['id']}})[_0x0ddf('0x29')](handleEntityNotFound(_0x24a02c,null))['then'](function(_0x47cdc0){if(_0x47cdc0){_0x25854a[_0x0ddf('0x51')][_0x0ddf('0x5c')]=_0x47cdc0['id'];return db[_0x0ddf('0x33')][_0x0ddf('0x50')](_0x25854a[_0x0ddf('0x51')]);}})[_0x0ddf('0x29')](respondWithResult(_0x24a02c,null))[_0x0ddf('0x5b')](handleError(_0x24a02c,null));};exports['getIntervals']=function(_0x40f348,_0x3a445b,_0x7d9b46){var _0xfcc6eb={};var _0x2033ff={};var _0x46c364;var _0x1b78c2;return db['Interval'][_0x0ddf('0x5d')]({'where':{'id':_0x40f348[_0x0ddf('0x5a')]['id']}})[_0x0ddf('0x29')](handleEntityNotFound(_0x3a445b,null))[_0x0ddf('0x29')](function(_0x3c88c0){if(_0x3c88c0){_0x46c364=_0x3c88c0;_0x2033ff[_0x0ddf('0x3b')]=_[_0x0ddf('0x3a')](db[_0x0ddf('0x33')][_0x0ddf('0x34')]);_0x2033ff['query']=_[_0x0ddf('0x3a')](_0x40f348[_0x0ddf('0x39')]);_0x2033ff[_0x0ddf('0x42')]=_[_0x0ddf('0x4c')](_0x2033ff[_0x0ddf('0x3b')],_0x2033ff['query']);_0xfcc6eb[_0x0ddf('0x3c')]=_[_0x0ddf('0x4c')](_0x2033ff[_0x0ddf('0x3b')],qs['fields'](_0x40f348[_0x0ddf('0x39')][_0x0ddf('0x3d')]));_0xfcc6eb[_0x0ddf('0x3c')]=_0xfcc6eb[_0x0ddf('0x3c')][_0x0ddf('0x4d')]?_0xfcc6eb['attributes']:_0x2033ff[_0x0ddf('0x3b')];_0xfcc6eb[_0x0ddf('0x3f')]=qs[_0x0ddf('0x40')](_0x40f348['query'][_0x0ddf('0x40')]);_0xfcc6eb[_0x0ddf('0x44')]=qs['filters'](_[_0x0ddf('0x41')](_0x40f348[_0x0ddf('0x39')],_0x2033ff[_0x0ddf('0x42')]));if(_0x40f348[_0x0ddf('0x39')]['filter']){_0xfcc6eb[_0x0ddf('0x44')]=_['merge'](_0xfcc6eb['where'],{'$or':_[_0x0ddf('0x32')](_0xfcc6eb['attributes'],function(_0x3a368d){var _0x144218={};_0x144218[_0x3a368d]={'$like':'%'+_0x40f348[_0x0ddf('0x39')][_0x0ddf('0x43')]+'%'};return _0x144218;})});}_0xfcc6eb=_['merge']({},_0xfcc6eb,_0x40f348[_0x0ddf('0x47')]);return _0x46c364[_0x0ddf('0x5e')](_0xfcc6eb);}})['then'](function(_0x44fa28){if(_0x44fa28){_0x1b78c2=_0x44fa28[_0x0ddf('0x4d')];if(!_0x40f348['query'][_0x0ddf('0x3e')](_0x0ddf('0x5f'))){_0xfcc6eb[_0x0ddf('0x21')]=qs[_0x0ddf('0x21')](_0x40f348[_0x0ddf('0x39')][_0x0ddf('0x21')]);_0xfcc6eb['offset']=qs[_0x0ddf('0x1f')](_0x40f348[_0x0ddf('0x39')][_0x0ddf('0x1f')]);}return _0x46c364[_0x0ddf('0x5e')](_0xfcc6eb);}})[_0x0ddf('0x29')](function(_0x34ac1e){if(_0x34ac1e){return _0x34ac1e?{'count':_0x1b78c2,'rows':_0x34ac1e}:null;}})['then'](respondWithResult(_0x3a445b,null))[_0x0ddf('0x5b')](handleError(_0x3a445b,null));};exports[_0x0ddf('0x60')]=function(_0x32d387,_0x524aa3,_0x16e4f3){return db['Interval'][_0x0ddf('0x5d')]({'where':{'id':_0x32d387[_0x0ddf('0x5a')]['id']}})[_0x0ddf('0x29')](handleEntityNotFound(_0x524aa3,null))[_0x0ddf('0x29')](function(_0x1f3150){if(_0x1f3150){return db['sequelize']['transaction'](function(_0x15db19){return db[_0x0ddf('0x33')][_0x0ddf('0x2a')]({'where':{'IntervalId':_0x32d387[_0x0ddf('0x5a')]['id']},'transaction':_0x15db19})[_0x0ddf('0x29')](function(_0x558ca7){var _0x53b62e=_[_0x0ddf('0x32')](_0x32d387['body'],function(_0x36c847){delete _0x36c847['id'];_0x36c847[_0x0ddf('0x5c')]=_0x32d387[_0x0ddf('0x5a')]['id'];return _0x36c847;});return db[_0x0ddf('0x33')]['bulkCreate'](_0x53b62e,{'transaction':_0x15db19});});})[_0x0ddf('0x29')](function(){return db[_0x0ddf('0x33')]['findAll']({'where':{'IntervalId':_0x32d387[_0x0ddf('0x5a')]['id']}});});}})[_0x0ddf('0x29')](respondWithResult(_0x524aa3,null))[_0x0ddf('0x5b')](handleError(_0x524aa3,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index f4336d2..e516c51 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 _0x278b=['tools_intervals','rewrite','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./interval.attributes','exports','Interval'];(function(_0x2a01f8,_0x535c05){var _0x464ca9=function(_0x277d97){while(--_0x277d97){_0x2a01f8['push'](_0x2a01f8['shift']());}};_0x464ca9(++_0x535c05);}(_0x278b,0xec));var _0xb278=function(_0x32b122,_0x1ad490){_0x32b122=_0x32b122-0x0;var _0x4ad25a=_0x278b[_0x32b122];return _0x4ad25a;};'use strict';var _=require('lodash');var util=require(_0xb278('0x0'));var logger=require(_0xb278('0x1'))(_0xb278('0x2'));var moment=require(_0xb278('0x3'));var BPromise=require(_0xb278('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb278('0x5'));var rimraf=require(_0xb278('0x6'));var config=require(_0xb278('0x7'));var attributes=require(_0xb278('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0xb278('0x9')]=function(_0x189349,_0x2fe156){return _0x189349['define'](_0xb278('0xa'),attributes,{'tableName':_0xb278('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4352ad,_0x386ed5){extensions[_0xb278('0xc')](_0x189349,_0x4352ad);},'afterBulkCreate':function(_0x198afd,_0x1314df,_0xb2ab92){_0xb2ab92();extensions[_0xb278('0xc')](_0x189349,_0x198afd[0x0]);},'afterUpdate':function(_0x32a974,_0x4df156){extensions[_0xb278('0xc')](_0x189349,_0x32a974);},'afterDestroy':function(_0x30d31c,_0x3c42a6){extensions['rewrite'](_0x189349,_0x30d31c);}}});}; \ No newline at end of file +var _0x9916=['rewrite','util','api','moment','bluebird','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals'];(function(_0x4635df,_0x13063c){var _0x1842ad=function(_0x992348){while(--_0x992348){_0x4635df['push'](_0x4635df['shift']());}};_0x1842ad(++_0x13063c);}(_0x9916,0x145));var _0x6991=function(_0x1f6c3a,_0x36a2ab){_0x1f6c3a=_0x1f6c3a-0x0;var _0x39999d=_0x9916[_0x1f6c3a];return _0x39999d;};'use strict';var _=require('lodash');var util=require(_0x6991('0x0'));var logger=require('../../config/logger')(_0x6991('0x1'));var moment=require(_0x6991('0x2'));var BPromise=require(_0x6991('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6991('0x4'));var attributes=require(_0x6991('0x5'));var extensions=require(_0x6991('0x6'));module[_0x6991('0x7')]=function(_0xb970b,_0x5aca95){return _0xb970b[_0x6991('0x8')](_0x6991('0x9'),attributes,{'tableName':_0x6991('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ad56d,_0x40efae){extensions[_0x6991('0xb')](_0xb970b,_0x5ad56d);},'afterBulkCreate':function(_0x105ef8,_0x16f4a9,_0x343e85){_0x343e85();extensions[_0x6991('0xb')](_0xb970b,_0x105ef8[0x0]);},'afterUpdate':function(_0x1e5e75,_0x1cfc17){extensions[_0x6991('0xb')](_0xb970b,_0x1e5e75);},'afterDestroy':function(_0x11a899,_0x48f79b){extensions['rewrite'](_0xb970b,_0x11a899);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c6f8c2c..2e20463 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(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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(_0x265003,_0xf0f023){var _0x33c743=function(_0x326a5d){while(--_0x326a5d){_0x265003['push'](_0x265003['shift']());}};_0x33c743(++_0xf0f023);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 6fd29a5..1143f5f 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x4b0d72,_0xf66c17){var _0x205999=function(_0x4bc69c){while(--_0x4bc69c){_0x4b0d72['push'](_0x4b0d72['shift']());}};_0x205999(++_0xf66c17);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3150fc,_0x4d3793){_0x3150fc=_0x3150fc-0x0;var _0x29b253=_0x5f2f[_0x3150fc];return _0x29b253;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x3ed659,_0x554e48){var _0x433acc=function(_0x2cb5e8){while(--_0x2cb5e8){_0x3ed659['push'](_0x3ed659['shift']());}};_0x433acc(++_0x554e48);}(_0xadb5,0xad));var _0x5adb=function(_0x53285e,_0x23f791){_0x53285e=_0x53285e-0x0;var _0x56f823=_0xadb5[_0x53285e];return _0x56f823;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 83aa239..6e5ed82 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 _0x4d1a=['end','status','statusCode','json','parse','api.jira','openIssue','send','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','3eAmWpBVP0','MOTGUI','summary','Report','description','Bug','fields','email','customfield_11501','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','Basic\x20','toString','stringify','utf8','data'];(function(_0x26dbc6,_0x1c4f4e){var _0x916fe7=function(_0x27cfc8){while(--_0x27cfc8){_0x26dbc6['push'](_0x26dbc6['shift']());}};_0x916fe7(++_0x1c4f4e);}(_0x4d1a,0x1c5));var _0xa4d1=function(_0x5b216d,_0x5c3d62){_0x5b216d=_0x5b216d-0x0;var _0x3d7088=_0x4d1a[_0x5b216d];return _0x3d7088;};'use strict';var BPromise=require(_0xa4d1('0x0'));var https=require(_0xa4d1('0x1'));var logger=require(_0xa4d1('0x2'))(_0xa4d1('0x3'));var USERNAME='support';var PASSWORD=_0xa4d1('0x4');function openIssue(_0x323745,_0x4d7a09){var _0x29ec02={'fields':{'project':{'key':_0x323745['key']||_0xa4d1('0x5')},'summary':(_0x323745[_0xa4d1('0x6')]||_0xa4d1('0x7'))+'\x20from\x20'+_0x323745['ip'],'description':_0x323745[_0xa4d1('0x8')]||JSON['stringify'](_0x323745),'issuetype':{'name':_0x323745['issuetype']||_0xa4d1('0x9')}}};_0x29ec02[_0xa4d1('0xa')]['customfield_11500']=_0x323745[_0xa4d1('0xb')];_0x29ec02[_0xa4d1('0xa')][_0xa4d1('0xc')]=_0x323745[_0xa4d1('0xd')];_0x29ec02['fields'][_0xa4d1('0xe')]=_0x323745['newToken'];_0x29ec02['fields'][_0xa4d1('0xf')]=_0x323745[_0xa4d1('0x10')];_0x29ec02[_0xa4d1('0xa')][_0xa4d1('0x11')]=_0x323745[_0xa4d1('0x12')];_0x29ec02[_0xa4d1('0xa')][_0xa4d1('0x13')]=_0x323745['ip'];var _0x5bbfb4={'host':_0xa4d1('0x14'),'port':0x1bb,'path':_0xa4d1('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xa4d1('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xa4d1('0x17')]('base64')}};var _0x361ac=JSON[_0xa4d1('0x18')](_0x29ec02);var _0x5accc4=https['request'](_0x5bbfb4,function(_0x5008c3){_0x5008c3['setEncoding'](_0xa4d1('0x19'));var _0x1f9ec8='';_0x5008c3['on'](_0xa4d1('0x1a'),function(_0x373fa7){_0x1f9ec8+=_0x373fa7;});_0x5008c3['on'](_0xa4d1('0x1b'),function(){if(_0x4d7a09){return _0x4d7a09[_0xa4d1('0x1c')](_0x5008c3[_0xa4d1('0x1d')])[_0xa4d1('0x1e')](JSON[_0xa4d1('0x1f')](_0x1f9ec8));}});});_0x5accc4['on']('error',function(_0x4209db){if(_0x4d7a09){return _0x4d7a09[_0xa4d1('0x1c')](0x1f4)[_0xa4d1('0x1e')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xa4d1('0x20')}]});}});_0x5accc4['write'](_0x361ac);_0x5accc4['end']();}exports[_0xa4d1('0x21')]=openIssue;exports[_0xa4d1('0x22')]=function(_0x53f884,_0x521fee){_0x53f884['body']['ip']=_0x53f884['headers'][_0xa4d1('0x23')]||_0x53f884[_0xa4d1('0x24')][_0xa4d1('0x25')]||_0x53f884[_0xa4d1('0x26')]['remoteAddress']||_0x53f884[_0xa4d1('0x24')][_0xa4d1('0x26')][_0xa4d1('0x25')];return openIssue(_0x53f884[_0xa4d1('0x27')],_0x521fee);}; \ No newline at end of file +var _0xed86=['POST','toString','request','setEncoding','data','end','status','json','parse','error','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue'];(function(_0x50cc54,_0x54c15f){var _0x28ecca=function(_0x4eff92){while(--_0x4eff92){_0x50cc54['push'](_0x50cc54['shift']());}};_0x28ecca(++_0x54c15f);}(_0xed86,0xf0));var _0x6ed8=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0xed86[_0xe8129c];return _0x709fc5;};'use strict';var BPromise=require('bluebird');var https=require(_0x6ed8('0x0'));var logger=require(_0x6ed8('0x1'))('api');var USERNAME=_0x6ed8('0x2');var PASSWORD=_0x6ed8('0x3');function openIssue(_0x4270b8,_0x1034f0){var _0x3247c6={'fields':{'project':{'key':_0x4270b8[_0x6ed8('0x4')]||'MOTGUI'},'summary':(_0x4270b8[_0x6ed8('0x5')]||_0x6ed8('0x6'))+_0x6ed8('0x7')+_0x4270b8['ip'],'description':_0x4270b8[_0x6ed8('0x8')]||JSON[_0x6ed8('0x9')](_0x4270b8),'issuetype':{'name':_0x4270b8['issuetype']||_0x6ed8('0xa')}}};_0x3247c6[_0x6ed8('0xb')][_0x6ed8('0xc')]=_0x4270b8[_0x6ed8('0xd')];_0x3247c6[_0x6ed8('0xb')][_0x6ed8('0xe')]=_0x4270b8[_0x6ed8('0xf')];_0x3247c6[_0x6ed8('0xb')][_0x6ed8('0x10')]=_0x4270b8[_0x6ed8('0x11')];_0x3247c6[_0x6ed8('0xb')][_0x6ed8('0x12')]=_0x4270b8[_0x6ed8('0x13')];_0x3247c6[_0x6ed8('0xb')]['customfield_11504']=_0x4270b8[_0x6ed8('0x14')];_0x3247c6[_0x6ed8('0xb')][_0x6ed8('0x15')]=_0x4270b8['ip'];var _0x5a381e={'host':_0x6ed8('0x16'),'port':0x1bb,'path':_0x6ed8('0x17'),'method':_0x6ed8('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x6ed8('0x19')]('base64')}};var _0x588cf3=JSON[_0x6ed8('0x9')](_0x3247c6);var _0x1eb7f2=https[_0x6ed8('0x1a')](_0x5a381e,function(_0x19608f){_0x19608f[_0x6ed8('0x1b')]('utf8');var _0x272707='';_0x19608f['on'](_0x6ed8('0x1c'),function(_0x42296b){_0x272707+=_0x42296b;});_0x19608f['on'](_0x6ed8('0x1d'),function(){if(_0x1034f0){return _0x1034f0[_0x6ed8('0x1e')](_0x19608f['statusCode'])[_0x6ed8('0x1f')](JSON[_0x6ed8('0x20')](_0x272707));}});});_0x1eb7f2['on'](_0x6ed8('0x21'),function(_0x592858){if(_0x1034f0){return _0x1034f0[_0x6ed8('0x1e')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x6ed8('0x22')}]});}});_0x1eb7f2[_0x6ed8('0x23')](_0x588cf3);_0x1eb7f2[_0x6ed8('0x1d')]();}exports[_0x6ed8('0x24')]=openIssue;exports[_0x6ed8('0x25')]=function(_0x2afaba,_0x1ee74e){_0x2afaba[_0x6ed8('0x26')]['ip']=_0x2afaba[_0x6ed8('0x27')][_0x6ed8('0x28')]||_0x2afaba[_0x6ed8('0x29')][_0x6ed8('0x2a')]||_0x2afaba[_0x6ed8('0x2b')]['remoteAddress']||_0x2afaba[_0x6ed8('0x29')][_0x6ed8('0x2b')]['remoteAddress'];return openIssue(_0x2afaba['body'],_0x1ee74e);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index f12f581..642c852 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 _0x9c44=['update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put'];(function(_0xf9664c,_0x23180f){var _0x400cfb=function(_0x10db21){while(--_0x10db21){_0xf9664c['push'](_0xf9664c['shift']());}};_0x400cfb(++_0x23180f);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0xf')]);router['delete']('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa74f=['/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get'];(function(_0x32ec2e,_0x3d423f){var _0x28e955=function(_0x5297c1){while(--_0x5297c1){_0x32ec2e['push'](_0x32ec2e['shift']());}};_0x28e955(++_0x3d423f);}(_0xa74f,0x9a));var _0xfa74=function(_0x340756,_0xad31ae){_0x340756=_0x340756-0x0;var _0x2ef745=_0xa74f[_0x340756];return _0x2ef745;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0xc')]('/',auth[_0xfa74('0x9')](),controller['create']);router[_0xfa74('0xd')](_0xfa74('0xe'),auth['isAuthenticated'](),controller[_0xfa74('0xf')]);router[_0xfa74('0x10')](_0xfa74('0xe'),auth[_0xfa74('0x9')](),controller['destroy']);module[_0xfa74('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index b293a1e..02b35f2 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(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x7a54,0x106));var _0x47a5=function(_0x1b20bb,_0x47a9da){_0x1b20bb=_0x1b20bb-0x0;var _0x354e59=_0x7a54[_0x1b20bb];return _0x354e59;};'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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7a54,0x106));var _0x47a5=function(_0x532687,_0x359b2d){_0x532687=_0x532687-0x0;var _0xca75cc=_0x7a54[_0x532687];return _0xca75cc;};'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 09b63e1..07475bd 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 _0x9c63=['querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','update','then','destroy','stack','name','send','index','JscriptyAnswerReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x19b290,_0x40fb19){var _0x109c0c=function(_0x40a76c){while(--_0x40a76c){_0x19b290['push'](_0x19b290['shift']());}};_0x109c0c(++_0x40fb19);}(_0x9c63,0x1a7));var _0x39c6=function(_0x32ebcc,_0x443b3d){_0x32ebcc=_0x32ebcc-0x0;var _0x84a525=_0x9c63[_0x32ebcc];return _0x84a525;};'use strict';var emlformat=require(_0x39c6('0x0'));var rimraf=require(_0x39c6('0x1'));var zipdir=require(_0x39c6('0x2'));var jsonpatch=require(_0x39c6('0x3'));var rp=require(_0x39c6('0x4'));var moment=require('moment');var BPromise=require(_0x39c6('0x5'));var Mustache=require(_0x39c6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x39c6('0x7'));var csv=require(_0x39c6('0x8'));var ejs=require(_0x39c6('0x9'));var fs=require('fs');var fs_extra=require(_0x39c6('0xa'));var _=require(_0x39c6('0xb'));var squel=require(_0x39c6('0xc'));var crypto=require('crypto');var jsforce=require(_0x39c6('0xd'));var deskjs=require(_0x39c6('0xe'));var toCsv=require(_0x39c6('0x8'));var querystring=require(_0x39c6('0xf'));var Papa=require(_0x39c6('0x10'));var Redis=require('ioredis');var authService=require(_0x39c6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x39c6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39c6('0x13'))(_0x39c6('0x14'));var utils=require(_0x39c6('0x15'));var config=require(_0x39c6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x39c6('0x17'))['db'];function respondWithStatusCode(_0x5a9e9a,_0x58a65f){_0x58a65f=_0x58a65f||0xcc;return function(_0x1f3e1d){if(_0x1f3e1d){return _0x5a9e9a[_0x39c6('0x18')](_0x58a65f);}return _0x5a9e9a[_0x39c6('0x19')](_0x58a65f)[_0x39c6('0x1a')]();};}function respondWithResult(_0x504041,_0x124d43){_0x124d43=_0x124d43||0xc8;return function(_0x4c83dc){if(_0x4c83dc){return _0x504041[_0x39c6('0x19')](_0x124d43)[_0x39c6('0x1b')](_0x4c83dc);}};}function respondWithFilteredResult(_0x2ac896,_0x4c732a){return function(_0x5e3046){if(_0x5e3046){var _0x4581d7=typeof _0x4c732a[_0x39c6('0x1c')]==='undefined'&&typeof _0x4c732a[_0x39c6('0x1d')]===_0x39c6('0x1e');var _0x10ffb8=_0x5e3046[_0x39c6('0x1f')];var _0x129613=_0x4581d7?0x0:_0x4c732a[_0x39c6('0x1c')];var _0x518536=_0x4581d7?_0x5e3046['count']:_0x4c732a['offset']+_0x4c732a['limit'];var _0x524702;if(_0x518536>=_0x10ffb8){_0x518536=_0x10ffb8;_0x524702=0xc8;}else{_0x524702=0xce;}_0x2ac896[_0x39c6('0x19')](_0x524702);return _0x2ac896['set']('Content-Range',_0x129613+'-'+_0x518536+'/'+_0x10ffb8)[_0x39c6('0x1b')](_0x5e3046);}return null;};}function patchUpdates(_0x37dce5){return function(_0x1d91aa){try{jsonpatch[_0x39c6('0x20')](_0x1d91aa,_0x37dce5,!![]);}catch(_0x5608dd){return BPromise['reject'](_0x5608dd);}return _0x1d91aa['save']();};}function saveUpdates(_0x35fc85,_0x588c1d){return function(_0x5d4083){if(_0x5d4083){return _0x5d4083[_0x39c6('0x21')](_0x35fc85)[_0x39c6('0x22')](function(_0x358f6f){return _0x358f6f;});}return null;};}function removeEntity(_0x2e88a3,_0x3e4d7d){return function(_0x33132f){if(_0x33132f){return _0x33132f[_0x39c6('0x23')]()[_0x39c6('0x22')](function(){_0x2e88a3[_0x39c6('0x19')](0xcc)[_0x39c6('0x1a')]();});}};}function handleEntityNotFound(_0x2fd3a7,_0x3018f6){return function(_0x3e49ca){if(!_0x3e49ca){_0x2fd3a7[_0x39c6('0x18')](0x194);}return _0x3e49ca;};}function handleError(_0x1ebdf2,_0x46d0c3){_0x46d0c3=_0x46d0c3||0x1f4;return function(_0x1708e7){logger['error'](_0x1708e7[_0x39c6('0x24')]);if(_0x1708e7[_0x39c6('0x25')]){delete _0x1708e7[_0x39c6('0x25')];}_0x1ebdf2['status'](_0x46d0c3)[_0x39c6('0x26')](_0x1708e7);};}exports[_0x39c6('0x27')]=function(_0x185869,_0x179f15){var _0x5c07f7={},_0x4937c4={},_0x43d1be={'count':0x0,'rows':[]};var _0x243d47=_['map'](db[_0x39c6('0x28')]['rawAttributes'],function(_0x520e8a){return{'name':_0x520e8a[_0x39c6('0x29')],'type':_0x520e8a[_0x39c6('0x2a')][_0x39c6('0x2b')]};});_0x4937c4[_0x39c6('0x2c')]=_[_0x39c6('0x2d')](_0x243d47,_0x39c6('0x25'));_0x4937c4[_0x39c6('0x2e')]=_[_0x39c6('0x2f')](_0x185869[_0x39c6('0x2e')]);_0x4937c4[_0x39c6('0x30')]=_[_0x39c6('0x31')](_0x4937c4[_0x39c6('0x2c')],_0x4937c4[_0x39c6('0x2e')]);_0x5c07f7[_0x39c6('0x32')]=_[_0x39c6('0x31')](_0x4937c4[_0x39c6('0x2c')],qs[_0x39c6('0x33')](_0x185869['query']['fields']));_0x5c07f7[_0x39c6('0x32')]=_0x5c07f7[_0x39c6('0x32')][_0x39c6('0x34')]?_0x5c07f7[_0x39c6('0x32')]:_0x4937c4[_0x39c6('0x2c')];if(!_0x185869[_0x39c6('0x2e')][_0x39c6('0x35')]('nolimit')){_0x5c07f7[_0x39c6('0x1d')]=qs[_0x39c6('0x1d')](_0x185869['query']['limit']);_0x5c07f7[_0x39c6('0x1c')]=qs[_0x39c6('0x1c')](_0x185869[_0x39c6('0x2e')][_0x39c6('0x1c')]);}_0x5c07f7[_0x39c6('0x36')]=qs[_0x39c6('0x37')](_0x185869[_0x39c6('0x2e')][_0x39c6('0x37')]);_0x5c07f7[_0x39c6('0x38')]=qs[_0x39c6('0x30')](_[_0x39c6('0x39')](_0x185869[_0x39c6('0x2e')],_0x4937c4[_0x39c6('0x30')]),_0x243d47);if(_0x185869['query']['filter']){_0x5c07f7[_0x39c6('0x38')]=_[_0x39c6('0x3a')](_0x5c07f7[_0x39c6('0x38')],{'$or':_['map'](_0x243d47,function(_0x2eda73){if(_0x2eda73[_0x39c6('0x2a')]!==_0x39c6('0x3b')){var _0xd92ccc={};_0xd92ccc[_0x2eda73['name']]={'$like':'%'+_0x185869['query'][_0x39c6('0x3c')]+'%'};return _0xd92ccc;}})});}_0x5c07f7=_['merge']({},_0x5c07f7,_0x185869[_0x39c6('0x3d')]);var _0x18aae9={'where':_0x5c07f7[_0x39c6('0x38')]};return db[_0x39c6('0x28')]['count'](_0x18aae9)[_0x39c6('0x22')](function(_0x8e4821){_0x43d1be[_0x39c6('0x1f')]=_0x8e4821;if(_0x185869[_0x39c6('0x2e')][_0x39c6('0x3e')]){_0x5c07f7[_0x39c6('0x3f')]=[{'all':!![]}];}return db[_0x39c6('0x28')][_0x39c6('0x40')](_0x5c07f7);})[_0x39c6('0x22')](function(_0x4bf748){_0x43d1be['rows']=_0x4bf748;return _0x43d1be;})[_0x39c6('0x22')](respondWithFilteredResult(_0x179f15,_0x5c07f7))['catch'](handleError(_0x179f15,null));};exports[_0x39c6('0x41')]=function(_0x4c3bf2,_0x4989ac){var _0x3642fc={'raw':!![],'where':{'id':_0x4c3bf2[_0x39c6('0x42')]['id']}},_0x1f6d26={};_0x1f6d26['model']=_[_0x39c6('0x2f')](db[_0x39c6('0x28')][_0x39c6('0x43')]);_0x1f6d26[_0x39c6('0x2e')]=_[_0x39c6('0x2f')](_0x4c3bf2[_0x39c6('0x2e')]);_0x1f6d26['filters']=_['intersection'](_0x1f6d26[_0x39c6('0x2c')],_0x1f6d26[_0x39c6('0x2e')]);_0x3642fc['attributes']=_[_0x39c6('0x31')](_0x1f6d26[_0x39c6('0x2c')],qs['fields'](_0x4c3bf2[_0x39c6('0x2e')][_0x39c6('0x33')]));_0x3642fc[_0x39c6('0x32')]=_0x3642fc[_0x39c6('0x32')][_0x39c6('0x34')]?_0x3642fc[_0x39c6('0x32')]:_0x1f6d26['model'];if(_0x4c3bf2[_0x39c6('0x2e')][_0x39c6('0x3e')]){_0x3642fc[_0x39c6('0x3f')]=[{'all':!![]}];}_0x3642fc=_[_0x39c6('0x3a')]({},_0x3642fc,_0x4c3bf2[_0x39c6('0x3d')]);return db['JscriptyAnswerReport'][_0x39c6('0x44')](_0x3642fc)['then'](handleEntityNotFound(_0x4989ac,null))[_0x39c6('0x22')](respondWithResult(_0x4989ac,null))[_0x39c6('0x45')](handleError(_0x4989ac,null));};exports[_0x39c6('0x46')]=function(_0x15dc9a,_0x144130){return db[_0x39c6('0x28')][_0x39c6('0x46')](_0x15dc9a[_0x39c6('0x47')],{})['then'](respondWithResult(_0x144130,0xc9))[_0x39c6('0x45')](handleError(_0x144130,null));};exports[_0x39c6('0x21')]=function(_0x209bda,_0x3147e2){if(_0x209bda[_0x39c6('0x47')]['id']){delete _0x209bda[_0x39c6('0x47')]['id'];}return db[_0x39c6('0x28')][_0x39c6('0x44')]({'where':{'id':_0x209bda[_0x39c6('0x42')]['id']}})['then'](handleEntityNotFound(_0x3147e2,null))[_0x39c6('0x22')](saveUpdates(_0x209bda[_0x39c6('0x47')],null))[_0x39c6('0x22')](respondWithResult(_0x3147e2,null))['catch'](handleError(_0x3147e2,null));};exports[_0x39c6('0x23')]=function(_0x56df9b,_0x34f0bf){return db['JscriptyAnswerReport'][_0x39c6('0x44')]({'where':{'id':_0x56df9b[_0x39c6('0x42')]['id']}})[_0x39c6('0x22')](handleEntityNotFound(_0x34f0bf,null))['then'](removeEntity(_0x34f0bf,null))[_0x39c6('0x45')](handleError(_0x34f0bf,null));};exports[_0x39c6('0x48')]=function(_0x348228,_0x27e8e7){return db[_0x39c6('0x28')][_0x39c6('0x48')]()['then'](respondWithResult(_0x27e8e7,null))[_0x39c6('0x45')](handleError(_0x27e8e7,null));}; \ No newline at end of file +var _0x17c4=['order','sort','where','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','filters','intersection','merge','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','end','sendStatus','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x6ae0d5,_0x13d067){var _0x53943d=function(_0x1e5f12){while(--_0x1e5f12){_0x6ae0d5['push'](_0x6ae0d5['shift']());}};_0x53943d(++_0x13d067);}(_0x17c4,0x102));var _0x417c=function(_0x4d82e4,_0x3cf5be){_0x4d82e4=_0x4d82e4-0x0;var _0x3a3c8b=_0x17c4[_0x4d82e4];return _0x3a3c8b;};'use strict';var emlformat=require(_0x417c('0x0'));var rimraf=require(_0x417c('0x1'));var zipdir=require(_0x417c('0x2'));var jsonpatch=require(_0x417c('0x3'));var rp=require(_0x417c('0x4'));var moment=require(_0x417c('0x5'));var BPromise=require(_0x417c('0x6'));var Mustache=require(_0x417c('0x7'));var util=require(_0x417c('0x8'));var path=require(_0x417c('0x9'));var sox=require(_0x417c('0xa'));var csv=require('to-csv');var ejs=require(_0x417c('0xb'));var fs=require('fs');var fs_extra=require(_0x417c('0xc'));var _=require(_0x417c('0xd'));var squel=require(_0x417c('0xe'));var crypto=require(_0x417c('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x417c('0x10'));var querystring=require(_0x417c('0x11'));var Papa=require(_0x417c('0x12'));var Redis=require(_0x417c('0x13'));var authService=require(_0x417c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x417c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x417c('0x16'))(_0x417c('0x17'));var utils=require(_0x417c('0x18'));var config=require(_0x417c('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23b22f,_0x5952b2){_0x5952b2=_0x5952b2||0xcc;return function(_0x4e113a){if(_0x4e113a){return _0x23b22f['sendStatus'](_0x5952b2);}return _0x23b22f[_0x417c('0x1a')](_0x5952b2)['end']();};}function respondWithResult(_0x73f8c3,_0x34361a){_0x34361a=_0x34361a||0xc8;return function(_0x49a227){if(_0x49a227){return _0x73f8c3[_0x417c('0x1a')](_0x34361a)[_0x417c('0x1b')](_0x49a227);}};}function respondWithFilteredResult(_0x3feb87,_0x4416c6){return function(_0x509fce){if(_0x509fce){var _0x56d121=typeof _0x4416c6[_0x417c('0x1c')]===_0x417c('0x1d')&&typeof _0x4416c6[_0x417c('0x1e')]==='undefined';var _0x1ab811=_0x509fce[_0x417c('0x1f')];var _0xf8d94c=_0x56d121?0x0:_0x4416c6[_0x417c('0x1c')];var _0x308618=_0x56d121?_0x509fce[_0x417c('0x1f')]:_0x4416c6[_0x417c('0x1c')]+_0x4416c6[_0x417c('0x1e')];var _0x4a8fc3;if(_0x308618>=_0x1ab811){_0x308618=_0x1ab811;_0x4a8fc3=0xc8;}else{_0x4a8fc3=0xce;}_0x3feb87[_0x417c('0x1a')](_0x4a8fc3);return _0x3feb87[_0x417c('0x20')](_0x417c('0x21'),_0xf8d94c+'-'+_0x308618+'/'+_0x1ab811)[_0x417c('0x1b')](_0x509fce);}return null;};}function patchUpdates(_0x226647){return function(_0x7c1e5a){try{jsonpatch[_0x417c('0x22')](_0x7c1e5a,_0x226647,!![]);}catch(_0x32247b){return BPromise[_0x417c('0x23')](_0x32247b);}return _0x7c1e5a[_0x417c('0x24')]();};}function saveUpdates(_0xcb26f7,_0x6b6835){return function(_0xd5a3fa){if(_0xd5a3fa){return _0xd5a3fa['update'](_0xcb26f7)['then'](function(_0x1924eb){return _0x1924eb;});}return null;};}function removeEntity(_0x3b3c60,_0x1867e6){return function(_0x5b6067){if(_0x5b6067){return _0x5b6067[_0x417c('0x25')]()[_0x417c('0x26')](function(){_0x3b3c60[_0x417c('0x1a')](0xcc)[_0x417c('0x27')]();});}};}function handleEntityNotFound(_0x2a27f8,_0x482b3f){return function(_0x243066){if(!_0x243066){_0x2a27f8[_0x417c('0x28')](0x194);}return _0x243066;};}function handleError(_0x528e04,_0x4cebb9){_0x4cebb9=_0x4cebb9||0x1f4;return function(_0x54dd1a){logger[_0x417c('0x29')](_0x54dd1a['stack']);if(_0x54dd1a[_0x417c('0x2a')]){delete _0x54dd1a[_0x417c('0x2a')];}_0x528e04[_0x417c('0x1a')](_0x4cebb9)[_0x417c('0x2b')](_0x54dd1a);};}exports[_0x417c('0x2c')]=function(_0xa9435f,_0x1f0805){var _0x3fb31c={},_0x9685fd={},_0x17128b={'count':0x0,'rows':[]};var _0x4a355c=_[_0x417c('0x2d')](db[_0x417c('0x2e')][_0x417c('0x2f')],function(_0x2f0376){return{'name':_0x2f0376[_0x417c('0x30')],'type':_0x2f0376[_0x417c('0x31')][_0x417c('0x32')]};});_0x9685fd[_0x417c('0x33')]=_[_0x417c('0x2d')](_0x4a355c,_0x417c('0x2a'));_0x9685fd[_0x417c('0x34')]=_['keys'](_0xa9435f[_0x417c('0x34')]);_0x9685fd['filters']=_['intersection'](_0x9685fd[_0x417c('0x33')],_0x9685fd['query']);_0x3fb31c['attributes']=_['intersection'](_0x9685fd['model'],qs[_0x417c('0x35')](_0xa9435f[_0x417c('0x34')]['fields']));_0x3fb31c[_0x417c('0x36')]=_0x3fb31c['attributes'][_0x417c('0x37')]?_0x3fb31c[_0x417c('0x36')]:_0x9685fd[_0x417c('0x33')];if(!_0xa9435f['query'][_0x417c('0x38')](_0x417c('0x39'))){_0x3fb31c[_0x417c('0x1e')]=qs[_0x417c('0x1e')](_0xa9435f[_0x417c('0x34')][_0x417c('0x1e')]);_0x3fb31c[_0x417c('0x1c')]=qs['offset'](_0xa9435f['query'][_0x417c('0x1c')]);}_0x3fb31c[_0x417c('0x3a')]=qs['sort'](_0xa9435f['query'][_0x417c('0x3b')]);_0x3fb31c[_0x417c('0x3c')]=qs['filters'](_['pick'](_0xa9435f[_0x417c('0x34')],_0x9685fd['filters']),_0x4a355c);if(_0xa9435f[_0x417c('0x34')][_0x417c('0x3d')]){_0x3fb31c['where']=_['merge'](_0x3fb31c[_0x417c('0x3c')],{'$or':_[_0x417c('0x2d')](_0x4a355c,function(_0x3ddcc6){if(_0x3ddcc6[_0x417c('0x31')]!==_0x417c('0x3e')){var _0x51ca08={};_0x51ca08[_0x3ddcc6['name']]={'$like':'%'+_0xa9435f[_0x417c('0x34')][_0x417c('0x3d')]+'%'};return _0x51ca08;}})});}_0x3fb31c=_['merge']({},_0x3fb31c,_0xa9435f[_0x417c('0x3f')]);var _0x127527={'where':_0x3fb31c[_0x417c('0x3c')]};return db[_0x417c('0x2e')][_0x417c('0x1f')](_0x127527)[_0x417c('0x26')](function(_0x54a86f){_0x17128b['count']=_0x54a86f;if(_0xa9435f[_0x417c('0x34')][_0x417c('0x40')]){_0x3fb31c[_0x417c('0x41')]=[{'all':!![]}];}return db[_0x417c('0x2e')]['findAll'](_0x3fb31c);})[_0x417c('0x26')](function(_0x3d7ec3){_0x17128b[_0x417c('0x42')]=_0x3d7ec3;return _0x17128b;})[_0x417c('0x26')](respondWithFilteredResult(_0x1f0805,_0x3fb31c))[_0x417c('0x43')](handleError(_0x1f0805,null));};exports[_0x417c('0x44')]=function(_0x8796e1,_0x20e2f6){var _0x3745bc={'raw':!![],'where':{'id':_0x8796e1[_0x417c('0x45')]['id']}},_0x24d265={};_0x24d265[_0x417c('0x33')]=_[_0x417c('0x46')](db[_0x417c('0x2e')][_0x417c('0x2f')]);_0x24d265[_0x417c('0x34')]=_['keys'](_0x8796e1[_0x417c('0x34')]);_0x24d265[_0x417c('0x47')]=_['intersection'](_0x24d265[_0x417c('0x33')],_0x24d265[_0x417c('0x34')]);_0x3745bc[_0x417c('0x36')]=_[_0x417c('0x48')](_0x24d265[_0x417c('0x33')],qs[_0x417c('0x35')](_0x8796e1[_0x417c('0x34')][_0x417c('0x35')]));_0x3745bc[_0x417c('0x36')]=_0x3745bc['attributes']['length']?_0x3745bc[_0x417c('0x36')]:_0x24d265[_0x417c('0x33')];if(_0x8796e1[_0x417c('0x34')][_0x417c('0x40')]){_0x3745bc[_0x417c('0x41')]=[{'all':!![]}];}_0x3745bc=_[_0x417c('0x49')]({},_0x3745bc,_0x8796e1[_0x417c('0x3f')]);return db['JscriptyAnswerReport'][_0x417c('0x4a')](_0x3745bc)['then'](handleEntityNotFound(_0x20e2f6,null))['then'](respondWithResult(_0x20e2f6,null))['catch'](handleError(_0x20e2f6,null));};exports['create']=function(_0x18d2ba,_0x30a8b0){return db[_0x417c('0x2e')][_0x417c('0x4b')](_0x18d2ba[_0x417c('0x4c')],{})[_0x417c('0x26')](respondWithResult(_0x30a8b0,0xc9))[_0x417c('0x43')](handleError(_0x30a8b0,null));};exports[_0x417c('0x4d')]=function(_0x384a4f,_0x19b001){if(_0x384a4f[_0x417c('0x4c')]['id']){delete _0x384a4f['body']['id'];}return db[_0x417c('0x2e')]['find']({'where':{'id':_0x384a4f[_0x417c('0x45')]['id']}})[_0x417c('0x26')](handleEntityNotFound(_0x19b001,null))[_0x417c('0x26')](saveUpdates(_0x384a4f[_0x417c('0x4c')],null))[_0x417c('0x26')](respondWithResult(_0x19b001,null))[_0x417c('0x43')](handleError(_0x19b001,null));};exports[_0x417c('0x25')]=function(_0x33db9d,_0x49db00){return db['JscriptyAnswerReport'][_0x417c('0x4a')]({'where':{'id':_0x33db9d['params']['id']}})[_0x417c('0x26')](handleEntityNotFound(_0x49db00,null))[_0x417c('0x26')](removeEntity(_0x49db00,null))[_0x417c('0x43')](handleError(_0x49db00,null));};exports[_0x417c('0x4e')]=function(_0x2abf02,_0xf45c1f){return db[_0x417c('0x2e')]['describe']()[_0x417c('0x26')](respondWithResult(_0xf45c1f,null))['catch'](handleError(_0xf45c1f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 1d9a18b..7b4b227 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 _0xb2c9=['../../config/logger','moment','bluebird','request-promise','path','rimraf','define','JscriptyAnswerReport','lodash','util'];(function(_0x363258,_0x5bd3d6){var _0x107e97=function(_0x2ec868){while(--_0x2ec868){_0x363258['push'](_0x363258['shift']());}};_0x107e97(++_0x5bd3d6);}(_0xb2c9,0x1d4));var _0x9b2c=function(_0x1c1da1,_0x4755d8){_0x1c1da1=_0x1c1da1-0x0;var _0x3c1816=_0xb2c9[_0x1c1da1];return _0x3c1816;};'use strict';var _=require(_0x9b2c('0x0'));var util=require(_0x9b2c('0x1'));var logger=require(_0x9b2c('0x2'))('api');var moment=require(_0x9b2c('0x3'));var BPromise=require(_0x9b2c('0x4'));var rp=require(_0x9b2c('0x5'));var fs=require('fs');var path=require(_0x9b2c('0x6'));var rimraf=require(_0x9b2c('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x5bcb75,_0x46169a){return _0x5bcb75[_0x9b2c('0x8')](_0x9b2c('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cd7=['request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','moment','bluebird'];(function(_0x269013,_0x31a752){var _0x1d7271=function(_0x43db41){while(--_0x43db41){_0x269013['push'](_0x269013['shift']());}};_0x1d7271(++_0x31a752);}(_0x4cd7,0xd4));var _0x74cd=function(_0x2d1e94,_0x17f318){_0x2d1e94=_0x2d1e94-0x0;var _0x27908d=_0x4cd7[_0x2d1e94];return _0x27908d;};'use strict';var _=require('lodash');var util=require(_0x74cd('0x0'));var logger=require(_0x74cd('0x1'))('api');var moment=require(_0x74cd('0x2'));var BPromise=require(_0x74cd('0x3'));var rp=require(_0x74cd('0x4'));var fs=require('fs');var path=require(_0x74cd('0x5'));var rimraf=require(_0x74cd('0x6'));var config=require(_0x74cd('0x7'));var attributes=require(_0x74cd('0x8'));module[_0x74cd('0x9')]=function(_0x330278,_0x7a5fd4){return _0x330278['define'](_0x74cd('0xa'),attributes,{'tableName':_0x74cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 2ca68c3..e2d5afc 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 _0x7f36=['debug','request\x20sent','stringify','error','code','message','info','result','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x7f36,0x1ec));var _0x67f3=function(_0x22eaa9,_0x1b1040){_0x22eaa9=_0x22eaa9-0x0;var _0x36e7b8=_0x7f36[_0x22eaa9];return _0x36e7b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x67f3('0x0'));var BPromise=require(_0x67f3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67f3('0x2'))['db'];var utils=require(_0x67f3('0x3'));var logger=require(_0x67f3('0x4'))('rpc');var config=require(_0x67f3('0x5'));var jayson=require(_0x67f3('0x6'));var client=jayson[_0x67f3('0x7')][_0x67f3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50534c,_0x5bfd12,_0x2878a7){return new BPromise(function(_0x618cd4,_0x573449){return client[_0x67f3('0x9')](_0x50534c,_0x2878a7)[_0x67f3('0xa')](function(_0x45e0bd){logger['info'](_0x67f3('0xb'),_0x5bfd12,'request\x20sent');logger[_0x67f3('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5bfd12,_0x67f3('0xd'),JSON[_0x67f3('0xe')](_0x45e0bd));if(_0x45e0bd[_0x67f3('0xf')]){if(_0x45e0bd[_0x67f3('0xf')][_0x67f3('0x10')]===0x1f4){logger[_0x67f3('0xf')](_0x67f3('0xb'),_0x5bfd12,_0x45e0bd['error'][_0x67f3('0x11')]);return _0x573449(_0x45e0bd['error'][_0x67f3('0x11')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x5bfd12,_0x45e0bd['error'][_0x67f3('0x11')]);return _0x618cd4(_0x45e0bd['error']['message']);}else{logger[_0x67f3('0x12')](_0x67f3('0xb'),_0x5bfd12,_0x67f3('0xd'));_0x618cd4(_0x45e0bd[_0x67f3('0x13')]['message']);}})[_0x67f3('0x14')](function(_0x2a51c0){logger[_0x67f3('0xf')](_0x67f3('0xb'),_0x5bfd12,_0x2a51c0);_0x573449(_0x2a51c0);});});} \ No newline at end of file +var _0x1327=['error','code','message','info','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2dfb25,_0x358b90){var _0x5947a6=function(_0x412cf8){while(--_0x412cf8){_0x2dfb25['push'](_0x2dfb25['shift']());}};_0x5947a6(++_0x358b90);}(_0x1327,0xba));var _0x7132=function(_0x6962d3,_0x5d097e){_0x6962d3=_0x6962d3-0x0;var _0x2b98cd=_0x1327[_0x6962d3];return _0x2b98cd;};'use strict';var _=require('lodash');var util=require(_0x7132('0x0'));var moment=require('moment');var BPromise=require(_0x7132('0x1'));var rs=require(_0x7132('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7132('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7132('0x4'))(_0x7132('0x5'));var config=require('../../config/environment');var jayson=require(_0x7132('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27460e,_0x481db3,_0x1577a){return new BPromise(function(_0x573554,_0x57a73b){return client[_0x7132('0x7')](_0x27460e,_0x1577a)[_0x7132('0x8')](function(_0x5e8d1e){logger['info'](_0x7132('0x9'),_0x481db3,_0x7132('0xa'));logger[_0x7132('0xb')](_0x7132('0xc'),_0x481db3,_0x7132('0xa'),JSON[_0x7132('0xd')](_0x5e8d1e));if(_0x5e8d1e['error']){if(_0x5e8d1e[_0x7132('0xe')][_0x7132('0xf')]===0x1f4){logger[_0x7132('0xe')](_0x7132('0x9'),_0x481db3,_0x5e8d1e[_0x7132('0xe')][_0x7132('0x10')]);return _0x57a73b(_0x5e8d1e['error'][_0x7132('0x10')]);}logger['error'](_0x7132('0x9'),_0x481db3,_0x5e8d1e[_0x7132('0xe')][_0x7132('0x10')]);return _0x573554(_0x5e8d1e['error'][_0x7132('0x10')]);}else{logger[_0x7132('0x11')](_0x7132('0x9'),_0x481db3,_0x7132('0xa'));_0x573554(_0x5e8d1e[_0x7132('0x12')][_0x7132('0x10')]);}})[_0x7132('0x13')](function(_0x335edb){logger[_0x7132('0xe')](_0x7132('0x9'),_0x481db3,_0x335edb);_0x57a73b(_0x335edb);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 43d4801..70435c4 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 _0x87f6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','post','/:id/clone','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x398143,_0x1abacc){var _0x191755=function(_0x28d727){while(--_0x28d727){_0x398143['push'](_0x398143['shift']());}};_0x191755(++_0x1abacc);}(_0x87f6,0x15a));var _0x687f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x87f6[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x687f('0x0'));var util=require(_0x687f('0x1'));var path=require(_0x687f('0x2'));var timeout=require('connect-timeout');var express=require(_0x687f('0x3'));var router=express[_0x687f('0x4')]();var fs_extra=require(_0x687f('0x5'));var auth=require(_0x687f('0x6'));var interaction=require(_0x687f('0x7'));var config=require(_0x687f('0x8'));var controller=require('./jscriptyProject.controller');router[_0x687f('0x9')]('/',auth['isAuthenticated'](),controller[_0x687f('0xa')]);router[_0x687f('0x9')](_0x687f('0xb'),auth[_0x687f('0xc')](),controller['show']);router[_0x687f('0x9')](_0x687f('0xd'),auth[_0x687f('0xc')](),controller[_0x687f('0xe')]);router[_0x687f('0x9')](_0x687f('0xf'),auth[_0x687f('0xc')](),controller[_0x687f('0x10')]);router[_0x687f('0x9')](_0x687f('0x11'),auth[_0x687f('0xc')](),timeout('30s'),controller['getSummary']);router[_0x687f('0x12')]('/',auth[_0x687f('0xc')](),controller['create']);router[_0x687f('0x12')](_0x687f('0x13'),auth[_0x687f('0xc')](),controller['clone']);router[_0x687f('0x14')](_0x687f('0xb'),auth['isAuthenticated'](),controller[_0x687f('0x15')]);router[_0x687f('0x16')](_0x687f('0xb'),auth[_0x687f('0xc')](),controller[_0x687f('0x17')]);module[_0x687f('0x18')]=router; \ No newline at end of file +var _0x02f0=['get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller'];(function(_0x27fadf,_0x2d4ebd){var _0x1731ca=function(_0x1c9c15){while(--_0x1c9c15){_0x27fadf['push'](_0x27fadf['shift']());}};_0x1731ca(++_0x2d4ebd);}(_0x02f0,0xc7));var _0x002f=function(_0x5776b5,_0x4b203f){_0x5776b5=_0x5776b5-0x0;var _0x8a96dd=_0x02f0[_0x5776b5];return _0x8a96dd;};'use strict';var multer=require(_0x002f('0x0'));var util=require('util');var path=require(_0x002f('0x1'));var timeout=require(_0x002f('0x2'));var express=require(_0x002f('0x3'));var router=express[_0x002f('0x4')]();var fs_extra=require(_0x002f('0x5'));var auth=require(_0x002f('0x6'));var interaction=require(_0x002f('0x7'));var config=require('../../config/environment');var controller=require(_0x002f('0x8'));router[_0x002f('0x9')]('/',auth[_0x002f('0xa')](),controller[_0x002f('0xb')]);router[_0x002f('0x9')](_0x002f('0xc'),auth['isAuthenticated'](),controller[_0x002f('0xd')]);router[_0x002f('0x9')](_0x002f('0xe'),auth[_0x002f('0xa')](),controller[_0x002f('0xf')]);router[_0x002f('0x9')](_0x002f('0x10'),auth[_0x002f('0xa')](),controller[_0x002f('0x11')]);router[_0x002f('0x9')]('/:id/summary',auth[_0x002f('0xa')](),timeout(_0x002f('0x12')),controller[_0x002f('0x13')]);router[_0x002f('0x14')]('/',auth[_0x002f('0xa')](),controller[_0x002f('0x15')]);router[_0x002f('0x14')](_0x002f('0x16'),auth[_0x002f('0xa')](),controller['clone']);router['put']('/:id',auth[_0x002f('0xa')](),controller[_0x002f('0x17')]);router[_0x002f('0x18')](_0x002f('0xc'),auth['isAuthenticated'](),controller[_0x002f('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 939ec5d..9e33325 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 _0xc1b2=['name','long','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util','exports','STRING'];(function(_0x621bee,_0x58f8c0){var _0x3076c8=function(_0x228229){while(--_0x228229){_0x621bee['push'](_0x621bee['shift']());}};_0x3076c8(++_0x58f8c0);}(_0xc1b2,0x146));var _0x2c1b=function(_0x503887,_0x97b668){_0x503887=_0x503887-0x0;var _0x2903bf=_0xc1b2[_0x503887];return _0x2903bf;};'use strict';var Sequelize=require('sequelize');var _=require(_0x2c1b('0x0'));var util=require(_0x2c1b('0x1'));module[_0x2c1b('0x2')]={'name':{'type':Sequelize[_0x2c1b('0x3')],'unique':_0x2c1b('0x4')},'description':{'type':Sequelize[_0x2c1b('0x3')]},'formData':{'type':Sequelize['TEXT'](_0x2c1b('0x5')),'set':function(_0x5ba565){if(_['isObjectLike'](_0x5ba565)){this[_0x2c1b('0x6')](_0x2c1b('0x7'),JSON[_0x2c1b('0x8')](_0x5ba565));}else if(_[_0x2c1b('0x9')](_0x5ba565)){this[_0x2c1b('0x6')](_0x2c1b('0x7'),_0x5ba565);}else{this[_0x2c1b('0x6')](_0x2c1b('0x7'),util[_0x2c1b('0xa')](_0x2c1b('0xb'),this[_0x2c1b('0xc')]('name')||'',this[_0x2c1b('0xc')](_0x2c1b('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2c1b('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xf229=['BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','setDataValue','formData','isString','format'];(function(_0x4d3800,_0x554c78){var _0x312aca=function(_0x5653e4){while(--_0x5653e4){_0x4d3800['push'](_0x4d3800['shift']());}};_0x312aca(++_0x554c78);}(_0xf229,0x12a));var _0x9f22=function(_0x40a230,_0x310e3d){_0x40a230=_0x40a230-0x0;var _0x181934=_0xf229[_0x40a230];return _0x181934;};'use strict';var Sequelize=require(_0x9f22('0x0'));var _=require(_0x9f22('0x1'));var util=require(_0x9f22('0x2'));module['exports']={'name':{'type':Sequelize[_0x9f22('0x3')],'unique':_0x9f22('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x9f22('0x5')]('long'),'set':function(_0xb2ac97){if(_['isObjectLike'](_0xb2ac97)){this[_0x9f22('0x6')](_0x9f22('0x7'),JSON['stringify'](_0xb2ac97));}else if(_[_0x9f22('0x8')](_0xb2ac97)){this[_0x9f22('0x6')]('formData',_0xb2ac97);}else{this[_0x9f22('0x6')](_0x9f22('0x7'),util[_0x9f22('0x9')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x9f22('0x4'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x9f22('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index a0c3ae3..e76ff24 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 _0xa8ac=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','JscriptyProject','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','Projects','UserProfileSection','destroy','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','starttime','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','rimraf','zip-dir','request-promise','moment','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x9213a5,_0x5aeddb){var _0x31353c=function(_0x50eaa6){while(--_0x50eaa6){_0x9213a5['push'](_0x9213a5['shift']());}};_0x31353c(++_0x5aeddb);}(_0xa8ac,0xd9));var _0xca8a=function(_0x17dbc7,_0x53c27d){_0x17dbc7=_0x17dbc7-0x0;var _0x5329f6=_0xa8ac[_0x17dbc7];return _0x5329f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca8a('0x0'));var zipdir=require(_0xca8a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca8a('0x2'));var moment=require(_0xca8a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xca8a('0x4'));var path=require('path');var sox=require(_0xca8a('0x5'));var csv=require('to-csv');var ejs=require(_0xca8a('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca8a('0x7'));var squel=require('squel');var crypto=require(_0xca8a('0x8'));var jsforce=require(_0xca8a('0x9'));var deskjs=require(_0xca8a('0xa'));var toCsv=require(_0xca8a('0xb'));var querystring=require(_0xca8a('0xc'));var Papa=require(_0xca8a('0xd'));var Redis=require(_0xca8a('0xe'));var authService=require(_0xca8a('0xf'));var qs=require(_0xca8a('0x10'));var as=require(_0xca8a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca8a('0x12'))('api');var utils=require(_0xca8a('0x13'));var config=require(_0xca8a('0x14'));var licenseUtil=require(_0xca8a('0x15'));var db=require(_0xca8a('0x16'))['db'];function respondWithStatusCode(_0x3efdd3,_0x2fbbcc){_0x2fbbcc=_0x2fbbcc||0xcc;return function(_0x176120){if(_0x176120){return _0x3efdd3[_0xca8a('0x17')](_0x2fbbcc);}return _0x3efdd3[_0xca8a('0x18')](_0x2fbbcc)['end']();};}function respondWithResult(_0x2d7bd2,_0x37eb42){_0x37eb42=_0x37eb42||0xc8;return function(_0x15a35a){if(_0x15a35a){return _0x2d7bd2['status'](_0x37eb42)[_0xca8a('0x19')](_0x15a35a);}};}function respondWithFilteredResult(_0x167d3a,_0x4e8550){return function(_0x5538aa){if(_0x5538aa){var _0x2169fe=typeof _0x4e8550[_0xca8a('0x1a')]===_0xca8a('0x1b')&&typeof _0x4e8550[_0xca8a('0x1c')]===_0xca8a('0x1b');var _0x356bd8=_0x5538aa[_0xca8a('0x1d')];var _0x186b2a=_0x2169fe?0x0:_0x4e8550[_0xca8a('0x1a')];var _0x2d03c8=_0x2169fe?_0x5538aa['count']:_0x4e8550[_0xca8a('0x1a')]+_0x4e8550[_0xca8a('0x1c')];var _0x2052ea;if(_0x2d03c8>=_0x356bd8){_0x2d03c8=_0x356bd8;_0x2052ea=0xc8;}else{_0x2052ea=0xce;}_0x167d3a[_0xca8a('0x18')](_0x2052ea);return _0x167d3a[_0xca8a('0x1e')](_0xca8a('0x1f'),_0x186b2a+'-'+_0x2d03c8+'/'+_0x356bd8)[_0xca8a('0x19')](_0x5538aa);}return null;};}function patchUpdates(_0x7b6bde){return function(_0x62b19c){try{jsonpatch[_0xca8a('0x20')](_0x62b19c,_0x7b6bde,!![]);}catch(_0x335952){return BPromise[_0xca8a('0x21')](_0x335952);}return _0x62b19c[_0xca8a('0x22')]();};}function saveUpdates(_0x382201,_0x30dd86){return function(_0x43879c){if(_0x43879c){return _0x43879c[_0xca8a('0x23')](_0x382201)['then'](function(_0x284fce){return _0x284fce;});}return null;};}function removeEntity(_0x5e7262,_0x20d2a7){return function(_0x4241a4){if(_0x4241a4){return _0x4241a4['destroy']()[_0xca8a('0x24')](function(){var _0x5239e0=_0x4241a4[_0xca8a('0x25')]({'plain':!![]});var _0x297af4='Projects';return db[_0xca8a('0x26')]['destroy']({'where':{'type':_0x297af4,'resourceId':_0x5239e0['id']}})[_0xca8a('0x24')](function(){return _0x4241a4;});})[_0xca8a('0x24')](function(){_0x5e7262['status'](0xcc)[_0xca8a('0x27')]();});}};}function handleEntityNotFound(_0x2f167f,_0x1ae921){return function(_0x5406d4){if(!_0x5406d4){_0x2f167f[_0xca8a('0x17')](0x194);}return _0x5406d4;};}function handleError(_0x54107f,_0x4ca10c){_0x4ca10c=_0x4ca10c||0x1f4;return function(_0xe7285b){logger[_0xca8a('0x28')](_0xe7285b[_0xca8a('0x29')]);if(_0xe7285b[_0xca8a('0x2a')]){delete _0xe7285b[_0xca8a('0x2a')];}_0x54107f[_0xca8a('0x18')](_0x4ca10c)[_0xca8a('0x2b')](_0xe7285b);};}exports[_0xca8a('0x2c')]=function(_0x5caf48,_0x346568){var _0x39ba05={},_0x3317b4={},_0x4685b7={'count':0x0,'rows':[]};var _0x2f67e8=_[_0xca8a('0x2d')](db['JscriptyProject'][_0xca8a('0x2e')],function(_0x185507){return{'name':_0x185507[_0xca8a('0x2f')],'type':_0x185507['type'][_0xca8a('0x30')]};});_0x3317b4[_0xca8a('0x31')]=_[_0xca8a('0x2d')](_0x2f67e8,'name');_0x3317b4[_0xca8a('0x32')]=_[_0xca8a('0x33')](_0x5caf48[_0xca8a('0x32')]);_0x3317b4[_0xca8a('0x34')]=_[_0xca8a('0x35')](_0x3317b4['model'],_0x3317b4['query']);_0x39ba05[_0xca8a('0x36')]=_[_0xca8a('0x35')](_0x3317b4[_0xca8a('0x31')],qs[_0xca8a('0x37')](_0x5caf48[_0xca8a('0x32')][_0xca8a('0x37')]));_0x39ba05[_0xca8a('0x36')]=_0x39ba05['attributes'][_0xca8a('0x38')]?_0x39ba05[_0xca8a('0x36')]:_0x3317b4['model'];if(!_0x5caf48[_0xca8a('0x32')][_0xca8a('0x39')](_0xca8a('0x3a'))){_0x39ba05[_0xca8a('0x1c')]=qs[_0xca8a('0x1c')](_0x5caf48[_0xca8a('0x32')][_0xca8a('0x1c')]);_0x39ba05['offset']=qs[_0xca8a('0x1a')](_0x5caf48['query']['offset']);}_0x39ba05[_0xca8a('0x3b')]=qs[_0xca8a('0x3c')](_0x5caf48[_0xca8a('0x32')][_0xca8a('0x3c')]);_0x39ba05[_0xca8a('0x3d')]=qs[_0xca8a('0x34')](_[_0xca8a('0x3e')](_0x5caf48[_0xca8a('0x32')],_0x3317b4[_0xca8a('0x34')]),_0x2f67e8);if(_0x5caf48[_0xca8a('0x32')][_0xca8a('0x3f')]){_0x39ba05[_0xca8a('0x3d')]=_['merge'](_0x39ba05[_0xca8a('0x3d')],{'$or':_[_0xca8a('0x2d')](_0x2f67e8,function(_0x388f9b){if(_0x388f9b['type']!==_0xca8a('0x40')){var _0x318a7d={};_0x318a7d[_0x388f9b[_0xca8a('0x2a')]]={'$like':'%'+_0x5caf48[_0xca8a('0x32')][_0xca8a('0x3f')]+'%'};return _0x318a7d;}})});}_0x39ba05=_[_0xca8a('0x41')]({},_0x39ba05,_0x5caf48[_0xca8a('0x42')]);var _0x232692={'where':_0x39ba05['where']};return db['JscriptyProject'][_0xca8a('0x1d')](_0x232692)[_0xca8a('0x24')](function(_0x1ad82d){_0x4685b7[_0xca8a('0x1d')]=_0x1ad82d;if(_0x5caf48['query'][_0xca8a('0x43')]){_0x39ba05[_0xca8a('0x44')]=[{'all':!![]}];}return db['JscriptyProject'][_0xca8a('0x45')](_0x39ba05);})[_0xca8a('0x24')](function(_0x263379){_0x4685b7[_0xca8a('0x46')]=_0x263379;return _0x4685b7;})[_0xca8a('0x24')](respondWithFilteredResult(_0x346568,_0x39ba05))[_0xca8a('0x47')](handleError(_0x346568,null));};exports[_0xca8a('0x48')]=function(_0x266085,_0x5c90d0){var _0xe44634={'raw':![],'where':{'id':_0x266085[_0xca8a('0x49')]['id']}},_0x1919dd={};_0x1919dd[_0xca8a('0x31')]=_[_0xca8a('0x33')](db[_0xca8a('0x4a')]['rawAttributes']);_0x1919dd[_0xca8a('0x32')]=_[_0xca8a('0x33')](_0x266085[_0xca8a('0x32')]);_0x1919dd[_0xca8a('0x34')]=_[_0xca8a('0x35')](_0x1919dd['model'],_0x1919dd[_0xca8a('0x32')]);_0xe44634[_0xca8a('0x36')]=_['intersection'](_0x1919dd[_0xca8a('0x31')],qs[_0xca8a('0x37')](_0x266085['query'][_0xca8a('0x37')]));_0xe44634[_0xca8a('0x36')]=_0xe44634[_0xca8a('0x36')][_0xca8a('0x38')]?_0xe44634[_0xca8a('0x36')]:_0x1919dd[_0xca8a('0x31')];if(_0x266085[_0xca8a('0x32')][_0xca8a('0x43')]){_0xe44634[_0xca8a('0x44')]=[{'all':!![]}];}_0xe44634=_[_0xca8a('0x41')]({},_0xe44634,_0x266085[_0xca8a('0x42')]);return db[_0xca8a('0x4a')][_0xca8a('0x4b')](_0xe44634)[_0xca8a('0x24')](handleEntityNotFound(_0x5c90d0,null))[_0xca8a('0x24')](respondWithResult(_0x5c90d0,null))['catch'](handleError(_0x5c90d0,null));};exports[_0xca8a('0x4c')]=function(_0x1ffcd7,_0x281b1f){return db[_0xca8a('0x4a')][_0xca8a('0x4c')](_0x1ffcd7['body'],{})['then'](function(_0x55509f){var _0x3342be=_0x1ffcd7[_0xca8a('0x4d')][_0xca8a('0x25')]({'plain':!![]});if(!_0x3342be)throw new Error(_0xca8a('0x4e'));if(_0x3342be[_0xca8a('0x4f')]===_0xca8a('0x4d')){var _0x40e678=_0x55509f[_0xca8a('0x25')]({'plain':!![]});var _0x540bd2='Projects';return db['UserProfileSection'][_0xca8a('0x4b')]({'where':{'name':_0x540bd2,'userProfileId':_0x3342be[_0xca8a('0x50')]},'raw':!![]})[_0xca8a('0x24')](function(_0x2538bc){if(_0x2538bc&&_0x2538bc['autoAssociation']===0x0){return db[_0xca8a('0x26')][_0xca8a('0x4c')]({'name':_0x40e678[_0xca8a('0x2a')],'resourceId':_0x40e678['id'],'type':_0x2538bc[_0xca8a('0x2a')],'sectionId':_0x2538bc['id']},{})[_0xca8a('0x24')](function(){return _0x55509f;});}else{return _0x55509f;}})[_0xca8a('0x47')](function(_0x54cce9){logger[_0xca8a('0x28')](_0xca8a('0x51'),_0x54cce9);throw _0x54cce9;});}return _0x55509f;})['then'](respondWithResult(_0x281b1f,0xc9))[_0xca8a('0x47')](handleError(_0x281b1f,null));};exports[_0xca8a('0x52')]=function(_0x10e5c8,_0x4e91cf){var _0x309663={'where':{'id':_0x10e5c8[_0xca8a('0x49')]['id']}},_0x2ae12e={};_0x2ae12e[_0xca8a('0x31')]=_['keys'](db[_0xca8a('0x4a')][_0xca8a('0x2e')]);_0x309663['attributes']=_[_0xca8a('0x35')](_0x2ae12e[_0xca8a('0x31')],qs[_0xca8a('0x37')](_0x10e5c8[_0xca8a('0x32')][_0xca8a('0x37')]));_0x309663[_0xca8a('0x36')]=_0x309663['attributes'][_0xca8a('0x38')]?_0x309663[_0xca8a('0x36')]:_0x2ae12e[_0xca8a('0x31')];if(_0x10e5c8['query'][_0xca8a('0x43')]){_0x309663['include']=[{'all':!![]}];}_0x309663=_[_0xca8a('0x41')]({},_0x309663,_0x10e5c8['options']);return db[_0xca8a('0x4a')]['find'](_0x309663)[_0xca8a('0x24')](handleEntityNotFound(_0x4e91cf,null))['then'](function(_0x3f6af4){if(_0x3f6af4){var _0x2f04e8=_0x3f6af4[_0xca8a('0x25')]({'plain':!![]});_0x2f04e8=qs[_0xca8a('0x53')](_0x2f04e8,['id',_0xca8a('0x54'),'updatedAt']);_0x10e5c8['body']=_[_0xca8a('0x53')](_0x10e5c8[_0xca8a('0x55')],['id',_0xca8a('0x54'),_0xca8a('0x56')]);return db[_0xca8a('0x4a')][_0xca8a('0x4c')](_['merge'](_0x2f04e8,_0x10e5c8[_0xca8a('0x55')]),{'include':_0x10e5c8[_0xca8a('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0xca8a('0x24')](function(_0xc44737){var _0x43c9b3=_0x10e5c8[_0xca8a('0x4d')][_0xca8a('0x25')]({'plain':!![]});if(!_0x43c9b3)throw new Error(_0xca8a('0x4e'));if(_0x43c9b3[_0xca8a('0x4f')]===_0xca8a('0x4d')){var _0x5bafc7=_0xc44737[_0xca8a('0x25')]({'plain':!![]});var _0x10d0d5=_0xca8a('0x57');return db[_0xca8a('0x58')][_0xca8a('0x4b')]({'where':{'name':_0x10d0d5,'userProfileId':_0x43c9b3['userProfileId']},'raw':!![]})['then'](function(_0x36a7c5){if(_0x36a7c5&&_0x36a7c5['autoAssociation']===0x0){return db['UserProfileResource'][_0xca8a('0x4c')]({'name':_0x5bafc7['name'],'resourceId':_0x5bafc7['id'],'type':_0x36a7c5[_0xca8a('0x2a')],'sectionId':_0x36a7c5['id']},{})['then'](function(){return _0xc44737;});}else{return _0xc44737;}})['catch'](function(_0x51c376){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51c376);throw _0x51c376;});}return _0xc44737;});}})[_0xca8a('0x24')](respondWithResult(_0x4e91cf,0xc9))[_0xca8a('0x47')](handleError(_0x4e91cf,null));};exports[_0xca8a('0x23')]=function(_0x2e324f,_0x328df2){if(_0x2e324f[_0xca8a('0x55')]['id']){delete _0x2e324f[_0xca8a('0x55')]['id'];}return db[_0xca8a('0x4a')][_0xca8a('0x4b')]({'where':{'id':_0x2e324f[_0xca8a('0x49')]['id']}})[_0xca8a('0x24')](handleEntityNotFound(_0x328df2,null))[_0xca8a('0x24')](saveUpdates(_0x2e324f[_0xca8a('0x55')],null))[_0xca8a('0x24')](respondWithResult(_0x328df2,null))[_0xca8a('0x47')](handleError(_0x328df2,null));};exports[_0xca8a('0x59')]=function(_0x2ffc19,_0x4af5a6){return db[_0xca8a('0x4a')][_0xca8a('0x4b')]({'where':{'id':_0x2ffc19['params']['id']}})['then'](handleEntityNotFound(_0x4af5a6,null))[_0xca8a('0x24')](removeEntity(_0x4af5a6,null))[_0xca8a('0x47')](handleError(_0x4af5a6,null));};exports[_0xca8a('0x5a')]=function(_0x118aa0,_0x1186e8,_0x476eb4){var _0x16354a={'raw':!![],'where':{}};var _0x11da14={};var _0x6382e1={'count':0x0,'rows':[]};return db[_0xca8a('0x4a')][_0xca8a('0x5b')]({'where':{'id':_0x118aa0[_0xca8a('0x49')]['id']}})['then'](handleEntityNotFound(_0x1186e8,null))[_0xca8a('0x24')](function(_0x5bbc90){if(_0x5bbc90){_0x11da14['model']=_[_0xca8a('0x33')](db[_0xca8a('0x5c')][_0xca8a('0x2e')]);_0x11da14[_0xca8a('0x32')]=_['keys'](_0x118aa0[_0xca8a('0x32')]);_0x11da14[_0xca8a('0x34')]=_['intersection'](_0x11da14[_0xca8a('0x31')],_0x11da14[_0xca8a('0x32')]);_0x16354a[_0xca8a('0x36')]=_[_0xca8a('0x35')](_0x11da14[_0xca8a('0x31')],qs[_0xca8a('0x37')](_0x118aa0[_0xca8a('0x32')][_0xca8a('0x37')]));_0x16354a[_0xca8a('0x36')]=_0x16354a[_0xca8a('0x36')][_0xca8a('0x38')]?_0x16354a[_0xca8a('0x36')]:_0x11da14[_0xca8a('0x31')];if(!_0x118aa0[_0xca8a('0x32')]['hasOwnProperty']('nolimit')){_0x16354a['limit']=qs[_0xca8a('0x1c')](_0x118aa0[_0xca8a('0x32')][_0xca8a('0x1c')]);_0x16354a[_0xca8a('0x1a')]=qs[_0xca8a('0x1a')](_0x118aa0['query'][_0xca8a('0x1a')]);}_0x16354a['order']=qs[_0xca8a('0x3c')](_0x118aa0[_0xca8a('0x32')][_0xca8a('0x3c')]);_0x16354a[_0xca8a('0x3d')]=qs[_0xca8a('0x34')](_[_0xca8a('0x3e')](_0x118aa0[_0xca8a('0x32')],_0x11da14[_0xca8a('0x34')]));_0x16354a[_0xca8a('0x3d')][_0xca8a('0x5d')]=_0x5bbc90['id'];if(_0x118aa0[_0xca8a('0x32')]['filter']){_0x16354a[_0xca8a('0x3d')]=_[_0xca8a('0x41')](_0x16354a[_0xca8a('0x3d')],{'$or':_[_0xca8a('0x2d')](_0x16354a['attributes'],function(_0x2b1e95){var _0x3af9a6={};_0x3af9a6[_0x2b1e95]={'$like':'%'+_0x118aa0[_0xca8a('0x32')]['filter']+'%'};return _0x3af9a6;})});}_0x16354a=_[_0xca8a('0x41')]({},_0x16354a,_0x118aa0['options']);return db[_0xca8a('0x5c')][_0xca8a('0x1d')]({'where':_0x16354a['where']})[_0xca8a('0x24')](function(_0x30f9ea){_0x6382e1[_0xca8a('0x1d')]=_0x30f9ea;if(_0x118aa0[_0xca8a('0x32')]['includeAll']){_0x16354a[_0xca8a('0x44')]=[{'all':!![]}];}return db[_0xca8a('0x5c')][_0xca8a('0x45')](_0x16354a);})['then'](function(_0x9dc7a5){_0x6382e1['rows']=_0x9dc7a5;return _0x6382e1;});}})['then'](respondWithFilteredResult(_0x1186e8,_0x16354a))['catch'](handleError(_0x1186e8,null));};exports[_0xca8a('0x5e')]=function(_0x19ac9c,_0x532d2f,_0x26108c){var _0x4ca901={'raw':!![],'where':{}};var _0x1479de={};var _0xcd7671={'count':0x0,'rows':[]};return db[_0xca8a('0x4a')][_0xca8a('0x5b')]({'where':{'id':_0x19ac9c['params']['id']}})[_0xca8a('0x24')](handleEntityNotFound(_0x532d2f,null))[_0xca8a('0x24')](function(_0x1ffaae){if(_0x1ffaae){_0x1479de['model']=_[_0xca8a('0x33')](db['JscriptyAnswerReport'][_0xca8a('0x2e')]);_0x1479de[_0xca8a('0x32')]=_[_0xca8a('0x33')](_0x19ac9c[_0xca8a('0x32')]);_0x1479de[_0xca8a('0x34')]=_[_0xca8a('0x35')](_0x1479de['model'],_0x1479de['query']);_0x4ca901['attributes']=_[_0xca8a('0x35')](_0x1479de[_0xca8a('0x31')],qs[_0xca8a('0x37')](_0x19ac9c[_0xca8a('0x32')][_0xca8a('0x37')]));_0x4ca901[_0xca8a('0x36')]=_0x4ca901['attributes'][_0xca8a('0x38')]?_0x4ca901[_0xca8a('0x36')]:_0x1479de['model'];if(!_0x19ac9c[_0xca8a('0x32')]['hasOwnProperty']('nolimit')){_0x4ca901[_0xca8a('0x1c')]=qs['limit'](_0x19ac9c[_0xca8a('0x32')][_0xca8a('0x1c')]);_0x4ca901['offset']=qs[_0xca8a('0x1a')](_0x19ac9c[_0xca8a('0x32')]['offset']);}_0x4ca901[_0xca8a('0x3b')]=qs[_0xca8a('0x3c')](_0x19ac9c[_0xca8a('0x32')]['sort']);_0x4ca901[_0xca8a('0x3d')]=qs['filters'](_[_0xca8a('0x3e')](_0x19ac9c[_0xca8a('0x32')],_0x1479de['filters']));_0x4ca901['where']['ProjectId']=_0x1ffaae['id'];if(_0x19ac9c[_0xca8a('0x32')][_0xca8a('0x3f')]){_0x4ca901[_0xca8a('0x3d')]=_[_0xca8a('0x41')](_0x4ca901[_0xca8a('0x3d')],{'$or':_[_0xca8a('0x2d')](_0x4ca901['attributes'],function(_0xcddc3d){var _0x383375={};_0x383375[_0xcddc3d]={'$like':'%'+_0x19ac9c['query'][_0xca8a('0x3f')]+'%'};return _0x383375;})});}_0x4ca901=_['merge']({},_0x4ca901,_0x19ac9c[_0xca8a('0x42')]);return db[_0xca8a('0x5f')][_0xca8a('0x1d')]({'where':_0x4ca901[_0xca8a('0x3d')]})['then'](function(_0x855671){_0xcd7671[_0xca8a('0x1d')]=_0x855671;if(_0x19ac9c['query']['includeAll']){_0x4ca901[_0xca8a('0x44')]=[{'all':!![]}];}return db[_0xca8a('0x5f')][_0xca8a('0x45')](_0x4ca901);})['then'](function(_0x4b1045){_0xcd7671['rows']=_0x4b1045;return _0xcd7671;});}})[_0xca8a('0x24')](respondWithFilteredResult(_0x532d2f,_0x4ca901))[_0xca8a('0x47')](handleError(_0x532d2f,null));};function char(_0x4fd10b){return _0xca8a('0x60')===typeof _0x4fd10b?String[_0xca8a('0x61')][_0xca8a('0x20')](null,arguments):_0x4fd10b;}function needsEncapsulation(_0x1380f7){return!!_0x1380f7&&(_0x1380f7[_0xca8a('0x62')]()[_0xca8a('0x63')](char(0xd))>=0x0||_0x1380f7['toString']()[_0xca8a('0x63')](char(0xa))>=0x0||_0x1380f7[_0xca8a('0x62')]()[_0xca8a('0x63')](char(0x2c))>=0x0||_0x1380f7[_0xca8a('0x62')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x291704){var _0x35cec8=char(0x22),_0x12fb68='\x5c'+char(0x22),_0x7299d8=_0x291704[_0xca8a('0x62')]()['replace'](new RegExp(_0x35cec8,'g'),_0x12fb68);return _0x35cec8+_0x7299d8+_0x35cec8;}exports[_0xca8a('0x64')]=function(_0x3fc287,_0x3cada6,_0x5cddb3){var _0x111995,_0x3e64b9;var _0x46472a={'where':{'ProjectId':_0x3fc287[_0xca8a('0x49')]['id']}};if(_0x3fc287[_0xca8a('0x32')]['startTime']){_0x46472a[_0xca8a('0x3d')][_0xca8a('0x65')]=JSON['parse'](_0x3fc287[_0xca8a('0x32')][_0xca8a('0x66')]);}return db[_0xca8a('0x5c')][_0xca8a('0x45')](_0x46472a)[_0xca8a('0x24')](handleEntityNotFound(_0x3cada6,null))[_0xca8a('0x24')](function(_0x5c3e83){if(_0x5c3e83){_0x111995=_0x5c3e83;return db[_0xca8a('0x67')][_0xca8a('0x45')]({'where':{'SessionId':{'$in':_['map'](_0x111995,'id')},'ProjectId':_0x3fc287[_0xca8a('0x49')]['id']},'order':_0xca8a('0x68')});}})[_0xca8a('0x24')](handleEntityNotFound(_0x3cada6,null))[_0xca8a('0x24')](function(_0x4c463a){if(_0x4c463a){_0x3e64b9=_0x4c463a;var _0x4d3d1b={};for(var _0x1825ce=0x0,_0x397413=_0x3e64b9[_0xca8a('0x38')];_0x1825ce<_0x397413;_0x1825ce++){if(!_0x4d3d1b[_0xca8a('0x39')](_0x3e64b9[_0x1825ce][_0xca8a('0x69')])){_0x4d3d1b[_0x3e64b9[_0x1825ce]['questionId']]=needsEncapsulation(_0x3e64b9[_0x1825ce][_0xca8a('0x6a')])?encapsulate(_0x3e64b9[_0x1825ce][_0xca8a('0x6a')]):_0x3e64b9[_0x1825ce]['question'];}}var _0x1a0a72=[],_0xf77ac1={};for(var _0x162388=0x0,_0x371886=_0x111995[_0xca8a('0x38')];_0x162388<_0x371886;_0x162388++){_0xf77ac1={'ProjectId':_0x3fc287[_0xca8a('0x49')]['id'],'SessionId':_0x111995[_0x162388]['id'],'StartTime':moment(_0x111995[_0x162388]['starttime'])[_0xca8a('0x6b')](_0xca8a('0x6c'))};for(var _0x58231c=0x0,_0x1d6c8c=_0x3e64b9[_0xca8a('0x38')];_0x58231c<_0x1d6c8c;_0x58231c++){if(_0x3e64b9[_0x58231c][_0xca8a('0x6d')]==_0x111995[_0x162388]['id']&&_0x4d3d1b[_0xca8a('0x39')](_0x3e64b9[_0x58231c][_0xca8a('0x69')])){_0xf77ac1[_0x4d3d1b[_0x3e64b9[_0x58231c][_0xca8a('0x69')]]]=_0x3e64b9[_0x58231c][_0xca8a('0x6e')];}}for(var _0x3b0774 in _0x4d3d1b){if(!_0xf77ac1[_0xca8a('0x39')](_0x4d3d1b[_0x3b0774])){_0xf77ac1[_0x4d3d1b[_0x3b0774]]=null;}}_0x1a0a72[_0xca8a('0x6f')](_0xf77ac1);}return _0x1a0a72;}})['then'](function(_0xf9d1cd){if(!_[_0xca8a('0x70')](_0xf9d1cd)){var _0x4cf137=toCsv(_0xf9d1cd);var _0xb1dca9=Date[_0xca8a('0x71')]();fs[_0xca8a('0x72')](util[_0xca8a('0x6b')](_0xca8a('0x73'),_0x3fc287[_0xca8a('0x49')]['id'],_0xb1dca9),_0x4cf137);_0x3cada6['setHeader']('Content-disposition','attachment;\x20filename='+util['format'](_0xca8a('0x74'),_0x3fc287[_0xca8a('0x49')]['id'],_0xb1dca9));_0x3cada6[_0xca8a('0x75')](_0xca8a('0x76'),_0xca8a('0x77'));return _0x3cada6[_0xca8a('0x78')](util['format'](_0xca8a('0x73'),_0x3fc287['params']['id'],_0xb1dca9));}else{return _0x3cada6[_0xca8a('0x17')](0xcc);}})[_0xca8a('0x47')](handleError(_0x3cada6,null));}; \ No newline at end of file +var _0xd070=['apply','toString','indexOf','replace','startTime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','Projects','destroy','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','then','findAll','catch','show','params','length','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileResource','error','clone','omit','createdAt','updatedAt','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','findOne','JscriptySessionReport','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode'];(function(_0x282694,_0x316486){var _0x2146e2=function(_0x207301){while(--_0x207301){_0x282694['push'](_0x282694['shift']());}};_0x2146e2(++_0x316486);}(_0xd070,0x8e));var _0x0d07=function(_0x56b8b1,_0x239c08){_0x56b8b1=_0x56b8b1-0x0;var _0x4be3f8=_0xd070[_0x56b8b1];return _0x4be3f8;};'use strict';var emlformat=require(_0x0d07('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d07('0x1'));var jsonpatch=require(_0x0d07('0x2'));var rp=require(_0x0d07('0x3'));var moment=require(_0x0d07('0x4'));var BPromise=require(_0x0d07('0x5'));var Mustache=require(_0x0d07('0x6'));var util=require(_0x0d07('0x7'));var path=require(_0x0d07('0x8'));var sox=require(_0x0d07('0x9'));var csv=require(_0x0d07('0xa'));var ejs=require(_0x0d07('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d07('0xc'));var squel=require('squel');var crypto=require(_0x0d07('0xd'));var jsforce=require(_0x0d07('0xe'));var deskjs=require(_0x0d07('0xf'));var toCsv=require(_0x0d07('0xa'));var querystring=require(_0x0d07('0x10'));var Papa=require(_0x0d07('0x11'));var Redis=require(_0x0d07('0x12'));var authService=require(_0x0d07('0x13'));var qs=require(_0x0d07('0x14'));var as=require(_0x0d07('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0d07('0x16'));var utils=require(_0x0d07('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0d07('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14f46d,_0xe73ad0){_0xe73ad0=_0xe73ad0||0xcc;return function(_0x5c4ea8){if(_0x5c4ea8){return _0x14f46d[_0x0d07('0x19')](_0xe73ad0);}return _0x14f46d[_0x0d07('0x1a')](_0xe73ad0)[_0x0d07('0x1b')]();};}function respondWithResult(_0x1eb6ba,_0x334556){_0x334556=_0x334556||0xc8;return function(_0x3ac960){if(_0x3ac960){return _0x1eb6ba['status'](_0x334556)[_0x0d07('0x1c')](_0x3ac960);}};}function respondWithFilteredResult(_0x5b91c0,_0x5b0749){return function(_0x332266){if(_0x332266){var _0x403719=typeof _0x5b0749[_0x0d07('0x1d')]===_0x0d07('0x1e')&&typeof _0x5b0749[_0x0d07('0x1f')]==='undefined';var _0x50cc30=_0x332266['count'];var _0x187df2=_0x403719?0x0:_0x5b0749[_0x0d07('0x1d')];var _0x52cb4b=_0x403719?_0x332266[_0x0d07('0x20')]:_0x5b0749['offset']+_0x5b0749[_0x0d07('0x1f')];var _0x5bacd5;if(_0x52cb4b>=_0x50cc30){_0x52cb4b=_0x50cc30;_0x5bacd5=0xc8;}else{_0x5bacd5=0xce;}_0x5b91c0['status'](_0x5bacd5);return _0x5b91c0[_0x0d07('0x21')]('Content-Range',_0x187df2+'-'+_0x52cb4b+'/'+_0x50cc30)[_0x0d07('0x1c')](_0x332266);}return null;};}function patchUpdates(_0x54790f){return function(_0x3781f3){try{jsonpatch['apply'](_0x3781f3,_0x54790f,!![]);}catch(_0x51da24){return BPromise[_0x0d07('0x22')](_0x51da24);}return _0x3781f3[_0x0d07('0x23')]();};}function saveUpdates(_0x8d9823,_0x57e997){return function(_0x96853e){if(_0x96853e){return _0x96853e['update'](_0x8d9823)['then'](function(_0x396ae0){return _0x396ae0;});}return null;};}function removeEntity(_0x14a160,_0xd42245){return function(_0x19f82f){if(_0x19f82f){return _0x19f82f['destroy']()['then'](function(){var _0x9d9bfd=_0x19f82f['get']({'plain':!![]});var _0x43c7ac=_0x0d07('0x24');return db['UserProfileResource'][_0x0d07('0x25')]({'where':{'type':_0x43c7ac,'resourceId':_0x9d9bfd['id']}})['then'](function(){return _0x19f82f;});})['then'](function(){_0x14a160['status'](0xcc)[_0x0d07('0x1b')]();});}};}function handleEntityNotFound(_0x3f09c7,_0x423b3a){return function(_0x25633b){if(!_0x25633b){_0x3f09c7[_0x0d07('0x19')](0x194);}return _0x25633b;};}function handleError(_0x3fdfa9,_0x116f6e){_0x116f6e=_0x116f6e||0x1f4;return function(_0x127552){logger['error'](_0x127552['stack']);if(_0x127552[_0x0d07('0x26')]){delete _0x127552[_0x0d07('0x26')];}_0x3fdfa9[_0x0d07('0x1a')](_0x116f6e)[_0x0d07('0x27')](_0x127552);};}exports[_0x0d07('0x28')]=function(_0xb7d4d,_0xf8b3fd){var _0x314916={},_0x240dc0={},_0xa0c281={'count':0x0,'rows':[]};var _0x3d0663=_[_0x0d07('0x29')](db[_0x0d07('0x2a')][_0x0d07('0x2b')],function(_0x13e434){return{'name':_0x13e434[_0x0d07('0x2c')],'type':_0x13e434[_0x0d07('0x2d')][_0x0d07('0x2e')]};});_0x240dc0['model']=_['map'](_0x3d0663,'name');_0x240dc0[_0x0d07('0x2f')]=_[_0x0d07('0x30')](_0xb7d4d['query']);_0x240dc0[_0x0d07('0x31')]=_[_0x0d07('0x32')](_0x240dc0[_0x0d07('0x33')],_0x240dc0[_0x0d07('0x2f')]);_0x314916['attributes']=_[_0x0d07('0x32')](_0x240dc0['model'],qs[_0x0d07('0x34')](_0xb7d4d['query']['fields']));_0x314916[_0x0d07('0x35')]=_0x314916['attributes']['length']?_0x314916[_0x0d07('0x35')]:_0x240dc0[_0x0d07('0x33')];if(!_0xb7d4d[_0x0d07('0x2f')][_0x0d07('0x36')](_0x0d07('0x37'))){_0x314916['limit']=qs['limit'](_0xb7d4d['query'][_0x0d07('0x1f')]);_0x314916[_0x0d07('0x1d')]=qs[_0x0d07('0x1d')](_0xb7d4d[_0x0d07('0x2f')][_0x0d07('0x1d')]);}_0x314916[_0x0d07('0x38')]=qs[_0x0d07('0x39')](_0xb7d4d[_0x0d07('0x2f')][_0x0d07('0x39')]);_0x314916['where']=qs['filters'](_[_0x0d07('0x3a')](_0xb7d4d[_0x0d07('0x2f')],_0x240dc0[_0x0d07('0x31')]),_0x3d0663);if(_0xb7d4d[_0x0d07('0x2f')][_0x0d07('0x3b')]){_0x314916['where']=_[_0x0d07('0x3c')](_0x314916['where'],{'$or':_[_0x0d07('0x29')](_0x3d0663,function(_0x284420){if(_0x284420[_0x0d07('0x2d')]!==_0x0d07('0x3d')){var _0x28f414={};_0x28f414[_0x284420[_0x0d07('0x26')]]={'$like':'%'+_0xb7d4d[_0x0d07('0x2f')]['filter']+'%'};return _0x28f414;}})});}_0x314916=_[_0x0d07('0x3c')]({},_0x314916,_0xb7d4d[_0x0d07('0x3e')]);var _0xcaf191={'where':_0x314916[_0x0d07('0x3f')]};return db[_0x0d07('0x2a')][_0x0d07('0x20')](_0xcaf191)[_0x0d07('0x40')](function(_0xd44143){_0xa0c281['count']=_0xd44143;if(_0xb7d4d[_0x0d07('0x2f')]['includeAll']){_0x314916['include']=[{'all':!![]}];}return db[_0x0d07('0x2a')][_0x0d07('0x41')](_0x314916);})[_0x0d07('0x40')](function(_0x2ffaf5){_0xa0c281['rows']=_0x2ffaf5;return _0xa0c281;})['then'](respondWithFilteredResult(_0xf8b3fd,_0x314916))[_0x0d07('0x42')](handleError(_0xf8b3fd,null));};exports[_0x0d07('0x43')]=function(_0x1d88e4,_0x5a4a74){var _0x259354={'raw':![],'where':{'id':_0x1d88e4[_0x0d07('0x44')]['id']}},_0x4b3ea2={};_0x4b3ea2[_0x0d07('0x33')]=_[_0x0d07('0x30')](db['JscriptyProject'][_0x0d07('0x2b')]);_0x4b3ea2[_0x0d07('0x2f')]=_['keys'](_0x1d88e4[_0x0d07('0x2f')]);_0x4b3ea2[_0x0d07('0x31')]=_[_0x0d07('0x32')](_0x4b3ea2[_0x0d07('0x33')],_0x4b3ea2[_0x0d07('0x2f')]);_0x259354['attributes']=_['intersection'](_0x4b3ea2['model'],qs[_0x0d07('0x34')](_0x1d88e4[_0x0d07('0x2f')]['fields']));_0x259354['attributes']=_0x259354[_0x0d07('0x35')][_0x0d07('0x45')]?_0x259354[_0x0d07('0x35')]:_0x4b3ea2['model'];if(_0x1d88e4[_0x0d07('0x2f')][_0x0d07('0x46')]){_0x259354[_0x0d07('0x47')]=[{'all':!![]}];}_0x259354=_[_0x0d07('0x3c')]({},_0x259354,_0x1d88e4['options']);return db[_0x0d07('0x2a')][_0x0d07('0x48')](_0x259354)[_0x0d07('0x40')](handleEntityNotFound(_0x5a4a74,null))[_0x0d07('0x40')](respondWithResult(_0x5a4a74,null))[_0x0d07('0x42')](handleError(_0x5a4a74,null));};exports[_0x0d07('0x49')]=function(_0x40f8b6,_0x5729e5){return db[_0x0d07('0x2a')][_0x0d07('0x49')](_0x40f8b6[_0x0d07('0x4a')],{})[_0x0d07('0x40')](function(_0x1bcd59){var _0x1c5712=_0x40f8b6[_0x0d07('0x4b')][_0x0d07('0x4c')]({'plain':!![]});if(!_0x1c5712)throw new Error(_0x0d07('0x4d'));if(_0x1c5712[_0x0d07('0x4e')]===_0x0d07('0x4b')){var _0x373573=_0x1bcd59['get']({'plain':!![]});var _0x735c6d='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x735c6d,'userProfileId':_0x1c5712['userProfileId']},'raw':!![]})[_0x0d07('0x40')](function(_0x38454f){if(_0x38454f&&_0x38454f['autoAssociation']===0x0){return db[_0x0d07('0x4f')][_0x0d07('0x49')]({'name':_0x373573['name'],'resourceId':_0x373573['id'],'type':_0x38454f[_0x0d07('0x26')],'sectionId':_0x38454f['id']},{})['then'](function(){return _0x1bcd59;});}else{return _0x1bcd59;}})[_0x0d07('0x42')](function(_0x2ca1df){logger[_0x0d07('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca1df);throw _0x2ca1df;});}return _0x1bcd59;})[_0x0d07('0x40')](respondWithResult(_0x5729e5,0xc9))[_0x0d07('0x42')](handleError(_0x5729e5,null));};exports[_0x0d07('0x51')]=function(_0x251503,_0xeb7d99){var _0x2a4caf={'where':{'id':_0x251503[_0x0d07('0x44')]['id']}},_0x580522={};_0x580522[_0x0d07('0x33')]=_[_0x0d07('0x30')](db[_0x0d07('0x2a')][_0x0d07('0x2b')]);_0x2a4caf[_0x0d07('0x35')]=_[_0x0d07('0x32')](_0x580522[_0x0d07('0x33')],qs[_0x0d07('0x34')](_0x251503[_0x0d07('0x2f')][_0x0d07('0x34')]));_0x2a4caf[_0x0d07('0x35')]=_0x2a4caf[_0x0d07('0x35')][_0x0d07('0x45')]?_0x2a4caf[_0x0d07('0x35')]:_0x580522[_0x0d07('0x33')];if(_0x251503[_0x0d07('0x2f')][_0x0d07('0x46')]){_0x2a4caf[_0x0d07('0x47')]=[{'all':!![]}];}_0x2a4caf=_[_0x0d07('0x3c')]({},_0x2a4caf,_0x251503[_0x0d07('0x3e')]);return db[_0x0d07('0x2a')][_0x0d07('0x48')](_0x2a4caf)[_0x0d07('0x40')](handleEntityNotFound(_0xeb7d99,null))[_0x0d07('0x40')](function(_0x516ca2){if(_0x516ca2){var _0x1f294c=_0x516ca2[_0x0d07('0x4c')]({'plain':!![]});_0x1f294c=qs[_0x0d07('0x52')](_0x1f294c,['id',_0x0d07('0x53'),'updatedAt']);_0x251503['body']=_['omit'](_0x251503['body'],['id',_0x0d07('0x53'),_0x0d07('0x54')]);return db[_0x0d07('0x2a')][_0x0d07('0x49')](_[_0x0d07('0x3c')](_0x1f294c,_0x251503[_0x0d07('0x4a')]),{'include':_0x251503[_0x0d07('0x2f')][_0x0d07('0x46')]?[{'all':!![]}]:undefined})[_0x0d07('0x40')](function(_0x29497c){var _0x2ad6c9=_0x251503[_0x0d07('0x4b')][_0x0d07('0x4c')]({'plain':!![]});if(!_0x2ad6c9)throw new Error(_0x0d07('0x4d'));if(_0x2ad6c9[_0x0d07('0x4e')]===_0x0d07('0x4b')){var _0x167548=_0x29497c[_0x0d07('0x4c')]({'plain':!![]});var _0xf798bd=_0x0d07('0x24');return db[_0x0d07('0x55')][_0x0d07('0x48')]({'where':{'name':_0xf798bd,'userProfileId':_0x2ad6c9[_0x0d07('0x56')]},'raw':!![]})[_0x0d07('0x40')](function(_0x5ae95a){if(_0x5ae95a&&_0x5ae95a['autoAssociation']===0x0){return db[_0x0d07('0x4f')][_0x0d07('0x49')]({'name':_0x167548[_0x0d07('0x26')],'resourceId':_0x167548['id'],'type':_0x5ae95a['name'],'sectionId':_0x5ae95a['id']},{})[_0x0d07('0x40')](function(){return _0x29497c;});}else{return _0x29497c;}})[_0x0d07('0x42')](function(_0x50f22c){logger[_0x0d07('0x50')](_0x0d07('0x57'),_0x50f22c);throw _0x50f22c;});}return _0x29497c;});}})[_0x0d07('0x40')](respondWithResult(_0xeb7d99,0xc9))[_0x0d07('0x42')](handleError(_0xeb7d99,null));};exports[_0x0d07('0x58')]=function(_0x324e0d,_0x211993){if(_0x324e0d[_0x0d07('0x4a')]['id']){delete _0x324e0d['body']['id'];}return db[_0x0d07('0x2a')]['find']({'where':{'id':_0x324e0d[_0x0d07('0x44')]['id']}})[_0x0d07('0x40')](handleEntityNotFound(_0x211993,null))[_0x0d07('0x40')](saveUpdates(_0x324e0d[_0x0d07('0x4a')],null))[_0x0d07('0x40')](respondWithResult(_0x211993,null))[_0x0d07('0x42')](handleError(_0x211993,null));};exports[_0x0d07('0x25')]=function(_0xc26525,_0x3be0d6){return db[_0x0d07('0x2a')][_0x0d07('0x48')]({'where':{'id':_0xc26525[_0x0d07('0x44')]['id']}})[_0x0d07('0x40')](handleEntityNotFound(_0x3be0d6,null))['then'](removeEntity(_0x3be0d6,null))['catch'](handleError(_0x3be0d6,null));};exports[_0x0d07('0x59')]=function(_0x1d09b7,_0x34ca0e,_0x315d7f){var _0x40d2dd={'raw':!![],'where':{}};var _0x68387b={};var _0x175823={'count':0x0,'rows':[]};return db[_0x0d07('0x2a')][_0x0d07('0x5a')]({'where':{'id':_0x1d09b7[_0x0d07('0x44')]['id']}})['then'](handleEntityNotFound(_0x34ca0e,null))[_0x0d07('0x40')](function(_0x55939f){if(_0x55939f){_0x68387b[_0x0d07('0x33')]=_[_0x0d07('0x30')](db[_0x0d07('0x5b')][_0x0d07('0x2b')]);_0x68387b['query']=_[_0x0d07('0x30')](_0x1d09b7[_0x0d07('0x2f')]);_0x68387b[_0x0d07('0x31')]=_[_0x0d07('0x32')](_0x68387b[_0x0d07('0x33')],_0x68387b[_0x0d07('0x2f')]);_0x40d2dd[_0x0d07('0x35')]=_[_0x0d07('0x32')](_0x68387b[_0x0d07('0x33')],qs['fields'](_0x1d09b7['query'][_0x0d07('0x34')]));_0x40d2dd[_0x0d07('0x35')]=_0x40d2dd[_0x0d07('0x35')][_0x0d07('0x45')]?_0x40d2dd[_0x0d07('0x35')]:_0x68387b[_0x0d07('0x33')];if(!_0x1d09b7[_0x0d07('0x2f')][_0x0d07('0x36')](_0x0d07('0x37'))){_0x40d2dd['limit']=qs[_0x0d07('0x1f')](_0x1d09b7[_0x0d07('0x2f')][_0x0d07('0x1f')]);_0x40d2dd[_0x0d07('0x1d')]=qs[_0x0d07('0x1d')](_0x1d09b7[_0x0d07('0x2f')]['offset']);}_0x40d2dd[_0x0d07('0x38')]=qs[_0x0d07('0x39')](_0x1d09b7[_0x0d07('0x2f')][_0x0d07('0x39')]);_0x40d2dd[_0x0d07('0x3f')]=qs[_0x0d07('0x31')](_['pick'](_0x1d09b7[_0x0d07('0x2f')],_0x68387b[_0x0d07('0x31')]));_0x40d2dd[_0x0d07('0x3f')][_0x0d07('0x5c')]=_0x55939f['id'];if(_0x1d09b7[_0x0d07('0x2f')]['filter']){_0x40d2dd['where']=_[_0x0d07('0x3c')](_0x40d2dd['where'],{'$or':_[_0x0d07('0x29')](_0x40d2dd[_0x0d07('0x35')],function(_0x5552f){var _0x457c69={};_0x457c69[_0x5552f]={'$like':'%'+_0x1d09b7[_0x0d07('0x2f')]['filter']+'%'};return _0x457c69;})});}_0x40d2dd=_['merge']({},_0x40d2dd,_0x1d09b7[_0x0d07('0x3e')]);return db[_0x0d07('0x5b')][_0x0d07('0x20')]({'where':_0x40d2dd['where']})['then'](function(_0x522524){_0x175823[_0x0d07('0x20')]=_0x522524;if(_0x1d09b7[_0x0d07('0x2f')][_0x0d07('0x46')]){_0x40d2dd[_0x0d07('0x47')]=[{'all':!![]}];}return db[_0x0d07('0x5b')]['findAll'](_0x40d2dd);})[_0x0d07('0x40')](function(_0x1f7b91){_0x175823[_0x0d07('0x5d')]=_0x1f7b91;return _0x175823;});}})['then'](respondWithFilteredResult(_0x34ca0e,_0x40d2dd))[_0x0d07('0x42')](handleError(_0x34ca0e,null));};exports[_0x0d07('0x5e')]=function(_0x4a3bb4,_0x3ece09,_0x53a083){var _0x40d54a={'raw':!![],'where':{}};var _0x2504ee={};var _0x421412={'count':0x0,'rows':[]};return db[_0x0d07('0x2a')][_0x0d07('0x5a')]({'where':{'id':_0x4a3bb4[_0x0d07('0x44')]['id']}})['then'](handleEntityNotFound(_0x3ece09,null))[_0x0d07('0x40')](function(_0x1b8964){if(_0x1b8964){_0x2504ee['model']=_[_0x0d07('0x30')](db[_0x0d07('0x5f')]['rawAttributes']);_0x2504ee[_0x0d07('0x2f')]=_['keys'](_0x4a3bb4[_0x0d07('0x2f')]);_0x2504ee[_0x0d07('0x31')]=_['intersection'](_0x2504ee[_0x0d07('0x33')],_0x2504ee[_0x0d07('0x2f')]);_0x40d54a['attributes']=_[_0x0d07('0x32')](_0x2504ee[_0x0d07('0x33')],qs[_0x0d07('0x34')](_0x4a3bb4[_0x0d07('0x2f')][_0x0d07('0x34')]));_0x40d54a['attributes']=_0x40d54a[_0x0d07('0x35')]['length']?_0x40d54a[_0x0d07('0x35')]:_0x2504ee[_0x0d07('0x33')];if(!_0x4a3bb4[_0x0d07('0x2f')][_0x0d07('0x36')](_0x0d07('0x37'))){_0x40d54a[_0x0d07('0x1f')]=qs[_0x0d07('0x1f')](_0x4a3bb4[_0x0d07('0x2f')]['limit']);_0x40d54a[_0x0d07('0x1d')]=qs[_0x0d07('0x1d')](_0x4a3bb4[_0x0d07('0x2f')][_0x0d07('0x1d')]);}_0x40d54a['order']=qs[_0x0d07('0x39')](_0x4a3bb4['query'][_0x0d07('0x39')]);_0x40d54a['where']=qs[_0x0d07('0x31')](_[_0x0d07('0x3a')](_0x4a3bb4[_0x0d07('0x2f')],_0x2504ee[_0x0d07('0x31')]));_0x40d54a[_0x0d07('0x3f')]['ProjectId']=_0x1b8964['id'];if(_0x4a3bb4[_0x0d07('0x2f')][_0x0d07('0x3b')]){_0x40d54a[_0x0d07('0x3f')]=_['merge'](_0x40d54a[_0x0d07('0x3f')],{'$or':_[_0x0d07('0x29')](_0x40d54a[_0x0d07('0x35')],function(_0x1ba81d){var _0x52f9fc={};_0x52f9fc[_0x1ba81d]={'$like':'%'+_0x4a3bb4[_0x0d07('0x2f')][_0x0d07('0x3b')]+'%'};return _0x52f9fc;})});}_0x40d54a=_['merge']({},_0x40d54a,_0x4a3bb4['options']);return db[_0x0d07('0x5f')][_0x0d07('0x20')]({'where':_0x40d54a[_0x0d07('0x3f')]})[_0x0d07('0x40')](function(_0x5a80a4){_0x421412[_0x0d07('0x20')]=_0x5a80a4;if(_0x4a3bb4[_0x0d07('0x2f')][_0x0d07('0x46')]){_0x40d54a[_0x0d07('0x47')]=[{'all':!![]}];}return db[_0x0d07('0x5f')][_0x0d07('0x41')](_0x40d54a);})[_0x0d07('0x40')](function(_0x194196){_0x421412[_0x0d07('0x5d')]=_0x194196;return _0x421412;});}})['then'](respondWithFilteredResult(_0x3ece09,_0x40d54a))[_0x0d07('0x42')](handleError(_0x3ece09,null));};function char(_0x27800e){return _0x0d07('0x60')===typeof _0x27800e?String[_0x0d07('0x61')][_0x0d07('0x62')](null,arguments):_0x27800e;}function needsEncapsulation(_0x55c374){return!!_0x55c374&&(_0x55c374[_0x0d07('0x63')]()[_0x0d07('0x64')](char(0xd))>=0x0||_0x55c374[_0x0d07('0x63')]()[_0x0d07('0x64')](char(0xa))>=0x0||_0x55c374['toString']()['indexOf'](char(0x2c))>=0x0||_0x55c374['toString']()[_0x0d07('0x64')](char(0x22))>=0x0);}function encapsulate(_0x496539){var _0x31a480=char(0x22),_0x568573='\x5c'+char(0x22),_0x440982=_0x496539[_0x0d07('0x63')]()[_0x0d07('0x65')](new RegExp(_0x31a480,'g'),_0x568573);return _0x31a480+_0x440982+_0x31a480;}exports['getSummary']=function(_0x110677,_0x5a727a,_0x82a6de){var _0x5ab74e,_0x3d091c;var _0x391d71={'where':{'ProjectId':_0x110677[_0x0d07('0x44')]['id']}};if(_0x110677[_0x0d07('0x2f')][_0x0d07('0x66')]){_0x391d71[_0x0d07('0x3f')]['starttime']=JSON['parse'](_0x110677[_0x0d07('0x2f')][_0x0d07('0x66')]);}return db['JscriptySessionReport']['findAll'](_0x391d71)['then'](handleEntityNotFound(_0x5a727a,null))[_0x0d07('0x40')](function(_0x44eeb5){if(_0x44eeb5){_0x5ab74e=_0x44eeb5;return db[_0x0d07('0x67')][_0x0d07('0x41')]({'where':{'SessionId':{'$in':_['map'](_0x5ab74e,'id')},'ProjectId':_0x110677['params']['id']},'order':'-createdAt'});}})[_0x0d07('0x40')](handleEntityNotFound(_0x5a727a,null))[_0x0d07('0x40')](function(_0x43c342){if(_0x43c342){_0x3d091c=_0x43c342;var _0x3fd4ca={};for(var _0x3c8493=0x0,_0x3c5209=_0x3d091c[_0x0d07('0x45')];_0x3c8493<_0x3c5209;_0x3c8493++){if(!_0x3fd4ca['hasOwnProperty'](_0x3d091c[_0x3c8493][_0x0d07('0x68')])){_0x3fd4ca[_0x3d091c[_0x3c8493][_0x0d07('0x68')]]=needsEncapsulation(_0x3d091c[_0x3c8493][_0x0d07('0x69')])?encapsulate(_0x3d091c[_0x3c8493]['question']):_0x3d091c[_0x3c8493][_0x0d07('0x69')];}}var _0x2eae57=[],_0x52f6ea={};for(var _0x682a6d=0x0,_0x13133b=_0x5ab74e[_0x0d07('0x45')];_0x682a6d<_0x13133b;_0x682a6d++){_0x52f6ea={'ProjectId':_0x110677[_0x0d07('0x44')]['id'],'SessionId':_0x5ab74e[_0x682a6d]['id'],'StartTime':moment(_0x5ab74e[_0x682a6d]['starttime'])[_0x0d07('0x6a')](_0x0d07('0x6b'))};for(var _0x20c0f3=0x0,_0x5ef1d7=_0x3d091c[_0x0d07('0x45')];_0x20c0f3<_0x5ef1d7;_0x20c0f3++){if(_0x3d091c[_0x20c0f3][_0x0d07('0x6c')]==_0x5ab74e[_0x682a6d]['id']&&_0x3fd4ca['hasOwnProperty'](_0x3d091c[_0x20c0f3]['questionId'])){_0x52f6ea[_0x3fd4ca[_0x3d091c[_0x20c0f3][_0x0d07('0x68')]]]=_0x3d091c[_0x20c0f3][_0x0d07('0x6d')];}}for(var _0x172a65 in _0x3fd4ca){if(!_0x52f6ea['hasOwnProperty'](_0x3fd4ca[_0x172a65])){_0x52f6ea[_0x3fd4ca[_0x172a65]]=null;}}_0x2eae57[_0x0d07('0x6e')](_0x52f6ea);}return _0x2eae57;}})[_0x0d07('0x40')](function(_0x280264){if(!_[_0x0d07('0x6f')](_0x280264)){var _0x4cf9cd=toCsv(_0x280264);var _0xf59ad9=Date['now']();fs[_0x0d07('0x70')](util[_0x0d07('0x6a')](_0x0d07('0x71'),_0x110677[_0x0d07('0x44')]['id'],_0xf59ad9),_0x4cf9cd);_0x5a727a[_0x0d07('0x72')]('Content-disposition',_0x0d07('0x73')+util[_0x0d07('0x6a')](_0x0d07('0x74'),_0x110677['params']['id'],_0xf59ad9));_0x5a727a[_0x0d07('0x72')](_0x0d07('0x75'),_0x0d07('0x76'));return _0x5a727a[_0x0d07('0x77')](util[_0x0d07('0x6a')](_0x0d07('0x71'),_0x110677[_0x0d07('0x44')]['id'],_0xf59ad9));}else{return _0x5a727a[_0x0d07('0x19')](0xcc);}})[_0x0d07('0x42')](handleError(_0x5a727a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 9895c0f..e78c80e 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 _0x9f5a=['api','bluebird','request-promise','path','../../config/environment','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger'];(function(_0xabbd65,_0x546d99){var _0x1d005a=function(_0x11694e){while(--_0x11694e){_0xabbd65['push'](_0xabbd65['shift']());}};_0x1d005a(++_0x546d99);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x394cc2,_0x293735){_0x394cc2=_0x394cc2-0x0;var _0x1c1d2b=_0x9f5a[_0x394cc2];return _0x1c1d2b;};'use strict';var _=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var logger=require(_0xa9f5('0x2'))(_0xa9f5('0x3'));var moment=require('moment');var BPromise=require(_0xa9f5('0x4'));var rp=require(_0xa9f5('0x5'));var fs=require('fs');var path=require(_0xa9f5('0x6'));var rimraf=require('rimraf');var config=require(_0xa9f5('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0xa9f5('0x8')]=function(_0x219e89,_0x49e337){return _0x219e89[_0xa9f5('0x9')](_0xa9f5('0xa'),attributes,{'tableName':_0xa9f5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c7=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','jscripty_projects','lodash','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0xf06ba8,_0x171bfd){_0xf06ba8=_0xf06ba8-0x0;var _0x2e79ae=_0xb4c7[_0xf06ba8];return _0x2e79ae;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));module['exports']=function(_0x1b0f57,_0x10e197){return _0x1b0f57[_0x7b4c('0xa')]('JscriptyProject',attributes,{'tableName':_0x7b4c('0xb'),'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 5ec6816..4c6887f 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 _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x28fa6f,_0x1b22ac){var _0x1ae01b=function(_0x12aed8){while(--_0x12aed8){_0x28fa6f['push'](_0x28fa6f['shift']());}};_0x1ae01b(++_0x1b22ac);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5d5f58,_0x53d4e3){_0x5d5f58=_0x5d5f58-0x0;var _0x23c5e5=_0xf4eb[_0x5d5f58];return _0x23c5e5;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xb7e7=['JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x4b5d42,_0x36cc8f){var _0x238f20=function(_0x2a345a){while(--_0x2a345a){_0x4b5d42['push'](_0x4b5d42['shift']());}};_0x238f20(++_0x36cc8f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xb7e7[_0x5d80de];return _0x1c7556;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index a8d5bea..32eacdc 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 _0x652f=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x25a780,_0x4478bf){var _0x225d6a=function(_0x59ea95){while(--_0x59ea95){_0x25a780['push'](_0x25a780['shift']());}};_0x225d6a(++_0x4478bf);}(_0x652f,0x129));var _0xf652=function(_0x18f16b,_0x2c8553){_0x18f16b=_0x18f16b-0x0;var _0xfe3d69=_0x652f[_0x18f16b];return _0xfe3d69;};'use strict';var multer=require(_0xf652('0x0'));var util=require('util');var path=require(_0xf652('0x1'));var timeout=require(_0xf652('0x2'));var express=require(_0xf652('0x3'));var router=express[_0xf652('0x4')]();var fs_extra=require(_0xf652('0x5'));var auth=require(_0xf652('0x6'));var interaction=require(_0xf652('0x7'));var config=require(_0xf652('0x8'));var controller=require(_0xf652('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf652('0xa')]);router[_0xf652('0xb')](_0xf652('0xc'),auth[_0xf652('0xd')](),controller[_0xf652('0xe')]);router[_0xf652('0xb')](_0xf652('0xf'),auth[_0xf652('0xd')](),controller[_0xf652('0x10')]);router[_0xf652('0x11')]('/',auth['isAuthenticated'](),controller[_0xf652('0x12')]);router[_0xf652('0x13')](_0xf652('0xf'),auth[_0xf652('0xd')](),controller[_0xf652('0x14')]);router[_0xf652('0x15')](_0xf652('0xf'),auth['isAuthenticated'](),controller[_0xf652('0x16')]);module[_0xf652('0x17')]=router; \ No newline at end of file +var _0xf1b1=['show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x424b21,_0x55dfd4){var _0x290984=function(_0x597fdd){while(--_0x597fdd){_0x424b21['push'](_0x424b21['shift']());}};_0x290984(++_0x55dfd4);}(_0xf1b1,0xe2));var _0x1f1b=function(_0x412faa,_0x6d5ea8){_0x412faa=_0x412faa-0x0;var _0x204402=_0xf1b1[_0x412faa];return _0x204402;};'use strict';var multer=require(_0x1f1b('0x0'));var util=require(_0x1f1b('0x1'));var path=require(_0x1f1b('0x2'));var timeout=require(_0x1f1b('0x3'));var express=require(_0x1f1b('0x4'));var router=express['Router']();var fs_extra=require(_0x1f1b('0x5'));var auth=require(_0x1f1b('0x6'));var interaction=require(_0x1f1b('0x7'));var config=require(_0x1f1b('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0x1f1b('0x9')]('/',auth[_0x1f1b('0xa')](),controller[_0x1f1b('0xb')]);router[_0x1f1b('0x9')](_0x1f1b('0xc'),auth[_0x1f1b('0xa')](),controller['describe']);router[_0x1f1b('0x9')](_0x1f1b('0xd'),auth[_0x1f1b('0xa')](),controller[_0x1f1b('0xe')]);router[_0x1f1b('0xf')]('/',auth[_0x1f1b('0xa')](),controller[_0x1f1b('0x10')]);router[_0x1f1b('0x11')]('/:id',auth[_0x1f1b('0xa')](),controller['update']);router['delete'](_0x1f1b('0xd'),auth[_0x1f1b('0xa')](),controller[_0x1f1b('0x12')]);module[_0x1f1b('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index c160526..4d8e735 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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7a54,0x106));var _0x47a5=function(_0x6212ae,_0x4854c8){_0x6212ae=_0x6212ae-0x0;var _0x18179e=_0x7a54[_0x6212ae];return _0x18179e;};'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(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x7a54,0x106));var _0x47a5=function(_0x709577,_0x584320){_0x709577=_0x709577-0x0;var _0x22b80a=_0x7a54[_0x709577];return _0x22b80a;};'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 f257f8b..ca7b4c4 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 _0x6b15=['filter','merge','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','rows','show','params','keys','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xbbb332,_0x14c6d5){var _0x4c50ba=function(_0x4c99f1){while(--_0x4c99f1){_0xbbb332['push'](_0xbbb332['shift']());}};_0x4c50ba(++_0x14c6d5);}(_0x6b15,0x1b0));var _0x56b1=function(_0x3dbf5a,_0x4613fc){_0x3dbf5a=_0x3dbf5a-0x0;var _0x5e83a8=_0x6b15[_0x3dbf5a];return _0x5e83a8;};'use strict';var emlformat=require(_0x56b1('0x0'));var rimraf=require(_0x56b1('0x1'));var zipdir=require(_0x56b1('0x2'));var jsonpatch=require(_0x56b1('0x3'));var rp=require(_0x56b1('0x4'));var moment=require(_0x56b1('0x5'));var BPromise=require(_0x56b1('0x6'));var Mustache=require(_0x56b1('0x7'));var util=require(_0x56b1('0x8'));var path=require(_0x56b1('0x9'));var sox=require(_0x56b1('0xa'));var csv=require(_0x56b1('0xb'));var ejs=require(_0x56b1('0xc'));var fs=require('fs');var fs_extra=require(_0x56b1('0xd'));var _=require('lodash');var squel=require(_0x56b1('0xe'));var crypto=require(_0x56b1('0xf'));var jsforce=require(_0x56b1('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x56b1('0xb'));var querystring=require(_0x56b1('0x11'));var Papa=require(_0x56b1('0x12'));var Redis=require(_0x56b1('0x13'));var authService=require(_0x56b1('0x14'));var qs=require(_0x56b1('0x15'));var as=require(_0x56b1('0x16'));var hardwareService=require(_0x56b1('0x17'));var logger=require(_0x56b1('0x18'))(_0x56b1('0x19'));var utils=require('../../config/utils');var config=require(_0x56b1('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x56b1('0x1b'))['db'];function respondWithStatusCode(_0x5809c4,_0x4dee48){_0x4dee48=_0x4dee48||0xcc;return function(_0x452fee){if(_0x452fee){return _0x5809c4[_0x56b1('0x1c')](_0x4dee48);}return _0x5809c4['status'](_0x4dee48)[_0x56b1('0x1d')]();};}function respondWithResult(_0x59ebb2,_0x3c2cb8){_0x3c2cb8=_0x3c2cb8||0xc8;return function(_0x23a9fa){if(_0x23a9fa){return _0x59ebb2[_0x56b1('0x1e')](_0x3c2cb8)[_0x56b1('0x1f')](_0x23a9fa);}};}function respondWithFilteredResult(_0x4eda7d,_0x4d323d){return function(_0x409c1d){if(_0x409c1d){var _0x4364ce=typeof _0x4d323d[_0x56b1('0x20')]===_0x56b1('0x21')&&typeof _0x4d323d[_0x56b1('0x22')]===_0x56b1('0x21');var _0x3c9ff0=_0x409c1d[_0x56b1('0x23')];var _0x24a7a3=_0x4364ce?0x0:_0x4d323d[_0x56b1('0x20')];var _0x1a74d9=_0x4364ce?_0x409c1d[_0x56b1('0x23')]:_0x4d323d[_0x56b1('0x20')]+_0x4d323d[_0x56b1('0x22')];var _0x4e72f1;if(_0x1a74d9>=_0x3c9ff0){_0x1a74d9=_0x3c9ff0;_0x4e72f1=0xc8;}else{_0x4e72f1=0xce;}_0x4eda7d[_0x56b1('0x1e')](_0x4e72f1);return _0x4eda7d[_0x56b1('0x24')](_0x56b1('0x25'),_0x24a7a3+'-'+_0x1a74d9+'/'+_0x3c9ff0)[_0x56b1('0x1f')](_0x409c1d);}return null;};}function patchUpdates(_0x5293de){return function(_0x180776){try{jsonpatch[_0x56b1('0x26')](_0x180776,_0x5293de,!![]);}catch(_0x314fd4){return BPromise[_0x56b1('0x27')](_0x314fd4);}return _0x180776[_0x56b1('0x28')]();};}function saveUpdates(_0x48b32c,_0x1dda69){return function(_0x37ab23){if(_0x37ab23){return _0x37ab23[_0x56b1('0x29')](_0x48b32c)[_0x56b1('0x2a')](function(_0x13d4ab){return _0x13d4ab;});}return null;};}function removeEntity(_0x3c2dd4,_0x13f196){return function(_0x16650a){if(_0x16650a){return _0x16650a['destroy']()[_0x56b1('0x2a')](function(){_0x3c2dd4[_0x56b1('0x1e')](0xcc)[_0x56b1('0x1d')]();});}};}function handleEntityNotFound(_0x190ff5,_0x2edb8c){return function(_0x7c4b6e){if(!_0x7c4b6e){_0x190ff5['sendStatus'](0x194);}return _0x7c4b6e;};}function handleError(_0x50f911,_0x299ff6){_0x299ff6=_0x299ff6||0x1f4;return function(_0x506433){logger[_0x56b1('0x2b')](_0x506433[_0x56b1('0x2c')]);if(_0x506433[_0x56b1('0x2d')]){delete _0x506433[_0x56b1('0x2d')];}_0x50f911[_0x56b1('0x1e')](_0x299ff6)[_0x56b1('0x2e')](_0x506433);};}exports[_0x56b1('0x2f')]=function(_0x5d5088,_0x38f1eb){var _0x55930e={},_0x246c7c={},_0x59164b={'count':0x0,'rows':[]};var _0x47f2de=_[_0x56b1('0x30')](db['JscriptyQuestionReport'][_0x56b1('0x31')],function(_0x343d85){return{'name':_0x343d85[_0x56b1('0x32')],'type':_0x343d85[_0x56b1('0x33')][_0x56b1('0x34')]};});_0x246c7c[_0x56b1('0x35')]=_[_0x56b1('0x30')](_0x47f2de,'name');_0x246c7c[_0x56b1('0x36')]=_['keys'](_0x5d5088[_0x56b1('0x36')]);_0x246c7c[_0x56b1('0x37')]=_[_0x56b1('0x38')](_0x246c7c[_0x56b1('0x35')],_0x246c7c[_0x56b1('0x36')]);_0x55930e['attributes']=_['intersection'](_0x246c7c[_0x56b1('0x35')],qs[_0x56b1('0x39')](_0x5d5088['query']['fields']));_0x55930e[_0x56b1('0x3a')]=_0x55930e[_0x56b1('0x3a')][_0x56b1('0x3b')]?_0x55930e[_0x56b1('0x3a')]:_0x246c7c['model'];if(!_0x5d5088[_0x56b1('0x36')][_0x56b1('0x3c')](_0x56b1('0x3d'))){_0x55930e[_0x56b1('0x22')]=qs[_0x56b1('0x22')](_0x5d5088['query']['limit']);_0x55930e[_0x56b1('0x20')]=qs[_0x56b1('0x20')](_0x5d5088[_0x56b1('0x36')][_0x56b1('0x20')]);}_0x55930e[_0x56b1('0x3e')]=qs[_0x56b1('0x3f')](_0x5d5088[_0x56b1('0x36')][_0x56b1('0x3f')]);_0x55930e[_0x56b1('0x40')]=qs['filters'](_[_0x56b1('0x41')](_0x5d5088[_0x56b1('0x36')],_0x246c7c[_0x56b1('0x37')]),_0x47f2de);if(_0x5d5088[_0x56b1('0x36')][_0x56b1('0x42')]){_0x55930e[_0x56b1('0x40')]=_[_0x56b1('0x43')](_0x55930e['where'],{'$or':_[_0x56b1('0x30')](_0x47f2de,function(_0x222029){if(_0x222029[_0x56b1('0x33')]!==_0x56b1('0x44')){var _0xd21a5c={};_0xd21a5c[_0x222029[_0x56b1('0x2d')]]={'$like':'%'+_0x5d5088[_0x56b1('0x36')][_0x56b1('0x42')]+'%'};return _0xd21a5c;}})});}_0x55930e=_[_0x56b1('0x43')]({},_0x55930e,_0x5d5088[_0x56b1('0x45')]);var _0x22a69c={'where':_0x55930e['where']};return db[_0x56b1('0x46')]['count'](_0x22a69c)[_0x56b1('0x2a')](function(_0x5f38de){_0x59164b[_0x56b1('0x23')]=_0x5f38de;if(_0x5d5088['query'][_0x56b1('0x47')]){_0x55930e[_0x56b1('0x48')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x55930e);})[_0x56b1('0x2a')](function(_0x5a9205){_0x59164b[_0x56b1('0x49')]=_0x5a9205;return _0x59164b;})[_0x56b1('0x2a')](respondWithFilteredResult(_0x38f1eb,_0x55930e))['catch'](handleError(_0x38f1eb,null));};exports[_0x56b1('0x4a')]=function(_0x5cab14,_0x3aff4e){var _0x48bee8={'raw':!![],'where':{'id':_0x5cab14[_0x56b1('0x4b')]['id']}},_0x329669={};_0x329669['model']=_[_0x56b1('0x4c')](db[_0x56b1('0x46')]['rawAttributes']);_0x329669[_0x56b1('0x36')]=_['keys'](_0x5cab14['query']);_0x329669[_0x56b1('0x37')]=_[_0x56b1('0x38')](_0x329669['model'],_0x329669['query']);_0x48bee8[_0x56b1('0x3a')]=_[_0x56b1('0x38')](_0x329669[_0x56b1('0x35')],qs['fields'](_0x5cab14[_0x56b1('0x36')][_0x56b1('0x39')]));_0x48bee8[_0x56b1('0x3a')]=_0x48bee8[_0x56b1('0x3a')][_0x56b1('0x3b')]?_0x48bee8[_0x56b1('0x3a')]:_0x329669[_0x56b1('0x35')];if(_0x5cab14[_0x56b1('0x36')][_0x56b1('0x47')]){_0x48bee8[_0x56b1('0x48')]=[{'all':!![]}];}_0x48bee8=_['merge']({},_0x48bee8,_0x5cab14[_0x56b1('0x45')]);return db['JscriptyQuestionReport'][_0x56b1('0x4d')](_0x48bee8)['then'](handleEntityNotFound(_0x3aff4e,null))[_0x56b1('0x2a')](respondWithResult(_0x3aff4e,null))[_0x56b1('0x4e')](handleError(_0x3aff4e,null));};exports[_0x56b1('0x4f')]=function(_0x33030d,_0x1f9b14){return db['JscriptyQuestionReport'][_0x56b1('0x4f')](_0x33030d[_0x56b1('0x50')],{})[_0x56b1('0x2a')](respondWithResult(_0x1f9b14,0xc9))[_0x56b1('0x4e')](handleError(_0x1f9b14,null));};exports[_0x56b1('0x29')]=function(_0x4ad714,_0x326acb){if(_0x4ad714[_0x56b1('0x50')]['id']){delete _0x4ad714[_0x56b1('0x50')]['id'];}return db['JscriptyQuestionReport'][_0x56b1('0x4d')]({'where':{'id':_0x4ad714['params']['id']}})[_0x56b1('0x2a')](handleEntityNotFound(_0x326acb,null))[_0x56b1('0x2a')](saveUpdates(_0x4ad714[_0x56b1('0x50')],null))[_0x56b1('0x2a')](respondWithResult(_0x326acb,null))[_0x56b1('0x4e')](handleError(_0x326acb,null));};exports[_0x56b1('0x51')]=function(_0x18b284,_0x2e6790){return db['JscriptyQuestionReport'][_0x56b1('0x4d')]({'where':{'id':_0x18b284[_0x56b1('0x4b')]['id']}})[_0x56b1('0x2a')](handleEntityNotFound(_0x2e6790,null))[_0x56b1('0x2a')](removeEntity(_0x2e6790,null))[_0x56b1('0x4e')](handleError(_0x2e6790,null));};exports['describe']=function(_0x405705,_0x3b82ef){return db[_0x56b1('0x46')][_0x56b1('0x52')]()[_0x56b1('0x2a')](respondWithResult(_0x3b82ef,null))[_0x56b1('0x4e')](handleError(_0x3b82ef,null));}; \ No newline at end of file +var _0xc1f8=['offset','count','limit','set','Content-Range','reject','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','show','params','keys','create','body','update','find','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../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'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc1f8,0x163));var _0x8c1f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc1f8[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c1f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c1f('0x1'));var rp=require(_0x8c1f('0x2'));var moment=require(_0x8c1f('0x3'));var BPromise=require(_0x8c1f('0x4'));var Mustache=require(_0x8c1f('0x5'));var util=require(_0x8c1f('0x6'));var path=require(_0x8c1f('0x7'));var sox=require(_0x8c1f('0x8'));var csv=require(_0x8c1f('0x9'));var ejs=require(_0x8c1f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c1f('0xb'));var squel=require(_0x8c1f('0xc'));var crypto=require(_0x8c1f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8c1f('0xe'));var toCsv=require(_0x8c1f('0x9'));var querystring=require(_0x8c1f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8c1f('0x10'));var as=require(_0x8c1f('0x11'));var hardwareService=require(_0x8c1f('0x12'));var logger=require(_0x8c1f('0x13'))(_0x8c1f('0x14'));var utils=require(_0x8c1f('0x15'));var config=require(_0x8c1f('0x16'));var licenseUtil=require(_0x8c1f('0x17'));var db=require(_0x8c1f('0x18'))['db'];function respondWithStatusCode(_0x3575ff,_0x587a6c){_0x587a6c=_0x587a6c||0xcc;return function(_0x1d41aa){if(_0x1d41aa){return _0x3575ff[_0x8c1f('0x19')](_0x587a6c);}return _0x3575ff[_0x8c1f('0x1a')](_0x587a6c)[_0x8c1f('0x1b')]();};}function respondWithResult(_0x3cfb2d,_0x118553){_0x118553=_0x118553||0xc8;return function(_0x14f842){if(_0x14f842){return _0x3cfb2d[_0x8c1f('0x1a')](_0x118553)[_0x8c1f('0x1c')](_0x14f842);}};}function respondWithFilteredResult(_0x33cc5a,_0x59be2d){return function(_0xfb15b){if(_0xfb15b){var _0x577fa9=typeof _0x59be2d['offset']===_0x8c1f('0x1d')&&typeof _0x59be2d['limit']===_0x8c1f('0x1d');var _0x5c85e9=_0xfb15b['count'];var _0x577133=_0x577fa9?0x0:_0x59be2d[_0x8c1f('0x1e')];var _0x228928=_0x577fa9?_0xfb15b[_0x8c1f('0x1f')]:_0x59be2d['offset']+_0x59be2d[_0x8c1f('0x20')];var _0x465828;if(_0x228928>=_0x5c85e9){_0x228928=_0x5c85e9;_0x465828=0xc8;}else{_0x465828=0xce;}_0x33cc5a['status'](_0x465828);return _0x33cc5a[_0x8c1f('0x21')](_0x8c1f('0x22'),_0x577133+'-'+_0x228928+'/'+_0x5c85e9)[_0x8c1f('0x1c')](_0xfb15b);}return null;};}function patchUpdates(_0x250794){return function(_0x32139d){try{jsonpatch['apply'](_0x32139d,_0x250794,!![]);}catch(_0x2d0682){return BPromise[_0x8c1f('0x23')](_0x2d0682);}return _0x32139d['save']();};}function saveUpdates(_0x4a9b9f,_0x36226b){return function(_0x50e8c0){if(_0x50e8c0){return _0x50e8c0['update'](_0x4a9b9f)['then'](function(_0x361096){return _0x361096;});}return null;};}function removeEntity(_0x1075ed,_0x5e45d4){return function(_0x238b7c){if(_0x238b7c){return _0x238b7c['destroy']()['then'](function(){_0x1075ed['status'](0xcc)[_0x8c1f('0x1b')]();});}};}function handleEntityNotFound(_0x389260,_0x896f3b){return function(_0x234faf){if(!_0x234faf){_0x389260[_0x8c1f('0x19')](0x194);}return _0x234faf;};}function handleError(_0x412ff7,_0x4e2cb2){_0x4e2cb2=_0x4e2cb2||0x1f4;return function(_0x344669){logger['error'](_0x344669[_0x8c1f('0x24')]);if(_0x344669[_0x8c1f('0x25')]){delete _0x344669[_0x8c1f('0x25')];}_0x412ff7[_0x8c1f('0x1a')](_0x4e2cb2)[_0x8c1f('0x26')](_0x344669);};}exports[_0x8c1f('0x27')]=function(_0x549616,_0xc0073a){var _0x357ab7={},_0x26d0af={},_0xa6a618={'count':0x0,'rows':[]};var _0xe3cd9=_['map'](db[_0x8c1f('0x28')][_0x8c1f('0x29')],function(_0x2d7f1f){return{'name':_0x2d7f1f[_0x8c1f('0x2a')],'type':_0x2d7f1f[_0x8c1f('0x2b')][_0x8c1f('0x2c')]};});_0x26d0af['model']=_[_0x8c1f('0x2d')](_0xe3cd9,_0x8c1f('0x25'));_0x26d0af[_0x8c1f('0x2e')]=_['keys'](_0x549616[_0x8c1f('0x2e')]);_0x26d0af[_0x8c1f('0x2f')]=_['intersection'](_0x26d0af[_0x8c1f('0x30')],_0x26d0af['query']);_0x357ab7[_0x8c1f('0x31')]=_[_0x8c1f('0x32')](_0x26d0af['model'],qs[_0x8c1f('0x33')](_0x549616[_0x8c1f('0x2e')][_0x8c1f('0x33')]));_0x357ab7[_0x8c1f('0x31')]=_0x357ab7['attributes'][_0x8c1f('0x34')]?_0x357ab7[_0x8c1f('0x31')]:_0x26d0af[_0x8c1f('0x30')];if(!_0x549616[_0x8c1f('0x2e')][_0x8c1f('0x35')]('nolimit')){_0x357ab7['limit']=qs[_0x8c1f('0x20')](_0x549616['query'][_0x8c1f('0x20')]);_0x357ab7[_0x8c1f('0x1e')]=qs[_0x8c1f('0x1e')](_0x549616['query']['offset']);}_0x357ab7[_0x8c1f('0x36')]=qs[_0x8c1f('0x37')](_0x549616[_0x8c1f('0x2e')]['sort']);_0x357ab7['where']=qs['filters'](_[_0x8c1f('0x38')](_0x549616['query'],_0x26d0af['filters']),_0xe3cd9);if(_0x549616[_0x8c1f('0x2e')]['filter']){_0x357ab7[_0x8c1f('0x39')]=_[_0x8c1f('0x3a')](_0x357ab7['where'],{'$or':_[_0x8c1f('0x2d')](_0xe3cd9,function(_0x54b8c4){if(_0x54b8c4[_0x8c1f('0x2b')]!==_0x8c1f('0x3b')){var _0x1269f3={};_0x1269f3[_0x54b8c4[_0x8c1f('0x25')]]={'$like':'%'+_0x549616[_0x8c1f('0x2e')][_0x8c1f('0x3c')]+'%'};return _0x1269f3;}})});}_0x357ab7=_[_0x8c1f('0x3a')]({},_0x357ab7,_0x549616[_0x8c1f('0x3d')]);var _0x2309e4={'where':_0x357ab7[_0x8c1f('0x39')]};return db[_0x8c1f('0x28')][_0x8c1f('0x1f')](_0x2309e4)[_0x8c1f('0x3e')](function(_0x265d18){_0xa6a618['count']=_0x265d18;if(_0x549616[_0x8c1f('0x2e')][_0x8c1f('0x3f')]){_0x357ab7[_0x8c1f('0x40')]=[{'all':!![]}];}return db[_0x8c1f('0x28')][_0x8c1f('0x41')](_0x357ab7);})[_0x8c1f('0x3e')](function(_0xdbc168){_0xa6a618[_0x8c1f('0x42')]=_0xdbc168;return _0xa6a618;})['then'](respondWithFilteredResult(_0xc0073a,_0x357ab7))[_0x8c1f('0x43')](handleError(_0xc0073a,null));};exports[_0x8c1f('0x44')]=function(_0x4aef62,_0x29fd11){var _0x1496c6={'raw':!![],'where':{'id':_0x4aef62[_0x8c1f('0x45')]['id']}},_0x561054={};_0x561054[_0x8c1f('0x30')]=_['keys'](db[_0x8c1f('0x28')][_0x8c1f('0x29')]);_0x561054['query']=_[_0x8c1f('0x46')](_0x4aef62['query']);_0x561054[_0x8c1f('0x2f')]=_[_0x8c1f('0x32')](_0x561054['model'],_0x561054[_0x8c1f('0x2e')]);_0x1496c6[_0x8c1f('0x31')]=_[_0x8c1f('0x32')](_0x561054[_0x8c1f('0x30')],qs['fields'](_0x4aef62[_0x8c1f('0x2e')][_0x8c1f('0x33')]));_0x1496c6[_0x8c1f('0x31')]=_0x1496c6[_0x8c1f('0x31')][_0x8c1f('0x34')]?_0x1496c6[_0x8c1f('0x31')]:_0x561054[_0x8c1f('0x30')];if(_0x4aef62[_0x8c1f('0x2e')][_0x8c1f('0x3f')]){_0x1496c6['include']=[{'all':!![]}];}_0x1496c6=_[_0x8c1f('0x3a')]({},_0x1496c6,_0x4aef62[_0x8c1f('0x3d')]);return db[_0x8c1f('0x28')]['find'](_0x1496c6)[_0x8c1f('0x3e')](handleEntityNotFound(_0x29fd11,null))[_0x8c1f('0x3e')](respondWithResult(_0x29fd11,null))[_0x8c1f('0x43')](handleError(_0x29fd11,null));};exports['create']=function(_0x1b003f,_0x47146d){return db['JscriptyQuestionReport'][_0x8c1f('0x47')](_0x1b003f[_0x8c1f('0x48')],{})[_0x8c1f('0x3e')](respondWithResult(_0x47146d,0xc9))['catch'](handleError(_0x47146d,null));};exports[_0x8c1f('0x49')]=function(_0x2033ed,_0x31546e){if(_0x2033ed[_0x8c1f('0x48')]['id']){delete _0x2033ed[_0x8c1f('0x48')]['id'];}return db[_0x8c1f('0x28')][_0x8c1f('0x4a')]({'where':{'id':_0x2033ed[_0x8c1f('0x45')]['id']}})[_0x8c1f('0x3e')](handleEntityNotFound(_0x31546e,null))[_0x8c1f('0x3e')](saveUpdates(_0x2033ed[_0x8c1f('0x48')],null))[_0x8c1f('0x3e')](respondWithResult(_0x31546e,null))[_0x8c1f('0x43')](handleError(_0x31546e,null));};exports[_0x8c1f('0x4b')]=function(_0x183a10,_0x3b6ce3){return db[_0x8c1f('0x28')][_0x8c1f('0x4a')]({'where':{'id':_0x183a10['params']['id']}})[_0x8c1f('0x3e')](handleEntityNotFound(_0x3b6ce3,null))[_0x8c1f('0x3e')](removeEntity(_0x3b6ce3,null))[_0x8c1f('0x43')](handleError(_0x3b6ce3,null));};exports[_0x8c1f('0x4c')]=function(_0x5d4ed3,_0x6c3e1a){return db[_0x8c1f('0x28')][_0x8c1f('0x4c')]()[_0x8c1f('0x3e')](respondWithResult(_0x6c3e1a,null))[_0x8c1f('0x43')](handleError(_0x6c3e1a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 83d4800..13b8713 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 _0xa7b6=['exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xa7b6,0x1b4));var _0x6a7b=function(_0x2a4da6,_0x5e7f66){_0x2a4da6=_0x2a4da6-0x0;var _0x21f384=_0xa7b6[_0x2a4da6];return _0x21f384;};'use strict';var _=require(_0x6a7b('0x0'));var util=require(_0x6a7b('0x1'));var logger=require(_0x6a7b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6a7b('0x3'));var rp=require(_0x6a7b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a7b('0x5'));var config=require(_0x6a7b('0x6'));var attributes=require(_0x6a7b('0x7'));module[_0x6a7b('0x8')]=function(_0x176806,_0x56ac98){return _0x176806[_0x6a7b('0x9')](_0x6a7b('0xa'),attributes,{'tableName':_0x6a7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc31=['api','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','define','lodash','util','../../config/logger'];(function(_0x2d51bd,_0x9d03bf){var _0x2a39fd=function(_0x3477b4){while(--_0x3477b4){_0x2d51bd['push'](_0x2d51bd['shift']());}};_0x2a39fd(++_0x9d03bf);}(_0xcc31,0x16f));var _0x1cc3=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xcc31[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x1cc3('0x0'));var util=require(_0x1cc3('0x1'));var logger=require(_0x1cc3('0x2'))(_0x1cc3('0x3'));var moment=require('moment');var BPromise=require(_0x1cc3('0x4'));var rp=require(_0x1cc3('0x5'));var fs=require('fs');var path=require(_0x1cc3('0x6'));var rimraf=require(_0x1cc3('0x7'));var config=require('../../config/environment');var attributes=require(_0x1cc3('0x8'));module['exports']=function(_0x1132af,_0x686d3){return _0x1132af[_0x1cc3('0x9')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','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 4986dfd..761b9ef 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 _0x3c0e=['request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','info','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x4687df,_0x12099c){var _0x32eaef=function(_0x2387db){while(--_0x2387db){_0x4687df['push'](_0x4687df['shift']());}};_0x32eaef(++_0x12099c);}(_0x3c0e,0xa9));var _0xe3c0=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3c0e[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xe3c0('0x0'));var moment=require(_0xe3c0('0x1'));var BPromise=require(_0xe3c0('0x2'));var rs=require(_0xe3c0('0x3'));var fs=require('fs');var Redis=require(_0xe3c0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe3c0('0x5'));var logger=require('../../config/logger')(_0xe3c0('0x6'));var config=require(_0xe3c0('0x7'));var jayson=require(_0xe3c0('0x8'));var client=jayson[_0xe3c0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5809fc,_0x5a70e3,_0x30d608){return new BPromise(function(_0xd55e48,_0x429ea3){return client['request'](_0x5809fc,_0x30d608)[_0xe3c0('0xa')](function(_0x3ba1b1){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x5a70e3,_0xe3c0('0xb'));logger['debug'](_0xe3c0('0xc'),_0x5a70e3,_0xe3c0('0xb'),JSON[_0xe3c0('0xd')](_0x3ba1b1));if(_0x3ba1b1[_0xe3c0('0xe')]){if(_0x3ba1b1[_0xe3c0('0xe')][_0xe3c0('0xf')]===0x1f4){logger[_0xe3c0('0xe')](_0xe3c0('0x10'),_0x5a70e3,_0x3ba1b1[_0xe3c0('0xe')][_0xe3c0('0x11')]);return _0x429ea3(_0x3ba1b1[_0xe3c0('0xe')]['message']);}logger[_0xe3c0('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5a70e3,_0x3ba1b1[_0xe3c0('0xe')]['message']);return _0xd55e48(_0x3ba1b1['error'][_0xe3c0('0x11')]);}else{logger[_0xe3c0('0x12')](_0xe3c0('0x10'),_0x5a70e3,_0xe3c0('0xb'));_0xd55e48(_0x3ba1b1[_0xe3c0('0x13')][_0xe3c0('0x11')]);}})['catch'](function(_0x1d6c4c){logger[_0xe3c0('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5a70e3,_0x1d6c4c);_0x429ea3(_0x1d6c4c);});});} \ No newline at end of file +var _0xb42e=['request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','request','then','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x5a649c,_0x687bd2){var _0x2e6830=function(_0x4008fb){while(--_0x4008fb){_0x5a649c['push'](_0x5a649c['shift']());}};_0x2e6830(++_0x687bd2);}(_0xb42e,0x1a0));var _0xeb42=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0xb42e[_0x4653f7];return _0x5454da;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeb42('0x0'));var BPromise=require('bluebird');var rs=require(_0xeb42('0x1'));var fs=require('fs');var Redis=require(_0xeb42('0x2'));var db=require(_0xeb42('0x3'))['db'];var utils=require(_0xeb42('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xeb42('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52b8a9,_0x289743,_0x21d127){return new BPromise(function(_0x3e04f1,_0x4be940){return client[_0xeb42('0x6')](_0x52b8a9,_0x21d127)[_0xeb42('0x7')](function(_0x1865f5){logger['info'](_0xeb42('0x8'),_0x289743,_0xeb42('0x9'));logger[_0xeb42('0xa')](_0xeb42('0xb'),_0x289743,'request\x20sent',JSON[_0xeb42('0xc')](_0x1865f5));if(_0x1865f5[_0xeb42('0xd')]){if(_0x1865f5['error'][_0xeb42('0xe')]===0x1f4){logger[_0xeb42('0xd')](_0xeb42('0x8'),_0x289743,_0x1865f5[_0xeb42('0xd')][_0xeb42('0xf')]);return _0x4be940(_0x1865f5[_0xeb42('0xd')][_0xeb42('0xf')]);}logger[_0xeb42('0xd')](_0xeb42('0x8'),_0x289743,_0x1865f5[_0xeb42('0xd')]['message']);return _0x3e04f1(_0x1865f5['error'][_0xeb42('0xf')]);}else{logger['info'](_0xeb42('0x8'),_0x289743,'request\x20sent');_0x3e04f1(_0x1865f5['result'][_0xeb42('0xf')]);}})[_0xeb42('0x10')](function(_0x3dd3f0){logger[_0xeb42('0xd')](_0xeb42('0x8'),_0x289743,_0x3dd3f0);_0x4be940(_0x3dd3f0);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2f99c55..1d8a8ec 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 _0x9477=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','show','/:id/questions','getQuestions','post','create','put','/:id','delete','exports','multer','util','path'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x9477,0x184));var _0x7947=function(_0x547302,_0x20f226){_0x547302=_0x547302-0x0;var _0x2cf6de=_0x9477[_0x547302];return _0x2cf6de;};'use strict';var multer=require(_0x7947('0x0'));var util=require(_0x7947('0x1'));var path=require(_0x7947('0x2'));var timeout=require(_0x7947('0x3'));var express=require(_0x7947('0x4'));var router=express['Router']();var fs_extra=require(_0x7947('0x5'));var auth=require(_0x7947('0x6'));var interaction=require(_0x7947('0x7'));var config=require(_0x7947('0x8'));var controller=require(_0x7947('0x9'));router['get']('/',auth[_0x7947('0xa')](),controller[_0x7947('0xb')]);router[_0x7947('0xc')](_0x7947('0xd'),auth[_0x7947('0xa')](),controller['describe']);router[_0x7947('0xc')]('/:id',auth[_0x7947('0xa')](),controller[_0x7947('0xe')]);router[_0x7947('0xc')](_0x7947('0xf'),auth['isAuthenticated'](),controller[_0x7947('0x10')]);router[_0x7947('0x11')]('/',auth[_0x7947('0xa')](),controller[_0x7947('0x12')]);router[_0x7947('0x13')](_0x7947('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x7947('0x15')](_0x7947('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0x7947('0x16')]=router; \ No newline at end of file +var _0x8236=['/:id','show','/:id/questions','getQuestions','post','put','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1e5905,_0x470358){var _0x5abe4d=function(_0x3ac378){while(--_0x3ac378){_0x1e5905['push'](_0x1e5905['shift']());}};_0x5abe4d(++_0x470358);}(_0x8236,0x1c1));var _0x6823=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x8236[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require(_0x6823('0x0'));var util=require(_0x6823('0x1'));var path=require(_0x6823('0x2'));var timeout=require('connect-timeout');var express=require(_0x6823('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6823('0x4'));var interaction=require(_0x6823('0x5'));var config=require(_0x6823('0x6'));var controller=require(_0x6823('0x7'));router[_0x6823('0x8')]('/',auth[_0x6823('0x9')](),controller[_0x6823('0xa')]);router[_0x6823('0x8')](_0x6823('0xb'),auth[_0x6823('0x9')](),controller[_0x6823('0xc')]);router[_0x6823('0x8')](_0x6823('0xd'),auth[_0x6823('0x9')](),controller[_0x6823('0xe')]);router[_0x6823('0x8')](_0x6823('0xf'),auth['isAuthenticated'](),controller[_0x6823('0x10')]);router[_0x6823('0x11')]('/',auth[_0x6823('0x9')](),controller['create']);router[_0x6823('0x12')](_0x6823('0xd'),auth[_0x6823('0x9')](),controller[_0x6823('0x13')]);router['delete'](_0x6823('0xd'),auth['isAuthenticated'](),controller[_0x6823('0x14')]);module[_0x6823('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 e828f24..f09f14d 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 _0xd69e=['sequelize','exports','setDataValue','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd69e,0xa0));var _0xed69=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xd69e[_0x5f0089];return _0x193892;};'use strict';var moment=require(_0xed69('0x0'));var Sequelize=require(_0xed69('0x1'));module[_0xed69('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x3bf887){this[_0xed69('0x3')]('starttime',_0x3bf887);this['setDataValue']('endtime',moment()['format'](_0xed69('0x4')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xed69('0x5')]},'queue':{'type':Sequelize[_0xed69('0x5')]},'uniqueid':{'type':Sequelize[_0xed69('0x5')]},'calleridname':{'type':Sequelize[_0xed69('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xed69('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x7cf8=['sequelize','exports','DATE','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0x138676,_0x27a8d5){var _0xf72f74=function(_0xc6036a){while(--_0xc6036a){_0x138676['push'](_0x138676['shift']());}};_0xf72f74(++_0x27a8d5);}(_0x7cf8,0xa9));var _0x87cf=function(_0x320f5a,_0x242419){_0x320f5a=_0x320f5a-0x0;var _0x230c93=_0x7cf8[_0x320f5a];return _0x230c93;};'use strict';var moment=require(_0x87cf('0x0'));var Sequelize=require(_0x87cf('0x1'));module[_0x87cf('0x2')]={'starttime':{'type':Sequelize[_0x87cf('0x3')],'set':function(_0x166355){this[_0x87cf('0x4')](_0x87cf('0x5'),_0x166355);this['setDataValue']('endtime',moment()[_0x87cf('0x6')](_0x87cf('0x7')));}},'endtime':{'type':Sequelize[_0x87cf('0x3')]},'membername':{'type':Sequelize[_0x87cf('0x8')]},'projectname':{'type':Sequelize[_0x87cf('0x8')]},'queue':{'type':Sequelize[_0x87cf('0x8')]},'uniqueid':{'type':Sequelize[_0x87cf('0x8')]},'calleridname':{'type':Sequelize[_0x87cf('0x8')]},'calleridnum':{'type':Sequelize[_0x87cf('0x8')]},'completed':{'type':Sequelize[_0x87cf('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 79e6199..6ed69c7 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 _0xf65f=['pick','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','catch','show','params','rawAttributes','fields','find','create','body','describe','getQuestions','findOne','SessionId','filter','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','keys','filters','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x6315ee,_0x3064ca){var _0xa9718=function(_0xf816c1){while(--_0xf816c1){_0x6315ee['push'](_0x6315ee['shift']());}};_0xa9718(++_0x3064ca);}(_0xf65f,0xbe));var _0xff65=function(_0x52b677,_0x5a545b){_0x52b677=_0x52b677-0x0;var _0x4f523c=_0xf65f[_0x52b677];return _0x4f523c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff65('0x0'));var zipdir=require(_0xff65('0x1'));var jsonpatch=require(_0xff65('0x2'));var rp=require(_0xff65('0x3'));var moment=require(_0xff65('0x4'));var BPromise=require(_0xff65('0x5'));var Mustache=require(_0xff65('0x6'));var util=require(_0xff65('0x7'));var path=require(_0xff65('0x8'));var sox=require(_0xff65('0x9'));var csv=require('to-csv');var ejs=require(_0xff65('0xa'));var fs=require('fs');var fs_extra=require(_0xff65('0xb'));var _=require(_0xff65('0xc'));var squel=require(_0xff65('0xd'));var crypto=require(_0xff65('0xe'));var jsforce=require(_0xff65('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xff65('0x10'));var Papa=require('papaparse');var Redis=require(_0xff65('0x11'));var authService=require(_0xff65('0x12'));var qs=require(_0xff65('0x13'));var as=require(_0xff65('0x14'));var hardwareService=require(_0xff65('0x15'));var logger=require(_0xff65('0x16'))(_0xff65('0x17'));var utils=require(_0xff65('0x18'));var config=require(_0xff65('0x19'));var licenseUtil=require(_0xff65('0x1a'));var db=require(_0xff65('0x1b'))['db'];function respondWithStatusCode(_0x3a1bdc,_0x2ce24a){_0x2ce24a=_0x2ce24a||0xcc;return function(_0x505246){if(_0x505246){return _0x3a1bdc[_0xff65('0x1c')](_0x2ce24a);}return _0x3a1bdc[_0xff65('0x1d')](_0x2ce24a)[_0xff65('0x1e')]();};}function respondWithResult(_0x2bcfa5,_0x1f7199){_0x1f7199=_0x1f7199||0xc8;return function(_0x37fcde){if(_0x37fcde){return _0x2bcfa5[_0xff65('0x1d')](_0x1f7199)['json'](_0x37fcde);}};}function respondWithFilteredResult(_0x28ef8e,_0x1f149b){return function(_0x601db3){if(_0x601db3){var _0x2b6b72=typeof _0x1f149b[_0xff65('0x1f')]===_0xff65('0x20')&&typeof _0x1f149b[_0xff65('0x21')]===_0xff65('0x20');var _0x2833b2=_0x601db3[_0xff65('0x22')];var _0xfba2d=_0x2b6b72?0x0:_0x1f149b[_0xff65('0x1f')];var _0xdf803d=_0x2b6b72?_0x601db3['count']:_0x1f149b[_0xff65('0x1f')]+_0x1f149b[_0xff65('0x21')];var _0x5614ee;if(_0xdf803d>=_0x2833b2){_0xdf803d=_0x2833b2;_0x5614ee=0xc8;}else{_0x5614ee=0xce;}_0x28ef8e[_0xff65('0x1d')](_0x5614ee);return _0x28ef8e[_0xff65('0x23')](_0xff65('0x24'),_0xfba2d+'-'+_0xdf803d+'/'+_0x2833b2)[_0xff65('0x25')](_0x601db3);}return null;};}function patchUpdates(_0x5bd92b){return function(_0x132ecd){try{jsonpatch['apply'](_0x132ecd,_0x5bd92b,!![]);}catch(_0x50448c){return BPromise['reject'](_0x50448c);}return _0x132ecd['save']();};}function saveUpdates(_0x4009ef,_0x176ee7){return function(_0x3fde3){if(_0x3fde3){return _0x3fde3[_0xff65('0x26')](_0x4009ef)[_0xff65('0x27')](function(_0x14ad2c){return _0x14ad2c;});}return null;};}function removeEntity(_0x4214cf,_0x14d232){return function(_0xdfee29){if(_0xdfee29){return _0xdfee29[_0xff65('0x28')]()[_0xff65('0x27')](function(){_0x4214cf[_0xff65('0x1d')](0xcc)[_0xff65('0x1e')]();});}};}function handleEntityNotFound(_0xd2ae29,_0x628d2d){return function(_0x1fe0dd){if(!_0x1fe0dd){_0xd2ae29['sendStatus'](0x194);}return _0x1fe0dd;};}function handleError(_0x20e88e,_0x4657ec){_0x4657ec=_0x4657ec||0x1f4;return function(_0x341a8a){logger[_0xff65('0x29')](_0x341a8a[_0xff65('0x2a')]);if(_0x341a8a[_0xff65('0x2b')]){delete _0x341a8a[_0xff65('0x2b')];}_0x20e88e[_0xff65('0x1d')](_0x4657ec)[_0xff65('0x2c')](_0x341a8a);};}exports[_0xff65('0x2d')]=function(_0x39a142,_0x1568b8){var _0x316e95={},_0x2c8b34={},_0x3a24ab={'count':0x0,'rows':[]};var _0x4e4ee0=_[_0xff65('0x2e')](db['JscriptySessionReport']['rawAttributes'],function(_0x164183){return{'name':_0x164183[_0xff65('0x2f')],'type':_0x164183[_0xff65('0x30')][_0xff65('0x31')]};});_0x2c8b34[_0xff65('0x32')]=_[_0xff65('0x2e')](_0x4e4ee0,'name');_0x2c8b34['query']=_[_0xff65('0x33')](_0x39a142['query']);_0x2c8b34[_0xff65('0x34')]=_['intersection'](_0x2c8b34[_0xff65('0x32')],_0x2c8b34[_0xff65('0x35')]);_0x316e95['attributes']=_[_0xff65('0x36')](_0x2c8b34[_0xff65('0x32')],qs['fields'](_0x39a142[_0xff65('0x35')]['fields']));_0x316e95[_0xff65('0x37')]=_0x316e95[_0xff65('0x37')][_0xff65('0x38')]?_0x316e95['attributes']:_0x2c8b34[_0xff65('0x32')];if(!_0x39a142[_0xff65('0x35')][_0xff65('0x39')](_0xff65('0x3a'))){_0x316e95[_0xff65('0x21')]=qs['limit'](_0x39a142['query'][_0xff65('0x21')]);_0x316e95[_0xff65('0x1f')]=qs['offset'](_0x39a142[_0xff65('0x35')][_0xff65('0x1f')]);}_0x316e95[_0xff65('0x3b')]=qs[_0xff65('0x3c')](_0x39a142[_0xff65('0x35')][_0xff65('0x3c')]);_0x316e95[_0xff65('0x3d')]=qs[_0xff65('0x34')](_[_0xff65('0x3e')](_0x39a142[_0xff65('0x35')],_0x2c8b34[_0xff65('0x34')]),_0x4e4ee0);if(_0x39a142['query']['filter']){_0x316e95[_0xff65('0x3d')]=_[_0xff65('0x3f')](_0x316e95[_0xff65('0x3d')],{'$or':_[_0xff65('0x2e')](_0x4e4ee0,function(_0x1d1cab){if(_0x1d1cab['type']!==_0xff65('0x40')){var _0x5a9cd2={};_0x5a9cd2[_0x1d1cab[_0xff65('0x2b')]]={'$like':'%'+_0x39a142[_0xff65('0x35')]['filter']+'%'};return _0x5a9cd2;}})});}_0x316e95=_[_0xff65('0x3f')]({},_0x316e95,_0x39a142[_0xff65('0x41')]);var _0x3f2c2d={'where':_0x316e95[_0xff65('0x3d')]};return db[_0xff65('0x42')]['count'](_0x3f2c2d)[_0xff65('0x27')](function(_0x160fae){_0x3a24ab[_0xff65('0x22')]=_0x160fae;if(_0x39a142[_0xff65('0x35')][_0xff65('0x43')]){_0x316e95[_0xff65('0x44')]=[{'all':!![]}];}return db[_0xff65('0x42')][_0xff65('0x45')](_0x316e95);})[_0xff65('0x27')](function(_0x34374a){_0x3a24ab['rows']=_0x34374a;return _0x3a24ab;})[_0xff65('0x27')](respondWithFilteredResult(_0x1568b8,_0x316e95))[_0xff65('0x46')](handleError(_0x1568b8,null));};exports[_0xff65('0x47')]=function(_0x2e1ea2,_0x1fe126){var _0x11002b={'raw':!![],'where':{'id':_0x2e1ea2[_0xff65('0x48')]['id']}},_0x11db9e={};_0x11db9e[_0xff65('0x32')]=_['keys'](db['JscriptySessionReport'][_0xff65('0x49')]);_0x11db9e[_0xff65('0x35')]=_[_0xff65('0x33')](_0x2e1ea2['query']);_0x11db9e[_0xff65('0x34')]=_['intersection'](_0x11db9e[_0xff65('0x32')],_0x11db9e['query']);_0x11002b[_0xff65('0x37')]=_[_0xff65('0x36')](_0x11db9e[_0xff65('0x32')],qs[_0xff65('0x4a')](_0x2e1ea2[_0xff65('0x35')][_0xff65('0x4a')]));_0x11002b['attributes']=_0x11002b['attributes'][_0xff65('0x38')]?_0x11002b[_0xff65('0x37')]:_0x11db9e[_0xff65('0x32')];if(_0x2e1ea2['query'][_0xff65('0x43')]){_0x11002b['include']=[{'all':!![]}];}_0x11002b=_[_0xff65('0x3f')]({},_0x11002b,_0x2e1ea2['options']);return db[_0xff65('0x42')][_0xff65('0x4b')](_0x11002b)[_0xff65('0x27')](handleEntityNotFound(_0x1fe126,null))['then'](respondWithResult(_0x1fe126,null))[_0xff65('0x46')](handleError(_0x1fe126,null));};exports[_0xff65('0x4c')]=function(_0x2e9108,_0x42eed2){return db[_0xff65('0x42')][_0xff65('0x4c')](_0x2e9108[_0xff65('0x4d')],{})[_0xff65('0x27')](respondWithResult(_0x42eed2,0xc9))[_0xff65('0x46')](handleError(_0x42eed2,null));};exports['update']=function(_0x4e8891,_0x5117cb){if(_0x4e8891[_0xff65('0x4d')]['id']){delete _0x4e8891['body']['id'];}return db[_0xff65('0x42')][_0xff65('0x4b')]({'where':{'id':_0x4e8891[_0xff65('0x48')]['id']}})[_0xff65('0x27')](handleEntityNotFound(_0x5117cb,null))[_0xff65('0x27')](saveUpdates(_0x4e8891[_0xff65('0x4d')],null))[_0xff65('0x27')](respondWithResult(_0x5117cb,null))[_0xff65('0x46')](handleError(_0x5117cb,null));};exports[_0xff65('0x28')]=function(_0x4c2863,_0x59639b){return db[_0xff65('0x42')][_0xff65('0x4b')]({'where':{'id':_0x4c2863[_0xff65('0x48')]['id']}})[_0xff65('0x27')](handleEntityNotFound(_0x59639b,null))[_0xff65('0x27')](removeEntity(_0x59639b,null))[_0xff65('0x46')](handleError(_0x59639b,null));};exports[_0xff65('0x4e')]=function(_0x493a21,_0x3b2a19){return db[_0xff65('0x42')][_0xff65('0x4e')]()[_0xff65('0x27')](respondWithResult(_0x3b2a19,null))[_0xff65('0x46')](handleError(_0x3b2a19,null));};exports[_0xff65('0x4f')]=function(_0x7eb5cb,_0x30e444,_0x4e28c8){var _0x31b022={'raw':!![],'where':{}};var _0x26ad99={};var _0x212465={'count':0x0,'rows':[]};return db[_0xff65('0x42')][_0xff65('0x50')]({'where':{'id':_0x7eb5cb[_0xff65('0x48')]['id']}})[_0xff65('0x27')](handleEntityNotFound(_0x30e444,null))[_0xff65('0x27')](function(_0x33909d){if(_0x33909d){_0x26ad99['model']=_[_0xff65('0x33')](db['JscriptyQuestionReport'][_0xff65('0x49')]);_0x26ad99[_0xff65('0x35')]=_[_0xff65('0x33')](_0x7eb5cb['query']);_0x26ad99[_0xff65('0x34')]=_['intersection'](_0x26ad99[_0xff65('0x32')],_0x26ad99[_0xff65('0x35')]);_0x31b022[_0xff65('0x37')]=_[_0xff65('0x36')](_0x26ad99[_0xff65('0x32')],qs[_0xff65('0x4a')](_0x7eb5cb[_0xff65('0x35')]['fields']));_0x31b022[_0xff65('0x37')]=_0x31b022[_0xff65('0x37')][_0xff65('0x38')]?_0x31b022['attributes']:_0x26ad99[_0xff65('0x32')];if(!_0x7eb5cb[_0xff65('0x35')][_0xff65('0x39')](_0xff65('0x3a'))){_0x31b022[_0xff65('0x21')]=qs[_0xff65('0x21')](_0x7eb5cb[_0xff65('0x35')]['limit']);_0x31b022[_0xff65('0x1f')]=qs[_0xff65('0x1f')](_0x7eb5cb['query'][_0xff65('0x1f')]);}_0x31b022['order']=qs[_0xff65('0x3c')](_0x7eb5cb[_0xff65('0x35')]['sort']);_0x31b022['where']=qs[_0xff65('0x34')](_[_0xff65('0x3e')](_0x7eb5cb['query'],_0x26ad99[_0xff65('0x34')]));_0x31b022[_0xff65('0x3d')][_0xff65('0x51')]=_0x33909d['id'];if(_0x7eb5cb[_0xff65('0x35')]['filter']){_0x31b022[_0xff65('0x3d')]=_[_0xff65('0x3f')](_0x31b022[_0xff65('0x3d')],{'$or':_['map'](_0x31b022[_0xff65('0x37')],function(_0x3c6f59){var _0x27087f={};_0x27087f[_0x3c6f59]={'$like':'%'+_0x7eb5cb[_0xff65('0x35')][_0xff65('0x52')]+'%'};return _0x27087f;})});}_0x31b022=_[_0xff65('0x3f')]({},_0x31b022,_0x7eb5cb[_0xff65('0x41')]);return db[_0xff65('0x53')]['count']({'where':_0x31b022[_0xff65('0x3d')]})[_0xff65('0x27')](function(_0x43264e){_0x212465[_0xff65('0x22')]=_0x43264e;if(_0x7eb5cb[_0xff65('0x35')][_0xff65('0x43')]){_0x31b022[_0xff65('0x44')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xff65('0x45')](_0x31b022);})['then'](function(_0x1c7a49){_0x212465['rows']=_0x1c7a49;return _0x212465;});}})[_0xff65('0x27')](respondWithFilteredResult(_0x30e444,_0x31b022))[_0xff65('0x46')](handleError(_0x30e444,null));}; \ No newline at end of file +var _0x542a=['where','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','rows','intersection','include','find','catch','create','update','body','params','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','Content-Range','apply','reject','error','stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','nolimit','order','sort'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x542a,0x19f));var _0xa542=function(_0x5f0147,_0x37c8d8){_0x5f0147=_0x5f0147-0x0;var _0x424756=_0x542a[_0x5f0147];return _0x424756;};'use strict';var emlformat=require(_0xa542('0x0'));var rimraf=require(_0xa542('0x1'));var zipdir=require(_0xa542('0x2'));var jsonpatch=require(_0xa542('0x3'));var rp=require(_0xa542('0x4'));var moment=require(_0xa542('0x5'));var BPromise=require(_0xa542('0x6'));var Mustache=require('mustache');var util=require(_0xa542('0x7'));var path=require(_0xa542('0x8'));var sox=require(_0xa542('0x9'));var csv=require(_0xa542('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa542('0xb'));var _=require('lodash');var squel=require(_0xa542('0xc'));var crypto=require(_0xa542('0xd'));var jsforce=require(_0xa542('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa542('0xa'));var querystring=require(_0xa542('0xf'));var Papa=require(_0xa542('0x10'));var Redis=require(_0xa542('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa542('0x12'));var as=require(_0xa542('0x13'));var hardwareService=require(_0xa542('0x14'));var logger=require(_0xa542('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa542('0x16'));var licenseUtil=require(_0xa542('0x17'));var db=require(_0xa542('0x18'))['db'];function respondWithStatusCode(_0x271fe0,_0x45ad89){_0x45ad89=_0x45ad89||0xcc;return function(_0x37f25a){if(_0x37f25a){return _0x271fe0['sendStatus'](_0x45ad89);}return _0x271fe0['status'](_0x45ad89)[_0xa542('0x19')]();};}function respondWithResult(_0x5b24f2,_0x2f427b){_0x2f427b=_0x2f427b||0xc8;return function(_0x497995){if(_0x497995){return _0x5b24f2[_0xa542('0x1a')](_0x2f427b)['json'](_0x497995);}};}function respondWithFilteredResult(_0x55e216,_0x5231ba){return function(_0x259d54){if(_0x259d54){var _0x54c7f0=typeof _0x5231ba[_0xa542('0x1b')]===_0xa542('0x1c')&&typeof _0x5231ba[_0xa542('0x1d')]==='undefined';var _0x370c03=_0x259d54[_0xa542('0x1e')];var _0x5a1f03=_0x54c7f0?0x0:_0x5231ba['offset'];var _0x4164f3=_0x54c7f0?_0x259d54[_0xa542('0x1e')]:_0x5231ba['offset']+_0x5231ba['limit'];var _0x3ba134;if(_0x4164f3>=_0x370c03){_0x4164f3=_0x370c03;_0x3ba134=0xc8;}else{_0x3ba134=0xce;}_0x55e216[_0xa542('0x1a')](_0x3ba134);return _0x55e216['set'](_0xa542('0x1f'),_0x5a1f03+'-'+_0x4164f3+'/'+_0x370c03)['json'](_0x259d54);}return null;};}function patchUpdates(_0x3f1d4f){return function(_0xae0292){try{jsonpatch[_0xa542('0x20')](_0xae0292,_0x3f1d4f,!![]);}catch(_0xf6e9ca){return BPromise[_0xa542('0x21')](_0xf6e9ca);}return _0xae0292['save']();};}function saveUpdates(_0x26ae8c,_0x38feae){return function(_0x584147){if(_0x584147){return _0x584147['update'](_0x26ae8c)['then'](function(_0x5dd8d4){return _0x5dd8d4;});}return null;};}function removeEntity(_0x3fad6a,_0x4f327e){return function(_0x265e86){if(_0x265e86){return _0x265e86['destroy']()['then'](function(){_0x3fad6a[_0xa542('0x1a')](0xcc)[_0xa542('0x19')]();});}};}function handleEntityNotFound(_0x49f929,_0x3559e8){return function(_0x24d2a9){if(!_0x24d2a9){_0x49f929['sendStatus'](0x194);}return _0x24d2a9;};}function handleError(_0x4e4bf8,_0x572c03){_0x572c03=_0x572c03||0x1f4;return function(_0x172943){logger[_0xa542('0x22')](_0x172943[_0xa542('0x23')]);if(_0x172943['name']){delete _0x172943[_0xa542('0x24')];}_0x4e4bf8[_0xa542('0x1a')](_0x572c03)['send'](_0x172943);};}exports[_0xa542('0x25')]=function(_0x5c6aa1,_0x1e8efd){var _0x549111={},_0x2d492a={},_0x1f6e85={'count':0x0,'rows':[]};var _0x5e2b1a=_[_0xa542('0x26')](db[_0xa542('0x27')][_0xa542('0x28')],function(_0x57478f){return{'name':_0x57478f[_0xa542('0x29')],'type':_0x57478f[_0xa542('0x2a')]['key']};});_0x2d492a['model']=_[_0xa542('0x26')](_0x5e2b1a,_0xa542('0x24'));_0x2d492a[_0xa542('0x2b')]=_[_0xa542('0x2c')](_0x5c6aa1[_0xa542('0x2b')]);_0x2d492a[_0xa542('0x2d')]=_['intersection'](_0x2d492a[_0xa542('0x2e')],_0x2d492a[_0xa542('0x2b')]);_0x549111[_0xa542('0x2f')]=_['intersection'](_0x2d492a[_0xa542('0x2e')],qs[_0xa542('0x30')](_0x5c6aa1[_0xa542('0x2b')][_0xa542('0x30')]));_0x549111['attributes']=_0x549111['attributes'][_0xa542('0x31')]?_0x549111[_0xa542('0x2f')]:_0x2d492a['model'];if(!_0x5c6aa1[_0xa542('0x2b')]['hasOwnProperty'](_0xa542('0x32'))){_0x549111['limit']=qs[_0xa542('0x1d')](_0x5c6aa1['query'][_0xa542('0x1d')]);_0x549111[_0xa542('0x1b')]=qs[_0xa542('0x1b')](_0x5c6aa1['query'][_0xa542('0x1b')]);}_0x549111[_0xa542('0x33')]=qs[_0xa542('0x34')](_0x5c6aa1[_0xa542('0x2b')][_0xa542('0x34')]);_0x549111[_0xa542('0x35')]=qs['filters'](_[_0xa542('0x36')](_0x5c6aa1[_0xa542('0x2b')],_0x2d492a[_0xa542('0x2d')]),_0x5e2b1a);if(_0x5c6aa1[_0xa542('0x2b')][_0xa542('0x37')]){_0x549111[_0xa542('0x35')]=_[_0xa542('0x38')](_0x549111[_0xa542('0x35')],{'$or':_['map'](_0x5e2b1a,function(_0x367ae0){if(_0x367ae0[_0xa542('0x2a')]!==_0xa542('0x39')){var _0x5313c5={};_0x5313c5[_0x367ae0[_0xa542('0x24')]]={'$like':'%'+_0x5c6aa1[_0xa542('0x2b')][_0xa542('0x37')]+'%'};return _0x5313c5;}})});}_0x549111=_['merge']({},_0x549111,_0x5c6aa1[_0xa542('0x3a')]);var _0x4008a6={'where':_0x549111[_0xa542('0x35')]};return db[_0xa542('0x27')]['count'](_0x4008a6)[_0xa542('0x3b')](function(_0x309b8c){_0x1f6e85['count']=_0x309b8c;if(_0x5c6aa1[_0xa542('0x2b')][_0xa542('0x3c')]){_0x549111['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0xa542('0x3d')](_0x549111);})[_0xa542('0x3b')](function(_0x4020dd){_0x1f6e85[_0xa542('0x3e')]=_0x4020dd;return _0x1f6e85;})[_0xa542('0x3b')](respondWithFilteredResult(_0x1e8efd,_0x549111))['catch'](handleError(_0x1e8efd,null));};exports['show']=function(_0x30358e,_0x2eb230){var _0x3ca8f9={'raw':!![],'where':{'id':_0x30358e['params']['id']}},_0xb49342={};_0xb49342[_0xa542('0x2e')]=_[_0xa542('0x2c')](db[_0xa542('0x27')][_0xa542('0x28')]);_0xb49342[_0xa542('0x2b')]=_[_0xa542('0x2c')](_0x30358e['query']);_0xb49342[_0xa542('0x2d')]=_[_0xa542('0x3f')](_0xb49342['model'],_0xb49342[_0xa542('0x2b')]);_0x3ca8f9['attributes']=_[_0xa542('0x3f')](_0xb49342['model'],qs[_0xa542('0x30')](_0x30358e[_0xa542('0x2b')]['fields']));_0x3ca8f9[_0xa542('0x2f')]=_0x3ca8f9[_0xa542('0x2f')][_0xa542('0x31')]?_0x3ca8f9[_0xa542('0x2f')]:_0xb49342[_0xa542('0x2e')];if(_0x30358e[_0xa542('0x2b')]['includeAll']){_0x3ca8f9[_0xa542('0x40')]=[{'all':!![]}];}_0x3ca8f9=_[_0xa542('0x38')]({},_0x3ca8f9,_0x30358e[_0xa542('0x3a')]);return db['JscriptySessionReport'][_0xa542('0x41')](_0x3ca8f9)['then'](handleEntityNotFound(_0x2eb230,null))['then'](respondWithResult(_0x2eb230,null))[_0xa542('0x42')](handleError(_0x2eb230,null));};exports[_0xa542('0x43')]=function(_0x517adc,_0x418255){return db[_0xa542('0x27')]['create'](_0x517adc['body'],{})[_0xa542('0x3b')](respondWithResult(_0x418255,0xc9))[_0xa542('0x42')](handleError(_0x418255,null));};exports[_0xa542('0x44')]=function(_0x2d1c63,_0x321b78){if(_0x2d1c63[_0xa542('0x45')]['id']){delete _0x2d1c63[_0xa542('0x45')]['id'];}return db[_0xa542('0x27')]['find']({'where':{'id':_0x2d1c63[_0xa542('0x46')]['id']}})[_0xa542('0x3b')](handleEntityNotFound(_0x321b78,null))[_0xa542('0x3b')](saveUpdates(_0x2d1c63[_0xa542('0x45')],null))[_0xa542('0x3b')](respondWithResult(_0x321b78,null))[_0xa542('0x42')](handleError(_0x321b78,null));};exports[_0xa542('0x47')]=function(_0x530a39,_0x3f3e87){return db[_0xa542('0x27')][_0xa542('0x41')]({'where':{'id':_0x530a39['params']['id']}})[_0xa542('0x3b')](handleEntityNotFound(_0x3f3e87,null))[_0xa542('0x3b')](removeEntity(_0x3f3e87,null))['catch'](handleError(_0x3f3e87,null));};exports['describe']=function(_0x1f5df5,_0x33af4e){return db[_0xa542('0x27')][_0xa542('0x48')]()[_0xa542('0x3b')](respondWithResult(_0x33af4e,null))[_0xa542('0x42')](handleError(_0x33af4e,null));};exports[_0xa542('0x49')]=function(_0x3fe67b,_0x46ee98,_0x5e64a3){var _0x27a77f={'raw':!![],'where':{}};var _0x54a149={};var _0x503e6a={'count':0x0,'rows':[]};return db[_0xa542('0x27')][_0xa542('0x4a')]({'where':{'id':_0x3fe67b['params']['id']}})[_0xa542('0x3b')](handleEntityNotFound(_0x46ee98,null))[_0xa542('0x3b')](function(_0x4015fb){if(_0x4015fb){_0x54a149[_0xa542('0x2e')]=_[_0xa542('0x2c')](db[_0xa542('0x4b')][_0xa542('0x28')]);_0x54a149['query']=_['keys'](_0x3fe67b[_0xa542('0x2b')]);_0x54a149[_0xa542('0x2d')]=_['intersection'](_0x54a149['model'],_0x54a149[_0xa542('0x2b')]);_0x27a77f[_0xa542('0x2f')]=_[_0xa542('0x3f')](_0x54a149[_0xa542('0x2e')],qs['fields'](_0x3fe67b[_0xa542('0x2b')][_0xa542('0x30')]));_0x27a77f[_0xa542('0x2f')]=_0x27a77f[_0xa542('0x2f')]['length']?_0x27a77f[_0xa542('0x2f')]:_0x54a149[_0xa542('0x2e')];if(!_0x3fe67b[_0xa542('0x2b')][_0xa542('0x4c')](_0xa542('0x32'))){_0x27a77f[_0xa542('0x1d')]=qs[_0xa542('0x1d')](_0x3fe67b['query'][_0xa542('0x1d')]);_0x27a77f[_0xa542('0x1b')]=qs['offset'](_0x3fe67b[_0xa542('0x2b')][_0xa542('0x1b')]);}_0x27a77f[_0xa542('0x33')]=qs[_0xa542('0x34')](_0x3fe67b[_0xa542('0x2b')]['sort']);_0x27a77f[_0xa542('0x35')]=qs[_0xa542('0x2d')](_[_0xa542('0x36')](_0x3fe67b['query'],_0x54a149[_0xa542('0x2d')]));_0x27a77f[_0xa542('0x35')][_0xa542('0x4d')]=_0x4015fb['id'];if(_0x3fe67b[_0xa542('0x2b')]['filter']){_0x27a77f[_0xa542('0x35')]=_[_0xa542('0x38')](_0x27a77f[_0xa542('0x35')],{'$or':_[_0xa542('0x26')](_0x27a77f[_0xa542('0x2f')],function(_0x1e048c){var _0x4887d7={};_0x4887d7[_0x1e048c]={'$like':'%'+_0x3fe67b[_0xa542('0x2b')]['filter']+'%'};return _0x4887d7;})});}_0x27a77f=_[_0xa542('0x38')]({},_0x27a77f,_0x3fe67b[_0xa542('0x3a')]);return db[_0xa542('0x4b')][_0xa542('0x1e')]({'where':_0x27a77f['where']})[_0xa542('0x3b')](function(_0x2354bc){_0x503e6a[_0xa542('0x1e')]=_0x2354bc;if(_0x3fe67b[_0xa542('0x2b')]['includeAll']){_0x27a77f[_0xa542('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xa542('0x3d')](_0x27a77f);})['then'](function(_0x4bb43f){_0x503e6a['rows']=_0x4bb43f;return _0x503e6a;});}})[_0xa542('0x3b')](respondWithFilteredResult(_0x46ee98,_0x27a77f))[_0xa542('0x42')](handleError(_0x46ee98,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 362ad81..e83fbb3 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 _0x3c6c=['rimraf','../../config/environment','exports','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x759263,_0x25553e){_0x759263=_0x759263-0x0;var _0x402c17=_0x3c6c[_0x759263];return _0x402c17;};'use strict';var _=require(_0xc3c6('0x0'));var util=require('util');var logger=require(_0xc3c6('0x1'))(_0xc3c6('0x2'));var moment=require(_0xc3c6('0x3'));var BPromise=require(_0xc3c6('0x4'));var rp=require(_0xc3c6('0x5'));var fs=require('fs');var path=require(_0xc3c6('0x6'));var rimraf=require(_0xc3c6('0x7'));var config=require(_0xc3c6('0x8'));var attributes=require('./jscriptySessionReport.attributes');module[_0xc3c6('0x9')]=function(_0x4a2ca1,_0xe7731e){return _0x4a2ca1['define']('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7278=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports'];(function(_0x189808,_0x32bfa1){var _0x2a01c4=function(_0x25e337){while(--_0x25e337){_0x189808['push'](_0x189808['shift']());}};_0x2a01c4(++_0x32bfa1);}(_0x7278,0x161));var _0x8727=function(_0x3e1984,_0x1511e7){_0x3e1984=_0x3e1984-0x0;var _0x3edb61=_0x7278[_0x3e1984];return _0x3edb61;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));module[_0x8727('0xa')]=function(_0x180b71,_0x5549d5){return _0x180b71[_0x8727('0xb')](_0x8727('0xc'),attributes,{'tableName':_0x8727('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 166d36c..e5ef289 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68b3=['rpc','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x308daf,_0x540526){var _0x32fb9d=function(_0x86d1d5){while(--_0x86d1d5){_0x308daf['push'](_0x308daf['shift']());}};_0x32fb9d(++_0x540526);}(_0x68b3,0x1d8));var _0x368b=function(_0x597f3d,_0x49774f){_0x597f3d=_0x597f3d-0x0;var _0x255df6=_0x68b3[_0x597f3d];return _0x255df6;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});} \ No newline at end of file +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0xb725be,_0x45bd01){var _0x2f2424=function(_0x2566ca){while(--_0x2566ca){_0xb725be['push'](_0xb725be['shift']());}};_0x2f2424(++_0x45bd01);}(_0x524e,0x15e));var _0xe524=function(_0x289367,_0x121058){_0x289367=_0x289367-0x0;var _0x1e0dc6=_0x524e[_0x289367];return _0x1e0dc6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 081f80d..db6c3cb 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 _0xfd6e=['../../config/environment','index','put','/:id','isAuthenticated','update','multer','path','express','Router'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xfd6e,0x16e));var _0xefd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd6e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xefd6('0x0'));var util=require('util');var path=require(_0xefd6('0x1'));var timeout=require('connect-timeout');var express=require(_0xefd6('0x2'));var router=express[_0xefd6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xefd6('0x4'));var controller=require('./license.controller');router['get']('/',controller[_0xefd6('0x5')]);router[_0xefd6('0x6')](_0xefd6('0x7'),auth[_0xefd6('0x8')](),controller[_0xefd6('0x9')]);module['exports']=router; \ No newline at end of file +var _0x008c=['/:id','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put'];(function(_0x5489db,_0x31e7e0){var _0x269a6a=function(_0x26557d){while(--_0x26557d){_0x5489db['push'](_0x5489db['shift']());}};_0x269a6a(++_0x31e7e0);}(_0x008c,0x188));var _0xc008=function(_0x50856f,_0x262f2c){_0x50856f=_0x50856f-0x0;var _0x505ca2=_0x008c[_0x50856f];return _0x505ca2;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',controller[_0xc008('0xb')]);router[_0xc008('0xc')](_0xc008('0xd'),auth['isAuthenticated'](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 0794b80..debe2bb 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 _0x802c=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0xb4cc12,_0x41436e){var _0x8593b5=function(_0x13b840){while(--_0x13b840){_0xb4cc12['push'](_0xb4cc12['shift']());}};_0x8593b5(++_0x41436e);}(_0x802c,0x176));var _0xc802=function(_0x2aa2bd,_0xed3782){_0x2aa2bd=_0x2aa2bd-0x0;var _0x1bd661=_0x802c[_0x2aa2bd];return _0x1bd661;};'use strict';var Sequelize=require(_0xc802('0x0'));module[_0xc802('0x1')]={'license':{'type':Sequelize[_0xc802('0x2')]},'data1':{'type':Sequelize[_0xc802('0x3')]},'data2':{'type':Sequelize[_0xc802('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xc802('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x24ad=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x5d3600,_0x567ba2){var _0x23cac6=function(_0x2c638b){while(--_0x2c638b){_0x5d3600['push'](_0x5d3600['shift']());}};_0x23cac6(++_0x567ba2);}(_0x24ad,0x180));var _0xd24a=function(_0x34c622,_0x16beab){_0x34c622=_0x34c622-0x0;var _0x46ba00=_0x24ad[_0x34c622];return _0x46ba00;};'use strict';var Sequelize=require(_0xd24a('0x0'));module[_0xd24a('0x1')]={'license':{'type':Sequelize[_0xd24a('0x2')]},'data1':{'type':Sequelize[_0xd24a('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xd24a('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index ae5c5b7..d13720a 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 _0x814b=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','model','keys','rawAttributes','intersection','query','attributes','fields','length','merge','options','getLicense','catch','body','License','params','get','key','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','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/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x3c7090,_0x2721b4){var _0x6fc211=function(_0x55f2c8){while(--_0x55f2c8){_0x3c7090['push'](_0x3c7090['shift']());}};_0x6fc211(++_0x2721b4);}(_0x814b,0x1a2));var _0xb814=function(_0x415f7e,_0x4630b6){_0x415f7e=_0x415f7e-0x0;var _0x311ff4=_0x814b[_0x415f7e];return _0x311ff4;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}var utilLicense=require(_0xb814('0x19'));exports['index']=function(_0x9008b2,_0x37d24d){var _0x530744={'raw':!![],'where':{'id':0x1}},_0x499f22={};_0x499f22[_0xb814('0x2e')]=_[_0xb814('0x2f')](db['License'][_0xb814('0x30')]);_0x499f22['query']=_[_0xb814('0x2f')](_0x9008b2['query']);_0x499f22['filters']=_[_0xb814('0x31')](_0x499f22['model'],_0x499f22[_0xb814('0x32')]);_0x530744[_0xb814('0x33')]=_[_0xb814('0x31')](_0x499f22['model'],qs['fields'](_0x9008b2[_0xb814('0x32')][_0xb814('0x34')]));_0x530744['attributes']=_0x530744[_0xb814('0x33')][_0xb814('0x35')]?_0x530744[_0xb814('0x33')]:_0x499f22[_0xb814('0x2e')];_0x530744=_[_0xb814('0x36')]({},_0x530744,_0x9008b2[_0xb814('0x37')]);return utilLicense[_0xb814('0x38')](_0x530744)['then'](respondWithResult(_0x37d24d,null))[_0xb814('0x39')](handleError(_0x37d24d,null));};exports[_0xb814('0x27')]=function(_0x30de5a,_0x424e2b){if(_0x30de5a[_0xb814('0x3a')]['id']){delete _0x30de5a['body']['id'];}return db[_0xb814('0x3b')]['find']({'where':{'id':_0x30de5a[_0xb814('0x3c')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x424e2b,null))[_0xb814('0x28')](function(_0x492d5e){var _0x40b885=_0x492d5e[_0xb814('0x3d')]({'plain':!![]});return utilLicense['checkLicense'](_0x40b885,_0x30de5a[_0xb814('0x3a')][_0xb814('0x3e')]);})[_0xb814('0x28')](function(_0x1f7cd8){if(!_0x1f7cd8[_0xb814('0x3f')]){return saveUpdates(_0x30de5a[_0xb814('0x3a')],null);}return _0x1f7cd8;})['then'](respondWithResult(_0x424e2b,null))[_0xb814('0x39')](handleError(_0x424e2b,null));}; \ No newline at end of file +var _0x1967=['params','checkLicense','key','demo','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','index','model','keys','rawAttributes','query','intersection','attributes','fields','merge','getLicense','body','find'];(function(_0x3fd3d3,_0x5c6eba){var _0x5288b9=function(_0x133fed){while(--_0x133fed){_0x3fd3d3['push'](_0x3fd3d3['shift']());}};_0x5288b9(++_0x5c6eba);}(_0x1967,0x173));var _0x7196=function(_0x6b7666,_0x2ee33f){_0x6b7666=_0x6b7666-0x0;var _0x45009c=_0x1967[_0x6b7666];return _0x45009c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}var utilLicense=require('../../config/license/util');exports[_0x7196('0x2c')]=function(_0x4ecea1,_0x4fd339){var _0x59d79d={'raw':!![],'where':{'id':0x1}},_0x30151f={};_0x30151f[_0x7196('0x2d')]=_[_0x7196('0x2e')](db['License'][_0x7196('0x2f')]);_0x30151f[_0x7196('0x30')]=_[_0x7196('0x2e')](_0x4ecea1[_0x7196('0x30')]);_0x30151f['filters']=_[_0x7196('0x31')](_0x30151f[_0x7196('0x2d')],_0x30151f[_0x7196('0x30')]);_0x59d79d[_0x7196('0x32')]=_[_0x7196('0x31')](_0x30151f[_0x7196('0x2d')],qs[_0x7196('0x33')](_0x4ecea1[_0x7196('0x30')][_0x7196('0x33')]));_0x59d79d[_0x7196('0x32')]=_0x59d79d[_0x7196('0x32')]['length']?_0x59d79d[_0x7196('0x32')]:_0x30151f['model'];_0x59d79d=_[_0x7196('0x34')]({},_0x59d79d,_0x4ecea1['options']);return utilLicense[_0x7196('0x35')](_0x59d79d)[_0x7196('0x27')](respondWithResult(_0x4fd339,null))['catch'](handleError(_0x4fd339,null));};exports[_0x7196('0x26')]=function(_0x2bcadd,_0x4531d7){if(_0x2bcadd[_0x7196('0x36')]['id']){delete _0x2bcadd[_0x7196('0x36')]['id'];}return db['License'][_0x7196('0x37')]({'where':{'id':_0x2bcadd[_0x7196('0x38')]['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x4531d7,null))[_0x7196('0x27')](function(_0x3e8f98){var _0x123cad=_0x3e8f98['get']({'plain':!![]});return utilLicense[_0x7196('0x39')](_0x123cad,_0x2bcadd[_0x7196('0x36')][_0x7196('0x3a')]);})['then'](function(_0x33831a){if(!_0x33831a[_0x7196('0x3b')]){return saveUpdates(_0x2bcadd[_0x7196('0x36')],null);}return _0x33831a;})[_0x7196('0x27')](respondWithResult(_0x4531d7,null))[_0x7196('0x3c')](handleError(_0x4531d7,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 00d7725..ca5e186 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 _0x7bc5=['license','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./license.attributes','define','License'];(function(_0x1eff7c,_0x357ad0){var _0x304854=function(_0x27f760){while(--_0x27f760){_0x1eff7c['push'](_0x1eff7c['shift']());}};_0x304854(++_0x357ad0);}(_0x7bc5,0x109));var _0x57bc=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0x7bc5[_0x3b76f7];return _0x43984e;};'use strict';var _=require(_0x57bc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x57bc('0x1'));var moment=require(_0x57bc('0x2'));var BPromise=require(_0x57bc('0x3'));var rp=require(_0x57bc('0x4'));var fs=require('fs');var path=require(_0x57bc('0x5'));var rimraf=require('rimraf');var config=require(_0x57bc('0x6'));var attributes=require(_0x57bc('0x7'));module['exports']=function(_0x53841e,_0x350a86){return _0x53841e[_0x57bc('0x8')](_0x57bc('0x9'),attributes,{'tableName':_0x57bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29a9=['./license.attributes','define','License','license','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0x29a9,0x19c));var _0x929a=function(_0x50068c,_0x38a87a){_0x50068c=_0x50068c-0x0;var _0x11826a=_0x29a9[_0x50068c];return _0x11826a;};'use strict';var _=require(_0x929a('0x0'));var util=require('util');var logger=require(_0x929a('0x1'))(_0x929a('0x2'));var moment=require(_0x929a('0x3'));var BPromise=require(_0x929a('0x4'));var rp=require(_0x929a('0x5'));var fs=require('fs');var path=require(_0x929a('0x6'));var rimraf=require('rimraf');var config=require(_0x929a('0x7'));var attributes=require(_0x929a('0x8'));module['exports']=function(_0x4cedbd,_0x593cd9){return _0x4cedbd[_0x929a('0x9')](_0x929a('0xa'),attributes,{'tableName':_0x929a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index c5aee29..4be7963 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 _0x0fe9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment'];(function(_0x3b8c2f,_0x213377){var _0x2b9515=function(_0x525a9e){while(--_0x525a9e){_0x3b8c2f['push'](_0x3b8c2f['shift']());}};_0x2b9515(++_0x213377);}(_0x0fe9,0xcc));var _0x90fe=function(_0x32f7d1,_0x22b59a){_0x32f7d1=_0x32f7d1-0x0;var _0x55b2e2=_0x0fe9[_0x32f7d1];return _0x55b2e2;};'use strict';var _=require(_0x90fe('0x0'));var util=require(_0x90fe('0x1'));var moment=require(_0x90fe('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90fe('0x3'));var db=require(_0x90fe('0x4'))['db'];var utils=require(_0x90fe('0x5'));var logger=require(_0x90fe('0x6'))(_0x90fe('0x7'));var config=require(_0x90fe('0x8'));var jayson=require(_0x90fe('0x9'));var client=jayson[_0x90fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2564b4,_0x584367,_0x1c7a8a){return new BPromise(function(_0x17ab72,_0x171527){return client['request'](_0x2564b4,_0x1c7a8a)[_0x90fe('0xb')](function(_0x17f535){logger[_0x90fe('0xc')](_0x90fe('0xd'),_0x584367,'request\x20sent');logger[_0x90fe('0xe')](_0x90fe('0xf'),_0x584367,'request\x20sent',JSON[_0x90fe('0x10')](_0x17f535));if(_0x17f535[_0x90fe('0x11')]){if(_0x17f535[_0x90fe('0x11')][_0x90fe('0x12')]===0x1f4){logger[_0x90fe('0x11')]('License,\x20%s,\x20%s',_0x584367,_0x17f535[_0x90fe('0x11')][_0x90fe('0x13')]);return _0x171527(_0x17f535[_0x90fe('0x11')][_0x90fe('0x13')]);}logger[_0x90fe('0x11')]('License,\x20%s,\x20%s',_0x584367,_0x17f535[_0x90fe('0x11')][_0x90fe('0x13')]);return _0x17ab72(_0x17f535[_0x90fe('0x11')]['message']);}else{logger['info']('License,\x20%s,\x20%s',_0x584367,_0x90fe('0x14'));_0x17ab72(_0x17f535[_0x90fe('0x15')]['message']);}})[_0x90fe('0x16')](function(_0x6df538){logger[_0x90fe('0x11')](_0x90fe('0xd'),_0x584367,_0x6df538);_0x171527(_0x6df538);});});} \ No newline at end of file +var _0x5afb=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5afb,0x1c9));var _0xb5af=function(_0x45aa72,_0x8af642){_0x45aa72=_0x45aa72-0x0;var _0x75adaa=_0x5afb[_0x45aa72];return _0x75adaa;};'use strict';var _=require(_0xb5af('0x0'));var util=require(_0xb5af('0x1'));var moment=require('moment');var BPromise=require(_0xb5af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb5af('0x3'))['db'];var utils=require(_0xb5af('0x4'));var logger=require(_0xb5af('0x5'))(_0xb5af('0x6'));var config=require(_0xb5af('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb5af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f882c,_0x37eb00,_0x871eb5){return new BPromise(function(_0x2910c4,_0x3d4870){return client[_0xb5af('0x9')](_0x3f882c,_0x871eb5)[_0xb5af('0xa')](function(_0x23c788){logger['info'](_0xb5af('0xb'),_0x37eb00,_0xb5af('0xc'));logger[_0xb5af('0xd')](_0xb5af('0xe'),_0x37eb00,'request\x20sent',JSON[_0xb5af('0xf')](_0x23c788));if(_0x23c788[_0xb5af('0x10')]){if(_0x23c788['error']['code']===0x1f4){logger[_0xb5af('0x10')](_0xb5af('0xb'),_0x37eb00,_0x23c788['error'][_0xb5af('0x11')]);return _0x3d4870(_0x23c788['error'][_0xb5af('0x11')]);}logger[_0xb5af('0x10')](_0xb5af('0xb'),_0x37eb00,_0x23c788[_0xb5af('0x10')]['message']);return _0x2910c4(_0x23c788['error'][_0xb5af('0x11')]);}else{logger[_0xb5af('0x12')](_0xb5af('0xb'),_0x37eb00,_0xb5af('0xc'));_0x2910c4(_0x23c788[_0xb5af('0x13')][_0xb5af('0x11')]);}})['catch'](function(_0x26a23e){logger[_0xb5af('0x10')](_0xb5af('0xb'),_0x37eb00,_0x26a23e);_0x3d4870(_0x26a23e);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index ae62b5e..8831b97 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 _0xd324=['delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','addDisposition','post','addAnswer','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','put','update'];(function(_0x57b34e,_0x216f8f){var _0x59b002=function(_0x4fb8f9){while(--_0x4fb8f9){_0x57b34e['push'](_0x57b34e['shift']());}};_0x59b002(++_0x216f8f);}(_0xd324,0x1dd));var _0x4d32=function(_0x6942e0,_0x131e6d){_0x6942e0=_0x6942e0-0x0;var _0xb86490=_0xd324[_0x6942e0];return _0xb86490;};'use strict';var multer=require('multer');var util=require(_0x4d32('0x0'));var path=require(_0x4d32('0x1'));var timeout=require(_0x4d32('0x2'));var express=require(_0x4d32('0x3'));var router=express[_0x4d32('0x4')]();var fs_extra=require(_0x4d32('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4d32('0x6'));var config=require(_0x4d32('0x7'));var controller=require(_0x4d32('0x8'));router[_0x4d32('0x9')]('/',auth[_0x4d32('0xa')](),controller['index']);router['get'](_0x4d32('0xb'),auth['isAuthenticated'](),controller[_0x4d32('0xc')]);router[_0x4d32('0x9')](_0x4d32('0xd'),auth[_0x4d32('0xa')](),controller[_0x4d32('0xe')]);router[_0x4d32('0x9')](_0x4d32('0xf'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x10')]);router[_0x4d32('0x9')](_0x4d32('0x11'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x12')]);router[_0x4d32('0x9')](_0x4d32('0x13'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x14')]);router['get'](_0x4d32('0x15'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x16')]);router[_0x4d32('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0x4d32('0x17'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x18')]);router[_0x4d32('0x9')](_0x4d32('0x19'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x1a')]);router[_0x4d32('0x9')]('/:id/verify',auth['isAuthenticated'](),controller['verifySmtp']);router['get'](_0x4d32('0x1b'),auth['isAuthenticated'](),controller[_0x4d32('0x1c')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4d32('0x1d')]);router[_0x4d32('0x1e')](_0x4d32('0x11'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x1f')]);router[_0x4d32('0x1e')]('/',auth[_0x4d32('0xa')](),controller['create']);router[_0x4d32('0x1e')](_0x4d32('0x13'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x20')]);router[_0x4d32('0x1e')](_0x4d32('0x15'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x21')]);router[_0x4d32('0x1e')]('/:id/interactions',auth[_0x4d32('0xa')](),controller[_0x4d32('0x22')]);router[_0x4d32('0x1e')](_0x4d32('0x17'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x23')]);router[_0x4d32('0x1e')](_0x4d32('0x24'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x25')]);router[_0x4d32('0x1e')](_0x4d32('0x1b'),auth[_0x4d32('0xa')](),controller['addAgents']);router[_0x4d32('0x26')](_0x4d32('0xd'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x27')]);router[_0x4d32('0x28')](_0x4d32('0xf'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x29')]);router['delete'](_0x4d32('0x11'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x2a')]);router[_0x4d32('0x28')](_0x4d32('0x13'),auth['isAuthenticated'](),controller[_0x4d32('0x2b')]);router['delete'](_0x4d32('0x15'),auth['isAuthenticated'](),controller[_0x4d32('0x2c')]);router[_0x4d32('0x28')](_0x4d32('0xd'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x2d')]);router['delete'](_0x4d32('0x1b'),auth['isAuthenticated'](),controller[_0x4d32('0x2e')]);module['exports']=router; \ No newline at end of file +var _0xbafc=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1c8fb9,_0x251cb6){var _0x10ac95=function(_0x1d26ea){while(--_0x1d26ea){_0x1c8fb9['push'](_0x1c8fb9['shift']());}};_0x10ac95(++_0x251cb6);}(_0xbafc,0x102));var _0xcbaf=function(_0xd2f4ac,_0x5aa8e5){_0xd2f4ac=_0xd2f4ac-0x0;var _0x9757b2=_0xbafc[_0xd2f4ac];return _0x9757b2;};'use strict';var multer=require(_0xcbaf('0x0'));var util=require(_0xcbaf('0x1'));var path=require(_0xcbaf('0x2'));var timeout=require(_0xcbaf('0x3'));var express=require(_0xcbaf('0x4'));var router=express[_0xcbaf('0x5')]();var fs_extra=require(_0xcbaf('0x6'));var auth=require(_0xcbaf('0x7'));var interaction=require(_0xcbaf('0x8'));var config=require(_0xcbaf('0x9'));var controller=require('./mailAccount.controller');router[_0xcbaf('0xa')]('/',auth[_0xcbaf('0xb')](),controller['index']);router['get'](_0xcbaf('0xc'),auth['isAuthenticated'](),controller[_0xcbaf('0xd')]);router[_0xcbaf('0xa')](_0xcbaf('0xe'),auth[_0xcbaf('0xb')](),controller[_0xcbaf('0xf')]);router[_0xcbaf('0xa')](_0xcbaf('0x10'),auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x11')]);router[_0xcbaf('0xa')](_0xcbaf('0x12'),auth[_0xcbaf('0xb')](),controller['getAnswers']);router[_0xcbaf('0xa')](_0xcbaf('0x13'),auth[_0xcbaf('0xb')](),controller['getImap']);router[_0xcbaf('0xa')](_0xcbaf('0x14'),auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x15')]);router['get']('/:id/interactions',auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x16')]);router['get'](_0xcbaf('0x17'),auth['isAuthenticated'](),controller[_0xcbaf('0x18')]);router['get']('/:id/messages',auth[_0xcbaf('0xb')](),controller['getMessages']);router['get'](_0xcbaf('0x19'),auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x1a')]);router[_0xcbaf('0xa')](_0xcbaf('0x1b'),auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x1c')]);router[_0xcbaf('0x1d')](_0xcbaf('0x10'),auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x1e')]);router[_0xcbaf('0x1d')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xcbaf('0x1f')]);router[_0xcbaf('0x1d')]('/',auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x20')]);router[_0xcbaf('0x1d')](_0xcbaf('0x13'),auth[_0xcbaf('0xb')](),controller['addImap']);router['post'](_0xcbaf('0x14'),auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x21')]);router['post'](_0xcbaf('0x22'),auth['isAuthenticated'](),controller[_0xcbaf('0x23')]);router[_0xcbaf('0x1d')](_0xcbaf('0x17'),auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x24')]);router[_0xcbaf('0x1d')](_0xcbaf('0x25'),auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x26')]);router[_0xcbaf('0x1d')](_0xcbaf('0x1b'),auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x27')]);router[_0xcbaf('0x28')](_0xcbaf('0xe'),auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x29')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xcbaf('0x2a')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0xcbaf('0x2a')]('/:id/in_servers',auth['isAuthenticated'](),controller['removeImap']);router['delete'](_0xcbaf('0x14'),auth[_0xcbaf('0xb')](),controller['removeSmtp']);router[_0xcbaf('0x2a')](_0xcbaf('0xe'),auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x2b')]);router[_0xcbaf('0x2a')](_0xcbaf('0x1b'),auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x2c')]);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 af3dfe8..5e291ae 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 _0x851e=['TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN'];(function(_0x2b8983,_0x2c668b){var _0x2888a2=function(_0x26aee8){while(--_0x26aee8){_0x2b8983['push'](_0x2b8983['shift']());}};_0x2888a2(++_0x2c668b);}(_0x851e,0x1e8));var _0xe851=function(_0x4c55c2,_0x5dde7e){_0x4c55c2=_0x4c55c2-0x0;var _0x469bab=_0x851e[_0x4c55c2];return _0x469bab;};'use strict';var Sequelize=require(_0xe851('0x0'));module[_0xe851('0x1')]={'description':{'type':Sequelize[_0xe851('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xe851('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xe851('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xe851('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xe851('0x4')]},'markAsUnread':{'type':Sequelize[_0xe851('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe851('0x5')},'fontSize':{'type':Sequelize[_0xe851('0x6')](0x2)[_0xe851('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe851('0x4')],'defaultValue':function(){return _0xe851('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe851('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe851('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe851('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe851('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe851('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe851('0x3')],'defaultValue':![],'comment':_0xe851('0x9'),'set':function(_0x3d373c){if(!_0x3d373c)this['setDataValue'](_0xe851('0xa'),null);this['setDataValue'](_0xe851('0xb'),_0x3d373c);}}}; \ No newline at end of file +var _0xd847=['STRING','BOOLEAN','TEXT','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x129ee3,_0x5c37f7){var _0x9da975=function(_0x4ea2ca){while(--_0x4ea2ca){_0x129ee3['push'](_0x129ee3['shift']());}};_0x9da975(++_0x5c37f7);}(_0xd847,0x18a));var _0x7d84=function(_0x237a75,_0x282c1b){_0x237a75=_0x237a75-0x0;var _0x1f4e3e=_0xd847[_0x237a75];return _0x1f4e3e;};'use strict';var Sequelize=require(_0x7d84('0x0'));module[_0x7d84('0x1')]={'description':{'type':Sequelize[_0x7d84('0x2')]},'name':{'type':Sequelize[_0x7d84('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x7d84('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x7d84('0x4')]},'markAsUnread':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7d84('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x7d84('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7d84('0x4')],'defaultValue':function(){return _0x7d84('0x6');}},'notificationSound':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7d84('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x7d84('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':![],'comment':_0x7d84('0x8'),'set':function(_0x27aa7a){if(!_0x27aa7a)this[_0x7d84('0x9')](_0x7d84('0xa'),null);this[_0x7d84('0x9')](_0x7d84('0xb'),_0x27aa7a);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index f085b15..bcd9b1c 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 _0x21c1=['split','format','inlineCss','true','List','CmContact','Contacts','updatedAt','DESC','from','attachments','root','server/files/attachments','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','html-to-text','juice','../../components/auth/service','../../components/parsers/advancedSearch','api','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','get','MailAccounts','stack','name','index','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','MailAccount','includeAll','findAll','rows','show','params','fields','length','include','options','find','body','Pause','describe','addDisposition','MailAccountId','create','getDispositions','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','cpassword','authentication','host','port','service','password','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','send','getApplications','getMessages','$gte'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x21c1,0xef));var _0x121c=function(_0xd18a37,_0x1ef0ce){_0xd18a37=_0xd18a37-0x0;var _0x235fd0=_0x21c1[_0xd18a37];return _0x235fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x121c('0x0'));var jsonpatch=require(_0x121c('0x1'));var rp=require(_0x121c('0x2'));var moment=require(_0x121c('0x3'));var BPromise=require(_0x121c('0x4'));var Mustache=require(_0x121c('0x5'));var util=require('util');var path=require(_0x121c('0x6'));var sox=require(_0x121c('0x7'));var csv=require(_0x121c('0x8'));var ejs=require(_0x121c('0x9'));var fs=require('fs');var fs_extra=require(_0x121c('0xa'));var _=require('lodash');var squel=require(_0x121c('0xb'));var crypto=require('crypto');var jsforce=require(_0x121c('0xc'));var deskjs=require(_0x121c('0xd'));var toCsv=require(_0x121c('0x8'));var querystring=require(_0x121c('0xe'));var Papa=require(_0x121c('0xf'));var htmlToText=require(_0x121c('0x10'));var juice=require(_0x121c('0x11'));var Redis=require('ioredis');var authService=require(_0x121c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x121c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x121c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x121c('0x15'))['db'];config[_0x121c('0x16')]=_['defaults'](config['redis'],{'host':_0x121c('0x17'),'port':0x18eb});var socket=require(_0x121c('0x18'))(new Redis(config[_0x121c('0x16')]));require('./mailAccount.socket')[_0x121c('0x19')](socket);var jayson=require(_0x121c('0x1a'));var client=jayson[_0x121c('0x1b')][_0x121c('0x1c')]({'port':0x232b});function respondWithRpcPromise(_0x4743fd,_0x30397,_0x1bffb6,_0x5597cb){return new BPromise(function(_0x2005e0,_0x4c3848){var _0x212b09=_0x5597cb||client;return _0x212b09[_0x121c('0x1d')](_0x4743fd,_0x1bffb6)[_0x121c('0x1e')](function(_0x115b32){logger[_0x121c('0x1f')](_0x121c('0x20'),_0x30397,_0x121c('0x21'));logger['debug'](_0x121c('0x22'),_0x30397,_0x121c('0x21'),JSON['stringify'](_0x115b32));if(_0x115b32[_0x121c('0x23')]){if(_0x115b32[_0x121c('0x23')][_0x121c('0x24')]===0x1f4){logger[_0x121c('0x23')]('MailAccount,\x20%s,\x20%s',_0x30397,_0x115b32['error'][_0x121c('0x25')]);return _0x4c3848(_0x115b32[_0x121c('0x23')][_0x121c('0x25')]);}logger[_0x121c('0x23')](_0x121c('0x20'),_0x30397,_0x115b32[_0x121c('0x23')][_0x121c('0x25')]);return _0x2005e0(_0x115b32[_0x121c('0x23')][_0x121c('0x25')]);}else{logger[_0x121c('0x1f')]('MailAccount,\x20%s,\x20%s',_0x30397,_0x121c('0x21'));_0x2005e0(_0x115b32[_0x121c('0x26')][_0x121c('0x25')]);}})[_0x121c('0x27')](function(_0x2f249d){logger['error'](_0x121c('0x20'),_0x30397,_0x2f249d);_0x4c3848(_0x2f249d);});});}function respondWithStatusCode(_0x51a5fe,_0x48dc1d){_0x48dc1d=_0x48dc1d||0xcc;return function(_0x162db0){if(_0x162db0){return _0x51a5fe[_0x121c('0x28')](_0x48dc1d);}return _0x51a5fe[_0x121c('0x29')](_0x48dc1d)[_0x121c('0x2a')]();};}function respondWithResult(_0x3db652,_0x4d4c3a){_0x4d4c3a=_0x4d4c3a||0xc8;return function(_0xdc4038){if(_0xdc4038){return _0x3db652[_0x121c('0x29')](_0x4d4c3a)['json'](_0xdc4038);}};}function respondWithFilteredResult(_0x3b2f4d,_0x225a4d){return function(_0x4d18e6){if(_0x4d18e6){var _0x2547d5=typeof _0x225a4d[_0x121c('0x2b')]===_0x121c('0x2c')&&typeof _0x225a4d[_0x121c('0x2d')]===_0x121c('0x2c');var _0x57895d=_0x4d18e6[_0x121c('0x2e')];var _0x4e9948=_0x2547d5?0x0:_0x225a4d['offset'];var _0x3d1d17=_0x2547d5?_0x4d18e6[_0x121c('0x2e')]:_0x225a4d[_0x121c('0x2b')]+_0x225a4d[_0x121c('0x2d')];var _0x13ba61;if(_0x3d1d17>=_0x57895d){_0x3d1d17=_0x57895d;_0x13ba61=0xc8;}else{_0x13ba61=0xce;}_0x3b2f4d[_0x121c('0x29')](_0x13ba61);return _0x3b2f4d[_0x121c('0x2f')]('Content-Range',_0x4e9948+'-'+_0x3d1d17+'/'+_0x57895d)[_0x121c('0x30')](_0x4d18e6);}return null;};}function patchUpdates(_0x517a8c){return function(_0x13ce3c){try{jsonpatch[_0x121c('0x31')](_0x13ce3c,_0x517a8c,!![]);}catch(_0x20b69b){return BPromise[_0x121c('0x32')](_0x20b69b);}return _0x13ce3c[_0x121c('0x33')]();};}function saveUpdates(_0x2d818,_0x38f374){return function(_0xf70a22){if(_0xf70a22){return _0xf70a22[_0x121c('0x34')](_0x2d818)['then'](function(_0x2afe08){return _0x2afe08;});}return null;};}function removeEntity(_0x49b157,_0x1686c6){return function(_0x5be135){if(_0x5be135){return _0x5be135[_0x121c('0x35')]()[_0x121c('0x1e')](function(){var _0x4cd91b=_0x5be135[_0x121c('0x36')]({'plain':!![]});var _0x370f72=_0x121c('0x37');return db['UserProfileResource'][_0x121c('0x35')]({'where':{'type':_0x370f72,'resourceId':_0x4cd91b['id']}})[_0x121c('0x1e')](function(){return _0x5be135;});})[_0x121c('0x1e')](function(){_0x49b157[_0x121c('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e4b4d,_0x36374e){return function(_0x1d824c){if(!_0x1d824c){_0x5e4b4d[_0x121c('0x28')](0x194);}return _0x1d824c;};}function handleError(_0x3cb863,_0x1ac13b){_0x1ac13b=_0x1ac13b||0x1f4;return function(_0xc8e43b){logger[_0x121c('0x23')](_0xc8e43b[_0x121c('0x38')]);if(_0xc8e43b[_0x121c('0x39')]){delete _0xc8e43b[_0x121c('0x39')];}_0x3cb863[_0x121c('0x29')](_0x1ac13b)['send'](_0xc8e43b);};}exports[_0x121c('0x3a')]=function(_0x59078a,_0x4efe0e){var _0x87ee6f={'include':[{'model':db[_0x121c('0x3b')],'as':_0x121c('0x3c')},{'model':db[_0x121c('0x3d')],'as':_0x121c('0x3e')},{'model':db['Pause'],'as':_0x121c('0x3f')}]},_0x3a69be={},_0x4d58dc={'count':0x0,'rows':[]};var _0x550426=_[_0x121c('0x40')](db['MailAccount'][_0x121c('0x41')],function(_0x408016){return{'name':_0x408016[_0x121c('0x42')],'type':_0x408016[_0x121c('0x43')][_0x121c('0x44')]};});_0x3a69be[_0x121c('0x45')]=_[_0x121c('0x40')](_0x550426,'name');_0x3a69be[_0x121c('0x46')]=_[_0x121c('0x47')](_0x59078a[_0x121c('0x46')]);_0x3a69be[_0x121c('0x48')]=_[_0x121c('0x49')](_0x3a69be[_0x121c('0x45')],_0x3a69be[_0x121c('0x46')]);_0x87ee6f['attributes']=_[_0x121c('0x49')](_0x3a69be['model'],qs['fields'](_0x59078a['query']['fields']));_0x87ee6f[_0x121c('0x4a')]=_0x87ee6f['attributes']['length']?_0x87ee6f[_0x121c('0x4a')]:_0x3a69be[_0x121c('0x45')];if(!_0x59078a['query'][_0x121c('0x4b')](_0x121c('0x4c'))){_0x87ee6f[_0x121c('0x2d')]=qs[_0x121c('0x2d')](_0x59078a['query'][_0x121c('0x2d')]);_0x87ee6f['offset']=qs['offset'](_0x59078a[_0x121c('0x46')][_0x121c('0x2b')]);}_0x87ee6f[_0x121c('0x4d')]=qs[_0x121c('0x4e')](_0x59078a['query'][_0x121c('0x4e')]);_0x87ee6f[_0x121c('0x4f')]=qs['filters'](_[_0x121c('0x50')](_0x59078a['query'],_0x3a69be['filters']),_0x550426);if(_0x59078a['query'][_0x121c('0x51')]){_0x87ee6f[_0x121c('0x4f')]=_[_0x121c('0x52')](_0x87ee6f['where'],{'$or':_[_0x121c('0x40')](_0x550426,function(_0x26e003){if(_0x26e003[_0x121c('0x43')]!==_0x121c('0x53')){var _0x380ffc={};_0x380ffc[_0x26e003[_0x121c('0x39')]]={'$like':'%'+_0x59078a['query'][_0x121c('0x51')]+'%'};return _0x380ffc;}})});}_0x87ee6f=_[_0x121c('0x52')]({},_0x87ee6f,_0x59078a['options']);var _0x399f12={'where':_0x87ee6f[_0x121c('0x4f')]};return db[_0x121c('0x54')][_0x121c('0x2e')](_0x399f12)[_0x121c('0x1e')](function(_0x3d3c75){_0x4d58dc[_0x121c('0x2e')]=_0x3d3c75;if(_0x59078a[_0x121c('0x46')][_0x121c('0x55')]){_0x87ee6f['include']=[{'all':!![]}];}return db[_0x121c('0x54')][_0x121c('0x56')](_0x87ee6f);})[_0x121c('0x1e')](function(_0x18eafb){_0x4d58dc[_0x121c('0x57')]=_0x18eafb;return _0x4d58dc;})[_0x121c('0x1e')](respondWithFilteredResult(_0x4efe0e,_0x87ee6f))[_0x121c('0x27')](handleError(_0x4efe0e,null));};exports[_0x121c('0x58')]=function(_0x11d7a3,_0x26ef43){var _0x2eee8e={'raw':![],'where':{'id':_0x11d7a3[_0x121c('0x59')]['id']},'include':[{'model':db[_0x121c('0x3b')],'as':'Imap'},{'model':db[_0x121c('0x3d')],'as':_0x121c('0x3e')},{'model':db['Pause'],'as':_0x121c('0x3f')}]},_0x76e16d={};_0x76e16d[_0x121c('0x45')]=_[_0x121c('0x47')](db[_0x121c('0x54')]['rawAttributes']);_0x76e16d['query']=_[_0x121c('0x47')](_0x11d7a3[_0x121c('0x46')]);_0x76e16d[_0x121c('0x48')]=_['intersection'](_0x76e16d[_0x121c('0x45')],_0x76e16d['query']);_0x2eee8e[_0x121c('0x4a')]=_['intersection'](_0x76e16d['model'],qs[_0x121c('0x5a')](_0x11d7a3[_0x121c('0x46')][_0x121c('0x5a')]));_0x2eee8e[_0x121c('0x4a')]=_0x2eee8e['attributes'][_0x121c('0x5b')]?_0x2eee8e['attributes']:_0x76e16d[_0x121c('0x45')];if(_0x11d7a3[_0x121c('0x46')][_0x121c('0x55')]){_0x2eee8e[_0x121c('0x5c')]=[{'all':!![]}];}_0x2eee8e=_['merge']({},_0x2eee8e,_0x11d7a3[_0x121c('0x5d')]);return db[_0x121c('0x54')][_0x121c('0x5e')](_0x2eee8e)[_0x121c('0x1e')](handleEntityNotFound(_0x26ef43,null))[_0x121c('0x1e')](respondWithResult(_0x26ef43,null))[_0x121c('0x27')](handleError(_0x26ef43,null));};exports[_0x121c('0x34')]=function(_0x4a7d18,_0x47f38b){if(_0x4a7d18[_0x121c('0x5f')]['id']){delete _0x4a7d18[_0x121c('0x5f')]['id'];}return db[_0x121c('0x54')][_0x121c('0x5e')]({'where':{'id':_0x4a7d18['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x121c('0x3c')},{'model':db['MailServerOut'],'as':_0x121c('0x3e')},{'model':db[_0x121c('0x60')],'as':'mandatoryDispositionPause'}]})[_0x121c('0x1e')](handleEntityNotFound(_0x47f38b,null))[_0x121c('0x1e')](saveUpdates(_0x4a7d18[_0x121c('0x5f')],null))[_0x121c('0x1e')](function(_0x40f54c){if(_0x40f54c&&_0x4a7d18[_0x121c('0x5f')][_0x121c('0x3c')]){return db['MailServerIn'][_0x121c('0x34')](_0x4a7d18[_0x121c('0x5f')]['Imap'],{'where':{'MailAccountId':_0x40f54c['id']}})[_0x121c('0x1e')](function(){return _0x40f54c;});}return _0x40f54c;})['then'](function(_0xd11beb){if(_0xd11beb&&_0x4a7d18[_0x121c('0x5f')][_0x121c('0x3e')]){return db['MailServerOut']['update'](_0x4a7d18[_0x121c('0x5f')][_0x121c('0x3e')],{'where':{'MailAccountId':_0xd11beb['id']}})[_0x121c('0x1e')](function(){return _0xd11beb;});}return _0xd11beb;})[_0x121c('0x1e')](respondWithResult(_0x47f38b,null))[_0x121c('0x27')](handleError(_0x47f38b,null));};exports[_0x121c('0x61')]=function(_0x2d3c7c,_0x522323){return db[_0x121c('0x54')][_0x121c('0x61')]()['then'](respondWithResult(_0x522323,null))[_0x121c('0x27')](handleError(_0x522323,null));};exports[_0x121c('0x62')]=function(_0x55df7c,_0x5ebb24,_0x36c436){if(_0x55df7c[_0x121c('0x5f')]['id']){delete _0x55df7c['body']['id'];}return db[_0x121c('0x54')]['find']({'where':{'id':_0x55df7c[_0x121c('0x59')]['id']}})[_0x121c('0x1e')](handleEntityNotFound(_0x5ebb24,null))[_0x121c('0x1e')](function(_0x5c0637){if(_0x5c0637){_0x55df7c[_0x121c('0x5f')][_0x121c('0x63')]=_0x5c0637['id'];return db['Disposition'][_0x121c('0x64')](_0x55df7c[_0x121c('0x5f')]);}})['then'](respondWithResult(_0x5ebb24,null))['catch'](handleError(_0x5ebb24,null));};exports[_0x121c('0x65')]=function(_0x1ebb5b,_0x44b035,_0x5ac5ff){var _0x141027={'raw':![],'where':{}};var _0x1e6155={};var _0x199551={'count':0x0,'rows':[]};return db[_0x121c('0x54')]['findOne']({'where':{'id':_0x1ebb5b[_0x121c('0x59')]['id']}})[_0x121c('0x1e')](handleEntityNotFound(_0x44b035,null))[_0x121c('0x1e')](function(_0x193b96){if(_0x193b96){_0x1e6155['model']=_['keys'](db[_0x121c('0x66')][_0x121c('0x41')]);_0x1e6155[_0x121c('0x46')]=_[_0x121c('0x47')](_0x1ebb5b[_0x121c('0x46')]);_0x1e6155[_0x121c('0x48')]=_[_0x121c('0x49')](_0x1e6155[_0x121c('0x45')],_0x1e6155[_0x121c('0x46')]);_0x141027[_0x121c('0x4a')]=_[_0x121c('0x49')](_0x1e6155['model'],qs[_0x121c('0x5a')](_0x1ebb5b[_0x121c('0x46')][_0x121c('0x5a')]));_0x141027['attributes']=_0x141027[_0x121c('0x4a')]['length']?_0x141027[_0x121c('0x4a')]:_0x1e6155[_0x121c('0x45')];if(!_0x1ebb5b[_0x121c('0x46')][_0x121c('0x4b')](_0x121c('0x4c'))){_0x141027[_0x121c('0x2d')]=qs[_0x121c('0x2d')](_0x1ebb5b[_0x121c('0x46')]['limit']);_0x141027[_0x121c('0x2b')]=qs[_0x121c('0x2b')](_0x1ebb5b[_0x121c('0x46')]['offset']);}_0x141027[_0x121c('0x4d')]=qs[_0x121c('0x4e')](_0x1ebb5b[_0x121c('0x46')][_0x121c('0x4e')]);_0x141027['where']=qs[_0x121c('0x48')](_[_0x121c('0x50')](_0x1ebb5b['query'],_0x1e6155[_0x121c('0x48')]));_0x141027[_0x121c('0x4f')]['MailAccountId']=_0x193b96['id'];if(_0x1ebb5b['query']['filter']){_0x141027[_0x121c('0x4f')]=_[_0x121c('0x52')](_0x141027['where'],{'$or':_[_0x121c('0x40')](_0x141027[_0x121c('0x4a')],function(_0x43ec57){var _0x564e81={};_0x564e81[_0x43ec57]={'$like':'%'+_0x1ebb5b[_0x121c('0x46')]['filter']+'%'};return _0x564e81;})});}_0x141027=_[_0x121c('0x52')]({},_0x141027,_0x1ebb5b[_0x121c('0x5d')]);return db['Disposition']['count']({'where':_0x141027[_0x121c('0x4f')]})[_0x121c('0x1e')](function(_0x3beded){_0x199551['count']=_0x3beded;if(_0x1ebb5b['query'][_0x121c('0x55')]){_0x141027['include']=[{'all':!![]}];}return db[_0x121c('0x66')][_0x121c('0x56')](_0x141027);})['then'](function(_0x3324ec){_0x199551[_0x121c('0x57')]=_0x3324ec;return _0x199551;});}})[_0x121c('0x1e')](respondWithFilteredResult(_0x44b035,_0x141027))['catch'](handleError(_0x44b035,null));};exports['removeDispositions']=function(_0x11deb0,_0x38699a,_0x27c58a){return db[_0x121c('0x54')][_0x121c('0x5e')]({'where':{'id':_0x11deb0[_0x121c('0x59')]['id']}})[_0x121c('0x1e')](handleEntityNotFound(_0x38699a,null))[_0x121c('0x1e')](function(_0x112026){if(_0x112026){return _0x112026[_0x121c('0x67')](_0x11deb0['query'][_0x121c('0x68')]);}})['then'](respondWithStatusCode(_0x38699a,null))['catch'](handleError(_0x38699a,null));};exports[_0x121c('0x69')]=function(_0x423096,_0x2d4038,_0x494474){if(_0x423096[_0x121c('0x5f')]['id']){delete _0x423096[_0x121c('0x5f')]['id'];}return db[_0x121c('0x54')]['find']({'where':{'id':_0x423096[_0x121c('0x59')]['id']}})[_0x121c('0x1e')](handleEntityNotFound(_0x2d4038,null))['then'](function(_0x5ab323){if(_0x5ab323){_0x423096[_0x121c('0x5f')]['MailAccountId']=_0x5ab323['id'];return db[_0x121c('0x6a')]['create'](_0x423096[_0x121c('0x5f')]);}})[_0x121c('0x1e')](respondWithResult(_0x2d4038,null))[_0x121c('0x27')](handleError(_0x2d4038,null));};exports[_0x121c('0x6b')]=function(_0x5d5d02,_0x35d248,_0x25ac56){var _0x2d242e={'raw':![],'where':{}};var _0x457e06={};var _0x17d7a3={'count':0x0,'rows':[]};return db[_0x121c('0x54')][_0x121c('0x6c')]({'where':{'id':_0x5d5d02[_0x121c('0x59')]['id']}})[_0x121c('0x1e')](handleEntityNotFound(_0x35d248,null))['then'](function(_0x3ef097){if(_0x3ef097){_0x457e06['model']=_['keys'](db[_0x121c('0x6a')]['rawAttributes']);_0x457e06[_0x121c('0x46')]=_[_0x121c('0x47')](_0x5d5d02[_0x121c('0x46')]);_0x457e06[_0x121c('0x48')]=_[_0x121c('0x49')](_0x457e06[_0x121c('0x45')],_0x457e06[_0x121c('0x46')]);_0x2d242e['attributes']=_[_0x121c('0x49')](_0x457e06[_0x121c('0x45')],qs[_0x121c('0x5a')](_0x5d5d02[_0x121c('0x46')][_0x121c('0x5a')]));_0x2d242e['attributes']=_0x2d242e[_0x121c('0x4a')]['length']?_0x2d242e['attributes']:_0x457e06['model'];if(!_0x5d5d02[_0x121c('0x46')]['hasOwnProperty'](_0x121c('0x4c'))){_0x2d242e[_0x121c('0x2d')]=qs['limit'](_0x5d5d02[_0x121c('0x46')]['limit']);_0x2d242e[_0x121c('0x2b')]=qs[_0x121c('0x2b')](_0x5d5d02[_0x121c('0x46')][_0x121c('0x2b')]);}_0x2d242e[_0x121c('0x4d')]=qs['sort'](_0x5d5d02[_0x121c('0x46')][_0x121c('0x4e')]);_0x2d242e['where']=qs[_0x121c('0x48')](_[_0x121c('0x50')](_0x5d5d02['query'],_0x457e06[_0x121c('0x48')]));_0x2d242e[_0x121c('0x4f')]['MailAccountId']=_0x3ef097['id'];if(_0x5d5d02[_0x121c('0x46')]['filter']){_0x2d242e['where']=_[_0x121c('0x52')](_0x2d242e[_0x121c('0x4f')],{'$or':_[_0x121c('0x40')](_0x2d242e[_0x121c('0x4a')],function(_0x34811f){var _0x63e5fe={};_0x63e5fe[_0x34811f]={'$like':'%'+_0x5d5d02[_0x121c('0x46')][_0x121c('0x51')]+'%'};return _0x63e5fe;})});}_0x2d242e=_['merge']({},_0x2d242e,_0x5d5d02['options']);return db[_0x121c('0x6a')][_0x121c('0x2e')]({'where':_0x2d242e[_0x121c('0x4f')]})[_0x121c('0x1e')](function(_0x34062f){_0x17d7a3[_0x121c('0x2e')]=_0x34062f;if(_0x5d5d02[_0x121c('0x46')][_0x121c('0x55')]){_0x2d242e[_0x121c('0x5c')]=[{'all':!![]}];}return db[_0x121c('0x6a')]['findAll'](_0x2d242e);})[_0x121c('0x1e')](function(_0x6aa989){_0x17d7a3['rows']=_0x6aa989;return _0x17d7a3;});}})[_0x121c('0x1e')](respondWithFilteredResult(_0x35d248,_0x2d242e))[_0x121c('0x27')](handleError(_0x35d248,null));};exports[_0x121c('0x6d')]=function(_0x344187,_0x4ff859,_0x484fbd){return db[_0x121c('0x54')][_0x121c('0x5e')]({'where':{'id':_0x344187[_0x121c('0x59')]['id']}})['then'](handleEntityNotFound(_0x4ff859,null))['then'](function(_0x2c3ea6){if(_0x2c3ea6){return _0x2c3ea6[_0x121c('0x6d')](_0x344187[_0x121c('0x46')]['ids']);}})[_0x121c('0x1e')](respondWithStatusCode(_0x4ff859,null))[_0x121c('0x27')](handleError(_0x4ff859,null));};exports['create']=function(_0x19a3f2,_0x485d80){var _0x1e4c9e={'name':_0x19a3f2[_0x121c('0x5f')][_0x121c('0x39')],'key':_0x19a3f2['body']['key'],'email':_0x19a3f2[_0x121c('0x5f')][_0x121c('0x6e')],'ListId':_0x19a3f2[_0x121c('0x5f')][_0x121c('0x6f')],'active':!_[_0x121c('0x70')](_0x19a3f2[_0x121c('0x5f')][_0x121c('0x71')])?_0x19a3f2[_0x121c('0x5f')][_0x121c('0x71')]:!![],'description':_0x19a3f2[_0x121c('0x5f')][_0x121c('0x72')]||null,'Imap':{},'Smtp':{}};if(_[_0x121c('0x70')](_0x19a3f2['body'][_0x121c('0x73')])){if(_0x19a3f2[_0x121c('0x5f')][_0x121c('0x74')]){_0x1e4c9e[_0x121c('0x3c')]['user']=_0x1e4c9e[_0x121c('0x3e')][_0x121c('0x75')]=_0x19a3f2['body'][_0x121c('0x76')];_0x1e4c9e[_0x121c('0x3c')]['password']=_0x1e4c9e[_0x121c('0x3e')]['pass']=_0x19a3f2[_0x121c('0x5f')][_0x121c('0x77')];}else{_0x1e4c9e['Imap'][_0x121c('0x78')]=_0x1e4c9e[_0x121c('0x3e')]['authentication']=![];}_0x1e4c9e[_0x121c('0x3c')][_0x121c('0x79')]=_0x19a3f2[_0x121c('0x5f')][_0x121c('0x3c')][_0x121c('0x79')];_0x1e4c9e[_0x121c('0x3c')][_0x121c('0x7a')]=_0x19a3f2[_0x121c('0x5f')][_0x121c('0x3c')][_0x121c('0x7a')];_0x1e4c9e['Smtp'][_0x121c('0x79')]=_0x19a3f2[_0x121c('0x5f')][_0x121c('0x3e')][_0x121c('0x79')];_0x1e4c9e[_0x121c('0x3e')]['port']=_0x19a3f2[_0x121c('0x5f')][_0x121c('0x3e')][_0x121c('0x7a')];}else{_0x1e4c9e[_0x121c('0x3c')][_0x121c('0x7b')]=_0x1e4c9e['Smtp'][_0x121c('0x7b')]=_0x19a3f2[_0x121c('0x5f')][_0x121c('0x73')];_0x1e4c9e[_0x121c('0x3c')][_0x121c('0x75')]=_0x1e4c9e[_0x121c('0x3e')]['user']=_0x19a3f2[_0x121c('0x5f')]['cuser'];_0x1e4c9e[_0x121c('0x3c')][_0x121c('0x7c')]=_0x1e4c9e['Smtp'][_0x121c('0x7d')]=_0x19a3f2[_0x121c('0x5f')]['cpassword'];}return db[_0x121c('0x54')][_0x121c('0x64')](_0x1e4c9e,{'include':[{'model':db['MailServerOut'],'as':_0x121c('0x3e')},{'model':db[_0x121c('0x3b')],'as':_0x121c('0x3c')}]})[_0x121c('0x1e')](function(_0x8aa480){var _0x55d384=_0x19a3f2[_0x121c('0x75')][_0x121c('0x36')]({'plain':!![]});if(!_0x55d384)throw new Error(_0x121c('0x7e'));if(_0x55d384['role']===_0x121c('0x75')){var _0x321bdc=_0x8aa480[_0x121c('0x36')]({'plain':!![]});return db['UserProfileSection'][_0x121c('0x5e')]({'where':{'name':'MailAccounts','userProfileId':_0x55d384['userProfileId']},'raw':!![]})[_0x121c('0x1e')](function(_0x4a757e){if(_0x4a757e&&_0x4a757e[_0x121c('0x7f')]===0x0){return db[_0x121c('0x80')]['create']({'name':_0x321bdc[_0x121c('0x39')],'resourceId':_0x321bdc['id'],'type':_0x4a757e[_0x121c('0x39')],'sectionId':_0x4a757e['id']},{})[_0x121c('0x1e')](function(){return _0x8aa480;});}else{return _0x8aa480;}})[_0x121c('0x27')](function(_0x18bb93){logger[_0x121c('0x23')](_0x121c('0x81'),_0x18bb93);throw _0x18bb93;});}return _0x8aa480;})[_0x121c('0x1e')](respondWithResult(_0x485d80,0xc9))[_0x121c('0x27')](handleError(_0x485d80,null));};exports[_0x121c('0x82')]=function(_0x13f13d,_0x57f238,_0x15d9bb){return db[_0x121c('0x54')]['findOne']({'where':{'id':_0x13f13d[_0x121c('0x59')]['id']}})[_0x121c('0x1e')](handleEntityNotFound(_0x57f238,null))[_0x121c('0x1e')](function(_0xe3e6b9){if(_0xe3e6b9){return _0xe3e6b9[_0x121c('0x82')]();}return null;})['then'](respondWithResult(_0x57f238,null))[_0x121c('0x27')](handleError(_0x57f238,null));};exports[_0x121c('0x83')]=function(_0x4c6469,_0x19a97e,_0x4b7dc4){if(_0x4c6469[_0x121c('0x5f')]['id']){delete _0x4c6469[_0x121c('0x5f')]['id'];}return db[_0x121c('0x54')]['find']({'where':{'id':_0x4c6469[_0x121c('0x59')]['id']}})[_0x121c('0x1e')](handleEntityNotFound(_0x19a97e,null))[_0x121c('0x1e')](function(_0x281b06){if(_0x281b06){_0x4c6469[_0x121c('0x5f')][_0x121c('0x63')]=_0x281b06['id'];return db[_0x121c('0x3b')][_0x121c('0x64')](_0x4c6469['body']);}})['then'](respondWithResult(_0x19a97e,null))[_0x121c('0x27')](handleError(_0x19a97e,null));};exports[_0x121c('0x84')]=function(_0x558012,_0x27d49f,_0x3d529b){return db[_0x121c('0x54')]['findOne']({'where':{'id':_0x558012[_0x121c('0x59')]['id']}})['then'](handleEntityNotFound(_0x27d49f,null))[_0x121c('0x1e')](function(_0x22c6a2){if(_0x22c6a2){return _0x22c6a2[_0x121c('0x85')](null);}return null;})[_0x121c('0x1e')](respondWithStatusCode(_0x27d49f,null))[_0x121c('0x27')](handleError(_0x27d49f,null));};exports[_0x121c('0x86')]=function(_0x355dda,_0x398180,_0x2ade6){return db[_0x121c('0x54')][_0x121c('0x6c')]({'where':{'id':_0x355dda[_0x121c('0x59')]['id']}})[_0x121c('0x1e')](handleEntityNotFound(_0x398180,null))[_0x121c('0x1e')](function(_0x142a57){if(_0x142a57){return _0x142a57[_0x121c('0x86')]();}return null;})[_0x121c('0x1e')](respondWithResult(_0x398180,null))[_0x121c('0x27')](handleError(_0x398180,null));};exports[_0x121c('0x87')]=function(_0xe8cf9,_0x3fafb2,_0x15a37c){if(_0xe8cf9[_0x121c('0x5f')]['id']){delete _0xe8cf9[_0x121c('0x5f')]['id'];}return db[_0x121c('0x54')][_0x121c('0x5e')]({'where':{'id':_0xe8cf9[_0x121c('0x59')]['id']}})['then'](handleEntityNotFound(_0x3fafb2,null))['then'](function(_0x4c8b6a){if(_0x4c8b6a){_0xe8cf9[_0x121c('0x5f')][_0x121c('0x63')]=_0x4c8b6a['id'];return db[_0x121c('0x3d')][_0x121c('0x64')](_0xe8cf9[_0x121c('0x5f')]);}})[_0x121c('0x1e')](respondWithResult(_0x3fafb2,null))[_0x121c('0x27')](handleError(_0x3fafb2,null));};exports['removeSmtp']=function(_0x2ae60c,_0x37ad3a,_0x2f0e30){return db[_0x121c('0x54')][_0x121c('0x6c')]({'where':{'id':_0x2ae60c[_0x121c('0x59')]['id']}})['then'](handleEntityNotFound(_0x37ad3a,null))[_0x121c('0x1e')](function(_0xa88859){if(_0xa88859){return _0xa88859[_0x121c('0x88')](null);}return null;})['then'](respondWithStatusCode(_0x37ad3a,null))[_0x121c('0x27')](handleError(_0x37ad3a,null));};exports[_0x121c('0x89')]=function(_0x4074b2,_0xb8fed0,_0x396adc){return db['MailInteraction'][_0x121c('0x5e')]({'where':{'id':_0x4074b2[_0x121c('0x59')]['id']}})[_0x121c('0x1e')](handleEntityNotFound(_0xb8fed0,null))[_0x121c('0x1e')](function(_0x109004){if(_0x109004){return _0x109004[_0x121c('0x89')](_0x4074b2['body'][_0x121c('0x68')],_['omit'](_0x4074b2[_0x121c('0x5f')],['ids','id'])||{});}})['then'](respondWithResult(_0xb8fed0,null))[_0x121c('0x27')](handleError(_0xb8fed0,null));};exports[_0x121c('0x8a')]=function(_0x86a4c2,_0x104890,_0x503af2){var _0x43cd23={'raw':![],'where':{}};var _0x20f722={};var _0x1fcc78={'count':0x0,'rows':[]};return db[_0x121c('0x54')]['findOne']({'where':{'id':_0x86a4c2['params']['id']}})['then'](handleEntityNotFound(_0x104890,null))[_0x121c('0x1e')](function(_0x2020ae){if(_0x2020ae){_0x20f722['model']=_[_0x121c('0x47')](db[_0x121c('0x8b')]['rawAttributes']);_0x20f722[_0x121c('0x46')]=_[_0x121c('0x47')](_0x86a4c2['query']);_0x20f722[_0x121c('0x48')]=_[_0x121c('0x49')](_0x20f722['model'],_0x20f722[_0x121c('0x46')]);_0x43cd23[_0x121c('0x4a')]=_[_0x121c('0x49')](_0x20f722[_0x121c('0x45')],qs[_0x121c('0x5a')](_0x86a4c2[_0x121c('0x46')][_0x121c('0x5a')]));_0x43cd23['attributes']=_0x43cd23[_0x121c('0x4a')]['length']?_0x43cd23[_0x121c('0x4a')]:_0x20f722[_0x121c('0x45')];if(!_0x86a4c2[_0x121c('0x46')][_0x121c('0x4b')](_0x121c('0x4c'))){_0x43cd23[_0x121c('0x2d')]=qs[_0x121c('0x2d')](_0x86a4c2['query'][_0x121c('0x2d')]);_0x43cd23['offset']=qs[_0x121c('0x2b')](_0x86a4c2['query'][_0x121c('0x2b')]);}_0x43cd23[_0x121c('0x4d')]=qs[_0x121c('0x4e')](_0x86a4c2[_0x121c('0x46')][_0x121c('0x4e')]);_0x43cd23['where']=qs['filters'](_[_0x121c('0x50')](_0x86a4c2['query'],_0x20f722[_0x121c('0x48')]));_0x43cd23[_0x121c('0x4f')]['MailAccountId']=_0x2020ae['id'];if(_0x86a4c2[_0x121c('0x46')][_0x121c('0x51')]){_0x43cd23[_0x121c('0x4f')]=_[_0x121c('0x52')](_0x43cd23[_0x121c('0x4f')],{'$or':_[_0x121c('0x40')](_0x43cd23[_0x121c('0x4a')],function(_0x207b50){var _0x4b4f0e={};_0x4b4f0e[_0x207b50]={'$like':'%'+_0x86a4c2['query'][_0x121c('0x51')]+'%'};return _0x4b4f0e;})});}_0x43cd23=_[_0x121c('0x52')]({},_0x43cd23,_0x86a4c2['options']);return db[_0x121c('0x8b')]['count']({'where':_0x43cd23[_0x121c('0x4f')]})[_0x121c('0x1e')](function(_0x555f2f){_0x1fcc78[_0x121c('0x2e')]=_0x555f2f;if(_0x86a4c2[_0x121c('0x46')]['includeAll']){_0x43cd23['include']=[{'model':db['CmContact'],'as':_0x121c('0x8c'),'required':![]},{'model':db[_0x121c('0x8d')],'as':_0x121c('0x8e'),'attributes':[_0x121c('0x39'),_0x121c('0x8f'),_0x121c('0x90')],'required':![]},{'model':db[_0x121c('0x91')],'as':_0x121c('0x92'),'attributes':['id',_0x121c('0x39'),_0x121c('0x93')],'where':_0x86a4c2[_0x121c('0x46')][_0x121c('0x94')]?{'id':_0x86a4c2[_0x121c('0x46')]['tag']}:undefined,'required':_0x86a4c2[_0x121c('0x46')][_0x121c('0x94')]?!![]:![]}];}return db[_0x121c('0x8b')][_0x121c('0x56')](_0x43cd23);})[_0x121c('0x1e')](function(_0x838987){_0x1fcc78[_0x121c('0x57')]=_0x838987;return _0x1fcc78;});}})[_0x121c('0x1e')](respondWithFilteredResult(_0x104890,_0x43cd23))[_0x121c('0x27')](handleError(_0x104890,null));};exports[_0x121c('0x95')]=function addApplications(_0x54fb67,_0x57f673){var _0x2e754b=_0x54fb67[_0x121c('0x59')]['id'];var _0x12dd11=_0x54fb67[_0x121c('0x5f')];var _0x32f95b=0xc8;var _0x56ce87=null;return db['sequelize'][_0x121c('0x96')]({'isolationLevel':db[_0x121c('0x97')][_0x121c('0x98')][_0x121c('0x99')][_0x121c('0x9a')]},function(_0x41bbc8){return db['MailAccount'][_0x121c('0x6c')]({'where':{'id':_0x2e754b},'transaction':_0x41bbc8})['then'](function(_0x562109){if(_0x562109){return db['MailApplication'][_0x121c('0x35')]({'where':{'MailAccountId':_0x2e754b},'transaction':_0x41bbc8})[_0x121c('0x1e')](function(){var _0x53f0b4=_[_0x121c('0x40')](_0x12dd11,function(_0x523ddb){_0x523ddb[_0x121c('0x63')]=_0x2e754b;return _0x523ddb;});return db[_0x121c('0x9b')]['bulkCreate'](_0x53f0b4,{'transaction':_0x41bbc8});});}else{_0x32f95b=0x194;_0x56ce87=[];}});})[_0x121c('0x1e')](function(){if(_0x32f95b!==0x194){return db[_0x121c('0x9b')][_0x121c('0x9c')]({'where':{'MailAccountId':_0x2e754b},'order':_0x121c('0x9d')})[_0x121c('0x1e')](function(_0x4056da){_0x56ce87=_0x4056da;});}})[_0x121c('0x27')](function(_0xe81db6){_0x32f95b=0x1f4;logger[_0x121c('0x23')](_0xe81db6['stack']);if(_0xe81db6[_0x121c('0x39')]){delete _0xe81db6[_0x121c('0x39')];}_0x56ce87=_0xe81db6;})[_0x121c('0x9e')](function(){if(_0x56ce87===null){_0x57f673['sendStatus'](_0x32f95b);}else{if(_0x32f95b===0x1f4){_0x57f673[_0x121c('0x29')](_0x32f95b)[_0x121c('0x9f')](_0x56ce87);}else{_0x57f673[_0x121c('0x29')](_0x32f95b)[_0x121c('0x30')](_0x56ce87);}}});};exports[_0x121c('0xa0')]=function(_0x1d7070,_0x446c7d,_0x35cccf){var _0xdb3e93={};var _0xf91a55={};var _0x19d559;var _0x26aa41;return db[_0x121c('0x54')][_0x121c('0x6c')]({'where':{'id':_0x1d7070['params']['id']}})['then'](handleEntityNotFound(_0x446c7d,null))[_0x121c('0x1e')](function(_0x12b0be){if(_0x12b0be){_0x19d559=_0x12b0be;_0xf91a55['model']=_[_0x121c('0x47')](db[_0x121c('0x9b')][_0x121c('0x41')]);_0xf91a55[_0x121c('0x46')]=_['keys'](_0x1d7070[_0x121c('0x46')]);_0xf91a55[_0x121c('0x48')]=_['intersection'](_0xf91a55[_0x121c('0x45')],_0xf91a55[_0x121c('0x46')]);_0xdb3e93[_0x121c('0x4a')]=_[_0x121c('0x49')](_0xf91a55[_0x121c('0x45')],qs[_0x121c('0x5a')](_0x1d7070[_0x121c('0x46')][_0x121c('0x5a')]));_0xdb3e93['attributes']=_0xdb3e93['attributes'][_0x121c('0x5b')]?_0xdb3e93[_0x121c('0x4a')]:_0xf91a55[_0x121c('0x45')];_0xdb3e93[_0x121c('0x4d')]=qs[_0x121c('0x4e')](_0x1d7070[_0x121c('0x46')][_0x121c('0x4e')]);_0xdb3e93[_0x121c('0x4f')]=qs[_0x121c('0x48')](_[_0x121c('0x50')](_0x1d7070[_0x121c('0x46')],_0xf91a55[_0x121c('0x48')]));if(_0x1d7070[_0x121c('0x46')]['filter']){_0xdb3e93[_0x121c('0x4f')]=_[_0x121c('0x52')](_0xdb3e93[_0x121c('0x4f')],{'$or':_[_0x121c('0x40')](_0xdb3e93['attributes'],function(_0x3532ca){var _0x31b5b0={};_0x31b5b0[_0x3532ca]={'$like':'%'+_0x1d7070[_0x121c('0x46')]['filter']+'%'};return _0x31b5b0;})});}_0xdb3e93=_[_0x121c('0x52')]({},_0xdb3e93,_0x1d7070[_0x121c('0x5d')]);return _0x19d559[_0x121c('0xa0')](_0xdb3e93);}})[_0x121c('0x1e')](function(_0x157560){if(_0x157560){_0x26aa41=_0x157560[_0x121c('0x5b')];if(!_0x1d7070[_0x121c('0x46')][_0x121c('0x4b')](_0x121c('0x4c'))){_0xdb3e93[_0x121c('0x2d')]=qs[_0x121c('0x2d')](_0x1d7070[_0x121c('0x46')]['limit']);_0xdb3e93[_0x121c('0x2b')]=qs['offset'](_0x1d7070[_0x121c('0x46')]['offset']);}return _0x19d559[_0x121c('0xa0')](_0xdb3e93);}})[_0x121c('0x1e')](function(_0x4c659f){if(_0x4c659f){return _0x4c659f?{'count':_0x26aa41,'rows':_0x4c659f}:null;}})[_0x121c('0x1e')](respondWithResult(_0x446c7d,null))['catch'](handleError(_0x446c7d,null));};exports[_0x121c('0xa1')]=function(_0x4df2f5,_0x1779db,_0x285fac){var _0x2d2162={'raw':!![],'where':{}};var _0x3be7a8={};var _0x516fae={'count':0x0,'rows':[]};return db[_0x121c('0x54')][_0x121c('0x6c')]({'where':{'id':_0x4df2f5[_0x121c('0x59')]['id']}})[_0x121c('0x1e')](handleEntityNotFound(_0x1779db,null))[_0x121c('0x1e')](function(_0x5bcbf5){if(_0x5bcbf5){_0x3be7a8[_0x121c('0x45')]=_[_0x121c('0x47')](db['MailMessage'][_0x121c('0x41')]);_0x3be7a8[_0x121c('0x46')]=_['keys'](_0x4df2f5[_0x121c('0x46')]);_0x3be7a8['filters']=_[_0x121c('0x49')](_0x3be7a8[_0x121c('0x45')],_0x3be7a8['query']);_0x2d2162[_0x121c('0x4a')]=_['intersection'](_0x3be7a8[_0x121c('0x45')],qs[_0x121c('0x5a')](_0x4df2f5[_0x121c('0x46')][_0x121c('0x5a')]));_0x2d2162[_0x121c('0x4a')]=_0x2d2162[_0x121c('0x4a')][_0x121c('0x5b')]?_0x2d2162[_0x121c('0x4a')]:_0x3be7a8[_0x121c('0x45')];if(!_0x4df2f5[_0x121c('0x46')][_0x121c('0x4b')]('nolimit')){_0x2d2162[_0x121c('0x2d')]=qs[_0x121c('0x2d')](_0x4df2f5[_0x121c('0x46')][_0x121c('0x2d')]);_0x2d2162[_0x121c('0x2b')]=qs[_0x121c('0x2b')](_0x4df2f5[_0x121c('0x46')][_0x121c('0x2b')]);}_0x2d2162[_0x121c('0x4d')]=qs[_0x121c('0x4e')](_0x4df2f5[_0x121c('0x46')][_0x121c('0x4e')]);_0x2d2162[_0x121c('0x4f')]=qs[_0x121c('0x48')](_['pick'](_0x4df2f5[_0x121c('0x46')],_0x3be7a8[_0x121c('0x48')]));_0x2d2162['where'][_0x121c('0x63')]=_0x5bcbf5['id'];if(_0x4df2f5[_0x121c('0x46')][_0x121c('0x51')]){_0x2d2162[_0x121c('0x4f')]=_[_0x121c('0x52')](_0x2d2162[_0x121c('0x4f')],{'$or':_[_0x121c('0x40')](_0x2d2162[_0x121c('0x4a')],function(_0x4a231e){var _0x1693b0={};_0x1693b0[_0x4a231e]={'$like':'%'+_0x4df2f5[_0x121c('0x46')][_0x121c('0x51')]+'%'};return _0x1693b0;})});}if(_0x4df2f5[_0x121c('0x46')][_0x121c('0xa2')]){var _0x44e5ea=_0x4df2f5[_0x121c('0x46')]['$gte'][_0x121c('0xa3')](',');var _0x179a8a={};_0x179a8a[_0x44e5ea[0x0]]={'$gte':moment(_0x44e5ea[0x1])[_0x121c('0xa4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2d2162[_0x121c('0x4f')]=_[_0x121c('0x52')](_0x2d2162[_0x121c('0x4f')],_0x179a8a);}_0x2d2162=_[_0x121c('0x52')]({},_0x2d2162,_0x4df2f5[_0x121c('0x5d')]);return db['MailMessage'][_0x121c('0x2e')]({'where':_0x2d2162[_0x121c('0x4f')]})[_0x121c('0x1e')](function(_0x507e70){_0x516fae[_0x121c('0x2e')]=_0x507e70;if(_0x4df2f5[_0x121c('0x46')][_0x121c('0x55')]){_0x2d2162['include']=[{'all':!![]}];}return db['MailMessage'][_0x121c('0x56')](_0x2d2162);})[_0x121c('0x1e')](function(_0x4b4b12){if(_0x4df2f5['query'][_0x121c('0xa5')]===_0x121c('0xa6')){for(var _0x3936e4=0x0;_0x3936e4<_0x4b4b12[_0x121c('0x5b')];_0x3936e4++){_0x4b4b12[_0x3936e4][_0x121c('0x5f')]=juice(_0x4b4b12[_0x3936e4][_0x121c('0x5f')]);}}_0x516fae['rows']=_0x4b4b12;return _0x516fae;});}})[_0x121c('0x1e')](respondWithFilteredResult(_0x1779db,_0x2d2162))['catch'](handleError(_0x1779db,null));};exports[_0x121c('0x9f')]=function(_0x45952d,_0x4f9705,_0x2de708){var _0x29cd25,_0x514f7b={},_0x35418a;if(_0x45952d[_0x121c('0x5f')]['to']){_0x35418a=_0x45952d[_0x121c('0x5f')]['to'][_0x121c('0xa3')](',')[0x0];}return db[_0x121c('0x54')][_0x121c('0x5e')]({'where':{'id':_0x45952d['params']['id']},'include':[{'model':db['CmList'],'as':_0x121c('0xa7'),'include':[{'model':db[_0x121c('0xa8')],'as':_0x121c('0xa9'),'where':{'email':_0x35418a},'limit':0x1,'order':[[_0x121c('0xaa'),_0x121c('0xab')]]}]},{'model':db[_0x121c('0x3d')],'as':_0x121c('0x3e'),'raw':!![]}]})[_0x121c('0x1e')](handleEntityNotFound(_0x4f9705,null))[_0x121c('0x1e')](function(_0x3f1088){if(_0x3f1088){_0x29cd25=_0x3f1088;if(_0x3f1088[_0x121c('0x3e')]){if(_[_0x121c('0x70')](_0x45952d[_0x121c('0x5f')][_0x121c('0xac')])){_0x45952d[_0x121c('0x5f')][_0x121c('0xac')]=util[_0x121c('0xa4')]('%s\x20<%s>',_0x3f1088['name'],_0x3f1088[_0x121c('0x6e')]||_0x3f1088[_0x121c('0x3e')][_0x121c('0x75')]);}if(_0x45952d[_0x121c('0x5f')][_0x121c('0xad')]&&_0x45952d['body']['attachments'][_0x121c('0x5b')]){for(var _0x4d10ea=0x0;_0x4d10ea<_0x45952d[_0x121c('0x5f')][_0x121c('0xad')][_0x121c('0x5b')];_0x4d10ea+=0x1){_0x45952d[_0x121c('0x5f')][_0x121c('0xad')][_0x4d10ea]={'filename':_0x45952d[_0x121c('0x5f')][_0x121c('0xad')][_0x4d10ea][_0x121c('0x39')],'path':path['join'](config[_0x121c('0xae')],_0x121c('0xaf'),_0x45952d[_0x121c('0x5f')]['attachments'][_0x4d10ea]['basename'])};}}var _0x24d939={'tls':{'rejectUnauthorized':![]}};if(_[_0x121c('0x70')](_0x3f1088['Smtp'][_0x121c('0x7b')])){if(_0x3f1088[_0x121c('0x3e')][_0x121c('0x78')]){_0x24d939[_0x121c('0xb0')]={'user':_0x3f1088[_0x121c('0x3e')]['user'],'pass':_0x3f1088[_0x121c('0x3e')][_0x121c('0x7d')]};}_0x24d939[_0x121c('0x79')]=_0x3f1088[_0x121c('0x3e')][_0x121c('0x79')];_0x24d939[_0x121c('0x7a')]=_0x3f1088[_0x121c('0x3e')]['port'];_0x24d939['secure']=_0x3f1088[_0x121c('0x3e')][_0x121c('0xb1')];}else{_0x24d939[_0x121c('0x7b')]=_0x3f1088['Smtp'][_0x121c('0x7b')];_0x24d939['auth']={'user':_0x3f1088[_0x121c('0x3e')][_0x121c('0x75')],'pass':_0x3f1088[_0x121c('0x3e')][_0x121c('0x7d')]};}return respondWithRpcPromise(_0x121c('0xb2'),_0x121c('0xb3'),{'account':_0x24d939,'message':_0x45952d['body']});}else{throw new Error(_0x121c('0xb4'));}}})['then'](function(_0x4ba9b8){if(_0x4ba9b8){_0x514f7b=_0x4ba9b8;if(_0x29cd25['List']){if(_0x29cd25[_0x121c('0xa7')][_0x121c('0xa9')][_0x121c('0x5b')]){return _0x29cd25[_0x121c('0xa7')]['Contacts'][0x0];}else{return db[_0x121c('0xa8')][_0x121c('0x64')](_['defaults'](_0x45952d[_0x121c('0x5f')],{'firstName':_0x45952d[_0x121c('0x5f')]['to'],'email':_0x45952d['body']['to'],'phone':_0x45952d[_0x121c('0x5f')]['to'],'ListId':_0x29cd25[_0x121c('0x6f')]}));}}else{throw new Error(_0x121c('0xb4'));}}})[_0x121c('0x1e')](function(_0x16feda){if(_0x16feda){var _0x4e0fe8={'UserId':_0x45952d[_0x121c('0x75')]['id'],'ContactId':_0x16feda['id'],'MailAccountId':_0x29cd25['id'],'inReplyTo':_0x514f7b[_0x121c('0xb5')],'to':_0x45952d[_0x121c('0x5f')]['from'],'cc':_0x45952d[_0x121c('0x5f')]['cc'],'subject':_0x45952d['body'][_0x121c('0xb6')],'attach':_0x45952d['body'][_0x121c('0xb7')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x121c('0xb8')),'lastMsgDirection':_0x121c('0xb9'),'Messages':[_['merge'](_0x45952d[_0x121c('0x5f')],{'messageId':_0x514f7b[_0x121c('0xb5')],'sentAt':moment()[_0x121c('0xa4')](_0x121c('0xb8')),'read':!![],'MailAccountId':_0x29cd25['id'],'UserId':_0x45952d[_0x121c('0x75')]['id'],'ContactId':_0x16feda['id']})]};if(_0x45952d[_0x121c('0x5f')][_0x121c('0xba')]){_0x4e0fe8=_[_0x121c('0x52')](_0x4e0fe8,_0x45952d['body'][_0x121c('0xba')]);}return db[_0x121c('0x8b')][_0x121c('0x64')](_0x4e0fe8,{'include':[{'model':db['MailMessage'],'as':_0x121c('0xbb')}]});}})[_0x121c('0x1e')](respondWithResult(_0x4f9705,null))[_0x121c('0x27')](handleError(_0x4f9705,null));};exports[_0x121c('0xbc')]=function(_0x17ad79,_0x3f4da7,_0x4c0891){return db[_0x121c('0x54')]['find']({'where':{'id':_0x17ad79[_0x121c('0x59')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x121c('0x3e'),'raw':!![]}]})['then'](handleEntityNotFound(_0x3f4da7,null))['then'](function(_0x24d53a){if(_0x24d53a&&_0x24d53a[_0x121c('0x3e')]){var _0x43ee70={'id':_0x24d53a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x24d53a['Smtp'][_0x121c('0x7b')]){_0x43ee70['service']=_0x24d53a[_0x121c('0x3e')][_0x121c('0x7b')];}else{_0x43ee70[_0x121c('0x79')]=_0x24d53a['Smtp'][_0x121c('0x79')];_0x43ee70[_0x121c('0x7a')]=_0x24d53a[_0x121c('0x3e')][_0x121c('0x7a')];_0x43ee70['secure']=_0x24d53a[_0x121c('0x3e')]['secure'];}if(_0x24d53a[_0x121c('0x3e')][_0x121c('0x78')]){_0x43ee70[_0x121c('0xb0')]={'user':_0x24d53a[_0x121c('0x3e')][_0x121c('0x75')],'pass':_0x24d53a[_0x121c('0x3e')][_0x121c('0x7d')]};}return respondWithRpcPromise(_0x121c('0xbd'),'verifySmtp',{'account':_0x43ee70});}})[_0x121c('0x1e')](respondWithResult(_0x3f4da7,null))[_0x121c('0x27')](handleError(_0x3f4da7,null));};exports[_0x121c('0x35')]=function(_0x228310,_0x41a51e){return db[_0x121c('0x54')][_0x121c('0x5e')]({'where':{'id':_0x228310[_0x121c('0x59')]['id']}})[_0x121c('0x1e')](handleEntityNotFound(_0x41a51e,null))[_0x121c('0x1e')](function(_0x20d229){if(_0x20d229&&_0x20d229[_0x121c('0x7b')]){throw new db[(_0x121c('0xbe'))][(_0x121c('0xbf'))](_0x121c('0xc0'));}return _0x20d229;})[_0x121c('0x1e')](removeEntity(_0x41a51e,null))[_0x121c('0x27')](handleError(_0x41a51e,null));};exports[_0x121c('0xc1')]=function(_0x20b072,_0x35e305,_0x2160f3){return db['MailAccount'][_0x121c('0x5e')]({'where':{'id':_0x20b072[_0x121c('0x59')]['id']}})['then'](handleEntityNotFound(_0x35e305,null))[_0x121c('0x1e')](function(_0x53437f){if(_0x53437f){return _0x53437f[_0x121c('0xc1')](_0x20b072[_0x121c('0x5f')]['ids'],_[_0x121c('0xc2')](_0x20b072[_0x121c('0x5f')],['ids','id'])||{})[_0x121c('0xc3')](function(_0x1dac7c){for(var _0x1a798c=0x0;_0x1a798c<_0x20b072['body'][_0x121c('0x68')][_0x121c('0x5b')];_0x1a798c+=0x1){socket[_0x121c('0xc4')]('userMailAccount:save',{'UserId':Number(_0x20b072['body'][_0x121c('0x68')][_0x1a798c]),'MailAccountId':Number(_0x20b072[_0x121c('0x59')]['id'])});}return _0x1dac7c;});}})[_0x121c('0x1e')](respondWithResult(_0x35e305,null))[_0x121c('0x27')](handleError(_0x35e305,null));};exports[_0x121c('0xc5')]=function(_0x38ece1,_0x346636,_0x5a459d){return db['MailAccount'][_0x121c('0x5e')]({'where':{'id':_0x38ece1['params']['id']}})['then'](handleEntityNotFound(_0x346636,null))['then'](function(_0x22faf6){if(_0x22faf6){return _0x22faf6['removeAgents'](_0x38ece1[_0x121c('0x46')]['ids'])[_0x121c('0x1e')](function(){if(_[_0x121c('0xc6')](_0x38ece1['query'][_0x121c('0x68')])){for(var _0x1c6040=0x0;_0x1c6040<_0x38ece1['query'][_0x121c('0x68')][_0x121c('0x5b')];_0x1c6040+=0x1){socket[_0x121c('0xc4')](_0x121c('0xc7'),{'UserId':Number(_0x38ece1[_0x121c('0x46')]['ids'][_0x1c6040]),'MailAccountId':Number(_0x38ece1['params']['id'])});}}else{socket[_0x121c('0xc4')](_0x121c('0xc7'),{'UserId':Number(_0x38ece1[_0x121c('0x46')][_0x121c('0x68')]),'MailAccountId':Number(_0x38ece1['params']['id'])});}});}})['then'](respondWithStatusCode(_0x346636,null))[_0x121c('0x27')](handleError(_0x346636,null));};exports[_0x121c('0xc8')]=function(_0x2e5726,_0x55e04d,_0x3f10b7){var _0x14353c={};var _0x1ca1df={};var _0x1b300f;var _0x14c3bb;return db[_0x121c('0x54')]['findOne']({'where':{'id':_0x2e5726[_0x121c('0x59')]['id']}})[_0x121c('0x1e')](handleEntityNotFound(_0x55e04d,null))[_0x121c('0x1e')](function(_0x5f2a6d){if(_0x5f2a6d){_0x1b300f=_0x5f2a6d;_0x1ca1df[_0x121c('0x45')]=_[_0x121c('0x47')](db[_0x121c('0x8d')][_0x121c('0x41')]);_0x1ca1df[_0x121c('0x46')]=_[_0x121c('0x47')](_0x2e5726[_0x121c('0x46')]);_0x1ca1df[_0x121c('0x48')]=_[_0x121c('0x49')](_0x1ca1df[_0x121c('0x45')],_0x1ca1df[_0x121c('0x46')]);_0x14353c['attributes']=_[_0x121c('0x49')](_0x1ca1df['model'],qs[_0x121c('0x5a')](_0x2e5726[_0x121c('0x46')][_0x121c('0x5a')]));_0x14353c[_0x121c('0x4a')]=_0x14353c[_0x121c('0x4a')]['length']?_0x14353c[_0x121c('0x4a')]:_0x1ca1df['model'];_0x14353c[_0x121c('0x4d')]=qs[_0x121c('0x4e')](_0x2e5726[_0x121c('0x46')][_0x121c('0x4e')]);_0x14353c[_0x121c('0x4f')]=qs['filters'](_[_0x121c('0x50')](_0x2e5726[_0x121c('0x46')],_0x1ca1df['filters']));if(_0x2e5726[_0x121c('0x46')][_0x121c('0x51')]){_0x14353c[_0x121c('0x4f')]=_[_0x121c('0x52')](_0x14353c[_0x121c('0x4f')],{'$or':_['map'](_0x14353c[_0x121c('0x4a')],function(_0x1d0fb5){var _0x4db799={};_0x4db799[_0x1d0fb5]={'$like':'%'+_0x2e5726[_0x121c('0x46')][_0x121c('0x51')]+'%'};return _0x4db799;})});}_0x14353c=_[_0x121c('0x52')]({},_0x14353c,_0x2e5726[_0x121c('0x5d')]);return _0x1b300f['getAgents'](_0x14353c);}})[_0x121c('0x1e')](function(_0xa0e527){if(_0xa0e527){_0x14c3bb=_0xa0e527[_0x121c('0x5b')];if(!_0x2e5726['query'][_0x121c('0x4b')](_0x121c('0x4c'))){_0x14353c['limit']=qs[_0x121c('0x2d')](_0x2e5726[_0x121c('0x46')][_0x121c('0x2d')]);_0x14353c[_0x121c('0x2b')]=qs['offset'](_0x2e5726[_0x121c('0x46')][_0x121c('0x2b')]);}return _0x1b300f['getAgents'](_0x14353c);}})[_0x121c('0x1e')](function(_0x41ca3d){if(_0x41ca3d){return _0x41ca3d?{'count':_0x14c3bb,'rows':_0x41ca3d}:null;}})['then'](respondWithResult(_0x55e04d,null))[_0x121c('0x27')](handleError(_0x55e04d,null));}; \ No newline at end of file +var _0x2bc1=['user','cuser','password','cpassword','authentication','host','port','service','cservice','pass','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','updatedAt','DESC','from','attachments','join','root','server/files/attachments','auth','secure','SendMail','sendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./mailAccount.socket','jayson/promise','http','request','then','info','debug','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','end','status','undefined','limit','offset','set','Content-Range','json','apply','reject','save','update','destroy','get','MailAccounts','UserProfileResource','sendStatus','name','send','Imap','Smtp','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','pick','where','merge','VIRTUAL','filter','MailAccount','count','includeAll','include','findAll','rows','catch','show','params','MailServerOut','Pause','find','body','MailServerIn','describe','addDisposition','getDispositions','findOne','hasOwnProperty','sort','MailAccountId','options','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','email','ListId','isNil','active','description','cauthentication'];(function(_0x51e49e,_0x2e95d2){var _0x429917=function(_0x3ac1a7){while(--_0x3ac1a7){_0x51e49e['push'](_0x51e49e['shift']());}};_0x429917(++_0x2e95d2);}(_0x2bc1,0x11e));var _0x12bc=function(_0x1723cb,_0x3c8816){_0x1723cb=_0x1723cb-0x0;var _0x3078ff=_0x2bc1[_0x1723cb];return _0x3078ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x12bc('0x0'));var zipdir=require(_0x12bc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x12bc('0x2'));var moment=require('moment');var BPromise=require(_0x12bc('0x3'));var Mustache=require(_0x12bc('0x4'));var util=require(_0x12bc('0x5'));var path=require(_0x12bc('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x12bc('0x7'));var fs=require('fs');var fs_extra=require(_0x12bc('0x8'));var _=require(_0x12bc('0x9'));var squel=require(_0x12bc('0xa'));var crypto=require(_0x12bc('0xb'));var jsforce=require(_0x12bc('0xc'));var deskjs=require(_0x12bc('0xd'));var toCsv=require(_0x12bc('0xe'));var querystring=require(_0x12bc('0xf'));var Papa=require(_0x12bc('0x10'));var htmlToText=require(_0x12bc('0x11'));var juice=require('juice');var Redis=require(_0x12bc('0x12'));var authService=require(_0x12bc('0x13'));var qs=require(_0x12bc('0x14'));var as=require(_0x12bc('0x15'));var hardwareService=require(_0x12bc('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x12bc('0x17'));var config=require(_0x12bc('0x18'));var licenseUtil=require(_0x12bc('0x19'));var db=require(_0x12bc('0x1a'))['db'];config['redis']=_[_0x12bc('0x1b')](config[_0x12bc('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x12bc('0x1d'))(new Redis(config[_0x12bc('0x1c')]));require(_0x12bc('0x1e'))['register'](socket);var jayson=require(_0x12bc('0x1f'));var client=jayson['client'][_0x12bc('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x3ebe68,_0x1a995c,_0x5ab9e7,_0x417a61){return new BPromise(function(_0x58ab55,_0x54648d){var _0x5e38ad=_0x417a61||client;return _0x5e38ad[_0x12bc('0x21')](_0x3ebe68,_0x5ab9e7)[_0x12bc('0x22')](function(_0x57feac){logger[_0x12bc('0x23')]('MailAccount,\x20%s,\x20%s',_0x1a995c,'request\x20sent');logger[_0x12bc('0x24')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1a995c,_0x12bc('0x25'),JSON[_0x12bc('0x26')](_0x57feac));if(_0x57feac[_0x12bc('0x27')]){if(_0x57feac[_0x12bc('0x27')][_0x12bc('0x28')]===0x1f4){logger[_0x12bc('0x27')](_0x12bc('0x29'),_0x1a995c,_0x57feac[_0x12bc('0x27')]['message']);return _0x54648d(_0x57feac[_0x12bc('0x27')][_0x12bc('0x2a')]);}logger['error'](_0x12bc('0x29'),_0x1a995c,_0x57feac[_0x12bc('0x27')][_0x12bc('0x2a')]);return _0x58ab55(_0x57feac[_0x12bc('0x27')][_0x12bc('0x2a')]);}else{logger[_0x12bc('0x23')](_0x12bc('0x29'),_0x1a995c,_0x12bc('0x25'));_0x58ab55(_0x57feac[_0x12bc('0x2b')][_0x12bc('0x2a')]);}})['catch'](function(_0x2900f8){logger['error'](_0x12bc('0x29'),_0x1a995c,_0x2900f8);_0x54648d(_0x2900f8);});});}function respondWithStatusCode(_0xc17d7a,_0x104312){_0x104312=_0x104312||0xcc;return function(_0x268301){if(_0x268301){return _0xc17d7a['sendStatus'](_0x104312);}return _0xc17d7a['status'](_0x104312)[_0x12bc('0x2c')]();};}function respondWithResult(_0x4c1245,_0x57b146){_0x57b146=_0x57b146||0xc8;return function(_0x119423){if(_0x119423){return _0x4c1245[_0x12bc('0x2d')](_0x57b146)['json'](_0x119423);}};}function respondWithFilteredResult(_0x310182,_0x280b67){return function(_0x1beea5){if(_0x1beea5){var _0x43af8c=typeof _0x280b67['offset']===_0x12bc('0x2e')&&typeof _0x280b67[_0x12bc('0x2f')]===_0x12bc('0x2e');var _0x2517a4=_0x1beea5['count'];var _0x4deb77=_0x43af8c?0x0:_0x280b67[_0x12bc('0x30')];var _0x312284=_0x43af8c?_0x1beea5['count']:_0x280b67[_0x12bc('0x30')]+_0x280b67[_0x12bc('0x2f')];var _0x43a640;if(_0x312284>=_0x2517a4){_0x312284=_0x2517a4;_0x43a640=0xc8;}else{_0x43a640=0xce;}_0x310182[_0x12bc('0x2d')](_0x43a640);return _0x310182[_0x12bc('0x31')](_0x12bc('0x32'),_0x4deb77+'-'+_0x312284+'/'+_0x2517a4)[_0x12bc('0x33')](_0x1beea5);}return null;};}function patchUpdates(_0x40e6b8){return function(_0x25cb5c){try{jsonpatch[_0x12bc('0x34')](_0x25cb5c,_0x40e6b8,!![]);}catch(_0x3e0501){return BPromise[_0x12bc('0x35')](_0x3e0501);}return _0x25cb5c[_0x12bc('0x36')]();};}function saveUpdates(_0x1eb5e7,_0x3aa6b9){return function(_0x353db7){if(_0x353db7){return _0x353db7[_0x12bc('0x37')](_0x1eb5e7)[_0x12bc('0x22')](function(_0x25a8db){return _0x25a8db;});}return null;};}function removeEntity(_0xdce70c,_0x4f85cb){return function(_0x1050f9){if(_0x1050f9){return _0x1050f9[_0x12bc('0x38')]()[_0x12bc('0x22')](function(){var _0x4ad3ce=_0x1050f9[_0x12bc('0x39')]({'plain':!![]});var _0x59be37=_0x12bc('0x3a');return db[_0x12bc('0x3b')]['destroy']({'where':{'type':_0x59be37,'resourceId':_0x4ad3ce['id']}})[_0x12bc('0x22')](function(){return _0x1050f9;});})[_0x12bc('0x22')](function(){_0xdce70c['status'](0xcc)[_0x12bc('0x2c')]();});}};}function handleEntityNotFound(_0x4e4d10,_0xe3b1ba){return function(_0x5c3c8a){if(!_0x5c3c8a){_0x4e4d10[_0x12bc('0x3c')](0x194);}return _0x5c3c8a;};}function handleError(_0x44d6f4,_0x2c9bf7){_0x2c9bf7=_0x2c9bf7||0x1f4;return function(_0x24cf16){logger[_0x12bc('0x27')](_0x24cf16['stack']);if(_0x24cf16[_0x12bc('0x3d')]){delete _0x24cf16[_0x12bc('0x3d')];}_0x44d6f4[_0x12bc('0x2d')](_0x2c9bf7)[_0x12bc('0x3e')](_0x24cf16);};}exports['index']=function(_0x514442,_0x2c372c){var _0xdeb001={'include':[{'model':db['MailServerIn'],'as':_0x12bc('0x3f')},{'model':db['MailServerOut'],'as':_0x12bc('0x40')},{'model':db['Pause'],'as':_0x12bc('0x41')}]},_0x4d0e9f={},_0x31f04b={'count':0x0,'rows':[]};var _0xaff55e=_[_0x12bc('0x42')](db['MailAccount'][_0x12bc('0x43')],function(_0x2c2ba9){return{'name':_0x2c2ba9[_0x12bc('0x44')],'type':_0x2c2ba9[_0x12bc('0x45')][_0x12bc('0x46')]};});_0x4d0e9f['model']=_[_0x12bc('0x42')](_0xaff55e,_0x12bc('0x3d'));_0x4d0e9f['query']=_[_0x12bc('0x47')](_0x514442[_0x12bc('0x48')]);_0x4d0e9f[_0x12bc('0x49')]=_[_0x12bc('0x4a')](_0x4d0e9f[_0x12bc('0x4b')],_0x4d0e9f[_0x12bc('0x48')]);_0xdeb001[_0x12bc('0x4c')]=_[_0x12bc('0x4a')](_0x4d0e9f[_0x12bc('0x4b')],qs[_0x12bc('0x4d')](_0x514442[_0x12bc('0x48')][_0x12bc('0x4d')]));_0xdeb001[_0x12bc('0x4c')]=_0xdeb001['attributes'][_0x12bc('0x4e')]?_0xdeb001[_0x12bc('0x4c')]:_0x4d0e9f[_0x12bc('0x4b')];if(!_0x514442['query']['hasOwnProperty'](_0x12bc('0x4f'))){_0xdeb001[_0x12bc('0x2f')]=qs[_0x12bc('0x2f')](_0x514442[_0x12bc('0x48')][_0x12bc('0x2f')]);_0xdeb001['offset']=qs[_0x12bc('0x30')](_0x514442[_0x12bc('0x48')]['offset']);}_0xdeb001[_0x12bc('0x50')]=qs['sort'](_0x514442[_0x12bc('0x48')]['sort']);_0xdeb001['where']=qs[_0x12bc('0x49')](_[_0x12bc('0x51')](_0x514442[_0x12bc('0x48')],_0x4d0e9f['filters']),_0xaff55e);if(_0x514442[_0x12bc('0x48')]['filter']){_0xdeb001[_0x12bc('0x52')]=_[_0x12bc('0x53')](_0xdeb001[_0x12bc('0x52')],{'$or':_[_0x12bc('0x42')](_0xaff55e,function(_0x58b4f1){if(_0x58b4f1['type']!==_0x12bc('0x54')){var _0x25cb5d={};_0x25cb5d[_0x58b4f1['name']]={'$like':'%'+_0x514442[_0x12bc('0x48')][_0x12bc('0x55')]+'%'};return _0x25cb5d;}})});}_0xdeb001=_[_0x12bc('0x53')]({},_0xdeb001,_0x514442['options']);var _0x4bb796={'where':_0xdeb001[_0x12bc('0x52')]};return db[_0x12bc('0x56')][_0x12bc('0x57')](_0x4bb796)[_0x12bc('0x22')](function(_0x2edc49){_0x31f04b['count']=_0x2edc49;if(_0x514442[_0x12bc('0x48')][_0x12bc('0x58')]){_0xdeb001[_0x12bc('0x59')]=[{'all':!![]}];}return db[_0x12bc('0x56')][_0x12bc('0x5a')](_0xdeb001);})['then'](function(_0x507993){_0x31f04b[_0x12bc('0x5b')]=_0x507993;return _0x31f04b;})['then'](respondWithFilteredResult(_0x2c372c,_0xdeb001))[_0x12bc('0x5c')](handleError(_0x2c372c,null));};exports[_0x12bc('0x5d')]=function(_0x537b41,_0xf9decf){var _0x313f68={'raw':![],'where':{'id':_0x537b41[_0x12bc('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x12bc('0x3f')},{'model':db[_0x12bc('0x5f')],'as':_0x12bc('0x40')},{'model':db[_0x12bc('0x60')],'as':'mandatoryDispositionPause'}]},_0x4a2d23={};_0x4a2d23[_0x12bc('0x4b')]=_[_0x12bc('0x47')](db['MailAccount'][_0x12bc('0x43')]);_0x4a2d23[_0x12bc('0x48')]=_[_0x12bc('0x47')](_0x537b41[_0x12bc('0x48')]);_0x4a2d23['filters']=_[_0x12bc('0x4a')](_0x4a2d23[_0x12bc('0x4b')],_0x4a2d23[_0x12bc('0x48')]);_0x313f68['attributes']=_[_0x12bc('0x4a')](_0x4a2d23[_0x12bc('0x4b')],qs[_0x12bc('0x4d')](_0x537b41[_0x12bc('0x48')][_0x12bc('0x4d')]));_0x313f68[_0x12bc('0x4c')]=_0x313f68[_0x12bc('0x4c')][_0x12bc('0x4e')]?_0x313f68[_0x12bc('0x4c')]:_0x4a2d23[_0x12bc('0x4b')];if(_0x537b41[_0x12bc('0x48')]['includeAll']){_0x313f68[_0x12bc('0x59')]=[{'all':!![]}];}_0x313f68=_['merge']({},_0x313f68,_0x537b41['options']);return db[_0x12bc('0x56')][_0x12bc('0x61')](_0x313f68)[_0x12bc('0x22')](handleEntityNotFound(_0xf9decf,null))[_0x12bc('0x22')](respondWithResult(_0xf9decf,null))[_0x12bc('0x5c')](handleError(_0xf9decf,null));};exports[_0x12bc('0x37')]=function(_0x5b5868,_0x316ca4){if(_0x5b5868[_0x12bc('0x62')]['id']){delete _0x5b5868['body']['id'];}return db[_0x12bc('0x56')]['find']({'where':{'id':_0x5b5868[_0x12bc('0x5e')]['id']},'include':[{'model':db[_0x12bc('0x63')],'as':_0x12bc('0x3f')},{'model':db[_0x12bc('0x5f')],'as':'Smtp'},{'model':db[_0x12bc('0x60')],'as':_0x12bc('0x41')}]})[_0x12bc('0x22')](handleEntityNotFound(_0x316ca4,null))[_0x12bc('0x22')](saveUpdates(_0x5b5868[_0x12bc('0x62')],null))[_0x12bc('0x22')](function(_0x42fdba){if(_0x42fdba&&_0x5b5868['body'][_0x12bc('0x3f')]){return db[_0x12bc('0x63')]['update'](_0x5b5868[_0x12bc('0x62')][_0x12bc('0x3f')],{'where':{'MailAccountId':_0x42fdba['id']}})[_0x12bc('0x22')](function(){return _0x42fdba;});}return _0x42fdba;})[_0x12bc('0x22')](function(_0x3b06be){if(_0x3b06be&&_0x5b5868[_0x12bc('0x62')]['Smtp']){return db[_0x12bc('0x5f')][_0x12bc('0x37')](_0x5b5868[_0x12bc('0x62')]['Smtp'],{'where':{'MailAccountId':_0x3b06be['id']}})['then'](function(){return _0x3b06be;});}return _0x3b06be;})[_0x12bc('0x22')](respondWithResult(_0x316ca4,null))[_0x12bc('0x5c')](handleError(_0x316ca4,null));};exports[_0x12bc('0x64')]=function(_0x2107d6,_0x49ab7a){return db[_0x12bc('0x56')]['describe']()['then'](respondWithResult(_0x49ab7a,null))['catch'](handleError(_0x49ab7a,null));};exports[_0x12bc('0x65')]=function(_0x39bea1,_0x13142a,_0x50d90d){if(_0x39bea1[_0x12bc('0x62')]['id']){delete _0x39bea1[_0x12bc('0x62')]['id'];}return db[_0x12bc('0x56')][_0x12bc('0x61')]({'where':{'id':_0x39bea1[_0x12bc('0x5e')]['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0x13142a,null))['then'](function(_0x5bab9d){if(_0x5bab9d){_0x39bea1[_0x12bc('0x62')]['MailAccountId']=_0x5bab9d['id'];return db['Disposition']['create'](_0x39bea1['body']);}})[_0x12bc('0x22')](respondWithResult(_0x13142a,null))[_0x12bc('0x5c')](handleError(_0x13142a,null));};exports[_0x12bc('0x66')]=function(_0x5a659c,_0x1d5644,_0xd002ed){var _0x33dcf7={'raw':![],'where':{}};var _0xbcf568={};var _0x5ca502={'count':0x0,'rows':[]};return db[_0x12bc('0x56')][_0x12bc('0x67')]({'where':{'id':_0x5a659c[_0x12bc('0x5e')]['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0x1d5644,null))[_0x12bc('0x22')](function(_0x193dc2){if(_0x193dc2){_0xbcf568[_0x12bc('0x4b')]=_[_0x12bc('0x47')](db['Disposition'][_0x12bc('0x43')]);_0xbcf568[_0x12bc('0x48')]=_[_0x12bc('0x47')](_0x5a659c[_0x12bc('0x48')]);_0xbcf568[_0x12bc('0x49')]=_['intersection'](_0xbcf568['model'],_0xbcf568['query']);_0x33dcf7[_0x12bc('0x4c')]=_[_0x12bc('0x4a')](_0xbcf568[_0x12bc('0x4b')],qs['fields'](_0x5a659c[_0x12bc('0x48')]['fields']));_0x33dcf7['attributes']=_0x33dcf7[_0x12bc('0x4c')][_0x12bc('0x4e')]?_0x33dcf7['attributes']:_0xbcf568['model'];if(!_0x5a659c['query'][_0x12bc('0x68')](_0x12bc('0x4f'))){_0x33dcf7[_0x12bc('0x2f')]=qs['limit'](_0x5a659c[_0x12bc('0x48')][_0x12bc('0x2f')]);_0x33dcf7[_0x12bc('0x30')]=qs['offset'](_0x5a659c[_0x12bc('0x48')]['offset']);}_0x33dcf7[_0x12bc('0x50')]=qs[_0x12bc('0x69')](_0x5a659c['query'][_0x12bc('0x69')]);_0x33dcf7[_0x12bc('0x52')]=qs[_0x12bc('0x49')](_[_0x12bc('0x51')](_0x5a659c[_0x12bc('0x48')],_0xbcf568[_0x12bc('0x49')]));_0x33dcf7[_0x12bc('0x52')][_0x12bc('0x6a')]=_0x193dc2['id'];if(_0x5a659c[_0x12bc('0x48')][_0x12bc('0x55')]){_0x33dcf7[_0x12bc('0x52')]=_['merge'](_0x33dcf7[_0x12bc('0x52')],{'$or':_[_0x12bc('0x42')](_0x33dcf7[_0x12bc('0x4c')],function(_0x11c8b1){var _0x50c8ee={};_0x50c8ee[_0x11c8b1]={'$like':'%'+_0x5a659c['query'][_0x12bc('0x55')]+'%'};return _0x50c8ee;})});}_0x33dcf7=_[_0x12bc('0x53')]({},_0x33dcf7,_0x5a659c[_0x12bc('0x6b')]);return db[_0x12bc('0x6c')][_0x12bc('0x57')]({'where':_0x33dcf7[_0x12bc('0x52')]})['then'](function(_0x5d7a20){_0x5ca502[_0x12bc('0x57')]=_0x5d7a20;if(_0x5a659c['query'][_0x12bc('0x58')]){_0x33dcf7[_0x12bc('0x59')]=[{'all':!![]}];}return db[_0x12bc('0x6c')][_0x12bc('0x5a')](_0x33dcf7);})[_0x12bc('0x22')](function(_0x486faa){_0x5ca502[_0x12bc('0x5b')]=_0x486faa;return _0x5ca502;});}})[_0x12bc('0x22')](respondWithFilteredResult(_0x1d5644,_0x33dcf7))[_0x12bc('0x5c')](handleError(_0x1d5644,null));};exports['removeDispositions']=function(_0x54fac6,_0x1641dc,_0x17c7df){return db['MailAccount'][_0x12bc('0x61')]({'where':{'id':_0x54fac6[_0x12bc('0x5e')]['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0x1641dc,null))[_0x12bc('0x22')](function(_0x26930b){if(_0x26930b){return _0x26930b[_0x12bc('0x6d')](_0x54fac6[_0x12bc('0x48')][_0x12bc('0x6e')]);}})[_0x12bc('0x22')](respondWithStatusCode(_0x1641dc,null))[_0x12bc('0x5c')](handleError(_0x1641dc,null));};exports[_0x12bc('0x6f')]=function(_0x518d52,_0x2cc99f,_0x5304aa){if(_0x518d52[_0x12bc('0x62')]['id']){delete _0x518d52[_0x12bc('0x62')]['id'];}return db[_0x12bc('0x56')][_0x12bc('0x61')]({'where':{'id':_0x518d52['params']['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0x2cc99f,null))['then'](function(_0x1d2a22){if(_0x1d2a22){_0x518d52[_0x12bc('0x62')]['MailAccountId']=_0x1d2a22['id'];return db[_0x12bc('0x70')][_0x12bc('0x71')](_0x518d52[_0x12bc('0x62')]);}})[_0x12bc('0x22')](respondWithResult(_0x2cc99f,null))['catch'](handleError(_0x2cc99f,null));};exports[_0x12bc('0x72')]=function(_0x29af5b,_0xabd9a3,_0x58a424){var _0x35328a={'raw':![],'where':{}};var _0x49924e={};var _0x3f99a7={'count':0x0,'rows':[]};return db[_0x12bc('0x56')][_0x12bc('0x67')]({'where':{'id':_0x29af5b['params']['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0xabd9a3,null))[_0x12bc('0x22')](function(_0x31a6af){if(_0x31a6af){_0x49924e['model']=_['keys'](db[_0x12bc('0x70')]['rawAttributes']);_0x49924e[_0x12bc('0x48')]=_['keys'](_0x29af5b[_0x12bc('0x48')]);_0x49924e[_0x12bc('0x49')]=_[_0x12bc('0x4a')](_0x49924e['model'],_0x49924e['query']);_0x35328a[_0x12bc('0x4c')]=_[_0x12bc('0x4a')](_0x49924e['model'],qs['fields'](_0x29af5b[_0x12bc('0x48')][_0x12bc('0x4d')]));_0x35328a[_0x12bc('0x4c')]=_0x35328a[_0x12bc('0x4c')][_0x12bc('0x4e')]?_0x35328a[_0x12bc('0x4c')]:_0x49924e[_0x12bc('0x4b')];if(!_0x29af5b['query']['hasOwnProperty'](_0x12bc('0x4f'))){_0x35328a[_0x12bc('0x2f')]=qs['limit'](_0x29af5b[_0x12bc('0x48')][_0x12bc('0x2f')]);_0x35328a['offset']=qs[_0x12bc('0x30')](_0x29af5b[_0x12bc('0x48')][_0x12bc('0x30')]);}_0x35328a[_0x12bc('0x50')]=qs[_0x12bc('0x69')](_0x29af5b[_0x12bc('0x48')]['sort']);_0x35328a[_0x12bc('0x52')]=qs['filters'](_['pick'](_0x29af5b['query'],_0x49924e[_0x12bc('0x49')]));_0x35328a['where']['MailAccountId']=_0x31a6af['id'];if(_0x29af5b[_0x12bc('0x48')]['filter']){_0x35328a['where']=_[_0x12bc('0x53')](_0x35328a[_0x12bc('0x52')],{'$or':_[_0x12bc('0x42')](_0x35328a['attributes'],function(_0x24dd69){var _0xa28e1b={};_0xa28e1b[_0x24dd69]={'$like':'%'+_0x29af5b[_0x12bc('0x48')][_0x12bc('0x55')]+'%'};return _0xa28e1b;})});}_0x35328a=_[_0x12bc('0x53')]({},_0x35328a,_0x29af5b[_0x12bc('0x6b')]);return db[_0x12bc('0x70')][_0x12bc('0x57')]({'where':_0x35328a['where']})[_0x12bc('0x22')](function(_0x2b3e31){_0x3f99a7[_0x12bc('0x57')]=_0x2b3e31;if(_0x29af5b[_0x12bc('0x48')][_0x12bc('0x58')]){_0x35328a[_0x12bc('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x12bc('0x5a')](_0x35328a);})['then'](function(_0x5d1626){_0x3f99a7[_0x12bc('0x5b')]=_0x5d1626;return _0x3f99a7;});}})[_0x12bc('0x22')](respondWithFilteredResult(_0xabd9a3,_0x35328a))['catch'](handleError(_0xabd9a3,null));};exports['removeAnswers']=function(_0x2c1824,_0x4d0208,_0x3f1ad3){return db[_0x12bc('0x56')][_0x12bc('0x61')]({'where':{'id':_0x2c1824['params']['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0x4d0208,null))['then'](function(_0x9f9e7a){if(_0x9f9e7a){return _0x9f9e7a[_0x12bc('0x73')](_0x2c1824[_0x12bc('0x48')][_0x12bc('0x6e')]);}})['then'](respondWithStatusCode(_0x4d0208,null))[_0x12bc('0x5c')](handleError(_0x4d0208,null));};exports['create']=function(_0x342d1e,_0x3e89ac){var _0x3074d5={'name':_0x342d1e['body'][_0x12bc('0x3d')],'key':_0x342d1e['body'][_0x12bc('0x46')],'email':_0x342d1e['body'][_0x12bc('0x74')],'ListId':_0x342d1e[_0x12bc('0x62')][_0x12bc('0x75')],'active':!_[_0x12bc('0x76')](_0x342d1e[_0x12bc('0x62')][_0x12bc('0x77')])?_0x342d1e[_0x12bc('0x62')][_0x12bc('0x77')]:!![],'description':_0x342d1e[_0x12bc('0x62')][_0x12bc('0x78')]||null,'Imap':{},'Smtp':{}};if(_[_0x12bc('0x76')](_0x342d1e[_0x12bc('0x62')]['cservice'])){if(_0x342d1e[_0x12bc('0x62')][_0x12bc('0x79')]){_0x3074d5['Imap']['user']=_0x3074d5[_0x12bc('0x40')][_0x12bc('0x7a')]=_0x342d1e[_0x12bc('0x62')][_0x12bc('0x7b')];_0x3074d5[_0x12bc('0x3f')][_0x12bc('0x7c')]=_0x3074d5['Smtp']['pass']=_0x342d1e[_0x12bc('0x62')][_0x12bc('0x7d')];}else{_0x3074d5['Imap'][_0x12bc('0x7e')]=_0x3074d5[_0x12bc('0x40')][_0x12bc('0x7e')]=![];}_0x3074d5[_0x12bc('0x3f')][_0x12bc('0x7f')]=_0x342d1e['body'][_0x12bc('0x3f')]['host'];_0x3074d5[_0x12bc('0x3f')][_0x12bc('0x80')]=_0x342d1e[_0x12bc('0x62')][_0x12bc('0x3f')][_0x12bc('0x80')];_0x3074d5[_0x12bc('0x40')][_0x12bc('0x7f')]=_0x342d1e[_0x12bc('0x62')]['Smtp'][_0x12bc('0x7f')];_0x3074d5[_0x12bc('0x40')][_0x12bc('0x80')]=_0x342d1e[_0x12bc('0x62')][_0x12bc('0x40')]['port'];}else{_0x3074d5[_0x12bc('0x3f')][_0x12bc('0x81')]=_0x3074d5[_0x12bc('0x40')]['service']=_0x342d1e[_0x12bc('0x62')][_0x12bc('0x82')];_0x3074d5[_0x12bc('0x3f')][_0x12bc('0x7a')]=_0x3074d5[_0x12bc('0x40')]['user']=_0x342d1e[_0x12bc('0x62')]['cuser'];_0x3074d5[_0x12bc('0x3f')]['password']=_0x3074d5['Smtp'][_0x12bc('0x83')]=_0x342d1e[_0x12bc('0x62')][_0x12bc('0x7d')];}return db[_0x12bc('0x56')]['create'](_0x3074d5,{'include':[{'model':db[_0x12bc('0x5f')],'as':_0x12bc('0x40')},{'model':db[_0x12bc('0x63')],'as':_0x12bc('0x3f')}]})[_0x12bc('0x22')](function(_0x152ff){var _0x264c12=_0x342d1e[_0x12bc('0x7a')][_0x12bc('0x39')]({'plain':!![]});if(!_0x264c12)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x264c12[_0x12bc('0x84')]==='user'){var _0x4251fc=_0x152ff[_0x12bc('0x39')]({'plain':!![]});return db[_0x12bc('0x85')][_0x12bc('0x61')]({'where':{'name':'MailAccounts','userProfileId':_0x264c12[_0x12bc('0x86')]},'raw':!![]})[_0x12bc('0x22')](function(_0x76d568){if(_0x76d568&&_0x76d568[_0x12bc('0x87')]===0x0){return db[_0x12bc('0x3b')][_0x12bc('0x71')]({'name':_0x4251fc[_0x12bc('0x3d')],'resourceId':_0x4251fc['id'],'type':_0x76d568[_0x12bc('0x3d')],'sectionId':_0x76d568['id']},{})[_0x12bc('0x22')](function(){return _0x152ff;});}else{return _0x152ff;}})[_0x12bc('0x5c')](function(_0x5d2d1b){logger[_0x12bc('0x27')](_0x12bc('0x88'),_0x5d2d1b);throw _0x5d2d1b;});}return _0x152ff;})[_0x12bc('0x22')](respondWithResult(_0x3e89ac,0xc9))[_0x12bc('0x5c')](handleError(_0x3e89ac,null));};exports['getImap']=function(_0x500101,_0x2b93c1,_0x3bef6f){return db[_0x12bc('0x56')]['findOne']({'where':{'id':_0x500101[_0x12bc('0x5e')]['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0x2b93c1,null))[_0x12bc('0x22')](function(_0x408ca4){if(_0x408ca4){return _0x408ca4[_0x12bc('0x89')]();}return null;})['then'](respondWithResult(_0x2b93c1,null))[_0x12bc('0x5c')](handleError(_0x2b93c1,null));};exports['addImap']=function(_0x3a4f43,_0x4b1bc5,_0x32040c){if(_0x3a4f43[_0x12bc('0x62')]['id']){delete _0x3a4f43[_0x12bc('0x62')]['id'];}return db['MailAccount'][_0x12bc('0x61')]({'where':{'id':_0x3a4f43['params']['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0x4b1bc5,null))[_0x12bc('0x22')](function(_0x3cb476){if(_0x3cb476){_0x3a4f43[_0x12bc('0x62')]['MailAccountId']=_0x3cb476['id'];return db[_0x12bc('0x63')][_0x12bc('0x71')](_0x3a4f43[_0x12bc('0x62')]);}})[_0x12bc('0x22')](respondWithResult(_0x4b1bc5,null))[_0x12bc('0x5c')](handleError(_0x4b1bc5,null));};exports[_0x12bc('0x8a')]=function(_0x3a31f7,_0xf9c63c,_0x40865c){return db['MailAccount'][_0x12bc('0x67')]({'where':{'id':_0x3a31f7[_0x12bc('0x5e')]['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0xf9c63c,null))['then'](function(_0x998542){if(_0x998542){return _0x998542['setImap'](null);}return null;})['then'](respondWithStatusCode(_0xf9c63c,null))['catch'](handleError(_0xf9c63c,null));};exports[_0x12bc('0x8b')]=function(_0x30ca57,_0x3e001c,_0x30d2f2){return db[_0x12bc('0x56')][_0x12bc('0x67')]({'where':{'id':_0x30ca57[_0x12bc('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3e001c,null))[_0x12bc('0x22')](function(_0x448093){if(_0x448093){return _0x448093[_0x12bc('0x8b')]();}return null;})['then'](respondWithResult(_0x3e001c,null))[_0x12bc('0x5c')](handleError(_0x3e001c,null));};exports['addSmtp']=function(_0x265dee,_0x161db8,_0x306e1e){if(_0x265dee[_0x12bc('0x62')]['id']){delete _0x265dee[_0x12bc('0x62')]['id'];}return db[_0x12bc('0x56')][_0x12bc('0x61')]({'where':{'id':_0x265dee[_0x12bc('0x5e')]['id']}})['then'](handleEntityNotFound(_0x161db8,null))[_0x12bc('0x22')](function(_0x32dcaa){if(_0x32dcaa){_0x265dee['body'][_0x12bc('0x6a')]=_0x32dcaa['id'];return db['MailServerOut'][_0x12bc('0x71')](_0x265dee[_0x12bc('0x62')]);}})[_0x12bc('0x22')](respondWithResult(_0x161db8,null))[_0x12bc('0x5c')](handleError(_0x161db8,null));};exports['removeSmtp']=function(_0x5b21ff,_0xe48639,_0x49b559){return db[_0x12bc('0x56')][_0x12bc('0x67')]({'where':{'id':_0x5b21ff['params']['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0xe48639,null))['then'](function(_0x3c2813){if(_0x3c2813){return _0x3c2813[_0x12bc('0x8c')](null);}return null;})['then'](respondWithStatusCode(_0xe48639,null))[_0x12bc('0x5c')](handleError(_0xe48639,null));};exports[_0x12bc('0x8d')]=function(_0x4d2f7a,_0x2a97ba,_0xd581d7){return db[_0x12bc('0x8e')][_0x12bc('0x61')]({'where':{'id':_0x4d2f7a[_0x12bc('0x5e')]['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0x2a97ba,null))[_0x12bc('0x22')](function(_0x3a32aa){if(_0x3a32aa){return _0x3a32aa[_0x12bc('0x8d')](_0x4d2f7a[_0x12bc('0x62')][_0x12bc('0x6e')],_[_0x12bc('0x8f')](_0x4d2f7a[_0x12bc('0x62')],[_0x12bc('0x6e'),'id'])||{});}})[_0x12bc('0x22')](respondWithResult(_0x2a97ba,null))['catch'](handleError(_0x2a97ba,null));};exports['getInteractions']=function(_0xbaceae,_0x58f4cc,_0x505d1a){var _0x5832be={'raw':![],'where':{}};var _0x46f8df={};var _0x176d54={'count':0x0,'rows':[]};return db['MailAccount'][_0x12bc('0x67')]({'where':{'id':_0xbaceae['params']['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0x58f4cc,null))[_0x12bc('0x22')](function(_0x4028ef){if(_0x4028ef){_0x46f8df[_0x12bc('0x4b')]=_[_0x12bc('0x47')](db['MailInteraction'][_0x12bc('0x43')]);_0x46f8df['query']=_['keys'](_0xbaceae['query']);_0x46f8df[_0x12bc('0x49')]=_['intersection'](_0x46f8df[_0x12bc('0x4b')],_0x46f8df[_0x12bc('0x48')]);_0x5832be['attributes']=_['intersection'](_0x46f8df[_0x12bc('0x4b')],qs[_0x12bc('0x4d')](_0xbaceae['query'][_0x12bc('0x4d')]));_0x5832be[_0x12bc('0x4c')]=_0x5832be[_0x12bc('0x4c')]['length']?_0x5832be['attributes']:_0x46f8df[_0x12bc('0x4b')];if(!_0xbaceae['query']['hasOwnProperty'](_0x12bc('0x4f'))){_0x5832be[_0x12bc('0x2f')]=qs[_0x12bc('0x2f')](_0xbaceae[_0x12bc('0x48')][_0x12bc('0x2f')]);_0x5832be['offset']=qs[_0x12bc('0x30')](_0xbaceae['query'][_0x12bc('0x30')]);}_0x5832be[_0x12bc('0x50')]=qs[_0x12bc('0x69')](_0xbaceae[_0x12bc('0x48')][_0x12bc('0x69')]);_0x5832be[_0x12bc('0x52')]=qs[_0x12bc('0x49')](_[_0x12bc('0x51')](_0xbaceae[_0x12bc('0x48')],_0x46f8df[_0x12bc('0x49')]));_0x5832be[_0x12bc('0x52')][_0x12bc('0x6a')]=_0x4028ef['id'];if(_0xbaceae[_0x12bc('0x48')][_0x12bc('0x55')]){_0x5832be[_0x12bc('0x52')]=_[_0x12bc('0x53')](_0x5832be[_0x12bc('0x52')],{'$or':_[_0x12bc('0x42')](_0x5832be[_0x12bc('0x4c')],function(_0x55ac97){var _0x45fb13={};_0x45fb13[_0x55ac97]={'$like':'%'+_0xbaceae[_0x12bc('0x48')][_0x12bc('0x55')]+'%'};return _0x45fb13;})});}_0x5832be=_[_0x12bc('0x53')]({},_0x5832be,_0xbaceae[_0x12bc('0x6b')]);return db[_0x12bc('0x8e')][_0x12bc('0x57')]({'where':_0x5832be[_0x12bc('0x52')]})[_0x12bc('0x22')](function(_0x1d258d){_0x176d54[_0x12bc('0x57')]=_0x1d258d;if(_0xbaceae[_0x12bc('0x48')][_0x12bc('0x58')]){_0x5832be[_0x12bc('0x59')]=[{'model':db[_0x12bc('0x90')],'as':_0x12bc('0x91'),'required':![]},{'model':db[_0x12bc('0x92')],'as':'Owner','attributes':['name',_0x12bc('0x93'),_0x12bc('0x94')],'required':![]},{'model':db[_0x12bc('0x95')],'as':_0x12bc('0x96'),'attributes':['id','name',_0x12bc('0x97')],'where':_0xbaceae[_0x12bc('0x48')][_0x12bc('0x98')]?{'id':_0xbaceae[_0x12bc('0x48')][_0x12bc('0x98')]}:undefined,'required':_0xbaceae[_0x12bc('0x48')][_0x12bc('0x98')]?!![]:![]}];}return db[_0x12bc('0x8e')][_0x12bc('0x5a')](_0x5832be);})['then'](function(_0x12e26e){_0x176d54[_0x12bc('0x5b')]=_0x12e26e;return _0x176d54;});}})['then'](respondWithFilteredResult(_0x58f4cc,_0x5832be))[_0x12bc('0x5c')](handleError(_0x58f4cc,null));};exports['addApplications']=function addApplications(_0x4e169f,_0x3f5f50){var _0x47c388=_0x4e169f[_0x12bc('0x5e')]['id'];var _0x511e30=_0x4e169f[_0x12bc('0x62')];var _0x31faf5=0xc8;var _0x53ab9f=null;return db['sequelize'][_0x12bc('0x99')]({'isolationLevel':db['sequelize'][_0x12bc('0x9a')][_0x12bc('0x9b')][_0x12bc('0x9c')]},function(_0x3b4675){return db['MailAccount'][_0x12bc('0x67')]({'where':{'id':_0x47c388},'transaction':_0x3b4675})[_0x12bc('0x22')](function(_0x41e9c7){if(_0x41e9c7){return db[_0x12bc('0x9d')][_0x12bc('0x38')]({'where':{'MailAccountId':_0x47c388},'transaction':_0x3b4675})[_0x12bc('0x22')](function(){var _0xe5b0e0=_['map'](_0x511e30,function(_0x17a89a){_0x17a89a[_0x12bc('0x6a')]=_0x47c388;return _0x17a89a;});return db[_0x12bc('0x9d')][_0x12bc('0x9e')](_0xe5b0e0,{'transaction':_0x3b4675});});}else{_0x31faf5=0x194;_0x53ab9f=[];}});})[_0x12bc('0x22')](function(){if(_0x31faf5!==0x194){return db['MailApplication'][_0x12bc('0x9f')]({'where':{'MailAccountId':_0x47c388},'order':_0x12bc('0xa0')})['then'](function(_0x5543e6){_0x53ab9f=_0x5543e6;});}})[_0x12bc('0x5c')](function(_0x55e048){_0x31faf5=0x1f4;logger['error'](_0x55e048[_0x12bc('0xa1')]);if(_0x55e048[_0x12bc('0x3d')]){delete _0x55e048[_0x12bc('0x3d')];}_0x53ab9f=_0x55e048;})['finally'](function(){if(_0x53ab9f===null){_0x3f5f50[_0x12bc('0x3c')](_0x31faf5);}else{if(_0x31faf5===0x1f4){_0x3f5f50[_0x12bc('0x2d')](_0x31faf5)[_0x12bc('0x3e')](_0x53ab9f);}else{_0x3f5f50['status'](_0x31faf5)[_0x12bc('0x33')](_0x53ab9f);}}});};exports[_0x12bc('0xa2')]=function(_0x9da41,_0x1b5885,_0x5278fe){var _0x5702a0={};var _0x39d7f8={};var _0x1fafa2;var _0x236c09;return db[_0x12bc('0x56')][_0x12bc('0x67')]({'where':{'id':_0x9da41['params']['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0x1b5885,null))[_0x12bc('0x22')](function(_0x42816f){if(_0x42816f){_0x1fafa2=_0x42816f;_0x39d7f8['model']=_[_0x12bc('0x47')](db[_0x12bc('0x9d')]['rawAttributes']);_0x39d7f8[_0x12bc('0x48')]=_[_0x12bc('0x47')](_0x9da41['query']);_0x39d7f8[_0x12bc('0x49')]=_[_0x12bc('0x4a')](_0x39d7f8[_0x12bc('0x4b')],_0x39d7f8[_0x12bc('0x48')]);_0x5702a0[_0x12bc('0x4c')]=_[_0x12bc('0x4a')](_0x39d7f8[_0x12bc('0x4b')],qs[_0x12bc('0x4d')](_0x9da41[_0x12bc('0x48')][_0x12bc('0x4d')]));_0x5702a0[_0x12bc('0x4c')]=_0x5702a0[_0x12bc('0x4c')][_0x12bc('0x4e')]?_0x5702a0['attributes']:_0x39d7f8[_0x12bc('0x4b')];_0x5702a0[_0x12bc('0x50')]=qs[_0x12bc('0x69')](_0x9da41[_0x12bc('0x48')][_0x12bc('0x69')]);_0x5702a0[_0x12bc('0x52')]=qs[_0x12bc('0x49')](_[_0x12bc('0x51')](_0x9da41[_0x12bc('0x48')],_0x39d7f8[_0x12bc('0x49')]));if(_0x9da41[_0x12bc('0x48')][_0x12bc('0x55')]){_0x5702a0[_0x12bc('0x52')]=_[_0x12bc('0x53')](_0x5702a0['where'],{'$or':_['map'](_0x5702a0[_0x12bc('0x4c')],function(_0x472e89){var _0x55ad61={};_0x55ad61[_0x472e89]={'$like':'%'+_0x9da41[_0x12bc('0x48')][_0x12bc('0x55')]+'%'};return _0x55ad61;})});}_0x5702a0=_['merge']({},_0x5702a0,_0x9da41[_0x12bc('0x6b')]);return _0x1fafa2[_0x12bc('0xa2')](_0x5702a0);}})['then'](function(_0x316a0f){if(_0x316a0f){_0x236c09=_0x316a0f[_0x12bc('0x4e')];if(!_0x9da41[_0x12bc('0x48')][_0x12bc('0x68')](_0x12bc('0x4f'))){_0x5702a0[_0x12bc('0x2f')]=qs['limit'](_0x9da41[_0x12bc('0x48')][_0x12bc('0x2f')]);_0x5702a0[_0x12bc('0x30')]=qs[_0x12bc('0x30')](_0x9da41[_0x12bc('0x48')][_0x12bc('0x30')]);}return _0x1fafa2['getApplications'](_0x5702a0);}})[_0x12bc('0x22')](function(_0x1b8511){if(_0x1b8511){return _0x1b8511?{'count':_0x236c09,'rows':_0x1b8511}:null;}})[_0x12bc('0x22')](respondWithResult(_0x1b5885,null))[_0x12bc('0x5c')](handleError(_0x1b5885,null));};exports[_0x12bc('0xa3')]=function(_0x1aac92,_0x406204,_0x4930d1){var _0x517ec9={'raw':!![],'where':{}};var _0x1adbff={};var _0x53a5ea={'count':0x0,'rows':[]};return db[_0x12bc('0x56')]['findOne']({'where':{'id':_0x1aac92[_0x12bc('0x5e')]['id']}})['then'](handleEntityNotFound(_0x406204,null))['then'](function(_0x3cd62c){if(_0x3cd62c){_0x1adbff[_0x12bc('0x4b')]=_['keys'](db[_0x12bc('0xa4')]['rawAttributes']);_0x1adbff[_0x12bc('0x48')]=_['keys'](_0x1aac92[_0x12bc('0x48')]);_0x1adbff[_0x12bc('0x49')]=_[_0x12bc('0x4a')](_0x1adbff[_0x12bc('0x4b')],_0x1adbff['query']);_0x517ec9['attributes']=_['intersection'](_0x1adbff[_0x12bc('0x4b')],qs[_0x12bc('0x4d')](_0x1aac92[_0x12bc('0x48')][_0x12bc('0x4d')]));_0x517ec9[_0x12bc('0x4c')]=_0x517ec9[_0x12bc('0x4c')][_0x12bc('0x4e')]?_0x517ec9[_0x12bc('0x4c')]:_0x1adbff['model'];if(!_0x1aac92['query']['hasOwnProperty'](_0x12bc('0x4f'))){_0x517ec9['limit']=qs['limit'](_0x1aac92[_0x12bc('0x48')]['limit']);_0x517ec9[_0x12bc('0x30')]=qs[_0x12bc('0x30')](_0x1aac92[_0x12bc('0x48')]['offset']);}_0x517ec9[_0x12bc('0x50')]=qs[_0x12bc('0x69')](_0x1aac92['query']['sort']);_0x517ec9[_0x12bc('0x52')]=qs['filters'](_[_0x12bc('0x51')](_0x1aac92['query'],_0x1adbff[_0x12bc('0x49')]));_0x517ec9[_0x12bc('0x52')][_0x12bc('0x6a')]=_0x3cd62c['id'];if(_0x1aac92['query'][_0x12bc('0x55')]){_0x517ec9[_0x12bc('0x52')]=_[_0x12bc('0x53')](_0x517ec9[_0x12bc('0x52')],{'$or':_[_0x12bc('0x42')](_0x517ec9[_0x12bc('0x4c')],function(_0x370ca0){var _0x4697a9={};_0x4697a9[_0x370ca0]={'$like':'%'+_0x1aac92[_0x12bc('0x48')]['filter']+'%'};return _0x4697a9;})});}if(_0x1aac92[_0x12bc('0x48')][_0x12bc('0xa5')]){var _0x3ae07b=_0x1aac92[_0x12bc('0x48')][_0x12bc('0xa5')][_0x12bc('0xa6')](',');var _0x5252ac={};_0x5252ac[_0x3ae07b[0x0]]={'$gte':moment(_0x3ae07b[0x1])[_0x12bc('0xa7')](_0x12bc('0xa8'))};_0x517ec9[_0x12bc('0x52')]=_[_0x12bc('0x53')](_0x517ec9[_0x12bc('0x52')],_0x5252ac);}_0x517ec9=_[_0x12bc('0x53')]({},_0x517ec9,_0x1aac92[_0x12bc('0x6b')]);return db[_0x12bc('0xa4')][_0x12bc('0x57')]({'where':_0x517ec9[_0x12bc('0x52')]})[_0x12bc('0x22')](function(_0x15ac8f){_0x53a5ea[_0x12bc('0x57')]=_0x15ac8f;if(_0x1aac92['query']['includeAll']){_0x517ec9[_0x12bc('0x59')]=[{'all':!![]}];}return db[_0x12bc('0xa4')][_0x12bc('0x5a')](_0x517ec9);})['then'](function(_0x188582){if(_0x1aac92[_0x12bc('0x48')]['inlineCss']===_0x12bc('0xa9')){for(var _0xa17aae=0x0;_0xa17aae<_0x188582[_0x12bc('0x4e')];_0xa17aae++){_0x188582[_0xa17aae]['body']=juice(_0x188582[_0xa17aae][_0x12bc('0x62')]);}}_0x53a5ea[_0x12bc('0x5b')]=_0x188582;return _0x53a5ea;});}})[_0x12bc('0x22')](respondWithFilteredResult(_0x406204,_0x517ec9))[_0x12bc('0x5c')](handleError(_0x406204,null));};exports[_0x12bc('0x3e')]=function(_0x382a88,_0x229db1,_0x129e09){var _0x3fa44d,_0x39b8cd={},_0x2c9701;if(_0x382a88[_0x12bc('0x62')]['to']){_0x2c9701=_0x382a88[_0x12bc('0x62')]['to']['split'](',')[0x0];}return db[_0x12bc('0x56')][_0x12bc('0x61')]({'where':{'id':_0x382a88[_0x12bc('0x5e')]['id']},'include':[{'model':db[_0x12bc('0xaa')],'as':_0x12bc('0xab'),'include':[{'model':db[_0x12bc('0x90')],'as':'Contacts','where':{'email':_0x2c9701},'limit':0x1,'order':[[_0x12bc('0xac'),_0x12bc('0xad')]]}]},{'model':db[_0x12bc('0x5f')],'as':_0x12bc('0x40'),'raw':!![]}]})['then'](handleEntityNotFound(_0x229db1,null))['then'](function(_0x2c16f9){if(_0x2c16f9){_0x3fa44d=_0x2c16f9;if(_0x2c16f9[_0x12bc('0x40')]){if(_[_0x12bc('0x76')](_0x382a88[_0x12bc('0x62')][_0x12bc('0xae')])){_0x382a88[_0x12bc('0x62')]['from']=util[_0x12bc('0xa7')]('%s\x20<%s>',_0x2c16f9['name'],_0x2c16f9[_0x12bc('0x74')]||_0x2c16f9[_0x12bc('0x40')][_0x12bc('0x7a')]);}if(_0x382a88[_0x12bc('0x62')]['attachments']&&_0x382a88[_0x12bc('0x62')]['attachments'][_0x12bc('0x4e')]){for(var _0x240cd4=0x0;_0x240cd4<_0x382a88[_0x12bc('0x62')][_0x12bc('0xaf')][_0x12bc('0x4e')];_0x240cd4+=0x1){_0x382a88[_0x12bc('0x62')][_0x12bc('0xaf')][_0x240cd4]={'filename':_0x382a88[_0x12bc('0x62')][_0x12bc('0xaf')][_0x240cd4][_0x12bc('0x3d')],'path':path[_0x12bc('0xb0')](config[_0x12bc('0xb1')],_0x12bc('0xb2'),_0x382a88[_0x12bc('0x62')]['attachments'][_0x240cd4]['basename'])};}}var _0x47e261={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x2c16f9['Smtp'][_0x12bc('0x81')])){if(_0x2c16f9[_0x12bc('0x40')]['authentication']){_0x47e261[_0x12bc('0xb3')]={'user':_0x2c16f9[_0x12bc('0x40')]['user'],'pass':_0x2c16f9['Smtp'][_0x12bc('0x83')]};}_0x47e261[_0x12bc('0x7f')]=_0x2c16f9[_0x12bc('0x40')][_0x12bc('0x7f')];_0x47e261['port']=_0x2c16f9['Smtp'][_0x12bc('0x80')];_0x47e261[_0x12bc('0xb4')]=_0x2c16f9[_0x12bc('0x40')][_0x12bc('0xb4')];}else{_0x47e261[_0x12bc('0x81')]=_0x2c16f9[_0x12bc('0x40')][_0x12bc('0x81')];_0x47e261['auth']={'user':_0x2c16f9[_0x12bc('0x40')][_0x12bc('0x7a')],'pass':_0x2c16f9[_0x12bc('0x40')]['pass']};}return respondWithRpcPromise(_0x12bc('0xb5'),_0x12bc('0xb6'),{'account':_0x47e261,'message':_0x382a88[_0x12bc('0x62')]});}else{throw new Error(_0x12bc('0xb7'));}}})[_0x12bc('0x22')](function(_0x4f1201){if(_0x4f1201){_0x39b8cd=_0x4f1201;if(_0x3fa44d['List']){if(_0x3fa44d['List'][_0x12bc('0xb8')][_0x12bc('0x4e')]){return _0x3fa44d['List']['Contacts'][0x0];}else{return db[_0x12bc('0x90')]['create'](_['defaults'](_0x382a88[_0x12bc('0x62')],{'firstName':_0x382a88['body']['to'],'email':_0x382a88[_0x12bc('0x62')]['to'],'phone':_0x382a88[_0x12bc('0x62')]['to'],'ListId':_0x3fa44d[_0x12bc('0x75')]}));}}else{throw new Error(_0x12bc('0xb7'));}}})[_0x12bc('0x22')](function(_0x20f208){if(_0x20f208){var _0x160aa2={'UserId':_0x382a88[_0x12bc('0x7a')]['id'],'ContactId':_0x20f208['id'],'MailAccountId':_0x3fa44d['id'],'inReplyTo':_0x39b8cd[_0x12bc('0xb9')],'to':_0x382a88[_0x12bc('0x62')][_0x12bc('0xae')],'cc':_0x382a88[_0x12bc('0x62')]['cc'],'subject':_0x382a88[_0x12bc('0x62')][_0x12bc('0xba')],'attach':_0x382a88['body'][_0x12bc('0xbb')],'firstMsgDirection':_0x12bc('0xbc'),'lastMsgAt':moment()['format'](_0x12bc('0xa8')),'lastMsgDirection':_0x12bc('0xbc'),'Messages':[_[_0x12bc('0x53')](_0x382a88[_0x12bc('0x62')],{'messageId':_0x39b8cd['messageId'],'sentAt':moment()['format'](_0x12bc('0xa8')),'read':!![],'MailAccountId':_0x3fa44d['id'],'UserId':_0x382a88[_0x12bc('0x7a')]['id'],'ContactId':_0x20f208['id']})]};if(_0x382a88['body'][_0x12bc('0xbd')]){_0x160aa2=_[_0x12bc('0x53')](_0x160aa2,_0x382a88[_0x12bc('0x62')][_0x12bc('0xbd')]);}return db[_0x12bc('0x8e')][_0x12bc('0x71')](_0x160aa2,{'include':[{'model':db['MailMessage'],'as':_0x12bc('0xbe')}]});}})[_0x12bc('0x22')](respondWithResult(_0x229db1,null))[_0x12bc('0x5c')](handleError(_0x229db1,null));};exports[_0x12bc('0xbf')]=function(_0x5e58d3,_0xce0776,_0x15720c){return db[_0x12bc('0x56')]['find']({'where':{'id':_0x5e58d3[_0x12bc('0x5e')]['id']},'include':[{'model':db[_0x12bc('0x5f')],'as':_0x12bc('0x40'),'raw':!![]}]})[_0x12bc('0x22')](handleEntityNotFound(_0xce0776,null))[_0x12bc('0x22')](function(_0x5aeb2a){if(_0x5aeb2a&&_0x5aeb2a[_0x12bc('0x40')]){var _0x53e660={'id':_0x5aeb2a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5aeb2a[_0x12bc('0x40')][_0x12bc('0x81')]){_0x53e660['service']=_0x5aeb2a[_0x12bc('0x40')][_0x12bc('0x81')];}else{_0x53e660[_0x12bc('0x7f')]=_0x5aeb2a[_0x12bc('0x40')]['host'];_0x53e660[_0x12bc('0x80')]=_0x5aeb2a[_0x12bc('0x40')][_0x12bc('0x80')];_0x53e660[_0x12bc('0xb4')]=_0x5aeb2a[_0x12bc('0x40')][_0x12bc('0xb4')];}if(_0x5aeb2a[_0x12bc('0x40')][_0x12bc('0x7e')]){_0x53e660[_0x12bc('0xb3')]={'user':_0x5aeb2a[_0x12bc('0x40')]['user'],'pass':_0x5aeb2a['Smtp'][_0x12bc('0x83')]};}return respondWithRpcPromise(_0x12bc('0xc0'),_0x12bc('0xbf'),{'account':_0x53e660});}})['then'](respondWithResult(_0xce0776,null))[_0x12bc('0x5c')](handleError(_0xce0776,null));};exports['destroy']=function(_0x5d7305,_0x470857){return db[_0x12bc('0x56')][_0x12bc('0x61')]({'where':{'id':_0x5d7305[_0x12bc('0x5e')]['id']}})['then'](handleEntityNotFound(_0x470857,null))['then'](function(_0x454a53){if(_0x454a53&&_0x454a53[_0x12bc('0x81')]){throw new db[(_0x12bc('0xc1'))][(_0x12bc('0xc2'))](_0x12bc('0xc3'));}return _0x454a53;})['then'](removeEntity(_0x470857,null))[_0x12bc('0x5c')](handleError(_0x470857,null));};exports[_0x12bc('0xc4')]=function(_0x4557b7,_0x222343,_0x5be605){return db[_0x12bc('0x56')][_0x12bc('0x61')]({'where':{'id':_0x4557b7[_0x12bc('0x5e')]['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0x222343,null))['then'](function(_0x57b2e0){if(_0x57b2e0){return _0x57b2e0['addAgents'](_0x4557b7[_0x12bc('0x62')][_0x12bc('0x6e')],_[_0x12bc('0x8f')](_0x4557b7[_0x12bc('0x62')],[_0x12bc('0x6e'),'id'])||{})[_0x12bc('0xc5')](function(_0x3924b3){for(var _0x223bc7=0x0;_0x223bc7<_0x4557b7[_0x12bc('0x62')]['ids'][_0x12bc('0x4e')];_0x223bc7+=0x1){socket[_0x12bc('0xc6')](_0x12bc('0xc7'),{'UserId':Number(_0x4557b7[_0x12bc('0x62')][_0x12bc('0x6e')][_0x223bc7]),'MailAccountId':Number(_0x4557b7['params']['id'])});}return _0x3924b3;});}})[_0x12bc('0x22')](respondWithResult(_0x222343,null))['catch'](handleError(_0x222343,null));};exports[_0x12bc('0xc8')]=function(_0x54d8a3,_0x374e08,_0x1129a0){return db[_0x12bc('0x56')]['find']({'where':{'id':_0x54d8a3[_0x12bc('0x5e')]['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0x374e08,null))[_0x12bc('0x22')](function(_0x6731fa){if(_0x6731fa){return _0x6731fa[_0x12bc('0xc8')](_0x54d8a3[_0x12bc('0x48')][_0x12bc('0x6e')])[_0x12bc('0x22')](function(){if(_[_0x12bc('0xc9')](_0x54d8a3[_0x12bc('0x48')][_0x12bc('0x6e')])){for(var _0x43eb7a=0x0;_0x43eb7a<_0x54d8a3[_0x12bc('0x48')][_0x12bc('0x6e')][_0x12bc('0x4e')];_0x43eb7a+=0x1){socket[_0x12bc('0xc6')](_0x12bc('0xca'),{'UserId':Number(_0x54d8a3['query'][_0x12bc('0x6e')][_0x43eb7a]),'MailAccountId':Number(_0x54d8a3[_0x12bc('0x5e')]['id'])});}}else{socket[_0x12bc('0xc6')](_0x12bc('0xca'),{'UserId':Number(_0x54d8a3[_0x12bc('0x48')][_0x12bc('0x6e')]),'MailAccountId':Number(_0x54d8a3[_0x12bc('0x5e')]['id'])});}});}})[_0x12bc('0x22')](respondWithStatusCode(_0x374e08,null))[_0x12bc('0x5c')](handleError(_0x374e08,null));};exports[_0x12bc('0xcb')]=function(_0x194094,_0x494b23,_0x2de415){var _0x3a3ac2={};var _0xd7e251={};var _0x1c5ffb;var _0x3279dc;return db[_0x12bc('0x56')][_0x12bc('0x67')]({'where':{'id':_0x194094['params']['id']}})[_0x12bc('0x22')](handleEntityNotFound(_0x494b23,null))['then'](function(_0x4d9602){if(_0x4d9602){_0x1c5ffb=_0x4d9602;_0xd7e251[_0x12bc('0x4b')]=_[_0x12bc('0x47')](db['User'][_0x12bc('0x43')]);_0xd7e251['query']=_[_0x12bc('0x47')](_0x194094[_0x12bc('0x48')]);_0xd7e251[_0x12bc('0x49')]=_[_0x12bc('0x4a')](_0xd7e251[_0x12bc('0x4b')],_0xd7e251[_0x12bc('0x48')]);_0x3a3ac2['attributes']=_[_0x12bc('0x4a')](_0xd7e251['model'],qs[_0x12bc('0x4d')](_0x194094[_0x12bc('0x48')][_0x12bc('0x4d')]));_0x3a3ac2[_0x12bc('0x4c')]=_0x3a3ac2[_0x12bc('0x4c')][_0x12bc('0x4e')]?_0x3a3ac2[_0x12bc('0x4c')]:_0xd7e251[_0x12bc('0x4b')];_0x3a3ac2[_0x12bc('0x50')]=qs[_0x12bc('0x69')](_0x194094['query'][_0x12bc('0x69')]);_0x3a3ac2['where']=qs[_0x12bc('0x49')](_[_0x12bc('0x51')](_0x194094[_0x12bc('0x48')],_0xd7e251[_0x12bc('0x49')]));if(_0x194094[_0x12bc('0x48')][_0x12bc('0x55')]){_0x3a3ac2['where']=_[_0x12bc('0x53')](_0x3a3ac2[_0x12bc('0x52')],{'$or':_[_0x12bc('0x42')](_0x3a3ac2[_0x12bc('0x4c')],function(_0x4eb11a){var _0x525188={};_0x525188[_0x4eb11a]={'$like':'%'+_0x194094['query'][_0x12bc('0x55')]+'%'};return _0x525188;})});}_0x3a3ac2=_[_0x12bc('0x53')]({},_0x3a3ac2,_0x194094[_0x12bc('0x6b')]);return _0x1c5ffb[_0x12bc('0xcb')](_0x3a3ac2);}})[_0x12bc('0x22')](function(_0x86d6ba){if(_0x86d6ba){_0x3279dc=_0x86d6ba[_0x12bc('0x4e')];if(!_0x194094[_0x12bc('0x48')]['hasOwnProperty']('nolimit')){_0x3a3ac2[_0x12bc('0x2f')]=qs[_0x12bc('0x2f')](_0x194094[_0x12bc('0x48')][_0x12bc('0x2f')]);_0x3a3ac2['offset']=qs[_0x12bc('0x30')](_0x194094[_0x12bc('0x48')][_0x12bc('0x30')]);}return _0x1c5ffb[_0x12bc('0xcb')](_0x3a3ac2);}})[_0x12bc('0x22')](function(_0x502a5a){if(_0x502a5a){return _0x502a5a?{'count':_0x3279dc,'rows':_0x502a5a}:null;}})['then'](respondWithResult(_0x494b23,null))['catch'](handleError(_0x494b23,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 1ecd0b5..75f7a9c 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 _0x3c85=['remove','emit','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x48a2f2,_0x279848){var _0x2a9490=function(_0x3aff73){while(--_0x3aff73){_0x48a2f2['push'](_0x48a2f2['shift']());}};_0x2a9490(++_0x279848);}(_0x3c85,0x1a0));var _0x53c8=function(_0x3ea797,_0x5c4c2f){_0x3ea797=_0x3ea797-0x0;var _0x264804=_0x3c85[_0x3ea797];return _0x264804;};'use strict';var EventEmitter=require(_0x53c8('0x0'));var MailAccount=require(_0x53c8('0x1'))['db'][_0x53c8('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x53c8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x53c8('0x4')};function emitEvent(_0xcc2f5f){return function(_0x44a11e,_0x4be799,_0x270365){MailAccountEvents[_0x53c8('0x5')](_0xcc2f5f+':'+_0x44a11e['id'],_0x44a11e);MailAccountEvents[_0x53c8('0x5')](_0xcc2f5f,_0x44a11e);_0x270365(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x3cdc=['MailAccount','setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x18b8cb,_0xbd3c14){var _0x2645ce=function(_0xb190da){while(--_0xb190da){_0x18b8cb['push'](_0x18b8cb['shift']());}};_0x2645ce(++_0xbd3c14);}(_0x3cdc,0x18b));var _0xc3cd=function(_0x5a5f6d,_0x2b614b){_0x5a5f6d=_0x5a5f6d-0x0;var _0x14edb7=_0x3cdc[_0x5a5f6d];return _0x14edb7;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xc3cd('0x0'))['db'][_0xc3cd('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xc3cd('0x2')](0x0);var events={'afterCreate':_0xc3cd('0x3'),'afterUpdate':_0xc3cd('0x4'),'afterDestroy':_0xc3cd('0x5')};function emitEvent(_0x3b90ad){return function(_0x3274f6,_0x15811d,_0x275374){MailAccountEvents[_0xc3cd('0x6')](_0x3b90ad+':'+_0x3274f6['id'],_0x3274f6);MailAccountEvents[_0xc3cd('0x6')](_0x3b90ad,_0x3274f6);_0x275374(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xc3cd('0x7')](e,emitEvent(event));}}module[_0xc3cd('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 cb78212..7f529e4 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 _0x04da=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailAccount.attributes','exports','define','mail_accounts','util','../../config/logger'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x04da,0x77));var _0xa04d=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0x04da[_0x15dbca];return _0x326533;};'use strict';var _=require('lodash');var util=require(_0xa04d('0x0'));var logger=require(_0xa04d('0x1'))('api');var moment=require(_0xa04d('0x2'));var BPromise=require(_0xa04d('0x3'));var rp=require(_0xa04d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa04d('0x5'));var config=require(_0xa04d('0x6'));var attributes=require(_0xa04d('0x7'));module[_0xa04d('0x8')]=function(_0x524179,_0x3a0339){return _0x524179[_0xa04d('0x9')]('MailAccount',attributes,{'tableName':_0xa04d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe40d=['MailAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define'];(function(_0x3e1829,_0xc8ccda){var _0x129345=function(_0x2357c0){while(--_0x2357c0){_0x3e1829['push'](_0x3e1829['shift']());}};_0x129345(++_0xc8ccda);}(_0xe40d,0x15f));var _0xde40=function(_0x1bf002,_0x564016){_0x1bf002=_0x1bf002-0x0;var _0x101820=_0xe40d[_0x1bf002];return _0x101820;};'use strict';var _=require(_0xde40('0x0'));var util=require(_0xde40('0x1'));var logger=require(_0xde40('0x2'))(_0xde40('0x3'));var moment=require(_0xde40('0x4'));var BPromise=require(_0xde40('0x5'));var rp=require(_0xde40('0x6'));var fs=require('fs');var path=require(_0xde40('0x7'));var rimraf=require(_0xde40('0x8'));var config=require(_0xde40('0x9'));var attributes=require(_0xde40('0xa'));module[_0xde40('0xb')]=function(_0x31d41f,_0x305204){return _0x31d41f[_0xde40('0xc')](_0xde40('0xd'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 990be07..a4e2cd2 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 _0xd6e9=['DESC','MailApplication','Applications','Smtp','omit','applications','list','priority','asc','length','close','*,*,*,*','defaults','create','List\x20not\x20found','contact','generate','messageId','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','spread','update','get','interaction','created','subject','originTo','originCc','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMailAccount','findAll','options','where','map','include','model','attributes','ShowMailAccount','MailAccount','find','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','account','CmList','List','Contacts'];(function(_0x12f665,_0x2dbc7e){var _0xd48436=function(_0x184d3d){while(--_0x184d3d){_0x12f665['push'](_0x12f665['shift']());}};_0xd48436(++_0x2dbc7e);}(_0xd6e9,0x1b3));var _0x9d6e=function(_0x33ff8f,_0x2a374d){_0x33ff8f=_0x33ff8f-0x0;var _0x46fa60=_0xd6e9[_0x33ff8f];return _0x46fa60;};'use strict';var _=require(_0x9d6e('0x0'));var util=require(_0x9d6e('0x1'));var moment=require('moment');var BPromise=require(_0x9d6e('0x2'));var rs=require(_0x9d6e('0x3'));var fs=require('fs');var Redis=require(_0x9d6e('0x4'));var db=require(_0x9d6e('0x5'))['db'];var utils=require(_0x9d6e('0x6'));var logger=require(_0x9d6e('0x7'))('rpc');var config=require(_0x9d6e('0x8'));var jayson=require(_0x9d6e('0x9'));var client=jayson[_0x9d6e('0xa')][_0x9d6e('0xb')]({'port':0x232c});config['redis']=_['defaults'](config['redis'],{'host':_0x9d6e('0xc'),'port':0x18eb});var socket=require(_0x9d6e('0xd'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x9d6e('0xe')](socket);function respondWithRpcPromise(_0x1a6c3f,_0x3a25b5,_0x22bf26){return new BPromise(function(_0x2793a2,_0x2661a6){return client[_0x9d6e('0xf')](_0x1a6c3f,_0x22bf26)[_0x9d6e('0x10')](function(_0x42c600){logger[_0x9d6e('0x11')](_0x9d6e('0x12'),_0x3a25b5,_0x9d6e('0x13'));logger[_0x9d6e('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3a25b5,_0x9d6e('0x13'),JSON[_0x9d6e('0x15')](_0x42c600));if(_0x42c600[_0x9d6e('0x16')]){if(_0x42c600[_0x9d6e('0x16')]['code']===0x1f4){logger[_0x9d6e('0x16')]('MailAccount,\x20%s,\x20%s',_0x3a25b5,_0x42c600['error']['message']);return _0x2661a6(_0x42c600['error']['message']);}logger['error'](_0x9d6e('0x12'),_0x3a25b5,_0x42c600['error'][_0x9d6e('0x17')]);return _0x2793a2(_0x42c600[_0x9d6e('0x16')][_0x9d6e('0x17')]);}else{logger[_0x9d6e('0x11')](_0x9d6e('0x12'),_0x3a25b5,'request\x20sent');_0x2793a2(_0x42c600[_0x9d6e('0x18')][_0x9d6e('0x17')]);}})[_0x9d6e('0x19')](function(_0x5ae54f){logger[_0x9d6e('0x16')](_0x9d6e('0x12'),_0x3a25b5,_0x5ae54f);_0x2661a6(_0x5ae54f);});});}exports[_0x9d6e('0x1a')]=function(_0x55e8e9){var _0x54bcc3=this;return new Promise(function(_0x5f221d,_0x4793ea){return db['MailAccount'][_0x9d6e('0x1b')]({'raw':_0x55e8e9['options']?_0x55e8e9[_0x9d6e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x55e8e9[_0x9d6e('0x1c')]?_0x55e8e9[_0x9d6e('0x1c')][_0x9d6e('0x1d')]||null:null,'attributes':_0x55e8e9[_0x9d6e('0x1c')]?_0x55e8e9[_0x9d6e('0x1c')]['attributes']||null:null,'limit':_0x55e8e9['options']?_0x55e8e9['options']['limit']||null:null,'include':_0x55e8e9['options']?_0x55e8e9[_0x9d6e('0x1c')]['include']?_[_0x9d6e('0x1e')](_0x55e8e9[_0x9d6e('0x1c')]['include'],function(_0x5710a9){return{'model':db[_0x5710a9['model']],'as':_0x5710a9['as'],'attributes':_0x5710a9['attributes'],'include':_0x5710a9['include']?_[_0x9d6e('0x1e')](_0x5710a9[_0x9d6e('0x1f')],function(_0x12f3fd){return{'model':db[_0x12f3fd['model']],'as':_0x12f3fd['as'],'attributes':_0x12f3fd['attributes'],'include':_0x12f3fd[_0x9d6e('0x1f')]?_[_0x9d6e('0x1e')](_0x12f3fd[_0x9d6e('0x1f')],function(_0x28f231){return{'model':db[_0x28f231[_0x9d6e('0x20')]],'as':_0x28f231['as'],'attributes':_0x28f231[_0x9d6e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9d6e('0x10')](function(_0x47a005){logger[_0x9d6e('0x11')](_0x9d6e('0x1a'),_0x55e8e9);logger[_0x9d6e('0x14')](_0x9d6e('0x1a'),_0x55e8e9,JSON[_0x9d6e('0x15')](_0x47a005));_0x5f221d(_0x47a005);})[_0x9d6e('0x19')](function(_0xa383e1){logger['error'](_0x9d6e('0x1a'),_0xa383e1['message'],_0x55e8e9);_0x4793ea(_0x54bcc3[_0x9d6e('0x16')](0x1f4,_0xa383e1[_0x9d6e('0x17')]));});});};exports[_0x9d6e('0x22')]=function(_0x28319b){var _0x5c5df8=this;return new Promise(function(_0x3ad357,_0x57d1c6){return db[_0x9d6e('0x23')][_0x9d6e('0x24')]({'raw':_0x28319b[_0x9d6e('0x1c')]?_0x28319b[_0x9d6e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x28319b[_0x9d6e('0x1c')]?_0x28319b[_0x9d6e('0x1c')][_0x9d6e('0x1d')]||null:null,'attributes':_0x28319b[_0x9d6e('0x1c')]?_0x28319b[_0x9d6e('0x1c')]['attributes']||null:null,'include':_0x28319b[_0x9d6e('0x1c')]?_0x28319b[_0x9d6e('0x1c')][_0x9d6e('0x1f')]?_['map'](_0x28319b[_0x9d6e('0x1c')]['include'],function(_0x4bb5dc){return{'model':db[_0x4bb5dc[_0x9d6e('0x20')]],'as':_0x4bb5dc['as'],'attributes':_0x4bb5dc['attributes'],'include':_0x4bb5dc[_0x9d6e('0x1f')]?_[_0x9d6e('0x1e')](_0x4bb5dc[_0x9d6e('0x1f')],function(_0x57f233){return{'model':db[_0x57f233[_0x9d6e('0x20')]],'as':_0x57f233['as'],'attributes':_0x57f233[_0x9d6e('0x21')],'include':_0x57f233[_0x9d6e('0x1f')]?_['map'](_0x57f233[_0x9d6e('0x1f')],function(_0x5e187c){return{'model':db[_0x5e187c[_0x9d6e('0x20')]],'as':_0x5e187c['as'],'attributes':_0x5e187c[_0x9d6e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9d6e('0x10')](function(_0x8d2f5d){logger[_0x9d6e('0x11')]('ShowMailAccount',_0x28319b);logger[_0x9d6e('0x14')]('ShowMailAccount',_0x28319b,JSON[_0x9d6e('0x15')](_0x8d2f5d));_0x3ad357(_0x8d2f5d);})[_0x9d6e('0x19')](function(_0x39004a){logger[_0x9d6e('0x16')](_0x9d6e('0x22'),_0x39004a[_0x9d6e('0x17')],_0x28319b);_0x57d1c6(_0x5c5df8[_0x9d6e('0x16')](0x1f4,_0x39004a[_0x9d6e('0x17')]));});});};exports['NotifyMailAccount']=function(_0x1afae4){var _0x5c7436=this;return new Promise(function(_0x2a5c04,_0x3f5a6c){var _0x3db02d={'body':_0x1afae4[_0x9d6e('0x25')],'channel':_0x9d6e('0x26')};var _0x5aeb1c=_['difference'](_[_0x9d6e('0x27')](db[_0x9d6e('0x28')][_0x9d6e('0x29')]),[_0x9d6e('0x2a'),_0x9d6e('0x2b'),_0x9d6e('0x2c'),_0x9d6e('0x2d')]);var _0xa2c50c=![];if(_0x1afae4[_0x9d6e('0x25')]['id']){delete _0x1afae4[_0x9d6e('0x25')]['id'];}if(_['isNil'](_0x1afae4['body'][_0x9d6e('0x2e')])){return _0x3f5a6c(_0x5c7436['error'](0x1f4,_0x9d6e('0x2f')));}if(_[_0x9d6e('0x30')](_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x25')])||_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x25')]===''){return _0x3f5a6c(_0x5c7436[_0x9d6e('0x16')](0x1f4,_0x9d6e('0x31')));}if(_[_0x9d6e('0x30')](_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x32')])){return _0x3f5a6c(_0x5c7436[_0x9d6e('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5aeb1c));}if(!_['includes'](_0x5aeb1c,_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x32')])){return _0x3f5a6c(_0x5c7436[_0x9d6e('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5aeb1c));}var _0x28a86b={};_0x28a86b[_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x32')]]=_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x2e')];return db[_0x9d6e('0x23')][_0x9d6e('0x24')]({'where':{'id':_0x1afae4[_0x9d6e('0x33')]['id']},'include':[{'model':db[_0x9d6e('0x34')],'as':_0x9d6e('0x35'),'include':[{'model':db[_0x9d6e('0x28')],'as':_0x9d6e('0x36'),'where':_0x28a86b,'limit':0x1,'order':[[_0x9d6e('0x2b'),_0x9d6e('0x37')]]}]},{'model':db[_0x9d6e('0x38')],'as':_0x9d6e('0x39')},{'model':db['MailServerOut'],'as':_0x9d6e('0x3a')}]})[_0x9d6e('0x10')](function(_0x10d736){if(_0x10d736&&_0x10d736['List']){var _0x412547=_0x10d736['get']({'plain':!![]});_0x3db02d[_0x9d6e('0x33')]=_[_0x9d6e('0x3b')](_0x412547,[_0x9d6e('0x39'),'List']);_0x3db02d[_0x9d6e('0x3c')]=_0x412547['Applications'];_0x3db02d[_0x9d6e('0x3d')]=_0x412547['List'];_0x3db02d[_0x9d6e('0x3c')]=_['orderBy'](_0x3db02d['applications'],[_0x9d6e('0x3e')],[_0x9d6e('0x3f')]);if(_0x3db02d['account']&&_0x3db02d[_0x9d6e('0x33')]['autoclose']){_0x3db02d[_0x9d6e('0x3c')]['push']({'id':0x0,'priority':_0x3db02d[_0x9d6e('0x3c')][_0x9d6e('0x40')]+0x1,'app':_0x9d6e('0x41'),'appdata':'autoclose','interval':_0x9d6e('0x42')});}if(_0x3db02d[_0x9d6e('0x33')][_0x9d6e('0x39')]){delete _0x3db02d[_0x9d6e('0x33')]['Applications'];}if(_0x3db02d['account']['List']){delete _0x3db02d[_0x9d6e('0x33')][_0x9d6e('0x35')];}if(_0x412547[_0x9d6e('0x35')]['Contacts'][_0x9d6e('0x40')]){return _0x412547['List']['Contacts'][0x0];}var _0x1b92b0=_[_0x9d6e('0x43')](_0x1afae4[_0x9d6e('0x25')],{'firstName':_0x1afae4['body'][_0x9d6e('0x2e')],'ListId':_0x412547['ListId']});_0x1b92b0[_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x32')]]=_0x1afae4['body']['from'];return db['CmContact'][_0x9d6e('0x44')](_0x1b92b0);}else{throw new Error(_0x9d6e('0x45'));}})['then'](function(_0x2e34d3){_0x3db02d[_0x9d6e('0x46')]=_0x2e34d3;if(_0x2e34d3){if(!_0x1afae4['body'][_0x9d6e('0x17')]['messageId']){_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')]['messageId']=rs[_0x9d6e('0x47')]()+'\x20'+_0x1afae4['body']['message'][_0x9d6e('0x2e')];}var _0x1ad311={'ContactId':_0x2e34d3['id'],'MailAccountId':_0x1afae4['account']['id'],'inReplyTo':_0x1afae4[_0x9d6e('0x25')]['message'][_0x9d6e('0x48')],'to':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')][_0x9d6e('0x2e')],'cc':_0x1afae4[_0x9d6e('0x25')]['message']['cc'],'subject':_0x1afae4['body']['message']['subject'],'attach':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')][_0x9d6e('0x49')],'lastMsgAt':moment()[_0x9d6e('0x4a')](_0x9d6e('0x4b')),'lastMsgDirection':'in'};return db[_0x9d6e('0x4c')][_0x9d6e('0x24')]({'where':{'closed':![],'MailAccountId':_0x1afae4[_0x9d6e('0x33')]['id']},'include':[{'model':db[_0x9d6e('0x4d')],'as':_0x9d6e('0x4e'),'attributes':[_0x9d6e('0x48')],'where':{'messageId':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')]['inReplyTo']}}]})[_0x9d6e('0x10')](function(_0x1e4839){if(_0x1e4839){return[_0x1e4839,![]];}return db['MailInteraction']['create'](_0x1ad311)['then'](function(_0x111e7b){return[_0x111e7b,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9d6e('0x4f')](function(_0x5832a6,_0x1e206f){if(_0x5832a6){_0xa2c50c=_0x1e206f;if(!_0x1e206f){return _0x5832a6[_0x9d6e('0x50')]({'inReplyTo':_0x1afae4['body']['message'][_0x9d6e('0x48')],'to':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')][_0x9d6e('0x2e')],'cc':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')]['cc'],'subject':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')]['subject'],'attach':_0x5832a6[_0x9d6e('0x49')]?_0x5832a6[_0x9d6e('0x49')]:_0x1afae4['body'][_0x9d6e('0x17')][_0x9d6e('0x49')],'substatus':null,'substatusAt':moment()['format'](_0x9d6e('0x4b')),'lastMsgAt':moment()[_0x9d6e('0x4a')](_0x9d6e('0x4b')),'lastMsgDirection':'in'});}else{return _0x5832a6;}}})[_0x9d6e('0x10')](function(_0x5c6882){_0x3db02d['interaction']=_0x5c6882[_0x9d6e('0x51')]({'plain':!![]});_0x3db02d[_0x9d6e('0x52')][_0x9d6e('0x53')]=_0xa2c50c;return db[_0x9d6e('0x4d')][_0x9d6e('0x44')]({'body':_0x1afae4['body'][_0x9d6e('0x25')],'MailAccountId':_0x1afae4[_0x9d6e('0x33')]['id'],'MailInteractionId':_0x5c6882['id'],'direction':'in','ContactId':_0x3db02d[_0x9d6e('0x46')]['id'],'messageId':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')][_0x9d6e('0x48')],'from':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')]['from'],'to':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')]['to'],'cc':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')]['cc'],'subject':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')][_0x9d6e('0x54')],'attach':_0x1afae4['body'][_0x9d6e('0x17')][_0x9d6e('0x49')],'Attachments':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')]['attachments'],'originTo':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')][_0x9d6e('0x55')],'originCc':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')][_0x9d6e('0x56')],'bcc':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')]['bcc'],'ChatWebsiteId':_0x1afae4[_0x9d6e('0x25')]['message']['ChatWebsiteId']||null,'originChannel':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')][_0x9d6e('0x57')]||'Email','ChatOfflineMessageId':_0x1afae4[_0x9d6e('0x25')][_0x9d6e('0x17')][_0x9d6e('0x58')]||null},{'include':[{'model':db[_0x9d6e('0x59')],'as':_0x9d6e('0x5a')}]});})[_0x9d6e('0x10')](function(_0x235b52){_0x3db02d[_0x9d6e('0x17')]=_0x235b52;if(_0x3db02d[_0x9d6e('0x52')][_0x9d6e('0x5b')]){return db[_0x9d6e('0x5c')][_0x9d6e('0x24')]({'attributes':['id',_0x9d6e('0x5d')],'where':{'id':_0x3db02d[_0x9d6e('0x52')][_0x9d6e('0x5b')]}})[_0x9d6e('0x10')](function(_0x49c8c9){if(_0x49c8c9){_0x3db02d['applications'][_0x9d6e('0x5e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x49c8c9[_0x9d6e('0x5d')]+','+(_0x3db02d[_0x9d6e('0x33')][_0x9d6e('0x5f')]||0xa),'interval':_0x9d6e('0x42')});}return respondWithRpcPromise(_0x9d6e('0x60'),'startRouting',_0x3db02d);});}return respondWithRpcPromise(_0x9d6e('0x60'),_0x9d6e('0x61'),_0x3db02d);})[_0x9d6e('0x10')](function(_0x35322d){_0x2a5c04(_0x35322d);})['catch'](function(_0x5110c7){_0x3f5a6c(_0x5c7436['error'](0x1f4,_0x5110c7['message']));});});}; \ No newline at end of file +var _0xd577=['error','message','MailAccount,\x20%s,\x20%s','catch','GetMailAccount','MailAccount','findAll','options','where','attributes','limit','include','map','model','ShowMailAccount','stringify','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','account','CmList','List','Contacts','DESC','MailApplication','Applications','get','omit','applications','orderBy','priority','autoclose','push','length','close','*,*,*,*','create','contact','messageId','subject','attach','format','MailInteraction','find','inReplyTo','Contact\x20not\x20found','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created','MailMessage','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3db029,_0x36b2d4){var _0x3e6f28=function(_0x3d3256){while(--_0x3d3256){_0x3db029['push'](_0x3db029['shift']());}};_0x3e6f28(++_0x36b2d4);}(_0xd577,0x1e7));var _0x7d57=function(_0x15f8ad,_0x5275c3){_0x15f8ad=_0x15f8ad-0x0;var _0xc0238a=_0xd577[_0x15f8ad];return _0xc0238a;};'use strict';var _=require(_0x7d57('0x0'));var util=require(_0x7d57('0x1'));var moment=require(_0x7d57('0x2'));var BPromise=require(_0x7d57('0x3'));var rs=require(_0x7d57('0x4'));var fs=require('fs');var Redis=require(_0x7d57('0x5'));var db=require(_0x7d57('0x6'))['db'];var utils=require(_0x7d57('0x7'));var logger=require(_0x7d57('0x8'))('rpc');var config=require(_0x7d57('0x9'));var jayson=require(_0x7d57('0xa'));var client=jayson[_0x7d57('0xb')][_0x7d57('0xc')]({'port':0x232c});config[_0x7d57('0xd')]=_[_0x7d57('0xe')](config[_0x7d57('0xd')],{'host':_0x7d57('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7d57('0x10'))[_0x7d57('0x11')](socket);function respondWithRpcPromise(_0x4334f5,_0x150e2d,_0x43cdc5){return new BPromise(function(_0x388b63,_0x5c9f3d){return client['request'](_0x4334f5,_0x43cdc5)[_0x7d57('0x12')](function(_0x245103){logger[_0x7d57('0x13')]('MailAccount,\x20%s,\x20%s',_0x150e2d,'request\x20sent');logger[_0x7d57('0x14')](_0x7d57('0x15'),_0x150e2d,_0x7d57('0x16'),JSON['stringify'](_0x245103));if(_0x245103[_0x7d57('0x17')]){if(_0x245103[_0x7d57('0x17')]['code']===0x1f4){logger[_0x7d57('0x17')]('MailAccount,\x20%s,\x20%s',_0x150e2d,_0x245103[_0x7d57('0x17')][_0x7d57('0x18')]);return _0x5c9f3d(_0x245103[_0x7d57('0x17')][_0x7d57('0x18')]);}logger[_0x7d57('0x17')](_0x7d57('0x19'),_0x150e2d,_0x245103[_0x7d57('0x17')]['message']);return _0x388b63(_0x245103['error'][_0x7d57('0x18')]);}else{logger[_0x7d57('0x13')](_0x7d57('0x19'),_0x150e2d,_0x7d57('0x16'));_0x388b63(_0x245103['result'][_0x7d57('0x18')]);}})[_0x7d57('0x1a')](function(_0x16d773){logger[_0x7d57('0x17')](_0x7d57('0x19'),_0x150e2d,_0x16d773);_0x5c9f3d(_0x16d773);});});}exports[_0x7d57('0x1b')]=function(_0x39207a){var _0x16b5d3=this;return new Promise(function(_0x535630,_0x523bba){return db[_0x7d57('0x1c')][_0x7d57('0x1d')]({'raw':_0x39207a['options']?_0x39207a[_0x7d57('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x39207a[_0x7d57('0x1e')]?_0x39207a[_0x7d57('0x1e')][_0x7d57('0x1f')]||null:null,'attributes':_0x39207a[_0x7d57('0x1e')]?_0x39207a[_0x7d57('0x1e')][_0x7d57('0x20')]||null:null,'limit':_0x39207a['options']?_0x39207a['options'][_0x7d57('0x21')]||null:null,'include':_0x39207a[_0x7d57('0x1e')]?_0x39207a[_0x7d57('0x1e')][_0x7d57('0x22')]?_[_0x7d57('0x23')](_0x39207a[_0x7d57('0x1e')]['include'],function(_0xe1c564){return{'model':db[_0xe1c564[_0x7d57('0x24')]],'as':_0xe1c564['as'],'attributes':_0xe1c564[_0x7d57('0x20')],'include':_0xe1c564[_0x7d57('0x22')]?_[_0x7d57('0x23')](_0xe1c564['include'],function(_0x402168){return{'model':db[_0x402168[_0x7d57('0x24')]],'as':_0x402168['as'],'attributes':_0x402168['attributes'],'include':_0x402168[_0x7d57('0x22')]?_[_0x7d57('0x23')](_0x402168[_0x7d57('0x22')],function(_0x1319ac){return{'model':db[_0x1319ac[_0x7d57('0x24')]],'as':_0x1319ac['as'],'attributes':_0x1319ac[_0x7d57('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7d57('0x12')](function(_0x48016d){logger[_0x7d57('0x13')](_0x7d57('0x1b'),_0x39207a);logger[_0x7d57('0x14')](_0x7d57('0x1b'),_0x39207a,JSON['stringify'](_0x48016d));_0x535630(_0x48016d);})['catch'](function(_0x555a3d){logger[_0x7d57('0x17')](_0x7d57('0x1b'),_0x555a3d['message'],_0x39207a);_0x523bba(_0x16b5d3[_0x7d57('0x17')](0x1f4,_0x555a3d[_0x7d57('0x18')]));});});};exports[_0x7d57('0x25')]=function(_0x4ecafc){var _0x1ce3c0=this;return new Promise(function(_0x3d3fa8,_0x2b0a39){return db[_0x7d57('0x1c')]['find']({'raw':_0x4ecafc[_0x7d57('0x1e')]?_0x4ecafc[_0x7d57('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4ecafc['options']?_0x4ecafc[_0x7d57('0x1e')][_0x7d57('0x1f')]||null:null,'attributes':_0x4ecafc['options']?_0x4ecafc[_0x7d57('0x1e')][_0x7d57('0x20')]||null:null,'include':_0x4ecafc['options']?_0x4ecafc[_0x7d57('0x1e')][_0x7d57('0x22')]?_[_0x7d57('0x23')](_0x4ecafc['options']['include'],function(_0x47e411){return{'model':db[_0x47e411[_0x7d57('0x24')]],'as':_0x47e411['as'],'attributes':_0x47e411[_0x7d57('0x20')],'include':_0x47e411[_0x7d57('0x22')]?_[_0x7d57('0x23')](_0x47e411[_0x7d57('0x22')],function(_0x49f2d1){return{'model':db[_0x49f2d1[_0x7d57('0x24')]],'as':_0x49f2d1['as'],'attributes':_0x49f2d1[_0x7d57('0x20')],'include':_0x49f2d1[_0x7d57('0x22')]?_[_0x7d57('0x23')](_0x49f2d1[_0x7d57('0x22')],function(_0x542ed8){return{'model':db[_0x542ed8[_0x7d57('0x24')]],'as':_0x542ed8['as'],'attributes':_0x542ed8[_0x7d57('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7d57('0x12')](function(_0x38da1a){logger[_0x7d57('0x13')](_0x7d57('0x25'),_0x4ecafc);logger[_0x7d57('0x14')](_0x7d57('0x25'),_0x4ecafc,JSON[_0x7d57('0x26')](_0x38da1a));_0x3d3fa8(_0x38da1a);})[_0x7d57('0x1a')](function(_0x879e6f){logger[_0x7d57('0x17')](_0x7d57('0x25'),_0x879e6f[_0x7d57('0x18')],_0x4ecafc);_0x2b0a39(_0x1ce3c0[_0x7d57('0x17')](0x1f4,_0x879e6f[_0x7d57('0x18')]));});});};exports[_0x7d57('0x27')]=function(_0x502d31){var _0x193d85=this;return new Promise(function(_0xab2741,_0x1bf207){var _0x514590={'body':_0x502d31[_0x7d57('0x28')],'channel':_0x7d57('0x29')};var _0x26eb2c=_['difference'](_[_0x7d57('0x2a')](db[_0x7d57('0x2b')][_0x7d57('0x2c')]),[_0x7d57('0x2d'),_0x7d57('0x2e'),_0x7d57('0x2f'),_0x7d57('0x30')]);var _0x2ff7bc=![];if(_0x502d31[_0x7d57('0x28')]['id']){delete _0x502d31[_0x7d57('0x28')]['id'];}if(_[_0x7d57('0x31')](_0x502d31['body'][_0x7d57('0x32')])){return _0x1bf207(_0x193d85[_0x7d57('0x17')](0x1f4,_0x7d57('0x33')));}if(_['isNil'](_0x502d31[_0x7d57('0x28')][_0x7d57('0x28')])||_0x502d31[_0x7d57('0x28')]['body']===''){return _0x1bf207(_0x193d85[_0x7d57('0x17')](0x1f4,_0x7d57('0x34')));}if(_[_0x7d57('0x31')](_0x502d31['body'][_0x7d57('0x35')])){return _0x1bf207(_0x193d85['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x26eb2c));}if(!_[_0x7d57('0x36')](_0x26eb2c,_0x502d31['body']['mapKey'])){return _0x1bf207(_0x193d85['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x26eb2c));}var _0x189859={};_0x189859[_0x502d31[_0x7d57('0x28')][_0x7d57('0x35')]]=_0x502d31['body'][_0x7d57('0x32')];return db[_0x7d57('0x1c')]['find']({'where':{'id':_0x502d31[_0x7d57('0x37')]['id']},'include':[{'model':db[_0x7d57('0x38')],'as':_0x7d57('0x39'),'include':[{'model':db[_0x7d57('0x2b')],'as':_0x7d57('0x3a'),'where':_0x189859,'limit':0x1,'order':[['updatedAt',_0x7d57('0x3b')]]}]},{'model':db[_0x7d57('0x3c')],'as':_0x7d57('0x3d')},{'model':db['MailServerOut'],'as':'Smtp'}]})['then'](function(_0x50c353){if(_0x50c353&&_0x50c353[_0x7d57('0x39')]){var _0x8433a=_0x50c353[_0x7d57('0x3e')]({'plain':!![]});_0x514590[_0x7d57('0x37')]=_[_0x7d57('0x3f')](_0x8433a,['Applications',_0x7d57('0x39')]);_0x514590[_0x7d57('0x40')]=_0x8433a['Applications'];_0x514590['list']=_0x8433a[_0x7d57('0x39')];_0x514590[_0x7d57('0x40')]=_[_0x7d57('0x41')](_0x514590[_0x7d57('0x40')],[_0x7d57('0x42')],['asc']);if(_0x514590[_0x7d57('0x37')]&&_0x514590[_0x7d57('0x37')][_0x7d57('0x43')]){_0x514590[_0x7d57('0x40')][_0x7d57('0x44')]({'id':0x0,'priority':_0x514590['applications'][_0x7d57('0x45')]+0x1,'app':_0x7d57('0x46'),'appdata':'autoclose','interval':_0x7d57('0x47')});}if(_0x514590[_0x7d57('0x37')][_0x7d57('0x3d')]){delete _0x514590[_0x7d57('0x37')][_0x7d57('0x3d')];}if(_0x514590[_0x7d57('0x37')][_0x7d57('0x39')]){delete _0x514590[_0x7d57('0x37')][_0x7d57('0x39')];}if(_0x8433a['List'][_0x7d57('0x3a')][_0x7d57('0x45')]){return _0x8433a[_0x7d57('0x39')]['Contacts'][0x0];}var _0x30f9d7=_[_0x7d57('0xe')](_0x502d31[_0x7d57('0x28')],{'firstName':_0x502d31[_0x7d57('0x28')]['from'],'ListId':_0x8433a[_0x7d57('0x30')]});_0x30f9d7[_0x502d31[_0x7d57('0x28')][_0x7d57('0x35')]]=_0x502d31[_0x7d57('0x28')][_0x7d57('0x32')];return db['CmContact'][_0x7d57('0x48')](_0x30f9d7);}else{throw new Error('List\x20not\x20found');}})[_0x7d57('0x12')](function(_0x1b7652){_0x514590[_0x7d57('0x49')]=_0x1b7652;if(_0x1b7652){if(!_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')]['messageId']){_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')][_0x7d57('0x4a')]=rs['generate']()+'\x20'+_0x502d31[_0x7d57('0x28')]['message'][_0x7d57('0x32')];}var _0x23a29e={'ContactId':_0x1b7652['id'],'MailAccountId':_0x502d31[_0x7d57('0x37')]['id'],'inReplyTo':_0x502d31['body'][_0x7d57('0x18')][_0x7d57('0x4a')],'to':_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')][_0x7d57('0x32')],'cc':_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')]['cc'],'subject':_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')][_0x7d57('0x4b')],'attach':_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')][_0x7d57('0x4c')],'lastMsgAt':moment()[_0x7d57('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x7d57('0x4e')][_0x7d57('0x4f')]({'where':{'closed':![],'MailAccountId':_0x502d31[_0x7d57('0x37')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x7d57('0x4a')],'where':{'messageId':_0x502d31[_0x7d57('0x28')]['message'][_0x7d57('0x50')]}}]})[_0x7d57('0x12')](function(_0x1e328d){if(_0x1e328d){return[_0x1e328d,![]];}return db[_0x7d57('0x4e')][_0x7d57('0x48')](_0x23a29e)[_0x7d57('0x12')](function(_0x171a0e){return[_0x171a0e,!![]];});});}else{throw new Error(_0x7d57('0x51'));}})['spread'](function(_0x3927f7,_0x94ac8f){if(_0x3927f7){_0x2ff7bc=_0x94ac8f;if(!_0x94ac8f){return _0x3927f7[_0x7d57('0x52')]({'inReplyTo':_0x502d31[_0x7d57('0x28')]['message']['messageId'],'to':_0x502d31['body']['message'][_0x7d57('0x32')],'cc':_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')]['cc'],'subject':_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')][_0x7d57('0x4b')],'attach':_0x3927f7['attach']?_0x3927f7['attach']:_0x502d31[_0x7d57('0x28')]['message']['attach'],'substatus':null,'substatusAt':moment()[_0x7d57('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x7d57('0x53')),'lastMsgDirection':'in'});}else{return _0x3927f7;}}})[_0x7d57('0x12')](function(_0x125044){_0x514590[_0x7d57('0x54')]=_0x125044[_0x7d57('0x3e')]({'plain':!![]});_0x514590[_0x7d57('0x54')][_0x7d57('0x55')]=_0x2ff7bc;return db[_0x7d57('0x56')]['create']({'body':_0x502d31[_0x7d57('0x28')]['body'],'MailAccountId':_0x502d31['account']['id'],'MailInteractionId':_0x125044['id'],'direction':'in','ContactId':_0x514590['contact']['id'],'messageId':_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')][_0x7d57('0x4a')],'from':_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')]['from'],'to':_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')]['to'],'cc':_0x502d31['body']['message']['cc'],'subject':_0x502d31['body']['message']['subject'],'attach':_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')][_0x7d57('0x4c')],'Attachments':_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')][_0x7d57('0x57')],'originTo':_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')][_0x7d57('0x58')],'originCc':_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')]['originCc'],'bcc':_0x502d31[_0x7d57('0x28')]['message'][_0x7d57('0x59')],'ChatWebsiteId':_0x502d31[_0x7d57('0x28')][_0x7d57('0x18')][_0x7d57('0x5a')]||null,'originChannel':_0x502d31[_0x7d57('0x28')]['message'][_0x7d57('0x5b')]||_0x7d57('0x5c'),'ChatOfflineMessageId':_0x502d31['body'][_0x7d57('0x18')][_0x7d57('0x5d')]||null},{'include':[{'model':db['Attachment'],'as':_0x7d57('0x5e')}]});})['then'](function(_0x2b8c55){_0x514590[_0x7d57('0x18')]=_0x2b8c55;if(_0x514590['interaction'][_0x7d57('0x5f')]){return db[_0x7d57('0x60')][_0x7d57('0x4f')]({'attributes':['id',_0x7d57('0x61')],'where':{'id':_0x514590['interaction'][_0x7d57('0x5f')]}})['then'](function(_0x27aaaa){if(_0x27aaaa){_0x514590[_0x7d57('0x40')][_0x7d57('0x62')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x27aaaa[_0x7d57('0x61')]+','+(_0x514590[_0x7d57('0x37')][_0x7d57('0x63')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7d57('0x64'),_0x7d57('0x65'),_0x514590);});}return respondWithRpcPromise(_0x7d57('0x64'),_0x7d57('0x65'),_0x514590);})[_0x7d57('0x12')](function(_0x279880){_0xab2741(_0x279880);})['catch'](function(_0x54a165){_0x1bf207(_0x193d85[_0x7d57('0x17')](0x1f4,_0x54a165['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index c70dbae..9d9374c 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 _0xd06f=['update','emit','register','length','./mailAccount.events','save'];(function(_0x3fec3f,_0x471a3f){var _0x535bfb=function(_0x2e5d98){while(--_0x2e5d98){_0x3fec3f['push'](_0x3fec3f['shift']());}};_0x535bfb(++_0x471a3f);}(_0xd06f,0x13c));var _0xfd06=function(_0x35cd20,_0x3591fb){_0x35cd20=_0x35cd20-0x0;var _0xa7dbcc=_0xd06f[_0x35cd20];return _0xa7dbcc;};'use strict';var MailAccountEvents=require(_0xfd06('0x0'));var events=[_0xfd06('0x1'),'remove',_0xfd06('0x2')];function createListener(_0x1f25df,_0x168090){return function(_0x30d2fd){_0x168090[_0xfd06('0x3')](_0x1f25df,_0x30d2fd);};}function removeListener(_0x121c7f,_0x2fe07a){return function(){MailAccountEvents['removeListener'](_0x121c7f,_0x2fe07a);};}exports[_0xfd06('0x4')]=function(_0x46f348){for(var _0x933a31=0x0,_0xf617b4=events[_0xfd06('0x5')];_0x933a31<_0xf617b4;_0x933a31++){var _0xba42a0=events[_0x933a31];var _0x49eece=createListener('mailAccount:'+_0xba42a0,_0x46f348);MailAccountEvents['on'](_0xba42a0,_0x49eece);}}; \ No newline at end of file +var _0xc3b7=['save','remove','update','emit','length','mailAccount:'];(function(_0x29e2af,_0x15e2b1){var _0x1ea06a=function(_0x34d736){while(--_0x34d736){_0x29e2af['push'](_0x29e2af['shift']());}};_0x1ea06a(++_0x15e2b1);}(_0xc3b7,0xb4));var _0x7c3b=function(_0x447ee0,_0x22972b){_0x447ee0=_0x447ee0-0x0;var _0x33db56=_0xc3b7[_0x447ee0];return _0x33db56;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x7c3b('0x0'),_0x7c3b('0x1'),_0x7c3b('0x2')];function createListener(_0x17ab0d,_0x910ef9){return function(_0xa1c598){_0x910ef9[_0x7c3b('0x3')](_0x17ab0d,_0xa1c598);};}function removeListener(_0x363234,_0xd931d7){return function(){MailAccountEvents['removeListener'](_0x363234,_0xd931d7);};}exports['register']=function(_0x20fa26){for(var _0x40ef6a=0x0,_0x208213=events[_0x7c3b('0x4')];_0x40ef6a<_0x208213;_0x40ef6a++){var _0x47d9a7=events[_0x40ef6a];var _0x218be1=createListener(_0x7c3b('0x5')+_0x47d9a7,_0x20fa26);MailAccountEvents['on'](_0x47d9a7,_0x218be1);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 6e2209b..f641e16 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 _0xeb3d=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer'];(function(_0x17ea32,_0x2563bd){var _0x1b8c6c=function(_0x1804e6){while(--_0x1804e6){_0x17ea32['push'](_0x17ea32['shift']());}};_0x1b8c6c(++_0x2563bd);}(_0xeb3d,0x1a8));var _0xdeb3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeb3d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xdeb3('0x0'));var util=require(_0xdeb3('0x1'));var path=require(_0xdeb3('0x2'));var timeout=require(_0xdeb3('0x3'));var express=require(_0xdeb3('0x4'));var router=express[_0xdeb3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdeb3('0x6'));var config=require(_0xdeb3('0x7'));var controller=require('./mailApplication.controller');router[_0xdeb3('0x8')](_0xdeb3('0x9'),auth[_0xdeb3('0xa')](),controller[_0xdeb3('0xb')]);router[_0xdeb3('0xc')](_0xdeb3('0x9'),auth[_0xdeb3('0xa')](),controller[_0xdeb3('0xd')]);router[_0xdeb3('0xe')](_0xdeb3('0x9'),auth['isAuthenticated'](),controller[_0xdeb3('0xf')]);module[_0xdeb3('0x10')]=router; \ No newline at end of file +var _0xbf75=['put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show'];(function(_0xc868b9,_0x193b2e){var _0xe50e3e=function(_0x5c0f83){while(--_0x5c0f83){_0xc868b9['push'](_0xc868b9['shift']());}};_0xe50e3e(++_0x193b2e);}(_0xbf75,0x168));var _0x5bf7=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xbf75[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require(_0x5bf7('0x0'));var path=require(_0x5bf7('0x1'));var timeout=require(_0x5bf7('0x2'));var express=require(_0x5bf7('0x3'));var router=express[_0x5bf7('0x4')]();var fs_extra=require(_0x5bf7('0x5'));var auth=require(_0x5bf7('0x6'));var interaction=require(_0x5bf7('0x7'));var config=require(_0x5bf7('0x8'));var controller=require(_0x5bf7('0x9'));router[_0x5bf7('0xa')](_0x5bf7('0xb'),auth[_0x5bf7('0xc')](),controller[_0x5bf7('0xd')]);router[_0x5bf7('0xe')](_0x5bf7('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5bf7('0xb'),auth[_0x5bf7('0xc')](),controller[_0x5bf7('0xf')]);module[_0x5bf7('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 57bec31..d5fbc7c 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 _0xc53a=['TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x1d4449,_0x31f042){var _0x17b8a8=function(_0x50774c){while(--_0x50774c){_0x1d4449['push'](_0x1d4449['shift']());}};_0x17b8a8(++_0x31f042);}(_0xc53a,0x106));var _0xac53=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc53a[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0xac53('0x0'));module[_0xac53('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xac53('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xac53('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xac53('0x2')],'defaultValue':_0xac53('0x4')}}; \ No newline at end of file +var _0xa835=['noop','sequelize','exports','INTEGER','STRING'];(function(_0x2f9035,_0x215577){var _0x4b0ebe=function(_0x31e0f3){while(--_0x31e0f3){_0x2f9035['push'](_0x2f9035['shift']());}};_0x4b0ebe(++_0x215577);}(_0xa835,0x1aa));var _0x5a83=function(_0x512e76,_0x487d59){_0x512e76=_0x512e76-0x0;var _0xb66bbc=_0xa835[_0x512e76];return _0xb66bbc;};'use strict';var Sequelize=require(_0x5a83('0x0'));module[_0x5a83('0x1')]={'priority':{'type':Sequelize[_0x5a83('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5a83('0x3')],'allowNull':![],'defaultValue':_0x5a83('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5a83('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index cba4deb..cf57bc3 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 _0xda3f=['includeAll','include','merge','find','catch','body','MailApplication','destroy','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','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','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','params','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x47b5f1,_0x468ef1){var _0x5dbd1f=function(_0x40cfd2){while(--_0x40cfd2){_0x47b5f1['push'](_0x47b5f1['shift']());}};_0x5dbd1f(++_0x468ef1);}(_0xda3f,0xec));var _0xfda3=function(_0x48b727,_0x2ce07c){_0x48b727=_0x48b727-0x0;var _0xba2d8e=_0xda3f[_0x48b727];return _0xba2d8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['show']=function(_0x3c1549,_0x4101b1){var _0x301509={'raw':!![],'where':{'id':_0x3c1549[_0xfda3('0x28')]['id']}},_0x474992={};_0x474992[_0xfda3('0x29')]=_[_0xfda3('0x2a')](db['MailApplication']['rawAttributes']);_0x474992[_0xfda3('0x2b')]=_['keys'](_0x3c1549['query']);_0x474992[_0xfda3('0x2c')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2e')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],qs[_0xfda3('0x2f')](_0x3c1549[_0xfda3('0x2b')]['fields']));_0x301509[_0xfda3('0x2e')]=_0x301509[_0xfda3('0x2e')][_0xfda3('0x30')]?_0x301509[_0xfda3('0x2e')]:_0x474992[_0xfda3('0x29')];if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x31')]){_0x301509[_0xfda3('0x32')]=[{'all':!![]}];}_0x301509=_[_0xfda3('0x33')]({},_0x301509,_0x3c1549['options']);return db['MailApplication'][_0xfda3('0x34')](_0x301509)[_0xfda3('0x23')](handleEntityNotFound(_0x4101b1,null))['then'](respondWithResult(_0x4101b1,null))[_0xfda3('0x35')](handleError(_0x4101b1,null));};exports[_0xfda3('0x22')]=function(_0x28ca96,_0x52ee98){if(_0x28ca96[_0xfda3('0x36')]['id']){delete _0x28ca96[_0xfda3('0x36')]['id'];}return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x28ca96[_0xfda3('0x28')]['id']}})['then'](handleEntityNotFound(_0x52ee98,null))[_0xfda3('0x23')](saveUpdates(_0x28ca96[_0xfda3('0x36')],null))[_0xfda3('0x23')](respondWithResult(_0x52ee98,null))['catch'](handleError(_0x52ee98,null));};exports[_0xfda3('0x38')]=function(_0x4854b1,_0x2d9a3f){return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x4854b1[_0xfda3('0x28')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2d9a3f,null))[_0xfda3('0x23')](removeEntity(_0x2d9a3f,null))[_0xfda3('0x35')](handleError(_0x2d9a3f,null));}; \ No newline at end of file +var _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0xaa88[_0x199b1f];return _0x267ac9;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 78b2689..b21566e 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 _0xa3ef=['bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa3ef,0x114));var _0xfa3e=function(_0x5bfe86,_0x2313f6){_0x5bfe86=_0x5bfe86-0x0;var _0x793020=_0xa3ef[_0x5bfe86];return _0x793020;};'use strict';var _=require('lodash');var util=require(_0xfa3e('0x0'));var logger=require(_0xfa3e('0x1'))(_0xfa3e('0x2'));var moment=require(_0xfa3e('0x3'));var BPromise=require(_0xfa3e('0x4'));var rp=require(_0xfa3e('0x5'));var fs=require('fs');var path=require(_0xfa3e('0x6'));var rimraf=require(_0xfa3e('0x7'));var config=require(_0xfa3e('0x8'));var attributes=require(_0xfa3e('0x9'));module[_0xfa3e('0xa')]=function(_0x301d41,_0x1ad76f){return _0x301d41[_0xfa3e('0xb')](_0xfa3e('0xc'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfa3e('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xaf55=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0xda6ad1,_0x5f09e3){var _0xedc3a5=function(_0x5459d7){while(--_0x5459d7){_0xda6ad1['push'](_0xda6ad1['shift']());}};_0xedc3a5(++_0x5f09e3);}(_0xaf55,0x95));var _0x5af5=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xaf55[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x5af5('0x0'));var util=require(_0x5af5('0x1'));var logger=require(_0x5af5('0x2'))(_0x5af5('0x3'));var moment=require('moment');var BPromise=require(_0x5af5('0x4'));var rp=require(_0x5af5('0x5'));var fs=require('fs');var path=require(_0x5af5('0x6'));var rimraf=require(_0x5af5('0x7'));var config=require(_0x5af5('0x8'));var attributes=require(_0x5af5('0x9'));module[_0x5af5('0xa')]=function(_0x4415b7,_0xdc7c77){return _0x4415b7[_0x5af5('0xb')](_0x5af5('0xc'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5af5('0xd'),'collate':_0x5af5('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index a2390c1..02f6d5d 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 _0x9857=['attributes','limit','UpdateMailApplication','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','MailApplication','update','body','options','raw','where'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x9857,0x87));var _0x7985=function(_0x3c1ce9,_0x296a2d){_0x3c1ce9=_0x3c1ce9-0x0;var _0x2de183=_0x9857[_0x3c1ce9];return _0x2de183;};'use strict';var _=require(_0x7985('0x0'));var util=require(_0x7985('0x1'));var moment=require(_0x7985('0x2'));var BPromise=require(_0x7985('0x3'));var rs=require(_0x7985('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7985('0x5'))['db'];var utils=require(_0x7985('0x6'));var logger=require(_0x7985('0x7'))(_0x7985('0x8'));var config=require(_0x7985('0x9'));var jayson=require(_0x7985('0xa'));var client=jayson[_0x7985('0xb')][_0x7985('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d0179,_0x53d2cd,_0x4ce3a0){return new BPromise(function(_0xa42742,_0x2e9df){return client[_0x7985('0xd')](_0x1d0179,_0x4ce3a0)[_0x7985('0xe')](function(_0x4cbd8c){logger[_0x7985('0xf')](_0x7985('0x10'),_0x53d2cd,_0x7985('0x11'));logger[_0x7985('0x12')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x53d2cd,_0x7985('0x11'),JSON[_0x7985('0x13')](_0x4cbd8c));if(_0x4cbd8c[_0x7985('0x14')]){if(_0x4cbd8c['error']['code']===0x1f4){logger[_0x7985('0x14')]('MailApplication,\x20%s,\x20%s',_0x53d2cd,_0x4cbd8c[_0x7985('0x14')][_0x7985('0x15')]);return _0x2e9df(_0x4cbd8c[_0x7985('0x14')][_0x7985('0x15')]);}logger['error'](_0x7985('0x10'),_0x53d2cd,_0x4cbd8c[_0x7985('0x14')][_0x7985('0x15')]);return _0xa42742(_0x4cbd8c['error'][_0x7985('0x15')]);}else{logger[_0x7985('0xf')](_0x7985('0x10'),_0x53d2cd,'request\x20sent');_0xa42742(_0x4cbd8c[_0x7985('0x16')][_0x7985('0x15')]);}})[_0x7985('0x17')](function(_0xdff847){logger[_0x7985('0x14')]('MailApplication,\x20%s,\x20%s',_0x53d2cd,_0xdff847);_0x2e9df(_0xdff847);});});}exports['UpdateMailApplication']=function(_0x59fd1d){var _0x34288b=this;return new Promise(function(_0x3294fb,_0x2faf50){return db[_0x7985('0x18')][_0x7985('0x19')](_0x59fd1d[_0x7985('0x1a')],{'raw':_0x59fd1d['options']?_0x59fd1d[_0x7985('0x1b')][_0x7985('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59fd1d['options']?_0x59fd1d[_0x7985('0x1b')][_0x7985('0x1d')]||null:null,'attributes':_0x59fd1d[_0x7985('0x1b')]?_0x59fd1d[_0x7985('0x1b')][_0x7985('0x1e')]||null:null,'limit':_0x59fd1d[_0x7985('0x1b')]?_0x59fd1d[_0x7985('0x1b')][_0x7985('0x1f')]||null:null})[_0x7985('0xe')](function(_0x40d19d){logger['info'](_0x7985('0x20'),_0x59fd1d);logger[_0x7985('0x12')]('UpdateMailApplication',_0x59fd1d,JSON[_0x7985('0x13')](_0x40d19d));_0x3294fb(_0x40d19d);})[_0x7985('0x17')](function(_0x578540){logger['error'](_0x7985('0x20'),_0x578540['message'],_0x59fd1d);_0x2faf50(_0x34288b[_0x7985('0x14')](0x1f4,_0x578540[_0x7985('0x15')]));});});}; \ No newline at end of file +var _0xeb0a=['MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','limit','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeb0a,0xad));var _0xaeb0=function(_0x2d0d9f,_0x22c0d8){_0x2d0d9f=_0x2d0d9f-0x0;var _0x30243d=_0xeb0a[_0x2d0d9f];return _0x30243d;};'use strict';var _=require(_0xaeb0('0x0'));var util=require(_0xaeb0('0x1'));var moment=require(_0xaeb0('0x2'));var BPromise=require(_0xaeb0('0x3'));var rs=require(_0xaeb0('0x4'));var fs=require('fs');var Redis=require(_0xaeb0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaeb0('0x6'))(_0xaeb0('0x7'));var config=require(_0xaeb0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaeb0('0x9')][_0xaeb0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8fcf6c,_0x4d10c1,_0x2c8c59){return new BPromise(function(_0x5c5cdb,_0x2deb34){return client[_0xaeb0('0xb')](_0x8fcf6c,_0x2c8c59)['then'](function(_0x2c5c25){logger[_0xaeb0('0xc')](_0xaeb0('0xd'),_0x4d10c1,'request\x20sent');logger['debug'](_0xaeb0('0xe'),_0x4d10c1,_0xaeb0('0xf'),JSON[_0xaeb0('0x10')](_0x2c5c25));if(_0x2c5c25['error']){if(_0x2c5c25['error'][_0xaeb0('0x11')]===0x1f4){logger[_0xaeb0('0x12')]('MailApplication,\x20%s,\x20%s',_0x4d10c1,_0x2c5c25[_0xaeb0('0x12')][_0xaeb0('0x13')]);return _0x2deb34(_0x2c5c25[_0xaeb0('0x12')][_0xaeb0('0x13')]);}logger[_0xaeb0('0x12')]('MailApplication,\x20%s,\x20%s',_0x4d10c1,_0x2c5c25[_0xaeb0('0x12')][_0xaeb0('0x13')]);return _0x5c5cdb(_0x2c5c25['error']['message']);}else{logger[_0xaeb0('0xc')](_0xaeb0('0xd'),_0x4d10c1,_0xaeb0('0xf'));_0x5c5cdb(_0x2c5c25['result'][_0xaeb0('0x13')]);}})[_0xaeb0('0x14')](function(_0x21b1ed){logger[_0xaeb0('0x12')](_0xaeb0('0xd'),_0x4d10c1,_0x21b1ed);_0x2deb34(_0x21b1ed);});});}exports[_0xaeb0('0x15')]=function(_0x59f396){var _0x12888d=this;return new Promise(function(_0x478501,_0x19412d){return db[_0xaeb0('0x16')][_0xaeb0('0x17')](_0x59f396[_0xaeb0('0x18')],{'raw':_0x59f396[_0xaeb0('0x19')]?_0x59f396[_0xaeb0('0x19')][_0xaeb0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59f396[_0xaeb0('0x19')]?_0x59f396[_0xaeb0('0x19')][_0xaeb0('0x1b')]||null:null,'attributes':_0x59f396['options']?_0x59f396[_0xaeb0('0x19')]['attributes']||null:null,'limit':_0x59f396[_0xaeb0('0x19')]?_0x59f396[_0xaeb0('0x19')][_0xaeb0('0x1c')]||null:null})[_0xaeb0('0x1d')](function(_0x227975){logger[_0xaeb0('0xc')](_0xaeb0('0x15'),_0x59f396);logger[_0xaeb0('0x1e')](_0xaeb0('0x15'),_0x59f396,JSON[_0xaeb0('0x10')](_0x227975));_0x478501(_0x227975);})[_0xaeb0('0x14')](function(_0x289e71){logger[_0xaeb0('0x12')](_0xaeb0('0x15'),_0x289e71[_0xaeb0('0x13')],_0x59f396);_0x19412d(_0x12888d[_0xaeb0('0x12')](0x1f4,_0x289e71[_0xaeb0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 9646839..0e178d2 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 _0x3415=['express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','tracked','mailinteraction:addtags','addTags','mail','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports'];(function(_0x48f6b0,_0x2c6165){var _0x154609=function(_0x1d6474){while(--_0x1d6474){_0x48f6b0['push'](_0x48f6b0['shift']());}};_0x154609(++_0x2c6165);}(_0x3415,0x1dc));var _0x5341=function(_0x55363c,_0x27b071){_0x55363c=_0x55363c-0x0;var _0x39c4fc=_0x3415[_0x55363c];return _0x39c4fc;};'use strict';var express=require(_0x5341('0x0'));var router=express[_0x5341('0x1')]();var auth=require(_0x5341('0x2'));var interaction=require(_0x5341('0x3'));var controller=require(_0x5341('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5341('0x5')](_0x5341('0x6'),auth[_0x5341('0x7')](),controller['describe']);router[_0x5341('0x5')](_0x5341('0x8'),auth[_0x5341('0x7')](),controller[_0x5341('0x9')]);router[_0x5341('0x5')](_0x5341('0xa'),auth['isAuthenticated'](),controller[_0x5341('0xb')]);router[_0x5341('0x5')](_0x5341('0xc'),auth[_0x5341('0x7')](),controller['download']);router['post']('/',auth[_0x5341('0x7')](),controller[_0x5341('0xd')]);router[_0x5341('0xe')](_0x5341('0xa'),auth[_0x5341('0x7')](),controller[_0x5341('0xf')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x5341('0x10')]('mail',_0x5341('0x11')),controller[_0x5341('0x12')]);router['put']('/:id',auth[_0x5341('0x7')](),interaction['tracked'](_0x5341('0x13'),_0x5341('0x14')),controller[_0x5341('0x15')]);router['delete'](_0x5341('0x8'),auth[_0x5341('0x7')](),interaction[_0x5341('0x10')](_0x5341('0x13'),_0x5341('0x16')),controller[_0x5341('0x17')]);router[_0x5341('0x18')](_0x5341('0x19'),auth[_0x5341('0x7')](),controller[_0x5341('0x1a')]);module[_0x5341('0x1b')]=router; \ No newline at end of file +var _0x71e8=['/:id','getMessages','download','post','create','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','destroy','delete','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe'];(function(_0x34ebed,_0x1ef392){var _0x351b0c=function(_0x4d4684){while(--_0x4d4684){_0x34ebed['push'](_0x34ebed['shift']());}};_0x351b0c(++_0x1ef392);}(_0x71e8,0x1f0));var _0x871e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71e8[_0x17d9e3];return _0x14192d;};'use strict';var express=require(_0x871e('0x0'));var router=express['Router']();var auth=require(_0x871e('0x1'));var interaction=require(_0x871e('0x2'));var controller=require(_0x871e('0x3'));router['get']('/',auth[_0x871e('0x4')](),controller[_0x871e('0x5')]);router[_0x871e('0x6')](_0x871e('0x7'),auth[_0x871e('0x4')](),controller['describe']);router['get'](_0x871e('0x8'),auth[_0x871e('0x4')](),controller['show']);router[_0x871e('0x6')]('/:id/messages',auth[_0x871e('0x4')](),controller[_0x871e('0x9')]);router[_0x871e('0x6')]('/:id/download',auth[_0x871e('0x4')](),controller[_0x871e('0xa')]);router[_0x871e('0xb')]('/',auth[_0x871e('0x4')](),controller[_0x871e('0xc')]);router['post']('/:id/messages',auth[_0x871e('0x4')](),controller['addMessage']);router[_0x871e('0xb')](_0x871e('0xd'),auth[_0x871e('0x4')](),interaction[_0x871e('0xe')](_0x871e('0xf'),_0x871e('0x10')),controller[_0x871e('0x11')]);router[_0x871e('0x12')](_0x871e('0x8'),auth[_0x871e('0x4')](),interaction[_0x871e('0xe')](_0x871e('0xf'),'mailinteraction:update'),controller[_0x871e('0x13')]);router['delete'](_0x871e('0x8'),auth['isAuthenticated'](),interaction[_0x871e('0xe')]('mail','mailinteraction:destroy'),controller[_0x871e('0x14')]);router[_0x871e('0x15')](_0x871e('0xd'),auth['isAuthenticated'](),controller[_0x871e('0x16')]);module[_0x871e('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 6613e0e..61da108 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 _0x1239=['BOOLEAN','DATE','STRING','TEXT','ENUM','out','sequelize','iconv','exports'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0x1239,0x114));var _0x9123=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1239[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x9123('0x0'));var iconv=require(_0x9123('0x1'));module[_0x9123('0x2')]={'closed':{'type':Sequelize[_0x9123('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9123('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9123('0x5')]},'thirdDisposition':{'type':Sequelize[_0x9123('0x5')]},'note':{'type':Sequelize[_0x9123('0x5')]},'inReplyTo':{'type':Sequelize[_0x9123('0x5')](0x1fe)},'to':{'type':Sequelize[_0x9123('0x5')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x9123('0x6')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9123('0x4')]},'substatus':{'type':Sequelize[_0x9123('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x9123('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x9123('0x7')]('in',_0x9123('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9123('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x9123('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9123('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x00ad=['ENUM','out','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT'];(function(_0x27470b,_0x3ade0f){var _0x239c90=function(_0x446e7b){while(--_0x446e7b){_0x27470b['push'](_0x27470b['shift']());}};_0x239c90(++_0x3ade0f);}(_0x00ad,0x15a));var _0xd00a=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x00ad[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0xd00a('0x0'));var iconv=require(_0xd00a('0x1'));module['exports']={'closed':{'type':Sequelize[_0xd00a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd00a('0x3')]},'disposition':{'type':Sequelize[_0xd00a('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd00a('0x4')]},'note':{'type':Sequelize[_0xd00a('0x4')]},'inReplyTo':{'type':Sequelize[_0xd00a('0x4')](0x1fe)},'to':{'type':Sequelize[_0xd00a('0x4')]},'cc':{'type':Sequelize[_0xd00a('0x5')]('long')},'subject':{'type':Sequelize[_0xd00a('0x5')]()},'attach':{'type':Sequelize[_0xd00a('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xd00a('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xd00a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd00a('0x6')]('in',_0xd00a('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd00a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd00a('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd00a('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index a157f25..79960ac 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 _0x3eb9=['ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','forEach','MailAccountId','i.MailAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','sequelize','toString','keyBy','merge','MailInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','params','includeAll','include','options','create','body','describe','MailMessage','addMessage','ids','getMessages','hasOwnProperty','format','inlineCss','setTags','omit','findAll','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','createdAt','get','each','subject','decode','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','lodash','squel','../../components/parsers/advancedSearch','api','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','Users','map','fullname','Tags','TagIds','push','findOne','out','plainBody','lastMsgText','trimStart','catch','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','field','color','from','tools_tags','select','u.id','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','a.id\x20=\x20i.MailAccountId','mail_messages','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?'];(function(_0x57ba77,_0x5c0844){var _0x22aaeb=function(_0x85e305){while(--_0x85e305){_0x57ba77['push'](_0x57ba77['shift']());}};_0x22aaeb(++_0x5c0844);}(_0x3eb9,0x171));var _0x93eb=function(_0x4ea413,_0x51ff3a){_0x4ea413=_0x4ea413-0x0;var _0x51cf25=_0x3eb9[_0x4ea413];return _0x51cf25;};'use strict';var emlformat=require(_0x93eb('0x0'));var rimraf=require(_0x93eb('0x1'));var zipdir=require(_0x93eb('0x2'));var moment=require('moment');var BPromise=require(_0x93eb('0x3'));var util=require(_0x93eb('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x93eb('0x5'));var squel=require(_0x93eb('0x6'));var juice=require('juice');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require(_0x93eb('0x7'));var logger=require('../../config/logger')(_0x93eb('0x8'));var config=require('../../config/environment');var db=require(_0x93eb('0x9'))['db'];var htmlEntities=require(_0x93eb('0xa'));config[_0x93eb('0xb')]=_[_0x93eb('0xc')](config[_0x93eb('0xb')],{'host':_0x93eb('0xd'),'port':0x18eb});var socket=require(_0x93eb('0xe'))(new Redis(config[_0x93eb('0xb')]));require(_0x93eb('0xf'))[_0x93eb('0x10')](socket);function respondWithStatusCode(_0x4b7de5,_0x241c16){_0x241c16=_0x241c16||0xcc;return function(_0x26ffc2){if(_0x26ffc2){return _0x4b7de5['sendStatus'](_0x241c16);}return _0x4b7de5[_0x93eb('0x11')](_0x241c16)[_0x93eb('0x12')]();};}function respondWithResult(_0x1bd7b4,_0x3824be){_0x3824be=_0x3824be||0xc8;return function(_0x599545){if(_0x599545){return _0x1bd7b4[_0x93eb('0x11')](_0x3824be)[_0x93eb('0x13')](_0x599545);}};}function respondWithFilteredResult(_0x5d705c,_0x3bbe19){return function(_0x4c53e9){if(_0x4c53e9){var _0x1c4c35=typeof _0x3bbe19['offset']===_0x93eb('0x14')&&typeof _0x3bbe19[_0x93eb('0x15')]==='undefined';var _0x535996=_0x4c53e9[_0x93eb('0x16')];var _0x17ea09=_0x1c4c35?0x0:_0x3bbe19[_0x93eb('0x17')];var _0x24bef6=_0x1c4c35?_0x4c53e9[_0x93eb('0x16')]:_0x3bbe19['offset']+_0x3bbe19[_0x93eb('0x15')];var _0x537e4e;if(_0x24bef6>=_0x535996){_0x24bef6=_0x535996;_0x537e4e=0xc8;}else{_0x537e4e=0xce;}_0x5d705c[_0x93eb('0x11')](_0x537e4e);return _0x5d705c[_0x93eb('0x18')](_0x93eb('0x19'),_0x17ea09+'-'+_0x24bef6+'/'+_0x535996)['json'](_0x4c53e9);}return null;};}function saveUpdates(_0xfa2f00){return function(_0x2a2dc8){if(_0x2a2dc8){return _0x2a2dc8[_0x93eb('0x1a')](_0xfa2f00)[_0x93eb('0x1b')](function(_0x4653a4){return _0x4653a4;});}return null;};}function removeEntity(_0x4bb678){return function(_0x3fe6b5){if(_0x3fe6b5){return _0x3fe6b5[_0x93eb('0x1c')]()[_0x93eb('0x1b')](function(){_0x4bb678[_0x93eb('0x11')](0xcc)[_0x93eb('0x12')]();});}};}function handleEntityNotFound(_0xb08d50){return function(_0x4b1949){if(!_0x4b1949){_0xb08d50[_0x93eb('0x1d')](0x194);}return _0x4b1949;};}function handleError(_0xc7fd24,_0x345b6b){_0x345b6b=_0x345b6b||0x1f4;return function(_0x128fd1){logger['error'](_0x128fd1[_0x93eb('0x1e')]);if(_0x128fd1[_0x93eb('0x1f')]){delete _0x128fd1[_0x93eb('0x1f')];}_0xc7fd24[_0x93eb('0x11')](_0x345b6b)[_0x93eb('0x20')](_0x128fd1);};}function getInteractionUsers(_0x3f7cd5,_0xd9a603){return new BPromise(function(_0x2f98e7,_0x16c379){try{if(_0xd9a603[_0x3f7cd5['id']]){_0x3f7cd5[_0x93eb('0x21')]=_[_0x93eb('0x22')](_0xd9a603[_0x3f7cd5['id']],function(_0x20ffff){return{'id':_0x20ffff['id'],'fullname':_0x20ffff[_0x93eb('0x23')]};});}}catch(_0x281382){_0x16c379(_0x281382);}_0x2f98e7(_0x3f7cd5);});}function getInteractionTags(_0x32cbf0,_0x3db2dd){return new BPromise(function(_0x868b5f,_0x283611){try{if(_0x32cbf0['TagIds']){_0x32cbf0[_0x93eb('0x24')]=[];_0x32cbf0[_0x93eb('0x25')]['split'](',')['forEach'](function(_0x485ee9){_0x32cbf0[_0x93eb('0x24')][_0x93eb('0x26')](_0x3db2dd[_0x485ee9]);});}delete _0x32cbf0['TagIds'];}catch(_0x114f3e){_0x283611(_0x114f3e);}_0x868b5f(_0x32cbf0);});}function getLastMessageText(_0x56fa16){return new BPromise(function(_0xe0d992,_0x31c14b){return db['MailMessage'][_0x93eb('0x27')]({'where':{'$and':[{'MailInteractionId':_0x56fa16['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x93eb('0x28')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x93eb('0x29')],'order':'-id','raw':!![]})['then'](function(_0x4d678e){if(_0x4d678e&&_0x4d678e[_0x93eb('0x29')]){_0x56fa16[_0x93eb('0x2a')]=_[_0x93eb('0x2b')](_0x4d678e[_0x93eb('0x29')]);}_0xe0d992(_0x56fa16);})[_0x93eb('0x2c')](function(_0x3007ee){_0x31c14b(_0x3007ee);});});}function updateMailInteraction(_0x40895b,_0x4e75bb,_0x4ac687,_0x4ea506){return new BPromise(function(_0x39ab8d,_0x517745){return getInteractionUsers(_0x40895b,_0x4ac687)['then'](function(_0x568ba2){return getInteractionTags(_0x568ba2,_0x4e75bb);})[_0x93eb('0x1b')](function(_0x4aaa9f){if(_0x4ea506){_0x39ab8d(getLastMessageText(_0x4aaa9f));}else{_0x39ab8d(_0x4aaa9f);}})['catch'](function(_0x1bff03){_0x517745(_0x1bff03);});});}exports[_0x93eb('0x2d')]=function(_0x40938f,_0x2092a1){var _0x1946f1={},_0x118c75={},_0x3c6ce3={'count':0x0,'rows':[]};var _0x1aef06=_[_0x93eb('0x22')](db['MailInteraction'][_0x93eb('0x2e')],function(_0x32a430){return{'name':_0x32a430[_0x93eb('0x2f')],'type':_0x32a430[_0x93eb('0x30')][_0x93eb('0x31')]};});_0x118c75[_0x93eb('0x32')]=_['map'](_0x1aef06,'name');_0x118c75[_0x93eb('0x33')]=_[_0x93eb('0x34')](_0x40938f[_0x93eb('0x33')]);_0x118c75[_0x93eb('0x35')]=_[_0x93eb('0x36')](_0x118c75[_0x93eb('0x32')],_0x118c75['query']);_0x1946f1['attributes']=_['intersection'](_0x118c75[_0x93eb('0x32')],qs[_0x93eb('0x37')](_0x40938f[_0x93eb('0x33')][_0x93eb('0x37')]));_0x1946f1['attributes']=_0x1946f1[_0x93eb('0x38')][_0x93eb('0x39')]?_0x1946f1[_0x93eb('0x38')]:_0x118c75['model'];if(!_0x40938f[_0x93eb('0x33')]['hasOwnProperty'](_0x93eb('0x3a'))){_0x1946f1[_0x93eb('0x15')]=qs[_0x93eb('0x15')](_0x40938f[_0x93eb('0x33')][_0x93eb('0x15')]);_0x1946f1[_0x93eb('0x17')]=qs[_0x93eb('0x17')](_0x40938f[_0x93eb('0x33')]['offset']);}_0x1946f1['order']=qs[_0x93eb('0x3b')](_0x40938f['query']['sort']);_0x1946f1[_0x93eb('0x3c')]=qs[_0x93eb('0x35')](_[_0x93eb('0x3d')](_0x40938f[_0x93eb('0x33')],_0x118c75[_0x93eb('0x35')]),_0x1aef06);var _0x29e930=[];var _0x12dc22=squel['select']()[_0x93eb('0x3e')]('id')['field'](_0x93eb('0x1f'))[_0x93eb('0x3e')](_0x93eb('0x3f'))[_0x93eb('0x40')](_0x93eb('0x41'));var _0x402ba3=squel[_0x93eb('0x42')]()[_0x93eb('0x3e')](_0x93eb('0x43'))[_0x93eb('0x3e')]('u.fullname')[_0x93eb('0x3e')](_0x93eb('0x44'))['from'](_0x93eb('0x45'),'ui')[_0x93eb('0x46')]('users','u',_0x93eb('0x47'));var _0x3e1c2d=squel[_0x93eb('0x42')]()[_0x93eb('0x40')](_0x93eb('0x48'),'i')[_0x93eb('0x46')](_0x93eb('0x49'),'c',_0x93eb('0x4a'))[_0x93eb('0x46')](_0x93eb('0x4b'),'o','o.id\x20=\x20i.UserId')[_0x93eb('0x46')]('mail_accounts','a',_0x93eb('0x4c'))[_0x93eb('0x46')](_0x93eb('0x4d'),'me','me.MailInteractionId\x20=\x20i.id')['left_join']('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')[_0x93eb('0x46')](_0x93eb('0x41'),'t',_0x93eb('0x4e'));var _0x3a8c21=squel[_0x93eb('0x4f')]();var _0x428547=[];var _0x45c03f=squel['expr']();var _0x2994a2;if(_0x40938f[_0x93eb('0x33')][_0x93eb('0x50')]){_0x2994a2=as['parseSearch'](_0x40938f[_0x93eb('0x33')][_0x93eb('0x50')]);var _0x59be1d=_0x2994a2[_0x93eb('0x51')];for(var _0x4b0c9a=0x0;_0x4b0c9a<_0x2994a2[_0x93eb('0x52')][_0x93eb('0x39')];_0x4b0c9a++){var _0x54d146=_0x2994a2['conditions'][_0x4b0c9a];var _0x346eb4='i';var _0x13ae4c=_[_0x93eb('0x53')](_0x1aef06,[_0x93eb('0x1f'),_0x54d146['field']]);if(!_0x13ae4c){switch(_0x54d146[_0x93eb('0x3e')]){case _0x93eb('0x54'):if(_0x54d146[_0x93eb('0x55')]==0x1){_0x3e1c2d[_0x93eb('0x56')]('`'+_0x54d146['field']+_0x93eb('0x57'));}else{_0x3e1c2d['having']('`'+_0x54d146['field']+'`\x20>\x200');}break;case _0x93eb('0x58'):if(_0x54d146[_0x93eb('0x59')]===_0x93eb('0x5a')){if(_0x54d146[_0x93eb('0x55')][_0x93eb('0x5b')]('\x20')[_0x93eb('0x39')]>0x1){_0x3a8c21[_0x59be1d](_0x93eb('0x5c'),qs[_0x93eb('0x5d')](_0x54d146['value']),null);}else{var _0x4f755d='%'+_0x54d146[_0x93eb('0x55')]+'%';_0x3a8c21[_0x59be1d](_0x93eb('0x5e'),_0x4f755d,_0x4f755d,_0x4f755d);}}else{_0x13ae4c=_[_0x93eb('0x53')](_0x1aef06,[_0x93eb('0x1f'),_0x93eb('0x5f')]);_0x54d146[_0x93eb('0x3e')]=_0x93eb('0x5f');_0xce8088=as[_0x93eb('0x60')](_0x346eb4,_0x13ae4c[_0x93eb('0x30')],_0x54d146);_0x3a8c21[_0x59be1d](_0xce8088[_0x93eb('0x61')],_0xce8088[_0x93eb('0x55')][_0x93eb('0x62')],_0xce8088[_0x93eb('0x55')][_0x93eb('0x12')]);}break;case'Tag':var _0x361ab3=_0x54d146[_0x93eb('0x55')][_0x93eb('0x5b')](',')[_0x93eb('0x22')](function(_0x5afb01){return Number(_0x5afb01);});_0x361ab3['forEach'](function(_0x1852a3){_0x45c03f['or'](_0x93eb('0x63'),'%,'+_0x1852a3+',%');});_0x428547=_[_0x93eb('0x64')](_0x428547,_0x361ab3);break;case _0x93eb('0x65'):if(_0x54d146[_0x93eb('0x59')]==='$substring'){_0x3a8c21[_0x59be1d](_0x93eb('0x66'),'%'+_0x54d146[_0x93eb('0x55')]+'%',null);}else{_0x13ae4c=_[_0x93eb('0x53')](_0x1aef06,[_0x93eb('0x1f'),_0x93eb('0x67')]);_0x54d146[_0x93eb('0x3e')]=_0x93eb('0x67');_0xce8088=as[_0x93eb('0x60')](_0x346eb4,_0x13ae4c[_0x93eb('0x30')],_0x54d146);_0x3a8c21[_0x59be1d](_0xce8088[_0x93eb('0x61')],_0xce8088[_0x93eb('0x55')][_0x93eb('0x62')],_0xce8088['value'][_0x93eb('0x12')]);}break;case _0x93eb('0x29'):_0xce8088=as[_0x93eb('0x60')]('me',null,_0x54d146);_0x3a8c21[_0x59be1d](_0xce8088['text'],_0xce8088[_0x93eb('0x55')][_0x93eb('0x62')],_0xce8088['value']['end']);break;}}else{var _0xce8088=as[_0x93eb('0x60')](_0x346eb4,_0x13ae4c['type'],_0x54d146);_0x3a8c21[_0x59be1d](_0xce8088['text'],_0xce8088[_0x93eb('0x55')][_0x93eb('0x62')],_0xce8088['value'][_0x93eb('0x12')]);}}}else{var _0x3c8764=_(_0x40938f['query'])[_0x93eb('0x34')]()['map'](function(_0x5c5b29){return _[_0x93eb('0x68')](_0x1aef06,[_0x93eb('0x1f'),_0x5c5b29])?_0x5c5b29:undefined;})[_0x93eb('0x69')]()[_0x93eb('0x55')]();if(!_[_0x93eb('0x6a')](_0x3c8764)){_0x3c8764[_0x93eb('0x6b')](function(_0xf6aae0){if(_0xf6aae0===_0x93eb('0x6c')){_0x3e1c2d['where'](_0x93eb('0x6d'),[][_0x93eb('0x6e')](_0x40938f[_0x93eb('0x33')][_0xf6aae0]));}else if(_0xf6aae0==='createdAt'){var _0x2a1a10=JSON[_0x93eb('0x6f')](_0x40938f[_0x93eb('0x33')][_0xf6aae0])[_0x93eb('0x70')];var _0x2741e4=JSON[_0x93eb('0x6f')](_0x40938f[_0x93eb('0x33')][_0xf6aae0])[_0x93eb('0x71')];_0x3e1c2d[_0x93eb('0x3c')](_0x93eb('0x72'),_0x2a1a10,_0x2741e4);}else{if(_0x40938f['query'][_0xf6aae0]===_0x93eb('0x73')){_0x3e1c2d['where']('i.'+_0xf6aae0+'\x20IS\x20NULL');}else{_0x3e1c2d[_0x93eb('0x3c')]('i.'+_0xf6aae0+'\x20=\x20?',_0x40938f[_0x93eb('0x33')][_0xf6aae0]);}}});}if(_0x40938f[_0x93eb('0x33')]['read']){if(_0x40938f['query'][_0x93eb('0x74')]==0x1){_0x3e1c2d[_0x93eb('0x56')](_0x93eb('0x75'));}else{_0x3e1c2d['having'](_0x93eb('0x76'));}}if(_0x40938f[_0x93eb('0x33')][_0x93eb('0x77')]){_0x428547=_[_0x93eb('0x78')](_0x40938f[_0x93eb('0x33')][_0x93eb('0x77')])?_0x40938f['query'][_0x93eb('0x77')]:new Array(_0x40938f[_0x93eb('0x33')][_0x93eb('0x77')]);_0x428547['forEach'](function(_0x146edd){_0x45c03f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x146edd+',%');});}if(_0x40938f[_0x93eb('0x33')][_0x93eb('0x79')]){var _0x23ef77=_0x40938f[_0x93eb('0x33')][_0x93eb('0x79')]['replace']('\x5c','\x5c\x5c')[_0x93eb('0x7a')](/'/g,'\x27\x27');if(qs[_0x93eb('0x7b')](_0x23ef77)){_0x3a8c21['or'](_0x93eb('0x7c'),_0x23ef77+'%');}else if(qs[_0x93eb('0x7d')](_0x23ef77)){_0x3a8c21['or'](_0x93eb('0x7e'),_0x23ef77+'%');}else{_0x3a8c21['or'](_0x93eb('0x7f'),qs[_0x93eb('0x5d')](_0x23ef77))['or'](_0x93eb('0x80'),qs[_0x93eb('0x5d')](_0x23ef77));}}}_0x3e1c2d[_0x93eb('0x3c')](_0x3a8c21);_0x3e1c2d['group'](_0x93eb('0x81'));var _0x495495={'type':db[_0x93eb('0x82')][_0x93eb('0x83')][_0x93eb('0x84')],'raw':!![]};var _0x28275b=_0x3e1c2d['clone']();_0x28275b['field']('i.id');_0x28275b['field'](_0x93eb('0x85'),_0x93eb('0x54'));if(_0x1946f1[_0x93eb('0x86')]){_0x1946f1['order'][_0x93eb('0x6b')](function(_0x1e4c1b){var _0x1f558e=_0x1e4c1b[0x0]===_0x93eb('0x87')?_0x1e4c1b[0x0]:'i.'+_0x1e4c1b[0x0];_0x3e1c2d[_0x93eb('0x86')](_0x1f558e,_0x1e4c1b[0x1]==='DESC'?![]:!![]);});}if(!_[_0x93eb('0x6a')](_0x428547)){_0x3e1c2d['having'](_0x45c03f);_0x28275b[_0x93eb('0x3c')](_0x93eb('0x88'),_0x428547);}BPromise[_0x93eb('0x89')]()[_0x93eb('0x1b')](function(){if(!_0x2994a2){if(_0x40938f[_0x93eb('0x33')]['MailAccountId'])return;_0x28275b[_0x93eb('0x3c')](_0x93eb('0x8a'));_0x3e1c2d[_0x93eb('0x3c')](_0x93eb('0x8a'));return;}if(_0x40938f[_0x93eb('0x8b')][_0x93eb('0x8c')]!==_0x93eb('0x8d'))return;return _0x40938f[_0x93eb('0x8b')][_0x93eb('0x8e')]({'attributes':['id'],'raw':!![]})[_0x93eb('0x1b')](function(_0x6c930){if(_[_0x93eb('0x6a')](_0x6c930)){_0x28275b[_0x93eb('0x3c')]('i.MailAccountId\x20IS\x20NULL');_0x3e1c2d[_0x93eb('0x3c')]('i.MailAccountId\x20IS\x20NULL');}else{_0x28275b[_0x93eb('0x3c')](_0x93eb('0x6d'),_[_0x93eb('0x22')](_0x6c930,'id'));_0x3e1c2d['where'](_0x93eb('0x6d'),_[_0x93eb('0x22')](_0x6c930,'id'));}});})['then'](function(){if(_0x40938f[_0x93eb('0x8b')]['role']===_0x93eb('0x8d')&&!_0x2994a2&&!_0x40938f[_0x93eb('0x33')][_0x93eb('0x6c')])return[];return db[_0x93eb('0x8f')][_0x93eb('0x33')](_0x28275b['toString'](),_0x495495);})[_0x93eb('0x1b')](function(_0x5cb382){_0x3c6ce3['count']=_0x5cb382[_0x93eb('0x39')];if(_0x3c6ce3[_0x93eb('0x16')]===0x0)return[];return db[_0x93eb('0x8f')]['query'](_0x12dc22[_0x93eb('0x90')](),_0x495495)[_0x93eb('0x1b')](function(_0x33b624){_0x29e930=_[_0x93eb('0x91')](_0x33b624,'id');_0x495495=_[_0x93eb('0x92')](_0x495495,{'model':db[_0x93eb('0x93')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40938f['query'][_0x93eb('0x37')]){_0x1946f1['attributes'][_0x93eb('0x6b')](function(_0x494244){_0x3e1c2d['field']('i.'+_0x494244);});}else{_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0x85'),_0x93eb('0x54'));_0x3e1c2d[_0x93eb('0x3e')]('a.key',_0x93eb('0x94'));_0x3e1c2d['field'](_0x93eb('0x95'),_0x93eb('0x96'));_0x3e1c2d['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x93eb('0x87'));_0x3e1c2d['field'](_0x93eb('0x81'));_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0x97'));_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0x98'));_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0x99'));_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0x9a'));_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0x9b'));_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0x9c'));_0x3e1c2d[_0x93eb('0x3e')]('i.lastMsgDirection');_0x3e1c2d['field'](_0x93eb('0x9d'));_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0x9e'));_0x3e1c2d['field'](_0x93eb('0x9f'));_0x3e1c2d[_0x93eb('0x3e')]('i.thirdDisposition');_0x3e1c2d['field'](_0x93eb('0xa0'));_0x3e1c2d['field'](_0x93eb('0xa1'));_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0xa2'));_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0xa3'));_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0xa4'));_0x3e1c2d['field']('c.firstName',_0x93eb('0xa5'));_0x3e1c2d['field'](_0x93eb('0xa6'),'Contact.lastName');_0x3e1c2d['field'](_0x93eb('0xa7'),'Contact.email');_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0xa8'),_0x93eb('0xa9'));_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0xaa'),_0x93eb('0xab'));_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0xac'),_0x93eb('0xad'));_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0xae'),_0x93eb('0xaf'));_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0xb0'),_0x93eb('0xb1'));_0x3e1c2d[_0x93eb('0x3e')](_0x93eb('0xb2'),'TagIds');}if(_0x1946f1[_0x93eb('0x15')])_0x3e1c2d[_0x93eb('0x15')](_0x1946f1[_0x93eb('0x15')]);if(_0x1946f1[_0x93eb('0x17')])_0x3e1c2d[_0x93eb('0x17')](_0x1946f1[_0x93eb('0x17')]);return db[_0x93eb('0x8f')][_0x93eb('0x33')](_0x3e1c2d[_0x93eb('0x90')](),_0x495495);})[_0x93eb('0x1b')](function(_0x5273ab){if(_0x5273ab['length']>0x0)_0x402ba3[_0x93eb('0x3c')](_0x93eb('0xb3'),_['map'](_0x5273ab,'id'));return db['sequelize']['query'](_0x402ba3[_0x93eb('0x90')](),_0x495495)['then'](function(_0x1ba30a){var _0x3ce36c=_[_0x93eb('0xb4')](_0x1ba30a,_0x93eb('0xb5'));var _0x33aa51=[];return db[_0x93eb('0xb6')][_0x93eb('0x27')]({'attributes':[_0x93eb('0xb7')],'raw':!![]})[_0x93eb('0x1b')](function(_0x1af611){var _0x4905d5=_0x1af611[_0x93eb('0xb7')];_0x5273ab['forEach'](function(_0x32575e){_0x33aa51['push'](updateMailInteraction(_0x32575e,_0x29e930,_0x3ce36c,_0x4905d5));});return BPromise[_0x93eb('0xb8')](_0x33aa51);});});});})[_0x93eb('0x1b')](function(_0x20c11a){_0x3c6ce3[_0x93eb('0xb9')]=_0x20c11a;return _0x3c6ce3;})['then'](respondWithFilteredResult(_0x2092a1,_0x1946f1))['catch'](handleError(_0x2092a1,null));};exports['show']=function(_0x1de00c,_0xf397b4){var _0x5bd27a={'raw':![],'where':{'id':_0x1de00c[_0x93eb('0xba')]['id']}},_0x590922={};_0x590922[_0x93eb('0x32')]=_[_0x93eb('0x34')](db[_0x93eb('0x93')][_0x93eb('0x2e')]);_0x590922['query']=_[_0x93eb('0x34')](_0x1de00c[_0x93eb('0x33')]);_0x590922[_0x93eb('0x35')]=_[_0x93eb('0x36')](_0x590922[_0x93eb('0x32')],_0x590922['query']);_0x5bd27a['attributes']=_[_0x93eb('0x36')](_0x590922[_0x93eb('0x32')],qs[_0x93eb('0x37')](_0x1de00c[_0x93eb('0x33')][_0x93eb('0x37')]));_0x5bd27a[_0x93eb('0x38')]=_0x5bd27a['attributes']['length']?_0x5bd27a[_0x93eb('0x38')]:_0x590922[_0x93eb('0x32')];if(_0x1de00c['query'][_0x93eb('0xbb')]){_0x5bd27a[_0x93eb('0xbc')]=[{'all':!![]}];}_0x5bd27a=_[_0x93eb('0x92')]({},_0x5bd27a,_0x1de00c[_0x93eb('0xbd')]);return db[_0x93eb('0x93')][_0x93eb('0x53')](_0x5bd27a)[_0x93eb('0x1b')](handleEntityNotFound(_0xf397b4,null))[_0x93eb('0x1b')](respondWithResult(_0xf397b4,null))['catch'](handleError(_0xf397b4,null));};exports[_0x93eb('0xbe')]=function(_0x306549,_0x26905f){return db[_0x93eb('0x93')][_0x93eb('0xbe')](_0x306549[_0x93eb('0xbf')],{})[_0x93eb('0x1b')](respondWithResult(_0x26905f,0xc9))[_0x93eb('0x2c')](handleError(_0x26905f,null));};exports['update']=function(_0x3c464d,_0x5478a2){if(_0x3c464d[_0x93eb('0xbf')]['id']){delete _0x3c464d[_0x93eb('0xbf')]['id'];}return db[_0x93eb('0x93')][_0x93eb('0x53')]({'where':{'id':_0x3c464d[_0x93eb('0xba')]['id']}})['then'](handleEntityNotFound(_0x5478a2,null))[_0x93eb('0x1b')](saveUpdates(_0x3c464d[_0x93eb('0xbf')],null))[_0x93eb('0x1b')](respondWithResult(_0x5478a2,null))[_0x93eb('0x2c')](handleError(_0x5478a2,null));};exports['destroy']=function(_0x5c8df1,_0x54ff36){return db[_0x93eb('0x93')]['find']({'where':{'id':_0x5c8df1[_0x93eb('0xba')]['id']}})[_0x93eb('0x1b')](handleEntityNotFound(_0x54ff36,null))[_0x93eb('0x1b')](removeEntity(_0x54ff36,null))['catch'](handleError(_0x54ff36,null));};exports[_0x93eb('0xc0')]=function(_0x29bb08,_0xfe6696){return db['MailInteraction'][_0x93eb('0xc0')]()[_0x93eb('0x1b')](respondWithResult(_0xfe6696,null))[_0x93eb('0x2c')](handleError(_0xfe6696,null));};exports['addMessage']=function(_0x328f68,_0x15e29f){return db[_0x93eb('0xc1')][_0x93eb('0x53')]({'where':{'id':_0x328f68[_0x93eb('0xba')]['id']}})[_0x93eb('0x1b')](handleEntityNotFound(_0x15e29f,null))[_0x93eb('0x1b')](function(_0x2cf552){if(_0x2cf552){return _0x2cf552[_0x93eb('0xc2')](_0x328f68[_0x93eb('0xbf')][_0x93eb('0xc3')],_['omit'](_0x328f68[_0x93eb('0xbf')],[_0x93eb('0xc3'),'id'])||{});}})[_0x93eb('0x1b')](respondWithResult(_0x15e29f,null))[_0x93eb('0x2c')](handleError(_0x15e29f,null));};exports[_0x93eb('0xc4')]=function(_0x4d9481,_0x16b451){var _0x4adb4c={'raw':![],'where':{}};var _0x254b51={};var _0x33160e={'count':0x0,'rows':[]};return db['MailInteraction'][_0x93eb('0x27')]({'where':{'id':_0x4d9481[_0x93eb('0xba')]['id']}})[_0x93eb('0x1b')](handleEntityNotFound(_0x16b451,null))[_0x93eb('0x1b')](function(_0x2d1460){if(_0x2d1460){_0x254b51[_0x93eb('0x32')]=_[_0x93eb('0x34')](db[_0x93eb('0xc1')][_0x93eb('0x2e')]);_0x254b51[_0x93eb('0x33')]=_[_0x93eb('0x34')](_0x4d9481[_0x93eb('0x33')]);_0x254b51[_0x93eb('0x35')]=_[_0x93eb('0x36')](_0x254b51[_0x93eb('0x32')],_0x254b51[_0x93eb('0x33')]);_0x4adb4c[_0x93eb('0x38')]=_['intersection'](_0x254b51[_0x93eb('0x32')],qs[_0x93eb('0x37')](_0x4d9481['query'][_0x93eb('0x37')]));_0x4adb4c[_0x93eb('0x38')]=_0x4adb4c[_0x93eb('0x38')]['length']?_0x4adb4c[_0x93eb('0x38')]:_0x254b51['model'];if(!_0x4d9481[_0x93eb('0x33')][_0x93eb('0xc5')]('nolimit')){_0x4adb4c['limit']=qs[_0x93eb('0x15')](_0x4d9481[_0x93eb('0x33')][_0x93eb('0x15')]);_0x4adb4c['offset']=qs['offset'](_0x4d9481[_0x93eb('0x33')]['offset']);}_0x4adb4c[_0x93eb('0x86')]=qs[_0x93eb('0x3b')](_0x4d9481[_0x93eb('0x33')][_0x93eb('0x3b')]);_0x4adb4c[_0x93eb('0x3c')]=qs[_0x93eb('0x35')](_[_0x93eb('0x3d')](_0x4d9481[_0x93eb('0x33')],_0x254b51[_0x93eb('0x35')]));_0x4adb4c[_0x93eb('0x3c')][_0x93eb('0xb5')]=_0x2d1460['id'];if(_0x4d9481[_0x93eb('0x33')][_0x93eb('0x79')]){_0x4adb4c['where']=_[_0x93eb('0x92')](_0x4adb4c[_0x93eb('0x3c')],{'$or':_[_0x93eb('0x22')](_0x4adb4c[_0x93eb('0x38')],function(_0x5aa701){var _0x1f8e3e={};_0x1f8e3e[_0x5aa701]={'$like':'%'+_0x4d9481[_0x93eb('0x33')]['filter']+'%'};return _0x1f8e3e;})});}if(_0x4d9481[_0x93eb('0x33')][_0x93eb('0x70')]){var _0x3e09b7=_0x4d9481[_0x93eb('0x33')][_0x93eb('0x70')]['split'](',');var _0x2e0c3d={};_0x2e0c3d[_0x3e09b7[0x0]]={'$gte':moment(_0x3e09b7[0x1])[_0x93eb('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4adb4c[_0x93eb('0x3c')]=_[_0x93eb('0x92')](_0x4adb4c[_0x93eb('0x3c')],_0x2e0c3d);}_0x4adb4c=_[_0x93eb('0x92')]({},_0x4adb4c,_0x4d9481[_0x93eb('0xbd')]);return db['MailMessage'][_0x93eb('0x16')]({'where':_0x4adb4c[_0x93eb('0x3c')]})[_0x93eb('0x1b')](function(_0x113efb){_0x33160e[_0x93eb('0x16')]=_0x113efb;if(_0x4d9481[_0x93eb('0x33')][_0x93eb('0xbb')]){_0x4adb4c[_0x93eb('0xbc')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x4adb4c);})[_0x93eb('0x1b')](function(_0x41aa51){if(_0x4d9481[_0x93eb('0x33')][_0x93eb('0xc7')]==='true'){for(var _0x27d6b8=0x0;_0x27d6b8<_0x41aa51[_0x93eb('0x39')];_0x27d6b8++){_0x41aa51[_0x27d6b8][_0x93eb('0xbf')]=juice(_0x41aa51[_0x27d6b8][_0x93eb('0xbf')]);}}_0x33160e[_0x93eb('0xb9')]=_0x41aa51;return _0x33160e;});}})[_0x93eb('0x1b')](respondWithFilteredResult(_0x16b451,_0x4adb4c))['catch'](handleError(_0x16b451,null));};exports['addTags']=function(_0x12d39b,_0x233065){return db[_0x93eb('0x93')][_0x93eb('0x53')]({'where':{'id':_0x12d39b[_0x93eb('0xba')]['id']}})[_0x93eb('0x1b')](handleEntityNotFound(_0x233065,null))[_0x93eb('0x1b')](function(_0x510c9b){if(_0x510c9b){return _0x510c9b[_0x93eb('0xc8')](_0x12d39b[_0x93eb('0xbf')][_0x93eb('0xc3')],_[_0x93eb('0xc9')](_0x12d39b[_0x93eb('0xbf')],[_0x93eb('0xc3'),'id'])||{})['spread'](function(){return db['Tag'][_0x93eb('0xca')]({'attributes':['id',_0x93eb('0x1f'),'color'],'where':{'id':_0x12d39b[_0x93eb('0xbf')][_0x93eb('0xc3')]}});})[_0x93eb('0x1b')](function(_0x376a20){socket[_0x93eb('0xcb')](_0x93eb('0xcc'),{'id':Number(_0x12d39b['params']['id']),'tags':_0x376a20||[]});return{'id':Number(_0x12d39b[_0x93eb('0xba')]['id']),'tags':_0x376a20||[]};});}})[_0x93eb('0x1b')](respondWithResult(_0x233065,null))[_0x93eb('0x2c')](handleError(_0x233065,null));};exports['removeTags']=function(_0x187ced,_0x24773b){return db[_0x93eb('0x93')][_0x93eb('0x53')]({'where':{'id':_0x187ced[_0x93eb('0xba')]['id']}})['then'](handleEntityNotFound(_0x24773b,null))[_0x93eb('0x1b')](function(_0xc76df5){if(_0xc76df5){return _0xc76df5[_0x93eb('0xcd')](_0x187ced[_0x93eb('0x33')][_0x93eb('0xc3')]);}})[_0x93eb('0x1b')](respondWithStatusCode(_0x24773b,null))[_0x93eb('0x2c')](handleError(_0x24773b,null));};exports[_0x93eb('0xce')]=function(_0x459010,_0x718337){var _0x44fdca=moment()[_0x93eb('0xcf')]()[_0x93eb('0x90')]();var _0x1abc0e=path[_0x93eb('0xd0')](config[_0x93eb('0xd1')],_0x93eb('0xd2'),'files','tmp');var _0x23fdf0=path['join'](config['root'],'server',_0x93eb('0xd3'),_0x93eb('0xd4'));var _0x54ba84=path[_0x93eb('0xd0')](_0x1abc0e,_0x44fdca);var _0x332a38=util['format'](_0x93eb('0xd5'),_0x459010[_0x93eb('0xba')]['id'],_0x44fdca);var _0x3311a0=path[_0x93eb('0xd0')](_0x1abc0e,_0x332a38);var _0x5b0c99=[];if(_0x459010[_0x93eb('0x33')][_0x93eb('0xd4')]){_0x5b0c99['push']({'model':db[_0x93eb('0xd6')],'as':_0x93eb('0xd7'),'raw':!![]});}var _0x58b504=[{'model':db['MailMessage'],'as':_0x93eb('0xd8'),'attributes':['id',_0x93eb('0xbf'),_0x93eb('0x40'),'to','cc',_0x93eb('0xd9'),'subject',_0x93eb('0xda')],'where':{'secret':![]},'order':qs[_0x93eb('0x3b')]('id'),'include':_0x5b0c99}];return db[_0x93eb('0x93')][_0x93eb('0x53')]({'where':{'id':_0x459010[_0x93eb('0xba')]['id']},'include':_0x58b504})['then'](handleEntityNotFound(_0x718337,null))[_0x93eb('0x1b')](function(_0x1ec029){if(_0x1ec029&&_0x1ec029[_0x93eb('0xd8')]){var _0x5d2bec=_0x1ec029[_0x93eb('0xdb')]({'plain':!![]});fs['mkdirSync'](_0x54ba84);return BPromise[_0x93eb('0xdc')](_0x5d2bec[_0x93eb('0xd8')],function(_0xa4ba06,_0x3cc955){var _0x58262b={'from':_0xa4ba06[_0x93eb('0x40')],'to':_0xa4ba06['to'],'subject':_0xa4ba06[_0x93eb('0xdd')],'html':htmlEntities[_0x93eb('0xde')](_0xa4ba06[_0x93eb('0xbf')]),'headers':{'Date':moment(_0xa4ba06[_0x93eb('0xda')])[_0x93eb('0xc6')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xa4ba06['cc']){_0x58262b[_0x93eb('0xdf')]['Cc']=_0xa4ba06['cc'];}if(_0xa4ba06[_0x93eb('0xd9')]){_0x58262b[_0x93eb('0xdf')][_0x93eb('0xe0')]=_0xa4ba06[_0x93eb('0xd9')];}return new BPromise(function(_0x274391,_0x16b217){if(_0xa4ba06[_0x93eb('0xd7')]){for(var _0x8908ba=0x0;_0x8908ba<_0xa4ba06[_0x93eb('0xd7')]['length'];_0x8908ba++){var _0xed334d=_0xa4ba06[_0x93eb('0xd7')][_0x8908ba];var _0x3bcfeb=path[_0x93eb('0xd0')](_0x23fdf0,_0xed334d[_0x93eb('0xe1')]);if(fs[_0x93eb('0xe2')](_0x3bcfeb)){_0x58262b[_0x93eb('0xd4')]['push']({'name':_0xed334d[_0x93eb('0x1f')],'contentType':_0xed334d[_0x93eb('0x30')],'data':fs[_0x93eb('0xe3')](_0x3bcfeb)});}}}emlformat[_0x93eb('0xe4')](_0x58262b,function(_0x32485e,_0x2a6954){if(_0x32485e)return _0x16b217(_0x32485e);fs[_0x93eb('0xe5')](path['join'](_0x54ba84,util[_0x93eb('0xc6')](_0x93eb('0xe6'),_0x3cc955)),_0x2a6954);return _0x274391(_0x2a6954);});});})[_0x93eb('0x1b')](function(){return new BPromise(function(_0x298104,_0x219f44){zipdir(_0x54ba84,{'saveTo':_0x3311a0},function(_0x30f6d0,_0x182b30){if(_0x30f6d0)return _0x219f44(_0x30f6d0);return _0x298104(_0x182b30);});})[_0x93eb('0x1b')](function(){return new BPromise(function(_0x2c2005,_0x3240f8){rimraf(_0x54ba84,function(_0x1b6710){if(_0x1b6710)_0x3240f8(_0x1b6710);return _0x2c2005();});});})[_0x93eb('0x1b')](function(){return _0x718337[_0x93eb('0xce')](_0x3311a0,_0x332a38,function(_0x4649f5){if(!_0x4649f5)fs[_0x93eb('0xe7')](_0x3311a0);});});});}else{return _0x718337[_0x93eb('0x1d')](0xc8);}})[_0x93eb('0x2c')](handleError(_0x718337,null));}; \ No newline at end of file +var _0x3590=['getMessages','MailInteractionId','format','findAll','inlineCss','true','rows','setTags','omit','spread','mailInteractionTags:save','join','root','transcript-%d-%s.zip','attachments','Attachments','Messages','bcc','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','download','rimraf','zip-dir','moment','bluebird','path','lodash','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','status','end','json','undefined','limit','count','offset','set','Content-Range','destroy','then','sendStatus','error','name','Users','map','fullname','Tags','split','TagIds','MailMessage','findOne','out','plainBody','-id','lastMsgText','catch','index','MailInteraction','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','field','color','from','tools_tags','select','u.id','u.fullname','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','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','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','forEach','MailAccountId','where','i.MailAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.disposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','c.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','enableEmailPreview','push','all','show','params','includeAll','include','options','create','update','body','describe','addMessage','ids'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x3590,0x1db));var _0x0359=function(_0x488653,_0x522f3c){_0x488653=_0x488653-0x0;var _0x35ce4d=_0x3590[_0x488653];return _0x35ce4d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0359('0x0'));var zipdir=require(_0x0359('0x1'));var moment=require(_0x0359('0x2'));var BPromise=require(_0x0359('0x3'));var util=require('util');var path=require(_0x0359('0x4'));var fs=require('fs');var _=require(_0x0359('0x5'));var squel=require('squel');var juice=require(_0x0359('0x6'));var Redis=require(_0x0359('0x7'));var qs=require(_0x0359('0x8'));var as=require(_0x0359('0x9'));var logger=require(_0x0359('0xa'))('api');var config=require(_0x0359('0xb'));var db=require(_0x0359('0xc'))['db'];var htmlEntities=require(_0x0359('0xd'));config[_0x0359('0xe')]=_[_0x0359('0xf')](config[_0x0359('0xe')],{'host':_0x0359('0x10'),'port':0x18eb});var socket=require(_0x0359('0x11'))(new Redis(config[_0x0359('0xe')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x178fc5,_0x317d68){_0x317d68=_0x317d68||0xcc;return function(_0x1ad5af){if(_0x1ad5af){return _0x178fc5['sendStatus'](_0x317d68);}return _0x178fc5[_0x0359('0x12')](_0x317d68)[_0x0359('0x13')]();};}function respondWithResult(_0x467be4,_0x44c810){_0x44c810=_0x44c810||0xc8;return function(_0x237b69){if(_0x237b69){return _0x467be4['status'](_0x44c810)[_0x0359('0x14')](_0x237b69);}};}function respondWithFilteredResult(_0x487cf6,_0x4c25a4){return function(_0x57db26){if(_0x57db26){var _0xb8bd6f=typeof _0x4c25a4['offset']===_0x0359('0x15')&&typeof _0x4c25a4[_0x0359('0x16')]===_0x0359('0x15');var _0x4d6a7d=_0x57db26[_0x0359('0x17')];var _0x4b6bcd=_0xb8bd6f?0x0:_0x4c25a4[_0x0359('0x18')];var _0x565bc2=_0xb8bd6f?_0x57db26[_0x0359('0x17')]:_0x4c25a4[_0x0359('0x18')]+_0x4c25a4[_0x0359('0x16')];var _0x35119e;if(_0x565bc2>=_0x4d6a7d){_0x565bc2=_0x4d6a7d;_0x35119e=0xc8;}else{_0x35119e=0xce;}_0x487cf6[_0x0359('0x12')](_0x35119e);return _0x487cf6[_0x0359('0x19')](_0x0359('0x1a'),_0x4b6bcd+'-'+_0x565bc2+'/'+_0x4d6a7d)['json'](_0x57db26);}return null;};}function saveUpdates(_0x542014){return function(_0x3642f5){if(_0x3642f5){return _0x3642f5['update'](_0x542014)['then'](function(_0x4effd5){return _0x4effd5;});}return null;};}function removeEntity(_0x526149){return function(_0x4fe0ba){if(_0x4fe0ba){return _0x4fe0ba[_0x0359('0x1b')]()[_0x0359('0x1c')](function(){_0x526149[_0x0359('0x12')](0xcc)[_0x0359('0x13')]();});}};}function handleEntityNotFound(_0x4f206d){return function(_0x108ac0){if(!_0x108ac0){_0x4f206d[_0x0359('0x1d')](0x194);}return _0x108ac0;};}function handleError(_0x5749c9,_0xf0e9bb){_0xf0e9bb=_0xf0e9bb||0x1f4;return function(_0x4c617c){logger[_0x0359('0x1e')](_0x4c617c['stack']);if(_0x4c617c[_0x0359('0x1f')]){delete _0x4c617c[_0x0359('0x1f')];}_0x5749c9['status'](_0xf0e9bb)['send'](_0x4c617c);};}function getInteractionUsers(_0x194f94,_0x5dc390){return new BPromise(function(_0x2dde0a,_0x4ae1f9){try{if(_0x5dc390[_0x194f94['id']]){_0x194f94[_0x0359('0x20')]=_[_0x0359('0x21')](_0x5dc390[_0x194f94['id']],function(_0x3d6af2){return{'id':_0x3d6af2['id'],'fullname':_0x3d6af2[_0x0359('0x22')]};});}}catch(_0x36ebfc){_0x4ae1f9(_0x36ebfc);}_0x2dde0a(_0x194f94);});}function getInteractionTags(_0x226308,_0x3dfd30){return new BPromise(function(_0xdabdd3,_0x2e7f5a){try{if(_0x226308['TagIds']){_0x226308[_0x0359('0x23')]=[];_0x226308['TagIds'][_0x0359('0x24')](',')['forEach'](function(_0x41d507){_0x226308[_0x0359('0x23')]['push'](_0x3dfd30[_0x41d507]);});}delete _0x226308[_0x0359('0x25')];}catch(_0x3d37e2){_0x2e7f5a(_0x3d37e2);}_0xdabdd3(_0x226308);});}function getLastMessageText(_0xc1308e){return new BPromise(function(_0x415b78,_0x3759c4){return db[_0x0359('0x26')][_0x0359('0x27')]({'where':{'$and':[{'MailInteractionId':_0xc1308e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0359('0x28')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x0359('0x29')],'order':_0x0359('0x2a'),'raw':!![]})['then'](function(_0x82ddbf){if(_0x82ddbf&&_0x82ddbf[_0x0359('0x29')]){_0xc1308e[_0x0359('0x2b')]=_['trimStart'](_0x82ddbf['plainBody']);}_0x415b78(_0xc1308e);})[_0x0359('0x2c')](function(_0xe00ad5){_0x3759c4(_0xe00ad5);});});}function updateMailInteraction(_0x3036d3,_0x5ad321,_0x3f7c37,_0x42379b){return new BPromise(function(_0x26d636,_0x2b6e8a){return getInteractionUsers(_0x3036d3,_0x3f7c37)['then'](function(_0x17d97d){return getInteractionTags(_0x17d97d,_0x5ad321);})[_0x0359('0x1c')](function(_0x1ac037){if(_0x42379b){_0x26d636(getLastMessageText(_0x1ac037));}else{_0x26d636(_0x1ac037);}})['catch'](function(_0x50c03a){_0x2b6e8a(_0x50c03a);});});}exports[_0x0359('0x2d')]=function(_0x5aee5e,_0x2421e3){var _0x15033b={},_0xb530c2={},_0x24c2c8={'count':0x0,'rows':[]};var _0x3d1a81=_[_0x0359('0x21')](db[_0x0359('0x2e')][_0x0359('0x2f')],function(_0x450716){return{'name':_0x450716[_0x0359('0x30')],'type':_0x450716[_0x0359('0x31')][_0x0359('0x32')]};});_0xb530c2[_0x0359('0x33')]=_[_0x0359('0x21')](_0x3d1a81,_0x0359('0x1f'));_0xb530c2['query']=_[_0x0359('0x34')](_0x5aee5e[_0x0359('0x35')]);_0xb530c2['filters']=_['intersection'](_0xb530c2[_0x0359('0x33')],_0xb530c2[_0x0359('0x35')]);_0x15033b[_0x0359('0x36')]=_[_0x0359('0x37')](_0xb530c2[_0x0359('0x33')],qs[_0x0359('0x38')](_0x5aee5e[_0x0359('0x35')][_0x0359('0x38')]));_0x15033b[_0x0359('0x36')]=_0x15033b[_0x0359('0x36')][_0x0359('0x39')]?_0x15033b[_0x0359('0x36')]:_0xb530c2[_0x0359('0x33')];if(!_0x5aee5e['query'][_0x0359('0x3a')](_0x0359('0x3b'))){_0x15033b['limit']=qs[_0x0359('0x16')](_0x5aee5e[_0x0359('0x35')][_0x0359('0x16')]);_0x15033b[_0x0359('0x18')]=qs[_0x0359('0x18')](_0x5aee5e[_0x0359('0x35')][_0x0359('0x18')]);}_0x15033b[_0x0359('0x3c')]=qs[_0x0359('0x3d')](_0x5aee5e['query'][_0x0359('0x3d')]);_0x15033b['where']=qs['filters'](_[_0x0359('0x3e')](_0x5aee5e[_0x0359('0x35')],_0xb530c2[_0x0359('0x3f')]),_0x3d1a81);var _0x471e64=[];var _0x5225c1=squel['select']()[_0x0359('0x40')]('id')[_0x0359('0x40')](_0x0359('0x1f'))[_0x0359('0x40')](_0x0359('0x41'))[_0x0359('0x42')](_0x0359('0x43'));var _0x3ccb22=squel[_0x0359('0x44')]()[_0x0359('0x40')](_0x0359('0x45'))[_0x0359('0x40')](_0x0359('0x46'))[_0x0359('0x40')]('ui.MailInteractionId')[_0x0359('0x42')](_0x0359('0x47'),'ui')[_0x0359('0x48')]('users','u',_0x0359('0x49'));var _0x215b8d=squel[_0x0359('0x44')]()[_0x0359('0x42')](_0x0359('0x4a'),'i')['left_join'](_0x0359('0x4b'),'c',_0x0359('0x4c'))[_0x0359('0x48')](_0x0359('0x4d'),'o',_0x0359('0x4e'))[_0x0359('0x48')]('mail_accounts','a','a.id\x20=\x20i.MailAccountId')['left_join'](_0x0359('0x4f'),'me',_0x0359('0x50'))[_0x0359('0x48')]('mail_interaction_has_tags','it',_0x0359('0x51'))[_0x0359('0x48')](_0x0359('0x43'),'t',_0x0359('0x52'));var _0x1338ce=squel['expr']();var _0x3367c6=[];var _0x1c04ad=squel[_0x0359('0x53')]();var _0x3c11ed;if(_0x5aee5e[_0x0359('0x35')][_0x0359('0x54')]){_0x3c11ed=as[_0x0359('0x55')](_0x5aee5e[_0x0359('0x35')]['search']);var _0x4fa360=_0x3c11ed['sqlOperator'];for(var _0x56bbd2=0x0;_0x56bbd2<_0x3c11ed[_0x0359('0x56')][_0x0359('0x39')];_0x56bbd2++){var _0x3b30b8=_0x3c11ed[_0x0359('0x56')][_0x56bbd2];var _0x741e2='i';var _0x520f51=_[_0x0359('0x57')](_0x3d1a81,[_0x0359('0x1f'),_0x3b30b8[_0x0359('0x40')]]);if(!_0x520f51){switch(_0x3b30b8[_0x0359('0x40')]){case _0x0359('0x58'):if(_0x3b30b8['value']==0x1){_0x215b8d[_0x0359('0x59')]('`'+_0x3b30b8['field']+'`\x20=\x200');}else{_0x215b8d[_0x0359('0x59')]('`'+_0x3b30b8['field']+_0x0359('0x5a'));}break;case _0x0359('0x5b'):if(_0x3b30b8[_0x0359('0x5c')]===_0x0359('0x5d')){if(_0x3b30b8[_0x0359('0x5e')][_0x0359('0x24')]('\x20')[_0x0359('0x39')]>0x1){_0x1338ce[_0x4fa360](_0x0359('0x5f'),qs[_0x0359('0x60')](_0x3b30b8['value']),null);}else{var _0x2c9dd5='%'+_0x3b30b8[_0x0359('0x5e')]+'%';_0x1338ce[_0x4fa360]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2c9dd5,_0x2c9dd5,_0x2c9dd5);}}else{_0x520f51=_[_0x0359('0x57')](_0x3d1a81,[_0x0359('0x1f'),_0x0359('0x61')]);_0x3b30b8[_0x0359('0x40')]=_0x0359('0x61');_0x47c6c6=as[_0x0359('0x62')](_0x741e2,_0x520f51[_0x0359('0x31')],_0x3b30b8);_0x1338ce[_0x4fa360](_0x47c6c6[_0x0359('0x63')],_0x47c6c6[_0x0359('0x5e')][_0x0359('0x64')],_0x47c6c6['value'][_0x0359('0x13')]);}break;case _0x0359('0x65'):var _0x335029=_0x3b30b8['value'][_0x0359('0x24')](',')[_0x0359('0x21')](function(_0x3cc495){return Number(_0x3cc495);});_0x335029['forEach'](function(_0x5cdc2f){_0x1c04ad['or'](_0x0359('0x66'),'%,'+_0x5cdc2f+',%');});_0x3367c6=_['union'](_0x3367c6,_0x335029);break;case _0x0359('0x67'):if(_0x3b30b8[_0x0359('0x5c')]===_0x0359('0x5d')){_0x1338ce[_0x4fa360](_0x0359('0x68'),'%'+_0x3b30b8[_0x0359('0x5e')]+'%',null);}else{_0x520f51=_[_0x0359('0x57')](_0x3d1a81,['name',_0x0359('0x69')]);_0x3b30b8[_0x0359('0x40')]=_0x0359('0x69');_0x47c6c6=as[_0x0359('0x62')](_0x741e2,_0x520f51[_0x0359('0x31')],_0x3b30b8);_0x1338ce[_0x4fa360](_0x47c6c6['text'],_0x47c6c6[_0x0359('0x5e')][_0x0359('0x64')],_0x47c6c6[_0x0359('0x5e')][_0x0359('0x13')]);}break;case _0x0359('0x29'):_0x47c6c6=as[_0x0359('0x62')]('me',null,_0x3b30b8);_0x1338ce[_0x4fa360](_0x47c6c6['text'],_0x47c6c6[_0x0359('0x5e')][_0x0359('0x64')],_0x47c6c6['value'][_0x0359('0x13')]);break;}}else{var _0x47c6c6=as[_0x0359('0x62')](_0x741e2,_0x520f51[_0x0359('0x31')],_0x3b30b8);_0x1338ce[_0x4fa360](_0x47c6c6[_0x0359('0x63')],_0x47c6c6[_0x0359('0x5e')][_0x0359('0x64')],_0x47c6c6['value'][_0x0359('0x13')]);}}}else{var _0x476b08=_(_0x5aee5e['query'])[_0x0359('0x34')]()['map'](function(_0x3f185b){return _[_0x0359('0x6a')](_0x3d1a81,[_0x0359('0x1f'),_0x3f185b])?_0x3f185b:undefined;})[_0x0359('0x6b')]()[_0x0359('0x5e')]();if(!_[_0x0359('0x6c')](_0x476b08)){_0x476b08[_0x0359('0x6d')](function(_0xe60008){if(_0xe60008===_0x0359('0x6e')){_0x215b8d[_0x0359('0x6f')](_0x0359('0x70'),[]['concat'](_0x5aee5e[_0x0359('0x35')][_0xe60008]));}else if(_0xe60008===_0x0359('0x71')){var _0x554cd6=JSON[_0x0359('0x72')](_0x5aee5e[_0x0359('0x35')][_0xe60008])[_0x0359('0x73')];var _0x53ae0e=JSON['parse'](_0x5aee5e[_0x0359('0x35')][_0xe60008])['$lte'];_0x215b8d[_0x0359('0x6f')](_0x0359('0x74'),_0x554cd6,_0x53ae0e);}else{if(_0x5aee5e['query'][_0xe60008]===_0x0359('0x75')){_0x215b8d[_0x0359('0x6f')]('i.'+_0xe60008+_0x0359('0x76'));}else{_0x215b8d['where']('i.'+_0xe60008+_0x0359('0x77'),_0x5aee5e[_0x0359('0x35')][_0xe60008]);}}});}if(_0x5aee5e[_0x0359('0x35')]['read']){if(_0x5aee5e[_0x0359('0x35')][_0x0359('0x78')]==0x1){_0x215b8d[_0x0359('0x59')](_0x0359('0x79'));}else{_0x215b8d[_0x0359('0x59')]('`unreadMessages`\x20>\x200');}}if(_0x5aee5e[_0x0359('0x35')][_0x0359('0x7a')]){_0x3367c6=_['isArray'](_0x5aee5e[_0x0359('0x35')][_0x0359('0x7a')])?_0x5aee5e[_0x0359('0x35')]['tag']:new Array(_0x5aee5e[_0x0359('0x35')][_0x0359('0x7a')]);_0x3367c6['forEach'](function(_0x236a65){_0x1c04ad['or'](_0x0359('0x66'),'%,'+_0x236a65+',%');});}if(_0x5aee5e[_0x0359('0x35')][_0x0359('0x7b')]){var _0x37ce65=_0x5aee5e['query'][_0x0359('0x7b')][_0x0359('0x7c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x0359('0x7d')](_0x37ce65)){_0x1338ce['or']('i.id\x20LIKE\x20?',_0x37ce65+'%');}else if(qs['isEmail'](_0x37ce65)){_0x1338ce['or'](_0x0359('0x7e'),_0x37ce65+'%');}else{_0x1338ce['or'](_0x0359('0x7f'),qs[_0x0359('0x60')](_0x37ce65))['or'](_0x0359('0x80'),qs[_0x0359('0x60')](_0x37ce65));}}}_0x215b8d[_0x0359('0x6f')](_0x1338ce);_0x215b8d[_0x0359('0x81')](_0x0359('0x82'));var _0x5d537b={'type':db[_0x0359('0x83')][_0x0359('0x84')][_0x0359('0x85')],'raw':!![]};var _0x35c357=_0x215b8d['clone']();_0x35c357['field']('i.id');_0x35c357['field'](_0x0359('0x86'),'unreadMessages');if(_0x15033b[_0x0359('0x3c')]){_0x15033b['order'][_0x0359('0x6d')](function(_0x40849b){var _0xb476d3=_0x40849b[0x0]===_0x0359('0x87')?_0x40849b[0x0]:'i.'+_0x40849b[0x0];_0x215b8d['order'](_0xb476d3,_0x40849b[0x1]===_0x0359('0x88')?![]:!![]);});}if(!_[_0x0359('0x6c')](_0x3367c6)){_0x215b8d[_0x0359('0x59')](_0x1c04ad);_0x35c357['where'](_0x0359('0x89'),_0x3367c6);}BPromise[_0x0359('0x8a')]()['then'](function(){if(!_0x3c11ed){if(_0x5aee5e[_0x0359('0x35')][_0x0359('0x6e')])return;_0x35c357[_0x0359('0x6f')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x215b8d[_0x0359('0x6f')](_0x0359('0x8b'));return;}if(_0x5aee5e['user'][_0x0359('0x8c')]!==_0x0359('0x8d'))return;return _0x5aee5e[_0x0359('0x8e')][_0x0359('0x8f')]({'attributes':['id'],'raw':!![]})[_0x0359('0x1c')](function(_0x71b26d){if(_['isEmpty'](_0x71b26d)){_0x35c357['where'](_0x0359('0x90'));_0x215b8d[_0x0359('0x6f')](_0x0359('0x90'));}else{_0x35c357[_0x0359('0x6f')](_0x0359('0x70'),_[_0x0359('0x21')](_0x71b26d,'id'));_0x215b8d[_0x0359('0x6f')]('i.MailAccountId\x20IN\x20?',_['map'](_0x71b26d,'id'));}});})['then'](function(){if(_0x5aee5e[_0x0359('0x8e')][_0x0359('0x8c')]===_0x0359('0x8d')&&!_0x3c11ed&&!_0x5aee5e[_0x0359('0x35')]['MailAccountId'])return[];return db[_0x0359('0x91')][_0x0359('0x35')](_0x35c357[_0x0359('0x92')](),_0x5d537b);})['then'](function(_0x1e8809){_0x24c2c8['count']=_0x1e8809[_0x0359('0x39')];if(_0x24c2c8[_0x0359('0x17')]===0x0)return[];return db[_0x0359('0x91')][_0x0359('0x35')](_0x5225c1[_0x0359('0x92')](),_0x5d537b)[_0x0359('0x1c')](function(_0x4aa3e4){_0x471e64=_['keyBy'](_0x4aa3e4,'id');_0x5d537b=_[_0x0359('0x93')](_0x5d537b,{'model':db[_0x0359('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5aee5e[_0x0359('0x35')][_0x0359('0x38')]){_0x15033b[_0x0359('0x36')][_0x0359('0x6d')](function(_0x132bbb){_0x215b8d[_0x0359('0x40')]('i.'+_0x132bbb);});}else{_0x215b8d['field'](_0x0359('0x86'),_0x0359('0x58'));_0x215b8d['field'](_0x0359('0x94'),_0x0359('0x95'));_0x215b8d[_0x0359('0x40')](_0x0359('0x96'),_0x0359('0x97'));_0x215b8d['field'](_0x0359('0x98'),_0x0359('0x87'));_0x215b8d['field']('i.id');_0x215b8d[_0x0359('0x40')](_0x0359('0x99'));_0x215b8d[_0x0359('0x40')](_0x0359('0x9a'));_0x215b8d['field'](_0x0359('0x9b'));_0x215b8d[_0x0359('0x40')](_0x0359('0x9c'));_0x215b8d[_0x0359('0x40')](_0x0359('0x9d'));_0x215b8d[_0x0359('0x40')](_0x0359('0x9e'));_0x215b8d[_0x0359('0x40')]('i.lastMsgDirection');_0x215b8d['field']('i.subject');_0x215b8d[_0x0359('0x40')](_0x0359('0x9f'));_0x215b8d[_0x0359('0x40')]('i.secondDisposition');_0x215b8d[_0x0359('0x40')](_0x0359('0xa0'));_0x215b8d[_0x0359('0x40')]('i.substatus');_0x215b8d['field'](_0x0359('0xa1'));_0x215b8d['field'](_0x0359('0xa2'));_0x215b8d['field'](_0x0359('0xa3'));_0x215b8d['field'](_0x0359('0xa4'));_0x215b8d['field']('c.firstName','Contact.firstName');_0x215b8d['field'](_0x0359('0xa5'),_0x0359('0xa6'));_0x215b8d[_0x0359('0x40')]('c.email',_0x0359('0xa7'));_0x215b8d[_0x0359('0x40')]('c.phone',_0x0359('0xa8'));_0x215b8d[_0x0359('0x40')](_0x0359('0xa9'),'Contact.mobile');_0x215b8d['field'](_0x0359('0xaa'),'Contact.fax');_0x215b8d[_0x0359('0x40')](_0x0359('0xab'),'Owner.fullname');_0x215b8d[_0x0359('0x40')]('o.internal',_0x0359('0xac'));_0x215b8d[_0x0359('0x40')](_0x0359('0xad'),_0x0359('0x25'));}if(_0x15033b[_0x0359('0x16')])_0x215b8d[_0x0359('0x16')](_0x15033b['limit']);if(_0x15033b[_0x0359('0x18')])_0x215b8d['offset'](_0x15033b[_0x0359('0x18')]);return db[_0x0359('0x91')][_0x0359('0x35')](_0x215b8d[_0x0359('0x92')](),_0x5d537b);})[_0x0359('0x1c')](function(_0x20f52a){if(_0x20f52a[_0x0359('0x39')]>0x0)_0x3ccb22[_0x0359('0x6f')](_0x0359('0xae'),_[_0x0359('0x21')](_0x20f52a,'id'));return db[_0x0359('0x91')][_0x0359('0x35')](_0x3ccb22['toString'](),_0x5d537b)[_0x0359('0x1c')](function(_0x5cda29){var _0x34e04e=_[_0x0359('0xaf')](_0x5cda29,'MailInteractionId');var _0x2059f8=[];return db[_0x0359('0xb0')][_0x0359('0x27')]({'attributes':[_0x0359('0xb1')],'raw':!![]})[_0x0359('0x1c')](function(_0x3ecc38){var _0x1e1b5c=_0x3ecc38['enableEmailPreview'];_0x20f52a[_0x0359('0x6d')](function(_0x58ea70){_0x2059f8[_0x0359('0xb2')](updateMailInteraction(_0x58ea70,_0x471e64,_0x34e04e,_0x1e1b5c));});return BPromise[_0x0359('0xb3')](_0x2059f8);});});});})['then'](function(_0x4b6061){_0x24c2c8['rows']=_0x4b6061;return _0x24c2c8;})[_0x0359('0x1c')](respondWithFilteredResult(_0x2421e3,_0x15033b))[_0x0359('0x2c')](handleError(_0x2421e3,null));};exports[_0x0359('0xb4')]=function(_0x5460b3,_0x373a44){var _0x402e21={'raw':![],'where':{'id':_0x5460b3[_0x0359('0xb5')]['id']}},_0x5e422a={};_0x5e422a[_0x0359('0x33')]=_[_0x0359('0x34')](db['MailInteraction'][_0x0359('0x2f')]);_0x5e422a[_0x0359('0x35')]=_[_0x0359('0x34')](_0x5460b3[_0x0359('0x35')]);_0x5e422a[_0x0359('0x3f')]=_[_0x0359('0x37')](_0x5e422a['model'],_0x5e422a[_0x0359('0x35')]);_0x402e21[_0x0359('0x36')]=_[_0x0359('0x37')](_0x5e422a[_0x0359('0x33')],qs[_0x0359('0x38')](_0x5460b3[_0x0359('0x35')][_0x0359('0x38')]));_0x402e21[_0x0359('0x36')]=_0x402e21[_0x0359('0x36')][_0x0359('0x39')]?_0x402e21[_0x0359('0x36')]:_0x5e422a[_0x0359('0x33')];if(_0x5460b3[_0x0359('0x35')][_0x0359('0xb6')]){_0x402e21[_0x0359('0xb7')]=[{'all':!![]}];}_0x402e21=_['merge']({},_0x402e21,_0x5460b3[_0x0359('0xb8')]);return db[_0x0359('0x2e')][_0x0359('0x57')](_0x402e21)[_0x0359('0x1c')](handleEntityNotFound(_0x373a44,null))[_0x0359('0x1c')](respondWithResult(_0x373a44,null))[_0x0359('0x2c')](handleError(_0x373a44,null));};exports[_0x0359('0xb9')]=function(_0x2cb3d9,_0x514e67){return db['MailInteraction'][_0x0359('0xb9')](_0x2cb3d9['body'],{})[_0x0359('0x1c')](respondWithResult(_0x514e67,0xc9))[_0x0359('0x2c')](handleError(_0x514e67,null));};exports[_0x0359('0xba')]=function(_0x1bacf4,_0x5cd1d3){if(_0x1bacf4[_0x0359('0xbb')]['id']){delete _0x1bacf4[_0x0359('0xbb')]['id'];}return db[_0x0359('0x2e')][_0x0359('0x57')]({'where':{'id':_0x1bacf4[_0x0359('0xb5')]['id']}})['then'](handleEntityNotFound(_0x5cd1d3,null))[_0x0359('0x1c')](saveUpdates(_0x1bacf4[_0x0359('0xbb')],null))[_0x0359('0x1c')](respondWithResult(_0x5cd1d3,null))[_0x0359('0x2c')](handleError(_0x5cd1d3,null));};exports['destroy']=function(_0x538559,_0x25159d){return db[_0x0359('0x2e')][_0x0359('0x57')]({'where':{'id':_0x538559['params']['id']}})[_0x0359('0x1c')](handleEntityNotFound(_0x25159d,null))[_0x0359('0x1c')](removeEntity(_0x25159d,null))[_0x0359('0x2c')](handleError(_0x25159d,null));};exports[_0x0359('0xbc')]=function(_0x12f96c,_0x2a88b3){return db['MailInteraction']['describe']()[_0x0359('0x1c')](respondWithResult(_0x2a88b3,null))[_0x0359('0x2c')](handleError(_0x2a88b3,null));};exports[_0x0359('0xbd')]=function(_0x27dd50,_0x531358){return db[_0x0359('0x26')][_0x0359('0x57')]({'where':{'id':_0x27dd50[_0x0359('0xb5')]['id']}})['then'](handleEntityNotFound(_0x531358,null))['then'](function(_0x3766f7){if(_0x3766f7){return _0x3766f7[_0x0359('0xbd')](_0x27dd50['body'][_0x0359('0xbe')],_['omit'](_0x27dd50[_0x0359('0xbb')],['ids','id'])||{});}})[_0x0359('0x1c')](respondWithResult(_0x531358,null))[_0x0359('0x2c')](handleError(_0x531358,null));};exports[_0x0359('0xbf')]=function(_0xd5bbc8,_0x487caa){var _0x3016d7={'raw':![],'where':{}};var _0x4db9dc={};var _0x2a4dfd={'count':0x0,'rows':[]};return db[_0x0359('0x2e')][_0x0359('0x27')]({'where':{'id':_0xd5bbc8[_0x0359('0xb5')]['id']}})[_0x0359('0x1c')](handleEntityNotFound(_0x487caa,null))[_0x0359('0x1c')](function(_0xd836cd){if(_0xd836cd){_0x4db9dc[_0x0359('0x33')]=_['keys'](db[_0x0359('0x26')][_0x0359('0x2f')]);_0x4db9dc[_0x0359('0x35')]=_[_0x0359('0x34')](_0xd5bbc8[_0x0359('0x35')]);_0x4db9dc[_0x0359('0x3f')]=_[_0x0359('0x37')](_0x4db9dc[_0x0359('0x33')],_0x4db9dc[_0x0359('0x35')]);_0x3016d7[_0x0359('0x36')]=_[_0x0359('0x37')](_0x4db9dc['model'],qs[_0x0359('0x38')](_0xd5bbc8[_0x0359('0x35')][_0x0359('0x38')]));_0x3016d7[_0x0359('0x36')]=_0x3016d7['attributes']['length']?_0x3016d7[_0x0359('0x36')]:_0x4db9dc['model'];if(!_0xd5bbc8[_0x0359('0x35')]['hasOwnProperty']('nolimit')){_0x3016d7[_0x0359('0x16')]=qs[_0x0359('0x16')](_0xd5bbc8[_0x0359('0x35')]['limit']);_0x3016d7[_0x0359('0x18')]=qs['offset'](_0xd5bbc8[_0x0359('0x35')][_0x0359('0x18')]);}_0x3016d7[_0x0359('0x3c')]=qs[_0x0359('0x3d')](_0xd5bbc8[_0x0359('0x35')]['sort']);_0x3016d7[_0x0359('0x6f')]=qs[_0x0359('0x3f')](_[_0x0359('0x3e')](_0xd5bbc8[_0x0359('0x35')],_0x4db9dc[_0x0359('0x3f')]));_0x3016d7[_0x0359('0x6f')][_0x0359('0xc0')]=_0xd836cd['id'];if(_0xd5bbc8[_0x0359('0x35')][_0x0359('0x7b')]){_0x3016d7['where']=_[_0x0359('0x93')](_0x3016d7[_0x0359('0x6f')],{'$or':_['map'](_0x3016d7[_0x0359('0x36')],function(_0x152356){var _0x5cfd21={};_0x5cfd21[_0x152356]={'$like':'%'+_0xd5bbc8[_0x0359('0x35')]['filter']+'%'};return _0x5cfd21;})});}if(_0xd5bbc8[_0x0359('0x35')][_0x0359('0x73')]){var _0xd2605=_0xd5bbc8[_0x0359('0x35')][_0x0359('0x73')][_0x0359('0x24')](',');var _0x58cf95={};_0x58cf95[_0xd2605[0x0]]={'$gte':moment(_0xd2605[0x1])[_0x0359('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3016d7[_0x0359('0x6f')]=_['merge'](_0x3016d7[_0x0359('0x6f')],_0x58cf95);}_0x3016d7=_['merge']({},_0x3016d7,_0xd5bbc8[_0x0359('0xb8')]);return db[_0x0359('0x26')]['count']({'where':_0x3016d7[_0x0359('0x6f')]})['then'](function(_0x21f325){_0x2a4dfd[_0x0359('0x17')]=_0x21f325;if(_0xd5bbc8[_0x0359('0x35')]['includeAll']){_0x3016d7[_0x0359('0xb7')]=[{'all':!![]}];}return db[_0x0359('0x26')][_0x0359('0xc2')](_0x3016d7);})[_0x0359('0x1c')](function(_0x527216){if(_0xd5bbc8[_0x0359('0x35')][_0x0359('0xc3')]===_0x0359('0xc4')){for(var _0x5b88d2=0x0;_0x5b88d2<_0x527216[_0x0359('0x39')];_0x5b88d2++){_0x527216[_0x5b88d2]['body']=juice(_0x527216[_0x5b88d2][_0x0359('0xbb')]);}}_0x2a4dfd[_0x0359('0xc5')]=_0x527216;return _0x2a4dfd;});}})[_0x0359('0x1c')](respondWithFilteredResult(_0x487caa,_0x3016d7))['catch'](handleError(_0x487caa,null));};exports['addTags']=function(_0x1d4c6e,_0x15eab5){return db[_0x0359('0x2e')][_0x0359('0x57')]({'where':{'id':_0x1d4c6e['params']['id']}})[_0x0359('0x1c')](handleEntityNotFound(_0x15eab5,null))[_0x0359('0x1c')](function(_0x262768){if(_0x262768){return _0x262768[_0x0359('0xc6')](_0x1d4c6e['body']['ids'],_[_0x0359('0xc7')](_0x1d4c6e[_0x0359('0xbb')],['ids','id'])||{})[_0x0359('0xc8')](function(){return db['Tag'][_0x0359('0xc2')]({'attributes':['id',_0x0359('0x1f'),'color'],'where':{'id':_0x1d4c6e[_0x0359('0xbb')][_0x0359('0xbe')]}});})[_0x0359('0x1c')](function(_0x301b6d){socket['emit'](_0x0359('0xc9'),{'id':Number(_0x1d4c6e[_0x0359('0xb5')]['id']),'tags':_0x301b6d||[]});return{'id':Number(_0x1d4c6e[_0x0359('0xb5')]['id']),'tags':_0x301b6d||[]};});}})[_0x0359('0x1c')](respondWithResult(_0x15eab5,null))['catch'](handleError(_0x15eab5,null));};exports['removeTags']=function(_0x1a8e36,_0x24928a){return db[_0x0359('0x2e')]['find']({'where':{'id':_0x1a8e36['params']['id']}})['then'](handleEntityNotFound(_0x24928a,null))[_0x0359('0x1c')](function(_0x69ab6c){if(_0x69ab6c){return _0x69ab6c['removeTags'](_0x1a8e36['query']['ids']);}})[_0x0359('0x1c')](respondWithStatusCode(_0x24928a,null))['catch'](handleError(_0x24928a,null));};exports['download']=function(_0x208282,_0x23aa76){var _0x197e9f=moment()['unix']()['toString']();var _0x374d2d=path[_0x0359('0xca')](config[_0x0359('0xcb')],'server','files','tmp');var _0x4cd6b0=path[_0x0359('0xca')](config['root'],'server','files','attachments');var _0x409af8=path[_0x0359('0xca')](_0x374d2d,_0x197e9f);var _0x1389a3=util[_0x0359('0xc1')](_0x0359('0xcc'),_0x208282[_0x0359('0xb5')]['id'],_0x197e9f);var _0x187e3e=path['join'](_0x374d2d,_0x1389a3);var _0x413c5f=[];if(_0x208282['query'][_0x0359('0xcd')]){_0x413c5f[_0x0359('0xb2')]({'model':db['Attachment'],'as':_0x0359('0xce'),'raw':!![]});}var _0xa06854=[{'model':db[_0x0359('0x26')],'as':_0x0359('0xcf'),'attributes':['id',_0x0359('0xbb'),_0x0359('0x42'),'to','cc',_0x0359('0xd0'),'subject',_0x0359('0x71')],'where':{'secret':![]},'order':qs[_0x0359('0x3d')]('id'),'include':_0x413c5f}];return db[_0x0359('0x2e')][_0x0359('0x57')]({'where':{'id':_0x208282[_0x0359('0xb5')]['id']},'include':_0xa06854})['then'](handleEntityNotFound(_0x23aa76,null))[_0x0359('0x1c')](function(_0x37c11c){if(_0x37c11c&&_0x37c11c[_0x0359('0xcf')]){var _0x28e8f5=_0x37c11c[_0x0359('0xd1')]({'plain':!![]});fs[_0x0359('0xd2')](_0x409af8);return BPromise[_0x0359('0xd3')](_0x28e8f5[_0x0359('0xcf')],function(_0x5b3549,_0x2ca2b1){var _0xcf5dfd={'from':_0x5b3549[_0x0359('0x42')],'to':_0x5b3549['to'],'subject':_0x5b3549['subject'],'html':htmlEntities[_0x0359('0xd4')](_0x5b3549[_0x0359('0xbb')]),'headers':{'Date':moment(_0x5b3549['createdAt'])[_0x0359('0xc1')](_0x0359('0xd5'))},'attachments':[]};if(_0x5b3549['cc']){_0xcf5dfd[_0x0359('0xd6')]['Cc']=_0x5b3549['cc'];}if(_0x5b3549[_0x0359('0xd0')]){_0xcf5dfd[_0x0359('0xd6')][_0x0359('0xd7')]=_0x5b3549[_0x0359('0xd0')];}return new BPromise(function(_0x325891,_0x42cff7){if(_0x5b3549[_0x0359('0xce')]){for(var _0x24aced=0x0;_0x24aced<_0x5b3549['Attachments']['length'];_0x24aced++){var _0x5cc3ba=_0x5b3549[_0x0359('0xce')][_0x24aced];var _0x97e14a=path['join'](_0x4cd6b0,_0x5cc3ba[_0x0359('0xd8')]);if(fs[_0x0359('0xd9')](_0x97e14a)){_0xcf5dfd[_0x0359('0xcd')][_0x0359('0xb2')]({'name':_0x5cc3ba[_0x0359('0x1f')],'contentType':_0x5cc3ba[_0x0359('0x31')],'data':fs[_0x0359('0xda')](_0x97e14a)});}}}emlformat['build'](_0xcf5dfd,function(_0x3c701c,_0x81e784){if(_0x3c701c)return _0x42cff7(_0x3c701c);fs[_0x0359('0xdb')](path[_0x0359('0xca')](_0x409af8,util[_0x0359('0xc1')](_0x0359('0xdc'),_0x2ca2b1)),_0x81e784);return _0x325891(_0x81e784);});});})[_0x0359('0x1c')](function(){return new BPromise(function(_0x2f4c77,_0x3d8dbd){zipdir(_0x409af8,{'saveTo':_0x187e3e},function(_0x2ebeea,_0x324a2c){if(_0x2ebeea)return _0x3d8dbd(_0x2ebeea);return _0x2f4c77(_0x324a2c);});})[_0x0359('0x1c')](function(){return new BPromise(function(_0x475a6b,_0x30890c){rimraf(_0x409af8,function(_0x3b3d5b){if(_0x3b3d5b)_0x30890c(_0x3b3d5b);return _0x475a6b();});});})[_0x0359('0x1c')](function(){return _0x23aa76[_0x0359('0xdd')](_0x187e3e,_0x1389a3,function(_0x5e414b){if(!_0x5e414b)fs['unlinkSync'](_0x187e3e);});});});}else{return _0x23aa76['sendStatus'](0xc8);}})[_0x0359('0x2c')](handleError(_0x23aa76,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 87afb5d..5fa3358 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 _0x2c1f=['exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','getUsers','then','setDataValue','Users','map','findAll','length','hasOwnProperty','hook'];(function(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0x2c1f,0x13c));var _0xf2c1=function(_0xf7a791,_0x413cb1){_0xf7a791=_0xf7a791-0x0;var _0x4116e3=_0x2c1f[_0xf7a791];return _0x4116e3;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xf2c1('0x0'))['db'][_0xf2c1('0x1')];var MailMessage=require(_0xf2c1('0x0'))['db'][_0xf2c1('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf2c1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf2c1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x9a1942){return function(_0x260b87,_0x15d377,_0x45d2d1){_0x260b87[_0xf2c1('0x5')]({'attributes':['id'],'raw':!![]})[_0xf2c1('0x6')](function(_0x3f86a0){_0x260b87[_0xf2c1('0x7')](_0xf2c1('0x8'),_0x3f86a0[_0xf2c1('0x9')](function(_0x5d3e06){return{'id':_0x5d3e06['id']};}));return MailMessage[_0xf2c1('0xa')]({'where':{'MailInteractionId':_0x260b87['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2c8663){_0x260b87[_0xf2c1('0x7')]('unreadMessages',_0x2c8663[_0xf2c1('0xb')]);MailInteractionEvents['emit'](_0x9a1942+':'+_0x260b87['id'],_0x260b87);MailInteractionEvents['emit'](_0x9a1942,_0x260b87);_0x45d2d1(null);})['catch'](_0x45d2d1(null));};}for(var e in events){if(events[_0xf2c1('0xc')](e)){var event=events[e];MailInteraction[_0xf2c1('0xd')](e,emitEvent(event));}}module[_0xf2c1('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0x9353=['emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','setMaxListeners','update','remove','getUsers','then','setDataValue','map','findAll','length'];(function(_0x39168b,_0x875fa3){var _0x47a5f6=function(_0x578800){while(--_0x578800){_0x39168b['push'](_0x39168b['shift']());}};_0x47a5f6(++_0x875fa3);}(_0x9353,0x154));var _0x3935=function(_0x4d1324,_0x3f7b0d){_0x4d1324=_0x4d1324-0x0;var _0x5e6bf0=_0x9353[_0x4d1324];return _0x5e6bf0;};'use strict';var EventEmitter=require(_0x3935('0x0'));var MailInteraction=require(_0x3935('0x1'))['db'][_0x3935('0x2')];var MailMessage=require(_0x3935('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3935('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3935('0x4'),'afterDestroy':_0x3935('0x5')};function emitEvent(_0x511884){return function(_0x36aeda,_0x5e2a30,_0xb23583){_0x36aeda[_0x3935('0x6')]({'attributes':['id'],'raw':!![]})[_0x3935('0x7')](function(_0x58d12b){_0x36aeda[_0x3935('0x8')]('Users',_0x58d12b[_0x3935('0x9')](function(_0x5d9b7f){return{'id':_0x5d9b7f['id']};}));return MailMessage[_0x3935('0xa')]({'where':{'MailInteractionId':_0x36aeda['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3935('0x7')](function(_0x25bfb0){_0x36aeda[_0x3935('0x8')]('unreadMessages',_0x25bfb0[_0x3935('0xb')]);MailInteractionEvents[_0x3935('0xc')](_0x511884+':'+_0x36aeda['id'],_0x36aeda);MailInteractionEvents[_0x3935('0xc')](_0x511884,_0x36aeda);_0xb23583(null);})[_0x3935('0xd')](_0xb23583(null));};}for(var e in events){if(events[_0x3935('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x3935('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 1d2c48e..5c80fca 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 _0x0ee8=['closed','closedAt','changed','substatus','get','MailMessage','update','then','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','rimraf','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x31f7b9,_0x5be72c){var _0xa304fb=function(_0x205efc){while(--_0x205efc){_0x31f7b9['push'](_0x31f7b9['shift']());}};_0xa304fb(++_0x5be72c);}(_0x0ee8,0x180));var _0x80ee=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0ee8[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x80ee('0x0'));var util=require('util');var logger=require(_0x80ee('0x1'))(_0x80ee('0x2'));var moment=require(_0x80ee('0x3'));var BPromise=require(_0x80ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x80ee('0x5'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x80ee('0x6')]=function(_0x314609,_0x4a084f){return _0x314609[_0x80ee('0x7')](_0x80ee('0x8'),attributes,{'tableName':_0x80ee('0x9'),'paranoid':![],'indexes':[{'name':_0x80ee('0xa'),'fields':[_0x80ee('0xb'),'to'],'type':_0x80ee('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x21e60c,_0x5761ca,_0x2b8fc4){if(_0x21e60c['substatus']){_0x21e60c[_0x80ee('0xd')]=moment()[_0x80ee('0xe')](_0x80ee('0xf'));}if(_0x21e60c[_0x80ee('0x10')]){_0x21e60c[_0x80ee('0x11')]=moment()['format'](_0x80ee('0xf'));}_0x2b8fc4(null,_0x5761ca);},'beforeUpdate':function(_0x40b798,_0x115904,_0x2c7102){if(_0x40b798[_0x80ee('0x12')]('substatus')){_0x40b798[_0x80ee('0xd')]=_0x40b798[_0x80ee('0x13')]?moment()[_0x80ee('0xe')](_0x80ee('0xf')):null;}if(_0x40b798[_0x80ee('0x12')](_0x80ee('0x10'))){_0x40b798[_0x80ee('0x11')]=moment()[_0x80ee('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x40b798[_0x80ee('0x13')]=null;_0x40b798[_0x80ee('0xd')]=null;}_0x2c7102(null,_0x40b798);},'afterUpdate':function(_0x29aeeb,_0x252902,_0x233e01){var _0x877642=_0x314609['models'];var _0x550468=_0x29aeeb[_0x80ee('0x14')]({'plain':!![]});if(_0x550468[_0x80ee('0x10')]){return _0x877642[_0x80ee('0x15')][_0x80ee('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x550468['id']}})[_0x80ee('0x17')](function(){_0x233e01();})['catch'](function(_0x3d4d06){_0x233e01(_0x3d4d06);});}else{_0x233e01();}}},'charset':'utf8mb4','collate':_0x80ee('0x18')});}; \ No newline at end of file +var _0x472b=['YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','MailMessage','update','then','catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','subject','FULLTEXT','substatus','substatusAt','format'];(function(_0x1e8f35,_0x3db390){var _0x446c13=function(_0xa1e11e){while(--_0xa1e11e){_0x1e8f35['push'](_0x1e8f35['shift']());}};_0x446c13(++_0x3db390);}(_0x472b,0x17f));var _0xb472=function(_0x410088,_0x4a31e0){_0x410088=_0x410088-0x0;var _0x3f1588=_0x472b[_0x410088];return _0x3f1588;};'use strict';var _=require(_0xb472('0x0'));var util=require(_0xb472('0x1'));var logger=require(_0xb472('0x2'))(_0xb472('0x3'));var moment=require(_0xb472('0x4'));var BPromise=require(_0xb472('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb472('0x6'));var rimraf=require(_0xb472('0x7'));var config=require('../../config/environment');var attributes=require(_0xb472('0x8'));module[_0xb472('0x9')]=function(_0x15a394,_0x149d60){return _0x15a394[_0xb472('0xa')](_0xb472('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xb472('0xc'),'to'],'type':_0xb472('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x451dc6,_0x5e429d,_0x539bb5){if(_0x451dc6[_0xb472('0xe')]){_0x451dc6[_0xb472('0xf')]=moment()[_0xb472('0x10')](_0xb472('0x11'));}if(_0x451dc6[_0xb472('0x12')]){_0x451dc6[_0xb472('0x13')]=moment()[_0xb472('0x10')](_0xb472('0x11'));}_0x539bb5(null,_0x5e429d);},'beforeUpdate':function(_0x3489c0,_0x4a4166,_0x27a077){if(_0x3489c0['changed']('substatus')){_0x3489c0[_0xb472('0xf')]=_0x3489c0[_0xb472('0xe')]?moment()[_0xb472('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x3489c0['changed']('closed')){_0x3489c0[_0xb472('0x13')]=moment()['format'](_0xb472('0x11'));_0x3489c0[_0xb472('0xe')]=null;_0x3489c0['substatusAt']=null;}_0x27a077(null,_0x3489c0);},'afterUpdate':function(_0x574a23,_0x3ef7fd,_0x18f0eb){var _0x1479d4=_0x15a394['models'];var _0xbc53d8=_0x574a23['get']({'plain':!![]});if(_0xbc53d8['closed']){return _0x1479d4[_0xb472('0x14')][_0xb472('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0xbc53d8['id']}})[_0xb472('0x16')](function(){_0x18f0eb();})[_0xb472('0x17')](function(_0x359867){_0x18f0eb(_0x359867);});}else{_0x18f0eb();}}},'charset':_0xb472('0x18'),'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 d35af1c..8fb6ceb 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 _0xd9f4=['rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./mailInteraction.socket','register','request','then','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','MailInteraction,\x20%s,\x20%s','message','info','result','catch','MailInteraction','update','options','where','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','ids','omit','body','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x498e3a,_0x3aa121){var _0x796c1f=function(_0x209362){while(--_0x209362){_0x498e3a['push'](_0x498e3a['shift']());}};_0x796c1f(++_0x3aa121);}(_0xd9f4,0x172));var _0x4d9f=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0xd9f4[_0x26da89];return _0xc95b7b;};'use strict';var _=require(_0x4d9f('0x0'));var util=require(_0x4d9f('0x1'));var moment=require(_0x4d9f('0x2'));var BPromise=require(_0x4d9f('0x3'));var rs=require(_0x4d9f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d9f('0x5'))['db'];var utils=require(_0x4d9f('0x6'));var logger=require(_0x4d9f('0x7'))(_0x4d9f('0x8'));var config=require(_0x4d9f('0x9'));var jayson=require(_0x4d9f('0xa'));var client=jayson['client'][_0x4d9f('0xb')]({'port':0x232a});config[_0x4d9f('0xc')]=_['defaults'](config[_0x4d9f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4d9f('0xd'))(new Redis(config['redis']));require(_0x4d9f('0xe'))[_0x4d9f('0xf')](socket);function respondWithRpcPromise(_0x19acd6,_0x2f220f,_0x1f3e15){return new BPromise(function(_0x8a45ec,_0x5a291b){return client[_0x4d9f('0x10')](_0x19acd6,_0x1f3e15)[_0x4d9f('0x11')](function(_0xc13fcd){logger['info']('MailInteraction,\x20%s,\x20%s',_0x2f220f,_0x4d9f('0x12'));logger[_0x4d9f('0x13')](_0x4d9f('0x14'),_0x2f220f,_0x4d9f('0x12'),JSON[_0x4d9f('0x15')](_0xc13fcd));if(_0xc13fcd['error']){if(_0xc13fcd[_0x4d9f('0x16')]['code']===0x1f4){logger[_0x4d9f('0x16')](_0x4d9f('0x17'),_0x2f220f,_0xc13fcd[_0x4d9f('0x16')][_0x4d9f('0x18')]);return _0x5a291b(_0xc13fcd['error']['message']);}logger[_0x4d9f('0x16')](_0x4d9f('0x17'),_0x2f220f,_0xc13fcd[_0x4d9f('0x16')][_0x4d9f('0x18')]);return _0x8a45ec(_0xc13fcd['error'][_0x4d9f('0x18')]);}else{logger[_0x4d9f('0x19')](_0x4d9f('0x17'),_0x2f220f,_0x4d9f('0x12'));_0x8a45ec(_0xc13fcd[_0x4d9f('0x1a')][_0x4d9f('0x18')]);}})[_0x4d9f('0x1b')](function(_0x3c76b5){logger[_0x4d9f('0x16')](_0x4d9f('0x17'),_0x2f220f,_0x3c76b5);_0x5a291b(_0x3c76b5);});});}exports['UpdateMailInteraction']=function(_0x3afe1d){var _0x3173f7=this;return new Promise(function(_0x59da68,_0x343d38){return db[_0x4d9f('0x1c')][_0x4d9f('0x1d')](_0x3afe1d['body'],{'raw':_0x3afe1d[_0x4d9f('0x1e')]?_0x3afe1d[_0x4d9f('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3afe1d[_0x4d9f('0x1e')]?_0x3afe1d['options'][_0x4d9f('0x1f')]||null:null,'attributes':_0x3afe1d[_0x4d9f('0x1e')]?_0x3afe1d['options'][_0x4d9f('0x20')]||null:null,'limit':_0x3afe1d[_0x4d9f('0x1e')]?_0x3afe1d[_0x4d9f('0x1e')][_0x4d9f('0x21')]||null:null})[_0x4d9f('0x11')](function(_0x14a018){logger[_0x4d9f('0x19')](_0x4d9f('0x22'),_0x3afe1d);logger[_0x4d9f('0x13')](_0x4d9f('0x22'),_0x3afe1d,JSON[_0x4d9f('0x15')](_0x14a018));_0x59da68(_0x14a018);})[_0x4d9f('0x1b')](function(_0x575d67){logger[_0x4d9f('0x16')](_0x4d9f('0x22'),_0x575d67[_0x4d9f('0x18')],_0x3afe1d);_0x343d38(_0x3173f7['error'](0x1f4,_0x575d67[_0x4d9f('0x18')]));});});};exports[_0x4d9f('0x23')]=function(_0x49f5e1){return new Promise(function(_0x5148fc,_0x4bd3cc){return db[_0x4d9f('0x1c')][_0x4d9f('0x24')]({'where':_0x49f5e1[_0x4d9f('0x1e')]?_0x49f5e1[_0x4d9f('0x1e')][_0x4d9f('0x1f')]||null:null})[_0x4d9f('0x11')](function(_0x260738){if(_0x260738){return _0x260738[_0x4d9f('0x25')](_0x49f5e1['body'][_0x4d9f('0x26')],_[_0x4d9f('0x27')](_0x49f5e1[_0x4d9f('0x28')],['ids','id'])||{});}})['spread'](function(_0x285841){logger[_0x4d9f('0x19')]('AddTags',_0x49f5e1);logger['debug']('AddTags',_0x49f5e1,JSON[_0x4d9f('0x15')](_0x285841));_0x5148fc(_0x285841);})[_0x4d9f('0x1b')](function(_0x548d91){logger[_0x4d9f('0x16')](_0x4d9f('0x29'),_0x548d91['message'],_0x49f5e1);_0x4bd3cc(_this[_0x4d9f('0x16')](0x1f4,_0x548d91[_0x4d9f('0x18')]));});});}; \ No newline at end of file +var _0xbeb1=['MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','debug','stringify','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xbeb1,0x9b));var _0x1beb=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xbeb1[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x1beb('0x0'));var util=require(_0x1beb('0x1'));var moment=require(_0x1beb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1beb('0x3'));var db=require(_0x1beb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1beb('0x5'))(_0x1beb('0x6'));var config=require(_0x1beb('0x7'));var jayson=require(_0x1beb('0x8'));var client=jayson[_0x1beb('0x9')][_0x1beb('0xa')]({'port':0x232a});config[_0x1beb('0xb')]=_[_0x1beb('0xc')](config[_0x1beb('0xb')],{'host':_0x1beb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1beb('0xb')]));require(_0x1beb('0xe'))[_0x1beb('0xf')](socket);function respondWithRpcPromise(_0x2e4509,_0x14f540,_0x3eff24){return new BPromise(function(_0x1c3690,_0x476c13){return client[_0x1beb('0x10')](_0x2e4509,_0x3eff24)[_0x1beb('0x11')](function(_0x368c01){logger[_0x1beb('0x12')](_0x1beb('0x13'),_0x14f540,_0x1beb('0x14'));logger['debug'](_0x1beb('0x15'),_0x14f540,'request\x20sent',JSON['stringify'](_0x368c01));if(_0x368c01[_0x1beb('0x16')]){if(_0x368c01[_0x1beb('0x16')][_0x1beb('0x17')]===0x1f4){logger[_0x1beb('0x16')]('MailInteraction,\x20%s,\x20%s',_0x14f540,_0x368c01[_0x1beb('0x16')][_0x1beb('0x18')]);return _0x476c13(_0x368c01[_0x1beb('0x16')][_0x1beb('0x18')]);}logger[_0x1beb('0x16')](_0x1beb('0x13'),_0x14f540,_0x368c01[_0x1beb('0x16')][_0x1beb('0x18')]);return _0x1c3690(_0x368c01['error'][_0x1beb('0x18')]);}else{logger[_0x1beb('0x12')](_0x1beb('0x13'),_0x14f540,'request\x20sent');_0x1c3690(_0x368c01[_0x1beb('0x19')][_0x1beb('0x18')]);}})[_0x1beb('0x1a')](function(_0x5c0b09){logger[_0x1beb('0x16')](_0x1beb('0x13'),_0x14f540,_0x5c0b09);_0x476c13(_0x5c0b09);});});}exports[_0x1beb('0x1b')]=function(_0xae2063){var _0x5f05e2=this;return new Promise(function(_0x2a24a8,_0x129f93){return db[_0x1beb('0x1c')][_0x1beb('0x1d')](_0xae2063[_0x1beb('0x1e')],{'raw':_0xae2063[_0x1beb('0x1f')]?_0xae2063[_0x1beb('0x1f')][_0x1beb('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xae2063[_0x1beb('0x1f')]?_0xae2063[_0x1beb('0x1f')][_0x1beb('0x21')]||null:null,'attributes':_0xae2063['options']?_0xae2063[_0x1beb('0x1f')][_0x1beb('0x22')]||null:null,'limit':_0xae2063[_0x1beb('0x1f')]?_0xae2063['options'][_0x1beb('0x23')]||null:null})[_0x1beb('0x11')](function(_0x57dacb){logger[_0x1beb('0x12')](_0x1beb('0x1b'),_0xae2063);logger[_0x1beb('0x24')]('UpdateMailInteraction',_0xae2063,JSON[_0x1beb('0x25')](_0x57dacb));_0x2a24a8(_0x57dacb);})['catch'](function(_0x2fabd7){logger['error'](_0x1beb('0x1b'),_0x2fabd7[_0x1beb('0x18')],_0xae2063);_0x129f93(_0x5f05e2[_0x1beb('0x16')](0x1f4,_0x2fabd7[_0x1beb('0x18')]));});});};exports[_0x1beb('0x26')]=function(_0xc13c42){return new Promise(function(_0x9cf4c9,_0x415ec3){return db[_0x1beb('0x1c')][_0x1beb('0x27')]({'where':_0xc13c42[_0x1beb('0x1f')]?_0xc13c42[_0x1beb('0x1f')][_0x1beb('0x21')]||null:null})[_0x1beb('0x11')](function(_0x3c9be9){if(_0x3c9be9){return _0x3c9be9[_0x1beb('0x28')](_0xc13c42[_0x1beb('0x1e')][_0x1beb('0x29')],_['omit'](_0xc13c42['body'],[_0x1beb('0x29'),'id'])||{});}})[_0x1beb('0x2a')](function(_0x119825){logger[_0x1beb('0x12')]('AddTags',_0xc13c42);logger[_0x1beb('0x24')](_0x1beb('0x2b'),_0xc13c42,JSON['stringify'](_0x119825));_0x9cf4c9(_0x119825);})[_0x1beb('0x1a')](function(_0x4ea90f){logger[_0x1beb('0x16')](_0x1beb('0x2b'),_0x4ea90f[_0x1beb('0x18')],_0xc13c42);_0x415ec3(_this[_0x1beb('0x16')](0x1f4,_0x4ea90f[_0x1beb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 8e1071a..9c9e1ba 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 _0x62e1=['removeListener','mailInteraction:','remove','update','emit'];(function(_0x2ac0a7,_0x1b3269){var _0x54077f=function(_0x59a01b){while(--_0x59a01b){_0x2ac0a7['push'](_0x2ac0a7['shift']());}};_0x54077f(++_0x1b3269);}(_0x62e1,0x16a));var _0x162e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x62e1[_0x21aec3];return _0x288bbc;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0x162e('0x0'),_0x162e('0x1')];function createListener(_0x1fcb21,_0x2dfd09){return function(_0x2c3753){_0x2dfd09[_0x162e('0x2')](_0x1fcb21,_0x2c3753);};}function removeListener(_0xed7eea,_0x3dca9a){return function(){MailInteractionEvents[_0x162e('0x3')](_0xed7eea,_0x3dca9a);};}exports['register']=function(_0x3edd11){for(var _0x35672b=0x0,_0x167b0c=events['length'];_0x35672b<_0x167b0c;_0x35672b++){var _0x3ab2a8=events[_0x35672b];var _0x2b5850=createListener(_0x162e('0x4')+_0x3ab2a8,_0x3edd11);MailInteractionEvents['on'](_0x3ab2a8,_0x2b5850);}}; \ No newline at end of file +var _0x8079=['emit','removeListener','register','length','mailInteraction:','save','update'];(function(_0x5a9bf2,_0xc02bda){var _0x1927ef=function(_0x433e84){while(--_0x433e84){_0x5a9bf2['push'](_0x5a9bf2['shift']());}};_0x1927ef(++_0xc02bda);}(_0x8079,0x98));var _0x9807=function(_0x35f18a,_0x4e66d3){_0x35f18a=_0x35f18a-0x0;var _0x52d4e0=_0x8079[_0x35f18a];return _0x52d4e0;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x9807('0x0'),'remove',_0x9807('0x1')];function createListener(_0x3f8cd6,_0x5ae939){return function(_0x1cd839){_0x5ae939[_0x9807('0x2')](_0x3f8cd6,_0x1cd839);};}function removeListener(_0x366fd4,_0x15ab32){return function(){MailInteractionEvents[_0x9807('0x3')](_0x366fd4,_0x15ab32);};}exports[_0x9807('0x4')]=function(_0x49c517){for(var _0xda817d=0x0,_0x5b0316=events[_0x9807('0x5')];_0xda817d<_0x5b0316;_0xda817d++){var _0xe0b68=events[_0xda817d];var _0x329a31=createListener(_0x9807('0x6')+_0xe0b68,_0x49c517);MailInteractionEvents['on'](_0xe0b68,_0x329a31);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 4c44788..264e9de 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 _0xfbb2=['accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','tracked','mailmessage:create','put','update'];(function(_0x2025d1,_0x1ef288){var _0xdff0a2=function(_0x5d3aa9){while(--_0x5d3aa9){_0x2025d1['push'](_0x2025d1['shift']());}};_0xdff0a2(++_0x1ef288);}(_0xfbb2,0xae));var _0x2fbb=function(_0x375e04,_0x27dad6){_0x375e04=_0x375e04-0x0;var _0x250b96=_0xfbb2[_0x375e04];return _0x250b96;};'use strict';var multer=require(_0x2fbb('0x0'));var util=require(_0x2fbb('0x1'));var path=require(_0x2fbb('0x2'));var timeout=require(_0x2fbb('0x3'));var express=require('express');var router=express[_0x2fbb('0x4')]();var fs_extra=require(_0x2fbb('0x5'));var auth=require(_0x2fbb('0x6'));var interaction=require(_0x2fbb('0x7'));var config=require(_0x2fbb('0x8'));var controller=require(_0x2fbb('0x9'));router[_0x2fbb('0xa')]('/',auth['isAuthenticated'](),controller[_0x2fbb('0xb')]);router[_0x2fbb('0xa')](_0x2fbb('0xc'),auth['isAuthenticated'](),controller[_0x2fbb('0xd')]);router[_0x2fbb('0xa')](_0x2fbb('0xe'),auth[_0x2fbb('0xf')](),controller[_0x2fbb('0x10')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x2fbb('0x11')]('/',auth[_0x2fbb('0xf')](),interaction[_0x2fbb('0x12')]('mail',_0x2fbb('0x13')),controller['create']);router[_0x2fbb('0x14')](_0x2fbb('0xe'),auth[_0x2fbb('0xf')](),controller[_0x2fbb('0x15')]);router[_0x2fbb('0x14')]('/:id/accept',auth[_0x2fbb('0xf')](),controller[_0x2fbb('0x16')]);router['put'](_0x2fbb('0x17'),auth['isAuthenticated'](),controller[_0x2fbb('0x18')]);router[_0x2fbb('0x19')](_0x2fbb('0xe'),auth['isAuthenticated'](),controller[_0x2fbb('0x1a')]);module[_0x2fbb('0x1b')]=router; \ No newline at end of file +var _0xe0af=['../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','/:id','show','/:id/download','post','tracked','mail','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe0af,0x1c9));var _0xfe0a=function(_0x3b247d,_0xbe4218){_0x3b247d=_0x3b247d-0x0;var _0x131bcf=_0xe0af[_0x3b247d];return _0x131bcf;};'use strict';var multer=require(_0xfe0a('0x0'));var util=require(_0xfe0a('0x1'));var path=require(_0xfe0a('0x2'));var timeout=require('connect-timeout');var express=require(_0xfe0a('0x3'));var router=express[_0xfe0a('0x4')]();var fs_extra=require(_0xfe0a('0x5'));var auth=require(_0xfe0a('0x6'));var interaction=require(_0xfe0a('0x7'));var config=require(_0xfe0a('0x8'));var controller=require(_0xfe0a('0x9'));router[_0xfe0a('0xa')]('/',auth[_0xfe0a('0xb')](),controller['index']);router['get'](_0xfe0a('0xc'),auth[_0xfe0a('0xb')](),controller['describe']);router[_0xfe0a('0xa')](_0xfe0a('0xd'),auth['isAuthenticated'](),controller[_0xfe0a('0xe')]);router[_0xfe0a('0xa')](_0xfe0a('0xf'),auth[_0xfe0a('0xb')](),controller['download']);router[_0xfe0a('0x10')]('/',auth[_0xfe0a('0xb')](),interaction[_0xfe0a('0x11')](_0xfe0a('0x12'),_0xfe0a('0x13')),controller[_0xfe0a('0x14')]);router['put'](_0xfe0a('0xd'),auth[_0xfe0a('0xb')](),controller['update']);router[_0xfe0a('0x15')](_0xfe0a('0x16'),auth[_0xfe0a('0xb')](),controller[_0xfe0a('0x17')]);router['put'](_0xfe0a('0x18'),auth['isAuthenticated'](),controller[_0xfe0a('0x19')]);router[_0xfe0a('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xfe0a('0x1b')]);module[_0xfe0a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 6df17f6..9a77221 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 _0xdb3a=['sequelize','lodash','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','Email','Chat'];(function(_0x3beff9,_0x536707){var _0x458844=function(_0x28a5a9){while(--_0x28a5a9){_0x3beff9['push'](_0x3beff9['shift']());}};_0x458844(++_0x536707);}(_0xdb3a,0x1c0));var _0xadb3=function(_0x212776,_0x38666e){_0x212776=_0x212776-0x0;var _0x46b217=_0xdb3a[_0x212776];return _0x46b217;};'use strict';var Sequelize=require(_0xadb3('0x0'));var _=require(_0xadb3('0x1'));module[_0xadb3('0x2')]={'body':{'type':Sequelize[_0xadb3('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xadb3('0x3')](_0xadb3('0x4'))},'read':{'type':Sequelize[_0xadb3('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xadb3('0x6')]('in',_0xadb3('0x7')),'defaultValue':_0xadb3('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xadb3('0x8')]},'to':{'type':Sequelize[_0xadb3('0x3')](_0xadb3('0x9'))},'cc':{'type':Sequelize[_0xadb3('0x3')](_0xadb3('0x9'))},'bcc':{'type':Sequelize[_0xadb3('0x3')](_0xadb3('0x9'))},'subject':{'type':Sequelize[_0xadb3('0x3')]},'sentAt':{'type':Sequelize[_0xadb3('0xa')]},'attach':{'type':Sequelize[_0xadb3('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xadb3('0xa')]},'originTo':{'type':Sequelize[_0xadb3('0x3')](_0xadb3('0x9'))},'originCc':{'type':Sequelize['TEXT'](_0xadb3('0x9'))},'originChannel':{'type':Sequelize[_0xadb3('0x6')](_0xadb3('0xc'),_0xadb3('0xd')),'defaultValue':_0xadb3('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0xd0d2=['long','INTEGER','DATE','ENUM','Email','Chat','sequelize','exports','TEXT','medium','BOOLEAN','out','STRING'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xd0d2,0x6e));var _0x2d0d=function(_0x437d7f,_0x1feb46){_0x437d7f=_0x437d7f-0x0;var _0x31058c=_0xd0d2[_0x437d7f];return _0x31058c;};'use strict';var Sequelize=require(_0x2d0d('0x0'));var _=require('lodash');module[_0x2d0d('0x1')]={'body':{'type':Sequelize[_0x2d0d('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2d0d('0x3'))},'read':{'type':Sequelize[_0x2d0d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2d0d('0x5')),'defaultValue':_0x2d0d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2d0d('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x2d0d('0x2')](_0x2d0d('0x7'))},'cc':{'type':Sequelize[_0x2d0d('0x2')](_0x2d0d('0x7'))},'bcc':{'type':Sequelize[_0x2d0d('0x2')](_0x2d0d('0x7'))},'subject':{'type':Sequelize[_0x2d0d('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x2d0d('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2d0d('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2d0d('0x9')]},'originTo':{'type':Sequelize[_0x2d0d('0x2')](_0x2d0d('0x7'))},'originCc':{'type':Sequelize[_0x2d0d('0x2')](_0x2d0d('0x7'))},'originChannel':{'type':Sequelize[_0x2d0d('0xa')](_0x2d0d('0xb'),_0x2d0d('0xc')),'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 7ce692a..c73db58 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 _0x122e=['readFileSync','build','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','undefined','limit','count','offset','status','Content-Range','json','update','destroy','stack','name','send','index','map','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','MailMessage','includeAll','include','findAll','rows','show','params','keys','options','find','body','describe','create','out','split','MailAccount','findOne','MailAccountId','CmList','Contacts','updatedAt','MailServerOut','Smtp','host','port','secure','auth','user','pass','service','attachments','join','root','server/files/attachments','basename','List','CmContact','ListId','List\x20not\x20found','SendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','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','SELECT','User','agent','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','reject','rejectmessage','download','unix','server','files','tmp','message-%s.eml','from','bcc','subject','Attachment','Attachments','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push'];(function(_0x526b1d,_0x495dd1){var _0x415f99=function(_0x5b2b86){while(--_0x5b2b86){_0x526b1d['push'](_0x526b1d['shift']());}};_0x415f99(++_0x495dd1);}(_0x122e,0x1ef));var _0xe122=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x122e[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xe122('0x0'));var moment=require(_0xe122('0x1'));var BPromise=require(_0xe122('0x2'));var util=require('util');var path=require(_0xe122('0x3'));var fs=require('fs');var _=require(_0xe122('0x4'));var Redis=require(_0xe122('0x5'));var htmlToText=require('html-to-text');var qs=require(_0xe122('0x6'));var logger=require('../../config/logger')(_0xe122('0x7'));var interaction_log=require(_0xe122('0x8'))(_0xe122('0x9'));var config=require(_0xe122('0xa'));var db=require(_0xe122('0xb'))['db'];config['redis']=_[_0xe122('0xc')](config[_0xe122('0xd')],{'host':_0xe122('0xe'),'port':0x18eb});var socket=require(_0xe122('0xf'))(new Redis(config['redis']));var htmlEntities=require(_0xe122('0x10'));require(_0xe122('0x11'))[_0xe122('0x12')](socket);var jayson=require(_0xe122('0x13'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0xe122('0x14')]['http']({'port':0x232b});var client9002=jayson[_0xe122('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e58e9,_0x43c1b1,_0x530081,_0x56add4){return new BPromise(function(_0x519c12,_0xad6b0f){var _0x51885f=_0x56add4||client;return _0x51885f[_0xe122('0x15')](_0x1e58e9,_0x530081)[_0xe122('0x16')](function(_0x44c241){logger[_0xe122('0x17')](_0xe122('0x18'),_0x43c1b1,_0xe122('0x19'));logger['debug'](_0xe122('0x1a'),_0x43c1b1,'request\x20sent',JSON[_0xe122('0x1b')](_0x44c241));if(_0x44c241[_0xe122('0x1c')]){if(_0x44c241[_0xe122('0x1c')][_0xe122('0x1d')]===0x1f4){logger[_0xe122('0x1c')](_0xe122('0x18'),_0x43c1b1,_0x44c241['error'][_0xe122('0x1e')]);return _0xad6b0f(_0x44c241['error'][_0xe122('0x1e')]);}logger[_0xe122('0x1c')](_0xe122('0x18'),_0x43c1b1,_0x44c241[_0xe122('0x1c')]['message']);return _0x519c12(_0x44c241[_0xe122('0x1c')][_0xe122('0x1e')]);}else{logger['info'](_0xe122('0x18'),_0x43c1b1,_0xe122('0x19'));_0x519c12(_0x44c241['result']['message']);}})[_0xe122('0x1f')](function(_0x4bdf45){logger[_0xe122('0x1c')](_0xe122('0x18'),_0x43c1b1,_0x4bdf45);_0xad6b0f(_0x4bdf45);});});}function respondWithResult(_0x2c6679,_0x12bf66){_0x12bf66=_0x12bf66||0xc8;return function(_0x2a1952){if(_0x2a1952){return _0x2c6679['status'](_0x12bf66)['json'](_0x2a1952);}};}function respondWithFilteredResult(_0x17591c,_0x2410c3){return function(_0x58d1ef){if(_0x58d1ef){var _0x4e23f5=typeof _0x2410c3['offset']===_0xe122('0x20')&&typeof _0x2410c3[_0xe122('0x21')]===_0xe122('0x20');var _0x531ec8=_0x58d1ef[_0xe122('0x22')];var _0x36af85=_0x4e23f5?0x0:_0x2410c3[_0xe122('0x23')];var _0x345dcc=_0x4e23f5?_0x58d1ef[_0xe122('0x22')]:_0x2410c3[_0xe122('0x23')]+_0x2410c3['limit'];var _0x5a462f;if(_0x345dcc>=_0x531ec8){_0x345dcc=_0x531ec8;_0x5a462f=0xc8;}else{_0x5a462f=0xce;}_0x17591c[_0xe122('0x24')](_0x5a462f);return _0x17591c['set'](_0xe122('0x25'),_0x36af85+'-'+_0x345dcc+'/'+_0x531ec8)[_0xe122('0x26')](_0x58d1ef);}return null;};}function saveUpdates(_0x284d58){return function(_0x1ed859){if(_0x1ed859){return _0x1ed859[_0xe122('0x27')](_0x284d58)[_0xe122('0x16')](function(_0x51b601){return _0x51b601;});}return null;};}function removeEntity(_0x3c15f9){return function(_0x4d8752){if(_0x4d8752){return _0x4d8752[_0xe122('0x28')]()[_0xe122('0x16')](function(){_0x3c15f9[_0xe122('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa425f4){return function(_0x3e7889){if(!_0x3e7889){_0xa425f4['sendStatus'](0x194);}return _0x3e7889;};}function handleError(_0x2f16ff,_0x46ed46){_0x46ed46=_0x46ed46||0x1f4;return function(_0x773c22){logger[_0xe122('0x1c')](_0x773c22[_0xe122('0x29')]);if(_0x773c22['name']){delete _0x773c22[_0xe122('0x2a')];}_0x2f16ff[_0xe122('0x24')](_0x46ed46)[_0xe122('0x2b')](_0x773c22);};}exports[_0xe122('0x2c')]=function(_0xbffff3,_0x5bc18a){var _0x3d0a49={},_0x158a3f={},_0x54572f={'count':0x0,'rows':[]};var _0x5b21cb=_[_0xe122('0x2d')](db['MailMessage']['rawAttributes'],function(_0x11d4d5){return{'name':_0x11d4d5[_0xe122('0x2e')],'type':_0x11d4d5[_0xe122('0x2f')][_0xe122('0x30')]};});_0x158a3f['model']=_[_0xe122('0x2d')](_0x5b21cb,_0xe122('0x2a'));_0x158a3f[_0xe122('0x31')]=_['keys'](_0xbffff3[_0xe122('0x31')]);_0x158a3f['filters']=_[_0xe122('0x32')](_0x158a3f['model'],_0x158a3f[_0xe122('0x31')]);_0x3d0a49[_0xe122('0x33')]=_['intersection'](_0x158a3f[_0xe122('0x34')],qs['fields'](_0xbffff3[_0xe122('0x31')][_0xe122('0x35')]));_0x3d0a49['attributes']=_0x3d0a49['attributes'][_0xe122('0x36')]?_0x3d0a49[_0xe122('0x33')]:_0x158a3f[_0xe122('0x34')];if(!_0xbffff3['query'][_0xe122('0x37')](_0xe122('0x38'))){_0x3d0a49[_0xe122('0x21')]=qs[_0xe122('0x21')](_0xbffff3[_0xe122('0x31')]['limit']);_0x3d0a49['offset']=qs[_0xe122('0x23')](_0xbffff3[_0xe122('0x31')][_0xe122('0x23')]);}_0x3d0a49[_0xe122('0x39')]=qs[_0xe122('0x3a')](_0xbffff3[_0xe122('0x31')]['sort']);_0x3d0a49[_0xe122('0x3b')]=qs[_0xe122('0x3c')](_['pick'](_0xbffff3[_0xe122('0x31')],_0x158a3f[_0xe122('0x3c')]),_0x5b21cb);if(_0xbffff3[_0xe122('0x31')]['filter']){_0x3d0a49[_0xe122('0x3b')]=_[_0xe122('0x3d')](_0x3d0a49['where'],{'$or':_[_0xe122('0x2d')](_0x5b21cb,function(_0x43f4f0){if(_0x43f4f0['type']!==_0xe122('0x3e')){var _0xa51094={};_0xa51094[_0x43f4f0['name']]={'$like':'%'+_0xbffff3[_0xe122('0x31')]['filter']+'%'};return _0xa51094;}})});}_0x3d0a49=_[_0xe122('0x3d')]({},_0x3d0a49,_0xbffff3['options']);var _0x5d2adb={'where':_0x3d0a49[_0xe122('0x3b')]};return db[_0xe122('0x3f')][_0xe122('0x22')](_0x5d2adb)[_0xe122('0x16')](function(_0x376d99){_0x54572f[_0xe122('0x22')]=_0x376d99;if(_0xbffff3[_0xe122('0x31')][_0xe122('0x40')]){_0x3d0a49[_0xe122('0x41')]=[{'all':!![]}];}return db[_0xe122('0x3f')][_0xe122('0x42')](_0x3d0a49);})[_0xe122('0x16')](function(_0x11d80a){_0x54572f[_0xe122('0x43')]=_0x11d80a;return _0x54572f;})[_0xe122('0x16')](respondWithFilteredResult(_0x5bc18a,_0x3d0a49))[_0xe122('0x1f')](handleError(_0x5bc18a,null));};exports[_0xe122('0x44')]=function(_0x589590,_0x49e284){var _0x8f18a4={'raw':!![],'where':{'id':_0x589590[_0xe122('0x45')]['id']}},_0x29ba5f={};_0x29ba5f[_0xe122('0x34')]=_['keys'](db[_0xe122('0x3f')]['rawAttributes']);_0x29ba5f[_0xe122('0x31')]=_[_0xe122('0x46')](_0x589590['query']);_0x29ba5f[_0xe122('0x3c')]=_[_0xe122('0x32')](_0x29ba5f[_0xe122('0x34')],_0x29ba5f[_0xe122('0x31')]);_0x8f18a4[_0xe122('0x33')]=_[_0xe122('0x32')](_0x29ba5f[_0xe122('0x34')],qs['fields'](_0x589590[_0xe122('0x31')][_0xe122('0x35')]));_0x8f18a4['attributes']=_0x8f18a4[_0xe122('0x33')][_0xe122('0x36')]?_0x8f18a4[_0xe122('0x33')]:_0x29ba5f['model'];if(_0x589590[_0xe122('0x31')][_0xe122('0x40')]){_0x8f18a4[_0xe122('0x41')]=[{'all':!![]}];}_0x8f18a4=_['merge']({},_0x8f18a4,_0x589590[_0xe122('0x47')]);return db[_0xe122('0x3f')][_0xe122('0x48')](_0x8f18a4)['then'](handleEntityNotFound(_0x49e284,null))[_0xe122('0x16')](respondWithResult(_0x49e284,null))[_0xe122('0x1f')](handleError(_0x49e284,null));};exports['update']=function(_0x2a6449,_0x353e85){if(_0x2a6449[_0xe122('0x49')]['id']){delete _0x2a6449[_0xe122('0x49')]['id'];}return db['MailMessage'][_0xe122('0x48')]({'where':{'id':_0x2a6449['params']['id']}})[_0xe122('0x16')](handleEntityNotFound(_0x353e85,null))[_0xe122('0x16')](saveUpdates(_0x2a6449[_0xe122('0x49')],null))['then'](respondWithResult(_0x353e85,null))['catch'](handleError(_0x353e85,null));};exports[_0xe122('0x28')]=function(_0x8ba58a,_0x1a0263){return db['MailMessage'][_0xe122('0x48')]({'where':{'id':_0x8ba58a[_0xe122('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a0263,null))[_0xe122('0x16')](removeEntity(_0x1a0263,null))[_0xe122('0x1f')](handleError(_0x1a0263,null));};exports[_0xe122('0x4a')]=function(_0x16d208,_0xc404f8){return db['MailMessage'][_0xe122('0x4a')]()[_0xe122('0x16')](respondWithResult(_0xc404f8,null))[_0xe122('0x1f')](handleError(_0xc404f8,null));};exports[_0xe122('0x4b')]=function(_0x5ccf44,_0x1da2f4){return db['MailMessage']['create'](_0x5ccf44[_0xe122('0x49')])[_0xe122('0x16')](function(_0x945621){if(_0x945621){if(_0x945621['direction']===_0xe122('0x4c')&&!_0x945621['secret']){var _0x228fae,_0x402344,_0x191fca;if(_0x5ccf44['body']['to']){_0x402344=_0x5ccf44[_0xe122('0x49')]['to'][_0xe122('0x4d')](',')[0x0];}return db[_0xe122('0x4e')][_0xe122('0x4f')]({'where':{'id':_0x945621[_0xe122('0x50')]},'include':[{'model':db[_0xe122('0x51')],'as':'List','include':[{'model':db['CmContact'],'as':_0xe122('0x52'),'where':{'email':_0x402344},'limit':0x1,'order':[[_0xe122('0x53'),'DESC']]}]},{'model':db[_0xe122('0x54')],'as':_0xe122('0x55'),'raw':!![]}]})[_0xe122('0x16')](function(_0x1d37ca){_0x228fae=_0x1d37ca;if(_0x228fae&&_0x228fae['Smtp']){var _0x27e651={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x228fae['Smtp']['service'])){_0x27e651[_0xe122('0x56')]=_0x228fae[_0xe122('0x55')][_0xe122('0x56')];_0x27e651[_0xe122('0x57')]=_0x228fae['Smtp'][_0xe122('0x57')];_0x27e651[_0xe122('0x58')]=_0x228fae[_0xe122('0x55')]['secure'];if(_0x228fae[_0xe122('0x55')]['authentication']){_0x27e651[_0xe122('0x59')]={'user':_0x228fae[_0xe122('0x55')][_0xe122('0x5a')],'pass':_0x228fae[_0xe122('0x55')][_0xe122('0x5b')]};}}else{_0x27e651[_0xe122('0x5c')]=_0x228fae['Smtp'][_0xe122('0x5c')];_0x27e651[_0xe122('0x59')]={'user':_0x228fae['Smtp'][_0xe122('0x5a')],'pass':_0x228fae[_0xe122('0x55')][_0xe122('0x5b')]};_0x27e651[_0xe122('0x58')]=_0x228fae['Smtp'][_0xe122('0x58')];}if(_0x5ccf44[_0xe122('0x49')][_0xe122('0x5d')]&&_0x5ccf44['body'][_0xe122('0x5d')]['length']){for(var _0x1b745e=0x0;_0x1b745e<_0x5ccf44[_0xe122('0x49')][_0xe122('0x5d')][_0xe122('0x36')];_0x1b745e+=0x1){_0x5ccf44[_0xe122('0x49')]['attachments'][_0x1b745e]={'filename':_0x5ccf44[_0xe122('0x49')][_0xe122('0x5d')][_0x1b745e][_0xe122('0x2a')],'path':path[_0xe122('0x5e')](config[_0xe122('0x5f')],_0xe122('0x60'),_0x5ccf44[_0xe122('0x49')]['attachments'][_0x1b745e][_0xe122('0x61')])};}}_0x191fca={'account':_0x27e651,'message':_0x5ccf44[_0xe122('0x49')]};return;}})[_0xe122('0x16')](function(){if(_0x228fae[_0xe122('0x62')]){if(_0x228fae[_0xe122('0x62')]['Contacts'][_0xe122('0x36')]){return _0x228fae[_0xe122('0x62')][_0xe122('0x52')][0x0];}else{return db[_0xe122('0x63')][_0xe122('0x4b')](_[_0xe122('0xc')](_0x5ccf44[_0xe122('0x49')],{'firstName':_0x5ccf44[_0xe122('0x49')]['to'],'email':_0x5ccf44['body']['to'],'phone':_0x5ccf44[_0xe122('0x49')]['to'],'ListId':_0x228fae[_0xe122('0x64')]}));}}else{throw new Error(_0xe122('0x65'));}})[_0xe122('0x16')](function(){if(_0x191fca){return respondWithRpcPromise(_0xe122('0x66'),'sendMail',_0x191fca,client9003)[_0xe122('0x16')](function(_0x17b8a8){return _0x945621[_0xe122('0x27')]({'read':!![],'messageId':_0x17b8a8['messageId'],'sentAt':moment()[_0xe122('0x67')](_0xe122('0x68'))});})[_0xe122('0x1f')](function(_0x298d51){logger['error']('%s',JSON[_0xe122('0x1b')](_0x298d51));return _0x945621;});}return _0x945621;});}return _0x945621;}})[_0xe122('0x16')](respondWithResult(_0x1da2f4,0xc9))[_0xe122('0x1f')](handleError(_0x1da2f4,null));};exports[_0xe122('0x69')]=function(_0x1a5b77,_0x15af0a){var _0x57f8d0={'agent':{},'channel':_0xe122('0x6a')};if(_0x1a5b77[_0xe122('0x49')]['id']){delete _0x1a5b77['body']['id'];}_0x1a5b77[_0xe122('0x49')][_0xe122('0x6b')]=!![];_0x1a5b77['body'][_0xe122('0x6c')]=moment()[_0xe122('0x67')](_0xe122('0x68'));_0x1a5b77[_0xe122('0x49')][_0xe122('0x6d')]=_0x1a5b77['body']['UserId']||_0x1a5b77[_0xe122('0x5a')]['id'];_0x57f8d0['agent']['id']=_0x1a5b77[_0xe122('0x49')][_0xe122('0x6d')];return db[_0xe122('0x3f')][_0xe122('0x48')]({'where':{'id':_0x1a5b77[_0xe122('0x45')]['id'],'UserId':null}})[_0xe122('0x16')](handleEntityNotFound(_0x15af0a,null))[_0xe122('0x16')](saveUpdates(_0x1a5b77[_0xe122('0x49')],null))['then'](function(_0x43ff5b){if(_0x43ff5b){_0x57f8d0[_0xe122('0x1e')]=_0x43ff5b[_0xe122('0x6e')]({'plain':!![]});return db[_0xe122('0x6f')]['find']({'where':{'id':_0x43ff5b[_0xe122('0x70')]}});}return null;})[_0xe122('0x16')](handleEntityNotFound(_0x15af0a,null))[_0xe122('0x16')](function(_0x15863a){if(_0x15863a){return _0x15863a[_0xe122('0x27')]({'UserId':_0x1a5b77[_0xe122('0x49')][_0xe122('0x6d')],'read1stAt':_['isNil'](_0x15863a[_0xe122('0x71')])?moment()['format'](_0xe122('0x68')):undefined});}return null;})['then'](function(_0x5a02a3){if(_0x5a02a3){_0x57f8d0[_0xe122('0x72')]=_0x5a02a3[_0xe122('0x6e')]({'plain':!![]});interaction_log['info'](_0xe122('0x73'),_0x1a5b77[_0xe122('0x5a')]['id'],_0x1a5b77[_0xe122('0x5a')][_0xe122('0x2a')],_0x1a5b77[_0xe122('0x5a')][_0xe122('0x74')],_0x57f8d0[_0xe122('0x72')]['id'],_0x1a5b77[_0xe122('0x49')]?JSON[_0xe122('0x1b')](_0x1a5b77[_0xe122('0x49')]):_0xe122('0x75'));return respondWithRpcPromise(_0xe122('0x76'),_0xe122('0x77'),_0x57f8d0);}return null;})[_0xe122('0x16')](function(_0x13e44d){var _0x121f11=_0xe122('0x78')+_0x13e44d[_0xe122('0x1e')][_0xe122('0x79')];return db[_0xe122('0x7a')][_0xe122('0x31')](_0x121f11,{'type':db[_0xe122('0x7b')]['QueryTypes'][_0xe122('0x7c')],'raw':!![]})[_0xe122('0x16')](function(_0x53dba9){return _0x53dba9;});})['then'](function(_0x181286){if(_0x181286){_0x57f8d0[_0xe122('0x1e')]['contact']=_0x181286[0x0];if(!_0x1a5b77[_0xe122('0x49')][_0xe122('0x6d')])return;return db[_0xe122('0x7d')]['find']({'where':{'id':_0x1a5b77[_0xe122('0x49')][_0xe122('0x6d')],'role':_0xe122('0x7e')},'attributes':['id','name',_0xe122('0x7f'),_0xe122('0x80'),_0xe122('0x81')],'raw':!![]});}return null;})[_0xe122('0x16')](function(_0x1ff1b4){if(!_0x1ff1b4)return null;_0x57f8d0[_0xe122('0x1e')][_0xe122('0x7e')]=_0x1ff1b4;return _0x57f8d0;})[_0xe122('0x16')](function(_0x2fe516){if(_0x2fe516){if(_0x1a5b77[_0xe122('0x49')][_0xe122('0x82')]){_0x57f8d0[_0xe122('0x1e')]['interface']=util[_0xe122('0x67')](_0xe122('0x83'),_0x1a5b77[_0xe122('0x5a')][_0xe122('0x2a')]);_0x57f8d0['message'][_0xe122('0x84')]=_0x57f8d0[_0xe122('0x84')];_0x57f8d0[_0xe122('0x1e')][_0xe122('0x85')]=_0x57f8d0[_0xe122('0x84')];_0x57f8d0['message'][_0xe122('0x86')]=_0xe122('0x69');_0x57f8d0[_0xe122('0x1e')][_0xe122('0x49')]=htmlToText[_0xe122('0x87')](_0x57f8d0[_0xe122('0x1e')]['body']);return respondWithRpcPromise('EventManager',_0xe122('0x88'),{'event':_0xe122('0x89'),'message':_0x57f8d0[_0xe122('0x1e')]},client9002)[_0xe122('0x16')](function(){return _0x57f8d0;});}return _0x57f8d0;}return null;})[_0xe122('0x16')](respondWithResult(_0x15af0a,null))[_0xe122('0x1f')](handleError(_0x15af0a,null));};exports['reject']=function(_0x5bc21a,_0x23c26c){var _0x406b06={'agent':{},'channel':_0xe122('0x6a')};if(_0x5bc21a['body']['id']){delete _0x5bc21a['body']['id'];}_0x5bc21a['body'][_0xe122('0x6d')]=_0x5bc21a[_0xe122('0x49')][_0xe122('0x6d')]||_0x5bc21a[_0xe122('0x5a')]['id'];_0x406b06[_0xe122('0x7e')]['id']=_0x5bc21a[_0xe122('0x49')][_0xe122('0x6d')];return db['MailMessage'][_0xe122('0x48')]({'where':{'id':_0x5bc21a[_0xe122('0x45')]['id'],'UserId':null}})[_0xe122('0x16')](handleEntityNotFound(_0x23c26c,null))[_0xe122('0x16')](function(_0x545572){if(_0x545572){_0x406b06[_0xe122('0x1e')]=_0x545572[_0xe122('0x6e')]({'plain':!![]});return db[_0xe122('0x6f')]['find']({'where':{'id':_0x545572[_0xe122('0x70')]}});}return null;})[_0xe122('0x16')](handleEntityNotFound(_0x23c26c,null))[_0xe122('0x16')](function(_0x3f846a){if(_0x3f846a){_0x406b06[_0xe122('0x72')]=_0x3f846a[_0xe122('0x6e')]({'plain':!![]});interaction_log[_0xe122('0x17')](_0xe122('0x8a'),_0x5bc21a[_0xe122('0x5a')]['id'],_0x5bc21a[_0xe122('0x5a')]['name'],_0x5bc21a[_0xe122('0x5a')][_0xe122('0x74')],_0x406b06['interaction']['id'],_0x5bc21a[_0xe122('0x49')]?JSON[_0xe122('0x1b')](_0x5bc21a['body']):_0xe122('0x75'));return respondWithRpcPromise('RejectMessage',_0xe122('0x8b'),_0x406b06);}return null;})[_0xe122('0x16')](function(_0x1c0130){var _0x15fa0a=_0xe122('0x78')+_0x1c0130['message'][_0xe122('0x79')];return db[_0xe122('0x7a')]['query'](_0x15fa0a,{'type':db['Sequelize']['QueryTypes'][_0xe122('0x7c')],'raw':!![]})[_0xe122('0x16')](function(_0x373985){return _0x373985;});})['then'](function(_0x23f0c1){if(_0x23f0c1){_0x406b06[_0xe122('0x1e')]['contact']=_0x23f0c1[0x0];if(!_0x5bc21a[_0xe122('0x49')][_0xe122('0x6d')])return;return db[_0xe122('0x7d')][_0xe122('0x48')]({'where':{'id':_0x5bc21a[_0xe122('0x49')][_0xe122('0x6d')],'role':_0xe122('0x7e')},'attributes':['id',_0xe122('0x2a'),_0xe122('0x7f'),_0xe122('0x80'),_0xe122('0x81')],'raw':!![]});}return null;})[_0xe122('0x16')](function(_0x5cb04e){if(!_0x5cb04e)return null;_0x406b06['message'][_0xe122('0x7e')]=_0x5cb04e;return _0x406b06;})[_0xe122('0x16')](function(_0x54e7df){if(_0x54e7df){_0x54e7df[_0xe122('0x1e')][_0xe122('0x8c')]=util[_0xe122('0x67')](_0xe122('0x83'),_0x5bc21a[_0xe122('0x5a')][_0xe122('0x2a')]);_0x54e7df[_0xe122('0x1e')][_0xe122('0x84')]=_0x406b06[_0xe122('0x84')];_0x54e7df[_0xe122('0x1e')]['motionChannel']=_0x406b06[_0xe122('0x84')];_0x54e7df[_0xe122('0x1e')][_0xe122('0x86')]=_0xe122('0x8d');_0x54e7df[_0xe122('0x1e')][_0xe122('0x49')]=htmlToText[_0xe122('0x87')](_0x406b06[_0xe122('0x1e')][_0xe122('0x49')]);respondWithRpcPromise('EventManager',_0xe122('0x88'),{'event':_0xe122('0x8e'),'message':_0x54e7df[_0xe122('0x1e')]},client9002);return _0x406b06;}return null;})[_0xe122('0x16')](respondWithResult(_0x23c26c,null))[_0xe122('0x1f')](handleError(_0x23c26c,null));};exports[_0xe122('0x8f')]=function(_0x47f7eb,_0x1ca3da){var _0x54a8e6=moment()[_0xe122('0x90')]()['toString']();var _0x23366f=path[_0xe122('0x5e')](config['root'],_0xe122('0x91'),_0xe122('0x92'),_0xe122('0x93'));var _0x207b1e=path['join'](config[_0xe122('0x5f')],'server',_0xe122('0x92'),_0xe122('0x5d'));var _0x18e5ee=util[_0xe122('0x67')](_0xe122('0x94'),_0x54a8e6);return db[_0xe122('0x3f')][_0xe122('0x48')]({'where':{'id':_0x47f7eb['params']['id']},'attributes':['id',_0xe122('0x49'),_0xe122('0x95'),'to','cc',_0xe122('0x96'),_0xe122('0x97'),'createdAt'],'include':_0x47f7eb['query']['attachments']?[{'model':db[_0xe122('0x98')],'as':_0xe122('0x99')}]:undefined})['then'](handleEntityNotFound(_0x1ca3da,null))[_0xe122('0x16')](function(_0x488d12){if(_0x488d12){var _0x2f77ff=_0x488d12;var _0x449152={'from':_0x2f77ff[_0xe122('0x95')],'to':_0x2f77ff['to'],'subject':_0x2f77ff[_0xe122('0x97')],'html':htmlEntities[_0xe122('0x9a')](_0x2f77ff['body']),'headers':{'Date':moment(_0x2f77ff[_0xe122('0x9b')])[_0xe122('0x67')](_0xe122('0x9c'))},'attachments':[]};if(_0x488d12['cc']){_0x449152[_0xe122('0x9d')]['Cc']=_0x488d12['cc'];}if(_0x488d12['bcc']){_0x449152['headers'][_0xe122('0x9e')]=_0x488d12[_0xe122('0x96')];}return new BPromise(function(_0xcf69c1,_0x2aa96a){if(_0x488d12[_0xe122('0x99')]){for(var _0x4bc12b=0x0;_0x4bc12b<_0x488d12[_0xe122('0x99')]['length'];_0x4bc12b++){var _0x45e293=_0x488d12['Attachments'][_0x4bc12b];var _0x25b276=path[_0xe122('0x5e')](_0x207b1e,_0x45e293[_0xe122('0x61')]);if(fs[_0xe122('0x9f')](_0x25b276)){_0x449152[_0xe122('0x5d')][_0xe122('0xa0')]({'name':_0x45e293[_0xe122('0x2a')],'contentType':_0x45e293[_0xe122('0x2f')],'data':fs[_0xe122('0xa1')](_0x25b276)});}}}emlformat[_0xe122('0xa2')](_0x449152,function(_0x15d152,_0x3d3de2){if(_0x15d152)return _0x2aa96a(_0x15d152);fs['writeFileSync'](path[_0xe122('0x5e')](_0x23366f,_0x18e5ee),_0x3d3de2);return _0xcf69c1(_0x3d3de2);});});}})['then'](function(_0x419b40){if(_0x419b40){return _0x1ca3da[_0xe122('0x8f')](path[_0xe122('0x5e')](_0x23366f,_0x18e5ee),_0x18e5ee,function(_0x585ca7){if(!_0x585ca7)fs[_0xe122('0xa3')](path[_0xe122('0x5e')](_0x23366f,_0x18e5ee));});}})[_0xe122('0x1f')](handleError(_0x1ca3da,null));}; \ No newline at end of file +var _0xc84d=['status','set','Content-Range','destroy','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','update','body','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','basename','ListId','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','readAt','UserId','MailInteraction','read1stAt','format','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','User','agent','email','internal','manual','interface','SIP/%s','channel','event','fromString','EventManager','acceptmessage','reject','mail','MailInteractionId','null','RejectMessage','rejectMessage','ContactId','sequelize','QueryTypes','contact','download','unix','toString','server','files','tmp','message-%s.eml','bcc','createdAt','Attachment','Attachments','from','subject','decode','headers','Bcc','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','json','limit','undefined','count'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0xc84d,0x1d8));var _0xdc84=function(_0x334cc2,_0x14d267){_0x334cc2=_0x334cc2-0x0;var _0x58d91e=_0xc84d[_0x334cc2];return _0x58d91e;};'use strict';var emlformat=require(_0xdc84('0x0'));var moment=require(_0xdc84('0x1'));var BPromise=require(_0xdc84('0x2'));var util=require(_0xdc84('0x3'));var path=require(_0xdc84('0x4'));var fs=require('fs');var _=require(_0xdc84('0x5'));var Redis=require(_0xdc84('0x6'));var htmlToText=require(_0xdc84('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xdc84('0x8'))(_0xdc84('0x9'));var interaction_log=require(_0xdc84('0x8'))(_0xdc84('0xa'));var config=require(_0xdc84('0xb'));var db=require(_0xdc84('0xc'))['db'];config[_0xdc84('0xd')]=_[_0xdc84('0xe')](config[_0xdc84('0xd')],{'host':_0xdc84('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc84('0xd')]));var htmlEntities=require(_0xdc84('0x10'));require(_0xdc84('0x11'))[_0xdc84('0x12')](socket);var jayson=require(_0xdc84('0x13'));var client=jayson[_0xdc84('0x14')]['http']({'port':0x232c});var client9003=jayson['client'][_0xdc84('0x15')]({'port':0x232b});var client9002=jayson['client'][_0xdc84('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x5f0f90,_0x2c364d,_0x5b3af9,_0x86f1f5){return new BPromise(function(_0x42f8ea,_0x5e4c34){var _0x554a96=_0x86f1f5||client;return _0x554a96[_0xdc84('0x16')](_0x5f0f90,_0x5b3af9)[_0xdc84('0x17')](function(_0x2b7a94){logger['info'](_0xdc84('0x18'),_0x2c364d,'request\x20sent');logger[_0xdc84('0x19')](_0xdc84('0x1a'),_0x2c364d,_0xdc84('0x1b'),JSON[_0xdc84('0x1c')](_0x2b7a94));if(_0x2b7a94[_0xdc84('0x1d')]){if(_0x2b7a94['error'][_0xdc84('0x1e')]===0x1f4){logger[_0xdc84('0x1d')](_0xdc84('0x18'),_0x2c364d,_0x2b7a94[_0xdc84('0x1d')][_0xdc84('0x1f')]);return _0x5e4c34(_0x2b7a94['error']['message']);}logger[_0xdc84('0x1d')]('MailMessage,\x20%s,\x20%s',_0x2c364d,_0x2b7a94[_0xdc84('0x1d')][_0xdc84('0x1f')]);return _0x42f8ea(_0x2b7a94[_0xdc84('0x1d')][_0xdc84('0x1f')]);}else{logger[_0xdc84('0x20')](_0xdc84('0x18'),_0x2c364d,_0xdc84('0x1b'));_0x42f8ea(_0x2b7a94['result']['message']);}})[_0xdc84('0x21')](function(_0x33cb2e){logger[_0xdc84('0x1d')](_0xdc84('0x18'),_0x2c364d,_0x33cb2e);_0x5e4c34(_0x33cb2e);});});}function respondWithResult(_0x109b3e,_0x57e82c){_0x57e82c=_0x57e82c||0xc8;return function(_0x381e37){if(_0x381e37){return _0x109b3e['status'](_0x57e82c)[_0xdc84('0x22')](_0x381e37);}};}function respondWithFilteredResult(_0x2d1df6,_0x1985f8){return function(_0x2b3014){if(_0x2b3014){var _0x2a4aee=typeof _0x1985f8['offset']==='undefined'&&typeof _0x1985f8[_0xdc84('0x23')]===_0xdc84('0x24');var _0x36b6d7=_0x2b3014[_0xdc84('0x25')];var _0x430f70=_0x2a4aee?0x0:_0x1985f8['offset'];var _0x57fdf0=_0x2a4aee?_0x2b3014['count']:_0x1985f8['offset']+_0x1985f8['limit'];var _0x9d06f;if(_0x57fdf0>=_0x36b6d7){_0x57fdf0=_0x36b6d7;_0x9d06f=0xc8;}else{_0x9d06f=0xce;}_0x2d1df6[_0xdc84('0x26')](_0x9d06f);return _0x2d1df6[_0xdc84('0x27')](_0xdc84('0x28'),_0x430f70+'-'+_0x57fdf0+'/'+_0x36b6d7)[_0xdc84('0x22')](_0x2b3014);}return null;};}function saveUpdates(_0x2d6ed5){return function(_0x26778a){if(_0x26778a){return _0x26778a['update'](_0x2d6ed5)[_0xdc84('0x17')](function(_0x3e97d9){return _0x3e97d9;});}return null;};}function removeEntity(_0x52ad4c){return function(_0x2075fc){if(_0x2075fc){return _0x2075fc[_0xdc84('0x29')]()[_0xdc84('0x17')](function(){_0x52ad4c[_0xdc84('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35c726){return function(_0x44bf73){if(!_0x44bf73){_0x35c726[_0xdc84('0x2a')](0x194);}return _0x44bf73;};}function handleError(_0xbdb10d,_0x2486db){_0x2486db=_0x2486db||0x1f4;return function(_0x19bc5e){logger[_0xdc84('0x1d')](_0x19bc5e[_0xdc84('0x2b')]);if(_0x19bc5e[_0xdc84('0x2c')]){delete _0x19bc5e[_0xdc84('0x2c')];}_0xbdb10d[_0xdc84('0x26')](_0x2486db)[_0xdc84('0x2d')](_0x19bc5e);};}exports[_0xdc84('0x2e')]=function(_0x4950e9,_0xd9ee41){var _0x34540b={},_0xbb451f={},_0x50db66={'count':0x0,'rows':[]};var _0x32bb59=_[_0xdc84('0x2f')](db[_0xdc84('0x30')][_0xdc84('0x31')],function(_0xe0c120){return{'name':_0xe0c120[_0xdc84('0x32')],'type':_0xe0c120[_0xdc84('0x33')][_0xdc84('0x34')]};});_0xbb451f[_0xdc84('0x35')]=_['map'](_0x32bb59,_0xdc84('0x2c'));_0xbb451f['query']=_[_0xdc84('0x36')](_0x4950e9[_0xdc84('0x37')]);_0xbb451f[_0xdc84('0x38')]=_[_0xdc84('0x39')](_0xbb451f[_0xdc84('0x35')],_0xbb451f[_0xdc84('0x37')]);_0x34540b[_0xdc84('0x3a')]=_[_0xdc84('0x39')](_0xbb451f[_0xdc84('0x35')],qs[_0xdc84('0x3b')](_0x4950e9[_0xdc84('0x37')][_0xdc84('0x3b')]));_0x34540b[_0xdc84('0x3a')]=_0x34540b[_0xdc84('0x3a')][_0xdc84('0x3c')]?_0x34540b[_0xdc84('0x3a')]:_0xbb451f['model'];if(!_0x4950e9[_0xdc84('0x37')][_0xdc84('0x3d')](_0xdc84('0x3e'))){_0x34540b['limit']=qs[_0xdc84('0x23')](_0x4950e9[_0xdc84('0x37')][_0xdc84('0x23')]);_0x34540b['offset']=qs[_0xdc84('0x3f')](_0x4950e9[_0xdc84('0x37')][_0xdc84('0x3f')]);}_0x34540b[_0xdc84('0x40')]=qs[_0xdc84('0x41')](_0x4950e9[_0xdc84('0x37')]['sort']);_0x34540b[_0xdc84('0x42')]=qs[_0xdc84('0x38')](_['pick'](_0x4950e9[_0xdc84('0x37')],_0xbb451f[_0xdc84('0x38')]),_0x32bb59);if(_0x4950e9[_0xdc84('0x37')][_0xdc84('0x43')]){_0x34540b[_0xdc84('0x42')]=_[_0xdc84('0x44')](_0x34540b['where'],{'$or':_[_0xdc84('0x2f')](_0x32bb59,function(_0x361bef){if(_0x361bef[_0xdc84('0x33')]!==_0xdc84('0x45')){var _0x20e0c4={};_0x20e0c4[_0x361bef[_0xdc84('0x2c')]]={'$like':'%'+_0x4950e9[_0xdc84('0x37')]['filter']+'%'};return _0x20e0c4;}})});}_0x34540b=_[_0xdc84('0x44')]({},_0x34540b,_0x4950e9[_0xdc84('0x46')]);var _0x20429c={'where':_0x34540b['where']};return db[_0xdc84('0x30')][_0xdc84('0x25')](_0x20429c)['then'](function(_0x35becb){_0x50db66['count']=_0x35becb;if(_0x4950e9['query'][_0xdc84('0x47')]){_0x34540b[_0xdc84('0x48')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x34540b);})[_0xdc84('0x17')](function(_0x5ca271){_0x50db66[_0xdc84('0x49')]=_0x5ca271;return _0x50db66;})[_0xdc84('0x17')](respondWithFilteredResult(_0xd9ee41,_0x34540b))[_0xdc84('0x21')](handleError(_0xd9ee41,null));};exports[_0xdc84('0x4a')]=function(_0x56c24e,_0xe081e9){var _0x518fe8={'raw':!![],'where':{'id':_0x56c24e[_0xdc84('0x4b')]['id']}},_0x498928={};_0x498928[_0xdc84('0x35')]=_[_0xdc84('0x36')](db[_0xdc84('0x30')][_0xdc84('0x31')]);_0x498928[_0xdc84('0x37')]=_[_0xdc84('0x36')](_0x56c24e[_0xdc84('0x37')]);_0x498928[_0xdc84('0x38')]=_['intersection'](_0x498928[_0xdc84('0x35')],_0x498928[_0xdc84('0x37')]);_0x518fe8[_0xdc84('0x3a')]=_[_0xdc84('0x39')](_0x498928['model'],qs[_0xdc84('0x3b')](_0x56c24e[_0xdc84('0x37')]['fields']));_0x518fe8[_0xdc84('0x3a')]=_0x518fe8[_0xdc84('0x3a')][_0xdc84('0x3c')]?_0x518fe8[_0xdc84('0x3a')]:_0x498928[_0xdc84('0x35')];if(_0x56c24e[_0xdc84('0x37')]['includeAll']){_0x518fe8[_0xdc84('0x48')]=[{'all':!![]}];}_0x518fe8=_['merge']({},_0x518fe8,_0x56c24e[_0xdc84('0x46')]);return db[_0xdc84('0x30')][_0xdc84('0x4c')](_0x518fe8)['then'](handleEntityNotFound(_0xe081e9,null))[_0xdc84('0x17')](respondWithResult(_0xe081e9,null))[_0xdc84('0x21')](handleError(_0xe081e9,null));};exports[_0xdc84('0x4d')]=function(_0x48f87c,_0xa11048){if(_0x48f87c[_0xdc84('0x4e')]['id']){delete _0x48f87c[_0xdc84('0x4e')]['id'];}return db[_0xdc84('0x30')][_0xdc84('0x4c')]({'where':{'id':_0x48f87c['params']['id']}})[_0xdc84('0x17')](handleEntityNotFound(_0xa11048,null))[_0xdc84('0x17')](saveUpdates(_0x48f87c['body'],null))['then'](respondWithResult(_0xa11048,null))['catch'](handleError(_0xa11048,null));};exports['destroy']=function(_0xb4cb0e,_0x3f5574){return db[_0xdc84('0x30')]['find']({'where':{'id':_0xb4cb0e['params']['id']}})[_0xdc84('0x17')](handleEntityNotFound(_0x3f5574,null))[_0xdc84('0x17')](removeEntity(_0x3f5574,null))[_0xdc84('0x21')](handleError(_0x3f5574,null));};exports['describe']=function(_0x5f5170,_0x421a36){return db[_0xdc84('0x30')][_0xdc84('0x4f')]()[_0xdc84('0x17')](respondWithResult(_0x421a36,null))[_0xdc84('0x21')](handleError(_0x421a36,null));};exports['create']=function(_0xa5b152,_0x238080){return db[_0xdc84('0x30')][_0xdc84('0x50')](_0xa5b152['body'])[_0xdc84('0x17')](function(_0x10e845){if(_0x10e845){if(_0x10e845[_0xdc84('0x51')]===_0xdc84('0x52')&&!_0x10e845[_0xdc84('0x53')]){var _0x35d0d8,_0x5351e4,_0x178057;if(_0xa5b152['body']['to']){_0x5351e4=_0xa5b152[_0xdc84('0x4e')]['to'][_0xdc84('0x54')](',')[0x0];}return db[_0xdc84('0x55')]['findOne']({'where':{'id':_0x10e845[_0xdc84('0x56')]},'include':[{'model':db[_0xdc84('0x57')],'as':_0xdc84('0x58'),'include':[{'model':db[_0xdc84('0x59')],'as':_0xdc84('0x5a'),'where':{'email':_0x5351e4},'limit':0x1,'order':[[_0xdc84('0x5b'),_0xdc84('0x5c')]]}]},{'model':db[_0xdc84('0x5d')],'as':_0xdc84('0x5e'),'raw':!![]}]})['then'](function(_0x3d38dd){_0x35d0d8=_0x3d38dd;if(_0x35d0d8&&_0x35d0d8[_0xdc84('0x5e')]){var _0x139a3d={'tls':{'rejectUnauthorized':![]}};if(_[_0xdc84('0x5f')](_0x35d0d8[_0xdc84('0x5e')][_0xdc84('0x60')])){_0x139a3d[_0xdc84('0x61')]=_0x35d0d8['Smtp']['host'];_0x139a3d[_0xdc84('0x62')]=_0x35d0d8['Smtp'][_0xdc84('0x62')];_0x139a3d[_0xdc84('0x63')]=_0x35d0d8['Smtp'][_0xdc84('0x63')];if(_0x35d0d8['Smtp'][_0xdc84('0x64')]){_0x139a3d[_0xdc84('0x65')]={'user':_0x35d0d8[_0xdc84('0x5e')][_0xdc84('0x66')],'pass':_0x35d0d8[_0xdc84('0x5e')][_0xdc84('0x67')]};}}else{_0x139a3d[_0xdc84('0x60')]=_0x35d0d8['Smtp'][_0xdc84('0x60')];_0x139a3d[_0xdc84('0x65')]={'user':_0x35d0d8['Smtp'][_0xdc84('0x66')],'pass':_0x35d0d8['Smtp']['pass']};_0x139a3d[_0xdc84('0x63')]=_0x35d0d8['Smtp'][_0xdc84('0x63')];}if(_0xa5b152[_0xdc84('0x4e')]['attachments']&&_0xa5b152[_0xdc84('0x4e')][_0xdc84('0x68')][_0xdc84('0x3c')]){for(var _0x19cd14=0x0;_0x19cd14<_0xa5b152[_0xdc84('0x4e')][_0xdc84('0x68')][_0xdc84('0x3c')];_0x19cd14+=0x1){_0xa5b152[_0xdc84('0x4e')][_0xdc84('0x68')][_0x19cd14]={'filename':_0xa5b152['body'][_0xdc84('0x68')][_0x19cd14][_0xdc84('0x2c')],'path':path[_0xdc84('0x69')](config[_0xdc84('0x6a')],'server/files/attachments',_0xa5b152[_0xdc84('0x4e')]['attachments'][_0x19cd14][_0xdc84('0x6b')])};}}_0x178057={'account':_0x139a3d,'message':_0xa5b152[_0xdc84('0x4e')]};return;}})[_0xdc84('0x17')](function(){if(_0x35d0d8[_0xdc84('0x58')]){if(_0x35d0d8[_0xdc84('0x58')][_0xdc84('0x5a')][_0xdc84('0x3c')]){return _0x35d0d8[_0xdc84('0x58')][_0xdc84('0x5a')][0x0];}else{return db[_0xdc84('0x59')][_0xdc84('0x50')](_[_0xdc84('0xe')](_0xa5b152[_0xdc84('0x4e')],{'firstName':_0xa5b152[_0xdc84('0x4e')]['to'],'email':_0xa5b152['body']['to'],'phone':_0xa5b152['body']['to'],'ListId':_0x35d0d8[_0xdc84('0x6c')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xdc84('0x17')](function(){if(_0x178057){return respondWithRpcPromise(_0xdc84('0x6d'),_0xdc84('0x6e'),_0x178057,client9003)[_0xdc84('0x17')](function(_0x2d2100){return _0x10e845[_0xdc84('0x4d')]({'read':!![],'messageId':_0x2d2100[_0xdc84('0x6f')],'sentAt':moment()['format'](_0xdc84('0x70'))});})[_0xdc84('0x21')](function(_0x5602d4){logger['error']('%s',JSON[_0xdc84('0x1c')](_0x5602d4));return _0x10e845;});}return _0x10e845;});}return _0x10e845;}})['then'](respondWithResult(_0x238080,0xc9))[_0xdc84('0x21')](handleError(_0x238080,null));};exports[_0xdc84('0x71')]=function(_0x446947,_0x4181b6){var _0x9bc5a7={'agent':{},'channel':'mail'};if(_0x446947[_0xdc84('0x4e')]['id']){delete _0x446947[_0xdc84('0x4e')]['id'];}_0x446947[_0xdc84('0x4e')]['read']=!![];_0x446947['body'][_0xdc84('0x72')]=moment()['format'](_0xdc84('0x70'));_0x446947[_0xdc84('0x4e')][_0xdc84('0x73')]=_0x446947[_0xdc84('0x4e')][_0xdc84('0x73')]||_0x446947['user']['id'];_0x9bc5a7['agent']['id']=_0x446947[_0xdc84('0x4e')][_0xdc84('0x73')];return db[_0xdc84('0x30')][_0xdc84('0x4c')]({'where':{'id':_0x446947['params']['id'],'UserId':null}})[_0xdc84('0x17')](handleEntityNotFound(_0x4181b6,null))[_0xdc84('0x17')](saveUpdates(_0x446947[_0xdc84('0x4e')],null))[_0xdc84('0x17')](function(_0x401528){if(_0x401528){_0x9bc5a7[_0xdc84('0x1f')]=_0x401528['get']({'plain':!![]});return db[_0xdc84('0x74')]['find']({'where':{'id':_0x401528['MailInteractionId']}});}return null;})[_0xdc84('0x17')](handleEntityNotFound(_0x4181b6,null))['then'](function(_0x5812f2){if(_0x5812f2){return _0x5812f2['update']({'UserId':_0x446947[_0xdc84('0x4e')]['UserId'],'read1stAt':_[_0xdc84('0x5f')](_0x5812f2[_0xdc84('0x75')])?moment()[_0xdc84('0x76')](_0xdc84('0x70')):undefined});}return null;})[_0xdc84('0x17')](function(_0x48bb6d){if(_0x48bb6d){_0x9bc5a7[_0xdc84('0x77')]=_0x48bb6d[_0xdc84('0x78')]({'plain':!![]});interaction_log[_0xdc84('0x20')](_0xdc84('0x79'),_0x446947[_0xdc84('0x66')]['id'],_0x446947['user'][_0xdc84('0x2c')],_0x446947['user'][_0xdc84('0x7a')],_0x9bc5a7[_0xdc84('0x77')]['id'],_0x446947[_0xdc84('0x4e')]?JSON[_0xdc84('0x1c')](_0x446947[_0xdc84('0x4e')]):'null');return respondWithRpcPromise('AcceptMessage',_0xdc84('0x7b'),_0x9bc5a7);}return null;})[_0xdc84('0x17')](function(_0x53b0cc){var _0x2de837=_0xdc84('0x7c')+_0x53b0cc[_0xdc84('0x1f')]['ContactId'];return db['sequelize'][_0xdc84('0x37')](_0x2de837,{'type':db[_0xdc84('0x7d')]['QueryTypes'][_0xdc84('0x7e')],'raw':!![]})[_0xdc84('0x17')](function(_0x35aa39){return _0x35aa39;});})[_0xdc84('0x17')](function(_0x24225d){if(_0x24225d){_0x9bc5a7['message']['contact']=_0x24225d[0x0];if(!_0x446947[_0xdc84('0x4e')][_0xdc84('0x73')])return;return db[_0xdc84('0x7f')][_0xdc84('0x4c')]({'where':{'id':_0x446947['body'][_0xdc84('0x73')],'role':_0xdc84('0x80')},'attributes':['id',_0xdc84('0x2c'),'fullname',_0xdc84('0x81'),_0xdc84('0x82')],'raw':!![]});}return null;})[_0xdc84('0x17')](function(_0x2503db){if(!_0x2503db)return null;_0x9bc5a7[_0xdc84('0x1f')][_0xdc84('0x80')]=_0x2503db;return _0x9bc5a7;})[_0xdc84('0x17')](function(_0x42a4b0){if(_0x42a4b0){if(_0x446947['body'][_0xdc84('0x83')]){_0x9bc5a7['message'][_0xdc84('0x84')]=util[_0xdc84('0x76')](_0xdc84('0x85'),_0x446947['user'][_0xdc84('0x2c')]);_0x9bc5a7['message'][_0xdc84('0x86')]=_0x9bc5a7[_0xdc84('0x86')];_0x9bc5a7[_0xdc84('0x1f')]['motionChannel']=_0x9bc5a7[_0xdc84('0x86')];_0x9bc5a7[_0xdc84('0x1f')][_0xdc84('0x87')]=_0xdc84('0x71');_0x9bc5a7[_0xdc84('0x1f')][_0xdc84('0x4e')]=htmlToText[_0xdc84('0x88')](_0x9bc5a7[_0xdc84('0x1f')][_0xdc84('0x4e')]);return respondWithRpcPromise(_0xdc84('0x89'),_0xdc84('0x89'),{'event':_0xdc84('0x8a'),'message':_0x9bc5a7[_0xdc84('0x1f')]},client9002)[_0xdc84('0x17')](function(){return _0x9bc5a7;});}return _0x9bc5a7;}return null;})[_0xdc84('0x17')](respondWithResult(_0x4181b6,null))[_0xdc84('0x21')](handleError(_0x4181b6,null));};exports[_0xdc84('0x8b')]=function(_0x2f34fe,_0x29a7e2){var _0x2bcd0d={'agent':{},'channel':_0xdc84('0x8c')};if(_0x2f34fe['body']['id']){delete _0x2f34fe[_0xdc84('0x4e')]['id'];}_0x2f34fe[_0xdc84('0x4e')][_0xdc84('0x73')]=_0x2f34fe[_0xdc84('0x4e')]['UserId']||_0x2f34fe[_0xdc84('0x66')]['id'];_0x2bcd0d['agent']['id']=_0x2f34fe[_0xdc84('0x4e')][_0xdc84('0x73')];return db[_0xdc84('0x30')][_0xdc84('0x4c')]({'where':{'id':_0x2f34fe[_0xdc84('0x4b')]['id'],'UserId':null}})[_0xdc84('0x17')](handleEntityNotFound(_0x29a7e2,null))[_0xdc84('0x17')](function(_0xed6b3){if(_0xed6b3){_0x2bcd0d[_0xdc84('0x1f')]=_0xed6b3[_0xdc84('0x78')]({'plain':!![]});return db[_0xdc84('0x74')][_0xdc84('0x4c')]({'where':{'id':_0xed6b3[_0xdc84('0x8d')]}});}return null;})['then'](handleEntityNotFound(_0x29a7e2,null))['then'](function(_0x489311){if(_0x489311){_0x2bcd0d[_0xdc84('0x77')]=_0x489311['get']({'plain':!![]});interaction_log[_0xdc84('0x20')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2f34fe['user']['id'],_0x2f34fe[_0xdc84('0x66')][_0xdc84('0x2c')],_0x2f34fe[_0xdc84('0x66')][_0xdc84('0x7a')],_0x2bcd0d[_0xdc84('0x77')]['id'],_0x2f34fe[_0xdc84('0x4e')]?JSON[_0xdc84('0x1c')](_0x2f34fe['body']):_0xdc84('0x8e'));return respondWithRpcPromise(_0xdc84('0x8f'),_0xdc84('0x90'),_0x2bcd0d);}return null;})['then'](function(_0x1942ed){var _0xbb9c7f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1942ed[_0xdc84('0x1f')][_0xdc84('0x91')];return db[_0xdc84('0x92')][_0xdc84('0x37')](_0xbb9c7f,{'type':db[_0xdc84('0x7d')][_0xdc84('0x93')]['SELECT'],'raw':!![]})[_0xdc84('0x17')](function(_0x2cc6d0){return _0x2cc6d0;});})[_0xdc84('0x17')](function(_0x42cd15){if(_0x42cd15){_0x2bcd0d['message'][_0xdc84('0x94')]=_0x42cd15[0x0];if(!_0x2f34fe[_0xdc84('0x4e')]['UserId'])return;return db['User'][_0xdc84('0x4c')]({'where':{'id':_0x2f34fe[_0xdc84('0x4e')][_0xdc84('0x73')],'role':_0xdc84('0x80')},'attributes':['id',_0xdc84('0x2c'),'fullname',_0xdc84('0x81'),_0xdc84('0x82')],'raw':!![]});}return null;})[_0xdc84('0x17')](function(_0x98e41a){if(!_0x98e41a)return null;_0x2bcd0d[_0xdc84('0x1f')][_0xdc84('0x80')]=_0x98e41a;return _0x2bcd0d;})['then'](function(_0x376e10){if(_0x376e10){_0x376e10['message'][_0xdc84('0x84')]=util[_0xdc84('0x76')]('SIP/%s',_0x2f34fe[_0xdc84('0x66')][_0xdc84('0x2c')]);_0x376e10[_0xdc84('0x1f')][_0xdc84('0x86')]=_0x2bcd0d[_0xdc84('0x86')];_0x376e10['message']['motionChannel']=_0x2bcd0d[_0xdc84('0x86')];_0x376e10[_0xdc84('0x1f')][_0xdc84('0x87')]='reject';_0x376e10['message'][_0xdc84('0x4e')]=htmlToText[_0xdc84('0x88')](_0x2bcd0d[_0xdc84('0x1f')]['body']);respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x376e10[_0xdc84('0x1f')]},client9002);return _0x2bcd0d;}return null;})[_0xdc84('0x17')](respondWithResult(_0x29a7e2,null))[_0xdc84('0x21')](handleError(_0x29a7e2,null));};exports[_0xdc84('0x95')]=function(_0x539b88,_0x252886){var _0xe9e13b=moment()[_0xdc84('0x96')]()[_0xdc84('0x97')]();var _0x50dcdc=path[_0xdc84('0x69')](config[_0xdc84('0x6a')],_0xdc84('0x98'),_0xdc84('0x99'),_0xdc84('0x9a'));var _0x23c237=path[_0xdc84('0x69')](config[_0xdc84('0x6a')],_0xdc84('0x98'),_0xdc84('0x99'),'attachments');var _0x3103dd=util[_0xdc84('0x76')](_0xdc84('0x9b'),_0xe9e13b);return db['MailMessage'][_0xdc84('0x4c')]({'where':{'id':_0x539b88[_0xdc84('0x4b')]['id']},'attributes':['id',_0xdc84('0x4e'),'from','to','cc',_0xdc84('0x9c'),'subject',_0xdc84('0x9d')],'include':_0x539b88[_0xdc84('0x37')][_0xdc84('0x68')]?[{'model':db[_0xdc84('0x9e')],'as':_0xdc84('0x9f')}]:undefined})[_0xdc84('0x17')](handleEntityNotFound(_0x252886,null))[_0xdc84('0x17')](function(_0xf9ab1){if(_0xf9ab1){var _0xa967d4=_0xf9ab1;var _0x1d1853={'from':_0xa967d4[_0xdc84('0xa0')],'to':_0xa967d4['to'],'subject':_0xa967d4[_0xdc84('0xa1')],'html':htmlEntities[_0xdc84('0xa2')](_0xa967d4[_0xdc84('0x4e')]),'headers':{'Date':moment(_0xa967d4[_0xdc84('0x9d')])[_0xdc84('0x76')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xf9ab1['cc']){_0x1d1853[_0xdc84('0xa3')]['Cc']=_0xf9ab1['cc'];}if(_0xf9ab1[_0xdc84('0x9c')]){_0x1d1853[_0xdc84('0xa3')][_0xdc84('0xa4')]=_0xf9ab1['bcc'];}return new BPromise(function(_0x52951a,_0x5ce87a){if(_0xf9ab1[_0xdc84('0x9f')]){for(var _0x154159=0x0;_0x154159<_0xf9ab1['Attachments']['length'];_0x154159++){var _0x3796cf=_0xf9ab1[_0xdc84('0x9f')][_0x154159];var _0x2933d5=path[_0xdc84('0x69')](_0x23c237,_0x3796cf[_0xdc84('0x6b')]);if(fs['existsSync'](_0x2933d5)){_0x1d1853['attachments'][_0xdc84('0xa5')]({'name':_0x3796cf[_0xdc84('0x2c')],'contentType':_0x3796cf['type'],'data':fs[_0xdc84('0xa6')](_0x2933d5)});}}}emlformat[_0xdc84('0xa7')](_0x1d1853,function(_0x493f3e,_0x4ac233){if(_0x493f3e)return _0x5ce87a(_0x493f3e);fs[_0xdc84('0xa8')](path['join'](_0x50dcdc,_0x3103dd),_0x4ac233);return _0x52951a(_0x4ac233);});});}})[_0xdc84('0x17')](function(_0x5f2e35){if(_0x5f2e35){return _0x252886[_0xdc84('0x95')](path['join'](_0x50dcdc,_0x3103dd),_0x3103dd,function(_0x163d99){if(!_0x163d99)fs[_0xdc84('0xa9')](path[_0xdc84('0x69')](_0x50dcdc,_0x3103dd));});}})[_0xdc84('0x21')](handleError(_0x252886,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index c258d4e..b8134d1 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 _0x1d67=['update','remove','hasOwnProperty','exports','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x42fcfd,_0x4523ab){var _0x3ef5eb=function(_0x12aaf0){while(--_0x12aaf0){_0x42fcfd['push'](_0x42fcfd['shift']());}};_0x3ef5eb(++_0x4523ab);}(_0x1d67,0x115));var _0x71d6=function(_0x301ecb,_0x5c75a4){_0x301ecb=_0x301ecb-0x0;var _0x45af85=_0x1d67[_0x301ecb];return _0x45af85;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x71d6('0x0'))['db'][_0x71d6('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x71d6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x71d6('0x3'),'afterDestroy':_0x71d6('0x4')};function emitEvent(_0x4c1218){return function(_0x3a37c5,_0x9e8745,_0x21aa76){MailMessageEvents['emit'](_0x4c1218+':'+_0x3a37c5['id'],_0x3a37c5);MailMessageEvents['emit'](_0x4c1218,_0x3a37c5);_0x21aa76(null);};}for(var e in events){if(events[_0x71d6('0x5')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x71d6('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x2f56=['update','remove','emit','hasOwnProperty','exports','events','MailMessage','setMaxListeners'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0x2f56,0x1e5));var _0x62f5=function(_0x437e48,_0x301e40){_0x437e48=_0x437e48-0x0;var _0x1cbdd1=_0x2f56[_0x437e48];return _0x1cbdd1;};'use strict';var EventEmitter=require(_0x62f5('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x62f5('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x62f5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x62f5('0x3'),'afterDestroy':_0x62f5('0x4')};function emitEvent(_0x14b75c){return function(_0x318da2,_0x77b6c9,_0x18e8c9){MailMessageEvents[_0x62f5('0x5')](_0x14b75c+':'+_0x318da2['id'],_0x318da2);MailMessageEvents[_0x62f5('0x5')](_0x14b75c,_0x318da2);_0x18e8c9(null);};}for(var e in events){if(events[_0x62f5('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x62f5('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 6b8ef7a..ec7ca8f 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 _0x70b0=['MailMessage','mail_messages','plainBody','subject','FULLTEXT','fromString','body','models','get','direction','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','toLowerCase','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x2f3d59,_0x5df3de){var _0x365cd4=function(_0x188c37){while(--_0x188c37){_0x2f3d59['push'](_0x2f3d59['shift']());}};_0x365cd4(++_0x5df3de);}(_0x70b0,0x176));var _0x070b=function(_0x1e896c,_0x3f9948){_0x1e896c=_0x1e896c-0x0;var _0xd149d9=_0x70b0[_0x1e896c];return _0xd149d9;};'use strict';var _=require(_0x070b('0x0'));var util=require(_0x070b('0x1'));var logger=require(_0x070b('0x2'))(_0x070b('0x3'));var moment=require(_0x070b('0x4'));var BPromise=require(_0x070b('0x5'));var rp=require(_0x070b('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0x070b('0x7'));var config=require(_0x070b('0x8'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x4f1a8b,_0x2f3e03){return _0x4f1a8b[_0x070b('0x9')](_0x070b('0xa'),attributes,{'tableName':_0x070b('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_mail_messages','fields':[_0x070b('0xc'),_0x070b('0xd')],'type':_0x070b('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x538dcd,_0x248467,_0x509f00){if(_0x538dcd['body']){_0x538dcd[_0x070b('0xc')]=htmlToText[_0x070b('0xf')](_0x538dcd[_0x070b('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x509f00(null,_0x248467);},'afterCreate':function(_0xb6dae3,_0x1fc6a7,_0x1abdd1){var _0x22f6c5=_0x4f1a8b[_0x070b('0x11')];var _0x3bc8f6=_0xb6dae3[_0x070b('0x12')]({'plain':!![]});if(_0x3bc8f6[_0x070b('0x13')]['toLowerCase']()==='in'||_0x3bc8f6[_0x070b('0x13')]['toLowerCase']()==='out'&&!_0x3bc8f6[_0x070b('0x14')]&&!_[_0x070b('0x15')](_0x3bc8f6[_0x070b('0x16')])){_0x22f6c5[_0x070b('0x17')]['findOne']({'where':{'id':_0x3bc8f6[_0x070b('0x18')]}})[_0x070b('0x19')](function(_0x442164){if(_0x442164){_0x442164[_0x070b('0x1a')]({'lastMsgAt':_0x3bc8f6[_0x070b('0x1b')],'lastMsgDirection':_0x3bc8f6[_0x070b('0x13')][_0x070b('0x1c')]()});}})[_0x070b('0x1d')](function(_0x542f5b){console[_0x070b('0x1e')](_0x542f5b);});}_0x1abdd1();}},'charset':_0x070b('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2d18=['html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise'];(function(_0x358125,_0x45326f){var _0x118f28=function(_0x4f1d66){while(--_0x4f1d66){_0x358125['push'](_0x358125['shift']());}};_0x118f28(++_0x45326f);}(_0x2d18,0xbc));var _0x82d1=function(_0x1bd987,_0x36af79){_0x1bd987=_0x1bd987-0x0;var _0x1e89c3=_0x2d18[_0x1bd987];return _0x1e89c3;};'use strict';var _=require(_0x82d1('0x0'));var util=require('util');var logger=require(_0x82d1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x82d1('0x2'));var rp=require(_0x82d1('0x3'));var htmlToText=require(_0x82d1('0x4'));var fs=require('fs');var path=require(_0x82d1('0x5'));var rimraf=require(_0x82d1('0x6'));var config=require(_0x82d1('0x7'));var attributes=require(_0x82d1('0x8'));module['exports']=function(_0x202c68,_0x48b400){return _0x202c68['define']('MailMessage',attributes,{'tableName':_0x82d1('0x9'),'paranoid':![],'indexes':[{'name':_0x82d1('0xa'),'fields':[_0x82d1('0xa')]},{'name':_0x82d1('0xb'),'fields':[_0x82d1('0xc'),_0x82d1('0xd')],'type':_0x82d1('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5f275d,_0x18758e,_0x16decf){if(_0x5f275d[_0x82d1('0xf')]){_0x5f275d[_0x82d1('0xc')]=htmlToText[_0x82d1('0x10')](_0x5f275d[_0x82d1('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x16decf(null,_0x18758e);},'afterCreate':function(_0x856811,_0x20202e,_0x9cd4d9){var _0x3a9eff=_0x202c68[_0x82d1('0x11')];var _0x1c3a8a=_0x856811['get']({'plain':!![]});if(_0x1c3a8a[_0x82d1('0x12')][_0x82d1('0x13')]()==='in'||_0x1c3a8a[_0x82d1('0x12')]['toLowerCase']()===_0x82d1('0x14')&&!_0x1c3a8a[_0x82d1('0x15')]&&!_['isNil'](_0x1c3a8a[_0x82d1('0x16')])){_0x3a9eff[_0x82d1('0x17')][_0x82d1('0x18')]({'where':{'id':_0x1c3a8a[_0x82d1('0x19')]}})[_0x82d1('0x1a')](function(_0x1870e4){if(_0x1870e4){_0x1870e4[_0x82d1('0x1b')]({'lastMsgAt':_0x1c3a8a['createdAt'],'lastMsgDirection':_0x1c3a8a['direction']['toLowerCase']()});}})[_0x82d1('0x1c')](function(_0x3d9ae){console[_0x82d1('0x1d')](_0x3d9ae);});}_0x9cd4d9();}},'charset':_0x82d1('0x1e'),'collate':_0x82d1('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 5e969d9..51c5790 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 _0x7d25=['client','redis','defaults','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateMailMessage','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5d10d3,_0x36b2fc){var _0x366df3=function(_0x597f0f){while(--_0x597f0f){_0x5d10d3['push'](_0x5d10d3['shift']());}};_0x366df3(++_0x36b2fc);}(_0x7d25,0x8a));var _0x57d2=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x7d25[_0x344a3f];return _0x264712;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});config[_0x57d2('0x8')]=_[_0x57d2('0x9')](config[_0x57d2('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57d2('0x8')]));require('./mailMessage.socket')[_0x57d2('0xa')](socket);function respondWithRpcPromise(_0x5153c2,_0xa04872,_0x485438){return new BPromise(function(_0x429301,_0x1a86db){return client[_0x57d2('0xb')](_0x5153c2,_0x485438)[_0x57d2('0xc')](function(_0x2e8e12){logger[_0x57d2('0xd')](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));logger[_0x57d2('0x10')](_0x57d2('0x11'),_0xa04872,_0x57d2('0xf'),JSON[_0x57d2('0x12')](_0x2e8e12));if(_0x2e8e12[_0x57d2('0x13')]){if(_0x2e8e12[_0x57d2('0x13')][_0x57d2('0x14')]===0x1f4){logger[_0x57d2('0x13')]('MailMessage,\x20%s,\x20%s',_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x1a86db(_0x2e8e12[_0x57d2('0x13')]['message']);}logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x429301(_0x2e8e12['error'][_0x57d2('0x15')]);}else{logger['info'](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));_0x429301(_0x2e8e12[_0x57d2('0x16')]['message']);}})['catch'](function(_0xbaeda8){logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0xbaeda8);_0x1a86db(_0xbaeda8);});});}exports[_0x57d2('0x17')]=function(_0x5b1b9d){var _0x1cbe4a=this;return new Promise(function(_0xcf924f,_0x55191e){return db['MailMessage'][_0x57d2('0x18')](_0x5b1b9d[_0x57d2('0x19')],{'raw':_0x5b1b9d[_0x57d2('0x1a')]?_0x5b1b9d[_0x57d2('0x1a')][_0x57d2('0x1b')]===undefined?!![]:![]:!![]})[_0x57d2('0xc')](function(_0x32c7c8){logger[_0x57d2('0xd')](_0x57d2('0x17'),_0x5b1b9d);logger[_0x57d2('0x10')](_0x57d2('0x17'),_0x5b1b9d,JSON[_0x57d2('0x12')](_0x32c7c8));_0xcf924f(_0x32c7c8);})[_0x57d2('0x1c')](function(_0x473df2){logger['error'](_0x57d2('0x17'),_0x473df2[_0x57d2('0x15')],_0x5b1b9d);_0x55191e(_0x1cbe4a[_0x57d2('0x13')](0x1f4,_0x473df2[_0x57d2('0x15')]));});});}; \ No newline at end of file +var _0x1eba=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','then','info','request\x20sent','debug','error','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x1eba[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var BPromise=require(_0xa1eb('0x3'));var rs=require(_0xa1eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1eb('0x5'));var logger=require(_0xa1eb('0x6'))(_0xa1eb('0x7'));var config=require(_0xa1eb('0x8'));var jayson=require(_0xa1eb('0x9'));var client=jayson[_0xa1eb('0xa')][_0xa1eb('0xb')]({'port':0x232a});config[_0xa1eb('0xc')]=_[_0xa1eb('0xd')](config[_0xa1eb('0xc')],{'host':_0xa1eb('0xe'),'port':0x18eb});var socket=require(_0xa1eb('0xf'))(new Redis(config['redis']));require(_0xa1eb('0x10'))['register'](socket);function respondWithRpcPromise(_0x219802,_0x54cdad,_0x3f53ff){return new BPromise(function(_0x5d7101,_0x41a7bc){return client['request'](_0x219802,_0x3f53ff)[_0xa1eb('0x11')](function(_0x325d13){logger[_0xa1eb('0x12')]('MailMessage,\x20%s,\x20%s',_0x54cdad,_0xa1eb('0x13'));logger[_0xa1eb('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x54cdad,_0xa1eb('0x13'),JSON['stringify'](_0x325d13));if(_0x325d13['error']){if(_0x325d13[_0xa1eb('0x15')]['code']===0x1f4){logger[_0xa1eb('0x15')](_0xa1eb('0x16'),_0x54cdad,_0x325d13[_0xa1eb('0x15')][_0xa1eb('0x17')]);return _0x41a7bc(_0x325d13[_0xa1eb('0x15')][_0xa1eb('0x17')]);}logger[_0xa1eb('0x15')](_0xa1eb('0x16'),_0x54cdad,_0x325d13[_0xa1eb('0x15')]['message']);return _0x5d7101(_0x325d13[_0xa1eb('0x15')]['message']);}else{logger[_0xa1eb('0x12')](_0xa1eb('0x16'),_0x54cdad,_0xa1eb('0x13'));_0x5d7101(_0x325d13[_0xa1eb('0x18')]['message']);}})[_0xa1eb('0x19')](function(_0x22cd44){logger[_0xa1eb('0x15')](_0xa1eb('0x16'),_0x54cdad,_0x22cd44);_0x41a7bc(_0x22cd44);});});}exports[_0xa1eb('0x1a')]=function(_0x3b8607){var _0x2143e6=this;return new Promise(function(_0x166f7f,_0x4fc14a){return db[_0xa1eb('0x1b')]['create'](_0x3b8607[_0xa1eb('0x1c')],{'raw':_0x3b8607[_0xa1eb('0x1d')]?_0x3b8607[_0xa1eb('0x1d')][_0xa1eb('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x539634){logger[_0xa1eb('0x12')](_0xa1eb('0x1a'),_0x3b8607);logger['debug'](_0xa1eb('0x1a'),_0x3b8607,JSON[_0xa1eb('0x1f')](_0x539634));_0x166f7f(_0x539634);})[_0xa1eb('0x19')](function(_0xa6b20c){logger[_0xa1eb('0x15')](_0xa1eb('0x1a'),_0xa6b20c[_0xa1eb('0x17')],_0x3b8607);_0x4fc14a(_0x2143e6[_0xa1eb('0x15')](0x1f4,_0xa6b20c[_0xa1eb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index b80cfe2..0d3ef51 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 _0x7bbd=['removeListener','register','length','mailMessage:','./mailMessage.events','remove','update','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7bbd,0x12c));var _0xd7bb=function(_0x1da542,_0x249b89){_0x1da542=_0x1da542-0x0;var _0x10ddfb=_0x7bbd[_0x1da542];return _0x10ddfb;};'use strict';var MailMessageEvents=require(_0xd7bb('0x0'));var events=['save',_0xd7bb('0x1'),_0xd7bb('0x2')];function createListener(_0x124766,_0x541164){return function(_0xfb9b2e){_0x541164[_0xd7bb('0x3')](_0x124766,_0xfb9b2e);};}function removeListener(_0x2e646e,_0x2daf7c){return function(){MailMessageEvents[_0xd7bb('0x4')](_0x2e646e,_0x2daf7c);};}exports[_0xd7bb('0x5')]=function(_0x57b42b){for(var _0x498266=0x0,_0x2261c7=events[_0xd7bb('0x6')];_0x498266<_0x2261c7;_0x498266++){var _0x156c57=events[_0x498266];var _0xc331ed=createListener(_0xd7bb('0x7')+_0x156c57,_0x57b42b);MailMessageEvents['on'](_0x156c57,_0xc331ed);}}; \ No newline at end of file +var _0xe4c7=['update','emit','register','mailMessage:','./mailMessage.events','save','remove'];(function(_0x583e0d,_0x1f5487){var _0x2ad393=function(_0x178501){while(--_0x178501){_0x583e0d['push'](_0x583e0d['shift']());}};_0x2ad393(++_0x1f5487);}(_0xe4c7,0x1d2));var _0x7e4c=function(_0x314115,_0x22f606){_0x314115=_0x314115-0x0;var _0x1347df=_0xe4c7[_0x314115];return _0x1347df;};'use strict';var MailMessageEvents=require(_0x7e4c('0x0'));var events=[_0x7e4c('0x1'),_0x7e4c('0x2'),_0x7e4c('0x3')];function createListener(_0x3aeff1,_0x2d294c){return function(_0x5123a7){_0x2d294c[_0x7e4c('0x4')](_0x3aeff1,_0x5123a7);};}function removeListener(_0xfc6b9e,_0x1ae8f4){return function(){MailMessageEvents['removeListener'](_0xfc6b9e,_0x1ae8f4);};}exports[_0x7e4c('0x5')]=function(_0x305963){for(var _0x40b497=0x0,_0x4db23c=events['length'];_0x40b497<_0x4db23c;_0x40b497++){var _0x5a5bb4=events[_0x40b497];var _0x2ca5b6=createListener(_0x7e4c('0x6')+_0x5a5bb4,_0x305963);MailMessageEvents['on'](_0x5a5bb4,_0x2ca5b6);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b4542af..a7673b4 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 _0x6132=['fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/:id','show','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','/:id/teams','exports','util','path','express','Router'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x6132,0xd4));var _0x2613=function(_0x1391bd,_0x230877){_0x1391bd=_0x1391bd-0x0;var _0x27a24a=_0x6132[_0x1391bd];return _0x27a24a;};'use strict';var multer=require('multer');var util=require(_0x2613('0x0'));var path=require(_0x2613('0x1'));var timeout=require('connect-timeout');var express=require(_0x2613('0x2'));var router=express[_0x2613('0x3')]();var fs_extra=require(_0x2613('0x4'));var auth=require(_0x2613('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2613('0x6'));var controller=require(_0x2613('0x7'));router[_0x2613('0x8')]('/',auth[_0x2613('0x9')](),controller[_0x2613('0xa')]);router[_0x2613('0x8')]('/describe',auth[_0x2613('0x9')](),controller['describe']);router[_0x2613('0x8')](_0x2613('0xb'),auth[_0x2613('0x9')](),controller[_0x2613('0xc')]);router[_0x2613('0x8')]('/:id/members',auth[_0x2613('0x9')](),controller[_0x2613('0xd')]);router[_0x2613('0x8')]('/:id/teams',auth[_0x2613('0x9')](),controller[_0x2613('0xe')]);router[_0x2613('0x8')](_0x2613('0xf'),auth[_0x2613('0x9')](),controller[_0x2613('0x10')]);router[_0x2613('0x11')]('/',auth[_0x2613('0x9')](),controller[_0x2613('0x12')]);router[_0x2613('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0x2613('0x13')]);router['post'](_0x2613('0xf'),auth[_0x2613('0x9')](),controller[_0x2613('0x14')]);router[_0x2613('0x15')](_0x2613('0xb'),auth['isAuthenticated'](),controller[_0x2613('0x16')]);router[_0x2613('0x17')]('/:id',auth[_0x2613('0x9')](),controller[_0x2613('0x18')]);router[_0x2613('0x17')](_0x2613('0x19'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x2613('0x17')](_0x2613('0xf'),auth[_0x2613('0x9')](),controller['removeAgents']);module[_0x2613('0x1a')]=router; \ No newline at end of file +var _0x86b0=['describe','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x86b0,0x9d));var _0x086b=function(_0x43e0b0,_0x5e3e4e){_0x43e0b0=_0x43e0b0-0x0;var _0x1f9331=_0x86b0[_0x43e0b0];return _0x1f9331;};'use strict';var multer=require(_0x086b('0x0'));var util=require('util');var path=require(_0x086b('0x1'));var timeout=require('connect-timeout');var express=require(_0x086b('0x2'));var router=express[_0x086b('0x3')]();var fs_extra=require(_0x086b('0x4'));var auth=require(_0x086b('0x5'));var interaction=require(_0x086b('0x6'));var config=require(_0x086b('0x7'));var controller=require(_0x086b('0x8'));router['get']('/',auth[_0x086b('0x9')](),controller[_0x086b('0xa')]);router['get']('/describe',auth[_0x086b('0x9')](),controller[_0x086b('0xb')]);router[_0x086b('0xc')]('/:id',auth[_0x086b('0x9')](),controller['show']);router[_0x086b('0xc')](_0x086b('0xd'),auth[_0x086b('0x9')](),controller[_0x086b('0xe')]);router[_0x086b('0xc')](_0x086b('0xf'),auth[_0x086b('0x9')](),controller[_0x086b('0x10')]);router['get'](_0x086b('0x11'),auth[_0x086b('0x9')](),controller[_0x086b('0x12')]);router[_0x086b('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x086b('0xf'),auth[_0x086b('0x9')](),controller['addTeams']);router[_0x086b('0x13')](_0x086b('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0x086b('0x14')](_0x086b('0x15'),auth[_0x086b('0x9')](),controller[_0x086b('0x16')]);router[_0x086b('0x17')](_0x086b('0x15'),auth[_0x086b('0x9')](),controller[_0x086b('0x18')]);router['delete'](_0x086b('0xf'),auth[_0x086b('0x9')](),controller[_0x086b('0x19')]);router[_0x086b('0x17')](_0x086b('0x11'),auth[_0x086b('0x9')](),controller[_0x086b('0x1a')]);module[_0x086b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 115a5fe..50a8e58 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 _0xa2d7=['rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x563188,_0x157c4d){var _0x211dde=function(_0x175b4b){while(--_0x175b4b){_0x563188['push'](_0x563188['shift']());}};_0x211dde(++_0x157c4d);}(_0xa2d7,0x1a6));var _0x7a2d=function(_0x4e8c6e,_0x45b6d6){_0x4e8c6e=_0x4e8c6e-0x0;var _0x68f77c=_0xa2d7[_0x4e8c6e];return _0x68f77c;};'use strict';var Sequelize=require(_0x7a2d('0x0'));module[_0x7a2d('0x1')]={'name':{'type':Sequelize[_0x7a2d('0x2')],'unique':_0x7a2d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7a2d('0x2')]},'timeout':{'type':Sequelize[_0x7a2d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7a2d('0x5'),'beepall',_0x7a2d('0x6'))}}; \ No newline at end of file +var _0x9f46=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x3ed59d,_0xcdde8b){var _0x108f37=function(_0x191821){while(--_0x191821){_0x3ed59d['push'](_0x3ed59d['shift']());}};_0x108f37(++_0xcdde8b);}(_0x9f46,0x19c));var _0x69f4=function(_0x2bddec,_0x40c658){_0x2bddec=_0x2bddec-0x0;var _0x18e546=_0x9f46[_0x2bddec];return _0x18e546;};'use strict';var Sequelize=require(_0x69f4('0x0'));module[_0x69f4('0x1')]={'name':{'type':Sequelize[_0x69f4('0x2')],'unique':_0x69f4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x69f4('0x2')]},'timeout':{'type':Sequelize[_0x69f4('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x69f4('0x5')](_0x69f4('0x6'),'beepall',_0x69f4('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 9141f88..e66066d 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 _0x37d7=['index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','show','params','include','options','find','catch','create','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','User','updatedAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','field','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','includes','all','union','compact','value','transaction','removeAgents','userMailQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./mailQueue.socket','register','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','get','MailQueues','error','stack','name','send'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x37d7,0x163));var _0x737d=function(_0x1e1d07,_0x299b1e){_0x1e1d07=_0x1e1d07-0x0;var _0x225dce=_0x37d7[_0x1e1d07];return _0x225dce;};'use strict';var emlformat=require(_0x737d('0x0'));var rimraf=require(_0x737d('0x1'));var zipdir=require(_0x737d('0x2'));var jsonpatch=require(_0x737d('0x3'));var rp=require(_0x737d('0x4'));var moment=require('moment');var BPromise=require(_0x737d('0x5'));var Mustache=require('mustache');var util=require(_0x737d('0x6'));var path=require(_0x737d('0x7'));var sox=require(_0x737d('0x8'));var csv=require(_0x737d('0x9'));var ejs=require(_0x737d('0xa'));var fs=require('fs');var fs_extra=require(_0x737d('0xb'));var _=require(_0x737d('0xc'));var squel=require(_0x737d('0xd'));var crypto=require(_0x737d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x737d('0xf'));var toCsv=require(_0x737d('0x9'));var querystring=require('querystring');var Papa=require(_0x737d('0x10'));var Redis=require(_0x737d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x737d('0x12'));var as=require(_0x737d('0x13'));var hardwareService=require(_0x737d('0x14'));var logger=require(_0x737d('0x15'))(_0x737d('0x16'));var utils=require(_0x737d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x737d('0x18'));var db=require(_0x737d('0x19'))['db'];config['redis']=_['defaults'](config[_0x737d('0x1a')],{'host':_0x737d('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x737d('0x1a')]));require(_0x737d('0x1c'))[_0x737d('0x1d')](socket);function respondWithStatusCode(_0x423275,_0x4619dc){_0x4619dc=_0x4619dc||0xcc;return function(_0x1f302e){if(_0x1f302e){return _0x423275['sendStatus'](_0x4619dc);}return _0x423275[_0x737d('0x1e')](_0x4619dc)['end']();};}function respondWithResult(_0x2aca92,_0x2f4c95){_0x2f4c95=_0x2f4c95||0xc8;return function(_0x469a3c){if(_0x469a3c){return _0x2aca92['status'](_0x2f4c95)['json'](_0x469a3c);}};}function respondWithFilteredResult(_0x19d4a3,_0x5111db){return function(_0x5d019f){if(_0x5d019f){var _0x125204=typeof _0x5111db[_0x737d('0x1f')]===_0x737d('0x20')&&typeof _0x5111db[_0x737d('0x21')]===_0x737d('0x20');var _0x466f66=_0x5d019f[_0x737d('0x22')];var _0x1f82fe=_0x125204?0x0:_0x5111db[_0x737d('0x1f')];var _0x15bf2a=_0x125204?_0x5d019f[_0x737d('0x22')]:_0x5111db['offset']+_0x5111db[_0x737d('0x21')];var _0x28be19;if(_0x15bf2a>=_0x466f66){_0x15bf2a=_0x466f66;_0x28be19=0xc8;}else{_0x28be19=0xce;}_0x19d4a3[_0x737d('0x1e')](_0x28be19);return _0x19d4a3['set'](_0x737d('0x23'),_0x1f82fe+'-'+_0x15bf2a+'/'+_0x466f66)[_0x737d('0x24')](_0x5d019f);}return null;};}function patchUpdates(_0x3e6144){return function(_0x12c551){try{jsonpatch[_0x737d('0x25')](_0x12c551,_0x3e6144,!![]);}catch(_0x9075){return BPromise[_0x737d('0x26')](_0x9075);}return _0x12c551[_0x737d('0x27')]();};}function saveUpdates(_0x4b4fad,_0x26d6a3){return function(_0x22c102){if(_0x22c102){return _0x22c102['update'](_0x4b4fad)['then'](function(_0x4ff8e0){return _0x4ff8e0;});}return null;};}function removeEntity(_0x4ea4f1,_0x5cf6cd){return function(_0x572705){if(_0x572705){return _0x572705['destroy']()[_0x737d('0x28')](function(){var _0x34a8d5=_0x572705[_0x737d('0x29')]({'plain':!![]});var _0x37be9c=_0x737d('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x37be9c,'resourceId':_0x34a8d5['id']}})['then'](function(){return _0x572705;});})[_0x737d('0x28')](function(){_0x4ea4f1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x283c01,_0x20f867){return function(_0x597c24){if(!_0x597c24){_0x283c01['sendStatus'](0x194);}return _0x597c24;};}function handleError(_0x106fda,_0x1606e4){_0x1606e4=_0x1606e4||0x1f4;return function(_0x44fa4d){logger[_0x737d('0x2b')](_0x44fa4d[_0x737d('0x2c')]);if(_0x44fa4d[_0x737d('0x2d')]){delete _0x44fa4d[_0x737d('0x2d')];}_0x106fda[_0x737d('0x1e')](_0x1606e4)[_0x737d('0x2e')](_0x44fa4d);};}exports[_0x737d('0x2f')]=function(_0x4cc324,_0x1c4c52){var _0x223ff2={},_0x5bc51b={},_0x165cd5={'count':0x0,'rows':[]};var _0x55c0e2=_[_0x737d('0x30')](db[_0x737d('0x31')][_0x737d('0x32')],function(_0x281b98){return{'name':_0x281b98[_0x737d('0x33')],'type':_0x281b98[_0x737d('0x34')][_0x737d('0x35')]};});_0x5bc51b[_0x737d('0x36')]=_[_0x737d('0x30')](_0x55c0e2,_0x737d('0x2d'));_0x5bc51b[_0x737d('0x37')]=_[_0x737d('0x38')](_0x4cc324['query']);_0x5bc51b[_0x737d('0x39')]=_[_0x737d('0x3a')](_0x5bc51b[_0x737d('0x36')],_0x5bc51b[_0x737d('0x37')]);_0x223ff2[_0x737d('0x3b')]=_[_0x737d('0x3a')](_0x5bc51b['model'],qs[_0x737d('0x3c')](_0x4cc324[_0x737d('0x37')]['fields']));_0x223ff2[_0x737d('0x3b')]=_0x223ff2['attributes'][_0x737d('0x3d')]?_0x223ff2[_0x737d('0x3b')]:_0x5bc51b[_0x737d('0x36')];if(!_0x4cc324['query'][_0x737d('0x3e')]('nolimit')){_0x223ff2[_0x737d('0x21')]=qs['limit'](_0x4cc324['query'][_0x737d('0x21')]);_0x223ff2[_0x737d('0x1f')]=qs['offset'](_0x4cc324[_0x737d('0x37')][_0x737d('0x1f')]);}_0x223ff2[_0x737d('0x3f')]=qs[_0x737d('0x40')](_0x4cc324[_0x737d('0x37')][_0x737d('0x40')]);_0x223ff2['where']=qs[_0x737d('0x39')](_[_0x737d('0x41')](_0x4cc324[_0x737d('0x37')],_0x5bc51b[_0x737d('0x39')]),_0x55c0e2);if(_0x4cc324['query'][_0x737d('0x42')]){_0x223ff2[_0x737d('0x43')]=_['merge'](_0x223ff2[_0x737d('0x43')],{'$or':_[_0x737d('0x30')](_0x55c0e2,function(_0x7e3c1b){if(_0x7e3c1b[_0x737d('0x34')]!==_0x737d('0x44')){var _0x1e4165={};_0x1e4165[_0x7e3c1b[_0x737d('0x2d')]]={'$like':'%'+_0x4cc324[_0x737d('0x37')][_0x737d('0x42')]+'%'};return _0x1e4165;}})});}_0x223ff2=_[_0x737d('0x45')]({},_0x223ff2,_0x4cc324['options']);var _0x4c7009={'where':_0x223ff2['where']};return db['MailQueue']['count'](_0x4c7009)['then'](function(_0x4bccc6){_0x165cd5[_0x737d('0x22')]=_0x4bccc6;if(_0x4cc324[_0x737d('0x37')][_0x737d('0x46')]){_0x223ff2['include']=[{'all':!![]}];}return db[_0x737d('0x31')][_0x737d('0x47')](_0x223ff2);})[_0x737d('0x28')](function(_0x19cf2d){_0x165cd5[_0x737d('0x48')]=_0x19cf2d;return _0x165cd5;})['then'](respondWithFilteredResult(_0x1c4c52,_0x223ff2))['catch'](handleError(_0x1c4c52,null));};exports[_0x737d('0x49')]=function(_0x23161d,_0x33cf4e){var _0x17fe00={'raw':!![],'where':{'id':_0x23161d[_0x737d('0x4a')]['id']}},_0x270d91={};_0x270d91[_0x737d('0x36')]=_['keys'](db[_0x737d('0x31')][_0x737d('0x32')]);_0x270d91[_0x737d('0x37')]=_[_0x737d('0x38')](_0x23161d[_0x737d('0x37')]);_0x270d91[_0x737d('0x39')]=_[_0x737d('0x3a')](_0x270d91['model'],_0x270d91[_0x737d('0x37')]);_0x17fe00[_0x737d('0x3b')]=_[_0x737d('0x3a')](_0x270d91[_0x737d('0x36')],qs[_0x737d('0x3c')](_0x23161d[_0x737d('0x37')][_0x737d('0x3c')]));_0x17fe00[_0x737d('0x3b')]=_0x17fe00[_0x737d('0x3b')][_0x737d('0x3d')]?_0x17fe00[_0x737d('0x3b')]:_0x270d91[_0x737d('0x36')];if(_0x23161d[_0x737d('0x37')][_0x737d('0x46')]){_0x17fe00[_0x737d('0x4b')]=[{'all':!![]}];}_0x17fe00=_[_0x737d('0x45')]({},_0x17fe00,_0x23161d[_0x737d('0x4c')]);return db[_0x737d('0x31')][_0x737d('0x4d')](_0x17fe00)[_0x737d('0x28')](handleEntityNotFound(_0x33cf4e,null))[_0x737d('0x28')](respondWithResult(_0x33cf4e,null))[_0x737d('0x4e')](handleError(_0x33cf4e,null));};exports[_0x737d('0x4f')]=function(_0x229b1d,_0x6ff75b){return db[_0x737d('0x31')][_0x737d('0x4f')](_0x229b1d['body'],{})[_0x737d('0x28')](function(_0x527b83){var _0x4c8624=_0x229b1d['user'][_0x737d('0x29')]({'plain':!![]});if(!_0x4c8624)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c8624[_0x737d('0x50')]===_0x737d('0x51')){var _0x5c46d6=_0x527b83[_0x737d('0x29')]({'plain':!![]});var _0x1bcf26=_0x737d('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x1bcf26,'userProfileId':_0x4c8624[_0x737d('0x52')]},'raw':!![]})['then'](function(_0x2cba52){if(_0x2cba52&&_0x2cba52[_0x737d('0x53')]===0x0){return db[_0x737d('0x54')][_0x737d('0x4f')]({'name':_0x5c46d6[_0x737d('0x2d')],'resourceId':_0x5c46d6['id'],'type':_0x2cba52[_0x737d('0x2d')],'sectionId':_0x2cba52['id']},{})['then'](function(){return _0x527b83;});}else{return _0x527b83;}})[_0x737d('0x4e')](function(_0x5e4767){logger[_0x737d('0x2b')](_0x737d('0x55'),_0x5e4767);throw _0x5e4767;});}return _0x527b83;})[_0x737d('0x28')](respondWithResult(_0x6ff75b,0xc9))[_0x737d('0x4e')](handleError(_0x6ff75b,null));};exports[_0x737d('0x56')]=function(_0x32030c,_0x50f3de){if(_0x32030c[_0x737d('0x57')]['id']){delete _0x32030c[_0x737d('0x57')]['id'];}return db[_0x737d('0x31')][_0x737d('0x4d')]({'where':{'id':_0x32030c[_0x737d('0x4a')]['id']}})[_0x737d('0x28')](handleEntityNotFound(_0x50f3de,null))['then'](saveUpdates(_0x32030c[_0x737d('0x57')],null))[_0x737d('0x28')](respondWithResult(_0x50f3de,null))[_0x737d('0x4e')](handleError(_0x50f3de,null));};exports['destroy']=function(_0xafdfbd,_0x4f2af1){return db[_0x737d('0x31')][_0x737d('0x4d')]({'where':{'id':_0xafdfbd[_0x737d('0x4a')]['id']}})[_0x737d('0x28')](handleEntityNotFound(_0x4f2af1,null))[_0x737d('0x28')](removeEntity(_0x4f2af1,null))[_0x737d('0x4e')](handleError(_0x4f2af1,null));};exports[_0x737d('0x58')]=function(_0x555653,_0x59588f){return db['MailQueue'][_0x737d('0x58')]()[_0x737d('0x28')](respondWithResult(_0x59588f,null))[_0x737d('0x4e')](handleError(_0x59588f,null));};exports[_0x737d('0x59')]=function(_0x112cd2,_0x427519,_0x3ae690){var _0x597edd={'raw':!![],'where':{}},_0x74d912={},_0x4e01e3;return db[_0x737d('0x31')][_0x737d('0x5a')]({'where':{'id':_0x112cd2[_0x737d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x427519,null))['then'](function(_0x1438d1){if(_0x1438d1){_0x4e01e3=_0x1438d1[_0x737d('0x29')]({'plain':!![]});_0x74d912[_0x737d('0x36')]=_['keys'](db[_0x737d('0x5b')]['rawAttributes']);_0x74d912[_0x737d('0x37')]=_['keys'](_0x112cd2[_0x737d('0x37')]);_0x74d912[_0x737d('0x39')]=_[_0x737d('0x3a')](_0x74d912[_0x737d('0x36')],_0x74d912[_0x737d('0x37')]);_0x597edd[_0x737d('0x3b')]=_['intersection'](_0x74d912['model'],qs[_0x737d('0x3c')](_0x112cd2['query'][_0x737d('0x3c')]));_0x597edd[_0x737d('0x3b')]=_0x597edd[_0x737d('0x3b')]['length']?_0x597edd[_0x737d('0x3b')]:_0x74d912['model'];if(!_0x112cd2['query'][_0x737d('0x3e')](_0x737d('0x5c'))){_0x597edd['limit']=qs['limit'](_0x112cd2[_0x737d('0x37')]['limit']);_0x597edd[_0x737d('0x1f')]=qs['offset'](_0x112cd2[_0x737d('0x37')][_0x737d('0x1f')]);}_0x597edd['order']=qs[_0x737d('0x40')](_0x112cd2[_0x737d('0x37')][_0x737d('0x40')]);_0x597edd[_0x737d('0x43')]=qs[_0x737d('0x39')](_[_0x737d('0x41')](_0x112cd2[_0x737d('0x37')],_0x74d912['filters']));_0x597edd['where'][_0x737d('0x5d')]=_0x1438d1['id'];if(_0x112cd2['query'][_0x737d('0x42')]){_0x597edd[_0x737d('0x43')]=_[_0x737d('0x45')](_0x597edd['where'],{'$or':_[_0x737d('0x30')](_0x597edd[_0x737d('0x3b')],function(_0x45402d){var _0xbda28d={};_0xbda28d[_0x45402d]={'$like':'%'+_0x112cd2[_0x737d('0x37')][_0x737d('0x42')]+'%'};return _0xbda28d;})});}_0x597edd=_['merge']({},_0x597edd,_0x112cd2[_0x737d('0x4c')]);return db[_0x737d('0x5b')][_0x737d('0x47')](_0x597edd);}})[_0x737d('0x28')](function(_0x4cef19){if(_0x4cef19){return db[_0x737d('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x4cef19,'UserId'),'role':'agent'},'attributes':['id',_0x737d('0x2d'),'mailPause',_0x737d('0x5f'),'createdAt']});}})[_0x737d('0x28')](function(_0x34686a){if(_0x34686a){return{'count':_0x34686a['count'],'rows':_[_0x737d('0x30')](_0x34686a['rows'],function(_0x33401b){return{'membername':_0x33401b['name'],'UserId':_0x33401b['id'],'queue_name':_0x4e01e3[_0x737d('0x2d')],'MailQueueId':_0x4e01e3['id'],'interface':util[_0x737d('0x60')](_0x737d('0x61'),_0x737d('0x62'),_0x33401b[_0x737d('0x2d')]),'penalty':0x0,'paused':_0x33401b['mailPause'],'createdAt':_0x33401b['createdAt'],'updatedAt':_0x33401b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x737d('0x28')](respondWithFilteredResult(_0x427519,_0x597edd))[_0x737d('0x4e')](handleError(_0x427519,null));};exports[_0x737d('0x63')]=function(_0x1c2080,_0x1f484c,_0x37c0da){var _0x4e3526={};var _0x2267f5={};var _0x47eacd;var _0x1320d5;return db[_0x737d('0x31')][_0x737d('0x5a')]({'where':{'id':_0x1c2080[_0x737d('0x4a')]['id']}})[_0x737d('0x28')](handleEntityNotFound(_0x1f484c,null))[_0x737d('0x28')](function(_0x2128f7){if(_0x2128f7){_0x47eacd=_0x2128f7;_0x2267f5[_0x737d('0x36')]=_[_0x737d('0x38')](db[_0x737d('0x64')][_0x737d('0x32')]);_0x2267f5[_0x737d('0x37')]=_[_0x737d('0x38')](_0x1c2080[_0x737d('0x37')]);_0x2267f5['filters']=_[_0x737d('0x3a')](_0x2267f5[_0x737d('0x36')],_0x2267f5[_0x737d('0x37')]);_0x4e3526[_0x737d('0x3b')]=_['intersection'](_0x2267f5[_0x737d('0x36')],qs['fields'](_0x1c2080[_0x737d('0x37')][_0x737d('0x3c')]));_0x4e3526[_0x737d('0x3b')]=_0x4e3526[_0x737d('0x3b')]['length']?_0x4e3526[_0x737d('0x3b')]:_0x2267f5['model'];_0x4e3526[_0x737d('0x3f')]=qs['sort'](_0x1c2080[_0x737d('0x37')][_0x737d('0x40')]);_0x4e3526['where']=qs[_0x737d('0x39')](_['pick'](_0x1c2080['query'],_0x2267f5['filters']));if(_0x1c2080[_0x737d('0x37')]['filter']){_0x4e3526[_0x737d('0x43')]=_[_0x737d('0x45')](_0x4e3526['where'],{'$or':_[_0x737d('0x30')](_0x4e3526['attributes'],function(_0x698dfd){var _0xcec0cd={};_0xcec0cd[_0x698dfd]={'$like':'%'+_0x1c2080[_0x737d('0x37')][_0x737d('0x42')]+'%'};return _0xcec0cd;})});}_0x4e3526=_['merge']({},_0x4e3526,_0x1c2080[_0x737d('0x4c')]);return _0x47eacd[_0x737d('0x63')](_0x4e3526);}})[_0x737d('0x28')](function(_0x3294d0){if(_0x3294d0){_0x1320d5=_0x3294d0['length'];if(!_0x1c2080[_0x737d('0x37')]['hasOwnProperty']('nolimit')){_0x4e3526[_0x737d('0x21')]=qs[_0x737d('0x21')](_0x1c2080[_0x737d('0x37')][_0x737d('0x21')]);_0x4e3526[_0x737d('0x1f')]=qs[_0x737d('0x1f')](_0x1c2080[_0x737d('0x37')][_0x737d('0x1f')]);}return _0x47eacd[_0x737d('0x63')](_0x4e3526);}})['then'](function(_0x227ab8){if(_0x227ab8){return _0x227ab8?{'count':_0x1320d5,'rows':_0x227ab8}:null;}})[_0x737d('0x28')](respondWithResult(_0x1f484c,null))['catch'](handleError(_0x1f484c,null));};exports[_0x737d('0x65')]=function(_0x5a396e,_0x15103c,_0x4ef8fa){var _0x4db2df=_0x5a396e[_0x737d('0x57')]['ids'];return db[_0x737d('0x64')][_0x737d('0x47')]({'where':{'id':_0x4db2df},'attributes':['id'],'include':[{'model':db[_0x737d('0x5e')],'as':_0x737d('0x66'),'attributes':['id',_0x737d('0x2d'),'online',_0x737d('0x67'),_0x737d('0x68')],'raw':!![]}]})[_0x737d('0x28')](function(_0x389865){if(_0x389865){var _0x518956=_[_0x737d('0x69')](_0x389865,function(_0x4b57f2){var _0x59bd44=_0x4b57f2[_0x737d('0x29')]({'plain':!![]});return _0x59bd44[_0x737d('0x66')];});return db[_0x737d('0x31')][_0x737d('0x4d')]({'where':{'id':_0x5a396e['params']['id']}})['then'](function(_0x55c523){return db[_0x737d('0x6a')]['transaction'](function(_0x29c3b8){return _0x55c523['addTeams'](_0x4db2df,{'transaction':_0x29c3b8})[_0x737d('0x28')](function(){return BPromise[_0x737d('0x6b')](_0x518956,function(_0x263f3f){return db['UserMailQueue'][_0x737d('0x6c')]({'where':{'UserId':_0x263f3f['id'],'MailQueueId':_0x5a396e[_0x737d('0x4a')]['id']},'transaction':_0x29c3b8});});})[_0x737d('0x28')](function(){_0x518956[_0x737d('0x6d')](function(_0x2ecc3a){socket[_0x737d('0x6e')](_0x737d('0x6f'),{'UserId':_0x2ecc3a['id'],'MailQueueId':_0x55c523['id']});});});});});}})['then'](respondWithStatusCode(_0x15103c,null))[_0x737d('0x4e')](handleError(_0x15103c,null));};exports[_0x737d('0x70')]=function(_0x296637,_0x438854,_0x3c53a0){return db['Team'][_0x737d('0x47')]({'where':{'id':_0x296637[_0x737d('0x37')][_0x737d('0x71')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x737d('0x66'),'attributes':['id'],'raw':!![]}]})[_0x737d('0x28')](handleEntityNotFound(_0x438854,null))[_0x737d('0x28')](function(_0x5b5f73){var _0x424c61=_[_0x737d('0x30')](_0x5b5f73,'id');var _0x3df726=[];var _0x4c736b=[];var _0x250282=squel['select']();_0x250282[_0x737d('0x72')]('tq.TeamId')['from']('team_has_mail_queues','tq')['join'](_0x737d('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x737d('0x43')](_0x737d('0x74'),_0x296637[_0x737d('0x4a')]['id']);for(var _0xbd8f6e=0x0;_0xbd8f6e<_0x5b5f73[_0x737d('0x3d')];_0xbd8f6e+=0x1){let _0x60b968=_0x5b5f73[_0xbd8f6e];for(var _0x1cab87=0x0;_0x1cab87<_0x60b968['Agents'][_0x737d('0x3d')];_0x1cab87+=0x1){let _0xbeb8de=_0x60b968[_0x737d('0x66')][_0x1cab87];var _0x510114=_0x250282[_0x737d('0x75')]();_0x510114[_0x737d('0x43')](_0x737d('0x76'),_0xbeb8de['id']);_0x4c736b[_0x737d('0x77')](db[_0x737d('0x6a')][_0x737d('0x37')](_0x510114[_0x737d('0x78')](),{'type':db[_0x737d('0x6a')]['QueryTypes'][_0x737d('0x79')]})[_0x737d('0x28')](function(_0x31607a){if(_0x31607a['length']===0x1){return _0xbeb8de['id'];}else{var _0x3673b0=_['every'](_[_0x737d('0x30')](_0x31607a,'TeamId'),function(_0x115ab7){return _[_0x737d('0x7a')](_0x424c61,_0x115ab7);});if(_0x3673b0){return _0xbeb8de['id'];}}}));}}return BPromise[_0x737d('0x7b')](_0x4c736b)['then'](function(_0x4d7a4e){_0x3df726=_(_0x3df726)[_0x737d('0x7c')](_0x4d7a4e)[_0x737d('0x7d')]()[_0x737d('0x7e')]();return db[_0x737d('0x31')]['find']({'where':{'id':_0x296637[_0x737d('0x4a')]['id']}})[_0x737d('0x28')](function(_0x1026d8){return db[_0x737d('0x6a')][_0x737d('0x7f')](function(_0x909d4d){return _0x1026d8[_0x737d('0x70')](_0x296637['query'][_0x737d('0x71')],{'transaction':_0x909d4d})[_0x737d('0x28')](function(){if(!_['isEmpty'](_0x3df726)){return _0x1026d8[_0x737d('0x80')](_0x3df726,{'transaction':_0x909d4d});}})[_0x737d('0x28')](function(){_0x3df726['forEach'](function(_0x376ba8){socket['emit'](_0x737d('0x81'),{'UserId':_0x376ba8,'MailQueueId':_0x1026d8['id']});});});});});});})[_0x737d('0x28')](respondWithStatusCode(_0x438854,null))[_0x737d('0x4e')](handleError(_0x438854,null));};exports['addAgents']=function(_0x261596,_0x10a121,_0x456d9a){return db['MailQueue'][_0x737d('0x4d')]({'where':{'id':_0x261596[_0x737d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x10a121,null))[_0x737d('0x28')](function(_0x2ebac3){if(_0x2ebac3){return _0x2ebac3[_0x737d('0x82')](_0x261596[_0x737d('0x57')][_0x737d('0x71')],_['omit'](_0x261596['body'],[_0x737d('0x71'),'id'])||{})[_0x737d('0x83')](function(_0xf68f12){for(var _0x5127e0=0x0;_0x5127e0<_0x261596['body'][_0x737d('0x71')][_0x737d('0x3d')];_0x5127e0+=0x1){socket[_0x737d('0x6e')](_0x737d('0x6f'),{'UserId':Number(_0x261596['body'][_0x737d('0x71')][_0x5127e0]),'MailQueueId':Number(_0x261596[_0x737d('0x4a')]['id'])});}return _0xf68f12;});}})[_0x737d('0x28')](respondWithResult(_0x10a121,null))[_0x737d('0x4e')](handleError(_0x10a121,null));};exports[_0x737d('0x80')]=function(_0x3bfb1c,_0x463141,_0x258a4e){return db[_0x737d('0x31')]['find']({'where':{'id':_0x3bfb1c[_0x737d('0x4a')]['id']}})[_0x737d('0x28')](handleEntityNotFound(_0x463141,null))['then'](function(_0xab8e02){if(_0xab8e02){return _0xab8e02[_0x737d('0x80')](_0x3bfb1c[_0x737d('0x37')]['ids'])['then'](function(){if(_[_0x737d('0x84')](_0x3bfb1c['query']['ids'])){for(var _0x4246af=0x0;_0x4246af<_0x3bfb1c['query'][_0x737d('0x71')][_0x737d('0x3d')];_0x4246af+=0x1){socket[_0x737d('0x6e')](_0x737d('0x81'),{'UserId':Number(_0x3bfb1c['query'][_0x737d('0x71')][_0x4246af]),'MailQueueId':Number(_0x3bfb1c[_0x737d('0x4a')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x3bfb1c[_0x737d('0x37')][_0x737d('0x71')]),'MailQueueId':Number(_0x3bfb1c[_0x737d('0x4a')]['id'])});}});}})[_0x737d('0x28')](respondWithStatusCode(_0x463141,null))[_0x737d('0x4e')](handleError(_0x463141,null));};exports[_0x737d('0x85')]=function(_0x275057,_0x176ddc,_0xc7cd72){var _0x5677d={};var _0x278c94={};var _0x22e41b;var _0x359ef5;return db[_0x737d('0x31')]['findOne']({'where':{'id':_0x275057[_0x737d('0x4a')]['id']}})[_0x737d('0x28')](handleEntityNotFound(_0x176ddc,null))[_0x737d('0x28')](function(_0x40b400){if(_0x40b400){_0x22e41b=_0x40b400;_0x278c94[_0x737d('0x36')]=_[_0x737d('0x38')](db[_0x737d('0x5e')][_0x737d('0x32')]);_0x278c94[_0x737d('0x37')]=_[_0x737d('0x38')](_0x275057[_0x737d('0x37')]);_0x278c94['filters']=_[_0x737d('0x3a')](_0x278c94['model'],_0x278c94[_0x737d('0x37')]);_0x5677d['attributes']=_[_0x737d('0x3a')](_0x278c94['model'],qs['fields'](_0x275057['query']['fields']));_0x5677d[_0x737d('0x3b')]=_0x5677d[_0x737d('0x3b')][_0x737d('0x3d')]?_0x5677d[_0x737d('0x3b')]:_0x278c94[_0x737d('0x36')];_0x5677d[_0x737d('0x3f')]=qs[_0x737d('0x40')](_0x275057[_0x737d('0x37')][_0x737d('0x40')]);_0x5677d[_0x737d('0x43')]=qs['filters'](_[_0x737d('0x41')](_0x275057[_0x737d('0x37')],_0x278c94[_0x737d('0x39')]));if(_0x275057['query']['filter']){_0x5677d[_0x737d('0x43')]=_['merge'](_0x5677d['where'],{'$or':_['map'](_0x5677d[_0x737d('0x3b')],function(_0x490c07){var _0x2c93cd={};_0x2c93cd[_0x490c07]={'$like':'%'+_0x275057['query'][_0x737d('0x42')]+'%'};return _0x2c93cd;})});}_0x5677d=_[_0x737d('0x45')]({},_0x5677d,_0x275057[_0x737d('0x4c')]);return _0x22e41b[_0x737d('0x85')](_0x5677d);}})[_0x737d('0x28')](function(_0x4a6fa8){if(_0x4a6fa8){_0x359ef5=_0x4a6fa8[_0x737d('0x3d')];if(!_0x275057[_0x737d('0x37')][_0x737d('0x3e')](_0x737d('0x5c'))){_0x5677d[_0x737d('0x21')]=qs[_0x737d('0x21')](_0x275057['query'][_0x737d('0x21')]);_0x5677d[_0x737d('0x1f')]=qs[_0x737d('0x1f')](_0x275057[_0x737d('0x37')][_0x737d('0x1f')]);}return _0x22e41b[_0x737d('0x85')](_0x5677d);}})[_0x737d('0x28')](function(_0x526a02){if(_0x526a02){return _0x526a02?{'count':_0x359ef5,'rows':_0x526a02}:null;}})[_0x737d('0x28')](respondWithResult(_0x176ddc,null))[_0x737d('0x4e')](handleError(_0x176ddc,null));}; \ No newline at end of file +var _0x1ea1=['length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','rawAttributes','MailQueueId','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','updatedAt','format','SIP','createdAt','getTeams','Team','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','value','removeAgents','userMailQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','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','./mailQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','MailQueues','UserProfileResource','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueue','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x286ec0,_0x4b1dbf){var _0x3cb78f=function(_0x2e5f21){while(--_0x2e5f21){_0x286ec0['push'](_0x286ec0['shift']());}};_0x3cb78f(++_0x4b1dbf);}(_0x1ea1,0xce));var _0x11ea=function(_0x18a655,_0x28e829){_0x18a655=_0x18a655-0x0;var _0x45913f=_0x1ea1[_0x18a655];return _0x45913f;};'use strict';var emlformat=require(_0x11ea('0x0'));var rimraf=require(_0x11ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11ea('0x2'));var rp=require(_0x11ea('0x3'));var moment=require('moment');var BPromise=require(_0x11ea('0x4'));var Mustache=require(_0x11ea('0x5'));var util=require(_0x11ea('0x6'));var path=require(_0x11ea('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x11ea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x11ea('0x9'));var crypto=require(_0x11ea('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x11ea('0xb'));var toCsv=require('to-csv');var querystring=require(_0x11ea('0xc'));var Papa=require('papaparse');var Redis=require(_0x11ea('0xd'));var authService=require(_0x11ea('0xe'));var qs=require(_0x11ea('0xf'));var as=require(_0x11ea('0x10'));var hardwareService=require(_0x11ea('0x11'));var logger=require(_0x11ea('0x12'))(_0x11ea('0x13'));var utils=require('../../config/utils');var config=require(_0x11ea('0x14'));var licenseUtil=require(_0x11ea('0x15'));var db=require(_0x11ea('0x16'))['db'];config[_0x11ea('0x17')]=_[_0x11ea('0x18')](config[_0x11ea('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x11ea('0x19'))[_0x11ea('0x1a')](socket);function respondWithStatusCode(_0x4e4c38,_0x3bc4e3){_0x3bc4e3=_0x3bc4e3||0xcc;return function(_0x22e048){if(_0x22e048){return _0x4e4c38[_0x11ea('0x1b')](_0x3bc4e3);}return _0x4e4c38[_0x11ea('0x1c')](_0x3bc4e3)[_0x11ea('0x1d')]();};}function respondWithResult(_0x42fdd5,_0x263dbe){_0x263dbe=_0x263dbe||0xc8;return function(_0x5a6933){if(_0x5a6933){return _0x42fdd5[_0x11ea('0x1c')](_0x263dbe)[_0x11ea('0x1e')](_0x5a6933);}};}function respondWithFilteredResult(_0x156b35,_0x14537e){return function(_0x32e928){if(_0x32e928){var _0x778d63=typeof _0x14537e[_0x11ea('0x1f')]==='undefined'&&typeof _0x14537e[_0x11ea('0x20')]===_0x11ea('0x21');var _0x593146=_0x32e928[_0x11ea('0x22')];var _0x342481=_0x778d63?0x0:_0x14537e[_0x11ea('0x1f')];var _0x11bed3=_0x778d63?_0x32e928[_0x11ea('0x22')]:_0x14537e[_0x11ea('0x1f')]+_0x14537e[_0x11ea('0x20')];var _0xc50182;if(_0x11bed3>=_0x593146){_0x11bed3=_0x593146;_0xc50182=0xc8;}else{_0xc50182=0xce;}_0x156b35[_0x11ea('0x1c')](_0xc50182);return _0x156b35[_0x11ea('0x23')](_0x11ea('0x24'),_0x342481+'-'+_0x11bed3+'/'+_0x593146)[_0x11ea('0x1e')](_0x32e928);}return null;};}function patchUpdates(_0x24ff12){return function(_0x27ca75){try{jsonpatch[_0x11ea('0x25')](_0x27ca75,_0x24ff12,!![]);}catch(_0xd9c0f5){return BPromise[_0x11ea('0x26')](_0xd9c0f5);}return _0x27ca75[_0x11ea('0x27')]();};}function saveUpdates(_0x3c6653,_0x7df261){return function(_0x2aeec3){if(_0x2aeec3){return _0x2aeec3['update'](_0x3c6653)[_0x11ea('0x28')](function(_0xf6b093){return _0xf6b093;});}return null;};}function removeEntity(_0x4c4f9b,_0x566222){return function(_0x1f074a){if(_0x1f074a){return _0x1f074a[_0x11ea('0x29')]()[_0x11ea('0x28')](function(){var _0xe0802d=_0x1f074a[_0x11ea('0x2a')]({'plain':!![]});var _0x340414=_0x11ea('0x2b');return db[_0x11ea('0x2c')][_0x11ea('0x29')]({'where':{'type':_0x340414,'resourceId':_0xe0802d['id']}})[_0x11ea('0x28')](function(){return _0x1f074a;});})[_0x11ea('0x28')](function(){_0x4c4f9b[_0x11ea('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56fa44,_0x81eb50){return function(_0x3636b0){if(!_0x3636b0){_0x56fa44[_0x11ea('0x1b')](0x194);}return _0x3636b0;};}function handleError(_0x5eba1c,_0x58f734){_0x58f734=_0x58f734||0x1f4;return function(_0x18a80e){logger['error'](_0x18a80e[_0x11ea('0x2d')]);if(_0x18a80e[_0x11ea('0x2e')]){delete _0x18a80e['name'];}_0x5eba1c[_0x11ea('0x1c')](_0x58f734)[_0x11ea('0x2f')](_0x18a80e);};}exports[_0x11ea('0x30')]=function(_0x3c3eba,_0x2b978c){var _0x54206b={},_0x196796={},_0x467391={'count':0x0,'rows':[]};var _0x1a7a14=_[_0x11ea('0x31')](db['MailQueue']['rawAttributes'],function(_0x1b8489){return{'name':_0x1b8489[_0x11ea('0x32')],'type':_0x1b8489[_0x11ea('0x33')][_0x11ea('0x34')]};});_0x196796[_0x11ea('0x35')]=_[_0x11ea('0x31')](_0x1a7a14,'name');_0x196796[_0x11ea('0x36')]=_['keys'](_0x3c3eba[_0x11ea('0x36')]);_0x196796[_0x11ea('0x37')]=_[_0x11ea('0x38')](_0x196796['model'],_0x196796[_0x11ea('0x36')]);_0x54206b['attributes']=_[_0x11ea('0x38')](_0x196796[_0x11ea('0x35')],qs['fields'](_0x3c3eba[_0x11ea('0x36')][_0x11ea('0x39')]));_0x54206b['attributes']=_0x54206b[_0x11ea('0x3a')]['length']?_0x54206b['attributes']:_0x196796['model'];if(!_0x3c3eba[_0x11ea('0x36')][_0x11ea('0x3b')](_0x11ea('0x3c'))){_0x54206b[_0x11ea('0x20')]=qs[_0x11ea('0x20')](_0x3c3eba['query'][_0x11ea('0x20')]);_0x54206b[_0x11ea('0x1f')]=qs[_0x11ea('0x1f')](_0x3c3eba[_0x11ea('0x36')][_0x11ea('0x1f')]);}_0x54206b[_0x11ea('0x3d')]=qs[_0x11ea('0x3e')](_0x3c3eba[_0x11ea('0x36')][_0x11ea('0x3e')]);_0x54206b[_0x11ea('0x3f')]=qs['filters'](_[_0x11ea('0x40')](_0x3c3eba[_0x11ea('0x36')],_0x196796[_0x11ea('0x37')]),_0x1a7a14);if(_0x3c3eba['query'][_0x11ea('0x41')]){_0x54206b['where']=_[_0x11ea('0x42')](_0x54206b[_0x11ea('0x3f')],{'$or':_[_0x11ea('0x31')](_0x1a7a14,function(_0x5ef824){if(_0x5ef824[_0x11ea('0x33')]!==_0x11ea('0x43')){var _0x2de969={};_0x2de969[_0x5ef824[_0x11ea('0x2e')]]={'$like':'%'+_0x3c3eba[_0x11ea('0x36')][_0x11ea('0x41')]+'%'};return _0x2de969;}})});}_0x54206b=_[_0x11ea('0x42')]({},_0x54206b,_0x3c3eba[_0x11ea('0x44')]);var _0x506e5d={'where':_0x54206b['where']};return db[_0x11ea('0x45')][_0x11ea('0x22')](_0x506e5d)['then'](function(_0x4d69c9){_0x467391['count']=_0x4d69c9;if(_0x3c3eba['query'][_0x11ea('0x46')]){_0x54206b[_0x11ea('0x47')]=[{'all':!![]}];}return db[_0x11ea('0x45')][_0x11ea('0x48')](_0x54206b);})[_0x11ea('0x28')](function(_0x473d57){_0x467391[_0x11ea('0x49')]=_0x473d57;return _0x467391;})['then'](respondWithFilteredResult(_0x2b978c,_0x54206b))[_0x11ea('0x4a')](handleError(_0x2b978c,null));};exports[_0x11ea('0x4b')]=function(_0x3a8ee7,_0x1200de){var _0x507adf={'raw':!![],'where':{'id':_0x3a8ee7[_0x11ea('0x4c')]['id']}},_0x1f4dd8={};_0x1f4dd8[_0x11ea('0x35')]=_[_0x11ea('0x4d')](db['MailQueue']['rawAttributes']);_0x1f4dd8[_0x11ea('0x36')]=_[_0x11ea('0x4d')](_0x3a8ee7[_0x11ea('0x36')]);_0x1f4dd8[_0x11ea('0x37')]=_['intersection'](_0x1f4dd8['model'],_0x1f4dd8[_0x11ea('0x36')]);_0x507adf[_0x11ea('0x3a')]=_[_0x11ea('0x38')](_0x1f4dd8[_0x11ea('0x35')],qs[_0x11ea('0x39')](_0x3a8ee7['query']['fields']));_0x507adf['attributes']=_0x507adf['attributes'][_0x11ea('0x4e')]?_0x507adf['attributes']:_0x1f4dd8['model'];if(_0x3a8ee7[_0x11ea('0x36')][_0x11ea('0x46')]){_0x507adf['include']=[{'all':!![]}];}_0x507adf=_['merge']({},_0x507adf,_0x3a8ee7[_0x11ea('0x44')]);return db['MailQueue'][_0x11ea('0x4f')](_0x507adf)['then'](handleEntityNotFound(_0x1200de,null))['then'](respondWithResult(_0x1200de,null))[_0x11ea('0x4a')](handleError(_0x1200de,null));};exports[_0x11ea('0x50')]=function(_0x20e5a2,_0x4761cb){return db[_0x11ea('0x45')][_0x11ea('0x50')](_0x20e5a2['body'],{})[_0x11ea('0x28')](function(_0x29c9b7){var _0x445f31=_0x20e5a2['user'][_0x11ea('0x2a')]({'plain':!![]});if(!_0x445f31)throw new Error(_0x11ea('0x51'));if(_0x445f31[_0x11ea('0x52')]===_0x11ea('0x53')){var _0x24918d=_0x29c9b7[_0x11ea('0x2a')]({'plain':!![]});var _0x5a72ff=_0x11ea('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x5a72ff,'userProfileId':_0x445f31[_0x11ea('0x54')]},'raw':!![]})[_0x11ea('0x28')](function(_0x14fb98){if(_0x14fb98&&_0x14fb98[_0x11ea('0x55')]===0x0){return db[_0x11ea('0x2c')][_0x11ea('0x50')]({'name':_0x24918d['name'],'resourceId':_0x24918d['id'],'type':_0x14fb98['name'],'sectionId':_0x14fb98['id']},{})[_0x11ea('0x28')](function(){return _0x29c9b7;});}else{return _0x29c9b7;}})['catch'](function(_0x222299){logger[_0x11ea('0x56')](_0x11ea('0x57'),_0x222299);throw _0x222299;});}return _0x29c9b7;})[_0x11ea('0x28')](respondWithResult(_0x4761cb,0xc9))[_0x11ea('0x4a')](handleError(_0x4761cb,null));};exports[_0x11ea('0x58')]=function(_0x588a0a,_0x1be1d0){if(_0x588a0a['body']['id']){delete _0x588a0a[_0x11ea('0x59')]['id'];}return db[_0x11ea('0x45')]['find']({'where':{'id':_0x588a0a['params']['id']}})['then'](handleEntityNotFound(_0x1be1d0,null))[_0x11ea('0x28')](saveUpdates(_0x588a0a[_0x11ea('0x59')],null))[_0x11ea('0x28')](respondWithResult(_0x1be1d0,null))[_0x11ea('0x4a')](handleError(_0x1be1d0,null));};exports[_0x11ea('0x29')]=function(_0x294d4f,_0x2df23d){return db['MailQueue'][_0x11ea('0x4f')]({'where':{'id':_0x294d4f[_0x11ea('0x4c')]['id']}})[_0x11ea('0x28')](handleEntityNotFound(_0x2df23d,null))[_0x11ea('0x28')](removeEntity(_0x2df23d,null))['catch'](handleError(_0x2df23d,null));};exports[_0x11ea('0x5a')]=function(_0x35a456,_0x4e1cfc){return db[_0x11ea('0x45')][_0x11ea('0x5a')]()['then'](respondWithResult(_0x4e1cfc,null))[_0x11ea('0x4a')](handleError(_0x4e1cfc,null));};exports[_0x11ea('0x5b')]=function(_0x4bad3f,_0x4a9001,_0x2e975a){var _0xcbb8bf={'raw':!![],'where':{}},_0x44c705={},_0x5bfaeb;return db['MailQueue'][_0x11ea('0x5c')]({'where':{'id':_0x4bad3f[_0x11ea('0x4c')]['id']}})[_0x11ea('0x28')](handleEntityNotFound(_0x4a9001,null))[_0x11ea('0x28')](function(_0x5bb8ef){if(_0x5bb8ef){_0x5bfaeb=_0x5bb8ef[_0x11ea('0x2a')]({'plain':!![]});_0x44c705['model']=_[_0x11ea('0x4d')](db['UserMailQueue'][_0x11ea('0x5d')]);_0x44c705[_0x11ea('0x36')]=_[_0x11ea('0x4d')](_0x4bad3f[_0x11ea('0x36')]);_0x44c705[_0x11ea('0x37')]=_[_0x11ea('0x38')](_0x44c705['model'],_0x44c705['query']);_0xcbb8bf[_0x11ea('0x3a')]=_[_0x11ea('0x38')](_0x44c705['model'],qs['fields'](_0x4bad3f[_0x11ea('0x36')]['fields']));_0xcbb8bf[_0x11ea('0x3a')]=_0xcbb8bf[_0x11ea('0x3a')][_0x11ea('0x4e')]?_0xcbb8bf[_0x11ea('0x3a')]:_0x44c705['model'];if(!_0x4bad3f[_0x11ea('0x36')][_0x11ea('0x3b')](_0x11ea('0x3c'))){_0xcbb8bf['limit']=qs['limit'](_0x4bad3f[_0x11ea('0x36')]['limit']);_0xcbb8bf[_0x11ea('0x1f')]=qs[_0x11ea('0x1f')](_0x4bad3f[_0x11ea('0x36')][_0x11ea('0x1f')]);}_0xcbb8bf[_0x11ea('0x3d')]=qs[_0x11ea('0x3e')](_0x4bad3f[_0x11ea('0x36')][_0x11ea('0x3e')]);_0xcbb8bf['where']=qs[_0x11ea('0x37')](_[_0x11ea('0x40')](_0x4bad3f['query'],_0x44c705[_0x11ea('0x37')]));_0xcbb8bf['where'][_0x11ea('0x5e')]=_0x5bb8ef['id'];if(_0x4bad3f[_0x11ea('0x36')]['filter']){_0xcbb8bf[_0x11ea('0x3f')]=_[_0x11ea('0x42')](_0xcbb8bf['where'],{'$or':_['map'](_0xcbb8bf[_0x11ea('0x3a')],function(_0xdc817e){var _0x53136f={};_0x53136f[_0xdc817e]={'$like':'%'+_0x4bad3f[_0x11ea('0x36')][_0x11ea('0x41')]+'%'};return _0x53136f;})});}_0xcbb8bf=_[_0x11ea('0x42')]({},_0xcbb8bf,_0x4bad3f[_0x11ea('0x44')]);return db[_0x11ea('0x5f')][_0x11ea('0x48')](_0xcbb8bf);}})[_0x11ea('0x28')](function(_0x231ee1){if(_0x231ee1){return db[_0x11ea('0x60')][_0x11ea('0x61')]({'where':{'id':_['map'](_0x231ee1,_0x11ea('0x62')),'role':_0x11ea('0x63')},'attributes':['id','name',_0x11ea('0x64'),_0x11ea('0x65'),'createdAt']});}})['then'](function(_0x8ba581){if(_0x8ba581){return{'count':_0x8ba581['count'],'rows':_[_0x11ea('0x31')](_0x8ba581['rows'],function(_0x32f991){return{'membername':_0x32f991[_0x11ea('0x2e')],'UserId':_0x32f991['id'],'queue_name':_0x5bfaeb['name'],'MailQueueId':_0x5bfaeb['id'],'interface':util[_0x11ea('0x66')]('%s/%s',_0x11ea('0x67'),_0x32f991['name']),'penalty':0x0,'paused':_0x32f991['mailPause'],'createdAt':_0x32f991[_0x11ea('0x68')],'updatedAt':_0x32f991['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x11ea('0x28')](respondWithFilteredResult(_0x4a9001,_0xcbb8bf))[_0x11ea('0x4a')](handleError(_0x4a9001,null));};exports[_0x11ea('0x69')]=function(_0x1fee57,_0x1e9a0f,_0x2c7a55){var _0x25660a={};var _0x521301={};var _0x11c994;var _0x5ec222;return db['MailQueue'][_0x11ea('0x5c')]({'where':{'id':_0x1fee57[_0x11ea('0x4c')]['id']}})[_0x11ea('0x28')](handleEntityNotFound(_0x1e9a0f,null))['then'](function(_0x5226b3){if(_0x5226b3){_0x11c994=_0x5226b3;_0x521301[_0x11ea('0x35')]=_['keys'](db['Team'][_0x11ea('0x5d')]);_0x521301[_0x11ea('0x36')]=_[_0x11ea('0x4d')](_0x1fee57[_0x11ea('0x36')]);_0x521301[_0x11ea('0x37')]=_[_0x11ea('0x38')](_0x521301['model'],_0x521301[_0x11ea('0x36')]);_0x25660a['attributes']=_[_0x11ea('0x38')](_0x521301[_0x11ea('0x35')],qs[_0x11ea('0x39')](_0x1fee57[_0x11ea('0x36')][_0x11ea('0x39')]));_0x25660a[_0x11ea('0x3a')]=_0x25660a['attributes']['length']?_0x25660a[_0x11ea('0x3a')]:_0x521301[_0x11ea('0x35')];_0x25660a[_0x11ea('0x3d')]=qs['sort'](_0x1fee57[_0x11ea('0x36')][_0x11ea('0x3e')]);_0x25660a[_0x11ea('0x3f')]=qs[_0x11ea('0x37')](_[_0x11ea('0x40')](_0x1fee57['query'],_0x521301[_0x11ea('0x37')]));if(_0x1fee57['query'][_0x11ea('0x41')]){_0x25660a[_0x11ea('0x3f')]=_[_0x11ea('0x42')](_0x25660a[_0x11ea('0x3f')],{'$or':_[_0x11ea('0x31')](_0x25660a[_0x11ea('0x3a')],function(_0x3c3eac){var _0x1479e2={};_0x1479e2[_0x3c3eac]={'$like':'%'+_0x1fee57['query'][_0x11ea('0x41')]+'%'};return _0x1479e2;})});}_0x25660a=_[_0x11ea('0x42')]({},_0x25660a,_0x1fee57[_0x11ea('0x44')]);return _0x11c994['getTeams'](_0x25660a);}})['then'](function(_0xe3cac6){if(_0xe3cac6){_0x5ec222=_0xe3cac6[_0x11ea('0x4e')];if(!_0x1fee57[_0x11ea('0x36')][_0x11ea('0x3b')](_0x11ea('0x3c'))){_0x25660a[_0x11ea('0x20')]=qs['limit'](_0x1fee57['query'][_0x11ea('0x20')]);_0x25660a[_0x11ea('0x1f')]=qs[_0x11ea('0x1f')](_0x1fee57[_0x11ea('0x36')][_0x11ea('0x1f')]);}return _0x11c994[_0x11ea('0x69')](_0x25660a);}})[_0x11ea('0x28')](function(_0x22325a){if(_0x22325a){return _0x22325a?{'count':_0x5ec222,'rows':_0x22325a}:null;}})[_0x11ea('0x28')](respondWithResult(_0x1e9a0f,null))['catch'](handleError(_0x1e9a0f,null));};exports['addTeams']=function(_0x3fe39d,_0x55802e,_0x5119cd){var _0x22c938=_0x3fe39d[_0x11ea('0x59')]['ids'];return db[_0x11ea('0x6a')][_0x11ea('0x48')]({'where':{'id':_0x22c938},'attributes':['id'],'include':[{'model':db[_0x11ea('0x60')],'as':'Agents','attributes':['id',_0x11ea('0x2e'),'online',_0x11ea('0x6b'),_0x11ea('0x6c')],'raw':!![]}]})[_0x11ea('0x28')](function(_0x4c1479){if(_0x4c1479){var _0x2c6a37=_['flatMap'](_0x4c1479,function(_0x189f66){var _0x483cd8=_0x189f66[_0x11ea('0x2a')]({'plain':!![]});return _0x483cd8[_0x11ea('0x6d')];});return db[_0x11ea('0x45')]['find']({'where':{'id':_0x3fe39d[_0x11ea('0x4c')]['id']}})[_0x11ea('0x28')](function(_0x22b860){return db[_0x11ea('0x6e')][_0x11ea('0x6f')](function(_0x288f8e){return _0x22b860['addTeams'](_0x22c938,{'transaction':_0x288f8e})[_0x11ea('0x28')](function(){return BPromise[_0x11ea('0x70')](_0x2c6a37,function(_0xab6059){return db[_0x11ea('0x5f')][_0x11ea('0x71')]({'where':{'UserId':_0xab6059['id'],'MailQueueId':_0x3fe39d[_0x11ea('0x4c')]['id']},'transaction':_0x288f8e});});})[_0x11ea('0x28')](function(){_0x2c6a37[_0x11ea('0x72')](function(_0xa0a9bb){socket[_0x11ea('0x73')](_0x11ea('0x74'),{'UserId':_0xa0a9bb['id'],'MailQueueId':_0x22b860['id']});});});});});}})[_0x11ea('0x28')](respondWithStatusCode(_0x55802e,null))['catch'](handleError(_0x55802e,null));};exports[_0x11ea('0x75')]=function(_0x1c74f5,_0xd75e6b,_0x594548){return db[_0x11ea('0x6a')][_0x11ea('0x48')]({'where':{'id':_0x1c74f5['query'][_0x11ea('0x76')]},'attributes':['id'],'include':[{'model':db[_0x11ea('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x11ea('0x28')](handleEntityNotFound(_0xd75e6b,null))[_0x11ea('0x28')](function(_0x54fb66){var _0x3ea2a8=_[_0x11ea('0x31')](_0x54fb66,'id');var _0x4895b0=[];var _0x3ec124=[];var _0x5cd8bf=squel[_0x11ea('0x77')]();_0x5cd8bf[_0x11ea('0x78')](_0x11ea('0x79'))['from'](_0x11ea('0x7a'),'tq')[_0x11ea('0x7b')](_0x11ea('0x7c'),'ut',_0x11ea('0x7d'))[_0x11ea('0x3f')](_0x11ea('0x7e'),_0x1c74f5['params']['id']);for(var _0x3a683f=0x0;_0x3a683f<_0x54fb66[_0x11ea('0x4e')];_0x3a683f+=0x1){let _0x16106a=_0x54fb66[_0x3a683f];for(var _0x587ccf=0x0;_0x587ccf<_0x16106a['Agents'][_0x11ea('0x4e')];_0x587ccf+=0x1){let _0x1e55ba=_0x16106a[_0x11ea('0x6d')][_0x587ccf];var _0x3f5cd9=_0x5cd8bf['clone']();_0x3f5cd9[_0x11ea('0x3f')](_0x11ea('0x7f'),_0x1e55ba['id']);_0x3ec124[_0x11ea('0x80')](db[_0x11ea('0x6e')][_0x11ea('0x36')](_0x3f5cd9[_0x11ea('0x81')](),{'type':db['sequelize'][_0x11ea('0x82')][_0x11ea('0x83')]})[_0x11ea('0x28')](function(_0x4253da){if(_0x4253da[_0x11ea('0x4e')]===0x1){return _0x1e55ba['id'];}else{var _0x54ab65=_['every'](_[_0x11ea('0x31')](_0x4253da,_0x11ea('0x84')),function(_0x14c7b2){return _['includes'](_0x3ea2a8,_0x14c7b2);});if(_0x54ab65){return _0x1e55ba['id'];}}}));}}return BPromise[_0x11ea('0x85')](_0x3ec124)[_0x11ea('0x28')](function(_0x23bfea){_0x4895b0=_(_0x4895b0)[_0x11ea('0x86')](_0x23bfea)['compact']()[_0x11ea('0x87')]();return db['MailQueue'][_0x11ea('0x4f')]({'where':{'id':_0x1c74f5[_0x11ea('0x4c')]['id']}})['then'](function(_0x3cde3a){return db[_0x11ea('0x6e')][_0x11ea('0x6f')](function(_0x5af7bb){return _0x3cde3a['removeTeams'](_0x1c74f5[_0x11ea('0x36')]['ids'],{'transaction':_0x5af7bb})[_0x11ea('0x28')](function(){if(!_['isEmpty'](_0x4895b0)){return _0x3cde3a[_0x11ea('0x88')](_0x4895b0,{'transaction':_0x5af7bb});}})[_0x11ea('0x28')](function(){_0x4895b0[_0x11ea('0x72')](function(_0x347d69){socket['emit'](_0x11ea('0x89'),{'UserId':_0x347d69,'MailQueueId':_0x3cde3a['id']});});});});});});})[_0x11ea('0x28')](respondWithStatusCode(_0xd75e6b,null))[_0x11ea('0x4a')](handleError(_0xd75e6b,null));};exports[_0x11ea('0x8a')]=function(_0x165f46,_0x9156b1,_0x4b5d70){return db[_0x11ea('0x45')][_0x11ea('0x4f')]({'where':{'id':_0x165f46[_0x11ea('0x4c')]['id']}})['then'](handleEntityNotFound(_0x9156b1,null))[_0x11ea('0x28')](function(_0x544b03){if(_0x544b03){return _0x544b03[_0x11ea('0x8a')](_0x165f46['body'][_0x11ea('0x76')],_['omit'](_0x165f46[_0x11ea('0x59')],[_0x11ea('0x76'),'id'])||{})[_0x11ea('0x8b')](function(_0xaecad5){for(var _0x2a2232=0x0;_0x2a2232<_0x165f46[_0x11ea('0x59')]['ids'][_0x11ea('0x4e')];_0x2a2232+=0x1){socket[_0x11ea('0x73')](_0x11ea('0x74'),{'UserId':Number(_0x165f46[_0x11ea('0x59')]['ids'][_0x2a2232]),'MailQueueId':Number(_0x165f46[_0x11ea('0x4c')]['id'])});}return _0xaecad5;});}})[_0x11ea('0x28')](respondWithResult(_0x9156b1,null))[_0x11ea('0x4a')](handleError(_0x9156b1,null));};exports[_0x11ea('0x88')]=function(_0x1a0b45,_0x3d8a92,_0x404338){return db['MailQueue']['find']({'where':{'id':_0x1a0b45[_0x11ea('0x4c')]['id']}})[_0x11ea('0x28')](handleEntityNotFound(_0x3d8a92,null))[_0x11ea('0x28')](function(_0x5546fb){if(_0x5546fb){return _0x5546fb[_0x11ea('0x88')](_0x1a0b45[_0x11ea('0x36')][_0x11ea('0x76')])[_0x11ea('0x28')](function(){if(_[_0x11ea('0x8c')](_0x1a0b45[_0x11ea('0x36')][_0x11ea('0x76')])){for(var _0x537ad8=0x0;_0x537ad8<_0x1a0b45[_0x11ea('0x36')][_0x11ea('0x76')]['length'];_0x537ad8+=0x1){socket[_0x11ea('0x73')](_0x11ea('0x89'),{'UserId':Number(_0x1a0b45[_0x11ea('0x36')]['ids'][_0x537ad8]),'MailQueueId':Number(_0x1a0b45[_0x11ea('0x4c')]['id'])});}}else{socket['emit'](_0x11ea('0x89'),{'UserId':Number(_0x1a0b45['query'][_0x11ea('0x76')]),'MailQueueId':Number(_0x1a0b45[_0x11ea('0x4c')]['id'])});}});}})[_0x11ea('0x28')](respondWithStatusCode(_0x3d8a92,null))[_0x11ea('0x4a')](handleError(_0x3d8a92,null));};exports[_0x11ea('0x8d')]=function(_0x4e934d,_0x2418f2,_0x1e9e5a){var _0x1d8162={};var _0x23b061={};var _0x3aedc3;var _0xa58755;return db['MailQueue'][_0x11ea('0x5c')]({'where':{'id':_0x4e934d['params']['id']}})[_0x11ea('0x28')](handleEntityNotFound(_0x2418f2,null))['then'](function(_0x1bd1fb){if(_0x1bd1fb){_0x3aedc3=_0x1bd1fb;_0x23b061[_0x11ea('0x35')]=_[_0x11ea('0x4d')](db[_0x11ea('0x60')][_0x11ea('0x5d')]);_0x23b061[_0x11ea('0x36')]=_[_0x11ea('0x4d')](_0x4e934d[_0x11ea('0x36')]);_0x23b061['filters']=_[_0x11ea('0x38')](_0x23b061['model'],_0x23b061[_0x11ea('0x36')]);_0x1d8162[_0x11ea('0x3a')]=_[_0x11ea('0x38')](_0x23b061[_0x11ea('0x35')],qs[_0x11ea('0x39')](_0x4e934d[_0x11ea('0x36')][_0x11ea('0x39')]));_0x1d8162[_0x11ea('0x3a')]=_0x1d8162['attributes']['length']?_0x1d8162[_0x11ea('0x3a')]:_0x23b061[_0x11ea('0x35')];_0x1d8162['order']=qs[_0x11ea('0x3e')](_0x4e934d['query']['sort']);_0x1d8162[_0x11ea('0x3f')]=qs[_0x11ea('0x37')](_[_0x11ea('0x40')](_0x4e934d[_0x11ea('0x36')],_0x23b061[_0x11ea('0x37')]));if(_0x4e934d[_0x11ea('0x36')]['filter']){_0x1d8162[_0x11ea('0x3f')]=_[_0x11ea('0x42')](_0x1d8162[_0x11ea('0x3f')],{'$or':_[_0x11ea('0x31')](_0x1d8162[_0x11ea('0x3a')],function(_0x11a1cd){var _0x13ea56={};_0x13ea56[_0x11a1cd]={'$like':'%'+_0x4e934d[_0x11ea('0x36')][_0x11ea('0x41')]+'%'};return _0x13ea56;})});}_0x1d8162=_[_0x11ea('0x42')]({},_0x1d8162,_0x4e934d['options']);return _0x3aedc3[_0x11ea('0x8d')](_0x1d8162);}})[_0x11ea('0x28')](function(_0x12c818){if(_0x12c818){_0xa58755=_0x12c818[_0x11ea('0x4e')];if(!_0x4e934d['query']['hasOwnProperty']('nolimit')){_0x1d8162['limit']=qs[_0x11ea('0x20')](_0x4e934d[_0x11ea('0x36')][_0x11ea('0x20')]);_0x1d8162[_0x11ea('0x1f')]=qs[_0x11ea('0x1f')](_0x4e934d[_0x11ea('0x36')]['offset']);}return _0x3aedc3[_0x11ea('0x8d')](_0x1d8162);}})['then'](function(_0x4881dd){if(_0x4881dd){return _0x4881dd?{'count':_0xa58755,'rows':_0x4881dd}:null;}})[_0x11ea('0x28')](respondWithResult(_0x2418f2,null))[_0x11ea('0x4a')](handleError(_0x2418f2,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index de25702..5f89da6 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 _0xe257=['hasOwnProperty','hook','../../mysqldb','MailQueue','setMaxListeners','save','update','emit'];(function(_0x4756dc,_0x5d6941){var _0x5313d9=function(_0x5f4e70){while(--_0x5f4e70){_0x4756dc['push'](_0x4756dc['shift']());}};_0x5313d9(++_0x5d6941);}(_0xe257,0x1ea));var _0x7e25=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xe257[_0x273c39];return _0x46d6b5;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x7e25('0x0'))['db'][_0x7e25('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7e25('0x2')](0x0);var events={'afterCreate':_0x7e25('0x3'),'afterUpdate':_0x7e25('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4b8994){return function(_0x211fd1,_0x4d2c09,_0x3d214b){MailQueueEvents[_0x7e25('0x5')](_0x4b8994+':'+_0x211fd1['id'],_0x211fd1);MailQueueEvents['emit'](_0x4b8994,_0x211fd1);_0x3d214b(null);};}for(var e in events){if(events[_0x7e25('0x6')](e)){var event=events[e];MailQueue[_0x7e25('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x0da4=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailQueue'];(function(_0x22367a,_0x53aee2){var _0x41659c=function(_0x2659c0){while(--_0x2659c0){_0x22367a['push'](_0x22367a['shift']());}};_0x41659c(++_0x53aee2);}(_0x0da4,0x18d));var _0x40da=function(_0x4d9cb1,_0x5d92ac){_0x4d9cb1=_0x4d9cb1-0x0;var _0x1f3553=_0x0da4[_0x4d9cb1];return _0x1f3553;};'use strict';var EventEmitter=require(_0x40da('0x0'));var MailQueue=require(_0x40da('0x1'))['db'][_0x40da('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x40da('0x3')](0x0);var events={'afterCreate':_0x40da('0x4'),'afterUpdate':_0x40da('0x5'),'afterDestroy':_0x40da('0x6')};function emitEvent(_0x5cc436){return function(_0x10b304,_0x5d040c,_0x4174a3){MailQueueEvents[_0x40da('0x7')](_0x5cc436+':'+_0x10b304['id'],_0x10b304);MailQueueEvents[_0x40da('0x7')](_0x5cc436,_0x10b304);_0x4174a3(null);};}for(var e in events){if(events[_0x40da('0x8')](e)){var event=events[e];MailQueue[_0x40da('0x9')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index fb3b701..4e80c5a 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 _0xcc86=['bluebird','path','rimraf','./mailQueue.attributes','exports','MailQueue','lodash','util','api','moment'];(function(_0x20d667,_0x2255d8){var _0x186204=function(_0x36d3bb){while(--_0x36d3bb){_0x20d667['push'](_0x20d667['shift']());}};_0x186204(++_0x2255d8);}(_0xcc86,0xe2));var _0x6cc8=function(_0x526027,_0x3e492c){_0x526027=_0x526027-0x0;var _0x42f65c=_0xcc86[_0x526027];return _0x42f65c;};'use strict';var _=require(_0x6cc8('0x0'));var util=require(_0x6cc8('0x1'));var logger=require('../../config/logger')(_0x6cc8('0x2'));var moment=require(_0x6cc8('0x3'));var BPromise=require(_0x6cc8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6cc8('0x5'));var rimraf=require(_0x6cc8('0x6'));var config=require('../../config/environment');var attributes=require(_0x6cc8('0x7'));module[_0x6cc8('0x8')]=function(_0x2bd656,_0x5a2ecb){return _0x2bd656['define'](_0x6cc8('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3218=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','mail_queues','lodash'];(function(_0x456401,_0xec2682){var _0x1c9774=function(_0x118a89){while(--_0x118a89){_0x456401['push'](_0x456401['shift']());}};_0x1c9774(++_0xec2682);}(_0x3218,0x185));var _0x8321=function(_0x3d5df9,_0x5b3623){_0x3d5df9=_0x3d5df9-0x0;var _0x50ba39=_0x3218[_0x3d5df9];return _0x50ba39;};'use strict';var _=require(_0x8321('0x0'));var util=require('util');var logger=require(_0x8321('0x1'))(_0x8321('0x2'));var moment=require('moment');var BPromise=require(_0x8321('0x3'));var rp=require(_0x8321('0x4'));var fs=require('fs');var path=require(_0x8321('0x5'));var rimraf=require(_0x8321('0x6'));var config=require(_0x8321('0x7'));var attributes=require(_0x8321('0x8'));module['exports']=function(_0x5f3723,_0x10548){return _0x5f3723['define']('MailQueue',attributes,{'tableName':_0x8321('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 8362d2e..c469abb 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 _0x5959=['client','http','defaults','redis','localhost','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','map','model','ShowMailQueue','find','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x382f22,_0x865aa8){var _0x59f66b=function(_0x13ded9){while(--_0x13ded9){_0x382f22['push'](_0x382f22['shift']());}};_0x59f66b(++_0x865aa8);}(_0x5959,0x17c));var _0x9595=function(_0x4126dc,_0x1430f8){_0x4126dc=_0x4126dc-0x0;var _0xef998b=_0x5959[_0x4126dc];return _0xef998b;};'use strict';var _=require(_0x9595('0x0'));var util=require(_0x9595('0x1'));var moment=require(_0x9595('0x2'));var BPromise=require('bluebird');var rs=require(_0x9595('0x3'));var fs=require('fs');var Redis=require(_0x9595('0x4'));var db=require(_0x9595('0x5'))['db'];var utils=require(_0x9595('0x6'));var logger=require(_0x9595('0x7'))(_0x9595('0x8'));var config=require(_0x9595('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9595('0xa')][_0x9595('0xb')]({'port':0x232a});config['redis']=_[_0x9595('0xc')](config[_0x9595('0xd')],{'host':_0x9595('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2ecd87,_0x358fa8,_0x37c348){return new BPromise(function(_0x1293c6,_0x3345e7){return client[_0x9595('0xf')](_0x2ecd87,_0x37c348)[_0x9595('0x10')](function(_0x160946){logger[_0x9595('0x11')](_0x9595('0x12'),_0x358fa8,'request\x20sent');logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x358fa8,_0x9595('0x13'),JSON[_0x9595('0x14')](_0x160946));if(_0x160946[_0x9595('0x15')]){if(_0x160946['error'][_0x9595('0x16')]===0x1f4){logger[_0x9595('0x15')](_0x9595('0x12'),_0x358fa8,_0x160946[_0x9595('0x15')]['message']);return _0x3345e7(_0x160946[_0x9595('0x15')]['message']);}logger[_0x9595('0x15')]('MailQueue,\x20%s,\x20%s',_0x358fa8,_0x160946['error'][_0x9595('0x17')]);return _0x1293c6(_0x160946[_0x9595('0x15')][_0x9595('0x17')]);}else{logger[_0x9595('0x11')](_0x9595('0x12'),_0x358fa8,_0x9595('0x13'));_0x1293c6(_0x160946[_0x9595('0x18')]['message']);}})[_0x9595('0x19')](function(_0x2b92e7){logger[_0x9595('0x15')](_0x9595('0x12'),_0x358fa8,_0x2b92e7);_0x3345e7(_0x2b92e7);});});}exports[_0x9595('0x1a')]=function(_0x534f59){var _0x275e86=this;return new Promise(function(_0x2c4c1e,_0x5a8d93){return db[_0x9595('0x1b')][_0x9595('0x1c')]({'raw':_0x534f59[_0x9595('0x1d')]?_0x534f59[_0x9595('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x534f59[_0x9595('0x1d')]?_0x534f59[_0x9595('0x1d')][_0x9595('0x1e')]||null:null,'attributes':_0x534f59[_0x9595('0x1d')]?_0x534f59[_0x9595('0x1d')][_0x9595('0x1f')]||null:null,'limit':_0x534f59[_0x9595('0x1d')]?_0x534f59['options'][_0x9595('0x20')]||null:null,'include':_0x534f59[_0x9595('0x1d')]?_0x534f59[_0x9595('0x1d')][_0x9595('0x21')]?_['map'](_0x534f59['options']['include'],function(_0x1131f3){return{'model':db[_0x1131f3['model']],'as':_0x1131f3['as'],'attributes':_0x1131f3[_0x9595('0x1f')],'include':_0x1131f3[_0x9595('0x21')]?_[_0x9595('0x22')](_0x1131f3[_0x9595('0x21')],function(_0x3157a0){return{'model':db[_0x3157a0[_0x9595('0x23')]],'as':_0x3157a0['as'],'attributes':_0x3157a0[_0x9595('0x1f')],'include':_0x3157a0['include']?_[_0x9595('0x22')](_0x3157a0[_0x9595('0x21')],function(_0x57683f){return{'model':db[_0x57683f[_0x9595('0x23')]],'as':_0x57683f['as'],'attributes':_0x57683f[_0x9595('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9595('0x10')](function(_0x433d73){logger[_0x9595('0x11')]('GetMailQueue',_0x534f59);logger['debug'](_0x9595('0x1a'),_0x534f59,JSON[_0x9595('0x14')](_0x433d73));_0x2c4c1e(_0x433d73);})[_0x9595('0x19')](function(_0x353358){logger[_0x9595('0x15')](_0x9595('0x1a'),_0x353358[_0x9595('0x17')],_0x534f59);_0x5a8d93(_0x275e86[_0x9595('0x15')](0x1f4,_0x353358[_0x9595('0x17')]));});});};exports[_0x9595('0x24')]=function(_0x3e2e4b){var _0xaf2cb=this;return new Promise(function(_0x507035,_0x478c85){return db[_0x9595('0x1b')][_0x9595('0x25')]({'raw':_0x3e2e4b['options']?_0x3e2e4b[_0x9595('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3e2e4b['options']?_0x3e2e4b[_0x9595('0x1d')][_0x9595('0x1e')]||null:null,'attributes':_0x3e2e4b[_0x9595('0x1d')]?_0x3e2e4b[_0x9595('0x1d')][_0x9595('0x1f')]||null:null,'include':_0x3e2e4b[_0x9595('0x1d')]?_0x3e2e4b[_0x9595('0x1d')][_0x9595('0x21')]?_['map'](_0x3e2e4b[_0x9595('0x1d')]['include'],function(_0x328a85){return{'model':db[_0x328a85['model']],'as':_0x328a85['as'],'attributes':_0x328a85[_0x9595('0x1f')],'include':_0x328a85[_0x9595('0x21')]?_['map'](_0x328a85[_0x9595('0x21')],function(_0x7fda96){return{'model':db[_0x7fda96[_0x9595('0x23')]],'as':_0x7fda96['as'],'attributes':_0x7fda96['attributes'],'include':_0x7fda96[_0x9595('0x21')]?_[_0x9595('0x22')](_0x7fda96[_0x9595('0x21')],function(_0x2693dd){return{'model':db[_0x2693dd[_0x9595('0x23')]],'as':_0x2693dd['as'],'attributes':_0x2693dd[_0x9595('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9595('0x10')](function(_0x5756d2){logger[_0x9595('0x11')](_0x9595('0x24'),_0x3e2e4b);logger[_0x9595('0x26')](_0x9595('0x24'),_0x3e2e4b,JSON['stringify'](_0x5756d2));_0x507035(_0x5756d2);})[_0x9595('0x19')](function(_0x9ff54c){logger[_0x9595('0x15')]('ShowMailQueue',_0x9ff54c['message'],_0x3e2e4b);_0x478c85(_0xaf2cb[_0x9595('0x15')](0x1f4,_0x9ff54c[_0x9595('0x17')]));});});}; \ No newline at end of file +var _0x6727=['where','attributes','limit','map','include','model','GetMailQueue','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailQueue','options','raw'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x6727,0x17a));var _0x7672=function(_0x1ee7cd,_0x1a314b){_0x1ee7cd=_0x1ee7cd-0x0;var _0x4e0136=_0x6727[_0x1ee7cd];return _0x4e0136;};'use strict';var _=require(_0x7672('0x0'));var util=require(_0x7672('0x1'));var moment=require(_0x7672('0x2'));var BPromise=require(_0x7672('0x3'));var rs=require(_0x7672('0x4'));var fs=require('fs');var Redis=require(_0x7672('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7672('0x6'));var logger=require('../../config/logger')(_0x7672('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7672('0x8')]({'port':0x232a});config[_0x7672('0x9')]=_[_0x7672('0xa')](config[_0x7672('0x9')],{'host':_0x7672('0xb'),'port':0x18eb});var socket=require(_0x7672('0xc'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x7672('0xd')](socket);function respondWithRpcPromise(_0x1d0752,_0x1eb69a,_0x2206b5){return new BPromise(function(_0x147625,_0xcf939b){return client[_0x7672('0xe')](_0x1d0752,_0x2206b5)[_0x7672('0xf')](function(_0x44f956){logger[_0x7672('0x10')](_0x7672('0x11'),_0x1eb69a,_0x7672('0x12'));logger[_0x7672('0x13')](_0x7672('0x14'),_0x1eb69a,_0x7672('0x12'),JSON[_0x7672('0x15')](_0x44f956));if(_0x44f956[_0x7672('0x16')]){if(_0x44f956[_0x7672('0x16')][_0x7672('0x17')]===0x1f4){logger[_0x7672('0x16')](_0x7672('0x11'),_0x1eb69a,_0x44f956['error'][_0x7672('0x18')]);return _0xcf939b(_0x44f956[_0x7672('0x16')][_0x7672('0x18')]);}logger[_0x7672('0x16')](_0x7672('0x11'),_0x1eb69a,_0x44f956[_0x7672('0x16')]['message']);return _0x147625(_0x44f956['error'][_0x7672('0x18')]);}else{logger['info'](_0x7672('0x11'),_0x1eb69a,'request\x20sent');_0x147625(_0x44f956['result'][_0x7672('0x18')]);}})[_0x7672('0x19')](function(_0x284d0a){logger['error'](_0x7672('0x11'),_0x1eb69a,_0x284d0a);_0xcf939b(_0x284d0a);});});}exports['GetMailQueue']=function(_0x4199cb){var _0x46e65=this;return new Promise(function(_0x1e63ad,_0xf9f565){return db[_0x7672('0x1a')]['findAll']({'raw':_0x4199cb[_0x7672('0x1b')]?_0x4199cb[_0x7672('0x1b')][_0x7672('0x1c')]===undefined?!![]:![]:!![],'where':_0x4199cb[_0x7672('0x1b')]?_0x4199cb[_0x7672('0x1b')][_0x7672('0x1d')]||null:null,'attributes':_0x4199cb[_0x7672('0x1b')]?_0x4199cb[_0x7672('0x1b')][_0x7672('0x1e')]||null:null,'limit':_0x4199cb[_0x7672('0x1b')]?_0x4199cb[_0x7672('0x1b')][_0x7672('0x1f')]||null:null,'include':_0x4199cb[_0x7672('0x1b')]?_0x4199cb[_0x7672('0x1b')]['include']?_[_0x7672('0x20')](_0x4199cb['options'][_0x7672('0x21')],function(_0x5e1887){return{'model':db[_0x5e1887[_0x7672('0x22')]],'as':_0x5e1887['as'],'attributes':_0x5e1887[_0x7672('0x1e')],'include':_0x5e1887[_0x7672('0x21')]?_[_0x7672('0x20')](_0x5e1887['include'],function(_0x117588){return{'model':db[_0x117588[_0x7672('0x22')]],'as':_0x117588['as'],'attributes':_0x117588[_0x7672('0x1e')],'include':_0x117588['include']?_[_0x7672('0x20')](_0x117588[_0x7672('0x21')],function(_0x369065){return{'model':db[_0x369065[_0x7672('0x22')]],'as':_0x369065['as'],'attributes':_0x369065[_0x7672('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7672('0xf')](function(_0x59772d){logger[_0x7672('0x10')]('GetMailQueue',_0x4199cb);logger[_0x7672('0x13')](_0x7672('0x23'),_0x4199cb,JSON[_0x7672('0x15')](_0x59772d));_0x1e63ad(_0x59772d);})['catch'](function(_0x425bcd){logger[_0x7672('0x16')](_0x7672('0x23'),_0x425bcd['message'],_0x4199cb);_0xf9f565(_0x46e65['error'](0x1f4,_0x425bcd[_0x7672('0x18')]));});});};exports['ShowMailQueue']=function(_0x7b786){var _0x281689=this;return new Promise(function(_0x4bf5fc,_0x5267b8){return db[_0x7672('0x1a')]['find']({'raw':_0x7b786[_0x7672('0x1b')]?_0x7b786[_0x7672('0x1b')][_0x7672('0x1c')]===undefined?!![]:![]:!![],'where':_0x7b786[_0x7672('0x1b')]?_0x7b786['options'][_0x7672('0x1d')]||null:null,'attributes':_0x7b786[_0x7672('0x1b')]?_0x7b786[_0x7672('0x1b')][_0x7672('0x1e')]||null:null,'include':_0x7b786[_0x7672('0x1b')]?_0x7b786[_0x7672('0x1b')]['include']?_[_0x7672('0x20')](_0x7b786[_0x7672('0x1b')][_0x7672('0x21')],function(_0x4679b0){return{'model':db[_0x4679b0[_0x7672('0x22')]],'as':_0x4679b0['as'],'attributes':_0x4679b0['attributes'],'include':_0x4679b0[_0x7672('0x21')]?_[_0x7672('0x20')](_0x4679b0[_0x7672('0x21')],function(_0x5ad164){return{'model':db[_0x5ad164[_0x7672('0x22')]],'as':_0x5ad164['as'],'attributes':_0x5ad164[_0x7672('0x1e')],'include':_0x5ad164['include']?_[_0x7672('0x20')](_0x5ad164[_0x7672('0x21')],function(_0x31ed7e){return{'model':db[_0x31ed7e['model']],'as':_0x31ed7e['as'],'attributes':_0x31ed7e[_0x7672('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7672('0xf')](function(_0x79bf76){logger['info']('ShowMailQueue',_0x7b786);logger['debug'](_0x7672('0x24'),_0x7b786,JSON['stringify'](_0x79bf76));_0x4bf5fc(_0x79bf76);})['catch'](function(_0x1ab1da){logger[_0x7672('0x16')](_0x7672('0x24'),_0x1ab1da[_0x7672('0x18')],_0x7b786);_0x5267b8(_0x281689[_0x7672('0x16')](0x1f4,_0x1ab1da[_0x7672('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 09fe6dd..e3fc15a 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 _0x253e=['removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x5dff08,_0x41581e){var _0x4031e5=function(_0x3a5d23){while(--_0x3a5d23){_0x5dff08['push'](_0x5dff08['shift']());}};_0x4031e5(++_0x41581e);}(_0x253e,0x1ec));var _0xe253=function(_0x3fc7ad,_0x1b263c){_0x3fc7ad=_0x3fc7ad-0x0;var _0x3f5a29=_0x253e[_0x3fc7ad];return _0x3f5a29;};'use strict';var MailQueueEvents=require(_0xe253('0x0'));var events=[_0xe253('0x1'),_0xe253('0x2'),_0xe253('0x3')];function createListener(_0x30ff29,_0x5f0d6f){return function(_0x3d914d){_0x5f0d6f['emit'](_0x30ff29,_0x3d914d);};}function removeListener(_0x24ca15,_0x3eba){return function(){MailQueueEvents[_0xe253('0x4')](_0x24ca15,_0x3eba);};}exports[_0xe253('0x5')]=function(_0xf9f6a5){for(var _0x38a277=0x0,_0x276993=events[_0xe253('0x6')];_0x38a277<_0x276993;_0x38a277++){var _0x5b742c=events[_0x38a277];var _0x2a44a7=createListener(_0xe253('0x7')+_0x5b742c,_0xf9f6a5);MailQueueEvents['on'](_0x5b742c,_0x2a44a7);}}; \ No newline at end of file +var _0xb2a6=['./mailQueue.events','save','update','emit','length','mailQueue:'];(function(_0x4c4352,_0x10affa){var _0x3b1c59=function(_0x3da944){while(--_0x3da944){_0x4c4352['push'](_0x4c4352['shift']());}};_0x3b1c59(++_0x10affa);}(_0xb2a6,0xf0));var _0x6b2a=function(_0x2b8cc1,_0xa7e9ac){_0x2b8cc1=_0x2b8cc1-0x0;var _0x5bbacc=_0xb2a6[_0x2b8cc1];return _0x5bbacc;};'use strict';var MailQueueEvents=require(_0x6b2a('0x0'));var events=[_0x6b2a('0x1'),'remove',_0x6b2a('0x2')];function createListener(_0x59250d,_0x41f892){return function(_0x2d1353){_0x41f892[_0x6b2a('0x3')](_0x59250d,_0x2d1353);};}function removeListener(_0x133bb3,_0x446ecf){return function(){MailQueueEvents['removeListener'](_0x133bb3,_0x446ecf);};}exports['register']=function(_0x4ba810){for(var _0x45de57=0x0,_0x54b0ce=events[_0x6b2a('0x4')];_0x45de57<_0x54b0ce;_0x45de57++){var _0x2663f2=events[_0x45de57];var _0x3ec52a=createListener(_0x6b2a('0x5')+_0x2663f2,_0x4ba810);MailQueueEvents['on'](_0x2663f2,_0x3ec52a);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index a43ea90..8177dde 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 _0x7c78=['index','/describe','isAuthenticated','describe','/:id','show','post','create','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7c78,0x10f));var _0x87c7=function(_0x38a308,_0xdf9c05){_0x38a308=_0x38a308-0x0;var _0x4934dc=_0x7c78[_0x38a308];return _0x4934dc;};'use strict';var multer=require(_0x87c7('0x0'));var util=require(_0x87c7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x87c7('0x2'));var router=express[_0x87c7('0x3')]();var fs_extra=require(_0x87c7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x87c7('0x5'));var config=require(_0x87c7('0x6'));var controller=require(_0x87c7('0x7'));router[_0x87c7('0x8')]('/',auth['isAuthenticated'](),controller[_0x87c7('0x9')]);router[_0x87c7('0x8')](_0x87c7('0xa'),auth[_0x87c7('0xb')](),controller[_0x87c7('0xc')]);router['get'](_0x87c7('0xd'),auth[_0x87c7('0xb')](),controller[_0x87c7('0xe')]);router[_0x87c7('0xf')]('/',auth[_0x87c7('0xb')](),controller[_0x87c7('0x10')]);router['put'](_0x87c7('0xd'),auth[_0x87c7('0xb')](),controller[_0x87c7('0x11')]);router['delete']('/:id',auth[_0x87c7('0xb')](),controller[_0x87c7('0x12')]);module[_0x87c7('0x13')]=router; \ No newline at end of file +var _0x29e0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5cde2e,_0xc3a449){var _0x106574=function(_0x19f08c){while(--_0x19f08c){_0x5cde2e['push'](_0x5cde2e['shift']());}};_0x106574(++_0xc3a449);}(_0x29e0,0x149));var _0x029e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x029e('0x0'));var util=require(_0x029e('0x1'));var path=require(_0x029e('0x2'));var timeout=require(_0x029e('0x3'));var express=require(_0x029e('0x4'));var router=express[_0x029e('0x5')]();var fs_extra=require(_0x029e('0x6'));var auth=require(_0x029e('0x7'));var interaction=require(_0x029e('0x8'));var config=require(_0x029e('0x9'));var controller=require(_0x029e('0xa'));router[_0x029e('0xb')]('/',auth[_0x029e('0xc')](),controller[_0x029e('0xd')]);router[_0x029e('0xb')](_0x029e('0xe'),auth[_0x029e('0xc')](),controller[_0x029e('0xf')]);router[_0x029e('0xb')](_0x029e('0x10'),auth[_0x029e('0xc')](),controller[_0x029e('0x11')]);router[_0x029e('0x12')]('/',auth[_0x029e('0xc')](),controller[_0x029e('0x13')]);router[_0x029e('0x14')](_0x029e('0x10'),auth[_0x029e('0xc')](),controller[_0x029e('0x15')]);router['delete']('/:id',auth[_0x029e('0xc')](),controller[_0x029e('0x16')]);module[_0x029e('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 0bdd7f1..426d393 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 _0x988c=['STRING','DATE','moment','sequelize'];(function(_0x4bb593,_0x272ed0){var _0x2da2d8=function(_0x4b25e9){while(--_0x4b25e9){_0x4bb593['push'](_0x4bb593['shift']());}};_0x2da2d8(++_0x272ed0);}(_0x988c,0xca));var _0xc988=function(_0x41fae4,_0x5efdf0){_0x41fae4=_0x41fae4-0x0;var _0x5e850e=_0x988c[_0x41fae4];return _0x5e850e;};'use strict';var moment=require(_0xc988('0x0'));var Sequelize=require(_0xc988('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xc988('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc988('0x2')]},'joinAt':{'type':Sequelize[_0xc988('0x3')]},'leaveAt':{'type':Sequelize[_0xc988('0x3')]},'acceptAt':{'type':Sequelize[_0xc988('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xc988('0x2')]}}; \ No newline at end of file +var _0x213f=['exports','STRING','DATE','sequelize'];(function(_0x17244e,_0x2d1f5e){var _0x2953b1=function(_0x453f8f){while(--_0x453f8f){_0x17244e['push'](_0x17244e['shift']());}};_0x2953b1(++_0x2d1f5e);}(_0x213f,0x1c7));var _0xf213=function(_0x29e62e,_0x1cb6ef){_0x29e62e=_0x29e62e-0x0;var _0x916011=_0x213f[_0x29e62e];return _0x916011;};'use strict';var moment=require('moment');var Sequelize=require(_0xf213('0x0'));module[_0xf213('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf213('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf213('0x3')]},'acceptAt':{'type':Sequelize[_0xf213('0x3')]},'exitAt':{'type':Sequelize[_0xf213('0x3')]},'reason':{'type':Sequelize[_0xf213('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 7f2e114..786d7bc 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 _0x1623=['filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','MailQueueReport','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1623,0xab));var _0x3162=function(_0x4858e8,_0x392464){_0x4858e8=_0x4858e8-0x0;var _0x59792c=_0x1623[_0x4858e8];return _0x59792c;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['MailQueueReport'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':!![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));};exports[_0x3162('0x49')]=function(_0x554a03,_0x48b81d){return db['MailQueueReport'][_0x3162('0x49')]()[_0x3162('0x24')](respondWithResult(_0x48b81d,null))[_0x3162('0x42')](handleError(_0x48b81d,null));}; \ No newline at end of file +var _0xb44a=['options','rows','catch','show','params','includeAll','merge','create','body','find','destroy','describe','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','MailQueueReport','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL'];(function(_0x92c4b4,_0x3bb55c){var _0x16a72f=function(_0x46cca9){while(--_0x46cca9){_0x92c4b4['push'](_0x92c4b4['shift']());}};_0x16a72f(++_0x3bb55c);}(_0xb44a,0x1c2));var _0xab44=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0xb44a[_0x1e6e4e];return _0x3d746b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab44('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab44('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xab44('0x2'));var util=require('util');var path=require(_0xab44('0x3'));var sox=require(_0xab44('0x4'));var csv=require(_0xab44('0x5'));var ejs=require(_0xab44('0x6'));var fs=require('fs');var fs_extra=require(_0xab44('0x7'));var _=require(_0xab44('0x8'));var squel=require(_0xab44('0x9'));var crypto=require(_0xab44('0xa'));var jsforce=require(_0xab44('0xb'));var deskjs=require(_0xab44('0xc'));var toCsv=require(_0xab44('0x5'));var querystring=require(_0xab44('0xd'));var Papa=require(_0xab44('0xe'));var Redis=require('ioredis');var authService=require(_0xab44('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xab44('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xab44('0x11'));var utils=require(_0xab44('0x12'));var config=require(_0xab44('0x13'));var licenseUtil=require(_0xab44('0x14'));var db=require(_0xab44('0x15'))['db'];function respondWithStatusCode(_0x237c26,_0x52d282){_0x52d282=_0x52d282||0xcc;return function(_0x57fcff){if(_0x57fcff){return _0x237c26[_0xab44('0x16')](_0x52d282);}return _0x237c26['status'](_0x52d282)[_0xab44('0x17')]();};}function respondWithResult(_0x5ae369,_0x25f611){_0x25f611=_0x25f611||0xc8;return function(_0x15b98a){if(_0x15b98a){return _0x5ae369[_0xab44('0x18')](_0x25f611)[_0xab44('0x19')](_0x15b98a);}};}function respondWithFilteredResult(_0x31404d,_0x41701b){return function(_0x4875df){if(_0x4875df){var _0x51251b=typeof _0x41701b[_0xab44('0x1a')]===_0xab44('0x1b')&&typeof _0x41701b[_0xab44('0x1c')]===_0xab44('0x1b');var _0xffdfbc=_0x4875df[_0xab44('0x1d')];var _0x354b09=_0x51251b?0x0:_0x41701b[_0xab44('0x1a')];var _0x310b15=_0x51251b?_0x4875df[_0xab44('0x1d')]:_0x41701b[_0xab44('0x1a')]+_0x41701b['limit'];var _0xb779bb;if(_0x310b15>=_0xffdfbc){_0x310b15=_0xffdfbc;_0xb779bb=0xc8;}else{_0xb779bb=0xce;}_0x31404d[_0xab44('0x18')](_0xb779bb);return _0x31404d[_0xab44('0x1e')](_0xab44('0x1f'),_0x354b09+'-'+_0x310b15+'/'+_0xffdfbc)[_0xab44('0x19')](_0x4875df);}return null;};}function patchUpdates(_0x5123b1){return function(_0xcd426){try{jsonpatch['apply'](_0xcd426,_0x5123b1,!![]);}catch(_0x1f7311){return BPromise[_0xab44('0x20')](_0x1f7311);}return _0xcd426[_0xab44('0x21')]();};}function saveUpdates(_0x355083,_0x486317){return function(_0x3a2b1d){if(_0x3a2b1d){return _0x3a2b1d[_0xab44('0x22')](_0x355083)[_0xab44('0x23')](function(_0x3b17d5){return _0x3b17d5;});}return null;};}function removeEntity(_0x11f0b,_0x402950){return function(_0x43f1c6){if(_0x43f1c6){return _0x43f1c6['destroy']()['then'](function(){_0x11f0b[_0xab44('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2439f3,_0x5a7269){return function(_0x2a1bbc){if(!_0x2a1bbc){_0x2439f3['sendStatus'](0x194);}return _0x2a1bbc;};}function handleError(_0x531583,_0x8e60fa){_0x8e60fa=_0x8e60fa||0x1f4;return function(_0x25287b){logger[_0xab44('0x24')](_0x25287b[_0xab44('0x25')]);if(_0x25287b[_0xab44('0x26')]){delete _0x25287b['name'];}_0x531583[_0xab44('0x18')](_0x8e60fa)[_0xab44('0x27')](_0x25287b);};}exports['index']=function(_0x887b0d,_0xebb7d1){var _0x21131e={},_0x1cd486={},_0x4550c8={'count':0x0,'rows':[]};var _0xdc50a1=_['map'](db[_0xab44('0x28')][_0xab44('0x29')],function(_0x36f9b6){return{'name':_0x36f9b6['fieldName'],'type':_0x36f9b6['type'][_0xab44('0x2a')]};});_0x1cd486['model']=_['map'](_0xdc50a1,_0xab44('0x26'));_0x1cd486[_0xab44('0x2b')]=_[_0xab44('0x2c')](_0x887b0d[_0xab44('0x2b')]);_0x1cd486[_0xab44('0x2d')]=_[_0xab44('0x2e')](_0x1cd486[_0xab44('0x2f')],_0x1cd486[_0xab44('0x2b')]);_0x21131e[_0xab44('0x30')]=_[_0xab44('0x2e')](_0x1cd486[_0xab44('0x2f')],qs[_0xab44('0x31')](_0x887b0d[_0xab44('0x2b')][_0xab44('0x31')]));_0x21131e['attributes']=_0x21131e['attributes'][_0xab44('0x32')]?_0x21131e[_0xab44('0x30')]:_0x1cd486['model'];if(!_0x887b0d[_0xab44('0x2b')][_0xab44('0x33')](_0xab44('0x34'))){_0x21131e[_0xab44('0x1c')]=qs[_0xab44('0x1c')](_0x887b0d[_0xab44('0x2b')][_0xab44('0x1c')]);_0x21131e[_0xab44('0x1a')]=qs[_0xab44('0x1a')](_0x887b0d[_0xab44('0x2b')][_0xab44('0x1a')]);}_0x21131e[_0xab44('0x35')]=qs[_0xab44('0x36')](_0x887b0d[_0xab44('0x2b')][_0xab44('0x36')]);_0x21131e[_0xab44('0x37')]=qs[_0xab44('0x2d')](_[_0xab44('0x38')](_0x887b0d['query'],_0x1cd486[_0xab44('0x2d')]),_0xdc50a1);if(_0x887b0d[_0xab44('0x2b')][_0xab44('0x39')]){_0x21131e[_0xab44('0x37')]=_['merge'](_0x21131e[_0xab44('0x37')],{'$or':_[_0xab44('0x3a')](_0xdc50a1,function(_0xcd077a){if(_0xcd077a[_0xab44('0x3b')]!==_0xab44('0x3c')){var _0x4f5cf3={};_0x4f5cf3[_0xcd077a[_0xab44('0x26')]]={'$like':'%'+_0x887b0d[_0xab44('0x2b')][_0xab44('0x39')]+'%'};return _0x4f5cf3;}})});}_0x21131e=_['merge']({},_0x21131e,_0x887b0d[_0xab44('0x3d')]);var _0x1e26de={'where':_0x21131e[_0xab44('0x37')]};return db[_0xab44('0x28')][_0xab44('0x1d')](_0x1e26de)['then'](function(_0x1de52d){_0x4550c8['count']=_0x1de52d;if(_0x887b0d[_0xab44('0x2b')]['includeAll']){_0x21131e['include']=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x21131e);})['then'](function(_0x120585){_0x4550c8[_0xab44('0x3e')]=_0x120585;return _0x4550c8;})[_0xab44('0x23')](respondWithFilteredResult(_0xebb7d1,_0x21131e))[_0xab44('0x3f')](handleError(_0xebb7d1,null));};exports[_0xab44('0x40')]=function(_0xf3f37a,_0x19d20d){var _0x33641e={'raw':!![],'where':{'id':_0xf3f37a[_0xab44('0x41')]['id']}},_0x4429e6={};_0x4429e6['model']=_[_0xab44('0x2c')](db[_0xab44('0x28')][_0xab44('0x29')]);_0x4429e6[_0xab44('0x2b')]=_['keys'](_0xf3f37a[_0xab44('0x2b')]);_0x4429e6[_0xab44('0x2d')]=_[_0xab44('0x2e')](_0x4429e6[_0xab44('0x2f')],_0x4429e6[_0xab44('0x2b')]);_0x33641e[_0xab44('0x30')]=_['intersection'](_0x4429e6['model'],qs[_0xab44('0x31')](_0xf3f37a[_0xab44('0x2b')][_0xab44('0x31')]));_0x33641e[_0xab44('0x30')]=_0x33641e[_0xab44('0x30')]['length']?_0x33641e[_0xab44('0x30')]:_0x4429e6[_0xab44('0x2f')];if(_0xf3f37a[_0xab44('0x2b')][_0xab44('0x42')]){_0x33641e['include']=[{'all':!![]}];}_0x33641e=_[_0xab44('0x43')]({},_0x33641e,_0xf3f37a[_0xab44('0x3d')]);return db[_0xab44('0x28')]['find'](_0x33641e)[_0xab44('0x23')](handleEntityNotFound(_0x19d20d,null))[_0xab44('0x23')](respondWithResult(_0x19d20d,null))[_0xab44('0x3f')](handleError(_0x19d20d,null));};exports[_0xab44('0x44')]=function(_0x4eeb65,_0x13892d){return db['MailQueueReport'][_0xab44('0x44')](_0x4eeb65[_0xab44('0x45')],{})[_0xab44('0x23')](respondWithResult(_0x13892d,0xc9))[_0xab44('0x3f')](handleError(_0x13892d,null));};exports['update']=function(_0x328891,_0x5497a3){if(_0x328891[_0xab44('0x45')]['id']){delete _0x328891[_0xab44('0x45')]['id'];}return db[_0xab44('0x28')][_0xab44('0x46')]({'where':{'id':_0x328891[_0xab44('0x41')]['id']}})['then'](handleEntityNotFound(_0x5497a3,null))[_0xab44('0x23')](saveUpdates(_0x328891['body'],null))[_0xab44('0x23')](respondWithResult(_0x5497a3,null))[_0xab44('0x3f')](handleError(_0x5497a3,null));};exports[_0xab44('0x47')]=function(_0x50b705,_0x4463f1){return db[_0xab44('0x28')][_0xab44('0x46')]({'where':{'id':_0x50b705[_0xab44('0x41')]['id']}})[_0xab44('0x23')](handleEntityNotFound(_0x4463f1,null))['then'](removeEntity(_0x4463f1,null))['catch'](handleError(_0x4463f1,null));};exports[_0xab44('0x48')]=function(_0x1b18fb,_0xaa00a1){return db['MailQueueReport'][_0xab44('0x48')]()[_0xab44('0x23')](respondWithResult(_0xaa00a1,null))[_0xab44('0x3f')](handleError(_0xaa00a1,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index cec02bf..94385f5 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 _0xa473=['request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa473,0x89));var _0x3a47=function(_0x5b9c76,_0x4fc91b){_0x5b9c76=_0x5b9c76-0x0;var _0x33793b=_0xa473[_0x5b9c76];return _0x33793b;};'use strict';var _=require(_0x3a47('0x0'));var util=require(_0x3a47('0x1'));var logger=require(_0x3a47('0x2'))(_0x3a47('0x3'));var moment=require(_0x3a47('0x4'));var BPromise=require(_0x3a47('0x5'));var rp=require(_0x3a47('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a47('0x7'));var config=require(_0x3a47('0x8'));var attributes=require(_0x3a47('0x9'));module['exports']=function(_0x84dabe,_0x193884){return _0x84dabe['define']('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x3a47('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd18c=['../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4f3008,_0x4a4b5c){var _0x673197=function(_0x74b739){while(--_0x74b739){_0x4f3008['push'](_0x4f3008['shift']());}};_0x673197(++_0x4a4b5c);}(_0xd18c,0xa2));var _0xcd18=function(_0x351b4c,_0x5d78f5){_0x351b4c=_0x351b4c-0x0;var _0x4de136=_0xd18c[_0x351b4c];return _0x4de136;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xcd18('0x0'));var moment=require(_0xcd18('0x1'));var BPromise=require(_0xcd18('0x2'));var rp=require(_0xcd18('0x3'));var fs=require('fs');var path=require(_0xcd18('0x4'));var rimraf=require(_0xcd18('0x5'));var config=require(_0xcd18('0x6'));var attributes=require(_0xcd18('0x7'));module[_0xcd18('0x8')]=function(_0x5dd703,_0x59d2f1){return _0x5dd703[_0xcd18('0x9')](_0xcd18('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xcd18('0xb'),'fields':[_0xcd18('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 2d5aad1..a36474d 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 _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x4c88d2,_0x455f74){var _0x5ed9fb=function(_0x1867e1){while(--_0x1867e1){_0x4c88d2['push'](_0x4c88d2['shift']());}};_0x5ed9fb(++_0x455f74);}(_0xadb5,0xad));var _0x5adb=function(_0x3da4b5,_0x207798){_0x3da4b5=_0x3da4b5-0x0;var _0x4051f1=_0xadb5[_0x3da4b5];return _0x4051f1;};'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']('MailQueueReport,\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);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x58bf98,_0x3ff23c){var _0x4dadcc=function(_0x5358e3){while(--_0x5358e3){_0x58bf98['push'](_0x58bf98['shift']());}};_0x4dadcc(++_0x3ff23c);}(_0xadb5,0xad));var _0x5adb=function(_0x2774c0,_0x2852fb){_0x2774c0=_0x2774c0-0x0;var _0x4f820c=_0xadb5[_0x2774c0];return _0x4f820c;};'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']('MailQueueReport,\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);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 4c78330..8cf04b4 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3cc6dd,_0x5b6122){var _0x41317f=function(_0xc96af2){while(--_0xc96af2){_0x3cc6dd['push'](_0x3cc6dd['shift']());}};_0x41317f(++_0x5b6122);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ab3d9,_0x50e716){_0x2ab3d9=_0x2ab3d9-0x0;var _0x210a54=_0xcb91[_0x2ab3d9];return _0x210a54;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2948b8,_0x5f5188){var _0x44b2ca=function(_0x524bb6){while(--_0x524bb6){_0x2948b8['push'](_0x2948b8['shift']());}};_0x44b2ca(++_0x5f5188);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0xcb91[_0x2de0a7];return _0x429437;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index d77f089..b4ba4e2 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 _0x41bb=['exports','STRING','INTEGER','BOOLEAN','INBOX','sequelize'];(function(_0x514671,_0x1c5290){var _0xd8a14d=function(_0x1af03b){while(--_0x1af03b){_0x514671['push'](_0x514671['shift']());}};_0xd8a14d(++_0x1c5290);}(_0x41bb,0xc5));var _0xb41b=function(_0x1e8b08,_0x5a6bd0){_0x1e8b08=_0x1e8b08-0x0;var _0x5d7a01=_0x41bb[_0x1e8b08];return _0x5d7a01;};'use strict';var Sequelize=require(_0xb41b('0x0'));module[_0xb41b('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb41b('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xb41b('0x2')]},'password':{'type':Sequelize[_0xb41b('0x2')]},'port':{'type':Sequelize[_0xb41b('0x3')]},'tls':{'type':Sequelize[_0xb41b('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xb41b('0x5')},'connTimeout':{'type':Sequelize[_0xb41b('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb41b('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3c81=['sequelize','exports','STRING','BOOLEAN','INBOX','INTEGER'];(function(_0x15eb9f,_0x1142b1){var _0x1e0d35=function(_0x1b6c3d){while(--_0x1b6c3d){_0x15eb9f['push'](_0x15eb9f['shift']());}};_0x1e0d35(++_0x1142b1);}(_0x3c81,0x102));var _0x13c8=function(_0xe705e9,_0x4999e1){_0xe705e9=_0xe705e9-0x0;var _0x43da2b=_0x3c81[_0xe705e9];return _0x43da2b;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x13c8('0x2')]},'authentication':{'type':Sequelize[_0x13c8('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x4')},'connTimeout':{'type':Sequelize[_0x13c8('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x13c8('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x13c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 650e027..ee1a263 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 _0x2c86=['MailServerIn','mail_servers_in','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define'];(function(_0x5b2fc7,_0x35184f){var _0xb3545c=function(_0x5279e6){while(--_0x5279e6){_0x5b2fc7['push'](_0x5b2fc7['shift']());}};_0xb3545c(++_0x35184f);}(_0x2c86,0xce));var _0x62c8=function(_0x5684f5,_0x35fd41){_0x5684f5=_0x5684f5-0x0;var _0x169b29=_0x2c86[_0x5684f5];return _0x169b29;};'use strict';var _=require(_0x62c8('0x0'));var util=require('util');var logger=require(_0x62c8('0x1'))(_0x62c8('0x2'));var moment=require('moment');var BPromise=require(_0x62c8('0x3'));var rp=require(_0x62c8('0x4'));var fs=require('fs');var path=require(_0x62c8('0x5'));var rimraf=require('rimraf');var config=require(_0x62c8('0x6'));var attributes=require(_0x62c8('0x7'));module[_0x62c8('0x8')]=function(_0x4bb9db,_0x587540){return _0x4bb9db[_0x62c8('0x9')](_0x62c8('0xa'),attributes,{'tableName':_0x62c8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0d0=['../../config/logger','api','moment','bluebird','request-promise','path','MailServerIn','lodash','util'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xc0d0,0xb2));var _0x0c0d=function(_0x56a061,_0x53fb1b){_0x56a061=_0x56a061-0x0;var _0x105fa0=_0xc0d0[_0x56a061];return _0x105fa0;};'use strict';var _=require(_0x0c0d('0x0'));var util=require(_0x0c0d('0x1'));var logger=require(_0x0c0d('0x2'))(_0x0c0d('0x3'));var moment=require(_0x0c0d('0x4'));var BPromise=require(_0x0c0d('0x5'));var rp=require(_0x0c0d('0x6'));var fs=require('fs');var path=require(_0x0c0d('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x521fec,_0x2b4018){return _0x521fec['define'](_0x0c0d('0x8'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 144f0c6..2e1ff36 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 _0xb32d=['result','options','where','limit','include','model','attributes','GetMailServerIn','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xb32d,0x1da));var _0xdb32=function(_0x328305,_0x19098d){_0x328305=_0x328305-0x0;var _0xf0347=_0xb32d[_0x328305];return _0xf0347;};'use strict';var _=require(_0xdb32('0x0'));var util=require(_0xdb32('0x1'));var moment=require(_0xdb32('0x2'));var BPromise=require(_0xdb32('0x3'));var rs=require(_0xdb32('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdb32('0x5'));var logger=require(_0xdb32('0x6'))('rpc');var config=require(_0xdb32('0x7'));var jayson=require(_0xdb32('0x8'));var client=jayson[_0xdb32('0x9')][_0xdb32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6f4af0,_0x386309,_0x5bb076){return new BPromise(function(_0x3b0995,_0x2686db){return client[_0xdb32('0xb')](_0x6f4af0,_0x5bb076)[_0xdb32('0xc')](function(_0x30e03d){logger[_0xdb32('0xd')](_0xdb32('0xe'),_0x386309,_0xdb32('0xf'));logger[_0xdb32('0x10')](_0xdb32('0x11'),_0x386309,_0xdb32('0xf'),JSON[_0xdb32('0x12')](_0x30e03d));if(_0x30e03d[_0xdb32('0x13')]){if(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x14')]===0x1f4){logger[_0xdb32('0x13')](_0xdb32('0xe'),_0x386309,_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);return _0x2686db(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);}logger['error'](_0xdb32('0xe'),_0x386309,_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);return _0x3b0995(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);}else{logger['info'](_0xdb32('0xe'),_0x386309,_0xdb32('0xf'));_0x3b0995(_0x30e03d[_0xdb32('0x16')]['message']);}})['catch'](function(_0x59a5f8){logger['error'](_0xdb32('0xe'),_0x386309,_0x59a5f8);_0x2686db(_0x59a5f8);});});}exports['GetMailServerIn']=function(_0x1fd22b){var _0xfab49a=this;return new Promise(function(_0x1ba5f4,_0x301cc3){return db['MailServerIn']['findAll']({'raw':_0x1fd22b['options']?_0x1fd22b[_0xdb32('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1fd22b[_0xdb32('0x17')]?_0x1fd22b[_0xdb32('0x17')][_0xdb32('0x18')]||null:null,'attributes':_0x1fd22b[_0xdb32('0x17')]?_0x1fd22b[_0xdb32('0x17')]['attributes']||null:null,'limit':_0x1fd22b[_0xdb32('0x17')]?_0x1fd22b[_0xdb32('0x17')][_0xdb32('0x19')]||null:null,'include':_0x1fd22b['options']?_0x1fd22b['options'][_0xdb32('0x1a')]?_['map'](_0x1fd22b['options'][_0xdb32('0x1a')],function(_0x14b5fd){return{'model':db[_0x14b5fd[_0xdb32('0x1b')]],'as':_0x14b5fd['as'],'attributes':_0x14b5fd[_0xdb32('0x1c')],'include':_0x14b5fd['include']?_['map'](_0x14b5fd[_0xdb32('0x1a')],function(_0x2168d9){return{'model':db[_0x2168d9[_0xdb32('0x1b')]],'as':_0x2168d9['as'],'attributes':_0x2168d9['attributes'],'include':_0x2168d9[_0xdb32('0x1a')]?_['map'](_0x2168d9[_0xdb32('0x1a')],function(_0x17f627){return{'model':db[_0x17f627[_0xdb32('0x1b')]],'as':_0x17f627['as'],'attributes':_0x17f627[_0xdb32('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdb32('0xc')](function(_0x5d29da){logger['info'](_0xdb32('0x1d'),_0x1fd22b);logger['debug'](_0xdb32('0x1d'),_0x1fd22b,JSON[_0xdb32('0x12')](_0x5d29da));_0x1ba5f4(_0x5d29da);})[_0xdb32('0x1e')](function(_0x5a6109){logger['error'](_0xdb32('0x1d'),_0x5a6109[_0xdb32('0x15')],_0x1fd22b);_0x301cc3(_0xfab49a[_0xdb32('0x13')](0x1f4,_0x5a6109['message']));});});}; \ No newline at end of file +var _0xcdd2=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','MailServerIn,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','map','include','model','then','debug','stringify','lodash','util','bluebird'];(function(_0x26c792,_0x4f392c){var _0x3bc2cc=function(_0x2e5125){while(--_0x2e5125){_0x26c792['push'](_0x26c792['shift']());}};_0x3bc2cc(++_0x4f392c);}(_0xcdd2,0x13d));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var moment=require('moment');var BPromise=require(_0x2cdd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cdd('0x3'));var db=require(_0x2cdd('0x4'))['db'];var utils=require(_0x2cdd('0x5'));var logger=require('../../config/logger')(_0x2cdd('0x6'));var config=require(_0x2cdd('0x7'));var jayson=require(_0x2cdd('0x8'));var client=jayson[_0x2cdd('0x9')][_0x2cdd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dd0d4,_0x8b9856,_0x3a4498){return new BPromise(function(_0x25e2f8,_0x1e63f3){return client['request'](_0x3dd0d4,_0x3a4498)['then'](function(_0x28b7c7){logger[_0x2cdd('0xb')](_0x2cdd('0xc'),_0x8b9856,_0x2cdd('0xd'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x8b9856,_0x2cdd('0xd'),JSON['stringify'](_0x28b7c7));if(_0x28b7c7[_0x2cdd('0xe')]){if(_0x28b7c7[_0x2cdd('0xe')][_0x2cdd('0xf')]===0x1f4){logger[_0x2cdd('0xe')](_0x2cdd('0xc'),_0x8b9856,_0x28b7c7[_0x2cdd('0xe')][_0x2cdd('0x10')]);return _0x1e63f3(_0x28b7c7[_0x2cdd('0xe')][_0x2cdd('0x10')]);}logger[_0x2cdd('0xe')](_0x2cdd('0xc'),_0x8b9856,_0x28b7c7[_0x2cdd('0xe')][_0x2cdd('0x10')]);return _0x25e2f8(_0x28b7c7['error'][_0x2cdd('0x10')]);}else{logger['info'](_0x2cdd('0xc'),_0x8b9856,_0x2cdd('0xd'));_0x25e2f8(_0x28b7c7[_0x2cdd('0x11')][_0x2cdd('0x10')]);}})[_0x2cdd('0x12')](function(_0x7ae468){logger[_0x2cdd('0xe')](_0x2cdd('0xc'),_0x8b9856,_0x7ae468);_0x1e63f3(_0x7ae468);});});}exports[_0x2cdd('0x13')]=function(_0x21a3c8){var _0x5039b4=this;return new Promise(function(_0x2b4a69,_0x26dcfa){return db[_0x2cdd('0x14')][_0x2cdd('0x15')]({'raw':_0x21a3c8[_0x2cdd('0x16')]?_0x21a3c8[_0x2cdd('0x16')][_0x2cdd('0x17')]===undefined?!![]:![]:!![],'where':_0x21a3c8['options']?_0x21a3c8[_0x2cdd('0x16')][_0x2cdd('0x18')]||null:null,'attributes':_0x21a3c8['options']?_0x21a3c8[_0x2cdd('0x16')][_0x2cdd('0x19')]||null:null,'limit':_0x21a3c8['options']?_0x21a3c8[_0x2cdd('0x16')]['limit']||null:null,'include':_0x21a3c8[_0x2cdd('0x16')]?_0x21a3c8[_0x2cdd('0x16')]['include']?_[_0x2cdd('0x1a')](_0x21a3c8[_0x2cdd('0x16')][_0x2cdd('0x1b')],function(_0x1ca25d){return{'model':db[_0x1ca25d[_0x2cdd('0x1c')]],'as':_0x1ca25d['as'],'attributes':_0x1ca25d[_0x2cdd('0x19')],'include':_0x1ca25d[_0x2cdd('0x1b')]?_[_0x2cdd('0x1a')](_0x1ca25d['include'],function(_0x16b1d4){return{'model':db[_0x16b1d4[_0x2cdd('0x1c')]],'as':_0x16b1d4['as'],'attributes':_0x16b1d4[_0x2cdd('0x19')],'include':_0x16b1d4[_0x2cdd('0x1b')]?_[_0x2cdd('0x1a')](_0x16b1d4[_0x2cdd('0x1b')],function(_0x5d8b47){return{'model':db[_0x5d8b47[_0x2cdd('0x1c')]],'as':_0x5d8b47['as'],'attributes':_0x5d8b47[_0x2cdd('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2cdd('0x1d')](function(_0x2f1982){logger[_0x2cdd('0xb')]('GetMailServerIn',_0x21a3c8);logger[_0x2cdd('0x1e')](_0x2cdd('0x13'),_0x21a3c8,JSON[_0x2cdd('0x1f')](_0x2f1982));_0x2b4a69(_0x2f1982);})[_0x2cdd('0x12')](function(_0x5b003d){logger[_0x2cdd('0xe')](_0x2cdd('0x13'),_0x5b003d[_0x2cdd('0x10')],_0x21a3c8);_0x26dcfa(_0x5039b4[_0x2cdd('0xe')](0x1f4,_0x5b003d[_0x2cdd('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 3fb6f95..b2baf61 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(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x7a54,0x106));var _0x47a5=function(_0x355a54,_0x4d1b34){_0x355a54=_0x355a54-0x0;var _0x47e660=_0x7a54[_0x355a54];return _0x47e660;};'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(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7a54,0x106));var _0x47a5=function(_0x25449c,_0xf5d52e){_0x25449c=_0x25449c-0x0;var _0x13bc0d=_0x7a54[_0x25449c];return _0x13bc0d;};'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 49322d1..3406f8d 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 _0x5bfa=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x5bfa,0x70));var _0xa5bf=function(_0x2da357,_0x1f9b2f){_0x2da357=_0x2da357-0x0;var _0x138fdd=_0x5bfa[_0x2da357];return _0x138fdd;};'use strict';var Sequelize=require(_0xa5bf('0x0'));module['exports']={'description':{'type':Sequelize[_0xa5bf('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xa5bf('0x1')]},'port':{'type':Sequelize[_0xa5bf('0x2')]},'secure':{'type':Sequelize[_0xa5bf('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xa5bf('0x1')]},'authentication':{'type':Sequelize[_0xa5bf('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6e0e=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x4f09de,_0x511292){var _0x51b215=function(_0x2e5846){while(--_0x2e5846){_0x4f09de['push'](_0x4f09de['shift']());}};_0x51b215(++_0x511292);}(_0x6e0e,0x8a));var _0xe6e0=function(_0x336a8a,_0x3da52c){_0x336a8a=_0x336a8a-0x0;var _0x46f497=_0x6e0e[_0x336a8a];return _0x46f497;};'use strict';var Sequelize=require('sequelize');module[_0xe6e0('0x0')]={'description':{'type':Sequelize[_0xe6e0('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xe6e0('0x1')]},'port':{'type':Sequelize[_0xe6e0('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xe6e0('0x1')]},'authentication':{'type':Sequelize[_0xe6e0('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 1d580c7..ff0dc25 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 _0x9817=['filter','merge','VIRTUAL','options','MailServerOut','includeAll','include','findAll','rows','catch','show','keys','fields','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','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','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1dc0b9,_0x43ffca){var _0x20013a=function(_0x147ffa){while(--_0x147ffa){_0x1dc0b9['push'](_0x1dc0b9['shift']());}};_0x20013a(++_0x43ffca);}(_0x9817,0x131));var _0x7981=function(_0x4ff99b,_0x440e66){_0x4ff99b=_0x4ff99b-0x0;var _0x1f1e1c=_0x9817[_0x4ff99b];return _0x1f1e1c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7981('0x0'));var jsonpatch=require(_0x7981('0x1'));var rp=require(_0x7981('0x2'));var moment=require(_0x7981('0x3'));var BPromise=require(_0x7981('0x4'));var Mustache=require(_0x7981('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7981('0x6'));var csv=require(_0x7981('0x7'));var ejs=require(_0x7981('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7981('0x9'));var crypto=require(_0x7981('0xa'));var jsforce=require(_0x7981('0xb'));var deskjs=require(_0x7981('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7981('0xd'));var Redis=require(_0x7981('0xe'));var authService=require(_0x7981('0xf'));var qs=require(_0x7981('0x10'));var as=require(_0x7981('0x11'));var hardwareService=require(_0x7981('0x12'));var logger=require('../../config/logger')(_0x7981('0x13'));var utils=require(_0x7981('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7981('0x15'));var db=require(_0x7981('0x16'))['db'];function respondWithStatusCode(_0x5ac5ed,_0x86bf3f){_0x86bf3f=_0x86bf3f||0xcc;return function(_0x2b237b){if(_0x2b237b){return _0x5ac5ed['sendStatus'](_0x86bf3f);}return _0x5ac5ed[_0x7981('0x17')](_0x86bf3f)['end']();};}function respondWithResult(_0x52bbe1,_0x3e7de4){_0x3e7de4=_0x3e7de4||0xc8;return function(_0x56f2c1){if(_0x56f2c1){return _0x52bbe1['status'](_0x3e7de4)['json'](_0x56f2c1);}};}function respondWithFilteredResult(_0x209c71,_0x2a00b3){return function(_0x3dbf02){if(_0x3dbf02){var _0x15a81d=typeof _0x2a00b3[_0x7981('0x18')]==='undefined'&&typeof _0x2a00b3[_0x7981('0x19')]===_0x7981('0x1a');var _0x18f3de=_0x3dbf02[_0x7981('0x1b')];var _0x21aa7c=_0x15a81d?0x0:_0x2a00b3[_0x7981('0x18')];var _0x172ab5=_0x15a81d?_0x3dbf02[_0x7981('0x1b')]:_0x2a00b3[_0x7981('0x18')]+_0x2a00b3[_0x7981('0x19')];var _0x133189;if(_0x172ab5>=_0x18f3de){_0x172ab5=_0x18f3de;_0x133189=0xc8;}else{_0x133189=0xce;}_0x209c71[_0x7981('0x17')](_0x133189);return _0x209c71[_0x7981('0x1c')](_0x7981('0x1d'),_0x21aa7c+'-'+_0x172ab5+'/'+_0x18f3de)['json'](_0x3dbf02);}return null;};}function patchUpdates(_0x296ce9){return function(_0x510288){try{jsonpatch[_0x7981('0x1e')](_0x510288,_0x296ce9,!![]);}catch(_0x254477){return BPromise[_0x7981('0x1f')](_0x254477);}return _0x510288[_0x7981('0x20')]();};}function saveUpdates(_0x3913a3,_0x3db961){return function(_0x3596aa){if(_0x3596aa){return _0x3596aa['update'](_0x3913a3)[_0x7981('0x21')](function(_0x381f9d){return _0x381f9d;});}return null;};}function removeEntity(_0xbddba8,_0x53f509){return function(_0x524111){if(_0x524111){return _0x524111[_0x7981('0x22')]()[_0x7981('0x21')](function(){_0xbddba8['status'](0xcc)[_0x7981('0x23')]();});}};}function handleEntityNotFound(_0xf1ab12,_0x34c915){return function(_0x5e6bc6){if(!_0x5e6bc6){_0xf1ab12[_0x7981('0x24')](0x194);}return _0x5e6bc6;};}function handleError(_0x507f61,_0x1f8364){_0x1f8364=_0x1f8364||0x1f4;return function(_0x54deb1){logger['error'](_0x54deb1[_0x7981('0x25')]);if(_0x54deb1[_0x7981('0x26')]){delete _0x54deb1[_0x7981('0x26')];}_0x507f61[_0x7981('0x17')](_0x1f8364)[_0x7981('0x27')](_0x54deb1);};}exports['index']=function(_0x29728e,_0x2110f2){var _0x715bcc={},_0x4e5b78={},_0x17e4fc={'count':0x0,'rows':[]};var _0x387a93=_[_0x7981('0x28')](db['MailServerOut'][_0x7981('0x29')],function(_0x4aba3b){return{'name':_0x4aba3b['fieldName'],'type':_0x4aba3b[_0x7981('0x2a')][_0x7981('0x2b')]};});_0x4e5b78[_0x7981('0x2c')]=_['map'](_0x387a93,_0x7981('0x26'));_0x4e5b78[_0x7981('0x2d')]=_['keys'](_0x29728e[_0x7981('0x2d')]);_0x4e5b78[_0x7981('0x2e')]=_[_0x7981('0x2f')](_0x4e5b78['model'],_0x4e5b78[_0x7981('0x2d')]);_0x715bcc[_0x7981('0x30')]=_[_0x7981('0x2f')](_0x4e5b78[_0x7981('0x2c')],qs['fields'](_0x29728e['query']['fields']));_0x715bcc['attributes']=_0x715bcc['attributes'][_0x7981('0x31')]?_0x715bcc[_0x7981('0x30')]:_0x4e5b78[_0x7981('0x2c')];if(!_0x29728e['query'][_0x7981('0x32')](_0x7981('0x33'))){_0x715bcc['limit']=qs[_0x7981('0x19')](_0x29728e[_0x7981('0x2d')][_0x7981('0x19')]);_0x715bcc[_0x7981('0x18')]=qs[_0x7981('0x18')](_0x29728e['query'][_0x7981('0x18')]);}_0x715bcc[_0x7981('0x34')]=qs[_0x7981('0x35')](_0x29728e[_0x7981('0x2d')][_0x7981('0x35')]);_0x715bcc[_0x7981('0x36')]=qs[_0x7981('0x2e')](_['pick'](_0x29728e[_0x7981('0x2d')],_0x4e5b78['filters']),_0x387a93);if(_0x29728e[_0x7981('0x2d')][_0x7981('0x37')]){_0x715bcc[_0x7981('0x36')]=_[_0x7981('0x38')](_0x715bcc[_0x7981('0x36')],{'$or':_[_0x7981('0x28')](_0x387a93,function(_0x2e5346){if(_0x2e5346[_0x7981('0x2a')]!==_0x7981('0x39')){var _0x268a7d={};_0x268a7d[_0x2e5346['name']]={'$like':'%'+_0x29728e['query'][_0x7981('0x37')]+'%'};return _0x268a7d;}})});}_0x715bcc=_[_0x7981('0x38')]({},_0x715bcc,_0x29728e[_0x7981('0x3a')]);var _0x392a49={'where':_0x715bcc[_0x7981('0x36')]};return db[_0x7981('0x3b')][_0x7981('0x1b')](_0x392a49)['then'](function(_0x47e2d1){_0x17e4fc['count']=_0x47e2d1;if(_0x29728e[_0x7981('0x2d')][_0x7981('0x3c')]){_0x715bcc[_0x7981('0x3d')]=[{'all':!![]}];}return db[_0x7981('0x3b')][_0x7981('0x3e')](_0x715bcc);})[_0x7981('0x21')](function(_0x4bcf07){_0x17e4fc[_0x7981('0x3f')]=_0x4bcf07;return _0x17e4fc;})[_0x7981('0x21')](respondWithFilteredResult(_0x2110f2,_0x715bcc))[_0x7981('0x40')](handleError(_0x2110f2,null));};exports[_0x7981('0x41')]=function(_0x1ab802,_0x406723){var _0x4fd48a={'raw':!![],'where':{'id':_0x1ab802['params']['id']}},_0x22417f={};_0x22417f[_0x7981('0x2c')]=_[_0x7981('0x42')](db[_0x7981('0x3b')][_0x7981('0x29')]);_0x22417f['query']=_[_0x7981('0x42')](_0x1ab802[_0x7981('0x2d')]);_0x22417f[_0x7981('0x2e')]=_['intersection'](_0x22417f[_0x7981('0x2c')],_0x22417f['query']);_0x4fd48a['attributes']=_['intersection'](_0x22417f['model'],qs['fields'](_0x1ab802[_0x7981('0x2d')][_0x7981('0x43')]));_0x4fd48a['attributes']=_0x4fd48a['attributes']['length']?_0x4fd48a[_0x7981('0x30')]:_0x22417f[_0x7981('0x2c')];if(_0x1ab802[_0x7981('0x2d')][_0x7981('0x3c')]){_0x4fd48a[_0x7981('0x3d')]=[{'all':!![]}];}_0x4fd48a=_['merge']({},_0x4fd48a,_0x1ab802[_0x7981('0x3a')]);return db[_0x7981('0x3b')][_0x7981('0x44')](_0x4fd48a)[_0x7981('0x21')](handleEntityNotFound(_0x406723,null))[_0x7981('0x21')](respondWithResult(_0x406723,null))[_0x7981('0x40')](handleError(_0x406723,null));};exports[_0x7981('0x45')]=function(_0x1e0dd5,_0x5ce6ad){return db['MailServerOut'][_0x7981('0x45')](_0x1e0dd5[_0x7981('0x46')],{})[_0x7981('0x21')](respondWithResult(_0x5ce6ad,0xc9))['catch'](handleError(_0x5ce6ad,null));};exports['update']=function(_0x117b9c,_0x7975ba){if(_0x117b9c[_0x7981('0x46')]['id']){delete _0x117b9c['body']['id'];}return db[_0x7981('0x3b')][_0x7981('0x44')]({'where':{'id':_0x117b9c[_0x7981('0x47')]['id']}})['then'](handleEntityNotFound(_0x7975ba,null))[_0x7981('0x21')](saveUpdates(_0x117b9c[_0x7981('0x46')],null))[_0x7981('0x21')](respondWithResult(_0x7975ba,null))[_0x7981('0x40')](handleError(_0x7975ba,null));};exports[_0x7981('0x22')]=function(_0x2ec514,_0x489d7c){return db[_0x7981('0x3b')][_0x7981('0x44')]({'where':{'id':_0x2ec514[_0x7981('0x47')]['id']}})[_0x7981('0x21')](handleEntityNotFound(_0x489d7c,null))['then'](removeEntity(_0x489d7c,null))[_0x7981('0x40')](handleError(_0x489d7c,null));}; \ No newline at end of file +var _0xbb51=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','apply','update','then','destroy','end','index','map','MailServerOut','rawAttributes','type','key','model','name','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x5717ce,_0x5ac43a){var _0x36103b=function(_0xc1bdfc){while(--_0xc1bdfc){_0x5717ce['push'](_0x5717ce['shift']());}};_0x36103b(++_0x5ac43a);}(_0xbb51,0x1ab));var _0x1bb5=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xbb51[_0x20589d];return _0x422de9;};'use strict';var emlformat=require(_0x1bb5('0x0'));var rimraf=require(_0x1bb5('0x1'));var zipdir=require(_0x1bb5('0x2'));var jsonpatch=require(_0x1bb5('0x3'));var rp=require(_0x1bb5('0x4'));var moment=require(_0x1bb5('0x5'));var BPromise=require(_0x1bb5('0x6'));var Mustache=require('mustache');var util=require(_0x1bb5('0x7'));var path=require(_0x1bb5('0x8'));var sox=require(_0x1bb5('0x9'));var csv=require(_0x1bb5('0xa'));var ejs=require(_0x1bb5('0xb'));var fs=require('fs');var fs_extra=require(_0x1bb5('0xc'));var _=require(_0x1bb5('0xd'));var squel=require(_0x1bb5('0xe'));var crypto=require(_0x1bb5('0xf'));var jsforce=require(_0x1bb5('0x10'));var deskjs=require(_0x1bb5('0x11'));var toCsv=require(_0x1bb5('0xa'));var querystring=require(_0x1bb5('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1bb5('0x13'));var qs=require(_0x1bb5('0x14'));var as=require(_0x1bb5('0x15'));var hardwareService=require(_0x1bb5('0x16'));var logger=require(_0x1bb5('0x17'))(_0x1bb5('0x18'));var utils=require(_0x1bb5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1bb5('0x1a'));var db=require(_0x1bb5('0x1b'))['db'];function respondWithStatusCode(_0xf7d4dc,_0x1c4a0a){_0x1c4a0a=_0x1c4a0a||0xcc;return function(_0x3bb141){if(_0x3bb141){return _0xf7d4dc[_0x1bb5('0x1c')](_0x1c4a0a);}return _0xf7d4dc[_0x1bb5('0x1d')](_0x1c4a0a)['end']();};}function respondWithResult(_0x4e7242,_0xc089e9){_0xc089e9=_0xc089e9||0xc8;return function(_0x2f6737){if(_0x2f6737){return _0x4e7242[_0x1bb5('0x1d')](_0xc089e9)['json'](_0x2f6737);}};}function respondWithFilteredResult(_0x547d99,_0x203cbb){return function(_0x101aaf){if(_0x101aaf){var _0x32add1=typeof _0x203cbb[_0x1bb5('0x1e')]===_0x1bb5('0x1f')&&typeof _0x203cbb[_0x1bb5('0x20')]===_0x1bb5('0x1f');var _0x285900=_0x101aaf[_0x1bb5('0x21')];var _0x36a9f4=_0x32add1?0x0:_0x203cbb[_0x1bb5('0x1e')];var _0xb53788=_0x32add1?_0x101aaf['count']:_0x203cbb['offset']+_0x203cbb[_0x1bb5('0x20')];var _0x3db4ee;if(_0xb53788>=_0x285900){_0xb53788=_0x285900;_0x3db4ee=0xc8;}else{_0x3db4ee=0xce;}_0x547d99[_0x1bb5('0x1d')](_0x3db4ee);return _0x547d99['set']('Content-Range',_0x36a9f4+'-'+_0xb53788+'/'+_0x285900)['json'](_0x101aaf);}return null;};}function patchUpdates(_0x1be969){return function(_0x5299a0){try{jsonpatch[_0x1bb5('0x22')](_0x5299a0,_0x1be969,!![]);}catch(_0x3aeb50){return BPromise['reject'](_0x3aeb50);}return _0x5299a0['save']();};}function saveUpdates(_0xaebfc7,_0x55ef7f){return function(_0x410cac){if(_0x410cac){return _0x410cac[_0x1bb5('0x23')](_0xaebfc7)[_0x1bb5('0x24')](function(_0x5169bd){return _0x5169bd;});}return null;};}function removeEntity(_0x3863b0,_0x10948f){return function(_0x33fb1a){if(_0x33fb1a){return _0x33fb1a[_0x1bb5('0x25')]()['then'](function(){_0x3863b0[_0x1bb5('0x1d')](0xcc)[_0x1bb5('0x26')]();});}};}function handleEntityNotFound(_0x55a428,_0xce68cb){return function(_0x106828){if(!_0x106828){_0x55a428[_0x1bb5('0x1c')](0x194);}return _0x106828;};}function handleError(_0x67edfe,_0x3ca553){_0x3ca553=_0x3ca553||0x1f4;return function(_0x14399d){logger['error'](_0x14399d['stack']);if(_0x14399d['name']){delete _0x14399d['name'];}_0x67edfe['status'](_0x3ca553)['send'](_0x14399d);};}exports[_0x1bb5('0x27')]=function(_0x267ac5,_0x2df2d7){var _0x51dc08={},_0x2044f4={},_0x118ad0={'count':0x0,'rows':[]};var _0x3cf5cf=_[_0x1bb5('0x28')](db[_0x1bb5('0x29')][_0x1bb5('0x2a')],function(_0x5ca7c7){return{'name':_0x5ca7c7['fieldName'],'type':_0x5ca7c7[_0x1bb5('0x2b')][_0x1bb5('0x2c')]};});_0x2044f4[_0x1bb5('0x2d')]=_[_0x1bb5('0x28')](_0x3cf5cf,_0x1bb5('0x2e'));_0x2044f4['query']=_[_0x1bb5('0x2f')](_0x267ac5['query']);_0x2044f4[_0x1bb5('0x30')]=_[_0x1bb5('0x31')](_0x2044f4[_0x1bb5('0x2d')],_0x2044f4[_0x1bb5('0x32')]);_0x51dc08['attributes']=_[_0x1bb5('0x31')](_0x2044f4['model'],qs[_0x1bb5('0x33')](_0x267ac5['query'][_0x1bb5('0x33')]));_0x51dc08['attributes']=_0x51dc08[_0x1bb5('0x34')][_0x1bb5('0x35')]?_0x51dc08[_0x1bb5('0x34')]:_0x2044f4[_0x1bb5('0x2d')];if(!_0x267ac5['query'][_0x1bb5('0x36')]('nolimit')){_0x51dc08[_0x1bb5('0x20')]=qs['limit'](_0x267ac5[_0x1bb5('0x32')][_0x1bb5('0x20')]);_0x51dc08[_0x1bb5('0x1e')]=qs[_0x1bb5('0x1e')](_0x267ac5[_0x1bb5('0x32')][_0x1bb5('0x1e')]);}_0x51dc08[_0x1bb5('0x37')]=qs[_0x1bb5('0x38')](_0x267ac5[_0x1bb5('0x32')][_0x1bb5('0x38')]);_0x51dc08['where']=qs[_0x1bb5('0x30')](_[_0x1bb5('0x39')](_0x267ac5[_0x1bb5('0x32')],_0x2044f4['filters']),_0x3cf5cf);if(_0x267ac5['query'][_0x1bb5('0x3a')]){_0x51dc08[_0x1bb5('0x3b')]=_[_0x1bb5('0x3c')](_0x51dc08[_0x1bb5('0x3b')],{'$or':_['map'](_0x3cf5cf,function(_0x53c861){if(_0x53c861['type']!==_0x1bb5('0x3d')){var _0x4ee4dc={};_0x4ee4dc[_0x53c861[_0x1bb5('0x2e')]]={'$like':'%'+_0x267ac5[_0x1bb5('0x32')]['filter']+'%'};return _0x4ee4dc;}})});}_0x51dc08=_[_0x1bb5('0x3c')]({},_0x51dc08,_0x267ac5[_0x1bb5('0x3e')]);var _0x5c6bbd={'where':_0x51dc08['where']};return db[_0x1bb5('0x29')][_0x1bb5('0x21')](_0x5c6bbd)[_0x1bb5('0x24')](function(_0x348cee){_0x118ad0[_0x1bb5('0x21')]=_0x348cee;if(_0x267ac5['query'][_0x1bb5('0x3f')]){_0x51dc08['include']=[{'all':!![]}];}return db[_0x1bb5('0x29')][_0x1bb5('0x40')](_0x51dc08);})[_0x1bb5('0x24')](function(_0x5598ca){_0x118ad0[_0x1bb5('0x41')]=_0x5598ca;return _0x118ad0;})['then'](respondWithFilteredResult(_0x2df2d7,_0x51dc08))['catch'](handleError(_0x2df2d7,null));};exports[_0x1bb5('0x42')]=function(_0x12f3d7,_0x3e9a01){var _0xb7440e={'raw':!![],'where':{'id':_0x12f3d7[_0x1bb5('0x43')]['id']}},_0x4cd62b={};_0x4cd62b[_0x1bb5('0x2d')]=_[_0x1bb5('0x2f')](db[_0x1bb5('0x29')][_0x1bb5('0x2a')]);_0x4cd62b[_0x1bb5('0x32')]=_[_0x1bb5('0x2f')](_0x12f3d7['query']);_0x4cd62b[_0x1bb5('0x30')]=_[_0x1bb5('0x31')](_0x4cd62b[_0x1bb5('0x2d')],_0x4cd62b['query']);_0xb7440e[_0x1bb5('0x34')]=_['intersection'](_0x4cd62b[_0x1bb5('0x2d')],qs['fields'](_0x12f3d7[_0x1bb5('0x32')][_0x1bb5('0x33')]));_0xb7440e['attributes']=_0xb7440e[_0x1bb5('0x34')][_0x1bb5('0x35')]?_0xb7440e['attributes']:_0x4cd62b[_0x1bb5('0x2d')];if(_0x12f3d7[_0x1bb5('0x32')][_0x1bb5('0x3f')]){_0xb7440e[_0x1bb5('0x44')]=[{'all':!![]}];}_0xb7440e=_[_0x1bb5('0x3c')]({},_0xb7440e,_0x12f3d7[_0x1bb5('0x3e')]);return db[_0x1bb5('0x29')]['find'](_0xb7440e)[_0x1bb5('0x24')](handleEntityNotFound(_0x3e9a01,null))['then'](respondWithResult(_0x3e9a01,null))[_0x1bb5('0x45')](handleError(_0x3e9a01,null));};exports['create']=function(_0x1cba7a,_0x2c4beb){return db[_0x1bb5('0x29')][_0x1bb5('0x46')](_0x1cba7a[_0x1bb5('0x47')],{})[_0x1bb5('0x24')](respondWithResult(_0x2c4beb,0xc9))[_0x1bb5('0x45')](handleError(_0x2c4beb,null));};exports[_0x1bb5('0x23')]=function(_0x4fabd7,_0x331f58){if(_0x4fabd7[_0x1bb5('0x47')]['id']){delete _0x4fabd7[_0x1bb5('0x47')]['id'];}return db['MailServerOut'][_0x1bb5('0x48')]({'where':{'id':_0x4fabd7[_0x1bb5('0x43')]['id']}})[_0x1bb5('0x24')](handleEntityNotFound(_0x331f58,null))[_0x1bb5('0x24')](saveUpdates(_0x4fabd7[_0x1bb5('0x47')],null))[_0x1bb5('0x24')](respondWithResult(_0x331f58,null))[_0x1bb5('0x45')](handleError(_0x331f58,null));};exports[_0x1bb5('0x25')]=function(_0x59c779,_0xe5f8c8){return db[_0x1bb5('0x29')][_0x1bb5('0x48')]({'where':{'id':_0x59c779['params']['id']}})[_0x1bb5('0x24')](handleEntityNotFound(_0xe5f8c8,null))[_0x1bb5('0x24')](removeEntity(_0xe5f8c8,null))[_0x1bb5('0x45')](handleError(_0xe5f8c8,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 36ba456..aa868bf 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 _0x52e8=['request-promise','path','exports','define','MailServerOut','mail_servers_out','lodash','util','api','bluebird'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x52e8,0x128));var _0x852e=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x52e8[_0xdd2bfa];return _0x55397e;};'use strict';var _=require(_0x852e('0x0'));var util=require(_0x852e('0x1'));var logger=require('../../config/logger')(_0x852e('0x2'));var moment=require('moment');var BPromise=require(_0x852e('0x3'));var rp=require(_0x852e('0x4'));var fs=require('fs');var path=require(_0x852e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module[_0x852e('0x6')]=function(_0x241dfd,_0x15f260){return _0x241dfd[_0x852e('0x7')](_0x852e('0x8'),attributes,{'tableName':_0x852e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc170=['mail_servers_out','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailServerOut.attributes','exports','MailServerOut'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xc170,0x1ae));var _0x0c17=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc170[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0c17('0x0'));var util=require('util');var logger=require(_0x0c17('0x1'))(_0x0c17('0x2'));var moment=require(_0x0c17('0x3'));var BPromise=require(_0x0c17('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c17('0x5'));var rimraf=require('rimraf');var config=require(_0x0c17('0x6'));var attributes=require(_0x0c17('0x7'));module[_0x0c17('0x8')]=function(_0x16c672,_0x5dac95){return _0x16c672['define'](_0x0c17('0x9'),attributes,{'tableName':_0x0c17('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index d39f824..279aaeb 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x354bae,_0x558be3){var _0x1aea37=function(_0x5c428f){while(--_0x5c428f){_0x354bae['push'](_0x354bae['shift']());}};_0x1aea37(++_0x558be3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x50b191,_0x230adb){_0x50b191=_0x50b191-0x0;var _0x1d0ac3=_0x5f2f[_0x50b191];return _0x1d0ac3;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +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(_0x1b02bb,_0x3d9fde){var _0x131245=function(_0x2fd1d8){while(--_0x2fd1d8){_0x1b02bb['push'](_0x1b02bb['shift']());}};_0x131245(++_0x3d9fde);}(_0xadb5,0xad));var _0x5adb=function(_0x651d0d,_0x1fbc0f){_0x651d0d=_0x651d0d-0x0;var _0x417747=_0xadb5[_0x651d0d];return _0x417747;};'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 diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 58f5b41..36fa0d9 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 _0xd443=['post','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','describe','show'];(function(_0x378e65,_0x43692a){var _0x3e43eb=function(_0x355a3f){while(--_0x355a3f){_0x378e65['push'](_0x378e65['shift']());}};_0x3e43eb(++_0x43692a);}(_0xd443,0x131));var _0x3d44=function(_0x50daeb,_0x557b8d){_0x50daeb=_0x50daeb-0x0;var _0x1013af=_0xd443[_0x50daeb];return _0x1013af;};'use strict';var multer=require(_0x3d44('0x0'));var util=require(_0x3d44('0x1'));var path=require(_0x3d44('0x2'));var timeout=require(_0x3d44('0x3'));var express=require(_0x3d44('0x4'));var router=express[_0x3d44('0x5')]();var fs_extra=require(_0x3d44('0x6'));var auth=require(_0x3d44('0x7'));var interaction=require(_0x3d44('0x8'));var config=require(_0x3d44('0x9'));var controller=require(_0x3d44('0xa'));router[_0x3d44('0xb')]('/',auth[_0x3d44('0xc')](),controller['index']);router['get']('/describe',auth[_0x3d44('0xc')](),controller[_0x3d44('0xd')]);router['get']('/:id',auth[_0x3d44('0xc')](),controller[_0x3d44('0xe')]);router[_0x3d44('0xf')]('/',auth[_0x3d44('0xc')](),controller['create']);router[_0x3d44('0x10')](_0x3d44('0x11'),auth[_0x3d44('0xc')](),controller['update']);router['delete'](_0x3d44('0x11'),auth[_0x3d44('0xc')](),controller[_0x3d44('0x12')]);module[_0x3d44('0x13')]=router; \ No newline at end of file +var _0x40ae=['isAuthenticated','describe','show','create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','index','/describe'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x40ae,0x111));var _0xe40a=function(_0x3f1c0f,_0x4c8207){_0x3f1c0f=_0x3f1c0f-0x0;var _0x2a79e2=_0x40ae[_0x3f1c0f];return _0x2a79e2;};'use strict';var multer=require(_0xe40a('0x0'));var util=require(_0xe40a('0x1'));var path=require(_0xe40a('0x2'));var timeout=require('connect-timeout');var express=require(_0xe40a('0x3'));var router=express[_0xe40a('0x4')]();var fs_extra=require(_0xe40a('0x5'));var auth=require(_0xe40a('0x6'));var interaction=require(_0xe40a('0x7'));var config=require(_0xe40a('0x8'));var controller=require(_0xe40a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe40a('0xa')]);router['get'](_0xe40a('0xb'),auth[_0xe40a('0xc')](),controller[_0xe40a('0xd')]);router['get']('/:id',auth[_0xe40a('0xc')](),controller[_0xe40a('0xe')]);router['post']('/',auth[_0xe40a('0xc')](),controller[_0xe40a('0xf')]);router[_0xe40a('0x10')]('/:id',auth[_0xe40a('0xc')](),controller[_0xe40a('0x11')]);router[_0xe40a('0x12')]('/:id',auth[_0xe40a('0xc')](),controller['destroy']);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 0deaabc..b8ff25e 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 _0x85d0=['STRING'];(function(_0x875d83,_0x36c69e){var _0x21895d=function(_0x11f1b1){while(--_0x11f1b1){_0x875d83['push'](_0x875d83['shift']());}};_0x21895d(++_0x36c69e);}(_0x85d0,0x164));var _0x085d=function(_0x47371b,_0x51083e){_0x47371b=_0x47371b-0x0;var _0x271b55=_0x85d0[_0x47371b];return _0x271b55;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x085d('0x0')]}}; \ No newline at end of file +var _0xdc97=['sequelize','exports','STRING'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xdc97,0x13b));var _0x7dc9=function(_0x5321d9,_0x5c760c){_0x5321d9=_0x5321d9-0x0;var _0x7ec0a9=_0xdc97[_0x5321d9];return _0x7ec0a9;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7dc9('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index b1026ed..e55b3a7 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 _0x8ade=['query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','key','model'];(function(_0x4ed1ae,_0x22662a){var _0x154977=function(_0x4bbdb8){while(--_0x4bbdb8){_0x4ed1ae['push'](_0x4ed1ae['shift']());}};_0x154977(++_0x22662a);}(_0x8ade,0x19d));var _0xe8ad=function(_0x1ddf1e,_0x4447c1){_0x1ddf1e=_0x1ddf1e-0x0;var _0xf207ee=_0x8ade[_0x1ddf1e];return _0xf207ee;};'use strict';var emlformat=require(_0xe8ad('0x0'));var rimraf=require(_0xe8ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe8ad('0x2'));var rp=require('request-promise');var moment=require(_0xe8ad('0x3'));var BPromise=require(_0xe8ad('0x4'));var Mustache=require('mustache');var util=require(_0xe8ad('0x5'));var path=require(_0xe8ad('0x6'));var sox=require(_0xe8ad('0x7'));var csv=require(_0xe8ad('0x8'));var ejs=require(_0xe8ad('0x9'));var fs=require('fs');var fs_extra=require(_0xe8ad('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe8ad('0xb'));var jsforce=require(_0xe8ad('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe8ad('0xd'));var Papa=require('papaparse');var Redis=require(_0xe8ad('0xe'));var authService=require(_0xe8ad('0xf'));var qs=require(_0xe8ad('0x10'));var as=require(_0xe8ad('0x11'));var hardwareService=require(_0xe8ad('0x12'));var logger=require(_0xe8ad('0x13'))(_0xe8ad('0x14'));var utils=require('../../config/utils');var config=require(_0xe8ad('0x15'));var licenseUtil=require(_0xe8ad('0x16'));var db=require(_0xe8ad('0x17'))['db'];function respondWithStatusCode(_0x3fdb50,_0x3eb331){_0x3eb331=_0x3eb331||0xcc;return function(_0x531280){if(_0x531280){return _0x3fdb50[_0xe8ad('0x18')](_0x3eb331);}return _0x3fdb50['status'](_0x3eb331)['end']();};}function respondWithResult(_0x397a92,_0xab6c27){_0xab6c27=_0xab6c27||0xc8;return function(_0x361bb1){if(_0x361bb1){return _0x397a92[_0xe8ad('0x19')](_0xab6c27)[_0xe8ad('0x1a')](_0x361bb1);}};}function respondWithFilteredResult(_0x551d64,_0x3172fd){return function(_0x5d81a0){if(_0x5d81a0){var _0x393b2c=typeof _0x3172fd[_0xe8ad('0x1b')]==='undefined'&&typeof _0x3172fd[_0xe8ad('0x1c')]===_0xe8ad('0x1d');var _0x3bc283=_0x5d81a0[_0xe8ad('0x1e')];var _0x166c99=_0x393b2c?0x0:_0x3172fd['offset'];var _0x2ce043=_0x393b2c?_0x5d81a0[_0xe8ad('0x1e')]:_0x3172fd['offset']+_0x3172fd['limit'];var _0x68ba17;if(_0x2ce043>=_0x3bc283){_0x2ce043=_0x3bc283;_0x68ba17=0xc8;}else{_0x68ba17=0xce;}_0x551d64['status'](_0x68ba17);return _0x551d64[_0xe8ad('0x1f')](_0xe8ad('0x20'),_0x166c99+'-'+_0x2ce043+'/'+_0x3bc283)[_0xe8ad('0x1a')](_0x5d81a0);}return null;};}function patchUpdates(_0x56c386){return function(_0x1a9c82){try{jsonpatch[_0xe8ad('0x21')](_0x1a9c82,_0x56c386,!![]);}catch(_0x20f063){return BPromise[_0xe8ad('0x22')](_0x20f063);}return _0x1a9c82[_0xe8ad('0x23')]();};}function saveUpdates(_0x2deecd,_0x1dc547){return function(_0x11691b){if(_0x11691b){return _0x11691b[_0xe8ad('0x24')](_0x2deecd)[_0xe8ad('0x25')](function(_0x1eb48b){return _0x1eb48b;});}return null;};}function removeEntity(_0x5c9d48,_0x4a4b36){return function(_0x5bb055){if(_0x5bb055){return _0x5bb055[_0xe8ad('0x26')]()[_0xe8ad('0x25')](function(){_0x5c9d48[_0xe8ad('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26decb,_0x2a70f7){return function(_0x202348){if(!_0x202348){_0x26decb[_0xe8ad('0x18')](0x194);}return _0x202348;};}function handleError(_0x5310e9,_0x52ba4e){_0x52ba4e=_0x52ba4e||0x1f4;return function(_0x216f74){logger[_0xe8ad('0x27')](_0x216f74[_0xe8ad('0x28')]);if(_0x216f74[_0xe8ad('0x29')]){delete _0x216f74['name'];}_0x5310e9[_0xe8ad('0x19')](_0x52ba4e)[_0xe8ad('0x2a')](_0x216f74);};}exports[_0xe8ad('0x2b')]=function(_0x42113,_0x399bcb){var _0x260777={},_0x197e93={},_0x4e354a={'count':0x0,'rows':[]};var _0x42063b=_['map'](db[_0xe8ad('0x2c')][_0xe8ad('0x2d')],function(_0x4582b8){return{'name':_0x4582b8[_0xe8ad('0x2e')],'type':_0x4582b8['type'][_0xe8ad('0x2f')]};});_0x197e93[_0xe8ad('0x30')]=_['map'](_0x42063b,_0xe8ad('0x29'));_0x197e93[_0xe8ad('0x31')]=_[_0xe8ad('0x32')](_0x42113['query']);_0x197e93['filters']=_['intersection'](_0x197e93[_0xe8ad('0x30')],_0x197e93[_0xe8ad('0x31')]);_0x260777[_0xe8ad('0x33')]=_[_0xe8ad('0x34')](_0x197e93[_0xe8ad('0x30')],qs[_0xe8ad('0x35')](_0x42113[_0xe8ad('0x31')][_0xe8ad('0x35')]));_0x260777['attributes']=_0x260777['attributes'][_0xe8ad('0x36')]?_0x260777[_0xe8ad('0x33')]:_0x197e93[_0xe8ad('0x30')];if(!_0x42113['query'][_0xe8ad('0x37')](_0xe8ad('0x38'))){_0x260777['limit']=qs['limit'](_0x42113[_0xe8ad('0x31')]['limit']);_0x260777['offset']=qs[_0xe8ad('0x1b')](_0x42113[_0xe8ad('0x31')][_0xe8ad('0x1b')]);}_0x260777[_0xe8ad('0x39')]=qs[_0xe8ad('0x3a')](_0x42113[_0xe8ad('0x31')][_0xe8ad('0x3a')]);_0x260777[_0xe8ad('0x3b')]=qs['filters'](_[_0xe8ad('0x3c')](_0x42113['query'],_0x197e93[_0xe8ad('0x3d')]),_0x42063b);if(_0x42113[_0xe8ad('0x31')][_0xe8ad('0x3e')]){_0x260777['where']=_[_0xe8ad('0x3f')](_0x260777[_0xe8ad('0x3b')],{'$or':_['map'](_0x42063b,function(_0x57efaf){if(_0x57efaf[_0xe8ad('0x40')]!==_0xe8ad('0x41')){var _0x1dc011={};_0x1dc011[_0x57efaf[_0xe8ad('0x29')]]={'$like':'%'+_0x42113[_0xe8ad('0x31')][_0xe8ad('0x3e')]+'%'};return _0x1dc011;}})});}_0x260777=_[_0xe8ad('0x3f')]({},_0x260777,_0x42113[_0xe8ad('0x42')]);var _0x15df0b={'where':_0x260777[_0xe8ad('0x3b')]};return db['MailSubstatus'][_0xe8ad('0x1e')](_0x15df0b)['then'](function(_0x2fabf9){_0x4e354a[_0xe8ad('0x1e')]=_0x2fabf9;if(_0x42113['query'][_0xe8ad('0x43')]){_0x260777[_0xe8ad('0x44')]=[{'all':!![]}];}return db[_0xe8ad('0x2c')]['findAll'](_0x260777);})[_0xe8ad('0x25')](function(_0x4d177c){_0x4e354a[_0xe8ad('0x45')]=_0x4d177c;return _0x4e354a;})[_0xe8ad('0x25')](respondWithFilteredResult(_0x399bcb,_0x260777))[_0xe8ad('0x46')](handleError(_0x399bcb,null));};exports[_0xe8ad('0x47')]=function(_0x31381c,_0x3e0c42){var _0x48c1bd={'raw':!![],'where':{'id':_0x31381c['params']['id']}},_0x4a1974={};_0x4a1974[_0xe8ad('0x30')]=_[_0xe8ad('0x32')](db[_0xe8ad('0x2c')]['rawAttributes']);_0x4a1974[_0xe8ad('0x31')]=_['keys'](_0x31381c[_0xe8ad('0x31')]);_0x4a1974['filters']=_[_0xe8ad('0x34')](_0x4a1974[_0xe8ad('0x30')],_0x4a1974[_0xe8ad('0x31')]);_0x48c1bd[_0xe8ad('0x33')]=_[_0xe8ad('0x34')](_0x4a1974[_0xe8ad('0x30')],qs[_0xe8ad('0x35')](_0x31381c[_0xe8ad('0x31')][_0xe8ad('0x35')]));_0x48c1bd['attributes']=_0x48c1bd[_0xe8ad('0x33')][_0xe8ad('0x36')]?_0x48c1bd[_0xe8ad('0x33')]:_0x4a1974[_0xe8ad('0x30')];if(_0x31381c[_0xe8ad('0x31')]['includeAll']){_0x48c1bd[_0xe8ad('0x44')]=[{'all':!![]}];}_0x48c1bd=_[_0xe8ad('0x3f')]({},_0x48c1bd,_0x31381c['options']);return db[_0xe8ad('0x2c')][_0xe8ad('0x48')](_0x48c1bd)[_0xe8ad('0x25')](handleEntityNotFound(_0x3e0c42,null))[_0xe8ad('0x25')](respondWithResult(_0x3e0c42,null))['catch'](handleError(_0x3e0c42,null));};exports[_0xe8ad('0x49')]=function(_0x2a1016,_0x44095f){return db[_0xe8ad('0x2c')]['create'](_0x2a1016[_0xe8ad('0x4a')],{})['then'](respondWithResult(_0x44095f,0xc9))['catch'](handleError(_0x44095f,null));};exports[_0xe8ad('0x24')]=function(_0x526e8a,_0x15398e){if(_0x526e8a['body']['id']){delete _0x526e8a[_0xe8ad('0x4a')]['id'];}return db[_0xe8ad('0x2c')]['find']({'where':{'id':_0x526e8a['params']['id']}})[_0xe8ad('0x25')](handleEntityNotFound(_0x15398e,null))[_0xe8ad('0x25')](saveUpdates(_0x526e8a['body'],null))['then'](respondWithResult(_0x15398e,null))[_0xe8ad('0x46')](handleError(_0x15398e,null));};exports[_0xe8ad('0x26')]=function(_0x17dbbb,_0x557a2f){return db[_0xe8ad('0x2c')]['find']({'where':{'id':_0x17dbbb[_0xe8ad('0x4b')]['id']}})[_0xe8ad('0x25')](handleEntityNotFound(_0x557a2f,null))[_0xe8ad('0x25')](removeEntity(_0x557a2f,null))[_0xe8ad('0x46')](handleError(_0x557a2f,null));};exports['describe']=function(_0x5f0949,_0x50eaa4){return db['MailSubstatus'][_0xe8ad('0x4c')]()[_0xe8ad('0x25')](respondWithResult(_0x50eaa4,null))[_0xe8ad('0x46')](handleError(_0x50eaa4,null));}; \ No newline at end of file +var _0xd39a=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x512654,_0x18b898){var _0x24d4ab=function(_0x48b4f7){while(--_0x48b4f7){_0x512654['push'](_0x512654['shift']());}};_0x24d4ab(++_0x18b898);}(_0xd39a,0x1ec));var _0xad39=function(_0x3e438f,_0x4439e7){_0x3e438f=_0x3e438f-0x0;var _0x35f7ff=_0xd39a[_0x3e438f];return _0x35f7ff;};'use strict';var emlformat=require(_0xad39('0x0'));var rimraf=require(_0xad39('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad39('0x2'));var rp=require('request-promise');var moment=require(_0xad39('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xad39('0x4'));var util=require(_0xad39('0x5'));var path=require(_0xad39('0x6'));var sox=require(_0xad39('0x7'));var csv=require('to-csv');var ejs=require(_0xad39('0x8'));var fs=require('fs');var fs_extra=require(_0xad39('0x9'));var _=require(_0xad39('0xa'));var squel=require('squel');var crypto=require(_0xad39('0xb'));var jsforce=require(_0xad39('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xad39('0xd'));var querystring=require('querystring');var Papa=require(_0xad39('0xe'));var Redis=require(_0xad39('0xf'));var authService=require(_0xad39('0x10'));var qs=require(_0xad39('0x11'));var as=require(_0xad39('0x12'));var hardwareService=require(_0xad39('0x13'));var logger=require(_0xad39('0x14'))(_0xad39('0x15'));var utils=require(_0xad39('0x16'));var config=require(_0xad39('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xad39('0x18'))['db'];function respondWithStatusCode(_0x2b5a78,_0xa6220b){_0xa6220b=_0xa6220b||0xcc;return function(_0x135512){if(_0x135512){return _0x2b5a78['sendStatus'](_0xa6220b);}return _0x2b5a78[_0xad39('0x19')](_0xa6220b)['end']();};}function respondWithResult(_0x33c295,_0x450ec9){_0x450ec9=_0x450ec9||0xc8;return function(_0x2812dd){if(_0x2812dd){return _0x33c295[_0xad39('0x19')](_0x450ec9)[_0xad39('0x1a')](_0x2812dd);}};}function respondWithFilteredResult(_0x1572e6,_0x2df268){return function(_0x263935){if(_0x263935){var _0x2ba665=typeof _0x2df268[_0xad39('0x1b')]===_0xad39('0x1c')&&typeof _0x2df268[_0xad39('0x1d')]===_0xad39('0x1c');var _0x4b1693=_0x263935[_0xad39('0x1e')];var _0x209b89=_0x2ba665?0x0:_0x2df268[_0xad39('0x1b')];var _0x5d5db2=_0x2ba665?_0x263935[_0xad39('0x1e')]:_0x2df268[_0xad39('0x1b')]+_0x2df268[_0xad39('0x1d')];var _0x13faed;if(_0x5d5db2>=_0x4b1693){_0x5d5db2=_0x4b1693;_0x13faed=0xc8;}else{_0x13faed=0xce;}_0x1572e6[_0xad39('0x19')](_0x13faed);return _0x1572e6['set']('Content-Range',_0x209b89+'-'+_0x5d5db2+'/'+_0x4b1693)[_0xad39('0x1a')](_0x263935);}return null;};}function patchUpdates(_0x1a196d){return function(_0x2bc730){try{jsonpatch[_0xad39('0x1f')](_0x2bc730,_0x1a196d,!![]);}catch(_0x418b1b){return BPromise['reject'](_0x418b1b);}return _0x2bc730[_0xad39('0x20')]();};}function saveUpdates(_0x231b6b,_0xfaf7ea){return function(_0x429ae2){if(_0x429ae2){return _0x429ae2[_0xad39('0x21')](_0x231b6b)[_0xad39('0x22')](function(_0x426b25){return _0x426b25;});}return null;};}function removeEntity(_0x38a520,_0x5bb0d0){return function(_0x25dcb3){if(_0x25dcb3){return _0x25dcb3[_0xad39('0x23')]()[_0xad39('0x22')](function(){_0x38a520['status'](0xcc)[_0xad39('0x24')]();});}};}function handleEntityNotFound(_0x114d2a,_0x122a73){return function(_0x4d0aef){if(!_0x4d0aef){_0x114d2a[_0xad39('0x25')](0x194);}return _0x4d0aef;};}function handleError(_0x2a4ee2,_0x1c7375){_0x1c7375=_0x1c7375||0x1f4;return function(_0x5a8d4a){logger[_0xad39('0x26')](_0x5a8d4a[_0xad39('0x27')]);if(_0x5a8d4a[_0xad39('0x28')]){delete _0x5a8d4a['name'];}_0x2a4ee2[_0xad39('0x19')](_0x1c7375)[_0xad39('0x29')](_0x5a8d4a);};}exports[_0xad39('0x2a')]=function(_0x217e9e,_0x260975){var _0x14755b={},_0x87eb68={},_0x7bf784={'count':0x0,'rows':[]};var _0x219c69=_[_0xad39('0x2b')](db[_0xad39('0x2c')][_0xad39('0x2d')],function(_0x276fa1){return{'name':_0x276fa1[_0xad39('0x2e')],'type':_0x276fa1[_0xad39('0x2f')][_0xad39('0x30')]};});_0x87eb68[_0xad39('0x31')]=_[_0xad39('0x2b')](_0x219c69,_0xad39('0x28'));_0x87eb68[_0xad39('0x32')]=_[_0xad39('0x33')](_0x217e9e[_0xad39('0x32')]);_0x87eb68[_0xad39('0x34')]=_['intersection'](_0x87eb68[_0xad39('0x31')],_0x87eb68[_0xad39('0x32')]);_0x14755b[_0xad39('0x35')]=_[_0xad39('0x36')](_0x87eb68['model'],qs[_0xad39('0x37')](_0x217e9e[_0xad39('0x32')][_0xad39('0x37')]));_0x14755b['attributes']=_0x14755b[_0xad39('0x35')]['length']?_0x14755b['attributes']:_0x87eb68[_0xad39('0x31')];if(!_0x217e9e['query'][_0xad39('0x38')]('nolimit')){_0x14755b[_0xad39('0x1d')]=qs['limit'](_0x217e9e[_0xad39('0x32')]['limit']);_0x14755b[_0xad39('0x1b')]=qs[_0xad39('0x1b')](_0x217e9e['query'][_0xad39('0x1b')]);}_0x14755b['order']=qs[_0xad39('0x39')](_0x217e9e['query']['sort']);_0x14755b['where']=qs['filters'](_[_0xad39('0x3a')](_0x217e9e[_0xad39('0x32')],_0x87eb68[_0xad39('0x34')]),_0x219c69);if(_0x217e9e[_0xad39('0x32')][_0xad39('0x3b')]){_0x14755b[_0xad39('0x3c')]=_[_0xad39('0x3d')](_0x14755b[_0xad39('0x3c')],{'$or':_[_0xad39('0x2b')](_0x219c69,function(_0x1faa13){if(_0x1faa13[_0xad39('0x2f')]!=='VIRTUAL'){var _0x548eb1={};_0x548eb1[_0x1faa13[_0xad39('0x28')]]={'$like':'%'+_0x217e9e['query']['filter']+'%'};return _0x548eb1;}})});}_0x14755b=_[_0xad39('0x3d')]({},_0x14755b,_0x217e9e[_0xad39('0x3e')]);var _0x134e45={'where':_0x14755b[_0xad39('0x3c')]};return db['MailSubstatus'][_0xad39('0x1e')](_0x134e45)[_0xad39('0x22')](function(_0x2707e1){_0x7bf784[_0xad39('0x1e')]=_0x2707e1;if(_0x217e9e['query'][_0xad39('0x3f')]){_0x14755b['include']=[{'all':!![]}];}return db[_0xad39('0x2c')][_0xad39('0x40')](_0x14755b);})['then'](function(_0x5944c7){_0x7bf784[_0xad39('0x41')]=_0x5944c7;return _0x7bf784;})[_0xad39('0x22')](respondWithFilteredResult(_0x260975,_0x14755b))[_0xad39('0x42')](handleError(_0x260975,null));};exports[_0xad39('0x43')]=function(_0x599c61,_0x3d5fd1){var _0x36c6e1={'raw':!![],'where':{'id':_0x599c61[_0xad39('0x44')]['id']}},_0xbe0742={};_0xbe0742[_0xad39('0x31')]=_[_0xad39('0x33')](db[_0xad39('0x2c')][_0xad39('0x2d')]);_0xbe0742[_0xad39('0x32')]=_[_0xad39('0x33')](_0x599c61[_0xad39('0x32')]);_0xbe0742[_0xad39('0x34')]=_[_0xad39('0x36')](_0xbe0742[_0xad39('0x31')],_0xbe0742[_0xad39('0x32')]);_0x36c6e1[_0xad39('0x35')]=_[_0xad39('0x36')](_0xbe0742[_0xad39('0x31')],qs[_0xad39('0x37')](_0x599c61['query']['fields']));_0x36c6e1[_0xad39('0x35')]=_0x36c6e1[_0xad39('0x35')]['length']?_0x36c6e1[_0xad39('0x35')]:_0xbe0742[_0xad39('0x31')];if(_0x599c61[_0xad39('0x32')][_0xad39('0x3f')]){_0x36c6e1['include']=[{'all':!![]}];}_0x36c6e1=_[_0xad39('0x3d')]({},_0x36c6e1,_0x599c61['options']);return db[_0xad39('0x2c')][_0xad39('0x45')](_0x36c6e1)['then'](handleEntityNotFound(_0x3d5fd1,null))[_0xad39('0x22')](respondWithResult(_0x3d5fd1,null))[_0xad39('0x42')](handleError(_0x3d5fd1,null));};exports[_0xad39('0x46')]=function(_0x5a9c17,_0x1bfdab){return db[_0xad39('0x2c')][_0xad39('0x46')](_0x5a9c17[_0xad39('0x47')],{})[_0xad39('0x22')](respondWithResult(_0x1bfdab,0xc9))[_0xad39('0x42')](handleError(_0x1bfdab,null));};exports[_0xad39('0x21')]=function(_0x3e3f85,_0x2ad5cb){if(_0x3e3f85[_0xad39('0x47')]['id']){delete _0x3e3f85[_0xad39('0x47')]['id'];}return db[_0xad39('0x2c')]['find']({'where':{'id':_0x3e3f85[_0xad39('0x44')]['id']}})[_0xad39('0x22')](handleEntityNotFound(_0x2ad5cb,null))['then'](saveUpdates(_0x3e3f85[_0xad39('0x47')],null))[_0xad39('0x22')](respondWithResult(_0x2ad5cb,null))['catch'](handleError(_0x2ad5cb,null));};exports[_0xad39('0x23')]=function(_0x46b6bb,_0x120f61){return db[_0xad39('0x2c')][_0xad39('0x45')]({'where':{'id':_0x46b6bb[_0xad39('0x44')]['id']}})[_0xad39('0x22')](handleEntityNotFound(_0x120f61,null))[_0xad39('0x22')](removeEntity(_0x120f61,null))[_0xad39('0x42')](handleError(_0x120f61,null));};exports['describe']=function(_0x45699f,_0x1fdc4d){return db[_0xad39('0x2c')][_0xad39('0x48')]()[_0xad39('0x22')](respondWithResult(_0x1fdc4d,null))['catch'](handleError(_0x1fdc4d,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 66d70b4..9424736 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 _0x73db=['../../mysqldb','MailSubstatus','setMaxListeners','emit','events'];(function(_0x421c56,_0x4efd00){var _0x49b244=function(_0x5cd079){while(--_0x5cd079){_0x421c56['push'](_0x421c56['shift']());}};_0x49b244(++_0x4efd00);}(_0x73db,0x158));var _0xb73d=function(_0x20a3cb,_0x3da272){_0x20a3cb=_0x20a3cb-0x0;var _0x467919=_0x73db[_0x20a3cb];return _0x467919;};'use strict';var EventEmitter=require(_0xb73d('0x0'));var MailSubstatus=require(_0xb73d('0x1'))['db'][_0xb73d('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xb73d('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x4a37bd){return function(_0x3ce5d4,_0x12f4a4,_0x2f3fab){MailSubstatusEvents[_0xb73d('0x4')](_0x4a37bd+':'+_0x3ce5d4['id'],_0x3ce5d4);MailSubstatusEvents[_0xb73d('0x4')](_0x4a37bd,_0x3ce5d4);_0x2f3fab(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x19e9=['../../mysqldb','MailSubstatus','emit','hasOwnProperty','hook','exports','events'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x19e9,0x117));var _0x919e=function(_0x139d18,_0x16f404){_0x139d18=_0x139d18-0x0;var _0x1fe62c=_0x19e9[_0x139d18];return _0x1fe62c;};'use strict';var EventEmitter=require(_0x919e('0x0'));var MailSubstatus=require(_0x919e('0x1'))['db'][_0x919e('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x5e171d){return function(_0x122aa8,_0x112117,_0x4f4d42){MailSubstatusEvents['emit'](_0x5e171d+':'+_0x122aa8['id'],_0x122aa8);MailSubstatusEvents[_0x919e('0x3')](_0x5e171d,_0x122aa8);_0x4f4d42(null);};}for(var e in events){if(events[_0x919e('0x4')](e)){var event=events[e];MailSubstatus[_0x919e('0x5')](e,emitEvent(event));}}module[_0x919e('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index de721e5..8dff402 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 _0x2732=['update','name','_previousDataValues','catch','exports','models','MailSubstatus','mail_substatuses','Condition'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0x2732,0x112));var _0x2273=function(_0x2afb4e,_0x1e221c){_0x2afb4e=_0x2afb4e-0x0;var _0x493c21=_0x2732[_0x2afb4e];return _0x493c21;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x2273('0x0')]=function(_0x538043){var _0xf14d32=_0x538043[_0x2273('0x1')];return _0x538043['define'](_0x2273('0x2'),attributes,{'tableName':_0x2273('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x463395,_0x10c5f0,_0x5144ae){return _0xf14d32[_0x2273('0x4')][_0x2273('0x5')]({'value':_0x463395[_0x2273('0x6')]},{'where':{'field':'mailSubstatus','value':_0x463395[_0x2273('0x7')][_0x2273('0x6')]}})['then'](function(){_0x5144ae();})[_0x2273('0x8')](function(_0x459ff2){_0x5144ae(_0x459ff2);});}}});}; \ No newline at end of file +var _0xc0de=['./mailSubstatus.attributes','exports','define','mail_substatuses','Condition','mailSubstatus','_previousDataValues','then','catch'];(function(_0x56c2f9,_0xcd3177){var _0x532a5d=function(_0x3b61b9){while(--_0x3b61b9){_0x56c2f9['push'](_0x56c2f9['shift']());}};_0x532a5d(++_0xcd3177);}(_0xc0de,0x156));var _0xec0d=function(_0x13c63e,_0x439a82){_0x13c63e=_0x13c63e-0x0;var _0x219a1a=_0xc0de[_0x13c63e];return _0x219a1a;};'use strict';var attributes=require(_0xec0d('0x0'));module[_0xec0d('0x1')]=function(_0x47c1c9){var _0x5d7304=_0x47c1c9['models'];return _0x47c1c9[_0xec0d('0x2')]('MailSubstatus',attributes,{'tableName':_0xec0d('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x449368,_0xde23e1,_0x5dd838){return _0x5d7304[_0xec0d('0x4')]['update']({'value':_0x449368['name']},{'where':{'field':_0xec0d('0x5'),'value':_0x449368[_0xec0d('0x6')]['name']}})[_0xec0d('0x7')](function(){_0x5dd838();})[_0xec0d('0x8')](function(_0x260fa2){_0x5dd838(_0x260fa2);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 3caed54..1c9a7ee 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 _0x9322=['http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9322,0x14d));var _0x2932=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9322[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x2932('0x0'));var util=require(_0x2932('0x1'));var moment=require(_0x2932('0x2'));var BPromise=require(_0x2932('0x3'));var rs=require(_0x2932('0x4'));var fs=require('fs');var Redis=require(_0x2932('0x5'));var db=require(_0x2932('0x6'))['db'];var utils=require(_0x2932('0x7'));var logger=require(_0x2932('0x8'))(_0x2932('0x9'));var config=require('../../config/environment');var jayson=require(_0x2932('0xa'));var client=jayson[_0x2932('0xb')][_0x2932('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c8597,_0x3b8b8a,_0x25d968){return new BPromise(function(_0x17dcd2,_0x2a3a44){return client['request'](_0x3c8597,_0x25d968)[_0x2932('0xd')](function(_0xc62a9c){logger[_0x2932('0xe')](_0x2932('0xf'),_0x3b8b8a,_0x2932('0x10'));logger[_0x2932('0x11')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x3b8b8a,_0x2932('0x10'),JSON[_0x2932('0x12')](_0xc62a9c));if(_0xc62a9c[_0x2932('0x13')]){if(_0xc62a9c[_0x2932('0x13')][_0x2932('0x14')]===0x1f4){logger[_0x2932('0x13')](_0x2932('0xf'),_0x3b8b8a,_0xc62a9c['error'][_0x2932('0x15')]);return _0x2a3a44(_0xc62a9c[_0x2932('0x13')][_0x2932('0x15')]);}logger[_0x2932('0x13')](_0x2932('0xf'),_0x3b8b8a,_0xc62a9c['error'][_0x2932('0x15')]);return _0x17dcd2(_0xc62a9c['error'][_0x2932('0x15')]);}else{logger['info'](_0x2932('0xf'),_0x3b8b8a,_0x2932('0x10'));_0x17dcd2(_0xc62a9c[_0x2932('0x16')][_0x2932('0x15')]);}})['catch'](function(_0x27ce11){logger[_0x2932('0x13')](_0x2932('0xf'),_0x3b8b8a,_0x27ce11);_0x2a3a44(_0x27ce11);});});} \ No newline at end of file +var _0xc125=['client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x561d06,_0x580baa){var _0x23a005=function(_0x1e0ed6){while(--_0x1e0ed6){_0x561d06['push'](_0x561d06['shift']());}};_0x23a005(++_0x580baa);}(_0xc125,0x6c));var _0x5c12=function(_0x7e9a81,_0x30477c){_0x7e9a81=_0x7e9a81-0x0;var _0x2ccf89=_0xc125[_0x7e9a81];return _0x2ccf89;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5c12('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c12('0x1'));var db=require(_0x5c12('0x2'))['db'];var utils=require(_0x5c12('0x3'));var logger=require('../../config/logger')(_0x5c12('0x4'));var config=require(_0x5c12('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5c12('0x6')][_0x5c12('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x544506,_0x30e6e5,_0xf214c4){return new BPromise(function(_0x1c57ea,_0x47eca7){return client[_0x5c12('0x8')](_0x544506,_0xf214c4)['then'](function(_0xca3773){logger[_0x5c12('0x9')](_0x5c12('0xa'),_0x30e6e5,_0x5c12('0xb'));logger['debug'](_0x5c12('0xc'),_0x30e6e5,'request\x20sent',JSON[_0x5c12('0xd')](_0xca3773));if(_0xca3773['error']){if(_0xca3773[_0x5c12('0xe')][_0x5c12('0xf')]===0x1f4){logger[_0x5c12('0xe')](_0x5c12('0xa'),_0x30e6e5,_0xca3773[_0x5c12('0xe')][_0x5c12('0x10')]);return _0x47eca7(_0xca3773[_0x5c12('0xe')][_0x5c12('0x10')]);}logger['error'](_0x5c12('0xa'),_0x30e6e5,_0xca3773[_0x5c12('0xe')][_0x5c12('0x10')]);return _0x1c57ea(_0xca3773['error'][_0x5c12('0x10')]);}else{logger['info'](_0x5c12('0xa'),_0x30e6e5,'request\x20sent');_0x1c57ea(_0xca3773[_0x5c12('0x11')][_0x5c12('0x10')]);}})[_0x5c12('0x12')](function(_0x3751e0){logger[_0x5c12('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x30e6e5,_0x3751e0);_0x47eca7(_0x3751e0);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index c55f456..934d302 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 _0xfa11=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','/:id','post'];(function(_0x12cbd8,_0x8ef0ce){var _0x2fb1ab=function(_0x57242c){while(--_0x57242c){_0x12cbd8['push'](_0x12cbd8['shift']());}};_0x2fb1ab(++_0x8ef0ce);}(_0xfa11,0x1bd));var _0x1fa1=function(_0xf00df6,_0x3cdfca){_0xf00df6=_0xf00df6-0x0;var _0x2e883b=_0xfa11[_0xf00df6];return _0x2e883b;};'use strict';var multer=require(_0x1fa1('0x0'));var util=require(_0x1fa1('0x1'));var path=require(_0x1fa1('0x2'));var timeout=require(_0x1fa1('0x3'));var express=require(_0x1fa1('0x4'));var router=express[_0x1fa1('0x5')]();var fs_extra=require(_0x1fa1('0x6'));var auth=require(_0x1fa1('0x7'));var interaction=require(_0x1fa1('0x8'));var config=require(_0x1fa1('0x9'));var controller=require(_0x1fa1('0xa'));router[_0x1fa1('0xb')]('/',auth[_0x1fa1('0xc')](),controller[_0x1fa1('0xd')]);router[_0x1fa1('0xb')]('/describe',auth[_0x1fa1('0xc')](),controller[_0x1fa1('0xe')]);router[_0x1fa1('0xb')](_0x1fa1('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x1fa1('0x10')]('/',auth['isAuthenticated'](),controller[_0x1fa1('0x11')]);router[_0x1fa1('0x12')](_0x1fa1('0xf'),auth[_0x1fa1('0xc')](),controller[_0x1fa1('0x13')]);router[_0x1fa1('0x14')]('/:id',auth[_0x1fa1('0xc')](),controller[_0x1fa1('0x15')]);module['exports']=router; \ No newline at end of file +var _0x97b4=['path','express','fs-extra','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','/describe','get','show','post','put','/:id','update','destroy','exports','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x97b4,0xb2));var _0x497b=function(_0x5bb32d,_0x3173b9){_0x5bb32d=_0x5bb32d-0x0;var _0x212f7e=_0x97b4[_0x5bb32d];return _0x212f7e;};'use strict';var multer=require(_0x497b('0x0'));var util=require(_0x497b('0x1'));var path=require(_0x497b('0x2'));var timeout=require('connect-timeout');var express=require(_0x497b('0x3'));var router=express['Router']();var fs_extra=require(_0x497b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x497b('0x5'));var controller=require(_0x497b('0x6'));router['get']('/',auth[_0x497b('0x7')](),controller[_0x497b('0x8')]);router['get'](_0x497b('0x9'),auth[_0x497b('0x7')](),controller['describe']);router[_0x497b('0xa')]('/:id',auth[_0x497b('0x7')](),controller[_0x497b('0xb')]);router[_0x497b('0xc')]('/',auth[_0x497b('0x7')](),controller['create']);router[_0x497b('0xd')](_0x497b('0xe'),auth[_0x497b('0x7')](),controller[_0x497b('0xf')]);router['delete'](_0x497b('0xe'),auth[_0x497b('0x7')](),controller[_0x497b('0x10')]);module[_0x497b('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index fd31408..81724a9 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x1ec6b3,_0x4d613c){var _0x7f842c=function(_0x3e1c27){while(--_0x3e1c27){_0x1ec6b3['push'](_0x1ec6b3['shift']());}};_0x7f842c(++_0x4d613c);}(_0x54ef,0x112));var _0xf54e=function(_0x19ce78,_0x40e9d3){_0x19ce78=_0x19ce78-0x0;var _0x32e150=_0x54ef[_0x19ce78];return _0x32e150;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0xb43b,0x1b2));var _0xbb43=function(_0x50c61b,_0x13f3bb){_0x50c61b=_0x50c61b-0x0;var _0x41080d=_0xb43b[_0x50c61b];return _0x41080d;};'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 ef23e90..cc5ffe9 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 _0xe7f8=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','MailTransferReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','VIRTUAL','options','count','includeAll','include','rows','catch','params','length','merge','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1046ba,_0x17699d){var _0x31ae08=function(_0x4c737d){while(--_0x4c737d){_0x1046ba['push'](_0x1046ba['shift']());}};_0x31ae08(++_0x17699d);}(_0xe7f8,0x16c));var _0x8e7f=function(_0x357481,_0x7525d1){_0x357481=_0x357481-0x0;var _0x4391d9=_0xe7f8[_0x357481];return _0x4391d9;};'use strict';var emlformat=require(_0x8e7f('0x0'));var rimraf=require(_0x8e7f('0x1'));var zipdir=require(_0x8e7f('0x2'));var jsonpatch=require(_0x8e7f('0x3'));var rp=require(_0x8e7f('0x4'));var moment=require(_0x8e7f('0x5'));var BPromise=require(_0x8e7f('0x6'));var Mustache=require(_0x8e7f('0x7'));var util=require(_0x8e7f('0x8'));var path=require(_0x8e7f('0x9'));var sox=require('sox');var csv=require(_0x8e7f('0xa'));var ejs=require(_0x8e7f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8e7f('0xc'));var squel=require(_0x8e7f('0xd'));var crypto=require(_0x8e7f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8e7f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8e7f('0x10'));var Papa=require(_0x8e7f('0x11'));var Redis=require(_0x8e7f('0x12'));var authService=require(_0x8e7f('0x13'));var qs=require(_0x8e7f('0x14'));var as=require(_0x8e7f('0x15'));var hardwareService=require(_0x8e7f('0x16'));var logger=require(_0x8e7f('0x17'))('api');var utils=require(_0x8e7f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8e7f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767e9,_0x458462){_0x458462=_0x458462||0xcc;return function(_0x50f6a4){if(_0x50f6a4){return _0x4767e9[_0x8e7f('0x1a')](_0x458462);}return _0x4767e9[_0x8e7f('0x1b')](_0x458462)[_0x8e7f('0x1c')]();};}function respondWithResult(_0x389fcb,_0x11f172){_0x11f172=_0x11f172||0xc8;return function(_0x37361e){if(_0x37361e){return _0x389fcb[_0x8e7f('0x1b')](_0x11f172)[_0x8e7f('0x1d')](_0x37361e);}};}function respondWithFilteredResult(_0x2adba6,_0xf5f316){return function(_0x9e8499){if(_0x9e8499){var _0x32e073=typeof _0xf5f316[_0x8e7f('0x1e')]===_0x8e7f('0x1f')&&typeof _0xf5f316[_0x8e7f('0x20')]===_0x8e7f('0x1f');var _0xe4b2fe=_0x9e8499['count'];var _0x4697fd=_0x32e073?0x0:_0xf5f316[_0x8e7f('0x1e')];var _0x1c2a67=_0x32e073?_0x9e8499['count']:_0xf5f316[_0x8e7f('0x1e')]+_0xf5f316['limit'];var _0x199dc9;if(_0x1c2a67>=_0xe4b2fe){_0x1c2a67=_0xe4b2fe;_0x199dc9=0xc8;}else{_0x199dc9=0xce;}_0x2adba6[_0x8e7f('0x1b')](_0x199dc9);return _0x2adba6[_0x8e7f('0x21')](_0x8e7f('0x22'),_0x4697fd+'-'+_0x1c2a67+'/'+_0xe4b2fe)[_0x8e7f('0x1d')](_0x9e8499);}return null;};}function patchUpdates(_0x50f476){return function(_0x130493){try{jsonpatch[_0x8e7f('0x23')](_0x130493,_0x50f476,!![]);}catch(_0x14bcb3){return BPromise[_0x8e7f('0x24')](_0x14bcb3);}return _0x130493[_0x8e7f('0x25')]();};}function saveUpdates(_0x1b3a48,_0x444874){return function(_0x7aafa){if(_0x7aafa){return _0x7aafa[_0x8e7f('0x26')](_0x1b3a48)[_0x8e7f('0x27')](function(_0x38113c){return _0x38113c;});}return null;};}function removeEntity(_0x4292a8,_0x5055fa){return function(_0x301f46){if(_0x301f46){return _0x301f46[_0x8e7f('0x28')]()[_0x8e7f('0x27')](function(){_0x4292a8[_0x8e7f('0x1b')](0xcc)[_0x8e7f('0x1c')]();});}};}function handleEntityNotFound(_0x121c55,_0x434580){return function(_0x27cbc3){if(!_0x27cbc3){_0x121c55[_0x8e7f('0x1a')](0x194);}return _0x27cbc3;};}function handleError(_0x3cbf23,_0x918032){_0x918032=_0x918032||0x1f4;return function(_0x11b4fa){logger[_0x8e7f('0x29')](_0x11b4fa[_0x8e7f('0x2a')]);if(_0x11b4fa[_0x8e7f('0x2b')]){delete _0x11b4fa['name'];}_0x3cbf23['status'](_0x918032)[_0x8e7f('0x2c')](_0x11b4fa);};}exports['index']=function(_0x397aa2,_0x356997){var _0x2db730={},_0x18c503={},_0x8c9460={'count':0x0,'rows':[]};var _0x4420fc=_['map'](db[_0x8e7f('0x2d')][_0x8e7f('0x2e')],function(_0x49ec83){return{'name':_0x49ec83[_0x8e7f('0x2f')],'type':_0x49ec83[_0x8e7f('0x30')][_0x8e7f('0x31')]};});_0x18c503['model']=_[_0x8e7f('0x32')](_0x4420fc,_0x8e7f('0x2b'));_0x18c503[_0x8e7f('0x33')]=_[_0x8e7f('0x34')](_0x397aa2[_0x8e7f('0x33')]);_0x18c503[_0x8e7f('0x35')]=_[_0x8e7f('0x36')](_0x18c503['model'],_0x18c503[_0x8e7f('0x33')]);_0x2db730[_0x8e7f('0x37')]=_[_0x8e7f('0x36')](_0x18c503[_0x8e7f('0x38')],qs[_0x8e7f('0x39')](_0x397aa2[_0x8e7f('0x33')][_0x8e7f('0x39')]));_0x2db730['attributes']=_0x2db730[_0x8e7f('0x37')]['length']?_0x2db730['attributes']:_0x18c503[_0x8e7f('0x38')];if(!_0x397aa2[_0x8e7f('0x33')]['hasOwnProperty'](_0x8e7f('0x3a'))){_0x2db730[_0x8e7f('0x20')]=qs[_0x8e7f('0x20')](_0x397aa2[_0x8e7f('0x33')][_0x8e7f('0x20')]);_0x2db730[_0x8e7f('0x1e')]=qs[_0x8e7f('0x1e')](_0x397aa2[_0x8e7f('0x33')][_0x8e7f('0x1e')]);}_0x2db730[_0x8e7f('0x3b')]=qs[_0x8e7f('0x3c')](_0x397aa2[_0x8e7f('0x33')][_0x8e7f('0x3c')]);_0x2db730[_0x8e7f('0x3d')]=qs[_0x8e7f('0x35')](_[_0x8e7f('0x3e')](_0x397aa2[_0x8e7f('0x33')],_0x18c503[_0x8e7f('0x35')]),_0x4420fc);if(_0x397aa2['query']['filter']){_0x2db730[_0x8e7f('0x3d')]=_['merge'](_0x2db730[_0x8e7f('0x3d')],{'$or':_[_0x8e7f('0x32')](_0x4420fc,function(_0x2c7f5c){if(_0x2c7f5c[_0x8e7f('0x30')]!==_0x8e7f('0x3f')){var _0x1b20ca={};_0x1b20ca[_0x2c7f5c[_0x8e7f('0x2b')]]={'$like':'%'+_0x397aa2['query']['filter']+'%'};return _0x1b20ca;}})});}_0x2db730=_['merge']({},_0x2db730,_0x397aa2[_0x8e7f('0x40')]);var _0x2a3506={'where':_0x2db730['where']};return db[_0x8e7f('0x2d')][_0x8e7f('0x41')](_0x2a3506)['then'](function(_0xf489e){_0x8c9460[_0x8e7f('0x41')]=_0xf489e;if(_0x397aa2[_0x8e7f('0x33')][_0x8e7f('0x42')]){_0x2db730[_0x8e7f('0x43')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x2db730);})[_0x8e7f('0x27')](function(_0x1fc396){_0x8c9460[_0x8e7f('0x44')]=_0x1fc396;return _0x8c9460;})['then'](respondWithFilteredResult(_0x356997,_0x2db730))[_0x8e7f('0x45')](handleError(_0x356997,null));};exports['show']=function(_0x20f6b3,_0x5a8e5a){var _0x4e8e29={'raw':!![],'where':{'id':_0x20f6b3[_0x8e7f('0x46')]['id']}},_0x30cec8={};_0x30cec8[_0x8e7f('0x38')]=_['keys'](db[_0x8e7f('0x2d')][_0x8e7f('0x2e')]);_0x30cec8['query']=_['keys'](_0x20f6b3['query']);_0x30cec8[_0x8e7f('0x35')]=_[_0x8e7f('0x36')](_0x30cec8[_0x8e7f('0x38')],_0x30cec8[_0x8e7f('0x33')]);_0x4e8e29[_0x8e7f('0x37')]=_[_0x8e7f('0x36')](_0x30cec8[_0x8e7f('0x38')],qs[_0x8e7f('0x39')](_0x20f6b3[_0x8e7f('0x33')][_0x8e7f('0x39')]));_0x4e8e29[_0x8e7f('0x37')]=_0x4e8e29[_0x8e7f('0x37')][_0x8e7f('0x47')]?_0x4e8e29[_0x8e7f('0x37')]:_0x30cec8[_0x8e7f('0x38')];if(_0x20f6b3[_0x8e7f('0x33')]['includeAll']){_0x4e8e29[_0x8e7f('0x43')]=[{'all':!![]}];}_0x4e8e29=_[_0x8e7f('0x48')]({},_0x4e8e29,_0x20f6b3[_0x8e7f('0x40')]);return db[_0x8e7f('0x2d')]['find'](_0x4e8e29)[_0x8e7f('0x27')](handleEntityNotFound(_0x5a8e5a,null))[_0x8e7f('0x27')](respondWithResult(_0x5a8e5a,null))[_0x8e7f('0x45')](handleError(_0x5a8e5a,null));};exports[_0x8e7f('0x49')]=function(_0x22dd55,_0x19df6a){return db[_0x8e7f('0x2d')][_0x8e7f('0x49')](_0x22dd55[_0x8e7f('0x4a')],{})[_0x8e7f('0x27')](respondWithResult(_0x19df6a,0xc9))[_0x8e7f('0x45')](handleError(_0x19df6a,null));};exports[_0x8e7f('0x26')]=function(_0x4259b9,_0x243285){if(_0x4259b9[_0x8e7f('0x4a')]['id']){delete _0x4259b9[_0x8e7f('0x4a')]['id'];}return db[_0x8e7f('0x2d')][_0x8e7f('0x4b')]({'where':{'id':_0x4259b9[_0x8e7f('0x46')]['id']}})[_0x8e7f('0x27')](handleEntityNotFound(_0x243285,null))[_0x8e7f('0x27')](saveUpdates(_0x4259b9[_0x8e7f('0x4a')],null))[_0x8e7f('0x27')](respondWithResult(_0x243285,null))[_0x8e7f('0x45')](handleError(_0x243285,null));};exports[_0x8e7f('0x28')]=function(_0x5bc787,_0x30dac9){return db[_0x8e7f('0x2d')]['find']({'where':{'id':_0x5bc787['params']['id']}})[_0x8e7f('0x27')](handleEntityNotFound(_0x30dac9,null))['then'](removeEntity(_0x30dac9,null))[_0x8e7f('0x45')](handleError(_0x30dac9,null));};exports['describe']=function(_0x2d85be,_0x1d63e1){return db['MailTransferReport'][_0x8e7f('0x4c')]()[_0x8e7f('0x27')](respondWithResult(_0x1d63e1,null))[_0x8e7f('0x45')](handleError(_0x1d63e1,null));}; \ No newline at end of file +var _0xc61f=['json','undefined','limit','count','offset','set','apply','reject','save','destroy','then','status','sendStatus','error','stack','name','send','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','options','MailTransferReport','includeAll','include','findAll','rows','show','params','keys','rawAttributes','length','merge','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end'];(function(_0x1e9256,_0x21f76b){var _0x2839bc=function(_0x1016fc){while(--_0x1016fc){_0x1e9256['push'](_0x1e9256['shift']());}};_0x2839bc(++_0x21f76b);}(_0xc61f,0x163));var _0xfc61=function(_0x3017b8,_0x24f192){_0x3017b8=_0x3017b8-0x0;var _0x53410f=_0xc61f[_0x3017b8];return _0x53410f;};'use strict';var emlformat=require(_0xfc61('0x0'));var rimraf=require(_0xfc61('0x1'));var zipdir=require(_0xfc61('0x2'));var jsonpatch=require(_0xfc61('0x3'));var rp=require(_0xfc61('0x4'));var moment=require(_0xfc61('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfc61('0x6'));var util=require(_0xfc61('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xfc61('0x8'));var ejs=require(_0xfc61('0x9'));var fs=require('fs');var fs_extra=require(_0xfc61('0xa'));var _=require(_0xfc61('0xb'));var squel=require(_0xfc61('0xc'));var crypto=require(_0xfc61('0xd'));var jsforce=require(_0xfc61('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfc61('0x8'));var querystring=require(_0xfc61('0xf'));var Papa=require(_0xfc61('0x10'));var Redis=require('ioredis');var authService=require(_0xfc61('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfc61('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc61('0x13'))(_0xfc61('0x14'));var utils=require(_0xfc61('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfc61('0x16'));var db=require(_0xfc61('0x17'))['db'];function respondWithStatusCode(_0x40bb6a,_0x1edff7){_0x1edff7=_0x1edff7||0xcc;return function(_0x2070ec){if(_0x2070ec){return _0x40bb6a['sendStatus'](_0x1edff7);}return _0x40bb6a['status'](_0x1edff7)[_0xfc61('0x18')]();};}function respondWithResult(_0x81723b,_0x2d7ef0){_0x2d7ef0=_0x2d7ef0||0xc8;return function(_0x397ef9){if(_0x397ef9){return _0x81723b['status'](_0x2d7ef0)[_0xfc61('0x19')](_0x397ef9);}};}function respondWithFilteredResult(_0x23e16d,_0x376266){return function(_0x39450c){if(_0x39450c){var _0x4c4d69=typeof _0x376266['offset']===_0xfc61('0x1a')&&typeof _0x376266[_0xfc61('0x1b')]===_0xfc61('0x1a');var _0x5c2a7d=_0x39450c[_0xfc61('0x1c')];var _0x40141a=_0x4c4d69?0x0:_0x376266[_0xfc61('0x1d')];var _0x34f471=_0x4c4d69?_0x39450c[_0xfc61('0x1c')]:_0x376266['offset']+_0x376266[_0xfc61('0x1b')];var _0x4aab68;if(_0x34f471>=_0x5c2a7d){_0x34f471=_0x5c2a7d;_0x4aab68=0xc8;}else{_0x4aab68=0xce;}_0x23e16d['status'](_0x4aab68);return _0x23e16d[_0xfc61('0x1e')]('Content-Range',_0x40141a+'-'+_0x34f471+'/'+_0x5c2a7d)['json'](_0x39450c);}return null;};}function patchUpdates(_0x3fdcb9){return function(_0x11fbe9){try{jsonpatch[_0xfc61('0x1f')](_0x11fbe9,_0x3fdcb9,!![]);}catch(_0x3b0838){return BPromise[_0xfc61('0x20')](_0x3b0838);}return _0x11fbe9[_0xfc61('0x21')]();};}function saveUpdates(_0x2cf33a,_0x58abbd){return function(_0x3f9252){if(_0x3f9252){return _0x3f9252['update'](_0x2cf33a)['then'](function(_0x2db68f){return _0x2db68f;});}return null;};}function removeEntity(_0x173924,_0x463a52){return function(_0x20dd90){if(_0x20dd90){return _0x20dd90[_0xfc61('0x22')]()[_0xfc61('0x23')](function(){_0x173924[_0xfc61('0x24')](0xcc)[_0xfc61('0x18')]();});}};}function handleEntityNotFound(_0x4f8d41,_0x902f56){return function(_0x5ef9f4){if(!_0x5ef9f4){_0x4f8d41[_0xfc61('0x25')](0x194);}return _0x5ef9f4;};}function handleError(_0x27e803,_0x57bdfc){_0x57bdfc=_0x57bdfc||0x1f4;return function(_0x23edf1){logger[_0xfc61('0x26')](_0x23edf1[_0xfc61('0x27')]);if(_0x23edf1['name']){delete _0x23edf1[_0xfc61('0x28')];}_0x27e803[_0xfc61('0x24')](_0x57bdfc)[_0xfc61('0x29')](_0x23edf1);};}exports['index']=function(_0x463da9,_0x27c6ad){var _0x52f75d={},_0x5a023a={},_0x1e1f1e={'count':0x0,'rows':[]};var _0x169cc4=_['map'](db['MailTransferReport']['rawAttributes'],function(_0x218551){return{'name':_0x218551[_0xfc61('0x2a')],'type':_0x218551[_0xfc61('0x2b')][_0xfc61('0x2c')]};});_0x5a023a[_0xfc61('0x2d')]=_[_0xfc61('0x2e')](_0x169cc4,_0xfc61('0x28'));_0x5a023a[_0xfc61('0x2f')]=_['keys'](_0x463da9[_0xfc61('0x2f')]);_0x5a023a[_0xfc61('0x30')]=_[_0xfc61('0x31')](_0x5a023a['model'],_0x5a023a[_0xfc61('0x2f')]);_0x52f75d[_0xfc61('0x32')]=_['intersection'](_0x5a023a['model'],qs[_0xfc61('0x33')](_0x463da9[_0xfc61('0x2f')]['fields']));_0x52f75d['attributes']=_0x52f75d['attributes']['length']?_0x52f75d[_0xfc61('0x32')]:_0x5a023a['model'];if(!_0x463da9['query'][_0xfc61('0x34')](_0xfc61('0x35'))){_0x52f75d['limit']=qs[_0xfc61('0x1b')](_0x463da9[_0xfc61('0x2f')][_0xfc61('0x1b')]);_0x52f75d[_0xfc61('0x1d')]=qs[_0xfc61('0x1d')](_0x463da9[_0xfc61('0x2f')][_0xfc61('0x1d')]);}_0x52f75d['order']=qs[_0xfc61('0x36')](_0x463da9['query'][_0xfc61('0x36')]);_0x52f75d[_0xfc61('0x37')]=qs[_0xfc61('0x30')](_[_0xfc61('0x38')](_0x463da9[_0xfc61('0x2f')],_0x5a023a[_0xfc61('0x30')]),_0x169cc4);if(_0x463da9['query']['filter']){_0x52f75d['where']=_['merge'](_0x52f75d[_0xfc61('0x37')],{'$or':_[_0xfc61('0x2e')](_0x169cc4,function(_0x2c8b23){if(_0x2c8b23[_0xfc61('0x2b')]!=='VIRTUAL'){var _0x52de1d={};_0x52de1d[_0x2c8b23[_0xfc61('0x28')]]={'$like':'%'+_0x463da9[_0xfc61('0x2f')][_0xfc61('0x39')]+'%'};return _0x52de1d;}})});}_0x52f75d=_['merge']({},_0x52f75d,_0x463da9[_0xfc61('0x3a')]);var _0x14b11f={'where':_0x52f75d[_0xfc61('0x37')]};return db[_0xfc61('0x3b')][_0xfc61('0x1c')](_0x14b11f)['then'](function(_0x386c9d){_0x1e1f1e['count']=_0x386c9d;if(_0x463da9[_0xfc61('0x2f')][_0xfc61('0x3c')]){_0x52f75d[_0xfc61('0x3d')]=[{'all':!![]}];}return db[_0xfc61('0x3b')][_0xfc61('0x3e')](_0x52f75d);})['then'](function(_0x546f2d){_0x1e1f1e[_0xfc61('0x3f')]=_0x546f2d;return _0x1e1f1e;})['then'](respondWithFilteredResult(_0x27c6ad,_0x52f75d))['catch'](handleError(_0x27c6ad,null));};exports[_0xfc61('0x40')]=function(_0x55772b,_0x280672){var _0x2f765d={'raw':!![],'where':{'id':_0x55772b[_0xfc61('0x41')]['id']}},_0xe39e8b={};_0xe39e8b[_0xfc61('0x2d')]=_[_0xfc61('0x42')](db[_0xfc61('0x3b')][_0xfc61('0x43')]);_0xe39e8b[_0xfc61('0x2f')]=_['keys'](_0x55772b['query']);_0xe39e8b[_0xfc61('0x30')]=_[_0xfc61('0x31')](_0xe39e8b['model'],_0xe39e8b[_0xfc61('0x2f')]);_0x2f765d[_0xfc61('0x32')]=_[_0xfc61('0x31')](_0xe39e8b[_0xfc61('0x2d')],qs[_0xfc61('0x33')](_0x55772b[_0xfc61('0x2f')]['fields']));_0x2f765d[_0xfc61('0x32')]=_0x2f765d[_0xfc61('0x32')][_0xfc61('0x44')]?_0x2f765d[_0xfc61('0x32')]:_0xe39e8b[_0xfc61('0x2d')];if(_0x55772b[_0xfc61('0x2f')][_0xfc61('0x3c')]){_0x2f765d[_0xfc61('0x3d')]=[{'all':!![]}];}_0x2f765d=_[_0xfc61('0x45')]({},_0x2f765d,_0x55772b[_0xfc61('0x3a')]);return db[_0xfc61('0x3b')][_0xfc61('0x46')](_0x2f765d)['then'](handleEntityNotFound(_0x280672,null))[_0xfc61('0x23')](respondWithResult(_0x280672,null))[_0xfc61('0x47')](handleError(_0x280672,null));};exports[_0xfc61('0x48')]=function(_0x179121,_0x48527f){return db['MailTransferReport'][_0xfc61('0x48')](_0x179121['body'],{})[_0xfc61('0x23')](respondWithResult(_0x48527f,0xc9))['catch'](handleError(_0x48527f,null));};exports[_0xfc61('0x49')]=function(_0x19219d,_0x2b6e64){if(_0x19219d[_0xfc61('0x4a')]['id']){delete _0x19219d[_0xfc61('0x4a')]['id'];}return db[_0xfc61('0x3b')][_0xfc61('0x46')]({'where':{'id':_0x19219d[_0xfc61('0x41')]['id']}})[_0xfc61('0x23')](handleEntityNotFound(_0x2b6e64,null))[_0xfc61('0x23')](saveUpdates(_0x19219d['body'],null))[_0xfc61('0x23')](respondWithResult(_0x2b6e64,null))[_0xfc61('0x47')](handleError(_0x2b6e64,null));};exports['destroy']=function(_0x5b5cca,_0x4a0159){return db[_0xfc61('0x3b')][_0xfc61('0x46')]({'where':{'id':_0x5b5cca[_0xfc61('0x41')]['id']}})['then'](handleEntityNotFound(_0x4a0159,null))[_0xfc61('0x23')](removeEntity(_0x4a0159,null))[_0xfc61('0x47')](handleError(_0x4a0159,null));};exports[_0xfc61('0x4b')]=function(_0x235ba7,_0x18e896){return db[_0xfc61('0x3b')][_0xfc61('0x4b')]()[_0xfc61('0x23')](respondWithResult(_0x18e896,null))[_0xfc61('0x47')](handleError(_0x18e896,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 798788e..c63dfe2 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 _0xaa48=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x559319,_0x55a8d5){var _0xf23388=function(_0x180c16){while(--_0x180c16){_0x559319['push'](_0x559319['shift']());}};_0xf23388(++_0x55a8d5);}(_0xaa48,0x15a));var _0x8aa4=function(_0x597052,_0x1cd33a){_0x597052=_0x597052-0x0;var _0x5955b1=_0xaa48[_0x597052];return _0x5955b1;};'use strict';var _=require(_0x8aa4('0x0'));var util=require(_0x8aa4('0x1'));var logger=require(_0x8aa4('0x2'))(_0x8aa4('0x3'));var moment=require(_0x8aa4('0x4'));var BPromise=require(_0x8aa4('0x5'));var rp=require(_0x8aa4('0x6'));var fs=require('fs');var path=require(_0x8aa4('0x7'));var rimraf=require(_0x8aa4('0x8'));var config=require(_0x8aa4('0x9'));var attributes=require(_0x8aa4('0xa'));module[_0x8aa4('0xb')]=function(_0x141d8b,_0x14614c){return _0x141d8b[_0x8aa4('0xc')](_0x8aa4('0xd'),attributes,{'tableName':_0x8aa4('0xe'),'paranoid':![],'indexes':[{'name':_0x8aa4('0xf'),'fields':[_0x8aa4('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8a8b=['exports','define','report_mail_transfer','uniqueid','lodash','api','moment','request-promise','rimraf','./mailTransferReport.attributes'];(function(_0x5083da,_0x174589){var _0x5c3887=function(_0x571048){while(--_0x571048){_0x5083da['push'](_0x5083da['shift']());}};_0x5c3887(++_0x174589);}(_0x8a8b,0xae));var _0xb8a8=function(_0xcc6b4,_0x3b5d58){_0xcc6b4=_0xcc6b4-0x0;var _0x542fe3=_0x8a8b[_0xcc6b4];return _0x542fe3;};'use strict';var _=require(_0xb8a8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb8a8('0x1'));var moment=require(_0xb8a8('0x2'));var BPromise=require('bluebird');var rp=require(_0xb8a8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb8a8('0x4'));var config=require('../../config/environment');var attributes=require(_0xb8a8('0x5'));module[_0xb8a8('0x6')]=function(_0xcca5ca,_0x578e1b){return _0xcca5ca[_0xb8a8('0x7')]('MailTransferReport',attributes,{'tableName':_0xb8a8('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb8a8('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index a7c069f..7dd1a90 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 _0xf062=['debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xf062,0x93));var _0x2f06=function(_0x518032,_0x5e430c){_0x518032=_0x518032-0x0;var _0x2a8ce1=_0xf062[_0x518032];return _0x2a8ce1;};'use strict';var _=require('lodash');var util=require(_0x2f06('0x0'));var moment=require(_0x2f06('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f06('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f06('0x3'));var logger=require(_0x2f06('0x4'))(_0x2f06('0x5'));var config=require(_0x2f06('0x6'));var jayson=require(_0x2f06('0x7'));var client=jayson[_0x2f06('0x8')][_0x2f06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2852f3,_0xf5d835,_0x384f6f){return new BPromise(function(_0x4e8ee6,_0x544a9b){return client[_0x2f06('0xa')](_0x2852f3,_0x384f6f)[_0x2f06('0xb')](function(_0x348ad4){logger[_0x2f06('0xc')]('MailTransferReport,\x20%s,\x20%s',_0xf5d835,_0x2f06('0xd'));logger[_0x2f06('0xe')](_0x2f06('0xf'),_0xf5d835,_0x2f06('0xd'),JSON[_0x2f06('0x10')](_0x348ad4));if(_0x348ad4[_0x2f06('0x11')]){if(_0x348ad4['error'][_0x2f06('0x12')]===0x1f4){logger[_0x2f06('0x11')](_0x2f06('0x13'),_0xf5d835,_0x348ad4['error'][_0x2f06('0x14')]);return _0x544a9b(_0x348ad4[_0x2f06('0x11')][_0x2f06('0x14')]);}logger[_0x2f06('0x11')]('MailTransferReport,\x20%s,\x20%s',_0xf5d835,_0x348ad4[_0x2f06('0x11')][_0x2f06('0x14')]);return _0x4e8ee6(_0x348ad4[_0x2f06('0x11')][_0x2f06('0x14')]);}else{logger[_0x2f06('0xc')]('MailTransferReport,\x20%s,\x20%s',_0xf5d835,_0x2f06('0xd'));_0x4e8ee6(_0x348ad4[_0x2f06('0x15')][_0x2f06('0x14')]);}})[_0x2f06('0x16')](function(_0x4172d5){logger['error'](_0x2f06('0x13'),_0xf5d835,_0x4172d5);_0x544a9b(_0x4172d5);});});} \ No newline at end of file +var _0x2713=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x1b55a9,_0x231d6e){var _0x4e2051=function(_0x2a412e){while(--_0x2a412e){_0x1b55a9['push'](_0x1b55a9['shift']());}};_0x4e2051(++_0x231d6e);}(_0x2713,0x164));var _0x3271=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2713[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x3271('0x0'));var util=require(_0x3271('0x1'));var moment=require(_0x3271('0x2'));var BPromise=require(_0x3271('0x3'));var rs=require(_0x3271('0x4'));var fs=require('fs');var Redis=require(_0x3271('0x5'));var db=require(_0x3271('0x6'))['db'];var utils=require(_0x3271('0x7'));var logger=require(_0x3271('0x8'))(_0x3271('0x9'));var config=require(_0x3271('0xa'));var jayson=require(_0x3271('0xb'));var client=jayson[_0x3271('0xc')][_0x3271('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2180bd,_0x39d924,_0x4303fe){return new BPromise(function(_0x574534,_0x4d41db){return client['request'](_0x2180bd,_0x4303fe)['then'](function(_0x4fe767){logger[_0x3271('0xe')](_0x3271('0xf'),_0x39d924,_0x3271('0x10'));logger[_0x3271('0x11')](_0x3271('0x12'),_0x39d924,_0x3271('0x10'),JSON[_0x3271('0x13')](_0x4fe767));if(_0x4fe767[_0x3271('0x14')]){if(_0x4fe767[_0x3271('0x14')][_0x3271('0x15')]===0x1f4){logger[_0x3271('0x14')](_0x3271('0xf'),_0x39d924,_0x4fe767[_0x3271('0x14')]['message']);return _0x4d41db(_0x4fe767['error'][_0x3271('0x16')]);}logger['error'](_0x3271('0xf'),_0x39d924,_0x4fe767[_0x3271('0x14')][_0x3271('0x16')]);return _0x574534(_0x4fe767['error'][_0x3271('0x16')]);}else{logger['info'](_0x3271('0xf'),_0x39d924,'request\x20sent');_0x574534(_0x4fe767[_0x3271('0x17')][_0x3271('0x16')]);}})[_0x3271('0x18')](function(_0x40cf27){logger['error'](_0x3271('0xf'),_0x39d924,_0x40cf27);_0x4d41db(_0x40cf27);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 7c168b9..aadf848 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 _0x49b2=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller'];(function(_0x3840ac,_0x187a97){var _0x2fcea8=function(_0x58d0bb){while(--_0x58d0bb){_0x3840ac['push'](_0x3840ac['shift']());}};_0x2fcea8(++_0x187a97);}(_0x49b2,0x12b));var _0x249b=function(_0x4c2dc8,_0x5795e1){_0x4c2dc8=_0x4c2dc8-0x0;var _0x14b1af=_0x49b2[_0x4c2dc8];return _0x14b1af;};'use strict';var multer=require(_0x249b('0x0'));var util=require('util');var path=require(_0x249b('0x1'));var timeout=require(_0x249b('0x2'));var express=require(_0x249b('0x3'));var router=express[_0x249b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x249b('0x5'));var interaction=require(_0x249b('0x6'));var config=require(_0x249b('0x7'));var controller=require(_0x249b('0x8'));router[_0x249b('0x9')]('/',auth[_0x249b('0xa')](),controller[_0x249b('0xb')]);router['get'](_0x249b('0xc'),auth[_0x249b('0xa')](),controller[_0x249b('0xd')]);router[_0x249b('0x9')](_0x249b('0xe'),auth[_0x249b('0xa')](),controller[_0x249b('0xf')]);router[_0x249b('0x10')]('/',auth[_0x249b('0xa')](),controller[_0x249b('0x11')]);router['put'](_0x249b('0xe'),auth[_0x249b('0xa')](),controller[_0x249b('0x12')]);router[_0x249b('0x13')]('/:id',auth[_0x249b('0xa')](),controller[_0x249b('0x14')]);module[_0x249b('0x15')]=router; \ No newline at end of file +var _0x2754=['destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete'];(function(_0x86f131,_0x3655bd){var _0x1c2fe2=function(_0x222e43){while(--_0x222e43){_0x86f131['push'](_0x86f131['shift']());}};_0x1c2fe2(++_0x3655bd);}(_0x2754,0x12e));var _0x4275=function(_0x35e695,_0x35c7a8){_0x35e695=_0x35e695-0x0;var _0x1a4be2=_0x2754[_0x35e695];return _0x1a4be2;};'use strict';var multer=require('multer');var util=require(_0x4275('0x0'));var path=require(_0x4275('0x1'));var timeout=require(_0x4275('0x2'));var express=require('express');var router=express[_0x4275('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4275('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4275('0x5'));var controller=require(_0x4275('0x6'));router[_0x4275('0x7')]('/',auth[_0x4275('0x8')](),controller[_0x4275('0x9')]);router[_0x4275('0x7')](_0x4275('0xa'),auth['isAuthenticated'](),controller[_0x4275('0xb')]);router[_0x4275('0x7')](_0x4275('0xc'),auth[_0x4275('0x8')](),controller[_0x4275('0xd')]);router[_0x4275('0xe')]('/',auth[_0x4275('0x8')](),controller['create']);router[_0x4275('0xf')](_0x4275('0xc'),auth[_0x4275('0x8')](),controller[_0x4275('0x10')]);router[_0x4275('0x11')](_0x4275('0xc'),auth['isAuthenticated'](),controller[_0x4275('0x12')]);module[_0x4275('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 583ff12..bb561d9 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 _0xd442=['setDataValue','exitAt','duration','talk:[dial\x20string]','INTEGER','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds'];(function(_0x3e665d,_0xef863d){var _0x24a155=function(_0x1343e7){while(--_0x1343e7){_0x3e665d['push'](_0x3e665d['shift']());}};_0x24a155(++_0xef863d);}(_0xd442,0xf5));var _0x2d44=function(_0x25d74e,_0x3ceaef){_0x25d74e=_0x25d74e-0x0;var _0x509a5f=_0xd442[_0x25d74e];return _0x509a5f;};'use strict';var Sequelize=require(_0x2d44('0x0'));var moment=require(_0x2d44('0x1'));module['exports']={'channel':{'type':Sequelize[_0x2d44('0x2')]},'membername':{'type':Sequelize[_0x2d44('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2d44('0x2')],'defaultValue':_0x2d44('0x3'),'comment':_0x2d44('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x2d44('0x5')]},'exitAt':{'type':Sequelize[_0x2d44('0x5')],'set':function(_0x3b9815){var _0x5b3c79=moment(_0x3b9815);var _0x17089c=moment(this[_0x2d44('0x6')](_0x2d44('0x7')));var _0xc59627=_0x5b3c79[_0x2d44('0x8')](_0x17089c,_0x2d44('0x9'));this[_0x2d44('0xa')](_0x2d44('0xb'),_0x3b9815);this[_0x2d44('0xa')](_0x2d44('0xc'),_0xc59627>=0x0?_0xc59627:null);}},'data1':{'type':Sequelize[_0x2d44('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x2d44('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x2d44('0x2')],'comment':_0x2d44('0xd')},'data5':{'type':Sequelize[_0x2d44('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x2d44('0x2')]},'internal':{'type':Sequelize[_0x2d44('0xe')]},'uniqueid':{'type':Sequelize[_0x2d44('0x2')]}}; \ No newline at end of file +var _0xeac0=['talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','setDataValue','talk:[start]'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0xeac0,0x1f0));var _0x0eac=function(_0x355e87,_0x2e065c){_0x355e87=_0x355e87-0x0;var _0x4028de=_0xeac0[_0x355e87];return _0x4028de;};'use strict';var Sequelize=require(_0x0eac('0x0'));var moment=require('moment');module[_0x0eac('0x1')]={'channel':{'type':Sequelize[_0x0eac('0x2')]},'membername':{'type':Sequelize[_0x0eac('0x2')]},'interface':{'type':Sequelize[_0x0eac('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x0eac('0x3'),'comment':_0x0eac('0x4')},'duration':{'type':Sequelize[_0x0eac('0x5')]},'enterAt':{'type':Sequelize[_0x0eac('0x6')]},'exitAt':{'type':Sequelize[_0x0eac('0x6')],'set':function(_0x245c0f){var _0x2c6d00=moment(_0x245c0f);var _0x355536=moment(this[_0x0eac('0x7')](_0x0eac('0x8')));var _0x493943=_0x2c6d00['diff'](_0x355536,'seconds');this[_0x0eac('0x9')]('exitAt',_0x245c0f);this[_0x0eac('0x9')]('duration',_0x493943>=0x0?_0x493943:null);}},'data1':{'type':Sequelize[_0x0eac('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x0eac('0x2')],'comment':_0x0eac('0xa')},'data3':{'type':Sequelize[_0x0eac('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x0eac('0x2')],'comment':_0x0eac('0xb')},'data5':{'type':Sequelize['STRING'],'comment':_0x0eac('0xc')},'role':{'type':Sequelize[_0x0eac('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x0eac('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index bf3bab5..51e9f94 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 _0x9957=['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','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x259aaf,_0x5dbec1){var _0x366663=function(_0x24a61a){while(--_0x24a61a){_0x259aaf['push'](_0x259aaf['shift']());}};_0x366663(++_0x5dbec1);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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['MemberReport']['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['MemberReport'][_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['MemberReport'][_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('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,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(_0x391481,_0x3ae5a5){var _0x5721b6=function(_0x455abe){while(--_0x455abe){_0x391481['push'](_0x391481['shift']());}};_0x5721b6(++_0x3ae5a5);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'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 b5ddd5c..6063261 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 _0xbc74=['membername_interface','membername','interface','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define','MemberReport','report_member'];(function(_0x2484c6,_0x17dbbd){var _0x3d09a6=function(_0x4fa0a1){while(--_0x4fa0a1){_0x2484c6['push'](_0x2484c6['shift']());}};_0x3d09a6(++_0x17dbbd);}(_0xbc74,0x1c3));var _0x4bc7=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xbc74[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x4bc7('0x0'));var util=require(_0x4bc7('0x1'));var logger=require(_0x4bc7('0x2'))('api');var moment=require(_0x4bc7('0x3'));var BPromise=require(_0x4bc7('0x4'));var rp=require(_0x4bc7('0x5'));var fs=require('fs');var path=require(_0x4bc7('0x6'));var rimraf=require('rimraf');var config=require(_0x4bc7('0x7'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x2f4caf,_0x6a2392){return _0x2f4caf[_0x4bc7('0x8')](_0x4bc7('0x9'),attributes,{'tableName':_0x4bc7('0xa'),'paranoid':![],'indexes':[{'name':_0x4bc7('0xb'),'fields':[_0x4bc7('0xc'),_0x4bc7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3338=['rimraf','../../config/environment','./memberReport.attributes','exports','define','membername','interface','lodash','util','moment','bluebird','request-promise','path'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x3338,0xb0));var _0x8333=function(_0x135f1f,_0x45e875){_0x135f1f=_0x135f1f-0x0;var _0x547ed6=_0x3338[_0x135f1f];return _0x547ed6;};'use strict';var _=require(_0x8333('0x0'));var util=require(_0x8333('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8333('0x2'));var BPromise=require(_0x8333('0x3'));var rp=require(_0x8333('0x4'));var fs=require('fs');var path=require(_0x8333('0x5'));var rimraf=require(_0x8333('0x6'));var config=require(_0x8333('0x7'));var attributes=require(_0x8333('0x8'));module[_0x8333('0x9')]=function(_0xde1a75,_0x14211c){return _0xde1a75[_0x8333('0xa')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x8333('0xb'),_0x8333('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index f142810..855e5e6 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 _0x8ca9=['UpdateMemberReport','update','body','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','map','include','model','catch','CreateMemberReport','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ca9,0x9c));var _0x98ca=function(_0x16b909,_0x10447d){_0x16b909=_0x16b909-0x0;var _0x55270b=_0x8ca9[_0x16b909];return _0x55270b;};'use strict';var _=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var moment=require(_0x98ca('0x2'));var BPromise=require(_0x98ca('0x3'));var rs=require(_0x98ca('0x4'));var fs=require('fs');var Redis=require(_0x98ca('0x5'));var db=require(_0x98ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x98ca('0x7'));var config=require('../../config/environment');var jayson=require(_0x98ca('0x8'));var client=jayson['client'][_0x98ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xca4097,_0x18c349,_0x2852a0){return new BPromise(function(_0x323c95,_0x28a37a){return client[_0x98ca('0xa')](_0xca4097,_0x2852a0)[_0x98ca('0xb')](function(_0x277c29){logger[_0x98ca('0xc')](_0x98ca('0xd'),_0x18c349,_0x98ca('0xe'));logger[_0x98ca('0xf')](_0x98ca('0x10'),_0x18c349,_0x98ca('0xe'),JSON[_0x98ca('0x11')](_0x277c29));if(_0x277c29[_0x98ca('0x12')]){if(_0x277c29[_0x98ca('0x12')]['code']===0x1f4){logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);return _0x28a37a(_0x277c29['error'][_0x98ca('0x13')]);}logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);return _0x323c95(_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);}else{logger['info'](_0x98ca('0xd'),_0x18c349,_0x98ca('0xe'));_0x323c95(_0x277c29[_0x98ca('0x14')][_0x98ca('0x13')]);}})['catch'](function(_0x238c1a){logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x238c1a);_0x28a37a(_0x238c1a);});});}exports[_0x98ca('0x15')]=function(_0x4523bb){var _0x3ca209=this;return new Promise(function(_0x28c8a6,_0x3dc670){return db[_0x98ca('0x16')][_0x98ca('0x17')]({'raw':_0x4523bb[_0x98ca('0x18')]?_0x4523bb['options'][_0x98ca('0x19')]===undefined?!![]:![]:!![],'where':_0x4523bb['options']?_0x4523bb[_0x98ca('0x18')][_0x98ca('0x1a')]||null:null,'attributes':_0x4523bb['options']?_0x4523bb['options'][_0x98ca('0x1b')]||null:null,'limit':_0x4523bb[_0x98ca('0x18')]?_0x4523bb[_0x98ca('0x18')]['limit']||null:null,'include':_0x4523bb[_0x98ca('0x18')]?_0x4523bb[_0x98ca('0x18')]['include']?_[_0x98ca('0x1c')](_0x4523bb['options'][_0x98ca('0x1d')],function(_0x323cdb){return{'model':db[_0x323cdb[_0x98ca('0x1e')]],'as':_0x323cdb['as'],'attributes':_0x323cdb[_0x98ca('0x1b')],'include':_0x323cdb[_0x98ca('0x1d')]?_[_0x98ca('0x1c')](_0x323cdb[_0x98ca('0x1d')],function(_0x50b1a2){return{'model':db[_0x50b1a2[_0x98ca('0x1e')]],'as':_0x50b1a2['as'],'attributes':_0x50b1a2['attributes'],'include':_0x50b1a2[_0x98ca('0x1d')]?_[_0x98ca('0x1c')](_0x50b1a2['include'],function(_0x1f569b){return{'model':db[_0x1f569b['model']],'as':_0x1f569b['as'],'attributes':_0x1f569b[_0x98ca('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bf77d){logger[_0x98ca('0xc')]('GetMemberReport',_0x4523bb);logger[_0x98ca('0xf')](_0x98ca('0x15'),_0x4523bb,JSON[_0x98ca('0x11')](_0x5bf77d));_0x28c8a6(_0x5bf77d);})[_0x98ca('0x1f')](function(_0x3b3e60){logger[_0x98ca('0x12')](_0x98ca('0x15'),_0x3b3e60[_0x98ca('0x13')],_0x4523bb);_0x3dc670(_0x3ca209[_0x98ca('0x12')](0x1f4,_0x3b3e60['message']));});});};exports[_0x98ca('0x20')]=function(_0x4cc74f){var _0xb873c5=this;return new Promise(function(_0x34b74d,_0x4d43fd){return db['MemberReport'][_0x98ca('0x21')](_0x4cc74f['body'],{'raw':_0x4cc74f[_0x98ca('0x18')]?_0x4cc74f['options'][_0x98ca('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x401034){logger[_0x98ca('0xc')]('CreateMemberReport',_0x4cc74f);logger[_0x98ca('0xf')](_0x98ca('0x20'),_0x4cc74f,JSON['stringify'](_0x401034));_0x34b74d(_0x401034);})[_0x98ca('0x1f')](function(_0x3c6d06){logger['error'](_0x98ca('0x20'),_0x3c6d06[_0x98ca('0x13')],_0x4cc74f);_0x4d43fd(_0xb873c5[_0x98ca('0x12')](0x1f4,_0x3c6d06[_0x98ca('0x13')]));});});};exports[_0x98ca('0x22')]=function(_0x47b1c1){var _0x15e428=this;return new Promise(function(_0x430a37,_0x48a26c){return db[_0x98ca('0x16')][_0x98ca('0x23')](_0x47b1c1[_0x98ca('0x24')],{'raw':_0x47b1c1['options']?_0x47b1c1[_0x98ca('0x18')][_0x98ca('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47b1c1[_0x98ca('0x18')]?_0x47b1c1['options'][_0x98ca('0x1a')]||null:null,'attributes':_0x47b1c1[_0x98ca('0x18')]?_0x47b1c1[_0x98ca('0x18')]['attributes']||null:null,'limit':_0x47b1c1['options']?_0x47b1c1[_0x98ca('0x18')][_0x98ca('0x25')]||null:null})[_0x98ca('0xb')](function(_0x48636b){logger[_0x98ca('0xc')](_0x98ca('0x22'),_0x47b1c1);logger[_0x98ca('0xf')]('UpdateMemberReport',_0x47b1c1,JSON[_0x98ca('0x11')](_0x48636b));_0x430a37(_0x48636b);})[_0x98ca('0x1f')](function(_0x1059df){logger[_0x98ca('0x12')](_0x98ca('0x22'),_0x1059df['message'],_0x47b1c1);_0x48a26c(_0x15e428['error'](0x1f4,_0x1059df['message']));});});}; \ No newline at end of file +var _0x2eb2=['error','MemberReport,\x20%s,\x20%s','message','MemberReport','options','raw','attributes','limit','include','map','model','GetMemberReport','stringify','catch','CreateMemberReport','body','debug','UpdateMemberReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x5202e8,_0x2446f9){var _0x2d9ee9=function(_0x250018){while(--_0x250018){_0x5202e8['push'](_0x5202e8['shift']());}};_0x2d9ee9(++_0x2446f9);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x2eb2[_0x4e1d03];return _0x362d4b;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9850,_0x4539d0,_0x396806){return new BPromise(function(_0x33ddef,_0x3375d6){return client[_0x22eb('0xa')](_0x2a9850,_0x396806)[_0x22eb('0xb')](function(_0xb9c8a4){logger[_0x22eb('0xc')]('MemberReport,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'),JSON['stringify'](_0xb9c8a4));if(_0xb9c8a4[_0x22eb('0xe')]){if(_0xb9c8a4[_0x22eb('0xe')]['code']===0x1f4){logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);return _0x3375d6(_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);}logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4['error'][_0x22eb('0x10')]);return _0x33ddef(_0xb9c8a4['error'][_0x22eb('0x10')]);}else{logger[_0x22eb('0xc')]('MemberReport,\x20%s,\x20%s',_0x4539d0,'request\x20sent');_0x33ddef(_0xb9c8a4['result'][_0x22eb('0x10')]);}})['catch'](function(_0x50176d){logger[_0x22eb('0xe')]('MemberReport,\x20%s,\x20%s',_0x4539d0,_0x50176d);_0x3375d6(_0x50176d);});});}exports['GetMemberReport']=function(_0xb7a73a){var _0x2a55e4=this;return new Promise(function(_0x385bcb,_0x1ff041){return db[_0x22eb('0x11')]['findAll']({'raw':_0xb7a73a[_0x22eb('0x12')]?_0xb7a73a[_0x22eb('0x12')][_0x22eb('0x13')]===undefined?!![]:![]:!![],'where':_0xb7a73a[_0x22eb('0x12')]?_0xb7a73a[_0x22eb('0x12')]['where']||null:null,'attributes':_0xb7a73a[_0x22eb('0x12')]?_0xb7a73a[_0x22eb('0x12')][_0x22eb('0x14')]||null:null,'limit':_0xb7a73a['options']?_0xb7a73a['options'][_0x22eb('0x15')]||null:null,'include':_0xb7a73a[_0x22eb('0x12')]?_0xb7a73a[_0x22eb('0x12')][_0x22eb('0x16')]?_[_0x22eb('0x17')](_0xb7a73a[_0x22eb('0x12')][_0x22eb('0x16')],function(_0x4e7e69){return{'model':db[_0x4e7e69[_0x22eb('0x18')]],'as':_0x4e7e69['as'],'attributes':_0x4e7e69[_0x22eb('0x14')],'include':_0x4e7e69[_0x22eb('0x16')]?_[_0x22eb('0x17')](_0x4e7e69[_0x22eb('0x16')],function(_0x4da252){return{'model':db[_0x4da252[_0x22eb('0x18')]],'as':_0x4da252['as'],'attributes':_0x4da252[_0x22eb('0x14')],'include':_0x4da252[_0x22eb('0x16')]?_['map'](_0x4da252[_0x22eb('0x16')],function(_0x259847){return{'model':db[_0x259847['model']],'as':_0x259847['as'],'attributes':_0x259847[_0x22eb('0x14')]};}):[]};}):[]};}):[]:[]})[_0x22eb('0xb')](function(_0x1e3015){logger[_0x22eb('0xc')](_0x22eb('0x19'),_0xb7a73a);logger['debug']('GetMemberReport',_0xb7a73a,JSON[_0x22eb('0x1a')](_0x1e3015));_0x385bcb(_0x1e3015);})[_0x22eb('0x1b')](function(_0x44cf91){logger[_0x22eb('0xe')](_0x22eb('0x19'),_0x44cf91[_0x22eb('0x10')],_0xb7a73a);_0x1ff041(_0x2a55e4[_0x22eb('0xe')](0x1f4,_0x44cf91[_0x22eb('0x10')]));});});};exports[_0x22eb('0x1c')]=function(_0x39cec1){var _0x24e9dc=this;return new Promise(function(_0x5a37f8,_0x54f401){return db[_0x22eb('0x11')]['create'](_0x39cec1[_0x22eb('0x1d')],{'raw':_0x39cec1[_0x22eb('0x12')]?_0x39cec1[_0x22eb('0x12')][_0x22eb('0x13')]===undefined?!![]:![]:!![]})[_0x22eb('0xb')](function(_0x158cfa){logger[_0x22eb('0xc')](_0x22eb('0x1c'),_0x39cec1);logger[_0x22eb('0x1e')](_0x22eb('0x1c'),_0x39cec1,JSON['stringify'](_0x158cfa));_0x5a37f8(_0x158cfa);})['catch'](function(_0x239a41){logger['error']('CreateMemberReport',_0x239a41[_0x22eb('0x10')],_0x39cec1);_0x54f401(_0x24e9dc[_0x22eb('0xe')](0x1f4,_0x239a41[_0x22eb('0x10')]));});});};exports[_0x22eb('0x1f')]=function(_0x45c53e){var _0x332e9a=this;return new Promise(function(_0x3855df,_0x42a6d6){return db[_0x22eb('0x11')][_0x22eb('0x20')](_0x45c53e['body'],{'raw':_0x45c53e[_0x22eb('0x12')]?_0x45c53e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45c53e[_0x22eb('0x12')]?_0x45c53e[_0x22eb('0x12')]['where']||null:null,'attributes':_0x45c53e[_0x22eb('0x12')]?_0x45c53e[_0x22eb('0x12')][_0x22eb('0x14')]||null:null,'limit':_0x45c53e[_0x22eb('0x12')]?_0x45c53e[_0x22eb('0x12')]['limit']||null:null})[_0x22eb('0xb')](function(_0x1aea5f){logger['info'](_0x22eb('0x1f'),_0x45c53e);logger[_0x22eb('0x1e')](_0x22eb('0x1f'),_0x45c53e,JSON[_0x22eb('0x1a')](_0x1aea5f));_0x3855df(_0x1aea5f);})[_0x22eb('0x1b')](function(_0x5382eb){logger['error'](_0x22eb('0x1f'),_0x5382eb[_0x22eb('0x10')],_0x45c53e);_0x42a6d6(_0x332e9a['error'](0x1f4,_0x5382eb[_0x22eb('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 5941827..ec1dd38 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 _0x5549=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x247d5c,_0x467287){var _0xf576c=function(_0x13f623){while(--_0x13f623){_0x247d5c['push'](_0x247d5c['shift']());}};_0xf576c(++_0x467287);}(_0x5549,0x1f4));var _0x9554=function(_0x44d05f,_0xedc0f2){_0x44d05f=_0x44d05f-0x0;var _0x2fb57b=_0x5549[_0x44d05f];return _0x2fb57b;};'use strict';var multer=require(_0x9554('0x0'));var util=require(_0x9554('0x1'));var path=require(_0x9554('0x2'));var timeout=require(_0x9554('0x3'));var express=require(_0x9554('0x4'));var router=express['Router']();var fs_extra=require(_0x9554('0x5'));var auth=require(_0x9554('0x6'));var interaction=require(_0x9554('0x7'));var config=require(_0x9554('0x8'));var controller=require(_0x9554('0x9'));router['get']('/',controller[_0x9554('0xa')]);module['exports']=router; \ No newline at end of file +var _0xf131=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','multer'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf131,0x1a1));var _0x1f13=function(_0x4b82d9,_0x2c024b){_0x4b82d9=_0x4b82d9-0x0;var _0x52a238=_0xf131[_0x4b82d9];return _0x52a238;};'use strict';var multer=require(_0x1f13('0x0'));var util=require(_0x1f13('0x1'));var path=require(_0x1f13('0x2'));var timeout=require(_0x1f13('0x3'));var express=require(_0x1f13('0x4'));var router=express[_0x1f13('0x5')]();var fs_extra=require(_0x1f13('0x6'));var auth=require(_0x1f13('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1f13('0x8'));var controller=require('./migration.controller');router[_0x1f13('0x9')]('/',controller[_0x1f13('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 69fc0e9..ea37f6b 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 _0x9a1b=['exports','STRING','version','sequelize'];(function(_0x47a022,_0x409170){var _0x4f7fc1=function(_0x1bb89a){while(--_0x1bb89a){_0x47a022['push'](_0x47a022['shift']());}};_0x4f7fc1(++_0x409170);}(_0x9a1b,0x123));var _0xb9a1=function(_0x3bf111,_0x5a5ece){_0x3bf111=_0x3bf111-0x0;var _0x2a8e6e=_0x9a1b[_0x3bf111];return _0x2a8e6e;};'use strict';var Sequelize=require(_0xb9a1('0x0'));module[_0xb9a1('0x1')]={'version':{'type':Sequelize[_0xb9a1('0x2')],'unique':_0xb9a1('0x3')}}; \ No newline at end of file +var _0x7ee9=['version'];(function(_0x179bb9,_0x2eadd8){var _0x5e093d=function(_0x1cf1ca){while(--_0x1cf1ca){_0x179bb9['push'](_0x179bb9['shift']());}};_0x5e093d(++_0x2eadd8);}(_0x7ee9,0x115));var _0x97ee=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x7ee9[_0x1deb03];return _0x189fe7;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x97ee('0x0')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 89919b5..fa98335 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 _0x8bc9=['../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','set','json','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','Migration','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','include','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2cacf9,_0x24ffe3){var _0x1590d4=function(_0x59249d){while(--_0x59249d){_0x2cacf9['push'](_0x2cacf9['shift']());}};_0x1590d4(++_0x24ffe3);}(_0x8bc9,0xec));var _0x98bc=function(_0x29f62e,_0xf58e94){_0x29f62e=_0x29f62e-0x0;var _0xeefdb8=_0x8bc9[_0x29f62e];return _0xeefdb8;};'use strict';var emlformat=require(_0x98bc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98bc('0x1'));var jsonpatch=require(_0x98bc('0x2'));var rp=require(_0x98bc('0x3'));var moment=require(_0x98bc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x98bc('0x5'));var util=require(_0x98bc('0x6'));var path=require(_0x98bc('0x7'));var sox=require(_0x98bc('0x8'));var csv=require(_0x98bc('0x9'));var ejs=require(_0x98bc('0xa'));var fs=require('fs');var fs_extra=require(_0x98bc('0xb'));var _=require(_0x98bc('0xc'));var squel=require(_0x98bc('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x98bc('0xe'));var toCsv=require(_0x98bc('0x9'));var querystring=require(_0x98bc('0xf'));var Papa=require('papaparse');var Redis=require(_0x98bc('0x10'));var authService=require(_0x98bc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x98bc('0x12'));var hardwareService=require(_0x98bc('0x13'));var logger=require(_0x98bc('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x98bc('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x98bc('0x16'))['db'];function respondWithStatusCode(_0x3eb9fd,_0x274482){_0x274482=_0x274482||0xcc;return function(_0x13da1d){if(_0x13da1d){return _0x3eb9fd[_0x98bc('0x17')](_0x274482);}return _0x3eb9fd[_0x98bc('0x18')](_0x274482)['end']();};}function respondWithResult(_0x115d34,_0x4f6b02){_0x4f6b02=_0x4f6b02||0xc8;return function(_0x5f1492){if(_0x5f1492){return _0x115d34[_0x98bc('0x18')](_0x4f6b02)['json'](_0x5f1492);}};}function respondWithFilteredResult(_0xae67ed,_0x324851){return function(_0x43cb87){if(_0x43cb87){var _0x4f094e=typeof _0x324851[_0x98bc('0x19')]===_0x98bc('0x1a')&&typeof _0x324851[_0x98bc('0x1b')]===_0x98bc('0x1a');var _0x38ab0b=_0x43cb87['count'];var _0x29d4cc=_0x4f094e?0x0:_0x324851[_0x98bc('0x19')];var _0x34d6bb=_0x4f094e?_0x43cb87['count']:_0x324851['offset']+_0x324851['limit'];var _0x41bf88;if(_0x34d6bb>=_0x38ab0b){_0x34d6bb=_0x38ab0b;_0x41bf88=0xc8;}else{_0x41bf88=0xce;}_0xae67ed[_0x98bc('0x18')](_0x41bf88);return _0xae67ed[_0x98bc('0x1c')]('Content-Range',_0x29d4cc+'-'+_0x34d6bb+'/'+_0x38ab0b)[_0x98bc('0x1d')](_0x43cb87);}return null;};}function patchUpdates(_0x532390){return function(_0x52fbe4){try{jsonpatch[_0x98bc('0x1e')](_0x52fbe4,_0x532390,!![]);}catch(_0x5ba8ec){return BPromise[_0x98bc('0x1f')](_0x5ba8ec);}return _0x52fbe4[_0x98bc('0x20')]();};}function saveUpdates(_0x1ec2ae,_0x22afd3){return function(_0x522fc3){if(_0x522fc3){return _0x522fc3['update'](_0x1ec2ae)[_0x98bc('0x21')](function(_0x5e4247){return _0x5e4247;});}return null;};}function removeEntity(_0x31306b,_0x57afc2){return function(_0x11d108){if(_0x11d108){return _0x11d108[_0x98bc('0x22')]()[_0x98bc('0x21')](function(){_0x31306b[_0x98bc('0x18')](0xcc)[_0x98bc('0x23')]();});}};}function handleEntityNotFound(_0x3e9a61,_0x17af95){return function(_0x16524b){if(!_0x16524b){_0x3e9a61[_0x98bc('0x17')](0x194);}return _0x16524b;};}function handleError(_0x1476a5,_0x53fea6){_0x53fea6=_0x53fea6||0x1f4;return function(_0x9ab6b4){logger[_0x98bc('0x24')](_0x9ab6b4[_0x98bc('0x25')]);if(_0x9ab6b4[_0x98bc('0x26')]){delete _0x9ab6b4[_0x98bc('0x26')];}_0x1476a5['status'](_0x53fea6)[_0x98bc('0x27')](_0x9ab6b4);};}exports[_0x98bc('0x28')]=function(_0x1777ff,_0x3f903d){var _0x5008dc={},_0x3b81a9={},_0x55faf5={'count':0x0,'rows':[]};var _0x4587aa=_[_0x98bc('0x29')](db[_0x98bc('0x2a')]['rawAttributes'],function(_0x55a2c5){return{'name':_0x55a2c5['fieldName'],'type':_0x55a2c5[_0x98bc('0x2b')]['key']};});_0x3b81a9[_0x98bc('0x2c')]=_['map'](_0x4587aa,_0x98bc('0x26'));_0x3b81a9[_0x98bc('0x2d')]=_['keys'](_0x1777ff[_0x98bc('0x2d')]);_0x3b81a9[_0x98bc('0x2e')]=_[_0x98bc('0x2f')](_0x3b81a9['model'],_0x3b81a9[_0x98bc('0x2d')]);_0x5008dc[_0x98bc('0x30')]=_['intersection'](_0x3b81a9[_0x98bc('0x2c')],qs[_0x98bc('0x31')](_0x1777ff[_0x98bc('0x2d')][_0x98bc('0x31')]));_0x5008dc[_0x98bc('0x30')]=_0x5008dc[_0x98bc('0x30')]['length']?_0x5008dc['attributes']:_0x3b81a9[_0x98bc('0x2c')];if(!_0x1777ff[_0x98bc('0x2d')][_0x98bc('0x32')](_0x98bc('0x33'))){_0x5008dc[_0x98bc('0x1b')]=qs[_0x98bc('0x1b')](_0x1777ff[_0x98bc('0x2d')][_0x98bc('0x1b')]);_0x5008dc['offset']=qs[_0x98bc('0x19')](_0x1777ff[_0x98bc('0x2d')]['offset']);}_0x5008dc[_0x98bc('0x34')]=qs[_0x98bc('0x35')](_0x1777ff[_0x98bc('0x2d')][_0x98bc('0x35')]);_0x5008dc[_0x98bc('0x36')]=qs[_0x98bc('0x2e')](_[_0x98bc('0x37')](_0x1777ff[_0x98bc('0x2d')],_0x3b81a9[_0x98bc('0x2e')]),_0x4587aa);if(_0x1777ff[_0x98bc('0x2d')][_0x98bc('0x38')]){_0x5008dc[_0x98bc('0x36')]=_[_0x98bc('0x39')](_0x5008dc['where'],{'$or':_[_0x98bc('0x29')](_0x4587aa,function(_0x251e58){if(_0x251e58[_0x98bc('0x2b')]!=='VIRTUAL'){var _0x5e15c9={};_0x5e15c9[_0x251e58[_0x98bc('0x26')]]={'$like':'%'+_0x1777ff[_0x98bc('0x2d')][_0x98bc('0x38')]+'%'};return _0x5e15c9;}})});}_0x5008dc=_[_0x98bc('0x39')]({},_0x5008dc,_0x1777ff[_0x98bc('0x3a')]);var _0x52bb3f={'where':_0x5008dc[_0x98bc('0x36')]};return db[_0x98bc('0x2a')][_0x98bc('0x3b')](_0x52bb3f)[_0x98bc('0x21')](function(_0xd1807f){_0x55faf5['count']=_0xd1807f;if(_0x1777ff['query']['includeAll']){_0x5008dc[_0x98bc('0x3c')]=[{'all':!![]}];}return db[_0x98bc('0x2a')][_0x98bc('0x3d')](_0x5008dc);})[_0x98bc('0x21')](function(_0x240c8a){_0x55faf5[_0x98bc('0x3e')]=_0x240c8a;return _0x55faf5;})[_0x98bc('0x21')](respondWithFilteredResult(_0x3f903d,_0x5008dc))[_0x98bc('0x3f')](handleError(_0x3f903d,null));}; \ No newline at end of file +var _0x0738=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','where','filter','merge','options','Migration','includeAll','include','findAll','rows','catch','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4a49d5,_0x3e62c4){var _0x54c75a=function(_0x495f81){while(--_0x495f81){_0x4a49d5['push'](_0x4a49d5['shift']());}};_0x54c75a(++_0x3e62c4);}(_0x0738,0x7b));var _0x8073=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x0738[_0x486f4a];return _0x135d99;};'use strict';var emlformat=require(_0x8073('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8073('0x1'));var rp=require('request-promise');var moment=require(_0x8073('0x2'));var BPromise=require(_0x8073('0x3'));var Mustache=require('mustache');var util=require(_0x8073('0x4'));var path=require(_0x8073('0x5'));var sox=require(_0x8073('0x6'));var csv=require(_0x8073('0x7'));var ejs=require(_0x8073('0x8'));var fs=require('fs');var fs_extra=require(_0x8073('0x9'));var _=require(_0x8073('0xa'));var squel=require(_0x8073('0xb'));var crypto=require(_0x8073('0xc'));var jsforce=require(_0x8073('0xd'));var deskjs=require(_0x8073('0xe'));var toCsv=require(_0x8073('0x7'));var querystring=require(_0x8073('0xf'));var Papa=require(_0x8073('0x10'));var Redis=require(_0x8073('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8073('0x12'));var as=require(_0x8073('0x13'));var hardwareService=require(_0x8073('0x14'));var logger=require(_0x8073('0x15'))(_0x8073('0x16'));var utils=require(_0x8073('0x17'));var config=require(_0x8073('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8073('0x19'))['db'];function respondWithStatusCode(_0x103904,_0x446abc){_0x446abc=_0x446abc||0xcc;return function(_0x36ea72){if(_0x36ea72){return _0x103904[_0x8073('0x1a')](_0x446abc);}return _0x103904[_0x8073('0x1b')](_0x446abc)[_0x8073('0x1c')]();};}function respondWithResult(_0x39d0db,_0x409174){_0x409174=_0x409174||0xc8;return function(_0x4654cd){if(_0x4654cd){return _0x39d0db[_0x8073('0x1b')](_0x409174)['json'](_0x4654cd);}};}function respondWithFilteredResult(_0x2c65c4,_0x5b3a9a){return function(_0x1c8b30){if(_0x1c8b30){var _0x18e544=typeof _0x5b3a9a[_0x8073('0x1d')]===_0x8073('0x1e')&&typeof _0x5b3a9a[_0x8073('0x1f')]===_0x8073('0x1e');var _0x20561a=_0x1c8b30[_0x8073('0x20')];var _0x26c946=_0x18e544?0x0:_0x5b3a9a[_0x8073('0x1d')];var _0x3b3604=_0x18e544?_0x1c8b30[_0x8073('0x20')]:_0x5b3a9a[_0x8073('0x1d')]+_0x5b3a9a[_0x8073('0x1f')];var _0x3671fe;if(_0x3b3604>=_0x20561a){_0x3b3604=_0x20561a;_0x3671fe=0xc8;}else{_0x3671fe=0xce;}_0x2c65c4['status'](_0x3671fe);return _0x2c65c4[_0x8073('0x21')](_0x8073('0x22'),_0x26c946+'-'+_0x3b3604+'/'+_0x20561a)[_0x8073('0x23')](_0x1c8b30);}return null;};}function patchUpdates(_0x23d2f4){return function(_0x3c25f1){try{jsonpatch[_0x8073('0x24')](_0x3c25f1,_0x23d2f4,!![]);}catch(_0x171ce7){return BPromise[_0x8073('0x25')](_0x171ce7);}return _0x3c25f1[_0x8073('0x26')]();};}function saveUpdates(_0x2519e9,_0x5a7376){return function(_0x5dab27){if(_0x5dab27){return _0x5dab27[_0x8073('0x27')](_0x2519e9)[_0x8073('0x28')](function(_0x2ffec9){return _0x2ffec9;});}return null;};}function removeEntity(_0x405881,_0x21f4ca){return function(_0x5f0194){if(_0x5f0194){return _0x5f0194[_0x8073('0x29')]()[_0x8073('0x28')](function(){_0x405881[_0x8073('0x1b')](0xcc)[_0x8073('0x1c')]();});}};}function handleEntityNotFound(_0x458aeb,_0x77ae10){return function(_0x4f0cde){if(!_0x4f0cde){_0x458aeb['sendStatus'](0x194);}return _0x4f0cde;};}function handleError(_0x3ee89d,_0x4953e5){_0x4953e5=_0x4953e5||0x1f4;return function(_0xe6ba90){logger[_0x8073('0x2a')](_0xe6ba90['stack']);if(_0xe6ba90[_0x8073('0x2b')]){delete _0xe6ba90['name'];}_0x3ee89d[_0x8073('0x1b')](_0x4953e5)['send'](_0xe6ba90);};}exports['index']=function(_0x3fa7e5,_0x302f06){var _0x37410f={},_0x357426={},_0x1699b2={'count':0x0,'rows':[]};var _0x39ee59=_[_0x8073('0x2c')](db['Migration'][_0x8073('0x2d')],function(_0x3eac02){return{'name':_0x3eac02[_0x8073('0x2e')],'type':_0x3eac02[_0x8073('0x2f')][_0x8073('0x30')]};});_0x357426[_0x8073('0x31')]=_[_0x8073('0x2c')](_0x39ee59,_0x8073('0x2b'));_0x357426[_0x8073('0x32')]=_[_0x8073('0x33')](_0x3fa7e5[_0x8073('0x32')]);_0x357426['filters']=_[_0x8073('0x34')](_0x357426[_0x8073('0x31')],_0x357426[_0x8073('0x32')]);_0x37410f[_0x8073('0x35')]=_[_0x8073('0x34')](_0x357426[_0x8073('0x31')],qs['fields'](_0x3fa7e5[_0x8073('0x32')][_0x8073('0x36')]));_0x37410f[_0x8073('0x35')]=_0x37410f['attributes'][_0x8073('0x37')]?_0x37410f['attributes']:_0x357426[_0x8073('0x31')];if(!_0x3fa7e5['query'][_0x8073('0x38')](_0x8073('0x39'))){_0x37410f[_0x8073('0x1f')]=qs[_0x8073('0x1f')](_0x3fa7e5[_0x8073('0x32')][_0x8073('0x1f')]);_0x37410f[_0x8073('0x1d')]=qs['offset'](_0x3fa7e5[_0x8073('0x32')][_0x8073('0x1d')]);}_0x37410f['order']=qs[_0x8073('0x3a')](_0x3fa7e5[_0x8073('0x32')][_0x8073('0x3a')]);_0x37410f['where']=qs[_0x8073('0x3b')](_['pick'](_0x3fa7e5[_0x8073('0x32')],_0x357426[_0x8073('0x3b')]),_0x39ee59);if(_0x3fa7e5['query']['filter']){_0x37410f[_0x8073('0x3c')]=_['merge'](_0x37410f[_0x8073('0x3c')],{'$or':_[_0x8073('0x2c')](_0x39ee59,function(_0xb19e09){if(_0xb19e09[_0x8073('0x2f')]!=='VIRTUAL'){var _0x3e962e={};_0x3e962e[_0xb19e09[_0x8073('0x2b')]]={'$like':'%'+_0x3fa7e5[_0x8073('0x32')][_0x8073('0x3d')]+'%'};return _0x3e962e;}})});}_0x37410f=_[_0x8073('0x3e')]({},_0x37410f,_0x3fa7e5[_0x8073('0x3f')]);var _0x43fe3c={'where':_0x37410f['where']};return db[_0x8073('0x40')]['count'](_0x43fe3c)['then'](function(_0x44d6e5){_0x1699b2['count']=_0x44d6e5;if(_0x3fa7e5[_0x8073('0x32')][_0x8073('0x41')]){_0x37410f[_0x8073('0x42')]=[{'all':!![]}];}return db[_0x8073('0x40')][_0x8073('0x43')](_0x37410f);})[_0x8073('0x28')](function(_0x42a9b6){_0x1699b2[_0x8073('0x44')]=_0x42a9b6;return _0x1699b2;})[_0x8073('0x28')](respondWithFilteredResult(_0x302f06,_0x37410f))[_0x8073('0x45')](handleError(_0x302f06,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b9eab32..d1e8adb 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 _0x957f=['moment','request-promise','rimraf','./migration.attributes','exports','util','../../config/logger','api'];(function(_0x33e60c,_0x45e1d9){var _0x108ee5=function(_0x5cdcf6){while(--_0x5cdcf6){_0x33e60c['push'](_0x33e60c['shift']());}};_0x108ee5(++_0x45e1d9);}(_0x957f,0x9d));var _0xf957=function(_0x4b9b78,_0x1dc74a){_0x4b9b78=_0x4b9b78-0x0;var _0x330388=_0x957f[_0x4b9b78];return _0x330388;};'use strict';var _=require('lodash');var util=require(_0xf957('0x0'));var logger=require(_0xf957('0x1'))(_0xf957('0x2'));var moment=require(_0xf957('0x3'));var BPromise=require('bluebird');var rp=require(_0xf957('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf957('0x5'));var config=require('../../config/environment');var attributes=require(_0xf957('0x6'));module[_0xf957('0x7')]=function(_0x26885e,_0x19be2b){return _0x26885e['define']('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac8b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xac8b,0x8c));var _0xbac8=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xac8b[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xbac8('0x0'));var util=require(_0xbac8('0x1'));var logger=require(_0xbac8('0x2'))(_0xbac8('0x3'));var moment=require(_0xbac8('0x4'));var BPromise=require(_0xbac8('0x5'));var rp=require(_0xbac8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbac8('0x7'));var config=require(_0xbac8('0x8'));var attributes=require(_0xbac8('0x9'));module[_0xbac8('0xa')]=function(_0x1c9675,_0x4523b0){return _0x1c9675[_0xbac8('0xb')](_0xbac8('0xc'),attributes,{'tableName':_0xbac8('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 6a25b66..85aebe3 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 _0x95c5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x401701,_0x149dce){var _0x3da178=function(_0x48b110){while(--_0x48b110){_0x401701['push'](_0x401701['shift']());}};_0x3da178(++_0x149dce);}(_0x95c5,0x153));var _0x595c=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x95c5[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x595c('0x0'));var util=require(_0x595c('0x1'));var moment=require('moment');var BPromise=require(_0x595c('0x2'));var rs=require(_0x595c('0x3'));var fs=require('fs');var Redis=require(_0x595c('0x4'));var db=require(_0x595c('0x5'))['db'];var utils=require(_0x595c('0x6'));var logger=require(_0x595c('0x7'))(_0x595c('0x8'));var config=require(_0x595c('0x9'));var jayson=require(_0x595c('0xa'));var client=jayson[_0x595c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49a115,_0xc9f937,_0xfcaf47){return new BPromise(function(_0x218eca,_0x3b55ad){return client[_0x595c('0xc')](_0x49a115,_0xfcaf47)[_0x595c('0xd')](function(_0x1250e7){logger[_0x595c('0xe')](_0x595c('0xf'),_0xc9f937,'request\x20sent');logger[_0x595c('0x10')](_0x595c('0x11'),_0xc9f937,_0x595c('0x12'),JSON['stringify'](_0x1250e7));if(_0x1250e7[_0x595c('0x13')]){if(_0x1250e7[_0x595c('0x13')][_0x595c('0x14')]===0x1f4){logger[_0x595c('0x13')](_0x595c('0xf'),_0xc9f937,_0x1250e7[_0x595c('0x13')][_0x595c('0x15')]);return _0x3b55ad(_0x1250e7[_0x595c('0x13')][_0x595c('0x15')]);}logger[_0x595c('0x13')](_0x595c('0xf'),_0xc9f937,_0x1250e7[_0x595c('0x13')][_0x595c('0x15')]);return _0x218eca(_0x1250e7[_0x595c('0x13')]['message']);}else{logger[_0x595c('0xe')](_0x595c('0xf'),_0xc9f937,_0x595c('0x12'));_0x218eca(_0x1250e7[_0x595c('0x16')]['message']);}})['catch'](function(_0x3a2a04){logger['error']('Migration,\x20%s,\x20%s',_0xc9f937,_0x3a2a04);_0x3b55ad(_0x3a2a04);});});} \ No newline at end of file +var _0x1ddc=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x4e8b6f,_0x57578c){var _0x12c3a6=function(_0x413ef0){while(--_0x413ef0){_0x4e8b6f['push'](_0x4e8b6f['shift']());}};_0x12c3a6(++_0x57578c);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x2b9388,_0x542dcf){_0x2b9388=_0x2b9388-0x0;var _0xc75a68=_0x1ddc[_0x2b9388];return _0xc75a68;};'use strict';var _=require('lodash');var util=require(_0xc1dd('0x0'));var moment=require(_0xc1dd('0x1'));var BPromise=require(_0xc1dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1dd('0x3'));var db=require(_0xc1dd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1dd('0x5'))(_0xc1dd('0x6'));var config=require('../../config/environment');var jayson=require(_0xc1dd('0x7'));var client=jayson[_0xc1dd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3938ff,_0x25c543,_0x593de5){return new BPromise(function(_0x54819b,_0x411452){return client[_0xc1dd('0x9')](_0x3938ff,_0x593de5)[_0xc1dd('0xa')](function(_0x217d07){logger['info'](_0xc1dd('0xb'),_0x25c543,_0xc1dd('0xc'));logger[_0xc1dd('0xd')](_0xc1dd('0xe'),_0x25c543,'request\x20sent',JSON[_0xc1dd('0xf')](_0x217d07));if(_0x217d07[_0xc1dd('0x10')]){if(_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x11')]===0x1f4){logger[_0xc1dd('0x10')](_0xc1dd('0xb'),_0x25c543,_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);return _0x411452(_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);}logger[_0xc1dd('0x10')]('Migration,\x20%s,\x20%s',_0x25c543,_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);return _0x54819b(_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);}else{logger[_0xc1dd('0x13')]('Migration,\x20%s,\x20%s',_0x25c543,_0xc1dd('0xc'));_0x54819b(_0x217d07[_0xc1dd('0x14')][_0xc1dd('0x12')]);}})[_0xc1dd('0x15')](function(_0x5815d3){logger['error'](_0xc1dd('0xb'),_0x25c543,_0x5815d3);_0x411452(_0x5815d3);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index c12cee1..10aa7d8 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 _0xa6ce=['post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./network.controller','get','isAuthenticated','index','show'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa6ce,0x15e));var _0xea6c=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xa6ce[_0x1beef3];return _0x5af964;};'use strict';var multer=require(_0xea6c('0x0'));var util=require('util');var path=require(_0xea6c('0x1'));var timeout=require(_0xea6c('0x2'));var express=require('express');var router=express[_0xea6c('0x3')]();var fs_extra=require(_0xea6c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xea6c('0x5'));var controller=require(_0xea6c('0x6'));router[_0xea6c('0x7')]('/',auth[_0xea6c('0x8')](),controller[_0xea6c('0x9')]);router[_0xea6c('0x7')]('/:id',auth[_0xea6c('0x8')](),controller[_0xea6c('0xa')]);router[_0xea6c('0xb')]('/',auth[_0xea6c('0x8')](),controller[_0xea6c('0xc')]);router[_0xea6c('0xd')](_0xea6c('0xe'),auth[_0xea6c('0x8')](),controller[_0xea6c('0xf')]);router[_0xea6c('0x10')](_0xea6c('0xe'),auth[_0xea6c('0x8')](),controller[_0xea6c('0x11')]);module[_0xea6c('0x12')]=router; \ No newline at end of file +var _0xed1c=['show','post','create','put','update','destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index','/:id'];(function(_0x147331,_0x3c2a32){var _0x5524fb=function(_0x2b5c4a){while(--_0x2b5c4a){_0x147331['push'](_0x147331['shift']());}};_0x5524fb(++_0x3c2a32);}(_0xed1c,0xe4));var _0xced1=function(_0x492bf9,_0x3494c9){_0x492bf9=_0x492bf9-0x0;var _0x2df282=_0xed1c[_0x492bf9];return _0x2df282;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0xb')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0xd')](_0xced1('0x9'),auth['isAuthenticated'](),controller[_0xced1('0xe')]);router['delete'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xf')]);module[_0xced1('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index b3d300e..94f941c 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 _0x4270=['ENUM','localnet','externip','stun','turn','STRING','exports'];(function(_0x363d20,_0xc3ec4c){var _0x119a31=function(_0x4d437b){while(--_0x4d437b){_0x363d20['push'](_0x363d20['shift']());}};_0x119a31(++_0xc3ec4c);}(_0x4270,0x15d));var _0x0427=function(_0x2ddc1f,_0x36a583){_0x2ddc1f=_0x2ddc1f-0x0;var _0xa912ca=_0x4270[_0x2ddc1f];return _0xa912ca;};'use strict';var Sequelize=require('sequelize');module[_0x0427('0x0')]={'type':{'type':Sequelize[_0x0427('0x1')](_0x0427('0x2'),_0x0427('0x3'),_0x0427('0x4'),_0x0427('0x5'))},'value':{'type':Sequelize[_0x0427('0x6')]},'username':{'type':Sequelize[_0x0427('0x6')]},'password':{'type':Sequelize[_0x0427('0x6')]}}; \ No newline at end of file +var _0x2d70=['turn','STRING','exports','ENUM','localnet','externip'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x2d70,0x110));var _0x02d7=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0x2d70[_0xa990b7];return _0x52c99c;};'use strict';var Sequelize=require('sequelize');module[_0x02d7('0x0')]={'type':{'type':Sequelize[_0x02d7('0x1')](_0x02d7('0x2'),_0x02d7('0x3'),'stun',_0x02d7('0x4'))},'value':{'type':Sequelize[_0x02d7('0x5')]},'username':{'type':Sequelize[_0x02d7('0x5')]},'password':{'type':Sequelize[_0x02d7('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index fdfb8ac..cee9f64 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 _0xece0=['update','destroy','end','stack','name','index','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','params','keys','Network','rawAttributes','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','utf8','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','server/files/templates/turn_multiple.ejs','TURN','chan_sip.so','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','set','Content-Range','apply','reject','save'];(function(_0x66156e,_0x28f300){var _0x308ea6=function(_0x3c5da9){while(--_0x3c5da9){_0x66156e['push'](_0x66156e['shift']());}};_0x308ea6(++_0x28f300);}(_0xece0,0xa5));var _0x0ece=function(_0x822282,_0x56c940){_0x822282=_0x822282-0x0;var _0x5b982f=_0xece0[_0x822282];return _0x5b982f;};'use strict';var emlformat=require(_0x0ece('0x0'));var rimraf=require(_0x0ece('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ece('0x2'));var rp=require(_0x0ece('0x3'));var moment=require('moment');var BPromise=require(_0x0ece('0x4'));var Mustache=require(_0x0ece('0x5'));var util=require(_0x0ece('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0ece('0x7'));var ejs=require(_0x0ece('0x8'));var fs=require('fs');var fs_extra=require(_0x0ece('0x9'));var _=require(_0x0ece('0xa'));var squel=require(_0x0ece('0xb'));var crypto=require(_0x0ece('0xc'));var jsforce=require(_0x0ece('0xd'));var deskjs=require(_0x0ece('0xe'));var toCsv=require(_0x0ece('0x7'));var querystring=require(_0x0ece('0xf'));var Papa=require(_0x0ece('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0ece('0x11'));var as=require(_0x0ece('0x12'));var hardwareService=require(_0x0ece('0x13'));var logger=require(_0x0ece('0x14'))(_0x0ece('0x15'));var utils=require('../../config/utils');var config=require(_0x0ece('0x16'));var licenseUtil=require(_0x0ece('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0ece('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23dcfd,_0x6bd476,_0x326516,_0x52ad37){return new BPromise(function(_0x532df0,_0x1d475e){var _0x2e477c=_0x52ad37||client;return _0x2e477c[_0x0ece('0x19')](_0x23dcfd,_0x326516)[_0x0ece('0x1a')](function(_0x54715d){logger[_0x0ece('0x1b')](_0x0ece('0x1c'),_0x6bd476,_0x0ece('0x1d'));logger[_0x0ece('0x1e')]('Network,\x20%s,\x20%s,\x20%s',_0x6bd476,_0x0ece('0x1d'),JSON[_0x0ece('0x1f')](_0x54715d));if(_0x54715d[_0x0ece('0x20')]){if(_0x54715d[_0x0ece('0x20')][_0x0ece('0x21')]===0x1f4){logger[_0x0ece('0x20')](_0x0ece('0x1c'),_0x6bd476,_0x54715d[_0x0ece('0x20')][_0x0ece('0x22')]);return _0x1d475e(_0x54715d[_0x0ece('0x20')][_0x0ece('0x22')]);}logger[_0x0ece('0x20')](_0x0ece('0x1c'),_0x6bd476,_0x54715d[_0x0ece('0x20')]['message']);return _0x532df0(_0x54715d[_0x0ece('0x20')][_0x0ece('0x22')]);}else{logger[_0x0ece('0x1b')]('Network,\x20%s,\x20%s',_0x6bd476,_0x0ece('0x1d'));_0x532df0(_0x54715d[_0x0ece('0x23')][_0x0ece('0x22')]);}})[_0x0ece('0x24')](function(_0xedbb04){logger['error'](_0x0ece('0x1c'),_0x6bd476,_0xedbb04);_0x1d475e(_0xedbb04);});});}function respondWithStatusCode(_0x4d072e,_0x352aeb){_0x352aeb=_0x352aeb||0xcc;return function(_0x2e2e8f){if(_0x2e2e8f){return _0x4d072e[_0x0ece('0x25')](_0x352aeb);}return _0x4d072e[_0x0ece('0x26')](_0x352aeb)['end']();};}function respondWithResult(_0x43a08f,_0x21c4ff){_0x21c4ff=_0x21c4ff||0xc8;return function(_0x102d55){if(_0x102d55){return _0x43a08f[_0x0ece('0x26')](_0x21c4ff)[_0x0ece('0x27')](_0x102d55);}};}function respondWithFilteredResult(_0x4efd12,_0x1773f7){return function(_0x38acac){if(_0x38acac){var _0x485694=typeof _0x1773f7[_0x0ece('0x28')]===_0x0ece('0x29')&&typeof _0x1773f7['limit']===_0x0ece('0x29');var _0x4370ec=_0x38acac['count'];var _0x11d5af=_0x485694?0x0:_0x1773f7['offset'];var _0x42b340=_0x485694?_0x38acac['count']:_0x1773f7[_0x0ece('0x28')]+_0x1773f7['limit'];var _0x2a8659;if(_0x42b340>=_0x4370ec){_0x42b340=_0x4370ec;_0x2a8659=0xc8;}else{_0x2a8659=0xce;}_0x4efd12[_0x0ece('0x26')](_0x2a8659);return _0x4efd12[_0x0ece('0x2a')](_0x0ece('0x2b'),_0x11d5af+'-'+_0x42b340+'/'+_0x4370ec)[_0x0ece('0x27')](_0x38acac);}return null;};}function patchUpdates(_0x4dc6a1){return function(_0x93d9a1){try{jsonpatch[_0x0ece('0x2c')](_0x93d9a1,_0x4dc6a1,!![]);}catch(_0x4eeba2){return BPromise[_0x0ece('0x2d')](_0x4eeba2);}return _0x93d9a1[_0x0ece('0x2e')]();};}function saveUpdates(_0x165f7c,_0x5e5589){return function(_0x38bc55){if(_0x38bc55){return _0x38bc55[_0x0ece('0x2f')](_0x165f7c)[_0x0ece('0x1a')](function(_0x883d25){return _0x883d25;});}return null;};}function removeEntity(_0x1f0f30,_0x44aca8){return function(_0x36cf81){if(_0x36cf81){return _0x36cf81[_0x0ece('0x30')]()[_0x0ece('0x1a')](function(){_0x1f0f30[_0x0ece('0x26')](0xcc)[_0x0ece('0x31')]();});}};}function handleEntityNotFound(_0x18aef5,_0x1adad1){return function(_0x296bda){if(!_0x296bda){_0x18aef5[_0x0ece('0x25')](0x194);}return _0x296bda;};}function handleError(_0x42c9cd,_0x24632a){_0x24632a=_0x24632a||0x1f4;return function(_0x8350bf){logger[_0x0ece('0x20')](_0x8350bf[_0x0ece('0x32')]);if(_0x8350bf[_0x0ece('0x33')]){delete _0x8350bf['name'];}_0x42c9cd[_0x0ece('0x26')](_0x24632a)['send'](_0x8350bf);};}exports[_0x0ece('0x34')]=function(_0xfd7fcf,_0x303965){var _0x2eef9b={},_0x272bec={},_0x1b1750={'count':0x0,'rows':[]};var _0x5441fa=_['map'](db['Network']['rawAttributes'],function(_0x4dbd1d){return{'name':_0x4dbd1d[_0x0ece('0x35')],'type':_0x4dbd1d[_0x0ece('0x36')]['key']};});_0x272bec[_0x0ece('0x37')]=_[_0x0ece('0x38')](_0x5441fa,_0x0ece('0x33'));_0x272bec[_0x0ece('0x39')]=_['keys'](_0xfd7fcf[_0x0ece('0x39')]);_0x272bec[_0x0ece('0x3a')]=_[_0x0ece('0x3b')](_0x272bec[_0x0ece('0x37')],_0x272bec[_0x0ece('0x39')]);_0x2eef9b[_0x0ece('0x3c')]=_['intersection'](_0x272bec[_0x0ece('0x37')],qs[_0x0ece('0x3d')](_0xfd7fcf[_0x0ece('0x39')][_0x0ece('0x3d')]));_0x2eef9b[_0x0ece('0x3c')]=_0x2eef9b[_0x0ece('0x3c')][_0x0ece('0x3e')]?_0x2eef9b[_0x0ece('0x3c')]:_0x272bec['model'];if(!_0xfd7fcf['query'][_0x0ece('0x3f')](_0x0ece('0x40'))){_0x2eef9b[_0x0ece('0x41')]=qs[_0x0ece('0x41')](_0xfd7fcf[_0x0ece('0x39')][_0x0ece('0x41')]);_0x2eef9b[_0x0ece('0x28')]=qs[_0x0ece('0x28')](_0xfd7fcf[_0x0ece('0x39')]['offset']);}_0x2eef9b['order']=qs[_0x0ece('0x42')](_0xfd7fcf[_0x0ece('0x39')][_0x0ece('0x42')]);_0x2eef9b[_0x0ece('0x43')]=qs[_0x0ece('0x3a')](_[_0x0ece('0x44')](_0xfd7fcf[_0x0ece('0x39')],_0x272bec['filters']),_0x5441fa);if(_0xfd7fcf[_0x0ece('0x39')][_0x0ece('0x45')]){_0x2eef9b[_0x0ece('0x43')]=_[_0x0ece('0x46')](_0x2eef9b[_0x0ece('0x43')],{'$or':_[_0x0ece('0x38')](_0x5441fa,function(_0x1a51d1){if(_0x1a51d1[_0x0ece('0x36')]!=='VIRTUAL'){var _0x482e79={};_0x482e79[_0x1a51d1[_0x0ece('0x33')]]={'$like':'%'+_0xfd7fcf['query'][_0x0ece('0x45')]+'%'};return _0x482e79;}})});}_0x2eef9b=_[_0x0ece('0x46')]({},_0x2eef9b,_0xfd7fcf[_0x0ece('0x47')]);var _0x1be1e6={'where':_0x2eef9b[_0x0ece('0x43')]};return db['Network'][_0x0ece('0x48')](_0x1be1e6)['then'](function(_0x344bb6){_0x1b1750['count']=_0x344bb6;if(_0xfd7fcf['query'][_0x0ece('0x49')]){_0x2eef9b[_0x0ece('0x4a')]=[{'all':!![]}];}return db['Network'][_0x0ece('0x4b')](_0x2eef9b);})[_0x0ece('0x1a')](function(_0x3da32f){_0x1b1750[_0x0ece('0x4c')]=_0x3da32f;return _0x1b1750;})['then'](respondWithFilteredResult(_0x303965,_0x2eef9b))[_0x0ece('0x24')](handleError(_0x303965,null));};exports['show']=function(_0x3c000b,_0x3134ae){var _0x42a060={'raw':!![],'where':{'id':_0x3c000b[_0x0ece('0x4d')]['id']}},_0x384314={};_0x384314[_0x0ece('0x37')]=_[_0x0ece('0x4e')](db[_0x0ece('0x4f')][_0x0ece('0x50')]);_0x384314[_0x0ece('0x39')]=_['keys'](_0x3c000b['query']);_0x384314[_0x0ece('0x3a')]=_[_0x0ece('0x3b')](_0x384314[_0x0ece('0x37')],_0x384314[_0x0ece('0x39')]);_0x42a060[_0x0ece('0x3c')]=_['intersection'](_0x384314['model'],qs[_0x0ece('0x3d')](_0x3c000b['query'][_0x0ece('0x3d')]));_0x42a060[_0x0ece('0x3c')]=_0x42a060[_0x0ece('0x3c')][_0x0ece('0x3e')]?_0x42a060[_0x0ece('0x3c')]:_0x384314[_0x0ece('0x37')];if(_0x3c000b[_0x0ece('0x39')][_0x0ece('0x49')]){_0x42a060[_0x0ece('0x4a')]=[{'all':!![]}];}_0x42a060=_[_0x0ece('0x46')]({},_0x42a060,_0x3c000b[_0x0ece('0x47')]);return db[_0x0ece('0x4f')][_0x0ece('0x51')](_0x42a060)[_0x0ece('0x1a')](handleEntityNotFound(_0x3134ae,null))[_0x0ece('0x1a')](respondWithResult(_0x3134ae,null))['catch'](handleError(_0x3134ae,null));};exports[_0x0ece('0x52')]=function(_0x5213bd,_0x371ee5,_0x598984){var _0x1e48bd;return db[_0x0ece('0x53')][_0x0ece('0x54')](function(_0x2b8fad){return db[_0x0ece('0x4f')]['create'](_0x5213bd[_0x0ece('0x55')],{'raw':!![]})['then'](function(_0x32ebb9){_0x1e48bd=_0x32ebb9;return db[_0x0ece('0x4f')][_0x0ece('0x4b')]({'where':{'type':_0x5213bd['body']['type']},'raw':!![]});})[_0x0ece('0x1a')](function(_0x27e68e){if(_0x1e48bd[_0x0ece('0x36')][_0x0ece('0x56')]()==_0x0ece('0x57')){var _0x2fed75=fs[_0x0ece('0x58')](path[_0x0ece('0x59')](config[_0x0ece('0x5a')],_0x0ece('0x5b')),'utf8');var _0x371a9b=ejs[_0x0ece('0x5c')](_0x2fed75,{'networks':_0x27e68e||[]});fs[_0x0ece('0x5d')](_0x0ece('0x5e'),_0x371a9b);return respondWithRpcPromise(_0x0ece('0x5f'),'create',{'module':_0x0ece('0x60')});}else if(_0x1e48bd[_0x0ece('0x36')]['toUpperCase']()=='TURN'){var _0x1c969b=fs['readFileSync'](path['join'](config[_0x0ece('0x5a')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x59bf3f=ejs['render'](_0x1c969b,{'networks':_0x27e68e||[]});fs[_0x0ece('0x5d')](_0x0ece('0x61'),_0x59bf3f);return respondWithRpcPromise(_0x0ece('0x5f'),'create',{'module':_0x0ece('0x60')});}else{var _0x52252e=fs[_0x0ece('0x58')](path[_0x0ece('0x59')](config[_0x0ece('0x5a')],_0x0ece('0x62')),_0x0ece('0x63'));var _0x3586e9=ejs[_0x0ece('0x5c')](_0x52252e,{'networks':_0x27e68e||[]});fs[_0x0ece('0x5d')](util[_0x0ece('0x64')](_0x0ece('0x65'),_0x5213bd[_0x0ece('0x55')][_0x0ece('0x36')][_0x0ece('0x66')]()),_0x3586e9);return respondWithRpcPromise(_0x0ece('0x5f'),_0x0ece('0x52'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x1e48bd;});})[_0x0ece('0x1a')](respondWithResult(_0x371ee5,0xc9))[_0x0ece('0x24')](handleError(_0x371ee5,null));};exports[_0x0ece('0x2f')]=function(_0x3932e5,_0x4fb09d,_0xe25d57){var _0x24705b;return db['sequelize']['transaction'](function(_0xed00a6){return db[_0x0ece('0x4f')][_0x0ece('0x51')]({'where':{'id':_0x3932e5[_0x0ece('0x4d')]['id']}})[_0x0ece('0x1a')](handleEntityNotFound(_0x4fb09d,null))[_0x0ece('0x1a')](saveUpdates(_0x3932e5[_0x0ece('0x55')],null))[_0x0ece('0x1a')](function(_0x3f0b5d){if(_0x3f0b5d){_0x24705b=_0x3f0b5d;return db[_0x0ece('0x4f')][_0x0ece('0x4b')]({'where':{'type':_0x24705b[_0x0ece('0x36')]},'raw':!![]});}return null;})[_0x0ece('0x1a')](function(_0x3f812e){if(_0x24705b['type'][_0x0ece('0x56')]()==_0x0ece('0x57')){var _0x3940ef=fs[_0x0ece('0x58')](path['join'](config[_0x0ece('0x5a')],_0x0ece('0x5b')),_0x0ece('0x63'));var _0x4fed6c=ejs['render'](_0x3940ef,{'networks':_0x3f812e||[]});fs[_0x0ece('0x5d')](_0x0ece('0x5e'),_0x4fed6c);return respondWithRpcPromise(_0x0ece('0x5f'),_0x0ece('0x2f'),{'module':_0x0ece('0x60')});}else if(_0x24705b[_0x0ece('0x36')][_0x0ece('0x56')]()=='TURN'){var _0x2bdd06=fs['readFileSync'](path['join'](config[_0x0ece('0x5a')],_0x0ece('0x67')),_0x0ece('0x63'));var _0x3886c4=ejs['render'](_0x2bdd06,{'networks':_0x3f812e||[]});fs[_0x0ece('0x5d')]('/etc/asterisk/turn_xcally.conf',_0x3886c4);return respondWithRpcPromise(_0x0ece('0x5f'),_0x0ece('0x2f'),{'module':_0x0ece('0x60')});}else{var _0x5d0bf1=fs[_0x0ece('0x58')](path['join'](config[_0x0ece('0x5a')],'server/files/templates/network.ejs'),_0x0ece('0x63'));var _0x39d2c4=ejs[_0x0ece('0x5c')](_0x5d0bf1,{'networks':_0x3f812e||[]});fs[_0x0ece('0x5d')](util[_0x0ece('0x64')](_0x0ece('0x65'),_0x3932e5[_0x0ece('0x55')][_0x0ece('0x36')][_0x0ece('0x66')]()),_0x39d2c4);return respondWithRpcPromise(_0x0ece('0x5f'),_0x0ece('0x2f'),{'module':'chan_sip.so'});}return null;})[_0x0ece('0x1a')](function(_0x9b781a){if(_0x9b781a){return _0x24705b;}return null;});})[_0x0ece('0x1a')](respondWithResult(_0x4fb09d,null))[_0x0ece('0x24')](handleError(_0x4fb09d,null));};exports['destroy']=function(_0x568c38,_0x2c7132,_0x232a56){var _0x217fe7;return db[_0x0ece('0x4f')]['find']({'where':{'id':_0x568c38[_0x0ece('0x4d')]['id']}})[_0x0ece('0x1a')](function(_0x442668){_0x217fe7=_0x442668;return _0x442668;})[_0x0ece('0x1a')](handleEntityNotFound(_0x2c7132,null))['then'](removeEntity(_0x2c7132,null))[_0x0ece('0x1a')](function(){if(_0x217fe7){return db[_0x0ece('0x4f')][_0x0ece('0x4b')]({'where':{'type':_0x217fe7[_0x0ece('0x36')]},'raw':!![]});}})[_0x0ece('0x1a')](function(_0x46ca9c){if(_0x217fe7[_0x0ece('0x36')][_0x0ece('0x56')]()=='STUN'){var _0x1fd2ee=fs[_0x0ece('0x58')](path['join'](config[_0x0ece('0x5a')],_0x0ece('0x5b')),'utf8');var _0x427f77=ejs['render'](_0x1fd2ee,{'networks':_0x46ca9c||[]});fs['writeFileSync'](_0x0ece('0x5e'),_0x427f77);return respondWithRpcPromise(_0x0ece('0x5f'),_0x0ece('0x30'),{'module':_0x0ece('0x60')});}else if(_0x217fe7[_0x0ece('0x36')][_0x0ece('0x56')]()==_0x0ece('0x68')){var _0x2406ae=fs['readFileSync'](path[_0x0ece('0x59')](config[_0x0ece('0x5a')],'server/files/templates/turn_multiple.ejs'),_0x0ece('0x63'));var _0x14dd54=ejs[_0x0ece('0x5c')](_0x2406ae,{'networks':_0x46ca9c||[]});fs[_0x0ece('0x5d')](_0x0ece('0x61'),_0x14dd54);return respondWithRpcPromise(_0x0ece('0x5f'),_0x0ece('0x30'),{'module':_0x0ece('0x60')});}else{var _0x4b1788=fs[_0x0ece('0x58')](path[_0x0ece('0x59')](config[_0x0ece('0x5a')],_0x0ece('0x62')),_0x0ece('0x63'));var _0x2eea48=ejs['render'](_0x4b1788,{'networks':_0x46ca9c||[]});fs['writeFileSync'](util[_0x0ece('0x64')](_0x0ece('0x65'),_0x568c38[_0x0ece('0x55')][_0x0ece('0x36')][_0x0ece('0x66')]()),_0x2eea48);return respondWithRpcPromise(_0x0ece('0x5f'),_0x0ece('0x30'),{'module':_0x0ece('0x69')});}return null;})[_0x0ece('0x24')](handleError(_0x2c7132,null));}; \ No newline at end of file +var _0x093a=['include','findAll','rows','params','length','options','find','catch','sequelize','transaction','body','STUN','readFileSync','join','utf8','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','writeFileSync','create','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/stun_multiple.ejs','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','toUpperCase','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','send','index','rawAttributes','type','key','map','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','Network','includeAll'];(function(_0x1068d5,_0x20e99b){var _0xb6c523=function(_0x35e67c){while(--_0x35e67c){_0x1068d5['push'](_0x1068d5['shift']());}};_0xb6c523(++_0x20e99b);}(_0x093a,0x16a));var _0xa093=function(_0x39609a,_0x28a563){_0x39609a=_0x39609a-0x0;var _0xecd92=_0x093a[_0x39609a];return _0xecd92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa093('0x0'));var zipdir=require(_0xa093('0x1'));var jsonpatch=require(_0xa093('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa093('0x3'));var Mustache=require(_0xa093('0x4'));var util=require(_0xa093('0x5'));var path=require(_0xa093('0x6'));var sox=require(_0xa093('0x7'));var csv=require(_0xa093('0x8'));var ejs=require(_0xa093('0x9'));var fs=require('fs');var fs_extra=require(_0xa093('0xa'));var _=require(_0xa093('0xb'));var squel=require(_0xa093('0xc'));var crypto=require(_0xa093('0xd'));var jsforce=require(_0xa093('0xe'));var deskjs=require(_0xa093('0xf'));var toCsv=require(_0xa093('0x8'));var querystring=require(_0xa093('0x10'));var Papa=require(_0xa093('0x11'));var Redis=require(_0xa093('0x12'));var authService=require(_0xa093('0x13'));var qs=require(_0xa093('0x14'));var as=require(_0xa093('0x15'));var hardwareService=require(_0xa093('0x16'));var logger=require('../../config/logger')(_0xa093('0x17'));var utils=require(_0xa093('0x18'));var config=require(_0xa093('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa093('0x1a'))['db'];var jayson=require(_0xa093('0x1b'));var client=jayson[_0xa093('0x1c')][_0xa093('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1171cb,_0x1593be,_0x3fa081,_0x5b7b2c){return new BPromise(function(_0x108037,_0x56fc96){var _0x1fffe5=_0x5b7b2c||client;return _0x1fffe5[_0xa093('0x1e')](_0x1171cb,_0x3fa081)[_0xa093('0x1f')](function(_0x2f8e67){logger[_0xa093('0x20')](_0xa093('0x21'),_0x1593be,_0xa093('0x22'));logger[_0xa093('0x23')]('Network,\x20%s,\x20%s,\x20%s',_0x1593be,_0xa093('0x22'),JSON[_0xa093('0x24')](_0x2f8e67));if(_0x2f8e67[_0xa093('0x25')]){if(_0x2f8e67[_0xa093('0x25')][_0xa093('0x26')]===0x1f4){logger[_0xa093('0x25')](_0xa093('0x21'),_0x1593be,_0x2f8e67['error'][_0xa093('0x27')]);return _0x56fc96(_0x2f8e67['error'][_0xa093('0x27')]);}logger['error'](_0xa093('0x21'),_0x1593be,_0x2f8e67[_0xa093('0x25')]['message']);return _0x108037(_0x2f8e67[_0xa093('0x25')][_0xa093('0x27')]);}else{logger[_0xa093('0x20')](_0xa093('0x21'),_0x1593be,_0xa093('0x22'));_0x108037(_0x2f8e67['result'][_0xa093('0x27')]);}})['catch'](function(_0x5a16bd){logger['error'](_0xa093('0x21'),_0x1593be,_0x5a16bd);_0x56fc96(_0x5a16bd);});});}function respondWithStatusCode(_0x329847,_0x2e909d){_0x2e909d=_0x2e909d||0xcc;return function(_0x3aeb7f){if(_0x3aeb7f){return _0x329847[_0xa093('0x28')](_0x2e909d);}return _0x329847[_0xa093('0x29')](_0x2e909d)[_0xa093('0x2a')]();};}function respondWithResult(_0x591b98,_0x302f21){_0x302f21=_0x302f21||0xc8;return function(_0x536311){if(_0x536311){return _0x591b98[_0xa093('0x29')](_0x302f21)[_0xa093('0x2b')](_0x536311);}};}function respondWithFilteredResult(_0x1f9506,_0x36fd8f){return function(_0x31909b){if(_0x31909b){var _0x5f7bb7=typeof _0x36fd8f[_0xa093('0x2c')]===_0xa093('0x2d')&&typeof _0x36fd8f[_0xa093('0x2e')]===_0xa093('0x2d');var _0x581d99=_0x31909b[_0xa093('0x2f')];var _0x1b9148=_0x5f7bb7?0x0:_0x36fd8f[_0xa093('0x2c')];var _0x238904=_0x5f7bb7?_0x31909b[_0xa093('0x2f')]:_0x36fd8f['offset']+_0x36fd8f['limit'];var _0x26a606;if(_0x238904>=_0x581d99){_0x238904=_0x581d99;_0x26a606=0xc8;}else{_0x26a606=0xce;}_0x1f9506[_0xa093('0x29')](_0x26a606);return _0x1f9506[_0xa093('0x30')](_0xa093('0x31'),_0x1b9148+'-'+_0x238904+'/'+_0x581d99)['json'](_0x31909b);}return null;};}function patchUpdates(_0x56b5ab){return function(_0x57a5f7){try{jsonpatch[_0xa093('0x32')](_0x57a5f7,_0x56b5ab,!![]);}catch(_0x5b0dbb){return BPromise[_0xa093('0x33')](_0x5b0dbb);}return _0x57a5f7[_0xa093('0x34')]();};}function saveUpdates(_0x23cb42,_0x4a7245){return function(_0x2c501f){if(_0x2c501f){return _0x2c501f[_0xa093('0x35')](_0x23cb42)[_0xa093('0x1f')](function(_0x36d75a){return _0x36d75a;});}return null;};}function removeEntity(_0x157f29,_0x25120c){return function(_0x3d73b3){if(_0x3d73b3){return _0x3d73b3[_0xa093('0x36')]()[_0xa093('0x1f')](function(){_0x157f29[_0xa093('0x29')](0xcc)[_0xa093('0x2a')]();});}};}function handleEntityNotFound(_0x445425,_0x5bd787){return function(_0x38b33d){if(!_0x38b33d){_0x445425['sendStatus'](0x194);}return _0x38b33d;};}function handleError(_0x37e784,_0xbf6732){_0xbf6732=_0xbf6732||0x1f4;return function(_0x32937e){logger[_0xa093('0x25')](_0x32937e['stack']);if(_0x32937e[_0xa093('0x37')]){delete _0x32937e['name'];}_0x37e784[_0xa093('0x29')](_0xbf6732)[_0xa093('0x38')](_0x32937e);};}exports[_0xa093('0x39')]=function(_0xfe40b9,_0xd3d8c1){var _0x4d6aba={},_0xcb0f02={},_0x4a2eca={'count':0x0,'rows':[]};var _0x150923=_['map'](db['Network'][_0xa093('0x3a')],function(_0x1652fb){return{'name':_0x1652fb['fieldName'],'type':_0x1652fb[_0xa093('0x3b')][_0xa093('0x3c')]};});_0xcb0f02['model']=_[_0xa093('0x3d')](_0x150923,'name');_0xcb0f02[_0xa093('0x3e')]=_[_0xa093('0x3f')](_0xfe40b9[_0xa093('0x3e')]);_0xcb0f02['filters']=_['intersection'](_0xcb0f02[_0xa093('0x40')],_0xcb0f02[_0xa093('0x3e')]);_0x4d6aba[_0xa093('0x41')]=_[_0xa093('0x42')](_0xcb0f02[_0xa093('0x40')],qs[_0xa093('0x43')](_0xfe40b9[_0xa093('0x3e')][_0xa093('0x43')]));_0x4d6aba['attributes']=_0x4d6aba[_0xa093('0x41')]['length']?_0x4d6aba[_0xa093('0x41')]:_0xcb0f02[_0xa093('0x40')];if(!_0xfe40b9[_0xa093('0x3e')][_0xa093('0x44')](_0xa093('0x45'))){_0x4d6aba['limit']=qs[_0xa093('0x2e')](_0xfe40b9[_0xa093('0x3e')]['limit']);_0x4d6aba[_0xa093('0x2c')]=qs[_0xa093('0x2c')](_0xfe40b9[_0xa093('0x3e')][_0xa093('0x2c')]);}_0x4d6aba['order']=qs[_0xa093('0x46')](_0xfe40b9[_0xa093('0x3e')][_0xa093('0x46')]);_0x4d6aba[_0xa093('0x47')]=qs[_0xa093('0x48')](_['pick'](_0xfe40b9[_0xa093('0x3e')],_0xcb0f02[_0xa093('0x48')]),_0x150923);if(_0xfe40b9[_0xa093('0x3e')][_0xa093('0x49')]){_0x4d6aba['where']=_[_0xa093('0x4a')](_0x4d6aba[_0xa093('0x47')],{'$or':_[_0xa093('0x3d')](_0x150923,function(_0x2f0252){if(_0x2f0252[_0xa093('0x3b')]!==_0xa093('0x4b')){var _0x25bf7c={};_0x25bf7c[_0x2f0252[_0xa093('0x37')]]={'$like':'%'+_0xfe40b9[_0xa093('0x3e')][_0xa093('0x49')]+'%'};return _0x25bf7c;}})});}_0x4d6aba=_['merge']({},_0x4d6aba,_0xfe40b9['options']);var _0x1213b1={'where':_0x4d6aba[_0xa093('0x47')]};return db[_0xa093('0x4c')][_0xa093('0x2f')](_0x1213b1)[_0xa093('0x1f')](function(_0x38475a){_0x4a2eca[_0xa093('0x2f')]=_0x38475a;if(_0xfe40b9[_0xa093('0x3e')][_0xa093('0x4d')]){_0x4d6aba[_0xa093('0x4e')]=[{'all':!![]}];}return db[_0xa093('0x4c')][_0xa093('0x4f')](_0x4d6aba);})[_0xa093('0x1f')](function(_0x295c21){_0x4a2eca[_0xa093('0x50')]=_0x295c21;return _0x4a2eca;})['then'](respondWithFilteredResult(_0xd3d8c1,_0x4d6aba))['catch'](handleError(_0xd3d8c1,null));};exports['show']=function(_0x55b539,_0x2905da){var _0x36fb5a={'raw':!![],'where':{'id':_0x55b539[_0xa093('0x51')]['id']}},_0x2fefaf={};_0x2fefaf[_0xa093('0x40')]=_[_0xa093('0x3f')](db[_0xa093('0x4c')]['rawAttributes']);_0x2fefaf[_0xa093('0x3e')]=_[_0xa093('0x3f')](_0x55b539[_0xa093('0x3e')]);_0x2fefaf['filters']=_[_0xa093('0x42')](_0x2fefaf['model'],_0x2fefaf['query']);_0x36fb5a[_0xa093('0x41')]=_[_0xa093('0x42')](_0x2fefaf['model'],qs[_0xa093('0x43')](_0x55b539['query'][_0xa093('0x43')]));_0x36fb5a[_0xa093('0x41')]=_0x36fb5a[_0xa093('0x41')][_0xa093('0x52')]?_0x36fb5a[_0xa093('0x41')]:_0x2fefaf[_0xa093('0x40')];if(_0x55b539[_0xa093('0x3e')][_0xa093('0x4d')]){_0x36fb5a[_0xa093('0x4e')]=[{'all':!![]}];}_0x36fb5a=_[_0xa093('0x4a')]({},_0x36fb5a,_0x55b539[_0xa093('0x53')]);return db[_0xa093('0x4c')][_0xa093('0x54')](_0x36fb5a)[_0xa093('0x1f')](handleEntityNotFound(_0x2905da,null))[_0xa093('0x1f')](respondWithResult(_0x2905da,null))[_0xa093('0x55')](handleError(_0x2905da,null));};exports['create']=function(_0x362c55,_0x219f3c,_0x2276be){var _0x17b278;return db[_0xa093('0x56')][_0xa093('0x57')](function(_0x716ef){return db['Network']['create'](_0x362c55[_0xa093('0x58')],{'raw':!![]})['then'](function(_0x2e3562){_0x17b278=_0x2e3562;return db[_0xa093('0x4c')][_0xa093('0x4f')]({'where':{'type':_0x362c55[_0xa093('0x58')][_0xa093('0x3b')]},'raw':!![]});})['then'](function(_0x4c77dd){if(_0x17b278['type']['toUpperCase']()==_0xa093('0x59')){var _0x54ca2a=fs[_0xa093('0x5a')](path[_0xa093('0x5b')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xa093('0x5c'));var _0x592175=ejs['render'](_0x54ca2a,{'networks':_0x4c77dd||[]});fs['writeFileSync'](_0xa093('0x5d'),_0x592175);return respondWithRpcPromise(_0xa093('0x5e'),'create',{'module':_0xa093('0x5f')});}else if(_0x17b278[_0xa093('0x3b')]['toUpperCase']()==_0xa093('0x60')){var _0x4789ea=fs[_0xa093('0x5a')](path[_0xa093('0x5b')](config[_0xa093('0x61')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x260f9b=ejs['render'](_0x4789ea,{'networks':_0x4c77dd||[]});fs[_0xa093('0x62')]('/etc/asterisk/turn_xcally.conf',_0x260f9b);return respondWithRpcPromise('Reload',_0xa093('0x63'),{'module':_0xa093('0x5f')});}else{var _0x1cfe29=fs[_0xa093('0x5a')](path[_0xa093('0x5b')](config[_0xa093('0x61')],_0xa093('0x64')),_0xa093('0x5c'));var _0x2b0ba0=ejs[_0xa093('0x65')](_0x1cfe29,{'networks':_0x4c77dd||[]});fs[_0xa093('0x62')](util[_0xa093('0x66')](_0xa093('0x67'),_0x362c55[_0xa093('0x58')][_0xa093('0x3b')][_0xa093('0x68')]()),_0x2b0ba0);return respondWithRpcPromise('Reload',_0xa093('0x63'),{'module':_0xa093('0x69')});}return null;})[_0xa093('0x1f')](function(){return _0x17b278;});})[_0xa093('0x1f')](respondWithResult(_0x219f3c,0xc9))[_0xa093('0x55')](handleError(_0x219f3c,null));};exports[_0xa093('0x35')]=function(_0x2a99f8,_0x245cd4,_0x326209){var _0x4f3f83;return db[_0xa093('0x56')]['transaction'](function(_0x3e3c91){return db[_0xa093('0x4c')][_0xa093('0x54')]({'where':{'id':_0x2a99f8['params']['id']}})[_0xa093('0x1f')](handleEntityNotFound(_0x245cd4,null))[_0xa093('0x1f')](saveUpdates(_0x2a99f8[_0xa093('0x58')],null))[_0xa093('0x1f')](function(_0x1b80cc){if(_0x1b80cc){_0x4f3f83=_0x1b80cc;return db[_0xa093('0x4c')][_0xa093('0x4f')]({'where':{'type':_0x4f3f83[_0xa093('0x3b')]},'raw':!![]});}return null;})[_0xa093('0x1f')](function(_0x8d62c5){if(_0x4f3f83['type']['toUpperCase']()==_0xa093('0x59')){var _0x19ae1c=fs[_0xa093('0x5a')](path[_0xa093('0x5b')](config[_0xa093('0x61')],_0xa093('0x6a')),'utf8');var _0x5ac02f=ejs[_0xa093('0x65')](_0x19ae1c,{'networks':_0x8d62c5||[]});fs['writeFileSync'](_0xa093('0x5d'),_0x5ac02f);return respondWithRpcPromise(_0xa093('0x5e'),_0xa093('0x35'),{'module':_0xa093('0x5f')});}else if(_0x4f3f83[_0xa093('0x3b')]['toUpperCase']()==_0xa093('0x60')){var _0x1339e3=fs['readFileSync'](path[_0xa093('0x5b')](config[_0xa093('0x61')],_0xa093('0x6b')),_0xa093('0x5c'));var _0x4e416e=ejs[_0xa093('0x65')](_0x1339e3,{'networks':_0x8d62c5||[]});fs[_0xa093('0x62')](_0xa093('0x6c'),_0x4e416e);return respondWithRpcPromise(_0xa093('0x5e'),_0xa093('0x35'),{'module':_0xa093('0x5f')});}else{var _0x20002c=fs[_0xa093('0x5a')](path['join'](config[_0xa093('0x61')],'server/files/templates/network.ejs'),_0xa093('0x5c'));var _0x18d94f=ejs[_0xa093('0x65')](_0x20002c,{'networks':_0x8d62c5||[]});fs[_0xa093('0x62')](util[_0xa093('0x66')](_0xa093('0x67'),_0x2a99f8['body'][_0xa093('0x3b')][_0xa093('0x68')]()),_0x18d94f);return respondWithRpcPromise(_0xa093('0x5e'),_0xa093('0x35'),{'module':'chan_sip.so'});}return null;})[_0xa093('0x1f')](function(_0x3c116d){if(_0x3c116d){return _0x4f3f83;}return null;});})[_0xa093('0x1f')](respondWithResult(_0x245cd4,null))['catch'](handleError(_0x245cd4,null));};exports['destroy']=function(_0x45beca,_0x40e724,_0x3a156f){var _0x97de06;return db[_0xa093('0x4c')]['find']({'where':{'id':_0x45beca[_0xa093('0x51')]['id']}})[_0xa093('0x1f')](function(_0x597f07){_0x97de06=_0x597f07;return _0x597f07;})['then'](handleEntityNotFound(_0x40e724,null))[_0xa093('0x1f')](removeEntity(_0x40e724,null))['then'](function(){if(_0x97de06){return db[_0xa093('0x4c')][_0xa093('0x4f')]({'where':{'type':_0x97de06['type']},'raw':!![]});}})[_0xa093('0x1f')](function(_0x512a0b){if(_0x97de06['type']['toUpperCase']()==_0xa093('0x59')){var _0x3821d7=fs[_0xa093('0x5a')](path[_0xa093('0x5b')](config[_0xa093('0x61')],_0xa093('0x6a')),'utf8');var _0xbd58f6=ejs[_0xa093('0x65')](_0x3821d7,{'networks':_0x512a0b||[]});fs[_0xa093('0x62')]('/etc/asterisk/stun_xcally.conf',_0xbd58f6);return respondWithRpcPromise(_0xa093('0x5e'),_0xa093('0x36'),{'module':_0xa093('0x5f')});}else if(_0x97de06['type'][_0xa093('0x6d')]()==_0xa093('0x60')){var _0x2c289b=fs[_0xa093('0x5a')](path[_0xa093('0x5b')](config[_0xa093('0x61')],_0xa093('0x6b')),_0xa093('0x5c'));var _0xd4602b=ejs[_0xa093('0x65')](_0x2c289b,{'networks':_0x512a0b||[]});fs[_0xa093('0x62')](_0xa093('0x6c'),_0xd4602b);return respondWithRpcPromise(_0xa093('0x5e'),_0xa093('0x36'),{'module':_0xa093('0x5f')});}else{var _0x47449b=fs['readFileSync'](path['join'](config[_0xa093('0x61')],_0xa093('0x64')),'utf8');var _0x4515ff=ejs['render'](_0x47449b,{'networks':_0x512a0b||[]});fs['writeFileSync'](util[_0xa093('0x66')](_0xa093('0x67'),_0x45beca['body']['type'][_0xa093('0x68')]()),_0x4515ff);return respondWithRpcPromise(_0xa093('0x5e'),_0xa093('0x36'),{'module':_0xa093('0x69')});}return null;})['catch'](handleError(_0x40e724,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index c95462c..bf084a4 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 _0x87ae=['define','Network','../../config/logger','bluebird','request-promise','path','../../config/environment','./network.attributes','exports'];(function(_0x346008,_0x4129d9){var _0x4f12af=function(_0x4c6c73){while(--_0x4c6c73){_0x346008['push'](_0x346008['shift']());}};_0x4f12af(++_0x4129d9);}(_0x87ae,0xf5));var _0xe87a=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x87ae[_0x44b3bd];return _0x1efc4a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe87a('0x0'))('api');var moment=require('moment');var BPromise=require(_0xe87a('0x1'));var rp=require(_0xe87a('0x2'));var fs=require('fs');var path=require(_0xe87a('0x3'));var rimraf=require('rimraf');var config=require(_0xe87a('0x4'));var attributes=require(_0xe87a('0x5'));module[_0xe87a('0x6')]=function(_0x5ef978,_0x4b9934){return _0x5ef978[_0xe87a('0x7')](_0xe87a('0x8'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x593e=['path','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x19ed04,_0x17abd3){var _0x1a3b2b=function(_0x3db4bb){while(--_0x3db4bb){_0x19ed04['push'](_0x19ed04['shift']());}};_0x1a3b2b(++_0x17abd3);}(_0x593e,0xcb));var _0xe593=function(_0x3a9b85,_0xcfb1ec){_0x3a9b85=_0x3a9b85-0x0;var _0x5041c2=_0x593e[_0x3a9b85];return _0x5041c2;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var logger=require(_0xe593('0x2'))(_0xe593('0x3'));var moment=require(_0xe593('0x4'));var BPromise=require(_0xe593('0x5'));var rp=require(_0xe593('0x6'));var fs=require('fs');var path=require(_0xe593('0x7'));var rimraf=require('rimraf');var config=require(_0xe593('0x8'));var attributes=require(_0xe593('0x9'));module[_0xe593('0xa')]=function(_0x1e50d3,_0x3b7082){return _0x1e50d3[_0xe593('0xb')](_0xe593('0xc'),attributes,{'tableName':_0xe593('0xd'),'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 b78bc8c..d37e318 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x38f66c,_0x55f9e9){var _0x333a41=function(_0x19f70c){while(--_0x19f70c){_0x38f66c['push'](_0x38f66c['shift']());}};_0x333a41(++_0x55f9e9);}(_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 moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x58c53a,_0x4fdd19){_0x58c53a=_0x58c53a-0x0;var _0x3f756a=_0x7a54[_0x58c53a];return _0x3f756a;};'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 740e0f4..b7fcef6 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 _0x1623=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','update','destroy','delete','removeAnswers','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x1623,0x1e7));var _0x3162=function(_0x450321,_0x2a4484){_0x450321=_0x450321-0x0;var _0x598ce1=_0x1623[_0x450321];return _0x598ce1;};'use strict';var multer=require('multer');var util=require(_0x3162('0x0'));var path=require(_0x3162('0x1'));var timeout=require(_0x3162('0x2'));var express=require(_0x3162('0x3'));var router=express[_0x3162('0x4')]();var fs_extra=require(_0x3162('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3162('0x6'));var config=require(_0x3162('0x7'));var controller=require('./openchannelAccount.controller');router[_0x3162('0x8')]('/',auth[_0x3162('0x9')](),controller['index']);router[_0x3162('0x8')](_0x3162('0xa'),auth[_0x3162('0x9')](),controller[_0x3162('0xb')]);router['get'](_0x3162('0xc'),auth[_0x3162('0x9')](),controller['show']);router['get'](_0x3162('0xd'),auth[_0x3162('0x9')](),controller[_0x3162('0xe')]);router[_0x3162('0x8')](_0x3162('0xf'),auth['isAuthenticated'](),controller[_0x3162('0x10')]);router[_0x3162('0x8')](_0x3162('0x11'),auth[_0x3162('0x9')](),controller[_0x3162('0x12')]);router[_0x3162('0x8')](_0x3162('0x13'),auth[_0x3162('0x9')](),controller[_0x3162('0x14')]);router[_0x3162('0x8')](_0x3162('0x15'),auth[_0x3162('0x9')](),controller[_0x3162('0x16')]);router[_0x3162('0x17')]('/',auth[_0x3162('0x9')](),controller[_0x3162('0x18')]);router[_0x3162('0x17')](_0x3162('0xd'),auth[_0x3162('0x9')](),controller[_0x3162('0x19')]);router[_0x3162('0x17')](_0x3162('0xf'),auth[_0x3162('0x9')](),controller[_0x3162('0x1a')]);router[_0x3162('0x17')](_0x3162('0x1b'),controller[_0x3162('0x1c')]);router[_0x3162('0x17')](_0x3162('0x11'),auth[_0x3162('0x9')](),controller[_0x3162('0x1d')]);router[_0x3162('0x17')](_0x3162('0x15'),auth['isAuthenticated'](),controller[_0x3162('0x1e')]);router[_0x3162('0x17')](_0x3162('0x1f'),auth[_0x3162('0x9')](),controller[_0x3162('0x20')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3162('0x21')]);router['delete'](_0x3162('0xc'),auth[_0x3162('0x9')](),controller[_0x3162('0x22')]);router[_0x3162('0x23')]('/:id/dispositions',auth[_0x3162('0x9')](),controller['removeDispositions']);router[_0x3162('0x23')](_0x3162('0xf'),auth['isAuthenticated'](),controller[_0x3162('0x24')]);router[_0x3162('0x23')]('/:id/users',auth[_0x3162('0x9')](),controller[_0x3162('0x25')]);module['exports']=router; \ No newline at end of file +var _0x906c=['show','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','notify','addAgents','/:id/send','send','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x906c,0x180));var _0xc906=function(_0x459866,_0x429a60){_0x459866=_0x459866-0x0;var _0x1c49ce=_0x906c[_0x459866];return _0x1c49ce;};'use strict';var multer=require(_0xc906('0x0'));var util=require(_0xc906('0x1'));var path=require(_0xc906('0x2'));var timeout=require(_0xc906('0x3'));var express=require(_0xc906('0x4'));var router=express[_0xc906('0x5')]();var fs_extra=require(_0xc906('0x6'));var auth=require(_0xc906('0x7'));var interaction=require(_0xc906('0x8'));var config=require(_0xc906('0x9'));var controller=require(_0xc906('0xa'));router[_0xc906('0xb')]('/',auth[_0xc906('0xc')](),controller['index']);router[_0xc906('0xb')](_0xc906('0xd'),auth[_0xc906('0xc')](),controller[_0xc906('0xe')]);router[_0xc906('0xb')](_0xc906('0xf'),auth[_0xc906('0xc')](),controller[_0xc906('0x10')]);router[_0xc906('0xb')]('/:id/dispositions',auth[_0xc906('0xc')](),controller[_0xc906('0x11')]);router[_0xc906('0xb')](_0xc906('0x12'),auth[_0xc906('0xc')](),controller['getAnswers']);router[_0xc906('0xb')](_0xc906('0x13'),auth[_0xc906('0xc')](),controller[_0xc906('0x14')]);router['get'](_0xc906('0x15'),auth[_0xc906('0xc')](),controller[_0xc906('0x16')]);router[_0xc906('0xb')](_0xc906('0x17'),auth[_0xc906('0xc')](),controller[_0xc906('0x18')]);router[_0xc906('0x19')]('/',auth[_0xc906('0xc')](),controller[_0xc906('0x1a')]);router[_0xc906('0x19')](_0xc906('0x1b'),auth['isAuthenticated'](),controller[_0xc906('0x1c')]);router['post']('/:id/canned_answers',auth[_0xc906('0xc')](),controller[_0xc906('0x1d')]);router[_0xc906('0x19')]('/:id/notify',controller[_0xc906('0x1e')]);router['post'](_0xc906('0x13'),auth[_0xc906('0xc')](),controller['addApplications']);router[_0xc906('0x19')](_0xc906('0x17'),auth[_0xc906('0xc')](),controller[_0xc906('0x1f')]);router[_0xc906('0x19')](_0xc906('0x20'),auth[_0xc906('0xc')](),controller[_0xc906('0x21')]);router['put'](_0xc906('0xf'),auth[_0xc906('0xc')](),controller['update']);router[_0xc906('0x22')]('/:id',auth[_0xc906('0xc')](),controller[_0xc906('0x23')]);router[_0xc906('0x22')](_0xc906('0x1b'),auth[_0xc906('0xc')](),controller[_0xc906('0x24')]);router[_0xc906('0x22')](_0xc906('0x12'),auth[_0xc906('0xc')](),controller[_0xc906('0x25')]);router[_0xc906('0x22')](_0xc906('0x17'),auth['isAuthenticated'](),controller[_0xc906('0x26')]);module[_0xc906('0x27')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index df6b49d..a6ec530 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 _0xe6b3=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x2cbd6f,_0x5236d5){var _0x3401c7=function(_0x581383){while(--_0x581383){_0x2cbd6f['push'](_0x2cbd6f['shift']());}};_0x3401c7(++_0x5236d5);}(_0xe6b3,0x17d));var _0x3e6b=function(_0x2a9d58,_0x2a7d9d){_0x2a9d58=_0x2a9d58-0x0;var _0x293cdd=_0xe6b3[_0x2a9d58];return _0x293cdd;};'use strict';var Sequelize=require(_0x3e6b('0x0'));var rs=require(_0x3e6b('0x1'));module[_0x3e6b('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x3e6b('0x3')]},'token':{'type':Sequelize[_0x3e6b('0x3')],'defaultValue':function(){return rs[_0x3e6b('0x4')]();}},'replyUri':{'type':Sequelize[_0x3e6b('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3e6b('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x3e6b('0x5');}},'notificationSound':{'type':Sequelize[_0x3e6b('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3e6b('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3e6b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3e6b('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3e6b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3e6b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3e6b('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x3e6b('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x3e6b('0x6')],'defaultValue':![],'comment':_0x3e6b('0x9'),'set':function(_0x533627){if(!_0x533627)this['setDataValue'](_0x3e6b('0xa'),null);this[_0x3e6b('0xb')](_0x3e6b('0xc'),_0x533627);}}}; \ No newline at end of file +var _0x458a=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x193b9d,_0x39bce3){var _0x32d2d4=function(_0x30d0cd){while(--_0x30d0cd){_0x193b9d['push'](_0x193b9d['shift']());}};_0x32d2d4(++_0x39bce3);}(_0x458a,0xbb));var _0xa458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x458a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa458('0x0'));module[_0xa458('0x1')]={'name':{'type':Sequelize[_0xa458('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xa458('0x2')]},'token':{'type':Sequelize[_0xa458('0x2')],'defaultValue':function(){return rs[_0xa458('0x3')]();}},'replyUri':{'type':Sequelize[_0xa458('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa458('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa458('0x4')],'defaultValue':function(){return _0xa458('0x5');}},'notificationSound':{'type':Sequelize[_0xa458('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa458('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa458('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa458('0x2')]},'queueTransfer':{'type':Sequelize[_0xa458('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa458('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa458('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xa458('0x6')],'defaultValue':![],'comment':_0xa458('0x9'),'set':function(_0x13b3d5){if(!_0x13b3d5)this[_0xa458('0xa')](_0xa458('0xb'),null);this['setDataValue'](_0xa458('0xc'),_0x13b3d5);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 99309c5..9f51958 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 _0xcc3e=['find','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','filter','removeDispositions','ids','addAnswer','CannedAnswer','order','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','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','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','asc','Contacts','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','priority','finally','getApplications','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','fast-json-patch','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','../../config/license/util','../../mysqldb','defaults','redis','localhost','./openchannelAccount.socket','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','model','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation'];(function(_0x20fb8b,_0xd7c9e1){var _0x3018c0=function(_0x3a5099){while(--_0x3a5099){_0x20fb8b['push'](_0x20fb8b['shift']());}};_0x3018c0(++_0xd7c9e1);}(_0xcc3e,0x11c));var _0xecc3=function(_0x1e9842,_0x39ad44){_0x1e9842=_0x1e9842-0x0;var _0x4975d7=_0xcc3e[_0x1e9842];return _0x4975d7;};'use strict';var emlformat=require(_0xecc3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xecc3('0x1'));var rp=require('request-promise');var moment=require(_0xecc3('0x2'));var BPromise=require(_0xecc3('0x3'));var Mustache=require('mustache');var util=require(_0xecc3('0x4'));var path=require(_0xecc3('0x5'));var sox=require(_0xecc3('0x6'));var csv=require(_0xecc3('0x7'));var ejs=require(_0xecc3('0x8'));var fs=require('fs');var fs_extra=require(_0xecc3('0x9'));var _=require(_0xecc3('0xa'));var squel=require(_0xecc3('0xb'));var crypto=require(_0xecc3('0xc'));var jsforce=require(_0xecc3('0xd'));var deskjs=require(_0xecc3('0xe'));var toCsv=require(_0xecc3('0x7'));var querystring=require(_0xecc3('0xf'));var Papa=require(_0xecc3('0x10'));var Redis=require(_0xecc3('0x11'));var authService=require(_0xecc3('0x12'));var qs=require(_0xecc3('0x13'));var as=require(_0xecc3('0x14'));var hardwareService=require(_0xecc3('0x15'));var logger=require(_0xecc3('0x16'))('api');var utils=require(_0xecc3('0x17'));var config=require(_0xecc3('0x18'));var licenseUtil=require(_0xecc3('0x19'));var db=require(_0xecc3('0x1a'))['db'];config['redis']=_[_0xecc3('0x1b')](config[_0xecc3('0x1c')],{'host':_0xecc3('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xecc3('0x1c')]));require(_0xecc3('0x1e'))['register'](socket);var jayson=require(_0xecc3('0x1f'));var client=jayson[_0xecc3('0x20')][_0xecc3('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x41961c,_0x5c3ce4,_0x605fa2,_0x4954b0){return new BPromise(function(_0x12d028,_0x77690f){var _0x33d8cd=_0x4954b0||client;return _0x33d8cd[_0xecc3('0x22')](_0x41961c,_0x605fa2)[_0xecc3('0x23')](function(_0x4084e5){logger[_0xecc3('0x24')](_0xecc3('0x25'),_0x5c3ce4,_0xecc3('0x26'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5c3ce4,_0xecc3('0x26'),JSON[_0xecc3('0x27')](_0x4084e5));if(_0x4084e5[_0xecc3('0x28')]){if(_0x4084e5[_0xecc3('0x28')][_0xecc3('0x29')]===0x1f4){logger[_0xecc3('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x5c3ce4,_0x4084e5[_0xecc3('0x28')][_0xecc3('0x2a')]);return _0x77690f(_0x4084e5['error'][_0xecc3('0x2a')]);}logger[_0xecc3('0x28')](_0xecc3('0x25'),_0x5c3ce4,_0x4084e5[_0xecc3('0x28')][_0xecc3('0x2a')]);return _0x12d028(_0x4084e5['error']['message']);}else{logger[_0xecc3('0x24')](_0xecc3('0x25'),_0x5c3ce4,_0xecc3('0x26'));_0x12d028(_0x4084e5[_0xecc3('0x2b')][_0xecc3('0x2a')]);}})[_0xecc3('0x2c')](function(_0x5335f4){logger['error'](_0xecc3('0x25'),_0x5c3ce4,_0x5335f4);_0x77690f(_0x5335f4);});});}function respondWithStatusCode(_0x35001b,_0x51a9b2){_0x51a9b2=_0x51a9b2||0xcc;return function(_0x4c5c7c){if(_0x4c5c7c){return _0x35001b[_0xecc3('0x2d')](_0x51a9b2);}return _0x35001b[_0xecc3('0x2e')](_0x51a9b2)['end']();};}function respondWithResult(_0x3ab178,_0x5d1960){_0x5d1960=_0x5d1960||0xc8;return function(_0xc3ab8){if(_0xc3ab8){return _0x3ab178[_0xecc3('0x2e')](_0x5d1960)[_0xecc3('0x2f')](_0xc3ab8);}};}function respondWithFilteredResult(_0xe28c8e,_0x119426){return function(_0x2c39d9){if(_0x2c39d9){var _0x2c292e=typeof _0x119426[_0xecc3('0x30')]===_0xecc3('0x31')&&typeof _0x119426[_0xecc3('0x32')]===_0xecc3('0x31');var _0x289ebb=_0x2c39d9[_0xecc3('0x33')];var _0x116a65=_0x2c292e?0x0:_0x119426[_0xecc3('0x30')];var _0x4b6473=_0x2c292e?_0x2c39d9[_0xecc3('0x33')]:_0x119426[_0xecc3('0x30')]+_0x119426[_0xecc3('0x32')];var _0x113a7f;if(_0x4b6473>=_0x289ebb){_0x4b6473=_0x289ebb;_0x113a7f=0xc8;}else{_0x113a7f=0xce;}_0xe28c8e[_0xecc3('0x2e')](_0x113a7f);return _0xe28c8e[_0xecc3('0x34')](_0xecc3('0x35'),_0x116a65+'-'+_0x4b6473+'/'+_0x289ebb)[_0xecc3('0x2f')](_0x2c39d9);}return null;};}function patchUpdates(_0x49540c){return function(_0x5a60bd){try{jsonpatch[_0xecc3('0x36')](_0x5a60bd,_0x49540c,!![]);}catch(_0x39e0f7){return BPromise[_0xecc3('0x37')](_0x39e0f7);}return _0x5a60bd['save']();};}function saveUpdates(_0x34c8f8,_0x30183e){return function(_0x271859){if(_0x271859){return _0x271859[_0xecc3('0x38')](_0x34c8f8)[_0xecc3('0x23')](function(_0x15e4ee){return _0x15e4ee;});}return null;};}function removeEntity(_0x578d8f,_0x3b3c93){return function(_0xcacffa){if(_0xcacffa){return _0xcacffa[_0xecc3('0x39')]()['then'](function(){var _0x426cc4=_0xcacffa[_0xecc3('0x3a')]({'plain':!![]});var _0x1d2aae=_0xecc3('0x3b');return db[_0xecc3('0x3c')][_0xecc3('0x39')]({'where':{'type':_0x1d2aae,'resourceId':_0x426cc4['id']}})['then'](function(){return _0xcacffa;});})[_0xecc3('0x23')](function(){_0x578d8f[_0xecc3('0x2e')](0xcc)[_0xecc3('0x3d')]();});}};}function handleEntityNotFound(_0x1fd911,_0x2ab51c){return function(_0x42cd12){if(!_0x42cd12){_0x1fd911[_0xecc3('0x2d')](0x194);}return _0x42cd12;};}function handleError(_0x14dede,_0x22cce0){_0x22cce0=_0x22cce0||0x1f4;return function(_0x4da1d5){logger['error'](_0x4da1d5[_0xecc3('0x3e')]);if(_0x4da1d5[_0xecc3('0x3f')]){delete _0x4da1d5[_0xecc3('0x3f')];}_0x14dede[_0xecc3('0x2e')](_0x22cce0)[_0xecc3('0x40')](_0x4da1d5);};}exports[_0xecc3('0x41')]=function(_0x671576,_0x2e797e){var _0x5c5169={'include':[{'model':db[_0xecc3('0x42')],'as':_0xecc3('0x43')}]},_0x488419={},_0x14489c={'count':0x0,'rows':[]};var _0x38aea5=_[_0xecc3('0x44')](db[_0xecc3('0x45')]['rawAttributes'],function(_0x59faf2){return{'name':_0x59faf2['fieldName'],'type':_0x59faf2['type']['key']};});_0x488419[_0xecc3('0x46')]=_[_0xecc3('0x44')](_0x38aea5,_0xecc3('0x3f'));_0x488419[_0xecc3('0x47')]=_[_0xecc3('0x48')](_0x671576['query']);_0x488419['filters']=_[_0xecc3('0x49')](_0x488419[_0xecc3('0x46')],_0x488419[_0xecc3('0x47')]);_0x5c5169[_0xecc3('0x4a')]=_[_0xecc3('0x49')](_0x488419[_0xecc3('0x46')],qs[_0xecc3('0x4b')](_0x671576['query'][_0xecc3('0x4b')]));_0x5c5169[_0xecc3('0x4a')]=_0x5c5169[_0xecc3('0x4a')][_0xecc3('0x4c')]?_0x5c5169[_0xecc3('0x4a')]:_0x488419['model'];if(!_0x671576[_0xecc3('0x47')]['hasOwnProperty']('nolimit')){_0x5c5169[_0xecc3('0x32')]=qs['limit'](_0x671576[_0xecc3('0x47')][_0xecc3('0x32')]);_0x5c5169[_0xecc3('0x30')]=qs[_0xecc3('0x30')](_0x671576[_0xecc3('0x47')][_0xecc3('0x30')]);}_0x5c5169['order']=qs[_0xecc3('0x4d')](_0x671576[_0xecc3('0x47')][_0xecc3('0x4d')]);_0x5c5169[_0xecc3('0x4e')]=qs[_0xecc3('0x4f')](_[_0xecc3('0x50')](_0x671576[_0xecc3('0x47')],_0x488419[_0xecc3('0x4f')]),_0x38aea5);if(_0x671576[_0xecc3('0x47')]['filter']){_0x5c5169[_0xecc3('0x4e')]=_['merge'](_0x5c5169[_0xecc3('0x4e')],{'$or':_[_0xecc3('0x44')](_0x38aea5,function(_0x484f57){if(_0x484f57[_0xecc3('0x51')]!==_0xecc3('0x52')){var _0x5f4f02={};_0x5f4f02[_0x484f57[_0xecc3('0x3f')]]={'$like':'%'+_0x671576[_0xecc3('0x47')]['filter']+'%'};return _0x5f4f02;}})});}_0x5c5169=_[_0xecc3('0x53')]({},_0x5c5169,_0x671576[_0xecc3('0x54')]);var _0x39c4de={'where':_0x5c5169[_0xecc3('0x4e')]};return db['OpenchannelAccount'][_0xecc3('0x33')](_0x39c4de)[_0xecc3('0x23')](function(_0x227379){_0x14489c[_0xecc3('0x33')]=_0x227379;if(_0x671576[_0xecc3('0x47')][_0xecc3('0x55')]){_0x5c5169[_0xecc3('0x56')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xecc3('0x57')](_0x5c5169);})[_0xecc3('0x23')](function(_0x5cbd20){_0x14489c[_0xecc3('0x58')]=_0x5cbd20;return _0x14489c;})[_0xecc3('0x23')](respondWithFilteredResult(_0x2e797e,_0x5c5169))['catch'](handleError(_0x2e797e,null));};exports[_0xecc3('0x59')]=function(_0x2c5f12,_0x2ed561){var _0x38f102={'raw':![],'where':{'id':_0x2c5f12[_0xecc3('0x5a')]['id']},'include':[{'model':db[_0xecc3('0x42')],'as':_0xecc3('0x43')}]},_0x2850f7={};_0x2850f7['model']=_['keys'](db[_0xecc3('0x45')][_0xecc3('0x5b')]);_0x2850f7[_0xecc3('0x47')]=_[_0xecc3('0x48')](_0x2c5f12[_0xecc3('0x47')]);_0x2850f7['filters']=_[_0xecc3('0x49')](_0x2850f7[_0xecc3('0x46')],_0x2850f7[_0xecc3('0x47')]);_0x38f102[_0xecc3('0x4a')]=_[_0xecc3('0x49')](_0x2850f7['model'],qs[_0xecc3('0x4b')](_0x2c5f12['query'][_0xecc3('0x4b')]));_0x38f102[_0xecc3('0x4a')]=_0x38f102[_0xecc3('0x4a')]['length']?_0x38f102['attributes']:_0x2850f7[_0xecc3('0x46')];if(_0x2c5f12[_0xecc3('0x47')][_0xecc3('0x55')]){_0x38f102[_0xecc3('0x56')]=[{'all':!![]}];}_0x38f102=_['merge']({},_0x38f102,_0x2c5f12[_0xecc3('0x54')]);return db[_0xecc3('0x45')]['find'](_0x38f102)['then'](handleEntityNotFound(_0x2ed561,null))[_0xecc3('0x23')](respondWithResult(_0x2ed561,null))[_0xecc3('0x2c')](handleError(_0x2ed561,null));};exports[_0xecc3('0x5c')]=function(_0x1f8397,_0x1d6cea){return db[_0xecc3('0x45')]['create'](_0x1f8397[_0xecc3('0x5d')],{})[_0xecc3('0x23')](function(_0x1d41de){var _0x3f8e3d=_0x1f8397['user'][_0xecc3('0x3a')]({'plain':!![]});if(!_0x3f8e3d)throw new Error(_0xecc3('0x5e'));if(_0x3f8e3d[_0xecc3('0x5f')]===_0xecc3('0x60')){var _0x6cab71=_0x1d41de[_0xecc3('0x3a')]({'plain':!![]});var _0x194e9b=_0xecc3('0x3b');return db[_0xecc3('0x61')]['find']({'where':{'name':_0x194e9b,'userProfileId':_0x3f8e3d[_0xecc3('0x62')]},'raw':!![]})[_0xecc3('0x23')](function(_0x36da5d){if(_0x36da5d&&_0x36da5d[_0xecc3('0x63')]===0x0){return db['UserProfileResource'][_0xecc3('0x5c')]({'name':_0x6cab71['name'],'resourceId':_0x6cab71['id'],'type':_0x36da5d[_0xecc3('0x3f')],'sectionId':_0x36da5d['id']},{})[_0xecc3('0x23')](function(){return _0x1d41de;});}else{return _0x1d41de;}})[_0xecc3('0x2c')](function(_0x4426b7){logger[_0xecc3('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4426b7);throw _0x4426b7;});}return _0x1d41de;})[_0xecc3('0x23')](respondWithResult(_0x1d6cea,0xc9))[_0xecc3('0x2c')](handleError(_0x1d6cea,null));};exports[_0xecc3('0x38')]=function(_0x4946b2,_0x422aba){if(_0x4946b2[_0xecc3('0x5d')]['id']){delete _0x4946b2[_0xecc3('0x5d')]['id'];}return db[_0xecc3('0x45')][_0xecc3('0x64')]({'where':{'id':_0x4946b2[_0xecc3('0x5a')]['id']},'include':[{'model':db[_0xecc3('0x42')],'as':_0xecc3('0x43')}]})['then'](handleEntityNotFound(_0x422aba,null))[_0xecc3('0x23')](saveUpdates(_0x4946b2[_0xecc3('0x5d')],null))[_0xecc3('0x23')](respondWithResult(_0x422aba,null))[_0xecc3('0x2c')](handleError(_0x422aba,null));};exports['destroy']=function(_0x3f9942,_0x29422a){return db['OpenchannelAccount'][_0xecc3('0x64')]({'where':{'id':_0x3f9942[_0xecc3('0x5a')]['id']}})[_0xecc3('0x23')](handleEntityNotFound(_0x29422a,null))[_0xecc3('0x23')](removeEntity(_0x29422a,null))[_0xecc3('0x2c')](handleError(_0x29422a,null));};exports[_0xecc3('0x65')]=function(_0x3a6dc3,_0x2533dd){return db[_0xecc3('0x45')][_0xecc3('0x65')]()['then'](respondWithResult(_0x2533dd,null))[_0xecc3('0x2c')](handleError(_0x2533dd,null));};exports['addDisposition']=function(_0x274094,_0x2b7de4,_0x1fd957){if(_0x274094['body']['id']){delete _0x274094[_0xecc3('0x5d')]['id'];}return db[_0xecc3('0x45')][_0xecc3('0x64')]({'where':{'id':_0x274094[_0xecc3('0x5a')]['id']}})[_0xecc3('0x23')](handleEntityNotFound(_0x2b7de4,null))['then'](function(_0x486fbd){if(_0x486fbd){_0x274094[_0xecc3('0x5d')][_0xecc3('0x66')]=_0x486fbd['id'];return db[_0xecc3('0x67')][_0xecc3('0x5c')](_0x274094['body']);}})[_0xecc3('0x23')](respondWithResult(_0x2b7de4,null))['catch'](handleError(_0x2b7de4,null));};exports[_0xecc3('0x68')]=function(_0x1f20fa,_0x15ed68,_0x4241e1){var _0x2bcaf9={'raw':![],'where':{}};var _0x104d7f={};var _0x3a2eb5={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xecc3('0x69')]({'where':{'id':_0x1f20fa[_0xecc3('0x5a')]['id']}})[_0xecc3('0x23')](handleEntityNotFound(_0x15ed68,null))[_0xecc3('0x23')](function(_0x1cad8e){if(_0x1cad8e){_0x104d7f[_0xecc3('0x46')]=_[_0xecc3('0x48')](db['Disposition'][_0xecc3('0x5b')]);_0x104d7f['query']=_[_0xecc3('0x48')](_0x1f20fa['query']);_0x104d7f['filters']=_[_0xecc3('0x49')](_0x104d7f['model'],_0x104d7f[_0xecc3('0x47')]);_0x2bcaf9[_0xecc3('0x4a')]=_[_0xecc3('0x49')](_0x104d7f[_0xecc3('0x46')],qs[_0xecc3('0x4b')](_0x1f20fa['query']['fields']));_0x2bcaf9[_0xecc3('0x4a')]=_0x2bcaf9[_0xecc3('0x4a')][_0xecc3('0x4c')]?_0x2bcaf9['attributes']:_0x104d7f[_0xecc3('0x46')];if(!_0x1f20fa[_0xecc3('0x47')][_0xecc3('0x6a')](_0xecc3('0x6b'))){_0x2bcaf9[_0xecc3('0x32')]=qs[_0xecc3('0x32')](_0x1f20fa['query'][_0xecc3('0x32')]);_0x2bcaf9[_0xecc3('0x30')]=qs['offset'](_0x1f20fa[_0xecc3('0x47')][_0xecc3('0x30')]);}_0x2bcaf9['order']=qs[_0xecc3('0x4d')](_0x1f20fa[_0xecc3('0x47')][_0xecc3('0x4d')]);_0x2bcaf9[_0xecc3('0x4e')]=qs['filters'](_[_0xecc3('0x50')](_0x1f20fa[_0xecc3('0x47')],_0x104d7f['filters']));_0x2bcaf9[_0xecc3('0x4e')][_0xecc3('0x66')]=_0x1cad8e['id'];if(_0x1f20fa[_0xecc3('0x47')]['filter']){_0x2bcaf9['where']=_['merge'](_0x2bcaf9['where'],{'$or':_[_0xecc3('0x44')](_0x2bcaf9[_0xecc3('0x4a')],function(_0x4bbd0c){var _0x554171={};_0x554171[_0x4bbd0c]={'$like':'%'+_0x1f20fa[_0xecc3('0x47')][_0xecc3('0x6c')]+'%'};return _0x554171;})});}_0x2bcaf9=_[_0xecc3('0x53')]({},_0x2bcaf9,_0x1f20fa[_0xecc3('0x54')]);return db[_0xecc3('0x67')][_0xecc3('0x33')]({'where':_0x2bcaf9[_0xecc3('0x4e')]})[_0xecc3('0x23')](function(_0x57b8d8){_0x3a2eb5['count']=_0x57b8d8;if(_0x1f20fa[_0xecc3('0x47')][_0xecc3('0x55')]){_0x2bcaf9[_0xecc3('0x56')]=[{'all':!![]}];}return db[_0xecc3('0x67')][_0xecc3('0x57')](_0x2bcaf9);})[_0xecc3('0x23')](function(_0x4e15dc){_0x3a2eb5['rows']=_0x4e15dc;return _0x3a2eb5;});}})['then'](respondWithFilteredResult(_0x15ed68,_0x2bcaf9))[_0xecc3('0x2c')](handleError(_0x15ed68,null));};exports['removeDispositions']=function(_0x52f68b,_0x3025bb,_0x38976e){return db['OpenchannelAccount'][_0xecc3('0x64')]({'where':{'id':_0x52f68b[_0xecc3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3025bb,null))[_0xecc3('0x23')](function(_0x3ff8d8){if(_0x3ff8d8){return _0x3ff8d8[_0xecc3('0x6d')](_0x52f68b[_0xecc3('0x47')][_0xecc3('0x6e')]);}})[_0xecc3('0x23')](respondWithStatusCode(_0x3025bb,null))['catch'](handleError(_0x3025bb,null));};exports[_0xecc3('0x6f')]=function(_0x3639ad,_0x2db899,_0x2eabf4){if(_0x3639ad['body']['id']){delete _0x3639ad[_0xecc3('0x5d')]['id'];}return db[_0xecc3('0x45')][_0xecc3('0x64')]({'where':{'id':_0x3639ad[_0xecc3('0x5a')]['id']}})[_0xecc3('0x23')](handleEntityNotFound(_0x2db899,null))['then'](function(_0x5ba0d4){if(_0x5ba0d4){_0x3639ad[_0xecc3('0x5d')]['OpenchannelAccountId']=_0x5ba0d4['id'];return db[_0xecc3('0x70')]['create'](_0x3639ad[_0xecc3('0x5d')]);}})['then'](respondWithResult(_0x2db899,null))[_0xecc3('0x2c')](handleError(_0x2db899,null));};exports['getAnswers']=function(_0x3e6b19,_0x13b4af,_0x4a6914){var _0x317d36={'raw':![],'where':{}};var _0x585fe5={};var _0x4621ef={'count':0x0,'rows':[]};return db[_0xecc3('0x45')][_0xecc3('0x69')]({'where':{'id':_0x3e6b19[_0xecc3('0x5a')]['id']}})[_0xecc3('0x23')](handleEntityNotFound(_0x13b4af,null))[_0xecc3('0x23')](function(_0x37f4f7){if(_0x37f4f7){_0x585fe5['model']=_[_0xecc3('0x48')](db[_0xecc3('0x70')][_0xecc3('0x5b')]);_0x585fe5[_0xecc3('0x47')]=_[_0xecc3('0x48')](_0x3e6b19['query']);_0x585fe5['filters']=_[_0xecc3('0x49')](_0x585fe5[_0xecc3('0x46')],_0x585fe5['query']);_0x317d36[_0xecc3('0x4a')]=_[_0xecc3('0x49')](_0x585fe5[_0xecc3('0x46')],qs[_0xecc3('0x4b')](_0x3e6b19[_0xecc3('0x47')][_0xecc3('0x4b')]));_0x317d36[_0xecc3('0x4a')]=_0x317d36['attributes']['length']?_0x317d36['attributes']:_0x585fe5[_0xecc3('0x46')];if(!_0x3e6b19[_0xecc3('0x47')][_0xecc3('0x6a')](_0xecc3('0x6b'))){_0x317d36[_0xecc3('0x32')]=qs[_0xecc3('0x32')](_0x3e6b19['query'][_0xecc3('0x32')]);_0x317d36['offset']=qs[_0xecc3('0x30')](_0x3e6b19[_0xecc3('0x47')][_0xecc3('0x30')]);}_0x317d36[_0xecc3('0x71')]=qs[_0xecc3('0x4d')](_0x3e6b19[_0xecc3('0x47')][_0xecc3('0x4d')]);_0x317d36[_0xecc3('0x4e')]=qs[_0xecc3('0x4f')](_[_0xecc3('0x50')](_0x3e6b19['query'],_0x585fe5[_0xecc3('0x4f')]));_0x317d36[_0xecc3('0x4e')]['OpenchannelAccountId']=_0x37f4f7['id'];if(_0x3e6b19['query'][_0xecc3('0x6c')]){_0x317d36[_0xecc3('0x4e')]=_[_0xecc3('0x53')](_0x317d36[_0xecc3('0x4e')],{'$or':_[_0xecc3('0x44')](_0x317d36[_0xecc3('0x4a')],function(_0x5f46c9){var _0x509ab2={};_0x509ab2[_0x5f46c9]={'$like':'%'+_0x3e6b19['query'][_0xecc3('0x6c')]+'%'};return _0x509ab2;})});}_0x317d36=_[_0xecc3('0x53')]({},_0x317d36,_0x3e6b19['options']);return db[_0xecc3('0x70')][_0xecc3('0x33')]({'where':_0x317d36[_0xecc3('0x4e')]})[_0xecc3('0x23')](function(_0x53f153){_0x4621ef[_0xecc3('0x33')]=_0x53f153;if(_0x3e6b19[_0xecc3('0x47')][_0xecc3('0x55')]){_0x317d36[_0xecc3('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0xecc3('0x57')](_0x317d36);})[_0xecc3('0x23')](function(_0x385638){_0x4621ef[_0xecc3('0x58')]=_0x385638;return _0x4621ef;});}})['then'](respondWithFilteredResult(_0x13b4af,_0x317d36))[_0xecc3('0x2c')](handleError(_0x13b4af,null));};exports[_0xecc3('0x72')]=function(_0x163f70,_0x1e2686,_0x47fcf8){return db['OpenchannelAccount'][_0xecc3('0x64')]({'where':{'id':_0x163f70['params']['id']}})[_0xecc3('0x23')](handleEntityNotFound(_0x1e2686,null))[_0xecc3('0x23')](function(_0x4a2dbe){if(_0x4a2dbe){return _0x4a2dbe['removeAnswers'](_0x163f70[_0xecc3('0x47')]['ids']);}})[_0xecc3('0x23')](respondWithStatusCode(_0x1e2686,null))[_0xecc3('0x2c')](handleError(_0x1e2686,null));};exports[_0xecc3('0x73')]=function(_0x1fea4c,_0x52c9f2,_0x35a29e){var _0x2e22c9={'body':_0x1fea4c[_0xecc3('0x5d')],'channel':'openchannel'};var _0x494262=[];var _0x5bcd72=[];var _0x3e4480={};var _0x1f31bb=![];return db[_0xecc3('0x74')][_0xecc3('0x65')]()['then'](function(_0x12a288){if(!_0x12a288){throw new db[(_0xecc3('0x75'))][(_0xecc3('0x76'))](_0xecc3('0x77'));}_0x494262=_['difference'](_[_0xecc3('0x48')](_0x12a288),[_0xecc3('0x78'),'updatedAt']);_0x5bcd72=_[_0xecc3('0x79')](_[_0xecc3('0x48')](_0x12a288),[_0xecc3('0x78'),_0xecc3('0x7a'),'CompanyId',_0xecc3('0x7b')]);if(_0x1fea4c[_0xecc3('0x5d')]['id']){delete _0x1fea4c[_0xecc3('0x5d')]['id'];}if(_['isNil'](_0x1fea4c[_0xecc3('0x5d')][_0xecc3('0x7c')])){throw new db['Sequelize']['ValidationError'](_0xecc3('0x7d'));}if(_[_0xecc3('0x7e')](_0x1fea4c['body']['body'])||_0x1fea4c[_0xecc3('0x5d')][_0xecc3('0x5d')]===''){throw new db['Sequelize'][(_0xecc3('0x76'))](_0xecc3('0x7f'));}if(_[_0xecc3('0x7e')](_0x1fea4c[_0xecc3('0x5d')]['mapKey'])){throw new db[(_0xecc3('0x75'))][(_0xecc3('0x76'))](_0xecc3('0x80')+_0x5bcd72);}if(!_[_0xecc3('0x81')](_0x5bcd72,_0x1fea4c[_0xecc3('0x5d')][_0xecc3('0x82')])){throw new db[(_0xecc3('0x75'))][(_0xecc3('0x76'))](_0xecc3('0x83')+_0x5bcd72);}_0x3e4480[_0x1fea4c['body'][_0xecc3('0x82')]]=_0x1fea4c['body'][_0xecc3('0x7c')];})['then'](function(){return db[_0xecc3('0x45')][_0xecc3('0x64')]({'where':{'id':_0x1fea4c[_0xecc3('0x5a')]['id']},'include':[{'model':db[_0xecc3('0x84')],'as':_0xecc3('0x85'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3e4480,'limit':0x1,'order':[[_0xecc3('0x7a'),_0xecc3('0x86')]]}]},{'model':db[_0xecc3('0x87')],'as':_0xecc3('0x88')}]});})[_0xecc3('0x23')](handleEntityNotFound(_0x52c9f2,null))[_0xecc3('0x23')](function(_0x68242c){if(_0x68242c&&_0x68242c['List']){_0x2e22c9[_0xecc3('0x89')]=_0x68242c;_0x2e22c9['applications']=_0x68242c[_0xecc3('0x88')];_0x2e22c9[_0xecc3('0x8a')]=_0x68242c[_0xecc3('0x85')];_0x2e22c9[_0xecc3('0x8b')]=_[_0xecc3('0x8c')](_0x2e22c9[_0xecc3('0x8b')],['priority'],[_0xecc3('0x8d')]);if(_0x2e22c9[_0xecc3('0x89')]['Applications']){delete _0x2e22c9[_0xecc3('0x89')][_0xecc3('0x88')];}if(_0x2e22c9[_0xecc3('0x89')]['List']&&_0x2e22c9['account'][_0xecc3('0x85')]['Contacts'][_0xecc3('0x4c')]){return _0x2e22c9[_0xecc3('0x89')][_0xecc3('0x85')][_0xecc3('0x8e')][0x0];}var _0x1de576=_['defaults'](_0x1fea4c[_0xecc3('0x5d')],{'firstName':_0x1fea4c[_0xecc3('0x5d')]['from'],'ListId':_0x68242c[_0xecc3('0x7b')]});_0x1de576[_0x1fea4c[_0xecc3('0x5d')][_0xecc3('0x82')]]=_0x1fea4c['body']['from'];return db[_0xecc3('0x74')][_0xecc3('0x5c')](_0x1de576,{'fields':_0x494262,'raw':!![]});}})[_0xecc3('0x23')](handleEntityNotFound(_0x52c9f2,null))[_0xecc3('0x23')](function(_0xc80ac8){_0x2e22c9[_0xecc3('0x8f')]=_0xc80ac8;if(_0xc80ac8){var _0x22dee4={'ContactId':_0xc80ac8['id'],'OpenchannelAccountId':_0x1fea4c[_0xecc3('0x5a')]['id'],'from':(_0xc80ac8[_0xecc3('0x90')]||'')+'\x20'+(_0xc80ac8[_0xecc3('0x91')]||'')};var _0x1cec43={'OpenchannelAccountId':_0x1fea4c[_0xecc3('0x5a')]['id'],'closed':![]};if(_0x1fea4c[_0xecc3('0x5d')][_0xecc3('0x92')]){_0x1cec43[_0xecc3('0x92')]=_0x1fea4c['body'][_0xecc3('0x92')];return db['OpenchannelInteraction'][_0xecc3('0x64')]({'where':_0x1cec43})[_0xecc3('0x23')](function(_0x39e83d){if(_0x39e83d){return[_0x39e83d,![]];}_0x22dee4[_0xecc3('0x92')]=_0x1fea4c[_0xecc3('0x5d')]['threadId'];_0x22dee4[_0xecc3('0x93')]=_0x1fea4c[_0xecc3('0x5d')][_0xecc3('0x93')];return db[_0xecc3('0x94')]['create'](_0x22dee4)[_0xecc3('0x23')](function(_0x4f7e6f){return[_0x4f7e6f,!![]];});});}else{_0x1cec43[_0xecc3('0x92')]=null;}_0x1cec43['ContactId']=_0xc80ac8['id'];return db[_0xecc3('0x94')]['find']({'where':_0x1cec43})[_0xecc3('0x23')](function(_0x16a291){if(_0x16a291){return[_0x16a291,![]];}return db[_0xecc3('0x94')]['create'](_0x22dee4)[_0xecc3('0x23')](function(_0x22e36c){return[_0x22e36c,!![]];});});}})[_0xecc3('0x95')](function(_0x3f595f,_0x4f5f4e){if(_0x3f595f){_0x1f31bb=_0x4f5f4e;if(!_0x4f5f4e){var _0x57581c={'from':(_0x2e22c9[_0xecc3('0x8f')]['firstName']||'')+'\x20'+(_0x2e22c9[_0xecc3('0x8f')][_0xecc3('0x91')]||'')};if(_0x1fea4c[_0xecc3('0x5d')][_0xecc3('0x92')]&&_0x1fea4c['body'][_0xecc3('0x96')]&&_0x1fea4c['body'][_0xecc3('0x92')]!=_0x1fea4c[_0xecc3('0x5d')][_0xecc3('0x96')]){_0x57581c[_0xecc3('0x92')]=_0x1fea4c[_0xecc3('0x5d')]['messageId'];}return _0x3f595f['update'](_0x57581c);}else{return _0x3f595f;}}})[_0xecc3('0x23')](function(_0x2a957b){_0x2e22c9[_0xecc3('0x97')]=_0x2a957b[_0xecc3('0x3a')]({'plain':!![]});_0x2e22c9[_0xecc3('0x97')]['created']=_0x1f31bb;if(_0x2e22c9['interaction'][_0xecc3('0x98')]){if(_0x2e22c9[_0xecc3('0x89')][_0xecc3('0x99')]){_0x2e22c9[_0xecc3('0x8b')][_0xecc3('0x9a')]({'id':0x0,'priority':_0x2e22c9[_0xecc3('0x8b')][_0xecc3('0x4c')]+0x1,'app':_0xecc3('0x9b'),'appdata':_0xecc3('0x9c'),'interval':_0xecc3('0x9d')});}}return db[_0xecc3('0x9e')]['create']({'body':_0x1fea4c[_0xecc3('0x5d')][_0xecc3('0x5d')],'OpenchannelAccountId':_0x1fea4c[_0xecc3('0x5a')]['id'],'OpenchannelInteractionId':_0x2a957b['id'],'direction':'in','ContactId':_0x2e22c9[_0xecc3('0x8f')]['id'],'AttachmentId':_0x1fea4c[_0xecc3('0x5d')]['AttachmentId']});})[_0xecc3('0x23')](function(_0x3a97ca){_0x2e22c9[_0xecc3('0x2a')]=_0x3a97ca;if(_0x2e22c9[_0xecc3('0x97')][_0xecc3('0x9f')]){return db[_0xecc3('0xa0')][_0xecc3('0x64')]({'attributes':['id',_0xecc3('0x3f')],'where':{'id':_0x2e22c9['interaction'][_0xecc3('0x9f')]}})[_0xecc3('0x23')](function(_0x58952b){if(_0x58952b){_0x2e22c9[_0xecc3('0x8b')][_0xecc3('0xa1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x58952b[_0xecc3('0x3f')]+','+(_0x2e22c9[_0xecc3('0x89')][_0xecc3('0xa2')]||0xa),'interval':_0xecc3('0x9d')});_0x2e22c9[_0xecc3('0xa3')]=![];}return respondWithRpcPromise(_0xecc3('0xa4'),_0xecc3('0xa5'),_0x2e22c9);});}return respondWithRpcPromise(_0xecc3('0xa4'),_0xecc3('0xa5'),_0x2e22c9);})['then'](function(_0x53f688){respondWithRpcPromise(_0xecc3('0xa6'),_0xecc3('0xa6'),{'event':_0xecc3('0x73'),'message':_0x53f688},client9002);return _0x53f688;})[_0xecc3('0x23')](respondWithResult(_0x52c9f2,null))[_0xecc3('0x2c')](handleError(_0x52c9f2,null));};exports[_0xecc3('0xa7')]=function(_0x23ac39,_0x3fa612){var _0x294aa0=_0x23ac39[_0xecc3('0x5a')]['id'];var _0x15d372=_0x23ac39[_0xecc3('0x5d')];var _0x278a44=0xc8;var _0x50187e=null;return db[_0xecc3('0xa8')][_0xecc3('0xa9')]({'isolationLevel':db[_0xecc3('0xa8')]['Transaction'][_0xecc3('0xaa')][_0xecc3('0xab')]},function(_0x4f696d){return db['OpenchannelAccount'][_0xecc3('0x69')]({'where':{'id':_0x294aa0},'transaction':_0x4f696d})[_0xecc3('0x23')](function(_0x1034bb){if(_0x1034bb){return db['OpenchannelApplication'][_0xecc3('0x39')]({'where':{'OpenchannelAccountId':_0x294aa0},'transaction':_0x4f696d})[_0xecc3('0x23')](function(){var _0x3cc163=_[_0xecc3('0x44')](_0x15d372,function(_0x333da0){_0x333da0['OpenchannelAccountId']=_0x294aa0;return _0x333da0;});return db[_0xecc3('0x87')][_0xecc3('0xac')](_0x3cc163,{'transaction':_0x4f696d});});}else{_0x278a44=0x194;_0x50187e=[];}});})[_0xecc3('0x23')](function(){if(_0x278a44!==0x194){return db[_0xecc3('0x87')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x294aa0},'order':_0xecc3('0xad')})['then'](function(_0x3e580e){_0x50187e=_0x3e580e;});}})['catch'](function(_0x1281c2){_0x278a44=0x1f4;logger[_0xecc3('0x28')](_0x1281c2[_0xecc3('0x3e')]);if(_0x1281c2['name']){delete _0x1281c2[_0xecc3('0x3f')];}_0x50187e=_0x1281c2;})[_0xecc3('0xae')](function(){if(_0x50187e===null){_0x3fa612[_0xecc3('0x2d')](_0x278a44);}else{if(_0x278a44===0x1f4){_0x3fa612[_0xecc3('0x2e')](_0x278a44)['send'](_0x50187e);}else{_0x3fa612[_0xecc3('0x2e')](_0x278a44)[_0xecc3('0x2f')](_0x50187e);}}});};exports['getApplications']=function(_0x3b69e1,_0x44f932,_0x59a296){var _0x110abe={};var _0x19287d={};var _0x4f859c;var _0x2ea6d8;return db[_0xecc3('0x45')]['findOne']({'where':{'id':_0x3b69e1['params']['id']}})['then'](handleEntityNotFound(_0x44f932,null))[_0xecc3('0x23')](function(_0x1cf78a){if(_0x1cf78a){_0x4f859c=_0x1cf78a;_0x19287d[_0xecc3('0x46')]=_[_0xecc3('0x48')](db[_0xecc3('0x87')][_0xecc3('0x5b')]);_0x19287d[_0xecc3('0x47')]=_[_0xecc3('0x48')](_0x3b69e1[_0xecc3('0x47')]);_0x19287d['filters']=_[_0xecc3('0x49')](_0x19287d[_0xecc3('0x46')],_0x19287d[_0xecc3('0x47')]);_0x110abe[_0xecc3('0x4a')]=_[_0xecc3('0x49')](_0x19287d[_0xecc3('0x46')],qs[_0xecc3('0x4b')](_0x3b69e1[_0xecc3('0x47')][_0xecc3('0x4b')]));_0x110abe['attributes']=_0x110abe['attributes'][_0xecc3('0x4c')]?_0x110abe[_0xecc3('0x4a')]:_0x19287d['model'];_0x110abe[_0xecc3('0x71')]=qs['sort'](_0x3b69e1[_0xecc3('0x47')][_0xecc3('0x4d')]);_0x110abe['where']=qs[_0xecc3('0x4f')](_['pick'](_0x3b69e1[_0xecc3('0x47')],_0x19287d[_0xecc3('0x4f')]));if(_0x3b69e1[_0xecc3('0x47')][_0xecc3('0x6c')]){_0x110abe[_0xecc3('0x4e')]=_['merge'](_0x110abe[_0xecc3('0x4e')],{'$or':_['map'](_0x110abe['attributes'],function(_0x78f394){var _0x5fc674={};_0x5fc674[_0x78f394]={'$like':'%'+_0x3b69e1[_0xecc3('0x47')][_0xecc3('0x6c')]+'%'};return _0x5fc674;})});}_0x110abe=_[_0xecc3('0x53')]({},_0x110abe,_0x3b69e1[_0xecc3('0x54')]);return _0x4f859c[_0xecc3('0xaf')](_0x110abe);}})[_0xecc3('0x23')](function(_0x166fac){if(_0x166fac){_0x2ea6d8=_0x166fac[_0xecc3('0x4c')];if(!_0x3b69e1[_0xecc3('0x47')][_0xecc3('0x6a')](_0xecc3('0x6b'))){_0x110abe[_0xecc3('0x32')]=qs[_0xecc3('0x32')](_0x3b69e1[_0xecc3('0x47')]['limit']);_0x110abe[_0xecc3('0x30')]=qs[_0xecc3('0x30')](_0x3b69e1[_0xecc3('0x47')]['offset']);}return _0x4f859c['getApplications'](_0x110abe);}})[_0xecc3('0x23')](function(_0x13ebf5){if(_0x13ebf5){return _0x13ebf5?{'count':_0x2ea6d8,'rows':_0x13ebf5}:null;}})[_0xecc3('0x23')](respondWithResult(_0x44f932,null))[_0xecc3('0x2c')](handleError(_0x44f932,null));};exports['getInteractions']=function(_0x2d3f46,_0x33f6a6,_0x32c9d9){var _0x2f4ae6={'raw':![],'where':{}};var _0x5c13cd={};var _0xb29531={'count':0x0,'rows':[]};return db[_0xecc3('0x45')][_0xecc3('0x69')]({'where':{'id':_0x2d3f46[_0xecc3('0x5a')]['id']}})[_0xecc3('0x23')](handleEntityNotFound(_0x33f6a6,null))['then'](function(_0x247496){if(_0x247496){_0x5c13cd['model']=_[_0xecc3('0x48')](db[_0xecc3('0x94')]['rawAttributes']);_0x5c13cd[_0xecc3('0x47')]=_[_0xecc3('0x48')](_0x2d3f46[_0xecc3('0x47')]);_0x5c13cd[_0xecc3('0x4f')]=_['intersection'](_0x5c13cd[_0xecc3('0x46')],_0x5c13cd[_0xecc3('0x47')]);_0x2f4ae6[_0xecc3('0x4a')]=_[_0xecc3('0x49')](_0x5c13cd[_0xecc3('0x46')],qs['fields'](_0x2d3f46['query']['fields']));_0x2f4ae6[_0xecc3('0x4a')]=_0x2f4ae6[_0xecc3('0x4a')][_0xecc3('0x4c')]?_0x2f4ae6[_0xecc3('0x4a')]:_0x5c13cd[_0xecc3('0x46')];if(!_0x2d3f46[_0xecc3('0x47')][_0xecc3('0x6a')]('nolimit')){_0x2f4ae6['limit']=qs['limit'](_0x2d3f46[_0xecc3('0x47')][_0xecc3('0x32')]);_0x2f4ae6[_0xecc3('0x30')]=qs[_0xecc3('0x30')](_0x2d3f46[_0xecc3('0x47')]['offset']);}_0x2f4ae6['order']=qs['sort'](_0x2d3f46[_0xecc3('0x47')][_0xecc3('0x4d')]);_0x2f4ae6[_0xecc3('0x4e')]=qs[_0xecc3('0x4f')](_['pick'](_0x2d3f46['query'],_0x5c13cd[_0xecc3('0x4f')]));_0x2f4ae6['where'][_0xecc3('0x66')]=_0x247496['id'];if(_0x2d3f46['query'][_0xecc3('0x6c')]){_0x2f4ae6[_0xecc3('0x4e')]=_[_0xecc3('0x53')](_0x2f4ae6[_0xecc3('0x4e')],{'$or':_[_0xecc3('0x44')](_0x2f4ae6['attributes'],function(_0x59aefd){var _0x7b966c={};_0x7b966c[_0x59aefd]={'$like':'%'+_0x2d3f46[_0xecc3('0x47')]['filter']+'%'};return _0x7b966c;})});}_0x2f4ae6=_['merge']({},_0x2f4ae6,_0x2d3f46[_0xecc3('0x54')]);return db['OpenchannelInteraction'][_0xecc3('0x33')]({'where':_0x2f4ae6[_0xecc3('0x4e')]})[_0xecc3('0x23')](function(_0x56d7d){_0xb29531[_0xecc3('0x33')]=_0x56d7d;if(_0x2d3f46[_0xecc3('0x47')]['includeAll']){_0x2f4ae6[_0xecc3('0x56')]=[{'model':db[_0xecc3('0x74')],'as':_0xecc3('0xb0'),'required':![]},{'model':db[_0xecc3('0xa0')],'as':_0xecc3('0xb1'),'attributes':['name',_0xecc3('0xb2'),_0xecc3('0xb3')],'required':![]},{'model':db[_0xecc3('0xb4')],'as':'Tags','attributes':['id','name',_0xecc3('0xb5')],'where':_0x2d3f46[_0xecc3('0x47')][_0xecc3('0xb6')]?{'id':_0x2d3f46[_0xecc3('0x47')][_0xecc3('0xb6')]}:undefined,'required':_0x2d3f46['query']['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xecc3('0x57')](_0x2f4ae6);})[_0xecc3('0x23')](function(_0x334ee2){_0xb29531['rows']=_0x334ee2;return _0xb29531;});}})[_0xecc3('0x23')](respondWithFilteredResult(_0x33f6a6,_0x2f4ae6))['catch'](handleError(_0x33f6a6,null));};exports[_0xecc3('0xb7')]=function(_0x558922,_0x3d2833,_0x4fcf06){return db['OpenchannelAccount'][_0xecc3('0x64')]({'where':{'id':_0x558922['params']['id']}})[_0xecc3('0x23')](handleEntityNotFound(_0x3d2833,null))[_0xecc3('0x23')](function(_0xb9134f){if(_0xb9134f){return _0xb9134f[_0xecc3('0xb7')](_0x558922[_0xecc3('0x5d')][_0xecc3('0x6e')],_['omit'](_0x558922['body'],[_0xecc3('0x6e'),'id'])||{})[_0xecc3('0x95')](function(_0x9a721b){for(var _0x510679=0x0;_0x510679<_0x558922[_0xecc3('0x5d')][_0xecc3('0x6e')]['length'];_0x510679+=0x1){socket[_0xecc3('0xb8')](_0xecc3('0xb9'),{'UserId':Number(_0x558922[_0xecc3('0x5d')][_0xecc3('0x6e')][_0x510679]),'OpenchannelAccountId':Number(_0x558922[_0xecc3('0x5a')]['id'])});}return _0x9a721b;});}})[_0xecc3('0x23')](respondWithResult(_0x3d2833,null))[_0xecc3('0x2c')](handleError(_0x3d2833,null));};exports[_0xecc3('0xba')]=function(_0x2cac4d,_0x74470b,_0x3dc967){return db[_0xecc3('0x45')][_0xecc3('0x64')]({'where':{'id':_0x2cac4d[_0xecc3('0x5a')]['id']}})[_0xecc3('0x23')](handleEntityNotFound(_0x74470b,null))[_0xecc3('0x23')](function(_0xa90fc){if(_0xa90fc){return _0xa90fc[_0xecc3('0xba')](_0x2cac4d[_0xecc3('0x47')][_0xecc3('0x6e')])[_0xecc3('0x23')](function(){if(_['isArray'](_0x2cac4d[_0xecc3('0x47')][_0xecc3('0x6e')])){for(var _0x2f140c=0x0;_0x2f140c<_0x2cac4d[_0xecc3('0x47')][_0xecc3('0x6e')][_0xecc3('0x4c')];_0x2f140c+=0x1){socket[_0xecc3('0xb8')](_0xecc3('0xbb'),{'UserId':Number(_0x2cac4d['query'][_0xecc3('0x6e')][_0x2f140c]),'OpenchannelAccountId':Number(_0x2cac4d[_0xecc3('0x5a')]['id'])});}}else{socket[_0xecc3('0xb8')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2cac4d[_0xecc3('0x47')][_0xecc3('0x6e')]),'OpenchannelAccountId':Number(_0x2cac4d[_0xecc3('0x5a')]['id'])});}});}})[_0xecc3('0x23')](respondWithStatusCode(_0x74470b,null))[_0xecc3('0x2c')](handleError(_0x74470b,null));};exports[_0xecc3('0xbc')]=function(_0xfff2ad,_0x1138f9,_0x4aaae2){var _0x39a8cb={};var _0x3f59bc={};var _0x606f93;var _0x2d78a3;return db[_0xecc3('0x45')]['findOne']({'where':{'id':_0xfff2ad['params']['id']}})[_0xecc3('0x23')](handleEntityNotFound(_0x1138f9,null))[_0xecc3('0x23')](function(_0x415387){if(_0x415387){_0x606f93=_0x415387;_0x3f59bc[_0xecc3('0x46')]=_['keys'](db[_0xecc3('0xa0')][_0xecc3('0x5b')]);_0x3f59bc[_0xecc3('0x47')]=_[_0xecc3('0x48')](_0xfff2ad['query']);_0x3f59bc[_0xecc3('0x4f')]=_[_0xecc3('0x49')](_0x3f59bc['model'],_0x3f59bc[_0xecc3('0x47')]);_0x39a8cb[_0xecc3('0x4a')]=_[_0xecc3('0x49')](_0x3f59bc['model'],qs[_0xecc3('0x4b')](_0xfff2ad[_0xecc3('0x47')][_0xecc3('0x4b')]));_0x39a8cb[_0xecc3('0x4a')]=_0x39a8cb[_0xecc3('0x4a')][_0xecc3('0x4c')]?_0x39a8cb[_0xecc3('0x4a')]:_0x3f59bc[_0xecc3('0x46')];_0x39a8cb[_0xecc3('0x71')]=qs[_0xecc3('0x4d')](_0xfff2ad['query'][_0xecc3('0x4d')]);_0x39a8cb['where']=qs[_0xecc3('0x4f')](_[_0xecc3('0x50')](_0xfff2ad[_0xecc3('0x47')],_0x3f59bc[_0xecc3('0x4f')]));if(_0xfff2ad[_0xecc3('0x47')][_0xecc3('0x6c')]){_0x39a8cb[_0xecc3('0x4e')]=_['merge'](_0x39a8cb[_0xecc3('0x4e')],{'$or':_['map'](_0x39a8cb[_0xecc3('0x4a')],function(_0x164687){var _0x1a751c={};_0x1a751c[_0x164687]={'$like':'%'+_0xfff2ad[_0xecc3('0x47')]['filter']+'%'};return _0x1a751c;})});}_0x39a8cb=_['merge']({},_0x39a8cb,_0xfff2ad['options']);return _0x606f93['getAgents'](_0x39a8cb);}})[_0xecc3('0x23')](function(_0x27e6f8){if(_0x27e6f8){_0x2d78a3=_0x27e6f8[_0xecc3('0x4c')];if(!_0xfff2ad[_0xecc3('0x47')]['hasOwnProperty'](_0xecc3('0x6b'))){_0x39a8cb[_0xecc3('0x32')]=qs[_0xecc3('0x32')](_0xfff2ad[_0xecc3('0x47')][_0xecc3('0x32')]);_0x39a8cb['offset']=qs['offset'](_0xfff2ad['query']['offset']);}return _0x606f93[_0xecc3('0xbc')](_0x39a8cb);}})[_0xecc3('0x23')](function(_0x5cad5d){if(_0x5cad5d){return _0x5cad5d?{'count':_0x2d78a3,'rows':_0x5cad5d}:null;}})[_0xecc3('0x23')](respondWithResult(_0x1138f9,null))['catch'](handleError(_0x1138f9,null));};exports[_0xecc3('0x40')]=function(_0x2a147e,_0x1da4ab,_0x5f4323){var _0x5b6e81,_0x2c89d2,_0x546838;if(_[_0xecc3('0x7e')](_0x2a147e[_0xecc3('0x5d')][_0xecc3('0x5d')])||_0x2a147e[_0xecc3('0x5d')][_0xecc3('0x5d')]===''){throw new db['Sequelize']['ValidationError'](_0xecc3('0x7f'));}if(_['isNil'](_0x2a147e[_0xecc3('0x5d')]['to'])){}_0x5b6e81=_0x2a147e[_0xecc3('0x5d')]['to'];return db['OpenchannelAccount'][_0xecc3('0x69')]({'where':{'id':_0x2a147e[_0xecc3('0x5a')]['id']}})[_0xecc3('0x23')](handleEntityNotFound(_0x1da4ab,null))[_0xecc3('0x23')](function(_0x3cc321){if(_0x3cc321){return db[_0xecc3('0x45')]['find']({'where':{'id':_0x3cc321['id']},'include':[{'model':db[_0xecc3('0x84')],'as':_0xecc3('0x85'),'include':[{'model':db[_0xecc3('0x74')],'as':_0xecc3('0x8e'),'where':{[_0x3cc321[_0xecc3('0x82')]]:_0x5b6e81},'limit':0x1,'order':[[_0xecc3('0x7a'),_0xecc3('0x86')]]}]}]})['then'](handleEntityNotFound(_0x1da4ab,null))[_0xecc3('0x23')](function(_0x118812){if(_0x118812&&_0x118812[_0xecc3('0x85')]){_0x2c89d2=_0x118812['get']({'plain':!![]});if(_0x2c89d2[_0xecc3('0x85')]&&_0x2c89d2[_0xecc3('0x85')][_0xecc3('0x8e')]['length']){return _0x2c89d2[_0xecc3('0x85')][_0xecc3('0x8e')][0x0];}return db[_0xecc3('0x74')]['create'](_['defaults'](_0x2a147e['body'],{'firstName':_0x5b6e81,[_0x118812[_0xecc3('0x82')]]:_0x5b6e81,'phone':_0x5b6e81,'ListId':_0x2c89d2[_0xecc3('0x7b')]}));}})[_0xecc3('0x23')](handleEntityNotFound(_0x1da4ab,null))[_0xecc3('0x23')](function(_0xd0ae64){if(_0xd0ae64){_0x546838=_0xd0ae64;return db[_0xecc3('0x94')][_0xecc3('0x64')]({'where':{'ContactId':_0x546838['id'],'closed':![],'OpenchannelAccountId':_0x2c89d2['id']}})[_0xecc3('0x23')](function(_0x3de8f0){if(_0x3de8f0){return[_0x3de8f0,![]];}return db[_0xecc3('0x94')][_0xecc3('0x5c')]({'UserId':_0x2a147e[_0xecc3('0x60')]['id'],'ContactId':_0x546838['id'],'OpenchannelAccountId':_0x2c89d2['id'],'lastMsgDirection':_0xecc3('0xbd'),'Messages':[_[_0xecc3('0x53')](_0x2a147e[_0xecc3('0x5d')],{'read':![],'body':_0x2a147e[_0xecc3('0x5d')][_0xecc3('0x5d')],'OpenchannelAccountId':_0x2c89d2['id'],'UserId':_0x2a147e['user']['id'],'ContactId':_0x546838['id']})]},{'include':[{'model':db[_0xecc3('0x9e')],'as':_0xecc3('0xbe')}]})[_0xecc3('0x23')](function(_0x295257){return[_0x295257,!![]];});});}})[_0xecc3('0x95')](function(_0x16a020,_0x8ce941){if(_0x8ce941){return _0x16a020;}return db[_0xecc3('0x9e')][_0xecc3('0x5c')](_[_0xecc3('0x53')](_0x2a147e['body'],{'read':![],'body':_0x2a147e[_0xecc3('0x5d')][_0xecc3('0x5d')],'OpenchannelAccountId':_0x2c89d2['id'],'OpenchannelInteractionId':_0x16a020['id'],'UserId':_0x2a147e[_0xecc3('0x60')]['id'],'ContactId':_0x546838['id']}))[_0xecc3('0x23')](function(_0x4d5291){_0x16a020[_0xecc3('0xbf')][_0xecc3('0xbe')]=[];_0x16a020[_0xecc3('0xbf')]['Messages']['push'](_0x4d5291[_0xecc3('0xbf')]);return _0x16a020;});});}})[_0xecc3('0x23')](respondWithResult(_0x1da4ab,null))[_0xecc3('0x2c')](handleError(_0x1da4ab,null));}; \ No newline at end of file +var _0xd2e2=['nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','rows','show','params','mandatoryDispositionPause','keys','length','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','OpenchannelAccountId','Disposition','getDispositions','findAll','removeDispositions','addAnswer','CannedAnswer','findOne','hasOwnProperty','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','list','orderBy','applications','asc','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','contact','messageId','interaction','created','push','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','stack','getApplications','getInteractions','Contact','Owner','fullname','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply','reject','save','destroy','get','OpenchannelAccounts','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields'];(function(_0xacb435,_0x220f20){var _0x32b976=function(_0x45d334){while(--_0x45d334){_0xacb435['push'](_0xacb435['shift']());}};_0x32b976(++_0x220f20);}(_0xd2e2,0x78));var _0x2d2e=function(_0x41c624,_0x2a00cb){_0x41c624=_0x41c624-0x0;var _0x5c163f=_0xd2e2[_0x41c624];return _0x5c163f;};'use strict';var emlformat=require(_0x2d2e('0x0'));var rimraf=require(_0x2d2e('0x1'));var zipdir=require(_0x2d2e('0x2'));var jsonpatch=require(_0x2d2e('0x3'));var rp=require('request-promise');var moment=require(_0x2d2e('0x4'));var BPromise=require(_0x2d2e('0x5'));var Mustache=require(_0x2d2e('0x6'));var util=require(_0x2d2e('0x7'));var path=require(_0x2d2e('0x8'));var sox=require(_0x2d2e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d2e('0xa'));var squel=require('squel');var crypto=require(_0x2d2e('0xb'));var jsforce=require(_0x2d2e('0xc'));var deskjs=require(_0x2d2e('0xd'));var toCsv=require(_0x2d2e('0xe'));var querystring=require(_0x2d2e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2d2e('0x10'));var hardwareService=require(_0x2d2e('0x11'));var logger=require(_0x2d2e('0x12'))('api');var utils=require(_0x2d2e('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2d2e('0x14'))['db'];config[_0x2d2e('0x15')]=_[_0x2d2e('0x16')](config[_0x2d2e('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x2d2e('0x17'))(new Redis(config['redis']));require(_0x2d2e('0x18'))[_0x2d2e('0x19')](socket);var jayson=require(_0x2d2e('0x1a'));var client=jayson['client'][_0x2d2e('0x1b')]({'port':0x232c});var client9002=jayson[_0x2d2e('0x1c')][_0x2d2e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4ff88e,_0x3d18af,_0x582338,_0x510c66){return new BPromise(function(_0x184e7f,_0x219430){var _0x51209b=_0x510c66||client;return _0x51209b[_0x2d2e('0x1d')](_0x4ff88e,_0x582338)[_0x2d2e('0x1e')](function(_0x588fc4){logger['info'](_0x2d2e('0x1f'),_0x3d18af,'request\x20sent');logger[_0x2d2e('0x20')](_0x2d2e('0x21'),_0x3d18af,_0x2d2e('0x22'),JSON[_0x2d2e('0x23')](_0x588fc4));if(_0x588fc4[_0x2d2e('0x24')]){if(_0x588fc4['error'][_0x2d2e('0x25')]===0x1f4){logger[_0x2d2e('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x3d18af,_0x588fc4[_0x2d2e('0x24')]['message']);return _0x219430(_0x588fc4[_0x2d2e('0x24')]['message']);}logger['error'](_0x2d2e('0x1f'),_0x3d18af,_0x588fc4[_0x2d2e('0x24')]['message']);return _0x184e7f(_0x588fc4['error'][_0x2d2e('0x26')]);}else{logger[_0x2d2e('0x27')](_0x2d2e('0x1f'),_0x3d18af,_0x2d2e('0x22'));_0x184e7f(_0x588fc4[_0x2d2e('0x28')][_0x2d2e('0x26')]);}})[_0x2d2e('0x29')](function(_0xc3fadf){logger[_0x2d2e('0x24')](_0x2d2e('0x1f'),_0x3d18af,_0xc3fadf);_0x219430(_0xc3fadf);});});}function respondWithStatusCode(_0x5f2193,_0x42a435){_0x42a435=_0x42a435||0xcc;return function(_0x581119){if(_0x581119){return _0x5f2193[_0x2d2e('0x2a')](_0x42a435);}return _0x5f2193['status'](_0x42a435)[_0x2d2e('0x2b')]();};}function respondWithResult(_0x6c1e17,_0x56da26){_0x56da26=_0x56da26||0xc8;return function(_0x24c89b){if(_0x24c89b){return _0x6c1e17[_0x2d2e('0x2c')](_0x56da26)[_0x2d2e('0x2d')](_0x24c89b);}};}function respondWithFilteredResult(_0x2d361b,_0x4f5fbd){return function(_0x35960a){if(_0x35960a){var _0x58e31f=typeof _0x4f5fbd[_0x2d2e('0x2e')]==='undefined'&&typeof _0x4f5fbd['limit']==='undefined';var _0x47af7a=_0x35960a[_0x2d2e('0x2f')];var _0x23e831=_0x58e31f?0x0:_0x4f5fbd[_0x2d2e('0x2e')];var _0x5909c7=_0x58e31f?_0x35960a['count']:_0x4f5fbd[_0x2d2e('0x2e')]+_0x4f5fbd[_0x2d2e('0x30')];var _0x3db84e;if(_0x5909c7>=_0x47af7a){_0x5909c7=_0x47af7a;_0x3db84e=0xc8;}else{_0x3db84e=0xce;}_0x2d361b[_0x2d2e('0x2c')](_0x3db84e);return _0x2d361b[_0x2d2e('0x31')](_0x2d2e('0x32'),_0x23e831+'-'+_0x5909c7+'/'+_0x47af7a)[_0x2d2e('0x2d')](_0x35960a);}return null;};}function patchUpdates(_0x466d40){return function(_0x3ef5ee){try{jsonpatch[_0x2d2e('0x33')](_0x3ef5ee,_0x466d40,!![]);}catch(_0x23ba8b){return BPromise[_0x2d2e('0x34')](_0x23ba8b);}return _0x3ef5ee[_0x2d2e('0x35')]();};}function saveUpdates(_0x38b1f2,_0x1b27ff){return function(_0x5a211c){if(_0x5a211c){return _0x5a211c['update'](_0x38b1f2)[_0x2d2e('0x1e')](function(_0x32b644){return _0x32b644;});}return null;};}function removeEntity(_0x105067,_0x1a6428){return function(_0x18d5dc){if(_0x18d5dc){return _0x18d5dc[_0x2d2e('0x36')]()[_0x2d2e('0x1e')](function(){var _0xf745c3=_0x18d5dc[_0x2d2e('0x37')]({'plain':!![]});var _0x5c5f5e=_0x2d2e('0x38');return db['UserProfileResource'][_0x2d2e('0x36')]({'where':{'type':_0x5c5f5e,'resourceId':_0xf745c3['id']}})[_0x2d2e('0x1e')](function(){return _0x18d5dc;});})['then'](function(){_0x105067['status'](0xcc)[_0x2d2e('0x2b')]();});}};}function handleEntityNotFound(_0x5cbb40,_0x55dcd7){return function(_0x437cd6){if(!_0x437cd6){_0x5cbb40[_0x2d2e('0x2a')](0x194);}return _0x437cd6;};}function handleError(_0x4d0b36,_0x3b8664){_0x3b8664=_0x3b8664||0x1f4;return function(_0x3eb9e3){logger['error'](_0x3eb9e3['stack']);if(_0x3eb9e3[_0x2d2e('0x39')]){delete _0x3eb9e3['name'];}_0x4d0b36[_0x2d2e('0x2c')](_0x3b8664)[_0x2d2e('0x3a')](_0x3eb9e3);};}exports[_0x2d2e('0x3b')]=function(_0x1df1a8,_0x4ec41e){var _0x152bec={'include':[{'model':db[_0x2d2e('0x3c')],'as':'mandatoryDispositionPause'}]},_0x538614={},_0x24c95e={'count':0x0,'rows':[]};var _0x3edaac=_[_0x2d2e('0x3d')](db[_0x2d2e('0x3e')][_0x2d2e('0x3f')],function(_0xc932eb){return{'name':_0xc932eb[_0x2d2e('0x40')],'type':_0xc932eb[_0x2d2e('0x41')][_0x2d2e('0x42')]};});_0x538614[_0x2d2e('0x43')]=_[_0x2d2e('0x3d')](_0x3edaac,_0x2d2e('0x39'));_0x538614[_0x2d2e('0x44')]=_['keys'](_0x1df1a8[_0x2d2e('0x44')]);_0x538614['filters']=_['intersection'](_0x538614[_0x2d2e('0x43')],_0x538614[_0x2d2e('0x44')]);_0x152bec[_0x2d2e('0x45')]=_[_0x2d2e('0x46')](_0x538614['model'],qs[_0x2d2e('0x47')](_0x1df1a8[_0x2d2e('0x44')][_0x2d2e('0x47')]));_0x152bec[_0x2d2e('0x45')]=_0x152bec['attributes']['length']?_0x152bec[_0x2d2e('0x45')]:_0x538614[_0x2d2e('0x43')];if(!_0x1df1a8['query']['hasOwnProperty'](_0x2d2e('0x48'))){_0x152bec['limit']=qs[_0x2d2e('0x30')](_0x1df1a8['query'][_0x2d2e('0x30')]);_0x152bec[_0x2d2e('0x2e')]=qs[_0x2d2e('0x2e')](_0x1df1a8['query'][_0x2d2e('0x2e')]);}_0x152bec[_0x2d2e('0x49')]=qs[_0x2d2e('0x4a')](_0x1df1a8[_0x2d2e('0x44')][_0x2d2e('0x4a')]);_0x152bec[_0x2d2e('0x4b')]=qs[_0x2d2e('0x4c')](_[_0x2d2e('0x4d')](_0x1df1a8[_0x2d2e('0x44')],_0x538614[_0x2d2e('0x4c')]),_0x3edaac);if(_0x1df1a8[_0x2d2e('0x44')][_0x2d2e('0x4e')]){_0x152bec[_0x2d2e('0x4b')]=_[_0x2d2e('0x4f')](_0x152bec[_0x2d2e('0x4b')],{'$or':_[_0x2d2e('0x3d')](_0x3edaac,function(_0x387392){if(_0x387392[_0x2d2e('0x41')]!=='VIRTUAL'){var _0x5601ab={};_0x5601ab[_0x387392[_0x2d2e('0x39')]]={'$like':'%'+_0x1df1a8[_0x2d2e('0x44')]['filter']+'%'};return _0x5601ab;}})});}_0x152bec=_[_0x2d2e('0x4f')]({},_0x152bec,_0x1df1a8['options']);var _0x1e3ff2={'where':_0x152bec['where']};return db[_0x2d2e('0x3e')][_0x2d2e('0x2f')](_0x1e3ff2)[_0x2d2e('0x1e')](function(_0xeb0975){_0x24c95e[_0x2d2e('0x2f')]=_0xeb0975;if(_0x1df1a8[_0x2d2e('0x44')][_0x2d2e('0x50')]){_0x152bec[_0x2d2e('0x51')]=[{'all':!![]}];}return db[_0x2d2e('0x3e')]['findAll'](_0x152bec);})[_0x2d2e('0x1e')](function(_0x5f310f){_0x24c95e[_0x2d2e('0x52')]=_0x5f310f;return _0x24c95e;})[_0x2d2e('0x1e')](respondWithFilteredResult(_0x4ec41e,_0x152bec))[_0x2d2e('0x29')](handleError(_0x4ec41e,null));};exports[_0x2d2e('0x53')]=function(_0x56abe6,_0x3e05c8){var _0x163fa9={'raw':![],'where':{'id':_0x56abe6[_0x2d2e('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x2d2e('0x55')}]},_0x1e2723={};_0x1e2723[_0x2d2e('0x43')]=_['keys'](db[_0x2d2e('0x3e')][_0x2d2e('0x3f')]);_0x1e2723[_0x2d2e('0x44')]=_[_0x2d2e('0x56')](_0x56abe6[_0x2d2e('0x44')]);_0x1e2723['filters']=_[_0x2d2e('0x46')](_0x1e2723[_0x2d2e('0x43')],_0x1e2723[_0x2d2e('0x44')]);_0x163fa9['attributes']=_[_0x2d2e('0x46')](_0x1e2723['model'],qs[_0x2d2e('0x47')](_0x56abe6[_0x2d2e('0x44')][_0x2d2e('0x47')]));_0x163fa9[_0x2d2e('0x45')]=_0x163fa9['attributes'][_0x2d2e('0x57')]?_0x163fa9[_0x2d2e('0x45')]:_0x1e2723[_0x2d2e('0x43')];if(_0x56abe6['query'][_0x2d2e('0x50')]){_0x163fa9[_0x2d2e('0x51')]=[{'all':!![]}];}_0x163fa9=_[_0x2d2e('0x4f')]({},_0x163fa9,_0x56abe6[_0x2d2e('0x58')]);return db[_0x2d2e('0x3e')]['find'](_0x163fa9)[_0x2d2e('0x1e')](handleEntityNotFound(_0x3e05c8,null))['then'](respondWithResult(_0x3e05c8,null))[_0x2d2e('0x29')](handleError(_0x3e05c8,null));};exports[_0x2d2e('0x59')]=function(_0x293efa,_0x1ee544){return db[_0x2d2e('0x3e')]['create'](_0x293efa['body'],{})['then'](function(_0x4f6cc1){var _0x75daa7=_0x293efa[_0x2d2e('0x5a')][_0x2d2e('0x37')]({'plain':!![]});if(!_0x75daa7)throw new Error(_0x2d2e('0x5b'));if(_0x75daa7[_0x2d2e('0x5c')]===_0x2d2e('0x5a')){var _0x1d48ce=_0x4f6cc1[_0x2d2e('0x37')]({'plain':!![]});var _0x13ab5a='OpenchannelAccounts';return db[_0x2d2e('0x5d')][_0x2d2e('0x5e')]({'where':{'name':_0x13ab5a,'userProfileId':_0x75daa7[_0x2d2e('0x5f')]},'raw':!![]})['then'](function(_0x380226){if(_0x380226&&_0x380226[_0x2d2e('0x60')]===0x0){return db[_0x2d2e('0x61')][_0x2d2e('0x59')]({'name':_0x1d48ce['name'],'resourceId':_0x1d48ce['id'],'type':_0x380226['name'],'sectionId':_0x380226['id']},{})['then'](function(){return _0x4f6cc1;});}else{return _0x4f6cc1;}})[_0x2d2e('0x29')](function(_0x3b7f54){logger[_0x2d2e('0x24')](_0x2d2e('0x62'),_0x3b7f54);throw _0x3b7f54;});}return _0x4f6cc1;})[_0x2d2e('0x1e')](respondWithResult(_0x1ee544,0xc9))[_0x2d2e('0x29')](handleError(_0x1ee544,null));};exports[_0x2d2e('0x63')]=function(_0x2a5a92,_0xa7d3c6){if(_0x2a5a92[_0x2d2e('0x64')]['id']){delete _0x2a5a92['body']['id'];}return db[_0x2d2e('0x3e')][_0x2d2e('0x5e')]({'where':{'id':_0x2a5a92[_0x2d2e('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x2d2e('0x55')}]})['then'](handleEntityNotFound(_0xa7d3c6,null))[_0x2d2e('0x1e')](saveUpdates(_0x2a5a92[_0x2d2e('0x64')],null))[_0x2d2e('0x1e')](respondWithResult(_0xa7d3c6,null))['catch'](handleError(_0xa7d3c6,null));};exports['destroy']=function(_0x5b7430,_0x4ea504){return db['OpenchannelAccount']['find']({'where':{'id':_0x5b7430[_0x2d2e('0x54')]['id']}})['then'](handleEntityNotFound(_0x4ea504,null))[_0x2d2e('0x1e')](removeEntity(_0x4ea504,null))[_0x2d2e('0x29')](handleError(_0x4ea504,null));};exports['describe']=function(_0x2d8d2d,_0x244878){return db[_0x2d2e('0x3e')][_0x2d2e('0x65')]()[_0x2d2e('0x1e')](respondWithResult(_0x244878,null))[_0x2d2e('0x29')](handleError(_0x244878,null));};exports['addDisposition']=function(_0x1d2127,_0x35179a,_0x21dda0){if(_0x1d2127[_0x2d2e('0x64')]['id']){delete _0x1d2127[_0x2d2e('0x64')]['id'];}return db[_0x2d2e('0x3e')][_0x2d2e('0x5e')]({'where':{'id':_0x1d2127['params']['id']}})['then'](handleEntityNotFound(_0x35179a,null))['then'](function(_0x4afae6){if(_0x4afae6){_0x1d2127[_0x2d2e('0x64')][_0x2d2e('0x66')]=_0x4afae6['id'];return db[_0x2d2e('0x67')][_0x2d2e('0x59')](_0x1d2127[_0x2d2e('0x64')]);}})[_0x2d2e('0x1e')](respondWithResult(_0x35179a,null))[_0x2d2e('0x29')](handleError(_0x35179a,null));};exports[_0x2d2e('0x68')]=function(_0x22dc2b,_0x3a339d,_0x5bad4a){var _0x11f0bd={'raw':![],'where':{}};var _0x112e02={};var _0x280d50={'count':0x0,'rows':[]};return db[_0x2d2e('0x3e')]['findOne']({'where':{'id':_0x22dc2b[_0x2d2e('0x54')]['id']}})[_0x2d2e('0x1e')](handleEntityNotFound(_0x3a339d,null))['then'](function(_0x3d228c){if(_0x3d228c){_0x112e02['model']=_['keys'](db[_0x2d2e('0x67')][_0x2d2e('0x3f')]);_0x112e02['query']=_[_0x2d2e('0x56')](_0x22dc2b['query']);_0x112e02[_0x2d2e('0x4c')]=_['intersection'](_0x112e02[_0x2d2e('0x43')],_0x112e02[_0x2d2e('0x44')]);_0x11f0bd[_0x2d2e('0x45')]=_[_0x2d2e('0x46')](_0x112e02[_0x2d2e('0x43')],qs[_0x2d2e('0x47')](_0x22dc2b[_0x2d2e('0x44')]['fields']));_0x11f0bd[_0x2d2e('0x45')]=_0x11f0bd[_0x2d2e('0x45')]['length']?_0x11f0bd[_0x2d2e('0x45')]:_0x112e02[_0x2d2e('0x43')];if(!_0x22dc2b[_0x2d2e('0x44')]['hasOwnProperty'](_0x2d2e('0x48'))){_0x11f0bd[_0x2d2e('0x30')]=qs['limit'](_0x22dc2b['query']['limit']);_0x11f0bd[_0x2d2e('0x2e')]=qs[_0x2d2e('0x2e')](_0x22dc2b[_0x2d2e('0x44')][_0x2d2e('0x2e')]);}_0x11f0bd[_0x2d2e('0x49')]=qs['sort'](_0x22dc2b[_0x2d2e('0x44')][_0x2d2e('0x4a')]);_0x11f0bd[_0x2d2e('0x4b')]=qs[_0x2d2e('0x4c')](_['pick'](_0x22dc2b['query'],_0x112e02['filters']));_0x11f0bd[_0x2d2e('0x4b')]['OpenchannelAccountId']=_0x3d228c['id'];if(_0x22dc2b[_0x2d2e('0x44')][_0x2d2e('0x4e')]){_0x11f0bd[_0x2d2e('0x4b')]=_[_0x2d2e('0x4f')](_0x11f0bd[_0x2d2e('0x4b')],{'$or':_[_0x2d2e('0x3d')](_0x11f0bd[_0x2d2e('0x45')],function(_0x257f11){var _0x536c4d={};_0x536c4d[_0x257f11]={'$like':'%'+_0x22dc2b[_0x2d2e('0x44')]['filter']+'%'};return _0x536c4d;})});}_0x11f0bd=_['merge']({},_0x11f0bd,_0x22dc2b[_0x2d2e('0x58')]);return db['Disposition']['count']({'where':_0x11f0bd[_0x2d2e('0x4b')]})[_0x2d2e('0x1e')](function(_0x8a2ba8){_0x280d50[_0x2d2e('0x2f')]=_0x8a2ba8;if(_0x22dc2b[_0x2d2e('0x44')]['includeAll']){_0x11f0bd[_0x2d2e('0x51')]=[{'all':!![]}];}return db[_0x2d2e('0x67')][_0x2d2e('0x69')](_0x11f0bd);})[_0x2d2e('0x1e')](function(_0x23e362){_0x280d50[_0x2d2e('0x52')]=_0x23e362;return _0x280d50;});}})[_0x2d2e('0x1e')](respondWithFilteredResult(_0x3a339d,_0x11f0bd))[_0x2d2e('0x29')](handleError(_0x3a339d,null));};exports[_0x2d2e('0x6a')]=function(_0x57b1c8,_0x550f32,_0xe4188a){return db['OpenchannelAccount'][_0x2d2e('0x5e')]({'where':{'id':_0x57b1c8['params']['id']}})[_0x2d2e('0x1e')](handleEntityNotFound(_0x550f32,null))[_0x2d2e('0x1e')](function(_0x28fd2e){if(_0x28fd2e){return _0x28fd2e[_0x2d2e('0x6a')](_0x57b1c8['query']['ids']);}})['then'](respondWithStatusCode(_0x550f32,null))[_0x2d2e('0x29')](handleError(_0x550f32,null));};exports[_0x2d2e('0x6b')]=function(_0x51800a,_0x14c385,_0x3e7edc){if(_0x51800a[_0x2d2e('0x64')]['id']){delete _0x51800a[_0x2d2e('0x64')]['id'];}return db['OpenchannelAccount'][_0x2d2e('0x5e')]({'where':{'id':_0x51800a[_0x2d2e('0x54')]['id']}})['then'](handleEntityNotFound(_0x14c385,null))[_0x2d2e('0x1e')](function(_0x3a6d05){if(_0x3a6d05){_0x51800a[_0x2d2e('0x64')][_0x2d2e('0x66')]=_0x3a6d05['id'];return db[_0x2d2e('0x6c')][_0x2d2e('0x59')](_0x51800a[_0x2d2e('0x64')]);}})[_0x2d2e('0x1e')](respondWithResult(_0x14c385,null))[_0x2d2e('0x29')](handleError(_0x14c385,null));};exports['getAnswers']=function(_0x4e8b3a,_0x1d4cca,_0x11200e){var _0x5b0b11={'raw':![],'where':{}};var _0x50db42={};var _0xc9f159={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x2d2e('0x6d')]({'where':{'id':_0x4e8b3a[_0x2d2e('0x54')]['id']}})['then'](handleEntityNotFound(_0x1d4cca,null))[_0x2d2e('0x1e')](function(_0x77c620){if(_0x77c620){_0x50db42[_0x2d2e('0x43')]=_['keys'](db[_0x2d2e('0x6c')][_0x2d2e('0x3f')]);_0x50db42[_0x2d2e('0x44')]=_[_0x2d2e('0x56')](_0x4e8b3a[_0x2d2e('0x44')]);_0x50db42['filters']=_[_0x2d2e('0x46')](_0x50db42[_0x2d2e('0x43')],_0x50db42[_0x2d2e('0x44')]);_0x5b0b11['attributes']=_[_0x2d2e('0x46')](_0x50db42[_0x2d2e('0x43')],qs[_0x2d2e('0x47')](_0x4e8b3a[_0x2d2e('0x44')][_0x2d2e('0x47')]));_0x5b0b11[_0x2d2e('0x45')]=_0x5b0b11[_0x2d2e('0x45')][_0x2d2e('0x57')]?_0x5b0b11['attributes']:_0x50db42[_0x2d2e('0x43')];if(!_0x4e8b3a[_0x2d2e('0x44')][_0x2d2e('0x6e')]('nolimit')){_0x5b0b11[_0x2d2e('0x30')]=qs[_0x2d2e('0x30')](_0x4e8b3a['query']['limit']);_0x5b0b11[_0x2d2e('0x2e')]=qs['offset'](_0x4e8b3a['query'][_0x2d2e('0x2e')]);}_0x5b0b11['order']=qs['sort'](_0x4e8b3a[_0x2d2e('0x44')][_0x2d2e('0x4a')]);_0x5b0b11[_0x2d2e('0x4b')]=qs[_0x2d2e('0x4c')](_[_0x2d2e('0x4d')](_0x4e8b3a['query'],_0x50db42['filters']));_0x5b0b11[_0x2d2e('0x4b')][_0x2d2e('0x66')]=_0x77c620['id'];if(_0x4e8b3a['query'][_0x2d2e('0x4e')]){_0x5b0b11[_0x2d2e('0x4b')]=_[_0x2d2e('0x4f')](_0x5b0b11[_0x2d2e('0x4b')],{'$or':_[_0x2d2e('0x3d')](_0x5b0b11['attributes'],function(_0x4fc4bd){var _0x1a7779={};_0x1a7779[_0x4fc4bd]={'$like':'%'+_0x4e8b3a['query'][_0x2d2e('0x4e')]+'%'};return _0x1a7779;})});}_0x5b0b11=_[_0x2d2e('0x4f')]({},_0x5b0b11,_0x4e8b3a['options']);return db[_0x2d2e('0x6c')][_0x2d2e('0x2f')]({'where':_0x5b0b11[_0x2d2e('0x4b')]})['then'](function(_0xc6b69d){_0xc9f159[_0x2d2e('0x2f')]=_0xc6b69d;if(_0x4e8b3a[_0x2d2e('0x44')][_0x2d2e('0x50')]){_0x5b0b11[_0x2d2e('0x51')]=[{'all':!![]}];}return db[_0x2d2e('0x6c')][_0x2d2e('0x69')](_0x5b0b11);})[_0x2d2e('0x1e')](function(_0x398bfe){_0xc9f159[_0x2d2e('0x52')]=_0x398bfe;return _0xc9f159;});}})['then'](respondWithFilteredResult(_0x1d4cca,_0x5b0b11))[_0x2d2e('0x29')](handleError(_0x1d4cca,null));};exports[_0x2d2e('0x6f')]=function(_0x2d12a1,_0x1458ea,_0xa218c8){return db[_0x2d2e('0x3e')]['find']({'where':{'id':_0x2d12a1[_0x2d2e('0x54')]['id']}})[_0x2d2e('0x1e')](handleEntityNotFound(_0x1458ea,null))[_0x2d2e('0x1e')](function(_0x1eae09){if(_0x1eae09){return _0x1eae09[_0x2d2e('0x6f')](_0x2d12a1['query'][_0x2d2e('0x70')]);}})[_0x2d2e('0x1e')](respondWithStatusCode(_0x1458ea,null))[_0x2d2e('0x29')](handleError(_0x1458ea,null));};exports[_0x2d2e('0x71')]=function(_0xfce18a,_0x2517c8,_0x17bdf5){var _0x212d5c={'body':_0xfce18a['body'],'channel':_0x2d2e('0x72')};var _0x54478c=[];var _0x198946=[];var _0x3199b1={};var _0x5acc18=![];return db[_0x2d2e('0x73')]['describe']()[_0x2d2e('0x1e')](function(_0x8904f5){if(!_0x8904f5){throw new db[(_0x2d2e('0x74'))]['ValidationError'](_0x2d2e('0x75'));}_0x54478c=_[_0x2d2e('0x76')](_[_0x2d2e('0x56')](_0x8904f5),[_0x2d2e('0x77'),_0x2d2e('0x78')]);_0x198946=_['difference'](_['keys'](_0x8904f5),[_0x2d2e('0x77'),'updatedAt',_0x2d2e('0x79'),_0x2d2e('0x7a')]);if(_0xfce18a['body']['id']){delete _0xfce18a[_0x2d2e('0x64')]['id'];}if(_['isNil'](_0xfce18a['body'][_0x2d2e('0x7b')])){throw new db[(_0x2d2e('0x74'))][(_0x2d2e('0x7c'))](_0x2d2e('0x7d'));}if(_['isNil'](_0xfce18a[_0x2d2e('0x64')][_0x2d2e('0x64')])||_0xfce18a[_0x2d2e('0x64')][_0x2d2e('0x64')]===''){throw new db['Sequelize'][(_0x2d2e('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2d2e('0x7e')](_0xfce18a[_0x2d2e('0x64')][_0x2d2e('0x7f')])){throw new db[(_0x2d2e('0x74'))][(_0x2d2e('0x7c'))](_0x2d2e('0x80')+_0x198946);}if(!_[_0x2d2e('0x81')](_0x198946,_0xfce18a[_0x2d2e('0x64')][_0x2d2e('0x7f')])){throw new db[(_0x2d2e('0x74'))][(_0x2d2e('0x7c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x198946);}_0x3199b1[_0xfce18a[_0x2d2e('0x64')]['mapKey']]=_0xfce18a['body'][_0x2d2e('0x7b')];})[_0x2d2e('0x1e')](function(){return db['OpenchannelAccount'][_0x2d2e('0x5e')]({'where':{'id':_0xfce18a[_0x2d2e('0x54')]['id']},'include':[{'model':db[_0x2d2e('0x82')],'as':_0x2d2e('0x83'),'include':[{'model':db['CmContact'],'as':_0x2d2e('0x84'),'where':_0x3199b1,'limit':0x1,'order':[[_0x2d2e('0x78'),_0x2d2e('0x85')]]}]},{'model':db[_0x2d2e('0x86')],'as':_0x2d2e('0x87')}]});})[_0x2d2e('0x1e')](handleEntityNotFound(_0x2517c8,null))[_0x2d2e('0x1e')](function(_0x2381a0){if(_0x2381a0&&_0x2381a0['List']){_0x212d5c[_0x2d2e('0x88')]=_0x2381a0;_0x212d5c['applications']=_0x2381a0[_0x2d2e('0x87')];_0x212d5c[_0x2d2e('0x89')]=_0x2381a0['List'];_0x212d5c['applications']=_[_0x2d2e('0x8a')](_0x212d5c[_0x2d2e('0x8b')],['priority'],[_0x2d2e('0x8c')]);if(_0x212d5c['account'][_0x2d2e('0x87')]){delete _0x212d5c['account']['Applications'];}if(_0x212d5c['account'][_0x2d2e('0x83')]&&_0x212d5c['account'][_0x2d2e('0x83')]['Contacts'][_0x2d2e('0x57')]){return _0x212d5c[_0x2d2e('0x88')][_0x2d2e('0x83')][_0x2d2e('0x84')][0x0];}var _0xe0d8e3=_[_0x2d2e('0x16')](_0xfce18a[_0x2d2e('0x64')],{'firstName':_0xfce18a[_0x2d2e('0x64')][_0x2d2e('0x7b')],'ListId':_0x2381a0['ListId']});_0xe0d8e3[_0xfce18a[_0x2d2e('0x64')]['mapKey']]=_0xfce18a[_0x2d2e('0x64')][_0x2d2e('0x7b')];return db['CmContact']['create'](_0xe0d8e3,{'fields':_0x54478c,'raw':!![]});}})[_0x2d2e('0x1e')](handleEntityNotFound(_0x2517c8,null))[_0x2d2e('0x1e')](function(_0x26e6a9){_0x212d5c['contact']=_0x26e6a9;if(_0x26e6a9){var _0x568f93={'ContactId':_0x26e6a9['id'],'OpenchannelAccountId':_0xfce18a[_0x2d2e('0x54')]['id'],'from':(_0x26e6a9[_0x2d2e('0x8d')]||'')+'\x20'+(_0x26e6a9[_0x2d2e('0x8e')]||'')};var _0x28eccb={'OpenchannelAccountId':_0xfce18a[_0x2d2e('0x54')]['id'],'closed':![]};if(_0xfce18a['body']['threadId']){_0x28eccb[_0x2d2e('0x8f')]=_0xfce18a[_0x2d2e('0x64')]['threadId'];return db['OpenchannelInteraction'][_0x2d2e('0x5e')]({'where':_0x28eccb})[_0x2d2e('0x1e')](function(_0x325998){if(_0x325998){return[_0x325998,![]];}_0x568f93['threadId']=_0xfce18a[_0x2d2e('0x64')][_0x2d2e('0x8f')];_0x568f93['externalUrl']=_0xfce18a[_0x2d2e('0x64')][_0x2d2e('0x90')];return db['OpenchannelInteraction'][_0x2d2e('0x59')](_0x568f93)[_0x2d2e('0x1e')](function(_0x34e334){return[_0x34e334,!![]];});});}else{_0x28eccb[_0x2d2e('0x8f')]=null;}_0x28eccb[_0x2d2e('0x91')]=_0x26e6a9['id'];return db[_0x2d2e('0x92')][_0x2d2e('0x5e')]({'where':_0x28eccb})[_0x2d2e('0x1e')](function(_0x4b715b){if(_0x4b715b){return[_0x4b715b,![]];}return db['OpenchannelInteraction'][_0x2d2e('0x59')](_0x568f93)['then'](function(_0x5bd99f){return[_0x5bd99f,!![]];});});}})[_0x2d2e('0x93')](function(_0xe0daae,_0x4ba3dd){if(_0xe0daae){_0x5acc18=_0x4ba3dd;if(!_0x4ba3dd){var _0x509384={'from':(_0x212d5c[_0x2d2e('0x94')][_0x2d2e('0x8d')]||'')+'\x20'+(_0x212d5c[_0x2d2e('0x94')][_0x2d2e('0x8e')]||'')};if(_0xfce18a['body'][_0x2d2e('0x8f')]&&_0xfce18a[_0x2d2e('0x64')][_0x2d2e('0x95')]&&_0xfce18a['body'][_0x2d2e('0x8f')]!=_0xfce18a[_0x2d2e('0x64')][_0x2d2e('0x95')]){_0x509384[_0x2d2e('0x8f')]=_0xfce18a[_0x2d2e('0x64')][_0x2d2e('0x95')];}return _0xe0daae['update'](_0x509384);}else{return _0xe0daae;}}})[_0x2d2e('0x1e')](function(_0x740ce6){_0x212d5c[_0x2d2e('0x96')]=_0x740ce6[_0x2d2e('0x37')]({'plain':!![]});_0x212d5c['interaction']['created']=_0x5acc18;if(_0x212d5c[_0x2d2e('0x96')][_0x2d2e('0x97')]){if(_0x212d5c[_0x2d2e('0x88')]['autoclose']){_0x212d5c[_0x2d2e('0x8b')][_0x2d2e('0x98')]({'id':0x0,'priority':_0x212d5c[_0x2d2e('0x8b')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x2d2e('0x99')][_0x2d2e('0x59')]({'body':_0xfce18a['body'][_0x2d2e('0x64')],'OpenchannelAccountId':_0xfce18a['params']['id'],'OpenchannelInteractionId':_0x740ce6['id'],'direction':'in','ContactId':_0x212d5c[_0x2d2e('0x94')]['id'],'AttachmentId':_0xfce18a[_0x2d2e('0x64')][_0x2d2e('0x9a')]});})[_0x2d2e('0x1e')](function(_0x1fc237){_0x212d5c[_0x2d2e('0x26')]=_0x1fc237;if(_0x212d5c[_0x2d2e('0x96')][_0x2d2e('0x9b')]){return db[_0x2d2e('0x9c')][_0x2d2e('0x5e')]({'attributes':['id',_0x2d2e('0x39')],'where':{'id':_0x212d5c[_0x2d2e('0x96')][_0x2d2e('0x9b')]}})['then'](function(_0x44f5e3){if(_0x44f5e3){_0x212d5c[_0x2d2e('0x8b')][_0x2d2e('0x9d')]({'id':0x0,'priority':0x0,'app':_0x2d2e('0x9e'),'appdata':_0x44f5e3['name']+','+(_0x212d5c[_0x2d2e('0x88')][_0x2d2e('0x9f')]||0xa),'interval':_0x2d2e('0xa0')});_0x212d5c[_0x2d2e('0xa1')]=![];}return respondWithRpcPromise(_0x2d2e('0xa2'),_0x2d2e('0xa3'),_0x212d5c);});}return respondWithRpcPromise(_0x2d2e('0xa2'),_0x2d2e('0xa3'),_0x212d5c);})[_0x2d2e('0x1e')](function(_0x2ded60){respondWithRpcPromise(_0x2d2e('0xa4'),'EventManager',{'event':_0x2d2e('0x71'),'message':_0x2ded60},client9002);return _0x2ded60;})[_0x2d2e('0x1e')](respondWithResult(_0x2517c8,null))['catch'](handleError(_0x2517c8,null));};exports['addApplications']=function(_0x41ed93,_0x1f51a2){var _0x9b5df6=_0x41ed93['params']['id'];var _0x5c205f=_0x41ed93[_0x2d2e('0x64')];var _0x29256e=0xc8;var _0x2d9a52=null;return db['sequelize'][_0x2d2e('0xa5')]({'isolationLevel':db[_0x2d2e('0xa6')][_0x2d2e('0xa7')][_0x2d2e('0xa8')][_0x2d2e('0xa9')]},function(_0x4f424e){return db[_0x2d2e('0x3e')][_0x2d2e('0x6d')]({'where':{'id':_0x9b5df6},'transaction':_0x4f424e})[_0x2d2e('0x1e')](function(_0x1278d7){if(_0x1278d7){return db[_0x2d2e('0x86')][_0x2d2e('0x36')]({'where':{'OpenchannelAccountId':_0x9b5df6},'transaction':_0x4f424e})[_0x2d2e('0x1e')](function(){var _0x4d91fe=_[_0x2d2e('0x3d')](_0x5c205f,function(_0x69a96b){_0x69a96b['OpenchannelAccountId']=_0x9b5df6;return _0x69a96b;});return db['OpenchannelApplication']['bulkCreate'](_0x4d91fe,{'transaction':_0x4f424e});});}else{_0x29256e=0x194;_0x2d9a52=[];}});})[_0x2d2e('0x1e')](function(){if(_0x29256e!==0x194){return db[_0x2d2e('0x86')][_0x2d2e('0xaa')]({'where':{'OpenchannelAccountId':_0x9b5df6},'order':_0x2d2e('0xab')})[_0x2d2e('0x1e')](function(_0x42c609){_0x2d9a52=_0x42c609;});}})[_0x2d2e('0x29')](function(_0x5be22){_0x29256e=0x1f4;logger[_0x2d2e('0x24')](_0x5be22[_0x2d2e('0xac')]);if(_0x5be22[_0x2d2e('0x39')]){delete _0x5be22[_0x2d2e('0x39')];}_0x2d9a52=_0x5be22;})['finally'](function(){if(_0x2d9a52===null){_0x1f51a2['sendStatus'](_0x29256e);}else{if(_0x29256e===0x1f4){_0x1f51a2[_0x2d2e('0x2c')](_0x29256e)[_0x2d2e('0x3a')](_0x2d9a52);}else{_0x1f51a2[_0x2d2e('0x2c')](_0x29256e)[_0x2d2e('0x2d')](_0x2d9a52);}}});};exports[_0x2d2e('0xad')]=function(_0x7280ab,_0x21dfa9,_0x39c547){var _0x36a8c2={};var _0x25e05d={};var _0x252db5;var _0x23b380;return db[_0x2d2e('0x3e')]['findOne']({'where':{'id':_0x7280ab['params']['id']}})['then'](handleEntityNotFound(_0x21dfa9,null))[_0x2d2e('0x1e')](function(_0x9aa3a8){if(_0x9aa3a8){_0x252db5=_0x9aa3a8;_0x25e05d['model']=_[_0x2d2e('0x56')](db[_0x2d2e('0x86')][_0x2d2e('0x3f')]);_0x25e05d[_0x2d2e('0x44')]=_[_0x2d2e('0x56')](_0x7280ab[_0x2d2e('0x44')]);_0x25e05d[_0x2d2e('0x4c')]=_[_0x2d2e('0x46')](_0x25e05d[_0x2d2e('0x43')],_0x25e05d[_0x2d2e('0x44')]);_0x36a8c2[_0x2d2e('0x45')]=_[_0x2d2e('0x46')](_0x25e05d[_0x2d2e('0x43')],qs['fields'](_0x7280ab['query'][_0x2d2e('0x47')]));_0x36a8c2['attributes']=_0x36a8c2[_0x2d2e('0x45')][_0x2d2e('0x57')]?_0x36a8c2[_0x2d2e('0x45')]:_0x25e05d['model'];_0x36a8c2[_0x2d2e('0x49')]=qs[_0x2d2e('0x4a')](_0x7280ab[_0x2d2e('0x44')][_0x2d2e('0x4a')]);_0x36a8c2['where']=qs[_0x2d2e('0x4c')](_[_0x2d2e('0x4d')](_0x7280ab['query'],_0x25e05d[_0x2d2e('0x4c')]));if(_0x7280ab[_0x2d2e('0x44')][_0x2d2e('0x4e')]){_0x36a8c2[_0x2d2e('0x4b')]=_['merge'](_0x36a8c2[_0x2d2e('0x4b')],{'$or':_[_0x2d2e('0x3d')](_0x36a8c2[_0x2d2e('0x45')],function(_0x46a4cf){var _0x4cc546={};_0x4cc546[_0x46a4cf]={'$like':'%'+_0x7280ab['query'][_0x2d2e('0x4e')]+'%'};return _0x4cc546;})});}_0x36a8c2=_['merge']({},_0x36a8c2,_0x7280ab[_0x2d2e('0x58')]);return _0x252db5[_0x2d2e('0xad')](_0x36a8c2);}})['then'](function(_0x1e3c04){if(_0x1e3c04){_0x23b380=_0x1e3c04[_0x2d2e('0x57')];if(!_0x7280ab[_0x2d2e('0x44')]['hasOwnProperty'](_0x2d2e('0x48'))){_0x36a8c2['limit']=qs[_0x2d2e('0x30')](_0x7280ab[_0x2d2e('0x44')][_0x2d2e('0x30')]);_0x36a8c2[_0x2d2e('0x2e')]=qs[_0x2d2e('0x2e')](_0x7280ab[_0x2d2e('0x44')][_0x2d2e('0x2e')]);}return _0x252db5[_0x2d2e('0xad')](_0x36a8c2);}})[_0x2d2e('0x1e')](function(_0x5e52c1){if(_0x5e52c1){return _0x5e52c1?{'count':_0x23b380,'rows':_0x5e52c1}:null;}})['then'](respondWithResult(_0x21dfa9,null))['catch'](handleError(_0x21dfa9,null));};exports[_0x2d2e('0xae')]=function(_0x4f4d95,_0x3e1d4a,_0x2d70cb){var _0x49cfa7={'raw':![],'where':{}};var _0x1b3f78={};var _0x46a1ea={'count':0x0,'rows':[]};return db[_0x2d2e('0x3e')][_0x2d2e('0x6d')]({'where':{'id':_0x4f4d95['params']['id']}})[_0x2d2e('0x1e')](handleEntityNotFound(_0x3e1d4a,null))[_0x2d2e('0x1e')](function(_0x340c6b){if(_0x340c6b){_0x1b3f78['model']=_[_0x2d2e('0x56')](db['OpenchannelInteraction']['rawAttributes']);_0x1b3f78[_0x2d2e('0x44')]=_[_0x2d2e('0x56')](_0x4f4d95[_0x2d2e('0x44')]);_0x1b3f78['filters']=_[_0x2d2e('0x46')](_0x1b3f78[_0x2d2e('0x43')],_0x1b3f78[_0x2d2e('0x44')]);_0x49cfa7[_0x2d2e('0x45')]=_[_0x2d2e('0x46')](_0x1b3f78[_0x2d2e('0x43')],qs[_0x2d2e('0x47')](_0x4f4d95[_0x2d2e('0x44')][_0x2d2e('0x47')]));_0x49cfa7[_0x2d2e('0x45')]=_0x49cfa7['attributes'][_0x2d2e('0x57')]?_0x49cfa7['attributes']:_0x1b3f78[_0x2d2e('0x43')];if(!_0x4f4d95[_0x2d2e('0x44')][_0x2d2e('0x6e')](_0x2d2e('0x48'))){_0x49cfa7[_0x2d2e('0x30')]=qs['limit'](_0x4f4d95[_0x2d2e('0x44')]['limit']);_0x49cfa7['offset']=qs[_0x2d2e('0x2e')](_0x4f4d95['query'][_0x2d2e('0x2e')]);}_0x49cfa7[_0x2d2e('0x49')]=qs[_0x2d2e('0x4a')](_0x4f4d95[_0x2d2e('0x44')][_0x2d2e('0x4a')]);_0x49cfa7[_0x2d2e('0x4b')]=qs[_0x2d2e('0x4c')](_[_0x2d2e('0x4d')](_0x4f4d95[_0x2d2e('0x44')],_0x1b3f78[_0x2d2e('0x4c')]));_0x49cfa7[_0x2d2e('0x4b')][_0x2d2e('0x66')]=_0x340c6b['id'];if(_0x4f4d95[_0x2d2e('0x44')]['filter']){_0x49cfa7[_0x2d2e('0x4b')]=_[_0x2d2e('0x4f')](_0x49cfa7[_0x2d2e('0x4b')],{'$or':_[_0x2d2e('0x3d')](_0x49cfa7[_0x2d2e('0x45')],function(_0x3b4a6c){var _0x49b4fe={};_0x49b4fe[_0x3b4a6c]={'$like':'%'+_0x4f4d95[_0x2d2e('0x44')]['filter']+'%'};return _0x49b4fe;})});}_0x49cfa7=_[_0x2d2e('0x4f')]({},_0x49cfa7,_0x4f4d95[_0x2d2e('0x58')]);return db[_0x2d2e('0x92')]['count']({'where':_0x49cfa7['where']})['then'](function(_0x5800ed){_0x46a1ea['count']=_0x5800ed;if(_0x4f4d95[_0x2d2e('0x44')][_0x2d2e('0x50')]){_0x49cfa7[_0x2d2e('0x51')]=[{'model':db['CmContact'],'as':_0x2d2e('0xaf'),'required':![]},{'model':db['User'],'as':_0x2d2e('0xb0'),'attributes':['name',_0x2d2e('0xb1'),'internal'],'required':![]},{'model':db[_0x2d2e('0xb2')],'as':'Tags','attributes':['id',_0x2d2e('0x39'),_0x2d2e('0xb3')],'where':_0x4f4d95[_0x2d2e('0x44')][_0x2d2e('0xb4')]?{'id':_0x4f4d95[_0x2d2e('0x44')][_0x2d2e('0xb4')]}:undefined,'required':_0x4f4d95[_0x2d2e('0x44')][_0x2d2e('0xb4')]?!![]:![]}];}return db[_0x2d2e('0x92')][_0x2d2e('0x69')](_0x49cfa7);})[_0x2d2e('0x1e')](function(_0x34be18){_0x46a1ea[_0x2d2e('0x52')]=_0x34be18;return _0x46a1ea;});}})[_0x2d2e('0x1e')](respondWithFilteredResult(_0x3e1d4a,_0x49cfa7))[_0x2d2e('0x29')](handleError(_0x3e1d4a,null));};exports[_0x2d2e('0xb5')]=function(_0x380e25,_0x14734a,_0x1a020b){return db[_0x2d2e('0x3e')]['find']({'where':{'id':_0x380e25[_0x2d2e('0x54')]['id']}})[_0x2d2e('0x1e')](handleEntityNotFound(_0x14734a,null))[_0x2d2e('0x1e')](function(_0x522898){if(_0x522898){return _0x522898['addAgents'](_0x380e25[_0x2d2e('0x64')][_0x2d2e('0x70')],_[_0x2d2e('0xb6')](_0x380e25[_0x2d2e('0x64')],[_0x2d2e('0x70'),'id'])||{})[_0x2d2e('0x93')](function(_0x50c693){for(var _0x28f495=0x0;_0x28f495<_0x380e25[_0x2d2e('0x64')][_0x2d2e('0x70')][_0x2d2e('0x57')];_0x28f495+=0x1){socket[_0x2d2e('0xb7')](_0x2d2e('0xb8'),{'UserId':Number(_0x380e25[_0x2d2e('0x64')][_0x2d2e('0x70')][_0x28f495]),'OpenchannelAccountId':Number(_0x380e25[_0x2d2e('0x54')]['id'])});}return _0x50c693;});}})['then'](respondWithResult(_0x14734a,null))[_0x2d2e('0x29')](handleError(_0x14734a,null));};exports['removeAgents']=function(_0x32c9df,_0x14bd28,_0x5846bc){return db[_0x2d2e('0x3e')][_0x2d2e('0x5e')]({'where':{'id':_0x32c9df[_0x2d2e('0x54')]['id']}})[_0x2d2e('0x1e')](handleEntityNotFound(_0x14bd28,null))['then'](function(_0x28d359){if(_0x28d359){return _0x28d359[_0x2d2e('0xb9')](_0x32c9df[_0x2d2e('0x44')][_0x2d2e('0x70')])['then'](function(){if(_[_0x2d2e('0xba')](_0x32c9df[_0x2d2e('0x44')][_0x2d2e('0x70')])){for(var _0x2502ac=0x0;_0x2502ac<_0x32c9df[_0x2d2e('0x44')][_0x2d2e('0x70')][_0x2d2e('0x57')];_0x2502ac+=0x1){socket[_0x2d2e('0xb7')](_0x2d2e('0xbb'),{'UserId':Number(_0x32c9df['query']['ids'][_0x2502ac]),'OpenchannelAccountId':Number(_0x32c9df[_0x2d2e('0x54')]['id'])});}}else{socket['emit'](_0x2d2e('0xbb'),{'UserId':Number(_0x32c9df[_0x2d2e('0x44')][_0x2d2e('0x70')]),'OpenchannelAccountId':Number(_0x32c9df['params']['id'])});}});}})[_0x2d2e('0x1e')](respondWithStatusCode(_0x14bd28,null))[_0x2d2e('0x29')](handleError(_0x14bd28,null));};exports[_0x2d2e('0xbc')]=function(_0x8866f5,_0x42eafe,_0x22e117){var _0x31713d={};var _0x35b2fe={};var _0x55877d;var _0x2282bd;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x8866f5[_0x2d2e('0x54')]['id']}})[_0x2d2e('0x1e')](handleEntityNotFound(_0x42eafe,null))['then'](function(_0x2f39bf){if(_0x2f39bf){_0x55877d=_0x2f39bf;_0x35b2fe[_0x2d2e('0x43')]=_[_0x2d2e('0x56')](db[_0x2d2e('0x9c')][_0x2d2e('0x3f')]);_0x35b2fe[_0x2d2e('0x44')]=_['keys'](_0x8866f5[_0x2d2e('0x44')]);_0x35b2fe[_0x2d2e('0x4c')]=_['intersection'](_0x35b2fe['model'],_0x35b2fe[_0x2d2e('0x44')]);_0x31713d[_0x2d2e('0x45')]=_[_0x2d2e('0x46')](_0x35b2fe[_0x2d2e('0x43')],qs['fields'](_0x8866f5[_0x2d2e('0x44')]['fields']));_0x31713d[_0x2d2e('0x45')]=_0x31713d[_0x2d2e('0x45')]['length']?_0x31713d['attributes']:_0x35b2fe[_0x2d2e('0x43')];_0x31713d[_0x2d2e('0x49')]=qs[_0x2d2e('0x4a')](_0x8866f5[_0x2d2e('0x44')][_0x2d2e('0x4a')]);_0x31713d[_0x2d2e('0x4b')]=qs[_0x2d2e('0x4c')](_[_0x2d2e('0x4d')](_0x8866f5[_0x2d2e('0x44')],_0x35b2fe[_0x2d2e('0x4c')]));if(_0x8866f5[_0x2d2e('0x44')][_0x2d2e('0x4e')]){_0x31713d[_0x2d2e('0x4b')]=_[_0x2d2e('0x4f')](_0x31713d[_0x2d2e('0x4b')],{'$or':_[_0x2d2e('0x3d')](_0x31713d[_0x2d2e('0x45')],function(_0x43ce80){var _0xecbff9={};_0xecbff9[_0x43ce80]={'$like':'%'+_0x8866f5['query'][_0x2d2e('0x4e')]+'%'};return _0xecbff9;})});}_0x31713d=_[_0x2d2e('0x4f')]({},_0x31713d,_0x8866f5[_0x2d2e('0x58')]);return _0x55877d[_0x2d2e('0xbc')](_0x31713d);}})[_0x2d2e('0x1e')](function(_0xc649bf){if(_0xc649bf){_0x2282bd=_0xc649bf['length'];if(!_0x8866f5['query'][_0x2d2e('0x6e')]('nolimit')){_0x31713d['limit']=qs[_0x2d2e('0x30')](_0x8866f5[_0x2d2e('0x44')][_0x2d2e('0x30')]);_0x31713d['offset']=qs['offset'](_0x8866f5[_0x2d2e('0x44')][_0x2d2e('0x2e')]);}return _0x55877d[_0x2d2e('0xbc')](_0x31713d);}})[_0x2d2e('0x1e')](function(_0x52547f){if(_0x52547f){return _0x52547f?{'count':_0x2282bd,'rows':_0x52547f}:null;}})[_0x2d2e('0x1e')](respondWithResult(_0x42eafe,null))[_0x2d2e('0x29')](handleError(_0x42eafe,null));};exports[_0x2d2e('0x3a')]=function(_0x139df6,_0x471d17,_0x88fb32){var _0x16c7f9,_0x297a56,_0x47f2d7;if(_[_0x2d2e('0x7e')](_0x139df6[_0x2d2e('0x64')][_0x2d2e('0x64')])||_0x139df6[_0x2d2e('0x64')][_0x2d2e('0x64')]===''){throw new db[(_0x2d2e('0x74'))][(_0x2d2e('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2d2e('0x7e')](_0x139df6['body']['to'])){}_0x16c7f9=_0x139df6['body']['to'];return db[_0x2d2e('0x3e')][_0x2d2e('0x6d')]({'where':{'id':_0x139df6['params']['id']}})['then'](handleEntityNotFound(_0x471d17,null))[_0x2d2e('0x1e')](function(_0x354a5d){if(_0x354a5d){return db[_0x2d2e('0x3e')][_0x2d2e('0x5e')]({'where':{'id':_0x354a5d['id']},'include':[{'model':db[_0x2d2e('0x82')],'as':_0x2d2e('0x83'),'include':[{'model':db['CmContact'],'as':_0x2d2e('0x84'),'where':{[_0x354a5d['mapKey']]:_0x16c7f9},'limit':0x1,'order':[[_0x2d2e('0x78'),'DESC']]}]}]})[_0x2d2e('0x1e')](handleEntityNotFound(_0x471d17,null))[_0x2d2e('0x1e')](function(_0x3c8b65){if(_0x3c8b65&&_0x3c8b65[_0x2d2e('0x83')]){_0x297a56=_0x3c8b65[_0x2d2e('0x37')]({'plain':!![]});if(_0x297a56[_0x2d2e('0x83')]&&_0x297a56['List'][_0x2d2e('0x84')]['length']){return _0x297a56['List'][_0x2d2e('0x84')][0x0];}return db[_0x2d2e('0x73')][_0x2d2e('0x59')](_['defaults'](_0x139df6[_0x2d2e('0x64')],{'firstName':_0x16c7f9,[_0x3c8b65[_0x2d2e('0x7f')]]:_0x16c7f9,'phone':_0x16c7f9,'ListId':_0x297a56[_0x2d2e('0x7a')]}));}})[_0x2d2e('0x1e')](handleEntityNotFound(_0x471d17,null))[_0x2d2e('0x1e')](function(_0x1188bd){if(_0x1188bd){_0x47f2d7=_0x1188bd;return db[_0x2d2e('0x92')][_0x2d2e('0x5e')]({'where':{'ContactId':_0x47f2d7['id'],'closed':![],'OpenchannelAccountId':_0x297a56['id']}})[_0x2d2e('0x1e')](function(_0x327797){if(_0x327797){return[_0x327797,![]];}return db[_0x2d2e('0x92')][_0x2d2e('0x59')]({'UserId':_0x139df6[_0x2d2e('0x5a')]['id'],'ContactId':_0x47f2d7['id'],'OpenchannelAccountId':_0x297a56['id'],'lastMsgDirection':_0x2d2e('0xbd'),'Messages':[_['merge'](_0x139df6[_0x2d2e('0x64')],{'read':![],'body':_0x139df6[_0x2d2e('0x64')]['body'],'OpenchannelAccountId':_0x297a56['id'],'UserId':_0x139df6['user']['id'],'ContactId':_0x47f2d7['id']})]},{'include':[{'model':db[_0x2d2e('0x99')],'as':_0x2d2e('0xbe')}]})[_0x2d2e('0x1e')](function(_0x42534e){return[_0x42534e,!![]];});});}})[_0x2d2e('0x93')](function(_0xc714ff,_0x933f74){if(_0x933f74){return _0xc714ff;}return db[_0x2d2e('0x99')][_0x2d2e('0x59')](_[_0x2d2e('0x4f')](_0x139df6[_0x2d2e('0x64')],{'read':![],'body':_0x139df6['body'][_0x2d2e('0x64')],'OpenchannelAccountId':_0x297a56['id'],'OpenchannelInteractionId':_0xc714ff['id'],'UserId':_0x139df6[_0x2d2e('0x5a')]['id'],'ContactId':_0x47f2d7['id']}))['then'](function(_0x5095f0){_0xc714ff['dataValues']['Messages']=[];_0xc714ff['dataValues'][_0x2d2e('0xbe')]['push'](_0x5095f0[_0x2d2e('0xbf')]);return _0xc714ff;});});}})[_0x2d2e('0x1e')](respondWithResult(_0x471d17,null))[_0x2d2e('0x29')](handleError(_0x471d17,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 8e85505..c42adda 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 _0xa74f=['remove','hasOwnProperty','hook','exports','OpenchannelAccount','update'];(function(_0x3abb90,_0x546b8a){var _0x470627=function(_0x4c0c05){while(--_0x4c0c05){_0x3abb90['push'](_0x3abb90['shift']());}};_0x470627(++_0x546b8a);}(_0xa74f,0x9a));var _0xfa74=function(_0x50d84b,_0x1d7ea7){_0x50d84b=_0x50d84b-0x0;var _0x6d4270=_0xa74f[_0x50d84b];return _0x6d4270;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0xfa74('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfa74('0x1'),'afterDestroy':_0xfa74('0x2')};function emitEvent(_0x394a1e){return function(_0x25a9b7,_0x5b367b,_0x141625){OpenchannelAccountEvents['emit'](_0x394a1e+':'+_0x25a9b7['id'],_0x25a9b7);OpenchannelAccountEvents['emit'](_0x394a1e,_0x25a9b7);_0x141625(null);};}for(var e in events){if(events[_0xfa74('0x3')](e)){var event=events[e];OpenchannelAccount[_0xfa74('0x4')](e,emitEvent(event));}}module[_0xfa74('0x5')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x2750=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount','setMaxListeners','save','update'];(function(_0x25aa6d,_0x545a44){var _0x5ed220=function(_0x21c809){while(--_0x21c809){_0x25aa6d['push'](_0x25aa6d['shift']());}};_0x5ed220(++_0x545a44);}(_0x2750,0x13b));var _0x0275=function(_0x4b3656,_0xc774ba){_0x4b3656=_0x4b3656-0x0;var _0x2fbcdb=_0x2750[_0x4b3656];return _0x2fbcdb;};'use strict';var EventEmitter=require(_0x0275('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x0275('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x0275('0x2')](0x0);var events={'afterCreate':_0x0275('0x3'),'afterUpdate':_0x0275('0x4'),'afterDestroy':_0x0275('0x5')};function emitEvent(_0x41ec06){return function(_0x20273d,_0x4960,_0x3d0c9c){OpenchannelAccountEvents[_0x0275('0x6')](_0x41ec06+':'+_0x20273d['id'],_0x20273d);OpenchannelAccountEvents['emit'](_0x41ec06,_0x20273d);_0x3d0c9c(null);};}for(var e in events){if(events[_0x0275('0x7')](e)){var event=events[e];OpenchannelAccount[_0x0275('0x8')](e,emitEvent(event));}}module[_0x0275('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 8bf0e91..2ef1886 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(_0x3f7604,_0x101f3b){var _0x122501=function(_0x197c4e){while(--_0x197c4e){_0x3f7604['push'](_0x3f7604['shift']());}};_0x122501(++_0x101f3b);}(_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 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(_0x52facc,_0x40b737){var _0x11bd78=function(_0x66f663){while(--_0x66f663){_0x52facc['push'](_0x52facc['shift']());}};_0x11bd78(++_0x40b737);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 8b48f02..147db61 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 _0x351d=['rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x474d2d,_0x2b7b3e){var _0x343fc4=function(_0x2b4c12){while(--_0x2b4c12){_0x474d2d['push'](_0x474d2d['shift']());}};_0x343fc4(++_0x2b7b3e);}(_0x351d,0x90));var _0xd351=function(_0xac43d2,_0x26634b){_0xac43d2=_0xac43d2-0x0;var _0x445f13=_0x351d[_0xac43d2];return _0x445f13;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var moment=require(_0xd351('0x1'));var BPromise=require(_0xd351('0x2'));var rs=require(_0xd351('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd351('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd351('0x5'))(_0xd351('0x6'));var config=require('../../config/environment');var jayson=require(_0xd351('0x7'));var client=jayson[_0xd351('0x8')][_0xd351('0x9')]({'port':0x232a});config['redis']=_[_0xd351('0xa')](config[_0xd351('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd351('0xc'))(new Redis(config[_0xd351('0xb')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x44bf81,_0x4904b4,_0x34cfc7){return new BPromise(function(_0x39b8c8,_0x5949a4){return client[_0xd351('0xd')](_0x44bf81,_0x34cfc7)[_0xd351('0xe')](function(_0x4ebca1){logger[_0xd351('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x4904b4,'request\x20sent');logger[_0xd351('0x10')](_0xd351('0x11'),_0x4904b4,_0xd351('0x12'),JSON[_0xd351('0x13')](_0x4ebca1));if(_0x4ebca1['error']){if(_0x4ebca1[_0xd351('0x14')][_0xd351('0x15')]===0x1f4){logger['error'](_0xd351('0x16'),_0x4904b4,_0x4ebca1[_0xd351('0x14')][_0xd351('0x17')]);return _0x5949a4(_0x4ebca1[_0xd351('0x14')][_0xd351('0x17')]);}logger['error'](_0xd351('0x16'),_0x4904b4,_0x4ebca1['error']['message']);return _0x39b8c8(_0x4ebca1[_0xd351('0x14')]['message']);}else{logger[_0xd351('0xf')](_0xd351('0x16'),_0x4904b4,_0xd351('0x12'));_0x39b8c8(_0x4ebca1['result'][_0xd351('0x17')]);}})[_0xd351('0x18')](function(_0x77985a){logger[_0xd351('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x4904b4,_0x77985a);_0x5949a4(_0x77985a);});});} \ No newline at end of file +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(_0x3a21ee,_0x108dde){var _0x34828e=function(_0x52a37f){while(--_0x52a37f){_0x3a21ee['push'](_0x3a21ee['shift']());}};_0x34828e(++_0x108dde);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9e6b[_0x4b055c];return _0x4b62bb;};'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 diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 38c7654..cf44e0f 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 _0x90ae=['emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x90ae,0x195));var _0xe90a=function(_0x2aad50,_0x3e09ce){_0x2aad50=_0x2aad50-0x0;var _0x39caf5=_0x90ae[_0x2aad50];return _0x39caf5;};'use strict';var OpenchannelAccountEvents=require(_0xe90a('0x0'));var events=[_0xe90a('0x1'),_0xe90a('0x2'),'update'];function createListener(_0xbff9b9,_0x2eb615){return function(_0x26d669){_0x2eb615[_0xe90a('0x3')](_0xbff9b9,_0x26d669);};}function removeListener(_0x2b677c,_0x31d57b){return function(){OpenchannelAccountEvents[_0xe90a('0x4')](_0x2b677c,_0x31d57b);};}exports[_0xe90a('0x5')]=function(_0x30cb7b){for(var _0x5c3573=0x0,_0x203575=events[_0xe90a('0x6')];_0x5c3573<_0x203575;_0x5c3573++){var _0x24b470=events[_0x5c3573];var _0x42fb64=createListener(_0xe90a('0x7')+_0x24b470,_0x30cb7b);OpenchannelAccountEvents['on'](_0x24b470,_0x42fb64);}}; \ No newline at end of file +var _0xbe31=['update','emit','register','length','openchannelAccount:','save','remove'];(function(_0x21e38a,_0x20893b){var _0x21e59b=function(_0x2b23fc){while(--_0x2b23fc){_0x21e38a['push'](_0x21e38a['shift']());}};_0x21e59b(++_0x20893b);}(_0xbe31,0x83));var _0x1be3=function(_0x31b9bb,_0x5ba620){_0x31b9bb=_0x31b9bb-0x0;var _0x5b10ae=_0xbe31[_0x31b9bb];return _0x5b10ae;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x1be3('0x0'),_0x1be3('0x1'),_0x1be3('0x2')];function createListener(_0x474db2,_0x228047){return function(_0x1bd12d){_0x228047[_0x1be3('0x3')](_0x474db2,_0x1bd12d);};}function removeListener(_0x2c1ddd,_0x3aacc2){return function(){OpenchannelAccountEvents['removeListener'](_0x2c1ddd,_0x3aacc2);};}exports[_0x1be3('0x4')]=function(_0x57e6b0){for(var _0x1f09ec=0x0,_0xa757b9=events[_0x1be3('0x5')];_0x1f09ec<_0xa757b9;_0x1f09ec++){var _0x2c3965=events[_0x1f09ec];var _0x2bb749=createListener(_0x1be3('0x6')+_0x2c3965,_0x57e6b0);OpenchannelAccountEvents['on'](_0x2c3965,_0x2bb749);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 8bd8e7f..620ec83 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 _0x5e9e=['./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x5b2436,_0xb8e634){var _0x178c76=function(_0x55e9ab){while(--_0x55e9ab){_0x5b2436['push'](_0x5b2436['shift']());}};_0x178c76(++_0xb8e634);}(_0x5e9e,0xbf));var _0xe5e9=function(_0x14ff79,_0x6c8051){_0x14ff79=_0x14ff79-0x0;var _0x2a3756=_0x5e9e[_0x14ff79];return _0x2a3756;};'use strict';var multer=require('multer');var util=require(_0xe5e9('0x0'));var path=require(_0xe5e9('0x1'));var timeout=require('connect-timeout');var express=require(_0xe5e9('0x2'));var router=express[_0xe5e9('0x3')]();var fs_extra=require(_0xe5e9('0x4'));var auth=require(_0xe5e9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe5e9('0x6'));var controller=require(_0xe5e9('0x7'));router[_0xe5e9('0x8')]('/',auth[_0xe5e9('0x9')](),controller[_0xe5e9('0xa')]);router[_0xe5e9('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe5e9('0xb')]);router[_0xe5e9('0xc')]('/',auth[_0xe5e9('0x9')](),controller[_0xe5e9('0xd')]);router['put'](_0xe5e9('0xe'),auth['isAuthenticated'](),controller[_0xe5e9('0xf')]);router[_0xe5e9('0x10')](_0xe5e9('0xe'),auth[_0xe5e9('0x9')](),controller['destroy']);module[_0xe5e9('0x11')]=router; \ No newline at end of file +var _0xd5ea=['update','delete','destroy','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x5705ba,_0x7f5a15){var _0x5694c3=function(_0x59b1ac){while(--_0x59b1ac){_0x5705ba['push'](_0x5705ba['shift']());}};_0x5694c3(++_0x7f5a15);}(_0xd5ea,0x99));var _0xad5e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd5ea[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0xad5e('0x0'));var path=require('path');var timeout=require(_0xad5e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xad5e('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xad5e('0x3'));var config=require(_0xad5e('0x4'));var controller=require('./openchannelApplication.controller');router[_0xad5e('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xad5e('0x6')](),controller[_0xad5e('0x7')]);router[_0xad5e('0x8')]('/',auth[_0xad5e('0x6')](),controller[_0xad5e('0x9')]);router[_0xad5e('0xa')](_0xad5e('0xb'),auth[_0xad5e('0x6')](),controller[_0xad5e('0xc')]);router[_0xad5e('0xd')](_0xad5e('0xb'),auth[_0xad5e('0x6')](),controller[_0xad5e('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index aee9e53..fd86246 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 _0xccaa=['TEXT','sequelize','INTEGER'];(function(_0x358f87,_0x5a4d20){var _0x4b2fdb=function(_0x384222){while(--_0x384222){_0x358f87['push'](_0x358f87['shift']());}};_0x4b2fdb(++_0x5a4d20);}(_0xccaa,0x1c3));var _0xacca=function(_0x5713b5,_0x423f83){_0x5713b5=_0x5713b5-0x0;var _0x2f795d=_0xccaa[_0x5713b5];return _0x2f795d;};'use strict';var Sequelize=require(_0xacca('0x0'));module['exports']={'priority':{'type':Sequelize[_0xacca('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xacca('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2dc3=['*,*,*,*','exports','STRING','noop','TEXT'];(function(_0x224d10,_0x43fa91){var _0x76e3f3=function(_0x36d51b){while(--_0x36d51b){_0x224d10['push'](_0x224d10['shift']());}};_0x76e3f3(++_0x43fa91);}(_0x2dc3,0x150));var _0x32dc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2dc3[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x32dc('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x32dc('0x1')],'allowNull':![],'defaultValue':_0x32dc('0x2')},'appdata':{'type':Sequelize[_0x32dc('0x3')]()},'description':{'type':Sequelize[_0x32dc('0x1')]},'interval':{'type':Sequelize[_0x32dc('0x1')],'defaultValue':_0x32dc('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index c18db3c..f6541c5 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 _0x1cb9=['sendStatus','end','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','keys','includeAll','find','body','params','request-promise','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x40bdb3,_0x5a81f2){var _0xeac086=function(_0x199fba){while(--_0x199fba){_0x40bdb3['push'](_0x40bdb3['shift']());}};_0xeac086(++_0x5a81f2);}(_0x1cb9,0x1d0));var _0x91cb=function(_0x80784f,_0x167f0e){_0x80784f=_0x80784f-0x0;var _0x5e2748=_0x1cb9[_0x80784f];return _0x5e2748;};'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(_0x91cb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x1'));var util=require(_0x91cb('0x2'));var path=require(_0x91cb('0x3'));var sox=require(_0x91cb('0x4'));var csv=require('to-csv');var ejs=require(_0x91cb('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91cb('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x91cb('0x7'));var deskjs=require(_0x91cb('0x8'));var toCsv=require(_0x91cb('0x9'));var querystring=require(_0x91cb('0xa'));var Papa=require(_0x91cb('0xb'));var Redis=require(_0x91cb('0xc'));var authService=require(_0x91cb('0xd'));var qs=require(_0x91cb('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91cb('0xf'));var logger=require(_0x91cb('0x10'))(_0x91cb('0x11'));var utils=require(_0x91cb('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35d7e6,_0x4e898d){_0x4e898d=_0x4e898d||0xcc;return function(_0x5e8845){if(_0x5e8845){return _0x35d7e6[_0x91cb('0x13')](_0x4e898d);}return _0x35d7e6['status'](_0x4e898d)[_0x91cb('0x14')]();};}function respondWithResult(_0x31be7f,_0x25fc82){_0x25fc82=_0x25fc82||0xc8;return function(_0x1951d1){if(_0x1951d1){return _0x31be7f['status'](_0x25fc82)['json'](_0x1951d1);}};}function respondWithFilteredResult(_0x3eaa14,_0x2ed7e8){return function(_0x2af21b){if(_0x2af21b){var _0x28e3b2=typeof _0x2ed7e8[_0x91cb('0x15')]===_0x91cb('0x16')&&typeof _0x2ed7e8[_0x91cb('0x17')]==='undefined';var _0x5173f9=_0x2af21b['count'];var _0x37a07d=_0x28e3b2?0x0:_0x2ed7e8[_0x91cb('0x15')];var _0x102486=_0x28e3b2?_0x2af21b[_0x91cb('0x18')]:_0x2ed7e8[_0x91cb('0x15')]+_0x2ed7e8[_0x91cb('0x17')];var _0x4b9a1d;if(_0x102486>=_0x5173f9){_0x102486=_0x5173f9;_0x4b9a1d=0xc8;}else{_0x4b9a1d=0xce;}_0x3eaa14['status'](_0x4b9a1d);return _0x3eaa14['set'](_0x91cb('0x19'),_0x37a07d+'-'+_0x102486+'/'+_0x5173f9)['json'](_0x2af21b);}return null;};}function patchUpdates(_0x1a3fb5){return function(_0x1a1216){try{jsonpatch[_0x91cb('0x1a')](_0x1a1216,_0x1a3fb5,!![]);}catch(_0x5d01d5){return BPromise[_0x91cb('0x1b')](_0x5d01d5);}return _0x1a1216['save']();};}function saveUpdates(_0x23dcd7,_0x26f0c4){return function(_0x55fa48){if(_0x55fa48){return _0x55fa48[_0x91cb('0x1c')](_0x23dcd7)[_0x91cb('0x1d')](function(_0x47a186){return _0x47a186;});}return null;};}function removeEntity(_0x54c203,_0x23a88f){return function(_0x213fd1){if(_0x213fd1){return _0x213fd1[_0x91cb('0x1e')]()[_0x91cb('0x1d')](function(){_0x54c203['status'](0xcc)[_0x91cb('0x14')]();});}};}function handleEntityNotFound(_0xc734c3,_0x1c8abf){return function(_0x229de9){if(!_0x229de9){_0xc734c3[_0x91cb('0x13')](0x194);}return _0x229de9;};}function handleError(_0x3ad86b,_0x58465b){_0x58465b=_0x58465b||0x1f4;return function(_0x14adbf){logger[_0x91cb('0x1f')](_0x14adbf[_0x91cb('0x20')]);if(_0x14adbf['name']){delete _0x14adbf[_0x91cb('0x21')];}_0x3ad86b['status'](_0x58465b)[_0x91cb('0x22')](_0x14adbf);};}exports[_0x91cb('0x23')]=function(_0x4a8af3,_0x32397a){var _0x3a3915={},_0x394dcb={},_0x5b1ca8={'count':0x0,'rows':[]};var _0x5ed97d=_[_0x91cb('0x24')](db[_0x91cb('0x25')][_0x91cb('0x26')],function(_0x3b9d3f){return{'name':_0x3b9d3f[_0x91cb('0x27')],'type':_0x3b9d3f[_0x91cb('0x28')][_0x91cb('0x29')]};});_0x394dcb[_0x91cb('0x2a')]=_[_0x91cb('0x24')](_0x5ed97d,_0x91cb('0x21'));_0x394dcb[_0x91cb('0x2b')]=_['keys'](_0x4a8af3[_0x91cb('0x2b')]);_0x394dcb[_0x91cb('0x2c')]=_[_0x91cb('0x2d')](_0x394dcb[_0x91cb('0x2a')],_0x394dcb[_0x91cb('0x2b')]);_0x3a3915[_0x91cb('0x2e')]=_[_0x91cb('0x2d')](_0x394dcb[_0x91cb('0x2a')],qs['fields'](_0x4a8af3[_0x91cb('0x2b')][_0x91cb('0x2f')]));_0x3a3915[_0x91cb('0x2e')]=_0x3a3915[_0x91cb('0x2e')][_0x91cb('0x30')]?_0x3a3915[_0x91cb('0x2e')]:_0x394dcb['model'];if(!_0x4a8af3['query'][_0x91cb('0x31')](_0x91cb('0x32'))){_0x3a3915['limit']=qs[_0x91cb('0x17')](_0x4a8af3['query'][_0x91cb('0x17')]);_0x3a3915[_0x91cb('0x15')]=qs[_0x91cb('0x15')](_0x4a8af3[_0x91cb('0x2b')][_0x91cb('0x15')]);}_0x3a3915[_0x91cb('0x33')]=qs[_0x91cb('0x34')](_0x4a8af3[_0x91cb('0x2b')][_0x91cb('0x34')]);_0x3a3915[_0x91cb('0x35')]=qs[_0x91cb('0x2c')](_[_0x91cb('0x36')](_0x4a8af3[_0x91cb('0x2b')],_0x394dcb['filters']),_0x5ed97d);if(_0x4a8af3[_0x91cb('0x2b')]['filter']){_0x3a3915[_0x91cb('0x35')]=_[_0x91cb('0x37')](_0x3a3915[_0x91cb('0x35')],{'$or':_[_0x91cb('0x24')](_0x5ed97d,function(_0x26273b){if(_0x26273b[_0x91cb('0x28')]!==_0x91cb('0x38')){var _0x30702e={};_0x30702e[_0x26273b[_0x91cb('0x21')]]={'$like':'%'+_0x4a8af3['query'][_0x91cb('0x39')]+'%'};return _0x30702e;}})});}_0x3a3915=_[_0x91cb('0x37')]({},_0x3a3915,_0x4a8af3[_0x91cb('0x3a')]);var _0xba5c40={'where':_0x3a3915[_0x91cb('0x35')]};return db['OpenchannelApplication'][_0x91cb('0x18')](_0xba5c40)[_0x91cb('0x1d')](function(_0x33be07){_0x5b1ca8[_0x91cb('0x18')]=_0x33be07;if(_0x4a8af3['query']['includeAll']){_0x3a3915[_0x91cb('0x3b')]=[{'all':!![]}];}return db[_0x91cb('0x25')][_0x91cb('0x3c')](_0x3a3915);})[_0x91cb('0x1d')](function(_0xe97781){_0x5b1ca8[_0x91cb('0x3d')]=_0xe97781;return _0x5b1ca8;})[_0x91cb('0x1d')](respondWithFilteredResult(_0x32397a,_0x3a3915))[_0x91cb('0x3e')](handleError(_0x32397a,null));};exports[_0x91cb('0x3f')]=function(_0x851e60,_0x25f826){var _0x5c2fc6={'raw':!![],'where':{'id':_0x851e60['params']['id']}},_0x5a325e={};_0x5a325e[_0x91cb('0x2a')]=_['keys'](db[_0x91cb('0x25')]['rawAttributes']);_0x5a325e['query']=_[_0x91cb('0x40')](_0x851e60[_0x91cb('0x2b')]);_0x5a325e[_0x91cb('0x2c')]=_[_0x91cb('0x2d')](_0x5a325e[_0x91cb('0x2a')],_0x5a325e['query']);_0x5c2fc6[_0x91cb('0x2e')]=_[_0x91cb('0x2d')](_0x5a325e[_0x91cb('0x2a')],qs['fields'](_0x851e60[_0x91cb('0x2b')][_0x91cb('0x2f')]));_0x5c2fc6[_0x91cb('0x2e')]=_0x5c2fc6[_0x91cb('0x2e')][_0x91cb('0x30')]?_0x5c2fc6[_0x91cb('0x2e')]:_0x5a325e[_0x91cb('0x2a')];if(_0x851e60['query'][_0x91cb('0x41')]){_0x5c2fc6[_0x91cb('0x3b')]=[{'all':!![]}];}_0x5c2fc6=_[_0x91cb('0x37')]({},_0x5c2fc6,_0x851e60['options']);return db[_0x91cb('0x25')][_0x91cb('0x42')](_0x5c2fc6)[_0x91cb('0x1d')](handleEntityNotFound(_0x25f826,null))[_0x91cb('0x1d')](respondWithResult(_0x25f826,null))[_0x91cb('0x3e')](handleError(_0x25f826,null));};exports['create']=function(_0x5a9375,_0x152181){return db[_0x91cb('0x25')]['create'](_0x5a9375[_0x91cb('0x43')],{})['then'](respondWithResult(_0x152181,0xc9))[_0x91cb('0x3e')](handleError(_0x152181,null));};exports['update']=function(_0x4dc35b,_0x6dc001){if(_0x4dc35b[_0x91cb('0x43')]['id']){delete _0x4dc35b[_0x91cb('0x43')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x4dc35b['params']['id']}})[_0x91cb('0x1d')](handleEntityNotFound(_0x6dc001,null))[_0x91cb('0x1d')](saveUpdates(_0x4dc35b[_0x91cb('0x43')],null))[_0x91cb('0x1d')](respondWithResult(_0x6dc001,null))['catch'](handleError(_0x6dc001,null));};exports[_0x91cb('0x1e')]=function(_0x41a47d,_0x1bd3d3){return db['OpenchannelApplication'][_0x91cb('0x42')]({'where':{'id':_0x41a47d[_0x91cb('0x44')]['id']}})[_0x91cb('0x1d')](handleEntityNotFound(_0x1bd3d3,null))[_0x91cb('0x1d')](removeEntity(_0x1bd3d3,null))['catch'](handleError(_0x1bd3d3,null));}; \ No newline at end of file +var _0x56cf=['error','name','send','index','map','OpenchannelApplication','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','rows','catch','params','keys','rawAttributes','length','options','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then'];(function(_0x156e0c,_0x3ef8e7){var _0x275e9c=function(_0x8a48d1){while(--_0x8a48d1){_0x156e0c['push'](_0x156e0c['shift']());}};_0x275e9c(++_0x3ef8e7);}(_0x56cf,0x102));var _0xf56c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56cf[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf56c('0x0'));var zipdir=require(_0xf56c('0x1'));var jsonpatch=require(_0xf56c('0x2'));var rp=require(_0xf56c('0x3'));var moment=require(_0xf56c('0x4'));var BPromise=require(_0xf56c('0x5'));var Mustache=require(_0xf56c('0x6'));var util=require(_0xf56c('0x7'));var path=require(_0xf56c('0x8'));var sox=require(_0xf56c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf56c('0xa'));var _=require(_0xf56c('0xb'));var squel=require(_0xf56c('0xc'));var crypto=require(_0xf56c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf56c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf56c('0xf'));var Papa=require('papaparse');var Redis=require(_0xf56c('0x10'));var authService=require(_0xf56c('0x11'));var qs=require(_0xf56c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf56c('0x13'))(_0xf56c('0x14'));var utils=require(_0xf56c('0x15'));var config=require(_0xf56c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf56c('0x17'))['db'];function respondWithStatusCode(_0x3fc363,_0x17e06a){_0x17e06a=_0x17e06a||0xcc;return function(_0x31756d){if(_0x31756d){return _0x3fc363[_0xf56c('0x18')](_0x17e06a);}return _0x3fc363[_0xf56c('0x19')](_0x17e06a)[_0xf56c('0x1a')]();};}function respondWithResult(_0x4dcfae,_0x4f15c2){_0x4f15c2=_0x4f15c2||0xc8;return function(_0x3b2455){if(_0x3b2455){return _0x4dcfae[_0xf56c('0x19')](_0x4f15c2)['json'](_0x3b2455);}};}function respondWithFilteredResult(_0x23fc33,_0x547e6b){return function(_0x1fbd49){if(_0x1fbd49){var _0xdab9e=typeof _0x547e6b[_0xf56c('0x1b')]===_0xf56c('0x1c')&&typeof _0x547e6b[_0xf56c('0x1d')]===_0xf56c('0x1c');var _0x4e1e54=_0x1fbd49[_0xf56c('0x1e')];var _0x23fba9=_0xdab9e?0x0:_0x547e6b[_0xf56c('0x1b')];var _0x15ecb4=_0xdab9e?_0x1fbd49[_0xf56c('0x1e')]:_0x547e6b[_0xf56c('0x1b')]+_0x547e6b[_0xf56c('0x1d')];var _0x4fb8ba;if(_0x15ecb4>=_0x4e1e54){_0x15ecb4=_0x4e1e54;_0x4fb8ba=0xc8;}else{_0x4fb8ba=0xce;}_0x23fc33[_0xf56c('0x19')](_0x4fb8ba);return _0x23fc33[_0xf56c('0x1f')](_0xf56c('0x20'),_0x23fba9+'-'+_0x15ecb4+'/'+_0x4e1e54)[_0xf56c('0x21')](_0x1fbd49);}return null;};}function patchUpdates(_0x2010f3){return function(_0x39b45b){try{jsonpatch[_0xf56c('0x22')](_0x39b45b,_0x2010f3,!![]);}catch(_0x1946b9){return BPromise[_0xf56c('0x23')](_0x1946b9);}return _0x39b45b[_0xf56c('0x24')]();};}function saveUpdates(_0x4c5896,_0x584431){return function(_0x32c26d){if(_0x32c26d){return _0x32c26d['update'](_0x4c5896)[_0xf56c('0x25')](function(_0x4d5c9d){return _0x4d5c9d;});}return null;};}function removeEntity(_0x291314,_0x4ecf57){return function(_0x8d7f5){if(_0x8d7f5){return _0x8d7f5['destroy']()[_0xf56c('0x25')](function(){_0x291314[_0xf56c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x543e20,_0x3ad7ae){return function(_0x434772){if(!_0x434772){_0x543e20['sendStatus'](0x194);}return _0x434772;};}function handleError(_0x303614,_0x5848ae){_0x5848ae=_0x5848ae||0x1f4;return function(_0x2857b4){logger[_0xf56c('0x26')](_0x2857b4['stack']);if(_0x2857b4[_0xf56c('0x27')]){delete _0x2857b4[_0xf56c('0x27')];}_0x303614[_0xf56c('0x19')](_0x5848ae)[_0xf56c('0x28')](_0x2857b4);};}exports[_0xf56c('0x29')]=function(_0x53d17e,_0x8a109b){var _0x139b7b={},_0x3ce3d1={},_0x1c5450={'count':0x0,'rows':[]};var _0x1a7970=_[_0xf56c('0x2a')](db[_0xf56c('0x2b')]['rawAttributes'],function(_0x71207c){return{'name':_0x71207c[_0xf56c('0x2c')],'type':_0x71207c[_0xf56c('0x2d')][_0xf56c('0x2e')]};});_0x3ce3d1[_0xf56c('0x2f')]=_[_0xf56c('0x2a')](_0x1a7970,_0xf56c('0x27'));_0x3ce3d1[_0xf56c('0x30')]=_['keys'](_0x53d17e[_0xf56c('0x30')]);_0x3ce3d1['filters']=_[_0xf56c('0x31')](_0x3ce3d1['model'],_0x3ce3d1[_0xf56c('0x30')]);_0x139b7b[_0xf56c('0x32')]=_[_0xf56c('0x31')](_0x3ce3d1[_0xf56c('0x2f')],qs[_0xf56c('0x33')](_0x53d17e[_0xf56c('0x30')][_0xf56c('0x33')]));_0x139b7b[_0xf56c('0x32')]=_0x139b7b[_0xf56c('0x32')]['length']?_0x139b7b['attributes']:_0x3ce3d1['model'];if(!_0x53d17e[_0xf56c('0x30')][_0xf56c('0x34')](_0xf56c('0x35'))){_0x139b7b['limit']=qs[_0xf56c('0x1d')](_0x53d17e[_0xf56c('0x30')][_0xf56c('0x1d')]);_0x139b7b['offset']=qs['offset'](_0x53d17e[_0xf56c('0x30')][_0xf56c('0x1b')]);}_0x139b7b[_0xf56c('0x36')]=qs[_0xf56c('0x37')](_0x53d17e[_0xf56c('0x30')][_0xf56c('0x37')]);_0x139b7b[_0xf56c('0x38')]=qs[_0xf56c('0x39')](_[_0xf56c('0x3a')](_0x53d17e['query'],_0x3ce3d1[_0xf56c('0x39')]),_0x1a7970);if(_0x53d17e[_0xf56c('0x30')][_0xf56c('0x3b')]){_0x139b7b[_0xf56c('0x38')]=_[_0xf56c('0x3c')](_0x139b7b[_0xf56c('0x38')],{'$or':_[_0xf56c('0x2a')](_0x1a7970,function(_0x269dd1){if(_0x269dd1['type']!==_0xf56c('0x3d')){var _0x408306={};_0x408306[_0x269dd1['name']]={'$like':'%'+_0x53d17e[_0xf56c('0x30')][_0xf56c('0x3b')]+'%'};return _0x408306;}})});}_0x139b7b=_[_0xf56c('0x3c')]({},_0x139b7b,_0x53d17e['options']);var _0xad18f4={'where':_0x139b7b['where']};return db[_0xf56c('0x2b')]['count'](_0xad18f4)[_0xf56c('0x25')](function(_0x2d02ca){_0x1c5450['count']=_0x2d02ca;if(_0x53d17e[_0xf56c('0x30')][_0xf56c('0x3e')]){_0x139b7b['include']=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x139b7b);})[_0xf56c('0x25')](function(_0x24a859){_0x1c5450[_0xf56c('0x3f')]=_0x24a859;return _0x1c5450;})[_0xf56c('0x25')](respondWithFilteredResult(_0x8a109b,_0x139b7b))[_0xf56c('0x40')](handleError(_0x8a109b,null));};exports['show']=function(_0x21b927,_0x4cef83){var _0x20ead9={'raw':!![],'where':{'id':_0x21b927[_0xf56c('0x41')]['id']}},_0xa1a41c={};_0xa1a41c[_0xf56c('0x2f')]=_[_0xf56c('0x42')](db[_0xf56c('0x2b')][_0xf56c('0x43')]);_0xa1a41c[_0xf56c('0x30')]=_['keys'](_0x21b927['query']);_0xa1a41c[_0xf56c('0x39')]=_['intersection'](_0xa1a41c[_0xf56c('0x2f')],_0xa1a41c[_0xf56c('0x30')]);_0x20ead9[_0xf56c('0x32')]=_['intersection'](_0xa1a41c[_0xf56c('0x2f')],qs['fields'](_0x21b927[_0xf56c('0x30')]['fields']));_0x20ead9[_0xf56c('0x32')]=_0x20ead9['attributes'][_0xf56c('0x44')]?_0x20ead9['attributes']:_0xa1a41c[_0xf56c('0x2f')];if(_0x21b927['query']['includeAll']){_0x20ead9['include']=[{'all':!![]}];}_0x20ead9=_[_0xf56c('0x3c')]({},_0x20ead9,_0x21b927[_0xf56c('0x45')]);return db[_0xf56c('0x2b')][_0xf56c('0x46')](_0x20ead9)[_0xf56c('0x25')](handleEntityNotFound(_0x4cef83,null))[_0xf56c('0x25')](respondWithResult(_0x4cef83,null))[_0xf56c('0x40')](handleError(_0x4cef83,null));};exports[_0xf56c('0x47')]=function(_0x662ccb,_0x412455){return db['OpenchannelApplication'][_0xf56c('0x47')](_0x662ccb[_0xf56c('0x48')],{})[_0xf56c('0x25')](respondWithResult(_0x412455,0xc9))[_0xf56c('0x40')](handleError(_0x412455,null));};exports['update']=function(_0x3c60e0,_0x3a0c97){if(_0x3c60e0[_0xf56c('0x48')]['id']){delete _0x3c60e0[_0xf56c('0x48')]['id'];}return db[_0xf56c('0x2b')][_0xf56c('0x46')]({'where':{'id':_0x3c60e0[_0xf56c('0x41')]['id']}})[_0xf56c('0x25')](handleEntityNotFound(_0x3a0c97,null))[_0xf56c('0x25')](saveUpdates(_0x3c60e0['body'],null))[_0xf56c('0x25')](respondWithResult(_0x3a0c97,null))[_0xf56c('0x40')](handleError(_0x3a0c97,null));};exports[_0xf56c('0x49')]=function(_0x1508f3,_0x3c3e88){return db[_0xf56c('0x2b')][_0xf56c('0x46')]({'where':{'id':_0x1508f3[_0xf56c('0x41')]['id']}})['then'](handleEntityNotFound(_0x3c3e88,null))['then'](removeEntity(_0x3c3e88,null))[_0xf56c('0x40')](handleError(_0x3c3e88,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 0956127..6759abf 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 _0x5531=['exports','define','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x64a815,_0x1a32bc){var _0x5b0448=function(_0x496a8f){while(--_0x496a8f){_0x64a815['push'](_0x64a815['shift']());}};_0x5b0448(++_0x1a32bc);}(_0x5531,0x177));var _0x1553=function(_0x5243b7,_0x4a3017){_0x5243b7=_0x5243b7-0x0;var _0x21b713=_0x5531[_0x5243b7];return _0x21b713;};'use strict';var _=require(_0x1553('0x0'));var util=require(_0x1553('0x1'));var logger=require(_0x1553('0x2'))(_0x1553('0x3'));var moment=require(_0x1553('0x4'));var BPromise=require('bluebird');var rp=require(_0x1553('0x5'));var fs=require('fs');var path=require(_0x1553('0x6'));var rimraf=require(_0x1553('0x7'));var config=require(_0x1553('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0x1553('0x9')]=function(_0x356418,_0x93a224){return _0x356418[_0x1553('0xa')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1553('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x71ea=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','lodash'];(function(_0x398a6d,_0x18a7f8){var _0x5873a5=function(_0x15b4da){while(--_0x15b4da){_0x398a6d['push'](_0x398a6d['shift']());}};_0x5873a5(++_0x18a7f8);}(_0x71ea,0x128));var _0xa71e=function(_0x302004,_0x56220a){_0x302004=_0x302004-0x0;var _0x5d521f=_0x71ea[_0x302004];return _0x5d521f;};'use strict';var _=require(_0xa71e('0x0'));var util=require(_0xa71e('0x1'));var logger=require(_0xa71e('0x2'))(_0xa71e('0x3'));var moment=require('moment');var BPromise=require(_0xa71e('0x4'));var rp=require(_0xa71e('0x5'));var fs=require('fs');var path=require(_0xa71e('0x6'));var rimraf=require('rimraf');var config=require(_0xa71e('0x7'));var attributes=require(_0xa71e('0x8'));module[_0xa71e('0x9')]=function(_0x3833fe,_0x5bce4e){return _0x3833fe[_0xa71e('0xa')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index c830945..ebe752c 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 _0x11fd=['util','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','attributes','then','catch','lodash'];(function(_0xd71a2e,_0x581806){var _0x3c8a4c=function(_0x1caa3b){while(--_0x1caa3b){_0xd71a2e['push'](_0xd71a2e['shift']());}};_0x3c8a4c(++_0x581806);}(_0x11fd,0x1ca));var _0xd11f=function(_0x3f056b,_0x2cb5bc){_0x3f056b=_0x3f056b-0x0;var _0x87a408=_0x11fd[_0x3f056b];return _0x87a408;};'use strict';var _=require(_0xd11f('0x0'));var util=require(_0xd11f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd11f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd11f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd11f('0x4'))(_0xd11f('0x5'));var config=require('../../config/environment');var jayson=require(_0xd11f('0x6'));var client=jayson[_0xd11f('0x7')][_0xd11f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47b918,_0x5eeeb8,_0x1cf56d){return new BPromise(function(_0x120b12,_0x199940){return client[_0xd11f('0x9')](_0x47b918,_0x1cf56d)['then'](function(_0x12af6d){logger['info'](_0xd11f('0xa'),_0x5eeeb8,_0xd11f('0xb'));logger[_0xd11f('0xc')](_0xd11f('0xd'),_0x5eeeb8,_0xd11f('0xb'),JSON[_0xd11f('0xe')](_0x12af6d));if(_0x12af6d[_0xd11f('0xf')]){if(_0x12af6d[_0xd11f('0xf')]['code']===0x1f4){logger[_0xd11f('0xf')](_0xd11f('0xa'),_0x5eeeb8,_0x12af6d[_0xd11f('0xf')][_0xd11f('0x10')]);return _0x199940(_0x12af6d[_0xd11f('0xf')]['message']);}logger['error'](_0xd11f('0xa'),_0x5eeeb8,_0x12af6d[_0xd11f('0xf')]['message']);return _0x120b12(_0x12af6d[_0xd11f('0xf')][_0xd11f('0x10')]);}else{logger[_0xd11f('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x5eeeb8,_0xd11f('0xb'));_0x120b12(_0x12af6d[_0xd11f('0x12')]['message']);}})['catch'](function(_0x4a87bd){logger['error'](_0xd11f('0xa'),_0x5eeeb8,_0x4a87bd);_0x199940(_0x4a87bd);});});}exports[_0xd11f('0x13')]=function(_0x2ca211){var _0x18533b=this;return new Promise(function(_0x47c058,_0x67dad9){return db[_0xd11f('0x14')]['update'](_0x2ca211[_0xd11f('0x15')],{'raw':_0x2ca211[_0xd11f('0x16')]?_0x2ca211[_0xd11f('0x16')][_0xd11f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ca211[_0xd11f('0x16')]?_0x2ca211[_0xd11f('0x16')]['where']||null:null,'attributes':_0x2ca211[_0xd11f('0x16')]?_0x2ca211[_0xd11f('0x16')][_0xd11f('0x18')]||null:null,'limit':_0x2ca211['options']?_0x2ca211[_0xd11f('0x16')]['limit']||null:null})[_0xd11f('0x19')](function(_0x4d65b1){logger[_0xd11f('0x11')](_0xd11f('0x13'),_0x2ca211);logger[_0xd11f('0xc')](_0xd11f('0x13'),_0x2ca211,JSON[_0xd11f('0xe')](_0x4d65b1));_0x47c058(_0x4d65b1);})[_0xd11f('0x1a')](function(_0x41447a){logger['error'](_0xd11f('0x13'),_0x41447a[_0xd11f('0x10')],_0x2ca211);_0x67dad9(_0x18533b[_0xd11f('0xf')](0x1f4,_0x41447a[_0xd11f('0x10')]));});});}; \ No newline at end of file +var _0xf964=['result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4cba27,_0x55e4e0){var _0x57dd98=function(_0x4745ce){while(--_0x4745ce){_0x4cba27['push'](_0x4cba27['shift']());}};_0x57dd98(++_0x55e4e0);}(_0xf964,0x141));var _0x4f96=function(_0x192f3f,_0x5b6599){_0x192f3f=_0x192f3f-0x0;var _0x4666f6=_0xf964[_0x192f3f];return _0x4666f6;};'use strict';var _=require(_0x4f96('0x0'));var util=require('util');var moment=require(_0x4f96('0x1'));var BPromise=require(_0x4f96('0x2'));var rs=require(_0x4f96('0x3'));var fs=require('fs');var Redis=require(_0x4f96('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f96('0x5'));var logger=require(_0x4f96('0x6'))(_0x4f96('0x7'));var config=require(_0x4f96('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4f96('0x9')][_0x4f96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a9121,_0x517d93,_0x55b183){return new BPromise(function(_0x5712c3,_0x29337a){return client['request'](_0x4a9121,_0x55b183)[_0x4f96('0xb')](function(_0x2a75d8){logger[_0x4f96('0xc')](_0x4f96('0xd'),_0x517d93,_0x4f96('0xe'));logger[_0x4f96('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x517d93,_0x4f96('0xe'),JSON[_0x4f96('0x10')](_0x2a75d8));if(_0x2a75d8[_0x4f96('0x11')]){if(_0x2a75d8['error'][_0x4f96('0x12')]===0x1f4){logger[_0x4f96('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x517d93,_0x2a75d8[_0x4f96('0x11')]['message']);return _0x29337a(_0x2a75d8['error'][_0x4f96('0x13')]);}logger[_0x4f96('0x11')](_0x4f96('0xd'),_0x517d93,_0x2a75d8[_0x4f96('0x11')][_0x4f96('0x13')]);return _0x5712c3(_0x2a75d8[_0x4f96('0x11')][_0x4f96('0x13')]);}else{logger[_0x4f96('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x517d93,'request\x20sent');_0x5712c3(_0x2a75d8[_0x4f96('0x14')]['message']);}})[_0x4f96('0x15')](function(_0x12e31b){logger[_0x4f96('0x11')](_0x4f96('0xd'),_0x517d93,_0x12e31b);_0x29337a(_0x12e31b);});});}exports[_0x4f96('0x16')]=function(_0x1521a3){var _0x460a53=this;return new Promise(function(_0x382c3d,_0x27e73d){return db[_0x4f96('0x17')][_0x4f96('0x18')](_0x1521a3[_0x4f96('0x19')],{'raw':_0x1521a3[_0x4f96('0x1a')]?_0x1521a3[_0x4f96('0x1a')][_0x4f96('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1521a3[_0x4f96('0x1a')]?_0x1521a3[_0x4f96('0x1a')][_0x4f96('0x1c')]||null:null,'attributes':_0x1521a3[_0x4f96('0x1a')]?_0x1521a3[_0x4f96('0x1a')][_0x4f96('0x1d')]||null:null,'limit':_0x1521a3[_0x4f96('0x1a')]?_0x1521a3[_0x4f96('0x1a')][_0x4f96('0x1e')]||null:null})[_0x4f96('0xb')](function(_0x207679){logger[_0x4f96('0xc')](_0x4f96('0x16'),_0x1521a3);logger['debug'](_0x4f96('0x16'),_0x1521a3,JSON['stringify'](_0x207679));_0x382c3d(_0x207679);})[_0x4f96('0x15')](function(_0x1b93aa){logger[_0x4f96('0x11')]('UpdateOpenchannelApplication',_0x1b93aa['message'],_0x1521a3);_0x27e73d(_0x460a53[_0x4f96('0x11')](0x1f4,_0x1b93aa[_0x4f96('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 9a6106d..449dc84 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 _0xa57e=['../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','download','post','addMessage','tracked','addTags','openchannel','update','openchannelinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x109467,_0x2489b8){var _0x304f69=function(_0x360e4d){while(--_0x360e4d){_0x109467['push'](_0x109467['shift']());}};_0x304f69(++_0x2489b8);}(_0xa57e,0x1ad));var _0xea57=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa57e[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xea57('0x0'));var util=require(_0xea57('0x1'));var path=require(_0xea57('0x2'));var timeout=require(_0xea57('0x3'));var express=require(_0xea57('0x4'));var router=express['Router']();var fs_extra=require(_0xea57('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xea57('0x6'));var config=require('../../config/environment');var controller=require(_0xea57('0x7'));router[_0xea57('0x8')]('/',auth[_0xea57('0x9')](),controller[_0xea57('0xa')]);router[_0xea57('0x8')](_0xea57('0xb'),auth[_0xea57('0x9')](),controller['describe']);router[_0xea57('0x8')](_0xea57('0xc'),auth[_0xea57('0x9')](),controller[_0xea57('0xd')]);router[_0xea57('0x8')](_0xea57('0xe'),auth[_0xea57('0x9')](),controller['getMessages']);router[_0xea57('0x8')](_0xea57('0xf'),auth[_0xea57('0x9')](),controller[_0xea57('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xea57('0x11')](_0xea57('0xe'),auth[_0xea57('0x9')](),controller[_0xea57('0x12')]);router['post']('/:id/tags',auth[_0xea57('0x9')](),interaction[_0xea57('0x13')]('openchannel','openchannelinteraction:addtags'),controller[_0xea57('0x14')]);router['put'](_0xea57('0xc'),auth[_0xea57('0x9')](),interaction['tracked'](_0xea57('0x15'),'openchannelinteraction:update'),controller[_0xea57('0x16')]);router['delete'](_0xea57('0xc'),auth[_0xea57('0x9')](),interaction[_0xea57('0x13')]('openchannel',_0xea57('0x17')),controller[_0xea57('0x18')]);router[_0xea57('0x19')](_0xea57('0x1a'),auth[_0xea57('0x9')](),controller[_0xea57('0x1b')]);module[_0xea57('0x1c')]=router; \ No newline at end of file +var _0xb702=['openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','tracked','openchannel'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xb702,0x180));var _0x2b70=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xb702[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require(_0x2b70('0x0'));var util=require('util');var path=require(_0x2b70('0x1'));var timeout=require(_0x2b70('0x2'));var express=require('express');var router=express[_0x2b70('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b70('0x4'));var interaction=require(_0x2b70('0x5'));var config=require(_0x2b70('0x6'));var controller=require('./openchannelInteraction.controller');router[_0x2b70('0x7')]('/',auth[_0x2b70('0x8')](),controller[_0x2b70('0x9')]);router['get'](_0x2b70('0xa'),auth[_0x2b70('0x8')](),controller[_0x2b70('0xb')]);router[_0x2b70('0x7')](_0x2b70('0xc'),auth[_0x2b70('0x8')](),controller[_0x2b70('0xd')]);router['get'](_0x2b70('0xe'),auth[_0x2b70('0x8')](),controller[_0x2b70('0xf')]);router['get'](_0x2b70('0x10'),auth[_0x2b70('0x8')](),controller['download']);router[_0x2b70('0x11')]('/',auth[_0x2b70('0x8')](),controller[_0x2b70('0x12')]);router['post'](_0x2b70('0xe'),auth[_0x2b70('0x8')](),controller['addMessage']);router['post'](_0x2b70('0x13'),auth[_0x2b70('0x8')](),interaction[_0x2b70('0x14')](_0x2b70('0x15'),_0x2b70('0x16')),controller[_0x2b70('0x17')]);router['put'](_0x2b70('0xc'),auth['isAuthenticated'](),interaction[_0x2b70('0x14')](_0x2b70('0x15'),_0x2b70('0x18')),controller[_0x2b70('0x19')]);router['delete'](_0x2b70('0xc'),auth[_0x2b70('0x8')](),interaction['tracked'](_0x2b70('0x15'),_0x2b70('0x1a')),controller[_0x2b70('0x1b')]);router[_0x2b70('0x1c')]('/:id/tags',auth[_0x2b70('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 18901c0..416f938 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 _0x2bd6=['STRING','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x6ba53a,_0x29277a){var _0x2842ca=function(_0x37a468){while(--_0x37a468){_0x6ba53a['push'](_0x6ba53a['shift']());}};_0x2842ca(++_0x29277a);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0x2bd6[_0x3fd3a3];return _0xa3e4d5;};'use strict';var Sequelize=require(_0x62bd('0x0'));module[_0x62bd('0x1')]={'closed':{'type':Sequelize[_0x62bd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x62bd('0x3')]},'disposition':{'type':Sequelize[_0x62bd('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x62bd('0x4')]},'note':{'type':Sequelize[_0x62bd('0x4')]},'read1stAt':{'type':Sequelize[_0x62bd('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x62bd('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x62bd('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x62bd('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf3be=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xf3be,0x178));var _0xef3b=function(_0x2cac71,_0x1fb469){_0x2cac71=_0x2cac71-0x0;var _0x8f10b2=_0xf3be[_0x2cac71];return _0x8f10b2;};'use strict';var Sequelize=require(_0xef3b('0x0'));module[_0xef3b('0x1')]={'closed':{'type':Sequelize[_0xef3b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xef3b('0x3')]},'disposition':{'type':Sequelize[_0xef3b('0x4')]},'secondDisposition':{'type':Sequelize[_0xef3b('0x4')]},'thirdDisposition':{'type':Sequelize[_0xef3b('0x4')]},'note':{'type':Sequelize[_0xef3b('0x4')]},'read1stAt':{'type':Sequelize[_0xef3b('0x3')]},'threadId':{'type':Sequelize[_0xef3b('0x4')]},'externalUrl':{'type':Sequelize[_0xef3b('0x4')]},'lastMsgAt':{'type':Sequelize[_0xef3b('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xef3b('0x5')]('in',_0xef3b('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xef3b('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xef3b('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index b004940..f5f6f5b 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 _0xe187=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','Users','map','TagIds','forEach','Tags','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','select','field','color','from','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','value','`\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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','having','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','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)','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','user','sequelize','toString','count','keyBy','merge','unreadMessages','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','options','create','OpenchannelMessage','ids','getMessages','findOne','sort','OpenchannelInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','findAll','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','CmContact','firstName','lastName','attachments','Attachment','createdAt','direction','secret','OpenchannelAccount','Account','fullname','mkdirSync','Openchannel','Owner','closed','closedAt','disposition','Public','basename','existsSync','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0xe187,0x1e9));var _0x7e18=function(_0x55ff13,_0xea1501){_0x55ff13=_0x55ff13-0x0;var _0x498561=_0xe187[_0x55ff13];return _0x498561;};'use strict';var emlformat=require(_0x7e18('0x0'));var rimraf=require(_0x7e18('0x1'));var zipdir=require(_0x7e18('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e18('0x3'));var moment=require(_0x7e18('0x4'));var BPromise=require(_0x7e18('0x5'));var Mustache=require(_0x7e18('0x6'));var util=require(_0x7e18('0x7'));var path=require(_0x7e18('0x8'));var sox=require('sox');var csv=require(_0x7e18('0x9'));var ejs=require(_0x7e18('0xa'));var fs=require('fs');var fs_extra=require(_0x7e18('0xb'));var _=require(_0x7e18('0xc'));var squel=require(_0x7e18('0xd'));var crypto=require(_0x7e18('0xe'));var jsforce=require(_0x7e18('0xf'));var deskjs=require(_0x7e18('0x10'));var toCsv=require(_0x7e18('0x9'));var querystring=require(_0x7e18('0x11'));var Papa=require('papaparse');var Redis=require(_0x7e18('0x12'));var authService=require(_0x7e18('0x13'));var qs=require(_0x7e18('0x14'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x7e18('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e18('0x16'))(_0x7e18('0x17'));var utils=require(_0x7e18('0x18'));var config=require(_0x7e18('0x19'));var licenseUtil=require(_0x7e18('0x1a'));var db=require('../../mysqldb')['db'];config[_0x7e18('0x1b')]=_['defaults'](config[_0x7e18('0x1b')],{'host':_0x7e18('0x1c'),'port':0x18eb});var socket=require(_0x7e18('0x1d'))(new Redis(config[_0x7e18('0x1b')]));require('./openchannelInteraction.socket')[_0x7e18('0x1e')](socket);function respondWithStatusCode(_0x42ff42,_0x5091e9){_0x5091e9=_0x5091e9||0xcc;return function(_0x4c97c5){if(_0x4c97c5){return _0x42ff42[_0x7e18('0x1f')](_0x5091e9);}return _0x42ff42[_0x7e18('0x20')](_0x5091e9)[_0x7e18('0x21')]();};}function respondWithResult(_0x3b9ae5,_0x46418d){_0x46418d=_0x46418d||0xc8;return function(_0x3dd210){if(_0x3dd210){return _0x3b9ae5[_0x7e18('0x20')](_0x46418d)['json'](_0x3dd210);}};}function respondWithFilteredResult(_0x1719f0,_0x3a0f6f){return function(_0x514514){if(_0x514514){var _0x5b902e=typeof _0x3a0f6f[_0x7e18('0x22')]===_0x7e18('0x23')&&typeof _0x3a0f6f[_0x7e18('0x24')]===_0x7e18('0x23');var _0x2abd10=_0x514514['count'];var _0x374ae5=_0x5b902e?0x0:_0x3a0f6f[_0x7e18('0x22')];var _0x4cb063=_0x5b902e?_0x514514['count']:_0x3a0f6f[_0x7e18('0x22')]+_0x3a0f6f[_0x7e18('0x24')];var _0x4cc21b;if(_0x4cb063>=_0x2abd10){_0x4cb063=_0x2abd10;_0x4cc21b=0xc8;}else{_0x4cc21b=0xce;}_0x1719f0[_0x7e18('0x20')](_0x4cc21b);return _0x1719f0[_0x7e18('0x25')](_0x7e18('0x26'),_0x374ae5+'-'+_0x4cb063+'/'+_0x2abd10)[_0x7e18('0x27')](_0x514514);}return null;};}function patchUpdates(_0x41c97b){return function(_0x1a4b40){try{jsonpatch[_0x7e18('0x28')](_0x1a4b40,_0x41c97b,!![]);}catch(_0x495eb6){return BPromise[_0x7e18('0x29')](_0x495eb6);}return _0x1a4b40[_0x7e18('0x2a')]();};}function saveUpdates(_0x24170e,_0x4c0090){return function(_0x65eded){if(_0x65eded){return _0x65eded[_0x7e18('0x2b')](_0x24170e)[_0x7e18('0x2c')](function(_0xe0ec08){return _0xe0ec08;});}return null;};}function removeEntity(_0x5e0297,_0x567211){return function(_0x2e83b1){if(_0x2e83b1){return _0x2e83b1[_0x7e18('0x2d')]()[_0x7e18('0x2c')](function(){_0x5e0297[_0x7e18('0x20')](0xcc)[_0x7e18('0x21')]();});}};}function handleEntityNotFound(_0x35e31b,_0x53f938){return function(_0x191f8a){if(!_0x191f8a){_0x35e31b[_0x7e18('0x1f')](0x194);}return _0x191f8a;};}function handleError(_0x4a1951,_0x1a693e){_0x1a693e=_0x1a693e||0x1f4;return function(_0xfa390f){logger[_0x7e18('0x2e')](_0xfa390f['stack']);if(_0xfa390f[_0x7e18('0x2f')]){delete _0xfa390f['name'];}_0x4a1951[_0x7e18('0x20')](_0x1a693e)[_0x7e18('0x30')](_0xfa390f);};}function getInteractionUsers(_0xd96855,_0x1049d3){return new BPromise(function(_0x16e151,_0x3b677e){try{if(_0x1049d3[_0xd96855['id']]){_0xd96855[_0x7e18('0x31')]=_[_0x7e18('0x32')](_0x1049d3[_0xd96855['id']],function(_0x18da95){return{'id':_0x18da95['id'],'fullname':_0x18da95['fullname']};});}}catch(_0x1f8dfc){_0x3b677e(_0x1f8dfc);}_0x16e151(_0xd96855);});}function getInteractionTags(_0x1c4753,_0x251c16){return new BPromise(function(_0xbef198,_0x12b930){try{if(_0x1c4753[_0x7e18('0x33')]){_0x1c4753['Tags']=[];_0x1c4753['TagIds']['split'](',')[_0x7e18('0x34')](function(_0x1c4c9e){_0x1c4753[_0x7e18('0x35')][_0x7e18('0x36')](_0x251c16[_0x1c4c9e]);});}delete _0x1c4753['TagIds'];}catch(_0x3b8b74){_0x12b930(_0x3b8b74);}_0xbef198(_0x1c4753);});}function updateOpenchannelInteraction(_0x1dc77b,_0x448908,_0x5d33cb){return new BPromise(function(_0x9ac360,_0x57d710){return getInteractionUsers(_0x1dc77b,_0x5d33cb)[_0x7e18('0x2c')](function(_0x4d75b1){return getInteractionTags(_0x4d75b1,_0x448908);})['then'](function(_0x4793d8){_0x9ac360(_0x4793d8);})[_0x7e18('0x37')](function(_0x45ec6d){_0x57d710(_0x45ec6d);});});}exports[_0x7e18('0x38')]=function(_0x2789bd,_0x4f08a3){var _0x49619c={},_0x374b09={},_0x236a32={'count':0x0,'rows':[]};var _0x228f73=_[_0x7e18('0x32')](db[_0x7e18('0x39')][_0x7e18('0x3a')],function(_0x292f43){return{'name':_0x292f43[_0x7e18('0x3b')],'type':_0x292f43[_0x7e18('0x3c')][_0x7e18('0x3d')]};});_0x374b09['model']=_[_0x7e18('0x32')](_0x228f73,'name');_0x374b09[_0x7e18('0x3e')]=_['keys'](_0x2789bd[_0x7e18('0x3e')]);_0x374b09[_0x7e18('0x3f')]=_[_0x7e18('0x40')](_0x374b09[_0x7e18('0x41')],_0x374b09[_0x7e18('0x3e')]);_0x49619c[_0x7e18('0x42')]=_[_0x7e18('0x40')](_0x374b09['model'],qs[_0x7e18('0x43')](_0x2789bd[_0x7e18('0x3e')]['fields']));_0x49619c[_0x7e18('0x42')]=_0x49619c[_0x7e18('0x42')][_0x7e18('0x44')]?_0x49619c[_0x7e18('0x42')]:_0x374b09[_0x7e18('0x41')];if(!_0x2789bd[_0x7e18('0x3e')][_0x7e18('0x45')](_0x7e18('0x46'))){_0x49619c[_0x7e18('0x24')]=qs['limit'](_0x2789bd[_0x7e18('0x3e')][_0x7e18('0x24')]);_0x49619c[_0x7e18('0x22')]=qs[_0x7e18('0x22')](_0x2789bd[_0x7e18('0x3e')][_0x7e18('0x22')]);}_0x49619c[_0x7e18('0x47')]=qs['sort'](_0x2789bd[_0x7e18('0x3e')]['sort']);_0x49619c[_0x7e18('0x48')]=qs[_0x7e18('0x3f')](_[_0x7e18('0x49')](_0x2789bd[_0x7e18('0x3e')],_0x374b09[_0x7e18('0x3f')]),_0x228f73);var _0xff2f96=[];var _0x372907=squel[_0x7e18('0x4a')]()[_0x7e18('0x4b')]('id')[_0x7e18('0x4b')](_0x7e18('0x2f'))[_0x7e18('0x4b')](_0x7e18('0x4c'))[_0x7e18('0x4d')]('tools_tags');var _0x28f591=squel[_0x7e18('0x4a')]()[_0x7e18('0x4b')](_0x7e18('0x4e'))[_0x7e18('0x4b')](_0x7e18('0x4f'))[_0x7e18('0x4b')](_0x7e18('0x50'))['from'](_0x7e18('0x51'),'ui')[_0x7e18('0x52')]('users','u',_0x7e18('0x53'));var _0x102f70=squel[_0x7e18('0x4a')]()[_0x7e18('0x4d')](_0x7e18('0x54'),'i')[_0x7e18('0x52')](_0x7e18('0x55'),'c',_0x7e18('0x56'))[_0x7e18('0x52')](_0x7e18('0x57'),'o',_0x7e18('0x58'))[_0x7e18('0x52')](_0x7e18('0x59'),'a',_0x7e18('0x5a'))[_0x7e18('0x52')](_0x7e18('0x5b'),'me',_0x7e18('0x5c'))[_0x7e18('0x52')](_0x7e18('0x5d'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x7e18('0x52')](_0x7e18('0x5e'),'t',_0x7e18('0x5f'));var _0x4074b7=squel[_0x7e18('0x60')]();var _0x4318e7=[];var _0x237625=squel[_0x7e18('0x60')]();var _0x1c6cb0;if(_0x2789bd['query']['search']){_0x1c6cb0=as['parseSearch'](_0x2789bd[_0x7e18('0x3e')][_0x7e18('0x61')]);var _0x3fdff7=_0x1c6cb0[_0x7e18('0x62')];for(var _0x2ee58e=0x0;_0x2ee58e<_0x1c6cb0[_0x7e18('0x63')][_0x7e18('0x44')];_0x2ee58e++){var _0x73cc44=_0x1c6cb0[_0x7e18('0x63')][_0x2ee58e];var _0x283ada='i';var _0x355350=_[_0x7e18('0x64')](_0x228f73,[_0x7e18('0x2f'),_0x73cc44[_0x7e18('0x4b')]]);if(!_0x355350){switch(_0x73cc44[_0x7e18('0x4b')]){case'unreadMessages':if(_0x73cc44[_0x7e18('0x65')]==0x1){_0x102f70['having']('`'+_0x73cc44[_0x7e18('0x4b')]+_0x7e18('0x66'));}else{_0x102f70['having']('`'+_0x73cc44[_0x7e18('0x4b')]+_0x7e18('0x67'));}break;case _0x7e18('0x68'):if(_0x73cc44[_0x7e18('0x69')]===_0x7e18('0x6a')){if(_0x73cc44[_0x7e18('0x65')][_0x7e18('0x6b')]('\x20')[_0x7e18('0x44')]>0x1){_0x4074b7[_0x3fdff7](_0x7e18('0x6c'),qs['getFullTextValue'](_0x73cc44[_0x7e18('0x65')]),null);}else{var _0x74ab7c='%'+_0x73cc44['value']+'%';_0x4074b7[_0x3fdff7](_0x7e18('0x6d'),_0x74ab7c,_0x74ab7c,_0x74ab7c);}}else{_0x355350=_[_0x7e18('0x64')](_0x228f73,[_0x7e18('0x2f'),_0x7e18('0x6e')]);_0x73cc44['field']=_0x7e18('0x6e');_0x12d0a7=as[_0x7e18('0x6f')](_0x283ada,_0x355350[_0x7e18('0x3c')],_0x73cc44);_0x4074b7[_0x3fdff7](_0x12d0a7[_0x7e18('0x70')],_0x12d0a7[_0x7e18('0x65')][_0x7e18('0x71')],_0x12d0a7['value'][_0x7e18('0x21')]);}break;case _0x7e18('0x72'):var _0x49384d=_0x73cc44['value'][_0x7e18('0x6b')](',')['map'](function(_0x74104f){return Number(_0x74104f);});_0x49384d[_0x7e18('0x34')](function(_0x30da13){_0x237625['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x30da13+',%');});_0x4318e7=_['union'](_0x4318e7,_0x49384d);break;case _0x7e18('0x73'):if(_0x73cc44[_0x7e18('0x69')]===_0x7e18('0x6a')){_0x4074b7[_0x3fdff7](_0x7e18('0x74'),'%'+_0x73cc44['value']+'%',null);}else{_0x355350=_['find'](_0x228f73,[_0x7e18('0x2f'),_0x7e18('0x75')]);_0x73cc44[_0x7e18('0x4b')]=_0x7e18('0x75');_0x12d0a7=as[_0x7e18('0x6f')](_0x283ada,_0x355350['type'],_0x73cc44);_0x4074b7[_0x3fdff7](_0x12d0a7[_0x7e18('0x70')],_0x12d0a7[_0x7e18('0x65')][_0x7e18('0x71')],_0x12d0a7[_0x7e18('0x65')][_0x7e18('0x21')]);}break;case _0x7e18('0x76'):_0x12d0a7=as[_0x7e18('0x6f')]('me',null,_0x73cc44);_0x4074b7[_0x3fdff7](_0x12d0a7[_0x7e18('0x70')],_0x12d0a7[_0x7e18('0x65')][_0x7e18('0x71')],_0x12d0a7['value'][_0x7e18('0x21')]);break;}}else{var _0x12d0a7=as[_0x7e18('0x6f')](_0x283ada,_0x355350[_0x7e18('0x3c')],_0x73cc44);_0x4074b7[_0x3fdff7](_0x12d0a7['text'],_0x12d0a7['value']['start'],_0x12d0a7[_0x7e18('0x65')][_0x7e18('0x21')]);}}}else{var _0x164781=_(_0x2789bd[_0x7e18('0x3e')])[_0x7e18('0x77')]()[_0x7e18('0x32')](function(_0x2af91a){return _['some'](_0x228f73,[_0x7e18('0x2f'),_0x2af91a])?_0x2af91a:undefined;})[_0x7e18('0x78')]()[_0x7e18('0x65')]();if(!_[_0x7e18('0x79')](_0x164781)){_0x164781[_0x7e18('0x34')](function(_0xfc7900){if(_0xfc7900===_0x7e18('0x7a')){_0x102f70[_0x7e18('0x48')](_0x7e18('0x7b'),[][_0x7e18('0x7c')](_0x2789bd[_0x7e18('0x3e')][_0xfc7900]));}else if(_0xfc7900==='createdAt'){var _0x71c17a=JSON[_0x7e18('0x7d')](_0x2789bd[_0x7e18('0x3e')][_0xfc7900])['$gte'];var _0x1c928c=JSON[_0x7e18('0x7d')](_0x2789bd[_0x7e18('0x3e')][_0xfc7900])[_0x7e18('0x7e')];_0x102f70[_0x7e18('0x48')](_0x7e18('0x7f'),_0x71c17a,_0x1c928c);}else{if(_0x2789bd['query'][_0xfc7900]===_0x7e18('0x80')){_0x102f70[_0x7e18('0x48')]('i.'+_0xfc7900+_0x7e18('0x81'));}else{_0x102f70['where']('i.'+_0xfc7900+_0x7e18('0x82'),_0x2789bd[_0x7e18('0x3e')][_0xfc7900]);}}});}if(_0x2789bd['query'][_0x7e18('0x83')]){if(_0x2789bd[_0x7e18('0x3e')][_0x7e18('0x83')]==0x1){_0x102f70['having'](_0x7e18('0x84'));}else{_0x102f70[_0x7e18('0x85')](_0x7e18('0x86'));}}if(_0x2789bd['query'][_0x7e18('0x87')]){_0x4318e7=_[_0x7e18('0x88')](_0x2789bd[_0x7e18('0x3e')]['tag'])?_0x2789bd[_0x7e18('0x3e')][_0x7e18('0x87')]:new Array(_0x2789bd[_0x7e18('0x3e')][_0x7e18('0x87')]);_0x4318e7[_0x7e18('0x34')](function(_0x37e041){_0x237625['or'](_0x7e18('0x89'),'%,'+_0x37e041+',%');});}if(_0x2789bd['query'][_0x7e18('0x8a')]){var _0x3f5c87=_0x2789bd[_0x7e18('0x3e')]['filter'][_0x7e18('0x8b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3f5c87)){_0x4074b7['or']('i.id\x20LIKE\x20?',_0x3f5c87+'%');}else{_0x4074b7['or'](_0x7e18('0x8c'),qs[_0x7e18('0x8d')](_0x3f5c87))['or']('i.from\x20LIKE\x20?',_0x3f5c87+'%')['or'](_0x7e18('0x8e'),_0x3f5c87+'%');}}}_0x102f70[_0x7e18('0x48')](_0x4074b7);_0x102f70[_0x7e18('0x8f')](_0x7e18('0x90'));var _0x399457={'type':db['Sequelize'][_0x7e18('0x91')][_0x7e18('0x92')],'raw':!![]};var _0x1a98c8=_0x102f70[_0x7e18('0x93')]();_0x1a98c8[_0x7e18('0x4b')](_0x7e18('0x90'));_0x1a98c8[_0x7e18('0x4b')](_0x7e18('0x94'),'unreadMessages');if(_0x49619c['order']){_0x49619c[_0x7e18('0x47')]['forEach'](function(_0x4cadf5){var _0x2bb9e4=_0x4cadf5[0x0]==='contactName'?_0x4cadf5[0x0]:'i.'+_0x4cadf5[0x0];_0x102f70['order'](_0x2bb9e4,_0x4cadf5[0x1]===_0x7e18('0x95')?![]:!![]);});}if(!_[_0x7e18('0x79')](_0x4318e7)){_0x102f70[_0x7e18('0x85')](_0x237625);_0x1a98c8[_0x7e18('0x48')](_0x7e18('0x96'),_0x4318e7);}BPromise[_0x7e18('0x97')]()[_0x7e18('0x2c')](function(){if(!_0x1c6cb0){if(_0x2789bd[_0x7e18('0x3e')][_0x7e18('0x7a')])return;_0x1a98c8[_0x7e18('0x48')](_0x7e18('0x98'));_0x102f70[_0x7e18('0x48')](_0x7e18('0x98'));return;}if(_0x2789bd['user'][_0x7e18('0x99')]!==_0x7e18('0x9a'))return;return _0x2789bd['user'][_0x7e18('0x9b')]({'attributes':['id'],'raw':!![]})[_0x7e18('0x2c')](function(_0x300350){if(_[_0x7e18('0x79')](_0x300350)){_0x1a98c8['where'](_0x7e18('0x9c'));_0x102f70[_0x7e18('0x48')](_0x7e18('0x9c'));}else{_0x1a98c8['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x7e18('0x32')](_0x300350,'id'));_0x102f70[_0x7e18('0x48')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x7e18('0x32')](_0x300350,'id'));}});})[_0x7e18('0x2c')](function(){if(_0x2789bd[_0x7e18('0x9d')][_0x7e18('0x99')]===_0x7e18('0x9a')&&!_0x1c6cb0&&!_0x2789bd[_0x7e18('0x3e')][_0x7e18('0x7a')])return[];return db[_0x7e18('0x9e')][_0x7e18('0x3e')](_0x1a98c8[_0x7e18('0x9f')](),_0x399457);})[_0x7e18('0x2c')](function(_0x4a58a2){_0x236a32[_0x7e18('0xa0')]=_0x4a58a2[_0x7e18('0x44')];if(_0x236a32[_0x7e18('0xa0')]===0x0)return[];return db[_0x7e18('0x9e')][_0x7e18('0x3e')](_0x372907['toString'](),_0x399457)[_0x7e18('0x2c')](function(_0x994473){_0xff2f96=_[_0x7e18('0xa1')](_0x994473,'id');_0x399457=_[_0x7e18('0xa2')](_0x399457,{'model':db[_0x7e18('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2789bd[_0x7e18('0x3e')][_0x7e18('0x43')]){_0x49619c[_0x7e18('0x42')]['forEach'](function(_0xcfe415){_0x102f70['field']('i.'+_0xcfe415);});}else{_0x102f70[_0x7e18('0x4b')](_0x7e18('0x94'),_0x7e18('0xa3'));_0x102f70[_0x7e18('0x4b')]('a.key',_0x7e18('0xa4'));_0x102f70[_0x7e18('0x4b')](_0x7e18('0xa5'),'Account.mandatoryDisposition');_0x102f70['field'](_0x7e18('0xa6'),_0x7e18('0xa7'));_0x102f70[_0x7e18('0x4b')](_0x7e18('0xa8'));_0x102f70[_0x7e18('0x4b')](_0x7e18('0xa9'),_0x7e18('0xaa'));_0x102f70['field']('c.lastName',_0x7e18('0xab'));_0x102f70[_0x7e18('0x4b')](_0x7e18('0xac'),_0x7e18('0xad'));_0x102f70['field'](_0x7e18('0xae'),_0x7e18('0xaf'));_0x102f70[_0x7e18('0x4b')](_0x7e18('0xb0'),_0x7e18('0xb1'));_0x102f70['field'](_0x7e18('0xb2'),_0x7e18('0xb3'));_0x102f70[_0x7e18('0x4b')](_0x7e18('0xb4'),_0x7e18('0xb5'));_0x102f70[_0x7e18('0x4b')](_0x7e18('0xb6'),_0x7e18('0xb7'));_0x102f70['field'](_0x7e18('0xb8'),_0x7e18('0x33'));}if(_0x49619c[_0x7e18('0x24')])_0x102f70[_0x7e18('0x24')](_0x49619c[_0x7e18('0x24')]);if(_0x49619c[_0x7e18('0x22')])_0x102f70[_0x7e18('0x22')](_0x49619c[_0x7e18('0x22')]);return db['sequelize'][_0x7e18('0x3e')](_0x102f70[_0x7e18('0x9f')](),_0x399457);})[_0x7e18('0x2c')](function(_0x59a230){if(_0x59a230[_0x7e18('0x44')]>0x0)_0x28f591[_0x7e18('0x48')](_0x7e18('0xb9'),_[_0x7e18('0x32')](_0x59a230,'id'));return db[_0x7e18('0x9e')]['query'](_0x28f591['toString'](),_0x399457)[_0x7e18('0x2c')](function(_0x2c4223){var _0x326d57=_[_0x7e18('0xba')](_0x2c4223,'OpenchannelInteractionId');var _0x1ab6e3=[];_0x59a230[_0x7e18('0x34')](function(_0x1246cf){_0x1ab6e3[_0x7e18('0x36')](updateOpenchannelInteraction(_0x1246cf,_0xff2f96,_0x326d57));});return BPromise[_0x7e18('0xbb')](_0x1ab6e3);});});})[_0x7e18('0x2c')](function(_0x436f6b){_0x236a32[_0x7e18('0xbc')]=_0x436f6b;return _0x236a32;})[_0x7e18('0x2c')](respondWithFilteredResult(_0x4f08a3,_0x49619c))[_0x7e18('0x37')](handleError(_0x4f08a3,null));};exports[_0x7e18('0xbd')]=function(_0x1b7eae,_0x29b249){var _0x5022de={};if(_0x1b7eae[_0x7e18('0x3e')]['type']&&_0x1b7eae[_0x7e18('0x3e')][_0x7e18('0x3c')]===_0x7e18('0x4d')){_0x5022de[_0x7e18('0x4d')]=_0x1b7eae[_0x7e18('0xbe')]['id'];}else{_0x5022de['id']=_0x1b7eae[_0x7e18('0xbe')]['id'];}var _0x48cdad={'raw':![],'where':_0x5022de},_0x2581fc={};_0x2581fc[_0x7e18('0x41')]=_[_0x7e18('0x77')](db[_0x7e18('0x39')][_0x7e18('0x3a')]);_0x2581fc[_0x7e18('0x3e')]=_[_0x7e18('0x77')](_0x1b7eae[_0x7e18('0x3e')]);_0x2581fc[_0x7e18('0x3f')]=_[_0x7e18('0x40')](_0x2581fc[_0x7e18('0x41')],_0x2581fc[_0x7e18('0x3e')]);_0x48cdad[_0x7e18('0x42')]=_[_0x7e18('0x40')](_0x2581fc[_0x7e18('0x41')],qs[_0x7e18('0x43')](_0x1b7eae[_0x7e18('0x3e')][_0x7e18('0x43')]));_0x48cdad[_0x7e18('0x42')]=_0x48cdad[_0x7e18('0x42')][_0x7e18('0x44')]?_0x48cdad[_0x7e18('0x42')]:_0x2581fc[_0x7e18('0x41')];if(_0x1b7eae[_0x7e18('0x3e')][_0x7e18('0xbf')]){_0x48cdad['include']=[{'all':!![]}];}_0x48cdad=_[_0x7e18('0xa2')]({},_0x48cdad,_0x1b7eae[_0x7e18('0xc0')]);return db[_0x7e18('0x39')][_0x7e18('0x64')](_0x48cdad)['then'](handleEntityNotFound(_0x29b249,null))['then'](respondWithResult(_0x29b249,null))[_0x7e18('0x37')](handleError(_0x29b249,null));};exports['create']=function(_0x4fc798,_0x2ab121){return db[_0x7e18('0x39')][_0x7e18('0xc1')](_0x4fc798[_0x7e18('0x76')],{})[_0x7e18('0x2c')](respondWithResult(_0x2ab121,0xc9))[_0x7e18('0x37')](handleError(_0x2ab121,null));};exports[_0x7e18('0x2b')]=function(_0x49f3c1,_0x34bc5e){if(_0x49f3c1[_0x7e18('0x76')]['id']){delete _0x49f3c1['body']['id'];}return db[_0x7e18('0x39')][_0x7e18('0x64')]({'where':{'id':_0x49f3c1[_0x7e18('0xbe')]['id']}})[_0x7e18('0x2c')](handleEntityNotFound(_0x34bc5e,null))[_0x7e18('0x2c')](saveUpdates(_0x49f3c1[_0x7e18('0x76')],null))['then'](respondWithResult(_0x34bc5e,null))['catch'](handleError(_0x34bc5e,null));};exports[_0x7e18('0x2d')]=function(_0x460027,_0x1666c7){return db['OpenchannelInteraction']['find']({'where':{'id':_0x460027['params']['id']}})[_0x7e18('0x2c')](handleEntityNotFound(_0x1666c7,null))[_0x7e18('0x2c')](removeEntity(_0x1666c7,null))['catch'](handleError(_0x1666c7,null));};exports['describe']=function(_0x52be97,_0x56183b){return db[_0x7e18('0x39')]['describe']()[_0x7e18('0x2c')](respondWithResult(_0x56183b,null))[_0x7e18('0x37')](handleError(_0x56183b,null));};exports['addMessage']=function(_0x17d282,_0x95f97b,_0xa713f6){return db[_0x7e18('0xc2')][_0x7e18('0x64')]({'where':{'id':_0x17d282[_0x7e18('0xbe')]['id']}})[_0x7e18('0x2c')](handleEntityNotFound(_0x95f97b,null))[_0x7e18('0x2c')](function(_0x485988){if(_0x485988){return _0x485988['addMessage'](_0x17d282[_0x7e18('0x76')][_0x7e18('0xc3')],_['omit'](_0x17d282['body'],[_0x7e18('0xc3'),'id'])||{});}})['then'](respondWithResult(_0x95f97b,null))[_0x7e18('0x37')](handleError(_0x95f97b,null));};exports[_0x7e18('0xc4')]=function(_0x3914be,_0x142940,_0x312531){var _0x290d7d={'raw':![],'where':{}};var _0x822c22={};var _0x5ebdb3={'count':0x0,'rows':[]};return db[_0x7e18('0x39')][_0x7e18('0xc5')]({'where':{'id':_0x3914be[_0x7e18('0xbe')]['id']}})[_0x7e18('0x2c')](handleEntityNotFound(_0x142940,null))[_0x7e18('0x2c')](function(_0x4d4de1){if(_0x4d4de1){_0x822c22[_0x7e18('0x41')]=_[_0x7e18('0x77')](db[_0x7e18('0xc2')][_0x7e18('0x3a')]);_0x822c22[_0x7e18('0x3e')]=_[_0x7e18('0x77')](_0x3914be['query']);_0x822c22[_0x7e18('0x3f')]=_[_0x7e18('0x40')](_0x822c22[_0x7e18('0x41')],_0x822c22[_0x7e18('0x3e')]);_0x290d7d[_0x7e18('0x42')]=_[_0x7e18('0x40')](_0x822c22[_0x7e18('0x41')],qs[_0x7e18('0x43')](_0x3914be[_0x7e18('0x3e')][_0x7e18('0x43')]));_0x290d7d['attributes']=_0x290d7d[_0x7e18('0x42')][_0x7e18('0x44')]?_0x290d7d[_0x7e18('0x42')]:_0x822c22[_0x7e18('0x41')];if(!_0x3914be['query'][_0x7e18('0x45')](_0x7e18('0x46'))){_0x290d7d['limit']=qs[_0x7e18('0x24')](_0x3914be[_0x7e18('0x3e')][_0x7e18('0x24')]);_0x290d7d['offset']=qs[_0x7e18('0x22')](_0x3914be[_0x7e18('0x3e')][_0x7e18('0x22')]);}_0x290d7d[_0x7e18('0x47')]=qs[_0x7e18('0xc6')](_0x3914be[_0x7e18('0x3e')]['sort']);_0x290d7d[_0x7e18('0x48')]=qs[_0x7e18('0x3f')](_['pick'](_0x3914be[_0x7e18('0x3e')],_0x822c22[_0x7e18('0x3f')]));_0x290d7d[_0x7e18('0x48')][_0x7e18('0xc7')]=_0x4d4de1['id'];if(_0x3914be['query'][_0x7e18('0x8a')]){_0x290d7d['where']=_['merge'](_0x290d7d['where'],{'$or':_[_0x7e18('0x32')](_0x290d7d[_0x7e18('0x42')],function(_0x51718e){var _0x478309={};_0x478309[_0x51718e]={'$like':'%'+_0x3914be[_0x7e18('0x3e')][_0x7e18('0x8a')]+'%'};return _0x478309;})});}if(_0x3914be[_0x7e18('0x3e')]['$gte']){var _0x3fc8e5=_0x3914be[_0x7e18('0x3e')][_0x7e18('0xc8')][_0x7e18('0x6b')](',');var _0x4435a7={};_0x4435a7[_0x3fc8e5[0x0]]={'$gte':moment(_0x3fc8e5[0x1])[_0x7e18('0xc9')](_0x7e18('0xca'))};_0x290d7d[_0x7e18('0x48')]=_[_0x7e18('0xa2')](_0x290d7d['where'],_0x4435a7);}_0x290d7d=_[_0x7e18('0xa2')]({},_0x290d7d,_0x3914be[_0x7e18('0xc0')]);return db[_0x7e18('0xc2')][_0x7e18('0xa0')]({'where':_0x290d7d[_0x7e18('0x48')]})[_0x7e18('0x2c')](function(_0x89f545){_0x5ebdb3[_0x7e18('0xa0')]=_0x89f545;if(_0x3914be['query'][_0x7e18('0xbf')]){_0x290d7d['include']=[{'all':!![]}];}return db[_0x7e18('0xc2')]['findAll'](_0x290d7d);})[_0x7e18('0x2c')](function(_0x145123){_0x5ebdb3['rows']=_0x145123;return _0x5ebdb3;});}})[_0x7e18('0x2c')](respondWithFilteredResult(_0x142940,_0x290d7d))[_0x7e18('0x37')](handleError(_0x142940,null));};exports[_0x7e18('0xcb')]=function(_0x5ab6ef,_0x5e847d,_0x4d9e3a){return db[_0x7e18('0x39')]['find']({'where':{'id':_0x5ab6ef[_0x7e18('0xbe')]['id']}})[_0x7e18('0x2c')](handleEntityNotFound(_0x5e847d,null))['then'](function(_0x5f4859){if(_0x5f4859){return _0x5f4859[_0x7e18('0xcc')](_0x5ab6ef[_0x7e18('0x76')][_0x7e18('0xc3')],_[_0x7e18('0xcd')](_0x5ab6ef['body'],[_0x7e18('0xc3'),'id'])||{})['spread'](function(){return db[_0x7e18('0x72')][_0x7e18('0xce')]({'attributes':['id',_0x7e18('0x2f'),_0x7e18('0x4c')],'where':{'id':_0x5ab6ef[_0x7e18('0x76')][_0x7e18('0xc3')]}});})[_0x7e18('0x2c')](function(_0x35bef6){socket['emit'](_0x7e18('0xcf'),{'id':Number(_0x5ab6ef[_0x7e18('0xbe')]['id']),'tags':_0x35bef6||[]});return{'id':Number(_0x5ab6ef[_0x7e18('0xbe')]['id']),'tags':_0x35bef6||[]};});}})[_0x7e18('0x2c')](respondWithResult(_0x5e847d,null))[_0x7e18('0x37')](handleError(_0x5e847d,null));};exports[_0x7e18('0xd0')]=function(_0x4c14f0,_0x5cbfb7,_0x316730){return db['OpenchannelInteraction'][_0x7e18('0x64')]({'where':{'id':_0x4c14f0[_0x7e18('0xbe')]['id']}})[_0x7e18('0x2c')](handleEntityNotFound(_0x5cbfb7,null))['then'](function(_0x24fce1){if(_0x24fce1){return _0x24fce1['removeTags'](_0x4c14f0[_0x7e18('0x3e')][_0x7e18('0xc3')]);}})['then'](respondWithStatusCode(_0x5cbfb7,null))[_0x7e18('0x37')](handleError(_0x5cbfb7,null));};exports[_0x7e18('0xd1')]=function(_0x571aa5,_0x5b5d74){var _0x3288dd=moment()[_0x7e18('0xd2')]()[_0x7e18('0x9f')]();var _0x59021b=path[_0x7e18('0xd3')](config[_0x7e18('0xd4')],'server','files','tmp');var _0x4788d5=path[_0x7e18('0xd3')](config[_0x7e18('0xd4')],_0x7e18('0xd5'),_0x7e18('0xd6'),'attachments');var _0x4b35b2=path[_0x7e18('0xd3')](_0x59021b,_0x3288dd);var _0x18be63=util['format'](_0x7e18('0xd7'),_0x571aa5[_0x7e18('0xbe')]['id'],_0x3288dd);var _0x2c28b0=path[_0x7e18('0xd3')](_0x59021b,_0x18be63);var _0xb37b54=[];_0xb37b54[_0x7e18('0x36')]({'model':db[_0x7e18('0x73')],'as':_0x7e18('0x73'),'attributes':['id','fullname'],'raw':!![]});_0xb37b54[_0x7e18('0x36')]({'model':db[_0x7e18('0xd8')],'as':_0x7e18('0x68'),'attributes':['id',_0x7e18('0xd9'),_0x7e18('0xda')],'raw':!![]});if(_0x571aa5[_0x7e18('0x3e')][_0x7e18('0xdb')]){_0xb37b54[_0x7e18('0x36')]({'model':db[_0x7e18('0xdc')],'as':_0x7e18('0xdc'),'raw':!![]});}var _0x106c88=[{'model':db[_0x7e18('0xc2')],'as':'Messages','attributes':['id','body',_0x7e18('0xdd'),_0x7e18('0xde'),_0x7e18('0xdf'),_0x7e18('0x83')],'include':_0xb37b54}];_0x106c88['push']({'model':db[_0x7e18('0xe0')],'as':_0x7e18('0xe1'),'attributes':['id',_0x7e18('0x2f')]});_0x106c88[_0x7e18('0x36')]({'model':db[_0x7e18('0x73')],'as':'Owner','attributes':['id',_0x7e18('0xe2')]});return db[_0x7e18('0x39')][_0x7e18('0x64')]({'where':{'id':_0x571aa5[_0x7e18('0xbe')]['id']},'include':_0x106c88})[_0x7e18('0x2c')](handleEntityNotFound(_0x5b5d74,null))[_0x7e18('0x2c')](function(_0x2fe9e3){if(_0x2fe9e3){var _0x233988=_0x2fe9e3['get']({'plain':!![]});fs[_0x7e18('0xe3')](_0x4b35b2);var _0x213540={'channel':_0x7e18('0xe4'),'account':_0x233988[_0x7e18('0xe1')][_0x7e18('0x2f')],'agent':_0x233988[_0x7e18('0xe5')]?_0x233988['Owner'][_0x7e18('0xe2')]:'N.A.','createdAt':moment(_0x233988[_0x7e18('0xdd')])[_0x7e18('0xc9')](_0x7e18('0xca'))[_0x7e18('0x9f')](),'closedAt':_0x233988[_0x7e18('0xe6')]?moment(_0x233988[_0x7e18('0xe7')])[_0x7e18('0xc9')](_0x7e18('0xca'))[_0x7e18('0x9f')]():'','disposition':_0x233988[_0x7e18('0xe8')],'visibility':_0x233988['threadId']?_0x7e18('0xe9'):'Private','messages':_(_0x233988['Messages'])[_0x7e18('0x8a')]({'secret':![]})[_0x7e18('0x32')](function(_0x1c49bb){if(_0x1c49bb[_0x7e18('0xdc')]){var _0x10d063=path[_0x7e18('0xd3')](_0x4788d5,_0x1c49bb[_0x7e18('0xdc')][_0x7e18('0xea')]);if(fs[_0x7e18('0xeb')](_0x10d063)){fs['createReadStream'](_0x10d063)['pipe'](fs[_0x7e18('0xec')](path['join'](_0x4b35b2,_0x1c49bb[_0x7e18('0xdc')]['basename'])));}}return{'date':moment(_0x1c49bb[_0x7e18('0xdd')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x7e18('0x9f')](),'sender':_0x1c49bb['direction']===_0x7e18('0xed')?_0x1c49bb[_0x7e18('0x73')]?_0x1c49bb[_0x7e18('0x73')][_0x7e18('0xe2')]:_0x7e18('0xee'):_0x1c49bb[_0x7e18('0x68')]['firstName']+(_0x1c49bb[_0x7e18('0x68')][_0x7e18('0xda')]?'\x20'+_0x1c49bb[_0x7e18('0x68')]['lastName']:''),'body':_0x1c49bb[_0x7e18('0xdc')]?_0x1c49bb[_0x7e18('0xdc')][_0x7e18('0xea')]:_0x1c49bb[_0x7e18('0x76')],'direction':_0x1c49bb[_0x7e18('0xde')]===_0x7e18('0xed')?'A':'C','secret':_0x1c49bb['secret'],'read':_0x1c49bb['read'],'attachment':_0x1c49bb[_0x7e18('0xdc')]};})[_0x7e18('0x65')]()};return ejs[_0x7e18('0xef')](path['join'](config['root'],_0x7e18('0xd5'),_0x7e18('0xf0'),_0x7e18('0xf1')),{'interaction':_0x213540})[_0x7e18('0x2c')](function(_0x451b88){var _0x23d300=path[_0x7e18('0xd3')](_0x4b35b2,_0x7e18('0xf2')+_0x233988['id']+'-'+_0x3288dd+_0x7e18('0xf3'));var _0x245811={'path':_0x23d300,'channel':_0x7e18('0xe4'),'interactionId':_0x233988['id']};return pdf[_0x7e18('0xf4')](_0x451b88,_0x245811);})['then'](function(){return new BPromise(function(_0x33f00d,_0x273a84){zipdir(_0x4b35b2,{'saveTo':_0x2c28b0},function(_0x1e40d4,_0x4f36ed){if(_0x1e40d4)return _0x273a84(_0x1e40d4);return _0x33f00d(_0x4f36ed);});})['then'](function(){return new BPromise(function(_0x594128,_0x47f3b8){rimraf(_0x4b35b2,function(_0x44991a){if(_0x44991a)_0x47f3b8(_0x44991a);return _0x594128();});});})[_0x7e18('0x2c')](function(){return _0x5b5d74[_0x7e18('0xd1')](_0x2c28b0,_0x18be63,function(_0x4d8513){if(_0x4d8513){console[_0x7e18('0xf5')]('err',_0x4d8513);}else{fs[_0x7e18('0xf6')](_0x2c28b0);}});});});}else{return _0x5b5d74[_0x7e18('0x1f')](0xc8);}})[_0x7e18('0x37')](handleError(_0x5b5d74,null));}; \ No newline at end of file +var _0x168b=['omit','getMessages','findOne','OpenchannelMessage','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Attachment','Messages','secret','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','disposition','threadId','Private','existsSync','createReadStream','pipe','out','basename','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','catch','index','OpenchannelInteraction','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','tools_tags','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','c.lastName','Contact.lastName','c.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','push','rows','show','params','rawAttributes','includeAll','options','create','describe','addMessage','ids'];(function(_0x25c044,_0xbd05f8){var _0x558ee5=function(_0x5de5d2){while(--_0x5de5d2){_0x25c044['push'](_0x25c044['shift']());}};_0x558ee5(++_0xbd05f8);}(_0x168b,0x12f));var _0xb168=function(_0x348a7e,_0x32f182){_0x348a7e=_0x348a7e-0x0;var _0x420f34=_0x168b[_0x348a7e];return _0x420f34;};'use strict';var emlformat=require(_0xb168('0x0'));var rimraf=require(_0xb168('0x1'));var zipdir=require(_0xb168('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb168('0x3'));var moment=require(_0xb168('0x4'));var BPromise=require(_0xb168('0x5'));var Mustache=require(_0xb168('0x6'));var util=require('util');var path=require(_0xb168('0x7'));var sox=require(_0xb168('0x8'));var csv=require(_0xb168('0x9'));var ejs=require(_0xb168('0xa'));var fs=require('fs');var fs_extra=require(_0xb168('0xb'));var _=require(_0xb168('0xc'));var squel=require('squel');var crypto=require(_0xb168('0xd'));var jsforce=require(_0xb168('0xe'));var deskjs=require(_0xb168('0xf'));var toCsv=require(_0xb168('0x9'));var querystring=require(_0xb168('0x10'));var Papa=require(_0xb168('0x11'));var Redis=require(_0xb168('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb168('0x13'));var as=require(_0xb168('0x14'));var pdf=require(_0xb168('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb168('0x16'))('api');var utils=require(_0xb168('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb168('0x18'))['db'];config[_0xb168('0x19')]=_[_0xb168('0x1a')](config[_0xb168('0x19')],{'host':_0xb168('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb168('0x19')]));require(_0xb168('0x1c'))[_0xb168('0x1d')](socket);function respondWithStatusCode(_0x10ec8f,_0x5bcecd){_0x5bcecd=_0x5bcecd||0xcc;return function(_0x299d8a){if(_0x299d8a){return _0x10ec8f['sendStatus'](_0x5bcecd);}return _0x10ec8f[_0xb168('0x1e')](_0x5bcecd)[_0xb168('0x1f')]();};}function respondWithResult(_0x84e01,_0xffe9ba){_0xffe9ba=_0xffe9ba||0xc8;return function(_0x4b9495){if(_0x4b9495){return _0x84e01[_0xb168('0x1e')](_0xffe9ba)[_0xb168('0x20')](_0x4b9495);}};}function respondWithFilteredResult(_0x462f5b,_0xa014f6){return function(_0x4ef92c){if(_0x4ef92c){var _0x3a293f=typeof _0xa014f6[_0xb168('0x21')]===_0xb168('0x22')&&typeof _0xa014f6[_0xb168('0x23')]==='undefined';var _0x4c2a38=_0x4ef92c[_0xb168('0x24')];var _0x5347cd=_0x3a293f?0x0:_0xa014f6[_0xb168('0x21')];var _0x2bdab9=_0x3a293f?_0x4ef92c[_0xb168('0x24')]:_0xa014f6[_0xb168('0x21')]+_0xa014f6[_0xb168('0x23')];var _0x45582a;if(_0x2bdab9>=_0x4c2a38){_0x2bdab9=_0x4c2a38;_0x45582a=0xc8;}else{_0x45582a=0xce;}_0x462f5b[_0xb168('0x1e')](_0x45582a);return _0x462f5b['set'](_0xb168('0x25'),_0x5347cd+'-'+_0x2bdab9+'/'+_0x4c2a38)[_0xb168('0x20')](_0x4ef92c);}return null;};}function patchUpdates(_0x5f132f){return function(_0x33550e){try{jsonpatch[_0xb168('0x26')](_0x33550e,_0x5f132f,!![]);}catch(_0x15bda2){return BPromise[_0xb168('0x27')](_0x15bda2);}return _0x33550e['save']();};}function saveUpdates(_0x286131,_0x3e726d){return function(_0x1b60a9){if(_0x1b60a9){return _0x1b60a9[_0xb168('0x28')](_0x286131)[_0xb168('0x29')](function(_0x37bb91){return _0x37bb91;});}return null;};}function removeEntity(_0xa87536,_0x352162){return function(_0x237453){if(_0x237453){return _0x237453[_0xb168('0x2a')]()[_0xb168('0x29')](function(){_0xa87536['status'](0xcc)[_0xb168('0x1f')]();});}};}function handleEntityNotFound(_0x181dd4,_0x401bad){return function(_0x963d0b){if(!_0x963d0b){_0x181dd4[_0xb168('0x2b')](0x194);}return _0x963d0b;};}function handleError(_0x2a6981,_0x1641ed){_0x1641ed=_0x1641ed||0x1f4;return function(_0x44e99e){logger[_0xb168('0x2c')](_0x44e99e[_0xb168('0x2d')]);if(_0x44e99e[_0xb168('0x2e')]){delete _0x44e99e[_0xb168('0x2e')];}_0x2a6981[_0xb168('0x1e')](_0x1641ed)[_0xb168('0x2f')](_0x44e99e);};}function getInteractionUsers(_0x18bbaf,_0x3fc35a){return new BPromise(function(_0x2c3f08,_0x57af92){try{if(_0x3fc35a[_0x18bbaf['id']]){_0x18bbaf[_0xb168('0x30')]=_[_0xb168('0x31')](_0x3fc35a[_0x18bbaf['id']],function(_0x31a567){return{'id':_0x31a567['id'],'fullname':_0x31a567[_0xb168('0x32')]};});}}catch(_0x24b732){_0x57af92(_0x24b732);}_0x2c3f08(_0x18bbaf);});}function getInteractionTags(_0x3ddfbe,_0x5d8161){return new BPromise(function(_0x5cb093,_0xdbb4e7){try{if(_0x3ddfbe[_0xb168('0x33')]){_0x3ddfbe['Tags']=[];_0x3ddfbe[_0xb168('0x33')][_0xb168('0x34')](',')[_0xb168('0x35')](function(_0x4e79d0){_0x3ddfbe[_0xb168('0x36')]['push'](_0x5d8161[_0x4e79d0]);});}delete _0x3ddfbe[_0xb168('0x33')];}catch(_0x3b8408){_0xdbb4e7(_0x3b8408);}_0x5cb093(_0x3ddfbe);});}function updateOpenchannelInteraction(_0x4775b7,_0xf9fcb8,_0x3fe82f){return new BPromise(function(_0xc87c3e,_0x10e564){return getInteractionUsers(_0x4775b7,_0x3fe82f)[_0xb168('0x29')](function(_0x266d51){return getInteractionTags(_0x266d51,_0xf9fcb8);})['then'](function(_0x2ca744){_0xc87c3e(_0x2ca744);})[_0xb168('0x37')](function(_0x5ab9b6){_0x10e564(_0x5ab9b6);});});}exports[_0xb168('0x38')]=function(_0x22ba57,_0x33a103){var _0x133d08={},_0x160de2={},_0x140299={'count':0x0,'rows':[]};var _0x539d8d=_[_0xb168('0x31')](db[_0xb168('0x39')]['rawAttributes'],function(_0x347e28){return{'name':_0x347e28['fieldName'],'type':_0x347e28['type'][_0xb168('0x3a')]};});_0x160de2['model']=_['map'](_0x539d8d,_0xb168('0x2e'));_0x160de2[_0xb168('0x3b')]=_[_0xb168('0x3c')](_0x22ba57['query']);_0x160de2['filters']=_[_0xb168('0x3d')](_0x160de2[_0xb168('0x3e')],_0x160de2[_0xb168('0x3b')]);_0x133d08[_0xb168('0x3f')]=_['intersection'](_0x160de2[_0xb168('0x3e')],qs[_0xb168('0x40')](_0x22ba57[_0xb168('0x3b')][_0xb168('0x40')]));_0x133d08['attributes']=_0x133d08[_0xb168('0x3f')][_0xb168('0x41')]?_0x133d08[_0xb168('0x3f')]:_0x160de2[_0xb168('0x3e')];if(!_0x22ba57[_0xb168('0x3b')][_0xb168('0x42')](_0xb168('0x43'))){_0x133d08[_0xb168('0x23')]=qs[_0xb168('0x23')](_0x22ba57[_0xb168('0x3b')]['limit']);_0x133d08['offset']=qs[_0xb168('0x21')](_0x22ba57[_0xb168('0x3b')]['offset']);}_0x133d08[_0xb168('0x44')]=qs[_0xb168('0x45')](_0x22ba57['query']['sort']);_0x133d08[_0xb168('0x46')]=qs[_0xb168('0x47')](_[_0xb168('0x48')](_0x22ba57['query'],_0x160de2[_0xb168('0x47')]),_0x539d8d);var _0x185887=[];var _0x5c2d97=squel[_0xb168('0x49')]()[_0xb168('0x4a')]('id')['field']('name')[_0xb168('0x4a')](_0xb168('0x4b'))['from'](_0xb168('0x4c'));var _0x1be001=squel[_0xb168('0x49')]()['field']('u.id')[_0xb168('0x4a')](_0xb168('0x4d'))[_0xb168('0x4a')](_0xb168('0x4e'))[_0xb168('0x4f')](_0xb168('0x50'),'ui')['left_join'](_0xb168('0x51'),'u',_0xb168('0x52'));var _0xe25246=squel['select']()[_0xb168('0x4f')](_0xb168('0x53'),'i')[_0xb168('0x54')](_0xb168('0x55'),'c',_0xb168('0x56'))[_0xb168('0x54')](_0xb168('0x51'),'o',_0xb168('0x57'))['left_join'](_0xb168('0x58'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xb168('0x54')]('openchannel_messages','me',_0xb168('0x59'))['left_join']('openchannel_interaction_has_tags','it',_0xb168('0x5a'))[_0xb168('0x54')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x45bf87=squel[_0xb168('0x5b')]();var _0x34fd8e=[];var _0x452c47=squel[_0xb168('0x5b')]();var _0x6f3643;if(_0x22ba57[_0xb168('0x3b')][_0xb168('0x5c')]){_0x6f3643=as[_0xb168('0x5d')](_0x22ba57[_0xb168('0x3b')][_0xb168('0x5c')]);var _0x478ea9=_0x6f3643[_0xb168('0x5e')];for(var _0x3812f8=0x0;_0x3812f8<_0x6f3643[_0xb168('0x5f')][_0xb168('0x41')];_0x3812f8++){var _0x58430b=_0x6f3643['conditions'][_0x3812f8];var _0xc5924d='i';var _0x1a1a4a=_[_0xb168('0x60')](_0x539d8d,[_0xb168('0x2e'),_0x58430b[_0xb168('0x4a')]]);if(!_0x1a1a4a){switch(_0x58430b['field']){case _0xb168('0x61'):if(_0x58430b[_0xb168('0x62')]==0x1){_0xe25246[_0xb168('0x63')]('`'+_0x58430b[_0xb168('0x4a')]+'`\x20=\x200');}else{_0xe25246[_0xb168('0x63')]('`'+_0x58430b[_0xb168('0x4a')]+_0xb168('0x64'));}break;case'Contact':if(_0x58430b[_0xb168('0x65')]==='$substring'){if(_0x58430b[_0xb168('0x62')][_0xb168('0x34')]('\x20')[_0xb168('0x41')]>0x1){_0x45bf87[_0x478ea9](_0xb168('0x66'),qs['getFullTextValue'](_0x58430b[_0xb168('0x62')]),null);}else{var _0x45428d='%'+_0x58430b[_0xb168('0x62')]+'%';_0x45bf87[_0x478ea9](_0xb168('0x67'),_0x45428d,_0x45428d,_0x45428d);}}else{_0x1a1a4a=_[_0xb168('0x60')](_0x539d8d,['name','ContactId']);_0x58430b[_0xb168('0x4a')]=_0xb168('0x68');_0x21a30e=as['buildExpression'](_0xc5924d,_0x1a1a4a[_0xb168('0x69')],_0x58430b);_0x45bf87[_0x478ea9](_0x21a30e[_0xb168('0x6a')],_0x21a30e[_0xb168('0x62')][_0xb168('0x6b')],_0x21a30e[_0xb168('0x62')][_0xb168('0x1f')]);}break;case'Tag':var _0x5540eb=_0x58430b[_0xb168('0x62')]['split'](',')[_0xb168('0x31')](function(_0x1a2732){return Number(_0x1a2732);});_0x5540eb[_0xb168('0x35')](function(_0x412012){_0x452c47['or'](_0xb168('0x6c'),'%,'+_0x412012+',%');});_0x34fd8e=_[_0xb168('0x6d')](_0x34fd8e,_0x5540eb);break;case _0xb168('0x6e'):if(_0x58430b[_0xb168('0x65')]===_0xb168('0x6f')){_0x45bf87[_0x478ea9](_0xb168('0x70'),'%'+_0x58430b['value']+'%',null);}else{_0x1a1a4a=_[_0xb168('0x60')](_0x539d8d,['name',_0xb168('0x71')]);_0x58430b[_0xb168('0x4a')]=_0xb168('0x71');_0x21a30e=as[_0xb168('0x72')](_0xc5924d,_0x1a1a4a[_0xb168('0x69')],_0x58430b);_0x45bf87[_0x478ea9](_0x21a30e[_0xb168('0x6a')],_0x21a30e[_0xb168('0x62')][_0xb168('0x6b')],_0x21a30e[_0xb168('0x62')][_0xb168('0x1f')]);}break;case _0xb168('0x73'):_0x21a30e=as[_0xb168('0x72')]('me',null,_0x58430b);_0x45bf87[_0x478ea9](_0x21a30e[_0xb168('0x6a')],_0x21a30e['value'][_0xb168('0x6b')],_0x21a30e[_0xb168('0x62')][_0xb168('0x1f')]);break;}}else{var _0x21a30e=as[_0xb168('0x72')](_0xc5924d,_0x1a1a4a[_0xb168('0x69')],_0x58430b);_0x45bf87[_0x478ea9](_0x21a30e[_0xb168('0x6a')],_0x21a30e[_0xb168('0x62')][_0xb168('0x6b')],_0x21a30e[_0xb168('0x62')][_0xb168('0x1f')]);}}}else{var _0x560cb1=_(_0x22ba57['query'])[_0xb168('0x3c')]()[_0xb168('0x31')](function(_0x569636){return _[_0xb168('0x74')](_0x539d8d,[_0xb168('0x2e'),_0x569636])?_0x569636:undefined;})[_0xb168('0x75')]()[_0xb168('0x62')]();if(!_[_0xb168('0x76')](_0x560cb1)){_0x560cb1[_0xb168('0x35')](function(_0xa81395){if(_0xa81395==='OpenchannelAccountId'){_0xe25246['where'](_0xb168('0x77'),[]['concat'](_0x22ba57[_0xb168('0x3b')][_0xa81395]));}else if(_0xa81395===_0xb168('0x78')){var _0x362d4f=JSON[_0xb168('0x79')](_0x22ba57[_0xb168('0x3b')][_0xa81395])[_0xb168('0x7a')];var _0x3ec36e=JSON[_0xb168('0x79')](_0x22ba57[_0xb168('0x3b')][_0xa81395])[_0xb168('0x7b')];_0xe25246['where'](_0xb168('0x7c'),_0x362d4f,_0x3ec36e);}else{if(_0x22ba57[_0xb168('0x3b')][_0xa81395]==='null'){_0xe25246[_0xb168('0x46')]('i.'+_0xa81395+_0xb168('0x7d'));}else{_0xe25246[_0xb168('0x46')]('i.'+_0xa81395+_0xb168('0x7e'),_0x22ba57[_0xb168('0x3b')][_0xa81395]);}}});}if(_0x22ba57[_0xb168('0x3b')][_0xb168('0x7f')]){if(_0x22ba57[_0xb168('0x3b')][_0xb168('0x7f')]==0x1){_0xe25246[_0xb168('0x63')](_0xb168('0x80'));}else{_0xe25246[_0xb168('0x63')](_0xb168('0x81'));}}if(_0x22ba57[_0xb168('0x3b')]['tag']){_0x34fd8e=_['isArray'](_0x22ba57[_0xb168('0x3b')][_0xb168('0x82')])?_0x22ba57[_0xb168('0x3b')][_0xb168('0x82')]:new Array(_0x22ba57[_0xb168('0x3b')]['tag']);_0x34fd8e[_0xb168('0x35')](function(_0xfa42b6){_0x452c47['or'](_0xb168('0x6c'),'%,'+_0xfa42b6+',%');});}if(_0x22ba57[_0xb168('0x3b')][_0xb168('0x83')]){var _0x1ad41c=_0x22ba57['query'][_0xb168('0x83')][_0xb168('0x84')]('\x5c','\x5c\x5c')[_0xb168('0x84')](/'/g,'\x27\x27');if(qs[_0xb168('0x85')](_0x1ad41c)){_0x45bf87['or'](_0xb168('0x86'),_0x1ad41c+'%');}else{_0x45bf87['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb168('0x87')](_0x1ad41c))['or'](_0xb168('0x88'),_0x1ad41c+'%')['or'](_0xb168('0x89'),_0x1ad41c+'%');}}}_0xe25246[_0xb168('0x46')](_0x45bf87);_0xe25246['group'](_0xb168('0x8a'));var _0x53e513={'type':db[_0xb168('0x8b')][_0xb168('0x8c')][_0xb168('0x8d')],'raw':!![]};var _0x873b8e=_0xe25246[_0xb168('0x8e')]();_0x873b8e[_0xb168('0x4a')]('i.id');_0x873b8e[_0xb168('0x4a')](_0xb168('0x8f'),_0xb168('0x61'));if(_0x133d08[_0xb168('0x44')]){_0x133d08[_0xb168('0x44')]['forEach'](function(_0x480f83){var _0x3c8dd7=_0x480f83[0x0]==='contactName'?_0x480f83[0x0]:'i.'+_0x480f83[0x0];_0xe25246[_0xb168('0x44')](_0x3c8dd7,_0x480f83[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb168('0x76')](_0x34fd8e)){_0xe25246[_0xb168('0x63')](_0x452c47);_0x873b8e[_0xb168('0x46')](_0xb168('0x90'),_0x34fd8e);}BPromise['resolve']()[_0xb168('0x29')](function(){if(!_0x6f3643){if(_0x22ba57['query'][_0xb168('0x91')])return;_0x873b8e[_0xb168('0x46')](_0xb168('0x92'));_0xe25246[_0xb168('0x46')](_0xb168('0x92'));return;}if(_0x22ba57[_0xb168('0x93')][_0xb168('0x94')]!==_0xb168('0x95'))return;return _0x22ba57[_0xb168('0x93')][_0xb168('0x96')]({'attributes':['id'],'raw':!![]})[_0xb168('0x29')](function(_0x3e4fb4){if(_['isEmpty'](_0x3e4fb4)){_0x873b8e['where'](_0xb168('0x97'));_0xe25246['where'](_0xb168('0x97'));}else{_0x873b8e['where'](_0xb168('0x77'),_['map'](_0x3e4fb4,'id'));_0xe25246[_0xb168('0x46')](_0xb168('0x77'),_[_0xb168('0x31')](_0x3e4fb4,'id'));}});})['then'](function(){if(_0x22ba57[_0xb168('0x93')][_0xb168('0x94')]===_0xb168('0x95')&&!_0x6f3643&&!_0x22ba57[_0xb168('0x3b')][_0xb168('0x91')])return[];return db[_0xb168('0x98')][_0xb168('0x3b')](_0x873b8e['toString'](),_0x53e513);})[_0xb168('0x29')](function(_0xfd7081){_0x140299[_0xb168('0x24')]=_0xfd7081['length'];if(_0x140299['count']===0x0)return[];return db[_0xb168('0x98')][_0xb168('0x3b')](_0x5c2d97[_0xb168('0x99')](),_0x53e513)[_0xb168('0x29')](function(_0x309b43){_0x185887=_[_0xb168('0x9a')](_0x309b43,'id');_0x53e513=_[_0xb168('0x9b')](_0x53e513,{'model':db[_0xb168('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x22ba57[_0xb168('0x3b')][_0xb168('0x40')]){_0x133d08[_0xb168('0x3f')]['forEach'](function(_0x12d722){_0xe25246[_0xb168('0x4a')]('i.'+_0x12d722);});}else{_0xe25246[_0xb168('0x4a')](_0xb168('0x8f'),'unreadMessages');_0xe25246[_0xb168('0x4a')](_0xb168('0x9c'),_0xb168('0x9d'));_0xe25246[_0xb168('0x4a')](_0xb168('0x9e'),_0xb168('0x9f'));_0xe25246[_0xb168('0x4a')](_0xb168('0xa0'),_0xb168('0xa1'));_0xe25246[_0xb168('0x4a')](_0xb168('0xa2'));_0xe25246['field'](_0xb168('0xa3'),'Contact.firstName');_0xe25246[_0xb168('0x4a')](_0xb168('0xa4'),_0xb168('0xa5'));_0xe25246[_0xb168('0x4a')]('c.email','Contact.email');_0xe25246['field'](_0xb168('0xa6'),'Contact.phone');_0xe25246['field'](_0xb168('0xa7'),_0xb168('0xa8'));_0xe25246[_0xb168('0x4a')]('c.fax','Contact.fax');_0xe25246[_0xb168('0x4a')](_0xb168('0xa9'),_0xb168('0xaa'));_0xe25246['field'](_0xb168('0xab'),_0xb168('0xac'));_0xe25246[_0xb168('0x4a')](_0xb168('0xad'),_0xb168('0x33'));}if(_0x133d08[_0xb168('0x23')])_0xe25246[_0xb168('0x23')](_0x133d08[_0xb168('0x23')]);if(_0x133d08[_0xb168('0x21')])_0xe25246[_0xb168('0x21')](_0x133d08[_0xb168('0x21')]);return db['sequelize'][_0xb168('0x3b')](_0xe25246['toString'](),_0x53e513);})['then'](function(_0x17a3cb){if(_0x17a3cb['length']>0x0)_0x1be001[_0xb168('0x46')](_0xb168('0xae'),_[_0xb168('0x31')](_0x17a3cb,'id'));return db[_0xb168('0x98')]['query'](_0x1be001['toString'](),_0x53e513)[_0xb168('0x29')](function(_0x58c8ac){var _0x13debe=_[_0xb168('0xaf')](_0x58c8ac,'OpenchannelInteractionId');var _0x58f62a=[];_0x17a3cb[_0xb168('0x35')](function(_0x24cd92){_0x58f62a[_0xb168('0xb0')](updateOpenchannelInteraction(_0x24cd92,_0x185887,_0x13debe));});return BPromise['all'](_0x58f62a);});});})[_0xb168('0x29')](function(_0x5d9660){_0x140299[_0xb168('0xb1')]=_0x5d9660;return _0x140299;})['then'](respondWithFilteredResult(_0x33a103,_0x133d08))[_0xb168('0x37')](handleError(_0x33a103,null));};exports[_0xb168('0xb2')]=function(_0x3f1831,_0x698aa2){var _0x1e2477={};if(_0x3f1831[_0xb168('0x3b')][_0xb168('0x69')]&&_0x3f1831['query'][_0xb168('0x69')]===_0xb168('0x4f')){_0x1e2477['from']=_0x3f1831[_0xb168('0xb3')]['id'];}else{_0x1e2477['id']=_0x3f1831[_0xb168('0xb3')]['id'];}var _0x35ab8b={'raw':![],'where':_0x1e2477},_0x5ccd03={};_0x5ccd03['model']=_[_0xb168('0x3c')](db[_0xb168('0x39')][_0xb168('0xb4')]);_0x5ccd03[_0xb168('0x3b')]=_[_0xb168('0x3c')](_0x3f1831[_0xb168('0x3b')]);_0x5ccd03[_0xb168('0x47')]=_[_0xb168('0x3d')](_0x5ccd03[_0xb168('0x3e')],_0x5ccd03[_0xb168('0x3b')]);_0x35ab8b[_0xb168('0x3f')]=_['intersection'](_0x5ccd03['model'],qs[_0xb168('0x40')](_0x3f1831['query'][_0xb168('0x40')]));_0x35ab8b[_0xb168('0x3f')]=_0x35ab8b['attributes']['length']?_0x35ab8b[_0xb168('0x3f')]:_0x5ccd03[_0xb168('0x3e')];if(_0x3f1831[_0xb168('0x3b')][_0xb168('0xb5')]){_0x35ab8b['include']=[{'all':!![]}];}_0x35ab8b=_[_0xb168('0x9b')]({},_0x35ab8b,_0x3f1831[_0xb168('0xb6')]);return db['OpenchannelInteraction'][_0xb168('0x60')](_0x35ab8b)[_0xb168('0x29')](handleEntityNotFound(_0x698aa2,null))[_0xb168('0x29')](respondWithResult(_0x698aa2,null))[_0xb168('0x37')](handleError(_0x698aa2,null));};exports[_0xb168('0xb7')]=function(_0x38dec2,_0x149f6){return db[_0xb168('0x39')][_0xb168('0xb7')](_0x38dec2[_0xb168('0x73')],{})[_0xb168('0x29')](respondWithResult(_0x149f6,0xc9))[_0xb168('0x37')](handleError(_0x149f6,null));};exports['update']=function(_0x2098d7,_0x2b2583){if(_0x2098d7[_0xb168('0x73')]['id']){delete _0x2098d7[_0xb168('0x73')]['id'];}return db[_0xb168('0x39')][_0xb168('0x60')]({'where':{'id':_0x2098d7['params']['id']}})['then'](handleEntityNotFound(_0x2b2583,null))[_0xb168('0x29')](saveUpdates(_0x2098d7[_0xb168('0x73')],null))[_0xb168('0x29')](respondWithResult(_0x2b2583,null))['catch'](handleError(_0x2b2583,null));};exports[_0xb168('0x2a')]=function(_0x5e8e60,_0x127cb3){return db[_0xb168('0x39')][_0xb168('0x60')]({'where':{'id':_0x5e8e60[_0xb168('0xb3')]['id']}})[_0xb168('0x29')](handleEntityNotFound(_0x127cb3,null))[_0xb168('0x29')](removeEntity(_0x127cb3,null))[_0xb168('0x37')](handleError(_0x127cb3,null));};exports[_0xb168('0xb8')]=function(_0x2eab28,_0x62dff9){return db[_0xb168('0x39')][_0xb168('0xb8')]()[_0xb168('0x29')](respondWithResult(_0x62dff9,null))[_0xb168('0x37')](handleError(_0x62dff9,null));};exports[_0xb168('0xb9')]=function(_0x1aafee,_0x1d7d64,_0x361240){return db['OpenchannelMessage']['find']({'where':{'id':_0x1aafee[_0xb168('0xb3')]['id']}})[_0xb168('0x29')](handleEntityNotFound(_0x1d7d64,null))[_0xb168('0x29')](function(_0x1e5181){if(_0x1e5181){return _0x1e5181[_0xb168('0xb9')](_0x1aafee[_0xb168('0x73')][_0xb168('0xba')],_[_0xb168('0xbb')](_0x1aafee[_0xb168('0x73')],[_0xb168('0xba'),'id'])||{});}})[_0xb168('0x29')](respondWithResult(_0x1d7d64,null))[_0xb168('0x37')](handleError(_0x1d7d64,null));};exports[_0xb168('0xbc')]=function(_0x3512f9,_0x3d7cb0,_0xf359d1){var _0x5b019b={'raw':![],'where':{}};var _0x49ce8e={};var _0x1846bf={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xb168('0xbd')]({'where':{'id':_0x3512f9[_0xb168('0xb3')]['id']}})[_0xb168('0x29')](handleEntityNotFound(_0x3d7cb0,null))[_0xb168('0x29')](function(_0x2c47b7){if(_0x2c47b7){_0x49ce8e[_0xb168('0x3e')]=_[_0xb168('0x3c')](db[_0xb168('0xbe')][_0xb168('0xb4')]);_0x49ce8e[_0xb168('0x3b')]=_['keys'](_0x3512f9['query']);_0x49ce8e[_0xb168('0x47')]=_[_0xb168('0x3d')](_0x49ce8e[_0xb168('0x3e')],_0x49ce8e['query']);_0x5b019b[_0xb168('0x3f')]=_[_0xb168('0x3d')](_0x49ce8e[_0xb168('0x3e')],qs['fields'](_0x3512f9[_0xb168('0x3b')]['fields']));_0x5b019b[_0xb168('0x3f')]=_0x5b019b['attributes'][_0xb168('0x41')]?_0x5b019b['attributes']:_0x49ce8e[_0xb168('0x3e')];if(!_0x3512f9[_0xb168('0x3b')][_0xb168('0x42')](_0xb168('0x43'))){_0x5b019b['limit']=qs[_0xb168('0x23')](_0x3512f9[_0xb168('0x3b')][_0xb168('0x23')]);_0x5b019b[_0xb168('0x21')]=qs['offset'](_0x3512f9[_0xb168('0x3b')][_0xb168('0x21')]);}_0x5b019b[_0xb168('0x44')]=qs[_0xb168('0x45')](_0x3512f9[_0xb168('0x3b')]['sort']);_0x5b019b[_0xb168('0x46')]=qs[_0xb168('0x47')](_[_0xb168('0x48')](_0x3512f9[_0xb168('0x3b')],_0x49ce8e['filters']));_0x5b019b['where'][_0xb168('0xbf')]=_0x2c47b7['id'];if(_0x3512f9[_0xb168('0x3b')][_0xb168('0x83')]){_0x5b019b['where']=_[_0xb168('0x9b')](_0x5b019b[_0xb168('0x46')],{'$or':_['map'](_0x5b019b[_0xb168('0x3f')],function(_0x41fd0d){var _0x25ac00={};_0x25ac00[_0x41fd0d]={'$like':'%'+_0x3512f9[_0xb168('0x3b')][_0xb168('0x83')]+'%'};return _0x25ac00;})});}if(_0x3512f9[_0xb168('0x3b')][_0xb168('0x7a')]){var _0x2834da=_0x3512f9[_0xb168('0x3b')][_0xb168('0x7a')]['split'](',');var _0x33b1ee={};_0x33b1ee[_0x2834da[0x0]]={'$gte':moment(_0x2834da[0x1])[_0xb168('0xc0')](_0xb168('0xc1'))};_0x5b019b['where']=_[_0xb168('0x9b')](_0x5b019b[_0xb168('0x46')],_0x33b1ee);}_0x5b019b=_['merge']({},_0x5b019b,_0x3512f9[_0xb168('0xb6')]);return db['OpenchannelMessage'][_0xb168('0x24')]({'where':_0x5b019b[_0xb168('0x46')]})[_0xb168('0x29')](function(_0x47abec){_0x1846bf[_0xb168('0x24')]=_0x47abec;if(_0x3512f9['query'][_0xb168('0xb5')]){_0x5b019b[_0xb168('0xc2')]=[{'all':!![]}];}return db[_0xb168('0xbe')][_0xb168('0xc3')](_0x5b019b);})['then'](function(_0x2eca62){_0x1846bf[_0xb168('0xb1')]=_0x2eca62;return _0x1846bf;});}})[_0xb168('0x29')](respondWithFilteredResult(_0x3d7cb0,_0x5b019b))[_0xb168('0x37')](handleError(_0x3d7cb0,null));};exports[_0xb168('0xc4')]=function(_0x46ae8a,_0x2c1239,_0xb69eb0){return db['OpenchannelInteraction'][_0xb168('0x60')]({'where':{'id':_0x46ae8a[_0xb168('0xb3')]['id']}})[_0xb168('0x29')](handleEntityNotFound(_0x2c1239,null))[_0xb168('0x29')](function(_0x246e60){if(_0x246e60){return _0x246e60[_0xb168('0xc5')](_0x46ae8a[_0xb168('0x73')]['ids'],_[_0xb168('0xbb')](_0x46ae8a['body'],[_0xb168('0xba'),'id'])||{})[_0xb168('0xc6')](function(){return db[_0xb168('0xc7')]['findAll']({'attributes':['id',_0xb168('0x2e'),'color'],'where':{'id':_0x46ae8a['body'][_0xb168('0xba')]}});})['then'](function(_0x21bc68){socket[_0xb168('0xc8')](_0xb168('0xc9'),{'id':Number(_0x46ae8a[_0xb168('0xb3')]['id']),'tags':_0x21bc68||[]});return{'id':Number(_0x46ae8a[_0xb168('0xb3')]['id']),'tags':_0x21bc68||[]};});}})[_0xb168('0x29')](respondWithResult(_0x2c1239,null))[_0xb168('0x37')](handleError(_0x2c1239,null));};exports[_0xb168('0xca')]=function(_0x9ab81b,_0x3e8de0,_0x1d7342){return db[_0xb168('0x39')][_0xb168('0x60')]({'where':{'id':_0x9ab81b[_0xb168('0xb3')]['id']}})[_0xb168('0x29')](handleEntityNotFound(_0x3e8de0,null))['then'](function(_0x21c626){if(_0x21c626){return _0x21c626['removeTags'](_0x9ab81b['query'][_0xb168('0xba')]);}})[_0xb168('0x29')](respondWithStatusCode(_0x3e8de0,null))[_0xb168('0x37')](handleError(_0x3e8de0,null));};exports[_0xb168('0xcb')]=function(_0x18478b,_0x2032a3){var _0x5f8cfa=moment()[_0xb168('0xcc')]()[_0xb168('0x99')]();var _0x519103=path[_0xb168('0xcd')](config[_0xb168('0xce')],_0xb168('0xcf'),'files',_0xb168('0xd0'));var _0x157142=path[_0xb168('0xcd')](config[_0xb168('0xce')],'server',_0xb168('0xd1'),_0xb168('0xd2'));var _0x20c985=path[_0xb168('0xcd')](_0x519103,_0x5f8cfa);var _0x2613bf=util[_0xb168('0xc0')](_0xb168('0xd3'),_0x18478b[_0xb168('0xb3')]['id'],_0x5f8cfa);var _0x554a9f=path[_0xb168('0xcd')](_0x519103,_0x2613bf);var _0x54b4ef=[];_0x54b4ef[_0xb168('0xb0')]({'model':db[_0xb168('0x6e')],'as':'User','attributes':['id',_0xb168('0x32')],'raw':!![]});_0x54b4ef[_0xb168('0xb0')]({'model':db[_0xb168('0xd4')],'as':_0xb168('0xd5'),'attributes':['id',_0xb168('0xd6'),_0xb168('0xd7')],'raw':!![]});if(_0x18478b[_0xb168('0x3b')][_0xb168('0xd2')]){_0x54b4ef[_0xb168('0xb0')]({'model':db[_0xb168('0xd8')],'as':_0xb168('0xd8'),'raw':!![]});}var _0x4a21c2=[{'model':db[_0xb168('0xbe')],'as':_0xb168('0xd9'),'attributes':['id',_0xb168('0x73'),'createdAt','direction',_0xb168('0xda'),_0xb168('0x7f')],'include':_0x54b4ef}];_0x4a21c2[_0xb168('0xb0')]({'model':db[_0xb168('0xdb')],'as':_0xb168('0xdc'),'attributes':['id',_0xb168('0x2e')]});_0x4a21c2[_0xb168('0xb0')]({'model':db[_0xb168('0x6e')],'as':'Owner','attributes':['id','fullname']});return db[_0xb168('0x39')]['find']({'where':{'id':_0x18478b[_0xb168('0xb3')]['id']},'include':_0x4a21c2})[_0xb168('0x29')](handleEntityNotFound(_0x2032a3,null))[_0xb168('0x29')](function(_0x2663c8){if(_0x2663c8){var _0x4460d3=_0x2663c8[_0xb168('0xdd')]({'plain':!![]});fs[_0xb168('0xde')](_0x20c985);var _0x338b3d={'channel':_0xb168('0xdf'),'account':_0x4460d3[_0xb168('0xdc')][_0xb168('0x2e')],'agent':_0x4460d3[_0xb168('0xe0')]?_0x4460d3[_0xb168('0xe0')][_0xb168('0x32')]:_0xb168('0xe1'),'createdAt':moment(_0x4460d3[_0xb168('0x78')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb168('0x99')](),'closedAt':_0x4460d3[_0xb168('0xe2')]?moment(_0x4460d3[_0xb168('0xe3')])[_0xb168('0xc0')](_0xb168('0xc1'))[_0xb168('0x99')]():'','disposition':_0x4460d3[_0xb168('0xe4')],'visibility':_0x4460d3[_0xb168('0xe5')]?'Public':_0xb168('0xe6'),'messages':_(_0x4460d3[_0xb168('0xd9')])[_0xb168('0x83')]({'secret':![]})[_0xb168('0x31')](function(_0x1d8e4f){if(_0x1d8e4f[_0xb168('0xd8')]){var _0x4b08d2=path['join'](_0x157142,_0x1d8e4f['Attachment']['basename']);if(fs[_0xb168('0xe7')](_0x4b08d2)){fs[_0xb168('0xe8')](_0x4b08d2)[_0xb168('0xe9')](fs['createWriteStream'](path['join'](_0x20c985,_0x1d8e4f[_0xb168('0xd8')]['basename'])));}}return{'date':moment(_0x1d8e4f[_0xb168('0x78')])[_0xb168('0xc0')](_0xb168('0xc1'))[_0xb168('0x99')](),'sender':_0x1d8e4f['direction']===_0xb168('0xea')?_0x1d8e4f[_0xb168('0x6e')]?_0x1d8e4f['User'][_0xb168('0x32')]:'System':_0x1d8e4f[_0xb168('0xd5')]['firstName']+(_0x1d8e4f[_0xb168('0xd5')][_0xb168('0xd7')]?'\x20'+_0x1d8e4f[_0xb168('0xd5')]['lastName']:''),'body':_0x1d8e4f[_0xb168('0xd8')]?_0x1d8e4f[_0xb168('0xd8')][_0xb168('0xeb')]:_0x1d8e4f[_0xb168('0x73')],'direction':_0x1d8e4f['direction']===_0xb168('0xea')?'A':'C','secret':_0x1d8e4f['secret'],'read':_0x1d8e4f[_0xb168('0x7f')],'attachment':_0x1d8e4f[_0xb168('0xd8')]};})[_0xb168('0x62')]()};return ejs[_0xb168('0xec')](path['join'](config[_0xb168('0xce')],_0xb168('0xcf'),_0xb168('0xed'),_0xb168('0xee')),{'interaction':_0x338b3d})[_0xb168('0x29')](function(_0x4142b5){var _0x97666d=path[_0xb168('0xcd')](_0x20c985,_0xb168('0xef')+_0x4460d3['id']+'-'+_0x5f8cfa+_0xb168('0xf0'));var _0x249873={'path':_0x97666d,'channel':_0xb168('0xdf'),'interactionId':_0x4460d3['id']};return pdf[_0xb168('0xf1')](_0x4142b5,_0x249873);})['then'](function(){return new BPromise(function(_0x2311e1,_0x510524){zipdir(_0x20c985,{'saveTo':_0x554a9f},function(_0x487d61,_0xad9e40){if(_0x487d61)return _0x510524(_0x487d61);return _0x2311e1(_0xad9e40);});})['then'](function(){return new BPromise(function(_0x35b7ed,_0x434fab){rimraf(_0x20c985,function(_0x65aa2f){if(_0x65aa2f)_0x434fab(_0x65aa2f);return _0x35b7ed();});});})[_0xb168('0x29')](function(){return _0x2032a3[_0xb168('0xcb')](_0x554a9f,_0x2613bf,function(_0x225c7a){if(_0x225c7a){console[_0xb168('0xf2')](_0xb168('0xf3'),_0x225c7a);}else{fs[_0xb168('0xf4')](_0x554a9f);}});});});}else{return _0x2032a3['sendStatus'](0xc8);}})[_0xb168('0x37')](handleError(_0x2032a3,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 6e1d75c..efaad2d 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 _0xa24d=['hasOwnProperty','hook','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0xa24d,0x10c));var _0xda24=function(_0x59ecf9,_0x9a29d){_0x59ecf9=_0x59ecf9-0x0;var _0x3c68c1=_0xa24d[_0x59ecf9];return _0x3c68c1;};'use strict';var EventEmitter=require(_0xda24('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xda24('0x1')];var OpenchannelMessage=require(_0xda24('0x2'))['db'][_0xda24('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xda24('0x4')](0x0);var events={'afterCreate':_0xda24('0x5'),'afterUpdate':_0xda24('0x6'),'afterDestroy':_0xda24('0x7')};function emitEvent(_0x47f9f2){return function(_0x5d596d,_0x19eafb,_0x160813){_0x5d596d['getUsers']({'attributes':['id'],'raw':!![]})[_0xda24('0x8')](function(_0x5ce202){_0x5d596d['setDataValue'](_0xda24('0x9'),_0x5ce202[_0xda24('0xa')](function(_0x2c768a){return{'id':_0x2c768a['id']};}));return OpenchannelMessage[_0xda24('0xb')]({'where':{'OpenchannelInteractionId':_0x5d596d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xda24('0x8')](function(_0x29b1bf){_0x5d596d[_0xda24('0xc')](_0xda24('0xd'),_0x29b1bf[_0xda24('0xe')]);OpenchannelInteractionEvents[_0xda24('0xf')](_0x47f9f2+':'+_0x5d596d['id'],_0x5d596d);OpenchannelInteractionEvents['emit'](_0x47f9f2,_0x5d596d);_0x160813(null);})[_0xda24('0x10')](_0x160813(null));};}for(var e in events){if(events[_0xda24('0x11')](e)){var event=events[e];OpenchannelInteraction[_0xda24('0x12')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x051b=['exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x33d9d3,_0x2339ac){var _0x2f988e=function(_0x5bb8e2){while(--_0x5bb8e2){_0x33d9d3['push'](_0x33d9d3['shift']());}};_0x2f988e(++_0x2339ac);}(_0x051b,0x11e));var _0xb051=function(_0x475d0d,_0x538ee6){_0x475d0d=_0x475d0d-0x0;var _0x1e089d=_0x051b[_0x475d0d];return _0x1e089d;};'use strict';var EventEmitter=require(_0xb051('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xb051('0x1'))['db'][_0xb051('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xb051('0x3')](0x0);var events={'afterCreate':_0xb051('0x4'),'afterUpdate':_0xb051('0x5'),'afterDestroy':_0xb051('0x6')};function emitEvent(_0x3c08f7){return function(_0x4c4cf6,_0x5634b1,_0x3f956f){_0x4c4cf6['getUsers']({'attributes':['id'],'raw':!![]})[_0xb051('0x7')](function(_0x589247){_0x4c4cf6[_0xb051('0x8')](_0xb051('0x9'),_0x589247[_0xb051('0xa')](function(_0x4cb206){return{'id':_0x4cb206['id']};}));return OpenchannelMessage[_0xb051('0xb')]({'where':{'OpenchannelInteractionId':_0x4c4cf6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2c0617){_0x4c4cf6[_0xb051('0x8')](_0xb051('0xc'),_0x2c0617[_0xb051('0xd')]);OpenchannelInteractionEvents[_0xb051('0xe')](_0x3c08f7+':'+_0x4c4cf6['id'],_0x4c4cf6);OpenchannelInteractionEvents[_0xb051('0xe')](_0x3c08f7,_0x4c4cf6);_0x3f956f(null);})[_0xb051('0xf')](_0x3f956f(null));};}for(var e in events){if(events[_0xb051('0x10')](e)){var event=events[e];OpenchannelInteraction[_0xb051('0x11')](e,emitEvent(event));}}module[_0xb051('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 0925bdc..7429d87 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 _0xea9d=['moment','bluebird','request-promise','path','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','lodash','util','api'];(function(_0x4e0b54,_0x4b055c){var _0x1ea8d5=function(_0x16849c){while(--_0x16849c){_0x4e0b54['push'](_0x4e0b54['shift']());}};_0x1ea8d5(++_0x4b055c);}(_0xea9d,0xb8));var _0xdea9=function(_0x4547a9,_0x97c71a){_0x4547a9=_0x4547a9-0x0;var _0x304f17=_0xea9d[_0x4547a9];return _0x304f17;};'use strict';var _=require(_0xdea9('0x0'));var util=require(_0xdea9('0x1'));var logger=require('../../config/logger')(_0xdea9('0x2'));var moment=require(_0xdea9('0x3'));var BPromise=require(_0xdea9('0x4'));var rp=require(_0xdea9('0x5'));var fs=require('fs');var path=require(_0xdea9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdea9('0x7'));module[_0xdea9('0x8')]=function(_0x12ff0c,_0xf1b83f){return _0x12ff0c[_0xdea9('0x9')](_0xdea9('0xa'),attributes,{'tableName':_0xdea9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdea9('0xc'),'collate':_0xdea9('0xd'),'hooks':{'beforeUpdate':function(_0x3ee323,_0x255083,_0xc6422e){if(_0x3ee323['changed'](_0xdea9('0xe'))){_0x3ee323[_0xdea9('0xf')]=moment()[_0xdea9('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0xc6422e(null,_0x3ee323);}}});}; \ No newline at end of file +var _0x0739=['../../config/environment','./openchannelInteraction.attributes','exports','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x45138b,_0xec2bd6){var _0x398884=function(_0x408309){while(--_0x408309){_0x45138b['push'](_0x45138b['shift']());}};_0x398884(++_0xec2bd6);}(_0x0739,0x15f));var _0x9073=function(_0x247c32,_0x7dda79){_0x247c32=_0x247c32-0x0;var _0x5b1521=_0x0739[_0x247c32];return _0x5b1521;};'use strict';var _=require(_0x9073('0x0'));var util=require(_0x9073('0x1'));var logger=require('../../config/logger')(_0x9073('0x2'));var moment=require('moment');var BPromise=require(_0x9073('0x3'));var rp=require(_0x9073('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9073('0x5'));var config=require(_0x9073('0x6'));var attributes=require(_0x9073('0x7'));module[_0x9073('0x8')]=function(_0x42969c,_0x163fae){return _0x42969c['define']('OpenchannelInteraction',attributes,{'tableName':_0x9073('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9073('0xa'),'collate':_0x9073('0xb'),'hooks':{'beforeUpdate':function(_0x19f6b0,_0x58e8e9,_0x42bca9){if(_0x19f6b0[_0x9073('0xc')](_0x9073('0xd'))){_0x19f6b0[_0x9073('0xe')]=moment()[_0x9073('0xf')](_0x9073('0x10'));}_0x42bca9(null,_0x19f6b0);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index c2c7692..42d6219 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 _0xcc17=['message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','AddTagsToOpenchannelInteraction','find','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x59a086,_0x57514c){var _0x588ac7=function(_0x122c4e){while(--_0x122c4e){_0x59a086['push'](_0x59a086['shift']());}};_0x588ac7(++_0x57514c);}(_0xcc17,0xb3));var _0x7cc1=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0xcc17[_0x2932cf];return _0x1711dd;};'use strict';var _=require(_0x7cc1('0x0'));var util=require(_0x7cc1('0x1'));var moment=require(_0x7cc1('0x2'));var BPromise=require(_0x7cc1('0x3'));var rs=require(_0x7cc1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cc1('0x5'))['db'];var utils=require(_0x7cc1('0x6'));var logger=require(_0x7cc1('0x7'))(_0x7cc1('0x8'));var config=require(_0x7cc1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7cc1('0xa')][_0x7cc1('0xb')]({'port':0x232a});config[_0x7cc1('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7cc1('0xd'))(new Redis(config[_0x7cc1('0xc')]));require(_0x7cc1('0xe'))[_0x7cc1('0xf')](socket);function respondWithRpcPromise(_0x504d86,_0x61b34e,_0x853289){return new BPromise(function(_0xbb8ec1,_0x55c490){return client[_0x7cc1('0x10')](_0x504d86,_0x853289)[_0x7cc1('0x11')](function(_0x3236f9){logger[_0x7cc1('0x12')](_0x7cc1('0x13'),_0x61b34e,_0x7cc1('0x14'));logger[_0x7cc1('0x15')](_0x7cc1('0x16'),_0x61b34e,'request\x20sent',JSON[_0x7cc1('0x17')](_0x3236f9));if(_0x3236f9[_0x7cc1('0x18')]){if(_0x3236f9['error'][_0x7cc1('0x19')]===0x1f4){logger[_0x7cc1('0x18')](_0x7cc1('0x13'),_0x61b34e,_0x3236f9[_0x7cc1('0x18')][_0x7cc1('0x1a')]);return _0x55c490(_0x3236f9[_0x7cc1('0x18')][_0x7cc1('0x1a')]);}logger[_0x7cc1('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x61b34e,_0x3236f9[_0x7cc1('0x18')][_0x7cc1('0x1a')]);return _0xbb8ec1(_0x3236f9[_0x7cc1('0x18')][_0x7cc1('0x1a')]);}else{logger[_0x7cc1('0x12')](_0x7cc1('0x13'),_0x61b34e,_0x7cc1('0x14'));_0xbb8ec1(_0x3236f9[_0x7cc1('0x1b')][_0x7cc1('0x1a')]);}})[_0x7cc1('0x1c')](function(_0x14c8eb){logger['error'](_0x7cc1('0x13'),_0x61b34e,_0x14c8eb);_0x55c490(_0x14c8eb);});});}exports[_0x7cc1('0x1d')]=function(_0x137a43){var _0x5d4fba=this;return new Promise(function(_0x7eb377,_0x571a87){return db[_0x7cc1('0x1e')]['update'](_0x137a43[_0x7cc1('0x1f')],{'raw':_0x137a43[_0x7cc1('0x20')]?_0x137a43[_0x7cc1('0x20')][_0x7cc1('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x137a43[_0x7cc1('0x20')]?_0x137a43[_0x7cc1('0x20')][_0x7cc1('0x22')]||null:null,'attributes':_0x137a43[_0x7cc1('0x20')]?_0x137a43[_0x7cc1('0x20')]['attributes']||null:null,'limit':_0x137a43[_0x7cc1('0x20')]?_0x137a43[_0x7cc1('0x20')]['limit']||null:null})[_0x7cc1('0x11')](function(_0x2ed551){logger[_0x7cc1('0x12')](_0x7cc1('0x1d'),_0x137a43);logger[_0x7cc1('0x15')](_0x7cc1('0x1d'),_0x137a43,JSON[_0x7cc1('0x17')](_0x2ed551));_0x7eb377(_0x2ed551);})[_0x7cc1('0x1c')](function(_0x54aa9){logger[_0x7cc1('0x18')](_0x7cc1('0x1d'),_0x54aa9[_0x7cc1('0x1a')],_0x137a43);_0x571a87(_0x5d4fba[_0x7cc1('0x18')](0x1f4,_0x54aa9[_0x7cc1('0x1a')]));});});};exports[_0x7cc1('0x23')]=function(_0x477125){return new Promise(function(_0x4fdf00,_0x41f9ea){return db[_0x7cc1('0x1e')][_0x7cc1('0x24')]({'where':_0x477125[_0x7cc1('0x20')]?_0x477125[_0x7cc1('0x20')][_0x7cc1('0x22')]||null:null})[_0x7cc1('0x11')](function(_0x303728){if(_0x303728){return _0x303728['addTags'](_0x477125['body']['ids'],_[_0x7cc1('0x25')](_0x477125[_0x7cc1('0x1f')],[_0x7cc1('0x26'),'id'])||{});}})[_0x7cc1('0x27')](function(_0xbc4a3){logger[_0x7cc1('0x12')]('AddTags',_0x477125);logger[_0x7cc1('0x15')](_0x7cc1('0x28'),_0x477125,JSON[_0x7cc1('0x17')](_0xbc4a3));_0x4fdf00(_0xbc4a3);})[_0x7cc1('0x1c')](function(_0x217bf9){logger[_0x7cc1('0x18')](_0x7cc1('0x28'),_0x217bf9[_0x7cc1('0x1a')],_0x477125);_0x41f9ea(_this['error'](0x1f4,_0x217bf9[_0x7cc1('0x1a')]));});});}; \ No newline at end of file +var _0x7ac8=['OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','OpenchannelInteraction','update','body','options','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7ac8,0x8b));var _0x87ac=function(_0x34951f,_0x277327){_0x34951f=_0x34951f-0x0;var _0x487db1=_0x7ac8[_0x34951f];return _0x487db1;};'use strict';var _=require('lodash');var util=require(_0x87ac('0x0'));var moment=require(_0x87ac('0x1'));var BPromise=require(_0x87ac('0x2'));var rs=require(_0x87ac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87ac('0x4'))['db'];var utils=require(_0x87ac('0x5'));var logger=require(_0x87ac('0x6'))(_0x87ac('0x7'));var config=require(_0x87ac('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x87ac('0x9')]=_[_0x87ac('0xa')](config[_0x87ac('0x9')],{'host':_0x87ac('0xb'),'port':0x18eb});var socket=require(_0x87ac('0xc'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x87ac('0xd')](socket);function respondWithRpcPromise(_0x47f385,_0x576d8c,_0xc905aa){return new BPromise(function(_0x10fdc8,_0x41843f){return client[_0x87ac('0xe')](_0x47f385,_0xc905aa)[_0x87ac('0xf')](function(_0x7894f4){logger[_0x87ac('0x10')](_0x87ac('0x11'),_0x576d8c,_0x87ac('0x12'));logger[_0x87ac('0x13')](_0x87ac('0x14'),_0x576d8c,_0x87ac('0x12'),JSON[_0x87ac('0x15')](_0x7894f4));if(_0x7894f4['error']){if(_0x7894f4[_0x87ac('0x16')][_0x87ac('0x17')]===0x1f4){logger[_0x87ac('0x16')](_0x87ac('0x11'),_0x576d8c,_0x7894f4[_0x87ac('0x16')][_0x87ac('0x18')]);return _0x41843f(_0x7894f4['error']['message']);}logger[_0x87ac('0x16')](_0x87ac('0x11'),_0x576d8c,_0x7894f4[_0x87ac('0x16')][_0x87ac('0x18')]);return _0x10fdc8(_0x7894f4[_0x87ac('0x16')][_0x87ac('0x18')]);}else{logger[_0x87ac('0x10')](_0x87ac('0x11'),_0x576d8c,_0x87ac('0x12'));_0x10fdc8(_0x7894f4['result']['message']);}})[_0x87ac('0x19')](function(_0x8d30b7){logger['error'](_0x87ac('0x11'),_0x576d8c,_0x8d30b7);_0x41843f(_0x8d30b7);});});}exports['UpdateOpenchannelInteraction']=function(_0x565205){var _0x15d0e3=this;return new Promise(function(_0x2722e7,_0x58baea){return db[_0x87ac('0x1a')][_0x87ac('0x1b')](_0x565205[_0x87ac('0x1c')],{'raw':_0x565205[_0x87ac('0x1d')]?_0x565205[_0x87ac('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x565205[_0x87ac('0x1d')]?_0x565205['options']['where']||null:null,'attributes':_0x565205[_0x87ac('0x1d')]?_0x565205[_0x87ac('0x1d')][_0x87ac('0x1e')]||null:null,'limit':_0x565205[_0x87ac('0x1d')]?_0x565205[_0x87ac('0x1d')][_0x87ac('0x1f')]||null:null})[_0x87ac('0xf')](function(_0x2511d3){logger[_0x87ac('0x10')](_0x87ac('0x20'),_0x565205);logger['debug'](_0x87ac('0x20'),_0x565205,JSON[_0x87ac('0x15')](_0x2511d3));_0x2722e7(_0x2511d3);})[_0x87ac('0x19')](function(_0x234981){logger[_0x87ac('0x16')](_0x87ac('0x20'),_0x234981['message'],_0x565205);_0x58baea(_0x15d0e3[_0x87ac('0x16')](0x1f4,_0x234981[_0x87ac('0x18')]));});});};exports[_0x87ac('0x21')]=function(_0x1f1f0c){return new Promise(function(_0x422a3b,_0x148808){return db[_0x87ac('0x1a')][_0x87ac('0x22')]({'where':_0x1f1f0c[_0x87ac('0x1d')]?_0x1f1f0c[_0x87ac('0x1d')]['where']||null:null})[_0x87ac('0xf')](function(_0x5138d1){if(_0x5138d1){return _0x5138d1[_0x87ac('0x23')](_0x1f1f0c[_0x87ac('0x1c')][_0x87ac('0x24')],_[_0x87ac('0x25')](_0x1f1f0c[_0x87ac('0x1c')],['ids','id'])||{});}})['spread'](function(_0x33621c){logger[_0x87ac('0x10')](_0x87ac('0x26'),_0x1f1f0c);logger[_0x87ac('0x13')]('AddTags',_0x1f1f0c,JSON[_0x87ac('0x15')](_0x33621c));_0x422a3b(_0x33621c);})[_0x87ac('0x19')](function(_0x13c13a){logger[_0x87ac('0x16')]('AddTags',_0x13c13a[_0x87ac('0x18')],_0x1f1f0c);_0x148808(_this[_0x87ac('0x16')](0x1f4,_0x13c13a[_0x87ac('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 10fc848..e5a177c 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 _0x82b2=['update','emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x309d66,_0x59d637){var _0x5f3b67=function(_0x17c8f4){while(--_0x17c8f4){_0x309d66['push'](_0x309d66['shift']());}};_0x5f3b67(++_0x59d637);}(_0x82b2,0x7d));var _0x282b=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0x82b2[_0x14e27a];return _0x288688;};'use strict';var OpenchannelInteractionEvents=require(_0x282b('0x0'));var events=[_0x282b('0x1'),_0x282b('0x2'),_0x282b('0x3')];function createListener(_0x1a60a6,_0x4bf6be){return function(_0x454701){_0x4bf6be[_0x282b('0x4')](_0x1a60a6,_0x454701);};}function removeListener(_0x2630d7,_0x68781b){return function(){OpenchannelInteractionEvents[_0x282b('0x5')](_0x2630d7,_0x68781b);};}exports['register']=function(_0x54ab49){for(var _0x58cdb1=0x0,_0x1e685c=events[_0x282b('0x6')];_0x58cdb1<_0x1e685c;_0x58cdb1++){var _0x57b592=events[_0x58cdb1];var _0x66920a=createListener(_0x282b('0x7')+_0x57b592,_0x54ab49);OpenchannelInteractionEvents['on'](_0x57b592,_0x66920a);}}; \ No newline at end of file +var _0x2439=['openchannelInteraction:','./openchannelInteraction.events','save','remove','emit','removeListener','register'];(function(_0x1d60a7,_0xe6a8f4){var _0x4b46f4=function(_0x1dd25f){while(--_0x1dd25f){_0x1d60a7['push'](_0x1d60a7['shift']());}};_0x4b46f4(++_0xe6a8f4);}(_0x2439,0x1dd));var _0x9243=function(_0x29cd52,_0x88b52b){_0x29cd52=_0x29cd52-0x0;var _0x5218bc=_0x2439[_0x29cd52];return _0x5218bc;};'use strict';var OpenchannelInteractionEvents=require(_0x9243('0x0'));var events=[_0x9243('0x1'),_0x9243('0x2'),'update'];function createListener(_0xfab26a,_0x33e4b7){return function(_0xc6077f){_0x33e4b7[_0x9243('0x3')](_0xfab26a,_0xc6077f);};}function removeListener(_0x3da8b1,_0x3d6355){return function(){OpenchannelInteractionEvents[_0x9243('0x4')](_0x3da8b1,_0x3d6355);};}exports[_0x9243('0x5')]=function(_0xd16866){for(var _0x121b98=0x0,_0xa28807=events['length'];_0x121b98<_0xa28807;_0x121b98++){var _0x3fc064=events[_0x121b98];var _0x4d1a82=createListener(_0x9243('0x6')+_0x3fc064,_0xd16866);OpenchannelInteractionEvents['on'](_0x3fc064,_0x4d1a82);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 316c909..08e2454 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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x28e0c5,_0xae901c){var _0x154afc=function(_0x9a6c91){while(--_0x9a6c91){_0x28e0c5['push'](_0x28e0c5['shift']());}};_0x154afc(++_0xae901c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0xcb91[_0x3e25c1];return _0x52e7f2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x50e40b,_0x338d17){var _0x2608b7=function(_0x4ded5e){while(--_0x4ded5e){_0x50e40b['push'](_0x50e40b['shift']());}};_0x2608b7(++_0x338d17);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0xcb91[_0x2caaef];return _0xd011f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index f3ec6dd..8db5d27 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 _0x05b6=['ENUM','out','DATE','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x05b6,0x74));var _0x605b=function(_0x34620e,_0x582015){_0x34620e=_0x34620e-0x0;var _0x3d33cd=_0x05b6[_0x34620e];return _0x3d33cd;};'use strict';var Sequelize=require(_0x605b('0x0'));module['exports']={'body':{'type':Sequelize[_0x605b('0x1')](_0x605b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x605b('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x605b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x605b('0x4')]('in',_0x605b('0x5')),'defaultValue':_0x605b('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x605b('0x6')]},'providerName':{'type':Sequelize[_0x605b('0x7')]},'providerResponse':{'type':Sequelize[_0x605b('0x1')]}}; \ No newline at end of file +var _0x174b=['medium','BOOLEAN','ENUM','out','TEXT','sequelize'];(function(_0x1b1bd6,_0x38a5d2){var _0x5ec48f=function(_0x4554b9){while(--_0x4554b9){_0x1b1bd6['push'](_0x1b1bd6['shift']());}};_0x5ec48f(++_0x38a5d2);}(_0x174b,0x19d));var _0xb174=function(_0x25dd3f,_0x5d27e9){_0x25dd3f=_0x25dd3f-0x0;var _0x22df6c=_0x174b[_0x25dd3f];return _0x22df6c;};'use strict';var Sequelize=require(_0xb174('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xb174('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xb174('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb174('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb174('0x3')]('in',_0xb174('0x4')),'defaultValue':_0xb174('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb174('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 7f49b28..c2fa9c9 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 _0x8d93=['acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','get','info','rejectMessage','QueryTypes','interface','rejectmessage','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','then','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','set','apply','update','stack','name','index','map','OpenchannelMessage','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','include','rows','show','params','rawAttributes','includeAll','find','create','body','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage'];(function(_0x5cb6c3,_0x2124ac){var _0x471ce5=function(_0x34ccd2){while(--_0x34ccd2){_0x5cb6c3['push'](_0x5cb6c3['shift']());}};_0x471ce5(++_0x2124ac);}(_0x8d93,0x96));var _0x38d9=function(_0x9b6a52,_0x3cb0ab){_0x9b6a52=_0x9b6a52-0x0;var _0x5c5c6f=_0x8d93[_0x9b6a52];return _0x5c5c6f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38d9('0x0'));var zipdir=require(_0x38d9('0x1'));var jsonpatch=require(_0x38d9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x38d9('0x3'));var Mustache=require(_0x38d9('0x4'));var util=require(_0x38d9('0x5'));var path=require(_0x38d9('0x6'));var sox=require('sox');var csv=require(_0x38d9('0x7'));var ejs=require(_0x38d9('0x8'));var fs=require('fs');var fs_extra=require(_0x38d9('0x9'));var _=require(_0x38d9('0xa'));var squel=require('squel');var crypto=require(_0x38d9('0xb'));var jsforce=require(_0x38d9('0xc'));var deskjs=require(_0x38d9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x38d9('0xe'));var Papa=require(_0x38d9('0xf'));var Redis=require(_0x38d9('0x10'));var authService=require(_0x38d9('0x11'));var qs=require(_0x38d9('0x12'));var as=require(_0x38d9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x38d9('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x38d9('0x15'))['db'];config[_0x38d9('0x16')]=_[_0x38d9('0x17')](config[_0x38d9('0x16')],{'host':_0x38d9('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38d9('0x16')]));require(_0x38d9('0x19'))[_0x38d9('0x1a')](socket);var jayson=require(_0x38d9('0x1b'));var client=jayson[_0x38d9('0x1c')][_0x38d9('0x1d')]({'port':0x232c});var client9002=jayson[_0x38d9('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21b547,_0xf1ea86,_0x30c433,_0x5ebf39){return new BPromise(function(_0x3c9f8d,_0x15f239){var _0x343266=_0x5ebf39||client;return _0x343266['request'](_0x21b547,_0x30c433)[_0x38d9('0x1e')](function(_0x48c69){logger['info'](_0x38d9('0x1f'),_0xf1ea86,'request\x20sent');logger[_0x38d9('0x20')](_0x38d9('0x21'),_0xf1ea86,_0x38d9('0x22'),JSON[_0x38d9('0x23')](_0x48c69));if(_0x48c69[_0x38d9('0x24')]){if(_0x48c69[_0x38d9('0x24')][_0x38d9('0x25')]===0x1f4){logger[_0x38d9('0x24')](_0x38d9('0x1f'),_0xf1ea86,_0x48c69[_0x38d9('0x24')][_0x38d9('0x26')]);return _0x15f239(_0x48c69[_0x38d9('0x24')]['message']);}logger['error'](_0x38d9('0x1f'),_0xf1ea86,_0x48c69[_0x38d9('0x24')]['message']);return _0x3c9f8d(_0x48c69[_0x38d9('0x24')]['message']);}else{logger['info'](_0x38d9('0x1f'),_0xf1ea86,_0x38d9('0x22'));_0x3c9f8d(_0x48c69[_0x38d9('0x27')]['message']);}})[_0x38d9('0x28')](function(_0x4c098c){logger[_0x38d9('0x24')](_0x38d9('0x1f'),_0xf1ea86,_0x4c098c);_0x15f239(_0x4c098c);});});}function respondWithStatusCode(_0x53a443,_0x3caaa1){_0x3caaa1=_0x3caaa1||0xcc;return function(_0x19c7fa){if(_0x19c7fa){return _0x53a443['sendStatus'](_0x3caaa1);}return _0x53a443[_0x38d9('0x29')](_0x3caaa1)[_0x38d9('0x2a')]();};}function respondWithResult(_0x3a3e82,_0xe75499){_0xe75499=_0xe75499||0xc8;return function(_0x20304a){if(_0x20304a){return _0x3a3e82[_0x38d9('0x29')](_0xe75499)[_0x38d9('0x2b')](_0x20304a);}};}function respondWithFilteredResult(_0x3348ff,_0x353d05){return function(_0x589279){if(_0x589279){var _0x5398c4=typeof _0x353d05[_0x38d9('0x2c')]===_0x38d9('0x2d')&&typeof _0x353d05[_0x38d9('0x2e')]===_0x38d9('0x2d');var _0x43dd82=_0x589279['count'];var _0x5e81f3=_0x5398c4?0x0:_0x353d05[_0x38d9('0x2c')];var _0x470ced=_0x5398c4?_0x589279['count']:_0x353d05[_0x38d9('0x2c')]+_0x353d05[_0x38d9('0x2e')];var _0x4c78fa;if(_0x470ced>=_0x43dd82){_0x470ced=_0x43dd82;_0x4c78fa=0xc8;}else{_0x4c78fa=0xce;}_0x3348ff['status'](_0x4c78fa);return _0x3348ff[_0x38d9('0x2f')]('Content-Range',_0x5e81f3+'-'+_0x470ced+'/'+_0x43dd82)[_0x38d9('0x2b')](_0x589279);}return null;};}function patchUpdates(_0x228733){return function(_0x7d82d6){try{jsonpatch[_0x38d9('0x30')](_0x7d82d6,_0x228733,!![]);}catch(_0x43116f){return BPromise['reject'](_0x43116f);}return _0x7d82d6['save']();};}function saveUpdates(_0x4d5cda,_0x158082){return function(_0xafe244){if(_0xafe244){return _0xafe244[_0x38d9('0x31')](_0x4d5cda)[_0x38d9('0x1e')](function(_0x1d2727){return _0x1d2727;});}return null;};}function removeEntity(_0x1ce890,_0x431905){return function(_0x44affb){if(_0x44affb){return _0x44affb['destroy']()[_0x38d9('0x1e')](function(){_0x1ce890['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f7a46,_0x39be0d){return function(_0x318120){if(!_0x318120){_0x4f7a46['sendStatus'](0x194);}return _0x318120;};}function handleError(_0x6bdc9c,_0x50bec9){_0x50bec9=_0x50bec9||0x1f4;return function(_0x2d4971){logger[_0x38d9('0x24')](_0x2d4971[_0x38d9('0x32')]);if(_0x2d4971[_0x38d9('0x33')]){delete _0x2d4971[_0x38d9('0x33')];}_0x6bdc9c['status'](_0x50bec9)['send'](_0x2d4971);};}exports[_0x38d9('0x34')]=function(_0x108b8a,_0x2fb70d){var _0x12a96d={},_0x174793={},_0x843685={'count':0x0,'rows':[]};var _0x5c5a55=_[_0x38d9('0x35')](db[_0x38d9('0x36')]['rawAttributes'],function(_0xe96cde){return{'name':_0xe96cde['fieldName'],'type':_0xe96cde['type'][_0x38d9('0x37')]};});_0x174793[_0x38d9('0x38')]=_[_0x38d9('0x35')](_0x5c5a55,_0x38d9('0x33'));_0x174793[_0x38d9('0x39')]=_[_0x38d9('0x3a')](_0x108b8a[_0x38d9('0x39')]);_0x174793[_0x38d9('0x3b')]=_[_0x38d9('0x3c')](_0x174793[_0x38d9('0x38')],_0x174793['query']);_0x12a96d[_0x38d9('0x3d')]=_['intersection'](_0x174793[_0x38d9('0x38')],qs[_0x38d9('0x3e')](_0x108b8a[_0x38d9('0x39')][_0x38d9('0x3e')]));_0x12a96d['attributes']=_0x12a96d['attributes'][_0x38d9('0x3f')]?_0x12a96d['attributes']:_0x174793[_0x38d9('0x38')];if(!_0x108b8a[_0x38d9('0x39')][_0x38d9('0x40')](_0x38d9('0x41'))){_0x12a96d['limit']=qs[_0x38d9('0x2e')](_0x108b8a[_0x38d9('0x39')]['limit']);_0x12a96d['offset']=qs[_0x38d9('0x2c')](_0x108b8a[_0x38d9('0x39')][_0x38d9('0x2c')]);}_0x12a96d[_0x38d9('0x42')]=qs[_0x38d9('0x43')](_0x108b8a[_0x38d9('0x39')][_0x38d9('0x43')]);_0x12a96d[_0x38d9('0x44')]=qs[_0x38d9('0x3b')](_['pick'](_0x108b8a[_0x38d9('0x39')],_0x174793[_0x38d9('0x3b')]),_0x5c5a55);if(_0x108b8a[_0x38d9('0x39')][_0x38d9('0x45')]){_0x12a96d['where']=_[_0x38d9('0x46')](_0x12a96d[_0x38d9('0x44')],{'$or':_[_0x38d9('0x35')](_0x5c5a55,function(_0x452f8d){if(_0x452f8d['type']!==_0x38d9('0x47')){var _0x108a36={};_0x108a36[_0x452f8d[_0x38d9('0x33')]]={'$like':'%'+_0x108b8a[_0x38d9('0x39')][_0x38d9('0x45')]+'%'};return _0x108a36;}})});}_0x12a96d=_['merge']({},_0x12a96d,_0x108b8a[_0x38d9('0x48')]);var _0x2a1ba0={'where':_0x12a96d[_0x38d9('0x44')]};return db[_0x38d9('0x36')][_0x38d9('0x49')](_0x2a1ba0)['then'](function(_0x4e671d){_0x843685['count']=_0x4e671d;if(_0x108b8a[_0x38d9('0x39')]['includeAll']){_0x12a96d[_0x38d9('0x4a')]=[{'all':!![]}];}return db[_0x38d9('0x36')]['findAll'](_0x12a96d);})['then'](function(_0x4e7d14){_0x843685[_0x38d9('0x4b')]=_0x4e7d14;return _0x843685;})[_0x38d9('0x1e')](respondWithFilteredResult(_0x2fb70d,_0x12a96d))[_0x38d9('0x28')](handleError(_0x2fb70d,null));};exports[_0x38d9('0x4c')]=function(_0x5f1dba,_0x929e03){var _0x5a942e={'raw':!![],'where':{'id':_0x5f1dba[_0x38d9('0x4d')]['id']}},_0x202c08={};_0x202c08[_0x38d9('0x38')]=_[_0x38d9('0x3a')](db['OpenchannelMessage'][_0x38d9('0x4e')]);_0x202c08[_0x38d9('0x39')]=_[_0x38d9('0x3a')](_0x5f1dba['query']);_0x202c08[_0x38d9('0x3b')]=_[_0x38d9('0x3c')](_0x202c08[_0x38d9('0x38')],_0x202c08[_0x38d9('0x39')]);_0x5a942e['attributes']=_[_0x38d9('0x3c')](_0x202c08[_0x38d9('0x38')],qs[_0x38d9('0x3e')](_0x5f1dba[_0x38d9('0x39')]['fields']));_0x5a942e[_0x38d9('0x3d')]=_0x5a942e[_0x38d9('0x3d')][_0x38d9('0x3f')]?_0x5a942e[_0x38d9('0x3d')]:_0x202c08['model'];if(_0x5f1dba[_0x38d9('0x39')][_0x38d9('0x4f')]){_0x5a942e[_0x38d9('0x4a')]=[{'all':!![]}];}_0x5a942e=_[_0x38d9('0x46')]({},_0x5a942e,_0x5f1dba[_0x38d9('0x48')]);return db[_0x38d9('0x36')][_0x38d9('0x50')](_0x5a942e)[_0x38d9('0x1e')](handleEntityNotFound(_0x929e03,null))['then'](respondWithResult(_0x929e03,null))[_0x38d9('0x28')](handleError(_0x929e03,null));};exports[_0x38d9('0x51')]=function(_0x154217,_0x5a97e9){return db[_0x38d9('0x36')][_0x38d9('0x51')](_0x154217[_0x38d9('0x52')],{})[_0x38d9('0x1e')](respondWithResult(_0x5a97e9,0xc9))[_0x38d9('0x28')](handleError(_0x5a97e9,null));};exports[_0x38d9('0x31')]=function(_0x17be35,_0x105dfd){if(_0x17be35[_0x38d9('0x52')]['id']){delete _0x17be35[_0x38d9('0x52')]['id'];}return db[_0x38d9('0x36')]['find']({'where':{'id':_0x17be35[_0x38d9('0x4d')]['id']}})[_0x38d9('0x1e')](handleEntityNotFound(_0x105dfd,null))[_0x38d9('0x1e')](saveUpdates(_0x17be35[_0x38d9('0x52')],null))[_0x38d9('0x1e')](respondWithResult(_0x105dfd,null))[_0x38d9('0x28')](handleError(_0x105dfd,null));};exports['destroy']=function(_0x5ec702,_0x2f2c93){return db[_0x38d9('0x36')][_0x38d9('0x50')]({'where':{'id':_0x5ec702[_0x38d9('0x4d')]['id']}})[_0x38d9('0x1e')](handleEntityNotFound(_0x2f2c93,null))[_0x38d9('0x1e')](removeEntity(_0x2f2c93,null))[_0x38d9('0x28')](handleError(_0x2f2c93,null));};exports['describe']=function(_0x588649,_0xb58969){return db[_0x38d9('0x36')]['describe']()[_0x38d9('0x1e')](respondWithResult(_0xb58969,null))['catch'](handleError(_0xb58969,null));};var interaction_log=require(_0x38d9('0x14'))(_0x38d9('0x53'));exports[_0x38d9('0x54')]=function(_0x4236cd,_0x38ee96,_0x4dbe99){var _0x5664ad={'agent':{},'channel':_0x38d9('0x55')};if(_0x4236cd['body']['id']){delete _0x4236cd[_0x38d9('0x52')]['id'];}_0x4236cd[_0x38d9('0x52')][_0x38d9('0x56')]=!![];_0x4236cd[_0x38d9('0x52')][_0x38d9('0x57')]=moment()['format'](_0x38d9('0x58'));_0x4236cd['body'][_0x38d9('0x59')]=_0x4236cd[_0x38d9('0x52')][_0x38d9('0x59')]||_0x4236cd[_0x38d9('0x5a')]['id'];_0x5664ad[_0x38d9('0x5b')]['id']=_0x4236cd[_0x38d9('0x52')][_0x38d9('0x59')];return db['OpenchannelMessage'][_0x38d9('0x50')]({'where':{'id':_0x4236cd['params']['id'],'UserId':null}})[_0x38d9('0x1e')](handleEntityNotFound(_0x38ee96,null))[_0x38d9('0x1e')](saveUpdates(_0x4236cd[_0x38d9('0x52')],null))['then'](function(_0xa17d0a){if(_0xa17d0a){_0x5664ad[_0x38d9('0x26')]=_0xa17d0a['get']({'plain':!![]});return db[_0x38d9('0x5c')][_0x38d9('0x50')]({'where':{'id':_0xa17d0a[_0x38d9('0x5d')]}});}return null;})['then'](handleEntityNotFound(_0x38ee96,null))[_0x38d9('0x1e')](function(_0x31ddb5){if(_0x31ddb5){return _0x31ddb5[_0x38d9('0x31')]({'UserId':_0x4236cd[_0x38d9('0x52')][_0x38d9('0x59')],'read1stAt':_[_0x38d9('0x5e')](_0x31ddb5[_0x38d9('0x5f')])?moment()[_0x38d9('0x60')](_0x38d9('0x58')):undefined});}return null;})[_0x38d9('0x1e')](function(_0x564ed8){if(_0x564ed8){_0x5664ad['interaction']=_0x564ed8['get']({'plain':!![]});interaction_log['info'](_0x38d9('0x61'),_0x4236cd[_0x38d9('0x5a')]['id'],_0x4236cd[_0x38d9('0x5a')][_0x38d9('0x33')],_0x4236cd[_0x38d9('0x5a')][_0x38d9('0x62')],_0x5664ad[_0x38d9('0x63')]['id'],_0x4236cd[_0x38d9('0x52')]?JSON[_0x38d9('0x23')](_0x4236cd[_0x38d9('0x52')]):_0x38d9('0x64'));return respondWithRpcPromise(_0x38d9('0x65'),_0x38d9('0x66'),_0x5664ad);}return null;})[_0x38d9('0x1e')](function(_0x43fd87){var _0x1afb8b=_0x38d9('0x67')+_0x43fd87[_0x38d9('0x26')][_0x38d9('0x68')];return db[_0x38d9('0x69')]['query'](_0x1afb8b,{'type':db[_0x38d9('0x6a')]['QueryTypes'][_0x38d9('0x6b')],'raw':!![]})['then'](function(_0x2d7812){return _0x2d7812;});})[_0x38d9('0x1e')](function(_0x31d7eb){if(_0x31d7eb){_0x5664ad['message'][_0x38d9('0x6c')]=_0x31d7eb[0x0];if(!_0x4236cd['body']['UserId'])return;return db[_0x38d9('0x6d')][_0x38d9('0x50')]({'where':{'id':_0x4236cd['body'][_0x38d9('0x59')],'role':'agent'},'attributes':['id',_0x38d9('0x33'),_0x38d9('0x6e'),_0x38d9('0x6f'),'internal'],'raw':!![]});}return null;})[_0x38d9('0x1e')](function(_0x330946){if(!_0x330946)return null;_0x5664ad[_0x38d9('0x26')][_0x38d9('0x5b')]=_0x330946;return _0x5664ad;})[_0x38d9('0x1e')](function(_0x56233b){if(_0x56233b){if(_0x4236cd[_0x38d9('0x52')][_0x38d9('0x70')]){_0x5664ad[_0x38d9('0x26')]['interface']=util['format'](_0x38d9('0x71'),_0x4236cd[_0x38d9('0x5a')][_0x38d9('0x33')]);_0x5664ad['message'][_0x38d9('0x72')]=_0x5664ad[_0x38d9('0x72')];_0x5664ad[_0x38d9('0x26')][_0x38d9('0x73')]=_0x5664ad[_0x38d9('0x72')];_0x5664ad[_0x38d9('0x26')][_0x38d9('0x74')]='accept';return respondWithRpcPromise('EventManager',_0x38d9('0x75'),{'event':_0x38d9('0x76'),'message':_0x5664ad[_0x38d9('0x26')]},client9002)[_0x38d9('0x1e')](function(){return _0x5664ad;});}return _0x5664ad;}return null;})[_0x38d9('0x1e')](respondWithResult(_0x38ee96,null))[_0x38d9('0x28')](handleError(_0x38ee96,null));};var interaction_log=require(_0x38d9('0x14'))(_0x38d9('0x53'));exports[_0x38d9('0x77')]=function(_0x516455,_0x32b1a7,_0x30d3f1){var _0x10fc90={'agent':{},'channel':_0x38d9('0x55')};if(_0x516455[_0x38d9('0x52')]['id']){delete _0x516455[_0x38d9('0x52')]['id'];}_0x516455[_0x38d9('0x52')][_0x38d9('0x59')]=_0x516455[_0x38d9('0x52')]['UserId']||_0x516455[_0x38d9('0x5a')]['id'];_0x10fc90['agent']['id']=_0x516455[_0x38d9('0x52')][_0x38d9('0x59')];return db[_0x38d9('0x36')]['find']({'where':{'id':_0x516455[_0x38d9('0x4d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x32b1a7,null))[_0x38d9('0x1e')](function(_0x5369af){if(_0x5369af){_0x10fc90['message']=_0x5369af[_0x38d9('0x78')]({'plain':!![]});return db[_0x38d9('0x5c')][_0x38d9('0x50')]({'where':{'id':_0x5369af[_0x38d9('0x5d')]}});}return null;})['then'](handleEntityNotFound(_0x32b1a7,null))[_0x38d9('0x1e')](function(_0x1b3951){if(_0x1b3951){_0x10fc90[_0x38d9('0x63')]=_0x1b3951['get']({'plain':!![]});interaction_log[_0x38d9('0x79')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x516455[_0x38d9('0x5a')]['id'],_0x516455[_0x38d9('0x5a')][_0x38d9('0x33')],_0x516455[_0x38d9('0x5a')]['role'],_0x10fc90['interaction']['id'],_0x516455[_0x38d9('0x52')]?JSON[_0x38d9('0x23')](_0x516455[_0x38d9('0x52')]):_0x38d9('0x64'));return respondWithRpcPromise('RejectMessage',_0x38d9('0x7a'),_0x10fc90);}return null;})['then'](function(_0x3baf94){var _0x385284=_0x38d9('0x67')+_0x3baf94[_0x38d9('0x26')][_0x38d9('0x68')];return db['sequelize'][_0x38d9('0x39')](_0x385284,{'type':db[_0x38d9('0x6a')][_0x38d9('0x7b')]['SELECT'],'raw':!![]})['then'](function(_0xad912b){return _0xad912b;});})['then'](function(_0x364287){if(_0x364287){_0x10fc90['message'][_0x38d9('0x6c')]=_0x364287[0x0];if(!_0x516455[_0x38d9('0x52')]['UserId'])return;return db[_0x38d9('0x6d')][_0x38d9('0x50')]({'where':{'id':_0x516455[_0x38d9('0x52')]['UserId'],'role':_0x38d9('0x5b')},'attributes':['id','name',_0x38d9('0x6e'),_0x38d9('0x6f'),'internal'],'raw':!![]});}return null;})[_0x38d9('0x1e')](function(_0x22757f){if(!_0x22757f)return null;_0x10fc90['message'][_0x38d9('0x5b')]=_0x22757f;return _0x10fc90;})[_0x38d9('0x1e')](function(_0x176850){if(_0x176850){_0x176850['message'][_0x38d9('0x7c')]=util[_0x38d9('0x60')](_0x38d9('0x71'),_0x516455[_0x38d9('0x5a')][_0x38d9('0x33')]);_0x176850['message'][_0x38d9('0x72')]=_0x10fc90['channel'];_0x176850[_0x38d9('0x26')]['motionChannel']=_0x10fc90[_0x38d9('0x72')];_0x176850[_0x38d9('0x26')]['event']=_0x38d9('0x77');respondWithRpcPromise(_0x38d9('0x75'),_0x38d9('0x75'),{'event':_0x38d9('0x7d'),'message':_0x176850[_0x38d9('0x26')]},client9002);return _0x10fc90;}return null;})['then'](respondWithResult(_0x32b1a7,null))[_0x38d9('0x28')](handleError(_0x32b1a7,null));}; \ No newline at end of file +var _0x71f3=['type','map','query','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','OpenchannelMessage','includeAll','include','show','params','keys','length','options','find','create','body','describe','openchannel-interactions','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','acceptmessage','../../config/logger','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','fullname','EventManager','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','fieldName'];(function(_0x1062a2,_0xabb7f1){var _0x440322=function(_0x33e030){while(--_0x33e030){_0x1062a2['push'](_0x1062a2['shift']());}};_0x440322(++_0xabb7f1);}(_0x71f3,0x13f));var _0x371f=function(_0x107daa,_0x30e0f6){_0x107daa=_0x107daa-0x0;var _0x253fca=_0x71f3[_0x107daa];return _0x253fca;};'use strict';var emlformat=require(_0x371f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x371f('0x1'));var jsonpatch=require(_0x371f('0x2'));var rp=require(_0x371f('0x3'));var moment=require(_0x371f('0x4'));var BPromise=require(_0x371f('0x5'));var Mustache=require(_0x371f('0x6'));var util=require('util');var path=require(_0x371f('0x7'));var sox=require(_0x371f('0x8'));var csv=require(_0x371f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x371f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x371f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x371f('0xc'));var Redis=require(_0x371f('0xd'));var authService=require(_0x371f('0xe'));var qs=require(_0x371f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x371f('0x10'));var config=require(_0x371f('0x11'));var licenseUtil=require(_0x371f('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x371f('0x13')](config[_0x371f('0x14')],{'host':_0x371f('0x15'),'port':0x18eb});var socket=require(_0x371f('0x16'))(new Redis(config['redis']));require(_0x371f('0x17'))[_0x371f('0x18')](socket);var jayson=require(_0x371f('0x19'));var client=jayson[_0x371f('0x1a')][_0x371f('0x1b')]({'port':0x232c});var client9002=jayson[_0x371f('0x1a')][_0x371f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5792f9,_0x2ef58f,_0x3efdfe,_0x2b04d8){return new BPromise(function(_0x273e34,_0x39ad54){var _0x598605=_0x2b04d8||client;return _0x598605[_0x371f('0x1c')](_0x5792f9,_0x3efdfe)[_0x371f('0x1d')](function(_0x56a42b){logger[_0x371f('0x1e')](_0x371f('0x1f'),_0x2ef58f,_0x371f('0x20'));logger[_0x371f('0x21')](_0x371f('0x22'),_0x2ef58f,_0x371f('0x20'),JSON['stringify'](_0x56a42b));if(_0x56a42b[_0x371f('0x23')]){if(_0x56a42b['error'][_0x371f('0x24')]===0x1f4){logger[_0x371f('0x23')](_0x371f('0x1f'),_0x2ef58f,_0x56a42b[_0x371f('0x23')]['message']);return _0x39ad54(_0x56a42b[_0x371f('0x23')]['message']);}logger[_0x371f('0x23')](_0x371f('0x1f'),_0x2ef58f,_0x56a42b[_0x371f('0x23')][_0x371f('0x25')]);return _0x273e34(_0x56a42b[_0x371f('0x23')][_0x371f('0x25')]);}else{logger[_0x371f('0x1e')](_0x371f('0x1f'),_0x2ef58f,_0x371f('0x20'));_0x273e34(_0x56a42b[_0x371f('0x26')]['message']);}})[_0x371f('0x27')](function(_0x25bd09){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x2ef58f,_0x25bd09);_0x39ad54(_0x25bd09);});});}function respondWithStatusCode(_0x1f31d3,_0x4f98b6){_0x4f98b6=_0x4f98b6||0xcc;return function(_0x5c15eb){if(_0x5c15eb){return _0x1f31d3['sendStatus'](_0x4f98b6);}return _0x1f31d3['status'](_0x4f98b6)[_0x371f('0x28')]();};}function respondWithResult(_0x398505,_0x4a31ea){_0x4a31ea=_0x4a31ea||0xc8;return function(_0x336423){if(_0x336423){return _0x398505[_0x371f('0x29')](_0x4a31ea)[_0x371f('0x2a')](_0x336423);}};}function respondWithFilteredResult(_0x476e95,_0xf9d6b0){return function(_0x1b31c1){if(_0x1b31c1){var _0x576dc8=typeof _0xf9d6b0[_0x371f('0x2b')]===_0x371f('0x2c')&&typeof _0xf9d6b0[_0x371f('0x2d')]===_0x371f('0x2c');var _0x30008d=_0x1b31c1[_0x371f('0x2e')];var _0x5156ac=_0x576dc8?0x0:_0xf9d6b0[_0x371f('0x2b')];var _0x23da5d=_0x576dc8?_0x1b31c1['count']:_0xf9d6b0['offset']+_0xf9d6b0['limit'];var _0x383ee4;if(_0x23da5d>=_0x30008d){_0x23da5d=_0x30008d;_0x383ee4=0xc8;}else{_0x383ee4=0xce;}_0x476e95[_0x371f('0x29')](_0x383ee4);return _0x476e95['set'](_0x371f('0x2f'),_0x5156ac+'-'+_0x23da5d+'/'+_0x30008d)[_0x371f('0x2a')](_0x1b31c1);}return null;};}function patchUpdates(_0xa9ba64){return function(_0x2dd322){try{jsonpatch[_0x371f('0x30')](_0x2dd322,_0xa9ba64,!![]);}catch(_0x5e6180){return BPromise[_0x371f('0x31')](_0x5e6180);}return _0x2dd322[_0x371f('0x32')]();};}function saveUpdates(_0x27cdec,_0x11b224){return function(_0x164cfe){if(_0x164cfe){return _0x164cfe[_0x371f('0x33')](_0x27cdec)[_0x371f('0x1d')](function(_0x3e0ec4){return _0x3e0ec4;});}return null;};}function removeEntity(_0x3c9de7,_0x1624d7){return function(_0x4db341){if(_0x4db341){return _0x4db341[_0x371f('0x34')]()[_0x371f('0x1d')](function(){_0x3c9de7[_0x371f('0x29')](0xcc)[_0x371f('0x28')]();});}};}function handleEntityNotFound(_0x91f45d,_0x423273){return function(_0x234d88){if(!_0x234d88){_0x91f45d['sendStatus'](0x194);}return _0x234d88;};}function handleError(_0x2da65f,_0x125415){_0x125415=_0x125415||0x1f4;return function(_0x1e15dc){logger['error'](_0x1e15dc[_0x371f('0x35')]);if(_0x1e15dc['name']){delete _0x1e15dc[_0x371f('0x36')];}_0x2da65f[_0x371f('0x29')](_0x125415)[_0x371f('0x37')](_0x1e15dc);};}exports[_0x371f('0x38')]=function(_0x3c8745,_0x2077fe){var _0x14d1be={},_0x399e7b={},_0x4a4c00={'count':0x0,'rows':[]};var _0x20697e=_['map'](db['OpenchannelMessage'][_0x371f('0x39')],function(_0x363031){return{'name':_0x363031[_0x371f('0x3a')],'type':_0x363031[_0x371f('0x3b')]['key']};});_0x399e7b['model']=_[_0x371f('0x3c')](_0x20697e,'name');_0x399e7b[_0x371f('0x3d')]=_['keys'](_0x3c8745['query']);_0x399e7b[_0x371f('0x3e')]=_[_0x371f('0x3f')](_0x399e7b['model'],_0x399e7b[_0x371f('0x3d')]);_0x14d1be[_0x371f('0x40')]=_[_0x371f('0x3f')](_0x399e7b[_0x371f('0x41')],qs['fields'](_0x3c8745[_0x371f('0x3d')][_0x371f('0x42')]));_0x14d1be[_0x371f('0x40')]=_0x14d1be['attributes']['length']?_0x14d1be[_0x371f('0x40')]:_0x399e7b[_0x371f('0x41')];if(!_0x3c8745['query'][_0x371f('0x43')]('nolimit')){_0x14d1be[_0x371f('0x2d')]=qs[_0x371f('0x2d')](_0x3c8745[_0x371f('0x3d')]['limit']);_0x14d1be['offset']=qs[_0x371f('0x2b')](_0x3c8745[_0x371f('0x3d')][_0x371f('0x2b')]);}_0x14d1be[_0x371f('0x44')]=qs[_0x371f('0x45')](_0x3c8745['query'][_0x371f('0x45')]);_0x14d1be[_0x371f('0x46')]=qs[_0x371f('0x3e')](_['pick'](_0x3c8745['query'],_0x399e7b[_0x371f('0x3e')]),_0x20697e);if(_0x3c8745['query']['filter']){_0x14d1be[_0x371f('0x46')]=_[_0x371f('0x47')](_0x14d1be[_0x371f('0x46')],{'$or':_[_0x371f('0x3c')](_0x20697e,function(_0x219525){if(_0x219525[_0x371f('0x3b')]!==_0x371f('0x48')){var _0x5cd054={};_0x5cd054[_0x219525[_0x371f('0x36')]]={'$like':'%'+_0x3c8745['query']['filter']+'%'};return _0x5cd054;}})});}_0x14d1be=_[_0x371f('0x47')]({},_0x14d1be,_0x3c8745['options']);var _0x4dbd36={'where':_0x14d1be[_0x371f('0x46')]};return db[_0x371f('0x49')][_0x371f('0x2e')](_0x4dbd36)['then'](function(_0x4ce360){_0x4a4c00[_0x371f('0x2e')]=_0x4ce360;if(_0x3c8745[_0x371f('0x3d')][_0x371f('0x4a')]){_0x14d1be[_0x371f('0x4b')]=[{'all':!![]}];}return db[_0x371f('0x49')]['findAll'](_0x14d1be);})[_0x371f('0x1d')](function(_0x100cb6){_0x4a4c00['rows']=_0x100cb6;return _0x4a4c00;})['then'](respondWithFilteredResult(_0x2077fe,_0x14d1be))['catch'](handleError(_0x2077fe,null));};exports[_0x371f('0x4c')]=function(_0x20b34b,_0x2c8c19){var _0x2663e0={'raw':!![],'where':{'id':_0x20b34b[_0x371f('0x4d')]['id']}},_0x123123={};_0x123123[_0x371f('0x41')]=_[_0x371f('0x4e')](db[_0x371f('0x49')]['rawAttributes']);_0x123123['query']=_['keys'](_0x20b34b[_0x371f('0x3d')]);_0x123123[_0x371f('0x3e')]=_[_0x371f('0x3f')](_0x123123[_0x371f('0x41')],_0x123123[_0x371f('0x3d')]);_0x2663e0['attributes']=_['intersection'](_0x123123[_0x371f('0x41')],qs[_0x371f('0x42')](_0x20b34b[_0x371f('0x3d')][_0x371f('0x42')]));_0x2663e0['attributes']=_0x2663e0[_0x371f('0x40')][_0x371f('0x4f')]?_0x2663e0['attributes']:_0x123123[_0x371f('0x41')];if(_0x20b34b['query'][_0x371f('0x4a')]){_0x2663e0[_0x371f('0x4b')]=[{'all':!![]}];}_0x2663e0=_[_0x371f('0x47')]({},_0x2663e0,_0x20b34b[_0x371f('0x50')]);return db[_0x371f('0x49')][_0x371f('0x51')](_0x2663e0)['then'](handleEntityNotFound(_0x2c8c19,null))[_0x371f('0x1d')](respondWithResult(_0x2c8c19,null))[_0x371f('0x27')](handleError(_0x2c8c19,null));};exports[_0x371f('0x52')]=function(_0x4cb153,_0x4a3d03){return db[_0x371f('0x49')][_0x371f('0x52')](_0x4cb153[_0x371f('0x53')],{})[_0x371f('0x1d')](respondWithResult(_0x4a3d03,0xc9))['catch'](handleError(_0x4a3d03,null));};exports[_0x371f('0x33')]=function(_0x297b42,_0x239978){if(_0x297b42[_0x371f('0x53')]['id']){delete _0x297b42['body']['id'];}return db[_0x371f('0x49')]['find']({'where':{'id':_0x297b42['params']['id']}})['then'](handleEntityNotFound(_0x239978,null))[_0x371f('0x1d')](saveUpdates(_0x297b42[_0x371f('0x53')],null))['then'](respondWithResult(_0x239978,null))[_0x371f('0x27')](handleError(_0x239978,null));};exports[_0x371f('0x34')]=function(_0x5bc897,_0x297136){return db[_0x371f('0x49')][_0x371f('0x51')]({'where':{'id':_0x5bc897['params']['id']}})[_0x371f('0x1d')](handleEntityNotFound(_0x297136,null))[_0x371f('0x1d')](removeEntity(_0x297136,null))[_0x371f('0x27')](handleError(_0x297136,null));};exports[_0x371f('0x54')]=function(_0x20e5c2,_0x59382f){return db[_0x371f('0x49')][_0x371f('0x54')]()[_0x371f('0x1d')](respondWithResult(_0x59382f,null))[_0x371f('0x27')](handleError(_0x59382f,null));};var interaction_log=require('../../config/logger')(_0x371f('0x55'));exports['accept']=function(_0x581e55,_0x556db2,_0x32f7af){var _0x229f9d={'agent':{},'channel':_0x371f('0x56')};if(_0x581e55[_0x371f('0x53')]['id']){delete _0x581e55[_0x371f('0x53')]['id'];}_0x581e55[_0x371f('0x53')]['read']=!![];_0x581e55['body'][_0x371f('0x57')]=moment()[_0x371f('0x58')](_0x371f('0x59'));_0x581e55[_0x371f('0x53')]['UserId']=_0x581e55[_0x371f('0x53')][_0x371f('0x5a')]||_0x581e55['user']['id'];_0x229f9d['agent']['id']=_0x581e55[_0x371f('0x53')][_0x371f('0x5a')];return db['OpenchannelMessage'][_0x371f('0x51')]({'where':{'id':_0x581e55[_0x371f('0x4d')]['id'],'UserId':null}})[_0x371f('0x1d')](handleEntityNotFound(_0x556db2,null))[_0x371f('0x1d')](saveUpdates(_0x581e55[_0x371f('0x53')],null))[_0x371f('0x1d')](function(_0x595a37){if(_0x595a37){_0x229f9d['message']=_0x595a37['get']({'plain':!![]});return db[_0x371f('0x5b')][_0x371f('0x51')]({'where':{'id':_0x595a37[_0x371f('0x5c')]}});}return null;})['then'](handleEntityNotFound(_0x556db2,null))[_0x371f('0x1d')](function(_0x222cd1){if(_0x222cd1){return _0x222cd1['update']({'UserId':_0x581e55[_0x371f('0x53')]['UserId'],'read1stAt':_[_0x371f('0x5d')](_0x222cd1['read1stAt'])?moment()[_0x371f('0x58')](_0x371f('0x59')):undefined});}return null;})[_0x371f('0x1d')](function(_0x59df57){if(_0x59df57){_0x229f9d[_0x371f('0x5e')]=_0x59df57[_0x371f('0x5f')]({'plain':!![]});interaction_log[_0x371f('0x1e')](_0x371f('0x60'),_0x581e55['user']['id'],_0x581e55['user'][_0x371f('0x36')],_0x581e55[_0x371f('0x61')][_0x371f('0x62')],_0x229f9d[_0x371f('0x5e')]['id'],_0x581e55[_0x371f('0x53')]?JSON[_0x371f('0x63')](_0x581e55[_0x371f('0x53')]):'null');return respondWithRpcPromise(_0x371f('0x64'),_0x371f('0x65'),_0x229f9d);}return null;})[_0x371f('0x1d')](function(_0x503c7a){var _0x3292a0=_0x371f('0x66')+_0x503c7a[_0x371f('0x25')]['ContactId'];return db[_0x371f('0x67')]['query'](_0x3292a0,{'type':db[_0x371f('0x68')][_0x371f('0x69')][_0x371f('0x6a')],'raw':!![]})[_0x371f('0x1d')](function(_0x4c2681){return _0x4c2681;});})['then'](function(_0x462da8){if(_0x462da8){_0x229f9d[_0x371f('0x25')][_0x371f('0x6b')]=_0x462da8[0x0];if(!_0x581e55['body'][_0x371f('0x5a')])return;return db[_0x371f('0x6c')][_0x371f('0x51')]({'where':{'id':_0x581e55[_0x371f('0x53')]['UserId'],'role':_0x371f('0x6d')},'attributes':['id',_0x371f('0x36'),'fullname',_0x371f('0x6e'),_0x371f('0x6f')],'raw':!![]});}return null;})[_0x371f('0x1d')](function(_0x214f75){if(!_0x214f75)return null;_0x229f9d[_0x371f('0x25')][_0x371f('0x6d')]=_0x214f75;return _0x229f9d;})['then'](function(_0x3903ce){if(_0x3903ce){if(_0x581e55[_0x371f('0x53')][_0x371f('0x70')]){_0x229f9d[_0x371f('0x25')][_0x371f('0x71')]=util[_0x371f('0x58')](_0x371f('0x72'),_0x581e55[_0x371f('0x61')][_0x371f('0x36')]);_0x229f9d['message']['channel']=_0x229f9d[_0x371f('0x73')];_0x229f9d[_0x371f('0x25')][_0x371f('0x74')]=_0x229f9d[_0x371f('0x73')];_0x229f9d['message'][_0x371f('0x75')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0x371f('0x76'),'message':_0x229f9d['message']},client9002)['then'](function(){return _0x229f9d;});}return _0x229f9d;}return null;})[_0x371f('0x1d')](respondWithResult(_0x556db2,null))[_0x371f('0x27')](handleError(_0x556db2,null));};var interaction_log=require(_0x371f('0x77'))(_0x371f('0x55'));exports[_0x371f('0x31')]=function(_0x15dce7,_0x35f409,_0x56ad8d){var _0x10c7eb={'agent':{},'channel':'openchannel'};if(_0x15dce7[_0x371f('0x53')]['id']){delete _0x15dce7[_0x371f('0x53')]['id'];}_0x15dce7[_0x371f('0x53')][_0x371f('0x5a')]=_0x15dce7[_0x371f('0x53')][_0x371f('0x5a')]||_0x15dce7[_0x371f('0x61')]['id'];_0x10c7eb[_0x371f('0x6d')]['id']=_0x15dce7['body']['UserId'];return db[_0x371f('0x49')][_0x371f('0x51')]({'where':{'id':_0x15dce7[_0x371f('0x4d')]['id'],'UserId':null}})[_0x371f('0x1d')](handleEntityNotFound(_0x35f409,null))['then'](function(_0x13eb95){if(_0x13eb95){_0x10c7eb['message']=_0x13eb95[_0x371f('0x5f')]({'plain':!![]});return db[_0x371f('0x5b')][_0x371f('0x51')]({'where':{'id':_0x13eb95[_0x371f('0x5c')]}});}return null;})['then'](handleEntityNotFound(_0x35f409,null))['then'](function(_0x2e0fa9){if(_0x2e0fa9){_0x10c7eb[_0x371f('0x5e')]=_0x2e0fa9['get']({'plain':!![]});interaction_log[_0x371f('0x1e')](_0x371f('0x78'),_0x15dce7[_0x371f('0x61')]['id'],_0x15dce7[_0x371f('0x61')][_0x371f('0x36')],_0x15dce7[_0x371f('0x61')]['role'],_0x10c7eb[_0x371f('0x5e')]['id'],_0x15dce7[_0x371f('0x53')]?JSON[_0x371f('0x63')](_0x15dce7[_0x371f('0x53')]):'null');return respondWithRpcPromise(_0x371f('0x79'),'rejectMessage',_0x10c7eb);}return null;})[_0x371f('0x1d')](function(_0xb02d79){var _0x9b69c=_0x371f('0x66')+_0xb02d79['message'][_0x371f('0x7a')];return db[_0x371f('0x67')]['query'](_0x9b69c,{'type':db[_0x371f('0x68')][_0x371f('0x69')][_0x371f('0x6a')],'raw':!![]})['then'](function(_0x4530b7){return _0x4530b7;});})[_0x371f('0x1d')](function(_0x26a894){if(_0x26a894){_0x10c7eb['message'][_0x371f('0x6b')]=_0x26a894[0x0];if(!_0x15dce7[_0x371f('0x53')][_0x371f('0x5a')])return;return db['User'][_0x371f('0x51')]({'where':{'id':_0x15dce7[_0x371f('0x53')]['UserId'],'role':_0x371f('0x6d')},'attributes':['id',_0x371f('0x36'),_0x371f('0x7b'),_0x371f('0x6e'),'internal'],'raw':!![]});}return null;})[_0x371f('0x1d')](function(_0x34d8bd){if(!_0x34d8bd)return null;_0x10c7eb[_0x371f('0x25')][_0x371f('0x6d')]=_0x34d8bd;return _0x10c7eb;})[_0x371f('0x1d')](function(_0x438e98){if(_0x438e98){_0x438e98[_0x371f('0x25')][_0x371f('0x71')]=util[_0x371f('0x58')](_0x371f('0x72'),_0x15dce7[_0x371f('0x61')][_0x371f('0x36')]);_0x438e98['message']['channel']=_0x10c7eb[_0x371f('0x73')];_0x438e98[_0x371f('0x25')][_0x371f('0x74')]=_0x10c7eb[_0x371f('0x73')];_0x438e98[_0x371f('0x25')][_0x371f('0x75')]=_0x371f('0x31');respondWithRpcPromise(_0x371f('0x7c'),'EventManager',{'event':_0x371f('0x7d'),'message':_0x438e98['message']},client9002);return _0x10c7eb;}return null;})[_0x371f('0x1d')](respondWithResult(_0x35f409,null))[_0x371f('0x27')](handleError(_0x35f409,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index a772c36..a557070 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 _0x81b3=['OpenchannelMessage','setMaxListeners','save','update','remove','emit','events','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x81b3,0x1be));var _0x381b=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x81b3[_0xefd519];return _0x4bb882;};'use strict';var EventEmitter=require(_0x381b('0x0'));var OpenchannelMessage=require(_0x381b('0x1'))['db'][_0x381b('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x381b('0x3')](0x0);var events={'afterCreate':_0x381b('0x4'),'afterUpdate':_0x381b('0x5'),'afterDestroy':_0x381b('0x6')};function emitEvent(_0x7e09cc){return function(_0x554ee0,_0x4c64a9,_0x51e202){OpenchannelMessageEvents[_0x381b('0x7')](_0x7e09cc+':'+_0x554ee0['id'],_0x554ee0);OpenchannelMessageEvents[_0x381b('0x7')](_0x7e09cc,_0x554ee0);_0x51e202(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x1270=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5909d4,_0x346d4e){var _0x5e9b32=function(_0x5945c5){while(--_0x5945c5){_0x5909d4['push'](_0x5909d4['shift']());}};_0x5e9b32(++_0x346d4e);}(_0x1270,0x66));var _0x0127=function(_0x3764ac,_0x3be41a){_0x3764ac=_0x3764ac-0x0;var _0x3fe10d=_0x1270[_0x3764ac];return _0x3fe10d;};'use strict';var EventEmitter=require(_0x0127('0x0'));var OpenchannelMessage=require(_0x0127('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0127('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0127('0x3'),'afterDestroy':'remove'};function emitEvent(_0x29c34c){return function(_0x262190,_0x5e5b93,_0x7bafea){OpenchannelMessageEvents[_0x0127('0x4')](_0x29c34c+':'+_0x262190['id'],_0x262190);OpenchannelMessageEvents['emit'](_0x29c34c,_0x262190);_0x7bafea(null);};}for(var e in events){if(events[_0x0127('0x5')](e)){var event=events[e];OpenchannelMessage[_0x0127('0x6')](e,emitEvent(event));}}module[_0x0127('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 7988f36..7100e91 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 _0x2032=['body','models','direction','out','secret','then','createdAt','toLowerCase','catch','error','describe','OpenchannelAccount','find','OpenchannelInteraction','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','omit','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages'];(function(_0x2187dd,_0x2eb232){var _0x5e00e9=function(_0x380e1d){while(--_0x380e1d){_0x2187dd['push'](_0x2187dd['shift']());}};_0x5e00e9(++_0x2eb232);}(_0x2032,0xd9));var _0x2203=function(_0x1db015,_0x2dd664){_0x1db015=_0x1db015-0x0;var _0x1df08e=_0x2032[_0x1db015];return _0x1df08e;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'name':_0x2203('0xc'),'fields':[_0x2203('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x526ae0,_0x10f055,_0x549908){var _0x27081c=_0x3f7ba1[_0x2203('0xe')];var _0x6339c4=_0x526ae0['get']({'plain':!![]});if(_0x6339c4[_0x2203('0xf')]['toLowerCase']()==='in'||_0x6339c4[_0x2203('0xf')]['toLowerCase']()===_0x2203('0x10')&&!_0x6339c4[_0x2203('0x11')]&&!_['isNil'](_0x6339c4['UserId'])){_0x27081c['OpenchannelInteraction']['findOne']({'where':{'id':_0x6339c4['OpenchannelInteractionId']}})[_0x2203('0x12')](function(_0x538b30){if(_0x538b30){_0x538b30['update']({'lastMsgAt':_0x6339c4[_0x2203('0x13')],'lastMsgDirection':_0x6339c4[_0x2203('0xf')][_0x2203('0x14')]()});}})[_0x2203('0x15')](function(_0x226209){console[_0x2203('0x16')](_0x226209);});}if(_0x6339c4[_0x2203('0xf')]===_0x2203('0x10')&&!_0x6339c4[_0x2203('0x11')]){var _0x3053f3;_0x27081c['CmContact'][_0x2203('0x17')]()[_0x2203('0x12')](function(_0x4893ff){return _0x27081c[_0x2203('0x18')][_0x2203('0x19')]({'where':{'id':_0x6339c4['OpenchannelAccountId']},'include':[{'model':_0x27081c[_0x2203('0x1a')],'as':'Interactions','where':{'id':_0x6339c4[_0x2203('0x1b')]},'limit':0x1,'include':[{'model':_0x27081c[_0x2203('0x1c')],'as':_0x2203('0x1d'),'attributes':_[_0x2203('0x1e')](_0x4893ff)}]}]});})[_0x2203('0x12')](function(_0x449039){_0x3053f3=_0x449039['get']({'plain':!![]});if(_0x3053f3&&_0x3053f3[_0x2203('0x1f')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2203('0x20'),util['format'](_0x2203('0x21'),_0x6339c4['id'],_0x3053f3[_0x2203('0x1f')]));if(_0x3053f3['Interactions']&&_0x3053f3[_0x2203('0x22')]['length']){_0x6339c4['Interaction']=_[_0x2203('0x23')](_0x3053f3[_0x2203('0x22')][0x0],_0x2203('0x1d'));_0x6339c4[_0x2203('0x1d')]=_0x3053f3[_0x2203('0x22')][0x0][_0x2203('0x1d')];}var _0x10f055={'method':_0x2203('0x24'),'uri':encodeURI(_0x3053f3['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x10f055[_0x2203('0x25')]){case _0x2203('0x26'):_0x10f055['qs']=_0x6339c4;break;case _0x2203('0x24'):_0x10f055['body']=_0x6339c4;break;}return rp(_0x10f055)[_0x2203('0x12')](function(_0x1cec17){logger['info'](_0x2203('0x27'),_0x2203('0x20'),util[_0x2203('0x28')](_0x2203('0x29'),_0x6339c4['id'],_0x3053f3[_0x2203('0x1f')]));if(_0x1cec17[_0x2203('0xd')][_0x2203('0x2a')]&&_0x1cec17['body'][_0x2203('0x2a')]!=_0x6339c4[_0x2203('0x2b')][_0x2203('0x2a')]){return _0x27081c[_0x2203('0x1a')]['update']({'threadId':_0x1cec17[_0x2203('0xd')][_0x2203('0x2a')]},{'logging':!![],'where':{'id':_0x6339c4[_0x2203('0x2b')]['id']}});}else{return;}})[_0x2203('0x12')](function(){return _0x526ae0['update']({'read':!![]});})[_0x2203('0x15')](function(_0x50aa17){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x2203('0x20'),util['inspect'](_0x50aa17,{'showHidden':![],'depth':null}));_0x549908();});}else{_0x549908();}})['finally'](function(){_0x549908();});}else{_0x549908();}}},'charset':_0x2203('0x2c'),'collate':_0x2203('0x2d')});}; \ No newline at end of file +var _0xb62e=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','then','update','catch','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteractionId','Contact','keys','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','Interactions','GET','POST','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect'];(function(_0x55a81a,_0x503a2e){var _0x4b4f1d=function(_0x5be9e0){while(--_0x5be9e0){_0x55a81a['push'](_0x55a81a['shift']());}};_0x4b4f1d(++_0x503a2e);}(_0xb62e,0x1de));var _0xeb62=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb62e[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var logger=require(_0xeb62('0x2'))(_0xeb62('0x3'));var moment=require('moment');var BPromise=require(_0xeb62('0x4'));var rp=require(_0xeb62('0x5'));var fs=require('fs');var path=require(_0xeb62('0x6'));var rimraf=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var attributes=require(_0xeb62('0x9'));module['exports']=function(_0x3ec879,_0x455e1a){return _0x3ec879[_0xeb62('0xa')]('OpenchannelMessage',attributes,{'tableName':_0xeb62('0xb'),'paranoid':![],'indexes':[{'name':_0xeb62('0xc'),'fields':[_0xeb62('0xd')],'type':_0xeb62('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4967c0,_0x5cdef3,_0x4693c9){var _0x40584b=_0x3ec879[_0xeb62('0xf')];var _0xf93c21=_0x4967c0[_0xeb62('0x10')]({'plain':!![]});if(_0xf93c21[_0xeb62('0x11')][_0xeb62('0x12')]()==='in'||_0xf93c21[_0xeb62('0x11')][_0xeb62('0x12')]()===_0xeb62('0x13')&&!_0xf93c21['secret']&&!_[_0xeb62('0x14')](_0xf93c21[_0xeb62('0x15')])){_0x40584b[_0xeb62('0x16')][_0xeb62('0x17')]({'where':{'id':_0xf93c21['OpenchannelInteractionId']}})[_0xeb62('0x18')](function(_0x2fbad2){if(_0x2fbad2){_0x2fbad2[_0xeb62('0x19')]({'lastMsgAt':_0xf93c21['createdAt'],'lastMsgDirection':_0xf93c21[_0xeb62('0x11')][_0xeb62('0x12')]()});}})[_0xeb62('0x1a')](function(_0x4ce9fa){console[_0xeb62('0x1b')](_0x4ce9fa);});}if(_0xf93c21[_0xeb62('0x11')]===_0xeb62('0x13')&&!_0xf93c21[_0xeb62('0x1c')]){var _0x3fb280;_0x40584b[_0xeb62('0x1d')][_0xeb62('0x1e')]()[_0xeb62('0x18')](function(_0x39b138){return _0x40584b[_0xeb62('0x1f')][_0xeb62('0x20')]({'where':{'id':_0xf93c21[_0xeb62('0x21')]},'include':[{'model':_0x40584b[_0xeb62('0x16')],'as':'Interactions','where':{'id':_0xf93c21[_0xeb62('0x22')]},'limit':0x1,'include':[{'model':_0x40584b[_0xeb62('0x1d')],'as':_0xeb62('0x23'),'attributes':_[_0xeb62('0x24')](_0x39b138)}]}]});})[_0xeb62('0x18')](function(_0x24cbf3){_0x3fb280=_0x24cbf3[_0xeb62('0x10')]({'plain':!![]});if(_0x3fb280&&_0x3fb280['replyUri']){logger['info'](_0xeb62('0x25'),_0xeb62('0x26'),util[_0xeb62('0x27')](_0xeb62('0x28'),_0xf93c21['id'],_0x3fb280[_0xeb62('0x29')]));if(_0x3fb280['Interactions']&&_0x3fb280['Interactions'][_0xeb62('0x2a')]){_0xf93c21[_0xeb62('0x2b')]=_[_0xeb62('0x2c')](_0x3fb280[_0xeb62('0x2d')][0x0],'Contact');_0xf93c21['Contact']=_0x3fb280[_0xeb62('0x2d')][0x0]['Contact'];}var _0x5cdef3={'method':'POST','uri':encodeURI(_0x3fb280[_0xeb62('0x29')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5cdef3['method']){case _0xeb62('0x2e'):_0x5cdef3['qs']=_0xf93c21;break;case _0xeb62('0x2f'):_0x5cdef3[_0xeb62('0xd')]=_0xf93c21;break;}return rp(_0x5cdef3)['then'](function(_0x3ef784){logger[_0xeb62('0x30')](_0xeb62('0x25'),_0xeb62('0x26'),util[_0xeb62('0x27')](_0xeb62('0x31'),_0xf93c21['id'],_0x3fb280['replyUri']));if(_0x3ef784[_0xeb62('0xd')][_0xeb62('0x32')]&&_0x3ef784['body'][_0xeb62('0x32')]!=_0xf93c21[_0xeb62('0x2b')][_0xeb62('0x32')]){return _0x40584b[_0xeb62('0x16')][_0xeb62('0x19')]({'threadId':_0x3ef784['body']['threadId']},{'logging':!![],'where':{'id':_0xf93c21[_0xeb62('0x2b')]['id']}});}else{return;}})[_0xeb62('0x18')](function(){return _0x4967c0[_0xeb62('0x19')]({'read':!![]});})[_0xeb62('0x1a')](function(_0x42b197){logger[_0xeb62('0x1b')](_0xeb62('0x25'),'afterCreate',util[_0xeb62('0x33')](_0x42b197,{'showHidden':![],'depth':null}));_0x4693c9();});}else{_0x4693c9();}})['finally'](function(){_0x4693c9();});}else{_0x4693c9();}}},'charset':'utf8mb4','collate':_0xeb62('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index ff5adf5..9c12a3b 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x248294,_0x33885e){var _0x1195ba=function(_0x27804f){while(--_0x27804f){_0x248294['push'](_0x248294['shift']());}};_0x1195ba(++_0x33885e);}(_0xadb5,0xad));var _0x5adb=function(_0x58821,_0x113150){_0x58821=_0x58821-0x0;var _0x29bfba=_0xadb5[_0x58821];return _0x29bfba;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x3e1bab,_0x304aad){var _0x5b7d4a=function(_0x37ab4e){while(--_0x37ab4e){_0x3e1bab['push'](_0x3e1bab['shift']());}};_0x5b7d4a(++_0x304aad);}(_0xadb5,0xad));var _0x5adb=function(_0x213c51,_0x3f5948){_0x213c51=_0x213c51-0x0;var _0x5e89a1=_0xadb5[_0x213c51];return _0x5e89a1;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 36ae300..89759fc 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 _0xb782=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x46f6d8,_0x2c8754){var _0x32455c=function(_0x129b93){while(--_0x129b93){_0x46f6d8['push'](_0x46f6d8['shift']());}};_0x32455c(++_0x2c8754);}(_0xb782,0xd1));var _0x2b78=function(_0x5b4e05,_0x34316b){_0x5b4e05=_0x5b4e05-0x0;var _0x3fb1d6=_0xb782[_0x5b4e05];return _0x3fb1d6;};'use strict';var OpenchannelMessageEvents=require(_0x2b78('0x0'));var events=[_0x2b78('0x1'),_0x2b78('0x2'),_0x2b78('0x3')];function createListener(_0x2cf14f,_0x109bbf){return function(_0x459a51){_0x109bbf[_0x2b78('0x4')](_0x2cf14f,_0x459a51);};}function removeListener(_0x336844,_0x369375){return function(){OpenchannelMessageEvents[_0x2b78('0x5')](_0x336844,_0x369375);};}exports[_0x2b78('0x6')]=function(_0x5e1845){for(var _0x4b633b=0x0,_0x1fe4be=events[_0x2b78('0x7')];_0x4b633b<_0x1fe4be;_0x4b633b++){var _0x559ada=events[_0x4b633b];var _0x31e027=createListener(_0x2b78('0x8')+_0x559ada,_0x5e1845);OpenchannelMessageEvents['on'](_0x559ada,_0x31e027);}}; \ No newline at end of file +var _0x9417=['emit','removeListener','register','openchannelMessage:','./openchannelMessage.events','save','remove','update'];(function(_0x27d0d8,_0x2b657d){var _0x2b79d1=function(_0x249ec1){while(--_0x249ec1){_0x27d0d8['push'](_0x27d0d8['shift']());}};_0x2b79d1(++_0x2b657d);}(_0x9417,0xb4));var _0x7941=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0x9417[_0x459423];return _0x42ed14;};'use strict';var OpenchannelMessageEvents=require(_0x7941('0x0'));var events=[_0x7941('0x1'),_0x7941('0x2'),_0x7941('0x3')];function createListener(_0x5e2057,_0x32968f){return function(_0x240766){_0x32968f[_0x7941('0x4')](_0x5e2057,_0x240766);};}function removeListener(_0x3351ee,_0x6f6dca){return function(){OpenchannelMessageEvents[_0x7941('0x5')](_0x3351ee,_0x6f6dca);};}exports[_0x7941('0x6')]=function(_0x3e38d8){for(var _0x1dee1a=0x0,_0x15c666=events['length'];_0x1dee1a<_0x15c666;_0x1dee1a++){var _0x11a155=events[_0x1dee1a];var _0x238e43=createListener(_0x7941('0x7')+_0x11a155,_0x3e38d8);OpenchannelMessageEvents['on'](_0x11a155,_0x238e43);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index d6e5781..cdcb0f8 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 _0x9a16=['post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getAgents'];(function(_0x4f9b5e,_0x44c0d1){var _0x368428=function(_0x527868){while(--_0x527868){_0x4f9b5e['push'](_0x4f9b5e['shift']());}};_0x368428(++_0x44c0d1);}(_0x9a16,0x84));var _0x69a1=function(_0x287428,_0x4f518a){_0x287428=_0x287428-0x0;var _0x5cea22=_0x9a16[_0x287428];return _0x5cea22;};'use strict';var multer=require(_0x69a1('0x0'));var util=require(_0x69a1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x69a1('0x2'));var router=express[_0x69a1('0x3')]();var fs_extra=require(_0x69a1('0x4'));var auth=require(_0x69a1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x69a1('0x6'));var controller=require(_0x69a1('0x7'));router[_0x69a1('0x8')]('/',auth[_0x69a1('0x9')](),controller[_0x69a1('0xa')]);router[_0x69a1('0x8')](_0x69a1('0xb'),auth[_0x69a1('0x9')](),controller[_0x69a1('0xc')]);router[_0x69a1('0x8')](_0x69a1('0xd'),auth[_0x69a1('0x9')](),controller[_0x69a1('0xe')]);router[_0x69a1('0x8')]('/:id/members',auth[_0x69a1('0x9')](),controller[_0x69a1('0xf')]);router[_0x69a1('0x8')](_0x69a1('0x10'),auth[_0x69a1('0x9')](),controller['getTeams']);router[_0x69a1('0x8')]('/:id/users',auth[_0x69a1('0x9')](),controller[_0x69a1('0x11')]);router[_0x69a1('0x12')]('/',auth[_0x69a1('0x9')](),controller[_0x69a1('0x13')]);router[_0x69a1('0x12')](_0x69a1('0x10'),auth[_0x69a1('0x9')](),controller[_0x69a1('0x14')]);router[_0x69a1('0x12')](_0x69a1('0x15'),auth['isAuthenticated'](),controller[_0x69a1('0x16')]);router[_0x69a1('0x17')](_0x69a1('0xd'),auth[_0x69a1('0x9')](),controller[_0x69a1('0x18')]);router[_0x69a1('0x19')](_0x69a1('0xd'),auth[_0x69a1('0x9')](),controller[_0x69a1('0x1a')]);router[_0x69a1('0x19')](_0x69a1('0x10'),auth[_0x69a1('0x9')](),controller[_0x69a1('0x1b')]);router[_0x69a1('0x19')](_0x69a1('0x15'),auth[_0x69a1('0x9')](),controller[_0x69a1('0x1c')]);module[_0x69a1('0x1d')]=router; \ No newline at end of file +var _0xd753=['fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','/:id/members','/:id/teams','getAgents','post','create','addTeams','/:id/users','update','delete','/:id','destroy','exports','multer','util','path','Router'];(function(_0x148879,_0x5b4c11){var _0x4f7027=function(_0xad056b){while(--_0xad056b){_0x148879['push'](_0x148879['shift']());}};_0x4f7027(++_0x5b4c11);}(_0xd753,0x92));var _0x3d75=function(_0x19fa9b,_0x36525e){_0x19fa9b=_0x19fa9b-0x0;var _0x13c8b5=_0xd753[_0x19fa9b];return _0x13c8b5;};'use strict';var multer=require(_0x3d75('0x0'));var util=require(_0x3d75('0x1'));var path=require(_0x3d75('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3d75('0x3')]();var fs_extra=require(_0x3d75('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3d75('0x5'));var config=require(_0x3d75('0x6'));var controller=require('./openchannelQueue.controller');router['get']('/',auth[_0x3d75('0x7')](),controller[_0x3d75('0x8')]);router[_0x3d75('0x9')](_0x3d75('0xa'),auth[_0x3d75('0x7')](),controller[_0x3d75('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3d75('0xc')]);router[_0x3d75('0x9')](_0x3d75('0xd'),auth[_0x3d75('0x7')](),controller['getMembers']);router[_0x3d75('0x9')](_0x3d75('0xe'),auth[_0x3d75('0x7')](),controller['getTeams']);router[_0x3d75('0x9')]('/:id/users',auth[_0x3d75('0x7')](),controller[_0x3d75('0xf')]);router[_0x3d75('0x10')]('/',auth[_0x3d75('0x7')](),controller[_0x3d75('0x11')]);router[_0x3d75('0x10')](_0x3d75('0xe'),auth[_0x3d75('0x7')](),controller[_0x3d75('0x12')]);router[_0x3d75('0x10')](_0x3d75('0x13'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x3d75('0x7')](),controller[_0x3d75('0x14')]);router[_0x3d75('0x15')](_0x3d75('0x16'),auth[_0x3d75('0x7')](),controller[_0x3d75('0x17')]);router[_0x3d75('0x15')]('/:id/teams',auth[_0x3d75('0x7')](),controller['removeTeams']);router[_0x3d75('0x15')](_0x3d75('0x13'),auth[_0x3d75('0x7')](),controller['removeAgents']);module[_0x3d75('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 7b252a0..0429259 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 _0x3d03=['rrmemory','roundrobin','sequelize','STRING','name','ENUM'];(function(_0x57d677,_0x3859e0){var _0x39a2cf=function(_0x23dd35){while(--_0x23dd35){_0x57d677['push'](_0x57d677['shift']());}};_0x39a2cf(++_0x3859e0);}(_0x3d03,0x1b8));var _0x33d0=function(_0x2f40b0,_0x40122e){_0x2f40b0=_0x2f40b0-0x0;var _0x5bc71b=_0x3d03[_0x2f40b0];return _0x5bc71b;};'use strict';var Sequelize=require(_0x33d0('0x0'));module['exports']={'name':{'type':Sequelize[_0x33d0('0x1')],'unique':_0x33d0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x33d0('0x3')](_0x33d0('0x4'),'beepall',_0x33d0('0x5'))}}; \ No newline at end of file +var _0xe9ff=['sequelize','name','STRING','INTEGER','rrmemory','roundrobin'];(function(_0xf97eb0,_0x1578b7){var _0xea70f4=function(_0x574c8d){while(--_0x574c8d){_0xf97eb0['push'](_0xf97eb0['shift']());}};_0xea70f4(++_0x1578b7);}(_0xe9ff,0xba));var _0xfe9f=function(_0x4476cc,_0x4d7cec){_0x4476cc=_0x4476cc-0x0;var _0x19f742=_0xe9ff[_0x4476cc];return _0x19f742;};'use strict';var Sequelize=require(_0xfe9f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xfe9f('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfe9f('0x2')]},'timeout':{'type':Sequelize[_0xfe9f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xfe9f('0x4'),'beepall',_0xfe9f('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index cc5481f..62a5e23 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 _0x07e7=['localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','pick','OpenchannelQueueId','map','User','findAndCountAll','UserId','agent','openchannelPause','%s/%s','SIP','createdAt','updatedAt','Team','getTeams','addTeams','Agents','interface','flatMap','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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/license/util','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07e7,0x197));var _0x707e=function(_0x543a1c,_0x19e985){_0x543a1c=_0x543a1c-0x0;var _0x558e17=_0x07e7[_0x543a1c];return _0x558e17;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x707e('0x0'));var jsonpatch=require(_0x707e('0x1'));var rp=require('request-promise');var moment=require(_0x707e('0x2'));var BPromise=require(_0x707e('0x3'));var Mustache=require(_0x707e('0x4'));var util=require(_0x707e('0x5'));var path=require(_0x707e('0x6'));var sox=require(_0x707e('0x7'));var csv=require(_0x707e('0x8'));var ejs=require(_0x707e('0x9'));var fs=require('fs');var fs_extra=require(_0x707e('0xa'));var _=require('lodash');var squel=require(_0x707e('0xb'));var crypto=require(_0x707e('0xc'));var jsforce=require(_0x707e('0xd'));var deskjs=require(_0x707e('0xe'));var toCsv=require(_0x707e('0x8'));var querystring=require(_0x707e('0xf'));var Papa=require(_0x707e('0x10'));var Redis=require(_0x707e('0x11'));var authService=require(_0x707e('0x12'));var qs=require(_0x707e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x707e('0x14'));var logger=require(_0x707e('0x15'))(_0x707e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x707e('0x17'));var db=require('../../mysqldb')['db'];config[_0x707e('0x18')]=_['defaults'](config['redis'],{'host':_0x707e('0x19'),'port':0x18eb});var socket=require(_0x707e('0x1a'))(new Redis(config['redis']));require(_0x707e('0x1b'))[_0x707e('0x1c')](socket);function respondWithStatusCode(_0x372a76,_0x4f8d55){_0x4f8d55=_0x4f8d55||0xcc;return function(_0x2a98eb){if(_0x2a98eb){return _0x372a76[_0x707e('0x1d')](_0x4f8d55);}return _0x372a76[_0x707e('0x1e')](_0x4f8d55)[_0x707e('0x1f')]();};}function respondWithResult(_0x2a4e1a,_0x528631){_0x528631=_0x528631||0xc8;return function(_0x4da1a4){if(_0x4da1a4){return _0x2a4e1a[_0x707e('0x1e')](_0x528631)[_0x707e('0x20')](_0x4da1a4);}};}function respondWithFilteredResult(_0x2a570f,_0x5460e4){return function(_0xb608a4){if(_0xb608a4){var _0x266de7=typeof _0x5460e4[_0x707e('0x21')]===_0x707e('0x22')&&typeof _0x5460e4[_0x707e('0x23')]==='undefined';var _0x2433a5=_0xb608a4[_0x707e('0x24')];var _0x531189=_0x266de7?0x0:_0x5460e4[_0x707e('0x21')];var _0x3dd7f1=_0x266de7?_0xb608a4['count']:_0x5460e4[_0x707e('0x21')]+_0x5460e4[_0x707e('0x23')];var _0x42d7e0;if(_0x3dd7f1>=_0x2433a5){_0x3dd7f1=_0x2433a5;_0x42d7e0=0xc8;}else{_0x42d7e0=0xce;}_0x2a570f[_0x707e('0x1e')](_0x42d7e0);return _0x2a570f[_0x707e('0x25')](_0x707e('0x26'),_0x531189+'-'+_0x3dd7f1+'/'+_0x2433a5)[_0x707e('0x20')](_0xb608a4);}return null;};}function patchUpdates(_0x4872fc){return function(_0x568bb4){try{jsonpatch[_0x707e('0x27')](_0x568bb4,_0x4872fc,!![]);}catch(_0x174536){return BPromise[_0x707e('0x28')](_0x174536);}return _0x568bb4[_0x707e('0x29')]();};}function saveUpdates(_0x241fad,_0xb61069){return function(_0xcf165){if(_0xcf165){return _0xcf165['update'](_0x241fad)[_0x707e('0x2a')](function(_0x56bb3b){return _0x56bb3b;});}return null;};}function removeEntity(_0x4b8371,_0x2cac13){return function(_0x35fd2c){if(_0x35fd2c){return _0x35fd2c[_0x707e('0x2b')]()[_0x707e('0x2a')](function(){var _0x555a7c=_0x35fd2c[_0x707e('0x2c')]({'plain':!![]});var _0x3c61c7=_0x707e('0x2d');return db[_0x707e('0x2e')][_0x707e('0x2b')]({'where':{'type':_0x3c61c7,'resourceId':_0x555a7c['id']}})[_0x707e('0x2a')](function(){return _0x35fd2c;});})[_0x707e('0x2a')](function(){_0x4b8371['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6bb2,_0x5bc05f){return function(_0x13e76e){if(!_0x13e76e){_0x4d6bb2['sendStatus'](0x194);}return _0x13e76e;};}function handleError(_0x3e5916,_0x153ef7){_0x153ef7=_0x153ef7||0x1f4;return function(_0x5c6745){logger['error'](_0x5c6745[_0x707e('0x2f')]);if(_0x5c6745[_0x707e('0x30')]){delete _0x5c6745[_0x707e('0x30')];}_0x3e5916['status'](_0x153ef7)[_0x707e('0x31')](_0x5c6745);};}exports[_0x707e('0x32')]=function(_0x39d2f6,_0x39ee2e){var _0x517424={},_0x92b15d={},_0x1defb2={'count':0x0,'rows':[]};var _0x349a35=_['map'](db[_0x707e('0x33')][_0x707e('0x34')],function(_0x1bd184){return{'name':_0x1bd184[_0x707e('0x35')],'type':_0x1bd184[_0x707e('0x36')]['key']};});_0x92b15d[_0x707e('0x37')]=_['map'](_0x349a35,'name');_0x92b15d[_0x707e('0x38')]=_['keys'](_0x39d2f6[_0x707e('0x38')]);_0x92b15d[_0x707e('0x39')]=_[_0x707e('0x3a')](_0x92b15d['model'],_0x92b15d[_0x707e('0x38')]);_0x517424[_0x707e('0x3b')]=_[_0x707e('0x3a')](_0x92b15d[_0x707e('0x37')],qs[_0x707e('0x3c')](_0x39d2f6[_0x707e('0x38')]['fields']));_0x517424[_0x707e('0x3b')]=_0x517424[_0x707e('0x3b')][_0x707e('0x3d')]?_0x517424[_0x707e('0x3b')]:_0x92b15d[_0x707e('0x37')];if(!_0x39d2f6[_0x707e('0x38')]['hasOwnProperty']('nolimit')){_0x517424[_0x707e('0x23')]=qs[_0x707e('0x23')](_0x39d2f6[_0x707e('0x38')][_0x707e('0x23')]);_0x517424[_0x707e('0x21')]=qs[_0x707e('0x21')](_0x39d2f6[_0x707e('0x38')][_0x707e('0x21')]);}_0x517424['order']=qs[_0x707e('0x3e')](_0x39d2f6[_0x707e('0x38')][_0x707e('0x3e')]);_0x517424[_0x707e('0x3f')]=qs['filters'](_['pick'](_0x39d2f6[_0x707e('0x38')],_0x92b15d['filters']),_0x349a35);if(_0x39d2f6['query'][_0x707e('0x40')]){_0x517424['where']=_[_0x707e('0x41')](_0x517424[_0x707e('0x3f')],{'$or':_['map'](_0x349a35,function(_0x1bd373){if(_0x1bd373[_0x707e('0x36')]!==_0x707e('0x42')){var _0x42c20f={};_0x42c20f[_0x1bd373['name']]={'$like':'%'+_0x39d2f6[_0x707e('0x38')][_0x707e('0x40')]+'%'};return _0x42c20f;}})});}_0x517424=_['merge']({},_0x517424,_0x39d2f6[_0x707e('0x43')]);var _0x3839b4={'where':_0x517424['where']};return db[_0x707e('0x33')][_0x707e('0x24')](_0x3839b4)[_0x707e('0x2a')](function(_0x5bbc4e){_0x1defb2[_0x707e('0x24')]=_0x5bbc4e;if(_0x39d2f6[_0x707e('0x38')][_0x707e('0x44')]){_0x517424[_0x707e('0x45')]=[{'all':!![]}];}return db[_0x707e('0x33')][_0x707e('0x46')](_0x517424);})[_0x707e('0x2a')](function(_0x398851){_0x1defb2[_0x707e('0x47')]=_0x398851;return _0x1defb2;})['then'](respondWithFilteredResult(_0x39ee2e,_0x517424))[_0x707e('0x48')](handleError(_0x39ee2e,null));};exports['show']=function(_0x1fb9e0,_0xf9594c){var _0x536d18={'raw':!![],'where':{'id':_0x1fb9e0[_0x707e('0x49')]['id']}},_0x1f4f6={};_0x1f4f6[_0x707e('0x37')]=_[_0x707e('0x4a')](db[_0x707e('0x33')]['rawAttributes']);_0x1f4f6[_0x707e('0x38')]=_[_0x707e('0x4a')](_0x1fb9e0[_0x707e('0x38')]);_0x1f4f6[_0x707e('0x39')]=_['intersection'](_0x1f4f6[_0x707e('0x37')],_0x1f4f6['query']);_0x536d18['attributes']=_['intersection'](_0x1f4f6[_0x707e('0x37')],qs['fields'](_0x1fb9e0['query'][_0x707e('0x3c')]));_0x536d18['attributes']=_0x536d18[_0x707e('0x3b')][_0x707e('0x3d')]?_0x536d18[_0x707e('0x3b')]:_0x1f4f6[_0x707e('0x37')];if(_0x1fb9e0[_0x707e('0x38')][_0x707e('0x44')]){_0x536d18[_0x707e('0x45')]=[{'all':!![]}];}_0x536d18=_[_0x707e('0x41')]({},_0x536d18,_0x1fb9e0[_0x707e('0x43')]);return db['OpenchannelQueue'][_0x707e('0x4b')](_0x536d18)[_0x707e('0x2a')](handleEntityNotFound(_0xf9594c,null))[_0x707e('0x2a')](respondWithResult(_0xf9594c,null))[_0x707e('0x48')](handleError(_0xf9594c,null));};exports[_0x707e('0x4c')]=function(_0x1201fa,_0x185d82){return db['OpenchannelQueue']['create'](_0x1201fa[_0x707e('0x4d')],{})[_0x707e('0x2a')](function(_0x280f29){var _0x1c727a=_0x1201fa[_0x707e('0x4e')][_0x707e('0x2c')]({'plain':!![]});if(!_0x1c727a)throw new Error(_0x707e('0x4f'));if(_0x1c727a[_0x707e('0x50')]==='user'){var _0x59435f=_0x280f29[_0x707e('0x2c')]({'plain':!![]});var _0xd0eea9='OpenchannelQueues';return db[_0x707e('0x51')]['find']({'where':{'name':_0xd0eea9,'userProfileId':_0x1c727a[_0x707e('0x52')]},'raw':!![]})[_0x707e('0x2a')](function(_0x13fcc4){if(_0x13fcc4&&_0x13fcc4[_0x707e('0x53')]===0x0){return db['UserProfileResource'][_0x707e('0x4c')]({'name':_0x59435f[_0x707e('0x30')],'resourceId':_0x59435f['id'],'type':_0x13fcc4[_0x707e('0x30')],'sectionId':_0x13fcc4['id']},{})['then'](function(){return _0x280f29;});}else{return _0x280f29;}})[_0x707e('0x48')](function(_0x19e3d2){logger[_0x707e('0x54')](_0x707e('0x55'),_0x19e3d2);throw _0x19e3d2;});}return _0x280f29;})[_0x707e('0x2a')](respondWithResult(_0x185d82,0xc9))[_0x707e('0x48')](handleError(_0x185d82,null));};exports[_0x707e('0x56')]=function(_0x3df098,_0x4b4175){if(_0x3df098['body']['id']){delete _0x3df098[_0x707e('0x4d')]['id'];}return db[_0x707e('0x33')][_0x707e('0x4b')]({'where':{'id':_0x3df098[_0x707e('0x49')]['id']}})['then'](handleEntityNotFound(_0x4b4175,null))[_0x707e('0x2a')](saveUpdates(_0x3df098[_0x707e('0x4d')],null))[_0x707e('0x2a')](respondWithResult(_0x4b4175,null))['catch'](handleError(_0x4b4175,null));};exports[_0x707e('0x2b')]=function(_0x4652c6,_0x353599){return db[_0x707e('0x33')][_0x707e('0x4b')]({'where':{'id':_0x4652c6['params']['id']}})['then'](handleEntityNotFound(_0x353599,null))[_0x707e('0x2a')](removeEntity(_0x353599,null))[_0x707e('0x48')](handleError(_0x353599,null));};exports[_0x707e('0x57')]=function(_0x36a889,_0x55f052){return db[_0x707e('0x33')]['describe']()['then'](respondWithResult(_0x55f052,null))[_0x707e('0x48')](handleError(_0x55f052,null));};exports['getMembers']=function(_0xf1479f,_0x449b7b,_0x1d941c){var _0x2a938c={'raw':!![],'where':{}},_0x516b4c={},_0x3fa5b3;return db[_0x707e('0x33')][_0x707e('0x58')]({'where':{'id':_0xf1479f[_0x707e('0x49')]['id']}})[_0x707e('0x2a')](handleEntityNotFound(_0x449b7b,null))[_0x707e('0x2a')](function(_0x440dbf){if(_0x440dbf){_0x3fa5b3=_0x440dbf[_0x707e('0x2c')]({'plain':!![]});_0x516b4c[_0x707e('0x37')]=_['keys'](db[_0x707e('0x59')][_0x707e('0x34')]);_0x516b4c['query']=_['keys'](_0xf1479f[_0x707e('0x38')]);_0x516b4c[_0x707e('0x39')]=_[_0x707e('0x3a')](_0x516b4c['model'],_0x516b4c['query']);_0x2a938c[_0x707e('0x3b')]=_[_0x707e('0x3a')](_0x516b4c['model'],qs[_0x707e('0x3c')](_0xf1479f[_0x707e('0x38')][_0x707e('0x3c')]));_0x2a938c[_0x707e('0x3b')]=_0x2a938c['attributes'][_0x707e('0x3d')]?_0x2a938c[_0x707e('0x3b')]:_0x516b4c[_0x707e('0x37')];if(!_0xf1479f[_0x707e('0x38')][_0x707e('0x5a')](_0x707e('0x5b'))){_0x2a938c['limit']=qs[_0x707e('0x23')](_0xf1479f[_0x707e('0x38')][_0x707e('0x23')]);_0x2a938c[_0x707e('0x21')]=qs['offset'](_0xf1479f[_0x707e('0x38')]['offset']);}_0x2a938c[_0x707e('0x5c')]=qs[_0x707e('0x3e')](_0xf1479f[_0x707e('0x38')]['sort']);_0x2a938c[_0x707e('0x3f')]=qs[_0x707e('0x39')](_[_0x707e('0x5d')](_0xf1479f[_0x707e('0x38')],_0x516b4c[_0x707e('0x39')]));_0x2a938c['where'][_0x707e('0x5e')]=_0x440dbf['id'];if(_0xf1479f[_0x707e('0x38')][_0x707e('0x40')]){_0x2a938c['where']=_[_0x707e('0x41')](_0x2a938c['where'],{'$or':_[_0x707e('0x5f')](_0x2a938c['attributes'],function(_0x59fb8c){var _0x2d0c0e={};_0x2d0c0e[_0x59fb8c]={'$like':'%'+_0xf1479f[_0x707e('0x38')][_0x707e('0x40')]+'%'};return _0x2d0c0e;})});}_0x2a938c=_['merge']({},_0x2a938c,_0xf1479f[_0x707e('0x43')]);return db[_0x707e('0x59')][_0x707e('0x46')](_0x2a938c);}})[_0x707e('0x2a')](function(_0x39f34d){if(_0x39f34d){return db[_0x707e('0x60')][_0x707e('0x61')]({'where':{'id':_[_0x707e('0x5f')](_0x39f34d,_0x707e('0x62')),'role':_0x707e('0x63')},'attributes':['id',_0x707e('0x30'),_0x707e('0x64'),'updatedAt','createdAt']});}})['then'](function(_0x307ed8){if(_0x307ed8){return{'count':_0x307ed8['count'],'rows':_[_0x707e('0x5f')](_0x307ed8['rows'],function(_0x1d8b5c){return{'membername':_0x1d8b5c[_0x707e('0x30')],'UserId':_0x1d8b5c['id'],'queue_name':_0x3fa5b3['name'],'OpenchannelQueueId':_0x3fa5b3['id'],'interface':util['format'](_0x707e('0x65'),_0x707e('0x66'),_0x1d8b5c[_0x707e('0x30')]),'penalty':0x0,'paused':_0x1d8b5c['openchannelPause'],'createdAt':_0x1d8b5c[_0x707e('0x67')],'updatedAt':_0x1d8b5c[_0x707e('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x707e('0x2a')](respondWithFilteredResult(_0x449b7b,_0x2a938c))[_0x707e('0x48')](handleError(_0x449b7b,null));};exports['getTeams']=function(_0x10652c,_0x67c529,_0x3525c7){var _0x18413b={};var _0x20a6c1={};var _0x4f2d4a;var _0x2e1a5d;return db[_0x707e('0x33')][_0x707e('0x58')]({'where':{'id':_0x10652c['params']['id']}})[_0x707e('0x2a')](handleEntityNotFound(_0x67c529,null))[_0x707e('0x2a')](function(_0x141639){if(_0x141639){_0x4f2d4a=_0x141639;_0x20a6c1[_0x707e('0x37')]=_[_0x707e('0x4a')](db[_0x707e('0x69')][_0x707e('0x34')]);_0x20a6c1[_0x707e('0x38')]=_[_0x707e('0x4a')](_0x10652c[_0x707e('0x38')]);_0x20a6c1['filters']=_[_0x707e('0x3a')](_0x20a6c1[_0x707e('0x37')],_0x20a6c1['query']);_0x18413b[_0x707e('0x3b')]=_[_0x707e('0x3a')](_0x20a6c1[_0x707e('0x37')],qs[_0x707e('0x3c')](_0x10652c['query']['fields']));_0x18413b[_0x707e('0x3b')]=_0x18413b['attributes']['length']?_0x18413b[_0x707e('0x3b')]:_0x20a6c1[_0x707e('0x37')];_0x18413b[_0x707e('0x5c')]=qs[_0x707e('0x3e')](_0x10652c[_0x707e('0x38')][_0x707e('0x3e')]);_0x18413b[_0x707e('0x3f')]=qs[_0x707e('0x39')](_[_0x707e('0x5d')](_0x10652c[_0x707e('0x38')],_0x20a6c1[_0x707e('0x39')]));if(_0x10652c[_0x707e('0x38')][_0x707e('0x40')]){_0x18413b[_0x707e('0x3f')]=_[_0x707e('0x41')](_0x18413b[_0x707e('0x3f')],{'$or':_[_0x707e('0x5f')](_0x18413b[_0x707e('0x3b')],function(_0x103350){var _0x57fa05={};_0x57fa05[_0x103350]={'$like':'%'+_0x10652c[_0x707e('0x38')]['filter']+'%'};return _0x57fa05;})});}_0x18413b=_[_0x707e('0x41')]({},_0x18413b,_0x10652c[_0x707e('0x43')]);return _0x4f2d4a[_0x707e('0x6a')](_0x18413b);}})[_0x707e('0x2a')](function(_0x38a59f){if(_0x38a59f){_0x2e1a5d=_0x38a59f[_0x707e('0x3d')];if(!_0x10652c[_0x707e('0x38')][_0x707e('0x5a')](_0x707e('0x5b'))){_0x18413b['limit']=qs[_0x707e('0x23')](_0x10652c['query'][_0x707e('0x23')]);_0x18413b[_0x707e('0x21')]=qs[_0x707e('0x21')](_0x10652c[_0x707e('0x38')]['offset']);}return _0x4f2d4a[_0x707e('0x6a')](_0x18413b);}})['then'](function(_0x5f806a){if(_0x5f806a){return _0x5f806a?{'count':_0x2e1a5d,'rows':_0x5f806a}:null;}})[_0x707e('0x2a')](respondWithResult(_0x67c529,null))[_0x707e('0x48')](handleError(_0x67c529,null));};exports[_0x707e('0x6b')]=function(_0x5ed745,_0x467fe5,_0x331d9c){var _0x531075=_0x5ed745[_0x707e('0x4d')]['ids'];return db[_0x707e('0x69')][_0x707e('0x46')]({'where':{'id':_0x531075},'attributes':['id'],'include':[{'model':db['User'],'as':_0x707e('0x6c'),'attributes':['id',_0x707e('0x30'),'online','voicePause',_0x707e('0x6d')],'raw':!![]}]})['then'](function(_0x9d465e){if(_0x9d465e){var _0x24dbb4=_[_0x707e('0x6e')](_0x9d465e,function(_0x52bc1b){var _0x43d6d2=_0x52bc1b[_0x707e('0x2c')]({'plain':!![]});return _0x43d6d2[_0x707e('0x6c')];});return db[_0x707e('0x33')][_0x707e('0x4b')]({'where':{'id':_0x5ed745[_0x707e('0x49')]['id']}})[_0x707e('0x2a')](function(_0x5d3811){return db['sequelize'][_0x707e('0x6f')](function(_0x52ddc1){return _0x5d3811[_0x707e('0x6b')](_0x531075,{'transaction':_0x52ddc1})[_0x707e('0x2a')](function(){return BPromise[_0x707e('0x70')](_0x24dbb4,function(_0x3056c0){return db[_0x707e('0x59')]['findOrCreate']({'where':{'UserId':_0x3056c0['id'],'OpenchannelQueueId':_0x5ed745[_0x707e('0x49')]['id']},'transaction':_0x52ddc1});});})[_0x707e('0x2a')](function(){_0x24dbb4[_0x707e('0x71')](function(_0x55b326){socket[_0x707e('0x72')](_0x707e('0x73'),{'UserId':_0x55b326['id'],'OpenchannelQueueId':_0x5d3811['id']});});});});});}})[_0x707e('0x2a')](respondWithStatusCode(_0x467fe5,null))[_0x707e('0x48')](handleError(_0x467fe5,null));};exports[_0x707e('0x74')]=function(_0xd255a3,_0x27da37,_0x345d4a){return db[_0x707e('0x69')][_0x707e('0x46')]({'where':{'id':_0xd255a3['query'][_0x707e('0x75')]},'attributes':['id'],'include':[{'model':db[_0x707e('0x60')],'as':_0x707e('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x27da37,null))[_0x707e('0x2a')](function(_0x4a5c99){var _0x101c34=_[_0x707e('0x5f')](_0x4a5c99,'id');var _0x3e0c00=[];var _0x4291a6=[];var _0x1c5d13=squel[_0x707e('0x76')]();_0x1c5d13[_0x707e('0x77')](_0x707e('0x78'))[_0x707e('0x79')](_0x707e('0x7a'),'tq')[_0x707e('0x7b')](_0x707e('0x7c'),'ut',_0x707e('0x7d'))[_0x707e('0x3f')]('OpenchannelQueueId\x20=\x20?',_0xd255a3[_0x707e('0x49')]['id']);for(var _0x121178=0x0;_0x121178<_0x4a5c99[_0x707e('0x3d')];_0x121178+=0x1){let _0x405442=_0x4a5c99[_0x121178];for(var _0xc91541=0x0;_0xc91541<_0x405442['Agents']['length'];_0xc91541+=0x1){let _0x128962=_0x405442[_0x707e('0x6c')][_0xc91541];var _0x494e58=_0x1c5d13['clone']();_0x494e58['where'](_0x707e('0x7e'),_0x128962['id']);_0x4291a6['push'](db['sequelize']['query'](_0x494e58[_0x707e('0x7f')](),{'type':db['sequelize']['QueryTypes'][_0x707e('0x80')]})[_0x707e('0x2a')](function(_0x14b19b){if(_0x14b19b[_0x707e('0x3d')]===0x1){return _0x128962['id'];}else{var _0x4385f4=_[_0x707e('0x81')](_[_0x707e('0x5f')](_0x14b19b,_0x707e('0x82')),function(_0x6056c6){return _[_0x707e('0x83')](_0x101c34,_0x6056c6);});if(_0x4385f4){return _0x128962['id'];}}}));}}return BPromise[_0x707e('0x84')](_0x4291a6)[_0x707e('0x2a')](function(_0x28b568){_0x3e0c00=_(_0x3e0c00)[_0x707e('0x85')](_0x28b568)[_0x707e('0x86')]()[_0x707e('0x87')]();return db[_0x707e('0x33')]['find']({'where':{'id':_0xd255a3[_0x707e('0x49')]['id']}})[_0x707e('0x2a')](function(_0x2fe4b8){return db[_0x707e('0x88')][_0x707e('0x6f')](function(_0x584af0){return _0x2fe4b8['removeTeams'](_0xd255a3[_0x707e('0x38')][_0x707e('0x75')],{'transaction':_0x584af0})['then'](function(){if(!_[_0x707e('0x89')](_0x3e0c00)){return _0x2fe4b8[_0x707e('0x8a')](_0x3e0c00,{'transaction':_0x584af0});}})[_0x707e('0x2a')](function(){_0x3e0c00['forEach'](function(_0x47354a){socket[_0x707e('0x72')](_0x707e('0x8b'),{'UserId':_0x47354a,'OpenchannelQueueId':_0x2fe4b8['id']});});});});});});})['then'](respondWithStatusCode(_0x27da37,null))['catch'](handleError(_0x27da37,null));};exports[_0x707e('0x8c')]=function(_0x50c386,_0x1e4f0c,_0x5c2bfb){return db[_0x707e('0x33')]['find']({'where':{'id':_0x50c386[_0x707e('0x49')]['id']}})[_0x707e('0x2a')](handleEntityNotFound(_0x1e4f0c,null))[_0x707e('0x2a')](function(_0x316dfa){if(_0x316dfa){return _0x316dfa[_0x707e('0x8c')](_0x50c386[_0x707e('0x4d')]['ids'],_['omit'](_0x50c386[_0x707e('0x4d')],[_0x707e('0x75'),'id'])||{})[_0x707e('0x8d')](function(_0x338c1f){for(var _0x414ffd=0x0;_0x414ffd<_0x50c386[_0x707e('0x4d')][_0x707e('0x75')][_0x707e('0x3d')];_0x414ffd+=0x1){socket['emit'](_0x707e('0x73'),{'UserId':Number(_0x50c386[_0x707e('0x4d')][_0x707e('0x75')][_0x414ffd]),'OpenchannelQueueId':Number(_0x50c386['params']['id'])});}return _0x338c1f;});}})[_0x707e('0x2a')](respondWithResult(_0x1e4f0c,null))['catch'](handleError(_0x1e4f0c,null));};exports[_0x707e('0x8a')]=function(_0xea735d,_0x1e33f8,_0x108acc){return db[_0x707e('0x33')][_0x707e('0x4b')]({'where':{'id':_0xea735d['params']['id']}})['then'](handleEntityNotFound(_0x1e33f8,null))[_0x707e('0x2a')](function(_0x103c4c){if(_0x103c4c){return _0x103c4c[_0x707e('0x8a')](_0xea735d['query'][_0x707e('0x75')])[_0x707e('0x2a')](function(){if(_[_0x707e('0x8e')](_0xea735d[_0x707e('0x38')][_0x707e('0x75')])){for(var _0x3d8917=0x0;_0x3d8917<_0xea735d[_0x707e('0x38')][_0x707e('0x75')]['length'];_0x3d8917+=0x1){socket[_0x707e('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0xea735d[_0x707e('0x38')][_0x707e('0x75')][_0x3d8917]),'OpenchannelQueueId':Number(_0xea735d['params']['id'])});}}else{socket[_0x707e('0x72')](_0x707e('0x8b'),{'UserId':Number(_0xea735d[_0x707e('0x38')][_0x707e('0x75')]),'OpenchannelQueueId':Number(_0xea735d['params']['id'])});}});}})[_0x707e('0x2a')](respondWithStatusCode(_0x1e33f8,null))[_0x707e('0x48')](handleError(_0x1e33f8,null));};exports[_0x707e('0x8f')]=function(_0x21db94,_0x23549a,_0x3b956a){var _0x33069f={};var _0x5a1c5={};var _0x3ab4e3;var _0x554f01;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x21db94['params']['id']}})[_0x707e('0x2a')](handleEntityNotFound(_0x23549a,null))[_0x707e('0x2a')](function(_0x2e2f93){if(_0x2e2f93){_0x3ab4e3=_0x2e2f93;_0x5a1c5['model']=_[_0x707e('0x4a')](db[_0x707e('0x60')]['rawAttributes']);_0x5a1c5[_0x707e('0x38')]=_[_0x707e('0x4a')](_0x21db94[_0x707e('0x38')]);_0x5a1c5[_0x707e('0x39')]=_[_0x707e('0x3a')](_0x5a1c5[_0x707e('0x37')],_0x5a1c5['query']);_0x33069f[_0x707e('0x3b')]=_[_0x707e('0x3a')](_0x5a1c5[_0x707e('0x37')],qs[_0x707e('0x3c')](_0x21db94[_0x707e('0x38')][_0x707e('0x3c')]));_0x33069f[_0x707e('0x3b')]=_0x33069f[_0x707e('0x3b')][_0x707e('0x3d')]?_0x33069f[_0x707e('0x3b')]:_0x5a1c5['model'];_0x33069f[_0x707e('0x5c')]=qs[_0x707e('0x3e')](_0x21db94[_0x707e('0x38')]['sort']);_0x33069f[_0x707e('0x3f')]=qs[_0x707e('0x39')](_[_0x707e('0x5d')](_0x21db94[_0x707e('0x38')],_0x5a1c5[_0x707e('0x39')]));if(_0x21db94[_0x707e('0x38')]['filter']){_0x33069f[_0x707e('0x3f')]=_[_0x707e('0x41')](_0x33069f[_0x707e('0x3f')],{'$or':_[_0x707e('0x5f')](_0x33069f[_0x707e('0x3b')],function(_0x34b473){var _0x142d0b={};_0x142d0b[_0x34b473]={'$like':'%'+_0x21db94[_0x707e('0x38')]['filter']+'%'};return _0x142d0b;})});}_0x33069f=_[_0x707e('0x41')]({},_0x33069f,_0x21db94[_0x707e('0x43')]);return _0x3ab4e3['getAgents'](_0x33069f);}})[_0x707e('0x2a')](function(_0x2b1d3c){if(_0x2b1d3c){_0x554f01=_0x2b1d3c['length'];if(!_0x21db94[_0x707e('0x38')][_0x707e('0x5a')](_0x707e('0x5b'))){_0x33069f['limit']=qs[_0x707e('0x23')](_0x21db94[_0x707e('0x38')][_0x707e('0x23')]);_0x33069f['offset']=qs[_0x707e('0x21')](_0x21db94[_0x707e('0x38')][_0x707e('0x21')]);}return _0x3ab4e3['getAgents'](_0x33069f);}})[_0x707e('0x2a')](function(_0x1bbb39){if(_0x1bbb39){return _0x1bbb39?{'count':_0x554f01,'rows':_0x1bbb39}:null;}})[_0x707e('0x2a')](respondWithResult(_0x23549a,null))[_0x707e('0x48')](handleError(_0x23549a,null));}; \ No newline at end of file +var _0x0057=['User','findAndCountAll','agent','openchannelPause','createdAt','format','%s/%s','updatedAt','Team','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','all','union','isEmpty','forEach','userOpenchannelQueue:remove','addAgents','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','OpenchannelQueues','UserProfileResource','destroy','error','stack','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId'];(function(_0x5e1609,_0x1c60d1){var _0x4be0b1=function(_0x3c979b){while(--_0x3c979b){_0x5e1609['push'](_0x5e1609['shift']());}};_0x4be0b1(++_0x1c60d1);}(_0x0057,0xbd));var _0x7005=function(_0x1c8485,_0x534015){_0x1c8485=_0x1c8485-0x0;var _0x5bd284=_0x0057[_0x1c8485];return _0x5bd284;};'use strict';var emlformat=require(_0x7005('0x0'));var rimraf=require(_0x7005('0x1'));var zipdir=require(_0x7005('0x2'));var jsonpatch=require(_0x7005('0x3'));var rp=require('request-promise');var moment=require(_0x7005('0x4'));var BPromise=require(_0x7005('0x5'));var Mustache=require(_0x7005('0x6'));var util=require(_0x7005('0x7'));var path=require('path');var sox=require(_0x7005('0x8'));var csv=require('to-csv');var ejs=require(_0x7005('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7005('0xa'));var squel=require(_0x7005('0xb'));var crypto=require(_0x7005('0xc'));var jsforce=require(_0x7005('0xd'));var deskjs=require(_0x7005('0xe'));var toCsv=require(_0x7005('0xf'));var querystring=require(_0x7005('0x10'));var Papa=require(_0x7005('0x11'));var Redis=require('ioredis');var authService=require(_0x7005('0x12'));var qs=require(_0x7005('0x13'));var as=require(_0x7005('0x14'));var hardwareService=require(_0x7005('0x15'));var logger=require(_0x7005('0x16'))(_0x7005('0x17'));var utils=require(_0x7005('0x18'));var config=require(_0x7005('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7005('0x1a'))['db'];config[_0x7005('0x1b')]=_[_0x7005('0x1c')](config[_0x7005('0x1b')],{'host':_0x7005('0x1d'),'port':0x18eb});var socket=require(_0x7005('0x1e'))(new Redis(config[_0x7005('0x1b')]));require('./openchannelQueue.socket')[_0x7005('0x1f')](socket);function respondWithStatusCode(_0x584d30,_0x431873){_0x431873=_0x431873||0xcc;return function(_0x21172a){if(_0x21172a){return _0x584d30[_0x7005('0x20')](_0x431873);}return _0x584d30[_0x7005('0x21')](_0x431873)[_0x7005('0x22')]();};}function respondWithResult(_0x3fe9e4,_0x1dde9f){_0x1dde9f=_0x1dde9f||0xc8;return function(_0x27a7a3){if(_0x27a7a3){return _0x3fe9e4[_0x7005('0x21')](_0x1dde9f)[_0x7005('0x23')](_0x27a7a3);}};}function respondWithFilteredResult(_0x30bc6a,_0x9c66d8){return function(_0x171fa7){if(_0x171fa7){var _0x3e2031=typeof _0x9c66d8[_0x7005('0x24')]===_0x7005('0x25')&&typeof _0x9c66d8[_0x7005('0x26')]===_0x7005('0x25');var _0x2960c7=_0x171fa7[_0x7005('0x27')];var _0x41d800=_0x3e2031?0x0:_0x9c66d8[_0x7005('0x24')];var _0x125c18=_0x3e2031?_0x171fa7[_0x7005('0x27')]:_0x9c66d8[_0x7005('0x24')]+_0x9c66d8[_0x7005('0x26')];var _0x40e1c7;if(_0x125c18>=_0x2960c7){_0x125c18=_0x2960c7;_0x40e1c7=0xc8;}else{_0x40e1c7=0xce;}_0x30bc6a['status'](_0x40e1c7);return _0x30bc6a[_0x7005('0x28')](_0x7005('0x29'),_0x41d800+'-'+_0x125c18+'/'+_0x2960c7)[_0x7005('0x23')](_0x171fa7);}return null;};}function patchUpdates(_0x117860){return function(_0x528081){try{jsonpatch['apply'](_0x528081,_0x117860,!![]);}catch(_0xbc9ff3){return BPromise[_0x7005('0x2a')](_0xbc9ff3);}return _0x528081[_0x7005('0x2b')]();};}function saveUpdates(_0xf95b68,_0x7abfd3){return function(_0x2b2750){if(_0x2b2750){return _0x2b2750[_0x7005('0x2c')](_0xf95b68)[_0x7005('0x2d')](function(_0xbae7fa){return _0xbae7fa;});}return null;};}function removeEntity(_0x3292d6,_0x216974){return function(_0x562a68){if(_0x562a68){return _0x562a68['destroy']()['then'](function(){var _0xd180ba=_0x562a68['get']({'plain':!![]});var _0x21e77d=_0x7005('0x2e');return db[_0x7005('0x2f')][_0x7005('0x30')]({'where':{'type':_0x21e77d,'resourceId':_0xd180ba['id']}})[_0x7005('0x2d')](function(){return _0x562a68;});})[_0x7005('0x2d')](function(){_0x3292d6[_0x7005('0x21')](0xcc)[_0x7005('0x22')]();});}};}function handleEntityNotFound(_0x39ec93,_0xb8c069){return function(_0x294328){if(!_0x294328){_0x39ec93['sendStatus'](0x194);}return _0x294328;};}function handleError(_0x32e66d,_0xb80b8){_0xb80b8=_0xb80b8||0x1f4;return function(_0x113897){logger[_0x7005('0x31')](_0x113897[_0x7005('0x32')]);if(_0x113897['name']){delete _0x113897['name'];}_0x32e66d[_0x7005('0x21')](_0xb80b8)['send'](_0x113897);};}exports[_0x7005('0x33')]=function(_0x24c092,_0x1fcddf){var _0x2e03b8={},_0x37cd58={},_0x55da0c={'count':0x0,'rows':[]};var _0x8210f2=_[_0x7005('0x34')](db[_0x7005('0x35')][_0x7005('0x36')],function(_0x3d1b22){return{'name':_0x3d1b22[_0x7005('0x37')],'type':_0x3d1b22['type'][_0x7005('0x38')]};});_0x37cd58[_0x7005('0x39')]=_[_0x7005('0x34')](_0x8210f2,_0x7005('0x3a'));_0x37cd58[_0x7005('0x3b')]=_[_0x7005('0x3c')](_0x24c092[_0x7005('0x3b')]);_0x37cd58[_0x7005('0x3d')]=_['intersection'](_0x37cd58[_0x7005('0x39')],_0x37cd58[_0x7005('0x3b')]);_0x2e03b8[_0x7005('0x3e')]=_[_0x7005('0x3f')](_0x37cd58[_0x7005('0x39')],qs[_0x7005('0x40')](_0x24c092[_0x7005('0x3b')][_0x7005('0x40')]));_0x2e03b8['attributes']=_0x2e03b8[_0x7005('0x3e')]['length']?_0x2e03b8[_0x7005('0x3e')]:_0x37cd58[_0x7005('0x39')];if(!_0x24c092[_0x7005('0x3b')][_0x7005('0x41')](_0x7005('0x42'))){_0x2e03b8[_0x7005('0x26')]=qs['limit'](_0x24c092['query'][_0x7005('0x26')]);_0x2e03b8['offset']=qs[_0x7005('0x24')](_0x24c092[_0x7005('0x3b')][_0x7005('0x24')]);}_0x2e03b8[_0x7005('0x43')]=qs['sort'](_0x24c092[_0x7005('0x3b')][_0x7005('0x44')]);_0x2e03b8[_0x7005('0x45')]=qs[_0x7005('0x3d')](_[_0x7005('0x46')](_0x24c092[_0x7005('0x3b')],_0x37cd58[_0x7005('0x3d')]),_0x8210f2);if(_0x24c092['query'][_0x7005('0x47')]){_0x2e03b8[_0x7005('0x45')]=_[_0x7005('0x48')](_0x2e03b8['where'],{'$or':_[_0x7005('0x34')](_0x8210f2,function(_0x1202f9){if(_0x1202f9[_0x7005('0x49')]!==_0x7005('0x4a')){var _0x3e9cc3={};_0x3e9cc3[_0x1202f9[_0x7005('0x3a')]]={'$like':'%'+_0x24c092[_0x7005('0x3b')]['filter']+'%'};return _0x3e9cc3;}})});}_0x2e03b8=_[_0x7005('0x48')]({},_0x2e03b8,_0x24c092['options']);var _0x36773d={'where':_0x2e03b8[_0x7005('0x45')]};return db[_0x7005('0x35')][_0x7005('0x27')](_0x36773d)[_0x7005('0x2d')](function(_0x11d6b9){_0x55da0c['count']=_0x11d6b9;if(_0x24c092['query'][_0x7005('0x4b')]){_0x2e03b8[_0x7005('0x4c')]=[{'all':!![]}];}return db[_0x7005('0x35')][_0x7005('0x4d')](_0x2e03b8);})[_0x7005('0x2d')](function(_0x391bf4){_0x55da0c[_0x7005('0x4e')]=_0x391bf4;return _0x55da0c;})[_0x7005('0x2d')](respondWithFilteredResult(_0x1fcddf,_0x2e03b8))[_0x7005('0x4f')](handleError(_0x1fcddf,null));};exports[_0x7005('0x50')]=function(_0x497121,_0x59c24c){var _0x22bc7e={'raw':!![],'where':{'id':_0x497121[_0x7005('0x51')]['id']}},_0xda5ac3={};_0xda5ac3['model']=_[_0x7005('0x3c')](db[_0x7005('0x35')]['rawAttributes']);_0xda5ac3[_0x7005('0x3b')]=_[_0x7005('0x3c')](_0x497121[_0x7005('0x3b')]);_0xda5ac3[_0x7005('0x3d')]=_[_0x7005('0x3f')](_0xda5ac3['model'],_0xda5ac3['query']);_0x22bc7e[_0x7005('0x3e')]=_[_0x7005('0x3f')](_0xda5ac3['model'],qs[_0x7005('0x40')](_0x497121['query'][_0x7005('0x40')]));_0x22bc7e[_0x7005('0x3e')]=_0x22bc7e[_0x7005('0x3e')][_0x7005('0x52')]?_0x22bc7e[_0x7005('0x3e')]:_0xda5ac3[_0x7005('0x39')];if(_0x497121[_0x7005('0x3b')]['includeAll']){_0x22bc7e[_0x7005('0x4c')]=[{'all':!![]}];}_0x22bc7e=_[_0x7005('0x48')]({},_0x22bc7e,_0x497121[_0x7005('0x53')]);return db['OpenchannelQueue'][_0x7005('0x54')](_0x22bc7e)[_0x7005('0x2d')](handleEntityNotFound(_0x59c24c,null))['then'](respondWithResult(_0x59c24c,null))[_0x7005('0x4f')](handleError(_0x59c24c,null));};exports['create']=function(_0x29e873,_0x2d04ad){return db[_0x7005('0x35')]['create'](_0x29e873[_0x7005('0x55')],{})[_0x7005('0x2d')](function(_0x1b9918){var _0x394184=_0x29e873[_0x7005('0x56')][_0x7005('0x57')]({'plain':!![]});if(!_0x394184)throw new Error(_0x7005('0x58'));if(_0x394184['role']===_0x7005('0x56')){var _0x4b23dc=_0x1b9918[_0x7005('0x57')]({'plain':!![]});var _0x493d74=_0x7005('0x2e');return db[_0x7005('0x59')][_0x7005('0x54')]({'where':{'name':_0x493d74,'userProfileId':_0x394184[_0x7005('0x5a')]},'raw':!![]})[_0x7005('0x2d')](function(_0x126118){if(_0x126118&&_0x126118['autoAssociation']===0x0){return db['UserProfileResource'][_0x7005('0x5b')]({'name':_0x4b23dc[_0x7005('0x3a')],'resourceId':_0x4b23dc['id'],'type':_0x126118[_0x7005('0x3a')],'sectionId':_0x126118['id']},{})['then'](function(){return _0x1b9918;});}else{return _0x1b9918;}})[_0x7005('0x4f')](function(_0x1ffcd9){logger[_0x7005('0x31')](_0x7005('0x5c'),_0x1ffcd9);throw _0x1ffcd9;});}return _0x1b9918;})['then'](respondWithResult(_0x2d04ad,0xc9))['catch'](handleError(_0x2d04ad,null));};exports['update']=function(_0x64bc5c,_0x2f4223){if(_0x64bc5c['body']['id']){delete _0x64bc5c['body']['id'];}return db['OpenchannelQueue'][_0x7005('0x54')]({'where':{'id':_0x64bc5c[_0x7005('0x51')]['id']}})[_0x7005('0x2d')](handleEntityNotFound(_0x2f4223,null))[_0x7005('0x2d')](saveUpdates(_0x64bc5c[_0x7005('0x55')],null))['then'](respondWithResult(_0x2f4223,null))['catch'](handleError(_0x2f4223,null));};exports[_0x7005('0x30')]=function(_0x5e9ff4,_0xce7df0){return db[_0x7005('0x35')]['find']({'where':{'id':_0x5e9ff4[_0x7005('0x51')]['id']}})[_0x7005('0x2d')](handleEntityNotFound(_0xce7df0,null))[_0x7005('0x2d')](removeEntity(_0xce7df0,null))[_0x7005('0x4f')](handleError(_0xce7df0,null));};exports[_0x7005('0x5d')]=function(_0x3f070a,_0xb29fd5){return db[_0x7005('0x35')][_0x7005('0x5d')]()[_0x7005('0x2d')](respondWithResult(_0xb29fd5,null))[_0x7005('0x4f')](handleError(_0xb29fd5,null));};exports['getMembers']=function(_0x5585e7,_0x3418a7,_0x3a52cd){var _0x9bafa3={'raw':!![],'where':{}},_0x54ba14={},_0x49dd0e;return db[_0x7005('0x35')][_0x7005('0x5e')]({'where':{'id':_0x5585e7[_0x7005('0x51')]['id']}})[_0x7005('0x2d')](handleEntityNotFound(_0x3418a7,null))[_0x7005('0x2d')](function(_0x2ed526){if(_0x2ed526){_0x49dd0e=_0x2ed526[_0x7005('0x57')]({'plain':!![]});_0x54ba14[_0x7005('0x39')]=_[_0x7005('0x3c')](db[_0x7005('0x5f')][_0x7005('0x36')]);_0x54ba14[_0x7005('0x3b')]=_[_0x7005('0x3c')](_0x5585e7['query']);_0x54ba14[_0x7005('0x3d')]=_['intersection'](_0x54ba14[_0x7005('0x39')],_0x54ba14[_0x7005('0x3b')]);_0x9bafa3[_0x7005('0x3e')]=_['intersection'](_0x54ba14[_0x7005('0x39')],qs[_0x7005('0x40')](_0x5585e7[_0x7005('0x3b')][_0x7005('0x40')]));_0x9bafa3[_0x7005('0x3e')]=_0x9bafa3[_0x7005('0x3e')][_0x7005('0x52')]?_0x9bafa3[_0x7005('0x3e')]:_0x54ba14['model'];if(!_0x5585e7['query']['hasOwnProperty'](_0x7005('0x42'))){_0x9bafa3[_0x7005('0x26')]=qs[_0x7005('0x26')](_0x5585e7[_0x7005('0x3b')][_0x7005('0x26')]);_0x9bafa3[_0x7005('0x24')]=qs[_0x7005('0x24')](_0x5585e7['query'][_0x7005('0x24')]);}_0x9bafa3[_0x7005('0x43')]=qs[_0x7005('0x44')](_0x5585e7[_0x7005('0x3b')]['sort']);_0x9bafa3['where']=qs[_0x7005('0x3d')](_[_0x7005('0x46')](_0x5585e7[_0x7005('0x3b')],_0x54ba14[_0x7005('0x3d')]));_0x9bafa3[_0x7005('0x45')][_0x7005('0x60')]=_0x2ed526['id'];if(_0x5585e7['query']['filter']){_0x9bafa3[_0x7005('0x45')]=_[_0x7005('0x48')](_0x9bafa3[_0x7005('0x45')],{'$or':_[_0x7005('0x34')](_0x9bafa3['attributes'],function(_0x3577f9){var _0x11809a={};_0x11809a[_0x3577f9]={'$like':'%'+_0x5585e7['query'][_0x7005('0x47')]+'%'};return _0x11809a;})});}_0x9bafa3=_['merge']({},_0x9bafa3,_0x5585e7[_0x7005('0x53')]);return db[_0x7005('0x5f')][_0x7005('0x4d')](_0x9bafa3);}})['then'](function(_0x38d1c7){if(_0x38d1c7){return db[_0x7005('0x61')][_0x7005('0x62')]({'where':{'id':_[_0x7005('0x34')](_0x38d1c7,'UserId'),'role':_0x7005('0x63')},'attributes':['id',_0x7005('0x3a'),_0x7005('0x64'),'updatedAt',_0x7005('0x65')]});}})[_0x7005('0x2d')](function(_0xa34320){if(_0xa34320){return{'count':_0xa34320[_0x7005('0x27')],'rows':_[_0x7005('0x34')](_0xa34320[_0x7005('0x4e')],function(_0x90547c){return{'membername':_0x90547c[_0x7005('0x3a')],'UserId':_0x90547c['id'],'queue_name':_0x49dd0e[_0x7005('0x3a')],'OpenchannelQueueId':_0x49dd0e['id'],'interface':util[_0x7005('0x66')](_0x7005('0x67'),'SIP',_0x90547c['name']),'penalty':0x0,'paused':_0x90547c[_0x7005('0x64')],'createdAt':_0x90547c['createdAt'],'updatedAt':_0x90547c[_0x7005('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7005('0x2d')](respondWithFilteredResult(_0x3418a7,_0x9bafa3))['catch'](handleError(_0x3418a7,null));};exports['getTeams']=function(_0x2a0002,_0x21a826,_0x380b39){var _0x481c2f={};var _0x6315f={};var _0x78d727;var _0x1091f5;return db[_0x7005('0x35')][_0x7005('0x5e')]({'where':{'id':_0x2a0002['params']['id']}})[_0x7005('0x2d')](handleEntityNotFound(_0x21a826,null))[_0x7005('0x2d')](function(_0x18ca86){if(_0x18ca86){_0x78d727=_0x18ca86;_0x6315f[_0x7005('0x39')]=_[_0x7005('0x3c')](db[_0x7005('0x69')][_0x7005('0x36')]);_0x6315f['query']=_[_0x7005('0x3c')](_0x2a0002['query']);_0x6315f['filters']=_[_0x7005('0x3f')](_0x6315f[_0x7005('0x39')],_0x6315f[_0x7005('0x3b')]);_0x481c2f['attributes']=_[_0x7005('0x3f')](_0x6315f[_0x7005('0x39')],qs[_0x7005('0x40')](_0x2a0002[_0x7005('0x3b')][_0x7005('0x40')]));_0x481c2f[_0x7005('0x3e')]=_0x481c2f['attributes']['length']?_0x481c2f[_0x7005('0x3e')]:_0x6315f['model'];_0x481c2f['order']=qs[_0x7005('0x44')](_0x2a0002['query'][_0x7005('0x44')]);_0x481c2f[_0x7005('0x45')]=qs[_0x7005('0x3d')](_[_0x7005('0x46')](_0x2a0002[_0x7005('0x3b')],_0x6315f[_0x7005('0x3d')]));if(_0x2a0002[_0x7005('0x3b')]['filter']){_0x481c2f['where']=_[_0x7005('0x48')](_0x481c2f[_0x7005('0x45')],{'$or':_[_0x7005('0x34')](_0x481c2f['attributes'],function(_0x138ab3){var _0x4d81ac={};_0x4d81ac[_0x138ab3]={'$like':'%'+_0x2a0002[_0x7005('0x3b')][_0x7005('0x47')]+'%'};return _0x4d81ac;})});}_0x481c2f=_[_0x7005('0x48')]({},_0x481c2f,_0x2a0002[_0x7005('0x53')]);return _0x78d727[_0x7005('0x6a')](_0x481c2f);}})[_0x7005('0x2d')](function(_0x5ef917){if(_0x5ef917){_0x1091f5=_0x5ef917[_0x7005('0x52')];if(!_0x2a0002['query'][_0x7005('0x41')](_0x7005('0x42'))){_0x481c2f[_0x7005('0x26')]=qs[_0x7005('0x26')](_0x2a0002[_0x7005('0x3b')][_0x7005('0x26')]);_0x481c2f[_0x7005('0x24')]=qs[_0x7005('0x24')](_0x2a0002[_0x7005('0x3b')][_0x7005('0x24')]);}return _0x78d727[_0x7005('0x6a')](_0x481c2f);}})[_0x7005('0x2d')](function(_0x56ea9e){if(_0x56ea9e){return _0x56ea9e?{'count':_0x1091f5,'rows':_0x56ea9e}:null;}})[_0x7005('0x2d')](respondWithResult(_0x21a826,null))[_0x7005('0x4f')](handleError(_0x21a826,null));};exports[_0x7005('0x6b')]=function(_0x142c66,_0x386ba1,_0x12ea82){var _0x229ba6=_0x142c66[_0x7005('0x55')][_0x7005('0x6c')];return db[_0x7005('0x69')][_0x7005('0x4d')]({'where':{'id':_0x229ba6},'attributes':['id'],'include':[{'model':db[_0x7005('0x61')],'as':_0x7005('0x6d'),'attributes':['id',_0x7005('0x3a'),'online',_0x7005('0x6e'),_0x7005('0x6f')],'raw':!![]}]})[_0x7005('0x2d')](function(_0x24e838){if(_0x24e838){var _0x2ca0c5=_[_0x7005('0x70')](_0x24e838,function(_0x3e495c){var _0x16832f=_0x3e495c['get']({'plain':!![]});return _0x16832f['Agents'];});return db[_0x7005('0x35')][_0x7005('0x54')]({'where':{'id':_0x142c66[_0x7005('0x51')]['id']}})[_0x7005('0x2d')](function(_0x33f3f){return db[_0x7005('0x71')][_0x7005('0x72')](function(_0x1e306d){return _0x33f3f[_0x7005('0x6b')](_0x229ba6,{'transaction':_0x1e306d})[_0x7005('0x2d')](function(){return BPromise[_0x7005('0x73')](_0x2ca0c5,function(_0x49b673){return db[_0x7005('0x5f')][_0x7005('0x74')]({'where':{'UserId':_0x49b673['id'],'OpenchannelQueueId':_0x142c66['params']['id']},'transaction':_0x1e306d});});})[_0x7005('0x2d')](function(){_0x2ca0c5['forEach'](function(_0x1f5f5c){socket[_0x7005('0x75')](_0x7005('0x76'),{'UserId':_0x1f5f5c['id'],'OpenchannelQueueId':_0x33f3f['id']});});});});});}})[_0x7005('0x2d')](respondWithStatusCode(_0x386ba1,null))[_0x7005('0x4f')](handleError(_0x386ba1,null));};exports[_0x7005('0x77')]=function(_0x2d0ef6,_0x50f587,_0x192010){return db[_0x7005('0x69')][_0x7005('0x4d')]({'where':{'id':_0x2d0ef6[_0x7005('0x3b')][_0x7005('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7005('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x7005('0x2d')](handleEntityNotFound(_0x50f587,null))[_0x7005('0x2d')](function(_0x1c7485){var _0x261915=_[_0x7005('0x34')](_0x1c7485,'id');var _0x297b20=[];var _0x418774=[];var _0x2d7015=squel[_0x7005('0x78')]();_0x2d7015[_0x7005('0x79')]('tq.TeamId')[_0x7005('0x7a')](_0x7005('0x7b'),'tq')[_0x7005('0x7c')](_0x7005('0x7d'),'ut',_0x7005('0x7e'))[_0x7005('0x45')](_0x7005('0x7f'),_0x2d0ef6['params']['id']);for(var _0x3acd3c=0x0;_0x3acd3c<_0x1c7485[_0x7005('0x52')];_0x3acd3c+=0x1){let _0x19475f=_0x1c7485[_0x3acd3c];for(var _0x2cda78=0x0;_0x2cda78<_0x19475f[_0x7005('0x6d')][_0x7005('0x52')];_0x2cda78+=0x1){let _0x40388e=_0x19475f[_0x7005('0x6d')][_0x2cda78];var _0x5db6c2=_0x2d7015[_0x7005('0x80')]();_0x5db6c2[_0x7005('0x45')](_0x7005('0x81'),_0x40388e['id']);_0x418774[_0x7005('0x82')](db[_0x7005('0x71')][_0x7005('0x3b')](_0x5db6c2['toString'](),{'type':db[_0x7005('0x71')][_0x7005('0x83')]['SELECT']})[_0x7005('0x2d')](function(_0x2a17e7){if(_0x2a17e7['length']===0x1){return _0x40388e['id'];}else{var _0x5e47b1=_[_0x7005('0x84')](_[_0x7005('0x34')](_0x2a17e7,_0x7005('0x85')),function(_0x2def6c){return _['includes'](_0x261915,_0x2def6c);});if(_0x5e47b1){return _0x40388e['id'];}}}));}}return BPromise[_0x7005('0x86')](_0x418774)[_0x7005('0x2d')](function(_0x1cab25){_0x297b20=_(_0x297b20)[_0x7005('0x87')](_0x1cab25)['compact']()['value']();return db['OpenchannelQueue'][_0x7005('0x54')]({'where':{'id':_0x2d0ef6[_0x7005('0x51')]['id']}})[_0x7005('0x2d')](function(_0x4325c1){return db[_0x7005('0x71')][_0x7005('0x72')](function(_0x5981cc){return _0x4325c1['removeTeams'](_0x2d0ef6[_0x7005('0x3b')][_0x7005('0x6c')],{'transaction':_0x5981cc})[_0x7005('0x2d')](function(){if(!_[_0x7005('0x88')](_0x297b20)){return _0x4325c1['removeAgents'](_0x297b20,{'transaction':_0x5981cc});}})[_0x7005('0x2d')](function(){_0x297b20[_0x7005('0x89')](function(_0x554d25){socket[_0x7005('0x75')](_0x7005('0x8a'),{'UserId':_0x554d25,'OpenchannelQueueId':_0x4325c1['id']});});});});});});})[_0x7005('0x2d')](respondWithStatusCode(_0x50f587,null))['catch'](handleError(_0x50f587,null));};exports[_0x7005('0x8b')]=function(_0x21305c,_0x89e874,_0x48bd6a){return db[_0x7005('0x35')][_0x7005('0x54')]({'where':{'id':_0x21305c[_0x7005('0x51')]['id']}})[_0x7005('0x2d')](handleEntityNotFound(_0x89e874,null))['then'](function(_0x296edf){if(_0x296edf){return _0x296edf[_0x7005('0x8b')](_0x21305c[_0x7005('0x55')]['ids'],_['omit'](_0x21305c[_0x7005('0x55')],[_0x7005('0x6c'),'id'])||{})['spread'](function(_0x8daa75){for(var _0x18ee9a=0x0;_0x18ee9a<_0x21305c[_0x7005('0x55')][_0x7005('0x6c')][_0x7005('0x52')];_0x18ee9a+=0x1){socket[_0x7005('0x75')](_0x7005('0x76'),{'UserId':Number(_0x21305c[_0x7005('0x55')][_0x7005('0x6c')][_0x18ee9a]),'OpenchannelQueueId':Number(_0x21305c[_0x7005('0x51')]['id'])});}return _0x8daa75;});}})[_0x7005('0x2d')](respondWithResult(_0x89e874,null))['catch'](handleError(_0x89e874,null));};exports[_0x7005('0x8c')]=function(_0x30c4a7,_0x9883f9,_0x3a6d70){return db[_0x7005('0x35')]['find']({'where':{'id':_0x30c4a7[_0x7005('0x51')]['id']}})[_0x7005('0x2d')](handleEntityNotFound(_0x9883f9,null))[_0x7005('0x2d')](function(_0x27f3b2){if(_0x27f3b2){return _0x27f3b2['removeAgents'](_0x30c4a7['query']['ids'])[_0x7005('0x2d')](function(){if(_[_0x7005('0x8d')](_0x30c4a7[_0x7005('0x3b')][_0x7005('0x6c')])){for(var _0x2048bf=0x0;_0x2048bf<_0x30c4a7[_0x7005('0x3b')][_0x7005('0x6c')][_0x7005('0x52')];_0x2048bf+=0x1){socket['emit'](_0x7005('0x8a'),{'UserId':Number(_0x30c4a7[_0x7005('0x3b')][_0x7005('0x6c')][_0x2048bf]),'OpenchannelQueueId':Number(_0x30c4a7['params']['id'])});}}else{socket[_0x7005('0x75')](_0x7005('0x8a'),{'UserId':Number(_0x30c4a7[_0x7005('0x3b')][_0x7005('0x6c')]),'OpenchannelQueueId':Number(_0x30c4a7['params']['id'])});}});}})[_0x7005('0x2d')](respondWithStatusCode(_0x9883f9,null))[_0x7005('0x4f')](handleError(_0x9883f9,null));};exports[_0x7005('0x8e')]=function(_0x466d8e,_0x407b53,_0x5f0239){var _0x714280={};var _0x25ef73={};var _0x55237b;var _0x250b07;return db['OpenchannelQueue'][_0x7005('0x5e')]({'where':{'id':_0x466d8e[_0x7005('0x51')]['id']}})['then'](handleEntityNotFound(_0x407b53,null))['then'](function(_0x56ad09){if(_0x56ad09){_0x55237b=_0x56ad09;_0x25ef73[_0x7005('0x39')]=_['keys'](db[_0x7005('0x61')][_0x7005('0x36')]);_0x25ef73['query']=_[_0x7005('0x3c')](_0x466d8e[_0x7005('0x3b')]);_0x25ef73[_0x7005('0x3d')]=_[_0x7005('0x3f')](_0x25ef73[_0x7005('0x39')],_0x25ef73[_0x7005('0x3b')]);_0x714280[_0x7005('0x3e')]=_[_0x7005('0x3f')](_0x25ef73[_0x7005('0x39')],qs[_0x7005('0x40')](_0x466d8e[_0x7005('0x3b')][_0x7005('0x40')]));_0x714280[_0x7005('0x3e')]=_0x714280['attributes']['length']?_0x714280[_0x7005('0x3e')]:_0x25ef73['model'];_0x714280[_0x7005('0x43')]=qs[_0x7005('0x44')](_0x466d8e[_0x7005('0x3b')][_0x7005('0x44')]);_0x714280[_0x7005('0x45')]=qs[_0x7005('0x3d')](_[_0x7005('0x46')](_0x466d8e[_0x7005('0x3b')],_0x25ef73['filters']));if(_0x466d8e[_0x7005('0x3b')]['filter']){_0x714280['where']=_[_0x7005('0x48')](_0x714280[_0x7005('0x45')],{'$or':_[_0x7005('0x34')](_0x714280[_0x7005('0x3e')],function(_0x423459){var _0x23104d={};_0x23104d[_0x423459]={'$like':'%'+_0x466d8e[_0x7005('0x3b')][_0x7005('0x47')]+'%'};return _0x23104d;})});}_0x714280=_[_0x7005('0x48')]({},_0x714280,_0x466d8e[_0x7005('0x53')]);return _0x55237b[_0x7005('0x8e')](_0x714280);}})[_0x7005('0x2d')](function(_0xb37858){if(_0xb37858){_0x250b07=_0xb37858[_0x7005('0x52')];if(!_0x466d8e['query']['hasOwnProperty'](_0x7005('0x42'))){_0x714280[_0x7005('0x26')]=qs[_0x7005('0x26')](_0x466d8e[_0x7005('0x3b')][_0x7005('0x26')]);_0x714280[_0x7005('0x24')]=qs[_0x7005('0x24')](_0x466d8e[_0x7005('0x3b')][_0x7005('0x24')]);}return _0x55237b[_0x7005('0x8e')](_0x714280);}})['then'](function(_0x280019){if(_0x280019){return _0x280019?{'count':_0x250b07,'rows':_0x280019}:null;}})[_0x7005('0x2d')](respondWithResult(_0x407b53,null))[_0x7005('0x4f')](handleError(_0x407b53,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index d7e9a06..9ad2794 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 _0x3d28=['hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','emit'];(function(_0xbabd,_0x18307f){var _0x286dc3=function(_0x47d716){while(--_0x47d716){_0xbabd['push'](_0xbabd['shift']());}};_0x286dc3(++_0x18307f);}(_0x3d28,0xda));var _0x83d2=function(_0x5de7f9,_0x19661f){_0x5de7f9=_0x5de7f9-0x0;var _0x374ae9=_0x3d28[_0x5de7f9];return _0x374ae9;};'use strict';var EventEmitter=require(_0x83d2('0x0'));var OpenchannelQueue=require(_0x83d2('0x1'))['db'][_0x83d2('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x83d2('0x3')](0x0);var events={'afterCreate':_0x83d2('0x4'),'afterUpdate':_0x83d2('0x5'),'afterDestroy':'remove'};function emitEvent(_0xda2c6d){return function(_0x364270,_0x4bd94a,_0xa9b1fb){OpenchannelQueueEvents[_0x83d2('0x6')](_0xda2c6d+':'+_0x364270['id'],_0x364270);OpenchannelQueueEvents[_0x83d2('0x6')](_0xda2c6d,_0x364270);_0xa9b1fb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x83d2('0x7')](e,emitEvent(event));}}module[_0x83d2('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xb52b=['hook','exports','events','../../mysqldb','save','remove','emit'];(function(_0x5433e8,_0x419b0b){var _0x43fac2=function(_0x485d83){while(--_0x485d83){_0x5433e8['push'](_0x5433e8['shift']());}};_0x43fac2(++_0x419b0b);}(_0xb52b,0x136));var _0xbb52=function(_0x39f16a,_0x46f125){_0x39f16a=_0x39f16a-0x0;var _0x3315ee=_0xb52b[_0x39f16a];return _0x3315ee;};'use strict';var EventEmitter=require(_0xbb52('0x0'));var OpenchannelQueue=require(_0xbb52('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbb52('0x2'),'afterUpdate':'update','afterDestroy':_0xbb52('0x3')};function emitEvent(_0x3b90fa){return function(_0x37f1b,_0x28b2aa,_0x3c7715){OpenchannelQueueEvents[_0xbb52('0x4')](_0x3b90fa+':'+_0x37f1b['id'],_0x37f1b);OpenchannelQueueEvents[_0xbb52('0x4')](_0x3b90fa,_0x37f1b);_0x3c7715(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xbb52('0x5')](e,emitEvent(event));}}module[_0xbb52('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index e9a4b2e..315a653 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 _0xf123=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelQueue','util'];(function(_0x2dd7d6,_0x5e3206){var _0x4ef620=function(_0x50bf8d){while(--_0x50bf8d){_0x2dd7d6['push'](_0x2dd7d6['shift']());}};_0x4ef620(++_0x5e3206);}(_0xf123,0x1bb));var _0x3f12=function(_0x522c6d,_0x4d250d){_0x522c6d=_0x522c6d-0x0;var _0x26300d=_0xf123[_0x522c6d];return _0x26300d;};'use strict';var _=require('lodash');var util=require(_0x3f12('0x0'));var logger=require(_0x3f12('0x1'))(_0x3f12('0x2'));var moment=require(_0x3f12('0x3'));var BPromise=require(_0x3f12('0x4'));var rp=require(_0x3f12('0x5'));var fs=require('fs');var path=require(_0x3f12('0x6'));var rimraf=require(_0x3f12('0x7'));var config=require(_0x3f12('0x8'));var attributes=require('./openchannelQueue.attributes');module[_0x3f12('0x9')]=function(_0x3f14a2,_0xac30b7){return _0x3f14a2[_0x3f12('0xa')](_0x3f12('0xb'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82af=['rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1a05ec,_0xc68024){var _0x21db22=function(_0x542174){while(--_0x542174){_0x1a05ec['push'](_0x1a05ec['shift']());}};_0x21db22(++_0xc68024);}(_0x82af,0x173));var _0xf82a=function(_0x3048ea,_0x3838c2){_0x3048ea=_0x3048ea-0x0;var _0x1a13c4=_0x82af[_0x3048ea];return _0x1a13c4;};'use strict';var _=require(_0xf82a('0x0'));var util=require(_0xf82a('0x1'));var logger=require('../../config/logger')(_0xf82a('0x2'));var moment=require(_0xf82a('0x3'));var BPromise=require(_0xf82a('0x4'));var rp=require(_0xf82a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf82a('0x6'));var config=require(_0xf82a('0x7'));var attributes=require(_0xf82a('0x8'));module[_0xf82a('0x9')]=function(_0x57a4fc,_0x585add){return _0x57a4fc[_0xf82a('0xa')](_0xf82a('0xb'),attributes,{'tableName':_0xf82a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index f2acbf0..eb61a65 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 _0x7a12=['result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','then','GetOpenchannelQueue','debug','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7a12,0xb4));var _0x27a1=function(_0x3f19c4,_0x348f52){_0x3f19c4=_0x3f19c4-0x0;var _0x8fcb7e=_0x7a12[_0x3f19c4];return _0x8fcb7e;};'use strict';var _=require(_0x27a1('0x0'));var util=require(_0x27a1('0x1'));var moment=require(_0x27a1('0x2'));var BPromise=require(_0x27a1('0x3'));var rs=require(_0x27a1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27a1('0x5'))['db'];var utils=require(_0x27a1('0x6'));var logger=require('../../config/logger')(_0x27a1('0x7'));var config=require(_0x27a1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x27a1('0x9')]({'port':0x232a});config[_0x27a1('0xa')]=_[_0x27a1('0xb')](config[_0x27a1('0xa')],{'host':_0x27a1('0xc'),'port':0x18eb});var socket=require(_0x27a1('0xd'))(new Redis(config[_0x27a1('0xa')]));require(_0x27a1('0xe'))[_0x27a1('0xf')](socket);function respondWithRpcPromise(_0xf74c8c,_0x398e5c,_0x450ea0){return new BPromise(function(_0x166597,_0x4fcb22){return client[_0x27a1('0x10')](_0xf74c8c,_0x450ea0)['then'](function(_0x4ad2fb){logger[_0x27a1('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x398e5c,_0x27a1('0x12'));logger['debug'](_0x27a1('0x13'),_0x398e5c,'request\x20sent',JSON[_0x27a1('0x14')](_0x4ad2fb));if(_0x4ad2fb[_0x27a1('0x15')]){if(_0x4ad2fb[_0x27a1('0x15')][_0x27a1('0x16')]===0x1f4){logger['error'](_0x27a1('0x17'),_0x398e5c,_0x4ad2fb['error'][_0x27a1('0x18')]);return _0x4fcb22(_0x4ad2fb[_0x27a1('0x15')][_0x27a1('0x18')]);}logger[_0x27a1('0x15')](_0x27a1('0x17'),_0x398e5c,_0x4ad2fb['error']['message']);return _0x166597(_0x4ad2fb[_0x27a1('0x15')][_0x27a1('0x18')]);}else{logger[_0x27a1('0x11')](_0x27a1('0x17'),_0x398e5c,'request\x20sent');_0x166597(_0x4ad2fb[_0x27a1('0x19')]['message']);}})[_0x27a1('0x1a')](function(_0x3a934a){logger[_0x27a1('0x15')](_0x27a1('0x17'),_0x398e5c,_0x3a934a);_0x4fcb22(_0x3a934a);});});}exports['GetOpenchannelQueue']=function(_0x57dd32){var _0x26f215=this;return new Promise(function(_0x36c4c9,_0x21b8aa){return db[_0x27a1('0x1b')][_0x27a1('0x1c')]({'raw':_0x57dd32['options']?_0x57dd32[_0x27a1('0x1d')][_0x27a1('0x1e')]===undefined?!![]:![]:!![],'where':_0x57dd32[_0x27a1('0x1d')]?_0x57dd32[_0x27a1('0x1d')][_0x27a1('0x1f')]||null:null,'attributes':_0x57dd32['options']?_0x57dd32[_0x27a1('0x1d')][_0x27a1('0x20')]||null:null,'limit':_0x57dd32[_0x27a1('0x1d')]?_0x57dd32[_0x27a1('0x1d')]['limit']||null:null,'include':_0x57dd32[_0x27a1('0x1d')]?_0x57dd32[_0x27a1('0x1d')][_0x27a1('0x21')]?_[_0x27a1('0x22')](_0x57dd32['options']['include'],function(_0x4b36dd){return{'model':db[_0x4b36dd['model']],'as':_0x4b36dd['as'],'attributes':_0x4b36dd[_0x27a1('0x20')],'include':_0x4b36dd['include']?_[_0x27a1('0x22')](_0x4b36dd['include'],function(_0x1c53c1){return{'model':db[_0x1c53c1['model']],'as':_0x1c53c1['as'],'attributes':_0x1c53c1[_0x27a1('0x20')],'include':_0x1c53c1[_0x27a1('0x21')]?_[_0x27a1('0x22')](_0x1c53c1[_0x27a1('0x21')],function(_0x17d7a6){return{'model':db[_0x17d7a6[_0x27a1('0x23')]],'as':_0x17d7a6['as'],'attributes':_0x17d7a6['attributes']};}):[]};}):[]};}):[]:[]})[_0x27a1('0x24')](function(_0x83d4){logger[_0x27a1('0x11')](_0x27a1('0x25'),_0x57dd32);logger[_0x27a1('0x26')](_0x27a1('0x25'),_0x57dd32,JSON['stringify'](_0x83d4));_0x36c4c9(_0x83d4);})[_0x27a1('0x1a')](function(_0x480c03){logger[_0x27a1('0x15')](_0x27a1('0x25'),_0x480c03[_0x27a1('0x18')],_0x57dd32);_0x21b8aa(_0x26f215['error'](0x1f4,_0x480c03[_0x27a1('0x18')]));});});};exports[_0x27a1('0x27')]=function(_0x1cd3f1){var _0x99d931=this;return new Promise(function(_0x1d2fac,_0x42dc8b){return db['OpenchannelQueue'][_0x27a1('0x28')]({'raw':_0x1cd3f1[_0x27a1('0x1d')]?_0x1cd3f1[_0x27a1('0x1d')][_0x27a1('0x1e')]===undefined?!![]:![]:!![],'where':_0x1cd3f1['options']?_0x1cd3f1['options']['where']||null:null,'attributes':_0x1cd3f1[_0x27a1('0x1d')]?_0x1cd3f1[_0x27a1('0x1d')][_0x27a1('0x20')]||null:null,'include':_0x1cd3f1[_0x27a1('0x1d')]?_0x1cd3f1[_0x27a1('0x1d')][_0x27a1('0x21')]?_[_0x27a1('0x22')](_0x1cd3f1[_0x27a1('0x1d')][_0x27a1('0x21')],function(_0x1384cf){return{'model':db[_0x1384cf[_0x27a1('0x23')]],'as':_0x1384cf['as'],'attributes':_0x1384cf[_0x27a1('0x20')],'include':_0x1384cf[_0x27a1('0x21')]?_[_0x27a1('0x22')](_0x1384cf[_0x27a1('0x21')],function(_0x3bf57e){return{'model':db[_0x3bf57e['model']],'as':_0x3bf57e['as'],'attributes':_0x3bf57e[_0x27a1('0x20')],'include':_0x3bf57e[_0x27a1('0x21')]?_[_0x27a1('0x22')](_0x3bf57e['include'],function(_0x256646){return{'model':db[_0x256646[_0x27a1('0x23')]],'as':_0x256646['as'],'attributes':_0x256646[_0x27a1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x27a1('0x24')](function(_0x5da4b3){logger[_0x27a1('0x11')](_0x27a1('0x27'),_0x1cd3f1);logger[_0x27a1('0x26')](_0x27a1('0x27'),_0x1cd3f1,JSON['stringify'](_0x5da4b3));_0x1d2fac(_0x5da4b3);})[_0x27a1('0x1a')](function(_0x7934d3){logger[_0x27a1('0x15')](_0x27a1('0x27'),_0x7934d3['message'],_0x1cd3f1);_0x42dc8b(_0x99d931[_0x27a1('0x15')](0x1f4,_0x7934d3[_0x27a1('0x18')]));});});}; \ No newline at end of file +var _0xabe9=['result','GetOpenchannelQueue','findAll','options','where','attributes','limit','map','include','model','debug','catch','ShowOpenchannelQueue','OpenchannelQueue','find','raw','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message'];(function(_0x180b66,_0x45b914){var _0x38c9db=function(_0x3f43ea){while(--_0x3f43ea){_0x180b66['push'](_0x180b66['shift']());}};_0x38c9db(++_0x45b914);}(_0xabe9,0x193));var _0x9abe=function(_0x20af77,_0x2ebc02){_0x20af77=_0x20af77-0x0;var _0x2877dc=_0xabe9[_0x20af77];return _0x2877dc;};'use strict';var _=require(_0x9abe('0x0'));var util=require(_0x9abe('0x1'));var moment=require('moment');var BPromise=require(_0x9abe('0x2'));var rs=require(_0x9abe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9abe('0x4'));var logger=require(_0x9abe('0x5'))(_0x9abe('0x6'));var config=require(_0x9abe('0x7'));var jayson=require(_0x9abe('0x8'));var client=jayson[_0x9abe('0x9')][_0x9abe('0xa')]({'port':0x232a});config['redis']=_[_0x9abe('0xb')](config[_0x9abe('0xc')],{'host':_0x9abe('0xd'),'port':0x18eb});var socket=require(_0x9abe('0xe'))(new Redis(config['redis']));require(_0x9abe('0xf'))[_0x9abe('0x10')](socket);function respondWithRpcPromise(_0x2cc952,_0x2eaf6b,_0x46db7f){return new BPromise(function(_0x1426fa,_0x5f13e4){return client[_0x9abe('0x11')](_0x2cc952,_0x46db7f)[_0x9abe('0x12')](function(_0x4da177){logger[_0x9abe('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x2eaf6b,_0x9abe('0x14'));logger['debug'](_0x9abe('0x15'),_0x2eaf6b,_0x9abe('0x14'),JSON[_0x9abe('0x16')](_0x4da177));if(_0x4da177[_0x9abe('0x17')]){if(_0x4da177[_0x9abe('0x17')][_0x9abe('0x18')]===0x1f4){logger[_0x9abe('0x17')](_0x9abe('0x19'),_0x2eaf6b,_0x4da177[_0x9abe('0x17')][_0x9abe('0x1a')]);return _0x5f13e4(_0x4da177[_0x9abe('0x17')][_0x9abe('0x1a')]);}logger[_0x9abe('0x17')](_0x9abe('0x19'),_0x2eaf6b,_0x4da177[_0x9abe('0x17')]['message']);return _0x1426fa(_0x4da177[_0x9abe('0x17')][_0x9abe('0x1a')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x2eaf6b,'request\x20sent');_0x1426fa(_0x4da177[_0x9abe('0x1b')][_0x9abe('0x1a')]);}})['catch'](function(_0x4ba485){logger['error'](_0x9abe('0x19'),_0x2eaf6b,_0x4ba485);_0x5f13e4(_0x4ba485);});});}exports[_0x9abe('0x1c')]=function(_0x2507ae){var _0x2c8ce8=this;return new Promise(function(_0x444047,_0x4bff6e){return db['OpenchannelQueue'][_0x9abe('0x1d')]({'raw':_0x2507ae[_0x9abe('0x1e')]?_0x2507ae[_0x9abe('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2507ae[_0x9abe('0x1e')]?_0x2507ae[_0x9abe('0x1e')][_0x9abe('0x1f')]||null:null,'attributes':_0x2507ae[_0x9abe('0x1e')]?_0x2507ae[_0x9abe('0x1e')][_0x9abe('0x20')]||null:null,'limit':_0x2507ae['options']?_0x2507ae[_0x9abe('0x1e')][_0x9abe('0x21')]||null:null,'include':_0x2507ae['options']?_0x2507ae[_0x9abe('0x1e')]['include']?_[_0x9abe('0x22')](_0x2507ae['options'][_0x9abe('0x23')],function(_0x4ca496){return{'model':db[_0x4ca496[_0x9abe('0x24')]],'as':_0x4ca496['as'],'attributes':_0x4ca496['attributes'],'include':_0x4ca496[_0x9abe('0x23')]?_['map'](_0x4ca496['include'],function(_0x55d751){return{'model':db[_0x55d751[_0x9abe('0x24')]],'as':_0x55d751['as'],'attributes':_0x55d751[_0x9abe('0x20')],'include':_0x55d751['include']?_[_0x9abe('0x22')](_0x55d751[_0x9abe('0x23')],function(_0x12c61c){return{'model':db[_0x12c61c[_0x9abe('0x24')]],'as':_0x12c61c['as'],'attributes':_0x12c61c[_0x9abe('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9abe('0x12')](function(_0x3fac9a){logger[_0x9abe('0x13')](_0x9abe('0x1c'),_0x2507ae);logger[_0x9abe('0x25')](_0x9abe('0x1c'),_0x2507ae,JSON[_0x9abe('0x16')](_0x3fac9a));_0x444047(_0x3fac9a);})[_0x9abe('0x26')](function(_0x16b025){logger['error'](_0x9abe('0x1c'),_0x16b025[_0x9abe('0x1a')],_0x2507ae);_0x4bff6e(_0x2c8ce8['error'](0x1f4,_0x16b025[_0x9abe('0x1a')]));});});};exports[_0x9abe('0x27')]=function(_0x55d520){var _0x5832b1=this;return new Promise(function(_0x150205,_0x545537){return db[_0x9abe('0x28')][_0x9abe('0x29')]({'raw':_0x55d520[_0x9abe('0x1e')]?_0x55d520[_0x9abe('0x1e')][_0x9abe('0x2a')]===undefined?!![]:![]:!![],'where':_0x55d520[_0x9abe('0x1e')]?_0x55d520[_0x9abe('0x1e')][_0x9abe('0x1f')]||null:null,'attributes':_0x55d520[_0x9abe('0x1e')]?_0x55d520[_0x9abe('0x1e')][_0x9abe('0x20')]||null:null,'include':_0x55d520[_0x9abe('0x1e')]?_0x55d520['options'][_0x9abe('0x23')]?_[_0x9abe('0x22')](_0x55d520[_0x9abe('0x1e')][_0x9abe('0x23')],function(_0x2b5b6d){return{'model':db[_0x2b5b6d[_0x9abe('0x24')]],'as':_0x2b5b6d['as'],'attributes':_0x2b5b6d[_0x9abe('0x20')],'include':_0x2b5b6d[_0x9abe('0x23')]?_[_0x9abe('0x22')](_0x2b5b6d['include'],function(_0xf03b55){return{'model':db[_0xf03b55[_0x9abe('0x24')]],'as':_0xf03b55['as'],'attributes':_0xf03b55[_0x9abe('0x20')],'include':_0xf03b55[_0x9abe('0x23')]?_['map'](_0xf03b55[_0x9abe('0x23')],function(_0x152d3f){return{'model':db[_0x152d3f[_0x9abe('0x24')]],'as':_0x152d3f['as'],'attributes':_0x152d3f[_0x9abe('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9abe('0x12')](function(_0x5812ae){logger[_0x9abe('0x13')](_0x9abe('0x27'),_0x55d520);logger[_0x9abe('0x25')](_0x9abe('0x27'),_0x55d520,JSON[_0x9abe('0x16')](_0x5812ae));_0x150205(_0x5812ae);})[_0x9abe('0x26')](function(_0x22f5d6){logger[_0x9abe('0x17')](_0x9abe('0x27'),_0x22f5d6[_0x9abe('0x1a')],_0x55d520);_0x545537(_0x5832b1[_0x9abe('0x17')](0x1f4,_0x22f5d6[_0x9abe('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 11b697d..294e1ba 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 _0x99fb=['remove','register','save'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x99fb,0xc5));var _0xb99f=function(_0x5adc23,_0x89ee86){_0x5adc23=_0x5adc23-0x0;var _0x4952e6=_0x99fb[_0x5adc23];return _0x4952e6;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xb99f('0x0'),_0xb99f('0x1'),'update'];function createListener(_0x3d5346,_0x729051){return function(_0x12b8fa){_0x729051['emit'](_0x3d5346,_0x12b8fa);};}function removeListener(_0x1b293c,_0x389bbc){return function(){OpenchannelQueueEvents['removeListener'](_0x1b293c,_0x389bbc);};}exports[_0xb99f('0x2')]=function(_0x3f3dd9){for(var _0x5ebe7c=0x0,_0x5cebe6=events['length'];_0x5ebe7c<_0x5cebe6;_0x5ebe7c++){var _0x3169fd=events[_0x5ebe7c];var _0x16d504=createListener('openchannelQueue:'+_0x3169fd,_0x3f3dd9);OpenchannelQueueEvents['on'](_0x3169fd,_0x16d504);}}; \ No newline at end of file +var _0x0b80=['removeListener','register','openchannelQueue:','remove','update'];(function(_0x4a5f6c,_0x4f532e){var _0x281ffd=function(_0x4c68e3){while(--_0x4c68e3){_0x4a5f6c['push'](_0x4a5f6c['shift']());}};_0x281ffd(++_0x4f532e);}(_0x0b80,0x1c0));var _0x00b8=function(_0x272479,_0x51cb8d){_0x272479=_0x272479-0x0;var _0x1f9694=_0x0b80[_0x272479];return _0x1f9694;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x00b8('0x0'),_0x00b8('0x1')];function createListener(_0x203d2d,_0x553404){return function(_0x1a43fd){_0x553404['emit'](_0x203d2d,_0x1a43fd);};}function removeListener(_0x1108ae,_0x4f1559){return function(){OpenchannelQueueEvents[_0x00b8('0x2')](_0x1108ae,_0x4f1559);};}exports[_0x00b8('0x3')]=function(_0x42ee9f){for(var _0x95cf93=0x0,_0x127281=events['length'];_0x95cf93<_0x127281;_0x95cf93++){var _0x265bc6=events[_0x95cf93];var _0x53c918=createListener(_0x00b8('0x4')+_0x265bc6,_0x42ee9f);OpenchannelQueueEvents['on'](_0x265bc6,_0x53c918);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 6a5d7d1..604396a 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 _0xd30c=['/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0xd30c,0x1bc));var _0xcd30=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xd30c[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0xcd30('0x0'));var util=require(_0xcd30('0x1'));var path=require(_0xcd30('0x2'));var timeout=require(_0xcd30('0x3'));var express=require(_0xcd30('0x4'));var router=express[_0xcd30('0x5')]();var fs_extra=require(_0xcd30('0x6'));var auth=require(_0xcd30('0x7'));var interaction=require(_0xcd30('0x8'));var config=require(_0xcd30('0x9'));var controller=require(_0xcd30('0xa'));router[_0xcd30('0xb')]('/',auth[_0xcd30('0xc')](),controller[_0xcd30('0xd')]);router[_0xcd30('0xb')](_0xcd30('0xe'),auth[_0xcd30('0xc')](),controller[_0xcd30('0xf')]);router[_0xcd30('0xb')](_0xcd30('0x10'),auth[_0xcd30('0xc')](),controller[_0xcd30('0x11')]);router['post']('/',auth[_0xcd30('0xc')](),controller['create']);router[_0xcd30('0x12')](_0xcd30('0x10'),auth[_0xcd30('0xc')](),controller[_0xcd30('0x13')]);router[_0xcd30('0x14')](_0xcd30('0x10'),auth['isAuthenticated'](),controller[_0xcd30('0x15')]);module[_0xcd30('0x16')]=router; \ No newline at end of file +var _0x8e0a=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','multer'];(function(_0x2ea35e,_0x6eb69b){var _0x56a727=function(_0x1ecc68){while(--_0x1ecc68){_0x2ea35e['push'](_0x2ea35e['shift']());}};_0x56a727(++_0x6eb69b);}(_0x8e0a,0x153));var _0xa8e0=function(_0x594727,_0x3dc118){_0x594727=_0x594727-0x0;var _0x7818ee=_0x8e0a[_0x594727];return _0x7818ee;};'use strict';var multer=require(_0xa8e0('0x0'));var util=require(_0xa8e0('0x1'));var path=require('path');var timeout=require(_0xa8e0('0x2'));var express=require('express');var router=express[_0xa8e0('0x3')]();var fs_extra=require(_0xa8e0('0x4'));var auth=require(_0xa8e0('0x5'));var interaction=require(_0xa8e0('0x6'));var config=require(_0xa8e0('0x7'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa8e0('0x8')]);router[_0xa8e0('0x9')](_0xa8e0('0xa'),auth[_0xa8e0('0xb')](),controller[_0xa8e0('0xc')]);router['get'](_0xa8e0('0xd'),auth[_0xa8e0('0xb')](),controller[_0xa8e0('0xe')]);router['post']('/',auth[_0xa8e0('0xb')](),controller[_0xa8e0('0xf')]);router[_0xa8e0('0x10')](_0xa8e0('0xd'),auth[_0xa8e0('0xb')](),controller[_0xa8e0('0x11')]);router[_0xa8e0('0x12')]('/:id',auth[_0xa8e0('0xb')](),controller[_0xa8e0('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 45a5d6c..0b5076c 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 _0xd08a=['DATE','moment','sequelize','exports','STRING'];(function(_0x2c0a27,_0x4b7846){var _0x18bf5d=function(_0x4948f5){while(--_0x4948f5){_0x2c0a27['push'](_0x2c0a27['shift']());}};_0x18bf5d(++_0x4b7846);}(_0xd08a,0x83));var _0xad08=function(_0x286b15,_0x13ec24){_0x286b15=_0x286b15-0x0;var _0x2e2b19=_0xd08a[_0x286b15];return _0x2e2b19;};'use strict';var moment=require(_0xad08('0x0'));var Sequelize=require(_0xad08('0x1'));module[_0xad08('0x2')]={'uniqueid':{'type':Sequelize[_0xad08('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xad08('0x4')]},'leaveAt':{'type':Sequelize[_0xad08('0x4')]},'acceptAt':{'type':Sequelize[_0xad08('0x4')]},'exitAt':{'type':Sequelize[_0xad08('0x4')]},'reason':{'type':Sequelize[_0xad08('0x3')]}}; \ No newline at end of file +var _0xe362=['moment','exports','STRING','DATE'];(function(_0x5b2abd,_0x704793){var _0x4edbbb=function(_0x44d4a1){while(--_0x44d4a1){_0x5b2abd['push'](_0x5b2abd['shift']());}};_0x4edbbb(++_0x704793);}(_0xe362,0x194));var _0x2e36=function(_0x44d72d,_0x2bb49c){_0x44d72d=_0x44d72d-0x0;var _0x2cb82f=_0xe362[_0x44d72d];return _0x2cb82f;};'use strict';var moment=require(_0x2e36('0x0'));var Sequelize=require('sequelize');module[_0x2e36('0x1')]={'uniqueid':{'type':Sequelize[_0x2e36('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2e36('0x3')]},'leaveAt':{'type':Sequelize[_0x2e36('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 82dfe8a..d0445d7 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 _0x4f39=['keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','zip-dir','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','model'];(function(_0x5e2489,_0x2fd8be){var _0xa87596=function(_0x3b348d){while(--_0x3b348d){_0x5e2489['push'](_0x5e2489['shift']());}};_0xa87596(++_0x2fd8be);}(_0x4f39,0xb5));var _0x94f3=function(_0x569340,_0x535a5b){_0x569340=_0x569340-0x0;var _0x3d09c3=_0x4f39[_0x569340];return _0x3d09c3;};'use strict';var emlformat=require(_0x94f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x94f3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x94f3('0x2'));var Mustache=require('mustache');var util=require(_0x94f3('0x3'));var path=require(_0x94f3('0x4'));var sox=require('sox');var csv=require(_0x94f3('0x5'));var ejs=require(_0x94f3('0x6'));var fs=require('fs');var fs_extra=require(_0x94f3('0x7'));var _=require(_0x94f3('0x8'));var squel=require('squel');var crypto=require(_0x94f3('0x9'));var jsforce=require(_0x94f3('0xa'));var deskjs=require(_0x94f3('0xb'));var toCsv=require(_0x94f3('0x5'));var querystring=require(_0x94f3('0xc'));var Papa=require(_0x94f3('0xd'));var Redis=require(_0x94f3('0xe'));var authService=require(_0x94f3('0xf'));var qs=require(_0x94f3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94f3('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x94f3('0x12'));var config=require(_0x94f3('0x13'));var licenseUtil=require(_0x94f3('0x14'));var db=require(_0x94f3('0x15'))['db'];function respondWithStatusCode(_0xe55a53,_0x32828e){_0x32828e=_0x32828e||0xcc;return function(_0x4392c4){if(_0x4392c4){return _0xe55a53[_0x94f3('0x16')](_0x32828e);}return _0xe55a53[_0x94f3('0x17')](_0x32828e)['end']();};}function respondWithResult(_0x132ed1,_0x401f1f){_0x401f1f=_0x401f1f||0xc8;return function(_0x3b71d9){if(_0x3b71d9){return _0x132ed1[_0x94f3('0x17')](_0x401f1f)[_0x94f3('0x18')](_0x3b71d9);}};}function respondWithFilteredResult(_0x18d932,_0x268556){return function(_0x3c894d){if(_0x3c894d){var _0x332919=typeof _0x268556[_0x94f3('0x19')]===_0x94f3('0x1a')&&typeof _0x268556['limit']===_0x94f3('0x1a');var _0x53651f=_0x3c894d[_0x94f3('0x1b')];var _0x35ebae=_0x332919?0x0:_0x268556[_0x94f3('0x19')];var _0x4d2031=_0x332919?_0x3c894d[_0x94f3('0x1b')]:_0x268556[_0x94f3('0x19')]+_0x268556[_0x94f3('0x1c')];var _0x106af7;if(_0x4d2031>=_0x53651f){_0x4d2031=_0x53651f;_0x106af7=0xc8;}else{_0x106af7=0xce;}_0x18d932[_0x94f3('0x17')](_0x106af7);return _0x18d932[_0x94f3('0x1d')](_0x94f3('0x1e'),_0x35ebae+'-'+_0x4d2031+'/'+_0x53651f)['json'](_0x3c894d);}return null;};}function patchUpdates(_0x576051){return function(_0x357c30){try{jsonpatch[_0x94f3('0x1f')](_0x357c30,_0x576051,!![]);}catch(_0x1d8686){return BPromise[_0x94f3('0x20')](_0x1d8686);}return _0x357c30[_0x94f3('0x21')]();};}function saveUpdates(_0x4ea65c,_0x2f08cd){return function(_0x4d2e1b){if(_0x4d2e1b){return _0x4d2e1b[_0x94f3('0x22')](_0x4ea65c)[_0x94f3('0x23')](function(_0x508821){return _0x508821;});}return null;};}function removeEntity(_0x507e68,_0xec996f){return function(_0x43ac1f){if(_0x43ac1f){return _0x43ac1f['destroy']()[_0x94f3('0x23')](function(){_0x507e68[_0x94f3('0x17')](0xcc)[_0x94f3('0x24')]();});}};}function handleEntityNotFound(_0x4228cb,_0x3d4b44){return function(_0x5ea7ac){if(!_0x5ea7ac){_0x4228cb[_0x94f3('0x16')](0x194);}return _0x5ea7ac;};}function handleError(_0x5b00c7,_0x57a0cb){_0x57a0cb=_0x57a0cb||0x1f4;return function(_0x51c811){logger[_0x94f3('0x25')](_0x51c811[_0x94f3('0x26')]);if(_0x51c811[_0x94f3('0x27')]){delete _0x51c811[_0x94f3('0x27')];}_0x5b00c7['status'](_0x57a0cb)[_0x94f3('0x28')](_0x51c811);};}exports[_0x94f3('0x29')]=function(_0x2cbbd1,_0x24c7cf){var _0xcf9f7a={},_0x2337d6={},_0x45bd56={'count':0x0,'rows':[]};var _0x42a760=_[_0x94f3('0x2a')](db[_0x94f3('0x2b')][_0x94f3('0x2c')],function(_0x41c605){return{'name':_0x41c605[_0x94f3('0x2d')],'type':_0x41c605['type']['key']};});_0x2337d6[_0x94f3('0x2e')]=_[_0x94f3('0x2a')](_0x42a760,_0x94f3('0x27'));_0x2337d6['query']=_[_0x94f3('0x2f')](_0x2cbbd1[_0x94f3('0x30')]);_0x2337d6['filters']=_['intersection'](_0x2337d6['model'],_0x2337d6[_0x94f3('0x30')]);_0xcf9f7a[_0x94f3('0x31')]=_[_0x94f3('0x32')](_0x2337d6[_0x94f3('0x2e')],qs[_0x94f3('0x33')](_0x2cbbd1[_0x94f3('0x30')][_0x94f3('0x33')]));_0xcf9f7a[_0x94f3('0x31')]=_0xcf9f7a[_0x94f3('0x31')][_0x94f3('0x34')]?_0xcf9f7a[_0x94f3('0x31')]:_0x2337d6[_0x94f3('0x2e')];if(!_0x2cbbd1[_0x94f3('0x30')][_0x94f3('0x35')](_0x94f3('0x36'))){_0xcf9f7a[_0x94f3('0x1c')]=qs['limit'](_0x2cbbd1[_0x94f3('0x30')]['limit']);_0xcf9f7a['offset']=qs[_0x94f3('0x19')](_0x2cbbd1[_0x94f3('0x30')][_0x94f3('0x19')]);}_0xcf9f7a['order']=qs[_0x94f3('0x37')](_0x2cbbd1[_0x94f3('0x30')][_0x94f3('0x37')]);_0xcf9f7a[_0x94f3('0x38')]=qs['filters'](_[_0x94f3('0x39')](_0x2cbbd1[_0x94f3('0x30')],_0x2337d6[_0x94f3('0x3a')]),_0x42a760);if(_0x2cbbd1['query'][_0x94f3('0x3b')]){_0xcf9f7a['where']=_[_0x94f3('0x3c')](_0xcf9f7a[_0x94f3('0x38')],{'$or':_[_0x94f3('0x2a')](_0x42a760,function(_0x5c6d79){if(_0x5c6d79[_0x94f3('0x3d')]!==_0x94f3('0x3e')){var _0x55f00c={};_0x55f00c[_0x5c6d79[_0x94f3('0x27')]]={'$like':'%'+_0x2cbbd1['query'][_0x94f3('0x3b')]+'%'};return _0x55f00c;}})});}_0xcf9f7a=_[_0x94f3('0x3c')]({},_0xcf9f7a,_0x2cbbd1[_0x94f3('0x3f')]);var _0x29d68b={'where':_0xcf9f7a['where']};return db[_0x94f3('0x2b')][_0x94f3('0x1b')](_0x29d68b)[_0x94f3('0x23')](function(_0x147172){_0x45bd56[_0x94f3('0x1b')]=_0x147172;if(_0x2cbbd1['query'][_0x94f3('0x40')]){_0xcf9f7a[_0x94f3('0x41')]=[{'all':!![]}];}return db[_0x94f3('0x2b')][_0x94f3('0x42')](_0xcf9f7a);})[_0x94f3('0x23')](function(_0x507c8b){_0x45bd56[_0x94f3('0x43')]=_0x507c8b;return _0x45bd56;})['then'](respondWithFilteredResult(_0x24c7cf,_0xcf9f7a))[_0x94f3('0x44')](handleError(_0x24c7cf,null));};exports[_0x94f3('0x45')]=function(_0x21b626,_0x4ee842){var _0x1ee554={'raw':!![],'where':{'id':_0x21b626[_0x94f3('0x46')]['id']}},_0xed528f={};_0xed528f[_0x94f3('0x2e')]=_[_0x94f3('0x2f')](db['OpenchannelQueueReport'][_0x94f3('0x2c')]);_0xed528f[_0x94f3('0x30')]=_[_0x94f3('0x2f')](_0x21b626[_0x94f3('0x30')]);_0xed528f[_0x94f3('0x3a')]=_[_0x94f3('0x32')](_0xed528f[_0x94f3('0x2e')],_0xed528f[_0x94f3('0x30')]);_0x1ee554[_0x94f3('0x31')]=_[_0x94f3('0x32')](_0xed528f[_0x94f3('0x2e')],qs[_0x94f3('0x33')](_0x21b626[_0x94f3('0x30')]['fields']));_0x1ee554['attributes']=_0x1ee554['attributes'][_0x94f3('0x34')]?_0x1ee554[_0x94f3('0x31')]:_0xed528f[_0x94f3('0x2e')];if(_0x21b626[_0x94f3('0x30')]['includeAll']){_0x1ee554[_0x94f3('0x41')]=[{'all':!![]}];}_0x1ee554=_[_0x94f3('0x3c')]({},_0x1ee554,_0x21b626['options']);return db[_0x94f3('0x2b')]['find'](_0x1ee554)[_0x94f3('0x23')](handleEntityNotFound(_0x4ee842,null))[_0x94f3('0x23')](respondWithResult(_0x4ee842,null))[_0x94f3('0x44')](handleError(_0x4ee842,null));};exports[_0x94f3('0x47')]=function(_0x453af2,_0x4476ae){return db[_0x94f3('0x2b')][_0x94f3('0x47')](_0x453af2[_0x94f3('0x48')],{})[_0x94f3('0x23')](respondWithResult(_0x4476ae,0xc9))[_0x94f3('0x44')](handleError(_0x4476ae,null));};exports[_0x94f3('0x22')]=function(_0x4f094d,_0x59e693){if(_0x4f094d[_0x94f3('0x48')]['id']){delete _0x4f094d['body']['id'];}return db[_0x94f3('0x2b')][_0x94f3('0x49')]({'where':{'id':_0x4f094d['params']['id']}})['then'](handleEntityNotFound(_0x59e693,null))[_0x94f3('0x23')](saveUpdates(_0x4f094d['body'],null))[_0x94f3('0x23')](respondWithResult(_0x59e693,null))[_0x94f3('0x44')](handleError(_0x59e693,null));};exports[_0x94f3('0x4a')]=function(_0x43c42f,_0x4fea21){return db[_0x94f3('0x2b')][_0x94f3('0x49')]({'where':{'id':_0x43c42f[_0x94f3('0x46')]['id']}})['then'](handleEntityNotFound(_0x4fea21,null))['then'](removeEntity(_0x4fea21,null))[_0x94f3('0x44')](handleError(_0x4fea21,null));};exports[_0x94f3('0x4b')]=function(_0x39887d,_0x4d0297){return db[_0x94f3('0x2b')][_0x94f3('0x4b')]()[_0x94f3('0x23')](respondWithResult(_0x4d0297,null))[_0x94f3('0x44')](handleError(_0x4d0297,null));}; \ No newline at end of file +var _0x2581=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','update','destroy','then','error','stack','name','send','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','filter','merge','options','includeAll','include','catch','show','params','intersection','fields','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x2581,0x11d));var _0x1258=function(_0x11c98c,_0x418789){_0x11c98c=_0x11c98c-0x0;var _0xe4ec92=_0x2581[_0x11c98c];return _0xe4ec92;};'use strict';var emlformat=require(_0x1258('0x0'));var rimraf=require(_0x1258('0x1'));var zipdir=require(_0x1258('0x2'));var jsonpatch=require(_0x1258('0x3'));var rp=require(_0x1258('0x4'));var moment=require('moment');var BPromise=require(_0x1258('0x5'));var Mustache=require('mustache');var util=require(_0x1258('0x6'));var path=require('path');var sox=require(_0x1258('0x7'));var csv=require(_0x1258('0x8'));var ejs=require(_0x1258('0x9'));var fs=require('fs');var fs_extra=require(_0x1258('0xa'));var _=require(_0x1258('0xb'));var squel=require(_0x1258('0xc'));var crypto=require('crypto');var jsforce=require(_0x1258('0xd'));var deskjs=require(_0x1258('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1258('0xf'));var Papa=require(_0x1258('0x10'));var Redis=require(_0x1258('0x11'));var authService=require(_0x1258('0x12'));var qs=require(_0x1258('0x13'));var as=require(_0x1258('0x14'));var hardwareService=require(_0x1258('0x15'));var logger=require(_0x1258('0x16'))(_0x1258('0x17'));var utils=require('../../config/utils');var config=require(_0x1258('0x18'));var licenseUtil=require(_0x1258('0x19'));var db=require(_0x1258('0x1a'))['db'];function respondWithStatusCode(_0x5349c2,_0x277550){_0x277550=_0x277550||0xcc;return function(_0x465994){if(_0x465994){return _0x5349c2['sendStatus'](_0x277550);}return _0x5349c2[_0x1258('0x1b')](_0x277550)[_0x1258('0x1c')]();};}function respondWithResult(_0x4c342c,_0x31ecaa){_0x31ecaa=_0x31ecaa||0xc8;return function(_0x3df9a4){if(_0x3df9a4){return _0x4c342c[_0x1258('0x1b')](_0x31ecaa)[_0x1258('0x1d')](_0x3df9a4);}};}function respondWithFilteredResult(_0x13aab2,_0x2af4e8){return function(_0x55c585){if(_0x55c585){var _0x1491d2=typeof _0x2af4e8[_0x1258('0x1e')]===_0x1258('0x1f')&&typeof _0x2af4e8[_0x1258('0x20')]===_0x1258('0x1f');var _0x151d01=_0x55c585[_0x1258('0x21')];var _0xec14ce=_0x1491d2?0x0:_0x2af4e8[_0x1258('0x1e')];var _0x570aa2=_0x1491d2?_0x55c585['count']:_0x2af4e8['offset']+_0x2af4e8[_0x1258('0x20')];var _0x8e87c8;if(_0x570aa2>=_0x151d01){_0x570aa2=_0x151d01;_0x8e87c8=0xc8;}else{_0x8e87c8=0xce;}_0x13aab2[_0x1258('0x1b')](_0x8e87c8);return _0x13aab2[_0x1258('0x22')]('Content-Range',_0xec14ce+'-'+_0x570aa2+'/'+_0x151d01)[_0x1258('0x1d')](_0x55c585);}return null;};}function patchUpdates(_0x236167){return function(_0x5b3805){try{jsonpatch['apply'](_0x5b3805,_0x236167,!![]);}catch(_0x3491ca){return BPromise[_0x1258('0x23')](_0x3491ca);}return _0x5b3805['save']();};}function saveUpdates(_0x20b3cd,_0x4588e1){return function(_0x1b0fbf){if(_0x1b0fbf){return _0x1b0fbf[_0x1258('0x24')](_0x20b3cd)['then'](function(_0x1acc4c){return _0x1acc4c;});}return null;};}function removeEntity(_0x21d815,_0x3ecfea){return function(_0x514ee1){if(_0x514ee1){return _0x514ee1[_0x1258('0x25')]()[_0x1258('0x26')](function(){_0x21d815[_0x1258('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b84f2,_0x17d721){return function(_0x10d7e1){if(!_0x10d7e1){_0x1b84f2['sendStatus'](0x194);}return _0x10d7e1;};}function handleError(_0x14a684,_0x5c4c86){_0x5c4c86=_0x5c4c86||0x1f4;return function(_0x5bb3e6){logger[_0x1258('0x27')](_0x5bb3e6[_0x1258('0x28')]);if(_0x5bb3e6[_0x1258('0x29')]){delete _0x5bb3e6['name'];}_0x14a684[_0x1258('0x1b')](_0x5c4c86)[_0x1258('0x2a')](_0x5bb3e6);};}exports['index']=function(_0x2cbec4,_0x78d7f4){var _0x4df02e={},_0x4457e={},_0x45ace1={'count':0x0,'rows':[]};var _0x3c1e9a=_['map'](db[_0x1258('0x2b')][_0x1258('0x2c')],function(_0x4859a8){return{'name':_0x4859a8[_0x1258('0x2d')],'type':_0x4859a8[_0x1258('0x2e')][_0x1258('0x2f')]};});_0x4457e[_0x1258('0x30')]=_['map'](_0x3c1e9a,_0x1258('0x29'));_0x4457e[_0x1258('0x31')]=_[_0x1258('0x32')](_0x2cbec4[_0x1258('0x31')]);_0x4457e[_0x1258('0x33')]=_['intersection'](_0x4457e[_0x1258('0x30')],_0x4457e[_0x1258('0x31')]);_0x4df02e[_0x1258('0x34')]=_['intersection'](_0x4457e[_0x1258('0x30')],qs['fields'](_0x2cbec4[_0x1258('0x31')]['fields']));_0x4df02e['attributes']=_0x4df02e['attributes']['length']?_0x4df02e[_0x1258('0x34')]:_0x4457e[_0x1258('0x30')];if(!_0x2cbec4[_0x1258('0x31')][_0x1258('0x35')](_0x1258('0x36'))){_0x4df02e[_0x1258('0x20')]=qs[_0x1258('0x20')](_0x2cbec4['query'][_0x1258('0x20')]);_0x4df02e['offset']=qs[_0x1258('0x1e')](_0x2cbec4[_0x1258('0x31')][_0x1258('0x1e')]);}_0x4df02e['order']=qs[_0x1258('0x37')](_0x2cbec4[_0x1258('0x31')][_0x1258('0x37')]);_0x4df02e[_0x1258('0x38')]=qs[_0x1258('0x33')](_[_0x1258('0x39')](_0x2cbec4[_0x1258('0x31')],_0x4457e[_0x1258('0x33')]),_0x3c1e9a);if(_0x2cbec4['query']['filter']){_0x4df02e['where']=_['merge'](_0x4df02e[_0x1258('0x38')],{'$or':_[_0x1258('0x3a')](_0x3c1e9a,function(_0x9692af){if(_0x9692af[_0x1258('0x2e')]!==_0x1258('0x3b')){var _0x4647f2={};_0x4647f2[_0x9692af['name']]={'$like':'%'+_0x2cbec4[_0x1258('0x31')][_0x1258('0x3c')]+'%'};return _0x4647f2;}})});}_0x4df02e=_[_0x1258('0x3d')]({},_0x4df02e,_0x2cbec4[_0x1258('0x3e')]);var _0x5933ed={'where':_0x4df02e[_0x1258('0x38')]};return db[_0x1258('0x2b')]['count'](_0x5933ed)['then'](function(_0x2c1360){_0x45ace1[_0x1258('0x21')]=_0x2c1360;if(_0x2cbec4[_0x1258('0x31')][_0x1258('0x3f')]){_0x4df02e[_0x1258('0x40')]=[{'all':!![]}];}return db[_0x1258('0x2b')]['findAll'](_0x4df02e);})[_0x1258('0x26')](function(_0x1783d2){_0x45ace1['rows']=_0x1783d2;return _0x45ace1;})['then'](respondWithFilteredResult(_0x78d7f4,_0x4df02e))[_0x1258('0x41')](handleError(_0x78d7f4,null));};exports[_0x1258('0x42')]=function(_0x204c46,_0x56f14b){var _0x31dc81={'raw':!![],'where':{'id':_0x204c46[_0x1258('0x43')]['id']}},_0x1956ac={};_0x1956ac[_0x1258('0x30')]=_[_0x1258('0x32')](db[_0x1258('0x2b')]['rawAttributes']);_0x1956ac['query']=_[_0x1258('0x32')](_0x204c46[_0x1258('0x31')]);_0x1956ac[_0x1258('0x33')]=_[_0x1258('0x44')](_0x1956ac['model'],_0x1956ac[_0x1258('0x31')]);_0x31dc81[_0x1258('0x34')]=_['intersection'](_0x1956ac[_0x1258('0x30')],qs[_0x1258('0x45')](_0x204c46['query'][_0x1258('0x45')]));_0x31dc81[_0x1258('0x34')]=_0x31dc81[_0x1258('0x34')][_0x1258('0x46')]?_0x31dc81['attributes']:_0x1956ac[_0x1258('0x30')];if(_0x204c46[_0x1258('0x31')][_0x1258('0x3f')]){_0x31dc81[_0x1258('0x40')]=[{'all':!![]}];}_0x31dc81=_[_0x1258('0x3d')]({},_0x31dc81,_0x204c46[_0x1258('0x3e')]);return db[_0x1258('0x2b')]['find'](_0x31dc81)[_0x1258('0x26')](handleEntityNotFound(_0x56f14b,null))['then'](respondWithResult(_0x56f14b,null))[_0x1258('0x41')](handleError(_0x56f14b,null));};exports[_0x1258('0x47')]=function(_0x3577ae,_0x4a339f){return db['OpenchannelQueueReport']['create'](_0x3577ae['body'],{})[_0x1258('0x26')](respondWithResult(_0x4a339f,0xc9))[_0x1258('0x41')](handleError(_0x4a339f,null));};exports[_0x1258('0x24')]=function(_0x357263,_0x2d6fdc){if(_0x357263[_0x1258('0x48')]['id']){delete _0x357263[_0x1258('0x48')]['id'];}return db['OpenchannelQueueReport'][_0x1258('0x49')]({'where':{'id':_0x357263[_0x1258('0x43')]['id']}})[_0x1258('0x26')](handleEntityNotFound(_0x2d6fdc,null))[_0x1258('0x26')](saveUpdates(_0x357263[_0x1258('0x48')],null))[_0x1258('0x26')](respondWithResult(_0x2d6fdc,null))[_0x1258('0x41')](handleError(_0x2d6fdc,null));};exports[_0x1258('0x25')]=function(_0x4a7e69,_0x49f3ee){return db[_0x1258('0x2b')][_0x1258('0x49')]({'where':{'id':_0x4a7e69[_0x1258('0x43')]['id']}})[_0x1258('0x26')](handleEntityNotFound(_0x49f3ee,null))[_0x1258('0x26')](removeEntity(_0x49f3ee,null))['catch'](handleError(_0x49f3ee,null));};exports[_0x1258('0x4a')]=function(_0x13ae7e,_0x2e2f00){return db[_0x1258('0x2b')][_0x1258('0x4a')]()[_0x1258('0x26')](respondWithResult(_0x2e2f00,null))[_0x1258('0x41')](handleError(_0x2e2f00,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 75f7529..224692e 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x1f3c64,_0x3041e7){var _0x54ca11=function(_0x10cd96){while(--_0x10cd96){_0x1f3c64['push'](_0x1f3c64['shift']());}};_0x54ca11(++_0x3041e7);}(_0x1261,0x144));var _0x1126=function(_0x1ef547,_0x31bfdb){_0x1ef547=_0x1ef547-0x0;var _0x1d697b=_0x1261[_0x1ef547];return _0x1d697b;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x37b57a,_0x3ab231){var _0x6b4ff4=function(_0xf5bc45){while(--_0xf5bc45){_0x37b57a['push'](_0x37b57a['shift']());}};_0x6b4ff4(++_0x3ab231);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc4aa[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index adb3556..51244b8 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 _0xe1e3=['raw','debug','catch','OpenchannelQueueReport','update','body','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','CreateOpenchannelQueueReport','options'];(function(_0x27700d,_0x32ca7d){var _0x2fde2a=function(_0x167d34){while(--_0x167d34){_0x27700d['push'](_0x27700d['shift']());}};_0x2fde2a(++_0x32ca7d);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x59dbdf,_0x272895){_0x59dbdf=_0x59dbdf-0x0;var _0x5c9aa5=_0xe1e3[_0x59dbdf];return _0x5c9aa5;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cfba,_0x1574e5,_0x13926d){return new BPromise(function(_0x2f0e12,_0xa67e35){return client[_0x3e1e('0xa')](_0x55cfba,_0x13926d)[_0x3e1e('0xb')](function(_0x5e7d1f){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x1574e5,_0x3e1e('0xc'));logger['debug'](_0x3e1e('0xd'),_0x1574e5,_0x3e1e('0xc'),JSON[_0x3e1e('0xe')](_0x5e7d1f));if(_0x5e7d1f['error']){if(_0x5e7d1f[_0x3e1e('0xf')]['code']===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x1574e5,_0x5e7d1f['error']['message']);return _0xa67e35(_0x5e7d1f[_0x3e1e('0xf')]['message']);}logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x5e7d1f[_0x3e1e('0xf')][_0x3e1e('0x11')]);return _0x2f0e12(_0x5e7d1f['error']['message']);}else{logger[_0x3e1e('0x12')](_0x3e1e('0x10'),_0x1574e5,'request\x20sent');_0x2f0e12(_0x5e7d1f[_0x3e1e('0x13')][_0x3e1e('0x11')]);}})['catch'](function(_0x11c07f){logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x11c07f);_0xa67e35(_0x11c07f);});});}exports[_0x3e1e('0x14')]=function(_0x1d786c){var _0x39eaa7=this;return new Promise(function(_0x791ed8,_0x1c181b){return db['OpenchannelQueueReport']['create'](_0x1d786c['body'],{'raw':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1c5acd){logger['info'](_0x3e1e('0x14'),_0x1d786c);logger[_0x3e1e('0x17')](_0x3e1e('0x14'),_0x1d786c,JSON['stringify'](_0x1c5acd));_0x791ed8(_0x1c5acd);})[_0x3e1e('0x18')](function(_0x96396){logger[_0x3e1e('0xf')]('CreateOpenchannelQueueReport',_0x96396['message'],_0x1d786c);_0x1c181b(_0x39eaa7[_0x3e1e('0xf')](0x1f4,_0x96396[_0x3e1e('0x11')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x60e6bc){var _0x56ae51=this;return new Promise(function(_0x164b15,_0x33bf0f){return db[_0x3e1e('0x19')][_0x3e1e('0x1a')](_0x60e6bc[_0x3e1e('0x1b')],{'raw':_0x60e6bc[_0x3e1e('0x15')]?_0x60e6bc['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x60e6bc[_0x3e1e('0x15')]?_0x60e6bc[_0x3e1e('0x15')]['where']||null:null,'attributes':_0x60e6bc['options']?_0x60e6bc['options'][_0x3e1e('0x1c')]||null:null,'limit':_0x60e6bc[_0x3e1e('0x15')]?_0x60e6bc['options'][_0x3e1e('0x1d')]||null:null})['then'](function(_0xdfcd93){logger[_0x3e1e('0x12')]('UpdateOpenchannelQueueReport',_0x60e6bc);logger[_0x3e1e('0x17')](_0x3e1e('0x1e'),_0x60e6bc,JSON[_0x3e1e('0xe')](_0xdfcd93));_0x164b15(_0xdfcd93);})['catch'](function(_0xdef39){logger['error']('UpdateOpenchannelQueueReport',_0xdef39['message'],_0x60e6bc);_0x33bf0f(_0x56ae51[_0x3e1e('0xf')](0x1f4,_0xdef39['message']));});});}; \ No newline at end of file +var _0x7fea=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','then','debug','stringify','update','body','where','attributes','limit','UpdateOpenchannelQueueReport','util'];(function(_0x2aa657,_0x2dbfc1){var _0x5af5db=function(_0x5d6087){while(--_0x5d6087){_0x2aa657['push'](_0x2aa657['shift']());}};_0x5af5db(++_0x2dbfc1);}(_0x7fea,0x149));var _0xa7fe=function(_0x5157e6,_0x16b379){_0x5157e6=_0x5157e6-0x0;var _0x2e8f5d=_0x7fea[_0x5157e6];return _0x2e8f5d;};'use strict';var _=require('lodash');var util=require(_0xa7fe('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa7fe('0x1'));var fs=require('fs');var Redis=require(_0xa7fe('0x2'));var db=require(_0xa7fe('0x3'))['db'];var utils=require(_0xa7fe('0x4'));var logger=require(_0xa7fe('0x5'))(_0xa7fe('0x6'));var config=require('../../config/environment');var jayson=require(_0xa7fe('0x7'));var client=jayson[_0xa7fe('0x8')][_0xa7fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1132f1,_0x45f967,_0x3597b0){return new BPromise(function(_0x4668f0,_0x3d9135){return client['request'](_0x1132f1,_0x3597b0)['then'](function(_0x1db10e){logger[_0xa7fe('0xa')](_0xa7fe('0xb'),_0x45f967,_0xa7fe('0xc'));logger['debug'](_0xa7fe('0xd'),_0x45f967,_0xa7fe('0xc'),JSON['stringify'](_0x1db10e));if(_0x1db10e[_0xa7fe('0xe')]){if(_0x1db10e['error'][_0xa7fe('0xf')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x45f967,_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);return _0x3d9135(_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);}logger[_0xa7fe('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x45f967,_0x1db10e['error'][_0xa7fe('0x10')]);return _0x4668f0(_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);}else{logger[_0xa7fe('0xa')](_0xa7fe('0xb'),_0x45f967,'request\x20sent');_0x4668f0(_0x1db10e[_0xa7fe('0x11')][_0xa7fe('0x10')]);}})[_0xa7fe('0x12')](function(_0x253293){logger[_0xa7fe('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x45f967,_0x253293);_0x3d9135(_0x253293);});});}exports[_0xa7fe('0x13')]=function(_0x1e4966){var _0x2bf8db=this;return new Promise(function(_0x2ef53c,_0x179b9e){return db[_0xa7fe('0x14')][_0xa7fe('0x15')](_0x1e4966['body'],{'raw':_0x1e4966['options']?_0x1e4966[_0xa7fe('0x16')][_0xa7fe('0x17')]===undefined?!![]:![]:!![]})[_0xa7fe('0x18')](function(_0x529990){logger[_0xa7fe('0xa')](_0xa7fe('0x13'),_0x1e4966);logger[_0xa7fe('0x19')]('CreateOpenchannelQueueReport',_0x1e4966,JSON[_0xa7fe('0x1a')](_0x529990));_0x2ef53c(_0x529990);})[_0xa7fe('0x12')](function(_0x1619c1){logger[_0xa7fe('0xe')](_0xa7fe('0x13'),_0x1619c1[_0xa7fe('0x10')],_0x1e4966);_0x179b9e(_0x2bf8db[_0xa7fe('0xe')](0x1f4,_0x1619c1[_0xa7fe('0x10')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3415b8){var _0x4fb801=this;return new Promise(function(_0x4ce2e7,_0x37c8fa){return db[_0xa7fe('0x14')][_0xa7fe('0x1b')](_0x3415b8[_0xa7fe('0x1c')],{'raw':_0x3415b8[_0xa7fe('0x16')]?_0x3415b8['options'][_0xa7fe('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3415b8[_0xa7fe('0x16')]?_0x3415b8[_0xa7fe('0x16')][_0xa7fe('0x1d')]||null:null,'attributes':_0x3415b8[_0xa7fe('0x16')]?_0x3415b8[_0xa7fe('0x16')][_0xa7fe('0x1e')]||null:null,'limit':_0x3415b8[_0xa7fe('0x16')]?_0x3415b8[_0xa7fe('0x16')][_0xa7fe('0x1f')]||null:null})[_0xa7fe('0x18')](function(_0x19dd83){logger[_0xa7fe('0xa')](_0xa7fe('0x20'),_0x3415b8);logger[_0xa7fe('0x19')](_0xa7fe('0x20'),_0x3415b8,JSON[_0xa7fe('0x1a')](_0x19dd83));_0x4ce2e7(_0x19dd83);})[_0xa7fe('0x12')](function(_0x1c9e5a){logger[_0xa7fe('0xe')]('UpdateOpenchannelQueueReport',_0x1c9e5a[_0xa7fe('0x10')],_0x3415b8);_0x37c8fa(_0x4fb801[_0xa7fe('0xe')](0x1f4,_0x1c9e5a['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index d89737a..a4584ea 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 _0x8808=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','util','path','express'];(function(_0x2ef40b,_0x118719){var _0x3be817=function(_0x13fbe6){while(--_0x13fbe6){_0x2ef40b['push'](_0x2ef40b['shift']());}};_0x3be817(++_0x118719);}(_0x8808,0xa5));var _0x8880=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x8808[_0x138adb];return _0x1b27f2;};'use strict';var multer=require('multer');var util=require(_0x8880('0x0'));var path=require(_0x8880('0x1'));var timeout=require('connect-timeout');var express=require(_0x8880('0x2'));var router=express[_0x8880('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8880('0x4'));var interaction=require(_0x8880('0x5'));var config=require(_0x8880('0x6'));var controller=require(_0x8880('0x7'));router[_0x8880('0x8')]('/',auth[_0x8880('0x9')](),controller[_0x8880('0xa')]);router[_0x8880('0x8')](_0x8880('0xb'),auth[_0x8880('0x9')](),controller[_0x8880('0xc')]);router[_0x8880('0x8')](_0x8880('0xd'),auth[_0x8880('0x9')](),controller[_0x8880('0xe')]);router[_0x8880('0xf')]('/',auth[_0x8880('0x9')](),controller[_0x8880('0x10')]);router[_0x8880('0x11')](_0x8880('0xd'),auth[_0x8880('0x9')](),controller[_0x8880('0x12')]);router['delete'](_0x8880('0xd'),auth[_0x8880('0x9')](),controller[_0x8880('0x13')]);module[_0x8880('0x14')]=router; \ No newline at end of file +var _0x4c64=['../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x350c4f,_0x19e19b){var _0x286ea1=function(_0x9628b7){while(--_0x9628b7){_0x350c4f['push'](_0x350c4f['shift']());}};_0x286ea1(++_0x19e19b);}(_0x4c64,0x76));var _0x44c6=function(_0x5d1fdb,_0x15acde){_0x5d1fdb=_0x5d1fdb-0x0;var _0x4077e1=_0x4c64[_0x5d1fdb];return _0x4077e1;};'use strict';var multer=require(_0x44c6('0x0'));var util=require(_0x44c6('0x1'));var path=require(_0x44c6('0x2'));var timeout=require(_0x44c6('0x3'));var express=require(_0x44c6('0x4'));var router=express[_0x44c6('0x5')]();var fs_extra=require(_0x44c6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x44c6('0x7'));var config=require(_0x44c6('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0x44c6('0x9')]('/',auth['isAuthenticated'](),controller[_0x44c6('0xa')]);router[_0x44c6('0x9')](_0x44c6('0xb'),auth[_0x44c6('0xc')](),controller[_0x44c6('0xd')]);router[_0x44c6('0x9')](_0x44c6('0xe'),auth[_0x44c6('0xc')](),controller[_0x44c6('0xf')]);router[_0x44c6('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x44c6('0x11')](_0x44c6('0xe'),auth[_0x44c6('0xc')](),controller[_0x44c6('0x12')]);router[_0x44c6('0x13')](_0x44c6('0xe'),auth[_0x44c6('0xc')](),controller[_0x44c6('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index aeead52..e725dee 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x4ae926,_0xe6ff7c){var _0x50f2ba=function(_0x2bfd16){while(--_0x2bfd16){_0x4ae926['push'](_0x4ae926['shift']());}};_0x50f2ba(++_0xe6ff7c);}(_0xe706,0xa3));var _0x6e70=function(_0xdb01a,_0x54a83a){_0xdb01a=_0xdb01a-0x0;var _0x107ede=_0xe706[_0xdb01a];return _0x107ede;};'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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x334201,_0x39f06f){var _0x134700=function(_0x28d73f){while(--_0x28d73f){_0x334201['push'](_0x334201['shift']());}};_0x134700(++_0x39f06f);}(_0x34e8,0x12c));var _0x834e=function(_0x5dd909,_0x2993ae){_0x5dd909=_0x5dd909-0x0;var _0x56f2a4=_0x34e8[_0x5dd909];return _0x56f2a4;};'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 5df958f..2bab85f 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 _0x3e9f=['apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','rawAttributes','fieldName','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','merge','VIRTUAL','options','OpenchannelTransferReport','include','findAll','rows','catch','show','params','keys','intersection','includeAll','find','create','body','describe','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range'];(function(_0x4127ee,_0x2a1236){var _0xd63da1=function(_0xce759b){while(--_0xce759b){_0x4127ee['push'](_0x4127ee['shift']());}};_0xd63da1(++_0x2a1236);}(_0x3e9f,0x14b));var _0xf3e9=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x3e9f[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf3e9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf3e9('0x1'));var moment=require(_0xf3e9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf3e9('0x3'));var util=require(_0xf3e9('0x4'));var path=require(_0xf3e9('0x5'));var sox=require(_0xf3e9('0x6'));var csv=require('to-csv');var ejs=require(_0xf3e9('0x7'));var fs=require('fs');var fs_extra=require(_0xf3e9('0x8'));var _=require(_0xf3e9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf3e9('0xa'));var toCsv=require(_0xf3e9('0xb'));var querystring=require(_0xf3e9('0xc'));var Papa=require(_0xf3e9('0xd'));var Redis=require(_0xf3e9('0xe'));var authService=require(_0xf3e9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf3e9('0x10'));var hardwareService=require(_0xf3e9('0x11'));var logger=require(_0xf3e9('0x12'))('api');var utils=require(_0xf3e9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf3e9('0x14'));var db=require(_0xf3e9('0x15'))['db'];function respondWithStatusCode(_0x501f3d,_0x3524d7){_0x3524d7=_0x3524d7||0xcc;return function(_0x4406b9){if(_0x4406b9){return _0x501f3d['sendStatus'](_0x3524d7);}return _0x501f3d[_0xf3e9('0x16')](_0x3524d7)['end']();};}function respondWithResult(_0x3dad36,_0x3b0ac5){_0x3b0ac5=_0x3b0ac5||0xc8;return function(_0x55f2b2){if(_0x55f2b2){return _0x3dad36['status'](_0x3b0ac5)[_0xf3e9('0x17')](_0x55f2b2);}};}function respondWithFilteredResult(_0x5d6d27,_0xca5dfa){return function(_0x93180c){if(_0x93180c){var _0x515a28=typeof _0xca5dfa[_0xf3e9('0x18')]===_0xf3e9('0x19')&&typeof _0xca5dfa['limit']===_0xf3e9('0x19');var _0x3c7e23=_0x93180c['count'];var _0x40cd50=_0x515a28?0x0:_0xca5dfa['offset'];var _0x1bf18c=_0x515a28?_0x93180c[_0xf3e9('0x1a')]:_0xca5dfa['offset']+_0xca5dfa['limit'];var _0x5f4264;if(_0x1bf18c>=_0x3c7e23){_0x1bf18c=_0x3c7e23;_0x5f4264=0xc8;}else{_0x5f4264=0xce;}_0x5d6d27[_0xf3e9('0x16')](_0x5f4264);return _0x5d6d27[_0xf3e9('0x1b')](_0xf3e9('0x1c'),_0x40cd50+'-'+_0x1bf18c+'/'+_0x3c7e23)['json'](_0x93180c);}return null;};}function patchUpdates(_0x1f76c9){return function(_0x5db080){try{jsonpatch[_0xf3e9('0x1d')](_0x5db080,_0x1f76c9,!![]);}catch(_0x4f2f30){return BPromise[_0xf3e9('0x1e')](_0x4f2f30);}return _0x5db080[_0xf3e9('0x1f')]();};}function saveUpdates(_0x1b64e4,_0xae77c1){return function(_0x2e7774){if(_0x2e7774){return _0x2e7774[_0xf3e9('0x20')](_0x1b64e4)['then'](function(_0x407a19){return _0x407a19;});}return null;};}function removeEntity(_0x56a948,_0x5034d0){return function(_0x9a15ab){if(_0x9a15ab){return _0x9a15ab[_0xf3e9('0x21')]()[_0xf3e9('0x22')](function(){_0x56a948[_0xf3e9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4463dd,_0x5a02ab){return function(_0x2abccc){if(!_0x2abccc){_0x4463dd[_0xf3e9('0x23')](0x194);}return _0x2abccc;};}function handleError(_0x3a26ee,_0x411139){_0x411139=_0x411139||0x1f4;return function(_0x1444f8){logger[_0xf3e9('0x24')](_0x1444f8[_0xf3e9('0x25')]);if(_0x1444f8['name']){delete _0x1444f8[_0xf3e9('0x26')];}_0x3a26ee['status'](_0x411139)['send'](_0x1444f8);};}exports[_0xf3e9('0x27')]=function(_0x134bc0,_0x1d2455){var _0x399b48={},_0x33c837={},_0x243af7={'count':0x0,'rows':[]};var _0x375072=_['map'](db['OpenchannelTransferReport'][_0xf3e9('0x28')],function(_0x3406e7){return{'name':_0x3406e7[_0xf3e9('0x29')],'type':_0x3406e7['type'][_0xf3e9('0x2a')]};});_0x33c837['model']=_[_0xf3e9('0x2b')](_0x375072,_0xf3e9('0x26'));_0x33c837[_0xf3e9('0x2c')]=_['keys'](_0x134bc0[_0xf3e9('0x2c')]);_0x33c837[_0xf3e9('0x2d')]=_['intersection'](_0x33c837[_0xf3e9('0x2e')],_0x33c837[_0xf3e9('0x2c')]);_0x399b48[_0xf3e9('0x2f')]=_['intersection'](_0x33c837[_0xf3e9('0x2e')],qs['fields'](_0x134bc0[_0xf3e9('0x2c')][_0xf3e9('0x30')]));_0x399b48[_0xf3e9('0x2f')]=_0x399b48[_0xf3e9('0x2f')][_0xf3e9('0x31')]?_0x399b48['attributes']:_0x33c837[_0xf3e9('0x2e')];if(!_0x134bc0[_0xf3e9('0x2c')][_0xf3e9('0x32')]('nolimit')){_0x399b48[_0xf3e9('0x33')]=qs[_0xf3e9('0x33')](_0x134bc0[_0xf3e9('0x2c')][_0xf3e9('0x33')]);_0x399b48[_0xf3e9('0x18')]=qs[_0xf3e9('0x18')](_0x134bc0['query'][_0xf3e9('0x18')]);}_0x399b48['order']=qs['sort'](_0x134bc0[_0xf3e9('0x2c')][_0xf3e9('0x34')]);_0x399b48[_0xf3e9('0x35')]=qs[_0xf3e9('0x2d')](_[_0xf3e9('0x36')](_0x134bc0[_0xf3e9('0x2c')],_0x33c837['filters']),_0x375072);if(_0x134bc0[_0xf3e9('0x2c')]['filter']){_0x399b48[_0xf3e9('0x35')]=_[_0xf3e9('0x37')](_0x399b48[_0xf3e9('0x35')],{'$or':_['map'](_0x375072,function(_0x1fd84e){if(_0x1fd84e['type']!==_0xf3e9('0x38')){var _0x31e125={};_0x31e125[_0x1fd84e['name']]={'$like':'%'+_0x134bc0[_0xf3e9('0x2c')]['filter']+'%'};return _0x31e125;}})});}_0x399b48=_[_0xf3e9('0x37')]({},_0x399b48,_0x134bc0[_0xf3e9('0x39')]);var _0x1f3e47={'where':_0x399b48[_0xf3e9('0x35')]};return db[_0xf3e9('0x3a')]['count'](_0x1f3e47)[_0xf3e9('0x22')](function(_0x245446){_0x243af7[_0xf3e9('0x1a')]=_0x245446;if(_0x134bc0[_0xf3e9('0x2c')]['includeAll']){_0x399b48[_0xf3e9('0x3b')]=[{'all':!![]}];}return db[_0xf3e9('0x3a')][_0xf3e9('0x3c')](_0x399b48);})[_0xf3e9('0x22')](function(_0x1a31a0){_0x243af7[_0xf3e9('0x3d')]=_0x1a31a0;return _0x243af7;})[_0xf3e9('0x22')](respondWithFilteredResult(_0x1d2455,_0x399b48))[_0xf3e9('0x3e')](handleError(_0x1d2455,null));};exports[_0xf3e9('0x3f')]=function(_0x53bd69,_0x7aed02){var _0x51d5dc={'raw':!![],'where':{'id':_0x53bd69[_0xf3e9('0x40')]['id']}},_0x5900c8={};_0x5900c8[_0xf3e9('0x2e')]=_['keys'](db[_0xf3e9('0x3a')][_0xf3e9('0x28')]);_0x5900c8[_0xf3e9('0x2c')]=_[_0xf3e9('0x41')](_0x53bd69[_0xf3e9('0x2c')]);_0x5900c8[_0xf3e9('0x2d')]=_[_0xf3e9('0x42')](_0x5900c8[_0xf3e9('0x2e')],_0x5900c8[_0xf3e9('0x2c')]);_0x51d5dc['attributes']=_[_0xf3e9('0x42')](_0x5900c8['model'],qs[_0xf3e9('0x30')](_0x53bd69[_0xf3e9('0x2c')]['fields']));_0x51d5dc[_0xf3e9('0x2f')]=_0x51d5dc[_0xf3e9('0x2f')][_0xf3e9('0x31')]?_0x51d5dc['attributes']:_0x5900c8[_0xf3e9('0x2e')];if(_0x53bd69['query'][_0xf3e9('0x43')]){_0x51d5dc['include']=[{'all':!![]}];}_0x51d5dc=_['merge']({},_0x51d5dc,_0x53bd69['options']);return db[_0xf3e9('0x3a')][_0xf3e9('0x44')](_0x51d5dc)['then'](handleEntityNotFound(_0x7aed02,null))[_0xf3e9('0x22')](respondWithResult(_0x7aed02,null))['catch'](handleError(_0x7aed02,null));};exports[_0xf3e9('0x45')]=function(_0x44ae08,_0x5047ba){return db[_0xf3e9('0x3a')][_0xf3e9('0x45')](_0x44ae08[_0xf3e9('0x46')],{})[_0xf3e9('0x22')](respondWithResult(_0x5047ba,0xc9))['catch'](handleError(_0x5047ba,null));};exports[_0xf3e9('0x20')]=function(_0x133e26,_0x71b3fc){if(_0x133e26[_0xf3e9('0x46')]['id']){delete _0x133e26[_0xf3e9('0x46')]['id'];}return db[_0xf3e9('0x3a')][_0xf3e9('0x44')]({'where':{'id':_0x133e26[_0xf3e9('0x40')]['id']}})[_0xf3e9('0x22')](handleEntityNotFound(_0x71b3fc,null))['then'](saveUpdates(_0x133e26[_0xf3e9('0x46')],null))[_0xf3e9('0x22')](respondWithResult(_0x71b3fc,null))[_0xf3e9('0x3e')](handleError(_0x71b3fc,null));};exports['destroy']=function(_0x26e4e4,_0x25c3cb){return db[_0xf3e9('0x3a')][_0xf3e9('0x44')]({'where':{'id':_0x26e4e4[_0xf3e9('0x40')]['id']}})[_0xf3e9('0x22')](handleEntityNotFound(_0x25c3cb,null))['then'](removeEntity(_0x25c3cb,null))[_0xf3e9('0x3e')](handleError(_0x25c3cb,null));};exports[_0xf3e9('0x47')]=function(_0x2a67e3,_0x1e0b76){return db[_0xf3e9('0x3a')][_0xf3e9('0x47')]()[_0xf3e9('0x22')](respondWithResult(_0x1e0b76,null))['catch'](handleError(_0x1e0b76,null));}; \ No newline at end of file +var _0x74f7=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','params','keys','find','catch','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','end','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query'];(function(_0x4c1505,_0x3544f2){var _0x5c25af=function(_0x41ff27){while(--_0x41ff27){_0x4c1505['push'](_0x4c1505['shift']());}};_0x5c25af(++_0x3544f2);}(_0x74f7,0x186));var _0x774f=function(_0x1ed084,_0x3f4260){_0x1ed084=_0x1ed084-0x0;var _0x5ab7c0=_0x74f7[_0x1ed084];return _0x5ab7c0;};'use strict';var emlformat=require(_0x774f('0x0'));var rimraf=require(_0x774f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x774f('0x2'));var moment=require(_0x774f('0x3'));var BPromise=require(_0x774f('0x4'));var Mustache=require(_0x774f('0x5'));var util=require(_0x774f('0x6'));var path=require(_0x774f('0x7'));var sox=require(_0x774f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x774f('0x9'));var _=require(_0x774f('0xa'));var squel=require(_0x774f('0xb'));var crypto=require(_0x774f('0xc'));var jsforce=require(_0x774f('0xd'));var deskjs=require(_0x774f('0xe'));var toCsv=require(_0x774f('0xf'));var querystring=require(_0x774f('0x10'));var Papa=require(_0x774f('0x11'));var Redis=require(_0x774f('0x12'));var authService=require(_0x774f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x774f('0x14'))(_0x774f('0x15'));var utils=require('../../config/utils');var config=require(_0x774f('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43802d,_0x3fdd0c){_0x3fdd0c=_0x3fdd0c||0xcc;return function(_0x375b1f){if(_0x375b1f){return _0x43802d[_0x774f('0x17')](_0x3fdd0c);}return _0x43802d['status'](_0x3fdd0c)['end']();};}function respondWithResult(_0xfe2a28,_0x12f1fe){_0x12f1fe=_0x12f1fe||0xc8;return function(_0x49c127){if(_0x49c127){return _0xfe2a28[_0x774f('0x18')](_0x12f1fe)[_0x774f('0x19')](_0x49c127);}};}function respondWithFilteredResult(_0x15d007,_0x3f1f01){return function(_0x31561c){if(_0x31561c){var _0x1b5d3a=typeof _0x3f1f01[_0x774f('0x1a')]===_0x774f('0x1b')&&typeof _0x3f1f01['limit']==='undefined';var _0x27a16b=_0x31561c['count'];var _0x24797c=_0x1b5d3a?0x0:_0x3f1f01[_0x774f('0x1a')];var _0x154685=_0x1b5d3a?_0x31561c[_0x774f('0x1c')]:_0x3f1f01[_0x774f('0x1a')]+_0x3f1f01[_0x774f('0x1d')];var _0x5c4fb7;if(_0x154685>=_0x27a16b){_0x154685=_0x27a16b;_0x5c4fb7=0xc8;}else{_0x5c4fb7=0xce;}_0x15d007['status'](_0x5c4fb7);return _0x15d007[_0x774f('0x1e')]('Content-Range',_0x24797c+'-'+_0x154685+'/'+_0x27a16b)[_0x774f('0x19')](_0x31561c);}return null;};}function patchUpdates(_0x3c234e){return function(_0x730e62){try{jsonpatch[_0x774f('0x1f')](_0x730e62,_0x3c234e,!![]);}catch(_0x45046b){return BPromise[_0x774f('0x20')](_0x45046b);}return _0x730e62[_0x774f('0x21')]();};}function saveUpdates(_0x5e3cd3,_0x46169a){return function(_0x13f979){if(_0x13f979){return _0x13f979[_0x774f('0x22')](_0x5e3cd3)[_0x774f('0x23')](function(_0x15e819){return _0x15e819;});}return null;};}function removeEntity(_0x4fe659,_0x5489cd){return function(_0x45b0fe){if(_0x45b0fe){return _0x45b0fe[_0x774f('0x24')]()[_0x774f('0x23')](function(){_0x4fe659[_0x774f('0x18')](0xcc)[_0x774f('0x25')]();});}};}function handleEntityNotFound(_0x3eff87,_0x4bd323){return function(_0x41e44c){if(!_0x41e44c){_0x3eff87[_0x774f('0x17')](0x194);}return _0x41e44c;};}function handleError(_0x3eb51d,_0x4f0359){_0x4f0359=_0x4f0359||0x1f4;return function(_0x3b662a){logger['error'](_0x3b662a[_0x774f('0x26')]);if(_0x3b662a[_0x774f('0x27')]){delete _0x3b662a[_0x774f('0x27')];}_0x3eb51d['status'](_0x4f0359)['send'](_0x3b662a);};}exports[_0x774f('0x28')]=function(_0x4d126a,_0x1fc55b){var _0x28bac4={},_0xadedf3={},_0x1c4c84={'count':0x0,'rows':[]};var _0xfc244a=_[_0x774f('0x29')](db[_0x774f('0x2a')][_0x774f('0x2b')],function(_0x4e5a70){return{'name':_0x4e5a70[_0x774f('0x2c')],'type':_0x4e5a70[_0x774f('0x2d')]['key']};});_0xadedf3[_0x774f('0x2e')]=_['map'](_0xfc244a,_0x774f('0x27'));_0xadedf3[_0x774f('0x2f')]=_['keys'](_0x4d126a[_0x774f('0x2f')]);_0xadedf3[_0x774f('0x30')]=_[_0x774f('0x31')](_0xadedf3[_0x774f('0x2e')],_0xadedf3[_0x774f('0x2f')]);_0x28bac4[_0x774f('0x32')]=_['intersection'](_0xadedf3[_0x774f('0x2e')],qs[_0x774f('0x33')](_0x4d126a[_0x774f('0x2f')][_0x774f('0x33')]));_0x28bac4[_0x774f('0x32')]=_0x28bac4[_0x774f('0x32')][_0x774f('0x34')]?_0x28bac4[_0x774f('0x32')]:_0xadedf3[_0x774f('0x2e')];if(!_0x4d126a[_0x774f('0x2f')][_0x774f('0x35')](_0x774f('0x36'))){_0x28bac4[_0x774f('0x1d')]=qs['limit'](_0x4d126a[_0x774f('0x2f')][_0x774f('0x1d')]);_0x28bac4[_0x774f('0x1a')]=qs[_0x774f('0x1a')](_0x4d126a[_0x774f('0x2f')][_0x774f('0x1a')]);}_0x28bac4[_0x774f('0x37')]=qs[_0x774f('0x38')](_0x4d126a['query'][_0x774f('0x38')]);_0x28bac4['where']=qs[_0x774f('0x30')](_[_0x774f('0x39')](_0x4d126a[_0x774f('0x2f')],_0xadedf3[_0x774f('0x30')]),_0xfc244a);if(_0x4d126a[_0x774f('0x2f')][_0x774f('0x3a')]){_0x28bac4['where']=_[_0x774f('0x3b')](_0x28bac4['where'],{'$or':_[_0x774f('0x29')](_0xfc244a,function(_0x53dae5){if(_0x53dae5[_0x774f('0x2d')]!==_0x774f('0x3c')){var _0x52b0d7={};_0x52b0d7[_0x53dae5[_0x774f('0x27')]]={'$like':'%'+_0x4d126a[_0x774f('0x2f')]['filter']+'%'};return _0x52b0d7;}})});}_0x28bac4=_[_0x774f('0x3b')]({},_0x28bac4,_0x4d126a[_0x774f('0x3d')]);var _0x154f80={'where':_0x28bac4[_0x774f('0x3e')]};return db['OpenchannelTransferReport'][_0x774f('0x1c')](_0x154f80)[_0x774f('0x23')](function(_0x21de82){_0x1c4c84[_0x774f('0x1c')]=_0x21de82;if(_0x4d126a[_0x774f('0x2f')][_0x774f('0x3f')]){_0x28bac4[_0x774f('0x40')]=[{'all':!![]}];}return db[_0x774f('0x2a')][_0x774f('0x41')](_0x28bac4);})[_0x774f('0x23')](function(_0x17028a){_0x1c4c84['rows']=_0x17028a;return _0x1c4c84;})[_0x774f('0x23')](respondWithFilteredResult(_0x1fc55b,_0x28bac4))['catch'](handleError(_0x1fc55b,null));};exports['show']=function(_0x4db5dd,_0x1a7f4e){var _0x5eb5fd={'raw':!![],'where':{'id':_0x4db5dd[_0x774f('0x42')]['id']}},_0x226118={};_0x226118[_0x774f('0x2e')]=_[_0x774f('0x43')](db[_0x774f('0x2a')]['rawAttributes']);_0x226118[_0x774f('0x2f')]=_['keys'](_0x4db5dd[_0x774f('0x2f')]);_0x226118[_0x774f('0x30')]=_[_0x774f('0x31')](_0x226118[_0x774f('0x2e')],_0x226118[_0x774f('0x2f')]);_0x5eb5fd['attributes']=_[_0x774f('0x31')](_0x226118['model'],qs[_0x774f('0x33')](_0x4db5dd['query']['fields']));_0x5eb5fd[_0x774f('0x32')]=_0x5eb5fd['attributes']['length']?_0x5eb5fd['attributes']:_0x226118[_0x774f('0x2e')];if(_0x4db5dd[_0x774f('0x2f')][_0x774f('0x3f')]){_0x5eb5fd[_0x774f('0x40')]=[{'all':!![]}];}_0x5eb5fd=_[_0x774f('0x3b')]({},_0x5eb5fd,_0x4db5dd['options']);return db[_0x774f('0x2a')][_0x774f('0x44')](_0x5eb5fd)[_0x774f('0x23')](handleEntityNotFound(_0x1a7f4e,null))[_0x774f('0x23')](respondWithResult(_0x1a7f4e,null))[_0x774f('0x45')](handleError(_0x1a7f4e,null));};exports[_0x774f('0x46')]=function(_0x594bcc,_0x3898a3){return db[_0x774f('0x2a')][_0x774f('0x46')](_0x594bcc[_0x774f('0x47')],{})[_0x774f('0x23')](respondWithResult(_0x3898a3,0xc9))[_0x774f('0x45')](handleError(_0x3898a3,null));};exports[_0x774f('0x22')]=function(_0x190eff,_0x56f289){if(_0x190eff[_0x774f('0x47')]['id']){delete _0x190eff[_0x774f('0x47')]['id'];}return db[_0x774f('0x2a')]['find']({'where':{'id':_0x190eff[_0x774f('0x42')]['id']}})[_0x774f('0x23')](handleEntityNotFound(_0x56f289,null))[_0x774f('0x23')](saveUpdates(_0x190eff['body'],null))['then'](respondWithResult(_0x56f289,null))[_0x774f('0x45')](handleError(_0x56f289,null));};exports['destroy']=function(_0x1df6af,_0x39bfa1){return db[_0x774f('0x2a')][_0x774f('0x44')]({'where':{'id':_0x1df6af[_0x774f('0x42')]['id']}})[_0x774f('0x23')](handleEntityNotFound(_0x39bfa1,null))[_0x774f('0x23')](removeEntity(_0x39bfa1,null))[_0x774f('0x45')](handleError(_0x39bfa1,null));};exports['describe']=function(_0x593fb2,_0x283ec1){return db[_0x774f('0x2a')][_0x774f('0x48')]()[_0x774f('0x23')](respondWithResult(_0x283ec1,null))[_0x774f('0x45')](handleError(_0x283ec1,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 3d0dd1e..3ed4bed 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 _0x5b75=['./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x5dc2e4,_0x3d175b){var _0x24abcd=function(_0x1424fc){while(--_0x1424fc){_0x5dc2e4['push'](_0x5dc2e4['shift']());}};_0x24abcd(++_0x3d175b);}(_0x5b75,0x148));var _0x55b7=function(_0x75ba0c,_0x141396){_0x75ba0c=_0x75ba0c-0x0;var _0x4d53d3=_0x5b75[_0x75ba0c];return _0x4d53d3;};'use strict';var _=require(_0x55b7('0x0'));var util=require(_0x55b7('0x1'));var logger=require(_0x55b7('0x2'))(_0x55b7('0x3'));var moment=require('moment');var BPromise=require(_0x55b7('0x4'));var rp=require(_0x55b7('0x5'));var fs=require('fs');var path=require(_0x55b7('0x6'));var rimraf=require(_0x55b7('0x7'));var config=require('../../config/environment');var attributes=require(_0x55b7('0x8'));module[_0x55b7('0x9')]=function(_0x8cfc03,_0x35769a){return _0x8cfc03[_0x55b7('0xa')](_0x55b7('0xb'),attributes,{'tableName':_0x55b7('0xc'),'paranoid':![],'indexes':[{'name':_0x55b7('0xd'),'fields':[_0x55b7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4546=['lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x4546,0x155));var _0x6454=function(_0x10f63e,_0x31b2d3){_0x10f63e=_0x10f63e-0x0;var _0x50b3d5=_0x4546[_0x10f63e];return _0x50b3d5;};'use strict';var _=require(_0x6454('0x0'));var util=require(_0x6454('0x1'));var logger=require(_0x6454('0x2'))(_0x6454('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6454('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6454('0x5'));var config=require(_0x6454('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x6454('0x7')]=function(_0x5f80a1,_0x3b63b0){return _0x5f80a1['define'](_0x6454('0x8'),attributes,{'tableName':_0x6454('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6454('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 90b2239..c15c0d6 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 _0x8ba0=['rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x19726f,_0x49e0eb){_0x19726f=_0x19726f-0x0;var _0x23c58c=_0x8ba0[_0x19726f];return _0x23c58c;};'use strict';var _=require(_0x08ba('0x0'));var util=require(_0x08ba('0x1'));var moment=require(_0x08ba('0x2'));var BPromise=require(_0x08ba('0x3'));var rs=require(_0x08ba('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x08ba('0x5'));var logger=require(_0x08ba('0x6'))(_0x08ba('0x7'));var config=require(_0x08ba('0x8'));var jayson=require(_0x08ba('0x9'));var client=jayson[_0x08ba('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x235354,_0x11f6a1,_0x37bcdf){return new BPromise(function(_0x451f15,_0x1f6051){return client['request'](_0x235354,_0x37bcdf)[_0x08ba('0xb')](function(_0x5eb94f){logger[_0x08ba('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x11f6a1,_0x08ba('0xd'));logger[_0x08ba('0xe')](_0x08ba('0xf'),_0x11f6a1,_0x08ba('0xd'),JSON[_0x08ba('0x10')](_0x5eb94f));if(_0x5eb94f[_0x08ba('0x11')]){if(_0x5eb94f[_0x08ba('0x11')][_0x08ba('0x12')]===0x1f4){logger[_0x08ba('0x11')](_0x08ba('0x13'),_0x11f6a1,_0x5eb94f[_0x08ba('0x11')][_0x08ba('0x14')]);return _0x1f6051(_0x5eb94f['error'][_0x08ba('0x14')]);}logger[_0x08ba('0x11')](_0x08ba('0x13'),_0x11f6a1,_0x5eb94f[_0x08ba('0x11')][_0x08ba('0x14')]);return _0x451f15(_0x5eb94f[_0x08ba('0x11')]['message']);}else{logger[_0x08ba('0xc')](_0x08ba('0x13'),_0x11f6a1,_0x08ba('0xd'));_0x451f15(_0x5eb94f[_0x08ba('0x15')][_0x08ba('0x14')]);}})['catch'](function(_0x4b5a04){logger[_0x08ba('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x11f6a1,_0x4b5a04);_0x1f6051(_0x4b5a04);});});} \ No newline at end of file +var _0xf2cf=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','util','moment'];(function(_0x346b57,_0x48b6ee){var _0x24ad77=function(_0x4ed4dd){while(--_0x4ed4dd){_0x346b57['push'](_0x346b57['shift']());}};_0x24ad77(++_0x48b6ee);}(_0xf2cf,0xf5));var _0xff2c=function(_0x4a6b83,_0x31db46){_0x4a6b83=_0x4a6b83-0x0;var _0x58185c=_0xf2cf[_0x4a6b83];return _0x58185c;};'use strict';var _=require('lodash');var util=require(_0xff2c('0x0'));var moment=require(_0xff2c('0x1'));var BPromise=require(_0xff2c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff2c('0x3'));var db=require(_0xff2c('0x4'))['db'];var utils=require(_0xff2c('0x5'));var logger=require(_0xff2c('0x6'))(_0xff2c('0x7'));var config=require(_0xff2c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xff2c('0x9')][_0xff2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ba3d,_0x21c5a5,_0x223a86){return new BPromise(function(_0x105f4d,_0x7ba107){return client[_0xff2c('0xb')](_0x57ba3d,_0x223a86)[_0xff2c('0xc')](function(_0x133ee9){logger['info'](_0xff2c('0xd'),_0x21c5a5,_0xff2c('0xe'));logger[_0xff2c('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x21c5a5,_0xff2c('0xe'),JSON[_0xff2c('0x10')](_0x133ee9));if(_0x133ee9[_0xff2c('0x11')]){if(_0x133ee9['error']['code']===0x1f4){logger[_0xff2c('0x11')](_0xff2c('0xd'),_0x21c5a5,_0x133ee9['error'][_0xff2c('0x12')]);return _0x7ba107(_0x133ee9['error']['message']);}logger[_0xff2c('0x11')](_0xff2c('0xd'),_0x21c5a5,_0x133ee9[_0xff2c('0x11')][_0xff2c('0x12')]);return _0x105f4d(_0x133ee9['error'][_0xff2c('0x12')]);}else{logger['info'](_0xff2c('0xd'),_0x21c5a5,_0xff2c('0xe'));_0x105f4d(_0x133ee9['result']['message']);}})['catch'](function(_0x31cec8){logger[_0xff2c('0x11')](_0xff2c('0xd'),_0x21c5a5,_0x31cec8);_0x7ba107(_0x31cec8);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index f73e13b..368c837 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 _0x5cfa=['create','/:id','delete','destroy','exports','multer','path','../../config/environment','./pause.controller','isAuthenticated','index','get','show','post'];(function(_0x379796,_0x28f3df){var _0x4f927d=function(_0x52603f){while(--_0x52603f){_0x379796['push'](_0x379796['shift']());}};_0x4f927d(++_0x28f3df);}(_0x5cfa,0x12b));var _0xa5cf=function(_0x5cb91e,_0x5d017c){_0x5cb91e=_0x5cb91e-0x0;var _0x1f53e3=_0x5cfa[_0x5cb91e];return _0x1f53e3;};'use strict';var multer=require(_0xa5cf('0x0'));var util=require('util');var path=require(_0xa5cf('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('../../components/interaction/service');var config=require(_0xa5cf('0x2'));var controller=require(_0xa5cf('0x3'));router['get']('/',auth[_0xa5cf('0x4')](),controller[_0xa5cf('0x5')]);router[_0xa5cf('0x6')]('/:id',auth[_0xa5cf('0x4')](),controller[_0xa5cf('0x7')]);router[_0xa5cf('0x8')]('/',auth[_0xa5cf('0x4')](),controller[_0xa5cf('0x9')]);router['put'](_0xa5cf('0xa'),auth[_0xa5cf('0x4')](),controller['update']);router[_0xa5cf('0xb')]('/:id',auth[_0xa5cf('0x4')](),controller[_0xa5cf('0xc')]);module[_0xa5cf('0xd')]=router; \ No newline at end of file +var _0xe3d1=['./pause.controller','get','/:id','show','post','isAuthenticated','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x30130f,_0x312be7){var _0x31b3e1=function(_0x1df83f){while(--_0x1df83f){_0x30130f['push'](_0x30130f['shift']());}};_0x31b3e1(++_0x312be7);}(_0xe3d1,0x114));var _0x1e3d=function(_0xc14df7,_0x163f90){_0xc14df7=_0xc14df7-0x0;var _0x34a445=_0xe3d1[_0xc14df7];return _0x34a445;};'use strict';var multer=require(_0x1e3d('0x0'));var util=require(_0x1e3d('0x1'));var path=require(_0x1e3d('0x2'));var timeout=require(_0x1e3d('0x3'));var express=require(_0x1e3d('0x4'));var router=express[_0x1e3d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1e3d('0x6'));var interaction=require(_0x1e3d('0x7'));var config=require(_0x1e3d('0x8'));var controller=require(_0x1e3d('0x9'));router[_0x1e3d('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1e3d('0xa')](_0x1e3d('0xb'),auth['isAuthenticated'](),controller[_0x1e3d('0xc')]);router[_0x1e3d('0xd')]('/',auth[_0x1e3d('0xe')](),controller[_0x1e3d('0xf')]);router['put'](_0x1e3d('0xb'),auth[_0x1e3d('0xe')](),controller[_0x1e3d('0x10')]);router[_0x1e3d('0x11')](_0x1e3d('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1e3d('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index ba06b42..4c48ca7 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 _0x2ea7=['exports','name'];(function(_0x293157,_0x5cb61a){var _0x2bf38e=function(_0x3d849d){while(--_0x3d849d){_0x293157['push'](_0x293157['shift']());}};_0x2bf38e(++_0x5cb61a);}(_0x2ea7,0x112));var _0x72ea=function(_0x746739,_0x289561){_0x746739=_0x746739-0x0;var _0x4b7447=_0x2ea7[_0x746739];return _0x4b7447;};'use strict';var Sequelize=require('sequelize');module[_0x72ea('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x72ea('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x72e3=['exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x72e3,0x171));var _0x372e=function(_0x24ce66,_0x16b922){_0x24ce66=_0x24ce66-0x0;var _0x2ed386=_0x72e3[_0x24ce66];return _0x2ed386;};'use strict';var Sequelize=require('sequelize');module[_0x372e('0x0')]={'name':{'type':Sequelize[_0x372e('0x1')],'unique':_0x372e('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x372e('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 4396f93..4d27ba4 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 _0x8dbc=['../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','VIRTUAL','options','where','Pause','includeAll','include','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis'];(function(_0x5b069c,_0x4b88cf){var _0x4313aa=function(_0x5b075f){while(--_0x5b075f){_0x5b069c['push'](_0x5b069c['shift']());}};_0x4313aa(++_0x4b88cf);}(_0x8dbc,0x1ee));var _0xc8db=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x8dbc[_0x4d07cc];return _0x42de3b;};'use strict';var emlformat=require(_0xc8db('0x0'));var rimraf=require(_0xc8db('0x1'));var zipdir=require(_0xc8db('0x2'));var jsonpatch=require(_0xc8db('0x3'));var rp=require(_0xc8db('0x4'));var moment=require(_0xc8db('0x5'));var BPromise=require(_0xc8db('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc8db('0x7'));var sox=require('sox');var csv=require(_0xc8db('0x8'));var ejs=require(_0xc8db('0x9'));var fs=require('fs');var fs_extra=require(_0xc8db('0xa'));var _=require(_0xc8db('0xb'));var squel=require('squel');var crypto=require(_0xc8db('0xc'));var jsforce=require(_0xc8db('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc8db('0x8'));var querystring=require(_0xc8db('0xe'));var Papa=require('papaparse');var Redis=require(_0xc8db('0xf'));var authService=require(_0xc8db('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc8db('0x11'));var logger=require(_0xc8db('0x12'))(_0xc8db('0x13'));var utils=require(_0xc8db('0x14'));var config=require(_0xc8db('0x15'));var licenseUtil=require(_0xc8db('0x16'));var db=require(_0xc8db('0x17'))['db'];function respondWithStatusCode(_0x97878c,_0x4e28ca){_0x4e28ca=_0x4e28ca||0xcc;return function(_0x389476){if(_0x389476){return _0x97878c['sendStatus'](_0x4e28ca);}return _0x97878c['status'](_0x4e28ca)[_0xc8db('0x18')]();};}function respondWithResult(_0x416867,_0x11c1e9){_0x11c1e9=_0x11c1e9||0xc8;return function(_0x15299f){if(_0x15299f){return _0x416867[_0xc8db('0x19')](_0x11c1e9)[_0xc8db('0x1a')](_0x15299f);}};}function respondWithFilteredResult(_0x11a135,_0x21a285){return function(_0x4ad78e){if(_0x4ad78e){var _0x1f1f04=typeof _0x21a285[_0xc8db('0x1b')]===_0xc8db('0x1c')&&typeof _0x21a285[_0xc8db('0x1d')]===_0xc8db('0x1c');var _0x183278=_0x4ad78e[_0xc8db('0x1e')];var _0x47df96=_0x1f1f04?0x0:_0x21a285[_0xc8db('0x1b')];var _0x3f2b7f=_0x1f1f04?_0x4ad78e['count']:_0x21a285[_0xc8db('0x1b')]+_0x21a285['limit'];var _0x2fd887;if(_0x3f2b7f>=_0x183278){_0x3f2b7f=_0x183278;_0x2fd887=0xc8;}else{_0x2fd887=0xce;}_0x11a135[_0xc8db('0x19')](_0x2fd887);return _0x11a135[_0xc8db('0x1f')](_0xc8db('0x20'),_0x47df96+'-'+_0x3f2b7f+'/'+_0x183278)[_0xc8db('0x1a')](_0x4ad78e);}return null;};}function patchUpdates(_0x251c21){return function(_0x5a427a){try{jsonpatch[_0xc8db('0x21')](_0x5a427a,_0x251c21,!![]);}catch(_0x48eb96){return BPromise[_0xc8db('0x22')](_0x48eb96);}return _0x5a427a[_0xc8db('0x23')]();};}function saveUpdates(_0x3f609b,_0x181457){return function(_0x2f755c){if(_0x2f755c){return _0x2f755c[_0xc8db('0x24')](_0x3f609b)[_0xc8db('0x25')](function(_0x3029fa){return _0x3029fa;});}return null;};}function removeEntity(_0x3ab719,_0x48c0b6){return function(_0x3dd4a0){if(_0x3dd4a0){return _0x3dd4a0[_0xc8db('0x26')]()[_0xc8db('0x25')](function(){var _0x44f019=_0x3dd4a0[_0xc8db('0x27')]({'plain':!![]});var _0xaf2288=_0xc8db('0x28');return db[_0xc8db('0x29')][_0xc8db('0x26')]({'where':{'type':_0xaf2288,'resourceId':_0x44f019['id']}})[_0xc8db('0x25')](function(){return _0x3dd4a0;});})[_0xc8db('0x25')](function(){_0x3ab719[_0xc8db('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x454202,_0x311757){return function(_0x4b678e){if(!_0x4b678e){_0x454202[_0xc8db('0x2a')](0x194);}return _0x4b678e;};}function handleError(_0x3e568c,_0x318837){_0x318837=_0x318837||0x1f4;return function(_0x2d1858){logger[_0xc8db('0x2b')](_0x2d1858[_0xc8db('0x2c')]);if(_0x2d1858[_0xc8db('0x2d')]){delete _0x2d1858[_0xc8db('0x2d')];}_0x3e568c['status'](_0x318837)[_0xc8db('0x2e')](_0x2d1858);};}exports[_0xc8db('0x2f')]=function(_0xd693d9,_0x20419d){var _0x557999={},_0x3e3aa1={},_0x1a62a7={'count':0x0,'rows':[]};var _0x575d52=_[_0xc8db('0x30')](db['Pause'][_0xc8db('0x31')],function(_0x43fa51){return{'name':_0x43fa51[_0xc8db('0x32')],'type':_0x43fa51['type'][_0xc8db('0x33')]};});_0x3e3aa1['model']=_['map'](_0x575d52,_0xc8db('0x2d'));_0x3e3aa1[_0xc8db('0x34')]=_['keys'](_0xd693d9[_0xc8db('0x34')]);_0x3e3aa1['filters']=_['intersection'](_0x3e3aa1[_0xc8db('0x35')],_0x3e3aa1[_0xc8db('0x34')]);_0x557999[_0xc8db('0x36')]=_[_0xc8db('0x37')](_0x3e3aa1['model'],qs[_0xc8db('0x38')](_0xd693d9['query']['fields']));_0x557999[_0xc8db('0x36')]=_0x557999[_0xc8db('0x36')][_0xc8db('0x39')]?_0x557999[_0xc8db('0x36')]:_0x3e3aa1[_0xc8db('0x35')];if(!_0xd693d9['query'][_0xc8db('0x3a')](_0xc8db('0x3b'))){_0x557999[_0xc8db('0x1d')]=qs[_0xc8db('0x1d')](_0xd693d9[_0xc8db('0x34')]['limit']);_0x557999[_0xc8db('0x1b')]=qs[_0xc8db('0x1b')](_0xd693d9[_0xc8db('0x34')][_0xc8db('0x1b')]);}_0x557999[_0xc8db('0x3c')]=qs['sort'](_0xd693d9['query'][_0xc8db('0x3d')]);_0x557999['where']=qs['filters'](_[_0xc8db('0x3e')](_0xd693d9[_0xc8db('0x34')],_0x3e3aa1[_0xc8db('0x3f')]),_0x575d52);if(_0xd693d9[_0xc8db('0x34')][_0xc8db('0x40')]){_0x557999['where']=_[_0xc8db('0x41')](_0x557999['where'],{'$or':_[_0xc8db('0x30')](_0x575d52,function(_0x3b62e3){if(_0x3b62e3['type']!==_0xc8db('0x42')){var _0x2d7f76={};_0x2d7f76[_0x3b62e3[_0xc8db('0x2d')]]={'$like':'%'+_0xd693d9['query'][_0xc8db('0x40')]+'%'};return _0x2d7f76;}})});}_0x557999=_[_0xc8db('0x41')]({},_0x557999,_0xd693d9[_0xc8db('0x43')]);var _0x482b86={'where':_0x557999[_0xc8db('0x44')]};return db[_0xc8db('0x45')][_0xc8db('0x1e')](_0x482b86)['then'](function(_0x12afe3){_0x1a62a7[_0xc8db('0x1e')]=_0x12afe3;if(_0xd693d9[_0xc8db('0x34')][_0xc8db('0x46')]){_0x557999[_0xc8db('0x47')]=[{'all':!![]}];}return db[_0xc8db('0x45')]['findAll'](_0x557999);})[_0xc8db('0x25')](function(_0x4be5c1){_0x1a62a7[_0xc8db('0x48')]=_0x4be5c1;return _0x1a62a7;})['then'](respondWithFilteredResult(_0x20419d,_0x557999))[_0xc8db('0x49')](handleError(_0x20419d,null));};exports['show']=function(_0x50537b,_0x172fa4){var _0x2e8aae={'raw':!![],'where':{'id':_0x50537b[_0xc8db('0x4a')]['id']}},_0x614696={};_0x614696[_0xc8db('0x35')]=_[_0xc8db('0x4b')](db[_0xc8db('0x45')][_0xc8db('0x31')]);_0x614696[_0xc8db('0x34')]=_['keys'](_0x50537b[_0xc8db('0x34')]);_0x614696[_0xc8db('0x3f')]=_['intersection'](_0x614696[_0xc8db('0x35')],_0x614696[_0xc8db('0x34')]);_0x2e8aae['attributes']=_[_0xc8db('0x37')](_0x614696['model'],qs[_0xc8db('0x38')](_0x50537b[_0xc8db('0x34')][_0xc8db('0x38')]));_0x2e8aae['attributes']=_0x2e8aae['attributes'][_0xc8db('0x39')]?_0x2e8aae['attributes']:_0x614696[_0xc8db('0x35')];if(_0x50537b[_0xc8db('0x34')]['includeAll']){_0x2e8aae[_0xc8db('0x47')]=[{'all':!![]}];}_0x2e8aae=_[_0xc8db('0x41')]({},_0x2e8aae,_0x50537b[_0xc8db('0x43')]);return db[_0xc8db('0x45')][_0xc8db('0x4c')](_0x2e8aae)[_0xc8db('0x25')](handleEntityNotFound(_0x172fa4,null))[_0xc8db('0x25')](respondWithResult(_0x172fa4,null))[_0xc8db('0x49')](handleError(_0x172fa4,null));};exports['create']=function(_0x21b760,_0x3c3d67){return db['Pause'][_0xc8db('0x4d')](_0x21b760[_0xc8db('0x4e')],{})[_0xc8db('0x25')](function(_0x5eff48){var _0x31ad25=_0x21b760[_0xc8db('0x4f')][_0xc8db('0x27')]({'plain':!![]});if(!_0x31ad25)throw new Error(_0xc8db('0x50'));if(_0x31ad25[_0xc8db('0x51')]==='user'){var _0x1db783=_0x5eff48['get']({'plain':!![]});var _0x587d8d=_0xc8db('0x28');return db[_0xc8db('0x52')]['find']({'where':{'name':_0x587d8d,'userProfileId':_0x31ad25['userProfileId']},'raw':!![]})['then'](function(_0x14b29b){if(_0x14b29b&&_0x14b29b[_0xc8db('0x53')]===0x0){return db[_0xc8db('0x29')][_0xc8db('0x4d')]({'name':_0x1db783[_0xc8db('0x2d')],'resourceId':_0x1db783['id'],'type':_0x14b29b[_0xc8db('0x2d')],'sectionId':_0x14b29b['id']},{})[_0xc8db('0x25')](function(){return _0x5eff48;});}else{return _0x5eff48;}})['catch'](function(_0x152793){logger[_0xc8db('0x2b')](_0xc8db('0x54'),_0x152793);throw _0x152793;});}return _0x5eff48;})['then'](respondWithResult(_0x3c3d67,0xc9))[_0xc8db('0x49')](handleError(_0x3c3d67,null));};exports[_0xc8db('0x24')]=function(_0x15f4e7,_0x38206b){if(_0x15f4e7['body']['id']){delete _0x15f4e7[_0xc8db('0x4e')]['id'];}return db['Pause'][_0xc8db('0x4c')]({'where':{'id':_0x15f4e7[_0xc8db('0x4a')]['id']}})[_0xc8db('0x25')](handleEntityNotFound(_0x38206b,null))[_0xc8db('0x25')](saveUpdates(_0x15f4e7[_0xc8db('0x4e')],null))[_0xc8db('0x25')](respondWithResult(_0x38206b,null))[_0xc8db('0x49')](handleError(_0x38206b,null));};exports['destroy']=function(_0x1c70f9,_0x15cc0f){return db[_0xc8db('0x45')][_0xc8db('0x4c')]({'where':{'id':_0x1c70f9[_0xc8db('0x4a')]['id']}})[_0xc8db('0x25')](handleEntityNotFound(_0x15cc0f,null))['then'](removeEntity(_0x15cc0f,null))['catch'](handleError(_0x15cc0f,null));}; \ No newline at end of file +var _0x646b=['sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','rawAttributes','include','find','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Pauses','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','Pause','fieldName','type','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0x3b1e6f,_0x17cdea){var _0x6bb946=function(_0x4915e2){while(--_0x4915e2){_0x3b1e6f['push'](_0x3b1e6f['shift']());}};_0x6bb946(++_0x17cdea);}(_0x646b,0xb9));var _0xb646=function(_0x4b2251,_0x393f10){_0x4b2251=_0x4b2251-0x0;var _0x5d22fb=_0x646b[_0x4b2251];return _0x5d22fb;};'use strict';var emlformat=require(_0xb646('0x0'));var rimraf=require(_0xb646('0x1'));var zipdir=require(_0xb646('0x2'));var jsonpatch=require(_0xb646('0x3'));var rp=require(_0xb646('0x4'));var moment=require('moment');var BPromise=require(_0xb646('0x5'));var Mustache=require(_0xb646('0x6'));var util=require(_0xb646('0x7'));var path=require(_0xb646('0x8'));var sox=require('sox');var csv=require(_0xb646('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb646('0xa'));var crypto=require(_0xb646('0xb'));var jsforce=require(_0xb646('0xc'));var deskjs=require(_0xb646('0xd'));var toCsv=require(_0xb646('0x9'));var querystring=require(_0xb646('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb646('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb646('0x10'));var logger=require(_0xb646('0x11'))(_0xb646('0x12'));var utils=require(_0xb646('0x13'));var config=require(_0xb646('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45f354,_0x12d1fa){_0x12d1fa=_0x12d1fa||0xcc;return function(_0x3a94f0){if(_0x3a94f0){return _0x45f354[_0xb646('0x15')](_0x12d1fa);}return _0x45f354[_0xb646('0x16')](_0x12d1fa)[_0xb646('0x17')]();};}function respondWithResult(_0x5e6327,_0x521984){_0x521984=_0x521984||0xc8;return function(_0x428b52){if(_0x428b52){return _0x5e6327[_0xb646('0x16')](_0x521984)[_0xb646('0x18')](_0x428b52);}};}function respondWithFilteredResult(_0x381795,_0x3a8b3e){return function(_0x21460d){if(_0x21460d){var _0x59e524=typeof _0x3a8b3e[_0xb646('0x19')]==='undefined'&&typeof _0x3a8b3e[_0xb646('0x1a')]===_0xb646('0x1b');var _0x4d4f9b=_0x21460d[_0xb646('0x1c')];var _0x183e44=_0x59e524?0x0:_0x3a8b3e[_0xb646('0x19')];var _0x22d863=_0x59e524?_0x21460d[_0xb646('0x1c')]:_0x3a8b3e[_0xb646('0x19')]+_0x3a8b3e[_0xb646('0x1a')];var _0xad81e5;if(_0x22d863>=_0x4d4f9b){_0x22d863=_0x4d4f9b;_0xad81e5=0xc8;}else{_0xad81e5=0xce;}_0x381795[_0xb646('0x16')](_0xad81e5);return _0x381795['set'](_0xb646('0x1d'),_0x183e44+'-'+_0x22d863+'/'+_0x4d4f9b)[_0xb646('0x18')](_0x21460d);}return null;};}function patchUpdates(_0x29304d){return function(_0x29adae){try{jsonpatch[_0xb646('0x1e')](_0x29adae,_0x29304d,!![]);}catch(_0x49e680){return BPromise[_0xb646('0x1f')](_0x49e680);}return _0x29adae[_0xb646('0x20')]();};}function saveUpdates(_0x216319,_0x14086d){return function(_0x3a58fb){if(_0x3a58fb){return _0x3a58fb[_0xb646('0x21')](_0x216319)[_0xb646('0x22')](function(_0x2cf561){return _0x2cf561;});}return null;};}function removeEntity(_0x500e65,_0x109275){return function(_0x163253){if(_0x163253){return _0x163253[_0xb646('0x23')]()[_0xb646('0x22')](function(){var _0x363a8e=_0x163253[_0xb646('0x24')]({'plain':!![]});var _0x559a85='Pauses';return db[_0xb646('0x25')]['destroy']({'where':{'type':_0x559a85,'resourceId':_0x363a8e['id']}})[_0xb646('0x22')](function(){return _0x163253;});})[_0xb646('0x22')](function(){_0x500e65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x496e02,_0x56c75f){return function(_0x10f59a){if(!_0x10f59a){_0x496e02[_0xb646('0x15')](0x194);}return _0x10f59a;};}function handleError(_0x5668eb,_0xbbc13a){_0xbbc13a=_0xbbc13a||0x1f4;return function(_0x232323){logger[_0xb646('0x26')](_0x232323['stack']);if(_0x232323[_0xb646('0x27')]){delete _0x232323[_0xb646('0x27')];}_0x5668eb['status'](_0xbbc13a)[_0xb646('0x28')](_0x232323);};}exports[_0xb646('0x29')]=function(_0x50b917,_0x26551a){var _0x201a76={},_0x16bb6c={},_0x1a08ff={'count':0x0,'rows':[]};var _0x50d3b0=_[_0xb646('0x2a')](db[_0xb646('0x2b')]['rawAttributes'],function(_0x1ce699){return{'name':_0x1ce699[_0xb646('0x2c')],'type':_0x1ce699[_0xb646('0x2d')]['key']};});_0x16bb6c[_0xb646('0x2e')]=_['map'](_0x50d3b0,'name');_0x16bb6c['query']=_[_0xb646('0x2f')](_0x50b917[_0xb646('0x30')]);_0x16bb6c['filters']=_[_0xb646('0x31')](_0x16bb6c[_0xb646('0x2e')],_0x16bb6c[_0xb646('0x30')]);_0x201a76['attributes']=_[_0xb646('0x31')](_0x16bb6c[_0xb646('0x2e')],qs['fields'](_0x50b917['query'][_0xb646('0x32')]));_0x201a76[_0xb646('0x33')]=_0x201a76[_0xb646('0x33')]['length']?_0x201a76[_0xb646('0x33')]:_0x16bb6c[_0xb646('0x2e')];if(!_0x50b917['query'][_0xb646('0x34')](_0xb646('0x35'))){_0x201a76['limit']=qs['limit'](_0x50b917[_0xb646('0x30')][_0xb646('0x1a')]);_0x201a76[_0xb646('0x19')]=qs[_0xb646('0x19')](_0x50b917[_0xb646('0x30')]['offset']);}_0x201a76[_0xb646('0x36')]=qs['sort'](_0x50b917[_0xb646('0x30')][_0xb646('0x37')]);_0x201a76[_0xb646('0x38')]=qs[_0xb646('0x39')](_[_0xb646('0x3a')](_0x50b917[_0xb646('0x30')],_0x16bb6c['filters']),_0x50d3b0);if(_0x50b917[_0xb646('0x30')][_0xb646('0x3b')]){_0x201a76[_0xb646('0x38')]=_[_0xb646('0x3c')](_0x201a76[_0xb646('0x38')],{'$or':_[_0xb646('0x2a')](_0x50d3b0,function(_0x467955){if(_0x467955[_0xb646('0x2d')]!==_0xb646('0x3d')){var _0x3950da={};_0x3950da[_0x467955[_0xb646('0x27')]]={'$like':'%'+_0x50b917[_0xb646('0x30')][_0xb646('0x3b')]+'%'};return _0x3950da;}})});}_0x201a76=_[_0xb646('0x3c')]({},_0x201a76,_0x50b917['options']);var _0x15ada2={'where':_0x201a76[_0xb646('0x38')]};return db['Pause'][_0xb646('0x1c')](_0x15ada2)['then'](function(_0x287536){_0x1a08ff['count']=_0x287536;if(_0x50b917['query'][_0xb646('0x3e')]){_0x201a76['include']=[{'all':!![]}];}return db[_0xb646('0x2b')][_0xb646('0x3f')](_0x201a76);})[_0xb646('0x22')](function(_0x9ce863){_0x1a08ff[_0xb646('0x40')]=_0x9ce863;return _0x1a08ff;})['then'](respondWithFilteredResult(_0x26551a,_0x201a76))['catch'](handleError(_0x26551a,null));};exports['show']=function(_0x2ce1bf,_0x56ad70){var _0x236b5a={'raw':!![],'where':{'id':_0x2ce1bf['params']['id']}},_0x5d5dec={};_0x5d5dec['model']=_['keys'](db[_0xb646('0x2b')][_0xb646('0x41')]);_0x5d5dec[_0xb646('0x30')]=_['keys'](_0x2ce1bf['query']);_0x5d5dec[_0xb646('0x39')]=_[_0xb646('0x31')](_0x5d5dec['model'],_0x5d5dec[_0xb646('0x30')]);_0x236b5a[_0xb646('0x33')]=_[_0xb646('0x31')](_0x5d5dec[_0xb646('0x2e')],qs[_0xb646('0x32')](_0x2ce1bf[_0xb646('0x30')][_0xb646('0x32')]));_0x236b5a[_0xb646('0x33')]=_0x236b5a['attributes']['length']?_0x236b5a['attributes']:_0x5d5dec[_0xb646('0x2e')];if(_0x2ce1bf[_0xb646('0x30')]['includeAll']){_0x236b5a[_0xb646('0x42')]=[{'all':!![]}];}_0x236b5a=_[_0xb646('0x3c')]({},_0x236b5a,_0x2ce1bf['options']);return db['Pause'][_0xb646('0x43')](_0x236b5a)['then'](handleEntityNotFound(_0x56ad70,null))[_0xb646('0x22')](respondWithResult(_0x56ad70,null))[_0xb646('0x44')](handleError(_0x56ad70,null));};exports['create']=function(_0x44b1d5,_0x56a885){return db['Pause']['create'](_0x44b1d5[_0xb646('0x45')],{})['then'](function(_0x1a3577){var _0x1dd8ad=_0x44b1d5['user'][_0xb646('0x24')]({'plain':!![]});if(!_0x1dd8ad)throw new Error(_0xb646('0x46'));if(_0x1dd8ad[_0xb646('0x47')]===_0xb646('0x48')){var _0x4b2de8=_0x1a3577[_0xb646('0x24')]({'plain':!![]});var _0x2c4c95=_0xb646('0x49');return db[_0xb646('0x4a')][_0xb646('0x43')]({'where':{'name':_0x2c4c95,'userProfileId':_0x1dd8ad[_0xb646('0x4b')]},'raw':!![]})[_0xb646('0x22')](function(_0x35e44a){if(_0x35e44a&&_0x35e44a[_0xb646('0x4c')]===0x0){return db[_0xb646('0x25')][_0xb646('0x4d')]({'name':_0x4b2de8[_0xb646('0x27')],'resourceId':_0x4b2de8['id'],'type':_0x35e44a[_0xb646('0x27')],'sectionId':_0x35e44a['id']},{})[_0xb646('0x22')](function(){return _0x1a3577;});}else{return _0x1a3577;}})[_0xb646('0x44')](function(_0x20831e){logger[_0xb646('0x26')](_0xb646('0x4e'),_0x20831e);throw _0x20831e;});}return _0x1a3577;})[_0xb646('0x22')](respondWithResult(_0x56a885,0xc9))[_0xb646('0x44')](handleError(_0x56a885,null));};exports[_0xb646('0x21')]=function(_0x2f9e6b,_0x565897){if(_0x2f9e6b[_0xb646('0x45')]['id']){delete _0x2f9e6b[_0xb646('0x45')]['id'];}return db[_0xb646('0x2b')][_0xb646('0x43')]({'where':{'id':_0x2f9e6b[_0xb646('0x4f')]['id']}})['then'](handleEntityNotFound(_0x565897,null))[_0xb646('0x22')](saveUpdates(_0x2f9e6b[_0xb646('0x45')],null))[_0xb646('0x22')](respondWithResult(_0x565897,null))[_0xb646('0x44')](handleError(_0x565897,null));};exports[_0xb646('0x23')]=function(_0x4a486c,_0x57afa3){return db[_0xb646('0x2b')]['find']({'where':{'id':_0x4a486c[_0xb646('0x4f')]['id']}})[_0xb646('0x22')](handleEntityNotFound(_0x57afa3,null))[_0xb646('0x22')](removeEntity(_0x57afa3,null))[_0xb646('0x44')](handleError(_0x57afa3,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 5aebb5c..5adfb92 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x2c856a,_0x1b6cda){var _0x449bca=function(_0x437377){while(--_0x437377){_0x2c856a['push'](_0x2c856a['shift']());}};_0x449bca(++_0x1b6cda);}(_0xf494,0x1c6));var _0x4f49=function(_0x39a592,_0x41ec66){_0x39a592=_0x39a592-0x0;var _0x16e89d=_0xf494[_0x39a592];return _0x16e89d;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x43ba84,_0x5e9e8a){var _0x6ce444=function(_0x417446){while(--_0x417446){_0x43ba84['push'](_0x43ba84['shift']());}};_0x6ce444(++_0x5e9e8a);}(_0x53ec,0x192));var _0xc53e=function(_0x4d394d,_0x40e7b3){_0x4d394d=_0x4d394d-0x0;var _0x4f0003=_0x53ec[_0x4d394d];return _0x4f0003;};'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 be5f773..7ff9727 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(_0x321dea,_0x2e0d2b){var _0xeedd54=function(_0x43bf32){while(--_0x43bf32){_0x321dea['push'](_0x321dea['shift']());}};_0xeedd54(++_0x2e0d2b);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ab13e,_0x44507a){_0x1ab13e=_0x1ab13e-0x0;var _0xa28f8=_0xb10b[_0x1ab13e];return _0xa28f8;};'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(_0x4f1cb1,_0x795571){var _0x27e842=function(_0x348344){while(--_0x348344){_0x4f1cb1['push'](_0x4f1cb1['shift']());}};_0x27e842(++_0x795571);}(_0x7a54,0x106));var _0x47a5=function(_0x43968b,_0x4c6f27){_0x43968b=_0x43968b-0x0;var _0x4b2f76=_0x7a54[_0x43968b];return _0x4b2f76;};'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 41db941..9378351 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 _0xf72b=['./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','download','join','root','server/files/plugins','originalname','replace','%s-%s%s','now','extname','post','single','upload','webhookPost','put','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xf72b,0x1d9));var _0xbf72=function(_0x4dc9ae,_0x362ed1){_0x4dc9ae=_0x4dc9ae-0x0;var _0x3cb50e=_0xf72b[_0x4dc9ae];return _0x3cb50e;};'use strict';var multer=require(_0xbf72('0x0'));var util=require('util');var path=require(_0xbf72('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf72('0x2'));var router=express[_0xbf72('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbf72('0x4'));var interaction=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var controller=require(_0xbf72('0x7'));router[_0xbf72('0x8')]('/',auth[_0xbf72('0x9')](),controller['index']);router[_0xbf72('0x8')](_0xbf72('0xa'),controller[_0xbf72('0xb')]);router[_0xbf72('0x8')](_0xbf72('0xc'),auth[_0xbf72('0x9')](),controller['show']);router[_0xbf72('0x8')]('/:id/download',auth[_0xbf72('0x9')](),controller[_0xbf72('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xaec095,_0x1c3453,_0x1853eb){_0x1853eb(null,path[_0xbf72('0xe')](config[_0xbf72('0xf')],_0xbf72('0x10')));},'filename':function(_0x14f6e6,_0x5eb4cc,_0x5967f5){_0x5eb4cc[_0xbf72('0x11')]=_0x5eb4cc[_0xbf72('0x11')][_0xbf72('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5967f5(null,util['format'](_0xbf72('0x13'),path['basename'](_0x5eb4cc['originalname'],path['extname'](_0x5eb4cc[_0xbf72('0x11')])),Date[_0xbf72('0x14')](),path[_0xbf72('0x15')](_0x5eb4cc[_0xbf72('0x11')])));}})});router[_0xbf72('0x16')]('/',upload[_0xbf72('0x17')]('file'),controller[_0xbf72('0x18')]);router[_0xbf72('0x16')](_0xbf72('0xa'),controller[_0xbf72('0x19')]);router[_0xbf72('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xbf72('0x1b')]);router[_0xbf72('0x1c')](_0xbf72('0xc'),auth[_0xbf72('0x9')](),controller[_0xbf72('0x1c')]);module[_0xbf72('0x1d')]=router; \ No newline at end of file +var _0x9f62=['extname','now','post','single','file','upload','put','/:id','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id/download','isAuthenticated','join','root','originalname','replace','format','%s-%s%s','basename'];(function(_0x48600e,_0x3eebbe){var _0x92bf52=function(_0x5df117){while(--_0x5df117){_0x48600e['push'](_0x48600e['shift']());}};_0x92bf52(++_0x3eebbe);}(_0x9f62,0x154));var _0x29f6=function(_0x37515e,_0x2a3970){_0x37515e=_0x37515e-0x0;var _0x4e10d4=_0x9f62[_0x37515e];return _0x4e10d4;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var controller=require(_0x29f6('0x6'));router[_0x29f6('0x7')]('/',auth['isAuthenticated'](),controller[_0x29f6('0x8')]);router[_0x29f6('0x7')](_0x29f6('0x9'),controller[_0x29f6('0xa')]);router[_0x29f6('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x29f6('0xb'),auth[_0x29f6('0xc')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29b3f5,_0x442623,_0x4909e0){_0x4909e0(null,path[_0x29f6('0xd')](config[_0x29f6('0xe')],'server/files/plugins'));},'filename':function(_0x5b9b6a,_0x559585,_0x57b2d2){_0x559585[_0x29f6('0xf')]=_0x559585[_0x29f6('0xf')][_0x29f6('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57b2d2(null,util[_0x29f6('0x11')](_0x29f6('0x12'),path[_0x29f6('0x13')](_0x559585[_0x29f6('0xf')],path[_0x29f6('0x14')](_0x559585[_0x29f6('0xf')])),Date[_0x29f6('0x15')](),path[_0x29f6('0x14')](_0x559585[_0x29f6('0xf')])));}})});router[_0x29f6('0x16')]('/',upload[_0x29f6('0x17')](_0x29f6('0x18')),controller[_0x29f6('0x19')]);router[_0x29f6('0x16')]('/webhook',controller['webhookPost']);router[_0x29f6('0x1a')](_0x29f6('0x1b'),auth[_0x29f6('0xc')](),controller['update']);router[_0x29f6('0x1c')](_0x29f6('0x1b'),auth['isAuthenticated'](),controller[_0x29f6('0x1c')]);module[_0x29f6('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 e7c639d..29d17eb 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 _0x21d0=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','never','always'];(function(_0x5c623c,_0x14f57){var _0x509d5d=function(_0x507c1b){while(--_0x507c1b){_0x5c623c['push'](_0x5c623c['shift']());}};_0x509d5d(++_0x14f57);}(_0x21d0,0x1bb));var _0x021d=function(_0x32ad52,_0x3867b7){_0x32ad52=_0x32ad52-0x0;var _0xd4d3d3=_0x21d0[_0x32ad52];return _0xd4d3d3;};'use strict';var Sequelize=require(_0x021d('0x0'));module[_0x021d('0x1')]={'name':{'type':Sequelize[_0x021d('0x2')]},'type':{'type':Sequelize[_0x021d('0x3')](_0x021d('0x4'),_0x021d('0x5'))},'description':{'type':Sequelize[_0x021d('0x6')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x021d('0x2')],'comment':_0x021d('0x7')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x021d('0x3')](_0x021d('0x8'),_0x021d('0x9'),'always',_0x021d('0xa')),'defaultValue':_0x021d('0xb'),'comment':_0x021d('0xc')},'icon':{'type':Sequelize[_0x021d('0x2')]},'adminUrl':{'type':Sequelize[_0x021d('0x2')]},'agentUrl':{'type':Sequelize[_0x021d('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x021d('0x2')]}}; \ No newline at end of file +var _0x9cc3=['script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html'];(function(_0x4c3ffe,_0x457374){var _0x28d3eb=function(_0x3ae2a3){while(--_0x3ae2a3){_0x4c3ffe['push'](_0x4c3ffe['shift']());}};_0x28d3eb(++_0x457374);}(_0x9cc3,0x1a0));var _0x39cc=function(_0x2ba269,_0x19c7a1){_0x2ba269=_0x2ba269-0x0;var _0x50bf1b=_0x9cc3[_0x2ba269];return _0x50bf1b;};'use strict';var Sequelize=require(_0x39cc('0x0'));module[_0x39cc('0x1')]={'name':{'type':Sequelize[_0x39cc('0x2')]},'type':{'type':Sequelize['ENUM'](_0x39cc('0x3'),_0x39cc('0x4'))},'description':{'type':Sequelize[_0x39cc('0x5')]},'version':{'type':Sequelize[_0x39cc('0x5')]},'path':{'type':Sequelize[_0x39cc('0x2')],'comment':_0x39cc('0x6')},'active':{'type':Sequelize[_0x39cc('0x7')],'defaultValue':0x0,'comment':_0x39cc('0x8')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0x39cc('0x9'),_0x39cc('0xa'),'never'),'defaultValue':_0x39cc('0xa'),'comment':_0x39cc('0xb')},'icon':{'type':Sequelize[_0x39cc('0x2')]},'adminUrl':{'type':Sequelize[_0x39cc('0x2')]},'agentUrl':{'type':Sequelize[_0x39cc('0x2')]},'scriptName':{'type':Sequelize[_0x39cc('0x2')]},'scriptPath':{'type':Sequelize[_0x39cc('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 47a98ca..58c8083 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 _0x3644=['limit','sort','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','download','path','join','root','%s.zip','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','catch','filename','extname','file','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','body','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','endsWith','statusCode','webhookPost','content-type','eml-format','rimraf','moment','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x829616,_0x5d9318){var _0x35857a=function(_0x502cb9){while(--_0x502cb9){_0x829616['push'](_0x829616['shift']());}};_0x35857a(++_0x5d9318);}(_0x3644,0x1ba));var _0x4364=function(_0x103c76,_0x18e3f9){_0x103c76=_0x103c76-0x0;var _0x311140=_0x3644[_0x103c76];return _0x311140;};'use strict';var emlformat=require(_0x4364('0x0'));var rimraf=require(_0x4364('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4364('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4364('0x3'));var util=require('util');var path=require('path');var sox=require(_0x4364('0x4'));var csv=require(_0x4364('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4364('0x6'));var _=require(_0x4364('0x7'));var squel=require(_0x4364('0x8'));var crypto=require(_0x4364('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4364('0xa'));var toCsv=require(_0x4364('0x5'));var querystring=require(_0x4364('0xb'));var Papa=require(_0x4364('0xc'));var extract=require(_0x4364('0xd'));var rimraf=require(_0x4364('0x1'));var archiver=require(_0x4364('0xe'));var Redis=require(_0x4364('0xf'));var authService=require(_0x4364('0x10'));var qs=require(_0x4364('0x11'));var as=require(_0x4364('0x12'));var hardwareService=require(_0x4364('0x13'));var logger=require(_0x4364('0x14'))('api');var utils=require(_0x4364('0x15'));var config=require(_0x4364('0x16'));var licenseUtil=require(_0x4364('0x17'));var db=require('../../mysqldb')['db'];config[_0x4364('0x18')]=_[_0x4364('0x19')](config[_0x4364('0x18')],{'host':_0x4364('0x1a'),'port':0x18eb});var socket=require(_0x4364('0x1b'))(new Redis(config[_0x4364('0x18')]));require(_0x4364('0x1c'))['register'](socket);function respondWithStatusCode(_0x389953,_0x33d1e8){_0x33d1e8=_0x33d1e8||0xcc;return function(_0x5d56b4){if(_0x5d56b4){return _0x389953[_0x4364('0x1d')](_0x33d1e8);}return _0x389953['status'](_0x33d1e8)[_0x4364('0x1e')]();};}function respondWithResult(_0x34ec76,_0x3622e1){_0x3622e1=_0x3622e1||0xc8;return function(_0x3c0479){if(_0x3c0479){return _0x34ec76[_0x4364('0x1f')](_0x3622e1)[_0x4364('0x20')](_0x3c0479);}};}function respondWithFilteredResult(_0x5c7548,_0x59fce3){return function(_0x4e8d5c){if(_0x4e8d5c){var _0xcfe550=typeof _0x59fce3['offset']==='undefined'&&typeof _0x59fce3['limit']===_0x4364('0x21');var _0x228548=_0x4e8d5c[_0x4364('0x22')];var _0x5ce598=_0xcfe550?0x0:_0x59fce3[_0x4364('0x23')];var _0x4d8b42=_0xcfe550?_0x4e8d5c[_0x4364('0x22')]:_0x59fce3[_0x4364('0x23')]+_0x59fce3['limit'];var _0x319dc1;if(_0x4d8b42>=_0x228548){_0x4d8b42=_0x228548;_0x319dc1=0xc8;}else{_0x319dc1=0xce;}_0x5c7548[_0x4364('0x1f')](_0x319dc1);return _0x5c7548[_0x4364('0x24')](_0x4364('0x25'),_0x5ce598+'-'+_0x4d8b42+'/'+_0x228548)['json'](_0x4e8d5c);}return null;};}function patchUpdates(_0x2ceefc){return function(_0x95d917){try{jsonpatch[_0x4364('0x26')](_0x95d917,_0x2ceefc,!![]);}catch(_0x21857d){return BPromise[_0x4364('0x27')](_0x21857d);}return _0x95d917[_0x4364('0x28')]();};}function saveUpdates(_0xf1a1c2,_0x953ea3){return function(_0x8114d2){if(_0x8114d2){return _0x8114d2[_0x4364('0x29')](_0xf1a1c2)['then'](function(_0x506682){return _0x506682;});}return null;};}function removeEntity(_0x448202,_0x5273fc){return function(_0xdccd34){if(_0xdccd34){return _0xdccd34[_0x4364('0x2a')]()['then'](function(){var _0x5bb91f=_0xdccd34[_0x4364('0x2b')]({'plain':!![]});var _0xc83a48='Plugins';return db[_0x4364('0x2c')]['destroy']({'where':{'type':_0xc83a48,'resourceId':_0x5bb91f['id']}})[_0x4364('0x2d')](function(){return _0xdccd34;});})['then'](function(){_0x448202[_0x4364('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x507012,_0x177da3){return function(_0x1da6dd){if(!_0x1da6dd){_0x507012[_0x4364('0x1d')](0x194);}return _0x1da6dd;};}function handleError(_0x57c051,_0x3393de){_0x3393de=_0x3393de||0x1f4;return function(_0xb26f57){logger[_0x4364('0x2e')](_0xb26f57[_0x4364('0x2f')]);if(_0xb26f57['name']){delete _0xb26f57[_0x4364('0x30')];}_0x57c051[_0x4364('0x1f')](_0x3393de)[_0x4364('0x31')](_0xb26f57);};}exports[_0x4364('0x32')]=function(_0x147fde,_0x22cafb){var _0x2cc5fc={},_0x25a993={},_0x25e243={'count':0x0,'rows':[]};var _0x2684ac=_[_0x4364('0x33')](db[_0x4364('0x34')][_0x4364('0x35')],function(_0x44d22d){return{'name':_0x44d22d[_0x4364('0x36')],'type':_0x44d22d['type'][_0x4364('0x37')]};});_0x25a993['model']=_['map'](_0x2684ac,_0x4364('0x30'));_0x25a993['query']=_['keys'](_0x147fde[_0x4364('0x38')]);_0x25a993[_0x4364('0x39')]=_[_0x4364('0x3a')](_0x25a993[_0x4364('0x3b')],_0x25a993['query']);_0x2cc5fc[_0x4364('0x3c')]=_['intersection'](_0x25a993[_0x4364('0x3b')],qs[_0x4364('0x3d')](_0x147fde[_0x4364('0x38')][_0x4364('0x3d')]));_0x2cc5fc['attributes']=_0x2cc5fc['attributes'][_0x4364('0x3e')]?_0x2cc5fc[_0x4364('0x3c')]:_0x25a993[_0x4364('0x3b')];if(!_0x147fde[_0x4364('0x38')][_0x4364('0x3f')](_0x4364('0x40'))){_0x2cc5fc['limit']=qs[_0x4364('0x41')](_0x147fde[_0x4364('0x38')]['limit']);_0x2cc5fc['offset']=qs[_0x4364('0x23')](_0x147fde[_0x4364('0x38')][_0x4364('0x23')]);}_0x2cc5fc['order']=qs[_0x4364('0x42')](_0x147fde['query'][_0x4364('0x42')]);_0x2cc5fc[_0x4364('0x43')]=qs[_0x4364('0x39')](_['pick'](_0x147fde[_0x4364('0x38')],_0x25a993[_0x4364('0x39')]),_0x2684ac);if(_0x147fde['query']['filter']){_0x2cc5fc[_0x4364('0x43')]=_[_0x4364('0x44')](_0x2cc5fc['where'],{'$or':_['map'](_0x2684ac,function(_0x3f28aa){if(_0x3f28aa[_0x4364('0x45')]!==_0x4364('0x46')){var _0x25bc10={};_0x25bc10[_0x3f28aa[_0x4364('0x30')]]={'$like':'%'+_0x147fde[_0x4364('0x38')]['filter']+'%'};return _0x25bc10;}})});}_0x2cc5fc=_[_0x4364('0x44')]({},_0x2cc5fc,_0x147fde[_0x4364('0x47')]);var _0x150316={'where':_0x2cc5fc[_0x4364('0x43')]};return db[_0x4364('0x34')][_0x4364('0x22')](_0x150316)[_0x4364('0x2d')](function(_0x4c0e96){_0x25e243[_0x4364('0x22')]=_0x4c0e96;if(_0x147fde['query'][_0x4364('0x48')]){_0x2cc5fc[_0x4364('0x49')]=[{'all':!![]}];}return db[_0x4364('0x34')][_0x4364('0x4a')](_0x2cc5fc);})['then'](function(_0x98a6a1){_0x25e243[_0x4364('0x4b')]=_0x98a6a1;return _0x25e243;})[_0x4364('0x2d')](respondWithFilteredResult(_0x22cafb,_0x2cc5fc))['catch'](handleError(_0x22cafb,null));};exports[_0x4364('0x4c')]=function(_0x18874a,_0x41f1fe){var _0xb9284f={'raw':!![],'where':{'id':_0x18874a[_0x4364('0x4d')]['id']}},_0x1aca9f={};_0x1aca9f[_0x4364('0x3b')]=_[_0x4364('0x4e')](db[_0x4364('0x34')][_0x4364('0x35')]);_0x1aca9f[_0x4364('0x38')]=_['keys'](_0x18874a['query']);_0x1aca9f[_0x4364('0x39')]=_['intersection'](_0x1aca9f[_0x4364('0x3b')],_0x1aca9f[_0x4364('0x38')]);_0xb9284f['attributes']=_[_0x4364('0x3a')](_0x1aca9f[_0x4364('0x3b')],qs[_0x4364('0x3d')](_0x18874a['query'][_0x4364('0x3d')]));_0xb9284f[_0x4364('0x3c')]=_0xb9284f['attributes'][_0x4364('0x3e')]?_0xb9284f[_0x4364('0x3c')]:_0x1aca9f[_0x4364('0x3b')];if(_0x18874a[_0x4364('0x38')]['includeAll']){_0xb9284f['include']=[{'all':!![]}];}_0xb9284f=_[_0x4364('0x44')]({},_0xb9284f,_0x18874a[_0x4364('0x47')]);return db['Plugin'][_0x4364('0x4f')](_0xb9284f)[_0x4364('0x2d')](handleEntityNotFound(_0x41f1fe,null))[_0x4364('0x2d')](respondWithResult(_0x41f1fe,null))['catch'](handleError(_0x41f1fe,null));};exports[_0x4364('0x50')]=function(_0x3b866d,_0x5f27b0,_0xb917a2){return db[_0x4364('0x34')]['find']({'where':{'id':_0x3b866d[_0x4364('0x4d')]['id']},'attributes':[_0x4364('0x30'),_0x4364('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x5f27b0,null))[_0x4364('0x2d')](function(_0x2e0de9){if(_0x2e0de9){var _0x19e6ee=path[_0x4364('0x52')](config[_0x4364('0x53')],'server/files/plugins',util['format'](_0x4364('0x54'),path[_0x4364('0x55')](_0x2e0de9[_0x4364('0x51')])));var _0x5e63e9=fs[_0x4364('0x56')](_0x19e6ee);var _0x5b2ca3=archiver(_0x4364('0x57'),{'zlib':{'level':0x9}});_0x5b2ca3['on'](_0x4364('0x58'),function(_0x4a3f38){if(_0x4a3f38['code']===_0x4364('0x59')){logger[_0x4364('0x2e')](_0x4a3f38);}else{throw new db[(_0x4364('0x5a'))][(_0x4364('0x5b'))](_0x4364('0x5c'));}});_0x5b2ca3['on'](_0x4364('0x2e'),function(_0x561c26){throw new db['Sequelize'][(_0x4364('0x5b'))](_0x4364('0x5c'));});_0x5b2ca3[_0x4364('0x5d')](_0x5e63e9);_0x5b2ca3['glob'](_0x4364('0x5e'),{'cwd':path[_0x4364('0x52')](config['root'],'server/files/plugins',path[_0x4364('0x5f')](_0x2e0de9[_0x4364('0x51')])),'ignore':[path[_0x4364('0x52')](path[_0x4364('0x55')](_0x2e0de9['path']),_0x4364('0x60')),path[_0x4364('0x52')](path[_0x4364('0x55')](_0x2e0de9[_0x4364('0x51')]),'attachments/**/*')],'nodir':!![]})[_0x4364('0x61')]();_0x5e63e9['on'](_0x4364('0x62'),function(){if(!fs[_0x4364('0x63')](_0x19e6ee)){throw new db[(_0x4364('0x5a'))][(_0x4364('0x5b'))](_0x4364('0x64'));}return _0x5f27b0[_0x4364('0x50')](_0x19e6ee,util[_0x4364('0x65')]('%s.zip',path['basename'](_0x2e0de9[_0x4364('0x51')])),function(_0x559611){if(_0x559611){throw new db[(_0x4364('0x5a'))]['Error'](_0x4364('0x66'));}fs[_0x4364('0x67')](_0x19e6ee);logger['info']('Download\x20completed');logger[_0x4364('0x68')]('Temporary\x20file\x20removed');});});}return null;})[_0x4364('0x69')](handleError(_0x5f27b0,null));};exports['upload']=function(_0x481e7e,_0x22a799,_0x11b1b1){var _0xba9e06=path[_0x4364('0x55')](_0x481e7e['file'][_0x4364('0x6a')],path[_0x4364('0x6b')](_0x481e7e[_0x4364('0x6c')][_0x4364('0x6a')]));var _0x22d08a=path[_0x4364('0x52')](config[_0x4364('0x53')],_0x4364('0x6d'),_0x481e7e[_0x4364('0x6c')][_0x4364('0x6a')]);var _0x5093c7=path[_0x4364('0x52')](config['root'],_0x4364('0x6d'),_0xba9e06);logger[_0x4364('0x68')](_0x4364('0x6e'),_0x22d08a);logger['info'](_0x4364('0x6f'),_0x5093c7);try{fs[_0x4364('0x70')](_0x22d08a,parseInt(_0x4364('0x71'),0x8));extract(_0x22d08a,{'dir':_0x5093c7},function(_0x250678){if(_0x250678){logger[_0x4364('0x2e')](_0x250678);handleError(_0x250678,!![]);};var _0x428ad1=fs['readdirSync'](_0x5093c7);if(_0x428ad1['length']>0x1){removeReferences(_0x22d08a,_0x5093c7);logger[_0x4364('0x2e')](_0x4364('0x72'));return _0x11b1b1(new Error(_0x4364('0x72')));}var _0x1f0ba0=fs[_0x4364('0x73')](path['join'](_0x5093c7,_0x428ad1[0x0]));if(_0x1f0ba0[_0x4364('0x74')]()){removeReferences(_0x22d08a,_0x5093c7);logger[_0x4364('0x2e')](_0x4364('0x72'));return _0x11b1b1(new Error(_0x4364('0x72')));}if(_0x1f0ba0[_0x4364('0x75')]()){var _0xa97677=fs['readdirSync'](path[_0x4364('0x52')](_0x5093c7,_0x428ad1[0x0]));if(_0xa97677[_0x4364('0x3e')]===0x0){removeReferences(_0x22d08a,_0x5093c7);logger[_0x4364('0x2e')](_0x4364('0x72'));return _0x11b1b1(new Error('Invalid\x20plugin\x20structure'));}var _0x48f62b=_0xa97677[_0x4364('0x76')](function(_0x123619){return _0x123619==='manifest.json';});if(!_0x48f62b){return _0x11b1b1(new Error(_0x4364('0x77')));}var _0x596cd5=fs['readFileSync'](path[_0x4364('0x52')](_0x5093c7,_0x428ad1[0x0],_0x4364('0x78')));var _0x3b51e8=JSON[_0x4364('0x79')](_0x596cd5);if('undefined'==typeof _0x3b51e8[_0x4364('0x30')]){return _0x11b1b1(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x4364('0x21')==typeof _0x3b51e8['type']){return _0x11b1b1(new Error(_0x4364('0x7a')));}if(_0x4364('0x21')==typeof _0x3b51e8[_0x4364('0x7b')]){return _0x11b1b1(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x4364('0x21')==typeof _0x3b51e8[_0x4364('0x7c')]){return _0x11b1b1(new Error(_0x4364('0x7d')));}if(_0x3b51e8['type']===_0x4364('0x7e')){if(_0x4364('0x21')==typeof _0x3b51e8[_0x4364('0x7c')]['views']){return _0x11b1b1(new Error(_0x4364('0x7f')));}if(_0x4364('0x21')==typeof _0x3b51e8[_0x4364('0x7c')][_0x4364('0x80')][_0x4364('0x81')]&&_0x4364('0x21')==typeof _0x3b51e8[_0x4364('0x7c')]['views'][_0x4364('0x82')]){return _0x11b1b1(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x3b51e8[_0x4364('0x45')]===_0x4364('0x83')){if(_0x4364('0x21')==typeof _0x3b51e8[_0x4364('0x7c')][_0x4364('0x84')]){return _0x11b1b1(new Error(_0x4364('0x85')));}if('undefined'==typeof _0x3b51e8[_0x4364('0x7c')][_0x4364('0x86')]){return _0x11b1b1(new Error(_0x4364('0x87')));}}else{return _0x11b1b1(new Error(_0x4364('0x88')));}var _0x59fc15=_0x3b51e8[_0x4364('0x30')];var _0x1f05cd=_0x3b51e8[_0x4364('0x89')];var _0x22c87a=_0x3b51e8[_0x4364('0x45')];var _0x2a9b6e=_0x3b51e8[_0x4364('0x8a')]?_0x3b51e8['sidebar']:_0x4364('0x8b');var _0x31dbe2=_0x3b51e8[_0x4364('0x8c')]?_0x3b51e8[_0x4364('0x8c')]:_0x4364('0x8d');var _0x1e0271='';var _0x369e91='';var _0x59ac19='';var _0x32a4e8='';var _0x5baa07=_0x3b51e8[_0x4364('0x7b')];if(_0x22c87a===_0x4364('0x7e')){if(_0x4364('0x21')!=typeof _0x3b51e8[_0x4364('0x7c')]['views']['admin']){var _0x53e2de=_0x3b51e8['parameters']['views'][_0x4364('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x4364('0x8e')](_0x53e2de)){_0x1e0271=path[_0x4364('0x52')](_0x4364('0x8f'),_0xba9e06,_0x428ad1[0x0],_0x53e2de);}else{_0x1e0271=_0x53e2de;}}else{logger[_0x4364('0x68')](_0x4364('0x90'));}if(_0x4364('0x21')!=typeof _0x3b51e8[_0x4364('0x7c')][_0x4364('0x80')][_0x4364('0x82')]){var _0x5df00b=_0x3b51e8[_0x4364('0x7c')][_0x4364('0x80')][_0x4364('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5df00b)){_0x369e91=path[_0x4364('0x52')](_0x4364('0x8f'),_0xba9e06,_0x428ad1[0x0],_0x5df00b);}else{_0x369e91=_0x5df00b;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x22c87a==='script'){_0x59ac19=_0x3b51e8[_0x4364('0x7c')][_0x4364('0x84')];_0x32a4e8=_0x3b51e8['parameters'][_0x4364('0x86')];if(_0x4364('0x21')!=typeof _0x3b51e8[_0x4364('0x7c')][_0x4364('0x80')]){if(_0x4364('0x21')!=typeof _0x3b51e8[_0x4364('0x7c')][_0x4364('0x80')][_0x4364('0x81')]){var _0x53e2de=_0x3b51e8[_0x4364('0x7c')][_0x4364('0x80')][_0x4364('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x4364('0x8e')](_0x53e2de)){_0x1e0271=path[_0x4364('0x52')](_0x4364('0x8f'),_0xba9e06,_0x428ad1[0x0],_0x53e2de);}else{_0x1e0271=_0x53e2de;}}if(_0x4364('0x21')!=typeof _0x3b51e8[_0x4364('0x7c')][_0x4364('0x80')][_0x4364('0x82')]){var _0x5df00b=_0x3b51e8[_0x4364('0x7c')][_0x4364('0x80')][_0x4364('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x4364('0x8e')](_0x5df00b)){_0x369e91=path[_0x4364('0x52')]('plugins',_0xba9e06,_0x428ad1[0x0],_0x5df00b);}else{_0x369e91=_0x5df00b;}}}}var _0x3df314={'name':_0x59fc15,'description':_0x1f05cd,'path':path['join'](_0xba9e06,_0x428ad1[0x0]),'type':_0x22c87a,'sidebar':_0x2a9b6e,'icon':_0x31dbe2,'adminUrl':_0x1e0271,'agentUrl':_0x369e91,'scriptName':_0x59ac19,'scriptPath':_0x32a4e8,'version':_0x5baa07};removeReferences(_0x22d08a,null);return db['Plugin'][_0x4364('0x91')](_0x3df314)[_0x4364('0x2d')](function(_0x35f0ce){var _0x494ff9={'role':_0x481e7e['body']['role'],'userProfileId':_0x481e7e['body'][_0x4364('0x92')]};if(!_0x494ff9)throw new Error(_0x4364('0x93'));if(_0x494ff9[_0x4364('0x94')]==='user'){var _0x2055de=_0x35f0ce[_0x4364('0x2b')]({'plain':!![]});return db[_0x4364('0x95')][_0x4364('0x4f')]({'where':{'name':'Plugins','userProfileId':_0x494ff9['userProfileId']},'raw':!![]})[_0x4364('0x2d')](function(_0x12fc4b){if(_0x12fc4b&&_0x12fc4b[_0x4364('0x96')]===0x0){return db[_0x4364('0x2c')][_0x4364('0x91')]({'name':_0x2055de[_0x4364('0x30')],'resourceId':_0x2055de['id'],'type':_0x12fc4b[_0x4364('0x30')],'sectionId':_0x12fc4b['id']},{})[_0x4364('0x2d')](function(){return _0x35f0ce;});}else{return _0x35f0ce;}})[_0x4364('0x69')](function(_0x3889bc){logger[_0x4364('0x2e')](_0x4364('0x97'),_0x3889bc);throw _0x3889bc;});}return _0x35f0ce;})[_0x4364('0x2d')](respondWithResult(_0x22a799,null))[_0x4364('0x69')](handleError(_0x22a799,null));}});}catch(_0x1480dd){_0x22a799[_0x4364('0x1f')](0x1f4)['send'](_0x1480dd);}};function removeReferences(_0x1eb18a,_0x5a7f93){try{if(_0x1eb18a){fs[_0x4364('0x67')](_0x1eb18a);logger['info'](_0x4364('0x98'));}if(_0x5a7f93){rimraf(_0x5a7f93,function(){});logger[_0x4364('0x68')]('Extracted\x20folder\x20removed');}}catch(_0x1fb65d){logger[_0x4364('0x2e')](_0x1fb65d);}}exports[_0x4364('0x29')]=function(_0x11c498,_0x4fde19,_0x1327d7){return db[_0x4364('0x34')][_0x4364('0x4f')]({'where':{'id':_0x11c498[_0x4364('0x4d')]['id']}})[_0x4364('0x2d')](handleEntityNotFound(_0x4fde19,null))[_0x4364('0x2d')](saveUpdates(_0x11c498[_0x4364('0x99')],null))['then'](respondWithResult(_0x4fde19,null))['catch'](handleError(_0x4fde19,null));};exports['delete']=function(_0x11adfb,_0x3b2265,_0x18d1cc){return db[_0x4364('0x34')]['find']({'where':{'id':_0x11adfb[_0x4364('0x4d')]['id']}})[_0x4364('0x2d')](function(_0x855284){if(_0x855284){return _0x855284['destroy']();}})[_0x4364('0x2d')](function(_0x1ec5cd){rimraf(path[_0x4364('0x52')](config[_0x4364('0x53')],'server/files/plugins',path[_0x4364('0x5f')](_0x1ec5cd[_0x4364('0x51')])),function(){});return _0x1ec5cd;})[_0x4364('0x2d')](handleEntityNotFound(_0x3b2265,null))[_0x4364('0x2d')](respondWithStatusCode(_0x3b2265,null))[_0x4364('0x69')](handleError(_0x3b2265,null));};exports['webhookGet']=function(_0x1ef14d,_0x1a9821,_0x51c95e){return BPromise[_0x4364('0x9a')]()[_0x4364('0x2d')](function(){if(!_0x1ef14d[_0x4364('0x38')][_0x4364('0x51')]){throw new Error(_0x4364('0x9b'));}if(!_0x1ef14d['query']['port']){throw new Error(_0x4364('0x9c'));}var _0x3efefc=_0x1ef14d[_0x4364('0x38')][_0x4364('0x9d')]?_0x1ef14d[_0x4364('0x38')][_0x4364('0x9d')]+':'+_0x1ef14d['query'][_0x4364('0x9e')]:_0x4364('0x9f')+_0x1ef14d[_0x4364('0x38')][_0x4364('0x9e')];var _0x21aa17=_0x1ef14d[_0x4364('0x38')][_0x4364('0x20')]?_0x1ef14d['query']['json']:!![];var _0x288264=_0x1ef14d[_0x4364('0x38')][_0x4364('0xa0')]?_0x1ef14d[_0x4364('0x38')][_0x4364('0xa0')]:null;var _0xf8482d={'method':_0x1ef14d[_0x4364('0xa1')],'uri':util[_0x4364('0x65')](_0x4364('0xa2'),_0x3efefc,_0x1ef14d['query'][_0x4364('0x51')]),'json':_0x21aa17,'resolveWithFullResponse':!![],'encoding':_0x288264,'qs':_0x1ef14d[_0x4364('0x38')]};if(_0x1ef14d[_0x4364('0xa3')]){_0xf8482d[_0x4364('0xa3')]=_0x1ef14d['headers'];if(_0xf8482d[_0x4364('0xa3')][_0x4364('0xa4')]){delete _0xf8482d[_0x4364('0xa3')][_0x4364('0xa4')];}}if(_0xf8482d[_0x4364('0xa3')]['content-type']){delete _0xf8482d[_0x4364('0xa3')]['content-type'];}return rp(_0xf8482d);})['then'](function(_0xe570bb){if(_0xe570bb){_0x1a9821[_0x4364('0x24')](_0xe570bb['headers']);logger['info'](_0xe570bb[_0x4364('0x99')]);if(_[_0x4364('0xa5')](_0x1ef14d['query'][_0x4364('0x51')],_0x4364('0x50'))&&_0xe570bb[_0x4364('0xa6')]==0x1f4){return _0x1a9821[_0x4364('0x1d')](_0xe570bb[_0x4364('0xa6')]);}else{return _0x1a9821[_0x4364('0x1f')](_0xe570bb[_0x4364('0xa6')])[_0x4364('0x31')](_0xe570bb['body']);}}else{return _0x1a9821['sendStatus'](0xc8);}})[_0x4364('0x69')](handleError(_0x1a9821,null));};exports[_0x4364('0xa7')]=function(_0x2436f1,_0x290ecb,_0x37bc07){return BPromise[_0x4364('0x9a')]()['then'](function(){if(!_0x2436f1[_0x4364('0x38')][_0x4364('0x51')]){throw new Error(_0x4364('0x9b'));}if(!_0x2436f1[_0x4364('0x38')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x257b74=_0x2436f1[_0x4364('0x38')][_0x4364('0x9d')]?_0x2436f1['query'][_0x4364('0x9d')]+':'+_0x2436f1[_0x4364('0x38')][_0x4364('0x9e')]:_0x4364('0x9f')+_0x2436f1['query'][_0x4364('0x9e')];var _0x57c240=_0x2436f1[_0x4364('0x38')]['json']?_0x2436f1[_0x4364('0x38')][_0x4364('0x20')]:!![];var _0x184df8=_0x2436f1['query']['encoding']?_0x2436f1['query'][_0x4364('0xa0')]:null;var _0x17d3c6={'method':_0x2436f1['method'],'uri':util[_0x4364('0x65')]('%s%s',_0x257b74,_0x2436f1['query'][_0x4364('0x51')]),'json':_0x57c240,'resolveWithFullResponse':!![],'encoding':_0x184df8,'body':_0x2436f1[_0x4364('0x99')]};if(_0x2436f1[_0x4364('0xa3')]){_0x17d3c6[_0x4364('0xa3')]=_0x2436f1[_0x4364('0xa3')];if(_0x17d3c6[_0x4364('0xa3')][_0x4364('0xa4')]){delete _0x17d3c6[_0x4364('0xa3')][_0x4364('0xa4')];}}if(_0x17d3c6[_0x4364('0xa3')][_0x4364('0xa8')]){delete _0x17d3c6['headers'][_0x4364('0xa8')];}return rp(_0x17d3c6);})[_0x4364('0x2d')](function(_0x508ba2){if(_0x508ba2){_0x290ecb[_0x4364('0x24')](_0x508ba2[_0x4364('0xa3')]);logger[_0x4364('0x68')](_0x508ba2[_0x4364('0x99')]);return _0x290ecb['status'](_0x508ba2['statusCode'])[_0x4364('0x31')](_0x508ba2['body']);}else{return _0x290ecb[_0x4364('0x1d')](0xc8);}})[_0x4364('0x69')](handleError(_0x290ecb,null));}; \ No newline at end of file +var _0x2a3b=['get','UserProfileResource','destroy','stack','name','map','Plugin','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','download','join','root','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','upload','file','filename','extname','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','Invalid\x20manifest:\x20views\x20missing','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','icon','icon-apps','html','views','admin','test','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','script','plugins','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','encoding','method','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','hostname','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x2a3b,0x1c1));var _0xb2a3=function(_0x63000d,_0x5a93ab){_0x63000d=_0x63000d-0x0;var _0x1e70cc=_0x2a3b[_0x63000d];return _0x1e70cc;};'use strict';var emlformat=require(_0xb2a3('0x0'));var rimraf=require(_0xb2a3('0x1'));var zipdir=require(_0xb2a3('0x2'));var jsonpatch=require(_0xb2a3('0x3'));var rp=require('request-promise');var moment=require(_0xb2a3('0x4'));var BPromise=require(_0xb2a3('0x5'));var Mustache=require(_0xb2a3('0x6'));var util=require(_0xb2a3('0x7'));var path=require(_0xb2a3('0x8'));var sox=require(_0xb2a3('0x9'));var csv=require(_0xb2a3('0xa'));var ejs=require(_0xb2a3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2a3('0xc'));var squel=require(_0xb2a3('0xd'));var crypto=require(_0xb2a3('0xe'));var jsforce=require(_0xb2a3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb2a3('0x10'));var Papa=require(_0xb2a3('0x11'));var extract=require(_0xb2a3('0x12'));var rimraf=require('rimraf');var archiver=require(_0xb2a3('0x13'));var Redis=require('ioredis');var authService=require(_0xb2a3('0x14'));var qs=require(_0xb2a3('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb2a3('0x16'));var logger=require(_0xb2a3('0x17'))('api');var utils=require(_0xb2a3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb2a3('0x19'));var db=require(_0xb2a3('0x1a'))['db'];config[_0xb2a3('0x1b')]=_[_0xb2a3('0x1c')](config['redis'],{'host':_0xb2a3('0x1d'),'port':0x18eb});var socket=require(_0xb2a3('0x1e'))(new Redis(config[_0xb2a3('0x1b')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x1dd967,_0x18b5e1){_0x18b5e1=_0x18b5e1||0xcc;return function(_0x4b0cca){if(_0x4b0cca){return _0x1dd967[_0xb2a3('0x1f')](_0x18b5e1);}return _0x1dd967[_0xb2a3('0x20')](_0x18b5e1)[_0xb2a3('0x21')]();};}function respondWithResult(_0x1b93f2,_0x327fdd){_0x327fdd=_0x327fdd||0xc8;return function(_0x3d3f8b){if(_0x3d3f8b){return _0x1b93f2[_0xb2a3('0x20')](_0x327fdd)[_0xb2a3('0x22')](_0x3d3f8b);}};}function respondWithFilteredResult(_0x57a29d,_0x39f5e7){return function(_0x5cb3d2){if(_0x5cb3d2){var _0xc4e37a=typeof _0x39f5e7[_0xb2a3('0x23')]===_0xb2a3('0x24')&&typeof _0x39f5e7[_0xb2a3('0x25')]===_0xb2a3('0x24');var _0x21ce02=_0x5cb3d2['count'];var _0x437e27=_0xc4e37a?0x0:_0x39f5e7['offset'];var _0x34b4f2=_0xc4e37a?_0x5cb3d2[_0xb2a3('0x26')]:_0x39f5e7[_0xb2a3('0x23')]+_0x39f5e7[_0xb2a3('0x25')];var _0x31e39a;if(_0x34b4f2>=_0x21ce02){_0x34b4f2=_0x21ce02;_0x31e39a=0xc8;}else{_0x31e39a=0xce;}_0x57a29d[_0xb2a3('0x20')](_0x31e39a);return _0x57a29d['set'](_0xb2a3('0x27'),_0x437e27+'-'+_0x34b4f2+'/'+_0x21ce02)['json'](_0x5cb3d2);}return null;};}function patchUpdates(_0x1fd22a){return function(_0x24bb08){try{jsonpatch[_0xb2a3('0x28')](_0x24bb08,_0x1fd22a,!![]);}catch(_0x510fc0){return BPromise['reject'](_0x510fc0);}return _0x24bb08[_0xb2a3('0x29')]();};}function saveUpdates(_0x451ca3,_0x2f705b){return function(_0x431d63){if(_0x431d63){return _0x431d63['update'](_0x451ca3)[_0xb2a3('0x2a')](function(_0x1644f9){return _0x1644f9;});}return null;};}function removeEntity(_0x2be41e,_0x3b3d77){return function(_0xbbceb8){if(_0xbbceb8){return _0xbbceb8['destroy']()[_0xb2a3('0x2a')](function(){var _0xa2d7b5=_0xbbceb8[_0xb2a3('0x2b')]({'plain':!![]});var _0x341c2c='Plugins';return db[_0xb2a3('0x2c')][_0xb2a3('0x2d')]({'where':{'type':_0x341c2c,'resourceId':_0xa2d7b5['id']}})['then'](function(){return _0xbbceb8;});})[_0xb2a3('0x2a')](function(){_0x2be41e[_0xb2a3('0x20')](0xcc)[_0xb2a3('0x21')]();});}};}function handleEntityNotFound(_0x11369f,_0x25b103){return function(_0x1d1ba8){if(!_0x1d1ba8){_0x11369f['sendStatus'](0x194);}return _0x1d1ba8;};}function handleError(_0x2f8fed,_0x3e2577){_0x3e2577=_0x3e2577||0x1f4;return function(_0x4f25ba){logger['error'](_0x4f25ba[_0xb2a3('0x2e')]);if(_0x4f25ba[_0xb2a3('0x2f')]){delete _0x4f25ba['name'];}_0x2f8fed[_0xb2a3('0x20')](_0x3e2577)['send'](_0x4f25ba);};}exports['index']=function(_0x437c0e,_0x2efc8e){var _0x5439a2={},_0x19e5c5={},_0xaec3d3={'count':0x0,'rows':[]};var _0x3fb621=_[_0xb2a3('0x30')](db[_0xb2a3('0x31')][_0xb2a3('0x32')],function(_0x27a1c2){return{'name':_0x27a1c2['fieldName'],'type':_0x27a1c2['type']['key']};});_0x19e5c5[_0xb2a3('0x33')]=_['map'](_0x3fb621,_0xb2a3('0x2f'));_0x19e5c5[_0xb2a3('0x34')]=_[_0xb2a3('0x35')](_0x437c0e['query']);_0x19e5c5[_0xb2a3('0x36')]=_['intersection'](_0x19e5c5['model'],_0x19e5c5[_0xb2a3('0x34')]);_0x5439a2[_0xb2a3('0x37')]=_[_0xb2a3('0x38')](_0x19e5c5[_0xb2a3('0x33')],qs[_0xb2a3('0x39')](_0x437c0e['query'][_0xb2a3('0x39')]));_0x5439a2['attributes']=_0x5439a2[_0xb2a3('0x37')][_0xb2a3('0x3a')]?_0x5439a2[_0xb2a3('0x37')]:_0x19e5c5[_0xb2a3('0x33')];if(!_0x437c0e[_0xb2a3('0x34')][_0xb2a3('0x3b')](_0xb2a3('0x3c'))){_0x5439a2[_0xb2a3('0x25')]=qs['limit'](_0x437c0e['query'][_0xb2a3('0x25')]);_0x5439a2[_0xb2a3('0x23')]=qs[_0xb2a3('0x23')](_0x437c0e[_0xb2a3('0x34')][_0xb2a3('0x23')]);}_0x5439a2['order']=qs[_0xb2a3('0x3d')](_0x437c0e[_0xb2a3('0x34')][_0xb2a3('0x3d')]);_0x5439a2['where']=qs[_0xb2a3('0x36')](_[_0xb2a3('0x3e')](_0x437c0e[_0xb2a3('0x34')],_0x19e5c5[_0xb2a3('0x36')]),_0x3fb621);if(_0x437c0e[_0xb2a3('0x34')][_0xb2a3('0x3f')]){_0x5439a2[_0xb2a3('0x40')]=_[_0xb2a3('0x41')](_0x5439a2[_0xb2a3('0x40')],{'$or':_[_0xb2a3('0x30')](_0x3fb621,function(_0x480afe){if(_0x480afe[_0xb2a3('0x42')]!==_0xb2a3('0x43')){var _0x40e7f6={};_0x40e7f6[_0x480afe[_0xb2a3('0x2f')]]={'$like':'%'+_0x437c0e[_0xb2a3('0x34')][_0xb2a3('0x3f')]+'%'};return _0x40e7f6;}})});}_0x5439a2=_[_0xb2a3('0x41')]({},_0x5439a2,_0x437c0e[_0xb2a3('0x44')]);var _0x18eded={'where':_0x5439a2[_0xb2a3('0x40')]};return db[_0xb2a3('0x31')][_0xb2a3('0x26')](_0x18eded)[_0xb2a3('0x2a')](function(_0x1d5479){_0xaec3d3['count']=_0x1d5479;if(_0x437c0e[_0xb2a3('0x34')][_0xb2a3('0x45')]){_0x5439a2[_0xb2a3('0x46')]=[{'all':!![]}];}return db[_0xb2a3('0x31')][_0xb2a3('0x47')](_0x5439a2);})[_0xb2a3('0x2a')](function(_0x4dc0c8){_0xaec3d3['rows']=_0x4dc0c8;return _0xaec3d3;})[_0xb2a3('0x2a')](respondWithFilteredResult(_0x2efc8e,_0x5439a2))[_0xb2a3('0x48')](handleError(_0x2efc8e,null));};exports[_0xb2a3('0x49')]=function(_0x4a8409,_0x1af2ae){var _0x5e955a={'raw':!![],'where':{'id':_0x4a8409[_0xb2a3('0x4a')]['id']}},_0x346c84={};_0x346c84['model']=_[_0xb2a3('0x35')](db[_0xb2a3('0x31')][_0xb2a3('0x32')]);_0x346c84[_0xb2a3('0x34')]=_[_0xb2a3('0x35')](_0x4a8409['query']);_0x346c84['filters']=_[_0xb2a3('0x38')](_0x346c84[_0xb2a3('0x33')],_0x346c84[_0xb2a3('0x34')]);_0x5e955a[_0xb2a3('0x37')]=_[_0xb2a3('0x38')](_0x346c84[_0xb2a3('0x33')],qs[_0xb2a3('0x39')](_0x4a8409[_0xb2a3('0x34')][_0xb2a3('0x39')]));_0x5e955a['attributes']=_0x5e955a[_0xb2a3('0x37')][_0xb2a3('0x3a')]?_0x5e955a[_0xb2a3('0x37')]:_0x346c84[_0xb2a3('0x33')];if(_0x4a8409[_0xb2a3('0x34')][_0xb2a3('0x45')]){_0x5e955a[_0xb2a3('0x46')]=[{'all':!![]}];}_0x5e955a=_[_0xb2a3('0x41')]({},_0x5e955a,_0x4a8409['options']);return db[_0xb2a3('0x31')][_0xb2a3('0x4b')](_0x5e955a)[_0xb2a3('0x2a')](handleEntityNotFound(_0x1af2ae,null))[_0xb2a3('0x2a')](respondWithResult(_0x1af2ae,null))[_0xb2a3('0x48')](handleError(_0x1af2ae,null));};exports[_0xb2a3('0x4c')]=function(_0x29adc5,_0x55ba10,_0x5a2d51){return db[_0xb2a3('0x31')][_0xb2a3('0x4b')]({'where':{'id':_0x29adc5['params']['id']},'attributes':['name',_0xb2a3('0x8')],'raw':!![]})[_0xb2a3('0x2a')](handleEntityNotFound(_0x55ba10,null))[_0xb2a3('0x2a')](function(_0x38b59a){if(_0x38b59a){var _0x1b1f2f=path[_0xb2a3('0x4d')](config[_0xb2a3('0x4e')],'server/files/plugins',util[_0xb2a3('0x4f')](_0xb2a3('0x50'),path[_0xb2a3('0x51')](_0x38b59a[_0xb2a3('0x8')])));var _0x1ed8d1=fs[_0xb2a3('0x52')](_0x1b1f2f);var _0x249fc4=archiver('zip',{'zlib':{'level':0x9}});_0x249fc4['on'](_0xb2a3('0x53'),function(_0x16f276){if(_0x16f276[_0xb2a3('0x54')]===_0xb2a3('0x55')){logger['error'](_0x16f276);}else{throw new db[(_0xb2a3('0x56'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x249fc4['on'](_0xb2a3('0x57'),function(_0xb6bf3b){throw new db[(_0xb2a3('0x56'))][(_0xb2a3('0x58'))](_0xb2a3('0x59'));});_0x249fc4[_0xb2a3('0x5a')](_0x1ed8d1);_0x249fc4['glob'](_0xb2a3('0x5b'),{'cwd':path['join'](config[_0xb2a3('0x4e')],'server/files/plugins',path[_0xb2a3('0x5c')](_0x38b59a[_0xb2a3('0x8')])),'ignore':[path['join'](path[_0xb2a3('0x51')](_0x38b59a[_0xb2a3('0x8')]),_0xb2a3('0x5d')),path[_0xb2a3('0x4d')](path[_0xb2a3('0x51')](_0x38b59a[_0xb2a3('0x8')]),_0xb2a3('0x5e'))],'nodir':!![]})[_0xb2a3('0x5f')]();_0x1ed8d1['on'](_0xb2a3('0x60'),function(){if(!fs['existsSync'](_0x1b1f2f)){throw new db[(_0xb2a3('0x56'))][(_0xb2a3('0x58'))](_0xb2a3('0x61'));}return _0x55ba10[_0xb2a3('0x4c')](_0x1b1f2f,util[_0xb2a3('0x4f')](_0xb2a3('0x50'),path[_0xb2a3('0x51')](_0x38b59a[_0xb2a3('0x8')])),function(_0x45c9ee){if(_0x45c9ee){throw new db['Sequelize'][(_0xb2a3('0x58'))](_0xb2a3('0x62'));}fs['unlinkSync'](_0x1b1f2f);logger[_0xb2a3('0x63')]('Download\x20completed');logger[_0xb2a3('0x63')](_0xb2a3('0x64'));});});}return null;})[_0xb2a3('0x48')](handleError(_0x55ba10,null));};exports[_0xb2a3('0x65')]=function(_0x5ec1a3,_0x44dd35,_0x13f78d){var _0x37dd04=path['basename'](_0x5ec1a3[_0xb2a3('0x66')][_0xb2a3('0x67')],path[_0xb2a3('0x68')](_0x5ec1a3['file'][_0xb2a3('0x67')]));var _0x284de0=path[_0xb2a3('0x4d')](config[_0xb2a3('0x4e')],_0xb2a3('0x69'),_0x5ec1a3[_0xb2a3('0x66')][_0xb2a3('0x67')]);var _0x50e2dc=path[_0xb2a3('0x4d')](config[_0xb2a3('0x4e')],_0xb2a3('0x69'),_0x37dd04);logger[_0xb2a3('0x63')](_0xb2a3('0x6a'),_0x284de0);logger[_0xb2a3('0x63')](_0xb2a3('0x6b'),_0x50e2dc);try{fs[_0xb2a3('0x6c')](_0x284de0,parseInt('0777',0x8));extract(_0x284de0,{'dir':_0x50e2dc},function(_0x33c14e){if(_0x33c14e){logger[_0xb2a3('0x57')](_0x33c14e);handleError(_0x33c14e,!![]);};var _0x56df56=fs[_0xb2a3('0x6d')](_0x50e2dc);if(_0x56df56['length']>0x1){removeReferences(_0x284de0,_0x50e2dc);logger[_0xb2a3('0x57')](_0xb2a3('0x6e'));return _0x13f78d(new Error(_0xb2a3('0x6e')));}var _0x2da9d4=fs['lstatSync'](path[_0xb2a3('0x4d')](_0x50e2dc,_0x56df56[0x0]));if(_0x2da9d4[_0xb2a3('0x6f')]()){removeReferences(_0x284de0,_0x50e2dc);logger[_0xb2a3('0x57')]('Invalid\x20plugin\x20structure');return _0x13f78d(new Error(_0xb2a3('0x6e')));}if(_0x2da9d4[_0xb2a3('0x70')]()){var _0x4c4dcf=fs[_0xb2a3('0x6d')](path['join'](_0x50e2dc,_0x56df56[0x0]));if(_0x4c4dcf['length']===0x0){removeReferences(_0x284de0,_0x50e2dc);logger[_0xb2a3('0x57')]('Invalid\x20plugin\x20structure');return _0x13f78d(new Error(_0xb2a3('0x6e')));}var _0x3566f3=_0x4c4dcf[_0xb2a3('0x71')](function(_0x5a0293){return _0x5a0293===_0xb2a3('0x72');});if(!_0x3566f3){return _0x13f78d(new Error(_0xb2a3('0x73')));}var _0x37a2ec=fs['readFileSync'](path[_0xb2a3('0x4d')](_0x50e2dc,_0x56df56[0x0],_0xb2a3('0x72')));var _0x94630=JSON[_0xb2a3('0x74')](_0x37a2ec);if(_0xb2a3('0x24')==typeof _0x94630[_0xb2a3('0x2f')]){return _0x13f78d(new Error(_0xb2a3('0x75')));}if(_0xb2a3('0x24')==typeof _0x94630[_0xb2a3('0x42')]){return _0x13f78d(new Error(_0xb2a3('0x76')));}if(_0xb2a3('0x24')==typeof _0x94630['version']){return _0x13f78d(new Error(_0xb2a3('0x77')));}if(_0xb2a3('0x24')==typeof _0x94630[_0xb2a3('0x78')]){return _0x13f78d(new Error(_0xb2a3('0x79')));}if(_0x94630['type']==='html'){if(_0xb2a3('0x24')==typeof _0x94630[_0xb2a3('0x78')]['views']){return _0x13f78d(new Error(_0xb2a3('0x7a')));}if(_0xb2a3('0x24')==typeof _0x94630['parameters']['views']['admin']&&_0xb2a3('0x24')==typeof _0x94630['parameters']['views']['agent']){return _0x13f78d(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x94630[_0xb2a3('0x42')]==='script'){if(_0xb2a3('0x24')==typeof _0x94630[_0xb2a3('0x78')][_0xb2a3('0x7b')]){return _0x13f78d(new Error(_0xb2a3('0x7c')));}if(_0xb2a3('0x24')==typeof _0x94630[_0xb2a3('0x78')][_0xb2a3('0x7d')]){return _0x13f78d(new Error(_0xb2a3('0x7e')));}}else{return _0x13f78d(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x507dfe=_0x94630[_0xb2a3('0x2f')];var _0x221688=_0x94630['description'];var _0x3203e4=_0x94630[_0xb2a3('0x42')];var _0x484de1=_0x94630[_0xb2a3('0x7f')]?_0x94630[_0xb2a3('0x7f')]:'always';var _0x286605=_0x94630[_0xb2a3('0x80')]?_0x94630[_0xb2a3('0x80')]:_0xb2a3('0x81');var _0x30f421='';var _0x40267c='';var _0x5da8e9='';var _0x1bfd89='';var _0x2079d7=_0x94630['version'];if(_0x3203e4===_0xb2a3('0x82')){if(_0xb2a3('0x24')!=typeof _0x94630[_0xb2a3('0x78')][_0xb2a3('0x83')][_0xb2a3('0x84')]){var _0x5286d8=_0x94630['parameters'][_0xb2a3('0x83')][_0xb2a3('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xb2a3('0x85')](_0x5286d8)){_0x30f421=path[_0xb2a3('0x4d')]('plugins',_0x37dd04,_0x56df56[0x0],_0x5286d8);}else{_0x30f421=_0x5286d8;}}else{logger[_0xb2a3('0x63')](_0xb2a3('0x86'));}if(_0xb2a3('0x24')!=typeof _0x94630['parameters'][_0xb2a3('0x83')][_0xb2a3('0x87')]){var _0x3dde9b=_0x94630['parameters'][_0xb2a3('0x83')][_0xb2a3('0x87')];if(!/^(f|ht)tps?:\/\//i[_0xb2a3('0x85')](_0x3dde9b)){_0x40267c=path[_0xb2a3('0x4d')]('plugins',_0x37dd04,_0x56df56[0x0],_0x3dde9b);}else{_0x40267c=_0x3dde9b;}}else{logger[_0xb2a3('0x63')](_0xb2a3('0x88'));}}else if(_0x3203e4===_0xb2a3('0x89')){_0x5da8e9=_0x94630[_0xb2a3('0x78')][_0xb2a3('0x7b')];_0x1bfd89=_0x94630[_0xb2a3('0x78')][_0xb2a3('0x7d')];if(_0xb2a3('0x24')!=typeof _0x94630[_0xb2a3('0x78')][_0xb2a3('0x83')]){if(_0xb2a3('0x24')!=typeof _0x94630[_0xb2a3('0x78')][_0xb2a3('0x83')]['admin']){var _0x5286d8=_0x94630[_0xb2a3('0x78')]['views'][_0xb2a3('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xb2a3('0x85')](_0x5286d8)){_0x30f421=path[_0xb2a3('0x4d')]('plugins',_0x37dd04,_0x56df56[0x0],_0x5286d8);}else{_0x30f421=_0x5286d8;}}if(_0xb2a3('0x24')!=typeof _0x94630[_0xb2a3('0x78')][_0xb2a3('0x83')][_0xb2a3('0x87')]){var _0x3dde9b=_0x94630[_0xb2a3('0x78')][_0xb2a3('0x83')][_0xb2a3('0x87')];if(!/^(f|ht)tps?:\/\//i[_0xb2a3('0x85')](_0x3dde9b)){_0x40267c=path[_0xb2a3('0x4d')](_0xb2a3('0x8a'),_0x37dd04,_0x56df56[0x0],_0x3dde9b);}else{_0x40267c=_0x3dde9b;}}}}var _0x2a6319={'name':_0x507dfe,'description':_0x221688,'path':path['join'](_0x37dd04,_0x56df56[0x0]),'type':_0x3203e4,'sidebar':_0x484de1,'icon':_0x286605,'adminUrl':_0x30f421,'agentUrl':_0x40267c,'scriptName':_0x5da8e9,'scriptPath':_0x1bfd89,'version':_0x2079d7};removeReferences(_0x284de0,null);return db['Plugin'][_0xb2a3('0x8b')](_0x2a6319)[_0xb2a3('0x2a')](function(_0x327deb){var _0x14b1e2={'role':_0x5ec1a3[_0xb2a3('0x8c')][_0xb2a3('0x8d')],'userProfileId':_0x5ec1a3[_0xb2a3('0x8c')][_0xb2a3('0x8e')]};if(!_0x14b1e2)throw new Error(_0xb2a3('0x8f'));if(_0x14b1e2['role']==='user'){var _0x20a481=_0x327deb[_0xb2a3('0x2b')]({'plain':!![]});return db[_0xb2a3('0x90')][_0xb2a3('0x4b')]({'where':{'name':_0xb2a3('0x91'),'userProfileId':_0x14b1e2[_0xb2a3('0x8e')]},'raw':!![]})['then'](function(_0x528e0f){if(_0x528e0f&&_0x528e0f[_0xb2a3('0x92')]===0x0){return db['UserProfileResource']['create']({'name':_0x20a481[_0xb2a3('0x2f')],'resourceId':_0x20a481['id'],'type':_0x528e0f[_0xb2a3('0x2f')],'sectionId':_0x528e0f['id']},{})['then'](function(){return _0x327deb;});}else{return _0x327deb;}})[_0xb2a3('0x48')](function(_0x36ad35){logger[_0xb2a3('0x57')](_0xb2a3('0x93'),_0x36ad35);throw _0x36ad35;});}return _0x327deb;})[_0xb2a3('0x2a')](respondWithResult(_0x44dd35,null))['catch'](handleError(_0x44dd35,null));}});}catch(_0x327607){_0x44dd35[_0xb2a3('0x20')](0x1f4)[_0xb2a3('0x94')](_0x327607);}};function removeReferences(_0x51436a,_0x1d4794){try{if(_0x51436a){fs[_0xb2a3('0x95')](_0x51436a);logger[_0xb2a3('0x63')]('Zip\x20archive\x20removed');}if(_0x1d4794){rimraf(_0x1d4794,function(){});logger[_0xb2a3('0x63')]('Extracted\x20folder\x20removed');}}catch(_0x506a21){logger[_0xb2a3('0x57')](_0x506a21);}}exports['update']=function(_0x5a6aad,_0x204ad2,_0x2e9aba){return db[_0xb2a3('0x31')][_0xb2a3('0x4b')]({'where':{'id':_0x5a6aad[_0xb2a3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x204ad2,null))[_0xb2a3('0x2a')](saveUpdates(_0x5a6aad[_0xb2a3('0x8c')],null))[_0xb2a3('0x2a')](respondWithResult(_0x204ad2,null))[_0xb2a3('0x48')](handleError(_0x204ad2,null));};exports['delete']=function(_0xda813e,_0x457957,_0x2574e2){return db[_0xb2a3('0x31')][_0xb2a3('0x4b')]({'where':{'id':_0xda813e[_0xb2a3('0x4a')]['id']}})['then'](function(_0x3b84a3){if(_0x3b84a3){return _0x3b84a3[_0xb2a3('0x2d')]();}})[_0xb2a3('0x2a')](function(_0x351fef){rimraf(path['join'](config[_0xb2a3('0x4e')],_0xb2a3('0x69'),path[_0xb2a3('0x5c')](_0x351fef[_0xb2a3('0x8')])),function(){});return _0x351fef;})[_0xb2a3('0x2a')](handleEntityNotFound(_0x457957,null))[_0xb2a3('0x2a')](respondWithStatusCode(_0x457957,null))[_0xb2a3('0x48')](handleError(_0x457957,null));};exports['webhookGet']=function(_0xc1f19,_0x2c242a,_0x1b3f72){return BPromise[_0xb2a3('0x96')]()[_0xb2a3('0x2a')](function(){if(!_0xc1f19[_0xb2a3('0x34')][_0xb2a3('0x8')]){throw new Error(_0xb2a3('0x97'));}if(!_0xc1f19[_0xb2a3('0x34')][_0xb2a3('0x98')]){throw new Error(_0xb2a3('0x99'));}var _0x50ba73=_0xc1f19['query']['hostname']?_0xc1f19['query']['hostname']+':'+_0xc1f19['query'][_0xb2a3('0x98')]:'http://localhost:'+_0xc1f19[_0xb2a3('0x34')][_0xb2a3('0x98')];var _0x5cbe38=_0xc1f19[_0xb2a3('0x34')][_0xb2a3('0x22')]?_0xc1f19['query'][_0xb2a3('0x22')]:!![];var _0x47c0f6=_0xc1f19[_0xb2a3('0x34')][_0xb2a3('0x9a')]?_0xc1f19['query']['encoding']:null;var _0x5347af={'method':_0xc1f19[_0xb2a3('0x9b')],'uri':util[_0xb2a3('0x4f')]('%s%s',_0x50ba73,_0xc1f19[_0xb2a3('0x34')][_0xb2a3('0x8')]),'json':_0x5cbe38,'resolveWithFullResponse':!![],'encoding':_0x47c0f6,'qs':_0xc1f19[_0xb2a3('0x34')]};if(_0xc1f19[_0xb2a3('0x9c')]){_0x5347af[_0xb2a3('0x9c')]=_0xc1f19[_0xb2a3('0x9c')];if(_0x5347af[_0xb2a3('0x9c')]['content-length']){delete _0x5347af['headers'][_0xb2a3('0x9d')];}}if(_0x5347af['headers'][_0xb2a3('0x9e')]){delete _0x5347af[_0xb2a3('0x9c')][_0xb2a3('0x9e')];}return rp(_0x5347af);})[_0xb2a3('0x2a')](function(_0x21b000){if(_0x21b000){_0x2c242a[_0xb2a3('0x9f')](_0x21b000[_0xb2a3('0x9c')]);logger[_0xb2a3('0x63')](_0x21b000[_0xb2a3('0x8c')]);if(_[_0xb2a3('0xa0')](_0xc1f19[_0xb2a3('0x34')][_0xb2a3('0x8')],_0xb2a3('0x4c'))&&_0x21b000[_0xb2a3('0xa1')]==0x1f4){return _0x2c242a[_0xb2a3('0x1f')](_0x21b000['statusCode']);}else{return _0x2c242a[_0xb2a3('0x20')](_0x21b000[_0xb2a3('0xa1')])['send'](_0x21b000[_0xb2a3('0x8c')]);}}else{return _0x2c242a['sendStatus'](0xc8);}})['catch'](handleError(_0x2c242a,null));};exports[_0xb2a3('0xa2')]=function(_0x94a7f6,_0x556089,_0x49c2c7){return BPromise[_0xb2a3('0x96')]()[_0xb2a3('0x2a')](function(){if(!_0x94a7f6[_0xb2a3('0x34')][_0xb2a3('0x8')]){throw new Error(_0xb2a3('0x97'));}if(!_0x94a7f6[_0xb2a3('0x34')][_0xb2a3('0x98')]){throw new Error(_0xb2a3('0x99'));}var _0x38a6fb=_0x94a7f6['query'][_0xb2a3('0xa3')]?_0x94a7f6[_0xb2a3('0x34')][_0xb2a3('0xa3')]+':'+_0x94a7f6[_0xb2a3('0x34')][_0xb2a3('0x98')]:'http://localhost:'+_0x94a7f6[_0xb2a3('0x34')][_0xb2a3('0x98')];var _0x376911=_0x94a7f6['query'][_0xb2a3('0x22')]?_0x94a7f6[_0xb2a3('0x34')][_0xb2a3('0x22')]:!![];var _0x337eed=_0x94a7f6[_0xb2a3('0x34')]['encoding']?_0x94a7f6[_0xb2a3('0x34')][_0xb2a3('0x9a')]:null;var _0x4e2be3={'method':_0x94a7f6[_0xb2a3('0x9b')],'uri':util[_0xb2a3('0x4f')]('%s%s',_0x38a6fb,_0x94a7f6['query']['path']),'json':_0x376911,'resolveWithFullResponse':!![],'encoding':_0x337eed,'body':_0x94a7f6[_0xb2a3('0x8c')]};if(_0x94a7f6[_0xb2a3('0x9c')]){_0x4e2be3['headers']=_0x94a7f6[_0xb2a3('0x9c')];if(_0x4e2be3[_0xb2a3('0x9c')][_0xb2a3('0x9d')]){delete _0x4e2be3[_0xb2a3('0x9c')][_0xb2a3('0x9d')];}}if(_0x4e2be3[_0xb2a3('0x9c')][_0xb2a3('0x9e')]){delete _0x4e2be3[_0xb2a3('0x9c')][_0xb2a3('0x9e')];}return rp(_0x4e2be3);})[_0xb2a3('0x2a')](function(_0x57a99a){if(_0x57a99a){_0x556089[_0xb2a3('0x9f')](_0x57a99a[_0xb2a3('0x9c')]);logger[_0xb2a3('0x63')](_0x57a99a[_0xb2a3('0x8c')]);return _0x556089[_0xb2a3('0x20')](_0x57a99a[_0xb2a3('0xa1')])[_0xb2a3('0x94')](_0x57a99a['body']);}else{return _0x556089[_0xb2a3('0x1f')](0xc8);}})[_0xb2a3('0x48')](handleError(_0x556089,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 42958e7..59a9b86 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 _0x93bb=['../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x93bb,0x135));var _0xb93b=function(_0x544d0b,_0x28c405){_0x544d0b=_0x544d0b-0x0;var _0x49931a=_0x93bb[_0x544d0b];return _0x49931a;};'use strict';var EventEmitter=require(_0xb93b('0x0'));var Plugin=require(_0xb93b('0x1'))['db'][_0xb93b('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xb93b('0x3')](0x0);var events={'afterCreate':_0xb93b('0x4'),'afterUpdate':_0xb93b('0x5'),'afterDestroy':_0xb93b('0x6')};function emitEvent(_0x3d634e){return function(_0x3eb285,_0x355196,_0x540b3c){PluginEvents[_0xb93b('0x7')](_0x3d634e+':'+_0x3eb285['id'],_0x3eb285);PluginEvents[_0xb93b('0x7')](_0x3d634e,_0x3eb285);_0x540b3c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xb93b('0x8')](e,emitEvent(event));}}module[_0xb93b('0x9')]=PluginEvents; \ No newline at end of file +var _0x5bd7=['update','emit','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x5bd7,0x12a));var _0x75bd=function(_0x44a82b,_0x2e7f66){_0x44a82b=_0x44a82b-0x0;var _0x47ed65=_0x5bd7[_0x44a82b];return _0x47ed65;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x75bd('0x0'))['db'][_0x75bd('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x75bd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x75bd('0x3'),'afterDestroy':'remove'};function emitEvent(_0x45639e){return function(_0x24036f,_0x524c93,_0x440c0d){PluginEvents[_0x75bd('0x4')](_0x45639e+':'+_0x24036f['id'],_0x24036f);PluginEvents[_0x75bd('0x4')](_0x45639e,_0x24036f);_0x440c0d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x75bd('0x5')](e,emitEvent(event));}}module[_0x75bd('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index d97fc06..dd22de1 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 _0x8d48=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./plugin.attributes','exports','define','Plugin','plugins'];(function(_0x54f049,_0x28e5bb){var _0x427c6c=function(_0x4fd019){while(--_0x4fd019){_0x54f049['push'](_0x54f049['shift']());}};_0x427c6c(++_0x28e5bb);}(_0x8d48,0xc0));var _0x88d4=function(_0x399bfc,_0x36d4b0){_0x399bfc=_0x399bfc-0x0;var _0x36846d=_0x8d48[_0x399bfc];return _0x36846d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x88d4('0x0'))(_0x88d4('0x1'));var moment=require(_0x88d4('0x2'));var BPromise=require(_0x88d4('0x3'));var rp=require(_0x88d4('0x4'));var fs=require('fs');var path=require(_0x88d4('0x5'));var rimraf=require(_0x88d4('0x6'));var config=require('../../config/environment');var attributes=require(_0x88d4('0x7'));module[_0x88d4('0x8')]=function(_0xf35213,_0x408fb6){return _0xf35213[_0x88d4('0x9')](_0x88d4('0xa'),attributes,{'tableName':_0x88d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f58=['api','moment','bluebird','request-promise','path','rimraf','./plugin.attributes','exports','define','Plugin','plugins','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f58,0xce));var _0x87f5=function(_0x511f28,_0x172aad){_0x511f28=_0x511f28-0x0;var _0x55a3ee=_0x7f58[_0x511f28];return _0x55a3ee;};'use strict';var _=require(_0x87f5('0x0'));var util=require('util');var logger=require(_0x87f5('0x1'))(_0x87f5('0x2'));var moment=require(_0x87f5('0x3'));var BPromise=require(_0x87f5('0x4'));var rp=require(_0x87f5('0x5'));var fs=require('fs');var path=require(_0x87f5('0x6'));var rimraf=require(_0x87f5('0x7'));var config=require('../../config/environment');var attributes=require(_0x87f5('0x8'));module[_0x87f5('0x9')]=function(_0x126d64,_0x18ed47){return _0x126d64[_0x87f5('0xa')](_0x87f5('0xb'),attributes,{'tableName':_0x87f5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 6b5591a..ffa80cc 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 _0x3eae=['Plugin','create','body','options','raw','CreatePlugin','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./plugin.socket','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','Plugin,\x20%s,\x20%s','message','result','catch'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3eae,0x126));var _0xe3ea=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x3eae[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0xe3ea('0x0'));var util=require(_0xe3ea('0x1'));var moment=require(_0xe3ea('0x2'));var BPromise=require(_0xe3ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3ea('0x4'));var db=require(_0xe3ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3ea('0x6'))(_0xe3ea('0x7'));var config=require(_0xe3ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe3ea('0x9')][_0xe3ea('0xa')]({'port':0x232a});config[_0xe3ea('0xb')]=_[_0xe3ea('0xc')](config[_0xe3ea('0xb')],{'host':_0xe3ea('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe3ea('0xb')]));require(_0xe3ea('0xe'))['register'](socket);function respondWithRpcPromise(_0x32a059,_0x23ca3e,_0x23134e){return new BPromise(function(_0x2afd60,_0x1db54c){return client['request'](_0x32a059,_0x23134e)[_0xe3ea('0xf')](function(_0x3236c0){logger[_0xe3ea('0x10')]('Plugin,\x20%s,\x20%s',_0x23ca3e,_0xe3ea('0x11'));logger[_0xe3ea('0x12')](_0xe3ea('0x13'),_0x23ca3e,_0xe3ea('0x11'),JSON[_0xe3ea('0x14')](_0x3236c0));if(_0x3236c0[_0xe3ea('0x15')]){if(_0x3236c0['error']['code']===0x1f4){logger[_0xe3ea('0x15')](_0xe3ea('0x16'),_0x23ca3e,_0x3236c0[_0xe3ea('0x15')][_0xe3ea('0x17')]);return _0x1db54c(_0x3236c0[_0xe3ea('0x15')]['message']);}logger['error'](_0xe3ea('0x16'),_0x23ca3e,_0x3236c0[_0xe3ea('0x15')]['message']);return _0x2afd60(_0x3236c0[_0xe3ea('0x15')][_0xe3ea('0x17')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x23ca3e,_0xe3ea('0x11'));_0x2afd60(_0x3236c0[_0xe3ea('0x18')][_0xe3ea('0x17')]);}})[_0xe3ea('0x19')](function(_0x12de73){logger[_0xe3ea('0x15')]('Plugin,\x20%s,\x20%s',_0x23ca3e,_0x12de73);_0x1db54c(_0x12de73);});});}exports['CreatePlugin']=function(_0x165f53){var _0x5d0ca4=this;return new Promise(function(_0x52df79,_0xcbb4db){return db[_0xe3ea('0x1a')][_0xe3ea('0x1b')](_0x165f53[_0xe3ea('0x1c')],{'raw':_0x165f53[_0xe3ea('0x1d')]?_0x165f53[_0xe3ea('0x1d')][_0xe3ea('0x1e')]===undefined?!![]:![]:!![]})[_0xe3ea('0xf')](function(_0x342192){logger[_0xe3ea('0x10')](_0xe3ea('0x1f'),_0x165f53);logger[_0xe3ea('0x12')](_0xe3ea('0x1f'),_0x165f53,JSON['stringify'](_0x342192));_0x52df79(_0x342192);})[_0xe3ea('0x19')](function(_0x1ac1c1){logger[_0xe3ea('0x15')](_0xe3ea('0x1f'),_0x1ac1c1[_0xe3ea('0x17')],_0x165f53);_0xcbb4db(_0x5d0ca4[_0xe3ea('0x15')](0x1f4,_0x1ac1c1[_0xe3ea('0x17')]));});});}; \ No newline at end of file +var _0x5d98=['Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./plugin.socket','register','request','then','info'];(function(_0x10f122,_0x445e0f){var _0x373fbf=function(_0x49ef3c){while(--_0x49ef3c){_0x10f122['push'](_0x10f122['shift']());}};_0x373fbf(++_0x445e0f);}(_0x5d98,0x1af));var _0x85d9=function(_0x523c2a,_0x5356b6){_0x523c2a=_0x523c2a-0x0;var _0x36fb68=_0x5d98[_0x523c2a];return _0x36fb68;};'use strict';var _=require(_0x85d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x85d9('0x1'));var rs=require(_0x85d9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x85d9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x85d9('0x4'))('rpc');var config=require(_0x85d9('0x5'));var jayson=require(_0x85d9('0x6'));var client=jayson[_0x85d9('0x7')][_0x85d9('0x8')]({'port':0x232a});config[_0x85d9('0x9')]=_[_0x85d9('0xa')](config['redis'],{'host':_0x85d9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85d9('0x9')]));require(_0x85d9('0xc'))[_0x85d9('0xd')](socket);function respondWithRpcPromise(_0x12afb7,_0xa62535,_0x54113f){return new BPromise(function(_0x7bd76b,_0x319519){return client[_0x85d9('0xe')](_0x12afb7,_0x54113f)[_0x85d9('0xf')](function(_0x39fa53){logger[_0x85d9('0x10')](_0x85d9('0x11'),_0xa62535,'request\x20sent');logger[_0x85d9('0x12')](_0x85d9('0x13'),_0xa62535,_0x85d9('0x14'),JSON[_0x85d9('0x15')](_0x39fa53));if(_0x39fa53[_0x85d9('0x16')]){if(_0x39fa53[_0x85d9('0x16')]['code']===0x1f4){logger[_0x85d9('0x16')](_0x85d9('0x11'),_0xa62535,_0x39fa53[_0x85d9('0x16')][_0x85d9('0x17')]);return _0x319519(_0x39fa53[_0x85d9('0x16')]['message']);}logger['error'](_0x85d9('0x11'),_0xa62535,_0x39fa53[_0x85d9('0x16')][_0x85d9('0x17')]);return _0x7bd76b(_0x39fa53[_0x85d9('0x16')]['message']);}else{logger[_0x85d9('0x10')](_0x85d9('0x11'),_0xa62535,'request\x20sent');_0x7bd76b(_0x39fa53[_0x85d9('0x18')][_0x85d9('0x17')]);}})[_0x85d9('0x19')](function(_0x1c674e){logger[_0x85d9('0x16')](_0x85d9('0x11'),_0xa62535,_0x1c674e);_0x319519(_0x1c674e);});});}exports[_0x85d9('0x1a')]=function(_0x276ac5){var _0x24a2ae=this;return new Promise(function(_0xde7e42,_0x824e30){return db[_0x85d9('0x1b')][_0x85d9('0x1c')](_0x276ac5[_0x85d9('0x1d')],{'raw':_0x276ac5['options']?_0x276ac5[_0x85d9('0x1e')][_0x85d9('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x13706d){logger[_0x85d9('0x10')]('CreatePlugin',_0x276ac5);logger['debug'](_0x85d9('0x1a'),_0x276ac5,JSON[_0x85d9('0x15')](_0x13706d));_0xde7e42(_0x13706d);})[_0x85d9('0x19')](function(_0x1dc2d8){logger['error'](_0x85d9('0x1a'),_0x1dc2d8[_0x85d9('0x17')],_0x276ac5);_0x824e30(_0x24a2ae[_0x85d9('0x16')](0x1f4,_0x1dc2d8[_0x85d9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 6c7ed5a..22ab06b 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 _0xaf3c=['plugin:','save','update','emit','removeListener','register'];(function(_0x40c0a5,_0x4d5f6f){var _0x5b6a0d=function(_0x3f014c){while(--_0x3f014c){_0x40c0a5['push'](_0x40c0a5['shift']());}};_0x5b6a0d(++_0x4d5f6f);}(_0xaf3c,0x1e1));var _0xcaf3=function(_0x550528,_0x34cb47){_0x550528=_0x550528-0x0;var _0x458275=_0xaf3c[_0x550528];return _0x458275;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xcaf3('0x0'),'remove',_0xcaf3('0x1')];function createListener(_0x3a9185,_0x7aba66){return function(_0x52a715){_0x7aba66[_0xcaf3('0x2')](_0x3a9185,_0x52a715);};}function removeListener(_0x1eb029,_0x379a8a){return function(){PluginEvents[_0xcaf3('0x3')](_0x1eb029,_0x379a8a);};}exports[_0xcaf3('0x4')]=function(_0x53cf84){for(var _0x2b333f=0x0,_0x2196a3=events['length'];_0x2b333f<_0x2196a3;_0x2b333f++){var _0x2d088d=events[_0x2b333f];var _0xbccc7b=createListener(_0xcaf3('0x5')+_0x2d088d,_0x53cf84);PluginEvents['on'](_0x2d088d,_0xbccc7b);}}; \ No newline at end of file +var _0x160a=['./plugin.events','update','removeListener','register','length','plugin:'];(function(_0x2a3afb,_0x47504f){var _0x9926de=function(_0x100d29){while(--_0x100d29){_0x2a3afb['push'](_0x2a3afb['shift']());}};_0x9926de(++_0x47504f);}(_0x160a,0x1e0));var _0xa160=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0x160a[_0x350182];return _0x4a0892;};'use strict';var PluginEvents=require(_0xa160('0x0'));var events=['save','remove',_0xa160('0x1')];function createListener(_0x5d3b24,_0x521940){return function(_0x5ede15){_0x521940['emit'](_0x5d3b24,_0x5ede15);};}function removeListener(_0x34f880,_0x40b827){return function(){PluginEvents[_0xa160('0x2')](_0x34f880,_0x40b827);};}exports[_0xa160('0x3')]=function(_0x567698){for(var _0x96b3d9=0x0,_0x20b2d0=events[_0xa160('0x4')];_0x96b3d9<_0x20b2d0;_0x96b3d9++){var _0x2cc59f=events[_0x96b3d9];var _0x3c8ad0=createListener(_0xa160('0x5')+_0x2cc59f,_0x567698);PluginEvents['on'](_0x2cc59f,_0x3c8ad0);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 6541eb2..14095a4 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(_0x4f34f2,_0x1e408b){var _0x344b81=function(_0x5be90c){while(--_0x5be90c){_0x4f34f2['push'](_0x4f34f2['shift']());}};_0x344b81(++_0x1e408b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x2b1bc8,_0x54dba5){var _0x56733b=function(_0x4a38c9){while(--_0x4a38c9){_0x2b1bc8['push'](_0x2b1bc8['shift']());}};_0x56733b(++_0x54dba5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 04f6450..e7cb88e 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 _0x6f7a=['../../files/plugins','cwd','chdir','start','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','dump','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','express','motion2','catch','show','params','body','script','join'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x48ee3f,_0x54971e){_0x48ee3f=_0x48ee3f-0x0;var _0x135a3e=_0x6f7a[_0x48ee3f];return _0x135a3e;};'use strict';var _=require(_0xa6f7('0x0'));var pm2=require(_0xa6f7('0x1'));var logger=require(_0xa6f7('0x2'))(_0xa6f7('0x3'));var path=require('path');var exec=require(_0xa6f7('0x4'))[_0xa6f7('0x5')];var BPromise=require(_0xa6f7('0x6'));function handleEntityNotFound(_0x1da6dc,_0x22e529){return function(_0x1f5922){if(!_0x1f5922){_0x1da6dc[_0xa6f7('0x7')](0x194);;}return _0x1f5922;};}function respondWithResult(_0x20cccd,_0x1fdd5f){_0x1fdd5f=_0x1fdd5f||0xc8;return function(_0x335aaa){if(_0x335aaa){return _0x20cccd[_0xa6f7('0x8')](_0x1fdd5f)['json'](_0x335aaa);}return null;};}function handleError(_0x4b4f9e,_0x30f2a7){_0x30f2a7=_0x30f2a7||0x1f4;return function(_0x2674c9){logger[_0xa6f7('0x9')](_0x2674c9[_0xa6f7('0xa')]);if(_0x2674c9[_0xa6f7('0xb')]){delete _0x2674c9['name'];}_0x4b4f9e['status'](_0x30f2a7)[_0xa6f7('0xc')](_0x2674c9);};}function execChildProcess(){return new BPromise(function(_0x225da4,_0x4e30bc){exec(_0xa6f7('0xd'),function(_0x5623bf,_0x315096,_0x1303c3){logger[_0xa6f7('0xe')](_0x315096);logger[_0xa6f7('0xe')](_0x1303c3);if(_0x5623bf){logger['error'](_0x5623bf);return _0x4e30bc(_0x5623bf);}return _0x225da4(_0x315096);});});}exports[_0xa6f7('0xf')]=function(_0x532352,_0x25b48f){return pm2[_0xa6f7('0x10')]()[_0xa6f7('0x11')](function(_0x4d3d59){if(_0x4d3d59){var _0x34c02d=_['reject'](_0x4d3d59,function(_0x41bc4d){return _0x41bc4d['name']===_0xa6f7('0x12')||_0x41bc4d[_0xa6f7('0xb')]===_0xa6f7('0x13');});return{'rows':_0x34c02d,'count':_0x34c02d['length']};}return null;})[_0xa6f7('0x11')](respondWithResult(_0x25b48f,null))[_0xa6f7('0x14')](handleError(_0x25b48f,null));};exports[_0xa6f7('0x15')]=function(_0x2401b9,_0x5681d5){return pm2['describe'](_0x2401b9[_0xa6f7('0x16')]['id'])['then'](respondWithResult(_0x5681d5,null))[_0xa6f7('0x11')](handleEntityNotFound(_0x5681d5,null))[_0xa6f7('0x14')](handleError(_0x5681d5,null));};exports['create']=function(_0x18fc4a,_0xb2cfaa){if(_0x18fc4a[_0xa6f7('0x17')][_0xa6f7('0xb')]&&_0x18fc4a[_0xa6f7('0x17')][_0xa6f7('0x18')]){var _0x4887ad=path[_0xa6f7('0x19')](__dirname,_0xa6f7('0x1a'),_0x18fc4a['body']['script']);var _0x5ddc8d=process[_0xa6f7('0x1b')]();process[_0xa6f7('0x1c')](path['dirname'](_0x4887ad));return execChildProcess()['then'](function(_0x50e2be){process[_0xa6f7('0x1c')](_0x5ddc8d);return pm2[_0xa6f7('0x1d')]({'name':_0x18fc4a[_0xa6f7('0x17')]['name'],'script':_0x4887ad});})['then'](function(_0x2f4907){pm2['dump']();return _0x2f4907[0x0];})['then'](respondWithResult(_0xb2cfaa,0xc9))[_0xa6f7('0x14')](handleError(_0xb2cfaa,null));}else{return _0xb2cfaa['status'](0x1f4)[_0xa6f7('0xc')]({'message':_0xa6f7('0x1e')});}};exports[_0xa6f7('0x1f')]=function(_0x2b4c6c,_0x3a3508){if(_0x2b4c6c['body']['id']){delete _0x2b4c6c['body']['id'];}var _0x1c419b={'online':_0xa6f7('0x20'),'stopped':'stop'};if(_0x1c419b[_0xa6f7('0x21')](_0x2b4c6c[_0xa6f7('0x17')][_0xa6f7('0x8')])){return pm2[_0x1c419b[_0x2b4c6c[_0xa6f7('0x17')][_0xa6f7('0x8')]]](_0x2b4c6c[_0xa6f7('0x16')]['id'])[_0xa6f7('0x11')](respondWithResult(_0x3a3508,0xc8))[_0xa6f7('0x14')](handleError(_0x3a3508,null));}else{return _0x3a3508[_0xa6f7('0x8')](0x1f4)[_0xa6f7('0xc')]({'message':_0xa6f7('0x22')});}};exports[_0xa6f7('0x23')]=function(_0x52f9c1,_0x442ccf){if(_0x52f9c1[_0xa6f7('0x17')]['id']){delete _0x52f9c1['body']['id'];}if(_0x52f9c1[_0xa6f7('0x16')]['id']){return pm2[_0xa6f7('0x24')](_0x52f9c1['params']['id'])['then'](function(_0x176378){pm2[_0xa6f7('0x25')]();return _0x176378[0x0];})[_0xa6f7('0x11')](respondWithResult(_0x442ccf,null))[_0xa6f7('0x14')](handleError(_0x442ccf,null));}else{return _0x442ccf[_0xa6f7('0x8')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x8ce3=['length','catch','show','describe','params','then','create','body','script','join','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','exec','bluebird','status','json','stack','name','send','npm\x20install','info','error','index','list','reject','express','motion2'];(function(_0x2526e3,_0x5f22f8){var _0xcf6f48=function(_0x284491){while(--_0x284491){_0x2526e3['push'](_0x2526e3['shift']());}};_0xcf6f48(++_0x5f22f8);}(_0x8ce3,0xc3));var _0x38ce=function(_0x28fde4,_0x4fbc40){_0x28fde4=_0x28fde4-0x0;var _0xdc3f1b=_0x8ce3[_0x28fde4];return _0xdc3f1b;};'use strict';var _=require(_0x38ce('0x0'));var pm2=require(_0x38ce('0x1'));var logger=require('../../config/logger')(_0x38ce('0x2'));var path=require(_0x38ce('0x3'));var exec=require(_0x38ce('0x4'))[_0x38ce('0x5')];var BPromise=require(_0x38ce('0x6'));function handleEntityNotFound(_0x17b96d,_0x1efae3){return function(_0x381fa0){if(!_0x381fa0){_0x17b96d['sendStatus'](0x194);;}return _0x381fa0;};}function respondWithResult(_0x372f86,_0xb24f4c){_0xb24f4c=_0xb24f4c||0xc8;return function(_0x58074c){if(_0x58074c){return _0x372f86[_0x38ce('0x7')](_0xb24f4c)[_0x38ce('0x8')](_0x58074c);}return null;};}function handleError(_0x3f8011,_0x482955){_0x482955=_0x482955||0x1f4;return function(_0x3c66e5){logger['error'](_0x3c66e5[_0x38ce('0x9')]);if(_0x3c66e5['name']){delete _0x3c66e5[_0x38ce('0xa')];}_0x3f8011[_0x38ce('0x7')](_0x482955)[_0x38ce('0xb')](_0x3c66e5);};}function execChildProcess(){return new BPromise(function(_0x2c0cab,_0x564332){exec(_0x38ce('0xc'),function(_0x2a9045,_0x171a02,_0x29bd3a){logger[_0x38ce('0xd')](_0x171a02);logger[_0x38ce('0xd')](_0x29bd3a);if(_0x2a9045){logger[_0x38ce('0xe')](_0x2a9045);return _0x564332(_0x2a9045);}return _0x2c0cab(_0x171a02);});});}exports[_0x38ce('0xf')]=function(_0x263d6f,_0x2e661b){return pm2[_0x38ce('0x10')]()['then'](function(_0x48ba7c){if(_0x48ba7c){var _0x3c4d7f=_[_0x38ce('0x11')](_0x48ba7c,function(_0x2369f3){return _0x2369f3['name']===_0x38ce('0x12')||_0x2369f3['name']===_0x38ce('0x13');});return{'rows':_0x3c4d7f,'count':_0x3c4d7f[_0x38ce('0x14')]};}return null;})['then'](respondWithResult(_0x2e661b,null))[_0x38ce('0x15')](handleError(_0x2e661b,null));};exports[_0x38ce('0x16')]=function(_0x1dfaba,_0x51f670){return pm2[_0x38ce('0x17')](_0x1dfaba[_0x38ce('0x18')]['id'])[_0x38ce('0x19')](respondWithResult(_0x51f670,null))[_0x38ce('0x19')](handleEntityNotFound(_0x51f670,null))[_0x38ce('0x15')](handleError(_0x51f670,null));};exports[_0x38ce('0x1a')]=function(_0x2d4218,_0x518b04){if(_0x2d4218[_0x38ce('0x1b')][_0x38ce('0xa')]&&_0x2d4218[_0x38ce('0x1b')][_0x38ce('0x1c')]){var _0x30b060=path[_0x38ce('0x1d')](__dirname,_0x38ce('0x1e'),_0x2d4218[_0x38ce('0x1b')][_0x38ce('0x1c')]);var _0x3cf50b=process[_0x38ce('0x1f')]();process['chdir'](path[_0x38ce('0x20')](_0x30b060));return execChildProcess()[_0x38ce('0x19')](function(_0xe40e9c){process[_0x38ce('0x21')](_0x3cf50b);return pm2['start']({'name':_0x2d4218[_0x38ce('0x1b')][_0x38ce('0xa')],'script':_0x30b060});})['then'](function(_0xe0af00){pm2[_0x38ce('0x22')]();return _0xe0af00[0x0];})[_0x38ce('0x19')](respondWithResult(_0x518b04,0xc9))['catch'](handleError(_0x518b04,null));}else{return _0x518b04['status'](0x1f4)[_0x38ce('0xb')]({'message':_0x38ce('0x23')});}};exports[_0x38ce('0x24')]=function(_0x21d4e7,_0x264cf0){if(_0x21d4e7[_0x38ce('0x1b')]['id']){delete _0x21d4e7[_0x38ce('0x1b')]['id'];}var _0xce1f64={'online':_0x38ce('0x25'),'stopped':_0x38ce('0x26')};if(_0xce1f64[_0x38ce('0x27')](_0x21d4e7[_0x38ce('0x1b')]['status'])){return pm2[_0xce1f64[_0x21d4e7[_0x38ce('0x1b')][_0x38ce('0x7')]]](_0x21d4e7['params']['id'])[_0x38ce('0x19')](respondWithResult(_0x264cf0,0xc8))[_0x38ce('0x15')](handleError(_0x264cf0,null));}else{return _0x264cf0['status'](0x1f4)[_0x38ce('0xb')]({'message':_0x38ce('0x28')});}};exports['destroy']=function(_0x28d775,_0x53f2c9){if(_0x28d775[_0x38ce('0x1b')]['id']){delete _0x28d775[_0x38ce('0x1b')]['id'];}if(_0x28d775[_0x38ce('0x18')]['id']){return pm2[_0x38ce('0x29')](_0x28d775[_0x38ce('0x18')]['id'])[_0x38ce('0x19')](function(_0x34262a){pm2[_0x38ce('0x22')]();return _0x34262a[0x0];})['then'](respondWithResult(_0x53f2c9,null))['catch'](handleError(_0x53f2c9,null));}else{return _0x53f2c9[_0x38ce('0x7')](0x1f4)[_0x38ce('0xb')]({'message':_0x38ce('0x2a')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index be94cfb..ee33c30 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 _0xd42b=['isAuthenticated','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','getAgents','/queues'];(function(_0x1cde71,_0x127f85){var _0x134952=function(_0x14258f){while(--_0x14258f){_0x1cde71['push'](_0x1cde71['shift']());}};_0x134952(++_0x127f85);}(_0xd42b,0x19a));var _0xbd42=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0xd42b[_0x40be86];return _0xda3c3b;};'use strict';var express=require(_0xbd42('0x0'));var router=express[_0xbd42('0x1')]();var auth=require(_0xbd42('0x2'));var controller=require(_0xbd42('0x3'));router[_0xbd42('0x4')](_0xbd42('0x5'),auth['isAuthenticated'](),controller[_0xbd42('0x6')]);router[_0xbd42('0x4')](_0xbd42('0x7'),auth[_0xbd42('0x8')](),controller[_0xbd42('0x9')]);module[_0xbd42('0xa')]=router; \ No newline at end of file +var _0xdd4f=['getAgents','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated'];(function(_0x176eae,_0x438c61){var _0x2d3588=function(_0x3f3bad){while(--_0x3f3bad){_0x176eae['push'](_0x176eae['shift']());}};_0x2d3588(++_0x438c61);}(_0xdd4f,0x1c7));var _0xfdd4=function(_0x1d79d5,_0x5bb5ba){_0x1d79d5=_0x1d79d5-0x0;var _0x4645cc=_0xdd4f[_0x1d79d5];return _0x4645cc;};'use strict';var express=require(_0xfdd4('0x0'));var router=express[_0xfdd4('0x1')]();var auth=require(_0xfdd4('0x2'));var controller=require(_0xfdd4('0x3'));router[_0xfdd4('0x4')](_0xfdd4('0x5'),auth[_0xfdd4('0x6')](),controller[_0xfdd4('0x7')]);router[_0xfdd4('0x4')](_0xfdd4('0x8'),auth[_0xfdd4('0x6')](),controller[_0xfdd4('0x9')]);module[_0xfdd4('0xa')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 16a8145..f0147fe 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 _0xfb29=['json','error','stack','name','status','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','voice','startCase','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','waiting','talking','paused','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','loggedIn','outbound','find','pick','queue','length','busy','some','connectedlinenum','internal','getMembers','UserId','accountcode','online','voiceStatus','Pause','findAll','QueueId','ringing','isNil','chatPause','mailPause','smsPause','voicePause','whatsappPause','every','filter','idle','pause','chatStatus','faxStatus','mailStatus','smsStatus','unknown','*pause','getAgents','userpic','lastLoginAt','lastPauseAt','pauseType','address','openchannelPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','phoneBarEnableScreenRecordingByAgent','routealias','faxPause','resolve','User','rawAttributes','type','key','query','agent','getOptions','raw','user','role','userProfileId','nolimit','sort','UserProfile','getResources','rows','omit','globalStatus','globalStatusFilter','mail','openchannel','whatsapp','includes','toLowerCase','Invalid\x20channel','fieldName','findAndCountAll','all','util','jayson/promise','../../config/logger','../../mysqldb','http','offset','undefined','limit','count','set','Content-Range'];(function(_0x1e60a1,_0x2c0233){var _0x881d8b=function(_0x9ef927){while(--_0x9ef927){_0x1e60a1['push'](_0x1e60a1['shift']());}};_0x881d8b(++_0x2c0233);}(_0xfb29,0x119));var _0x9fb2=function(_0x53cc70,_0x17473b){_0x53cc70=_0x53cc70-0x0;var _0x1b0923=_0xfb29[_0x53cc70];return _0x1b0923;};'use strict';var util=require(_0x9fb2('0x0'));var _=require('lodash');var jayson=require(_0x9fb2('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x9fb2('0x2'))('api');var db=require(_0x9fb2('0x3'))['db'];var amiClient=jayson['client'][_0x9fb2('0x4')]({'port':0x232a});var routingClient=jayson['client'][_0x9fb2('0x4')]({'port':0x232c});function respondWithFilteredResult(_0xf5221d,_0x842691){return function(_0x2f9a3a){if(_0x2f9a3a){var _0xc26c95=typeof _0x842691[_0x9fb2('0x5')]===_0x9fb2('0x6')&&typeof _0x842691[_0x9fb2('0x7')]==='undefined';var _0x2b06eb=_0x2f9a3a[_0x9fb2('0x8')];var _0x8ac7ae=_0xc26c95?0x0:_0x842691['offset'];var _0x40c418=_0xc26c95?_0x2f9a3a[_0x9fb2('0x8')]:_0x842691[_0x9fb2('0x5')]+_0x842691[_0x9fb2('0x7')];var _0x51d88d;if(_0x40c418>=_0x2b06eb){_0x40c418=_0x2b06eb;_0x51d88d=0xc8;}else{_0x51d88d=0xce;}_0xf5221d['status'](_0x51d88d);return _0xf5221d[_0x9fb2('0x9')](_0x9fb2('0xa'),_0x8ac7ae+'-'+_0x40c418+'/'+_0x2b06eb)[_0x9fb2('0xb')](_0x2f9a3a);}return null;};}function handleError(_0x3e4f91,_0x33d663){_0x33d663=_0x33d663||0x1f4;return function(_0x48d60b){logger[_0x9fb2('0xc')](_0x48d60b[_0x9fb2('0xd')]);if(_0x48d60b[_0x9fb2('0xe')]){delete _0x48d60b[_0x9fb2('0xe')];}_0x3e4f91[_0x9fb2('0xf')](_0x33d663)[_0x9fb2('0x10')](_0x48d60b);};}function getRealtimeAgents(){return new Promise(function(_0x5547e9,_0x2e0e64){return amiClient[_0x9fb2('0x11')](_0x9fb2('0x12'),{})[_0x9fb2('0x13')](function(_0x1eea89){if(_0x1eea89[_0x9fb2('0xc')])throw new Error(_0x9fb2('0x14'));var _0x4b3a18=_0x1eea89['result'];return routingClient[_0x9fb2('0x11')](_0x9fb2('0x12'),{})[_0x9fb2('0x13')](function(_0x41eae3){if(_0x41eae3['error'])throw new Error(_0x9fb2('0x15'));var _0xc881a5=_0x41eae3[_0x9fb2('0x16')];return _0x5547e9(_[_0x9fb2('0x17')]({},_0x4b3a18,_0xc881a5));});})[_0x9fb2('0x18')](function(_0xa95891){_0x2e0e64(_0xa95891);});});}function getRealtimeQueues(_0x2d1b80,_0x260024){return new Promise(function(_0x2702a5,_0x3669b5){var _0x4a0937=_0x260024===_0x9fb2('0x19')?amiClient:routingClient;return _0x4a0937[_0x9fb2('0x11')](_[_0x9fb2('0x1a')](_0x260024)+_0x9fb2('0x1b'),_0x2d1b80)[_0x9fb2('0x13')](function(_0x21b953){if(_0x21b953[_0x9fb2('0xc')])throw new Error(util['format'](_0x9fb2('0x1c'),_0x260024));return _0x2702a5(_0x21b953['result']);})['catch'](function(_0x38d93c){_0x3669b5(_0x38d93c);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0xe78e08,_0xebdc03){return amiClient[_0x9fb2('0x11')](_0x9fb2('0x1d'),{})['then'](function(_0x4b317f){if(_0x4b317f[_0x9fb2('0xc')])throw new Error(_0x9fb2('0x1e'));return _0xe78e08(_0x4b317f[_0x9fb2('0x16')]);})[_0x9fb2('0x18')](function(_0x13ffac){_0xebdc03(_0x13ffac);});});}function initializeQueues(_0x4e8599,_0x5a4731,_0x36cfe8,_0x1fe93c){var _0x4be74d=['loggedIn','available',_0x9fb2('0x1f'),_0x9fb2('0x20'),_0x9fb2('0x21')];if(_0x36cfe8===_0x9fb2('0x19')&&_0x1fe93c==='outbound'){_0x4be74d[_0x9fb2('0x22')](_0x9fb2('0x23'),_0x9fb2('0x24'),_0x9fb2('0x25'),_0x9fb2('0x26'),_0x9fb2('0x27'),_0x9fb2('0x28'),_0x9fb2('0x29'),_0x9fb2('0x2a'),'erlangCalls',_0x9fb2('0x2b'),_0x9fb2('0x2c'),_0x9fb2('0x2d'),_0x9fb2('0x2e'),_0x9fb2('0x2f'),_0x9fb2('0x30'),'predictiveIntervalAvailable',_0x9fb2('0x31'),_0x9fb2('0x32'),_0x9fb2('0x33'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0x9fb2('0x34'));}return _0x4e8599[_0x9fb2('0x35')](function(_0x25483e){var _0x529e8d=_0x25483e[_0x9fb2('0x36')]({'plain':!![]});_0x529e8d[_0x9fb2('0x37')]=[];_0x529e8d['paused']=0x0;_0x529e8d[_0x9fb2('0x38')]=0x0;_0x529e8d[_0x9fb2('0x39')]=0x0;_0x529e8d['available']=0x0;_0x529e8d[_0x9fb2('0x1f')]=0x0;if(_0x36cfe8===_0x9fb2('0x19')){_0x529e8d['talking']=0x0;_0x529e8d['busy']=0x0;if(_0x1fe93c===_0x9fb2('0x3a')){_0x529e8d[_0x9fb2('0x23')]=0x0;_0x529e8d[_0x9fb2('0x24')]=0x0;}}var _0x4d75bd=_[_0x9fb2('0x3b')](_0x5a4731,['id',_0x529e8d['id']]);if(_0x4d75bd)_[_0x9fb2('0x17')](_0x529e8d,_[_0x9fb2('0x3c')](_0x4d75bd,_0x4be74d));return _0x529e8d;});}function updateAgentVoiceStatus(_0x24a597,_0x1074e5,_0x291dc0){var _0x4e03f1=_['filter'](_0x291dc0,[_0x9fb2('0x3d'),_0x1074e5[_0x9fb2('0xe')]]);if(_0x4e03f1[_0x9fb2('0x3e')]===0x0)return _0x24a597[_0x9fb2('0x3f')]=!![];if(_[_0x9fb2('0x40')](_0x4e03f1,[_0x9fb2('0x41'),_0x24a597[_0x9fb2('0x42')]['toString']()]))return _0x24a597['talking']=!![];if(!_0x24a597[_0x9fb2('0x20')])return _0x24a597[_0x9fb2('0x3f')]=!![];}function getVoiceQueueAgents(_0x28d5f6,_0x286f9b,_0x1cf1e6,_0x27250e){var _0x3e226f=_['find'](_0x286f9b,['id',_0x28d5f6['id']]);if(!_0x3e226f)return _0x28d5f6;return _0x3e226f[_0x9fb2('0x43')]({'raw':!![]})['then'](function(_0x2ac47e){for(var _0x57fbee=0x0;_0x57fbee<_0x2ac47e[_0x9fb2('0x3e')];_0x57fbee++){var _0x1db6e7=_['find'](_0x1cf1e6,['id',_0x2ac47e[_0x57fbee]['UserId']]);if(!_0x1db6e7){_0x1db6e7={'id':_0x2ac47e[_0x57fbee]['UserId'],'name':_0x2ac47e[_0x57fbee][_0x9fb2('0x44')],'accountcode':'','online':![]};}var _0x3d4790={'id':_0x1db6e7['id'],'name':_0x1db6e7[_0x9fb2('0xe')],'internal':_0x1db6e7[_0x9fb2('0x45')],'online':Boolean(_0x1db6e7[_0x9fb2('0x46')]),'paused':Boolean(_0x2ac47e[_0x57fbee][_0x9fb2('0x21')])};if(_0x1db6e7[_0x9fb2('0x47')]==='talking')updateAgentVoiceStatus(_0x3d4790,_0x28d5f6,_0x27250e);if(_0x3d4790[_0x9fb2('0x46')])_0x28d5f6['loggedInDb']++;if(_0x3d4790[_0x9fb2('0x3f')])_0x28d5f6[_0x9fb2('0x3f')]++;if(_0x3d4790[_0x9fb2('0x21')]&&!_0x3d4790[_0x9fb2('0x3f')]&&!_0x3d4790[_0x9fb2('0x20')])_0x28d5f6['paused']++;_0x28d5f6[_0x9fb2('0x37')][_0x9fb2('0x22')](_0x3d4790);}return _0x28d5f6;});}function getQueueAgents(_0x40cad3,_0x28a7cc,_0x2750c1){var _0x35785a='User'+_[_0x9fb2('0x1a')](_0x2750c1)+'Queue';var _0x4bcb40=_0x2750c1+_0x9fb2('0x48');return db[_0x35785a][_0x9fb2('0x49')]({'where':{[_[_0x9fb2('0x1a')](_0x2750c1)+_0x9fb2('0x4a')]:_0x40cad3['id']},'raw':!![]})['then'](function(_0x225986){for(var _0x4249eb=0x0;_0x4249eb<_0x225986[_0x9fb2('0x3e')];_0x4249eb++){var _0x3bb40a=_[_0x9fb2('0x3b')](_0x28a7cc,['id',_0x225986[_0x4249eb][_0x9fb2('0x44')]]);if(!_0x3bb40a){_0x3bb40a={'id':_0x225986[_0x4249eb]['UserId'],'name':_0x225986[_0x4249eb][_0x9fb2('0x44')],'online':![],['pauseField']:![]};}var _0xb6a3a0={'id':_0x3bb40a['id'],'name':_0x3bb40a[_0x9fb2('0xe')],'online':Boolean(_0x3bb40a[_0x9fb2('0x46')]),'paused':Boolean(_0x3bb40a[_0x4bcb40])};if(_0xb6a3a0['online'])_0x40cad3[_0x9fb2('0x38')]++;_0x40cad3[_0x9fb2('0x37')][_0x9fb2('0x22')](_0xb6a3a0);}return _0x40cad3;});}function isIdle(_0x5ae5e9){return _0x5ae5e9==='idle'||_0x5ae5e9==='unknown'||_0x5ae5e9==='unavailable'||_0x5ae5e9===_0x9fb2('0x4b')||_[_0x9fb2('0x4c')](_0x5ae5e9);}function isAgentPaused(_0x4edf62,_0xba14d2){var _0x4a66f6=[_0x4edf62[_0x9fb2('0x4d')],_0x4edf62['faxPause'],_0x4edf62[_0x9fb2('0x4e')],_0x4edf62['openchannelPause'],_0x4edf62[_0x9fb2('0x4f')],_0x4edf62[_0x9fb2('0x50')],_0x4edf62[_0x9fb2('0x51')]];if(!_0xba14d2)return _[_0x9fb2('0x52')](_0x4a66f6);var _0x71690=_[_0x9fb2('0x53')](_0x4a66f6);return _0x71690[_0x9fb2('0x3e')]>0x0&&_0x71690[_0x9fb2('0x3e')]<_0x4a66f6[_0x9fb2('0x3e')]?!![]:![];}function isAgentIdle(_0x58d992){if(_0x58d992['voiceStatus']!==_0x9fb2('0x54')&&_0x58d992[_0x9fb2('0x50')]){_0x58d992[_0x9fb2('0x47')]=_0x9fb2('0x55');return![];}return _[_0x9fb2('0x52')]([_0x58d992[_0x9fb2('0x56')],_0x58d992[_0x9fb2('0x57')],_0x58d992[_0x9fb2('0x58')],_0x58d992['openchannelStatus'],_0x58d992[_0x9fb2('0x59')],_0x58d992[_0x9fb2('0x47')],_0x58d992['whatsappStatus']],isIdle);}function getAgentStatus(_0x3e4699){var _0x42f68d=_0x9fb2('0x5a');if(isAgentPaused(_0x3e4699))_0x42f68d='pause';else if(isAgentPaused(_0x3e4699,!![]))_0x42f68d=_0x9fb2('0x5b');else if(isAgentIdle(_0x3e4699))_0x42f68d=_0x9fb2('0x54');else _0x42f68d=_0x9fb2('0x3f');return _0x42f68d;}exports[_0x9fb2('0x5c')]=function(_0x5f0bf2,_0x435b69){var _0x17f038={'count':0x0,'rows':[]},_0x4b35d8={},_0x382af1,_0x30a6db,_0x4e18ff=[_0x9fb2('0x5d'),_0x9fb2('0x46'),_0x9fb2('0x5e'),_0x9fb2('0x5f'),_0x9fb2('0x60'),_0x9fb2('0x5f'),_0x9fb2('0x42'),_0x9fb2('0x61'),'chatPause',_0x9fb2('0x62'),_0x9fb2('0x4e'),_0x9fb2('0x4f'),_0x9fb2('0x51'),'faxPause',_0x9fb2('0x50'),_0x9fb2('0x63'),_0x9fb2('0x64'),_0x9fb2('0x65'),_0x9fb2('0x66'),'whatsappCapacity',_0x9fb2('0x67'),'chatCurrentCapacity','openchannelCurrentCapacity',_0x9fb2('0x68'),_0x9fb2('0x69'),_0x9fb2('0x6a'),_0x9fb2('0x6b'),_0x9fb2('0x56'),'openchannelStatus','mailStatus',_0x9fb2('0x59'),_0x9fb2('0x6c'),_0x9fb2('0x57'),_0x9fb2('0x47'),'chatStatusTime','openchannelStatusTime',_0x9fb2('0x6d'),_0x9fb2('0x6e'),_0x9fb2('0x6f'),_0x9fb2('0x70'),_0x9fb2('0x71'),_0x9fb2('0x3d'),'destconnectedlinenum','screenrecording',_0x9fb2('0x72'),'phoneBarEnableAutomaticScreenRecording',_0x9fb2('0x73')],_0x202bf0=[_0x9fb2('0x4d'),'openchannelPause','mailPause',_0x9fb2('0x4f'),_0x9fb2('0x51'),_0x9fb2('0x74'),_0x9fb2('0x50'),'online'];Promise[_0x9fb2('0x75')]()['then'](function(){var _0x4d0d89=_[_0x9fb2('0x35')](db[_0x9fb2('0x76')][_0x9fb2('0x77')],function(_0x575445){return{'name':_0x575445['fieldName'],'type':_0x575445[_0x9fb2('0x78')][_0x9fb2('0x79')]};});_0x5f0bf2[_0x9fb2('0x7a')]['role']=_0x9fb2('0x7b');_0x5f0bf2['query'][_0x9fb2('0x46')]=!![];_0x4b35d8=qs[_0x9fb2('0x7c')](_0x4d0d89,_0x5f0bf2);_0x4b35d8[_0x9fb2('0x7d')]=!![];if(_0x5f0bf2[_0x9fb2('0x7e')][_0x9fb2('0x7f')]===_0x9fb2('0x7e')){var _0x56731d={'params':{'id':_0x5f0bf2['user'][_0x9fb2('0x80')]},'query':{'section':_0x9fb2('0x12'),'role':_0x9fb2('0x7b'),'online':!![],'nolimit':_0x5f0bf2['query'][_0x9fb2('0x81')],'sort':_0x5f0bf2[_0x9fb2('0x7a')][_0x9fb2('0x82')],'filter':_0x5f0bf2['query']['filter']},'raw':!![]};return db[_0x9fb2('0x83')][_0x9fb2('0x84')](_0x56731d);}return db[_0x9fb2('0x76')]['findAndCountAll'](_0x4b35d8);})[_0x9fb2('0x13')](function(_0x4fc38d){_0x17f038['count']=_0x4fc38d[_0x9fb2('0x8')];_0x382af1=_0x4fc38d['rows'];return getRealtimeAgents();})[_0x9fb2('0x13')](function(_0x55f18f){_0x30a6db=_0x55f18f[_0x9fb2('0x85')];return _0x382af1[_0x9fb2('0x35')](function(_0x3a2098){var _0x1bdcfc=_[_0x9fb2('0x3b')](_0x30a6db,['id',_0x3a2098['id']]);if(_0x1bdcfc)_[_0x9fb2('0x17')](_0x3a2098,_[_0x9fb2('0x3c')](_[_0x9fb2('0x86')](_0x1bdcfc,_0x202bf0),_0x4e18ff));_0x3a2098[_0x9fb2('0x87')]=getAgentStatus(_0x3a2098);return _0x3a2098;});})['then'](function(_0x35d8c3){if(_0x5f0bf2[_0x9fb2('0x7a')][_0x9fb2('0x88')]){var _0x57de0b=_['filter'](_0x35d8c3,[_0x9fb2('0x87'),_0x5f0bf2[_0x9fb2('0x7a')]['globalStatusFilter']]);if(_0x5f0bf2[_0x9fb2('0x7a')]['pauseTypeFilter']){_0x57de0b=_[_0x9fb2('0x53')](_0x57de0b,[_0x9fb2('0x60'),_0x5f0bf2['query']['pauseTypeFilter']]);}}_0x17f038[_0x9fb2('0x85')]=_0x57de0b||_0x35d8c3;return _0x17f038;})[_0x9fb2('0x13')](respondWithFilteredResult(_0x435b69,_0x4b35d8))[_0x9fb2('0x18')](handleError(_0x435b69,null));};exports['getQueues']=function(_0x1a7122,_0x12f120){var _0x513de3=[_0x9fb2('0x89'),'chat','sms',_0x9fb2('0x8a'),'fax',_0x9fb2('0x8b'),'voice'];var _0x2dae72={'count':0x0,'rows':[]},_0x34ffdf={},_0x5a8235,_0x5d491e,_0x410d20,_0xc34d62,_0x9b2e5;Promise[_0x9fb2('0x75')]()[_0x9fb2('0x13')](function(){if(_0x1a7122['query']['channel']){if(!_[_0x9fb2('0x8c')](_0x513de3,_0x1a7122[_0x9fb2('0x7a')]['channel'][_0x9fb2('0x8d')]()))throw new Error(_0x9fb2('0x8e'));_0x5a8235=_0x1a7122[_0x9fb2('0x7a')]['channel'][_0x9fb2('0x8d')]();}var _0x38afae=_[_0x9fb2('0x1a')](_0x5a8235)+'Queue';var _0x4b65e9=_[_0x9fb2('0x35')](db[_0x38afae][_0x9fb2('0x77')],function(_0x5cdd4e){return{'name':_0x5cdd4e[_0x9fb2('0x8f')],'type':_0x5cdd4e[_0x9fb2('0x78')][_0x9fb2('0x79')]};});_0x34ffdf=qs[_0x9fb2('0x7c')](_0x4b65e9,_0x1a7122);if(_0x1a7122[_0x9fb2('0x7e')][_0x9fb2('0x7f')]===_0x9fb2('0x7e')){var _0xcdb39a={'params':{'id':_0x1a7122['user'][_0x9fb2('0x80')]},'query':{'section':_0x5a8235===_0x9fb2('0x19')&&_0x1a7122[_0x9fb2('0x7a')][_0x9fb2('0x78')]===_0x9fb2('0x3a')?'QueueCampaigns':_[_0x9fb2('0x1a')](_0x5a8235)+'Queues','type':_0x1a7122[_0x9fb2('0x7a')]['type'],'nolimit':!![],'sort':_0x9fb2('0xe'),'filter':_0x1a7122[_0x9fb2('0x7a')][_0x9fb2('0x53')]}};return db['UserProfile'][_0x9fb2('0x84')](_0xcdb39a);}return db[_0x38afae][_0x9fb2('0x90')](_0x34ffdf);})[_0x9fb2('0x13')](function(_0x43c65c){_0x2dae72[_0x9fb2('0x8')]=_0x43c65c[_0x9fb2('0x8')];_0x5d491e=_0x43c65c[_0x9fb2('0x85')];return getRealtimeQueues(_0x1a7122,_0x5a8235);})[_0x9fb2('0x13')](function(_0x4fefad){_0xc34d62=_0x4fefad[_0x9fb2('0x85')];return getRealtimeAgents();})[_0x9fb2('0x13')](function(_0x534e2e){_0x410d20=_0x534e2e[_0x9fb2('0x85')];if(_0x5a8235!=_0x9fb2('0x19'))return;return getRealtimeVoiceQueueChannels();})[_0x9fb2('0x13')](function(_0x3f7465){_0x9b2e5=_0x3f7465?_0x3f7465[_0x9fb2('0x85')]:[];return initializeQueues(_0x5d491e,_0xc34d62,_0x5a8235,_0x1a7122['query']['type']);})[_0x9fb2('0x13')](function(_0x58cc8d){var _0x3466ea=_0x58cc8d[_0x9fb2('0x35')](function(_0x52f1d5){if(_0x5a8235==='voice')return getVoiceQueueAgents(_0x52f1d5,_0x5d491e,_0x410d20,_0x9b2e5);else return getQueueAgents(_0x52f1d5,_0x410d20,_0x5a8235);});return Promise[_0x9fb2('0x91')](_0x3466ea);})[_0x9fb2('0x13')](function(_0x337f93){_0x2dae72[_0x9fb2('0x85')]=_0x337f93;return _0x2dae72;})['then'](respondWithFilteredResult(_0x12f120,_0x34ffdf))[_0x9fb2('0x18')](handleError(_0x12f120,null));}; \ No newline at end of file +var _0xfb85=['openchannel','whatsapp','channel','includes','QueueCampaigns','UserProfile','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','../../mysqldb','http','offset','undefined','count','status','set','Content-Range','json','stack','name','send','request','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','merge','voice','startCase','Queues','then','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','VoiceQueuesChannels','loggedIn','available','waiting','outbound','push','originated','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','get','agents','paused','loggedInDb','talking','pTalking','pick','filter','queue','busy','some','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','User','Queue','Pause','findAll','length','find','idle','unknown','unavailable','isNil','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','*pause','getAgents','lastLoginAt','lastPauseAt','pauseType','chatPause','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','smsStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','resolve','map','rawAttributes','fieldName','type','query','role','getOptions','raw','user','userProfileId','agent','sort','getResources','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','chat'];(function(_0x104027,_0x1ec787){var _0x4c2ada=function(_0x5dacfb){while(--_0x5dacfb){_0x104027['push'](_0x104027['shift']());}};_0x4c2ada(++_0x1ec787);}(_0xfb85,0x12e));var _0x5fb8=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xfb85[_0x422905];return _0x33dc6c;};'use strict';var util=require(_0x5fb8('0x0'));var _=require(_0x5fb8('0x1'));var jayson=require(_0x5fb8('0x2'));var qs=require(_0x5fb8('0x3'));var logger=require(_0x5fb8('0x4'))('api');var db=require(_0x5fb8('0x5'))['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson['client'][_0x5fb8('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x110df4,_0x136060){return function(_0x2bee8b){if(_0x2bee8b){var _0x5abea1=typeof _0x136060[_0x5fb8('0x7')]==='undefined'&&typeof _0x136060['limit']===_0x5fb8('0x8');var _0x1023bd=_0x2bee8b['count'];var _0x304cce=_0x5abea1?0x0:_0x136060[_0x5fb8('0x7')];var _0x297ed7=_0x5abea1?_0x2bee8b[_0x5fb8('0x9')]:_0x136060[_0x5fb8('0x7')]+_0x136060['limit'];var _0x6215db;if(_0x297ed7>=_0x1023bd){_0x297ed7=_0x1023bd;_0x6215db=0xc8;}else{_0x6215db=0xce;}_0x110df4[_0x5fb8('0xa')](_0x6215db);return _0x110df4[_0x5fb8('0xb')](_0x5fb8('0xc'),_0x304cce+'-'+_0x297ed7+'/'+_0x1023bd)[_0x5fb8('0xd')](_0x2bee8b);}return null;};}function handleError(_0x2f0c17,_0x1c5ce0){_0x1c5ce0=_0x1c5ce0||0x1f4;return function(_0x3ca3d8){logger['error'](_0x3ca3d8[_0x5fb8('0xe')]);if(_0x3ca3d8['name']){delete _0x3ca3d8[_0x5fb8('0xf')];}_0x2f0c17[_0x5fb8('0xa')](_0x1c5ce0)[_0x5fb8('0x10')](_0x3ca3d8);};}function getRealtimeAgents(){return new Promise(function(_0x96bfe4,_0x39c0e1){return amiClient[_0x5fb8('0x11')]('Agents',{})['then'](function(_0x570569){if(_0x570569[_0x5fb8('0x12')])throw new Error(_0x5fb8('0x13'));var _0x4bc9f6=_0x570569[_0x5fb8('0x14')];return routingClient[_0x5fb8('0x11')](_0x5fb8('0x15'),{})['then'](function(_0x5b1ce2){if(_0x5b1ce2[_0x5fb8('0x12')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x2c5057=_0x5b1ce2[_0x5fb8('0x14')];return _0x96bfe4(_[_0x5fb8('0x16')]({},_0x4bc9f6,_0x2c5057));});})['catch'](function(_0x4fa4dd){_0x39c0e1(_0x4fa4dd);});});}function getRealtimeQueues(_0x592250,_0x1f6925){return new Promise(function(_0x75a3fe,_0x334f69){var _0x141ed3=_0x1f6925===_0x5fb8('0x17')?amiClient:routingClient;return _0x141ed3[_0x5fb8('0x11')](_[_0x5fb8('0x18')](_0x1f6925)+_0x5fb8('0x19'),_0x592250)[_0x5fb8('0x1a')](function(_0x5ed8ac){if(_0x5ed8ac[_0x5fb8('0x12')])throw new Error(util['format'](_0x5fb8('0x1b'),_0x1f6925));return _0x75a3fe(_0x5ed8ac[_0x5fb8('0x14')]);})[_0x5fb8('0x1c')](function(_0x50b97b){_0x334f69(_0x50b97b);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x5ee98a,_0x3c3e8b){return amiClient[_0x5fb8('0x11')](_0x5fb8('0x1d'),{})[_0x5fb8('0x1a')](function(_0x2bcaf2){if(_0x2bcaf2[_0x5fb8('0x12')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x5ee98a(_0x2bcaf2[_0x5fb8('0x14')]);})[_0x5fb8('0x1c')](function(_0x3f15cb){_0x3c3e8b(_0x3f15cb);});});}function initializeQueues(_0x4a8eff,_0x5988d0,_0x458f50,_0x560145){var _0x4c6c13=[_0x5fb8('0x1e'),_0x5fb8('0x1f'),_0x5fb8('0x20'),'talking','paused'];if(_0x458f50===_0x5fb8('0x17')&&_0x560145===_0x5fb8('0x21')){_0x4c6c13[_0x5fb8('0x22')]('pTalking',_0x5fb8('0x23'),'message',_0x5fb8('0x24'),_0x5fb8('0x25'),_0x5fb8('0x26'),_0x5fb8('0x27'),_0x5fb8('0x28'),_0x5fb8('0x29'),'erlangCallToSecond',_0x5fb8('0x2a'),_0x5fb8('0x2b'),_0x5fb8('0x2c'),_0x5fb8('0x2d'),_0x5fb8('0x2e'),_0x5fb8('0x2f'),_0x5fb8('0x30'),_0x5fb8('0x31'),'predictiveIntervalDroppedCallsTimeout',_0x5fb8('0x32'),_0x5fb8('0x33'),_0x5fb8('0x34'));}return _0x4a8eff['map'](function(_0x22b2d3){var _0x70dafa=_0x22b2d3[_0x5fb8('0x35')]({'plain':!![]});_0x70dafa[_0x5fb8('0x36')]=[];_0x70dafa[_0x5fb8('0x37')]=0x0;_0x70dafa[_0x5fb8('0x38')]=0x0;_0x70dafa[_0x5fb8('0x1e')]=0x0;_0x70dafa[_0x5fb8('0x1f')]=0x0;_0x70dafa[_0x5fb8('0x20')]=0x0;if(_0x458f50===_0x5fb8('0x17')){_0x70dafa[_0x5fb8('0x39')]=0x0;_0x70dafa['busy']=0x0;if(_0x560145===_0x5fb8('0x21')){_0x70dafa[_0x5fb8('0x3a')]=0x0;_0x70dafa[_0x5fb8('0x23')]=0x0;}}var _0xe1cc0b=_['find'](_0x5988d0,['id',_0x70dafa['id']]);if(_0xe1cc0b)_[_0x5fb8('0x16')](_0x70dafa,_[_0x5fb8('0x3b')](_0xe1cc0b,_0x4c6c13));return _0x70dafa;});}function updateAgentVoiceStatus(_0x3dd9ae,_0xb919fb,_0x5bf3ab){var _0x3c83c1=_[_0x5fb8('0x3c')](_0x5bf3ab,[_0x5fb8('0x3d'),_0xb919fb[_0x5fb8('0xf')]]);if(_0x3c83c1['length']===0x0)return _0x3dd9ae[_0x5fb8('0x3e')]=!![];if(_[_0x5fb8('0x3f')](_0x3c83c1,[_0x5fb8('0x40'),_0x3dd9ae[_0x5fb8('0x41')][_0x5fb8('0x42')]()]))return _0x3dd9ae[_0x5fb8('0x39')]=!![];if(!_0x3dd9ae['talking'])return _0x3dd9ae[_0x5fb8('0x3e')]=!![];}function getVoiceQueueAgents(_0x1477ee,_0x471d27,_0x4b6676,_0x28a08b){var _0x1e08e2=_['find'](_0x471d27,['id',_0x1477ee['id']]);if(!_0x1e08e2)return _0x1477ee;return _0x1e08e2[_0x5fb8('0x43')]({'raw':!![]})[_0x5fb8('0x1a')](function(_0x32c0ab){for(var _0x32c773=0x0;_0x32c773<_0x32c0ab['length'];_0x32c773++){var _0x5ca186=_['find'](_0x4b6676,['id',_0x32c0ab[_0x32c773][_0x5fb8('0x44')]]);if(!_0x5ca186){_0x5ca186={'id':_0x32c0ab[_0x32c773][_0x5fb8('0x44')],'name':_0x32c0ab[_0x32c773][_0x5fb8('0x44')],'accountcode':'','online':![]};}var _0x1665d9={'id':_0x5ca186['id'],'name':_0x5ca186[_0x5fb8('0xf')],'internal':_0x5ca186[_0x5fb8('0x45')],'online':Boolean(_0x5ca186[_0x5fb8('0x46')]),'paused':Boolean(_0x32c0ab[_0x32c773][_0x5fb8('0x37')])};if(_0x5ca186['voiceStatus']==='talking')updateAgentVoiceStatus(_0x1665d9,_0x1477ee,_0x28a08b);if(_0x1665d9[_0x5fb8('0x46')])_0x1477ee[_0x5fb8('0x38')]++;if(_0x1665d9[_0x5fb8('0x3e')])_0x1477ee['busy']++;if(_0x1665d9[_0x5fb8('0x37')]&&!_0x1665d9[_0x5fb8('0x3e')]&&!_0x1665d9[_0x5fb8('0x39')])_0x1477ee['paused']++;_0x1477ee['agents']['push'](_0x1665d9);}return _0x1477ee;});}function getQueueAgents(_0x16cf1e,_0x5b4382,_0x32dfaf){var _0x3abc29=_0x5fb8('0x47')+_[_0x5fb8('0x18')](_0x32dfaf)+_0x5fb8('0x48');var _0x1d3c5c=_0x32dfaf+_0x5fb8('0x49');return db[_0x3abc29][_0x5fb8('0x4a')]({'where':{[_[_0x5fb8('0x18')](_0x32dfaf)+'QueueId']:_0x16cf1e['id']},'raw':!![]})[_0x5fb8('0x1a')](function(_0x317427){for(var _0x5d4743=0x0;_0x5d4743<_0x317427[_0x5fb8('0x4b')];_0x5d4743++){var _0x3e7566=_[_0x5fb8('0x4c')](_0x5b4382,['id',_0x317427[_0x5d4743][_0x5fb8('0x44')]]);if(!_0x3e7566){_0x3e7566={'id':_0x317427[_0x5d4743][_0x5fb8('0x44')],'name':_0x317427[_0x5d4743][_0x5fb8('0x44')],'online':![],['pauseField']:![]};}var _0x4a1c14={'id':_0x3e7566['id'],'name':_0x3e7566[_0x5fb8('0xf')],'online':Boolean(_0x3e7566[_0x5fb8('0x46')]),'paused':Boolean(_0x3e7566[_0x1d3c5c])};if(_0x4a1c14['online'])_0x16cf1e[_0x5fb8('0x38')]++;_0x16cf1e['agents'][_0x5fb8('0x22')](_0x4a1c14);}return _0x16cf1e;});}function isIdle(_0x391f50){return _0x391f50===_0x5fb8('0x4d')||_0x391f50===_0x5fb8('0x4e')||_0x391f50===_0x5fb8('0x4f')||_0x391f50==='ringing'||_[_0x5fb8('0x50')](_0x391f50);}function isAgentPaused(_0x29361f,_0xfc8a79){var _0x3e764d=[_0x29361f['chatPause'],_0x29361f[_0x5fb8('0x51')],_0x29361f[_0x5fb8('0x52')],_0x29361f[_0x5fb8('0x53')],_0x29361f[_0x5fb8('0x54')],_0x29361f[_0x5fb8('0x55')],_0x29361f[_0x5fb8('0x56')]];if(!_0xfc8a79)return _[_0x5fb8('0x57')](_0x3e764d);var _0x5097fd=_[_0x5fb8('0x3c')](_0x3e764d);return _0x5097fd[_0x5fb8('0x4b')]>0x0&&_0x5097fd[_0x5fb8('0x4b')]<_0x3e764d[_0x5fb8('0x4b')]?!![]:![];}function isAgentIdle(_0x188ab2){if(_0x188ab2[_0x5fb8('0x58')]!=='idle'&&_0x188ab2[_0x5fb8('0x55')]){_0x188ab2[_0x5fb8('0x58')]=_0x5fb8('0x59');return![];}return _['every']([_0x188ab2[_0x5fb8('0x5a')],_0x188ab2[_0x5fb8('0x5b')],_0x188ab2[_0x5fb8('0x5c')],_0x188ab2[_0x5fb8('0x5d')],_0x188ab2['smsStatus'],_0x188ab2['voiceStatus'],_0x188ab2[_0x5fb8('0x5e')]],isIdle);}function getAgentStatus(_0x4edc62){var _0x231a99=_0x5fb8('0x4e');if(isAgentPaused(_0x4edc62))_0x231a99='pause';else if(isAgentPaused(_0x4edc62,!![]))_0x231a99=_0x5fb8('0x5f');else if(isAgentIdle(_0x4edc62))_0x231a99=_0x5fb8('0x4d');else _0x231a99='busy';return _0x231a99;}exports[_0x5fb8('0x60')]=function(_0x54c042,_0x1af081){var _0x4dd7bf={'count':0x0,'rows':[]},_0x22df0f={},_0x1ffd97,_0x18340a,_0x16f36e=['userpic',_0x5fb8('0x46'),_0x5fb8('0x61'),_0x5fb8('0x62'),_0x5fb8('0x63'),'lastPauseAt','internal','address',_0x5fb8('0x64'),_0x5fb8('0x53'),_0x5fb8('0x52'),_0x5fb8('0x54'),'whatsappPause','faxPause',_0x5fb8('0x55'),'chatCapacity',_0x5fb8('0x65'),_0x5fb8('0x66'),_0x5fb8('0x67'),'whatsappCapacity',_0x5fb8('0x68'),_0x5fb8('0x69'),_0x5fb8('0x6a'),_0x5fb8('0x6b'),_0x5fb8('0x6c'),'whatsappCurrentCapacity',_0x5fb8('0x6d'),_0x5fb8('0x5a'),_0x5fb8('0x5d'),_0x5fb8('0x5c'),_0x5fb8('0x6e'),_0x5fb8('0x5e'),_0x5fb8('0x5b'),_0x5fb8('0x58'),_0x5fb8('0x6f'),_0x5fb8('0x70'),_0x5fb8('0x71'),_0x5fb8('0x72'),_0x5fb8('0x73'),_0x5fb8('0x74'),_0x5fb8('0x75'),_0x5fb8('0x3d'),_0x5fb8('0x76'),_0x5fb8('0x77'),'phoneBarEnableScreenRecordingByAgent',_0x5fb8('0x78'),_0x5fb8('0x79')],_0x347091=[_0x5fb8('0x64'),_0x5fb8('0x53'),'mailPause',_0x5fb8('0x54'),_0x5fb8('0x56'),_0x5fb8('0x51'),_0x5fb8('0x55'),_0x5fb8('0x46')];Promise[_0x5fb8('0x7a')]()[_0x5fb8('0x1a')](function(){var _0x10e336=_[_0x5fb8('0x7b')](db[_0x5fb8('0x47')][_0x5fb8('0x7c')],function(_0x1eb025){return{'name':_0x1eb025[_0x5fb8('0x7d')],'type':_0x1eb025[_0x5fb8('0x7e')]['key']};});_0x54c042[_0x5fb8('0x7f')][_0x5fb8('0x80')]='agent';_0x54c042['query'][_0x5fb8('0x46')]=!![];_0x22df0f=qs[_0x5fb8('0x81')](_0x10e336,_0x54c042);_0x22df0f[_0x5fb8('0x82')]=!![];if(_0x54c042[_0x5fb8('0x83')][_0x5fb8('0x80')]===_0x5fb8('0x83')){var _0x3b5be4={'params':{'id':_0x54c042[_0x5fb8('0x83')][_0x5fb8('0x84')]},'query':{'section':_0x5fb8('0x15'),'role':_0x5fb8('0x85'),'online':!![],'nolimit':_0x54c042[_0x5fb8('0x7f')]['nolimit'],'sort':_0x54c042[_0x5fb8('0x7f')][_0x5fb8('0x86')],'filter':_0x54c042[_0x5fb8('0x7f')][_0x5fb8('0x3c')]},'raw':!![]};return db['UserProfile'][_0x5fb8('0x87')](_0x3b5be4);}return db[_0x5fb8('0x47')]['findAndCountAll'](_0x22df0f);})[_0x5fb8('0x1a')](function(_0x269d86){_0x4dd7bf[_0x5fb8('0x9')]=_0x269d86[_0x5fb8('0x9')];_0x1ffd97=_0x269d86[_0x5fb8('0x88')];return getRealtimeAgents();})[_0x5fb8('0x1a')](function(_0x704ed2){_0x18340a=_0x704ed2[_0x5fb8('0x88')];return _0x1ffd97[_0x5fb8('0x7b')](function(_0x15f990){var _0x406d36=_[_0x5fb8('0x4c')](_0x18340a,['id',_0x15f990['id']]);if(_0x406d36)_[_0x5fb8('0x16')](_0x15f990,_[_0x5fb8('0x3b')](_[_0x5fb8('0x89')](_0x406d36,_0x347091),_0x16f36e));_0x15f990[_0x5fb8('0x8a')]=getAgentStatus(_0x15f990);return _0x15f990;});})['then'](function(_0x177d91){if(_0x54c042[_0x5fb8('0x7f')][_0x5fb8('0x8b')]){var _0x2840c1=_[_0x5fb8('0x3c')](_0x177d91,['globalStatus',_0x54c042['query'][_0x5fb8('0x8b')]]);if(_0x54c042[_0x5fb8('0x7f')][_0x5fb8('0x8c')]){_0x2840c1=_[_0x5fb8('0x3c')](_0x2840c1,[_0x5fb8('0x63'),_0x54c042['query'][_0x5fb8('0x8c')]]);}}_0x4dd7bf[_0x5fb8('0x88')]=_0x2840c1||_0x177d91;return _0x4dd7bf;})[_0x5fb8('0x1a')](respondWithFilteredResult(_0x1af081,_0x22df0f))[_0x5fb8('0x1c')](handleError(_0x1af081,null));};exports['getQueues']=function(_0x108b8b,_0xeba9d){var _0x3931c9=['mail',_0x5fb8('0x8d'),'sms',_0x5fb8('0x8e'),'fax',_0x5fb8('0x8f'),'voice'];var _0x4c3299={'count':0x0,'rows':[]},_0x52d429={},_0x312a03,_0x44b530,_0x5df4f7,_0x2433b8,_0x11b7f2;Promise[_0x5fb8('0x7a')]()[_0x5fb8('0x1a')](function(){if(_0x108b8b['query'][_0x5fb8('0x90')]){if(!_[_0x5fb8('0x91')](_0x3931c9,_0x108b8b[_0x5fb8('0x7f')][_0x5fb8('0x90')]['toLowerCase']()))throw new Error('Invalid\x20channel');_0x312a03=_0x108b8b[_0x5fb8('0x7f')][_0x5fb8('0x90')]['toLowerCase']();}var _0x5cfb98=_[_0x5fb8('0x18')](_0x312a03)+_0x5fb8('0x48');var _0x3677cc=_[_0x5fb8('0x7b')](db[_0x5cfb98][_0x5fb8('0x7c')],function(_0x599320){return{'name':_0x599320['fieldName'],'type':_0x599320[_0x5fb8('0x7e')]['key']};});_0x52d429=qs[_0x5fb8('0x81')](_0x3677cc,_0x108b8b);if(_0x108b8b[_0x5fb8('0x83')]['role']===_0x5fb8('0x83')){var _0xeab35f={'params':{'id':_0x108b8b['user'][_0x5fb8('0x84')]},'query':{'section':_0x312a03===_0x5fb8('0x17')&&_0x108b8b['query']['type']===_0x5fb8('0x21')?_0x5fb8('0x92'):_[_0x5fb8('0x18')](_0x312a03)+_0x5fb8('0x19'),'type':_0x108b8b[_0x5fb8('0x7f')][_0x5fb8('0x7e')],'nolimit':!![],'sort':_0x5fb8('0xf'),'filter':_0x108b8b[_0x5fb8('0x7f')]['filter']}};return db[_0x5fb8('0x93')]['getResources'](_0xeab35f);}return db[_0x5cfb98]['findAndCountAll'](_0x52d429);})[_0x5fb8('0x1a')](function(_0x58728e){_0x4c3299[_0x5fb8('0x9')]=_0x58728e[_0x5fb8('0x9')];_0x44b530=_0x58728e[_0x5fb8('0x88')];return getRealtimeQueues(_0x108b8b,_0x312a03);})[_0x5fb8('0x1a')](function(_0x1963a9){_0x2433b8=_0x1963a9['rows'];return getRealtimeAgents();})[_0x5fb8('0x1a')](function(_0x14bc6e){_0x5df4f7=_0x14bc6e[_0x5fb8('0x88')];if(_0x312a03!=_0x5fb8('0x17'))return;return getRealtimeVoiceQueueChannels();})[_0x5fb8('0x1a')](function(_0x387b54){_0x11b7f2=_0x387b54?_0x387b54[_0x5fb8('0x88')]:[];return initializeQueues(_0x44b530,_0x2433b8,_0x312a03,_0x108b8b[_0x5fb8('0x7f')][_0x5fb8('0x7e')]);})['then'](function(_0x10d10a){var _0xe1561=_0x10d10a[_0x5fb8('0x7b')](function(_0x2fdffc){if(_0x312a03===_0x5fb8('0x17'))return getVoiceQueueAgents(_0x2fdffc,_0x44b530,_0x5df4f7,_0x11b7f2);else return getQueueAgents(_0x2fdffc,_0x5df4f7,_0x312a03);});return Promise['all'](_0xe1561);})[_0x5fb8('0x1a')](function(_0x37b2a7){_0x4c3299[_0x5fb8('0x88')]=_0x37b2a7;return _0x4c3299;})[_0x5fb8('0x1a')](respondWithFilteredResult(_0xeba9d,_0x52d429))[_0x5fb8('0x1c')](handleError(_0xeba9d,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index dca1883..83da4a1 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x496188,_0x103d13){var _0x194a98=function(_0x2ab477){while(--_0x2ab477){_0x496188['push'](_0x496188['shift']());}};_0x194a98(++_0x103d13);}(_0xe706,0xa3));var _0x6e70=function(_0x5a8315,_0x9ef47d){_0x5a8315=_0x5a8315-0x0;var _0x5cc037=_0xe706[_0x5a8315];return _0x5cc037;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2bbe8d,_0x5156c2){var _0x539e7a=function(_0x518447){while(--_0x518447){_0x2bbe8d['push'](_0x2bbe8d['shift']());}};_0x539e7a(++_0x5156c2);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 075a085..6dd9ba6 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 _0xbb67=['DATE','exports','INTEGER','STRING'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xbb67,0x161));var _0x7bb6=function(_0x6c4d03,_0x234d38){_0x6c4d03=_0x6c4d03-0x0;var _0x4f585d=_0xbb67[_0x6c4d03];return _0x4f585d;};'use strict';var Sequelize=require('sequelize');module[_0x7bb6('0x0')]={'state':{'type':Sequelize[_0x7bb6('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x7bb6('0x2')]},'scheduledat':{'type':Sequelize[_0x7bb6('0x3')]},'uniqueid':{'type':Sequelize[_0x7bb6('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x7bb6('0x3')]},'ringtime':{'type':Sequelize[_0x7bb6('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7bb6('0x2')]},'campaigntype':{'type':Sequelize[_0x7bb6('0x2')]},'membername':{'type':Sequelize[_0x7bb6('0x2')]}}; \ No newline at end of file +var _0x1dcc=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x50d6c0,_0x281431){var _0x560861=function(_0xff5f60){while(--_0xff5f60){_0x50d6c0['push'](_0x50d6c0['shift']());}};_0x560861(++_0x281431);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x18c06e,_0x328f29){_0x18c06e=_0x18c06e-0x0;var _0x5cab1e=_0x1dcc[_0x18c06e];return _0x5cab1e;};'use strict';var Sequelize=require(_0xc1dc('0x0'));module[_0xc1dc('0x1')]={'state':{'type':Sequelize[_0xc1dc('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc1dc('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xc1dc('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xc1dc('0x4')]},'ringtime':{'type':Sequelize[_0xc1dc('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xc1dc('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 3a48b07..ad74fa8 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 _0xdfe0=['api','moment','request-promise','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','lodash'];(function(_0x54a6a8,_0x52ace0){var _0x4cb717=function(_0x486320){while(--_0x486320){_0x54a6a8['push'](_0x54a6a8['shift']());}};_0x4cb717(++_0x52ace0);}(_0xdfe0,0x187));var _0x0dfe=function(_0x1a9245,_0x36605b){_0x1a9245=_0x1a9245-0x0;var _0xd22075=_0xdfe0[_0x1a9245];return _0xd22075;};'use strict';var _=require(_0x0dfe('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0dfe('0x1'));var moment=require(_0x0dfe('0x2'));var BPromise=require('bluebird');var rp=require(_0x0dfe('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0dfe('0x4'));module[_0x0dfe('0x5')]=function(_0x55b67f,_0x56d643){return _0x55b67f[_0x0dfe('0x6')](_0x0dfe('0x7'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d99=['util','../../config/logger','api','request-promise','rimraf','./reportAgentPreview.attributes','exports','report_agent_preview'];(function(_0x141ac8,_0x353b53){var _0x574433=function(_0x989dcf){while(--_0x989dcf){_0x141ac8['push'](_0x141ac8['shift']());}};_0x574433(++_0x353b53);}(_0x1d99,0x128));var _0x91d9=function(_0x4de536,_0x3f2ed0){_0x4de536=_0x4de536-0x0;var _0xab4f0d=_0x1d99[_0x4de536];return _0xab4f0d;};'use strict';var _=require('lodash');var util=require(_0x91d9('0x0'));var logger=require(_0x91d9('0x1'))(_0x91d9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x91d9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91d9('0x4'));var config=require('../../config/environment');var attributes=require(_0x91d9('0x5'));module[_0x91d9('0x6')]=function(_0x370fb5,_0x6e0ad){return _0x370fb5['define']('ReportAgentPreview',attributes,{'tableName':_0x91d9('0x7'),'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 5d0d8cc..6d9631d 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 _0xc7b0=['body','options','raw','catch','lodash','util','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','CreateReportAgentPreview','ReportAgentPreview','create'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xc7b0,0x18a));var _0x0c7b=function(_0x414f08,_0x2c43ae){_0x414f08=_0x414f08-0x0;var _0x1d9d28=_0xc7b0[_0x414f08];return _0x1d9d28;};'use strict';var _=require(_0x0c7b('0x0'));var util=require(_0x0c7b('0x1'));var moment=require(_0x0c7b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c7b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c7b('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x0c7b('0x5'));var jayson=require(_0x0c7b('0x6'));var client=jayson[_0x0c7b('0x7')][_0x0c7b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f57d8,_0x1f1286,_0x91ad4a){return new BPromise(function(_0x119bfd,_0x3ad2c7){return client[_0x0c7b('0x9')](_0x5f57d8,_0x91ad4a)[_0x0c7b('0xa')](function(_0x353922){logger['info'](_0x0c7b('0xb'),_0x1f1286,'request\x20sent');logger[_0x0c7b('0xc')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x1f1286,'request\x20sent',JSON[_0x0c7b('0xd')](_0x353922));if(_0x353922[_0x0c7b('0xe')]){if(_0x353922['error']['code']===0x1f4){logger[_0x0c7b('0xe')](_0x0c7b('0xb'),_0x1f1286,_0x353922['error'][_0x0c7b('0xf')]);return _0x3ad2c7(_0x353922[_0x0c7b('0xe')][_0x0c7b('0xf')]);}logger[_0x0c7b('0xe')](_0x0c7b('0xb'),_0x1f1286,_0x353922[_0x0c7b('0xe')]['message']);return _0x119bfd(_0x353922[_0x0c7b('0xe')][_0x0c7b('0xf')]);}else{logger[_0x0c7b('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x1f1286,_0x0c7b('0x11'));_0x119bfd(_0x353922[_0x0c7b('0x12')][_0x0c7b('0xf')]);}})['catch'](function(_0xd92b49){logger[_0x0c7b('0xe')](_0x0c7b('0xb'),_0x1f1286,_0xd92b49);_0x3ad2c7(_0xd92b49);});});}exports[_0x0c7b('0x13')]=function(_0x137580){var _0x4a1b4c=this;return new Promise(function(_0x5f0c53,_0x3fe39e){return db[_0x0c7b('0x14')][_0x0c7b('0x15')](_0x137580[_0x0c7b('0x16')],{'raw':_0x137580[_0x0c7b('0x17')]?_0x137580[_0x0c7b('0x17')][_0x0c7b('0x18')]===undefined?!![]:![]:!![]})[_0x0c7b('0xa')](function(_0x3b6486){logger[_0x0c7b('0x10')]('CreateReportAgentPreview',_0x137580);logger[_0x0c7b('0xc')](_0x0c7b('0x13'),_0x137580,JSON[_0x0c7b('0xd')](_0x3b6486));_0x5f0c53(_0x3b6486);})[_0x0c7b('0x19')](function(_0x19513c){logger[_0x0c7b('0xe')](_0x0c7b('0x13'),_0x19513c[_0x0c7b('0xf')],_0x137580);_0x3fe39e(_0x4a1b4c[_0x0c7b('0xe')](0x1f4,_0x19513c[_0x0c7b('0xf')]));});});}; \ No newline at end of file +var _0x2d89=['ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x226b43,_0x3e0497){var _0x3ad8cd=function(_0x3f23c9){while(--_0x3f23c9){_0x226b43['push'](_0x226b43['shift']());}};_0x3ad8cd(++_0x3e0497);}(_0x2d89,0x11e));var _0x92d8=function(_0x51ad24,_0x10de8b){_0x51ad24=_0x51ad24-0x0;var _0x2e03c8=_0x2d89[_0x51ad24];return _0x2e03c8;};'use strict';var _=require(_0x92d8('0x0'));var util=require(_0x92d8('0x1'));var moment=require(_0x92d8('0x2'));var BPromise=require(_0x92d8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92d8('0x4'));var db=require(_0x92d8('0x5'))['db'];var utils=require(_0x92d8('0x6'));var logger=require(_0x92d8('0x7'))(_0x92d8('0x8'));var config=require(_0x92d8('0x9'));var jayson=require(_0x92d8('0xa'));var client=jayson[_0x92d8('0xb')][_0x92d8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x28841e,_0x1f5a36,_0x8def35){return new BPromise(function(_0x568423,_0x44fc91){return client['request'](_0x28841e,_0x8def35)[_0x92d8('0xd')](function(_0x311db6){logger['info'](_0x92d8('0xe'),_0x1f5a36,_0x92d8('0xf'));logger['debug'](_0x92d8('0x10'),_0x1f5a36,_0x92d8('0xf'),JSON['stringify'](_0x311db6));if(_0x311db6[_0x92d8('0x11')]){if(_0x311db6['error'][_0x92d8('0x12')]===0x1f4){logger[_0x92d8('0x11')](_0x92d8('0xe'),_0x1f5a36,_0x311db6['error'][_0x92d8('0x13')]);return _0x44fc91(_0x311db6['error']['message']);}logger[_0x92d8('0x11')](_0x92d8('0xe'),_0x1f5a36,_0x311db6[_0x92d8('0x11')]['message']);return _0x568423(_0x311db6['error'][_0x92d8('0x13')]);}else{logger[_0x92d8('0x14')](_0x92d8('0xe'),_0x1f5a36,_0x92d8('0xf'));_0x568423(_0x311db6['result'][_0x92d8('0x13')]);}})[_0x92d8('0x15')](function(_0x3ab83c){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x1f5a36,_0x3ab83c);_0x44fc91(_0x3ab83c);});});}exports[_0x92d8('0x16')]=function(_0x51f35a){var _0x2aff64=this;return new Promise(function(_0x11cb7b,_0x12b470){return db[_0x92d8('0x17')][_0x92d8('0x18')](_0x51f35a[_0x92d8('0x19')],{'raw':_0x51f35a[_0x92d8('0x1a')]?_0x51f35a[_0x92d8('0x1a')][_0x92d8('0x1b')]===undefined?!![]:![]:!![]})[_0x92d8('0xd')](function(_0x194220){logger['info'](_0x92d8('0x16'),_0x51f35a);logger[_0x92d8('0x1c')]('CreateReportAgentPreview',_0x51f35a,JSON[_0x92d8('0x1d')](_0x194220));_0x11cb7b(_0x194220);})[_0x92d8('0x15')](function(_0x9f1e43){logger[_0x92d8('0x11')](_0x92d8('0x16'),_0x9f1e43['message'],_0x51f35a);_0x12b470(_0x2aff64['error'](0x1f4,_0x9f1e43['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index cf68f53..44a6a1d 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 _0x1ece=['voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','agents','put','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','agentNotify','exports','multer','path','Router','./rpc.controller','/voice/channels'];(function(_0x8ba08d,_0x5cc984){var _0x29622d=function(_0x534023){while(--_0x534023){_0x8ba08d['push'](_0x8ba08d['shift']());}};_0x29622d(++_0x5cc984);}(_0x1ece,0x13f));var _0xe1ec=function(_0x4aeffd,_0x4177a9){_0x4aeffd=_0x4aeffd-0x0;var _0xe09896=_0x1ece[_0x4aeffd];return _0xe09896;};'use strict';var multer=require(_0xe1ec('0x0'));var util=require('util');var path=require(_0xe1ec('0x1'));var express=require('express');var router=express[_0xe1ec('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0xe1ec('0x3'));router['get'](_0xe1ec('0x4'),auth['isAuthenticated'](),controller[_0xe1ec('0x5')]);router[_0xe1ec('0x6')](_0xe1ec('0x7'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x9')]);router['get'](_0xe1ec('0xa'),auth['isAuthenticated'](),controller[_0xe1ec('0xb')]);router[_0xe1ec('0x6')]('/voice/queues',auth[_0xe1ec('0x8')](),controller[_0xe1ec('0xc')]);router['get'](_0xe1ec('0xd'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0xe')]);router[_0xe1ec('0x6')](_0xe1ec('0xf'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x10')]);router[_0xe1ec('0x6')]('/mail/accounts',auth['isAuthenticated'](),controller[_0xe1ec('0x11')]);router[_0xe1ec('0x6')](_0xe1ec('0x12'),auth['isAuthenticated'](),controller[_0xe1ec('0x13')]);router[_0xe1ec('0x6')](_0xe1ec('0x14'),auth[_0xe1ec('0x8')](),controller['smsQueues']);router[_0xe1ec('0x6')](_0xe1ec('0x15'),auth[_0xe1ec('0x8')](),controller['whatsappQueues']);router[_0xe1ec('0x6')](_0xe1ec('0x16'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x17')]);router[_0xe1ec('0x6')](_0xe1ec('0x18'),auth['isAuthenticated'](),controller[_0xe1ec('0x19')]);router['get'](_0xe1ec('0x1a'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x1b')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x1c')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x1d')]);router[_0xe1ec('0x6')](_0xe1ec('0x1e'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x1f')]);router[_0xe1ec('0x6')]('/voice/queues/:id',auth[_0xe1ec('0x8')](),controller['showVoiceQueues']);router['put'](_0xe1ec('0x20'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x21')]);router[_0xe1ec('0x6')](_0xe1ec('0x22'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x23')]);router[_0xe1ec('0x6')](_0xe1ec('0x24'),auth['isAuthenticated'](),controller[_0xe1ec('0x25')]);router[_0xe1ec('0x6')]('/agents',auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x26')]);router[_0xe1ec('0x27')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0xe1ec('0x28')]);router[_0xe1ec('0x6')](_0xe1ec('0x29'),auth['isAuthenticated'](),controller['telephones']);router['get'](_0xe1ec('0x2a'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x2b')]);router[_0xe1ec('0x6')](_0xe1ec('0x2c'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x2d')]);router['get'](_0xe1ec('0x2e'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x2f')]);router['get'](_0xe1ec('0x30'),auth['isAuthenticated'](),controller[_0xe1ec('0x31')]);router[_0xe1ec('0x6')](_0xe1ec('0x32'),auth[_0xe1ec('0x8')](),controller['mailQueuesWaitingInteractions']);router['get'](_0xe1ec('0x33'),auth[_0xe1ec('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0xe1ec('0x6')](_0xe1ec('0x34'),auth[_0xe1ec('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0xe1ec('0x35'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x36')]);router[_0xe1ec('0x6')](_0xe1ec('0x37'),auth[_0xe1ec('0x8')](),controller['whatsappQueuesWaitingInteractions']);router['get']('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xe1ec('0x38')]);router[_0xe1ec('0x39')](_0xe1ec('0x3a'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x3b')]('mail'));router[_0xe1ec('0x6')](_0xe1ec('0x3c'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x3d')]);router[_0xe1ec('0x39')]('/chat/queues/:id/notify',auth[_0xe1ec('0x8')](),controller['queueNotify'](_0xe1ec('0x3e')));router[_0xe1ec('0x6')](_0xe1ec('0x3f'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x40')]);router['post'](_0xe1ec('0x41'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x3b')](_0xe1ec('0x42')));router[_0xe1ec('0x6')](_0xe1ec('0x43'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x44')]);router[_0xe1ec('0x39')](_0xe1ec('0x45'),auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x3b')](_0xe1ec('0x46')));router[_0xe1ec('0x6')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0xe1ec('0x47')]);router['post'](_0xe1ec('0x48'),auth['isAuthenticated'](),controller['queueNotify'](_0xe1ec('0x49')));router['post'](_0xe1ec('0x4a'),auth['isAuthenticated'](),controller[_0xe1ec('0x3b')](_0xe1ec('0x4b')));router['get'](_0xe1ec('0x4c'),auth['isAuthenticated'](),controller[_0xe1ec('0x4d')]);router[_0xe1ec('0x6')]('/whatsapp/queues/:id',auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x4e')]);router['post']('/agents/:id/notify',auth[_0xe1ec('0x8')](),controller[_0xe1ec('0x4f')]);module[_0xe1ec('0x50')]=router; \ No newline at end of file +var _0x1e29=['faxAccounts','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','queueNotify','/openchannel/queues/:id','sms','/whatsapp/queues/:id/notify','whatsapp','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x1e29,0x1cb));var _0x91e2=function(_0x2922ce,_0x2463df){_0x2922ce=_0x2922ce-0x0;var _0x242ac8=_0x1e29[_0x2922ce];return _0x242ac8;};'use strict';var multer=require(_0x91e2('0x0'));var util=require(_0x91e2('0x1'));var path=require(_0x91e2('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x91e2('0x3'));var controller=require(_0x91e2('0x4'));router[_0x91e2('0x5')]('/voice/channels',auth[_0x91e2('0x6')](),controller[_0x91e2('0x7')]);router[_0x91e2('0x5')](_0x91e2('0x8'),auth['isAuthenticated'](),controller[_0x91e2('0x9')]);router['get'](_0x91e2('0xa'),auth[_0x91e2('0x6')](),controller[_0x91e2('0xb')]);router[_0x91e2('0x5')]('/voice/queues',auth[_0x91e2('0x6')](),controller[_0x91e2('0xc')]);router[_0x91e2('0x5')]('/chat/queues',auth['isAuthenticated'](),controller[_0x91e2('0xd')]);router['get'](_0x91e2('0xe'),auth[_0x91e2('0x6')](),controller[_0x91e2('0xf')]);router[_0x91e2('0x5')](_0x91e2('0x10'),auth['isAuthenticated'](),controller[_0x91e2('0x11')]);router[_0x91e2('0x5')](_0x91e2('0x12'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x13')]);router['get'](_0x91e2('0x14'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x15')]);router['get']('/whatsapp/queues',auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x91e2('0x5')](_0x91e2('0x16'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x17')]);router[_0x91e2('0x5')](_0x91e2('0x18'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x19')]);router[_0x91e2('0x5')](_0x91e2('0x1a'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x1b')]);router[_0x91e2('0x5')](_0x91e2('0x1c'),auth['isAuthenticated'](),controller[_0x91e2('0x1d')]);router[_0x91e2('0x5')](_0x91e2('0x1e'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x1f')]);router['get'](_0x91e2('0x20'),auth['isAuthenticated'](),controller[_0x91e2('0x21')]);router[_0x91e2('0x5')]('/voice/queues/:id',auth[_0x91e2('0x6')](),controller[_0x91e2('0x22')]);router[_0x91e2('0x23')](_0x91e2('0x24'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x25')]);router[_0x91e2('0x5')](_0x91e2('0x26'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x27')]);router[_0x91e2('0x5')](_0x91e2('0x28'),auth['isAuthenticated'](),controller[_0x91e2('0x29')]);router[_0x91e2('0x5')](_0x91e2('0x2a'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x2b')]);router[_0x91e2('0x23')](_0x91e2('0x2c'),auth[_0x91e2('0x6')](),controller['agentCapacity']);router[_0x91e2('0x5')](_0x91e2('0x2d'),auth[_0x91e2('0x6')](),controller['telephones']);router[_0x91e2('0x5')](_0x91e2('0x2e'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x2f')]);router[_0x91e2('0x5')](_0x91e2('0x30'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x31')]);router[_0x91e2('0x5')](_0x91e2('0x32'),auth['isAuthenticated'](),controller[_0x91e2('0x33')]);router[_0x91e2('0x5')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router['get'](_0x91e2('0x34'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x35')]);router[_0x91e2('0x5')](_0x91e2('0x36'),auth['isAuthenticated'](),controller[_0x91e2('0x37')]);router[_0x91e2('0x5')](_0x91e2('0x38'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x39')]);router['get'](_0x91e2('0x3a'),auth[_0x91e2('0x6')](),controller['smsQueuesWaitingInteractions']);router[_0x91e2('0x5')](_0x91e2('0x3b'),auth[_0x91e2('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0x91e2('0x5')](_0x91e2('0x3c'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x3d')]);router[_0x91e2('0x3e')](_0x91e2('0x3f'),auth[_0x91e2('0x6')](),controller['queueNotify'](_0x91e2('0x40')));router[_0x91e2('0x5')](_0x91e2('0x41'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x42')]);router[_0x91e2('0x3e')](_0x91e2('0x43'),auth[_0x91e2('0x6')](),controller['queueNotify'](_0x91e2('0x44')));router['get'](_0x91e2('0x45'),auth['isAuthenticated'](),controller[_0x91e2('0x46')]);router['post'](_0x91e2('0x47'),auth[_0x91e2('0x6')](),controller['queueNotify'](_0x91e2('0x48')));router['get'](_0x91e2('0x49'),auth['isAuthenticated'](),controller[_0x91e2('0x4a')]);router['post'](_0x91e2('0x4b'),auth['isAuthenticated'](),controller[_0x91e2('0x4c')]('openchannel'));router[_0x91e2('0x5')](_0x91e2('0x4d'),auth[_0x91e2('0x6')](),controller['showOpenchannelQueues']);router['post']('/sms/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x91e2('0x4e')));router[_0x91e2('0x3e')](_0x91e2('0x4f'),auth['isAuthenticated'](),controller[_0x91e2('0x4c')](_0x91e2('0x50')));router[_0x91e2('0x5')]('/sms/queues/:id',auth[_0x91e2('0x6')](),controller['showSmsQueues']);router['get'](_0x91e2('0x51'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router['post'](_0x91e2('0x52'),auth[_0x91e2('0x6')](),controller[_0x91e2('0x53')]);module[_0x91e2('0x54')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 65548f7..2878504 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 _0xeff8=['error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','user','hasOwnProperty','findAll','INTERACTION','format','length','updateAttributes','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','findOne','Interaction','\x20Message\x20not\x20found','MessageId','From','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','Message','messageId','update','InteractionId','create','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0xeff8,0x186));var _0x8eff=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xeff8[_0x36eaaa];return _0x461349;};'use strict';var BPromise=require(_0x8eff('0x0'));var moment=require(_0x8eff('0x1'));var _=require('lodash');var util=require(_0x8eff('0x2'));var db=require(_0x8eff('0x3'))['db'];var logger=require(_0x8eff('0x4'))('api');var jayson=require(_0x8eff('0x5'));var amiClient=jayson[_0x8eff('0x6')][_0x8eff('0x7')]({'port':0x232a});var mailClient=jayson[_0x8eff('0x6')]['http']({'port':0x232b});var routingClient=jayson[_0x8eff('0x6')][_0x8eff('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3409bc,_0x323b2,_0x491f01){return new BPromise(function(_0x3fb9ee,_0x19557f){var _0x17f22b=_0x491f01?_0x491f01:amiClient;return _0x17f22b[_0x8eff('0x8')](_0x3409bc,_0x323b2)['then'](function(_0x56f120){if(_0x56f120[_0x8eff('0x9')]){if(_0x56f120[_0x8eff('0x9')][_0x8eff('0xa')]===0x1f4){return _0x19557f(_0x56f120['error'][_0x8eff('0xb')]);}return _0x3fb9ee(_0x56f120[_0x8eff('0x9')]['message']);}else{_0x3fb9ee(_0x56f120[_0x8eff('0xc')]);}})[_0x8eff('0xd')](function(_0x559143){_0x19557f(_0x559143);});});}function respondWithResult(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xc8;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0xe')](_0x45f280)[_0x8eff('0xf')](_0x43c914);}return _0x4a399e[_0x8eff('0x10')](0x194);};}function handleError(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0x1f4;return function(_0x212a2e){logger[_0x8eff('0x9')](_0x212a2e[_0x8eff('0x11')]);if(_0x212a2e[_0x8eff('0x12')]){delete _0x212a2e[_0x8eff('0x12')];}_0x56efdf[_0x8eff('0xe')](_0x3e7c01)[_0x8eff('0x13')](_0x212a2e);};}function findById(_0x16a4eb){return function(_0x427902){if(!_[_0x8eff('0x14')](_0x16a4eb)&&!_['isNil'](_0x427902)&&!_[_0x8eff('0x14')](_0x427902[_0x8eff('0x15')])){return _[_0x8eff('0x16')](_0x427902[_0x8eff('0x15')],function(_0x2cd7c5){return _0x2cd7c5['id']==_0x16a4eb;});}return null;};}exports[_0x8eff('0x17')]=function(_0x38f5ee,_0x399d96){return respondWithRpcPromise(_0x8eff('0x18'),_0x38f5ee[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x399d96,null))[_0x8eff('0xd')](handleError(_0x399d96,null));};exports[_0x8eff('0x1b')]=function(_0x2a7337,_0xdbb7b5){return respondWithRpcPromise(_0x8eff('0x1c'),_['merge'](_0x2a7337[_0x8eff('0x19')],_0x2a7337[_0x8eff('0x1d')]))['then'](respondWithResult(_0xdbb7b5,null))[_0x8eff('0xd')](handleError(_0xdbb7b5,null));};exports['voiceChannelStopMixMonitor']=function(_0x2fe360,_0x23c030){return respondWithRpcPromise(_0x8eff('0x1e'),_[_0x8eff('0x1f')](_0x2fe360[_0x8eff('0x19')],_0x2fe360['params']))[_0x8eff('0x1a')](respondWithResult(_0x23c030,null))[_0x8eff('0xd')](handleError(_0x23c030,null));};exports['voiceQueues']=function(_0x15b66f,_0x5ec3d7){return respondWithRpcPromise(_0x8eff('0x20'),_0x15b66f[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x5ec3d7,null))[_0x8eff('0xd')](handleError(_0x5ec3d7,null));};exports[_0x8eff('0x21')]=function(_0x2e8067,_0x516173){return respondWithRpcPromise(_0x8eff('0x20'),_0x2e8067[_0x8eff('0x19')])[_0x8eff('0x1a')](findById(_0x2e8067[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x516173,null))[_0x8eff('0xd')](handleError(_0x516173,null));};exports['updateVoiceQueue']=function(_0x4ed3b8,_0x44dcdb){return respondWithRpcPromise(_0x8eff('0x22'),_[_0x8eff('0x1f')](_0x4ed3b8['body'],_0x4ed3b8[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x44dcdb,null))[_0x8eff('0xd')](handleError(_0x44dcdb,null));};exports[_0x8eff('0x23')]=function(_0x25b98e,_0x2c5727){return respondWithRpcPromise(_0x8eff('0x24'),_[_0x8eff('0x1f')](_0x25b98e[_0x8eff('0x19')],_0x25b98e[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x2c5727,null))[_0x8eff('0xd')](handleError(_0x2c5727,null));};exports['voiceQueuesChannels']=function(_0x2ad4b7,_0x165f8e){return respondWithRpcPromise(_0x8eff('0x25'),_0x2ad4b7[_0x8eff('0x19')])['then'](respondWithResult(_0x165f8e,null))[_0x8eff('0xd')](handleError(_0x165f8e,null));};exports[_0x8eff('0x26')]=function(_0x4c4220,_0x4e1256){return respondWithRpcPromise(_0x8eff('0x27'),_[_0x8eff('0x1f')](_0x4c4220['query'],_0x4c4220['params']))['then'](respondWithResult(_0x4e1256,null))[_0x8eff('0xd')](handleError(_0x4e1256,null));};exports['voiceQueuesChannelHangup']=function(_0x45d9d4,_0x59c9cc){return respondWithRpcPromise(_0x8eff('0x28'),_[_0x8eff('0x1f')](_0x45d9d4[_0x8eff('0x19')],_0x45d9d4[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x59c9cc,null))[_0x8eff('0xd')](handleError(_0x59c9cc,null));};exports['voiceQueuesChannelRedirect']=function(_0xd95908,_0x5907e0){return respondWithRpcPromise(_0x8eff('0x29'),_['merge'](_0xd95908[_0x8eff('0x19')],_0xd95908[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x5907e0,null))[_0x8eff('0xd')](handleError(_0x5907e0,null));};exports['outbound']=function(_0x2eb4bb,_0x170a33){return respondWithRpcPromise(_0x8eff('0x2a'),_0x2eb4bb['query'])[_0x8eff('0x1a')](respondWithResult(_0x170a33,null))[_0x8eff('0xd')](handleError(_0x170a33,null));};exports[_0x8eff('0x2b')]=function(_0x345bc7,_0x721c71){return respondWithRpcPromise(_0x8eff('0x2c'),_0x345bc7[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x721c71,null))[_0x8eff('0xd')](handleError(_0x721c71,null));};exports['agents']=function(_0x54a2d9,_0xf67cf3){var _0x114f8e;return respondWithRpcPromise(_0x8eff('0x2d'),_0x54a2d9[_0x8eff('0x19')])[_0x8eff('0x1a')](function(_0x1ba78a){_0x114f8e=_0x1ba78a;return respondWithRpcPromise(_0x8eff('0x2d'),_0x54a2d9['query'],routingClient);})[_0x8eff('0x1a')](function(_0x1c7332){return _['merge']({},_0x1c7332,_0x114f8e);})[_0x8eff('0x1a')](respondWithResult(_0xf67cf3,null))[_0x8eff('0xd')](handleError(_0xf67cf3,null));};exports[_0x8eff('0x2e')]=function(_0x18309b,_0xdc5e2f){if(_0x18309b[_0x8eff('0x2f')]&&_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')]&&_0x18309b[_0x8eff('0x31')]&&_0x18309b['user'][_0x8eff('0x12')]){for(var _0x27a8c9 in _0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')]){if(_0x18309b[_0x8eff('0x2f')]['interaction'][_0x8eff('0x32')](_0x27a8c9)){db['MemberReport'][_0x8eff('0x33')]({'where':{'channel':_0x27a8c9,'membername':_0x18309b[_0x8eff('0x31')][_0x8eff('0x12')],'type':_0x8eff('0x34'),'exitAt':null,'uniqueid':_0x18309b['body'][_0x8eff('0x30')][_0x27a8c9]&&_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')][_0x27a8c9]['length']?{'$notIn':_0x18309b['body'][_0x8eff('0x30')][_0x27a8c9]}:{'$ne':null}}})[_0x8eff('0x1a')](function(_0x3bf913){var _0x22f173=moment()[_0x8eff('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x28cb8e=0x0,_0x51aa5d=_0x3bf913[_0x8eff('0x36')];_0x28cb8e<_0x51aa5d;_0x28cb8e+=0x1){_0x3bf913[_0x28cb8e][_0x8eff('0x37')]({'exitAt':_0x22f173});}});for(var _0x577a2b=0x0;_0x577a2b<_0x18309b['body']['interaction'][_0x27a8c9]['length'];_0x577a2b+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x27a8c9,'membername':_0x18309b[_0x8eff('0x31')][_0x8eff('0x12')],'type':_0x8eff('0x34'),'uniqueid':_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')][_0x27a8c9][_0x577a2b],'exitAt':null},'defaults':{'channel':_0x27a8c9,'membername':_0x18309b[_0x8eff('0x31')][_0x8eff('0x12')],'interface':_[_0x8eff('0x14')](_0x18309b[_0x8eff('0x31')][_0x8eff('0x38')])?util['format'](_0x8eff('0x39'),_0x18309b['user'][_0x8eff('0x12')]):_0x18309b[_0x8eff('0x31')][_0x8eff('0x38')],'type':_0x8eff('0x34'),'enterAt':moment()[_0x8eff('0x35')](_0x8eff('0x3a')),'role':_0x8eff('0x3b'),'internal':_0x18309b[_0x8eff('0x31')][_0x8eff('0x3c')],'uniqueid':_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')][_0x27a8c9][_0x577a2b]}});}}}}return respondWithRpcPromise(_0x8eff('0x3d'),{'id':_0x18309b['params']['id'],'capacity':_0x18309b[_0x8eff('0x2f')][_0x8eff('0x3e')]},routingClient)[_0x8eff('0x1a')](respondWithResult(_0xdc5e2f,null))[_0x8eff('0xd')](handleError(_0xdc5e2f,null));};exports[_0x8eff('0x3f')]=function(_0x2de7fd,_0x16473d){return respondWithRpcPromise(_0x8eff('0x40'),_0x2de7fd[_0x8eff('0x19')])['then'](respondWithResult(_0x16473d,null))['catch'](handleError(_0x16473d,null));};exports[_0x8eff('0x41')]=function(_0x36e2fd,_0x430f5e){return respondWithRpcPromise(_0x8eff('0x42'),_0x36e2fd[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x430f5e,null))['catch'](handleError(_0x430f5e,null));};exports[_0x8eff('0x43')]=function(_0x1ca203,_0x1d0a8e){return respondWithRpcPromise('Campaigns',_0x1ca203[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x1d0a8e,null))[_0x8eff('0xd')](handleError(_0x1d0a8e,null));};exports[_0x8eff('0x44')]=function(_0x549e88,_0x40de1d){return respondWithRpcPromise(_0x8eff('0x45'),_0x549e88[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x40de1d,null))[_0x8eff('0xd')](handleError(_0x40de1d,null));};exports[_0x8eff('0x46')]=function(_0x3f646d,_0x575b0e){return respondWithRpcPromise(_0x8eff('0x45'),_0x3f646d[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x3f646d[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x575b0e,null))['catch'](handleError(_0x575b0e,null));};exports[_0x8eff('0x47')]=function(_0x16b968,_0x5d79b){return respondWithRpcPromise('MailQueues',_0x16b968[_0x8eff('0x19')],routingClient)['then'](respondWithResult(_0x5d79b,null))[_0x8eff('0xd')](handleError(_0x5d79b,null));};exports[_0x8eff('0x48')]=function(_0x23ed92,_0xfecdd8){return respondWithRpcPromise(_0x8eff('0x49'),_0x23ed92[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x23ed92['params']['id']))['then'](respondWithResult(_0xfecdd8,null))[_0x8eff('0xd')](handleError(_0xfecdd8,null));};exports['mailAccounts']=function(_0x3bfeac,_0x375ed3){return respondWithRpcPromise(_0x8eff('0x4a'),_0x3bfeac[_0x8eff('0x19')],mailClient)[_0x8eff('0x1a')](respondWithResult(_0x375ed3,null))['catch'](handleError(_0x375ed3,null));};exports[_0x8eff('0x4b')]=function(_0x36afc3,_0x1813df){return respondWithRpcPromise(_0x8eff('0x4c'),_0x36afc3[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x1813df,null))['catch'](handleError(_0x1813df,null));};exports[_0x8eff('0x4d')]=function(_0x5c0ea3,_0x2e45c2){return respondWithRpcPromise(_0x8eff('0x4c'),_0x5c0ea3['query'],routingClient)[_0x8eff('0x1a')](findById(_0x5c0ea3[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x2e45c2,null))[_0x8eff('0xd')](handleError(_0x2e45c2,null));};exports[_0x8eff('0x4e')]=function(_0x35467c,_0xabdd84){return respondWithRpcPromise(_0x8eff('0x4f'),_0x35467c['query'],routingClient)[_0x8eff('0x1a')](respondWithResult(_0xabdd84,null))['catch'](handleError(_0xabdd84,null));};exports['showSmsQueues']=function(_0x1a748f,_0x47626e){return respondWithRpcPromise('SmsQueues',_0x1a748f[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x1a748f['params']['id']))[_0x8eff('0x1a')](respondWithResult(_0x47626e,null))[_0x8eff('0xd')](handleError(_0x47626e,null));};exports['whatsappQueues']=function(_0xc70ecc,_0x1c6ee1){return respondWithRpcPromise(_0x8eff('0x50'),_0xc70ecc[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x1c6ee1,null))[_0x8eff('0xd')](handleError(_0x1c6ee1,null));};exports[_0x8eff('0x51')]=function(_0x58c9e6,_0x479a4b){return respondWithRpcPromise(_0x8eff('0x50'),_0x58c9e6[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x58c9e6[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x479a4b,null))[_0x8eff('0xd')](handleError(_0x479a4b,null));};exports[_0x8eff('0x52')]=function(_0x4f1c54,_0x593a18){return respondWithRpcPromise(_0x8eff('0x53'),_0x4f1c54['query'],routingClient)['then'](respondWithResult(_0x593a18,null))['catch'](handleError(_0x593a18,null));};exports[_0x8eff('0x54')]=function(_0x436db2,_0x461026){return respondWithRpcPromise(_0x8eff('0x53'),_0x436db2[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x436db2[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x461026,null))['catch'](handleError(_0x461026,null));};exports[_0x8eff('0x55')]=function(_0x5492df,_0x42efc6){return respondWithRpcPromise(_0x8eff('0x56'),_0x5492df[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x42efc6,null))[_0x8eff('0xd')](handleError(_0x42efc6,null));};exports[_0x8eff('0x57')]=function(_0x570728,_0x3db0d8){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x570728[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x3db0d8,null))[_0x8eff('0xd')](handleError(_0x3db0d8,null));};exports[_0x8eff('0x58')]=function(_0x41d7e2,_0x2f30cb){return respondWithRpcPromise(_0x8eff('0x59'),_0x41d7e2[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x2f30cb,null))['catch'](handleError(_0x2f30cb,null));};exports[_0x8eff('0x5a')]=function(_0x73b49f,_0x1299b5){return respondWithRpcPromise(_0x8eff('0x5b'),_0x73b49f[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x1299b5,null))[_0x8eff('0xd')](handleError(_0x1299b5,null));};exports[_0x8eff('0x5c')]=function(_0x3350b8,_0x123673){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3350b8['query'],routingClient)['then'](function(_0x5f3443){if(_0x3350b8[_0x8eff('0x19')][_0x8eff('0x5d')]!==undefined){var _0x2a15ba=_(_0x5f3443[_0x8eff('0x15')])[_0x8eff('0x5e')]([_0x3350b8[_0x8eff('0x19')][_0x8eff('0x5d')],_0x3350b8['params']['id']])[_0x8eff('0x5f')](_0x8eff('0x60'))[_0x8eff('0x61')]()[_0x8eff('0x62')]();return _0x5f3443['rows'][_0x8eff('0x5e')](function(_0x34ca22){return _0x2a15ba['indexOf'](_0x34ca22[_0x8eff('0x60')])>-0x1;});}else{return _0x5f3443[_0x8eff('0x15')][_0x8eff('0x5e')](function(_0x47e24f){return _0x47e24f['queue_id']===parseInt(_0x3350b8['params']['id']);});}})[_0x8eff('0x1a')](respondWithResult(_0x123673,null))[_0x8eff('0xd')](handleError(_0x123673,null));};exports[_0x8eff('0x63')]=function(_0x168465,_0xaca1b5){return respondWithRpcPromise(_0x8eff('0x64'),_0x168465[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0xaca1b5,null))[_0x8eff('0xd')](handleError(_0xaca1b5,null));};exports[_0x8eff('0x65')]=function(_0x4272e8,_0x5c8a83){return respondWithRpcPromise(_0x8eff('0x66'),_0x4272e8['query'],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x5c8a83,null))[_0x8eff('0xd')](handleError(_0x5c8a83,null));};exports['faxQueuesWaitingInteractions']=function(_0x9c448b,_0x536b6f){return respondWithRpcPromise(_0x8eff('0x67'),_0x9c448b[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x536b6f,null))[_0x8eff('0xd')](handleError(_0x536b6f,null));};exports[_0x8eff('0x68')]=function(_0x4a4603){return function(_0x842ad7,_0x56fd7d){var _0xd5edc5,_0x19768b;var _0x30c321=_[_0x8eff('0x69')](_0x4a4603);var _0x52be06=_0x4a4603===_0x8eff('0x6a')?_0x8eff('0x6b'):_0x8eff('0x6c');return db[_0x30c321+_0x8eff('0x6d')]['findOne']({'raw':!![],'where':{'id':_0x842ad7[_0x8eff('0x1d')]['id']}})[_0x8eff('0x1a')](function(_0x10e26f){if(_[_0x8eff('0x14')](_0x10e26f)){throw new Error(_0x30c321+_0x8eff('0x6e'));}_0xd5edc5=_0x10e26f;return db[_0x30c321+'Message'][_0x8eff('0x6f')]({'where':{'id':_0x842ad7[_0x8eff('0x2f')]['messageId']},'include':[{'model':db[_0x30c321+'Interaction'],'as':_0x8eff('0x70')},{'model':db[_0x30c321+_0x52be06],'as':_0x8eff('0x6c')}]});})[_0x8eff('0x1a')](function(_0xe31924){if(_[_0x8eff('0x14')](_0xe31924)){throw new Error(_0x30c321+_0x8eff('0x71'));}_0x19768b=_0xe31924;return _0xe31924['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x8eff('0x1a')](function(){var _0x522e5f={'uniqueid':_0x4a4603+'.'+_0x19768b['id']+'.'+_0x19768b[_0x8eff('0x70')]['id'],'FromUserId':_0x842ad7[_0x8eff('0x31')]['id'],'type':'queue'};_0x522e5f[_0x30c321+_0x8eff('0x72')]=_0x19768b['id'];_0x522e5f[_0x30c321+'InteractionId']=_0x19768b['Interaction']['id'];_0x522e5f[_0x8eff('0x73')+_0x30c321+_0x52be06+'Id']=_0x19768b['Account']['id'];_0x522e5f['To'+_0x30c321+_0x8eff('0x74')]=_0xd5edc5['id'];return db[_0x30c321+_0x8eff('0x75')]['create'](_0x522e5f);})[_0x8eff('0x1a')](function(){return respondWithRpcPromise(_0x8eff('0x76'),{'channel':_0x4a4603,'interaction':_0x19768b['Interaction'],'message':_0x19768b,'account':_0x19768b[_0x8eff('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8eff('0x77'),'appdata':_0xd5edc5[_0x8eff('0x12')]+','+(_0x19768b[_0x8eff('0x6c')][_0x8eff('0x78')]||0x12c),'interval':_0x8eff('0x79')}]},routingClient);})[_0x8eff('0x1a')](respondWithResult(_0x56fd7d,null))[_0x8eff('0xd')](handleError(_0x56fd7d,null));};};exports[_0x8eff('0x7a')]=function(_0x4aa16e,_0x4f7209){var _0x4c9436,_0x338269;if(_[_0x8eff('0x14')](_0x4aa16e[_0x8eff('0x2f')]['channel'])){throw new Error(_0x8eff('0x7b'));}var _0x35cf4c=_0x4aa16e[_0x8eff('0x2f')][_0x8eff('0x7c')];var _0x2c9646=_[_0x8eff('0x69')](_0x35cf4c);var _0x5ee248=_0x35cf4c===_0x8eff('0x6a')?'Website':_0x8eff('0x6c');return db[_0x8eff('0x7d')][_0x8eff('0x6f')]({'raw':!![],'where':{'id':_0x4aa16e[_0x8eff('0x1d')]['id'],'role':_0x8eff('0x3b')}})[_0x8eff('0x1a')](function(_0x476701){if(_['isNil'](_0x476701)){throw new Error(_0x8eff('0x7e'));}_0x4c9436=_0x476701;return db[_0x2c9646+_0x8eff('0x7f')][_0x8eff('0x6f')]({'where':{'id':_0x4aa16e[_0x8eff('0x2f')][_0x8eff('0x80')]},'include':[{'model':db[_0x2c9646+'Interaction'],'as':_0x8eff('0x70')},{'model':db[_0x2c9646+_0x5ee248],'as':_0x8eff('0x6c')}]});})[_0x8eff('0x1a')](function(_0x488a69){if(_['isNil'](_0x488a69)){throw new Error(_0x2c9646+_0x8eff('0x71'));}_0x338269=_0x488a69;return _0x488a69[_0x8eff('0x81')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8eff('0x1a')](function(){var _0x58db46={'uniqueid':_0x35cf4c+'.'+_0x338269['id']+'.'+_0x338269[_0x8eff('0x70')]['id'],'FromUserId':_0x4aa16e['user']['id'],'type':'queue','ToUserId':_0x4c9436['id']};_0x58db46[_0x2c9646+_0x8eff('0x72')]=_0x338269['id'];_0x58db46[_0x2c9646+_0x8eff('0x82')]=_0x338269[_0x8eff('0x70')]['id'];_0x58db46[_0x8eff('0x73')+_0x2c9646+_0x5ee248+'Id']=_0x338269[_0x8eff('0x6c')]['id'];return db[_0x2c9646+_0x8eff('0x75')][_0x8eff('0x83')](_0x58db46);})[_0x8eff('0x1a')](function(){return respondWithRpcPromise(_0x8eff('0x76'),{'channel':_0x35cf4c,'interaction':_0x338269[_0x8eff('0x70')],'message':_0x338269,'account':_0x338269[_0x8eff('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8eff('0x3b'),'appdata':_0x4c9436['name']+','+(_0x338269[_0x8eff('0x6c')][_0x8eff('0x84')]||0x12c),'interval':_0x8eff('0x79')}]},routingClient);})[_0x8eff('0x1a')](respondWithResult(_0x4f7209,null))[_0x8eff('0xd')](handleError(_0x4f7209,null));}; \ No newline at end of file +var _0xac9d=['SIP/%s','INTERACTION','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq','indexOf','queue_id','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','messageId','Interaction','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','\x20Message\x20not\x20found','update','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','then','error','code','message','result','catch','json','sendStatus','stack','name','status','send','isNil','find','rows','voiceChannels','VoiceChannels','voiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','findOrCreate','interface','format'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0xac9d,0x14d));var _0xdac9=function(_0x2defc4,_0x25dbea){_0x2defc4=_0x2defc4-0x0;var _0x10e80a=_0xac9d[_0x2defc4];return _0x10e80a;};'use strict';var BPromise=require(_0xdac9('0x0'));var moment=require(_0xdac9('0x1'));var _=require(_0xdac9('0x2'));var util=require(_0xdac9('0x3'));var db=require(_0xdac9('0x4'))['db'];var logger=require(_0xdac9('0x5'))(_0xdac9('0x6'));var jayson=require(_0xdac9('0x7'));var amiClient=jayson['client'][_0xdac9('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0xdac9('0x8')]({'port':0x232b});var routingClient=jayson[_0xdac9('0x9')][_0xdac9('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){var _0x47d9fd=_0x39f560?_0x39f560:amiClient;return _0x47d9fd[_0xdac9('0xa')](_0x776b6c,_0x1c78c5)[_0xdac9('0xb')](function(_0x39c92c){if(_0x39c92c[_0xdac9('0xc')]){if(_0x39c92c[_0xdac9('0xc')][_0xdac9('0xd')]===0x1f4){return _0x2b1d6f(_0x39c92c[_0xdac9('0xc')][_0xdac9('0xe')]);}return _0x5531af(_0x39c92c[_0xdac9('0xc')]['message']);}else{_0x5531af(_0x39c92c[_0xdac9('0xf')]);}})[_0xdac9('0x10')](function(_0x5a9bde){_0x2b1d6f(_0x5a9bde);});});}function respondWithResult(_0x3d8e97,_0xeddbc1){_0xeddbc1=_0xeddbc1||0xc8;return function(_0xbfe6d8){if(_0xbfe6d8){return _0x3d8e97['status'](_0xeddbc1)[_0xdac9('0x11')](_0xbfe6d8);}return _0x3d8e97[_0xdac9('0x12')](0x194);};}function handleError(_0x9e1bf6,_0x5f0bbd){_0x5f0bbd=_0x5f0bbd||0x1f4;return function(_0x5dd536){logger[_0xdac9('0xc')](_0x5dd536[_0xdac9('0x13')]);if(_0x5dd536['name']){delete _0x5dd536[_0xdac9('0x14')];}_0x9e1bf6[_0xdac9('0x15')](_0x5f0bbd)[_0xdac9('0x16')](_0x5dd536);};}function findById(_0x5b2f1b){return function(_0x2221f8){if(!_[_0xdac9('0x17')](_0x5b2f1b)&&!_[_0xdac9('0x17')](_0x2221f8)&&!_[_0xdac9('0x17')](_0x2221f8['rows'])){return _[_0xdac9('0x18')](_0x2221f8[_0xdac9('0x19')],function(_0x571e07){return _0x571e07['id']==_0x5b2f1b;});}return null;};}exports[_0xdac9('0x1a')]=function(_0xa57f2d,_0x171df1){return respondWithRpcPromise(_0xdac9('0x1b'),_0xa57f2d['query'])['then'](respondWithResult(_0x171df1,null))[_0xdac9('0x10')](handleError(_0x171df1,null));};exports[_0xdac9('0x1c')]=function(_0x2b9d91,_0x395ec7){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xdac9('0x1d')](_0x2b9d91[_0xdac9('0x1e')],_0x2b9d91[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x395ec7,null))[_0xdac9('0x10')](handleError(_0x395ec7,null));};exports[_0xdac9('0x20')]=function(_0x41335a,_0xa1f726){return respondWithRpcPromise(_0xdac9('0x21'),_[_0xdac9('0x1d')](_0x41335a['query'],_0x41335a[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0xa1f726,null))[_0xdac9('0x10')](handleError(_0xa1f726,null));};exports[_0xdac9('0x22')]=function(_0x5ca076,_0x1e631a){return respondWithRpcPromise('VoiceQueues',_0x5ca076[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x1e631a,null))['catch'](handleError(_0x1e631a,null));};exports[_0xdac9('0x23')]=function(_0x5105f1,_0x450f91){return respondWithRpcPromise(_0xdac9('0x24'),_0x5105f1[_0xdac9('0x1e')])[_0xdac9('0xb')](findById(_0x5105f1['params']['id']))['then'](respondWithResult(_0x450f91,null))[_0xdac9('0x10')](handleError(_0x450f91,null));};exports[_0xdac9('0x25')]=function(_0x4fe3bd,_0x4c4e21){return respondWithRpcPromise(_0xdac9('0x26'),_[_0xdac9('0x1d')](_0x4fe3bd[_0xdac9('0x27')],_0x4fe3bd[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x4c4e21,null))[_0xdac9('0x10')](handleError(_0x4c4e21,null));};exports[_0xdac9('0x28')]=function(_0x2cda4d,_0x406ed0){return respondWithRpcPromise(_0xdac9('0x29'),_[_0xdac9('0x1d')](_0x2cda4d[_0xdac9('0x1e')],_0x2cda4d[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x406ed0,null))[_0xdac9('0x10')](handleError(_0x406ed0,null));};exports[_0xdac9('0x2a')]=function(_0x372f02,_0x44eff2){return respondWithRpcPromise(_0xdac9('0x2b'),_0x372f02[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x44eff2,null))['catch'](handleError(_0x44eff2,null));};exports['voiceQueuesChannel']=function(_0x1e6832,_0x416501){return respondWithRpcPromise(_0xdac9('0x2c'),_[_0xdac9('0x1d')](_0x1e6832[_0xdac9('0x1e')],_0x1e6832['params']))[_0xdac9('0xb')](respondWithResult(_0x416501,null))['catch'](handleError(_0x416501,null));};exports[_0xdac9('0x2d')]=function(_0x2a611e,_0x5cfebf){return respondWithRpcPromise(_0xdac9('0x2e'),_['merge'](_0x2a611e['query'],_0x2a611e[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x5cfebf,null))[_0xdac9('0x10')](handleError(_0x5cfebf,null));};exports[_0xdac9('0x2f')]=function(_0x3bab10,_0x363d93){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xdac9('0x1d')](_0x3bab10[_0xdac9('0x1e')],_0x3bab10['params']))[_0xdac9('0xb')](respondWithResult(_0x363d93,null))[_0xdac9('0x10')](handleError(_0x363d93,null));};exports[_0xdac9('0x30')]=function(_0x27bdfb,_0x35aa58){return respondWithRpcPromise(_0xdac9('0x31'),_0x27bdfb[_0xdac9('0x1e')])['then'](respondWithResult(_0x35aa58,null))[_0xdac9('0x10')](handleError(_0x35aa58,null));};exports[_0xdac9('0x32')]=function(_0x238769,_0x4b6b09){return respondWithRpcPromise(_0xdac9('0x33'),_0x238769[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x4b6b09,null))[_0xdac9('0x10')](handleError(_0x4b6b09,null));};exports['agents']=function(_0x58fd14,_0x1d0243){var _0xe47a3c;return respondWithRpcPromise(_0xdac9('0x34'),_0x58fd14[_0xdac9('0x1e')])[_0xdac9('0xb')](function(_0x579581){_0xe47a3c=_0x579581;return respondWithRpcPromise(_0xdac9('0x34'),_0x58fd14['query'],routingClient);})[_0xdac9('0xb')](function(_0xaca43c){return _[_0xdac9('0x1d')]({},_0xaca43c,_0xe47a3c);})[_0xdac9('0xb')](respondWithResult(_0x1d0243,null))[_0xdac9('0x10')](handleError(_0x1d0243,null));};exports[_0xdac9('0x35')]=function(_0x413fb1,_0xb176e0){if(_0x413fb1[_0xdac9('0x27')]&&_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')]&&_0x413fb1[_0xdac9('0x37')]&&_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')]){for(var _0x5335ae in _0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')]){if(_0x413fb1['body'][_0xdac9('0x36')][_0xdac9('0x38')](_0x5335ae)){db[_0xdac9('0x39')][_0xdac9('0x3a')]({'where':{'channel':_0x5335ae,'membername':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x413fb1[_0xdac9('0x27')]['interaction'][_0x5335ae]&&_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')][_0x5335ae][_0xdac9('0x3b')]?{'$notIn':_0x413fb1[_0xdac9('0x27')]['interaction'][_0x5335ae]}:{'$ne':null}}})['then'](function(_0x585f08){var _0xcb7b82=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4159fd=0x0,_0x15c332=_0x585f08['length'];_0x4159fd<_0x15c332;_0x4159fd+=0x1){_0x585f08[_0x4159fd]['updateAttributes']({'exitAt':_0xcb7b82});}});for(var _0x1666c5=0x0;_0x1666c5<_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')][_0x5335ae][_0xdac9('0x3b')];_0x1666c5+=0x1){db[_0xdac9('0x39')][_0xdac9('0x3c')]({'where':{'channel':_0x5335ae,'membername':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')],'type':'INTERACTION','uniqueid':_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')][_0x5335ae][_0x1666c5],'exitAt':null},'defaults':{'channel':_0x5335ae,'membername':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')],'interface':_[_0xdac9('0x17')](_0x413fb1[_0xdac9('0x37')][_0xdac9('0x3d')])?util[_0xdac9('0x3e')](_0xdac9('0x3f'),_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')]):_0x413fb1[_0xdac9('0x37')][_0xdac9('0x3d')],'type':_0xdac9('0x40'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x41')],'uniqueid':_0x413fb1['body'][_0xdac9('0x36')][_0x5335ae][_0x1666c5]}});}}}}return respondWithRpcPromise(_0xdac9('0x42'),{'id':_0x413fb1[_0xdac9('0x1f')]['id'],'capacity':_0x413fb1['body'][_0xdac9('0x43')]},routingClient)[_0xdac9('0xb')](respondWithResult(_0xb176e0,null))['catch'](handleError(_0xb176e0,null));};exports['telephones']=function(_0x46f1c0,_0x4469d8){return respondWithRpcPromise(_0xdac9('0x44'),_0x46f1c0[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x4469d8,null))[_0xdac9('0x10')](handleError(_0x4469d8,null));};exports[_0xdac9('0x45')]=function(_0x3a77e3,_0x298c72){return respondWithRpcPromise(_0xdac9('0x46'),_0x3a77e3[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x298c72,null))[_0xdac9('0x10')](handleError(_0x298c72,null));};exports[_0xdac9('0x47')]=function(_0x35a378,_0x5d0b43){return respondWithRpcPromise(_0xdac9('0x48'),_0x35a378[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x5d0b43,null))[_0xdac9('0x10')](handleError(_0x5d0b43,null));};exports[_0xdac9('0x49')]=function(_0x3a391a,_0x4b118e){return respondWithRpcPromise(_0xdac9('0x4a'),_0x3a391a[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x4b118e,null))[_0xdac9('0x10')](handleError(_0x4b118e,null));};exports[_0xdac9('0x4b')]=function(_0x2a5bf9,_0x1eec39){return respondWithRpcPromise(_0xdac9('0x4a'),_0x2a5bf9[_0xdac9('0x1e')],routingClient)['then'](findById(_0x2a5bf9[_0xdac9('0x1f')]['id']))[_0xdac9('0xb')](respondWithResult(_0x1eec39,null))[_0xdac9('0x10')](handleError(_0x1eec39,null));};exports[_0xdac9('0x4c')]=function(_0x2ca15d,_0x21ab3d){return respondWithRpcPromise('MailQueues',_0x2ca15d['query'],routingClient)[_0xdac9('0xb')](respondWithResult(_0x21ab3d,null))[_0xdac9('0x10')](handleError(_0x21ab3d,null));};exports[_0xdac9('0x4d')]=function(_0x46017d,_0x1c1f5f){return respondWithRpcPromise(_0xdac9('0x4e'),_0x46017d['query'],routingClient)['then'](findById(_0x46017d['params']['id']))[_0xdac9('0xb')](respondWithResult(_0x1c1f5f,null))[_0xdac9('0x10')](handleError(_0x1c1f5f,null));};exports[_0xdac9('0x4f')]=function(_0x2f581b,_0x52ad7b){return respondWithRpcPromise(_0xdac9('0x50'),_0x2f581b[_0xdac9('0x1e')],mailClient)[_0xdac9('0xb')](respondWithResult(_0x52ad7b,null))[_0xdac9('0x10')](handleError(_0x52ad7b,null));};exports[_0xdac9('0x51')]=function(_0x496d9c,_0x19a46e){return respondWithRpcPromise('OpenchannelQueues',_0x496d9c[_0xdac9('0x1e')],routingClient)['then'](respondWithResult(_0x19a46e,null))[_0xdac9('0x10')](handleError(_0x19a46e,null));};exports[_0xdac9('0x52')]=function(_0x2fd7c8,_0x360499){return respondWithRpcPromise(_0xdac9('0x53'),_0x2fd7c8[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](findById(_0x2fd7c8['params']['id']))['then'](respondWithResult(_0x360499,null))['catch'](handleError(_0x360499,null));};exports[_0xdac9('0x54')]=function(_0x42ba53,_0x830d54){return respondWithRpcPromise(_0xdac9('0x55'),_0x42ba53[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x830d54,null))[_0xdac9('0x10')](handleError(_0x830d54,null));};exports['showSmsQueues']=function(_0x2d81fc,_0x5b63d8){return respondWithRpcPromise('SmsQueues',_0x2d81fc[_0xdac9('0x1e')],routingClient)['then'](findById(_0x2d81fc['params']['id']))[_0xdac9('0xb')](respondWithResult(_0x5b63d8,null))[_0xdac9('0x10')](handleError(_0x5b63d8,null));};exports[_0xdac9('0x56')]=function(_0x55ce14,_0x552cac){return respondWithRpcPromise(_0xdac9('0x57'),_0x55ce14[_0xdac9('0x1e')],routingClient)['then'](respondWithResult(_0x552cac,null))[_0xdac9('0x10')](handleError(_0x552cac,null));};exports[_0xdac9('0x58')]=function(_0x26b9b5,_0x272f14){return respondWithRpcPromise(_0xdac9('0x57'),_0x26b9b5[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](findById(_0x26b9b5[_0xdac9('0x1f')]['id']))[_0xdac9('0xb')](respondWithResult(_0x272f14,null))[_0xdac9('0x10')](handleError(_0x272f14,null));};exports[_0xdac9('0x59')]=function(_0x1e2e7b,_0x5401e6){return respondWithRpcPromise(_0xdac9('0x5a'),_0x1e2e7b['query'],routingClient)[_0xdac9('0xb')](respondWithResult(_0x5401e6,null))[_0xdac9('0x10')](handleError(_0x5401e6,null));};exports['showFaxQueues']=function(_0x3a6c78,_0x3bee81){return respondWithRpcPromise(_0xdac9('0x5a'),_0x3a6c78[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](findById(_0x3a6c78[_0xdac9('0x1f')]['id']))[_0xdac9('0xb')](respondWithResult(_0x3bee81,null))[_0xdac9('0x10')](handleError(_0x3bee81,null));};exports[_0xdac9('0x5b')]=function(_0x45f183,_0x263b84){return respondWithRpcPromise(_0xdac9('0x5c'),_0x45f183[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x263b84,null))[_0xdac9('0x10')](handleError(_0x263b84,null));};exports[_0xdac9('0x5d')]=function(_0x4c4a7b,_0x3a457b){return respondWithRpcPromise(_0xdac9('0x5e'),_0x4c4a7b[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x3a457b,null))['catch'](handleError(_0x3a457b,null));};exports[_0xdac9('0x5f')]=function(_0x31f56e,_0x1b6a68){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x31f56e[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x1b6a68,null))['catch'](handleError(_0x1b6a68,null));};exports[_0xdac9('0x60')]=function(_0x1b8ad9,_0x2a4d12){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1b8ad9[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x2a4d12,null))[_0xdac9('0x10')](handleError(_0x2a4d12,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x5c39e9,_0x108e03){return respondWithRpcPromise(_0xdac9('0x61'),_0x5c39e9[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](function(_0x4110da){if(_0x5c39e9[_0xdac9('0x1e')][_0xdac9('0x62')]!==undefined){var _0x2de535=_(_0x4110da[_0xdac9('0x19')])[_0xdac9('0x63')]([_0x5c39e9[_0xdac9('0x1e')][_0xdac9('0x62')],_0x5c39e9[_0xdac9('0x1f')]['id']])['map']('queue_id')[_0xdac9('0x64')]()['value']();return _0x4110da['rows'][_0xdac9('0x63')](function(_0x199518){return _0x2de535[_0xdac9('0x65')](_0x199518[_0xdac9('0x66')])>-0x1;});}else{return _0x4110da['rows'][_0xdac9('0x63')](function(_0xff5be){return _0xff5be[_0xdac9('0x66')]===parseInt(_0x5c39e9['params']['id']);});}})[_0xdac9('0xb')](respondWithResult(_0x108e03,null))[_0xdac9('0x10')](handleError(_0x108e03,null));};exports['smsQueuesWaitingInteractions']=function(_0x3cc0f9,_0x59b5b2){return respondWithRpcPromise(_0xdac9('0x67'),_0x3cc0f9['query'],routingClient)[_0xdac9('0xb')](respondWithResult(_0x59b5b2,null))[_0xdac9('0x10')](handleError(_0x59b5b2,null));};exports[_0xdac9('0x68')]=function(_0x251011,_0x9981f){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x251011[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x9981f,null))[_0xdac9('0x10')](handleError(_0x9981f,null));};exports[_0xdac9('0x69')]=function(_0x13be64,_0x227857){return respondWithRpcPromise(_0xdac9('0x6a'),_0x13be64[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x227857,null))['catch'](handleError(_0x227857,null));};exports[_0xdac9('0x6b')]=function(_0x300738){return function(_0x12c15b,_0x4f7f63){var _0x571130,_0x5650d1;var _0x5adc83=_['capitalize'](_0x300738);var _0x325407=_0x300738===_0xdac9('0x6c')?_0xdac9('0x6d'):_0xdac9('0x6e');return db[_0x5adc83+'Queue'][_0xdac9('0x6f')]({'raw':!![],'where':{'id':_0x12c15b['params']['id']}})[_0xdac9('0xb')](function(_0x750de7){if(_[_0xdac9('0x17')](_0x750de7)){throw new Error(_0x5adc83+_0xdac9('0x70'));}_0x571130=_0x750de7;return db[_0x5adc83+'Message'][_0xdac9('0x6f')]({'where':{'id':_0x12c15b[_0xdac9('0x27')][_0xdac9('0x71')]},'include':[{'model':db[_0x5adc83+_0xdac9('0x72')],'as':'Interaction'},{'model':db[_0x5adc83+_0x325407],'as':'Account'}]});})[_0xdac9('0xb')](function(_0x414f8a){if(_[_0xdac9('0x17')](_0x414f8a)){throw new Error(_0x5adc83+'\x20Message\x20not\x20found');}_0x5650d1=_0x414f8a;return _0x414f8a['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xdac9('0xb')](function(){var _0x111bff={'uniqueid':_0x300738+'.'+_0x5650d1['id']+'.'+_0x5650d1[_0xdac9('0x72')]['id'],'FromUserId':_0x12c15b[_0xdac9('0x37')]['id'],'type':_0xdac9('0x73')};_0x111bff[_0x5adc83+_0xdac9('0x74')]=_0x5650d1['id'];_0x111bff[_0x5adc83+_0xdac9('0x75')]=_0x5650d1[_0xdac9('0x72')]['id'];_0x111bff[_0xdac9('0x76')+_0x5adc83+_0x325407+'Id']=_0x5650d1[_0xdac9('0x6e')]['id'];_0x111bff['To'+_0x5adc83+_0xdac9('0x77')]=_0x571130['id'];return db[_0x5adc83+_0xdac9('0x78')][_0xdac9('0x79')](_0x111bff);})['then'](function(){return respondWithRpcPromise(_0xdac9('0x7a'),{'channel':_0x300738,'interaction':_0x5650d1[_0xdac9('0x72')],'message':_0x5650d1,'account':_0x5650d1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xdac9('0x73'),'appdata':_0x571130['name']+','+(_0x5650d1[_0xdac9('0x6e')][_0xdac9('0x7b')]||0x12c),'interval':_0xdac9('0x7c')}]},routingClient);})[_0xdac9('0xb')](respondWithResult(_0x4f7f63,null))[_0xdac9('0x10')](handleError(_0x4f7f63,null));};};exports[_0xdac9('0x7d')]=function(_0x232876,_0x4463ca){var _0x171d38,_0x328fa2;if(_[_0xdac9('0x17')](_0x232876['body'][_0xdac9('0x7e')])){throw new Error(_0xdac9('0x7f'));}var _0x284247=_0x232876[_0xdac9('0x27')][_0xdac9('0x7e')];var _0x4d7208=_['capitalize'](_0x284247);var _0x363541=_0x284247==='chat'?'Website':_0xdac9('0x6e');return db[_0xdac9('0x80')][_0xdac9('0x6f')]({'raw':!![],'where':{'id':_0x232876[_0xdac9('0x1f')]['id'],'role':'agent'}})[_0xdac9('0xb')](function(_0x8f37df){if(_[_0xdac9('0x17')](_0x8f37df)){throw new Error('Agent\x20not\x20found');}_0x171d38=_0x8f37df;return db[_0x4d7208+'Message'][_0xdac9('0x6f')]({'where':{'id':_0x232876[_0xdac9('0x27')]['messageId']},'include':[{'model':db[_0x4d7208+'Interaction'],'as':'Interaction'},{'model':db[_0x4d7208+_0x363541],'as':_0xdac9('0x6e')}]});})[_0xdac9('0xb')](function(_0x131c78){if(_['isNil'](_0x131c78)){throw new Error(_0x4d7208+_0xdac9('0x81'));}_0x328fa2=_0x131c78;return _0x131c78[_0xdac9('0x82')]({'read':0x0,'readAt':null,'UserId':null});})[_0xdac9('0xb')](function(){var _0x2ab89f={'uniqueid':_0x284247+'.'+_0x328fa2['id']+'.'+_0x328fa2[_0xdac9('0x72')]['id'],'FromUserId':_0x232876['user']['id'],'type':_0xdac9('0x73'),'ToUserId':_0x171d38['id']};_0x2ab89f[_0x4d7208+_0xdac9('0x74')]=_0x328fa2['id'];_0x2ab89f[_0x4d7208+'InteractionId']=_0x328fa2[_0xdac9('0x72')]['id'];_0x2ab89f[_0xdac9('0x76')+_0x4d7208+_0x363541+'Id']=_0x328fa2[_0xdac9('0x6e')]['id'];return db[_0x4d7208+_0xdac9('0x78')]['create'](_0x2ab89f);})['then'](function(){return respondWithRpcPromise(_0xdac9('0x7a'),{'channel':_0x284247,'interaction':_0x328fa2[_0xdac9('0x72')],'message':_0x328fa2,'account':_0x328fa2['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x171d38[_0xdac9('0x14')]+','+(_0x328fa2['Account'][_0xdac9('0x83')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x4463ca,null))[_0xdac9('0x10')](handleError(_0x4463ca,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index e25db0a..d73adfe 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 _0x3bf4=['show','/:id/run','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x3bf4,0x1d0));var _0x43bf=function(_0x240596,_0x1342f1){_0x240596=_0x240596-0x0;var _0x1ab179=_0x3bf4[_0x240596];return _0x1ab179;};'use strict';var multer=require(_0x43bf('0x0'));var util=require(_0x43bf('0x1'));var path=require(_0x43bf('0x2'));var timeout=require(_0x43bf('0x3'));var express=require(_0x43bf('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43bf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x43bf('0x6'));var controller=require(_0x43bf('0x7'));router[_0x43bf('0x8')]('/',auth[_0x43bf('0x9')](),controller['index']);router[_0x43bf('0x8')](_0x43bf('0xa'),auth[_0x43bf('0x9')](),controller[_0x43bf('0xb')]);router[_0x43bf('0x8')](_0x43bf('0xc'),auth[_0x43bf('0x9')](),controller['run']);router[_0x43bf('0xd')]('/',auth[_0x43bf('0x9')](),controller[_0x43bf('0xe')]);router[_0x43bf('0xf')]('/:id',auth[_0x43bf('0x9')](),controller[_0x43bf('0x10')]);router[_0x43bf('0x11')](_0x43bf('0xa'),auth[_0x43bf('0x9')](),controller[_0x43bf('0x12')]);module['exports']=router; \ No newline at end of file +var _0x960a=['update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put'];(function(_0x4e9ba2,_0x59422d){var _0x15097f=function(_0x18bdee){while(--_0x18bdee){_0x4e9ba2['push'](_0x4e9ba2['shift']());}};_0x15097f(++_0x59422d);}(_0x960a,0x122));var _0xa960=function(_0x48c812,_0x544a7e){_0x48c812=_0x48c812-0x0;var _0x121efb=_0x960a[_0x48c812];return _0x121efb;};'use strict';var multer=require('multer');var util=require(_0xa960('0x0'));var path=require(_0xa960('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa960('0x2')]();var fs_extra=require(_0xa960('0x3'));var auth=require(_0xa960('0x4'));var interaction=require(_0xa960('0x5'));var config=require(_0xa960('0x6'));var controller=require(_0xa960('0x7'));router[_0xa960('0x8')]('/',auth[_0xa960('0x9')](),controller[_0xa960('0xa')]);router[_0xa960('0x8')](_0xa960('0xb'),auth[_0xa960('0x9')](),controller[_0xa960('0xc')]);router['get'](_0xa960('0xd'),auth[_0xa960('0x9')](),controller[_0xa960('0xe')]);router[_0xa960('0xf')]('/',auth['isAuthenticated'](),controller[_0xa960('0x10')]);router[_0xa960('0x11')](_0xa960('0xb'),auth[_0xa960('0x9')](),controller[_0xa960('0x12')]);router[_0xa960('0x13')]('/:id',auth[_0xa960('0x9')](),controller[_0xa960('0x14')]);module[_0xa960('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 4dc9ffb..7e81d4b 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 _0x5e96=['months','weeks','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','BOOLEAN','sequelize','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','years'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e96,0x11b));var _0x65e9=function(_0x57a734,_0xab6c46){_0x57a734=_0x57a734-0x0;var _0x3c8aff=_0x5e96[_0x57a734];return _0x3c8aff;};'use strict';var Sequelize=require(_0x65e9('0x0'));module['exports']={'name':{'type':Sequelize[_0x65e9('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x65e9('0x2')},'startAt':{'type':Sequelize[_0x65e9('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x65e9('0x4')](_0x65e9('0x5'),'quarters',_0x65e9('0x6'),_0x65e9('0x7'),'days',_0x65e9('0x8'),_0x65e9('0x9')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x65e9('0x4')](_0x65e9('0xa'),_0x65e9('0xb'),_0x65e9('0xc')),'allowNull':![],'defaultValue':_0x65e9('0xa')},'type':{'type':Sequelize['ENUM'](_0x65e9('0xd'),_0x65e9('0xe')),'allowNull':![],'defaultValue':_0x65e9('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x65e9('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x65e9('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x65e9('0x10')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6437=['months','weeks','hours','minutes','csv','pdf','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years'];(function(_0x864853,_0x1b7287){var _0x2d1509=function(_0x3c8ed2){while(--_0x3c8ed2){_0x864853['push'](_0x864853['shift']());}};_0x2d1509(++_0x1b7287);}(_0x6437,0x12a));var _0x7643=function(_0x7e485,_0x40a7cb){_0x7e485=_0x7e485-0x0;var _0x558338=_0x6437[_0x7e485];return _0x558338;};'use strict';var Sequelize=require(_0x7643('0x0'));module[_0x7643('0x1')]={'name':{'type':Sequelize[_0x7643('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7643('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7643('0x2')],'allowNull':![],'defaultValue':_0x7643('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x7643('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7643('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7643('0x6')](_0x7643('0x7'),'quarters',_0x7643('0x8'),_0x7643('0x9'),'days',_0x7643('0xa'),_0x7643('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x7643('0x6')](_0x7643('0xc'),_0x7643('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0x7643('0xc')},'type':{'type':Sequelize[_0x7643('0x6')](_0x7643('0xe'),'default'),'allowNull':![],'defaultValue':_0x7643('0xe')},'sendMail':{'type':Sequelize[_0x7643('0xf')],'defaultValue':![]},'email':{'type':Sequelize[_0x7643('0x2')]},'cc':{'type':Sequelize[_0x7643('0x10')]},'bcc':{'type':Sequelize[_0x7643('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x7643('0xf')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 0cde154..d8ffee5 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 _0xf5af=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','get','Scheduler','end','error','name','send','index','Schedule','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x145124,_0x40f0f0){var _0x5ec150=function(_0x410e19){while(--_0x410e19){_0x145124['push'](_0x145124['shift']());}};_0x5ec150(++_0x40f0f0);}(_0xf5af,0x13e));var _0xff5a=function(_0xec9c4e,_0x1f3b34){_0xec9c4e=_0xec9c4e-0x0;var _0x49cf7b=_0xf5af[_0xec9c4e];return _0x49cf7b;};'use strict';var emlformat=require(_0xff5a('0x0'));var rimraf=require(_0xff5a('0x1'));var zipdir=require(_0xff5a('0x2'));var jsonpatch=require(_0xff5a('0x3'));var rp=require(_0xff5a('0x4'));var moment=require(_0xff5a('0x5'));var BPromise=require(_0xff5a('0x6'));var Mustache=require(_0xff5a('0x7'));var util=require('util');var path=require(_0xff5a('0x8'));var sox=require(_0xff5a('0x9'));var csv=require(_0xff5a('0xa'));var ejs=require(_0xff5a('0xb'));var fs=require('fs');var fs_extra=require(_0xff5a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xff5a('0xd'));var toCsv=require(_0xff5a('0xa'));var querystring=require(_0xff5a('0xe'));var Papa=require(_0xff5a('0xf'));var Redis=require('ioredis');var authService=require(_0xff5a('0x10'));var qs=require(_0xff5a('0x11'));var as=require(_0xff5a('0x12'));var hardwareService=require(_0xff5a('0x13'));var logger=require(_0xff5a('0x14'))('api');var utils=require(_0xff5a('0x15'));var config=require(_0xff5a('0x16'));var licenseUtil=require(_0xff5a('0x17'));var db=require(_0xff5a('0x18'))['db'];function respondWithStatusCode(_0x32eb1f,_0x3b192c){_0x3b192c=_0x3b192c||0xcc;return function(_0x474da4){if(_0x474da4){return _0x32eb1f[_0xff5a('0x19')](_0x3b192c);}return _0x32eb1f[_0xff5a('0x1a')](_0x3b192c)['end']();};}function respondWithResult(_0x2f95ff,_0x44b531){_0x44b531=_0x44b531||0xc8;return function(_0x2b416c){if(_0x2b416c){return _0x2f95ff['status'](_0x44b531)[_0xff5a('0x1b')](_0x2b416c);}};}function respondWithFilteredResult(_0x5b4d3f,_0x54d5d5){return function(_0x2be90f){if(_0x2be90f){var _0x4f31e5=typeof _0x54d5d5[_0xff5a('0x1c')]===_0xff5a('0x1d')&&typeof _0x54d5d5['limit']==='undefined';var _0x5d19b5=_0x2be90f[_0xff5a('0x1e')];var _0x6c2520=_0x4f31e5?0x0:_0x54d5d5[_0xff5a('0x1c')];var _0x3aedf2=_0x4f31e5?_0x2be90f[_0xff5a('0x1e')]:_0x54d5d5[_0xff5a('0x1c')]+_0x54d5d5[_0xff5a('0x1f')];var _0xd5e99d;if(_0x3aedf2>=_0x5d19b5){_0x3aedf2=_0x5d19b5;_0xd5e99d=0xc8;}else{_0xd5e99d=0xce;}_0x5b4d3f['status'](_0xd5e99d);return _0x5b4d3f[_0xff5a('0x20')](_0xff5a('0x21'),_0x6c2520+'-'+_0x3aedf2+'/'+_0x5d19b5)[_0xff5a('0x1b')](_0x2be90f);}return null;};}function patchUpdates(_0x15a4ec){return function(_0xf7c1f){try{jsonpatch['apply'](_0xf7c1f,_0x15a4ec,!![]);}catch(_0x5f1d88){return BPromise[_0xff5a('0x22')](_0x5f1d88);}return _0xf7c1f[_0xff5a('0x23')]();};}function saveUpdates(_0x12897c,_0x1adbe8){return function(_0x45f099){if(_0x45f099){return _0x45f099['update'](_0x12897c)[_0xff5a('0x24')](function(_0x1e363c){return _0x1e363c;});}return null;};}function removeEntity(_0x5e72a5,_0x21b629){return function(_0x2dcf0e){if(_0x2dcf0e){return _0x2dcf0e[_0xff5a('0x25')]()['then'](function(){var _0x30d8e5=_0x2dcf0e[_0xff5a('0x26')]({'plain':!![]});var _0x431a38=_0xff5a('0x27');return db['UserProfileResource'][_0xff5a('0x25')]({'where':{'type':_0x431a38,'resourceId':_0x30d8e5['id']}})[_0xff5a('0x24')](function(){return _0x2dcf0e;});})[_0xff5a('0x24')](function(){_0x5e72a5[_0xff5a('0x1a')](0xcc)[_0xff5a('0x28')]();});}};}function handleEntityNotFound(_0x5da104,_0x1bcefe){return function(_0x4d664e){if(!_0x4d664e){_0x5da104[_0xff5a('0x19')](0x194);}return _0x4d664e;};}function handleError(_0x591611,_0x591099){_0x591099=_0x591099||0x1f4;return function(_0x148693){logger[_0xff5a('0x29')](_0x148693['stack']);if(_0x148693[_0xff5a('0x2a')]){delete _0x148693[_0xff5a('0x2a')];}_0x591611[_0xff5a('0x1a')](_0x591099)[_0xff5a('0x2b')](_0x148693);};}exports[_0xff5a('0x2c')]=function(_0x46d066,_0x277855){var _0x40129b={},_0x2e8f38={},_0x2f054c={'count':0x0,'rows':[]};var _0x4c26f8=_['map'](db[_0xff5a('0x2d')][_0xff5a('0x2e')],function(_0x4b0e4b){return{'name':_0x4b0e4b[_0xff5a('0x2f')],'type':_0x4b0e4b[_0xff5a('0x30')]['key']};});_0x2e8f38[_0xff5a('0x31')]=_[_0xff5a('0x32')](_0x4c26f8,_0xff5a('0x2a'));_0x2e8f38[_0xff5a('0x33')]=_[_0xff5a('0x34')](_0x46d066[_0xff5a('0x33')]);_0x2e8f38[_0xff5a('0x35')]=_[_0xff5a('0x36')](_0x2e8f38['model'],_0x2e8f38[_0xff5a('0x33')]);_0x40129b[_0xff5a('0x37')]=_[_0xff5a('0x36')](_0x2e8f38[_0xff5a('0x31')],qs['fields'](_0x46d066[_0xff5a('0x33')][_0xff5a('0x38')]));_0x40129b['attributes']=_0x40129b[_0xff5a('0x37')][_0xff5a('0x39')]?_0x40129b[_0xff5a('0x37')]:_0x2e8f38['model'];if(!_0x46d066[_0xff5a('0x33')][_0xff5a('0x3a')]('nolimit')){_0x40129b[_0xff5a('0x1f')]=qs[_0xff5a('0x1f')](_0x46d066[_0xff5a('0x33')]['limit']);_0x40129b[_0xff5a('0x1c')]=qs[_0xff5a('0x1c')](_0x46d066[_0xff5a('0x33')]['offset']);}_0x40129b[_0xff5a('0x3b')]=qs[_0xff5a('0x3c')](_0x46d066[_0xff5a('0x33')][_0xff5a('0x3c')]);_0x40129b[_0xff5a('0x3d')]=qs[_0xff5a('0x35')](_['pick'](_0x46d066[_0xff5a('0x33')],_0x2e8f38[_0xff5a('0x35')]),_0x4c26f8);if(_0x46d066[_0xff5a('0x33')]['filter']){_0x40129b[_0xff5a('0x3d')]=_[_0xff5a('0x3e')](_0x40129b[_0xff5a('0x3d')],{'$or':_[_0xff5a('0x32')](_0x4c26f8,function(_0x272436){if(_0x272436[_0xff5a('0x30')]!=='VIRTUAL'){var _0x15a59c={};_0x15a59c[_0x272436[_0xff5a('0x2a')]]={'$like':'%'+_0x46d066[_0xff5a('0x33')][_0xff5a('0x3f')]+'%'};return _0x15a59c;}})});}_0x40129b=_[_0xff5a('0x3e')]({},_0x40129b,_0x46d066[_0xff5a('0x40')]);var _0x281bf4={'where':_0x40129b[_0xff5a('0x3d')]};return db[_0xff5a('0x2d')][_0xff5a('0x1e')](_0x281bf4)[_0xff5a('0x24')](function(_0x193eb9){_0x2f054c[_0xff5a('0x1e')]=_0x193eb9;if(_0x46d066[_0xff5a('0x33')][_0xff5a('0x41')]){_0x40129b[_0xff5a('0x42')]=[{'all':!![]}];}return db['Schedule'][_0xff5a('0x43')](_0x40129b);})[_0xff5a('0x24')](function(_0x541b11){_0x2f054c[_0xff5a('0x44')]=_0x541b11;return _0x2f054c;})['then'](respondWithFilteredResult(_0x277855,_0x40129b))[_0xff5a('0x45')](handleError(_0x277855,null));};exports[_0xff5a('0x46')]=function(_0x15a51a,_0x755f40){var _0x50f10c={'raw':![],'where':{'id':_0x15a51a[_0xff5a('0x47')]['id']}},_0x3cbf6b={};_0x3cbf6b[_0xff5a('0x31')]=_[_0xff5a('0x34')](db[_0xff5a('0x2d')]['rawAttributes']);_0x3cbf6b[_0xff5a('0x33')]=_[_0xff5a('0x34')](_0x15a51a[_0xff5a('0x33')]);_0x3cbf6b[_0xff5a('0x35')]=_[_0xff5a('0x36')](_0x3cbf6b[_0xff5a('0x31')],_0x3cbf6b[_0xff5a('0x33')]);_0x50f10c[_0xff5a('0x37')]=_[_0xff5a('0x36')](_0x3cbf6b[_0xff5a('0x31')],qs[_0xff5a('0x38')](_0x15a51a[_0xff5a('0x33')][_0xff5a('0x38')]));_0x50f10c[_0xff5a('0x37')]=_0x50f10c[_0xff5a('0x37')][_0xff5a('0x39')]?_0x50f10c['attributes']:_0x3cbf6b['model'];if(_0x15a51a[_0xff5a('0x33')][_0xff5a('0x41')]){_0x50f10c[_0xff5a('0x42')]=[{'all':!![]}];}_0x50f10c=_[_0xff5a('0x3e')]({},_0x50f10c,_0x15a51a['options']);return db[_0xff5a('0x2d')][_0xff5a('0x48')](_0x50f10c)[_0xff5a('0x24')](handleEntityNotFound(_0x755f40,null))[_0xff5a('0x24')](respondWithResult(_0x755f40,null))[_0xff5a('0x45')](handleError(_0x755f40,null));};exports[_0xff5a('0x49')]=function(_0x8744fe,_0x5af0a9){return db['Schedule'][_0xff5a('0x49')](_0x8744fe['body'],{})['then'](function(_0x10dd28){var _0x40a991=_0x8744fe['user'][_0xff5a('0x26')]({'plain':!![]});if(!_0x40a991)throw new Error(_0xff5a('0x4a'));if(_0x40a991[_0xff5a('0x4b')]===_0xff5a('0x4c')){var _0x131fee=_0x10dd28[_0xff5a('0x26')]({'plain':!![]});var _0x48baf2=_0xff5a('0x27');return db['UserProfileSection'][_0xff5a('0x48')]({'where':{'name':_0x48baf2,'userProfileId':_0x40a991[_0xff5a('0x4d')]},'raw':!![]})[_0xff5a('0x24')](function(_0x3e436f){if(_0x3e436f&&_0x3e436f['autoAssociation']===0x0){return db[_0xff5a('0x4e')][_0xff5a('0x49')]({'name':_0x131fee[_0xff5a('0x2a')],'resourceId':_0x131fee['id'],'type':_0x3e436f[_0xff5a('0x2a')],'sectionId':_0x3e436f['id']},{})[_0xff5a('0x24')](function(){return _0x10dd28;});}else{return _0x10dd28;}})[_0xff5a('0x45')](function(_0x360eeb){logger[_0xff5a('0x29')](_0xff5a('0x4f'),_0x360eeb);throw _0x360eeb;});}return _0x10dd28;})[_0xff5a('0x24')](respondWithResult(_0x5af0a9,0xc9))[_0xff5a('0x45')](handleError(_0x5af0a9,null));};exports[_0xff5a('0x50')]=function(_0x597021,_0x885e92){if(_0x597021[_0xff5a('0x51')]['id']){delete _0x597021[_0xff5a('0x51')]['id'];}return db['Schedule']['find']({'where':{'id':_0x597021[_0xff5a('0x47')]['id']}})[_0xff5a('0x24')](handleEntityNotFound(_0x885e92,null))[_0xff5a('0x24')](saveUpdates(_0x597021[_0xff5a('0x51')],null))[_0xff5a('0x24')](respondWithResult(_0x885e92,null))[_0xff5a('0x45')](handleError(_0x885e92,null));};exports[_0xff5a('0x25')]=function(_0x4d358c,_0xa13567){return db[_0xff5a('0x2d')]['find']({'where':{'id':_0x4d358c[_0xff5a('0x47')]['id']}})[_0xff5a('0x24')](handleEntityNotFound(_0xa13567,null))['then'](removeEntity(_0xa13567,null))['catch'](handleError(_0xa13567,null));};exports['run']=function(_0x58f5f1,_0x5edf8a,_0x3cb972){var _0x4342fb=require(_0xff5a('0x52'));return db[_0xff5a('0x2d')][_0xff5a('0x48')]({'where':{'id':_0x58f5f1[_0xff5a('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5edf8a,null))[_0xff5a('0x24')](function(){_0x4342fb[_0xff5a('0x53')](_0x58f5f1[_0xff5a('0x47')]['id']);})[_0xff5a('0x24')](respondWithStatusCode(_0x5edf8a,null))[_0xff5a('0x45')](handleError(_0x5edf8a,null));}; \ No newline at end of file +var _0xb822=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','index','Schedule','model','name','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','includeAll','include','findAll','rows','show','rawAttributes','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','params','../../config/schedule','run','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1678b1,_0x21797b){var _0x375264=function(_0xdf633d){while(--_0xdf633d){_0x1678b1['push'](_0x1678b1['shift']());}};_0x375264(++_0x21797b);}(_0xb822,0x95));var _0x2b82=function(_0xc3f564,_0x4c37bb){_0xc3f564=_0xc3f564-0x0;var _0x2421e7=_0xb822[_0xc3f564];return _0x2421e7;};'use strict';var emlformat=require(_0x2b82('0x0'));var rimraf=require(_0x2b82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b82('0x2'));var rp=require(_0x2b82('0x3'));var moment=require(_0x2b82('0x4'));var BPromise=require(_0x2b82('0x5'));var Mustache=require(_0x2b82('0x6'));var util=require('util');var path=require(_0x2b82('0x7'));var sox=require(_0x2b82('0x8'));var csv=require(_0x2b82('0x9'));var ejs=require(_0x2b82('0xa'));var fs=require('fs');var fs_extra=require(_0x2b82('0xb'));var _=require(_0x2b82('0xc'));var squel=require(_0x2b82('0xd'));var crypto=require(_0x2b82('0xe'));var jsforce=require(_0x2b82('0xf'));var deskjs=require(_0x2b82('0x10'));var toCsv=require(_0x2b82('0x9'));var querystring=require(_0x2b82('0x11'));var Papa=require(_0x2b82('0x12'));var Redis=require(_0x2b82('0x13'));var authService=require(_0x2b82('0x14'));var qs=require(_0x2b82('0x15'));var as=require(_0x2b82('0x16'));var hardwareService=require(_0x2b82('0x17'));var logger=require(_0x2b82('0x18'))(_0x2b82('0x19'));var utils=require(_0x2b82('0x1a'));var config=require(_0x2b82('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b82('0x1c'))['db'];function respondWithStatusCode(_0x2e5ba1,_0x2b1e5e){_0x2b1e5e=_0x2b1e5e||0xcc;return function(_0x2025c1){if(_0x2025c1){return _0x2e5ba1[_0x2b82('0x1d')](_0x2b1e5e);}return _0x2e5ba1[_0x2b82('0x1e')](_0x2b1e5e)[_0x2b82('0x1f')]();};}function respondWithResult(_0x52a5d5,_0x168ae1){_0x168ae1=_0x168ae1||0xc8;return function(_0x274b5d){if(_0x274b5d){return _0x52a5d5[_0x2b82('0x1e')](_0x168ae1)['json'](_0x274b5d);}};}function respondWithFilteredResult(_0x2e9c8d,_0x1b4035){return function(_0x1fde10){if(_0x1fde10){var _0x494022=typeof _0x1b4035[_0x2b82('0x20')]===_0x2b82('0x21')&&typeof _0x1b4035[_0x2b82('0x22')]===_0x2b82('0x21');var _0x25c5c5=_0x1fde10[_0x2b82('0x23')];var _0x3ae408=_0x494022?0x0:_0x1b4035[_0x2b82('0x20')];var _0x44723f=_0x494022?_0x1fde10[_0x2b82('0x23')]:_0x1b4035[_0x2b82('0x20')]+_0x1b4035[_0x2b82('0x22')];var _0x1d1dfa;if(_0x44723f>=_0x25c5c5){_0x44723f=_0x25c5c5;_0x1d1dfa=0xc8;}else{_0x1d1dfa=0xce;}_0x2e9c8d[_0x2b82('0x1e')](_0x1d1dfa);return _0x2e9c8d[_0x2b82('0x24')](_0x2b82('0x25'),_0x3ae408+'-'+_0x44723f+'/'+_0x25c5c5)[_0x2b82('0x26')](_0x1fde10);}return null;};}function patchUpdates(_0x442456){return function(_0x5ef5b3){try{jsonpatch[_0x2b82('0x27')](_0x5ef5b3,_0x442456,!![]);}catch(_0x212f5b){return BPromise[_0x2b82('0x28')](_0x212f5b);}return _0x5ef5b3[_0x2b82('0x29')]();};}function saveUpdates(_0x5eb864,_0x26d587){return function(_0xb9feaf){if(_0xb9feaf){return _0xb9feaf[_0x2b82('0x2a')](_0x5eb864)[_0x2b82('0x2b')](function(_0x23060b){return _0x23060b;});}return null;};}function removeEntity(_0x2a901d,_0x4d8641){return function(_0x455c37){if(_0x455c37){return _0x455c37[_0x2b82('0x2c')]()[_0x2b82('0x2b')](function(){var _0x4dc6a9=_0x455c37[_0x2b82('0x2d')]({'plain':!![]});var _0x1234d7=_0x2b82('0x2e');return db[_0x2b82('0x2f')][_0x2b82('0x2c')]({'where':{'type':_0x1234d7,'resourceId':_0x4dc6a9['id']}})[_0x2b82('0x2b')](function(){return _0x455c37;});})[_0x2b82('0x2b')](function(){_0x2a901d[_0x2b82('0x1e')](0xcc)[_0x2b82('0x1f')]();});}};}function handleEntityNotFound(_0x2d31e7,_0x40beae){return function(_0x1332ef){if(!_0x1332ef){_0x2d31e7[_0x2b82('0x1d')](0x194);}return _0x1332ef;};}function handleError(_0x352e20,_0x2550f5){_0x2550f5=_0x2550f5||0x1f4;return function(_0x44d2e2){logger[_0x2b82('0x30')](_0x44d2e2[_0x2b82('0x31')]);if(_0x44d2e2['name']){delete _0x44d2e2['name'];}_0x352e20[_0x2b82('0x1e')](_0x2550f5)['send'](_0x44d2e2);};}exports[_0x2b82('0x32')]=function(_0x2eaf5f,_0xd9ad8e){var _0x3d9ec9={},_0x232608={},_0x2d7529={'count':0x0,'rows':[]};var _0x342e72=_['map'](db[_0x2b82('0x33')]['rawAttributes'],function(_0x1ac2ce){return{'name':_0x1ac2ce['fieldName'],'type':_0x1ac2ce['type']['key']};});_0x232608[_0x2b82('0x34')]=_['map'](_0x342e72,_0x2b82('0x35'));_0x232608['query']=_['keys'](_0x2eaf5f['query']);_0x232608['filters']=_[_0x2b82('0x36')](_0x232608[_0x2b82('0x34')],_0x232608[_0x2b82('0x37')]);_0x3d9ec9['attributes']=_[_0x2b82('0x36')](_0x232608[_0x2b82('0x34')],qs[_0x2b82('0x38')](_0x2eaf5f[_0x2b82('0x37')]['fields']));_0x3d9ec9[_0x2b82('0x39')]=_0x3d9ec9[_0x2b82('0x39')][_0x2b82('0x3a')]?_0x3d9ec9['attributes']:_0x232608[_0x2b82('0x34')];if(!_0x2eaf5f['query'][_0x2b82('0x3b')]('nolimit')){_0x3d9ec9['limit']=qs[_0x2b82('0x22')](_0x2eaf5f[_0x2b82('0x37')][_0x2b82('0x22')]);_0x3d9ec9[_0x2b82('0x20')]=qs[_0x2b82('0x20')](_0x2eaf5f[_0x2b82('0x37')][_0x2b82('0x20')]);}_0x3d9ec9[_0x2b82('0x3c')]=qs[_0x2b82('0x3d')](_0x2eaf5f['query'][_0x2b82('0x3d')]);_0x3d9ec9['where']=qs[_0x2b82('0x3e')](_['pick'](_0x2eaf5f[_0x2b82('0x37')],_0x232608[_0x2b82('0x3e')]),_0x342e72);if(_0x2eaf5f['query'][_0x2b82('0x3f')]){_0x3d9ec9['where']=_[_0x2b82('0x40')](_0x3d9ec9[_0x2b82('0x41')],{'$or':_[_0x2b82('0x42')](_0x342e72,function(_0x3db86c){if(_0x3db86c[_0x2b82('0x43')]!=='VIRTUAL'){var _0x27a0d1={};_0x27a0d1[_0x3db86c['name']]={'$like':'%'+_0x2eaf5f[_0x2b82('0x37')]['filter']+'%'};return _0x27a0d1;}})});}_0x3d9ec9=_[_0x2b82('0x40')]({},_0x3d9ec9,_0x2eaf5f['options']);var _0x48ae27={'where':_0x3d9ec9[_0x2b82('0x41')]};return db[_0x2b82('0x33')]['count'](_0x48ae27)[_0x2b82('0x2b')](function(_0x272b90){_0x2d7529['count']=_0x272b90;if(_0x2eaf5f[_0x2b82('0x37')][_0x2b82('0x44')]){_0x3d9ec9[_0x2b82('0x45')]=[{'all':!![]}];}return db[_0x2b82('0x33')][_0x2b82('0x46')](_0x3d9ec9);})[_0x2b82('0x2b')](function(_0x5b8c68){_0x2d7529[_0x2b82('0x47')]=_0x5b8c68;return _0x2d7529;})['then'](respondWithFilteredResult(_0xd9ad8e,_0x3d9ec9))['catch'](handleError(_0xd9ad8e,null));};exports[_0x2b82('0x48')]=function(_0x4b4ded,_0x401a66){var _0x2e071d={'raw':![],'where':{'id':_0x4b4ded['params']['id']}},_0x1449bd={};_0x1449bd[_0x2b82('0x34')]=_['keys'](db[_0x2b82('0x33')][_0x2b82('0x49')]);_0x1449bd[_0x2b82('0x37')]=_['keys'](_0x4b4ded['query']);_0x1449bd[_0x2b82('0x3e')]=_[_0x2b82('0x36')](_0x1449bd[_0x2b82('0x34')],_0x1449bd[_0x2b82('0x37')]);_0x2e071d[_0x2b82('0x39')]=_['intersection'](_0x1449bd[_0x2b82('0x34')],qs[_0x2b82('0x38')](_0x4b4ded[_0x2b82('0x37')][_0x2b82('0x38')]));_0x2e071d[_0x2b82('0x39')]=_0x2e071d[_0x2b82('0x39')][_0x2b82('0x3a')]?_0x2e071d[_0x2b82('0x39')]:_0x1449bd[_0x2b82('0x34')];if(_0x4b4ded[_0x2b82('0x37')][_0x2b82('0x44')]){_0x2e071d[_0x2b82('0x45')]=[{'all':!![]}];}_0x2e071d=_['merge']({},_0x2e071d,_0x4b4ded[_0x2b82('0x4a')]);return db[_0x2b82('0x33')]['find'](_0x2e071d)[_0x2b82('0x2b')](handleEntityNotFound(_0x401a66,null))[_0x2b82('0x2b')](respondWithResult(_0x401a66,null))[_0x2b82('0x4b')](handleError(_0x401a66,null));};exports[_0x2b82('0x4c')]=function(_0x14f79f,_0x4da7a2){return db[_0x2b82('0x33')][_0x2b82('0x4c')](_0x14f79f[_0x2b82('0x4d')],{})[_0x2b82('0x2b')](function(_0xb6ef50){var _0x44a9f3=_0x14f79f['user'][_0x2b82('0x2d')]({'plain':!![]});if(!_0x44a9f3)throw new Error(_0x2b82('0x4e'));if(_0x44a9f3[_0x2b82('0x4f')]===_0x2b82('0x50')){var _0x1d1815=_0xb6ef50[_0x2b82('0x2d')]({'plain':!![]});var _0x3f0c7a='Scheduler';return db['UserProfileSection'][_0x2b82('0x51')]({'where':{'name':_0x3f0c7a,'userProfileId':_0x44a9f3[_0x2b82('0x52')]},'raw':!![]})[_0x2b82('0x2b')](function(_0x2d4cc7){if(_0x2d4cc7&&_0x2d4cc7[_0x2b82('0x53')]===0x0){return db['UserProfileResource'][_0x2b82('0x4c')]({'name':_0x1d1815[_0x2b82('0x35')],'resourceId':_0x1d1815['id'],'type':_0x2d4cc7[_0x2b82('0x35')],'sectionId':_0x2d4cc7['id']},{})[_0x2b82('0x2b')](function(){return _0xb6ef50;});}else{return _0xb6ef50;}})['catch'](function(_0x5f6792){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f6792);throw _0x5f6792;});}return _0xb6ef50;})['then'](respondWithResult(_0x4da7a2,0xc9))[_0x2b82('0x4b')](handleError(_0x4da7a2,null));};exports[_0x2b82('0x2a')]=function(_0x59b454,_0x3f0be0){if(_0x59b454[_0x2b82('0x4d')]['id']){delete _0x59b454[_0x2b82('0x4d')]['id'];}return db[_0x2b82('0x33')]['find']({'where':{'id':_0x59b454[_0x2b82('0x54')]['id']}})['then'](handleEntityNotFound(_0x3f0be0,null))[_0x2b82('0x2b')](saveUpdates(_0x59b454[_0x2b82('0x4d')],null))['then'](respondWithResult(_0x3f0be0,null))[_0x2b82('0x4b')](handleError(_0x3f0be0,null));};exports[_0x2b82('0x2c')]=function(_0x597aea,_0x233325){return db[_0x2b82('0x33')][_0x2b82('0x51')]({'where':{'id':_0x597aea[_0x2b82('0x54')]['id']}})[_0x2b82('0x2b')](handleEntityNotFound(_0x233325,null))['then'](removeEntity(_0x233325,null))[_0x2b82('0x4b')](handleError(_0x233325,null));};exports['run']=function(_0x1e9667,_0x2ecd09,_0x108be1){var _0x5b9797=require(_0x2b82('0x55'));return db[_0x2b82('0x33')]['find']({'where':{'id':_0x1e9667['params']['id']},'raw':!![]})[_0x2b82('0x2b')](handleEntityNotFound(_0x2ecd09,null))[_0x2b82('0x2b')](function(){_0x5b9797[_0x2b82('0x56')](_0x1e9667['params']['id']);})[_0x2b82('0x2b')](respondWithStatusCode(_0x2ecd09,null))[_0x2b82('0x4b')](handleError(_0x2ecd09,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index f5ad028..c89fe86 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 _0x2c2c=['tools_schedules','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','Schedule'];(function(_0x4bc3b2,_0x5ed708){var _0x55e523=function(_0xb5a2f5){while(--_0xb5a2f5){_0x4bc3b2['push'](_0x4bc3b2['shift']());}};_0x55e523(++_0x5ed708);}(_0x2c2c,0x11f));var _0xc2c2=function(_0x126290,_0x437433){_0x126290=_0x126290-0x0;var _0x1186b3=_0x2c2c[_0x126290];return _0x1186b3;};'use strict';var _=require(_0xc2c2('0x0'));var util=require(_0xc2c2('0x1'));var logger=require(_0xc2c2('0x2'))(_0xc2c2('0x3'));var moment=require('moment');var BPromise=require(_0xc2c2('0x4'));var rp=require(_0xc2c2('0x5'));var fs=require('fs');var path=require(_0xc2c2('0x6'));var rimraf=require(_0xc2c2('0x7'));var config=require(_0xc2c2('0x8'));var attributes=require(_0xc2c2('0x9'));module['exports']=function(_0x182c8d,_0x412e9e){return _0x182c8d[_0xc2c2('0xa')](_0xc2c2('0xb'),attributes,{'tableName':_0xc2c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8594=['define','Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird','path','rimraf','exports'];(function(_0x130ddf,_0x513e68){var _0x5939bc=function(_0x103e81){while(--_0x103e81){_0x130ddf['push'](_0x130ddf['shift']());}};_0x5939bc(++_0x513e68);}(_0x8594,0x1a5));var _0x4859=function(_0x5ba845,_0x33d65f){_0x5ba845=_0x5ba845-0x0;var _0x23798c=_0x8594[_0x5ba845];return _0x23798c;};'use strict';var _=require(_0x4859('0x0'));var util=require(_0x4859('0x1'));var logger=require(_0x4859('0x2'))(_0x4859('0x3'));var moment=require('moment');var BPromise=require(_0x4859('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4859('0x5'));var rimraf=require(_0x4859('0x6'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0x4859('0x7')]=function(_0x28a10a,_0x6469d){return _0x28a10a[_0x4859('0x8')](_0x4859('0x9'),attributes,{'tableName':_0x4859('0xa'),'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 9e1f23b..bc2245c 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 _0x42a6=['Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x42a6,0x164));var _0x642a=function(_0x2ecdbe,_0x114206){_0x2ecdbe=_0x2ecdbe-0x0;var _0x44d6d4=_0x42a6[_0x2ecdbe];return _0x44d6d4;};'use strict';var _=require(_0x642a('0x0'));var util=require(_0x642a('0x1'));var moment=require(_0x642a('0x2'));var BPromise=require(_0x642a('0x3'));var rs=require(_0x642a('0x4'));var fs=require('fs');var Redis=require(_0x642a('0x5'));var db=require(_0x642a('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x642a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x642a('0x8')][_0x642a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x549815,_0x45a740,_0xa2b80c){return new BPromise(function(_0x58c5c1,_0x1e988d){return client[_0x642a('0xa')](_0x549815,_0xa2b80c)[_0x642a('0xb')](function(_0x539b49){logger['info'](_0x642a('0xc'),_0x45a740,'request\x20sent');logger[_0x642a('0xd')](_0x642a('0xe'),_0x45a740,_0x642a('0xf'),JSON[_0x642a('0x10')](_0x539b49));if(_0x539b49[_0x642a('0x11')]){if(_0x539b49['error'][_0x642a('0x12')]===0x1f4){logger['error'](_0x642a('0xc'),_0x45a740,_0x539b49[_0x642a('0x11')][_0x642a('0x13')]);return _0x1e988d(_0x539b49[_0x642a('0x11')][_0x642a('0x13')]);}logger[_0x642a('0x11')](_0x642a('0xc'),_0x45a740,_0x539b49['error'][_0x642a('0x13')]);return _0x58c5c1(_0x539b49[_0x642a('0x11')][_0x642a('0x13')]);}else{logger[_0x642a('0x14')](_0x642a('0xc'),_0x45a740,_0x642a('0xf'));_0x58c5c1(_0x539b49[_0x642a('0x15')][_0x642a('0x13')]);}})[_0x642a('0x16')](function(_0x3ef1a1){logger[_0x642a('0x11')](_0x642a('0xc'),_0x45a740,_0x3ef1a1);_0x1e988d(_0x3ef1a1);});});} \ No newline at end of file +var _0x0608=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0xd33801,_0x2c8c0f){var _0x420bb9=function(_0x55fad2){while(--_0x55fad2){_0xd33801['push'](_0xd33801['shift']());}};_0x420bb9(++_0x2c8c0f);}(_0x0608,0xab));var _0x8060=function(_0x4ce633,_0x54bee8){_0x4ce633=_0x4ce633-0x0;var _0x37c3b6=_0x0608[_0x4ce633];return _0x37c3b6;};'use strict';var _=require(_0x8060('0x0'));var util=require(_0x8060('0x1'));var moment=require(_0x8060('0x2'));var BPromise=require('bluebird');var rs=require(_0x8060('0x3'));var fs=require('fs');var Redis=require(_0x8060('0x4'));var db=require(_0x8060('0x5'))['db'];var utils=require(_0x8060('0x6'));var logger=require(_0x8060('0x7'))(_0x8060('0x8'));var config=require('../../config/environment');var jayson=require(_0x8060('0x9'));var client=jayson[_0x8060('0xa')][_0x8060('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4aec60,_0x8aa572,_0x38865f){return new BPromise(function(_0x2cb59a,_0x4efb95){return client[_0x8060('0xc')](_0x4aec60,_0x38865f)[_0x8060('0xd')](function(_0x1b1119){logger[_0x8060('0xe')](_0x8060('0xf'),_0x8aa572,'request\x20sent');logger[_0x8060('0x10')](_0x8060('0x11'),_0x8aa572,_0x8060('0x12'),JSON[_0x8060('0x13')](_0x1b1119));if(_0x1b1119['error']){if(_0x1b1119[_0x8060('0x14')][_0x8060('0x15')]===0x1f4){logger[_0x8060('0x14')]('Schedule,\x20%s,\x20%s',_0x8aa572,_0x1b1119[_0x8060('0x14')][_0x8060('0x16')]);return _0x4efb95(_0x1b1119[_0x8060('0x14')][_0x8060('0x16')]);}logger[_0x8060('0x14')](_0x8060('0xf'),_0x8aa572,_0x1b1119[_0x8060('0x14')]['message']);return _0x2cb59a(_0x1b1119[_0x8060('0x14')][_0x8060('0x16')]);}else{logger[_0x8060('0xe')](_0x8060('0xf'),_0x8aa572,_0x8060('0x12'));_0x2cb59a(_0x1b1119[_0x8060('0x17')]['message']);}})[_0x8060('0x18')](function(_0x56a221){logger[_0x8060('0x14')](_0x8060('0xf'),_0x8aa572,_0x56a221);_0x4efb95(_0x56a221);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index e3dc19e..fca65eb 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 _0xf968=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','describe','/:id','/:id/download','download','post'];(function(_0x415138,_0x5ee388){var _0x5d7c5c=function(_0x3ffc86){while(--_0x3ffc86){_0x415138['push'](_0x415138['shift']());}};_0x5d7c5c(++_0x5ee388);}(_0xf968,0xc5));var _0x8f96=function(_0x11b7f4,_0x38c58a){_0x11b7f4=_0x11b7f4-0x0;var _0x5d1d9c=_0xf968[_0x11b7f4];return _0x5d1d9c;};'use strict';var multer=require(_0x8f96('0x0'));var util=require(_0x8f96('0x1'));var path=require(_0x8f96('0x2'));var timeout=require(_0x8f96('0x3'));var express=require(_0x8f96('0x4'));var router=express[_0x8f96('0x5')]();var fs_extra=require(_0x8f96('0x6'));var auth=require(_0x8f96('0x7'));var interaction=require(_0x8f96('0x8'));var config=require(_0x8f96('0x9'));var controller=require(_0x8f96('0xa'));router[_0x8f96('0xb')]('/',auth[_0x8f96('0xc')](),controller[_0x8f96('0xd')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8f96('0xe')]);router[_0x8f96('0xb')](_0x8f96('0xf'),auth[_0x8f96('0xc')](),controller['show']);router[_0x8f96('0xb')](_0x8f96('0x10'),auth[_0x8f96('0xc')](),controller[_0x8f96('0x11')]);router[_0x8f96('0x12')]('/',auth['isAuthenticated'](),controller[_0x8f96('0x13')]);router[_0x8f96('0x14')](_0x8f96('0xf'),auth['isAuthenticated'](),controller[_0x8f96('0x15')]);router[_0x8f96('0x16')](_0x8f96('0xf'),auth[_0x8f96('0xc')](),controller['destroy']);module[_0x8f96('0x17')]=router; \ No newline at end of file +var _0x7946=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','describe','/:id','show','/:id/download','post','create','put','isAuthenticated','update','delete','destroy','multer'];(function(_0x3fcfb6,_0x515024){var _0x3b99a7=function(_0x10ddfd){while(--_0x10ddfd){_0x3fcfb6['push'](_0x3fcfb6['shift']());}};_0x3b99a7(++_0x515024);}(_0x7946,0x99));var _0x6794=function(_0x3b80b8,_0x2bf273){_0x3b80b8=_0x3b80b8-0x0;var _0xe36b2c=_0x7946[_0x3b80b8];return _0xe36b2c;};'use strict';var multer=require(_0x6794('0x0'));var util=require(_0x6794('0x1'));var path=require(_0x6794('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6794('0x3')]();var fs_extra=require(_0x6794('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6794('0x5'));var config=require(_0x6794('0x6'));var controller=require(_0x6794('0x7'));router[_0x6794('0x8')]('/',auth['isAuthenticated'](),controller[_0x6794('0x9')]);router[_0x6794('0x8')](_0x6794('0xa'),auth['isAuthenticated'](),controller[_0x6794('0xb')]);router[_0x6794('0x8')](_0x6794('0xc'),auth['isAuthenticated'](),controller[_0x6794('0xd')]);router[_0x6794('0x8')](_0x6794('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x6794('0xf')]('/',auth['isAuthenticated'](),controller[_0x6794('0x10')]);router[_0x6794('0x11')](_0x6794('0xc'),auth[_0x6794('0x12')](),controller[_0x6794('0x13')]);router[_0x6794('0x14')]('/:id',auth[_0x6794('0x12')](),controller[_0x6794('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 97ad6e7..5cf3c4d 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 _0x23db=['replace','setDataValue','value','INTEGER','startedAt','subtract','DATE','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','extname','getDataValue','STRING'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0x23db,0x141));var _0xb23d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x23db[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0xb23d('0x0'));var moment=require(_0xb23d('0x1'));var path=require(_0xb23d('0x2'));var config=require(_0xb23d('0x3'));module[_0xb23d('0x4')]={'format':{'type':Sequelize[_0xb23d('0x5')],'get':function(){return this['getDataValue']('value')?path[_0xb23d('0x6')](this[_0xb23d('0x7')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xb23d('0x8')]},'channel':{'type':Sequelize[_0xb23d('0x8')]},'value':{'type':Sequelize[_0xb23d('0x8')],'set':function(_0x2056b6){var _0x39799c=_0x2056b6[_0xb23d('0x9')](/\\/g,'/');this[_0xb23d('0xa')](_0xb23d('0xb'),_0x39799c);}},'rating':{'type':Sequelize[_0xb23d('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x2f91f0){this[_0xb23d('0xa')](_0xb23d('0xd'),moment()[_0xb23d('0xe')](_0x2f91f0,'ms'));this[_0xb23d('0xa')]('closedAt',moment());this['setDataValue']('duration',_0x2f91f0);}},'startedAt':{'type':Sequelize[_0xb23d('0xf')],'get':function(){return moment(this['getDataValue'](_0xb23d('0xd')))[_0xb23d('0x10')](_0xb23d('0x11'))[_0xb23d('0x12')]();}},'closedAt':{'type':Sequelize[_0xb23d('0xf')],'get':function(){return moment(this[_0xb23d('0x7')](_0xb23d('0x13')))['format'](_0xb23d('0x11'))[_0xb23d('0x12')]();}},'createdAt':{'type':Sequelize[_0xb23d('0xf')],'get':function(){return moment(this[_0xb23d('0x7')](_0xb23d('0x14')))[_0xb23d('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0xb23d('0xf')],'get':function(){return moment(this[_0xb23d('0x7')](_0xb23d('0x15')))[_0xb23d('0x10')](_0xb23d('0x11'))[_0xb23d('0x12')]();}}}; \ No newline at end of file +var _0x1c9a=['format','MM-DD-YYYY\x20HH:mm','createdAt','toString','updatedAt','sequelize','path','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','DATE','startedAt'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x1c9a,0x98));var _0xa1c9=function(_0x2bdcd6,_0x52e426){_0x2bdcd6=_0x2bdcd6-0x0;var _0x299f09=_0x1c9a[_0x2bdcd6];return _0x299f09;};'use strict';var Sequelize=require(_0xa1c9('0x0'));var moment=require('moment');var path=require(_0xa1c9('0x1'));var config=require('../../config/environment');module[_0xa1c9('0x2')]={'format':{'type':Sequelize[_0xa1c9('0x3')],'get':function(){return this[_0xa1c9('0x4')]('value')?path[_0xa1c9('0x5')](this[_0xa1c9('0x4')](_0xa1c9('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xa1c9('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xa1c9('0x7')],'set':function(_0x5448f2){var _0x222624=_0x5448f2[_0xa1c9('0x8')](/\\/g,'/');this[_0xa1c9('0x9')]('value',_0x222624);}},'rating':{'type':Sequelize[_0xa1c9('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa1c9('0xa')],'set':function(_0x24136d){this[_0xa1c9('0x9')]('startedAt',moment()[_0xa1c9('0xb')](_0x24136d,'ms'));this[_0xa1c9('0x9')](_0xa1c9('0xc'),moment());this[_0xa1c9('0x9')](_0xa1c9('0xd'),_0x24136d);}},'startedAt':{'type':Sequelize[_0xa1c9('0xe')],'get':function(){return moment(this[_0xa1c9('0x4')](_0xa1c9('0xf')))[_0xa1c9('0x10')](_0xa1c9('0x11'))['toString']();}},'closedAt':{'type':Sequelize[_0xa1c9('0xe')],'get':function(){return moment(this[_0xa1c9('0x4')](_0xa1c9('0xc')))[_0xa1c9('0x10')](_0xa1c9('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0xa1c9('0xe')],'get':function(){return moment(this[_0xa1c9('0x4')](_0xa1c9('0x12')))[_0xa1c9('0x10')](_0xa1c9('0x11'))[_0xa1c9('0x13')]();}},'updatedAt':{'type':Sequelize[_0xa1c9('0xe')],'get':function(){return moment(this[_0xa1c9('0x4')](_0xa1c9('0x14')))[_0xa1c9('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xa1c9('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 9aaa801..be34436 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 _0xdc97=['join','root','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','sendStatus','error','name','send','index','map','format','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','options','ScreenRecording','includeAll','rows','catch','show','params','include','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid'];(function(_0xea1a1d,_0x112f7e){var _0x3f9495=function(_0x1ce9b4){while(--_0x1ce9b4){_0xea1a1d['push'](_0xea1a1d['shift']());}};_0x3f9495(++_0x112f7e);}(_0xdc97,0x13b));var _0x7dc9=function(_0x46d9d4,_0x49de8d){_0x46d9d4=_0x46d9d4-0x0;var _0x12ff3b=_0xdc97[_0x46d9d4];return _0x12ff3b;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){_0xffc080[_0x7dc9('0x16')](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x55a482,_0x48c6bc){return function(_0x4b9ba6){if(!_0x4b9ba6){_0x55a482[_0x7dc9('0x22')](0x194);}return _0x4b9ba6;};}function handleError(_0x32d032,_0x5843bf){_0x5843bf=_0x5843bf||0x1f4;return function(_0x585eef){logger[_0x7dc9('0x23')](_0x585eef['stack']);if(_0x585eef[_0x7dc9('0x24')]){delete _0x585eef[_0x7dc9('0x24')];}_0x32d032[_0x7dc9('0x16')](_0x5843bf)[_0x7dc9('0x25')](_0x585eef);};}exports[_0x7dc9('0x26')]=function(_0x450124,_0x236d42){var _0x229f8e={},_0x1fcf0e={},_0x3c4379={'count':0x0,'rows':[]};var _0x14083d=_[_0x7dc9('0x27')](db['ScreenRecording']['rawAttributes'],function(_0x513dd6){return{'name':_0x513dd6['fieldName'],'type':_0x513dd6['type']['key']};});_0x1fcf0e['model']=_['differenceBy'](_[_0x7dc9('0x27')](_0x14083d,_0x7dc9('0x24')),[_0x7dc9('0x28')]);_0x1fcf0e[_0x7dc9('0x29')]=_[_0x7dc9('0x2a')](_0x450124[_0x7dc9('0x29')]);_0x1fcf0e['filters']=_['intersection'](_0x1fcf0e['model'],_0x1fcf0e[_0x7dc9('0x29')]);_0x229f8e['attributes']=_[_0x7dc9('0x2b')](_0x1fcf0e[_0x7dc9('0x2c')],qs[_0x7dc9('0x2d')](_0x450124[_0x7dc9('0x29')][_0x7dc9('0x2d')]));_0x229f8e[_0x7dc9('0x2e')]=_0x229f8e[_0x7dc9('0x2e')][_0x7dc9('0x2f')]?_0x229f8e['attributes']:_0x1fcf0e[_0x7dc9('0x2c')];if(!_0x450124['query'][_0x7dc9('0x30')](_0x7dc9('0x31'))){_0x229f8e[_0x7dc9('0x1a')]=qs[_0x7dc9('0x1a')](_0x450124['query'][_0x7dc9('0x1a')]);_0x229f8e['offset']=qs[_0x7dc9('0x18')](_0x450124['query']['offset']);}_0x229f8e[_0x7dc9('0x32')]=qs[_0x7dc9('0x33')](_0x450124[_0x7dc9('0x29')][_0x7dc9('0x33')]);_0x229f8e['where']=qs[_0x7dc9('0x34')](_[_0x7dc9('0x35')](_0x450124[_0x7dc9('0x29')],_0x1fcf0e[_0x7dc9('0x34')]),_0x14083d);if(_0x450124[_0x7dc9('0x29')][_0x7dc9('0x36')]){_0x229f8e[_0x7dc9('0x37')]=_[_0x7dc9('0x38')](_0x229f8e[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x27')](_0x14083d,function(_0x452aed){if(_0x452aed[_0x7dc9('0x39')]!=='VIRTUAL'){var _0x34b5c9={};_0x34b5c9[_0x452aed[_0x7dc9('0x24')]]={'$like':'%'+_0x450124[_0x7dc9('0x29')][_0x7dc9('0x36')]+'%'};return _0x34b5c9;}})});}_0x229f8e=_['merge']({},_0x229f8e,_0x450124[_0x7dc9('0x3a')]);var _0x89db0e={'where':_0x229f8e[_0x7dc9('0x37')]};return db[_0x7dc9('0x3b')][_0x7dc9('0x1b')](_0x89db0e)[_0x7dc9('0x21')](function(_0x5a1201){_0x3c4379['count']=_0x5a1201;if(_0x450124[_0x7dc9('0x29')][_0x7dc9('0x3c')]){_0x229f8e['include']=[{'all':!![]}];}return db[_0x7dc9('0x3b')]['findAll'](_0x229f8e);})[_0x7dc9('0x21')](function(_0x2a91fe){_0x3c4379[_0x7dc9('0x3d')]=_0x2a91fe;return _0x3c4379;})['then'](respondWithFilteredResult(_0x236d42,_0x229f8e))[_0x7dc9('0x3e')](handleError(_0x236d42,null));};exports[_0x7dc9('0x3f')]=function(_0x1929b6,_0x95513c){var _0x28ffc0={'raw':![],'where':{'id':_0x1929b6[_0x7dc9('0x40')]['id']}},_0x23499a={};_0x23499a['model']=_[_0x7dc9('0x2a')](db['ScreenRecording']['rawAttributes']);_0x23499a[_0x7dc9('0x29')]=_[_0x7dc9('0x2a')](_0x1929b6[_0x7dc9('0x29')]);_0x23499a[_0x7dc9('0x34')]=_[_0x7dc9('0x2b')](_0x23499a[_0x7dc9('0x2c')],_0x23499a[_0x7dc9('0x29')]);_0x28ffc0[_0x7dc9('0x2e')]=_[_0x7dc9('0x2b')](_0x23499a['model'],qs[_0x7dc9('0x2d')](_0x1929b6[_0x7dc9('0x29')][_0x7dc9('0x2d')]));_0x28ffc0[_0x7dc9('0x2e')]=_0x28ffc0[_0x7dc9('0x2e')][_0x7dc9('0x2f')]?_0x28ffc0['attributes']:_0x23499a[_0x7dc9('0x2c')];if(_0x1929b6[_0x7dc9('0x29')]['includeAll']){_0x28ffc0[_0x7dc9('0x41')]=[{'all':!![]}];}_0x28ffc0=_[_0x7dc9('0x38')]({},_0x28ffc0,_0x1929b6[_0x7dc9('0x3a')]);return db['ScreenRecording'][_0x7dc9('0x42')](_0x28ffc0)['then'](handleEntityNotFound(_0x95513c,null))['then'](respondWithResult(_0x95513c,null))[_0x7dc9('0x3e')](handleError(_0x95513c,null));};exports[_0x7dc9('0x43')]=function(_0x36d591,_0x5e0dc5){return db['ScreenRecording'][_0x7dc9('0x43')](_0x36d591['body'],{})[_0x7dc9('0x21')](respondWithResult(_0x5e0dc5,0xc9))[_0x7dc9('0x3e')](handleError(_0x5e0dc5,null));};exports['update']=function(_0x24ccce,_0x1d6c0a){if(_0x24ccce[_0x7dc9('0x44')]['id']){delete _0x24ccce[_0x7dc9('0x44')]['id'];}delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x45')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x46')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x47')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x48')];return db[_0x7dc9('0x3b')]['find']({'where':{'id':_0x24ccce[_0x7dc9('0x40')]['id']}})['then'](handleEntityNotFound(_0x1d6c0a,null))['then'](saveUpdates(_0x24ccce[_0x7dc9('0x44')],null))[_0x7dc9('0x21')](respondWithResult(_0x1d6c0a,null))[_0x7dc9('0x3e')](handleError(_0x1d6c0a,null));};exports[_0x7dc9('0x49')]=function(_0x346d27,_0x510e2a){return db[_0x7dc9('0x3b')][_0x7dc9('0x49')]()[_0x7dc9('0x21')](respondWithResult(_0x510e2a,null))['catch'](handleError(_0x510e2a,null));};exports[_0x7dc9('0x4a')]=function(_0x3fc164,_0x2cf133,_0x32bc31){var _0xf41b8c=require(_0x7dc9('0x4b'));var _0x593132=![];var _0x366b8b={};if(_0x3fc164[_0x7dc9('0x29')][_0x7dc9('0x39')]&&_0x3fc164[_0x7dc9('0x29')][_0x7dc9('0x39')]===_0x7dc9('0x4c')){_0x366b8b[_0x7dc9('0x4c')]=_0x3fc164[_0x7dc9('0x40')]['id'];}else{_0x366b8b['id']=_0x3fc164[_0x7dc9('0x40')]['id'];}return db[_0x7dc9('0x3b')][_0x7dc9('0x42')]({'where':_0x366b8b,'attributes':['id',_0x7dc9('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x2cf133,null))[_0x7dc9('0x21')](function(_0x39be46){if(_0x39be46){var _0x38df9a=path[_0x7dc9('0x4d')](config[_0x7dc9('0x4e')],'server/files/screen_recordings',_0x39be46[_0x7dc9('0x48')]);var _0xd8d327=util[_0x7dc9('0x28')](_0x7dc9('0x4f'),_0x38df9a);if(fs[_0x7dc9('0x50')](_0xd8d327)){_0x593132=!![];return _0xf41b8c[_0x7dc9('0x51')](_0xd8d327,_0x38df9a,config['secrets']['recording'])['then'](function(){return _0x39be46;});}return _0x39be46;}})[_0x7dc9('0x21')](function(_0x3daf33){if(_0x3daf33){var _0x32a64f=path[_0x7dc9('0x4d')](config['root'],'server/files/screen_recordings',_0x3daf33[_0x7dc9('0x48')]);if(!fs[_0x7dc9('0x50')](_0x32a64f)){throw new db[(_0x7dc9('0x52'))][(_0x7dc9('0x53'))](_0x7dc9('0x54'));}if(_0x3daf33[_0x7dc9('0x55')]){return _0x2cf133[_0x7dc9('0x4a')](_0x32a64f,_0x3daf33['filename']+path[_0x7dc9('0x56')](_0x32a64f),function(){if(_0x593132){fs[_0x7dc9('0x57')](_0x32a64f);}});}else{return _0x2cf133[_0x7dc9('0x4a')](_0x32a64f,function(_0x1dad95){if(_0x593132){fs[_0x7dc9('0x57')](_0x32a64f);}});}}})['catch'](function(_0x175858){if(_0x175858[_0x7dc9('0x58')]===_0x7dc9('0x54')){_0x2cf133[_0x7dc9('0x16')](0x194)[_0x7dc9('0x25')](_0x7dc9('0x59'));}else{return handleError(_0x2cf133,null);}});};exports[_0x7dc9('0x5a')]=function(_0x2a02ed,_0x3463e4){return db[_0x7dc9('0x3b')][_0x7dc9('0x42')]({'where':{'id':_0x2a02ed[_0x7dc9('0x40')]['id']}})[_0x7dc9('0x21')](function(_0x5eee27){if(_[_0x7dc9('0x5b')](_0x5eee27)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5eee27;})[_0x7dc9('0x21')](function(_0x15cf19){var _0x48ea37=path[_0x7dc9('0x4d')](config[_0x7dc9('0x4e')],'server/files/screen_recordings',_0x15cf19[_0x7dc9('0x48')]);logger[_0x7dc9('0x5c')](_0x7dc9('0x5d'),_0x48ea37);if(!_['isNil'](_0x15cf19['value'])&&fs[_0x7dc9('0x50')](_0x48ea37)){logger[_0x7dc9('0x5c')](_0x7dc9('0x5e')+_0x48ea37+_0x7dc9('0x5f'));fs[_0x7dc9('0x60')](_0x48ea37);}_0x48ea37=_0x48ea37+_0x7dc9('0x61');if(!_[_0x7dc9('0x5b')](_0x15cf19[_0x7dc9('0x48')])&&fs[_0x7dc9('0x50')](_0x48ea37)){logger['info'](_0x7dc9('0x5e')+_0x48ea37+_0x7dc9('0x5f'));fs[_0x7dc9('0x60')](_0x48ea37);}return _0x15cf19;})['then'](function(_0x4f80bd){if(!_0x4f80bd)throw new InternalError();return _0x4f80bd[_0x7dc9('0x5a')]();})[_0x7dc9('0x21')](function(){_0x3463e4[_0x7dc9('0x16')](0xcc)[_0x7dc9('0x17')]();})['catch'](handleError(_0x3463e4,null));}; \ No newline at end of file +var _0x207c=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','duration','createdAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb'];(function(_0xa446e4,_0x184a24){var _0x4b2b92=function(_0x57b0f9){while(--_0x57b0f9){_0xa446e4['push'](_0xa446e4['shift']());}};_0x4b2b92(++_0x184a24);}(_0x207c,0x1e8));var _0xc207=function(_0x552252,_0xdb0d75){_0x552252=_0x552252-0x0;var _0x16ae8d=_0x207c[_0x552252];return _0x16ae8d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc207('0x0'));var zipdir=require(_0xc207('0x1'));var jsonpatch=require(_0xc207('0x2'));var rp=require(_0xc207('0x3'));var moment=require(_0xc207('0x4'));var BPromise=require(_0xc207('0x5'));var Mustache=require(_0xc207('0x6'));var util=require('util');var path=require(_0xc207('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc207('0x8'));var _=require(_0xc207('0x9'));var squel=require(_0xc207('0xa'));var crypto=require('crypto');var jsforce=require(_0xc207('0xb'));var deskjs=require(_0xc207('0xc'));var toCsv=require(_0xc207('0xd'));var querystring=require('querystring');var Papa=require(_0xc207('0xe'));var Redis=require(_0xc207('0xf'));var authService=require(_0xc207('0x10'));var qs=require(_0xc207('0x11'));var as=require(_0xc207('0x12'));var hardwareService=require(_0xc207('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc207('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc207('0x15'))['db'];function respondWithStatusCode(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xcc;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0x16')](_0x59d401);}return _0x2782ce[_0xc207('0x17')](_0x59d401)[_0xc207('0x18')]();};}function respondWithResult(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0xc8;return function(_0xc62672){if(_0xc62672){return _0xe993a0[_0xc207('0x17')](_0x51e967)[_0xc207('0x19')](_0xc62672);}};}function respondWithFilteredResult(_0x4031ad,_0x4ef6c4){return function(_0x564cef){if(_0x564cef){var _0x554e5c=typeof _0x4ef6c4[_0xc207('0x1a')]===_0xc207('0x1b')&&typeof _0x4ef6c4[_0xc207('0x1c')]===_0xc207('0x1b');var _0x4b8f44=_0x564cef[_0xc207('0x1d')];var _0x282595=_0x554e5c?0x0:_0x4ef6c4[_0xc207('0x1a')];var _0x5f288e=_0x554e5c?_0x564cef[_0xc207('0x1d')]:_0x4ef6c4['offset']+_0x4ef6c4[_0xc207('0x1c')];var _0x33ddb1;if(_0x5f288e>=_0x4b8f44){_0x5f288e=_0x4b8f44;_0x33ddb1=0xc8;}else{_0x33ddb1=0xce;}_0x4031ad[_0xc207('0x17')](_0x33ddb1);return _0x4031ad[_0xc207('0x1e')](_0xc207('0x1f'),_0x282595+'-'+_0x5f288e+'/'+_0x4b8f44)[_0xc207('0x19')](_0x564cef);}return null;};}function patchUpdates(_0x35c0b0){return function(_0x464dea){try{jsonpatch[_0xc207('0x20')](_0x464dea,_0x35c0b0,!![]);}catch(_0x2bd2eb){return BPromise[_0xc207('0x21')](_0x2bd2eb);}return _0x464dea[_0xc207('0x22')]();};}function saveUpdates(_0x40de25,_0x4b52a7){return function(_0x163b36){if(_0x163b36){return _0x163b36['update'](_0x40de25)[_0xc207('0x23')](function(_0x3ac142){return _0x3ac142;});}return null;};}function removeEntity(_0x1eabe8,_0x83253f){return function(_0x3539f4){if(_0x3539f4){return _0x3539f4[_0xc207('0x24')]()[_0xc207('0x23')](function(){_0x1eabe8[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();});}};}function handleEntityNotFound(_0x2385f7,_0x25c91e){return function(_0x27df03){if(!_0x27df03){_0x2385f7[_0xc207('0x16')](0x194);}return _0x27df03;};}function handleError(_0x138970,_0x1445d3){_0x1445d3=_0x1445d3||0x1f4;return function(_0x56a066){logger[_0xc207('0x25')](_0x56a066['stack']);if(_0x56a066['name']){delete _0x56a066[_0xc207('0x26')];}_0x138970[_0xc207('0x17')](_0x1445d3)[_0xc207('0x27')](_0x56a066);};}exports[_0xc207('0x28')]=function(_0x6a653d,_0x478af7){var _0xe5e848={},_0x463ac8={},_0x6223ef={'count':0x0,'rows':[]};var _0x1bec3f=_[_0xc207('0x29')](db[_0xc207('0x2a')][_0xc207('0x2b')],function(_0x27bc72){return{'name':_0x27bc72[_0xc207('0x2c')],'type':_0x27bc72[_0xc207('0x2d')][_0xc207('0x2e')]};});_0x463ac8[_0xc207('0x2f')]=_[_0xc207('0x30')](_['map'](_0x1bec3f,_0xc207('0x26')),[_0xc207('0x31')]);_0x463ac8[_0xc207('0x32')]=_[_0xc207('0x33')](_0x6a653d[_0xc207('0x32')]);_0x463ac8[_0xc207('0x34')]=_['intersection'](_0x463ac8[_0xc207('0x2f')],_0x463ac8[_0xc207('0x32')]);_0xe5e848[_0xc207('0x35')]=_[_0xc207('0x36')](_0x463ac8['model'],qs[_0xc207('0x37')](_0x6a653d[_0xc207('0x32')][_0xc207('0x37')]));_0xe5e848[_0xc207('0x35')]=_0xe5e848[_0xc207('0x35')][_0xc207('0x38')]?_0xe5e848[_0xc207('0x35')]:_0x463ac8[_0xc207('0x2f')];if(!_0x6a653d[_0xc207('0x32')]['hasOwnProperty']('nolimit')){_0xe5e848[_0xc207('0x1c')]=qs[_0xc207('0x1c')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1c')]);_0xe5e848['offset']=qs[_0xc207('0x1a')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1a')]);}_0xe5e848[_0xc207('0x39')]=qs[_0xc207('0x3a')](_0x6a653d['query'][_0xc207('0x3a')]);_0xe5e848[_0xc207('0x3b')]=qs['filters'](_[_0xc207('0x3c')](_0x6a653d['query'],_0x463ac8[_0xc207('0x34')]),_0x1bec3f);if(_0x6a653d[_0xc207('0x32')]['filter']){_0xe5e848[_0xc207('0x3b')]=_[_0xc207('0x3d')](_0xe5e848[_0xc207('0x3b')],{'$or':_['map'](_0x1bec3f,function(_0x5b3041){if(_0x5b3041[_0xc207('0x2d')]!==_0xc207('0x3e')){var _0x41d66c={};_0x41d66c[_0x5b3041[_0xc207('0x26')]]={'$like':'%'+_0x6a653d['query'][_0xc207('0x3f')]+'%'};return _0x41d66c;}})});}_0xe5e848=_['merge']({},_0xe5e848,_0x6a653d['options']);var _0x4c10ed={'where':_0xe5e848['where']};return db[_0xc207('0x2a')][_0xc207('0x1d')](_0x4c10ed)[_0xc207('0x23')](function(_0x487f98){_0x6223ef[_0xc207('0x1d')]=_0x487f98;if(_0x6a653d[_0xc207('0x32')][_0xc207('0x40')]){_0xe5e848[_0xc207('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xc207('0x42')](_0xe5e848);})[_0xc207('0x23')](function(_0x123a46){_0x6223ef[_0xc207('0x43')]=_0x123a46;return _0x6223ef;})[_0xc207('0x23')](respondWithFilteredResult(_0x478af7,_0xe5e848))['catch'](handleError(_0x478af7,null));};exports[_0xc207('0x44')]=function(_0x19a67d,_0x3a935a){var _0x471a85={'raw':![],'where':{'id':_0x19a67d[_0xc207('0x45')]['id']}},_0x153490={};_0x153490[_0xc207('0x2f')]=_[_0xc207('0x33')](db[_0xc207('0x2a')]['rawAttributes']);_0x153490[_0xc207('0x32')]=_[_0xc207('0x33')](_0x19a67d['query']);_0x153490[_0xc207('0x34')]=_[_0xc207('0x36')](_0x153490[_0xc207('0x2f')],_0x153490[_0xc207('0x32')]);_0x471a85[_0xc207('0x35')]=_['intersection'](_0x153490[_0xc207('0x2f')],qs[_0xc207('0x37')](_0x19a67d[_0xc207('0x32')]['fields']));_0x471a85[_0xc207('0x35')]=_0x471a85[_0xc207('0x35')][_0xc207('0x38')]?_0x471a85[_0xc207('0x35')]:_0x153490['model'];if(_0x19a67d['query'][_0xc207('0x40')]){_0x471a85[_0xc207('0x41')]=[{'all':!![]}];}_0x471a85=_[_0xc207('0x3d')]({},_0x471a85,_0x19a67d[_0xc207('0x46')]);return db[_0xc207('0x2a')][_0xc207('0x47')](_0x471a85)[_0xc207('0x23')](handleEntityNotFound(_0x3a935a,null))[_0xc207('0x23')](respondWithResult(_0x3a935a,null))[_0xc207('0x48')](handleError(_0x3a935a,null));};exports[_0xc207('0x49')]=function(_0x2afcd1,_0x2fda4f){return db['ScreenRecording']['create'](_0x2afcd1[_0xc207('0x4a')],{})[_0xc207('0x23')](respondWithResult(_0x2fda4f,0xc9))[_0xc207('0x48')](handleError(_0x2fda4f,null));};exports['update']=function(_0x2b89e0,_0x3f712d){if(_0x2b89e0[_0xc207('0x4a')]['id']){delete _0x2b89e0[_0xc207('0x4a')]['id'];}delete _0x2b89e0['body'][_0xc207('0x4b')];delete _0x2b89e0['body'][_0xc207('0x4c')];delete _0x2b89e0['body']['closedAt'];delete _0x2b89e0[_0xc207('0x4a')][_0xc207('0x4d')];return db['ScreenRecording']['find']({'where':{'id':_0x2b89e0['params']['id']}})[_0xc207('0x23')](handleEntityNotFound(_0x3f712d,null))[_0xc207('0x23')](saveUpdates(_0x2b89e0[_0xc207('0x4a')],null))[_0xc207('0x23')](respondWithResult(_0x3f712d,null))[_0xc207('0x48')](handleError(_0x3f712d,null));};exports[_0xc207('0x4e')]=function(_0x3dc457,_0x1dfdee){return db['ScreenRecording'][_0xc207('0x4e')]()[_0xc207('0x23')](respondWithResult(_0x1dfdee,null))['catch'](handleError(_0x1dfdee,null));};exports['download']=function(_0x362001,_0x47c630,_0x49a78b){var _0x2634d6=require(_0xc207('0x4f'));var _0x356c8c=![];var _0x3b2448={};if(_0x362001[_0xc207('0x32')][_0xc207('0x2d')]&&_0x362001[_0xc207('0x32')][_0xc207('0x2d')]===_0xc207('0x50')){_0x3b2448[_0xc207('0x50')]=_0x362001[_0xc207('0x45')]['id'];}else{_0x3b2448['id']=_0x362001['params']['id'];}return db['ScreenRecording'][_0xc207('0x47')]({'where':_0x3b2448,'attributes':['id',_0xc207('0x4d')],'raw':!![]})[_0xc207('0x23')](handleEntityNotFound(_0x47c630,null))[_0xc207('0x23')](function(_0xaff7a0){if(_0xaff7a0){var _0x21c12b=path[_0xc207('0x51')](config[_0xc207('0x52')],_0xc207('0x53'),_0xaff7a0['value']);var _0x1cc4e3=util[_0xc207('0x31')](_0xc207('0x54'),_0x21c12b);if(fs[_0xc207('0x55')](_0x1cc4e3)){_0x356c8c=!![];return _0x2634d6['decryptFile'](_0x1cc4e3,_0x21c12b,config[_0xc207('0x56')][_0xc207('0x57')])[_0xc207('0x23')](function(){return _0xaff7a0;});}return _0xaff7a0;}})[_0xc207('0x23')](function(_0x464263){if(_0x464263){var _0x45ad58=path[_0xc207('0x51')](config['root'],_0xc207('0x53'),_0x464263[_0xc207('0x4d')]);if(!fs[_0xc207('0x55')](_0x45ad58)){throw new db[(_0xc207('0x58'))]['ValidationError'](_0xc207('0x59'));}if(_0x464263['filename']){return _0x47c630['download'](_0x45ad58,_0x464263[_0xc207('0x5a')]+path[_0xc207('0x5b')](_0x45ad58),function(){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}else{return _0x47c630[_0xc207('0x5d')](_0x45ad58,function(_0x441d5f){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}}})[_0xc207('0x48')](function(_0x33c372){if(_0x33c372[_0xc207('0x5e')]===_0xc207('0x59')){_0x47c630[_0xc207('0x17')](0x194)[_0xc207('0x27')](_0xc207('0x5f'));}else{return handleError(_0x47c630,null);}});};exports[_0xc207('0x24')]=function(_0x282ae5,_0x501bca){return db[_0xc207('0x2a')]['find']({'where':{'id':_0x282ae5[_0xc207('0x45')]['id']}})[_0xc207('0x23')](function(_0x2ade23){if(_['isNil'](_0x2ade23)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2ade23;})[_0xc207('0x23')](function(_0x3ac0dd){var _0x2f18a2=path['join'](config[_0xc207('0x52')],_0xc207('0x53'),_0x3ac0dd[_0xc207('0x4d')]);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x2f18a2);if(!_[_0xc207('0x60')](_0x3ac0dd['value'])&&fs[_0xc207('0x55')](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}_0x2f18a2=_0x2f18a2+_0xc207('0x65');if(!_[_0xc207('0x60')](_0x3ac0dd[_0xc207('0x4d')])&&fs['existsSync'](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}return _0x3ac0dd;})[_0xc207('0x23')](function(_0x14050a){if(!_0x14050a)throw new InternalError();return _0x14050a[_0xc207('0x24')]();})[_0xc207('0x23')](function(){_0x501bca[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();})[_0xc207('0x48')](handleError(_0x501bca,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index f9ab97d..06e0972 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 _0x0cc3=['request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment','bluebird'];(function(_0x4df76b,_0x44aefd){var _0x82af3b=function(_0x1d5fbd){while(--_0x1d5fbd){_0x4df76b['push'](_0x4df76b['shift']());}};_0x82af3b(++_0x44aefd);}(_0x0cc3,0x191));var _0x30cc=function(_0x4cf3a3,_0x2c687e){_0x4cf3a3=_0x4cf3a3-0x0;var _0x1e0e3f=_0x0cc3[_0x4cf3a3];return _0x1e0e3f;};'use strict';var _=require(_0x30cc('0x0'));var util=require(_0x30cc('0x1'));var logger=require('../../config/logger')(_0x30cc('0x2'));var moment=require(_0x30cc('0x3'));var BPromise=require(_0x30cc('0x4'));var rp=require(_0x30cc('0x5'));var fs=require('fs');var path=require(_0x30cc('0x6'));var rimraf=require(_0x30cc('0x7'));var config=require(_0x30cc('0x8'));var attributes=require(_0x30cc('0x9'));module['exports']=function(_0x239b03,_0x3f92f5){return _0x239b03[_0x30cc('0xa')](_0x30cc('0xb'),attributes,{'tableName':_0x30cc('0xc'),'paranoid':![],'indexes':[{'name':_0x30cc('0xd'),'fields':[_0x30cc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x248e=['path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x47e0b0,_0x145a6a){var _0x117b35=function(_0x3dc14f){while(--_0x3dc14f){_0x47e0b0['push'](_0x47e0b0['shift']());}};_0x117b35(++_0x145a6a);}(_0x248e,0xcb));var _0xe248=function(_0x430053,_0x510e9d){_0x430053=_0x430053-0x0;var _0x21384f=_0x248e[_0x430053];return _0x21384f;};'use strict';var _=require(_0xe248('0x0'));var util=require(_0xe248('0x1'));var logger=require(_0xe248('0x2'))(_0xe248('0x3'));var moment=require(_0xe248('0x4'));var BPromise=require(_0xe248('0x5'));var rp=require(_0xe248('0x6'));var fs=require('fs');var path=require(_0xe248('0x7'));var rimraf=require(_0xe248('0x8'));var config=require(_0xe248('0x9'));var attributes=require(_0xe248('0xa'));module[_0xe248('0xb')]=function(_0x48a58e,_0x1b62b2){return _0x48a58e[_0xe248('0xc')]('ScreenRecording',attributes,{'tableName':_0xe248('0xd'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xe248('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 6f4465b..fa3f7cc 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 _0x7323=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3d11c4,_0x248d30){var _0x56a383=function(_0x23d539){while(--_0x23d539){_0x3d11c4['push'](_0x3d11c4['shift']());}};_0x56a383(++_0x248d30);}(_0x7323,0x126));var _0x3732=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x7323[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x3732('0x0'));var util=require(_0x3732('0x1'));var moment=require(_0x3732('0x2'));var BPromise=require(_0x3732('0x3'));var rs=require(_0x3732('0x4'));var fs=require('fs');var Redis=require(_0x3732('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3732('0x6'));var logger=require(_0x3732('0x7'))(_0x3732('0x8'));var config=require(_0x3732('0x9'));var jayson=require(_0x3732('0xa'));var client=jayson[_0x3732('0xb')][_0x3732('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1fdbfb,_0x13a1f8,_0x3cb424){return new BPromise(function(_0x27f9c9,_0x28bc2d){return client['request'](_0x1fdbfb,_0x3cb424)[_0x3732('0xd')](function(_0x2b08ce){logger[_0x3732('0xe')](_0x3732('0xf'),_0x13a1f8,_0x3732('0x10'));logger[_0x3732('0x11')](_0x3732('0x12'),_0x13a1f8,_0x3732('0x10'),JSON[_0x3732('0x13')](_0x2b08ce));if(_0x2b08ce[_0x3732('0x14')]){if(_0x2b08ce[_0x3732('0x14')][_0x3732('0x15')]===0x1f4){logger['error'](_0x3732('0xf'),_0x13a1f8,_0x2b08ce['error']['message']);return _0x28bc2d(_0x2b08ce['error'][_0x3732('0x16')]);}logger[_0x3732('0x14')]('ScreenRecording,\x20%s,\x20%s',_0x13a1f8,_0x2b08ce[_0x3732('0x14')][_0x3732('0x16')]);return _0x27f9c9(_0x2b08ce[_0x3732('0x14')][_0x3732('0x16')]);}else{logger['info'](_0x3732('0xf'),_0x13a1f8,_0x3732('0x10'));_0x27f9c9(_0x2b08ce[_0x3732('0x17')]['message']);}})[_0x3732('0x18')](function(_0x31b9c8){logger[_0x3732('0x14')]('ScreenRecording,\x20%s,\x20%s',_0x13a1f8,_0x31b9c8);_0x28bc2d(_0x31b9c8);});});} \ No newline at end of file +var _0xb4cf=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','stringify','error','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb4cf,0x19f));var _0xfb4c=function(_0x262cb5,_0x28ecfa){_0x262cb5=_0x262cb5-0x0;var _0x4e40ff=_0xb4cf[_0x262cb5];return _0x4e40ff;};'use strict';var _=require(_0xfb4c('0x0'));var util=require('util');var moment=require(_0xfb4c('0x1'));var BPromise=require('bluebird');var rs=require(_0xfb4c('0x2'));var fs=require('fs');var Redis=require(_0xfb4c('0x3'));var db=require(_0xfb4c('0x4'))['db'];var utils=require(_0xfb4c('0x5'));var logger=require(_0xfb4c('0x6'))(_0xfb4c('0x7'));var config=require(_0xfb4c('0x8'));var jayson=require(_0xfb4c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x179423,_0x33a95b,_0x13458d){return new BPromise(function(_0x238ef5,_0x17a8be){return client[_0xfb4c('0xa')](_0x179423,_0x13458d)['then'](function(_0x460fad){logger[_0xfb4c('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x33a95b,_0xfb4c('0xc'));logger[_0xfb4c('0xd')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x33a95b,_0xfb4c('0xc'),JSON[_0xfb4c('0xe')](_0x460fad));if(_0x460fad[_0xfb4c('0xf')]){if(_0x460fad[_0xfb4c('0xf')]['code']===0x1f4){logger[_0xfb4c('0xf')](_0xfb4c('0x10'),_0x33a95b,_0x460fad[_0xfb4c('0xf')]['message']);return _0x17a8be(_0x460fad['error']['message']);}logger['error'](_0xfb4c('0x10'),_0x33a95b,_0x460fad[_0xfb4c('0xf')]['message']);return _0x238ef5(_0x460fad[_0xfb4c('0xf')][_0xfb4c('0x11')]);}else{logger[_0xfb4c('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x33a95b,_0xfb4c('0xc'));_0x238ef5(_0x460fad[_0xfb4c('0x12')][_0xfb4c('0x11')]);}})[_0xfb4c('0x13')](function(_0x217ff3){logger[_0xfb4c('0xf')](_0xfb4c('0x10'),_0x33a95b,_0x217ff3);_0x17a8be(_0x217ff3);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 06dc14e..510fec1 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 _0x5271=['diskStorage','join','format','%s%s','logo','extname','originalname','/:id/logo','single','file','addLogo','server/files/images/logos/','root','post','/:id/favicon','addFavicon','put','update','exports','multer','express','Router','../../components/auth/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/preferred','getFavicon'];(function(_0x144ef5,_0x2246b5){var _0x587f9d=function(_0x4e95cc){while(--_0x4e95cc){_0x144ef5['push'](_0x144ef5['shift']());}};_0x587f9d(++_0x2246b5);}(_0x5271,0x82));var _0x1527=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x5271[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0x1527('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1527('0x1'));var router=express[_0x1527('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1527('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1527('0x4'));var controller=require(_0x1527('0x5'));router['get']('/',auth[_0x1527('0x6')](),controller[_0x1527('0x7')]);router[_0x1527('0x8')](_0x1527('0x9'),controller[_0x1527('0xa')]);router[_0x1527('0x8')](_0x1527('0xb'),controller[_0x1527('0xc')]);router[_0x1527('0x8')]('/:id/logo',controller[_0x1527('0xd')]);router['get'](_0x1527('0xe'),controller[_0x1527('0xf')]);router[_0x1527('0x8')]('/:id/gdpr',controller['gdpr']);router[_0x1527('0x8')](_0x1527('0x10'),controller['getPreferred']);router[_0x1527('0x8')]('/:id/favicon',controller[_0x1527('0x11')]);var upload=multer({'storage':multer[_0x1527('0x12')]({'destination':function(_0x59f0f0,_0x5eb55c,_0x1ac008){_0x1ac008(null,path[_0x1527('0x13')](config['root'],'server/files/images/logos/'));},'filename':function(_0x29b3ef,_0x47cfdf,_0x78e22a){_0x78e22a(null,util[_0x1527('0x14')](_0x1527('0x15'),_0x1527('0x16'),path[_0x1527('0x17')](_0x47cfdf[_0x1527('0x18')])));}})});router['post'](_0x1527('0x19'),upload[_0x1527('0x1a')](_0x1527('0x1b')),controller[_0x1527('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4cdcf3,_0x575e90,_0x228ad8){_0x228ad8(null,path[_0x1527('0x13')](config['root'],_0x1527('0x1d')));},'filename':function(_0x4156fe,_0x3820b1,_0x180bc8){_0x180bc8(null,util[_0x1527('0x14')](_0x1527('0x15'),'logologin',path[_0x1527('0x17')](_0x3820b1[_0x1527('0x18')])));}})});router['post'](_0x1527('0xe'),upload['single'](_0x1527('0x1b')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x1527('0x12')]({'destination':function(_0x23db6b,_0x1211f8,_0x59935d){_0x59935d(null,path[_0x1527('0x13')](config[_0x1527('0x1e')],_0x1527('0x1d')));},'filename':function(_0x4e4a2b,_0x11e92f,_0x22e021){_0x22e021(null,util['format'](_0x1527('0x15'),'preferred',path['extname'](_0x11e92f[_0x1527('0x18')])));}})});router[_0x1527('0x1f')](_0x1527('0x10'),upload[_0x1527('0x1a')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x1527('0x12')]({'destination':function(_0x57efa2,_0x52e8e0,_0x2c3f75){_0x2c3f75(null,path[_0x1527('0x13')](config[_0x1527('0x1e')],_0x1527('0x1d')));},'filename':function(_0x3c6dc0,_0x2cc0fa,_0x5eab78){_0x5eab78(null,util[_0x1527('0x14')]('%s%s','favicon',path['extname'](_0x2cc0fa[_0x1527('0x18')])));}})});router[_0x1527('0x1f')](_0x1527('0x20'),upload[_0x1527('0x1a')](_0x1527('0x1b')),controller[_0x1527('0x21')]);router[_0x1527('0x22')](_0x1527('0xb'),auth[_0x1527('0x6')](),controller[_0x1527('0x23')]);module[_0x1527('0x24')]=router; \ No newline at end of file +var _0x20b4=['/:id','/:id/logo','getLogo','getLogoLogin','/:id/preferred','getPreferred','getFavicon','diskStorage','root','server/files/images/logos/','format','logo','extname','post','single','addLogo','join','/:id/logo_login','file','%s%s','preferred','originalname','addPreferred','addFavicon','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now'];(function(_0x168888,_0x1f8123){var _0x442a72=function(_0x247b8b){while(--_0x247b8b){_0x168888['push'](_0x168888['shift']());}};_0x442a72(++_0x1f8123);}(_0x20b4,0x15d));var _0x420b=function(_0x5f46e7,_0x62f9f8){_0x5f46e7=_0x5f46e7-0x0;var _0x567e95=_0x20b4[_0x5f46e7];return _0x567e95;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x420b('0x0'));var timeout=require(_0x420b('0x1'));var express=require('express');var router=express[_0x420b('0x2')]();var fs_extra=require(_0x420b('0x3'));var auth=require(_0x420b('0x4'));var interaction=require(_0x420b('0x5'));var config=require(_0x420b('0x6'));var controller=require('./setting.controller');router[_0x420b('0x7')]('/',auth[_0x420b('0x8')](),controller[_0x420b('0x9')]);router[_0x420b('0x7')](_0x420b('0xa'),controller['getDate']);router[_0x420b('0x7')](_0x420b('0xb'),controller['show']);router[_0x420b('0x7')](_0x420b('0xc'),controller[_0x420b('0xd')]);router[_0x420b('0x7')]('/:id/logo_login',controller[_0x420b('0xe')]);router[_0x420b('0x7')]('/:id/gdpr',controller['gdpr']);router[_0x420b('0x7')](_0x420b('0xf'),controller[_0x420b('0x10')]);router['get']('/:id/favicon',controller[_0x420b('0x11')]);var upload=multer({'storage':multer[_0x420b('0x12')]({'destination':function(_0x40248f,_0x36f030,_0x4dbfc4){_0x4dbfc4(null,path['join'](config[_0x420b('0x13')],_0x420b('0x14')));},'filename':function(_0x42097e,_0x47a41d,_0x222995){_0x222995(null,util[_0x420b('0x15')]('%s%s',_0x420b('0x16'),path[_0x420b('0x17')](_0x47a41d['originalname'])));}})});router[_0x420b('0x18')]('/:id/logo',upload[_0x420b('0x19')]('file'),controller[_0x420b('0x1a')]);var upload=multer({'storage':multer[_0x420b('0x12')]({'destination':function(_0x989a80,_0x4aefa3,_0x124dc0){_0x124dc0(null,path[_0x420b('0x1b')](config[_0x420b('0x13')],_0x420b('0x14')));},'filename':function(_0x3d00f9,_0x35441d,_0x5f529e){_0x5f529e(null,util[_0x420b('0x15')]('%s%s','logologin',path[_0x420b('0x17')](_0x35441d['originalname'])));}})});router[_0x420b('0x18')](_0x420b('0x1c'),upload[_0x420b('0x19')](_0x420b('0x1d')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ee8a4,_0xe86a4e,_0x42130d){_0x42130d(null,path[_0x420b('0x1b')](config[_0x420b('0x13')],_0x420b('0x14')));},'filename':function(_0x6a9323,_0x3afdb3,_0x3fccdb){_0x3fccdb(null,util[_0x420b('0x15')](_0x420b('0x1e'),_0x420b('0x1f'),path[_0x420b('0x17')](_0x3afdb3[_0x420b('0x20')])));}})});router[_0x420b('0x18')]('/:id/preferred',upload[_0x420b('0x19')](_0x420b('0x1d')),controller[_0x420b('0x21')]);var upload=multer({'storage':multer[_0x420b('0x12')]({'destination':function(_0x17d00e,_0x3b1f44,_0x6975f7){_0x6975f7(null,path[_0x420b('0x1b')](config[_0x420b('0x13')],_0x420b('0x14')));},'filename':function(_0x5202ee,_0x5daa9b,_0x1cf035){_0x1cf035(null,util[_0x420b('0x15')](_0x420b('0x1e'),'favicon',path[_0x420b('0x17')](_0x5daa9b[_0x420b('0x20')])));}})});router[_0x420b('0x18')]('/:id/favicon',upload[_0x420b('0x19')](_0x420b('0x1d')),controller[_0x420b('0x22')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);module[_0x420b('0x23')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index dea3139..d49de76 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 _0xb8bc=['sequelize','exports','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED'];(function(_0x1c6eb4,_0xf4a172){var _0x4f8d3d=function(_0x308ca9){while(--_0x308ca9){_0x1c6eb4['push'](_0x1c6eb4['shift']());}};_0x4f8d3d(++_0xf4a172);}(_0xb8bc,0x78));var _0xcb8b=function(_0x8c5659,_0x5cb077){_0x8c5659=_0x8c5659-0x0;var _0x498ce5=_0xb8bc[_0x8c5659];return _0x498ce5;};'use strict';var Sequelize=require(_0xcb8b('0x0'));module[_0xcb8b('0x1')]={'min_internal':{'type':Sequelize[_0xcb8b('0x2')](0xb),'unique':_0xcb8b('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xcb8b('0x2')](0xb),'unique':_0xcb8b('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xcb8b('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xcb8b('0x6')]},'defaultLoginLogo':{'type':Sequelize[_0xcb8b('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xcb8b('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xcb8b('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xcb8b('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xcb8b('0x6')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xcb8b('0x6')]},'turnpassword':{'type':Sequelize[_0xcb8b('0x6')]},'pageTitle':{'type':Sequelize[_0xcb8b('0x6')]},'defaultPageTitle':{'type':Sequelize[_0xcb8b('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xcb8b('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xcb8b('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xcb8b('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xcb8b('0x6')],'defaultValue':_0xcb8b('0x8')},'enableEmailPreview':{'type':Sequelize[_0xcb8b('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xcb8b('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xcb8b('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xcb8b('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xcb8b('0x6')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0xcb8b('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xcb8b('0x6')]},'defaultPreferred':{'type':Sequelize[_0xcb8b('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xcb8b('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0xcb8b('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xcb8b('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xcb8b('0x6')]},'defaultFavicon':{'type':Sequelize[_0xcb8b('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xcb8b('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xcb8b('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xcb8b('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xcb8b('0x6')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xcb8b('0x2')]},'sentimentRegion':{'type':Sequelize[_0xcb8b('0x6')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xcb8b('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xcb8b('0x2')](0x2)[_0xcb8b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xcb8b('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xcb8b('0x2')](0x2)[_0xcb8b('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xcb8b('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xcb8b('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xcb8b('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xcb8b('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xcb8b('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x5a7f=['STRING','BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted'];(function(_0x1633e9,_0x50a939){var _0x549ace=function(_0x15a157){while(--_0x15a157){_0x1633e9['push'](_0x1633e9['shift']());}};_0x549ace(++_0x50a939);}(_0x5a7f,0x90));var _0xf5a7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5a7f[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xf5a7('0x0'));module[_0xf5a7('0x1')]={'min_internal':{'type':Sequelize[_0xf5a7('0x2')](0xb),'unique':_0xf5a7('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xf5a7('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf5a7('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xf5a7('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf5a7('0x6')]},'defaultLoginLogo':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf5a7('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xf5a7('0x6')]},'turnaddr':{'type':Sequelize[_0xf5a7('0x6')]},'turnusername':{'type':Sequelize[_0xf5a7('0x6')]},'turnpassword':{'type':Sequelize[_0xf5a7('0x6')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xf5a7('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xf5a7('0x6')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xf5a7('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xf5a7('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf5a7('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xf5a7('0x6')],'defaultValue':_0xf5a7('0x8')},'chatTimeout':{'type':Sequelize[_0xf5a7('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xf5a7('0x6')]},'defaultPreferred':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf5a7('0x6')]},'allowedLoginAttempts':{'type':Sequelize[_0xf5a7('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xf5a7('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xf5a7('0x6')]},'language':{'type':Sequelize[_0xf5a7('0x6')]},'bucket':{'type':Sequelize[_0xf5a7('0x6')]},'googleSsoEnabled':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xf5a7('0x2')](0x2)[_0xf5a7('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xf5a7('0x2')](0x2)[_0xf5a7('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0xf5a7('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xf5a7('0x2')](0x2)[_0xf5a7('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xf5a7('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xf5a7('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xf5a7('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xf5a7('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index b1da01f..6df1142 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 _0x4944=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','Setting,\x20%s,\x20%s','request\x20sent','result','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','sendStatus','name','send','Setting','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','length','merge','options','find','addLogo','file','filename','body','addLogoLogin','server/files/images/logos','getLicense','logo','loginLogo','preferred','favicon','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','defaultLogo','default_loginLogo.svg','\x20not\x20found','securePassword','addPreferred','getPreferred','defaultLoginLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','download','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x118758,_0x58232a){var _0x429d4b=function(_0x49dc87){while(--_0x49dc87){_0x118758['push'](_0x118758['shift']());}};_0x429d4b(++_0x58232a);}(_0x4944,0x6d));var _0x4494=function(_0x59be6d,_0x31c7e7){_0x59be6d=_0x59be6d-0x0;var _0x38a021=_0x4944[_0x59be6d];return _0x38a021;};'use strict';var emlformat=require(_0x4494('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4494('0x1'));var jsonpatch=require(_0x4494('0x2'));var rp=require(_0x4494('0x3'));var moment=require(_0x4494('0x4'));var BPromise=require(_0x4494('0x5'));var Mustache=require('mustache');var util=require(_0x4494('0x6'));var path=require('path');var sox=require(_0x4494('0x7'));var csv=require(_0x4494('0x8'));var ejs=require(_0x4494('0x9'));var fs=require('fs');var fs_extra=require(_0x4494('0xa'));var _=require(_0x4494('0xb'));var squel=require(_0x4494('0xc'));var crypto=require(_0x4494('0xd'));var jsforce=require(_0x4494('0xe'));var deskjs=require(_0x4494('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4494('0x10'));var Papa=require(_0x4494('0x11'));var Redis=require(_0x4494('0x12'));var authService=require(_0x4494('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4494('0x14'));var logger=require(_0x4494('0x15'))(_0x4494('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4494('0x17'));var db=require(_0x4494('0x18'))['db'];var jayson=require(_0x4494('0x19'));var client=jayson[_0x4494('0x1a')][_0x4494('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x24c0e8,_0x50b102,_0x34959d,_0x2325f4){return new BPromise(function(_0x45825c,_0x259e03){var _0x9e92d0=_0x2325f4||client;return _0x9e92d0[_0x4494('0x1c')](_0x24c0e8,_0x34959d)[_0x4494('0x1d')](function(_0x53fed5){logger[_0x4494('0x1e')]('Setting,\x20%s,\x20%s',_0x50b102,'request\x20sent');logger[_0x4494('0x1f')](_0x4494('0x20'),_0x50b102,'request\x20sent',JSON['stringify'](_0x53fed5));if(_0x53fed5[_0x4494('0x21')]){if(_0x53fed5['error'][_0x4494('0x22')]===0x1f4){logger[_0x4494('0x21')]('Setting,\x20%s,\x20%s',_0x50b102,_0x53fed5[_0x4494('0x21')]['message']);return _0x259e03(_0x53fed5[_0x4494('0x21')][_0x4494('0x23')]);}logger['error']('Setting,\x20%s,\x20%s',_0x50b102,_0x53fed5[_0x4494('0x21')][_0x4494('0x23')]);return _0x45825c(_0x53fed5[_0x4494('0x21')][_0x4494('0x23')]);}else{logger[_0x4494('0x1e')](_0x4494('0x24'),_0x50b102,_0x4494('0x25'));_0x45825c(_0x53fed5[_0x4494('0x26')]['message']);}})['catch'](function(_0x5b41a0){logger['error'](_0x4494('0x24'),_0x50b102,_0x5b41a0);_0x259e03(_0x5b41a0);});});}function respondWithStatusCode(_0x8b6c21,_0x1b3630){_0x1b3630=_0x1b3630||0xcc;return function(_0x470b2f){if(_0x470b2f){return _0x8b6c21['sendStatus'](_0x1b3630);}return _0x8b6c21[_0x4494('0x27')](_0x1b3630)[_0x4494('0x28')]();};}function respondWithResult(_0x5596fb,_0x10b231){_0x10b231=_0x10b231||0xc8;return function(_0x115520){if(_0x115520){return _0x5596fb[_0x4494('0x27')](_0x10b231)['json'](_0x115520);}};}function respondWithFilteredResult(_0xfc1631,_0x5926fc){return function(_0x3af50b){if(_0x3af50b){var _0x48d74d=typeof _0x5926fc[_0x4494('0x29')]===_0x4494('0x2a')&&typeof _0x5926fc[_0x4494('0x2b')]==='undefined';var _0x2f269a=_0x3af50b[_0x4494('0x2c')];var _0x491027=_0x48d74d?0x0:_0x5926fc[_0x4494('0x29')];var _0x303321=_0x48d74d?_0x3af50b[_0x4494('0x2c')]:_0x5926fc['offset']+_0x5926fc[_0x4494('0x2b')];var _0x2e94af;if(_0x303321>=_0x2f269a){_0x303321=_0x2f269a;_0x2e94af=0xc8;}else{_0x2e94af=0xce;}_0xfc1631[_0x4494('0x27')](_0x2e94af);return _0xfc1631[_0x4494('0x2d')](_0x4494('0x2e'),_0x491027+'-'+_0x303321+'/'+_0x2f269a)[_0x4494('0x2f')](_0x3af50b);}return null;};}function patchUpdates(_0x32f86f){return function(_0xcce4da){try{jsonpatch['apply'](_0xcce4da,_0x32f86f,!![]);}catch(_0x1d47f6){return BPromise[_0x4494('0x30')](_0x1d47f6);}return _0xcce4da[_0x4494('0x31')]();};}function saveUpdates(_0x5d90e0,_0x209fe8){return function(_0x1c93f0){if(_0x1c93f0){return _0x1c93f0[_0x4494('0x32')](_0x5d90e0)[_0x4494('0x1d')](function(_0x1e4b74){return _0x1e4b74;});}return null;};}function removeEntity(_0x2ebb49,_0x279631){return function(_0x4e1656){if(_0x4e1656){return _0x4e1656[_0x4494('0x33')]()[_0x4494('0x1d')](function(){_0x2ebb49[_0x4494('0x27')](0xcc)[_0x4494('0x28')]();});}};}function handleEntityNotFound(_0x381ea8,_0x3cbe98){return function(_0x5bba31){if(!_0x5bba31){_0x381ea8[_0x4494('0x34')](0x194);}return _0x5bba31;};}function handleError(_0x1009a4,_0x3b3cae){_0x3b3cae=_0x3b3cae||0x1f4;return function(_0x203517){logger[_0x4494('0x21')](_0x203517['stack']);if(_0x203517[_0x4494('0x35')]){delete _0x203517[_0x4494('0x35')];}_0x1009a4['status'](_0x3b3cae)[_0x4494('0x36')](_0x203517);};}exports['index']=function(_0x5e7a33,_0x5f3612){var _0x477848={},_0x250a0b={},_0x322748={'count':0x0,'rows':[]};var _0x546133=_['map'](db[_0x4494('0x37')][_0x4494('0x38')],function(_0x17726f){return{'name':_0x17726f[_0x4494('0x39')],'type':_0x17726f[_0x4494('0x3a')][_0x4494('0x3b')]};});_0x250a0b[_0x4494('0x3c')]=_[_0x4494('0x3d')](_0x546133,_0x4494('0x35'));_0x250a0b[_0x4494('0x3e')]=_[_0x4494('0x3f')](_0x5e7a33[_0x4494('0x3e')]);_0x250a0b[_0x4494('0x40')]=_['intersection'](_0x250a0b[_0x4494('0x3c')],_0x250a0b[_0x4494('0x3e')]);_0x477848[_0x4494('0x41')]=_[_0x4494('0x42')](_0x250a0b[_0x4494('0x3c')],qs[_0x4494('0x43')](_0x5e7a33[_0x4494('0x3e')][_0x4494('0x43')]));_0x477848[_0x4494('0x41')]=_0x477848['attributes']['length']?_0x477848[_0x4494('0x41')]:_0x250a0b['model'];if(!_0x5e7a33[_0x4494('0x3e')][_0x4494('0x44')](_0x4494('0x45'))){_0x477848[_0x4494('0x2b')]=qs[_0x4494('0x2b')](_0x5e7a33['query']['limit']);_0x477848[_0x4494('0x29')]=qs['offset'](_0x5e7a33[_0x4494('0x3e')][_0x4494('0x29')]);}_0x477848[_0x4494('0x46')]=qs[_0x4494('0x47')](_0x5e7a33[_0x4494('0x3e')][_0x4494('0x47')]);_0x477848[_0x4494('0x48')]=qs['filters'](_[_0x4494('0x49')](_0x5e7a33[_0x4494('0x3e')],_0x250a0b['filters']),_0x546133);if(_0x5e7a33[_0x4494('0x3e')][_0x4494('0x4a')]){_0x477848[_0x4494('0x48')]=_['merge'](_0x477848[_0x4494('0x48')],{'$or':_[_0x4494('0x3d')](_0x546133,function(_0x4784af){if(_0x4784af[_0x4494('0x3a')]!=='VIRTUAL'){var _0x524da6={};_0x524da6[_0x4784af[_0x4494('0x35')]]={'$like':'%'+_0x5e7a33[_0x4494('0x3e')][_0x4494('0x4a')]+'%'};return _0x524da6;}})});}_0x477848=_['merge']({},_0x477848,_0x5e7a33['options']);var _0x3717ae={'where':_0x477848[_0x4494('0x48')]};return db[_0x4494('0x37')]['count'](_0x3717ae)[_0x4494('0x1d')](function(_0x1800dd){_0x322748['count']=_0x1800dd;if(_0x5e7a33[_0x4494('0x3e')][_0x4494('0x4b')]){_0x477848[_0x4494('0x4c')]=[{'all':!![]}];}return db[_0x4494('0x37')][_0x4494('0x4d')](_0x477848);})['then'](function(_0x802d47){_0x322748[_0x4494('0x4e')]=_0x802d47;return _0x322748;})[_0x4494('0x1d')](respondWithFilteredResult(_0x5f3612,_0x477848))[_0x4494('0x4f')](handleError(_0x5f3612,null));};exports[_0x4494('0x50')]=function(_0x7ddcff,_0xcd59fc){var _0x904f3={'raw':![],'where':{'id':_0x7ddcff[_0x4494('0x51')]['id']}},_0x102010={};_0x102010['model']=_[_0x4494('0x3f')](db['Setting'][_0x4494('0x38')]);_0x102010[_0x4494('0x3e')]=_[_0x4494('0x3f')](_0x7ddcff[_0x4494('0x3e')]);_0x102010[_0x4494('0x40')]=_['intersection'](_0x102010[_0x4494('0x3c')],_0x102010['query']);_0x904f3['attributes']=_['intersection'](_0x102010['model'],qs['fields'](_0x7ddcff[_0x4494('0x3e')][_0x4494('0x43')]));_0x904f3[_0x4494('0x41')]=_0x904f3[_0x4494('0x41')][_0x4494('0x52')]?_0x904f3[_0x4494('0x41')]:_0x102010[_0x4494('0x3c')];if(_0x7ddcff['query']['includeAll']){_0x904f3['include']=[{'all':!![]}];}_0x904f3=_[_0x4494('0x53')]({},_0x904f3,_0x7ddcff[_0x4494('0x54')]);return db['Setting'][_0x4494('0x55')](_0x904f3)[_0x4494('0x1d')](handleEntityNotFound(_0xcd59fc,null))[_0x4494('0x1d')](respondWithResult(_0xcd59fc,null))[_0x4494('0x4f')](handleError(_0xcd59fc,null));};exports[_0x4494('0x32')]=function(_0x595e23,_0x3555b9){if(_0x595e23['body']['id']){delete _0x595e23['body']['id'];}return db[_0x4494('0x37')]['find']({'where':{'id':_0x595e23[_0x4494('0x51')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x3555b9,null))['then'](saveUpdates(_0x595e23['body'],null))[_0x4494('0x1d')](respondWithResult(_0x3555b9,null))[_0x4494('0x4f')](handleError(_0x3555b9,null));};exports[_0x4494('0x56')]=function(_0x49a187,_0x2ea074,_0x5e2471){if(_0x49a187[_0x4494('0x57')]&&_0x49a187[_0x4494('0x57')][_0x4494('0x58')]){_0x49a187[_0x4494('0x59')]['logo']=_0x49a187['file'][_0x4494('0x58')];}return db['Setting'][_0x4494('0x55')]({'where':{'id':_0x49a187[_0x4494('0x51')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x2ea074,null))['then'](saveUpdates(_0x49a187['body'],null))[_0x4494('0x1d')](respondWithResult(_0x2ea074,null))[_0x4494('0x4f')](handleError(_0x2ea074,null));};exports[_0x4494('0x5a')]=function(_0x2c7c18,_0x3dc04a,_0x35f7a4){if(_0x2c7c18[_0x4494('0x57')]&&_0x2c7c18['file'][_0x4494('0x58')]){_0x2c7c18[_0x4494('0x59')]['loginLogo']=_0x2c7c18[_0x4494('0x57')][_0x4494('0x58')];}return db[_0x4494('0x37')][_0x4494('0x55')]({'where':{'id':_0x2c7c18[_0x4494('0x51')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x3dc04a,null))[_0x4494('0x1d')](saveUpdates(_0x2c7c18[_0x4494('0x59')],null))[_0x4494('0x1d')](respondWithResult(_0x3dc04a,null))['catch'](handleError(_0x3dc04a,null));};var utilLicense=require(_0x4494('0x17'));exports['getLogo']=function(_0x5ed118,_0x2911fc,_0x472ea6){var _0x5560d4=_0x4494('0x5b');var _0x1175a3={'custom':![]};return utilLicense[_0x4494('0x5c')]()[_0x4494('0x1d')](function(_0x2ae8e6){if(_0x2ae8e6){_0x1175a3=_0x2ae8e6;}return db['Setting'][_0x4494('0x55')]({'where':{'id':_0x5ed118[_0x4494('0x51')]['id']},'attributes':[_0x4494('0x5d'),_0x4494('0x5e'),_0x4494('0x5f'),_0x4494('0x60'),'defaultLogo','defaultLoginLogo',_0x4494('0x61'),_0x4494('0x62')],'raw':!![]});})[_0x4494('0x1d')](handleEntityNotFound(_0x2911fc,null))[_0x4494('0x1d')](function(_0x33c5ae){if(_0x33c5ae){var _0x2f3e39=_0x33c5ae[_0x4494('0x5d')]&&fs[_0x4494('0x63')](path[_0x4494('0x64')](config[_0x4494('0x65')],_0x5560d4,_['toLower'](_0x33c5ae['logo'])))?path['join'](config[_0x4494('0x65')],_0x5560d4,_[_0x4494('0x66')](_0x33c5ae['logo'])):path[_0x4494('0x64')](config[_0x4494('0x65')],_0x5560d4,_[_0x4494('0x66')](_0x4494('0x67')));var _0x12eb81=_0x4494('0x68')+_[_0x4494('0x69')]('logo');if(_0x33c5ae[_0x12eb81]||!_0x1175a3[_0x4494('0x6a')]){_0x2f3e39=path[_0x4494('0x64')](config[_0x4494('0x65')],_0x5560d4,_[_0x4494('0x66')](_0x4494('0x67')));}if(!fs[_0x4494('0x63')](_0x2f3e39)){throw new db[(_0x4494('0x6b'))][(_0x4494('0x6c'))](_['upperFirst'](_0x4494('0x5d'))+'\x20not\x20found');}return _0x2911fc['download'](_0x2f3e39);}})[_0x4494('0x4f')](handleError(_0x2911fc,null));};var utilLicense=require(_0x4494('0x17'));exports['getLogoLogin']=function(_0x5a5edf,_0x2f8459,_0xa38100){var _0x4f6387=_0x4494('0x5b');var _0x5c610e={'custom':![]};return utilLicense[_0x4494('0x5c')]()['then'](function(_0x4bef06){if(_0x4bef06){_0x5c610e=_0x4bef06;}return db['Setting'][_0x4494('0x55')]({'where':{'id':_0x5a5edf[_0x4494('0x51')]['id']},'attributes':[_0x4494('0x5d'),_0x4494('0x5e'),_0x4494('0x5f'),'favicon',_0x4494('0x6d'),'defaultLoginLogo','defaultPreferred',_0x4494('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x2f8459,null))[_0x4494('0x1d')](function(_0x4c8b25){if(_0x4c8b25){var _0x5fc7d9=_0x4c8b25['loginLogo']&&fs['existsSync'](path['join'](config['root'],_0x4f6387,_[_0x4494('0x66')](_0x4c8b25[_0x4494('0x5e')])))?path[_0x4494('0x64')](config[_0x4494('0x65')],_0x4f6387,_[_0x4494('0x66')](_0x4c8b25[_0x4494('0x5e')])):path[_0x4494('0x64')](config[_0x4494('0x65')],_0x4f6387,_[_0x4494('0x66')](_0x4494('0x6e')));var _0x55e747='default'+_['upperFirst'](_0x4494('0x5e'));if(_0x4c8b25[_0x55e747]||!_0x5c610e[_0x4494('0x6a')]){_0x5fc7d9=path[_0x4494('0x64')](config['root'],_0x4f6387,_[_0x4494('0x66')](_0x4494('0x6e')));}if(!fs[_0x4494('0x63')](_0x5fc7d9)){throw new db[(_0x4494('0x6b'))][(_0x4494('0x6c'))](_['upperFirst'](_0x4494('0x5e'))+_0x4494('0x6f'));}return _0x2f8459['download'](_0x5fc7d9);}})['catch'](handleError(_0x2f8459,null));};exports['gdpr']=function(_0x54e8cd,_0x56e89d){return db['Setting'][_0x4494('0x55')]({'where':{'id':_0x54e8cd[_0x4494('0x51')]['id']},'attributes':[_0x4494('0x70')]})[_0x4494('0x1d')](respondWithResult(_0x56e89d,null))[_0x4494('0x4f')](handleError(_0x56e89d,null));};exports[_0x4494('0x71')]=function(_0x4fcef9,_0x5b0345,_0x2a5a2b){if(_0x4fcef9['file']&&_0x4fcef9[_0x4494('0x57')][_0x4494('0x58')]){_0x4fcef9[_0x4494('0x59')][_0x4494('0x5f')]=_0x4fcef9[_0x4494('0x57')]['filename'];}return db[_0x4494('0x37')][_0x4494('0x55')]({'where':{'id':_0x4fcef9['params']['id']}})['then'](handleEntityNotFound(_0x5b0345,null))[_0x4494('0x1d')](saveUpdates(_0x4fcef9[_0x4494('0x59')],null))[_0x4494('0x1d')](respondWithResult(_0x5b0345,null))[_0x4494('0x4f')](handleError(_0x5b0345,null));};var utilLicense=require(_0x4494('0x17'));exports[_0x4494('0x72')]=function(_0x3957ff,_0x27c56f,_0x33a824){var _0x5e1af2=_0x4494('0x5b');var _0x595453={'custom':![]};return utilLicense[_0x4494('0x5c')]()[_0x4494('0x1d')](function(_0x2418c1){if(_0x2418c1){_0x595453=_0x2418c1;}return db['Setting'][_0x4494('0x55')]({'where':{'id':_0x3957ff['params']['id']},'attributes':[_0x4494('0x5d'),_0x4494('0x5e'),_0x4494('0x5f'),_0x4494('0x60'),_0x4494('0x6d'),_0x4494('0x73'),'defaultPreferred',_0x4494('0x62')],'raw':!![]});})[_0x4494('0x1d')](handleEntityNotFound(_0x27c56f,null))['then'](function(_0x3a0787){if(_0x3a0787){var _0x483c9b=_0x3a0787[_0x4494('0x5f')]&&fs[_0x4494('0x63')](path[_0x4494('0x64')](config[_0x4494('0x65')],_0x5e1af2,_['toLower'](_0x3a0787[_0x4494('0x5f')])))?path['join'](config[_0x4494('0x65')],_0x5e1af2,_[_0x4494('0x66')](_0x3a0787[_0x4494('0x5f')])):path[_0x4494('0x64')](config[_0x4494('0x65')],_0x5e1af2,_['toLower']('default_preferred.png'));var _0x45716f=_0x4494('0x68')+_['upperFirst'](_0x4494('0x5f'));if(_0x3a0787[_0x45716f]||!_0x595453[_0x4494('0x6a')]||!_0x595453[_0x4494('0x5f')]){_0x483c9b=path['join'](config[_0x4494('0x65')],_0x5e1af2,_[_0x4494('0x66')](_0x4494('0x74')));}if(!fs[_0x4494('0x63')](_0x483c9b)){throw new db[(_0x4494('0x6b'))]['ValidationError'](_[_0x4494('0x69')](_0x4494('0x5f'))+_0x4494('0x6f'));}return _0x27c56f['download'](_0x483c9b);}})['catch'](handleError(_0x27c56f,null));};exports[_0x4494('0x75')]=function(_0x15c2d3,_0x2aa96c,_0x5642e5){if(_0x15c2d3[_0x4494('0x57')]&&_0x15c2d3['file'][_0x4494('0x58')]){_0x15c2d3[_0x4494('0x59')][_0x4494('0x60')]=_0x15c2d3[_0x4494('0x57')][_0x4494('0x58')];}return db[_0x4494('0x37')][_0x4494('0x55')]({'where':{'id':_0x15c2d3[_0x4494('0x51')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x2aa96c,null))[_0x4494('0x1d')](saveUpdates(_0x15c2d3[_0x4494('0x59')],null))['then'](respondWithResult(_0x2aa96c,null))[_0x4494('0x4f')](handleError(_0x2aa96c,null));};var utilLicense=require(_0x4494('0x17'));exports[_0x4494('0x76')]=function(_0x21768a,_0x36179c,_0x2b7a69){var _0x1c235a=_0x4494('0x5b');var _0x201cce={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x7f9392){if(_0x7f9392){_0x201cce=_0x7f9392;}return db[_0x4494('0x37')][_0x4494('0x55')]({'where':{'id':_0x21768a[_0x4494('0x51')]['id']},'attributes':[_0x4494('0x5d'),_0x4494('0x5e'),_0x4494('0x5f'),_0x4494('0x60'),_0x4494('0x6d'),_0x4494('0x73'),_0x4494('0x61'),_0x4494('0x62')],'raw':!![]});})[_0x4494('0x1d')](handleEntityNotFound(_0x36179c,null))[_0x4494('0x1d')](function(_0x88cf8){if(_0x88cf8){var _0x45b69d=_0x88cf8['favicon']&&fs['existsSync'](path[_0x4494('0x64')](config[_0x4494('0x65')],_0x1c235a,_[_0x4494('0x66')](_0x88cf8['favicon'])))?path[_0x4494('0x64')](config[_0x4494('0x65')],_0x1c235a,_['toLower'](_0x88cf8[_0x4494('0x60')])):path[_0x4494('0x64')](config[_0x4494('0x65')],_0x1c235a,_[_0x4494('0x66')]('default_favicon.ico'));var _0x31105a=_0x4494('0x68')+_[_0x4494('0x69')](_0x4494('0x60'));if(_0x88cf8[_0x31105a]||!_0x201cce[_0x4494('0x6a')]){_0x45b69d=path[_0x4494('0x64')](config[_0x4494('0x65')],_0x1c235a,_['toLower'](_0x4494('0x77')));}if(!fs[_0x4494('0x63')](_0x45b69d)){throw new db[(_0x4494('0x6b'))][(_0x4494('0x6c'))](_['upperFirst'](_0x4494('0x60'))+_0x4494('0x6f'));}return _0x36179c[_0x4494('0x78')](_0x45b69d);}})[_0x4494('0x4f')](handleError(_0x36179c,null));};exports[_0x4494('0x79')]=function(_0x3b8fed,_0x51c4c6){var _0x2dfed2={'offset':moment()[_0x4494('0x7a')]()};_0x2dfed2[_0x4494('0x7b')]=moment()[_0x4494('0x7a')](_0x2dfed2['offset'])[_0x4494('0x7c')](_0x4494('0x7d'));return _0x51c4c6[_0x4494('0x27')](0xc8)[_0x4494('0x36')](_0x2dfed2);}; \ No newline at end of file +var _0xdcf4=['options','count','includeAll','findAll','catch','show','fields','include','find','update','params','body','file','filename','addLogoLogin','getLogo','server/files/images/logos','getLicense','logo','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','existsSync','default_loginLogo.svg','ValidationError','gdpr','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','sendStatus','offset','undefined','limit','status','set','json','apply','save','then','destroy','end','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xdcf4,0x126));var _0x4dcf=function(_0xfa45b7,_0x100388){_0xfa45b7=_0xfa45b7-0x0;var _0x3b0525=_0xdcf4[_0xfa45b7];return _0x3b0525;};'use strict';var emlformat=require(_0x4dcf('0x0'));var rimraf=require(_0x4dcf('0x1'));var zipdir=require(_0x4dcf('0x2'));var jsonpatch=require(_0x4dcf('0x3'));var rp=require(_0x4dcf('0x4'));var moment=require(_0x4dcf('0x5'));var BPromise=require(_0x4dcf('0x6'));var Mustache=require('mustache');var util=require(_0x4dcf('0x7'));var path=require(_0x4dcf('0x8'));var sox=require(_0x4dcf('0x9'));var csv=require(_0x4dcf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4dcf('0xb'));var _=require(_0x4dcf('0xc'));var squel=require(_0x4dcf('0xd'));var crypto=require(_0x4dcf('0xe'));var jsforce=require(_0x4dcf('0xf'));var deskjs=require(_0x4dcf('0x10'));var toCsv=require(_0x4dcf('0xa'));var querystring=require(_0x4dcf('0x11'));var Papa=require(_0x4dcf('0x12'));var Redis=require(_0x4dcf('0x13'));var authService=require(_0x4dcf('0x14'));var qs=require(_0x4dcf('0x15'));var as=require(_0x4dcf('0x16'));var hardwareService=require(_0x4dcf('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x4dcf('0x18'));var config=require(_0x4dcf('0x19'));var licenseUtil=require(_0x4dcf('0x1a'));var db=require(_0x4dcf('0x1b'))['db'];var jayson=require(_0x4dcf('0x1c'));var client=jayson[_0x4dcf('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484c6d,_0x4105da,_0x150367,_0x4fb731){return new BPromise(function(_0x5a6710,_0x5d6c8c){var _0x53febb=_0x4fb731||client;return _0x53febb[_0x4dcf('0x1e')](_0x484c6d,_0x150367)['then'](function(_0x167658){logger['info'](_0x4dcf('0x1f'),_0x4105da,'request\x20sent');logger[_0x4dcf('0x20')](_0x4dcf('0x21'),_0x4105da,'request\x20sent',JSON[_0x4dcf('0x22')](_0x167658));if(_0x167658[_0x4dcf('0x23')]){if(_0x167658[_0x4dcf('0x23')]['code']===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x4105da,_0x167658[_0x4dcf('0x23')][_0x4dcf('0x24')]);return _0x5d6c8c(_0x167658[_0x4dcf('0x23')][_0x4dcf('0x24')]);}logger[_0x4dcf('0x23')](_0x4dcf('0x1f'),_0x4105da,_0x167658[_0x4dcf('0x23')]['message']);return _0x5a6710(_0x167658['error'][_0x4dcf('0x24')]);}else{logger[_0x4dcf('0x25')](_0x4dcf('0x1f'),_0x4105da,_0x4dcf('0x26'));_0x5a6710(_0x167658[_0x4dcf('0x27')]['message']);}})['catch'](function(_0x1e0d67){logger['error']('Setting,\x20%s,\x20%s',_0x4105da,_0x1e0d67);_0x5d6c8c(_0x1e0d67);});});}function respondWithStatusCode(_0x24bbca,_0x319d99){_0x319d99=_0x319d99||0xcc;return function(_0x10fdb9){if(_0x10fdb9){return _0x24bbca[_0x4dcf('0x28')](_0x319d99);}return _0x24bbca['status'](_0x319d99)['end']();};}function respondWithResult(_0x5c30c2,_0x4537bc){_0x4537bc=_0x4537bc||0xc8;return function(_0x56f855){if(_0x56f855){return _0x5c30c2['status'](_0x4537bc)['json'](_0x56f855);}};}function respondWithFilteredResult(_0x48dbf8,_0x1761a0){return function(_0x524941){if(_0x524941){var _0x297143=typeof _0x1761a0[_0x4dcf('0x29')]===_0x4dcf('0x2a')&&typeof _0x1761a0[_0x4dcf('0x2b')]===_0x4dcf('0x2a');var _0x2731ae=_0x524941['count'];var _0x249b53=_0x297143?0x0:_0x1761a0['offset'];var _0x43f3b2=_0x297143?_0x524941['count']:_0x1761a0[_0x4dcf('0x29')]+_0x1761a0[_0x4dcf('0x2b')];var _0x4d39cb;if(_0x43f3b2>=_0x2731ae){_0x43f3b2=_0x2731ae;_0x4d39cb=0xc8;}else{_0x4d39cb=0xce;}_0x48dbf8[_0x4dcf('0x2c')](_0x4d39cb);return _0x48dbf8[_0x4dcf('0x2d')]('Content-Range',_0x249b53+'-'+_0x43f3b2+'/'+_0x2731ae)[_0x4dcf('0x2e')](_0x524941);}return null;};}function patchUpdates(_0xd9a95d){return function(_0x576950){try{jsonpatch[_0x4dcf('0x2f')](_0x576950,_0xd9a95d,!![]);}catch(_0x45a513){return BPromise['reject'](_0x45a513);}return _0x576950[_0x4dcf('0x30')]();};}function saveUpdates(_0xc48808,_0x4603c9){return function(_0x58bcf5){if(_0x58bcf5){return _0x58bcf5['update'](_0xc48808)[_0x4dcf('0x31')](function(_0x5b3293){return _0x5b3293;});}return null;};}function removeEntity(_0xa925ae,_0x89d5c6){return function(_0x20db50){if(_0x20db50){return _0x20db50[_0x4dcf('0x32')]()['then'](function(){_0xa925ae[_0x4dcf('0x2c')](0xcc)[_0x4dcf('0x33')]();});}};}function handleEntityNotFound(_0x1135a5,_0x1e4d55){return function(_0x5dfe58){if(!_0x5dfe58){_0x1135a5['sendStatus'](0x194);}return _0x5dfe58;};}function handleError(_0x240aab,_0x20670d){_0x20670d=_0x20670d||0x1f4;return function(_0x416584){logger[_0x4dcf('0x23')](_0x416584[_0x4dcf('0x34')]);if(_0x416584[_0x4dcf('0x35')]){delete _0x416584[_0x4dcf('0x35')];}_0x240aab[_0x4dcf('0x2c')](_0x20670d)[_0x4dcf('0x36')](_0x416584);};}exports[_0x4dcf('0x37')]=function(_0x504262,_0x38a8e8){var _0x4ec055={},_0x167c80={},_0x3c64a5={'count':0x0,'rows':[]};var _0x5b3c00=_[_0x4dcf('0x38')](db[_0x4dcf('0x39')][_0x4dcf('0x3a')],function(_0x599b00){return{'name':_0x599b00[_0x4dcf('0x3b')],'type':_0x599b00[_0x4dcf('0x3c')]['key']};});_0x167c80[_0x4dcf('0x3d')]=_[_0x4dcf('0x38')](_0x5b3c00,_0x4dcf('0x35'));_0x167c80[_0x4dcf('0x3e')]=_[_0x4dcf('0x3f')](_0x504262[_0x4dcf('0x3e')]);_0x167c80[_0x4dcf('0x40')]=_[_0x4dcf('0x41')](_0x167c80[_0x4dcf('0x3d')],_0x167c80['query']);_0x4ec055[_0x4dcf('0x42')]=_['intersection'](_0x167c80['model'],qs['fields'](_0x504262['query']['fields']));_0x4ec055[_0x4dcf('0x42')]=_0x4ec055['attributes'][_0x4dcf('0x43')]?_0x4ec055[_0x4dcf('0x42')]:_0x167c80['model'];if(!_0x504262[_0x4dcf('0x3e')][_0x4dcf('0x44')](_0x4dcf('0x45'))){_0x4ec055[_0x4dcf('0x2b')]=qs[_0x4dcf('0x2b')](_0x504262[_0x4dcf('0x3e')]['limit']);_0x4ec055[_0x4dcf('0x29')]=qs[_0x4dcf('0x29')](_0x504262[_0x4dcf('0x3e')][_0x4dcf('0x29')]);}_0x4ec055['order']=qs['sort'](_0x504262[_0x4dcf('0x3e')][_0x4dcf('0x46')]);_0x4ec055[_0x4dcf('0x47')]=qs[_0x4dcf('0x40')](_['pick'](_0x504262[_0x4dcf('0x3e')],_0x167c80[_0x4dcf('0x40')]),_0x5b3c00);if(_0x504262[_0x4dcf('0x3e')]['filter']){_0x4ec055[_0x4dcf('0x47')]=_[_0x4dcf('0x48')](_0x4ec055['where'],{'$or':_['map'](_0x5b3c00,function(_0x477ba1){if(_0x477ba1[_0x4dcf('0x3c')]!==_0x4dcf('0x49')){var _0x44d267={};_0x44d267[_0x477ba1[_0x4dcf('0x35')]]={'$like':'%'+_0x504262[_0x4dcf('0x3e')][_0x4dcf('0x4a')]+'%'};return _0x44d267;}})});}_0x4ec055=_[_0x4dcf('0x48')]({},_0x4ec055,_0x504262[_0x4dcf('0x4b')]);var _0x51620d={'where':_0x4ec055[_0x4dcf('0x47')]};return db['Setting'][_0x4dcf('0x4c')](_0x51620d)['then'](function(_0x33b75c){_0x3c64a5['count']=_0x33b75c;if(_0x504262[_0x4dcf('0x3e')][_0x4dcf('0x4d')]){_0x4ec055['include']=[{'all':!![]}];}return db[_0x4dcf('0x39')][_0x4dcf('0x4e')](_0x4ec055);})[_0x4dcf('0x31')](function(_0x5e230d){_0x3c64a5['rows']=_0x5e230d;return _0x3c64a5;})[_0x4dcf('0x31')](respondWithFilteredResult(_0x38a8e8,_0x4ec055))[_0x4dcf('0x4f')](handleError(_0x38a8e8,null));};exports[_0x4dcf('0x50')]=function(_0x229826,_0x4ad05d){var _0x290efa={'raw':![],'where':{'id':_0x229826['params']['id']}},_0x40c29c={};_0x40c29c[_0x4dcf('0x3d')]=_[_0x4dcf('0x3f')](db['Setting'][_0x4dcf('0x3a')]);_0x40c29c['query']=_['keys'](_0x229826['query']);_0x40c29c[_0x4dcf('0x40')]=_[_0x4dcf('0x41')](_0x40c29c[_0x4dcf('0x3d')],_0x40c29c[_0x4dcf('0x3e')]);_0x290efa['attributes']=_[_0x4dcf('0x41')](_0x40c29c[_0x4dcf('0x3d')],qs[_0x4dcf('0x51')](_0x229826['query']['fields']));_0x290efa[_0x4dcf('0x42')]=_0x290efa[_0x4dcf('0x42')][_0x4dcf('0x43')]?_0x290efa[_0x4dcf('0x42')]:_0x40c29c[_0x4dcf('0x3d')];if(_0x229826[_0x4dcf('0x3e')][_0x4dcf('0x4d')]){_0x290efa[_0x4dcf('0x52')]=[{'all':!![]}];}_0x290efa=_['merge']({},_0x290efa,_0x229826[_0x4dcf('0x4b')]);return db[_0x4dcf('0x39')][_0x4dcf('0x53')](_0x290efa)['then'](handleEntityNotFound(_0x4ad05d,null))[_0x4dcf('0x31')](respondWithResult(_0x4ad05d,null))[_0x4dcf('0x4f')](handleError(_0x4ad05d,null));};exports[_0x4dcf('0x54')]=function(_0x1926be,_0x5387cf){if(_0x1926be['body']['id']){delete _0x1926be['body']['id'];}return db[_0x4dcf('0x39')]['find']({'where':{'id':_0x1926be[_0x4dcf('0x55')]['id']}})['then'](handleEntityNotFound(_0x5387cf,null))[_0x4dcf('0x31')](saveUpdates(_0x1926be[_0x4dcf('0x56')],null))[_0x4dcf('0x31')](respondWithResult(_0x5387cf,null))[_0x4dcf('0x4f')](handleError(_0x5387cf,null));};exports['addLogo']=function(_0x1dadcc,_0x198338,_0x19f7a6){if(_0x1dadcc['file']&&_0x1dadcc[_0x4dcf('0x57')][_0x4dcf('0x58')]){_0x1dadcc[_0x4dcf('0x56')]['logo']=_0x1dadcc[_0x4dcf('0x57')][_0x4dcf('0x58')];}return db[_0x4dcf('0x39')][_0x4dcf('0x53')]({'where':{'id':_0x1dadcc[_0x4dcf('0x55')]['id']}})[_0x4dcf('0x31')](handleEntityNotFound(_0x198338,null))[_0x4dcf('0x31')](saveUpdates(_0x1dadcc[_0x4dcf('0x56')],null))[_0x4dcf('0x31')](respondWithResult(_0x198338,null))[_0x4dcf('0x4f')](handleError(_0x198338,null));};exports[_0x4dcf('0x59')]=function(_0x5338b0,_0x4f74a8,_0x34b6f9){if(_0x5338b0[_0x4dcf('0x57')]&&_0x5338b0[_0x4dcf('0x57')][_0x4dcf('0x58')]){_0x5338b0[_0x4dcf('0x56')]['loginLogo']=_0x5338b0[_0x4dcf('0x57')][_0x4dcf('0x58')];}return db[_0x4dcf('0x39')][_0x4dcf('0x53')]({'where':{'id':_0x5338b0[_0x4dcf('0x55')]['id']}})[_0x4dcf('0x31')](handleEntityNotFound(_0x4f74a8,null))['then'](saveUpdates(_0x5338b0['body'],null))['then'](respondWithResult(_0x4f74a8,null))[_0x4dcf('0x4f')](handleError(_0x4f74a8,null));};var utilLicense=require(_0x4dcf('0x1a'));exports[_0x4dcf('0x5a')]=function(_0x5ea68d,_0x3f38d5,_0x3ee0f3){var _0x4e8fc6=_0x4dcf('0x5b');var _0x3a2749={'custom':![]};return utilLicense[_0x4dcf('0x5c')]()[_0x4dcf('0x31')](function(_0x5a92b0){if(_0x5a92b0){_0x3a2749=_0x5a92b0;}return db['Setting'][_0x4dcf('0x53')]({'where':{'id':_0x5ea68d[_0x4dcf('0x55')]['id']},'attributes':[_0x4dcf('0x5d'),_0x4dcf('0x5e'),_0x4dcf('0x5f'),_0x4dcf('0x60'),_0x4dcf('0x61'),_0x4dcf('0x62'),_0x4dcf('0x63'),_0x4dcf('0x64')],'raw':!![]});})[_0x4dcf('0x31')](handleEntityNotFound(_0x3f38d5,null))[_0x4dcf('0x31')](function(_0x2cf2a3){if(_0x2cf2a3){var _0x2d2aef=_0x2cf2a3[_0x4dcf('0x5d')]&&fs['existsSync'](path[_0x4dcf('0x65')](config[_0x4dcf('0x66')],_0x4e8fc6,_[_0x4dcf('0x67')](_0x2cf2a3[_0x4dcf('0x5d')])))?path['join'](config[_0x4dcf('0x66')],_0x4e8fc6,_[_0x4dcf('0x67')](_0x2cf2a3[_0x4dcf('0x5d')])):path[_0x4dcf('0x65')](config[_0x4dcf('0x66')],_0x4e8fc6,_[_0x4dcf('0x67')]('default_logo.svg'));var _0x1d9603=_0x4dcf('0x68')+_[_0x4dcf('0x69')](_0x4dcf('0x5d'));if(_0x2cf2a3[_0x1d9603]||!_0x3a2749[_0x4dcf('0x6a')]){_0x2d2aef=path[_0x4dcf('0x65')](config[_0x4dcf('0x66')],_0x4e8fc6,_[_0x4dcf('0x67')]('default_logo.svg'));}if(!fs['existsSync'](_0x2d2aef)){throw new db[(_0x4dcf('0x6b'))]['ValidationError'](_['upperFirst'](_0x4dcf('0x5d'))+_0x4dcf('0x6c'));}return _0x3f38d5[_0x4dcf('0x6d')](_0x2d2aef);}})[_0x4dcf('0x4f')](handleError(_0x3f38d5,null));};var utilLicense=require(_0x4dcf('0x1a'));exports[_0x4dcf('0x6e')]=function(_0x19aad5,_0x166632,_0x558fc3){var _0x3007d3='server/files/images/logos';var _0x495275={'custom':![]};return utilLicense[_0x4dcf('0x5c')]()[_0x4dcf('0x31')](function(_0x4326cf){if(_0x4326cf){_0x495275=_0x4326cf;}return db[_0x4dcf('0x39')]['find']({'where':{'id':_0x19aad5[_0x4dcf('0x55')]['id']},'attributes':[_0x4dcf('0x5d'),_0x4dcf('0x5e'),'preferred',_0x4dcf('0x60'),'defaultLogo',_0x4dcf('0x62'),'defaultPreferred',_0x4dcf('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x166632,null))[_0x4dcf('0x31')](function(_0x1e54ba){if(_0x1e54ba){var _0x3d8f31=_0x1e54ba[_0x4dcf('0x5e')]&&fs[_0x4dcf('0x6f')](path[_0x4dcf('0x65')](config['root'],_0x3007d3,_[_0x4dcf('0x67')](_0x1e54ba[_0x4dcf('0x5e')])))?path[_0x4dcf('0x65')](config[_0x4dcf('0x66')],_0x3007d3,_[_0x4dcf('0x67')](_0x1e54ba['loginLogo'])):path[_0x4dcf('0x65')](config[_0x4dcf('0x66')],_0x3007d3,_[_0x4dcf('0x67')]('default_loginLogo.svg'));var _0xdf8059=_0x4dcf('0x68')+_[_0x4dcf('0x69')]('loginLogo');if(_0x1e54ba[_0xdf8059]||!_0x495275['custom']){_0x3d8f31=path[_0x4dcf('0x65')](config['root'],_0x3007d3,_[_0x4dcf('0x67')](_0x4dcf('0x70')));}if(!fs[_0x4dcf('0x6f')](_0x3d8f31)){throw new db[(_0x4dcf('0x6b'))][(_0x4dcf('0x71'))](_[_0x4dcf('0x69')]('loginLogo')+_0x4dcf('0x6c'));}return _0x166632[_0x4dcf('0x6d')](_0x3d8f31);}})['catch'](handleError(_0x166632,null));};exports[_0x4dcf('0x72')]=function(_0x9a4de7,_0x4ceb76){return db[_0x4dcf('0x39')][_0x4dcf('0x53')]({'where':{'id':_0x9a4de7[_0x4dcf('0x55')]['id']},'attributes':['securePassword']})[_0x4dcf('0x31')](respondWithResult(_0x4ceb76,null))[_0x4dcf('0x4f')](handleError(_0x4ceb76,null));};exports['addPreferred']=function(_0x4bc4ca,_0xfb025f,_0x267519){if(_0x4bc4ca[_0x4dcf('0x57')]&&_0x4bc4ca['file'][_0x4dcf('0x58')]){_0x4bc4ca['body'][_0x4dcf('0x5f')]=_0x4bc4ca[_0x4dcf('0x57')][_0x4dcf('0x58')];}return db[_0x4dcf('0x39')][_0x4dcf('0x53')]({'where':{'id':_0x4bc4ca[_0x4dcf('0x55')]['id']}})[_0x4dcf('0x31')](handleEntityNotFound(_0xfb025f,null))[_0x4dcf('0x31')](saveUpdates(_0x4bc4ca[_0x4dcf('0x56')],null))[_0x4dcf('0x31')](respondWithResult(_0xfb025f,null))[_0x4dcf('0x4f')](handleError(_0xfb025f,null));};var utilLicense=require(_0x4dcf('0x1a'));exports['getPreferred']=function(_0x187a58,_0x425d68,_0xa6eab){var _0x6a9537=_0x4dcf('0x5b');var _0x48ccc1={'custom':![]};return utilLicense[_0x4dcf('0x5c')]()['then'](function(_0x4f3843){if(_0x4f3843){_0x48ccc1=_0x4f3843;}return db[_0x4dcf('0x39')][_0x4dcf('0x53')]({'where':{'id':_0x187a58[_0x4dcf('0x55')]['id']},'attributes':[_0x4dcf('0x5d'),_0x4dcf('0x5e'),_0x4dcf('0x5f'),_0x4dcf('0x60'),'defaultLogo',_0x4dcf('0x62'),_0x4dcf('0x63'),_0x4dcf('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x425d68,null))[_0x4dcf('0x31')](function(_0x31631a){if(_0x31631a){var _0x4dfe0c=_0x31631a['preferred']&&fs[_0x4dcf('0x6f')](path[_0x4dcf('0x65')](config[_0x4dcf('0x66')],_0x6a9537,_[_0x4dcf('0x67')](_0x31631a[_0x4dcf('0x5f')])))?path[_0x4dcf('0x65')](config[_0x4dcf('0x66')],_0x6a9537,_[_0x4dcf('0x67')](_0x31631a['preferred'])):path[_0x4dcf('0x65')](config[_0x4dcf('0x66')],_0x6a9537,_['toLower'](_0x4dcf('0x73')));var _0x5da67b=_0x4dcf('0x68')+_[_0x4dcf('0x69')]('preferred');if(_0x31631a[_0x5da67b]||!_0x48ccc1[_0x4dcf('0x6a')]||!_0x48ccc1['preferred']){_0x4dfe0c=path[_0x4dcf('0x65')](config[_0x4dcf('0x66')],_0x6a9537,_[_0x4dcf('0x67')](_0x4dcf('0x73')));}if(!fs[_0x4dcf('0x6f')](_0x4dfe0c)){throw new db[(_0x4dcf('0x6b'))][(_0x4dcf('0x71'))](_[_0x4dcf('0x69')](_0x4dcf('0x5f'))+_0x4dcf('0x6c'));}return _0x425d68['download'](_0x4dfe0c);}})[_0x4dcf('0x4f')](handleError(_0x425d68,null));};exports[_0x4dcf('0x74')]=function(_0x543284,_0x4f3713,_0xd776d9){if(_0x543284['file']&&_0x543284[_0x4dcf('0x57')]['filename']){_0x543284['body'][_0x4dcf('0x60')]=_0x543284[_0x4dcf('0x57')][_0x4dcf('0x58')];}return db[_0x4dcf('0x39')][_0x4dcf('0x53')]({'where':{'id':_0x543284['params']['id']}})['then'](handleEntityNotFound(_0x4f3713,null))['then'](saveUpdates(_0x543284['body'],null))[_0x4dcf('0x31')](respondWithResult(_0x4f3713,null))['catch'](handleError(_0x4f3713,null));};var utilLicense=require(_0x4dcf('0x1a'));exports[_0x4dcf('0x75')]=function(_0x20074c,_0x176926,_0x26cb68){var _0x15d518='server/files/images/logos';var _0x4da00f={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x27f23d){if(_0x27f23d){_0x4da00f=_0x27f23d;}return db[_0x4dcf('0x39')][_0x4dcf('0x53')]({'where':{'id':_0x20074c[_0x4dcf('0x55')]['id']},'attributes':[_0x4dcf('0x5d'),_0x4dcf('0x5e'),_0x4dcf('0x5f'),_0x4dcf('0x60'),_0x4dcf('0x61'),'defaultLoginLogo',_0x4dcf('0x63'),_0x4dcf('0x64')],'raw':!![]});})[_0x4dcf('0x31')](handleEntityNotFound(_0x176926,null))[_0x4dcf('0x31')](function(_0x3e5ee1){if(_0x3e5ee1){var _0x552568=_0x3e5ee1[_0x4dcf('0x60')]&&fs['existsSync'](path['join'](config[_0x4dcf('0x66')],_0x15d518,_[_0x4dcf('0x67')](_0x3e5ee1[_0x4dcf('0x60')])))?path[_0x4dcf('0x65')](config['root'],_0x15d518,_[_0x4dcf('0x67')](_0x3e5ee1[_0x4dcf('0x60')])):path['join'](config[_0x4dcf('0x66')],_0x15d518,_[_0x4dcf('0x67')](_0x4dcf('0x76')));var _0x3a7b8c='default'+_[_0x4dcf('0x69')](_0x4dcf('0x60'));if(_0x3e5ee1[_0x3a7b8c]||!_0x4da00f[_0x4dcf('0x6a')]){_0x552568=path[_0x4dcf('0x65')](config['root'],_0x15d518,_[_0x4dcf('0x67')](_0x4dcf('0x76')));}if(!fs['existsSync'](_0x552568)){throw new db['Sequelize'][(_0x4dcf('0x71'))](_[_0x4dcf('0x69')](_0x4dcf('0x60'))+'\x20not\x20found');}return _0x176926['download'](_0x552568);}})['catch'](handleError(_0x176926,null));};exports[_0x4dcf('0x77')]=function(_0x5cf725,_0x39e2e1){var _0x56aeb7={'offset':moment()[_0x4dcf('0x78')]()};_0x56aeb7[_0x4dcf('0x79')]=moment()['utcOffset'](_0x56aeb7[_0x4dcf('0x29')])[_0x4dcf('0x7a')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x39e2e1[_0x4dcf('0x2c')](0xc8)[_0x4dcf('0x36')](_0x56aeb7);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 96e3b3a..3bebbfb 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x7217,0x19e));var _0x7721=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x7217[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0x7217,0x19e));var _0x7721=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x7217[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index bfb5a1d..76a2ef0 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 _0xa9e9=['request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','ShowSetting','find','options','attributes','include','map','model','then','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','info','Setting,\x20%s,\x20%s'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0xa9e9,0x12e));var _0x9a9e=function(_0x32a710,_0x1a902e){_0x32a710=_0x32a710-0x0;var _0xa8f340=_0xa9e9[_0x32a710];return _0xa8f340;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9a9e('0x0'));var rs=require(_0x9a9e('0x1'));var fs=require('fs');var Redis=require(_0x9a9e('0x2'));var db=require(_0x9a9e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9a9e('0x4'));var jayson=require(_0x9a9e('0x5'));var client=jayson['client'][_0x9a9e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x26d645,_0x4a1941,_0x255be0){return new BPromise(function(_0x2253b6,_0x3bd96a){return client[_0x9a9e('0x7')](_0x26d645,_0x255be0)['then'](function(_0x37e6d5){logger[_0x9a9e('0x8')](_0x9a9e('0x9'),_0x4a1941,_0x9a9e('0xa'));logger[_0x9a9e('0xb')](_0x9a9e('0xc'),_0x4a1941,'request\x20sent',JSON[_0x9a9e('0xd')](_0x37e6d5));if(_0x37e6d5['error']){if(_0x37e6d5['error'][_0x9a9e('0xe')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x4a1941,_0x37e6d5[_0x9a9e('0xf')][_0x9a9e('0x10')]);return _0x3bd96a(_0x37e6d5[_0x9a9e('0xf')][_0x9a9e('0x10')]);}logger[_0x9a9e('0xf')](_0x9a9e('0x9'),_0x4a1941,_0x37e6d5[_0x9a9e('0xf')]['message']);return _0x2253b6(_0x37e6d5['error'][_0x9a9e('0x10')]);}else{logger[_0x9a9e('0x8')](_0x9a9e('0x9'),_0x4a1941,_0x9a9e('0xa'));_0x2253b6(_0x37e6d5[_0x9a9e('0x11')][_0x9a9e('0x10')]);}})['catch'](function(_0x2ac465){logger['error'](_0x9a9e('0x9'),_0x4a1941,_0x2ac465);_0x3bd96a(_0x2ac465);});});}exports[_0x9a9e('0x12')]=function(_0xfbbb16){var _0x5dbd1d=this;return new Promise(function(_0x43fdb5,_0x179354){return db['Setting'][_0x9a9e('0x13')]({'raw':_0xfbbb16['options']?_0xfbbb16['options']['raw']===undefined?!![]:![]:!![],'where':_0xfbbb16['options']?_0xfbbb16[_0x9a9e('0x14')]['where']||null:null,'attributes':_0xfbbb16['options']?_0xfbbb16[_0x9a9e('0x14')][_0x9a9e('0x15')]||null:null,'include':_0xfbbb16['options']?_0xfbbb16[_0x9a9e('0x14')][_0x9a9e('0x16')]?_[_0x9a9e('0x17')](_0xfbbb16[_0x9a9e('0x14')][_0x9a9e('0x16')],function(_0x278e6b){return{'model':db[_0x278e6b[_0x9a9e('0x18')]],'as':_0x278e6b['as'],'attributes':_0x278e6b['attributes'],'include':_0x278e6b[_0x9a9e('0x16')]?_[_0x9a9e('0x17')](_0x278e6b[_0x9a9e('0x16')],function(_0x3960e7){return{'model':db[_0x3960e7[_0x9a9e('0x18')]],'as':_0x3960e7['as'],'attributes':_0x3960e7[_0x9a9e('0x15')],'include':_0x3960e7[_0x9a9e('0x16')]?_[_0x9a9e('0x17')](_0x3960e7['include'],function(_0x96e296){return{'model':db[_0x96e296[_0x9a9e('0x18')]],'as':_0x96e296['as'],'attributes':_0x96e296[_0x9a9e('0x15')]};}):[]};}):[]};}):[]:[]})[_0x9a9e('0x19')](function(_0x43797d){logger[_0x9a9e('0x8')](_0x9a9e('0x12'),_0xfbbb16);logger[_0x9a9e('0xb')](_0x9a9e('0x12'),_0xfbbb16,JSON[_0x9a9e('0xd')](_0x43797d));_0x43fdb5(_0x43797d);})['catch'](function(_0x5c83f0){logger[_0x9a9e('0xf')](_0x9a9e('0x12'),_0x5c83f0[_0x9a9e('0x10')],_0xfbbb16);_0x179354(_0x5dbd1d[_0x9a9e('0xf')](0x1f4,_0x5c83f0[_0x9a9e('0x10')]));});});}; \ No newline at end of file +var _0xd80d=['include','map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','ShowSetting','Setting','options','attributes'];(function(_0x5d21ad,_0xd15094){var _0x2121de=function(_0x570fb4){while(--_0x570fb4){_0x5d21ad['push'](_0x5d21ad['shift']());}};_0x2121de(++_0xd15094);}(_0xd80d,0x164));var _0xdd80=function(_0x19728b,_0x1c652b){_0x19728b=_0x19728b-0x0;var _0x15c23e=_0xd80d[_0x19728b];return _0x15c23e;};'use strict';var _=require(_0xdd80('0x0'));var util=require(_0xdd80('0x1'));var moment=require(_0xdd80('0x2'));var BPromise=require(_0xdd80('0x3'));var rs=require(_0xdd80('0x4'));var fs=require('fs');var Redis=require(_0xdd80('0x5'));var db=require(_0xdd80('0x6'))['db'];var utils=require(_0xdd80('0x7'));var logger=require(_0xdd80('0x8'))(_0xdd80('0x9'));var config=require(_0xdd80('0xa'));var jayson=require(_0xdd80('0xb'));var client=jayson['client'][_0xdd80('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x523cb6,_0x7f7ce2,_0x565193){return new BPromise(function(_0x218fe0,_0x8b2360){return client[_0xdd80('0xd')](_0x523cb6,_0x565193)[_0xdd80('0xe')](function(_0x145454){logger[_0xdd80('0xf')]('Setting,\x20%s,\x20%s',_0x7f7ce2,_0xdd80('0x10'));logger[_0xdd80('0x11')](_0xdd80('0x12'),_0x7f7ce2,_0xdd80('0x10'),JSON[_0xdd80('0x13')](_0x145454));if(_0x145454[_0xdd80('0x14')]){if(_0x145454['error']['code']===0x1f4){logger[_0xdd80('0x14')]('Setting,\x20%s,\x20%s',_0x7f7ce2,_0x145454[_0xdd80('0x14')]['message']);return _0x8b2360(_0x145454[_0xdd80('0x14')]['message']);}logger[_0xdd80('0x14')](_0xdd80('0x15'),_0x7f7ce2,_0x145454['error'][_0xdd80('0x16')]);return _0x218fe0(_0x145454[_0xdd80('0x14')][_0xdd80('0x16')]);}else{logger[_0xdd80('0xf')](_0xdd80('0x15'),_0x7f7ce2,'request\x20sent');_0x218fe0(_0x145454[_0xdd80('0x17')][_0xdd80('0x16')]);}})['catch'](function(_0x2f3180){logger[_0xdd80('0x14')](_0xdd80('0x15'),_0x7f7ce2,_0x2f3180);_0x8b2360(_0x2f3180);});});}exports[_0xdd80('0x18')]=function(_0x2d1312){var _0x3ffe80=this;return new Promise(function(_0xf35d4f,_0x439d92){return db[_0xdd80('0x19')]['find']({'raw':_0x2d1312[_0xdd80('0x1a')]?_0x2d1312[_0xdd80('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2d1312[_0xdd80('0x1a')]?_0x2d1312[_0xdd80('0x1a')]['where']||null:null,'attributes':_0x2d1312[_0xdd80('0x1a')]?_0x2d1312[_0xdd80('0x1a')][_0xdd80('0x1b')]||null:null,'include':_0x2d1312['options']?_0x2d1312[_0xdd80('0x1a')][_0xdd80('0x1c')]?_[_0xdd80('0x1d')](_0x2d1312[_0xdd80('0x1a')][_0xdd80('0x1c')],function(_0x5c4b76){return{'model':db[_0x5c4b76['model']],'as':_0x5c4b76['as'],'attributes':_0x5c4b76[_0xdd80('0x1b')],'include':_0x5c4b76[_0xdd80('0x1c')]?_[_0xdd80('0x1d')](_0x5c4b76[_0xdd80('0x1c')],function(_0x4bf720){return{'model':db[_0x4bf720['model']],'as':_0x4bf720['as'],'attributes':_0x4bf720['attributes'],'include':_0x4bf720[_0xdd80('0x1c')]?_[_0xdd80('0x1d')](_0x4bf720[_0xdd80('0x1c')],function(_0xaea77a){return{'model':db[_0xaea77a[_0xdd80('0x1e')]],'as':_0xaea77a['as'],'attributes':_0xaea77a[_0xdd80('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x184a69){logger[_0xdd80('0xf')]('ShowSetting',_0x2d1312);logger[_0xdd80('0x11')](_0xdd80('0x18'),_0x2d1312,JSON[_0xdd80('0x13')](_0x184a69));_0xf35d4f(_0x184a69);})[_0xdd80('0x1f')](function(_0x7c4462){logger[_0xdd80('0x14')](_0xdd80('0x18'),_0x7c4462[_0xdd80('0x16')],_0x2d1312);_0x439d92(_0x3ffe80[_0xdd80('0x14')](0x1f4,_0x7c4462['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 5198870..d335716 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 _0xabce=['/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x29b6a9,_0x54ff5d){var _0x59e128=function(_0x527d2d){while(--_0x527d2d){_0x29b6a9['push'](_0x29b6a9['shift']());}};_0x59e128(++_0x54ff5d);}(_0xabce,0x103));var _0xeabc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xabce[_0x2dafbe];return _0x58a45a;};'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('./smsAccount.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x9')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x9')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x13')]);router[_0xeabc('0x9')](_0xeabc('0x14'),controller['statusGet']);router['get'](_0xeabc('0x15'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x16')]);router['post']('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x17')]);router['post']('/:id/dispositions',auth[_0xeabc('0x8')](),controller['addDisposition']);router[_0xeabc('0x18')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x19')]);router[_0xeabc('0x18')](_0xeabc('0x1a'),controller[_0xeabc('0x1b')]);router[_0xeabc('0x18')]('/:id/applications',auth[_0xeabc('0x8')](),controller['addApplications']);router[_0xeabc('0x18')](_0xeabc('0x1c'),auth['isAuthenticated'](),controller[_0xeabc('0x1d')]);router[_0xeabc('0x18')](_0xeabc('0x14'),controller[_0xeabc('0x1e')]);router[_0xeabc('0x18')]('/:id/users',auth[_0xeabc('0x8')](),controller[_0xeabc('0x1f')]);router[_0xeabc('0x20')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0x21')]);router[_0xeabc('0x22')](_0xeabc('0x23'),auth['isAuthenticated'](),controller[_0xeabc('0x24')]);router['delete'](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0x25')]);router[_0xeabc('0x22')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x26')]);router[_0xeabc('0x22')](_0xeabc('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xeabc('0x27')]=router; \ No newline at end of file +var _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x544c03,_0x558fe4){var _0x5e86ad=function(_0x3b2aaf){while(--_0x3b2aaf){_0x544c03['push'](_0x544c03['shift']());}};_0x5e86ad(++_0x558fe4);}(_0x814b,0x1a2));var _0xb814=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x814b[_0x154940];return _0x401409;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e53e312..0c84662 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 _0x5fed=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5fed,0xcb));var _0xd5fe=function(_0x2d4132,_0x16e982){_0x2d4132=_0x2d4132-0x0;var _0x4a0a1b=_0x5fed[_0x2d4132];return _0x4a0a1b;};'use strict';var Sequelize=require(_0xd5fe('0x0'));var rs=require(_0xd5fe('0x1'));module['exports']={'name':{'type':Sequelize[_0xd5fe('0x2')],'unique':_0xd5fe('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xd5fe('0x2')],'defaultValue':function(){return rs[_0xd5fe('0x4')]();}},'phone':{'type':Sequelize[_0xd5fe('0x2')]},'type':{'type':Sequelize[_0xd5fe('0x5')](_0xd5fe('0x6'),'skebby',_0xd5fe('0x7'),_0xd5fe('0x8'),_0xd5fe('0x9'),_0xd5fe('0xa'),_0xd5fe('0xb'),_0xd5fe('0xc'),_0xd5fe('0xd'),_0xd5fe('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xd5fe('0x2')]},'authToken':{'type':Sequelize[_0xd5fe('0x2')]},'smsMethod':{'type':Sequelize[_0xd5fe('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd5fe('0x2')]},'password':{'type':Sequelize[_0xd5fe('0x2')]},'apiKey':{'type':Sequelize[_0xd5fe('0x2')]},'applicationId':{'type':Sequelize[_0xd5fe('0x2')]},'accountId':{'type':Sequelize[_0xd5fe('0x2')]},'senderString':{'type':Sequelize[_0xd5fe('0x2')]},'deliveryReport':{'type':Sequelize[_0xd5fe('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd5fe('0x10');}},'notificationSound':{'type':Sequelize[_0xd5fe('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd5fe('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd5fe('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd5fe('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd5fe('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd5fe('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd5fe('0xf')],'defaultValue':![],'comment':_0xd5fe('0x12'),'set':function(_0x3e6484){if(!_0x3e6484)this[_0xd5fe('0x13')](_0xd5fe('0x14'),null);this['setDataValue'](_0xd5fe('0x15'),_0x3e6484);}}}; \ No newline at end of file +var _0x36be=['clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','ENUM','twilio','connectel'];(function(_0x129a57,_0x330d03){var _0xa7147c=function(_0x4e6c1f){while(--_0x4e6c1f){_0x129a57['push'](_0x129a57['shift']());}};_0xa7147c(++_0x330d03);}(_0x36be,0x99));var _0xe36b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x36be[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xe36b('0x0'));module[_0xe36b('0x1')]={'name':{'type':Sequelize[_0xe36b('0x2')],'unique':_0xe36b('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xe36b('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xe36b('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xe36b('0x2')]},'type':{'type':Sequelize[_0xe36b('0x4')](_0xe36b('0x5'),'skebby',_0xe36b('0x6'),_0xe36b('0x7'),_0xe36b('0x8'),_0xe36b('0x9'),_0xe36b('0xa'),'csc',_0xe36b('0xb'),_0xe36b('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xe36b('0x2')]},'authToken':{'type':Sequelize[_0xe36b('0x2')]},'smsMethod':{'type':Sequelize[_0xe36b('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xe36b('0x2')]},'password':{'type':Sequelize[_0xe36b('0x2')]},'apiKey':{'type':Sequelize[_0xe36b('0x2')]},'applicationId':{'type':Sequelize[_0xe36b('0x2')]},'accountId':{'type':Sequelize[_0xe36b('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xe36b('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xe36b('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe36b('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe36b('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe36b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe36b('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe36b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe36b('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe36b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe36b('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xe36b('0xf')},'mandatoryDisposition':{'type':Sequelize[_0xe36b('0xd')],'defaultValue':![],'comment':_0xe36b('0x10'),'set':function(_0x4b6dea){if(!_0x4b6dea)this['setDataValue'](_0xe36b('0x11'),null);this[_0xe36b('0x12')](_0xe36b('0x13'),_0x4b6dea);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index f19f97a..159f594 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 _0x8448=['request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','SmsAccount,\x20%s,\x20%s','message','result','status','json','offset','undefined','count','limit','Content-Range','reject','save','destroy','SmsAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SmsAccount','include','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','update','describe','addDisposition','Disposition','getDispositions','findOne','SmsAccountId','options','includeAll','removeDispositions','addAnswer','getAnswers','CannedAnswer','findAll','removeAnswers','notify','sms','SmsApplication','applications','orderBy','Applications','priority','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','type','twilio','from','Body','messageId','skebby','sender','text','clicksend','message_id','plivo','From','Text','infobip','results','csc','originatingAddress','clickatell','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','omit','Contacts','contact','SmsInteraction','spread','interaction','close','unmanaged','*,*,*,*','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','send','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','Contact','internal','Tag','color','tag','to\x20is\x20mandatory','List','SmsMessage','Messages','dataValues','push','skebby_dispatch_id','statusInt','requestid','status_code','groupName','DELIVERED','redif','inspect','connectel','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','ids','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http'];(function(_0xd0f170,_0x11b6b7){var _0x137be1=function(_0x283ba2){while(--_0x283ba2){_0xd0f170['push'](_0xd0f170['shift']());}};_0x137be1(++_0x11b6b7);}(_0x8448,0xc2));var _0x8844=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0x8448[_0x13b7fd];return _0x32a74a;};'use strict';var emlformat=require(_0x8844('0x0'));var rimraf=require(_0x8844('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8844('0x2'));var moment=require(_0x8844('0x3'));var BPromise=require(_0x8844('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8844('0x5'));var sox=require('sox');var csv=require(_0x8844('0x6'));var ejs=require(_0x8844('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8844('0x8'));var squel=require(_0x8844('0x9'));var crypto=require(_0x8844('0xa'));var jsforce=require(_0x8844('0xb'));var deskjs=require(_0x8844('0xc'));var toCsv=require(_0x8844('0x6'));var querystring=require(_0x8844('0xd'));var Papa=require(_0x8844('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8844('0xf'));var hardwareService=require(_0x8844('0x10'));var logger=require(_0x8844('0x11'))(_0x8844('0x12'));var utils=require('../../config/utils');var config=require(_0x8844('0x13'));var licenseUtil=require(_0x8844('0x14'));var db=require(_0x8844('0x15'))['db'];config[_0x8844('0x16')]=_[_0x8844('0x17')](config[_0x8844('0x16')],{'host':_0x8844('0x18'),'port':0x18eb});var socket=require(_0x8844('0x19'))(new Redis(config[_0x8844('0x16')]));require(_0x8844('0x1a'))[_0x8844('0x1b')](socket);var jayson=require(_0x8844('0x1c'));var client=jayson[_0x8844('0x1d')][_0x8844('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x25e2b0,_0x4a2dd5,_0x45f728,_0x5d6a44){return new BPromise(function(_0x1acd2f,_0x90e8b){var _0x14df6a=_0x5d6a44||client;return _0x14df6a[_0x8844('0x1f')](_0x25e2b0,_0x45f728)[_0x8844('0x20')](function(_0x370a3a){logger[_0x8844('0x21')]('SmsAccount,\x20%s,\x20%s',_0x4a2dd5,_0x8844('0x22'));logger[_0x8844('0x23')](_0x8844('0x24'),_0x4a2dd5,_0x8844('0x22'),JSON['stringify'](_0x370a3a));if(_0x370a3a[_0x8844('0x25')]){if(_0x370a3a[_0x8844('0x25')]['code']===0x1f4){logger[_0x8844('0x25')](_0x8844('0x26'),_0x4a2dd5,_0x370a3a[_0x8844('0x25')]['message']);return _0x90e8b(_0x370a3a[_0x8844('0x25')]['message']);}logger[_0x8844('0x25')]('SmsAccount,\x20%s,\x20%s',_0x4a2dd5,_0x370a3a[_0x8844('0x25')][_0x8844('0x27')]);return _0x1acd2f(_0x370a3a[_0x8844('0x25')][_0x8844('0x27')]);}else{logger[_0x8844('0x21')]('SmsAccount,\x20%s,\x20%s',_0x4a2dd5,_0x8844('0x22'));_0x1acd2f(_0x370a3a[_0x8844('0x28')]['message']);}})['catch'](function(_0xce1858){logger[_0x8844('0x25')](_0x8844('0x26'),_0x4a2dd5,_0xce1858);_0x90e8b(_0xce1858);});});}function respondWithStatusCode(_0x4bd89d,_0xb284dc){_0xb284dc=_0xb284dc||0xcc;return function(_0x2d213d){if(_0x2d213d){return _0x4bd89d['sendStatus'](_0xb284dc);}return _0x4bd89d[_0x8844('0x29')](_0xb284dc)['end']();};}function respondWithResult(_0x464132,_0x1818f2){_0x1818f2=_0x1818f2||0xc8;return function(_0x255119){if(_0x255119){return _0x464132[_0x8844('0x29')](_0x1818f2)[_0x8844('0x2a')](_0x255119);}};}function respondWithFilteredResult(_0x4b2de3,_0x498b54){return function(_0xe5c078){if(_0xe5c078){var _0x4e64f7=typeof _0x498b54[_0x8844('0x2b')]===_0x8844('0x2c')&&typeof _0x498b54['limit']===_0x8844('0x2c');var _0xfdb113=_0xe5c078[_0x8844('0x2d')];var _0x9f2598=_0x4e64f7?0x0:_0x498b54['offset'];var _0x3f1df1=_0x4e64f7?_0xe5c078['count']:_0x498b54[_0x8844('0x2b')]+_0x498b54[_0x8844('0x2e')];var _0x208676;if(_0x3f1df1>=_0xfdb113){_0x3f1df1=_0xfdb113;_0x208676=0xc8;}else{_0x208676=0xce;}_0x4b2de3['status'](_0x208676);return _0x4b2de3['set'](_0x8844('0x2f'),_0x9f2598+'-'+_0x3f1df1+'/'+_0xfdb113)[_0x8844('0x2a')](_0xe5c078);}return null;};}function patchUpdates(_0x3aa275){return function(_0x4190f1){try{jsonpatch['apply'](_0x4190f1,_0x3aa275,!![]);}catch(_0x3cd81d){return BPromise[_0x8844('0x30')](_0x3cd81d);}return _0x4190f1[_0x8844('0x31')]();};}function saveUpdates(_0x2fe9d2,_0x503ce5){return function(_0x1690ce){if(_0x1690ce){return _0x1690ce['update'](_0x2fe9d2)[_0x8844('0x20')](function(_0x4d106d){return _0x4d106d;});}return null;};}function removeEntity(_0x1ecfef,_0x1e20f2){return function(_0x38e48b){if(_0x38e48b){return _0x38e48b[_0x8844('0x32')]()[_0x8844('0x20')](function(){var _0x3e050f=_0x38e48b['get']({'plain':!![]});var _0x52e185=_0x8844('0x33');return db[_0x8844('0x34')][_0x8844('0x32')]({'where':{'type':_0x52e185,'resourceId':_0x3e050f['id']}})[_0x8844('0x20')](function(){return _0x38e48b;});})[_0x8844('0x20')](function(){_0x1ecfef['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x162efa,_0x1fff04){return function(_0x1ee619){if(!_0x1ee619){_0x162efa[_0x8844('0x35')](0x194);}return _0x1ee619;};}function handleError(_0x17d89e,_0x3f1b82){_0x3f1b82=_0x3f1b82||0x1f4;return function(_0x24eeec){logger[_0x8844('0x25')](_0x24eeec[_0x8844('0x36')]);if(_0x24eeec[_0x8844('0x37')]){delete _0x24eeec[_0x8844('0x37')];}_0x17d89e[_0x8844('0x29')](_0x3f1b82)['send'](_0x24eeec);};}exports[_0x8844('0x38')]=function(_0x299470,_0x1fcee5){var _0x28e454={'include':[{'model':db[_0x8844('0x39')],'as':_0x8844('0x3a')}]},_0x55055d={},_0x44f32c={'count':0x0,'rows':[]};var _0x3e799c=_[_0x8844('0x3b')](db['SmsAccount'][_0x8844('0x3c')],function(_0x364c81){return{'name':_0x364c81[_0x8844('0x3d')],'type':_0x364c81['type'][_0x8844('0x3e')]};});_0x55055d['model']=_[_0x8844('0x3b')](_0x3e799c,_0x8844('0x37'));_0x55055d[_0x8844('0x3f')]=_[_0x8844('0x40')](_0x299470[_0x8844('0x3f')]);_0x55055d[_0x8844('0x41')]=_[_0x8844('0x42')](_0x55055d[_0x8844('0x43')],_0x55055d[_0x8844('0x3f')]);_0x28e454['attributes']=_[_0x8844('0x42')](_0x55055d[_0x8844('0x43')],qs[_0x8844('0x44')](_0x299470['query']['fields']));_0x28e454[_0x8844('0x45')]=_0x28e454['attributes'][_0x8844('0x46')]?_0x28e454[_0x8844('0x45')]:_0x55055d[_0x8844('0x43')];if(!_0x299470['query'][_0x8844('0x47')](_0x8844('0x48'))){_0x28e454[_0x8844('0x2e')]=qs[_0x8844('0x2e')](_0x299470[_0x8844('0x3f')]['limit']);_0x28e454[_0x8844('0x2b')]=qs['offset'](_0x299470[_0x8844('0x3f')][_0x8844('0x2b')]);}_0x28e454[_0x8844('0x49')]=qs['sort'](_0x299470[_0x8844('0x3f')][_0x8844('0x4a')]);_0x28e454['where']=qs['filters'](_[_0x8844('0x4b')](_0x299470[_0x8844('0x3f')],_0x55055d[_0x8844('0x41')]),_0x3e799c);if(_0x299470[_0x8844('0x3f')][_0x8844('0x4c')]){_0x28e454[_0x8844('0x4d')]=_[_0x8844('0x4e')](_0x28e454['where'],{'$or':_[_0x8844('0x3b')](_0x3e799c,function(_0x9e0e1f){if(_0x9e0e1f['type']!==_0x8844('0x4f')){var _0x17a975={};_0x17a975[_0x9e0e1f['name']]={'$like':'%'+_0x299470['query']['filter']+'%'};return _0x17a975;}})});}_0x28e454=_[_0x8844('0x4e')]({},_0x28e454,_0x299470['options']);var _0x3b5e29={'where':_0x28e454[_0x8844('0x4d')]};return db[_0x8844('0x50')][_0x8844('0x2d')](_0x3b5e29)[_0x8844('0x20')](function(_0x425072){_0x44f32c[_0x8844('0x2d')]=_0x425072;if(_0x299470['query']['includeAll']){_0x28e454[_0x8844('0x51')]=[{'all':!![]}];}return db[_0x8844('0x50')]['findAll'](_0x28e454);})[_0x8844('0x20')](function(_0x757775){_0x44f32c[_0x8844('0x52')]=_0x757775;return _0x44f32c;})[_0x8844('0x20')](respondWithFilteredResult(_0x1fcee5,_0x28e454))[_0x8844('0x53')](handleError(_0x1fcee5,null));};exports[_0x8844('0x54')]=function(_0x47eff1,_0x2e2cb7){var _0x3c18ea={'raw':![],'where':{'id':_0x47eff1[_0x8844('0x55')]['id']},'include':[{'model':db[_0x8844('0x39')],'as':'mandatoryDispositionPause'}]},_0x6b89ee={};_0x6b89ee['model']=_[_0x8844('0x40')](db[_0x8844('0x50')][_0x8844('0x3c')]);_0x6b89ee['query']=_[_0x8844('0x40')](_0x47eff1[_0x8844('0x3f')]);_0x6b89ee[_0x8844('0x41')]=_[_0x8844('0x42')](_0x6b89ee[_0x8844('0x43')],_0x6b89ee[_0x8844('0x3f')]);_0x3c18ea[_0x8844('0x45')]=_[_0x8844('0x42')](_0x6b89ee[_0x8844('0x43')],qs[_0x8844('0x44')](_0x47eff1[_0x8844('0x3f')][_0x8844('0x44')]));_0x3c18ea[_0x8844('0x45')]=_0x3c18ea[_0x8844('0x45')][_0x8844('0x46')]?_0x3c18ea[_0x8844('0x45')]:_0x6b89ee[_0x8844('0x43')];if(_0x47eff1['query']['includeAll']){_0x3c18ea[_0x8844('0x51')]=[{'all':!![]}];}_0x3c18ea=_[_0x8844('0x4e')]({},_0x3c18ea,_0x47eff1['options']);return db[_0x8844('0x50')]['find'](_0x3c18ea)[_0x8844('0x20')](handleEntityNotFound(_0x2e2cb7,null))[_0x8844('0x20')](respondWithResult(_0x2e2cb7,null))[_0x8844('0x53')](handleError(_0x2e2cb7,null));};exports['create']=function(_0x30bbd8,_0x106760){return db[_0x8844('0x50')][_0x8844('0x56')](_0x30bbd8[_0x8844('0x57')],{})['then'](function(_0x433575){var _0x11fcb4=_0x30bbd8[_0x8844('0x58')][_0x8844('0x59')]({'plain':!![]});if(!_0x11fcb4)throw new Error(_0x8844('0x5a'));if(_0x11fcb4[_0x8844('0x5b')]===_0x8844('0x58')){var _0x4fcd37=_0x433575[_0x8844('0x59')]({'plain':!![]});var _0x3b77ff=_0x8844('0x33');return db[_0x8844('0x5c')][_0x8844('0x5d')]({'where':{'name':_0x3b77ff,'userProfileId':_0x11fcb4[_0x8844('0x5e')]},'raw':!![]})[_0x8844('0x20')](function(_0x5e73db){if(_0x5e73db&&_0x5e73db[_0x8844('0x5f')]===0x0){return db[_0x8844('0x34')][_0x8844('0x56')]({'name':_0x4fcd37[_0x8844('0x37')],'resourceId':_0x4fcd37['id'],'type':_0x5e73db['name'],'sectionId':_0x5e73db['id']},{})['then'](function(){return _0x433575;});}else{return _0x433575;}})[_0x8844('0x53')](function(_0x15875d){logger[_0x8844('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15875d);throw _0x15875d;});}return _0x433575;})[_0x8844('0x20')](respondWithResult(_0x106760,0xc9))[_0x8844('0x53')](handleError(_0x106760,null));};exports[_0x8844('0x60')]=function(_0x1c5294,_0x3b1ded){if(_0x1c5294[_0x8844('0x57')]['id']){delete _0x1c5294['body']['id'];}return db[_0x8844('0x50')]['find']({'where':{'id':_0x1c5294[_0x8844('0x55')]['id']},'include':[{'model':db[_0x8844('0x39')],'as':_0x8844('0x3a')}]})['then'](handleEntityNotFound(_0x3b1ded,null))[_0x8844('0x20')](saveUpdates(_0x1c5294[_0x8844('0x57')],null))[_0x8844('0x20')](respondWithResult(_0x3b1ded,null))['catch'](handleError(_0x3b1ded,null));};exports[_0x8844('0x32')]=function(_0x1df1ee,_0x846e09){return db[_0x8844('0x50')][_0x8844('0x5d')]({'where':{'id':_0x1df1ee[_0x8844('0x55')]['id']}})[_0x8844('0x20')](handleEntityNotFound(_0x846e09,null))[_0x8844('0x20')](removeEntity(_0x846e09,null))[_0x8844('0x53')](handleError(_0x846e09,null));};exports[_0x8844('0x61')]=function(_0x569551,_0x52a0fb){return db[_0x8844('0x50')]['describe']()[_0x8844('0x20')](respondWithResult(_0x52a0fb,null))[_0x8844('0x53')](handleError(_0x52a0fb,null));};exports[_0x8844('0x62')]=function(_0x1ac19e,_0x2dacbb,_0x2d27c9){if(_0x1ac19e[_0x8844('0x57')]['id']){delete _0x1ac19e[_0x8844('0x57')]['id'];}return db[_0x8844('0x50')][_0x8844('0x5d')]({'where':{'id':_0x1ac19e[_0x8844('0x55')]['id']}})[_0x8844('0x20')](handleEntityNotFound(_0x2dacbb,null))['then'](function(_0x5276b8){if(_0x5276b8){_0x1ac19e['body']['SmsAccountId']=_0x5276b8['id'];return db[_0x8844('0x63')]['create'](_0x1ac19e[_0x8844('0x57')]);}})[_0x8844('0x20')](respondWithResult(_0x2dacbb,null))[_0x8844('0x53')](handleError(_0x2dacbb,null));};exports[_0x8844('0x64')]=function(_0x170bed,_0x13a3c2,_0x2f4b89){var _0x59f2f0={'raw':![],'where':{}};var _0x20e009={};var _0x153df6={'count':0x0,'rows':[]};return db[_0x8844('0x50')][_0x8844('0x65')]({'where':{'id':_0x170bed[_0x8844('0x55')]['id']}})['then'](handleEntityNotFound(_0x13a3c2,null))[_0x8844('0x20')](function(_0x38da80){if(_0x38da80){_0x20e009['model']=_[_0x8844('0x40')](db['Disposition'][_0x8844('0x3c')]);_0x20e009[_0x8844('0x3f')]=_['keys'](_0x170bed[_0x8844('0x3f')]);_0x20e009[_0x8844('0x41')]=_[_0x8844('0x42')](_0x20e009[_0x8844('0x43')],_0x20e009['query']);_0x59f2f0[_0x8844('0x45')]=_['intersection'](_0x20e009[_0x8844('0x43')],qs[_0x8844('0x44')](_0x170bed[_0x8844('0x3f')][_0x8844('0x44')]));_0x59f2f0[_0x8844('0x45')]=_0x59f2f0['attributes'][_0x8844('0x46')]?_0x59f2f0[_0x8844('0x45')]:_0x20e009[_0x8844('0x43')];if(!_0x170bed['query'][_0x8844('0x47')](_0x8844('0x48'))){_0x59f2f0[_0x8844('0x2e')]=qs[_0x8844('0x2e')](_0x170bed[_0x8844('0x3f')]['limit']);_0x59f2f0[_0x8844('0x2b')]=qs[_0x8844('0x2b')](_0x170bed[_0x8844('0x3f')][_0x8844('0x2b')]);}_0x59f2f0['order']=qs[_0x8844('0x4a')](_0x170bed[_0x8844('0x3f')][_0x8844('0x4a')]);_0x59f2f0[_0x8844('0x4d')]=qs[_0x8844('0x41')](_['pick'](_0x170bed[_0x8844('0x3f')],_0x20e009[_0x8844('0x41')]));_0x59f2f0[_0x8844('0x4d')][_0x8844('0x66')]=_0x38da80['id'];if(_0x170bed[_0x8844('0x3f')][_0x8844('0x4c')]){_0x59f2f0[_0x8844('0x4d')]=_[_0x8844('0x4e')](_0x59f2f0[_0x8844('0x4d')],{'$or':_['map'](_0x59f2f0[_0x8844('0x45')],function(_0x4a0e0b){var _0x14d324={};_0x14d324[_0x4a0e0b]={'$like':'%'+_0x170bed[_0x8844('0x3f')][_0x8844('0x4c')]+'%'};return _0x14d324;})});}_0x59f2f0=_[_0x8844('0x4e')]({},_0x59f2f0,_0x170bed[_0x8844('0x67')]);return db['Disposition'][_0x8844('0x2d')]({'where':_0x59f2f0[_0x8844('0x4d')]})['then'](function(_0x1d393b){_0x153df6[_0x8844('0x2d')]=_0x1d393b;if(_0x170bed[_0x8844('0x3f')][_0x8844('0x68')]){_0x59f2f0[_0x8844('0x51')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x59f2f0);})[_0x8844('0x20')](function(_0x36f7b3){_0x153df6[_0x8844('0x52')]=_0x36f7b3;return _0x153df6;});}})[_0x8844('0x20')](respondWithFilteredResult(_0x13a3c2,_0x59f2f0))[_0x8844('0x53')](handleError(_0x13a3c2,null));};exports[_0x8844('0x69')]=function(_0x522834,_0x38925e,_0x2de7ee){return db[_0x8844('0x50')][_0x8844('0x5d')]({'where':{'id':_0x522834['params']['id']}})[_0x8844('0x20')](handleEntityNotFound(_0x38925e,null))[_0x8844('0x20')](function(_0x4b048e){if(_0x4b048e){return _0x4b048e['removeDispositions'](_0x522834[_0x8844('0x3f')]['ids']);}})[_0x8844('0x20')](respondWithStatusCode(_0x38925e,null))[_0x8844('0x53')](handleError(_0x38925e,null));};exports[_0x8844('0x6a')]=function(_0x5eb725,_0x18b2c5,_0x199bb8){if(_0x5eb725['body']['id']){delete _0x5eb725['body']['id'];}return db[_0x8844('0x50')][_0x8844('0x5d')]({'where':{'id':_0x5eb725['params']['id']}})[_0x8844('0x20')](handleEntityNotFound(_0x18b2c5,null))['then'](function(_0x3b51b0){if(_0x3b51b0){_0x5eb725[_0x8844('0x57')][_0x8844('0x66')]=_0x3b51b0['id'];return db['CannedAnswer']['create'](_0x5eb725[_0x8844('0x57')]);}})[_0x8844('0x20')](respondWithResult(_0x18b2c5,null))[_0x8844('0x53')](handleError(_0x18b2c5,null));};exports[_0x8844('0x6b')]=function(_0xa77d8f,_0x382530,_0x9168e1){var _0x45cafe={'raw':![],'where':{}};var _0x5b6edc={};var _0x5b9f27={'count':0x0,'rows':[]};return db[_0x8844('0x50')][_0x8844('0x65')]({'where':{'id':_0xa77d8f[_0x8844('0x55')]['id']}})[_0x8844('0x20')](handleEntityNotFound(_0x382530,null))['then'](function(_0x4519d2){if(_0x4519d2){_0x5b6edc[_0x8844('0x43')]=_[_0x8844('0x40')](db['CannedAnswer'][_0x8844('0x3c')]);_0x5b6edc['query']=_[_0x8844('0x40')](_0xa77d8f['query']);_0x5b6edc['filters']=_[_0x8844('0x42')](_0x5b6edc['model'],_0x5b6edc['query']);_0x45cafe['attributes']=_[_0x8844('0x42')](_0x5b6edc[_0x8844('0x43')],qs[_0x8844('0x44')](_0xa77d8f[_0x8844('0x3f')][_0x8844('0x44')]));_0x45cafe[_0x8844('0x45')]=_0x45cafe[_0x8844('0x45')]['length']?_0x45cafe[_0x8844('0x45')]:_0x5b6edc[_0x8844('0x43')];if(!_0xa77d8f['query'][_0x8844('0x47')](_0x8844('0x48'))){_0x45cafe[_0x8844('0x2e')]=qs[_0x8844('0x2e')](_0xa77d8f['query'][_0x8844('0x2e')]);_0x45cafe[_0x8844('0x2b')]=qs['offset'](_0xa77d8f[_0x8844('0x3f')][_0x8844('0x2b')]);}_0x45cafe['order']=qs[_0x8844('0x4a')](_0xa77d8f[_0x8844('0x3f')][_0x8844('0x4a')]);_0x45cafe[_0x8844('0x4d')]=qs[_0x8844('0x41')](_['pick'](_0xa77d8f[_0x8844('0x3f')],_0x5b6edc[_0x8844('0x41')]));_0x45cafe[_0x8844('0x4d')][_0x8844('0x66')]=_0x4519d2['id'];if(_0xa77d8f['query']['filter']){_0x45cafe[_0x8844('0x4d')]=_['merge'](_0x45cafe[_0x8844('0x4d')],{'$or':_[_0x8844('0x3b')](_0x45cafe[_0x8844('0x45')],function(_0x2f45bf){var _0x2f7788={};_0x2f7788[_0x2f45bf]={'$like':'%'+_0xa77d8f[_0x8844('0x3f')][_0x8844('0x4c')]+'%'};return _0x2f7788;})});}_0x45cafe=_['merge']({},_0x45cafe,_0xa77d8f[_0x8844('0x67')]);return db[_0x8844('0x6c')][_0x8844('0x2d')]({'where':_0x45cafe[_0x8844('0x4d')]})[_0x8844('0x20')](function(_0x55820d){_0x5b9f27['count']=_0x55820d;if(_0xa77d8f[_0x8844('0x3f')][_0x8844('0x68')]){_0x45cafe['include']=[{'all':!![]}];}return db[_0x8844('0x6c')][_0x8844('0x6d')](_0x45cafe);})['then'](function(_0x3e5002){_0x5b9f27[_0x8844('0x52')]=_0x3e5002;return _0x5b9f27;});}})[_0x8844('0x20')](respondWithFilteredResult(_0x382530,_0x45cafe))[_0x8844('0x53')](handleError(_0x382530,null));};exports[_0x8844('0x6e')]=function(_0xaf2ff3,_0x5aabd8,_0x14c2df){return db['SmsAccount'][_0x8844('0x5d')]({'where':{'id':_0xaf2ff3[_0x8844('0x55')]['id']}})['then'](handleEntityNotFound(_0x5aabd8,null))['then'](function(_0x3e5288){if(_0x3e5288){return _0x3e5288[_0x8844('0x6e')](_0xaf2ff3[_0x8844('0x3f')]['ids']);}})[_0x8844('0x20')](respondWithStatusCode(_0x5aabd8,null))[_0x8844('0x53')](handleError(_0x5aabd8,null));};exports[_0x8844('0x6f')]=function(_0x7c8ed0,_0x15f935,_0x206ac8){var _0x5baa7e={'channel':_0x8844('0x70')};var _0xd879f8=[];var _0x27a15c=[];var _0x285d9d={};return db[_0x8844('0x50')]['find']({'where':{'id':_0x7c8ed0[_0x8844('0x55')]['id']},'include':[{'model':db[_0x8844('0x71')],'as':'Applications'}]})[_0x8844('0x20')](handleEntityNotFound(_0x15f935,null))[_0x8844('0x20')](function(_0x566bb4){_0x5baa7e['account']=_0x566bb4;_0x5baa7e[_0x8844('0x72')]=_[_0x8844('0x73')](_0x566bb4[_0x8844('0x74')],[_0x8844('0x75')],[_0x8844('0x76')]);if(_0x5baa7e[_0x8844('0x77')][_0x8844('0x74')]){delete _0x5baa7e[_0x8844('0x77')][_0x8844('0x74')];}return db[_0x8844('0x78')][_0x8844('0x61')]();})[_0x8844('0x20')](function(_0x22975c){if(!_0x22975c){throw new db['Sequelize'][(_0x8844('0x79'))](_0x8844('0x7a'));}_0xd879f8=_[_0x8844('0x7b')](_['keys'](_0x22975c),[_0x8844('0x7c'),_0x8844('0x7d')]);_0x27a15c=_[_0x8844('0x7b')](_[_0x8844('0x40')](_0x22975c),['createdAt',_0x8844('0x7d'),'CompanyId',_0x8844('0x7e')]);_0x5baa7e[_0x8844('0x57')]={'mapKey':_0x8844('0x7f')};if(_0x5baa7e[_0x8844('0x77')][_0x8844('0x80')]){switch(_0x5baa7e[_0x8844('0x77')]['type']){case _0x8844('0x81'):_0x5baa7e[_0x8844('0x57')][_0x8844('0x82')]=_0x7c8ed0[_0x8844('0x57')]['From'];_0x5baa7e[_0x8844('0x57')]['body']=_0x7c8ed0[_0x8844('0x57')][_0x8844('0x83')];_0x5baa7e['body'][_0x8844('0x84')]=_0x7c8ed0[_0x8844('0x57')]['MessageSid'];break;case _0x8844('0x85'):_0x5baa7e[_0x8844('0x57')][_0x8844('0x82')]='+'+_0x7c8ed0[_0x8844('0x57')][_0x8844('0x86')];_0x5baa7e[_0x8844('0x57')][_0x8844('0x57')]=_0x7c8ed0[_0x8844('0x57')][_0x8844('0x87')];break;case'connectel':_0x5baa7e['body']['from']=_0x7c8ed0[_0x8844('0x57')][_0x8844('0x82')];_0x5baa7e[_0x8844('0x57')]['body']=_0x7c8ed0[_0x8844('0x57')][_0x8844('0x27')];break;case _0x8844('0x88'):_0x5baa7e[_0x8844('0x57')][_0x8844('0x82')]=_0x7c8ed0[_0x8844('0x57')][_0x8844('0x82')];_0x5baa7e[_0x8844('0x57')][_0x8844('0x57')]=_0x7c8ed0['body'][_0x8844('0x57')];_0x5baa7e[_0x8844('0x57')][_0x8844('0x84')]=_0x7c8ed0[_0x8844('0x57')][_0x8844('0x89')];break;case _0x8844('0x8a'):_0x5baa7e[_0x8844('0x57')][_0x8844('0x82')]=_0x7c8ed0[_0x8844('0x57')][_0x8844('0x8b')];_0x5baa7e[_0x8844('0x57')][_0x8844('0x57')]=_0x7c8ed0['body'][_0x8844('0x8c')];_0x5baa7e[_0x8844('0x57')][_0x8844('0x84')]=_0x7c8ed0[_0x8844('0x57')]['MessageUUID'];break;case _0x8844('0x8d'):_0x5baa7e[_0x8844('0x57')][_0x8844('0x82')]='+'+_0x7c8ed0['body'][_0x8844('0x8e')][0x0][_0x8844('0x82')];_0x5baa7e[_0x8844('0x57')][_0x8844('0x57')]=_0x7c8ed0[_0x8844('0x57')][_0x8844('0x8e')][0x0][_0x8844('0x87')];_0x5baa7e[_0x8844('0x57')][_0x8844('0x84')]=_0x7c8ed0['body'][_0x8844('0x8e')][0x0][_0x8844('0x84')];break;case _0x8844('0x8f'):_0x5baa7e[_0x8844('0x57')][_0x8844('0x82')]=_0x7c8ed0[_0x8844('0x57')][_0x8844('0x90')];_0x5baa7e['body'][_0x8844('0x57')]=_0x7c8ed0[_0x8844('0x57')]['segmentedMessage'][_0x8844('0x27')];break;case _0x8844('0x91'):_0x5baa7e[_0x8844('0x57')][_0x8844('0x82')]=_0x7c8ed0[_0x8844('0x57')]['fromNumber'];_0x5baa7e[_0x8844('0x57')][_0x8844('0x57')]=_0x7c8ed0['body'][_0x8844('0x87')];_0x5baa7e[_0x8844('0x57')][_0x8844('0x84')]=_0x7c8ed0[_0x8844('0x57')]['replyMessageId'];break;case _0x8844('0x92'):_0x5baa7e[_0x8844('0x57')][_0x8844('0x84')]=_0x7c8ed0['body'][0x0][_0x8844('0x27')]['id'];_0x5baa7e[_0x8844('0x57')][_0x8844('0x82')]=_0x7c8ed0[_0x8844('0x57')][0x0][_0x8844('0x27')][_0x8844('0x82')];_0x5baa7e[_0x8844('0x57')]['body']=_0x7c8ed0['body'][0x0]['message'][_0x8844('0x87')];break;case _0x8844('0x93'):_0x5baa7e[_0x8844('0x57')]['from']=_0x7c8ed0[_0x8844('0x57')][_0x8844('0x82')];_0x5baa7e['body'][_0x8844('0x57')]=_0x7c8ed0[_0x8844('0x57')][_0x8844('0x27')];_0x5baa7e['body'][_0x8844('0x84')]=_0x7c8ed0[_0x8844('0x57')][_0x8844('0x94')];break;}}if(_0x5baa7e[_0x8844('0x57')]['id']){delete _0x5baa7e[_0x8844('0x57')]['id'];}if(_[_0x8844('0x95')](_0x5baa7e[_0x8844('0x57')]['from'])){throw new db['Sequelize'][(_0x8844('0x79'))](_0x8844('0x96'));}if(_['isNil'](_0x5baa7e['body'][_0x8844('0x57')])||_0x5baa7e['body'][_0x8844('0x57')]===''){throw new db[(_0x8844('0x97'))][(_0x8844('0x79'))](_0x8844('0x98'));}if(_[_0x8844('0x95')](_0x5baa7e[_0x8844('0x57')]['mapKey'])){throw new db['Sequelize'][(_0x8844('0x79'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x27a15c);}if(!_[_0x8844('0x99')](_0x27a15c,_0x5baa7e[_0x8844('0x57')][_0x8844('0x9a')])){throw new db[(_0x8844('0x97'))][(_0x8844('0x79'))](_0x8844('0x9b')+_0x27a15c);}_0x285d9d[_0x5baa7e[_0x8844('0x57')][_0x8844('0x9a')]]=_0x5baa7e['body'][_0x8844('0x82')];return db[_0x8844('0x9c')][_0x8844('0x5d')]({'where':{'id':_0x5baa7e[_0x8844('0x77')][_0x8844('0x7e')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x285d9d,'limit':0x1,'order':[[_0x8844('0x7d'),'DESC']]}]});})[_0x8844('0x20')](handleEntityNotFound(_0x15f935,null))[_0x8844('0x20')](function(_0x42fe07){if(_0x42fe07){_0x5baa7e[_0x8844('0x9d')]=_[_0x8844('0x9e')](_0x42fe07,[_0x8844('0x9f')]);if(_0x42fe07[_0x8844('0x9f')][_0x8844('0x46')]){return _0x42fe07[_0x8844('0x9f')][0x0];}var _0x8b767f=_['defaults'](_0x5baa7e[_0x8844('0x57')],{'firstName':_0x5baa7e[_0x8844('0x57')][_0x8844('0x82')],'ListId':_0x42fe07['id']});_0x8b767f[_0x5baa7e[_0x8844('0x57')][_0x8844('0x9a')]]=_0x5baa7e[_0x8844('0x57')][_0x8844('0x82')];return db[_0x8844('0x78')][_0x8844('0x56')](_0x8b767f,{'fields':_0xd879f8,'raw':!![]});}})['then'](handleEntityNotFound(_0x15f935,null))[_0x8844('0x20')](function(_0xf4654a){if(_0xf4654a){_0x5baa7e[_0x8844('0xa0')]=_0xf4654a;var _0x1115c5={'ContactId':_0xf4654a['id'],'phone':_0x5baa7e['body'][_0x8844('0x82')],'SmsAccountId':_0x7c8ed0[_0x8844('0x55')]['id']};var _0x446673={'ContactId':_0xf4654a['id'],'SmsAccountId':_0x7c8ed0[_0x8844('0x55')]['id'],'closed':![]};return db[_0x8844('0xa1')][_0x8844('0x5d')]({'where':_0x446673})[_0x8844('0x20')](function(_0x3a9927){if(_0x3a9927){return[_0x3a9927,![]];}return db[_0x8844('0xa1')]['create'](_0x1115c5)[_0x8844('0x20')](function(_0x4326fb){return[_0x4326fb,!![]];});});}})[_0x8844('0xa2')](function(_0x5e14cb,_0x4c240c){_0x5baa7e[_0x8844('0xa3')]=_0x5e14cb['get']({'plain':!![]});_0x5baa7e['interaction']['created']=![];if(_0x4c240c){if(_0x5baa7e[_0x8844('0x77')]['autoclose']){_0x5baa7e[_0x8844('0x72')]['push']({'id':0x0,'priority':_0x5baa7e[_0x8844('0x72')][_0x8844('0x46')]+0x1,'app':_0x8844('0xa4'),'appdata':_0x8844('0xa5'),'interval':_0x8844('0xa6')});}_0x5baa7e[_0x8844('0xa3')]['created']=!![];}return db['SmsMessage'][_0x8844('0x56')]({'phone':_0x5baa7e[_0x8844('0x57')][_0x8844('0x82')],'messageId':_0x5baa7e[_0x8844('0x57')][_0x8844('0x84')],'body':_0x5baa7e['body'][_0x8844('0x57')],'SmsAccountId':_0x7c8ed0[_0x8844('0x55')]['id'],'SmsInteractionId':_0x5e14cb['id'],'direction':'in','ContactId':_0x5e14cb[_0x8844('0xa7')],'AttachmentId':_0x5baa7e[_0x8844('0x57')][_0x8844('0xa8')]});})[_0x8844('0x20')](function(_0x5e9616){_0x5baa7e['message']=_0x5e9616;if(_0x5baa7e[_0x8844('0xa3')]['UserId']){return db[_0x8844('0xa9')]['find']({'attributes':['id',_0x8844('0x37')],'where':{'id':_0x5baa7e[_0x8844('0xa3')][_0x8844('0xaa')]}})[_0x8844('0x20')](function(_0x3a6ed5){if(_0x3a6ed5){_0x5baa7e[_0x8844('0x72')][_0x8844('0xab')]({'id':0x0,'priority':0x0,'app':_0x8844('0xac'),'appdata':_0x3a6ed5['name']+','+(_0x5baa7e[_0x8844('0x77')][_0x8844('0xad')]||0xa),'interval':_0x8844('0xa6')});}return respondWithRpcPromise(_0x8844('0xae'),'startRouting',_0x5baa7e);});}return respondWithRpcPromise(_0x8844('0xae'),_0x8844('0xaf'),_0x5baa7e);})['then'](function(_0x14ada0){if(_0x14ada0){var _0x4cb292=0xc8;var _0x22fe03=_0x8844('0xb0');logger['info'](_0x8844('0x24'),_0x22fe03,_0x4cb292,'entity\x20found');logger[_0x8844('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x22fe03,_0x4cb292,_0x8844('0xb1'),JSON['stringify'](_0x14ada0));if(_0x5baa7e['account'][_0x8844('0x80')]===_0x8844('0x81')){return _0x15f935[_0x8844('0x29')](_0x4cb292)['set']('Content-Type','text/xml')[_0x8844('0xb2')]('\x0a');}else{return _0x15f935[_0x8844('0x29')](_0x4cb292)[_0x8844('0x2a')](_0x14ada0);}}})['catch'](handleError(_0x15f935,null));};exports[_0x8844('0xb3')]=function(_0x5b0246,_0x373ed9){var _0x2f62dc=_0x5b0246['params']['id'];var _0x3db5b1=_0x5b0246[_0x8844('0x57')];var _0x55eab7=0xc8;var _0x442a62=null;return db[_0x8844('0xb4')][_0x8844('0xb5')]({'isolationLevel':db[_0x8844('0xb4')][_0x8844('0xb6')][_0x8844('0xb7')][_0x8844('0xb8')]},function(_0x4a1ce0){return db[_0x8844('0x50')][_0x8844('0x65')]({'where':{'id':_0x2f62dc},'transaction':_0x4a1ce0})['then'](function(_0x22cd7e){if(_0x22cd7e){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x2f62dc},'transaction':_0x4a1ce0})[_0x8844('0x20')](function(){var _0x56dd33=_[_0x8844('0x3b')](_0x3db5b1,function(_0x216f1e){_0x216f1e[_0x8844('0x66')]=_0x2f62dc;return _0x216f1e;});return db[_0x8844('0x71')][_0x8844('0xb9')](_0x56dd33,{'transaction':_0x4a1ce0});});}else{_0x55eab7=0x194;_0x442a62=[];}});})[_0x8844('0x20')](function(){if(_0x55eab7!==0x194){return db[_0x8844('0x71')][_0x8844('0xba')]({'where':{'SmsAccountId':_0x2f62dc},'order':_0x8844('0x75')})[_0x8844('0x20')](function(_0x4263db){_0x442a62=_0x4263db;});}})[_0x8844('0x53')](function(_0x27b7fd){_0x55eab7=0x1f4;logger[_0x8844('0x25')](_0x27b7fd[_0x8844('0x36')]);if(_0x27b7fd[_0x8844('0x37')]){delete _0x27b7fd[_0x8844('0x37')];}_0x442a62=_0x27b7fd;})['finally'](function(){if(_0x442a62===null){_0x373ed9[_0x8844('0x35')](_0x55eab7);}else{if(_0x55eab7===0x1f4){_0x373ed9[_0x8844('0x29')](_0x55eab7)[_0x8844('0xb2')](_0x442a62);}else{_0x373ed9[_0x8844('0x29')](_0x55eab7)[_0x8844('0x2a')](_0x442a62);}}});};exports[_0x8844('0xbb')]=function(_0x2c3e9e,_0x578ddc,_0x2adebe){var _0x1d93df={};var _0x187390={};var _0xd2e15a;var _0x211f51;return db['SmsAccount'][_0x8844('0x65')]({'where':{'id':_0x2c3e9e['params']['id']}})['then'](handleEntityNotFound(_0x578ddc,null))['then'](function(_0x517913){if(_0x517913){_0xd2e15a=_0x517913;_0x187390['model']=_[_0x8844('0x40')](db[_0x8844('0x71')]['rawAttributes']);_0x187390[_0x8844('0x3f')]=_[_0x8844('0x40')](_0x2c3e9e['query']);_0x187390[_0x8844('0x41')]=_[_0x8844('0x42')](_0x187390['model'],_0x187390['query']);_0x1d93df[_0x8844('0x45')]=_[_0x8844('0x42')](_0x187390[_0x8844('0x43')],qs[_0x8844('0x44')](_0x2c3e9e[_0x8844('0x3f')][_0x8844('0x44')]));_0x1d93df[_0x8844('0x45')]=_0x1d93df[_0x8844('0x45')]['length']?_0x1d93df[_0x8844('0x45')]:_0x187390[_0x8844('0x43')];_0x1d93df[_0x8844('0x49')]=qs[_0x8844('0x4a')](_0x2c3e9e[_0x8844('0x3f')][_0x8844('0x4a')]);_0x1d93df[_0x8844('0x4d')]=qs['filters'](_[_0x8844('0x4b')](_0x2c3e9e[_0x8844('0x3f')],_0x187390[_0x8844('0x41')]));if(_0x2c3e9e[_0x8844('0x3f')][_0x8844('0x4c')]){_0x1d93df[_0x8844('0x4d')]=_[_0x8844('0x4e')](_0x1d93df[_0x8844('0x4d')],{'$or':_[_0x8844('0x3b')](_0x1d93df[_0x8844('0x45')],function(_0x588070){var _0x5cea49={};_0x5cea49[_0x588070]={'$like':'%'+_0x2c3e9e[_0x8844('0x3f')][_0x8844('0x4c')]+'%'};return _0x5cea49;})});}_0x1d93df=_[_0x8844('0x4e')]({},_0x1d93df,_0x2c3e9e[_0x8844('0x67')]);return _0xd2e15a[_0x8844('0xbb')](_0x1d93df);}})[_0x8844('0x20')](function(_0x40d5e9){if(_0x40d5e9){_0x211f51=_0x40d5e9[_0x8844('0x46')];if(!_0x2c3e9e[_0x8844('0x3f')]['hasOwnProperty'](_0x8844('0x48'))){_0x1d93df[_0x8844('0x2e')]=qs[_0x8844('0x2e')](_0x2c3e9e[_0x8844('0x3f')][_0x8844('0x2e')]);_0x1d93df[_0x8844('0x2b')]=qs[_0x8844('0x2b')](_0x2c3e9e[_0x8844('0x3f')][_0x8844('0x2b')]);}return _0xd2e15a[_0x8844('0xbb')](_0x1d93df);}})[_0x8844('0x20')](function(_0x3e65c0){if(_0x3e65c0){return _0x3e65c0?{'count':_0x211f51,'rows':_0x3e65c0}:null;}})[_0x8844('0x20')](respondWithResult(_0x578ddc,null))[_0x8844('0x53')](handleError(_0x578ddc,null));};exports['getInteractions']=function(_0x3065d6,_0x38301a,_0x12b2aa){var _0x3dd64e={'raw':![],'where':{}};var _0x5a4da5={};var _0x52d6e0={'count':0x0,'rows':[]};return db[_0x8844('0x50')]['findOne']({'where':{'id':_0x3065d6['params']['id']}})['then'](handleEntityNotFound(_0x38301a,null))[_0x8844('0x20')](function(_0x531881){if(_0x531881){_0x5a4da5[_0x8844('0x43')]=_[_0x8844('0x40')](db[_0x8844('0xa1')][_0x8844('0x3c')]);_0x5a4da5[_0x8844('0x3f')]=_[_0x8844('0x40')](_0x3065d6[_0x8844('0x3f')]);_0x5a4da5[_0x8844('0x41')]=_[_0x8844('0x42')](_0x5a4da5[_0x8844('0x43')],_0x5a4da5[_0x8844('0x3f')]);_0x3dd64e[_0x8844('0x45')]=_['intersection'](_0x5a4da5[_0x8844('0x43')],qs['fields'](_0x3065d6[_0x8844('0x3f')][_0x8844('0x44')]));_0x3dd64e['attributes']=_0x3dd64e[_0x8844('0x45')][_0x8844('0x46')]?_0x3dd64e[_0x8844('0x45')]:_0x5a4da5['model'];if(!_0x3065d6[_0x8844('0x3f')][_0x8844('0x47')](_0x8844('0x48'))){_0x3dd64e['limit']=qs[_0x8844('0x2e')](_0x3065d6[_0x8844('0x3f')]['limit']);_0x3dd64e[_0x8844('0x2b')]=qs[_0x8844('0x2b')](_0x3065d6['query'][_0x8844('0x2b')]);}_0x3dd64e[_0x8844('0x49')]=qs[_0x8844('0x4a')](_0x3065d6[_0x8844('0x3f')][_0x8844('0x4a')]);_0x3dd64e[_0x8844('0x4d')]=qs['filters'](_[_0x8844('0x4b')](_0x3065d6[_0x8844('0x3f')],_0x5a4da5[_0x8844('0x41')]));_0x3dd64e[_0x8844('0x4d')]['SmsAccountId']=_0x531881['id'];if(_0x3065d6[_0x8844('0x3f')][_0x8844('0x4c')]){_0x3dd64e[_0x8844('0x4d')]=_[_0x8844('0x4e')](_0x3dd64e[_0x8844('0x4d')],{'$or':_[_0x8844('0x3b')](_0x3dd64e['attributes'],function(_0x33b908){var _0x24318f={};_0x24318f[_0x33b908]={'$like':'%'+_0x3065d6['query'][_0x8844('0x4c')]+'%'};return _0x24318f;})});}_0x3dd64e=_[_0x8844('0x4e')]({},_0x3dd64e,_0x3065d6[_0x8844('0x67')]);return db[_0x8844('0xa1')][_0x8844('0x2d')]({'where':_0x3dd64e[_0x8844('0x4d')]})['then'](function(_0x3425fe){_0x52d6e0['count']=_0x3425fe;if(_0x3065d6[_0x8844('0x3f')]['includeAll']){_0x3dd64e['include']=[{'model':db[_0x8844('0x78')],'as':_0x8844('0xbc'),'required':![]},{'model':db[_0x8844('0xa9')],'as':'Owner','attributes':[_0x8844('0x37'),'fullname',_0x8844('0xbd')],'required':![]},{'model':db[_0x8844('0xbe')],'as':'Tags','attributes':['id',_0x8844('0x37'),_0x8844('0xbf')],'where':_0x3065d6['query'][_0x8844('0xc0')]?{'id':_0x3065d6[_0x8844('0x3f')][_0x8844('0xc0')]}:undefined,'required':_0x3065d6[_0x8844('0x3f')]['tag']?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x3dd64e);})[_0x8844('0x20')](function(_0x4aa325){_0x52d6e0[_0x8844('0x52')]=_0x4aa325;return _0x52d6e0;});}})[_0x8844('0x20')](respondWithFilteredResult(_0x38301a,_0x3dd64e))['catch'](handleError(_0x38301a,null));};exports[_0x8844('0xb2')]=function(_0x2b186d,_0x1741c3,_0x377227){var _0x34013c,_0x4e2dc3,_0xc7db08;if(_[_0x8844('0x95')](_0x2b186d[_0x8844('0x57')][_0x8844('0x57')])||_0x2b186d[_0x8844('0x57')][_0x8844('0x57')]===''){throw new db[(_0x8844('0x97'))][(_0x8844('0x79'))](_0x8844('0x98'));}if(_[_0x8844('0x95')](_0x2b186d[_0x8844('0x57')]['to'])){throw new db['Sequelize'][(_0x8844('0x79'))](_0x8844('0xc1'));}_0x34013c=_0x2b186d[_0x8844('0x57')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x2b186d[_0x8844('0x55')]['id']},'include':[{'model':db[_0x8844('0x9c')],'as':_0x8844('0xc2'),'include':[{'model':db['CmContact'],'as':_0x8844('0x9f'),'where':{'mobile':_0x34013c},'limit':0x1,'order':[[_0x8844('0x7d'),'DESC']]}]}]})[_0x8844('0x20')](handleEntityNotFound(_0x1741c3,null))[_0x8844('0x20')](function(_0x251c60){if(_0x251c60&&_0x251c60['List']){_0x4e2dc3=_0x251c60[_0x8844('0x59')]({'plain':!![]});if(_0x4e2dc3[_0x8844('0xc2')]&&_0x4e2dc3[_0x8844('0xc2')][_0x8844('0x9f')][_0x8844('0x46')]){return _0x4e2dc3[_0x8844('0xc2')][_0x8844('0x9f')][0x0];}return db[_0x8844('0x78')][_0x8844('0x56')](_[_0x8844('0x17')](_0x2b186d['body'],{'firstName':_0x34013c,'mobile':_0x34013c,'phone':_0x34013c,'ListId':_0x4e2dc3[_0x8844('0x7e')]}));}})[_0x8844('0x20')](handleEntityNotFound(_0x1741c3,null))[_0x8844('0x20')](function(_0x4b19f7){if(_0x4b19f7){_0xc7db08=_0x4b19f7;return db[_0x8844('0xa1')][_0x8844('0x5d')]({'where':{'ContactId':_0xc7db08['id'],'closed':![],'SmsAccountId':_0x4e2dc3['id']}})[_0x8844('0x20')](function(_0x31c155){if(_0x31c155){return[_0x31c155,![]];}return db[_0x8844('0xa1')]['create']({'UserId':_0x2b186d[_0x8844('0x58')]['id'],'ContactId':_0xc7db08['id'],'SmsAccountId':_0x4e2dc3['id'],'phone':_0x34013c,'firstMsgDirection':'out','Messages':[_[_0x8844('0x4e')](_0x2b186d['body'],{'read':![],'body':_0x2b186d[_0x8844('0x57')][_0x8844('0x57')],'phone':_0x34013c,'SmsAccountId':_0x4e2dc3['id'],'UserId':_0x2b186d[_0x8844('0x58')]['id'],'ContactId':_0xc7db08['id']})]},{'include':[{'model':db[_0x8844('0xc3')],'as':_0x8844('0xc4')}]})[_0x8844('0x20')](function(_0x8fb28a){return[_0x8fb28a,!![]];});});}})[_0x8844('0xa2')](function(_0x5b901e,_0x531e2b){if(_0x531e2b){return _0x5b901e;}return db[_0x8844('0xc3')][_0x8844('0x56')](_[_0x8844('0x4e')](_0x2b186d[_0x8844('0x57')],{'read':![],'body':_0x2b186d['body'][_0x8844('0x57')],'phone':_0x34013c,'SmsAccountId':_0x4e2dc3['id'],'SmsInteractionId':_0x5b901e['id'],'UserId':_0x2b186d[_0x8844('0x58')]['id'],'ContactId':_0xc7db08['id']}))['then'](function(_0x5e9c62){_0x5b901e[_0x8844('0xc5')][_0x8844('0xc4')]=[];_0x5b901e[_0x8844('0xc5')][_0x8844('0xc4')][_0x8844('0xc6')](_0x5e9c62['dataValues']);return _0x5b901e;});})['then'](respondWithResult(_0x1741c3,null))[_0x8844('0x53')](handleError(_0x1741c3,null));};exports[_0x8844('0x29')]=function(_0x2bc576,_0x1c10f7,_0x31f37f){if(_0x2bc576['body']['id']){delete _0x2bc576[_0x8844('0x57')]['id'];}var _0x39d298,_0x4301dc,_0x30b094;return db[_0x8844('0x50')][_0x8844('0x5d')]({'where':{'id':_0x2bc576[_0x8844('0x55')]['id']}})[_0x8844('0x20')](handleEntityNotFound(_0x1c10f7,null))[_0x8844('0x20')](function(_0x30ee56){if(_0x30ee56){_0x30b094=_0x30ee56;logger[_0x8844('0x23')](_0x8844('0x24'),'status','received\x20delivery\x20report\x20from',_0x30ee56[_0x8844('0x80')],util['inspect'](_0x2bc576['body'],{'showHidden':![],'depth':null}));switch(_0x30ee56['type']){case _0x8844('0x85'):if(_0x2bc576[_0x8844('0x57')][_0x8844('0xc7')]&&_0x2bc576[_0x8844('0x57')][_0x8844('0x29')]){_0x4301dc=_0x2bc576[_0x8844('0x57')][_0x8844('0x29')];return db['SmsMessage'][_0x8844('0x5d')]({'where':{'messageId':_0x2bc576[_0x8844('0x57')][_0x8844('0xc7')]}});}break;case'connectel':if(_0x2bc576[_0x8844('0x57')]['requestid']&&_0x2bc576[_0x8844('0x57')][_0x8844('0xc8')]){_0x4301dc=_0x2bc576['body'][_0x8844('0xc8')];return db[_0x8844('0xc3')][_0x8844('0x5d')]({'where':{'messageId':_0x2bc576[_0x8844('0x57')][_0x8844('0xc9')]}});}break;case _0x8844('0x88'):if(_0x2bc576[_0x8844('0x57')][_0x8844('0x89')]&&_0x2bc576[_0x8844('0x57')][_0x8844('0xca')]){_0x4301dc=_0x2bc576[_0x8844('0x57')][_0x8844('0xca')];return db[_0x8844('0xc3')][_0x8844('0x5d')]({'where':{'messageId':_0x2bc576[_0x8844('0x57')][_0x8844('0x89')]}});}break;case _0x8844('0x8d'):var _0x44a224=_0x2bc576[_0x8844('0x57')][_0x8844('0x8e')][0x0];if(_0x44a224[_0x8844('0x84')]&&_0x44a224[_0x8844('0x29')][_0x8844('0xcb')]===_0x8844('0xcc')){_0x4301dc=_0x44a224['status'][_0x8844('0xcb')];return db[_0x8844('0xc3')][_0x8844('0x5d')]({'where':{'messageId':_0x44a224[_0x8844('0x84')]}});}break;case _0x8844('0x91'):if(_0x2bc576[_0x8844('0x57')][_0x8844('0x84')]&&_0x2bc576[_0x8844('0x57')][_0x8844('0x29')]){_0x4301dc=_0x2bc576[_0x8844('0x57')]['status'];return db[_0x8844('0xc3')][_0x8844('0x5d')]({'where':{'messageId':_0x2bc576[_0x8844('0x57')][_0x8844('0x84')]}});}break;case _0x8844('0x92'):if(_0x2bc576[_0x8844('0x57')][0x0][_0x8844('0x27')]['id']){_0x4301dc=_0x2bc576[_0x8844('0x57')][0x0]['type'];return db['SmsMessage'][_0x8844('0x5d')]({'where':{'messageId':_0x2bc576[_0x8844('0x57')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x2bc576[_0x8844('0x57')][_0x8844('0xcd')]&&_0x2bc576['body'][_0x8844('0x29')]){_0x4301dc=_0x2bc576[_0x8844('0x57')][_0x8844('0x29')];return db[_0x8844('0xc3')][_0x8844('0x5d')]({'where':{'messageId':_0x2bc576[_0x8844('0x57')][_0x8844('0xcd')]}});}break;}}})[_0x8844('0x20')](handleEntityNotFound(_0x1c10f7,null))['then'](function(_0x4feca2){if(_0x4feca2){_0x39d298=_0x4feca2;switch(_0x30b094[_0x8844('0x80')]){case _0x8844('0x85'):if(_0x4301dc==='DELIVERED'){return _0x39d298[_0x8844('0x60')]({'read':!![]});}else{logger[_0x8844('0x25')](_0x8844('0x24'),_0x8844('0x29'),'skebby',util[_0x8844('0xce')](_0x2bc576['body'],{'showHidden':![],'depth':null}));}break;case _0x8844('0xcf'):if(_0x4301dc==='1'){return _0x39d298[_0x8844('0x60')]({'read':!![]});}else{logger['error'](_0x8844('0x24'),_0x8844('0x29'),_0x8844('0x85'),util[_0x8844('0xce')](_0x2bc576[_0x8844('0x57')],{'showHidden':![],'depth':null}));}break;case _0x8844('0x88'):if(!_0x2bc576['body'][_0x8844('0xd0')]&&_0x4301dc>=0xc8&&_0x4301dc<=0xce){return _0x39d298[_0x8844('0x60')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8844('0x29'),_0x8844('0x88'),util[_0x8844('0xce')](_0x2bc576['body'],{'showHidden':![],'depth':null}));}break;case _0x8844('0x8d'):var _0x4d3c23=_0x2bc576[_0x8844('0x57')][_0x8844('0x8e')][0x0];if(_0x4d3c23['status'][_0x8844('0xcb')]===_0x8844('0xcc')){return _0x39d298[_0x8844('0x60')]({'read':!![]});}else{logger[_0x8844('0x25')](_0x8844('0x24'),_0x8844('0x29'),'infobip',util[_0x8844('0xce')](_0x2bc576['body'],{'showHidden':![],'depth':null}));}break;case _0x8844('0x91'):if(_0x4301dc==_0x8844('0xd1')||_0x4301dc==_0x8844('0xd2')){return _0x39d298[_0x8844('0x60')]({'read':!![]});}else{logger['error'](_0x8844('0x24'),_0x8844('0x29'),_0x8844('0x91'),util[_0x8844('0xce')](_0x2bc576[_0x8844('0x57')],{'showHidden':![],'depth':null}));}break;case _0x8844('0x92'):if(_0x4301dc==_0x8844('0xd3')){return _0x39d298[_0x8844('0x60')]({'read':!![]});}else{logger['error'](_0x8844('0x24'),_0x8844('0x29'),_0x8844('0x92'),util['inspect'](_0x2bc576[_0x8844('0x57')],{'showHidden':![],'depth':null}));}break;case _0x8844('0x93'):if(_0x4301dc===_0x8844('0xd4')||_0x4301dc==='ACCEPTD'){return _0x39d298[_0x8844('0x60')]({'read':!![]});}else{logger[_0x8844('0x25')](_0x8844('0x24'),_0x8844('0x29'),_0x8844('0x93'),util[_0x8844('0xce')](_0x2bc576['body'],{'showHidden':![],'depth':null}));}break;}return _0x39d298;}})['then'](respondWithResult(_0x1c10f7,null))[_0x8844('0x53')](handleError(_0x1c10f7,null));};exports[_0x8844('0xd5')]=function(_0x452e6c,_0x592198,_0x92db50){var _0x181b76,_0x51f407,_0x43be15;return db['SmsAccount'][_0x8844('0x5d')]({'where':{'id':_0x452e6c[_0x8844('0x55')]['id']}})[_0x8844('0x20')](handleEntityNotFound(_0x592198,null))[_0x8844('0x20')](function(_0x513014){if(_0x513014){_0x43be15=_0x513014;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8844('0x29'),_0x8844('0xd6'),_0x513014['type'],util['inspect'](_0x452e6c[_0x8844('0x3f')],{'showHidden':![],'depth':null}));switch(_0x513014['type']){case _0x8844('0x8f'):if(_0x452e6c[_0x8844('0x3f')][_0x8844('0xd7')]&&_0x452e6c['query'][_0x8844('0xd8')]){_0x51f407=_0x452e6c[_0x8844('0x3f')][_0x8844('0xd8')];return db['SmsMessage'][_0x8844('0x5d')]({'where':{'messageId':_0x452e6c[_0x8844('0x3f')][_0x8844('0xd7')]}});}break;}}})['then'](handleEntityNotFound(_0x592198,null))[_0x8844('0x20')](function(_0x3810f7){if(_0x3810f7){_0x181b76=_0x3810f7;switch(_0x43be15[_0x8844('0x80')]){case _0x8844('0x8f'):if(_0x51f407==='2'||_0x51f407==='6'){return _0x181b76[_0x8844('0x60')]({'read':!![]});}else{logger[_0x8844('0x25')](_0x8844('0x24'),_0x8844('0x29'),'csc',util[_0x8844('0xce')](_0x452e6c[_0x8844('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x181b76;}})['then'](respondWithResult(_0x592198,null))[_0x8844('0x53')](handleError(_0x592198,null));};exports[_0x8844('0xd9')]=function(_0x538a95,_0x3053c3,_0x23155e){return db[_0x8844('0x50')]['find']({'where':{'id':_0x538a95['params']['id']}})[_0x8844('0x20')](handleEntityNotFound(_0x3053c3,null))['then'](function(_0x4c993f){if(_0x4c993f){return _0x4c993f['addAgents'](_0x538a95[_0x8844('0x57')][_0x8844('0xda')],_[_0x8844('0x9e')](_0x538a95[_0x8844('0x57')],[_0x8844('0xda'),'id'])||{})[_0x8844('0xa2')](function(_0x49c04a){for(var _0x53b8f3=0x0;_0x53b8f3<_0x538a95[_0x8844('0x57')]['ids'][_0x8844('0x46')];_0x53b8f3+=0x1){socket[_0x8844('0xdb')](_0x8844('0xdc'),{'UserId':Number(_0x538a95[_0x8844('0x57')][_0x8844('0xda')][_0x53b8f3]),'SmsAccountId':Number(_0x538a95[_0x8844('0x55')]['id'])});}return _0x49c04a;});}})[_0x8844('0x20')](respondWithResult(_0x3053c3,null))['catch'](handleError(_0x3053c3,null));};exports[_0x8844('0xdd')]=function(_0x6d2c7f,_0x31faf4,_0x1fa69d){return db[_0x8844('0x50')][_0x8844('0x5d')]({'where':{'id':_0x6d2c7f[_0x8844('0x55')]['id']}})['then'](handleEntityNotFound(_0x31faf4,null))['then'](function(_0x455b72){if(_0x455b72){return _0x455b72[_0x8844('0xdd')](_0x6d2c7f[_0x8844('0x3f')][_0x8844('0xda')])['then'](function(){if(_[_0x8844('0xde')](_0x6d2c7f[_0x8844('0x3f')]['ids'])){for(var _0x17be91=0x0;_0x17be91<_0x6d2c7f[_0x8844('0x3f')]['ids']['length'];_0x17be91+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x6d2c7f[_0x8844('0x3f')][_0x8844('0xda')][_0x17be91]),'SmsAccountId':Number(_0x6d2c7f[_0x8844('0x55')]['id'])});}}else{socket[_0x8844('0xdb')](_0x8844('0xdf'),{'UserId':Number(_0x6d2c7f[_0x8844('0x3f')][_0x8844('0xda')]),'SmsAccountId':Number(_0x6d2c7f[_0x8844('0x55')]['id'])});}});}})[_0x8844('0x20')](respondWithStatusCode(_0x31faf4,null))['catch'](handleError(_0x31faf4,null));};exports[_0x8844('0xe0')]=function(_0x1a5aa5,_0x37594d,_0x99c2c1){var _0x397669={};var _0x482d6d={};var _0x5a0379;var _0x50c75a;return db['SmsAccount'][_0x8844('0x65')]({'where':{'id':_0x1a5aa5[_0x8844('0x55')]['id']}})[_0x8844('0x20')](handleEntityNotFound(_0x37594d,null))[_0x8844('0x20')](function(_0x21e19e){if(_0x21e19e){_0x5a0379=_0x21e19e;_0x482d6d['model']=_[_0x8844('0x40')](db[_0x8844('0xa9')][_0x8844('0x3c')]);_0x482d6d['query']=_[_0x8844('0x40')](_0x1a5aa5[_0x8844('0x3f')]);_0x482d6d[_0x8844('0x41')]=_['intersection'](_0x482d6d[_0x8844('0x43')],_0x482d6d[_0x8844('0x3f')]);_0x397669[_0x8844('0x45')]=_['intersection'](_0x482d6d['model'],qs[_0x8844('0x44')](_0x1a5aa5[_0x8844('0x3f')][_0x8844('0x44')]));_0x397669[_0x8844('0x45')]=_0x397669[_0x8844('0x45')][_0x8844('0x46')]?_0x397669[_0x8844('0x45')]:_0x482d6d[_0x8844('0x43')];_0x397669[_0x8844('0x49')]=qs[_0x8844('0x4a')](_0x1a5aa5['query']['sort']);_0x397669[_0x8844('0x4d')]=qs[_0x8844('0x41')](_['pick'](_0x1a5aa5['query'],_0x482d6d[_0x8844('0x41')]));if(_0x1a5aa5[_0x8844('0x3f')][_0x8844('0x4c')]){_0x397669['where']=_['merge'](_0x397669[_0x8844('0x4d')],{'$or':_['map'](_0x397669['attributes'],function(_0xcebaf7){var _0x36971e={};_0x36971e[_0xcebaf7]={'$like':'%'+_0x1a5aa5['query'][_0x8844('0x4c')]+'%'};return _0x36971e;})});}_0x397669=_['merge']({},_0x397669,_0x1a5aa5[_0x8844('0x67')]);return _0x5a0379[_0x8844('0xe0')](_0x397669);}})[_0x8844('0x20')](function(_0x35a8d2){if(_0x35a8d2){_0x50c75a=_0x35a8d2[_0x8844('0x46')];if(!_0x1a5aa5['query'][_0x8844('0x47')]('nolimit')){_0x397669[_0x8844('0x2e')]=qs[_0x8844('0x2e')](_0x1a5aa5[_0x8844('0x3f')]['limit']);_0x397669['offset']=qs[_0x8844('0x2b')](_0x1a5aa5[_0x8844('0x3f')][_0x8844('0x2b')]);}return _0x5a0379[_0x8844('0xe0')](_0x397669);}})['then'](function(_0xbed4cb){if(_0xbed4cb){return _0xbed4cb?{'count':_0x50c75a,'rows':_0xbed4cb}:null;}})['then'](respondWithResult(_0x37594d,null))['catch'](handleError(_0x37594d,null));}; \ No newline at end of file +var _0xe46f=['getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','SmsMessage','dataValues','Messages','push','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','bandwidth','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','get','UserProfileResource','stack','name','send','index','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','Pause','mandatoryDispositionPause','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','pick','removeDispositions','ids','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','applications','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','messageId','MessageSid','skebby','sender','text','connectel','clicksend','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','CmList','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','*,*,*,*','ContactId','UserId','User','agent','Start','startRouting','entity\x20found','text/xml','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications'];(function(_0x5d6482,_0x1c9b00){var _0x32e681=function(_0x398459){while(--_0x398459){_0x5d6482['push'](_0x5d6482['shift']());}};_0x32e681(++_0x1c9b00);}(_0xe46f,0x1ef));var _0xfe46=function(_0x5cf53d,_0x29d8be){_0x5cf53d=_0x5cf53d-0x0;var _0x2c5588=_0xe46f[_0x5cf53d];return _0x2c5588;};'use strict';var emlformat=require(_0xfe46('0x0'));var rimraf=require(_0xfe46('0x1'));var zipdir=require(_0xfe46('0x2'));var jsonpatch=require(_0xfe46('0x3'));var rp=require('request-promise');var moment=require(_0xfe46('0x4'));var BPromise=require(_0xfe46('0x5'));var Mustache=require(_0xfe46('0x6'));var util=require('util');var path=require(_0xfe46('0x7'));var sox=require(_0xfe46('0x8'));var csv=require(_0xfe46('0x9'));var ejs=require(_0xfe46('0xa'));var fs=require('fs');var fs_extra=require(_0xfe46('0xb'));var _=require(_0xfe46('0xc'));var squel=require('squel');var crypto=require(_0xfe46('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfe46('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfe46('0xf'));var Papa=require(_0xfe46('0x10'));var Redis=require(_0xfe46('0x11'));var authService=require(_0xfe46('0x12'));var qs=require(_0xfe46('0x13'));var as=require(_0xfe46('0x14'));var hardwareService=require(_0xfe46('0x15'));var logger=require(_0xfe46('0x16'))(_0xfe46('0x17'));var utils=require('../../config/utils');var config=require(_0xfe46('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe46('0x19'))['db'];config['redis']=_['defaults'](config[_0xfe46('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xfe46('0x1b'))(new Redis(config['redis']));require(_0xfe46('0x1c'))[_0xfe46('0x1d')](socket);var jayson=require(_0xfe46('0x1e'));var client=jayson[_0xfe46('0x1f')][_0xfe46('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x3b1619,_0x4ee674,_0x43855d,_0x1e429a){return new BPromise(function(_0x99bb9c,_0x1f7bca){var _0x351086=_0x1e429a||client;return _0x351086[_0xfe46('0x21')](_0x3b1619,_0x43855d)[_0xfe46('0x22')](function(_0x3ba57d){logger[_0xfe46('0x23')](_0xfe46('0x24'),_0x4ee674,'request\x20sent');logger[_0xfe46('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4ee674,_0xfe46('0x26'),JSON[_0xfe46('0x27')](_0x3ba57d));if(_0x3ba57d['error']){if(_0x3ba57d['error'][_0xfe46('0x28')]===0x1f4){logger[_0xfe46('0x29')](_0xfe46('0x24'),_0x4ee674,_0x3ba57d[_0xfe46('0x29')][_0xfe46('0x2a')]);return _0x1f7bca(_0x3ba57d['error'][_0xfe46('0x2a')]);}logger[_0xfe46('0x29')]('SmsAccount,\x20%s,\x20%s',_0x4ee674,_0x3ba57d[_0xfe46('0x29')][_0xfe46('0x2a')]);return _0x99bb9c(_0x3ba57d['error']['message']);}else{logger[_0xfe46('0x23')]('SmsAccount,\x20%s,\x20%s',_0x4ee674,_0xfe46('0x26'));_0x99bb9c(_0x3ba57d[_0xfe46('0x2b')][_0xfe46('0x2a')]);}})['catch'](function(_0x1d0426){logger[_0xfe46('0x29')](_0xfe46('0x24'),_0x4ee674,_0x1d0426);_0x1f7bca(_0x1d0426);});});}function respondWithStatusCode(_0x1cea28,_0x5e72a9){_0x5e72a9=_0x5e72a9||0xcc;return function(_0x1cbfd6){if(_0x1cbfd6){return _0x1cea28[_0xfe46('0x2c')](_0x5e72a9);}return _0x1cea28[_0xfe46('0x2d')](_0x5e72a9)[_0xfe46('0x2e')]();};}function respondWithResult(_0xd96ea8,_0x1ce349){_0x1ce349=_0x1ce349||0xc8;return function(_0x456114){if(_0x456114){return _0xd96ea8['status'](_0x1ce349)[_0xfe46('0x2f')](_0x456114);}};}function respondWithFilteredResult(_0x4b5bd8,_0x170496){return function(_0x275e81){if(_0x275e81){var _0x4687a0=typeof _0x170496['offset']===_0xfe46('0x30')&&typeof _0x170496[_0xfe46('0x31')]===_0xfe46('0x30');var _0x68d463=_0x275e81[_0xfe46('0x32')];var _0xcec902=_0x4687a0?0x0:_0x170496[_0xfe46('0x33')];var _0x534552=_0x4687a0?_0x275e81[_0xfe46('0x32')]:_0x170496[_0xfe46('0x33')]+_0x170496[_0xfe46('0x31')];var _0x56a643;if(_0x534552>=_0x68d463){_0x534552=_0x68d463;_0x56a643=0xc8;}else{_0x56a643=0xce;}_0x4b5bd8[_0xfe46('0x2d')](_0x56a643);return _0x4b5bd8[_0xfe46('0x34')](_0xfe46('0x35'),_0xcec902+'-'+_0x534552+'/'+_0x68d463)[_0xfe46('0x2f')](_0x275e81);}return null;};}function patchUpdates(_0x5ca163){return function(_0x135482){try{jsonpatch['apply'](_0x135482,_0x5ca163,!![]);}catch(_0x13a91d){return BPromise[_0xfe46('0x36')](_0x13a91d);}return _0x135482[_0xfe46('0x37')]();};}function saveUpdates(_0x1c02c7,_0x2a08e1){return function(_0x308257){if(_0x308257){return _0x308257[_0xfe46('0x38')](_0x1c02c7)[_0xfe46('0x22')](function(_0x64a269){return _0x64a269;});}return null;};}function removeEntity(_0x34473d,_0x1a5d2a){return function(_0x2e7afb){if(_0x2e7afb){return _0x2e7afb['destroy']()[_0xfe46('0x22')](function(){var _0x47970a=_0x2e7afb[_0xfe46('0x39')]({'plain':!![]});var _0x2907ac='SmsAccounts';return db[_0xfe46('0x3a')]['destroy']({'where':{'type':_0x2907ac,'resourceId':_0x47970a['id']}})[_0xfe46('0x22')](function(){return _0x2e7afb;});})['then'](function(){_0x34473d[_0xfe46('0x2d')](0xcc)[_0xfe46('0x2e')]();});}};}function handleEntityNotFound(_0x1c0030,_0x209de8){return function(_0x358ffa){if(!_0x358ffa){_0x1c0030[_0xfe46('0x2c')](0x194);}return _0x358ffa;};}function handleError(_0x214ec5,_0x51c67f){_0x51c67f=_0x51c67f||0x1f4;return function(_0x5869d4){logger[_0xfe46('0x29')](_0x5869d4[_0xfe46('0x3b')]);if(_0x5869d4[_0xfe46('0x3c')]){delete _0x5869d4[_0xfe46('0x3c')];}_0x214ec5[_0xfe46('0x2d')](_0x51c67f)[_0xfe46('0x3d')](_0x5869d4);};}exports[_0xfe46('0x3e')]=function(_0x58cc6b,_0x28244f){var _0x29d351={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4da55f={},_0x5b4243={'count':0x0,'rows':[]};var _0x4a71ea=_[_0xfe46('0x3f')](db[_0xfe46('0x40')][_0xfe46('0x41')],function(_0x2395b2){return{'name':_0x2395b2['fieldName'],'type':_0x2395b2[_0xfe46('0x42')][_0xfe46('0x43')]};});_0x4da55f[_0xfe46('0x44')]=_[_0xfe46('0x3f')](_0x4a71ea,_0xfe46('0x3c'));_0x4da55f[_0xfe46('0x45')]=_[_0xfe46('0x46')](_0x58cc6b['query']);_0x4da55f[_0xfe46('0x47')]=_[_0xfe46('0x48')](_0x4da55f[_0xfe46('0x44')],_0x4da55f['query']);_0x29d351[_0xfe46('0x49')]=_[_0xfe46('0x48')](_0x4da55f[_0xfe46('0x44')],qs[_0xfe46('0x4a')](_0x58cc6b['query']['fields']));_0x29d351['attributes']=_0x29d351[_0xfe46('0x49')][_0xfe46('0x4b')]?_0x29d351[_0xfe46('0x49')]:_0x4da55f[_0xfe46('0x44')];if(!_0x58cc6b[_0xfe46('0x45')][_0xfe46('0x4c')](_0xfe46('0x4d'))){_0x29d351[_0xfe46('0x31')]=qs[_0xfe46('0x31')](_0x58cc6b[_0xfe46('0x45')][_0xfe46('0x31')]);_0x29d351['offset']=qs[_0xfe46('0x33')](_0x58cc6b['query'][_0xfe46('0x33')]);}_0x29d351[_0xfe46('0x4e')]=qs[_0xfe46('0x4f')](_0x58cc6b[_0xfe46('0x45')][_0xfe46('0x4f')]);_0x29d351['where']=qs['filters'](_['pick'](_0x58cc6b['query'],_0x4da55f[_0xfe46('0x47')]),_0x4a71ea);if(_0x58cc6b[_0xfe46('0x45')][_0xfe46('0x50')]){_0x29d351[_0xfe46('0x51')]=_['merge'](_0x29d351[_0xfe46('0x51')],{'$or':_[_0xfe46('0x3f')](_0x4a71ea,function(_0x47f461){if(_0x47f461[_0xfe46('0x42')]!==_0xfe46('0x52')){var _0x425cf3={};_0x425cf3[_0x47f461[_0xfe46('0x3c')]]={'$like':'%'+_0x58cc6b[_0xfe46('0x45')][_0xfe46('0x50')]+'%'};return _0x425cf3;}})});}_0x29d351=_[_0xfe46('0x53')]({},_0x29d351,_0x58cc6b[_0xfe46('0x54')]);var _0x369e61={'where':_0x29d351[_0xfe46('0x51')]};return db[_0xfe46('0x40')][_0xfe46('0x32')](_0x369e61)[_0xfe46('0x22')](function(_0x35516f){_0x5b4243['count']=_0x35516f;if(_0x58cc6b['query']['includeAll']){_0x29d351[_0xfe46('0x55')]=[{'all':!![]}];}return db[_0xfe46('0x40')][_0xfe46('0x56')](_0x29d351);})[_0xfe46('0x22')](function(_0x66e1c9){_0x5b4243[_0xfe46('0x57')]=_0x66e1c9;return _0x5b4243;})[_0xfe46('0x22')](respondWithFilteredResult(_0x28244f,_0x29d351))[_0xfe46('0x58')](handleError(_0x28244f,null));};exports[_0xfe46('0x59')]=function(_0x25d8cc,_0x208a92){var _0x329b7e={'raw':![],'where':{'id':_0x25d8cc[_0xfe46('0x5a')]['id']},'include':[{'model':db[_0xfe46('0x5b')],'as':_0xfe46('0x5c')}]},_0x3a05aa={};_0x3a05aa[_0xfe46('0x44')]=_[_0xfe46('0x46')](db[_0xfe46('0x40')]['rawAttributes']);_0x3a05aa[_0xfe46('0x45')]=_['keys'](_0x25d8cc[_0xfe46('0x45')]);_0x3a05aa[_0xfe46('0x47')]=_[_0xfe46('0x48')](_0x3a05aa[_0xfe46('0x44')],_0x3a05aa[_0xfe46('0x45')]);_0x329b7e[_0xfe46('0x49')]=_[_0xfe46('0x48')](_0x3a05aa['model'],qs[_0xfe46('0x4a')](_0x25d8cc[_0xfe46('0x45')][_0xfe46('0x4a')]));_0x329b7e[_0xfe46('0x49')]=_0x329b7e[_0xfe46('0x49')]['length']?_0x329b7e[_0xfe46('0x49')]:_0x3a05aa['model'];if(_0x25d8cc[_0xfe46('0x45')][_0xfe46('0x5d')]){_0x329b7e[_0xfe46('0x55')]=[{'all':!![]}];}_0x329b7e=_[_0xfe46('0x53')]({},_0x329b7e,_0x25d8cc[_0xfe46('0x54')]);return db['SmsAccount']['find'](_0x329b7e)['then'](handleEntityNotFound(_0x208a92,null))[_0xfe46('0x22')](respondWithResult(_0x208a92,null))['catch'](handleError(_0x208a92,null));};exports[_0xfe46('0x5e')]=function(_0x59b633,_0x2f97cd){return db[_0xfe46('0x40')]['create'](_0x59b633[_0xfe46('0x5f')],{})[_0xfe46('0x22')](function(_0x1ec74a){var _0x5638cb=_0x59b633[_0xfe46('0x60')][_0xfe46('0x39')]({'plain':!![]});if(!_0x5638cb)throw new Error(_0xfe46('0x61'));if(_0x5638cb[_0xfe46('0x62')]===_0xfe46('0x60')){var _0x5489b6=_0x1ec74a[_0xfe46('0x39')]({'plain':!![]});var _0x15d279='SmsAccounts';return db[_0xfe46('0x63')][_0xfe46('0x64')]({'where':{'name':_0x15d279,'userProfileId':_0x5638cb[_0xfe46('0x65')]},'raw':!![]})['then'](function(_0x1f271a){if(_0x1f271a&&_0x1f271a[_0xfe46('0x66')]===0x0){return db[_0xfe46('0x3a')][_0xfe46('0x5e')]({'name':_0x5489b6[_0xfe46('0x3c')],'resourceId':_0x5489b6['id'],'type':_0x1f271a[_0xfe46('0x3c')],'sectionId':_0x1f271a['id']},{})[_0xfe46('0x22')](function(){return _0x1ec74a;});}else{return _0x1ec74a;}})[_0xfe46('0x58')](function(_0x382b30){logger['error'](_0xfe46('0x67'),_0x382b30);throw _0x382b30;});}return _0x1ec74a;})[_0xfe46('0x22')](respondWithResult(_0x2f97cd,0xc9))[_0xfe46('0x58')](handleError(_0x2f97cd,null));};exports[_0xfe46('0x38')]=function(_0x3062d1,_0x228a5a){if(_0x3062d1[_0xfe46('0x5f')]['id']){delete _0x3062d1['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x3062d1['params']['id']},'include':[{'model':db[_0xfe46('0x5b')],'as':_0xfe46('0x5c')}]})[_0xfe46('0x22')](handleEntityNotFound(_0x228a5a,null))[_0xfe46('0x22')](saveUpdates(_0x3062d1[_0xfe46('0x5f')],null))['then'](respondWithResult(_0x228a5a,null))[_0xfe46('0x58')](handleError(_0x228a5a,null));};exports['destroy']=function(_0x2702c4,_0x32efe0){return db[_0xfe46('0x40')][_0xfe46('0x64')]({'where':{'id':_0x2702c4[_0xfe46('0x5a')]['id']}})['then'](handleEntityNotFound(_0x32efe0,null))[_0xfe46('0x22')](removeEntity(_0x32efe0,null))['catch'](handleError(_0x32efe0,null));};exports[_0xfe46('0x68')]=function(_0x6ff21,_0x4b2a07){return db[_0xfe46('0x40')]['describe']()['then'](respondWithResult(_0x4b2a07,null))[_0xfe46('0x58')](handleError(_0x4b2a07,null));};exports[_0xfe46('0x69')]=function(_0x4da228,_0x2e3284,_0x5cc0f0){if(_0x4da228[_0xfe46('0x5f')]['id']){delete _0x4da228['body']['id'];}return db[_0xfe46('0x40')][_0xfe46('0x64')]({'where':{'id':_0x4da228['params']['id']}})['then'](handleEntityNotFound(_0x2e3284,null))[_0xfe46('0x22')](function(_0x363ad1){if(_0x363ad1){_0x4da228[_0xfe46('0x5f')][_0xfe46('0x6a')]=_0x363ad1['id'];return db[_0xfe46('0x6b')]['create'](_0x4da228['body']);}})[_0xfe46('0x22')](respondWithResult(_0x2e3284,null))['catch'](handleError(_0x2e3284,null));};exports[_0xfe46('0x6c')]=function(_0xbb7492,_0x354cc5,_0x59e3e3){var _0x106463={'raw':![],'where':{}};var _0x46f6ec={};var _0x2f344d={'count':0x0,'rows':[]};return db[_0xfe46('0x40')]['findOne']({'where':{'id':_0xbb7492[_0xfe46('0x5a')]['id']}})[_0xfe46('0x22')](handleEntityNotFound(_0x354cc5,null))[_0xfe46('0x22')](function(_0x3d1c23){if(_0x3d1c23){_0x46f6ec[_0xfe46('0x44')]=_[_0xfe46('0x46')](db['Disposition'][_0xfe46('0x41')]);_0x46f6ec[_0xfe46('0x45')]=_[_0xfe46('0x46')](_0xbb7492[_0xfe46('0x45')]);_0x46f6ec[_0xfe46('0x47')]=_['intersection'](_0x46f6ec[_0xfe46('0x44')],_0x46f6ec[_0xfe46('0x45')]);_0x106463[_0xfe46('0x49')]=_[_0xfe46('0x48')](_0x46f6ec['model'],qs[_0xfe46('0x4a')](_0xbb7492['query'][_0xfe46('0x4a')]));_0x106463[_0xfe46('0x49')]=_0x106463['attributes'][_0xfe46('0x4b')]?_0x106463['attributes']:_0x46f6ec[_0xfe46('0x44')];if(!_0xbb7492[_0xfe46('0x45')][_0xfe46('0x4c')]('nolimit')){_0x106463[_0xfe46('0x31')]=qs['limit'](_0xbb7492[_0xfe46('0x45')][_0xfe46('0x31')]);_0x106463[_0xfe46('0x33')]=qs['offset'](_0xbb7492[_0xfe46('0x45')][_0xfe46('0x33')]);}_0x106463[_0xfe46('0x4e')]=qs['sort'](_0xbb7492[_0xfe46('0x45')][_0xfe46('0x4f')]);_0x106463[_0xfe46('0x51')]=qs[_0xfe46('0x47')](_[_0xfe46('0x6d')](_0xbb7492[_0xfe46('0x45')],_0x46f6ec[_0xfe46('0x47')]));_0x106463[_0xfe46('0x51')][_0xfe46('0x6a')]=_0x3d1c23['id'];if(_0xbb7492[_0xfe46('0x45')]['filter']){_0x106463[_0xfe46('0x51')]=_[_0xfe46('0x53')](_0x106463[_0xfe46('0x51')],{'$or':_[_0xfe46('0x3f')](_0x106463[_0xfe46('0x49')],function(_0x459b5a){var _0x561d44={};_0x561d44[_0x459b5a]={'$like':'%'+_0xbb7492[_0xfe46('0x45')][_0xfe46('0x50')]+'%'};return _0x561d44;})});}_0x106463=_[_0xfe46('0x53')]({},_0x106463,_0xbb7492['options']);return db[_0xfe46('0x6b')][_0xfe46('0x32')]({'where':_0x106463[_0xfe46('0x51')]})['then'](function(_0x200c89){_0x2f344d[_0xfe46('0x32')]=_0x200c89;if(_0xbb7492[_0xfe46('0x45')][_0xfe46('0x5d')]){_0x106463[_0xfe46('0x55')]=[{'all':!![]}];}return db[_0xfe46('0x6b')][_0xfe46('0x56')](_0x106463);})[_0xfe46('0x22')](function(_0x21b2f5){_0x2f344d[_0xfe46('0x57')]=_0x21b2f5;return _0x2f344d;});}})[_0xfe46('0x22')](respondWithFilteredResult(_0x354cc5,_0x106463))[_0xfe46('0x58')](handleError(_0x354cc5,null));};exports[_0xfe46('0x6e')]=function(_0x668494,_0x12dc7b,_0xe6b418){return db[_0xfe46('0x40')][_0xfe46('0x64')]({'where':{'id':_0x668494['params']['id']}})[_0xfe46('0x22')](handleEntityNotFound(_0x12dc7b,null))[_0xfe46('0x22')](function(_0x43a7c0){if(_0x43a7c0){return _0x43a7c0['removeDispositions'](_0x668494[_0xfe46('0x45')][_0xfe46('0x6f')]);}})[_0xfe46('0x22')](respondWithStatusCode(_0x12dc7b,null))[_0xfe46('0x58')](handleError(_0x12dc7b,null));};exports['addAnswer']=function(_0x2cad61,_0x3e3807,_0x217546){if(_0x2cad61[_0xfe46('0x5f')]['id']){delete _0x2cad61[_0xfe46('0x5f')]['id'];}return db['SmsAccount'][_0xfe46('0x64')]({'where':{'id':_0x2cad61['params']['id']}})[_0xfe46('0x22')](handleEntityNotFound(_0x3e3807,null))[_0xfe46('0x22')](function(_0x3df8a0){if(_0x3df8a0){_0x2cad61[_0xfe46('0x5f')][_0xfe46('0x6a')]=_0x3df8a0['id'];return db[_0xfe46('0x70')]['create'](_0x2cad61[_0xfe46('0x5f')]);}})['then'](respondWithResult(_0x3e3807,null))[_0xfe46('0x58')](handleError(_0x3e3807,null));};exports['getAnswers']=function(_0x295dbc,_0x5aa105,_0xb9c06a){var _0x7226e1={'raw':![],'where':{}};var _0x31e807={};var _0x289434={'count':0x0,'rows':[]};return db[_0xfe46('0x40')][_0xfe46('0x71')]({'where':{'id':_0x295dbc['params']['id']}})['then'](handleEntityNotFound(_0x5aa105,null))['then'](function(_0x38bff4){if(_0x38bff4){_0x31e807[_0xfe46('0x44')]=_[_0xfe46('0x46')](db[_0xfe46('0x70')]['rawAttributes']);_0x31e807[_0xfe46('0x45')]=_['keys'](_0x295dbc[_0xfe46('0x45')]);_0x31e807[_0xfe46('0x47')]=_[_0xfe46('0x48')](_0x31e807['model'],_0x31e807[_0xfe46('0x45')]);_0x7226e1[_0xfe46('0x49')]=_[_0xfe46('0x48')](_0x31e807['model'],qs['fields'](_0x295dbc[_0xfe46('0x45')]['fields']));_0x7226e1[_0xfe46('0x49')]=_0x7226e1[_0xfe46('0x49')][_0xfe46('0x4b')]?_0x7226e1[_0xfe46('0x49')]:_0x31e807['model'];if(!_0x295dbc[_0xfe46('0x45')]['hasOwnProperty'](_0xfe46('0x4d'))){_0x7226e1[_0xfe46('0x31')]=qs[_0xfe46('0x31')](_0x295dbc[_0xfe46('0x45')][_0xfe46('0x31')]);_0x7226e1[_0xfe46('0x33')]=qs[_0xfe46('0x33')](_0x295dbc['query'][_0xfe46('0x33')]);}_0x7226e1[_0xfe46('0x4e')]=qs[_0xfe46('0x4f')](_0x295dbc['query']['sort']);_0x7226e1[_0xfe46('0x51')]=qs[_0xfe46('0x47')](_['pick'](_0x295dbc[_0xfe46('0x45')],_0x31e807[_0xfe46('0x47')]));_0x7226e1['where'][_0xfe46('0x6a')]=_0x38bff4['id'];if(_0x295dbc[_0xfe46('0x45')][_0xfe46('0x50')]){_0x7226e1[_0xfe46('0x51')]=_['merge'](_0x7226e1[_0xfe46('0x51')],{'$or':_['map'](_0x7226e1[_0xfe46('0x49')],function(_0x3c8e2c){var _0x4a026a={};_0x4a026a[_0x3c8e2c]={'$like':'%'+_0x295dbc[_0xfe46('0x45')][_0xfe46('0x50')]+'%'};return _0x4a026a;})});}_0x7226e1=_[_0xfe46('0x53')]({},_0x7226e1,_0x295dbc['options']);return db[_0xfe46('0x70')][_0xfe46('0x32')]({'where':_0x7226e1[_0xfe46('0x51')]})[_0xfe46('0x22')](function(_0x470ac3){_0x289434[_0xfe46('0x32')]=_0x470ac3;if(_0x295dbc[_0xfe46('0x45')][_0xfe46('0x5d')]){_0x7226e1[_0xfe46('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xfe46('0x56')](_0x7226e1);})[_0xfe46('0x22')](function(_0x2f0d54){_0x289434['rows']=_0x2f0d54;return _0x289434;});}})[_0xfe46('0x22')](respondWithFilteredResult(_0x5aa105,_0x7226e1))[_0xfe46('0x58')](handleError(_0x5aa105,null));};exports[_0xfe46('0x72')]=function(_0x4e63ab,_0x2e0f5f,_0x175c87){return db[_0xfe46('0x40')][_0xfe46('0x64')]({'where':{'id':_0x4e63ab[_0xfe46('0x5a')]['id']}})[_0xfe46('0x22')](handleEntityNotFound(_0x2e0f5f,null))['then'](function(_0xb6eac6){if(_0xb6eac6){return _0xb6eac6[_0xfe46('0x72')](_0x4e63ab[_0xfe46('0x45')][_0xfe46('0x6f')]);}})['then'](respondWithStatusCode(_0x2e0f5f,null))[_0xfe46('0x58')](handleError(_0x2e0f5f,null));};exports[_0xfe46('0x73')]=function(_0x260647,_0x5dea97,_0x2357e){var _0x542a2a={'channel':'sms'};var _0x186f53=[];var _0x1923b2=[];var _0x23ee44={};return db[_0xfe46('0x40')][_0xfe46('0x64')]({'where':{'id':_0x260647['params']['id']},'include':[{'model':db[_0xfe46('0x74')],'as':_0xfe46('0x75')}]})[_0xfe46('0x22')](handleEntityNotFound(_0x5dea97,null))['then'](function(_0x424b6d){_0x542a2a[_0xfe46('0x76')]=_0x424b6d;_0x542a2a[_0xfe46('0x77')]=_['orderBy'](_0x424b6d[_0xfe46('0x75')],[_0xfe46('0x78')],['asc']);if(_0x542a2a[_0xfe46('0x76')][_0xfe46('0x75')]){delete _0x542a2a[_0xfe46('0x76')][_0xfe46('0x75')];}return db[_0xfe46('0x79')][_0xfe46('0x68')]();})[_0xfe46('0x22')](function(_0x480884){if(!_0x480884){throw new db[(_0xfe46('0x7a'))][(_0xfe46('0x7b'))](_0xfe46('0x7c'));}_0x186f53=_['difference'](_[_0xfe46('0x46')](_0x480884),[_0xfe46('0x7d'),_0xfe46('0x7e')]);_0x1923b2=_[_0xfe46('0x7f')](_[_0xfe46('0x46')](_0x480884),[_0xfe46('0x7d'),_0xfe46('0x7e'),_0xfe46('0x80'),_0xfe46('0x81')]);_0x542a2a[_0xfe46('0x5f')]={'mapKey':_0xfe46('0x82')};if(_0x542a2a[_0xfe46('0x76')][_0xfe46('0x42')]){switch(_0x542a2a[_0xfe46('0x76')][_0xfe46('0x42')]){case _0xfe46('0x83'):_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x84')]=_0x260647['body']['From'];_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x5f')]=_0x260647[_0xfe46('0x5f')]['Body'];_0x542a2a['body'][_0xfe46('0x85')]=_0x260647[_0xfe46('0x5f')][_0xfe46('0x86')];break;case _0xfe46('0x87'):_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x84')]='+'+_0x260647[_0xfe46('0x5f')][_0xfe46('0x88')];_0x542a2a['body']['body']=_0x260647[_0xfe46('0x5f')][_0xfe46('0x89')];break;case _0xfe46('0x8a'):_0x542a2a[_0xfe46('0x5f')]['from']=_0x260647[_0xfe46('0x5f')][_0xfe46('0x84')];_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x5f')]=_0x260647['body']['message'];break;case _0xfe46('0x8b'):_0x542a2a['body']['from']=_0x260647[_0xfe46('0x5f')][_0xfe46('0x84')];_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x5f')]=_0x260647[_0xfe46('0x5f')]['body'];_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x85')]=_0x260647[_0xfe46('0x5f')]['message_id'];break;case'plivo':_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x84')]=_0x260647['body']['From'];_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x5f')]=_0x260647['body'][_0xfe46('0x8c')];_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x85')]=_0x260647['body'][_0xfe46('0x8d')];break;case _0xfe46('0x8e'):_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x84')]='+'+_0x260647['body'][_0xfe46('0x8f')][0x0][_0xfe46('0x84')];_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x5f')]=_0x260647[_0xfe46('0x5f')]['results'][0x0][_0xfe46('0x89')];_0x542a2a['body'][_0xfe46('0x85')]=_0x260647[_0xfe46('0x5f')][_0xfe46('0x8f')][0x0][_0xfe46('0x85')];break;case _0xfe46('0x90'):_0x542a2a[_0xfe46('0x5f')]['from']=_0x260647[_0xfe46('0x5f')]['originatingAddress'];_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x5f')]=_0x260647[_0xfe46('0x5f')][_0xfe46('0x91')][_0xfe46('0x2a')];break;case _0xfe46('0x92'):_0x542a2a['body'][_0xfe46('0x84')]=_0x260647[_0xfe46('0x5f')][_0xfe46('0x93')];_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x5f')]=_0x260647['body']['text'];_0x542a2a['body'][_0xfe46('0x85')]=_0x260647[_0xfe46('0x5f')][_0xfe46('0x94')];break;case'bandwidth':_0x542a2a['body']['messageId']=_0x260647[_0xfe46('0x5f')][0x0]['message']['id'];_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x84')]=_0x260647['body'][0x0][_0xfe46('0x2a')][_0xfe46('0x84')];_0x542a2a[_0xfe46('0x5f')]['body']=_0x260647[_0xfe46('0x5f')][0x0][_0xfe46('0x2a')]['text'];break;case'intelepeer':_0x542a2a['body'][_0xfe46('0x84')]=_0x260647[_0xfe46('0x5f')][_0xfe46('0x84')];_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x5f')]=_0x260647[_0xfe46('0x5f')][_0xfe46('0x2a')];_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x85')]=_0x260647['body'][_0xfe46('0x95')];break;}}if(_0x542a2a[_0xfe46('0x5f')]['id']){delete _0x542a2a[_0xfe46('0x5f')]['id'];}if(_[_0xfe46('0x96')](_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x84')])){throw new db[(_0xfe46('0x7a'))][(_0xfe46('0x7b'))](_0xfe46('0x97'));}if(_[_0xfe46('0x96')](_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x5f')])||_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x5f')]===''){throw new db[(_0xfe46('0x7a'))][(_0xfe46('0x7b'))](_0xfe46('0x98'));}if(_[_0xfe46('0x96')](_0x542a2a[_0xfe46('0x5f')]['mapKey'])){throw new db[(_0xfe46('0x7a'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1923b2);}if(!_[_0xfe46('0x99')](_0x1923b2,_0x542a2a[_0xfe46('0x5f')]['mapKey'])){throw new db[(_0xfe46('0x7a'))][(_0xfe46('0x7b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1923b2);}_0x23ee44[_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x9a')]]=_0x542a2a[_0xfe46('0x5f')]['from'];return db[_0xfe46('0x9b')][_0xfe46('0x64')]({'where':{'id':_0x542a2a['account'][_0xfe46('0x81')]},'include':[{'model':db[_0xfe46('0x79')],'as':_0xfe46('0x9c'),'where':_0x23ee44,'limit':0x1,'order':[['updatedAt',_0xfe46('0x9d')]]}]});})[_0xfe46('0x22')](handleEntityNotFound(_0x5dea97,null))[_0xfe46('0x22')](function(_0x10aad7){if(_0x10aad7){_0x542a2a[_0xfe46('0x9e')]=_[_0xfe46('0x9f')](_0x10aad7,[_0xfe46('0x9c')]);if(_0x10aad7['Contacts'][_0xfe46('0x4b')]){return _0x10aad7[_0xfe46('0x9c')][0x0];}var _0x5dfcf1=_[_0xfe46('0xa0')](_0x542a2a[_0xfe46('0x5f')],{'firstName':_0x542a2a['body'][_0xfe46('0x84')],'ListId':_0x10aad7['id']});_0x5dfcf1[_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x9a')]]=_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x84')];return db[_0xfe46('0x79')][_0xfe46('0x5e')](_0x5dfcf1,{'fields':_0x186f53,'raw':!![]});}})['then'](handleEntityNotFound(_0x5dea97,null))[_0xfe46('0x22')](function(_0x491c8c){if(_0x491c8c){_0x542a2a[_0xfe46('0xa1')]=_0x491c8c;var _0x63088={'ContactId':_0x491c8c['id'],'phone':_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x84')],'SmsAccountId':_0x260647[_0xfe46('0x5a')]['id']};var _0x1ad04d={'ContactId':_0x491c8c['id'],'SmsAccountId':_0x260647[_0xfe46('0x5a')]['id'],'closed':![]};return db[_0xfe46('0xa2')][_0xfe46('0x64')]({'where':_0x1ad04d})['then'](function(_0x1e3c9c){if(_0x1e3c9c){return[_0x1e3c9c,![]];}return db[_0xfe46('0xa2')][_0xfe46('0x5e')](_0x63088)[_0xfe46('0x22')](function(_0x37c0d5){return[_0x37c0d5,!![]];});});}})[_0xfe46('0xa3')](function(_0x13165c,_0x548bbb){_0x542a2a[_0xfe46('0xa4')]=_0x13165c[_0xfe46('0x39')]({'plain':!![]});_0x542a2a[_0xfe46('0xa4')][_0xfe46('0xa5')]=![];if(_0x548bbb){if(_0x542a2a[_0xfe46('0x76')][_0xfe46('0xa6')]){_0x542a2a['applications']['push']({'id':0x0,'priority':_0x542a2a['applications'][_0xfe46('0x4b')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xfe46('0xa7')});}_0x542a2a[_0xfe46('0xa4')][_0xfe46('0xa5')]=!![];}return db['SmsMessage'][_0xfe46('0x5e')]({'phone':_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x84')],'messageId':_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x85')],'body':_0x542a2a[_0xfe46('0x5f')][_0xfe46('0x5f')],'SmsAccountId':_0x260647[_0xfe46('0x5a')]['id'],'SmsInteractionId':_0x13165c['id'],'direction':'in','ContactId':_0x13165c[_0xfe46('0xa8')],'AttachmentId':_0x542a2a[_0xfe46('0x5f')]['AttachmentId']});})[_0xfe46('0x22')](function(_0x19e104){_0x542a2a['message']=_0x19e104;if(_0x542a2a[_0xfe46('0xa4')][_0xfe46('0xa9')]){return db[_0xfe46('0xaa')][_0xfe46('0x64')]({'attributes':['id',_0xfe46('0x3c')],'where':{'id':_0x542a2a['interaction'][_0xfe46('0xa9')]}})['then'](function(_0x1645ee){if(_0x1645ee){_0x542a2a[_0xfe46('0x77')]['unshift']({'id':0x0,'priority':0x0,'app':_0xfe46('0xab'),'appdata':_0x1645ee[_0xfe46('0x3c')]+','+(_0x542a2a[_0xfe46('0x76')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xfe46('0xac'),_0xfe46('0xad'),_0x542a2a);});}return respondWithRpcPromise(_0xfe46('0xac'),_0xfe46('0xad'),_0x542a2a);})[_0xfe46('0x22')](function(_0x2c1cc3){if(_0x2c1cc3){var _0x571143=0xc8;var _0x49e337='receiveMessage';logger[_0xfe46('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x49e337,_0x571143,_0xfe46('0xae'));logger[_0xfe46('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x49e337,_0x571143,_0xfe46('0xae'),JSON[_0xfe46('0x27')](_0x2c1cc3));if(_0x542a2a[_0xfe46('0x76')][_0xfe46('0x42')]===_0xfe46('0x83')){return _0x5dea97[_0xfe46('0x2d')](_0x571143)[_0xfe46('0x34')]('Content-Type',_0xfe46('0xaf'))[_0xfe46('0x3d')](_0xfe46('0xb0'));}else{return _0x5dea97['status'](_0x571143)[_0xfe46('0x2f')](_0x2c1cc3);}}})['catch'](handleError(_0x5dea97,null));};exports[_0xfe46('0xb1')]=function(_0x40fae9,_0xcd9a09){var _0x4e1b44=_0x40fae9['params']['id'];var _0x5d1784=_0x40fae9[_0xfe46('0x5f')];var _0x2897e3=0xc8;var _0x3ce02f=null;return db[_0xfe46('0xb2')]['transaction']({'isolationLevel':db['sequelize'][_0xfe46('0xb3')][_0xfe46('0xb4')][_0xfe46('0xb5')]},function(_0x160635){return db['SmsAccount']['findOne']({'where':{'id':_0x4e1b44},'transaction':_0x160635})[_0xfe46('0x22')](function(_0x317784){if(_0x317784){return db[_0xfe46('0x74')]['destroy']({'where':{'SmsAccountId':_0x4e1b44},'transaction':_0x160635})[_0xfe46('0x22')](function(){var _0x93984f=_['map'](_0x5d1784,function(_0xdbd719){_0xdbd719[_0xfe46('0x6a')]=_0x4e1b44;return _0xdbd719;});return db['SmsApplication'][_0xfe46('0xb6')](_0x93984f,{'transaction':_0x160635});});}else{_0x2897e3=0x194;_0x3ce02f=[];}});})[_0xfe46('0x22')](function(){if(_0x2897e3!==0x194){return db[_0xfe46('0x74')][_0xfe46('0xb7')]({'where':{'SmsAccountId':_0x4e1b44},'order':'priority'})['then'](function(_0x2d86b9){_0x3ce02f=_0x2d86b9;});}})[_0xfe46('0x58')](function(_0xf6cf4f){_0x2897e3=0x1f4;logger[_0xfe46('0x29')](_0xf6cf4f[_0xfe46('0x3b')]);if(_0xf6cf4f[_0xfe46('0x3c')]){delete _0xf6cf4f[_0xfe46('0x3c')];}_0x3ce02f=_0xf6cf4f;})[_0xfe46('0xb8')](function(){if(_0x3ce02f===null){_0xcd9a09['sendStatus'](_0x2897e3);}else{if(_0x2897e3===0x1f4){_0xcd9a09[_0xfe46('0x2d')](_0x2897e3)['send'](_0x3ce02f);}else{_0xcd9a09[_0xfe46('0x2d')](_0x2897e3)['json'](_0x3ce02f);}}});};exports[_0xfe46('0xb9')]=function(_0x5776af,_0x1cfa77,_0xe87867){var _0x5ee7c5={};var _0x2825f2={};var _0x511b9b;var _0x197957;return db[_0xfe46('0x40')][_0xfe46('0x71')]({'where':{'id':_0x5776af['params']['id']}})[_0xfe46('0x22')](handleEntityNotFound(_0x1cfa77,null))[_0xfe46('0x22')](function(_0x195505){if(_0x195505){_0x511b9b=_0x195505;_0x2825f2[_0xfe46('0x44')]=_[_0xfe46('0x46')](db[_0xfe46('0x74')][_0xfe46('0x41')]);_0x2825f2[_0xfe46('0x45')]=_['keys'](_0x5776af[_0xfe46('0x45')]);_0x2825f2[_0xfe46('0x47')]=_[_0xfe46('0x48')](_0x2825f2[_0xfe46('0x44')],_0x2825f2[_0xfe46('0x45')]);_0x5ee7c5[_0xfe46('0x49')]=_[_0xfe46('0x48')](_0x2825f2[_0xfe46('0x44')],qs['fields'](_0x5776af[_0xfe46('0x45')]['fields']));_0x5ee7c5['attributes']=_0x5ee7c5['attributes']['length']?_0x5ee7c5[_0xfe46('0x49')]:_0x2825f2[_0xfe46('0x44')];_0x5ee7c5[_0xfe46('0x4e')]=qs[_0xfe46('0x4f')](_0x5776af[_0xfe46('0x45')][_0xfe46('0x4f')]);_0x5ee7c5['where']=qs[_0xfe46('0x47')](_[_0xfe46('0x6d')](_0x5776af[_0xfe46('0x45')],_0x2825f2[_0xfe46('0x47')]));if(_0x5776af[_0xfe46('0x45')][_0xfe46('0x50')]){_0x5ee7c5[_0xfe46('0x51')]=_[_0xfe46('0x53')](_0x5ee7c5['where'],{'$or':_['map'](_0x5ee7c5['attributes'],function(_0x330ceb){var _0x37d1dd={};_0x37d1dd[_0x330ceb]={'$like':'%'+_0x5776af['query'][_0xfe46('0x50')]+'%'};return _0x37d1dd;})});}_0x5ee7c5=_[_0xfe46('0x53')]({},_0x5ee7c5,_0x5776af['options']);return _0x511b9b[_0xfe46('0xb9')](_0x5ee7c5);}})[_0xfe46('0x22')](function(_0x1dea7e){if(_0x1dea7e){_0x197957=_0x1dea7e['length'];if(!_0x5776af[_0xfe46('0x45')][_0xfe46('0x4c')]('nolimit')){_0x5ee7c5[_0xfe46('0x31')]=qs[_0xfe46('0x31')](_0x5776af[_0xfe46('0x45')][_0xfe46('0x31')]);_0x5ee7c5['offset']=qs[_0xfe46('0x33')](_0x5776af[_0xfe46('0x45')][_0xfe46('0x33')]);}return _0x511b9b['getApplications'](_0x5ee7c5);}})[_0xfe46('0x22')](function(_0x4a2b08){if(_0x4a2b08){return _0x4a2b08?{'count':_0x197957,'rows':_0x4a2b08}:null;}})['then'](respondWithResult(_0x1cfa77,null))['catch'](handleError(_0x1cfa77,null));};exports[_0xfe46('0xba')]=function(_0x3eb22f,_0x5d4d8f,_0x30558e){var _0x2c2d27={'raw':![],'where':{}};var _0x1f4f9c={};var _0x47ee4d={'count':0x0,'rows':[]};return db[_0xfe46('0x40')]['findOne']({'where':{'id':_0x3eb22f['params']['id']}})[_0xfe46('0x22')](handleEntityNotFound(_0x5d4d8f,null))[_0xfe46('0x22')](function(_0x595a61){if(_0x595a61){_0x1f4f9c[_0xfe46('0x44')]=_[_0xfe46('0x46')](db[_0xfe46('0xa2')][_0xfe46('0x41')]);_0x1f4f9c['query']=_['keys'](_0x3eb22f[_0xfe46('0x45')]);_0x1f4f9c[_0xfe46('0x47')]=_[_0xfe46('0x48')](_0x1f4f9c['model'],_0x1f4f9c[_0xfe46('0x45')]);_0x2c2d27[_0xfe46('0x49')]=_[_0xfe46('0x48')](_0x1f4f9c[_0xfe46('0x44')],qs[_0xfe46('0x4a')](_0x3eb22f[_0xfe46('0x45')][_0xfe46('0x4a')]));_0x2c2d27[_0xfe46('0x49')]=_0x2c2d27[_0xfe46('0x49')][_0xfe46('0x4b')]?_0x2c2d27['attributes']:_0x1f4f9c[_0xfe46('0x44')];if(!_0x3eb22f['query'][_0xfe46('0x4c')](_0xfe46('0x4d'))){_0x2c2d27['limit']=qs[_0xfe46('0x31')](_0x3eb22f[_0xfe46('0x45')][_0xfe46('0x31')]);_0x2c2d27[_0xfe46('0x33')]=qs[_0xfe46('0x33')](_0x3eb22f[_0xfe46('0x45')][_0xfe46('0x33')]);}_0x2c2d27[_0xfe46('0x4e')]=qs[_0xfe46('0x4f')](_0x3eb22f[_0xfe46('0x45')][_0xfe46('0x4f')]);_0x2c2d27[_0xfe46('0x51')]=qs[_0xfe46('0x47')](_['pick'](_0x3eb22f[_0xfe46('0x45')],_0x1f4f9c[_0xfe46('0x47')]));_0x2c2d27[_0xfe46('0x51')][_0xfe46('0x6a')]=_0x595a61['id'];if(_0x3eb22f[_0xfe46('0x45')]['filter']){_0x2c2d27[_0xfe46('0x51')]=_[_0xfe46('0x53')](_0x2c2d27['where'],{'$or':_[_0xfe46('0x3f')](_0x2c2d27[_0xfe46('0x49')],function(_0x31ae01){var _0x102b76={};_0x102b76[_0x31ae01]={'$like':'%'+_0x3eb22f[_0xfe46('0x45')][_0xfe46('0x50')]+'%'};return _0x102b76;})});}_0x2c2d27=_[_0xfe46('0x53')]({},_0x2c2d27,_0x3eb22f['options']);return db[_0xfe46('0xa2')]['count']({'where':_0x2c2d27[_0xfe46('0x51')]})[_0xfe46('0x22')](function(_0x286e54){_0x47ee4d['count']=_0x286e54;if(_0x3eb22f[_0xfe46('0x45')]['includeAll']){_0x2c2d27[_0xfe46('0x55')]=[{'model':db[_0xfe46('0x79')],'as':_0xfe46('0xbb'),'required':![]},{'model':db[_0xfe46('0xaa')],'as':_0xfe46('0xbc'),'attributes':[_0xfe46('0x3c'),'fullname',_0xfe46('0xbd')],'required':![]},{'model':db[_0xfe46('0xbe')],'as':_0xfe46('0xbf'),'attributes':['id','name',_0xfe46('0xc0')],'where':_0x3eb22f[_0xfe46('0x45')][_0xfe46('0xc1')]?{'id':_0x3eb22f['query'][_0xfe46('0xc1')]}:undefined,'required':_0x3eb22f[_0xfe46('0x45')][_0xfe46('0xc1')]?!![]:![]}];}return db[_0xfe46('0xa2')][_0xfe46('0x56')](_0x2c2d27);})[_0xfe46('0x22')](function(_0x4f362b){_0x47ee4d[_0xfe46('0x57')]=_0x4f362b;return _0x47ee4d;});}})[_0xfe46('0x22')](respondWithFilteredResult(_0x5d4d8f,_0x2c2d27))[_0xfe46('0x58')](handleError(_0x5d4d8f,null));};exports[_0xfe46('0x3d')]=function(_0x33f4ef,_0x2bfb92,_0x462aab){var _0x36580b,_0x5dd660,_0x52bd0e;if(_['isNil'](_0x33f4ef[_0xfe46('0x5f')][_0xfe46('0x5f')])||_0x33f4ef['body'][_0xfe46('0x5f')]===''){throw new db[(_0xfe46('0x7a'))][(_0xfe46('0x7b'))](_0xfe46('0x98'));}if(_[_0xfe46('0x96')](_0x33f4ef[_0xfe46('0x5f')]['to'])){throw new db[(_0xfe46('0x7a'))]['ValidationError'](_0xfe46('0xc2'));}_0x36580b=_0x33f4ef['body']['to'];return db[_0xfe46('0x40')][_0xfe46('0x64')]({'where':{'id':_0x33f4ef[_0xfe46('0x5a')]['id']},'include':[{'model':db[_0xfe46('0x9b')],'as':_0xfe46('0xc3'),'include':[{'model':db[_0xfe46('0x79')],'as':_0xfe46('0x9c'),'where':{'mobile':_0x36580b},'limit':0x1,'order':[[_0xfe46('0x7e'),_0xfe46('0x9d')]]}]}]})[_0xfe46('0x22')](handleEntityNotFound(_0x2bfb92,null))[_0xfe46('0x22')](function(_0x3acee7){if(_0x3acee7&&_0x3acee7[_0xfe46('0xc3')]){_0x5dd660=_0x3acee7[_0xfe46('0x39')]({'plain':!![]});if(_0x5dd660[_0xfe46('0xc3')]&&_0x5dd660[_0xfe46('0xc3')][_0xfe46('0x9c')][_0xfe46('0x4b')]){return _0x5dd660[_0xfe46('0xc3')][_0xfe46('0x9c')][0x0];}return db['CmContact']['create'](_[_0xfe46('0xa0')](_0x33f4ef[_0xfe46('0x5f')],{'firstName':_0x36580b,'mobile':_0x36580b,'phone':_0x36580b,'ListId':_0x5dd660['ListId']}));}})[_0xfe46('0x22')](handleEntityNotFound(_0x2bfb92,null))['then'](function(_0x66156c){if(_0x66156c){_0x52bd0e=_0x66156c;return db['SmsInteraction']['find']({'where':{'ContactId':_0x52bd0e['id'],'closed':![],'SmsAccountId':_0x5dd660['id']}})[_0xfe46('0x22')](function(_0x46cf25){if(_0x46cf25){return[_0x46cf25,![]];}return db[_0xfe46('0xa2')]['create']({'UserId':_0x33f4ef[_0xfe46('0x60')]['id'],'ContactId':_0x52bd0e['id'],'SmsAccountId':_0x5dd660['id'],'phone':_0x36580b,'firstMsgDirection':_0xfe46('0xc4'),'Messages':[_['merge'](_0x33f4ef['body'],{'read':![],'body':_0x33f4ef[_0xfe46('0x5f')][_0xfe46('0x5f')],'phone':_0x36580b,'SmsAccountId':_0x5dd660['id'],'UserId':_0x33f4ef[_0xfe46('0x60')]['id'],'ContactId':_0x52bd0e['id']})]},{'include':[{'model':db[_0xfe46('0xc5')],'as':'Messages'}]})['then'](function(_0x23bae1){return[_0x23bae1,!![]];});});}})['spread'](function(_0x46595e,_0x557e28){if(_0x557e28){return _0x46595e;}return db[_0xfe46('0xc5')][_0xfe46('0x5e')](_['merge'](_0x33f4ef[_0xfe46('0x5f')],{'read':![],'body':_0x33f4ef[_0xfe46('0x5f')][_0xfe46('0x5f')],'phone':_0x36580b,'SmsAccountId':_0x5dd660['id'],'SmsInteractionId':_0x46595e['id'],'UserId':_0x33f4ef[_0xfe46('0x60')]['id'],'ContactId':_0x52bd0e['id']}))[_0xfe46('0x22')](function(_0x56eb15){_0x46595e[_0xfe46('0xc6')][_0xfe46('0xc7')]=[];_0x46595e[_0xfe46('0xc6')]['Messages'][_0xfe46('0xc8')](_0x56eb15[_0xfe46('0xc6')]);return _0x46595e;});})[_0xfe46('0x22')](respondWithResult(_0x2bfb92,null))['catch'](handleError(_0x2bfb92,null));};exports[_0xfe46('0x2d')]=function(_0x467cc3,_0x36eed0,_0x39a86a){if(_0x467cc3[_0xfe46('0x5f')]['id']){delete _0x467cc3[_0xfe46('0x5f')]['id'];}var _0x2dee06,_0x2021f5,_0x1aa0dc;return db[_0xfe46('0x40')][_0xfe46('0x64')]({'where':{'id':_0x467cc3[_0xfe46('0x5a')]['id']}})[_0xfe46('0x22')](handleEntityNotFound(_0x36eed0,null))[_0xfe46('0x22')](function(_0x4d57a2){if(_0x4d57a2){_0x1aa0dc=_0x4d57a2;logger[_0xfe46('0x25')](_0xfe46('0xc9'),'status',_0xfe46('0xca'),_0x4d57a2['type'],util[_0xfe46('0xcb')](_0x467cc3[_0xfe46('0x5f')],{'showHidden':![],'depth':null}));switch(_0x4d57a2[_0xfe46('0x42')]){case'skebby':if(_0x467cc3[_0xfe46('0x5f')][_0xfe46('0xcc')]&&_0x467cc3[_0xfe46('0x5f')]['status']){_0x2021f5=_0x467cc3[_0xfe46('0x5f')][_0xfe46('0x2d')];return db[_0xfe46('0xc5')][_0xfe46('0x64')]({'where':{'messageId':_0x467cc3[_0xfe46('0x5f')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x467cc3[_0xfe46('0x5f')][_0xfe46('0xcd')]&&_0x467cc3[_0xfe46('0x5f')][_0xfe46('0xce')]){_0x2021f5=_0x467cc3[_0xfe46('0x5f')]['statusInt'];return db['SmsMessage'][_0xfe46('0x64')]({'where':{'messageId':_0x467cc3[_0xfe46('0x5f')]['requestid']}});}break;case _0xfe46('0x8b'):if(_0x467cc3[_0xfe46('0x5f')][_0xfe46('0xcf')]&&_0x467cc3[_0xfe46('0x5f')]['status_code']){_0x2021f5=_0x467cc3[_0xfe46('0x5f')][_0xfe46('0xd0')];return db['SmsMessage']['find']({'where':{'messageId':_0x467cc3['body']['message_id']}});}break;case'infobip':var _0x1e2045=_0x467cc3[_0xfe46('0x5f')][_0xfe46('0x8f')][0x0];if(_0x1e2045[_0xfe46('0x85')]&&_0x1e2045[_0xfe46('0x2d')]['groupName']==='DELIVERED'){_0x2021f5=_0x1e2045[_0xfe46('0x2d')][_0xfe46('0xd1')];return db['SmsMessage'][_0xfe46('0x64')]({'where':{'messageId':_0x1e2045[_0xfe46('0x85')]}});}break;case'clickatell':if(_0x467cc3[_0xfe46('0x5f')][_0xfe46('0x85')]&&_0x467cc3[_0xfe46('0x5f')][_0xfe46('0x2d')]){_0x2021f5=_0x467cc3[_0xfe46('0x5f')][_0xfe46('0x2d')];return db['SmsMessage']['find']({'where':{'messageId':_0x467cc3[_0xfe46('0x5f')][_0xfe46('0x85')]}});}break;case _0xfe46('0xd2'):if(_0x467cc3['body'][0x0][_0xfe46('0x2a')]['id']){_0x2021f5=_0x467cc3[_0xfe46('0x5f')][0x0]['type'];return db[_0xfe46('0xc5')]['find']({'where':{'messageId':_0x467cc3[_0xfe46('0x5f')][0x0]['message']['id']}});}break;case _0xfe46('0xd3'):if(_0x467cc3[_0xfe46('0x5f')]['redif']&&_0x467cc3[_0xfe46('0x5f')][_0xfe46('0x2d')]){_0x2021f5=_0x467cc3[_0xfe46('0x5f')][_0xfe46('0x2d')];return db['SmsMessage'][_0xfe46('0x64')]({'where':{'messageId':_0x467cc3[_0xfe46('0x5f')]['redif']}});}break;}}})[_0xfe46('0x22')](handleEntityNotFound(_0x36eed0,null))['then'](function(_0x347221){if(_0x347221){_0x2dee06=_0x347221;switch(_0x1aa0dc[_0xfe46('0x42')]){case _0xfe46('0x87'):if(_0x2021f5===_0xfe46('0xd4')){return _0x2dee06[_0xfe46('0x38')]({'read':!![]});}else{logger['error'](_0xfe46('0xc9'),_0xfe46('0x2d'),_0xfe46('0x87'),util[_0xfe46('0xcb')](_0x467cc3[_0xfe46('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xfe46('0x8a'):if(_0x2021f5==='1'){return _0x2dee06[_0xfe46('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfe46('0x2d'),'skebby',util['inspect'](_0x467cc3['body'],{'showHidden':![],'depth':null}));}break;case _0xfe46('0x8b'):if(!_0x467cc3['body'][_0xfe46('0xd5')]&&_0x2021f5>=0xc8&&_0x2021f5<=0xce){return _0x2dee06[_0xfe46('0x38')]({'read':!![]});}else{logger[_0xfe46('0x29')](_0xfe46('0xc9'),'status',_0xfe46('0x8b'),util[_0xfe46('0xcb')](_0x467cc3[_0xfe46('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xfe46('0x8e'):var _0x1a9795=_0x467cc3[_0xfe46('0x5f')][_0xfe46('0x8f')][0x0];if(_0x1a9795[_0xfe46('0x2d')][_0xfe46('0xd1')]===_0xfe46('0xd4')){return _0x2dee06['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfe46('0x2d'),_0xfe46('0x8e'),util[_0xfe46('0xcb')](_0x467cc3[_0xfe46('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xfe46('0x92'):if(_0x2021f5==_0xfe46('0xd6')||_0x2021f5==_0xfe46('0xd7')){return _0x2dee06[_0xfe46('0x38')]({'read':!![]});}else{logger[_0xfe46('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfe46('0x2d'),_0xfe46('0x92'),util[_0xfe46('0xcb')](_0x467cc3['body'],{'showHidden':![],'depth':null}));}break;case _0xfe46('0xd2'):if(_0x2021f5==_0xfe46('0xd8')){return _0x2dee06[_0xfe46('0x38')]({'read':!![]});}else{logger[_0xfe46('0x29')](_0xfe46('0xc9'),_0xfe46('0x2d'),_0xfe46('0xd2'),util[_0xfe46('0xcb')](_0x467cc3[_0xfe46('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xfe46('0xd3'):if(_0x2021f5===_0xfe46('0xd9')||_0x2021f5==='ACCEPTD'){return _0x2dee06['update']({'read':!![]});}else{logger[_0xfe46('0x29')](_0xfe46('0xc9'),'status','intelepeer',util['inspect'](_0x467cc3[_0xfe46('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x2dee06;}})[_0xfe46('0x22')](respondWithResult(_0x36eed0,null))['catch'](handleError(_0x36eed0,null));};exports[_0xfe46('0xda')]=function(_0x273a72,_0x2aee36,_0x575bcb){var _0x5d6274,_0x2d3f9d,_0xafed97;return db[_0xfe46('0x40')]['find']({'where':{'id':_0x273a72[_0xfe46('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2aee36,null))['then'](function(_0x210bcd){if(_0x210bcd){_0xafed97=_0x210bcd;logger[_0xfe46('0x25')](_0xfe46('0xc9'),_0xfe46('0x2d'),'received\x20delivery\x20report\x20from',_0x210bcd[_0xfe46('0x42')],util['inspect'](_0x273a72[_0xfe46('0x45')],{'showHidden':![],'depth':null}));switch(_0x210bcd['type']){case'csc':if(_0x273a72[_0xfe46('0x45')]['message-id']&&_0x273a72[_0xfe46('0x45')][_0xfe46('0xdb')]){_0x2d3f9d=_0x273a72[_0xfe46('0x45')][_0xfe46('0xdb')];return db[_0xfe46('0xc5')][_0xfe46('0x64')]({'where':{'messageId':_0x273a72[_0xfe46('0x45')][_0xfe46('0xdc')]}});}break;}}})['then'](handleEntityNotFound(_0x2aee36,null))['then'](function(_0x124618){if(_0x124618){_0x5d6274=_0x124618;switch(_0xafed97[_0xfe46('0x42')]){case _0xfe46('0x90'):if(_0x2d3f9d==='2'||_0x2d3f9d==='6'){return _0x5d6274[_0xfe46('0x38')]({'read':!![]});}else{logger[_0xfe46('0x29')](_0xfe46('0xc9'),_0xfe46('0x2d'),'csc',util['inspect'](_0x273a72[_0xfe46('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x5d6274;}})[_0xfe46('0x22')](respondWithResult(_0x2aee36,null))[_0xfe46('0x58')](handleError(_0x2aee36,null));};exports[_0xfe46('0xdd')]=function(_0x5b9967,_0x1d8232,_0x52b203){return db[_0xfe46('0x40')][_0xfe46('0x64')]({'where':{'id':_0x5b9967[_0xfe46('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1d8232,null))[_0xfe46('0x22')](function(_0x4c5df6){if(_0x4c5df6){return _0x4c5df6['addAgents'](_0x5b9967[_0xfe46('0x5f')][_0xfe46('0x6f')],_[_0xfe46('0x9f')](_0x5b9967['body'],[_0xfe46('0x6f'),'id'])||{})[_0xfe46('0xa3')](function(_0x1ddbc9){for(var _0x8172b5=0x0;_0x8172b5<_0x5b9967[_0xfe46('0x5f')][_0xfe46('0x6f')]['length'];_0x8172b5+=0x1){socket[_0xfe46('0xde')](_0xfe46('0xdf'),{'UserId':Number(_0x5b9967[_0xfe46('0x5f')][_0xfe46('0x6f')][_0x8172b5]),'SmsAccountId':Number(_0x5b9967[_0xfe46('0x5a')]['id'])});}return _0x1ddbc9;});}})[_0xfe46('0x22')](respondWithResult(_0x1d8232,null))[_0xfe46('0x58')](handleError(_0x1d8232,null));};exports[_0xfe46('0xe0')]=function(_0x3861a6,_0x54fb73,_0x24c0f2){return db['SmsAccount'][_0xfe46('0x64')]({'where':{'id':_0x3861a6[_0xfe46('0x5a')]['id']}})[_0xfe46('0x22')](handleEntityNotFound(_0x54fb73,null))['then'](function(_0x1e0444){if(_0x1e0444){return _0x1e0444[_0xfe46('0xe0')](_0x3861a6[_0xfe46('0x45')][_0xfe46('0x6f')])[_0xfe46('0x22')](function(){if(_['isArray'](_0x3861a6[_0xfe46('0x45')]['ids'])){for(var _0xe9928d=0x0;_0xe9928d<_0x3861a6[_0xfe46('0x45')][_0xfe46('0x6f')]['length'];_0xe9928d+=0x1){socket[_0xfe46('0xde')](_0xfe46('0xe1'),{'UserId':Number(_0x3861a6['query'][_0xfe46('0x6f')][_0xe9928d]),'SmsAccountId':Number(_0x3861a6[_0xfe46('0x5a')]['id'])});}}else{socket[_0xfe46('0xde')]('userSmsAccount:remove',{'UserId':Number(_0x3861a6[_0xfe46('0x45')][_0xfe46('0x6f')]),'SmsAccountId':Number(_0x3861a6['params']['id'])});}});}})[_0xfe46('0x22')](respondWithStatusCode(_0x54fb73,null))['catch'](handleError(_0x54fb73,null));};exports[_0xfe46('0xe2')]=function(_0x2d20ab,_0x45fb65,_0x511284){var _0x42a621={};var _0x234303={};var _0x38382e;var _0xcbf532;return db[_0xfe46('0x40')][_0xfe46('0x71')]({'where':{'id':_0x2d20ab[_0xfe46('0x5a')]['id']}})[_0xfe46('0x22')](handleEntityNotFound(_0x45fb65,null))[_0xfe46('0x22')](function(_0x416bcd){if(_0x416bcd){_0x38382e=_0x416bcd;_0x234303[_0xfe46('0x44')]=_[_0xfe46('0x46')](db[_0xfe46('0xaa')][_0xfe46('0x41')]);_0x234303[_0xfe46('0x45')]=_[_0xfe46('0x46')](_0x2d20ab[_0xfe46('0x45')]);_0x234303[_0xfe46('0x47')]=_[_0xfe46('0x48')](_0x234303['model'],_0x234303[_0xfe46('0x45')]);_0x42a621['attributes']=_[_0xfe46('0x48')](_0x234303[_0xfe46('0x44')],qs[_0xfe46('0x4a')](_0x2d20ab[_0xfe46('0x45')][_0xfe46('0x4a')]));_0x42a621[_0xfe46('0x49')]=_0x42a621[_0xfe46('0x49')][_0xfe46('0x4b')]?_0x42a621[_0xfe46('0x49')]:_0x234303[_0xfe46('0x44')];_0x42a621['order']=qs[_0xfe46('0x4f')](_0x2d20ab[_0xfe46('0x45')][_0xfe46('0x4f')]);_0x42a621['where']=qs[_0xfe46('0x47')](_[_0xfe46('0x6d')](_0x2d20ab[_0xfe46('0x45')],_0x234303[_0xfe46('0x47')]));if(_0x2d20ab[_0xfe46('0x45')][_0xfe46('0x50')]){_0x42a621['where']=_[_0xfe46('0x53')](_0x42a621['where'],{'$or':_['map'](_0x42a621[_0xfe46('0x49')],function(_0x48066){var _0x345525={};_0x345525[_0x48066]={'$like':'%'+_0x2d20ab['query'][_0xfe46('0x50')]+'%'};return _0x345525;})});}_0x42a621=_[_0xfe46('0x53')]({},_0x42a621,_0x2d20ab[_0xfe46('0x54')]);return _0x38382e['getAgents'](_0x42a621);}})[_0xfe46('0x22')](function(_0x1f1764){if(_0x1f1764){_0xcbf532=_0x1f1764[_0xfe46('0x4b')];if(!_0x2d20ab[_0xfe46('0x45')]['hasOwnProperty']('nolimit')){_0x42a621[_0xfe46('0x31')]=qs[_0xfe46('0x31')](_0x2d20ab[_0xfe46('0x45')][_0xfe46('0x31')]);_0x42a621[_0xfe46('0x33')]=qs[_0xfe46('0x33')](_0x2d20ab['query'][_0xfe46('0x33')]);}return _0x38382e[_0xfe46('0xe2')](_0x42a621);}})[_0xfe46('0x22')](function(_0x4fc968){if(_0x4fc968){return _0x4fc968?{'count':_0xcbf532,'rows':_0x4fc968}:null;}})[_0xfe46('0x22')](respondWithResult(_0x45fb65,null))[_0xfe46('0x58')](handleError(_0x45fb65,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index dc3458c..29f448f 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 _0x7b9e=['hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners','save','remove','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7b9e,0x1a0));var _0xe7b9=function(_0x115aa9,_0x2db652){_0x115aa9=_0x115aa9-0x0;var _0x17401f=_0x7b9e[_0x115aa9];return _0x17401f;};'use strict';var EventEmitter=require(_0xe7b9('0x0'));var SmsAccount=require(_0xe7b9('0x1'))['db'][_0xe7b9('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe7b9('0x3')](0x0);var events={'afterCreate':_0xe7b9('0x4'),'afterUpdate':'update','afterDestroy':_0xe7b9('0x5')};function emitEvent(_0x58acac){return function(_0x1c8e23,_0x6ed207,_0x33f70f){SmsAccountEvents[_0xe7b9('0x6')](_0x58acac+':'+_0x1c8e23['id'],_0x1c8e23);SmsAccountEvents['emit'](_0x58acac,_0x1c8e23);_0x33f70f(null);};}for(var e in events){if(events[_0xe7b9('0x7')](e)){var event=events[e];SmsAccount[_0xe7b9('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x72c8=['update','remove','emit','hook','exports','../../mysqldb','SmsAccount'];(function(_0x4d924c,_0x2c6d55){var _0x1c5139=function(_0x45ae7f){while(--_0x45ae7f){_0x4d924c['push'](_0x4d924c['shift']());}};_0x1c5139(++_0x2c6d55);}(_0x72c8,0x98));var _0x872c=function(_0x481d14,_0x373782){_0x481d14=_0x481d14-0x0;var _0x3b8c38=_0x72c8[_0x481d14];return _0x3b8c38;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x872c('0x0'))['db'][_0x872c('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x872c('0x2'),'afterDestroy':_0x872c('0x3')};function emitEvent(_0x53e97b){return function(_0x3eaf55,_0x542b5c,_0xbeef56){SmsAccountEvents['emit'](_0x53e97b+':'+_0x3eaf55['id'],_0x3eaf55);SmsAccountEvents[_0x872c('0x4')](_0x53e97b,_0x3eaf55);_0xbeef56(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x872c('0x5')](e,emitEvent(event));}}module[_0x872c('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 91739ef..21ae369 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 _0xdc17=['path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x27b7a6,_0x4f3617){var _0x470156=function(_0x32ca5f){while(--_0x32ca5f){_0x27b7a6['push'](_0x27b7a6['shift']());}};_0x470156(++_0x4f3617);}(_0xdc17,0xf2));var _0x7dc1=function(_0x7c816a,_0x141bd8){_0x7c816a=_0x7c816a-0x0;var _0x7db9ce=_0xdc17[_0x7c816a];return _0x7db9ce;};'use strict';var _=require(_0x7dc1('0x0'));var util=require(_0x7dc1('0x1'));var logger=require(_0x7dc1('0x2'))(_0x7dc1('0x3'));var moment=require(_0x7dc1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7dc1('0x5'));var rimraf=require(_0x7dc1('0x6'));var config=require(_0x7dc1('0x7'));var attributes=require(_0x7dc1('0x8'));module[_0x7dc1('0x9')]=function(_0x51926f,_0x17daac){return _0x51926f[_0x7dc1('0xa')](_0x7dc1('0xb'),attributes,{'tableName':_0x7dc1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b9f=['util','api','moment','bluebird','path','rimraf','../../config/environment','./smsAccount.attributes','SmsAccount'];(function(_0xcca627,_0x5023e2){var _0x20a159=function(_0x449d5f){while(--_0x449d5f){_0xcca627['push'](_0xcca627['shift']());}};_0x20a159(++_0x5023e2);}(_0x7b9f,0x1b0));var _0xf7b9=function(_0x58d4ef,_0xbb8883){_0x58d4ef=_0x58d4ef-0x0;var _0x1bcffc=_0x7b9f[_0x58d4ef];return _0x1bcffc;};'use strict';var _=require('lodash');var util=require(_0xf7b9('0x0'));var logger=require('../../config/logger')(_0xf7b9('0x1'));var moment=require(_0xf7b9('0x2'));var BPromise=require(_0xf7b9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7b9('0x4'));var rimraf=require(_0xf7b9('0x5'));var config=require(_0xf7b9('0x6'));var attributes=require(_0xf7b9('0x7'));module['exports']=function(_0x1395e5,_0x2a9585){return _0x1395e5['define'](_0xf7b9('0x8'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index f82a3e1..bd57e8d 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 _0x8218=['util','moment','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','ShowSmsAccount','find','options','raw','include','attributes','map','model','stringify','catch','lodash'];(function(_0x526edc,_0x4c07a3){var _0x5b629b=function(_0x1970eb){while(--_0x1970eb){_0x526edc['push'](_0x526edc['shift']());}};_0x5b629b(++_0x4c07a3);}(_0x8218,0x153));var _0x8821=function(_0x2c9eae,_0x53588b){_0x2c9eae=_0x2c9eae-0x0;var _0x388033=_0x8218[_0x2c9eae];return _0x388033;};'use strict';var _=require(_0x8821('0x0'));var util=require(_0x8821('0x1'));var moment=require(_0x8821('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8821('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8821('0x4'));var logger=require('../../config/logger')(_0x8821('0x5'));var config=require('../../config/environment');var jayson=require(_0x8821('0x6'));var client=jayson[_0x8821('0x7')][_0x8821('0x8')]({'port':0x232a});config[_0x8821('0x9')]=_['defaults'](config[_0x8821('0x9')],{'host':_0x8821('0xa'),'port':0x18eb});var socket=require(_0x8821('0xb'))(new Redis(config['redis']));require(_0x8821('0xc'))[_0x8821('0xd')](socket);function respondWithRpcPromise(_0x128eda,_0x70e2b3,_0xa2e1d1){return new BPromise(function(_0x1de39f,_0xebd76e){return client[_0x8821('0xe')](_0x128eda,_0xa2e1d1)[_0x8821('0xf')](function(_0x35f500){logger[_0x8821('0x10')](_0x8821('0x11'),_0x70e2b3,_0x8821('0x12'));logger[_0x8821('0x13')](_0x8821('0x14'),_0x70e2b3,_0x8821('0x12'),JSON['stringify'](_0x35f500));if(_0x35f500[_0x8821('0x15')]){if(_0x35f500['error'][_0x8821('0x16')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x70e2b3,_0x35f500['error'][_0x8821('0x17')]);return _0xebd76e(_0x35f500[_0x8821('0x15')][_0x8821('0x17')]);}logger[_0x8821('0x15')]('SmsAccount,\x20%s,\x20%s',_0x70e2b3,_0x35f500[_0x8821('0x15')][_0x8821('0x17')]);return _0x1de39f(_0x35f500[_0x8821('0x15')][_0x8821('0x17')]);}else{logger['info'](_0x8821('0x11'),_0x70e2b3,_0x8821('0x12'));_0x1de39f(_0x35f500['result']['message']);}})['catch'](function(_0x39f836){logger[_0x8821('0x15')](_0x8821('0x11'),_0x70e2b3,_0x39f836);_0xebd76e(_0x39f836);});});}exports[_0x8821('0x18')]=function(_0x57ac3f){var _0x67393d=this;return new Promise(function(_0x4a3704,_0x1479a8){return db['SmsAccount'][_0x8821('0x19')]({'raw':_0x57ac3f[_0x8821('0x1a')]?_0x57ac3f[_0x8821('0x1a')][_0x8821('0x1b')]===undefined?!![]:![]:!![],'where':_0x57ac3f['options']?_0x57ac3f['options']['where']||null:null,'attributes':_0x57ac3f[_0x8821('0x1a')]?_0x57ac3f['options']['attributes']||null:null,'include':_0x57ac3f['options']?_0x57ac3f['options']['include']?_['map'](_0x57ac3f[_0x8821('0x1a')][_0x8821('0x1c')],function(_0x2de275){return{'model':db[_0x2de275['model']],'as':_0x2de275['as'],'attributes':_0x2de275[_0x8821('0x1d')],'include':_0x2de275['include']?_[_0x8821('0x1e')](_0x2de275['include'],function(_0xd27366){return{'model':db[_0xd27366['model']],'as':_0xd27366['as'],'attributes':_0xd27366['attributes'],'include':_0xd27366[_0x8821('0x1c')]?_[_0x8821('0x1e')](_0xd27366[_0x8821('0x1c')],function(_0x5c2c69){return{'model':db[_0x5c2c69[_0x8821('0x1f')]],'as':_0x5c2c69['as'],'attributes':_0x5c2c69[_0x8821('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8821('0xf')](function(_0x5c8c36){logger[_0x8821('0x10')](_0x8821('0x18'),_0x57ac3f);logger[_0x8821('0x13')](_0x8821('0x18'),_0x57ac3f,JSON[_0x8821('0x20')](_0x5c8c36));_0x4a3704(_0x5c8c36);})[_0x8821('0x21')](function(_0x4c31ba){logger[_0x8821('0x15')](_0x8821('0x18'),_0x4c31ba[_0x8821('0x17')],_0x57ac3f);_0x1479a8(_0x67393d[_0x8821('0x15')](0x1f4,_0x4c31ba[_0x8821('0x17')]));});});}; \ No newline at end of file +var _0x79b8=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','./smsAccount.socket','register','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','catch','find','options','where','attributes','include','map','model','ShowSmsAccount','lodash'];(function(_0x10f7e7,_0x9672dd){var _0x1b0410=function(_0x372e82){while(--_0x372e82){_0x10f7e7['push'](_0x10f7e7['shift']());}};_0x1b0410(++_0x9672dd);}(_0x79b8,0xc5));var _0x879b=function(_0xd7c338,_0x31f50f){_0xd7c338=_0xd7c338-0x0;var _0x56dded=_0x79b8[_0xd7c338];return _0x56dded;};'use strict';var _=require(_0x879b('0x0'));var util=require(_0x879b('0x1'));var moment=require('moment');var BPromise=require(_0x879b('0x2'));var rs=require(_0x879b('0x3'));var fs=require('fs');var Redis=require(_0x879b('0x4'));var db=require(_0x879b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x879b('0x6'))(_0x879b('0x7'));var config=require(_0x879b('0x8'));var jayson=require(_0x879b('0x9'));var client=jayson[_0x879b('0xa')]['http']({'port':0x232a});config['redis']=_[_0x879b('0xb')](config['redis'],{'host':_0x879b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x879b('0xd'))[_0x879b('0xe')](socket);function respondWithRpcPromise(_0x382b2d,_0x486411,_0x1275c7){return new BPromise(function(_0x1c55e6,_0x236a83){return client['request'](_0x382b2d,_0x1275c7)['then'](function(_0x185367){logger[_0x879b('0xf')]('SmsAccount,\x20%s,\x20%s',_0x486411,'request\x20sent');logger[_0x879b('0x10')](_0x879b('0x11'),_0x486411,_0x879b('0x12'),JSON[_0x879b('0x13')](_0x185367));if(_0x185367[_0x879b('0x14')]){if(_0x185367[_0x879b('0x14')][_0x879b('0x15')]===0x1f4){logger[_0x879b('0x14')]('SmsAccount,\x20%s,\x20%s',_0x486411,_0x185367['error']['message']);return _0x236a83(_0x185367[_0x879b('0x14')][_0x879b('0x16')]);}logger[_0x879b('0x14')](_0x879b('0x17'),_0x486411,_0x185367[_0x879b('0x14')][_0x879b('0x16')]);return _0x1c55e6(_0x185367[_0x879b('0x14')][_0x879b('0x16')]);}else{logger[_0x879b('0xf')]('SmsAccount,\x20%s,\x20%s',_0x486411,'request\x20sent');_0x1c55e6(_0x185367['result'][_0x879b('0x16')]);}})[_0x879b('0x18')](function(_0x3d14c9){logger[_0x879b('0x14')](_0x879b('0x17'),_0x486411,_0x3d14c9);_0x236a83(_0x3d14c9);});});}exports['ShowSmsAccount']=function(_0x39d662){var _0x2aa428=this;return new Promise(function(_0xa06c3,_0xfd5b74){return db['SmsAccount'][_0x879b('0x19')]({'raw':_0x39d662[_0x879b('0x1a')]?_0x39d662['options']['raw']===undefined?!![]:![]:!![],'where':_0x39d662[_0x879b('0x1a')]?_0x39d662[_0x879b('0x1a')][_0x879b('0x1b')]||null:null,'attributes':_0x39d662['options']?_0x39d662['options'][_0x879b('0x1c')]||null:null,'include':_0x39d662[_0x879b('0x1a')]?_0x39d662[_0x879b('0x1a')][_0x879b('0x1d')]?_['map'](_0x39d662['options']['include'],function(_0x4a7284){return{'model':db[_0x4a7284['model']],'as':_0x4a7284['as'],'attributes':_0x4a7284[_0x879b('0x1c')],'include':_0x4a7284[_0x879b('0x1d')]?_[_0x879b('0x1e')](_0x4a7284[_0x879b('0x1d')],function(_0x289e0e){return{'model':db[_0x289e0e['model']],'as':_0x289e0e['as'],'attributes':_0x289e0e['attributes'],'include':_0x289e0e[_0x879b('0x1d')]?_[_0x879b('0x1e')](_0x289e0e[_0x879b('0x1d')],function(_0x4104b7){return{'model':db[_0x4104b7[_0x879b('0x1f')]],'as':_0x4104b7['as'],'attributes':_0x4104b7[_0x879b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x485c97){logger[_0x879b('0xf')](_0x879b('0x20'),_0x39d662);logger[_0x879b('0x10')](_0x879b('0x20'),_0x39d662,JSON[_0x879b('0x13')](_0x485c97));_0xa06c3(_0x485c97);})['catch'](function(_0x1bcc16){logger['error'](_0x879b('0x20'),_0x1bcc16[_0x879b('0x16')],_0x39d662);_0xfd5b74(_0x2aa428['error'](0x1f4,_0x1bcc16[_0x879b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index e6ba8b4..5cf66d7 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x562ec2,_0x33932b){var _0xd3a205=function(_0x21aac4){while(--_0x21aac4){_0x562ec2['push'](_0x562ec2['shift']());}};_0xd3a205(++_0x33932b);}(_0x34e8,0x12c));var _0x834e=function(_0x3761cf,_0x220675){_0x3761cf=_0x3761cf-0x0;var _0x11419a=_0x34e8[_0x3761cf];return _0x11419a;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x132107,_0x40d4fc){var _0x28ecdf=function(_0x50ebb6){while(--_0x50ebb6){_0x132107['push'](_0x132107['shift']());}};_0x28ecdf(++_0x40d4fc);}(_0x3e74,0x175));var _0x43e7=function(_0x5bb99d,_0x32ceea){_0x5bb99d=_0x5bb99d-0x0;var _0x583ea7=_0x3e74[_0x5bb99d];return _0x583ea7;};'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 43576d2..0f0124f 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 _0x4c51=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x3db361,_0x34e8b3){var _0x4d9d29=function(_0x4a2bb8){while(--_0x4a2bb8){_0x3db361['push'](_0x3db361['shift']());}};_0x4d9d29(++_0x34e8b3);}(_0x4c51,0x192));var _0x14c5=function(_0x2892c6,_0x491431){_0x2892c6=_0x2892c6-0x0;var _0x20805d=_0x4c51[_0x2892c6];return _0x20805d;};'use strict';var Sequelize=require(_0x14c5('0x0'));module[_0x14c5('0x1')]={'priority':{'type':Sequelize[_0x14c5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x14c5('0x3')],'allowNull':![],'defaultValue':_0x14c5('0x4')},'appdata':{'type':Sequelize[_0x14c5('0x5')]()},'description':{'type':Sequelize[_0x14c5('0x3')]},'interval':{'type':Sequelize[_0x14c5('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x86f9=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0xcd9679,_0x2ff83a){var _0x3a41f2=function(_0x2631d0){while(--_0x2631d0){_0xcd9679['push'](_0xcd9679['shift']());}};_0x3a41f2(++_0x2ff83a);}(_0x86f9,0x136));var _0x986f=function(_0x45ee03,_0x2f5319){_0x45ee03=_0x45ee03-0x0;var _0x13d535=_0x86f9[_0x45ee03];return _0x13d535;};'use strict';var Sequelize=require(_0x986f('0x0'));module[_0x986f('0x1')]={'priority':{'type':Sequelize[_0x986f('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x986f('0x3')},'appdata':{'type':Sequelize[_0x986f('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x986f('0x5')],'defaultValue':_0x986f('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index dedccde..fcc3341 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 _0xa965=['catch','show','params','keys','include','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count','status','json','apply','save','update','destroy','error','stack','name','index','map','SmsApplication','rawAttributes','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','includeAll','findAll','rows'];(function(_0x33fdb3,_0x2d6764){var _0x258941=function(_0x244dc4){while(--_0x244dc4){_0x33fdb3['push'](_0x33fdb3['shift']());}};_0x258941(++_0x2d6764);}(_0xa965,0x93));var _0x5a96=function(_0x46ef1d,_0x24926){_0x46ef1d=_0x46ef1d-0x0;var _0x49ce69=_0xa965[_0x46ef1d];return _0x49ce69;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a96('0x0'));var zipdir=require(_0x5a96('0x1'));var jsonpatch=require(_0x5a96('0x2'));var rp=require(_0x5a96('0x3'));var moment=require(_0x5a96('0x4'));var BPromise=require(_0x5a96('0x5'));var Mustache=require(_0x5a96('0x6'));var util=require(_0x5a96('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5a96('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a96('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5a96('0xa'));var jsforce=require(_0x5a96('0xb'));var deskjs=require(_0x5a96('0xc'));var toCsv=require(_0x5a96('0x8'));var querystring=require(_0x5a96('0xd'));var Papa=require(_0x5a96('0xe'));var Redis=require(_0x5a96('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5a96('0x10'));var as=require(_0x5a96('0x11'));var hardwareService=require(_0x5a96('0x12'));var logger=require('../../config/logger')(_0x5a96('0x13'));var utils=require(_0x5a96('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5a96('0x15'));var db=require(_0x5a96('0x16'))['db'];function respondWithStatusCode(_0x3fabcd,_0x2c0fb1){_0x2c0fb1=_0x2c0fb1||0xcc;return function(_0x49ae19){if(_0x49ae19){return _0x3fabcd[_0x5a96('0x17')](_0x2c0fb1);}return _0x3fabcd['status'](_0x2c0fb1)['end']();};}function respondWithResult(_0x4cb333,_0x3b6f3b){_0x3b6f3b=_0x3b6f3b||0xc8;return function(_0x21afe9){if(_0x21afe9){return _0x4cb333['status'](_0x3b6f3b)['json'](_0x21afe9);}};}function respondWithFilteredResult(_0xa9aee0,_0x1b57bf){return function(_0xa93414){if(_0xa93414){var _0x2898a8=typeof _0x1b57bf[_0x5a96('0x18')]===_0x5a96('0x19')&&typeof _0x1b57bf[_0x5a96('0x1a')]===_0x5a96('0x19');var _0x589e73=_0xa93414[_0x5a96('0x1b')];var _0x26836f=_0x2898a8?0x0:_0x1b57bf[_0x5a96('0x18')];var _0x4f2d29=_0x2898a8?_0xa93414[_0x5a96('0x1b')]:_0x1b57bf['offset']+_0x1b57bf['limit'];var _0x2c7139;if(_0x4f2d29>=_0x589e73){_0x4f2d29=_0x589e73;_0x2c7139=0xc8;}else{_0x2c7139=0xce;}_0xa9aee0[_0x5a96('0x1c')](_0x2c7139);return _0xa9aee0['set']('Content-Range',_0x26836f+'-'+_0x4f2d29+'/'+_0x589e73)[_0x5a96('0x1d')](_0xa93414);}return null;};}function patchUpdates(_0x3b7ee9){return function(_0x1afcd9){try{jsonpatch[_0x5a96('0x1e')](_0x1afcd9,_0x3b7ee9,!![]);}catch(_0x3a5f8f){return BPromise['reject'](_0x3a5f8f);}return _0x1afcd9[_0x5a96('0x1f')]();};}function saveUpdates(_0x4ce1d7,_0x2e1373){return function(_0x257311){if(_0x257311){return _0x257311[_0x5a96('0x20')](_0x4ce1d7)['then'](function(_0x73d8dd){return _0x73d8dd;});}return null;};}function removeEntity(_0xf9078d,_0x10c702){return function(_0xeacdc5){if(_0xeacdc5){return _0xeacdc5[_0x5a96('0x21')]()['then'](function(){_0xf9078d[_0x5a96('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x442641,_0x5d3aba){return function(_0x20729f){if(!_0x20729f){_0x442641[_0x5a96('0x17')](0x194);}return _0x20729f;};}function handleError(_0x2c7d70,_0x14fb98){_0x14fb98=_0x14fb98||0x1f4;return function(_0x26d6de){logger[_0x5a96('0x22')](_0x26d6de[_0x5a96('0x23')]);if(_0x26d6de[_0x5a96('0x24')]){delete _0x26d6de[_0x5a96('0x24')];}_0x2c7d70[_0x5a96('0x1c')](_0x14fb98)['send'](_0x26d6de);};}exports[_0x5a96('0x25')]=function(_0x3c3a75,_0x588e76){var _0x259d6a={},_0x441e4f={},_0x2a8e6d={'count':0x0,'rows':[]};var _0x2be2f2=_[_0x5a96('0x26')](db[_0x5a96('0x27')][_0x5a96('0x28')],function(_0x29a1f4){return{'name':_0x29a1f4['fieldName'],'type':_0x29a1f4[_0x5a96('0x29')][_0x5a96('0x2a')]};});_0x441e4f[_0x5a96('0x2b')]=_[_0x5a96('0x26')](_0x2be2f2,_0x5a96('0x24'));_0x441e4f[_0x5a96('0x2c')]=_['keys'](_0x3c3a75[_0x5a96('0x2c')]);_0x441e4f['filters']=_['intersection'](_0x441e4f[_0x5a96('0x2b')],_0x441e4f[_0x5a96('0x2c')]);_0x259d6a[_0x5a96('0x2d')]=_[_0x5a96('0x2e')](_0x441e4f['model'],qs['fields'](_0x3c3a75[_0x5a96('0x2c')][_0x5a96('0x2f')]));_0x259d6a[_0x5a96('0x2d')]=_0x259d6a[_0x5a96('0x2d')]['length']?_0x259d6a[_0x5a96('0x2d')]:_0x441e4f['model'];if(!_0x3c3a75[_0x5a96('0x2c')][_0x5a96('0x30')](_0x5a96('0x31'))){_0x259d6a['limit']=qs[_0x5a96('0x1a')](_0x3c3a75[_0x5a96('0x2c')][_0x5a96('0x1a')]);_0x259d6a[_0x5a96('0x18')]=qs[_0x5a96('0x18')](_0x3c3a75[_0x5a96('0x2c')][_0x5a96('0x18')]);}_0x259d6a[_0x5a96('0x32')]=qs[_0x5a96('0x33')](_0x3c3a75[_0x5a96('0x2c')][_0x5a96('0x33')]);_0x259d6a['where']=qs[_0x5a96('0x34')](_[_0x5a96('0x35')](_0x3c3a75['query'],_0x441e4f['filters']),_0x2be2f2);if(_0x3c3a75['query'][_0x5a96('0x36')]){_0x259d6a[_0x5a96('0x37')]=_[_0x5a96('0x38')](_0x259d6a['where'],{'$or':_[_0x5a96('0x26')](_0x2be2f2,function(_0x56f6bf){if(_0x56f6bf['type']!==_0x5a96('0x39')){var _0x5e4cf1={};_0x5e4cf1[_0x56f6bf[_0x5a96('0x24')]]={'$like':'%'+_0x3c3a75[_0x5a96('0x2c')]['filter']+'%'};return _0x5e4cf1;}})});}_0x259d6a=_[_0x5a96('0x38')]({},_0x259d6a,_0x3c3a75[_0x5a96('0x3a')]);var _0x5bd492={'where':_0x259d6a[_0x5a96('0x37')]};return db['SmsApplication'][_0x5a96('0x1b')](_0x5bd492)[_0x5a96('0x3b')](function(_0x447064){_0x2a8e6d[_0x5a96('0x1b')]=_0x447064;if(_0x3c3a75[_0x5a96('0x2c')][_0x5a96('0x3c')]){_0x259d6a['include']=[{'all':!![]}];}return db[_0x5a96('0x27')][_0x5a96('0x3d')](_0x259d6a);})[_0x5a96('0x3b')](function(_0xae710c){_0x2a8e6d[_0x5a96('0x3e')]=_0xae710c;return _0x2a8e6d;})['then'](respondWithFilteredResult(_0x588e76,_0x259d6a))[_0x5a96('0x3f')](handleError(_0x588e76,null));};exports[_0x5a96('0x40')]=function(_0x1101bd,_0x415191){var _0xadb5e={'raw':!![],'where':{'id':_0x1101bd[_0x5a96('0x41')]['id']}},_0x19335d={};_0x19335d[_0x5a96('0x2b')]=_['keys'](db[_0x5a96('0x27')][_0x5a96('0x28')]);_0x19335d[_0x5a96('0x2c')]=_[_0x5a96('0x42')](_0x1101bd[_0x5a96('0x2c')]);_0x19335d['filters']=_[_0x5a96('0x2e')](_0x19335d[_0x5a96('0x2b')],_0x19335d[_0x5a96('0x2c')]);_0xadb5e[_0x5a96('0x2d')]=_[_0x5a96('0x2e')](_0x19335d[_0x5a96('0x2b')],qs[_0x5a96('0x2f')](_0x1101bd[_0x5a96('0x2c')]['fields']));_0xadb5e['attributes']=_0xadb5e['attributes']['length']?_0xadb5e[_0x5a96('0x2d')]:_0x19335d[_0x5a96('0x2b')];if(_0x1101bd[_0x5a96('0x2c')][_0x5a96('0x3c')]){_0xadb5e[_0x5a96('0x43')]=[{'all':!![]}];}_0xadb5e=_[_0x5a96('0x38')]({},_0xadb5e,_0x1101bd[_0x5a96('0x3a')]);return db[_0x5a96('0x27')]['find'](_0xadb5e)[_0x5a96('0x3b')](handleEntityNotFound(_0x415191,null))[_0x5a96('0x3b')](respondWithResult(_0x415191,null))['catch'](handleError(_0x415191,null));};exports[_0x5a96('0x44')]=function(_0x27744f,_0x5dfae9){return db[_0x5a96('0x27')][_0x5a96('0x44')](_0x27744f[_0x5a96('0x45')],{})[_0x5a96('0x3b')](respondWithResult(_0x5dfae9,0xc9))[_0x5a96('0x3f')](handleError(_0x5dfae9,null));};exports[_0x5a96('0x20')]=function(_0x3d8b44,_0x1f921f){if(_0x3d8b44[_0x5a96('0x45')]['id']){delete _0x3d8b44['body']['id'];}return db['SmsApplication']['find']({'where':{'id':_0x3d8b44[_0x5a96('0x41')]['id']}})[_0x5a96('0x3b')](handleEntityNotFound(_0x1f921f,null))[_0x5a96('0x3b')](saveUpdates(_0x3d8b44['body'],null))[_0x5a96('0x3b')](respondWithResult(_0x1f921f,null))[_0x5a96('0x3f')](handleError(_0x1f921f,null));};exports[_0x5a96('0x21')]=function(_0x2007ac,_0x3fa2b7){return db[_0x5a96('0x27')]['find']({'where':{'id':_0x2007ac['params']['id']}})[_0x5a96('0x3b')](handleEntityNotFound(_0x3fa2b7,null))[_0x5a96('0x3b')](removeEntity(_0x3fa2b7,null))['catch'](handleError(_0x3fa2b7,null));}; \ No newline at end of file +var _0xbe02=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','includeAll','findAll','rows','keys','intersection','length','include','options','find','create','catch','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring'];(function(_0x5a461e,_0xe83e49){var _0x1fac23=function(_0x32517a){while(--_0x32517a){_0x5a461e['push'](_0x5a461e['shift']());}};_0x1fac23(++_0xe83e49);}(_0xbe02,0x122));var _0x2be0=function(_0x4de122,_0x2949c8){_0x4de122=_0x4de122-0x0;var _0x4caf8b=_0xbe02[_0x4de122];return _0x4caf8b;};'use strict';var emlformat=require(_0x2be0('0x0'));var rimraf=require(_0x2be0('0x1'));var zipdir=require(_0x2be0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2be0('0x3'));var moment=require('moment');var BPromise=require(_0x2be0('0x4'));var Mustache=require(_0x2be0('0x5'));var util=require('util');var path=require(_0x2be0('0x6'));var sox=require(_0x2be0('0x7'));var csv=require(_0x2be0('0x8'));var ejs=require(_0x2be0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2be0('0xa'));var squel=require(_0x2be0('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2be0('0xc'));var toCsv=require(_0x2be0('0x8'));var querystring=require(_0x2be0('0xd'));var Papa=require(_0x2be0('0xe'));var Redis=require(_0x2be0('0xf'));var authService=require(_0x2be0('0x10'));var qs=require(_0x2be0('0x11'));var as=require(_0x2be0('0x12'));var hardwareService=require(_0x2be0('0x13'));var logger=require(_0x2be0('0x14'))(_0x2be0('0x15'));var utils=require('../../config/utils');var config=require(_0x2be0('0x16'));var licenseUtil=require(_0x2be0('0x17'));var db=require(_0x2be0('0x18'))['db'];function respondWithStatusCode(_0x4fa4e8,_0x43a8bf){_0x43a8bf=_0x43a8bf||0xcc;return function(_0x278a43){if(_0x278a43){return _0x4fa4e8[_0x2be0('0x19')](_0x43a8bf);}return _0x4fa4e8[_0x2be0('0x1a')](_0x43a8bf)[_0x2be0('0x1b')]();};}function respondWithResult(_0x4f3dee,_0x1a4d01){_0x1a4d01=_0x1a4d01||0xc8;return function(_0x264c58){if(_0x264c58){return _0x4f3dee['status'](_0x1a4d01)[_0x2be0('0x1c')](_0x264c58);}};}function respondWithFilteredResult(_0x4a9e8c,_0x363501){return function(_0x50ef2e){if(_0x50ef2e){var _0x51e69b=typeof _0x363501[_0x2be0('0x1d')]===_0x2be0('0x1e')&&typeof _0x363501[_0x2be0('0x1f')]===_0x2be0('0x1e');var _0x385a30=_0x50ef2e['count'];var _0x5be96d=_0x51e69b?0x0:_0x363501[_0x2be0('0x1d')];var _0x3a00a7=_0x51e69b?_0x50ef2e[_0x2be0('0x20')]:_0x363501[_0x2be0('0x1d')]+_0x363501['limit'];var _0x59441d;if(_0x3a00a7>=_0x385a30){_0x3a00a7=_0x385a30;_0x59441d=0xc8;}else{_0x59441d=0xce;}_0x4a9e8c['status'](_0x59441d);return _0x4a9e8c[_0x2be0('0x21')](_0x2be0('0x22'),_0x5be96d+'-'+_0x3a00a7+'/'+_0x385a30)['json'](_0x50ef2e);}return null;};}function patchUpdates(_0x3bac5b){return function(_0x4f68cb){try{jsonpatch['apply'](_0x4f68cb,_0x3bac5b,!![]);}catch(_0x3628af){return BPromise[_0x2be0('0x23')](_0x3628af);}return _0x4f68cb[_0x2be0('0x24')]();};}function saveUpdates(_0x49bb2e,_0x137fcb){return function(_0x219d6c){if(_0x219d6c){return _0x219d6c[_0x2be0('0x25')](_0x49bb2e)[_0x2be0('0x26')](function(_0x4c784){return _0x4c784;});}return null;};}function removeEntity(_0x389ae4,_0x42cde5){return function(_0x3878dc){if(_0x3878dc){return _0x3878dc[_0x2be0('0x27')]()['then'](function(){_0x389ae4[_0x2be0('0x1a')](0xcc)[_0x2be0('0x1b')]();});}};}function handleEntityNotFound(_0x105c82,_0x709f51){return function(_0x392aaf){if(!_0x392aaf){_0x105c82[_0x2be0('0x19')](0x194);}return _0x392aaf;};}function handleError(_0x3ff196,_0x20ce9e){_0x20ce9e=_0x20ce9e||0x1f4;return function(_0x104bac){logger['error'](_0x104bac[_0x2be0('0x28')]);if(_0x104bac[_0x2be0('0x29')]){delete _0x104bac['name'];}_0x3ff196[_0x2be0('0x1a')](_0x20ce9e)[_0x2be0('0x2a')](_0x104bac);};}exports[_0x2be0('0x2b')]=function(_0x29e134,_0x2783bb){var _0x575de2={},_0x3e00c1={},_0x232812={'count':0x0,'rows':[]};var _0x5f4192=_[_0x2be0('0x2c')](db[_0x2be0('0x2d')][_0x2be0('0x2e')],function(_0x2da927){return{'name':_0x2da927[_0x2be0('0x2f')],'type':_0x2da927['type'][_0x2be0('0x30')]};});_0x3e00c1[_0x2be0('0x31')]=_[_0x2be0('0x2c')](_0x5f4192,_0x2be0('0x29'));_0x3e00c1[_0x2be0('0x32')]=_['keys'](_0x29e134[_0x2be0('0x32')]);_0x3e00c1[_0x2be0('0x33')]=_['intersection'](_0x3e00c1[_0x2be0('0x31')],_0x3e00c1['query']);_0x575de2[_0x2be0('0x34')]=_['intersection'](_0x3e00c1['model'],qs[_0x2be0('0x35')](_0x29e134['query']['fields']));_0x575de2[_0x2be0('0x34')]=_0x575de2[_0x2be0('0x34')]['length']?_0x575de2['attributes']:_0x3e00c1[_0x2be0('0x31')];if(!_0x29e134[_0x2be0('0x32')][_0x2be0('0x36')](_0x2be0('0x37'))){_0x575de2[_0x2be0('0x1f')]=qs[_0x2be0('0x1f')](_0x29e134[_0x2be0('0x32')][_0x2be0('0x1f')]);_0x575de2[_0x2be0('0x1d')]=qs[_0x2be0('0x1d')](_0x29e134[_0x2be0('0x32')][_0x2be0('0x1d')]);}_0x575de2[_0x2be0('0x38')]=qs[_0x2be0('0x39')](_0x29e134[_0x2be0('0x32')][_0x2be0('0x39')]);_0x575de2['where']=qs[_0x2be0('0x33')](_[_0x2be0('0x3a')](_0x29e134[_0x2be0('0x32')],_0x3e00c1[_0x2be0('0x33')]),_0x5f4192);if(_0x29e134['query'][_0x2be0('0x3b')]){_0x575de2[_0x2be0('0x3c')]=_[_0x2be0('0x3d')](_0x575de2[_0x2be0('0x3c')],{'$or':_[_0x2be0('0x2c')](_0x5f4192,function(_0xbd72c9){if(_0xbd72c9[_0x2be0('0x3e')]!=='VIRTUAL'){var _0x5d84f0={};_0x5d84f0[_0xbd72c9[_0x2be0('0x29')]]={'$like':'%'+_0x29e134[_0x2be0('0x32')]['filter']+'%'};return _0x5d84f0;}})});}_0x575de2=_[_0x2be0('0x3d')]({},_0x575de2,_0x29e134['options']);var _0x2a56da={'where':_0x575de2[_0x2be0('0x3c')]};return db['SmsApplication'][_0x2be0('0x20')](_0x2a56da)[_0x2be0('0x26')](function(_0x2d2fc3){_0x232812[_0x2be0('0x20')]=_0x2d2fc3;if(_0x29e134[_0x2be0('0x32')][_0x2be0('0x3f')]){_0x575de2['include']=[{'all':!![]}];}return db[_0x2be0('0x2d')][_0x2be0('0x40')](_0x575de2);})[_0x2be0('0x26')](function(_0x5782a3){_0x232812[_0x2be0('0x41')]=_0x5782a3;return _0x232812;})[_0x2be0('0x26')](respondWithFilteredResult(_0x2783bb,_0x575de2))['catch'](handleError(_0x2783bb,null));};exports['show']=function(_0xf85a07,_0x16d254){var _0x3f5541={'raw':!![],'where':{'id':_0xf85a07['params']['id']}},_0x13c75c={};_0x13c75c['model']=_[_0x2be0('0x42')](db['SmsApplication'][_0x2be0('0x2e')]);_0x13c75c[_0x2be0('0x32')]=_[_0x2be0('0x42')](_0xf85a07[_0x2be0('0x32')]);_0x13c75c['filters']=_[_0x2be0('0x43')](_0x13c75c[_0x2be0('0x31')],_0x13c75c[_0x2be0('0x32')]);_0x3f5541['attributes']=_[_0x2be0('0x43')](_0x13c75c[_0x2be0('0x31')],qs[_0x2be0('0x35')](_0xf85a07[_0x2be0('0x32')]['fields']));_0x3f5541[_0x2be0('0x34')]=_0x3f5541['attributes'][_0x2be0('0x44')]?_0x3f5541[_0x2be0('0x34')]:_0x13c75c[_0x2be0('0x31')];if(_0xf85a07[_0x2be0('0x32')][_0x2be0('0x3f')]){_0x3f5541[_0x2be0('0x45')]=[{'all':!![]}];}_0x3f5541=_[_0x2be0('0x3d')]({},_0x3f5541,_0xf85a07[_0x2be0('0x46')]);return db[_0x2be0('0x2d')][_0x2be0('0x47')](_0x3f5541)[_0x2be0('0x26')](handleEntityNotFound(_0x16d254,null))[_0x2be0('0x26')](respondWithResult(_0x16d254,null))['catch'](handleError(_0x16d254,null));};exports['create']=function(_0xf32a32,_0x23339b){return db['SmsApplication'][_0x2be0('0x48')](_0xf32a32['body'],{})['then'](respondWithResult(_0x23339b,0xc9))[_0x2be0('0x49')](handleError(_0x23339b,null));};exports[_0x2be0('0x25')]=function(_0x1eb709,_0x288c99){if(_0x1eb709[_0x2be0('0x4a')]['id']){delete _0x1eb709[_0x2be0('0x4a')]['id'];}return db[_0x2be0('0x2d')][_0x2be0('0x47')]({'where':{'id':_0x1eb709['params']['id']}})[_0x2be0('0x26')](handleEntityNotFound(_0x288c99,null))[_0x2be0('0x26')](saveUpdates(_0x1eb709[_0x2be0('0x4a')],null))['then'](respondWithResult(_0x288c99,null))[_0x2be0('0x49')](handleError(_0x288c99,null));};exports[_0x2be0('0x27')]=function(_0x17006e,_0x3a817b){return db[_0x2be0('0x2d')][_0x2be0('0x47')]({'where':{'id':_0x17006e[_0x2be0('0x4b')]['id']}})[_0x2be0('0x26')](handleEntityNotFound(_0x3a817b,null))[_0x2be0('0x26')](removeEntity(_0x3a817b,null))['catch'](handleError(_0x3a817b,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index e6508fb..2cf96b3 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 _0x31c2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./smsApplication.attributes','exports','SmsApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x22df7a,_0x3af0eb){var _0x4ea07d=function(_0x351666){while(--_0x351666){_0x22df7a['push'](_0x22df7a['shift']());}};_0x4ea07d(++_0x3af0eb);}(_0x31c2,0x1e1));var _0x231c=function(_0x46da4c,_0x5b5944){_0x46da4c=_0x46da4c-0x0;var _0x2286f5=_0x31c2[_0x46da4c];return _0x2286f5;};'use strict';var _=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var logger=require(_0x231c('0x2'))(_0x231c('0x3'));var moment=require(_0x231c('0x4'));var BPromise=require(_0x231c('0x5'));var rp=require(_0x231c('0x6'));var fs=require('fs');var path=require(_0x231c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x231c('0x8'));module[_0x231c('0x9')]=function(_0x1f3f7d,_0x219c3f){return _0x1f3f7d['define'](_0x231c('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x231c('0xb'),'collate':_0x231c('0xc')});}; \ No newline at end of file +var _0xabe7=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','utf8mb4'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xabe7,0x1c3));var _0x7abe=function(_0xda7ac5,_0x2d667f){_0xda7ac5=_0xda7ac5-0x0;var _0x432d66=_0xabe7[_0xda7ac5];return _0x432d66;};'use strict';var _=require('lodash');var util=require(_0x7abe('0x0'));var logger=require(_0x7abe('0x1'))(_0x7abe('0x2'));var moment=require(_0x7abe('0x3'));var BPromise=require(_0x7abe('0x4'));var rp=require(_0x7abe('0x5'));var fs=require('fs');var path=require(_0x7abe('0x6'));var rimraf=require(_0x7abe('0x7'));var config=require(_0x7abe('0x8'));var attributes=require(_0x7abe('0x9'));module[_0x7abe('0xa')]=function(_0xcac5d1,_0x324837){return _0xcac5d1[_0x7abe('0xb')](_0x7abe('0xc'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7abe('0xd'),'collate':_0x7abe('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c19c862..291dffa 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 _0xd48e=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsApplication,\x20%s,\x20%s','message','catch'];(function(_0x5d0825,_0x21b82a){var _0x3f8ce1=function(_0x3fb7cb){while(--_0x3fb7cb){_0x5d0825['push'](_0x5d0825['shift']());}};_0x3f8ce1(++_0x21b82a);}(_0xd48e,0x93));var _0xed48=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xd48e[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require(_0xed48('0x0'));var moment=require(_0xed48('0x1'));var BPromise=require(_0xed48('0x2'));var rs=require(_0xed48('0x3'));var fs=require('fs');var Redis=require(_0xed48('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed48('0x5'));var logger=require(_0xed48('0x6'))(_0xed48('0x7'));var config=require('../../config/environment');var jayson=require(_0xed48('0x8'));var client=jayson[_0xed48('0x9')][_0xed48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50b4ce,_0x2cc522,_0x1c9299){return new BPromise(function(_0x52a5e2,_0x5f0f1b){return client['request'](_0x50b4ce,_0x1c9299)[_0xed48('0xb')](function(_0x28096a){logger[_0xed48('0xc')]('SmsApplication,\x20%s,\x20%s',_0x2cc522,'request\x20sent');logger[_0xed48('0xd')](_0xed48('0xe'),_0x2cc522,_0xed48('0xf'),JSON['stringify'](_0x28096a));if(_0x28096a[_0xed48('0x10')]){if(_0x28096a[_0xed48('0x10')][_0xed48('0x11')]===0x1f4){logger[_0xed48('0x10')](_0xed48('0x12'),_0x2cc522,_0x28096a[_0xed48('0x10')][_0xed48('0x13')]);return _0x5f0f1b(_0x28096a[_0xed48('0x10')][_0xed48('0x13')]);}logger[_0xed48('0x10')](_0xed48('0x12'),_0x2cc522,_0x28096a[_0xed48('0x10')][_0xed48('0x13')]);return _0x52a5e2(_0x28096a['error'][_0xed48('0x13')]);}else{logger['info'](_0xed48('0x12'),_0x2cc522,'request\x20sent');_0x52a5e2(_0x28096a['result'][_0xed48('0x13')]);}})[_0xed48('0x14')](function(_0x3dd77d){logger[_0xed48('0x10')](_0xed48('0x12'),_0x2cc522,_0x3dd77d);_0x5f0f1b(_0x3dd77d);});});} \ No newline at end of file +var _0x8357=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','SmsApplication,\x20%s,\x20%s','message','result','catch'];(function(_0x4f06cb,_0x1c4f52){var _0x114721=function(_0x13c7ac){while(--_0x13c7ac){_0x4f06cb['push'](_0x4f06cb['shift']());}};_0x114721(++_0x1c4f52);}(_0x8357,0x1e4));var _0x7835=function(_0x25fc6a,_0x577bae){_0x25fc6a=_0x25fc6a-0x0;var _0x31489d=_0x8357[_0x25fc6a];return _0x31489d;};'use strict';var _=require(_0x7835('0x0'));var util=require(_0x7835('0x1'));var moment=require(_0x7835('0x2'));var BPromise=require('bluebird');var rs=require(_0x7835('0x3'));var fs=require('fs');var Redis=require(_0x7835('0x4'));var db=require(_0x7835('0x5'))['db'];var utils=require(_0x7835('0x6'));var logger=require(_0x7835('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7835('0x8'));var client=jayson['client'][_0x7835('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x298c79,_0x504d32,_0x48805f){return new BPromise(function(_0x11835c,_0x5bc0f7){return client[_0x7835('0xa')](_0x298c79,_0x48805f)[_0x7835('0xb')](function(_0x2b34af){logger[_0x7835('0xc')]('SmsApplication,\x20%s,\x20%s',_0x504d32,_0x7835('0xd'));logger[_0x7835('0xe')](_0x7835('0xf'),_0x504d32,_0x7835('0xd'),JSON[_0x7835('0x10')](_0x2b34af));if(_0x2b34af[_0x7835('0x11')]){if(_0x2b34af[_0x7835('0x11')]['code']===0x1f4){logger[_0x7835('0x11')](_0x7835('0x12'),_0x504d32,_0x2b34af[_0x7835('0x11')][_0x7835('0x13')]);return _0x5bc0f7(_0x2b34af[_0x7835('0x11')][_0x7835('0x13')]);}logger[_0x7835('0x11')](_0x7835('0x12'),_0x504d32,_0x2b34af[_0x7835('0x11')][_0x7835('0x13')]);return _0x11835c(_0x2b34af[_0x7835('0x11')][_0x7835('0x13')]);}else{logger[_0x7835('0xc')](_0x7835('0x12'),_0x504d32,'request\x20sent');_0x11835c(_0x2b34af[_0x7835('0x14')][_0x7835('0x13')]);}})[_0x7835('0x15')](function(_0x1792cd){logger[_0x7835('0x11')]('SmsApplication,\x20%s,\x20%s',_0x504d32,_0x1792cd);_0x5bc0f7(_0x1792cd);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 7a06203..9bddaf9 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 _0x80ed=['delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update'];(function(_0x1c2aeb,_0x48433c){var _0x783379=function(_0x3e8820){while(--_0x3e8820){_0x1c2aeb['push'](_0x1c2aeb['shift']());}};_0x783379(++_0x48433c);}(_0x80ed,0x11c));var _0xd80e=function(_0x4d903d,_0xe967bf){_0x4d903d=_0x4d903d-0x0;var _0x15280f=_0x80ed[_0x4d903d];return _0x15280f;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./smsInteraction.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0x8')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0x8')](_0xd80e('0xf'),auth[_0xd80e('0x9')](),controller['getMessages']);router[_0xd80e('0x8')](_0xd80e('0x10'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x12')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0x13')]);router[_0xd80e('0x12')](_0xd80e('0xf'),auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0xd80e('0x9')](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x16')),controller[_0xd80e('0x17')]);router['put'](_0xd80e('0xd'),auth[_0xd80e('0x9')](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x18')),controller[_0xd80e('0x19')]);router[_0xd80e('0x1a')](_0xd80e('0xd'),auth['isAuthenticated'](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x1b')),controller[_0xd80e('0x1c')]);router['delete'](_0xd80e('0x1d'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x1eba=['put','/:id','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','download','post','create','/:id/tags','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x1591b0,_0x31909f){var _0x29c8de=function(_0x2f629f){while(--_0x2f629f){_0x1591b0['push'](_0x1591b0['shift']());}};_0x29c8de(++_0x31909f);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0x1eba[_0x218994];return _0x3f350b;};'use strict';var multer=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var path=require(_0xa1eb('0x2'));var timeout=require(_0xa1eb('0x3'));var express=require(_0xa1eb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa1eb('0x5'));var interaction=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var controller=require(_0xa1eb('0x8'));router[_0xa1eb('0x9')]('/',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xb')]);router[_0xa1eb('0x9')](_0xa1eb('0xc'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xd')]);router[_0xa1eb('0x9')]('/:id',auth[_0xa1eb('0xa')](),controller['show']);router[_0xa1eb('0x9')]('/:id/messages',auth[_0xa1eb('0xa')](),controller['getMessages']);router[_0xa1eb('0x9')]('/:id/download',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xe')]);router[_0xa1eb('0xf')]('/',auth['isAuthenticated'](),controller[_0xa1eb('0x10')]);router[_0xa1eb('0xf')]('/:id/messages',auth[_0xa1eb('0xa')](),controller['addMessage']);router['post'](_0xa1eb('0x11'),auth['isAuthenticated'](),interaction[_0xa1eb('0x12')](_0xa1eb('0x13'),_0xa1eb('0x14')),controller[_0xa1eb('0x15')]);router[_0xa1eb('0x16')](_0xa1eb('0x17'),auth[_0xa1eb('0xa')](),interaction[_0xa1eb('0x12')](_0xa1eb('0x13'),'smsinteraction:update'),controller[_0xa1eb('0x18')]);router['delete'](_0xa1eb('0x17'),auth[_0xa1eb('0xa')](),interaction[_0xa1eb('0x12')](_0xa1eb('0x13'),'smsinteraction:destroy'),controller[_0xa1eb('0x19')]);router[_0xa1eb('0x1a')](_0xa1eb('0x11'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0x1b')]);module[_0xa1eb('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 27aceaa..513675d 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 _0xab3f=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x35e6ca,_0x54939f){var _0x239e43=function(_0x3ea90d){while(--_0x3ea90d){_0x35e6ca['push'](_0x35e6ca['shift']());}};_0x239e43(++_0x54939f);}(_0xab3f,0x72));var _0xfab3=function(_0x5d5d11,_0x409643){_0x5d5d11=_0x5d5d11-0x0;var _0x4cf67d=_0xab3f[_0x5d5d11];return _0x4cf67d;};'use strict';var Sequelize=require(_0xfab3('0x0'));var moment=require('moment');module[_0xfab3('0x1')]={'closed':{'type':Sequelize[_0xfab3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfab3('0x3')]},'disposition':{'type':Sequelize[_0xfab3('0x4')]},'secondDisposition':{'type':Sequelize[_0xfab3('0x4')]},'thirdDisposition':{'type':Sequelize[_0xfab3('0x4')]},'note':{'type':Sequelize[_0xfab3('0x4')]},'phone':{'type':Sequelize[_0xfab3('0x4')]},'read1stAt':{'type':Sequelize[_0xfab3('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xfab3('0x5')]('in',_0xfab3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfab3('0x5')]('in',_0xfab3('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfab3('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xff16=['ENUM','sequelize','moment','BOOLEAN','DATE','STRING','out'];(function(_0x5821a8,_0x43c249){var _0xdb4573=function(_0x22bd85){while(--_0x22bd85){_0x5821a8['push'](_0x5821a8['shift']());}};_0xdb4573(++_0x43c249);}(_0xff16,0x7f));var _0x6ff1=function(_0x447ab8,_0x31fdff){_0x447ab8=_0x447ab8-0x0;var _0x25c050=_0xff16[_0x447ab8];return _0x25c050;};'use strict';var Sequelize=require(_0x6ff1('0x0'));var moment=require(_0x6ff1('0x1'));module['exports']={'closed':{'type':Sequelize[_0x6ff1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6ff1('0x3')]},'disposition':{'type':Sequelize[_0x6ff1('0x4')]},'secondDisposition':{'type':Sequelize[_0x6ff1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6ff1('0x4')]},'note':{'type':Sequelize[_0x6ff1('0x4')]},'phone':{'type':Sequelize[_0x6ff1('0x4')]},'read1stAt':{'type':Sequelize[_0x6ff1('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6ff1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6ff1('0x6')]('in',_0x6ff1('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6ff1('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 884ae77..a899322 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 _0xd3d8=['query','keys','attributes','model','fields','hasOwnProperty','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','find','unreadMessages','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','value','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','intersection','includeAll','include','options','create','body','params','describe','addMessage','SmsMessage','ids','omit','getMessages','nolimit','$gte','format','findAll','addTags','setTags','spread','smsInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','firstName','lastName','direction','secret','SmsAccount','Account','get','mkdirSync','Sms','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','out','renderFile','views','transcript-','.pdf','log','err','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/environment','../../config/license/util','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','map','fullname','TagIds','split','forEach','Tags','push','catch','index','SmsInteraction','rawAttributes','key'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3d8,0xa9));var _0x8d3d=function(_0x190b82,_0x183226){_0x190b82=_0x190b82-0x0;var _0x3ef134=_0xd3d8[_0x190b82];return _0x3ef134;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d3d('0x0'));var zipdir=require(_0x8d3d('0x1'));var jsonpatch=require(_0x8d3d('0x2'));var rp=require('request-promise');var moment=require(_0x8d3d('0x3'));var BPromise=require(_0x8d3d('0x4'));var Mustache=require(_0x8d3d('0x5'));var util=require(_0x8d3d('0x6'));var path=require(_0x8d3d('0x7'));var sox=require(_0x8d3d('0x8'));var csv=require(_0x8d3d('0x9'));var ejs=require(_0x8d3d('0xa'));var fs=require('fs');var fs_extra=require(_0x8d3d('0xb'));var _=require(_0x8d3d('0xc'));var squel=require(_0x8d3d('0xd'));var crypto=require(_0x8d3d('0xe'));var jsforce=require(_0x8d3d('0xf'));var deskjs=require(_0x8d3d('0x10'));var toCsv=require(_0x8d3d('0x9'));var querystring=require(_0x8d3d('0x11'));var Papa=require(_0x8d3d('0x12'));var Redis=require(_0x8d3d('0x13'));var authService=require(_0x8d3d('0x14'));var qs=require(_0x8d3d('0x15'));var as=require(_0x8d3d('0x16'));var pdf=require(_0x8d3d('0x17'));var hardwareService=require(_0x8d3d('0x18'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x8d3d('0x19'));var licenseUtil=require(_0x8d3d('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8d3d('0x1b')](config['redis'],{'host':_0x8d3d('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8d3d('0x1d'))[_0x8d3d('0x1e')](socket);function respondWithStatusCode(_0x55d79c,_0x2be07d){_0x2be07d=_0x2be07d||0xcc;return function(_0x218356){if(_0x218356){return _0x55d79c[_0x8d3d('0x1f')](_0x2be07d);}return _0x55d79c[_0x8d3d('0x20')](_0x2be07d)[_0x8d3d('0x21')]();};}function respondWithResult(_0x3619f9,_0x4998b5){_0x4998b5=_0x4998b5||0xc8;return function(_0x24db9a){if(_0x24db9a){return _0x3619f9[_0x8d3d('0x20')](_0x4998b5)[_0x8d3d('0x22')](_0x24db9a);}};}function respondWithFilteredResult(_0x5e234f,_0x356abb){return function(_0x390d95){if(_0x390d95){var _0x43596b=typeof _0x356abb[_0x8d3d('0x23')]===_0x8d3d('0x24')&&typeof _0x356abb[_0x8d3d('0x25')]==='undefined';var _0x3198bf=_0x390d95[_0x8d3d('0x26')];var _0x248fb3=_0x43596b?0x0:_0x356abb[_0x8d3d('0x23')];var _0x3bbc13=_0x43596b?_0x390d95[_0x8d3d('0x26')]:_0x356abb[_0x8d3d('0x23')]+_0x356abb['limit'];var _0x505a81;if(_0x3bbc13>=_0x3198bf){_0x3bbc13=_0x3198bf;_0x505a81=0xc8;}else{_0x505a81=0xce;}_0x5e234f['status'](_0x505a81);return _0x5e234f[_0x8d3d('0x27')](_0x8d3d('0x28'),_0x248fb3+'-'+_0x3bbc13+'/'+_0x3198bf)[_0x8d3d('0x22')](_0x390d95);}return null;};}function patchUpdates(_0x390545){return function(_0x29615b){try{jsonpatch[_0x8d3d('0x29')](_0x29615b,_0x390545,!![]);}catch(_0x4bb111){return BPromise[_0x8d3d('0x2a')](_0x4bb111);}return _0x29615b['save']();};}function saveUpdates(_0x85a806,_0x507b3d){return function(_0x5c3788){if(_0x5c3788){return _0x5c3788[_0x8d3d('0x2b')](_0x85a806)[_0x8d3d('0x2c')](function(_0x1b5149){return _0x1b5149;});}return null;};}function removeEntity(_0x2d985c,_0x2c405e){return function(_0x1dbb21){if(_0x1dbb21){return _0x1dbb21[_0x8d3d('0x2d')]()[_0x8d3d('0x2c')](function(){_0x2d985c['status'](0xcc)[_0x8d3d('0x21')]();});}};}function handleEntityNotFound(_0x183471,_0x37afde){return function(_0x1eb6f3){if(!_0x1eb6f3){_0x183471[_0x8d3d('0x1f')](0x194);}return _0x1eb6f3;};}function handleError(_0x65ea0d,_0x365c35){_0x365c35=_0x365c35||0x1f4;return function(_0x45455f){logger[_0x8d3d('0x2e')](_0x45455f['stack']);if(_0x45455f[_0x8d3d('0x2f')]){delete _0x45455f[_0x8d3d('0x2f')];}_0x65ea0d[_0x8d3d('0x20')](_0x365c35)[_0x8d3d('0x30')](_0x45455f);};}function getInteractionUsers(_0x303d4d,_0x378e8d){return new BPromise(function(_0x2e43c7,_0x836e51){try{if(_0x378e8d[_0x303d4d['id']]){_0x303d4d['Users']=_[_0x8d3d('0x31')](_0x378e8d[_0x303d4d['id']],function(_0x4358d9){return{'id':_0x4358d9['id'],'fullname':_0x4358d9[_0x8d3d('0x32')]};});}}catch(_0x4ad181){_0x836e51(_0x4ad181);}_0x2e43c7(_0x303d4d);});}function getInteractionTags(_0x87ba69,_0x388ca4){return new BPromise(function(_0x1167b1,_0x2d3bdd){try{if(_0x87ba69[_0x8d3d('0x33')]){_0x87ba69['Tags']=[];_0x87ba69[_0x8d3d('0x33')][_0x8d3d('0x34')](',')[_0x8d3d('0x35')](function(_0x15eb6f){_0x87ba69[_0x8d3d('0x36')][_0x8d3d('0x37')](_0x388ca4[_0x15eb6f]);});}delete _0x87ba69[_0x8d3d('0x33')];}catch(_0x32e4ce){_0x2d3bdd(_0x32e4ce);}_0x1167b1(_0x87ba69);});}function updateSmsInteraction(_0x564893,_0x37215f,_0x554f5e){return new BPromise(function(_0x32a074,_0x9daa56){return getInteractionUsers(_0x564893,_0x554f5e)[_0x8d3d('0x2c')](function(_0x355b53){return getInteractionTags(_0x355b53,_0x37215f);})[_0x8d3d('0x2c')](function(_0x75e012){_0x32a074(_0x75e012);})[_0x8d3d('0x38')](function(_0x2dd92e){_0x9daa56(_0x2dd92e);});});}exports[_0x8d3d('0x39')]=function(_0x3c7a41,_0x37b4fd){var _0x29d10a={},_0x40492c={},_0x342cc2={'count':0x0,'rows':[]};var _0x12d79b=_[_0x8d3d('0x31')](db[_0x8d3d('0x3a')][_0x8d3d('0x3b')],function(_0x3cfd53){return{'name':_0x3cfd53['fieldName'],'type':_0x3cfd53['type'][_0x8d3d('0x3c')]};});_0x40492c['model']=_[_0x8d3d('0x31')](_0x12d79b,_0x8d3d('0x2f'));_0x40492c[_0x8d3d('0x3d')]=_[_0x8d3d('0x3e')](_0x3c7a41[_0x8d3d('0x3d')]);_0x40492c['filters']=_['intersection'](_0x40492c['model'],_0x40492c[_0x8d3d('0x3d')]);_0x29d10a[_0x8d3d('0x3f')]=_['intersection'](_0x40492c[_0x8d3d('0x40')],qs[_0x8d3d('0x41')](_0x3c7a41['query'][_0x8d3d('0x41')]));_0x29d10a['attributes']=_0x29d10a[_0x8d3d('0x3f')]['length']?_0x29d10a[_0x8d3d('0x3f')]:_0x40492c[_0x8d3d('0x40')];if(!_0x3c7a41['query'][_0x8d3d('0x42')]('nolimit')){_0x29d10a['limit']=qs[_0x8d3d('0x25')](_0x3c7a41[_0x8d3d('0x3d')][_0x8d3d('0x25')]);_0x29d10a['offset']=qs['offset'](_0x3c7a41[_0x8d3d('0x3d')][_0x8d3d('0x23')]);}_0x29d10a['order']=qs['sort'](_0x3c7a41['query'][_0x8d3d('0x43')]);_0x29d10a[_0x8d3d('0x44')]=qs[_0x8d3d('0x45')](_[_0x8d3d('0x46')](_0x3c7a41[_0x8d3d('0x3d')],_0x40492c[_0x8d3d('0x45')]),_0x12d79b);var _0x48b86a=[];var _0x16d43b=squel[_0x8d3d('0x47')]()['field']('id')[_0x8d3d('0x48')](_0x8d3d('0x2f'))[_0x8d3d('0x48')](_0x8d3d('0x49'))[_0x8d3d('0x4a')](_0x8d3d('0x4b'));var _0x21c2f0=squel[_0x8d3d('0x47')]()[_0x8d3d('0x48')](_0x8d3d('0x4c'))['field']('u.fullname')[_0x8d3d('0x48')](_0x8d3d('0x4d'))[_0x8d3d('0x4a')](_0x8d3d('0x4e'),'ui')[_0x8d3d('0x4f')](_0x8d3d('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x1916f6=squel[_0x8d3d('0x47')]()[_0x8d3d('0x4a')](_0x8d3d('0x51'),'i')[_0x8d3d('0x4f')](_0x8d3d('0x52'),'c',_0x8d3d('0x53'))[_0x8d3d('0x4f')](_0x8d3d('0x50'),'o',_0x8d3d('0x54'))[_0x8d3d('0x4f')]('sms_accounts','a',_0x8d3d('0x55'))[_0x8d3d('0x4f')]('sms_messages','me',_0x8d3d('0x56'))[_0x8d3d('0x4f')](_0x8d3d('0x57'),'it',_0x8d3d('0x58'))[_0x8d3d('0x4f')](_0x8d3d('0x4b'),'t',_0x8d3d('0x59'));var _0x163cf3=squel[_0x8d3d('0x5a')]();var _0x53924f=[];var _0x4e3d4f=squel[_0x8d3d('0x5a')]();var _0x428ab2;if(_0x3c7a41[_0x8d3d('0x3d')][_0x8d3d('0x5b')]){_0x428ab2=as[_0x8d3d('0x5c')](_0x3c7a41[_0x8d3d('0x3d')][_0x8d3d('0x5b')]);var _0x114943=_0x428ab2[_0x8d3d('0x5d')];for(var _0x38f994=0x0;_0x38f994<_0x428ab2['conditions'][_0x8d3d('0x5e')];_0x38f994++){var _0x251133=_0x428ab2[_0x8d3d('0x5f')][_0x38f994];var _0x321a05='i';var _0xd18572=_[_0x8d3d('0x60')](_0x12d79b,[_0x8d3d('0x2f'),_0x251133['field']]);if(!_0xd18572){switch(_0x251133[_0x8d3d('0x48')]){case _0x8d3d('0x61'):if(_0x251133['value']==0x1){_0x1916f6[_0x8d3d('0x62')]('`'+_0x251133[_0x8d3d('0x48')]+'`\x20=\x200');}else{_0x1916f6['having']('`'+_0x251133[_0x8d3d('0x48')]+_0x8d3d('0x63'));}break;case _0x8d3d('0x64'):if(_0x251133[_0x8d3d('0x65')]===_0x8d3d('0x66')){if(_0x251133['value'][_0x8d3d('0x34')]('\x20')['length']>0x1){_0x163cf3[_0x114943](_0x8d3d('0x67'),qs[_0x8d3d('0x68')](_0x251133[_0x8d3d('0x69')]),null);}else{var _0x13feda='%'+_0x251133['value']+'%';_0x163cf3[_0x114943]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x13feda,_0x13feda,_0x13feda);}}else{_0xd18572=_[_0x8d3d('0x60')](_0x12d79b,[_0x8d3d('0x2f'),_0x8d3d('0x6a')]);_0x251133['field']='ContactId';_0x4ce26e=as[_0x8d3d('0x6b')](_0x321a05,_0xd18572[_0x8d3d('0x6c')],_0x251133);_0x163cf3[_0x114943](_0x4ce26e[_0x8d3d('0x6d')],_0x4ce26e[_0x8d3d('0x69')][_0x8d3d('0x6e')],_0x4ce26e['value'][_0x8d3d('0x21')]);}break;case _0x8d3d('0x6f'):var _0x5e7b53=_0x251133[_0x8d3d('0x69')][_0x8d3d('0x34')](',')[_0x8d3d('0x31')](function(_0x1a9938){return Number(_0x1a9938);});_0x5e7b53[_0x8d3d('0x35')](function(_0x21c881){_0x4e3d4f['or'](_0x8d3d('0x70'),'%,'+_0x21c881+',%');});_0x53924f=_[_0x8d3d('0x71')](_0x53924f,_0x5e7b53);break;case _0x8d3d('0x72'):if(_0x251133[_0x8d3d('0x65')]===_0x8d3d('0x66')){_0x163cf3[_0x114943]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x251133[_0x8d3d('0x69')]+'%',null);}else{_0xd18572=_[_0x8d3d('0x60')](_0x12d79b,[_0x8d3d('0x2f'),_0x8d3d('0x73')]);_0x251133[_0x8d3d('0x48')]=_0x8d3d('0x73');_0x4ce26e=as[_0x8d3d('0x6b')](_0x321a05,_0xd18572[_0x8d3d('0x6c')],_0x251133);_0x163cf3[_0x114943](_0x4ce26e[_0x8d3d('0x6d')],_0x4ce26e['value'][_0x8d3d('0x6e')],_0x4ce26e[_0x8d3d('0x69')][_0x8d3d('0x21')]);}break;case'body':_0x4ce26e=as['buildExpression']('me',null,_0x251133);_0x163cf3[_0x114943](_0x4ce26e[_0x8d3d('0x6d')],_0x4ce26e[_0x8d3d('0x69')][_0x8d3d('0x6e')],_0x4ce26e[_0x8d3d('0x69')]['end']);break;}}else{var _0x4ce26e=as[_0x8d3d('0x6b')](_0x321a05,_0xd18572[_0x8d3d('0x6c')],_0x251133);_0x163cf3[_0x114943](_0x4ce26e[_0x8d3d('0x6d')],_0x4ce26e['value'][_0x8d3d('0x6e')],_0x4ce26e[_0x8d3d('0x69')]['end']);}}}else{var _0x443886=_(_0x3c7a41[_0x8d3d('0x3d')])[_0x8d3d('0x3e')]()[_0x8d3d('0x31')](function(_0x18cd07){return _[_0x8d3d('0x74')](_0x12d79b,[_0x8d3d('0x2f'),_0x18cd07])?_0x18cd07:undefined;})[_0x8d3d('0x75')]()[_0x8d3d('0x69')]();if(!_['isEmpty'](_0x443886)){_0x443886[_0x8d3d('0x35')](function(_0x298597){if(_0x298597===_0x8d3d('0x76')){_0x1916f6[_0x8d3d('0x44')](_0x8d3d('0x77'),[]['concat'](_0x3c7a41['query'][_0x298597]));}else if(_0x298597===_0x8d3d('0x78')){var _0x53c573=JSON[_0x8d3d('0x79')](_0x3c7a41[_0x8d3d('0x3d')][_0x298597])['$gte'];var _0x1da901=JSON[_0x8d3d('0x79')](_0x3c7a41['query'][_0x298597])['$lte'];_0x1916f6[_0x8d3d('0x44')](_0x8d3d('0x7a'),_0x53c573,_0x1da901);}else{if(_0x3c7a41[_0x8d3d('0x3d')][_0x298597]===_0x8d3d('0x7b')){_0x1916f6[_0x8d3d('0x44')]('i.'+_0x298597+_0x8d3d('0x7c'));}else{_0x1916f6[_0x8d3d('0x44')]('i.'+_0x298597+_0x8d3d('0x7d'),_0x3c7a41['query'][_0x298597]);}}});}if(_0x3c7a41['query'][_0x8d3d('0x7e')]){if(_0x3c7a41[_0x8d3d('0x3d')]['read']==0x1){_0x1916f6[_0x8d3d('0x62')](_0x8d3d('0x7f'));}else{_0x1916f6['having']('`unreadMessages`\x20>\x200');}}if(_0x3c7a41['query']['tag']){_0x53924f=_[_0x8d3d('0x80')](_0x3c7a41[_0x8d3d('0x3d')][_0x8d3d('0x81')])?_0x3c7a41[_0x8d3d('0x3d')][_0x8d3d('0x81')]:new Array(_0x3c7a41['query'][_0x8d3d('0x81')]);_0x53924f[_0x8d3d('0x35')](function(_0x5f0d26){_0x4e3d4f['or'](_0x8d3d('0x70'),'%,'+_0x5f0d26+',%');});}if(_0x3c7a41[_0x8d3d('0x3d')][_0x8d3d('0x82')]){var _0x4c5c55=_0x3c7a41[_0x8d3d('0x3d')][_0x8d3d('0x82')][_0x8d3d('0x83')]('\x5c','\x5c\x5c')[_0x8d3d('0x83')](/'/g,'\x27\x27');if(qs[_0x8d3d('0x84')](_0x4c5c55)){_0x163cf3['or'](_0x8d3d('0x85'),_0x4c5c55+'%')['or'](_0x8d3d('0x86'),_0x4c5c55+'%');}else{_0x163cf3['or'](_0x8d3d('0x87'),qs[_0x8d3d('0x68')](_0x4c5c55))['or'](_0x8d3d('0x88'),_0x4c5c55+'%');}}}_0x1916f6[_0x8d3d('0x44')](_0x163cf3);_0x1916f6[_0x8d3d('0x89')](_0x8d3d('0x8a'));var _0x121edd={'type':db[_0x8d3d('0x8b')][_0x8d3d('0x8c')][_0x8d3d('0x8d')],'raw':!![]};var _0x5f1d5e=_0x1916f6['clone']();_0x5f1d5e[_0x8d3d('0x48')]('i.id');_0x5f1d5e['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8d3d('0x61'));if(_0x29d10a[_0x8d3d('0x8e')]){_0x29d10a['order'][_0x8d3d('0x35')](function(_0x4d13a0){var _0x256dac=_0x4d13a0[0x0]===_0x8d3d('0x8f')?_0x4d13a0[0x0]:'i.'+_0x4d13a0[0x0];_0x1916f6[_0x8d3d('0x8e')](_0x256dac,_0x4d13a0[0x1]===_0x8d3d('0x90')?![]:!![]);});}if(!_[_0x8d3d('0x91')](_0x53924f)){_0x1916f6[_0x8d3d('0x62')](_0x4e3d4f);_0x5f1d5e[_0x8d3d('0x44')](_0x8d3d('0x92'),_0x53924f);}BPromise[_0x8d3d('0x93')]()[_0x8d3d('0x2c')](function(){if(!_0x428ab2){if(_0x3c7a41[_0x8d3d('0x3d')][_0x8d3d('0x76')])return;_0x5f1d5e[_0x8d3d('0x44')](_0x8d3d('0x94'));_0x1916f6[_0x8d3d('0x44')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3c7a41['user'][_0x8d3d('0x95')]!==_0x8d3d('0x96'))return;return _0x3c7a41[_0x8d3d('0x97')][_0x8d3d('0x98')]({'attributes':['id'],'raw':!![]})[_0x8d3d('0x2c')](function(_0x1b5891){if(_['isEmpty'](_0x1b5891)){_0x5f1d5e[_0x8d3d('0x44')](_0x8d3d('0x99'));_0x1916f6[_0x8d3d('0x44')](_0x8d3d('0x99'));}else{_0x5f1d5e[_0x8d3d('0x44')](_0x8d3d('0x77'),_[_0x8d3d('0x31')](_0x1b5891,'id'));_0x1916f6[_0x8d3d('0x44')](_0x8d3d('0x77'),_[_0x8d3d('0x31')](_0x1b5891,'id'));}});})[_0x8d3d('0x2c')](function(){if(_0x3c7a41[_0x8d3d('0x97')]['role']===_0x8d3d('0x96')&&!_0x428ab2&&!_0x3c7a41['query'][_0x8d3d('0x76')])return[];return db[_0x8d3d('0x9a')][_0x8d3d('0x3d')](_0x5f1d5e[_0x8d3d('0x9b')](),_0x121edd);})[_0x8d3d('0x2c')](function(_0x177310){_0x342cc2[_0x8d3d('0x26')]=_0x177310[_0x8d3d('0x5e')];if(_0x342cc2[_0x8d3d('0x26')]===0x0)return[];return db[_0x8d3d('0x9a')]['query'](_0x16d43b[_0x8d3d('0x9b')](),_0x121edd)[_0x8d3d('0x2c')](function(_0x4a82a0){_0x48b86a=_[_0x8d3d('0x9c')](_0x4a82a0,'id');_0x121edd=_[_0x8d3d('0x9d')](_0x121edd,{'model':db[_0x8d3d('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3c7a41[_0x8d3d('0x3d')][_0x8d3d('0x41')]){_0x29d10a[_0x8d3d('0x3f')][_0x8d3d('0x35')](function(_0x4ad3ac){_0x1916f6['field']('i.'+_0x4ad3ac);});}else{_0x1916f6['field'](_0x8d3d('0x9e'),_0x8d3d('0x61'));_0x1916f6[_0x8d3d('0x48')](_0x8d3d('0x9f'),_0x8d3d('0xa0'));_0x1916f6[_0x8d3d('0x48')]('a.mandatoryDisposition',_0x8d3d('0xa1'));_0x1916f6[_0x8d3d('0x48')]('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');_0x1916f6[_0x8d3d('0x48')](_0x8d3d('0xa2'));_0x1916f6[_0x8d3d('0x48')](_0x8d3d('0xa3'),_0x8d3d('0xa4'));_0x1916f6['field'](_0x8d3d('0xa5'),'Contact.lastName');_0x1916f6['field'](_0x8d3d('0xa6'),'Contact.email');_0x1916f6['field'](_0x8d3d('0xa7'),_0x8d3d('0xa8'));_0x1916f6[_0x8d3d('0x48')]('c.mobile',_0x8d3d('0xa9'));_0x1916f6[_0x8d3d('0x48')](_0x8d3d('0xaa'),_0x8d3d('0xab'));_0x1916f6[_0x8d3d('0x48')](_0x8d3d('0xac'),_0x8d3d('0xad'));_0x1916f6['field']('o.internal','Owner.internal');_0x1916f6['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8d3d('0x33'));}if(_0x29d10a[_0x8d3d('0x25')])_0x1916f6['limit'](_0x29d10a[_0x8d3d('0x25')]);if(_0x29d10a[_0x8d3d('0x23')])_0x1916f6['offset'](_0x29d10a['offset']);return db[_0x8d3d('0x9a')][_0x8d3d('0x3d')](_0x1916f6[_0x8d3d('0x9b')](),_0x121edd);})[_0x8d3d('0x2c')](function(_0x3ea0c4){if(_0x3ea0c4['length']>0x0)_0x21c2f0['where'](_0x8d3d('0xae'),_[_0x8d3d('0x31')](_0x3ea0c4,'id'));return db[_0x8d3d('0x9a')][_0x8d3d('0x3d')](_0x21c2f0[_0x8d3d('0x9b')](),_0x121edd)[_0x8d3d('0x2c')](function(_0x49fbeb){var _0x44a898=_[_0x8d3d('0xaf')](_0x49fbeb,_0x8d3d('0xb0'));var _0xc2bb95=[];_0x3ea0c4[_0x8d3d('0x35')](function(_0xe283d1){_0xc2bb95[_0x8d3d('0x37')](updateSmsInteraction(_0xe283d1,_0x48b86a,_0x44a898));});return BPromise['all'](_0xc2bb95);});});})[_0x8d3d('0x2c')](function(_0x5ab02f){_0x342cc2[_0x8d3d('0xb1')]=_0x5ab02f;return _0x342cc2;})[_0x8d3d('0x2c')](respondWithFilteredResult(_0x37b4fd,_0x29d10a))[_0x8d3d('0x38')](handleError(_0x37b4fd,null));};exports['show']=function(_0x3b2121,_0x402f45){var _0x38c6d8={'raw':![],'where':{'id':_0x3b2121['params']['id']}},_0x841ba4={};_0x841ba4['model']=_[_0x8d3d('0x3e')](db[_0x8d3d('0x3a')][_0x8d3d('0x3b')]);_0x841ba4[_0x8d3d('0x3d')]=_[_0x8d3d('0x3e')](_0x3b2121[_0x8d3d('0x3d')]);_0x841ba4[_0x8d3d('0x45')]=_['intersection'](_0x841ba4[_0x8d3d('0x40')],_0x841ba4[_0x8d3d('0x3d')]);_0x38c6d8['attributes']=_[_0x8d3d('0xb2')](_0x841ba4[_0x8d3d('0x40')],qs['fields'](_0x3b2121[_0x8d3d('0x3d')][_0x8d3d('0x41')]));_0x38c6d8[_0x8d3d('0x3f')]=_0x38c6d8[_0x8d3d('0x3f')][_0x8d3d('0x5e')]?_0x38c6d8[_0x8d3d('0x3f')]:_0x841ba4[_0x8d3d('0x40')];if(_0x3b2121['query'][_0x8d3d('0xb3')]){_0x38c6d8[_0x8d3d('0xb4')]=[{'all':!![]}];}_0x38c6d8=_[_0x8d3d('0x9d')]({},_0x38c6d8,_0x3b2121[_0x8d3d('0xb5')]);return db[_0x8d3d('0x3a')][_0x8d3d('0x60')](_0x38c6d8)[_0x8d3d('0x2c')](handleEntityNotFound(_0x402f45,null))[_0x8d3d('0x2c')](respondWithResult(_0x402f45,null))['catch'](handleError(_0x402f45,null));};exports[_0x8d3d('0xb6')]=function(_0x5cfe46,_0x25e7fa){return db[_0x8d3d('0x3a')][_0x8d3d('0xb6')](_0x5cfe46[_0x8d3d('0xb7')],{})['then'](respondWithResult(_0x25e7fa,0xc9))[_0x8d3d('0x38')](handleError(_0x25e7fa,null));};exports[_0x8d3d('0x2b')]=function(_0x21afc4,_0x513ba8){if(_0x21afc4['body']['id']){delete _0x21afc4['body']['id'];}return db[_0x8d3d('0x3a')][_0x8d3d('0x60')]({'where':{'id':_0x21afc4[_0x8d3d('0xb8')]['id']}})[_0x8d3d('0x2c')](handleEntityNotFound(_0x513ba8,null))['then'](saveUpdates(_0x21afc4['body'],null))[_0x8d3d('0x2c')](respondWithResult(_0x513ba8,null))[_0x8d3d('0x38')](handleError(_0x513ba8,null));};exports[_0x8d3d('0x2d')]=function(_0x5cc3be,_0x34be45){return db[_0x8d3d('0x3a')]['find']({'where':{'id':_0x5cc3be['params']['id']}})[_0x8d3d('0x2c')](handleEntityNotFound(_0x34be45,null))[_0x8d3d('0x2c')](removeEntity(_0x34be45,null))[_0x8d3d('0x38')](handleError(_0x34be45,null));};exports[_0x8d3d('0xb9')]=function(_0x34376c,_0x2475c5){return db[_0x8d3d('0x3a')][_0x8d3d('0xb9')]()[_0x8d3d('0x2c')](respondWithResult(_0x2475c5,null))[_0x8d3d('0x38')](handleError(_0x2475c5,null));};exports[_0x8d3d('0xba')]=function(_0xac6062,_0x21f292,_0xa8b38b){return db[_0x8d3d('0xbb')][_0x8d3d('0x60')]({'where':{'id':_0xac6062[_0x8d3d('0xb8')]['id']}})[_0x8d3d('0x2c')](handleEntityNotFound(_0x21f292,null))['then'](function(_0x2db21b){if(_0x2db21b){return _0x2db21b[_0x8d3d('0xba')](_0xac6062['body'][_0x8d3d('0xbc')],_[_0x8d3d('0xbd')](_0xac6062[_0x8d3d('0xb7')],[_0x8d3d('0xbc'),'id'])||{});}})[_0x8d3d('0x2c')](respondWithResult(_0x21f292,null))['catch'](handleError(_0x21f292,null));};exports[_0x8d3d('0xbe')]=function(_0x39befe,_0x59c67f,_0x35be35){var _0x51284b={'raw':![],'where':{}};var _0x176463={};var _0x1d58e7={'count':0x0,'rows':[]};return db[_0x8d3d('0x3a')]['findOne']({'where':{'id':_0x39befe[_0x8d3d('0xb8')]['id']}})['then'](handleEntityNotFound(_0x59c67f,null))['then'](function(_0x21019f){if(_0x21019f){_0x176463[_0x8d3d('0x40')]=_[_0x8d3d('0x3e')](db[_0x8d3d('0xbb')]['rawAttributes']);_0x176463[_0x8d3d('0x3d')]=_[_0x8d3d('0x3e')](_0x39befe[_0x8d3d('0x3d')]);_0x176463['filters']=_[_0x8d3d('0xb2')](_0x176463['model'],_0x176463[_0x8d3d('0x3d')]);_0x51284b[_0x8d3d('0x3f')]=_['intersection'](_0x176463[_0x8d3d('0x40')],qs[_0x8d3d('0x41')](_0x39befe[_0x8d3d('0x3d')][_0x8d3d('0x41')]));_0x51284b[_0x8d3d('0x3f')]=_0x51284b[_0x8d3d('0x3f')][_0x8d3d('0x5e')]?_0x51284b['attributes']:_0x176463['model'];if(!_0x39befe[_0x8d3d('0x3d')]['hasOwnProperty'](_0x8d3d('0xbf'))){_0x51284b[_0x8d3d('0x25')]=qs[_0x8d3d('0x25')](_0x39befe[_0x8d3d('0x3d')][_0x8d3d('0x25')]);_0x51284b[_0x8d3d('0x23')]=qs[_0x8d3d('0x23')](_0x39befe[_0x8d3d('0x3d')][_0x8d3d('0x23')]);}_0x51284b['order']=qs[_0x8d3d('0x43')](_0x39befe[_0x8d3d('0x3d')]['sort']);_0x51284b[_0x8d3d('0x44')]=qs[_0x8d3d('0x45')](_[_0x8d3d('0x46')](_0x39befe[_0x8d3d('0x3d')],_0x176463['filters']));_0x51284b[_0x8d3d('0x44')][_0x8d3d('0xb0')]=_0x21019f['id'];if(_0x39befe[_0x8d3d('0x3d')]['filter']){_0x51284b[_0x8d3d('0x44')]=_[_0x8d3d('0x9d')](_0x51284b[_0x8d3d('0x44')],{'$or':_[_0x8d3d('0x31')](_0x51284b[_0x8d3d('0x3f')],function(_0xe22763){var _0x54862e={};_0x54862e[_0xe22763]={'$like':'%'+_0x39befe[_0x8d3d('0x3d')][_0x8d3d('0x82')]+'%'};return _0x54862e;})});}if(_0x39befe[_0x8d3d('0x3d')]['$gte']){var _0x40ab46=_0x39befe[_0x8d3d('0x3d')][_0x8d3d('0xc0')][_0x8d3d('0x34')](',');var _0x33f86b={};_0x33f86b[_0x40ab46[0x0]]={'$gte':moment(_0x40ab46[0x1])[_0x8d3d('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x51284b[_0x8d3d('0x44')]=_[_0x8d3d('0x9d')](_0x51284b[_0x8d3d('0x44')],_0x33f86b);}_0x51284b=_[_0x8d3d('0x9d')]({},_0x51284b,_0x39befe[_0x8d3d('0xb5')]);return db[_0x8d3d('0xbb')][_0x8d3d('0x26')]({'where':_0x51284b['where']})['then'](function(_0x20f5bb){_0x1d58e7[_0x8d3d('0x26')]=_0x20f5bb;if(_0x39befe['query'][_0x8d3d('0xb3')]){_0x51284b[_0x8d3d('0xb4')]=[{'all':!![]}];}return db[_0x8d3d('0xbb')][_0x8d3d('0xc2')](_0x51284b);})[_0x8d3d('0x2c')](function(_0x370336){_0x1d58e7[_0x8d3d('0xb1')]=_0x370336;return _0x1d58e7;});}})[_0x8d3d('0x2c')](respondWithFilteredResult(_0x59c67f,_0x51284b))[_0x8d3d('0x38')](handleError(_0x59c67f,null));};exports[_0x8d3d('0xc3')]=function(_0x214955,_0x5e18e2,_0x220ef2){return db[_0x8d3d('0x3a')][_0x8d3d('0x60')]({'where':{'id':_0x214955['params']['id']}})[_0x8d3d('0x2c')](handleEntityNotFound(_0x5e18e2,null))[_0x8d3d('0x2c')](function(_0x5ee08d){if(_0x5ee08d){return _0x5ee08d[_0x8d3d('0xc4')](_0x214955[_0x8d3d('0xb7')][_0x8d3d('0xbc')],_[_0x8d3d('0xbd')](_0x214955[_0x8d3d('0xb7')],[_0x8d3d('0xbc'),'id'])||{})[_0x8d3d('0xc5')](function(){return db[_0x8d3d('0x6f')][_0x8d3d('0xc2')]({'attributes':['id',_0x8d3d('0x2f'),'color'],'where':{'id':_0x214955['body'][_0x8d3d('0xbc')]}});})[_0x8d3d('0x2c')](function(_0x4e0ce4){socket['emit'](_0x8d3d('0xc6'),{'id':Number(_0x214955[_0x8d3d('0xb8')]['id']),'tags':_0x4e0ce4||[]});return{'id':Number(_0x214955[_0x8d3d('0xb8')]['id']),'tags':_0x4e0ce4||[]};});}})[_0x8d3d('0x2c')](respondWithResult(_0x5e18e2,null))[_0x8d3d('0x38')](handleError(_0x5e18e2,null));};exports[_0x8d3d('0xc7')]=function(_0x44da83,_0x3ec0c3,_0x36634b){return db[_0x8d3d('0x3a')][_0x8d3d('0x60')]({'where':{'id':_0x44da83[_0x8d3d('0xb8')]['id']}})[_0x8d3d('0x2c')](handleEntityNotFound(_0x3ec0c3,null))[_0x8d3d('0x2c')](function(_0x35a82c){if(_0x35a82c){return _0x35a82c['removeTags'](_0x44da83[_0x8d3d('0x3d')][_0x8d3d('0xbc')]);}})['then'](respondWithStatusCode(_0x3ec0c3,null))[_0x8d3d('0x38')](handleError(_0x3ec0c3,null));};exports[_0x8d3d('0xc8')]=function(_0x41f91d,_0x18d73e){var _0x3154c0=moment()[_0x8d3d('0xc9')]()[_0x8d3d('0x9b')]();var _0x43ba64=path[_0x8d3d('0xca')](config[_0x8d3d('0xcb')],_0x8d3d('0xcc'),'files',_0x8d3d('0xcd'));var _0x5bb11c=path['join'](config[_0x8d3d('0xcb')],_0x8d3d('0xcc'),_0x8d3d('0xce'),_0x8d3d('0xcf'));var _0x4de9ed=path[_0x8d3d('0xca')](_0x43ba64,_0x3154c0);var _0x4c9c5f=util[_0x8d3d('0xc1')](_0x8d3d('0xd0'),_0x41f91d['params']['id'],_0x3154c0);var _0x4c47ce=path['join'](_0x43ba64,_0x4c9c5f);var _0x53f6ad=[];_0x53f6ad[_0x8d3d('0x37')]({'model':db[_0x8d3d('0x72')],'as':_0x8d3d('0x72'),'attributes':['id','fullname'],'raw':!![]});_0x53f6ad[_0x8d3d('0x37')]({'model':db['CmContact'],'as':_0x8d3d('0x64'),'attributes':['id',_0x8d3d('0xd1'),_0x8d3d('0xd2')],'raw':!![]});var _0xf85ba9=[{'model':db[_0x8d3d('0xbb')],'as':'Messages','attributes':['id','body','createdAt',_0x8d3d('0xd3'),_0x8d3d('0xd4'),'read'],'include':_0x53f6ad}];_0xf85ba9[_0x8d3d('0x37')]({'model':db[_0x8d3d('0xd5')],'as':_0x8d3d('0xd6'),'attributes':['id',_0x8d3d('0x2f')]});_0xf85ba9[_0x8d3d('0x37')]({'model':db[_0x8d3d('0x72')],'as':'Owner','attributes':['id',_0x8d3d('0x32')]});return db[_0x8d3d('0x3a')]['find']({'where':{'id':_0x41f91d[_0x8d3d('0xb8')]['id']},'include':_0xf85ba9})[_0x8d3d('0x2c')](handleEntityNotFound(_0x18d73e,null))[_0x8d3d('0x2c')](function(_0xfe9531){if(_0xfe9531){var _0x4d6998=_0xfe9531[_0x8d3d('0xd7')]({'plain':!![]});fs[_0x8d3d('0xd8')](_0x4de9ed);var _0x5c515c={'channel':_0x8d3d('0xd9'),'account':_0x4d6998[_0x8d3d('0xd6')][_0x8d3d('0x2f')],'agent':_0x4d6998['Owner']?_0x4d6998[_0x8d3d('0xda')][_0x8d3d('0x32')]:_0x8d3d('0xdb'),'createdAt':moment(_0x4d6998['createdAt'])[_0x8d3d('0xc1')](_0x8d3d('0xdc'))[_0x8d3d('0x9b')](),'closedAt':_0x4d6998[_0x8d3d('0xdd')]?moment(_0x4d6998['closedAt'])[_0x8d3d('0xc1')](_0x8d3d('0xdc'))[_0x8d3d('0x9b')]():'','disposition':_0x4d6998[_0x8d3d('0xde')],'messages':_(_0x4d6998['Messages'])[_0x8d3d('0x82')]({'secret':![]})[_0x8d3d('0x31')](function(_0x3017be){return{'date':moment(_0x3017be['createdAt'])[_0x8d3d('0xc1')](_0x8d3d('0xdc'))['toString'](),'sender':_0x3017be[_0x8d3d('0xd3')]===_0x8d3d('0xdf')?_0x3017be['User']?_0x3017be[_0x8d3d('0x72')]['fullname']:'System':_0x3017be[_0x8d3d('0x64')][_0x8d3d('0xd1')]+(_0x3017be[_0x8d3d('0x64')][_0x8d3d('0xd2')]?'\x20'+_0x3017be[_0x8d3d('0x64')][_0x8d3d('0xd2')]:''),'body':_0x3017be['body'],'direction':_0x3017be['direction']==='out'?'A':'C','secret':_0x3017be['secret'],'read':_0x3017be[_0x8d3d('0x7e')]};})[_0x8d3d('0x69')]()};return ejs[_0x8d3d('0xe0')](path[_0x8d3d('0xca')](config['root'],_0x8d3d('0xcc'),_0x8d3d('0xe1'),'downloadInteraction.ejs'),{'interaction':_0x5c515c})[_0x8d3d('0x2c')](function(_0x4fe862){var _0xd3140f=path['join'](_0x4de9ed,_0x8d3d('0xe2')+_0x4d6998['id']+'-'+_0x3154c0+_0x8d3d('0xe3'));var _0xed34ce={'path':_0xd3140f,'channel':'Sms','interactionId':_0x4d6998['id']};return pdf['createPdfFromHTML'](_0x4fe862,_0xed34ce);})[_0x8d3d('0x2c')](function(){return new BPromise(function(_0x34b387,_0x3cb10c){zipdir(_0x4de9ed,{'saveTo':_0x4c47ce},function(_0x1fc7d1,_0x3fd702){if(_0x1fc7d1)return _0x3cb10c(_0x1fc7d1);return _0x34b387(_0x3fd702);});})[_0x8d3d('0x2c')](function(){return new BPromise(function(_0x27f914,_0x656f2f){rimraf(_0x4de9ed,function(_0x570d02){if(_0x570d02)_0x656f2f(_0x570d02);return _0x27f914();});});})[_0x8d3d('0x2c')](function(){return _0x18d73e[_0x8d3d('0xc8')](_0x4c47ce,_0x4c9c5f,function(_0x3b7682){if(_0x3b7682){console[_0x8d3d('0xe4')](_0x8d3d('0xe5'),_0x3b7682);}else{fs['unlinkSync'](_0x4c47ce);}});});});}else{return _0x18d73e[_0x8d3d('0x1f')](0xc8);}})[_0x8d3d('0x38')](handleError(_0x18d73e,null));}; \ No newline at end of file +var _0xfa6d=['i.SmsAccountId\x20IS\x20NULL','agent','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','show','params','includeAll','include','create','update','describe','ids','omit','getMessages','findOne','SmsMessage','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','smsInteractionTags:save','removeTags','download','unix','root','tmp','join','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closed','closedAt','disposition','out','renderFile','server','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','reject','save','destroy','end','error','stack','name','send','Users','fullname','TagIds','Tags','then','catch','index','map','SmsInteraction','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','t.id\x20IN\x20?','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfa6d,0x14a));var _0xdfa6=function(_0x458464,_0x53049c){_0x458464=_0x458464-0x0;var _0x24704c=_0xfa6d[_0x458464];return _0x24704c;};'use strict';var emlformat=require(_0xdfa6('0x0'));var rimraf=require(_0xdfa6('0x1'));var zipdir=require(_0xdfa6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdfa6('0x3'));var moment=require(_0xdfa6('0x4'));var BPromise=require(_0xdfa6('0x5'));var Mustache=require(_0xdfa6('0x6'));var util=require('util');var path=require(_0xdfa6('0x7'));var sox=require(_0xdfa6('0x8'));var csv=require(_0xdfa6('0x9'));var ejs=require(_0xdfa6('0xa'));var fs=require('fs');var fs_extra=require(_0xdfa6('0xb'));var _=require(_0xdfa6('0xc'));var squel=require(_0xdfa6('0xd'));var crypto=require(_0xdfa6('0xe'));var jsforce=require(_0xdfa6('0xf'));var deskjs=require(_0xdfa6('0x10'));var toCsv=require(_0xdfa6('0x9'));var querystring=require(_0xdfa6('0x11'));var Papa=require(_0xdfa6('0x12'));var Redis=require(_0xdfa6('0x13'));var authService=require(_0xdfa6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xdfa6('0x15'));var pdf=require(_0xdfa6('0x16'));var hardwareService=require(_0xdfa6('0x17'));var logger=require(_0xdfa6('0x18'))(_0xdfa6('0x19'));var utils=require(_0xdfa6('0x1a'));var config=require(_0xdfa6('0x1b'));var licenseUtil=require(_0xdfa6('0x1c'));var db=require(_0xdfa6('0x1d'))['db'];config[_0xdfa6('0x1e')]=_[_0xdfa6('0x1f')](config[_0xdfa6('0x1e')],{'host':_0xdfa6('0x20'),'port':0x18eb});var socket=require(_0xdfa6('0x21'))(new Redis(config['redis']));require(_0xdfa6('0x22'))[_0xdfa6('0x23')](socket);function respondWithStatusCode(_0x180f58,_0x4c5f52){_0x4c5f52=_0x4c5f52||0xcc;return function(_0x5d0ecb){if(_0x5d0ecb){return _0x180f58[_0xdfa6('0x24')](_0x4c5f52);}return _0x180f58['status'](_0x4c5f52)['end']();};}function respondWithResult(_0xb6d475,_0x1f2abf){_0x1f2abf=_0x1f2abf||0xc8;return function(_0x2e7989){if(_0x2e7989){return _0xb6d475[_0xdfa6('0x25')](_0x1f2abf)[_0xdfa6('0x26')](_0x2e7989);}};}function respondWithFilteredResult(_0x2f1291,_0x9dc747){return function(_0x23adbc){if(_0x23adbc){var _0x5f1cb7=typeof _0x9dc747['offset']==='undefined'&&typeof _0x9dc747[_0xdfa6('0x27')]===_0xdfa6('0x28');var _0x163225=_0x23adbc['count'];var _0x38f820=_0x5f1cb7?0x0:_0x9dc747[_0xdfa6('0x29')];var _0x45d7ba=_0x5f1cb7?_0x23adbc[_0xdfa6('0x2a')]:_0x9dc747[_0xdfa6('0x29')]+_0x9dc747[_0xdfa6('0x27')];var _0x2af8e2;if(_0x45d7ba>=_0x163225){_0x45d7ba=_0x163225;_0x2af8e2=0xc8;}else{_0x2af8e2=0xce;}_0x2f1291[_0xdfa6('0x25')](_0x2af8e2);return _0x2f1291[_0xdfa6('0x2b')](_0xdfa6('0x2c'),_0x38f820+'-'+_0x45d7ba+'/'+_0x163225)[_0xdfa6('0x26')](_0x23adbc);}return null;};}function patchUpdates(_0x3d67f3){return function(_0x272a5d){try{jsonpatch['apply'](_0x272a5d,_0x3d67f3,!![]);}catch(_0x4c2892){return BPromise[_0xdfa6('0x2d')](_0x4c2892);}return _0x272a5d[_0xdfa6('0x2e')]();};}function saveUpdates(_0x1b7380,_0x147b3e){return function(_0x15ef48){if(_0x15ef48){return _0x15ef48['update'](_0x1b7380)['then'](function(_0x3e9246){return _0x3e9246;});}return null;};}function removeEntity(_0x387b11,_0x4a6c8a){return function(_0x3ab314){if(_0x3ab314){return _0x3ab314[_0xdfa6('0x2f')]()['then'](function(){_0x387b11[_0xdfa6('0x25')](0xcc)[_0xdfa6('0x30')]();});}};}function handleEntityNotFound(_0x2f42b3,_0x41691f){return function(_0x75d226){if(!_0x75d226){_0x2f42b3[_0xdfa6('0x24')](0x194);}return _0x75d226;};}function handleError(_0x13d20c,_0xa0675){_0xa0675=_0xa0675||0x1f4;return function(_0x396742){logger[_0xdfa6('0x31')](_0x396742[_0xdfa6('0x32')]);if(_0x396742[_0xdfa6('0x33')]){delete _0x396742['name'];}_0x13d20c[_0xdfa6('0x25')](_0xa0675)[_0xdfa6('0x34')](_0x396742);};}function getInteractionUsers(_0x2a1e52,_0x313be6){return new BPromise(function(_0x2f3a84,_0x3a7924){try{if(_0x313be6[_0x2a1e52['id']]){_0x2a1e52[_0xdfa6('0x35')]=_['map'](_0x313be6[_0x2a1e52['id']],function(_0x15d692){return{'id':_0x15d692['id'],'fullname':_0x15d692[_0xdfa6('0x36')]};});}}catch(_0x3166e0){_0x3a7924(_0x3166e0);}_0x2f3a84(_0x2a1e52);});}function getInteractionTags(_0x58f18f,_0x429502){return new BPromise(function(_0x3633ed,_0x44a402){try{if(_0x58f18f[_0xdfa6('0x37')]){_0x58f18f[_0xdfa6('0x38')]=[];_0x58f18f['TagIds']['split'](',')['forEach'](function(_0x3e1483){_0x58f18f['Tags']['push'](_0x429502[_0x3e1483]);});}delete _0x58f18f['TagIds'];}catch(_0x172765){_0x44a402(_0x172765);}_0x3633ed(_0x58f18f);});}function updateSmsInteraction(_0x4dac0a,_0x295c78,_0x86a486){return new BPromise(function(_0x192ff7,_0x504472){return getInteractionUsers(_0x4dac0a,_0x86a486)[_0xdfa6('0x39')](function(_0x67a65c){return getInteractionTags(_0x67a65c,_0x295c78);})[_0xdfa6('0x39')](function(_0x2127a6){_0x192ff7(_0x2127a6);})[_0xdfa6('0x3a')](function(_0x10253a){_0x504472(_0x10253a);});});}exports[_0xdfa6('0x3b')]=function(_0x18f781,_0x148335){var _0x370994={},_0x550fb3={},_0x4163af={'count':0x0,'rows':[]};var _0x4b925c=_[_0xdfa6('0x3c')](db[_0xdfa6('0x3d')][_0xdfa6('0x3e')],function(_0xa90a41){return{'name':_0xa90a41['fieldName'],'type':_0xa90a41[_0xdfa6('0x3f')][_0xdfa6('0x40')]};});_0x550fb3[_0xdfa6('0x41')]=_[_0xdfa6('0x3c')](_0x4b925c,'name');_0x550fb3[_0xdfa6('0x42')]=_[_0xdfa6('0x43')](_0x18f781['query']);_0x550fb3['filters']=_[_0xdfa6('0x44')](_0x550fb3[_0xdfa6('0x41')],_0x550fb3[_0xdfa6('0x42')]);_0x370994[_0xdfa6('0x45')]=_['intersection'](_0x550fb3[_0xdfa6('0x41')],qs[_0xdfa6('0x46')](_0x18f781[_0xdfa6('0x42')][_0xdfa6('0x46')]));_0x370994['attributes']=_0x370994[_0xdfa6('0x45')][_0xdfa6('0x47')]?_0x370994[_0xdfa6('0x45')]:_0x550fb3[_0xdfa6('0x41')];if(!_0x18f781[_0xdfa6('0x42')][_0xdfa6('0x48')](_0xdfa6('0x49'))){_0x370994[_0xdfa6('0x27')]=qs['limit'](_0x18f781[_0xdfa6('0x42')][_0xdfa6('0x27')]);_0x370994[_0xdfa6('0x29')]=qs['offset'](_0x18f781[_0xdfa6('0x42')][_0xdfa6('0x29')]);}_0x370994['order']=qs[_0xdfa6('0x4a')](_0x18f781[_0xdfa6('0x42')][_0xdfa6('0x4a')]);_0x370994[_0xdfa6('0x4b')]=qs[_0xdfa6('0x4c')](_['pick'](_0x18f781[_0xdfa6('0x42')],_0x550fb3['filters']),_0x4b925c);var _0x36721e=[];var _0x3111c2=squel[_0xdfa6('0x4d')]()[_0xdfa6('0x4e')]('id')[_0xdfa6('0x4e')](_0xdfa6('0x33'))[_0xdfa6('0x4e')](_0xdfa6('0x4f'))[_0xdfa6('0x50')](_0xdfa6('0x51'));var _0x284e90=squel['select']()[_0xdfa6('0x4e')](_0xdfa6('0x52'))[_0xdfa6('0x4e')](_0xdfa6('0x53'))[_0xdfa6('0x4e')](_0xdfa6('0x54'))[_0xdfa6('0x50')](_0xdfa6('0x55'),'ui')['left_join'](_0xdfa6('0x56'),'u',_0xdfa6('0x57'));var _0x5caebc=squel[_0xdfa6('0x4d')]()[_0xdfa6('0x50')]('sms_interactions','i')[_0xdfa6('0x58')](_0xdfa6('0x59'),'c',_0xdfa6('0x5a'))[_0xdfa6('0x58')](_0xdfa6('0x56'),'o',_0xdfa6('0x5b'))['left_join'](_0xdfa6('0x5c'),'a',_0xdfa6('0x5d'))[_0xdfa6('0x58')](_0xdfa6('0x5e'),'me',_0xdfa6('0x5f'))[_0xdfa6('0x58')](_0xdfa6('0x60'),'it',_0xdfa6('0x61'))['left_join'](_0xdfa6('0x51'),'t',_0xdfa6('0x62'));var _0x474e1a=squel[_0xdfa6('0x63')]();var _0x2759ce=[];var _0x5f1e74=squel[_0xdfa6('0x63')]();var _0x2de9b6;if(_0x18f781[_0xdfa6('0x42')]['search']){_0x2de9b6=as[_0xdfa6('0x64')](_0x18f781[_0xdfa6('0x42')][_0xdfa6('0x65')]);var _0x489993=_0x2de9b6[_0xdfa6('0x66')];for(var _0x554f04=0x0;_0x554f04<_0x2de9b6[_0xdfa6('0x67')][_0xdfa6('0x47')];_0x554f04++){var _0x49c1a5=_0x2de9b6[_0xdfa6('0x67')][_0x554f04];var _0x2a7986='i';var _0x59207f=_[_0xdfa6('0x68')](_0x4b925c,[_0xdfa6('0x33'),_0x49c1a5[_0xdfa6('0x4e')]]);if(!_0x59207f){switch(_0x49c1a5[_0xdfa6('0x4e')]){case'unreadMessages':if(_0x49c1a5[_0xdfa6('0x69')]==0x1){_0x5caebc[_0xdfa6('0x6a')]('`'+_0x49c1a5[_0xdfa6('0x4e')]+_0xdfa6('0x6b'));}else{_0x5caebc[_0xdfa6('0x6a')]('`'+_0x49c1a5['field']+_0xdfa6('0x6c'));}break;case _0xdfa6('0x6d'):if(_0x49c1a5['operator']===_0xdfa6('0x6e')){if(_0x49c1a5['value'][_0xdfa6('0x6f')]('\x20')[_0xdfa6('0x47')]>0x1){_0x474e1a[_0x489993](_0xdfa6('0x70'),qs['getFullTextValue'](_0x49c1a5['value']),null);}else{var _0x44ae34='%'+_0x49c1a5[_0xdfa6('0x69')]+'%';_0x474e1a[_0x489993]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x44ae34,_0x44ae34,_0x44ae34);}}else{_0x59207f=_[_0xdfa6('0x68')](_0x4b925c,[_0xdfa6('0x33'),'ContactId']);_0x49c1a5['field']=_0xdfa6('0x71');_0x5dd069=as[_0xdfa6('0x72')](_0x2a7986,_0x59207f[_0xdfa6('0x3f')],_0x49c1a5);_0x474e1a[_0x489993](_0x5dd069['text'],_0x5dd069[_0xdfa6('0x69')][_0xdfa6('0x73')],_0x5dd069[_0xdfa6('0x69')]['end']);}break;case _0xdfa6('0x74'):var _0x5f23ac=_0x49c1a5[_0xdfa6('0x69')][_0xdfa6('0x6f')](',')[_0xdfa6('0x3c')](function(_0xb857ce){return Number(_0xb857ce);});_0x5f23ac[_0xdfa6('0x75')](function(_0x21c753){_0x5f1e74['or'](_0xdfa6('0x76'),'%,'+_0x21c753+',%');});_0x2759ce=_[_0xdfa6('0x77')](_0x2759ce,_0x5f23ac);break;case _0xdfa6('0x78'):if(_0x49c1a5['operator']===_0xdfa6('0x6e')){_0x474e1a[_0x489993](_0xdfa6('0x79'),'%'+_0x49c1a5[_0xdfa6('0x69')]+'%',null);}else{_0x59207f=_['find'](_0x4b925c,[_0xdfa6('0x33'),_0xdfa6('0x7a')]);_0x49c1a5[_0xdfa6('0x4e')]=_0xdfa6('0x7a');_0x5dd069=as['buildExpression'](_0x2a7986,_0x59207f[_0xdfa6('0x3f')],_0x49c1a5);_0x474e1a[_0x489993](_0x5dd069[_0xdfa6('0x7b')],_0x5dd069['value']['start'],_0x5dd069[_0xdfa6('0x69')][_0xdfa6('0x30')]);}break;case _0xdfa6('0x7c'):_0x5dd069=as[_0xdfa6('0x72')]('me',null,_0x49c1a5);_0x474e1a[_0x489993](_0x5dd069['text'],_0x5dd069[_0xdfa6('0x69')][_0xdfa6('0x73')],_0x5dd069[_0xdfa6('0x69')][_0xdfa6('0x30')]);break;}}else{var _0x5dd069=as['buildExpression'](_0x2a7986,_0x59207f[_0xdfa6('0x3f')],_0x49c1a5);_0x474e1a[_0x489993](_0x5dd069[_0xdfa6('0x7b')],_0x5dd069[_0xdfa6('0x69')][_0xdfa6('0x73')],_0x5dd069['value'][_0xdfa6('0x30')]);}}}else{var _0x5c8984=_(_0x18f781['query'])[_0xdfa6('0x43')]()[_0xdfa6('0x3c')](function(_0x17b29e){return _[_0xdfa6('0x7d')](_0x4b925c,[_0xdfa6('0x33'),_0x17b29e])?_0x17b29e:undefined;})[_0xdfa6('0x7e')]()[_0xdfa6('0x69')]();if(!_[_0xdfa6('0x7f')](_0x5c8984)){_0x5c8984[_0xdfa6('0x75')](function(_0x2f8d00){if(_0x2f8d00==='SmsAccountId'){_0x5caebc[_0xdfa6('0x4b')](_0xdfa6('0x80'),[][_0xdfa6('0x81')](_0x18f781[_0xdfa6('0x42')][_0x2f8d00]));}else if(_0x2f8d00===_0xdfa6('0x82')){var _0x2a55dc=JSON[_0xdfa6('0x83')](_0x18f781[_0xdfa6('0x42')][_0x2f8d00])['$gte'];var _0x37fe1c=JSON[_0xdfa6('0x83')](_0x18f781[_0xdfa6('0x42')][_0x2f8d00])[_0xdfa6('0x84')];_0x5caebc[_0xdfa6('0x4b')](_0xdfa6('0x85'),_0x2a55dc,_0x37fe1c);}else{if(_0x18f781[_0xdfa6('0x42')][_0x2f8d00]===_0xdfa6('0x86')){_0x5caebc[_0xdfa6('0x4b')]('i.'+_0x2f8d00+'\x20IS\x20NULL');}else{_0x5caebc[_0xdfa6('0x4b')]('i.'+_0x2f8d00+_0xdfa6('0x87'),_0x18f781['query'][_0x2f8d00]);}}});}if(_0x18f781['query'][_0xdfa6('0x88')]){if(_0x18f781[_0xdfa6('0x42')][_0xdfa6('0x88')]==0x1){_0x5caebc['having']('`unreadMessages`\x20=\x200');}else{_0x5caebc['having'](_0xdfa6('0x89'));}}if(_0x18f781[_0xdfa6('0x42')]['tag']){_0x2759ce=_[_0xdfa6('0x8a')](_0x18f781[_0xdfa6('0x42')][_0xdfa6('0x8b')])?_0x18f781['query'][_0xdfa6('0x8b')]:new Array(_0x18f781[_0xdfa6('0x42')][_0xdfa6('0x8b')]);_0x2759ce[_0xdfa6('0x75')](function(_0xcba439){_0x5f1e74['or'](_0xdfa6('0x76'),'%,'+_0xcba439+',%');});}if(_0x18f781['query'][_0xdfa6('0x8c')]){var _0x1c87fb=_0x18f781[_0xdfa6('0x42')][_0xdfa6('0x8c')][_0xdfa6('0x8d')]('\x5c','\x5c\x5c')[_0xdfa6('0x8d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1c87fb)){_0x474e1a['or'](_0xdfa6('0x8e'),_0x1c87fb+'%')['or'](_0xdfa6('0x8f'),_0x1c87fb+'%');}else{_0x474e1a['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xdfa6('0x90')](_0x1c87fb))['or'](_0xdfa6('0x91'),_0x1c87fb+'%');}}}_0x5caebc[_0xdfa6('0x4b')](_0x474e1a);_0x5caebc['group']('i.id');var _0x3197db={'type':db[_0xdfa6('0x92')]['QueryTypes'][_0xdfa6('0x93')],'raw':!![]};var _0x2690ed=_0x5caebc['clone']();_0x2690ed[_0xdfa6('0x4e')](_0xdfa6('0x94'));_0x2690ed[_0xdfa6('0x4e')](_0xdfa6('0x95'),_0xdfa6('0x96'));if(_0x370994[_0xdfa6('0x97')]){_0x370994[_0xdfa6('0x97')][_0xdfa6('0x75')](function(_0x2db52d){var _0xe3c4bf=_0x2db52d[0x0]===_0xdfa6('0x98')?_0x2db52d[0x0]:'i.'+_0x2db52d[0x0];_0x5caebc[_0xdfa6('0x97')](_0xe3c4bf,_0x2db52d[0x1]==='DESC'?![]:!![]);});}if(!_[_0xdfa6('0x7f')](_0x2759ce)){_0x5caebc['having'](_0x5f1e74);_0x2690ed['where'](_0xdfa6('0x99'),_0x2759ce);}BPromise['resolve']()[_0xdfa6('0x39')](function(){if(!_0x2de9b6){if(_0x18f781[_0xdfa6('0x42')][_0xdfa6('0x9a')])return;_0x2690ed[_0xdfa6('0x4b')](_0xdfa6('0x9b'));_0x5caebc[_0xdfa6('0x4b')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x18f781[_0xdfa6('0x9c')]['role']!=='agent')return;return _0x18f781['user'][_0xdfa6('0x9d')]({'attributes':['id'],'raw':!![]})[_0xdfa6('0x39')](function(_0x5b7816){if(_[_0xdfa6('0x7f')](_0x5b7816)){_0x2690ed['where'](_0xdfa6('0x9e'));_0x5caebc[_0xdfa6('0x4b')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x2690ed[_0xdfa6('0x4b')](_0xdfa6('0x80'),_[_0xdfa6('0x3c')](_0x5b7816,'id'));_0x5caebc['where']('i.SmsAccountId\x20IN\x20?',_[_0xdfa6('0x3c')](_0x5b7816,'id'));}});})[_0xdfa6('0x39')](function(){if(_0x18f781[_0xdfa6('0x9c')]['role']===_0xdfa6('0x9f')&&!_0x2de9b6&&!_0x18f781[_0xdfa6('0x42')][_0xdfa6('0x9a')])return[];return db[_0xdfa6('0xa0')][_0xdfa6('0x42')](_0x2690ed[_0xdfa6('0xa1')](),_0x3197db);})[_0xdfa6('0x39')](function(_0x451c9e){_0x4163af[_0xdfa6('0x2a')]=_0x451c9e[_0xdfa6('0x47')];if(_0x4163af[_0xdfa6('0x2a')]===0x0)return[];return db[_0xdfa6('0xa0')][_0xdfa6('0x42')](_0x3111c2[_0xdfa6('0xa1')](),_0x3197db)[_0xdfa6('0x39')](function(_0x3eb3a6){_0x36721e=_['keyBy'](_0x3eb3a6,'id');_0x3197db=_[_0xdfa6('0xa2')](_0x3197db,{'model':db[_0xdfa6('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x18f781[_0xdfa6('0x42')][_0xdfa6('0x46')]){_0x370994[_0xdfa6('0x45')][_0xdfa6('0x75')](function(_0x44d3b3){_0x5caebc[_0xdfa6('0x4e')]('i.'+_0x44d3b3);});}else{_0x5caebc[_0xdfa6('0x4e')](_0xdfa6('0x95'),_0xdfa6('0x96'));_0x5caebc[_0xdfa6('0x4e')](_0xdfa6('0xa3'),_0xdfa6('0xa4'));_0x5caebc['field'](_0xdfa6('0xa5'),_0xdfa6('0xa6'));_0x5caebc['field'](_0xdfa6('0xa7'),_0xdfa6('0x98'));_0x5caebc[_0xdfa6('0x4e')](_0xdfa6('0xa8'));_0x5caebc[_0xdfa6('0x4e')]('c.firstName',_0xdfa6('0xa9'));_0x5caebc[_0xdfa6('0x4e')](_0xdfa6('0xaa'),_0xdfa6('0xab'));_0x5caebc['field']('c.email',_0xdfa6('0xac'));_0x5caebc[_0xdfa6('0x4e')](_0xdfa6('0xad'),_0xdfa6('0xae'));_0x5caebc['field'](_0xdfa6('0xaf'),_0xdfa6('0xb0'));_0x5caebc[_0xdfa6('0x4e')](_0xdfa6('0xb1'),_0xdfa6('0xb2'));_0x5caebc[_0xdfa6('0x4e')](_0xdfa6('0xb3'),_0xdfa6('0xb4'));_0x5caebc[_0xdfa6('0x4e')](_0xdfa6('0xb5'),_0xdfa6('0xb6'));_0x5caebc['field'](_0xdfa6('0xb7'),_0xdfa6('0x37'));}if(_0x370994['limit'])_0x5caebc[_0xdfa6('0x27')](_0x370994[_0xdfa6('0x27')]);if(_0x370994['offset'])_0x5caebc[_0xdfa6('0x29')](_0x370994[_0xdfa6('0x29')]);return db[_0xdfa6('0xa0')][_0xdfa6('0x42')](_0x5caebc[_0xdfa6('0xa1')](),_0x3197db);})['then'](function(_0x5b29b2){if(_0x5b29b2[_0xdfa6('0x47')]>0x0)_0x284e90['where'](_0xdfa6('0xb8'),_['map'](_0x5b29b2,'id'));return db['sequelize'][_0xdfa6('0x42')](_0x284e90[_0xdfa6('0xa1')](),_0x3197db)[_0xdfa6('0x39')](function(_0x373b3b){var _0x4eac18=_[_0xdfa6('0xb9')](_0x373b3b,_0xdfa6('0xba'));var _0x3392c7=[];_0x5b29b2[_0xdfa6('0x75')](function(_0xdfc1ee){_0x3392c7[_0xdfa6('0xbb')](updateSmsInteraction(_0xdfc1ee,_0x36721e,_0x4eac18));});return BPromise[_0xdfa6('0xbc')](_0x3392c7);});});})[_0xdfa6('0x39')](function(_0xc9bdb4){_0x4163af[_0xdfa6('0xbd')]=_0xc9bdb4;return _0x4163af;})[_0xdfa6('0x39')](respondWithFilteredResult(_0x148335,_0x370994))[_0xdfa6('0x3a')](handleError(_0x148335,null));};exports[_0xdfa6('0xbe')]=function(_0x33a5e2,_0x3b4cb8){var _0x54dd65={'raw':![],'where':{'id':_0x33a5e2[_0xdfa6('0xbf')]['id']}},_0x29f424={};_0x29f424[_0xdfa6('0x41')]=_[_0xdfa6('0x43')](db[_0xdfa6('0x3d')][_0xdfa6('0x3e')]);_0x29f424[_0xdfa6('0x42')]=_[_0xdfa6('0x43')](_0x33a5e2[_0xdfa6('0x42')]);_0x29f424[_0xdfa6('0x4c')]=_[_0xdfa6('0x44')](_0x29f424[_0xdfa6('0x41')],_0x29f424[_0xdfa6('0x42')]);_0x54dd65['attributes']=_[_0xdfa6('0x44')](_0x29f424['model'],qs['fields'](_0x33a5e2[_0xdfa6('0x42')][_0xdfa6('0x46')]));_0x54dd65[_0xdfa6('0x45')]=_0x54dd65['attributes']['length']?_0x54dd65[_0xdfa6('0x45')]:_0x29f424['model'];if(_0x33a5e2[_0xdfa6('0x42')][_0xdfa6('0xc0')]){_0x54dd65[_0xdfa6('0xc1')]=[{'all':!![]}];}_0x54dd65=_[_0xdfa6('0xa2')]({},_0x54dd65,_0x33a5e2['options']);return db[_0xdfa6('0x3d')][_0xdfa6('0x68')](_0x54dd65)['then'](handleEntityNotFound(_0x3b4cb8,null))[_0xdfa6('0x39')](respondWithResult(_0x3b4cb8,null))['catch'](handleError(_0x3b4cb8,null));};exports[_0xdfa6('0xc2')]=function(_0x1dfbd0,_0x18005d){return db[_0xdfa6('0x3d')][_0xdfa6('0xc2')](_0x1dfbd0[_0xdfa6('0x7c')],{})[_0xdfa6('0x39')](respondWithResult(_0x18005d,0xc9))['catch'](handleError(_0x18005d,null));};exports[_0xdfa6('0xc3')]=function(_0x2b7a14,_0x3df5f1){if(_0x2b7a14[_0xdfa6('0x7c')]['id']){delete _0x2b7a14[_0xdfa6('0x7c')]['id'];}return db[_0xdfa6('0x3d')][_0xdfa6('0x68')]({'where':{'id':_0x2b7a14[_0xdfa6('0xbf')]['id']}})['then'](handleEntityNotFound(_0x3df5f1,null))[_0xdfa6('0x39')](saveUpdates(_0x2b7a14[_0xdfa6('0x7c')],null))[_0xdfa6('0x39')](respondWithResult(_0x3df5f1,null))['catch'](handleError(_0x3df5f1,null));};exports[_0xdfa6('0x2f')]=function(_0x5c0762,_0x37da70){return db[_0xdfa6('0x3d')]['find']({'where':{'id':_0x5c0762['params']['id']}})[_0xdfa6('0x39')](handleEntityNotFound(_0x37da70,null))['then'](removeEntity(_0x37da70,null))[_0xdfa6('0x3a')](handleError(_0x37da70,null));};exports[_0xdfa6('0xc4')]=function(_0x5edf03,_0x9eabfe){return db[_0xdfa6('0x3d')][_0xdfa6('0xc4')]()[_0xdfa6('0x39')](respondWithResult(_0x9eabfe,null))[_0xdfa6('0x3a')](handleError(_0x9eabfe,null));};exports['addMessage']=function(_0x12d6cd,_0x8c2cfa,_0x2c5aa1){return db['SmsMessage'][_0xdfa6('0x68')]({'where':{'id':_0x12d6cd[_0xdfa6('0xbf')]['id']}})[_0xdfa6('0x39')](handleEntityNotFound(_0x8c2cfa,null))['then'](function(_0x42e45c){if(_0x42e45c){return _0x42e45c['addMessage'](_0x12d6cd[_0xdfa6('0x7c')][_0xdfa6('0xc5')],_[_0xdfa6('0xc6')](_0x12d6cd['body'],[_0xdfa6('0xc5'),'id'])||{});}})[_0xdfa6('0x39')](respondWithResult(_0x8c2cfa,null))[_0xdfa6('0x3a')](handleError(_0x8c2cfa,null));};exports[_0xdfa6('0xc7')]=function(_0x443d01,_0x4324bb,_0x2af9c9){var _0x2d2cc5={'raw':![],'where':{}};var _0x38f4f6={};var _0x5d847d={'count':0x0,'rows':[]};return db[_0xdfa6('0x3d')][_0xdfa6('0xc8')]({'where':{'id':_0x443d01['params']['id']}})[_0xdfa6('0x39')](handleEntityNotFound(_0x4324bb,null))['then'](function(_0x3475dc){if(_0x3475dc){_0x38f4f6[_0xdfa6('0x41')]=_[_0xdfa6('0x43')](db[_0xdfa6('0xc9')][_0xdfa6('0x3e')]);_0x38f4f6[_0xdfa6('0x42')]=_[_0xdfa6('0x43')](_0x443d01['query']);_0x38f4f6[_0xdfa6('0x4c')]=_[_0xdfa6('0x44')](_0x38f4f6[_0xdfa6('0x41')],_0x38f4f6['query']);_0x2d2cc5[_0xdfa6('0x45')]=_['intersection'](_0x38f4f6['model'],qs['fields'](_0x443d01[_0xdfa6('0x42')][_0xdfa6('0x46')]));_0x2d2cc5[_0xdfa6('0x45')]=_0x2d2cc5['attributes']['length']?_0x2d2cc5['attributes']:_0x38f4f6[_0xdfa6('0x41')];if(!_0x443d01[_0xdfa6('0x42')][_0xdfa6('0x48')](_0xdfa6('0x49'))){_0x2d2cc5[_0xdfa6('0x27')]=qs['limit'](_0x443d01[_0xdfa6('0x42')][_0xdfa6('0x27')]);_0x2d2cc5[_0xdfa6('0x29')]=qs['offset'](_0x443d01[_0xdfa6('0x42')][_0xdfa6('0x29')]);}_0x2d2cc5[_0xdfa6('0x97')]=qs[_0xdfa6('0x4a')](_0x443d01[_0xdfa6('0x42')][_0xdfa6('0x4a')]);_0x2d2cc5[_0xdfa6('0x4b')]=qs['filters'](_[_0xdfa6('0xca')](_0x443d01[_0xdfa6('0x42')],_0x38f4f6[_0xdfa6('0x4c')]));_0x2d2cc5[_0xdfa6('0x4b')][_0xdfa6('0xba')]=_0x3475dc['id'];if(_0x443d01[_0xdfa6('0x42')]['filter']){_0x2d2cc5['where']=_[_0xdfa6('0xa2')](_0x2d2cc5[_0xdfa6('0x4b')],{'$or':_[_0xdfa6('0x3c')](_0x2d2cc5[_0xdfa6('0x45')],function(_0x42f7aa){var _0x1f4d33={};_0x1f4d33[_0x42f7aa]={'$like':'%'+_0x443d01[_0xdfa6('0x42')][_0xdfa6('0x8c')]+'%'};return _0x1f4d33;})});}if(_0x443d01[_0xdfa6('0x42')][_0xdfa6('0xcb')]){var _0x267609=_0x443d01[_0xdfa6('0x42')]['$gte'][_0xdfa6('0x6f')](',');var _0x21009c={};_0x21009c[_0x267609[0x0]]={'$gte':moment(_0x267609[0x1])[_0xdfa6('0xcc')](_0xdfa6('0xcd'))};_0x2d2cc5['where']=_[_0xdfa6('0xa2')](_0x2d2cc5[_0xdfa6('0x4b')],_0x21009c);}_0x2d2cc5=_[_0xdfa6('0xa2')]({},_0x2d2cc5,_0x443d01[_0xdfa6('0xce')]);return db[_0xdfa6('0xc9')][_0xdfa6('0x2a')]({'where':_0x2d2cc5[_0xdfa6('0x4b')]})[_0xdfa6('0x39')](function(_0x4fec7a){_0x5d847d[_0xdfa6('0x2a')]=_0x4fec7a;if(_0x443d01[_0xdfa6('0x42')][_0xdfa6('0xc0')]){_0x2d2cc5[_0xdfa6('0xc1')]=[{'all':!![]}];}return db['SmsMessage'][_0xdfa6('0xcf')](_0x2d2cc5);})[_0xdfa6('0x39')](function(_0x23555c){_0x5d847d['rows']=_0x23555c;return _0x5d847d;});}})['then'](respondWithFilteredResult(_0x4324bb,_0x2d2cc5))[_0xdfa6('0x3a')](handleError(_0x4324bb,null));};exports[_0xdfa6('0xd0')]=function(_0x1c3a26,_0x3195c2,_0x4a1ab0){return db[_0xdfa6('0x3d')][_0xdfa6('0x68')]({'where':{'id':_0x1c3a26['params']['id']}})['then'](handleEntityNotFound(_0x3195c2,null))[_0xdfa6('0x39')](function(_0x1c5b23){if(_0x1c5b23){return _0x1c5b23[_0xdfa6('0xd1')](_0x1c3a26[_0xdfa6('0x7c')][_0xdfa6('0xc5')],_[_0xdfa6('0xc6')](_0x1c3a26[_0xdfa6('0x7c')],['ids','id'])||{})[_0xdfa6('0xd2')](function(){return db[_0xdfa6('0x74')]['findAll']({'attributes':['id','name',_0xdfa6('0x4f')],'where':{'id':_0x1c3a26[_0xdfa6('0x7c')][_0xdfa6('0xc5')]}});})[_0xdfa6('0x39')](function(_0x49a4ef){socket['emit'](_0xdfa6('0xd3'),{'id':Number(_0x1c3a26[_0xdfa6('0xbf')]['id']),'tags':_0x49a4ef||[]});return{'id':Number(_0x1c3a26[_0xdfa6('0xbf')]['id']),'tags':_0x49a4ef||[]};});}})[_0xdfa6('0x39')](respondWithResult(_0x3195c2,null))[_0xdfa6('0x3a')](handleError(_0x3195c2,null));};exports[_0xdfa6('0xd4')]=function(_0x212e55,_0x1fc73a,_0x25f464){return db[_0xdfa6('0x3d')][_0xdfa6('0x68')]({'where':{'id':_0x212e55[_0xdfa6('0xbf')]['id']}})[_0xdfa6('0x39')](handleEntityNotFound(_0x1fc73a,null))[_0xdfa6('0x39')](function(_0xb43bb0){if(_0xb43bb0){return _0xb43bb0[_0xdfa6('0xd4')](_0x212e55[_0xdfa6('0x42')][_0xdfa6('0xc5')]);}})[_0xdfa6('0x39')](respondWithStatusCode(_0x1fc73a,null))[_0xdfa6('0x3a')](handleError(_0x1fc73a,null));};exports[_0xdfa6('0xd5')]=function(_0x3fcd6f,_0x56a1a6){var _0x213834=moment()[_0xdfa6('0xd6')]()[_0xdfa6('0xa1')]();var _0x108168=path['join'](config[_0xdfa6('0xd7')],'server','files',_0xdfa6('0xd8'));var _0x33c531=path[_0xdfa6('0xd9')](config['root'],'server',_0xdfa6('0xda'),_0xdfa6('0xdb'));var _0x4629b9=path['join'](_0x108168,_0x213834);var _0x420c82=util[_0xdfa6('0xcc')](_0xdfa6('0xdc'),_0x3fcd6f[_0xdfa6('0xbf')]['id'],_0x213834);var _0x27808f=path[_0xdfa6('0xd9')](_0x108168,_0x420c82);var _0x788869=[];_0x788869['push']({'model':db['User'],'as':_0xdfa6('0x78'),'attributes':['id',_0xdfa6('0x36')],'raw':!![]});_0x788869[_0xdfa6('0xbb')]({'model':db[_0xdfa6('0xdd')],'as':_0xdfa6('0x6d'),'attributes':['id',_0xdfa6('0xde'),_0xdfa6('0xdf')],'raw':!![]});var _0x171c2e=[{'model':db[_0xdfa6('0xc9')],'as':_0xdfa6('0xe0'),'attributes':['id',_0xdfa6('0x7c'),_0xdfa6('0x82'),_0xdfa6('0xe1'),_0xdfa6('0xe2'),_0xdfa6('0x88')],'include':_0x788869}];_0x171c2e[_0xdfa6('0xbb')]({'model':db[_0xdfa6('0xe3')],'as':_0xdfa6('0xe4'),'attributes':['id','name']});_0x171c2e[_0xdfa6('0xbb')]({'model':db['User'],'as':_0xdfa6('0xe5'),'attributes':['id',_0xdfa6('0x36')]});return db[_0xdfa6('0x3d')][_0xdfa6('0x68')]({'where':{'id':_0x3fcd6f[_0xdfa6('0xbf')]['id']},'include':_0x171c2e})[_0xdfa6('0x39')](handleEntityNotFound(_0x56a1a6,null))[_0xdfa6('0x39')](function(_0x28cf17){if(_0x28cf17){var _0x4b285b=_0x28cf17[_0xdfa6('0xe6')]({'plain':!![]});fs[_0xdfa6('0xe7')](_0x4629b9);var _0x1f6c24={'channel':_0xdfa6('0xe8'),'account':_0x4b285b[_0xdfa6('0xe4')]['name'],'agent':_0x4b285b['Owner']?_0x4b285b[_0xdfa6('0xe5')][_0xdfa6('0x36')]:_0xdfa6('0xe9'),'createdAt':moment(_0x4b285b[_0xdfa6('0x82')])[_0xdfa6('0xcc')](_0xdfa6('0xcd'))[_0xdfa6('0xa1')](),'closedAt':_0x4b285b[_0xdfa6('0xea')]?moment(_0x4b285b[_0xdfa6('0xeb')])[_0xdfa6('0xcc')](_0xdfa6('0xcd'))[_0xdfa6('0xa1')]():'','disposition':_0x4b285b[_0xdfa6('0xec')],'messages':_(_0x4b285b['Messages'])[_0xdfa6('0x8c')]({'secret':![]})[_0xdfa6('0x3c')](function(_0x4414c7){return{'date':moment(_0x4414c7[_0xdfa6('0x82')])['format'](_0xdfa6('0xcd'))[_0xdfa6('0xa1')](),'sender':_0x4414c7[_0xdfa6('0xe1')]===_0xdfa6('0xed')?_0x4414c7[_0xdfa6('0x78')]?_0x4414c7[_0xdfa6('0x78')][_0xdfa6('0x36')]:'System':_0x4414c7[_0xdfa6('0x6d')][_0xdfa6('0xde')]+(_0x4414c7[_0xdfa6('0x6d')][_0xdfa6('0xdf')]?'\x20'+_0x4414c7[_0xdfa6('0x6d')][_0xdfa6('0xdf')]:''),'body':_0x4414c7[_0xdfa6('0x7c')],'direction':_0x4414c7['direction']===_0xdfa6('0xed')?'A':'C','secret':_0x4414c7[_0xdfa6('0xe2')],'read':_0x4414c7['read']};})[_0xdfa6('0x69')]()};return ejs[_0xdfa6('0xee')](path[_0xdfa6('0xd9')](config[_0xdfa6('0xd7')],_0xdfa6('0xef'),'views',_0xdfa6('0xf0')),{'interaction':_0x1f6c24})[_0xdfa6('0x39')](function(_0x57825b){var _0xdf8ba=path[_0xdfa6('0xd9')](_0x4629b9,'transcript-'+_0x4b285b['id']+'-'+_0x213834+_0xdfa6('0xf1'));var _0x533a50={'path':_0xdf8ba,'channel':_0xdfa6('0xe8'),'interactionId':_0x4b285b['id']};return pdf[_0xdfa6('0xf2')](_0x57825b,_0x533a50);})[_0xdfa6('0x39')](function(){return new BPromise(function(_0x11f0bf,_0x5129a0){zipdir(_0x4629b9,{'saveTo':_0x27808f},function(_0x1c7dc4,_0x4fb5cf){if(_0x1c7dc4)return _0x5129a0(_0x1c7dc4);return _0x11f0bf(_0x4fb5cf);});})[_0xdfa6('0x39')](function(){return new BPromise(function(_0x3959d8,_0xa4043d){rimraf(_0x4629b9,function(_0xfd20f0){if(_0xfd20f0)_0xa4043d(_0xfd20f0);return _0x3959d8();});});})['then'](function(){return _0x56a1a6[_0xdfa6('0xd5')](_0x27808f,_0x420c82,function(_0x37a7b2){if(_0x37a7b2){console['log'](_0xdfa6('0xf3'),_0x37a7b2);}else{fs['unlinkSync'](_0x27808f);}});});});}else{return _0x56a1a6[_0xdfa6('0x24')](0xc8);}})[_0xdfa6('0x3a')](handleError(_0x56a1a6,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 120ce04..04297d9 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 _0x056b=['hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x98f42e,_0x4d9cc2){var _0x748f97=function(_0x307a34){while(--_0x307a34){_0x98f42e['push'](_0x98f42e['shift']());}};_0x748f97(++_0x4d9cc2);}(_0x056b,0xb6));var _0xb056=function(_0x3ae516,_0x4b97c5){_0x3ae516=_0x3ae516-0x0;var _0x2b257a=_0x056b[_0x3ae516];return _0x2b257a;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xb056('0x0'))['db'][_0xb056('0x1')];var SmsMessage=require(_0xb056('0x0'))['db'][_0xb056('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xb056('0x3')](0x0);var events={'afterCreate':_0xb056('0x4'),'afterUpdate':_0xb056('0x5'),'afterDestroy':_0xb056('0x6')};function emitEvent(_0x343d88){return function(_0x2ff09d,_0x15a545,_0x515612){_0x2ff09d[_0xb056('0x7')]({'attributes':['id'],'raw':!![]})[_0xb056('0x8')](function(_0x3eae69){_0x2ff09d[_0xb056('0x9')](_0xb056('0xa'),_0x3eae69[_0xb056('0xb')](function(_0x539126){return{'id':_0x539126['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x2ff09d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb056('0x8')](function(_0x160c2a){_0x2ff09d[_0xb056('0x9')](_0xb056('0xc'),_0x160c2a['length']);SmsInteractionEvents[_0xb056('0xd')](_0x343d88+':'+_0x2ff09d['id'],_0x2ff09d);SmsInteractionEvents['emit'](_0x343d88,_0x2ff09d);_0x515612(null);})[_0xb056('0xe')](_0x515612(null));};}for(var e in events){if(events[_0xb056('0xf')](e)){var event=events[e];SmsInteraction[_0xb056('0x10')](e,emitEvent(event));}}module[_0xb056('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x93e9=['getUsers','then','setDataValue','map','findAll','unreadMessages','emit','hook','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save'];(function(_0x50a75c,_0x3bb4a8){var _0x3bb372=function(_0x3b6000){while(--_0x3b6000){_0x50a75c['push'](_0x50a75c['shift']());}};_0x3bb372(++_0x3bb4a8);}(_0x93e9,0xcc));var _0x993e=function(_0x4140da,_0x237574){_0x4140da=_0x4140da-0x0;var _0x174438=_0x93e9[_0x4140da];return _0x174438;};'use strict';var EventEmitter=require(_0x993e('0x0'));var SmsInteraction=require(_0x993e('0x1'))['db'][_0x993e('0x2')];var SmsMessage=require(_0x993e('0x1'))['db'][_0x993e('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x993e('0x4')](0x0);var events={'afterCreate':_0x993e('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b762e){return function(_0x255045,_0x15ce9b,_0x45f52e){_0x255045[_0x993e('0x6')]({'attributes':['id'],'raw':!![]})[_0x993e('0x7')](function(_0x12ac94){_0x255045[_0x993e('0x8')]('Users',_0x12ac94[_0x993e('0x9')](function(_0x69ff1){return{'id':_0x69ff1['id']};}));return SmsMessage[_0x993e('0xa')]({'where':{'SmsInteractionId':_0x255045['id'],'direction':'in','read':![]},'raw':!![]});})[_0x993e('0x7')](function(_0x2cd389){_0x255045[_0x993e('0x8')](_0x993e('0xb'),_0x2cd389['length']);SmsInteractionEvents[_0x993e('0xc')](_0x1b762e+':'+_0x255045['id'],_0x255045);SmsInteractionEvents[_0x993e('0xc')](_0x1b762e,_0x255045);_0x45f52e(null);})['catch'](_0x45f52e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x993e('0xd')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 36b3d3e..a552da2 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 _0x4636=['rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x13d42a,_0x34920f){var _0x35a80f=function(_0x888ee8){while(--_0x888ee8){_0x13d42a['push'](_0x13d42a['shift']());}};_0x35a80f(++_0x34920f);}(_0x4636,0x1d9));var _0x6463=function(_0x568b97,_0x2c4f8a){_0x568b97=_0x568b97-0x0;var _0x51067b=_0x4636[_0x568b97];return _0x51067b;};'use strict';var _=require(_0x6463('0x0'));var util=require(_0x6463('0x1'));var logger=require(_0x6463('0x2'))('api');var moment=require(_0x6463('0x3'));var BPromise=require(_0x6463('0x4'));var rp=require(_0x6463('0x5'));var fs=require('fs');var path=require(_0x6463('0x6'));var rimraf=require(_0x6463('0x7'));var config=require(_0x6463('0x8'));var attributes=require(_0x6463('0x9'));module[_0x6463('0xa')]=function(_0x3b4ddd,_0x24168d){return _0x3b4ddd['define'](_0x6463('0xb'),attributes,{'tableName':_0x6463('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x393c89,_0x1c485b,_0x29e58c){if(_0x393c89[_0x6463('0xd')]('closed')){_0x393c89[_0x6463('0xe')]=moment()['format'](_0x6463('0xf'));}_0x29e58c(null,_0x393c89);}}});}; \ No newline at end of file +var _0x6dfc=['bluebird','../../config/environment','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment'];(function(_0x4f4814,_0x44959d){var _0x179592=function(_0x33f18c){while(--_0x33f18c){_0x4f4814['push'](_0x4f4814['shift']());}};_0x179592(++_0x44959d);}(_0x6dfc,0x147));var _0xc6df=function(_0x1f11ac,_0x512c5b){_0x1f11ac=_0x1f11ac-0x0;var _0x5e2cd6=_0x6dfc[_0x1f11ac];return _0x5e2cd6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc6df('0x0'))(_0xc6df('0x1'));var moment=require(_0xc6df('0x2'));var BPromise=require(_0xc6df('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc6df('0x4'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x30fcb6,_0xcc48bb){return _0x30fcb6[_0xc6df('0x5')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x334909,_0x34a934,_0x267e08){if(_0x334909[_0xc6df('0x6')](_0xc6df('0x7'))){_0x334909[_0xc6df('0x8')]=moment()[_0xc6df('0x9')](_0xc6df('0xa'));}_0x267e08(null,_0x334909);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 7a57536..a7cb5b2 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 _0x75d3=['raw','where','attributes','limit','AddTagsToSmsInteraction','ids','omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','UpdateSmsInteraction','body','options'];(function(_0x1c5383,_0x5d9669){var _0x44a5a7=function(_0x5eb3f1){while(--_0x5eb3f1){_0x1c5383['push'](_0x1c5383['shift']());}};_0x44a5a7(++_0x5d9669);}(_0x75d3,0xf3));var _0x375d=function(_0x25fafc,_0x121966){_0x25fafc=_0x25fafc-0x0;var _0x42a243=_0x75d3[_0x25fafc];return _0x42a243;};'use strict';var _=require('lodash');var util=require(_0x375d('0x0'));var moment=require('moment');var BPromise=require(_0x375d('0x1'));var rs=require(_0x375d('0x2'));var fs=require('fs');var Redis=require(_0x375d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x375d('0x4'));var logger=require(_0x375d('0x5'))(_0x375d('0x6'));var config=require(_0x375d('0x7'));var jayson=require(_0x375d('0x8'));var client=jayson['client'][_0x375d('0x9')]({'port':0x232a});config[_0x375d('0xa')]=_['defaults'](config[_0x375d('0xa')],{'host':_0x375d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x375d('0xc'))[_0x375d('0xd')](socket);function respondWithRpcPromise(_0x36a7ee,_0x1a5971,_0x454e21){return new BPromise(function(_0x1e46a2,_0x25cd10){return client[_0x375d('0xe')](_0x36a7ee,_0x454e21)[_0x375d('0xf')](function(_0xdec7d3){logger[_0x375d('0x10')](_0x375d('0x11'),_0x1a5971,'request\x20sent');logger[_0x375d('0x12')](_0x375d('0x13'),_0x1a5971,'request\x20sent',JSON[_0x375d('0x14')](_0xdec7d3));if(_0xdec7d3[_0x375d('0x15')]){if(_0xdec7d3[_0x375d('0x15')][_0x375d('0x16')]===0x1f4){logger['error'](_0x375d('0x11'),_0x1a5971,_0xdec7d3[_0x375d('0x15')][_0x375d('0x17')]);return _0x25cd10(_0xdec7d3[_0x375d('0x15')]['message']);}logger[_0x375d('0x15')](_0x375d('0x11'),_0x1a5971,_0xdec7d3[_0x375d('0x15')]['message']);return _0x1e46a2(_0xdec7d3['error'][_0x375d('0x17')]);}else{logger['info'](_0x375d('0x11'),_0x1a5971,_0x375d('0x18'));_0x1e46a2(_0xdec7d3[_0x375d('0x19')][_0x375d('0x17')]);}})[_0x375d('0x1a')](function(_0x525d79){logger[_0x375d('0x15')](_0x375d('0x11'),_0x1a5971,_0x525d79);_0x25cd10(_0x525d79);});});}exports[_0x375d('0x1b')]=function(_0x535c83){var _0x1531ef=this;return new Promise(function(_0x5e89e1,_0x5e36f3){return db['SmsInteraction']['update'](_0x535c83[_0x375d('0x1c')],{'raw':_0x535c83[_0x375d('0x1d')]?_0x535c83[_0x375d('0x1d')][_0x375d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x535c83[_0x375d('0x1d')]?_0x535c83[_0x375d('0x1d')][_0x375d('0x1f')]||null:null,'attributes':_0x535c83[_0x375d('0x1d')]?_0x535c83['options'][_0x375d('0x20')]||null:null,'limit':_0x535c83['options']?_0x535c83['options'][_0x375d('0x21')]||null:null})[_0x375d('0xf')](function(_0x5127c8){logger[_0x375d('0x10')](_0x375d('0x1b'),_0x535c83);logger[_0x375d('0x12')](_0x375d('0x1b'),_0x535c83,JSON[_0x375d('0x14')](_0x5127c8));_0x5e89e1(_0x5127c8);})['catch'](function(_0x30339e){logger[_0x375d('0x15')]('UpdateSmsInteraction',_0x30339e[_0x375d('0x17')],_0x535c83);_0x5e36f3(_0x1531ef[_0x375d('0x15')](0x1f4,_0x30339e[_0x375d('0x17')]));});});};exports[_0x375d('0x22')]=function(_0x1a18a0){return new Promise(function(_0x1a9105,_0x504440){return db['SmsInteraction']['find']({'where':_0x1a18a0[_0x375d('0x1d')]?_0x1a18a0[_0x375d('0x1d')][_0x375d('0x1f')]||null:null})['then'](function(_0x372841){if(_0x372841){return _0x372841['addTags'](_0x1a18a0[_0x375d('0x1c')][_0x375d('0x23')],_[_0x375d('0x24')](_0x1a18a0[_0x375d('0x1c')],['ids','id'])||{});}})[_0x375d('0x25')](function(_0x3bcd9d){logger[_0x375d('0x10')](_0x375d('0x26'),_0x1a18a0);logger[_0x375d('0x12')](_0x375d('0x26'),_0x1a18a0,JSON['stringify'](_0x3bcd9d));_0x1a9105(_0x3bcd9d);})['catch'](function(_0x2393f7){logger[_0x375d('0x15')](_0x375d('0x26'),_0x2393f7[_0x375d('0x17')],_0x1a18a0);_0x504440(_this[_0x375d('0x15')](0x1f4,_0x2393f7[_0x375d('0x17')]));});});}; \ No newline at end of file +var _0x854d=['client','http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateSmsInteraction','update','options','where','attributes','limit','stringify','AddTagsToSmsInteraction','SmsInteraction','find','omit','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x65eb73,_0x1cc017){var _0x4e0f06=function(_0x1b8b0a){while(--_0x1b8b0a){_0x65eb73['push'](_0x65eb73['shift']());}};_0x4e0f06(++_0x1cc017);}(_0x854d,0xf8));var _0xd854=function(_0x5612b3,_0x41d33e){_0x5612b3=_0x5612b3-0x0;var _0x2a6f09=_0x854d[_0x5612b3];return _0x2a6f09;};'use strict';var _=require(_0xd854('0x0'));var util=require(_0xd854('0x1'));var moment=require(_0xd854('0x2'));var BPromise=require(_0xd854('0x3'));var rs=require(_0xd854('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd854('0x5'))['db'];var utils=require(_0xd854('0x6'));var logger=require(_0xd854('0x7'))(_0xd854('0x8'));var config=require('../../config/environment');var jayson=require(_0xd854('0x9'));var client=jayson[_0xd854('0xa')][_0xd854('0xb')]({'port':0x232a});config[_0xd854('0xc')]=_[_0xd854('0xd')](config['redis'],{'host':_0xd854('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd854('0xc')]));require(_0xd854('0xf'))[_0xd854('0x10')](socket);function respondWithRpcPromise(_0x1d73d5,_0x4c481c,_0x532385){return new BPromise(function(_0x18f426,_0x52b17a){return client[_0xd854('0x11')](_0x1d73d5,_0x532385)[_0xd854('0x12')](function(_0x51ad66){logger[_0xd854('0x13')](_0xd854('0x14'),_0x4c481c,_0xd854('0x15'));logger[_0xd854('0x16')](_0xd854('0x17'),_0x4c481c,_0xd854('0x15'),JSON['stringify'](_0x51ad66));if(_0x51ad66[_0xd854('0x18')]){if(_0x51ad66[_0xd854('0x18')]['code']===0x1f4){logger['error'](_0xd854('0x14'),_0x4c481c,_0x51ad66[_0xd854('0x18')][_0xd854('0x19')]);return _0x52b17a(_0x51ad66[_0xd854('0x18')][_0xd854('0x19')]);}logger[_0xd854('0x18')](_0xd854('0x14'),_0x4c481c,_0x51ad66[_0xd854('0x18')][_0xd854('0x19')]);return _0x18f426(_0x51ad66[_0xd854('0x18')]['message']);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x4c481c,_0xd854('0x15'));_0x18f426(_0x51ad66[_0xd854('0x1a')][_0xd854('0x19')]);}})[_0xd854('0x1b')](function(_0x11a5ed){logger[_0xd854('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x4c481c,_0x11a5ed);_0x52b17a(_0x11a5ed);});});}exports[_0xd854('0x1c')]=function(_0x48d69d){var _0x30aed0=this;return new Promise(function(_0x232655,_0x27a63c){return db['SmsInteraction'][_0xd854('0x1d')](_0x48d69d['body'],{'raw':_0x48d69d[_0xd854('0x1e')]?_0x48d69d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48d69d[_0xd854('0x1e')]?_0x48d69d[_0xd854('0x1e')][_0xd854('0x1f')]||null:null,'attributes':_0x48d69d[_0xd854('0x1e')]?_0x48d69d[_0xd854('0x1e')][_0xd854('0x20')]||null:null,'limit':_0x48d69d[_0xd854('0x1e')]?_0x48d69d[_0xd854('0x1e')][_0xd854('0x21')]||null:null})['then'](function(_0x4e0d3c){logger[_0xd854('0x13')](_0xd854('0x1c'),_0x48d69d);logger['debug']('UpdateSmsInteraction',_0x48d69d,JSON[_0xd854('0x22')](_0x4e0d3c));_0x232655(_0x4e0d3c);})[_0xd854('0x1b')](function(_0x1a52ca){logger[_0xd854('0x18')]('UpdateSmsInteraction',_0x1a52ca[_0xd854('0x19')],_0x48d69d);_0x27a63c(_0x30aed0['error'](0x1f4,_0x1a52ca[_0xd854('0x19')]));});});};exports[_0xd854('0x23')]=function(_0x495d9c){return new Promise(function(_0x1e67e0,_0x46ccda){return db[_0xd854('0x24')][_0xd854('0x25')]({'where':_0x495d9c[_0xd854('0x1e')]?_0x495d9c['options']['where']||null:null})[_0xd854('0x12')](function(_0x51f78a){if(_0x51f78a){return _0x51f78a['addTags'](_0x495d9c['body']['ids'],_[_0xd854('0x26')](_0x495d9c[_0xd854('0x27')],[_0xd854('0x28'),'id'])||{});}})[_0xd854('0x29')](function(_0x1ac453){logger['info'](_0xd854('0x2a'),_0x495d9c);logger[_0xd854('0x16')](_0xd854('0x2a'),_0x495d9c,JSON['stringify'](_0x1ac453));_0x1e67e0(_0x1ac453);})[_0xd854('0x1b')](function(_0x39fe78){logger[_0xd854('0x18')](_0xd854('0x2a'),_0x39fe78[_0xd854('0x19')],_0x495d9c);_0x46ccda(_this[_0xd854('0x18')](0x1f4,_0x39fe78[_0xd854('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 290995b..77f57f3 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 _0xb987=['./smsInteraction.events','save','remove','update','emit','removeListener','register','length','smsInteraction:'];(function(_0x26bd1d,_0x5a41fc){var _0x4f6701=function(_0xe034c2){while(--_0xe034c2){_0x26bd1d['push'](_0x26bd1d['shift']());}};_0x4f6701(++_0x5a41fc);}(_0xb987,0xab));var _0x7b98=function(_0x346c94,_0x48d3e3){_0x346c94=_0x346c94-0x0;var _0x435c21=_0xb987[_0x346c94];return _0x435c21;};'use strict';var SmsInteractionEvents=require(_0x7b98('0x0'));var events=[_0x7b98('0x1'),_0x7b98('0x2'),_0x7b98('0x3')];function createListener(_0x5d00d3,_0x2e4d07){return function(_0x2d6e0c){_0x2e4d07[_0x7b98('0x4')](_0x5d00d3,_0x2d6e0c);};}function removeListener(_0x4f3ca0,_0x4a5c05){return function(){SmsInteractionEvents[_0x7b98('0x5')](_0x4f3ca0,_0x4a5c05);};}exports[_0x7b98('0x6')]=function(_0x2a4197){for(var _0x265366=0x0,_0x16fc76=events[_0x7b98('0x7')];_0x265366<_0x16fc76;_0x265366++){var _0x2e573a=events[_0x265366];var _0x2cc2e0=createListener(_0x7b98('0x8')+_0x2e573a,_0x2a4197);SmsInteractionEvents['on'](_0x2e573a,_0x2cc2e0);}}; \ No newline at end of file +var _0x30e2=['remove','update','emit','register','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x30e2,0x6e));var _0x230e=function(_0x227f7b,_0x2ae6ce){_0x227f7b=_0x227f7b-0x0;var _0x356f56=_0x30e2[_0x227f7b];return _0x356f56;};'use strict';var SmsInteractionEvents=require(_0x230e('0x0'));var events=[_0x230e('0x1'),_0x230e('0x2'),_0x230e('0x3')];function createListener(_0x552d49,_0x69f408){return function(_0x46aa39){_0x69f408[_0x230e('0x4')](_0x552d49,_0x46aa39);};}function removeListener(_0x5a1ddb,_0x571ccf){return function(){SmsInteractionEvents['removeListener'](_0x5a1ddb,_0x571ccf);};}exports[_0x230e('0x5')]=function(_0x2bdea6){for(var _0x4c48eb=0x0,_0x269e9d=events[_0x230e('0x6')];_0x4c48eb<_0x269e9d;_0x4c48eb++){var _0xaf9ff7=events[_0x4c48eb];var _0x3a625e=createListener(_0x230e('0x7')+_0xaf9ff7,_0x2bdea6);SmsInteractionEvents['on'](_0xaf9ff7,_0x3a625e);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 0c6a332..818fbfd 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 _0x8e2e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','fs-extra'];(function(_0x151c6e,_0x38de4b){var _0x1df6f3=function(_0x554b5a){while(--_0x554b5a){_0x151c6e['push'](_0x151c6e['shift']());}};_0x1df6f3(++_0x38de4b);}(_0x8e2e,0x10b));var _0xe8e2=function(_0x2e20fb,_0x5b5c93){_0x2e20fb=_0x2e20fb-0x0;var _0x5e445a=_0x8e2e[_0x2e20fb];return _0x5e445a;};'use strict';var multer=require('multer');var util=require(_0xe8e2('0x0'));var path=require(_0xe8e2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe8e2('0x2'));var auth=require(_0xe8e2('0x3'));var interaction=require(_0xe8e2('0x4'));var config=require(_0xe8e2('0x5'));var controller=require(_0xe8e2('0x6'));router[_0xe8e2('0x7')]('/',auth[_0xe8e2('0x8')](),controller[_0xe8e2('0x9')]);router[_0xe8e2('0x7')](_0xe8e2('0xa'),auth['isAuthenticated'](),controller[_0xe8e2('0xb')]);router[_0xe8e2('0x7')](_0xe8e2('0xc'),auth['isAuthenticated'](),controller[_0xe8e2('0xd')]);router[_0xe8e2('0xe')]('/',auth[_0xe8e2('0x8')](),interaction['tracked']('sms','smsmessage:create'),controller[_0xe8e2('0xf')]);router[_0xe8e2('0xe')](_0xe8e2('0x10'),controller[_0xe8e2('0x11')]);router[_0xe8e2('0x12')](_0xe8e2('0xc'),auth[_0xe8e2('0x8')](),controller[_0xe8e2('0x13')]);router[_0xe8e2('0x12')](_0xe8e2('0x14'),auth['isAuthenticated'](),controller[_0xe8e2('0x15')]);router['put'](_0xe8e2('0x16'),auth[_0xe8e2('0x8')](),controller[_0xe8e2('0x17')]);router[_0xe8e2('0x18')]('/:id',auth[_0xe8e2('0x8')](),controller[_0xe8e2('0x19')]);module[_0xe8e2('0x1a')]=router; \ No newline at end of file +var _0xa515=['accept','reject','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','post','tracked','sms','smsmessage:create','create','/:id/status','put','/:id','update','/:id/accept'];(function(_0x286d8a,_0x5e7ac7){var _0x2b6a5f=function(_0x3efe85){while(--_0x3efe85){_0x286d8a['push'](_0x286d8a['shift']());}};_0x2b6a5f(++_0x5e7ac7);}(_0xa515,0x108));var _0x5a51=function(_0x4dd2f4,_0x56e12f){_0x4dd2f4=_0x4dd2f4-0x0;var _0x324e54=_0xa515[_0x4dd2f4];return _0x324e54;};'use strict';var multer=require(_0x5a51('0x0'));var util=require(_0x5a51('0x1'));var path=require(_0x5a51('0x2'));var timeout=require(_0x5a51('0x3'));var express=require('express');var router=express[_0x5a51('0x4')]();var fs_extra=require(_0x5a51('0x5'));var auth=require(_0x5a51('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5a51('0x7'));var controller=require('./smsMessage.controller');router[_0x5a51('0x8')]('/',auth['isAuthenticated'](),controller[_0x5a51('0x9')]);router['get'](_0x5a51('0xa'),auth[_0x5a51('0xb')](),controller['describe']);router[_0x5a51('0x8')]('/:id',auth[_0x5a51('0xb')](),controller['show']);router[_0x5a51('0xc')]('/',auth[_0x5a51('0xb')](),interaction[_0x5a51('0xd')](_0x5a51('0xe'),_0x5a51('0xf')),controller[_0x5a51('0x10')]);router[_0x5a51('0xc')](_0x5a51('0x11'),controller['status']);router[_0x5a51('0x12')](_0x5a51('0x13'),auth[_0x5a51('0xb')](),controller[_0x5a51('0x14')]);router[_0x5a51('0x12')](_0x5a51('0x15'),auth['isAuthenticated'](),controller[_0x5a51('0x16')]);router[_0x5a51('0x12')]('/:id/reject',auth[_0x5a51('0xb')](),controller[_0x5a51('0x17')]);router[_0x5a51('0x18')](_0x5a51('0x13'),auth[_0x5a51('0xb')](),controller['destroy']);module[_0x5a51('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index decb670..e616b7f 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 _0x8a25=['STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x77378d,_0x2b2e74){var _0x53e884=function(_0x4813c1){while(--_0x4813c1){_0x77378d['push'](_0x77378d['shift']());}};_0x53e884(++_0x2b2e74);}(_0x8a25,0x1aa));var _0x58a2=function(_0xe7d286,_0x32715c){_0xe7d286=_0xe7d286-0x0;var _0x3637a3=_0x8a25[_0xe7d286];return _0x3637a3;};'use strict';var Sequelize=require(_0x58a2('0x0'));module[_0x58a2('0x1')]={'body':{'type':Sequelize[_0x58a2('0x2')](_0x58a2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x58a2('0x4')]('in',_0x58a2('0x5')),'defaultValue':_0x58a2('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x58a2('0x6')](0xbe)},'phone':{'type':Sequelize[_0x58a2('0x6')]},'readAt':{'type':Sequelize[_0x58a2('0x7')]},'secret':{'type':Sequelize[_0x58a2('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x58a2('0x6')]},'providerResponse':{'type':Sequelize[_0x58a2('0x2')]}}; \ No newline at end of file +var _0x2086=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0xe4936,_0x3cd5c0){var _0x254fee=function(_0x3a2b9f){while(--_0x3a2b9f){_0xe4936['push'](_0xe4936['shift']());}};_0x254fee(++_0x3cd5c0);}(_0x2086,0x124));var _0x6208=function(_0x10dec8,_0x2469b2){_0x10dec8=_0x10dec8-0x0;var _0x264bce=_0x2086[_0x10dec8];return _0x264bce;};'use strict';var Sequelize=require(_0x6208('0x0'));module[_0x6208('0x1')]={'body':{'type':Sequelize[_0x6208('0x2')](_0x6208('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6208('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6208('0x5')]('in','out'),'defaultValue':_0x6208('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6208('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x6208('0x8')]},'secret':{'type':Sequelize[_0x6208('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6208('0x7')]},'providerResponse':{'type':Sequelize[_0x6208('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index e7771d9..069de56 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 _0x6209=['get','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','agent','fullname','email','internal','manual','interface','channel','event','EventManager','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','SIP/%s','motionChannel','rejectmessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','type','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','infobip','results','groupName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','message','error','result','catch','sendStatus','status','limit','undefined','offset','Content-Range','json','update','then','destroy','end','stack','name','index','map','SmsMessage','fieldName','key','query','filters','intersection','fields','length','attributes','model','hasOwnProperty','nolimit','sort','where','pick','merge','filter','count','includeAll','rows','show','params','keys','rawAttributes','include','options','find','create','body','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','format','UserId','user'];(function(_0xf1a450,_0x11b462){var _0x2e912f=function(_0x399c8c){while(--_0x399c8c){_0xf1a450['push'](_0xf1a450['shift']());}};_0x2e912f(++_0x11b462);}(_0x6209,0x1e8));var _0x9620=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x6209[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0x9620('0x0'));var rimraf=require(_0x9620('0x1'));var zipdir=require(_0x9620('0x2'));var jsonpatch=require(_0x9620('0x3'));var rp=require(_0x9620('0x4'));var moment=require(_0x9620('0x5'));var BPromise=require(_0x9620('0x6'));var Mustache=require('mustache');var util=require(_0x9620('0x7'));var path=require(_0x9620('0x8'));var sox=require(_0x9620('0x9'));var csv=require('to-csv');var ejs=require(_0x9620('0xa'));var fs=require('fs');var fs_extra=require(_0x9620('0xb'));var _=require(_0x9620('0xc'));var squel=require(_0x9620('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9620('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9620('0xf'));var Papa=require(_0x9620('0x10'));var Redis=require(_0x9620('0x11'));var authService=require(_0x9620('0x12'));var qs=require(_0x9620('0x13'));var as=require(_0x9620('0x14'));var hardwareService=require(_0x9620('0x15'));var logger=require('../../config/logger')(_0x9620('0x16'));var utils=require('../../config/utils');var config=require(_0x9620('0x17'));var licenseUtil=require(_0x9620('0x18'));var db=require(_0x9620('0x19'))['db'];config[_0x9620('0x1a')]=_[_0x9620('0x1b')](config[_0x9620('0x1a')],{'host':_0x9620('0x1c'),'port':0x18eb});var socket=require(_0x9620('0x1d'))(new Redis(config[_0x9620('0x1a')]));require(_0x9620('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9620('0x1f')][_0x9620('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x9620('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x309b4c,_0x34168b,_0x1a75d8,_0x4f399c){return new BPromise(function(_0x2cb40e,_0x1d1c61){var _0x5a9b98=_0x4f399c||client;return _0x5a9b98[_0x9620('0x21')](_0x309b4c,_0x1a75d8)['then'](function(_0x10a166){logger[_0x9620('0x22')](_0x9620('0x23'),_0x34168b,_0x9620('0x24'));logger[_0x9620('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x34168b,_0x9620('0x24'),JSON['stringify'](_0x10a166));if(_0x10a166['error']){if(_0x10a166['error']['code']===0x1f4){logger['error'](_0x9620('0x23'),_0x34168b,_0x10a166['error'][_0x9620('0x26')]);return _0x1d1c61(_0x10a166[_0x9620('0x27')][_0x9620('0x26')]);}logger[_0x9620('0x27')](_0x9620('0x23'),_0x34168b,_0x10a166[_0x9620('0x27')][_0x9620('0x26')]);return _0x2cb40e(_0x10a166['error']['message']);}else{logger[_0x9620('0x22')](_0x9620('0x23'),_0x34168b,'request\x20sent');_0x2cb40e(_0x10a166[_0x9620('0x28')][_0x9620('0x26')]);}})[_0x9620('0x29')](function(_0x156298){logger[_0x9620('0x27')](_0x9620('0x23'),_0x34168b,_0x156298);_0x1d1c61(_0x156298);});});}function respondWithStatusCode(_0x2edc88,_0x1527bd){_0x1527bd=_0x1527bd||0xcc;return function(_0x255cac){if(_0x255cac){return _0x2edc88[_0x9620('0x2a')](_0x1527bd);}return _0x2edc88[_0x9620('0x2b')](_0x1527bd)['end']();};}function respondWithResult(_0x6b92c5,_0x3e40aa){_0x3e40aa=_0x3e40aa||0xc8;return function(_0x1a7eeb){if(_0x1a7eeb){return _0x6b92c5[_0x9620('0x2b')](_0x3e40aa)['json'](_0x1a7eeb);}};}function respondWithFilteredResult(_0x4a9e41,_0x1282dc){return function(_0x581fc3){if(_0x581fc3){var _0xf2cb11=typeof _0x1282dc['offset']==='undefined'&&typeof _0x1282dc[_0x9620('0x2c')]===_0x9620('0x2d');var _0x182417=_0x581fc3['count'];var _0x19ddaf=_0xf2cb11?0x0:_0x1282dc[_0x9620('0x2e')];var _0x42bfe6=_0xf2cb11?_0x581fc3['count']:_0x1282dc[_0x9620('0x2e')]+_0x1282dc['limit'];var _0xb601c5;if(_0x42bfe6>=_0x182417){_0x42bfe6=_0x182417;_0xb601c5=0xc8;}else{_0xb601c5=0xce;}_0x4a9e41[_0x9620('0x2b')](_0xb601c5);return _0x4a9e41['set'](_0x9620('0x2f'),_0x19ddaf+'-'+_0x42bfe6+'/'+_0x182417)[_0x9620('0x30')](_0x581fc3);}return null;};}function patchUpdates(_0x3ad50e){return function(_0x242e12){try{jsonpatch['apply'](_0x242e12,_0x3ad50e,!![]);}catch(_0x539851){return BPromise['reject'](_0x539851);}return _0x242e12['save']();};}function saveUpdates(_0x3fa0b4,_0x27bd92){return function(_0x53514c){if(_0x53514c){return _0x53514c[_0x9620('0x31')](_0x3fa0b4)[_0x9620('0x32')](function(_0x4b961d){return _0x4b961d;});}return null;};}function removeEntity(_0x4465ee,_0x3d8550){return function(_0x4e5b08){if(_0x4e5b08){return _0x4e5b08[_0x9620('0x33')]()[_0x9620('0x32')](function(){_0x4465ee[_0x9620('0x2b')](0xcc)[_0x9620('0x34')]();});}};}function handleEntityNotFound(_0x49a459,_0x1de657){return function(_0x4d63b8){if(!_0x4d63b8){_0x49a459[_0x9620('0x2a')](0x194);}return _0x4d63b8;};}function handleError(_0x2c5dfe,_0x57dc75){_0x57dc75=_0x57dc75||0x1f4;return function(_0x55c834){logger[_0x9620('0x27')](_0x55c834[_0x9620('0x35')]);if(_0x55c834[_0x9620('0x36')]){delete _0x55c834[_0x9620('0x36')];}_0x2c5dfe[_0x9620('0x2b')](_0x57dc75)['send'](_0x55c834);};}exports[_0x9620('0x37')]=function(_0x2d87fa,_0x10c968){var _0x4b21a0={},_0x18eba2={},_0x534bd5={'count':0x0,'rows':[]};var _0x3c1a11=_[_0x9620('0x38')](db[_0x9620('0x39')]['rawAttributes'],function(_0x243486){return{'name':_0x243486[_0x9620('0x3a')],'type':_0x243486['type'][_0x9620('0x3b')]};});_0x18eba2['model']=_[_0x9620('0x38')](_0x3c1a11,_0x9620('0x36'));_0x18eba2[_0x9620('0x3c')]=_['keys'](_0x2d87fa[_0x9620('0x3c')]);_0x18eba2[_0x9620('0x3d')]=_[_0x9620('0x3e')](_0x18eba2['model'],_0x18eba2[_0x9620('0x3c')]);_0x4b21a0['attributes']=_['intersection'](_0x18eba2['model'],qs[_0x9620('0x3f')](_0x2d87fa['query'][_0x9620('0x3f')]));_0x4b21a0['attributes']=_0x4b21a0['attributes'][_0x9620('0x40')]?_0x4b21a0[_0x9620('0x41')]:_0x18eba2[_0x9620('0x42')];if(!_0x2d87fa['query'][_0x9620('0x43')](_0x9620('0x44'))){_0x4b21a0[_0x9620('0x2c')]=qs[_0x9620('0x2c')](_0x2d87fa[_0x9620('0x3c')][_0x9620('0x2c')]);_0x4b21a0[_0x9620('0x2e')]=qs[_0x9620('0x2e')](_0x2d87fa[_0x9620('0x3c')][_0x9620('0x2e')]);}_0x4b21a0['order']=qs[_0x9620('0x45')](_0x2d87fa[_0x9620('0x3c')][_0x9620('0x45')]);_0x4b21a0[_0x9620('0x46')]=qs[_0x9620('0x3d')](_[_0x9620('0x47')](_0x2d87fa[_0x9620('0x3c')],_0x18eba2['filters']),_0x3c1a11);if(_0x2d87fa[_0x9620('0x3c')]['filter']){_0x4b21a0[_0x9620('0x46')]=_[_0x9620('0x48')](_0x4b21a0[_0x9620('0x46')],{'$or':_[_0x9620('0x38')](_0x3c1a11,function(_0x4ba242){if(_0x4ba242['type']!=='VIRTUAL'){var _0x158911={};_0x158911[_0x4ba242[_0x9620('0x36')]]={'$like':'%'+_0x2d87fa['query'][_0x9620('0x49')]+'%'};return _0x158911;}})});}_0x4b21a0=_[_0x9620('0x48')]({},_0x4b21a0,_0x2d87fa['options']);var _0x5aa59a={'where':_0x4b21a0[_0x9620('0x46')]};return db['SmsMessage'][_0x9620('0x4a')](_0x5aa59a)[_0x9620('0x32')](function(_0x52a268){_0x534bd5[_0x9620('0x4a')]=_0x52a268;if(_0x2d87fa['query'][_0x9620('0x4b')]){_0x4b21a0['include']=[{'all':!![]}];}return db[_0x9620('0x39')]['findAll'](_0x4b21a0);})[_0x9620('0x32')](function(_0x21af35){_0x534bd5[_0x9620('0x4c')]=_0x21af35;return _0x534bd5;})['then'](respondWithFilteredResult(_0x10c968,_0x4b21a0))[_0x9620('0x29')](handleError(_0x10c968,null));};exports[_0x9620('0x4d')]=function(_0x3086c4,_0x19afd6){var _0x17537a={'raw':!![],'where':{'id':_0x3086c4[_0x9620('0x4e')]['id']}},_0x428f9d={};_0x428f9d[_0x9620('0x42')]=_[_0x9620('0x4f')](db[_0x9620('0x39')][_0x9620('0x50')]);_0x428f9d[_0x9620('0x3c')]=_[_0x9620('0x4f')](_0x3086c4['query']);_0x428f9d[_0x9620('0x3d')]=_[_0x9620('0x3e')](_0x428f9d['model'],_0x428f9d[_0x9620('0x3c')]);_0x17537a[_0x9620('0x41')]=_[_0x9620('0x3e')](_0x428f9d[_0x9620('0x42')],qs[_0x9620('0x3f')](_0x3086c4['query'][_0x9620('0x3f')]));_0x17537a[_0x9620('0x41')]=_0x17537a['attributes'][_0x9620('0x40')]?_0x17537a[_0x9620('0x41')]:_0x428f9d[_0x9620('0x42')];if(_0x3086c4[_0x9620('0x3c')][_0x9620('0x4b')]){_0x17537a[_0x9620('0x51')]=[{'all':!![]}];}_0x17537a=_[_0x9620('0x48')]({},_0x17537a,_0x3086c4[_0x9620('0x52')]);return db['SmsMessage'][_0x9620('0x53')](_0x17537a)[_0x9620('0x32')](handleEntityNotFound(_0x19afd6,null))['then'](respondWithResult(_0x19afd6,null))[_0x9620('0x29')](handleError(_0x19afd6,null));};exports[_0x9620('0x54')]=function(_0x265dc5,_0x5b414b){return db[_0x9620('0x39')][_0x9620('0x54')](_0x265dc5[_0x9620('0x55')],{})[_0x9620('0x32')](respondWithResult(_0x5b414b,0xc9))['catch'](handleError(_0x5b414b,null));};exports[_0x9620('0x31')]=function(_0x4d68ea,_0x42ac56){if(_0x4d68ea[_0x9620('0x55')]['id']){delete _0x4d68ea['body']['id'];}return db[_0x9620('0x39')]['find']({'where':{'id':_0x4d68ea[_0x9620('0x4e')]['id']}})[_0x9620('0x32')](handleEntityNotFound(_0x42ac56,null))[_0x9620('0x32')](saveUpdates(_0x4d68ea[_0x9620('0x55')],null))['then'](respondWithResult(_0x42ac56,null))[_0x9620('0x29')](handleError(_0x42ac56,null));};exports[_0x9620('0x33')]=function(_0x1f9085,_0x5a5e3c){return db[_0x9620('0x39')][_0x9620('0x53')]({'where':{'id':_0x1f9085['params']['id']}})[_0x9620('0x32')](handleEntityNotFound(_0x5a5e3c,null))['then'](removeEntity(_0x5a5e3c,null))['catch'](handleError(_0x5a5e3c,null));};exports[_0x9620('0x56')]=function(_0x549966,_0x4f0715){return db[_0x9620('0x39')][_0x9620('0x56')]()[_0x9620('0x32')](respondWithResult(_0x4f0715,null))[_0x9620('0x29')](handleError(_0x4f0715,null));};var interaction_log=require(_0x9620('0x57'))(_0x9620('0x58'));exports[_0x9620('0x59')]=function(_0x209b63,_0x9a55bc,_0x4bc03b){var _0x4bc1bd={'agent':{},'channel':_0x9620('0x5a')};if(_0x209b63[_0x9620('0x55')]['id']){delete _0x209b63[_0x9620('0x55')]['id'];}_0x209b63[_0x9620('0x55')][_0x9620('0x5b')]=!![];_0x209b63[_0x9620('0x55')][_0x9620('0x5c')]=moment()[_0x9620('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x209b63['body'][_0x9620('0x5e')]=_0x209b63[_0x9620('0x55')]['UserId']||_0x209b63[_0x9620('0x5f')]['id'];_0x4bc1bd['agent']['id']=_0x209b63['body']['UserId'];return db['SmsMessage'][_0x9620('0x53')]({'where':{'id':_0x209b63[_0x9620('0x4e')]['id'],'UserId':null}})[_0x9620('0x32')](handleEntityNotFound(_0x9a55bc,null))['then'](saveUpdates(_0x209b63['body'],null))[_0x9620('0x32')](function(_0x111e99){if(_0x111e99){_0x4bc1bd[_0x9620('0x26')]=_0x111e99[_0x9620('0x60')]({'plain':!![]});return db['SmsInteraction'][_0x9620('0x53')]({'where':{'id':_0x111e99[_0x9620('0x61')]}});}return null;})[_0x9620('0x32')](handleEntityNotFound(_0x9a55bc,null))['then'](function(_0x306410){if(_0x306410){return _0x306410[_0x9620('0x31')]({'UserId':_0x209b63[_0x9620('0x55')]['UserId'],'read1stAt':_[_0x9620('0x62')](_0x306410[_0x9620('0x63')])?moment()[_0x9620('0x5d')](_0x9620('0x64')):undefined});}return null;})['then'](function(_0x25c808){if(_0x25c808){_0x4bc1bd[_0x9620('0x65')]=_0x25c808['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x209b63[_0x9620('0x5f')]['id'],_0x209b63[_0x9620('0x5f')][_0x9620('0x36')],_0x209b63[_0x9620('0x5f')][_0x9620('0x66')],_0x4bc1bd[_0x9620('0x65')]['id'],_0x209b63[_0x9620('0x55')]?JSON[_0x9620('0x67')](_0x209b63['body']):_0x9620('0x68'));return respondWithRpcPromise(_0x9620('0x69'),'acceptMessage',_0x4bc1bd);}return null;})[_0x9620('0x32')](function(_0x2a253c){var _0xcbfbb2=_0x9620('0x6a')+_0x2a253c[_0x9620('0x26')][_0x9620('0x6b')];return db[_0x9620('0x6c')][_0x9620('0x3c')](_0xcbfbb2,{'type':db[_0x9620('0x6d')][_0x9620('0x6e')][_0x9620('0x6f')],'raw':!![]})['then'](function(_0x1c25cb){return _0x1c25cb;});})[_0x9620('0x32')](function(_0x16ba20){if(_0x16ba20){_0x4bc1bd['message']['contact']=_0x16ba20[0x0];if(!_0x209b63['body'][_0x9620('0x5e')])return;return db['User'][_0x9620('0x53')]({'where':{'id':_0x209b63[_0x9620('0x55')]['UserId'],'role':_0x9620('0x70')},'attributes':['id',_0x9620('0x36'),_0x9620('0x71'),_0x9620('0x72'),_0x9620('0x73')],'raw':!![]});}return null;})['then'](function(_0x3c0b3e){if(!_0x3c0b3e)return null;_0x4bc1bd[_0x9620('0x26')][_0x9620('0x70')]=_0x3c0b3e;return _0x4bc1bd;})[_0x9620('0x32')](function(_0x2bdb17){if(_0x2bdb17){if(_0x209b63[_0x9620('0x55')][_0x9620('0x74')]){_0x4bc1bd['message'][_0x9620('0x75')]=util[_0x9620('0x5d')]('SIP/%s',_0x209b63[_0x9620('0x5f')][_0x9620('0x36')]);_0x4bc1bd[_0x9620('0x26')][_0x9620('0x76')]=_0x4bc1bd[_0x9620('0x76')];_0x4bc1bd[_0x9620('0x26')]['motionChannel']=_0x4bc1bd[_0x9620('0x76')];_0x4bc1bd[_0x9620('0x26')][_0x9620('0x77')]='accept';return respondWithRpcPromise(_0x9620('0x78'),_0x9620('0x78'),{'event':_0x9620('0x79'),'message':_0x4bc1bd[_0x9620('0x26')]},client9002)[_0x9620('0x32')](function(){return _0x4bc1bd;});}return _0x4bc1bd;}return null;})[_0x9620('0x32')](respondWithResult(_0x9a55bc,null))[_0x9620('0x29')](handleError(_0x9a55bc,null));};var interaction_log=require(_0x9620('0x57'))(_0x9620('0x58'));exports[_0x9620('0x7a')]=function(_0x44865f,_0x43022c,_0x591721){var _0x927d48={'agent':{},'channel':_0x9620('0x5a')};if(_0x44865f[_0x9620('0x55')]['id']){delete _0x44865f[_0x9620('0x55')]['id'];}_0x44865f['body'][_0x9620('0x5e')]=_0x44865f[_0x9620('0x55')][_0x9620('0x5e')]||_0x44865f[_0x9620('0x5f')]['id'];_0x927d48[_0x9620('0x70')]['id']=_0x44865f['body'][_0x9620('0x5e')];return db['SmsMessage']['find']({'where':{'id':_0x44865f[_0x9620('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x43022c,null))[_0x9620('0x32')](function(_0x3dece1){if(_0x3dece1){_0x927d48[_0x9620('0x26')]=_0x3dece1[_0x9620('0x60')]({'plain':!![]});return db['SmsInteraction'][_0x9620('0x53')]({'where':{'id':_0x3dece1[_0x9620('0x61')]}});}return null;})[_0x9620('0x32')](handleEntityNotFound(_0x43022c,null))['then'](function(_0x4b401f){if(_0x4b401f){_0x927d48[_0x9620('0x65')]=_0x4b401f[_0x9620('0x60')]({'plain':!![]});interaction_log['info'](_0x9620('0x7b'),_0x44865f[_0x9620('0x5f')]['id'],_0x44865f[_0x9620('0x5f')]['name'],_0x44865f[_0x9620('0x5f')][_0x9620('0x66')],_0x927d48[_0x9620('0x65')]['id'],_0x44865f['body']?JSON['stringify'](_0x44865f[_0x9620('0x55')]):_0x9620('0x68'));return respondWithRpcPromise(_0x9620('0x7c'),_0x9620('0x7d'),_0x927d48);}return null;})[_0x9620('0x32')](function(_0x490705){var _0x21146b=_0x9620('0x6a')+_0x490705[_0x9620('0x26')]['ContactId'];return db[_0x9620('0x6c')][_0x9620('0x3c')](_0x21146b,{'type':db[_0x9620('0x6d')][_0x9620('0x6e')][_0x9620('0x6f')],'raw':!![]})[_0x9620('0x32')](function(_0x47811e){return _0x47811e;});})[_0x9620('0x32')](function(_0x56c8ee){if(_0x56c8ee){_0x927d48['message']['contact']=_0x56c8ee[0x0];if(!_0x44865f[_0x9620('0x55')][_0x9620('0x5e')])return;return db[_0x9620('0x7e')]['find']({'where':{'id':_0x44865f[_0x9620('0x55')][_0x9620('0x5e')],'role':'agent'},'attributes':['id',_0x9620('0x36'),_0x9620('0x71'),_0x9620('0x72'),_0x9620('0x73')],'raw':!![]});}return null;})[_0x9620('0x32')](function(_0x2694d5){if(!_0x2694d5)return null;_0x927d48[_0x9620('0x26')]['agent']=_0x2694d5;return _0x927d48;})[_0x9620('0x32')](function(_0xc9564){if(_0xc9564){_0xc9564['message'][_0x9620('0x75')]=util[_0x9620('0x5d')](_0x9620('0x7f'),_0x44865f[_0x9620('0x5f')][_0x9620('0x36')]);_0xc9564[_0x9620('0x26')][_0x9620('0x76')]=_0x927d48['channel'];_0xc9564[_0x9620('0x26')][_0x9620('0x80')]=_0x927d48[_0x9620('0x76')];_0xc9564[_0x9620('0x26')][_0x9620('0x77')]=_0x9620('0x7a');respondWithRpcPromise(_0x9620('0x78'),_0x9620('0x78'),{'event':_0x9620('0x81'),'message':_0xc9564['message']},client9002);return _0x927d48;}return null;})['then'](respondWithResult(_0x43022c,null))['catch'](handleError(_0x43022c,null));};exports[_0x9620('0x2b')]=function(_0xc2658c,_0x5ac865,_0x4b3549){if(_0xc2658c[_0x9620('0x55')]['id']){delete _0xc2658c[_0x9620('0x55')]['id'];}var _0x84bf8f;return db[_0x9620('0x39')][_0x9620('0x53')]({'where':{'id':_0xc2658c['params']['id']}})[_0x9620('0x32')](handleEntityNotFound(_0x5ac865,null))['then'](function(_0x45e747){if(_0x45e747){_0x84bf8f=_0x45e747;return db['SmsAccount'][_0x9620('0x53')]({'where':{'id':_0x45e747[_0x9620('0x82')]}});}})[_0x9620('0x32')](handleEntityNotFound(_0x5ac865,null))['then'](function(_0x43d8e9){if(_0x43d8e9){logger[_0x9620('0x25')](_0x9620('0x83'),_0x9620('0x2b'),'received\x20delivery\x20report\x20from',_0x43d8e9[_0x9620('0x84')],util[_0x9620('0x85')](_0xc2658c['body'],{'showHidden':![],'depth':null}));switch(_0x43d8e9['type']){case _0x9620('0x86'):if(_0xc2658c[_0x9620('0x55')][_0x9620('0x87')]&&_0xc2658c[_0x9620('0x55')]['MessageSid']===_0x84bf8f[_0x9620('0x88')]){return _0x84bf8f[_0x9620('0x31')]({'read':!![]});}else{logger[_0x9620('0x27')](_0x9620('0x89'),_0x9620('0x2b'),_0x9620('0x86'),util['inspect'](_0xc2658c[_0x9620('0x55')],{'showHidden':![],'depth':null}));}break;case _0x9620('0x8a'):if(_0xc2658c[_0x9620('0x55')][_0x9620('0x8b')]&&_0xc2658c['body'][_0x9620('0x8b')]===_0x84bf8f[_0x9620('0x88')]&&_[_0x9620('0x8c')]([_0x9620('0x8d'),'delivered'],_0xc2658c[_0x9620('0x55')][_0x9620('0x8e')])>=0x0){return _0x84bf8f[_0x9620('0x31')]({'read':!![]});}else{logger[_0x9620('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9620('0x2b'),'plivio',util[_0x9620('0x85')](_0xc2658c[_0x9620('0x55')],{'showHidden':![],'depth':null}));}break;case _0x9620('0x8f'):var _0x24fd27=_0xc2658c[_0x9620('0x55')][_0x9620('0x90')][0x0];if(_0x24fd27[_0x9620('0x2b')][_0x9620('0x91')]==='DELIVERED'){return _0x84bf8f[_0x9620('0x31')]({'read':!![]});}else{logger[_0x9620('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9620('0x2b'),_0x9620('0x8f'),util['inspect'](_0xc2658c[_0x9620('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x84bf8f;}})[_0x9620('0x32')](respondWithResult(_0x5ac865,null))[_0x9620('0x29')](handleError(_0x5ac865,null));}; \ No newline at end of file +var _0xb6ff=['count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','create','body','find','describe','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','internal','interface','channel','event','EventManager','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','email','format','motionChannel','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','http','then','info','SmsMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','sendStatus','end','status','json','limit'];(function(_0x4d938f,_0x35028c){var _0x4e118f=function(_0xb537d5){while(--_0xb537d5){_0x4d938f['push'](_0x4d938f['shift']());}};_0x4e118f(++_0x35028c);}(_0xb6ff,0x185));var _0xfb6f=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0xb6ff[_0x37a7c6];return _0x539905;};'use strict';var emlformat=require(_0xfb6f('0x0'));var rimraf=require(_0xfb6f('0x1'));var zipdir=require(_0xfb6f('0x2'));var jsonpatch=require(_0xfb6f('0x3'));var rp=require('request-promise');var moment=require(_0xfb6f('0x4'));var BPromise=require(_0xfb6f('0x5'));var Mustache=require(_0xfb6f('0x6'));var util=require('util');var path=require(_0xfb6f('0x7'));var sox=require(_0xfb6f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb6f('0x9'));var _=require(_0xfb6f('0xa'));var squel=require(_0xfb6f('0xb'));var crypto=require(_0xfb6f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfb6f('0xd'));var toCsv=require(_0xfb6f('0xe'));var querystring=require('querystring');var Papa=require(_0xfb6f('0xf'));var Redis=require(_0xfb6f('0x10'));var authService=require(_0xfb6f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfb6f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb6f('0x13'))('api');var utils=require(_0xfb6f('0x14'));var config=require(_0xfb6f('0x15'));var licenseUtil=require(_0xfb6f('0x16'));var db=require(_0xfb6f('0x17'))['db'];config[_0xfb6f('0x18')]=_[_0xfb6f('0x19')](config[_0xfb6f('0x18')],{'host':_0xfb6f('0x1a'),'port':0x18eb});var socket=require(_0xfb6f('0x1b'))(new Redis(config[_0xfb6f('0x18')]));require('./smsMessage.socket')[_0xfb6f('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfb6f('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xfb6f('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x560cdd,_0x453827,_0x5b05e6,_0x165d5d){return new BPromise(function(_0x2b1eec,_0x37b6a3){var _0x322e88=_0x165d5d||client;return _0x322e88['request'](_0x560cdd,_0x5b05e6)[_0xfb6f('0x1e')](function(_0x3e75fa){logger[_0xfb6f('0x1f')](_0xfb6f('0x20'),_0x453827,'request\x20sent');logger[_0xfb6f('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x453827,'request\x20sent',JSON[_0xfb6f('0x22')](_0x3e75fa));if(_0x3e75fa[_0xfb6f('0x23')]){if(_0x3e75fa[_0xfb6f('0x23')][_0xfb6f('0x24')]===0x1f4){logger[_0xfb6f('0x23')](_0xfb6f('0x20'),_0x453827,_0x3e75fa['error']['message']);return _0x37b6a3(_0x3e75fa[_0xfb6f('0x23')][_0xfb6f('0x25')]);}logger[_0xfb6f('0x23')](_0xfb6f('0x20'),_0x453827,_0x3e75fa[_0xfb6f('0x23')][_0xfb6f('0x25')]);return _0x2b1eec(_0x3e75fa['error'][_0xfb6f('0x25')]);}else{logger[_0xfb6f('0x1f')](_0xfb6f('0x20'),_0x453827,_0xfb6f('0x26'));_0x2b1eec(_0x3e75fa[_0xfb6f('0x27')][_0xfb6f('0x25')]);}})[_0xfb6f('0x28')](function(_0x210857){logger[_0xfb6f('0x23')](_0xfb6f('0x20'),_0x453827,_0x210857);_0x37b6a3(_0x210857);});});}function respondWithStatusCode(_0x2d3703,_0x11d0b3){_0x11d0b3=_0x11d0b3||0xcc;return function(_0x3a5cda){if(_0x3a5cda){return _0x2d3703[_0xfb6f('0x29')](_0x11d0b3);}return _0x2d3703['status'](_0x11d0b3)[_0xfb6f('0x2a')]();};}function respondWithResult(_0x2d9a53,_0x3dad4a){_0x3dad4a=_0x3dad4a||0xc8;return function(_0x1ad74c){if(_0x1ad74c){return _0x2d9a53[_0xfb6f('0x2b')](_0x3dad4a)[_0xfb6f('0x2c')](_0x1ad74c);}};}function respondWithFilteredResult(_0x10b7b8,_0x526eae){return function(_0x1ca1e9){if(_0x1ca1e9){var _0x29797e=typeof _0x526eae['offset']==='undefined'&&typeof _0x526eae[_0xfb6f('0x2d')]==='undefined';var _0xe43775=_0x1ca1e9[_0xfb6f('0x2e')];var _0x3caa20=_0x29797e?0x0:_0x526eae[_0xfb6f('0x2f')];var _0x1575cc=_0x29797e?_0x1ca1e9['count']:_0x526eae[_0xfb6f('0x2f')]+_0x526eae[_0xfb6f('0x2d')];var _0x1bfa7a;if(_0x1575cc>=_0xe43775){_0x1575cc=_0xe43775;_0x1bfa7a=0xc8;}else{_0x1bfa7a=0xce;}_0x10b7b8[_0xfb6f('0x2b')](_0x1bfa7a);return _0x10b7b8[_0xfb6f('0x30')](_0xfb6f('0x31'),_0x3caa20+'-'+_0x1575cc+'/'+_0xe43775)[_0xfb6f('0x2c')](_0x1ca1e9);}return null;};}function patchUpdates(_0x4cddd6){return function(_0x4f2953){try{jsonpatch[_0xfb6f('0x32')](_0x4f2953,_0x4cddd6,!![]);}catch(_0x4b319a){return BPromise[_0xfb6f('0x33')](_0x4b319a);}return _0x4f2953[_0xfb6f('0x34')]();};}function saveUpdates(_0x29d2f8,_0x39bb9d){return function(_0x5018a8){if(_0x5018a8){return _0x5018a8[_0xfb6f('0x35')](_0x29d2f8)[_0xfb6f('0x1e')](function(_0x31ba15){return _0x31ba15;});}return null;};}function removeEntity(_0x27ad3f,_0x49735e){return function(_0x49cef6){if(_0x49cef6){return _0x49cef6[_0xfb6f('0x36')]()[_0xfb6f('0x1e')](function(){_0x27ad3f[_0xfb6f('0x2b')](0xcc)[_0xfb6f('0x2a')]();});}};}function handleEntityNotFound(_0x5154a8,_0xb49b17){return function(_0x1e71fb){if(!_0x1e71fb){_0x5154a8['sendStatus'](0x194);}return _0x1e71fb;};}function handleError(_0x303196,_0x232e0e){_0x232e0e=_0x232e0e||0x1f4;return function(_0xed1842){logger[_0xfb6f('0x23')](_0xed1842['stack']);if(_0xed1842[_0xfb6f('0x37')]){delete _0xed1842[_0xfb6f('0x37')];}_0x303196[_0xfb6f('0x2b')](_0x232e0e)[_0xfb6f('0x38')](_0xed1842);};}exports['index']=function(_0x59312c,_0x449b99){var _0x1eab62={},_0x635710={},_0x2afac3={'count':0x0,'rows':[]};var _0x2296fe=_[_0xfb6f('0x39')](db[_0xfb6f('0x3a')][_0xfb6f('0x3b')],function(_0x4616aa){return{'name':_0x4616aa[_0xfb6f('0x3c')],'type':_0x4616aa[_0xfb6f('0x3d')][_0xfb6f('0x3e')]};});_0x635710[_0xfb6f('0x3f')]=_[_0xfb6f('0x39')](_0x2296fe,'name');_0x635710[_0xfb6f('0x40')]=_['keys'](_0x59312c[_0xfb6f('0x40')]);_0x635710[_0xfb6f('0x41')]=_[_0xfb6f('0x42')](_0x635710[_0xfb6f('0x3f')],_0x635710[_0xfb6f('0x40')]);_0x1eab62[_0xfb6f('0x43')]=_[_0xfb6f('0x42')](_0x635710['model'],qs[_0xfb6f('0x44')](_0x59312c[_0xfb6f('0x40')][_0xfb6f('0x44')]));_0x1eab62[_0xfb6f('0x43')]=_0x1eab62['attributes'][_0xfb6f('0x45')]?_0x1eab62[_0xfb6f('0x43')]:_0x635710['model'];if(!_0x59312c['query'][_0xfb6f('0x46')](_0xfb6f('0x47'))){_0x1eab62['limit']=qs[_0xfb6f('0x2d')](_0x59312c[_0xfb6f('0x40')][_0xfb6f('0x2d')]);_0x1eab62[_0xfb6f('0x2f')]=qs[_0xfb6f('0x2f')](_0x59312c['query'][_0xfb6f('0x2f')]);}_0x1eab62[_0xfb6f('0x48')]=qs['sort'](_0x59312c[_0xfb6f('0x40')][_0xfb6f('0x49')]);_0x1eab62['where']=qs[_0xfb6f('0x41')](_['pick'](_0x59312c[_0xfb6f('0x40')],_0x635710[_0xfb6f('0x41')]),_0x2296fe);if(_0x59312c[_0xfb6f('0x40')]['filter']){_0x1eab62[_0xfb6f('0x4a')]=_[_0xfb6f('0x4b')](_0x1eab62[_0xfb6f('0x4a')],{'$or':_[_0xfb6f('0x39')](_0x2296fe,function(_0x3bb7a0){if(_0x3bb7a0[_0xfb6f('0x3d')]!==_0xfb6f('0x4c')){var _0x4fb213={};_0x4fb213[_0x3bb7a0[_0xfb6f('0x37')]]={'$like':'%'+_0x59312c[_0xfb6f('0x40')][_0xfb6f('0x4d')]+'%'};return _0x4fb213;}})});}_0x1eab62=_['merge']({},_0x1eab62,_0x59312c[_0xfb6f('0x4e')]);var _0x406ece={'where':_0x1eab62[_0xfb6f('0x4a')]};return db[_0xfb6f('0x3a')][_0xfb6f('0x2e')](_0x406ece)[_0xfb6f('0x1e')](function(_0xd25af2){_0x2afac3['count']=_0xd25af2;if(_0x59312c[_0xfb6f('0x40')][_0xfb6f('0x4f')]){_0x1eab62[_0xfb6f('0x50')]=[{'all':!![]}];}return db[_0xfb6f('0x3a')][_0xfb6f('0x51')](_0x1eab62);})[_0xfb6f('0x1e')](function(_0xe45d8b){_0x2afac3[_0xfb6f('0x52')]=_0xe45d8b;return _0x2afac3;})[_0xfb6f('0x1e')](respondWithFilteredResult(_0x449b99,_0x1eab62))[_0xfb6f('0x28')](handleError(_0x449b99,null));};exports[_0xfb6f('0x53')]=function(_0xfaf577,_0x1d4bab){var _0xbfb4d8={'raw':!![],'where':{'id':_0xfaf577[_0xfb6f('0x54')]['id']}},_0x1e4121={};_0x1e4121[_0xfb6f('0x3f')]=_[_0xfb6f('0x55')](db[_0xfb6f('0x3a')][_0xfb6f('0x3b')]);_0x1e4121[_0xfb6f('0x40')]=_[_0xfb6f('0x55')](_0xfaf577[_0xfb6f('0x40')]);_0x1e4121['filters']=_[_0xfb6f('0x42')](_0x1e4121[_0xfb6f('0x3f')],_0x1e4121[_0xfb6f('0x40')]);_0xbfb4d8[_0xfb6f('0x43')]=_[_0xfb6f('0x42')](_0x1e4121[_0xfb6f('0x3f')],qs[_0xfb6f('0x44')](_0xfaf577['query'][_0xfb6f('0x44')]));_0xbfb4d8[_0xfb6f('0x43')]=_0xbfb4d8[_0xfb6f('0x43')]['length']?_0xbfb4d8[_0xfb6f('0x43')]:_0x1e4121[_0xfb6f('0x3f')];if(_0xfaf577['query']['includeAll']){_0xbfb4d8[_0xfb6f('0x50')]=[{'all':!![]}];}_0xbfb4d8=_[_0xfb6f('0x4b')]({},_0xbfb4d8,_0xfaf577[_0xfb6f('0x4e')]);return db[_0xfb6f('0x3a')]['find'](_0xbfb4d8)[_0xfb6f('0x1e')](handleEntityNotFound(_0x1d4bab,null))['then'](respondWithResult(_0x1d4bab,null))[_0xfb6f('0x28')](handleError(_0x1d4bab,null));};exports[_0xfb6f('0x56')]=function(_0x25b6e7,_0x2df87d){return db[_0xfb6f('0x3a')][_0xfb6f('0x56')](_0x25b6e7[_0xfb6f('0x57')],{})[_0xfb6f('0x1e')](respondWithResult(_0x2df87d,0xc9))[_0xfb6f('0x28')](handleError(_0x2df87d,null));};exports[_0xfb6f('0x35')]=function(_0x519f2e,_0x4f66a3){if(_0x519f2e[_0xfb6f('0x57')]['id']){delete _0x519f2e['body']['id'];}return db[_0xfb6f('0x3a')][_0xfb6f('0x58')]({'where':{'id':_0x519f2e[_0xfb6f('0x54')]['id']}})[_0xfb6f('0x1e')](handleEntityNotFound(_0x4f66a3,null))[_0xfb6f('0x1e')](saveUpdates(_0x519f2e['body'],null))[_0xfb6f('0x1e')](respondWithResult(_0x4f66a3,null))[_0xfb6f('0x28')](handleError(_0x4f66a3,null));};exports['destroy']=function(_0x3be739,_0x49901f){return db['SmsMessage'][_0xfb6f('0x58')]({'where':{'id':_0x3be739[_0xfb6f('0x54')]['id']}})[_0xfb6f('0x1e')](handleEntityNotFound(_0x49901f,null))[_0xfb6f('0x1e')](removeEntity(_0x49901f,null))[_0xfb6f('0x28')](handleError(_0x49901f,null));};exports[_0xfb6f('0x59')]=function(_0x21aabd,_0x4499c3){return db[_0xfb6f('0x3a')]['describe']()[_0xfb6f('0x1e')](respondWithResult(_0x4499c3,null))['catch'](handleError(_0x4499c3,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xfb6f('0x5a')]=function(_0x5ce08a,_0xb936f1,_0x3c6716){var _0x14bbae={'agent':{},'channel':'sms'};if(_0x5ce08a[_0xfb6f('0x57')]['id']){delete _0x5ce08a['body']['id'];}_0x5ce08a[_0xfb6f('0x57')][_0xfb6f('0x5b')]=!![];_0x5ce08a[_0xfb6f('0x57')][_0xfb6f('0x5c')]=moment()['format'](_0xfb6f('0x5d'));_0x5ce08a[_0xfb6f('0x57')][_0xfb6f('0x5e')]=_0x5ce08a[_0xfb6f('0x57')][_0xfb6f('0x5e')]||_0x5ce08a[_0xfb6f('0x5f')]['id'];_0x14bbae[_0xfb6f('0x60')]['id']=_0x5ce08a[_0xfb6f('0x57')][_0xfb6f('0x5e')];return db[_0xfb6f('0x3a')][_0xfb6f('0x58')]({'where':{'id':_0x5ce08a['params']['id'],'UserId':null}})[_0xfb6f('0x1e')](handleEntityNotFound(_0xb936f1,null))['then'](saveUpdates(_0x5ce08a[_0xfb6f('0x57')],null))[_0xfb6f('0x1e')](function(_0x50fd45){if(_0x50fd45){_0x14bbae['message']=_0x50fd45[_0xfb6f('0x61')]({'plain':!![]});return db[_0xfb6f('0x62')][_0xfb6f('0x58')]({'where':{'id':_0x50fd45[_0xfb6f('0x63')]}});}return null;})[_0xfb6f('0x1e')](handleEntityNotFound(_0xb936f1,null))[_0xfb6f('0x1e')](function(_0x501891){if(_0x501891){return _0x501891[_0xfb6f('0x35')]({'UserId':_0x5ce08a[_0xfb6f('0x57')][_0xfb6f('0x5e')],'read1stAt':_['isNil'](_0x501891[_0xfb6f('0x64')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x24e9c3){if(_0x24e9c3){_0x14bbae['interaction']=_0x24e9c3[_0xfb6f('0x61')]({'plain':!![]});interaction_log['info'](_0xfb6f('0x65'),_0x5ce08a[_0xfb6f('0x5f')]['id'],_0x5ce08a[_0xfb6f('0x5f')][_0xfb6f('0x37')],_0x5ce08a[_0xfb6f('0x5f')]['role'],_0x14bbae[_0xfb6f('0x66')]['id'],_0x5ce08a[_0xfb6f('0x57')]?JSON['stringify'](_0x5ce08a['body']):_0xfb6f('0x67'));return respondWithRpcPromise(_0xfb6f('0x68'),_0xfb6f('0x69'),_0x14bbae);}return null;})[_0xfb6f('0x1e')](function(_0x3b5d1e){var _0x572791=_0xfb6f('0x6a')+_0x3b5d1e[_0xfb6f('0x25')][_0xfb6f('0x6b')];return db[_0xfb6f('0x6c')]['query'](_0x572791,{'type':db[_0xfb6f('0x6d')][_0xfb6f('0x6e')]['SELECT'],'raw':!![]})[_0xfb6f('0x1e')](function(_0x3547f7){return _0x3547f7;});})[_0xfb6f('0x1e')](function(_0x1ed7cd){if(_0x1ed7cd){_0x14bbae[_0xfb6f('0x25')][_0xfb6f('0x6f')]=_0x1ed7cd[0x0];if(!_0x5ce08a['body'][_0xfb6f('0x5e')])return;return db['User'][_0xfb6f('0x58')]({'where':{'id':_0x5ce08a[_0xfb6f('0x57')][_0xfb6f('0x5e')],'role':_0xfb6f('0x60')},'attributes':['id',_0xfb6f('0x37'),'fullname','email',_0xfb6f('0x70')],'raw':!![]});}return null;})[_0xfb6f('0x1e')](function(_0x1d7209){if(!_0x1d7209)return null;_0x14bbae[_0xfb6f('0x25')][_0xfb6f('0x60')]=_0x1d7209;return _0x14bbae;})['then'](function(_0xe344d3){if(_0xe344d3){if(_0x5ce08a[_0xfb6f('0x57')]['manual']){_0x14bbae[_0xfb6f('0x25')][_0xfb6f('0x71')]=util['format']('SIP/%s',_0x5ce08a[_0xfb6f('0x5f')][_0xfb6f('0x37')]);_0x14bbae[_0xfb6f('0x25')][_0xfb6f('0x72')]=_0x14bbae[_0xfb6f('0x72')];_0x14bbae[_0xfb6f('0x25')]['motionChannel']=_0x14bbae[_0xfb6f('0x72')];_0x14bbae['message'][_0xfb6f('0x73')]=_0xfb6f('0x5a');return respondWithRpcPromise(_0xfb6f('0x74'),_0xfb6f('0x74'),{'event':_0xfb6f('0x75'),'message':_0x14bbae[_0xfb6f('0x25')]},client9002)[_0xfb6f('0x1e')](function(){return _0x14bbae;});}return _0x14bbae;}return null;})[_0xfb6f('0x1e')](respondWithResult(_0xb936f1,null))[_0xfb6f('0x28')](handleError(_0xb936f1,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xfb6f('0x33')]=function(_0x329d4f,_0x5554ce,_0x5ab54e){var _0x2b2750={'agent':{},'channel':_0xfb6f('0x76')};if(_0x329d4f[_0xfb6f('0x57')]['id']){delete _0x329d4f[_0xfb6f('0x57')]['id'];}_0x329d4f[_0xfb6f('0x57')][_0xfb6f('0x5e')]=_0x329d4f[_0xfb6f('0x57')]['UserId']||_0x329d4f[_0xfb6f('0x5f')]['id'];_0x2b2750[_0xfb6f('0x60')]['id']=_0x329d4f[_0xfb6f('0x57')][_0xfb6f('0x5e')];return db[_0xfb6f('0x3a')][_0xfb6f('0x58')]({'where':{'id':_0x329d4f[_0xfb6f('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5554ce,null))[_0xfb6f('0x1e')](function(_0x3ea627){if(_0x3ea627){_0x2b2750[_0xfb6f('0x25')]=_0x3ea627[_0xfb6f('0x61')]({'plain':!![]});return db[_0xfb6f('0x62')][_0xfb6f('0x58')]({'where':{'id':_0x3ea627[_0xfb6f('0x63')]}});}return null;})[_0xfb6f('0x1e')](handleEntityNotFound(_0x5554ce,null))[_0xfb6f('0x1e')](function(_0x1ff6d4){if(_0x1ff6d4){_0x2b2750['interaction']=_0x1ff6d4['get']({'plain':!![]});interaction_log[_0xfb6f('0x1f')](_0xfb6f('0x77'),_0x329d4f['user']['id'],_0x329d4f['user'][_0xfb6f('0x37')],_0x329d4f[_0xfb6f('0x5f')]['role'],_0x2b2750['interaction']['id'],_0x329d4f[_0xfb6f('0x57')]?JSON[_0xfb6f('0x22')](_0x329d4f[_0xfb6f('0x57')]):_0xfb6f('0x67'));return respondWithRpcPromise(_0xfb6f('0x78'),_0xfb6f('0x79'),_0x2b2750);}return null;})[_0xfb6f('0x1e')](function(_0xa3f861){var _0x34f2aa=_0xfb6f('0x6a')+_0xa3f861[_0xfb6f('0x25')]['ContactId'];return db[_0xfb6f('0x6c')][_0xfb6f('0x40')](_0x34f2aa,{'type':db[_0xfb6f('0x6d')][_0xfb6f('0x6e')]['SELECT'],'raw':!![]})[_0xfb6f('0x1e')](function(_0x1bf40d){return _0x1bf40d;});})[_0xfb6f('0x1e')](function(_0x47578e){if(_0x47578e){_0x2b2750['message'][_0xfb6f('0x6f')]=_0x47578e[0x0];if(!_0x329d4f['body'][_0xfb6f('0x5e')])return;return db['User'][_0xfb6f('0x58')]({'where':{'id':_0x329d4f[_0xfb6f('0x57')][_0xfb6f('0x5e')],'role':_0xfb6f('0x60')},'attributes':['id',_0xfb6f('0x37'),_0xfb6f('0x7a'),_0xfb6f('0x7b'),_0xfb6f('0x70')],'raw':!![]});}return null;})[_0xfb6f('0x1e')](function(_0x1cd26e){if(!_0x1cd26e)return null;_0x2b2750[_0xfb6f('0x25')][_0xfb6f('0x60')]=_0x1cd26e;return _0x2b2750;})[_0xfb6f('0x1e')](function(_0x13c878){if(_0x13c878){_0x13c878[_0xfb6f('0x25')][_0xfb6f('0x71')]=util[_0xfb6f('0x7c')]('SIP/%s',_0x329d4f[_0xfb6f('0x5f')]['name']);_0x13c878[_0xfb6f('0x25')][_0xfb6f('0x72')]=_0x2b2750[_0xfb6f('0x72')];_0x13c878[_0xfb6f('0x25')][_0xfb6f('0x7d')]=_0x2b2750[_0xfb6f('0x72')];_0x13c878[_0xfb6f('0x25')]['event']=_0xfb6f('0x33');respondWithRpcPromise(_0xfb6f('0x74'),'EventManager',{'event':_0xfb6f('0x7e'),'message':_0x13c878[_0xfb6f('0x25')]},client9002);return _0x2b2750;}return null;})[_0xfb6f('0x1e')](respondWithResult(_0x5554ce,null))['catch'](handleError(_0x5554ce,null));};exports[_0xfb6f('0x2b')]=function(_0x5e354c,_0x288c7a,_0x512f89){if(_0x5e354c['body']['id']){delete _0x5e354c[_0xfb6f('0x57')]['id'];}var _0x50c35d;return db['SmsMessage']['find']({'where':{'id':_0x5e354c[_0xfb6f('0x54')]['id']}})[_0xfb6f('0x1e')](handleEntityNotFound(_0x288c7a,null))[_0xfb6f('0x1e')](function(_0x3c51b2){if(_0x3c51b2){_0x50c35d=_0x3c51b2;return db[_0xfb6f('0x7f')]['find']({'where':{'id':_0x3c51b2[_0xfb6f('0x80')]}});}})[_0xfb6f('0x1e')](handleEntityNotFound(_0x288c7a,null))['then'](function(_0x23d4a2){if(_0x23d4a2){logger[_0xfb6f('0x21')](_0xfb6f('0x81'),_0xfb6f('0x2b'),_0xfb6f('0x82'),_0x23d4a2[_0xfb6f('0x3d')],util[_0xfb6f('0x83')](_0x5e354c[_0xfb6f('0x57')],{'showHidden':![],'depth':null}));switch(_0x23d4a2['type']){case _0xfb6f('0x84'):if(_0x5e354c['body']['MessageSid']&&_0x5e354c[_0xfb6f('0x57')]['MessageSid']===_0x50c35d[_0xfb6f('0x85')]){return _0x50c35d['update']({'read':!![]});}else{logger['error'](_0xfb6f('0x86'),'status',_0xfb6f('0x84'),util['inspect'](_0x5e354c[_0xfb6f('0x57')],{'showHidden':![],'depth':null}));}break;case _0xfb6f('0x87'):if(_0x5e354c['body'][_0xfb6f('0x88')]&&_0x5e354c[_0xfb6f('0x57')][_0xfb6f('0x88')]===_0x50c35d[_0xfb6f('0x85')]&&_[_0xfb6f('0x89')]([_0xfb6f('0x8a'),'delivered'],_0x5e354c['body'][_0xfb6f('0x8b')])>=0x0){return _0x50c35d[_0xfb6f('0x35')]({'read':!![]});}else{logger[_0xfb6f('0x23')](_0xfb6f('0x86'),'status',_0xfb6f('0x8c'),util['inspect'](_0x5e354c[_0xfb6f('0x57')],{'showHidden':![],'depth':null}));}break;case _0xfb6f('0x8d'):var _0x430bc6=_0x5e354c[_0xfb6f('0x57')][_0xfb6f('0x8e')][0x0];if(_0x430bc6['status'][_0xfb6f('0x8f')]===_0xfb6f('0x90')){return _0x50c35d[_0xfb6f('0x35')]({'read':!![]});}else{logger[_0xfb6f('0x23')](_0xfb6f('0x86'),_0xfb6f('0x2b'),'infobip',util[_0xfb6f('0x83')](_0x5e354c['body'],{'showHidden':![],'depth':null}));}break;}return _0x50c35d;}})['then'](respondWithResult(_0x288c7a,null))[_0xfb6f('0x28')](handleError(_0x288c7a,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 74dafba..ba301ac 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 _0x28e7=['setMaxListeners','save','remove','emit','hook','exports','../../mysqldb','SmsMessage'];(function(_0x2e163f,_0x41ecdc){var _0x4ed708=function(_0x2583a7){while(--_0x2583a7){_0x2e163f['push'](_0x2e163f['shift']());}};_0x4ed708(++_0x41ecdc);}(_0x28e7,0x86));var _0x728e=function(_0x25c5af,_0x1667e1){_0x25c5af=_0x25c5af-0x0;var _0x5139f1=_0x28e7[_0x25c5af];return _0x5139f1;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x728e('0x0'))['db'][_0x728e('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x728e('0x2')](0x0);var events={'afterCreate':_0x728e('0x3'),'afterUpdate':'update','afterDestroy':_0x728e('0x4')};function emitEvent(_0x44e3b6){return function(_0x2cb863,_0x4f2e33,_0x426792){SmsMessageEvents[_0x728e('0x5')](_0x44e3b6+':'+_0x2cb863['id'],_0x2cb863);SmsMessageEvents[_0x728e('0x5')](_0x44e3b6,_0x2cb863);_0x426792(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x728e('0x6')](e,emitEvent(event));}}module[_0x728e('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xe8fc=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe8fc,0x9d));var _0xce8f=function(_0x256ea9,_0x390904){_0x256ea9=_0x256ea9-0x0;var _0x32127e=_0xe8fc[_0x256ea9];return _0x32127e;};'use strict';var EventEmitter=require(_0xce8f('0x0'));var SmsMessage=require(_0xce8f('0x1'))['db'][_0xce8f('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xce8f('0x3')](0x0);var events={'afterCreate':_0xce8f('0x4'),'afterUpdate':_0xce8f('0x5'),'afterDestroy':_0xce8f('0x6')};function emitEvent(_0x2fed16){return function(_0x178a2c,_0x3d031d,_0x31824a){SmsMessageEvents['emit'](_0x2fed16+':'+_0x178a2c['id'],_0x178a2c);SmsMessageEvents[_0xce8f('0x7')](_0x2fed16,_0x178a2c);_0x31824a(null);};}for(var e in events){if(events[_0xce8f('0x8')](e)){var event=events[e];SmsMessage[_0xce8f('0x9')](e,emitEvent(event));}}module[_0xce8f('0xa')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 4de0471..8d78333 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 _0xdae9=['secret','isNil','SmsInteractionId','SmsInteraction','findOne','then','createdAt','out','SmsAccount','type','twilio','accountSid','phone','authToken','messages','remote','/api/sms/messages/','/status?token=','sid','update','catch','error','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','sender','login?username=','&password=','GET','sms','session_key','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString','POST','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','authId','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','token','application/json','infobip','Missing\x20parameters:\x20base_url','crypto','login','text','timestamp','keys','sort','length','createHash','md5','hex','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','Token\x20not\x20received','finally','utf8mb4','../../config/logger','api','moment','path','./smsMessage.attributes','exports','SmsMessage','messageId','fti_sms_messages','body','direction','toLowerCase'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdae9,0x1bc));var _0x9dae=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0xdae9[_0x5466ab];return _0x40751a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9dae('0x0'))(_0x9dae('0x1'));var moment=require(_0x9dae('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9dae('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9dae('0x4'));module[_0x9dae('0x5')]=function(_0x580e29,_0x4a3d21){return _0x580e29['define'](_0x9dae('0x6'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x9dae('0x7'),'fields':[_0x9dae('0x7')]},{'name':_0x9dae('0x8'),'fields':[_0x9dae('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b92cb,_0x2ff853,_0x5adaee){var _0x2a513e=_0x580e29['models'];var _0x33412f=_0x4b92cb['get']({'plain':!![]});if(_0x33412f[_0x9dae('0xa')][_0x9dae('0xb')]()==='in'||_0x33412f['direction'][_0x9dae('0xb')]()==='out'&&!_0x33412f[_0x9dae('0xc')]&&!_['isNil'](_0x33412f['UserId'])&&!_[_0x9dae('0xd')](_0x33412f[_0x9dae('0xe')])){_0x2a513e[_0x9dae('0xf')][_0x9dae('0x10')]({'where':{'id':_0x33412f['SmsInteractionId']}})[_0x9dae('0x11')](function(_0x5b5824){if(_0x5b5824){_0x5b5824['update']({'lastMsgAt':_0x33412f[_0x9dae('0x12')],'lastMsgDirection':_0x33412f[_0x9dae('0xa')][_0x9dae('0xb')]()});}})['catch'](function(_0x10df01){console['error'](_0x10df01);});}if(_0x33412f['direction']===_0x9dae('0x13')&&!_0x33412f[_0x9dae('0xc')]){var _0x252335;_0x2a513e[_0x9dae('0x14')]['find']({'where':{'id':_0x33412f['SmsAccountId']},'raw':!![]})[_0x9dae('0x11')](function(_0x398d2d){_0x252335=_0x398d2d;if(_0x252335&&_0x252335['type']){switch(_0x252335[_0x9dae('0x15')]){case _0x9dae('0x16'):var _0xa7e57=require('twilio');if(_0x252335[_0x9dae('0x17')]&&_0x252335['authToken']&&_0x252335[_0x9dae('0x18')]){var _0x155add=new _0xa7e57(_0x252335[_0x9dae('0x17')],_0x252335[_0x9dae('0x19')]);_0x155add[_0x9dae('0x1a')]['create']({'body':_0x33412f[_0x9dae('0x9')],'to':_0x33412f[_0x9dae('0x18')],'from':_0x252335[_0x9dae('0x18')],'statusCallback':_0x252335[_0x9dae('0x1b')]+_0x9dae('0x1c')+_0x33412f['id']+_0x9dae('0x1d')+_0x252335['token']})[_0x9dae('0x11')](function(_0x104593){if(_0x104593[_0x9dae('0x1e')]){return _0x4b92cb[_0x9dae('0x1f')]({'messageId':_0x104593[_0x9dae('0x1e')]});}})[_0x9dae('0x20')](function(_0x5022b3){logger[_0x9dae('0x21')](_0x9dae('0x22'),_0x9dae('0x23'),_0x9dae('0x16'),util[_0x9dae('0x24')](_0x5022b3,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9dae('0x23'),'twilio',_0x9dae('0x25'));}break;case _0x9dae('0x26'):var _0x2c2330=_0x9dae('0x27');if(_0x252335[_0x9dae('0x28')]&&_0x252335[_0x9dae('0x29')]){var _0x2c5b9c={'recipient':[_0x33412f[_0x9dae('0x18')]],'message':_0x33412f['body'],'message_type':_0x252335['smsMethod']};if(_0x252335['smsMethod']&&_0x252335[_0x9dae('0x2a')]!=='SI'){_0x2c5b9c[_0x9dae('0x2b')]=_0x252335['phone'];}var _0x5e637c={'url':_0x2c2330+_0x9dae('0x2c')+_0x252335[_0x9dae('0x28')]+_0x9dae('0x2d')+_0x252335[_0x9dae('0x29')],'method':_0x9dae('0x2e')};rp(_0x5e637c)[_0x9dae('0x11')](function(_0x299bce){var _0xd7afe9=_0x299bce['split'](';');var _0x3eab78={'user_key':_0xd7afe9[0x0],'session_key':_0xd7afe9[0x1]};_0x5e637c={'url':_0x2c2330+_0x9dae('0x2f'),'method':'POST','headers':{'user_key':_0x3eab78['user_key'],'Session_key':_0x3eab78[_0x9dae('0x30')]},'json':!![],'body':_0x2c5b9c};return rp(_0x5e637c);})[_0x9dae('0x11')](function(_0x1fe238){if(_0x1fe238['total_sent']>=0x1){var _0x4f8de1={'messageId':_0x1fe238[_0x9dae('0x31')]};if(_0x252335[_0x9dae('0x2a')]!=='GP'||!_0x252335[_0x9dae('0x32')]){_0x4f8de1[_0x9dae('0x33')]=!![];}return _0x4b92cb['update'](_0x4f8de1);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9dae('0x23'),_0x9dae('0x26'),util[_0x9dae('0x24')](_0x1fe238,{'showHidden':![],'depth':null}));}})[_0x9dae('0x20')](function(_0x20d49){return logger[_0x9dae('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9dae('0x26'),util[_0x9dae('0x24')](_0x20d49,{'showHidden':![],'depth':null}));});}else{logger[_0x9dae('0x21')](_0x9dae('0x22'),_0x9dae('0x23'),_0x9dae('0x26'),_0x9dae('0x34'));}break;case'connectel':if(_0x252335[_0x9dae('0x19')]){var _0xa0ea43={'recipient':_0x33412f[_0x9dae('0x18')],'message':_0x33412f[_0x9dae('0x9')],'sender':_0x252335[_0x9dae('0x35')]||_0x252335[_0x9dae('0x18')],'authorization':_0x252335[_0x9dae('0x19')]};var _0x2ff853={'method':_0x9dae('0x36'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0xa0ea43,'json':!![]};rp(_0x2ff853)[_0x9dae('0x11')](function(_0x369b0c){var _0x5e8e36={'messageId':_0x369b0c[_0x9dae('0x37')]};if(!_0x252335[_0x9dae('0x32')]){_0x5e8e36[_0x9dae('0x33')]=!![];}return _0x4b92cb[_0x9dae('0x1f')](_0x5e8e36);})['catch'](function(_0x408da1){logger[_0x9dae('0x21')](_0x9dae('0x22'),_0x9dae('0x23'),'connectel',util[_0x9dae('0x24')](_0x408da1,{'showHidden':![],'depth':null}));});}else{logger[_0x9dae('0x21')](_0x9dae('0x22'),_0x9dae('0x23'),_0x9dae('0x38'),_0x9dae('0x39'));}break;case _0x9dae('0x3a'):if(_0x252335['username']&&_0x252335['password']){var _0xa0ea43={'messages':[{'source':_0x9dae('0x3b'),'to':_0x33412f['phone'],'body':_0x33412f['body'],'from':_0x252335['senderString']||_0x252335[_0x9dae('0x18')]}]};var _0x5ffb2b=util[_0x9dae('0x3c')](_0x9dae('0x3d'),_0x252335[_0x9dae('0x28')],_0x252335[_0x9dae('0x29')]);var _0x2ff853={'method':'POST','uri':_0x9dae('0x3e'),'body':_0xa0ea43,'headers':{'Authorization':util[_0x9dae('0x3c')](_0x9dae('0x3f'),new Buffer(_0x5ffb2b)[_0x9dae('0x40')]('base64'))},'json':!![]};rp(_0x2ff853)['then'](function(_0x29d2f8){if(_0x29d2f8['http_code']>=0xc8&&_0x29d2f8[_0x9dae('0x41')]<=0xce){if(_0x29d2f8[_0x9dae('0x42')]&&_0x29d2f8[_0x9dae('0x42')][_0x9dae('0x43')]>0x0){var _0x1734ed=_[_0x9dae('0x44')](_0x29d2f8[_0x9dae('0x42')][_0x9dae('0x1a')]);var _0x5a0810={'messageId':_0x1734ed[_0x9dae('0x45')]};if(!_0x252335['deliveryReport']){_0x5a0810[_0x9dae('0x33')]=!![];}return _0x4b92cb[_0x9dae('0x1f')](_0x5a0810);}else{logger[_0x9dae('0x21')](_0x9dae('0x22'),'afterCreate',_0x9dae('0x46'),util['inspect'](_0x29d2f8,{'showHidden':![],'depth':null}));}}else{logger[_0x9dae('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9dae('0x46'),util[_0x9dae('0x24')](_0x29d2f8,{'showHidden':![],'depth':null}));}})[_0x9dae('0x20')](function(_0x3a8d98){logger[_0x9dae('0x21')](_0x9dae('0x22'),_0x9dae('0x23'),_0x9dae('0x46'),util[_0x9dae('0x24')](_0x3a8d98,{'showHidden':![],'depth':null}));});}else{logger[_0x9dae('0x21')](_0x9dae('0x22'),_0x9dae('0x23'),_0x9dae('0x46'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x252335['authId']&&_0x252335[_0x9dae('0x19')]){var _0xa0ea43={'dst':_0x33412f[_0x9dae('0x18')],'text':_0x33412f[_0x9dae('0x9')],'src':_0x252335[_0x9dae('0x35')]||_0x252335[_0x9dae('0x18')],'url':_0x252335[_0x9dae('0x1b')]+_0x9dae('0x1c')+_0x33412f['id']+_0x9dae('0x1d')+_0x252335['token']};var _0x5ffb2b=util[_0x9dae('0x3c')]('%s:%s',_0x252335[_0x9dae('0x47')],_0x252335[_0x9dae('0x19')]);var _0x2ff853={'method':_0x9dae('0x36'),'uri':util[_0x9dae('0x3c')]('https://api.plivo.com/v1/Account/%s/Message/',_0x252335['authId']),'body':_0xa0ea43,'headers':{'Authorization':util[_0x9dae('0x3c')](_0x9dae('0x3f'),new Buffer(_0x5ffb2b)[_0x9dae('0x40')](_0x9dae('0x48')))},'json':!![]};rp(_0x2ff853)[_0x9dae('0x11')](function(_0x1ce803){var _0x1abf1b={'messageId':_0x1ce803[_0x9dae('0x49')][0x0]};return _0x4b92cb[_0x9dae('0x1f')](_0x1abf1b);})[_0x9dae('0x20')](function(_0x604b8f){logger[_0x9dae('0x21')](_0x9dae('0x22'),_0x9dae('0x23'),_0x9dae('0x4a'),util[_0x9dae('0x24')](_0x604b8f,{'showHidden':![],'depth':null}));});}else{logger[_0x9dae('0x21')](_0x9dae('0x22'),_0x9dae('0x23'),'plivo',_0x9dae('0x4b'));}break;case'infobip':if(_0x252335[_0x9dae('0x28')]&&_0x252335[_0x9dae('0x29')]){if(_0x252335['baseUrl']){var _0x74a168={'method':'POST','uri':_0x252335[_0x9dae('0x4c')]+_0x9dae('0x4d'),'body':{'username':_0x252335[_0x9dae('0x28')],'password':_0x252335['password']},'json':!![]};return rp(_0x74a168)[_0x9dae('0x11')](function(_0x43cbb4){var _0x4fc079={'method':_0x9dae('0x36'),'uri':_0x252335[_0x9dae('0x4c')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x252335[_0x9dae('0x18')],'destinations':[{'to':_0x33412f[_0x9dae('0x18')]}],'text':_0x33412f[_0x9dae('0x9')],'notifyUrl':_0x252335[_0x9dae('0x1b')]+'/api/sms/messages/'+_0x33412f['id']+_0x9dae('0x1d')+_0x252335[_0x9dae('0x4e')],'notifyContentType':_0x9dae('0x4f'),'callbackData':_0x252335[_0x9dae('0x18')]+';'+_0x33412f[_0x9dae('0x9')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x43cbb4['token']},'json':!![]};return rp(_0x4fc079)[_0x9dae('0x11')](function(_0x5317b8){if(_0x5317b8[_0x9dae('0x1a')]){var _0x50c7c2={'messageId':_0x5317b8[_0x9dae('0x1a')][0x0][_0x9dae('0x7')]};if(!_0x252335[_0x9dae('0x32')]){_0x50c7c2[_0x9dae('0x33')]=!![];}return _0x4b92cb[_0x9dae('0x1f')](_0x50c7c2);}else{return logger[_0x9dae('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9dae('0x50'),util[_0x9dae('0x24')](_0x5317b8,{'showHidden':![],'depth':null}));}});})[_0x9dae('0x20')](function(_0x1b9acd){return logger['error'](_0x9dae('0x22'),_0x9dae('0x23'),_0x9dae('0x50'),util['inspect'](_0x1b9acd,{'showHidden':![],'depth':null}));});}else{logger[_0x9dae('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9dae('0x23'),_0x9dae('0x50'),_0x9dae('0x51'));}}else{logger[_0x9dae('0x21')](_0x9dae('0x22'),_0x9dae('0x23'),_0x9dae('0x50'),_0x9dae('0x34'));}break;case'csc':var _0x5507b4=require(_0x9dae('0x52'));if(_0x252335['apiKey']){var _0x449649={};_0x449649[_0x9dae('0x53')]=_0x252335[_0x9dae('0x28')];_0x449649['phone']=_0x33412f['phone'];_0x449649[_0x9dae('0x2b')]=_0x252335[_0x9dae('0x18')];_0x449649[_0x9dae('0x54')]=_0x33412f['body'];_0x449649[_0x9dae('0x55')]=+new Date();var _0x5f2fc4='';var _0x171333='';var _0x3d2cbb=Object[_0x9dae('0x56')](_0x449649);_0x3d2cbb[_0x9dae('0x57')]();for(var _0x47d0b3=0x0;_0x47d0b3<_0x3d2cbb[_0x9dae('0x58')];_0x47d0b3++){if(_0x5f2fc4!=''){_0x5f2fc4+='&';}_0x5f2fc4+=_0x3d2cbb[_0x47d0b3]+'='+encodeURIComponent(_0x449649[_0x3d2cbb[_0x47d0b3]]);_0x171333+=_0x449649[_0x3d2cbb[_0x47d0b3]];}_0x171333+=_0x252335['apiKey'];_0x171333=_0x5507b4[_0x9dae('0x59')](_0x9dae('0x5a'))[_0x9dae('0x1f')](_0x171333)['digest'](_0x9dae('0x5b'));if(_0x5f2fc4!==''){_0x5f2fc4+='&';}_0x5f2fc4+='signature='+_0x171333;var _0x5e637c={'method':'GET','uri':_0x252335[_0x9dae('0x4c')]+_0x9dae('0x5c')+_0x5f2fc4,'json':!![]};return rp(_0x5e637c)['then'](function(_0x5cc80b){var _0x5eeaa3=Object['keys'](_0x5cc80b);if(_0x5cc80b[_0x5eeaa3[0x0]][_0x9dae('0x21')]&&parseInt(_0x5cc80b[_0x5eeaa3[0x0]][_0x9dae('0x21')])===0x0){var _0x2ef543={'messageId':_0x5cc80b[_0x5eeaa3[0x0]][_0x9dae('0x5d')]};if(!_0x252335[_0x9dae('0x32')]){_0x2ef543[_0x9dae('0x33')]=!![];}return _0x4b92cb['update'](_0x2ef543);}else{return logger[_0x9dae('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9dae('0x23'),_0x9dae('0x5e'),util['inspect'](_0x5cc80b[_0x9dae('0x21')],{'showHidden':![],'depth':null}));}})[_0x9dae('0x20')](function(_0x276b32){return logger[_0x9dae('0x21')](_0x9dae('0x22'),_0x9dae('0x23'),'csc',util[_0x9dae('0x24')](_0x276b32,{'showHidden':![],'depth':null}));});}else{logger[_0x9dae('0x21')](_0x9dae('0x22'),'afterCreate',_0x9dae('0x5e'),_0x9dae('0x5f'));}break;case _0x9dae('0x60'):if(_0x252335[_0x9dae('0x61')]){var _0x3f02fd={'method':_0x9dae('0x36'),'uri':_0x9dae('0x62'),'headers':{'Authorization':_0x252335[_0x9dae('0x61')]},'body':{'content':_0x33412f[_0x9dae('0x9')],'to':[_0x33412f[_0x9dae('0x18')]],'from':_0x252335[_0x9dae('0x18')],'binary':![],'clientMessageId':_0x9dae('0x63'),'charset':'UTF-8'},'json':!![]};rp(_0x3f02fd)['then'](function(_0x15f224){if(!_0x15f224[_0x9dae('0x21')]){var _0x5c9ed6={'messageId':_0x15f224[_0x9dae('0x1a')][0x0][_0x9dae('0x64')]};if(!_0x252335[_0x9dae('0x32')]){_0x5c9ed6[_0x9dae('0x33')]=!![];}return _0x4b92cb[_0x9dae('0x1f')](_0x5c9ed6);}else{return logger[_0x9dae('0x21')](_0x9dae('0x22'),_0x9dae('0x23'),_0x9dae('0x60'),util[_0x9dae('0x24')](_0x15f224['error'],{'showHidden':![],'depth':null}));}})[_0x9dae('0x20')](function(_0x1e9ac7){return logger[_0x9dae('0x21')](_0x9dae('0x22'),_0x9dae('0x23'),'clickatell',util['inspect'](_0x1e9ac7,{'showHidden':![],'depth':null}));});}else{logger[_0x9dae('0x21')](_0x9dae('0x22'),_0x9dae('0x23'),_0x9dae('0x60'),_0x9dae('0x5f'));}break;case _0x9dae('0x65'):if(_0x252335[_0x9dae('0x28')]&&_0x252335['password']){var _0x5ffb2b=util[_0x9dae('0x3c')](_0x9dae('0x3d'),_0x252335[_0x9dae('0x28')],_0x252335[_0x9dae('0x29')]);var _0x2ff853={'method':_0x9dae('0x36'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x252335[_0x9dae('0x66')]+_0x9dae('0x67'),'body':{'to':[_0x33412f[_0x9dae('0x18')]],'text':_0x33412f[_0x9dae('0x9')],'from':_0x252335['phone'],'applicationId':_0x252335[_0x9dae('0x68')]},'headers':{'Authorization':util[_0x9dae('0x3c')](_0x9dae('0x3f'),new Buffer(_0x5ffb2b)['toString'](_0x9dae('0x48')))},'json':!![]};rp(_0x2ff853)[_0x9dae('0x11')](function(_0x369240){if(_0x369240['id']){var _0x48d4e6={'messageId':_0x369240['id']};return _0x4b92cb[_0x9dae('0x1f')](_0x48d4e6);}else{logger['error'](_0x9dae('0x22'),_0x9dae('0x23'),'bandwidth',util['inspect'](_0x369240,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1a669e){logger[_0x9dae('0x21')](_0x9dae('0x22'),_0x9dae('0x23'),'bandwidth',util[_0x9dae('0x24')](_0x1a669e,{'showHidden':![],'depth':null}));});}else{logger[_0x9dae('0x21')](_0x9dae('0x22'),_0x9dae('0x23'),_0x9dae('0x65'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x9dae('0x69'):if(_0x252335[_0x9dae('0x61')]){var _0x31696b={};var _0x5e637c={'method':_0x9dae('0x36'),'uri':_0x9dae('0x6a'),'headers':{'Authorization':_0x9dae('0x6b')+_0x252335[_0x9dae('0x61')],'Content-Type':'application/json'},'body':{'from':_0x252335[_0x9dae('0x18')],'to':_0x33412f[_0x9dae('0x18')],'text':_0x33412f[_0x9dae('0x9')]},'json':!![]};return rp(_0x5e637c)[_0x9dae('0x11')](function(_0x1cce44){if(_0x1cce44[_0x9dae('0x6c')]==0xca){_0x31696b['message']=_0x1cce44;var _0x3ddd6c={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x9dae('0x6b')+_0x252335[_0x9dae('0x61')],'Content-Type':_0x9dae('0x4f')},'body':{'refid':_0x31696b[_0x9dae('0x6d')][_0x9dae('0x6e')]},'json':!![]};return rp(_0x3ddd6c)['then'](function(_0x3ec470){_0x31696b['status']=_0x3ec470;var _0x24a8c0={'messageId':_0x31696b['message'][_0x9dae('0x6e')],'read':!![]};return _0x4b92cb[_0x9dae('0x1f')](_0x24a8c0);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9dae('0x23'),_0x9dae('0x69'),util[_0x9dae('0x24')](_0x1cce44,{'showHidden':![],'depth':null}));}})['catch'](function(_0x14779f){return logger['error'](_0x9dae('0x22'),'afterCreate',_0x9dae('0x69'),util[_0x9dae('0x24')](_0x14779f,{'showHidden':![],'depth':null}));});}else{return logger[_0x9dae('0x21')](_0x9dae('0x22'),'afterCreate',_0x9dae('0x69'),_0x9dae('0x6f'));}break;}}})[_0x9dae('0x70')](function(){_0x5adaee();});}else{_0x5adaee();}}},'charset':_0x9dae('0x71'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf808=['format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','%s:%s','message_uuid','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','text','keys','sort','createHash','md5','digest','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','out','secret','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','&password=','GET','sms','POST','user_key','session_key','total_sent','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','clicksend','xCALLY\x20Motion'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0xf808,0xb2));var _0x8f80=function(_0x169b2f,_0x1cca40){_0x169b2f=_0x169b2f-0x0;var _0x2a268b=_0xf808[_0x169b2f];return _0x2a268b;};'use strict';var _=require(_0x8f80('0x0'));var util=require(_0x8f80('0x1'));var logger=require(_0x8f80('0x2'))(_0x8f80('0x3'));var moment=require(_0x8f80('0x4'));var BPromise=require('bluebird');var rp=require(_0x8f80('0x5'));var fs=require('fs');var path=require(_0x8f80('0x6'));var rimraf=require('rimraf');var config=require(_0x8f80('0x7'));var attributes=require(_0x8f80('0x8'));module[_0x8f80('0x9')]=function(_0x3e7a12,_0x405663){return _0x3e7a12['define'](_0x8f80('0xa'),attributes,{'tableName':_0x8f80('0xb'),'paranoid':![],'indexes':[{'name':_0x8f80('0xc'),'fields':[_0x8f80('0xc')]},{'name':'fti_sms_messages','fields':[_0x8f80('0xd')],'type':_0x8f80('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xe86d51,_0x459f1b,_0x4f5b32){var _0x41c0f1=_0x3e7a12[_0x8f80('0xf')];var _0x15b46d=_0xe86d51[_0x8f80('0x10')]({'plain':!![]});if(_0x15b46d[_0x8f80('0x11')]['toLowerCase']()==='in'||_0x15b46d[_0x8f80('0x11')][_0x8f80('0x12')]()==='out'&&!_0x15b46d['secret']&&!_[_0x8f80('0x13')](_0x15b46d[_0x8f80('0x14')])&&!_[_0x8f80('0x13')](_0x15b46d[_0x8f80('0x15')])){_0x41c0f1[_0x8f80('0x16')][_0x8f80('0x17')]({'where':{'id':_0x15b46d['SmsInteractionId']}})[_0x8f80('0x18')](function(_0xa688d6){if(_0xa688d6){_0xa688d6[_0x8f80('0x19')]({'lastMsgAt':_0x15b46d[_0x8f80('0x1a')],'lastMsgDirection':_0x15b46d['direction'][_0x8f80('0x12')]()});}})[_0x8f80('0x1b')](function(_0x504b36){console[_0x8f80('0x1c')](_0x504b36);});}if(_0x15b46d[_0x8f80('0x11')]===_0x8f80('0x1d')&&!_0x15b46d[_0x8f80('0x1e')]){var _0x2fdb48;_0x41c0f1['SmsAccount'][_0x8f80('0x1f')]({'where':{'id':_0x15b46d[_0x8f80('0x20')]},'raw':!![]})[_0x8f80('0x18')](function(_0x5ac91d){_0x2fdb48=_0x5ac91d;if(_0x2fdb48&&_0x2fdb48[_0x8f80('0x21')]){switch(_0x2fdb48[_0x8f80('0x21')]){case _0x8f80('0x22'):var _0x1bea15=require(_0x8f80('0x22'));if(_0x2fdb48['accountSid']&&_0x2fdb48[_0x8f80('0x23')]&&_0x2fdb48[_0x8f80('0x24')]){var _0x41b0de=new _0x1bea15(_0x2fdb48[_0x8f80('0x25')],_0x2fdb48[_0x8f80('0x23')]);_0x41b0de[_0x8f80('0x26')][_0x8f80('0x27')]({'body':_0x15b46d[_0x8f80('0xd')],'to':_0x15b46d[_0x8f80('0x24')],'from':_0x2fdb48[_0x8f80('0x24')],'statusCallback':_0x2fdb48[_0x8f80('0x28')]+_0x8f80('0x29')+_0x15b46d['id']+_0x8f80('0x2a')+_0x2fdb48[_0x8f80('0x2b')]})[_0x8f80('0x18')](function(_0x16feee){if(_0x16feee[_0x8f80('0x2c')]){return _0xe86d51['update']({'messageId':_0x16feee[_0x8f80('0x2c')]});}})[_0x8f80('0x1b')](function(_0x406b06){logger[_0x8f80('0x1c')](_0x8f80('0x2d'),_0x8f80('0x2e'),_0x8f80('0x22'),util[_0x8f80('0x2f')](_0x406b06,{'showHidden':![],'depth':null}));});}else{logger[_0x8f80('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8f80('0x2e'),_0x8f80('0x22'),_0x8f80('0x30'));}break;case _0x8f80('0x31'):var _0x5ab470=_0x8f80('0x32');if(_0x2fdb48[_0x8f80('0x33')]&&_0x2fdb48[_0x8f80('0x34')]){var _0x3881d6={'recipient':[_0x15b46d[_0x8f80('0x24')]],'message':_0x15b46d[_0x8f80('0xd')],'message_type':_0x2fdb48['smsMethod']};if(_0x2fdb48[_0x8f80('0x35')]&&_0x2fdb48['smsMethod']!=='SI'){_0x3881d6['sender']=_0x2fdb48[_0x8f80('0x24')];}var _0x157691={'url':_0x5ab470+'login?username='+_0x2fdb48[_0x8f80('0x33')]+_0x8f80('0x36')+_0x2fdb48[_0x8f80('0x34')],'method':_0x8f80('0x37')};rp(_0x157691)[_0x8f80('0x18')](function(_0x4564eb){var _0x254e26=_0x4564eb['split'](';');var _0xe39490={'user_key':_0x254e26[0x0],'session_key':_0x254e26[0x1]};_0x157691={'url':_0x5ab470+_0x8f80('0x38'),'method':_0x8f80('0x39'),'headers':{'user_key':_0xe39490[_0x8f80('0x3a')],'Session_key':_0xe39490[_0x8f80('0x3b')]},'json':!![],'body':_0x3881d6};return rp(_0x157691);})[_0x8f80('0x18')](function(_0x585ca1){if(_0x585ca1[_0x8f80('0x3c')]>=0x1){var _0x50fdf7={'messageId':_0x585ca1['internal_order_id']};if(_0x2fdb48[_0x8f80('0x35')]!=='GP'||!_0x2fdb48[_0x8f80('0x3d')]){_0x50fdf7[_0x8f80('0x3e')]=!![];}return _0xe86d51[_0x8f80('0x19')](_0x50fdf7);}else{return logger[_0x8f80('0x1c')](_0x8f80('0x2d'),_0x8f80('0x2e'),_0x8f80('0x31'),util[_0x8f80('0x2f')](_0x585ca1,{'showHidden':![],'depth':null}));}})[_0x8f80('0x1b')](function(_0x316a09){return logger[_0x8f80('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8f80('0x31'),util[_0x8f80('0x2f')](_0x316a09,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8f80('0x2d'),_0x8f80('0x2e'),'skebby',_0x8f80('0x3f'));}break;case'connectel':if(_0x2fdb48['authToken']){var _0x3965c2={'recipient':_0x15b46d[_0x8f80('0x24')],'message':_0x15b46d[_0x8f80('0xd')],'sender':_0x2fdb48[_0x8f80('0x40')]||_0x2fdb48['phone'],'authorization':_0x2fdb48[_0x8f80('0x23')]};var _0x459f1b={'method':_0x8f80('0x39'),'uri':_0x8f80('0x41'),'body':_0x3965c2,'json':!![]};rp(_0x459f1b)[_0x8f80('0x18')](function(_0x4d45ce){var _0x550045={'messageId':_0x4d45ce[_0x8f80('0x42')]};if(!_0x2fdb48[_0x8f80('0x3d')]){_0x550045[_0x8f80('0x3e')]=!![];}return _0xe86d51[_0x8f80('0x19')](_0x550045);})[_0x8f80('0x1b')](function(_0x3ee7c6){logger[_0x8f80('0x1c')](_0x8f80('0x2d'),_0x8f80('0x2e'),_0x8f80('0x43'),util[_0x8f80('0x2f')](_0x3ee7c6,{'showHidden':![],'depth':null}));});}else{logger[_0x8f80('0x1c')](_0x8f80('0x2d'),'afterCreate','connectel','Missing\x20parameters:\x20authToken');}break;case _0x8f80('0x44'):if(_0x2fdb48[_0x8f80('0x33')]&&_0x2fdb48['password']){var _0x3965c2={'messages':[{'source':_0x8f80('0x45'),'to':_0x15b46d[_0x8f80('0x24')],'body':_0x15b46d[_0x8f80('0xd')],'from':_0x2fdb48[_0x8f80('0x40')]||_0x2fdb48[_0x8f80('0x24')]}]};var _0x3eb827=util[_0x8f80('0x46')]('%s:%s',_0x2fdb48[_0x8f80('0x33')],_0x2fdb48[_0x8f80('0x34')]);var _0x459f1b={'method':_0x8f80('0x39'),'uri':_0x8f80('0x47'),'body':_0x3965c2,'headers':{'Authorization':util[_0x8f80('0x46')](_0x8f80('0x48'),new Buffer(_0x3eb827)[_0x8f80('0x49')](_0x8f80('0x4a')))},'json':!![]};rp(_0x459f1b)[_0x8f80('0x18')](function(_0x53b5b9){if(_0x53b5b9['http_code']>=0xc8&&_0x53b5b9[_0x8f80('0x4b')]<=0xce){if(_0x53b5b9[_0x8f80('0x4c')]&&_0x53b5b9[_0x8f80('0x4c')][_0x8f80('0x4d')]>0x0){var _0x25bdbd=_[_0x8f80('0x4e')](_0x53b5b9[_0x8f80('0x4c')][_0x8f80('0x26')]);var _0xf73133={'messageId':_0x25bdbd[_0x8f80('0x4f')]};if(!_0x2fdb48[_0x8f80('0x3d')]){_0xf73133[_0x8f80('0x3e')]=!![];}return _0xe86d51[_0x8f80('0x19')](_0xf73133);}else{logger[_0x8f80('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util['inspect'](_0x53b5b9,{'showHidden':![],'depth':null}));}}else{logger[_0x8f80('0x1c')](_0x8f80('0x2d'),_0x8f80('0x2e'),_0x8f80('0x50'),util[_0x8f80('0x2f')](_0x53b5b9,{'showHidden':![],'depth':null}));}})[_0x8f80('0x1b')](function(_0x4367a5){logger[_0x8f80('0x1c')](_0x8f80('0x2d'),_0x8f80('0x2e'),_0x8f80('0x50'),util[_0x8f80('0x2f')](_0x4367a5,{'showHidden':![],'depth':null}));});}else{logger[_0x8f80('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8f80('0x2e'),'clickSend',_0x8f80('0x3f'));}break;case _0x8f80('0x51'):if(_0x2fdb48[_0x8f80('0x52')]&&_0x2fdb48[_0x8f80('0x23')]){var _0x3965c2={'dst':_0x15b46d[_0x8f80('0x24')],'text':_0x15b46d['body'],'src':_0x2fdb48[_0x8f80('0x40')]||_0x2fdb48['phone'],'url':_0x2fdb48[_0x8f80('0x28')]+'/api/sms/messages/'+_0x15b46d['id']+'/status?token='+_0x2fdb48[_0x8f80('0x2b')]};var _0x3eb827=util[_0x8f80('0x46')](_0x8f80('0x53'),_0x2fdb48[_0x8f80('0x52')],_0x2fdb48['authToken']);var _0x459f1b={'method':'POST','uri':util[_0x8f80('0x46')]('https://api.plivo.com/v1/Account/%s/Message/',_0x2fdb48[_0x8f80('0x52')]),'body':_0x3965c2,'headers':{'Authorization':util[_0x8f80('0x46')](_0x8f80('0x48'),new Buffer(_0x3eb827)['toString'](_0x8f80('0x4a')))},'json':!![]};rp(_0x459f1b)[_0x8f80('0x18')](function(_0x2a592f){var _0x4ed8de={'messageId':_0x2a592f[_0x8f80('0x54')][0x0]};return _0xe86d51[_0x8f80('0x19')](_0x4ed8de);})['catch'](function(_0x53489b){logger[_0x8f80('0x1c')](_0x8f80('0x2d'),'afterCreate',_0x8f80('0x51'),util['inspect'](_0x53489b,{'showHidden':![],'depth':null}));});}else{logger[_0x8f80('0x1c')](_0x8f80('0x2d'),_0x8f80('0x2e'),_0x8f80('0x51'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x8f80('0x55'):if(_0x2fdb48[_0x8f80('0x33')]&&_0x2fdb48[_0x8f80('0x34')]){if(_0x2fdb48[_0x8f80('0x56')]){var _0x5e2f21={'method':_0x8f80('0x39'),'uri':_0x2fdb48[_0x8f80('0x56')]+_0x8f80('0x57'),'body':{'username':_0x2fdb48[_0x8f80('0x33')],'password':_0x2fdb48['password']},'json':!![]};return rp(_0x5e2f21)['then'](function(_0x3df0f2){var _0x53544a={'method':'POST','uri':_0x2fdb48[_0x8f80('0x56')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x2fdb48[_0x8f80('0x24')],'destinations':[{'to':_0x15b46d[_0x8f80('0x24')]}],'text':_0x15b46d[_0x8f80('0xd')],'notifyUrl':_0x2fdb48[_0x8f80('0x28')]+_0x8f80('0x29')+_0x15b46d['id']+_0x8f80('0x2a')+_0x2fdb48['token'],'notifyContentType':_0x8f80('0x58'),'callbackData':_0x2fdb48['phone']+';'+_0x15b46d['body']}]},'headers':{'Authorization':_0x8f80('0x59')+_0x3df0f2[_0x8f80('0x2b')]},'json':!![]};return rp(_0x53544a)[_0x8f80('0x18')](function(_0x1ef845){if(_0x1ef845[_0x8f80('0x26')]){var _0xffe09f={'messageId':_0x1ef845['messages'][0x0][_0x8f80('0xc')]};if(!_0x2fdb48[_0x8f80('0x3d')]){_0xffe09f[_0x8f80('0x3e')]=!![];}return _0xe86d51[_0x8f80('0x19')](_0xffe09f);}else{return logger[_0x8f80('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8f80('0x2e'),_0x8f80('0x55'),util['inspect'](_0x1ef845,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x56b482){return logger[_0x8f80('0x1c')](_0x8f80('0x2d'),_0x8f80('0x2e'),'infobip',util['inspect'](_0x56b482,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8f80('0x2e'),'infobip',_0x8f80('0x5a'));}}else{logger[_0x8f80('0x1c')](_0x8f80('0x2d'),_0x8f80('0x2e'),'infobip',_0x8f80('0x3f'));}break;case _0x8f80('0x5b'):var _0x4f03f1=require(_0x8f80('0x5c'));if(_0x2fdb48[_0x8f80('0x5d')]){var _0x3d25fe={};_0x3d25fe[_0x8f80('0x5e')]=_0x2fdb48[_0x8f80('0x33')];_0x3d25fe[_0x8f80('0x24')]=_0x15b46d['phone'];_0x3d25fe[_0x8f80('0x5f')]=_0x2fdb48[_0x8f80('0x24')];_0x3d25fe[_0x8f80('0x60')]=_0x15b46d['body'];_0x3d25fe['timestamp']=+new Date();var _0x5b7348='';var _0x44ba61='';var _0x1000eb=Object[_0x8f80('0x61')](_0x3d25fe);_0x1000eb[_0x8f80('0x62')]();for(var _0x45850b=0x0;_0x45850b<_0x1000eb['length'];_0x45850b++){if(_0x5b7348!=''){_0x5b7348+='&';}_0x5b7348+=_0x1000eb[_0x45850b]+'='+encodeURIComponent(_0x3d25fe[_0x1000eb[_0x45850b]]);_0x44ba61+=_0x3d25fe[_0x1000eb[_0x45850b]];}_0x44ba61+=_0x2fdb48[_0x8f80('0x5d')];_0x44ba61=_0x4f03f1[_0x8f80('0x63')](_0x8f80('0x64'))[_0x8f80('0x19')](_0x44ba61)[_0x8f80('0x65')]('hex');if(_0x5b7348!==''){_0x5b7348+='&';}_0x5b7348+=_0x8f80('0x66')+_0x44ba61;var _0x157691={'method':_0x8f80('0x37'),'uri':_0x2fdb48[_0x8f80('0x56')]+_0x8f80('0x67')+_0x5b7348,'json':!![]};return rp(_0x157691)[_0x8f80('0x18')](function(_0x1bd354){var _0x366152=Object[_0x8f80('0x61')](_0x1bd354);if(_0x1bd354[_0x366152[0x0]][_0x8f80('0x1c')]&&parseInt(_0x1bd354[_0x366152[0x0]][_0x8f80('0x1c')])===0x0){var _0x3ce317={'messageId':_0x1bd354[_0x366152[0x0]]['id_sms']};if(!_0x2fdb48['deliveryReport']){_0x3ce317[_0x8f80('0x3e')]=!![];}return _0xe86d51[_0x8f80('0x19')](_0x3ce317);}else{return logger[_0x8f80('0x1c')](_0x8f80('0x2d'),'afterCreate',_0x8f80('0x5b'),util[_0x8f80('0x2f')](_0x1bd354['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2b5307){return logger[_0x8f80('0x1c')](_0x8f80('0x2d'),_0x8f80('0x2e'),_0x8f80('0x5b'),util['inspect'](_0x2b5307,{'showHidden':![],'depth':null}));});}else{logger[_0x8f80('0x1c')](_0x8f80('0x2d'),'afterCreate',_0x8f80('0x5b'),_0x8f80('0x68'));}break;case _0x8f80('0x69'):if(_0x2fdb48[_0x8f80('0x5d')]){var _0x1fc64b={'method':_0x8f80('0x39'),'uri':_0x8f80('0x6a'),'headers':{'Authorization':_0x2fdb48[_0x8f80('0x5d')]},'body':{'content':_0x15b46d['body'],'to':[_0x15b46d[_0x8f80('0x24')]],'from':_0x2fdb48[_0x8f80('0x24')],'binary':![],'clientMessageId':_0x8f80('0x6b'),'charset':'UTF-8'},'json':!![]};rp(_0x1fc64b)[_0x8f80('0x18')](function(_0x22a70d){if(!_0x22a70d[_0x8f80('0x1c')]){var _0x54ce0c={'messageId':_0x22a70d[_0x8f80('0x26')][0x0]['apiMessageId']};if(!_0x2fdb48['deliveryReport']){_0x54ce0c[_0x8f80('0x3e')]=!![];}return _0xe86d51[_0x8f80('0x19')](_0x54ce0c);}else{return logger[_0x8f80('0x1c')](_0x8f80('0x2d'),_0x8f80('0x2e'),'clickatell',util[_0x8f80('0x2f')](_0x22a70d[_0x8f80('0x1c')],{'showHidden':![],'depth':null}));}})[_0x8f80('0x1b')](function(_0x438050){return logger['error'](_0x8f80('0x2d'),_0x8f80('0x2e'),_0x8f80('0x69'),util['inspect'](_0x438050,{'showHidden':![],'depth':null}));});}else{logger[_0x8f80('0x1c')](_0x8f80('0x2d'),'afterCreate',_0x8f80('0x69'),_0x8f80('0x68'));}break;case _0x8f80('0x6c'):if(_0x2fdb48[_0x8f80('0x33')]&&_0x2fdb48[_0x8f80('0x34')]){var _0x3eb827=util['format'](_0x8f80('0x53'),_0x2fdb48[_0x8f80('0x33')],_0x2fdb48['password']);var _0x459f1b={'method':_0x8f80('0x39'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x2fdb48[_0x8f80('0x6d')]+_0x8f80('0x6e'),'body':{'to':[_0x15b46d[_0x8f80('0x24')]],'text':_0x15b46d[_0x8f80('0xd')],'from':_0x2fdb48['phone'],'applicationId':_0x2fdb48[_0x8f80('0x6f')]},'headers':{'Authorization':util[_0x8f80('0x46')](_0x8f80('0x48'),new Buffer(_0x3eb827)[_0x8f80('0x49')](_0x8f80('0x4a')))},'json':!![]};rp(_0x459f1b)[_0x8f80('0x18')](function(_0x63360d){if(_0x63360d['id']){var _0x40e50b={'messageId':_0x63360d['id']};return _0xe86d51[_0x8f80('0x19')](_0x40e50b);}else{logger[_0x8f80('0x1c')](_0x8f80('0x2d'),_0x8f80('0x2e'),_0x8f80('0x6c'),util['inspect'](_0x63360d,{'showHidden':![],'depth':null}));}})[_0x8f80('0x1b')](function(_0x47b4a4){logger[_0x8f80('0x1c')](_0x8f80('0x2d'),_0x8f80('0x2e'),'bandwidth',util[_0x8f80('0x2f')](_0x47b4a4,{'showHidden':![],'depth':null}));});}else{logger[_0x8f80('0x1c')](_0x8f80('0x2d'),'afterCreate',_0x8f80('0x6c'),_0x8f80('0x3f'));}break;case _0x8f80('0x70'):if(_0x2fdb48[_0x8f80('0x5d')]){var _0x450b43={};var _0x157691={'method':_0x8f80('0x39'),'uri':_0x8f80('0x71'),'headers':{'Authorization':_0x8f80('0x72')+_0x2fdb48[_0x8f80('0x5d')],'Content-Type':_0x8f80('0x58')},'body':{'from':_0x2fdb48['phone'],'to':_0x15b46d[_0x8f80('0x24')],'text':_0x15b46d['body']},'json':!![]};return rp(_0x157691)[_0x8f80('0x18')](function(_0x42d00c){if(_0x42d00c[_0x8f80('0x73')]==0xca){_0x450b43['message']=_0x42d00c;var _0x5490ce={'method':_0x8f80('0x39'),'uri':_0x8f80('0x74'),'headers':{'Authorization':_0x8f80('0x72')+_0x2fdb48[_0x8f80('0x5d')],'Content-Type':_0x8f80('0x58')},'body':{'refid':_0x450b43[_0x8f80('0x75')][_0x8f80('0x76')]},'json':!![]};return rp(_0x5490ce)['then'](function(_0x3a9a68){_0x450b43[_0x8f80('0x77')]=_0x3a9a68;var _0x1137f2={'messageId':_0x450b43[_0x8f80('0x75')][_0x8f80('0x76')],'read':!![]};return _0xe86d51[_0x8f80('0x19')](_0x1137f2);});}else{return logger[_0x8f80('0x1c')](_0x8f80('0x2d'),_0x8f80('0x2e'),_0x8f80('0x70'),util[_0x8f80('0x2f')](_0x42d00c,{'showHidden':![],'depth':null}));}})[_0x8f80('0x1b')](function(_0x2ab0b1){return logger[_0x8f80('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8f80('0x70'),util[_0x8f80('0x2f')](_0x2ab0b1,{'showHidden':![],'depth':null}));});}else{return logger[_0x8f80('0x1c')](_0x8f80('0x2d'),'afterCreate','intelepeer',_0x8f80('0x78'));}break;}}})[_0x8f80('0x79')](function(){_0x4f5b32();});}else{_0x4f5b32();}}},'charset':_0x8f80('0x7a'),'collate':_0x8f80('0x7b')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 5527ddd..149fed5 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 _0x7b66=['message','result','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x48a836,_0xa1d010){var _0x249dc8=function(_0x2a95a0){while(--_0x2a95a0){_0x48a836['push'](_0x48a836['shift']());}};_0x249dc8(++_0xa1d010);}(_0x7b66,0xa8));var _0x67b6=function(_0x5f18ec,_0x31f9da){_0x5f18ec=_0x5f18ec-0x0;var _0x558a79=_0x7b66[_0x5f18ec];return _0x558a79;};'use strict';var _=require(_0x67b6('0x0'));var util=require(_0x67b6('0x1'));var moment=require(_0x67b6('0x2'));var BPromise=require(_0x67b6('0x3'));var rs=require(_0x67b6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67b6('0x5'))['db'];var utils=require(_0x67b6('0x6'));var logger=require(_0x67b6('0x7'))(_0x67b6('0x8'));var config=require('../../config/environment');var jayson=require(_0x67b6('0x9'));var client=jayson[_0x67b6('0xa')][_0x67b6('0xb')]({'port':0x232a});config[_0x67b6('0xc')]=_[_0x67b6('0xd')](config[_0x67b6('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x67b6('0xe'))[_0x67b6('0xf')](socket);function respondWithRpcPromise(_0x507099,_0xa22445,_0x4934a9){return new BPromise(function(_0x3e24ca,_0xdd9e56){return client['request'](_0x507099,_0x4934a9)[_0x67b6('0x10')](function(_0xe7926a){logger[_0x67b6('0x11')](_0x67b6('0x12'),_0xa22445,_0x67b6('0x13'));logger[_0x67b6('0x14')](_0x67b6('0x15'),_0xa22445,_0x67b6('0x13'),JSON['stringify'](_0xe7926a));if(_0xe7926a[_0x67b6('0x16')]){if(_0xe7926a[_0x67b6('0x16')][_0x67b6('0x17')]===0x1f4){logger[_0x67b6('0x16')](_0x67b6('0x12'),_0xa22445,_0xe7926a[_0x67b6('0x16')][_0x67b6('0x18')]);return _0xdd9e56(_0xe7926a['error']['message']);}logger[_0x67b6('0x16')](_0x67b6('0x12'),_0xa22445,_0xe7926a[_0x67b6('0x16')][_0x67b6('0x18')]);return _0x3e24ca(_0xe7926a[_0x67b6('0x16')][_0x67b6('0x18')]);}else{logger['info'](_0x67b6('0x12'),_0xa22445,_0x67b6('0x13'));_0x3e24ca(_0xe7926a[_0x67b6('0x19')][_0x67b6('0x18')]);}})['catch'](function(_0x1f6386){logger[_0x67b6('0x16')]('SmsMessage,\x20%s,\x20%s',_0xa22445,_0x1f6386);_0xdd9e56(_0x1f6386);});});}exports[_0x67b6('0x1a')]=function(_0x4890fb){var _0x224649=this;return new Promise(function(_0x49ff9a,_0x475987){return db[_0x67b6('0x1b')][_0x67b6('0x1c')](_0x4890fb[_0x67b6('0x1d')],{'raw':_0x4890fb[_0x67b6('0x1e')]?_0x4890fb[_0x67b6('0x1e')][_0x67b6('0x1f')]===undefined?!![]:![]:!![]})[_0x67b6('0x10')](function(_0x18f592){logger[_0x67b6('0x11')](_0x67b6('0x1a'),_0x4890fb);logger[_0x67b6('0x14')](_0x67b6('0x1a'),_0x4890fb,JSON['stringify'](_0x18f592));_0x49ff9a(_0x18f592);})['catch'](function(_0x42977c){logger['error'](_0x67b6('0x1a'),_0x42977c['message'],_0x4890fb);_0x475987(_0x224649[_0x67b6('0x16')](0x1f4,_0x42977c[_0x67b6('0x18')]));});});}; \ No newline at end of file +var _0xc785=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','options','raw'];(function(_0x5b7dce,_0x2ae5d5){var _0x2d22da=function(_0x406b21){while(--_0x406b21){_0x5b7dce['push'](_0x5b7dce['shift']());}};_0x2d22da(++_0x2ae5d5);}(_0xc785,0x66));var _0x5c78=function(_0x4ae44f,_0x5d42aa){_0x4ae44f=_0x4ae44f-0x0;var _0x513c77=_0xc785[_0x4ae44f];return _0x513c77;};'use strict';var _=require(_0x5c78('0x0'));var util=require(_0x5c78('0x1'));var moment=require(_0x5c78('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c78('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c78('0x4'))['db'];var utils=require(_0x5c78('0x5'));var logger=require('../../config/logger')(_0x5c78('0x6'));var config=require(_0x5c78('0x7'));var jayson=require(_0x5c78('0x8'));var client=jayson['client'][_0x5c78('0x9')]({'port':0x232a});config[_0x5c78('0xa')]=_[_0x5c78('0xb')](config[_0x5c78('0xa')],{'host':_0x5c78('0xc'),'port':0x18eb});var socket=require(_0x5c78('0xd'))(new Redis(config[_0x5c78('0xa')]));require(_0x5c78('0xe'))[_0x5c78('0xf')](socket);function respondWithRpcPromise(_0x3510d7,_0x367f84,_0x30f6bb){return new BPromise(function(_0x589f29,_0x1d2a61){return client[_0x5c78('0x10')](_0x3510d7,_0x30f6bb)[_0x5c78('0x11')](function(_0x1706a0){logger[_0x5c78('0x12')](_0x5c78('0x13'),_0x367f84,_0x5c78('0x14'));logger[_0x5c78('0x15')](_0x5c78('0x16'),_0x367f84,_0x5c78('0x14'),JSON[_0x5c78('0x17')](_0x1706a0));if(_0x1706a0[_0x5c78('0x18')]){if(_0x1706a0['error'][_0x5c78('0x19')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x367f84,_0x1706a0[_0x5c78('0x18')][_0x5c78('0x1a')]);return _0x1d2a61(_0x1706a0[_0x5c78('0x18')][_0x5c78('0x1a')]);}logger[_0x5c78('0x18')](_0x5c78('0x13'),_0x367f84,_0x1706a0[_0x5c78('0x18')][_0x5c78('0x1a')]);return _0x589f29(_0x1706a0['error'][_0x5c78('0x1a')]);}else{logger[_0x5c78('0x12')](_0x5c78('0x13'),_0x367f84,_0x5c78('0x14'));_0x589f29(_0x1706a0[_0x5c78('0x1b')][_0x5c78('0x1a')]);}})[_0x5c78('0x1c')](function(_0x1da9a0){logger[_0x5c78('0x18')](_0x5c78('0x13'),_0x367f84,_0x1da9a0);_0x1d2a61(_0x1da9a0);});});}exports[_0x5c78('0x1d')]=function(_0x172cb8){var _0x4178a7=this;return new Promise(function(_0x814619,_0x54aaec){return db[_0x5c78('0x1e')][_0x5c78('0x1f')](_0x172cb8['body'],{'raw':_0x172cb8[_0x5c78('0x20')]?_0x172cb8['options'][_0x5c78('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x6fe82c){logger['info']('CreateSmsMessage',_0x172cb8);logger[_0x5c78('0x15')]('CreateSmsMessage',_0x172cb8,JSON[_0x5c78('0x17')](_0x6fe82c));_0x814619(_0x6fe82c);})[_0x5c78('0x1c')](function(_0x19bb72){logger[_0x5c78('0x18')]('CreateSmsMessage',_0x19bb72['message'],_0x172cb8);_0x54aaec(_0x4178a7['error'](0x1f4,_0x19bb72['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 59e9437..f429bc3 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 _0x0da3=['emit','removeListener','register','smsMessage:','save','remove','update'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0da3,0x100));var _0x30da=function(_0x3d6c76,_0x5d26f9){_0x3d6c76=_0x3d6c76-0x0;var _0x304ac8=_0x0da3[_0x3d6c76];return _0x304ac8;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x30da('0x0'),_0x30da('0x1'),_0x30da('0x2')];function createListener(_0x24abb6,_0x1df2fd){return function(_0x3f3288){_0x1df2fd[_0x30da('0x3')](_0x24abb6,_0x3f3288);};}function removeListener(_0x4c878b,_0x16fd46){return function(){SmsMessageEvents[_0x30da('0x4')](_0x4c878b,_0x16fd46);};}exports[_0x30da('0x5')]=function(_0x504f23){for(var _0x247695=0x0,_0x292453=events['length'];_0x247695<_0x292453;_0x247695++){var _0x2a74c6=events[_0x247695];var _0x2e7ff4=createListener(_0x30da('0x6')+_0x2a74c6,_0x504f23);SmsMessageEvents['on'](_0x2a74c6,_0x2e7ff4);}}; \ No newline at end of file +var _0xcd74=['smsMessage:','./smsMessage.events','save','remove','update','removeListener','register'];(function(_0x39c369,_0x472367){var _0x141b59=function(_0x204937){while(--_0x204937){_0x39c369['push'](_0x39c369['shift']());}};_0x141b59(++_0x472367);}(_0xcd74,0xe8));var _0x4cd7=function(_0x2bc38e,_0x554a04){_0x2bc38e=_0x2bc38e-0x0;var _0x321e4f=_0xcd74[_0x2bc38e];return _0x321e4f;};'use strict';var SmsMessageEvents=require(_0x4cd7('0x0'));var events=[_0x4cd7('0x1'),_0x4cd7('0x2'),_0x4cd7('0x3')];function createListener(_0x331f7b,_0x4222d7){return function(_0x418765){_0x4222d7['emit'](_0x331f7b,_0x418765);};}function removeListener(_0x166cbb,_0x4d5fe4){return function(){SmsMessageEvents[_0x4cd7('0x4')](_0x166cbb,_0x4d5fe4);};}exports[_0x4cd7('0x5')]=function(_0x222c2a){for(var _0x4b3c2e=0x0,_0x49cc51=events['length'];_0x4b3c2e<_0x49cc51;_0x4b3c2e++){var _0x5ac0c5=events[_0x4b3c2e];var _0x103077=createListener(_0x4cd7('0x6')+_0x5ac0c5,_0x222c2a);SmsMessageEvents['on'](_0x5ac0c5,_0x103077);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index d220257..29e4ad6 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 _0xb48f=['addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','create','post','/:id/users'];(function(_0x1ab0b7,_0x184ac4){var _0x4574ab=function(_0x57dae4){while(--_0x57dae4){_0x1ab0b7['push'](_0x1ab0b7['shift']());}};_0x4574ab(++_0x184ac4);}(_0xb48f,0x1e4));var _0xfb48=function(_0x295a92,_0x7d70dc){_0x295a92=_0x295a92-0x0;var _0x3f5dac=_0xb48f[_0x295a92];return _0x3f5dac;};'use strict';var multer=require('multer');var util=require(_0xfb48('0x0'));var path=require(_0xfb48('0x1'));var timeout=require(_0xfb48('0x2'));var express=require(_0xfb48('0x3'));var router=express[_0xfb48('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfb48('0x5'));var config=require(_0xfb48('0x6'));var controller=require(_0xfb48('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfb48('0x8')](_0xfb48('0x9'),auth[_0xfb48('0xa')](),controller[_0xfb48('0xb')]);router[_0xfb48('0x8')]('/:id',auth[_0xfb48('0xa')](),controller[_0xfb48('0xc')]);router[_0xfb48('0x8')](_0xfb48('0xd'),auth[_0xfb48('0xa')](),controller[_0xfb48('0xe')]);router['get'](_0xfb48('0xf'),auth[_0xfb48('0xa')](),controller[_0xfb48('0x10')]);router[_0xfb48('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xfb48('0xa')](),controller[_0xfb48('0x11')]);router[_0xfb48('0x12')]('/:id/teams',auth[_0xfb48('0xa')](),controller['addTeams']);router[_0xfb48('0x12')](_0xfb48('0x13'),auth[_0xfb48('0xa')](),controller[_0xfb48('0x14')]);router[_0xfb48('0x15')](_0xfb48('0x16'),auth[_0xfb48('0xa')](),controller['update']);router[_0xfb48('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xfb48('0x18')]);router[_0xfb48('0x17')](_0xfb48('0xf'),auth[_0xfb48('0xa')](),controller[_0xfb48('0x19')]);router[_0xfb48('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xfb48('0x1a')]);module[_0xfb48('0x1b')]=router; \ No newline at end of file +var _0x4e52=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','update','delete','destroy','removeTeams','exports','multer'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4e52,0xfb));var _0x24e5=function(_0x1890b4,_0x1dbc77){_0x1890b4=_0x1890b4-0x0;var _0x1fa29f=_0x4e52[_0x1890b4];return _0x1fa29f;};'use strict';var multer=require(_0x24e5('0x0'));var util=require(_0x24e5('0x1'));var path=require('path');var timeout=require(_0x24e5('0x2'));var express=require(_0x24e5('0x3'));var router=express['Router']();var fs_extra=require(_0x24e5('0x4'));var auth=require(_0x24e5('0x5'));var interaction=require(_0x24e5('0x6'));var config=require(_0x24e5('0x7'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x24e5('0x8')](),controller[_0x24e5('0x9')]);router[_0x24e5('0xa')](_0x24e5('0xb'),auth['isAuthenticated'](),controller[_0x24e5('0xc')]);router['get'](_0x24e5('0xd'),auth[_0x24e5('0x8')](),controller[_0x24e5('0xe')]);router[_0x24e5('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0x24e5('0xf')]);router[_0x24e5('0xa')](_0x24e5('0x10'),auth['isAuthenticated'](),controller[_0x24e5('0x11')]);router[_0x24e5('0xa')]('/:id/users',auth[_0x24e5('0x8')](),controller[_0x24e5('0x12')]);router[_0x24e5('0x13')]('/',auth[_0x24e5('0x8')](),controller[_0x24e5('0x14')]);router[_0x24e5('0x13')]('/:id/teams',auth[_0x24e5('0x8')](),controller[_0x24e5('0x15')]);router['post'](_0x24e5('0x16'),auth[_0x24e5('0x8')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x24e5('0x17')]);router[_0x24e5('0x18')](_0x24e5('0xd'),auth[_0x24e5('0x8')](),controller[_0x24e5('0x19')]);router[_0x24e5('0x18')](_0x24e5('0x10'),auth['isAuthenticated'](),controller[_0x24e5('0x1a')]);router[_0x24e5('0x18')](_0x24e5('0x16'),auth[_0x24e5('0x8')](),controller['removeAgents']);module[_0x24e5('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 5db19c2..15d9f8b 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 _0xd9c1=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x5aebad,_0x259592){var _0x146c0f=function(_0x22d8bc){while(--_0x22d8bc){_0x5aebad['push'](_0x5aebad['shift']());}};_0x146c0f(++_0x259592);}(_0xd9c1,0x14f));var _0x1d9c=function(_0x4c69de,_0x37fcf9){_0x4c69de=_0x4c69de-0x0;var _0x1105b2=_0xd9c1[_0x4c69de];return _0x1105b2;};'use strict';var Sequelize=require(_0x1d9c('0x0'));module['exports']={'name':{'type':Sequelize[_0x1d9c('0x1')],'unique':_0x1d9c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1d9c('0x1')]},'timeout':{'type':Sequelize[_0x1d9c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1d9c('0x4')](_0x1d9c('0x5'),_0x1d9c('0x6'),_0x1d9c('0x7'))}}; \ No newline at end of file +var _0xd849=['sequelize','exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x5ac813,_0x1e116d){var _0x4102a8=function(_0x4f72c0){while(--_0x4f72c0){_0x5ac813['push'](_0x5ac813['shift']());}};_0x4102a8(++_0x1e116d);}(_0xd849,0xc8));var _0x9d84=function(_0x2c921c,_0x3c6a85){_0x2c921c=_0x2c921c-0x0;var _0x440bf2=_0xd849[_0x2c921c];return _0x440bf2;};'use strict';var Sequelize=require(_0x9d84('0x0'));module[_0x9d84('0x1')]={'name':{'type':Sequelize[_0x9d84('0x2')],'unique':_0x9d84('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9d84('0x2')]},'timeout':{'type':Sequelize[_0x9d84('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9d84('0x5'),_0x9d84('0x6'),_0x9d84('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 68e52c0..8537c7a 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 _0xc69d=['SIP','getTeams','findOne','hasOwnProperty','addTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','forEach','emit','userSmsQueue:save','removeTeams','ids','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','union','value','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','options','include','catch','params','includeAll','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserSmsQueue','SmsQueueId','findAll','User','agent','smsPause','updatedAt','createdAt','rows','%s/%s'];(function(_0x33cb0a,_0x8201cc){var _0x23c94d=function(_0x8f293b){while(--_0x8f293b){_0x33cb0a['push'](_0x33cb0a['shift']());}};_0x23c94d(++_0x8201cc);}(_0xc69d,0x143));var _0xdc69=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0xc69d[_0x480bc8];return _0x28c245;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc69('0x0'));var zipdir=require(_0xdc69('0x1'));var jsonpatch=require(_0xdc69('0x2'));var rp=require('request-promise');var moment=require(_0xdc69('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdc69('0x4'));var util=require(_0xdc69('0x5'));var path=require(_0xdc69('0x6'));var sox=require('sox');var csv=require(_0xdc69('0x7'));var ejs=require(_0xdc69('0x8'));var fs=require('fs');var fs_extra=require(_0xdc69('0x9'));var _=require('lodash');var squel=require(_0xdc69('0xa'));var crypto=require('crypto');var jsforce=require(_0xdc69('0xb'));var deskjs=require(_0xdc69('0xc'));var toCsv=require(_0xdc69('0x7'));var querystring=require(_0xdc69('0xd'));var Papa=require('papaparse');var Redis=require(_0xdc69('0xe'));var authService=require(_0xdc69('0xf'));var qs=require(_0xdc69('0x10'));var as=require(_0xdc69('0x11'));var hardwareService=require(_0xdc69('0x12'));var logger=require(_0xdc69('0x13'))(_0xdc69('0x14'));var utils=require(_0xdc69('0x15'));var config=require(_0xdc69('0x16'));var licenseUtil=require(_0xdc69('0x17'));var db=require(_0xdc69('0x18'))['db'];config[_0xdc69('0x19')]=_[_0xdc69('0x1a')](config['redis'],{'host':_0xdc69('0x1b'),'port':0x18eb});var socket=require(_0xdc69('0x1c'))(new Redis(config['redis']));require(_0xdc69('0x1d'))[_0xdc69('0x1e')](socket);function respondWithStatusCode(_0x5a5c98,_0xc8b612){_0xc8b612=_0xc8b612||0xcc;return function(_0xce4e6b){if(_0xce4e6b){return _0x5a5c98[_0xdc69('0x1f')](_0xc8b612);}return _0x5a5c98[_0xdc69('0x20')](_0xc8b612)[_0xdc69('0x21')]();};}function respondWithResult(_0x44243e,_0x2dfea4){_0x2dfea4=_0x2dfea4||0xc8;return function(_0x5b3004){if(_0x5b3004){return _0x44243e['status'](_0x2dfea4)[_0xdc69('0x22')](_0x5b3004);}};}function respondWithFilteredResult(_0x39ccf9,_0xe33890){return function(_0x445c9b){if(_0x445c9b){var _0x32f0c3=typeof _0xe33890[_0xdc69('0x23')]===_0xdc69('0x24')&&typeof _0xe33890[_0xdc69('0x25')]===_0xdc69('0x24');var _0x2f1a92=_0x445c9b[_0xdc69('0x26')];var _0x2e6626=_0x32f0c3?0x0:_0xe33890[_0xdc69('0x23')];var _0x2648d4=_0x32f0c3?_0x445c9b['count']:_0xe33890[_0xdc69('0x23')]+_0xe33890['limit'];var _0x54341c;if(_0x2648d4>=_0x2f1a92){_0x2648d4=_0x2f1a92;_0x54341c=0xc8;}else{_0x54341c=0xce;}_0x39ccf9[_0xdc69('0x20')](_0x54341c);return _0x39ccf9[_0xdc69('0x27')](_0xdc69('0x28'),_0x2e6626+'-'+_0x2648d4+'/'+_0x2f1a92)[_0xdc69('0x22')](_0x445c9b);}return null;};}function patchUpdates(_0x88326b){return function(_0x394826){try{jsonpatch[_0xdc69('0x29')](_0x394826,_0x88326b,!![]);}catch(_0x276d35){return BPromise[_0xdc69('0x2a')](_0x276d35);}return _0x394826[_0xdc69('0x2b')]();};}function saveUpdates(_0x271e5d,_0x48b29f){return function(_0x11a4ea){if(_0x11a4ea){return _0x11a4ea[_0xdc69('0x2c')](_0x271e5d)['then'](function(_0x1e959f){return _0x1e959f;});}return null;};}function removeEntity(_0x109f97,_0x49d02a){return function(_0x5a48ef){if(_0x5a48ef){return _0x5a48ef[_0xdc69('0x2d')]()[_0xdc69('0x2e')](function(){var _0x3c3244=_0x5a48ef['get']({'plain':!![]});var _0x154987='SmsQueues';return db[_0xdc69('0x2f')]['destroy']({'where':{'type':_0x154987,'resourceId':_0x3c3244['id']}})[_0xdc69('0x2e')](function(){return _0x5a48ef;});})[_0xdc69('0x2e')](function(){_0x109f97['status'](0xcc)[_0xdc69('0x21')]();});}};}function handleEntityNotFound(_0x4ac158,_0x3a3e9e){return function(_0x25747a){if(!_0x25747a){_0x4ac158['sendStatus'](0x194);}return _0x25747a;};}function handleError(_0x437a50,_0x4c7468){_0x4c7468=_0x4c7468||0x1f4;return function(_0x168161){logger[_0xdc69('0x30')](_0x168161[_0xdc69('0x31')]);if(_0x168161['name']){delete _0x168161[_0xdc69('0x32')];}_0x437a50['status'](_0x4c7468)['send'](_0x168161);};}exports['index']=function(_0x3fe326,_0x2d8983){var _0x23f323={},_0x98dabb={},_0x5c1a58={'count':0x0,'rows':[]};var _0x373b0b=_[_0xdc69('0x33')](db[_0xdc69('0x34')][_0xdc69('0x35')],function(_0x4df39d){return{'name':_0x4df39d[_0xdc69('0x36')],'type':_0x4df39d[_0xdc69('0x37')][_0xdc69('0x38')]};});_0x98dabb[_0xdc69('0x39')]=_['map'](_0x373b0b,'name');_0x98dabb['query']=_[_0xdc69('0x3a')](_0x3fe326[_0xdc69('0x3b')]);_0x98dabb[_0xdc69('0x3c')]=_[_0xdc69('0x3d')](_0x98dabb['model'],_0x98dabb[_0xdc69('0x3b')]);_0x23f323[_0xdc69('0x3e')]=_[_0xdc69('0x3d')](_0x98dabb['model'],qs[_0xdc69('0x3f')](_0x3fe326[_0xdc69('0x3b')][_0xdc69('0x3f')]));_0x23f323[_0xdc69('0x3e')]=_0x23f323['attributes'][_0xdc69('0x40')]?_0x23f323[_0xdc69('0x3e')]:_0x98dabb[_0xdc69('0x39')];if(!_0x3fe326[_0xdc69('0x3b')]['hasOwnProperty'](_0xdc69('0x41'))){_0x23f323[_0xdc69('0x25')]=qs[_0xdc69('0x25')](_0x3fe326['query'][_0xdc69('0x25')]);_0x23f323[_0xdc69('0x23')]=qs[_0xdc69('0x23')](_0x3fe326[_0xdc69('0x3b')][_0xdc69('0x23')]);}_0x23f323[_0xdc69('0x42')]=qs['sort'](_0x3fe326['query'][_0xdc69('0x43')]);_0x23f323[_0xdc69('0x44')]=qs['filters'](_[_0xdc69('0x45')](_0x3fe326[_0xdc69('0x3b')],_0x98dabb[_0xdc69('0x3c')]),_0x373b0b);if(_0x3fe326[_0xdc69('0x3b')][_0xdc69('0x46')]){_0x23f323[_0xdc69('0x44')]=_['merge'](_0x23f323['where'],{'$or':_[_0xdc69('0x33')](_0x373b0b,function(_0x36f595){if(_0x36f595[_0xdc69('0x37')]!=='VIRTUAL'){var _0x3aa7aa={};_0x3aa7aa[_0x36f595[_0xdc69('0x32')]]={'$like':'%'+_0x3fe326['query'][_0xdc69('0x46')]+'%'};return _0x3aa7aa;}})});}_0x23f323=_['merge']({},_0x23f323,_0x3fe326[_0xdc69('0x47')]);var _0x3b57be={'where':_0x23f323[_0xdc69('0x44')]};return db[_0xdc69('0x34')][_0xdc69('0x26')](_0x3b57be)['then'](function(_0x338d5c){_0x5c1a58[_0xdc69('0x26')]=_0x338d5c;if(_0x3fe326[_0xdc69('0x3b')]['includeAll']){_0x23f323[_0xdc69('0x48')]=[{'all':!![]}];}return db[_0xdc69('0x34')]['findAll'](_0x23f323);})[_0xdc69('0x2e')](function(_0x59fdc){_0x5c1a58['rows']=_0x59fdc;return _0x5c1a58;})[_0xdc69('0x2e')](respondWithFilteredResult(_0x2d8983,_0x23f323))[_0xdc69('0x49')](handleError(_0x2d8983,null));};exports['show']=function(_0x44e90c,_0x3f8f0d){var _0x2a3399={'raw':!![],'where':{'id':_0x44e90c[_0xdc69('0x4a')]['id']}},_0x36f5aa={};_0x36f5aa['model']=_[_0xdc69('0x3a')](db[_0xdc69('0x34')][_0xdc69('0x35')]);_0x36f5aa[_0xdc69('0x3b')]=_[_0xdc69('0x3a')](_0x44e90c['query']);_0x36f5aa['filters']=_['intersection'](_0x36f5aa['model'],_0x36f5aa['query']);_0x2a3399[_0xdc69('0x3e')]=_['intersection'](_0x36f5aa[_0xdc69('0x39')],qs[_0xdc69('0x3f')](_0x44e90c[_0xdc69('0x3b')][_0xdc69('0x3f')]));_0x2a3399[_0xdc69('0x3e')]=_0x2a3399[_0xdc69('0x3e')][_0xdc69('0x40')]?_0x2a3399['attributes']:_0x36f5aa[_0xdc69('0x39')];if(_0x44e90c[_0xdc69('0x3b')][_0xdc69('0x4b')]){_0x2a3399[_0xdc69('0x48')]=[{'all':!![]}];}_0x2a3399=_[_0xdc69('0x4c')]({},_0x2a3399,_0x44e90c[_0xdc69('0x47')]);return db[_0xdc69('0x34')][_0xdc69('0x4d')](_0x2a3399)[_0xdc69('0x2e')](handleEntityNotFound(_0x3f8f0d,null))[_0xdc69('0x2e')](respondWithResult(_0x3f8f0d,null))['catch'](handleError(_0x3f8f0d,null));};exports['create']=function(_0xe78c00,_0x335165){return db[_0xdc69('0x34')][_0xdc69('0x4e')](_0xe78c00[_0xdc69('0x4f')],{})[_0xdc69('0x2e')](function(_0x203ae2){var _0x34e0d1=_0xe78c00[_0xdc69('0x50')][_0xdc69('0x51')]({'plain':!![]});if(!_0x34e0d1)throw new Error(_0xdc69('0x52'));if(_0x34e0d1[_0xdc69('0x53')]==='user'){var _0x8a8ce9=_0x203ae2[_0xdc69('0x51')]({'plain':!![]});var _0x5b025b=_0xdc69('0x54');return db[_0xdc69('0x55')][_0xdc69('0x4d')]({'where':{'name':_0x5b025b,'userProfileId':_0x34e0d1['userProfileId']},'raw':!![]})[_0xdc69('0x2e')](function(_0x3db571){if(_0x3db571&&_0x3db571[_0xdc69('0x56')]===0x0){return db[_0xdc69('0x2f')]['create']({'name':_0x8a8ce9[_0xdc69('0x32')],'resourceId':_0x8a8ce9['id'],'type':_0x3db571[_0xdc69('0x32')],'sectionId':_0x3db571['id']},{})['then'](function(){return _0x203ae2;});}else{return _0x203ae2;}})['catch'](function(_0x4f53b5){logger['error'](_0xdc69('0x57'),_0x4f53b5);throw _0x4f53b5;});}return _0x203ae2;})[_0xdc69('0x2e')](respondWithResult(_0x335165,0xc9))[_0xdc69('0x49')](handleError(_0x335165,null));};exports['update']=function(_0x53f575,_0x39a64d){if(_0x53f575[_0xdc69('0x4f')]['id']){delete _0x53f575[_0xdc69('0x4f')]['id'];}return db['SmsQueue'][_0xdc69('0x4d')]({'where':{'id':_0x53f575[_0xdc69('0x4a')]['id']}})[_0xdc69('0x2e')](handleEntityNotFound(_0x39a64d,null))[_0xdc69('0x2e')](saveUpdates(_0x53f575[_0xdc69('0x4f')],null))[_0xdc69('0x2e')](respondWithResult(_0x39a64d,null))[_0xdc69('0x49')](handleError(_0x39a64d,null));};exports[_0xdc69('0x2d')]=function(_0x45f3fc,_0x2e7367){return db[_0xdc69('0x34')]['find']({'where':{'id':_0x45f3fc[_0xdc69('0x4a')]['id']}})[_0xdc69('0x2e')](handleEntityNotFound(_0x2e7367,null))[_0xdc69('0x2e')](removeEntity(_0x2e7367,null))[_0xdc69('0x49')](handleError(_0x2e7367,null));};exports[_0xdc69('0x58')]=function(_0x9c0491,_0xeaa9ca){return db[_0xdc69('0x34')]['describe']()[_0xdc69('0x2e')](respondWithResult(_0xeaa9ca,null))[_0xdc69('0x49')](handleError(_0xeaa9ca,null));};exports[_0xdc69('0x59')]=function(_0x2866c6,_0x469012,_0x410a21){var _0x2c3aa4={'raw':!![],'where':{}},_0xd2a03f={},_0x5e0832;return db[_0xdc69('0x34')]['findOne']({'where':{'id':_0x2866c6['params']['id']}})['then'](handleEntityNotFound(_0x469012,null))[_0xdc69('0x2e')](function(_0x41f2a7){if(_0x41f2a7){_0x5e0832=_0x41f2a7[_0xdc69('0x51')]({'plain':!![]});_0xd2a03f[_0xdc69('0x39')]=_[_0xdc69('0x3a')](db[_0xdc69('0x5a')][_0xdc69('0x35')]);_0xd2a03f[_0xdc69('0x3b')]=_['keys'](_0x2866c6[_0xdc69('0x3b')]);_0xd2a03f[_0xdc69('0x3c')]=_[_0xdc69('0x3d')](_0xd2a03f[_0xdc69('0x39')],_0xd2a03f['query']);_0x2c3aa4[_0xdc69('0x3e')]=_[_0xdc69('0x3d')](_0xd2a03f[_0xdc69('0x39')],qs['fields'](_0x2866c6['query'][_0xdc69('0x3f')]));_0x2c3aa4[_0xdc69('0x3e')]=_0x2c3aa4[_0xdc69('0x3e')][_0xdc69('0x40')]?_0x2c3aa4[_0xdc69('0x3e')]:_0xd2a03f[_0xdc69('0x39')];if(!_0x2866c6[_0xdc69('0x3b')]['hasOwnProperty'](_0xdc69('0x41'))){_0x2c3aa4[_0xdc69('0x25')]=qs[_0xdc69('0x25')](_0x2866c6[_0xdc69('0x3b')][_0xdc69('0x25')]);_0x2c3aa4['offset']=qs[_0xdc69('0x23')](_0x2866c6[_0xdc69('0x3b')][_0xdc69('0x23')]);}_0x2c3aa4[_0xdc69('0x42')]=qs['sort'](_0x2866c6['query'][_0xdc69('0x43')]);_0x2c3aa4[_0xdc69('0x44')]=qs[_0xdc69('0x3c')](_['pick'](_0x2866c6[_0xdc69('0x3b')],_0xd2a03f[_0xdc69('0x3c')]));_0x2c3aa4[_0xdc69('0x44')][_0xdc69('0x5b')]=_0x41f2a7['id'];if(_0x2866c6[_0xdc69('0x3b')][_0xdc69('0x46')]){_0x2c3aa4['where']=_[_0xdc69('0x4c')](_0x2c3aa4[_0xdc69('0x44')],{'$or':_[_0xdc69('0x33')](_0x2c3aa4[_0xdc69('0x3e')],function(_0x538ebe){var _0x384761={};_0x384761[_0x538ebe]={'$like':'%'+_0x2866c6[_0xdc69('0x3b')]['filter']+'%'};return _0x384761;})});}_0x2c3aa4=_[_0xdc69('0x4c')]({},_0x2c3aa4,_0x2866c6['options']);return db[_0xdc69('0x5a')][_0xdc69('0x5c')](_0x2c3aa4);}})[_0xdc69('0x2e')](function(_0x58ff9e){if(_0x58ff9e){return db[_0xdc69('0x5d')]['findAndCountAll']({'where':{'id':_[_0xdc69('0x33')](_0x58ff9e,'UserId'),'role':_0xdc69('0x5e')},'attributes':['id','name',_0xdc69('0x5f'),_0xdc69('0x60'),_0xdc69('0x61')]});}})[_0xdc69('0x2e')](function(_0x264285){if(_0x264285){return{'count':_0x264285['count'],'rows':_['map'](_0x264285[_0xdc69('0x62')],function(_0x46675b){return{'membername':_0x46675b['name'],'UserId':_0x46675b['id'],'queue_name':_0x5e0832[_0xdc69('0x32')],'SmsQueueId':_0x5e0832['id'],'interface':util['format'](_0xdc69('0x63'),_0xdc69('0x64'),_0x46675b['name']),'penalty':0x0,'paused':_0x46675b[_0xdc69('0x5f')],'createdAt':_0x46675b[_0xdc69('0x61')],'updatedAt':_0x46675b[_0xdc69('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdc69('0x2e')](respondWithFilteredResult(_0x469012,_0x2c3aa4))[_0xdc69('0x49')](handleError(_0x469012,null));};exports[_0xdc69('0x65')]=function(_0x18a433,_0xce433a,_0x4a7986){var _0x7ed6e0={};var _0x487358={};var _0x1d55f3;var _0x2f68b0;return db[_0xdc69('0x34')][_0xdc69('0x66')]({'where':{'id':_0x18a433[_0xdc69('0x4a')]['id']}})[_0xdc69('0x2e')](handleEntityNotFound(_0xce433a,null))[_0xdc69('0x2e')](function(_0x102441){if(_0x102441){_0x1d55f3=_0x102441;_0x487358[_0xdc69('0x39')]=_['keys'](db['Team']['rawAttributes']);_0x487358[_0xdc69('0x3b')]=_[_0xdc69('0x3a')](_0x18a433[_0xdc69('0x3b')]);_0x487358['filters']=_[_0xdc69('0x3d')](_0x487358[_0xdc69('0x39')],_0x487358[_0xdc69('0x3b')]);_0x7ed6e0[_0xdc69('0x3e')]=_[_0xdc69('0x3d')](_0x487358[_0xdc69('0x39')],qs['fields'](_0x18a433[_0xdc69('0x3b')][_0xdc69('0x3f')]));_0x7ed6e0['attributes']=_0x7ed6e0[_0xdc69('0x3e')]['length']?_0x7ed6e0[_0xdc69('0x3e')]:_0x487358['model'];_0x7ed6e0[_0xdc69('0x42')]=qs['sort'](_0x18a433[_0xdc69('0x3b')][_0xdc69('0x43')]);_0x7ed6e0[_0xdc69('0x44')]=qs[_0xdc69('0x3c')](_[_0xdc69('0x45')](_0x18a433[_0xdc69('0x3b')],_0x487358[_0xdc69('0x3c')]));if(_0x18a433['query'][_0xdc69('0x46')]){_0x7ed6e0[_0xdc69('0x44')]=_['merge'](_0x7ed6e0[_0xdc69('0x44')],{'$or':_['map'](_0x7ed6e0[_0xdc69('0x3e')],function(_0x1d0dd5){var _0xaf3a7d={};_0xaf3a7d[_0x1d0dd5]={'$like':'%'+_0x18a433[_0xdc69('0x3b')][_0xdc69('0x46')]+'%'};return _0xaf3a7d;})});}_0x7ed6e0=_['merge']({},_0x7ed6e0,_0x18a433[_0xdc69('0x47')]);return _0x1d55f3['getTeams'](_0x7ed6e0);}})['then'](function(_0xe63fc2){if(_0xe63fc2){_0x2f68b0=_0xe63fc2[_0xdc69('0x40')];if(!_0x18a433[_0xdc69('0x3b')][_0xdc69('0x67')](_0xdc69('0x41'))){_0x7ed6e0[_0xdc69('0x25')]=qs['limit'](_0x18a433['query'][_0xdc69('0x25')]);_0x7ed6e0[_0xdc69('0x23')]=qs[_0xdc69('0x23')](_0x18a433[_0xdc69('0x3b')][_0xdc69('0x23')]);}return _0x1d55f3[_0xdc69('0x65')](_0x7ed6e0);}})[_0xdc69('0x2e')](function(_0x441f7e){if(_0x441f7e){return _0x441f7e?{'count':_0x2f68b0,'rows':_0x441f7e}:null;}})['then'](respondWithResult(_0xce433a,null))[_0xdc69('0x49')](handleError(_0xce433a,null));};exports[_0xdc69('0x68')]=function(_0x3decfc,_0x35a68d,_0x160708){var _0x26d709=_0x3decfc[_0xdc69('0x4f')]['ids'];return db[_0xdc69('0x69')]['findAll']({'where':{'id':_0x26d709},'attributes':['id'],'include':[{'model':db[_0xdc69('0x5d')],'as':_0xdc69('0x6a'),'attributes':['id',_0xdc69('0x32'),_0xdc69('0x6b'),_0xdc69('0x6c'),_0xdc69('0x6d')],'raw':!![]}]})[_0xdc69('0x2e')](function(_0x5594c8){if(_0x5594c8){var _0x55ccd5=_[_0xdc69('0x6e')](_0x5594c8,function(_0x1c79cc){var _0x2eea07=_0x1c79cc[_0xdc69('0x51')]({'plain':!![]});return _0x2eea07[_0xdc69('0x6a')];});return db[_0xdc69('0x34')][_0xdc69('0x4d')]({'where':{'id':_0x3decfc[_0xdc69('0x4a')]['id']}})[_0xdc69('0x2e')](function(_0x3cf487){return db[_0xdc69('0x6f')]['transaction'](function(_0x16fed5){return _0x3cf487[_0xdc69('0x68')](_0x26d709,{'transaction':_0x16fed5})[_0xdc69('0x2e')](function(){return BPromise[_0xdc69('0x70')](_0x55ccd5,function(_0x16a895){return db[_0xdc69('0x5a')]['findOrCreate']({'where':{'UserId':_0x16a895['id'],'SmsQueueId':_0x3decfc['params']['id']},'transaction':_0x16fed5});});})[_0xdc69('0x2e')](function(){_0x55ccd5[_0xdc69('0x71')](function(_0x1e1cb9){socket[_0xdc69('0x72')](_0xdc69('0x73'),{'UserId':_0x1e1cb9['id'],'SmsQueueId':_0x3cf487['id']});});});});});}})[_0xdc69('0x2e')](respondWithStatusCode(_0x35a68d,null))['catch'](handleError(_0x35a68d,null));};exports[_0xdc69('0x74')]=function(_0x2f54f9,_0x3e4f0c,_0x5b4d31){return db[_0xdc69('0x69')][_0xdc69('0x5c')]({'where':{'id':_0x2f54f9[_0xdc69('0x3b')][_0xdc69('0x75')]},'attributes':['id'],'include':[{'model':db[_0xdc69('0x5d')],'as':_0xdc69('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xdc69('0x2e')](handleEntityNotFound(_0x3e4f0c,null))[_0xdc69('0x2e')](function(_0x31aee1){var _0x5d80e2=_['map'](_0x31aee1,'id');var _0x1e9521=[];var _0x4565ae=[];var _0x94407a=squel['select']();_0x94407a['field'](_0xdc69('0x76'))[_0xdc69('0x77')](_0xdc69('0x78'),'tq')[_0xdc69('0x79')](_0xdc69('0x7a'),'ut',_0xdc69('0x7b'))[_0xdc69('0x44')](_0xdc69('0x7c'),_0x2f54f9[_0xdc69('0x4a')]['id']);for(var _0x190cb6=0x0;_0x190cb6<_0x31aee1[_0xdc69('0x40')];_0x190cb6+=0x1){let _0x591e96=_0x31aee1[_0x190cb6];for(var _0x534c21=0x0;_0x534c21<_0x591e96[_0xdc69('0x6a')][_0xdc69('0x40')];_0x534c21+=0x1){let _0x1b2a14=_0x591e96[_0xdc69('0x6a')][_0x534c21];var _0x218efa=_0x94407a['clone']();_0x218efa[_0xdc69('0x44')](_0xdc69('0x7d'),_0x1b2a14['id']);_0x4565ae[_0xdc69('0x7e')](db[_0xdc69('0x6f')][_0xdc69('0x3b')](_0x218efa[_0xdc69('0x7f')](),{'type':db[_0xdc69('0x6f')]['QueryTypes'][_0xdc69('0x80')]})[_0xdc69('0x2e')](function(_0x4cbeb0){if(_0x4cbeb0[_0xdc69('0x40')]===0x1){return _0x1b2a14['id'];}else{var _0x4928a7=_[_0xdc69('0x81')](_['map'](_0x4cbeb0,_0xdc69('0x82')),function(_0xaede46){return _['includes'](_0x5d80e2,_0xaede46);});if(_0x4928a7){return _0x1b2a14['id'];}}}));}}return BPromise['all'](_0x4565ae)['then'](function(_0x32d0cd){_0x1e9521=_(_0x1e9521)[_0xdc69('0x83')](_0x32d0cd)['compact']()[_0xdc69('0x84')]();return db[_0xdc69('0x34')][_0xdc69('0x4d')]({'where':{'id':_0x2f54f9[_0xdc69('0x4a')]['id']}})[_0xdc69('0x2e')](function(_0x3ecdaa){return db[_0xdc69('0x6f')][_0xdc69('0x85')](function(_0xece2d8){return _0x3ecdaa['removeTeams'](_0x2f54f9[_0xdc69('0x3b')][_0xdc69('0x75')],{'transaction':_0xece2d8})[_0xdc69('0x2e')](function(){if(!_[_0xdc69('0x86')](_0x1e9521)){return _0x3ecdaa[_0xdc69('0x87')](_0x1e9521,{'transaction':_0xece2d8});}})['then'](function(){_0x1e9521[_0xdc69('0x71')](function(_0x2d1eed){socket[_0xdc69('0x72')](_0xdc69('0x88'),{'UserId':_0x2d1eed,'SmsQueueId':_0x3ecdaa['id']});});});});});});})[_0xdc69('0x2e')](respondWithStatusCode(_0x3e4f0c,null))[_0xdc69('0x49')](handleError(_0x3e4f0c,null));};exports[_0xdc69('0x89')]=function(_0x445dce,_0x301dea,_0x465832){return db[_0xdc69('0x34')][_0xdc69('0x4d')]({'where':{'id':_0x445dce['params']['id']}})[_0xdc69('0x2e')](handleEntityNotFound(_0x301dea,null))['then'](function(_0x4b1a3d){if(_0x4b1a3d){return _0x4b1a3d[_0xdc69('0x89')](_0x445dce[_0xdc69('0x4f')][_0xdc69('0x75')],_[_0xdc69('0x8a')](_0x445dce['body'],[_0xdc69('0x75'),'id'])||{})['spread'](function(_0x42fe2a){for(var _0x1c9edd=0x0;_0x1c9edd<_0x445dce['body'][_0xdc69('0x75')][_0xdc69('0x40')];_0x1c9edd+=0x1){socket['emit'](_0xdc69('0x73'),{'UserId':Number(_0x445dce[_0xdc69('0x4f')][_0xdc69('0x75')][_0x1c9edd]),'SmsQueueId':Number(_0x445dce[_0xdc69('0x4a')]['id'])});}return _0x42fe2a;});}})[_0xdc69('0x2e')](respondWithResult(_0x301dea,null))[_0xdc69('0x49')](handleError(_0x301dea,null));};exports['removeAgents']=function(_0x35e40b,_0x22202d,_0x183676){return db['SmsQueue'][_0xdc69('0x4d')]({'where':{'id':_0x35e40b[_0xdc69('0x4a')]['id']}})[_0xdc69('0x2e')](handleEntityNotFound(_0x22202d,null))[_0xdc69('0x2e')](function(_0x324737){if(_0x324737){return _0x324737[_0xdc69('0x87')](_0x35e40b['query'][_0xdc69('0x75')])[_0xdc69('0x2e')](function(){if(_[_0xdc69('0x8b')](_0x35e40b[_0xdc69('0x3b')][_0xdc69('0x75')])){for(var _0x5f156f=0x0;_0x5f156f<_0x35e40b[_0xdc69('0x3b')]['ids'][_0xdc69('0x40')];_0x5f156f+=0x1){socket[_0xdc69('0x72')](_0xdc69('0x88'),{'UserId':Number(_0x35e40b[_0xdc69('0x3b')]['ids'][_0x5f156f]),'SmsQueueId':Number(_0x35e40b['params']['id'])});}}else{socket['emit'](_0xdc69('0x88'),{'UserId':Number(_0x35e40b[_0xdc69('0x3b')][_0xdc69('0x75')]),'SmsQueueId':Number(_0x35e40b[_0xdc69('0x4a')]['id'])});}});}})[_0xdc69('0x2e')](respondWithStatusCode(_0x22202d,null))['catch'](handleError(_0x22202d,null));};exports[_0xdc69('0x8c')]=function(_0x5f4214,_0x44a87e,_0x4140a9){var _0x3292d8={};var _0x32f58b={};var _0xa2c232;var _0x46c5b7;return db['SmsQueue'][_0xdc69('0x66')]({'where':{'id':_0x5f4214[_0xdc69('0x4a')]['id']}})['then'](handleEntityNotFound(_0x44a87e,null))[_0xdc69('0x2e')](function(_0x36a108){if(_0x36a108){_0xa2c232=_0x36a108;_0x32f58b['model']=_[_0xdc69('0x3a')](db[_0xdc69('0x5d')]['rawAttributes']);_0x32f58b[_0xdc69('0x3b')]=_[_0xdc69('0x3a')](_0x5f4214[_0xdc69('0x3b')]);_0x32f58b['filters']=_['intersection'](_0x32f58b[_0xdc69('0x39')],_0x32f58b[_0xdc69('0x3b')]);_0x3292d8[_0xdc69('0x3e')]=_['intersection'](_0x32f58b['model'],qs['fields'](_0x5f4214[_0xdc69('0x3b')][_0xdc69('0x3f')]));_0x3292d8[_0xdc69('0x3e')]=_0x3292d8[_0xdc69('0x3e')][_0xdc69('0x40')]?_0x3292d8[_0xdc69('0x3e')]:_0x32f58b[_0xdc69('0x39')];_0x3292d8[_0xdc69('0x42')]=qs[_0xdc69('0x43')](_0x5f4214['query'][_0xdc69('0x43')]);_0x3292d8[_0xdc69('0x44')]=qs['filters'](_[_0xdc69('0x45')](_0x5f4214['query'],_0x32f58b[_0xdc69('0x3c')]));if(_0x5f4214[_0xdc69('0x3b')][_0xdc69('0x46')]){_0x3292d8[_0xdc69('0x44')]=_[_0xdc69('0x4c')](_0x3292d8[_0xdc69('0x44')],{'$or':_['map'](_0x3292d8[_0xdc69('0x3e')],function(_0x57b546){var _0x1691c8={};_0x1691c8[_0x57b546]={'$like':'%'+_0x5f4214[_0xdc69('0x3b')][_0xdc69('0x46')]+'%'};return _0x1691c8;})});}_0x3292d8=_[_0xdc69('0x4c')]({},_0x3292d8,_0x5f4214[_0xdc69('0x47')]);return _0xa2c232['getAgents'](_0x3292d8);}})[_0xdc69('0x2e')](function(_0x2f8ca7){if(_0x2f8ca7){_0x46c5b7=_0x2f8ca7[_0xdc69('0x40')];if(!_0x5f4214[_0xdc69('0x3b')]['hasOwnProperty'](_0xdc69('0x41'))){_0x3292d8[_0xdc69('0x25')]=qs[_0xdc69('0x25')](_0x5f4214[_0xdc69('0x3b')]['limit']);_0x3292d8[_0xdc69('0x23')]=qs['offset'](_0x5f4214[_0xdc69('0x3b')]['offset']);}return _0xa2c232[_0xdc69('0x8c')](_0x3292d8);}})[_0xdc69('0x2e')](function(_0x3aabf6){if(_0x3aabf6){return _0x3aabf6?{'count':_0x46c5b7,'rows':_0x3aabf6}:null;}})[_0xdc69('0x2e')](respondWithResult(_0x44a87e,null))[_0xdc69('0x49')](handleError(_0x44a87e,null));}; \ No newline at end of file +var _0xa48a=['field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','SmsQueues','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','SmsQueue','includeAll','include','rows','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','pick','addTeams','voicePause','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','findAll','ids','select'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0xa48a,0xac));var _0xaa48=function(_0x505513,_0x15672a){_0x505513=_0x505513-0x0;var _0x459892=_0xa48a[_0x505513];return _0x459892;};'use strict';var emlformat=require(_0xaa48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaa48('0x1'));var jsonpatch=require(_0xaa48('0x2'));var rp=require(_0xaa48('0x3'));var moment=require(_0xaa48('0x4'));var BPromise=require(_0xaa48('0x5'));var Mustache=require('mustache');var util=require(_0xaa48('0x6'));var path=require(_0xaa48('0x7'));var sox=require(_0xaa48('0x8'));var csv=require(_0xaa48('0x9'));var ejs=require(_0xaa48('0xa'));var fs=require('fs');var fs_extra=require(_0xaa48('0xb'));var _=require(_0xaa48('0xc'));var squel=require('squel');var crypto=require(_0xaa48('0xd'));var jsforce=require(_0xaa48('0xe'));var deskjs=require(_0xaa48('0xf'));var toCsv=require(_0xaa48('0x9'));var querystring=require(_0xaa48('0x10'));var Papa=require(_0xaa48('0x11'));var Redis=require(_0xaa48('0x12'));var authService=require(_0xaa48('0x13'));var qs=require(_0xaa48('0x14'));var as=require(_0xaa48('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa48('0x16'))('api');var utils=require(_0xaa48('0x17'));var config=require(_0xaa48('0x18'));var licenseUtil=require(_0xaa48('0x19'));var db=require(_0xaa48('0x1a'))['db'];config[_0xaa48('0x1b')]=_['defaults'](config[_0xaa48('0x1b')],{'host':_0xaa48('0x1c'),'port':0x18eb});var socket=require(_0xaa48('0x1d'))(new Redis(config[_0xaa48('0x1b')]));require(_0xaa48('0x1e'))[_0xaa48('0x1f')](socket);function respondWithStatusCode(_0x5bb858,_0x51fb36){_0x51fb36=_0x51fb36||0xcc;return function(_0x3f27ad){if(_0x3f27ad){return _0x5bb858[_0xaa48('0x20')](_0x51fb36);}return _0x5bb858['status'](_0x51fb36)[_0xaa48('0x21')]();};}function respondWithResult(_0x38e665,_0x546159){_0x546159=_0x546159||0xc8;return function(_0x23b7dc){if(_0x23b7dc){return _0x38e665[_0xaa48('0x22')](_0x546159)['json'](_0x23b7dc);}};}function respondWithFilteredResult(_0x1df5d8,_0x5cea99){return function(_0x33ea1c){if(_0x33ea1c){var _0x1642c2=typeof _0x5cea99[_0xaa48('0x23')]===_0xaa48('0x24')&&typeof _0x5cea99['limit']===_0xaa48('0x24');var _0x4b55e2=_0x33ea1c[_0xaa48('0x25')];var _0x42610c=_0x1642c2?0x0:_0x5cea99[_0xaa48('0x23')];var _0x177f9a=_0x1642c2?_0x33ea1c[_0xaa48('0x25')]:_0x5cea99[_0xaa48('0x23')]+_0x5cea99[_0xaa48('0x26')];var _0x439151;if(_0x177f9a>=_0x4b55e2){_0x177f9a=_0x4b55e2;_0x439151=0xc8;}else{_0x439151=0xce;}_0x1df5d8[_0xaa48('0x22')](_0x439151);return _0x1df5d8['set'](_0xaa48('0x27'),_0x42610c+'-'+_0x177f9a+'/'+_0x4b55e2)['json'](_0x33ea1c);}return null;};}function patchUpdates(_0x2a22ca){return function(_0x1127a1){try{jsonpatch[_0xaa48('0x28')](_0x1127a1,_0x2a22ca,!![]);}catch(_0x262684){return BPromise[_0xaa48('0x29')](_0x262684);}return _0x1127a1[_0xaa48('0x2a')]();};}function saveUpdates(_0x1f8f15,_0x40cac6){return function(_0x5410f5){if(_0x5410f5){return _0x5410f5[_0xaa48('0x2b')](_0x1f8f15)['then'](function(_0x112824){return _0x112824;});}return null;};}function removeEntity(_0x40bc13,_0x4bb3f6){return function(_0x1ce25d){if(_0x1ce25d){return _0x1ce25d[_0xaa48('0x2c')]()[_0xaa48('0x2d')](function(){var _0x5445f0=_0x1ce25d['get']({'plain':!![]});var _0x428edd=_0xaa48('0x2e');return db[_0xaa48('0x2f')][_0xaa48('0x2c')]({'where':{'type':_0x428edd,'resourceId':_0x5445f0['id']}})['then'](function(){return _0x1ce25d;});})[_0xaa48('0x2d')](function(){_0x40bc13[_0xaa48('0x22')](0xcc)[_0xaa48('0x21')]();});}};}function handleEntityNotFound(_0x3cd8db,_0x2db4ea){return function(_0x50895f){if(!_0x50895f){_0x3cd8db[_0xaa48('0x20')](0x194);}return _0x50895f;};}function handleError(_0x504d55,_0x231201){_0x231201=_0x231201||0x1f4;return function(_0x386203){logger['error'](_0x386203[_0xaa48('0x30')]);if(_0x386203['name']){delete _0x386203[_0xaa48('0x31')];}_0x504d55['status'](_0x231201)[_0xaa48('0x32')](_0x386203);};}exports[_0xaa48('0x33')]=function(_0x2bacc6,_0x5d500c){var _0x122679={},_0x2a71ae={},_0x2f235a={'count':0x0,'rows':[]};var _0x448b0c=_['map'](db['SmsQueue'][_0xaa48('0x34')],function(_0x54a681){return{'name':_0x54a681[_0xaa48('0x35')],'type':_0x54a681[_0xaa48('0x36')][_0xaa48('0x37')]};});_0x2a71ae[_0xaa48('0x38')]=_[_0xaa48('0x39')](_0x448b0c,_0xaa48('0x31'));_0x2a71ae[_0xaa48('0x3a')]=_['keys'](_0x2bacc6[_0xaa48('0x3a')]);_0x2a71ae['filters']=_[_0xaa48('0x3b')](_0x2a71ae[_0xaa48('0x38')],_0x2a71ae[_0xaa48('0x3a')]);_0x122679[_0xaa48('0x3c')]=_[_0xaa48('0x3b')](_0x2a71ae[_0xaa48('0x38')],qs['fields'](_0x2bacc6[_0xaa48('0x3a')][_0xaa48('0x3d')]));_0x122679['attributes']=_0x122679[_0xaa48('0x3c')][_0xaa48('0x3e')]?_0x122679['attributes']:_0x2a71ae[_0xaa48('0x38')];if(!_0x2bacc6['query'][_0xaa48('0x3f')](_0xaa48('0x40'))){_0x122679[_0xaa48('0x26')]=qs[_0xaa48('0x26')](_0x2bacc6[_0xaa48('0x3a')][_0xaa48('0x26')]);_0x122679['offset']=qs[_0xaa48('0x23')](_0x2bacc6[_0xaa48('0x3a')]['offset']);}_0x122679[_0xaa48('0x41')]=qs[_0xaa48('0x42')](_0x2bacc6[_0xaa48('0x3a')]['sort']);_0x122679[_0xaa48('0x43')]=qs[_0xaa48('0x44')](_['pick'](_0x2bacc6['query'],_0x2a71ae[_0xaa48('0x44')]),_0x448b0c);if(_0x2bacc6[_0xaa48('0x3a')][_0xaa48('0x45')]){_0x122679[_0xaa48('0x43')]=_['merge'](_0x122679[_0xaa48('0x43')],{'$or':_[_0xaa48('0x39')](_0x448b0c,function(_0x5cb93b){if(_0x5cb93b[_0xaa48('0x36')]!==_0xaa48('0x46')){var _0x87e53={};_0x87e53[_0x5cb93b['name']]={'$like':'%'+_0x2bacc6[_0xaa48('0x3a')][_0xaa48('0x45')]+'%'};return _0x87e53;}})});}_0x122679=_[_0xaa48('0x47')]({},_0x122679,_0x2bacc6[_0xaa48('0x48')]);var _0x40c55f={'where':_0x122679['where']};return db[_0xaa48('0x49')][_0xaa48('0x25')](_0x40c55f)[_0xaa48('0x2d')](function(_0x5f13d0){_0x2f235a[_0xaa48('0x25')]=_0x5f13d0;if(_0x2bacc6[_0xaa48('0x3a')][_0xaa48('0x4a')]){_0x122679[_0xaa48('0x4b')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x122679);})[_0xaa48('0x2d')](function(_0xf735bd){_0x2f235a[_0xaa48('0x4c')]=_0xf735bd;return _0x2f235a;})[_0xaa48('0x2d')](respondWithFilteredResult(_0x5d500c,_0x122679))['catch'](handleError(_0x5d500c,null));};exports[_0xaa48('0x4d')]=function(_0x482237,_0xf7e699){var _0x5a6961={'raw':!![],'where':{'id':_0x482237[_0xaa48('0x4e')]['id']}},_0x3b38ad={};_0x3b38ad['model']=_['keys'](db['SmsQueue'][_0xaa48('0x34')]);_0x3b38ad[_0xaa48('0x3a')]=_[_0xaa48('0x4f')](_0x482237['query']);_0x3b38ad[_0xaa48('0x44')]=_['intersection'](_0x3b38ad[_0xaa48('0x38')],_0x3b38ad['query']);_0x5a6961[_0xaa48('0x3c')]=_['intersection'](_0x3b38ad[_0xaa48('0x38')],qs[_0xaa48('0x3d')](_0x482237['query'][_0xaa48('0x3d')]));_0x5a6961[_0xaa48('0x3c')]=_0x5a6961[_0xaa48('0x3c')]['length']?_0x5a6961[_0xaa48('0x3c')]:_0x3b38ad['model'];if(_0x482237[_0xaa48('0x3a')]['includeAll']){_0x5a6961['include']=[{'all':!![]}];}_0x5a6961=_['merge']({},_0x5a6961,_0x482237[_0xaa48('0x48')]);return db[_0xaa48('0x49')][_0xaa48('0x50')](_0x5a6961)[_0xaa48('0x2d')](handleEntityNotFound(_0xf7e699,null))['then'](respondWithResult(_0xf7e699,null))['catch'](handleError(_0xf7e699,null));};exports[_0xaa48('0x51')]=function(_0x5da0be,_0x17aced){return db[_0xaa48('0x49')][_0xaa48('0x51')](_0x5da0be[_0xaa48('0x52')],{})['then'](function(_0x2b1dd8){var _0x59890b=_0x5da0be[_0xaa48('0x53')]['get']({'plain':!![]});if(!_0x59890b)throw new Error(_0xaa48('0x54'));if(_0x59890b[_0xaa48('0x55')]===_0xaa48('0x53')){var _0x181130=_0x2b1dd8[_0xaa48('0x56')]({'plain':!![]});var _0x7e8a6c=_0xaa48('0x2e');return db[_0xaa48('0x57')][_0xaa48('0x50')]({'where':{'name':_0x7e8a6c,'userProfileId':_0x59890b[_0xaa48('0x58')]},'raw':!![]})[_0xaa48('0x2d')](function(_0x5783bd){if(_0x5783bd&&_0x5783bd[_0xaa48('0x59')]===0x0){return db[_0xaa48('0x2f')][_0xaa48('0x51')]({'name':_0x181130[_0xaa48('0x31')],'resourceId':_0x181130['id'],'type':_0x5783bd[_0xaa48('0x31')],'sectionId':_0x5783bd['id']},{})[_0xaa48('0x2d')](function(){return _0x2b1dd8;});}else{return _0x2b1dd8;}})[_0xaa48('0x5a')](function(_0x50b58a){logger[_0xaa48('0x5b')](_0xaa48('0x5c'),_0x50b58a);throw _0x50b58a;});}return _0x2b1dd8;})[_0xaa48('0x2d')](respondWithResult(_0x17aced,0xc9))[_0xaa48('0x5a')](handleError(_0x17aced,null));};exports[_0xaa48('0x2b')]=function(_0x3dcd17,_0x5ac177){if(_0x3dcd17[_0xaa48('0x52')]['id']){delete _0x3dcd17[_0xaa48('0x52')]['id'];}return db['SmsQueue'][_0xaa48('0x50')]({'where':{'id':_0x3dcd17[_0xaa48('0x4e')]['id']}})[_0xaa48('0x2d')](handleEntityNotFound(_0x5ac177,null))['then'](saveUpdates(_0x3dcd17[_0xaa48('0x52')],null))[_0xaa48('0x2d')](respondWithResult(_0x5ac177,null))[_0xaa48('0x5a')](handleError(_0x5ac177,null));};exports['destroy']=function(_0x12c6c2,_0x24edbe){return db[_0xaa48('0x49')][_0xaa48('0x50')]({'where':{'id':_0x12c6c2['params']['id']}})[_0xaa48('0x2d')](handleEntityNotFound(_0x24edbe,null))[_0xaa48('0x2d')](removeEntity(_0x24edbe,null))[_0xaa48('0x5a')](handleError(_0x24edbe,null));};exports[_0xaa48('0x5d')]=function(_0x5269f4,_0x3b84e7){return db[_0xaa48('0x49')]['describe']()[_0xaa48('0x2d')](respondWithResult(_0x3b84e7,null))[_0xaa48('0x5a')](handleError(_0x3b84e7,null));};exports['getMembers']=function(_0x3aac71,_0x48ef65,_0x16ad36){var _0x5f3b66={'raw':!![],'where':{}},_0x5e5ab1={},_0x991252;return db[_0xaa48('0x49')][_0xaa48('0x5e')]({'where':{'id':_0x3aac71[_0xaa48('0x4e')]['id']}})[_0xaa48('0x2d')](handleEntityNotFound(_0x48ef65,null))['then'](function(_0x3267e2){if(_0x3267e2){_0x991252=_0x3267e2[_0xaa48('0x56')]({'plain':!![]});_0x5e5ab1[_0xaa48('0x38')]=_[_0xaa48('0x4f')](db[_0xaa48('0x5f')][_0xaa48('0x34')]);_0x5e5ab1[_0xaa48('0x3a')]=_[_0xaa48('0x4f')](_0x3aac71['query']);_0x5e5ab1[_0xaa48('0x44')]=_[_0xaa48('0x3b')](_0x5e5ab1[_0xaa48('0x38')],_0x5e5ab1[_0xaa48('0x3a')]);_0x5f3b66[_0xaa48('0x3c')]=_['intersection'](_0x5e5ab1[_0xaa48('0x38')],qs[_0xaa48('0x3d')](_0x3aac71[_0xaa48('0x3a')]['fields']));_0x5f3b66['attributes']=_0x5f3b66[_0xaa48('0x3c')][_0xaa48('0x3e')]?_0x5f3b66['attributes']:_0x5e5ab1[_0xaa48('0x38')];if(!_0x3aac71['query'][_0xaa48('0x3f')]('nolimit')){_0x5f3b66['limit']=qs[_0xaa48('0x26')](_0x3aac71['query'][_0xaa48('0x26')]);_0x5f3b66[_0xaa48('0x23')]=qs['offset'](_0x3aac71[_0xaa48('0x3a')][_0xaa48('0x23')]);}_0x5f3b66[_0xaa48('0x41')]=qs[_0xaa48('0x42')](_0x3aac71[_0xaa48('0x3a')][_0xaa48('0x42')]);_0x5f3b66[_0xaa48('0x43')]=qs[_0xaa48('0x44')](_['pick'](_0x3aac71['query'],_0x5e5ab1['filters']));_0x5f3b66[_0xaa48('0x43')][_0xaa48('0x60')]=_0x3267e2['id'];if(_0x3aac71[_0xaa48('0x3a')][_0xaa48('0x45')]){_0x5f3b66['where']=_['merge'](_0x5f3b66['where'],{'$or':_[_0xaa48('0x39')](_0x5f3b66[_0xaa48('0x3c')],function(_0x37ff54){var _0x38d576={};_0x38d576[_0x37ff54]={'$like':'%'+_0x3aac71[_0xaa48('0x3a')]['filter']+'%'};return _0x38d576;})});}_0x5f3b66=_['merge']({},_0x5f3b66,_0x3aac71['options']);return db['UserSmsQueue']['findAll'](_0x5f3b66);}})[_0xaa48('0x2d')](function(_0x5ade6b){if(_0x5ade6b){return db[_0xaa48('0x61')][_0xaa48('0x62')]({'where':{'id':_[_0xaa48('0x39')](_0x5ade6b,_0xaa48('0x63')),'role':_0xaa48('0x64')},'attributes':['id',_0xaa48('0x31'),_0xaa48('0x65'),'updatedAt','createdAt']});}})[_0xaa48('0x2d')](function(_0x244a5c){if(_0x244a5c){return{'count':_0x244a5c[_0xaa48('0x25')],'rows':_[_0xaa48('0x39')](_0x244a5c[_0xaa48('0x4c')],function(_0x1f7818){return{'membername':_0x1f7818[_0xaa48('0x31')],'UserId':_0x1f7818['id'],'queue_name':_0x991252[_0xaa48('0x31')],'SmsQueueId':_0x991252['id'],'interface':util['format'](_0xaa48('0x66'),_0xaa48('0x67'),_0x1f7818[_0xaa48('0x31')]),'penalty':0x0,'paused':_0x1f7818[_0xaa48('0x65')],'createdAt':_0x1f7818[_0xaa48('0x68')],'updatedAt':_0x1f7818[_0xaa48('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaa48('0x2d')](respondWithFilteredResult(_0x48ef65,_0x5f3b66))[_0xaa48('0x5a')](handleError(_0x48ef65,null));};exports[_0xaa48('0x6a')]=function(_0x57c187,_0x3757e4,_0xe0ea6c){var _0x200441={};var _0x32c91e={};var _0x3804a4;var _0x406166;return db[_0xaa48('0x49')][_0xaa48('0x5e')]({'where':{'id':_0x57c187[_0xaa48('0x4e')]['id']}})[_0xaa48('0x2d')](handleEntityNotFound(_0x3757e4,null))[_0xaa48('0x2d')](function(_0x140658){if(_0x140658){_0x3804a4=_0x140658;_0x32c91e[_0xaa48('0x38')]=_[_0xaa48('0x4f')](db[_0xaa48('0x6b')][_0xaa48('0x34')]);_0x32c91e[_0xaa48('0x3a')]=_['keys'](_0x57c187[_0xaa48('0x3a')]);_0x32c91e[_0xaa48('0x44')]=_['intersection'](_0x32c91e[_0xaa48('0x38')],_0x32c91e[_0xaa48('0x3a')]);_0x200441[_0xaa48('0x3c')]=_[_0xaa48('0x3b')](_0x32c91e[_0xaa48('0x38')],qs[_0xaa48('0x3d')](_0x57c187[_0xaa48('0x3a')]['fields']));_0x200441['attributes']=_0x200441[_0xaa48('0x3c')][_0xaa48('0x3e')]?_0x200441['attributes']:_0x32c91e[_0xaa48('0x38')];_0x200441[_0xaa48('0x41')]=qs[_0xaa48('0x42')](_0x57c187['query'][_0xaa48('0x42')]);_0x200441[_0xaa48('0x43')]=qs[_0xaa48('0x44')](_[_0xaa48('0x6c')](_0x57c187[_0xaa48('0x3a')],_0x32c91e[_0xaa48('0x44')]));if(_0x57c187[_0xaa48('0x3a')][_0xaa48('0x45')]){_0x200441['where']=_[_0xaa48('0x47')](_0x200441[_0xaa48('0x43')],{'$or':_[_0xaa48('0x39')](_0x200441[_0xaa48('0x3c')],function(_0x4cc618){var _0x119fa4={};_0x119fa4[_0x4cc618]={'$like':'%'+_0x57c187['query'][_0xaa48('0x45')]+'%'};return _0x119fa4;})});}_0x200441=_[_0xaa48('0x47')]({},_0x200441,_0x57c187['options']);return _0x3804a4['getTeams'](_0x200441);}})[_0xaa48('0x2d')](function(_0x46633d){if(_0x46633d){_0x406166=_0x46633d['length'];if(!_0x57c187['query']['hasOwnProperty'](_0xaa48('0x40'))){_0x200441['limit']=qs[_0xaa48('0x26')](_0x57c187['query'][_0xaa48('0x26')]);_0x200441[_0xaa48('0x23')]=qs[_0xaa48('0x23')](_0x57c187['query']['offset']);}return _0x3804a4['getTeams'](_0x200441);}})[_0xaa48('0x2d')](function(_0x4eda04){if(_0x4eda04){return _0x4eda04?{'count':_0x406166,'rows':_0x4eda04}:null;}})[_0xaa48('0x2d')](respondWithResult(_0x3757e4,null))[_0xaa48('0x5a')](handleError(_0x3757e4,null));};exports[_0xaa48('0x6d')]=function(_0x382602,_0x3cc472,_0xdf48cc){var _0x5ce38a=_0x382602[_0xaa48('0x52')]['ids'];return db[_0xaa48('0x6b')]['findAll']({'where':{'id':_0x5ce38a},'attributes':['id'],'include':[{'model':db[_0xaa48('0x61')],'as':'Agents','attributes':['id',_0xaa48('0x31'),'online',_0xaa48('0x6e'),'interface'],'raw':!![]}]})[_0xaa48('0x2d')](function(_0x4205b2){if(_0x4205b2){var _0x3c0690=_[_0xaa48('0x6f')](_0x4205b2,function(_0x1274d6){var _0x4aa5e4=_0x1274d6[_0xaa48('0x56')]({'plain':!![]});return _0x4aa5e4[_0xaa48('0x70')];});return db[_0xaa48('0x49')][_0xaa48('0x50')]({'where':{'id':_0x382602[_0xaa48('0x4e')]['id']}})[_0xaa48('0x2d')](function(_0x17295c){return db[_0xaa48('0x71')][_0xaa48('0x72')](function(_0x3dafca){return _0x17295c[_0xaa48('0x6d')](_0x5ce38a,{'transaction':_0x3dafca})[_0xaa48('0x2d')](function(){return BPromise[_0xaa48('0x73')](_0x3c0690,function(_0x5f78ff){return db['UserSmsQueue'][_0xaa48('0x74')]({'where':{'UserId':_0x5f78ff['id'],'SmsQueueId':_0x382602[_0xaa48('0x4e')]['id']},'transaction':_0x3dafca});});})[_0xaa48('0x2d')](function(){_0x3c0690[_0xaa48('0x75')](function(_0x28650b){socket[_0xaa48('0x76')](_0xaa48('0x77'),{'UserId':_0x28650b['id'],'SmsQueueId':_0x17295c['id']});});});});});}})[_0xaa48('0x2d')](respondWithStatusCode(_0x3cc472,null))[_0xaa48('0x5a')](handleError(_0x3cc472,null));};exports[_0xaa48('0x78')]=function(_0x675675,_0x2081db,_0xb58394){return db[_0xaa48('0x6b')][_0xaa48('0x79')]({'where':{'id':_0x675675['query'][_0xaa48('0x7a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xaa48('0x70'),'attributes':['id'],'raw':!![]}]})[_0xaa48('0x2d')](handleEntityNotFound(_0x2081db,null))[_0xaa48('0x2d')](function(_0x97e446){var _0x557432=_['map'](_0x97e446,'id');var _0xf72692=[];var _0x17849d=[];var _0x2624d3=squel[_0xaa48('0x7b')]();_0x2624d3[_0xaa48('0x7c')]('tq.TeamId')[_0xaa48('0x7d')](_0xaa48('0x7e'),'tq')[_0xaa48('0x7f')](_0xaa48('0x80'),'ut',_0xaa48('0x81'))[_0xaa48('0x43')](_0xaa48('0x82'),_0x675675[_0xaa48('0x4e')]['id']);for(var _0xca7cbc=0x0;_0xca7cbc<_0x97e446[_0xaa48('0x3e')];_0xca7cbc+=0x1){let _0x59f055=_0x97e446[_0xca7cbc];for(var _0x1872c4=0x0;_0x1872c4<_0x59f055[_0xaa48('0x70')][_0xaa48('0x3e')];_0x1872c4+=0x1){let _0x42fc3e=_0x59f055[_0xaa48('0x70')][_0x1872c4];var _0x4c1111=_0x2624d3[_0xaa48('0x83')]();_0x4c1111[_0xaa48('0x43')]('ut.UserId\x20=\x20?',_0x42fc3e['id']);_0x17849d[_0xaa48('0x84')](db[_0xaa48('0x71')][_0xaa48('0x3a')](_0x4c1111[_0xaa48('0x85')](),{'type':db[_0xaa48('0x71')]['QueryTypes'][_0xaa48('0x86')]})[_0xaa48('0x2d')](function(_0x4b6345){if(_0x4b6345[_0xaa48('0x3e')]===0x1){return _0x42fc3e['id'];}else{var _0x3227b2=_[_0xaa48('0x87')](_[_0xaa48('0x39')](_0x4b6345,_0xaa48('0x88')),function(_0x14074d){return _['includes'](_0x557432,_0x14074d);});if(_0x3227b2){return _0x42fc3e['id'];}}}));}}return BPromise[_0xaa48('0x89')](_0x17849d)['then'](function(_0x409ccb){_0xf72692=_(_0xf72692)['union'](_0x409ccb)[_0xaa48('0x8a')]()[_0xaa48('0x8b')]();return db[_0xaa48('0x49')][_0xaa48('0x50')]({'where':{'id':_0x675675[_0xaa48('0x4e')]['id']}})[_0xaa48('0x2d')](function(_0xc7ae7e){return db['sequelize'][_0xaa48('0x72')](function(_0xb267d8){return _0xc7ae7e[_0xaa48('0x78')](_0x675675[_0xaa48('0x3a')][_0xaa48('0x7a')],{'transaction':_0xb267d8})['then'](function(){if(!_[_0xaa48('0x8c')](_0xf72692)){return _0xc7ae7e[_0xaa48('0x8d')](_0xf72692,{'transaction':_0xb267d8});}})[_0xaa48('0x2d')](function(){_0xf72692[_0xaa48('0x75')](function(_0xabbb5a){socket['emit'](_0xaa48('0x8e'),{'UserId':_0xabbb5a,'SmsQueueId':_0xc7ae7e['id']});});});});});});})[_0xaa48('0x2d')](respondWithStatusCode(_0x2081db,null))[_0xaa48('0x5a')](handleError(_0x2081db,null));};exports[_0xaa48('0x8f')]=function(_0x3ec6b6,_0x48d280,_0x3e508d){return db[_0xaa48('0x49')][_0xaa48('0x50')]({'where':{'id':_0x3ec6b6[_0xaa48('0x4e')]['id']}})[_0xaa48('0x2d')](handleEntityNotFound(_0x48d280,null))[_0xaa48('0x2d')](function(_0x59bfaf){if(_0x59bfaf){return _0x59bfaf[_0xaa48('0x8f')](_0x3ec6b6['body'][_0xaa48('0x7a')],_[_0xaa48('0x90')](_0x3ec6b6['body'],[_0xaa48('0x7a'),'id'])||{})[_0xaa48('0x91')](function(_0x23e838){for(var _0x25bf65=0x0;_0x25bf65<_0x3ec6b6[_0xaa48('0x52')][_0xaa48('0x7a')][_0xaa48('0x3e')];_0x25bf65+=0x1){socket[_0xaa48('0x76')](_0xaa48('0x77'),{'UserId':Number(_0x3ec6b6[_0xaa48('0x52')][_0xaa48('0x7a')][_0x25bf65]),'SmsQueueId':Number(_0x3ec6b6['params']['id'])});}return _0x23e838;});}})[_0xaa48('0x2d')](respondWithResult(_0x48d280,null))[_0xaa48('0x5a')](handleError(_0x48d280,null));};exports[_0xaa48('0x8d')]=function(_0x43cb18,_0x341735,_0x3ae598){return db[_0xaa48('0x49')]['find']({'where':{'id':_0x43cb18[_0xaa48('0x4e')]['id']}})[_0xaa48('0x2d')](handleEntityNotFound(_0x341735,null))['then'](function(_0x13e47e){if(_0x13e47e){return _0x13e47e['removeAgents'](_0x43cb18['query'][_0xaa48('0x7a')])[_0xaa48('0x2d')](function(){if(_[_0xaa48('0x92')](_0x43cb18[_0xaa48('0x3a')][_0xaa48('0x7a')])){for(var _0x1bd904=0x0;_0x1bd904<_0x43cb18[_0xaa48('0x3a')][_0xaa48('0x7a')]['length'];_0x1bd904+=0x1){socket[_0xaa48('0x76')](_0xaa48('0x8e'),{'UserId':Number(_0x43cb18[_0xaa48('0x3a')][_0xaa48('0x7a')][_0x1bd904]),'SmsQueueId':Number(_0x43cb18[_0xaa48('0x4e')]['id'])});}}else{socket['emit'](_0xaa48('0x8e'),{'UserId':Number(_0x43cb18['query'][_0xaa48('0x7a')]),'SmsQueueId':Number(_0x43cb18[_0xaa48('0x4e')]['id'])});}});}})[_0xaa48('0x2d')](respondWithStatusCode(_0x341735,null))['catch'](handleError(_0x341735,null));};exports[_0xaa48('0x93')]=function(_0x1ac639,_0x148ca1,_0x54b24b){var _0x56533b={};var _0x310655={};var _0xa919d0;var _0x51eba0;return db[_0xaa48('0x49')][_0xaa48('0x5e')]({'where':{'id':_0x1ac639['params']['id']}})[_0xaa48('0x2d')](handleEntityNotFound(_0x148ca1,null))[_0xaa48('0x2d')](function(_0x5ca438){if(_0x5ca438){_0xa919d0=_0x5ca438;_0x310655[_0xaa48('0x38')]=_['keys'](db['User'][_0xaa48('0x34')]);_0x310655['query']=_['keys'](_0x1ac639[_0xaa48('0x3a')]);_0x310655['filters']=_[_0xaa48('0x3b')](_0x310655['model'],_0x310655[_0xaa48('0x3a')]);_0x56533b['attributes']=_[_0xaa48('0x3b')](_0x310655[_0xaa48('0x38')],qs['fields'](_0x1ac639[_0xaa48('0x3a')][_0xaa48('0x3d')]));_0x56533b[_0xaa48('0x3c')]=_0x56533b[_0xaa48('0x3c')][_0xaa48('0x3e')]?_0x56533b['attributes']:_0x310655[_0xaa48('0x38')];_0x56533b[_0xaa48('0x41')]=qs[_0xaa48('0x42')](_0x1ac639[_0xaa48('0x3a')]['sort']);_0x56533b[_0xaa48('0x43')]=qs['filters'](_[_0xaa48('0x6c')](_0x1ac639[_0xaa48('0x3a')],_0x310655[_0xaa48('0x44')]));if(_0x1ac639[_0xaa48('0x3a')]['filter']){_0x56533b[_0xaa48('0x43')]=_['merge'](_0x56533b['where'],{'$or':_['map'](_0x56533b[_0xaa48('0x3c')],function(_0x49efee){var _0x18923c={};_0x18923c[_0x49efee]={'$like':'%'+_0x1ac639[_0xaa48('0x3a')][_0xaa48('0x45')]+'%'};return _0x18923c;})});}_0x56533b=_[_0xaa48('0x47')]({},_0x56533b,_0x1ac639['options']);return _0xa919d0[_0xaa48('0x93')](_0x56533b);}})[_0xaa48('0x2d')](function(_0x22775d){if(_0x22775d){_0x51eba0=_0x22775d['length'];if(!_0x1ac639[_0xaa48('0x3a')][_0xaa48('0x3f')]('nolimit')){_0x56533b[_0xaa48('0x26')]=qs[_0xaa48('0x26')](_0x1ac639['query'][_0xaa48('0x26')]);_0x56533b['offset']=qs[_0xaa48('0x23')](_0x1ac639[_0xaa48('0x3a')]['offset']);}return _0xa919d0[_0xaa48('0x93')](_0x56533b);}})[_0xaa48('0x2d')](function(_0x4a3e4c){if(_0x4a3e4c){return _0x4a3e4c?{'count':_0x51eba0,'rows':_0x4a3e4c}:null;}})['then'](respondWithResult(_0x148ca1,null))['catch'](handleError(_0x148ca1,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index a19cda1..4b3a806 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 _0xa888=['events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','hook','exports'];(function(_0x247374,_0x367f6c){var _0x2c2407=function(_0x28787b){while(--_0x28787b){_0x247374['push'](_0x247374['shift']());}};_0x2c2407(++_0x367f6c);}(_0xa888,0x168));var _0x8a88=function(_0x1f8ce9,_0x3d538a){_0x1f8ce9=_0x1f8ce9-0x0;var _0x3530f4=_0xa888[_0x1f8ce9];return _0x3530f4;};'use strict';var EventEmitter=require(_0x8a88('0x0'));var SmsQueue=require(_0x8a88('0x1'))['db'][_0x8a88('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x8a88('0x3')](0x0);var events={'afterCreate':_0x8a88('0x4'),'afterUpdate':_0x8a88('0x5'),'afterDestroy':_0x8a88('0x6')};function emitEvent(_0x57e0e1){return function(_0x3d3937,_0x327c17,_0x29b162){SmsQueueEvents['emit'](_0x57e0e1+':'+_0x3d3937['id'],_0x3d3937);SmsQueueEvents['emit'](_0x57e0e1,_0x3d3937);_0x29b162(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x8a88('0x7')](e,emitEvent(event));}}module[_0x8a88('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x68c2=['update','remove','emit','hook','exports','events','SmsQueue','setMaxListeners','save'];(function(_0x48d776,_0xb7dfa1){var _0x4973d7=function(_0xf08a7a){while(--_0xf08a7a){_0x48d776['push'](_0x48d776['shift']());}};_0x4973d7(++_0xb7dfa1);}(_0x68c2,0x1b5));var _0x268c=function(_0x39b352,_0x5db49d){_0x39b352=_0x39b352-0x0;var _0x4a39d3=_0x68c2[_0x39b352];return _0x4a39d3;};'use strict';var EventEmitter=require(_0x268c('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x268c('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x268c('0x2')](0x0);var events={'afterCreate':_0x268c('0x3'),'afterUpdate':_0x268c('0x4'),'afterDestroy':_0x268c('0x5')};function emitEvent(_0x1ff093){return function(_0x1f2ab6,_0x39b0e5,_0x599ff7){SmsQueueEvents[_0x268c('0x6')](_0x1ff093+':'+_0x1f2ab6['id'],_0x1f2ab6);SmsQueueEvents['emit'](_0x1ff093,_0x1f2ab6);_0x599ff7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x268c('0x7')](e,emitEvent(event));}}module[_0x268c('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 671a7bf..ddbdbd2 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 _0x13ef=['./smsQueue.attributes','exports','define','SmsQueue','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x414cf2,_0x2136dd){var _0x27c0dc=function(_0x46062d){while(--_0x46062d){_0x414cf2['push'](_0x414cf2['shift']());}};_0x27c0dc(++_0x2136dd);}(_0x13ef,0x12d));var _0xf13e=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x13ef[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xf13e('0x0'));var util=require(_0xf13e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf13e('0x2'));var BPromise=require(_0xf13e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf13e('0x4'));var rimraf=require(_0xf13e('0x5'));var config=require(_0xf13e('0x6'));var attributes=require(_0xf13e('0x7'));module[_0xf13e('0x8')]=function(_0x578bdb,_0xa8a330){return _0x578bdb[_0xf13e('0x9')](_0xf13e('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed30=['bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','moment'];(function(_0x5a8536,_0x4ce197){var _0x5486c2=function(_0x13cc20){while(--_0x13cc20){_0x5a8536['push'](_0x5a8536['shift']());}};_0x5486c2(++_0x4ce197);}(_0xed30,0xc3));var _0x0ed3=function(_0x31a563,_0x5747d5){_0x31a563=_0x31a563-0x0;var _0x27b95f=_0xed30[_0x31a563];return _0x27b95f;};'use strict';var _=require(_0x0ed3('0x0'));var util=require(_0x0ed3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0ed3('0x2'));var BPromise=require(_0x0ed3('0x3'));var rp=require(_0x0ed3('0x4'));var fs=require('fs');var path=require(_0x0ed3('0x5'));var rimraf=require('rimraf');var config=require(_0x0ed3('0x6'));var attributes=require(_0x0ed3('0x7'));module['exports']=function(_0x264b3a,_0xbc86ef){return _0x264b3a[_0x0ed3('0x8')](_0x0ed3('0x9'),attributes,{'tableName':_0x0ed3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index bc1e44e..4f2182d 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 _0x8931=['model','GetSmsQueue','SmsQueue','where','then','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueue,\x20%s,\x20%s','catch','findAll','options','raw','attributes','limit','include','map'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8931,0xae));var _0x1893=function(_0xdce2c9,_0x3ced9c){_0xdce2c9=_0xdce2c9-0x0;var _0x1448cf=_0x8931[_0xdce2c9];return _0x1448cf;};'use strict';var _=require(_0x1893('0x0'));var util=require(_0x1893('0x1'));var moment=require(_0x1893('0x2'));var BPromise=require(_0x1893('0x3'));var rs=require(_0x1893('0x4'));var fs=require('fs');var Redis=require(_0x1893('0x5'));var db=require(_0x1893('0x6'))['db'];var utils=require(_0x1893('0x7'));var logger=require(_0x1893('0x8'))(_0x1893('0x9'));var config=require(_0x1893('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1893('0xb')]({'port':0x232a});config[_0x1893('0xc')]=_[_0x1893('0xd')](config[_0x1893('0xc')],{'host':_0x1893('0xe'),'port':0x18eb});var socket=require(_0x1893('0xf'))(new Redis(config[_0x1893('0xc')]));require(_0x1893('0x10'))[_0x1893('0x11')](socket);function respondWithRpcPromise(_0x45caa2,_0x37cb0e,_0x1b53c2){return new BPromise(function(_0x5838c4,_0x27cb85){return client[_0x1893('0x12')](_0x45caa2,_0x1b53c2)['then'](function(_0x5e579b){logger[_0x1893('0x13')]('SmsQueue,\x20%s,\x20%s',_0x37cb0e,_0x1893('0x14'));logger[_0x1893('0x15')](_0x1893('0x16'),_0x37cb0e,_0x1893('0x14'),JSON[_0x1893('0x17')](_0x5e579b));if(_0x5e579b['error']){if(_0x5e579b[_0x1893('0x18')][_0x1893('0x19')]===0x1f4){logger[_0x1893('0x18')]('SmsQueue,\x20%s,\x20%s',_0x37cb0e,_0x5e579b[_0x1893('0x18')][_0x1893('0x1a')]);return _0x27cb85(_0x5e579b[_0x1893('0x18')][_0x1893('0x1a')]);}logger[_0x1893('0x18')]('SmsQueue,\x20%s,\x20%s',_0x37cb0e,_0x5e579b[_0x1893('0x18')][_0x1893('0x1a')]);return _0x5838c4(_0x5e579b[_0x1893('0x18')]['message']);}else{logger[_0x1893('0x13')](_0x1893('0x1b'),_0x37cb0e,_0x1893('0x14'));_0x5838c4(_0x5e579b['result'][_0x1893('0x1a')]);}})[_0x1893('0x1c')](function(_0x57c1cd){logger[_0x1893('0x18')](_0x1893('0x1b'),_0x37cb0e,_0x57c1cd);_0x27cb85(_0x57c1cd);});});}exports['GetSmsQueue']=function(_0x4ca885){var _0x99acbd=this;return new Promise(function(_0x422a70,_0xb5f98a){return db['SmsQueue'][_0x1893('0x1d')]({'raw':_0x4ca885[_0x1893('0x1e')]?_0x4ca885[_0x1893('0x1e')][_0x1893('0x1f')]===undefined?!![]:![]:!![],'where':_0x4ca885[_0x1893('0x1e')]?_0x4ca885['options']['where']||null:null,'attributes':_0x4ca885[_0x1893('0x1e')]?_0x4ca885[_0x1893('0x1e')][_0x1893('0x20')]||null:null,'limit':_0x4ca885[_0x1893('0x1e')]?_0x4ca885[_0x1893('0x1e')][_0x1893('0x21')]||null:null,'include':_0x4ca885[_0x1893('0x1e')]?_0x4ca885[_0x1893('0x1e')][_0x1893('0x22')]?_[_0x1893('0x23')](_0x4ca885['options'][_0x1893('0x22')],function(_0x6a28c8){return{'model':db[_0x6a28c8['model']],'as':_0x6a28c8['as'],'attributes':_0x6a28c8[_0x1893('0x20')],'include':_0x6a28c8[_0x1893('0x22')]?_[_0x1893('0x23')](_0x6a28c8[_0x1893('0x22')],function(_0x469ff5){return{'model':db[_0x469ff5[_0x1893('0x24')]],'as':_0x469ff5['as'],'attributes':_0x469ff5[_0x1893('0x20')],'include':_0x469ff5[_0x1893('0x22')]?_[_0x1893('0x23')](_0x469ff5['include'],function(_0x4e92d1){return{'model':db[_0x4e92d1['model']],'as':_0x4e92d1['as'],'attributes':_0x4e92d1[_0x1893('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x558461){logger['info'](_0x1893('0x25'),_0x4ca885);logger[_0x1893('0x15')](_0x1893('0x25'),_0x4ca885,JSON[_0x1893('0x17')](_0x558461));_0x422a70(_0x558461);})[_0x1893('0x1c')](function(_0x2b547){logger[_0x1893('0x18')](_0x1893('0x25'),_0x2b547[_0x1893('0x1a')],_0x4ca885);_0xb5f98a(_0x99acbd[_0x1893('0x18')](0x1f4,_0x2b547['message']));});});};exports['ShowSmsQueue']=function(_0x5dd695){var _0x52b1b4=this;return new Promise(function(_0xbd2674,_0x26136c){return db[_0x1893('0x26')]['find']({'raw':_0x5dd695[_0x1893('0x1e')]?_0x5dd695[_0x1893('0x1e')][_0x1893('0x1f')]===undefined?!![]:![]:!![],'where':_0x5dd695[_0x1893('0x1e')]?_0x5dd695[_0x1893('0x1e')][_0x1893('0x27')]||null:null,'attributes':_0x5dd695[_0x1893('0x1e')]?_0x5dd695[_0x1893('0x1e')][_0x1893('0x20')]||null:null,'include':_0x5dd695[_0x1893('0x1e')]?_0x5dd695[_0x1893('0x1e')]['include']?_[_0x1893('0x23')](_0x5dd695[_0x1893('0x1e')][_0x1893('0x22')],function(_0x14c6d){return{'model':db[_0x14c6d[_0x1893('0x24')]],'as':_0x14c6d['as'],'attributes':_0x14c6d[_0x1893('0x20')],'include':_0x14c6d[_0x1893('0x22')]?_[_0x1893('0x23')](_0x14c6d[_0x1893('0x22')],function(_0x27af06){return{'model':db[_0x27af06[_0x1893('0x24')]],'as':_0x27af06['as'],'attributes':_0x27af06['attributes'],'include':_0x27af06[_0x1893('0x22')]?_[_0x1893('0x23')](_0x27af06['include'],function(_0x526952){return{'model':db[_0x526952[_0x1893('0x24')]],'as':_0x526952['as'],'attributes':_0x526952[_0x1893('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1893('0x28')](function(_0x1b72ff){logger[_0x1893('0x13')](_0x1893('0x29'),_0x5dd695);logger[_0x1893('0x15')]('ShowSmsQueue',_0x5dd695,JSON[_0x1893('0x17')](_0x1b72ff));_0xbd2674(_0x1b72ff);})[_0x1893('0x1c')](function(_0x1aaa00){logger[_0x1893('0x18')](_0x1893('0x29'),_0x1aaa00[_0x1893('0x1a')],_0x5dd695);_0x26136c(_0x52b1b4['error'](0x1f4,_0x1aaa00[_0x1893('0x1a')]));});});}; \ No newline at end of file +var _0x4808=['code','message','info','result','catch','options','raw','where','limit','include','map','model','attributes','GetSmsQueue','SmsQueue','find','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x132f2e,_0x367606){var _0x42a7e2=function(_0x1652e8){while(--_0x1652e8){_0x132f2e['push'](_0x132f2e['shift']());}};_0x42a7e2(++_0x367606);}(_0x4808,0x101));var _0x8480=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x4808[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x8480('0x0'));var util=require(_0x8480('0x1'));var moment=require(_0x8480('0x2'));var BPromise=require(_0x8480('0x3'));var rs=require(_0x8480('0x4'));var fs=require('fs');var Redis=require(_0x8480('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8480('0x6'));var logger=require('../../config/logger')(_0x8480('0x7'));var config=require(_0x8480('0x8'));var jayson=require(_0x8480('0x9'));var client=jayson[_0x8480('0xa')]['http']({'port':0x232a});config[_0x8480('0xb')]=_['defaults'](config[_0x8480('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8480('0xc'))(new Redis(config['redis']));require(_0x8480('0xd'))[_0x8480('0xe')](socket);function respondWithRpcPromise(_0x2a63cd,_0x4daa01,_0xa9fbc1){return new BPromise(function(_0x3b7cd1,_0x368fb9){return client[_0x8480('0xf')](_0x2a63cd,_0xa9fbc1)[_0x8480('0x10')](function(_0x4f5904){logger['info'](_0x8480('0x11'),_0x4daa01,'request\x20sent');logger[_0x8480('0x12')](_0x8480('0x13'),_0x4daa01,_0x8480('0x14'),JSON[_0x8480('0x15')](_0x4f5904));if(_0x4f5904[_0x8480('0x16')]){if(_0x4f5904['error'][_0x8480('0x17')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x4daa01,_0x4f5904['error'][_0x8480('0x18')]);return _0x368fb9(_0x4f5904['error'][_0x8480('0x18')]);}logger['error'](_0x8480('0x11'),_0x4daa01,_0x4f5904[_0x8480('0x16')][_0x8480('0x18')]);return _0x3b7cd1(_0x4f5904['error']['message']);}else{logger[_0x8480('0x19')](_0x8480('0x11'),_0x4daa01,_0x8480('0x14'));_0x3b7cd1(_0x4f5904[_0x8480('0x1a')][_0x8480('0x18')]);}})[_0x8480('0x1b')](function(_0x2f7868){logger[_0x8480('0x16')]('SmsQueue,\x20%s,\x20%s',_0x4daa01,_0x2f7868);_0x368fb9(_0x2f7868);});});}exports['GetSmsQueue']=function(_0x1df324){var _0x52eda3=this;return new Promise(function(_0x25342a,_0x141e89){return db['SmsQueue']['findAll']({'raw':_0x1df324['options']?_0x1df324[_0x8480('0x1c')][_0x8480('0x1d')]===undefined?!![]:![]:!![],'where':_0x1df324[_0x8480('0x1c')]?_0x1df324[_0x8480('0x1c')][_0x8480('0x1e')]||null:null,'attributes':_0x1df324[_0x8480('0x1c')]?_0x1df324[_0x8480('0x1c')]['attributes']||null:null,'limit':_0x1df324[_0x8480('0x1c')]?_0x1df324[_0x8480('0x1c')][_0x8480('0x1f')]||null:null,'include':_0x1df324['options']?_0x1df324[_0x8480('0x1c')][_0x8480('0x20')]?_[_0x8480('0x21')](_0x1df324[_0x8480('0x1c')][_0x8480('0x20')],function(_0x227279){return{'model':db[_0x227279[_0x8480('0x22')]],'as':_0x227279['as'],'attributes':_0x227279[_0x8480('0x23')],'include':_0x227279['include']?_[_0x8480('0x21')](_0x227279[_0x8480('0x20')],function(_0x30e92e){return{'model':db[_0x30e92e['model']],'as':_0x30e92e['as'],'attributes':_0x30e92e[_0x8480('0x23')],'include':_0x30e92e[_0x8480('0x20')]?_[_0x8480('0x21')](_0x30e92e['include'],function(_0x5e5af8){return{'model':db[_0x5e5af8[_0x8480('0x22')]],'as':_0x5e5af8['as'],'attributes':_0x5e5af8[_0x8480('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8480('0x10')](function(_0x5222ca){logger['info'](_0x8480('0x24'),_0x1df324);logger[_0x8480('0x12')](_0x8480('0x24'),_0x1df324,JSON[_0x8480('0x15')](_0x5222ca));_0x25342a(_0x5222ca);})['catch'](function(_0x50513c){logger[_0x8480('0x16')](_0x8480('0x24'),_0x50513c[_0x8480('0x18')],_0x1df324);_0x141e89(_0x52eda3['error'](0x1f4,_0x50513c[_0x8480('0x18')]));});});};exports['ShowSmsQueue']=function(_0x314578){var _0x3ef4f2=this;return new Promise(function(_0x4de749,_0x1484c2){return db[_0x8480('0x25')][_0x8480('0x26')]({'raw':_0x314578[_0x8480('0x1c')]?_0x314578[_0x8480('0x1c')][_0x8480('0x1d')]===undefined?!![]:![]:!![],'where':_0x314578[_0x8480('0x1c')]?_0x314578[_0x8480('0x1c')]['where']||null:null,'attributes':_0x314578[_0x8480('0x1c')]?_0x314578[_0x8480('0x1c')]['attributes']||null:null,'include':_0x314578[_0x8480('0x1c')]?_0x314578[_0x8480('0x1c')][_0x8480('0x20')]?_[_0x8480('0x21')](_0x314578[_0x8480('0x1c')][_0x8480('0x20')],function(_0x3a432f){return{'model':db[_0x3a432f[_0x8480('0x22')]],'as':_0x3a432f['as'],'attributes':_0x3a432f['attributes'],'include':_0x3a432f[_0x8480('0x20')]?_[_0x8480('0x21')](_0x3a432f[_0x8480('0x20')],function(_0x388a5f){return{'model':db[_0x388a5f[_0x8480('0x22')]],'as':_0x388a5f['as'],'attributes':_0x388a5f[_0x8480('0x23')],'include':_0x388a5f['include']?_[_0x8480('0x21')](_0x388a5f[_0x8480('0x20')],function(_0xd795e5){return{'model':db[_0xd795e5[_0x8480('0x22')]],'as':_0xd795e5['as'],'attributes':_0xd795e5[_0x8480('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8480('0x10')](function(_0x11dc2e){logger[_0x8480('0x19')](_0x8480('0x27'),_0x314578);logger[_0x8480('0x12')](_0x8480('0x27'),_0x314578,JSON[_0x8480('0x15')](_0x11dc2e));_0x4de749(_0x11dc2e);})['catch'](function(_0xa5167){logger[_0x8480('0x16')](_0x8480('0x27'),_0xa5167[_0x8480('0x18')],_0x314578);_0x1484c2(_0x3ef4f2[_0x8480('0x16')](0x1f4,_0xa5167[_0x8480('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index d67b424..891db5f 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 _0x2ad8=['./smsQueue.events','remove','update','emit','length','smsQueue:'];(function(_0x4d7280,_0x1755e9){var _0x4c467f=function(_0x2f3446){while(--_0x2f3446){_0x4d7280['push'](_0x4d7280['shift']());}};_0x4c467f(++_0x1755e9);}(_0x2ad8,0x84));var _0x82ad=function(_0x1c081d,_0x10b432){_0x1c081d=_0x1c081d-0x0;var _0x2deb0e=_0x2ad8[_0x1c081d];return _0x2deb0e;};'use strict';var SmsQueueEvents=require(_0x82ad('0x0'));var events=['save',_0x82ad('0x1'),_0x82ad('0x2')];function createListener(_0x381181,_0x3bc172){return function(_0x593d2e){_0x3bc172[_0x82ad('0x3')](_0x381181,_0x593d2e);};}function removeListener(_0x333a37,_0x59537b){return function(){SmsQueueEvents['removeListener'](_0x333a37,_0x59537b);};}exports['register']=function(_0x535516){for(var _0x2a504a=0x0,_0x355e3a=events[_0x82ad('0x4')];_0x2a504a<_0x355e3a;_0x2a504a++){var _0x48d8e2=events[_0x2a504a];var _0x5b1917=createListener(_0x82ad('0x5')+_0x48d8e2,_0x535516);SmsQueueEvents['on'](_0x48d8e2,_0x5b1917);}}; \ No newline at end of file +var _0x3dc7=['smsQueue:','emit','length'];(function(_0x4e6090,_0x50fa28){var _0x108ca1=function(_0x34939e){while(--_0x34939e){_0x4e6090['push'](_0x4e6090['shift']());}};_0x108ca1(++_0x50fa28);}(_0x3dc7,0x1ae));var _0x73dc=function(_0x3c76e2,_0xdb82c7){_0x3c76e2=_0x3c76e2-0x0;var _0x5c4227=_0x3dc7[_0x3c76e2];return _0x5c4227;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove','update'];function createListener(_0x3453cc,_0x43925c){return function(_0x5928ae){_0x43925c[_0x73dc('0x0')](_0x3453cc,_0x5928ae);};}function removeListener(_0x412d41,_0x14f0ad){return function(){SmsQueueEvents['removeListener'](_0x412d41,_0x14f0ad);};}exports['register']=function(_0x46ffe6){for(var _0x8df243=0x0,_0x409eb1=events[_0x73dc('0x1')];_0x8df243<_0x409eb1;_0x8df243++){var _0x1dcb35=events[_0x8df243];var _0x5705b3=createListener(_0x73dc('0x2')+_0x1dcb35,_0x46ffe6);SmsQueueEvents['on'](_0x1dcb35,_0x5705b3);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 6b194f1..741d1c1 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 _0x8c32=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','show','put'];(function(_0x300a33,_0x2f8031){var _0x2346cf=function(_0xdc051){while(--_0xdc051){_0x300a33['push'](_0x300a33['shift']());}};_0x2346cf(++_0x2f8031);}(_0x8c32,0x130));var _0x28c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8c32[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x28c3('0x0'));var util=require(_0x28c3('0x1'));var path=require(_0x28c3('0x2'));var timeout=require(_0x28c3('0x3'));var express=require(_0x28c3('0x4'));var router=express[_0x28c3('0x5')]();var fs_extra=require(_0x28c3('0x6'));var auth=require(_0x28c3('0x7'));var interaction=require(_0x28c3('0x8'));var config=require(_0x28c3('0x9'));var controller=require(_0x28c3('0xa'));router[_0x28c3('0xb')]('/',auth['isAuthenticated'](),controller[_0x28c3('0xc')]);router[_0x28c3('0xb')](_0x28c3('0xd'),auth[_0x28c3('0xe')](),controller[_0x28c3('0xf')]);router[_0x28c3('0xb')]('/:id',auth[_0x28c3('0xe')](),controller[_0x28c3('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x28c3('0x11')](_0x28c3('0x12'),auth['isAuthenticated'](),controller[_0x28c3('0x13')]);router[_0x28c3('0x14')](_0x28c3('0x12'),auth['isAuthenticated'](),controller[_0x28c3('0x15')]);module[_0x28c3('0x16')]=router; \ No newline at end of file +var _0x7852=['show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','describe','/:id','isAuthenticated'];(function(_0x57853f,_0x18dd25){var _0x4ba6ae=function(_0x20774d){while(--_0x20774d){_0x57853f['push'](_0x57853f['shift']());}};_0x4ba6ae(++_0x18dd25);}(_0x7852,0x137));var _0x2785=function(_0x4735cb,_0x22cd08){_0x4735cb=_0x4735cb-0x0;var _0x474bcc=_0x7852[_0x4735cb];return _0x474bcc;};'use strict';var multer=require(_0x2785('0x0'));var util=require('util');var path=require(_0x2785('0x1'));var timeout=require(_0x2785('0x2'));var express=require('express');var router=express[_0x2785('0x3')]();var fs_extra=require(_0x2785('0x4'));var auth=require(_0x2785('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2785('0x6'));var controller=require(_0x2785('0x7'));router[_0x2785('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2785('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x2785('0x9')]);router[_0x2785('0x8')](_0x2785('0xa'),auth[_0x2785('0xb')](),controller[_0x2785('0xc')]);router[_0x2785('0xd')]('/',auth[_0x2785('0xb')](),controller[_0x2785('0xe')]);router[_0x2785('0xf')](_0x2785('0xa'),auth[_0x2785('0xb')](),controller['update']);router[_0x2785('0x10')](_0x2785('0xa'),auth[_0x2785('0xb')](),controller[_0x2785('0x11')]);module[_0x2785('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b401b3b..b01e7db 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 _0x446e=['moment','sequelize','STRING','DATE'];(function(_0x1fb679,_0x15fb4a){var _0x56b51b=function(_0x38e205){while(--_0x38e205){_0x1fb679['push'](_0x1fb679['shift']());}};_0x56b51b(++_0x15fb4a);}(_0x446e,0x1f0));var _0xe446=function(_0x3d8d76,_0xd81341){_0x3d8d76=_0x3d8d76-0x0;var _0x480926=_0x446e[_0x3d8d76];return _0x480926;};'use strict';var moment=require(_0xe446('0x0'));var Sequelize=require(_0xe446('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe446('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe446('0x2')]},'joinAt':{'type':Sequelize[_0xe446('0x3')]},'leaveAt':{'type':Sequelize[_0xe446('0x3')]},'acceptAt':{'type':Sequelize[_0xe446('0x3')]},'exitAt':{'type':Sequelize[_0xe446('0x3')]},'reason':{'type':Sequelize[_0xe446('0x2')]}}; \ No newline at end of file +var _0x9da2=['DATE','sequelize','exports','STRING'];(function(_0x19c5f2,_0x44ed13){var _0xb94caf=function(_0x1b3522){while(--_0x1b3522){_0x19c5f2['push'](_0x19c5f2['shift']());}};_0xb94caf(++_0x44ed13);}(_0x9da2,0xf1));var _0x29da=function(_0x559244,_0x181c8d){_0x559244=_0x559244-0x0;var _0x20bd3f=_0x9da2[_0x559244];return _0x20bd3f;};'use strict';var moment=require('moment');var Sequelize=require(_0x29da('0x0'));module[_0x29da('0x1')]={'uniqueid':{'type':Sequelize[_0x29da('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x29da('0x2')]},'joinAt':{'type':Sequelize[_0x29da('0x3')]},'leaveAt':{'type':Sequelize[_0x29da('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x29da('0x3')]},'reason':{'type':Sequelize[_0x29da('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index c83bd5a..c60975d 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 _0xbc12=['Content-Range','save','then','destroy','end','error','stack','name','index','map','SmsQueueReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','includeAll','include','rows','catch','show','params','keys','merge','options','find','create','body','update','describe','zip-dir','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0xbc12,0xfe));var _0x2bc1=function(_0x14d4d5,_0x3c298e){_0x14d4d5=_0x14d4d5-0x0;var _0x516cf5=_0xbc12[_0x14d4d5];return _0x516cf5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2bc1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2bc1('0x1'));var BPromise=require(_0x2bc1('0x2'));var Mustache=require('mustache');var util=require(_0x2bc1('0x3'));var path=require(_0x2bc1('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2bc1('0x5'));var fs=require('fs');var fs_extra=require(_0x2bc1('0x6'));var _=require(_0x2bc1('0x7'));var squel=require(_0x2bc1('0x8'));var crypto=require(_0x2bc1('0x9'));var jsforce=require(_0x2bc1('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2bc1('0xb'));var querystring=require(_0x2bc1('0xc'));var Papa=require(_0x2bc1('0xd'));var Redis=require(_0x2bc1('0xe'));var authService=require(_0x2bc1('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2bc1('0x10'));var logger=require(_0x2bc1('0x11'))(_0x2bc1('0x12'));var utils=require(_0x2bc1('0x13'));var config=require(_0x2bc1('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2bc1('0x15'))['db'];function respondWithStatusCode(_0x5dc6be,_0x3d14df){_0x3d14df=_0x3d14df||0xcc;return function(_0x101ca6){if(_0x101ca6){return _0x5dc6be[_0x2bc1('0x16')](_0x3d14df);}return _0x5dc6be[_0x2bc1('0x17')](_0x3d14df)['end']();};}function respondWithResult(_0x354cee,_0x53ec6d){_0x53ec6d=_0x53ec6d||0xc8;return function(_0x1ae2a1){if(_0x1ae2a1){return _0x354cee[_0x2bc1('0x17')](_0x53ec6d)[_0x2bc1('0x18')](_0x1ae2a1);}};}function respondWithFilteredResult(_0x53adb0,_0x57817a){return function(_0x251c38){if(_0x251c38){var _0x1961f3=typeof _0x57817a[_0x2bc1('0x19')]===_0x2bc1('0x1a')&&typeof _0x57817a[_0x2bc1('0x1b')]===_0x2bc1('0x1a');var _0x51df07=_0x251c38[_0x2bc1('0x1c')];var _0x57ae7f=_0x1961f3?0x0:_0x57817a[_0x2bc1('0x19')];var _0x3a9538=_0x1961f3?_0x251c38['count']:_0x57817a[_0x2bc1('0x19')]+_0x57817a[_0x2bc1('0x1b')];var _0x1cb4f7;if(_0x3a9538>=_0x51df07){_0x3a9538=_0x51df07;_0x1cb4f7=0xc8;}else{_0x1cb4f7=0xce;}_0x53adb0[_0x2bc1('0x17')](_0x1cb4f7);return _0x53adb0[_0x2bc1('0x1d')](_0x2bc1('0x1e'),_0x57ae7f+'-'+_0x3a9538+'/'+_0x51df07)['json'](_0x251c38);}return null;};}function patchUpdates(_0x5e031b){return function(_0x320a02){try{jsonpatch['apply'](_0x320a02,_0x5e031b,!![]);}catch(_0x346dbb){return BPromise['reject'](_0x346dbb);}return _0x320a02[_0x2bc1('0x1f')]();};}function saveUpdates(_0x59e315,_0x34c095){return function(_0x1e21f3){if(_0x1e21f3){return _0x1e21f3['update'](_0x59e315)[_0x2bc1('0x20')](function(_0x5b75a7){return _0x5b75a7;});}return null;};}function removeEntity(_0x25c273,_0x2e0a4e){return function(_0x5bd030){if(_0x5bd030){return _0x5bd030[_0x2bc1('0x21')]()['then'](function(){_0x25c273[_0x2bc1('0x17')](0xcc)[_0x2bc1('0x22')]();});}};}function handleEntityNotFound(_0x2c22a6,_0x48554d){return function(_0x375323){if(!_0x375323){_0x2c22a6[_0x2bc1('0x16')](0x194);}return _0x375323;};}function handleError(_0x2d4880,_0x54f21d){_0x54f21d=_0x54f21d||0x1f4;return function(_0x34b805){logger[_0x2bc1('0x23')](_0x34b805[_0x2bc1('0x24')]);if(_0x34b805[_0x2bc1('0x25')]){delete _0x34b805[_0x2bc1('0x25')];}_0x2d4880['status'](_0x54f21d)['send'](_0x34b805);};}exports[_0x2bc1('0x26')]=function(_0x2d517b,_0x27fa31){var _0x41c7dd={},_0x25d4c2={},_0x434730={'count':0x0,'rows':[]};var _0x4323a6=_[_0x2bc1('0x27')](db[_0x2bc1('0x28')][_0x2bc1('0x29')],function(_0x2125d0){return{'name':_0x2125d0['fieldName'],'type':_0x2125d0[_0x2bc1('0x2a')][_0x2bc1('0x2b')]};});_0x25d4c2[_0x2bc1('0x2c')]=_['map'](_0x4323a6,'name');_0x25d4c2[_0x2bc1('0x2d')]=_['keys'](_0x2d517b[_0x2bc1('0x2d')]);_0x25d4c2[_0x2bc1('0x2e')]=_[_0x2bc1('0x2f')](_0x25d4c2['model'],_0x25d4c2['query']);_0x41c7dd['attributes']=_[_0x2bc1('0x2f')](_0x25d4c2[_0x2bc1('0x2c')],qs[_0x2bc1('0x30')](_0x2d517b['query'][_0x2bc1('0x30')]));_0x41c7dd['attributes']=_0x41c7dd[_0x2bc1('0x31')][_0x2bc1('0x32')]?_0x41c7dd[_0x2bc1('0x31')]:_0x25d4c2['model'];if(!_0x2d517b[_0x2bc1('0x2d')][_0x2bc1('0x33')]('nolimit')){_0x41c7dd[_0x2bc1('0x1b')]=qs['limit'](_0x2d517b[_0x2bc1('0x2d')]['limit']);_0x41c7dd[_0x2bc1('0x19')]=qs[_0x2bc1('0x19')](_0x2d517b[_0x2bc1('0x2d')][_0x2bc1('0x19')]);}_0x41c7dd[_0x2bc1('0x34')]=qs[_0x2bc1('0x35')](_0x2d517b[_0x2bc1('0x2d')][_0x2bc1('0x35')]);_0x41c7dd[_0x2bc1('0x36')]=qs[_0x2bc1('0x2e')](_['pick'](_0x2d517b['query'],_0x25d4c2[_0x2bc1('0x2e')]),_0x4323a6);if(_0x2d517b[_0x2bc1('0x2d')][_0x2bc1('0x37')]){_0x41c7dd['where']=_['merge'](_0x41c7dd['where'],{'$or':_['map'](_0x4323a6,function(_0x391752){if(_0x391752[_0x2bc1('0x2a')]!==_0x2bc1('0x38')){var _0x1da677={};_0x1da677[_0x391752[_0x2bc1('0x25')]]={'$like':'%'+_0x2d517b[_0x2bc1('0x2d')]['filter']+'%'};return _0x1da677;}})});}_0x41c7dd=_['merge']({},_0x41c7dd,_0x2d517b['options']);var _0x110980={'where':_0x41c7dd[_0x2bc1('0x36')]};return db['SmsQueueReport'][_0x2bc1('0x1c')](_0x110980)[_0x2bc1('0x20')](function(_0x5ebb29){_0x434730[_0x2bc1('0x1c')]=_0x5ebb29;if(_0x2d517b[_0x2bc1('0x2d')][_0x2bc1('0x39')]){_0x41c7dd[_0x2bc1('0x3a')]=[{'all':!![]}];}return db[_0x2bc1('0x28')]['findAll'](_0x41c7dd);})[_0x2bc1('0x20')](function(_0x31b0f1){_0x434730[_0x2bc1('0x3b')]=_0x31b0f1;return _0x434730;})[_0x2bc1('0x20')](respondWithFilteredResult(_0x27fa31,_0x41c7dd))[_0x2bc1('0x3c')](handleError(_0x27fa31,null));};exports[_0x2bc1('0x3d')]=function(_0x510bab,_0x51e1fb){var _0x94970f={'raw':!![],'where':{'id':_0x510bab[_0x2bc1('0x3e')]['id']}},_0x3cfc5e={};_0x3cfc5e[_0x2bc1('0x2c')]=_[_0x2bc1('0x3f')](db['SmsQueueReport'][_0x2bc1('0x29')]);_0x3cfc5e[_0x2bc1('0x2d')]=_['keys'](_0x510bab[_0x2bc1('0x2d')]);_0x3cfc5e[_0x2bc1('0x2e')]=_[_0x2bc1('0x2f')](_0x3cfc5e[_0x2bc1('0x2c')],_0x3cfc5e['query']);_0x94970f[_0x2bc1('0x31')]=_['intersection'](_0x3cfc5e[_0x2bc1('0x2c')],qs[_0x2bc1('0x30')](_0x510bab[_0x2bc1('0x2d')][_0x2bc1('0x30')]));_0x94970f[_0x2bc1('0x31')]=_0x94970f[_0x2bc1('0x31')][_0x2bc1('0x32')]?_0x94970f[_0x2bc1('0x31')]:_0x3cfc5e[_0x2bc1('0x2c')];if(_0x510bab[_0x2bc1('0x2d')]['includeAll']){_0x94970f[_0x2bc1('0x3a')]=[{'all':!![]}];}_0x94970f=_[_0x2bc1('0x40')]({},_0x94970f,_0x510bab[_0x2bc1('0x41')]);return db[_0x2bc1('0x28')][_0x2bc1('0x42')](_0x94970f)[_0x2bc1('0x20')](handleEntityNotFound(_0x51e1fb,null))[_0x2bc1('0x20')](respondWithResult(_0x51e1fb,null))[_0x2bc1('0x3c')](handleError(_0x51e1fb,null));};exports['create']=function(_0x275a6d,_0x3b98a0){return db[_0x2bc1('0x28')][_0x2bc1('0x43')](_0x275a6d[_0x2bc1('0x44')],{})['then'](respondWithResult(_0x3b98a0,0xc9))['catch'](handleError(_0x3b98a0,null));};exports[_0x2bc1('0x45')]=function(_0xe6e1af,_0x2e5e2d){if(_0xe6e1af[_0x2bc1('0x44')]['id']){delete _0xe6e1af[_0x2bc1('0x44')]['id'];}return db[_0x2bc1('0x28')][_0x2bc1('0x42')]({'where':{'id':_0xe6e1af[_0x2bc1('0x3e')]['id']}})[_0x2bc1('0x20')](handleEntityNotFound(_0x2e5e2d,null))[_0x2bc1('0x20')](saveUpdates(_0xe6e1af[_0x2bc1('0x44')],null))[_0x2bc1('0x20')](respondWithResult(_0x2e5e2d,null))[_0x2bc1('0x3c')](handleError(_0x2e5e2d,null));};exports[_0x2bc1('0x21')]=function(_0x32c490,_0x16f9d5){return db[_0x2bc1('0x28')]['find']({'where':{'id':_0x32c490['params']['id']}})['then'](handleEntityNotFound(_0x16f9d5,null))[_0x2bc1('0x20')](removeEntity(_0x16f9d5,null))[_0x2bc1('0x3c')](handleError(_0x16f9d5,null));};exports[_0x2bc1('0x46')]=function(_0x1f1e41,_0x47e5a){return db[_0x2bc1('0x28')][_0x2bc1('0x46')]()[_0x2bc1('0x20')](respondWithResult(_0x47e5a,null))[_0x2bc1('0x3c')](handleError(_0x47e5a,null));}; \ No newline at end of file +var _0x0e88=['json','offset','limit','undefined','count','set','Content-Range','apply','update','then','stack','name','send','index','map','SmsQueueReport','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','params','options','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x0e88,0x151));var _0x80e8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0e88[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x80e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x80e8('0x1'));var jsonpatch=require(_0x80e8('0x2'));var rp=require(_0x80e8('0x3'));var moment=require('moment');var BPromise=require(_0x80e8('0x4'));var Mustache=require(_0x80e8('0x5'));var util=require(_0x80e8('0x6'));var path=require(_0x80e8('0x7'));var sox=require(_0x80e8('0x8'));var csv=require('to-csv');var ejs=require(_0x80e8('0x9'));var fs=require('fs');var fs_extra=require(_0x80e8('0xa'));var _=require('lodash');var squel=require(_0x80e8('0xb'));var crypto=require(_0x80e8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x80e8('0xd'));var toCsv=require(_0x80e8('0xe'));var querystring=require('querystring');var Papa=require(_0x80e8('0xf'));var Redis=require(_0x80e8('0x10'));var authService=require(_0x80e8('0x11'));var qs=require(_0x80e8('0x12'));var as=require(_0x80e8('0x13'));var hardwareService=require(_0x80e8('0x14'));var logger=require(_0x80e8('0x15'))(_0x80e8('0x16'));var utils=require(_0x80e8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x80e8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x336b5e,_0x1ce147){_0x1ce147=_0x1ce147||0xcc;return function(_0x4d760b){if(_0x4d760b){return _0x336b5e[_0x80e8('0x19')](_0x1ce147);}return _0x336b5e[_0x80e8('0x1a')](_0x1ce147)[_0x80e8('0x1b')]();};}function respondWithResult(_0x1930f2,_0x34ac31){_0x34ac31=_0x34ac31||0xc8;return function(_0x3652f9){if(_0x3652f9){return _0x1930f2[_0x80e8('0x1a')](_0x34ac31)[_0x80e8('0x1c')](_0x3652f9);}};}function respondWithFilteredResult(_0x281f67,_0xa72a37){return function(_0x131fa0){if(_0x131fa0){var _0x385710=typeof _0xa72a37[_0x80e8('0x1d')]==='undefined'&&typeof _0xa72a37[_0x80e8('0x1e')]===_0x80e8('0x1f');var _0x5cd034=_0x131fa0[_0x80e8('0x20')];var _0x2f1dfb=_0x385710?0x0:_0xa72a37[_0x80e8('0x1d')];var _0x53e9c4=_0x385710?_0x131fa0['count']:_0xa72a37[_0x80e8('0x1d')]+_0xa72a37['limit'];var _0x591843;if(_0x53e9c4>=_0x5cd034){_0x53e9c4=_0x5cd034;_0x591843=0xc8;}else{_0x591843=0xce;}_0x281f67[_0x80e8('0x1a')](_0x591843);return _0x281f67[_0x80e8('0x21')](_0x80e8('0x22'),_0x2f1dfb+'-'+_0x53e9c4+'/'+_0x5cd034)[_0x80e8('0x1c')](_0x131fa0);}return null;};}function patchUpdates(_0xbfc005){return function(_0x54c771){try{jsonpatch[_0x80e8('0x23')](_0x54c771,_0xbfc005,!![]);}catch(_0x1bf3e8){return BPromise['reject'](_0x1bf3e8);}return _0x54c771['save']();};}function saveUpdates(_0x171ae7,_0x3a44b5){return function(_0x39166b){if(_0x39166b){return _0x39166b[_0x80e8('0x24')](_0x171ae7)[_0x80e8('0x25')](function(_0x456d26){return _0x456d26;});}return null;};}function removeEntity(_0x2cbd5e,_0x5bea60){return function(_0x4c3847){if(_0x4c3847){return _0x4c3847['destroy']()[_0x80e8('0x25')](function(){_0x2cbd5e['status'](0xcc)[_0x80e8('0x1b')]();});}};}function handleEntityNotFound(_0x20bfa3,_0x121e37){return function(_0x5a77e0){if(!_0x5a77e0){_0x20bfa3[_0x80e8('0x19')](0x194);}return _0x5a77e0;};}function handleError(_0x1a446d,_0x1a2110){_0x1a2110=_0x1a2110||0x1f4;return function(_0x3d9978){logger['error'](_0x3d9978[_0x80e8('0x26')]);if(_0x3d9978[_0x80e8('0x27')]){delete _0x3d9978[_0x80e8('0x27')];}_0x1a446d[_0x80e8('0x1a')](_0x1a2110)[_0x80e8('0x28')](_0x3d9978);};}exports[_0x80e8('0x29')]=function(_0x4cf673,_0x1e7ef0){var _0x3baf6c={},_0x4bdaac={},_0x4fff9b={'count':0x0,'rows':[]};var _0x2a7c76=_[_0x80e8('0x2a')](db[_0x80e8('0x2b')][_0x80e8('0x2c')],function(_0x1ddd7c){return{'name':_0x1ddd7c['fieldName'],'type':_0x1ddd7c[_0x80e8('0x2d')][_0x80e8('0x2e')]};});_0x4bdaac[_0x80e8('0x2f')]=_[_0x80e8('0x2a')](_0x2a7c76,_0x80e8('0x27'));_0x4bdaac['query']=_[_0x80e8('0x30')](_0x4cf673['query']);_0x4bdaac[_0x80e8('0x31')]=_[_0x80e8('0x32')](_0x4bdaac[_0x80e8('0x2f')],_0x4bdaac['query']);_0x3baf6c[_0x80e8('0x33')]=_[_0x80e8('0x32')](_0x4bdaac[_0x80e8('0x2f')],qs[_0x80e8('0x34')](_0x4cf673[_0x80e8('0x35')]['fields']));_0x3baf6c[_0x80e8('0x33')]=_0x3baf6c[_0x80e8('0x33')]['length']?_0x3baf6c[_0x80e8('0x33')]:_0x4bdaac[_0x80e8('0x2f')];if(!_0x4cf673[_0x80e8('0x35')][_0x80e8('0x36')](_0x80e8('0x37'))){_0x3baf6c[_0x80e8('0x1e')]=qs['limit'](_0x4cf673[_0x80e8('0x35')][_0x80e8('0x1e')]);_0x3baf6c['offset']=qs[_0x80e8('0x1d')](_0x4cf673[_0x80e8('0x35')][_0x80e8('0x1d')]);}_0x3baf6c[_0x80e8('0x38')]=qs[_0x80e8('0x39')](_0x4cf673['query'][_0x80e8('0x39')]);_0x3baf6c[_0x80e8('0x3a')]=qs[_0x80e8('0x31')](_[_0x80e8('0x3b')](_0x4cf673[_0x80e8('0x35')],_0x4bdaac[_0x80e8('0x31')]),_0x2a7c76);if(_0x4cf673[_0x80e8('0x35')]['filter']){_0x3baf6c[_0x80e8('0x3a')]=_[_0x80e8('0x3c')](_0x3baf6c['where'],{'$or':_[_0x80e8('0x2a')](_0x2a7c76,function(_0x2dcf5a){if(_0x2dcf5a[_0x80e8('0x2d')]!=='VIRTUAL'){var _0x1ddf33={};_0x1ddf33[_0x2dcf5a[_0x80e8('0x27')]]={'$like':'%'+_0x4cf673['query'][_0x80e8('0x3d')]+'%'};return _0x1ddf33;}})});}_0x3baf6c=_[_0x80e8('0x3c')]({},_0x3baf6c,_0x4cf673['options']);var _0x2fddb5={'where':_0x3baf6c[_0x80e8('0x3a')]};return db[_0x80e8('0x2b')][_0x80e8('0x20')](_0x2fddb5)['then'](function(_0x30c2d9){_0x4fff9b[_0x80e8('0x20')]=_0x30c2d9;if(_0x4cf673[_0x80e8('0x35')][_0x80e8('0x3e')]){_0x3baf6c[_0x80e8('0x3f')]=[{'all':!![]}];}return db[_0x80e8('0x2b')][_0x80e8('0x40')](_0x3baf6c);})[_0x80e8('0x25')](function(_0x28decf){_0x4fff9b[_0x80e8('0x41')]=_0x28decf;return _0x4fff9b;})[_0x80e8('0x25')](respondWithFilteredResult(_0x1e7ef0,_0x3baf6c))[_0x80e8('0x42')](handleError(_0x1e7ef0,null));};exports['show']=function(_0x1522ca,_0xe9ca3e){var _0x3c0bb6={'raw':!![],'where':{'id':_0x1522ca[_0x80e8('0x43')]['id']}},_0x284513={};_0x284513[_0x80e8('0x2f')]=_[_0x80e8('0x30')](db[_0x80e8('0x2b')]['rawAttributes']);_0x284513[_0x80e8('0x35')]=_[_0x80e8('0x30')](_0x1522ca[_0x80e8('0x35')]);_0x284513['filters']=_[_0x80e8('0x32')](_0x284513[_0x80e8('0x2f')],_0x284513[_0x80e8('0x35')]);_0x3c0bb6[_0x80e8('0x33')]=_[_0x80e8('0x32')](_0x284513[_0x80e8('0x2f')],qs['fields'](_0x1522ca['query'][_0x80e8('0x34')]));_0x3c0bb6['attributes']=_0x3c0bb6[_0x80e8('0x33')]['length']?_0x3c0bb6['attributes']:_0x284513[_0x80e8('0x2f')];if(_0x1522ca[_0x80e8('0x35')][_0x80e8('0x3e')]){_0x3c0bb6[_0x80e8('0x3f')]=[{'all':!![]}];}_0x3c0bb6=_[_0x80e8('0x3c')]({},_0x3c0bb6,_0x1522ca[_0x80e8('0x44')]);return db[_0x80e8('0x2b')]['find'](_0x3c0bb6)[_0x80e8('0x25')](handleEntityNotFound(_0xe9ca3e,null))['then'](respondWithResult(_0xe9ca3e,null))[_0x80e8('0x42')](handleError(_0xe9ca3e,null));};exports[_0x80e8('0x45')]=function(_0x4c32b3,_0x415c77){return db['SmsQueueReport']['create'](_0x4c32b3[_0x80e8('0x46')],{})[_0x80e8('0x25')](respondWithResult(_0x415c77,0xc9))['catch'](handleError(_0x415c77,null));};exports[_0x80e8('0x24')]=function(_0x25ee23,_0x3c7876){if(_0x25ee23['body']['id']){delete _0x25ee23[_0x80e8('0x46')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x25ee23[_0x80e8('0x43')]['id']}})[_0x80e8('0x25')](handleEntityNotFound(_0x3c7876,null))[_0x80e8('0x25')](saveUpdates(_0x25ee23[_0x80e8('0x46')],null))['then'](respondWithResult(_0x3c7876,null))[_0x80e8('0x42')](handleError(_0x3c7876,null));};exports[_0x80e8('0x47')]=function(_0xe74b36,_0x4f5e9c){return db[_0x80e8('0x2b')]['find']({'where':{'id':_0xe74b36['params']['id']}})[_0x80e8('0x25')](handleEntityNotFound(_0x4f5e9c,null))['then'](removeEntity(_0x4f5e9c,null))[_0x80e8('0x42')](handleError(_0x4f5e9c,null));};exports[_0x80e8('0x48')]=function(_0x2aa849,_0x3d0602){return db['SmsQueueReport'][_0x80e8('0x48')]()['then'](respondWithResult(_0x3d0602,null))[_0x80e8('0x42')](handleError(_0x3d0602,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 58fc9d1..22a8260 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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1af3ce,_0x46b05e){var _0x59559e=function(_0x51d930){while(--_0x51d930){_0x1af3ce['push'](_0x1af3ce['shift']());}};_0x59559e(++_0x46b05e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x136a26,_0x4839e1){var _0x5e6f33=function(_0x5c089b){while(--_0x5c089b){_0x136a26['push'](_0x136a26['shift']());}};_0x5e6f33(++_0x4839e1);}(_0x70e0,0x17b));var _0x070e=function(_0x14bc9c,_0x5ac577){_0x14bc9c=_0x14bc9c-0x0;var _0x1253cd=_0x70e0[_0x14bc9c];return _0x1253cd;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 42adbb7..74d9cca 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 _0xa305=['then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','update','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x27e6e7,_0x42813e){var _0x5d4802=function(_0x130c25){while(--_0x130c25){_0x27e6e7['push'](_0x27e6e7['shift']());}};_0x5d4802(++_0x42813e);}(_0xa305,0x78));var _0x5a30=function(_0x5b2656,_0x30219c){_0x5b2656=_0x5b2656-0x0;var _0x5b92a2=_0xa305[_0x5b2656];return _0x5b92a2;};'use strict';var _=require(_0x5a30('0x0'));var util=require(_0x5a30('0x1'));var moment=require(_0x5a30('0x2'));var BPromise=require(_0x5a30('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a30('0x4'));var db=require(_0x5a30('0x5'))['db'];var utils=require(_0x5a30('0x6'));var logger=require(_0x5a30('0x7'))(_0x5a30('0x8'));var config=require(_0x5a30('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5a30('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50c25d,_0x2336f3,_0x1c73d5){return new BPromise(function(_0x23e6e9,_0x5ccf70){return client[_0x5a30('0xb')](_0x50c25d,_0x1c73d5)[_0x5a30('0xc')](function(_0x25eefb){logger[_0x5a30('0xd')](_0x5a30('0xe'),_0x2336f3,'request\x20sent');logger[_0x5a30('0xf')](_0x5a30('0x10'),_0x2336f3,_0x5a30('0x11'),JSON[_0x5a30('0x12')](_0x25eefb));if(_0x25eefb[_0x5a30('0x13')]){if(_0x25eefb[_0x5a30('0x13')]['code']===0x1f4){logger[_0x5a30('0x13')](_0x5a30('0xe'),_0x2336f3,_0x25eefb['error']['message']);return _0x5ccf70(_0x25eefb[_0x5a30('0x13')][_0x5a30('0x14')]);}logger[_0x5a30('0x13')](_0x5a30('0xe'),_0x2336f3,_0x25eefb[_0x5a30('0x13')][_0x5a30('0x14')]);return _0x23e6e9(_0x25eefb[_0x5a30('0x13')][_0x5a30('0x14')]);}else{logger[_0x5a30('0xd')](_0x5a30('0xe'),_0x2336f3,'request\x20sent');_0x23e6e9(_0x25eefb[_0x5a30('0x15')]['message']);}})[_0x5a30('0x16')](function(_0x137265){logger[_0x5a30('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x2336f3,_0x137265);_0x5ccf70(_0x137265);});});}exports['CreateSmsQueueReport']=function(_0x219374){var _0x2cd5b4=this;return new Promise(function(_0x312ee6,_0x11be26){return db[_0x5a30('0x17')][_0x5a30('0x18')](_0x219374[_0x5a30('0x19')],{'raw':_0x219374[_0x5a30('0x1a')]?_0x219374['options'][_0x5a30('0x1b')]===undefined?!![]:![]:!![]})[_0x5a30('0xc')](function(_0x39b4ef){logger['info']('CreateSmsQueueReport',_0x219374);logger[_0x5a30('0xf')](_0x5a30('0x1c'),_0x219374,JSON[_0x5a30('0x12')](_0x39b4ef));_0x312ee6(_0x39b4ef);})[_0x5a30('0x16')](function(_0x343966){logger[_0x5a30('0x13')]('CreateSmsQueueReport',_0x343966['message'],_0x219374);_0x11be26(_0x2cd5b4[_0x5a30('0x13')](0x1f4,_0x343966[_0x5a30('0x14')]));});});};exports[_0x5a30('0x1d')]=function(_0x13f8d6){var _0x5302ef=this;return new Promise(function(_0x4cabcf,_0x498e73){return db[_0x5a30('0x17')][_0x5a30('0x1e')](_0x13f8d6[_0x5a30('0x19')],{'raw':_0x13f8d6['options']?_0x13f8d6[_0x5a30('0x1a')][_0x5a30('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13f8d6[_0x5a30('0x1a')]?_0x13f8d6[_0x5a30('0x1a')][_0x5a30('0x1f')]||null:null,'attributes':_0x13f8d6[_0x5a30('0x1a')]?_0x13f8d6[_0x5a30('0x1a')]['attributes']||null:null,'limit':_0x13f8d6[_0x5a30('0x1a')]?_0x13f8d6[_0x5a30('0x1a')][_0x5a30('0x20')]||null:null})['then'](function(_0x57bb56){logger[_0x5a30('0xd')]('UpdateSmsQueueReport',_0x13f8d6);logger[_0x5a30('0xf')](_0x5a30('0x1d'),_0x13f8d6,JSON[_0x5a30('0x12')](_0x57bb56));_0x4cabcf(_0x57bb56);})['catch'](function(_0xf447f7){logger[_0x5a30('0x13')](_0x5a30('0x1d'),_0xf447f7[_0x5a30('0x14')],_0x13f8d6);_0x498e73(_0x5302ef[_0x5a30('0x13')](0x1f4,_0xf447f7[_0x5a30('0x14')]));});});}; \ No newline at end of file +var _0x70a2=['raw','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','then','stringify','UpdateSmsQueueReport','update'];(function(_0x4f0848,_0x5b1079){var _0x45f6c0=function(_0x150e3e){while(--_0x150e3e){_0x4f0848['push'](_0x4f0848['shift']());}};_0x45f6c0(++_0x5b1079);}(_0x70a2,0x8f));var _0x270a=function(_0x10c6ef,_0x5534fe){_0x10c6ef=_0x10c6ef-0x0;var _0x160322=_0x70a2[_0x10c6ef];return _0x160322;};'use strict';var _=require(_0x270a('0x0'));var util=require(_0x270a('0x1'));var moment=require(_0x270a('0x2'));var BPromise=require(_0x270a('0x3'));var rs=require(_0x270a('0x4'));var fs=require('fs');var Redis=require(_0x270a('0x5'));var db=require(_0x270a('0x6'))['db'];var utils=require(_0x270a('0x7'));var logger=require(_0x270a('0x8'))(_0x270a('0x9'));var config=require(_0x270a('0xa'));var jayson=require(_0x270a('0xb'));var client=jayson[_0x270a('0xc')][_0x270a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1d8f85,_0x441f0d,_0xae2bb){return new BPromise(function(_0xf9dbdf,_0x1b8396){return client[_0x270a('0xe')](_0x1d8f85,_0xae2bb)['then'](function(_0x409066){logger[_0x270a('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x441f0d,_0x270a('0x10'));logger[_0x270a('0x11')](_0x270a('0x12'),_0x441f0d,_0x270a('0x10'),JSON['stringify'](_0x409066));if(_0x409066['error']){if(_0x409066[_0x270a('0x13')]['code']===0x1f4){logger[_0x270a('0x13')](_0x270a('0x14'),_0x441f0d,_0x409066[_0x270a('0x13')][_0x270a('0x15')]);return _0x1b8396(_0x409066['error'][_0x270a('0x15')]);}logger[_0x270a('0x13')](_0x270a('0x14'),_0x441f0d,_0x409066[_0x270a('0x13')]['message']);return _0xf9dbdf(_0x409066[_0x270a('0x13')][_0x270a('0x15')]);}else{logger[_0x270a('0xf')](_0x270a('0x14'),_0x441f0d,_0x270a('0x10'));_0xf9dbdf(_0x409066[_0x270a('0x16')][_0x270a('0x15')]);}})[_0x270a('0x17')](function(_0x971d8b){logger[_0x270a('0x13')](_0x270a('0x14'),_0x441f0d,_0x971d8b);_0x1b8396(_0x971d8b);});});}exports[_0x270a('0x18')]=function(_0x559224){var _0x12f916=this;return new Promise(function(_0x40a459,_0x43422f){return db[_0x270a('0x19')]['create'](_0x559224[_0x270a('0x1a')],{'raw':_0x559224[_0x270a('0x1b')]?_0x559224[_0x270a('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x270a('0x1c')](function(_0x59daa5){logger[_0x270a('0xf')](_0x270a('0x18'),_0x559224);logger[_0x270a('0x11')](_0x270a('0x18'),_0x559224,JSON[_0x270a('0x1d')](_0x59daa5));_0x40a459(_0x59daa5);})['catch'](function(_0x3d9144){logger[_0x270a('0x13')]('CreateSmsQueueReport',_0x3d9144[_0x270a('0x15')],_0x559224);_0x43422f(_0x12f916[_0x270a('0x13')](0x1f4,_0x3d9144[_0x270a('0x15')]));});});};exports[_0x270a('0x1e')]=function(_0x7b85eb){var _0x273605=this;return new Promise(function(_0x3cd03f,_0x3d09e3){return db[_0x270a('0x19')][_0x270a('0x1f')](_0x7b85eb[_0x270a('0x1a')],{'raw':_0x7b85eb[_0x270a('0x1b')]?_0x7b85eb[_0x270a('0x1b')][_0x270a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7b85eb[_0x270a('0x1b')]?_0x7b85eb['options']['where']||null:null,'attributes':_0x7b85eb[_0x270a('0x1b')]?_0x7b85eb[_0x270a('0x1b')][_0x270a('0x21')]||null:null,'limit':_0x7b85eb[_0x270a('0x1b')]?_0x7b85eb[_0x270a('0x1b')][_0x270a('0x22')]||null:null})[_0x270a('0x1c')](function(_0x2d1a21){logger[_0x270a('0xf')](_0x270a('0x1e'),_0x7b85eb);logger['debug']('UpdateSmsQueueReport',_0x7b85eb,JSON[_0x270a('0x1d')](_0x2d1a21));_0x3cd03f(_0x2d1a21);})[_0x270a('0x17')](function(_0x592105){logger[_0x270a('0x13')](_0x270a('0x1e'),_0x592105[_0x270a('0x15')],_0x7b85eb);_0x3d09e3(_0x273605['error'](0x1f4,_0x592105['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index a759f8b..7a98ff7 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 _0x7dfd=['isAuthenticated','index','/describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get'];(function(_0x468ee9,_0x26b16d){var _0x14ae87=function(_0x3fdb45){while(--_0x3fdb45){_0x468ee9['push'](_0x468ee9['shift']());}};_0x14ae87(++_0x26b16d);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0xd')]);router[_0xd7df('0xb')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller['describe']);router[_0xd7df('0xb')](_0xd7df('0xf'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x10')]);router['post']('/',auth[_0xd7df('0xc')](),controller['create']);router[_0xd7df('0x11')]('/:id',auth[_0xd7df('0xc')](),controller[_0xd7df('0x12')]);router[_0xd7df('0x13')](_0xd7df('0xf'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x14')]);module[_0xd7df('0x15')]=router; \ No newline at end of file +var _0xe107=['/describe','isAuthenticated','describe','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./smsTransferReport.controller','get'];(function(_0x3e7375,_0x213aab){var _0x37f281=function(_0x5a8d94){while(--_0x5a8d94){_0x3e7375['push'](_0x3e7375['shift']());}};_0x37f281(++_0x213aab);}(_0xe107,0xb3));var _0x7e10=function(_0x319a4e,_0x2ab748){_0x319a4e=_0x319a4e-0x0;var _0x22a4cb=_0xe107[_0x319a4e];return _0x22a4cb;};'use strict';var multer=require(_0x7e10('0x0'));var util=require('util');var path=require(_0x7e10('0x1'));var timeout=require(_0x7e10('0x2'));var express=require(_0x7e10('0x3'));var router=express['Router']();var fs_extra=require(_0x7e10('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7e10('0x5'));var controller=require(_0x7e10('0x6'));router[_0x7e10('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7e10('0x7')](_0x7e10('0x8'),auth[_0x7e10('0x9')](),controller[_0x7e10('0xa')]);router['get']('/:id',auth[_0x7e10('0x9')](),controller['show']);router['post']('/',auth[_0x7e10('0x9')](),controller[_0x7e10('0xb')]);router[_0x7e10('0xc')](_0x7e10('0xd'),auth[_0x7e10('0x9')](),controller['update']);router[_0x7e10('0xe')]('/:id',auth[_0x7e10('0x9')](),controller[_0x7e10('0xf')]);module[_0x7e10('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 5bc853f..17b085b 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4a9748,_0x31ff88){_0x4a9748=_0x4a9748-0x0;var _0x1860bb=_0x9bde[_0x4a9748];return _0x1860bb;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x3ea022,_0x2d5328){var _0x3b97a2=function(_0x351179){while(--_0x351179){_0x3ea022['push'](_0x3ea022['shift']());}};_0x3b97a2(++_0x2d5328);}(_0x54ef,0x112));var _0xf54e=function(_0x1f1c41,_0x60ea59){_0x1f1c41=_0x1f1c41-0x0;var _0x218bfd=_0x54ef[_0x1f1c41];return _0x218bfd;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 693407b..cbb4745 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 _0xd8ee=['apply','reject','save','update','then','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd8ee,0x1b6));var _0xed8e=function(_0xe18133,_0xb60669){_0xe18133=_0xe18133-0x0;var _0x2a136a=_0xd8ee[_0xe18133];return _0x2a136a;};'use strict';var emlformat=require(_0xed8e('0x0'));var rimraf=require(_0xed8e('0x1'));var zipdir=require(_0xed8e('0x2'));var jsonpatch=require(_0xed8e('0x3'));var rp=require('request-promise');var moment=require(_0xed8e('0x4'));var BPromise=require(_0xed8e('0x5'));var Mustache=require(_0xed8e('0x6'));var util=require('util');var path=require(_0xed8e('0x7'));var sox=require(_0xed8e('0x8'));var csv=require(_0xed8e('0x9'));var ejs=require(_0xed8e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed8e('0xb'));var crypto=require('crypto');var jsforce=require(_0xed8e('0xc'));var deskjs=require(_0xed8e('0xd'));var toCsv=require(_0xed8e('0x9'));var querystring=require(_0xed8e('0xe'));var Papa=require(_0xed8e('0xf'));var Redis=require(_0xed8e('0x10'));var authService=require(_0xed8e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xed8e('0x12'));var hardwareService=require(_0xed8e('0x13'));var logger=require(_0xed8e('0x14'))(_0xed8e('0x15'));var utils=require(_0xed8e('0x16'));var config=require(_0xed8e('0x17'));var licenseUtil=require(_0xed8e('0x18'));var db=require(_0xed8e('0x19'))['db'];function respondWithStatusCode(_0x364db4,_0x4f1841){_0x4f1841=_0x4f1841||0xcc;return function(_0x264d84){if(_0x264d84){return _0x364db4[_0xed8e('0x1a')](_0x4f1841);}return _0x364db4[_0xed8e('0x1b')](_0x4f1841)[_0xed8e('0x1c')]();};}function respondWithResult(_0x5d2432,_0xf92b45){_0xf92b45=_0xf92b45||0xc8;return function(_0x5067f6){if(_0x5067f6){return _0x5d2432[_0xed8e('0x1b')](_0xf92b45)[_0xed8e('0x1d')](_0x5067f6);}};}function respondWithFilteredResult(_0x5a92e0,_0x29417e){return function(_0x1f1e36){if(_0x1f1e36){var _0x53c80c=typeof _0x29417e[_0xed8e('0x1e')]===_0xed8e('0x1f')&&typeof _0x29417e[_0xed8e('0x20')]===_0xed8e('0x1f');var _0x82c459=_0x1f1e36[_0xed8e('0x21')];var _0x379d0a=_0x53c80c?0x0:_0x29417e['offset'];var _0x6bdcde=_0x53c80c?_0x1f1e36[_0xed8e('0x21')]:_0x29417e[_0xed8e('0x1e')]+_0x29417e[_0xed8e('0x20')];var _0x2763d8;if(_0x6bdcde>=_0x82c459){_0x6bdcde=_0x82c459;_0x2763d8=0xc8;}else{_0x2763d8=0xce;}_0x5a92e0[_0xed8e('0x1b')](_0x2763d8);return _0x5a92e0[_0xed8e('0x22')](_0xed8e('0x23'),_0x379d0a+'-'+_0x6bdcde+'/'+_0x82c459)[_0xed8e('0x1d')](_0x1f1e36);}return null;};}function patchUpdates(_0x16fc75){return function(_0x3ee967){try{jsonpatch[_0xed8e('0x24')](_0x3ee967,_0x16fc75,!![]);}catch(_0x55d70a){return BPromise[_0xed8e('0x25')](_0x55d70a);}return _0x3ee967[_0xed8e('0x26')]();};}function saveUpdates(_0x40f268,_0x70a343){return function(_0x343fc3){if(_0x343fc3){return _0x343fc3[_0xed8e('0x27')](_0x40f268)[_0xed8e('0x28')](function(_0x5c71c5){return _0x5c71c5;});}return null;};}function removeEntity(_0x53c779,_0x243602){return function(_0x12a111){if(_0x12a111){return _0x12a111['destroy']()[_0xed8e('0x28')](function(){_0x53c779[_0xed8e('0x1b')](0xcc)[_0xed8e('0x1c')]();});}};}function handleEntityNotFound(_0x270ebb,_0x58ab68){return function(_0x431bc1){if(!_0x431bc1){_0x270ebb[_0xed8e('0x1a')](0x194);}return _0x431bc1;};}function handleError(_0x54e84a,_0x2f2eec){_0x2f2eec=_0x2f2eec||0x1f4;return function(_0x39aae2){logger[_0xed8e('0x29')](_0x39aae2[_0xed8e('0x2a')]);if(_0x39aae2[_0xed8e('0x2b')]){delete _0x39aae2[_0xed8e('0x2b')];}_0x54e84a['status'](_0x2f2eec)[_0xed8e('0x2c')](_0x39aae2);};}exports[_0xed8e('0x2d')]=function(_0x4d08dc,_0x131b3e){var _0x233354={},_0x43809a={},_0x2d2ba2={'count':0x0,'rows':[]};var _0x479b39=_[_0xed8e('0x2e')](db[_0xed8e('0x2f')][_0xed8e('0x30')],function(_0x254a64){return{'name':_0x254a64[_0xed8e('0x31')],'type':_0x254a64[_0xed8e('0x32')][_0xed8e('0x33')]};});_0x43809a['model']=_[_0xed8e('0x2e')](_0x479b39,_0xed8e('0x2b'));_0x43809a['query']=_[_0xed8e('0x34')](_0x4d08dc[_0xed8e('0x35')]);_0x43809a[_0xed8e('0x36')]=_['intersection'](_0x43809a[_0xed8e('0x37')],_0x43809a[_0xed8e('0x35')]);_0x233354[_0xed8e('0x38')]=_[_0xed8e('0x39')](_0x43809a[_0xed8e('0x37')],qs['fields'](_0x4d08dc['query'][_0xed8e('0x3a')]));_0x233354[_0xed8e('0x38')]=_0x233354[_0xed8e('0x38')][_0xed8e('0x3b')]?_0x233354[_0xed8e('0x38')]:_0x43809a[_0xed8e('0x37')];if(!_0x4d08dc[_0xed8e('0x35')]['hasOwnProperty']('nolimit')){_0x233354[_0xed8e('0x20')]=qs[_0xed8e('0x20')](_0x4d08dc['query']['limit']);_0x233354[_0xed8e('0x1e')]=qs[_0xed8e('0x1e')](_0x4d08dc['query'][_0xed8e('0x1e')]);}_0x233354[_0xed8e('0x3c')]=qs['sort'](_0x4d08dc[_0xed8e('0x35')][_0xed8e('0x3d')]);_0x233354[_0xed8e('0x3e')]=qs['filters'](_[_0xed8e('0x3f')](_0x4d08dc['query'],_0x43809a['filters']),_0x479b39);if(_0x4d08dc[_0xed8e('0x35')][_0xed8e('0x40')]){_0x233354['where']=_[_0xed8e('0x41')](_0x233354[_0xed8e('0x3e')],{'$or':_[_0xed8e('0x2e')](_0x479b39,function(_0x23ffd1){if(_0x23ffd1['type']!==_0xed8e('0x42')){var _0x56ae9d={};_0x56ae9d[_0x23ffd1[_0xed8e('0x2b')]]={'$like':'%'+_0x4d08dc[_0xed8e('0x35')][_0xed8e('0x40')]+'%'};return _0x56ae9d;}})});}_0x233354=_[_0xed8e('0x41')]({},_0x233354,_0x4d08dc[_0xed8e('0x43')]);var _0x260d8b={'where':_0x233354[_0xed8e('0x3e')]};return db[_0xed8e('0x2f')]['count'](_0x260d8b)[_0xed8e('0x28')](function(_0x47c994){_0x2d2ba2[_0xed8e('0x21')]=_0x47c994;if(_0x4d08dc[_0xed8e('0x35')][_0xed8e('0x44')]){_0x233354[_0xed8e('0x45')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xed8e('0x46')](_0x233354);})[_0xed8e('0x28')](function(_0x33b946){_0x2d2ba2[_0xed8e('0x47')]=_0x33b946;return _0x2d2ba2;})[_0xed8e('0x28')](respondWithFilteredResult(_0x131b3e,_0x233354))['catch'](handleError(_0x131b3e,null));};exports[_0xed8e('0x48')]=function(_0x280e07,_0x15579f){var _0xecd7b5={'raw':!![],'where':{'id':_0x280e07[_0xed8e('0x49')]['id']}},_0x267f51={};_0x267f51[_0xed8e('0x37')]=_['keys'](db[_0xed8e('0x2f')][_0xed8e('0x30')]);_0x267f51[_0xed8e('0x35')]=_[_0xed8e('0x34')](_0x280e07['query']);_0x267f51[_0xed8e('0x36')]=_['intersection'](_0x267f51[_0xed8e('0x37')],_0x267f51[_0xed8e('0x35')]);_0xecd7b5[_0xed8e('0x38')]=_[_0xed8e('0x39')](_0x267f51[_0xed8e('0x37')],qs[_0xed8e('0x3a')](_0x280e07['query'][_0xed8e('0x3a')]));_0xecd7b5['attributes']=_0xecd7b5['attributes'][_0xed8e('0x3b')]?_0xecd7b5[_0xed8e('0x38')]:_0x267f51['model'];if(_0x280e07[_0xed8e('0x35')][_0xed8e('0x44')]){_0xecd7b5[_0xed8e('0x45')]=[{'all':!![]}];}_0xecd7b5=_[_0xed8e('0x41')]({},_0xecd7b5,_0x280e07[_0xed8e('0x43')]);return db[_0xed8e('0x2f')][_0xed8e('0x4a')](_0xecd7b5)[_0xed8e('0x28')](handleEntityNotFound(_0x15579f,null))[_0xed8e('0x28')](respondWithResult(_0x15579f,null))[_0xed8e('0x4b')](handleError(_0x15579f,null));};exports['create']=function(_0xb1cb0e,_0x9de12c){return db['SmsTransferReport'][_0xed8e('0x4c')](_0xb1cb0e[_0xed8e('0x4d')],{})[_0xed8e('0x28')](respondWithResult(_0x9de12c,0xc9))['catch'](handleError(_0x9de12c,null));};exports['update']=function(_0x5714e7,_0x292fcf){if(_0x5714e7[_0xed8e('0x4d')]['id']){delete _0x5714e7[_0xed8e('0x4d')]['id'];}return db['SmsTransferReport'][_0xed8e('0x4a')]({'where':{'id':_0x5714e7['params']['id']}})[_0xed8e('0x28')](handleEntityNotFound(_0x292fcf,null))[_0xed8e('0x28')](saveUpdates(_0x5714e7[_0xed8e('0x4d')],null))[_0xed8e('0x28')](respondWithResult(_0x292fcf,null))[_0xed8e('0x4b')](handleError(_0x292fcf,null));};exports[_0xed8e('0x4e')]=function(_0x510cab,_0x12d8c2){return db['SmsTransferReport'][_0xed8e('0x4a')]({'where':{'id':_0x510cab['params']['id']}})[_0xed8e('0x28')](handleEntityNotFound(_0x12d8c2,null))[_0xed8e('0x28')](removeEntity(_0x12d8c2,null))[_0xed8e('0x4b')](handleError(_0x12d8c2,null));};exports['describe']=function(_0x3ea194,_0x11a59e){return db[_0xed8e('0x2f')]['describe']()[_0xed8e('0x28')](respondWithResult(_0x11a59e,null))[_0xed8e('0x4b')](handleError(_0x11a59e,null));}; \ No newline at end of file +var _0x08f1=['intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','filters'];(function(_0x403570,_0x126a83){var _0x4664ff=function(_0x4babfb){while(--_0x4babfb){_0x403570['push'](_0x403570['shift']());}};_0x4664ff(++_0x126a83);}(_0x08f1,0x1d1));var _0x108f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x08f1[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x108f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x108f('0x1'));var rp=require(_0x108f('0x2'));var moment=require(_0x108f('0x3'));var BPromise=require(_0x108f('0x4'));var Mustache=require(_0x108f('0x5'));var util=require(_0x108f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x108f('0x7'));var ejs=require(_0x108f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x108f('0x9'));var squel=require('squel');var crypto=require(_0x108f('0xa'));var jsforce=require(_0x108f('0xb'));var deskjs=require(_0x108f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x108f('0xd'));var Papa=require(_0x108f('0xe'));var Redis=require(_0x108f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x108f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x108f('0x11'));var logger=require(_0x108f('0x12'))(_0x108f('0x13'));var utils=require(_0x108f('0x14'));var config=require(_0x108f('0x15'));var licenseUtil=require(_0x108f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fb226,_0x1e7e98){_0x1e7e98=_0x1e7e98||0xcc;return function(_0x299cb5){if(_0x299cb5){return _0x1fb226[_0x108f('0x17')](_0x1e7e98);}return _0x1fb226[_0x108f('0x18')](_0x1e7e98)[_0x108f('0x19')]();};}function respondWithResult(_0x3d2b16,_0x4e4496){_0x4e4496=_0x4e4496||0xc8;return function(_0x1ba27f){if(_0x1ba27f){return _0x3d2b16[_0x108f('0x18')](_0x4e4496)['json'](_0x1ba27f);}};}function respondWithFilteredResult(_0x38023b,_0x43bcaa){return function(_0x21374d){if(_0x21374d){var _0x3cc80b=typeof _0x43bcaa[_0x108f('0x1a')]==='undefined'&&typeof _0x43bcaa['limit']===_0x108f('0x1b');var _0x1cf933=_0x21374d[_0x108f('0x1c')];var _0xfc4c80=_0x3cc80b?0x0:_0x43bcaa[_0x108f('0x1a')];var _0x1ae6d6=_0x3cc80b?_0x21374d[_0x108f('0x1c')]:_0x43bcaa[_0x108f('0x1a')]+_0x43bcaa[_0x108f('0x1d')];var _0x56ff74;if(_0x1ae6d6>=_0x1cf933){_0x1ae6d6=_0x1cf933;_0x56ff74=0xc8;}else{_0x56ff74=0xce;}_0x38023b['status'](_0x56ff74);return _0x38023b['set']('Content-Range',_0xfc4c80+'-'+_0x1ae6d6+'/'+_0x1cf933)['json'](_0x21374d);}return null;};}function patchUpdates(_0x28b6a7){return function(_0x5b9292){try{jsonpatch['apply'](_0x5b9292,_0x28b6a7,!![]);}catch(_0x5b4a1c){return BPromise[_0x108f('0x1e')](_0x5b4a1c);}return _0x5b9292[_0x108f('0x1f')]();};}function saveUpdates(_0x2d3c3a,_0x49f1ac){return function(_0x566b2b){if(_0x566b2b){return _0x566b2b[_0x108f('0x20')](_0x2d3c3a)[_0x108f('0x21')](function(_0x58345f){return _0x58345f;});}return null;};}function removeEntity(_0x46b526,_0x46e519){return function(_0x15a86f){if(_0x15a86f){return _0x15a86f[_0x108f('0x22')]()[_0x108f('0x21')](function(){_0x46b526[_0x108f('0x18')](0xcc)[_0x108f('0x19')]();});}};}function handleEntityNotFound(_0x4cf793,_0x474b04){return function(_0x3c5505){if(!_0x3c5505){_0x4cf793['sendStatus'](0x194);}return _0x3c5505;};}function handleError(_0x2c8089,_0x11f0c7){_0x11f0c7=_0x11f0c7||0x1f4;return function(_0x5b9e98){logger[_0x108f('0x23')](_0x5b9e98[_0x108f('0x24')]);if(_0x5b9e98['name']){delete _0x5b9e98[_0x108f('0x25')];}_0x2c8089[_0x108f('0x18')](_0x11f0c7)[_0x108f('0x26')](_0x5b9e98);};}exports[_0x108f('0x27')]=function(_0x484e40,_0x2186ea){var _0x1eed93={},_0x3046f2={},_0x1d7006={'count':0x0,'rows':[]};var _0x5afa75=_[_0x108f('0x28')](db[_0x108f('0x29')][_0x108f('0x2a')],function(_0x266f4b){return{'name':_0x266f4b[_0x108f('0x2b')],'type':_0x266f4b[_0x108f('0x2c')]['key']};});_0x3046f2['model']=_[_0x108f('0x28')](_0x5afa75,_0x108f('0x25'));_0x3046f2['query']=_['keys'](_0x484e40['query']);_0x3046f2[_0x108f('0x2d')]=_[_0x108f('0x2e')](_0x3046f2[_0x108f('0x2f')],_0x3046f2[_0x108f('0x30')]);_0x1eed93[_0x108f('0x31')]=_[_0x108f('0x2e')](_0x3046f2[_0x108f('0x2f')],qs[_0x108f('0x32')](_0x484e40[_0x108f('0x30')][_0x108f('0x32')]));_0x1eed93['attributes']=_0x1eed93[_0x108f('0x31')]['length']?_0x1eed93[_0x108f('0x31')]:_0x3046f2['model'];if(!_0x484e40['query'][_0x108f('0x33')](_0x108f('0x34'))){_0x1eed93[_0x108f('0x1d')]=qs[_0x108f('0x1d')](_0x484e40['query'][_0x108f('0x1d')]);_0x1eed93['offset']=qs[_0x108f('0x1a')](_0x484e40[_0x108f('0x30')][_0x108f('0x1a')]);}_0x1eed93[_0x108f('0x35')]=qs[_0x108f('0x36')](_0x484e40['query'][_0x108f('0x36')]);_0x1eed93[_0x108f('0x37')]=qs[_0x108f('0x2d')](_[_0x108f('0x38')](_0x484e40[_0x108f('0x30')],_0x3046f2[_0x108f('0x2d')]),_0x5afa75);if(_0x484e40['query'][_0x108f('0x39')]){_0x1eed93[_0x108f('0x37')]=_[_0x108f('0x3a')](_0x1eed93[_0x108f('0x37')],{'$or':_['map'](_0x5afa75,function(_0x24d6e6){if(_0x24d6e6[_0x108f('0x2c')]!==_0x108f('0x3b')){var _0x1e8d7c={};_0x1e8d7c[_0x24d6e6[_0x108f('0x25')]]={'$like':'%'+_0x484e40[_0x108f('0x30')][_0x108f('0x39')]+'%'};return _0x1e8d7c;}})});}_0x1eed93=_['merge']({},_0x1eed93,_0x484e40[_0x108f('0x3c')]);var _0x1a4b9={'where':_0x1eed93[_0x108f('0x37')]};return db[_0x108f('0x29')][_0x108f('0x1c')](_0x1a4b9)[_0x108f('0x21')](function(_0x47dca0){_0x1d7006[_0x108f('0x1c')]=_0x47dca0;if(_0x484e40[_0x108f('0x30')][_0x108f('0x3d')]){_0x1eed93[_0x108f('0x3e')]=[{'all':!![]}];}return db[_0x108f('0x29')]['findAll'](_0x1eed93);})[_0x108f('0x21')](function(_0x56eb7e){_0x1d7006[_0x108f('0x3f')]=_0x56eb7e;return _0x1d7006;})['then'](respondWithFilteredResult(_0x2186ea,_0x1eed93))[_0x108f('0x40')](handleError(_0x2186ea,null));};exports[_0x108f('0x41')]=function(_0xffb66f,_0x15421f){var _0xda6d23={'raw':!![],'where':{'id':_0xffb66f[_0x108f('0x42')]['id']}},_0x52c3b3={};_0x52c3b3[_0x108f('0x2f')]=_[_0x108f('0x43')](db[_0x108f('0x29')][_0x108f('0x2a')]);_0x52c3b3[_0x108f('0x30')]=_[_0x108f('0x43')](_0xffb66f['query']);_0x52c3b3[_0x108f('0x2d')]=_[_0x108f('0x2e')](_0x52c3b3[_0x108f('0x2f')],_0x52c3b3[_0x108f('0x30')]);_0xda6d23[_0x108f('0x31')]=_[_0x108f('0x2e')](_0x52c3b3[_0x108f('0x2f')],qs[_0x108f('0x32')](_0xffb66f[_0x108f('0x30')][_0x108f('0x32')]));_0xda6d23[_0x108f('0x31')]=_0xda6d23[_0x108f('0x31')][_0x108f('0x44')]?_0xda6d23[_0x108f('0x31')]:_0x52c3b3[_0x108f('0x2f')];if(_0xffb66f['query'][_0x108f('0x3d')]){_0xda6d23[_0x108f('0x3e')]=[{'all':!![]}];}_0xda6d23=_[_0x108f('0x3a')]({},_0xda6d23,_0xffb66f[_0x108f('0x3c')]);return db[_0x108f('0x29')][_0x108f('0x45')](_0xda6d23)[_0x108f('0x21')](handleEntityNotFound(_0x15421f,null))[_0x108f('0x21')](respondWithResult(_0x15421f,null))[_0x108f('0x40')](handleError(_0x15421f,null));};exports[_0x108f('0x46')]=function(_0x4d43c3,_0x53d372){return db['SmsTransferReport']['create'](_0x4d43c3[_0x108f('0x47')],{})[_0x108f('0x21')](respondWithResult(_0x53d372,0xc9))['catch'](handleError(_0x53d372,null));};exports[_0x108f('0x20')]=function(_0x51e12a,_0x8bdab0){if(_0x51e12a[_0x108f('0x47')]['id']){delete _0x51e12a[_0x108f('0x47')]['id'];}return db[_0x108f('0x29')][_0x108f('0x45')]({'where':{'id':_0x51e12a[_0x108f('0x42')]['id']}})['then'](handleEntityNotFound(_0x8bdab0,null))[_0x108f('0x21')](saveUpdates(_0x51e12a[_0x108f('0x47')],null))['then'](respondWithResult(_0x8bdab0,null))[_0x108f('0x40')](handleError(_0x8bdab0,null));};exports[_0x108f('0x22')]=function(_0x33ce0a,_0x2f0225){return db[_0x108f('0x29')][_0x108f('0x45')]({'where':{'id':_0x33ce0a[_0x108f('0x42')]['id']}})[_0x108f('0x21')](handleEntityNotFound(_0x2f0225,null))['then'](removeEntity(_0x2f0225,null))[_0x108f('0x40')](handleError(_0x2f0225,null));};exports[_0x108f('0x48')]=function(_0x19a4e2,_0x51d929){return db[_0x108f('0x29')]['describe']()[_0x108f('0x21')](respondWithResult(_0x51d929,null))['catch'](handleError(_0x51d929,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 8fe3cbd..c5e3af8 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 _0xcb26=['define','uniqueid','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0xcb26,0x14c));var _0x6cb2=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xcb26[_0x3070dc];return _0x431489;};'use strict';var _=require('lodash');var util=require(_0x6cb2('0x0'));var logger=require(_0x6cb2('0x1'))(_0x6cb2('0x2'));var moment=require(_0x6cb2('0x3'));var BPromise=require(_0x6cb2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6cb2('0x5'));var rimraf=require('rimraf');var config=require(_0x6cb2('0x6'));var attributes=require(_0x6cb2('0x7'));module[_0x6cb2('0x8')]=function(_0x2d8bce,_0x172745){return _0x2d8bce[_0x6cb2('0x9')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x6cb2('0xa'),'fields':[_0x6cb2('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56ff=['./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1e9514,_0x4caf91){var _0x3a07b1=function(_0x134d64){while(--_0x134d64){_0x1e9514['push'](_0x1e9514['shift']());}};_0x3a07b1(++_0x4caf91);}(_0x56ff,0xb9));var _0xf56f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x56ff[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf56f('0x0'));var util=require(_0xf56f('0x1'));var logger=require(_0xf56f('0x2'))(_0xf56f('0x3'));var moment=require(_0xf56f('0x4'));var BPromise=require(_0xf56f('0x5'));var rp=require(_0xf56f('0x6'));var fs=require('fs');var path=require(_0xf56f('0x7'));var rimraf=require(_0xf56f('0x8'));var config=require(_0xf56f('0x9'));var attributes=require(_0xf56f('0xa'));module[_0xf56f('0xb')]=function(_0x5db3fc,_0x1b4a7d){return _0x5db3fc[_0xf56f('0xc')]('SmsTransferReport',attributes,{'tableName':_0xf56f('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf56f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index ca4748e..3e11970 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 _0x35d0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x6d8139,_0x38ba46){var _0x45ced7=function(_0x56d4f5){while(--_0x56d4f5){_0x6d8139['push'](_0x6d8139['shift']());}};_0x45ced7(++_0x38ba46);}(_0x35d0,0xf9));var _0x035d=function(_0x45161c,_0x5494fc){_0x45161c=_0x45161c-0x0;var _0x186581=_0x35d0[_0x45161c];return _0x186581;};'use strict';var _=require(_0x035d('0x0'));var util=require(_0x035d('0x1'));var moment=require('moment');var BPromise=require(_0x035d('0x2'));var rs=require(_0x035d('0x3'));var fs=require('fs');var Redis=require(_0x035d('0x4'));var db=require(_0x035d('0x5'))['db'];var utils=require(_0x035d('0x6'));var logger=require(_0x035d('0x7'))('rpc');var config=require(_0x035d('0x8'));var jayson=require(_0x035d('0x9'));var client=jayson[_0x035d('0xa')][_0x035d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x511bb7,_0x430045,_0x31fa37){return new BPromise(function(_0x3890c4,_0x30cc76){return client[_0x035d('0xc')](_0x511bb7,_0x31fa37)[_0x035d('0xd')](function(_0x28254f){logger[_0x035d('0xe')](_0x035d('0xf'),_0x430045,_0x035d('0x10'));logger['debug'](_0x035d('0x11'),_0x430045,'request\x20sent',JSON[_0x035d('0x12')](_0x28254f));if(_0x28254f['error']){if(_0x28254f[_0x035d('0x13')]['code']===0x1f4){logger[_0x035d('0x13')](_0x035d('0xf'),_0x430045,_0x28254f[_0x035d('0x13')][_0x035d('0x14')]);return _0x30cc76(_0x28254f[_0x035d('0x13')]['message']);}logger['error'](_0x035d('0xf'),_0x430045,_0x28254f[_0x035d('0x13')][_0x035d('0x14')]);return _0x3890c4(_0x28254f[_0x035d('0x13')][_0x035d('0x14')]);}else{logger[_0x035d('0xe')](_0x035d('0xf'),_0x430045,'request\x20sent');_0x3890c4(_0x28254f[_0x035d('0x15')][_0x035d('0x14')]);}})[_0x035d('0x16')](function(_0x47c916){logger[_0x035d('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x430045,_0x47c916);_0x30cc76(_0x47c916);});});} \ No newline at end of file +var _0x1dcc=['error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2c5c33,_0xf365d6){var _0x125452=function(_0x236f29){while(--_0x236f29){_0x2c5c33['push'](_0x2c5c33['shift']());}};_0x125452(++_0xf365d6);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x312c8f,_0x502dbf){_0x312c8f=_0x312c8f-0x0;var _0x49a6ab=_0x1dcc[_0x312c8f];return _0x49a6ab;};'use strict';var _=require(_0xc1dc('0x0'));var util=require(_0xc1dc('0x1'));var moment=require(_0xc1dc('0x2'));var BPromise=require(_0xc1dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1dc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1dc('0x5'));var logger=require(_0xc1dc('0x6'))(_0xc1dc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc1dc('0x8')][_0xc1dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41b667,_0x4dab41,_0x3ef050){return new BPromise(function(_0x3deb94,_0x597ba8){return client[_0xc1dc('0xa')](_0x41b667,_0x3ef050)['then'](function(_0x2e606d){logger['info'](_0xc1dc('0xb'),_0x4dab41,_0xc1dc('0xc'));logger[_0xc1dc('0xd')](_0xc1dc('0xe'),_0x4dab41,_0xc1dc('0xc'),JSON[_0xc1dc('0xf')](_0x2e606d));if(_0x2e606d[_0xc1dc('0x10')]){if(_0x2e606d[_0xc1dc('0x10')][_0xc1dc('0x11')]===0x1f4){logger['error'](_0xc1dc('0xb'),_0x4dab41,_0x2e606d[_0xc1dc('0x10')][_0xc1dc('0x12')]);return _0x597ba8(_0x2e606d['error'][_0xc1dc('0x12')]);}logger[_0xc1dc('0x10')](_0xc1dc('0xb'),_0x4dab41,_0x2e606d[_0xc1dc('0x10')][_0xc1dc('0x12')]);return _0x3deb94(_0x2e606d[_0xc1dc('0x10')][_0xc1dc('0x12')]);}else{logger[_0xc1dc('0x13')](_0xc1dc('0xb'),_0x4dab41,_0xc1dc('0xc'));_0x3deb94(_0x2e606d[_0xc1dc('0x14')]['message']);}})[_0xc1dc('0x15')](function(_0x3533a9){logger[_0xc1dc('0x10')](_0xc1dc('0xb'),_0x4dab41,_0x3533a9);_0x597ba8(_0x3533a9);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index bffecaa..7cc2bc2 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 _0x7adb=['file','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','/:id','show','isAuthenticated','download','diskStorage','join','originalname','replace','%s-%s%s','basename','extname','now','post','single'];(function(_0x208bc9,_0x4f36f6){var _0x2675a8=function(_0x452e72){while(--_0x452e72){_0x208bc9['push'](_0x208bc9['shift']());}};_0x2675a8(++_0x4f36f6);}(_0x7adb,0x14f));var _0xb7ad=function(_0x3816c2,_0xb221e1){_0x3816c2=_0x3816c2-0x0;var _0x144669=_0x7adb[_0x3816c2];return _0x144669;};'use strict';var multer=require(_0xb7ad('0x0'));var util=require(_0xb7ad('0x1'));var path=require(_0xb7ad('0x2'));var timeout=require(_0xb7ad('0x3'));var express=require(_0xb7ad('0x4'));var router=express[_0xb7ad('0x5')]();var fs_extra=require(_0xb7ad('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb7ad('0x7'));var config=require(_0xb7ad('0x8'));var controller=require(_0xb7ad('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb7ad('0xa')](_0xb7ad('0xb'),auth['isAuthenticated'](),controller[_0xb7ad('0xc')]);router['get']('/:id/download',auth[_0xb7ad('0xd')](),controller[_0xb7ad('0xe')]);var upload=multer({'storage':multer[_0xb7ad('0xf')]({'destination':function(_0x4af5b9,_0x5edd79,_0x802e05){_0x802e05(null,path[_0xb7ad('0x10')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x530c8b,_0x38fbc0,_0x1c7640){_0x38fbc0[_0xb7ad('0x11')]=_0x38fbc0[_0xb7ad('0x11')][_0xb7ad('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1c7640(null,util['format'](_0xb7ad('0x13'),path[_0xb7ad('0x14')](_0x38fbc0[_0xb7ad('0x11')],path[_0xb7ad('0x15')](_0x38fbc0['originalname'])),Date[_0xb7ad('0x16')](),path[_0xb7ad('0x15')](_0x38fbc0[_0xb7ad('0x11')])));}})});router[_0xb7ad('0x17')]('/',upload[_0xb7ad('0x18')](_0xb7ad('0x19')),controller[_0xb7ad('0x1a')]);router['put'](_0xb7ad('0xb'),auth[_0xb7ad('0xd')](),controller[_0xb7ad('0x1b')]);router[_0xb7ad('0x1c')](_0xb7ad('0xb'),auth[_0xb7ad('0xd')](),controller[_0xb7ad('0x1c')]);module[_0xb7ad('0x1d')]=router; \ No newline at end of file +var _0xf537=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','diskStorage','join','server/files/sounds/original/','originalname','replace','format','basename','extname','now','single','create','update','delete','exports','util','path','Router'];(function(_0xd3bc07,_0x3a11a5){var _0x10aa85=function(_0xb8f14e){while(--_0xb8f14e){_0xd3bc07['push'](_0xd3bc07['shift']());}};_0x10aa85(++_0x3a11a5);}(_0xf537,0x6d));var _0x7f53=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf537[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x7f53('0x0'));var path=require(_0x7f53('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7f53('0x2')]();var fs_extra=require(_0x7f53('0x3'));var auth=require(_0x7f53('0x4'));var interaction=require(_0x7f53('0x5'));var config=require(_0x7f53('0x6'));var controller=require(_0x7f53('0x7'));router[_0x7f53('0x8')]('/',auth['isAuthenticated'](),controller[_0x7f53('0x9')]);router['get'](_0x7f53('0xa'),auth[_0x7f53('0xb')](),controller[_0x7f53('0xc')]);router[_0x7f53('0x8')](_0x7f53('0xd'),auth[_0x7f53('0xb')](),controller['download']);var upload=multer({'storage':multer[_0x7f53('0xe')]({'destination':function(_0x562dfc,_0x206a90,_0x5d022e){_0x5d022e(null,path[_0x7f53('0xf')](config['root'],_0x7f53('0x10')));},'filename':function(_0x109d62,_0x4ecc76,_0x2a0ad6){_0x4ecc76['originalname']=_0x4ecc76[_0x7f53('0x11')][_0x7f53('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2a0ad6(null,util[_0x7f53('0x13')]('%s-%s%s',path[_0x7f53('0x14')](_0x4ecc76[_0x7f53('0x11')],path[_0x7f53('0x15')](_0x4ecc76['originalname'])),Date[_0x7f53('0x16')](),path[_0x7f53('0x15')](_0x4ecc76[_0x7f53('0x11')])));}})});router['post']('/',upload[_0x7f53('0x17')]('file'),controller[_0x7f53('0x18')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7f53('0x19')]);router[_0x7f53('0x1a')]('/:id',auth[_0x7f53('0xb')](),controller[_0x7f53('0x1a')]);module[_0x7f53('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 9c1f770..1fcdafd 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 _0x6d21=['sequelize','exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x425ee6,_0x44c155){var _0x503e7e=function(_0x37b14a){while(--_0x37b14a){_0x425ee6['push'](_0x425ee6['shift']());}};_0x503e7e(++_0x44c155);}(_0x6d21,0x7e));var _0x16d2=function(_0x101ad7,_0x5e6ee2){_0x101ad7=_0x101ad7-0x0;var _0x3ecead=_0x6d21[_0x101ad7];return _0x3ecead;};'use strict';var Sequelize=require(_0x16d2('0x0'));module[_0x16d2('0x1')]={'name':{'type':Sequelize[_0x16d2('0x2')],'unique':_0x16d2('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x16d2('0x2')]},'original_format':{'type':Sequelize[_0x16d2('0x2')]},'original_duration':{'type':Sequelize[_0x16d2('0x4')]},'original_sampleCount':{'type':Sequelize[_0x16d2('0x5')]},'original_channelCount':{'type':Sequelize[_0x16d2('0x6')]},'original_bitRate':{'type':Sequelize[_0x16d2('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x16d2('0x2')]},'converted_duration':{'type':Sequelize[_0x16d2('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x16d2('0x5')]},'converted_channelCount':{'type':Sequelize[_0x16d2('0x6')]},'converted_bitRate':{'type':Sequelize[_0x16d2('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x16d2('0x6')]}}; \ No newline at end of file +var _0x6be3=['BIGINT','INTEGER','sequelize','exports','STRING','name','FLOAT'];(function(_0x19c3ab,_0x4dd25c){var _0x30d6c8=function(_0x248c59){while(--_0x248c59){_0x19c3ab['push'](_0x19c3ab['shift']());}};_0x30d6c8(++_0x4dd25c);}(_0x6be3,0x175));var _0x36be=function(_0x3ebcab,_0x482df2){_0x3ebcab=_0x3ebcab-0x0;var _0x4074d3=_0x6be3[_0x3ebcab];return _0x4074d3;};'use strict';var Sequelize=require(_0x36be('0x0'));module[_0x36be('0x1')]={'name':{'type':Sequelize[_0x36be('0x2')],'unique':_0x36be('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x36be('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x36be('0x2')]},'original_format':{'type':Sequelize[_0x36be('0x2')]},'original_duration':{'type':Sequelize[_0x36be('0x4')]},'original_sampleCount':{'type':Sequelize[_0x36be('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x36be('0x5')]},'original_sampleRate':{'type':Sequelize[_0x36be('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x36be('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x36be('0x5')]},'converted_channelCount':{'type':Sequelize[_0x36be('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x36be('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index ad92600..153c85a 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 _0x2122=['keys','query','filters','intersection','attributes','fields','length','nolimit','sort','filter','merge','where','options','Sound','includeAll','include','findAll','rows','show','rawAttributes','catch','find','params','join','converted_format','ValidationError','Sound\x20not\x20found','download','root','server/files/sounds/converted','%s.%s','format','create','basename','file','extname','filename','originalname','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','src','original_duration','duration','sampleCount','channelCount','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','pick','description','delete','save_name','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','get','Sounds','UserProfileResource','end','sendStatus','error','stack','name','send','index','type','key','model','map'];(function(_0x1ed638,_0x38615b){var _0x3dfd30=function(_0x5d8bbe){while(--_0x5d8bbe){_0x1ed638['push'](_0x1ed638['shift']());}};_0x3dfd30(++_0x38615b);}(_0x2122,0x14b));var _0x2212=function(_0x5232bb,_0x4fcb6c){_0x5232bb=_0x5232bb-0x0;var _0x2ba6d1=_0x2122[_0x5232bb];return _0x2ba6d1;};'use strict';var emlformat=require(_0x2212('0x0'));var rimraf=require(_0x2212('0x1'));var zipdir=require(_0x2212('0x2'));var jsonpatch=require(_0x2212('0x3'));var rp=require(_0x2212('0x4'));var moment=require(_0x2212('0x5'));var BPromise=require(_0x2212('0x6'));var Mustache=require(_0x2212('0x7'));var util=require(_0x2212('0x8'));var path=require(_0x2212('0x9'));var sox=require(_0x2212('0xa'));var csv=require(_0x2212('0xb'));var ejs=require(_0x2212('0xc'));var fs=require('fs');var fs_extra=require(_0x2212('0xd'));var _=require('lodash');var squel=require(_0x2212('0xe'));var crypto=require(_0x2212('0xf'));var jsforce=require(_0x2212('0x10'));var deskjs=require(_0x2212('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2212('0x12'));var Papa=require(_0x2212('0x13'));var Redis=require(_0x2212('0x14'));var authService=require(_0x2212('0x15'));var qs=require(_0x2212('0x16'));var as=require(_0x2212('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2212('0x18'))(_0x2212('0x19'));var utils=require('../../config/utils');var config=require(_0x2212('0x1a'));var licenseUtil=require(_0x2212('0x1b'));var db=require(_0x2212('0x1c'))['db'];function respondWithStatusCode(_0x10dc0b,_0x4f2347){_0x4f2347=_0x4f2347||0xcc;return function(_0x42a837){if(_0x42a837){return _0x10dc0b['sendStatus'](_0x4f2347);}return _0x10dc0b['status'](_0x4f2347)['end']();};}function respondWithResult(_0x1fae44,_0x388ea5){_0x388ea5=_0x388ea5||0xc8;return function(_0x13ef19){if(_0x13ef19){return _0x1fae44[_0x2212('0x1d')](_0x388ea5)['json'](_0x13ef19);}};}function respondWithFilteredResult(_0x500702,_0x566f88){return function(_0x56606b){if(_0x56606b){var _0x2e6229=typeof _0x566f88['offset']===_0x2212('0x1e')&&typeof _0x566f88[_0x2212('0x1f')]===_0x2212('0x1e');var _0x1f9641=_0x56606b[_0x2212('0x20')];var _0x19de5f=_0x2e6229?0x0:_0x566f88['offset'];var _0x4918bb=_0x2e6229?_0x56606b[_0x2212('0x20')]:_0x566f88[_0x2212('0x21')]+_0x566f88[_0x2212('0x1f')];var _0x17da27;if(_0x4918bb>=_0x1f9641){_0x4918bb=_0x1f9641;_0x17da27=0xc8;}else{_0x17da27=0xce;}_0x500702['status'](_0x17da27);return _0x500702[_0x2212('0x22')](_0x2212('0x23'),_0x19de5f+'-'+_0x4918bb+'/'+_0x1f9641)[_0x2212('0x24')](_0x56606b);}return null;};}function patchUpdates(_0x52c864){return function(_0x13b368){try{jsonpatch['apply'](_0x13b368,_0x52c864,!![]);}catch(_0x33b19b){return BPromise[_0x2212('0x25')](_0x33b19b);}return _0x13b368[_0x2212('0x26')]();};}function saveUpdates(_0x12dc1d,_0x372a76){return function(_0x5a8e08){if(_0x5a8e08){return _0x5a8e08[_0x2212('0x27')](_0x12dc1d)[_0x2212('0x28')](function(_0x433cd8){return _0x433cd8;});}return null;};}function removeEntity(_0x551868,_0x39205a){return function(_0x2b9490){if(_0x2b9490){return _0x2b9490[_0x2212('0x29')]()[_0x2212('0x28')](function(){var _0x11dc56=_0x2b9490[_0x2212('0x2a')]({'plain':!![]});var _0x5bfe75=_0x2212('0x2b');return db[_0x2212('0x2c')][_0x2212('0x29')]({'where':{'type':_0x5bfe75,'resourceId':_0x11dc56['id']}})['then'](function(){return _0x2b9490;});})[_0x2212('0x28')](function(){_0x551868[_0x2212('0x1d')](0xcc)[_0x2212('0x2d')]();});}};}function handleEntityNotFound(_0x2f2f12,_0x627ec7){return function(_0x14977a){if(!_0x14977a){_0x2f2f12[_0x2212('0x2e')](0x194);}return _0x14977a;};}function handleError(_0x27014b,_0x4ce5bb){_0x4ce5bb=_0x4ce5bb||0x1f4;return function(_0x52bab5){logger[_0x2212('0x2f')](_0x52bab5[_0x2212('0x30')]);if(_0x52bab5[_0x2212('0x31')]){delete _0x52bab5[_0x2212('0x31')];}_0x27014b[_0x2212('0x1d')](_0x4ce5bb)[_0x2212('0x32')](_0x52bab5);};}exports[_0x2212('0x33')]=function(_0x5d55a7,_0x1f58ef){var _0x23eb27={},_0x51cbed={},_0x47c590={'count':0x0,'rows':[]};var _0x3007d2=_['map'](db['Sound']['rawAttributes'],function(_0x596d14){return{'name':_0x596d14['fieldName'],'type':_0x596d14[_0x2212('0x34')][_0x2212('0x35')]};});_0x51cbed[_0x2212('0x36')]=_[_0x2212('0x37')](_0x3007d2,_0x2212('0x31'));_0x51cbed['query']=_[_0x2212('0x38')](_0x5d55a7[_0x2212('0x39')]);_0x51cbed[_0x2212('0x3a')]=_[_0x2212('0x3b')](_0x51cbed[_0x2212('0x36')],_0x51cbed[_0x2212('0x39')]);_0x23eb27[_0x2212('0x3c')]=_[_0x2212('0x3b')](_0x51cbed[_0x2212('0x36')],qs[_0x2212('0x3d')](_0x5d55a7[_0x2212('0x39')][_0x2212('0x3d')]));_0x23eb27[_0x2212('0x3c')]=_0x23eb27[_0x2212('0x3c')][_0x2212('0x3e')]?_0x23eb27[_0x2212('0x3c')]:_0x51cbed['model'];if(!_0x5d55a7[_0x2212('0x39')]['hasOwnProperty'](_0x2212('0x3f'))){_0x23eb27[_0x2212('0x1f')]=qs[_0x2212('0x1f')](_0x5d55a7['query'][_0x2212('0x1f')]);_0x23eb27[_0x2212('0x21')]=qs[_0x2212('0x21')](_0x5d55a7[_0x2212('0x39')][_0x2212('0x21')]);}_0x23eb27['order']=qs[_0x2212('0x40')](_0x5d55a7['query'][_0x2212('0x40')]);_0x23eb27['where']=qs[_0x2212('0x3a')](_['pick'](_0x5d55a7[_0x2212('0x39')],_0x51cbed[_0x2212('0x3a')]),_0x3007d2);if(_0x5d55a7[_0x2212('0x39')][_0x2212('0x41')]){_0x23eb27['where']=_[_0x2212('0x42')](_0x23eb27[_0x2212('0x43')],{'$or':_[_0x2212('0x37')](_0x3007d2,function(_0x21ad0f){if(_0x21ad0f[_0x2212('0x34')]!=='VIRTUAL'){var _0x1e39b7={};_0x1e39b7[_0x21ad0f[_0x2212('0x31')]]={'$like':'%'+_0x5d55a7['query'][_0x2212('0x41')]+'%'};return _0x1e39b7;}})});}_0x23eb27=_[_0x2212('0x42')]({},_0x23eb27,_0x5d55a7[_0x2212('0x44')]);var _0x530fb7={'where':_0x23eb27[_0x2212('0x43')]};return db[_0x2212('0x45')][_0x2212('0x20')](_0x530fb7)[_0x2212('0x28')](function(_0x47e019){_0x47c590[_0x2212('0x20')]=_0x47e019;if(_0x5d55a7['query'][_0x2212('0x46')]){_0x23eb27[_0x2212('0x47')]=[{'all':!![]}];}return db[_0x2212('0x45')][_0x2212('0x48')](_0x23eb27);})['then'](function(_0x49668a){_0x47c590[_0x2212('0x49')]=_0x49668a;return _0x47c590;})[_0x2212('0x28')](respondWithFilteredResult(_0x1f58ef,_0x23eb27))['catch'](handleError(_0x1f58ef,null));};exports[_0x2212('0x4a')]=function(_0x550653,_0x73892b){var _0x5c1c82={'raw':!![],'where':{'id':_0x550653['params']['id']}},_0x4647eb={};_0x4647eb['model']=_['keys'](db['Sound'][_0x2212('0x4b')]);_0x4647eb[_0x2212('0x39')]=_['keys'](_0x550653[_0x2212('0x39')]);_0x4647eb[_0x2212('0x3a')]=_[_0x2212('0x3b')](_0x4647eb[_0x2212('0x36')],_0x4647eb['query']);_0x5c1c82[_0x2212('0x3c')]=_[_0x2212('0x3b')](_0x4647eb['model'],qs[_0x2212('0x3d')](_0x550653[_0x2212('0x39')][_0x2212('0x3d')]));_0x5c1c82['attributes']=_0x5c1c82[_0x2212('0x3c')][_0x2212('0x3e')]?_0x5c1c82[_0x2212('0x3c')]:_0x4647eb[_0x2212('0x36')];if(_0x550653['query'][_0x2212('0x46')]){_0x5c1c82[_0x2212('0x47')]=[{'all':!![]}];}_0x5c1c82=_['merge']({},_0x5c1c82,_0x550653[_0x2212('0x44')]);return db[_0x2212('0x45')]['find'](_0x5c1c82)[_0x2212('0x28')](handleEntityNotFound(_0x73892b,null))[_0x2212('0x28')](respondWithResult(_0x73892b,null))[_0x2212('0x4c')](handleError(_0x73892b,null));};exports['download']=function(_0x19418e,_0x404bd7,_0x1fba07){return db['Sound'][_0x2212('0x4d')]({'where':{'id':_0x19418e[_0x2212('0x4e')]['id']},'attributes':[_0x2212('0x31'),'save_name','converted_format'],'raw':!![]})[_0x2212('0x28')](handleEntityNotFound(_0x404bd7,null))['then'](function(_0x540bd6){if(_0x540bd6){if(!fs['existsSync'](path[_0x2212('0x4f')](config['root'],'server/files/sounds/converted',_0x540bd6['save_name']+'.'+_0x540bd6[_0x2212('0x50')]))){throw new db['Sequelize'][(_0x2212('0x51'))](_0x2212('0x52'));}return _0x404bd7[_0x2212('0x53')](path[_0x2212('0x4f')](config[_0x2212('0x54')],_0x2212('0x55'),util['format'](_0x2212('0x56'),_0x540bd6['save_name'],_0x540bd6[_0x2212('0x50')])),util[_0x2212('0x57')](_0x2212('0x56'),_0x540bd6['name'],_0x540bd6['converted_format']));}return null;})['catch'](handleError(_0x404bd7,null));};exports[_0x2212('0x58')]=function(_0x55b583,_0x38e5d3,_0x91cbe8){var _0x19eebb={'name':path[_0x2212('0x59')](_0x55b583[_0x2212('0x5a')]['originalname'],path[_0x2212('0x5b')](_0x55b583[_0x2212('0x5a')]['originalname'])),'save_name':path[_0x2212('0x59')](_0x55b583[_0x2212('0x5a')][_0x2212('0x5c')],path[_0x2212('0x5b')](_0x55b583['file'][_0x2212('0x5c')])),'original_format':path[_0x2212('0x5b')](_0x55b583['file'][_0x2212('0x5d')])[_0x2212('0x5e')](0x1),'converted_format':'wav'};var _0x2639f7=path['join'](config[_0x2212('0x54')],_0x2212('0x5f'),_0x55b583[_0x2212('0x5a')][_0x2212('0x5c')]);var _0x11006e=path[_0x2212('0x4f')](config[_0x2212('0x54')],_0x2212('0x55'),util[_0x2212('0x57')](_0x2212('0x56'),path['basename'](_0x55b583['file']['filename'],path['extname'](_0x55b583[_0x2212('0x5a')][_0x2212('0x5c')])),_0x19eebb['converted_format']));logger[_0x2212('0x60')](_0x2212('0x61'),_0x2639f7);logger[_0x2212('0x60')]('Sound\x20upload\x20destination:\x20%s',_0x11006e);try{fs[_0x2212('0x62')](_0x2639f7,parseInt(_0x2212('0x63'),0x8));var _0x5a327e=sox[_0x2212('0x64')](_0x2639f7,_0x11006e,{'sampleRate':0x1f40,'format':_0x2212('0x65'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5a327e['on']('error',function(_0x5dfb08){fs[_0x2212('0x66')](_0x2639f7);_0x38e5d3[_0x2212('0x1d')](0x1f4)['send'](_0x5dfb08);});_0x5a327e['on'](_0x2212('0x67'),function(_0x3976dd){_0x19eebb[_0x2212('0x68')]=isNaN(_0x3976dd[_0x2212('0x69')])?null:_0x3976dd[_0x2212('0x69')]*0x3e8;_0x19eebb['original_sampleCount']=isNaN(_0x3976dd[_0x2212('0x6a')])?null:_0x3976dd[_0x2212('0x6a')];_0x19eebb['original_channelCount']=isNaN(_0x3976dd[_0x2212('0x6b')])?null:_0x3976dd[_0x2212('0x6b')];_0x19eebb['original_bitRate']=isNaN(_0x3976dd['bitRate'])?null:_0x3976dd['bitRate'];_0x19eebb[_0x2212('0x6c')]=isNaN(_0x3976dd[_0x2212('0x6d')])?null:_0x3976dd[_0x2212('0x6d')];});_0x5a327e['on'](_0x2212('0x6e'),function(_0x66bc48){_0x19eebb[_0x2212('0x6f')]=isNaN(_0x66bc48['duration'])?null:_0x66bc48[_0x2212('0x69')]*0x3e8;_0x19eebb[_0x2212('0x70')]=isNaN(_0x66bc48[_0x2212('0x6a')])?null:_0x66bc48[_0x2212('0x6a')];_0x19eebb[_0x2212('0x71')]=isNaN(_0x66bc48['channelCount'])?null:_0x66bc48[_0x2212('0x6b')];_0x19eebb[_0x2212('0x72')]=isNaN(_0x66bc48[_0x2212('0x73')])?null:_0x66bc48[_0x2212('0x73')];_0x19eebb[_0x2212('0x74')]=isNaN(_0x66bc48[_0x2212('0x6d')])?null:_0x66bc48[_0x2212('0x6d')];});_0x5a327e['on']('end',function(){fs[_0x2212('0x62')](_0x11006e,parseInt(_0x2212('0x63'),0x8));return db[_0x2212('0x45')][_0x2212('0x58')](_0x19eebb)[_0x2212('0x28')](function(_0x1b4254){var _0x6ec0a1={'role':_0x55b583[_0x2212('0x75')]['role'],'userProfileId':_0x55b583[_0x2212('0x75')]['userProfileId']};if(!_0x6ec0a1)throw new Error(_0x2212('0x76'));if(_0x6ec0a1[_0x2212('0x77')]===_0x2212('0x78')){var _0xaded49=_0x1b4254[_0x2212('0x2a')]({'plain':!![]});return db[_0x2212('0x79')][_0x2212('0x4d')]({'where':{'name':_0x2212('0x2b'),'userProfileId':_0x6ec0a1[_0x2212('0x7a')]},'raw':!![]})[_0x2212('0x28')](function(_0x4c4b3b){if(_0x4c4b3b&&_0x4c4b3b[_0x2212('0x7b')]===0x0){return db['UserProfileResource'][_0x2212('0x58')]({'name':_0xaded49[_0x2212('0x31')],'resourceId':_0xaded49['id'],'type':_0x4c4b3b[_0x2212('0x31')],'sectionId':_0x4c4b3b['id']},{})[_0x2212('0x28')](function(){return _0x1b4254;});}else{return _0x1b4254;}})[_0x2212('0x4c')](function(_0x3cdebd){logger[_0x2212('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cdebd);throw _0x3cdebd;});}return _0x1b4254;})[_0x2212('0x28')](respondWithResult(_0x38e5d3,null))[_0x2212('0x4c')](handleError(_0x38e5d3,null));});_0x5a327e['start']();}catch(_0x53c8d6){_0x38e5d3['status'](0x1f4)[_0x2212('0x32')](_0x53c8d6);}};exports[_0x2212('0x27')]=function(_0x4c3b07,_0x5adc27,_0x40c39){return db['Sound'][_0x2212('0x4d')]({'where':{'id':_0x4c3b07[_0x2212('0x4e')]['id']}})[_0x2212('0x28')](handleEntityNotFound(_0x5adc27,null))[_0x2212('0x28')](saveUpdates(_[_0x2212('0x7c')](_0x4c3b07[_0x2212('0x75')],[_0x2212('0x31'),_0x2212('0x7d')]),null))[_0x2212('0x28')](respondWithResult(_0x5adc27,null))[_0x2212('0x4c')](handleError(_0x5adc27,null));};exports[_0x2212('0x7e')]=function(_0xb0eda,_0x3d4d31,_0x54d91d){return db[_0x2212('0x45')][_0x2212('0x4d')]({'where':{'id':_0xb0eda[_0x2212('0x4e')]['id']}})[_0x2212('0x28')](function(_0x248e28){if(_0x248e28){return _0x248e28[_0x2212('0x29')]();}})[_0x2212('0x28')](function(_0x22fb9a){var _0x365dc6=path[_0x2212('0x4f')](config[_0x2212('0x54')],_0x2212('0x5f'),util[_0x2212('0x57')]('%s.%s',_0x22fb9a[_0x2212('0x7f')],_0x22fb9a[_0x2212('0x80')]));var _0x28b253=path['join'](config[_0x2212('0x54')],_0x2212('0x55'),util[_0x2212('0x57')](_0x2212('0x56'),_0x22fb9a['save_name'],_0x22fb9a[_0x2212('0x50')]));fs['unlinkSync'](_0x365dc6);fs[_0x2212('0x66')](_0x28b253);return _0x22fb9a;})[_0x2212('0x28')](function(_0x52212e){if(_0x52212e){return _0x3d4d31[_0x2212('0x1d')](0xcc)[_0x2212('0x2d')]();}})[_0x2212('0x28')](handleEntityNotFound(_0x3d4d31,null))['catch'](handleError(_0x3d4d31,null));}; \ No newline at end of file +var _0xa88f=['intersection','includeAll','include','find','catch','download','params','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','root','format','create','basename','extname','file','originalname','filename','substring','wav','%s.%s','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','send','src','duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','pick','delete','server/files/sounds/original','original_format','unlinkSync','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','name','index','map','Sound','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','findAll','rows'];(function(_0x11babf,_0x2a02bb){var _0x3bcc27=function(_0x41b892){while(--_0x41b892){_0x11babf['push'](_0x11babf['shift']());}};_0x3bcc27(++_0x2a02bb);}(_0xa88f,0xae));var _0xfa88=function(_0x3682e1,_0x20891d){_0x3682e1=_0x3682e1-0x0;var _0x329586=_0xa88f[_0x3682e1];return _0x329586;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa88('0x0'));var zipdir=require(_0xfa88('0x1'));var jsonpatch=require(_0xfa88('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfa88('0x3'));var util=require(_0xfa88('0x4'));var path=require(_0xfa88('0x5'));var sox=require(_0xfa88('0x6'));var csv=require(_0xfa88('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfa88('0x8'));var crypto=require('crypto');var jsforce=require(_0xfa88('0x9'));var deskjs=require(_0xfa88('0xa'));var toCsv=require(_0xfa88('0x7'));var querystring=require(_0xfa88('0xb'));var Papa=require(_0xfa88('0xc'));var Redis=require(_0xfa88('0xd'));var authService=require(_0xfa88('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfa88('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa88('0x10'))('api');var utils=require(_0xfa88('0x11'));var config=require(_0xfa88('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xfa88('0x13'))['db'];function respondWithStatusCode(_0x920040,_0x245748){_0x245748=_0x245748||0xcc;return function(_0xa3a924){if(_0xa3a924){return _0x920040[_0xfa88('0x14')](_0x245748);}return _0x920040[_0xfa88('0x15')](_0x245748)[_0xfa88('0x16')]();};}function respondWithResult(_0x48d15e,_0x5c8690){_0x5c8690=_0x5c8690||0xc8;return function(_0x256499){if(_0x256499){return _0x48d15e['status'](_0x5c8690)[_0xfa88('0x17')](_0x256499);}};}function respondWithFilteredResult(_0x5ac79e,_0x365660){return function(_0x1eb894){if(_0x1eb894){var _0x525728=typeof _0x365660['offset']==='undefined'&&typeof _0x365660['limit']===_0xfa88('0x18');var _0x2ef5c8=_0x1eb894[_0xfa88('0x19')];var _0x3c3e1e=_0x525728?0x0:_0x365660['offset'];var _0x3575b2=_0x525728?_0x1eb894[_0xfa88('0x19')]:_0x365660[_0xfa88('0x1a')]+_0x365660[_0xfa88('0x1b')];var _0x249aba;if(_0x3575b2>=_0x2ef5c8){_0x3575b2=_0x2ef5c8;_0x249aba=0xc8;}else{_0x249aba=0xce;}_0x5ac79e['status'](_0x249aba);return _0x5ac79e[_0xfa88('0x1c')](_0xfa88('0x1d'),_0x3c3e1e+'-'+_0x3575b2+'/'+_0x2ef5c8)[_0xfa88('0x17')](_0x1eb894);}return null;};}function patchUpdates(_0x54889f){return function(_0x52ddfd){try{jsonpatch[_0xfa88('0x1e')](_0x52ddfd,_0x54889f,!![]);}catch(_0x56ac26){return BPromise[_0xfa88('0x1f')](_0x56ac26);}return _0x52ddfd[_0xfa88('0x20')]();};}function saveUpdates(_0x15d1d3,_0x2449e2){return function(_0x438af5){if(_0x438af5){return _0x438af5[_0xfa88('0x21')](_0x15d1d3)[_0xfa88('0x22')](function(_0x481120){return _0x481120;});}return null;};}function removeEntity(_0x41b7e6,_0x2180f7){return function(_0x2036e0){if(_0x2036e0){return _0x2036e0[_0xfa88('0x23')]()[_0xfa88('0x22')](function(){var _0x433812=_0x2036e0[_0xfa88('0x24')]({'plain':!![]});var _0x5e93ad=_0xfa88('0x25');return db[_0xfa88('0x26')][_0xfa88('0x23')]({'where':{'type':_0x5e93ad,'resourceId':_0x433812['id']}})['then'](function(){return _0x2036e0;});})[_0xfa88('0x22')](function(){_0x41b7e6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39cb82,_0x5410ca){return function(_0x32d1e8){if(!_0x32d1e8){_0x39cb82[_0xfa88('0x14')](0x194);}return _0x32d1e8;};}function handleError(_0x47bcd8,_0x8914a1){_0x8914a1=_0x8914a1||0x1f4;return function(_0x5a90bf){logger[_0xfa88('0x27')](_0x5a90bf['stack']);if(_0x5a90bf[_0xfa88('0x28')]){delete _0x5a90bf[_0xfa88('0x28')];}_0x47bcd8[_0xfa88('0x15')](_0x8914a1)['send'](_0x5a90bf);};}exports[_0xfa88('0x29')]=function(_0x2c3a2f,_0x1e858e){var _0x4c28a1={},_0x4d4693={},_0x5c5dc7={'count':0x0,'rows':[]};var _0x4c43ea=_[_0xfa88('0x2a')](db[_0xfa88('0x2b')][_0xfa88('0x2c')],function(_0x47f5e4){return{'name':_0x47f5e4[_0xfa88('0x2d')],'type':_0x47f5e4[_0xfa88('0x2e')][_0xfa88('0x2f')]};});_0x4d4693[_0xfa88('0x30')]=_[_0xfa88('0x2a')](_0x4c43ea,'name');_0x4d4693['query']=_[_0xfa88('0x31')](_0x2c3a2f[_0xfa88('0x32')]);_0x4d4693[_0xfa88('0x33')]=_['intersection'](_0x4d4693['model'],_0x4d4693[_0xfa88('0x32')]);_0x4c28a1[_0xfa88('0x34')]=_['intersection'](_0x4d4693[_0xfa88('0x30')],qs[_0xfa88('0x35')](_0x2c3a2f[_0xfa88('0x32')][_0xfa88('0x35')]));_0x4c28a1[_0xfa88('0x34')]=_0x4c28a1['attributes'][_0xfa88('0x36')]?_0x4c28a1[_0xfa88('0x34')]:_0x4d4693[_0xfa88('0x30')];if(!_0x2c3a2f['query'][_0xfa88('0x37')](_0xfa88('0x38'))){_0x4c28a1[_0xfa88('0x1b')]=qs['limit'](_0x2c3a2f[_0xfa88('0x32')]['limit']);_0x4c28a1[_0xfa88('0x1a')]=qs[_0xfa88('0x1a')](_0x2c3a2f[_0xfa88('0x32')][_0xfa88('0x1a')]);}_0x4c28a1['order']=qs[_0xfa88('0x39')](_0x2c3a2f['query'][_0xfa88('0x39')]);_0x4c28a1['where']=qs[_0xfa88('0x33')](_['pick'](_0x2c3a2f[_0xfa88('0x32')],_0x4d4693[_0xfa88('0x33')]),_0x4c43ea);if(_0x2c3a2f[_0xfa88('0x32')][_0xfa88('0x3a')]){_0x4c28a1[_0xfa88('0x3b')]=_['merge'](_0x4c28a1['where'],{'$or':_[_0xfa88('0x2a')](_0x4c43ea,function(_0xa3f31e){if(_0xa3f31e[_0xfa88('0x2e')]!=='VIRTUAL'){var _0x9294b={};_0x9294b[_0xa3f31e[_0xfa88('0x28')]]={'$like':'%'+_0x2c3a2f['query']['filter']+'%'};return _0x9294b;}})});}_0x4c28a1=_[_0xfa88('0x3c')]({},_0x4c28a1,_0x2c3a2f[_0xfa88('0x3d')]);var _0x5919ba={'where':_0x4c28a1[_0xfa88('0x3b')]};return db[_0xfa88('0x2b')]['count'](_0x5919ba)[_0xfa88('0x22')](function(_0xa04f3f){_0x5c5dc7[_0xfa88('0x19')]=_0xa04f3f;if(_0x2c3a2f[_0xfa88('0x32')]['includeAll']){_0x4c28a1['include']=[{'all':!![]}];}return db[_0xfa88('0x2b')][_0xfa88('0x3e')](_0x4c28a1);})[_0xfa88('0x22')](function(_0x23bf00){_0x5c5dc7[_0xfa88('0x3f')]=_0x23bf00;return _0x5c5dc7;})[_0xfa88('0x22')](respondWithFilteredResult(_0x1e858e,_0x4c28a1))['catch'](handleError(_0x1e858e,null));};exports['show']=function(_0x3bdf0c,_0x575259){var _0x7ac677={'raw':!![],'where':{'id':_0x3bdf0c['params']['id']}},_0x2715ca={};_0x2715ca[_0xfa88('0x30')]=_[_0xfa88('0x31')](db[_0xfa88('0x2b')][_0xfa88('0x2c')]);_0x2715ca[_0xfa88('0x32')]=_[_0xfa88('0x31')](_0x3bdf0c['query']);_0x2715ca[_0xfa88('0x33')]=_[_0xfa88('0x40')](_0x2715ca['model'],_0x2715ca[_0xfa88('0x32')]);_0x7ac677[_0xfa88('0x34')]=_[_0xfa88('0x40')](_0x2715ca[_0xfa88('0x30')],qs[_0xfa88('0x35')](_0x3bdf0c[_0xfa88('0x32')][_0xfa88('0x35')]));_0x7ac677['attributes']=_0x7ac677[_0xfa88('0x34')][_0xfa88('0x36')]?_0x7ac677[_0xfa88('0x34')]:_0x2715ca['model'];if(_0x3bdf0c[_0xfa88('0x32')][_0xfa88('0x41')]){_0x7ac677[_0xfa88('0x42')]=[{'all':!![]}];}_0x7ac677=_[_0xfa88('0x3c')]({},_0x7ac677,_0x3bdf0c[_0xfa88('0x3d')]);return db[_0xfa88('0x2b')][_0xfa88('0x43')](_0x7ac677)['then'](handleEntityNotFound(_0x575259,null))['then'](respondWithResult(_0x575259,null))[_0xfa88('0x44')](handleError(_0x575259,null));};exports[_0xfa88('0x45')]=function(_0x1c760a,_0x1057d3,_0x28e8cd){return db['Sound'][_0xfa88('0x43')]({'where':{'id':_0x1c760a[_0xfa88('0x46')]['id']},'attributes':['name',_0xfa88('0x47'),_0xfa88('0x48')],'raw':!![]})[_0xfa88('0x22')](handleEntityNotFound(_0x1057d3,null))[_0xfa88('0x22')](function(_0x5051fa){if(_0x5051fa){if(!fs[_0xfa88('0x49')](path[_0xfa88('0x4a')](config['root'],_0xfa88('0x4b'),_0x5051fa[_0xfa88('0x47')]+'.'+_0x5051fa[_0xfa88('0x48')]))){throw new db[(_0xfa88('0x4c'))]['ValidationError'](_0xfa88('0x4d'));}return _0x1057d3['download'](path[_0xfa88('0x4a')](config[_0xfa88('0x4e')],_0xfa88('0x4b'),util[_0xfa88('0x4f')]('%s.%s',_0x5051fa['save_name'],_0x5051fa['converted_format'])),util[_0xfa88('0x4f')]('%s.%s',_0x5051fa[_0xfa88('0x28')],_0x5051fa[_0xfa88('0x48')]));}return null;})[_0xfa88('0x44')](handleError(_0x1057d3,null));};exports[_0xfa88('0x50')]=function(_0xf8d614,_0x3b085e,_0xf62a8){var _0x5a961f={'name':path[_0xfa88('0x51')](_0xf8d614['file']['originalname'],path[_0xfa88('0x52')](_0xf8d614[_0xfa88('0x53')][_0xfa88('0x54')])),'save_name':path[_0xfa88('0x51')](_0xf8d614['file']['filename'],path[_0xfa88('0x52')](_0xf8d614[_0xfa88('0x53')][_0xfa88('0x55')])),'original_format':path[_0xfa88('0x52')](_0xf8d614[_0xfa88('0x53')][_0xfa88('0x54')])[_0xfa88('0x56')](0x1),'converted_format':_0xfa88('0x57')};var _0x3fca15=path['join'](config[_0xfa88('0x4e')],'server/files/sounds/original',_0xf8d614[_0xfa88('0x53')][_0xfa88('0x55')]);var _0x420314=path[_0xfa88('0x4a')](config[_0xfa88('0x4e')],_0xfa88('0x4b'),util['format'](_0xfa88('0x58'),path['basename'](_0xf8d614['file'][_0xfa88('0x55')],path['extname'](_0xf8d614['file'][_0xfa88('0x55')])),_0x5a961f[_0xfa88('0x48')]));logger['info'](_0xfa88('0x59'),_0x3fca15);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x420314);try{fs[_0xfa88('0x5a')](_0x3fca15,parseInt(_0xfa88('0x5b'),0x8));var _0xdf981b=sox['transcode'](_0x3fca15,_0x420314,{'sampleRate':0x1f40,'format':_0xfa88('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xdf981b['on'](_0xfa88('0x27'),function(_0x10dbe6){fs['unlinkSync'](_0x3fca15);_0x3b085e['status'](0x1f4)[_0xfa88('0x5c')](_0x10dbe6);});_0xdf981b['on'](_0xfa88('0x5d'),function(_0x34a036){_0x5a961f['original_duration']=isNaN(_0x34a036[_0xfa88('0x5e')])?null:_0x34a036[_0xfa88('0x5e')]*0x3e8;_0x5a961f[_0xfa88('0x5f')]=isNaN(_0x34a036['sampleCount'])?null:_0x34a036[_0xfa88('0x60')];_0x5a961f[_0xfa88('0x61')]=isNaN(_0x34a036['channelCount'])?null:_0x34a036['channelCount'];_0x5a961f[_0xfa88('0x62')]=isNaN(_0x34a036[_0xfa88('0x63')])?null:_0x34a036[_0xfa88('0x63')];_0x5a961f['original_sampleRate']=isNaN(_0x34a036[_0xfa88('0x64')])?null:_0x34a036[_0xfa88('0x64')];});_0xdf981b['on'](_0xfa88('0x65'),function(_0x3713ba){_0x5a961f[_0xfa88('0x66')]=isNaN(_0x3713ba[_0xfa88('0x5e')])?null:_0x3713ba[_0xfa88('0x5e')]*0x3e8;_0x5a961f[_0xfa88('0x67')]=isNaN(_0x3713ba[_0xfa88('0x60')])?null:_0x3713ba[_0xfa88('0x60')];_0x5a961f[_0xfa88('0x68')]=isNaN(_0x3713ba[_0xfa88('0x69')])?null:_0x3713ba[_0xfa88('0x69')];_0x5a961f[_0xfa88('0x6a')]=isNaN(_0x3713ba[_0xfa88('0x63')])?null:_0x3713ba['bitRate'];_0x5a961f[_0xfa88('0x6b')]=isNaN(_0x3713ba[_0xfa88('0x64')])?null:_0x3713ba[_0xfa88('0x64')];});_0xdf981b['on']('end',function(){fs[_0xfa88('0x5a')](_0x420314,parseInt('0777',0x8));return db[_0xfa88('0x2b')]['create'](_0x5a961f)[_0xfa88('0x22')](function(_0x36963){var _0xdfcca7={'role':_0xf8d614[_0xfa88('0x6c')][_0xfa88('0x6d')],'userProfileId':_0xf8d614[_0xfa88('0x6c')][_0xfa88('0x6e')]};if(!_0xdfcca7)throw new Error(_0xfa88('0x6f'));if(_0xdfcca7[_0xfa88('0x6d')]==='user'){var _0x3478ff=_0x36963[_0xfa88('0x24')]({'plain':!![]});return db[_0xfa88('0x70')][_0xfa88('0x43')]({'where':{'name':_0xfa88('0x25'),'userProfileId':_0xdfcca7[_0xfa88('0x6e')]},'raw':!![]})[_0xfa88('0x22')](function(_0x45b9f2){if(_0x45b9f2&&_0x45b9f2[_0xfa88('0x71')]===0x0){return db[_0xfa88('0x26')][_0xfa88('0x50')]({'name':_0x3478ff[_0xfa88('0x28')],'resourceId':_0x3478ff['id'],'type':_0x45b9f2[_0xfa88('0x28')],'sectionId':_0x45b9f2['id']},{})['then'](function(){return _0x36963;});}else{return _0x36963;}})['catch'](function(_0xcbe05f){logger[_0xfa88('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcbe05f);throw _0xcbe05f;});}return _0x36963;})[_0xfa88('0x22')](respondWithResult(_0x3b085e,null))[_0xfa88('0x44')](handleError(_0x3b085e,null));});_0xdf981b['start']();}catch(_0xb416f8){_0x3b085e['status'](0x1f4)[_0xfa88('0x5c')](_0xb416f8);}};exports[_0xfa88('0x21')]=function(_0x236982,_0x409a58,_0x39b3f8){return db[_0xfa88('0x2b')][_0xfa88('0x43')]({'where':{'id':_0x236982['params']['id']}})['then'](handleEntityNotFound(_0x409a58,null))[_0xfa88('0x22')](saveUpdates(_[_0xfa88('0x72')](_0x236982[_0xfa88('0x6c')],[_0xfa88('0x28'),'description']),null))['then'](respondWithResult(_0x409a58,null))[_0xfa88('0x44')](handleError(_0x409a58,null));};exports[_0xfa88('0x73')]=function(_0x4b495a,_0x60c049,_0x356a07){return db[_0xfa88('0x2b')][_0xfa88('0x43')]({'where':{'id':_0x4b495a[_0xfa88('0x46')]['id']}})[_0xfa88('0x22')](function(_0x11c0e3){if(_0x11c0e3){return _0x11c0e3[_0xfa88('0x23')]();}})[_0xfa88('0x22')](function(_0x1c696a){var _0x3d15f8=path['join'](config[_0xfa88('0x4e')],_0xfa88('0x74'),util[_0xfa88('0x4f')](_0xfa88('0x58'),_0x1c696a[_0xfa88('0x47')],_0x1c696a[_0xfa88('0x75')]));var _0x531682=path[_0xfa88('0x4a')](config[_0xfa88('0x4e')],_0xfa88('0x4b'),util[_0xfa88('0x4f')](_0xfa88('0x58'),_0x1c696a[_0xfa88('0x47')],_0x1c696a['converted_format']));fs[_0xfa88('0x76')](_0x3d15f8);fs[_0xfa88('0x76')](_0x531682);return _0x1c696a;})['then'](function(_0x584334){if(_0x584334){return _0x60c049['status'](0xcc)['end']();}})['then'](handleEntityNotFound(_0x60c049,null))[_0xfa88('0x44')](handleError(_0x60c049,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 5ed80ef..f6b0ffa 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 _0xc795=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','Sound','tools_sounds','lodash','../../config/logger'];(function(_0xe36206,_0x2cc107){var _0x44e619=function(_0x3021a8){while(--_0x3021a8){_0xe36206['push'](_0xe36206['shift']());}};_0x44e619(++_0x2cc107);}(_0xc795,0x143));var _0x5c79=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xc795[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x5c79('0x0'));var util=require('util');var logger=require(_0x5c79('0x1'))(_0x5c79('0x2'));var moment=require(_0x5c79('0x3'));var BPromise=require(_0x5c79('0x4'));var rp=require(_0x5c79('0x5'));var fs=require('fs');var path=require(_0x5c79('0x6'));var rimraf=require(_0x5c79('0x7'));var config=require(_0x5c79('0x8'));var attributes=require(_0x5c79('0x9'));module[_0x5c79('0xa')]=function(_0x37bfd0,_0x86b044){return _0x37bfd0['define'](_0x5c79('0xb'),attributes,{'tableName':_0x5c79('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f80=['rimraf','../../config/environment','./sound.attributes','exports','define','Sound','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x1f80,0x172));var _0x01f8=function(_0x1dcf61,_0x595054){_0x1dcf61=_0x1dcf61-0x0;var _0x176cdf=_0x1f80[_0x1dcf61];return _0x176cdf;};'use strict';var _=require(_0x01f8('0x0'));var util=require('util');var logger=require(_0x01f8('0x1'))(_0x01f8('0x2'));var moment=require(_0x01f8('0x3'));var BPromise=require(_0x01f8('0x4'));var rp=require(_0x01f8('0x5'));var fs=require('fs');var path=require(_0x01f8('0x6'));var rimraf=require(_0x01f8('0x7'));var config=require(_0x01f8('0x8'));var attributes=require(_0x01f8('0x9'));module[_0x01f8('0xa')]=function(_0x28e0c5,_0x5c5216){return _0x28e0c5[_0x01f8('0xb')](_0x01f8('0xc'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index ae6f81a..27ea519 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 _0xa4b1=['Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','find','options','raw','where','attributes','include','map','model','ShowSound','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1900bd,_0x48a6b6){var _0x5c162e=function(_0x17240c){while(--_0x17240c){_0x1900bd['push'](_0x1900bd['shift']());}};_0x5c162e(++_0x48a6b6);}(_0xa4b1,0x144));var _0x1a4b=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa4b1[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x1a4b('0x0'));var util=require('util');var moment=require(_0x1a4b('0x1'));var BPromise=require(_0x1a4b('0x2'));var rs=require(_0x1a4b('0x3'));var fs=require('fs');var Redis=require(_0x1a4b('0x4'));var db=require(_0x1a4b('0x5'))['db'];var utils=require(_0x1a4b('0x6'));var logger=require(_0x1a4b('0x7'))(_0x1a4b('0x8'));var config=require(_0x1a4b('0x9'));var jayson=require(_0x1a4b('0xa'));var client=jayson[_0x1a4b('0xb')][_0x1a4b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c66fe,_0x5040c4,_0x135118){return new BPromise(function(_0x24324d,_0x33f85a){return client[_0x1a4b('0xd')](_0x1c66fe,_0x135118)[_0x1a4b('0xe')](function(_0x1e2412){logger[_0x1a4b('0xf')](_0x1a4b('0x10'),_0x5040c4,_0x1a4b('0x11'));logger[_0x1a4b('0x12')](_0x1a4b('0x13'),_0x5040c4,_0x1a4b('0x11'),JSON[_0x1a4b('0x14')](_0x1e2412));if(_0x1e2412['error']){if(_0x1e2412[_0x1a4b('0x15')]['code']===0x1f4){logger['error'](_0x1a4b('0x10'),_0x5040c4,_0x1e2412[_0x1a4b('0x15')][_0x1a4b('0x16')]);return _0x33f85a(_0x1e2412[_0x1a4b('0x15')]['message']);}logger['error']('Sound,\x20%s,\x20%s',_0x5040c4,_0x1e2412['error'][_0x1a4b('0x16')]);return _0x24324d(_0x1e2412[_0x1a4b('0x15')][_0x1a4b('0x16')]);}else{logger[_0x1a4b('0xf')]('Sound,\x20%s,\x20%s',_0x5040c4,_0x1a4b('0x11'));_0x24324d(_0x1e2412[_0x1a4b('0x17')][_0x1a4b('0x16')]);}})[_0x1a4b('0x18')](function(_0x3bf9fa){logger['error'](_0x1a4b('0x10'),_0x5040c4,_0x3bf9fa);_0x33f85a(_0x3bf9fa);});});}exports['ShowSound']=function(_0x43310f){var _0x2e7e96=this;return new Promise(function(_0x3cabfc,_0x2c1a73){return db['Sound'][_0x1a4b('0x19')]({'raw':_0x43310f['options']?_0x43310f[_0x1a4b('0x1a')][_0x1a4b('0x1b')]===undefined?!![]:![]:!![],'where':_0x43310f[_0x1a4b('0x1a')]?_0x43310f[_0x1a4b('0x1a')][_0x1a4b('0x1c')]||null:null,'attributes':_0x43310f[_0x1a4b('0x1a')]?_0x43310f[_0x1a4b('0x1a')][_0x1a4b('0x1d')]||null:null,'include':_0x43310f[_0x1a4b('0x1a')]?_0x43310f[_0x1a4b('0x1a')][_0x1a4b('0x1e')]?_[_0x1a4b('0x1f')](_0x43310f[_0x1a4b('0x1a')]['include'],function(_0x3f756c){return{'model':db[_0x3f756c[_0x1a4b('0x20')]],'as':_0x3f756c['as'],'attributes':_0x3f756c[_0x1a4b('0x1d')],'include':_0x3f756c['include']?_[_0x1a4b('0x1f')](_0x3f756c[_0x1a4b('0x1e')],function(_0x501d55){return{'model':db[_0x501d55[_0x1a4b('0x20')]],'as':_0x501d55['as'],'attributes':_0x501d55[_0x1a4b('0x1d')],'include':_0x501d55[_0x1a4b('0x1e')]?_[_0x1a4b('0x1f')](_0x501d55['include'],function(_0x35a07e){return{'model':db[_0x35a07e['model']],'as':_0x35a07e['as'],'attributes':_0x35a07e[_0x1a4b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dbf43){logger[_0x1a4b('0xf')](_0x1a4b('0x21'),_0x43310f);logger[_0x1a4b('0x12')](_0x1a4b('0x21'),_0x43310f,JSON[_0x1a4b('0x14')](_0x2dbf43));_0x3cabfc(_0x2dbf43);})[_0x1a4b('0x18')](function(_0x226cb7){logger[_0x1a4b('0x15')](_0x1a4b('0x21'),_0x226cb7[_0x1a4b('0x16')],_0x43310f);_0x2c1a73(_0x2e7e96['error'](0x1f4,_0x226cb7[_0x1a4b('0x16')]));});});}; \ No newline at end of file +var _0xcb49=['error','code','message','find','options','raw','where','attributes','include','map','model','ShowSound','util','moment','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x32c171,_0x5b06d7){var _0xe37209=function(_0x170a8){while(--_0x170a8){_0x32c171['push'](_0x32c171['shift']());}};_0xe37209(++_0x5b06d7);}(_0xcb49,0x1d7));var _0x9cb4=function(_0x40bdbc,_0x3fabcd){_0x40bdbc=_0x40bdbc-0x0;var _0xc603a8=_0xcb49[_0x40bdbc];return _0xc603a8;};'use strict';var _=require('lodash');var util=require(_0x9cb4('0x0'));var moment=require(_0x9cb4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cb4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9cb4('0x3'));var logger=require('../../config/logger')(_0x9cb4('0x4'));var config=require(_0x9cb4('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x9cb4('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x452756,_0x56d103,_0x1984ef){return new BPromise(function(_0x3abfd3,_0x43f30d){return client[_0x9cb4('0x7')](_0x452756,_0x1984ef)[_0x9cb4('0x8')](function(_0xad303b){logger[_0x9cb4('0x9')](_0x9cb4('0xa'),_0x56d103,_0x9cb4('0xb'));logger[_0x9cb4('0xc')](_0x9cb4('0xd'),_0x56d103,_0x9cb4('0xb'),JSON[_0x9cb4('0xe')](_0xad303b));if(_0xad303b[_0x9cb4('0xf')]){if(_0xad303b[_0x9cb4('0xf')][_0x9cb4('0x10')]===0x1f4){logger['error'](_0x9cb4('0xa'),_0x56d103,_0xad303b[_0x9cb4('0xf')][_0x9cb4('0x11')]);return _0x43f30d(_0xad303b[_0x9cb4('0xf')]['message']);}logger[_0x9cb4('0xf')]('Sound,\x20%s,\x20%s',_0x56d103,_0xad303b[_0x9cb4('0xf')]['message']);return _0x3abfd3(_0xad303b[_0x9cb4('0xf')][_0x9cb4('0x11')]);}else{logger['info'](_0x9cb4('0xa'),_0x56d103,_0x9cb4('0xb'));_0x3abfd3(_0xad303b['result']['message']);}})['catch'](function(_0xb65699){logger['error']('Sound,\x20%s,\x20%s',_0x56d103,_0xb65699);_0x43f30d(_0xb65699);});});}exports['ShowSound']=function(_0x2cb675){var _0x4b6a02=this;return new Promise(function(_0x3b39a9,_0x21f996){return db['Sound'][_0x9cb4('0x12')]({'raw':_0x2cb675[_0x9cb4('0x13')]?_0x2cb675[_0x9cb4('0x13')][_0x9cb4('0x14')]===undefined?!![]:![]:!![],'where':_0x2cb675[_0x9cb4('0x13')]?_0x2cb675[_0x9cb4('0x13')][_0x9cb4('0x15')]||null:null,'attributes':_0x2cb675[_0x9cb4('0x13')]?_0x2cb675[_0x9cb4('0x13')][_0x9cb4('0x16')]||null:null,'include':_0x2cb675[_0x9cb4('0x13')]?_0x2cb675[_0x9cb4('0x13')][_0x9cb4('0x17')]?_[_0x9cb4('0x18')](_0x2cb675[_0x9cb4('0x13')][_0x9cb4('0x17')],function(_0x2a08ac){return{'model':db[_0x2a08ac['model']],'as':_0x2a08ac['as'],'attributes':_0x2a08ac[_0x9cb4('0x16')],'include':_0x2a08ac[_0x9cb4('0x17')]?_[_0x9cb4('0x18')](_0x2a08ac['include'],function(_0x4ee218){return{'model':db[_0x4ee218[_0x9cb4('0x19')]],'as':_0x4ee218['as'],'attributes':_0x4ee218[_0x9cb4('0x16')],'include':_0x4ee218[_0x9cb4('0x17')]?_[_0x9cb4('0x18')](_0x4ee218[_0x9cb4('0x17')],function(_0x35964b){return{'model':db[_0x35964b['model']],'as':_0x35964b['as'],'attributes':_0x35964b['attributes']};}):[]};}):[]};}):[]:[]})[_0x9cb4('0x8')](function(_0xbfc939){logger['info'](_0x9cb4('0x1a'),_0x2cb675);logger['debug'](_0x9cb4('0x1a'),_0x2cb675,JSON[_0x9cb4('0xe')](_0xbfc939));_0x3b39a9(_0xbfc939);})['catch'](function(_0x2731d8){logger[_0x9cb4('0xf')](_0x9cb4('0x1a'),_0x2731d8['message'],_0x2cb675);_0x21f996(_0x4b6a02[_0x9cb4('0xf')](0x1f4,_0x2731d8[_0x9cb4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 04d502d..0e9d6a9 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 _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x47459b,_0x8a1a7a){var _0x17bf72=function(_0x2e8604){while(--_0x2e8604){_0x47459b['push'](_0x47459b['shift']());}};_0x17bf72(++_0x8a1a7a);}(_0x757a,0xde));var _0xa757=function(_0x34cb5a,_0x2ebf7a){_0x34cb5a=_0x34cb5a-0x0;var _0x27614f=_0x757a[_0x34cb5a];return _0x27614f;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x41b4a9,_0x2a6605){var _0x4a0854=function(_0x16c60e){while(--_0x16c60e){_0x41b4a9['push'](_0x41b4a9['shift']());}};_0x4a0854(++_0x2a6605);}(_0x5eb8,0xb0));var _0x85eb=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x5eb8[_0x47b15f];return _0x55bf25;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index ef434b7..b7c074a 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 _0xf836=['sequelize','STRING','TEXT','medium','out'];(function(_0x2975ec,_0x3497e9){var _0x2d7835=function(_0xcc4298){while(--_0xcc4298){_0x2975ec['push'](_0x2975ec['shift']());}};_0x2d7835(++_0x3497e9);}(_0xf836,0x172));var _0x6f83=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf836[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6f83('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6f83('0x1')]},'body':{'type':Sequelize[_0x6f83('0x2')](_0x6f83('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6f83('0x4')),'defaultValue':_0x6f83('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6f83('0x1')]},'providerResponse':{'type':Sequelize[_0x6f83('0x2')]}}; \ No newline at end of file +var _0x0bcb=['exports','STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x369c5a,_0x2cc6cd){var _0x212aa4=function(_0x771b5d){while(--_0x771b5d){_0x369c5a['push'](_0x369c5a['shift']());}};_0x212aa4(++_0x2cc6cd);}(_0x0bcb,0x109));var _0xb0bc=function(_0x1e49a7,_0x38d39a){_0x1e49a7=_0x1e49a7-0x0;var _0x3245ac=_0x0bcb[_0x1e49a7];return _0x3245ac;};'use strict';var Sequelize=require(_0xb0bc('0x0'));module[_0xb0bc('0x1')]={'uniqueid':{'type':Sequelize[_0xb0bc('0x2')]},'body':{'type':Sequelize[_0xb0bc('0x3')](_0xb0bc('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xb0bc('0x5')]('in','out'),'defaultValue':_0xb0bc('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0xb0bc('0x2')]},'providerResponse':{'type':Sequelize[_0xb0bc('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 51e0bbe..90e7e3e 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 _0xad07=['rows','show','options','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','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','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','update','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','VIRTUAL','filter','merge','SquareMessage','then','includeAll','include'];(function(_0x6594d4,_0x9724a1){var _0x560069=function(_0x19f9e7){while(--_0x19f9e7){_0x6594d4['push'](_0x6594d4['shift']());}};_0x560069(++_0x9724a1);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7ad0('0x0'));var rimraf=require(_0x7ad0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ad0('0x2'));var rp=require(_0x7ad0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7ad0('0x4'));var util=require(_0x7ad0('0x5'));var path=require(_0x7ad0('0x6'));var sox=require('sox');var csv=require(_0x7ad0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ad0('0x8'));var squel=require(_0x7ad0('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7ad0('0xa'));var toCsv=require(_0x7ad0('0x7'));var querystring=require('querystring');var Papa=require(_0x7ad0('0xb'));var Redis=require(_0x7ad0('0xc'));var authService=require(_0x7ad0('0xd'));var qs=require(_0x7ad0('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ad0('0xf'));var logger=require(_0x7ad0('0x10'))(_0x7ad0('0x11'));var utils=require(_0x7ad0('0x12'));var config=require(_0x7ad0('0x13'));var licenseUtil=require(_0x7ad0('0x14'));var db=require(_0x7ad0('0x15'))['db'];function respondWithStatusCode(_0x30d2af,_0x5e1389){_0x5e1389=_0x5e1389||0xcc;return function(_0x572905){if(_0x572905){return _0x30d2af[_0x7ad0('0x16')](_0x5e1389);}return _0x30d2af[_0x7ad0('0x17')](_0x5e1389)[_0x7ad0('0x18')]();};}function respondWithResult(_0x1478e6,_0x51fed3){_0x51fed3=_0x51fed3||0xc8;return function(_0x53cdff){if(_0x53cdff){return _0x1478e6[_0x7ad0('0x17')](_0x51fed3)[_0x7ad0('0x19')](_0x53cdff);}};}function respondWithFilteredResult(_0x456226,_0xcecbc1){return function(_0xebb4da){if(_0xebb4da){var _0x901908=typeof _0xcecbc1[_0x7ad0('0x1a')]===_0x7ad0('0x1b')&&typeof _0xcecbc1['limit']===_0x7ad0('0x1b');var _0x40fa9c=_0xebb4da['count'];var _0x4f45e4=_0x901908?0x0:_0xcecbc1[_0x7ad0('0x1a')];var _0x4f9d6b=_0x901908?_0xebb4da[_0x7ad0('0x1c')]:_0xcecbc1[_0x7ad0('0x1a')]+_0xcecbc1['limit'];var _0x126454;if(_0x4f9d6b>=_0x40fa9c){_0x4f9d6b=_0x40fa9c;_0x126454=0xc8;}else{_0x126454=0xce;}_0x456226['status'](_0x126454);return _0x456226[_0x7ad0('0x1d')]('Content-Range',_0x4f45e4+'-'+_0x4f9d6b+'/'+_0x40fa9c)[_0x7ad0('0x19')](_0xebb4da);}return null;};}function patchUpdates(_0x1795e5){return function(_0x1c5c7c){try{jsonpatch[_0x7ad0('0x1e')](_0x1c5c7c,_0x1795e5,!![]);}catch(_0x481eeb){return BPromise[_0x7ad0('0x1f')](_0x481eeb);}return _0x1c5c7c['save']();};}function saveUpdates(_0x291352,_0x304054){return function(_0x5df5c8){if(_0x5df5c8){return _0x5df5c8[_0x7ad0('0x20')](_0x291352)['then'](function(_0x5edbdf){return _0x5edbdf;});}return null;};}function removeEntity(_0x4be2a0,_0x1d9a26){return function(_0x4fbe51){if(_0x4fbe51){return _0x4fbe51[_0x7ad0('0x21')]()['then'](function(){_0x4be2a0[_0x7ad0('0x17')](0xcc)[_0x7ad0('0x18')]();});}};}function handleEntityNotFound(_0x3894a7,_0x319644){return function(_0x103222){if(!_0x103222){_0x3894a7[_0x7ad0('0x16')](0x194);}return _0x103222;};}function handleError(_0x51716e,_0x14ca11){_0x14ca11=_0x14ca11||0x1f4;return function(_0xf9c854){logger[_0x7ad0('0x22')](_0xf9c854[_0x7ad0('0x23')]);if(_0xf9c854[_0x7ad0('0x24')]){delete _0xf9c854[_0x7ad0('0x24')];}_0x51716e[_0x7ad0('0x17')](_0x14ca11)[_0x7ad0('0x25')](_0xf9c854);};}exports['index']=function(_0x5196df,_0x2b2e49){var _0x380eb3={},_0x8150f5={},_0x21e083={'count':0x0,'rows':[]};var _0x2b0b1e=_['map'](db['SquareMessage'][_0x7ad0('0x26')],function(_0x1b4028){return{'name':_0x1b4028[_0x7ad0('0x27')],'type':_0x1b4028[_0x7ad0('0x28')][_0x7ad0('0x29')]};});_0x8150f5[_0x7ad0('0x2a')]=_[_0x7ad0('0x2b')](_0x2b0b1e,_0x7ad0('0x24'));_0x8150f5[_0x7ad0('0x2c')]=_[_0x7ad0('0x2d')](_0x5196df['query']);_0x8150f5['filters']=_[_0x7ad0('0x2e')](_0x8150f5[_0x7ad0('0x2a')],_0x8150f5[_0x7ad0('0x2c')]);_0x380eb3[_0x7ad0('0x2f')]=_[_0x7ad0('0x2e')](_0x8150f5[_0x7ad0('0x2a')],qs[_0x7ad0('0x30')](_0x5196df[_0x7ad0('0x2c')][_0x7ad0('0x30')]));_0x380eb3[_0x7ad0('0x2f')]=_0x380eb3[_0x7ad0('0x2f')][_0x7ad0('0x31')]?_0x380eb3[_0x7ad0('0x2f')]:_0x8150f5['model'];if(!_0x5196df[_0x7ad0('0x2c')][_0x7ad0('0x32')](_0x7ad0('0x33'))){_0x380eb3[_0x7ad0('0x34')]=qs[_0x7ad0('0x34')](_0x5196df[_0x7ad0('0x2c')][_0x7ad0('0x34')]);_0x380eb3[_0x7ad0('0x1a')]=qs[_0x7ad0('0x1a')](_0x5196df[_0x7ad0('0x2c')]['offset']);}_0x380eb3[_0x7ad0('0x35')]=qs['sort'](_0x5196df[_0x7ad0('0x2c')][_0x7ad0('0x36')]);_0x380eb3[_0x7ad0('0x37')]=qs['filters'](_[_0x7ad0('0x38')](_0x5196df[_0x7ad0('0x2c')],_0x8150f5[_0x7ad0('0x39')]),_0x2b0b1e);if(_0x5196df[_0x7ad0('0x2c')]['filter']){_0x380eb3[_0x7ad0('0x37')]=_['merge'](_0x380eb3['where'],{'$or':_[_0x7ad0('0x2b')](_0x2b0b1e,function(_0x56f6a0){if(_0x56f6a0['type']!==_0x7ad0('0x3a')){var _0x1faccd={};_0x1faccd[_0x56f6a0[_0x7ad0('0x24')]]={'$like':'%'+_0x5196df[_0x7ad0('0x2c')][_0x7ad0('0x3b')]+'%'};return _0x1faccd;}})});}_0x380eb3=_[_0x7ad0('0x3c')]({},_0x380eb3,_0x5196df['options']);var _0x448962={'where':_0x380eb3[_0x7ad0('0x37')]};return db[_0x7ad0('0x3d')]['count'](_0x448962)[_0x7ad0('0x3e')](function(_0x3c92d5){_0x21e083[_0x7ad0('0x1c')]=_0x3c92d5;if(_0x5196df['query'][_0x7ad0('0x3f')]){_0x380eb3[_0x7ad0('0x40')]=[{'all':!![]}];}return db[_0x7ad0('0x3d')]['findAll'](_0x380eb3);})['then'](function(_0x1e73d6){_0x21e083[_0x7ad0('0x41')]=_0x1e73d6;return _0x21e083;})['then'](respondWithFilteredResult(_0x2b2e49,_0x380eb3))['catch'](handleError(_0x2b2e49,null));};exports[_0x7ad0('0x42')]=function(_0x267644,_0x448fe6){var _0x43dbd2={'raw':!![],'where':{'id':_0x267644['params']['id']}},_0x5f5959={};_0x5f5959['model']=_[_0x7ad0('0x2d')](db[_0x7ad0('0x3d')][_0x7ad0('0x26')]);_0x5f5959[_0x7ad0('0x2c')]=_['keys'](_0x267644[_0x7ad0('0x2c')]);_0x5f5959[_0x7ad0('0x39')]=_['intersection'](_0x5f5959['model'],_0x5f5959[_0x7ad0('0x2c')]);_0x43dbd2['attributes']=_['intersection'](_0x5f5959[_0x7ad0('0x2a')],qs[_0x7ad0('0x30')](_0x267644[_0x7ad0('0x2c')][_0x7ad0('0x30')]));_0x43dbd2[_0x7ad0('0x2f')]=_0x43dbd2[_0x7ad0('0x2f')][_0x7ad0('0x31')]?_0x43dbd2['attributes']:_0x5f5959[_0x7ad0('0x2a')];if(_0x267644['query']['includeAll']){_0x43dbd2[_0x7ad0('0x40')]=[{'all':!![]}];}_0x43dbd2=_[_0x7ad0('0x3c')]({},_0x43dbd2,_0x267644[_0x7ad0('0x43')]);return db[_0x7ad0('0x3d')][_0x7ad0('0x44')](_0x43dbd2)[_0x7ad0('0x3e')](handleEntityNotFound(_0x448fe6,null))[_0x7ad0('0x3e')](respondWithResult(_0x448fe6,null))[_0x7ad0('0x45')](handleError(_0x448fe6,null));};exports['create']=function(_0x313397,_0x24372d){return db[_0x7ad0('0x3d')][_0x7ad0('0x46')](_0x313397[_0x7ad0('0x47')],{})[_0x7ad0('0x3e')](respondWithResult(_0x24372d,0xc9))[_0x7ad0('0x45')](handleError(_0x24372d,null));};exports[_0x7ad0('0x20')]=function(_0x2677be,_0x23b613){if(_0x2677be['body']['id']){delete _0x2677be['body']['id'];}return db[_0x7ad0('0x3d')][_0x7ad0('0x44')]({'where':{'id':_0x2677be[_0x7ad0('0x48')]['id']}})[_0x7ad0('0x3e')](handleEntityNotFound(_0x23b613,null))[_0x7ad0('0x3e')](saveUpdates(_0x2677be[_0x7ad0('0x47')],null))[_0x7ad0('0x3e')](respondWithResult(_0x23b613,null))[_0x7ad0('0x45')](handleError(_0x23b613,null));};exports[_0x7ad0('0x21')]=function(_0x61d8ac,_0x4ea6d6){return db[_0x7ad0('0x3d')][_0x7ad0('0x44')]({'where':{'id':_0x61d8ac[_0x7ad0('0x48')]['id']}})['then'](handleEntityNotFound(_0x4ea6d6,null))[_0x7ad0('0x3e')](removeEntity(_0x4ea6d6,null))[_0x7ad0('0x45')](handleError(_0x4ea6d6,null));}; \ No newline at end of file +var _0x6cac=['findAll','rows','show','params','options','find','catch','create','body','eml-format','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','send','index','map','SquareMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include'];(function(_0x2aea4f,_0x5b6f9b){var _0x2648bf=function(_0x8e4b93){while(--_0x8e4b93){_0x2aea4f['push'](_0x2aea4f['shift']());}};_0x2648bf(++_0x5b6f9b);}(_0x6cac,0xe7));var _0xc6ca=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x6cac[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0xc6ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6ca('0x1'));var jsonpatch=require(_0xc6ca('0x2'));var rp=require(_0xc6ca('0x3'));var moment=require(_0xc6ca('0x4'));var BPromise=require(_0xc6ca('0x5'));var Mustache=require('mustache');var util=require(_0xc6ca('0x6'));var path=require(_0xc6ca('0x7'));var sox=require(_0xc6ca('0x8'));var csv=require(_0xc6ca('0x9'));var ejs=require(_0xc6ca('0xa'));var fs=require('fs');var fs_extra=require(_0xc6ca('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc6ca('0xc'));var jsforce=require(_0xc6ca('0xd'));var deskjs=require(_0xc6ca('0xe'));var toCsv=require(_0xc6ca('0x9'));var querystring=require('querystring');var Papa=require(_0xc6ca('0xf'));var Redis=require(_0xc6ca('0x10'));var authService=require(_0xc6ca('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc6ca('0x12'));var hardwareService=require(_0xc6ca('0x13'));var logger=require('../../config/logger')(_0xc6ca('0x14'));var utils=require(_0xc6ca('0x15'));var config=require(_0xc6ca('0x16'));var licenseUtil=require(_0xc6ca('0x17'));var db=require(_0xc6ca('0x18'))['db'];function respondWithStatusCode(_0x2d25d7,_0xf8f9b9){_0xf8f9b9=_0xf8f9b9||0xcc;return function(_0x3a2494){if(_0x3a2494){return _0x2d25d7['sendStatus'](_0xf8f9b9);}return _0x2d25d7[_0xc6ca('0x19')](_0xf8f9b9)[_0xc6ca('0x1a')]();};}function respondWithResult(_0x169714,_0x4b97fb){_0x4b97fb=_0x4b97fb||0xc8;return function(_0x568c38){if(_0x568c38){return _0x169714[_0xc6ca('0x19')](_0x4b97fb)['json'](_0x568c38);}};}function respondWithFilteredResult(_0x4ead4d,_0xe18468){return function(_0x256ebf){if(_0x256ebf){var _0x494ab1=typeof _0xe18468[_0xc6ca('0x1b')]===_0xc6ca('0x1c')&&typeof _0xe18468[_0xc6ca('0x1d')]===_0xc6ca('0x1c');var _0x11d7a9=_0x256ebf[_0xc6ca('0x1e')];var _0x1e566a=_0x494ab1?0x0:_0xe18468['offset'];var _0x198468=_0x494ab1?_0x256ebf[_0xc6ca('0x1e')]:_0xe18468[_0xc6ca('0x1b')]+_0xe18468[_0xc6ca('0x1d')];var _0x3fc168;if(_0x198468>=_0x11d7a9){_0x198468=_0x11d7a9;_0x3fc168=0xc8;}else{_0x3fc168=0xce;}_0x4ead4d[_0xc6ca('0x19')](_0x3fc168);return _0x4ead4d[_0xc6ca('0x1f')](_0xc6ca('0x20'),_0x1e566a+'-'+_0x198468+'/'+_0x11d7a9)['json'](_0x256ebf);}return null;};}function patchUpdates(_0x58c13c){return function(_0xe33db0){try{jsonpatch[_0xc6ca('0x21')](_0xe33db0,_0x58c13c,!![]);}catch(_0x29cfee){return BPromise[_0xc6ca('0x22')](_0x29cfee);}return _0xe33db0['save']();};}function saveUpdates(_0x438cbf,_0x23f108){return function(_0x422e90){if(_0x422e90){return _0x422e90['update'](_0x438cbf)[_0xc6ca('0x23')](function(_0x298032){return _0x298032;});}return null;};}function removeEntity(_0x5bbc4e,_0x40b99b){return function(_0x49d214){if(_0x49d214){return _0x49d214[_0xc6ca('0x24')]()[_0xc6ca('0x23')](function(){_0x5bbc4e[_0xc6ca('0x19')](0xcc)[_0xc6ca('0x1a')]();});}};}function handleEntityNotFound(_0x5d4157,_0x214eb9){return function(_0x5bb6b9){if(!_0x5bb6b9){_0x5d4157[_0xc6ca('0x25')](0x194);}return _0x5bb6b9;};}function handleError(_0x1a084b,_0x4e91e2){_0x4e91e2=_0x4e91e2||0x1f4;return function(_0x344d56){logger['error'](_0x344d56[_0xc6ca('0x26')]);if(_0x344d56[_0xc6ca('0x27')]){delete _0x344d56[_0xc6ca('0x27')];}_0x1a084b[_0xc6ca('0x19')](_0x4e91e2)[_0xc6ca('0x28')](_0x344d56);};}exports[_0xc6ca('0x29')]=function(_0x3b2d55,_0x17b4b2){var _0x4b256b={},_0x43a8d0={},_0x4fe1e5={'count':0x0,'rows':[]};var _0x20688a=_[_0xc6ca('0x2a')](db[_0xc6ca('0x2b')][_0xc6ca('0x2c')],function(_0x1e5a62){return{'name':_0x1e5a62['fieldName'],'type':_0x1e5a62[_0xc6ca('0x2d')]['key']};});_0x43a8d0[_0xc6ca('0x2e')]=_['map'](_0x20688a,_0xc6ca('0x27'));_0x43a8d0[_0xc6ca('0x2f')]=_[_0xc6ca('0x30')](_0x3b2d55['query']);_0x43a8d0[_0xc6ca('0x31')]=_[_0xc6ca('0x32')](_0x43a8d0['model'],_0x43a8d0['query']);_0x4b256b[_0xc6ca('0x33')]=_[_0xc6ca('0x32')](_0x43a8d0[_0xc6ca('0x2e')],qs[_0xc6ca('0x34')](_0x3b2d55[_0xc6ca('0x2f')][_0xc6ca('0x34')]));_0x4b256b[_0xc6ca('0x33')]=_0x4b256b[_0xc6ca('0x33')][_0xc6ca('0x35')]?_0x4b256b[_0xc6ca('0x33')]:_0x43a8d0[_0xc6ca('0x2e')];if(!_0x3b2d55['query'][_0xc6ca('0x36')](_0xc6ca('0x37'))){_0x4b256b['limit']=qs[_0xc6ca('0x1d')](_0x3b2d55['query'][_0xc6ca('0x1d')]);_0x4b256b[_0xc6ca('0x1b')]=qs[_0xc6ca('0x1b')](_0x3b2d55['query']['offset']);}_0x4b256b[_0xc6ca('0x38')]=qs[_0xc6ca('0x39')](_0x3b2d55['query'][_0xc6ca('0x39')]);_0x4b256b[_0xc6ca('0x3a')]=qs['filters'](_[_0xc6ca('0x3b')](_0x3b2d55[_0xc6ca('0x2f')],_0x43a8d0[_0xc6ca('0x31')]),_0x20688a);if(_0x3b2d55[_0xc6ca('0x2f')][_0xc6ca('0x3c')]){_0x4b256b[_0xc6ca('0x3a')]=_[_0xc6ca('0x3d')](_0x4b256b['where'],{'$or':_['map'](_0x20688a,function(_0x10c7a2){if(_0x10c7a2[_0xc6ca('0x2d')]!==_0xc6ca('0x3e')){var _0x4905e2={};_0x4905e2[_0x10c7a2['name']]={'$like':'%'+_0x3b2d55[_0xc6ca('0x2f')][_0xc6ca('0x3c')]+'%'};return _0x4905e2;}})});}_0x4b256b=_[_0xc6ca('0x3d')]({},_0x4b256b,_0x3b2d55['options']);var _0x3c0ea1={'where':_0x4b256b[_0xc6ca('0x3a')]};return db['SquareMessage']['count'](_0x3c0ea1)[_0xc6ca('0x23')](function(_0x9b9c53){_0x4fe1e5[_0xc6ca('0x1e')]=_0x9b9c53;if(_0x3b2d55[_0xc6ca('0x2f')][_0xc6ca('0x3f')]){_0x4b256b[_0xc6ca('0x40')]=[{'all':!![]}];}return db[_0xc6ca('0x2b')][_0xc6ca('0x41')](_0x4b256b);})[_0xc6ca('0x23')](function(_0x1892c0){_0x4fe1e5[_0xc6ca('0x42')]=_0x1892c0;return _0x4fe1e5;})[_0xc6ca('0x23')](respondWithFilteredResult(_0x17b4b2,_0x4b256b))['catch'](handleError(_0x17b4b2,null));};exports[_0xc6ca('0x43')]=function(_0x594c0a,_0x4fc439){var _0x179813={'raw':!![],'where':{'id':_0x594c0a[_0xc6ca('0x44')]['id']}},_0x41b592={};_0x41b592['model']=_[_0xc6ca('0x30')](db[_0xc6ca('0x2b')]['rawAttributes']);_0x41b592[_0xc6ca('0x2f')]=_['keys'](_0x594c0a[_0xc6ca('0x2f')]);_0x41b592['filters']=_[_0xc6ca('0x32')](_0x41b592[_0xc6ca('0x2e')],_0x41b592[_0xc6ca('0x2f')]);_0x179813['attributes']=_[_0xc6ca('0x32')](_0x41b592[_0xc6ca('0x2e')],qs[_0xc6ca('0x34')](_0x594c0a[_0xc6ca('0x2f')][_0xc6ca('0x34')]));_0x179813[_0xc6ca('0x33')]=_0x179813['attributes']['length']?_0x179813[_0xc6ca('0x33')]:_0x41b592[_0xc6ca('0x2e')];if(_0x594c0a['query']['includeAll']){_0x179813[_0xc6ca('0x40')]=[{'all':!![]}];}_0x179813=_[_0xc6ca('0x3d')]({},_0x179813,_0x594c0a[_0xc6ca('0x45')]);return db[_0xc6ca('0x2b')][_0xc6ca('0x46')](_0x179813)['then'](handleEntityNotFound(_0x4fc439,null))['then'](respondWithResult(_0x4fc439,null))[_0xc6ca('0x47')](handleError(_0x4fc439,null));};exports[_0xc6ca('0x48')]=function(_0x299c85,_0x5f20ab){return db[_0xc6ca('0x2b')][_0xc6ca('0x48')](_0x299c85[_0xc6ca('0x49')],{})[_0xc6ca('0x23')](respondWithResult(_0x5f20ab,0xc9))['catch'](handleError(_0x5f20ab,null));};exports['update']=function(_0x2dd706,_0x4bb404){if(_0x2dd706['body']['id']){delete _0x2dd706[_0xc6ca('0x49')]['id'];}return db[_0xc6ca('0x2b')][_0xc6ca('0x46')]({'where':{'id':_0x2dd706['params']['id']}})[_0xc6ca('0x23')](handleEntityNotFound(_0x4bb404,null))[_0xc6ca('0x23')](saveUpdates(_0x2dd706[_0xc6ca('0x49')],null))['then'](respondWithResult(_0x4bb404,null))[_0xc6ca('0x47')](handleError(_0x4bb404,null));};exports[_0xc6ca('0x24')]=function(_0x163209,_0x22f9f4){return db[_0xc6ca('0x2b')]['find']({'where':{'id':_0x163209[_0xc6ca('0x44')]['id']}})[_0xc6ca('0x23')](handleEntityNotFound(_0x22f9f4,null))[_0xc6ca('0x23')](removeEntity(_0x22f9f4,null))[_0xc6ca('0x47')](handleError(_0x22f9f4,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index e2c8d4e..3d31da2 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 _0x07f5=['define','SquareMessage','square_messages','lodash','util','../../config/logger','api','path','rimraf','./squareMessage.attributes','exports'];(function(_0x118733,_0x2bd820){var _0x4777af=function(_0x52886a){while(--_0x52886a){_0x118733['push'](_0x118733['shift']());}};_0x4777af(++_0x2bd820);}(_0x07f5,0xb3));var _0x507f=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x07f5[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x507f('0x0'));var util=require(_0x507f('0x1'));var logger=require(_0x507f('0x2'))(_0x507f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x507f('0x4'));var rimraf=require(_0x507f('0x5'));var config=require('../../config/environment');var attributes=require(_0x507f('0x6'));module[_0x507f('0x7')]=function(_0x470e61,_0x16f715){return _0x470e61[_0x507f('0x8')](_0x507f('0x9'),attributes,{'tableName':_0x507f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc52d=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','square_messages','lodash'];(function(_0x5db148,_0x31ad8f){var _0x3c7480=function(_0x3a6d45){while(--_0x3a6d45){_0x5db148['push'](_0x5db148['shift']());}};_0x3c7480(++_0x31ad8f);}(_0xc52d,0x6b));var _0xdc52=function(_0x47ca78,_0x51aaf7){_0x47ca78=_0x47ca78-0x0;var _0x3a5a5d=_0xc52d[_0x47ca78];return _0x3a5a5d;};'use strict';var _=require(_0xdc52('0x0'));var util=require(_0xdc52('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdc52('0x2'));var BPromise=require(_0xdc52('0x3'));var rp=require(_0xdc52('0x4'));var fs=require('fs');var path=require(_0xdc52('0x5'));var rimraf=require(_0xdc52('0x6'));var config=require(_0xdc52('0x7'));var attributes=require(_0xdc52('0x8'));module[_0xdc52('0x9')]=function(_0x7e6984,_0x1ea2dd){return _0x7e6984[_0xdc52('0xa')]('SquareMessage',attributes,{'tableName':_0xdc52('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index dffa56b..46b56f3 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 _0xd4f2=['jayson/promise','client','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareMessage','create','body','options','raw','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1a6f7f,_0xcf31a7){var _0x165eb3=function(_0x546ea8){while(--_0x546ea8){_0x1a6f7f['push'](_0x1a6f7f['shift']());}};_0x165eb3(++_0xcf31a7);}(_0xd4f2,0xfb));var _0x2d4f=function(_0x3cf4b3,_0x10fda0){_0x3cf4b3=_0x3cf4b3-0x0;var _0x508ab9=_0xd4f2[_0x3cf4b3];return _0x508ab9;};'use strict';var _=require(_0x2d4f('0x0'));var util=require(_0x2d4f('0x1'));var moment=require(_0x2d4f('0x2'));var BPromise=require(_0x2d4f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d4f('0x4'));var db=require(_0x2d4f('0x5'))['db'];var utils=require(_0x2d4f('0x6'));var logger=require(_0x2d4f('0x7'))(_0x2d4f('0x8'));var config=require(_0x2d4f('0x9'));var jayson=require(_0x2d4f('0xa'));var client=jayson[_0x2d4f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x107990,_0x10b542,_0x392843){return new BPromise(function(_0x4c212a,_0x137b9b){return client[_0x2d4f('0xc')](_0x107990,_0x392843)['then'](function(_0x36646a){logger[_0x2d4f('0xd')](_0x2d4f('0xe'),_0x10b542,_0x2d4f('0xf'));logger[_0x2d4f('0x10')](_0x2d4f('0x11'),_0x10b542,'request\x20sent',JSON[_0x2d4f('0x12')](_0x36646a));if(_0x36646a[_0x2d4f('0x13')]){if(_0x36646a[_0x2d4f('0x13')][_0x2d4f('0x14')]===0x1f4){logger[_0x2d4f('0x13')]('SquareMessage,\x20%s,\x20%s',_0x10b542,_0x36646a[_0x2d4f('0x13')][_0x2d4f('0x15')]);return _0x137b9b(_0x36646a['error'][_0x2d4f('0x15')]);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x10b542,_0x36646a['error']['message']);return _0x4c212a(_0x36646a['error'][_0x2d4f('0x15')]);}else{logger[_0x2d4f('0xd')](_0x2d4f('0xe'),_0x10b542,_0x2d4f('0xf'));_0x4c212a(_0x36646a['result']['message']);}})[_0x2d4f('0x16')](function(_0x1dcd00){logger[_0x2d4f('0x13')]('SquareMessage,\x20%s,\x20%s',_0x10b542,_0x1dcd00);_0x137b9b(_0x1dcd00);});});}exports[_0x2d4f('0x17')]=function(_0x499f25){var _0x26e4ca=this;return new Promise(function(_0x751c10,_0x376e0b){return db['SquareMessage'][_0x2d4f('0x18')](_0x499f25[_0x2d4f('0x19')],{'raw':_0x499f25['options']?_0x499f25[_0x2d4f('0x1a')][_0x2d4f('0x1b')]===undefined?!![]:![]:!![]})[_0x2d4f('0x1c')](function(_0x22a871){logger['info'](_0x2d4f('0x17'),_0x499f25);logger[_0x2d4f('0x10')](_0x2d4f('0x17'),_0x499f25,JSON[_0x2d4f('0x12')](_0x22a871));_0x751c10(_0x22a871);})['catch'](function(_0x3cfdb1){logger[_0x2d4f('0x13')]('CreateSquareMessage',_0x3cfdb1[_0x2d4f('0x15')],_0x499f25);_0x376e0b(_0x26e4ca['error'](0x1f4,_0x3cfdb1[_0x2d4f('0x15')]));});});}; \ No newline at end of file +var _0xf925=['error','code','message','result','SquareMessage','create','body','options','CreateSquareMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf925,0x90));var _0x5f92=function(_0x1ca9a0,_0x17be2b){_0x1ca9a0=_0x1ca9a0-0x0;var _0x4a80d6=_0xf925[_0x1ca9a0];return _0x4a80d6;};'use strict';var _=require(_0x5f92('0x0'));var util=require(_0x5f92('0x1'));var moment=require(_0x5f92('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f92('0x3'));var fs=require('fs');var Redis=require(_0x5f92('0x4'));var db=require(_0x5f92('0x5'))['db'];var utils=require(_0x5f92('0x6'));var logger=require(_0x5f92('0x7'))('rpc');var config=require(_0x5f92('0x8'));var jayson=require(_0x5f92('0x9'));var client=jayson['client'][_0x5f92('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa021a1,_0x22ac69,_0x44de24){return new BPromise(function(_0x502380,_0x4c121f){return client[_0x5f92('0xb')](_0xa021a1,_0x44de24)[_0x5f92('0xc')](function(_0x3211bb){logger[_0x5f92('0xd')](_0x5f92('0xe'),_0x22ac69,_0x5f92('0xf'));logger[_0x5f92('0x10')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x22ac69,_0x5f92('0xf'),JSON[_0x5f92('0x11')](_0x3211bb));if(_0x3211bb[_0x5f92('0x12')]){if(_0x3211bb[_0x5f92('0x12')][_0x5f92('0x13')]===0x1f4){logger[_0x5f92('0x12')](_0x5f92('0xe'),_0x22ac69,_0x3211bb['error']['message']);return _0x4c121f(_0x3211bb[_0x5f92('0x12')][_0x5f92('0x14')]);}logger['error'](_0x5f92('0xe'),_0x22ac69,_0x3211bb[_0x5f92('0x12')][_0x5f92('0x14')]);return _0x502380(_0x3211bb[_0x5f92('0x12')][_0x5f92('0x14')]);}else{logger[_0x5f92('0xd')]('SquareMessage,\x20%s,\x20%s',_0x22ac69,_0x5f92('0xf'));_0x502380(_0x3211bb[_0x5f92('0x15')]['message']);}})['catch'](function(_0xa8fba4){logger[_0x5f92('0x12')]('SquareMessage,\x20%s,\x20%s',_0x22ac69,_0xa8fba4);_0x4c121f(_0xa8fba4);});});}exports['CreateSquareMessage']=function(_0x1b9f37){var _0x24fd6a=this;return new Promise(function(_0x75908,_0x337c56){return db[_0x5f92('0x16')][_0x5f92('0x17')](_0x1b9f37[_0x5f92('0x18')],{'raw':_0x1b9f37[_0x5f92('0x19')]?_0x1b9f37[_0x5f92('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5f92('0xc')](function(_0x2d770f){logger[_0x5f92('0xd')](_0x5f92('0x1a'),_0x1b9f37);logger[_0x5f92('0x10')](_0x5f92('0x1a'),_0x1b9f37,JSON['stringify'](_0x2d770f));_0x75908(_0x2d770f);})['catch'](function(_0x5ebadf){logger[_0x5f92('0x12')]('CreateSquareMessage',_0x5ebadf['message'],_0x1b9f37);_0x337c56(_0x24fd6a['error'](0x1f4,_0x5ebadf['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 6364cd5..cbb839d 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 _0x1611=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/test','15s','test','post','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x11f5af,_0xbfb801){var _0x7eaaaa=function(_0x4cb3bd){while(--_0x4cb3bd){_0x11f5af['push'](_0x11f5af['shift']());}};_0x7eaaaa(++_0xbfb801);}(_0x1611,0x171));var _0x1161=function(_0x1e30b0,_0x52a17a){_0x1e30b0=_0x1e30b0-0x0;var _0x5de912=_0x1611[_0x1e30b0];return _0x5de912;};'use strict';var multer=require(_0x1161('0x0'));var util=require('util');var path=require(_0x1161('0x1'));var timeout=require(_0x1161('0x2'));var express=require(_0x1161('0x3'));var router=express[_0x1161('0x4')]();var fs_extra=require(_0x1161('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1161('0x6'));var config=require(_0x1161('0x7'));var controller=require('./squareOdbc.controller');router[_0x1161('0x8')]('/',auth[_0x1161('0x9')](),controller[_0x1161('0xa')]);router[_0x1161('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1161('0xb')]);router[_0x1161('0x8')](_0x1161('0xc'),auth['isAuthenticated'](),timeout(_0x1161('0xd')),controller[_0x1161('0xe')]);router[_0x1161('0xf')]('/',auth['isAuthenticated'](),controller[_0x1161('0x10')]);router[_0x1161('0x11')](_0x1161('0x12'),auth[_0x1161('0x9')](),controller[_0x1161('0x13')]);router['delete']('/:id',auth[_0x1161('0x9')](),controller[_0x1161('0x14')]);module[_0x1161('0x15')]=router; \ No newline at end of file +var _0x143a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','15s','test','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xc14e9b,_0x5c3047){var _0x48f298=function(_0x3ddc68){while(--_0x3ddc68){_0xc14e9b['push'](_0xc14e9b['shift']());}};_0x48f298(++_0x5c3047);}(_0x143a,0x13a));var _0xa143=function(_0x4b2b6c,_0x2f1ab2){_0x4b2b6c=_0x4b2b6c-0x0;var _0x38ea4b=_0x143a[_0x4b2b6c];return _0x38ea4b;};'use strict';var multer=require(_0xa143('0x0'));var util=require(_0xa143('0x1'));var path=require(_0xa143('0x2'));var timeout=require(_0xa143('0x3'));var express=require(_0xa143('0x4'));var router=express[_0xa143('0x5')]();var fs_extra=require(_0xa143('0x6'));var auth=require(_0xa143('0x7'));var interaction=require(_0xa143('0x8'));var config=require(_0xa143('0x9'));var controller=require('./squareOdbc.controller');router[_0xa143('0xa')]('/',auth[_0xa143('0xb')](),controller['index']);router[_0xa143('0xa')](_0xa143('0xc'),auth[_0xa143('0xb')](),controller['show']);router['get']('/:id/test',auth['isAuthenticated'](),timeout(_0xa143('0xd')),controller[_0xa143('0xe')]);router[_0xa143('0xf')]('/',auth[_0xa143('0xb')](),controller[_0xa143('0x10')]);router[_0xa143('0x11')](_0xa143('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa143('0xc'),auth[_0xa143('0xb')](),controller[_0xa143('0x12')]);module[_0xa143('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index fc151ca..8aa6d5c 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 _0x2ad4=['STRING','name','sequelize','exports'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x2ad4,0xa2));var _0x42ad=function(_0x3804da,_0x4b1678){_0x3804da=_0x3804da-0x0;var _0x1038e3=_0x2ad4[_0x3804da];return _0x1038e3;};'use strict';var Sequelize=require(_0x42ad('0x0'));module[_0x42ad('0x1')]={'name':{'type':Sequelize[_0x42ad('0x2')],'unique':_0x42ad('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x42ad('0x2')]},'description':{'type':Sequelize[_0x42ad('0x2')]}}; \ No newline at end of file +var _0x5b2b=['sequelize','STRING','name'];(function(_0xa3de82,_0x525f8f){var _0xbadf05=function(_0x3bacd3){while(--_0x3bacd3){_0xa3de82['push'](_0xa3de82['shift']());}};_0xbadf05(++_0x525f8f);}(_0x5b2b,0x153));var _0xb5b2=function(_0x23e1e6,_0x5950d3){_0x23e1e6=_0x23e1e6-0x0;var _0x413414=_0x5b2b[_0x23e1e6];return _0x413414;};'use strict';var Sequelize=require(_0xb5b2('0x0'));module['exports']={'name':{'type':Sequelize[_0xb5b2('0x1')],'unique':_0xb5b2('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb5b2('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 5d83554..87ee9b1 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 _0x45c2=['limit','Content-Range','json','apply','reject','update','then','get','UserProfileResource','destroy','stack','name','index','map','SquareOdbc','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','role','user','ODBC','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x45c2,0x93));var _0x245c=function(_0x563db8,_0xd567f9){_0x563db8=_0x563db8-0x0;var _0x5b79ec=_0x45c2[_0x563db8];return _0x5b79ec;};'use strict';var emlformat=require(_0x245c('0x0'));var rimraf=require(_0x245c('0x1'));var zipdir=require(_0x245c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x245c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x245c('0x4'));var util=require(_0x245c('0x5'));var path=require(_0x245c('0x6'));var sox=require(_0x245c('0x7'));var csv=require(_0x245c('0x8'));var ejs=require(_0x245c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x245c('0xa'));var squel=require(_0x245c('0xb'));var crypto=require(_0x245c('0xc'));var jsforce=require(_0x245c('0xd'));var deskjs=require(_0x245c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x245c('0xf'));var Papa=require(_0x245c('0x10'));var Redis=require(_0x245c('0x11'));var authService=require(_0x245c('0x12'));var qs=require(_0x245c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x245c('0x14'));var logger=require('../../config/logger')(_0x245c('0x15'));var utils=require(_0x245c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x245c('0x17'));var db=require(_0x245c('0x18'))['db'];function respondWithStatusCode(_0x286af8,_0x55534a){_0x55534a=_0x55534a||0xcc;return function(_0x15f767){if(_0x15f767){return _0x286af8[_0x245c('0x19')](_0x55534a);}return _0x286af8[_0x245c('0x1a')](_0x55534a)[_0x245c('0x1b')]();};}function respondWithResult(_0x5972b8,_0x13981d){_0x13981d=_0x13981d||0xc8;return function(_0x3ef5d6){if(_0x3ef5d6){return _0x5972b8[_0x245c('0x1a')](_0x13981d)['json'](_0x3ef5d6);}};}function respondWithFilteredResult(_0x59aa6e,_0xe9790b){return function(_0x5b1e66){if(_0x5b1e66){var _0x54376d=typeof _0xe9790b['offset']===_0x245c('0x1c')&&typeof _0xe9790b['limit']==='undefined';var _0x1e123d=_0x5b1e66[_0x245c('0x1d')];var _0x2b298e=_0x54376d?0x0:_0xe9790b[_0x245c('0x1e')];var _0x3f2798=_0x54376d?_0x5b1e66[_0x245c('0x1d')]:_0xe9790b[_0x245c('0x1e')]+_0xe9790b[_0x245c('0x1f')];var _0x12c91e;if(_0x3f2798>=_0x1e123d){_0x3f2798=_0x1e123d;_0x12c91e=0xc8;}else{_0x12c91e=0xce;}_0x59aa6e['status'](_0x12c91e);return _0x59aa6e['set'](_0x245c('0x20'),_0x2b298e+'-'+_0x3f2798+'/'+_0x1e123d)[_0x245c('0x21')](_0x5b1e66);}return null;};}function patchUpdates(_0x111bfe){return function(_0x54295a){try{jsonpatch[_0x245c('0x22')](_0x54295a,_0x111bfe,!![]);}catch(_0x3424df){return BPromise[_0x245c('0x23')](_0x3424df);}return _0x54295a['save']();};}function saveUpdates(_0x10cbb3,_0x20a71f){return function(_0x195c8b){if(_0x195c8b){return _0x195c8b[_0x245c('0x24')](_0x10cbb3)[_0x245c('0x25')](function(_0x10b3f0){return _0x10b3f0;});}return null;};}function removeEntity(_0x4d1769,_0x5e94c2){return function(_0x1c4618){if(_0x1c4618){return _0x1c4618['destroy']()[_0x245c('0x25')](function(){var _0x194585=_0x1c4618[_0x245c('0x26')]({'plain':!![]});var _0xdeaf8e='ODBC';return db[_0x245c('0x27')][_0x245c('0x28')]({'where':{'type':_0xdeaf8e,'resourceId':_0x194585['id']}})['then'](function(){return _0x1c4618;});})[_0x245c('0x25')](function(){_0x4d1769[_0x245c('0x1a')](0xcc)[_0x245c('0x1b')]();});}};}function handleEntityNotFound(_0x8f7143,_0x22773e){return function(_0x58775e){if(!_0x58775e){_0x8f7143['sendStatus'](0x194);}return _0x58775e;};}function handleError(_0x1e1ed9,_0x36c89c){_0x36c89c=_0x36c89c||0x1f4;return function(_0x56d4d1){logger['error'](_0x56d4d1[_0x245c('0x29')]);if(_0x56d4d1[_0x245c('0x2a')]){delete _0x56d4d1[_0x245c('0x2a')];}_0x1e1ed9[_0x245c('0x1a')](_0x36c89c)['send'](_0x56d4d1);};}exports[_0x245c('0x2b')]=function(_0x4d28f7,_0x2f75c){var _0x5082d5={},_0x56cca9={},_0x266068={'count':0x0,'rows':[]};var _0x4a4936=_[_0x245c('0x2c')](db[_0x245c('0x2d')]['rawAttributes'],function(_0x2c25f7){return{'name':_0x2c25f7[_0x245c('0x2e')],'type':_0x2c25f7['type'][_0x245c('0x2f')]};});_0x56cca9[_0x245c('0x30')]=_[_0x245c('0x2c')](_0x4a4936,_0x245c('0x2a'));_0x56cca9[_0x245c('0x31')]=_[_0x245c('0x32')](_0x4d28f7[_0x245c('0x31')]);_0x56cca9['filters']=_[_0x245c('0x33')](_0x56cca9[_0x245c('0x30')],_0x56cca9[_0x245c('0x31')]);_0x5082d5[_0x245c('0x34')]=_[_0x245c('0x33')](_0x56cca9[_0x245c('0x30')],qs['fields'](_0x4d28f7[_0x245c('0x31')][_0x245c('0x35')]));_0x5082d5[_0x245c('0x34')]=_0x5082d5[_0x245c('0x34')]['length']?_0x5082d5[_0x245c('0x34')]:_0x56cca9[_0x245c('0x30')];if(!_0x4d28f7['query'][_0x245c('0x36')]('nolimit')){_0x5082d5[_0x245c('0x1f')]=qs[_0x245c('0x1f')](_0x4d28f7[_0x245c('0x31')][_0x245c('0x1f')]);_0x5082d5[_0x245c('0x1e')]=qs[_0x245c('0x1e')](_0x4d28f7['query'][_0x245c('0x1e')]);}_0x5082d5[_0x245c('0x37')]=qs[_0x245c('0x38')](_0x4d28f7[_0x245c('0x31')][_0x245c('0x38')]);_0x5082d5[_0x245c('0x39')]=qs[_0x245c('0x3a')](_[_0x245c('0x3b')](_0x4d28f7[_0x245c('0x31')],_0x56cca9['filters']),_0x4a4936);if(_0x4d28f7[_0x245c('0x31')][_0x245c('0x3c')]){_0x5082d5[_0x245c('0x39')]=_[_0x245c('0x3d')](_0x5082d5[_0x245c('0x39')],{'$or':_[_0x245c('0x2c')](_0x4a4936,function(_0x4391de){if(_0x4391de[_0x245c('0x3e')]!=='VIRTUAL'){var _0x186a8d={};_0x186a8d[_0x4391de['name']]={'$like':'%'+_0x4d28f7[_0x245c('0x31')][_0x245c('0x3c')]+'%'};return _0x186a8d;}})});}_0x5082d5=_[_0x245c('0x3d')]({},_0x5082d5,_0x4d28f7[_0x245c('0x3f')]);var _0x31fd1c={'where':_0x5082d5[_0x245c('0x39')]};return db['SquareOdbc'][_0x245c('0x1d')](_0x31fd1c)[_0x245c('0x25')](function(_0x42b3cb){_0x266068[_0x245c('0x1d')]=_0x42b3cb;if(_0x4d28f7[_0x245c('0x31')][_0x245c('0x40')]){_0x5082d5['include']=[{'all':!![]}];}return db[_0x245c('0x2d')][_0x245c('0x41')](_0x5082d5);})[_0x245c('0x25')](function(_0x1f81e8){_0x266068[_0x245c('0x42')]=_0x1f81e8;return _0x266068;})[_0x245c('0x25')](respondWithFilteredResult(_0x2f75c,_0x5082d5))[_0x245c('0x43')](handleError(_0x2f75c,null));};exports[_0x245c('0x44')]=function(_0x5f3568,_0x271d5b){var _0x2410d4={'raw':!![],'where':{'id':_0x5f3568[_0x245c('0x45')]['id']}},_0x39d978={};_0x39d978[_0x245c('0x30')]=_[_0x245c('0x32')](db[_0x245c('0x2d')][_0x245c('0x46')]);_0x39d978[_0x245c('0x31')]=_['keys'](_0x5f3568[_0x245c('0x31')]);_0x39d978[_0x245c('0x3a')]=_[_0x245c('0x33')](_0x39d978[_0x245c('0x30')],_0x39d978[_0x245c('0x31')]);_0x2410d4[_0x245c('0x34')]=_[_0x245c('0x33')](_0x39d978[_0x245c('0x30')],qs[_0x245c('0x35')](_0x5f3568[_0x245c('0x31')][_0x245c('0x35')]));_0x2410d4[_0x245c('0x34')]=_0x2410d4['attributes'][_0x245c('0x47')]?_0x2410d4[_0x245c('0x34')]:_0x39d978[_0x245c('0x30')];if(_0x5f3568[_0x245c('0x31')]['includeAll']){_0x2410d4[_0x245c('0x48')]=[{'all':!![]}];}_0x2410d4=_[_0x245c('0x3d')]({},_0x2410d4,_0x5f3568[_0x245c('0x3f')]);return db[_0x245c('0x2d')][_0x245c('0x49')](_0x2410d4)[_0x245c('0x25')](handleEntityNotFound(_0x271d5b,null))[_0x245c('0x25')](respondWithResult(_0x271d5b,null))[_0x245c('0x43')](handleError(_0x271d5b,null));};exports[_0x245c('0x4a')]=function(_0x1521ed,_0x1b8cfe){return db['SquareOdbc'][_0x245c('0x4a')](_0x1521ed[_0x245c('0x4b')],{})[_0x245c('0x25')](function(_0x2f0192){var _0x2a6be4=_0x1521ed['user'][_0x245c('0x26')]({'plain':!![]});if(!_0x2a6be4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a6be4[_0x245c('0x4c')]===_0x245c('0x4d')){var _0x162898=_0x2f0192['get']({'plain':!![]});var _0x39aa30=_0x245c('0x4e');return db[_0x245c('0x4f')][_0x245c('0x49')]({'where':{'name':_0x39aa30,'userProfileId':_0x2a6be4[_0x245c('0x50')]},'raw':!![]})[_0x245c('0x25')](function(_0x231574){if(_0x231574&&_0x231574[_0x245c('0x51')]===0x0){return db[_0x245c('0x27')]['create']({'name':_0x162898['name'],'resourceId':_0x162898['id'],'type':_0x231574[_0x245c('0x2a')],'sectionId':_0x231574['id']},{})[_0x245c('0x25')](function(){return _0x2f0192;});}else{return _0x2f0192;}})[_0x245c('0x43')](function(_0x3d9e85){logger[_0x245c('0x52')](_0x245c('0x53'),_0x3d9e85);throw _0x3d9e85;});}return _0x2f0192;})[_0x245c('0x25')](respondWithResult(_0x1b8cfe,0xc9))[_0x245c('0x43')](handleError(_0x1b8cfe,null));};exports[_0x245c('0x24')]=function(_0x3a7164,_0x428945){if(_0x3a7164[_0x245c('0x4b')]['id']){delete _0x3a7164[_0x245c('0x4b')]['id'];}return db['SquareOdbc'][_0x245c('0x49')]({'where':{'id':_0x3a7164['params']['id']}})[_0x245c('0x25')](handleEntityNotFound(_0x428945,null))['then'](saveUpdates(_0x3a7164[_0x245c('0x4b')],null))[_0x245c('0x25')](respondWithResult(_0x428945,null))[_0x245c('0x43')](handleError(_0x428945,null));};exports['destroy']=function(_0x26d9d0,_0x3fa66f){return db[_0x245c('0x2d')][_0x245c('0x49')]({'where':{'id':_0x26d9d0[_0x245c('0x45')]['id']}})[_0x245c('0x25')](handleEntityNotFound(_0x3fa66f,null))[_0x245c('0x25')](removeEntity(_0x3fa66f,null))[_0x245c('0x43')](handleError(_0x3fa66f,null));};exports[_0x245c('0x54')]=function(_0x163b71,_0x4063c4,_0x200e4c){var _0x39ccb0;return db['SquareOdbc'][_0x245c('0x49')]({'where':{'id':_0x163b71[_0x245c('0x45')]['id']},'attributes':['id','dsn']})[_0x245c('0x25')](handleEntityNotFound(_0x4063c4,null))[_0x245c('0x25')](function(_0xaf3aae){if(_0xaf3aae){var _0x424e83=require(_0x245c('0x55'))();_0x424e83[_0x245c('0x56')](_0xaf3aae[_0x245c('0x57')]);_0x424e83[_0x245c('0x58')]();return _0xaf3aae;}})['then'](respondWithResult(_0x4063c4,null))[_0x245c('0x43')](handleError(_0x4063c4,null));}; \ No newline at end of file +var _0x5d16=['Content-Range','then','destroy','ODBC','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','SquareOdbc','findAll','catch','show','params','keys','includeAll','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','dsn','odbc','openSync','closeSync','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x28f741,_0xf40eee){var _0x47976b=function(_0x453460){while(--_0x453460){_0x28f741['push'](_0x28f741['shift']());}};_0x47976b(++_0xf40eee);}(_0x5d16,0x190));var _0x65d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d16[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x65d1('0x0'));var rimraf=require(_0x65d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x65d1('0x2'));var moment=require(_0x65d1('0x3'));var BPromise=require(_0x65d1('0x4'));var Mustache=require(_0x65d1('0x5'));var util=require(_0x65d1('0x6'));var path=require(_0x65d1('0x7'));var sox=require(_0x65d1('0x8'));var csv=require(_0x65d1('0x9'));var ejs=require(_0x65d1('0xa'));var fs=require('fs');var fs_extra=require(_0x65d1('0xb'));var _=require(_0x65d1('0xc'));var squel=require('squel');var crypto=require(_0x65d1('0xd'));var jsforce=require(_0x65d1('0xe'));var deskjs=require(_0x65d1('0xf'));var toCsv=require(_0x65d1('0x9'));var querystring=require(_0x65d1('0x10'));var Papa=require(_0x65d1('0x11'));var Redis=require(_0x65d1('0x12'));var authService=require(_0x65d1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x65d1('0x14'));var hardwareService=require(_0x65d1('0x15'));var logger=require('../../config/logger')(_0x65d1('0x16'));var utils=require(_0x65d1('0x17'));var config=require(_0x65d1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x65d1('0x19'))['db'];function respondWithStatusCode(_0xe96f5a,_0xdaab53){_0xdaab53=_0xdaab53||0xcc;return function(_0x5efa2c){if(_0x5efa2c){return _0xe96f5a[_0x65d1('0x1a')](_0xdaab53);}return _0xe96f5a[_0x65d1('0x1b')](_0xdaab53)[_0x65d1('0x1c')]();};}function respondWithResult(_0xfdfc65,_0x18f45d){_0x18f45d=_0x18f45d||0xc8;return function(_0x562bca){if(_0x562bca){return _0xfdfc65[_0x65d1('0x1b')](_0x18f45d)[_0x65d1('0x1d')](_0x562bca);}};}function respondWithFilteredResult(_0x57483b,_0x542a8c){return function(_0x4c5d74){if(_0x4c5d74){var _0xc07368=typeof _0x542a8c[_0x65d1('0x1e')]===_0x65d1('0x1f')&&typeof _0x542a8c[_0x65d1('0x20')]===_0x65d1('0x1f');var _0x18fad1=_0x4c5d74['count'];var _0x14ff21=_0xc07368?0x0:_0x542a8c[_0x65d1('0x1e')];var _0xa7ae0b=_0xc07368?_0x4c5d74[_0x65d1('0x21')]:_0x542a8c['offset']+_0x542a8c['limit'];var _0x42fc81;if(_0xa7ae0b>=_0x18fad1){_0xa7ae0b=_0x18fad1;_0x42fc81=0xc8;}else{_0x42fc81=0xce;}_0x57483b[_0x65d1('0x1b')](_0x42fc81);return _0x57483b[_0x65d1('0x22')](_0x65d1('0x23'),_0x14ff21+'-'+_0xa7ae0b+'/'+_0x18fad1)['json'](_0x4c5d74);}return null;};}function patchUpdates(_0x418523){return function(_0x5c8768){try{jsonpatch['apply'](_0x5c8768,_0x418523,!![]);}catch(_0x5946a3){return BPromise['reject'](_0x5946a3);}return _0x5c8768['save']();};}function saveUpdates(_0x3d34ef,_0x2baf0c){return function(_0x1cd375){if(_0x1cd375){return _0x1cd375['update'](_0x3d34ef)[_0x65d1('0x24')](function(_0x408db4){return _0x408db4;});}return null;};}function removeEntity(_0x2cb0fe,_0x347860){return function(_0x39c20b){if(_0x39c20b){return _0x39c20b[_0x65d1('0x25')]()['then'](function(){var _0x1e8f45=_0x39c20b['get']({'plain':!![]});var _0x59ac6b=_0x65d1('0x26');return db[_0x65d1('0x27')][_0x65d1('0x25')]({'where':{'type':_0x59ac6b,'resourceId':_0x1e8f45['id']}})[_0x65d1('0x24')](function(){return _0x39c20b;});})[_0x65d1('0x24')](function(){_0x2cb0fe[_0x65d1('0x1b')](0xcc)[_0x65d1('0x1c')]();});}};}function handleEntityNotFound(_0x3e4fcd,_0x3f0a47){return function(_0x3ddb52){if(!_0x3ddb52){_0x3e4fcd['sendStatus'](0x194);}return _0x3ddb52;};}function handleError(_0x2e1091,_0x2827b7){_0x2827b7=_0x2827b7||0x1f4;return function(_0x5b3a94){logger[_0x65d1('0x28')](_0x5b3a94[_0x65d1('0x29')]);if(_0x5b3a94[_0x65d1('0x2a')]){delete _0x5b3a94[_0x65d1('0x2a')];}_0x2e1091['status'](_0x2827b7)[_0x65d1('0x2b')](_0x5b3a94);};}exports[_0x65d1('0x2c')]=function(_0x36f1b6,_0xbd609a){var _0x287480={},_0x342fb4={},_0x4979b3={'count':0x0,'rows':[]};var _0x31ed36=_[_0x65d1('0x2d')](db['SquareOdbc'][_0x65d1('0x2e')],function(_0x11a8d4){return{'name':_0x11a8d4[_0x65d1('0x2f')],'type':_0x11a8d4[_0x65d1('0x30')][_0x65d1('0x31')]};});_0x342fb4['model']=_[_0x65d1('0x2d')](_0x31ed36,_0x65d1('0x2a'));_0x342fb4[_0x65d1('0x32')]=_['keys'](_0x36f1b6['query']);_0x342fb4[_0x65d1('0x33')]=_[_0x65d1('0x34')](_0x342fb4['model'],_0x342fb4[_0x65d1('0x32')]);_0x287480[_0x65d1('0x35')]=_[_0x65d1('0x34')](_0x342fb4[_0x65d1('0x36')],qs[_0x65d1('0x37')](_0x36f1b6['query'][_0x65d1('0x37')]));_0x287480[_0x65d1('0x35')]=_0x287480[_0x65d1('0x35')][_0x65d1('0x38')]?_0x287480['attributes']:_0x342fb4[_0x65d1('0x36')];if(!_0x36f1b6['query'][_0x65d1('0x39')](_0x65d1('0x3a'))){_0x287480[_0x65d1('0x20')]=qs['limit'](_0x36f1b6[_0x65d1('0x32')]['limit']);_0x287480[_0x65d1('0x1e')]=qs[_0x65d1('0x1e')](_0x36f1b6[_0x65d1('0x32')][_0x65d1('0x1e')]);}_0x287480[_0x65d1('0x3b')]=qs[_0x65d1('0x3c')](_0x36f1b6[_0x65d1('0x32')][_0x65d1('0x3c')]);_0x287480[_0x65d1('0x3d')]=qs[_0x65d1('0x33')](_['pick'](_0x36f1b6['query'],_0x342fb4[_0x65d1('0x33')]),_0x31ed36);if(_0x36f1b6[_0x65d1('0x32')][_0x65d1('0x3e')]){_0x287480[_0x65d1('0x3d')]=_['merge'](_0x287480['where'],{'$or':_['map'](_0x31ed36,function(_0x87f8c8){if(_0x87f8c8[_0x65d1('0x30')]!==_0x65d1('0x3f')){var _0x5de798={};_0x5de798[_0x87f8c8['name']]={'$like':'%'+_0x36f1b6[_0x65d1('0x32')][_0x65d1('0x3e')]+'%'};return _0x5de798;}})});}_0x287480=_[_0x65d1('0x40')]({},_0x287480,_0x36f1b6[_0x65d1('0x41')]);var _0x3f7034={'where':_0x287480['where']};return db[_0x65d1('0x42')][_0x65d1('0x21')](_0x3f7034)[_0x65d1('0x24')](function(_0x1ddc0b){_0x4979b3[_0x65d1('0x21')]=_0x1ddc0b;if(_0x36f1b6[_0x65d1('0x32')]['includeAll']){_0x287480['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x65d1('0x43')](_0x287480);})[_0x65d1('0x24')](function(_0x4de724){_0x4979b3['rows']=_0x4de724;return _0x4979b3;})[_0x65d1('0x24')](respondWithFilteredResult(_0xbd609a,_0x287480))[_0x65d1('0x44')](handleError(_0xbd609a,null));};exports[_0x65d1('0x45')]=function(_0x8ce10d,_0x200c2c){var _0x1247e3={'raw':!![],'where':{'id':_0x8ce10d[_0x65d1('0x46')]['id']}},_0x13fe65={};_0x13fe65[_0x65d1('0x36')]=_[_0x65d1('0x47')](db[_0x65d1('0x42')][_0x65d1('0x2e')]);_0x13fe65['query']=_[_0x65d1('0x47')](_0x8ce10d['query']);_0x13fe65[_0x65d1('0x33')]=_['intersection'](_0x13fe65[_0x65d1('0x36')],_0x13fe65[_0x65d1('0x32')]);_0x1247e3[_0x65d1('0x35')]=_[_0x65d1('0x34')](_0x13fe65[_0x65d1('0x36')],qs['fields'](_0x8ce10d['query'][_0x65d1('0x37')]));_0x1247e3[_0x65d1('0x35')]=_0x1247e3['attributes'][_0x65d1('0x38')]?_0x1247e3[_0x65d1('0x35')]:_0x13fe65[_0x65d1('0x36')];if(_0x8ce10d[_0x65d1('0x32')][_0x65d1('0x48')]){_0x1247e3[_0x65d1('0x49')]=[{'all':!![]}];}_0x1247e3=_[_0x65d1('0x40')]({},_0x1247e3,_0x8ce10d[_0x65d1('0x41')]);return db[_0x65d1('0x42')][_0x65d1('0x4a')](_0x1247e3)[_0x65d1('0x24')](handleEntityNotFound(_0x200c2c,null))['then'](respondWithResult(_0x200c2c,null))['catch'](handleError(_0x200c2c,null));};exports[_0x65d1('0x4b')]=function(_0x13c599,_0x38b93f){return db[_0x65d1('0x42')][_0x65d1('0x4b')](_0x13c599['body'],{})[_0x65d1('0x24')](function(_0x32574e){var _0x3684ce=_0x13c599[_0x65d1('0x4c')][_0x65d1('0x4d')]({'plain':!![]});if(!_0x3684ce)throw new Error(_0x65d1('0x4e'));if(_0x3684ce['role']===_0x65d1('0x4c')){var _0x3c4b0b=_0x32574e[_0x65d1('0x4d')]({'plain':!![]});var _0x1be053=_0x65d1('0x26');return db['UserProfileSection'][_0x65d1('0x4a')]({'where':{'name':_0x1be053,'userProfileId':_0x3684ce[_0x65d1('0x4f')]},'raw':!![]})[_0x65d1('0x24')](function(_0x44b247){if(_0x44b247&&_0x44b247['autoAssociation']===0x0){return db['UserProfileResource'][_0x65d1('0x4b')]({'name':_0x3c4b0b[_0x65d1('0x2a')],'resourceId':_0x3c4b0b['id'],'type':_0x44b247[_0x65d1('0x2a')],'sectionId':_0x44b247['id']},{})[_0x65d1('0x24')](function(){return _0x32574e;});}else{return _0x32574e;}})['catch'](function(_0x39e6de){logger[_0x65d1('0x28')](_0x65d1('0x50'),_0x39e6de);throw _0x39e6de;});}return _0x32574e;})[_0x65d1('0x24')](respondWithResult(_0x38b93f,0xc9))['catch'](handleError(_0x38b93f,null));};exports[_0x65d1('0x51')]=function(_0x332145,_0x149679){if(_0x332145[_0x65d1('0x52')]['id']){delete _0x332145[_0x65d1('0x52')]['id'];}return db['SquareOdbc'][_0x65d1('0x4a')]({'where':{'id':_0x332145[_0x65d1('0x46')]['id']}})[_0x65d1('0x24')](handleEntityNotFound(_0x149679,null))[_0x65d1('0x24')](saveUpdates(_0x332145[_0x65d1('0x52')],null))[_0x65d1('0x24')](respondWithResult(_0x149679,null))[_0x65d1('0x44')](handleError(_0x149679,null));};exports[_0x65d1('0x25')]=function(_0x4a2cc9,_0x42a912){return db[_0x65d1('0x42')]['find']({'where':{'id':_0x4a2cc9[_0x65d1('0x46')]['id']}})[_0x65d1('0x24')](handleEntityNotFound(_0x42a912,null))['then'](removeEntity(_0x42a912,null))['catch'](handleError(_0x42a912,null));};exports['test']=function(_0x5a77c2,_0x55452b,_0x2ebeae){var _0x34407b;return db[_0x65d1('0x42')][_0x65d1('0x4a')]({'where':{'id':_0x5a77c2[_0x65d1('0x46')]['id']},'attributes':['id',_0x65d1('0x53')]})[_0x65d1('0x24')](handleEntityNotFound(_0x55452b,null))['then'](function(_0x3ac66a){if(_0x3ac66a){var _0x2fb54f=require(_0x65d1('0x54'))();_0x2fb54f[_0x65d1('0x55')](_0x3ac66a[_0x65d1('0x53')]);_0x2fb54f[_0x65d1('0x56')]();return _0x3ac66a;}})['then'](respondWithResult(_0x55452b,null))[_0x65d1('0x44')](handleError(_0x55452b,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 3eba649..5efafe6 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 _0xec28=['path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3cc26d,_0x15df19){var _0x2d0761=function(_0x30595e){while(--_0x30595e){_0x3cc26d['push'](_0x3cc26d['shift']());}};_0x2d0761(++_0x15df19);}(_0xec28,0x14a));var _0x8ec2=function(_0x2e1907,_0x229a70){_0x2e1907=_0x2e1907-0x0;var _0x401555=_0xec28[_0x2e1907];return _0x401555;};'use strict';var _=require(_0x8ec2('0x0'));var util=require(_0x8ec2('0x1'));var logger=require('../../config/logger')(_0x8ec2('0x2'));var moment=require(_0x8ec2('0x3'));var BPromise=require(_0x8ec2('0x4'));var rp=require(_0x8ec2('0x5'));var fs=require('fs');var path=require(_0x8ec2('0x6'));var rimraf=require(_0x8ec2('0x7'));var config=require(_0x8ec2('0x8'));var attributes=require(_0x8ec2('0x9'));module[_0x8ec2('0xa')]=function(_0x21c1ce,_0x13e94e){return _0x21c1ce[_0x8ec2('0xb')](_0x8ec2('0xc'),attributes,{'tableName':_0x8ec2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfadd=['rimraf','../../config/environment','lodash','util','moment','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfadd,0x16e));var _0xdfad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfadd[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdfad('0x0'));var util=require(_0xdfad('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdfad('0x2'));var BPromise=require(_0xdfad('0x3'));var rp=require(_0xdfad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdfad('0x5'));var config=require(_0xdfad('0x6'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x5ce298,_0x4911aa){return _0x5ce298['define']('SquareOdbc',attributes,{'tableName':'square_odbc','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 2686285..0541530 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 _0xeba2=['raw','where','attributes','include','map','model','ShowSquareOdbc','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','find','options'];(function(_0x5ea7a6,_0x2d9d48){var _0x16eb7c=function(_0x96aeda){while(--_0x96aeda){_0x5ea7a6['push'](_0x5ea7a6['shift']());}};_0x16eb7c(++_0x2d9d48);}(_0xeba2,0x1e7));var _0x2eba=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0xeba2[_0x47e93d];return _0xe86c46;};'use strict';var _=require(_0x2eba('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2eba('0x1'));var rs=require(_0x2eba('0x2'));var fs=require('fs');var Redis=require(_0x2eba('0x3'));var db=require(_0x2eba('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2eba('0x5'));var jayson=require(_0x2eba('0x6'));var client=jayson[_0x2eba('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2867c5,_0x2ffe51,_0x4a57b3){return new BPromise(function(_0x49355e,_0x1b7bc4){return client[_0x2eba('0x8')](_0x2867c5,_0x4a57b3)[_0x2eba('0x9')](function(_0x4df2ae){logger['info'](_0x2eba('0xa'),_0x2ffe51,'request\x20sent');logger[_0x2eba('0xb')](_0x2eba('0xc'),_0x2ffe51,_0x2eba('0xd'),JSON[_0x2eba('0xe')](_0x4df2ae));if(_0x4df2ae[_0x2eba('0xf')]){if(_0x4df2ae['error'][_0x2eba('0x10')]===0x1f4){logger[_0x2eba('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x2ffe51,_0x4df2ae[_0x2eba('0xf')][_0x2eba('0x11')]);return _0x1b7bc4(_0x4df2ae[_0x2eba('0xf')][_0x2eba('0x11')]);}logger[_0x2eba('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x2ffe51,_0x4df2ae['error'][_0x2eba('0x11')]);return _0x49355e(_0x4df2ae['error'][_0x2eba('0x11')]);}else{logger[_0x2eba('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x2ffe51,_0x2eba('0xd'));_0x49355e(_0x4df2ae[_0x2eba('0x13')][_0x2eba('0x11')]);}})[_0x2eba('0x14')](function(_0x361240){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x2ffe51,_0x361240);_0x1b7bc4(_0x361240);});});}exports['ShowSquareOdbc']=function(_0x128e5b){var _0x1c7468=this;return new Promise(function(_0x27e8e2,_0x567a7e){return db['SquareOdbc'][_0x2eba('0x15')]({'raw':_0x128e5b[_0x2eba('0x16')]?_0x128e5b[_0x2eba('0x16')][_0x2eba('0x17')]===undefined?!![]:![]:!![],'where':_0x128e5b[_0x2eba('0x16')]?_0x128e5b['options'][_0x2eba('0x18')]||null:null,'attributes':_0x128e5b[_0x2eba('0x16')]?_0x128e5b[_0x2eba('0x16')][_0x2eba('0x19')]||null:null,'include':_0x128e5b[_0x2eba('0x16')]?_0x128e5b[_0x2eba('0x16')][_0x2eba('0x1a')]?_[_0x2eba('0x1b')](_0x128e5b['options']['include'],function(_0x2fad63){return{'model':db[_0x2fad63[_0x2eba('0x1c')]],'as':_0x2fad63['as'],'attributes':_0x2fad63['attributes'],'include':_0x2fad63[_0x2eba('0x1a')]?_['map'](_0x2fad63['include'],function(_0x2431c2){return{'model':db[_0x2431c2['model']],'as':_0x2431c2['as'],'attributes':_0x2431c2[_0x2eba('0x19')],'include':_0x2431c2['include']?_[_0x2eba('0x1b')](_0x2431c2[_0x2eba('0x1a')],function(_0x360e4a){return{'model':db[_0x360e4a[_0x2eba('0x1c')]],'as':_0x360e4a['as'],'attributes':_0x360e4a[_0x2eba('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2eba('0x9')](function(_0x356154){logger['info'](_0x2eba('0x1d'),_0x128e5b);logger[_0x2eba('0xb')](_0x2eba('0x1d'),_0x128e5b,JSON[_0x2eba('0xe')](_0x356154));_0x27e8e2(_0x356154);})['catch'](function(_0x332b10){logger[_0x2eba('0xf')]('ShowSquareOdbc',_0x332b10['message'],_0x128e5b);_0x567a7e(_0x1c7468[_0x2eba('0xf')](0x1f4,_0x332b10[_0x2eba('0x11')]));});});}; \ No newline at end of file +var _0x8caa=['attributes','map','include','model','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSquareOdbc','SquareOdbc','find','options','where'];(function(_0x4e52ab,_0x2dddb1){var _0x4ff83b=function(_0x47c775){while(--_0x47c775){_0x4e52ab['push'](_0x4e52ab['shift']());}};_0x4ff83b(++_0x2dddb1);}(_0x8caa,0x10d));var _0xa8ca=function(_0x57426f,_0x52f0d3){_0x57426f=_0x57426f-0x0;var _0xe15733=_0x8caa[_0x57426f];return _0xe15733;};'use strict';var _=require('lodash');var util=require(_0xa8ca('0x0'));var moment=require(_0xa8ca('0x1'));var BPromise=require(_0xa8ca('0x2'));var rs=require(_0xa8ca('0x3'));var fs=require('fs');var Redis=require(_0xa8ca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8ca('0x5'));var logger=require(_0xa8ca('0x6'))(_0xa8ca('0x7'));var config=require(_0xa8ca('0x8'));var jayson=require(_0xa8ca('0x9'));var client=jayson[_0xa8ca('0xa')][_0xa8ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2aea12,_0x21b5e2,_0x524bbc){return new BPromise(function(_0x777a83,_0xcdf53a){return client[_0xa8ca('0xc')](_0x2aea12,_0x524bbc)[_0xa8ca('0xd')](function(_0xaac991){logger[_0xa8ca('0xe')](_0xa8ca('0xf'),_0x21b5e2,_0xa8ca('0x10'));logger[_0xa8ca('0x11')](_0xa8ca('0x12'),_0x21b5e2,_0xa8ca('0x10'),JSON[_0xa8ca('0x13')](_0xaac991));if(_0xaac991[_0xa8ca('0x14')]){if(_0xaac991[_0xa8ca('0x14')][_0xa8ca('0x15')]===0x1f4){logger['error'](_0xa8ca('0xf'),_0x21b5e2,_0xaac991[_0xa8ca('0x14')][_0xa8ca('0x16')]);return _0xcdf53a(_0xaac991[_0xa8ca('0x14')][_0xa8ca('0x16')]);}logger[_0xa8ca('0x14')](_0xa8ca('0xf'),_0x21b5e2,_0xaac991[_0xa8ca('0x14')][_0xa8ca('0x16')]);return _0x777a83(_0xaac991[_0xa8ca('0x14')][_0xa8ca('0x16')]);}else{logger['info'](_0xa8ca('0xf'),_0x21b5e2,_0xa8ca('0x10'));_0x777a83(_0xaac991['result'][_0xa8ca('0x16')]);}})['catch'](function(_0x132207){logger[_0xa8ca('0x14')](_0xa8ca('0xf'),_0x21b5e2,_0x132207);_0xcdf53a(_0x132207);});});}exports[_0xa8ca('0x17')]=function(_0x3172bd){var _0x1c2a7b=this;return new Promise(function(_0x4e6040,_0x5c021b){return db[_0xa8ca('0x18')][_0xa8ca('0x19')]({'raw':_0x3172bd[_0xa8ca('0x1a')]?_0x3172bd['options']['raw']===undefined?!![]:![]:!![],'where':_0x3172bd[_0xa8ca('0x1a')]?_0x3172bd[_0xa8ca('0x1a')][_0xa8ca('0x1b')]||null:null,'attributes':_0x3172bd['options']?_0x3172bd['options'][_0xa8ca('0x1c')]||null:null,'include':_0x3172bd[_0xa8ca('0x1a')]?_0x3172bd[_0xa8ca('0x1a')]['include']?_[_0xa8ca('0x1d')](_0x3172bd[_0xa8ca('0x1a')][_0xa8ca('0x1e')],function(_0x347ea2){return{'model':db[_0x347ea2[_0xa8ca('0x1f')]],'as':_0x347ea2['as'],'attributes':_0x347ea2[_0xa8ca('0x1c')],'include':_0x347ea2[_0xa8ca('0x1e')]?_[_0xa8ca('0x1d')](_0x347ea2[_0xa8ca('0x1e')],function(_0x1f1414){return{'model':db[_0x1f1414[_0xa8ca('0x1f')]],'as':_0x1f1414['as'],'attributes':_0x1f1414[_0xa8ca('0x1c')],'include':_0x1f1414[_0xa8ca('0x1e')]?_['map'](_0x1f1414['include'],function(_0x5c5c2a){return{'model':db[_0x5c5c2a[_0xa8ca('0x1f')]],'as':_0x5c5c2a['as'],'attributes':_0x5c5c2a[_0xa8ca('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa8ca('0xd')](function(_0x5dea95){logger[_0xa8ca('0xe')]('ShowSquareOdbc',_0x3172bd);logger[_0xa8ca('0x11')](_0xa8ca('0x17'),_0x3172bd,JSON[_0xa8ca('0x13')](_0x5dea95));_0x4e6040(_0x5dea95);})[_0xa8ca('0x20')](function(_0x131cf0){logger[_0xa8ca('0x14')]('ShowSquareOdbc',_0x131cf0['message'],_0x3172bd);_0x5c021b(_0x1c2a7b['error'](0x1f4,_0x131cf0[_0xa8ca('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index e3ccbbd..9be4706 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 _0x223e=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','get','/:id/users','getUsers','post','create','addUsers','put','update','delete','destroy','removeUsers'];(function(_0x4fce3a,_0x31dd65){var _0xab350c=function(_0x142764){while(--_0x142764){_0x4fce3a['push'](_0x4fce3a['shift']());}};_0xab350c(++_0x31dd65);}(_0x223e,0x1b1));var _0xe223=function(_0x118afa,_0x4bf0c1){_0x118afa=_0x118afa-0x0;var _0x167d76=_0x223e[_0x118afa];return _0x167d76;};'use strict';var multer=require(_0xe223('0x0'));var util=require(_0xe223('0x1'));var path=require(_0xe223('0x2'));var timeout=require('connect-timeout');var express=require(_0xe223('0x3'));var router=express[_0xe223('0x4')]();var fs_extra=require(_0xe223('0x5'));var auth=require(_0xe223('0x6'));var interaction=require(_0xe223('0x7'));var config=require(_0xe223('0x8'));var controller=require('./squareProject.controller');router['get']('/',auth[_0xe223('0x9')](),controller[_0xe223('0xa')]);router['get'](_0xe223('0xb'),auth[_0xe223('0x9')](),controller['show']);router[_0xe223('0xc')](_0xe223('0xd'),auth[_0xe223('0x9')](),controller[_0xe223('0xe')]);router[_0xe223('0xf')]('/',auth['isAuthenticated'](),controller[_0xe223('0x10')]);router['post'](_0xe223('0xd'),auth[_0xe223('0x9')](),controller[_0xe223('0x11')]);router[_0xe223('0x12')](_0xe223('0xb'),auth['isAuthenticated'](),controller[_0xe223('0x13')]);router[_0xe223('0x14')](_0xe223('0xb'),auth[_0xe223('0x9')](),controller[_0xe223('0x15')]);router[_0xe223('0x14')](_0xe223('0xd'),auth['isAuthenticated'](),controller[_0xe223('0x16')]);module[_0xe223('0x17')]=router; \ No newline at end of file +var _0x2032=['Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','getUsers','create','post','put','update','/:id/users','exports','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2032,0xd9));var _0x2203=function(_0x130238,_0x328b6e){_0x130238=_0x130238-0x0;var _0x2d166e=_0x2032[_0x130238];return _0x2d166e;};'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/users',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0xe')]);router[_0x2203('0xf')]('/:id/users',auth[_0x2203('0x9')](),controller['addUsers']);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x2203('0x12'),auth['isAuthenticated'](),controller['removeUsers']);module[_0x2203('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 24db899..2375ef6 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 _0x571a=['preproduction','toString','long','production','utf8','DATE','sequelize','exports','STRING','TEXT','BLOB','getDataValue'];(function(_0xd8fb7d,_0x25c1b0){var _0x1f4557=function(_0x1303d9){while(--_0x1303d9){_0xd8fb7d['push'](_0xd8fb7d['shift']());}};_0x1f4557(++_0x25c1b0);}(_0x571a,0xf6));var _0xa571=function(_0x144629,_0x4a34e4){_0x144629=_0x144629-0x0;var _0x461f50=_0x571a[_0x144629];return _0x461f50;};'use strict';var Sequelize=require(_0xa571('0x0'));module[_0xa571('0x1')]={'name':{'type':Sequelize[_0xa571('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xa571('0x3')]},'preproduction':{'type':Sequelize[_0xa571('0x4')]('long'),'get':function(){if(this[_0xa571('0x5')](_0xa571('0x6'))){return this['getDataValue'](_0xa571('0x6'))[_0xa571('0x7')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0xa571('0x8')),'get':function(){if(this[_0xa571('0x5')](_0xa571('0x9'))){return this['getDataValue'](_0xa571('0x9'))['toString'](_0xa571('0xa'));}}},'savedAt':{'type':Sequelize[_0xa571('0xb')]},'publishedAt':{'type':Sequelize[_0xa571('0xb')]}}; \ No newline at end of file +var _0x6370=['STRING','TEXT','long','getDataValue','preproduction','toString','utf8','BLOB','production','DATE','sequelize','exports','name'];(function(_0xe05a50,_0x45ec13){var _0x375976=function(_0x231aad){while(--_0x231aad){_0xe05a50['push'](_0xe05a50['shift']());}};_0x375976(++_0x45ec13);}(_0x6370,0x99));var _0x0637=function(_0x5484f4,_0x4f2c3a){_0x5484f4=_0x5484f4-0x0;var _0x7f7dc9=_0x6370[_0x5484f4];return _0x7f7dc9;};'use strict';var Sequelize=require(_0x0637('0x0'));module[_0x0637('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0637('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x0637('0x3')]},'notes':{'type':Sequelize[_0x0637('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x0637('0x5')),'get':function(){if(this[_0x0637('0x6')](_0x0637('0x7'))){return this[_0x0637('0x6')](_0x0637('0x7'))[_0x0637('0x8')](_0x0637('0x9'));}}},'production':{'type':Sequelize[_0x0637('0xa')](_0x0637('0x5')),'get':function(){if(this[_0x0637('0x6')](_0x0637('0xb'))){return this[_0x0637('0x6')]('production')[_0x0637('0x8')](_0x0637('0x9'));}}},'savedAt':{'type':Sequelize[_0x0637('0xc')]},'publishedAt':{'type':Sequelize[_0x0637('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 4767b32..86d46d6 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 _0x96f7=['defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','map','SquareProject','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','addUsers','ids','removeUsers','isArray','emit','User','merge','getUsers','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x28d367,_0x269c1e){var _0x19c1a7=function(_0x159720){while(--_0x159720){_0x28d367['push'](_0x28d367['shift']());}};_0x19c1a7(++_0x269c1e);}(_0x96f7,0x16b));var _0x796f=function(_0xa8d025,_0x3a5cbe){_0xa8d025=_0xa8d025-0x0;var _0x29e44e=_0x96f7[_0xa8d025];return _0x29e44e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x796f('0x0'));var zipdir=require(_0x796f('0x1'));var jsonpatch=require(_0x796f('0x2'));var rp=require('request-promise');var moment=require(_0x796f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x796f('0x4'));var util=require(_0x796f('0x5'));var path=require(_0x796f('0x6'));var sox=require(_0x796f('0x7'));var csv=require(_0x796f('0x8'));var ejs=require(_0x796f('0x9'));var fs=require('fs');var fs_extra=require(_0x796f('0xa'));var _=require(_0x796f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x796f('0xc'));var deskjs=require(_0x796f('0xd'));var toCsv=require(_0x796f('0x8'));var querystring=require(_0x796f('0xe'));var Papa=require(_0x796f('0xf'));var Redis=require(_0x796f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x796f('0x11'));var as=require(_0x796f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x796f('0x13'))('api');var utils=require(_0x796f('0x14'));var config=require(_0x796f('0x15'));var licenseUtil=require(_0x796f('0x16'));var db=require(_0x796f('0x17'))['db'];config[_0x796f('0x18')]=_[_0x796f('0x19')](config[_0x796f('0x18')],{'host':_0x796f('0x1a'),'port':0x18eb});var socket=require(_0x796f('0x1b'))(new Redis(config[_0x796f('0x18')]));require(_0x796f('0x1c'))[_0x796f('0x1d')](socket);function respondWithStatusCode(_0xe8209d,_0x356ca8){_0x356ca8=_0x356ca8||0xcc;return function(_0xf65b7d){if(_0xf65b7d){return _0xe8209d[_0x796f('0x1e')](_0x356ca8);}return _0xe8209d['status'](_0x356ca8)[_0x796f('0x1f')]();};}function respondWithResult(_0x34419a,_0x463d00){_0x463d00=_0x463d00||0xc8;return function(_0x4d616c){if(_0x4d616c){return _0x34419a[_0x796f('0x20')](_0x463d00)[_0x796f('0x21')](_0x4d616c);}};}function respondWithFilteredResult(_0x4d985a,_0x20a298){return function(_0x550c9a){if(_0x550c9a){var _0x5cf369=typeof _0x20a298['offset']==='undefined'&&typeof _0x20a298[_0x796f('0x22')]===_0x796f('0x23');var _0x1114de=_0x550c9a[_0x796f('0x24')];var _0x5e52ee=_0x5cf369?0x0:_0x20a298['offset'];var _0x220e8c=_0x5cf369?_0x550c9a[_0x796f('0x24')]:_0x20a298[_0x796f('0x25')]+_0x20a298[_0x796f('0x22')];var _0x529b03;if(_0x220e8c>=_0x1114de){_0x220e8c=_0x1114de;_0x529b03=0xc8;}else{_0x529b03=0xce;}_0x4d985a[_0x796f('0x20')](_0x529b03);return _0x4d985a[_0x796f('0x26')](_0x796f('0x27'),_0x5e52ee+'-'+_0x220e8c+'/'+_0x1114de)['json'](_0x550c9a);}return null;};}function patchUpdates(_0x3ae260){return function(_0x2e304e){try{jsonpatch[_0x796f('0x28')](_0x2e304e,_0x3ae260,!![]);}catch(_0x3d7c14){return BPromise[_0x796f('0x29')](_0x3d7c14);}return _0x2e304e[_0x796f('0x2a')]();};}function saveUpdates(_0x33d405,_0x16f2ea){return function(_0x417951){if(_0x417951){return _0x417951['update'](_0x33d405)[_0x796f('0x2b')](function(_0x509ba1){return _0x509ba1;});}return null;};}function removeEntity(_0x54f53d,_0x5521e6){return function(_0x2b4f04){if(_0x2b4f04){return _0x2b4f04[_0x796f('0x2c')]()[_0x796f('0x2b')](function(){var _0x68b92d=_0x2b4f04[_0x796f('0x2d')]({'plain':!![]});var _0x1519ab=_0x796f('0x2e');return db[_0x796f('0x2f')]['destroy']({'where':{'type':_0x1519ab,'resourceId':_0x68b92d['id']}})[_0x796f('0x2b')](function(){return _0x2b4f04;});})[_0x796f('0x2b')](function(){_0x54f53d['status'](0xcc)[_0x796f('0x1f')]();});}};}function handleEntityNotFound(_0x17ffe3,_0xdb639){return function(_0xf1bcf0){if(!_0xf1bcf0){_0x17ffe3[_0x796f('0x1e')](0x194);}return _0xf1bcf0;};}function handleError(_0x3ed776,_0x114e30){_0x114e30=_0x114e30||0x1f4;return function(_0x4124f6){logger[_0x796f('0x30')](_0x4124f6[_0x796f('0x31')]);if(_0x4124f6[_0x796f('0x32')]){delete _0x4124f6[_0x796f('0x32')];}_0x3ed776[_0x796f('0x20')](_0x114e30)[_0x796f('0x33')](_0x4124f6);};}exports['index']=function(_0x193a12,_0x483fa8){var _0x1c4a6f={},_0x1fe931={},_0x4c89ed={'count':0x0,'rows':[]};var _0x4b916=_[_0x796f('0x34')](db[_0x796f('0x35')][_0x796f('0x36')],function(_0x179bd8){return{'name':_0x179bd8['fieldName'],'type':_0x179bd8[_0x796f('0x37')][_0x796f('0x38')]};});_0x1fe931[_0x796f('0x39')]=_[_0x796f('0x34')](_0x4b916,_0x796f('0x32'));_0x1fe931['query']=_[_0x796f('0x3a')](_0x193a12[_0x796f('0x3b')]);_0x1fe931[_0x796f('0x3c')]=_[_0x796f('0x3d')](_0x1fe931[_0x796f('0x39')],_0x1fe931[_0x796f('0x3b')]);_0x1c4a6f['attributes']=_[_0x796f('0x3d')](_0x1fe931[_0x796f('0x39')],qs[_0x796f('0x3e')](_0x193a12[_0x796f('0x3b')][_0x796f('0x3e')]));_0x1c4a6f[_0x796f('0x3f')]=_0x1c4a6f[_0x796f('0x3f')]['length']?_0x1c4a6f['attributes']:_0x1fe931['model'];if(!_0x193a12[_0x796f('0x3b')][_0x796f('0x40')](_0x796f('0x41'))){_0x1c4a6f[_0x796f('0x22')]=qs[_0x796f('0x22')](_0x193a12[_0x796f('0x3b')][_0x796f('0x22')]);_0x1c4a6f[_0x796f('0x25')]=qs[_0x796f('0x25')](_0x193a12[_0x796f('0x3b')]['offset']);}_0x1c4a6f[_0x796f('0x42')]=qs[_0x796f('0x43')](_0x193a12[_0x796f('0x3b')][_0x796f('0x43')]);_0x1c4a6f[_0x796f('0x44')]=qs['filters'](_[_0x796f('0x45')](_0x193a12[_0x796f('0x3b')],_0x1fe931[_0x796f('0x3c')]),_0x4b916);if(_0x193a12[_0x796f('0x3b')][_0x796f('0x46')]){_0x1c4a6f[_0x796f('0x44')]=_['merge'](_0x1c4a6f[_0x796f('0x44')],{'$or':_[_0x796f('0x34')](_0x4b916,function(_0x52b212){if(_0x52b212[_0x796f('0x37')]!==_0x796f('0x47')){var _0x2a2068={};_0x2a2068[_0x52b212[_0x796f('0x32')]]={'$like':'%'+_0x193a12[_0x796f('0x3b')]['filter']+'%'};return _0x2a2068;}})});}_0x1c4a6f=_['merge']({},_0x1c4a6f,_0x193a12[_0x796f('0x48')]);var _0x4a15ba={'where':_0x1c4a6f[_0x796f('0x44')]};return db[_0x796f('0x35')]['count'](_0x4a15ba)[_0x796f('0x2b')](function(_0xf61d7e){_0x4c89ed[_0x796f('0x24')]=_0xf61d7e;if(_0x193a12['query'][_0x796f('0x49')]){_0x1c4a6f[_0x796f('0x4a')]=[{'all':!![]}];}return db[_0x796f('0x35')][_0x796f('0x4b')](_0x1c4a6f);})[_0x796f('0x2b')](function(_0x399678){_0x4c89ed[_0x796f('0x4c')]=_0x399678;return _0x4c89ed;})[_0x796f('0x2b')](respondWithFilteredResult(_0x483fa8,_0x1c4a6f))[_0x796f('0x4d')](handleError(_0x483fa8,null));};exports['show']=function(_0x467266,_0x39978b){var _0x31e8c9={'raw':![],'where':{'id':_0x467266[_0x796f('0x4e')]['id']}},_0x125dd8={};_0x125dd8[_0x796f('0x39')]=_[_0x796f('0x3a')](db[_0x796f('0x35')][_0x796f('0x36')]);_0x125dd8[_0x796f('0x3b')]=_['keys'](_0x467266['query']);_0x125dd8[_0x796f('0x3c')]=_['intersection'](_0x125dd8[_0x796f('0x39')],_0x125dd8[_0x796f('0x3b')]);_0x31e8c9[_0x796f('0x3f')]=_[_0x796f('0x3d')](_0x125dd8[_0x796f('0x39')],qs[_0x796f('0x3e')](_0x467266[_0x796f('0x3b')][_0x796f('0x3e')]));_0x31e8c9[_0x796f('0x3f')]=_0x31e8c9['attributes'][_0x796f('0x4f')]?_0x31e8c9['attributes']:_0x125dd8[_0x796f('0x39')];if(_0x467266[_0x796f('0x3b')]['includeAll']){_0x31e8c9[_0x796f('0x4a')]=[{'all':!![]}];}_0x31e8c9=_['merge']({},_0x31e8c9,_0x467266[_0x796f('0x48')]);return db[_0x796f('0x35')][_0x796f('0x50')](_0x31e8c9)['then'](handleEntityNotFound(_0x39978b,null))['then'](respondWithResult(_0x39978b,null))[_0x796f('0x4d')](handleError(_0x39978b,null));};exports[_0x796f('0x51')]=function(_0x41cd35,_0x173ea6){return db[_0x796f('0x35')][_0x796f('0x51')](_0x41cd35[_0x796f('0x52')],{})[_0x796f('0x2b')](function(_0x4a3bdf){var _0x5cb7ee=_0x41cd35[_0x796f('0x53')][_0x796f('0x2d')]({'plain':!![]});if(!_0x5cb7ee)throw new Error(_0x796f('0x54'));if(_0x5cb7ee[_0x796f('0x55')]===_0x796f('0x53')){var _0x3c877e=_0x4a3bdf[_0x796f('0x2d')]({'plain':!![]});var _0x50fa1c=_0x796f('0x2e');return db[_0x796f('0x56')][_0x796f('0x50')]({'where':{'name':_0x50fa1c,'userProfileId':_0x5cb7ee[_0x796f('0x57')]},'raw':!![]})[_0x796f('0x2b')](function(_0x337906){if(_0x337906&&_0x337906['autoAssociation']===0x0){return db[_0x796f('0x2f')]['create']({'name':_0x3c877e[_0x796f('0x32')],'resourceId':_0x3c877e['id'],'type':_0x337906[_0x796f('0x32')],'sectionId':_0x337906['id']},{})[_0x796f('0x2b')](function(){return _0x4a3bdf;});}else{return _0x4a3bdf;}})['catch'](function(_0x411f32){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x411f32);throw _0x411f32;});}return _0x4a3bdf;})[_0x796f('0x2b')](respondWithResult(_0x173ea6,0xc9))[_0x796f('0x4d')](handleError(_0x173ea6,null));};exports[_0x796f('0x58')]=function(_0x957326,_0x28f931){if(_0x957326[_0x796f('0x52')]['id']){delete _0x957326[_0x796f('0x52')]['id'];}return db[_0x796f('0x35')][_0x796f('0x50')]({'where':{'id':_0x957326[_0x796f('0x4e')]['id']}})[_0x796f('0x2b')](handleEntityNotFound(_0x28f931,null))[_0x796f('0x2b')](saveUpdates(_0x957326['body'],null))[_0x796f('0x2b')](respondWithResult(_0x28f931,null))[_0x796f('0x4d')](handleError(_0x28f931,null));};exports[_0x796f('0x2c')]=function(_0x2b9b77,_0x116238){return db[_0x796f('0x35')][_0x796f('0x50')]({'where':{'id':_0x2b9b77[_0x796f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x116238,null))[_0x796f('0x2b')](removeEntity(_0x116238,null))[_0x796f('0x4d')](handleError(_0x116238,null));};exports[_0x796f('0x59')]=function(_0x2b8108,_0x1364df,_0x366756){return db['SquareProject'][_0x796f('0x50')]({'where':{'id':_0x2b8108['params']['id']}})[_0x796f('0x2b')](handleEntityNotFound(_0x1364df,null))['then'](function(_0x56fa87){if(_0x56fa87){return _0x56fa87['addUsers'](_0x2b8108[_0x796f('0x52')][_0x796f('0x5a')],_['omit'](_0x2b8108[_0x796f('0x52')],[_0x796f('0x5a'),'id'])||{});}})[_0x796f('0x2b')](respondWithResult(_0x1364df,null))['catch'](handleError(_0x1364df,null));};exports['removeUsers']=function(_0xad4fd1,_0x3a2535,_0x44b9f1){return db[_0x796f('0x35')][_0x796f('0x50')]({'where':{'id':_0xad4fd1[_0x796f('0x4e')]['id']}})[_0x796f('0x2b')](handleEntityNotFound(_0x3a2535,null))[_0x796f('0x2b')](function(_0x79a8d5){if(_0x79a8d5){return _0x79a8d5[_0x796f('0x5b')](_0xad4fd1['query'][_0x796f('0x5a')])['then'](function(){if(_[_0x796f('0x5c')](_0xad4fd1[_0x796f('0x3b')]['ids'])){for(var _0x18385a=0x0;_0x18385a<_0xad4fd1[_0x796f('0x3b')]['ids'][_0x796f('0x4f')];_0x18385a+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0xad4fd1[_0x796f('0x3b')][_0x796f('0x5a')][_0x18385a]),'SquareProjectId':Number(_0xad4fd1[_0x796f('0x4e')]['id'])});}}else{socket[_0x796f('0x5d')]('userSquareProject:remove',{'UserId':Number(_0xad4fd1[_0x796f('0x3b')][_0x796f('0x5a')]),'SquareProjectId':Number(_0xad4fd1[_0x796f('0x4e')]['id'])});}});}})[_0x796f('0x2b')](respondWithStatusCode(_0x3a2535,null))[_0x796f('0x4d')](handleError(_0x3a2535,null));};exports['getUsers']=function(_0x138dae,_0x3b5bb7,_0xa3d62b){var _0x17b331={};var _0x3baf19={};var _0x4e3e0b;var _0x52f490;return db[_0x796f('0x35')]['findOne']({'where':{'id':_0x138dae[_0x796f('0x4e')]['id']}})[_0x796f('0x2b')](handleEntityNotFound(_0x3b5bb7,null))[_0x796f('0x2b')](function(_0x3db937){if(_0x3db937){_0x4e3e0b=_0x3db937;_0x3baf19['model']=_[_0x796f('0x3a')](db[_0x796f('0x5e')][_0x796f('0x36')]);_0x3baf19['query']=_['keys'](_0x138dae[_0x796f('0x3b')]);_0x3baf19[_0x796f('0x3c')]=_[_0x796f('0x3d')](_0x3baf19[_0x796f('0x39')],_0x3baf19[_0x796f('0x3b')]);_0x17b331[_0x796f('0x3f')]=_['intersection'](_0x3baf19[_0x796f('0x39')],qs[_0x796f('0x3e')](_0x138dae[_0x796f('0x3b')][_0x796f('0x3e')]));_0x17b331['attributes']=_0x17b331[_0x796f('0x3f')][_0x796f('0x4f')]?_0x17b331[_0x796f('0x3f')]:_0x3baf19[_0x796f('0x39')];_0x17b331[_0x796f('0x42')]=qs[_0x796f('0x43')](_0x138dae[_0x796f('0x3b')][_0x796f('0x43')]);_0x17b331[_0x796f('0x44')]=qs[_0x796f('0x3c')](_['pick'](_0x138dae['query'],_0x3baf19['filters']));if(_0x138dae[_0x796f('0x3b')][_0x796f('0x46')]){_0x17b331[_0x796f('0x44')]=_[_0x796f('0x5f')](_0x17b331[_0x796f('0x44')],{'$or':_[_0x796f('0x34')](_0x17b331[_0x796f('0x3f')],function(_0x5edb95){var _0x34d2a8={};_0x34d2a8[_0x5edb95]={'$like':'%'+_0x138dae[_0x796f('0x3b')][_0x796f('0x46')]+'%'};return _0x34d2a8;})});}_0x17b331=_[_0x796f('0x5f')]({},_0x17b331,_0x138dae[_0x796f('0x48')]);return _0x4e3e0b['getUsers'](_0x17b331);}})['then'](function(_0x2f28d5){if(_0x2f28d5){_0x52f490=_0x2f28d5[_0x796f('0x4f')];if(!_0x138dae[_0x796f('0x3b')][_0x796f('0x40')](_0x796f('0x41'))){_0x17b331[_0x796f('0x22')]=qs[_0x796f('0x22')](_0x138dae['query'][_0x796f('0x22')]);_0x17b331[_0x796f('0x25')]=qs[_0x796f('0x25')](_0x138dae['query']['offset']);}return _0x4e3e0b[_0x796f('0x60')](_0x17b331);}})[_0x796f('0x2b')](function(_0x2599e6){if(_0x2599e6){return _0x2599e6?{'count':_0x52f490,'rows':_0x2599e6}:null;}})[_0x796f('0x2b')](respondWithResult(_0x3b5bb7,null))[_0x796f('0x4d')](handleError(_0x3b5bb7,null));}; \ No newline at end of file +var _0xc0f6=['UserProfileResource','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','params','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','findOne','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','end','status','undefined','limit','count','offset','json','reject','update','then','destroy','get'];(function(_0x4e2e37,_0x1bff3f){var _0x4c55ec=function(_0x26165a){while(--_0x26165a){_0x4e2e37['push'](_0x4e2e37['shift']());}};_0x4c55ec(++_0x1bff3f);}(_0xc0f6,0x95));var _0x6c0f=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0xc0f6[_0x237da8];return _0x558825;};'use strict';var emlformat=require(_0x6c0f('0x0'));var rimraf=require(_0x6c0f('0x1'));var zipdir=require(_0x6c0f('0x2'));var jsonpatch=require(_0x6c0f('0x3'));var rp=require(_0x6c0f('0x4'));var moment=require(_0x6c0f('0x5'));var BPromise=require(_0x6c0f('0x6'));var Mustache=require(_0x6c0f('0x7'));var util=require(_0x6c0f('0x8'));var path=require(_0x6c0f('0x9'));var sox=require(_0x6c0f('0xa'));var csv=require(_0x6c0f('0xb'));var ejs=require(_0x6c0f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c0f('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6c0f('0xe'));var deskjs=require(_0x6c0f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6c0f('0x10'));var Papa=require(_0x6c0f('0x11'));var Redis=require(_0x6c0f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6c0f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c0f('0x14'));var logger=require(_0x6c0f('0x15'))(_0x6c0f('0x16'));var utils=require('../../config/utils');var config=require(_0x6c0f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c0f('0x18'))['db'];config['redis']=_['defaults'](config[_0x6c0f('0x19')],{'host':_0x6c0f('0x1a'),'port':0x18eb});var socket=require(_0x6c0f('0x1b'))(new Redis(config[_0x6c0f('0x19')]));require(_0x6c0f('0x1c'))[_0x6c0f('0x1d')](socket);function respondWithStatusCode(_0x3c5b36,_0x423829){_0x423829=_0x423829||0xcc;return function(_0x1e365c){if(_0x1e365c){return _0x3c5b36[_0x6c0f('0x1e')](_0x423829);}return _0x3c5b36['status'](_0x423829)[_0x6c0f('0x1f')]();};}function respondWithResult(_0x2ea59b,_0x5195e8){_0x5195e8=_0x5195e8||0xc8;return function(_0x40d0f5){if(_0x40d0f5){return _0x2ea59b[_0x6c0f('0x20')](_0x5195e8)['json'](_0x40d0f5);}};}function respondWithFilteredResult(_0x45c703,_0x40b915){return function(_0x4ed579){if(_0x4ed579){var _0x4825f0=typeof _0x40b915['offset']===_0x6c0f('0x21')&&typeof _0x40b915[_0x6c0f('0x22')]===_0x6c0f('0x21');var _0x4eec88=_0x4ed579[_0x6c0f('0x23')];var _0x5d74c0=_0x4825f0?0x0:_0x40b915[_0x6c0f('0x24')];var _0x306bb2=_0x4825f0?_0x4ed579[_0x6c0f('0x23')]:_0x40b915['offset']+_0x40b915[_0x6c0f('0x22')];var _0x1d8d3c;if(_0x306bb2>=_0x4eec88){_0x306bb2=_0x4eec88;_0x1d8d3c=0xc8;}else{_0x1d8d3c=0xce;}_0x45c703['status'](_0x1d8d3c);return _0x45c703['set']('Content-Range',_0x5d74c0+'-'+_0x306bb2+'/'+_0x4eec88)[_0x6c0f('0x25')](_0x4ed579);}return null;};}function patchUpdates(_0x1bf4a0){return function(_0xc22b45){try{jsonpatch['apply'](_0xc22b45,_0x1bf4a0,!![]);}catch(_0xcd0e92){return BPromise[_0x6c0f('0x26')](_0xcd0e92);}return _0xc22b45['save']();};}function saveUpdates(_0x234f8f,_0x100b40){return function(_0x22bfde){if(_0x22bfde){return _0x22bfde[_0x6c0f('0x27')](_0x234f8f)[_0x6c0f('0x28')](function(_0x4c31cc){return _0x4c31cc;});}return null;};}function removeEntity(_0x5d49fb,_0x4397aa){return function(_0x389ce2){if(_0x389ce2){return _0x389ce2[_0x6c0f('0x29')]()[_0x6c0f('0x28')](function(){var _0x560365=_0x389ce2[_0x6c0f('0x2a')]({'plain':!![]});var _0x348fdf='SquareProjects';return db[_0x6c0f('0x2b')][_0x6c0f('0x29')]({'where':{'type':_0x348fdf,'resourceId':_0x560365['id']}})[_0x6c0f('0x28')](function(){return _0x389ce2;});})[_0x6c0f('0x28')](function(){_0x5d49fb[_0x6c0f('0x20')](0xcc)[_0x6c0f('0x1f')]();});}};}function handleEntityNotFound(_0x4a59bf,_0x56d289){return function(_0x203d37){if(!_0x203d37){_0x4a59bf[_0x6c0f('0x1e')](0x194);}return _0x203d37;};}function handleError(_0x350be8,_0x8d6845){_0x8d6845=_0x8d6845||0x1f4;return function(_0x391f3a){logger[_0x6c0f('0x2c')](_0x391f3a[_0x6c0f('0x2d')]);if(_0x391f3a['name']){delete _0x391f3a[_0x6c0f('0x2e')];}_0x350be8['status'](_0x8d6845)[_0x6c0f('0x2f')](_0x391f3a);};}exports[_0x6c0f('0x30')]=function(_0x2a4284,_0x5707dd){var _0x43da65={},_0x5a15ad={},_0x26a520={'count':0x0,'rows':[]};var _0x51dab1=_[_0x6c0f('0x31')](db[_0x6c0f('0x32')][_0x6c0f('0x33')],function(_0x42109f){return{'name':_0x42109f[_0x6c0f('0x34')],'type':_0x42109f[_0x6c0f('0x35')][_0x6c0f('0x36')]};});_0x5a15ad[_0x6c0f('0x37')]=_[_0x6c0f('0x31')](_0x51dab1,_0x6c0f('0x2e'));_0x5a15ad['query']=_['keys'](_0x2a4284[_0x6c0f('0x38')]);_0x5a15ad[_0x6c0f('0x39')]=_[_0x6c0f('0x3a')](_0x5a15ad[_0x6c0f('0x37')],_0x5a15ad['query']);_0x43da65[_0x6c0f('0x3b')]=_[_0x6c0f('0x3a')](_0x5a15ad[_0x6c0f('0x37')],qs['fields'](_0x2a4284['query'][_0x6c0f('0x3c')]));_0x43da65['attributes']=_0x43da65[_0x6c0f('0x3b')][_0x6c0f('0x3d')]?_0x43da65[_0x6c0f('0x3b')]:_0x5a15ad['model'];if(!_0x2a4284[_0x6c0f('0x38')][_0x6c0f('0x3e')](_0x6c0f('0x3f'))){_0x43da65[_0x6c0f('0x22')]=qs[_0x6c0f('0x22')](_0x2a4284['query'][_0x6c0f('0x22')]);_0x43da65['offset']=qs[_0x6c0f('0x24')](_0x2a4284[_0x6c0f('0x38')]['offset']);}_0x43da65['order']=qs[_0x6c0f('0x40')](_0x2a4284['query'][_0x6c0f('0x40')]);_0x43da65[_0x6c0f('0x41')]=qs[_0x6c0f('0x39')](_[_0x6c0f('0x42')](_0x2a4284[_0x6c0f('0x38')],_0x5a15ad[_0x6c0f('0x39')]),_0x51dab1);if(_0x2a4284[_0x6c0f('0x38')][_0x6c0f('0x43')]){_0x43da65[_0x6c0f('0x41')]=_[_0x6c0f('0x44')](_0x43da65[_0x6c0f('0x41')],{'$or':_[_0x6c0f('0x31')](_0x51dab1,function(_0x22dafc){if(_0x22dafc[_0x6c0f('0x35')]!==_0x6c0f('0x45')){var _0x558263={};_0x558263[_0x22dafc['name']]={'$like':'%'+_0x2a4284[_0x6c0f('0x38')]['filter']+'%'};return _0x558263;}})});}_0x43da65=_[_0x6c0f('0x44')]({},_0x43da65,_0x2a4284['options']);var _0x3b1e39={'where':_0x43da65[_0x6c0f('0x41')]};return db[_0x6c0f('0x32')][_0x6c0f('0x23')](_0x3b1e39)[_0x6c0f('0x28')](function(_0x2a1160){_0x26a520[_0x6c0f('0x23')]=_0x2a1160;if(_0x2a4284[_0x6c0f('0x38')]['includeAll']){_0x43da65[_0x6c0f('0x46')]=[{'all':!![]}];}return db[_0x6c0f('0x32')][_0x6c0f('0x47')](_0x43da65);})[_0x6c0f('0x28')](function(_0x5da57d){_0x26a520[_0x6c0f('0x48')]=_0x5da57d;return _0x26a520;})[_0x6c0f('0x28')](respondWithFilteredResult(_0x5707dd,_0x43da65))[_0x6c0f('0x49')](handleError(_0x5707dd,null));};exports[_0x6c0f('0x4a')]=function(_0x258ea0,_0x587b64){var _0x297cff={'raw':![],'where':{'id':_0x258ea0['params']['id']}},_0x21efae={};_0x21efae[_0x6c0f('0x37')]=_['keys'](db['SquareProject'][_0x6c0f('0x33')]);_0x21efae['query']=_[_0x6c0f('0x4b')](_0x258ea0[_0x6c0f('0x38')]);_0x21efae[_0x6c0f('0x39')]=_[_0x6c0f('0x3a')](_0x21efae[_0x6c0f('0x37')],_0x21efae[_0x6c0f('0x38')]);_0x297cff[_0x6c0f('0x3b')]=_[_0x6c0f('0x3a')](_0x21efae[_0x6c0f('0x37')],qs[_0x6c0f('0x3c')](_0x258ea0[_0x6c0f('0x38')]['fields']));_0x297cff[_0x6c0f('0x3b')]=_0x297cff[_0x6c0f('0x3b')][_0x6c0f('0x3d')]?_0x297cff[_0x6c0f('0x3b')]:_0x21efae[_0x6c0f('0x37')];if(_0x258ea0[_0x6c0f('0x38')][_0x6c0f('0x4c')]){_0x297cff[_0x6c0f('0x46')]=[{'all':!![]}];}_0x297cff=_[_0x6c0f('0x44')]({},_0x297cff,_0x258ea0[_0x6c0f('0x4d')]);return db[_0x6c0f('0x32')][_0x6c0f('0x4e')](_0x297cff)[_0x6c0f('0x28')](handleEntityNotFound(_0x587b64,null))['then'](respondWithResult(_0x587b64,null))['catch'](handleError(_0x587b64,null));};exports[_0x6c0f('0x4f')]=function(_0x4dce42,_0x36d731){return db[_0x6c0f('0x32')][_0x6c0f('0x4f')](_0x4dce42[_0x6c0f('0x50')],{})[_0x6c0f('0x28')](function(_0x21bc28){var _0x34fc42=_0x4dce42['user']['get']({'plain':!![]});if(!_0x34fc42)throw new Error(_0x6c0f('0x51'));if(_0x34fc42['role']===_0x6c0f('0x52')){var _0x57a516=_0x21bc28[_0x6c0f('0x2a')]({'plain':!![]});var _0xa7d52d='SquareProjects';return db[_0x6c0f('0x53')][_0x6c0f('0x4e')]({'where':{'name':_0xa7d52d,'userProfileId':_0x34fc42[_0x6c0f('0x54')]},'raw':!![]})[_0x6c0f('0x28')](function(_0x5ba965){if(_0x5ba965&&_0x5ba965[_0x6c0f('0x55')]===0x0){return db[_0x6c0f('0x2b')]['create']({'name':_0x57a516['name'],'resourceId':_0x57a516['id'],'type':_0x5ba965[_0x6c0f('0x2e')],'sectionId':_0x5ba965['id']},{})['then'](function(){return _0x21bc28;});}else{return _0x21bc28;}})[_0x6c0f('0x49')](function(_0x3fbaad){logger[_0x6c0f('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fbaad);throw _0x3fbaad;});}return _0x21bc28;})[_0x6c0f('0x28')](respondWithResult(_0x36d731,0xc9))[_0x6c0f('0x49')](handleError(_0x36d731,null));};exports[_0x6c0f('0x27')]=function(_0x20efb9,_0x168eb9){if(_0x20efb9[_0x6c0f('0x50')]['id']){delete _0x20efb9['body']['id'];}return db['SquareProject'][_0x6c0f('0x4e')]({'where':{'id':_0x20efb9['params']['id']}})[_0x6c0f('0x28')](handleEntityNotFound(_0x168eb9,null))['then'](saveUpdates(_0x20efb9['body'],null))['then'](respondWithResult(_0x168eb9,null))[_0x6c0f('0x49')](handleError(_0x168eb9,null));};exports[_0x6c0f('0x29')]=function(_0x89aa5b,_0x321334){return db[_0x6c0f('0x32')]['find']({'where':{'id':_0x89aa5b[_0x6c0f('0x56')]['id']}})['then'](handleEntityNotFound(_0x321334,null))[_0x6c0f('0x28')](removeEntity(_0x321334,null))[_0x6c0f('0x49')](handleError(_0x321334,null));};exports[_0x6c0f('0x57')]=function(_0x5845a0,_0x4c839e,_0x32e5c2){return db[_0x6c0f('0x32')][_0x6c0f('0x4e')]({'where':{'id':_0x5845a0[_0x6c0f('0x56')]['id']}})[_0x6c0f('0x28')](handleEntityNotFound(_0x4c839e,null))[_0x6c0f('0x28')](function(_0x1fef25){if(_0x1fef25){return _0x1fef25['addUsers'](_0x5845a0[_0x6c0f('0x50')][_0x6c0f('0x58')],_[_0x6c0f('0x59')](_0x5845a0[_0x6c0f('0x50')],['ids','id'])||{});}})['then'](respondWithResult(_0x4c839e,null))['catch'](handleError(_0x4c839e,null));};exports[_0x6c0f('0x5a')]=function(_0x12469a,_0x4ecc76,_0x4736e3){return db['SquareProject'][_0x6c0f('0x4e')]({'where':{'id':_0x12469a[_0x6c0f('0x56')]['id']}})[_0x6c0f('0x28')](handleEntityNotFound(_0x4ecc76,null))[_0x6c0f('0x28')](function(_0x37b54e){if(_0x37b54e){return _0x37b54e[_0x6c0f('0x5a')](_0x12469a[_0x6c0f('0x38')][_0x6c0f('0x58')])[_0x6c0f('0x28')](function(){if(_['isArray'](_0x12469a[_0x6c0f('0x38')][_0x6c0f('0x58')])){for(var _0x6377d8=0x0;_0x6377d8<_0x12469a[_0x6c0f('0x38')][_0x6c0f('0x58')]['length'];_0x6377d8+=0x1){socket[_0x6c0f('0x5b')]('userSquareProject:remove',{'UserId':Number(_0x12469a[_0x6c0f('0x38')][_0x6c0f('0x58')][_0x6377d8]),'SquareProjectId':Number(_0x12469a[_0x6c0f('0x56')]['id'])});}}else{socket['emit'](_0x6c0f('0x5c'),{'UserId':Number(_0x12469a['query'][_0x6c0f('0x58')]),'SquareProjectId':Number(_0x12469a[_0x6c0f('0x56')]['id'])});}});}})[_0x6c0f('0x28')](respondWithStatusCode(_0x4ecc76,null))[_0x6c0f('0x49')](handleError(_0x4ecc76,null));};exports[_0x6c0f('0x5d')]=function(_0x1e3361,_0x5bdc8f,_0x191a6e){var _0x146086={};var _0x39bb2c={};var _0x132d06;var _0x4c27e2;return db[_0x6c0f('0x32')][_0x6c0f('0x5e')]({'where':{'id':_0x1e3361[_0x6c0f('0x56')]['id']}})[_0x6c0f('0x28')](handleEntityNotFound(_0x5bdc8f,null))['then'](function(_0x46ed2a){if(_0x46ed2a){_0x132d06=_0x46ed2a;_0x39bb2c[_0x6c0f('0x37')]=_[_0x6c0f('0x4b')](db[_0x6c0f('0x5f')]['rawAttributes']);_0x39bb2c[_0x6c0f('0x38')]=_[_0x6c0f('0x4b')](_0x1e3361[_0x6c0f('0x38')]);_0x39bb2c[_0x6c0f('0x39')]=_[_0x6c0f('0x3a')](_0x39bb2c[_0x6c0f('0x37')],_0x39bb2c[_0x6c0f('0x38')]);_0x146086[_0x6c0f('0x3b')]=_[_0x6c0f('0x3a')](_0x39bb2c[_0x6c0f('0x37')],qs['fields'](_0x1e3361[_0x6c0f('0x38')][_0x6c0f('0x3c')]));_0x146086[_0x6c0f('0x3b')]=_0x146086[_0x6c0f('0x3b')][_0x6c0f('0x3d')]?_0x146086['attributes']:_0x39bb2c[_0x6c0f('0x37')];_0x146086['order']=qs[_0x6c0f('0x40')](_0x1e3361[_0x6c0f('0x38')][_0x6c0f('0x40')]);_0x146086[_0x6c0f('0x41')]=qs[_0x6c0f('0x39')](_[_0x6c0f('0x42')](_0x1e3361['query'],_0x39bb2c['filters']));if(_0x1e3361[_0x6c0f('0x38')][_0x6c0f('0x43')]){_0x146086[_0x6c0f('0x41')]=_[_0x6c0f('0x44')](_0x146086['where'],{'$or':_[_0x6c0f('0x31')](_0x146086[_0x6c0f('0x3b')],function(_0x55ecd6){var _0x916406={};_0x916406[_0x55ecd6]={'$like':'%'+_0x1e3361['query'][_0x6c0f('0x43')]+'%'};return _0x916406;})});}_0x146086=_[_0x6c0f('0x44')]({},_0x146086,_0x1e3361[_0x6c0f('0x4d')]);return _0x132d06[_0x6c0f('0x5d')](_0x146086);}})[_0x6c0f('0x28')](function(_0x1dd4d3){if(_0x1dd4d3){_0x4c27e2=_0x1dd4d3[_0x6c0f('0x3d')];if(!_0x1e3361[_0x6c0f('0x38')][_0x6c0f('0x3e')](_0x6c0f('0x3f'))){_0x146086[_0x6c0f('0x22')]=qs['limit'](_0x1e3361['query'][_0x6c0f('0x22')]);_0x146086[_0x6c0f('0x24')]=qs[_0x6c0f('0x24')](_0x1e3361[_0x6c0f('0x38')]['offset']);}return _0x132d06[_0x6c0f('0x5d')](_0x146086);}})[_0x6c0f('0x28')](function(_0x1d5e04){if(_0x1d5e04){return _0x1d5e04?{'count':_0x4c27e2,'rows':_0x1d5e04}:null;}})['then'](respondWithResult(_0x5bdc8f,null))['catch'](handleError(_0x5bdc8f,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 9b571df..7cfdf99 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 _0x686c=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners'];(function(_0xbcc5ec,_0x447f85){var _0xfdb877=function(_0x4d2221){while(--_0x4d2221){_0xbcc5ec['push'](_0xbcc5ec['shift']());}};_0xfdb877(++_0x447f85);}(_0x686c,0x6b));var _0xc686=function(_0x5cfd3b,_0x4c4d69){_0x5cfd3b=_0x5cfd3b-0x0;var _0x5524dc=_0x686c[_0x5cfd3b];return _0x5524dc;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xc686('0x0'))['db'][_0xc686('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xc686('0x2')](0x0);var events={'afterCreate':_0xc686('0x3'),'afterUpdate':_0xc686('0x4'),'afterDestroy':_0xc686('0x5')};function emitEvent(_0x2c2a7a){return function(_0x648821,_0x103e1,_0xc5d628){SquareProjectEvents[_0xc686('0x6')](_0x2c2a7a+':'+_0x648821['id'],_0x648821);SquareProjectEvents[_0xc686('0x6')](_0x2c2a7a,_0x648821);_0xc5d628(null);};}for(var e in events){if(events[_0xc686('0x7')](e)){var event=events[e];SquareProject[_0xc686('0x8')](e,emitEvent(event));}}module[_0xc686('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x3803=['SquareProject','remove','emit','exports','events','../../mysqldb'];(function(_0x55583a,_0x2cb30a){var _0x230683=function(_0x527f80){while(--_0x527f80){_0x55583a['push'](_0x55583a['shift']());}};_0x230683(++_0x2cb30a);}(_0x3803,0xca));var _0x3380=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3803[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x3380('0x0'));var SquareProject=require(_0x3380('0x1'))['db'][_0x3380('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3380('0x3')};function emitEvent(_0x4b9479){return function(_0xdf13cc,_0x27acbe,_0x20fcb7){SquareProjectEvents['emit'](_0x4b9479+':'+_0xdf13cc['id'],_0xdf13cc);SquareProjectEvents[_0x3380('0x4')](_0x4b9479,_0xdf13cc);_0x20fcb7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x3380('0x5')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 0764595..f26603b 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 _0xe423=['bluebird','request-promise','path','rimraf','../../config/environment','define','SquareProject','square_projects','changed','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','lodash','util','../../config/logger','api','moment'];(function(_0x5673d9,_0x3cdedf){var _0x5a4435=function(_0x26b383){while(--_0x26b383){_0x5673d9['push'](_0x5673d9['shift']());}};_0x5a4435(++_0x3cdedf);}(_0xe423,0xb9));var _0x3e42=function(_0x57bc2f,_0x11c1ae){_0x57bc2f=_0x57bc2f-0x0;var _0xde36e4=_0xe423[_0x57bc2f];return _0xde36e4;};'use strict';var _=require(_0x3e42('0x0'));var util=require(_0x3e42('0x1'));var logger=require(_0x3e42('0x2'))(_0x3e42('0x3'));var moment=require(_0x3e42('0x4'));var BPromise=require(_0x3e42('0x5'));var rp=require(_0x3e42('0x6'));var fs=require('fs');var path=require(_0x3e42('0x7'));var rimraf=require(_0x3e42('0x8'));var config=require(_0x3e42('0x9'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x5dcc6e,_0x5943bb){return _0x5dcc6e[_0x3e42('0xa')](_0x3e42('0xb'),attributes,{'tableName':_0x3e42('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53a9d4,_0x12a6fa,_0x542da6){if(_0x53a9d4[_0x3e42('0xd')]('preproduction')){_0x53a9d4[_0x3e42('0xe')]=moment()['format'](_0x3e42('0xf'));}if(_0x53a9d4[_0x3e42('0xd')](_0x3e42('0x10'))){_0x53a9d4[_0x3e42('0x11')]=moment()[_0x3e42('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0x542da6(null,_0x53a9d4);}}});}; \ No newline at end of file +var _0x69dc=['../../config/environment','exports','SquareProject','square_projects','changed','preproduction','savedAt','format','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4cf0b5,_0x3bd5c0){var _0x5e5034=function(_0x41f262){while(--_0x41f262){_0x4cf0b5['push'](_0x4cf0b5['shift']());}};_0x5e5034(++_0x3bd5c0);}(_0x69dc,0xdb));var _0xc69d=function(_0x26996d,_0x18e1cb){_0x26996d=_0x26996d-0x0;var _0x456601=_0x69dc[_0x26996d];return _0x456601;};'use strict';var _=require(_0xc69d('0x0'));var util=require(_0xc69d('0x1'));var logger=require(_0xc69d('0x2'))(_0xc69d('0x3'));var moment=require(_0xc69d('0x4'));var BPromise=require(_0xc69d('0x5'));var rp=require(_0xc69d('0x6'));var fs=require('fs');var path=require(_0xc69d('0x7'));var rimraf=require(_0xc69d('0x8'));var config=require(_0xc69d('0x9'));var attributes=require('./squareProject.attributes');module[_0xc69d('0xa')]=function(_0x3a1363,_0xfb848d){return _0x3a1363['define'](_0xc69d('0xb'),attributes,{'tableName':_0xc69d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40e0dc,_0x20102f,_0x4ba41a){if(_0x40e0dc[_0xc69d('0xd')](_0xc69d('0xe'))){_0x40e0dc[_0xc69d('0xf')]=moment()[_0xc69d('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x40e0dc[_0xc69d('0xd')]('production')){_0x40e0dc[_0xc69d('0x11')]=moment()['format'](_0xc69d('0x12'));}_0x4ba41a(null,_0x40e0dc);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 7f6ce07..f25f1ef 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 _0x0400=['./squareProject.socket','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSquareProject','SquareProject','options','raw','where','attributes','map','include','model','then','debug','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost'];(function(_0x4d5179,_0x1275a1){var _0xe7d4d1=function(_0x482148){while(--_0x482148){_0x4d5179['push'](_0x4d5179['shift']());}};_0xe7d4d1(++_0x1275a1);}(_0x0400,0x197));var _0x0040=function(_0x3d61c6,_0x4571e6){_0x3d61c6=_0x3d61c6-0x0;var _0x47e0df=_0x0400[_0x3d61c6];return _0x47e0df;};'use strict';var _=require(_0x0040('0x0'));var util=require('util');var moment=require(_0x0040('0x1'));var BPromise=require(_0x0040('0x2'));var rs=require(_0x0040('0x3'));var fs=require('fs');var Redis=require(_0x0040('0x4'));var db=require(_0x0040('0x5'))['db'];var utils=require(_0x0040('0x6'));var logger=require('../../config/logger')(_0x0040('0x7'));var config=require(_0x0040('0x8'));var jayson=require(_0x0040('0x9'));var client=jayson[_0x0040('0xa')]['http']({'port':0x232a});config[_0x0040('0xb')]=_['defaults'](config[_0x0040('0xb')],{'host':_0x0040('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0040('0xb')]));require(_0x0040('0xd'))['register'](socket);function respondWithRpcPromise(_0x3b1727,_0x1cb017,_0x3e610c){return new BPromise(function(_0x14f278,_0x1e8cf2){return client['request'](_0x3b1727,_0x3e610c)['then'](function(_0x1a1d9a){logger[_0x0040('0xe')](_0x0040('0xf'),_0x1cb017,_0x0040('0x10'));logger['debug'](_0x0040('0x11'),_0x1cb017,_0x0040('0x10'),JSON[_0x0040('0x12')](_0x1a1d9a));if(_0x1a1d9a[_0x0040('0x13')]){if(_0x1a1d9a['error'][_0x0040('0x14')]===0x1f4){logger[_0x0040('0x13')](_0x0040('0xf'),_0x1cb017,_0x1a1d9a[_0x0040('0x13')]['message']);return _0x1e8cf2(_0x1a1d9a['error'][_0x0040('0x15')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0x1cb017,_0x1a1d9a[_0x0040('0x13')][_0x0040('0x15')]);return _0x14f278(_0x1a1d9a[_0x0040('0x13')]['message']);}else{logger[_0x0040('0xe')]('SquareProject,\x20%s,\x20%s',_0x1cb017,_0x0040('0x10'));_0x14f278(_0x1a1d9a[_0x0040('0x16')][_0x0040('0x15')]);}})['catch'](function(_0x3e1dcb){logger[_0x0040('0x13')](_0x0040('0xf'),_0x1cb017,_0x3e1dcb);_0x1e8cf2(_0x3e1dcb);});});}exports[_0x0040('0x17')]=function(_0x168f17){var _0x45224b=this;return new Promise(function(_0x2fe015,_0x2d2fb6){return db[_0x0040('0x18')]['find']({'raw':_0x168f17[_0x0040('0x19')]?_0x168f17[_0x0040('0x19')][_0x0040('0x1a')]===undefined?!![]:![]:!![],'where':_0x168f17[_0x0040('0x19')]?_0x168f17['options'][_0x0040('0x1b')]||null:null,'attributes':_0x168f17[_0x0040('0x19')]?_0x168f17[_0x0040('0x19')][_0x0040('0x1c')]||null:null,'include':_0x168f17[_0x0040('0x19')]?_0x168f17[_0x0040('0x19')]['include']?_[_0x0040('0x1d')](_0x168f17[_0x0040('0x19')][_0x0040('0x1e')],function(_0x4686ab){return{'model':db[_0x4686ab[_0x0040('0x1f')]],'as':_0x4686ab['as'],'attributes':_0x4686ab[_0x0040('0x1c')],'include':_0x4686ab['include']?_[_0x0040('0x1d')](_0x4686ab['include'],function(_0x28db90){return{'model':db[_0x28db90[_0x0040('0x1f')]],'as':_0x28db90['as'],'attributes':_0x28db90[_0x0040('0x1c')],'include':_0x28db90['include']?_[_0x0040('0x1d')](_0x28db90[_0x0040('0x1e')],function(_0xc25734){return{'model':db[_0xc25734['model']],'as':_0xc25734['as'],'attributes':_0xc25734['attributes']};}):[]};}):[]};}):[]:[]})[_0x0040('0x20')](function(_0x1dba11){logger[_0x0040('0xe')](_0x0040('0x17'),_0x168f17);logger[_0x0040('0x21')](_0x0040('0x17'),_0x168f17,JSON[_0x0040('0x12')](_0x1dba11));_0x2fe015(_0x1dba11);})[_0x0040('0x22')](function(_0x1ccda7){logger['error'](_0x0040('0x17'),_0x1ccda7[_0x0040('0x15')],_0x168f17);_0x2d2fb6(_0x45224b[_0x0040('0x13')](0x1f4,_0x1ccda7[_0x0040('0x15')]));});});}; \ No newline at end of file +var _0x9d57=['code','message','catch','ShowSquareProject','SquareProject','options','raw','where','attributes','include','map','model','info','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x9d57,0x118));var _0x79d5=function(_0x174c1d,_0x20c68e){_0x174c1d=_0x174c1d-0x0;var _0x361c26=_0x9d57[_0x174c1d];return _0x361c26;};'use strict';var _=require('lodash');var util=require(_0x79d5('0x0'));var moment=require(_0x79d5('0x1'));var BPromise=require(_0x79d5('0x2'));var rs=require(_0x79d5('0x3'));var fs=require('fs');var Redis=require(_0x79d5('0x4'));var db=require(_0x79d5('0x5'))['db'];var utils=require(_0x79d5('0x6'));var logger=require('../../config/logger')(_0x79d5('0x7'));var config=require(_0x79d5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x79d5('0x9')][_0x79d5('0xa')]({'port':0x232a});config[_0x79d5('0xb')]=_[_0x79d5('0xc')](config[_0x79d5('0xb')],{'host':_0x79d5('0xd'),'port':0x18eb});var socket=require(_0x79d5('0xe'))(new Redis(config['redis']));require(_0x79d5('0xf'))[_0x79d5('0x10')](socket);function respondWithRpcPromise(_0x13b413,_0x3d55ec,_0x1682e8){return new BPromise(function(_0x3983e3,_0x37a5d4){return client[_0x79d5('0x11')](_0x13b413,_0x1682e8)[_0x79d5('0x12')](function(_0xd82e0e){logger['info'](_0x79d5('0x13'),_0x3d55ec,_0x79d5('0x14'));logger['debug'](_0x79d5('0x15'),_0x3d55ec,_0x79d5('0x14'),JSON[_0x79d5('0x16')](_0xd82e0e));if(_0xd82e0e[_0x79d5('0x17')]){if(_0xd82e0e['error'][_0x79d5('0x18')]===0x1f4){logger[_0x79d5('0x17')]('SquareProject,\x20%s,\x20%s',_0x3d55ec,_0xd82e0e[_0x79d5('0x17')][_0x79d5('0x19')]);return _0x37a5d4(_0xd82e0e[_0x79d5('0x17')][_0x79d5('0x19')]);}logger[_0x79d5('0x17')](_0x79d5('0x13'),_0x3d55ec,_0xd82e0e[_0x79d5('0x17')][_0x79d5('0x19')]);return _0x3983e3(_0xd82e0e['error'][_0x79d5('0x19')]);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0x3d55ec,_0x79d5('0x14'));_0x3983e3(_0xd82e0e['result'][_0x79d5('0x19')]);}})[_0x79d5('0x1a')](function(_0x949b47){logger[_0x79d5('0x17')](_0x79d5('0x13'),_0x3d55ec,_0x949b47);_0x37a5d4(_0x949b47);});});}exports[_0x79d5('0x1b')]=function(_0xff9d59){var _0xb5d0b6=this;return new Promise(function(_0xb0cb0d,_0x354a1b){return db[_0x79d5('0x1c')]['find']({'raw':_0xff9d59[_0x79d5('0x1d')]?_0xff9d59[_0x79d5('0x1d')][_0x79d5('0x1e')]===undefined?!![]:![]:!![],'where':_0xff9d59[_0x79d5('0x1d')]?_0xff9d59[_0x79d5('0x1d')][_0x79d5('0x1f')]||null:null,'attributes':_0xff9d59[_0x79d5('0x1d')]?_0xff9d59[_0x79d5('0x1d')][_0x79d5('0x20')]||null:null,'include':_0xff9d59[_0x79d5('0x1d')]?_0xff9d59[_0x79d5('0x1d')][_0x79d5('0x21')]?_[_0x79d5('0x22')](_0xff9d59[_0x79d5('0x1d')][_0x79d5('0x21')],function(_0x3a5d45){return{'model':db[_0x3a5d45['model']],'as':_0x3a5d45['as'],'attributes':_0x3a5d45[_0x79d5('0x20')],'include':_0x3a5d45[_0x79d5('0x21')]?_['map'](_0x3a5d45[_0x79d5('0x21')],function(_0x37784d){return{'model':db[_0x37784d['model']],'as':_0x37784d['as'],'attributes':_0x37784d[_0x79d5('0x20')],'include':_0x37784d['include']?_[_0x79d5('0x22')](_0x37784d[_0x79d5('0x21')],function(_0x2d39d6){return{'model':db[_0x2d39d6[_0x79d5('0x23')]],'as':_0x2d39d6['as'],'attributes':_0x2d39d6['attributes']};}):[]};}):[]};}):[]:[]})[_0x79d5('0x12')](function(_0x513a63){logger[_0x79d5('0x24')](_0x79d5('0x1b'),_0xff9d59);logger[_0x79d5('0x25')]('ShowSquareProject',_0xff9d59,JSON[_0x79d5('0x16')](_0x513a63));_0xb0cb0d(_0x513a63);})[_0x79d5('0x1a')](function(_0x183157){logger[_0x79d5('0x17')]('ShowSquareProject',_0x183157[_0x79d5('0x19')],_0xff9d59);_0x354a1b(_0xb5d0b6[_0x79d5('0x17')](0x1f4,_0x183157['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index a33b1c6..c39b308 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 _0x9b09=['length','squareProject:','./squareProject.events','save','remove','emit','removeListener','register'];(function(_0x5333ba,_0x22e1bb){var _0x20f9dc=function(_0x1956af){while(--_0x1956af){_0x5333ba['push'](_0x5333ba['shift']());}};_0x20f9dc(++_0x22e1bb);}(_0x9b09,0xca));var _0x99b0=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x9b09[_0x31ced5];return _0x10d9e5;};'use strict';var SquareProjectEvents=require(_0x99b0('0x0'));var events=[_0x99b0('0x1'),_0x99b0('0x2'),'update'];function createListener(_0x134ff1,_0x4740f0){return function(_0x16c452){_0x4740f0[_0x99b0('0x3')](_0x134ff1,_0x16c452);};}function removeListener(_0x118d01,_0xc16ada){return function(){SquareProjectEvents[_0x99b0('0x4')](_0x118d01,_0xc16ada);};}exports[_0x99b0('0x5')]=function(_0x3e7b1c){for(var _0x3c1c14=0x0,_0x378cee=events[_0x99b0('0x6')];_0x3c1c14<_0x378cee;_0x3c1c14++){var _0x142dac=events[_0x3c1c14];var _0x4f4821=createListener(_0x99b0('0x7')+_0x142dac,_0x3e7b1c);SquareProjectEvents['on'](_0x142dac,_0x4f4821);}}; \ No newline at end of file +var _0xa2d8=['save','remove','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa2d8,0x77));var _0x8a2d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa2d8[_0x6131cd];return _0x47e916;};'use strict';var SquareProjectEvents=require(_0x8a2d('0x0'));var events=[_0x8a2d('0x1'),_0x8a2d('0x2'),'update'];function createListener(_0x3a2f95,_0x4e0832){return function(_0x927952){_0x4e0832[_0x8a2d('0x3')](_0x3a2f95,_0x927952);};}function removeListener(_0x2ff9f7,_0x1b1a73){return function(){SquareProjectEvents[_0x8a2d('0x4')](_0x2ff9f7,_0x1b1a73);};}exports[_0x8a2d('0x5')]=function(_0x5dafcc){for(var _0x311f62=0x0,_0x35c1e0=events[_0x8a2d('0x6')];_0x311f62<_0x35c1e0;_0x311f62++){var _0x407e2e=events[_0x311f62];var _0x171615=createListener(_0x8a2d('0x7')+_0x407e2e,_0x5dafcc);SquareProjectEvents['on'](_0x407e2e,_0x171615);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index fbec8df..e25957a 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x264f96,_0x208c1c){var _0x55c47d=function(_0x3600f8){while(--_0x3600f8){_0x264f96['push'](_0x264f96['shift']());}};_0x55c47d(++_0x208c1c);}(_0x7a54,0x106));var _0x47a5=function(_0x542041,_0x57ff8f){_0x542041=_0x542041-0x0;var _0xa7ae86=_0x7a54[_0x542041];return _0xa7ae86;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file +var _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x3304ba,_0x3c7902){var _0x30d311=function(_0x5ea7f4){while(--_0x5ea7f4){_0x3304ba['push'](_0x3304ba['shift']());}};_0x30d311(++_0x3c7902);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x45e18e,_0x47cc4d){_0x45e18e=_0x45e18e-0x0;var _0x175e61=_0x7fbe[_0x45e18e];return _0x175e61;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 760571e..d69f304 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 _0x7c09=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x1fc689,_0x1391e2){var _0x58b031=function(_0x348480){while(--_0x348480){_0x1fc689['push'](_0x1fc689['shift']());}};_0x58b031(++_0x1391e2);}(_0x7c09,0x102));var _0x97c0=function(_0x2bec57,_0x20ad44){_0x2bec57=_0x2bec57-0x0;var _0x273be2=_0x7c09[_0x2bec57];return _0x273be2;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'uniqueid':{'type':Sequelize[_0x97c0('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97c0('0x1')]},'context':{'type':Sequelize[_0x97c0('0x1')]},'extension':{'type':Sequelize[_0x97c0('0x1')]},'priority':{'type':Sequelize[_0x97c0('0x1')]},'accountcode':{'type':Sequelize[_0x97c0('0x1')]},'dnid':{'type':Sequelize[_0x97c0('0x1')]},'projectName':{'type':Sequelize[_0x97c0('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x97c0('0x2')],'get':function(){var _0x42c6c7='';var _0x2c19fa=this[_0x97c0('0x3')](_0x97c0('0x4'));if(_0x2c19fa){_0x42c6c7=_0x2c19fa['substring'](_0x2c19fa[_0x97c0('0x5')]('.'));}return _0x42c6c7;}}}; \ No newline at end of file +var _0xa41a=['exports','STRING','getDataValue','substring','lastIndexOf','sequelize'];(function(_0x3be836,_0x590a9b){var _0x3babd5=function(_0x127dae){while(--_0x127dae){_0x3be836['push'](_0x3be836['shift']());}};_0x3babd5(++_0x590a9b);}(_0xa41a,0x6b));var _0xaa41=function(_0x2ad8d5,_0x3db7e7){_0x2ad8d5=_0x2ad8d5-0x0;var _0xd6fe8d=_0xa41a[_0x2ad8d5];return _0xd6fe8d;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'context':{'type':Sequelize[_0xaa41('0x2')]},'extension':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize[_0xaa41('0x2')]},'dnid':{'type':Sequelize[_0xaa41('0x2')]},'projectName':{'type':Sequelize[_0xaa41('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xaa41('0x2')]},'savePath':{'type':Sequelize[_0xaa41('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x5b1fff='';var _0x179545=this[_0xaa41('0x3')]('savePath');if(_0x179545){_0x5b1fff=_0x179545[_0xaa41('0x4')](_0x179545[_0xaa41('0x5')]('.'));}return _0x5b1fff;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index ef8f4aa..861ef8d 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 _0x4cf2=['cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','sendStatus','stack','name','send','index','map','SquareRecording','fieldName','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','find','create','body','../../components/encryptor','type','uniqueid','savePath','filename','format','%s.cypher','existsSync','recording','Sequelize','ValidationError','download','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','destroy','Entity\x20not\x20found'];(function(_0x382f6a,_0x2b25ac){var _0x367fb1=function(_0x564b98){while(--_0x564b98){_0x382f6a['push'](_0x382f6a['shift']());}};_0x367fb1(++_0x2b25ac);}(_0x4cf2,0xcb));var _0x24cf=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x4cf2[_0x462999];return _0x4b1366;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x24cf('0x0'));var zipdir=require(_0x24cf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24cf('0x2'));var moment=require(_0x24cf('0x3'));var BPromise=require(_0x24cf('0x4'));var Mustache=require(_0x24cf('0x5'));var util=require(_0x24cf('0x6'));var path=require(_0x24cf('0x7'));var sox=require('sox');var csv=require(_0x24cf('0x8'));var ejs=require(_0x24cf('0x9'));var fs=require('fs');var fs_extra=require(_0x24cf('0xa'));var _=require(_0x24cf('0xb'));var squel=require(_0x24cf('0xc'));var crypto=require(_0x24cf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x24cf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x24cf('0xf'));var Papa=require(_0x24cf('0x10'));var Redis=require(_0x24cf('0x11'));var authService=require(_0x24cf('0x12'));var qs=require(_0x24cf('0x13'));var as=require(_0x24cf('0x14'));var hardwareService=require(_0x24cf('0x15'));var logger=require(_0x24cf('0x16'))(_0x24cf('0x17'));var utils=require(_0x24cf('0x18'));var config=require(_0x24cf('0x19'));var licenseUtil=require(_0x24cf('0x1a'));var db=require(_0x24cf('0x1b'))['db'];function respondWithStatusCode(_0x5699d8,_0x1ba2a6){_0x1ba2a6=_0x1ba2a6||0xcc;return function(_0x184563){if(_0x184563){return _0x5699d8['sendStatus'](_0x1ba2a6);}return _0x5699d8[_0x24cf('0x1c')](_0x1ba2a6)[_0x24cf('0x1d')]();};}function respondWithResult(_0x438623,_0x39ee7d){_0x39ee7d=_0x39ee7d||0xc8;return function(_0x5c8a49){if(_0x5c8a49){return _0x438623['status'](_0x39ee7d)[_0x24cf('0x1e')](_0x5c8a49);}};}function respondWithFilteredResult(_0x3550aa,_0x4137ec){return function(_0x33b81c){if(_0x33b81c){var _0x6d653e=typeof _0x4137ec[_0x24cf('0x1f')]==='undefined'&&typeof _0x4137ec['limit']===_0x24cf('0x20');var _0x29fffa=_0x33b81c[_0x24cf('0x21')];var _0x45349b=_0x6d653e?0x0:_0x4137ec[_0x24cf('0x1f')];var _0x17c1e3=_0x6d653e?_0x33b81c[_0x24cf('0x21')]:_0x4137ec[_0x24cf('0x1f')]+_0x4137ec[_0x24cf('0x22')];var _0x152459;if(_0x17c1e3>=_0x29fffa){_0x17c1e3=_0x29fffa;_0x152459=0xc8;}else{_0x152459=0xce;}_0x3550aa[_0x24cf('0x1c')](_0x152459);return _0x3550aa[_0x24cf('0x23')](_0x24cf('0x24'),_0x45349b+'-'+_0x17c1e3+'/'+_0x29fffa)[_0x24cf('0x1e')](_0x33b81c);}return null;};}function patchUpdates(_0x2ff781){return function(_0x9200d){try{jsonpatch['apply'](_0x9200d,_0x2ff781,!![]);}catch(_0x40aa3f){return BPromise['reject'](_0x40aa3f);}return _0x9200d[_0x24cf('0x25')]();};}function saveUpdates(_0x57d786,_0x12904d){return function(_0x39c83c){if(_0x39c83c){return _0x39c83c[_0x24cf('0x26')](_0x57d786)[_0x24cf('0x27')](function(_0x5309d4){return _0x5309d4;});}return null;};}function removeEntity(_0x115771,_0x4848a1){return function(_0x26670f){if(_0x26670f){return _0x26670f['destroy']()[_0x24cf('0x27')](function(){_0x115771[_0x24cf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b405e,_0x29bf1d){return function(_0x40dbf2){if(!_0x40dbf2){_0x3b405e[_0x24cf('0x28')](0x194);}return _0x40dbf2;};}function handleError(_0x8fcb60,_0x5887ce){_0x5887ce=_0x5887ce||0x1f4;return function(_0x402dba){logger['error'](_0x402dba[_0x24cf('0x29')]);if(_0x402dba['name']){delete _0x402dba[_0x24cf('0x2a')];}_0x8fcb60[_0x24cf('0x1c')](_0x5887ce)[_0x24cf('0x2b')](_0x402dba);};}exports[_0x24cf('0x2c')]=function(_0x24c001,_0x42c9c8){var _0x5ea8d7={},_0x724236={},_0x4c2548={'count':0x0,'rows':[]};var _0x3730aa=_[_0x24cf('0x2d')](db[_0x24cf('0x2e')]['rawAttributes'],function(_0x4a9164){return{'name':_0x4a9164[_0x24cf('0x2f')],'type':_0x4a9164['type']['key']};});_0x724236[_0x24cf('0x30')]=_[_0x24cf('0x2d')](_0x3730aa,_0x24cf('0x2a'));_0x724236[_0x24cf('0x31')]=_['keys'](_0x24c001[_0x24cf('0x31')]);_0x724236[_0x24cf('0x32')]=_[_0x24cf('0x33')](_0x724236[_0x24cf('0x30')],_0x724236['query']);_0x5ea8d7[_0x24cf('0x34')]=_[_0x24cf('0x33')](_0x724236[_0x24cf('0x30')],qs[_0x24cf('0x35')](_0x24c001['query'][_0x24cf('0x35')]));_0x5ea8d7[_0x24cf('0x34')]=_0x5ea8d7[_0x24cf('0x34')][_0x24cf('0x36')]?_0x5ea8d7[_0x24cf('0x34')]:_0x724236[_0x24cf('0x30')];if(!_0x24c001[_0x24cf('0x31')]['hasOwnProperty'](_0x24cf('0x37'))){_0x5ea8d7['limit']=qs[_0x24cf('0x22')](_0x24c001[_0x24cf('0x31')][_0x24cf('0x22')]);_0x5ea8d7[_0x24cf('0x1f')]=qs['offset'](_0x24c001[_0x24cf('0x31')][_0x24cf('0x1f')]);}_0x5ea8d7[_0x24cf('0x38')]=qs[_0x24cf('0x39')](_0x24c001[_0x24cf('0x31')]['sort']);_0x5ea8d7[_0x24cf('0x3a')]=qs['filters'](_[_0x24cf('0x3b')](_0x24c001[_0x24cf('0x31')],_0x724236[_0x24cf('0x32')]),_0x3730aa);if(_0x24c001['query']['filter']){_0x5ea8d7[_0x24cf('0x3a')]=_[_0x24cf('0x3c')](_0x5ea8d7[_0x24cf('0x3a')],{'$or':_[_0x24cf('0x2d')](_0x3730aa,function(_0x2e97e1){if(_0x2e97e1['type']!==_0x24cf('0x3d')){var _0x4bcde6={};_0x4bcde6[_0x2e97e1[_0x24cf('0x2a')]]={'$like':'%'+_0x24c001['query']['filter']+'%'};return _0x4bcde6;}})});}_0x5ea8d7=_['merge']({},_0x5ea8d7,_0x24c001[_0x24cf('0x3e')]);var _0x37636a={'where':_0x5ea8d7['where']};return db[_0x24cf('0x2e')]['count'](_0x37636a)[_0x24cf('0x27')](function(_0x4e464d){_0x4c2548[_0x24cf('0x21')]=_0x4e464d;if(_0x24c001[_0x24cf('0x31')][_0x24cf('0x3f')]){_0x5ea8d7['include']=[{'all':!![]}];}return db['SquareRecording'][_0x24cf('0x40')](_0x5ea8d7);})[_0x24cf('0x27')](function(_0x2a2530){_0x4c2548[_0x24cf('0x41')]=_0x2a2530;return _0x4c2548;})[_0x24cf('0x27')](respondWithFilteredResult(_0x42c9c8,_0x5ea8d7))[_0x24cf('0x42')](handleError(_0x42c9c8,null));};exports['show']=function(_0x23e1a1,_0x1030d8){var _0x3ac7c8={'raw':!![],'where':{'id':_0x23e1a1[_0x24cf('0x43')]['id']}},_0x43e99f={};_0x43e99f[_0x24cf('0x30')]=_[_0x24cf('0x44')](db[_0x24cf('0x2e')]['rawAttributes']);_0x43e99f[_0x24cf('0x31')]=_[_0x24cf('0x44')](_0x23e1a1[_0x24cf('0x31')]);_0x43e99f[_0x24cf('0x32')]=_[_0x24cf('0x33')](_0x43e99f[_0x24cf('0x30')],_0x43e99f[_0x24cf('0x31')]);_0x3ac7c8[_0x24cf('0x34')]=_[_0x24cf('0x33')](_0x43e99f['model'],qs[_0x24cf('0x35')](_0x23e1a1[_0x24cf('0x31')][_0x24cf('0x35')]));_0x3ac7c8[_0x24cf('0x34')]=_0x3ac7c8[_0x24cf('0x34')][_0x24cf('0x36')]?_0x3ac7c8[_0x24cf('0x34')]:_0x43e99f[_0x24cf('0x30')];if(_0x23e1a1[_0x24cf('0x31')][_0x24cf('0x3f')]){_0x3ac7c8['include']=[{'all':!![]}];}_0x3ac7c8=_[_0x24cf('0x3c')]({},_0x3ac7c8,_0x23e1a1[_0x24cf('0x3e')]);return db[_0x24cf('0x2e')][_0x24cf('0x45')](_0x3ac7c8)[_0x24cf('0x27')](handleEntityNotFound(_0x1030d8,null))[_0x24cf('0x27')](respondWithResult(_0x1030d8,null))[_0x24cf('0x42')](handleError(_0x1030d8,null));};exports['create']=function(_0x524906,_0xa3684c){return db['SquareRecording'][_0x24cf('0x46')](_0x524906['body'],{})[_0x24cf('0x27')](respondWithResult(_0xa3684c,0xc9))['catch'](handleError(_0xa3684c,null));};exports['update']=function(_0x561ffa,_0x239ddf){if(_0x561ffa['body']['id']){delete _0x561ffa[_0x24cf('0x47')]['id'];}return db[_0x24cf('0x2e')][_0x24cf('0x45')]({'where':{'id':_0x561ffa[_0x24cf('0x43')]['id']}})[_0x24cf('0x27')](handleEntityNotFound(_0x239ddf,null))[_0x24cf('0x27')](saveUpdates(_0x561ffa[_0x24cf('0x47')],null))[_0x24cf('0x27')](respondWithResult(_0x239ddf,null))['catch'](handleError(_0x239ddf,null));};exports['download']=function(_0x431f4b,_0x1da217,_0x5a11cb){var _0x4a6439=require(_0x24cf('0x48'));var _0x27d095=![];var _0x3b9e66={};if(_0x431f4b['query']['type']&&_0x431f4b[_0x24cf('0x31')][_0x24cf('0x49')]==='uniqueid'){_0x3b9e66[_0x24cf('0x4a')]=_0x431f4b[_0x24cf('0x43')]['id'];}else{_0x3b9e66['id']=_0x431f4b[_0x24cf('0x43')]['id'];}return db['SquareRecording'][_0x24cf('0x45')]({'where':_0x3b9e66,'attributes':['id',_0x24cf('0x4b'),_0x24cf('0x4c')],'raw':!![]})[_0x24cf('0x27')](handleEntityNotFound(_0x1da217,null))[_0x24cf('0x27')](function(_0x529eb2){if(_0x529eb2){var _0x22634b=_0x529eb2[_0x24cf('0x4b')];var _0x38783a=util[_0x24cf('0x4d')](_0x24cf('0x4e'),_0x22634b);if(fs[_0x24cf('0x4f')](_0x38783a)){_0x27d095=!![];return _0x4a6439['decryptFile'](_0x38783a,_0x22634b,config['secrets'][_0x24cf('0x50')])['then'](function(){return _0x529eb2;});}return _0x529eb2;}})[_0x24cf('0x27')](function(_0x32b5df){if(_0x32b5df){var _0x5d254b=_0x32b5df[_0x24cf('0x4b')];if(!fs[_0x24cf('0x4f')](_0x5d254b)){throw new db[(_0x24cf('0x51'))][(_0x24cf('0x52'))]('SquareRecording\x20not\x20found');}if(_0x32b5df[_0x24cf('0x4c')]){return _0x1da217[_0x24cf('0x53')](_0x5d254b,_0x32b5df['filename']+path[_0x24cf('0x54')](_0x5d254b),function(){if(_0x27d095){fs['unlink'](_0x5d254b);}});}else{return _0x1da217[_0x24cf('0x53')](_0x5d254b,function(_0xb58695){if(_0x27d095){fs[_0x24cf('0x55')](_0x5d254b);}});}}})[_0x24cf('0x42')](function(_0x4917ab){if(_0x4917ab[_0x24cf('0x56')]===_0x24cf('0x57')){_0x1da217[_0x24cf('0x1c')](0x194)['send'](_0x24cf('0x58'));}else{return handleError(_0x1da217,null);}});};exports[_0x24cf('0x59')]=function(_0x39a226,_0x3511a1){return db[_0x24cf('0x2e')]['find']({'where':{'id':_0x39a226[_0x24cf('0x43')]['id']}})['then'](function(_0x331058){if(_['isNil'](_0x331058)){throw new ReferenceError(_0x24cf('0x5a'));}return _0x331058;})[_0x24cf('0x27')](function(_0x5912c8){var _0x8e6e24=_0x5912c8[_0x24cf('0x4b')];logger['info'](_0x24cf('0x5b'),_0x8e6e24);if(!_[_0x24cf('0x5c')](_0x5912c8[_0x24cf('0x4b')])&&fs['existsSync'](_0x8e6e24)){logger[_0x24cf('0x5d')](_0x24cf('0x5e')+_0x8e6e24+_0x24cf('0x5f'));fs[_0x24cf('0x60')](_0x8e6e24);}_0x8e6e24=_0x8e6e24+_0x24cf('0x61');if(!_[_0x24cf('0x5c')](_0x5912c8[_0x24cf('0x4b')])&&fs[_0x24cf('0x4f')](_0x8e6e24)){logger[_0x24cf('0x5d')](_0x24cf('0x5e')+_0x8e6e24+_0x24cf('0x5f'));fs['unlinkSync'](_0x8e6e24);}return _0x5912c8;})[_0x24cf('0x27')](function(_0x16993f){if(!_0x16993f)throw new InternalError();return _0x16993f[_0x24cf('0x59')]();})[_0x24cf('0x27')](function(){_0x3511a1[_0x24cf('0x1c')](0xcc)[_0x24cf('0x1d')]();})['catch'](handleError(_0x3511a1,null));}; \ No newline at end of file +var _0x597a=['squel','jsforce','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','map','SquareRecording','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','type','VIRTUAL','includeAll','include','rows','catch','params','rawAttributes','merge','options','find','create','body','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','zip-dir','moment','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4fb3cc,_0x56b3b6){var _0x38be9f=function(_0x2c94db){while(--_0x2c94db){_0x4fb3cc['push'](_0x4fb3cc['shift']());}};_0x38be9f(++_0x56b3b6);}(_0x597a,0x14b));var _0xa597=function(_0x24006e,_0x42714c){_0x24006e=_0x24006e-0x0;var _0x5b9d3a=_0x597a[_0x24006e];return _0x5b9d3a;};'use strict';var emlformat=require(_0xa597('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa597('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa597('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa597('0x3'));var sox=require(_0xa597('0x4'));var csv=require(_0xa597('0x5'));var ejs=require(_0xa597('0x6'));var fs=require('fs');var fs_extra=require(_0xa597('0x7'));var _=require(_0xa597('0x8'));var squel=require(_0xa597('0x9'));var crypto=require('crypto');var jsforce=require(_0xa597('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa597('0x5'));var querystring=require(_0xa597('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa597('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa597('0xd'))(_0xa597('0xe'));var utils=require(_0xa597('0xf'));var config=require(_0xa597('0x10'));var licenseUtil=require(_0xa597('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48f9c0,_0x2ccebb){_0x2ccebb=_0x2ccebb||0xcc;return function(_0x48ecad){if(_0x48ecad){return _0x48f9c0[_0xa597('0x12')](_0x2ccebb);}return _0x48f9c0[_0xa597('0x13')](_0x2ccebb)[_0xa597('0x14')]();};}function respondWithResult(_0x59717a,_0x134f89){_0x134f89=_0x134f89||0xc8;return function(_0x2d0d89){if(_0x2d0d89){return _0x59717a[_0xa597('0x13')](_0x134f89)[_0xa597('0x15')](_0x2d0d89);}};}function respondWithFilteredResult(_0x494e40,_0x178af2){return function(_0x4eca86){if(_0x4eca86){var _0x13658c=typeof _0x178af2[_0xa597('0x16')]===_0xa597('0x17')&&typeof _0x178af2[_0xa597('0x18')]===_0xa597('0x17');var _0xf69449=_0x4eca86[_0xa597('0x19')];var _0x29f459=_0x13658c?0x0:_0x178af2[_0xa597('0x16')];var _0x186ec8=_0x13658c?_0x4eca86[_0xa597('0x19')]:_0x178af2[_0xa597('0x16')]+_0x178af2[_0xa597('0x18')];var _0x431e7b;if(_0x186ec8>=_0xf69449){_0x186ec8=_0xf69449;_0x431e7b=0xc8;}else{_0x431e7b=0xce;}_0x494e40['status'](_0x431e7b);return _0x494e40[_0xa597('0x1a')]('Content-Range',_0x29f459+'-'+_0x186ec8+'/'+_0xf69449)['json'](_0x4eca86);}return null;};}function patchUpdates(_0x29fb14){return function(_0x474d6e){try{jsonpatch[_0xa597('0x1b')](_0x474d6e,_0x29fb14,!![]);}catch(_0x4b7e76){return BPromise[_0xa597('0x1c')](_0x4b7e76);}return _0x474d6e['save']();};}function saveUpdates(_0x501f1b,_0xcc20cc){return function(_0x1bbc3c){if(_0x1bbc3c){return _0x1bbc3c[_0xa597('0x1d')](_0x501f1b)[_0xa597('0x1e')](function(_0x110001){return _0x110001;});}return null;};}function removeEntity(_0x1ec28d,_0x558321){return function(_0x46bd17){if(_0x46bd17){return _0x46bd17[_0xa597('0x1f')]()[_0xa597('0x1e')](function(){_0x1ec28d[_0xa597('0x13')](0xcc)[_0xa597('0x14')]();});}};}function handleEntityNotFound(_0x16ac08,_0xa58173){return function(_0x19b393){if(!_0x19b393){_0x16ac08['sendStatus'](0x194);}return _0x19b393;};}function handleError(_0x42b522,_0x491837){_0x491837=_0x491837||0x1f4;return function(_0x182248){logger[_0xa597('0x20')](_0x182248[_0xa597('0x21')]);if(_0x182248[_0xa597('0x22')]){delete _0x182248[_0xa597('0x22')];}_0x42b522[_0xa597('0x13')](_0x491837)['send'](_0x182248);};}exports['index']=function(_0xc68911,_0x57039f){var _0x7fd58b={},_0x4e8880={},_0x30547c={'count':0x0,'rows':[]};var _0x3fdc90=_[_0xa597('0x23')](db[_0xa597('0x24')]['rawAttributes'],function(_0x2c1452){return{'name':_0x2c1452['fieldName'],'type':_0x2c1452['type']['key']};});_0x4e8880[_0xa597('0x25')]=_[_0xa597('0x23')](_0x3fdc90,_0xa597('0x22'));_0x4e8880['query']=_[_0xa597('0x26')](_0xc68911[_0xa597('0x27')]);_0x4e8880[_0xa597('0x28')]=_[_0xa597('0x29')](_0x4e8880[_0xa597('0x25')],_0x4e8880[_0xa597('0x27')]);_0x7fd58b[_0xa597('0x2a')]=_[_0xa597('0x29')](_0x4e8880[_0xa597('0x25')],qs['fields'](_0xc68911[_0xa597('0x27')][_0xa597('0x2b')]));_0x7fd58b[_0xa597('0x2a')]=_0x7fd58b[_0xa597('0x2a')][_0xa597('0x2c')]?_0x7fd58b[_0xa597('0x2a')]:_0x4e8880[_0xa597('0x25')];if(!_0xc68911[_0xa597('0x27')][_0xa597('0x2d')](_0xa597('0x2e'))){_0x7fd58b[_0xa597('0x18')]=qs[_0xa597('0x18')](_0xc68911[_0xa597('0x27')][_0xa597('0x18')]);_0x7fd58b[_0xa597('0x16')]=qs[_0xa597('0x16')](_0xc68911[_0xa597('0x27')][_0xa597('0x16')]);}_0x7fd58b['order']=qs[_0xa597('0x2f')](_0xc68911[_0xa597('0x27')][_0xa597('0x2f')]);_0x7fd58b['where']=qs['filters'](_['pick'](_0xc68911[_0xa597('0x27')],_0x4e8880['filters']),_0x3fdc90);if(_0xc68911[_0xa597('0x27')][_0xa597('0x30')]){_0x7fd58b[_0xa597('0x31')]=_['merge'](_0x7fd58b[_0xa597('0x31')],{'$or':_[_0xa597('0x23')](_0x3fdc90,function(_0x142db0){if(_0x142db0[_0xa597('0x32')]!==_0xa597('0x33')){var _0x5c5571={};_0x5c5571[_0x142db0[_0xa597('0x22')]]={'$like':'%'+_0xc68911[_0xa597('0x27')][_0xa597('0x30')]+'%'};return _0x5c5571;}})});}_0x7fd58b=_['merge']({},_0x7fd58b,_0xc68911['options']);var _0x83a416={'where':_0x7fd58b[_0xa597('0x31')]};return db['SquareRecording'][_0xa597('0x19')](_0x83a416)[_0xa597('0x1e')](function(_0x23957d){_0x30547c[_0xa597('0x19')]=_0x23957d;if(_0xc68911['query'][_0xa597('0x34')]){_0x7fd58b[_0xa597('0x35')]=[{'all':!![]}];}return db[_0xa597('0x24')]['findAll'](_0x7fd58b);})[_0xa597('0x1e')](function(_0x30dfc9){_0x30547c[_0xa597('0x36')]=_0x30dfc9;return _0x30547c;})['then'](respondWithFilteredResult(_0x57039f,_0x7fd58b))[_0xa597('0x37')](handleError(_0x57039f,null));};exports['show']=function(_0x3fce10,_0x255efe){var _0x4edaf5={'raw':!![],'where':{'id':_0x3fce10[_0xa597('0x38')]['id']}},_0xe5c952={};_0xe5c952[_0xa597('0x25')]=_[_0xa597('0x26')](db['SquareRecording'][_0xa597('0x39')]);_0xe5c952['query']=_[_0xa597('0x26')](_0x3fce10[_0xa597('0x27')]);_0xe5c952[_0xa597('0x28')]=_[_0xa597('0x29')](_0xe5c952[_0xa597('0x25')],_0xe5c952[_0xa597('0x27')]);_0x4edaf5[_0xa597('0x2a')]=_[_0xa597('0x29')](_0xe5c952[_0xa597('0x25')],qs[_0xa597('0x2b')](_0x3fce10[_0xa597('0x27')][_0xa597('0x2b')]));_0x4edaf5[_0xa597('0x2a')]=_0x4edaf5['attributes'][_0xa597('0x2c')]?_0x4edaf5['attributes']:_0xe5c952[_0xa597('0x25')];if(_0x3fce10['query']['includeAll']){_0x4edaf5[_0xa597('0x35')]=[{'all':!![]}];}_0x4edaf5=_[_0xa597('0x3a')]({},_0x4edaf5,_0x3fce10[_0xa597('0x3b')]);return db['SquareRecording'][_0xa597('0x3c')](_0x4edaf5)[_0xa597('0x1e')](handleEntityNotFound(_0x255efe,null))[_0xa597('0x1e')](respondWithResult(_0x255efe,null))[_0xa597('0x37')](handleError(_0x255efe,null));};exports['create']=function(_0x4904f9,_0x400e3b){return db[_0xa597('0x24')][_0xa597('0x3d')](_0x4904f9[_0xa597('0x3e')],{})[_0xa597('0x1e')](respondWithResult(_0x400e3b,0xc9))['catch'](handleError(_0x400e3b,null));};exports[_0xa597('0x1d')]=function(_0x15b283,_0x3d003c){if(_0x15b283[_0xa597('0x3e')]['id']){delete _0x15b283[_0xa597('0x3e')]['id'];}return db[_0xa597('0x24')]['find']({'where':{'id':_0x15b283[_0xa597('0x38')]['id']}})[_0xa597('0x1e')](handleEntityNotFound(_0x3d003c,null))[_0xa597('0x1e')](saveUpdates(_0x15b283[_0xa597('0x3e')],null))[_0xa597('0x1e')](respondWithResult(_0x3d003c,null))[_0xa597('0x37')](handleError(_0x3d003c,null));};exports['download']=function(_0x12507b,_0x28b5b0,_0x20ad77){var _0x4d42e2=require('../../components/encryptor');var _0x323ff5=![];var _0x24f2d2={};if(_0x12507b[_0xa597('0x27')]['type']&&_0x12507b['query'][_0xa597('0x32')]===_0xa597('0x3f')){_0x24f2d2[_0xa597('0x3f')]=_0x12507b['params']['id'];}else{_0x24f2d2['id']=_0x12507b[_0xa597('0x38')]['id'];}return db[_0xa597('0x24')][_0xa597('0x3c')]({'where':_0x24f2d2,'attributes':['id',_0xa597('0x40'),_0xa597('0x41')],'raw':!![]})[_0xa597('0x1e')](handleEntityNotFound(_0x28b5b0,null))[_0xa597('0x1e')](function(_0x2c0e65){if(_0x2c0e65){var _0x5d6bcf=_0x2c0e65['savePath'];var _0x2191bc=util[_0xa597('0x42')](_0xa597('0x43'),_0x5d6bcf);if(fs[_0xa597('0x44')](_0x2191bc)){_0x323ff5=!![];return _0x4d42e2[_0xa597('0x45')](_0x2191bc,_0x5d6bcf,config[_0xa597('0x46')][_0xa597('0x47')])['then'](function(){return _0x2c0e65;});}return _0x2c0e65;}})['then'](function(_0x12ac88){if(_0x12ac88){var _0x50d6ab=_0x12ac88[_0xa597('0x40')];if(!fs['existsSync'](_0x50d6ab)){throw new db[(_0xa597('0x48'))][(_0xa597('0x49'))](_0xa597('0x4a'));}if(_0x12ac88[_0xa597('0x41')]){return _0x28b5b0[_0xa597('0x4b')](_0x50d6ab,_0x12ac88['filename']+path[_0xa597('0x4c')](_0x50d6ab),function(){if(_0x323ff5){fs[_0xa597('0x4d')](_0x50d6ab);}});}else{return _0x28b5b0[_0xa597('0x4b')](_0x50d6ab,function(_0x56049c){if(_0x323ff5){fs[_0xa597('0x4d')](_0x50d6ab);}});}}})['catch'](function(_0x1c87a5){if(_0x1c87a5['message']===_0xa597('0x4a')){_0x28b5b0[_0xa597('0x13')](0x194)['send'](_0xa597('0x4e'));}else{return handleError(_0x28b5b0,null);}});};exports[_0xa597('0x1f')]=function(_0x35d2b2,_0x10f978){return db['SquareRecording'][_0xa597('0x3c')]({'where':{'id':_0x35d2b2[_0xa597('0x38')]['id']}})[_0xa597('0x1e')](function(_0xb0919a){if(_[_0xa597('0x4f')](_0xb0919a)){throw new ReferenceError('Entity\x20not\x20found');}return _0xb0919a;})[_0xa597('0x1e')](function(_0x5f19f4){var _0xb59704=_0x5f19f4[_0xa597('0x40')];logger[_0xa597('0x50')]('cancellazione\x20fisica\x20documento\x20%s',_0xb59704);if(!_[_0xa597('0x4f')](_0x5f19f4[_0xa597('0x40')])&&fs[_0xa597('0x44')](_0xb59704)){logger[_0xa597('0x50')](_0xa597('0x51')+_0xb59704+_0xa597('0x52'));fs[_0xa597('0x53')](_0xb59704);}_0xb59704=_0xb59704+_0xa597('0x54');if(!_['isNil'](_0x5f19f4[_0xa597('0x40')])&&fs[_0xa597('0x44')](_0xb59704)){logger[_0xa597('0x50')](_0xa597('0x51')+_0xb59704+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa597('0x53')](_0xb59704);}return _0x5f19f4;})[_0xa597('0x1e')](function(_0x29a45c){if(!_0x29a45c)throw new InternalError();return _0x29a45c['destroy']();})[_0xa597('0x1e')](function(){_0x10f978[_0xa597('0x13')](0xcc)['end']();})['catch'](handleError(_0x10f978,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index e15edaa..40f4fd1 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 _0x16ce=['square_recordings','util','../../config/logger','api','moment','bluebird','request-promise','./squareRecording.attributes','define','SquareRecording'];(function(_0x3228e8,_0x28237d){var _0x2f5943=function(_0x30ffd0){while(--_0x30ffd0){_0x3228e8['push'](_0x3228e8['shift']());}};_0x2f5943(++_0x28237d);}(_0x16ce,0xfb));var _0xe16c=function(_0x289d18,_0x1d4271){_0x289d18=_0x289d18-0x0;var _0x2b3ad9=_0x16ce[_0x289d18];return _0x2b3ad9;};'use strict';var _=require('lodash');var util=require(_0xe16c('0x0'));var logger=require(_0xe16c('0x1'))(_0xe16c('0x2'));var moment=require(_0xe16c('0x3'));var BPromise=require(_0xe16c('0x4'));var rp=require(_0xe16c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe16c('0x6'));module['exports']=function(_0x1707f9,_0x13ee4a){return _0x1707f9[_0xe16c('0x7')](_0xe16c('0x8'),attributes,{'tableName':_0xe16c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd05=['../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','moment','bluebird','request-promise','path'];(function(_0x5dff5b,_0x600c5d){var _0x34dd83=function(_0x9830f8){while(--_0x9830f8){_0x5dff5b['push'](_0x5dff5b['shift']());}};_0x34dd83(++_0x600c5d);}(_0xcd05,0x163));var _0x5cd0=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0xcd05[_0x1399d6];return _0x4a9db4;};'use strict';var _=require(_0x5cd0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5cd0('0x1'));var BPromise=require(_0x5cd0('0x2'));var rp=require(_0x5cd0('0x3'));var fs=require('fs');var path=require(_0x5cd0('0x4'));var rimraf=require('rimraf');var config=require(_0x5cd0('0x5'));var attributes=require(_0x5cd0('0x6'));module['exports']=function(_0x47c141,_0x4eea17){return _0x47c141[_0x5cd0('0x7')](_0x5cd0('0x8'),attributes,{'tableName':_0x5cd0('0x9'),'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 8a4b557..b47db21 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 _0x68dd=['SquareRecording','body','options','raw','then','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','info','SquareRecording,\x20%s,\x20%s','debug','request\x20sent','code','error','message','result','catch','CreateSquareRecording'];(function(_0x558744,_0x501f9b){var _0x1cc14f=function(_0x56ec72){while(--_0x56ec72){_0x558744['push'](_0x558744['shift']());}};_0x1cc14f(++_0x501f9b);}(_0x68dd,0x1c7));var _0xd68d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x68dd[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xd68d('0x0'));var util=require(_0xd68d('0x1'));var moment=require(_0xd68d('0x2'));var BPromise=require('bluebird');var rs=require(_0xd68d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd68d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd68d('0x5'))(_0xd68d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd68d('0x7')][_0xd68d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x484612,_0x5a0dd6,_0x53b388){return new BPromise(function(_0x4511b,_0x4fc9f5){return client[_0xd68d('0x9')](_0x484612,_0x53b388)['then'](function(_0x19b9d2){logger[_0xd68d('0xa')](_0xd68d('0xb'),_0x5a0dd6,'request\x20sent');logger[_0xd68d('0xc')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5a0dd6,_0xd68d('0xd'),JSON['stringify'](_0x19b9d2));if(_0x19b9d2['error']){if(_0x19b9d2['error'][_0xd68d('0xe')]===0x1f4){logger[_0xd68d('0xf')](_0xd68d('0xb'),_0x5a0dd6,_0x19b9d2['error']['message']);return _0x4fc9f5(_0x19b9d2[_0xd68d('0xf')][_0xd68d('0x10')]);}logger[_0xd68d('0xf')]('SquareRecording,\x20%s,\x20%s',_0x5a0dd6,_0x19b9d2[_0xd68d('0xf')]['message']);return _0x4511b(_0x19b9d2[_0xd68d('0xf')][_0xd68d('0x10')]);}else{logger['info'](_0xd68d('0xb'),_0x5a0dd6,_0xd68d('0xd'));_0x4511b(_0x19b9d2[_0xd68d('0x11')][_0xd68d('0x10')]);}})[_0xd68d('0x12')](function(_0x299388){logger[_0xd68d('0xf')](_0xd68d('0xb'),_0x5a0dd6,_0x299388);_0x4fc9f5(_0x299388);});});}exports[_0xd68d('0x13')]=function(_0x2f36d0){var _0x1a4013=this;return new Promise(function(_0x79e6b0,_0x5ae2c1){return db[_0xd68d('0x14')]['create'](_0x2f36d0[_0xd68d('0x15')],{'raw':_0x2f36d0['options']?_0x2f36d0[_0xd68d('0x16')][_0xd68d('0x17')]===undefined?!![]:![]:!![]})[_0xd68d('0x18')](function(_0x3008ec){logger[_0xd68d('0xa')]('CreateSquareRecording',_0x2f36d0);logger[_0xd68d('0xc')]('CreateSquareRecording',_0x2f36d0,JSON['stringify'](_0x3008ec));_0x79e6b0(_0x3008ec);})[_0xd68d('0x12')](function(_0x33b0af){logger[_0xd68d('0xf')]('CreateSquareRecording',_0x33b0af[_0xd68d('0x10')],_0x2f36d0);_0x5ae2c1(_0x1a4013[_0xd68d('0xf')](0x1f4,_0x33b0af['message']));});});}; \ No newline at end of file +var _0x0200=['catch','CreateSquareRecording','create','options','stringify','lodash','util','moment','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x1d1d4e,_0x4dbfab){var _0x594fa4=function(_0xd872b){while(--_0xd872b){_0x1d1d4e['push'](_0x1d1d4e['shift']());}};_0x594fa4(++_0x4dbfab);}(_0x0200,0x17b));var _0x0020=function(_0x1b33bc,_0x282af6){_0x1b33bc=_0x1b33bc-0x0;var _0x23b81c=_0x0200[_0x1b33bc];return _0x23b81c;};'use strict';var _=require(_0x0020('0x0'));var util=require(_0x0020('0x1'));var moment=require(_0x0020('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0020('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0020('0x4'));var config=require(_0x0020('0x5'));var jayson=require(_0x0020('0x6'));var client=jayson[_0x0020('0x7')][_0x0020('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ed441,_0x32b49d,_0x5bceaf){return new BPromise(function(_0x33e1bd,_0x5261fb){return client['request'](_0x5ed441,_0x5bceaf)[_0x0020('0x9')](function(_0x4c5052){logger['info'](_0x0020('0xa'),_0x32b49d,'request\x20sent');logger[_0x0020('0xb')](_0x0020('0xc'),_0x32b49d,'request\x20sent',JSON['stringify'](_0x4c5052));if(_0x4c5052[_0x0020('0xd')]){if(_0x4c5052['error'][_0x0020('0xe')]===0x1f4){logger[_0x0020('0xd')]('SquareRecording,\x20%s,\x20%s',_0x32b49d,_0x4c5052[_0x0020('0xd')][_0x0020('0xf')]);return _0x5261fb(_0x4c5052[_0x0020('0xd')]['message']);}logger[_0x0020('0xd')](_0x0020('0xa'),_0x32b49d,_0x4c5052[_0x0020('0xd')][_0x0020('0xf')]);return _0x33e1bd(_0x4c5052[_0x0020('0xd')][_0x0020('0xf')]);}else{logger[_0x0020('0x10')]('SquareRecording,\x20%s,\x20%s',_0x32b49d,'request\x20sent');_0x33e1bd(_0x4c5052['result'][_0x0020('0xf')]);}})[_0x0020('0x11')](function(_0x16f968){logger['error'](_0x0020('0xa'),_0x32b49d,_0x16f968);_0x5261fb(_0x16f968);});});}exports[_0x0020('0x12')]=function(_0x4dc85e){var _0x460159=this;return new Promise(function(_0x50c4a9,_0x1d5aa0){return db['SquareRecording'][_0x0020('0x13')](_0x4dc85e['body'],{'raw':_0x4dc85e['options']?_0x4dc85e[_0x0020('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x0020('0x9')](function(_0x28b459){logger[_0x0020('0x10')](_0x0020('0x12'),_0x4dc85e);logger[_0x0020('0xb')](_0x0020('0x12'),_0x4dc85e,JSON[_0x0020('0x15')](_0x28b459));_0x50c4a9(_0x28b459);})['catch'](function(_0x4c854b){logger[_0x0020('0xd')]('CreateSquareRecording',_0x4c854b[_0x0020('0xf')],_0x4dc85e);_0x1d5aa0(_0x460159[_0x0020('0xd')](0x1f4,_0x4c854b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index fe47043..7f8a5ea 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x20e7ad,_0x5c8f9e){var _0x1cd387=function(_0x37ce74){while(--_0x37ce74){_0x20e7ad['push'](_0x20e7ad['shift']());}};_0x1cd387(++_0x5c8f9e);}(_0xe706,0xa3));var _0x6e70=function(_0x4222e4,_0x25096f){_0x4222e4=_0x4222e4-0x0;var _0x4bfa29=_0xe706[_0x4222e4];return _0x4bfa29;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x3f6f0d,_0x126fbe){var _0x1075f1=function(_0x11dacf){while(--_0x11dacf){_0x3f6f0d['push'](_0x3f6f0d['shift']());}};_0x1075f1(++_0x126fbe);}(_0xe706,0xa3));var _0x6e70=function(_0xee4b51,_0x82653a){_0xee4b51=_0xee4b51-0x0;var _0x5c4317=_0xe706[_0xee4b51];return _0x5c4317;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 9ce4d1c..7eb2eb2 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 _0x5e9d=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x7902d0,_0x378152){var _0x2ab4ac=function(_0x1837ee){while(--_0x1837ee){_0x7902d0['push'](_0x7902d0['shift']());}};_0x2ab4ac(++_0x378152);}(_0x5e9d,0x17d));var _0xd5e9=function(_0x381fb0,_0x1fcec7){_0x381fb0=_0x381fb0-0x0;var _0x24988f=_0x5e9d[_0x381fb0];return _0x24988f;};'use strict';var Sequelize=require(_0xd5e9('0x0'));module[_0xd5e9('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xd5e9('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd5e9('0x2')]},'type':{'type':Sequelize[_0xd5e9('0x2')]},'uniqueid':{'type':Sequelize[_0xd5e9('0x2')]},'version':{'type':Sequelize[_0xd5e9('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xd5e9('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xd5e9('0x2')]},'callingtns':{'type':Sequelize[_0xd5e9('0x2')]},'dnid':{'type':Sequelize[_0xd5e9('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd5e9('0x2')]},'enhanced':{'type':Sequelize[_0xd5e9('0x2')]},'accountcode':{'type':Sequelize[_0xd5e9('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xd5e9('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd5e9('0x3')]},'bot':{'type':Sequelize[_0xd5e9('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x6da9=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x325e4d,_0x511630){var _0x202a36=function(_0x4f61c3){while(--_0x4f61c3){_0x325e4d['push'](_0x325e4d['shift']());}};_0x202a36(++_0x511630);}(_0x6da9,0x161));var _0x96da=function(_0x4753a8,_0x41b7e4){_0x4753a8=_0x4753a8-0x0;var _0x4ea255=_0x6da9[_0x4753a8];return _0x4ea255;};'use strict';var Sequelize=require(_0x96da('0x0'));module[_0x96da('0x1')]={'network':{'type':Sequelize[_0x96da('0x2')]},'network_script':{'type':Sequelize[_0x96da('0x2')]},'request':{'type':Sequelize[_0x96da('0x2')]},'channel':{'type':Sequelize[_0x96da('0x2')]},'language':{'type':Sequelize[_0x96da('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x96da('0x2')]},'calleridname':{'type':Sequelize[_0x96da('0x2')]},'callingpres':{'type':Sequelize[_0x96da('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x96da('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x96da('0x2')]},'rdnis':{'type':Sequelize[_0x96da('0x2')]},'context':{'type':Sequelize[_0x96da('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x96da('0x2')]},'threadid':{'type':Sequelize[_0x96da('0x2')]},'project_name':{'type':Sequelize[_0x96da('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x96da('0x3')]},'bot':{'type':Sequelize[_0x96da('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 37a3e6b..82fb7ce 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 _0x7fbf=['lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','limit','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','SquareReport','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','count','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x6c3084,_0x3c0f96){var _0x3549cd=function(_0x2110a7){while(--_0x2110a7){_0x6c3084['push'](_0x6c3084['shift']());}};_0x3549cd(++_0x3c0f96);}(_0x7fbf,0x1ce));var _0xf7fb=function(_0xfbf3ce,_0x3742c5){_0xfbf3ce=_0xfbf3ce-0x0;var _0x42199a=_0x7fbf[_0xfbf3ce];return _0x42199a;};'use strict';var emlformat=require(_0xf7fb('0x0'));var rimraf=require(_0xf7fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7fb('0x2'));var rp=require(_0xf7fb('0x3'));var moment=require(_0xf7fb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf7fb('0x5'));var util=require(_0xf7fb('0x6'));var path=require(_0xf7fb('0x7'));var sox=require(_0xf7fb('0x8'));var csv=require(_0xf7fb('0x9'));var ejs=require(_0xf7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xf7fb('0xb'));var _=require(_0xf7fb('0xc'));var squel=require(_0xf7fb('0xd'));var crypto=require(_0xf7fb('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf7fb('0xf'));var toCsv=require(_0xf7fb('0x9'));var querystring=require(_0xf7fb('0x10'));var Papa=require(_0xf7fb('0x11'));var Redis=require(_0xf7fb('0x12'));var authService=require(_0xf7fb('0x13'));var qs=require(_0xf7fb('0x14'));var as=require(_0xf7fb('0x15'));var hardwareService=require(_0xf7fb('0x16'));var logger=require(_0xf7fb('0x17'))(_0xf7fb('0x18'));var utils=require(_0xf7fb('0x19'));var config=require(_0xf7fb('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x287d27,_0x4bc329){_0x4bc329=_0x4bc329||0xcc;return function(_0x93d4){if(_0x93d4){return _0x287d27[_0xf7fb('0x1b')](_0x4bc329);}return _0x287d27['status'](_0x4bc329)[_0xf7fb('0x1c')]();};}function respondWithResult(_0x1971df,_0x20a983){_0x20a983=_0x20a983||0xc8;return function(_0xeba129){if(_0xeba129){return _0x1971df[_0xf7fb('0x1d')](_0x20a983)['json'](_0xeba129);}};}function respondWithFilteredResult(_0x3290ef,_0x3996c6){return function(_0x993e93){if(_0x993e93){var _0x213350=typeof _0x3996c6[_0xf7fb('0x1e')]===_0xf7fb('0x1f')&&typeof _0x3996c6[_0xf7fb('0x20')]===_0xf7fb('0x1f');var _0x56ccad=_0x993e93['count'];var _0x3f85ba=_0x213350?0x0:_0x3996c6[_0xf7fb('0x1e')];var _0x22b5e3=_0x213350?_0x993e93['count']:_0x3996c6[_0xf7fb('0x1e')]+_0x3996c6[_0xf7fb('0x20')];var _0x103bc6;if(_0x22b5e3>=_0x56ccad){_0x22b5e3=_0x56ccad;_0x103bc6=0xc8;}else{_0x103bc6=0xce;}_0x3290ef[_0xf7fb('0x1d')](_0x103bc6);return _0x3290ef['set'](_0xf7fb('0x21'),_0x3f85ba+'-'+_0x22b5e3+'/'+_0x56ccad)[_0xf7fb('0x22')](_0x993e93);}return null;};}function patchUpdates(_0x41cd2e){return function(_0x4f8820){try{jsonpatch[_0xf7fb('0x23')](_0x4f8820,_0x41cd2e,!![]);}catch(_0x8564c2){return BPromise['reject'](_0x8564c2);}return _0x4f8820[_0xf7fb('0x24')]();};}function saveUpdates(_0x502cde,_0x5f4b7a){return function(_0x4b7094){if(_0x4b7094){return _0x4b7094[_0xf7fb('0x25')](_0x502cde)[_0xf7fb('0x26')](function(_0x20e97c){return _0x20e97c;});}return null;};}function removeEntity(_0x79bb,_0x1607c9){return function(_0x132057){if(_0x132057){return _0x132057[_0xf7fb('0x27')]()[_0xf7fb('0x26')](function(){_0x79bb[_0xf7fb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b6550,_0x18312c){return function(_0x1f3871){if(!_0x1f3871){_0x3b6550[_0xf7fb('0x1b')](0x194);}return _0x1f3871;};}function handleError(_0x568a2d,_0x166748){_0x166748=_0x166748||0x1f4;return function(_0xe54cdc){logger['error'](_0xe54cdc[_0xf7fb('0x28')]);if(_0xe54cdc[_0xf7fb('0x29')]){delete _0xe54cdc[_0xf7fb('0x29')];}_0x568a2d[_0xf7fb('0x1d')](_0x166748)[_0xf7fb('0x2a')](_0xe54cdc);};}exports[_0xf7fb('0x2b')]=function(_0x595e4c,_0x5ab6d8){var _0xc2cf13={},_0x50e5e7={},_0x28377d={'count':0x0,'rows':[]};var _0x2afbdb=_[_0xf7fb('0x2c')](db[_0xf7fb('0x2d')]['rawAttributes'],function(_0x5162dc){return{'name':_0x5162dc[_0xf7fb('0x2e')],'type':_0x5162dc[_0xf7fb('0x2f')][_0xf7fb('0x30')]};});_0x50e5e7[_0xf7fb('0x31')]=_[_0xf7fb('0x2c')](_0x2afbdb,_0xf7fb('0x29'));_0x50e5e7['query']=_['keys'](_0x595e4c[_0xf7fb('0x32')]);_0x50e5e7['filters']=_[_0xf7fb('0x33')](_0x50e5e7['model'],_0x50e5e7[_0xf7fb('0x32')]);_0xc2cf13['attributes']=_['intersection'](_0x50e5e7[_0xf7fb('0x31')],qs['fields'](_0x595e4c[_0xf7fb('0x32')][_0xf7fb('0x34')]));_0xc2cf13[_0xf7fb('0x35')]=_0xc2cf13[_0xf7fb('0x35')][_0xf7fb('0x36')]?_0xc2cf13[_0xf7fb('0x35')]:_0x50e5e7[_0xf7fb('0x31')];if(!_0x595e4c['query'][_0xf7fb('0x37')](_0xf7fb('0x38'))){_0xc2cf13[_0xf7fb('0x20')]=qs[_0xf7fb('0x20')](_0x595e4c[_0xf7fb('0x32')][_0xf7fb('0x20')]);_0xc2cf13['offset']=qs[_0xf7fb('0x1e')](_0x595e4c['query'][_0xf7fb('0x1e')]);}_0xc2cf13[_0xf7fb('0x39')]=qs[_0xf7fb('0x3a')](_0x595e4c[_0xf7fb('0x32')]['sort']);_0xc2cf13['where']=qs[_0xf7fb('0x3b')](_[_0xf7fb('0x3c')](_0x595e4c[_0xf7fb('0x32')],_0x50e5e7[_0xf7fb('0x3b')]),_0x2afbdb);if(_0x595e4c['query'][_0xf7fb('0x3d')]){_0xc2cf13['where']=_[_0xf7fb('0x3e')](_0xc2cf13[_0xf7fb('0x3f')],{'$or':_[_0xf7fb('0x2c')](_0x2afbdb,function(_0x9a36ea){if(_0x9a36ea[_0xf7fb('0x2f')]!==_0xf7fb('0x40')){var _0x572388={};_0x572388[_0x9a36ea[_0xf7fb('0x29')]]={'$like':'%'+_0x595e4c[_0xf7fb('0x32')][_0xf7fb('0x3d')]+'%'};return _0x572388;}})});}_0xc2cf13=_[_0xf7fb('0x3e')]({},_0xc2cf13,_0x595e4c['options']);var _0x16a9b6={'where':_0xc2cf13[_0xf7fb('0x3f')]};return db['SquareReport'][_0xf7fb('0x41')](_0x16a9b6)[_0xf7fb('0x26')](function(_0x5eb028){_0x28377d['count']=_0x5eb028;if(_0x595e4c[_0xf7fb('0x32')][_0xf7fb('0x42')]){_0xc2cf13['include']=[{'all':!![]}];}return db[_0xf7fb('0x2d')][_0xf7fb('0x43')](_0xc2cf13);})[_0xf7fb('0x26')](function(_0x40e5e0){_0x28377d[_0xf7fb('0x44')]=_0x40e5e0;return _0x28377d;})[_0xf7fb('0x26')](respondWithFilteredResult(_0x5ab6d8,_0xc2cf13))[_0xf7fb('0x45')](handleError(_0x5ab6d8,null));};exports[_0xf7fb('0x46')]=function(_0xa41e3b,_0x253408){var _0x46b778={'raw':!![],'where':{'id':_0xa41e3b['params']['id']}},_0x3a190e={};_0x3a190e['model']=_[_0xf7fb('0x47')](db['SquareReport'][_0xf7fb('0x48')]);_0x3a190e[_0xf7fb('0x32')]=_[_0xf7fb('0x47')](_0xa41e3b[_0xf7fb('0x32')]);_0x3a190e[_0xf7fb('0x3b')]=_[_0xf7fb('0x33')](_0x3a190e['model'],_0x3a190e[_0xf7fb('0x32')]);_0x46b778[_0xf7fb('0x35')]=_[_0xf7fb('0x33')](_0x3a190e['model'],qs['fields'](_0xa41e3b[_0xf7fb('0x32')][_0xf7fb('0x34')]));_0x46b778[_0xf7fb('0x35')]=_0x46b778[_0xf7fb('0x35')][_0xf7fb('0x36')]?_0x46b778['attributes']:_0x3a190e[_0xf7fb('0x31')];if(_0xa41e3b[_0xf7fb('0x32')]['includeAll']){_0x46b778[_0xf7fb('0x49')]=[{'all':!![]}];}_0x46b778=_[_0xf7fb('0x3e')]({},_0x46b778,_0xa41e3b['options']);return db[_0xf7fb('0x2d')]['find'](_0x46b778)[_0xf7fb('0x26')](handleEntityNotFound(_0x253408,null))[_0xf7fb('0x26')](respondWithResult(_0x253408,null))[_0xf7fb('0x45')](handleError(_0x253408,null));};exports[_0xf7fb('0x4a')]=function(_0x9a983c,_0x10e283){return db[_0xf7fb('0x2d')][_0xf7fb('0x4a')](_0x9a983c[_0xf7fb('0x4b')],{})[_0xf7fb('0x26')](respondWithResult(_0x10e283,0xc9))[_0xf7fb('0x45')](handleError(_0x10e283,null));};exports[_0xf7fb('0x25')]=function(_0xe68f14,_0x2639b6){if(_0xe68f14['body']['id']){delete _0xe68f14[_0xf7fb('0x4b')]['id'];}return db[_0xf7fb('0x2d')][_0xf7fb('0x4c')]({'where':{'id':_0xe68f14[_0xf7fb('0x4d')]['id']}})[_0xf7fb('0x26')](handleEntityNotFound(_0x2639b6,null))[_0xf7fb('0x26')](saveUpdates(_0xe68f14[_0xf7fb('0x4b')],null))[_0xf7fb('0x26')](respondWithResult(_0x2639b6,null))[_0xf7fb('0x45')](handleError(_0x2639b6,null));};exports[_0xf7fb('0x27')]=function(_0x274ee9,_0x52b343){return db['SquareReport']['find']({'where':{'id':_0x274ee9[_0xf7fb('0x4d')]['id']}})['then'](handleEntityNotFound(_0x52b343,null))[_0xf7fb('0x26')](removeEntity(_0x52b343,null))[_0xf7fb('0x45')](handleError(_0x52b343,null));};exports[_0xf7fb('0x4e')]=function(_0x1ac2c5,_0x58eb48){return db[_0xf7fb('0x2d')]['describe']()[_0xf7fb('0x26')](respondWithResult(_0x58eb48,null))[_0xf7fb('0x45')](handleError(_0x58eb48,null));}; \ No newline at end of file +var _0xb6e2=['fields','length','hasOwnProperty','order','sort','where','pick','filter','map','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','merge','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','stack','name','send','index','SquareReport','rawAttributes','type','model','query','keys','filters','intersection','attributes'];(function(_0x2e4211,_0x536d67){var _0x9f0bbe=function(_0x28dfca){while(--_0x28dfca){_0x2e4211['push'](_0x2e4211['shift']());}};_0x9f0bbe(++_0x536d67);}(_0xb6e2,0x193));var _0x2b6e=function(_0x1622d2,_0x918280){_0x1622d2=_0x1622d2-0x0;var _0x239c91=_0xb6e2[_0x1622d2];return _0x239c91;};'use strict';var emlformat=require(_0x2b6e('0x0'));var rimraf=require(_0x2b6e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b6e('0x2'));var rp=require(_0x2b6e('0x3'));var moment=require(_0x2b6e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2b6e('0x5'));var util=require(_0x2b6e('0x6'));var path=require(_0x2b6e('0x7'));var sox=require('sox');var csv=require(_0x2b6e('0x8'));var ejs=require(_0x2b6e('0x9'));var fs=require('fs');var fs_extra=require(_0x2b6e('0xa'));var _=require(_0x2b6e('0xb'));var squel=require(_0x2b6e('0xc'));var crypto=require(_0x2b6e('0xd'));var jsforce=require(_0x2b6e('0xe'));var deskjs=require(_0x2b6e('0xf'));var toCsv=require(_0x2b6e('0x8'));var querystring=require(_0x2b6e('0x10'));var Papa=require(_0x2b6e('0x11'));var Redis=require(_0x2b6e('0x12'));var authService=require(_0x2b6e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b6e('0x14'));var logger=require(_0x2b6e('0x15'))(_0x2b6e('0x16'));var utils=require(_0x2b6e('0x17'));var config=require(_0x2b6e('0x18'));var licenseUtil=require(_0x2b6e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13ce79,_0x15e6d9){_0x15e6d9=_0x15e6d9||0xcc;return function(_0x598a37){if(_0x598a37){return _0x13ce79[_0x2b6e('0x1a')](_0x15e6d9);}return _0x13ce79[_0x2b6e('0x1b')](_0x15e6d9)[_0x2b6e('0x1c')]();};}function respondWithResult(_0x4936c1,_0x4905be){_0x4905be=_0x4905be||0xc8;return function(_0x326a86){if(_0x326a86){return _0x4936c1[_0x2b6e('0x1b')](_0x4905be)[_0x2b6e('0x1d')](_0x326a86);}};}function respondWithFilteredResult(_0x21fe55,_0x19047d){return function(_0x59934c){if(_0x59934c){var _0x390b8e=typeof _0x19047d[_0x2b6e('0x1e')]===_0x2b6e('0x1f')&&typeof _0x19047d[_0x2b6e('0x20')]===_0x2b6e('0x1f');var _0x40c905=_0x59934c[_0x2b6e('0x21')];var _0x13cbad=_0x390b8e?0x0:_0x19047d[_0x2b6e('0x1e')];var _0x2b4e5f=_0x390b8e?_0x59934c[_0x2b6e('0x21')]:_0x19047d[_0x2b6e('0x1e')]+_0x19047d['limit'];var _0x1f3b09;if(_0x2b4e5f>=_0x40c905){_0x2b4e5f=_0x40c905;_0x1f3b09=0xc8;}else{_0x1f3b09=0xce;}_0x21fe55['status'](_0x1f3b09);return _0x21fe55['set'](_0x2b6e('0x22'),_0x13cbad+'-'+_0x2b4e5f+'/'+_0x40c905)[_0x2b6e('0x1d')](_0x59934c);}return null;};}function patchUpdates(_0x2c097c){return function(_0xf97f8a){try{jsonpatch['apply'](_0xf97f8a,_0x2c097c,!![]);}catch(_0x2a9c8b){return BPromise[_0x2b6e('0x23')](_0x2a9c8b);}return _0xf97f8a[_0x2b6e('0x24')]();};}function saveUpdates(_0x4dc211,_0x1a91b2){return function(_0x37a7a1){if(_0x37a7a1){return _0x37a7a1[_0x2b6e('0x25')](_0x4dc211)[_0x2b6e('0x26')](function(_0x47fe45){return _0x47fe45;});}return null;};}function removeEntity(_0x3de09a,_0x4871ce){return function(_0x54a88a){if(_0x54a88a){return _0x54a88a['destroy']()[_0x2b6e('0x26')](function(){_0x3de09a[_0x2b6e('0x1b')](0xcc)[_0x2b6e('0x1c')]();});}};}function handleEntityNotFound(_0x15075a,_0x552128){return function(_0x1c285a){if(!_0x1c285a){_0x15075a[_0x2b6e('0x1a')](0x194);}return _0x1c285a;};}function handleError(_0x294aba,_0x5275a5){_0x5275a5=_0x5275a5||0x1f4;return function(_0x587e6a){logger[_0x2b6e('0x27')](_0x587e6a[_0x2b6e('0x28')]);if(_0x587e6a['name']){delete _0x587e6a[_0x2b6e('0x29')];}_0x294aba[_0x2b6e('0x1b')](_0x5275a5)[_0x2b6e('0x2a')](_0x587e6a);};}exports[_0x2b6e('0x2b')]=function(_0x28b0dd,_0x246aef){var _0x3c55e2={},_0x5492ac={},_0x22c08d={'count':0x0,'rows':[]};var _0x4f532b=_['map'](db[_0x2b6e('0x2c')][_0x2b6e('0x2d')],function(_0x381086){return{'name':_0x381086['fieldName'],'type':_0x381086[_0x2b6e('0x2e')]['key']};});_0x5492ac[_0x2b6e('0x2f')]=_['map'](_0x4f532b,'name');_0x5492ac[_0x2b6e('0x30')]=_[_0x2b6e('0x31')](_0x28b0dd[_0x2b6e('0x30')]);_0x5492ac[_0x2b6e('0x32')]=_[_0x2b6e('0x33')](_0x5492ac[_0x2b6e('0x2f')],_0x5492ac['query']);_0x3c55e2[_0x2b6e('0x34')]=_['intersection'](_0x5492ac[_0x2b6e('0x2f')],qs[_0x2b6e('0x35')](_0x28b0dd[_0x2b6e('0x30')][_0x2b6e('0x35')]));_0x3c55e2[_0x2b6e('0x34')]=_0x3c55e2['attributes'][_0x2b6e('0x36')]?_0x3c55e2[_0x2b6e('0x34')]:_0x5492ac[_0x2b6e('0x2f')];if(!_0x28b0dd[_0x2b6e('0x30')][_0x2b6e('0x37')]('nolimit')){_0x3c55e2[_0x2b6e('0x20')]=qs[_0x2b6e('0x20')](_0x28b0dd[_0x2b6e('0x30')][_0x2b6e('0x20')]);_0x3c55e2[_0x2b6e('0x1e')]=qs[_0x2b6e('0x1e')](_0x28b0dd['query']['offset']);}_0x3c55e2[_0x2b6e('0x38')]=qs[_0x2b6e('0x39')](_0x28b0dd[_0x2b6e('0x30')]['sort']);_0x3c55e2[_0x2b6e('0x3a')]=qs[_0x2b6e('0x32')](_[_0x2b6e('0x3b')](_0x28b0dd['query'],_0x5492ac[_0x2b6e('0x32')]),_0x4f532b);if(_0x28b0dd[_0x2b6e('0x30')][_0x2b6e('0x3c')]){_0x3c55e2['where']=_['merge'](_0x3c55e2[_0x2b6e('0x3a')],{'$or':_[_0x2b6e('0x3d')](_0x4f532b,function(_0x324cbb){if(_0x324cbb[_0x2b6e('0x2e')]!==_0x2b6e('0x3e')){var _0x5a4c30={};_0x5a4c30[_0x324cbb[_0x2b6e('0x29')]]={'$like':'%'+_0x28b0dd[_0x2b6e('0x30')][_0x2b6e('0x3c')]+'%'};return _0x5a4c30;}})});}_0x3c55e2=_['merge']({},_0x3c55e2,_0x28b0dd[_0x2b6e('0x3f')]);var _0x47df63={'where':_0x3c55e2[_0x2b6e('0x3a')]};return db['SquareReport']['count'](_0x47df63)[_0x2b6e('0x26')](function(_0x2f7eec){_0x22c08d[_0x2b6e('0x21')]=_0x2f7eec;if(_0x28b0dd['query']['includeAll']){_0x3c55e2['include']=[{'all':!![]}];}return db[_0x2b6e('0x2c')][_0x2b6e('0x40')](_0x3c55e2);})[_0x2b6e('0x26')](function(_0x4f8684){_0x22c08d[_0x2b6e('0x41')]=_0x4f8684;return _0x22c08d;})[_0x2b6e('0x26')](respondWithFilteredResult(_0x246aef,_0x3c55e2))[_0x2b6e('0x42')](handleError(_0x246aef,null));};exports[_0x2b6e('0x43')]=function(_0x15314e,_0x2d5be8){var _0x3ff768={'raw':!![],'where':{'id':_0x15314e[_0x2b6e('0x44')]['id']}},_0x26dc41={};_0x26dc41[_0x2b6e('0x2f')]=_[_0x2b6e('0x31')](db[_0x2b6e('0x2c')][_0x2b6e('0x2d')]);_0x26dc41[_0x2b6e('0x30')]=_['keys'](_0x15314e[_0x2b6e('0x30')]);_0x26dc41['filters']=_['intersection'](_0x26dc41[_0x2b6e('0x2f')],_0x26dc41[_0x2b6e('0x30')]);_0x3ff768['attributes']=_['intersection'](_0x26dc41['model'],qs['fields'](_0x15314e[_0x2b6e('0x30')][_0x2b6e('0x35')]));_0x3ff768[_0x2b6e('0x34')]=_0x3ff768[_0x2b6e('0x34')][_0x2b6e('0x36')]?_0x3ff768[_0x2b6e('0x34')]:_0x26dc41[_0x2b6e('0x2f')];if(_0x15314e[_0x2b6e('0x30')][_0x2b6e('0x45')]){_0x3ff768[_0x2b6e('0x46')]=[{'all':!![]}];}_0x3ff768=_[_0x2b6e('0x47')]({},_0x3ff768,_0x15314e[_0x2b6e('0x3f')]);return db['SquareReport']['find'](_0x3ff768)['then'](handleEntityNotFound(_0x2d5be8,null))[_0x2b6e('0x26')](respondWithResult(_0x2d5be8,null))[_0x2b6e('0x42')](handleError(_0x2d5be8,null));};exports[_0x2b6e('0x48')]=function(_0x4850bd,_0x529872){return db[_0x2b6e('0x2c')][_0x2b6e('0x48')](_0x4850bd[_0x2b6e('0x49')],{})[_0x2b6e('0x26')](respondWithResult(_0x529872,0xc9))['catch'](handleError(_0x529872,null));};exports[_0x2b6e('0x25')]=function(_0x45c3cc,_0x370fb1){if(_0x45c3cc[_0x2b6e('0x49')]['id']){delete _0x45c3cc[_0x2b6e('0x49')]['id'];}return db[_0x2b6e('0x2c')][_0x2b6e('0x4a')]({'where':{'id':_0x45c3cc[_0x2b6e('0x44')]['id']}})[_0x2b6e('0x26')](handleEntityNotFound(_0x370fb1,null))[_0x2b6e('0x26')](saveUpdates(_0x45c3cc[_0x2b6e('0x49')],null))[_0x2b6e('0x26')](respondWithResult(_0x370fb1,null))[_0x2b6e('0x42')](handleError(_0x370fb1,null));};exports['destroy']=function(_0x588bc1,_0x12b4a0){return db[_0x2b6e('0x2c')][_0x2b6e('0x4a')]({'where':{'id':_0x588bc1['params']['id']}})[_0x2b6e('0x26')](handleEntityNotFound(_0x12b4a0,null))[_0x2b6e('0x26')](removeEntity(_0x12b4a0,null))[_0x2b6e('0x42')](handleError(_0x12b4a0,null));};exports[_0x2b6e('0x4b')]=function(_0x5c2e1b,_0x152008){return db[_0x2b6e('0x2c')][_0x2b6e('0x4b')]()[_0x2b6e('0x26')](respondWithResult(_0x152008,null))['catch'](handleError(_0x152008,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 7b9f8a6..42c76d1 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 _0x2edd=['leaveAt','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name'];(function(_0x47c838,_0x789f87){var _0x10e095=function(_0xb27087){while(--_0xb27087){_0x47c838['push'](_0x47c838['shift']());}};_0x10e095(++_0x789f87);}(_0x2edd,0x181));var _0xd2ed=function(_0x33818e,_0x4261df){_0x33818e=_0x33818e-0x0;var _0x52e8bb=_0x2edd[_0x33818e];return _0x52e8bb;};'use strict';var _=require(_0xd2ed('0x0'));var util=require(_0xd2ed('0x1'));var logger=require('../../config/logger')(_0xd2ed('0x2'));var moment=require(_0xd2ed('0x3'));var BPromise=require(_0xd2ed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2ed('0x5'));var rimraf=require(_0xd2ed('0x6'));var config=require(_0xd2ed('0x7'));var attributes=require('./squareReport.attributes');module[_0xd2ed('0x8')]=function(_0x4b2341,_0xb24a93){return _0x4b2341[_0xd2ed('0x9')](_0xd2ed('0xa'),attributes,{'tableName':_0xd2ed('0xb'),'paranoid':![],'indexes':[{'name':_0xd2ed('0xc'),'fields':[_0xd2ed('0xd'),_0xd2ed('0xe')]},{'name':_0xd2ed('0xf'),'fields':[_0xd2ed('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1552=['../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x4b7e94,_0x12dab8){var _0x377eea=function(_0x46ab37){while(--_0x46ab37){_0x4b7e94['push'](_0x4b7e94['shift']());}};_0x377eea(++_0x12dab8);}(_0x1552,0x109));var _0x2155=function(_0x395928,_0x51afb0){_0x395928=_0x395928-0x0;var _0x4efda4=_0x1552[_0x395928];return _0x4efda4;};'use strict';var _=require(_0x2155('0x0'));var util=require(_0x2155('0x1'));var logger=require(_0x2155('0x2'))(_0x2155('0x3'));var moment=require('moment');var BPromise=require(_0x2155('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2155('0x5'));var rimraf=require(_0x2155('0x6'));var config=require(_0x2155('0x7'));var attributes=require(_0x2155('0x8'));module['exports']=function(_0x416d45,_0x5a1594){return _0x416d45[_0x2155('0x9')](_0x2155('0xa'),attributes,{'tableName':_0x2155('0xb'),'paranoid':![],'indexes':[{'name':_0x2155('0xc'),'fields':[_0x2155('0xd'),_0x2155('0xe')]},{'name':_0x2155('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 0986c87..a43317e 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 _0xb287=['UpdateSquareReport','update','body','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareReport','SquareReport','create','options','raw','stringify'];(function(_0x58a310,_0x202f33){var _0xcb9d6b=function(_0x516647){while(--_0x516647){_0x58a310['push'](_0x58a310['shift']());}};_0xcb9d6b(++_0x202f33);}(_0xb287,0xa4));var _0x7b28=function(_0xebce74,_0x59c150){_0xebce74=_0xebce74-0x0;var _0xdf10d4=_0xb287[_0xebce74];return _0xdf10d4;};'use strict';var _=require('lodash');var util=require(_0x7b28('0x0'));var moment=require(_0x7b28('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b28('0x2'));var fs=require('fs');var Redis=require(_0x7b28('0x3'));var db=require(_0x7b28('0x4'))['db'];var utils=require(_0x7b28('0x5'));var logger=require(_0x7b28('0x6'))(_0x7b28('0x7'));var config=require(_0x7b28('0x8'));var jayson=require(_0x7b28('0x9'));var client=jayson['client'][_0x7b28('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5efa52,_0x53abb3,_0x105f12){return new BPromise(function(_0x592520,_0x402c5b){return client[_0x7b28('0xb')](_0x5efa52,_0x105f12)[_0x7b28('0xc')](function(_0x1659f0){logger['info'](_0x7b28('0xd'),_0x53abb3,_0x7b28('0xe'));logger[_0x7b28('0xf')](_0x7b28('0x10'),_0x53abb3,'request\x20sent',JSON['stringify'](_0x1659f0));if(_0x1659f0[_0x7b28('0x11')]){if(_0x1659f0[_0x7b28('0x11')][_0x7b28('0x12')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x53abb3,_0x1659f0['error'][_0x7b28('0x13')]);return _0x402c5b(_0x1659f0['error'][_0x7b28('0x13')]);}logger['error'](_0x7b28('0xd'),_0x53abb3,_0x1659f0[_0x7b28('0x11')]['message']);return _0x592520(_0x1659f0[_0x7b28('0x11')][_0x7b28('0x13')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x53abb3,_0x7b28('0xe'));_0x592520(_0x1659f0[_0x7b28('0x14')][_0x7b28('0x13')]);}})[_0x7b28('0x15')](function(_0x192f3a){logger[_0x7b28('0x11')](_0x7b28('0xd'),_0x53abb3,_0x192f3a);_0x402c5b(_0x192f3a);});});}exports[_0x7b28('0x16')]=function(_0x1a54ef){var _0x2350f4=this;return new Promise(function(_0x5561cc,_0x55567c){return db[_0x7b28('0x17')][_0x7b28('0x18')](_0x1a54ef['body'],{'raw':_0x1a54ef[_0x7b28('0x19')]?_0x1a54ef['options'][_0x7b28('0x1a')]===undefined?!![]:![]:!![]})[_0x7b28('0xc')](function(_0x1d1cfa){logger['info'](_0x7b28('0x16'),_0x1a54ef);logger['debug'](_0x7b28('0x16'),_0x1a54ef,JSON[_0x7b28('0x1b')](_0x1d1cfa));_0x5561cc(_0x1d1cfa);})[_0x7b28('0x15')](function(_0x219311){logger[_0x7b28('0x11')](_0x7b28('0x16'),_0x219311['message'],_0x1a54ef);_0x55567c(_0x2350f4['error'](0x1f4,_0x219311[_0x7b28('0x13')]));});});};exports[_0x7b28('0x1c')]=function(_0x4fc730){var _0x483148=this;return new Promise(function(_0x20b5c2,_0x31095b){return db['SquareReport'][_0x7b28('0x1d')](_0x4fc730[_0x7b28('0x1e')],{'raw':_0x4fc730['options']?_0x4fc730[_0x7b28('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fc730[_0x7b28('0x19')]?_0x4fc730[_0x7b28('0x19')][_0x7b28('0x1f')]||null:null,'attributes':_0x4fc730[_0x7b28('0x19')]?_0x4fc730[_0x7b28('0x19')]['attributes']||null:null,'limit':_0x4fc730[_0x7b28('0x19')]?_0x4fc730[_0x7b28('0x19')]['limit']||null:null})[_0x7b28('0xc')](function(_0x57d1df){logger['info'](_0x7b28('0x1c'),_0x4fc730);logger[_0x7b28('0xf')](_0x7b28('0x1c'),_0x4fc730,JSON['stringify'](_0x57d1df));_0x20b5c2(_0x57d1df);})[_0x7b28('0x15')](function(_0x1bd8dc){logger[_0x7b28('0x11')](_0x7b28('0x1c'),_0x1bd8dc[_0x7b28('0x13')],_0x4fc730);_0x31095b(_0x483148[_0x7b28('0x11')](0x1f4,_0x1bd8dc[_0x7b28('0x13')]));});});}; \ No newline at end of file +var _0x0698=['code','message','CreateSquareReport','SquareReport','create','options','debug','update','body','raw','where','attributes','limit','UpdateSquareReport','catch','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5cd7fd,_0x4de617){var _0x5213ae=function(_0x49b2aa){while(--_0x49b2aa){_0x5cd7fd['push'](_0x5cd7fd['shift']());}};_0x5213ae(++_0x4de617);}(_0x0698,0x1a5));var _0x8069=function(_0x4a4f3c,_0x275973){_0x4a4f3c=_0x4a4f3c-0x0;var _0x45eaeb=_0x0698[_0x4a4f3c];return _0x45eaeb;};'use strict';var _=require('lodash');var util=require(_0x8069('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8069('0x1'));var db=require(_0x8069('0x2'))['db'];var utils=require(_0x8069('0x3'));var logger=require(_0x8069('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8069('0x5'));var client=jayson['client'][_0x8069('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5af070,_0x32175d,_0x2c4ca9){return new BPromise(function(_0x53d665,_0x361aa8){return client['request'](_0x5af070,_0x2c4ca9)[_0x8069('0x7')](function(_0x20d39f){logger[_0x8069('0x8')](_0x8069('0x9'),_0x32175d,_0x8069('0xa'));logger['debug'](_0x8069('0xb'),_0x32175d,_0x8069('0xa'),JSON[_0x8069('0xc')](_0x20d39f));if(_0x20d39f[_0x8069('0xd')]){if(_0x20d39f[_0x8069('0xd')][_0x8069('0xe')]===0x1f4){logger[_0x8069('0xd')](_0x8069('0x9'),_0x32175d,_0x20d39f['error']['message']);return _0x361aa8(_0x20d39f[_0x8069('0xd')]['message']);}logger[_0x8069('0xd')](_0x8069('0x9'),_0x32175d,_0x20d39f[_0x8069('0xd')][_0x8069('0xf')]);return _0x53d665(_0x20d39f[_0x8069('0xd')][_0x8069('0xf')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x32175d,_0x8069('0xa'));_0x53d665(_0x20d39f['result'][_0x8069('0xf')]);}})['catch'](function(_0x165bc3){logger[_0x8069('0xd')](_0x8069('0x9'),_0x32175d,_0x165bc3);_0x361aa8(_0x165bc3);});});}exports[_0x8069('0x10')]=function(_0x14d093){var _0x16d3fa=this;return new Promise(function(_0x3dd2a1,_0x5f3cb2){return db[_0x8069('0x11')][_0x8069('0x12')](_0x14d093['body'],{'raw':_0x14d093[_0x8069('0x13')]?_0x14d093[_0x8069('0x13')]['raw']===undefined?!![]:![]:!![]})[_0x8069('0x7')](function(_0x449d71){logger[_0x8069('0x8')](_0x8069('0x10'),_0x14d093);logger[_0x8069('0x14')](_0x8069('0x10'),_0x14d093,JSON[_0x8069('0xc')](_0x449d71));_0x3dd2a1(_0x449d71);})['catch'](function(_0x3f5b82){logger[_0x8069('0xd')](_0x8069('0x10'),_0x3f5b82[_0x8069('0xf')],_0x14d093);_0x5f3cb2(_0x16d3fa[_0x8069('0xd')](0x1f4,_0x3f5b82['message']));});});};exports['UpdateSquareReport']=function(_0x5a9c71){var _0x4ae312=this;return new Promise(function(_0x335744,_0x27af40){return db[_0x8069('0x11')][_0x8069('0x15')](_0x5a9c71[_0x8069('0x16')],{'raw':_0x5a9c71[_0x8069('0x13')]?_0x5a9c71[_0x8069('0x13')][_0x8069('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a9c71[_0x8069('0x13')]?_0x5a9c71[_0x8069('0x13')][_0x8069('0x18')]||null:null,'attributes':_0x5a9c71[_0x8069('0x13')]?_0x5a9c71['options'][_0x8069('0x19')]||null:null,'limit':_0x5a9c71['options']?_0x5a9c71[_0x8069('0x13')][_0x8069('0x1a')]||null:null})[_0x8069('0x7')](function(_0x2c244e){logger['info']('UpdateSquareReport',_0x5a9c71);logger[_0x8069('0x14')](_0x8069('0x1b'),_0x5a9c71,JSON[_0x8069('0xc')](_0x2c244e));_0x335744(_0x2c244e);})[_0x8069('0x1c')](function(_0x20174a){logger[_0x8069('0xd')]('UpdateSquareReport',_0x20174a[_0x8069('0xf')],_0x5a9c71);_0x27af40(_0x4ae312['error'](0x1f4,_0x20174a[_0x8069('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index d091f96..8799eef 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 _0xe099=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x37b07c,_0x5941a1){var _0x264672=function(_0x4860e6){while(--_0x4860e6){_0x37b07c['push'](_0x37b07c['shift']());}};_0x264672(++_0x5941a1);}(_0xe099,0x1d3));var _0x9e09=function(_0x26543d,_0x1e7d0d){_0x26543d=_0x26543d-0x0;var _0xf10150=_0xe099[_0x26543d];return _0xf10150;};'use strict';var multer=require(_0x9e09('0x0'));var util=require(_0x9e09('0x1'));var path=require(_0x9e09('0x2'));var timeout=require(_0x9e09('0x3'));var express=require('express');var router=express[_0x9e09('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9e09('0x5'));var interaction=require(_0x9e09('0x6'));var config=require(_0x9e09('0x7'));var controller=require(_0x9e09('0x8'));router[_0x9e09('0x9')]('/',auth[_0x9e09('0xa')](),controller[_0x9e09('0xb')]);router[_0x9e09('0x9')](_0x9e09('0xc'),auth[_0x9e09('0xa')](),controller[_0x9e09('0xd')]);router[_0x9e09('0x9')](_0x9e09('0xe'),auth['isAuthenticated'](),controller[_0x9e09('0xf')]);router[_0x9e09('0x10')]('/',auth[_0x9e09('0xa')](),controller[_0x9e09('0x11')]);router[_0x9e09('0x12')](_0x9e09('0xe'),auth['isAuthenticated'](),controller[_0x9e09('0x13')]);router[_0x9e09('0x14')](_0x9e09('0xe'),auth[_0x9e09('0xa')](),controller[_0x9e09('0x15')]);module[_0x9e09('0x16')]=router; \ No newline at end of file +var _0xd4d3=['show','post','create','put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x581960,_0x1232ff){var _0x4ee892=function(_0x2a920d){while(--_0x2a920d){_0x581960['push'](_0x581960['shift']());}};_0x4ee892(++_0x1232ff);}(_0xd4d3,0x146));var _0x3d4d=function(_0x4dfe5f,_0x3c9a05){_0x4dfe5f=_0x4dfe5f-0x0;var _0x32c92f=_0xd4d3[_0x4dfe5f];return _0x32c92f;};'use strict';var multer=require(_0x3d4d('0x0'));var util=require('util');var path=require(_0x3d4d('0x1'));var timeout=require(_0x3d4d('0x2'));var express=require(_0x3d4d('0x3'));var router=express[_0x3d4d('0x4')]();var fs_extra=require(_0x3d4d('0x5'));var auth=require(_0x3d4d('0x6'));var interaction=require(_0x3d4d('0x7'));var config=require(_0x3d4d('0x8'));var controller=require('./squareReportDetail.controller');router[_0x3d4d('0x9')]('/',auth[_0x3d4d('0xa')](),controller[_0x3d4d('0xb')]);router[_0x3d4d('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3d4d('0xc')]);router['get'](_0x3d4d('0xd'),auth['isAuthenticated'](),controller[_0x3d4d('0xe')]);router[_0x3d4d('0xf')]('/',auth[_0x3d4d('0xa')](),controller[_0x3d4d('0x10')]);router[_0x3d4d('0x11')]('/:id',auth[_0x3d4d('0xa')](),controller[_0x3d4d('0x12')]);router['delete'](_0x3d4d('0xd'),auth['isAuthenticated'](),controller[_0x3d4d('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index e02bea3..fc05018 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 _0xb8b2=['STRING','TEXT','sequelize','exports'];(function(_0x5062db,_0x1894fb){var _0x389f5=function(_0x20aed6){while(--_0x20aed6){_0x5062db['push'](_0x5062db['shift']());}};_0x389f5(++_0x1894fb);}(_0xb8b2,0x11a));var _0x2b8b=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xb8b2[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require(_0x2b8b('0x0'));module[_0x2b8b('0x1')]={'uniqueid':{'type':Sequelize[_0x2b8b('0x2')]},'node':{'type':Sequelize[_0x2b8b('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x2b8b('0x3')]},'project_name':{'type':Sequelize[_0x2b8b('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xffe8=['sequelize','STRING'];(function(_0x1ee115,_0x1422aa){var _0x15a15c=function(_0x592d49){while(--_0x592d49){_0x1ee115['push'](_0x1ee115['shift']());}};_0x15a15c(++_0x1422aa);}(_0xffe8,0xe2));var _0x8ffe=function(_0x1db1f1,_0x4372c6){_0x1db1f1=_0x1db1f1-0x0;var _0x217230=_0xffe8[_0x1db1f1];return _0x217230;};'use strict';var Sequelize=require(_0x8ffe('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x8ffe('0x1')]},'application':{'type':Sequelize[_0x8ffe('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 6957d54..92b1c1e 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 _0x1569=['offset','limit','undefined','count','set','Content-Range','apply','save','destroy','then','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','desk.js','querystring','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x5ab826,_0x842f7d){var _0x507c9c=function(_0x4eb03f){while(--_0x4eb03f){_0x5ab826['push'](_0x5ab826['shift']());}};_0x507c9c(++_0x842f7d);}(_0x1569,0x1bf));var _0x9156=function(_0x126e4f,_0x4242de){_0x126e4f=_0x126e4f-0x0;var _0x4960c3=_0x1569[_0x126e4f];return _0x4960c3;};'use strict';var emlformat=require(_0x9156('0x0'));var rimraf=require(_0x9156('0x1'));var zipdir=require(_0x9156('0x2'));var jsonpatch=require(_0x9156('0x3'));var rp=require('request-promise');var moment=require(_0x9156('0x4'));var BPromise=require(_0x9156('0x5'));var Mustache=require(_0x9156('0x6'));var util=require('util');var path=require(_0x9156('0x7'));var sox=require(_0x9156('0x8'));var csv=require(_0x9156('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9156('0xa'));var squel=require('squel');var crypto=require(_0x9156('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9156('0xc'));var toCsv=require(_0x9156('0x9'));var querystring=require(_0x9156('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9156('0xe'));var config=require(_0x9156('0xf'));var licenseUtil=require(_0x9156('0x10'));var db=require(_0x9156('0x11'))['db'];function respondWithStatusCode(_0x15cfcf,_0x4a3cd6){_0x4a3cd6=_0x4a3cd6||0xcc;return function(_0x2fb563){if(_0x2fb563){return _0x15cfcf[_0x9156('0x12')](_0x4a3cd6);}return _0x15cfcf[_0x9156('0x13')](_0x4a3cd6)[_0x9156('0x14')]();};}function respondWithResult(_0x49db28,_0x1dcb19){_0x1dcb19=_0x1dcb19||0xc8;return function(_0x31478a){if(_0x31478a){return _0x49db28['status'](_0x1dcb19)[_0x9156('0x15')](_0x31478a);}};}function respondWithFilteredResult(_0x6e817c,_0x5dba64){return function(_0x35f293){if(_0x35f293){var _0x4d4490=typeof _0x5dba64[_0x9156('0x16')]==='undefined'&&typeof _0x5dba64[_0x9156('0x17')]===_0x9156('0x18');var _0x1123a8=_0x35f293[_0x9156('0x19')];var _0x3c190b=_0x4d4490?0x0:_0x5dba64[_0x9156('0x16')];var _0x5a80f6=_0x4d4490?_0x35f293[_0x9156('0x19')]:_0x5dba64[_0x9156('0x16')]+_0x5dba64[_0x9156('0x17')];var _0x77e28b;if(_0x5a80f6>=_0x1123a8){_0x5a80f6=_0x1123a8;_0x77e28b=0xc8;}else{_0x77e28b=0xce;}_0x6e817c[_0x9156('0x13')](_0x77e28b);return _0x6e817c[_0x9156('0x1a')](_0x9156('0x1b'),_0x3c190b+'-'+_0x5a80f6+'/'+_0x1123a8)['json'](_0x35f293);}return null;};}function patchUpdates(_0x519b15){return function(_0x25f23c){try{jsonpatch[_0x9156('0x1c')](_0x25f23c,_0x519b15,!![]);}catch(_0x496c8c){return BPromise['reject'](_0x496c8c);}return _0x25f23c[_0x9156('0x1d')]();};}function saveUpdates(_0x292c83,_0x313fa4){return function(_0x2b8d20){if(_0x2b8d20){return _0x2b8d20['update'](_0x292c83)['then'](function(_0x144b8c){return _0x144b8c;});}return null;};}function removeEntity(_0x2ae46c,_0x3ce9c3){return function(_0x33440a){if(_0x33440a){return _0x33440a[_0x9156('0x1e')]()[_0x9156('0x1f')](function(){_0x2ae46c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53aa15,_0x405319){return function(_0x2faa60){if(!_0x2faa60){_0x53aa15['sendStatus'](0x194);}return _0x2faa60;};}function handleError(_0xa9adbb,_0x1e8977){_0x1e8977=_0x1e8977||0x1f4;return function(_0x27db97){logger[_0x9156('0x20')](_0x27db97['stack']);if(_0x27db97[_0x9156('0x21')]){delete _0x27db97[_0x9156('0x21')];}_0xa9adbb[_0x9156('0x13')](_0x1e8977)[_0x9156('0x22')](_0x27db97);};}exports[_0x9156('0x23')]=function(_0x34e02f,_0x3439a2){var _0x560006={},_0x308f1b={},_0x1cf687={'count':0x0,'rows':[]};var _0x4356f0=_[_0x9156('0x24')](db[_0x9156('0x25')][_0x9156('0x26')],function(_0x1aa9e3){return{'name':_0x1aa9e3[_0x9156('0x27')],'type':_0x1aa9e3[_0x9156('0x28')]['key']};});_0x308f1b['model']=_[_0x9156('0x24')](_0x4356f0,'name');_0x308f1b[_0x9156('0x29')]=_[_0x9156('0x2a')](_0x34e02f[_0x9156('0x29')]);_0x308f1b[_0x9156('0x2b')]=_[_0x9156('0x2c')](_0x308f1b[_0x9156('0x2d')],_0x308f1b[_0x9156('0x29')]);_0x560006[_0x9156('0x2e')]=_['intersection'](_0x308f1b[_0x9156('0x2d')],qs['fields'](_0x34e02f['query']['fields']));_0x560006[_0x9156('0x2e')]=_0x560006[_0x9156('0x2e')]['length']?_0x560006[_0x9156('0x2e')]:_0x308f1b[_0x9156('0x2d')];if(!_0x34e02f[_0x9156('0x29')][_0x9156('0x2f')](_0x9156('0x30'))){_0x560006[_0x9156('0x17')]=qs['limit'](_0x34e02f[_0x9156('0x29')][_0x9156('0x17')]);_0x560006[_0x9156('0x16')]=qs[_0x9156('0x16')](_0x34e02f[_0x9156('0x29')][_0x9156('0x16')]);}_0x560006[_0x9156('0x31')]=qs['sort'](_0x34e02f[_0x9156('0x29')][_0x9156('0x32')]);_0x560006[_0x9156('0x33')]=qs[_0x9156('0x2b')](_['pick'](_0x34e02f[_0x9156('0x29')],_0x308f1b[_0x9156('0x2b')]),_0x4356f0);if(_0x34e02f[_0x9156('0x29')][_0x9156('0x34')]){_0x560006['where']=_[_0x9156('0x35')](_0x560006['where'],{'$or':_[_0x9156('0x24')](_0x4356f0,function(_0x27d84f){if(_0x27d84f[_0x9156('0x28')]!==_0x9156('0x36')){var _0x308fdf={};_0x308fdf[_0x27d84f[_0x9156('0x21')]]={'$like':'%'+_0x34e02f[_0x9156('0x29')][_0x9156('0x34')]+'%'};return _0x308fdf;}})});}_0x560006=_['merge']({},_0x560006,_0x34e02f[_0x9156('0x37')]);var _0x59fcd3={'where':_0x560006[_0x9156('0x33')]};return db[_0x9156('0x25')][_0x9156('0x19')](_0x59fcd3)[_0x9156('0x1f')](function(_0x2cab64){_0x1cf687[_0x9156('0x19')]=_0x2cab64;if(_0x34e02f['query'][_0x9156('0x38')]){_0x560006['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0x9156('0x39')](_0x560006);})[_0x9156('0x1f')](function(_0x421b0a){_0x1cf687[_0x9156('0x3a')]=_0x421b0a;return _0x1cf687;})[_0x9156('0x1f')](respondWithFilteredResult(_0x3439a2,_0x560006))[_0x9156('0x3b')](handleError(_0x3439a2,null));};exports[_0x9156('0x3c')]=function(_0x34a9d5,_0x103f17){var _0x6f2868={'raw':!![],'where':{'id':_0x34a9d5[_0x9156('0x3d')]['id']}},_0x5cbb3c={};_0x5cbb3c[_0x9156('0x2d')]=_[_0x9156('0x2a')](db[_0x9156('0x25')]['rawAttributes']);_0x5cbb3c[_0x9156('0x29')]=_[_0x9156('0x2a')](_0x34a9d5[_0x9156('0x29')]);_0x5cbb3c[_0x9156('0x2b')]=_[_0x9156('0x2c')](_0x5cbb3c[_0x9156('0x2d')],_0x5cbb3c[_0x9156('0x29')]);_0x6f2868['attributes']=_[_0x9156('0x2c')](_0x5cbb3c[_0x9156('0x2d')],qs[_0x9156('0x3e')](_0x34a9d5[_0x9156('0x29')][_0x9156('0x3e')]));_0x6f2868[_0x9156('0x2e')]=_0x6f2868['attributes'][_0x9156('0x3f')]?_0x6f2868[_0x9156('0x2e')]:_0x5cbb3c['model'];if(_0x34a9d5[_0x9156('0x29')][_0x9156('0x38')]){_0x6f2868['include']=[{'all':!![]}];}_0x6f2868=_[_0x9156('0x35')]({},_0x6f2868,_0x34a9d5[_0x9156('0x37')]);return db[_0x9156('0x25')][_0x9156('0x40')](_0x6f2868)[_0x9156('0x1f')](handleEntityNotFound(_0x103f17,null))[_0x9156('0x1f')](respondWithResult(_0x103f17,null))[_0x9156('0x3b')](handleError(_0x103f17,null));};exports['create']=function(_0x20da8f,_0x33d4a8){return db[_0x9156('0x25')][_0x9156('0x41')](_0x20da8f[_0x9156('0x42')],{})[_0x9156('0x1f')](respondWithResult(_0x33d4a8,0xc9))[_0x9156('0x3b')](handleError(_0x33d4a8,null));};exports['update']=function(_0x1967f3,_0x4f76b7){if(_0x1967f3[_0x9156('0x42')]['id']){delete _0x1967f3['body']['id'];}return db[_0x9156('0x25')][_0x9156('0x40')]({'where':{'id':_0x1967f3[_0x9156('0x3d')]['id']}})[_0x9156('0x1f')](handleEntityNotFound(_0x4f76b7,null))['then'](saveUpdates(_0x1967f3[_0x9156('0x42')],null))[_0x9156('0x1f')](respondWithResult(_0x4f76b7,null))[_0x9156('0x3b')](handleError(_0x4f76b7,null));};exports[_0x9156('0x1e')]=function(_0xecea25,_0x11d3f5){return db[_0x9156('0x25')][_0x9156('0x40')]({'where':{'id':_0xecea25[_0x9156('0x3d')]['id']}})[_0x9156('0x1f')](handleEntityNotFound(_0x11d3f5,null))[_0x9156('0x1f')](removeEntity(_0x11d3f5,null))[_0x9156('0x3b')](handleError(_0x11d3f5,null));};exports['describe']=function(_0x39edc7,_0x4fe765){return db[_0x9156('0x25')]['describe']()[_0x9156('0x1f')](respondWithResult(_0x4fe765,null))[_0x9156('0x3b')](handleError(_0x4fe765,null));}; \ No newline at end of file +var _0xf5f5=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','SquareDetailsReport','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type'];(function(_0x25f0a1,_0x48aee4){var _0x239ad1=function(_0x2050f6){while(--_0x2050f6){_0x25f0a1['push'](_0x25f0a1['shift']());}};_0x239ad1(++_0x48aee4);}(_0xf5f5,0x101));var _0x5f5f=function(_0x3a2925,_0x4b8c2d){_0x3a2925=_0x3a2925-0x0;var _0x5dd8d4=_0xf5f5[_0x3a2925];return _0x5dd8d4;};'use strict';var emlformat=require(_0x5f5f('0x0'));var rimraf=require(_0x5f5f('0x1'));var zipdir=require(_0x5f5f('0x2'));var jsonpatch=require(_0x5f5f('0x3'));var rp=require(_0x5f5f('0x4'));var moment=require(_0x5f5f('0x5'));var BPromise=require(_0x5f5f('0x6'));var Mustache=require(_0x5f5f('0x7'));var util=require(_0x5f5f('0x8'));var path=require(_0x5f5f('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f5f('0xa'));var _=require('lodash');var squel=require(_0x5f5f('0xb'));var crypto=require(_0x5f5f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5f5f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5f5f('0xe'));var Papa=require(_0x5f5f('0xf'));var Redis=require(_0x5f5f('0x10'));var authService=require(_0x5f5f('0x11'));var qs=require(_0x5f5f('0x12'));var as=require(_0x5f5f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f5f('0x14'));var utils=require(_0x5f5f('0x15'));var config=require(_0x5f5f('0x16'));var licenseUtil=require(_0x5f5f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bd592,_0x143a04){_0x143a04=_0x143a04||0xcc;return function(_0x5d0116){if(_0x5d0116){return _0x3bd592[_0x5f5f('0x18')](_0x143a04);}return _0x3bd592[_0x5f5f('0x19')](_0x143a04)[_0x5f5f('0x1a')]();};}function respondWithResult(_0x234ffd,_0x4eba6a){_0x4eba6a=_0x4eba6a||0xc8;return function(_0x2e98a9){if(_0x2e98a9){return _0x234ffd[_0x5f5f('0x19')](_0x4eba6a)[_0x5f5f('0x1b')](_0x2e98a9);}};}function respondWithFilteredResult(_0x242f56,_0x34cfdb){return function(_0x1ce900){if(_0x1ce900){var _0x1a8cab=typeof _0x34cfdb[_0x5f5f('0x1c')]===_0x5f5f('0x1d')&&typeof _0x34cfdb[_0x5f5f('0x1e')]===_0x5f5f('0x1d');var _0x4da767=_0x1ce900[_0x5f5f('0x1f')];var _0x1f562a=_0x1a8cab?0x0:_0x34cfdb[_0x5f5f('0x1c')];var _0x2a44c9=_0x1a8cab?_0x1ce900[_0x5f5f('0x1f')]:_0x34cfdb[_0x5f5f('0x1c')]+_0x34cfdb[_0x5f5f('0x1e')];var _0x19e6f9;if(_0x2a44c9>=_0x4da767){_0x2a44c9=_0x4da767;_0x19e6f9=0xc8;}else{_0x19e6f9=0xce;}_0x242f56[_0x5f5f('0x19')](_0x19e6f9);return _0x242f56[_0x5f5f('0x20')]('Content-Range',_0x1f562a+'-'+_0x2a44c9+'/'+_0x4da767)[_0x5f5f('0x1b')](_0x1ce900);}return null;};}function patchUpdates(_0x5e905b){return function(_0x39843d){try{jsonpatch[_0x5f5f('0x21')](_0x39843d,_0x5e905b,!![]);}catch(_0x4b1fc3){return BPromise[_0x5f5f('0x22')](_0x4b1fc3);}return _0x39843d[_0x5f5f('0x23')]();};}function saveUpdates(_0x4873ea,_0x2c7855){return function(_0x3b662f){if(_0x3b662f){return _0x3b662f[_0x5f5f('0x24')](_0x4873ea)[_0x5f5f('0x25')](function(_0x4baf7d){return _0x4baf7d;});}return null;};}function removeEntity(_0x190ed1,_0x2d1cb4){return function(_0xcae554){if(_0xcae554){return _0xcae554[_0x5f5f('0x26')]()['then'](function(){_0x190ed1[_0x5f5f('0x19')](0xcc)[_0x5f5f('0x1a')]();});}};}function handleEntityNotFound(_0x2bb17b,_0x2be2c4){return function(_0x52e9b0){if(!_0x52e9b0){_0x2bb17b[_0x5f5f('0x18')](0x194);}return _0x52e9b0;};}function handleError(_0xc3cd24,_0x1ecc76){_0x1ecc76=_0x1ecc76||0x1f4;return function(_0x5ac83c){logger[_0x5f5f('0x27')](_0x5ac83c[_0x5f5f('0x28')]);if(_0x5ac83c[_0x5f5f('0x29')]){delete _0x5ac83c['name'];}_0xc3cd24[_0x5f5f('0x19')](_0x1ecc76)[_0x5f5f('0x2a')](_0x5ac83c);};}exports['index']=function(_0x2dc5b9,_0x26828e){var _0x4b7bc3={},_0x4155b3={},_0x168fe8={'count':0x0,'rows':[]};var _0x15ba47=_[_0x5f5f('0x2b')](db['SquareDetailsReport'][_0x5f5f('0x2c')],function(_0xb4fe5e){return{'name':_0xb4fe5e[_0x5f5f('0x2d')],'type':_0xb4fe5e[_0x5f5f('0x2e')][_0x5f5f('0x2f')]};});_0x4155b3[_0x5f5f('0x30')]=_['map'](_0x15ba47,'name');_0x4155b3[_0x5f5f('0x31')]=_[_0x5f5f('0x32')](_0x2dc5b9['query']);_0x4155b3[_0x5f5f('0x33')]=_[_0x5f5f('0x34')](_0x4155b3[_0x5f5f('0x30')],_0x4155b3['query']);_0x4b7bc3[_0x5f5f('0x35')]=_[_0x5f5f('0x34')](_0x4155b3[_0x5f5f('0x30')],qs[_0x5f5f('0x36')](_0x2dc5b9['query'][_0x5f5f('0x36')]));_0x4b7bc3['attributes']=_0x4b7bc3[_0x5f5f('0x35')][_0x5f5f('0x37')]?_0x4b7bc3[_0x5f5f('0x35')]:_0x4155b3[_0x5f5f('0x30')];if(!_0x2dc5b9[_0x5f5f('0x31')][_0x5f5f('0x38')](_0x5f5f('0x39'))){_0x4b7bc3[_0x5f5f('0x1e')]=qs[_0x5f5f('0x1e')](_0x2dc5b9['query']['limit']);_0x4b7bc3[_0x5f5f('0x1c')]=qs[_0x5f5f('0x1c')](_0x2dc5b9['query'][_0x5f5f('0x1c')]);}_0x4b7bc3[_0x5f5f('0x3a')]=qs[_0x5f5f('0x3b')](_0x2dc5b9[_0x5f5f('0x31')]['sort']);_0x4b7bc3['where']=qs[_0x5f5f('0x33')](_[_0x5f5f('0x3c')](_0x2dc5b9[_0x5f5f('0x31')],_0x4155b3['filters']),_0x15ba47);if(_0x2dc5b9[_0x5f5f('0x31')][_0x5f5f('0x3d')]){_0x4b7bc3['where']=_[_0x5f5f('0x3e')](_0x4b7bc3[_0x5f5f('0x3f')],{'$or':_['map'](_0x15ba47,function(_0x160f77){if(_0x160f77['type']!=='VIRTUAL'){var _0x37b5be={};_0x37b5be[_0x160f77['name']]={'$like':'%'+_0x2dc5b9['query']['filter']+'%'};return _0x37b5be;}})});}_0x4b7bc3=_[_0x5f5f('0x3e')]({},_0x4b7bc3,_0x2dc5b9[_0x5f5f('0x40')]);var _0x5e3139={'where':_0x4b7bc3['where']};return db[_0x5f5f('0x41')][_0x5f5f('0x1f')](_0x5e3139)[_0x5f5f('0x25')](function(_0x4e1000){_0x168fe8[_0x5f5f('0x1f')]=_0x4e1000;if(_0x2dc5b9[_0x5f5f('0x31')][_0x5f5f('0x42')]){_0x4b7bc3['include']=[{'all':!![]}];}return db[_0x5f5f('0x41')][_0x5f5f('0x43')](_0x4b7bc3);})['then'](function(_0x422b12){_0x168fe8['rows']=_0x422b12;return _0x168fe8;})[_0x5f5f('0x25')](respondWithFilteredResult(_0x26828e,_0x4b7bc3))[_0x5f5f('0x44')](handleError(_0x26828e,null));};exports[_0x5f5f('0x45')]=function(_0x55bb1b,_0x8e53ab){var _0x2a4aef={'raw':!![],'where':{'id':_0x55bb1b[_0x5f5f('0x46')]['id']}},_0x3e2d98={};_0x3e2d98[_0x5f5f('0x30')]=_[_0x5f5f('0x32')](db[_0x5f5f('0x41')][_0x5f5f('0x2c')]);_0x3e2d98['query']=_[_0x5f5f('0x32')](_0x55bb1b[_0x5f5f('0x31')]);_0x3e2d98[_0x5f5f('0x33')]=_[_0x5f5f('0x34')](_0x3e2d98[_0x5f5f('0x30')],_0x3e2d98[_0x5f5f('0x31')]);_0x2a4aef[_0x5f5f('0x35')]=_['intersection'](_0x3e2d98[_0x5f5f('0x30')],qs[_0x5f5f('0x36')](_0x55bb1b[_0x5f5f('0x31')]['fields']));_0x2a4aef[_0x5f5f('0x35')]=_0x2a4aef[_0x5f5f('0x35')][_0x5f5f('0x37')]?_0x2a4aef[_0x5f5f('0x35')]:_0x3e2d98[_0x5f5f('0x30')];if(_0x55bb1b[_0x5f5f('0x31')][_0x5f5f('0x42')]){_0x2a4aef[_0x5f5f('0x47')]=[{'all':!![]}];}_0x2a4aef=_[_0x5f5f('0x3e')]({},_0x2a4aef,_0x55bb1b[_0x5f5f('0x40')]);return db['SquareDetailsReport'][_0x5f5f('0x48')](_0x2a4aef)[_0x5f5f('0x25')](handleEntityNotFound(_0x8e53ab,null))[_0x5f5f('0x25')](respondWithResult(_0x8e53ab,null))[_0x5f5f('0x44')](handleError(_0x8e53ab,null));};exports['create']=function(_0x24d74b,_0xe203c3){return db[_0x5f5f('0x41')][_0x5f5f('0x49')](_0x24d74b[_0x5f5f('0x4a')],{})['then'](respondWithResult(_0xe203c3,0xc9))[_0x5f5f('0x44')](handleError(_0xe203c3,null));};exports[_0x5f5f('0x24')]=function(_0x5df47c,_0x56d73c){if(_0x5df47c[_0x5f5f('0x4a')]['id']){delete _0x5df47c[_0x5f5f('0x4a')]['id'];}return db[_0x5f5f('0x41')]['find']({'where':{'id':_0x5df47c['params']['id']}})[_0x5f5f('0x25')](handleEntityNotFound(_0x56d73c,null))[_0x5f5f('0x25')](saveUpdates(_0x5df47c[_0x5f5f('0x4a')],null))[_0x5f5f('0x25')](respondWithResult(_0x56d73c,null))['catch'](handleError(_0x56d73c,null));};exports[_0x5f5f('0x26')]=function(_0x5a1a0c,_0xd73d40){return db['SquareDetailsReport'][_0x5f5f('0x48')]({'where':{'id':_0x5a1a0c['params']['id']}})[_0x5f5f('0x25')](handleEntityNotFound(_0xd73d40,null))[_0x5f5f('0x25')](removeEntity(_0xd73d40,null))[_0x5f5f('0x44')](handleError(_0xd73d40,null));};exports[_0x5f5f('0x4b')]=function(_0x27c124,_0x95b0d1){return db[_0x5f5f('0x41')][_0x5f5f('0x4b')]()[_0x5f5f('0x25')](respondWithResult(_0x95b0d1,null))[_0x5f5f('0x44')](handleError(_0x95b0d1,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index c637ec9..909c2dc 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 _0x768d=['request-promise','path','rimraf','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','moment','bluebird'];(function(_0x593752,_0xfc3827){var _0x4612be=function(_0x2d64c6){while(--_0x2d64c6){_0x593752['push'](_0x593752['shift']());}};_0x4612be(++_0xfc3827);}(_0x768d,0x1c3));var _0xd768=function(_0x18f88c,_0x153ee6){_0x18f88c=_0x18f88c-0x0;var _0x159767=_0x768d[_0x18f88c];return _0x159767;};'use strict';var _=require(_0xd768('0x0'));var util=require(_0xd768('0x1'));var logger=require(_0xd768('0x2'))('api');var moment=require(_0xd768('0x3'));var BPromise=require(_0xd768('0x4'));var rp=require(_0xd768('0x5'));var fs=require('fs');var path=require(_0xd768('0x6'));var rimraf=require(_0xd768('0x7'));var config=require('../../config/environment');var attributes=require(_0xd768('0x8'));module[_0xd768('0x9')]=function(_0x1b5cc5,_0x399d06){return _0x1b5cc5['define'](_0xd768('0xa'),attributes,{'tableName':_0xd768('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe737=['define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe737,0xcf));var _0x7e73=function(_0x579323,_0x429de0){_0x579323=_0x579323-0x0;var _0x432abf=_0xe737[_0x579323];return _0x432abf;};'use strict';var _=require(_0x7e73('0x0'));var util=require(_0x7e73('0x1'));var logger=require(_0x7e73('0x2'))('api');var moment=require(_0x7e73('0x3'));var BPromise=require(_0x7e73('0x4'));var rp=require(_0x7e73('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e73('0x6'));var config=require(_0x7e73('0x7'));var attributes=require(_0x7e73('0x8'));module['exports']=function(_0x2bf9d6,_0x12cfa9){return _0x2bf9d6[_0x7e73('0x9')](_0x7e73('0xa'),attributes,{'tableName':_0x7e73('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 5209dc1..06225aa 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 _0x9f4d=['options','CreateSquareDetailsReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareDetailsReport','create','body'];(function(_0x2af4cf,_0x30e1a7){var _0x169855=function(_0x51f569){while(--_0x51f569){_0x2af4cf['push'](_0x2af4cf['shift']());}};_0x169855(++_0x30e1a7);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x2ac5f8,_0x4c3a9f){_0x2ac5f8=_0x2ac5f8-0x0;var _0x3b8229=_0x9f4d[_0x2ac5f8];return _0x3b8229;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var moment=require(_0xd9f4('0x2'));var BPromise=require(_0xd9f4('0x3'));var rs=require(_0xd9f4('0x4'));var fs=require('fs');var Redis=require(_0xd9f4('0x5'));var db=require(_0xd9f4('0x6'))['db'];var utils=require(_0xd9f4('0x7'));var logger=require(_0xd9f4('0x8'))('rpc');var config=require(_0xd9f4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd9f4('0xa')][_0xd9f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cc036,_0x366b9d,_0x5cf448){return new BPromise(function(_0x6b13b5,_0x18305f){return client['request'](_0x2cc036,_0x5cf448)[_0xd9f4('0xc')](function(_0x47d52f){logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));logger[_0xd9f4('0x10')](_0xd9f4('0x11'),_0x366b9d,'request\x20sent',JSON[_0xd9f4('0x12')](_0x47d52f));if(_0x47d52f[_0xd9f4('0x13')]){if(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x14')]===0x1f4){logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x18305f(_0x47d52f['error'][_0xd9f4('0x15')]);}logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x6b13b5(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);}else{logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));_0x6b13b5(_0x47d52f[_0xd9f4('0x16')][_0xd9f4('0x15')]);}})[_0xd9f4('0x17')](function(_0x5e7da1){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x366b9d,_0x5e7da1);_0x18305f(_0x5e7da1);});});}exports['CreateSquareDetailsReport']=function(_0x25a7fe){var _0x2d7cb2=this;return new Promise(function(_0xc01934,_0x4a5ecf){return db[_0xd9f4('0x18')][_0xd9f4('0x19')](_0x25a7fe[_0xd9f4('0x1a')],{'raw':_0x25a7fe['options']?_0x25a7fe[_0xd9f4('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xd9f4('0xc')](function(_0x93e8df){logger[_0xd9f4('0xd')]('CreateSquareDetailsReport',_0x25a7fe);logger[_0xd9f4('0x10')](_0xd9f4('0x1c'),_0x25a7fe,JSON['stringify'](_0x93e8df));_0xc01934(_0x93e8df);})['catch'](function(_0x7196ab){logger['error'](_0xd9f4('0x1c'),_0x7196ab[_0xd9f4('0x15')],_0x25a7fe);_0x4a5ecf(_0x2d7cb2[_0xd9f4('0x13')](0x1f4,_0x7196ab[_0xd9f4('0x15')]));});});}; \ No newline at end of file +var _0x15b8=['options','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create'];(function(_0x42fc63,_0x4afc61){var _0x224588=function(_0x2d9a35){while(--_0x2d9a35){_0x42fc63['push'](_0x42fc63['shift']());}};_0x224588(++_0x4afc61);}(_0x15b8,0xcd));var _0x815b=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x15b8[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var util=require(_0x815b('0x0'));var moment=require(_0x815b('0x1'));var BPromise=require(_0x815b('0x2'));var rs=require(_0x815b('0x3'));var fs=require('fs');var Redis=require(_0x815b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x815b('0x5'));var logger=require(_0x815b('0x6'))(_0x815b('0x7'));var config=require(_0x815b('0x8'));var jayson=require(_0x815b('0x9'));var client=jayson[_0x815b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9fc0,_0xdfdf6,_0x26119a){return new BPromise(function(_0x175053,_0x2170c5){return client[_0x815b('0xb')](_0x1e9fc0,_0x26119a)[_0x815b('0xc')](function(_0x221ce4){logger[_0x815b('0xd')](_0x815b('0xe'),_0xdfdf6,_0x815b('0xf'));logger[_0x815b('0x10')](_0x815b('0x11'),_0xdfdf6,_0x815b('0xf'),JSON[_0x815b('0x12')](_0x221ce4));if(_0x221ce4[_0x815b('0x13')]){if(_0x221ce4[_0x815b('0x13')][_0x815b('0x14')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xdfdf6,_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);return _0x2170c5(_0x221ce4['error']['message']);}logger['error'](_0x815b('0xe'),_0xdfdf6,_0x221ce4['error']['message']);return _0x175053(_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);}else{logger[_0x815b('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0xdfdf6,'request\x20sent');_0x175053(_0x221ce4[_0x815b('0x16')][_0x815b('0x15')]);}})[_0x815b('0x17')](function(_0x4078db){logger[_0x815b('0x13')](_0x815b('0xe'),_0xdfdf6,_0x4078db);_0x2170c5(_0x4078db);});});}exports[_0x815b('0x18')]=function(_0x92d86a){var _0x26a8a3=this;return new Promise(function(_0x2fa2bd,_0x2ade43){return db[_0x815b('0x19')][_0x815b('0x1a')](_0x92d86a['body'],{'raw':_0x92d86a[_0x815b('0x1b')]?_0x92d86a[_0x815b('0x1b')][_0x815b('0x1c')]===undefined?!![]:![]:!![]})[_0x815b('0xc')](function(_0x3f710c){logger['info'](_0x815b('0x18'),_0x92d86a);logger[_0x815b('0x10')](_0x815b('0x18'),_0x92d86a,JSON['stringify'](_0x3f710c));_0x2fa2bd(_0x3f710c);})['catch'](function(_0x3ffdb7){logger[_0x815b('0x13')](_0x815b('0x18'),_0x3ffdb7[_0x815b('0x15')],_0x92d86a);_0x2ade43(_0x26a8a3[_0x815b('0x13')](0x1f4,_0x3ffdb7[_0x815b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 331e3d6..d803ef4 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 _0x94cb=['get','isAuthenticated','index','killProcess','exports','Router'];(function(_0x40b6db,_0x2a1fbb){var _0x3eaa81=function(_0x203e91){while(--_0x203e91){_0x40b6db['push'](_0x40b6db['shift']());}};_0x3eaa81(++_0x2a1fbb);}(_0x94cb,0x13d));var _0xb94c=function(_0x9820c5,_0x3bae04){_0x9820c5=_0x9820c5-0x0;var _0x712054=_0x94cb[_0x9820c5];return _0x712054;};'use strict';var express=require('express');var router=express[_0xb94c('0x0')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0xb94c('0x1')]('/',auth[_0xb94c('0x2')](),controller[_0xb94c('0x3')]);router[_0xb94c('0x1')]('/process/:pid/kill',auth[_0xb94c('0x2')](),controller[_0xb94c('0x4')]);module[_0xb94c('0x5')]=router; \ No newline at end of file +var _0x4895=['Router','../../components/auth/service','./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess'];(function(_0x2af264,_0x247f36){var _0x332436=function(_0x5d133d){while(--_0x5d133d){_0x2af264['push'](_0x2af264['shift']());}};_0x332436(++_0x247f36);}(_0x4895,0x90));var _0x5489=function(_0x560600,_0x2b7963){_0x560600=_0x560600-0x0;var _0x4d94e0=_0x4895[_0x560600];return _0x4d94e0;};'use strict';var express=require('express');var router=express[_0x5489('0x0')]();var auth=require(_0x5489('0x1'));var controller=require(_0x5489('0x2'));router[_0x5489('0x3')]('/',auth['isAuthenticated'](),controller[_0x5489('0x4')]);router[_0x5489('0x3')](_0x5489('0x5'),auth[_0x5489('0x6')](),controller[_0x5489('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index cfb18ac..42b2b56 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 _0xcd20=['split','length','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','../../config/logger','api','util','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid'];(function(_0xa483e,_0x28033d){var _0x565d91=function(_0x3bc273){while(--_0x3bc273){_0xa483e['push'](_0xa483e['shift']());}};_0x565d91(++_0x28033d);}(_0xcd20,0x157));var _0x0cd2=function(_0x125339,_0x3e13b3){_0x125339=_0x125339-0x0;var _0x303dec=_0xcd20[_0x125339];return _0x303dec;};'use strict';var info=require(_0x0cd2('0x0'));var exec=require(_0x0cd2('0x1'))['exec'];var logger=require(_0x0cd2('0x2'))(_0x0cd2('0x3'));var util=require(_0x0cd2('0x4'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x58d51b,_0x2b173d,_0x3cfacb){_0x2b173d=_0x2b173d||0x1f4;return function(_0x2b67fe){logger[_0x0cd2('0x5')](_0x0cd2('0x6'),_0x3cfacb,_0x2b173d,util[_0x0cd2('0x7')](_0x2b67fe,{'showHidden':![],'depth':null}));delete _0x2b67fe[_0x0cd2('0x8')];_0x58d51b[_0x0cd2('0x9')](_0x2b173d)[_0x0cd2('0xa')](_0x2b67fe);};}exports[_0x0cd2('0xb')]=function(_0x1a0670,_0x581bf9){return info[_0x0cd2('0xc')]()[_0x0cd2('0xd')](function(_0x2fd451){return _0x581bf9[_0x0cd2('0x9')](0xc8)[_0x0cd2('0xe')](_0x2fd451);})[_0x0cd2('0xf')](function(_0x5254ed){return _0x581bf9[_0x0cd2('0x9')](0x1f4)['json'](_0x5254ed);});};exports['killProcess']=function(_0x162af4,_0x36d894){var _0x5e5b19=[_0x0cd2('0x10')];return new BPromise(function(_0x172b12,_0x3fba4d){return exec(util[_0x0cd2('0x11')](_0x0cd2('0x12'),_0x162af4[_0x0cd2('0x13')][_0x0cd2('0x14')]),function(_0x3f7ccc,_0x1c0775,_0x68c014){if(_0x3f7ccc){return _0x3fba4d(_0x3f7ccc);}return _0x172b12(_0x1c0775);});})[_0x0cd2('0xd')](function(_0x4d3001){var _0x54c843=![];var _0x149d22=_0x4d3001[_0x0cd2('0x15')](/\n/);for(var _0x4cb4f2=0x0,_0x5c0d5a=_0x5e5b19[_0x0cd2('0x16')];_0x4cb4f2<_0x5c0d5a,_0x54c843===![];_0x4cb4f2+=0x1){if(_0x4d3001[_0x0cd2('0x17')](_0x5e5b19[_0x4cb4f2])>=0x0){_0x54c843=!![];}}if(!_0x54c843){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x162af4[_0x0cd2('0x13')][_0x0cd2('0x14')]));}process[_0x0cd2('0x18')](_0x162af4[_0x0cd2('0x13')][_0x0cd2('0x14')],_0x0cd2('0x19'));return _0x36d894[_0x0cd2('0x9')](0xc8)[_0x0cd2('0xe')]({'message':util['format'](_0x0cd2('0x1a'),_0x162af4[_0x0cd2('0x13')][_0x0cd2('0x14')])});})['catch'](handleError(_0x36d894,null,_0x0cd2('0x1b')));}; \ No newline at end of file +var _0xa8dc=['Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','api','util','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','then','json','catch','status','killProcess','components/import/cm','format','params','pid','split','length','indexOf'];(function(_0x2024bb,_0xffbe29){var _0x1856e9=function(_0x144a57){while(--_0x144a57){_0x2024bb['push'](_0x2024bb['shift']());}};_0x1856e9(++_0xffbe29);}(_0xa8dc,0x148));var _0xca8d=function(_0x1ad472,_0x45e50f){_0x1ad472=_0x1ad472-0x0;var _0xd94eec=_0xa8dc[_0x1ad472];return _0xd94eec;};'use strict';var info=require(_0xca8d('0x0'));var exec=require('child_process')[_0xca8d('0x1')];var logger=require('../../config/logger')(_0xca8d('0x2'));var util=require(_0xca8d('0x3'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x3add64,_0x14d48f,_0x281d9c){_0x14d48f=_0x14d48f||0x1f4;return function(_0x2af7e9){logger[_0xca8d('0x4')](_0xca8d('0x5'),_0x281d9c,_0x14d48f,util[_0xca8d('0x6')](_0x2af7e9,{'showHidden':![],'depth':null}));delete _0x2af7e9[_0xca8d('0x7')];_0x3add64['status'](_0x14d48f)[_0xca8d('0x8')](_0x2af7e9);};}exports[_0xca8d('0x9')]=function(_0x484f3b,_0xc452a){return info[_0xca8d('0xa')]()[_0xca8d('0xb')](function(_0x2edc4b){return _0xc452a['status'](0xc8)[_0xca8d('0xc')](_0x2edc4b);})[_0xca8d('0xd')](function(_0x10c995){return _0xc452a[_0xca8d('0xe')](0x1f4)[_0xca8d('0xc')](_0x10c995);});};exports[_0xca8d('0xf')]=function(_0x1c4e55,_0x1899af){var _0x5f3575=[_0xca8d('0x10')];return new BPromise(function(_0x2b5559,_0x34dfc1){return exec(util[_0xca8d('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1c4e55[_0xca8d('0x12')][_0xca8d('0x13')]),function(_0x382a1e,_0x1c93c0,_0x11104d){if(_0x382a1e){return _0x34dfc1(_0x382a1e);}return _0x2b5559(_0x1c93c0);});})['then'](function(_0x2dd5ae){var _0x591292=![];var _0x400f2a=_0x2dd5ae[_0xca8d('0x14')](/\n/);for(var _0x5cc77f=0x0,_0x40da3a=_0x5f3575[_0xca8d('0x15')];_0x5cc77f<_0x40da3a,_0x591292===![];_0x5cc77f+=0x1){if(_0x2dd5ae[_0xca8d('0x16')](_0x5f3575[_0x5cc77f])>=0x0){_0x591292=!![];}}if(!_0x591292){throw new Error(util[_0xca8d('0x11')](_0xca8d('0x17'),_0x1c4e55[_0xca8d('0x12')][_0xca8d('0x13')]));}process[_0xca8d('0x18')](_0x1c4e55['params']['pid'],_0xca8d('0x19'));return _0x1899af[_0xca8d('0xe')](0xc8)['json']({'message':util[_0xca8d('0x11')](_0xca8d('0x1a'),_0x1c4e55[_0xca8d('0x12')]['pid'])});})[_0xca8d('0xd')](handleError(_0x1899af,null,_0xca8d('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 5d2085f..f8f7335 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 _0x5430=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x2bf7db,_0xafc0ec){var _0x45be3a=function(_0xf9d78f){while(--_0xf9d78f){_0x2bf7db['push'](_0x2bf7db['shift']());}};_0x45be3a(++_0xafc0ec);}(_0x5430,0x10c));var _0x0543=function(_0x260745,_0x22df66){_0x260745=_0x260745-0x0;var _0xc5e63e=_0x5430[_0x260745];return _0xc5e63e;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express[_0x0543('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0543('0x6'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x0543('0x7')]('/',auth[_0x0543('0x8')](),controller[_0x0543('0x9')]);router[_0x0543('0x7')](_0x0543('0xa'),auth['isAuthenticated'](),controller[_0x0543('0xb')]);router[_0x0543('0xc')]('/',auth[_0x0543('0x8')](),controller[_0x0543('0xd')]);router[_0x0543('0xe')](_0x0543('0xa'),auth['isAuthenticated'](),controller[_0x0543('0xf')]);router[_0x0543('0x10')]('/:id',auth[_0x0543('0x8')](),controller[_0x0543('0x11')]);module[_0x0543('0x12')]=router; \ No newline at end of file +var _0xc7da=['index','/:id','show','post','create','put','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated'];(function(_0x2963b3,_0x179f6d){var _0x333b8e=function(_0x1598b2){while(--_0x1598b2){_0x2963b3['push'](_0x2963b3['shift']());}};_0x333b8e(++_0x179f6d);}(_0xc7da,0xf2));var _0xac7d=function(_0x1b1870,_0x3c6382){_0x1b1870=_0x1b1870-0x0;var _0x319b16=_0xc7da[_0x1b1870];return _0x319b16;};'use strict';var multer=require(_0xac7d('0x0'));var util=require(_0xac7d('0x1'));var path=require(_0xac7d('0x2'));var timeout=require('connect-timeout');var express=require(_0xac7d('0x3'));var router=express[_0xac7d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xac7d('0x5'));var interaction=require(_0xac7d('0x6'));var config=require('../../config/environment');var controller=require(_0xac7d('0x7'));router[_0xac7d('0x8')]('/',auth[_0xac7d('0x9')](),controller[_0xac7d('0xa')]);router[_0xac7d('0x8')](_0xac7d('0xb'),auth['isAuthenticated'](),controller[_0xac7d('0xc')]);router[_0xac7d('0xd')]('/',auth[_0xac7d('0x9')](),controller[_0xac7d('0xe')]);router[_0xac7d('0xf')](_0xac7d('0xb'),auth[_0xac7d('0x9')](),controller['update']);router[_0xac7d('0x10')](_0xac7d('0xb'),auth[_0xac7d('0x9')](),controller['destroy']);module[_0xac7d('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 508c0fa..34edc21 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 _0x8f59=['sequelize','exports','STRING','name','#0091EA'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0x8f59,0x11d));var _0x98f5=function(_0x441318,_0x1c6f5c){_0x441318=_0x441318-0x0;var _0x3f6839=_0x8f59[_0x441318];return _0x3f6839;};'use strict';var Sequelize=require(_0x98f5('0x0'));module[_0x98f5('0x1')]={'name':{'type':Sequelize[_0x98f5('0x2')],'unique':_0x98f5('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x98f5('0x2')],'defaultValue':_0x98f5('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5453=['sequelize','exports','STRING','name','#0091EA'];(function(_0x2748ff,_0x41e07d){var _0x156882=function(_0x4e2a64){while(--_0x4e2a64){_0x2748ff['push'](_0x2748ff['shift']());}};_0x156882(++_0x41e07d);}(_0x5453,0x18b));var _0x3545=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5453[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x3545('0x0'));module[_0x3545('0x1')]={'name':{'type':Sequelize[_0x3545('0x2')],'unique':_0x3545('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3545('0x2')],'defaultValue':_0x3545('0x4')},'description':{'type':Sequelize[_0x3545('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 664d429..4614ecd 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 _0x26c2=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','name','send','index','map','Tag','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x34827d,_0x216e99){var _0x7a060a=function(_0x5b466a){while(--_0x5b466a){_0x34827d['push'](_0x34827d['shift']());}};_0x7a060a(++_0x216e99);}(_0x26c2,0x130));var _0x226c=function(_0x428129,_0x347e21){_0x428129=_0x428129-0x0;var _0x5503f1=_0x26c2[_0x428129];return _0x5503f1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x226c('0x0'));var rp=require(_0x226c('0x1'));var moment=require(_0x226c('0x2'));var BPromise=require(_0x226c('0x3'));var Mustache=require('mustache');var util=require(_0x226c('0x4'));var path=require(_0x226c('0x5'));var sox=require('sox');var csv=require(_0x226c('0x6'));var ejs=require(_0x226c('0x7'));var fs=require('fs');var fs_extra=require(_0x226c('0x8'));var _=require(_0x226c('0x9'));var squel=require(_0x226c('0xa'));var crypto=require('crypto');var jsforce=require(_0x226c('0xb'));var deskjs=require(_0x226c('0xc'));var toCsv=require(_0x226c('0x6'));var querystring=require(_0x226c('0xd'));var Papa=require(_0x226c('0xe'));var Redis=require('ioredis');var authService=require(_0x226c('0xf'));var qs=require(_0x226c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x226c('0x11'))(_0x226c('0x12'));var utils=require(_0x226c('0x13'));var config=require(_0x226c('0x14'));var licenseUtil=require(_0x226c('0x15'));var db=require(_0x226c('0x16'))['db'];function respondWithStatusCode(_0x2964c2,_0x57dbc4){_0x57dbc4=_0x57dbc4||0xcc;return function(_0x481496){if(_0x481496){return _0x2964c2[_0x226c('0x17')](_0x57dbc4);}return _0x2964c2[_0x226c('0x18')](_0x57dbc4)[_0x226c('0x19')]();};}function respondWithResult(_0x36af55,_0x4eb557){_0x4eb557=_0x4eb557||0xc8;return function(_0x4bfd5c){if(_0x4bfd5c){return _0x36af55[_0x226c('0x18')](_0x4eb557)[_0x226c('0x1a')](_0x4bfd5c);}};}function respondWithFilteredResult(_0x15e13b,_0x55697c){return function(_0x5d6c21){if(_0x5d6c21){var _0x694eef=typeof _0x55697c[_0x226c('0x1b')]===_0x226c('0x1c')&&typeof _0x55697c[_0x226c('0x1d')]===_0x226c('0x1c');var _0x4832f5=_0x5d6c21['count'];var _0x5989e0=_0x694eef?0x0:_0x55697c[_0x226c('0x1b')];var _0x813b69=_0x694eef?_0x5d6c21[_0x226c('0x1e')]:_0x55697c[_0x226c('0x1b')]+_0x55697c['limit'];var _0x7fc168;if(_0x813b69>=_0x4832f5){_0x813b69=_0x4832f5;_0x7fc168=0xc8;}else{_0x7fc168=0xce;}_0x15e13b[_0x226c('0x18')](_0x7fc168);return _0x15e13b[_0x226c('0x1f')](_0x226c('0x20'),_0x5989e0+'-'+_0x813b69+'/'+_0x4832f5)[_0x226c('0x1a')](_0x5d6c21);}return null;};}function patchUpdates(_0x3d412a){return function(_0x4dabf3){try{jsonpatch[_0x226c('0x21')](_0x4dabf3,_0x3d412a,!![]);}catch(_0x34253b){return BPromise[_0x226c('0x22')](_0x34253b);}return _0x4dabf3[_0x226c('0x23')]();};}function saveUpdates(_0x272f26,_0x57eb9f){return function(_0x575c7a){if(_0x575c7a){return _0x575c7a['update'](_0x272f26)[_0x226c('0x24')](function(_0x52985c){return _0x52985c;});}return null;};}function removeEntity(_0x4da72c,_0xbaee21){return function(_0x5b3919){if(_0x5b3919){return _0x5b3919[_0x226c('0x25')]()[_0x226c('0x24')](function(){var _0x2a570a=_0x5b3919['get']({'plain':!![]});var _0x25165d='Tags';return db[_0x226c('0x26')]['destroy']({'where':{'type':_0x25165d,'resourceId':_0x2a570a['id']}})[_0x226c('0x24')](function(){return _0x5b3919;});})[_0x226c('0x24')](function(){_0x4da72c[_0x226c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14c49b,_0x4a0b38){return function(_0xbe7c35){if(!_0xbe7c35){_0x14c49b['sendStatus'](0x194);}return _0xbe7c35;};}function handleError(_0x431875,_0x539e59){_0x539e59=_0x539e59||0x1f4;return function(_0x40a095){logger[_0x226c('0x27')](_0x40a095['stack']);if(_0x40a095['name']){delete _0x40a095[_0x226c('0x28')];}_0x431875[_0x226c('0x18')](_0x539e59)[_0x226c('0x29')](_0x40a095);};}exports[_0x226c('0x2a')]=function(_0x1e78f5,_0x253aeb){var _0x2ff83b={},_0x3a28d8={},_0x5fdaf5={'count':0x0,'rows':[]};var _0x1bd25d=_[_0x226c('0x2b')](db[_0x226c('0x2c')]['rawAttributes'],function(_0xabaf14){return{'name':_0xabaf14[_0x226c('0x2d')],'type':_0xabaf14[_0x226c('0x2e')][_0x226c('0x2f')]};});_0x3a28d8[_0x226c('0x30')]=_['map'](_0x1bd25d,_0x226c('0x28'));_0x3a28d8[_0x226c('0x31')]=_[_0x226c('0x32')](_0x1e78f5['query']);_0x3a28d8[_0x226c('0x33')]=_['intersection'](_0x3a28d8[_0x226c('0x30')],_0x3a28d8[_0x226c('0x31')]);_0x2ff83b[_0x226c('0x34')]=_[_0x226c('0x35')](_0x3a28d8[_0x226c('0x30')],qs[_0x226c('0x36')](_0x1e78f5[_0x226c('0x31')][_0x226c('0x36')]));_0x2ff83b[_0x226c('0x34')]=_0x2ff83b[_0x226c('0x34')][_0x226c('0x37')]?_0x2ff83b[_0x226c('0x34')]:_0x3a28d8[_0x226c('0x30')];if(!_0x1e78f5[_0x226c('0x31')]['hasOwnProperty'](_0x226c('0x38'))){_0x2ff83b[_0x226c('0x1d')]=qs[_0x226c('0x1d')](_0x1e78f5[_0x226c('0x31')][_0x226c('0x1d')]);_0x2ff83b[_0x226c('0x1b')]=qs[_0x226c('0x1b')](_0x1e78f5[_0x226c('0x31')][_0x226c('0x1b')]);}_0x2ff83b['order']=qs['sort'](_0x1e78f5[_0x226c('0x31')][_0x226c('0x39')]);_0x2ff83b[_0x226c('0x3a')]=qs[_0x226c('0x33')](_[_0x226c('0x3b')](_0x1e78f5[_0x226c('0x31')],_0x3a28d8[_0x226c('0x33')]),_0x1bd25d);if(_0x1e78f5[_0x226c('0x31')][_0x226c('0x3c')]){_0x2ff83b['where']=_[_0x226c('0x3d')](_0x2ff83b['where'],{'$or':_[_0x226c('0x2b')](_0x1bd25d,function(_0x1a7d0d){if(_0x1a7d0d[_0x226c('0x2e')]!=='VIRTUAL'){var _0x507aa8={};_0x507aa8[_0x1a7d0d[_0x226c('0x28')]]={'$like':'%'+_0x1e78f5[_0x226c('0x31')]['filter']+'%'};return _0x507aa8;}})});}_0x2ff83b=_[_0x226c('0x3d')]({},_0x2ff83b,_0x1e78f5[_0x226c('0x3e')]);var _0x190605={'where':_0x2ff83b[_0x226c('0x3a')]};return db['Tag'][_0x226c('0x1e')](_0x190605)[_0x226c('0x24')](function(_0x12f34d){_0x5fdaf5['count']=_0x12f34d;if(_0x1e78f5[_0x226c('0x31')][_0x226c('0x3f')]){_0x2ff83b[_0x226c('0x40')]=[{'all':!![]}];}return db[_0x226c('0x2c')][_0x226c('0x41')](_0x2ff83b);})['then'](function(_0x5ea01f){_0x5fdaf5['rows']=_0x5ea01f;return _0x5fdaf5;})[_0x226c('0x24')](respondWithFilteredResult(_0x253aeb,_0x2ff83b))[_0x226c('0x42')](handleError(_0x253aeb,null));};exports[_0x226c('0x43')]=function(_0x17e1a8,_0x345514){var _0x3145f4={'raw':!![],'where':{'id':_0x17e1a8[_0x226c('0x44')]['id']}},_0x16ae23={};_0x16ae23[_0x226c('0x30')]=_['keys'](db['Tag'][_0x226c('0x45')]);_0x16ae23[_0x226c('0x31')]=_['keys'](_0x17e1a8[_0x226c('0x31')]);_0x16ae23['filters']=_['intersection'](_0x16ae23[_0x226c('0x30')],_0x16ae23['query']);_0x3145f4[_0x226c('0x34')]=_[_0x226c('0x35')](_0x16ae23[_0x226c('0x30')],qs[_0x226c('0x36')](_0x17e1a8[_0x226c('0x31')][_0x226c('0x36')]));_0x3145f4['attributes']=_0x3145f4[_0x226c('0x34')]['length']?_0x3145f4[_0x226c('0x34')]:_0x16ae23[_0x226c('0x30')];if(_0x17e1a8[_0x226c('0x31')][_0x226c('0x3f')]){_0x3145f4['include']=[{'all':!![]}];}_0x3145f4=_[_0x226c('0x3d')]({},_0x3145f4,_0x17e1a8['options']);return db[_0x226c('0x2c')][_0x226c('0x46')](_0x3145f4)[_0x226c('0x24')](handleEntityNotFound(_0x345514,null))[_0x226c('0x24')](respondWithResult(_0x345514,null))[_0x226c('0x42')](handleError(_0x345514,null));};exports[_0x226c('0x47')]=function(_0x4f99f5,_0x21c046){return db[_0x226c('0x2c')][_0x226c('0x47')](_0x4f99f5[_0x226c('0x48')],{})[_0x226c('0x24')](function(_0x27ccb8){var _0xfa1394=_0x4f99f5[_0x226c('0x49')][_0x226c('0x4a')]({'plain':!![]});if(!_0xfa1394)throw new Error(_0x226c('0x4b'));if(_0xfa1394[_0x226c('0x4c')]===_0x226c('0x49')){var _0x5f3434=_0x27ccb8['get']({'plain':!![]});var _0x486510=_0x226c('0x4d');return db[_0x226c('0x4e')][_0x226c('0x46')]({'where':{'name':_0x486510,'userProfileId':_0xfa1394['userProfileId']},'raw':!![]})[_0x226c('0x24')](function(_0x42710d){if(_0x42710d&&_0x42710d['autoAssociation']===0x0){return db[_0x226c('0x26')][_0x226c('0x47')]({'name':_0x5f3434[_0x226c('0x28')],'resourceId':_0x5f3434['id'],'type':_0x42710d[_0x226c('0x28')],'sectionId':_0x42710d['id']},{})[_0x226c('0x24')](function(){return _0x27ccb8;});}else{return _0x27ccb8;}})[_0x226c('0x42')](function(_0x3e60bf){logger[_0x226c('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e60bf);throw _0x3e60bf;});}return _0x27ccb8;})[_0x226c('0x24')](respondWithResult(_0x21c046,0xc9))[_0x226c('0x42')](handleError(_0x21c046,null));};exports['update']=function(_0x3b902a,_0x3e5304){if(_0x3b902a[_0x226c('0x48')]['id']){delete _0x3b902a[_0x226c('0x48')]['id'];}return db[_0x226c('0x2c')][_0x226c('0x46')]({'where':{'id':_0x3b902a['params']['id']}})[_0x226c('0x24')](handleEntityNotFound(_0x3e5304,null))['then'](saveUpdates(_0x3b902a['body'],null))[_0x226c('0x24')](respondWithResult(_0x3e5304,null))[_0x226c('0x42')](handleError(_0x3e5304,null));};exports['destroy']=function(_0x3861be,_0x17cfc1){return db[_0x226c('0x2c')]['find']({'where':{'id':_0x3861be[_0x226c('0x44')]['id']}})[_0x226c('0x24')](handleEntityNotFound(_0x17cfc1,null))[_0x226c('0x24')](removeEntity(_0x17cfc1,null))[_0x226c('0x42')](handleError(_0x17cfc1,null));}; \ No newline at end of file +var _0x8ce3=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','autoAssociation','UserProfileResource','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','stack','name','send','map','Tag','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields'];(function(_0x644560,_0x1783aa){var _0x41b76b=function(_0xff8c89){while(--_0xff8c89){_0x644560['push'](_0x644560['shift']());}};_0x41b76b(++_0x1783aa);}(_0x8ce3,0xc3));var _0x38ce=function(_0x50667a,_0x86eb28){_0x50667a=_0x50667a-0x0;var _0x4987e5=_0x8ce3[_0x50667a];return _0x4987e5;};'use strict';var emlformat=require(_0x38ce('0x0'));var rimraf=require(_0x38ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38ce('0x2'));var rp=require(_0x38ce('0x3'));var moment=require(_0x38ce('0x4'));var BPromise=require(_0x38ce('0x5'));var Mustache=require(_0x38ce('0x6'));var util=require(_0x38ce('0x7'));var path=require(_0x38ce('0x8'));var sox=require(_0x38ce('0x9'));var csv=require('to-csv');var ejs=require(_0x38ce('0xa'));var fs=require('fs');var fs_extra=require(_0x38ce('0xb'));var _=require('lodash');var squel=require(_0x38ce('0xc'));var crypto=require(_0x38ce('0xd'));var jsforce=require(_0x38ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x38ce('0xf'));var querystring=require('querystring');var Papa=require(_0x38ce('0x10'));var Redis=require('ioredis');var authService=require(_0x38ce('0x11'));var qs=require(_0x38ce('0x12'));var as=require(_0x38ce('0x13'));var hardwareService=require(_0x38ce('0x14'));var logger=require(_0x38ce('0x15'))(_0x38ce('0x16'));var utils=require(_0x38ce('0x17'));var config=require(_0x38ce('0x18'));var licenseUtil=require(_0x38ce('0x19'));var db=require(_0x38ce('0x1a'))['db'];function respondWithStatusCode(_0x42e234,_0x3ef662){_0x3ef662=_0x3ef662||0xcc;return function(_0x28b554){if(_0x28b554){return _0x42e234[_0x38ce('0x1b')](_0x3ef662);}return _0x42e234[_0x38ce('0x1c')](_0x3ef662)[_0x38ce('0x1d')]();};}function respondWithResult(_0x56a09f,_0x48ba7c){_0x48ba7c=_0x48ba7c||0xc8;return function(_0x3c4d7f){if(_0x3c4d7f){return _0x56a09f[_0x38ce('0x1c')](_0x48ba7c)[_0x38ce('0x1e')](_0x3c4d7f);}};}function respondWithFilteredResult(_0x55be6a,_0x2f3b99){return function(_0x54fcd3){if(_0x54fcd3){var _0x2771ec=typeof _0x2f3b99[_0x38ce('0x1f')]==='undefined'&&typeof _0x2f3b99[_0x38ce('0x20')]===_0x38ce('0x21');var _0x1dfaba=_0x54fcd3['count'];var _0xe4099a=_0x2771ec?0x0:_0x2f3b99[_0x38ce('0x1f')];var _0x3df527=_0x2771ec?_0x54fcd3[_0x38ce('0x22')]:_0x2f3b99[_0x38ce('0x1f')]+_0x2f3b99[_0x38ce('0x20')];var _0x2d4218;if(_0x3df527>=_0x1dfaba){_0x3df527=_0x1dfaba;_0x2d4218=0xc8;}else{_0x2d4218=0xce;}_0x55be6a['status'](_0x2d4218);return _0x55be6a[_0x38ce('0x23')](_0x38ce('0x24'),_0xe4099a+'-'+_0x3df527+'/'+_0x1dfaba)[_0x38ce('0x1e')](_0x54fcd3);}return null;};}function patchUpdates(_0x303391){return function(_0x30b060){try{jsonpatch[_0x38ce('0x25')](_0x30b060,_0x303391,!![]);}catch(_0x323490){return BPromise[_0x38ce('0x26')](_0x323490);}return _0x30b060[_0x38ce('0x27')]();};}function saveUpdates(_0x3cf50b,_0x1aace7){return function(_0x580cf3){if(_0x580cf3){return _0x580cf3[_0x38ce('0x28')](_0x3cf50b)[_0x38ce('0x29')](function(_0xe40e9c){return _0xe40e9c;});}return null;};}function removeEntity(_0xcf5d9e,_0x4a56b0){return function(_0x2c85e6){if(_0x2c85e6){return _0x2c85e6[_0x38ce('0x2a')]()['then'](function(){var _0xe0af00=_0x2c85e6[_0x38ce('0x2b')]({'plain':!![]});var _0x43b479='Tags';return db['UserProfileResource'][_0x38ce('0x2a')]({'where':{'type':_0x43b479,'resourceId':_0xe0af00['id']}})[_0x38ce('0x29')](function(){return _0x2c85e6;});})[_0x38ce('0x29')](function(){_0xcf5d9e[_0x38ce('0x1c')](0xcc)[_0x38ce('0x1d')]();});}};}function handleEntityNotFound(_0x2a59fe,_0x13e2fc){return function(_0xce1f64){if(!_0xce1f64){_0x2a59fe[_0x38ce('0x1b')](0x194);}return _0xce1f64;};}function handleError(_0x4649be,_0xfc590a){_0xfc590a=_0xfc590a||0x1f4;return function(_0x381703){logger['error'](_0x381703[_0x38ce('0x2c')]);if(_0x381703[_0x38ce('0x2d')]){delete _0x381703['name'];}_0x4649be[_0x38ce('0x1c')](_0xfc590a)[_0x38ce('0x2e')](_0x381703);};}exports['index']=function(_0xd96d33,_0x282ee4){var _0x568d94={},_0x28d775={},_0x53f2c9={'count':0x0,'rows':[]};var _0x1aa8fb=_[_0x38ce('0x2f')](db[_0x38ce('0x30')][_0x38ce('0x31')],function(_0x444b93){return{'name':_0x444b93[_0x38ce('0x32')],'type':_0x444b93[_0x38ce('0x33')][_0x38ce('0x34')]};});_0x28d775['model']=_['map'](_0x1aa8fb,_0x38ce('0x2d'));_0x28d775[_0x38ce('0x35')]=_[_0x38ce('0x36')](_0xd96d33[_0x38ce('0x35')]);_0x28d775[_0x38ce('0x37')]=_['intersection'](_0x28d775[_0x38ce('0x38')],_0x28d775[_0x38ce('0x35')]);_0x568d94[_0x38ce('0x39')]=_[_0x38ce('0x3a')](_0x28d775[_0x38ce('0x38')],qs[_0x38ce('0x3b')](_0xd96d33[_0x38ce('0x35')]['fields']));_0x568d94[_0x38ce('0x39')]=_0x568d94[_0x38ce('0x39')]['length']?_0x568d94[_0x38ce('0x39')]:_0x28d775[_0x38ce('0x38')];if(!_0xd96d33[_0x38ce('0x35')][_0x38ce('0x3c')](_0x38ce('0x3d'))){_0x568d94[_0x38ce('0x20')]=qs[_0x38ce('0x20')](_0xd96d33[_0x38ce('0x35')]['limit']);_0x568d94[_0x38ce('0x1f')]=qs[_0x38ce('0x1f')](_0xd96d33[_0x38ce('0x35')][_0x38ce('0x1f')]);}_0x568d94['order']=qs[_0x38ce('0x3e')](_0xd96d33['query'][_0x38ce('0x3e')]);_0x568d94[_0x38ce('0x3f')]=qs[_0x38ce('0x37')](_[_0x38ce('0x40')](_0xd96d33[_0x38ce('0x35')],_0x28d775[_0x38ce('0x37')]),_0x1aa8fb);if(_0xd96d33['query'][_0x38ce('0x41')]){_0x568d94['where']=_[_0x38ce('0x42')](_0x568d94[_0x38ce('0x3f')],{'$or':_[_0x38ce('0x2f')](_0x1aa8fb,function(_0x37b738){if(_0x37b738[_0x38ce('0x33')]!==_0x38ce('0x43')){var _0x5209ee={};_0x5209ee[_0x37b738[_0x38ce('0x2d')]]={'$like':'%'+_0xd96d33[_0x38ce('0x35')][_0x38ce('0x41')]+'%'};return _0x5209ee;}})});}_0x568d94=_[_0x38ce('0x42')]({},_0x568d94,_0xd96d33[_0x38ce('0x44')]);var _0x467d3e={'where':_0x568d94['where']};return db['Tag'][_0x38ce('0x22')](_0x467d3e)[_0x38ce('0x29')](function(_0x174c86){_0x53f2c9[_0x38ce('0x22')]=_0x174c86;if(_0xd96d33[_0x38ce('0x35')][_0x38ce('0x45')]){_0x568d94[_0x38ce('0x46')]=[{'all':!![]}];}return db['Tag'][_0x38ce('0x47')](_0x568d94);})[_0x38ce('0x29')](function(_0x5a689b){_0x53f2c9[_0x38ce('0x48')]=_0x5a689b;return _0x53f2c9;})[_0x38ce('0x29')](respondWithFilteredResult(_0x282ee4,_0x568d94))[_0x38ce('0x49')](handleError(_0x282ee4,null));};exports['show']=function(_0xaf99ce,_0xd95bc8){var _0x33f6a6={'raw':!![],'where':{'id':_0xaf99ce[_0x38ce('0x4a')]['id']}},_0x981068={};_0x981068[_0x38ce('0x38')]=_['keys'](db[_0x38ce('0x30')][_0x38ce('0x31')]);_0x981068[_0x38ce('0x35')]=_[_0x38ce('0x36')](_0xaf99ce[_0x38ce('0x35')]);_0x981068[_0x38ce('0x37')]=_['intersection'](_0x981068[_0x38ce('0x38')],_0x981068[_0x38ce('0x35')]);_0x33f6a6['attributes']=_['intersection'](_0x981068['model'],qs[_0x38ce('0x3b')](_0xaf99ce[_0x38ce('0x35')]['fields']));_0x33f6a6['attributes']=_0x33f6a6[_0x38ce('0x39')]['length']?_0x33f6a6[_0x38ce('0x39')]:_0x981068['model'];if(_0xaf99ce[_0x38ce('0x35')][_0x38ce('0x45')]){_0x33f6a6['include']=[{'all':!![]}];}_0x33f6a6=_[_0x38ce('0x42')]({},_0x33f6a6,_0xaf99ce[_0x38ce('0x44')]);return db['Tag'][_0x38ce('0x4b')](_0x33f6a6)[_0x38ce('0x29')](handleEntityNotFound(_0xd95bc8,null))[_0x38ce('0x29')](respondWithResult(_0xd95bc8,null))[_0x38ce('0x49')](handleError(_0xd95bc8,null));};exports[_0x38ce('0x4c')]=function(_0x25a299,_0x58cc6f){return db[_0x38ce('0x30')][_0x38ce('0x4c')](_0x25a299['body'],{})[_0x38ce('0x29')](function(_0x316eec){var _0x429517=_0x25a299[_0x38ce('0x4d')][_0x38ce('0x2b')]({'plain':!![]});if(!_0x429517)throw new Error(_0x38ce('0x4e'));if(_0x429517[_0x38ce('0x4f')]==='user'){var _0x3e1522=_0x316eec[_0x38ce('0x2b')]({'plain':!![]});var _0x3f88df=_0x38ce('0x50');return db[_0x38ce('0x51')][_0x38ce('0x4b')]({'where':{'name':_0x3f88df,'userProfileId':_0x429517['userProfileId']},'raw':!![]})['then'](function(_0xc2c9d3){if(_0xc2c9d3&&_0xc2c9d3[_0x38ce('0x52')]===0x0){return db[_0x38ce('0x53')][_0x38ce('0x4c')]({'name':_0x3e1522[_0x38ce('0x2d')],'resourceId':_0x3e1522['id'],'type':_0xc2c9d3[_0x38ce('0x2d')],'sectionId':_0xc2c9d3['id']},{})['then'](function(){return _0x316eec;});}else{return _0x316eec;}})['catch'](function(_0x199c5b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x199c5b);throw _0x199c5b;});}return _0x316eec;})[_0x38ce('0x29')](respondWithResult(_0x58cc6f,0xc9))[_0x38ce('0x49')](handleError(_0x58cc6f,null));};exports[_0x38ce('0x28')]=function(_0xbe5626,_0xd031c0){if(_0xbe5626['body']['id']){delete _0xbe5626[_0x38ce('0x54')]['id'];}return db[_0x38ce('0x30')][_0x38ce('0x4b')]({'where':{'id':_0xbe5626[_0x38ce('0x4a')]['id']}})[_0x38ce('0x29')](handleEntityNotFound(_0xd031c0,null))[_0x38ce('0x29')](saveUpdates(_0xbe5626[_0x38ce('0x54')],null))[_0x38ce('0x29')](respondWithResult(_0xd031c0,null))[_0x38ce('0x49')](handleError(_0xd031c0,null));};exports[_0x38ce('0x2a')]=function(_0x2db125,_0x56d63e){return db['Tag'][_0x38ce('0x4b')]({'where':{'id':_0x2db125[_0x38ce('0x4a')]['id']}})[_0x38ce('0x29')](handleEntityNotFound(_0x56d63e,null))[_0x38ce('0x29')](removeEntity(_0x56d63e,null))['catch'](handleError(_0x56d63e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index ccafb2f..1c3caed 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 _0x274e=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./tag.attributes','exports'];(function(_0x5b20cc,_0x4ddb6b){var _0x21fc47=function(_0x28b75d){while(--_0x28b75d){_0x5b20cc['push'](_0x5b20cc['shift']());}};_0x21fc47(++_0x4ddb6b);}(_0x274e,0xaa));var _0xe274=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x274e[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xe274('0x0'));var util=require(_0xe274('0x1'));var logger=require(_0xe274('0x2'))(_0xe274('0x3'));var moment=require(_0xe274('0x4'));var BPromise=require(_0xe274('0x5'));var rp=require(_0xe274('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe274('0x7'));var attributes=require(_0xe274('0x8'));module[_0xe274('0x9')]=function(_0x483050,_0x4ca821){return _0x483050['define']('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b9c=['define','Tag','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0x0b9c,0x195));var _0xc0b9=function(_0x252251,_0x15d92f){_0x252251=_0x252251-0x0;var _0x258b8d=_0x0b9c[_0x252251];return _0x258b8d;};'use strict';var _=require('lodash');var util=require(_0xc0b9('0x0'));var logger=require(_0xc0b9('0x1'))(_0xc0b9('0x2'));var moment=require(_0xc0b9('0x3'));var BPromise=require(_0xc0b9('0x4'));var rp=require(_0xc0b9('0x5'));var fs=require('fs');var path=require(_0xc0b9('0x6'));var rimraf=require(_0xc0b9('0x7'));var config=require(_0xc0b9('0x8'));var attributes=require(_0xc0b9('0x9'));module[_0xc0b9('0xa')]=function(_0xbdb383,_0x34fa7d){return _0xbdb383[_0xc0b9('0xb')](_0xc0b9('0xc'),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 5896a6d..1174c42 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 _0x89c3=['jayson/promise','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x89c3,0xff));var _0x389c=function(_0x2602f0,_0x4f438c){_0x2602f0=_0x2602f0-0x0;var _0x241731=_0x89c3[_0x2602f0];return _0x241731;};'use strict';var _=require(_0x389c('0x0'));var util=require(_0x389c('0x1'));var moment=require(_0x389c('0x2'));var BPromise=require(_0x389c('0x3'));var rs=require(_0x389c('0x4'));var fs=require('fs');var Redis=require(_0x389c('0x5'));var db=require(_0x389c('0x6'))['db'];var utils=require(_0x389c('0x7'));var logger=require('../../config/logger')(_0x389c('0x8'));var config=require('../../config/environment');var jayson=require(_0x389c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3e3f,_0x4a83ab,_0x58bf11){return new BPromise(function(_0x33cb72,_0x41b63b){return client[_0x389c('0xa')](_0x2f3e3f,_0x58bf11)[_0x389c('0xb')](function(_0x41c92b){logger[_0x389c('0xc')](_0x389c('0xd'),_0x4a83ab,_0x389c('0xe'));logger[_0x389c('0xf')]('Tag,\x20%s,\x20%s,\x20%s',_0x4a83ab,_0x389c('0xe'),JSON[_0x389c('0x10')](_0x41c92b));if(_0x41c92b[_0x389c('0x11')]){if(_0x41c92b[_0x389c('0x11')][_0x389c('0x12')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x4a83ab,_0x41c92b[_0x389c('0x11')][_0x389c('0x13')]);return _0x41b63b(_0x41c92b[_0x389c('0x11')]['message']);}logger[_0x389c('0x11')]('Tag,\x20%s,\x20%s',_0x4a83ab,_0x41c92b[_0x389c('0x11')][_0x389c('0x13')]);return _0x33cb72(_0x41c92b['error'][_0x389c('0x13')]);}else{logger[_0x389c('0xc')](_0x389c('0xd'),_0x4a83ab,'request\x20sent');_0x33cb72(_0x41c92b[_0x389c('0x14')][_0x389c('0x13')]);}})[_0x389c('0x15')](function(_0x3d6099){logger[_0x389c('0x11')]('Tag,\x20%s,\x20%s',_0x4a83ab,_0x3d6099);_0x41b63b(_0x3d6099);});});} \ No newline at end of file +var _0xed1f=['request','then','info','Tag,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1b827a,_0x9ed6b){var _0x4e4299=function(_0x485724){while(--_0x485724){_0x1b827a['push'](_0x1b827a['shift']());}};_0x4e4299(++_0x9ed6b);}(_0xed1f,0x6a));var _0xfed1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xed1f[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('Tag,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('Tag,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('Tag,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('Tag,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index fb7f0a6..c350f29 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 f8c680e..c1b8e07 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 _0x2032=['name','exports','STRING'];(function(_0x38e722,_0x5ee6c6){var _0x56b872=function(_0x46093c){while(--_0x46093c){_0x38e722['push'](_0x38e722['shift']());}};_0x56b872(++_0x5ee6c6);}(_0x2032,0xd9));var _0x2203=function(_0x36a569,_0x2cd602){_0x36a569=_0x36a569-0x0;var _0x4174e1=_0x2032[_0x36a569];return _0x4174e1;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xe706,0xa3));var _0x6e70=function(_0x26462e,_0x416ff7){_0x26462e=_0x26462e-0x0;var _0x31c3f0=_0xe706[_0x26462e];return _0x31c3f0;};'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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index d2d88cd..902a392 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 _0x2cc0=['rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','then','error','stack','name','send','index','map','Team','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','UserVoiceQueue','QueryTypes','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','end','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','Queue','sort','toLowerCase','Queues','addQueues','ValidationError','add','removeQueues','remove','capitalize','addAgents','isArray','ids','Chat','Sms','Fax','Openchannel','Whatsapp','Voice','through','QueueId','defaults','TeamVoiceQueue','penalty','findOrCreate','emit','Queue:save','User','voicePause','upsert','isNil','interface','format','SIP/%s','all','VoicePrefixId','spread','removeAgents','Mail','Queue:remove','UserVoiceQueueRt','getAgents','pick','eml-format'];(function(_0x3b8dbd,_0x2c2129){var _0x53a86c=function(_0x3d0d0b){while(--_0x3d0d0b){_0x3b8dbd['push'](_0x3b8dbd['shift']());}};_0x53a86c(++_0x2c2129);}(_0x2cc0,0x139));var _0x02cc=function(_0x33a444,_0x5a4a02){_0x33a444=_0x33a444-0x0;var _0x1fcc32=_0x2cc0[_0x33a444];return _0x1fcc32;};'use strict';var emlformat=require(_0x02cc('0x0'));var rimraf=require(_0x02cc('0x1'));var zipdir=require(_0x02cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x02cc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x02cc('0x4'));var util=require(_0x02cc('0x5'));var path=require(_0x02cc('0x6'));var sox=require(_0x02cc('0x7'));var csv=require(_0x02cc('0x8'));var ejs=require(_0x02cc('0x9'));var fs=require('fs');var fs_extra=require(_0x02cc('0xa'));var _=require('lodash');var squel=require(_0x02cc('0xb'));var crypto=require(_0x02cc('0xc'));var jsforce=require(_0x02cc('0xd'));var deskjs=require(_0x02cc('0xe'));var toCsv=require(_0x02cc('0x8'));var querystring=require(_0x02cc('0xf'));var Papa=require(_0x02cc('0x10'));var Redis=require(_0x02cc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x02cc('0x12'));var as=require(_0x02cc('0x13'));var hardwareService=require(_0x02cc('0x14'));var logger=require(_0x02cc('0x15'))('api');var utils=require(_0x02cc('0x16'));var config=require(_0x02cc('0x17'));var licenseUtil=require(_0x02cc('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x02cc('0x19')],{'host':_0x02cc('0x1a'),'port':0x18eb});var socket=require(_0x02cc('0x1b'))(new Redis(config[_0x02cc('0x19')]));require(_0x02cc('0x1c'))['register'](socket);function respondWithStatusCode(_0x566ee8,_0x276d91){_0x276d91=_0x276d91||0xcc;return function(_0x465bcf){if(_0x465bcf){return _0x566ee8[_0x02cc('0x1d')](_0x276d91);}return _0x566ee8[_0x02cc('0x1e')](_0x276d91)['end']();};}function respondWithResult(_0x448c8a,_0x118686){_0x118686=_0x118686||0xc8;return function(_0x457df6){if(_0x457df6){return _0x448c8a['status'](_0x118686)['json'](_0x457df6);}};}function respondWithFilteredResult(_0x4bdbe1,_0x2bad6b){return function(_0x44695){if(_0x44695){var _0x8a0b8a=typeof _0x2bad6b[_0x02cc('0x1f')]==='undefined'&&typeof _0x2bad6b['limit']===_0x02cc('0x20');var _0x1c758d=_0x44695['count'];var _0x28c7a8=_0x8a0b8a?0x0:_0x2bad6b[_0x02cc('0x1f')];var _0x208123=_0x8a0b8a?_0x44695[_0x02cc('0x21')]:_0x2bad6b[_0x02cc('0x1f')]+_0x2bad6b[_0x02cc('0x22')];var _0x46359f;if(_0x208123>=_0x1c758d){_0x208123=_0x1c758d;_0x46359f=0xc8;}else{_0x46359f=0xce;}_0x4bdbe1[_0x02cc('0x1e')](_0x46359f);return _0x4bdbe1[_0x02cc('0x23')]('Content-Range',_0x28c7a8+'-'+_0x208123+'/'+_0x1c758d)[_0x02cc('0x24')](_0x44695);}return null;};}function patchUpdates(_0x2360c7){return function(_0x3381ad){try{jsonpatch[_0x02cc('0x25')](_0x3381ad,_0x2360c7,!![]);}catch(_0x2964f3){return BPromise[_0x02cc('0x26')](_0x2964f3);}return _0x3381ad['save']();};}function saveUpdates(_0x4f157b,_0x221af3){return function(_0x1e1526){if(_0x1e1526){return _0x1e1526['update'](_0x4f157b)[_0x02cc('0x27')](function(_0x516a46){return _0x516a46;});}return null;};}function handleEntityNotFound(_0x2ddea6,_0x4bebbf){return function(_0x5ae8a1){if(!_0x5ae8a1){_0x2ddea6[_0x02cc('0x1d')](0x194);}return _0x5ae8a1;};}function handleError(_0x224fa6,_0x5f1268){_0x5f1268=_0x5f1268||0x1f4;return function(_0x818274){logger[_0x02cc('0x28')](_0x818274[_0x02cc('0x29')]);if(_0x818274[_0x02cc('0x2a')]){delete _0x818274['name'];}_0x224fa6['status'](_0x5f1268)[_0x02cc('0x2b')](_0x818274);};}exports[_0x02cc('0x2c')]=function(_0x329f02,_0x5e75f9){var _0xd04c55={},_0x48b05a={},_0x171186={'count':0x0,'rows':[]};var _0x5dbd3d=_[_0x02cc('0x2d')](db[_0x02cc('0x2e')][_0x02cc('0x2f')],function(_0x1862a4){return{'name':_0x1862a4['fieldName'],'type':_0x1862a4['type'][_0x02cc('0x30')]};});_0x48b05a[_0x02cc('0x31')]=_[_0x02cc('0x2d')](_0x5dbd3d,_0x02cc('0x2a'));_0x48b05a[_0x02cc('0x32')]=_[_0x02cc('0x33')](_0x329f02[_0x02cc('0x32')]);_0x48b05a[_0x02cc('0x34')]=_[_0x02cc('0x35')](_0x48b05a['model'],_0x48b05a[_0x02cc('0x32')]);_0xd04c55[_0x02cc('0x36')]=_[_0x02cc('0x35')](_0x48b05a[_0x02cc('0x31')],qs[_0x02cc('0x37')](_0x329f02[_0x02cc('0x32')][_0x02cc('0x37')]));_0xd04c55[_0x02cc('0x36')]=_0xd04c55[_0x02cc('0x36')][_0x02cc('0x38')]?_0xd04c55[_0x02cc('0x36')]:_0x48b05a[_0x02cc('0x31')];if(!_0x329f02[_0x02cc('0x32')][_0x02cc('0x39')](_0x02cc('0x3a'))){_0xd04c55[_0x02cc('0x22')]=qs[_0x02cc('0x22')](_0x329f02['query'][_0x02cc('0x22')]);_0xd04c55[_0x02cc('0x1f')]=qs[_0x02cc('0x1f')](_0x329f02[_0x02cc('0x32')]['offset']);}_0xd04c55[_0x02cc('0x3b')]=qs['sort'](_0x329f02[_0x02cc('0x32')]['sort']);_0xd04c55[_0x02cc('0x3c')]=qs['filters'](_['pick'](_0x329f02['query'],_0x48b05a['filters']),_0x5dbd3d);if(_0x329f02[_0x02cc('0x32')][_0x02cc('0x3d')]){_0xd04c55[_0x02cc('0x3c')]=_[_0x02cc('0x3e')](_0xd04c55['where'],{'$or':_[_0x02cc('0x2d')](_0x5dbd3d,function(_0x6aaef8){if(_0x6aaef8['type']!=='VIRTUAL'){var _0x29a93e={};_0x29a93e[_0x6aaef8[_0x02cc('0x2a')]]={'$like':'%'+_0x329f02['query'][_0x02cc('0x3d')]+'%'};return _0x29a93e;}})});}_0xd04c55=_[_0x02cc('0x3e')]({},_0xd04c55,_0x329f02[_0x02cc('0x3f')]);var _0x595577={'where':_0xd04c55[_0x02cc('0x3c')]};return db['Team'][_0x02cc('0x21')](_0x595577)[_0x02cc('0x27')](function(_0x35a41d){_0x171186[_0x02cc('0x21')]=_0x35a41d;if(_0x329f02[_0x02cc('0x32')][_0x02cc('0x40')]){_0xd04c55[_0x02cc('0x41')]=[{'all':!![]}];}return db['Team'][_0x02cc('0x42')](_0xd04c55);})[_0x02cc('0x27')](function(_0x5953f8){_0x171186[_0x02cc('0x43')]=_0x5953f8;return _0x171186;})[_0x02cc('0x27')](respondWithFilteredResult(_0x5e75f9,_0xd04c55))['catch'](handleError(_0x5e75f9,null));};exports[_0x02cc('0x44')]=function(_0x33a2e3,_0x55adb6){var _0x24629a={'raw':![],'where':{'id':_0x33a2e3[_0x02cc('0x45')]['id']}},_0x124821={};_0x124821[_0x02cc('0x31')]=_[_0x02cc('0x33')](db[_0x02cc('0x2e')]['rawAttributes']);_0x124821['query']=_[_0x02cc('0x33')](_0x33a2e3[_0x02cc('0x32')]);_0x124821['filters']=_[_0x02cc('0x35')](_0x124821[_0x02cc('0x31')],_0x124821['query']);_0x24629a[_0x02cc('0x36')]=_['intersection'](_0x124821[_0x02cc('0x31')],qs[_0x02cc('0x37')](_0x33a2e3[_0x02cc('0x32')][_0x02cc('0x37')]));_0x24629a[_0x02cc('0x36')]=_0x24629a[_0x02cc('0x36')][_0x02cc('0x38')]?_0x24629a[_0x02cc('0x36')]:_0x124821[_0x02cc('0x31')];if(_0x33a2e3[_0x02cc('0x32')][_0x02cc('0x40')]){_0x24629a[_0x02cc('0x41')]=[{'all':!![]}];}_0x24629a=_['merge']({},_0x24629a,_0x33a2e3[_0x02cc('0x3f')]);return db['Team'][_0x02cc('0x46')](_0x24629a)[_0x02cc('0x27')](handleEntityNotFound(_0x55adb6,null))[_0x02cc('0x27')](respondWithResult(_0x55adb6,null))[_0x02cc('0x47')](handleError(_0x55adb6,null));};exports[_0x02cc('0x48')]=function(_0x5881cf,_0x52039c){return db[_0x02cc('0x2e')][_0x02cc('0x48')](_0x5881cf['body'],{})[_0x02cc('0x27')](function(_0x4dbbb6){var _0x28f5ad=_0x5881cf[_0x02cc('0x49')][_0x02cc('0x4a')]({'plain':!![]});if(!_0x28f5ad)throw new Error(_0x02cc('0x4b'));if(_0x28f5ad[_0x02cc('0x4c')]===_0x02cc('0x49')){var _0x1a5564=_0x4dbbb6[_0x02cc('0x4a')]({'plain':!![]});var _0x277f69=_0x02cc('0x4d');return db['UserProfileSection'][_0x02cc('0x46')]({'where':{'name':_0x277f69,'userProfileId':_0x28f5ad[_0x02cc('0x4e')]},'raw':!![]})['then'](function(_0x55a311){if(_0x55a311&&_0x55a311['autoAssociation']===0x0){return db[_0x02cc('0x4f')][_0x02cc('0x48')]({'name':_0x1a5564[_0x02cc('0x2a')],'resourceId':_0x1a5564['id'],'type':_0x55a311[_0x02cc('0x2a')],'sectionId':_0x55a311['id']},{})[_0x02cc('0x27')](function(){return _0x4dbbb6;});}else{return _0x4dbbb6;}})['catch'](function(_0x3212a2){logger[_0x02cc('0x28')](_0x02cc('0x50'),_0x3212a2);throw _0x3212a2;});}return _0x4dbbb6;})['then'](respondWithResult(_0x52039c,0xc9))[_0x02cc('0x47')](handleError(_0x52039c,null));};exports[_0x02cc('0x51')]=function(_0x241821,_0x37b86a){if(_0x241821[_0x02cc('0x52')]['id']){delete _0x241821[_0x02cc('0x52')]['id'];}return db[_0x02cc('0x2e')][_0x02cc('0x46')]({'where':{'id':_0x241821[_0x02cc('0x45')]['id']}})[_0x02cc('0x27')](handleEntityNotFound(_0x37b86a,null))['then'](saveUpdates(_0x241821[_0x02cc('0x52')],null))['then'](respondWithResult(_0x37b86a,null))[_0x02cc('0x47')](handleError(_0x37b86a,null));};exports[_0x02cc('0x53')]=function(_0xf8e90b,_0x2e6030){var _0x522949=_0xf8e90b[_0x02cc('0x45')]['id'];var _0x1b8a2a=[];return db[_0x02cc('0x54')][_0x02cc('0x55')](function(_0x280c56){var _0x412d62=_0x02cc('0x56')+_0x522949;return db[_0x02cc('0x54')][_0x02cc('0x32')](_0x412d62,{'type':db[_0x02cc('0x57')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x280c56})['then'](function(_0x108497){_0x1b8a2a=_[_0x02cc('0x2d')](_0x108497,function(_0x65b709){return Number(_0x65b709['UserId']);});})[_0x02cc('0x27')](function(){var _0x232610=_0x02cc('0x58')+_0x522949;return db[_0x02cc('0x54')][_0x02cc('0x32')](_0x232610,{'type':db[_0x02cc('0x57')]['QueryTypes'][_0x02cc('0x59')],'raw':!![],'transaction':_0x280c56});})[_0x02cc('0x27')](function(_0x1558c8){var _0x390d0e=_[_0x02cc('0x2d')](_0x1558c8,function(_0x4265c4){return Number(_0x4265c4['VoiceQueueId']);});return db[_0x02cc('0x5a')][_0x02cc('0x53')]({'where':{'UserId':{'$in':_0x1b8a2a},'VoiceQueueId':{'$in':_0x390d0e}},'transaction':_0x280c56});})[_0x02cc('0x27')](function(){var _0x1ad435='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x522949;return db[_0x02cc('0x54')][_0x02cc('0x32')](_0x1ad435,{'type':db['Sequelize'][_0x02cc('0x5b')]['SELECT'],'raw':!![],'transaction':_0x280c56});})[_0x02cc('0x27')](function(_0x503015){var _0x5bae7a=_['map'](_0x503015,function(_0x1ff467){return Number(_0x1ff467[_0x02cc('0x5c')]);});return db[_0x02cc('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x1b8a2a},'MailQueueId':{'$in':_0x5bae7a}},'transaction':_0x280c56});})[_0x02cc('0x27')](function(){var _0x1874af=_0x02cc('0x5e')+_0x522949;return db['sequelize'][_0x02cc('0x32')](_0x1874af,{'type':db[_0x02cc('0x57')]['QueryTypes'][_0x02cc('0x59')],'raw':!![],'transaction':_0x280c56});})[_0x02cc('0x27')](function(_0x52042e){var _0x2140ce=_['map'](_0x52042e,function(_0x5026c8){return Number(_0x5026c8['SmsQueueId']);});return db[_0x02cc('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x1b8a2a},'SmsQueueId':{'$in':_0x2140ce}},'transaction':_0x280c56});})[_0x02cc('0x27')](function(){var _0x45ddc9=_0x02cc('0x60')+_0x522949;return db[_0x02cc('0x54')]['query'](_0x45ddc9,{'type':db[_0x02cc('0x57')][_0x02cc('0x5b')]['SELECT'],'raw':!![],'transaction':_0x280c56});})['then'](function(_0x273be8){var _0x420fed=_[_0x02cc('0x2d')](_0x273be8,function(_0x125493){return Number(_0x125493[_0x02cc('0x61')]);});return db['UserChatQueue'][_0x02cc('0x53')]({'where':{'UserId':{'$in':_0x1b8a2a},'ChatQueueId':{'$in':_0x420fed}},'transaction':_0x280c56});})['then'](function(){var _0x4bcb16=_0x02cc('0x62')+_0x522949;return db[_0x02cc('0x54')][_0x02cc('0x32')](_0x4bcb16,{'type':db[_0x02cc('0x57')]['QueryTypes'][_0x02cc('0x59')],'raw':!![],'transaction':_0x280c56});})[_0x02cc('0x27')](function(_0x2c6e4a){var _0x3915c4=_[_0x02cc('0x2d')](_0x2c6e4a,function(_0x489cc9){return Number(_0x489cc9[_0x02cc('0x63')]);});return db['UserFaxQueue'][_0x02cc('0x53')]({'where':{'UserId':{'$in':_0x1b8a2a},'FaxQueueId':{'$in':_0x3915c4}},'transaction':_0x280c56});})[_0x02cc('0x27')](function(){var _0x5d4f17=_0x02cc('0x64')+_0x522949;return db[_0x02cc('0x54')][_0x02cc('0x32')](_0x5d4f17,{'type':db[_0x02cc('0x57')][_0x02cc('0x5b')][_0x02cc('0x59')],'raw':!![],'transaction':_0x280c56});})[_0x02cc('0x27')](function(_0x259687){var _0x44654d=_['map'](_0x259687,function(_0x233430){return Number(_0x233430[_0x02cc('0x65')]);});return db[_0x02cc('0x66')][_0x02cc('0x53')]({'where':{'UserId':{'$in':_0x1b8a2a},'OpenchannelQueueId':{'$in':_0x44654d}},'transaction':_0x280c56});})[_0x02cc('0x27')](function(){var _0x215923=_0x02cc('0x67')+_0x522949;return db[_0x02cc('0x54')][_0x02cc('0x32')](_0x215923,{'type':db['Sequelize']['QueryTypes'][_0x02cc('0x59')],'raw':!![],'transaction':_0x280c56});})[_0x02cc('0x27')](function(_0x1661c5){var _0x1e1601=_[_0x02cc('0x2d')](_0x1661c5,function(_0xd11bd0){return Number(_0xd11bd0[_0x02cc('0x68')]);});return db[_0x02cc('0x69')][_0x02cc('0x53')]({'where':{'UserId':{'$in':_0x1b8a2a},'WhatsappQueueId':{'$in':_0x1e1601}},'transaction':_0x280c56});})[_0x02cc('0x27')](function(){return db[_0x02cc('0x6a')]['find']({'where':{'TeamId':_0x522949}});})[_0x02cc('0x27')](function(_0x3258b9){if(_0x3258b9===null){return;}return db[_0x02cc('0x6b')][_0x02cc('0x53')]({'where':{'UserId':{'$in':_0x1b8a2a},'VoicePrefixId':_0x3258b9['VoicePrefixId']},'transaction':_0x280c56});})['then'](function(){return db[_0x02cc('0x2e')][_0x02cc('0x53')]({'where':{'id':_0x522949},'cascade':!![],'transaction':_0x280c56});})[_0x02cc('0x27')](function(_0x4f6528){if(_0x4f6528===0x0){_0x2e6030[_0x02cc('0x1d')](0x194);}else{return db['UserProfileResource'][_0x02cc('0x53')]({'where':{'type':'Teams','resourceId':_0x522949},'cascade':!![],'transaction':_0x280c56})[_0x02cc('0x27')](function(){_0x2e6030[_0x02cc('0x1e')](0xcc)[_0x02cc('0x6c')]();});}})[_0x02cc('0x47')](function(_0x3eb126){_0x2e6030['status'](0x1f4)['send'](_0x3eb126);});});};exports[_0x02cc('0x6d')]=function(_0x29fae0,_0x5bd443,_0xe8ba3e){return db[_0x02cc('0x2e')][_0x02cc('0x6e')]({'where':{'id':_0x29fae0['params']['id']}})[_0x02cc('0x27')](handleEntityNotFound(_0x5bd443,null))['then'](function(_0x113fff){if(!_0x29fae0[_0x02cc('0x32')][_0x02cc('0x6f')]||!utils[_0x02cc('0x70')](_0x29fae0[_0x02cc('0x32')][_0x02cc('0x6f')])){throw new db[(_0x02cc('0x57'))]['ValidationError'](_0x02cc('0x71'));}var _0x45dcf4={};var _0x4b1bda={};_0x4b1bda['model']=_[_0x02cc('0x33')](db[_['capitalize'](_0x29fae0[_0x02cc('0x32')][_0x02cc('0x6f')]['toLowerCase']())+_0x02cc('0x72')][_0x02cc('0x2f')]);_0x4b1bda[_0x02cc('0x32')]=_[_0x02cc('0x33')](_0x29fae0['query']);_0x4b1bda[_0x02cc('0x34')]=_[_0x02cc('0x35')](_0x4b1bda[_0x02cc('0x31')],_0x4b1bda[_0x02cc('0x32')]);_0x45dcf4['attributes']=_['intersection'](_0x4b1bda['model'],qs['fields'](_0x29fae0[_0x02cc('0x32')][_0x02cc('0x37')]));_0x45dcf4[_0x02cc('0x36')]=_0x45dcf4[_0x02cc('0x36')][_0x02cc('0x38')]?_0x45dcf4[_0x02cc('0x36')]:_0x4b1bda['model'];_0x45dcf4[_0x02cc('0x22')]=qs[_0x02cc('0x22')](_0x29fae0['query'][_0x02cc('0x22')]);_0x45dcf4[_0x02cc('0x1f')]=qs[_0x02cc('0x1f')](_0x29fae0[_0x02cc('0x32')][_0x02cc('0x1f')]);_0x45dcf4[_0x02cc('0x3b')]=qs[_0x02cc('0x73')](_0x29fae0['query'][_0x02cc('0x73')]);_0x45dcf4['where']=qs[_0x02cc('0x34')](_['pick'](_0x29fae0[_0x02cc('0x32')],_0x4b1bda[_0x02cc('0x34')]));_0x45dcf4=_[_0x02cc('0x3e')]({},_0x45dcf4,_0x29fae0['options']);return _0x113fff[_0x02cc('0x4a')+_['capitalize'](_0x29fae0[_0x02cc('0x32')][_0x02cc('0x6f')][_0x02cc('0x74')]())+_0x02cc('0x75')](_0x45dcf4);})[_0x02cc('0x27')](respondWithResult(_0x5bd443,null))[_0x02cc('0x47')](handleError(_0x5bd443,null));};exports[_0x02cc('0x76')]=function(_0x138707,_0x290648,_0x18eb7c){return db['Team'][_0x02cc('0x6e')]({'where':{'id':_0x138707['params']['id']}})[_0x02cc('0x27')](function(_0x1a6e39){if(_0x1a6e39){if(!_0x138707['body'][_0x02cc('0x6f')]||!utils['isValidChannel'](_0x138707[_0x02cc('0x52')][_0x02cc('0x6f')])){throw new db[(_0x02cc('0x57'))][(_0x02cc('0x77'))](_0x02cc('0x71'));}return _0x1a6e39[_0x02cc('0x78')+_['capitalize'](_0x138707[_0x02cc('0x52')][_0x02cc('0x6f')][_0x02cc('0x74')]())+'Queues'](_0x138707['body']['ids']);}return null;})['then'](handleEntityNotFound(_0x290648,null))[_0x02cc('0x27')](respondWithStatusCode(_0x290648,null))[_0x02cc('0x47')](handleError(_0x290648,null));};exports[_0x02cc('0x79')]=function(_0x255873,_0x57ad1c,_0x20ab54){return db[_0x02cc('0x2e')][_0x02cc('0x6e')]({'where':{'id':_0x255873[_0x02cc('0x45')]['id']}})[_0x02cc('0x27')](function(_0x4c14d9){if(_0x4c14d9){if(!_0x255873['query'][_0x02cc('0x6f')]||!utils[_0x02cc('0x70')](_0x255873[_0x02cc('0x32')][_0x02cc('0x6f')])){throw new db[(_0x02cc('0x57'))][(_0x02cc('0x77'))]('Unknown\x20channel');}return _0x4c14d9[_0x02cc('0x7a')+_[_0x02cc('0x7b')](_0x255873[_0x02cc('0x32')][_0x02cc('0x6f')]['toLowerCase']())+'Queues'](_0x255873[_0x02cc('0x32')]['ids']);}return null;})[_0x02cc('0x27')](handleEntityNotFound(_0x57ad1c,null))[_0x02cc('0x27')](respondWithStatusCode(_0x57ad1c,null))[_0x02cc('0x47')](handleError(_0x57ad1c,null));};exports[_0x02cc('0x7c')]=function(_0x340b22,_0x166430){var _0x39de13=_[_0x02cc('0x7d')](_0x340b22[_0x02cc('0x52')][_0x02cc('0x7e')])?_0x340b22[_0x02cc('0x52')][_0x02cc('0x7e')]:[_0x340b22['body']['ids']];var _0x53f359=_0x340b22['params']['id'];return db[_0x02cc('0x2e')][_0x02cc('0x46')]({'where':{'id':_0x53f359}})['then'](handleEntityNotFound(_0x166430,null))[_0x02cc('0x27')](function(_0x128c8d){if(_0x128c8d){var _0x1a81f2=['Voice',_0x02cc('0x7f'),'Mail',_0x02cc('0x80'),_0x02cc('0x81'),_0x02cc('0x82'),_0x02cc('0x83')];return db[_0x02cc('0x54')]['transaction'](function(_0x5ccc8d){var _0xef8b58=_[_0x02cc('0x2d')](_0x1a81f2,function(_0x3d7760){var _0x41fc11={'attributes':['id',_0x02cc('0x2a')]};if(_0x3d7760===_0x02cc('0x84')){_0x41fc11[_0x02cc('0x85')]={'attributes':['penalty']};}return _0x128c8d['get'+_0x3d7760+_0x02cc('0x75')](_0x41fc11)[_0x02cc('0x27')](function(_0x1fc833){var _0x471df7=_[_0x02cc('0x2d')](_0x1fc833,function(_0x171116){var _0x5a8c01=_[_0x02cc('0x2d')](_0x39de13,function(_0x57a416){var _0x27995f={'where':{'UserId':_0x57a416,[_0x3d7760+_0x02cc('0x86')]:_0x171116['id']},'transaction':_0x5ccc8d};if(_0x3d7760===_0x02cc('0x84')){_0x27995f[_0x02cc('0x87')]={'penalty':_0x171116[_0x02cc('0x88')][_0x02cc('0x89')]};}return db['User'+_0x3d7760+'Queue'][_0x02cc('0x8a')](_0x27995f)['then'](function(){socket[_0x02cc('0x8b')]('user'+_0x3d7760+_0x02cc('0x8c'),{'UserId':_0x57a416,[_0x3d7760+'QueueId']:_0x171116['id']});if(_0x3d7760!==_0x02cc('0x84')){return;}return db[_0x02cc('0x8d')][_0x02cc('0x42')]({'where':{'id':_0x39de13,'online':0x1},'attributes':['id','name','online',_0x02cc('0x8e'),'interface'],'raw':!![]})[_0x02cc('0x27')](function(_0x12c34d){var _0xfb4b13=_[_0x02cc('0x2d')](_0x12c34d,function(_0x5d4cca){return db['UserVoiceQueueRt'][_0x02cc('0x8f')]({'membername':_0x5d4cca[_0x02cc('0x2a')],'UserId':_0x5d4cca['id'],'queue_name':_0x171116[_0x02cc('0x2a')],'VoiceQueueId':_0x171116['id'],'interface':_[_0x02cc('0x90')](_0x5d4cca[_0x02cc('0x91')])?util[_0x02cc('0x92')](_0x02cc('0x93'),_0x5d4cca[_0x02cc('0x2a')]):_0x5d4cca[_0x02cc('0x91')],'paused':_0x5d4cca[_0x02cc('0x8e')]||![],'penalty':_0x171116[_0x02cc('0x88')][_0x02cc('0x89')]},{'transaction':_0x5ccc8d});});return Promise[_0x02cc('0x94')](_0xfb4b13);});});});return Promise['all'](_0x5a8c01);});return Promise[_0x02cc('0x94')](_0x471df7);})[_0x02cc('0x27')](function(){return db['TeamVoicePrefix'][_0x02cc('0x6e')]({'where':{'teamId':_0x53f359}})['then'](function(_0x436c58){if(_0x436c58){var _0x5d4b22=_[_0x02cc('0x2d')](_0x39de13,function(_0x3e9fe1){db[_0x02cc('0x6b')]['upsert']({'UserId':_0x3e9fe1,'VoicePrefixId':_0x436c58[_0x02cc('0x95')]});});return Promise[_0x02cc('0x94')](_0x5d4b22);}});});});return Promise[_0x02cc('0x94')](_0xef8b58)[_0x02cc('0x27')](function(){return _0x128c8d[_0x02cc('0x7c')](_0x39de13,{'transaction':_0x5ccc8d})[_0x02cc('0x96')](function(_0x5c89ee){return _0x5c89ee;});});});}})[_0x02cc('0x27')](respondWithResult(_0x166430,null))[_0x02cc('0x47')](handleError(_0x166430,null));};exports[_0x02cc('0x97')]=function(_0x4ad987,_0x25c379){var _0x208da8=_[_0x02cc('0x7d')](_0x4ad987[_0x02cc('0x32')][_0x02cc('0x7e')])?_0x4ad987[_0x02cc('0x32')][_0x02cc('0x7e')]:[_0x4ad987['query']['ids']];var _0x18424b=_0x4ad987[_0x02cc('0x45')]['id'];return db['Team'][_0x02cc('0x46')]({'where':{'id':_0x18424b}})[_0x02cc('0x27')](handleEntityNotFound(_0x25c379,null))['then'](function(_0x13efbc){if(_0x13efbc){var _0x352245=[_0x02cc('0x84'),_0x02cc('0x7f'),_0x02cc('0x98'),_0x02cc('0x80'),'Fax',_0x02cc('0x82'),_0x02cc('0x83')];return db['sequelize'][_0x02cc('0x55')](function(_0x11aa44){var _0x267fa8=_['map'](_0x352245,function(_0x5a160e){var _0x21b35c={'attributes':['id','name']};return _0x13efbc['get'+_0x5a160e+'Queues'](_0x21b35c)[_0x02cc('0x27')](function(_0x4b0b06){var _0x3e18ae=_[_0x02cc('0x2d')](_0x4b0b06,function(_0x18d942){return _0x18d942[_0x02cc('0x97')](_0x208da8,{'transaction':_0x11aa44})[_0x02cc('0x27')](function(){var _0x6b6145=_['map'](_0x208da8,function(_0x571406){socket[_0x02cc('0x8b')](_0x02cc('0x49')+_0x5a160e+_0x02cc('0x99'),{'UserId':Number(_0x571406),[_0x5a160e+'QueueId']:_0x18d942['id']});if(_0x5a160e!=='Voice'){return;}return db[_0x02cc('0x9a')][_0x02cc('0x53')]({'where':{'VoiceQueueId':_0x18d942['id'],'UserId':_0x571406},'transaction':_0x11aa44});});return Promise[_0x02cc('0x94')](_0x6b6145);});});return Promise[_0x02cc('0x94')](_0x3e18ae);});});return Promise[_0x02cc('0x94')](_0x267fa8)[_0x02cc('0x27')](function(){return _0x13efbc[_0x02cc('0x97')](_0x208da8,{'transaction':_0x11aa44});})[_0x02cc('0x27')](function(){return db[_0x02cc('0x6a')]['findOne']({'where':{'teamId':_0x18424b}})[_0x02cc('0x27')](function(_0x576818){if(_0x576818){var _0x48624b=_[_0x02cc('0x2d')](_0x208da8,function(_0x30ccd4){db[_0x02cc('0x6b')]['destroy']({'where':{'UserId':_0x30ccd4,'VoicePrefixId':_0x576818[_0x02cc('0x95')]}});});return Promise[_0x02cc('0x94')](_0x48624b);}});});});}})[_0x02cc('0x27')](respondWithStatusCode(_0x25c379,null))[_0x02cc('0x47')](handleError(_0x25c379,null));};exports[_0x02cc('0x9b')]=function(_0x4e2feb,_0x76d4b,_0x318c84){var _0x5a22b2={};var _0x52a478={};var _0x4a2ab9;var _0x52c4fc;return db[_0x02cc('0x2e')][_0x02cc('0x6e')]({'where':{'id':_0x4e2feb[_0x02cc('0x45')]['id']}})[_0x02cc('0x27')](handleEntityNotFound(_0x76d4b,null))[_0x02cc('0x27')](function(_0x12e2b4){if(_0x12e2b4){_0x4a2ab9=_0x12e2b4;_0x52a478['model']=_[_0x02cc('0x33')](db[_0x02cc('0x8d')][_0x02cc('0x2f')]);_0x52a478[_0x02cc('0x32')]=_[_0x02cc('0x33')](_0x4e2feb[_0x02cc('0x32')]);_0x52a478[_0x02cc('0x34')]=_[_0x02cc('0x35')](_0x52a478[_0x02cc('0x31')],_0x52a478[_0x02cc('0x32')]);_0x5a22b2[_0x02cc('0x36')]=_[_0x02cc('0x35')](_0x52a478[_0x02cc('0x31')],qs[_0x02cc('0x37')](_0x4e2feb['query'][_0x02cc('0x37')]));_0x5a22b2[_0x02cc('0x36')]=_0x5a22b2[_0x02cc('0x36')]['length']?_0x5a22b2[_0x02cc('0x36')]:_0x52a478[_0x02cc('0x31')];_0x5a22b2[_0x02cc('0x3b')]=qs[_0x02cc('0x73')](_0x4e2feb[_0x02cc('0x32')]['sort']);_0x5a22b2[_0x02cc('0x3c')]=qs[_0x02cc('0x34')](_[_0x02cc('0x9c')](_0x4e2feb['query'],_0x52a478[_0x02cc('0x34')]));if(_0x4e2feb[_0x02cc('0x32')][_0x02cc('0x3d')]){_0x5a22b2['where']=_[_0x02cc('0x3e')](_0x5a22b2[_0x02cc('0x3c')],{'$or':_[_0x02cc('0x2d')](_0x5a22b2[_0x02cc('0x36')],function(_0x209d3a){var _0x3f67ac={};_0x3f67ac[_0x209d3a]={'$like':'%'+_0x4e2feb[_0x02cc('0x32')][_0x02cc('0x3d')]+'%'};return _0x3f67ac;})});}_0x5a22b2=_['merge']({},_0x5a22b2,_0x4e2feb[_0x02cc('0x3f')]);return _0x4a2ab9[_0x02cc('0x9b')](_0x5a22b2);}})['then'](function(_0x36416e){if(_0x36416e){_0x52c4fc=_0x36416e[_0x02cc('0x38')];if(!_0x4e2feb['query'][_0x02cc('0x39')](_0x02cc('0x3a'))){_0x5a22b2[_0x02cc('0x22')]=qs[_0x02cc('0x22')](_0x4e2feb[_0x02cc('0x32')][_0x02cc('0x22')]);_0x5a22b2['offset']=qs['offset'](_0x4e2feb[_0x02cc('0x32')]['offset']);}return _0x4a2ab9[_0x02cc('0x9b')](_0x5a22b2);}})[_0x02cc('0x27')](function(_0xefcba7){if(_0xefcba7){return _0xefcba7?{'count':_0x52c4fc,'rows':_0xefcba7}:null;}})[_0x02cc('0x27')](respondWithResult(_0x76d4b,null))['catch'](handleError(_0x76d4b,null));}; \ No newline at end of file +var _0x9041=['SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','Queue','toLowerCase','isValidChannel','Queues','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','through','QueueId','defaults','TeamVoiceQueue','penalty','User','emit','Queue:save','findAll','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','SIP/%s','all','TeamVoicePrefix','spread','removeAgents','Queue:remove','getAgents','order','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','save','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','include','catch','show','params','keys','create','body','user','role','get','Teams','find','userProfileId','autoAssociation','UserProfileResource','update','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','sequelize','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue'];(function(_0x2f6799,_0x4e7f00){var _0x3cb26f=function(_0x3c5a3d){while(--_0x3c5a3d){_0x2f6799['push'](_0x2f6799['shift']());}};_0x3cb26f(++_0x4e7f00);}(_0x9041,0x159));var _0x1904=function(_0x492325,_0x8bd1df){_0x492325=_0x492325-0x0;var _0x5b3018=_0x9041[_0x492325];return _0x5b3018;};'use strict';var emlformat=require(_0x1904('0x0'));var rimraf=require(_0x1904('0x1'));var zipdir=require(_0x1904('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1904('0x3'));var Mustache=require(_0x1904('0x4'));var util=require(_0x1904('0x5'));var path=require(_0x1904('0x6'));var sox=require('sox');var csv=require(_0x1904('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1904('0x8'));var _=require(_0x1904('0x9'));var squel=require('squel');var crypto=require(_0x1904('0xa'));var jsforce=require(_0x1904('0xb'));var deskjs=require(_0x1904('0xc'));var toCsv=require(_0x1904('0x7'));var querystring=require(_0x1904('0xd'));var Papa=require(_0x1904('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1904('0xf'));var as=require(_0x1904('0x10'));var hardwareService=require(_0x1904('0x11'));var logger=require(_0x1904('0x12'))(_0x1904('0x13'));var utils=require('../../config/utils');var config=require(_0x1904('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1904('0x15'))['db'];config[_0x1904('0x16')]=_['defaults'](config[_0x1904('0x16')],{'host':_0x1904('0x17'),'port':0x18eb});var socket=require(_0x1904('0x18'))(new Redis(config[_0x1904('0x16')]));require(_0x1904('0x19'))[_0x1904('0x1a')](socket);function respondWithStatusCode(_0x32eaab,_0x2c311e){_0x2c311e=_0x2c311e||0xcc;return function(_0x44a4d7){if(_0x44a4d7){return _0x32eaab[_0x1904('0x1b')](_0x2c311e);}return _0x32eaab[_0x1904('0x1c')](_0x2c311e)[_0x1904('0x1d')]();};}function respondWithResult(_0x25c50b,_0x2be06e){_0x2be06e=_0x2be06e||0xc8;return function(_0x627979){if(_0x627979){return _0x25c50b['status'](_0x2be06e)['json'](_0x627979);}};}function respondWithFilteredResult(_0x13eff9,_0x34d5fc){return function(_0x46c8f8){if(_0x46c8f8){var _0x360161=typeof _0x34d5fc[_0x1904('0x1e')]==='undefined'&&typeof _0x34d5fc['limit']===_0x1904('0x1f');var _0x37fc79=_0x46c8f8[_0x1904('0x20')];var _0x3b35df=_0x360161?0x0:_0x34d5fc[_0x1904('0x1e')];var _0x4f8f60=_0x360161?_0x46c8f8['count']:_0x34d5fc[_0x1904('0x1e')]+_0x34d5fc['limit'];var _0x4a7c8e;if(_0x4f8f60>=_0x37fc79){_0x4f8f60=_0x37fc79;_0x4a7c8e=0xc8;}else{_0x4a7c8e=0xce;}_0x13eff9[_0x1904('0x1c')](_0x4a7c8e);return _0x13eff9[_0x1904('0x21')](_0x1904('0x22'),_0x3b35df+'-'+_0x4f8f60+'/'+_0x37fc79)[_0x1904('0x23')](_0x46c8f8);}return null;};}function patchUpdates(_0x414205){return function(_0xb4831a){try{jsonpatch['apply'](_0xb4831a,_0x414205,!![]);}catch(_0x3aebf5){return BPromise['reject'](_0x3aebf5);}return _0xb4831a[_0x1904('0x24')]();};}function saveUpdates(_0x2fae5b,_0xf972f2){return function(_0x4839ee){if(_0x4839ee){return _0x4839ee['update'](_0x2fae5b)[_0x1904('0x25')](function(_0x38b105){return _0x38b105;});}return null;};}function handleEntityNotFound(_0x2b03c8,_0x4d87d4){return function(_0x30b6f7){if(!_0x30b6f7){_0x2b03c8['sendStatus'](0x194);}return _0x30b6f7;};}function handleError(_0x49d80f,_0x2f419f){_0x2f419f=_0x2f419f||0x1f4;return function(_0x4785ae){logger[_0x1904('0x26')](_0x4785ae[_0x1904('0x27')]);if(_0x4785ae['name']){delete _0x4785ae[_0x1904('0x28')];}_0x49d80f['status'](_0x2f419f)[_0x1904('0x29')](_0x4785ae);};}exports[_0x1904('0x2a')]=function(_0x48776a,_0x37f5a8){var _0x44a97c={},_0x85ea7={},_0x2d7a08={'count':0x0,'rows':[]};var _0x45c795=_[_0x1904('0x2b')](db[_0x1904('0x2c')][_0x1904('0x2d')],function(_0x4efe37){return{'name':_0x4efe37[_0x1904('0x2e')],'type':_0x4efe37[_0x1904('0x2f')][_0x1904('0x30')]};});_0x85ea7[_0x1904('0x31')]=_[_0x1904('0x2b')](_0x45c795,_0x1904('0x28'));_0x85ea7['query']=_['keys'](_0x48776a[_0x1904('0x32')]);_0x85ea7[_0x1904('0x33')]=_[_0x1904('0x34')](_0x85ea7['model'],_0x85ea7[_0x1904('0x32')]);_0x44a97c[_0x1904('0x35')]=_[_0x1904('0x34')](_0x85ea7[_0x1904('0x31')],qs[_0x1904('0x36')](_0x48776a[_0x1904('0x32')][_0x1904('0x36')]));_0x44a97c[_0x1904('0x35')]=_0x44a97c[_0x1904('0x35')][_0x1904('0x37')]?_0x44a97c[_0x1904('0x35')]:_0x85ea7['model'];if(!_0x48776a[_0x1904('0x32')][_0x1904('0x38')](_0x1904('0x39'))){_0x44a97c[_0x1904('0x3a')]=qs['limit'](_0x48776a[_0x1904('0x32')][_0x1904('0x3a')]);_0x44a97c[_0x1904('0x1e')]=qs['offset'](_0x48776a[_0x1904('0x32')][_0x1904('0x1e')]);}_0x44a97c['order']=qs[_0x1904('0x3b')](_0x48776a['query']['sort']);_0x44a97c[_0x1904('0x3c')]=qs[_0x1904('0x33')](_[_0x1904('0x3d')](_0x48776a[_0x1904('0x32')],_0x85ea7['filters']),_0x45c795);if(_0x48776a[_0x1904('0x32')][_0x1904('0x3e')]){_0x44a97c[_0x1904('0x3c')]=_[_0x1904('0x3f')](_0x44a97c['where'],{'$or':_[_0x1904('0x2b')](_0x45c795,function(_0x5b9816){if(_0x5b9816[_0x1904('0x2f')]!=='VIRTUAL'){var _0x56013c={};_0x56013c[_0x5b9816['name']]={'$like':'%'+_0x48776a[_0x1904('0x32')][_0x1904('0x3e')]+'%'};return _0x56013c;}})});}_0x44a97c=_[_0x1904('0x3f')]({},_0x44a97c,_0x48776a[_0x1904('0x40')]);var _0x32ae7d={'where':_0x44a97c[_0x1904('0x3c')]};return db[_0x1904('0x2c')]['count'](_0x32ae7d)[_0x1904('0x25')](function(_0x21bbe0){_0x2d7a08[_0x1904('0x20')]=_0x21bbe0;if(_0x48776a[_0x1904('0x32')]['includeAll']){_0x44a97c[_0x1904('0x41')]=[{'all':!![]}];}return db['Team']['findAll'](_0x44a97c);})[_0x1904('0x25')](function(_0x316517){_0x2d7a08['rows']=_0x316517;return _0x2d7a08;})['then'](respondWithFilteredResult(_0x37f5a8,_0x44a97c))[_0x1904('0x42')](handleError(_0x37f5a8,null));};exports[_0x1904('0x43')]=function(_0x499485,_0x509730){var _0x4f5119={'raw':![],'where':{'id':_0x499485[_0x1904('0x44')]['id']}},_0x38121a={};_0x38121a[_0x1904('0x31')]=_['keys'](db[_0x1904('0x2c')][_0x1904('0x2d')]);_0x38121a['query']=_[_0x1904('0x45')](_0x499485['query']);_0x38121a[_0x1904('0x33')]=_[_0x1904('0x34')](_0x38121a[_0x1904('0x31')],_0x38121a[_0x1904('0x32')]);_0x4f5119[_0x1904('0x35')]=_[_0x1904('0x34')](_0x38121a[_0x1904('0x31')],qs[_0x1904('0x36')](_0x499485['query'][_0x1904('0x36')]));_0x4f5119['attributes']=_0x4f5119[_0x1904('0x35')][_0x1904('0x37')]?_0x4f5119[_0x1904('0x35')]:_0x38121a['model'];if(_0x499485['query']['includeAll']){_0x4f5119['include']=[{'all':!![]}];}_0x4f5119=_[_0x1904('0x3f')]({},_0x4f5119,_0x499485[_0x1904('0x40')]);return db[_0x1904('0x2c')]['find'](_0x4f5119)[_0x1904('0x25')](handleEntityNotFound(_0x509730,null))[_0x1904('0x25')](respondWithResult(_0x509730,null))[_0x1904('0x42')](handleError(_0x509730,null));};exports[_0x1904('0x46')]=function(_0x4100be,_0xe09981){return db[_0x1904('0x2c')]['create'](_0x4100be[_0x1904('0x47')],{})[_0x1904('0x25')](function(_0x5c5695){var _0x28628b=_0x4100be[_0x1904('0x48')]['get']({'plain':!![]});if(!_0x28628b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28628b[_0x1904('0x49')]===_0x1904('0x48')){var _0x2ced56=_0x5c5695[_0x1904('0x4a')]({'plain':!![]});var _0x1f9176=_0x1904('0x4b');return db['UserProfileSection'][_0x1904('0x4c')]({'where':{'name':_0x1f9176,'userProfileId':_0x28628b[_0x1904('0x4d')]},'raw':!![]})[_0x1904('0x25')](function(_0x3a8fab){if(_0x3a8fab&&_0x3a8fab[_0x1904('0x4e')]===0x0){return db[_0x1904('0x4f')]['create']({'name':_0x2ced56['name'],'resourceId':_0x2ced56['id'],'type':_0x3a8fab[_0x1904('0x28')],'sectionId':_0x3a8fab['id']},{})[_0x1904('0x25')](function(){return _0x5c5695;});}else{return _0x5c5695;}})[_0x1904('0x42')](function(_0x166e9a){logger[_0x1904('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x166e9a);throw _0x166e9a;});}return _0x5c5695;})[_0x1904('0x25')](respondWithResult(_0xe09981,0xc9))[_0x1904('0x42')](handleError(_0xe09981,null));};exports[_0x1904('0x50')]=function(_0x17be2c,_0x376d39){if(_0x17be2c[_0x1904('0x47')]['id']){delete _0x17be2c[_0x1904('0x47')]['id'];}return db['Team'][_0x1904('0x4c')]({'where':{'id':_0x17be2c[_0x1904('0x44')]['id']}})[_0x1904('0x25')](handleEntityNotFound(_0x376d39,null))[_0x1904('0x25')](saveUpdates(_0x17be2c['body'],null))[_0x1904('0x25')](respondWithResult(_0x376d39,null))['catch'](handleError(_0x376d39,null));};exports[_0x1904('0x51')]=function(_0x5ee340,_0x372d21){var _0xf636f1=_0x5ee340[_0x1904('0x44')]['id'];var _0x1578f0=[];return db['sequelize'][_0x1904('0x52')](function(_0x4def61){var _0x459e23=_0x1904('0x53')+_0xf636f1;return db['sequelize'][_0x1904('0x32')](_0x459e23,{'type':db[_0x1904('0x54')][_0x1904('0x55')][_0x1904('0x56')],'raw':!![],'transaction':_0x4def61})[_0x1904('0x25')](function(_0x4a655a){_0x1578f0=_[_0x1904('0x2b')](_0x4a655a,function(_0x14a450){return Number(_0x14a450[_0x1904('0x57')]);});})['then'](function(){var _0xc5bba4=_0x1904('0x58')+_0xf636f1;return db[_0x1904('0x59')][_0x1904('0x32')](_0xc5bba4,{'type':db[_0x1904('0x54')][_0x1904('0x55')][_0x1904('0x56')],'raw':!![],'transaction':_0x4def61});})[_0x1904('0x25')](function(_0x401d12){var _0x4aad96=_[_0x1904('0x2b')](_0x401d12,function(_0x582458){return Number(_0x582458[_0x1904('0x5a')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x1578f0},'VoiceQueueId':{'$in':_0x4aad96}},'transaction':_0x4def61});})[_0x1904('0x25')](function(){var _0x11ab7d=_0x1904('0x5b')+_0xf636f1;return db[_0x1904('0x59')][_0x1904('0x32')](_0x11ab7d,{'type':db[_0x1904('0x54')]['QueryTypes'][_0x1904('0x56')],'raw':!![],'transaction':_0x4def61});})[_0x1904('0x25')](function(_0x24224e){var _0x2e136a=_[_0x1904('0x2b')](_0x24224e,function(_0x569b4a){return Number(_0x569b4a[_0x1904('0x5c')]);});return db[_0x1904('0x5d')][_0x1904('0x51')]({'where':{'UserId':{'$in':_0x1578f0},'MailQueueId':{'$in':_0x2e136a}},'transaction':_0x4def61});})[_0x1904('0x25')](function(){var _0x15d0f3=_0x1904('0x5e')+_0xf636f1;return db['sequelize'][_0x1904('0x32')](_0x15d0f3,{'type':db[_0x1904('0x54')]['QueryTypes'][_0x1904('0x56')],'raw':!![],'transaction':_0x4def61});})[_0x1904('0x25')](function(_0x1366e2){var _0x4f78d4=_[_0x1904('0x2b')](_0x1366e2,function(_0x19f55a){return Number(_0x19f55a['SmsQueueId']);});return db['UserSmsQueue'][_0x1904('0x51')]({'where':{'UserId':{'$in':_0x1578f0},'SmsQueueId':{'$in':_0x4f78d4}},'transaction':_0x4def61});})['then'](function(){var _0x1f0198='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0xf636f1;return db[_0x1904('0x59')]['query'](_0x1f0198,{'type':db[_0x1904('0x54')][_0x1904('0x55')]['SELECT'],'raw':!![],'transaction':_0x4def61});})[_0x1904('0x25')](function(_0x539fe2){var _0x518518=_[_0x1904('0x2b')](_0x539fe2,function(_0x19746b){return Number(_0x19746b[_0x1904('0x5f')]);});return db['UserChatQueue'][_0x1904('0x51')]({'where':{'UserId':{'$in':_0x1578f0},'ChatQueueId':{'$in':_0x518518}},'transaction':_0x4def61});})[_0x1904('0x25')](function(){var _0x182285=_0x1904('0x60')+_0xf636f1;return db[_0x1904('0x59')][_0x1904('0x32')](_0x182285,{'type':db[_0x1904('0x54')][_0x1904('0x55')]['SELECT'],'raw':!![],'transaction':_0x4def61});})[_0x1904('0x25')](function(_0x305179){var _0x1e9f63=_['map'](_0x305179,function(_0x1d37c0){return Number(_0x1d37c0[_0x1904('0x61')]);});return db[_0x1904('0x62')][_0x1904('0x51')]({'where':{'UserId':{'$in':_0x1578f0},'FaxQueueId':{'$in':_0x1e9f63}},'transaction':_0x4def61});})['then'](function(){var _0x18b9e0=_0x1904('0x63')+_0xf636f1;return db['sequelize'][_0x1904('0x32')](_0x18b9e0,{'type':db[_0x1904('0x54')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4def61});})['then'](function(_0x78e45){var _0x480bc4=_[_0x1904('0x2b')](_0x78e45,function(_0x536d54){return Number(_0x536d54['OpenchannelQueueId']);});return db[_0x1904('0x64')][_0x1904('0x51')]({'where':{'UserId':{'$in':_0x1578f0},'OpenchannelQueueId':{'$in':_0x480bc4}},'transaction':_0x4def61});})[_0x1904('0x25')](function(){var _0x7190e5=_0x1904('0x65')+_0xf636f1;return db['sequelize']['query'](_0x7190e5,{'type':db[_0x1904('0x54')][_0x1904('0x55')][_0x1904('0x56')],'raw':!![],'transaction':_0x4def61});})[_0x1904('0x25')](function(_0x4931a3){var _0x12410e=_[_0x1904('0x2b')](_0x4931a3,function(_0x4c7343){return Number(_0x4c7343['WhatsappQueueId']);});return db[_0x1904('0x66')][_0x1904('0x51')]({'where':{'UserId':{'$in':_0x1578f0},'WhatsappQueueId':{'$in':_0x12410e}},'transaction':_0x4def61});})[_0x1904('0x25')](function(){return db['TeamVoicePrefix'][_0x1904('0x4c')]({'where':{'TeamId':_0xf636f1}});})[_0x1904('0x25')](function(_0x4c5322){if(_0x4c5322===null){return;}return db[_0x1904('0x67')]['destroy']({'where':{'UserId':{'$in':_0x1578f0},'VoicePrefixId':_0x4c5322[_0x1904('0x68')]},'transaction':_0x4def61});})['then'](function(){return db[_0x1904('0x2c')]['destroy']({'where':{'id':_0xf636f1},'cascade':!![],'transaction':_0x4def61});})['then'](function(_0x1ad4b2){if(_0x1ad4b2===0x0){_0x372d21['sendStatus'](0x194);}else{return db[_0x1904('0x4f')][_0x1904('0x51')]({'where':{'type':_0x1904('0x4b'),'resourceId':_0xf636f1},'cascade':!![],'transaction':_0x4def61})[_0x1904('0x25')](function(){_0x372d21[_0x1904('0x1c')](0xcc)['end']();});}})[_0x1904('0x42')](function(_0x5c6d13){_0x372d21[_0x1904('0x1c')](0x1f4)['send'](_0x5c6d13);});});};exports[_0x1904('0x69')]=function(_0x2015a5,_0x3c0645,_0x2087bc){return db[_0x1904('0x2c')][_0x1904('0x6a')]({'where':{'id':_0x2015a5[_0x1904('0x44')]['id']}})['then'](handleEntityNotFound(_0x3c0645,null))[_0x1904('0x25')](function(_0x59b243){if(!_0x2015a5['query'][_0x1904('0x6b')]||!utils['isValidChannel'](_0x2015a5[_0x1904('0x32')]['channel'])){throw new db['Sequelize'][(_0x1904('0x6c'))](_0x1904('0x6d'));}var _0x3fe4eb={};var _0x286dbc={};_0x286dbc[_0x1904('0x31')]=_[_0x1904('0x45')](db[_[_0x1904('0x6e')](_0x2015a5[_0x1904('0x32')][_0x1904('0x6b')]['toLowerCase']())+_0x1904('0x6f')][_0x1904('0x2d')]);_0x286dbc['query']=_['keys'](_0x2015a5[_0x1904('0x32')]);_0x286dbc[_0x1904('0x33')]=_['intersection'](_0x286dbc[_0x1904('0x31')],_0x286dbc[_0x1904('0x32')]);_0x3fe4eb['attributes']=_[_0x1904('0x34')](_0x286dbc[_0x1904('0x31')],qs[_0x1904('0x36')](_0x2015a5[_0x1904('0x32')][_0x1904('0x36')]));_0x3fe4eb[_0x1904('0x35')]=_0x3fe4eb[_0x1904('0x35')]['length']?_0x3fe4eb[_0x1904('0x35')]:_0x286dbc['model'];_0x3fe4eb[_0x1904('0x3a')]=qs[_0x1904('0x3a')](_0x2015a5[_0x1904('0x32')][_0x1904('0x3a')]);_0x3fe4eb[_0x1904('0x1e')]=qs['offset'](_0x2015a5[_0x1904('0x32')]['offset']);_0x3fe4eb['order']=qs[_0x1904('0x3b')](_0x2015a5[_0x1904('0x32')]['sort']);_0x3fe4eb[_0x1904('0x3c')]=qs[_0x1904('0x33')](_[_0x1904('0x3d')](_0x2015a5[_0x1904('0x32')],_0x286dbc[_0x1904('0x33')]));_0x3fe4eb=_[_0x1904('0x3f')]({},_0x3fe4eb,_0x2015a5['options']);return _0x59b243[_0x1904('0x4a')+_[_0x1904('0x6e')](_0x2015a5[_0x1904('0x32')][_0x1904('0x6b')][_0x1904('0x70')]())+'Queues'](_0x3fe4eb);})[_0x1904('0x25')](respondWithResult(_0x3c0645,null))[_0x1904('0x42')](handleError(_0x3c0645,null));};exports['addQueues']=function(_0x199412,_0x1ed4ce,_0x4f38a8){return db[_0x1904('0x2c')]['findOne']({'where':{'id':_0x199412[_0x1904('0x44')]['id']}})['then'](function(_0x9516d0){if(_0x9516d0){if(!_0x199412[_0x1904('0x47')][_0x1904('0x6b')]||!utils[_0x1904('0x71')](_0x199412[_0x1904('0x47')][_0x1904('0x6b')])){throw new db[(_0x1904('0x54'))][(_0x1904('0x6c'))](_0x1904('0x6d'));}return _0x9516d0['add'+_[_0x1904('0x6e')](_0x199412[_0x1904('0x47')][_0x1904('0x6b')][_0x1904('0x70')]())+_0x1904('0x72')](_0x199412[_0x1904('0x47')][_0x1904('0x73')]);}return null;})[_0x1904('0x25')](handleEntityNotFound(_0x1ed4ce,null))[_0x1904('0x25')](respondWithStatusCode(_0x1ed4ce,null))[_0x1904('0x42')](handleError(_0x1ed4ce,null));};exports[_0x1904('0x74')]=function(_0x4428a5,_0xe2fd1c,_0x1ae44a){return db['Team'][_0x1904('0x6a')]({'where':{'id':_0x4428a5[_0x1904('0x44')]['id']}})['then'](function(_0x381dd5){if(_0x381dd5){if(!_0x4428a5[_0x1904('0x32')]['channel']||!utils['isValidChannel'](_0x4428a5[_0x1904('0x32')][_0x1904('0x6b')])){throw new db[(_0x1904('0x54'))][(_0x1904('0x6c'))](_0x1904('0x6d'));}return _0x381dd5[_0x1904('0x75')+_['capitalize'](_0x4428a5[_0x1904('0x32')][_0x1904('0x6b')]['toLowerCase']())+_0x1904('0x72')](_0x4428a5[_0x1904('0x32')][_0x1904('0x73')]);}return null;})['then'](handleEntityNotFound(_0xe2fd1c,null))[_0x1904('0x25')](respondWithStatusCode(_0xe2fd1c,null))['catch'](handleError(_0xe2fd1c,null));};exports[_0x1904('0x76')]=function(_0x3b36ac,_0x55eb67){var _0x5763b9=_[_0x1904('0x77')](_0x3b36ac[_0x1904('0x47')][_0x1904('0x73')])?_0x3b36ac['body'][_0x1904('0x73')]:[_0x3b36ac[_0x1904('0x47')][_0x1904('0x73')]];var _0x135887=_0x3b36ac[_0x1904('0x44')]['id'];return db[_0x1904('0x2c')][_0x1904('0x4c')]({'where':{'id':_0x135887}})['then'](handleEntityNotFound(_0x55eb67,null))['then'](function(_0x215672){if(_0x215672){var _0x2b69a1=[_0x1904('0x78'),_0x1904('0x79'),_0x1904('0x7a'),_0x1904('0x7b'),_0x1904('0x7c'),'Openchannel','Whatsapp'];return db[_0x1904('0x59')][_0x1904('0x52')](function(_0x187e51){var _0x5edaee=_[_0x1904('0x2b')](_0x2b69a1,function(_0x506283){var _0x415da={'attributes':['id',_0x1904('0x28')]};if(_0x506283==='Voice'){_0x415da[_0x1904('0x7d')]={'attributes':['penalty']};}return _0x215672[_0x1904('0x4a')+_0x506283+_0x1904('0x72')](_0x415da)[_0x1904('0x25')](function(_0x46343a){var _0x54f0d1=_['map'](_0x46343a,function(_0x5a7b07){var _0x4fa79e=_[_0x1904('0x2b')](_0x5763b9,function(_0x27b0ca){var _0x5c27bc={'where':{'UserId':_0x27b0ca,[_0x506283+_0x1904('0x7e')]:_0x5a7b07['id']},'transaction':_0x187e51};if(_0x506283===_0x1904('0x78')){_0x5c27bc[_0x1904('0x7f')]={'penalty':_0x5a7b07[_0x1904('0x80')][_0x1904('0x81')]};}return db[_0x1904('0x82')+_0x506283+_0x1904('0x6f')]['findOrCreate'](_0x5c27bc)[_0x1904('0x25')](function(){socket[_0x1904('0x83')](_0x1904('0x48')+_0x506283+_0x1904('0x84'),{'UserId':_0x27b0ca,[_0x506283+_0x1904('0x7e')]:_0x5a7b07['id']});if(_0x506283!==_0x1904('0x78')){return;}return db[_0x1904('0x82')][_0x1904('0x85')]({'where':{'id':_0x5763b9,'online':0x1},'attributes':['id',_0x1904('0x28'),_0x1904('0x86'),_0x1904('0x87'),'interface'],'raw':!![]})['then'](function(_0x3e4300){var _0x269a22=_['map'](_0x3e4300,function(_0x1751e7){return db[_0x1904('0x88')][_0x1904('0x89')]({'membername':_0x1751e7['name'],'UserId':_0x1751e7['id'],'queue_name':_0x5a7b07['name'],'VoiceQueueId':_0x5a7b07['id'],'interface':_[_0x1904('0x8a')](_0x1751e7[_0x1904('0x8b')])?util['format'](_0x1904('0x8c'),_0x1751e7[_0x1904('0x28')]):_0x1751e7['interface'],'paused':_0x1751e7[_0x1904('0x87')]||![],'penalty':_0x5a7b07['TeamVoiceQueue'][_0x1904('0x81')]},{'transaction':_0x187e51});});return Promise[_0x1904('0x8d')](_0x269a22);});});});return Promise[_0x1904('0x8d')](_0x4fa79e);});return Promise[_0x1904('0x8d')](_0x54f0d1);})[_0x1904('0x25')](function(){return db[_0x1904('0x8e')][_0x1904('0x6a')]({'where':{'teamId':_0x135887}})[_0x1904('0x25')](function(_0x314af9){if(_0x314af9){var _0xce597d=_[_0x1904('0x2b')](_0x5763b9,function(_0x3546c4){db[_0x1904('0x67')][_0x1904('0x89')]({'UserId':_0x3546c4,'VoicePrefixId':_0x314af9['VoicePrefixId']});});return Promise['all'](_0xce597d);}});});});return Promise[_0x1904('0x8d')](_0x5edaee)[_0x1904('0x25')](function(){return _0x215672['addAgents'](_0x5763b9,{'transaction':_0x187e51})[_0x1904('0x8f')](function(_0x1bc93e){return _0x1bc93e;});});});}})[_0x1904('0x25')](respondWithResult(_0x55eb67,null))['catch'](handleError(_0x55eb67,null));};exports['removeAgents']=function(_0x49b886,_0x2ede32){var _0x536830=_[_0x1904('0x77')](_0x49b886[_0x1904('0x32')]['ids'])?_0x49b886[_0x1904('0x32')][_0x1904('0x73')]:[_0x49b886[_0x1904('0x32')][_0x1904('0x73')]];var _0x4a43bf=_0x49b886[_0x1904('0x44')]['id'];return db[_0x1904('0x2c')]['find']({'where':{'id':_0x4a43bf}})[_0x1904('0x25')](handleEntityNotFound(_0x2ede32,null))[_0x1904('0x25')](function(_0x2f629b){if(_0x2f629b){var _0x3f0104=[_0x1904('0x78'),_0x1904('0x79'),_0x1904('0x7a'),'Sms',_0x1904('0x7c'),'Openchannel','Whatsapp'];return db[_0x1904('0x59')][_0x1904('0x52')](function(_0xcc99a5){var _0x1397d5=_[_0x1904('0x2b')](_0x3f0104,function(_0x449fba){var _0x8b970={'attributes':['id',_0x1904('0x28')]};return _0x2f629b['get'+_0x449fba+_0x1904('0x72')](_0x8b970)[_0x1904('0x25')](function(_0x562c52){var _0x4239a7=_[_0x1904('0x2b')](_0x562c52,function(_0x247f6b){return _0x247f6b[_0x1904('0x90')](_0x536830,{'transaction':_0xcc99a5})[_0x1904('0x25')](function(){var _0x317c0b=_['map'](_0x536830,function(_0x21350b){socket[_0x1904('0x83')](_0x1904('0x48')+_0x449fba+_0x1904('0x91'),{'UserId':Number(_0x21350b),[_0x449fba+_0x1904('0x7e')]:_0x247f6b['id']});if(_0x449fba!==_0x1904('0x78')){return;}return db['UserVoiceQueueRt'][_0x1904('0x51')]({'where':{'VoiceQueueId':_0x247f6b['id'],'UserId':_0x21350b},'transaction':_0xcc99a5});});return Promise[_0x1904('0x8d')](_0x317c0b);});});return Promise[_0x1904('0x8d')](_0x4239a7);});});return Promise['all'](_0x1397d5)[_0x1904('0x25')](function(){return _0x2f629b[_0x1904('0x90')](_0x536830,{'transaction':_0xcc99a5});})[_0x1904('0x25')](function(){return db[_0x1904('0x8e')][_0x1904('0x6a')]({'where':{'teamId':_0x4a43bf}})[_0x1904('0x25')](function(_0x29204d){if(_0x29204d){var _0x31ef2c=_['map'](_0x536830,function(_0x28f641){db[_0x1904('0x67')][_0x1904('0x51')]({'where':{'UserId':_0x28f641,'VoicePrefixId':_0x29204d[_0x1904('0x68')]}});});return Promise[_0x1904('0x8d')](_0x31ef2c);}});});});}})[_0x1904('0x25')](respondWithStatusCode(_0x2ede32,null))[_0x1904('0x42')](handleError(_0x2ede32,null));};exports[_0x1904('0x92')]=function(_0xc6612f,_0x4e9ad1,_0x388b15){var _0x34f03d={};var _0x362db7={};var _0x154a51;var _0x5edaed;return db[_0x1904('0x2c')][_0x1904('0x6a')]({'where':{'id':_0xc6612f[_0x1904('0x44')]['id']}})[_0x1904('0x25')](handleEntityNotFound(_0x4e9ad1,null))[_0x1904('0x25')](function(_0x2e75fb){if(_0x2e75fb){_0x154a51=_0x2e75fb;_0x362db7['model']=_[_0x1904('0x45')](db[_0x1904('0x82')][_0x1904('0x2d')]);_0x362db7[_0x1904('0x32')]=_['keys'](_0xc6612f[_0x1904('0x32')]);_0x362db7[_0x1904('0x33')]=_[_0x1904('0x34')](_0x362db7[_0x1904('0x31')],_0x362db7[_0x1904('0x32')]);_0x34f03d[_0x1904('0x35')]=_['intersection'](_0x362db7[_0x1904('0x31')],qs[_0x1904('0x36')](_0xc6612f[_0x1904('0x32')]['fields']));_0x34f03d[_0x1904('0x35')]=_0x34f03d[_0x1904('0x35')][_0x1904('0x37')]?_0x34f03d[_0x1904('0x35')]:_0x362db7[_0x1904('0x31')];_0x34f03d[_0x1904('0x93')]=qs[_0x1904('0x3b')](_0xc6612f[_0x1904('0x32')][_0x1904('0x3b')]);_0x34f03d['where']=qs['filters'](_['pick'](_0xc6612f['query'],_0x362db7[_0x1904('0x33')]));if(_0xc6612f[_0x1904('0x32')][_0x1904('0x3e')]){_0x34f03d[_0x1904('0x3c')]=_[_0x1904('0x3f')](_0x34f03d[_0x1904('0x3c')],{'$or':_['map'](_0x34f03d[_0x1904('0x35')],function(_0x14ea2b){var _0x531e98={};_0x531e98[_0x14ea2b]={'$like':'%'+_0xc6612f[_0x1904('0x32')]['filter']+'%'};return _0x531e98;})});}_0x34f03d=_[_0x1904('0x3f')]({},_0x34f03d,_0xc6612f[_0x1904('0x40')]);return _0x154a51[_0x1904('0x92')](_0x34f03d);}})['then'](function(_0x18df20){if(_0x18df20){_0x5edaed=_0x18df20[_0x1904('0x37')];if(!_0xc6612f[_0x1904('0x32')]['hasOwnProperty'](_0x1904('0x39'))){_0x34f03d[_0x1904('0x3a')]=qs[_0x1904('0x3a')](_0xc6612f[_0x1904('0x32')][_0x1904('0x3a')]);_0x34f03d['offset']=qs['offset'](_0xc6612f[_0x1904('0x32')]['offset']);}return _0x154a51['getAgents'](_0x34f03d);}})[_0x1904('0x25')](function(_0x231917){if(_0x231917){return _0x231917?{'count':_0x5edaed,'rows':_0x231917}:null;}})[_0x1904('0x25')](respondWithResult(_0x4e9ad1,null))[_0x1904('0x42')](handleError(_0x4e9ad1,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 8d3532e..ebab931 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 _0x150b=['../../mysqldb','Team','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xfa89dc,_0x39b916){var _0xa1062b=function(_0x55b002){while(--_0x55b002){_0xfa89dc['push'](_0xfa89dc['shift']());}};_0xa1062b(++_0x39b916);}(_0x150b,0x77));var _0xb150=function(_0x12877b,_0x8650cf){_0x12877b=_0x12877b-0x0;var _0x3549ff=_0x150b[_0x12877b];return _0x3549ff;};'use strict';var EventEmitter=require(_0xb150('0x0'));var Team=require(_0xb150('0x1'))['db'][_0xb150('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb150('0x3'),'afterUpdate':_0xb150('0x4'),'afterDestroy':_0xb150('0x5')};function emitEvent(_0x1a21e5){return function(_0x11314e,_0x3dc656,_0x571218){TeamEvents['emit'](_0x1a21e5+':'+_0x11314e['id'],_0x11314e);TeamEvents[_0xb150('0x6')](_0x1a21e5,_0x11314e);_0x571218(null);};}for(var e in events){if(events[_0xb150('0x7')](e)){var event=events[e];Team[_0xb150('0x8')](e,emitEvent(event));}}module[_0xb150('0x9')]=TeamEvents; \ No newline at end of file +var _0x5692=['save','update','emit','hasOwnProperty','exports','events','Team','setMaxListeners'];(function(_0x4f8e2e,_0x2e6f92){var _0x4cdb7f=function(_0xd97262){while(--_0xd97262){_0x4f8e2e['push'](_0x4f8e2e['shift']());}};_0x4cdb7f(++_0x2e6f92);}(_0x5692,0xe5));var _0x2569=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5692[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x2569('0x0'));var Team=require('../../mysqldb')['db'][_0x2569('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x2569('0x2')](0x0);var events={'afterCreate':_0x2569('0x3'),'afterUpdate':_0x2569('0x4'),'afterDestroy':'remove'};function emitEvent(_0x361d2b){return function(_0x38bedd,_0x47370e,_0x3db82a){TeamEvents[_0x2569('0x5')](_0x361d2b+':'+_0x38bedd['id'],_0x38bedd);TeamEvents[_0x2569('0x5')](_0x361d2b,_0x38bedd);_0x3db82a(null);};}for(var e in events){if(events[_0x2569('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x2569('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index a84baf0..d8aef9c 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 _0xcdf1=['exports','Team','teams','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x214593,_0x37e1f5){var _0x3f0730=function(_0x338f04){while(--_0x338f04){_0x214593['push'](_0x214593['shift']());}};_0x3f0730(++_0x37e1f5);}(_0xcdf1,0x189));var _0x1cdf=function(_0x18bb08,_0x552862){_0x18bb08=_0x18bb08-0x0;var _0x13df54=_0xcdf1[_0x18bb08];return _0x13df54;};'use strict';var _=require(_0x1cdf('0x0'));var util=require(_0x1cdf('0x1'));var logger=require(_0x1cdf('0x2'))(_0x1cdf('0x3'));var moment=require(_0x1cdf('0x4'));var BPromise=require(_0x1cdf('0x5'));var rp=require(_0x1cdf('0x6'));var fs=require('fs');var path=require(_0x1cdf('0x7'));var rimraf=require(_0x1cdf('0x8'));var config=require(_0x1cdf('0x9'));var attributes=require('./team.attributes');module[_0x1cdf('0xa')]=function(_0x4b395e,_0x5d0e46){return _0x4b395e['define'](_0x1cdf('0xb'),attributes,{'tableName':_0x1cdf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec08=['../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x19fefb,_0x175eed){var _0x3c7f34=function(_0xfd9b43){while(--_0xfd9b43){_0x19fefb['push'](_0x19fefb['shift']());}};_0x3c7f34(++_0x175eed);}(_0xec08,0x1f0));var _0x8ec0=function(_0x40c19a,_0xa3ac5a){_0x40c19a=_0x40c19a-0x0;var _0x58ef06=_0xec08[_0x40c19a];return _0x58ef06;};'use strict';var _=require(_0x8ec0('0x0'));var util=require(_0x8ec0('0x1'));var logger=require(_0x8ec0('0x2'))('api');var moment=require(_0x8ec0('0x3'));var BPromise=require(_0x8ec0('0x4'));var rp=require(_0x8ec0('0x5'));var fs=require('fs');var path=require(_0x8ec0('0x6'));var rimraf=require(_0x8ec0('0x7'));var config=require(_0x8ec0('0x8'));var attributes=require(_0x8ec0('0x9'));module[_0x8ec0('0xa')]=function(_0x302a11,_0x4d1ed6){return _0x302a11[_0x8ec0('0xb')](_0x8ec0('0xc'),attributes,{'tableName':_0x8ec0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 9c34fbb..fbd807d 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 _0x86e2=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','../../config/utils','../../config/logger'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x86e2,0x13d));var _0x286e=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0x86e2[_0x3e2fcf];return _0x497db7;};'use strict';var _=require(_0x286e('0x0'));var util=require(_0x286e('0x1'));var moment=require(_0x286e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x286e('0x3'));var logger=require(_0x286e('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x286e('0x5')][_0x286e('0x6')]({'port':0x232a});config[_0x286e('0x7')]=_[_0x286e('0x8')](config[_0x286e('0x7')],{'host':_0x286e('0x9'),'port':0x18eb});var socket=require(_0x286e('0xa'))(new Redis(config[_0x286e('0x7')]));require('./team.socket')[_0x286e('0xb')](socket);function respondWithRpcPromise(_0x3009f8,_0x1fd59c,_0x44429d){return new BPromise(function(_0x3eb451,_0x2bb5db){return client[_0x286e('0xc')](_0x3009f8,_0x44429d)['then'](function(_0x494832){logger['info'](_0x286e('0xd'),_0x1fd59c,_0x286e('0xe'));logger[_0x286e('0xf')](_0x286e('0x10'),_0x1fd59c,'request\x20sent',JSON[_0x286e('0x11')](_0x494832));if(_0x494832['error']){if(_0x494832[_0x286e('0x12')][_0x286e('0x13')]===0x1f4){logger[_0x286e('0x12')]('Team,\x20%s,\x20%s',_0x1fd59c,_0x494832['error']['message']);return _0x2bb5db(_0x494832[_0x286e('0x12')][_0x286e('0x14')]);}logger['error'](_0x286e('0xd'),_0x1fd59c,_0x494832['error'][_0x286e('0x14')]);return _0x3eb451(_0x494832[_0x286e('0x12')][_0x286e('0x14')]);}else{logger[_0x286e('0x15')]('Team,\x20%s,\x20%s',_0x1fd59c,'request\x20sent');_0x3eb451(_0x494832['result'][_0x286e('0x14')]);}})[_0x286e('0x16')](function(_0x190b05){logger['error'](_0x286e('0xd'),_0x1fd59c,_0x190b05);_0x2bb5db(_0x190b05);});});} \ No newline at end of file +var _0x1734=['info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./team.socket','then'];(function(_0x30599b,_0x40c0e8){var _0x330496=function(_0x202f15){while(--_0x202f15){_0x30599b['push'](_0x30599b['shift']());}};_0x330496(++_0x40c0e8);}(_0x1734,0xe3));var _0x4173=function(_0x534f4e,_0x176ac4){_0x534f4e=_0x534f4e-0x0;var _0x5ab2b8=_0x1734[_0x534f4e];return _0x5ab2b8;};'use strict';var _=require(_0x4173('0x0'));var util=require(_0x4173('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4173('0x2'));var db=require(_0x4173('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4173('0x4'))(_0x4173('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4173('0x6')]({'port':0x232a});config[_0x4173('0x7')]=_[_0x4173('0x8')](config[_0x4173('0x7')],{'host':_0x4173('0x9'),'port':0x18eb});var socket=require(_0x4173('0xa'))(new Redis(config[_0x4173('0x7')]));require(_0x4173('0xb'))['register'](socket);function respondWithRpcPromise(_0x333afa,_0x2c936b,_0x431d5c){return new BPromise(function(_0x445111,_0xe53dd8){return client['request'](_0x333afa,_0x431d5c)[_0x4173('0xc')](function(_0x57e3ee){logger[_0x4173('0xd')](_0x4173('0xe'),_0x2c936b,_0x4173('0xf'));logger[_0x4173('0x10')](_0x4173('0x11'),_0x2c936b,'request\x20sent',JSON[_0x4173('0x12')](_0x57e3ee));if(_0x57e3ee[_0x4173('0x13')]){if(_0x57e3ee[_0x4173('0x13')][_0x4173('0x14')]===0x1f4){logger[_0x4173('0x13')](_0x4173('0xe'),_0x2c936b,_0x57e3ee[_0x4173('0x13')][_0x4173('0x15')]);return _0xe53dd8(_0x57e3ee['error'][_0x4173('0x15')]);}logger['error'](_0x4173('0xe'),_0x2c936b,_0x57e3ee[_0x4173('0x13')]['message']);return _0x445111(_0x57e3ee[_0x4173('0x13')][_0x4173('0x15')]);}else{logger[_0x4173('0xd')]('Team,\x20%s,\x20%s',_0x2c936b,_0x4173('0xf'));_0x445111(_0x57e3ee[_0x4173('0x16')][_0x4173('0x15')]);}})[_0x4173('0x17')](function(_0x19a815){logger[_0x4173('0x13')]('Team,\x20%s,\x20%s',_0x2c936b,_0x19a815);_0xe53dd8(_0x19a815);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index bc2b953..9680623 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 _0xf87a=['./team.events','save','remove','emit','register','length','team:'];(function(_0x45f2e5,_0x51714c){var _0xb52bc=function(_0x640bee){while(--_0x640bee){_0x45f2e5['push'](_0x45f2e5['shift']());}};_0xb52bc(++_0x51714c);}(_0xf87a,0x103));var _0xaf87=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf87a[_0x17d9e3];return _0x14192d;};'use strict';var TeamEvents=require(_0xaf87('0x0'));var events=[_0xaf87('0x1'),_0xaf87('0x2'),'update'];function createListener(_0x5d8416,_0x510091){return function(_0x458df5){_0x510091[_0xaf87('0x3')](_0x5d8416,_0x458df5);};}function removeListener(_0x9d5742,_0x297e63){return function(){TeamEvents['removeListener'](_0x9d5742,_0x297e63);};}exports[_0xaf87('0x4')]=function(_0x22fd9a){for(var _0x1e2578=0x0,_0x3aeb01=events[_0xaf87('0x5')];_0x1e2578<_0x3aeb01;_0x1e2578++){var _0x2692f1=events[_0x1e2578];var _0x349095=createListener(_0xaf87('0x6')+_0x2692f1,_0x22fd9a);TeamEvents['on'](_0x2692f1,_0x349095);}}; \ No newline at end of file +var _0x9189=['remove','update','emit','removeListener','register','length'];(function(_0x561895,_0x4b2141){var _0x2b3134=function(_0x5d832a){while(--_0x5d832a){_0x561895['push'](_0x561895['shift']());}};_0x2b3134(++_0x4b2141);}(_0x9189,0x1b0));var _0x9918=function(_0x273b1f,_0x2df9eb){_0x273b1f=_0x273b1f-0x0;var _0x167f72=_0x9189[_0x273b1f];return _0x167f72;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x9918('0x0'),_0x9918('0x1')];function createListener(_0x27ad29,_0x204232){return function(_0x56e470){_0x204232[_0x9918('0x2')](_0x27ad29,_0x56e470);};}function removeListener(_0x568567,_0x4cb5a2){return function(){TeamEvents[_0x9918('0x3')](_0x568567,_0x4cb5a2);};}exports[_0x9918('0x4')]=function(_0x4a47d4){for(var _0x3ba4a8=0x0,_0x3cb556=events[_0x9918('0x5')];_0x3ba4a8<_0x3cb556;_0x3ba4a8++){var _0x5c926e=events[_0x3ba4a8];var _0x5a0552=createListener('team:'+_0x5c926e,_0x4a47d4);TeamEvents['on'](_0x5c926e,_0x5a0552);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 1559a13..8f85035 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 _0x55e0=['INTEGER','sequelize','exports'];(function(_0x5e70d9,_0x56a7cc){var _0x268845=function(_0x64296e){while(--_0x64296e){_0x5e70d9['push'](_0x5e70d9['shift']());}};_0x268845(++_0x56a7cc);}(_0x55e0,0xdc));var _0x055e=function(_0x1c289a,_0x277fe7){_0x1c289a=_0x1c289a-0x0;var _0x28d68e=_0x55e0[_0x1c289a];return _0x28d68e;};'use strict';var Sequelize=require(_0x055e('0x0'));module[_0x055e('0x1')]={'TeamId':{'type':Sequelize[_0x055e('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x055e('0x2')]}}; \ No newline at end of file +var _0xb59c=['sequelize','exports','INTEGER'];(function(_0x2e06cf,_0x33cec2){var _0x36199d=function(_0x2f130a){while(--_0x2f130a){_0x2e06cf['push'](_0x2e06cf['shift']());}};_0x36199d(++_0x33cec2);}(_0xb59c,0x10b));var _0xcb59=function(_0x4533d9,_0x2a98b9){_0x4533d9=_0x4533d9-0x0;var _0x3ae99a=_0xb59c[_0x4533d9];return _0x3ae99a;};'use strict';var Sequelize=require(_0xcb59('0x0'));module[_0xcb59('0x1')]={'TeamId':{'type':Sequelize[_0xcb59('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 942b67a..f500132 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 _0x584a=['api','moment','bluebird','request-promise','../../config/environment','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x584a,0x1c0));var _0xa584=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0x584a[_0x3cbe1c];return _0x5ee08b;};'use strict';var _=require(_0xa584('0x0'));var util=require(_0xa584('0x1'));var logger=require('../../config/logger')(_0xa584('0x2'));var moment=require(_0xa584('0x3'));var BPromise=require(_0xa584('0x4'));var rp=require(_0xa584('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa584('0x6'));var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x4a36d6,_0x263112){return _0x4a36d6['define'](_0xa584('0x7'),attributes,{'tableName':_0xa584('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbde=['moment','bluebird','request-promise','../../config/environment','./teamVoicePrefix.attributes','team_has_voice_prefixes','lodash','../../config/logger','api'];(function(_0xc2cd00,_0x2a3745){var _0x250d23=function(_0x39739f){while(--_0x39739f){_0xc2cd00['push'](_0xc2cd00['shift']());}};_0x250d23(++_0x2a3745);}(_0xcbde,0x141));var _0xecbd=function(_0x227bad,_0x322f45){_0x227bad=_0x227bad-0x0;var _0x1eb626=_0xcbde[_0x227bad];return _0x1eb626;};'use strict';var _=require(_0xecbd('0x0'));var util=require('util');var logger=require(_0xecbd('0x1'))(_0xecbd('0x2'));var moment=require(_0xecbd('0x3'));var BPromise=require(_0xecbd('0x4'));var rp=require(_0xecbd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xecbd('0x6'));var attributes=require(_0xecbd('0x7'));module['exports']=function(_0x25b899,_0x27a04d){return _0x25b899['define']('TeamVoicePrefix',attributes,{'tableName':_0xecbd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index c9654ea..9b0cf76 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3d7b10,_0xd2136c){var _0x3e7f17=function(_0x1d556e){while(--_0x1d556e){_0x3d7b10['push'](_0x3d7b10['shift']());}};_0x3e7f17(++_0xd2136c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0xcb91[_0x519756];return _0x37047e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x435e64,_0x26780f){var _0x1281c8=function(_0x363aba){while(--_0x363aba){_0x435e64['push'](_0x435e64['shift']());}};_0x1281c8(++_0x26780f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index ca7bcb9..69e2eef 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 _0xc84b=['sequelize','exports','INTEGER'];(function(_0x248905,_0x45792b){var _0x30fb64=function(_0x14e892){while(--_0x14e892){_0x248905['push'](_0x248905['shift']());}};_0x30fb64(++_0x45792b);}(_0xc84b,0x18c));var _0xbc84=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0xc84b[_0x173f10];return _0x53142d;};'use strict';var Sequelize=require(_0xbc84('0x0'));module[_0xbc84('0x1')]={'penalty':{'type':Sequelize[_0xbc84('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3cb0=['INTEGER','exports'];(function(_0xe0b6b8,_0x442384){var _0x353d90=function(_0x1429e1){while(--_0x1429e1){_0xe0b6b8['push'](_0xe0b6b8['shift']());}};_0x353d90(++_0x442384);}(_0x3cb0,0x123));var _0x03cb=function(_0xbe08b1,_0x5678f6){_0xbe08b1=_0xbe08b1-0x0;var _0x12109d=_0x3cb0[_0xbe08b1];return _0x12109d;};'use strict';var Sequelize=require('sequelize');module[_0x03cb('0x0')]={'penalty':{'type':Sequelize[_0x03cb('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index adfaed3..19cfeb4 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 _0x4f5d=['define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x573240,_0x35d274){var _0x3fc141=function(_0x2435dc){while(--_0x2435dc){_0x573240['push'](_0x573240['shift']());}};_0x3fc141(++_0x35d274);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x4f5d[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xd4f5('0x0'));var util=require(_0xd4f5('0x1'));var logger=require(_0xd4f5('0x2'))(_0xd4f5('0x3'));var moment=require(_0xd4f5('0x4'));var BPromise=require(_0xd4f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4f5('0x6'));var rimraf=require(_0xd4f5('0x7'));var config=require(_0xd4f5('0x8'));var attributes=require(_0xd4f5('0x9'));module[_0xd4f5('0xa')]=function(_0x2c44bb,_0x121bfd){return _0x2c44bb[_0xd4f5('0xb')](_0xd4f5('0xc'),attributes,{'tableName':_0xd4f5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee24=['TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports','define'];(function(_0x3b71c0,_0x4046ba){var _0x1269b9=function(_0x2b9e2f){while(--_0x2b9e2f){_0x3b71c0['push'](_0x3b71c0['shift']());}};_0x1269b9(++_0x4046ba);}(_0xee24,0x1a6));var _0x4ee2=function(_0x1cb279,_0x5481b8){_0x1cb279=_0x1cb279-0x0;var _0x592903=_0xee24[_0x1cb279];return _0x592903;};'use strict';var _=require('lodash');var util=require(_0x4ee2('0x0'));var logger=require(_0x4ee2('0x1'))('api');var moment=require(_0x4ee2('0x2'));var BPromise=require(_0x4ee2('0x3'));var rp=require(_0x4ee2('0x4'));var fs=require('fs');var path=require(_0x4ee2('0x5'));var rimraf=require('rimraf');var config=require(_0x4ee2('0x6'));var attributes=require(_0x4ee2('0x7'));module[_0x4ee2('0x8')]=function(_0x1993de,_0x5c778f){return _0x1993de[_0x4ee2('0x9')](_0x4ee2('0xa'),attributes,{'tableName':_0x4ee2('0xb'),'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 ade0562..d9ecc19 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 _0x93dc=['bluebird','randomstring','ioredis','../../mysqldb','rpc','client','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x546355,_0x2aedec){var _0x1e5cb3=function(_0x15cd7b){while(--_0x15cd7b){_0x546355['push'](_0x546355['shift']());}};_0x1e5cb3(++_0x2aedec);}(_0x93dc,0x90));var _0xc93d=function(_0x36a9e9,_0xc53bc6){_0x36a9e9=_0x36a9e9-0x0;var _0x4ac1c0=_0x93dc[_0x36a9e9];return _0x4ac1c0;};'use strict';var _=require(_0xc93d('0x0'));var util=require(_0xc93d('0x1'));var moment=require(_0xc93d('0x2'));var BPromise=require(_0xc93d('0x3'));var rs=require(_0xc93d('0x4'));var fs=require('fs');var Redis=require(_0xc93d('0x5'));var db=require(_0xc93d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc93d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc93d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a48e0,_0x555932,_0x2e4612){return new BPromise(function(_0x1b37f0,_0x13c794){return client['request'](_0x3a48e0,_0x2e4612)[_0xc93d('0x9')](function(_0xc58fca){logger[_0xc93d('0xa')](_0xc93d('0xb'),_0x555932,_0xc93d('0xc'));logger[_0xc93d('0xd')](_0xc93d('0xe'),_0x555932,_0xc93d('0xc'),JSON[_0xc93d('0xf')](_0xc58fca));if(_0xc58fca['error']){if(_0xc58fca[_0xc93d('0x10')][_0xc93d('0x11')]===0x1f4){logger[_0xc93d('0x10')](_0xc93d('0xb'),_0x555932,_0xc58fca[_0xc93d('0x10')][_0xc93d('0x12')]);return _0x13c794(_0xc58fca[_0xc93d('0x10')]['message']);}logger['error'](_0xc93d('0xb'),_0x555932,_0xc58fca['error'][_0xc93d('0x12')]);return _0x1b37f0(_0xc58fca['error'][_0xc93d('0x12')]);}else{logger[_0xc93d('0xa')](_0xc93d('0xb'),_0x555932,_0xc93d('0xc'));_0x1b37f0(_0xc58fca[_0xc93d('0x13')][_0xc93d('0x12')]);}})[_0xc93d('0x14')](function(_0x37b60c){logger[_0xc93d('0x10')](_0xc93d('0xb'),_0x555932,_0x37b60c);_0x13c794(_0x37b60c);});});} \ No newline at end of file +var _0x47c1=['message','info','TeamVoiceQueue,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3c957d,_0x40d8f3){var _0x46ab64=function(_0x470663){while(--_0x470663){_0x3c957d['push'](_0x3c957d['shift']());}};_0x46ab64(++_0x40d8f3);}(_0x47c1,0x14d));var _0x147c=function(_0x5b987d,_0x24a344){_0x5b987d=_0x5b987d-0x0;var _0x282e0d=_0x47c1[_0x5b987d];return _0x282e0d;};'use strict';var _=require(_0x147c('0x0'));var util=require('util');var moment=require(_0x147c('0x1'));var BPromise=require(_0x147c('0x2'));var rs=require(_0x147c('0x3'));var fs=require('fs');var Redis=require(_0x147c('0x4'));var db=require(_0x147c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x147c('0x6'))(_0x147c('0x7'));var config=require(_0x147c('0x8'));var jayson=require(_0x147c('0x9'));var client=jayson[_0x147c('0xa')][_0x147c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41e4a6,_0x3d881d,_0x3a0b23){return new BPromise(function(_0x6dbf79,_0x194ae3){return client[_0x147c('0xc')](_0x41e4a6,_0x3a0b23)[_0x147c('0xd')](function(_0x4ddeed){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x3d881d,'request\x20sent');logger[_0x147c('0xe')](_0x147c('0xf'),_0x3d881d,_0x147c('0x10'),JSON[_0x147c('0x11')](_0x4ddeed));if(_0x4ddeed[_0x147c('0x12')]){if(_0x4ddeed[_0x147c('0x12')]['code']===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x3d881d,_0x4ddeed['error'][_0x147c('0x13')]);return _0x194ae3(_0x4ddeed[_0x147c('0x12')]['message']);}logger[_0x147c('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3d881d,_0x4ddeed[_0x147c('0x12')][_0x147c('0x13')]);return _0x6dbf79(_0x4ddeed[_0x147c('0x12')][_0x147c('0x13')]);}else{logger[_0x147c('0x14')](_0x147c('0x15'),_0x3d881d,_0x147c('0x10'));_0x6dbf79(_0x4ddeed['result'][_0x147c('0x13')]);}})['catch'](function(_0x41a88f){logger[_0x147c('0x12')](_0x147c('0x15'),_0x3d881d,_0x41a88f);_0x194ae3(_0x41a88f);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index aa2eeee..051810e 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 _0xb515=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x29cc45,_0x1e2faf){var _0x35fee1=function(_0x469a58){while(--_0x469a58){_0x29cc45['push'](_0x29cc45['shift']());}};_0x35fee1(++_0x1e2faf);}(_0xb515,0x1b8));var _0x5b51=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0xb515[_0x5ef905];return _0x367808;};'use strict';var multer=require(_0x5b51('0x0'));var util=require('util');var path=require(_0x5b51('0x1'));var timeout=require(_0x5b51('0x2'));var express=require(_0x5b51('0x3'));var router=express[_0x5b51('0x4')]();var fs_extra=require(_0x5b51('0x5'));var auth=require(_0x5b51('0x6'));var interaction=require(_0x5b51('0x7'));var config=require(_0x5b51('0x8'));var controller=require('./template.controller');router[_0x5b51('0x9')]('/',auth[_0x5b51('0xa')](),controller[_0x5b51('0xb')]);router[_0x5b51('0x9')](_0x5b51('0xc'),auth[_0x5b51('0xa')](),controller[_0x5b51('0xd')]);router[_0x5b51('0xe')]('/',auth[_0x5b51('0xa')](),controller[_0x5b51('0xf')]);router[_0x5b51('0x10')](_0x5b51('0xc'),auth['isAuthenticated'](),controller[_0x5b51('0x11')]);router[_0x5b51('0x12')](_0x5b51('0xc'),auth[_0x5b51('0xa')](),controller[_0x5b51('0x13')]);module[_0x5b51('0x14')]=router; \ No newline at end of file +var _0x0755=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','put','update','destroy','exports','multer','util'];(function(_0x7e93d8,_0x463a87){var _0x55b61f=function(_0x26be94){while(--_0x26be94){_0x7e93d8['push'](_0x7e93d8['shift']());}};_0x55b61f(++_0x463a87);}(_0x0755,0x7c));var _0x5075=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0x0755[_0x20fdc1];return _0x25397c;};'use strict';var multer=require(_0x5075('0x0'));var util=require(_0x5075('0x1'));var path=require(_0x5075('0x2'));var timeout=require(_0x5075('0x3'));var express=require(_0x5075('0x4'));var router=express[_0x5075('0x5')]();var fs_extra=require(_0x5075('0x6'));var auth=require(_0x5075('0x7'));var interaction=require(_0x5075('0x8'));var config=require(_0x5075('0x9'));var controller=require('./template.controller');router[_0x5075('0xa')]('/',auth[_0x5075('0xb')](),controller[_0x5075('0xc')]);router[_0x5075('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5075('0xd')]('/',auth[_0x5075('0xb')](),controller['create']);router[_0x5075('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5075('0xf')]);router['delete']('/:id',auth[_0x5075('0xb')](),controller[_0x5075('0x10')]);module[_0x5075('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 214f501..7b5c0ff 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 _0xf536=['STRING','exports'];(function(_0x1d5ff8,_0x1ae2e7){var _0x19445a=function(_0x40d51d){while(--_0x40d51d){_0x1d5ff8['push'](_0x1d5ff8['shift']());}};_0x19445a(++_0x1ae2e7);}(_0xf536,0x1ef));var _0x6f53=function(_0x2f4d41,_0x525047){_0x2f4d41=_0x2f4d41-0x0;var _0x3b0bb2=_0xf536[_0x2f4d41];return _0x3b0bb2;};'use strict';var Sequelize=require('sequelize');module[_0x6f53('0x0')]={'name':{'type':Sequelize[_0x6f53('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xa3bd=['sequelize','exports','TEXT'];(function(_0x25a6b7,_0x30503d){var _0x1309e8=function(_0x40d543){while(--_0x40d543){_0x25a6b7['push'](_0x25a6b7['shift']());}};_0x1309e8(++_0x30503d);}(_0xa3bd,0xd5));var _0xda3b=function(_0x5057a7,_0x36dc09){_0x5057a7=_0x5057a7-0x0;var _0x476e22=_0xa3bd[_0x5057a7];return _0x476e22;};'use strict';var Sequelize=require(_0xda3b('0x0'));module[_0xda3b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xda3b('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index c0158fa..7f75089 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 _0x6936=['reject','update','destroy','get','UserProfileResource','then','error','stack','name','send','index','map','Template','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','user','role','Templates','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','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','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0x6936,0x1bd));var _0x6693=function(_0x51b2f0,_0x82be9a){_0x51b2f0=_0x51b2f0-0x0;var _0x404ee3=_0x6936[_0x51b2f0];return _0x404ee3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6693('0x0'));var zipdir=require(_0x6693('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6693('0x2'));var moment=require(_0x6693('0x3'));var BPromise=require(_0x6693('0x4'));var Mustache=require('mustache');var util=require(_0x6693('0x5'));var path=require(_0x6693('0x6'));var sox=require(_0x6693('0x7'));var csv=require(_0x6693('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6693('0x9'));var squel=require('squel');var crypto=require(_0x6693('0xa'));var jsforce=require(_0x6693('0xb'));var deskjs=require(_0x6693('0xc'));var toCsv=require(_0x6693('0x8'));var querystring=require(_0x6693('0xd'));var Papa=require(_0x6693('0xe'));var Redis=require(_0x6693('0xf'));var authService=require(_0x6693('0x10'));var qs=require(_0x6693('0x11'));var as=require(_0x6693('0x12'));var hardwareService=require(_0x6693('0x13'));var logger=require(_0x6693('0x14'))(_0x6693('0x15'));var utils=require(_0x6693('0x16'));var config=require(_0x6693('0x17'));var licenseUtil=require(_0x6693('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x327fa3,_0x33ca80){_0x33ca80=_0x33ca80||0xcc;return function(_0x508108){if(_0x508108){return _0x327fa3[_0x6693('0x19')](_0x33ca80);}return _0x327fa3[_0x6693('0x1a')](_0x33ca80)[_0x6693('0x1b')]();};}function respondWithResult(_0xf6cfcc,_0x398bfb){_0x398bfb=_0x398bfb||0xc8;return function(_0x4ab87f){if(_0x4ab87f){return _0xf6cfcc[_0x6693('0x1a')](_0x398bfb)[_0x6693('0x1c')](_0x4ab87f);}};}function respondWithFilteredResult(_0x3f66b0,_0x333777){return function(_0x5d7b93){if(_0x5d7b93){var _0x5780c7=typeof _0x333777['offset']===_0x6693('0x1d')&&typeof _0x333777[_0x6693('0x1e')]===_0x6693('0x1d');var _0x39f8e4=_0x5d7b93[_0x6693('0x1f')];var _0x9b327c=_0x5780c7?0x0:_0x333777[_0x6693('0x20')];var _0x320d25=_0x5780c7?_0x5d7b93[_0x6693('0x1f')]:_0x333777['offset']+_0x333777[_0x6693('0x1e')];var _0x436c3f;if(_0x320d25>=_0x39f8e4){_0x320d25=_0x39f8e4;_0x436c3f=0xc8;}else{_0x436c3f=0xce;}_0x3f66b0[_0x6693('0x1a')](_0x436c3f);return _0x3f66b0[_0x6693('0x21')](_0x6693('0x22'),_0x9b327c+'-'+_0x320d25+'/'+_0x39f8e4)[_0x6693('0x1c')](_0x5d7b93);}return null;};}function patchUpdates(_0x319c49){return function(_0x5e16c8){try{jsonpatch['apply'](_0x5e16c8,_0x319c49,!![]);}catch(_0x2921b1){return BPromise[_0x6693('0x23')](_0x2921b1);}return _0x5e16c8['save']();};}function saveUpdates(_0x26662e,_0x17fb71){return function(_0x170ae6){if(_0x170ae6){return _0x170ae6[_0x6693('0x24')](_0x26662e)['then'](function(_0x33f8ad){return _0x33f8ad;});}return null;};}function removeEntity(_0x9a7e19,_0x717c5e){return function(_0x425da8){if(_0x425da8){return _0x425da8[_0x6693('0x25')]()['then'](function(){var _0x4ec11c=_0x425da8[_0x6693('0x26')]({'plain':!![]});var _0x502cc6='Templates';return db[_0x6693('0x27')][_0x6693('0x25')]({'where':{'type':_0x502cc6,'resourceId':_0x4ec11c['id']}})[_0x6693('0x28')](function(){return _0x425da8;});})['then'](function(){_0x9a7e19[_0x6693('0x1a')](0xcc)[_0x6693('0x1b')]();});}};}function handleEntityNotFound(_0x58f38d,_0x2a9e13){return function(_0x581db7){if(!_0x581db7){_0x58f38d[_0x6693('0x19')](0x194);}return _0x581db7;};}function handleError(_0x4210c2,_0x36596f){_0x36596f=_0x36596f||0x1f4;return function(_0x3cf0da){logger[_0x6693('0x29')](_0x3cf0da[_0x6693('0x2a')]);if(_0x3cf0da['name']){delete _0x3cf0da[_0x6693('0x2b')];}_0x4210c2[_0x6693('0x1a')](_0x36596f)[_0x6693('0x2c')](_0x3cf0da);};}exports[_0x6693('0x2d')]=function(_0x1e3eca,_0x2ed490){var _0x1e9759={},_0x8a296={},_0x15c40e={'count':0x0,'rows':[]};var _0x5bc60e=_[_0x6693('0x2e')](db[_0x6693('0x2f')][_0x6693('0x30')],function(_0x22c56b){return{'name':_0x22c56b['fieldName'],'type':_0x22c56b[_0x6693('0x31')][_0x6693('0x32')]};});_0x8a296['model']=_[_0x6693('0x2e')](_0x5bc60e,_0x6693('0x2b'));_0x8a296[_0x6693('0x33')]=_[_0x6693('0x34')](_0x1e3eca[_0x6693('0x33')]);_0x8a296[_0x6693('0x35')]=_['intersection'](_0x8a296['model'],_0x8a296['query']);_0x1e9759[_0x6693('0x36')]=_[_0x6693('0x37')](_0x8a296[_0x6693('0x38')],qs[_0x6693('0x39')](_0x1e3eca[_0x6693('0x33')][_0x6693('0x39')]));_0x1e9759['attributes']=_0x1e9759['attributes']['length']?_0x1e9759[_0x6693('0x36')]:_0x8a296[_0x6693('0x38')];if(!_0x1e3eca[_0x6693('0x33')]['hasOwnProperty']('nolimit')){_0x1e9759[_0x6693('0x1e')]=qs[_0x6693('0x1e')](_0x1e3eca[_0x6693('0x33')][_0x6693('0x1e')]);_0x1e9759[_0x6693('0x20')]=qs[_0x6693('0x20')](_0x1e3eca[_0x6693('0x33')]['offset']);}_0x1e9759[_0x6693('0x3a')]=qs[_0x6693('0x3b')](_0x1e3eca[_0x6693('0x33')]['sort']);_0x1e9759['where']=qs[_0x6693('0x35')](_['pick'](_0x1e3eca['query'],_0x8a296['filters']),_0x5bc60e);if(_0x1e3eca[_0x6693('0x33')][_0x6693('0x3c')]){_0x1e9759[_0x6693('0x3d')]=_[_0x6693('0x3e')](_0x1e9759[_0x6693('0x3d')],{'$or':_['map'](_0x5bc60e,function(_0x3fbaf3){if(_0x3fbaf3['type']!==_0x6693('0x3f')){var _0x4d9262={};_0x4d9262[_0x3fbaf3[_0x6693('0x2b')]]={'$like':'%'+_0x1e3eca[_0x6693('0x33')][_0x6693('0x3c')]+'%'};return _0x4d9262;}})});}_0x1e9759=_['merge']({},_0x1e9759,_0x1e3eca[_0x6693('0x40')]);var _0x1c890b={'where':_0x1e9759[_0x6693('0x3d')]};return db[_0x6693('0x2f')][_0x6693('0x1f')](_0x1c890b)[_0x6693('0x28')](function(_0x19df91){_0x15c40e['count']=_0x19df91;if(_0x1e3eca[_0x6693('0x33')]['includeAll']){_0x1e9759[_0x6693('0x41')]=[{'all':!![]}];}return db[_0x6693('0x2f')][_0x6693('0x42')](_0x1e9759);})[_0x6693('0x28')](function(_0x5c74f1){_0x15c40e[_0x6693('0x43')]=_0x5c74f1;return _0x15c40e;})[_0x6693('0x28')](respondWithFilteredResult(_0x2ed490,_0x1e9759))[_0x6693('0x44')](handleError(_0x2ed490,null));};exports[_0x6693('0x45')]=function(_0x500485,_0x2bd1e4){var _0x566d14={'raw':!![],'where':{'id':_0x500485[_0x6693('0x46')]['id']}},_0x509078={};_0x509078['model']=_['keys'](db[_0x6693('0x2f')][_0x6693('0x30')]);_0x509078['query']=_['keys'](_0x500485[_0x6693('0x33')]);_0x509078[_0x6693('0x35')]=_['intersection'](_0x509078[_0x6693('0x38')],_0x509078[_0x6693('0x33')]);_0x566d14[_0x6693('0x36')]=_[_0x6693('0x37')](_0x509078[_0x6693('0x38')],qs[_0x6693('0x39')](_0x500485[_0x6693('0x33')][_0x6693('0x39')]));_0x566d14[_0x6693('0x36')]=_0x566d14[_0x6693('0x36')]['length']?_0x566d14[_0x6693('0x36')]:_0x509078[_0x6693('0x38')];if(_0x500485[_0x6693('0x33')]['includeAll']){_0x566d14[_0x6693('0x41')]=[{'all':!![]}];}_0x566d14=_[_0x6693('0x3e')]({},_0x566d14,_0x500485[_0x6693('0x40')]);return db[_0x6693('0x2f')][_0x6693('0x47')](_0x566d14)[_0x6693('0x28')](handleEntityNotFound(_0x2bd1e4,null))[_0x6693('0x28')](respondWithResult(_0x2bd1e4,null))['catch'](handleError(_0x2bd1e4,null));};exports['create']=function(_0x3e72fc,_0x479ea8){return db[_0x6693('0x2f')][_0x6693('0x48')](_0x3e72fc[_0x6693('0x49')],{})[_0x6693('0x28')](function(_0x40eb46){var _0x2382b6=_0x3e72fc[_0x6693('0x4a')]['get']({'plain':!![]});if(!_0x2382b6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2382b6[_0x6693('0x4b')]===_0x6693('0x4a')){var _0x623c9a=_0x40eb46['get']({'plain':!![]});var _0x3a8693=_0x6693('0x4c');return db['UserProfileSection'][_0x6693('0x47')]({'where':{'name':_0x3a8693,'userProfileId':_0x2382b6[_0x6693('0x4d')]},'raw':!![]})['then'](function(_0x57030d){if(_0x57030d&&_0x57030d[_0x6693('0x4e')]===0x0){return db[_0x6693('0x27')]['create']({'name':_0x623c9a[_0x6693('0x2b')],'resourceId':_0x623c9a['id'],'type':_0x57030d['name'],'sectionId':_0x57030d['id']},{})['then'](function(){return _0x40eb46;});}else{return _0x40eb46;}})[_0x6693('0x44')](function(_0x509f94){logger[_0x6693('0x29')](_0x6693('0x4f'),_0x509f94);throw _0x509f94;});}return _0x40eb46;})[_0x6693('0x28')](respondWithResult(_0x479ea8,0xc9))[_0x6693('0x44')](handleError(_0x479ea8,null));};exports[_0x6693('0x24')]=function(_0x2a25a5,_0x59cc5c){if(_0x2a25a5[_0x6693('0x49')]['id']){delete _0x2a25a5[_0x6693('0x49')]['id'];}return db[_0x6693('0x2f')][_0x6693('0x47')]({'where':{'id':_0x2a25a5[_0x6693('0x46')]['id']}})['then'](handleEntityNotFound(_0x59cc5c,null))[_0x6693('0x28')](saveUpdates(_0x2a25a5[_0x6693('0x49')],null))[_0x6693('0x28')](respondWithResult(_0x59cc5c,null))[_0x6693('0x44')](handleError(_0x59cc5c,null));};exports[_0x6693('0x25')]=function(_0x5f134a,_0x103c02){return db[_0x6693('0x2f')][_0x6693('0x47')]({'where':{'id':_0x5f134a[_0x6693('0x46')]['id']}})[_0x6693('0x28')](handleEntityNotFound(_0x103c02,null))[_0x6693('0x28')](removeEntity(_0x103c02,null))['catch'](handleError(_0x103c02,null));}; \ No newline at end of file +var _0xd8f2=['where','merge','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','lodash','squel','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','get','Templates','destroy','error','stack','name','send','map','Template','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0xd8f2,0x1a2));var _0x2d8f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd8f2[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x2d8f('0x0'));var rimraf=require(_0x2d8f('0x1'));var zipdir=require(_0x2d8f('0x2'));var jsonpatch=require(_0x2d8f('0x3'));var rp=require(_0x2d8f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2d8f('0x5'));var util=require('util');var path=require(_0x2d8f('0x6'));var sox=require(_0x2d8f('0x7'));var csv=require('to-csv');var ejs=require(_0x2d8f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d8f('0x9'));var squel=require(_0x2d8f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2d8f('0xb'));var querystring=require(_0x2d8f('0xc'));var Papa=require('papaparse');var Redis=require(_0x2d8f('0xd'));var authService=require(_0x2d8f('0xe'));var qs=require(_0x2d8f('0xf'));var as=require(_0x2d8f('0x10'));var hardwareService=require(_0x2d8f('0x11'));var logger=require(_0x2d8f('0x12'))(_0x2d8f('0x13'));var utils=require(_0x2d8f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d8f('0x15'));var db=require(_0x2d8f('0x16'))['db'];function respondWithStatusCode(_0x1f06f3,_0x578446){_0x578446=_0x578446||0xcc;return function(_0x1561a6){if(_0x1561a6){return _0x1f06f3[_0x2d8f('0x17')](_0x578446);}return _0x1f06f3['status'](_0x578446)[_0x2d8f('0x18')]();};}function respondWithResult(_0x5a27d5,_0x4ed38e){_0x4ed38e=_0x4ed38e||0xc8;return function(_0x1bc5b9){if(_0x1bc5b9){return _0x5a27d5[_0x2d8f('0x19')](_0x4ed38e)[_0x2d8f('0x1a')](_0x1bc5b9);}};}function respondWithFilteredResult(_0x1e0a9b,_0x4c8586){return function(_0x5979c4){if(_0x5979c4){var _0x54103b=typeof _0x4c8586[_0x2d8f('0x1b')]==='undefined'&&typeof _0x4c8586[_0x2d8f('0x1c')]===_0x2d8f('0x1d');var _0x467e18=_0x5979c4[_0x2d8f('0x1e')];var _0x4b2981=_0x54103b?0x0:_0x4c8586[_0x2d8f('0x1b')];var _0x231672=_0x54103b?_0x5979c4['count']:_0x4c8586['offset']+_0x4c8586[_0x2d8f('0x1c')];var _0x27d920;if(_0x231672>=_0x467e18){_0x231672=_0x467e18;_0x27d920=0xc8;}else{_0x27d920=0xce;}_0x1e0a9b[_0x2d8f('0x19')](_0x27d920);return _0x1e0a9b['set'](_0x2d8f('0x1f'),_0x4b2981+'-'+_0x231672+'/'+_0x467e18)[_0x2d8f('0x1a')](_0x5979c4);}return null;};}function patchUpdates(_0x4b3ca1){return function(_0x3ec84e){try{jsonpatch[_0x2d8f('0x20')](_0x3ec84e,_0x4b3ca1,!![]);}catch(_0xdc489){return BPromise['reject'](_0xdc489);}return _0x3ec84e[_0x2d8f('0x21')]();};}function saveUpdates(_0x53b4c9,_0x1484ab){return function(_0x4c3080){if(_0x4c3080){return _0x4c3080[_0x2d8f('0x22')](_0x53b4c9)['then'](function(_0x5e4b2d){return _0x5e4b2d;});}return null;};}function removeEntity(_0x469da0,_0x47c84a){return function(_0x467970){if(_0x467970){return _0x467970['destroy']()[_0x2d8f('0x23')](function(){var _0x3fa21c=_0x467970[_0x2d8f('0x24')]({'plain':!![]});var _0xdd3176=_0x2d8f('0x25');return db['UserProfileResource'][_0x2d8f('0x26')]({'where':{'type':_0xdd3176,'resourceId':_0x3fa21c['id']}})[_0x2d8f('0x23')](function(){return _0x467970;});})[_0x2d8f('0x23')](function(){_0x469da0[_0x2d8f('0x19')](0xcc)[_0x2d8f('0x18')]();});}};}function handleEntityNotFound(_0x935d14,_0x53e814){return function(_0x4ac2a2){if(!_0x4ac2a2){_0x935d14[_0x2d8f('0x17')](0x194);}return _0x4ac2a2;};}function handleError(_0x4e299a,_0x38f0e1){_0x38f0e1=_0x38f0e1||0x1f4;return function(_0x3aa22b){logger[_0x2d8f('0x27')](_0x3aa22b[_0x2d8f('0x28')]);if(_0x3aa22b[_0x2d8f('0x29')]){delete _0x3aa22b[_0x2d8f('0x29')];}_0x4e299a[_0x2d8f('0x19')](_0x38f0e1)[_0x2d8f('0x2a')](_0x3aa22b);};}exports['index']=function(_0x476ab7,_0x44ccf2){var _0x1e0bea={},_0x1b6eb0={},_0x375863={'count':0x0,'rows':[]};var _0x52f8e2=_[_0x2d8f('0x2b')](db[_0x2d8f('0x2c')]['rawAttributes'],function(_0x262bfe){return{'name':_0x262bfe[_0x2d8f('0x2d')],'type':_0x262bfe[_0x2d8f('0x2e')][_0x2d8f('0x2f')]};});_0x1b6eb0[_0x2d8f('0x30')]=_['map'](_0x52f8e2,'name');_0x1b6eb0[_0x2d8f('0x31')]=_[_0x2d8f('0x32')](_0x476ab7[_0x2d8f('0x31')]);_0x1b6eb0[_0x2d8f('0x33')]=_[_0x2d8f('0x34')](_0x1b6eb0[_0x2d8f('0x30')],_0x1b6eb0[_0x2d8f('0x31')]);_0x1e0bea['attributes']=_[_0x2d8f('0x34')](_0x1b6eb0[_0x2d8f('0x30')],qs[_0x2d8f('0x35')](_0x476ab7['query'][_0x2d8f('0x35')]));_0x1e0bea[_0x2d8f('0x36')]=_0x1e0bea[_0x2d8f('0x36')][_0x2d8f('0x37')]?_0x1e0bea[_0x2d8f('0x36')]:_0x1b6eb0[_0x2d8f('0x30')];if(!_0x476ab7['query'][_0x2d8f('0x38')](_0x2d8f('0x39'))){_0x1e0bea[_0x2d8f('0x1c')]=qs[_0x2d8f('0x1c')](_0x476ab7['query'][_0x2d8f('0x1c')]);_0x1e0bea['offset']=qs['offset'](_0x476ab7[_0x2d8f('0x31')][_0x2d8f('0x1b')]);}_0x1e0bea[_0x2d8f('0x3a')]=qs['sort'](_0x476ab7[_0x2d8f('0x31')][_0x2d8f('0x3b')]);_0x1e0bea['where']=qs['filters'](_[_0x2d8f('0x3c')](_0x476ab7[_0x2d8f('0x31')],_0x1b6eb0['filters']),_0x52f8e2);if(_0x476ab7[_0x2d8f('0x31')][_0x2d8f('0x3d')]){_0x1e0bea[_0x2d8f('0x3e')]=_[_0x2d8f('0x3f')](_0x1e0bea[_0x2d8f('0x3e')],{'$or':_[_0x2d8f('0x2b')](_0x52f8e2,function(_0x2cc032){if(_0x2cc032[_0x2d8f('0x2e')]!=='VIRTUAL'){var _0x5ba60b={};_0x5ba60b[_0x2cc032[_0x2d8f('0x29')]]={'$like':'%'+_0x476ab7['query'][_0x2d8f('0x3d')]+'%'};return _0x5ba60b;}})});}_0x1e0bea=_[_0x2d8f('0x3f')]({},_0x1e0bea,_0x476ab7['options']);var _0x37c4a4={'where':_0x1e0bea['where']};return db[_0x2d8f('0x2c')][_0x2d8f('0x1e')](_0x37c4a4)[_0x2d8f('0x23')](function(_0x5c6097){_0x375863[_0x2d8f('0x1e')]=_0x5c6097;if(_0x476ab7[_0x2d8f('0x31')][_0x2d8f('0x40')]){_0x1e0bea['include']=[{'all':!![]}];}return db[_0x2d8f('0x2c')][_0x2d8f('0x41')](_0x1e0bea);})['then'](function(_0x1a06ec){_0x375863[_0x2d8f('0x42')]=_0x1a06ec;return _0x375863;})['then'](respondWithFilteredResult(_0x44ccf2,_0x1e0bea))['catch'](handleError(_0x44ccf2,null));};exports[_0x2d8f('0x43')]=function(_0x2b162a,_0x21e6cd){var _0x5335f6={'raw':!![],'where':{'id':_0x2b162a[_0x2d8f('0x44')]['id']}},_0xd1079e={};_0xd1079e['model']=_[_0x2d8f('0x32')](db[_0x2d8f('0x2c')][_0x2d8f('0x45')]);_0xd1079e[_0x2d8f('0x31')]=_[_0x2d8f('0x32')](_0x2b162a[_0x2d8f('0x31')]);_0xd1079e[_0x2d8f('0x33')]=_['intersection'](_0xd1079e[_0x2d8f('0x30')],_0xd1079e[_0x2d8f('0x31')]);_0x5335f6[_0x2d8f('0x36')]=_[_0x2d8f('0x34')](_0xd1079e[_0x2d8f('0x30')],qs[_0x2d8f('0x35')](_0x2b162a[_0x2d8f('0x31')][_0x2d8f('0x35')]));_0x5335f6['attributes']=_0x5335f6['attributes'][_0x2d8f('0x37')]?_0x5335f6['attributes']:_0xd1079e[_0x2d8f('0x30')];if(_0x2b162a[_0x2d8f('0x31')]['includeAll']){_0x5335f6[_0x2d8f('0x46')]=[{'all':!![]}];}_0x5335f6=_[_0x2d8f('0x3f')]({},_0x5335f6,_0x2b162a['options']);return db[_0x2d8f('0x2c')][_0x2d8f('0x47')](_0x5335f6)['then'](handleEntityNotFound(_0x21e6cd,null))[_0x2d8f('0x23')](respondWithResult(_0x21e6cd,null))[_0x2d8f('0x48')](handleError(_0x21e6cd,null));};exports[_0x2d8f('0x49')]=function(_0x19fa12,_0x4cbb07){return db[_0x2d8f('0x2c')]['create'](_0x19fa12['body'],{})[_0x2d8f('0x23')](function(_0x26e7f1){var _0xda6d48=_0x19fa12['user'][_0x2d8f('0x24')]({'plain':!![]});if(!_0xda6d48)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xda6d48[_0x2d8f('0x4a')]===_0x2d8f('0x4b')){var _0x1b93b4=_0x26e7f1[_0x2d8f('0x24')]({'plain':!![]});var _0x39b59e=_0x2d8f('0x25');return db[_0x2d8f('0x4c')][_0x2d8f('0x47')]({'where':{'name':_0x39b59e,'userProfileId':_0xda6d48[_0x2d8f('0x4d')]},'raw':!![]})[_0x2d8f('0x23')](function(_0x3b5a43){if(_0x3b5a43&&_0x3b5a43['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1b93b4[_0x2d8f('0x29')],'resourceId':_0x1b93b4['id'],'type':_0x3b5a43[_0x2d8f('0x29')],'sectionId':_0x3b5a43['id']},{})['then'](function(){return _0x26e7f1;});}else{return _0x26e7f1;}})[_0x2d8f('0x48')](function(_0x1698ef){logger[_0x2d8f('0x27')](_0x2d8f('0x4e'),_0x1698ef);throw _0x1698ef;});}return _0x26e7f1;})[_0x2d8f('0x23')](respondWithResult(_0x4cbb07,0xc9))[_0x2d8f('0x48')](handleError(_0x4cbb07,null));};exports[_0x2d8f('0x22')]=function(_0x45ffb7,_0x3b551b){if(_0x45ffb7['body']['id']){delete _0x45ffb7[_0x2d8f('0x4f')]['id'];}return db[_0x2d8f('0x2c')][_0x2d8f('0x47')]({'where':{'id':_0x45ffb7[_0x2d8f('0x44')]['id']}})[_0x2d8f('0x23')](handleEntityNotFound(_0x3b551b,null))[_0x2d8f('0x23')](saveUpdates(_0x45ffb7[_0x2d8f('0x4f')],null))['then'](respondWithResult(_0x3b551b,null))['catch'](handleError(_0x3b551b,null));};exports[_0x2d8f('0x26')]=function(_0x1f4470,_0x373d8f){return db['Template']['find']({'where':{'id':_0x1f4470[_0x2d8f('0x44')]['id']}})[_0x2d8f('0x23')](handleEntityNotFound(_0x373d8f,null))[_0x2d8f('0x23')](removeEntity(_0x373d8f,null))['catch'](handleError(_0x373d8f,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 0089443..1a1e582 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 _0xf10e=['bluebird','request-promise','path','rimraf','../../config/environment','define','Template','tools_templates','lodash','../../config/logger'];(function(_0x1f4c82,_0x1ab4e1){var _0xb8917f=function(_0x193e14){while(--_0x193e14){_0x1f4c82['push'](_0x1f4c82['shift']());}};_0xb8917f(++_0x1ab4e1);}(_0xf10e,0x1ac));var _0xef10=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xf10e[_0x1a7846];return _0x48049;};'use strict';var _=require(_0xef10('0x0'));var util=require('util');var logger=require(_0xef10('0x1'))('api');var moment=require('moment');var BPromise=require(_0xef10('0x2'));var rp=require(_0xef10('0x3'));var fs=require('fs');var path=require(_0xef10('0x4'));var rimraf=require(_0xef10('0x5'));var config=require(_0xef10('0x6'));var attributes=require('./template.attributes');module['exports']=function(_0x2897c7,_0x35c01b){return _0x2897c7[_0xef10('0x7')](_0xef10('0x8'),attributes,{'tableName':_0xef10('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf44f=['request-promise','path','rimraf','../../config/environment','exports','define','Template','lodash','util','bluebird'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xf44f,0x129));var _0xff44=function(_0x358322,_0x2d8669){_0x358322=_0x358322-0x0;var _0x5cfa34=_0xf44f[_0x358322];return _0x5cfa34;};'use strict';var _=require(_0xff44('0x0'));var util=require(_0xff44('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xff44('0x2'));var rp=require(_0xff44('0x3'));var fs=require('fs');var path=require(_0xff44('0x4'));var rimraf=require(_0xff44('0x5'));var config=require(_0xff44('0x6'));var attributes=require('./template.attributes');module[_0xff44('0x7')]=function(_0x16295d,_0x4d74a6){return _0x16295d[_0xff44('0x8')](_0xff44('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 95b428a..184cf6c 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 _0x18a6=['error','code','message','info','result','GetTemplate','Template','options','where','attributes','limit','include','model','map','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x18a6,0x1c9));var _0x618a=function(_0x4c0002,_0x28cfbd){_0x4c0002=_0x4c0002-0x0;var _0x59e976=_0x18a6[_0x4c0002];return _0x59e976;};'use strict';var _=require('lodash');var util=require(_0x618a('0x0'));var moment=require(_0x618a('0x1'));var BPromise=require(_0x618a('0x2'));var rs=require(_0x618a('0x3'));var fs=require('fs');var Redis=require(_0x618a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x618a('0x5'));var logger=require(_0x618a('0x6'))(_0x618a('0x7'));var config=require(_0x618a('0x8'));var jayson=require(_0x618a('0x9'));var client=jayson[_0x618a('0xa')][_0x618a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32558e,_0x299682,_0x4d7fa6){return new BPromise(function(_0xefc1a7,_0x1b2a94){return client[_0x618a('0xc')](_0x32558e,_0x4d7fa6)[_0x618a('0xd')](function(_0x1e52b2){logger['info'](_0x618a('0xe'),_0x299682,'request\x20sent');logger[_0x618a('0xf')](_0x618a('0x10'),_0x299682,_0x618a('0x11'),JSON[_0x618a('0x12')](_0x1e52b2));if(_0x1e52b2['error']){if(_0x1e52b2[_0x618a('0x13')][_0x618a('0x14')]===0x1f4){logger[_0x618a('0x13')](_0x618a('0xe'),_0x299682,_0x1e52b2[_0x618a('0x13')][_0x618a('0x15')]);return _0x1b2a94(_0x1e52b2[_0x618a('0x13')][_0x618a('0x15')]);}logger['error']('Template,\x20%s,\x20%s',_0x299682,_0x1e52b2['error'][_0x618a('0x15')]);return _0xefc1a7(_0x1e52b2['error'][_0x618a('0x15')]);}else{logger[_0x618a('0x16')](_0x618a('0xe'),_0x299682,'request\x20sent');_0xefc1a7(_0x1e52b2[_0x618a('0x17')][_0x618a('0x15')]);}})['catch'](function(_0x2c0563){logger[_0x618a('0x13')](_0x618a('0xe'),_0x299682,_0x2c0563);_0x1b2a94(_0x2c0563);});});}exports[_0x618a('0x18')]=function(_0x35b13e){var _0x71d8ba=this;return new Promise(function(_0x469ffd,_0x24b51c){return db[_0x618a('0x19')]['findAll']({'raw':_0x35b13e[_0x618a('0x1a')]?_0x35b13e[_0x618a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x35b13e[_0x618a('0x1a')]?_0x35b13e['options'][_0x618a('0x1b')]||null:null,'attributes':_0x35b13e[_0x618a('0x1a')]?_0x35b13e[_0x618a('0x1a')][_0x618a('0x1c')]||null:null,'limit':_0x35b13e['options']?_0x35b13e['options'][_0x618a('0x1d')]||null:null,'include':_0x35b13e[_0x618a('0x1a')]?_0x35b13e['options'][_0x618a('0x1e')]?_['map'](_0x35b13e[_0x618a('0x1a')][_0x618a('0x1e')],function(_0x3175dc){return{'model':db[_0x3175dc['model']],'as':_0x3175dc['as'],'attributes':_0x3175dc[_0x618a('0x1c')],'include':_0x3175dc[_0x618a('0x1e')]?_['map'](_0x3175dc[_0x618a('0x1e')],function(_0x1da2a9){return{'model':db[_0x1da2a9[_0x618a('0x1f')]],'as':_0x1da2a9['as'],'attributes':_0x1da2a9[_0x618a('0x1c')],'include':_0x1da2a9[_0x618a('0x1e')]?_[_0x618a('0x20')](_0x1da2a9[_0x618a('0x1e')],function(_0x12074e){return{'model':db[_0x12074e['model']],'as':_0x12074e['as'],'attributes':_0x12074e['attributes']};}):[]};}):[]};}):[]:[]})[_0x618a('0xd')](function(_0x595c11){logger[_0x618a('0x16')](_0x618a('0x18'),_0x35b13e);logger[_0x618a('0xf')](_0x618a('0x18'),_0x35b13e,JSON['stringify'](_0x595c11));_0x469ffd(_0x595c11);})[_0x618a('0x21')](function(_0x4f3aa2){logger[_0x618a('0x13')]('GetTemplate',_0x4f3aa2[_0x618a('0x15')],_0x35b13e);_0x24b51c(_0x71d8ba['error'](0x1f4,_0x4f3aa2[_0x618a('0x15')]));});});}; \ No newline at end of file +var _0x849a=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','where','attributes','include','model','map'];(function(_0x1d78ba,_0x43014a){var _0x452b8=function(_0x163a1b){while(--_0x163a1b){_0x1d78ba['push'](_0x1d78ba['shift']());}};_0x452b8(++_0x43014a);}(_0x849a,0x1ba));var _0xa849=function(_0x1905e0,_0x31e064){_0x1905e0=_0x1905e0-0x0;var _0x314eab=_0x849a[_0x1905e0];return _0x314eab;};'use strict';var _=require(_0xa849('0x0'));var util=require(_0xa849('0x1'));var moment=require(_0xa849('0x2'));var BPromise=require(_0xa849('0x3'));var rs=require(_0xa849('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa849('0x5'))['db'];var utils=require(_0xa849('0x6'));var logger=require(_0xa849('0x7'))(_0xa849('0x8'));var config=require(_0xa849('0x9'));var jayson=require(_0xa849('0xa'));var client=jayson[_0xa849('0xb')][_0xa849('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ea7b8,_0x308e26,_0x5e5aee){return new BPromise(function(_0x16e755,_0x259965){return client['request'](_0x4ea7b8,_0x5e5aee)[_0xa849('0xd')](function(_0x163c80){logger[_0xa849('0xe')](_0xa849('0xf'),_0x308e26,_0xa849('0x10'));logger[_0xa849('0x11')](_0xa849('0x12'),_0x308e26,_0xa849('0x10'),JSON[_0xa849('0x13')](_0x163c80));if(_0x163c80[_0xa849('0x14')]){if(_0x163c80[_0xa849('0x14')][_0xa849('0x15')]===0x1f4){logger[_0xa849('0x14')](_0xa849('0xf'),_0x308e26,_0x163c80[_0xa849('0x14')][_0xa849('0x16')]);return _0x259965(_0x163c80[_0xa849('0x14')][_0xa849('0x16')]);}logger[_0xa849('0x14')](_0xa849('0xf'),_0x308e26,_0x163c80[_0xa849('0x14')][_0xa849('0x16')]);return _0x16e755(_0x163c80['error'][_0xa849('0x16')]);}else{logger[_0xa849('0xe')](_0xa849('0xf'),_0x308e26,'request\x20sent');_0x16e755(_0x163c80[_0xa849('0x17')][_0xa849('0x16')]);}})[_0xa849('0x18')](function(_0x3a9a41){logger[_0xa849('0x14')](_0xa849('0xf'),_0x308e26,_0x3a9a41);_0x259965(_0x3a9a41);});});}exports[_0xa849('0x19')]=function(_0x1053d7){var _0x4aa02d=this;return new Promise(function(_0x408a77,_0x34c26d){return db[_0xa849('0x1a')][_0xa849('0x1b')]({'raw':_0x1053d7[_0xa849('0x1c')]?_0x1053d7[_0xa849('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1053d7[_0xa849('0x1c')]?_0x1053d7[_0xa849('0x1c')][_0xa849('0x1d')]||null:null,'attributes':_0x1053d7[_0xa849('0x1c')]?_0x1053d7['options'][_0xa849('0x1e')]||null:null,'limit':_0x1053d7['options']?_0x1053d7[_0xa849('0x1c')]['limit']||null:null,'include':_0x1053d7[_0xa849('0x1c')]?_0x1053d7[_0xa849('0x1c')][_0xa849('0x1f')]?_['map'](_0x1053d7[_0xa849('0x1c')]['include'],function(_0x4f1a0c){return{'model':db[_0x4f1a0c[_0xa849('0x20')]],'as':_0x4f1a0c['as'],'attributes':_0x4f1a0c['attributes'],'include':_0x4f1a0c[_0xa849('0x1f')]?_['map'](_0x4f1a0c[_0xa849('0x1f')],function(_0x2fcab2){return{'model':db[_0x2fcab2[_0xa849('0x20')]],'as':_0x2fcab2['as'],'attributes':_0x2fcab2[_0xa849('0x1e')],'include':_0x2fcab2['include']?_[_0xa849('0x21')](_0x2fcab2[_0xa849('0x1f')],function(_0x4fcb93){return{'model':db[_0x4fcb93[_0xa849('0x20')]],'as':_0x4fcb93['as'],'attributes':_0x4fcb93[_0xa849('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa849('0xd')](function(_0x31172b){logger[_0xa849('0xe')](_0xa849('0x19'),_0x1053d7);logger[_0xa849('0x11')](_0xa849('0x19'),_0x1053d7,JSON[_0xa849('0x13')](_0x31172b));_0x408a77(_0x31172b);})[_0xa849('0x18')](function(_0x1708e3){logger['error']('GetTemplate',_0x1708e3['message'],_0x1053d7);_0x34c26d(_0x4aa02d[_0xa849('0x14')](0x1f4,_0x1708e3[_0xa849('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 5b9b05f..66fee6b 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 _0x45d3=['create','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post'];(function(_0x367db8,_0xd21da0){var _0x553f0b=function(_0x4acb7c){while(--_0x4acb7c){_0x367db8['push'](_0x367db8['shift']());}};_0x553f0b(++_0xd21da0);}(_0x45d3,0x148));var _0x345d=function(_0x510d50,_0x284a40){_0x510d50=_0x510d50-0x0;var _0x5eead6=_0x45d3[_0x510d50];return _0x5eead6;};'use strict';var multer=require('multer');var util=require(_0x345d('0x0'));var path=require(_0x345d('0x1'));var timeout=require(_0x345d('0x2'));var express=require(_0x345d('0x3'));var router=express[_0x345d('0x4')]();var fs_extra=require(_0x345d('0x5'));var auth=require(_0x345d('0x6'));var interaction=require(_0x345d('0x7'));var config=require(_0x345d('0x8'));var controller=require(_0x345d('0x9'));router[_0x345d('0xa')]('/',auth[_0x345d('0xb')](),controller[_0x345d('0xc')]);router[_0x345d('0xa')](_0x345d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x345d('0xa')](_0x345d('0xe'),auth['isAuthenticated'](),controller[_0x345d('0xf')]);router[_0x345d('0xa')](_0x345d('0x10'),auth['isAuthenticated'](),controller[_0x345d('0x11')]);router[_0x345d('0xa')](_0x345d('0x12'),auth['isAuthenticated'](),controller['getActions']);router[_0x345d('0x13')]('/',auth[_0x345d('0xb')](),controller[_0x345d('0x14')]);router[_0x345d('0x13')](_0x345d('0xe'),auth['isAuthenticated'](),controller[_0x345d('0x15')]);router[_0x345d('0x13')](_0x345d('0x10'),auth[_0x345d('0xb')](),controller[_0x345d('0x16')]);router[_0x345d('0x13')](_0x345d('0x12'),auth[_0x345d('0xb')](),controller[_0x345d('0x17')]);router[_0x345d('0x18')](_0x345d('0xd'),auth[_0x345d('0xb')](),controller[_0x345d('0x19')]);router[_0x345d('0x1a')](_0x345d('0xd'),auth['isAuthenticated'](),controller[_0x345d('0x1b')]);module[_0x345d('0x1c')]=router; \ No newline at end of file +var _0xa0d5=['addAnyCondition','addAction','update','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','create','post','addAllCondition'];(function(_0x1a0ae5,_0x443d07){var _0x1656cd=function(_0x15bc56){while(--_0x15bc56){_0x1a0ae5['push'](_0x1a0ae5['shift']());}};_0x1656cd(++_0x443d07);}(_0xa0d5,0xab));var _0x5a0d=function(_0x59ee91,_0x5ca1ef){_0x59ee91=_0x59ee91-0x0;var _0x51b0b7=_0xa0d5[_0x59ee91];return _0x51b0b7;};'use strict';var multer=require('multer');var util=require(_0x5a0d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5a0d('0x1'));var auth=require(_0x5a0d('0x2'));var interaction=require(_0x5a0d('0x3'));var config=require(_0x5a0d('0x4'));var controller=require(_0x5a0d('0x5'));router[_0x5a0d('0x6')]('/',auth['isAuthenticated'](),controller[_0x5a0d('0x7')]);router['get'](_0x5a0d('0x8'),auth[_0x5a0d('0x9')](),controller[_0x5a0d('0xa')]);router['get'](_0x5a0d('0xb'),auth[_0x5a0d('0x9')](),controller[_0x5a0d('0xc')]);router[_0x5a0d('0x6')](_0x5a0d('0xd'),auth[_0x5a0d('0x9')](),controller['getAnyConditions']);router[_0x5a0d('0x6')](_0x5a0d('0xe'),auth[_0x5a0d('0x9')](),controller['getActions']);router['post']('/',auth[_0x5a0d('0x9')](),controller[_0x5a0d('0xf')]);router[_0x5a0d('0x10')](_0x5a0d('0xb'),auth[_0x5a0d('0x9')](),controller[_0x5a0d('0x11')]);router[_0x5a0d('0x10')](_0x5a0d('0xd'),auth['isAuthenticated'](),controller[_0x5a0d('0x12')]);router[_0x5a0d('0x10')](_0x5a0d('0xe'),auth['isAuthenticated'](),controller[_0x5a0d('0x13')]);router['put'](_0x5a0d('0x8'),auth[_0x5a0d('0x9')](),controller[_0x5a0d('0x14')]);router['delete'](_0x5a0d('0x8'),auth[_0x5a0d('0x9')](),controller['destroy']);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 56415f7..2542447 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 _0x5031=['BOOLEAN','sequelize','STRING'];(function(_0x29d0e0,_0x56d503){var _0x5db0c0=function(_0x21ab9e){while(--_0x21ab9e){_0x29d0e0['push'](_0x29d0e0['shift']());}};_0x5db0c0(++_0x56d503);}(_0x5031,0x6d));var _0x1503=function(_0xcd1bff,_0x41fe05){_0xcd1bff=_0xcd1bff-0x0;var _0x11e977=_0x5031[_0xcd1bff];return _0x11e977;};'use strict';var Sequelize=require(_0x1503('0x0'));module['exports']={'name':{'type':Sequelize[_0x1503('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x1503('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x148b=['sequelize','STRING','BOOLEAN'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x148b,0xe1));var _0xb148=function(_0x1cea44,_0xf58a16){_0x1cea44=_0x1cea44-0x0;var _0x4d2e2e=_0x148b[_0x1cea44];return _0x4d2e2e;};'use strict';var Sequelize=require(_0xb148('0x0'));module['exports']={'name':{'type':Sequelize[_0xb148('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb148('0x1')]},'status':{'type':Sequelize[_0xb148('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 d89ac23..ade4128 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 _0x3365=['../../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','apply','save','destroy','Triggers','UserProfileResource','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','Trigger','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','get','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','order','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service'];(function(_0x3402a4,_0x580c67){var _0x5a275f=function(_0x31fc50){while(--_0x31fc50){_0x3402a4['push'](_0x3402a4['shift']());}};_0x5a275f(++_0x580c67);}(_0x3365,0x16c));var _0x5336=function(_0x4f9f65,_0x2a38ef){_0x4f9f65=_0x4f9f65-0x0;var _0x451c3a=_0x3365[_0x4f9f65];return _0x451c3a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5336('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5336('0x1'));var rp=require(_0x5336('0x2'));var moment=require(_0x5336('0x3'));var BPromise=require(_0x5336('0x4'));var Mustache=require(_0x5336('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5336('0x6'));var csv=require(_0x5336('0x7'));var ejs=require(_0x5336('0x8'));var fs=require('fs');var fs_extra=require(_0x5336('0x9'));var _=require(_0x5336('0xa'));var squel=require(_0x5336('0xb'));var crypto=require('crypto');var jsforce=require(_0x5336('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5336('0x7'));var querystring=require(_0x5336('0xd'));var Papa=require('papaparse');var Redis=require(_0x5336('0xe'));var authService=require(_0x5336('0xf'));var qs=require(_0x5336('0x10'));var as=require(_0x5336('0x11'));var hardwareService=require(_0x5336('0x12'));var logger=require(_0x5336('0x13'))(_0x5336('0x14'));var utils=require(_0x5336('0x15'));var config=require(_0x5336('0x16'));var licenseUtil=require(_0x5336('0x17'));var db=require(_0x5336('0x18'))['db'];function respondWithStatusCode(_0x44da5e,_0xf7074d){_0xf7074d=_0xf7074d||0xcc;return function(_0x28afa2){if(_0x28afa2){return _0x44da5e[_0x5336('0x19')](_0xf7074d);}return _0x44da5e[_0x5336('0x1a')](_0xf7074d)[_0x5336('0x1b')]();};}function respondWithResult(_0x3da64f,_0x455dc7){_0x455dc7=_0x455dc7||0xc8;return function(_0x2440ac){if(_0x2440ac){return _0x3da64f[_0x5336('0x1a')](_0x455dc7)[_0x5336('0x1c')](_0x2440ac);}};}function respondWithFilteredResult(_0x44feda,_0x2e1385){return function(_0xfe021e){if(_0xfe021e){var _0x3c69c1=typeof _0x2e1385[_0x5336('0x1d')]==='undefined'&&typeof _0x2e1385[_0x5336('0x1e')]===_0x5336('0x1f');var _0x528f47=_0xfe021e[_0x5336('0x20')];var _0x594e3f=_0x3c69c1?0x0:_0x2e1385['offset'];var _0x469da1=_0x3c69c1?_0xfe021e[_0x5336('0x20')]:_0x2e1385[_0x5336('0x1d')]+_0x2e1385[_0x5336('0x1e')];var _0x5d1954;if(_0x469da1>=_0x528f47){_0x469da1=_0x528f47;_0x5d1954=0xc8;}else{_0x5d1954=0xce;}_0x44feda[_0x5336('0x1a')](_0x5d1954);return _0x44feda[_0x5336('0x21')]('Content-Range',_0x594e3f+'-'+_0x469da1+'/'+_0x528f47)[_0x5336('0x1c')](_0xfe021e);}return null;};}function patchUpdates(_0x471957){return function(_0x552c71){try{jsonpatch[_0x5336('0x22')](_0x552c71,_0x471957,!![]);}catch(_0x7d04bb){return BPromise['reject'](_0x7d04bb);}return _0x552c71[_0x5336('0x23')]();};}function saveUpdates(_0x833cb3,_0x35a577){return function(_0x307da1){if(_0x307da1){return _0x307da1['update'](_0x833cb3)['then'](function(_0x59cf64){return _0x59cf64;});}return null;};}function removeEntity(_0x526f1b,_0x3259c2){return function(_0xac9dec){if(_0xac9dec){return _0xac9dec[_0x5336('0x24')]()['then'](function(){var _0x51adeb=_0xac9dec['get']({'plain':!![]});var _0x54153f=_0x5336('0x25');return db[_0x5336('0x26')][_0x5336('0x24')]({'where':{'type':_0x54153f,'resourceId':_0x51adeb['id']}})['then'](function(){return _0xac9dec;});})[_0x5336('0x27')](function(){_0x526f1b[_0x5336('0x1a')](0xcc)[_0x5336('0x1b')]();});}};}function handleEntityNotFound(_0x18b755,_0x16070f){return function(_0x57c17d){if(!_0x57c17d){_0x18b755[_0x5336('0x19')](0x194);}return _0x57c17d;};}function handleError(_0x2bdfae,_0x52bd03){_0x52bd03=_0x52bd03||0x1f4;return function(_0x4d5f4f){logger[_0x5336('0x28')](_0x4d5f4f[_0x5336('0x29')]);if(_0x4d5f4f['name']){delete _0x4d5f4f[_0x5336('0x2a')];}_0x2bdfae[_0x5336('0x1a')](_0x52bd03)[_0x5336('0x2b')](_0x4d5f4f);};}exports[_0x5336('0x2c')]=function(_0xc79611,_0x55a7a0){var _0x59cb25={},_0x4b56b8={},_0x5be331={'count':0x0,'rows':[]};var _0x408ef4=_[_0x5336('0x2d')](db['Trigger'][_0x5336('0x2e')],function(_0x51b3bc){return{'name':_0x51b3bc[_0x5336('0x2f')],'type':_0x51b3bc[_0x5336('0x30')][_0x5336('0x31')]};});_0x4b56b8[_0x5336('0x32')]=_[_0x5336('0x2d')](_0x408ef4,_0x5336('0x2a'));_0x4b56b8['query']=_['keys'](_0xc79611[_0x5336('0x33')]);_0x4b56b8[_0x5336('0x34')]=_['intersection'](_0x4b56b8[_0x5336('0x32')],_0x4b56b8[_0x5336('0x33')]);_0x59cb25[_0x5336('0x35')]=_[_0x5336('0x36')](_0x4b56b8[_0x5336('0x32')],qs['fields'](_0xc79611[_0x5336('0x33')][_0x5336('0x37')]));_0x59cb25['attributes']=_0x59cb25[_0x5336('0x35')][_0x5336('0x38')]?_0x59cb25[_0x5336('0x35')]:_0x4b56b8[_0x5336('0x32')];if(!_0xc79611[_0x5336('0x33')][_0x5336('0x39')](_0x5336('0x3a'))){_0x59cb25[_0x5336('0x1e')]=qs[_0x5336('0x1e')](_0xc79611['query']['limit']);_0x59cb25['offset']=qs[_0x5336('0x1d')](_0xc79611['query'][_0x5336('0x1d')]);}_0x59cb25['order']=qs['sort'](_0xc79611[_0x5336('0x33')][_0x5336('0x3b')]);_0x59cb25[_0x5336('0x3c')]=qs[_0x5336('0x34')](_[_0x5336('0x3d')](_0xc79611[_0x5336('0x33')],_0x4b56b8[_0x5336('0x34')]),_0x408ef4);if(_0xc79611[_0x5336('0x33')][_0x5336('0x3e')]){_0x59cb25[_0x5336('0x3c')]=_['merge'](_0x59cb25['where'],{'$or':_['map'](_0x408ef4,function(_0xa0889){if(_0xa0889['type']!==_0x5336('0x3f')){var _0x39cf9e={};_0x39cf9e[_0xa0889[_0x5336('0x2a')]]={'$like':'%'+_0xc79611[_0x5336('0x33')][_0x5336('0x3e')]+'%'};return _0x39cf9e;}})});}_0x59cb25=_[_0x5336('0x40')]({},_0x59cb25,_0xc79611[_0x5336('0x41')]);var _0x3a59bc={'where':_0x59cb25[_0x5336('0x3c')]};return db[_0x5336('0x42')][_0x5336('0x20')](_0x3a59bc)[_0x5336('0x27')](function(_0x2d6ed0){_0x5be331[_0x5336('0x20')]=_0x2d6ed0;if(_0xc79611[_0x5336('0x33')][_0x5336('0x43')]){_0x59cb25[_0x5336('0x44')]=[{'all':!![]}];}return db['Trigger'][_0x5336('0x45')](_0x59cb25);})[_0x5336('0x27')](function(_0x5aa0bb){_0x5be331[_0x5336('0x46')]=_0x5aa0bb;return _0x5be331;})[_0x5336('0x27')](respondWithFilteredResult(_0x55a7a0,_0x59cb25))[_0x5336('0x47')](handleError(_0x55a7a0,null));};exports[_0x5336('0x48')]=function(_0x4dd450,_0x2906e8){var _0x4b3aca={'raw':![],'where':{'id':_0x4dd450[_0x5336('0x49')]['id']}},_0x10fdb5={};_0x10fdb5[_0x5336('0x32')]=_[_0x5336('0x4a')](db[_0x5336('0x42')][_0x5336('0x2e')]);_0x10fdb5[_0x5336('0x33')]=_[_0x5336('0x4a')](_0x4dd450[_0x5336('0x33')]);_0x10fdb5[_0x5336('0x34')]=_[_0x5336('0x36')](_0x10fdb5['model'],_0x10fdb5[_0x5336('0x33')]);_0x4b3aca[_0x5336('0x35')]=_[_0x5336('0x36')](_0x10fdb5['model'],qs[_0x5336('0x37')](_0x4dd450[_0x5336('0x33')][_0x5336('0x37')]));_0x4b3aca['attributes']=_0x4b3aca[_0x5336('0x35')][_0x5336('0x38')]?_0x4b3aca[_0x5336('0x35')]:_0x10fdb5[_0x5336('0x32')];if(_0x4dd450[_0x5336('0x33')][_0x5336('0x43')]){_0x4b3aca['include']=[{'all':!![]}];}_0x4b3aca=_[_0x5336('0x40')]({},_0x4b3aca,_0x4dd450[_0x5336('0x41')]);return db['Trigger']['find'](_0x4b3aca)[_0x5336('0x27')](handleEntityNotFound(_0x2906e8,null))['then'](respondWithResult(_0x2906e8,null))[_0x5336('0x47')](handleError(_0x2906e8,null));};exports[_0x5336('0x4b')]=function(_0x165b19,_0x32919c){return db['Trigger'][_0x5336('0x4b')](_0x165b19[_0x5336('0x4c')],{})[_0x5336('0x27')](function(_0x1dae83){var _0x529199=_0x165b19[_0x5336('0x4d')][_0x5336('0x4e')]({'plain':!![]});if(!_0x529199)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x529199['role']===_0x5336('0x4d')){var _0x1b67ee=_0x1dae83[_0x5336('0x4e')]({'plain':!![]});var _0x4f60bf='Triggers';return db['UserProfileSection'][_0x5336('0x4f')]({'where':{'name':_0x4f60bf,'userProfileId':_0x529199['userProfileId']},'raw':!![]})[_0x5336('0x27')](function(_0x42f251){if(_0x42f251&&_0x42f251[_0x5336('0x50')]===0x0){return db[_0x5336('0x26')][_0x5336('0x4b')]({'name':_0x1b67ee[_0x5336('0x2a')],'resourceId':_0x1b67ee['id'],'type':_0x42f251[_0x5336('0x2a')],'sectionId':_0x42f251['id']},{})[_0x5336('0x27')](function(){return _0x1dae83;});}else{return _0x1dae83;}})[_0x5336('0x47')](function(_0x338e2c){logger[_0x5336('0x28')](_0x5336('0x51'),_0x338e2c);throw _0x338e2c;});}return _0x1dae83;})[_0x5336('0x27')](respondWithResult(_0x32919c,0xc9))[_0x5336('0x47')](handleError(_0x32919c,null));};exports[_0x5336('0x52')]=function(_0x5de143,_0x335683){if(_0x5de143['body']['id']){delete _0x5de143[_0x5336('0x4c')]['id'];}return db['Trigger'][_0x5336('0x4f')]({'where':{'id':_0x5de143[_0x5336('0x49')]['id']}})[_0x5336('0x27')](handleEntityNotFound(_0x335683,null))[_0x5336('0x27')](saveUpdates(_0x5de143[_0x5336('0x4c')],null))[_0x5336('0x27')](respondWithResult(_0x335683,null))[_0x5336('0x47')](handleError(_0x335683,null));};exports[_0x5336('0x24')]=function(_0x4dc8f6,_0xc9b611){return db[_0x5336('0x42')][_0x5336('0x4f')]({'where':{'id':_0x4dc8f6['params']['id']}})[_0x5336('0x27')](handleEntityNotFound(_0xc9b611,null))['then'](removeEntity(_0xc9b611,null))['catch'](handleError(_0xc9b611,null));};exports[_0x5336('0x53')]=function(_0x4a5fe7,_0x51c7df,_0x134491){if(_0x4a5fe7['body']['id']){delete _0x4a5fe7[_0x5336('0x4c')]['id'];}return db[_0x5336('0x42')]['find']({'where':{'id':_0x4a5fe7[_0x5336('0x49')]['id']}})[_0x5336('0x27')](handleEntityNotFound(_0x51c7df,null))['then'](function(_0x1ca119){if(_0x1ca119){_0x4a5fe7['body'][_0x5336('0x54')]=_0x1ca119['id'];return db[_0x5336('0x55')][_0x5336('0x4b')](_0x4a5fe7[_0x5336('0x4c')]);}})[_0x5336('0x27')](respondWithResult(_0x51c7df,null))['catch'](handleError(_0x51c7df,null));};exports['addAnyCondition']=function(_0x1da45b,_0x4c87bd,_0x2161d3){if(_0x1da45b[_0x5336('0x4c')]['id']){delete _0x1da45b['body']['id'];}return db['Trigger'][_0x5336('0x4f')]({'where':{'id':_0x1da45b['params']['id']}})[_0x5336('0x27')](handleEntityNotFound(_0x4c87bd,null))[_0x5336('0x27')](function(_0x3631e8){if(_0x3631e8){_0x1da45b[_0x5336('0x4c')][_0x5336('0x56')]=_0x3631e8['id'];return db[_0x5336('0x55')]['create'](_0x1da45b['body']);}})[_0x5336('0x27')](respondWithResult(_0x4c87bd,null))['catch'](handleError(_0x4c87bd,null));};exports[_0x5336('0x57')]=function(_0x648830,_0x3bb3dc,_0x56cee1){var _0x2e822b={};var _0x1b619b={};var _0x4274e5;var _0x3b8315;return db['Trigger'][_0x5336('0x58')]({'where':{'id':_0x648830[_0x5336('0x49')]['id']}})['then'](handleEntityNotFound(_0x3bb3dc,null))[_0x5336('0x27')](function(_0x5790f8){if(_0x5790f8){_0x4274e5=_0x5790f8;_0x1b619b[_0x5336('0x32')]=_['keys'](db[_0x5336('0x55')][_0x5336('0x2e')]);_0x1b619b[_0x5336('0x33')]=_[_0x5336('0x4a')](_0x648830['query']);_0x1b619b[_0x5336('0x34')]=_['intersection'](_0x1b619b[_0x5336('0x32')],_0x1b619b[_0x5336('0x33')]);_0x2e822b[_0x5336('0x35')]=_[_0x5336('0x36')](_0x1b619b['model'],qs[_0x5336('0x37')](_0x648830[_0x5336('0x33')][_0x5336('0x37')]));_0x2e822b[_0x5336('0x35')]=_0x2e822b[_0x5336('0x35')][_0x5336('0x38')]?_0x2e822b[_0x5336('0x35')]:_0x1b619b[_0x5336('0x32')];_0x2e822b[_0x5336('0x59')]=qs['sort'](_0x648830[_0x5336('0x33')][_0x5336('0x3b')]);_0x2e822b[_0x5336('0x3c')]=qs[_0x5336('0x34')](_['pick'](_0x648830[_0x5336('0x33')],_0x1b619b['filters']));if(_0x648830[_0x5336('0x33')]['filter']){_0x2e822b[_0x5336('0x3c')]=_[_0x5336('0x40')](_0x2e822b[_0x5336('0x3c')],{'$or':_['map'](_0x2e822b[_0x5336('0x35')],function(_0xb56142){var _0x567524={};_0x567524[_0xb56142]={'$like':'%'+_0x648830[_0x5336('0x33')][_0x5336('0x3e')]+'%'};return _0x567524;})});}_0x2e822b=_[_0x5336('0x40')]({},_0x2e822b,_0x648830[_0x5336('0x41')]);return _0x4274e5[_0x5336('0x57')](_0x2e822b);}})[_0x5336('0x27')](function(_0x10296a){if(_0x10296a){_0x3b8315=_0x10296a[_0x5336('0x38')];if(!_0x648830[_0x5336('0x33')][_0x5336('0x39')]('nolimit')){_0x2e822b[_0x5336('0x1e')]=qs[_0x5336('0x1e')](_0x648830[_0x5336('0x33')]['limit']);_0x2e822b[_0x5336('0x1d')]=qs[_0x5336('0x1d')](_0x648830[_0x5336('0x33')][_0x5336('0x1d')]);}return _0x4274e5[_0x5336('0x57')](_0x2e822b);}})[_0x5336('0x27')](function(_0x5658d8){if(_0x5658d8){return _0x5658d8?{'count':_0x3b8315,'rows':_0x5658d8}:null;}})[_0x5336('0x27')](respondWithResult(_0x3bb3dc,null))[_0x5336('0x47')](handleError(_0x3bb3dc,null));};exports[_0x5336('0x5a')]=function(_0x454c26,_0x2f8271,_0x452516){var _0x4dddff={};var _0x3afda2={};var _0x43c491;var _0x556ecc;return db[_0x5336('0x42')][_0x5336('0x58')]({'where':{'id':_0x454c26[_0x5336('0x49')]['id']}})[_0x5336('0x27')](handleEntityNotFound(_0x2f8271,null))[_0x5336('0x27')](function(_0x578710){if(_0x578710){_0x43c491=_0x578710;_0x3afda2['model']=_[_0x5336('0x4a')](db[_0x5336('0x55')][_0x5336('0x2e')]);_0x3afda2[_0x5336('0x33')]=_[_0x5336('0x4a')](_0x454c26[_0x5336('0x33')]);_0x3afda2[_0x5336('0x34')]=_[_0x5336('0x36')](_0x3afda2[_0x5336('0x32')],_0x3afda2[_0x5336('0x33')]);_0x4dddff[_0x5336('0x35')]=_[_0x5336('0x36')](_0x3afda2[_0x5336('0x32')],qs[_0x5336('0x37')](_0x454c26[_0x5336('0x33')]['fields']));_0x4dddff[_0x5336('0x35')]=_0x4dddff[_0x5336('0x35')][_0x5336('0x38')]?_0x4dddff['attributes']:_0x3afda2[_0x5336('0x32')];_0x4dddff[_0x5336('0x59')]=qs[_0x5336('0x3b')](_0x454c26[_0x5336('0x33')][_0x5336('0x3b')]);_0x4dddff['where']=qs[_0x5336('0x34')](_[_0x5336('0x3d')](_0x454c26[_0x5336('0x33')],_0x3afda2[_0x5336('0x34')]));if(_0x454c26['query'][_0x5336('0x3e')]){_0x4dddff['where']=_['merge'](_0x4dddff[_0x5336('0x3c')],{'$or':_[_0x5336('0x2d')](_0x4dddff['attributes'],function(_0xd3d557){var _0x133a16={};_0x133a16[_0xd3d557]={'$like':'%'+_0x454c26[_0x5336('0x33')][_0x5336('0x3e')]+'%'};return _0x133a16;})});}_0x4dddff=_[_0x5336('0x40')]({},_0x4dddff,_0x454c26[_0x5336('0x41')]);return _0x43c491[_0x5336('0x5a')](_0x4dddff);}})['then'](function(_0x28e02b){if(_0x28e02b){_0x556ecc=_0x28e02b[_0x5336('0x38')];if(!_0x454c26[_0x5336('0x33')][_0x5336('0x39')](_0x5336('0x3a'))){_0x4dddff[_0x5336('0x1e')]=qs['limit'](_0x454c26[_0x5336('0x33')]['limit']);_0x4dddff[_0x5336('0x1d')]=qs[_0x5336('0x1d')](_0x454c26[_0x5336('0x33')][_0x5336('0x1d')]);}return _0x43c491[_0x5336('0x5a')](_0x4dddff);}})[_0x5336('0x27')](function(_0x2f1c83){if(_0x2f1c83){return _0x2f1c83?{'count':_0x556ecc,'rows':_0x2f1c83}:null;}})[_0x5336('0x27')](respondWithResult(_0x2f8271,null))[_0x5336('0x47')](handleError(_0x2f8271,null));};exports[_0x5336('0x5b')]=function(_0x5c925f,_0xdec05d,_0x412ba6){if(_0x5c925f[_0x5336('0x4c')]['id']){delete _0x5c925f[_0x5336('0x4c')]['id'];}return db[_0x5336('0x42')][_0x5336('0x4f')]({'where':{'id':_0x5c925f[_0x5336('0x49')]['id']}})[_0x5336('0x27')](handleEntityNotFound(_0xdec05d,null))['then'](function(_0x10a313){if(_0x10a313){_0x5c925f[_0x5336('0x4c')][_0x5336('0x5c')]=_0x10a313['id'];return db[_0x5336('0x5d')][_0x5336('0x4b')](_0x5c925f[_0x5336('0x4c')]);}})['then'](respondWithResult(_0xdec05d,null))[_0x5336('0x47')](handleError(_0xdec05d,null));};exports[_0x5336('0x5e')]=function(_0x1b8afd,_0x10af6c,_0x9b4096){var _0x21fa8c={};var _0xc4306d={};var _0x4399b4;var _0x12604e;return db[_0x5336('0x42')][_0x5336('0x58')]({'where':{'id':_0x1b8afd[_0x5336('0x49')]['id']}})['then'](handleEntityNotFound(_0x10af6c,null))['then'](function(_0x1bd0af){if(_0x1bd0af){_0x4399b4=_0x1bd0af;_0xc4306d['model']=_[_0x5336('0x4a')](db[_0x5336('0x5d')][_0x5336('0x2e')]);_0xc4306d['query']=_[_0x5336('0x4a')](_0x1b8afd[_0x5336('0x33')]);_0xc4306d['filters']=_[_0x5336('0x36')](_0xc4306d[_0x5336('0x32')],_0xc4306d['query']);_0x21fa8c[_0x5336('0x35')]=_[_0x5336('0x36')](_0xc4306d[_0x5336('0x32')],qs[_0x5336('0x37')](_0x1b8afd[_0x5336('0x33')]['fields']));_0x21fa8c['attributes']=_0x21fa8c[_0x5336('0x35')][_0x5336('0x38')]?_0x21fa8c['attributes']:_0xc4306d['model'];_0x21fa8c['order']=qs['sort'](_0x1b8afd[_0x5336('0x33')][_0x5336('0x3b')]);_0x21fa8c['where']=qs[_0x5336('0x34')](_[_0x5336('0x3d')](_0x1b8afd[_0x5336('0x33')],_0xc4306d[_0x5336('0x34')]));if(_0x1b8afd[_0x5336('0x33')][_0x5336('0x3e')]){_0x21fa8c[_0x5336('0x3c')]=_[_0x5336('0x40')](_0x21fa8c['where'],{'$or':_[_0x5336('0x2d')](_0x21fa8c['attributes'],function(_0xceec4c){var _0x4f1146={};_0x4f1146[_0xceec4c]={'$like':'%'+_0x1b8afd[_0x5336('0x33')][_0x5336('0x3e')]+'%'};return _0x4f1146;})});}_0x21fa8c=_[_0x5336('0x40')]({},_0x21fa8c,_0x1b8afd[_0x5336('0x41')]);return _0x4399b4['getActions'](_0x21fa8c);}})[_0x5336('0x27')](function(_0x35ce28){if(_0x35ce28){_0x12604e=_0x35ce28[_0x5336('0x38')];if(!_0x1b8afd['query'][_0x5336('0x39')]('nolimit')){_0x21fa8c[_0x5336('0x1e')]=qs[_0x5336('0x1e')](_0x1b8afd['query']['limit']);_0x21fa8c[_0x5336('0x1d')]=qs[_0x5336('0x1d')](_0x1b8afd['query']['offset']);}return _0x4399b4['getActions'](_0x21fa8c);}})[_0x5336('0x27')](function(_0x362eba){if(_0x362eba){return _0x362eba?{'count':_0x12604e,'rows':_0x362eba}:null;}})[_0x5336('0x27')](respondWithResult(_0x10af6c,null))[_0x5336('0x47')](handleError(_0x10af6c,null));}; \ No newline at end of file +var _0x6a2e=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','UserProfileResource','error','stack','name','send','index','map','Trigger','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Triggers','userProfileId','autoAssociation','destroy','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','order','getAllConditions','getAnyConditions','addAction','TriggerId','getActions','Action','pick','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x286ae3,_0x4c22e3){var _0x121ed2=function(_0x723670){while(--_0x723670){_0x286ae3['push'](_0x286ae3['shift']());}};_0x121ed2(++_0x4c22e3);}(_0x6a2e,0x181));var _0xe6a2=function(_0x54b3f1,_0x32778f){_0x54b3f1=_0x54b3f1-0x0;var _0x513641=_0x6a2e[_0x54b3f1];return _0x513641;};'use strict';var emlformat=require(_0xe6a2('0x0'));var rimraf=require(_0xe6a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe6a2('0x2'));var rp=require(_0xe6a2('0x3'));var moment=require('moment');var BPromise=require(_0xe6a2('0x4'));var Mustache=require(_0xe6a2('0x5'));var util=require(_0xe6a2('0x6'));var path=require(_0xe6a2('0x7'));var sox=require(_0xe6a2('0x8'));var csv=require(_0xe6a2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe6a2('0xa'));var _=require(_0xe6a2('0xb'));var squel=require(_0xe6a2('0xc'));var crypto=require(_0xe6a2('0xd'));var jsforce=require(_0xe6a2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe6a2('0x9'));var querystring=require('querystring');var Papa=require(_0xe6a2('0xf'));var Redis=require(_0xe6a2('0x10'));var authService=require(_0xe6a2('0x11'));var qs=require(_0xe6a2('0x12'));var as=require(_0xe6a2('0x13'));var hardwareService=require(_0xe6a2('0x14'));var logger=require(_0xe6a2('0x15'))(_0xe6a2('0x16'));var utils=require(_0xe6a2('0x17'));var config=require(_0xe6a2('0x18'));var licenseUtil=require(_0xe6a2('0x19'));var db=require(_0xe6a2('0x1a'))['db'];function respondWithStatusCode(_0x34605a,_0x220e24){_0x220e24=_0x220e24||0xcc;return function(_0x5918ac){if(_0x5918ac){return _0x34605a[_0xe6a2('0x1b')](_0x220e24);}return _0x34605a[_0xe6a2('0x1c')](_0x220e24)[_0xe6a2('0x1d')]();};}function respondWithResult(_0x35c8e0,_0x5ccdc1){_0x5ccdc1=_0x5ccdc1||0xc8;return function(_0x475a83){if(_0x475a83){return _0x35c8e0[_0xe6a2('0x1c')](_0x5ccdc1)[_0xe6a2('0x1e')](_0x475a83);}};}function respondWithFilteredResult(_0x3fbeed,_0x375618){return function(_0x36cdd4){if(_0x36cdd4){var _0x46af57=typeof _0x375618[_0xe6a2('0x1f')]===_0xe6a2('0x20')&&typeof _0x375618[_0xe6a2('0x21')]===_0xe6a2('0x20');var _0x99ef6=_0x36cdd4[_0xe6a2('0x22')];var _0xe2a889=_0x46af57?0x0:_0x375618[_0xe6a2('0x1f')];var _0x287887=_0x46af57?_0x36cdd4['count']:_0x375618[_0xe6a2('0x1f')]+_0x375618['limit'];var _0x4572a2;if(_0x287887>=_0x99ef6){_0x287887=_0x99ef6;_0x4572a2=0xc8;}else{_0x4572a2=0xce;}_0x3fbeed[_0xe6a2('0x1c')](_0x4572a2);return _0x3fbeed[_0xe6a2('0x23')](_0xe6a2('0x24'),_0xe2a889+'-'+_0x287887+'/'+_0x99ef6)['json'](_0x36cdd4);}return null;};}function patchUpdates(_0x795d58){return function(_0x30896e){try{jsonpatch['apply'](_0x30896e,_0x795d58,!![]);}catch(_0x1e896e){return BPromise['reject'](_0x1e896e);}return _0x30896e[_0xe6a2('0x25')]();};}function saveUpdates(_0x169acd,_0x2c5586){return function(_0x3c1e24){if(_0x3c1e24){return _0x3c1e24[_0xe6a2('0x26')](_0x169acd)[_0xe6a2('0x27')](function(_0x1c3c76){return _0x1c3c76;});}return null;};}function removeEntity(_0x5e54e4,_0x4ec59d){return function(_0x21df31){if(_0x21df31){return _0x21df31['destroy']()[_0xe6a2('0x27')](function(){var _0x2bbbb6=_0x21df31[_0xe6a2('0x28')]({'plain':!![]});var _0x263a7f='Triggers';return db[_0xe6a2('0x29')]['destroy']({'where':{'type':_0x263a7f,'resourceId':_0x2bbbb6['id']}})[_0xe6a2('0x27')](function(){return _0x21df31;});})[_0xe6a2('0x27')](function(){_0x5e54e4[_0xe6a2('0x1c')](0xcc)[_0xe6a2('0x1d')]();});}};}function handleEntityNotFound(_0x1043c0,_0x42e6c0){return function(_0x5384b4){if(!_0x5384b4){_0x1043c0[_0xe6a2('0x1b')](0x194);}return _0x5384b4;};}function handleError(_0x46dd3d,_0x3a8947){_0x3a8947=_0x3a8947||0x1f4;return function(_0x3688fd){logger[_0xe6a2('0x2a')](_0x3688fd[_0xe6a2('0x2b')]);if(_0x3688fd[_0xe6a2('0x2c')]){delete _0x3688fd[_0xe6a2('0x2c')];}_0x46dd3d['status'](_0x3a8947)[_0xe6a2('0x2d')](_0x3688fd);};}exports[_0xe6a2('0x2e')]=function(_0x48a234,_0x253241){var _0x3d132c={},_0x3476df={},_0xb9890={'count':0x0,'rows':[]};var _0x5dac31=_[_0xe6a2('0x2f')](db[_0xe6a2('0x30')]['rawAttributes'],function(_0x467493){return{'name':_0x467493[_0xe6a2('0x31')],'type':_0x467493[_0xe6a2('0x32')][_0xe6a2('0x33')]};});_0x3476df[_0xe6a2('0x34')]=_[_0xe6a2('0x2f')](_0x5dac31,_0xe6a2('0x2c'));_0x3476df[_0xe6a2('0x35')]=_['keys'](_0x48a234[_0xe6a2('0x35')]);_0x3476df['filters']=_['intersection'](_0x3476df['model'],_0x3476df[_0xe6a2('0x35')]);_0x3d132c[_0xe6a2('0x36')]=_['intersection'](_0x3476df['model'],qs[_0xe6a2('0x37')](_0x48a234[_0xe6a2('0x35')][_0xe6a2('0x37')]));_0x3d132c[_0xe6a2('0x36')]=_0x3d132c[_0xe6a2('0x36')][_0xe6a2('0x38')]?_0x3d132c[_0xe6a2('0x36')]:_0x3476df[_0xe6a2('0x34')];if(!_0x48a234[_0xe6a2('0x35')][_0xe6a2('0x39')](_0xe6a2('0x3a'))){_0x3d132c[_0xe6a2('0x21')]=qs[_0xe6a2('0x21')](_0x48a234[_0xe6a2('0x35')][_0xe6a2('0x21')]);_0x3d132c[_0xe6a2('0x1f')]=qs['offset'](_0x48a234[_0xe6a2('0x35')][_0xe6a2('0x1f')]);}_0x3d132c['order']=qs['sort'](_0x48a234[_0xe6a2('0x35')][_0xe6a2('0x3b')]);_0x3d132c['where']=qs[_0xe6a2('0x3c')](_['pick'](_0x48a234['query'],_0x3476df[_0xe6a2('0x3c')]),_0x5dac31);if(_0x48a234[_0xe6a2('0x35')][_0xe6a2('0x3d')]){_0x3d132c[_0xe6a2('0x3e')]=_[_0xe6a2('0x3f')](_0x3d132c[_0xe6a2('0x3e')],{'$or':_[_0xe6a2('0x2f')](_0x5dac31,function(_0xeeff90){if(_0xeeff90['type']!==_0xe6a2('0x40')){var _0x545936={};_0x545936[_0xeeff90[_0xe6a2('0x2c')]]={'$like':'%'+_0x48a234[_0xe6a2('0x35')][_0xe6a2('0x3d')]+'%'};return _0x545936;}})});}_0x3d132c=_[_0xe6a2('0x3f')]({},_0x3d132c,_0x48a234[_0xe6a2('0x41')]);var _0x4811ea={'where':_0x3d132c[_0xe6a2('0x3e')]};return db['Trigger']['count'](_0x4811ea)[_0xe6a2('0x27')](function(_0x41b30b){_0xb9890[_0xe6a2('0x22')]=_0x41b30b;if(_0x48a234[_0xe6a2('0x35')]['includeAll']){_0x3d132c[_0xe6a2('0x42')]=[{'all':!![]}];}return db[_0xe6a2('0x30')][_0xe6a2('0x43')](_0x3d132c);})[_0xe6a2('0x27')](function(_0x2078bc){_0xb9890[_0xe6a2('0x44')]=_0x2078bc;return _0xb9890;})['then'](respondWithFilteredResult(_0x253241,_0x3d132c))[_0xe6a2('0x45')](handleError(_0x253241,null));};exports[_0xe6a2('0x46')]=function(_0x974a35,_0x4c22d2){var _0x29965d={'raw':![],'where':{'id':_0x974a35[_0xe6a2('0x47')]['id']}},_0x1a43ee={};_0x1a43ee[_0xe6a2('0x34')]=_[_0xe6a2('0x48')](db['Trigger'][_0xe6a2('0x49')]);_0x1a43ee[_0xe6a2('0x35')]=_[_0xe6a2('0x48')](_0x974a35[_0xe6a2('0x35')]);_0x1a43ee[_0xe6a2('0x3c')]=_[_0xe6a2('0x4a')](_0x1a43ee[_0xe6a2('0x34')],_0x1a43ee[_0xe6a2('0x35')]);_0x29965d['attributes']=_['intersection'](_0x1a43ee[_0xe6a2('0x34')],qs[_0xe6a2('0x37')](_0x974a35[_0xe6a2('0x35')][_0xe6a2('0x37')]));_0x29965d[_0xe6a2('0x36')]=_0x29965d[_0xe6a2('0x36')][_0xe6a2('0x38')]?_0x29965d[_0xe6a2('0x36')]:_0x1a43ee['model'];if(_0x974a35[_0xe6a2('0x35')][_0xe6a2('0x4b')]){_0x29965d['include']=[{'all':!![]}];}_0x29965d=_['merge']({},_0x29965d,_0x974a35[_0xe6a2('0x41')]);return db[_0xe6a2('0x30')][_0xe6a2('0x4c')](_0x29965d)['then'](handleEntityNotFound(_0x4c22d2,null))[_0xe6a2('0x27')](respondWithResult(_0x4c22d2,null))['catch'](handleError(_0x4c22d2,null));};exports[_0xe6a2('0x4d')]=function(_0x3ba80c,_0x3832be){return db[_0xe6a2('0x30')][_0xe6a2('0x4d')](_0x3ba80c[_0xe6a2('0x4e')],{})[_0xe6a2('0x27')](function(_0x3794b3){var _0x18229e=_0x3ba80c['user'][_0xe6a2('0x28')]({'plain':!![]});if(!_0x18229e)throw new Error(_0xe6a2('0x4f'));if(_0x18229e['role']===_0xe6a2('0x50')){var _0x23abaf=_0x3794b3[_0xe6a2('0x28')]({'plain':!![]});var _0xd2997c=_0xe6a2('0x51');return db['UserProfileSection']['find']({'where':{'name':_0xd2997c,'userProfileId':_0x18229e[_0xe6a2('0x52')]},'raw':!![]})['then'](function(_0x38196f){if(_0x38196f&&_0x38196f[_0xe6a2('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x23abaf[_0xe6a2('0x2c')],'resourceId':_0x23abaf['id'],'type':_0x38196f[_0xe6a2('0x2c')],'sectionId':_0x38196f['id']},{})['then'](function(){return _0x3794b3;});}else{return _0x3794b3;}})[_0xe6a2('0x45')](function(_0xa090c8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa090c8);throw _0xa090c8;});}return _0x3794b3;})['then'](respondWithResult(_0x3832be,0xc9))[_0xe6a2('0x45')](handleError(_0x3832be,null));};exports[_0xe6a2('0x26')]=function(_0x1c4ce3,_0x134cc3){if(_0x1c4ce3['body']['id']){delete _0x1c4ce3[_0xe6a2('0x4e')]['id'];}return db[_0xe6a2('0x30')][_0xe6a2('0x4c')]({'where':{'id':_0x1c4ce3[_0xe6a2('0x47')]['id']}})[_0xe6a2('0x27')](handleEntityNotFound(_0x134cc3,null))['then'](saveUpdates(_0x1c4ce3[_0xe6a2('0x4e')],null))[_0xe6a2('0x27')](respondWithResult(_0x134cc3,null))[_0xe6a2('0x45')](handleError(_0x134cc3,null));};exports[_0xe6a2('0x54')]=function(_0x5e0ec4,_0x46293d){return db[_0xe6a2('0x30')][_0xe6a2('0x4c')]({'where':{'id':_0x5e0ec4['params']['id']}})['then'](handleEntityNotFound(_0x46293d,null))[_0xe6a2('0x27')](removeEntity(_0x46293d,null))['catch'](handleError(_0x46293d,null));};exports['addAllCondition']=function(_0x2ad6bf,_0x3b5a65,_0x17274d){if(_0x2ad6bf[_0xe6a2('0x4e')]['id']){delete _0x2ad6bf[_0xe6a2('0x4e')]['id'];}return db[_0xe6a2('0x30')][_0xe6a2('0x4c')]({'where':{'id':_0x2ad6bf[_0xe6a2('0x47')]['id']}})[_0xe6a2('0x27')](handleEntityNotFound(_0x3b5a65,null))[_0xe6a2('0x27')](function(_0x19fc09){if(_0x19fc09){_0x2ad6bf[_0xe6a2('0x4e')][_0xe6a2('0x55')]=_0x19fc09['id'];return db[_0xe6a2('0x56')][_0xe6a2('0x4d')](_0x2ad6bf[_0xe6a2('0x4e')]);}})[_0xe6a2('0x27')](respondWithResult(_0x3b5a65,null))[_0xe6a2('0x45')](handleError(_0x3b5a65,null));};exports[_0xe6a2('0x57')]=function(_0x337074,_0x5ed125,_0x7b2852){if(_0x337074['body']['id']){delete _0x337074[_0xe6a2('0x4e')]['id'];}return db['Trigger']['find']({'where':{'id':_0x337074['params']['id']}})[_0xe6a2('0x27')](handleEntityNotFound(_0x5ed125,null))[_0xe6a2('0x27')](function(_0x3de9f5){if(_0x3de9f5){_0x337074['body'][_0xe6a2('0x58')]=_0x3de9f5['id'];return db[_0xe6a2('0x56')][_0xe6a2('0x4d')](_0x337074[_0xe6a2('0x4e')]);}})[_0xe6a2('0x27')](respondWithResult(_0x5ed125,null))[_0xe6a2('0x45')](handleError(_0x5ed125,null));};exports['getAllConditions']=function(_0x113ce6,_0x2df595,_0xdaa414){var _0x4ddc44={};var _0x237791={};var _0x401194;var _0x3f38d7;return db[_0xe6a2('0x30')][_0xe6a2('0x59')]({'where':{'id':_0x113ce6[_0xe6a2('0x47')]['id']}})[_0xe6a2('0x27')](handleEntityNotFound(_0x2df595,null))[_0xe6a2('0x27')](function(_0x4d0709){if(_0x4d0709){_0x401194=_0x4d0709;_0x237791[_0xe6a2('0x34')]=_[_0xe6a2('0x48')](db[_0xe6a2('0x56')][_0xe6a2('0x49')]);_0x237791['query']=_[_0xe6a2('0x48')](_0x113ce6[_0xe6a2('0x35')]);_0x237791['filters']=_[_0xe6a2('0x4a')](_0x237791['model'],_0x237791['query']);_0x4ddc44[_0xe6a2('0x36')]=_[_0xe6a2('0x4a')](_0x237791[_0xe6a2('0x34')],qs['fields'](_0x113ce6['query'][_0xe6a2('0x37')]));_0x4ddc44[_0xe6a2('0x36')]=_0x4ddc44[_0xe6a2('0x36')]['length']?_0x4ddc44[_0xe6a2('0x36')]:_0x237791[_0xe6a2('0x34')];_0x4ddc44[_0xe6a2('0x5a')]=qs[_0xe6a2('0x3b')](_0x113ce6[_0xe6a2('0x35')][_0xe6a2('0x3b')]);_0x4ddc44[_0xe6a2('0x3e')]=qs['filters'](_['pick'](_0x113ce6['query'],_0x237791[_0xe6a2('0x3c')]));if(_0x113ce6[_0xe6a2('0x35')]['filter']){_0x4ddc44[_0xe6a2('0x3e')]=_['merge'](_0x4ddc44[_0xe6a2('0x3e')],{'$or':_[_0xe6a2('0x2f')](_0x4ddc44[_0xe6a2('0x36')],function(_0x2fd563){var _0x27a381={};_0x27a381[_0x2fd563]={'$like':'%'+_0x113ce6['query'][_0xe6a2('0x3d')]+'%'};return _0x27a381;})});}_0x4ddc44=_['merge']({},_0x4ddc44,_0x113ce6['options']);return _0x401194[_0xe6a2('0x5b')](_0x4ddc44);}})[_0xe6a2('0x27')](function(_0xe0506b){if(_0xe0506b){_0x3f38d7=_0xe0506b[_0xe6a2('0x38')];if(!_0x113ce6['query']['hasOwnProperty'](_0xe6a2('0x3a'))){_0x4ddc44['limit']=qs['limit'](_0x113ce6['query']['limit']);_0x4ddc44[_0xe6a2('0x1f')]=qs[_0xe6a2('0x1f')](_0x113ce6[_0xe6a2('0x35')][_0xe6a2('0x1f')]);}return _0x401194[_0xe6a2('0x5b')](_0x4ddc44);}})[_0xe6a2('0x27')](function(_0x2dbd37){if(_0x2dbd37){return _0x2dbd37?{'count':_0x3f38d7,'rows':_0x2dbd37}:null;}})[_0xe6a2('0x27')](respondWithResult(_0x2df595,null))['catch'](handleError(_0x2df595,null));};exports['getAnyConditions']=function(_0x400554,_0x5b5448,_0x379584){var _0x312624={};var _0x1a7ce4={};var _0x2e4717;var _0x122730;return db[_0xe6a2('0x30')]['findOne']({'where':{'id':_0x400554[_0xe6a2('0x47')]['id']}})[_0xe6a2('0x27')](handleEntityNotFound(_0x5b5448,null))[_0xe6a2('0x27')](function(_0x4d51ab){if(_0x4d51ab){_0x2e4717=_0x4d51ab;_0x1a7ce4[_0xe6a2('0x34')]=_[_0xe6a2('0x48')](db[_0xe6a2('0x56')][_0xe6a2('0x49')]);_0x1a7ce4[_0xe6a2('0x35')]=_[_0xe6a2('0x48')](_0x400554[_0xe6a2('0x35')]);_0x1a7ce4['filters']=_['intersection'](_0x1a7ce4[_0xe6a2('0x34')],_0x1a7ce4['query']);_0x312624[_0xe6a2('0x36')]=_[_0xe6a2('0x4a')](_0x1a7ce4[_0xe6a2('0x34')],qs[_0xe6a2('0x37')](_0x400554[_0xe6a2('0x35')][_0xe6a2('0x37')]));_0x312624['attributes']=_0x312624[_0xe6a2('0x36')][_0xe6a2('0x38')]?_0x312624[_0xe6a2('0x36')]:_0x1a7ce4[_0xe6a2('0x34')];_0x312624[_0xe6a2('0x5a')]=qs[_0xe6a2('0x3b')](_0x400554[_0xe6a2('0x35')][_0xe6a2('0x3b')]);_0x312624[_0xe6a2('0x3e')]=qs[_0xe6a2('0x3c')](_['pick'](_0x400554['query'],_0x1a7ce4['filters']));if(_0x400554[_0xe6a2('0x35')]['filter']){_0x312624[_0xe6a2('0x3e')]=_[_0xe6a2('0x3f')](_0x312624[_0xe6a2('0x3e')],{'$or':_[_0xe6a2('0x2f')](_0x312624[_0xe6a2('0x36')],function(_0x48962d){var _0x201a2d={};_0x201a2d[_0x48962d]={'$like':'%'+_0x400554['query']['filter']+'%'};return _0x201a2d;})});}_0x312624=_[_0xe6a2('0x3f')]({},_0x312624,_0x400554[_0xe6a2('0x41')]);return _0x2e4717['getAnyConditions'](_0x312624);}})[_0xe6a2('0x27')](function(_0x3934c4){if(_0x3934c4){_0x122730=_0x3934c4[_0xe6a2('0x38')];if(!_0x400554[_0xe6a2('0x35')][_0xe6a2('0x39')](_0xe6a2('0x3a'))){_0x312624['limit']=qs[_0xe6a2('0x21')](_0x400554[_0xe6a2('0x35')][_0xe6a2('0x21')]);_0x312624['offset']=qs[_0xe6a2('0x1f')](_0x400554[_0xe6a2('0x35')][_0xe6a2('0x1f')]);}return _0x2e4717[_0xe6a2('0x5c')](_0x312624);}})[_0xe6a2('0x27')](function(_0x5c8d69){if(_0x5c8d69){return _0x5c8d69?{'count':_0x122730,'rows':_0x5c8d69}:null;}})['then'](respondWithResult(_0x5b5448,null))[_0xe6a2('0x45')](handleError(_0x5b5448,null));};exports[_0xe6a2('0x5d')]=function(_0x42588d,_0xe2f7cf,_0x18c8db){if(_0x42588d[_0xe6a2('0x4e')]['id']){delete _0x42588d['body']['id'];}return db[_0xe6a2('0x30')][_0xe6a2('0x4c')]({'where':{'id':_0x42588d[_0xe6a2('0x47')]['id']}})[_0xe6a2('0x27')](handleEntityNotFound(_0xe2f7cf,null))[_0xe6a2('0x27')](function(_0x34de88){if(_0x34de88){_0x42588d[_0xe6a2('0x4e')][_0xe6a2('0x5e')]=_0x34de88['id'];return db['Action'][_0xe6a2('0x4d')](_0x42588d[_0xe6a2('0x4e')]);}})[_0xe6a2('0x27')](respondWithResult(_0xe2f7cf,null))['catch'](handleError(_0xe2f7cf,null));};exports[_0xe6a2('0x5f')]=function(_0x2e48e0,_0x4b8ef9,_0x9a6317){var _0xa6cef5={};var _0x33b404={};var _0x4fbcab;var _0x4072ef;return db[_0xe6a2('0x30')][_0xe6a2('0x59')]({'where':{'id':_0x2e48e0[_0xe6a2('0x47')]['id']}})[_0xe6a2('0x27')](handleEntityNotFound(_0x4b8ef9,null))[_0xe6a2('0x27')](function(_0x542400){if(_0x542400){_0x4fbcab=_0x542400;_0x33b404[_0xe6a2('0x34')]=_[_0xe6a2('0x48')](db[_0xe6a2('0x60')]['rawAttributes']);_0x33b404['query']=_['keys'](_0x2e48e0[_0xe6a2('0x35')]);_0x33b404[_0xe6a2('0x3c')]=_['intersection'](_0x33b404[_0xe6a2('0x34')],_0x33b404[_0xe6a2('0x35')]);_0xa6cef5[_0xe6a2('0x36')]=_['intersection'](_0x33b404['model'],qs[_0xe6a2('0x37')](_0x2e48e0[_0xe6a2('0x35')][_0xe6a2('0x37')]));_0xa6cef5[_0xe6a2('0x36')]=_0xa6cef5[_0xe6a2('0x36')][_0xe6a2('0x38')]?_0xa6cef5[_0xe6a2('0x36')]:_0x33b404['model'];_0xa6cef5[_0xe6a2('0x5a')]=qs[_0xe6a2('0x3b')](_0x2e48e0[_0xe6a2('0x35')][_0xe6a2('0x3b')]);_0xa6cef5[_0xe6a2('0x3e')]=qs['filters'](_[_0xe6a2('0x61')](_0x2e48e0[_0xe6a2('0x35')],_0x33b404[_0xe6a2('0x3c')]));if(_0x2e48e0[_0xe6a2('0x35')][_0xe6a2('0x3d')]){_0xa6cef5[_0xe6a2('0x3e')]=_[_0xe6a2('0x3f')](_0xa6cef5[_0xe6a2('0x3e')],{'$or':_[_0xe6a2('0x2f')](_0xa6cef5[_0xe6a2('0x36')],function(_0x225370){var _0x5903a1={};_0x5903a1[_0x225370]={'$like':'%'+_0x2e48e0[_0xe6a2('0x35')][_0xe6a2('0x3d')]+'%'};return _0x5903a1;})});}_0xa6cef5=_[_0xe6a2('0x3f')]({},_0xa6cef5,_0x2e48e0['options']);return _0x4fbcab[_0xe6a2('0x5f')](_0xa6cef5);}})[_0xe6a2('0x27')](function(_0x21e97a){if(_0x21e97a){_0x4072ef=_0x21e97a['length'];if(!_0x2e48e0[_0xe6a2('0x35')][_0xe6a2('0x39')](_0xe6a2('0x3a'))){_0xa6cef5['limit']=qs[_0xe6a2('0x21')](_0x2e48e0[_0xe6a2('0x35')][_0xe6a2('0x21')]);_0xa6cef5[_0xe6a2('0x1f')]=qs[_0xe6a2('0x1f')](_0x2e48e0[_0xe6a2('0x35')][_0xe6a2('0x1f')]);}return _0x4fbcab[_0xe6a2('0x5f')](_0xa6cef5);}})[_0xe6a2('0x27')](function(_0x378742){if(_0x378742){return _0x378742?{'count':_0x4072ef,'rows':_0x378742}:null;}})[_0xe6a2('0x27')](respondWithResult(_0x4b8ef9,null))[_0xe6a2('0x45')](handleError(_0x4b8ef9,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 0c1e258..66fabe6 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 _0x5243=['rimraf','./trigger.attributes','define','Trigger','tools_triggers','lodash','api','moment','path'];(function(_0x3fe1ba,_0x1a33c5){var _0x5df1b4=function(_0x55d7c3){while(--_0x55d7c3){_0x3fe1ba['push'](_0x3fe1ba['shift']());}};_0x5df1b4(++_0x1a33c5);}(_0x5243,0x71));var _0x3524=function(_0x2a2eab,_0x5d7e94){_0x2a2eab=_0x2a2eab-0x0;var _0x22a24a=_0x5243[_0x2a2eab];return _0x22a24a;};'use strict';var _=require(_0x3524('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3524('0x1'));var moment=require(_0x3524('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3524('0x3'));var rimraf=require(_0x3524('0x4'));var config=require('../../config/environment');var attributes=require(_0x3524('0x5'));module['exports']=function(_0x2d8995,_0x564239){return _0x2d8995[_0x3524('0x6')](_0x3524('0x7'),attributes,{'tableName':_0x3524('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3645=['Trigger','tools_triggers','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports','define'];(function(_0x3082bc,_0xb0be8d){var _0x41566d=function(_0x56dd44){while(--_0x56dd44){_0x3082bc['push'](_0x3082bc['shift']());}};_0x41566d(++_0xb0be8d);}(_0x3645,0x154));var _0x5364=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x3645[_0x2d364e];return _0x1b9312;};'use strict';var _=require('lodash');var util=require(_0x5364('0x0'));var logger=require(_0x5364('0x1'))(_0x5364('0x2'));var moment=require(_0x5364('0x3'));var BPromise=require(_0x5364('0x4'));var rp=require(_0x5364('0x5'));var fs=require('fs');var path=require(_0x5364('0x6'));var rimraf=require('rimraf');var config=require(_0x5364('0x7'));var attributes=require(_0x5364('0x8'));module[_0x5364('0x9')]=function(_0x1f9c6b,_0x417c44){return _0x1f9c6b[_0x5364('0xa')](_0x5364('0xb'),attributes,{'tableName':_0x5364('0xc'),'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 a2cbc6a..1c9098c 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 _0xc028=['catch','GetTrigger','Trigger','findAll','options','attributes','limit','include','model','map','ShowTrigger','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Trigger,\x20%s,\x20%s','info','result'];(function(_0x2f8805,_0x2f1d21){var _0xa16375=function(_0x1c5bcc){while(--_0x1c5bcc){_0x2f8805['push'](_0x2f8805['shift']());}};_0xa16375(++_0x2f1d21);}(_0xc028,0x7d));var _0x8c02=function(_0x25a6be,_0x2478d5){_0x25a6be=_0x25a6be-0x0;var _0x28d9e9=_0xc028[_0x25a6be];return _0x28d9e9;};'use strict';var _=require(_0x8c02('0x0'));var util=require(_0x8c02('0x1'));var moment=require(_0x8c02('0x2'));var BPromise=require(_0x8c02('0x3'));var rs=require(_0x8c02('0x4'));var fs=require('fs');var Redis=require(_0x8c02('0x5'));var db=require(_0x8c02('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c02('0x7'))(_0x8c02('0x8'));var config=require(_0x8c02('0x9'));var jayson=require(_0x8c02('0xa'));var client=jayson['client'][_0x8c02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x135a05,_0xb1b6f9,_0x20f854){return new BPromise(function(_0xe163fb,_0x451a04){return client['request'](_0x135a05,_0x20f854)[_0x8c02('0xc')](function(_0x459e23){logger['info']('Trigger,\x20%s,\x20%s',_0xb1b6f9,'request\x20sent');logger[_0x8c02('0xd')](_0x8c02('0xe'),_0xb1b6f9,_0x8c02('0xf'),JSON[_0x8c02('0x10')](_0x459e23));if(_0x459e23[_0x8c02('0x11')]){if(_0x459e23[_0x8c02('0x11')][_0x8c02('0x12')]===0x1f4){logger[_0x8c02('0x11')]('Trigger,\x20%s,\x20%s',_0xb1b6f9,_0x459e23['error'][_0x8c02('0x13')]);return _0x451a04(_0x459e23[_0x8c02('0x11')][_0x8c02('0x13')]);}logger[_0x8c02('0x11')](_0x8c02('0x14'),_0xb1b6f9,_0x459e23['error'][_0x8c02('0x13')]);return _0xe163fb(_0x459e23['error'][_0x8c02('0x13')]);}else{logger[_0x8c02('0x15')](_0x8c02('0x14'),_0xb1b6f9,'request\x20sent');_0xe163fb(_0x459e23[_0x8c02('0x16')][_0x8c02('0x13')]);}})[_0x8c02('0x17')](function(_0x27a399){logger[_0x8c02('0x11')]('Trigger,\x20%s,\x20%s',_0xb1b6f9,_0x27a399);_0x451a04(_0x27a399);});});}exports[_0x8c02('0x18')]=function(_0x56e74f){var _0x16bcde=this;return new Promise(function(_0x3b8099,_0x32be8c){return db[_0x8c02('0x19')][_0x8c02('0x1a')]({'raw':_0x56e74f['options']?_0x56e74f[_0x8c02('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x56e74f[_0x8c02('0x1b')]?_0x56e74f[_0x8c02('0x1b')]['where']||null:null,'attributes':_0x56e74f[_0x8c02('0x1b')]?_0x56e74f['options'][_0x8c02('0x1c')]||null:null,'limit':_0x56e74f['options']?_0x56e74f[_0x8c02('0x1b')][_0x8c02('0x1d')]||null:null,'include':_0x56e74f[_0x8c02('0x1b')]?_0x56e74f[_0x8c02('0x1b')][_0x8c02('0x1e')]?_['map'](_0x56e74f[_0x8c02('0x1b')][_0x8c02('0x1e')],function(_0x10e39b){return{'model':db[_0x10e39b[_0x8c02('0x1f')]],'as':_0x10e39b['as'],'attributes':_0x10e39b[_0x8c02('0x1c')],'include':_0x10e39b[_0x8c02('0x1e')]?_[_0x8c02('0x20')](_0x10e39b[_0x8c02('0x1e')],function(_0x39c669){return{'model':db[_0x39c669[_0x8c02('0x1f')]],'as':_0x39c669['as'],'attributes':_0x39c669['attributes'],'include':_0x39c669[_0x8c02('0x1e')]?_['map'](_0x39c669[_0x8c02('0x1e')],function(_0x372d49){return{'model':db[_0x372d49[_0x8c02('0x1f')]],'as':_0x372d49['as'],'attributes':_0x372d49[_0x8c02('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8c02('0xc')](function(_0x58ac0a){logger[_0x8c02('0x15')]('GetTrigger',_0x56e74f);logger[_0x8c02('0xd')](_0x8c02('0x18'),_0x56e74f,JSON[_0x8c02('0x10')](_0x58ac0a));_0x3b8099(_0x58ac0a);})[_0x8c02('0x17')](function(_0x2f71b9){logger[_0x8c02('0x11')](_0x8c02('0x18'),_0x2f71b9[_0x8c02('0x13')],_0x56e74f);_0x32be8c(_0x16bcde[_0x8c02('0x11')](0x1f4,_0x2f71b9['message']));});});};exports[_0x8c02('0x21')]=function(_0x11703f){var _0x9a539=this;return new Promise(function(_0xabbbd7,_0x340f1c){return db[_0x8c02('0x19')][_0x8c02('0x22')]({'raw':_0x11703f['options']?_0x11703f['options'][_0x8c02('0x23')]===undefined?!![]:![]:!![],'where':_0x11703f[_0x8c02('0x1b')]?_0x11703f[_0x8c02('0x1b')][_0x8c02('0x24')]||null:null,'attributes':_0x11703f[_0x8c02('0x1b')]?_0x11703f[_0x8c02('0x1b')][_0x8c02('0x1c')]||null:null,'include':_0x11703f[_0x8c02('0x1b')]?_0x11703f[_0x8c02('0x1b')][_0x8c02('0x1e')]?_[_0x8c02('0x20')](_0x11703f[_0x8c02('0x1b')][_0x8c02('0x1e')],function(_0x31d732){return{'model':db[_0x31d732['model']],'as':_0x31d732['as'],'attributes':_0x31d732[_0x8c02('0x1c')],'include':_0x31d732[_0x8c02('0x1e')]?_['map'](_0x31d732[_0x8c02('0x1e')],function(_0x550e33){return{'model':db[_0x550e33['model']],'as':_0x550e33['as'],'attributes':_0x550e33['attributes'],'include':_0x550e33[_0x8c02('0x1e')]?_[_0x8c02('0x20')](_0x550e33['include'],function(_0x2f3fcc){return{'model':db[_0x2f3fcc[_0x8c02('0x1f')]],'as':_0x2f3fcc['as'],'attributes':_0x2f3fcc[_0x8c02('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8c02('0xc')](function(_0x304367){logger[_0x8c02('0x15')](_0x8c02('0x21'),_0x11703f);logger[_0x8c02('0xd')](_0x8c02('0x21'),_0x11703f,JSON[_0x8c02('0x10')](_0x304367));_0xabbbd7(_0x304367);})[_0x8c02('0x17')](function(_0x34bace){logger[_0x8c02('0x11')](_0x8c02('0x21'),_0x34bace[_0x8c02('0x13')],_0x11703f);_0x340f1c(_0x9a539[_0x8c02('0x11')](0x1f4,_0x34bace['message']));});});}; \ No newline at end of file +var _0x4083=['attributes','then','ShowTrigger','raw','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrigger','Trigger','options','where','limit','include','map','model'];(function(_0xda84b8,_0x369d6f){var _0x1421bb=function(_0x300ab0){while(--_0x300ab0){_0xda84b8['push'](_0xda84b8['shift']());}};_0x1421bb(++_0x369d6f);}(_0x4083,0x1f4));var _0x3408=function(_0x36a6ff,_0x33d3c1){_0x36a6ff=_0x36a6ff-0x0;var _0x1880d7=_0x4083[_0x36a6ff];return _0x1880d7;};'use strict';var _=require(_0x3408('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3408('0x1'));var rs=require(_0x3408('0x2'));var fs=require('fs');var Redis=require(_0x3408('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3408('0x4'))('rpc');var config=require(_0x3408('0x5'));var jayson=require(_0x3408('0x6'));var client=jayson[_0x3408('0x7')][_0x3408('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5383c9,_0x551f47,_0x2422ee){return new BPromise(function(_0x894505,_0xaf470b){return client[_0x3408('0x9')](_0x5383c9,_0x2422ee)['then'](function(_0x1f19e8){logger[_0x3408('0xa')](_0x3408('0xb'),_0x551f47,_0x3408('0xc'));logger[_0x3408('0xd')](_0x3408('0xe'),_0x551f47,_0x3408('0xc'),JSON[_0x3408('0xf')](_0x1f19e8));if(_0x1f19e8[_0x3408('0x10')]){if(_0x1f19e8[_0x3408('0x10')][_0x3408('0x11')]===0x1f4){logger[_0x3408('0x10')]('Trigger,\x20%s,\x20%s',_0x551f47,_0x1f19e8[_0x3408('0x10')]['message']);return _0xaf470b(_0x1f19e8[_0x3408('0x10')]['message']);}logger['error'](_0x3408('0xb'),_0x551f47,_0x1f19e8[_0x3408('0x10')][_0x3408('0x12')]);return _0x894505(_0x1f19e8['error']['message']);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x551f47,'request\x20sent');_0x894505(_0x1f19e8[_0x3408('0x13')][_0x3408('0x12')]);}})['catch'](function(_0x2603ff){logger[_0x3408('0x10')]('Trigger,\x20%s,\x20%s',_0x551f47,_0x2603ff);_0xaf470b(_0x2603ff);});});}exports[_0x3408('0x14')]=function(_0x13ddcc){var _0x2ad9db=this;return new Promise(function(_0x4ba29a,_0x293c0c){return db[_0x3408('0x15')]['findAll']({'raw':_0x13ddcc[_0x3408('0x16')]?_0x13ddcc[_0x3408('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x13ddcc[_0x3408('0x16')]?_0x13ddcc[_0x3408('0x16')][_0x3408('0x17')]||null:null,'attributes':_0x13ddcc[_0x3408('0x16')]?_0x13ddcc[_0x3408('0x16')]['attributes']||null:null,'limit':_0x13ddcc[_0x3408('0x16')]?_0x13ddcc[_0x3408('0x16')][_0x3408('0x18')]||null:null,'include':_0x13ddcc[_0x3408('0x16')]?_0x13ddcc[_0x3408('0x16')][_0x3408('0x19')]?_[_0x3408('0x1a')](_0x13ddcc['options'][_0x3408('0x19')],function(_0x314f17){return{'model':db[_0x314f17[_0x3408('0x1b')]],'as':_0x314f17['as'],'attributes':_0x314f17['attributes'],'include':_0x314f17[_0x3408('0x19')]?_[_0x3408('0x1a')](_0x314f17[_0x3408('0x19')],function(_0x2ce987){return{'model':db[_0x2ce987[_0x3408('0x1b')]],'as':_0x2ce987['as'],'attributes':_0x2ce987[_0x3408('0x1c')],'include':_0x2ce987['include']?_['map'](_0x2ce987[_0x3408('0x19')],function(_0x35a1b5){return{'model':db[_0x35a1b5[_0x3408('0x1b')]],'as':_0x35a1b5['as'],'attributes':_0x35a1b5[_0x3408('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3408('0x1d')](function(_0x2056ff){logger['info'](_0x3408('0x14'),_0x13ddcc);logger[_0x3408('0xd')](_0x3408('0x14'),_0x13ddcc,JSON['stringify'](_0x2056ff));_0x4ba29a(_0x2056ff);})['catch'](function(_0x1cf263){logger['error'](_0x3408('0x14'),_0x1cf263[_0x3408('0x12')],_0x13ddcc);_0x293c0c(_0x2ad9db['error'](0x1f4,_0x1cf263[_0x3408('0x12')]));});});};exports[_0x3408('0x1e')]=function(_0x308400){var _0x65c54b=this;return new Promise(function(_0x14a724,_0x752b9d){return db[_0x3408('0x15')]['find']({'raw':_0x308400[_0x3408('0x16')]?_0x308400[_0x3408('0x16')][_0x3408('0x1f')]===undefined?!![]:![]:!![],'where':_0x308400[_0x3408('0x16')]?_0x308400[_0x3408('0x16')][_0x3408('0x17')]||null:null,'attributes':_0x308400[_0x3408('0x16')]?_0x308400[_0x3408('0x16')][_0x3408('0x1c')]||null:null,'include':_0x308400['options']?_0x308400[_0x3408('0x16')][_0x3408('0x19')]?_[_0x3408('0x1a')](_0x308400[_0x3408('0x16')]['include'],function(_0x340851){return{'model':db[_0x340851[_0x3408('0x1b')]],'as':_0x340851['as'],'attributes':_0x340851[_0x3408('0x1c')],'include':_0x340851['include']?_['map'](_0x340851[_0x3408('0x19')],function(_0x41cfd0){return{'model':db[_0x41cfd0[_0x3408('0x1b')]],'as':_0x41cfd0['as'],'attributes':_0x41cfd0[_0x3408('0x1c')],'include':_0x41cfd0[_0x3408('0x19')]?_[_0x3408('0x1a')](_0x41cfd0[_0x3408('0x19')],function(_0x410906){return{'model':db[_0x410906[_0x3408('0x1b')]],'as':_0x410906['as'],'attributes':_0x410906['attributes']};}):[]};}):[]};}):[]:[]})[_0x3408('0x1d')](function(_0x1ed34){logger['info']('ShowTrigger',_0x308400);logger[_0x3408('0xd')]('ShowTrigger',_0x308400,JSON[_0x3408('0xf')](_0x1ed34));_0x14a724(_0x1ed34);})[_0x3408('0x20')](function(_0x5725ee){logger['error'](_0x3408('0x1e'),_0x5725ee[_0x3408('0x12')],_0x308400);_0x752b9d(_0x65c54b['error'](0x1f4,_0x5725ee[_0x3408('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index c518b4c..48579e1 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 _0xb921=['index','/:id','show','post','/:id/clone','clone','create','put','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0xb921,0x88));var _0x1b92=function(_0xa72f73,_0x8058d1){_0xa72f73=_0xa72f73-0x0;var _0x190264=_0xb921[_0xa72f73];return _0x190264;};'use strict';var multer=require(_0x1b92('0x0'));var util=require('util');var path=require(_0x1b92('0x1'));var timeout=require(_0x1b92('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1b92('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1b92('0x4'));var config=require(_0x1b92('0x5'));var controller=require(_0x1b92('0x6'));router['get']('/',auth[_0x1b92('0x7')](),controller[_0x1b92('0x8')]);router['get'](_0x1b92('0x9'),auth['isAuthenticated'](),controller[_0x1b92('0xa')]);router[_0x1b92('0xb')](_0x1b92('0xc'),auth['isAuthenticated'](),controller[_0x1b92('0xd')]);router[_0x1b92('0xb')]('/',auth['isAuthenticated'](),controller[_0x1b92('0xe')]);router[_0x1b92('0xf')]('/:id',auth[_0x1b92('0x7')](),controller['update']);router['delete']('/:id',auth[_0x1b92('0x7')](),controller[_0x1b92('0x10')]);module[_0x1b92('0x11')]=router; \ No newline at end of file +var _0x55e5=['clone','create','put','update','delete','destroy','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/clone'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x55e5,0x9e));var _0x555e=function(_0x493f2a,_0x30be54){_0x493f2a=_0x493f2a-0x0;var _0x808e6f=_0x55e5[_0x493f2a];return _0x808e6f;};'use strict';var multer=require(_0x555e('0x0'));var util=require('util');var path=require(_0x555e('0x1'));var timeout=require(_0x555e('0x2'));var express=require('express');var router=express[_0x555e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x555e('0x4'));var config=require(_0x555e('0x5'));var controller=require('./trunk.controller');router[_0x555e('0x6')]('/',auth[_0x555e('0x7')](),controller[_0x555e('0x8')]);router['get'](_0x555e('0x9'),auth[_0x555e('0x7')](),controller[_0x555e('0xa')]);router[_0x555e('0xb')](_0x555e('0xc'),auth['isAuthenticated'](),controller[_0x555e('0xd')]);router[_0x555e('0xb')]('/',auth[_0x555e('0x7')](),controller[_0x555e('0xe')]);router[_0x555e('0xf')](_0x555e('0x9'),auth[_0x555e('0x7')](),controller[_0x555e('0x10')]);router[_0x555e('0x11')](_0x555e('0x9'),auth['isAuthenticated'](),controller[_0x555e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 255ff5b..ada6a01 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 _0x0224=['inband','auto','nonat','outgoing','yes','force_rport,comedia','setDataValue','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','uac','uas','pai','certificate','active','passive','dynamic','update','update,nonat','BOOLEAN','sequelize','name','ENUM','friend','user','STRING','from-voip-provider','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','getDataValue','transport','split','rfc2833','info','shortinfo'];(function(_0x4b13ab,_0x4751e3){var _0x417699=function(_0x311869){while(--_0x311869){_0x4b13ab['push'](_0x4b13ab['shift']());}};_0x417699(++_0x4751e3);}(_0x0224,0xb4));var _0x4022=function(_0xd40536,_0xd6f24){_0xd40536=_0xd40536-0x0;var _0x4ac571=_0x0224[_0xd40536];return _0x4ac571;};'use strict';var Sequelize=require(_0x4022('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4022('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x3'),_0x4022('0x4'),'peer'),'allowNull':![],'defaultValue':_0x4022('0x3')},'context':{'type':Sequelize[_0x4022('0x5')],'allowNull':![],'defaultValue':_0x4022('0x6')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x4022('0x7'),'ALLOWED',_0x4022('0x8'),_0x4022('0x9'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x4022('0x5')]},'permit':{'type':Sequelize[_0x4022('0x5')]},'secret':{'type':Sequelize[_0x4022('0x5')]},'md5secret':{'type':Sequelize[_0x4022('0x5')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x4022('0x5')],'defaultValue':'udp','set':function(_0x28ae55){this['setDataValue']('transport',_0x28ae55?_0x28ae55['join'](','):null);},'get':function(){return this[_0x4022('0xa')](_0x4022('0xb'))?this[_0x4022('0xa')](_0x4022('0xb'))[_0x4022('0xc')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x4022('0x2')](_0x4022('0xd'),_0x4022('0xe'),_0x4022('0xf'),_0x4022('0x10'),_0x4022('0x11')),'defaultValue':_0x4022('0xd')},'directmedia':{'type':Sequelize[_0x4022('0x2')]('yes','no',_0x4022('0x12'),'update',_0x4022('0x13')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4022('0x5')]},'directmediadeny':{'type':Sequelize[_0x4022('0x5')]},'nat':{'type':Sequelize[_0x4022('0x5')],'defaultValue':_0x4022('0x15'),'set':function(_0xae1916){this[_0x4022('0x16')](_0x4022('0x17'),_0xae1916?_0xae1916[_0x4022('0x18')](','):null);},'get':function(){return this[_0x4022('0xa')](_0x4022('0x17'))?this[_0x4022('0xa')]('nat')[_0x4022('0xc')](','):null;},'comment':_0x4022('0x19')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x4022('0x5')]},'pickupgroup':{'type':Sequelize[_0x4022('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4022('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4022('0x5')],'defaultValue':_0x4022('0x1a')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4022('0x1b'),'set':function(_0x44c306){this[_0x4022('0x16')](_0x4022('0x1c'),_0x44c306?_0x44c306[_0x4022('0x18')](';'):_0x4022('0x1b'));},'get':function(){return this[_0x4022('0xa')]('allow')?this[_0x4022('0xa')](_0x4022('0x1c'))[_0x4022('0xc')](';'):null;},'comment':_0x4022('0x1d')},'autoframing':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x4022('0x1e'),'set':function(_0x1f97b4){this['setDataValue'](_0x4022('0x1f'),_0x1f97b4?_0x1f97b4[_0x4022('0x18')](','):null);},'get':function(){return this[_0x4022('0xa')]('insecure')?this[_0x4022('0xa')](_0x4022('0x1f'))[_0x4022('0xc')](','):null;},'comment':_0x4022('0x20')},'trustrpid':{'type':Sequelize['ENUM'](_0x4022('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no',_0x4022('0x21'))},'promiscredir':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no')},'useclientcode':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x4022('0x5')]},'callerid':{'type':Sequelize[_0x4022('0x5')],'defaultValue':_0x4022('0x22')},'amaflags':{'type':Sequelize[_0x4022('0x5')]},'callcounter':{'type':Sequelize[_0x4022('0x2')]('yes','no'),'defaultValue':_0x4022('0x14')},'busylevel':{'type':Sequelize[_0x4022('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x4022('0x14'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x4022('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no',_0x4022('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4022('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x25'),_0x4022('0x26'),'originate')},'session_expires':{'type':Sequelize[_0x4022('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x4022('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x27'),_0x4022('0x28')),'defaultValue':_0x4022('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x4022('0x5')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x4022('0x5')]},'port':{'type':Sequelize[_0x4022('0x23')](0x5)},'qualify':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no'),'defaultValue':_0x4022('0x14')},'keepalive':{'type':Sequelize[_0x4022('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x4022('0x5')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x4022('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x4022('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no',_0x4022('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4022('0x5')]},'callbackextension':{'type':Sequelize[_0x4022('0x5')]},'timert1':{'type':Sequelize[_0x4022('0x23')](0xb)},'timerb':{'type':Sequelize[_0x4022('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x4022('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x4022('0x5')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x4022('0x5')]},'maxforwards':{'type':Sequelize[_0x4022('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x4022('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x4022('0x14'),'no')},'force_avp':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no')},'icesupport':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x4022('0x2')]('yes','no','fingerprint',_0x4022('0x2a'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x4022('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0x4022('0x5')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x4022('0x5')]},'dtlssetup':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x2b'),_0x4022('0x2c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4022('0x5')]},'usereqphone':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4022('0x5')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0x4022('0x2')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x4022('0x5')]},'mohsuggest':{'type':Sequelize[_0x4022('0x5')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x4022('0x2d')},'canreinvite':{'type':Sequelize[_0x4022('0x2')](_0x4022('0x14'),'no',_0x4022('0x12'),_0x4022('0x2e'),_0x4022('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x4022('0x5')]},'active':{'type':Sequelize[_0x4022('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4022('0x5')],'defaultValue':'no'}}; \ No newline at end of file +var _0x82c4=['rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','getDataValue','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]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','accept','refuse','uas','fingerprint','certificate','passive','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x240446,_0x2c7a37){var _0x1ac71e=function(_0x593edb){while(--_0x593edb){_0x240446['push'](_0x240446['shift']());}};_0x1ac71e(++_0x2c7a37);}(_0x82c4,0x1f2));var _0x482c=function(_0x46fc28,_0x4746fb){_0x46fc28=_0x46fc28-0x0;var _0x5888fe=_0x82c4[_0x46fc28];return _0x5888fe;};'use strict';var Sequelize=require(_0x482c('0x0'));module[_0x482c('0x1')]={'name':{'type':Sequelize[_0x482c('0x2')],'allowNull':![],'unique':_0x482c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x482c('0x4')](_0x482c('0x5'),'user',_0x482c('0x6')),'allowNull':![],'defaultValue':_0x482c('0x5')},'context':{'type':Sequelize[_0x482c('0x2')],'allowNull':![],'defaultValue':_0x482c('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0x482c('0x8'),_0x482c('0x9'),_0x482c('0xa'),_0x482c('0xb'),_0x482c('0xc'),_0x482c('0xd'),_0x482c('0xe'),_0x482c('0xf'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x482c('0x2')]},'secret':{'type':Sequelize[_0x482c('0x2')]},'md5secret':{'type':Sequelize[_0x482c('0x2')]},'remotesecret':{'type':Sequelize[_0x482c('0x2')]},'transport':{'type':Sequelize[_0x482c('0x2')],'defaultValue':_0x482c('0x10'),'set':function(_0x1c3b30){this[_0x482c('0x11')](_0x482c('0x12'),_0x1c3b30?_0x1c3b30[_0x482c('0x13')](','):null);},'get':function(){return this['getDataValue'](_0x482c('0x12'))?this['getDataValue'](_0x482c('0x12'))[_0x482c('0x14')](','):null;},'comment':_0x482c('0x15')},'dtmfmode':{'type':Sequelize[_0x482c('0x4')](_0x482c('0x16'),_0x482c('0x17'),_0x482c('0x18'),_0x482c('0x19'),_0x482c('0x1a')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x482c('0x4')](_0x482c('0x1b'),'no',_0x482c('0x1c'),_0x482c('0x1d'),_0x482c('0x1e')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x482c('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x482c('0x2')]},'nat':{'type':Sequelize[_0x482c('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x161500){this[_0x482c('0x11')]('nat',_0x161500?_0x161500['join'](','):null);},'get':function(){return this[_0x482c('0x1f')]('nat')?this[_0x482c('0x1f')](_0x482c('0x20'))[_0x482c('0x14')](','):null;},'comment':_0x482c('0x21')},'callgroup':{'type':Sequelize[_0x482c('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x482c('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x482c('0x2')]},'language':{'type':Sequelize[_0x482c('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x482c('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x482c('0x2')],'defaultValue':_0x482c('0x22')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x482c('0x23'),'set':function(_0x29bad6){this[_0x482c('0x11')](_0x482c('0x24'),_0x29bad6?_0x29bad6['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x482c('0x1f')]('allow')?this[_0x482c('0x1f')](_0x482c('0x24'))[_0x482c('0x14')](';'):null;},'comment':_0x482c('0x25')},'autoframing':{'type':Sequelize['ENUM'](_0x482c('0x1b'),'no')},'insecure':{'type':Sequelize[_0x482c('0x2')],'defaultValue':_0x482c('0x26'),'set':function(_0x1bebe0){this['setDataValue'](_0x482c('0x27'),_0x1bebe0?_0x1bebe0[_0x482c('0x13')](','):null);},'get':function(){return this[_0x482c('0x1f')](_0x482c('0x27'))?this[_0x482c('0x1f')](_0x482c('0x27'))[_0x482c('0x14')](','):null;},'comment':_0x482c('0x28')},'trustrpid':{'type':Sequelize[_0x482c('0x4')](_0x482c('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x482c('0x4')](_0x482c('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x482c('0x4')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0x482c('0x4')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x482c('0x1b'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x482c('0x2')],'defaultValue':_0x482c('0x29')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x482c('0x2a')](0xb)},'allowoverlap':{'type':Sequelize[_0x482c('0x4')](_0x482c('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0x482c('0x4')](_0x482c('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0x482c('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x482c('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0x482c('0x1b'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x482c('0x1b'),'no')},'mailbox':{'type':Sequelize[_0x482c('0x2')]},'session_timers':{'type':Sequelize[_0x482c('0x4')](_0x482c('0x2b'),_0x482c('0x2c'),'originate')},'session_expires':{'type':Sequelize[_0x482c('0x2a')](0xb)},'session_minse':{'type':Sequelize[_0x482c('0x2a')](0xb)},'session_refresher':{'type':Sequelize[_0x482c('0x4')]('uac',_0x482c('0x2d')),'defaultValue':_0x482c('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0x482c('0x2')]},'regexten':{'type':Sequelize[_0x482c('0x2')]},'fromdomain':{'type':Sequelize[_0x482c('0x2')]},'fromuser':{'type':Sequelize[_0x482c('0x2')]},'port':{'type':Sequelize[_0x482c('0x2a')](0x5)},'qualify':{'type':Sequelize[_0x482c('0x4')]('yes','no'),'defaultValue':_0x482c('0x1b')},'keepalive':{'type':Sequelize[_0x482c('0x2a')](0xb)},'defaultip':{'type':Sequelize[_0x482c('0x2')]},'defaultuser':{'type':Sequelize[_0x482c('0x2')]},'rtptimeout':{'type':Sequelize[_0x482c('0x2a')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x482c('0x2a')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x482c('0x2a')](0xb)},'sendrpid':{'type':Sequelize[_0x482c('0x4')](_0x482c('0x1b'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x482c('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x482c('0x2a')](0xb)},'timerb':{'type':Sequelize[_0x482c('0x2a')](0xb)},'qualifyfreq':{'type':Sequelize[_0x482c('0x2a')](0xb)},'contactpermit':{'type':Sequelize[_0x482c('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x482c('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x482c('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x482c('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x482c('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x482c('0x4')](_0x482c('0x1b'),'no')},'icesupport':{'type':Sequelize[_0x482c('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x482c('0x4')](_0x482c('0x1b'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x482c('0x1b'),'no',_0x482c('0x2e'),_0x482c('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x482c('0x2a')](0xb)},'dtlscertfile':{'type':Sequelize[_0x482c('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x482c('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x482c('0x2')]},'dtlscapath':{'type':Sequelize[_0x482c('0x2')]},'dtlssetup':{'type':Sequelize[_0x482c('0x4')]('active',_0x482c('0x30'),_0x482c('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x482c('0x4')](_0x482c('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x482c('0x2')]},'recordofffeature':{'type':Sequelize[_0x482c('0x2')]},'call_limit':{'type':Sequelize[_0x482c('0x2a')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x482c('0x4')](_0x482c('0x1b'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x482c('0x2')]},'mohinterpret':{'type':Sequelize[_0x482c('0x2')]},'mohsuggest':{'type':Sequelize[_0x482c('0x2')]},'parkinglot':{'type':Sequelize[_0x482c('0x2')]},'description':{'type':Sequelize[_0x482c('0x2')]},'host':{'type':Sequelize[_0x482c('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x482c('0x1b'),'no',_0x482c('0x1c'),_0x482c('0x1d'),_0x482c('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x482c('0x2')]},'otherFields':{'type':Sequelize[_0x482c('0x2')]},'active':{'type':Sequelize[_0x482c('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x482c('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index d6ea615..99a2c47 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 _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x9b5bb2,_0x5db315){var _0x2e1e92=function(_0x5621c9){while(--_0x5621c9){_0x9b5bb2['push'](_0x9b5bb2['shift']());}};_0x2e1e92(++_0x5db315);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4e56a8,_0x3b17dc){_0x4e56a8=_0x4e56a8-0x0;var _0x2f9ab6=_0xe5b3[_0x4e56a8];return _0x2f9ab6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file +var _0x54ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','get','updatedAt','omit','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','root','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x20792d,_0x4563d0){var _0x1d6063=function(_0x37da05){while(--_0x37da05){_0x20792d['push'](_0x20792d['shift']());}};_0x1d6063(++_0x4563d0);}(_0x54ef,0x112));var _0xf54e=function(_0x2090b9,_0x16911c){_0x2090b9=_0x2090b9-0x0;var _0xd3d5f3=_0x54ef[_0x2090b9];return _0xd3d5f3;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2033e9,_0x28f776,_0x380f26,_0x5644aa){return new BPromise(function(_0x331732,_0x1bbeaa){var _0x1855fe=_0x5644aa||client;return _0x1855fe[_0xf54e('0x1a')](_0x2033e9,_0x380f26)['then'](function(_0x2366ee){logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,'request\x20sent');logger['debug'](_0xf54e('0x1d'),_0x28f776,_0xf54e('0x1e'),JSON[_0xf54e('0x1f')](_0x2366ee));if(_0x2366ee[_0xf54e('0x20')]){if(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x21')]===0x1f4){logger[_0xf54e('0x20')](_0xf54e('0x1c'),_0x28f776,_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);return _0x1bbeaa(_0x2366ee[_0xf54e('0x20')]['message']);}logger['error'](_0xf54e('0x1c'),_0x28f776,_0x2366ee['error'][_0xf54e('0x22')]);return _0x331732(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);}else{logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,_0xf54e('0x1e'));_0x331732(_0x2366ee[_0xf54e('0x23')][_0xf54e('0x22')]);}})[_0xf54e('0x24')](function(_0x5f9eea){logger[_0xf54e('0x20')]('Trunk,\x20%s,\x20%s',_0x28f776,_0x5f9eea);_0x1bbeaa(_0x5f9eea);});});}function respondWithStatusCode(_0x6f6d29,_0x54f914){_0x54f914=_0x54f914||0xcc;return function(_0x264a8f){if(_0x264a8f){return _0x6f6d29[_0xf54e('0x25')](_0x54f914);}return _0x6f6d29[_0xf54e('0x26')](_0x54f914)[_0xf54e('0x27')]();};}function respondWithResult(_0x3805a7,_0x160160){_0x160160=_0x160160||0xc8;return function(_0x1e08d1){if(_0x1e08d1){return _0x3805a7[_0xf54e('0x26')](_0x160160)[_0xf54e('0x28')](_0x1e08d1);}};}function respondWithFilteredResult(_0x33457f,_0xf6cdd7){return function(_0x39c0ae){if(_0x39c0ae){var _0x2ea001=typeof _0xf6cdd7['offset']===_0xf54e('0x29')&&typeof _0xf6cdd7['limit']===_0xf54e('0x29');var _0x5e63f4=_0x39c0ae[_0xf54e('0x2a')];var _0x269f47=_0x2ea001?0x0:_0xf6cdd7[_0xf54e('0x2b')];var _0xa13cd0=_0x2ea001?_0x39c0ae[_0xf54e('0x2a')]:_0xf6cdd7[_0xf54e('0x2b')]+_0xf6cdd7[_0xf54e('0x2c')];var _0x54bd8f;if(_0xa13cd0>=_0x5e63f4){_0xa13cd0=_0x5e63f4;_0x54bd8f=0xc8;}else{_0x54bd8f=0xce;}_0x33457f['status'](_0x54bd8f);return _0x33457f[_0xf54e('0x2d')](_0xf54e('0x2e'),_0x269f47+'-'+_0xa13cd0+'/'+_0x5e63f4)[_0xf54e('0x28')](_0x39c0ae);}return null;};}function patchUpdates(_0x16d00f){return function(_0xb2d4c4){try{jsonpatch[_0xf54e('0x2f')](_0xb2d4c4,_0x16d00f,!![]);}catch(_0x2b5408){return BPromise[_0xf54e('0x30')](_0x2b5408);}return _0xb2d4c4[_0xf54e('0x31')]();};}function saveUpdates(_0x12edc3,_0x5ea0cc){return function(_0x5f29d3){if(_0x5f29d3){return _0x5f29d3[_0xf54e('0x32')](_0x12edc3)[_0xf54e('0x33')](function(_0x4d8fdd){return _0x4d8fdd;});}return null;};}function removeEntity(_0x3e319c,_0x82e313){return function(_0x379110){if(_0x379110){return _0x379110[_0xf54e('0x34')]()['then'](function(){var _0x54bea4=_0x379110['get']({'plain':!![]});var _0x3c0cca=_0xf54e('0x35');return db[_0xf54e('0x36')][_0xf54e('0x34')]({'where':{'type':_0x3c0cca,'resourceId':_0x54bea4['id']}})[_0xf54e('0x33')](function(){return _0x379110;});})[_0xf54e('0x33')](function(){_0x3e319c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x530cee,_0xc04e04){return function(_0x734187){if(!_0x734187){_0x530cee['sendStatus'](0x194);}return _0x734187;};}function handleError(_0x4d9b06,_0xda1d10){_0xda1d10=_0xda1d10||0x1f4;return function(_0x2c0d30){logger[_0xf54e('0x20')](_0x2c0d30['stack']);if(_0x2c0d30[_0xf54e('0x37')]){delete _0x2c0d30[_0xf54e('0x37')];}_0x4d9b06['status'](_0xda1d10)[_0xf54e('0x38')](_0x2c0d30);};}exports[_0xf54e('0x39')]=function(_0x5af03,_0x1eeeb4){var _0x12ef97={},_0x199056={},_0x4e00b7={'count':0x0,'rows':[]};var _0x5d45cf=_[_0xf54e('0x3a')](db[_0xf54e('0x3b')][_0xf54e('0x3c')],function(_0x4b1f84){return{'name':_0x4b1f84[_0xf54e('0x3d')],'type':_0x4b1f84[_0xf54e('0x3e')][_0xf54e('0x3f')]};});_0x199056[_0xf54e('0x40')]=_[_0xf54e('0x3a')](_0x5d45cf,_0xf54e('0x37'));_0x199056[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x5af03[_0xf54e('0x41')]);_0x199056[_0xf54e('0x43')]=_[_0xf54e('0x44')](_0x199056[_0xf54e('0x40')],_0x199056[_0xf54e('0x41')]);_0x12ef97[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x199056['model'],qs['fields'](_0x5af03['query'][_0xf54e('0x46')]));_0x12ef97[_0xf54e('0x45')]=_0x12ef97['attributes'][_0xf54e('0x47')]?_0x12ef97[_0xf54e('0x45')]:_0x199056[_0xf54e('0x40')];if(!_0x5af03['query'][_0xf54e('0x48')](_0xf54e('0x49'))){_0x12ef97[_0xf54e('0x2c')]=qs[_0xf54e('0x2c')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x2c')]);_0x12ef97[_0xf54e('0x2b')]=qs[_0xf54e('0x2b')](_0x5af03[_0xf54e('0x41')]['offset']);}_0x12ef97[_0xf54e('0x4a')]=qs[_0xf54e('0x4b')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x4b')]);_0x12ef97[_0xf54e('0x4c')]=qs[_0xf54e('0x43')](_['pick'](_0x5af03[_0xf54e('0x41')],_0x199056['filters']),_0x5d45cf);if(_0x5af03[_0xf54e('0x41')]['filter']){_0x12ef97[_0xf54e('0x4c')]=_[_0xf54e('0x4d')](_0x12ef97[_0xf54e('0x4c')],{'$or':_['map'](_0x5d45cf,function(_0x1af35d){if(_0x1af35d[_0xf54e('0x3e')]!==_0xf54e('0x4e')){var _0x32fb46={};_0x32fb46[_0x1af35d[_0xf54e('0x37')]]={'$like':'%'+_0x5af03['query'][_0xf54e('0x4f')]+'%'};return _0x32fb46;}})});}_0x12ef97=_[_0xf54e('0x4d')]({},_0x12ef97,_0x5af03[_0xf54e('0x50')]);var _0x45592b={'where':_0x12ef97['where']};return db[_0xf54e('0x3b')][_0xf54e('0x2a')](_0x45592b)['then'](function(_0x22c842){_0x4e00b7[_0xf54e('0x2a')]=_0x22c842;if(_0x5af03[_0xf54e('0x41')][_0xf54e('0x51')]){_0x12ef97['include']=[{'all':!![]}];}return db[_0xf54e('0x3b')][_0xf54e('0x52')](_0x12ef97);})[_0xf54e('0x33')](function(_0xb4654f){_0x4e00b7[_0xf54e('0x53')]=_0xb4654f;return _0x4e00b7;})[_0xf54e('0x33')](respondWithFilteredResult(_0x1eeeb4,_0x12ef97))[_0xf54e('0x24')](handleError(_0x1eeeb4,null));};exports[_0xf54e('0x54')]=function(_0x15bfef,_0x21f2f8){var _0xaf9bf0={'raw':![],'where':{'id':_0x15bfef[_0xf54e('0x55')]['id']}},_0x1f4cf8={};_0x1f4cf8[_0xf54e('0x40')]=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x1f4cf8[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x15bfef[_0xf54e('0x41')]);_0x1f4cf8['filters']=_['intersection'](_0x1f4cf8[_0xf54e('0x40')],_0x1f4cf8[_0xf54e('0x41')]);_0xaf9bf0[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x1f4cf8[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x15bfef[_0xf54e('0x41')][_0xf54e('0x46')]));_0xaf9bf0[_0xf54e('0x45')]=_0xaf9bf0[_0xf54e('0x45')][_0xf54e('0x47')]?_0xaf9bf0['attributes']:_0x1f4cf8[_0xf54e('0x40')];if(_0x15bfef[_0xf54e('0x41')][_0xf54e('0x51')]){_0xaf9bf0[_0xf54e('0x56')]=[{'all':!![]}];}_0xaf9bf0=_[_0xf54e('0x4d')]({},_0xaf9bf0,_0x15bfef[_0xf54e('0x50')]);return db[_0xf54e('0x3b')]['find'](_0xaf9bf0)[_0xf54e('0x33')](handleEntityNotFound(_0x21f2f8,null))[_0xf54e('0x33')](respondWithResult(_0x21f2f8,null))[_0xf54e('0x24')](handleError(_0x21f2f8,null));};exports['clone']=function(_0x3ce832,_0x54ac1a){var _0x465a0f={'where':{'id':_0x3ce832[_0xf54e('0x55')]['id']}},_0x400ee0={};_0x400ee0['model']=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x465a0f[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x400ee0[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x3ce832['query']['fields']));_0x465a0f[_0xf54e('0x45')]=_0x465a0f[_0xf54e('0x45')]['length']?_0x465a0f[_0xf54e('0x45')]:_0x400ee0['model'];if(_0x3ce832[_0xf54e('0x41')]['includeAll']){_0x465a0f[_0xf54e('0x56')]=[{'all':!![]}];}_0x465a0f=_[_0xf54e('0x4d')]({},_0x465a0f,_0x3ce832[_0xf54e('0x50')]);return db[_0xf54e('0x3b')][_0xf54e('0x57')](_0x465a0f)[_0xf54e('0x33')](handleEntityNotFound(_0x54ac1a,null))['then'](function(_0x479572){if(_0x479572){var _0x79345=_0x479572[_0xf54e('0x58')]({'plain':!![]});_0x79345=qs['omit'](_0x79345,['id','createdAt',_0xf54e('0x59')]);_0x3ce832['body']=_[_0xf54e('0x5a')](_0x3ce832[_0xf54e('0x5b')],['id',_0xf54e('0x5c'),_0xf54e('0x59')]);return db[_0xf54e('0x3b')][_0xf54e('0x5d')](_[_0xf54e('0x4d')](_0x79345,_0x3ce832[_0xf54e('0x5b')]),{'include':_0x3ce832[_0xf54e('0x41')][_0xf54e('0x51')]?[{'all':!![]}]:undefined})[_0xf54e('0x33')](function(_0x2c6d0e){var _0x65bdf2=_0x3ce832[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x65bdf2)throw new Error(_0xf54e('0x5f'));if(_0x65bdf2[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x11908b=_0x2c6d0e[_0xf54e('0x58')]({'plain':!![]});var _0x494629=_0xf54e('0x35');return db[_0xf54e('0x61')]['find']({'where':{'name':_0x494629,'userProfileId':_0x65bdf2['userProfileId']},'raw':!![]})[_0xf54e('0x33')](function(_0x4b4a2f){if(_0x4b4a2f&&_0x4b4a2f[_0xf54e('0x62')]===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x11908b[_0xf54e('0x37')],'resourceId':_0x11908b['id'],'type':_0x4b4a2f['name'],'sectionId':_0x4b4a2f['id']},{})[_0xf54e('0x33')](function(){return _0x2c6d0e;});}else{return _0x2c6d0e;}})['catch'](function(_0x3800d4){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x3800d4);throw _0x3800d4;});}return _0x2c6d0e;});}})['then'](respondWithResult(_0x54ac1a,0xc9))[_0xf54e('0x24')](handleError(_0x54ac1a,null));};exports['create']=function(_0x3f7224,_0x3e2101,_0x5500d7){var _0x380b4f;return db['Trunk'][_0xf54e('0x5d')](_0x3f7224[_0xf54e('0x5b')],{'raw':!![]})[_0xf54e('0x33')](function(_0x38405c){_0x380b4f=_0x38405c;return db[_0xf54e('0x3b')]['findAll']({'raw':!![]});})[_0xf54e('0x33')](function(_0x1d18d3){var _0x57db6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x309895=fs['readFileSync'](path[_0xf54e('0x65')](config['root'],_0xf54e('0x68')),_0xf54e('0x67'));var _0x5e45e7=ejs[_0xf54e('0x69')](_0x57db6f,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x5e45e7);if(_0x380b4f[_0xf54e('0x6c')]){var _0x38bf71=ejs[_0xf54e('0x69')](_0x309895,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x38bf71);}})[_0xf54e('0x33')](function(){return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x5d'),{'module':'chan_sip.so'});})[_0xf54e('0x33')](function(){var _0x2c20b5=_0x3f7224[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x2c20b5)throw new Error(_0xf54e('0x5f'));if(_0x2c20b5[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x13db3e=_0x380b4f[_0xf54e('0x58')]({'plain':!![]});return db[_0xf54e('0x61')][_0xf54e('0x57')]({'where':{'name':'Trunks','userProfileId':_0x2c20b5[_0xf54e('0x6f')]},'raw':!![]})[_0xf54e('0x33')](function(_0x261c39){if(_0x261c39&&_0x261c39['autoAssociation']===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x13db3e[_0xf54e('0x37')],'resourceId':_0x13db3e['id'],'type':_0x261c39[_0xf54e('0x37')],'sectionId':_0x261c39['id']},{})['then'](function(){return _0x380b4f;});}else{return _0x380b4f;}})['catch'](function(_0x25d05e){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x25d05e);throw _0x25d05e;});}return _0x380b4f;})[_0xf54e('0x33')](respondWithResult(_0x3e2101,0xc9))[_0xf54e('0x24')](handleError(_0x3e2101,null));};exports[_0xf54e('0x32')]=function(_0x35b5a4,_0x3b2a3e,_0xf5108b){var _0x205b47;return db['Trunk'][_0xf54e('0x57')]({'where':{'id':_0x35b5a4[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x3b2a3e,null))[_0xf54e('0x33')](saveUpdates(_0x35b5a4['body'],null))[_0xf54e('0x33')](function(_0x1de6dd){if(_0x1de6dd){_0x205b47=_0x1de6dd;return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});}})['then'](function(_0x394862){if(_0x394862){var _0x4876b5=fs[_0xf54e('0x64')](path['join'](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x1e2834=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config[_0xf54e('0x70')],_0xf54e('0x68')),_0xf54e('0x67'));var _0x8093bc=ejs['render'](_0x4876b5,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x8093bc);var _0x4ce10=ejs[_0xf54e('0x69')](_0x1e2834,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x4ce10);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x32'),{'module':_0xf54e('0x71')});}return null;})[_0xf54e('0x33')](function(_0x11dec2){if(_0x11dec2){return _0x205b47;}})[_0xf54e('0x33')](respondWithResult(_0x3b2a3e,null))['catch'](handleError(_0x3b2a3e,null));};exports[_0xf54e('0x34')]=function(_0x1cfa09,_0x59acbc,_0x4a0614){var _0x85b108;return db[_0xf54e('0x3b')][_0xf54e('0x57')]({'where':{'id':_0x1cfa09[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x59acbc,null))[_0xf54e('0x33')](removeEntity(_0x59acbc,null))[_0xf54e('0x33')](function(){return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});})['then'](function(_0x2bb31f){var _0x3c222a=fs[_0xf54e('0x64')](path['join'](config[_0xf54e('0x70')],'server/files/templates/trunk.ejs'),_0xf54e('0x67'));var _0x57bc6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],'server/files/templates/registry.ejs'),_0xf54e('0x67'));var _0x632240=ejs[_0xf54e('0x69')](_0x3c222a,{'trunks':_0x2bb31f});var _0x406261=ejs[_0xf54e('0x69')](_0x57bc6f,{'trunks':_0x2bb31f});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x632240);fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x406261);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x34'),{'module':_0xf54e('0x71')});})[_0xf54e('0x24')](handleError(_0x59acbc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index efc16cf..e0d1a63 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 _0x778e=['../../config/environment','./trunk.attributes','Trunk','tools_trunks','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x1b4f25,_0x387b6c){var _0x3491f2=function(_0xbc1629){while(--_0xbc1629){_0x1b4f25['push'](_0x1b4f25['shift']());}};_0x3491f2(++_0x387b6c);}(_0x778e,0x93));var _0xe778=function(_0x245864,_0x6c3abd){_0x245864=_0x245864-0x0;var _0x2fd56c=_0x778e[_0x245864];return _0x2fd56c;};'use strict';var _=require(_0xe778('0x0'));var util=require(_0xe778('0x1'));var logger=require('../../config/logger')(_0xe778('0x2'));var moment=require(_0xe778('0x3'));var BPromise=require('bluebird');var rp=require(_0xe778('0x4'));var fs=require('fs');var path=require(_0xe778('0x5'));var rimraf=require(_0xe778('0x6'));var config=require(_0xe778('0x7'));var attributes=require(_0xe778('0x8'));module['exports']=function(_0x17463d,_0x2b49ca){return _0x17463d['define'](_0xe778('0x9'),attributes,{'tableName':_0xe778('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ab3=['api','bluebird','request-promise','path','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger'];(function(_0x2ac917,_0x40158b){var _0xe46b45=function(_0x42ff11){while(--_0x42ff11){_0x2ac917['push'](_0x2ac917['shift']());}};_0xe46b45(++_0x40158b);}(_0x6ab3,0xf9));var _0x36ab=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0x6ab3[_0x2a276d];return _0x2914cd;};'use strict';var _=require(_0x36ab('0x0'));var util=require(_0x36ab('0x1'));var logger=require(_0x36ab('0x2'))(_0x36ab('0x3'));var moment=require('moment');var BPromise=require(_0x36ab('0x4'));var rp=require(_0x36ab('0x5'));var fs=require('fs');var path=require(_0x36ab('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x36ab('0x7'));module[_0x36ab('0x8')]=function(_0x48549c,_0x5913cb){return _0x48549c[_0x36ab('0x9')](_0x36ab('0xa'),attributes,{'tableName':_0x36ab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index d66f569..f480cc0 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 _0xcb14=['util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','then','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetTrunk','findAll','options','raw','where','limit','include','map','attributes','model','debug','stringify','catch','ShowTrunk','Trunk','find','lodash'];(function(_0x56aad3,_0x3d48bc){var _0x1d165a=function(_0x1d4e95){while(--_0x1d4e95){_0x56aad3['push'](_0x56aad3['shift']());}};_0x1d165a(++_0x3d48bc);}(_0xcb14,0x107));var _0x4cb1=function(_0x56d8ab,_0x4a8fb0){_0x56d8ab=_0x56d8ab-0x0;var _0x4d1401=_0xcb14[_0x56d8ab];return _0x4d1401;};'use strict';var _=require(_0x4cb1('0x0'));var util=require(_0x4cb1('0x1'));var moment=require(_0x4cb1('0x2'));var BPromise=require(_0x4cb1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cb1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4cb1('0x5'));var logger=require('../../config/logger')(_0x4cb1('0x6'));var config=require(_0x4cb1('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a7321,_0x1fe7c0,_0x51c8f7){return new BPromise(function(_0x10654d,_0x5d676c){return client['request'](_0x3a7321,_0x51c8f7)[_0x4cb1('0x8')](function(_0x3fcf5a){logger['info'](_0x4cb1('0x9'),_0x1fe7c0,_0x4cb1('0xa'));logger['debug'](_0x4cb1('0xb'),_0x1fe7c0,'request\x20sent',JSON['stringify'](_0x3fcf5a));if(_0x3fcf5a[_0x4cb1('0xc')]){if(_0x3fcf5a[_0x4cb1('0xc')][_0x4cb1('0xd')]===0x1f4){logger['error'](_0x4cb1('0x9'),_0x1fe7c0,_0x3fcf5a[_0x4cb1('0xc')][_0x4cb1('0xe')]);return _0x5d676c(_0x3fcf5a[_0x4cb1('0xc')]['message']);}logger[_0x4cb1('0xc')](_0x4cb1('0x9'),_0x1fe7c0,_0x3fcf5a[_0x4cb1('0xc')][_0x4cb1('0xe')]);return _0x10654d(_0x3fcf5a[_0x4cb1('0xc')][_0x4cb1('0xe')]);}else{logger[_0x4cb1('0xf')](_0x4cb1('0x9'),_0x1fe7c0,_0x4cb1('0xa'));_0x10654d(_0x3fcf5a[_0x4cb1('0x10')]['message']);}})['catch'](function(_0x487d40){logger[_0x4cb1('0xc')](_0x4cb1('0x9'),_0x1fe7c0,_0x487d40);_0x5d676c(_0x487d40);});});}exports[_0x4cb1('0x11')]=function(_0x27a4b6){var _0x22c5a6=this;return new Promise(function(_0x142a45,_0x141b95){return db['Trunk'][_0x4cb1('0x12')]({'raw':_0x27a4b6[_0x4cb1('0x13')]?_0x27a4b6[_0x4cb1('0x13')][_0x4cb1('0x14')]===undefined?!![]:![]:!![],'where':_0x27a4b6[_0x4cb1('0x13')]?_0x27a4b6[_0x4cb1('0x13')][_0x4cb1('0x15')]||null:null,'attributes':_0x27a4b6[_0x4cb1('0x13')]?_0x27a4b6[_0x4cb1('0x13')]['attributes']||null:null,'limit':_0x27a4b6[_0x4cb1('0x13')]?_0x27a4b6[_0x4cb1('0x13')][_0x4cb1('0x16')]||null:null,'include':_0x27a4b6['options']?_0x27a4b6['options'][_0x4cb1('0x17')]?_[_0x4cb1('0x18')](_0x27a4b6[_0x4cb1('0x13')][_0x4cb1('0x17')],function(_0x87f2bf){return{'model':db[_0x87f2bf['model']],'as':_0x87f2bf['as'],'attributes':_0x87f2bf[_0x4cb1('0x19')],'include':_0x87f2bf[_0x4cb1('0x17')]?_[_0x4cb1('0x18')](_0x87f2bf[_0x4cb1('0x17')],function(_0x5611ef){return{'model':db[_0x5611ef[_0x4cb1('0x1a')]],'as':_0x5611ef['as'],'attributes':_0x5611ef['attributes'],'include':_0x5611ef['include']?_[_0x4cb1('0x18')](_0x5611ef[_0x4cb1('0x17')],function(_0x300cc5){return{'model':db[_0x300cc5[_0x4cb1('0x1a')]],'as':_0x300cc5['as'],'attributes':_0x300cc5[_0x4cb1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4cb1('0x8')](function(_0x21607e){logger[_0x4cb1('0xf')](_0x4cb1('0x11'),_0x27a4b6);logger[_0x4cb1('0x1b')](_0x4cb1('0x11'),_0x27a4b6,JSON[_0x4cb1('0x1c')](_0x21607e));_0x142a45(_0x21607e);})[_0x4cb1('0x1d')](function(_0x14dc5c){logger[_0x4cb1('0xc')](_0x4cb1('0x11'),_0x14dc5c[_0x4cb1('0xe')],_0x27a4b6);_0x141b95(_0x22c5a6[_0x4cb1('0xc')](0x1f4,_0x14dc5c[_0x4cb1('0xe')]));});});};exports[_0x4cb1('0x1e')]=function(_0x526fa1){var _0x42b8de=this;return new Promise(function(_0x2eaf2b,_0x5864cf){return db[_0x4cb1('0x1f')][_0x4cb1('0x20')]({'raw':_0x526fa1[_0x4cb1('0x13')]?_0x526fa1[_0x4cb1('0x13')][_0x4cb1('0x14')]===undefined?!![]:![]:!![],'where':_0x526fa1['options']?_0x526fa1[_0x4cb1('0x13')]['where']||null:null,'attributes':_0x526fa1[_0x4cb1('0x13')]?_0x526fa1[_0x4cb1('0x13')]['attributes']||null:null,'include':_0x526fa1[_0x4cb1('0x13')]?_0x526fa1[_0x4cb1('0x13')][_0x4cb1('0x17')]?_[_0x4cb1('0x18')](_0x526fa1[_0x4cb1('0x13')]['include'],function(_0x5d856f){return{'model':db[_0x5d856f[_0x4cb1('0x1a')]],'as':_0x5d856f['as'],'attributes':_0x5d856f['attributes'],'include':_0x5d856f[_0x4cb1('0x17')]?_['map'](_0x5d856f['include'],function(_0x2c2210){return{'model':db[_0x2c2210['model']],'as':_0x2c2210['as'],'attributes':_0x2c2210['attributes'],'include':_0x2c2210[_0x4cb1('0x17')]?_[_0x4cb1('0x18')](_0x2c2210[_0x4cb1('0x17')],function(_0x99ad6f){return{'model':db[_0x99ad6f[_0x4cb1('0x1a')]],'as':_0x99ad6f['as'],'attributes':_0x99ad6f[_0x4cb1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4cb1('0x8')](function(_0xd7883){logger[_0x4cb1('0xf')](_0x4cb1('0x1e'),_0x526fa1);logger[_0x4cb1('0x1b')](_0x4cb1('0x1e'),_0x526fa1,JSON[_0x4cb1('0x1c')](_0xd7883));_0x2eaf2b(_0xd7883);})[_0x4cb1('0x1d')](function(_0x5f2fe9){logger[_0x4cb1('0xc')](_0x4cb1('0x1e'),_0x5f2fe9[_0x4cb1('0xe')],_0x526fa1);_0x5864cf(_0x42b8de[_0x4cb1('0xc')](0x1f4,_0x5f2fe9['message']));});});}; \ No newline at end of file +var _0xbb13=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','result','GetTrunk','Trunk','options','raw','where','attributes','limit','include','model','map','catch','ShowTrunk'];(function(_0x3a0bb8,_0x6e069a){var _0x19ba8d=function(_0x1c5c28){while(--_0x1c5c28){_0x3a0bb8['push'](_0x3a0bb8['shift']());}};_0x19ba8d(++_0x6e069a);}(_0xbb13,0x90));var _0x3bb1=function(_0xeaa032,_0x1116bc){_0xeaa032=_0xeaa032-0x0;var _0x5c5801=_0xbb13[_0xeaa032];return _0x5c5801;};'use strict';var _=require(_0x3bb1('0x0'));var util=require(_0x3bb1('0x1'));var moment=require(_0x3bb1('0x2'));var BPromise=require(_0x3bb1('0x3'));var rs=require(_0x3bb1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bb1('0x5'))['db'];var utils=require(_0x3bb1('0x6'));var logger=require(_0x3bb1('0x7'))(_0x3bb1('0x8'));var config=require(_0x3bb1('0x9'));var jayson=require(_0x3bb1('0xa'));var client=jayson[_0x3bb1('0xb')][_0x3bb1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1fa7d2,_0xd27b09,_0x57e868){return new BPromise(function(_0xfe35b4,_0x4a591a){return client['request'](_0x1fa7d2,_0x57e868)[_0x3bb1('0xd')](function(_0x102b0c){logger[_0x3bb1('0xe')]('Trunk,\x20%s,\x20%s',_0xd27b09,_0x3bb1('0xf'));logger[_0x3bb1('0x10')](_0x3bb1('0x11'),_0xd27b09,'request\x20sent',JSON[_0x3bb1('0x12')](_0x102b0c));if(_0x102b0c[_0x3bb1('0x13')]){if(_0x102b0c[_0x3bb1('0x13')][_0x3bb1('0x14')]===0x1f4){logger[_0x3bb1('0x13')]('Trunk,\x20%s,\x20%s',_0xd27b09,_0x102b0c['error']['message']);return _0x4a591a(_0x102b0c[_0x3bb1('0x13')][_0x3bb1('0x15')]);}logger[_0x3bb1('0x13')](_0x3bb1('0x16'),_0xd27b09,_0x102b0c[_0x3bb1('0x13')]['message']);return _0xfe35b4(_0x102b0c[_0x3bb1('0x13')][_0x3bb1('0x15')]);}else{logger[_0x3bb1('0xe')](_0x3bb1('0x16'),_0xd27b09,_0x3bb1('0xf'));_0xfe35b4(_0x102b0c[_0x3bb1('0x17')]['message']);}})['catch'](function(_0x109628){logger[_0x3bb1('0x13')](_0x3bb1('0x16'),_0xd27b09,_0x109628);_0x4a591a(_0x109628);});});}exports[_0x3bb1('0x18')]=function(_0x2d9373){var _0x22d947=this;return new Promise(function(_0x3ab64e,_0x1c4283){return db[_0x3bb1('0x19')]['findAll']({'raw':_0x2d9373['options']?_0x2d9373[_0x3bb1('0x1a')][_0x3bb1('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d9373['options']?_0x2d9373[_0x3bb1('0x1a')][_0x3bb1('0x1c')]||null:null,'attributes':_0x2d9373[_0x3bb1('0x1a')]?_0x2d9373[_0x3bb1('0x1a')][_0x3bb1('0x1d')]||null:null,'limit':_0x2d9373[_0x3bb1('0x1a')]?_0x2d9373[_0x3bb1('0x1a')][_0x3bb1('0x1e')]||null:null,'include':_0x2d9373[_0x3bb1('0x1a')]?_0x2d9373[_0x3bb1('0x1a')][_0x3bb1('0x1f')]?_['map'](_0x2d9373[_0x3bb1('0x1a')]['include'],function(_0x1cf8fc){return{'model':db[_0x1cf8fc[_0x3bb1('0x20')]],'as':_0x1cf8fc['as'],'attributes':_0x1cf8fc['attributes'],'include':_0x1cf8fc['include']?_[_0x3bb1('0x21')](_0x1cf8fc['include'],function(_0x25b0cc){return{'model':db[_0x25b0cc[_0x3bb1('0x20')]],'as':_0x25b0cc['as'],'attributes':_0x25b0cc[_0x3bb1('0x1d')],'include':_0x25b0cc[_0x3bb1('0x1f')]?_[_0x3bb1('0x21')](_0x25b0cc[_0x3bb1('0x1f')],function(_0x172357){return{'model':db[_0x172357[_0x3bb1('0x20')]],'as':_0x172357['as'],'attributes':_0x172357[_0x3bb1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3bb1('0xd')](function(_0x47b424){logger[_0x3bb1('0xe')]('GetTrunk',_0x2d9373);logger[_0x3bb1('0x10')](_0x3bb1('0x18'),_0x2d9373,JSON[_0x3bb1('0x12')](_0x47b424));_0x3ab64e(_0x47b424);})[_0x3bb1('0x22')](function(_0x457ba1){logger[_0x3bb1('0x13')]('GetTrunk',_0x457ba1[_0x3bb1('0x15')],_0x2d9373);_0x1c4283(_0x22d947[_0x3bb1('0x13')](0x1f4,_0x457ba1[_0x3bb1('0x15')]));});});};exports[_0x3bb1('0x23')]=function(_0x35d04f){var _0x312cb4=this;return new Promise(function(_0x2e7aa3,_0x139663){return db[_0x3bb1('0x19')]['find']({'raw':_0x35d04f[_0x3bb1('0x1a')]?_0x35d04f[_0x3bb1('0x1a')][_0x3bb1('0x1b')]===undefined?!![]:![]:!![],'where':_0x35d04f[_0x3bb1('0x1a')]?_0x35d04f['options'][_0x3bb1('0x1c')]||null:null,'attributes':_0x35d04f[_0x3bb1('0x1a')]?_0x35d04f[_0x3bb1('0x1a')]['attributes']||null:null,'include':_0x35d04f[_0x3bb1('0x1a')]?_0x35d04f['options']['include']?_[_0x3bb1('0x21')](_0x35d04f[_0x3bb1('0x1a')][_0x3bb1('0x1f')],function(_0x8940c3){return{'model':db[_0x8940c3[_0x3bb1('0x20')]],'as':_0x8940c3['as'],'attributes':_0x8940c3[_0x3bb1('0x1d')],'include':_0x8940c3[_0x3bb1('0x1f')]?_[_0x3bb1('0x21')](_0x8940c3[_0x3bb1('0x1f')],function(_0x497d1f){return{'model':db[_0x497d1f[_0x3bb1('0x20')]],'as':_0x497d1f['as'],'attributes':_0x497d1f[_0x3bb1('0x1d')],'include':_0x497d1f[_0x3bb1('0x1f')]?_['map'](_0x497d1f[_0x3bb1('0x1f')],function(_0x30d135){return{'model':db[_0x30d135[_0x3bb1('0x20')]],'as':_0x30d135['as'],'attributes':_0x30d135[_0x3bb1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3bb1('0xd')](function(_0x395a52){logger[_0x3bb1('0xe')]('ShowTrunk',_0x35d04f);logger[_0x3bb1('0x10')](_0x3bb1('0x23'),_0x35d04f,JSON[_0x3bb1('0x12')](_0x395a52));_0x2e7aa3(_0x395a52);})[_0x3bb1('0x22')](function(_0x277bb6){logger[_0x3bb1('0x13')]('ShowTrunk',_0x277bb6['message'],_0x35d04f);_0x139663(_0x312cb4[_0x3bb1('0x13')](0x1f4,_0x277bb6[_0x3bb1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index c0f9fee..0f025b3 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 _0xf47b=['getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getWhatsappAccounts','/:id/api_key','getApiKey','post','create','bulkCreate','/:id/queues','join','server/files/images/','%s-%s','/:id/avatar','single','/:id/login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','put','update','/:id/password','changePassword','delete','removeQueues','/:id/teams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeMailAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/whoami','whoami','/presence','getPresence','/:id','show','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/groups','getGroups','/:id/recordings'];(function(_0x1f0fdc,_0x523311){var _0x1dc6c5=function(_0x2d2b0a){while(--_0x2d2b0a){_0x1f0fdc['push'](_0x1f0fdc['shift']());}};_0x1dc6c5(++_0x523311);}(_0xf47b,0x17e));var _0xbf47=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xf47b[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0xbf47('0x0'));var util=require(_0xbf47('0x1'));var path=require(_0xbf47('0x2'));var timeout=require(_0xbf47('0x3'));var express=require(_0xbf47('0x4'));var router=express[_0xbf47('0x5')]();var fs_extra=require(_0xbf47('0x6'));var auth=require(_0xbf47('0x7'));var interaction=require(_0xbf47('0x8'));var config=require(_0xbf47('0x9'));var controller=require(_0xbf47('0xa'));router[_0xbf47('0xb')]('/',auth[_0xbf47('0xc')](),controller[_0xbf47('0xd')]);router[_0xbf47('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xbf47('0xb')](_0xbf47('0xe'),auth[_0xbf47('0xc')](),controller[_0xbf47('0xf')]);router[_0xbf47('0xb')](_0xbf47('0x10'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x11')]);router[_0xbf47('0xb')](_0xbf47('0x12'),auth['isAuthenticated'](),controller[_0xbf47('0x13')]);router[_0xbf47('0xb')]('/:id/avatar',controller['getAvatar']);router[_0xbf47('0xb')](_0xbf47('0x14'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x15')]);router['get'](_0xbf47('0x16'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/queues',auth[_0xbf47('0xc')](),controller['getQueues']);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0xbf47('0xb')](_0xbf47('0x17'),auth['isAuthenticated'](),controller[_0xbf47('0x18')]);router[_0xbf47('0xb')](_0xbf47('0x19'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x1a')]);router['get'](_0xbf47('0x1b'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x1c')]);router['get'](_0xbf47('0x1d'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x1e')]);router[_0xbf47('0xb')](_0xbf47('0x1f'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x20')]);router[_0xbf47('0xb')]('/:id/mail/interactions',auth[_0xbf47('0xc')](),controller['getMailInteractions']);router[_0xbf47('0xb')](_0xbf47('0x21'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x22')]);router[_0xbf47('0xb')](_0xbf47('0x23'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x24')]);router[_0xbf47('0xb')](_0xbf47('0x25'),auth[_0xbf47('0xc')](),controller['getWhatsappInteractions']);router[_0xbf47('0xb')]('/:id/teams',auth[_0xbf47('0xc')](),controller[_0xbf47('0x26')]);router[_0xbf47('0xb')](_0xbf47('0x27'),auth[_0xbf47('0xc')](),controller['getLists']);router['get'](_0xbf47('0x28'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x29')]);router[_0xbf47('0xb')](_0xbf47('0x2a'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x2b')]);router[_0xbf47('0xb')](_0xbf47('0x2c'),auth[_0xbf47('0xc')](),controller['getFaxAccounts']);router[_0xbf47('0xb')](_0xbf47('0x2d'),auth[_0xbf47('0xc')](),controller['getMailAccounts']);router[_0xbf47('0xb')](_0xbf47('0x2e'),auth['isAuthenticated'](),controller[_0xbf47('0x2f')]);router[_0xbf47('0xb')](_0xbf47('0x30'),auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0xbf47('0xb')]('/:id/chat_websites',auth[_0xbf47('0xc')](),controller['getChatWebsites']);router[_0xbf47('0xb')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xbf47('0x31')]);router['get']('/:id/square_projects',auth[_0xbf47('0xc')](),controller['getSquareProjects']);router[_0xbf47('0xb')]('/:id/scheduled_calls',auth[_0xbf47('0xc')](),controller['getScheduledCalls']);router[_0xbf47('0xb')](_0xbf47('0x32'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x33')]);router[_0xbf47('0x34')]('/:id/contacts',auth[_0xbf47('0xc')](),controller['addContacts']);router[_0xbf47('0x34')]('/',auth[_0xbf47('0xc')](),controller[_0xbf47('0x35')]);router[_0xbf47('0x34')]('/create_many',auth[_0xbf47('0xc')](),controller[_0xbf47('0x36')]);router['post'](_0xbf47('0x37'),auth[_0xbf47('0xc')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3ade0e,_0xdd194a,_0x2b2ea3){_0x2b2ea3(null,path[_0xbf47('0x38')](config['root'],_0xbf47('0x39')));},'filename':function(_0x57adc5,_0x28df60,_0x34c8d2){_0x34c8d2(null,util['format'](_0xbf47('0x3a'),Date['now'](),_0x28df60['originalname']));}})});router[_0xbf47('0x34')](_0xbf47('0x3b'),upload[_0xbf47('0x3c')]('file'),controller['addAvatar']);router[_0xbf47('0x34')](_0xbf47('0x3d'),auth['isAuthenticated'](),controller['login']);router[_0xbf47('0x34')](_0xbf47('0x3e'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x3f')]);router[_0xbf47('0x34')](_0xbf47('0x40'),auth[_0xbf47('0xc')](),controller['pause']);router[_0xbf47('0x34')](_0xbf47('0x41'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x42')]);router[_0xbf47('0x34')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbf47('0x43')]);router[_0xbf47('0x34')]('/:id/chat_interactions',auth['isAuthenticated'](),controller['addChatInteractions']);router[_0xbf47('0x34')](_0xbf47('0x44'),auth[_0xbf47('0xc')](),controller['addMailInteractions']);router[_0xbf47('0x34')](_0xbf47('0x45'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x46')]);router[_0xbf47('0x34')](_0xbf47('0x47'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0xbf47('0x34')](_0xbf47('0x48'),auth['isAuthenticated'](),controller[_0xbf47('0x49')]);router[_0xbf47('0x34')](_0xbf47('0x4a'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x4b')]);router[_0xbf47('0x34')]('/:id/fax_accounts',auth[_0xbf47('0xc')](),controller[_0xbf47('0x4c')]);router['post'](_0xbf47('0x2d'),auth[_0xbf47('0xc')](),controller['addMailAccounts']);router[_0xbf47('0x34')]('/:id/openchannel_accounts',auth[_0xbf47('0xc')](),controller[_0xbf47('0x4d')]);router['post'](_0xbf47('0x30'),auth['isAuthenticated'](),controller[_0xbf47('0x4e')]);router[_0xbf47('0x34')](_0xbf47('0x4f'),auth[_0xbf47('0xc')](),controller['addChatWebsites']);router[_0xbf47('0x34')](_0xbf47('0x50'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x51')]);router[_0xbf47('0x34')](_0xbf47('0x52'),auth[_0xbf47('0xc')](),controller['addSquareProjects']);router[_0xbf47('0x34')](_0xbf47('0x32'),auth[_0xbf47('0xc')](),controller['createApiKey']);router[_0xbf47('0x53')](_0xbf47('0x12'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x54')]);router['put'](_0xbf47('0x55'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x56')]);router[_0xbf47('0x57')](_0xbf47('0x37'),auth['isAuthenticated'](),controller[_0xbf47('0x58')]);router[_0xbf47('0x57')](_0xbf47('0x59'),auth[_0xbf47('0xc')](),controller['removeTeams']);router[_0xbf47('0x57')]('/:id',auth[_0xbf47('0xc')](),controller[_0xbf47('0x5a')]);router[_0xbf47('0x57')]('/:id/chat_interactions',auth[_0xbf47('0xc')](),controller[_0xbf47('0x5b')]);router[_0xbf47('0x57')](_0xbf47('0x44'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x5c')]);router[_0xbf47('0x57')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xbf47('0x5d')]);router['delete'](_0xbf47('0x47'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x5e')]);router['delete'](_0xbf47('0x48'),auth['isAuthenticated'](),controller[_0xbf47('0x5f')]);router[_0xbf47('0x57')](_0xbf47('0x4a'),auth[_0xbf47('0xc')](),controller['removeWhatsappInteractions']);router[_0xbf47('0x57')](_0xbf47('0x2c'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0xbf47('0x57')](_0xbf47('0x2d'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x60')]);router[_0xbf47('0x57')](_0xbf47('0x2e'),auth[_0xbf47('0xc')](),controller['removeOpenchannelAccounts']);router[_0xbf47('0x57')](_0xbf47('0x30'),auth['isAuthenticated'](),controller[_0xbf47('0x61')]);router[_0xbf47('0x57')]('/:id/chat_websites',auth[_0xbf47('0xc')](),controller['removeChatWebsites']);router[_0xbf47('0x57')](_0xbf47('0x50'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x62')]);router[_0xbf47('0x57')](_0xbf47('0x52'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x63')]);router[_0xbf47('0x57')](_0xbf47('0x32'),auth[_0xbf47('0xc')](),controller[_0xbf47('0x64')]);module[_0xbf47('0x65')]=router; \ No newline at end of file +var _0x978a=['/:id/square_projects','getSquareProjects','addContacts','post','/create_many','addQueues','diskStorage','join','root','server/files/images/','format','now','single','file','addAvatar','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeApiKey','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/whoami','whoami','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts'];(function(_0x45ae0d,_0x1ea3b9){var _0x371826=function(_0x20e757){while(--_0x20e757){_0x45ae0d['push'](_0x45ae0d['shift']());}};_0x371826(++_0x1ea3b9);}(_0x978a,0x17a));var _0xa978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x978a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa978('0x0'));var util=require(_0xa978('0x1'));var path=require(_0xa978('0x2'));var timeout=require(_0xa978('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa978('0x4'));var auth=require(_0xa978('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa978('0x6'));var controller=require('./user.controller');router[_0xa978('0x7')]('/',auth[_0xa978('0x8')](),controller[_0xa978('0x9')]);router[_0xa978('0x7')]('/describe',auth[_0xa978('0x8')](),controller[_0xa978('0xa')]);router['get'](_0xa978('0xb'),auth[_0xa978('0x8')](),controller[_0xa978('0xc')]);router['get']('/presence',auth['isAuthenticated'](),controller['getPresence']);router[_0xa978('0x7')](_0xa978('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xa978('0xe'),controller[_0xa978('0xf')]);router['get'](_0xa978('0x10'),auth[_0xa978('0x8')](),controller[_0xa978('0x11')]);router[_0xa978('0x7')](_0xa978('0x12'),auth[_0xa978('0x8')](),controller[_0xa978('0x13')]);router[_0xa978('0x7')](_0xa978('0x14'),auth[_0xa978('0x8')](),controller['getQueues']);router[_0xa978('0x7')](_0xa978('0x15'),auth[_0xa978('0x8')](),controller[_0xa978('0x16')]);router[_0xa978('0x7')]('/:id/groups',auth[_0xa978('0x8')](),controller[_0xa978('0x17')]);router[_0xa978('0x7')](_0xa978('0x18'),auth[_0xa978('0x8')](),controller[_0xa978('0x19')]);router['get'](_0xa978('0x1a'),auth['isAuthenticated'](),controller[_0xa978('0x1b')]);router[_0xa978('0x7')]('/:id/chat/interactions',auth['isAuthenticated'](),controller['getChatInteractions']);router[_0xa978('0x7')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0xa978('0x1c')]);router[_0xa978('0x7')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0xa978('0x1d')]);router[_0xa978('0x7')](_0xa978('0x1e'),auth[_0xa978('0x8')](),controller[_0xa978('0x1f')]);router[_0xa978('0x7')]('/:id/fax/interactions',auth[_0xa978('0x8')](),controller[_0xa978('0x20')]);router[_0xa978('0x7')](_0xa978('0x21'),auth['isAuthenticated'](),controller[_0xa978('0x22')]);router[_0xa978('0x7')](_0xa978('0x23'),auth[_0xa978('0x8')](),controller['getTeams']);router[_0xa978('0x7')](_0xa978('0x24'),auth[_0xa978('0x8')](),controller[_0xa978('0x25')]);router[_0xa978('0x7')]('/:id/agents',auth[_0xa978('0x8')](),controller['getAgents']);router['get'](_0xa978('0x26'),auth['isAuthenticated'](),controller[_0xa978('0x27')]);router['get'](_0xa978('0x28'),auth[_0xa978('0x8')](),controller['getFaxAccounts']);router[_0xa978('0x7')](_0xa978('0x29'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0xa978('0x7')](_0xa978('0x2a'),auth['isAuthenticated'](),controller[_0xa978('0x2b')]);router[_0xa978('0x7')](_0xa978('0x2c'),auth[_0xa978('0x8')](),controller[_0xa978('0x2d')]);router['get'](_0xa978('0x2e'),auth[_0xa978('0x8')](),controller[_0xa978('0x2f')]);router[_0xa978('0x7')](_0xa978('0x30'),auth[_0xa978('0x8')](),controller[_0xa978('0x31')]);router[_0xa978('0x7')](_0xa978('0x32'),auth[_0xa978('0x8')](),controller[_0xa978('0x33')]);router['get']('/:id/scheduled_calls',auth['isAuthenticated'](),controller['getScheduledCalls']);router['get']('/:id/api_key',auth['isAuthenticated'](),controller['getApiKey']);router['post'](_0xa978('0x12'),auth[_0xa978('0x8')](),controller[_0xa978('0x34')]);router[_0xa978('0x35')]('/',auth[_0xa978('0x8')](),controller['create']);router[_0xa978('0x35')](_0xa978('0x36'),auth[_0xa978('0x8')](),controller['bulkCreate']);router[_0xa978('0x35')]('/:id/queues',auth[_0xa978('0x8')](),controller[_0xa978('0x37')]);var upload=multer({'storage':multer[_0xa978('0x38')]({'destination':function(_0x37b959,_0x5e2c8d,_0x42a9e3){_0x42a9e3(null,path[_0xa978('0x39')](config[_0xa978('0x3a')],_0xa978('0x3b')));},'filename':function(_0x5b9020,_0x25b39d,_0x2e89f8){_0x2e89f8(null,util[_0xa978('0x3c')]('%s-%s',Date[_0xa978('0x3d')](),_0x25b39d['originalname']));}})});router['post'](_0xa978('0xe'),upload[_0xa978('0x3e')](_0xa978('0x3f')),controller[_0xa978('0x40')]);router['post']('/:id/login',auth[_0xa978('0x8')](),controller[_0xa978('0x41')]);router[_0xa978('0x35')](_0xa978('0x42'),auth[_0xa978('0x8')](),controller[_0xa978('0x43')]);router['post'](_0xa978('0x44'),auth[_0xa978('0x8')](),controller['pause']);router[_0xa978('0x35')](_0xa978('0x45'),auth[_0xa978('0x8')](),controller[_0xa978('0x46')]);router[_0xa978('0x35')]('/:id/teams',auth[_0xa978('0x8')](),controller[_0xa978('0x47')]);router['post'](_0xa978('0x48'),auth['isAuthenticated'](),controller[_0xa978('0x49')]);router[_0xa978('0x35')](_0xa978('0x4a'),auth[_0xa978('0x8')](),controller[_0xa978('0x4b')]);router[_0xa978('0x35')](_0xa978('0x4c'),auth['isAuthenticated'](),controller[_0xa978('0x4d')]);router[_0xa978('0x35')](_0xa978('0x4e'),auth[_0xa978('0x8')](),controller['addSmsInteractions']);router['post']('/:id/openchannel_interactions',auth[_0xa978('0x8')](),controller[_0xa978('0x4f')]);router['post']('/:id/whatsapp_interactions',auth[_0xa978('0x8')](),controller['addWhatsappInteractions']);router[_0xa978('0x35')](_0xa978('0x28'),auth['isAuthenticated'](),controller[_0xa978('0x50')]);router[_0xa978('0x35')](_0xa978('0x29'),auth[_0xa978('0x8')](),controller[_0xa978('0x51')]);router[_0xa978('0x35')](_0xa978('0x2a'),auth[_0xa978('0x8')](),controller['addOpenchannelAccounts']);router[_0xa978('0x35')](_0xa978('0x2c'),auth[_0xa978('0x8')](),controller[_0xa978('0x52')]);router[_0xa978('0x35')](_0xa978('0x2e'),auth[_0xa978('0x8')](),controller[_0xa978('0x53')]);router[_0xa978('0x35')](_0xa978('0x30'),auth[_0xa978('0x8')](),controller[_0xa978('0x54')]);router[_0xa978('0x35')](_0xa978('0x32'),auth[_0xa978('0x8')](),controller[_0xa978('0x55')]);router[_0xa978('0x35')](_0xa978('0x56'),auth[_0xa978('0x8')](),controller['createApiKey']);router[_0xa978('0x57')](_0xa978('0xd'),auth[_0xa978('0x8')](),controller[_0xa978('0x58')]);router[_0xa978('0x57')](_0xa978('0x59'),auth[_0xa978('0x8')](),controller[_0xa978('0x5a')]);router[_0xa978('0x5b')]('/:id/queues',auth[_0xa978('0x8')](),controller[_0xa978('0x5c')]);router[_0xa978('0x5b')](_0xa978('0x23'),auth[_0xa978('0x8')](),controller[_0xa978('0x5d')]);router[_0xa978('0x5b')]('/:id',auth[_0xa978('0x8')](),controller[_0xa978('0x5e')]);router[_0xa978('0x5b')](_0xa978('0x48'),auth[_0xa978('0x8')](),controller[_0xa978('0x5f')]);router[_0xa978('0x5b')](_0xa978('0x4a'),auth[_0xa978('0x8')](),controller[_0xa978('0x60')]);router[_0xa978('0x5b')]('/:id/fax_interactions',auth[_0xa978('0x8')](),controller['removeFaxInteractions']);router[_0xa978('0x5b')](_0xa978('0x4e'),auth[_0xa978('0x8')](),controller[_0xa978('0x61')]);router['delete'](_0xa978('0x62'),auth[_0xa978('0x8')](),controller[_0xa978('0x63')]);router[_0xa978('0x5b')](_0xa978('0x64'),auth[_0xa978('0x8')](),controller[_0xa978('0x65')]);router[_0xa978('0x5b')]('/:id/fax_accounts',auth[_0xa978('0x8')](),controller[_0xa978('0x66')]);router[_0xa978('0x5b')](_0xa978('0x29'),auth[_0xa978('0x8')](),controller[_0xa978('0x67')]);router[_0xa978('0x5b')](_0xa978('0x2a'),auth[_0xa978('0x8')](),controller[_0xa978('0x68')]);router[_0xa978('0x5b')]('/:id/sms_accounts',auth[_0xa978('0x8')](),controller['removeSmsAccounts']);router[_0xa978('0x5b')](_0xa978('0x2e'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0xa978('0x5b')](_0xa978('0x30'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router['delete'](_0xa978('0x32'),auth[_0xa978('0x8')](),controller['removeSquareProjects']);router[_0xa978('0x5b')](_0xa978('0x56'),auth['isAuthenticated'](),controller[_0xa978('0x69')]);module[_0xa978('0x6a')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 27060cd..b6c5c36 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 _0x0207=['callerid','format','internal','toLowerCase','ENUM','admin','agent','telephone','local','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','passive','actpass','showWebBar','get','isArray','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','force_avp','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','UNSIGNED','moment','exports','STRING','name','setDataValue','fullname'];(function(_0x354e4e,_0x74f187){var _0x1ca266=function(_0x5772d3){while(--_0x5772d3){_0x354e4e['push'](_0x354e4e['shift']());}};_0x1ca266(++_0x74f187);}(_0x0207,0x162));var _0x7020=function(_0x3c96e9,_0x5a8abd){_0x3c96e9=_0x3c96e9-0x0;var _0x546772=_0x0207[_0x3c96e9];return _0x546772;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7020('0x0'));var util=require('util');var _=require('lodash');module[_0x7020('0x1')]={'name':{'type':Sequelize[_0x7020('0x2')],'allowNull':![],'unique':_0x7020('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x15db09){this[_0x7020('0x4')](_0x7020('0x3'),_0x15db09);this[_0x7020('0x4')]('defaultuser',_0x15db09);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x7020('0x2')],'allowNull':![],'set':function(_0x39263c){this[_0x7020('0x4')](_0x7020('0x5'),_0x39263c);this[_0x7020('0x4')](_0x7020('0x6'),util[_0x7020('0x7')]('\x22%s\x22\x20<%s>',_0x39263c,this['getDataValue'](_0x7020('0x8'))));}},'alias':{'type':Sequelize[_0x7020('0x2')]},'email':{'type':Sequelize[_0x7020('0x2')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x22fff6){if(_0x22fff6){this[_0x7020('0x4')]('email',_0x22fff6[_0x7020('0x9')]());}}},'role':{'type':Sequelize[_0x7020('0xa')](_0x7020('0xb'),'user',_0x7020('0xc'),_0x7020('0xd')),'allowNull':![]},'password':{'type':Sequelize[_0x7020('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x7020('0x2')],'defaultValue':_0x7020('0xe')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x7020('0x8'),'set':function(_0x5f5872){this[_0x7020('0x4')](_0x7020('0x8'),_0x5f5872);this[_0x7020('0x4')](_0x7020('0xf'),_0x5f5872);this[_0x7020('0x4')](_0x7020('0x6'),util['format'](_0x7020('0x10'),this['getDataValue'](_0x7020('0x5')),_0x5f5872));}},'salt':{'type':Sequelize[_0x7020('0x2')]},'phone':{'type':Sequelize[_0x7020('0x2')]},'mobile':{'type':Sequelize[_0x7020('0x2')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x7020('0x2')]},'userpic':{'type':Sequelize[_0x7020('0x2')]},'city':{'type':Sequelize[_0x7020('0x2')]},'country':{'type':Sequelize[_0x7020('0x2')]},'online':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x7020('0x12')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x7020('0x2')],'defaultValue':_0x7020('0x13')},'lastPauseAt':{'type':Sequelize[_0x7020('0x12')]},'chatCapacity':{'type':Sequelize[_0x7020('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x7020('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x7020('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x7020('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x7020('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x7020('0x11')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x7020('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x7020('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x7020('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x7020('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x7020('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x15'),_0x7020('0x16'),_0x7020('0x17')),'allowNull':!![],'defaultValue':_0x7020('0x15')},'context':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![],'defaultValue':_0x7020('0x18')},'callingpres':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x19'),_0x7020('0x1a'),_0x7020('0x1b'),'ALLOWED',_0x7020('0x1c'),_0x7020('0x1d'),_0x7020('0x1e'),_0x7020('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'secret':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![],'defaultValue':_0x7020('0x20'),'set':function(_0xd6f9bb){this[_0x7020('0x4')](_0x7020('0x21'),_0xd6f9bb?_0xd6f9bb['join'](','):null);},'get':function(){return this[_0x7020('0x22')](_0x7020('0x21'))?this[_0x7020('0x22')](_0x7020('0x21'))[_0x7020('0x23')](','):null;},'comment':_0x7020('0x24')},'dtmfmode':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x25'),_0x7020('0x26'),_0x7020('0x27'),_0x7020('0x28'),_0x7020('0x29')),'allowNull':!![],'defaultValue':_0x7020('0x25')},'directmedia':{'type':Sequelize[_0x7020('0xa')]('yes','no',_0x7020('0x2a'),_0x7020('0x2b'),_0x7020('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x7020('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![],'defaultValue':_0x7020('0x2e'),'set':function(_0x24160e){this['setDataValue'](_0x7020('0x2f'),_0x24160e?_0x24160e['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x7020('0x22')](_0x7020('0x2f'))[_0x7020('0x23')](','):null;},'comment':_0x7020('0x30')},'callgroup':{'type':Sequelize[_0x7020('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x7020('0x2')]},'language':{'type':Sequelize[_0x7020('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7020('0x2')]},'disallow':{'type':Sequelize[_0x7020('0x2')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x7020('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x35ebee){this[_0x7020('0x4')](_0x7020('0x31'),_0x35ebee?_0x35ebee['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x7020('0x22')]('allow')?this[_0x7020('0x22')](_0x7020('0x31'))['split'](';'):null;},'comment':_0x7020('0x32')},'autoframing':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x35d64e){this['setDataValue'](_0x7020('0x33'),_0x35d64e?_0x35d64e[_0x7020('0x34')](','):null);},'get':function(){return this[_0x7020('0x22')]('insecure')?this[_0x7020('0x22')](_0x7020('0x33'))[_0x7020('0x23')](','):null;},'comment':_0x7020('0x35')},'trustrpid':{'type':Sequelize[_0x7020('0xa')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x7020('0xa')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x7020('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![],'defaultValue':_0x7020('0x36')},'amaflags':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x7020('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x7020('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'template':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no',_0x7020('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7020('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x7020('0x38'),_0x7020('0x39'),_0x7020('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x7020('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x7020('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x7020('0x3b')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x7020('0x2d')},'keepalive':{'type':Sequelize[_0x7020('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x7020('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x7020('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x7020('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x7020('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x7020('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x7020('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x7020('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no',_0x7020('0x3c'),_0x7020('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x7020('0x3e'),_0x7020('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x7020('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x7020('0xa')](_0x7020('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x7020('0x2d'),'no','nonat',_0x7020('0x2b'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x7020('0x2')]},'resetPasswordExpires':{'type':Sequelize[_0x7020('0x12')]},'passwordResetAt':{'type':Sequelize[_0x7020('0x12')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x7020('0x14')],'defaultValue':0x0,'set':function(_0x3410f3){this[_0x7020('0x4')](_0x7020('0x40'),_0x3410f3);var _0x4017eb=this[_0x7020('0x41')]({'plain':!![]});switch(_0x3410f3){case 0x0:case 0x1:var _0x1f2eab=_0x4017eb[_0x7020('0x21')]?_[_0x7020('0x42')](_0x4017eb['transport'])?_0x4017eb[_0x7020('0x21')][_0x7020('0x34')]():_0x4017eb[_0x7020('0x21')]:_0x7020('0x20');if(_0x1f2eab===_0x7020('0x43')){_0x1f2eab='udp';}this[_0x7020('0x4')](_0x7020('0x21'),_0x1f2eab);this['setDataValue'](_0x7020('0x44'),'no');this[_0x7020('0x4')](_0x7020('0x45'),null);this['setDataValue']('force_avp',null);this[_0x7020('0x4')](_0x7020('0x46'),null);this[_0x7020('0x4')](_0x7020('0x47'),null);this[_0x7020('0x4')](_0x7020('0x48'),null);this[_0x7020('0x4')](_0x7020('0x49'),null);this[_0x7020('0x4')](_0x7020('0x4a'),null);this['setDataValue']('dtlsprivatekey',null);this['setDataValue'](_0x7020('0x4b'),'no');break;case 0x2:this[_0x7020('0x4')](_0x7020('0x21'),'wss');this[_0x7020('0x4')](_0x7020('0x44'),_0x7020('0x2d'));this[_0x7020('0x4')](_0x7020('0x45'),_0x7020('0x2d'));this[_0x7020('0x4')](_0x7020('0x4c'),_0x7020('0x2d'));this['setDataValue']('icesupport',_0x7020('0x2d'));this['setDataValue']('dtlsenable',_0x7020('0x2d'));this['setDataValue']('dtlsverify','no');this[_0x7020('0x4')](_0x7020('0x49'),_0x7020('0x3f'));this[_0x7020('0x4')](_0x7020('0x4a'),_0x4017eb['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this['setDataValue'](_0x7020('0x4d'),_0x4017eb[_0x7020('0x4d')]||_0x7020('0x4e'));this[_0x7020('0x4')](_0x7020('0x4b'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x365fcd){this['setDataValue'](_0x7020('0x4f'),_0x365fcd?_0x365fcd[_0x7020('0x34')](','):[]);},'get':function(){return this[_0x7020('0x22')]('permissions')?_[_0x7020('0x50')](this['getDataValue'](_0x7020('0x4f'))['split'](','),function(_0x4ce957){return parseInt(_0x4ce957,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x7020('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x7020('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0x7020('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x7020('0x11')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x7020('0x11')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x7020('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x7020('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x7020('0x2')]},'phoneBarEnableJaws':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x7020('0x51')],'get':function(){return this[_0x7020('0x22')](_0x7020('0x52'))?this[_0x7020('0x22')](_0x7020('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'interface':{'type':Sequelize[_0x7020('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x7020('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1f3176){if(typeof _0x1f3176===_0x7020('0x53')){var _0x30bfb6=_0x1f3176==='1'?!![]:_0x1f3176==='0'?![]:_0x1f3176===_0x7020('0x54')?!![]:_0x1f3176===_0x7020('0x55')?![]:![];this['setDataValue'](_0x7020('0x56'),_0x30bfb6);}else{this[_0x7020('0x4')](_0x7020('0x56'),_0x1f3176);}}},'blocked':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![],'set':function(_0x5f1c10){this[_0x7020('0x4')](_0x7020('0x57'),_0x5f1c10);if(_0x5f1c10===!![]){this['setDataValue'](_0x7020('0x58'),moment());this[_0x7020('0x4')]('loginAttempts',0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x7020('0x12')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x7020('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x7020('0x11')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x7020('0x11')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x7020('0x14')](0x5)[_0x7020('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x7020('0x11')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7020('0x11')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7020('0x11')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5bbd=['active','passive','actpass','update','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','getDataValue','internal','email','ENUM','admin','agent','local','INTEGER','\x22%s\x22\x20<%s>','DATE','BOOLEAN','dynamic','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','accept','refuse','uas','fingerprint','certificate'];(function(_0x284586,_0x27cbe5){var _0x19d336=function(_0x21408a){while(--_0x21408a){_0x284586['push'](_0x284586['shift']());}};_0x19d336(++_0x27cbe5);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd5bb('0x0'));var moment=require(_0xd5bb('0x1'));var util=require(_0xd5bb('0x2'));var _=require(_0xd5bb('0x3'));module[_0xd5bb('0x4')]={'name':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':![],'unique':_0xd5bb('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x480517){this['setDataValue']('name',_0x480517);this[_0xd5bb('0x7')](_0xd5bb('0x8'),_0x480517);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x292873){this['setDataValue'](_0xd5bb('0x9'),_0x292873);this[_0xd5bb('0x7')](_0xd5bb('0xa'),util['format']('\x22%s\x22\x20<%s>',_0x292873,this[_0xd5bb('0xb')](_0xd5bb('0xc'))));}},'alias':{'type':Sequelize[_0xd5bb('0x5')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd5bb('0xd'),'validate':{'isEmail':!![]},'set':function(_0x43be0a){if(_0x43be0a){this[_0xd5bb('0x7')]('email',_0x43be0a['toLowerCase']());}}},'role':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0xf'),'user',_0xd5bb('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xd5bb('0x11')},'internal':{'type':Sequelize[_0xd5bb('0x12')](0xb),'allowNull':![],'unique':'internal','set':function(_0x37bb78){this[_0xd5bb('0x7')](_0xd5bb('0xc'),_0x37bb78);this['setDataValue']('accountcode',_0x37bb78);this[_0xd5bb('0x7')](_0xd5bb('0xa'),util['format'](_0xd5bb('0x13'),this[_0xd5bb('0xb')](_0xd5bb('0x9')),_0x37bb78));}},'salt':{'type':Sequelize[_0xd5bb('0x5')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xd5bb('0x5')]},'address':{'type':Sequelize[_0xd5bb('0x5')]},'zipcode':{'type':Sequelize[_0xd5bb('0x5')]},'userpic':{'type':Sequelize[_0xd5bb('0x5')]},'city':{'type':Sequelize[_0xd5bb('0x5')]},'country':{'type':Sequelize[_0xd5bb('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xd5bb('0x14')]},'voicePause':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xd5bb('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xd5bb('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xd5bb('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xd5bb('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xd5bb('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xd5bb('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xd5bb('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xd5bb('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![],'defaultValue':_0xd5bb('0x16')},'ipaddr':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xd5bb('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xd5bb('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x17'),_0xd5bb('0x18'),_0xd5bb('0x19')),'allowNull':!![],'defaultValue':_0xd5bb('0x17')},'context':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![],'defaultValue':_0xd5bb('0x1a')},'callingpres':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x1b'),_0xd5bb('0x1c'),_0xd5bb('0x1d'),_0xd5bb('0x1e'),_0xd5bb('0x1f'),_0xd5bb('0x20'),_0xd5bb('0x21'),_0xd5bb('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![],'defaultValue':_0xd5bb('0x23'),'set':function(_0x3ac77f){this['setDataValue'](_0xd5bb('0x24'),_0x3ac77f?_0x3ac77f[_0xd5bb('0x25')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xd5bb('0xb')](_0xd5bb('0x24'))['split'](','):null;},'comment':_0xd5bb('0x26')},'dtmfmode':{'type':Sequelize['ENUM'](_0xd5bb('0x27'),_0xd5bb('0x28'),'shortinfo',_0xd5bb('0x29'),_0xd5bb('0x2a')),'allowNull':!![],'defaultValue':_0xd5bb('0x27')},'directmedia':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x2b'),'no',_0xd5bb('0x2c'),'update',_0xd5bb('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd5bb('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![],'defaultValue':_0xd5bb('0x2e'),'set':function(_0x13ea53){this[_0xd5bb('0x7')](_0xd5bb('0x2f'),_0x13ea53?_0x13ea53[_0xd5bb('0x25')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0xd5bb('0xb')]('nat')[_0xd5bb('0x30')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xd5bb('0x5')]},'pickupgroup':{'type':Sequelize[_0xd5bb('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xd5bb('0x5')]},'language':{'type':Sequelize[_0xd5bb('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd5bb('0x5')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd5bb('0x31'),'set':function(_0x1b1680){this[_0xd5bb('0x7')](_0xd5bb('0x32'),_0x1b1680?_0x1b1680['join'](';'):_0xd5bb('0x31'));},'get':function(){return this[_0xd5bb('0xb')](_0xd5bb('0x32'))?this['getDataValue'](_0xd5bb('0x32'))['split'](';'):null;},'comment':_0xd5bb('0x33')},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![],'set':function(_0x50471b){this['setDataValue'](_0xd5bb('0x34'),_0x50471b?_0x50471b['join'](','):null);},'get':function(){return this[_0xd5bb('0xb')](_0xd5bb('0x34'))?this[_0xd5bb('0xb')]('insecure')[_0xd5bb('0x30')](','):null;},'comment':_0xd5bb('0x35')},'trustrpid':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xd5bb('0x2b'),'no',_0xd5bb('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xd5bb('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![],'defaultValue':_0xd5bb('0x37')},'amaflags':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xd5bb('0x2b')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xd5bb('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xd5bb('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x2b'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd5bb('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xd5bb('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x38'),_0xd5bb('0x39'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xd5bb('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xd5bb('0xe')]('uac',_0xd5bb('0x3a')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xd5bb('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xd5bb('0x2b')},'keepalive':{'type':Sequelize[_0xd5bb('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xd5bb('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xd5bb('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xd5bb('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xd5bb('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xd5bb('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xd5bb('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xd5bb('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xd5bb('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xd5bb('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xd5bb('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xd5bb('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xd5bb('0x2b'),'no',_0xd5bb('0x3b'),_0xd5bb('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xd5bb('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x3d'),_0xd5bb('0x3e'),_0xd5bb('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xd5bb('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xd5bb('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xd5bb('0xe')](_0xd5bb('0x2b'),'no',_0xd5bb('0x2c'),_0xd5bb('0x40'),_0xd5bb('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xd5bb('0x14')]},'passwordResetAt':{'type':Sequelize[_0xd5bb('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xd5bb('0x42')]},'showWebBar':{'type':Sequelize[_0xd5bb('0x12')],'defaultValue':0x0,'set':function(_0x2fe8ff){this[_0xd5bb('0x7')](_0xd5bb('0x43'),_0x2fe8ff);var _0xadf5e5=this[_0xd5bb('0x44')]({'plain':!![]});switch(_0x2fe8ff){case 0x0:case 0x1:var _0x3ffaac=_0xadf5e5['transport']?_[_0xd5bb('0x45')](_0xadf5e5['transport'])?_0xadf5e5[_0xd5bb('0x24')]['join']():_0xadf5e5[_0xd5bb('0x24')]:_0xd5bb('0x23');if(_0x3ffaac===_0xd5bb('0x46')){_0x3ffaac=_0xd5bb('0x23');}this[_0xd5bb('0x7')]('transport',_0x3ffaac);this['setDataValue'](_0xd5bb('0x47'),'no');this['setDataValue'](_0xd5bb('0x48'),null);this['setDataValue']('force_avp',null);this['setDataValue'](_0xd5bb('0x49'),null);this[_0xd5bb('0x7')](_0xd5bb('0x4a'),null);this[_0xd5bb('0x7')](_0xd5bb('0x4b'),null);this[_0xd5bb('0x7')](_0xd5bb('0x4c'),null);this[_0xd5bb('0x7')](_0xd5bb('0x4d'),null);this[_0xd5bb('0x7')](_0xd5bb('0x4e'),null);this[_0xd5bb('0x7')](_0xd5bb('0x4f'),'no');break;case 0x2:this[_0xd5bb('0x7')](_0xd5bb('0x24'),'wss');this[_0xd5bb('0x7')](_0xd5bb('0x47'),_0xd5bb('0x2b'));this[_0xd5bb('0x7')](_0xd5bb('0x48'),'yes');this[_0xd5bb('0x7')]('force_avp',_0xd5bb('0x2b'));this['setDataValue']('icesupport',_0xd5bb('0x2b'));this[_0xd5bb('0x7')]('dtlsenable',_0xd5bb('0x2b'));this[_0xd5bb('0x7')](_0xd5bb('0x4b'),'no');this['setDataValue'](_0xd5bb('0x4c'),_0xd5bb('0x3f'));this['setDataValue'](_0xd5bb('0x4d'),_0xadf5e5['dtlscertfile']||_0xd5bb('0x50'));this[_0xd5bb('0x7')](_0xd5bb('0x4e'),_0xadf5e5['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0xd5bb('0x4f'),_0xd5bb('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0xd5bb('0x42')],'set':function(_0x42d735){this['setDataValue'](_0xd5bb('0x51'),_0x42d735?_0x42d735[_0xd5bb('0x25')](','):[]);},'get':function(){return this[_0xd5bb('0xb')](_0xd5bb('0x51'))?_['map'](this[_0xd5bb('0xb')](_0xd5bb('0x51'))['split'](','),function(_0x129022){return parseInt(_0x129022,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xd5bb('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xd5bb('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xd5bb('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xd5bb('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xd5bb('0x5')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xd5bb('0x52')],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0xd5bb('0xb')](_0xd5bb('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xd5bb('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xd5bb('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![],'set':function(_0x57dabb){if(typeof _0x57dabb===_0xd5bb('0x54')){var _0x23798a=_0x57dabb==='1'?!![]:_0x57dabb==='0'?![]:_0x57dabb==='true'?!![]:_0x57dabb===_0xd5bb('0x55')?![]:![];this[_0xd5bb('0x7')](_0xd5bb('0x56'),_0x23798a);}else{this[_0xd5bb('0x7')]('screenrecording',_0x57dabb);}}},'blocked':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![],'set':function(_0x4ac334){this[_0xd5bb('0x7')]('blocked',_0x4ac334);if(_0x4ac334===!![]){this[_0xd5bb('0x7')](_0xd5bb('0x57'),moment());this[_0xd5bb('0x7')](_0xd5bb('0x58'),0x0);}else{this[_0xd5bb('0x7')](_0xd5bb('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0xd5bb('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xd5bb('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xd5bb('0x12')](0x5)[_0xd5bb('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xd5bb('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 27a4526..61910cc 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 _0xe2fe=['Whatsapp','Fax','getOpenchannelQueues','Openchannel','transaction','addAgent','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','removeTeams','Chat','getMailQueues','Mail','flatten','removeAgent','UserVoicePrefix','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$overlap','$contains','$contained','firstName','lastName','Contact','dialActive','getApiKey','token','No\x20API\x20access\x20key\x20found!','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','queues','teams','desc','asc','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','client','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','offline','idle','unknown','ringing','voiceStatus','busy','slice','toUpperCase','SELECT','ui.','field','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','path','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','redis','register','localhost','request','then','info','User,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','role','Users','Agents','agent','telephone','map','value','includes','find','name','stack','send','index','User','rawAttributes','fieldName','type','key','password','includeAll','attributes','push','findAll','openTabs','true','length','chat','rows','dataValues','sms','mail','openchannel','whatsapp','model','keys','salt','query','intersection','fields','include','merge','fax','body','describe','params','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','mailbox','VoiceMail','fullname','102','110','104','106','108','109','100','111','114','115','user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','create','UserProfileSection','Telephones','UserProfileResource','bulkCreate','Unauthorized','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','all','each','isEmpty','autoAssociation','compact','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','ValidationError','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','channel','online','loginInPause','interface','Unknown\x20channel','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','VoiceQueue','format','SIP/%s','voicePause','UserVoiceQueueRt','upsert','remove','isArray','Queue:remove','addAvatar','userpic','file','getAvatar','root','existsSync','join','server/files/images/','download','getOpenTabs','ChatOpenTabs','CHAT','FAX','createdAt','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','getContacts','CmContact','filters','sort','where','filter','options','List','Tag','Tags','color','tag','nolimit','getQueues','isValidChannel','order','Queue','hasOwnProperty','getVoiceQueuesRt','pick','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','LOCAL/%s@from-sip/n','intrf','user:%s','headers','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','PAUSE','LOGININPAUSE','MemberReport','concat','isMiddleware','resolve','QueuePause','pause','updateAttributes','getChannels','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','%s%s','Pause','getTeams','Team','addTeams','setDataValue','getChatQueues','getSmsQueues','Sms','getWhatsappQueues'];(function(_0x3df028,_0x3452ca){var _0x2f6514=function(_0x3191f4){while(--_0x3191f4){_0x3df028['push'](_0x3df028['shift']());}};_0x2f6514(++_0x3452ca);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0xee2f('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xee2f('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0xee2f('0x2'));var jayson=require(_0xee2f('0x3'));var Redis=require(_0xee2f('0x4'));var authService=require(_0xee2f('0x5'));var qs=require(_0xee2f('0x6'));var logger=require('../../config/logger')(_0xee2f('0x7'));var utils=require(_0xee2f('0x8'));var config=require('../../config/environment');var licenseUtil=require(_0xee2f('0x9'));var db=require(_0xee2f('0xa'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xee2f('0xb')]));require('./user.socket')[_0xee2f('0xc')](socket);config[_0xee2f('0xb')]=_['defaults'](config[_0xee2f('0xb')],{'host':_0xee2f('0xd'),'port':0x18eb});var client=jayson['client']['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x4818df,_0x56bbea,_0x2b8fb1,_0x4cb4bf){return new BPromise(function(_0x481ea7,_0x53047d){var _0x25ddf7=_0x4cb4bf||client;return _0x25ddf7[_0xee2f('0xe')](_0x4818df,_0x2b8fb1)[_0xee2f('0xf')](function(_0x100449){logger[_0xee2f('0x10')](_0xee2f('0x11'),_0x56bbea,'request\x20sent');logger[_0xee2f('0x12')]('User,\x20%s,\x20%s,\x20%s',_0x56bbea,_0xee2f('0x13'),JSON[_0xee2f('0x14')](_0x100449));if(_0x100449['error']){if(_0x100449[_0xee2f('0x15')][_0xee2f('0x16')]===0x1f4){logger[_0xee2f('0x15')](_0xee2f('0x11'),_0x56bbea,_0x100449[_0xee2f('0x15')]['message']);return _0x53047d(_0x100449[_0xee2f('0x15')]['message']);}logger[_0xee2f('0x15')](_0xee2f('0x11'),_0x56bbea,_0x100449['error']['message']);return _0x481ea7(_0x100449[_0xee2f('0x15')]['message']);}else{logger[_0xee2f('0x10')](_0xee2f('0x11'),_0x56bbea,_0xee2f('0x13'));_0x481ea7(_0x100449['result'][_0xee2f('0x17')]);}})[_0xee2f('0x18')](function(_0x4db2cc){logger[_0xee2f('0x15')](_0xee2f('0x11'),_0x56bbea,_0x4db2cc);_0x53047d(_0x4db2cc);});});}function respondWithStatusCode(_0x5d36d4,_0x5e73ad){_0x5e73ad=_0x5e73ad||0xcc;return function(_0x40d1fd){if(_0x40d1fd){return _0x5d36d4[_0xee2f('0x19')](_0x5e73ad);}return _0x5d36d4[_0xee2f('0x1a')](_0x5e73ad)[_0xee2f('0x1b')]();};}function respondWithResult(_0x472e3b,_0xf278cc){_0xf278cc=_0xf278cc||0xc8;return function(_0x39a39c){if(_0x39a39c){return _0x472e3b['status'](_0xf278cc)[_0xee2f('0x1c')](_0x39a39c);}};}function respondWithFilteredResult(_0x2c47c5,_0x15ceda){return function(_0x70e308){if(_0x70e308){var _0x820101=typeof _0x15ceda[_0xee2f('0x1d')]===_0xee2f('0x1e')&&typeof _0x15ceda[_0xee2f('0x1f')]===_0xee2f('0x1e');var _0x1e394f=_0x70e308[_0xee2f('0x20')];var _0x168adc=_0x820101?0x0:_0x15ceda[_0xee2f('0x1d')];var _0x45c4a0=_0x820101?_0x70e308['count']:_0x15ceda['offset']+_0x15ceda['limit'];var _0x18bdbb;if(_0x45c4a0>=_0x1e394f){_0x45c4a0=_0x1e394f;_0x18bdbb=0xc8;}else{_0x18bdbb=0xce;}_0x2c47c5[_0xee2f('0x1a')](_0x18bdbb);return _0x2c47c5[_0xee2f('0x21')](_0xee2f('0x22'),_0x168adc+'-'+_0x45c4a0+'/'+_0x1e394f)[_0xee2f('0x1c')](_0x70e308);}return null;};}function saveUpdates(_0x3737fd){return function(_0x4d8398){if(_0x4d8398){return _0x4d8398[_0xee2f('0x23')](_0x3737fd)['then'](function(_0x235697){return _0x235697;});}return null;};}function removeEntity(_0x180429){return function(_0x25ee9c){if(_0x25ee9c){return _0x25ee9c[_0xee2f('0x24')]()[_0xee2f('0xf')](function(){var _0x47d5a6=_0x25ee9c[_0xee2f('0x25')]({'plain':!![]});if(_0x47d5a6[_0xee2f('0x26')]==='admin')return;var _0x4ee0e1=[{'name':_0xee2f('0x27'),'value':'user','ignore':!![]},{'name':_0xee2f('0x28'),'value':_0xee2f('0x29'),'ignore':![]},{'name':'Telephones','value':_0xee2f('0x2a'),'ignore':![]}];var _0x5ca9f6=_(_0x4ee0e1)['filter']('ignore')[_0xee2f('0x2b')](_0xee2f('0x2c'))['value']();if(_[_0xee2f('0x2d')](_0x5ca9f6,_0x47d5a6[_0xee2f('0x26')])){return;}var _0xd64b7=_[_0xee2f('0x2e')](_0x4ee0e1,[_0xee2f('0x2c'),_0x47d5a6['role']])[_0xee2f('0x2f')];return db['UserProfileResource'][_0xee2f('0x24')]({'where':{'type':_0xd64b7,'resourceId':_0x47d5a6['id']}})[_0xee2f('0xf')](function(){return _0x25ee9c;});})[_0xee2f('0xf')](function(){_0x180429['status'](0xcc)[_0xee2f('0x1b')]();});}};}function handleEntityNotFound(_0x5ed71e){return function(_0xd3aaa9){if(!_0xd3aaa9){_0x5ed71e['sendStatus'](0x194);}return _0xd3aaa9;};}function handleError(_0x3e6dcc,_0x13a824){_0x13a824=_0x13a824||0x1f4;return function(_0x13149e){logger[_0xee2f('0x15')](_0x13149e[_0xee2f('0x30')]);if(_0x13149e[_0xee2f('0x2f')]){delete _0x13149e[_0xee2f('0x2f')];}_0x3e6dcc[_0xee2f('0x1a')](_0x13a824)[_0xee2f('0x31')](_0x13149e);};}exports[_0xee2f('0x32')]=function(_0x433547,_0x5ad0a7){var _0x4584b8={},_0x47e54b={'count':0x0,'rows':[]};var _0x46166f=_(db[_0xee2f('0x33')][_0xee2f('0x34')])[_0xee2f('0x2b')](function(_0xaddf3b){return{'name':_0xaddf3b[_0xee2f('0x35')],'type':_0xaddf3b[_0xee2f('0x36')][_0xee2f('0x37')]};})['filter'](function(_0x562d58){return!_['includes']([_0xee2f('0x38'),'salt'],_0x562d58[_0xee2f('0x2f')]);})['value']();_0x4584b8=qs['getOptions'](_0x46166f,_0x433547);var _0x5027a6={'where':_0x4584b8['where']};return db[_0xee2f('0x33')][_0xee2f('0x20')](_0x5027a6)[_0xee2f('0xf')](function(_0x268775){_0x47e54b['count']=_0x268775;if(_0x433547['query'][_0xee2f('0x39')]){_0x4584b8['include']=[{'all':!![]}];}if(!_['includes'](_0x4584b8[_0xee2f('0x3a')],'id')){_0x4584b8[_0xee2f('0x3a')][_0xee2f('0x3b')]('id');}return db['User'][_0xee2f('0x3c')](_0x4584b8);})[_0xee2f('0xf')](function(_0x19bd4d){_0x47e54b['rows']=_0x19bd4d;if(_0x433547['query'][_0xee2f('0x3d')]===_0xee2f('0x3e')){var _0x3bf382=[];for(var _0x2b9b33=0x0;_0x2b9b33<_0x47e54b['rows'][_0xee2f('0x3f')];_0x2b9b33++){_0x3bf382[_0xee2f('0x3b')](get_open_tabs(_0xee2f('0x40'),_0x47e54b[_0xee2f('0x41')][_0x2b9b33][_0xee2f('0x42')]));_0x3bf382[_0xee2f('0x3b')](get_open_tabs(_0xee2f('0x43'),_0x47e54b[_0xee2f('0x41')][_0x2b9b33][_0xee2f('0x42')]));_0x3bf382[_0xee2f('0x3b')](get_open_tabs('fax',_0x47e54b['rows'][_0x2b9b33]['dataValues']));_0x3bf382['push'](get_open_tabs(_0xee2f('0x44'),_0x47e54b[_0xee2f('0x41')][_0x2b9b33][_0xee2f('0x42')]));_0x3bf382[_0xee2f('0x3b')](get_open_tabs(_0xee2f('0x45'),_0x47e54b['rows'][_0x2b9b33][_0xee2f('0x42')]));_0x3bf382[_0xee2f('0x3b')](get_open_tabs(_0xee2f('0x46'),_0x47e54b[_0xee2f('0x41')][_0x2b9b33]['dataValues']));}return BPromise['all'](_0x3bf382)['then'](function(_0x1609f0){return _0x47e54b;});}else{return _0x47e54b;}})['then'](respondWithFilteredResult(_0x5ad0a7,_0x4584b8))['catch'](handleError(_0x5ad0a7,null));};exports['show']=function(_0x5f39b4,_0x3834d1){var _0x3ebb54={'raw':![],'where':{'id':_0x5f39b4['params']['id']}},_0x32da72={};_0x32da72[_0xee2f('0x47')]=_['differenceBy'](_[_0xee2f('0x48')](db[_0xee2f('0x33')][_0xee2f('0x34')]),[_0xee2f('0x38'),_0xee2f('0x49')]);_0x32da72['query']=_['keys'](_0x5f39b4[_0xee2f('0x4a')]);_0x32da72['filters']=_[_0xee2f('0x4b')](_0x32da72[_0xee2f('0x47')],_0x32da72[_0xee2f('0x4a')]);_0x3ebb54[_0xee2f('0x3a')]=_['intersection'](_0x32da72['model'],qs[_0xee2f('0x4c')](_0x5f39b4[_0xee2f('0x4a')][_0xee2f('0x4c')]));_0x3ebb54[_0xee2f('0x3a')]=_0x3ebb54[_0xee2f('0x3a')][_0xee2f('0x3f')]?_0x3ebb54[_0xee2f('0x3a')]:_0x32da72[_0xee2f('0x47')];if(_0x5f39b4[_0xee2f('0x4a')][_0xee2f('0x39')]){_0x3ebb54[_0xee2f('0x4d')]=[{'all':!![]}];}_0x3ebb54=_[_0xee2f('0x4e')]({},_0x3ebb54,_0x5f39b4['options']);if(!_[_0xee2f('0x2d')](_0x3ebb54[_0xee2f('0x3a')],'id')){_0x3ebb54[_0xee2f('0x3a')][_0xee2f('0x3b')]('id');}return db['User'][_0xee2f('0x2e')](_0x3ebb54)[_0xee2f('0xf')](handleEntityNotFound(_0x3834d1,null))[_0xee2f('0xf')](function(_0xda9ad5){var _0xa88c4c=[];values=_0xda9ad5;if(_0x5f39b4['query'][_0xee2f('0x3d')]==='true'){_0xa88c4c['push'](get_open_tabs(_0xee2f('0x40'),_0xda9ad5[_0xee2f('0x42')]));_0xa88c4c[_0xee2f('0x3b')](get_open_tabs(_0xee2f('0x43'),_0xda9ad5[_0xee2f('0x42')]));_0xa88c4c[_0xee2f('0x3b')](get_open_tabs(_0xee2f('0x45'),_0xda9ad5['dataValues']));_0xa88c4c[_0xee2f('0x3b')](get_open_tabs(_0xee2f('0x46'),_0xda9ad5[_0xee2f('0x42')]));_0xa88c4c[_0xee2f('0x3b')](get_open_tabs(_0xee2f('0x4f'),_0xda9ad5[_0xee2f('0x42')]));_0xa88c4c[_0xee2f('0x3b')](get_open_tabs(_0xee2f('0x44'),_0xda9ad5[_0xee2f('0x42')]));return BPromise['all'](_0xa88c4c);}else{return values;}})[_0xee2f('0xf')](function(_0x4b9d29){return values;})[_0xee2f('0xf')](respondWithResult(_0x3834d1,null))[_0xee2f('0x18')](handleError(_0x3834d1,null));};exports[_0xee2f('0x23')]=function(_0x11ba31,_0x2f3891){if(_0x11ba31['body']['id']){delete _0x11ba31[_0xee2f('0x50')]['id'];}delete _0x11ba31[_0xee2f('0x50')][_0xee2f('0x26')];return db[_0xee2f('0x33')]['find']({'where':{'id':_0x11ba31['params']['id']}})['then'](handleEntityNotFound(_0x2f3891,null))['then'](saveUpdates(_0x11ba31['body'],null))[_0xee2f('0xf')](respondWithResult(_0x2f3891,null))['catch'](handleError(_0x2f3891,null));};exports[_0xee2f('0x51')]=function(_0x1421da,_0xd967e9){return db[_0xee2f('0x33')][_0xee2f('0x51')]()[_0xee2f('0xf')](respondWithResult(_0xd967e9,null))['catch'](handleError(_0xd967e9,null));};exports['addContacts']=function(_0x1708c5,_0x58e464){return db[_0xee2f('0x33')]['find']({'where':{'id':_0x1708c5[_0xee2f('0x52')]['id']}})['then'](handleEntityNotFound(_0x58e464,null))[_0xee2f('0xf')](function(_0x38616b){if(_0x38616b){return _0x38616b[_0xee2f('0x53')](_0x1708c5['body'][_0xee2f('0x54')],_[_0xee2f('0x55')](_0x1708c5[_0xee2f('0x50')],[_0xee2f('0x54'),'id'])||{});}})[_0xee2f('0xf')](respondWithResult(_0x58e464,null))[_0xee2f('0x18')](handleError(_0x58e464,null));};function validateUser(_0xf0c721){return new BPromise(function(_0x54f48f,_0x3ee766){if(_0xf0c721[_0xee2f('0x56')])return _0x54f48f(_0xf0c721);return db[_0xee2f('0x57')][_0xee2f('0x58')](0x1)[_0xee2f('0xf')](function(_0x3c9d47){if(_0x3c9d47[_0xee2f('0x59')])authService[_0xee2f('0x5a')](_0xf0c721[_0xee2f('0x38')]);db[_0xee2f('0x33')][_0xee2f('0x5b')]('internal')[_0xee2f('0xf')](function(_0xf15bc1){if(_['isNil'](_0xf15bc1)){_0xf0c721[_0xee2f('0x56')]=_0x3c9d47['min_internal']||0x1;return;}if(_[_0xee2f('0x5c')](_0x3c9d47['min_internal'])||_0x3c9d47['min_internal']===_0xf15bc1){_0xf0c721[_0xee2f('0x56')]=_0xf15bc1+0x1;return;}if(_0x3c9d47[_0xee2f('0x5d')]>_0xf15bc1){_0xf0c721[_0xee2f('0x56')]=_0x3c9d47[_0xee2f('0x5d')];return;}return db[_0xee2f('0x5e')]['query'](_0xee2f('0x5f'),{'type':db[_0xee2f('0x5e')][_0xee2f('0x60')]['SELECT']})[_0xee2f('0xf')](function(_0x413d70){if(_0x413d70&&_0x413d70['length']){for(var _0x1f1c55=0x0,_0x32800d=_0x413d70[_0xee2f('0x3f')];_0x1f1c55<_0x32800d&&_[_0xee2f('0x5c')](_0xf0c721[_0xee2f('0x56')]);_0x1f1c55++){if(_0x3c9d47[_0xee2f('0x5d')]<=_0x413d70[_0x1f1c55][_0xee2f('0x61')]){_0xf0c721[_0xee2f('0x56')]=_0x413d70[_0x1f1c55][_0xee2f('0x61')];}else if(_0x3c9d47['min_internal']>_0x413d70[_0x1f1c55]['from']&&_0x3c9d47['min_internal']<=_0x413d70[_0x1f1c55]['to']){_0xf0c721[_0xee2f('0x56')]=_0x3c9d47[_0xee2f('0x5d')];}}}if(_[_0xee2f('0x5c')](_0xf0c721[_0xee2f('0x56')])){_0xf0c721[_0xee2f('0x56')]=_0xf15bc1+0x1;}return _0x54f48f(_0xf0c721);});});})['catch'](function(_0x2b69f0){_0x3ee766(_0x2b69f0);});});}function updateUser(_0x3a4464){return new BPromise(function(_0x4e39ba,_0x2c4a18){try{if(_0x3a4464[_0xee2f('0x62')]){_0x3a4464[_0xee2f('0x63')]=_0x3a4464['internal'];_0x3a4464[_0xee2f('0x64')]={'mailbox':_0x3a4464['internal'],'password':_0x3a4464[_0xee2f('0x38')],'fullname':_0x3a4464[_0xee2f('0x65')],'email':_0x3a4464['email']};}if(_0x3a4464[_0xee2f('0x26')]===_0xee2f('0x29')){if(!_0x3a4464['permissions'])_0x3a4464['permissions']=['101',_0xee2f('0x66'),'103','113',_0xee2f('0x67'),_0xee2f('0x68'),'105',_0xee2f('0x69'),'107',_0xee2f('0x6a'),_0xee2f('0x6b'),_0xee2f('0x6c'),_0xee2f('0x6d'),_0xee2f('0x6e'),_0xee2f('0x6f')];}_0x4e39ba(_0x3a4464);}catch(_0x20990f){_0x2c4a18(_0x20990f);}});}exports['create']=function(_0x86eb61,_0x2989a8){if(_0x86eb61[_0xee2f('0x70')][_0xee2f('0x26')]===_0xee2f('0x29'))throw new Error('Unauthorized');if(_0x86eb61[_0xee2f('0x50')][_0xee2f('0x26')]===_0xee2f('0x70')&&_0x86eb61[_0xee2f('0x70')][_0xee2f('0x26')]!==_0xee2f('0x71')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x86eb61['body'][_0xee2f('0x26')]===_0xee2f('0x71')&&_0x86eb61[_0xee2f('0x70')][_0xee2f('0x26')]!==_0xee2f('0x71')){throw new Error(_0xee2f('0x72'));}return licenseUtil[_0xee2f('0x73')]([_0x86eb61['body']])['then'](function(){return validateUser(_0x86eb61[_0xee2f('0x50')]);})[_0xee2f('0xf')](function(_0x12c4f9){return updateUser(_0x12c4f9)[_0xee2f('0xf')](function(_0x38ee46){if(_0x38ee46[_0xee2f('0x26')]===_0xee2f('0x71')){_0x38ee46[_0xee2f('0x74')]=_0x86eb61[_0xee2f('0x70')][_0xee2f('0x74')];delete _0x38ee46[_0xee2f('0x75')];}return _0x38ee46;});})[_0xee2f('0xf')](function(_0x563d01){return db['User'][_0xee2f('0x76')](_0x563d01,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})['then'](function(_0x5a1fdc){if(_0x86eb61[_0xee2f('0x50')][_0xee2f('0x26')]==='user')return _0x5a1fdc;if(_0x86eb61['user'][_0xee2f('0x26')]!==_0xee2f('0x70'))return _0x5a1fdc;return db[_0xee2f('0x77')]['find']({'where':{'name':_0x5a1fdc['role']===_0xee2f('0x29')?_0xee2f('0x28'):_0xee2f('0x78'),'userProfileId':_0x86eb61['user'][_0xee2f('0x75')]},'raw':!![]})['then'](function(_0x1afacf){if(!_0x1afacf||_0x1afacf['autoAssociation']!=0x0)return _0x5a1fdc;return db[_0xee2f('0x79')][_0xee2f('0x76')]({'name':_0x5a1fdc[_0xee2f('0x2f')],'resourceId':_0x5a1fdc['id'],'type':_0x1afacf['name'],'sectionId':_0x1afacf['id']},{})['then'](function(){return _0x5a1fdc;});})[_0xee2f('0x18')](function(_0x4448a6){logger[_0xee2f('0x15')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4448a6);throw _0x4448a6;});})[_0xee2f('0xf')](respondWithResult(_0x2989a8,0xc9))[_0xee2f('0x18')](handleError(_0x2989a8,null));};exports[_0xee2f('0x7a')]=function(_0x346fc2,_0x413340){var _0x2c14f=_0x346fc2[_0xee2f('0x50')];var _0x16326e=[];if(_0x346fc2[_0xee2f('0x70')][_0xee2f('0x26')]===_0xee2f('0x29'))throw new Error(_0xee2f('0x7b'));if(_[_0xee2f('0x7c')](_0x2c14f,[_0xee2f('0x26'),'user'])&&_0x346fc2[_0xee2f('0x70')][_0xee2f('0x26')]!==_0xee2f('0x71')){throw new Error(_0xee2f('0x7d'));}if(_[_0xee2f('0x7c')](_0x2c14f,[_0xee2f('0x26'),_0xee2f('0x71')])&&_0x346fc2[_0xee2f('0x70')][_0xee2f('0x26')]!==_0xee2f('0x71')){throw new Error(_0xee2f('0x7e'));}return licenseUtil['checkUserLimits'](_0x2c14f)[_0xee2f('0xf')](function(){return validateUser(_0x2c14f[0x0]);})[_0xee2f('0xf')](function(){for(var _0x1422e9=0x1;_0x1422e9<_0x2c14f[_0xee2f('0x3f')];_0x1422e9++){var _0x53d769=_0x2c14f[_0x1422e9-0x1][_0xee2f('0x56')];if(!_0x2c14f[_0x1422e9][_0xee2f('0x56')])_0x2c14f[_0x1422e9][_0xee2f('0x56')]=_0x53d769+0x1;_0x16326e['push'](validateUser(_0x2c14f[_0x1422e9]));}return BPromise['all'](_0x16326e);})[_0xee2f('0xf')](function(){_0x16326e=[];for(var _0x48fe47=0x0;_0x48fe47<_0x2c14f['length'];_0x48fe47++){_0x16326e['push'](updateUser(_0x2c14f[_0x48fe47]));}return BPromise[_0xee2f('0x7f')](_0x16326e);})[_0xee2f('0xf')](function(){return BPromise[_0xee2f('0x80')](_0x2c14f,function(_0x172cee){return db['User'][_0xee2f('0x76')](_0x172cee,{'include':[{'model':db[_0xee2f('0x64')],'as':_0xee2f('0x64')}]})['then'](function(_0x20e5db){_0x172cee['id']=_0x20e5db['id'];return _0x172cee;});});})['then'](function(_0x150445){if(_0x346fc2['body']['role']===_0xee2f('0x70'))return _0x150445;if(_0x346fc2['user'][_0xee2f('0x26')]!=='user')return _0x150445;var _0x4e585b=_[_0xee2f('0x7c')](_0x150445,function(_0x20bc03){return _0x20bc03['role']===_0xee2f('0x29')||_0x20bc03[_0xee2f('0x26')]==='telephone';});if(!_0x4e585b)return _0x150445;return db['UserProfileSection'][_0xee2f('0x3c')]({'where':{'name':{'$or':[_0xee2f('0x28'),'Telephones']},'userProfileId':_0x346fc2[_0xee2f('0x70')][_0xee2f('0x75')]},'raw':!![]})[_0xee2f('0xf')](function(_0x2238c2){if(_[_0xee2f('0x81')](_0x2238c2)||!_['some'](_0x2238c2,['autoAssociation',0x0]))return _0x150445;_0x16326e=[];var _0x567de2=_(_0x2238c2)[_0xee2f('0x2b')](function(_0x1fe927){if(_0x1fe927[_0xee2f('0x82')]===0x1)return;return _0x1fe927[_0xee2f('0x2f')]===_0xee2f('0x28')?_0xee2f('0x29'):_0xee2f('0x2a');})[_0xee2f('0x83')]()[_0xee2f('0x2c')]();for(var _0x173f5f=0x0;_0x173f5f<_0x150445[_0xee2f('0x3f')];_0x173f5f++){if(!_[_0xee2f('0x2d')](_0x567de2,_0x150445[_0x173f5f][_0xee2f('0x26')]))return;var _0x470780=_0x150445[_0x173f5f][_0xee2f('0x26')]===_0xee2f('0x29')?'Agents':'Telephones';_0x16326e[_0xee2f('0x3b')](db[_0xee2f('0x79')]['create']({'name':_0x150445[_0x173f5f][_0xee2f('0x2f')],'resourceId':_0x150445[_0x173f5f]['id'],'type':_0x470780,'sectionId':_[_0xee2f('0x2e')](_0x2238c2,[_0xee2f('0x2f'),_0x470780])['id']},{}));}return BPromise['all'](_0x16326e);});})[_0xee2f('0xf')](respondWithResult(_0x413340,0xc9))[_0xee2f('0x18')](handleError(_0x413340,null));};exports[_0xee2f('0x84')]=function(_0x609bd9,_0x1954b5){if(_0x609bd9[_0xee2f('0x50')]['id']){delete _0x609bd9[_0xee2f('0x50')]['id'];}return db[_0xee2f('0x33')][_0xee2f('0x2e')]({'where':{'id':_0x609bd9['params']['id']}})[_0xee2f('0xf')](function(_0x16b101){if(!_0x16b101)return null;if(_0x16b101['id']===_0x609bd9[_0xee2f('0x70')]['id']){if(!_0x609bd9[_0xee2f('0x50')][_0xee2f('0x85')]||!_0x609bd9[_0xee2f('0x50')][_0xee2f('0x86')]){throw new db[(_0xee2f('0x87'))]['ValidationError'](_0xee2f('0x88'));}if(!_0x16b101[_0xee2f('0x89')](_0x609bd9['body'][_0xee2f('0x85')])){throw new db['Sequelize']['ValidationError'](_0xee2f('0x8a'));}if(_0x609bd9[_0xee2f('0x50')][_0xee2f('0x85')]===_0x609bd9[_0xee2f('0x50')][_0xee2f('0x86')]){throw new db[(_0xee2f('0x87'))]['ValidationError'](_0xee2f('0x8b'));}}else if(_0x609bd9[_0xee2f('0x70')]['role']===_0xee2f('0x71')){if(!_0x609bd9[_0xee2f('0x50')]['newPassword']){throw new db[(_0xee2f('0x87'))][(_0xee2f('0x8c'))](_0xee2f('0x8d'));}}else if(_0x609bd9[_0xee2f('0x70')][_0xee2f('0x26')]===_0xee2f('0x70')){if(!_0x609bd9[_0xee2f('0x50')][_0xee2f('0x86')]){throw new db[(_0xee2f('0x87'))][(_0xee2f('0x8c'))](_0xee2f('0x8d'));}if(_0x16b101[_0xee2f('0x26')]!=='agent'){throw new db[(_0xee2f('0x87'))]['ValidationError']('Unauthorized');}}else{throw new db['Sequelize'][(_0xee2f('0x8c'))]('Unauthorized');}return _0x16b101;})[_0xee2f('0xf')](handleEntityNotFound(_0x1954b5,null))[_0xee2f('0xf')](function(_0x344a3a){return db['Setting'][_0xee2f('0x8e')]({'attributes':['id',_0xee2f('0x59'),'enforcePasswordHistory',_0xee2f('0x8f')]})[_0xee2f('0xf')](function(_0x392446){if(_0x392446[_0xee2f('0x59')])authService[_0xee2f('0x5a')](_0x609bd9[_0xee2f('0x50')][_0xee2f('0x86')]);if(!_0x392446['enforcePasswordHistory']||!_0x344a3a[_0xee2f('0x90')])return _0x344a3a;authService[_0xee2f('0x91')](_0x609bd9['body'][_0xee2f('0x86')],_0x344a3a[_0xee2f('0x90')],_0x392446[_0xee2f('0x8f')]);return _0x344a3a;})['then'](saveUpdates({'password':_0x609bd9[_0xee2f('0x50')][_0xee2f('0x86')],'passwordResetAt':_0x609bd9[_0xee2f('0x70')]['id']==_0x609bd9[_0xee2f('0x52')]['id']?moment():null,'previousPasswords':authService[_0xee2f('0x92')](_0x609bd9[_0xee2f('0x50')]['newPassword'],_0x344a3a[_0xee2f('0x90')])},null));})[_0xee2f('0xf')](respondWithResult(_0x1954b5,null))[_0xee2f('0x18')](handleError(_0x1954b5,null));};exports['addQueues']=function(_0x50670a,_0xd39c00){var _0x52bb33=_0x50670a[_0xee2f('0x50')][_0xee2f('0x93')];return db['User'][_0xee2f('0x2e')]({'where':{'id':_0x50670a[_0xee2f('0x52')]['id']},'attributes':['id','name','role',_0xee2f('0x94'),_0xee2f('0x95'),'voicePause',_0xee2f('0x96')]})[_0xee2f('0xf')](handleEntityNotFound(_0xd39c00,null))[_0xee2f('0xf')](function(_0xd98eab){if(_0xd98eab){if(!utils['isValidChannel'](_0x52bb33)){throw new db[(_0xee2f('0x87'))][(_0xee2f('0x8c'))](_0xee2f('0x97'));}return _0xd98eab['add'+_[_0xee2f('0x98')](_0x52bb33[_0xee2f('0x99')]())+_0xee2f('0x9a')](_0x50670a[_0xee2f('0x50')]['ids'],{'penalty':_0x50670a['body'][_0xee2f('0x9b')]||0x0})[_0xee2f('0x9c')](function(_0x1fff43){for(var _0x56abfb=0x0;_0x56abfb<_0x50670a[_0xee2f('0x50')][_0xee2f('0x54')]['length'];_0x56abfb+=0x1){var _0x969efe={'UserId':Number(_0x50670a[_0xee2f('0x52')]['id'])};_0x969efe[_[_0xee2f('0x98')](_0x52bb33[_0xee2f('0x99')]())+_0xee2f('0x9d')]=Number(_0x50670a[_0xee2f('0x50')][_0xee2f('0x54')][_0x56abfb]);socket[_0xee2f('0x9e')]('user'+_[_0xee2f('0x98')](_0x52bb33[_0xee2f('0x99')]())+_0xee2f('0x9f'),_0x969efe);}return _0x1fff43;})['then'](function(){if(_0x52bb33===_0xee2f('0xa0')){return db[_0xee2f('0xa1')][_0xee2f('0x3c')]({'where':{'id':_0x50670a[_0xee2f('0x50')][_0xee2f('0x54')]||[]},'raw':!![],'attributes':['id',_0xee2f('0x2f')]});}})[_0xee2f('0xf')](function(_0x3a71fa){var _0x298dfa=_0xd98eab[_0xee2f('0x25')]({'plain':!![]});var _0x2bf351=[];if(_0x52bb33===_0xee2f('0xa0')&&_0x298dfa['role']===_0xee2f('0x29')&&_0x298dfa['online']){for(var _0xc1d07e=0x0;_0xc1d07e<_0x3a71fa[_0xee2f('0x3f')];_0xc1d07e+=0x1){_0x2bf351['push']({'membername':_0x298dfa[_0xee2f('0x2f')],'UserId':_0x298dfa['id'],'queue_name':_0x3a71fa[_0xc1d07e][_0xee2f('0x2f')],'VoiceQueueId':_0x3a71fa[_0xc1d07e]['id'],'interface':_[_0xee2f('0x5c')](_0x298dfa[_0xee2f('0x96')])?util[_0xee2f('0xa2')](_0xee2f('0xa3'),_0x298dfa['name']):_0x298dfa[_0xee2f('0x96')],'paused':_0x298dfa[_0xee2f('0xa4')]||![],'penalty':_0x50670a[_0xee2f('0x50')][_0xee2f('0x9b')]||0x0});}return BPromise[_0xee2f('0x80')](_0x2bf351,function(_0x31b0f7){return db[_0xee2f('0xa5')][_0xee2f('0xa6')](_0x31b0f7);});}return _0xd98eab;});}})[_0xee2f('0xf')](respondWithStatusCode(_0xd39c00,null))[_0xee2f('0x18')](handleError(_0xd39c00,null));};exports['removeQueues']=function(_0x1d4d12,_0x3ab6c7){var _0x37ebf7;return db['User']['find']({'where':{'id':_0x1d4d12[_0xee2f('0x52')]['id']},'attributes':['id',_0xee2f('0x2f'),_0xee2f('0x26')]})[_0xee2f('0xf')](handleEntityNotFound(_0x3ab6c7,null))[_0xee2f('0xf')](function(_0x4a91ca){if(_0x4a91ca){_0x37ebf7=_0x4a91ca;if(!_0x1d4d12[_0xee2f('0x4a')][_0xee2f('0x93')]||!utils['isValidChannel'](_0x1d4d12[_0xee2f('0x4a')][_0xee2f('0x93')])){throw new db[(_0xee2f('0x87'))][(_0xee2f('0x8c'))](_0xee2f('0x97'));}return _0x4a91ca[_0xee2f('0xa7')+_['capitalize'](_0x1d4d12[_0xee2f('0x4a')][_0xee2f('0x93')][_0xee2f('0x99')]())+_0xee2f('0x9a')](_0x1d4d12[_0xee2f('0x4a')][_0xee2f('0x54')]);}})[_0xee2f('0xf')](function(_0x2bd952){if(_[_0xee2f('0xa8')](_0x1d4d12[_0xee2f('0x4a')][_0xee2f('0x54')])){for(var _0x5010eb=0x0;_0x5010eb<_0x1d4d12[_0xee2f('0x4a')][_0xee2f('0x54')][_0xee2f('0x3f')];_0x5010eb+=0x1){var _0x11e4f5={'UserId':Number(_0x1d4d12[_0xee2f('0x52')]['id'])};_0x11e4f5[_[_0xee2f('0x98')](_0x1d4d12['query'][_0xee2f('0x93')][_0xee2f('0x99')]())+_0xee2f('0x9d')]=Number(_0x1d4d12[_0xee2f('0x4a')]['ids'][_0x5010eb]);socket[_0xee2f('0x9e')](_0xee2f('0x70')+_[_0xee2f('0x98')](_0x1d4d12[_0xee2f('0x4a')][_0xee2f('0x93')][_0xee2f('0x99')]())+_0xee2f('0xa9'),_0x11e4f5);}}else{var _0x11e4f5={'UserId':Number(_0x1d4d12['params']['id'])};_0x11e4f5[_['capitalize'](_0x1d4d12[_0xee2f('0x4a')][_0xee2f('0x93')][_0xee2f('0x99')]())+'QueueId']=Number(_0x1d4d12[_0xee2f('0x4a')]['ids']);socket[_0xee2f('0x9e')]('user'+_[_0xee2f('0x98')](_0x1d4d12[_0xee2f('0x4a')]['channel'][_0xee2f('0x99')]())+'Queue:remove',_0x11e4f5);}return _0x2bd952;})[_0xee2f('0xf')](function(){if(_0x1d4d12['query'][_0xee2f('0x93')]===_0xee2f('0xa0')){return db[_0xee2f('0xa5')][_0xee2f('0x24')]({'where':{'UserId':_0x1d4d12[_0xee2f('0x52')]['id'],'VoiceQueueId':_0x1d4d12['query'][_0xee2f('0x54')]},'individualHooks':!![]})[_0xee2f('0xf')](function(){return _0x37ebf7;});}return _0x37ebf7;})[_0xee2f('0xf')](respondWithStatusCode(_0x3ab6c7,null))[_0xee2f('0x18')](handleError(_0x3ab6c7,null));};exports[_0xee2f('0xaa')]=function(_0x73e99a,_0x55f1bd){_0x73e99a[_0xee2f('0x50')][_0xee2f('0xab')]=_0x73e99a[_0xee2f('0xac')]['filename'];return db[_0xee2f('0x33')][_0xee2f('0x2e')]({'where':{'id':_0x73e99a[_0xee2f('0x52')]['id']}})[_0xee2f('0xf')](handleEntityNotFound(_0x55f1bd,null))[_0xee2f('0xf')](saveUpdates(_0x73e99a[_0xee2f('0x50')],null))[_0xee2f('0xf')](respondWithResult(_0x55f1bd,null))[_0xee2f('0x18')](handleError(_0x55f1bd,null));};exports[_0xee2f('0xad')]=function(_0x2dc4ff,_0x351e10){var _0x3f0ef6=path['join'](config[_0xee2f('0xae')],'server/files/images/logos/default_profile.png');return db[_0xee2f('0x33')][_0xee2f('0x2e')]({'where':{'id':_0x2dc4ff['params']['id']},'attributes':['id',_0xee2f('0xab')],'raw':!![]})['then'](handleEntityNotFound(_0x351e10,null))[_0xee2f('0xf')](function(_0x34a358){if(_0x34a358){if(_[_0xee2f('0x5c')](_0x34a358[_0xee2f('0xab')])){return _0x351e10['download'](_0x3f0ef6);}else{if(!fs[_0xee2f('0xaf')](path[_0xee2f('0xb0')](config[_0xee2f('0xae')],_0xee2f('0xb1'),_0x34a358[_0xee2f('0xab')]))){return _0x351e10[_0xee2f('0xb2')](_0x3f0ef6);}return _0x351e10['download'](path[_0xee2f('0xb0')](config['root'],_0xee2f('0xb1'),_0x34a358[_0xee2f('0xab')]));}}})['catch'](handleError(_0x351e10,null));};exports[_0xee2f('0xb3')]=function(_0x44c1a8,_0x4b9d27){return db['User'][_0xee2f('0x2e')]({'where':{'id':_0x44c1a8[_0xee2f('0x52')]['id']},'attributes':['id']})[_0xee2f('0xf')](handleEntityNotFound(_0x4b9d27,null))[_0xee2f('0xf')](function(_0x2f5a60){var _0x33182c=[];values=_0x2f5a60['dataValues'];_0x33182c[_0xee2f('0x3b')](get_open_tabs('chat',_0x2f5a60['dataValues']));_0x33182c['push'](get_open_tabs(_0xee2f('0x43'),_0x2f5a60['dataValues']));_0x33182c[_0xee2f('0x3b')](get_open_tabs(_0xee2f('0x45'),_0x2f5a60['dataValues']));_0x33182c[_0xee2f('0x3b')](get_open_tabs(_0xee2f('0x46'),_0x2f5a60[_0xee2f('0x42')]));_0x33182c[_0xee2f('0x3b')](get_open_tabs(_0xee2f('0x4f'),_0x2f5a60['dataValues']));_0x33182c[_0xee2f('0x3b')](get_open_tabs(_0xee2f('0x44'),_0x2f5a60[_0xee2f('0x42')]));return BPromise[_0xee2f('0x7f')](_0x33182c);})[_0xee2f('0xf')](function(_0x1cbce0){var _0x6e5a1d=[];if(_0x1cbce0){for(var _0xf2d880=0x0;_0xf2d880=_0x3a3e4f){_0x4683c7=_0x3a3e4f;_0x17c103=0xc8;}else{_0x17c103=0xce;}_0x337602[_0xa66f('0x1c')](_0x17c103);return _0x337602[_0xa66f('0x20')](_0xa66f('0x21'),_0x384164+'-'+_0x4683c7+'/'+_0x3a3e4f)[_0xa66f('0x22')](_0x209f4d);}return null;};}function saveUpdates(_0x117d03){return function(_0x45f71c){if(_0x45f71c){return _0x45f71c[_0xa66f('0x23')](_0x117d03)[_0xa66f('0x11')](function(_0xeeb22e){return _0xeeb22e;});}return null;};}function removeEntity(_0x49f615){return function(_0x4c0695){if(_0x4c0695){return _0x4c0695[_0xa66f('0x24')]()[_0xa66f('0x11')](function(){var _0x55f309=_0x4c0695[_0xa66f('0x25')]({'plain':!![]});if(_0x55f309[_0xa66f('0x26')]==='admin')return;var _0x332e86=[{'name':_0xa66f('0x27'),'value':_0xa66f('0x28'),'ignore':!![]},{'name':_0xa66f('0x29'),'value':_0xa66f('0x2a'),'ignore':![]},{'name':'Telephones','value':_0xa66f('0x2b'),'ignore':![]}];var _0x4fcdc1=_(_0x332e86)[_0xa66f('0x2c')](_0xa66f('0x2d'))[_0xa66f('0x2e')]('value')[_0xa66f('0x2f')]();if(_[_0xa66f('0x30')](_0x4fcdc1,_0x55f309['role'])){return;}var _0x1a5d4a=_[_0xa66f('0x31')](_0x332e86,[_0xa66f('0x2f'),_0x55f309[_0xa66f('0x26')]])[_0xa66f('0x32')];return db[_0xa66f('0x33')][_0xa66f('0x24')]({'where':{'type':_0x1a5d4a,'resourceId':_0x55f309['id']}})[_0xa66f('0x11')](function(){return _0x4c0695;});})[_0xa66f('0x11')](function(){_0x49f615[_0xa66f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17984d){return function(_0x5bf736){if(!_0x5bf736){_0x17984d[_0xa66f('0x1b')](0x194);}return _0x5bf736;};}function handleError(_0x46f6cc,_0x9c7756){_0x9c7756=_0x9c7756||0x1f4;return function(_0x3b9261){logger[_0xa66f('0x14')](_0x3b9261[_0xa66f('0x34')]);if(_0x3b9261[_0xa66f('0x32')]){delete _0x3b9261[_0xa66f('0x32')];}_0x46f6cc['status'](_0x9c7756)[_0xa66f('0x35')](_0x3b9261);};}exports['index']=function(_0x4477cf,_0x45eeb8){var _0x2ed1fb={},_0x47b21a={'count':0x0,'rows':[]};var _0x4d60f9=_(db[_0xa66f('0x36')][_0xa66f('0x37')])[_0xa66f('0x2e')](function(_0x1f5a5f){return{'name':_0x1f5a5f[_0xa66f('0x38')],'type':_0x1f5a5f['type']['key']};})['filter'](function(_0x30f7de){return!_['includes'](['password','salt'],_0x30f7de[_0xa66f('0x32')]);})['value']();_0x2ed1fb=qs[_0xa66f('0x39')](_0x4d60f9,_0x4477cf);var _0x17d942={'where':_0x2ed1fb[_0xa66f('0x3a')]};return db[_0xa66f('0x36')][_0xa66f('0x1e')](_0x17d942)[_0xa66f('0x11')](function(_0x192033){_0x47b21a[_0xa66f('0x1e')]=_0x192033;if(_0x4477cf[_0xa66f('0x3b')][_0xa66f('0x3c')]){_0x2ed1fb[_0xa66f('0x3d')]=[{'all':!![]}];}if(!_[_0xa66f('0x30')](_0x2ed1fb[_0xa66f('0x3e')],'id')){_0x2ed1fb[_0xa66f('0x3e')]['push']('id');}return db[_0xa66f('0x36')][_0xa66f('0x3f')](_0x2ed1fb);})['then'](function(_0x248587){_0x47b21a['rows']=_0x248587;if(_0x4477cf[_0xa66f('0x3b')][_0xa66f('0x40')]==='true'){var _0x1ddd2f=[];for(var _0xa42041=0x0;_0xa42041<_0x47b21a[_0xa66f('0x41')]['length'];_0xa42041++){_0x1ddd2f[_0xa66f('0x42')](get_open_tabs('chat',_0x47b21a[_0xa66f('0x41')][_0xa42041][_0xa66f('0x43')]));_0x1ddd2f[_0xa66f('0x42')](get_open_tabs(_0xa66f('0x44'),_0x47b21a[_0xa66f('0x41')][_0xa42041][_0xa66f('0x43')]));_0x1ddd2f[_0xa66f('0x42')](get_open_tabs('fax',_0x47b21a[_0xa66f('0x41')][_0xa42041][_0xa66f('0x43')]));_0x1ddd2f[_0xa66f('0x42')](get_open_tabs(_0xa66f('0x45'),_0x47b21a[_0xa66f('0x41')][_0xa42041]['dataValues']));_0x1ddd2f['push'](get_open_tabs(_0xa66f('0x46'),_0x47b21a[_0xa66f('0x41')][_0xa42041][_0xa66f('0x43')]));_0x1ddd2f[_0xa66f('0x42')](get_open_tabs(_0xa66f('0x47'),_0x47b21a[_0xa66f('0x41')][_0xa42041]['dataValues']));}return BPromise[_0xa66f('0x48')](_0x1ddd2f)[_0xa66f('0x11')](function(_0x3f9cdd){return _0x47b21a;});}else{return _0x47b21a;}})['then'](respondWithFilteredResult(_0x45eeb8,_0x2ed1fb))['catch'](handleError(_0x45eeb8,null));};exports[_0xa66f('0x49')]=function(_0x113998,_0x227e24){var _0x5d6665={'raw':![],'where':{'id':_0x113998['params']['id']}},_0x52990f={};_0x52990f[_0xa66f('0x4a')]=_[_0xa66f('0x4b')](_[_0xa66f('0x4c')](db[_0xa66f('0x36')][_0xa66f('0x37')]),[_0xa66f('0x4d'),_0xa66f('0x4e')]);_0x52990f[_0xa66f('0x3b')]=_['keys'](_0x113998[_0xa66f('0x3b')]);_0x52990f[_0xa66f('0x4f')]=_[_0xa66f('0x50')](_0x52990f[_0xa66f('0x4a')],_0x52990f[_0xa66f('0x3b')]);_0x5d6665[_0xa66f('0x3e')]=_['intersection'](_0x52990f[_0xa66f('0x4a')],qs[_0xa66f('0x51')](_0x113998[_0xa66f('0x3b')][_0xa66f('0x51')]));_0x5d6665[_0xa66f('0x3e')]=_0x5d6665['attributes'][_0xa66f('0x52')]?_0x5d6665['attributes']:_0x52990f[_0xa66f('0x4a')];if(_0x113998['query']['includeAll']){_0x5d6665[_0xa66f('0x3d')]=[{'all':!![]}];}_0x5d6665=_[_0xa66f('0x53')]({},_0x5d6665,_0x113998[_0xa66f('0x54')]);if(!_[_0xa66f('0x30')](_0x5d6665[_0xa66f('0x3e')],'id')){_0x5d6665[_0xa66f('0x3e')]['push']('id');}return db[_0xa66f('0x36')][_0xa66f('0x31')](_0x5d6665)[_0xa66f('0x11')](handleEntityNotFound(_0x227e24,null))[_0xa66f('0x11')](function(_0x52550c){var _0x1a81c4=[];values=_0x52550c;if(_0x113998['query'][_0xa66f('0x40')]===_0xa66f('0x55')){_0x1a81c4[_0xa66f('0x42')](get_open_tabs(_0xa66f('0x56'),_0x52550c[_0xa66f('0x43')]));_0x1a81c4[_0xa66f('0x42')](get_open_tabs(_0xa66f('0x44'),_0x52550c['dataValues']));_0x1a81c4[_0xa66f('0x42')](get_open_tabs(_0xa66f('0x46'),_0x52550c[_0xa66f('0x43')]));_0x1a81c4[_0xa66f('0x42')](get_open_tabs(_0xa66f('0x47'),_0x52550c[_0xa66f('0x43')]));_0x1a81c4[_0xa66f('0x42')](get_open_tabs(_0xa66f('0x57'),_0x52550c[_0xa66f('0x43')]));_0x1a81c4['push'](get_open_tabs('mail',_0x52550c[_0xa66f('0x43')]));return BPromise[_0xa66f('0x48')](_0x1a81c4);}else{return values;}})[_0xa66f('0x11')](function(_0xf5cdf8){return values;})[_0xa66f('0x11')](respondWithResult(_0x227e24,null))[_0xa66f('0x1a')](handleError(_0x227e24,null));};exports[_0xa66f('0x23')]=function(_0x4b10cf,_0x1709eb){if(_0x4b10cf[_0xa66f('0x58')]['id']){delete _0x4b10cf[_0xa66f('0x58')]['id'];}delete _0x4b10cf[_0xa66f('0x58')]['role'];return db[_0xa66f('0x36')][_0xa66f('0x31')]({'where':{'id':_0x4b10cf[_0xa66f('0x59')]['id']}})[_0xa66f('0x11')](handleEntityNotFound(_0x1709eb,null))[_0xa66f('0x11')](saveUpdates(_0x4b10cf[_0xa66f('0x58')],null))['then'](respondWithResult(_0x1709eb,null))['catch'](handleError(_0x1709eb,null));};exports[_0xa66f('0x5a')]=function(_0x31b81b,_0x174aad){return db['User'][_0xa66f('0x5a')]()[_0xa66f('0x11')](respondWithResult(_0x174aad,null))[_0xa66f('0x1a')](handleError(_0x174aad,null));};exports[_0xa66f('0x5b')]=function(_0x17b2cf,_0x465758){return db[_0xa66f('0x36')][_0xa66f('0x31')]({'where':{'id':_0x17b2cf[_0xa66f('0x59')]['id']}})['then'](handleEntityNotFound(_0x465758,null))[_0xa66f('0x11')](function(_0x2d751e){if(_0x2d751e){return _0x2d751e[_0xa66f('0x5b')](_0x17b2cf[_0xa66f('0x58')][_0xa66f('0x5c')],_[_0xa66f('0x5d')](_0x17b2cf[_0xa66f('0x58')],[_0xa66f('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x465758,null))['catch'](handleError(_0x465758,null));};function validateUser(_0x46327d){return new BPromise(function(_0x196283,_0x2540ad){if(_0x46327d[_0xa66f('0x5e')])return _0x196283(_0x46327d);return db[_0xa66f('0x5f')]['findById'](0x1)[_0xa66f('0x11')](function(_0x4c2b68){if(_0x4c2b68[_0xa66f('0x60')])authService[_0xa66f('0x61')](_0x46327d[_0xa66f('0x4d')]);db[_0xa66f('0x36')]['max'](_0xa66f('0x5e'))[_0xa66f('0x11')](function(_0x31c11b){if(_[_0xa66f('0x62')](_0x31c11b)){_0x46327d[_0xa66f('0x5e')]=_0x4c2b68[_0xa66f('0x63')]||0x1;return;}if(_[_0xa66f('0x62')](_0x4c2b68[_0xa66f('0x63')])||_0x4c2b68[_0xa66f('0x63')]===_0x31c11b){_0x46327d[_0xa66f('0x5e')]=_0x31c11b+0x1;return;}if(_0x4c2b68[_0xa66f('0x63')]>_0x31c11b){_0x46327d[_0xa66f('0x5e')]=_0x4c2b68['min_internal'];return;}return db[_0xa66f('0x64')][_0xa66f('0x3b')](_0xa66f('0x65'),{'type':db[_0xa66f('0x64')][_0xa66f('0x66')][_0xa66f('0x67')]})[_0xa66f('0x11')](function(_0x68bd43){if(_0x68bd43&&_0x68bd43['length']){for(var _0x5173f0=0x0,_0xad9105=_0x68bd43[_0xa66f('0x52')];_0x5173f0<_0xad9105&&_[_0xa66f('0x62')](_0x46327d[_0xa66f('0x5e')]);_0x5173f0++){if(_0x4c2b68[_0xa66f('0x63')]<=_0x68bd43[_0x5173f0][_0xa66f('0x68')]){_0x46327d[_0xa66f('0x5e')]=_0x68bd43[_0x5173f0]['from'];}else if(_0x4c2b68['min_internal']>_0x68bd43[_0x5173f0][_0xa66f('0x68')]&&_0x4c2b68[_0xa66f('0x63')]<=_0x68bd43[_0x5173f0]['to']){_0x46327d[_0xa66f('0x5e')]=_0x4c2b68['min_internal'];}}}if(_['isNil'](_0x46327d[_0xa66f('0x5e')])){_0x46327d[_0xa66f('0x5e')]=_0x31c11b+0x1;}return _0x196283(_0x46327d);});});})[_0xa66f('0x1a')](function(_0x340dba){_0x2540ad(_0x340dba);});});}function updateUser(_0x5acb4e){return new BPromise(function(_0x43be19,_0x927c16){try{if(_0x5acb4e[_0xa66f('0x69')]){_0x5acb4e[_0xa66f('0x6a')]=_0x5acb4e[_0xa66f('0x5e')];_0x5acb4e[_0xa66f('0x6b')]={'mailbox':_0x5acb4e[_0xa66f('0x5e')],'password':_0x5acb4e[_0xa66f('0x4d')],'fullname':_0x5acb4e['fullname'],'email':_0x5acb4e[_0xa66f('0x6c')]};}if(_0x5acb4e[_0xa66f('0x26')]==='agent'){if(!_0x5acb4e['permissions'])_0x5acb4e[_0xa66f('0x6d')]=[_0xa66f('0x6e'),'102',_0xa66f('0x6f'),'113',_0xa66f('0x70'),'104','105','106',_0xa66f('0x71'),_0xa66f('0x72'),_0xa66f('0x73'),_0xa66f('0x74'),_0xa66f('0x75'),_0xa66f('0x76'),_0xa66f('0x77')];}_0x43be19(_0x5acb4e);}catch(_0x33062d){_0x927c16(_0x33062d);}});}exports[_0xa66f('0x78')]=function(_0x17f924,_0x121a3b){if(_0x17f924[_0xa66f('0x28')][_0xa66f('0x26')]===_0xa66f('0x2a'))throw new Error(_0xa66f('0x79'));if(_0x17f924[_0xa66f('0x58')]['role']===_0xa66f('0x28')&&_0x17f924['user'][_0xa66f('0x26')]!=='admin'){throw new Error(_0xa66f('0x7a'));}if(_0x17f924[_0xa66f('0x58')][_0xa66f('0x26')]==='admin'&&_0x17f924['user'][_0xa66f('0x26')]!==_0xa66f('0x7b')){throw new Error(_0xa66f('0x7c'));}return licenseUtil[_0xa66f('0x7d')]([_0x17f924[_0xa66f('0x58')]])[_0xa66f('0x11')](function(){return validateUser(_0x17f924[_0xa66f('0x58')]);})['then'](function(_0x4013b9){return updateUser(_0x4013b9)[_0xa66f('0x11')](function(_0x2023ea){if(_0x2023ea[_0xa66f('0x26')]===_0xa66f('0x7b')){_0x2023ea[_0xa66f('0x7e')]=_0x17f924[_0xa66f('0x28')][_0xa66f('0x7e')];delete _0x2023ea[_0xa66f('0x7f')];}return _0x2023ea;});})[_0xa66f('0x11')](function(_0x20d52a){return db[_0xa66f('0x36')][_0xa66f('0x78')](_0x20d52a,{'include':[{'model':db['VoiceMail'],'as':_0xa66f('0x6b')}]});})[_0xa66f('0x11')](function(_0x34ebfd){if(_0x17f924[_0xa66f('0x58')][_0xa66f('0x26')]===_0xa66f('0x28'))return _0x34ebfd;if(_0x17f924[_0xa66f('0x28')][_0xa66f('0x26')]!==_0xa66f('0x28'))return _0x34ebfd;return db['UserProfileSection'][_0xa66f('0x31')]({'where':{'name':_0x34ebfd['role']===_0xa66f('0x2a')?'Agents':_0xa66f('0x80'),'userProfileId':_0x17f924['user'][_0xa66f('0x7f')]},'raw':!![]})['then'](function(_0x272e4c){if(!_0x272e4c||_0x272e4c[_0xa66f('0x81')]!=0x0)return _0x34ebfd;return db[_0xa66f('0x33')][_0xa66f('0x78')]({'name':_0x34ebfd[_0xa66f('0x32')],'resourceId':_0x34ebfd['id'],'type':_0x272e4c[_0xa66f('0x32')],'sectionId':_0x272e4c['id']},{})['then'](function(){return _0x34ebfd;});})[_0xa66f('0x1a')](function(_0x2e0059){logger[_0xa66f('0x14')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e0059);throw _0x2e0059;});})[_0xa66f('0x11')](respondWithResult(_0x121a3b,0xc9))[_0xa66f('0x1a')](handleError(_0x121a3b,null));};exports['bulkCreate']=function(_0x1e8510,_0x473ebd){var _0x5ee6d5=_0x1e8510['body'];var _0x125bf4=[];if(_0x1e8510[_0xa66f('0x28')][_0xa66f('0x26')]===_0xa66f('0x2a'))throw new Error(_0xa66f('0x79'));if(_['some'](_0x5ee6d5,[_0xa66f('0x26'),_0xa66f('0x28')])&&_0x1e8510['user'][_0xa66f('0x26')]!==_0xa66f('0x7b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xa66f('0x82')](_0x5ee6d5,[_0xa66f('0x26'),_0xa66f('0x7b')])&&_0x1e8510[_0xa66f('0x28')][_0xa66f('0x26')]!=='admin'){throw new Error(_0xa66f('0x83'));}return licenseUtil[_0xa66f('0x7d')](_0x5ee6d5)[_0xa66f('0x11')](function(){return validateUser(_0x5ee6d5[0x0]);})[_0xa66f('0x11')](function(){for(var _0x40fb75=0x1;_0x40fb75<_0x5ee6d5[_0xa66f('0x52')];_0x40fb75++){var _0x4e318d=_0x5ee6d5[_0x40fb75-0x1][_0xa66f('0x5e')];if(!_0x5ee6d5[_0x40fb75][_0xa66f('0x5e')])_0x5ee6d5[_0x40fb75][_0xa66f('0x5e')]=_0x4e318d+0x1;_0x125bf4[_0xa66f('0x42')](validateUser(_0x5ee6d5[_0x40fb75]));}return BPromise[_0xa66f('0x48')](_0x125bf4);})[_0xa66f('0x11')](function(){_0x125bf4=[];for(var _0x16261a=0x0;_0x16261a<_0x5ee6d5['length'];_0x16261a++){_0x125bf4['push'](updateUser(_0x5ee6d5[_0x16261a]));}return BPromise[_0xa66f('0x48')](_0x125bf4);})['then'](function(){return BPromise[_0xa66f('0x84')](_0x5ee6d5,function(_0x148a8d){return db['User'][_0xa66f('0x78')](_0x148a8d,{'include':[{'model':db[_0xa66f('0x6b')],'as':_0xa66f('0x6b')}]})['then'](function(_0x4a2409){_0x148a8d['id']=_0x4a2409['id'];return _0x148a8d;});});})[_0xa66f('0x11')](function(_0x51b59b){if(_0x1e8510[_0xa66f('0x58')][_0xa66f('0x26')]===_0xa66f('0x28'))return _0x51b59b;if(_0x1e8510['user'][_0xa66f('0x26')]!=='user')return _0x51b59b;var _0x3dd1a3=_[_0xa66f('0x82')](_0x51b59b,function(_0x466b90){return _0x466b90[_0xa66f('0x26')]==='agent'||_0x466b90[_0xa66f('0x26')]===_0xa66f('0x2b');});if(!_0x3dd1a3)return _0x51b59b;return db[_0xa66f('0x85')][_0xa66f('0x3f')]({'where':{'name':{'$or':[_0xa66f('0x29'),_0xa66f('0x80')]},'userProfileId':_0x1e8510['user'][_0xa66f('0x7f')]},'raw':!![]})[_0xa66f('0x11')](function(_0xef3e9d){if(_[_0xa66f('0x86')](_0xef3e9d)||!_[_0xa66f('0x82')](_0xef3e9d,['autoAssociation',0x0]))return _0x51b59b;_0x125bf4=[];var _0x520dbb=_(_0xef3e9d)[_0xa66f('0x2e')](function(_0x30468d){if(_0x30468d[_0xa66f('0x81')]===0x1)return;return _0x30468d[_0xa66f('0x32')]===_0xa66f('0x29')?_0xa66f('0x2a'):_0xa66f('0x2b');})[_0xa66f('0x87')]()[_0xa66f('0x2f')]();for(var _0x1704e3=0x0;_0x1704e3<_0x51b59b[_0xa66f('0x52')];_0x1704e3++){if(!_[_0xa66f('0x30')](_0x520dbb,_0x51b59b[_0x1704e3]['role']))return;var _0x3d2385=_0x51b59b[_0x1704e3][_0xa66f('0x26')]==='agent'?_0xa66f('0x29'):_0xa66f('0x80');_0x125bf4[_0xa66f('0x42')](db['UserProfileResource']['create']({'name':_0x51b59b[_0x1704e3][_0xa66f('0x32')],'resourceId':_0x51b59b[_0x1704e3]['id'],'type':_0x3d2385,'sectionId':_['find'](_0xef3e9d,[_0xa66f('0x32'),_0x3d2385])['id']},{}));}return BPromise[_0xa66f('0x48')](_0x125bf4);});})['then'](respondWithResult(_0x473ebd,0xc9))[_0xa66f('0x1a')](handleError(_0x473ebd,null));};exports[_0xa66f('0x88')]=function(_0x57912d,_0xa568ed){if(_0x57912d[_0xa66f('0x58')]['id']){delete _0x57912d[_0xa66f('0x58')]['id'];}return db[_0xa66f('0x36')]['find']({'where':{'id':_0x57912d['params']['id']}})[_0xa66f('0x11')](function(_0xdd2d09){if(!_0xdd2d09)return null;if(_0xdd2d09['id']===_0x57912d[_0xa66f('0x28')]['id']){if(!_0x57912d[_0xa66f('0x58')][_0xa66f('0x89')]||!_0x57912d[_0xa66f('0x58')][_0xa66f('0x8a')]){throw new db[(_0xa66f('0x8b'))][(_0xa66f('0x8c'))](_0xa66f('0x8d'));}if(!_0xdd2d09['authenticate'](_0x57912d['body'][_0xa66f('0x89')])){throw new db[(_0xa66f('0x8b'))][(_0xa66f('0x8c'))](_0xa66f('0x8e'));}if(_0x57912d[_0xa66f('0x58')]['oldPassword']===_0x57912d[_0xa66f('0x58')][_0xa66f('0x8a')]){throw new db[(_0xa66f('0x8b'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x57912d['user'][_0xa66f('0x26')]==='admin'){if(!_0x57912d[_0xa66f('0x58')][_0xa66f('0x8a')]){throw new db[(_0xa66f('0x8b'))][(_0xa66f('0x8c'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x57912d[_0xa66f('0x28')][_0xa66f('0x26')]==='user'){if(!_0x57912d[_0xa66f('0x58')][_0xa66f('0x8a')]){throw new db['Sequelize']['ValidationError'](_0xa66f('0x8f'));}if(_0xdd2d09[_0xa66f('0x26')]!==_0xa66f('0x2a')){throw new db['Sequelize']['ValidationError']('Unauthorized');}}else{throw new db['Sequelize'][(_0xa66f('0x8c'))](_0xa66f('0x79'));}return _0xdd2d09;})[_0xa66f('0x11')](handleEntityNotFound(_0xa568ed,null))[_0xa66f('0x11')](function(_0x526be7){return db[_0xa66f('0x5f')]['findOne']({'attributes':['id',_0xa66f('0x60'),_0xa66f('0x90'),_0xa66f('0x91')]})[_0xa66f('0x11')](function(_0x563982){if(_0x563982['securePassword'])authService[_0xa66f('0x61')](_0x57912d[_0xa66f('0x58')][_0xa66f('0x8a')]);if(!_0x563982[_0xa66f('0x90')]||!_0x526be7[_0xa66f('0x92')])return _0x526be7;authService[_0xa66f('0x93')](_0x57912d[_0xa66f('0x58')][_0xa66f('0x8a')],_0x526be7[_0xa66f('0x92')],_0x563982[_0xa66f('0x91')]);return _0x526be7;})[_0xa66f('0x11')](saveUpdates({'password':_0x57912d['body'][_0xa66f('0x8a')],'passwordResetAt':_0x57912d['user']['id']==_0x57912d[_0xa66f('0x59')]['id']?moment():null,'previousPasswords':authService[_0xa66f('0x94')](_0x57912d[_0xa66f('0x58')][_0xa66f('0x8a')],_0x526be7[_0xa66f('0x92')])},null));})['then'](respondWithResult(_0xa568ed,null))['catch'](handleError(_0xa568ed,null));};exports['addQueues']=function(_0x484c8e,_0x728faa){var _0x4760b3=_0x484c8e[_0xa66f('0x58')][_0xa66f('0x95')];return db['User'][_0xa66f('0x31')]({'where':{'id':_0x484c8e[_0xa66f('0x59')]['id']},'attributes':['id','name',_0xa66f('0x26'),_0xa66f('0x96'),'loginInPause',_0xa66f('0x97'),_0xa66f('0x98')]})['then'](handleEntityNotFound(_0x728faa,null))[_0xa66f('0x11')](function(_0x400223){if(_0x400223){if(!utils[_0xa66f('0x99')](_0x4760b3)){throw new db[(_0xa66f('0x8b'))][(_0xa66f('0x8c'))](_0xa66f('0x9a'));}return _0x400223[_0xa66f('0x9b')+_[_0xa66f('0x9c')](_0x4760b3[_0xa66f('0x9d')]())+_0xa66f('0x9e')](_0x484c8e[_0xa66f('0x58')]['ids'],{'penalty':_0x484c8e['body'][_0xa66f('0x9f')]||0x0})[_0xa66f('0xa0')](function(_0x12278e){for(var _0x4e211b=0x0;_0x4e211b<_0x484c8e['body'][_0xa66f('0x5c')][_0xa66f('0x52')];_0x4e211b+=0x1){var _0x9617dc={'UserId':Number(_0x484c8e[_0xa66f('0x59')]['id'])};_0x9617dc[_[_0xa66f('0x9c')](_0x4760b3['toLowerCase']())+_0xa66f('0xa1')]=Number(_0x484c8e[_0xa66f('0x58')][_0xa66f('0x5c')][_0x4e211b]);socket[_0xa66f('0xa2')]('user'+_[_0xa66f('0x9c')](_0x4760b3[_0xa66f('0x9d')]())+'Queue:save',_0x9617dc);}return _0x12278e;})[_0xa66f('0x11')](function(){if(_0x4760b3===_0xa66f('0xa3')){return db['VoiceQueue'][_0xa66f('0x3f')]({'where':{'id':_0x484c8e[_0xa66f('0x58')][_0xa66f('0x5c')]||[]},'raw':!![],'attributes':['id',_0xa66f('0x32')]});}})[_0xa66f('0x11')](function(_0x3c73cc){var _0x2aca23=_0x400223['get']({'plain':!![]});var _0x5d74ef=[];if(_0x4760b3===_0xa66f('0xa3')&&_0x2aca23[_0xa66f('0x26')]===_0xa66f('0x2a')&&_0x2aca23[_0xa66f('0x96')]){for(var _0x11379e=0x0;_0x11379e<_0x3c73cc['length'];_0x11379e+=0x1){_0x5d74ef[_0xa66f('0x42')]({'membername':_0x2aca23[_0xa66f('0x32')],'UserId':_0x2aca23['id'],'queue_name':_0x3c73cc[_0x11379e]['name'],'VoiceQueueId':_0x3c73cc[_0x11379e]['id'],'interface':_[_0xa66f('0x62')](_0x2aca23['interface'])?util[_0xa66f('0xa4')](_0xa66f('0xa5'),_0x2aca23[_0xa66f('0x32')]):_0x2aca23[_0xa66f('0x98')],'paused':_0x2aca23['voicePause']||![],'penalty':_0x484c8e['body']['penalty']||0x0});}return BPromise[_0xa66f('0x84')](_0x5d74ef,function(_0x579a32){return db[_0xa66f('0xa6')]['upsert'](_0x579a32);});}return _0x400223;});}})[_0xa66f('0x11')](respondWithStatusCode(_0x728faa,null))[_0xa66f('0x1a')](handleError(_0x728faa,null));};exports['removeQueues']=function(_0x35a2ce,_0x2d3bca){var _0x3dc86c;return db[_0xa66f('0x36')][_0xa66f('0x31')]({'where':{'id':_0x35a2ce[_0xa66f('0x59')]['id']},'attributes':['id',_0xa66f('0x32'),'role']})[_0xa66f('0x11')](handleEntityNotFound(_0x2d3bca,null))[_0xa66f('0x11')](function(_0x59530c){if(_0x59530c){_0x3dc86c=_0x59530c;if(!_0x35a2ce[_0xa66f('0x3b')][_0xa66f('0x95')]||!utils[_0xa66f('0x99')](_0x35a2ce[_0xa66f('0x3b')][_0xa66f('0x95')])){throw new db[(_0xa66f('0x8b'))]['ValidationError'](_0xa66f('0x9a'));}return _0x59530c['remove'+_[_0xa66f('0x9c')](_0x35a2ce[_0xa66f('0x3b')][_0xa66f('0x95')][_0xa66f('0x9d')]())+_0xa66f('0x9e')](_0x35a2ce['query'][_0xa66f('0x5c')]);}})[_0xa66f('0x11')](function(_0x3889dd){if(_[_0xa66f('0xa7')](_0x35a2ce['query']['ids'])){for(var _0x4e9e39=0x0;_0x4e9e39<_0x35a2ce[_0xa66f('0x3b')][_0xa66f('0x5c')]['length'];_0x4e9e39+=0x1){var _0x434764={'UserId':Number(_0x35a2ce[_0xa66f('0x59')]['id'])};_0x434764[_[_0xa66f('0x9c')](_0x35a2ce['query'][_0xa66f('0x95')][_0xa66f('0x9d')]())+_0xa66f('0xa1')]=Number(_0x35a2ce[_0xa66f('0x3b')]['ids'][_0x4e9e39]);socket['emit']('user'+_[_0xa66f('0x9c')](_0x35a2ce[_0xa66f('0x3b')][_0xa66f('0x95')][_0xa66f('0x9d')]())+_0xa66f('0xa8'),_0x434764);}}else{var _0x434764={'UserId':Number(_0x35a2ce[_0xa66f('0x59')]['id'])};_0x434764[_[_0xa66f('0x9c')](_0x35a2ce['query'][_0xa66f('0x95')][_0xa66f('0x9d')]())+_0xa66f('0xa1')]=Number(_0x35a2ce['query'][_0xa66f('0x5c')]);socket[_0xa66f('0xa2')](_0xa66f('0x28')+_['capitalize'](_0x35a2ce['query'][_0xa66f('0x95')][_0xa66f('0x9d')]())+_0xa66f('0xa8'),_0x434764);}return _0x3889dd;})[_0xa66f('0x11')](function(){if(_0x35a2ce[_0xa66f('0x3b')][_0xa66f('0x95')]===_0xa66f('0xa3')){return db['UserVoiceQueueRt'][_0xa66f('0x24')]({'where':{'UserId':_0x35a2ce['params']['id'],'VoiceQueueId':_0x35a2ce[_0xa66f('0x3b')][_0xa66f('0x5c')]},'individualHooks':!![]})[_0xa66f('0x11')](function(){return _0x3dc86c;});}return _0x3dc86c;})[_0xa66f('0x11')](respondWithStatusCode(_0x2d3bca,null))[_0xa66f('0x1a')](handleError(_0x2d3bca,null));};exports[_0xa66f('0xa9')]=function(_0x241a75,_0x19b1f5){_0x241a75[_0xa66f('0x58')][_0xa66f('0xaa')]=_0x241a75[_0xa66f('0xab')][_0xa66f('0xac')];return db['User']['find']({'where':{'id':_0x241a75[_0xa66f('0x59')]['id']}})[_0xa66f('0x11')](handleEntityNotFound(_0x19b1f5,null))[_0xa66f('0x11')](saveUpdates(_0x241a75[_0xa66f('0x58')],null))[_0xa66f('0x11')](respondWithResult(_0x19b1f5,null))[_0xa66f('0x1a')](handleError(_0x19b1f5,null));};exports['getAvatar']=function(_0x1b5f18,_0x5b23b6){var _0x48c066=path[_0xa66f('0xad')](config[_0xa66f('0xae')],_0xa66f('0xaf'));return db[_0xa66f('0x36')]['find']({'where':{'id':_0x1b5f18[_0xa66f('0x59')]['id']},'attributes':['id',_0xa66f('0xaa')],'raw':!![]})[_0xa66f('0x11')](handleEntityNotFound(_0x5b23b6,null))[_0xa66f('0x11')](function(_0x2a03c8){if(_0x2a03c8){if(_['isNil'](_0x2a03c8['userpic'])){return _0x5b23b6[_0xa66f('0xb0')](_0x48c066);}else{if(!fs[_0xa66f('0xb1')](path[_0xa66f('0xad')](config[_0xa66f('0xae')],'server/files/images/',_0x2a03c8[_0xa66f('0xaa')]))){return _0x5b23b6[_0xa66f('0xb0')](_0x48c066);}return _0x5b23b6[_0xa66f('0xb0')](path[_0xa66f('0xad')](config[_0xa66f('0xae')],_0xa66f('0xb2'),_0x2a03c8[_0xa66f('0xaa')]));}}})[_0xa66f('0x1a')](handleError(_0x5b23b6,null));};exports['getOpenTabs']=function(_0x1d67f1,_0x18165d){return db['User'][_0xa66f('0x31')]({'where':{'id':_0x1d67f1[_0xa66f('0x59')]['id']},'attributes':['id']})[_0xa66f('0x11')](handleEntityNotFound(_0x18165d,null))[_0xa66f('0x11')](function(_0x3d0423){var _0x56b3bd=[];values=_0x3d0423[_0xa66f('0x43')];_0x56b3bd[_0xa66f('0x42')](get_open_tabs(_0xa66f('0x56'),_0x3d0423[_0xa66f('0x43')]));_0x56b3bd[_0xa66f('0x42')](get_open_tabs('sms',_0x3d0423[_0xa66f('0x43')]));_0x56b3bd[_0xa66f('0x42')](get_open_tabs('openchannel',_0x3d0423[_0xa66f('0x43')]));_0x56b3bd[_0xa66f('0x42')](get_open_tabs(_0xa66f('0x47'),_0x3d0423[_0xa66f('0x43')]));_0x56b3bd[_0xa66f('0x42')](get_open_tabs('fax',_0x3d0423[_0xa66f('0x43')]));_0x56b3bd[_0xa66f('0x42')](get_open_tabs(_0xa66f('0x45'),_0x3d0423[_0xa66f('0x43')]));return BPromise['all'](_0x56b3bd);})[_0xa66f('0x11')](function(_0x344df0){var _0x48ce2f=[];if(_0x344df0){for(var _0x2105b8=0x0;_0x2105b8=_0x497a2d[_0xb6e3('0x51')]){throw new Error(_0xb6e3('0x52'));}})['then'](function(){if(_0xd8ad8a){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0xd8ad8a[_0xb6e3('0x2c')]},'individualHooks':!![]});}})[_0xb6e3('0x14')](function(){if(_0xd8ad8a){return _0xd8ad8a[_0xb6e3('0x53')]({'raw':!![]});}})['then'](function(_0x7f15bb){if(_0xd8ad8a){if(_0x7f15bb){var _0x422db5=[];_0x14a563=_0x7f15bb;if(_0x14a563[_0xb6e3('0x32')]){for(var _0x5d3983=0x0;_0x5d3983<_0x14a563[_0xb6e3('0x32')];_0x5d3983++){_0x422db5[_0xb6e3('0x4c')](db[_0xb6e3('0x3f')][_0xb6e3('0x54')]({'membername':_0xd8ad8a[_0xb6e3('0x2c')],'UserId':_0xd8ad8a['id'],'queue_name':_0x14a563[_0x5d3983][_0xb6e3('0x2c')],'VoiceQueueId':_0x14a563[_0x5d3983]['id'],'interface':_0x351674,'paused':_0xd8ad8a[_0xb6e3('0x4d')]||![],'penalty':_0x14a563[_0x5d3983][_0xb6e3('0x55')]||0x0}));}return BPromise['all'](_0x422db5);}}}})[_0xb6e3('0x14')](function(){if(_0xd8ad8a){return db['MemberReport'][_0xb6e3('0x21')]({'where':{'membername':_0xd8ad8a[_0xb6e3('0x2c')],'exitAt':null}});}})[_0xb6e3('0x14')](function(_0xa04b3){if(_0xd8ad8a){if(_0xa04b3&&_0xa04b3['length']){var _0x3e7f58=[];_0xa04b3[_0xb6e3('0x49')](function(_0x1c859d){_0x3e7f58['push'](_0x1c859d[_0xb6e3('0x40')]({'exitAt':moment()[_0xb6e3('0x36')](_0xb6e3('0x33'))}));});return BPromise[_0xb6e3('0x56')](_0x3e7f58);}}})[_0xb6e3('0x14')](function(_0x784eda){if(_0xd8ad8a){var _0x2fb924=[];var _0x3b0c53=[];var _0x3048d9=utils[_0xb6e3('0x34')]();var _0x3bf317={'membername':_0xd8ad8a['name'],'interface':_0x351674,'enterAt':moment()[_0xb6e3('0x36')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xd8ad8a[_0xb6e3('0x2d')],'internal':_0xd8ad8a[_0xb6e3('0x2e')]};_0x3048d9['forEach'](function(_0x38d7b5){_0x2fb924[_0xb6e3('0x4c')](_['merge']({'channel':_0x38d7b5,'type':_0xb6e3('0x57'),'data1':_0xb6e3('0x58'),'data2':_0x351674},_0x3bf317));if(_0xd8ad8a['loginInPause']){_0x3b0c53[_0xb6e3('0x4c')](_['merge']({'channel':_0x38d7b5,'type':_0xb6e3('0x31'),'data1':_0xb6e3('0x59')},_0x3bf317));}});return db['MemberReport'][_0xb6e3('0x5a')](_0x2fb924[_0xb6e3('0x5b')](_0x3b0c53),{'individualHooks':!![]});}})['then'](function(){if(_0xd8ad8a){return _0xd8ad8a['update']({'online':!![],'lastLoginAt':moment()['format'](_0xb6e3('0x33')),'voicePause':_0xd8ad8a['loginInPause']||![],'mailPause':_0xd8ad8a[_0xb6e3('0x4d')]||![],'chatPause':_0xd8ad8a[_0xb6e3('0x4d')]||![],'faxPause':_0xd8ad8a[_0xb6e3('0x4d')]||![],'smsPause':_0xd8ad8a[_0xb6e3('0x4d')]||![],'openchannelPause':_0xd8ad8a[_0xb6e3('0x4d')]||![],'pauseType':_0xd8ad8a[_0xb6e3('0x4d')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0xb6e3('0x33')),'interface':_0x351674});}})[_0xb6e3('0x14')](function(_0x42f3de){_0x499cef(_0x42f3de);})[_0xb6e3('0x1e')](function(_0x94c3a0){_0x1a1c7e(_0x18a133[_0xb6e3('0x1a')](0x1f4,_0x94c3a0[_0xb6e3('0x1c')]));});});}; \ No newline at end of file +var _0xdb5b=['bulkCreate','findOne','channel','isValidChannel','Unknown\x20channel','voice','system','mail','chat','fax','sms','openchannel','whatsapp','%s%s','Pause','all','LogoutUser','destroy','LoginUser','mobile','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','LOGIN','merge','LOGININPAUSE','loginInPause','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./user.socket','register','then','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','User,\x20%s,\x20%s','message','info','result','catch','User','findAll','options','raw','where','limit','include','attributes','map','model','GetUser','ShowUser','find','PauseUser','name','role','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','forEach','push','isNil','body','type','DEFAULT\x20PAUSE','internal','uniqueid'];(function(_0x522516,_0x1045d5){var _0x5853d7=function(_0x502d4b){while(--_0x502d4b){_0x522516['push'](_0x522516['shift']());}};_0x5853d7(++_0x1045d5);}(_0xdb5b,0x194));var _0xbdb5=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xdb5b[_0x23e7c1];return _0x1add43;};'use strict';var _=require('lodash');var util=require(_0xbdb5('0x0'));var moment=require('moment');var BPromise=require(_0xbdb5('0x1'));var rs=require(_0xbdb5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbdb5('0x3'));var logger=require(_0xbdb5('0x4'))(_0xbdb5('0x5'));var config=require(_0xbdb5('0x6'));var jayson=require(_0xbdb5('0x7'));var client=jayson[_0xbdb5('0x8')][_0xbdb5('0x9')]({'port':0x232a});config['redis']=_[_0xbdb5('0xa')](config[_0xbdb5('0xb')],{'host':_0xbdb5('0xc'),'port':0x18eb});var socket=require(_0xbdb5('0xd'))(new Redis(config['redis']));require(_0xbdb5('0xe'))[_0xbdb5('0xf')](socket);function respondWithRpcPromise(_0x3da090,_0x2de7b5,_0x509f90){return new BPromise(function(_0x14b583,_0xe7ea32){return client['request'](_0x3da090,_0x509f90)[_0xbdb5('0x10')](function(_0x18f82a){logger['info']('User,\x20%s,\x20%s',_0x2de7b5,'request\x20sent');logger[_0xbdb5('0x11')](_0xbdb5('0x12'),_0x2de7b5,_0xbdb5('0x13'),JSON[_0xbdb5('0x14')](_0x18f82a));if(_0x18f82a[_0xbdb5('0x15')]){if(_0x18f82a['error']['code']===0x1f4){logger['error'](_0xbdb5('0x16'),_0x2de7b5,_0x18f82a[_0xbdb5('0x15')][_0xbdb5('0x17')]);return _0xe7ea32(_0x18f82a[_0xbdb5('0x15')][_0xbdb5('0x17')]);}logger[_0xbdb5('0x15')](_0xbdb5('0x16'),_0x2de7b5,_0x18f82a[_0xbdb5('0x15')][_0xbdb5('0x17')]);return _0x14b583(_0x18f82a[_0xbdb5('0x15')]['message']);}else{logger[_0xbdb5('0x18')]('User,\x20%s,\x20%s',_0x2de7b5,_0xbdb5('0x13'));_0x14b583(_0x18f82a[_0xbdb5('0x19')][_0xbdb5('0x17')]);}})[_0xbdb5('0x1a')](function(_0x191eef){logger[_0xbdb5('0x15')](_0xbdb5('0x16'),_0x2de7b5,_0x191eef);_0xe7ea32(_0x191eef);});});}exports['GetUser']=function(_0x62ca97){var _0x536c30=this;return new Promise(function(_0x2d2176,_0x59d66c){return db[_0xbdb5('0x1b')][_0xbdb5('0x1c')]({'raw':_0x62ca97[_0xbdb5('0x1d')]?_0x62ca97[_0xbdb5('0x1d')][_0xbdb5('0x1e')]===undefined?!![]:![]:!![],'where':_0x62ca97['options']?_0x62ca97[_0xbdb5('0x1d')][_0xbdb5('0x1f')]||null:null,'attributes':_0x62ca97[_0xbdb5('0x1d')]?_0x62ca97['options']['attributes']||null:null,'limit':_0x62ca97[_0xbdb5('0x1d')]?_0x62ca97['options'][_0xbdb5('0x20')]||null:null,'include':_0x62ca97[_0xbdb5('0x1d')]?_0x62ca97[_0xbdb5('0x1d')][_0xbdb5('0x21')]?_['map'](_0x62ca97[_0xbdb5('0x1d')][_0xbdb5('0x21')],function(_0x4349c2){return{'model':db[_0x4349c2['model']],'as':_0x4349c2['as'],'attributes':_0x4349c2[_0xbdb5('0x22')],'include':_0x4349c2[_0xbdb5('0x21')]?_[_0xbdb5('0x23')](_0x4349c2[_0xbdb5('0x21')],function(_0x211bca){return{'model':db[_0x211bca[_0xbdb5('0x24')]],'as':_0x211bca['as'],'attributes':_0x211bca[_0xbdb5('0x22')],'include':_0x211bca[_0xbdb5('0x21')]?_[_0xbdb5('0x23')](_0x211bca[_0xbdb5('0x21')],function(_0xf227fb){return{'model':db[_0xf227fb[_0xbdb5('0x24')]],'as':_0xf227fb['as'],'attributes':_0xf227fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xbdb5('0x10')](function(_0x16f41d){logger['info'](_0xbdb5('0x25'),_0x62ca97);logger[_0xbdb5('0x11')](_0xbdb5('0x25'),_0x62ca97,JSON['stringify'](_0x16f41d));_0x2d2176(_0x16f41d);})['catch'](function(_0x1af688){logger[_0xbdb5('0x15')]('GetUser',_0x1af688[_0xbdb5('0x17')],_0x62ca97);_0x59d66c(_0x536c30['error'](0x1f4,_0x1af688[_0xbdb5('0x17')]));});});};exports[_0xbdb5('0x26')]=function(_0x44f653){var _0xa29047=this;return new Promise(function(_0x2a8bd1,_0x5454af){return db['User'][_0xbdb5('0x27')]({'raw':_0x44f653[_0xbdb5('0x1d')]?_0x44f653['options'][_0xbdb5('0x1e')]===undefined?!![]:![]:!![],'where':_0x44f653[_0xbdb5('0x1d')]?_0x44f653['options'][_0xbdb5('0x1f')]||null:null,'attributes':_0x44f653[_0xbdb5('0x1d')]?_0x44f653[_0xbdb5('0x1d')][_0xbdb5('0x22')]||null:null,'include':_0x44f653[_0xbdb5('0x1d')]?_0x44f653[_0xbdb5('0x1d')][_0xbdb5('0x21')]?_[_0xbdb5('0x23')](_0x44f653[_0xbdb5('0x1d')][_0xbdb5('0x21')],function(_0x1524f0){return{'model':db[_0x1524f0[_0xbdb5('0x24')]],'as':_0x1524f0['as'],'attributes':_0x1524f0[_0xbdb5('0x22')],'include':_0x1524f0[_0xbdb5('0x21')]?_['map'](_0x1524f0[_0xbdb5('0x21')],function(_0x1c2561){return{'model':db[_0x1c2561['model']],'as':_0x1c2561['as'],'attributes':_0x1c2561[_0xbdb5('0x22')],'include':_0x1c2561[_0xbdb5('0x21')]?_[_0xbdb5('0x23')](_0x1c2561[_0xbdb5('0x21')],function(_0x552832){return{'model':db[_0x552832[_0xbdb5('0x24')]],'as':_0x552832['as'],'attributes':_0x552832[_0xbdb5('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbdb5('0x10')](function(_0x5f46c1){logger[_0xbdb5('0x18')](_0xbdb5('0x26'),_0x44f653);logger[_0xbdb5('0x11')](_0xbdb5('0x26'),_0x44f653,JSON[_0xbdb5('0x14')](_0x5f46c1));_0x2a8bd1(_0x5f46c1);})[_0xbdb5('0x1a')](function(_0x1cc90c){logger['error'](_0xbdb5('0x26'),_0x1cc90c[_0xbdb5('0x17')],_0x44f653);_0x5454af(_0xa29047[_0xbdb5('0x15')](0x1f4,_0x1cc90c[_0xbdb5('0x17')]));});});};exports[_0xbdb5('0x28')]=function(_0xc1d478){var _0x304b1f=this;return new Promise(function(_0x86d0a7,_0x5d0ced){var _0x11f4dd;return db[_0xbdb5('0x1b')][_0xbdb5('0x27')]({'where':_0xc1d478['options']['where']||{},'attributes':['id',_0xbdb5('0x29'),_0xbdb5('0x2a'),'internal',_0xbdb5('0x2b')]})[_0xbdb5('0x10')](function(_0x1915af){if(_0x1915af){_0x11f4dd=_0x1915af;return db[_0xbdb5('0x2c')][_0xbdb5('0x2d')]({'paused':0x1},{'where':{'UserId':_0x11f4dd['id']},'individualHooks':!![]});}})[_0xbdb5('0x10')](function(){if(_0x11f4dd){return db[_0xbdb5('0x2e')][_0xbdb5('0x1c')]({'where':{'membername':_0x11f4dd[_0xbdb5('0x29')],'type':_0xbdb5('0x2f'),'exitAt':null}});}})['then'](function(_0x5d5b4e){if(_0x11f4dd){if(_0x5d5b4e&&_0x5d5b4e['length']){var _0x463fe4=moment()[_0xbdb5('0x30')](_0xbdb5('0x31'));for(var _0x54db25=0x0,_0x1c549b=_0x5d5b4e[_0xbdb5('0x32')];_0x54db25<_0x1c549b;_0x54db25++){_0x5d5b4e[_0x54db25][_0xbdb5('0x33')]({'exitAt':_0x463fe4});}}}})[_0xbdb5('0x10')](function(){if(_0x11f4dd){var _0x5aa210=[];var _0x2ddf19=utils[_0xbdb5('0x34')]();_0x2ddf19[_0xbdb5('0x35')](function(_0x293821){_0x5aa210[_0xbdb5('0x36')]({'channel':_0x293821,'membername':_0x11f4dd[_0xbdb5('0x29')],'interface':_[_0xbdb5('0x37')](_0x11f4dd[_0xbdb5('0x2b')])?util[_0xbdb5('0x30')]('SIP/%s',_0x11f4dd[_0xbdb5('0x29')]):_0x11f4dd['interface'],'type':_0xbdb5('0x2f'),'enterAt':moment()[_0xbdb5('0x30')](_0xbdb5('0x31')),'data1':_0xc1d478[_0xbdb5('0x38')][_0xbdb5('0x39')]||_0xbdb5('0x3a'),'role':_0x11f4dd['role'],'internal':_0x11f4dd[_0xbdb5('0x3b')],'uniqueid':_0xc1d478[_0xbdb5('0x38')][_0xbdb5('0x3c')]||null});});return db['MemberReport'][_0xbdb5('0x3d')](_0x5aa210,{'individualHooks':!![]});}})[_0xbdb5('0x10')](function(){if(_0x11f4dd){return _0x11f4dd[_0xbdb5('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xc1d478[_0xbdb5('0x38')][_0xbdb5('0x39')]||_0xbdb5('0x3a'),'lastPauseAt':moment()[_0xbdb5('0x30')](_0xbdb5('0x31'))});}})['then'](function(_0x588730){_0x86d0a7(_0x588730);})[_0xbdb5('0x1a')](function(_0x4118af){_0x5d0ced(_0x304b1f[_0xbdb5('0x15')](0x1f4,_0x4118af[_0xbdb5('0x17')]));});});};exports['UnpauseUser']=function(_0x56fdfc){var _0x55a7ce=this;return new Promise(function(_0x132d82,_0x647cb5){var _0x4bc3f6;return db[_0xbdb5('0x1b')][_0xbdb5('0x3e')]({'where':_0x56fdfc['options']['where']||{},'attributes':['id',_0xbdb5('0x29')]})[_0xbdb5('0x10')](function(_0x59bc7c){if(_0x59bc7c){_0x4bc3f6=_0x59bc7c;if(_0x56fdfc[_0xbdb5('0x38')][_0xbdb5('0x3f')]&&!utils[_0xbdb5('0x40')](_0x56fdfc[_0xbdb5('0x38')]['channel'])){throw new Error(_0xbdb5('0x41'));}switch(_0x56fdfc[_0xbdb5('0x38')][_0xbdb5('0x3f')]){case _0xbdb5('0x42'):return db[_0xbdb5('0x2c')][_0xbdb5('0x2d')]({'paused':0x0},{'where':{'UserId':_0x4bc3f6['id']}})['then'](function(){return db['MemberReport'][_0xbdb5('0x27')]({'where':{'channel':_0x56fdfc['body']['channel'],'membername':_0x4bc3f6[_0xbdb5('0x29')],'type':_0xbdb5('0x2f'),'exitAt':null}});})['then'](function(_0x4da06d){if(_0x4da06d){return _0x4da06d[_0xbdb5('0x2d')]({'exitAt':moment()[_0xbdb5('0x30')](_0xbdb5('0x31')),'data2':_0xbdb5('0x43')},{'individualHooks':!![]});}return null;})[_0xbdb5('0x10')](function(){return _0x4bc3f6[_0xbdb5('0x2d')]({'voicePause':![]});});case _0xbdb5('0x44'):case _0xbdb5('0x45'):case _0xbdb5('0x46'):case _0xbdb5('0x47'):case _0xbdb5('0x48'):case _0xbdb5('0x49'):return db['MemberReport'][_0xbdb5('0x27')]({'where':{'channel':_0x56fdfc[_0xbdb5('0x38')][_0xbdb5('0x3f')],'membername':_0x4bc3f6['name'],'type':'PAUSE','exitAt':null}})[_0xbdb5('0x10')](function(_0x163d74){return _0x163d74[_0xbdb5('0x2d')]({'exitAt':moment()[_0xbdb5('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xbdb5('0x43')},{'individualHooks':!![]});})[_0xbdb5('0x10')](function(){var _0x56a3a6={};_['set'](_0x56a3a6,util['format'](_0xbdb5('0x4a'),_0x56fdfc['body'][_0xbdb5('0x3f')],_0xbdb5('0x4b')),![]);return _0x4bc3f6['update'](_0x56a3a6);});default:return db['UserVoiceQueueRt'][_0xbdb5('0x2d')]({'paused':0x0},{'where':{'UserId':_0x4bc3f6['id']}})[_0xbdb5('0x10')](function(){return db[_0xbdb5('0x2e')]['findAll']({'where':{'membername':_0x4bc3f6[_0xbdb5('0x29')],'type':_0xbdb5('0x2f'),'exitAt':null}});})[_0xbdb5('0x10')](function(_0x46b6b9){var _0x4243bc=[];_0x46b6b9[_0xbdb5('0x35')](function(_0x4e70c9){_0x4243bc[_0xbdb5('0x36')](_0x4e70c9[_0xbdb5('0x2d')]({'exitAt':moment()[_0xbdb5('0x30')](_0xbdb5('0x31')),'data2':_0xbdb5('0x43')}));});return BPromise[_0xbdb5('0x4c')](_0x4243bc);})['then'](function(){return _0x4bc3f6[_0xbdb5('0x2d')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xbdb5('0x10')](function(_0x4e1a6a){_0x132d82(_0x4e1a6a);})['catch'](function(_0x18afa2){_0x647cb5(_0x55a7ce[_0xbdb5('0x15')](0x1f4,_0x18afa2[_0xbdb5('0x17')]));});});};exports[_0xbdb5('0x4d')]=function(_0x263885){var _0x3806a8=this;return new Promise(function(_0x567c89,_0x56c845){var _0x35dc5b;return db[_0xbdb5('0x1b')]['findOne']({'where':_0x263885[_0xbdb5('0x1d')][_0xbdb5('0x1f')]||{},'attributes':['id','name']})[_0xbdb5('0x10')](function(_0x5b028f){if(_0x5b028f){_0x35dc5b=_0x5b028f;return db[_0xbdb5('0x2c')][_0xbdb5('0x4e')]({'where':{'membername':_0x35dc5b[_0xbdb5('0x29')]},'individualHooks':!![]});}})[_0xbdb5('0x10')](function(){if(_0x35dc5b){return db[_0xbdb5('0x2e')][_0xbdb5('0x1c')]({'where':{'membername':_0x35dc5b[_0xbdb5('0x29')],'exitAt':null}});}})[_0xbdb5('0x10')](function(_0x18dc06){if(_0x35dc5b){if(_0x18dc06&&_0x18dc06[_0xbdb5('0x32')]){var _0x1cf7ff=[];_0x18dc06[_0xbdb5('0x35')](function(_0x2ccffd){_0x1cf7ff[_0xbdb5('0x36')](_0x2ccffd[_0xbdb5('0x2d')]({'exitAt':moment()[_0xbdb5('0x30')](_0xbdb5('0x31'))}));});return BPromise[_0xbdb5('0x4c')](_0x1cf7ff);}}})[_0xbdb5('0x10')](function(){if(_0x35dc5b){return _0x35dc5b[_0xbdb5('0x2d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xbdb5('0x10')](function(_0x43e2fd){_0x567c89(_0x43e2fd);})[_0xbdb5('0x1a')](function(_0x3a77ff){_0x56c845(_0x3806a8[_0xbdb5('0x15')](0x1f4,_0x3a77ff[_0xbdb5('0x17')]));});});};exports[_0xbdb5('0x4f')]=function(_0x2cc91a){var _0x58b27f=this;return new Promise(function(_0x1ea960,_0x269bf4){var _0x5f0606;var _0x2b0f51;var _0x2df75a;var _0x16bce1;return db[_0xbdb5('0x1b')][_0xbdb5('0x3e')]({'where':_0x2cc91a['options'][_0xbdb5('0x1f')]||{},'attributes':['id',_0xbdb5('0x29'),_0xbdb5('0x2a'),_0xbdb5('0x50'),'phone',_0xbdb5('0x3b'),'loginInPause','interface']})[_0xbdb5('0x10')](function(_0xdc7586){if(_0xdc7586){_0x5f0606=_0xdc7586;_0x16bce1=_0x2cc91a[_0xbdb5('0x38')]['interface']?_0x2cc91a[_0xbdb5('0x38')][_0xbdb5('0x2b')]:util['format']('SIP/%s',_0x5f0606['name']);return db[_0xbdb5('0x1b')][_0xbdb5('0x51')]({'where':{'role':_0xbdb5('0x52'),'online':!![],'id':{'$ne':_0x5f0606['id']}}});}})[_0xbdb5('0x10')](function(_0xc3feb){if(_0xc3feb){_0x2df75a=_0xc3feb;return require(_0xbdb5('0x53'))[_0xbdb5('0x54')]();}})[_0xbdb5('0x10')](function(_0x24a624){if(_0x24a624&&_0x24a624[_0xbdb5('0x55')]&&_0x2df75a>=_0x24a624[_0xbdb5('0x55')]){throw new Error(_0xbdb5('0x56'));}})['then'](function(){if(_0x5f0606){return db[_0xbdb5('0x2c')][_0xbdb5('0x4e')]({'where':{'membername':_0x5f0606[_0xbdb5('0x29')]},'individualHooks':!![]});}})['then'](function(){if(_0x5f0606){return _0x5f0606['getVoiceQueues']({'raw':!![]});}})[_0xbdb5('0x10')](function(_0x1e1a45){if(_0x5f0606){if(_0x1e1a45){var _0x5735ea=[];_0x2b0f51=_0x1e1a45;if(_0x2b0f51[_0xbdb5('0x32')]){for(var _0xffdcc6=0x0;_0xffdcc6<_0x2b0f51[_0xbdb5('0x32')];_0xffdcc6++){_0x5735ea[_0xbdb5('0x36')](db[_0xbdb5('0x2c')][_0xbdb5('0x57')]({'membername':_0x5f0606['name'],'UserId':_0x5f0606['id'],'queue_name':_0x2b0f51[_0xffdcc6]['name'],'VoiceQueueId':_0x2b0f51[_0xffdcc6]['id'],'interface':_0x16bce1,'paused':_0x5f0606['loginInPause']||![],'penalty':_0x2b0f51[_0xffdcc6][_0xbdb5('0x58')]||0x0}));}return BPromise[_0xbdb5('0x4c')](_0x5735ea);}}}})[_0xbdb5('0x10')](function(){if(_0x5f0606){return db[_0xbdb5('0x2e')][_0xbdb5('0x1c')]({'where':{'membername':_0x5f0606[_0xbdb5('0x29')],'exitAt':null}});}})[_0xbdb5('0x10')](function(_0x3e8574){if(_0x5f0606){if(_0x3e8574&&_0x3e8574[_0xbdb5('0x32')]){var _0x1664bb=[];_0x3e8574[_0xbdb5('0x35')](function(_0x3aa67d){_0x1664bb[_0xbdb5('0x36')](_0x3aa67d[_0xbdb5('0x2d')]({'exitAt':moment()['format'](_0xbdb5('0x31'))}));});return BPromise[_0xbdb5('0x4c')](_0x1664bb);}}})[_0xbdb5('0x10')](function(_0x3e7e9d){if(_0x5f0606){var _0x5c1e69=[];var _0x1e1755=[];var _0x2a77d5=utils[_0xbdb5('0x34')]();var _0x947a94={'membername':_0x5f0606[_0xbdb5('0x29')],'interface':_0x16bce1,'enterAt':moment()[_0xbdb5('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5f0606[_0xbdb5('0x2a')],'internal':_0x5f0606[_0xbdb5('0x3b')]};_0x2a77d5['forEach'](function(_0x38496b){_0x5c1e69[_0xbdb5('0x36')](_['merge']({'channel':_0x38496b,'type':_0xbdb5('0x59'),'data1':'callysquare','data2':_0x16bce1},_0x947a94));if(_0x5f0606['loginInPause']){_0x1e1755[_0xbdb5('0x36')](_[_0xbdb5('0x5a')]({'channel':_0x38496b,'type':_0xbdb5('0x2f'),'data1':_0xbdb5('0x5b')},_0x947a94));}});return db[_0xbdb5('0x2e')][_0xbdb5('0x3d')](_0x5c1e69['concat'](_0x1e1755),{'individualHooks':!![]});}})['then'](function(){if(_0x5f0606){return _0x5f0606[_0xbdb5('0x2d')]({'online':!![],'lastLoginAt':moment()['format'](_0xbdb5('0x31')),'voicePause':_0x5f0606[_0xbdb5('0x5c')]||![],'mailPause':_0x5f0606['loginInPause']||![],'chatPause':_0x5f0606[_0xbdb5('0x5c')]||![],'faxPause':_0x5f0606[_0xbdb5('0x5c')]||![],'smsPause':_0x5f0606['loginInPause']||![],'openchannelPause':_0x5f0606['loginInPause']||![],'pauseType':_0x5f0606[_0xbdb5('0x5c')]?_0xbdb5('0x5b'):null,'lastPauseAt':moment()[_0xbdb5('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x16bce1});}})[_0xbdb5('0x10')](function(_0x36b079){_0x1ea960(_0x36b079);})[_0xbdb5('0x1a')](function(_0x472809){_0x269bf4(_0x58b27f[_0xbdb5('0x15')](0x1f4,_0x472809[_0xbdb5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 264d21a..a0a94fb 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 _0x4115=['user:','./user.events','save','update','length'];(function(_0x46dd33,_0x492982){var _0x979584=function(_0x5a414b){while(--_0x5a414b){_0x46dd33['push'](_0x46dd33['shift']());}};_0x979584(++_0x492982);}(_0x4115,0x187));var _0x5411=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x4115[_0x9dfc10];return _0x4f938a;};'use strict';var UserEvents=require(_0x5411('0x0'));var events=[_0x5411('0x1'),'remove',_0x5411('0x2')];function createListener(_0x13ab6d,_0x59a74e){return function(_0xd42cee){_0x59a74e['emit'](_0x13ab6d,_0xd42cee);};}function removeListener(_0xe87b83,_0x3aad9a){return function(){UserEvents['removeListener'](_0xe87b83,_0x3aad9a);};}exports['register']=function(_0x8da452){for(var _0x5f5786=0x0,_0x13e493=events[_0x5411('0x3')];_0x5f5786<_0x13e493;_0x5f5786++){var _0x29b5ed=events[_0x5f5786];var _0x279ea3=createListener(_0x5411('0x4')+_0x29b5ed,_0x8da452);UserEvents['on'](_0x29b5ed,_0x279ea3);}}; \ No newline at end of file +var _0x9a41=['user:','save','remove','update','emit','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9a41,0x1cf));var _0x19a4=function(_0x4c93e3,_0x2af869){_0x4c93e3=_0x4c93e3-0x0;var _0x2dc403=_0x9a41[_0x4c93e3];return _0x2dc403;};'use strict';var UserEvents=require('./user.events');var events=[_0x19a4('0x0'),_0x19a4('0x1'),_0x19a4('0x2')];function createListener(_0x44f1ac,_0x508d9a){return function(_0x2b9da5){_0x508d9a[_0x19a4('0x3')](_0x44f1ac,_0x2b9da5);};}function removeListener(_0x3f9769,_0x58802d){return function(){UserEvents['removeListener'](_0x3f9769,_0x58802d);};}exports['register']=function(_0x5be661){for(var _0x3410ad=0x0,_0x11b21a=events[_0x19a4('0x4')];_0x3410ad<_0x11b21a;_0x3410ad++){var _0x341e63=events[_0x3410ad];var _0x23cc9a=createListener(_0x19a4('0x5')+_0x341e63,_0x5be661);UserEvents['on'](_0x341e63,_0x23cc9a);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 6cc4e2b..db23404 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x54af83,_0x947eb2){var _0x2eaed6=function(_0x549eeb){while(--_0x549eeb){_0x54af83['push'](_0x54af83['shift']());}};_0x2eaed6(++_0x947eb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4ca922,_0x11f8d6){var _0x3feb75=function(_0x4e8db2){while(--_0x4e8db2){_0x4ca922['push'](_0x4ca922['shift']());}};_0x3feb75(++_0x11f8d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index df569d3..eb02f40 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 _0x9bfa=['sequelize','exports','INTEGER'];(function(_0xd81b5b,_0x15f6a7){var _0x52ffd9=function(_0x5571ea){while(--_0x5571ea){_0xd81b5b['push'](_0xd81b5b['shift']());}};_0x52ffd9(++_0x15f6a7);}(_0x9bfa,0x87));var _0xa9bf=function(_0x299bc4,_0x631809){_0x299bc4=_0x299bc4-0x0;var _0x3928fb=_0x9bfa[_0x299bc4];return _0x3928fb;};'use strict';var Sequelize=require(_0xa9bf('0x0'));module[_0xa9bf('0x1')]={'penalty':{'type':Sequelize[_0xa9bf('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xac44=['INTEGER','sequelize'];(function(_0x3edfc0,_0x4fd78a){var _0x64b1ef=function(_0x1fb1a9){while(--_0x1fb1a9){_0x3edfc0['push'](_0x3edfc0['shift']());}};_0x64b1ef(++_0x4fd78a);}(_0xac44,0x143));var _0x4ac4=function(_0x26411d,_0x39637d){_0x26411d=_0x26411d-0x0;var _0xc1a39a=_0xac44[_0x26411d];return _0xc1a39a;};'use strict';var Sequelize=require(_0x4ac4('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4ac4('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 41a03a8..93ed305 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 _0x77fb=['api','moment','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x77fb,0x7b));var _0xb77f=function(_0xd6ee8b,_0x346ebc){_0xd6ee8b=_0xd6ee8b-0x0;var _0x6c63de=_0x77fb[_0xd6ee8b];return _0x6c63de;};'use strict';var _=require(_0xb77f('0x0'));var util=require(_0xb77f('0x1'));var logger=require(_0xb77f('0x2'))(_0xb77f('0x3'));var moment=require(_0xb77f('0x4'));var BPromise=require('bluebird');var rp=require(_0xb77f('0x5'));var fs=require('fs');var path=require(_0xb77f('0x6'));var rimraf=require(_0xb77f('0x7'));var config=require(_0xb77f('0x8'));var attributes=require(_0xb77f('0x9'));module[_0xb77f('0xa')]=function(_0x5e0829,_0x159021){return _0x5e0829[_0xb77f('0xb')](_0xb77f('0xc'),attributes,{'tableName':_0xb77f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacb4=['define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x5c8916,_0x23f33c){var _0x44213f=function(_0x3a39d5){while(--_0x3a39d5){_0x5c8916['push'](_0x5c8916['shift']());}};_0x44213f(++_0x23f33c);}(_0xacb4,0x18f));var _0x4acb=function(_0x4cee4b,_0x1dfff3){_0x4cee4b=_0x4cee4b-0x0;var _0x4d891d=_0xacb4[_0x4cee4b];return _0x4d891d;};'use strict';var _=require(_0x4acb('0x0'));var util=require('util');var logger=require(_0x4acb('0x1'))(_0x4acb('0x2'));var moment=require(_0x4acb('0x3'));var BPromise=require('bluebird');var rp=require(_0x4acb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4acb('0x5'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x1d9179,_0x3b00c2){return _0x1d9179[_0x4acb('0x6')](_0x4acb('0x7'),attributes,{'tableName':_0x4acb('0x8'),'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 5a1678b..43d257c 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 _0xb9db=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4ac743,_0x3fa20d){var _0x3e60a3=function(_0x197da0){while(--_0x197da0){_0x4ac743['push'](_0x4ac743['shift']());}};_0x3e60a3(++_0x3fa20d);}(_0xb9db,0xb2));var _0xbb9d=function(_0x186b07,_0x22b089){_0x186b07=_0x186b07-0x0;var _0x253735=_0xb9db[_0x186b07];return _0x253735;};'use strict';var _=require(_0xbb9d('0x0'));var util=require(_0xbb9d('0x1'));var moment=require('moment');var BPromise=require(_0xbb9d('0x2'));var rs=require(_0xbb9d('0x3'));var fs=require('fs');var Redis=require(_0xbb9d('0x4'));var db=require(_0xbb9d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb9d('0x6'))(_0xbb9d('0x7'));var config=require(_0xbb9d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbb9d('0x9')][_0xbb9d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5aea67,_0x4be9fa,_0x16dcea){return new BPromise(function(_0x450b57,_0x1a48ce){return client['request'](_0x5aea67,_0x16dcea)[_0xbb9d('0xb')](function(_0x4e41ab){logger[_0xbb9d('0xc')](_0xbb9d('0xd'),_0x4be9fa,_0xbb9d('0xe'));logger['debug'](_0xbb9d('0xf'),_0x4be9fa,_0xbb9d('0xe'),JSON[_0xbb9d('0x10')](_0x4e41ab));if(_0x4e41ab['error']){if(_0x4e41ab[_0xbb9d('0x11')][_0xbb9d('0x12')]===0x1f4){logger[_0xbb9d('0x11')](_0xbb9d('0xd'),_0x4be9fa,_0x4e41ab[_0xbb9d('0x11')][_0xbb9d('0x13')]);return _0x1a48ce(_0x4e41ab[_0xbb9d('0x11')]['message']);}logger[_0xbb9d('0x11')](_0xbb9d('0xd'),_0x4be9fa,_0x4e41ab['error'][_0xbb9d('0x13')]);return _0x450b57(_0x4e41ab[_0xbb9d('0x11')][_0xbb9d('0x13')]);}else{logger['info'](_0xbb9d('0xd'),_0x4be9fa,_0xbb9d('0xe'));_0x450b57(_0x4e41ab[_0xbb9d('0x14')][_0xbb9d('0x13')]);}})[_0xbb9d('0x15')](function(_0x2e2f33){logger[_0xbb9d('0x11')](_0xbb9d('0xd'),_0x4be9fa,_0x2e2f33);_0x1a48ce(_0x2e2f33);});});} \ No newline at end of file +var _0x9b0b=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','ioredis','rpc','../../config/environment','jayson/promise','client','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x1beb9c,_0x35cffc){var _0x19b1cd=function(_0x3e1aa9){while(--_0x3e1aa9){_0x1beb9c['push'](_0x1beb9c['shift']());}};_0x19b1cd(++_0x35cffc);}(_0x9b0b,0x1ac));var _0xb9b0=function(_0x47c5bf,_0x45977e){_0x47c5bf=_0x47c5bf-0x0;var _0x11b779=_0x9b0b[_0x47c5bf];return _0x11b779;};'use strict';var _=require(_0xb9b0('0x0'));var util=require(_0xb9b0('0x1'));var moment=require(_0xb9b0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9b0('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb9b0('0x4'));var config=require(_0xb9b0('0x5'));var jayson=require(_0xb9b0('0x6'));var client=jayson[_0xb9b0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x180da0,_0x26c148,_0x129ddc){return new BPromise(function(_0x21a7c5,_0x2c75ab){return client[_0xb9b0('0x8')](_0x180da0,_0x129ddc)[_0xb9b0('0x9')](function(_0x1cd7ea){logger['info'](_0xb9b0('0xa'),_0x26c148,_0xb9b0('0xb'));logger[_0xb9b0('0xc')](_0xb9b0('0xd'),_0x26c148,_0xb9b0('0xb'),JSON[_0xb9b0('0xe')](_0x1cd7ea));if(_0x1cd7ea[_0xb9b0('0xf')]){if(_0x1cd7ea[_0xb9b0('0xf')][_0xb9b0('0x10')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x26c148,_0x1cd7ea['error'][_0xb9b0('0x11')]);return _0x2c75ab(_0x1cd7ea['error'][_0xb9b0('0x11')]);}logger['error'](_0xb9b0('0xa'),_0x26c148,_0x1cd7ea[_0xb9b0('0xf')][_0xb9b0('0x11')]);return _0x21a7c5(_0x1cd7ea[_0xb9b0('0xf')][_0xb9b0('0x11')]);}else{logger[_0xb9b0('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x26c148,'request\x20sent');_0x21a7c5(_0x1cd7ea['result'][_0xb9b0('0x11')]);}})[_0xb9b0('0x13')](function(_0x16d58f){logger[_0xb9b0('0xf')](_0xb9b0('0xa'),_0x26c148,_0x16d58f);_0x2c75ab(_0x16d58f);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 761915c..10b3f91 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4057a1,_0x315235){var _0x12f4a3=function(_0x46b5ea){while(--_0x46b5ea){_0x4057a1['push'](_0x4057a1['shift']());}};_0x12f4a3(++_0x315235);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3fbcf1,_0x51953d){var _0x5795fd=function(_0x210d50){while(--_0x210d50){_0x3fbcf1['push'](_0x3fbcf1['shift']());}};_0x5795fd(++_0x51953d);}(_0x70e0,0x17b));var _0x070e=function(_0x2df704,_0x1e334a){_0x2df704=_0x2df704-0x0;var _0x4cc127=_0x70e0[_0x2df704];return _0x4cc127;};'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 53f96c2..18f55d5 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 _0x6196=['STRING','sequelize','exports','INTEGER'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0x6196,0x8d));var _0x6619=function(_0x1531bb,_0x154d77){_0x1531bb=_0x1531bb-0x0;var _0x113699=_0x6196[_0x1531bb];return _0x113699;};'use strict';var Sequelize=require(_0x6619('0x0'));module[_0x6619('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6619('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x6619('0x3')]}}; \ No newline at end of file +var _0x7a13=['sequelize','exports','INTEGER','STRING'];(function(_0x598334,_0x5a077e){var _0x5b807f=function(_0x1d40cb){while(--_0x1d40cb){_0x598334['push'](_0x598334['shift']());}};_0x5b807f(++_0x5a077e);}(_0x7a13,0x6c));var _0x37a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a13[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x37a1('0x0'));module[_0x37a1('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x37a1('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x37a1('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 0a30063..370c281 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 _0x21d6=['bluebird','path','rimraf','../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','moment'];(function(_0x442f83,_0x56523b){var _0x41ff93=function(_0x426b5a){while(--_0x426b5a){_0x442f83['push'](_0x442f83['shift']());}};_0x41ff93(++_0x56523b);}(_0x21d6,0x164));var _0x621d=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x21d6[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require(_0x621d('0x0'));var logger=require(_0x621d('0x1'))(_0x621d('0x2'));var moment=require(_0x621d('0x3'));var BPromise=require(_0x621d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x621d('0x5'));var rimraf=require(_0x621d('0x6'));var config=require(_0x621d('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x621d('0x8')]=function(_0xfd26b1,_0x4e2e84){return _0xfd26b1[_0x621d('0x9')](_0x621d('0xa'),attributes,{'tableName':_0x621d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcba3=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','user_has_fax_queues','lodash','../../config/logger'];(function(_0x144de6,_0xaf38a3){var _0x18459f=function(_0x5b861e){while(--_0x5b861e){_0x144de6['push'](_0x144de6['shift']());}};_0x18459f(++_0xaf38a3);}(_0xcba3,0xf0));var _0x3cba=function(_0x1709f8,_0x1f40a3){_0x1709f8=_0x1709f8-0x0;var _0x2324da=_0xcba3[_0x1709f8];return _0x2324da;};'use strict';var _=require(_0x3cba('0x0'));var util=require('util');var logger=require(_0x3cba('0x1'))(_0x3cba('0x2'));var moment=require(_0x3cba('0x3'));var BPromise=require('bluebird');var rp=require(_0x3cba('0x4'));var fs=require('fs');var path=require(_0x3cba('0x5'));var rimraf=require(_0x3cba('0x6'));var config=require(_0x3cba('0x7'));var attributes=require(_0x3cba('0x8'));module[_0x3cba('0x9')]=function(_0x483eeb,_0x9d5f5d){return _0x483eeb['define']('UserFaxQueue',attributes,{'tableName':_0x3cba('0xa'),'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 bf2d932..5260e22 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 _0x9e69=['code','message','UserFaxQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x42e9c0,_0x346de3){var _0x19ca7c=function(_0x14479b){while(--_0x14479b){_0x42e9c0['push'](_0x42e9c0['shift']());}};_0x19ca7c(++_0x346de3);}(_0x9e69,0x10d));var _0x99e6=function(_0x49fd32,_0x3a942f){_0x49fd32=_0x49fd32-0x0;var _0x2edbc9=_0x9e69[_0x49fd32];return _0x2edbc9;};'use strict';var _=require(_0x99e6('0x0'));var util=require(_0x99e6('0x1'));var moment=require(_0x99e6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99e6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x99e6('0x4'))(_0x99e6('0x5'));var config=require(_0x99e6('0x6'));var jayson=require(_0x99e6('0x7'));var client=jayson[_0x99e6('0x8')][_0x99e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c2629,_0x563bcc,_0xc1fda2){return new BPromise(function(_0x3893f3,_0x421fb5){return client['request'](_0x5c2629,_0xc1fda2)[_0x99e6('0xa')](function(_0x44d921){logger[_0x99e6('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x563bcc,_0x99e6('0xc'));logger[_0x99e6('0xd')](_0x99e6('0xe'),_0x563bcc,_0x99e6('0xc'),JSON[_0x99e6('0xf')](_0x44d921));if(_0x44d921[_0x99e6('0x10')]){if(_0x44d921[_0x99e6('0x10')][_0x99e6('0x11')]===0x1f4){logger[_0x99e6('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x563bcc,_0x44d921[_0x99e6('0x10')][_0x99e6('0x12')]);return _0x421fb5(_0x44d921[_0x99e6('0x10')][_0x99e6('0x12')]);}logger[_0x99e6('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x563bcc,_0x44d921[_0x99e6('0x10')]['message']);return _0x3893f3(_0x44d921[_0x99e6('0x10')][_0x99e6('0x12')]);}else{logger[_0x99e6('0xb')](_0x99e6('0x13'),_0x563bcc,_0x99e6('0xc'));_0x3893f3(_0x44d921[_0x99e6('0x14')][_0x99e6('0x12')]);}})[_0x99e6('0x15')](function(_0x473d40){logger[_0x99e6('0x10')](_0x99e6('0x13'),_0x563bcc,_0x473d40);_0x421fb5(_0x473d40);});});} \ No newline at end of file +var _0xdf76=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf76,0xe8));var _0x6df7=function(_0xc4c142,_0x392430){_0xc4c142=_0xc4c142-0x0;var _0x2c825e=_0xdf76[_0xc4c142];return _0x2c825e;};'use strict';var _=require(_0x6df7('0x0'));var util=require(_0x6df7('0x1'));var moment=require(_0x6df7('0x2'));var BPromise=require(_0x6df7('0x3'));var rs=require(_0x6df7('0x4'));var fs=require('fs');var Redis=require(_0x6df7('0x5'));var db=require(_0x6df7('0x6'))['db'];var utils=require(_0x6df7('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6df7('0x8'));var client=jayson[_0x6df7('0x9')][_0x6df7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x245043,_0x415718,_0x406575){return new BPromise(function(_0x107e21,_0x2595d4){return client[_0x6df7('0xb')](_0x245043,_0x406575)[_0x6df7('0xc')](function(_0x164306){logger[_0x6df7('0xd')](_0x6df7('0xe'),_0x415718,_0x6df7('0xf'));logger[_0x6df7('0x10')](_0x6df7('0x11'),_0x415718,_0x6df7('0xf'),JSON[_0x6df7('0x12')](_0x164306));if(_0x164306[_0x6df7('0x13')]){if(_0x164306[_0x6df7('0x13')][_0x6df7('0x14')]===0x1f4){logger[_0x6df7('0x13')](_0x6df7('0xe'),_0x415718,_0x164306[_0x6df7('0x13')]['message']);return _0x2595d4(_0x164306[_0x6df7('0x13')][_0x6df7('0x15')]);}logger[_0x6df7('0x13')](_0x6df7('0xe'),_0x415718,_0x164306[_0x6df7('0x13')][_0x6df7('0x15')]);return _0x107e21(_0x164306[_0x6df7('0x13')][_0x6df7('0x15')]);}else{logger['info'](_0x6df7('0xe'),_0x415718,_0x6df7('0xf'));_0x107e21(_0x164306['result'][_0x6df7('0x15')]);}})[_0x6df7('0x16')](function(_0x60f392){logger[_0x6df7('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x415718,_0x60f392);_0x2595d4(_0x60f392);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 1cc7a28..5f9a73c 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1b17ca,_0x1f2936){var _0xf29c4c=function(_0x4f54fd){while(--_0x4f54fd){_0x1b17ca['push'](_0x1b17ca['shift']());}};_0xf29c4c(++_0x1f2936);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0xcb91[_0x2f5a22];return _0x326b70;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 858e69f..c410a38 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 _0x54bd=['sequelize','INTEGER'];(function(_0x17e10b,_0x1a8f74){var _0x3b8c8d=function(_0x5add79){while(--_0x5add79){_0x17e10b['push'](_0x17e10b['shift']());}};_0x3b8c8d(++_0x1a8f74);}(_0x54bd,0x19a));var _0xd54b=function(_0x39e0e1,_0x41e185){_0x39e0e1=_0x39e0e1-0x0;var _0x46a778=_0x54bd[_0x39e0e1];return _0x46a778;};'use strict';var Sequelize=require(_0xd54b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd54b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8b24=['INTEGER','sequelize','exports'];(function(_0x32c649,_0x4401e0){var _0x440a0a=function(_0x403748){while(--_0x403748){_0x32c649['push'](_0x32c649['shift']());}};_0x440a0a(++_0x4401e0);}(_0x8b24,0x109));var _0x48b2=function(_0x204047,_0x172bfc){_0x204047=_0x204047-0x0;var _0x408b71=_0x8b24[_0x204047];return _0x408b71;};'use strict';var Sequelize=require(_0x48b2('0x0'));module[_0x48b2('0x1')]={'penalty':{'type':Sequelize[_0x48b2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index bceefb4..8f7344e 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 _0x191f=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x5cc0a4,_0x1597ce){var _0x40eb3b=function(_0x5672f5){while(--_0x5672f5){_0x5cc0a4['push'](_0x5cc0a4['shift']());}};_0x40eb3b(++_0x1597ce);}(_0x191f,0xb0));var _0xf191=function(_0x2596a6,_0x39a094){_0x2596a6=_0x2596a6-0x0;var _0x12d9c0=_0x191f[_0x2596a6];return _0x12d9c0;};'use strict';var _=require(_0xf191('0x0'));var util=require('util');var logger=require(_0xf191('0x1'))(_0xf191('0x2'));var moment=require(_0xf191('0x3'));var BPromise=require(_0xf191('0x4'));var rp=require(_0xf191('0x5'));var fs=require('fs');var path=require(_0xf191('0x6'));var rimraf=require(_0xf191('0x7'));var config=require(_0xf191('0x8'));var attributes=require(_0xf191('0x9'));module[_0xf191('0xa')]=function(_0x12953f,_0xfd0cc0){return _0x12953f['define']('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d7c=['../../config/environment','./userMailQueue.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4920f2,_0xa4bfbf){var _0x1f27cf=function(_0x4d94ad){while(--_0x4d94ad){_0x4920f2['push'](_0x4920f2['shift']());}};_0x1f27cf(++_0xa4bfbf);}(_0x4d7c,0x86));var _0xc4d7=function(_0x272dce,_0x1f963a){_0x272dce=_0x272dce-0x0;var _0x3ba9db=_0x4d7c[_0x272dce];return _0x3ba9db;};'use strict';var _=require(_0xc4d7('0x0'));var util=require(_0xc4d7('0x1'));var logger=require(_0xc4d7('0x2'))('api');var moment=require(_0xc4d7('0x3'));var BPromise=require(_0xc4d7('0x4'));var rp=require(_0xc4d7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc4d7('0x6'));var attributes=require(_0xc4d7('0x7'));module[_0xc4d7('0x8')]=function(_0x5f4f5d,_0x485c50){return _0x5f4f5d[_0xc4d7('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 bddc307..58d95d6 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1e5971,_0x5dbf16){var _0x1d4474=function(_0x1be729){while(--_0x1be729){_0x1e5971['push'](_0x1e5971['shift']());}};_0x1d4474(++_0x5dbf16);}(_0x6aa7,0x178));var _0x76aa=function(_0x45d15a,_0x35d893){_0x45d15a=_0x45d15a-0x0;var _0x378ed7=_0x6aa7[_0x45d15a];return _0x378ed7;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x8cdd60,_0x126546){var _0x72d3c=function(_0x4a66cc){while(--_0x4a66cc){_0x8cdd60['push'](_0x8cdd60['shift']());}};_0x72d3c(++_0x126546);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2d57a9,_0x5ae060){_0x2d57a9=_0x2d57a9-0x0;var _0x1b9671=_0x7fbe[_0x2d57a9];return _0x1b9671;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 43ca986..d218edd 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 _0xa310=['post','sendUserNotification','exports','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x51c808,_0x90fd6e){var _0x43d5ae=function(_0x32d4b6){while(--_0x32d4b6){_0x51c808['push'](_0x51c808['shift']());}};_0x43d5ae(++_0x90fd6e);}(_0xa310,0xdb));var _0x0a31=function(_0x468d2b,_0x527370){_0x468d2b=_0x468d2b-0x0;var _0x5ec61b=_0xa310[_0x468d2b];return _0x5ec61b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0a31('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0a31('0x1'));var auth=require(_0x0a31('0x2'));var interaction=require(_0x0a31('0x3'));var config=require(_0x0a31('0x4'));var controller=require(_0x0a31('0x5'));router[_0x0a31('0x6')]('/',auth['isAuthenticated'](),controller[_0x0a31('0x7')]);module[_0x0a31('0x8')]=router; \ No newline at end of file +var _0xef62=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x51f40e,_0x14e8ea){var _0xb37761=function(_0x10bce3){while(--_0x10bce3){_0x51f40e['push'](_0x51f40e['shift']());}};_0xb37761(++_0x14e8ea);}(_0xef62,0x67));var _0x2ef6=function(_0x1a7cda,_0x20c4e1){_0x1a7cda=_0x1a7cda-0x0;var _0x42ed88=_0xef62[_0x1a7cda];return _0x42ed88;};'use strict';var multer=require('multer');var util=require(_0x2ef6('0x0'));var path=require(_0x2ef6('0x1'));var timeout=require(_0x2ef6('0x2'));var express=require('express');var router=express[_0x2ef6('0x3')]();var fs_extra=require(_0x2ef6('0x4'));var auth=require(_0x2ef6('0x5'));var interaction=require(_0x2ef6('0x6'));var config=require(_0x2ef6('0x7'));var controller=require(_0x2ef6('0x8'));router['post']('/',auth[_0x2ef6('0x9')](),controller[_0x2ef6('0xa')]);module[_0x2ef6('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 25d305d..7922491 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 _0x093c=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x19ec26,_0x1ae18f){var _0x571056=function(_0x4ad07f){while(--_0x4ad07f){_0x19ec26['push'](_0x19ec26['shift']());}};_0x571056(++_0x1ae18f);}(_0x093c,0x185));var _0xc093=function(_0xcf5066,_0x30ed53){_0xcf5066=_0xcf5066-0x0;var _0x50a09e=_0x093c[_0xcf5066];return _0x50a09e;};'use strict';var Sequelize=require(_0xc093('0x0'));module[_0xc093('0x1')]={'body':{'type':Sequelize[_0xc093('0x2')]},'senderName':{'type':Sequelize[_0xc093('0x3')]},'recipientsId':{'type':Sequelize[_0xc093('0x2')]},'recipientsDescription':{'type':Sequelize[_0xc093('0x3')]},'beep':{'type':Sequelize[_0xc093('0x4')]}}; \ No newline at end of file +var _0x4d30=['sequelize','TEXT'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0x4d30,0x84));var _0x04d3=function(_0x50c4e8,_0xf23dfc){_0x50c4e8=_0x50c4e8-0x0;var _0x33ddd1=_0x4d30[_0x50c4e8];return _0x33ddd1;};'use strict';var Sequelize=require(_0x04d3('0x0'));module['exports']={'body':{'type':Sequelize[_0x04d3('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x04d3('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 8e6c3ba..2f62d9b 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 _0xebdf=['transaction','UserNotification','create','forEach','recipient','emit','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','model','toLowerCase','ids','includes','queue','Queue','all','flatten','findOne','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','sendUserNotification','body','text','hasOwnProperty','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','Sequelize','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','user','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize'];(function(_0x16897b,_0xc869bf){var _0x409f63=function(_0x384fc3){while(--_0x384fc3){_0x16897b['push'](_0x16897b['shift']());}};_0x409f63(++_0xc869bf);}(_0xebdf,0x133));var _0xfebd=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0xebdf[_0x28b0a1];return _0x21470c;};'use strict';var emlformat=require(_0xfebd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfebd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfebd('0x2'));var moment=require('moment');var BPromise=require(_0xfebd('0x3'));var Mustache=require(_0xfebd('0x4'));var util=require(_0xfebd('0x5'));var path=require(_0xfebd('0x6'));var sox=require(_0xfebd('0x7'));var csv=require(_0xfebd('0x8'));var ejs=require(_0xfebd('0x9'));var fs=require('fs');var fs_extra=require(_0xfebd('0xa'));var _=require(_0xfebd('0xb'));var squel=require('squel');var crypto=require(_0xfebd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfebd('0xd'));var toCsv=require(_0xfebd('0x8'));var querystring=require(_0xfebd('0xe'));var Papa=require(_0xfebd('0xf'));var Redis=require('ioredis');var authService=require(_0xfebd('0x10'));var qs=require(_0xfebd('0x11'));var as=require(_0xfebd('0x12'));var hardwareService=require(_0xfebd('0x13'));var logger=require(_0xfebd('0x14'))(_0xfebd('0x15'));var utils=require(_0xfebd('0x16'));var config=require(_0xfebd('0x17'));var licenseUtil=require(_0xfebd('0x18'));var db=require(_0xfebd('0x19'))['db'];config[_0xfebd('0x1a')]=_[_0xfebd('0x1b')](config[_0xfebd('0x1a')],{'host':_0xfebd('0x1c'),'port':0x18eb});var socket=require(_0xfebd('0x1d'))(new Redis(config[_0xfebd('0x1a')]));require(_0xfebd('0x1e'))[_0xfebd('0x1f')](socket);function respondWithStatusCode(_0x530c1e,_0x465308){_0x465308=_0x465308||0xcc;return function(_0x4ca454){if(_0x4ca454){return _0x530c1e['sendStatus'](_0x465308);}return _0x530c1e[_0xfebd('0x20')](_0x465308)[_0xfebd('0x21')]();};}function respondWithResult(_0x1888f2,_0x525e65){_0x525e65=_0x525e65||0xc8;return function(_0x4c77ec){if(_0x4c77ec){return _0x1888f2[_0xfebd('0x20')](_0x525e65)[_0xfebd('0x22')](_0x4c77ec);}};}function respondWithFilteredResult(_0xba6b99,_0x2df59d){return function(_0x3a3ad7){if(_0x3a3ad7){var _0x21c574=typeof _0x2df59d['offset']===_0xfebd('0x23')&&typeof _0x2df59d[_0xfebd('0x24')]==='undefined';var _0x3db831=_0x3a3ad7[_0xfebd('0x25')];var _0x54bbf6=_0x21c574?0x0:_0x2df59d['offset'];var _0x33e05e=_0x21c574?_0x3a3ad7[_0xfebd('0x25')]:_0x2df59d[_0xfebd('0x26')]+_0x2df59d['limit'];var _0x2210dd;if(_0x33e05e>=_0x3db831){_0x33e05e=_0x3db831;_0x2210dd=0xc8;}else{_0x2210dd=0xce;}_0xba6b99['status'](_0x2210dd);return _0xba6b99['set'](_0xfebd('0x27'),_0x54bbf6+'-'+_0x33e05e+'/'+_0x3db831)[_0xfebd('0x22')](_0x3a3ad7);}return null;};}function patchUpdates(_0x2d6d35){return function(_0x1d865c){try{jsonpatch[_0xfebd('0x28')](_0x1d865c,_0x2d6d35,!![]);}catch(_0x3e55a6){return BPromise[_0xfebd('0x29')](_0x3e55a6);}return _0x1d865c[_0xfebd('0x2a')]();};}function saveUpdates(_0x267f04,_0x328c8d){return function(_0x57f51c){if(_0x57f51c){return _0x57f51c[_0xfebd('0x2b')](_0x267f04)[_0xfebd('0x2c')](function(_0x4d92f4){return _0x4d92f4;});}return null;};}function removeEntity(_0x230962,_0x341b21){return function(_0x11a6b2){if(_0x11a6b2){return _0x11a6b2[_0xfebd('0x2d')]()[_0xfebd('0x2c')](function(){_0x230962['status'](0xcc)[_0xfebd('0x21')]();});}};}function handleEntityNotFound(_0x10ba5f,_0x3354ed){return function(_0x4086d9){if(!_0x4086d9){_0x10ba5f['sendStatus'](0x194);}return _0x4086d9;};}function handleError(_0xcf80e2,_0x255afe){_0x255afe=_0x255afe||0x1f4;return function(_0x38ca8e){logger[_0xfebd('0x2e')](_0x38ca8e[_0xfebd('0x2f')]);if(_0x38ca8e[_0xfebd('0x30')]){delete _0x38ca8e[_0xfebd('0x30')];}_0xcf80e2[_0xfebd('0x20')](_0x255afe)['send'](_0x38ca8e);};}exports[_0xfebd('0x31')]=function(_0x20a483,_0x555b1c,_0x32c0d0){if(!_0x20a483[_0xfebd('0x32')]['hasOwnProperty'](_0xfebd('0x33'))&&!_0x20a483[_0xfebd('0x32')][_0xfebd('0x34')]('TemplateId')){throw new db['Sequelize'][(_0xfebd('0x35'))](_0xfebd('0x36'));}else{if(_0x20a483[_0xfebd('0x32')][_0xfebd('0x34')](_0xfebd('0x37'))&&!_0x20a483[_0xfebd('0x32')][_0xfebd('0x34')]('view')){throw new db[(_0xfebd('0x38'))]['ValidationError'](_0xfebd('0x39'));}if(!_0x20a483['body']['hasOwnProperty']('recipients')){throw new db[(_0xfebd('0x38'))]['ValidationError'](_0xfebd('0x3a'));}else{try{var _0x210f75=JSON['parse'](_0x20a483[_0xfebd('0x32')][_0xfebd('0x3b')]);}catch(_0x3c07fd){logger[_0xfebd('0x2e')](_0x3c07fd);throw new db['Sequelize'][(_0xfebd('0x35'))](_0xfebd('0x3c'));}var _0x372174=[_0xfebd('0x3d'),_0xfebd('0x3e'),_0xfebd('0x3f'),'openchannelqueue',_0xfebd('0x40'),_0xfebd('0x41'),_0xfebd('0x42'),'team',_0xfebd('0x43')];if(_['some'](_0x210f75,function(_0x3714fe){return!_['includes'](_0x372174,_0x3714fe['model']['toLowerCase']());})){throw new db[(_0xfebd('0x38'))][(_0xfebd('0x35'))](_0xfebd('0x44'));}}}var _0x27766e={};_0x27766e[_0xfebd('0x45')]=_0x20a483['body'][_0xfebd('0x34')](_0xfebd('0x45'))?_0x20a483['body'][_0xfebd('0x45')]:_0x20a483['user']['fullname'];_0x27766e[_0xfebd('0x46')]=_[_0xfebd('0x47')](_0x20a483[_0xfebd('0x32')]['recipientsDescription'])?null:_0x20a483[_0xfebd('0x32')]['recipientsDescription'];_0x27766e[_0xfebd('0x48')]=_0x20a483[_0xfebd('0x32')][_0xfebd('0x48')]||![];_0x27766e[_0xfebd('0x49')]=_0x20a483[_0xfebd('0x43')]['id'];return getContent(_0x20a483[_0xfebd('0x32')])[_0xfebd('0x2c')](function(_0x411323){_0x27766e[_0xfebd('0x32')]=_0x411323;return getRecipients(_0x210f75);})[_0xfebd('0x2c')](function(_0x5d10f6){_0x27766e[_0xfebd('0x4a')]=_[_0xfebd('0x4b')](_0x5d10f6)['join'](',');return db[_0xfebd('0x4c')][_0xfebd('0x4d')](function(_0x17a58f){return db[_0xfebd('0x4e')][_0xfebd('0x4f')](_0x27766e,{'raw':!![],'transaction':_0x17a58f})['then'](function(_0x275723){var _0x4c109e={'sender':_0x27766e[_0xfebd('0x45')],'description':_0x27766e[_0xfebd('0x46')],'content':_0x27766e[_0xfebd('0x32')],'beep':_0x27766e[_0xfebd('0x48')]};_0x5d10f6[_0xfebd('0x50')](function(_0x4c03b5){_0x4c109e[_0xfebd('0x51')]=_0x4c03b5;socket[_0xfebd('0x52')]('userNotification:send',_0x4c109e);});return _0x275723;});});})['then'](respondWithResult(_0x555b1c,0xc9))[_0xfebd('0x53')](handleError(_0x555b1c,null));};function getContent(_0xdfc326){return new BPromise(function(_0x24c009,_0x421449){if(_0xdfc326[_0xfebd('0x33')]){_0x24c009(_0xdfc326[_0xfebd('0x33')]);return;}return db[_0xfebd('0x54')]['findOne']({'attributes':[_0xfebd('0x55')],'where':{'id':_0xdfc326['TemplateId']},'raw':!![]})[_0xfebd('0x2c')](function(_0x2442f1){if(!_0x2442f1)throw new db[(_0xfebd('0x38'))][(_0xfebd('0x35'))](_0xfebd('0x56'));var _0x18d6cc=Mustache['render'](_0x2442f1[_0xfebd('0x55')],_0xdfc326['view']);_0x24c009(_0x18d6cc);})[_0xfebd('0x53')](function(_0xc0c728){_0x421449(_0xc0c728);});});}function getRecipients(_0x2c21d1){return new BPromise(function(_0x300133,_0x3d7732){var _0x57c35d=[];var _0x13c857=[];_0x2c21d1[_0xfebd('0x50')](function(_0xc5959b){var _0x53207d=_['startCase'](_0xc5959b[_0xfebd('0x57')][_0xfebd('0x58')]());if(_0x53207d==='User'){_0x57c35d=_['union'](_0x57c35d,_0xc5959b[_0xfebd('0x59')]);}else{if(_[_0xfebd('0x5a')](_0x53207d,_0xfebd('0x5b')))_0x53207d=_0x53207d['replace'](_0xfebd('0x5b'),_0xfebd('0x5c'));_0xc5959b[_0xfebd('0x59')][_0xfebd('0x50')](function(_0x4fcd52){_0x13c857['push'](getAgents(_0x53207d,_0x4fcd52));});}});return BPromise[_0xfebd('0x5d')](_0x13c857)['then'](function(_0x4a5928){_0x57c35d=_['union'](_0x57c35d,_[_0xfebd('0x5e')](_0x4a5928));_0x300133(_0x57c35d);})['catch'](function(_0x1976c7){_0x3d7732(_0x1976c7);});});}function getAgents(_0x53f4de,_0xa4867e){return new BPromise(function(_0x138468,_0x53861d){return db[_0x53f4de][_0xfebd('0x5f')]({'where':{'id':_0xa4867e}})['then'](function(_0x26121e){return _0x26121e['getAgents']({'attributes':['id'],'raw':!![]})[_0xfebd('0x2c')](function(_0x4dea99){var _0x24f055=_['map'](_0x4dea99,'id');_0x138468(_0x24f055);});})[_0xfebd('0x53')](function(_0x35ef33){_0x53861d(_0x35ef33);});});} \ No newline at end of file +var _0xf11e=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','sendUserNotification','hasOwnProperty','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','TemplateId','view','ValidationError','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','html','render','User','ids','queue','replace','union','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','querystring'];(function(_0xd9091b,_0x47e256){var _0x1dad34=function(_0x4ca815){while(--_0x4ca815){_0xd9091b['push'](_0xd9091b['shift']());}};_0x1dad34(++_0x47e256);}(_0xf11e,0x17a));var _0xef11=function(_0x480088,_0x27d29b){_0x480088=_0x480088-0x0;var _0x121daf=_0xf11e[_0x480088];return _0x121daf;};'use strict';var emlformat=require(_0xef11('0x0'));var rimraf=require(_0xef11('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef11('0x2'));var rp=require('request-promise');var moment=require(_0xef11('0x3'));var BPromise=require(_0xef11('0x4'));var Mustache=require(_0xef11('0x5'));var util=require(_0xef11('0x6'));var path=require('path');var sox=require(_0xef11('0x7'));var csv=require(_0xef11('0x8'));var ejs=require(_0xef11('0x9'));var fs=require('fs');var fs_extra=require(_0xef11('0xa'));var _=require(_0xef11('0xb'));var squel=require(_0xef11('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xef11('0xd'));var Papa=require(_0xef11('0xe'));var Redis=require(_0xef11('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xef11('0x10'));var as=require(_0xef11('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef11('0x12'))(_0xef11('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xef11('0x14'));var db=require(_0xef11('0x15'))['db'];config[_0xef11('0x16')]=_[_0xef11('0x17')](config[_0xef11('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xef11('0x18'))(new Redis(config[_0xef11('0x16')]));require(_0xef11('0x19'))[_0xef11('0x1a')](socket);function respondWithStatusCode(_0x1fb1fe,_0x5c8cc3){_0x5c8cc3=_0x5c8cc3||0xcc;return function(_0x21ba07){if(_0x21ba07){return _0x1fb1fe[_0xef11('0x1b')](_0x5c8cc3);}return _0x1fb1fe[_0xef11('0x1c')](_0x5c8cc3)['end']();};}function respondWithResult(_0x474c25,_0x16d17b){_0x16d17b=_0x16d17b||0xc8;return function(_0x5f514e){if(_0x5f514e){return _0x474c25[_0xef11('0x1c')](_0x16d17b)[_0xef11('0x1d')](_0x5f514e);}};}function respondWithFilteredResult(_0xc4a815,_0x18da8e){return function(_0x35ead8){if(_0x35ead8){var _0x393b19=typeof _0x18da8e[_0xef11('0x1e')]===_0xef11('0x1f')&&typeof _0x18da8e[_0xef11('0x20')]===_0xef11('0x1f');var _0x17c8c3=_0x35ead8[_0xef11('0x21')];var _0x470da5=_0x393b19?0x0:_0x18da8e[_0xef11('0x1e')];var _0x3effc8=_0x393b19?_0x35ead8['count']:_0x18da8e[_0xef11('0x1e')]+_0x18da8e[_0xef11('0x20')];var _0x12e3e2;if(_0x3effc8>=_0x17c8c3){_0x3effc8=_0x17c8c3;_0x12e3e2=0xc8;}else{_0x12e3e2=0xce;}_0xc4a815[_0xef11('0x1c')](_0x12e3e2);return _0xc4a815[_0xef11('0x22')]('Content-Range',_0x470da5+'-'+_0x3effc8+'/'+_0x17c8c3)[_0xef11('0x1d')](_0x35ead8);}return null;};}function patchUpdates(_0x1a64da){return function(_0x16a35d){try{jsonpatch[_0xef11('0x23')](_0x16a35d,_0x1a64da,!![]);}catch(_0x254612){return BPromise[_0xef11('0x24')](_0x254612);}return _0x16a35d[_0xef11('0x25')]();};}function saveUpdates(_0x2f0857,_0x33d7d7){return function(_0x5495fd){if(_0x5495fd){return _0x5495fd['update'](_0x2f0857)[_0xef11('0x26')](function(_0x16946f){return _0x16946f;});}return null;};}function removeEntity(_0x3f1c52,_0x40db26){return function(_0x1665e0){if(_0x1665e0){return _0x1665e0[_0xef11('0x27')]()[_0xef11('0x26')](function(){_0x3f1c52[_0xef11('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39f7f2,_0x4f2ff6){return function(_0x52293a){if(!_0x52293a){_0x39f7f2[_0xef11('0x1b')](0x194);}return _0x52293a;};}function handleError(_0x4f92fa,_0x54d3ca){_0x54d3ca=_0x54d3ca||0x1f4;return function(_0x1e1f32){logger[_0xef11('0x28')](_0x1e1f32[_0xef11('0x29')]);if(_0x1e1f32[_0xef11('0x2a')]){delete _0x1e1f32['name'];}_0x4f92fa[_0xef11('0x1c')](_0x54d3ca)[_0xef11('0x2b')](_0x1e1f32);};}exports[_0xef11('0x2c')]=function(_0x3631e6,_0x59ad90,_0x3aa691){if(!_0x3631e6['body'][_0xef11('0x2d')]('text')&&!_0x3631e6['body'][_0xef11('0x2d')]('TemplateId')){throw new db[(_0xef11('0x2e'))]['ValidationError'](_0xef11('0x2f'));}else{if(_0x3631e6[_0xef11('0x30')]['hasOwnProperty'](_0xef11('0x31'))&&!_0x3631e6[_0xef11('0x30')][_0xef11('0x2d')](_0xef11('0x32'))){throw new db[(_0xef11('0x2e'))][(_0xef11('0x33'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x3631e6[_0xef11('0x30')][_0xef11('0x2d')](_0xef11('0x34'))){throw new db[(_0xef11('0x2e'))][(_0xef11('0x33'))](_0xef11('0x35'));}else{try{var _0xb76185=JSON[_0xef11('0x36')](_0x3631e6['body'][_0xef11('0x34')]);}catch(_0x52c05e){logger[_0xef11('0x28')](_0x52c05e);throw new db[(_0xef11('0x2e'))]['ValidationError'](_0xef11('0x37'));}var _0x48ae7d=[_0xef11('0x38'),_0xef11('0x39'),_0xef11('0x3a'),'openchannelqueue',_0xef11('0x3b'),_0xef11('0x3c'),_0xef11('0x3d'),'team',_0xef11('0x3e')];if(_[_0xef11('0x3f')](_0xb76185,function(_0x46c039){return!_[_0xef11('0x40')](_0x48ae7d,_0x46c039[_0xef11('0x41')][_0xef11('0x42')]());})){throw new db['Sequelize']['ValidationError'](_0xef11('0x43'));}}}var _0x5d901f={};_0x5d901f['senderName']=_0x3631e6[_0xef11('0x30')][_0xef11('0x2d')](_0xef11('0x44'))?_0x3631e6['body']['senderName']:_0x3631e6['user'][_0xef11('0x45')];_0x5d901f[_0xef11('0x46')]=_[_0xef11('0x47')](_0x3631e6[_0xef11('0x30')]['recipientsDescription'])?null:_0x3631e6[_0xef11('0x30')][_0xef11('0x46')];_0x5d901f[_0xef11('0x48')]=_0x3631e6['body'][_0xef11('0x48')]||![];_0x5d901f[_0xef11('0x49')]=_0x3631e6['user']['id'];return getContent(_0x3631e6[_0xef11('0x30')])[_0xef11('0x26')](function(_0x4048e9){_0x5d901f[_0xef11('0x30')]=_0x4048e9;return getRecipients(_0xb76185);})['then'](function(_0x44aa04){_0x5d901f[_0xef11('0x4a')]=_[_0xef11('0x4b')](_0x44aa04)['join'](',');return db[_0xef11('0x4c')][_0xef11('0x4d')](function(_0x50dc59){return db[_0xef11('0x4e')][_0xef11('0x4f')](_0x5d901f,{'raw':!![],'transaction':_0x50dc59})[_0xef11('0x26')](function(_0xdc0d99){var _0x2c3678={'sender':_0x5d901f[_0xef11('0x44')],'description':_0x5d901f[_0xef11('0x46')],'content':_0x5d901f[_0xef11('0x30')],'beep':_0x5d901f[_0xef11('0x48')]};_0x44aa04[_0xef11('0x50')](function(_0x307b6d){_0x2c3678[_0xef11('0x51')]=_0x307b6d;socket[_0xef11('0x52')](_0xef11('0x53'),_0x2c3678);});return _0xdc0d99;});});})[_0xef11('0x26')](respondWithResult(_0x59ad90,0xc9))[_0xef11('0x54')](handleError(_0x59ad90,null));};function getContent(_0x767b1e){return new BPromise(function(_0x104eba,_0x4499b0){if(_0x767b1e['text']){_0x104eba(_0x767b1e[_0xef11('0x55')]);return;}return db[_0xef11('0x56')][_0xef11('0x57')]({'attributes':[_0xef11('0x58')],'where':{'id':_0x767b1e[_0xef11('0x31')]},'raw':!![]})[_0xef11('0x26')](function(_0x379931){if(!_0x379931)throw new db[(_0xef11('0x2e'))][(_0xef11('0x33'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x1a4f02=Mustache[_0xef11('0x59')](_0x379931[_0xef11('0x58')],_0x767b1e[_0xef11('0x32')]);_0x104eba(_0x1a4f02);})[_0xef11('0x54')](function(_0x138cff){_0x4499b0(_0x138cff);});});}function getRecipients(_0xba315c){return new BPromise(function(_0x3d7102,_0x3715b9){var _0x53c912=[];var _0x3d1967=[];_0xba315c[_0xef11('0x50')](function(_0x546504){var _0x4528c2=_['startCase'](_0x546504['model']['toLowerCase']());if(_0x4528c2===_0xef11('0x5a')){_0x53c912=_['union'](_0x53c912,_0x546504[_0xef11('0x5b')]);}else{if(_[_0xef11('0x40')](_0x4528c2,_0xef11('0x5c')))_0x4528c2=_0x4528c2[_0xef11('0x5d')](_0xef11('0x5c'),'Queue');_0x546504[_0xef11('0x5b')][_0xef11('0x50')](function(_0xb2c9d1){_0x3d1967['push'](getAgents(_0x4528c2,_0xb2c9d1));});}});return BPromise['all'](_0x3d1967)[_0xef11('0x26')](function(_0x1eee98){_0x53c912=_[_0xef11('0x5e')](_0x53c912,_[_0xef11('0x5f')](_0x1eee98));_0x3d7102(_0x53c912);})[_0xef11('0x54')](function(_0x181176){_0x3715b9(_0x181176);});});}function getAgents(_0x193a0f,_0x3929f6){return new BPromise(function(_0x264fa9,_0x1101df){return db[_0x193a0f][_0xef11('0x57')]({'where':{'id':_0x3929f6}})[_0xef11('0x26')](function(_0x514d19){return _0x514d19[_0xef11('0x60')]({'attributes':['id'],'raw':!![]})[_0xef11('0x26')](function(_0x2d94b6){var _0x8e0f8e=_[_0xef11('0x61')](_0x2d94b6,'id');_0x264fa9(_0x8e0f8e);});})[_0xef11('0x54')](function(_0x4ed17a){_0x1101df(_0x4ed17a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index a4ad53b..fd39648 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 _0xf899=['emit','hasOwnProperty','exports','events','../../mysqldb','UserNotification','save','update','remove'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xf899,0x17d));var _0x9f89=function(_0x56ced8,_0x4d2be9){_0x56ced8=_0x56ced8-0x0;var _0x1d15e4=_0xf899[_0x56ced8];return _0x1d15e4;};'use strict';var EventEmitter=require(_0x9f89('0x0'));var UserNotification=require(_0x9f89('0x1'))['db'][_0x9f89('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9f89('0x3'),'afterUpdate':_0x9f89('0x4'),'afterDestroy':_0x9f89('0x5')};function emitEvent(_0x2e5a1b){return function(_0x26125d,_0x136373,_0x2f8ad8){UserNotificationEvents[_0x9f89('0x6')](_0x2e5a1b+':'+_0x26125d['id'],_0x26125d);UserNotificationEvents['emit'](_0x2e5a1b,_0x26125d);_0x2f8ad8(null);};}for(var e in events){if(events[_0x9f89('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x9f89('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xe98d=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2995b8,_0x28b471){var _0x348063=function(_0x7e16e0){while(--_0x7e16e0){_0x2995b8['push'](_0x2995b8['shift']());}};_0x348063(++_0x28b471);}(_0xe98d,0x1df));var _0xde98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe98d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xde98('0x0'));var UserNotification=require(_0xde98('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xde98('0x2')](0x0);var events={'afterCreate':_0xde98('0x3'),'afterUpdate':_0xde98('0x4'),'afterDestroy':_0xde98('0x5')};function emitEvent(_0x23bea){return function(_0x40045a,_0xab9c5d,_0x10840e){UserNotificationEvents[_0xde98('0x6')](_0x23bea+':'+_0x40045a['id'],_0x40045a);UserNotificationEvents[_0xde98('0x6')](_0x23bea,_0x40045a);_0x10840e(null);};}for(var e in events){if(events[_0xde98('0x7')](e)){var event=events[e];UserNotification[_0xde98('0x8')](e,emitEvent(event));}}module[_0xde98('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 6096299..5ddbf20 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 _0x9a36=['userNotifications','utf8mb4','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification'];(function(_0x2f49fc,_0x5473bf){var _0x446c59=function(_0x406d32){while(--_0x406d32){_0x2f49fc['push'](_0x2f49fc['shift']());}};_0x446c59(++_0x5473bf);}(_0x9a36,0xc2));var _0x69a3=function(_0xf66b9a,_0x1447b1){_0xf66b9a=_0xf66b9a-0x0;var _0x26a46f=_0x9a36[_0xf66b9a];return _0x26a46f;};'use strict';var _=require(_0x69a3('0x0'));var util=require(_0x69a3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x69a3('0x2'));var BPromise=require('bluebird');var rp=require(_0x69a3('0x3'));var fs=require('fs');var path=require(_0x69a3('0x4'));var rimraf=require(_0x69a3('0x5'));var config=require(_0x69a3('0x6'));var attributes=require(_0x69a3('0x7'));module[_0x69a3('0x8')]=function(_0x5415d6,_0x1aa7f8){return _0x5415d6['define'](_0x69a3('0x9'),attributes,{'tableName':_0x69a3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x69a3('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9323=['../../config/environment','./userNotification.attributes','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','rimraf'];(function(_0x2b18af,_0x3cef17){var _0x190e2f=function(_0x298f91){while(--_0x298f91){_0x2b18af['push'](_0x2b18af['shift']());}};_0x190e2f(++_0x3cef17);}(_0x9323,0x1d4));var _0x3932=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9323[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x3932('0x0'));var logger=require(_0x3932('0x1'))(_0x3932('0x2'));var moment=require('moment');var BPromise=require(_0x3932('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3932('0x4'));var config=require(_0x3932('0x5'));var attributes=require(_0x3932('0x6'));module['exports']=function(_0x44d0a2,_0x5013d3){return _0x44d0a2['define'](_0x3932('0x7'),attributes,{'tableName':_0x3932('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3932('0x9'),'collate':_0x3932('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 7d7dfcb..3af3de4 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 _0x8ff1=['request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0x8ff1,0x173));var _0x18ff=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x8ff1[_0x38537f];return _0x141e23;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x18ff('0x0'));var BPromise=require(_0x18ff('0x1'));var rs=require(_0x18ff('0x2'));var fs=require('fs');var Redis=require(_0x18ff('0x3'));var db=require(_0x18ff('0x4'))['db'];var utils=require(_0x18ff('0x5'));var logger=require(_0x18ff('0x6'))(_0x18ff('0x7'));var config=require(_0x18ff('0x8'));var jayson=require(_0x18ff('0x9'));var client=jayson['client'][_0x18ff('0xa')]({'port':0x232a});config[_0x18ff('0xb')]=_[_0x18ff('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x18ff('0xd'))(new Redis(config[_0x18ff('0xb')]));require(_0x18ff('0xe'))['register'](socket);function respondWithRpcPromise(_0x5c2394,_0x1a5704,_0x221df7){return new BPromise(function(_0x3ac6e2,_0x390abf){return client[_0x18ff('0xf')](_0x5c2394,_0x221df7)[_0x18ff('0x10')](function(_0x18e262){logger[_0x18ff('0x11')](_0x18ff('0x12'),_0x1a5704,_0x18ff('0x13'));logger[_0x18ff('0x14')](_0x18ff('0x15'),_0x1a5704,'request\x20sent',JSON['stringify'](_0x18e262));if(_0x18e262[_0x18ff('0x16')]){if(_0x18e262['error'][_0x18ff('0x17')]===0x1f4){logger[_0x18ff('0x16')]('UserNotification,\x20%s,\x20%s',_0x1a5704,_0x18e262[_0x18ff('0x16')][_0x18ff('0x18')]);return _0x390abf(_0x18e262[_0x18ff('0x16')][_0x18ff('0x18')]);}logger[_0x18ff('0x16')](_0x18ff('0x12'),_0x1a5704,_0x18e262[_0x18ff('0x16')][_0x18ff('0x18')]);return _0x3ac6e2(_0x18e262['error']['message']);}else{logger[_0x18ff('0x11')](_0x18ff('0x12'),_0x1a5704,'request\x20sent');_0x3ac6e2(_0x18e262[_0x18ff('0x19')][_0x18ff('0x18')]);}})['catch'](function(_0x1d8fcd){logger[_0x18ff('0x16')](_0x18ff('0x12'),_0x1a5704,_0x1d8fcd);_0x390abf(_0x1d8fcd);});});} \ No newline at end of file +var _0x369d=['client','http','redis','localhost','socket.io-emitter','./userNotification.socket','request','info','UserNotification,\x20%s,\x20%s','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b3644,_0x2d8dee){var _0x5c7f32=function(_0x5d6a0a){while(--_0x5d6a0a){_0x1b3644['push'](_0x1b3644['shift']());}};_0x5c7f32(++_0x2d8dee);}(_0x369d,0x6e));var _0xd369=function(_0x12d718,_0x47343c){_0x12d718=_0x12d718-0x0;var _0x500629=_0x369d[_0x12d718];return _0x500629;};'use strict';var _=require(_0xd369('0x0'));var util=require('util');var moment=require(_0xd369('0x1'));var BPromise=require('bluebird');var rs=require(_0xd369('0x2'));var fs=require('fs');var Redis=require(_0xd369('0x3'));var db=require(_0xd369('0x4'))['db'];var utils=require(_0xd369('0x5'));var logger=require(_0xd369('0x6'))(_0xd369('0x7'));var config=require(_0xd369('0x8'));var jayson=require(_0xd369('0x9'));var client=jayson[_0xd369('0xa')][_0xd369('0xb')]({'port':0x232a});config[_0xd369('0xc')]=_['defaults'](config[_0xd369('0xc')],{'host':_0xd369('0xd'),'port':0x18eb});var socket=require(_0xd369('0xe'))(new Redis(config[_0xd369('0xc')]));require(_0xd369('0xf'))['register'](socket);function respondWithRpcPromise(_0x5d9540,_0x289b72,_0x494824){return new BPromise(function(_0x4d8ffc,_0x2f246a){return client[_0xd369('0x10')](_0x5d9540,_0x494824)['then'](function(_0x4c2c2d){logger[_0xd369('0x11')](_0xd369('0x12'),_0x289b72,'request\x20sent');logger['debug'](_0xd369('0x13'),_0x289b72,'request\x20sent',JSON['stringify'](_0x4c2c2d));if(_0x4c2c2d[_0xd369('0x14')]){if(_0x4c2c2d[_0xd369('0x14')][_0xd369('0x15')]===0x1f4){logger[_0xd369('0x14')]('UserNotification,\x20%s,\x20%s',_0x289b72,_0x4c2c2d[_0xd369('0x14')]['message']);return _0x2f246a(_0x4c2c2d[_0xd369('0x14')]['message']);}logger['error'](_0xd369('0x12'),_0x289b72,_0x4c2c2d['error']['message']);return _0x4d8ffc(_0x4c2c2d['error'][_0xd369('0x16')]);}else{logger[_0xd369('0x11')](_0xd369('0x12'),_0x289b72,'request\x20sent');_0x4d8ffc(_0x4c2c2d[_0xd369('0x17')]['message']);}})['catch'](function(_0x3a413d){logger[_0xd369('0x14')](_0xd369('0x12'),_0x289b72,_0x3a413d);_0x2f246a(_0x3a413d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 3e65daa..3286e84 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 _0xe65d=['length','userNotification:','./userNotification.events','save','remove','update','removeListener','register'];(function(_0x337aa9,_0x1578d0){var _0x5bb68a=function(_0x4c1eaa){while(--_0x4c1eaa){_0x337aa9['push'](_0x337aa9['shift']());}};_0x5bb68a(++_0x1578d0);}(_0xe65d,0xda));var _0xde65=function(_0x49986c,_0x300ed5){_0x49986c=_0x49986c-0x0;var _0x173341=_0xe65d[_0x49986c];return _0x173341;};'use strict';var UserNotificationEvents=require(_0xde65('0x0'));var events=[_0xde65('0x1'),_0xde65('0x2'),_0xde65('0x3')];function createListener(_0x15ba4b,_0x1e65a4){return function(_0x151d95){_0x1e65a4['emit'](_0x15ba4b,_0x151d95);};}function removeListener(_0x412675,_0x31283a){return function(){UserNotificationEvents[_0xde65('0x4')](_0x412675,_0x31283a);};}exports[_0xde65('0x5')]=function(_0x449129){for(var _0x592716=0x0,_0x41400a=events[_0xde65('0x6')];_0x592716<_0x41400a;_0x592716++){var _0x5e942c=events[_0x592716];var _0x359bb4=createListener(_0xde65('0x7')+_0x5e942c,_0x449129);UserNotificationEvents['on'](_0x5e942c,_0x359bb4);}}; \ No newline at end of file +var _0x6624=['emit','register','userNotification:','./userNotification.events','save','remove','update'];(function(_0xd630f9,_0x2238e8){var _0x55a634=function(_0x12e8b1){while(--_0x12e8b1){_0xd630f9['push'](_0xd630f9['shift']());}};_0x55a634(++_0x2238e8);}(_0x6624,0x1ca));var _0x4662=function(_0x4ec71d,_0x12ff51){_0x4ec71d=_0x4ec71d-0x0;var _0x26c495=_0x6624[_0x4ec71d];return _0x26c495;};'use strict';var UserNotificationEvents=require(_0x4662('0x0'));var events=[_0x4662('0x1'),_0x4662('0x2'),_0x4662('0x3')];function createListener(_0x2c886f,_0x4c5509){return function(_0x176d96){_0x4c5509[_0x4662('0x4')](_0x2c886f,_0x176d96);};}function removeListener(_0x2dde3c,_0x4ac29e){return function(){UserNotificationEvents['removeListener'](_0x2dde3c,_0x4ac29e);};}exports[_0x4662('0x5')]=function(_0x3fb07f){for(var _0x28c47c=0x0,_0x4922df=events['length'];_0x28c47c<_0x4922df;_0x28c47c++){var _0x1c0d9e=events[_0x28c47c];var _0x1d90bd=createListener(_0x4662('0x6')+_0x1c0d9e,_0x3fb07f);UserNotificationEvents['on'](_0x1c0d9e,_0x1d90bd);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 1c5b7f6..ac812a1 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5791db,_0x49bba5){var _0x496e92=function(_0x252159){while(--_0x252159){_0x5791db['push'](_0x5791db['shift']());}};_0x496e92(++_0x49bba5);}(_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(_0xb6087f,_0x2292d4){var _0x22df6d=function(_0x1e2afa){while(--_0x1e2afa){_0xb6087f['push'](_0xb6087f['shift']());}};_0x22df6d(++_0x2292d4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0xcb91[_0x144b30];return _0x1bb7bc;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index d9fa66a..ee6bc41 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 _0xedb6=['exports','INTEGER','sequelize'];(function(_0x2c8f6c,_0x3bb8d7){var _0x24c438=function(_0xb5b2e){while(--_0xb5b2e){_0x2c8f6c['push'](_0x2c8f6c['shift']());}};_0x24c438(++_0x3bb8d7);}(_0xedb6,0x14c));var _0x6edb=function(_0x430f44,_0x4ae21b){_0x430f44=_0x430f44-0x0;var _0x1f6b0f=_0xedb6[_0x430f44];return _0x1f6b0f;};'use strict';var Sequelize=require(_0x6edb('0x0'));module[_0x6edb('0x1')]={'penalty':{'type':Sequelize[_0x6edb('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf23b=['exports','INTEGER'];(function(_0x4f0f6d,_0x28b6f4){var _0x2b2c98=function(_0x433703){while(--_0x433703){_0x4f0f6d['push'](_0x4f0f6d['shift']());}};_0x2b2c98(++_0x28b6f4);}(_0xf23b,0x1d6));var _0xbf23=function(_0x272f2b,_0x47b6e9){_0x272f2b=_0x272f2b-0x0;var _0xe7800a=_0xf23b[_0x272f2b];return _0xe7800a;};'use strict';var Sequelize=require('sequelize');module[_0xbf23('0x0')]={'penalty':{'type':Sequelize[_0xbf23('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 6353667..31d1ee8 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 _0xd7e8=['define','UserOpenchannelQueue','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports'];(function(_0x466af7,_0x2f7551){var _0x348c96=function(_0x2d7477){while(--_0x2d7477){_0x466af7['push'](_0x466af7['shift']());}};_0x348c96(++_0x2f7551);}(_0xd7e8,0x147));var _0x8d7e=function(_0x544563,_0x586325){_0x544563=_0x544563-0x0;var _0x17803b=_0xd7e8[_0x544563];return _0x17803b;};'use strict';var _=require(_0x8d7e('0x0'));var util=require(_0x8d7e('0x1'));var logger=require(_0x8d7e('0x2'))(_0x8d7e('0x3'));var moment=require(_0x8d7e('0x4'));var BPromise=require('bluebird');var rp=require(_0x8d7e('0x5'));var fs=require('fs');var path=require(_0x8d7e('0x6'));var rimraf=require(_0x8d7e('0x7'));var config=require(_0x8d7e('0x8'));var attributes=require(_0x8d7e('0x9'));module[_0x8d7e('0xa')]=function(_0x43f6fe,_0x40120c){return _0x43f6fe[_0x8d7e('0xb')](_0x8d7e('0xc'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa96c=['./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xa96c,0x10c));var _0xca96=function(_0x4f4cae,_0x41a38f){_0x4f4cae=_0x4f4cae-0x0;var _0x2b350d=_0xa96c[_0x4f4cae];return _0x2b350d;};'use strict';var _=require(_0xca96('0x0'));var util=require('util');var logger=require(_0xca96('0x1'))(_0xca96('0x2'));var moment=require(_0xca96('0x3'));var BPromise=require(_0xca96('0x4'));var rp=require(_0xca96('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xca96('0x6'));var attributes=require(_0xca96('0x7'));module['exports']=function(_0x107c6c,_0x11a6bb){return _0x107c6c[_0xca96('0x8')](_0xca96('0x9'),attributes,{'tableName':_0xca96('0xa'),'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 8de0d50..ae75361 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 _0xcaef=['error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4f1627,_0x1c2a80){var _0x18b258=function(_0x5e10ee){while(--_0x5e10ee){_0x4f1627['push'](_0x4f1627['shift']());}};_0x18b258(++_0x1c2a80);}(_0xcaef,0x99));var _0xfcae=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xcaef[_0x381589];return _0x2a075d;};'use strict';var _=require('lodash');var util=require(_0xfcae('0x0'));var moment=require('moment');var BPromise=require(_0xfcae('0x1'));var rs=require(_0xfcae('0x2'));var fs=require('fs');var Redis=require(_0xfcae('0x3'));var db=require(_0xfcae('0x4'))['db'];var utils=require(_0xfcae('0x5'));var logger=require(_0xfcae('0x6'))(_0xfcae('0x7'));var config=require(_0xfcae('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x459451,_0x1a53e2,_0x659530){return new BPromise(function(_0x8b0810,_0x19ef1b){return client[_0xfcae('0x9')](_0x459451,_0x659530)[_0xfcae('0xa')](function(_0x58aaff){logger['info'](_0xfcae('0xb'),_0x1a53e2,_0xfcae('0xc'));logger[_0xfcae('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1a53e2,'request\x20sent',JSON[_0xfcae('0xe')](_0x58aaff));if(_0x58aaff[_0xfcae('0xf')]){if(_0x58aaff[_0xfcae('0xf')][_0xfcae('0x10')]===0x1f4){logger[_0xfcae('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1a53e2,_0x58aaff[_0xfcae('0xf')]['message']);return _0x19ef1b(_0x58aaff['error'][_0xfcae('0x11')]);}logger[_0xfcae('0xf')](_0xfcae('0xb'),_0x1a53e2,_0x58aaff[_0xfcae('0xf')][_0xfcae('0x11')]);return _0x8b0810(_0x58aaff['error'][_0xfcae('0x11')]);}else{logger[_0xfcae('0x12')](_0xfcae('0xb'),_0x1a53e2,_0xfcae('0xc'));_0x8b0810(_0x58aaff[_0xfcae('0x13')][_0xfcae('0x11')]);}})[_0xfcae('0x14')](function(_0x5a0a8f){logger[_0xfcae('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1a53e2,_0x5a0a8f);_0x19ef1b(_0x5a0a8f);});});} \ No newline at end of file +var _0xb5ee=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x22b449,_0x4de0f3){var _0xbfd2b7=function(_0xd70db4){while(--_0xd70db4){_0x22b449['push'](_0x22b449['shift']());}};_0xbfd2b7(++_0x4de0f3);}(_0xb5ee,0x16c));var _0xeb5e=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0xb5ee[_0x24f326];return _0x488e2d;};'use strict';var _=require(_0xeb5e('0x0'));var util=require(_0xeb5e('0x1'));var moment=require(_0xeb5e('0x2'));var BPromise=require(_0xeb5e('0x3'));var rs=require(_0xeb5e('0x4'));var fs=require('fs');var Redis=require(_0xeb5e('0x5'));var db=require(_0xeb5e('0x6'))['db'];var utils=require(_0xeb5e('0x7'));var logger=require('../../config/logger')(_0xeb5e('0x8'));var config=require('../../config/environment');var jayson=require(_0xeb5e('0x9'));var client=jayson[_0xeb5e('0xa')][_0xeb5e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34537c,_0x85df80,_0x12eeba){return new BPromise(function(_0xec2cee,_0xe26dfd){return client[_0xeb5e('0xc')](_0x34537c,_0x12eeba)[_0xeb5e('0xd')](function(_0x1b185a){logger[_0xeb5e('0xe')](_0xeb5e('0xf'),_0x85df80,_0xeb5e('0x10'));logger[_0xeb5e('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x85df80,'request\x20sent',JSON[_0xeb5e('0x12')](_0x1b185a));if(_0x1b185a[_0xeb5e('0x13')]){if(_0x1b185a[_0xeb5e('0x13')]['code']===0x1f4){logger[_0xeb5e('0x13')](_0xeb5e('0xf'),_0x85df80,_0x1b185a[_0xeb5e('0x13')][_0xeb5e('0x14')]);return _0xe26dfd(_0x1b185a[_0xeb5e('0x13')]['message']);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x85df80,_0x1b185a[_0xeb5e('0x13')][_0xeb5e('0x14')]);return _0xec2cee(_0x1b185a[_0xeb5e('0x13')][_0xeb5e('0x14')]);}else{logger[_0xeb5e('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x85df80,'request\x20sent');_0xec2cee(_0x1b185a[_0xeb5e('0x15')][_0xeb5e('0x14')]);}})[_0xeb5e('0x16')](function(_0x148d21){logger[_0xeb5e('0x13')](_0xeb5e('0xf'),_0x85df80,_0x148d21);_0xe26dfd(_0x148d21);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index bca35e6..280a4a1 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 _0x92bb=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','isAuthenticated','get','describe','/:id','show','/:id/sections','getSections','/:id/resources','post','create','clone','addSections','addResources','put','update','delete','destroy','removeResources','multer','util','path'];(function(_0x2a8cce,_0x4981f0){var _0x5ef53d=function(_0x4d3310){while(--_0x4d3310){_0x2a8cce['push'](_0x2a8cce['shift']());}};_0x5ef53d(++_0x4981f0);}(_0x92bb,0x1bd));var _0xb92b=function(_0x3d27a,_0x31311d){_0x3d27a=_0x3d27a-0x0;var _0x314fd7=_0x92bb[_0x3d27a];return _0x314fd7;};'use strict';var multer=require(_0xb92b('0x0'));var util=require(_0xb92b('0x1'));var path=require(_0xb92b('0x2'));var timeout=require(_0xb92b('0x3'));var express=require(_0xb92b('0x4'));var router=express[_0xb92b('0x5')]();var fs_extra=require(_0xb92b('0x6'));var auth=require(_0xb92b('0x7'));var interaction=require(_0xb92b('0x8'));var config=require('../../config/environment');var controller=require(_0xb92b('0x9'));router['get']('/',auth[_0xb92b('0xa')](),controller['index']);router[_0xb92b('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xb92b('0xc')]);router[_0xb92b('0xb')](_0xb92b('0xd'),auth[_0xb92b('0xa')](),controller[_0xb92b('0xe')]);router[_0xb92b('0xb')](_0xb92b('0xf'),auth[_0xb92b('0xa')](),controller[_0xb92b('0x10')]);router[_0xb92b('0xb')](_0xb92b('0x11'),auth[_0xb92b('0xa')](),controller['getResources']);router[_0xb92b('0x12')]('/',auth[_0xb92b('0xa')](),controller[_0xb92b('0x13')]);router[_0xb92b('0x12')]('/:id/clone',auth['isAuthenticated'](),controller[_0xb92b('0x14')]);router[_0xb92b('0x12')](_0xb92b('0xf'),auth['isAuthenticated'](),controller[_0xb92b('0x15')]);router[_0xb92b('0x12')](_0xb92b('0x11'),auth[_0xb92b('0xa')](),controller[_0xb92b('0x16')]);router[_0xb92b('0x17')](_0xb92b('0xd'),auth['isAuthenticated'](),controller[_0xb92b('0x18')]);router[_0xb92b('0x19')](_0xb92b('0xd'),auth[_0xb92b('0xa')](),controller[_0xb92b('0x1a')]);router[_0xb92b('0x19')](_0xb92b('0xf'),auth[_0xb92b('0xa')](),controller['removeSections']);router[_0xb92b('0x19')](_0xb92b('0x11'),auth[_0xb92b('0xa')](),controller[_0xb92b('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x4b18=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','/:id/sections','addSections','put','delete','destroy','removeSections','removeResources','exports'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x4b18,0x134));var _0x84b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b18[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x84b1('0x0'));var util=require(_0x84b1('0x1'));var path=require(_0x84b1('0x2'));var timeout=require(_0x84b1('0x3'));var express=require(_0x84b1('0x4'));var router=express[_0x84b1('0x5')]();var fs_extra=require(_0x84b1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x84b1('0x7'));var config=require(_0x84b1('0x8'));var controller=require('./userProfile.controller');router[_0x84b1('0x9')]('/',auth[_0x84b1('0xa')](),controller['index']);router[_0x84b1('0x9')](_0x84b1('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x84b1('0x9')](_0x84b1('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x84b1('0x9')]('/:id/sections',auth['isAuthenticated'](),controller[_0x84b1('0xd')]);router['get'](_0x84b1('0xe'),auth['isAuthenticated'](),controller[_0x84b1('0xf')]);router[_0x84b1('0x10')]('/',auth['isAuthenticated'](),controller[_0x84b1('0x11')]);router['post'](_0x84b1('0x12'),auth[_0x84b1('0xa')](),controller[_0x84b1('0x13')]);router[_0x84b1('0x10')](_0x84b1('0x14'),auth[_0x84b1('0xa')](),controller[_0x84b1('0x15')]);router[_0x84b1('0x10')]('/:id/resources',auth[_0x84b1('0xa')](),controller['addResources']);router[_0x84b1('0x16')]('/:id',auth[_0x84b1('0xa')](),controller['update']);router[_0x84b1('0x17')]('/:id',auth[_0x84b1('0xa')](),controller[_0x84b1('0x18')]);router[_0x84b1('0x17')]('/:id/sections',auth['isAuthenticated'](),controller[_0x84b1('0x19')]);router[_0x84b1('0x17')]('/:id/resources',auth[_0x84b1('0xa')](),controller[_0x84b1('0x1a')]);module[_0x84b1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 2d6f3e0..16c5652 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 _0x94b5=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x561c4d,_0x2d42f6){var _0x180342=function(_0x25b361){while(--_0x25b361){_0x561c4d['push'](_0x561c4d['shift']());}};_0x180342(++_0x2d42f6);}(_0x94b5,0x191));var _0x594b=function(_0x3b180d,_0x2aa709){_0x3b180d=_0x3b180d-0x0;var _0x4ff63d=_0x94b5[_0x3b180d];return _0x4ff63d;};'use strict';var Sequelize=require(_0x594b('0x0'));module[_0x594b('0x1')]={'name':{'type':Sequelize[_0x594b('0x2')],'allowNull':![],'unique':_0x594b('0x3')},'crudPermissions':{'type':Sequelize[_0x594b('0x2')],'set':function(_0x3d900f){this[_0x594b('0x4')](_0x594b('0x5'),_0x3d900f?_0x3d900f[_0x594b('0x6')](''):[]);},'get':function(){return this[_0x594b('0x7')]('crudPermissions')?this['getDataValue'](_0x594b('0x5'))[_0x594b('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x594b('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x594b('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x594b('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x594b('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x594b('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7f7e=['setDataValue','crudPermissions','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x43c4d8,_0x591b75){var _0x269822=function(_0x495b7a){while(--_0x495b7a){_0x43c4d8['push'](_0x43c4d8['shift']());}};_0x269822(++_0x591b75);}(_0x7f7e,0x1a3));var _0xe7f7=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7f7e[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0xe7f7('0x0'));module[_0xe7f7('0x1')]={'name':{'type':Sequelize[_0xe7f7('0x2')],'allowNull':![],'unique':_0xe7f7('0x3')},'crudPermissions':{'type':Sequelize[_0xe7f7('0x2')],'set':function(_0x2d839b){this[_0xe7f7('0x4')](_0xe7f7('0x5'),_0x2d839b?_0x2d839b['join'](''):[]);},'get':function(){return this[_0xe7f7('0x6')]('crudPermissions')?this[_0xe7f7('0x6')]('crudPermissions')[_0xe7f7('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xe7f7('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xe7f7('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xe7f7('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xe7f7('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xe7f7('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe7f7('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xe7f7('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe7f7('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 8476c9e..95f8c90 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 _0xd4a2=['find','create','clone','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','destroy','describe','addSections','UserProfileResource','push','removeSections','ids','includes','subsections','enabled','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','then','stack','name','send','index','map','UserProfile','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','options'];(function(_0x52155c,_0x4de9e1){var _0x55edd4=function(_0x13dc05){while(--_0x13dc05){_0x52155c['push'](_0x52155c['shift']());}};_0x55edd4(++_0x4de9e1);}(_0xd4a2,0x173));var _0x2d4a=function(_0x2d1cd2,_0x1b2c82){_0x2d1cd2=_0x2d1cd2-0x0;var _0x14c7f0=_0xd4a2[_0x2d1cd2];return _0x14c7f0;};'use strict';var emlformat=require(_0x2d4a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d4a('0x1'));var rp=require('request-promise');var moment=require(_0x2d4a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2d4a('0x3'));var util=require('util');var path=require(_0x2d4a('0x4'));var sox=require(_0x2d4a('0x5'));var csv=require(_0x2d4a('0x6'));var ejs=require(_0x2d4a('0x7'));var fs=require('fs');var fs_extra=require(_0x2d4a('0x8'));var _=require('lodash');var squel=require(_0x2d4a('0x9'));var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0x6'));var querystring=require(_0x2d4a('0xd'));var Papa=require(_0x2d4a('0xe'));var Redis=require(_0x2d4a('0xf'));var authService=require(_0x2d4a('0x10'));var qs=require(_0x2d4a('0x11'));var as=require(_0x2d4a('0x12'));var hardwareService=require(_0x2d4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x15'));var db=require(_0x2d4a('0x16'))['db'];config[_0x2d4a('0x17')]=_[_0x2d4a('0x18')](config[_0x2d4a('0x17')],{'host':_0x2d4a('0x19'),'port':0x18eb});var socket=require(_0x2d4a('0x1a'))(new Redis(config[_0x2d4a('0x17')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x2a1d0f,_0x5b6c4f){_0x5b6c4f=_0x5b6c4f||0xcc;return function(_0x11c64a){if(_0x11c64a){return _0x2a1d0f[_0x2d4a('0x1b')](_0x5b6c4f);}return _0x2a1d0f[_0x2d4a('0x1c')](_0x5b6c4f)[_0x2d4a('0x1d')]();};}function respondWithResult(_0x4c5287,_0x5f825d){_0x5f825d=_0x5f825d||0xc8;return function(_0x5a6378){if(_0x5a6378){return _0x4c5287[_0x2d4a('0x1c')](_0x5f825d)['json'](_0x5a6378);}};}function respondWithFilteredResult(_0x435687,_0xd1dd52){return function(_0x2188b2){if(_0x2188b2){var _0x388371=typeof _0xd1dd52['offset']==='undefined'&&typeof _0xd1dd52['limit']===_0x2d4a('0x1e');var _0x1966d1=_0x2188b2[_0x2d4a('0x1f')];var _0x419df5=_0x388371?0x0:_0xd1dd52[_0x2d4a('0x20')];var _0x2e4069=_0x388371?_0x2188b2['count']:_0xd1dd52['offset']+_0xd1dd52[_0x2d4a('0x21')];var _0x1f3e17;if(_0x2e4069>=_0x1966d1){_0x2e4069=_0x1966d1;_0x1f3e17=0xc8;}else{_0x1f3e17=0xce;}_0x435687[_0x2d4a('0x1c')](_0x1f3e17);return _0x435687[_0x2d4a('0x22')](_0x2d4a('0x23'),_0x419df5+'-'+_0x2e4069+'/'+_0x1966d1)[_0x2d4a('0x24')](_0x2188b2);}return null;};}function patchUpdates(_0x22dd0b){return function(_0xa43fb1){try{jsonpatch['apply'](_0xa43fb1,_0x22dd0b,!![]);}catch(_0x26e7b8){return BPromise[_0x2d4a('0x25')](_0x26e7b8);}return _0xa43fb1[_0x2d4a('0x26')]();};}function saveUpdates(_0x42d813,_0x2c845c){return function(_0xed2822){if(_0xed2822){return _0xed2822[_0x2d4a('0x27')](_0x42d813)[_0x2d4a('0x28')](function(_0x54c910){return _0x54c910;});}return null;};}function removeEntity(_0x544b9b,_0x5cc7d8){return function(_0x2bb9f0){if(_0x2bb9f0){return _0x2bb9f0['destroy']()[_0x2d4a('0x28')](function(){_0x544b9b[_0x2d4a('0x1c')](0xcc)[_0x2d4a('0x1d')]();});}};}function handleEntityNotFound(_0x1d2fa6,_0x13e769){return function(_0x326c38){if(!_0x326c38){_0x1d2fa6[_0x2d4a('0x1b')](0x194);}return _0x326c38;};}function handleError(_0x27b358,_0x4f1fc8){_0x4f1fc8=_0x4f1fc8||0x1f4;return function(_0x436f53){logger['error'](_0x436f53[_0x2d4a('0x29')]);if(_0x436f53[_0x2d4a('0x2a')]){delete _0x436f53[_0x2d4a('0x2a')];}_0x27b358[_0x2d4a('0x1c')](_0x4f1fc8)[_0x2d4a('0x2b')](_0x436f53);};}exports[_0x2d4a('0x2c')]=function(_0x25ac5c,_0x2e8063){var _0x51b447={},_0x45a4fa={},_0x3d94b7={'count':0x0,'rows':[]};var _0xda1ef2=_[_0x2d4a('0x2d')](db[_0x2d4a('0x2e')]['rawAttributes'],function(_0x217653){return{'name':_0x217653[_0x2d4a('0x2f')],'type':_0x217653[_0x2d4a('0x30')][_0x2d4a('0x31')]};});_0x45a4fa[_0x2d4a('0x32')]=_['map'](_0xda1ef2,_0x2d4a('0x2a'));_0x45a4fa[_0x2d4a('0x33')]=_[_0x2d4a('0x34')](_0x25ac5c[_0x2d4a('0x33')]);_0x45a4fa[_0x2d4a('0x35')]=_[_0x2d4a('0x36')](_0x45a4fa['model'],_0x45a4fa[_0x2d4a('0x33')]);_0x51b447[_0x2d4a('0x37')]=_[_0x2d4a('0x36')](_0x45a4fa[_0x2d4a('0x32')],qs[_0x2d4a('0x38')](_0x25ac5c['query'][_0x2d4a('0x38')]));_0x51b447[_0x2d4a('0x37')]=_0x51b447['attributes'][_0x2d4a('0x39')]?_0x51b447[_0x2d4a('0x37')]:_0x45a4fa[_0x2d4a('0x32')];if(!_0x25ac5c[_0x2d4a('0x33')][_0x2d4a('0x3a')](_0x2d4a('0x3b'))){_0x51b447['limit']=qs[_0x2d4a('0x21')](_0x25ac5c[_0x2d4a('0x33')][_0x2d4a('0x21')]);_0x51b447[_0x2d4a('0x20')]=qs[_0x2d4a('0x20')](_0x25ac5c[_0x2d4a('0x33')]['offset']);}_0x51b447['order']=qs[_0x2d4a('0x3c')](_0x25ac5c['query'][_0x2d4a('0x3c')]);_0x51b447[_0x2d4a('0x3d')]=qs['filters'](_[_0x2d4a('0x3e')](_0x25ac5c[_0x2d4a('0x33')],_0x45a4fa[_0x2d4a('0x35')]),_0xda1ef2);if(_0x25ac5c[_0x2d4a('0x33')][_0x2d4a('0x3f')]){_0x51b447[_0x2d4a('0x3d')]=_[_0x2d4a('0x40')](_0x51b447[_0x2d4a('0x3d')],{'$or':_[_0x2d4a('0x2d')](_0xda1ef2,function(_0x2d64b0){if(_0x2d64b0[_0x2d4a('0x30')]!=='VIRTUAL'){var _0x8bc995={};_0x8bc995[_0x2d64b0[_0x2d4a('0x2a')]]={'$like':'%'+_0x25ac5c[_0x2d4a('0x33')][_0x2d4a('0x3f')]+'%'};return _0x8bc995;}})});}_0x51b447=_[_0x2d4a('0x40')]({},_0x51b447,_0x25ac5c['options']);var _0x50dbc3={'where':_0x51b447['where']};return db['UserProfile'][_0x2d4a('0x1f')](_0x50dbc3)[_0x2d4a('0x28')](function(_0xf39020){_0x3d94b7[_0x2d4a('0x1f')]=_0xf39020;if(_0x25ac5c['query'][_0x2d4a('0x41')]){_0x51b447[_0x2d4a('0x42')]=[{'all':!![]}];}return db['UserProfile'][_0x2d4a('0x43')](_0x51b447);})[_0x2d4a('0x28')](function(_0x8a9375){_0x3d94b7[_0x2d4a('0x44')]=_0x8a9375;return _0x3d94b7;})[_0x2d4a('0x28')](respondWithFilteredResult(_0x2e8063,_0x51b447))[_0x2d4a('0x45')](handleError(_0x2e8063,null));};exports['show']=function(_0x236fbf,_0x2d6eca){var _0x12c899={'raw':![],'where':{'id':_0x236fbf[_0x2d4a('0x46')]['id']}},_0x365399={};_0x365399[_0x2d4a('0x32')]=_['keys'](db[_0x2d4a('0x2e')][_0x2d4a('0x47')]);_0x365399[_0x2d4a('0x33')]=_['keys'](_0x236fbf[_0x2d4a('0x33')]);_0x365399['filters']=_[_0x2d4a('0x36')](_0x365399[_0x2d4a('0x32')],_0x365399[_0x2d4a('0x33')]);_0x12c899[_0x2d4a('0x37')]=_[_0x2d4a('0x36')](_0x365399['model'],qs['fields'](_0x236fbf[_0x2d4a('0x33')][_0x2d4a('0x38')]));_0x12c899['attributes']=_0x12c899[_0x2d4a('0x37')]['length']?_0x12c899[_0x2d4a('0x37')]:_0x365399[_0x2d4a('0x32')];if(_0x236fbf[_0x2d4a('0x33')]['includeAll']){_0x12c899[_0x2d4a('0x42')]=[{'all':!![]}];}_0x12c899=_['merge']({},_0x12c899,_0x236fbf[_0x2d4a('0x48')]);return db[_0x2d4a('0x2e')][_0x2d4a('0x49')](_0x12c899)[_0x2d4a('0x28')](handleEntityNotFound(_0x2d6eca,null))[_0x2d4a('0x28')](respondWithResult(_0x2d6eca,null))[_0x2d4a('0x45')](handleError(_0x2d6eca,null));};exports[_0x2d4a('0x4a')]=function(_0x2b2f4b,_0x1ffb96){return db[_0x2d4a('0x2e')][_0x2d4a('0x4a')](_0x2b2f4b['body'],{})[_0x2d4a('0x28')](respondWithResult(_0x1ffb96,0xc9))[_0x2d4a('0x45')](handleError(_0x1ffb96,null));};exports[_0x2d4a('0x4b')]=function(_0x1467ab,_0x2d2e24){var _0x5b6086={'where':{'id':_0x1467ab[_0x2d4a('0x46')]['id']}},_0x39e5ec={};_0x39e5ec[_0x2d4a('0x32')]=_[_0x2d4a('0x34')](db[_0x2d4a('0x2e')]['rawAttributes']);_0x5b6086['attributes']=_[_0x2d4a('0x36')](_0x39e5ec[_0x2d4a('0x32')],qs['fields'](_0x1467ab[_0x2d4a('0x33')][_0x2d4a('0x38')]));_0x5b6086[_0x2d4a('0x37')]=_0x5b6086[_0x2d4a('0x37')]['length']?_0x5b6086[_0x2d4a('0x37')]:_0x39e5ec['model'];if(_0x1467ab[_0x2d4a('0x33')][_0x2d4a('0x41')]){_0x5b6086[_0x2d4a('0x42')]=[{'all':!![]}];}_0x5b6086=_[_0x2d4a('0x40')]({},_0x5b6086,_0x1467ab[_0x2d4a('0x48')]);return db[_0x2d4a('0x2e')][_0x2d4a('0x49')](_0x5b6086)[_0x2d4a('0x28')](handleEntityNotFound(_0x2d2e24,null))['then'](function(_0x255a82){if(_0x255a82){var _0x2cbe03=_0x255a82[_0x2d4a('0x4c')]({'plain':!![]});_0x2cbe03=qs[_0x2d4a('0x4d')](_0x2cbe03,['id',_0x2d4a('0x4e'),_0x2d4a('0x4f'),_0x2d4a('0x50')]);_0x1467ab[_0x2d4a('0x51')]=_[_0x2d4a('0x4d')](_0x1467ab[_0x2d4a('0x51')],['id',_0x2d4a('0x4e'),_0x2d4a('0x4f')]);return db[_0x2d4a('0x52')][_0x2d4a('0x53')](function(_0x1ce950){return db[_0x2d4a('0x2e')][_0x2d4a('0x4a')](_['merge'](_0x2cbe03,_0x1467ab[_0x2d4a('0x51')]),{'include':_0x1467ab[_0x2d4a('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x1ce950})[_0x2d4a('0x28')](function(_0x343f25){var _0x1f0b2b=_0x343f25[_0x2d4a('0x4c')]({'plain':!![]});return db[_0x2d4a('0x54')][_0x2d4a('0x43')]({'where':{'userProfileId':_0x1467ab[_0x2d4a('0x46')]['id']},'raw':!![]})[_0x2d4a('0x28')](function(_0x22afb4){if(_0x22afb4){return BPromise[_0x2d4a('0x55')](_0x22afb4,function(_0x346f2b){return new BPromise(function(_0x302323,_0x5c7cf9){if(_0x346f2b[_0x2d4a('0x56')]===null||_0x346f2b[_0x2d4a('0x56')]===0x1)_0x302323(null);return db['UserProfileResource'][_0x2d4a('0x43')]({'where':{'sectionId':_0x346f2b['id']},'raw':!![]})[_0x2d4a('0x28')](function(_0x1930c6){var _0xb4f74c=_[_0x2d4a('0x2d')](_0x1930c6,function(_0x1e86c3){return qs[_0x2d4a('0x4d')](_0x1e86c3,['id',_0x2d4a('0x4e'),_0x2d4a('0x4f'),_0x2d4a('0x57')]);});_0x302323(_0xb4f74c);})['catch'](function(_0x2bd137){_0x5c7cf9(_0x2bd137);});})[_0x2d4a('0x28')](function(_0x20445e){var _0x5504c6=qs[_0x2d4a('0x4d')](_0x346f2b,['id',_0x2d4a('0x4e'),_0x2d4a('0x4f')]);_0x5504c6[_0x2d4a('0x58')]=_0x1f0b2b['id'];if(_0x20445e)_0x5504c6[_0x2d4a('0x59')]=_0x20445e;return _0x5504c6;})[_0x2d4a('0x28')](function(_0x7e2699){return db[_0x2d4a('0x54')][_0x2d4a('0x4a')](_0x7e2699,{'include':[{'model':db['UserProfileResource'],'as':_0x2d4a('0x59')}],'raw':!![],'transaction':_0x1ce950});});})[_0x2d4a('0x28')](function(){return _0x1f0b2b;});}});});});}})[_0x2d4a('0x28')](respondWithResult(_0x2d2e24,0xc9))[_0x2d4a('0x45')](handleError(_0x2d2e24,null));};exports[_0x2d4a('0x27')]=function(_0x2f77ee,_0x53f52b){if(_0x2f77ee[_0x2d4a('0x51')]['id']){delete _0x2f77ee[_0x2d4a('0x51')]['id'];}return db[_0x2d4a('0x2e')]['find']({'where':{'id':_0x2f77ee[_0x2d4a('0x46')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x53f52b,null))['then'](saveUpdates(_0x2f77ee[_0x2d4a('0x51')],null))[_0x2d4a('0x28')](respondWithResult(_0x53f52b,null))['catch'](handleError(_0x53f52b,null));};exports[_0x2d4a('0x5a')]=function(_0x5ad7f6,_0x4d7271){return db[_0x2d4a('0x2e')][_0x2d4a('0x49')]({'where':{'id':_0x5ad7f6[_0x2d4a('0x46')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x4d7271,null))['then'](removeEntity(_0x4d7271,null))[_0x2d4a('0x45')](handleError(_0x4d7271,null));};exports[_0x2d4a('0x5b')]=function(_0x25ee37,_0x303815){return db['UserProfile']['describe']()[_0x2d4a('0x28')](respondWithResult(_0x303815,null))[_0x2d4a('0x45')](handleError(_0x303815,null));};exports[_0x2d4a('0x5c')]=function(_0x2aa9e8,_0x9e6321){var _0x3d6046=_0x2aa9e8[_0x2d4a('0x51')];return db['UserProfile'][_0x2d4a('0x49')]({'where':{'id':_0x2aa9e8[_0x2d4a('0x46')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x9e6321,null))[_0x2d4a('0x28')](function(_0x59810d){if(_0x59810d){return db[_0x2d4a('0x52')][_0x2d4a('0x53')](function(_0x32a048){return db[_0x2d4a('0x54')]['destroy']({'where':{'userProfileId':_0x2aa9e8[_0x2d4a('0x46')]['id'],'sectionId':_[_0x2d4a('0x2d')](_0x3d6046,function(_0x55d565){return _0x55d565[_0x2d4a('0x57')];})},'transaction':_0x32a048})[_0x2d4a('0x28')](function(){var _0x26c037=_['map'](_0x3d6046,function(_0x14a913){_0x14a913[_0x2d4a('0x58')]=_0x2aa9e8[_0x2d4a('0x46')]['id'];return _0x14a913;});var _0x33d274=[];return BPromise[_0x2d4a('0x55')](_0x26c037,function(_0xb6c864){return db[_0x2d4a('0x54')]['create'](_0xb6c864,{'include':[{'model':db[_0x2d4a('0x5d')],'as':_0x2d4a('0x59')}],'raw':!![],'transaction':_0x32a048})[_0x2d4a('0x28')](function(_0x1cc5ed){_0x33d274[_0x2d4a('0x5e')](_0x1cc5ed['get']({'plain':!![]}));});})[_0x2d4a('0x28')](function(){return _0x33d274;});});});}})['then'](function(_0x3a2aab){return _0x3a2aab;})[_0x2d4a('0x28')](respondWithResult(_0x9e6321,null))[_0x2d4a('0x45')](handleError(_0x9e6321,null));};exports[_0x2d4a('0x5f')]=function(_0xf9a063,_0x2ba9c2){var _0x40640b;return db[_0x2d4a('0x2e')][_0x2d4a('0x49')]({'where':{'id':_0xf9a063[_0x2d4a('0x46')]['id']},'attributes':['id','name']})[_0x2d4a('0x28')](handleEntityNotFound(_0x2ba9c2,null))['then'](function(_0x3d7d7d){if(_0x3d7d7d){_0x40640b=_0x3d7d7d;return db[_0x2d4a('0x54')][_0x2d4a('0x5a')]({'where':{'userProfileId':_0xf9a063[_0x2d4a('0x46')]['id'],'sectionId':_0xf9a063[_0x2d4a('0x33')][_0x2d4a('0x60')]}});}})[_0x2d4a('0x28')](function(){return _0x40640b;})[_0x2d4a('0x28')](respondWithStatusCode(_0x2ba9c2,null))[_0x2d4a('0x45')](handleError(_0x2ba9c2,null));};exports['getSections']=function(_0x1a83a4,_0x74bc62){var _0x211cef=[];var _0xcdf787=[];return db['UserProfileSection'][_0x2d4a('0x43')]({'where':{'userProfileId':_0x1a83a4[_0x2d4a('0x46')]['id']},'raw':!![]})[_0x2d4a('0x28')](function(_0xbe362d){_0x211cef=_[_0x2d4a('0x3f')](_0xbe362d,function(_0xd1adbe){return _0xd1adbe['enabled']===0x1||_[_0x2d4a('0x61')]([0x3eb,0x709],_0xd1adbe[_0x2d4a('0x57')]);});if(!_['isEmpty'](_0x211cef)){return _[_0x2d4a('0x2d')](_0x211cef,function(_0x2e7563){return _0x2e7563[_0x2d4a('0x57')];});}else{return;}})[_0x2d4a('0x28')](function(_0x429579){if(_0x429579)_0xcdf787=_0x429579;if(_[_0x2d4a('0x61')](_0xcdf787,0x64)){var _0x110a9f=_[_0x2d4a('0x49')](_0x211cef,{'sectionId':0x64});return hasDefaultDashboard(_0x110a9f)[_0x2d4a('0x28')](function(_0x70c4a0){return _['map'](_0x211cef,function(_0x212fcf){if(_0x212fcf['sectionId']===0x64){_0x212fcf[_0x2d4a('0x62')]=_0x70c4a0;}return _0x212fcf;});});}else{return;}})[_0x2d4a('0x28')](function(_0x285b93){if(_0x285b93)_0x211cef=_0x285b93;if(_[_0x2d4a('0x61')](_0xcdf787,0x3eb)){var _0x18d7f3=_[_0x2d4a('0x49')](_0x211cef,{'sectionId':0x3eb});return getCustomDashboards(_0x18d7f3)[_0x2d4a('0x28')](function(_0x49d196){return _[_0x2d4a('0x2d')](_0x211cef,function(_0x2ebb9e){if(_0x18d7f3[_0x2d4a('0x63')]){if(_0x2ebb9e[_0x2d4a('0x57')]===0x3eb){_0x2ebb9e[_0x2d4a('0x62')]=_0x49d196;}}else{if(_0x2ebb9e['sectionId']===0x64){_0x2ebb9e['subsections']=_0x49d196;}}return _0x2ebb9e;});});}else{return;}})['then'](function(_0x46e128){if(_0x46e128)_0x211cef=_0x46e128;if(_[_0x2d4a('0x61')](_0xcdf787,0x709)){var _0x42b42e=_['find'](_0x211cef,{'sectionId':0x709});return getPlugins(_0x42b42e)[_0x2d4a('0x28')](function(_0x7ca04e){if(_0x42b42e[_0x2d4a('0x63')]){return _[_0x2d4a('0x2d')](_0x211cef,function(_0x3373ff){if(_0x3373ff[_0x2d4a('0x57')]===0x709){_0x3373ff['subsections']=_0x7ca04e;}return _0x3373ff;});}else{var _0x334d5f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x7ca04e};var _0x579bdf=_[_0x2d4a('0x2d')](_0x211cef);_0x579bdf[_0x2d4a('0x5e')](_0x334d5f);return _0x579bdf;}});}else{return;}})['then'](function(_0x3fd93b){if(_0x3fd93b)_0x211cef=_0x3fd93b;return _['filter'](_0x211cef,['enabled',0x1]);})['then'](respondWithResult(_0x74bc62,null))[_0x2d4a('0x45')](handleError(_0x74bc62,null));};function hasDefaultDashboard(_0xd175e5){var _0x3f0164=[0x65];return new BPromise(function(_0x56f0df,_0x12e257){try{if(_0xd175e5[_0x2d4a('0x56')]){_0x56f0df(_0x3f0164);}else{return db[_0x2d4a('0x5d')][_0x2d4a('0x64')]({'where':{'sectionId':_0xd175e5['id']},'raw':!![]})['then'](function(_0x2e4038){_0x2e4038?_0x56f0df(_0x3f0164):_0x56f0df();});}}catch(_0x36e8a5){_0x12e257(_0x36e8a5);}});}function getCustomDashboards(_0x4cd04c){var _0xc6d9b4=[];return new BPromise(function(_0x404668,_0x4dee8f){try{if(_0x4cd04c[_0x2d4a('0x56')]){return db['Dashboard']['findAll']({'raw':!![]})[_0x2d4a('0x28')](function(_0x592512){_0x592512[_0x2d4a('0x65')](function(_0x12eccd){_0xc6d9b4[_0x2d4a('0x5e')](_0x12eccd['id']+0x1869f);});_0x404668(_0xc6d9b4);});}else{return db[_0x2d4a('0x5d')]['findAll']({'where':{'sectionId':_0x4cd04c['id']},'raw':!![]})[_0x2d4a('0x28')](function(_0x561e7e){_0x561e7e[_0x2d4a('0x65')](function(_0x41aa6e){_0xc6d9b4[_0x2d4a('0x5e')](_0x41aa6e[_0x2d4a('0x66')]+0x1869f);});_0x404668(_0xc6d9b4);});}}catch(_0x45f6b7){_0x4dee8f(_0x45f6b7);}});}function getPlugins(_0x4fd87a){var _0x34f0d7=[];return new BPromise(function(_0x2b9d62,_0x1c7c6a){try{if(_0x4fd87a['autoAssociation']){return db[_0x2d4a('0x67')]['findAll']({'raw':!![]})['then'](function(_0x393cb9){_0x393cb9[_0x2d4a('0x65')](function(_0x10e9fc){_0x34f0d7[_0x2d4a('0x5e')](_0x10e9fc['id']+0x15b38);});_0x2b9d62(_0x34f0d7);});}else{return db[_0x2d4a('0x5d')][_0x2d4a('0x43')]({'where':{'sectionId':_0x4fd87a['id']},'raw':!![]})[_0x2d4a('0x28')](function(_0x38ac6d){_0x38ac6d[_0x2d4a('0x65')](function(_0xd726c4){_0x34f0d7['push'](_0xd726c4[_0x2d4a('0x66')]+0x15b38);});_0x2b9d62(_0x34f0d7);});}}catch(_0x2b29b1){_0x1c7c6a(_0x2b29b1);}});}exports[_0x2d4a('0x68')]=function(_0x10d86c,_0x36b067){return db[_0x2d4a('0x2e')][_0x2d4a('0x49')]({'where':{'id':_0x10d86c[_0x2d4a('0x46')]['id']}})['then'](handleEntityNotFound(_0x36b067,null))[_0x2d4a('0x28')](function(_0x2c8761){if(_0x2c8761){return db[_0x2d4a('0x52')]['transaction'](function(_0x1d9c27){return db['UserProfileSection'][_0x2d4a('0x43')]({'where':{'userProfileId':_0x10d86c[_0x2d4a('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x2d4a('0x28')](function(_0x1816b9){if(_0x1816b9){return db['UserProfileSection'][_0x2d4a('0x5a')]({'where':{'userProfileId':_0x10d86c['params']['id'],'id':_[_0x2d4a('0x2d')](_0x1816b9,function(_0x54f1e4){return _0x54f1e4['id'];})},'transaction':_0x1d9c27});}})[_0x2d4a('0x28')](function(_0x5ee99a){var _0x3dee80=_['map'](_0x10d86c[_0x2d4a('0x51')],function(_0x165fff){_0x165fff[_0x2d4a('0x58')]=_0x10d86c[_0x2d4a('0x46')]['id'];return _0x165fff;});return db[_0x2d4a('0x54')][_0x2d4a('0x69')](_0x3dee80,{'raw':!![],'transaction':_0x1d9c27});})[_0x2d4a('0x28')](function(_0x1dd8ed){var _0x43c019=_['filter'](_['map'](_0x1dd8ed,function(_0x4bebc8){return _0x4bebc8[_0x2d4a('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x43c019){return db['UserProfileSection'][_0x2d4a('0x43')]({'where':{'userProfileId':_0x10d86c['params']['id'],'sectionId':_[_0x2d4a('0x2d')](_0x43c019,function(_0x29f417){return _0x29f417['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x2d4a('0x28')](function(_0x4ea523){var _0x279c26=_[_0x2d4a('0x2d')](_0x10d86c[_0x2d4a('0x51')],function(_0x5e1042){_0x5e1042[_0x2d4a('0x58')]=_0x10d86c[_0x2d4a('0x46')]['id'];return _0x5e1042;});return db[_0x2d4a('0x5d')][_0x2d4a('0x69')](_0x279c26,{'raw':!![],'transaction':_0x1d9c27});});}})[_0x2d4a('0x45')](handleError(_0x36b067,null));});}})[_0x2d4a('0x28')](function(_0x41c298){var _0xa629c5=_[_0x2d4a('0x2d')](_0x41c298,function(_0x121430){return _0x121430[_0x2d4a('0x4c')]({'plain':!![]});});})[_0x2d4a('0x28')](respondWithResult(_0x36b067,null))['catch'](handleError(_0x36b067,null));};exports[_0x2d4a('0x6a')]=function(_0x466969,_0x91bc9,_0x59f67a){return db[_0x2d4a('0x2e')][_0x2d4a('0x49')]({'where':{'id':_0x466969[_0x2d4a('0x46')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x91bc9,null))[_0x2d4a('0x28')](function(_0x4feefa){if(_0x4feefa){return _0x4feefa[_0x2d4a('0x6a')](_0x466969[_0x2d4a('0x33')][_0x2d4a('0x60')]);}})[_0x2d4a('0x28')](respondWithStatusCode(_0x91bc9,null))['catch'](handleError(_0x91bc9,null));};exports[_0x2d4a('0x6b')]=function(_0x1cd7fd,_0x44f57b){var _0x42246c={};if(!_0x1cd7fd[_0x2d4a('0x33')][_0x2d4a('0x6c')])throw new Error(_0x2d4a('0x6d'));if(!_0x1cd7fd['query'][_0x2d4a('0x3a')](_0x2d4a('0x3b'))){_0x42246c[_0x2d4a('0x21')]=qs[_0x2d4a('0x21')](_0x1cd7fd[_0x2d4a('0x33')][_0x2d4a('0x21')]);_0x42246c['offset']=qs[_0x2d4a('0x20')](_0x1cd7fd[_0x2d4a('0x33')][_0x2d4a('0x20')]);}return db[_0x2d4a('0x2e')][_0x2d4a('0x49')]({'where':{'id':_0x1cd7fd['params']['id']}})['then'](function(_0x3e276d){if(!_0x3e276d)throw new Error(_0x2d4a('0x6e')+_0x1cd7fd[_0x2d4a('0x46')]['id']);return db[_0x2d4a('0x2e')][_0x2d4a('0x6b')](_0x1cd7fd);})[_0x2d4a('0x28')](respondWithFilteredResult(_0x44f57b,_0x42246c))[_0x2d4a('0x45')](handleError(_0x44f57b,null));}; \ No newline at end of file +var _0x3c91=['desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','map','UserProfile','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','clone','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','userProfileId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce'];(function(_0x55a1cf,_0x19c1e6){var _0x29d191=function(_0x254192){while(--_0x254192){_0x55a1cf['push'](_0x55a1cf['shift']());}};_0x29d191(++_0x19c1e6);}(_0x3c91,0x1af));var _0x13c9=function(_0x2578f9,_0x2d6276){_0x2578f9=_0x2578f9-0x0;var _0x4d6aea=_0x3c91[_0x2578f9];return _0x4d6aea;};'use strict';var emlformat=require(_0x13c9('0x0'));var rimraf=require(_0x13c9('0x1'));var zipdir=require(_0x13c9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x13c9('0x3'));var BPromise=require(_0x13c9('0x4'));var Mustache=require(_0x13c9('0x5'));var util=require('util');var path=require(_0x13c9('0x6'));var sox=require(_0x13c9('0x7'));var csv=require(_0x13c9('0x8'));var ejs=require(_0x13c9('0x9'));var fs=require('fs');var fs_extra=require(_0x13c9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x13c9('0xb'));var jsforce=require(_0x13c9('0xc'));var deskjs=require(_0x13c9('0xd'));var toCsv=require(_0x13c9('0x8'));var querystring=require(_0x13c9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x13c9('0xf'));var qs=require(_0x13c9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x13c9('0x11'))(_0x13c9('0x12'));var utils=require(_0x13c9('0x13'));var config=require(_0x13c9('0x14'));var licenseUtil=require(_0x13c9('0x15'));var db=require(_0x13c9('0x16'))['db'];config[_0x13c9('0x17')]=_['defaults'](config[_0x13c9('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x5351f6,_0x5c5a18){_0x5c5a18=_0x5c5a18||0xcc;return function(_0x52abdd){if(_0x52abdd){return _0x5351f6[_0x13c9('0x18')](_0x5c5a18);}return _0x5351f6[_0x13c9('0x19')](_0x5c5a18)[_0x13c9('0x1a')]();};}function respondWithResult(_0x1c9601,_0xb269f4){_0xb269f4=_0xb269f4||0xc8;return function(_0x170c98){if(_0x170c98){return _0x1c9601[_0x13c9('0x19')](_0xb269f4)['json'](_0x170c98);}};}function respondWithFilteredResult(_0x51c4fb,_0x5cfd1f){return function(_0xd08fc0){if(_0xd08fc0){var _0x1a6c06=typeof _0x5cfd1f[_0x13c9('0x1b')]===_0x13c9('0x1c')&&typeof _0x5cfd1f[_0x13c9('0x1d')]==='undefined';var _0x1d5167=_0xd08fc0[_0x13c9('0x1e')];var _0xf95546=_0x1a6c06?0x0:_0x5cfd1f[_0x13c9('0x1b')];var _0x6fc26f=_0x1a6c06?_0xd08fc0[_0x13c9('0x1e')]:_0x5cfd1f[_0x13c9('0x1b')]+_0x5cfd1f['limit'];var _0x283c5e;if(_0x6fc26f>=_0x1d5167){_0x6fc26f=_0x1d5167;_0x283c5e=0xc8;}else{_0x283c5e=0xce;}_0x51c4fb[_0x13c9('0x19')](_0x283c5e);return _0x51c4fb[_0x13c9('0x1f')](_0x13c9('0x20'),_0xf95546+'-'+_0x6fc26f+'/'+_0x1d5167)[_0x13c9('0x21')](_0xd08fc0);}return null;};}function patchUpdates(_0x184912){return function(_0x193c91){try{jsonpatch[_0x13c9('0x22')](_0x193c91,_0x184912,!![]);}catch(_0x3aa102){return BPromise[_0x13c9('0x23')](_0x3aa102);}return _0x193c91['save']();};}function saveUpdates(_0x63df88,_0x12f9ad){return function(_0x25c866){if(_0x25c866){return _0x25c866[_0x13c9('0x24')](_0x63df88)[_0x13c9('0x25')](function(_0x55b3d9){return _0x55b3d9;});}return null;};}function removeEntity(_0x4e1236,_0x53b62f){return function(_0x4e079d){if(_0x4e079d){return _0x4e079d[_0x13c9('0x26')]()[_0x13c9('0x25')](function(){_0x4e1236[_0x13c9('0x19')](0xcc)[_0x13c9('0x1a')]();});}};}function handleEntityNotFound(_0x362cb7,_0x445486){return function(_0x3fcf1c){if(!_0x3fcf1c){_0x362cb7[_0x13c9('0x18')](0x194);}return _0x3fcf1c;};}function handleError(_0x2beb6e,_0x3b2da3){_0x3b2da3=_0x3b2da3||0x1f4;return function(_0x4ec9ff){logger[_0x13c9('0x27')](_0x4ec9ff[_0x13c9('0x28')]);if(_0x4ec9ff['name']){delete _0x4ec9ff[_0x13c9('0x29')];}_0x2beb6e[_0x13c9('0x19')](_0x3b2da3)[_0x13c9('0x2a')](_0x4ec9ff);};}exports['index']=function(_0x4b5938,_0x390073){var _0x35249b={},_0x1a1710={},_0x4cb64a={'count':0x0,'rows':[]};var _0x309606=_[_0x13c9('0x2b')](db[_0x13c9('0x2c')][_0x13c9('0x2d')],function(_0x26dd6a){return{'name':_0x26dd6a['fieldName'],'type':_0x26dd6a[_0x13c9('0x2e')][_0x13c9('0x2f')]};});_0x1a1710[_0x13c9('0x30')]=_[_0x13c9('0x2b')](_0x309606,_0x13c9('0x29'));_0x1a1710[_0x13c9('0x31')]=_[_0x13c9('0x32')](_0x4b5938['query']);_0x1a1710[_0x13c9('0x33')]=_[_0x13c9('0x34')](_0x1a1710['model'],_0x1a1710[_0x13c9('0x31')]);_0x35249b[_0x13c9('0x35')]=_[_0x13c9('0x34')](_0x1a1710[_0x13c9('0x30')],qs[_0x13c9('0x36')](_0x4b5938[_0x13c9('0x31')]['fields']));_0x35249b['attributes']=_0x35249b[_0x13c9('0x35')][_0x13c9('0x37')]?_0x35249b[_0x13c9('0x35')]:_0x1a1710[_0x13c9('0x30')];if(!_0x4b5938['query'][_0x13c9('0x38')](_0x13c9('0x39'))){_0x35249b['limit']=qs[_0x13c9('0x1d')](_0x4b5938[_0x13c9('0x31')][_0x13c9('0x1d')]);_0x35249b['offset']=qs[_0x13c9('0x1b')](_0x4b5938[_0x13c9('0x31')][_0x13c9('0x1b')]);}_0x35249b[_0x13c9('0x3a')]=qs['sort'](_0x4b5938['query'][_0x13c9('0x3b')]);_0x35249b[_0x13c9('0x3c')]=qs['filters'](_[_0x13c9('0x3d')](_0x4b5938[_0x13c9('0x31')],_0x1a1710[_0x13c9('0x33')]),_0x309606);if(_0x4b5938[_0x13c9('0x31')][_0x13c9('0x3e')]){_0x35249b[_0x13c9('0x3c')]=_[_0x13c9('0x3f')](_0x35249b[_0x13c9('0x3c')],{'$or':_['map'](_0x309606,function(_0x5821a2){if(_0x5821a2[_0x13c9('0x2e')]!==_0x13c9('0x40')){var _0x255e06={};_0x255e06[_0x5821a2[_0x13c9('0x29')]]={'$like':'%'+_0x4b5938[_0x13c9('0x31')][_0x13c9('0x3e')]+'%'};return _0x255e06;}})});}_0x35249b=_['merge']({},_0x35249b,_0x4b5938[_0x13c9('0x41')]);var _0x4c36d7={'where':_0x35249b[_0x13c9('0x3c')]};return db['UserProfile'][_0x13c9('0x1e')](_0x4c36d7)[_0x13c9('0x25')](function(_0x1269da){_0x4cb64a[_0x13c9('0x1e')]=_0x1269da;if(_0x4b5938['query'][_0x13c9('0x42')]){_0x35249b[_0x13c9('0x43')]=[{'all':!![]}];}return db['UserProfile'][_0x13c9('0x44')](_0x35249b);})['then'](function(_0x578a66){_0x4cb64a[_0x13c9('0x45')]=_0x578a66;return _0x4cb64a;})[_0x13c9('0x25')](respondWithFilteredResult(_0x390073,_0x35249b))[_0x13c9('0x46')](handleError(_0x390073,null));};exports[_0x13c9('0x47')]=function(_0x355663,_0x4e0f2f){var _0x129a70={'raw':![],'where':{'id':_0x355663[_0x13c9('0x48')]['id']}},_0x3a520d={};_0x3a520d[_0x13c9('0x30')]=_[_0x13c9('0x32')](db[_0x13c9('0x2c')][_0x13c9('0x2d')]);_0x3a520d[_0x13c9('0x31')]=_[_0x13c9('0x32')](_0x355663[_0x13c9('0x31')]);_0x3a520d[_0x13c9('0x33')]=_[_0x13c9('0x34')](_0x3a520d['model'],_0x3a520d[_0x13c9('0x31')]);_0x129a70[_0x13c9('0x35')]=_[_0x13c9('0x34')](_0x3a520d['model'],qs['fields'](_0x355663[_0x13c9('0x31')][_0x13c9('0x36')]));_0x129a70[_0x13c9('0x35')]=_0x129a70[_0x13c9('0x35')]['length']?_0x129a70[_0x13c9('0x35')]:_0x3a520d[_0x13c9('0x30')];if(_0x355663['query'][_0x13c9('0x42')]){_0x129a70[_0x13c9('0x43')]=[{'all':!![]}];}_0x129a70=_[_0x13c9('0x3f')]({},_0x129a70,_0x355663[_0x13c9('0x41')]);return db[_0x13c9('0x2c')]['find'](_0x129a70)[_0x13c9('0x25')](handleEntityNotFound(_0x4e0f2f,null))['then'](respondWithResult(_0x4e0f2f,null))[_0x13c9('0x46')](handleError(_0x4e0f2f,null));};exports[_0x13c9('0x49')]=function(_0x4f0915,_0x2bc31a){return db[_0x13c9('0x2c')][_0x13c9('0x49')](_0x4f0915[_0x13c9('0x4a')],{})[_0x13c9('0x25')](respondWithResult(_0x2bc31a,0xc9))[_0x13c9('0x46')](handleError(_0x2bc31a,null));};exports[_0x13c9('0x4b')]=function(_0x10c4f8,_0x2be9b0){var _0x2d81d8={'where':{'id':_0x10c4f8[_0x13c9('0x48')]['id']}},_0x4cb878={};_0x4cb878[_0x13c9('0x30')]=_[_0x13c9('0x32')](db['UserProfile'][_0x13c9('0x2d')]);_0x2d81d8['attributes']=_[_0x13c9('0x34')](_0x4cb878['model'],qs[_0x13c9('0x36')](_0x10c4f8[_0x13c9('0x31')][_0x13c9('0x36')]));_0x2d81d8[_0x13c9('0x35')]=_0x2d81d8[_0x13c9('0x35')][_0x13c9('0x37')]?_0x2d81d8['attributes']:_0x4cb878[_0x13c9('0x30')];if(_0x10c4f8[_0x13c9('0x31')]['includeAll']){_0x2d81d8[_0x13c9('0x43')]=[{'all':!![]}];}_0x2d81d8=_[_0x13c9('0x3f')]({},_0x2d81d8,_0x10c4f8[_0x13c9('0x41')]);return db['UserProfile'][_0x13c9('0x4c')](_0x2d81d8)[_0x13c9('0x25')](handleEntityNotFound(_0x2be9b0,null))[_0x13c9('0x25')](function(_0x189c57){if(_0x189c57){var _0x5b9390=_0x189c57[_0x13c9('0x4d')]({'plain':!![]});_0x5b9390=qs[_0x13c9('0x4e')](_0x5b9390,['id',_0x13c9('0x4f'),_0x13c9('0x50'),_0x13c9('0x51')]);_0x10c4f8[_0x13c9('0x4a')]=_[_0x13c9('0x4e')](_0x10c4f8[_0x13c9('0x4a')],['id',_0x13c9('0x4f'),_0x13c9('0x50')]);return db[_0x13c9('0x52')][_0x13c9('0x53')](function(_0x9e1912){return db[_0x13c9('0x2c')]['create'](_[_0x13c9('0x3f')](_0x5b9390,_0x10c4f8[_0x13c9('0x4a')]),{'include':_0x10c4f8['query'][_0x13c9('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x9e1912})[_0x13c9('0x25')](function(_0x188d2f){var _0x12ae9f=_0x188d2f[_0x13c9('0x4d')]({'plain':!![]});return db[_0x13c9('0x54')][_0x13c9('0x44')]({'where':{'userProfileId':_0x10c4f8['params']['id']},'raw':!![]})[_0x13c9('0x25')](function(_0x2f1aaf){if(_0x2f1aaf){return BPromise['each'](_0x2f1aaf,function(_0x4c85d){return new BPromise(function(_0x5c14f2,_0x2a3f03){if(_0x4c85d['autoAssociation']===null||_0x4c85d[_0x13c9('0x55')]===0x1)_0x5c14f2(null);return db[_0x13c9('0x56')][_0x13c9('0x44')]({'where':{'sectionId':_0x4c85d['id']},'raw':!![]})[_0x13c9('0x25')](function(_0x45c388){var _0x3e93a1=_[_0x13c9('0x2b')](_0x45c388,function(_0xe2443e){return qs[_0x13c9('0x4e')](_0xe2443e,['id',_0x13c9('0x4f'),_0x13c9('0x50'),_0x13c9('0x57')]);});_0x5c14f2(_0x3e93a1);})['catch'](function(_0x1726ec){_0x2a3f03(_0x1726ec);});})[_0x13c9('0x25')](function(_0x7c43ac){var _0x4387a6=qs[_0x13c9('0x4e')](_0x4c85d,['id',_0x13c9('0x4f'),_0x13c9('0x50')]);_0x4387a6['userProfileId']=_0x12ae9f['id'];if(_0x7c43ac)_0x4387a6[_0x13c9('0x58')]=_0x7c43ac;return _0x4387a6;})[_0x13c9('0x25')](function(_0x132d2e){return db[_0x13c9('0x54')]['create'](_0x132d2e,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x9e1912});});})[_0x13c9('0x25')](function(){return _0x12ae9f;});}});});});}})[_0x13c9('0x25')](respondWithResult(_0x2be9b0,0xc9))[_0x13c9('0x46')](handleError(_0x2be9b0,null));};exports['update']=function(_0x16bac6,_0x410b38){if(_0x16bac6[_0x13c9('0x4a')]['id']){delete _0x16bac6[_0x13c9('0x4a')]['id'];}return db[_0x13c9('0x2c')]['find']({'where':{'id':_0x16bac6[_0x13c9('0x48')]['id']}})[_0x13c9('0x25')](handleEntityNotFound(_0x410b38,null))[_0x13c9('0x25')](saveUpdates(_0x16bac6[_0x13c9('0x4a')],null))[_0x13c9('0x25')](respondWithResult(_0x410b38,null))[_0x13c9('0x46')](handleError(_0x410b38,null));};exports[_0x13c9('0x26')]=function(_0xbbadc8,_0x58851d){return db['UserProfile'][_0x13c9('0x4c')]({'where':{'id':_0xbbadc8[_0x13c9('0x48')]['id']}})[_0x13c9('0x25')](handleEntityNotFound(_0x58851d,null))['then'](removeEntity(_0x58851d,null))[_0x13c9('0x46')](handleError(_0x58851d,null));};exports['describe']=function(_0x35450e,_0x4022b8){return db[_0x13c9('0x2c')][_0x13c9('0x59')]()[_0x13c9('0x25')](respondWithResult(_0x4022b8,null))[_0x13c9('0x46')](handleError(_0x4022b8,null));};exports[_0x13c9('0x5a')]=function(_0x1ac2b3,_0x3a6636){var _0x38c7=_0x1ac2b3[_0x13c9('0x4a')];return db[_0x13c9('0x2c')][_0x13c9('0x4c')]({'where':{'id':_0x1ac2b3['params']['id']}})[_0x13c9('0x25')](handleEntityNotFound(_0x3a6636,null))[_0x13c9('0x25')](function(_0x31a98c){if(_0x31a98c){return db[_0x13c9('0x52')][_0x13c9('0x53')](function(_0x5a3d8c){return db[_0x13c9('0x54')][_0x13c9('0x26')]({'where':{'userProfileId':_0x1ac2b3[_0x13c9('0x48')]['id'],'sectionId':_[_0x13c9('0x2b')](_0x38c7,function(_0x5659ff){return _0x5659ff[_0x13c9('0x57')];})},'transaction':_0x5a3d8c})[_0x13c9('0x25')](function(){var _0x22aa42=_[_0x13c9('0x2b')](_0x38c7,function(_0x2cef4c){_0x2cef4c[_0x13c9('0x5b')]=_0x1ac2b3[_0x13c9('0x48')]['id'];return _0x2cef4c;});var _0x3bf0a6=[];return BPromise['each'](_0x22aa42,function(_0x245ec5){return db[_0x13c9('0x54')]['create'](_0x245ec5,{'include':[{'model':db[_0x13c9('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x5a3d8c})['then'](function(_0x22c6aa){_0x3bf0a6[_0x13c9('0x5c')](_0x22c6aa['get']({'plain':!![]}));});})['then'](function(){return _0x3bf0a6;});});});}})['then'](function(_0x50d301){return _0x50d301;})[_0x13c9('0x25')](respondWithResult(_0x3a6636,null))[_0x13c9('0x46')](handleError(_0x3a6636,null));};exports[_0x13c9('0x5d')]=function(_0x1f7a01,_0x323a20){var _0x518d17;return db[_0x13c9('0x2c')][_0x13c9('0x4c')]({'where':{'id':_0x1f7a01[_0x13c9('0x48')]['id']},'attributes':['id',_0x13c9('0x29')]})[_0x13c9('0x25')](handleEntityNotFound(_0x323a20,null))[_0x13c9('0x25')](function(_0x299857){if(_0x299857){_0x518d17=_0x299857;return db[_0x13c9('0x54')]['destroy']({'where':{'userProfileId':_0x1f7a01['params']['id'],'sectionId':_0x1f7a01['query'][_0x13c9('0x5e')]}});}})['then'](function(){return _0x518d17;})['then'](respondWithStatusCode(_0x323a20,null))[_0x13c9('0x46')](handleError(_0x323a20,null));};exports[_0x13c9('0x5f')]=function(_0x526b77,_0x20e3a2){var _0x3475c9=[];var _0x1e5482=[];return db[_0x13c9('0x54')][_0x13c9('0x44')]({'where':{'userProfileId':_0x526b77[_0x13c9('0x48')]['id']},'raw':!![]})[_0x13c9('0x25')](function(_0x1ef39a){_0x3475c9=_[_0x13c9('0x3e')](_0x1ef39a,function(_0x27e662){return _0x27e662[_0x13c9('0x60')]===0x1||_[_0x13c9('0x61')]([0x3eb,0x709],_0x27e662[_0x13c9('0x57')]);});if(!_[_0x13c9('0x62')](_0x3475c9)){return _[_0x13c9('0x2b')](_0x3475c9,function(_0x952d90){return _0x952d90[_0x13c9('0x57')];});}else{return;}})['then'](function(_0x78d90b){if(_0x78d90b)_0x1e5482=_0x78d90b;if(_[_0x13c9('0x61')](_0x1e5482,0x64)){var _0x4a2ace=_['find'](_0x3475c9,{'sectionId':0x64});return hasDefaultDashboard(_0x4a2ace)['then'](function(_0x48efc4){return _[_0x13c9('0x2b')](_0x3475c9,function(_0x819b02){if(_0x819b02[_0x13c9('0x57')]===0x64){_0x819b02['subsections']=_0x48efc4;}return _0x819b02;});});}else{return;}})[_0x13c9('0x25')](function(_0x2368ad){if(_0x2368ad)_0x3475c9=_0x2368ad;if(_[_0x13c9('0x61')](_0x1e5482,0x3eb)){var _0x219bf0=_[_0x13c9('0x4c')](_0x3475c9,{'sectionId':0x3eb});return getCustomDashboards(_0x219bf0)['then'](function(_0x514b6f){return _[_0x13c9('0x2b')](_0x3475c9,function(_0x30bd42){if(_0x219bf0[_0x13c9('0x60')]){if(_0x30bd42[_0x13c9('0x57')]===0x3eb){_0x30bd42[_0x13c9('0x63')]=_0x514b6f;}}else{if(_0x30bd42[_0x13c9('0x57')]===0x64){_0x30bd42[_0x13c9('0x63')]=_0x514b6f;}}return _0x30bd42;});});}else{return;}})[_0x13c9('0x25')](function(_0x2da0dc){if(_0x2da0dc)_0x3475c9=_0x2da0dc;if(_[_0x13c9('0x61')](_0x1e5482,0x709)){var _0x2bb9d7=_[_0x13c9('0x4c')](_0x3475c9,{'sectionId':0x709});return getPlugins(_0x2bb9d7)[_0x13c9('0x25')](function(_0x59a78b){if(_0x2bb9d7[_0x13c9('0x60')]){return _[_0x13c9('0x2b')](_0x3475c9,function(_0x139b93){if(_0x139b93['sectionId']===0x709){_0x139b93[_0x13c9('0x63')]=_0x59a78b;}return _0x139b93;});}else{var _0x15a172={'sectionId':0x76c,'enabled':0x1,'subsections':_0x59a78b};var _0x3fbf3e=_[_0x13c9('0x2b')](_0x3475c9);_0x3fbf3e[_0x13c9('0x5c')](_0x15a172);return _0x3fbf3e;}});}else{return;}})['then'](function(_0x2cc8d2){if(_0x2cc8d2)_0x3475c9=_0x2cc8d2;return _[_0x13c9('0x3e')](_0x3475c9,['enabled',0x1]);})[_0x13c9('0x25')](respondWithResult(_0x20e3a2,null))[_0x13c9('0x46')](handleError(_0x20e3a2,null));};function hasDefaultDashboard(_0x4e6707){var _0x55a60e=[0x65];return new BPromise(function(_0xe8982f,_0x27db30){try{if(_0x4e6707[_0x13c9('0x55')]){_0xe8982f(_0x55a60e);}else{return db[_0x13c9('0x56')][_0x13c9('0x64')]({'where':{'sectionId':_0x4e6707['id']},'raw':!![]})['then'](function(_0x36099d){_0x36099d?_0xe8982f(_0x55a60e):_0xe8982f();});}}catch(_0x1aa028){_0x27db30(_0x1aa028);}});}function getCustomDashboards(_0x28c297){var _0x10c405=[];return new BPromise(function(_0x3b3d06,_0x542433){try{if(_0x28c297[_0x13c9('0x55')]){return db[_0x13c9('0x65')][_0x13c9('0x44')]({'raw':!![]})['then'](function(_0x47edb1){_0x47edb1[_0x13c9('0x66')](function(_0x2d1f58){_0x10c405[_0x13c9('0x5c')](_0x2d1f58['id']+0x1869f);});_0x3b3d06(_0x10c405);});}else{return db[_0x13c9('0x56')]['findAll']({'where':{'sectionId':_0x28c297['id']},'raw':!![]})['then'](function(_0x185a51){_0x185a51['forEach'](function(_0x27eb7b){_0x10c405[_0x13c9('0x5c')](_0x27eb7b[_0x13c9('0x67')]+0x1869f);});_0x3b3d06(_0x10c405);});}}catch(_0xe52b47){_0x542433(_0xe52b47);}});}function getPlugins(_0x13c79d){var _0x2ee678=[];return new BPromise(function(_0x4e3294,_0x41e389){try{if(_0x13c79d[_0x13c9('0x55')]){return db[_0x13c9('0x68')][_0x13c9('0x44')]({'raw':!![]})[_0x13c9('0x25')](function(_0x1c536b){_0x1c536b[_0x13c9('0x66')](function(_0x2bd05e){_0x2ee678[_0x13c9('0x5c')](_0x2bd05e['id']+0x15b38);});_0x4e3294(_0x2ee678);});}else{return db[_0x13c9('0x56')][_0x13c9('0x44')]({'where':{'sectionId':_0x13c79d['id']},'raw':!![]})[_0x13c9('0x25')](function(_0x50c723){_0x50c723[_0x13c9('0x66')](function(_0x575334){_0x2ee678[_0x13c9('0x5c')](_0x575334[_0x13c9('0x67')]+0x15b38);});_0x4e3294(_0x2ee678);});}}catch(_0x552e67){_0x41e389(_0x552e67);}});}exports[_0x13c9('0x69')]=function(_0x206e9a,_0x39a5e2){return db[_0x13c9('0x2c')][_0x13c9('0x4c')]({'where':{'id':_0x206e9a[_0x13c9('0x48')]['id']}})[_0x13c9('0x25')](handleEntityNotFound(_0x39a5e2,null))[_0x13c9('0x25')](function(_0x188550){if(_0x188550){return db[_0x13c9('0x52')]['transaction'](function(_0x2f1ad6){return db[_0x13c9('0x54')][_0x13c9('0x44')]({'where':{'userProfileId':_0x206e9a[_0x13c9('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x13c9('0x25')](function(_0x2b4d09){if(_0x2b4d09){return db[_0x13c9('0x54')][_0x13c9('0x26')]({'where':{'userProfileId':_0x206e9a[_0x13c9('0x48')]['id'],'id':_[_0x13c9('0x2b')](_0x2b4d09,function(_0x411c2e){return _0x411c2e['id'];})},'transaction':_0x2f1ad6});}})[_0x13c9('0x25')](function(_0x2157c2){var _0x2eb5de=_['map'](_0x206e9a[_0x13c9('0x4a')],function(_0x3a669e){_0x3a669e[_0x13c9('0x5b')]=_0x206e9a[_0x13c9('0x48')]['id'];return _0x3a669e;});return db[_0x13c9('0x54')][_0x13c9('0x6a')](_0x2eb5de,{'raw':!![],'transaction':_0x2f1ad6});})[_0x13c9('0x25')](function(_0x4890fc){var _0x5081a1=_[_0x13c9('0x3e')](_[_0x13c9('0x2b')](_0x4890fc,function(_0x323014){return _0x323014[_0x13c9('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x5081a1){return db[_0x13c9('0x54')][_0x13c9('0x44')]({'where':{'userProfileId':_0x206e9a[_0x13c9('0x48')]['id'],'sectionId':_[_0x13c9('0x2b')](_0x5081a1,function(_0x948765){return _0x948765['sectionId'];})},'attributes':['id',_0x13c9('0x57')],'raw':!![]})[_0x13c9('0x25')](function(_0x892e80){var _0x3eb7ec=_[_0x13c9('0x2b')](_0x206e9a['body'],function(_0xb4450d){_0xb4450d[_0x13c9('0x5b')]=_0x206e9a[_0x13c9('0x48')]['id'];return _0xb4450d;});return db[_0x13c9('0x56')][_0x13c9('0x6a')](_0x3eb7ec,{'raw':!![],'transaction':_0x2f1ad6});});}})['catch'](handleError(_0x39a5e2,null));});}})[_0x13c9('0x25')](function(_0x118205){var _0x1a0d62=_['map'](_0x118205,function(_0x56aedd){return _0x56aedd[_0x13c9('0x4d')]({'plain':!![]});});})[_0x13c9('0x25')](respondWithResult(_0x39a5e2,null))[_0x13c9('0x46')](handleError(_0x39a5e2,null));};exports['removeResources']=function(_0x7a3cd4,_0x45dd8e,_0x1a78c9){return db[_0x13c9('0x2c')][_0x13c9('0x4c')]({'where':{'id':_0x7a3cd4['params']['id']}})[_0x13c9('0x25')](handleEntityNotFound(_0x45dd8e,null))[_0x13c9('0x25')](function(_0x5eafb4){if(_0x5eafb4){return _0x5eafb4['removeResources'](_0x7a3cd4[_0x13c9('0x31')][_0x13c9('0x5e')]);}})[_0x13c9('0x25')](respondWithStatusCode(_0x45dd8e,null))[_0x13c9('0x46')](handleError(_0x45dd8e,null));};exports['getResources']=function(_0x1ce77f,_0x1996ee){var _0x4aa3d2={};if(!_0x1ce77f[_0x13c9('0x31')][_0x13c9('0x6b')])throw new Error(_0x13c9('0x6c'));if(!_0x1ce77f[_0x13c9('0x31')][_0x13c9('0x38')](_0x13c9('0x39'))){_0x4aa3d2[_0x13c9('0x1d')]=qs['limit'](_0x1ce77f[_0x13c9('0x31')][_0x13c9('0x1d')]);_0x4aa3d2[_0x13c9('0x1b')]=qs[_0x13c9('0x1b')](_0x1ce77f[_0x13c9('0x31')][_0x13c9('0x1b')]);}return db[_0x13c9('0x2c')][_0x13c9('0x4c')]({'where':{'id':_0x1ce77f[_0x13c9('0x48')]['id']}})['then'](function(_0x36de00){if(!_0x36de00)throw new Error(_0x13c9('0x6d')+_0x1ce77f['params']['id']);return db[_0x13c9('0x2c')][_0x13c9('0x6e')](_0x1ce77f);})[_0x13c9('0x25')](respondWithFilteredResult(_0x1996ee,_0x4aa3d2))[_0x13c9('0x46')](handleError(_0x1996ee,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 701655f..7f1e76e 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 _0x2aa3=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x581d25,_0x45ff2a){var _0x450915=function(_0x1b1b76){while(--_0x1b1b76){_0x581d25['push'](_0x581d25['shift']());}};_0x450915(++_0x45ff2a);}(_0x2aa3,0x83));var _0x32aa=function(_0x1b1afa,_0x2ba8d4){_0x1b1afa=_0x1b1afa-0x0;var _0x4b5535=_0x2aa3[_0x1b1afa];return _0x4b5535;};'use strict';var EventEmitter=require(_0x32aa('0x0'));var UserProfile=require(_0x32aa('0x1'))['db'][_0x32aa('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x32aa('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x32aa('0x4')};function emitEvent(_0x2b754c){return function(_0x13843c,_0x33612d,_0x22e989){UserProfileEvents[_0x32aa('0x5')](_0x2b754c+':'+_0x13843c['id'],_0x13843c);UserProfileEvents['emit'](_0x2b754c,_0x13843c);_0x22e989(null);};}for(var e in events){if(events[_0x32aa('0x6')](e)){var event=events[e];UserProfile[_0x32aa('0x7')](e,emitEvent(event));}}module[_0x32aa('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x7919=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7919,0xeb));var _0x9791=function(_0xaa90f,_0x53d33e){_0xaa90f=_0xaa90f-0x0;var _0x5bc68a=_0x7919[_0xaa90f];return _0x5bc68a;};'use strict';var EventEmitter=require(_0x9791('0x0'));var UserProfile=require(_0x9791('0x1'))['db'][_0x9791('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x9791('0x3')](0x0);var events={'afterCreate':_0x9791('0x4'),'afterUpdate':_0x9791('0x5'),'afterDestroy':_0x9791('0x6')};function emitEvent(_0x54b9c0){return function(_0x13a1a5,_0x193919,_0x4b484f){UserProfileEvents[_0x9791('0x7')](_0x54b9c0+':'+_0x13a1a5['id'],_0x13a1a5);UserProfileEvents[_0x9791('0x7')](_0x54b9c0,_0x13a1a5);_0x4b484f(null);};}for(var e in events){if(events[_0x9791('0x8')](e)){var event=events[e];UserProfile[_0x9791('0x9')](e,emitEvent(event));}}module[_0x9791('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 1d09388..e129857 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 _0x4991=['reportId','AnalyticMetric','toUpperCase','slice','Sequelize','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','UserProfile','user_profiles','query','section','mergeResources','Invalid\x20section\x20\x27','length','find','all','ignore','isEmpty','union','push','autoAssociation','rawAttributes','keys','intersection','fields','attributes','hasOwnProperty','limit','offset','sort','filters','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','default','DefaultReports','custom','CustomReports','count','rows','Tags','tag','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','../../components/parsers/qs','exports','models','filter','field','value','findAll','then','associatedResources','map','model','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareRecording','parentSections','SquareProjects','projects','CmContact','Lists','ListId','lists','companies','CmCompany','CmCustomField','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','whatsappaccounts','Team','voicequeues','VoiceQueues','users','agents','telephones','Users','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','Template','triggers','Trunk','Variable','plugins'];(function(_0x1ded8e,_0x101e2d){var _0x3c5037=function(_0x9f0432){while(--_0x9f0432){_0x1ded8e['push'](_0x1ded8e['shift']());}};_0x3c5037(++_0x101e2d);}(_0x4991,0xf7));var _0x1499=function(_0x4f232d,_0x50c2fd){_0x4f232d=_0x4f232d-0x0;var _0x494086=_0x4991[_0x4f232d];return _0x494086;};'use strict';var _=require(_0x1499('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x1499('0x1'));var squel=require('squel');module[_0x1499('0x2')]=function(_0x256e41){var _0x16ac22=_0x256e41[_0x1499('0x3')];function _0x1b291f(_0x158134,_0x19adff){return new Promise(function(_0x209616,_0x4b6154){if(!_0x19adff)return _0x209616(null);var _0x2a8e96=_0x19adff[_0x1499('0x4')]?{[_0x19adff[_0x1499('0x4')][_0x1499('0x5')]]:_0x19adff[_0x1499('0x4')][_0x1499('0x6')]}:undefined;return _0x16ac22[_0x158134][_0x1499('0x7')]({'where':_0x2a8e96,'raw':!![]})[_0x1499('0x8')](function(_0x48d2ca){_0x19adff[_0x1499('0x9')]=_[_0x1499('0xa')](_0x48d2ca,'id');_0x209616(_0x19adff);})['catch'](function(_0x2a4816){_0x4b6154(_0x2a4816);});});}function _0x352180(_0x4c2bd2,_0x4407c2){return new Promise(function(_0x2867b1,_0x5de9a2){var _0x4ab173=_0x4c2bd2['filter']?{[_0x4c2bd2[_0x1499('0x4')][_0x1499('0x5')]]:_0x4c2bd2[_0x1499('0x4')][_0x1499('0x6')]}:undefined;return _0x16ac22[_0x4c2bd2[_0x1499('0xb')]]['findAll']({'where':_0x4ab173,'raw':!![]})['then'](function(_0x308177){_0x4407c2['associatedResources']=_[_0x1499('0xa')](_0x308177,function(_0x12cde0){return _0x12cde0[_0x1499('0xc')];});_0x2867b1(_0x4407c2);})[_0x1499('0xd')](function(_0x48f654){_0x5de9a2(_0x48f654);});});}function _0x1ed43b(_0x373f57,_0x592c27,_0x25164c){if(!_0x592c27)return Promise[_0x1499('0xe')](null);return new Promise(function(_0x46b364,_0xc92272){return _0x16ac22[_0x1499('0xf')][_0x1499('0x7')]({'where':{'sectionId':_0x592c27['id']},'raw':!![]})['then'](function(_0x541477){if(_0x373f57['field']&&_0x373f57[_0x1499('0x5')]!=='id'){_0x592c27[_0x1499('0x9')]=_['map'](_0x541477,function(_0x351da9){return _0x351da9[_0x373f57[_0x1499('0x5')]];});}else{if(_0x25164c===_0x1499('0x10')){_0x592c27[_0x1499('0x9')]=_[_0x1499('0xa')](_0x541477,function(_0x2911ab){return{'id':_0x2911ab[_0x1499('0x11')],'type':_0x2911ab[_0x1499('0x12')]};});}else{_0x592c27[_0x1499('0x9')]=_[_0x1499('0xa')](_0x541477,function(_0x2bb71f){return _0x2bb71f[_0x1499('0x11')];});}}_0x46b364(_0x592c27);})[_0x1499('0xd')](function(_0x3b73f6){_0xc92272(_0x3b73f6);});});}function _0x4ec57a(_0x1e2c51,_0x2c7f57){var _0x5615b4={'parentSections':[]};switch(_0x1e2c51[_0x1499('0x13')]()){case _0x1499('0x14'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x16');break;case _0x1499('0x17'):_0x5615b4[_0x1499('0x15')]='SquareOdbc';break;case'squarerecordings':_0x5615b4[_0x1499('0x15')]=_0x1499('0x18');_0x5615b4[_0x1499('0x19')]=[{'name':_0x1499('0x1a'),'field':_0x1499('0xc'),'foreignKey':'projectName'}];break;case _0x1499('0x1b'):_0x5615b4['childModel']='JscriptyProject';break;case'contacts':_0x5615b4[_0x1499('0x15')]=_0x1499('0x1c');_0x5615b4[_0x1499('0x19')]=[{'name':_0x1499('0x1d'),'field':'id','foreignKey':_0x1499('0x1e')}];break;case _0x1499('0x1f'):_0x5615b4[_0x1499('0x15')]='CmList';break;case _0x1499('0x20'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x21');break;case'globalcustomfields':_0x5615b4[_0x1499('0x15')]=_0x1499('0x22');break;case'chatqueues':_0x5615b4[_0x1499('0x15')]=_0x1499('0x23');break;case'chatwebsites':_0x5615b4[_0x1499('0x15')]=_0x1499('0x24');break;case _0x1499('0x25'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x26');break;case _0x1499('0x27'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x28');break;case _0x1499('0x29'):case _0x1499('0x2a'):case _0x1499('0x2b'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x2c');break;case _0x1499('0x2d'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x2e');break;case _0x1499('0x2f'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x30');break;case _0x1499('0x31'):_0x5615b4['childModel']=_0x1499('0x32');_0x5615b4[_0x1499('0x19')]=[{'name':_0x1499('0x33'),'field':_0x1499('0xc'),'foreignKey':_0x1499('0x34'),'model':_0x1499('0x35'),'filter':{'field':_0x1499('0x36'),'value':[_0x1499('0x37')]}},{'name':_0x1499('0x38'),'field':_0x1499('0xc'),'foreignKey':_0x1499('0x34'),'model':'User','filter':{'field':'role','value':[_0x1499('0x39')]}},{'name':'VoiceQueues','field':_0x1499('0xc'),'foreignKey':'queue','model':_0x1499('0x3a'),'filter':{'field':_0x1499('0x12'),'value':[_0x1499('0x3b')]}},{'name':_0x1499('0x3c'),'field':'name','foreignKey':_0x1499('0x3d'),'model':'VoiceQueue','filter':{'field':_0x1499('0x12'),'value':[_0x1499('0x3e')]}}];break;case _0x1499('0x3f'):_0x5615b4[_0x1499('0x15')]='VoiceMusicOnHold';break;case _0x1499('0x40'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x41');break;case _0x1499('0x42'):_0x5615b4['childModel']=_0x1499('0x43');break;case'ivrcampaigns':_0x5615b4[_0x1499('0x15')]=_0x1499('0x44');break;case _0x1499('0x45'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x46');break;case _0x1499('0x47'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x48');break;case _0x1499('0x49'):_0x5615b4[_0x1499('0x15')]='MailSubstatus';break;case _0x1499('0x4a'):_0x5615b4['childModel']=_0x1499('0x4b');break;case _0x1499('0x4c'):_0x5615b4['childModel']=_0x1499('0x4d');break;case _0x1499('0x4e'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x4f');break;case _0x1499('0x50'):_0x5615b4['childModel']='SmsAccount';break;case _0x1499('0x51'):_0x5615b4[_0x1499('0x15')]='WhatsappQueue';break;case _0x1499('0x52'):_0x5615b4[_0x1499('0x15')]='WhatsappAccount';break;case'teams':_0x5615b4[_0x1499('0x15')]=_0x1499('0x53');break;case _0x1499('0x54'):case'queuecampaigns':_0x5615b4[_0x1499('0x15')]=_0x1499('0x3a');if(_0x2c7f57){_0x5615b4[_0x1499('0x19')]=[{'name':_0x1499('0x55')},{'name':'QueueCampaigns'}];}break;case _0x1499('0x56'):case _0x1499('0x57'):case _0x1499('0x58'):_0x5615b4[_0x1499('0x15')]='User';if(_0x2c7f57){_0x5615b4[_0x1499('0x19')]=[{'name':_0x1499('0x59'),'filter':{'field':_0x1499('0x36'),'value':['admin','user']},'ignore':!![]},{'name':_0x1499('0x33')},{'name':'Telephones'}];}break;case _0x1499('0x5a'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x5b');break;case _0x1499('0x5c'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x5d');break;case _0x1499('0x5e'):_0x5615b4['childModel']=_0x1499('0x5f');break;case'sugarcrmaccounts':_0x5615b4[_0x1499('0x15')]=_0x1499('0x60');break;case'deskaccounts':_0x5615b4[_0x1499('0x15')]=_0x1499('0x61');break;case _0x1499('0x62'):_0x5615b4['childModel']=_0x1499('0x63');break;case _0x1499('0x64'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x35');break;case _0x1499('0x65'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x66');break;case _0x1499('0x67'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x68');break;case'customdashboards':_0x5615b4[_0x1499('0x15')]=_0x1499('0x69');break;case _0x1499('0x6a'):_0x5615b4['childModel']=_0x1499('0x6b');break;case _0x1499('0x6c'):_0x5615b4['childModel']=_0x1499('0x6d');break;case _0x1499('0x6e'):_0x5615b4['childModel']=_0x1499('0x6f');break;case _0x1499('0x70'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x71');break;case _0x1499('0x72'):_0x5615b4[_0x1499('0x15')]=_0x1499('0x73');break;case'templates':_0x5615b4[_0x1499('0x15')]=_0x1499('0x74');break;case _0x1499('0x75'):_0x5615b4[_0x1499('0x15')]='Trigger';break;case'trunks':_0x5615b4[_0x1499('0x15')]=_0x1499('0x76');break;case'variables':_0x5615b4[_0x1499('0x15')]=_0x1499('0x77');break;case _0x1499('0x78'):_0x5615b4['childModel']='Plugin';break;case'extractedreports':_0x5615b4[_0x1499('0x15')]=_0x1499('0x10');_0x5615b4[_0x1499('0x19')]=[{'name':'Reports','field':'id','foreignKey':_0x1499('0x79')}];break;case'metrics':_0x5615b4[_0x1499('0x15')]=_0x1499('0x7a');break;}return _0x5615b4;}function _0x2fc6f9(_0x16ef45,_0x573552){var _0x53a9da=_0x16ef45['charAt'](0x0)[_0x1499('0x7b')]()+_0x16ef45[_0x1499('0x7c')](0x1);var _0x1e9261={'type':_0x16ac22[_0x1499('0x7d')]['QueryTypes'][_0x1499('0x7e')],'raw':!![]};return new Promise(function(_0x2ecfc5,_0x517f15){var _0x11f55a=squel['select']()[_0x1499('0x5')](_0x1499('0x7f')+_0x53a9da+_0x1499('0x80'),'id')['field'](_0x1499('0x81'))[_0x1499('0x82')](_0x1499('0x83')+_0x16ef45+'_interactions','ui')[_0x1499('0x84')](_0x1499('0x85'),_0x573552['id']);return _0x16ac22[_0x1499('0x86')]['query'](_0x11f55a[_0x1499('0x87')](),_0x1e9261)[_0x1499('0x8')](function(_0x217399){_0x573552[_0x53a9da+_0x1499('0x88')]=_0x217399;_0x2ecfc5(_0x217399);})[_0x1499('0xd')](function(_0x96a0ed){_0x517f15(_0x96a0ed);});});}return _0x256e41['define'](_0x1499('0x89'),attributes,{'tableName':_0x1499('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4d6165){var _0x3839da={'raw':![],'where':{}};var _0x258555={};var _0x26cc61={'count':0x0,'rows':[]};var _0x1eba4e=_0x4d6165[_0x1499('0x8b')][_0x1499('0x8c')];var _0x5e5ee4=_0x4d6165[_0x1499('0x8b')][_0x1499('0x8d')]||![];var _0x4eec83=_0x4ec57a(_0x1eba4e,_0x5e5ee4);if(!_0x4eec83['childModel'])throw new Error(_0x1499('0x8e')+_0x1eba4e+'\x27');var _0x314d88=[{'name':_0x1eba4e}];if(!_['isEmpty'](_0x4eec83[_0x1499('0x19')]))_0x314d88=_0x4eec83[_0x1499('0x19')];var _0x302dee=[];for(var _0x57a574=0x0;_0x57a574<_0x314d88[_0x1499('0x8f')];_0x57a574++){_0x302dee['push'](_0x16ac22['UserProfileSection'][_0x1499('0x90')]({'where':{'userProfileId':_0x4d6165['params']['id'],'name':_0x314d88[_0x57a574]['name']},'raw':!![]}));}return Promise[_0x1499('0x91')](_0x302dee)[_0x1499('0x8')](function(_0x59dd18){var _0x261255=_[_0x1499('0x4')](_0x59dd18,function(_0x3da29f){return _0x3da29f?_0x3da29f:undefined;});var _0x50780b=_['filter'](_0x314d88,[_0x1499('0x92'),!![]]);var _0x2f3a3a=_[_0x1499('0x93')](_0x261255)&&_[_0x1499('0x93')](_0x50780b)?null:_[_0x1499('0x94')](_0x50780b,_0x261255);if(!_0x2f3a3a)return null;var _0x52583b=[];for(var _0x344c5e=0x0;_0x344c5e<_0x2f3a3a[_0x1499('0x8f')];_0x344c5e++){var _0x57bb71=_[_0x1499('0x90')](_0x314d88,function(_0x20e5f3){return _0x2f3a3a[_0x344c5e]?_0x20e5f3[_0x1499('0xc')]===_0x2f3a3a[_0x344c5e]['name']:null;});if(_0x57bb71){if(_0x2f3a3a[_0x344c5e][_0x1499('0x92')]){_0x52583b[_0x1499('0x95')](_0x1b291f(_0x4eec83[_0x1499('0x15')],_0x2f3a3a[_0x344c5e]));}else{if(!_0x2f3a3a[_0x344c5e][_0x1499('0x96')]){_0x52583b['push'](_0x1ed43b(_0x57bb71,_0x2f3a3a[_0x344c5e],_0x4eec83[_0x1499('0x15')]));}else{if(_0x57bb71[_0x1499('0xb')]){_0x52583b[_0x1499('0x95')](_0x352180(_0x57bb71,_0x2f3a3a[_0x344c5e]));}}}}}return Promise['all'](_0x52583b);})[_0x1499('0x8')](function(_0x67a745){var _0x316c67=_0x67a745;var _0x1f9d15=null;if(_0x316c67){_0x1f9d15=_0x316c67[_0x1499('0x8f')]===0x1?_0x316c67[0x0]:null;}if(!_0x1f9d15&&!_0x316c67)return _0x26cc61;var _0x2e6136=_0x16ac22[_0x4eec83['childModel']][_0x1499('0x97')];_0x258555['model']=_['keys'](_0x2e6136);_0x258555[_0x1499('0x8b')]=_[_0x1499('0x98')](_0x4d6165[_0x1499('0x8b')]);_0x258555['filters']=_['intersection'](_0x258555[_0x1499('0xb')],_0x258555[_0x1499('0x8b')]);_0x3839da['attributes']=_[_0x1499('0x99')](_0x258555[_0x1499('0xb')],qs[_0x1499('0x9a')](_0x4d6165[_0x1499('0x8b')][_0x1499('0x9a')]));_0x3839da[_0x1499('0x9b')]=_0x3839da[_0x1499('0x9b')]['length']?_0x3839da[_0x1499('0x9b')]:_0x258555[_0x1499('0xb')];if(!_0x4d6165['query'][_0x1499('0x9c')]('nolimit')){_0x3839da[_0x1499('0x9d')]=qs[_0x1499('0x9d')](_0x4d6165[_0x1499('0x8b')][_0x1499('0x9d')]);_0x3839da['offset']=qs[_0x1499('0x9e')](_0x4d6165['query'][_0x1499('0x9e')]);}_0x3839da['order']=qs[_0x1499('0x9f')](_0x4d6165[_0x1499('0x8b')][_0x1499('0x9f')]);_0x3839da['where']=qs[_0x1499('0xa0')](_[_0x1499('0xa1')](_0x4d6165['query'],_0x258555['filters']));if(_0x4d6165[_0x1499('0x8b')]['filter']){_0x3839da[_0x1499('0x84')]=_['merge'](_0x3839da[_0x1499('0x84')],{'$or':_['map'](_0x2e6136,function(_0x35405c){if(_0x35405c[_0x1499('0x12')][_0x1499('0xa2')]!==_0x1499('0xa3')){var _0x1f5e4f={};_0x1f5e4f[_0x35405c[_0x1499('0x5')]]={'$like':'%'+_0x4d6165[_0x1499('0x8b')][_0x1499('0x4')]+'%'};return _0x1f5e4f;}})});}var _0x59ad2c=[];var _0x131b76=null;var _0x31e7ae={};if(_0x1f9d15){_0x131b76=_[_0x1499('0x90')](_0x314d88,['name',_0x1f9d15[_0x1499('0xc')]]);if(_0x131b76[_0x1499('0x5')]){_0x31e7ae={};if(_0x4eec83['childModel']===_0x1499('0x10')){_0x31e7ae[_0x131b76[_0x1499('0xa4')]]=_[_0x1499('0xa')](_0x1f9d15[_0x1499('0x9')],'id');}else{_0x31e7ae[_0x131b76[_0x1499('0xa4')]]=_0x1f9d15['associatedResources'];}_0x59ad2c[_0x1499('0x95')](_0x31e7ae);}else{_0x3839da['where']['id']=_0x1f9d15['associatedResources'];}}else{for(var _0x5cc567=0x0;_0x5cc567<_0x316c67[_0x1499('0x8f')];_0x5cc567++){_0x131b76=_[_0x1499('0x90')](_0x314d88,[_0x1499('0xc'),_0x316c67[_0x5cc567][_0x1499('0xc')]]);if(_0x131b76[_0x1499('0x5')]){_0x31e7ae={};_0x31e7ae[_0x131b76[_0x1499('0xa4')]]=_0x316c67[_0x5cc567]['associatedResources'];_0x59ad2c['push'](_0x31e7ae);}else{if(!_0x3839da[_0x1499('0x84')]['id'])_0x3839da[_0x1499('0x84')]['id']=[];_0x316c67[_0x5cc567]['associatedResources'][_0x1499('0xa5')](function(_0x525e83){_0x3839da[_0x1499('0x84')]['id']['push'](_0x525e83);});}}}if(!_[_0x1499('0x93')](_0x59ad2c)){_0x3839da['where']=_[_0x1499('0xa6')](_0x3839da['where'],{'$and':{'$or':_0x59ad2c}});}_0x3839da=_[_0x1499('0xa6')]({},_0x3839da,_0x4d6165[_0x1499('0xa7')]);if(_0x1f9d15&&!_0x1f9d15['autoAssociation']&&_0x4eec83[_0x1499('0x15')]===_0x1499('0x10')){if(_0x4d6165['query'][_0x1499('0xa8')]){_0x3839da[_0x1499('0xa9')]=[{'all':!![]}];}return _0x16ac22[_0x4eec83[_0x1499('0x15')]][_0x1499('0x7')](_0x3839da)[_0x1499('0x8')](function(_0x3a2a78){var _0x1cb4b4=[];_0x3a2a78['forEach'](function(_0x25c8b9){var _0xd6d6ff;switch(_0x25c8b9['reportType']){case _0x1499('0xaa'):_0xd6d6ff=_[_0x1499('0x90')](_0x1f9d15['associatedResources'],function(_0x17bc4b){return _0x17bc4b['id']===_0x25c8b9[_0x1499('0x79')]&&_0x17bc4b['type']===_0x1499('0xab');});break;case _0x1499('0xac'):_0xd6d6ff=_[_0x1499('0x90')](_0x1f9d15[_0x1499('0x9')],function(_0x23e033){return _0x23e033['id']===_0x25c8b9[_0x1499('0x79')]&&_0x23e033[_0x1499('0x12')]===_0x1499('0xad');});break;}if(_0xd6d6ff)_0x1cb4b4['push'](_0x25c8b9);});_0x26cc61[_0x1499('0xae')]=_0x1cb4b4[_0x1499('0x8f')];_0x26cc61[_0x1499('0xaf')]=_0x1cb4b4;return _0x26cc61;});}else{return _0x16ac22[_0x4eec83[_0x1499('0x15')]][_0x1499('0xae')]({'where':_0x3839da[_0x1499('0x84')]})['then'](function(_0x537ae7){_0x26cc61['count']=_0x537ae7;if(_0x4d6165[_0x1499('0x8b')][_0x1499('0xa8')]){if(_0x4eec83[_0x1499('0x15')]===_0x1499('0x1c')){_0x3839da[_0x1499('0xa9')]=[{'model':_0x16ac22[_0x1499('0x73')],'as':_0x1499('0xb0'),'attributes':['id',_0x1499('0xc'),'color'],'required':_0x4d6165[_0x1499('0x8b')][_0x1499('0xb1')]?!![]:![]},{'model':_0x16ac22['Tag'],'as':'ThroughTags','attributes':['id',_0x1499('0xc'),'color'],'through':_0x4d6165['query']['tag']?{'attributes':[],'where':{'TagId':_0x4d6165[_0x1499('0x8b')][_0x1499('0xb1')]||undefined}}:{},'required':_0x4d6165[_0x1499('0x8b')][_0x1499('0xb1')]?!![]:![]}];}else{_0x3839da[_0x1499('0xa9')]=[{'all':!![]}];}}return _0x16ac22[_0x4eec83['childModel']]['findAll'](_0x3839da);})[_0x1499('0x8')](function(_0x17804b){_0x26cc61[_0x1499('0xaf')]=_0x17804b;if(_0x1eba4e==='Agents'&&_0x4d6165[_0x1499('0x8b')]['openTabs']==='true'){var _0x1b12b1=[];for(var _0x4f0bd3=0x0;_0x4f0bd3<_0x26cc61[_0x1499('0xaf')]['length'];_0x4f0bd3++){_0x1b12b1[_0x1499('0x95')](_0x2fc6f9('chat',_0x26cc61[_0x1499('0xaf')][_0x4f0bd3][_0x1499('0xb2')]));_0x1b12b1['push'](_0x2fc6f9(_0x1499('0xb3'),_0x26cc61['rows'][_0x4f0bd3][_0x1499('0xb2')]));_0x1b12b1[_0x1499('0x95')](_0x2fc6f9(_0x1499('0xb4'),_0x26cc61[_0x1499('0xaf')][_0x4f0bd3][_0x1499('0xb2')]));_0x1b12b1[_0x1499('0x95')](_0x2fc6f9(_0x1499('0xb5'),_0x26cc61[_0x1499('0xaf')][_0x4f0bd3][_0x1499('0xb2')]));_0x1b12b1[_0x1499('0x95')](_0x2fc6f9(_0x1499('0xb6'),_0x26cc61[_0x1499('0xaf')][_0x4f0bd3][_0x1499('0xb2')]));_0x1b12b1['push'](_0x2fc6f9(_0x1499('0xb7'),_0x26cc61[_0x1499('0xaf')][_0x4f0bd3][_0x1499('0xb2')]));}return Promise[_0x1499('0x91')](_0x1b12b1)['then'](function(){return _0x26cc61;});}return _0x26cc61;});}});}}});}; \ No newline at end of file +var _0x5d58=['rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','merge','VIRTUAL','find','foreignKey','forEach','options','autoAssociation','includeAll','include','reportType','default','reportId','CustomReports','count','rows','CmContact','Tag','Tags','color','tag','true','chat','dataValues','fax','mail','openchannel','whatsapp','filter','field','findAll','associatedResources','map','model','then','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','squareprojects','childModel','SquareProject','odbc','SquareOdbc','parentSections','SquareProjects','name','projects','JscriptyProject','contacts','Lists','ListId','lists','CmCompany','globalcustomfields','CmCustomField','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','membername','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','type','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','zendeskaccounts','ZendeskAccount','freshdeskaccounts','FreshdeskAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','templates','Template','triggers','Trigger','variables','Variable','plugins','Reports','metrics','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','ui.','InteractionId','ui.createdAt','from','_interactions','ui.UserId\x20=\x20?','query','toString','define','UserProfile','user_profiles','Invalid\x20section\x20\x27','UserProfileSection','all','ignore','isEmpty','union','length','push'];(function(_0x460626,_0x2ac973){var _0x4ee589=function(_0xb3421f){while(--_0xb3421f){_0x460626['push'](_0x460626['shift']());}};_0x4ee589(++_0x2ac973);}(_0x5d58,0x187));var _0x85d5=function(_0x73af7a,_0x2f718e){_0x73af7a=_0x73af7a-0x0;var _0x1e2229=_0x5d58[_0x73af7a];return _0x1e2229;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');var squel=require('squel');module['exports']=function(_0x64d32c){var _0x1eff3b=_0x64d32c['models'];function _0x1469fc(_0x30bfe8,_0x54207b){return new Promise(function(_0x1eb211,_0x2d457a){if(!_0x54207b)return _0x1eb211(null);var _0x578fad=_0x54207b[_0x85d5('0x0')]?{[_0x54207b['filter'][_0x85d5('0x1')]]:_0x54207b[_0x85d5('0x0')]['value']}:undefined;return _0x1eff3b[_0x30bfe8][_0x85d5('0x2')]({'where':_0x578fad,'raw':!![]})['then'](function(_0x1098be){_0x54207b[_0x85d5('0x3')]=_[_0x85d5('0x4')](_0x1098be,'id');_0x1eb211(_0x54207b);})['catch'](function(_0x499b36){_0x2d457a(_0x499b36);});});}function _0x4e147a(_0x1a2b82,_0x12a681){return new Promise(function(_0xde1063,_0x25369e){var _0x229355=_0x1a2b82[_0x85d5('0x0')]?{[_0x1a2b82[_0x85d5('0x0')]['field']]:_0x1a2b82['filter']['value']}:undefined;return _0x1eff3b[_0x1a2b82[_0x85d5('0x5')]][_0x85d5('0x2')]({'where':_0x229355,'raw':!![]})[_0x85d5('0x6')](function(_0x1704f0){_0x12a681[_0x85d5('0x3')]=_[_0x85d5('0x4')](_0x1704f0,function(_0x1545b4){return _0x1545b4['name'];});_0xde1063(_0x12a681);})[_0x85d5('0x7')](function(_0x2d7c95){_0x25369e(_0x2d7c95);});});}function _0x1621ed(_0x3da3f4,_0x19f7d5,_0x3dc83c){if(!_0x19f7d5)return Promise[_0x85d5('0x8')](null);return new Promise(function(_0x12bef9,_0x17652b){return _0x1eff3b[_0x85d5('0x9')][_0x85d5('0x2')]({'where':{'sectionId':_0x19f7d5['id']},'raw':!![]})[_0x85d5('0x6')](function(_0x34b981){if(_0x3da3f4[_0x85d5('0x1')]&&_0x3da3f4[_0x85d5('0x1')]!=='id'){_0x19f7d5[_0x85d5('0x3')]=_[_0x85d5('0x4')](_0x34b981,function(_0x1d6134){return _0x1d6134[_0x3da3f4['field']];});}else{if(_0x3dc83c===_0x85d5('0xa')){_0x19f7d5[_0x85d5('0x3')]=_['map'](_0x34b981,function(_0x231b57){return{'id':_0x231b57[_0x85d5('0xb')],'type':_0x231b57['type']};});}else{_0x19f7d5['associatedResources']=_[_0x85d5('0x4')](_0x34b981,function(_0x5a1b9a){return _0x5a1b9a[_0x85d5('0xb')];});}}_0x12bef9(_0x19f7d5);})['catch'](function(_0x240000){_0x17652b(_0x240000);});});}function _0x1f8d27(_0x560b3a,_0x4e11c4){var _0x4da71b={'parentSections':[]};switch(_0x560b3a['toLowerCase']()){case _0x85d5('0xc'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0xe');break;case _0x85d5('0xf'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x10');break;case'squarerecordings':_0x4da71b[_0x85d5('0xd')]='SquareRecording';_0x4da71b[_0x85d5('0x11')]=[{'name':_0x85d5('0x12'),'field':_0x85d5('0x13'),'foreignKey':'projectName'}];break;case _0x85d5('0x14'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x15');break;case _0x85d5('0x16'):_0x4da71b[_0x85d5('0xd')]='CmContact';_0x4da71b[_0x85d5('0x11')]=[{'name':_0x85d5('0x17'),'field':'id','foreignKey':_0x85d5('0x18')}];break;case _0x85d5('0x19'):_0x4da71b[_0x85d5('0xd')]='CmList';break;case'companies':_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x1a');break;case _0x85d5('0x1b'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x1c');break;case'chatqueues':_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x1d');break;case'chatwebsites':_0x4da71b['childModel']=_0x85d5('0x1e');break;case _0x85d5('0x1f'):_0x4da71b['childModel']=_0x85d5('0x20');break;case'faxaccounts':_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x21');break;case'inboundroutes':case _0x85d5('0x22'):case _0x85d5('0x23'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x24');break;case'contexts':_0x4da71b['childModel']=_0x85d5('0x25');break;case _0x85d5('0x26'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x27');break;case _0x85d5('0x28'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x29');_0x4da71b[_0x85d5('0x11')]=[{'name':_0x85d5('0x2a'),'field':'name','foreignKey':'membername','model':_0x85d5('0x2b'),'filter':{'field':_0x85d5('0x2c'),'value':[_0x85d5('0x2d')]}},{'name':_0x85d5('0x2e'),'field':_0x85d5('0x13'),'foreignKey':_0x85d5('0x2f'),'model':_0x85d5('0x2b'),'filter':{'field':_0x85d5('0x2c'),'value':['telephone']}},{'name':_0x85d5('0x30'),'field':_0x85d5('0x13'),'foreignKey':_0x85d5('0x31'),'model':_0x85d5('0x32'),'filter':{'field':'type','value':[_0x85d5('0x33')]}},{'name':_0x85d5('0x34'),'field':_0x85d5('0x13'),'foreignKey':_0x85d5('0x31'),'model':'VoiceQueue','filter':{'field':_0x85d5('0x35'),'value':['outbound']}}];break;case'musiconholds':_0x4da71b[_0x85d5('0xd')]='VoiceMusicOnHold';break;case _0x85d5('0x36'):_0x4da71b['childModel']='VoiceChanSpy';break;case _0x85d5('0x37'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x38');break;case _0x85d5('0x39'):_0x4da71b[_0x85d5('0xd')]='Campaign';break;case'mailqueues':_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x3a');break;case _0x85d5('0x3b'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x3c');break;case _0x85d5('0x3d'):_0x4da71b['childModel']='MailSubstatus';break;case _0x85d5('0x3e'):_0x4da71b['childModel']=_0x85d5('0x3f');break;case _0x85d5('0x40'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x41');break;case _0x85d5('0x42'):_0x4da71b['childModel']='SmsQueue';break;case _0x85d5('0x43'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x44');break;case _0x85d5('0x45'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x46');break;case _0x85d5('0x47'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x48');break;case _0x85d5('0x49'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x4a');break;case _0x85d5('0x4b'):case _0x85d5('0x4c'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x32');if(_0x4e11c4){_0x4da71b[_0x85d5('0x11')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x85d5('0x4d'):case _0x85d5('0x4e'):case _0x85d5('0x4f'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x2b');if(_0x4e11c4){_0x4da71b[_0x85d5('0x11')]=[{'name':'Users','filter':{'field':_0x85d5('0x2c'),'value':['admin','user']},'ignore':!![]},{'name':_0x85d5('0x2a')},{'name':_0x85d5('0x2e')}];}break;case _0x85d5('0x50'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x51');break;case'salesforceaccounts':_0x4da71b[_0x85d5('0xd')]='SalesforceAccount';break;case _0x85d5('0x52'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x53');break;case'sugarcrmaccounts':_0x4da71b['childModel']='SugarcrmAccount';break;case _0x85d5('0x54'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x55');break;case'zohoaccounts':_0x4da71b['childModel']=_0x85d5('0x56');break;case _0x85d5('0x57'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x2b');break;case'cannedanswers':_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x58');break;case _0x85d5('0x59'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x5a');break;case _0x85d5('0x5b'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x5c');break;case _0x85d5('0x5d'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x5e');break;case _0x85d5('0x5f'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x60');break;case _0x85d5('0x61'):_0x4da71b['childModel']=_0x85d5('0x62');break;case _0x85d5('0x63'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x64');break;case'tags':_0x4da71b[_0x85d5('0xd')]='Tag';break;case _0x85d5('0x65'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x66');break;case _0x85d5('0x67'):_0x4da71b['childModel']=_0x85d5('0x68');break;case'trunks':_0x4da71b['childModel']='Trunk';break;case _0x85d5('0x69'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x6a');break;case _0x85d5('0x6b'):_0x4da71b[_0x85d5('0xd')]='Plugin';break;case'extractedreports':_0x4da71b[_0x85d5('0xd')]=_0x85d5('0xa');_0x4da71b[_0x85d5('0x11')]=[{'name':_0x85d5('0x6c'),'field':'id','foreignKey':'reportId'}];break;case _0x85d5('0x6d'):_0x4da71b[_0x85d5('0xd')]=_0x85d5('0x6e');break;}return _0x4da71b;}function _0x54b9ab(_0x565ebe,_0x3ed683){var _0x404451=_0x565ebe[_0x85d5('0x6f')](0x0)['toUpperCase']()+_0x565ebe[_0x85d5('0x70')](0x1);var _0x3e7263={'type':_0x1eff3b[_0x85d5('0x71')][_0x85d5('0x72')]['SELECT'],'raw':!![]};return new Promise(function(_0x259942,_0x35c0e1){var _0x720309=squel['select']()[_0x85d5('0x1')](_0x85d5('0x73')+_0x404451+_0x85d5('0x74'),'id')['field'](_0x85d5('0x75'))[_0x85d5('0x76')]('user_has_'+_0x565ebe+_0x85d5('0x77'),'ui')['where'](_0x85d5('0x78'),_0x3ed683['id']);return _0x1eff3b['sequelize'][_0x85d5('0x79')](_0x720309[_0x85d5('0x7a')](),_0x3e7263)[_0x85d5('0x6')](function(_0x33c486){_0x3ed683[_0x404451+'OpenTabs']=_0x33c486;_0x259942(_0x33c486);})[_0x85d5('0x7')](function(_0x38a2fd){_0x35c0e1(_0x38a2fd);});});}return _0x64d32c[_0x85d5('0x7b')](_0x85d5('0x7c'),attributes,{'tableName':_0x85d5('0x7d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x226795){var _0x3236b5={'raw':![],'where':{}};var _0x390c3a={};var _0x5cf0a6={'count':0x0,'rows':[]};var _0x5d67d1=_0x226795[_0x85d5('0x79')]['section'];var _0x29e17f=_0x226795[_0x85d5('0x79')]['mergeResources']||![];var _0x580322=_0x1f8d27(_0x5d67d1,_0x29e17f);if(!_0x580322[_0x85d5('0xd')])throw new Error(_0x85d5('0x7e')+_0x5d67d1+'\x27');var _0x4266ae=[{'name':_0x5d67d1}];if(!_['isEmpty'](_0x580322[_0x85d5('0x11')]))_0x4266ae=_0x580322[_0x85d5('0x11')];var _0x123422=[];for(var _0x2aa68f=0x0;_0x2aa68f<_0x4266ae['length'];_0x2aa68f++){_0x123422['push'](_0x1eff3b[_0x85d5('0x7f')]['find']({'where':{'userProfileId':_0x226795['params']['id'],'name':_0x4266ae[_0x2aa68f][_0x85d5('0x13')]},'raw':!![]}));}return Promise[_0x85d5('0x80')](_0x123422)[_0x85d5('0x6')](function(_0x556af9){var _0x576714=_[_0x85d5('0x0')](_0x556af9,function(_0x67ae8d){return _0x67ae8d?_0x67ae8d:undefined;});var _0x291298=_['filter'](_0x4266ae,[_0x85d5('0x81'),!![]]);var _0x353236=_[_0x85d5('0x82')](_0x576714)&&_[_0x85d5('0x82')](_0x291298)?null:_[_0x85d5('0x83')](_0x291298,_0x576714);if(!_0x353236)return null;var _0x2b3421=[];for(var _0x361a01=0x0;_0x361a01<_0x353236[_0x85d5('0x84')];_0x361a01++){var _0x4f80dd=_['find'](_0x4266ae,function(_0x2a0a59){return _0x353236[_0x361a01]?_0x2a0a59[_0x85d5('0x13')]===_0x353236[_0x361a01][_0x85d5('0x13')]:null;});if(_0x4f80dd){if(_0x353236[_0x361a01]['ignore']){_0x2b3421[_0x85d5('0x85')](_0x1469fc(_0x580322[_0x85d5('0xd')],_0x353236[_0x361a01]));}else{if(!_0x353236[_0x361a01]['autoAssociation']){_0x2b3421[_0x85d5('0x85')](_0x1621ed(_0x4f80dd,_0x353236[_0x361a01],_0x580322[_0x85d5('0xd')]));}else{if(_0x4f80dd[_0x85d5('0x5')]){_0x2b3421[_0x85d5('0x85')](_0x4e147a(_0x4f80dd,_0x353236[_0x361a01]));}}}}}return Promise[_0x85d5('0x80')](_0x2b3421);})['then'](function(_0x35ba15){var _0x1b96eb=_0x35ba15;var _0x46f825=null;if(_0x1b96eb){_0x46f825=_0x1b96eb[_0x85d5('0x84')]===0x1?_0x1b96eb[0x0]:null;}if(!_0x46f825&&!_0x1b96eb)return _0x5cf0a6;var _0x17a33b=_0x1eff3b[_0x580322['childModel']][_0x85d5('0x86')];_0x390c3a[_0x85d5('0x5')]=_[_0x85d5('0x87')](_0x17a33b);_0x390c3a[_0x85d5('0x79')]=_[_0x85d5('0x87')](_0x226795[_0x85d5('0x79')]);_0x390c3a[_0x85d5('0x88')]=_[_0x85d5('0x89')](_0x390c3a[_0x85d5('0x5')],_0x390c3a[_0x85d5('0x79')]);_0x3236b5['attributes']=_[_0x85d5('0x89')](_0x390c3a[_0x85d5('0x5')],qs[_0x85d5('0x8a')](_0x226795[_0x85d5('0x79')][_0x85d5('0x8a')]));_0x3236b5[_0x85d5('0x8b')]=_0x3236b5['attributes'][_0x85d5('0x84')]?_0x3236b5['attributes']:_0x390c3a['model'];if(!_0x226795[_0x85d5('0x79')][_0x85d5('0x8c')](_0x85d5('0x8d'))){_0x3236b5[_0x85d5('0x8e')]=qs[_0x85d5('0x8e')](_0x226795[_0x85d5('0x79')][_0x85d5('0x8e')]);_0x3236b5[_0x85d5('0x8f')]=qs[_0x85d5('0x8f')](_0x226795['query'][_0x85d5('0x8f')]);}_0x3236b5[_0x85d5('0x90')]=qs[_0x85d5('0x91')](_0x226795[_0x85d5('0x79')][_0x85d5('0x91')]);_0x3236b5[_0x85d5('0x92')]=qs[_0x85d5('0x88')](_[_0x85d5('0x93')](_0x226795[_0x85d5('0x79')],_0x390c3a[_0x85d5('0x88')]));if(_0x226795[_0x85d5('0x79')][_0x85d5('0x0')]){_0x3236b5[_0x85d5('0x92')]=_[_0x85d5('0x94')](_0x3236b5[_0x85d5('0x92')],{'$or':_['map'](_0x17a33b,function(_0x52243a){if(_0x52243a[_0x85d5('0x35')]['key']!==_0x85d5('0x95')){var _0xa18a5e={};_0xa18a5e[_0x52243a[_0x85d5('0x1')]]={'$like':'%'+_0x226795[_0x85d5('0x79')][_0x85d5('0x0')]+'%'};return _0xa18a5e;}})});}var _0x182933=[];var _0x3c14d0=null;var _0xdeef5e={};if(_0x46f825){_0x3c14d0=_[_0x85d5('0x96')](_0x4266ae,['name',_0x46f825[_0x85d5('0x13')]]);if(_0x3c14d0[_0x85d5('0x1')]){_0xdeef5e={};if(_0x580322['childModel']===_0x85d5('0xa')){_0xdeef5e[_0x3c14d0['foreignKey']]=_[_0x85d5('0x4')](_0x46f825[_0x85d5('0x3')],'id');}else{_0xdeef5e[_0x3c14d0[_0x85d5('0x97')]]=_0x46f825[_0x85d5('0x3')];}_0x182933['push'](_0xdeef5e);}else{_0x3236b5[_0x85d5('0x92')]['id']=_0x46f825[_0x85d5('0x3')];}}else{for(var _0x59d51b=0x0;_0x59d51b<_0x1b96eb[_0x85d5('0x84')];_0x59d51b++){_0x3c14d0=_[_0x85d5('0x96')](_0x4266ae,['name',_0x1b96eb[_0x59d51b][_0x85d5('0x13')]]);if(_0x3c14d0[_0x85d5('0x1')]){_0xdeef5e={};_0xdeef5e[_0x3c14d0[_0x85d5('0x97')]]=_0x1b96eb[_0x59d51b]['associatedResources'];_0x182933[_0x85d5('0x85')](_0xdeef5e);}else{if(!_0x3236b5[_0x85d5('0x92')]['id'])_0x3236b5[_0x85d5('0x92')]['id']=[];_0x1b96eb[_0x59d51b][_0x85d5('0x3')][_0x85d5('0x98')](function(_0x1e45e5){_0x3236b5['where']['id'][_0x85d5('0x85')](_0x1e45e5);});}}}if(!_[_0x85d5('0x82')](_0x182933)){_0x3236b5['where']=_[_0x85d5('0x94')](_0x3236b5['where'],{'$and':{'$or':_0x182933}});}_0x3236b5=_[_0x85d5('0x94')]({},_0x3236b5,_0x226795[_0x85d5('0x99')]);if(_0x46f825&&!_0x46f825[_0x85d5('0x9a')]&&_0x580322['childModel']===_0x85d5('0xa')){if(_0x226795[_0x85d5('0x79')][_0x85d5('0x9b')]){_0x3236b5[_0x85d5('0x9c')]=[{'all':!![]}];}return _0x1eff3b[_0x580322[_0x85d5('0xd')]]['findAll'](_0x3236b5)[_0x85d5('0x6')](function(_0x29ca79){var _0xbbff78=[];_0x29ca79[_0x85d5('0x98')](function(_0x599c49){var _0x1764b0;switch(_0x599c49[_0x85d5('0x9d')]){case _0x85d5('0x9e'):_0x1764b0=_['find'](_0x46f825[_0x85d5('0x3')],function(_0x55d388){return _0x55d388['id']===_0x599c49[_0x85d5('0x9f')]&&_0x55d388[_0x85d5('0x35')]==='DefaultReports';});break;case'custom':_0x1764b0=_[_0x85d5('0x96')](_0x46f825[_0x85d5('0x3')],function(_0x3f8420){return _0x3f8420['id']===_0x599c49[_0x85d5('0x9f')]&&_0x3f8420[_0x85d5('0x35')]===_0x85d5('0xa0');});break;}if(_0x1764b0)_0xbbff78[_0x85d5('0x85')](_0x599c49);});_0x5cf0a6[_0x85d5('0xa1')]=_0xbbff78['length'];_0x5cf0a6[_0x85d5('0xa2')]=_0xbbff78;return _0x5cf0a6;});}else{return _0x1eff3b[_0x580322[_0x85d5('0xd')]][_0x85d5('0xa1')]({'where':_0x3236b5['where']})[_0x85d5('0x6')](function(_0x393a29){_0x5cf0a6['count']=_0x393a29;if(_0x226795[_0x85d5('0x79')][_0x85d5('0x9b')]){if(_0x580322[_0x85d5('0xd')]===_0x85d5('0xa3')){_0x3236b5[_0x85d5('0x9c')]=[{'model':_0x1eff3b[_0x85d5('0xa4')],'as':_0x85d5('0xa5'),'attributes':['id','name',_0x85d5('0xa6')],'required':_0x226795[_0x85d5('0x79')][_0x85d5('0xa7')]?!![]:![]},{'model':_0x1eff3b[_0x85d5('0xa4')],'as':'ThroughTags','attributes':['id',_0x85d5('0x13'),_0x85d5('0xa6')],'through':_0x226795[_0x85d5('0x79')][_0x85d5('0xa7')]?{'attributes':[],'where':{'TagId':_0x226795[_0x85d5('0x79')]['tag']||undefined}}:{},'required':_0x226795['query'][_0x85d5('0xa7')]?!![]:![]}];}else{_0x3236b5['include']=[{'all':!![]}];}}return _0x1eff3b[_0x580322[_0x85d5('0xd')]][_0x85d5('0x2')](_0x3236b5);})[_0x85d5('0x6')](function(_0xc595b5){_0x5cf0a6[_0x85d5('0xa2')]=_0xc595b5;if(_0x5d67d1===_0x85d5('0x2a')&&_0x226795[_0x85d5('0x79')]['openTabs']===_0x85d5('0xa8')){var _0x5366bc=[];for(var _0x26fbbe=0x0;_0x26fbbe<_0x5cf0a6[_0x85d5('0xa2')][_0x85d5('0x84')];_0x26fbbe++){_0x5366bc['push'](_0x54b9ab(_0x85d5('0xa9'),_0x5cf0a6[_0x85d5('0xa2')][_0x26fbbe][_0x85d5('0xaa')]));_0x5366bc['push'](_0x54b9ab('sms',_0x5cf0a6[_0x85d5('0xa2')][_0x26fbbe][_0x85d5('0xaa')]));_0x5366bc['push'](_0x54b9ab(_0x85d5('0xab'),_0x5cf0a6[_0x85d5('0xa2')][_0x26fbbe]['dataValues']));_0x5366bc[_0x85d5('0x85')](_0x54b9ab(_0x85d5('0xac'),_0x5cf0a6[_0x85d5('0xa2')][_0x26fbbe][_0x85d5('0xaa')]));_0x5366bc[_0x85d5('0x85')](_0x54b9ab(_0x85d5('0xad'),_0x5cf0a6[_0x85d5('0xa2')][_0x26fbbe]['dataValues']));_0x5366bc[_0x85d5('0x85')](_0x54b9ab(_0x85d5('0xae'),_0x5cf0a6[_0x85d5('0xa2')][_0x26fbbe][_0x85d5('0xaa')]));}return Promise['all'](_0x5366bc)['then'](function(){return _0x5cf0a6;});}return _0x5cf0a6;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 0c0f163..9cba1ff 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 _0xf693=['UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info'];(function(_0x1cc040,_0x40e0d7){var _0x3cd89e=function(_0x523e80){while(--_0x523e80){_0x1cc040['push'](_0x1cc040['shift']());}};_0x3cd89e(++_0x40e0d7);}(_0xf693,0x181));var _0x3f69=function(_0x30b260,_0x204885){_0x30b260=_0x30b260-0x0;var _0x5f382b=_0xf693[_0x30b260];return _0x5f382b;};'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']('UserProfile,\x20%s,\x20%s',_0x3214f9,_0x3f69('0x1c'));_0x1feeb3(_0x37d68d['result']['message']);}})['catch'](function(_0x427eb9){logger['error'](_0x3f69('0x15'),_0x3214f9,_0x427eb9);_0x558498(_0x427eb9);});});} \ No newline at end of file +var _0x2709=['message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x2709,0x189));var _0x9270=function(_0x211d54,_0x49986d){_0x211d54=_0x211d54-0x0;var _0x3e6133=_0x2709[_0x211d54];return _0x3e6133;};'use strict';var _=require(_0x9270('0x0'));var util=require('util');var moment=require(_0x9270('0x1'));var BPromise=require(_0x9270('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9270('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9270('0x4'));var logger=require(_0x9270('0x5'))(_0x9270('0x6'));var config=require(_0x9270('0x7'));var jayson=require(_0x9270('0x8'));var client=jayson[_0x9270('0x9')]['http']({'port':0x232a});config[_0x9270('0xa')]=_[_0x9270('0xb')](config[_0x9270('0xa')],{'host':_0x9270('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9270('0xa')]));require(_0x9270('0xd'))[_0x9270('0xe')](socket);function respondWithRpcPromise(_0xe68f8b,_0x623907,_0x78d773){return new BPromise(function(_0x46ead1,_0x9a0421){return client[_0x9270('0xf')](_0xe68f8b,_0x78d773)[_0x9270('0x10')](function(_0x5cf72b){logger[_0x9270('0x11')](_0x9270('0x12'),_0x623907,_0x9270('0x13'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x623907,_0x9270('0x13'),JSON[_0x9270('0x14')](_0x5cf72b));if(_0x5cf72b[_0x9270('0x15')]){if(_0x5cf72b['error'][_0x9270('0x16')]===0x1f4){logger[_0x9270('0x15')](_0x9270('0x12'),_0x623907,_0x5cf72b[_0x9270('0x15')]['message']);return _0x9a0421(_0x5cf72b['error'][_0x9270('0x17')]);}logger[_0x9270('0x15')]('UserProfile,\x20%s,\x20%s',_0x623907,_0x5cf72b[_0x9270('0x15')]['message']);return _0x46ead1(_0x5cf72b[_0x9270('0x15')][_0x9270('0x17')]);}else{logger[_0x9270('0x11')]('UserProfile,\x20%s,\x20%s',_0x623907,'request\x20sent');_0x46ead1(_0x5cf72b[_0x9270('0x18')][_0x9270('0x17')]);}})[_0x9270('0x19')](function(_0x54f3bd){logger[_0x9270('0x15')](_0x9270('0x12'),_0x623907,_0x54f3bd);_0x9a0421(_0x54f3bd);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 26cce44..d769a38 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 _0xe12d=['removeListener','register','length','userProfile:','./userProfile.events','remove','emit'];(function(_0x3c0fe7,_0x20d95f){var _0xf9b3e9=function(_0x32285f){while(--_0x32285f){_0x3c0fe7['push'](_0x3c0fe7['shift']());}};_0xf9b3e9(++_0x20d95f);}(_0xe12d,0x177));var _0xde12=function(_0x5e502b,_0x4d31fc){_0x5e502b=_0x5e502b-0x0;var _0x4f4031=_0xe12d[_0x5e502b];return _0x4f4031;};'use strict';var UserProfileEvents=require(_0xde12('0x0'));var events=['save',_0xde12('0x1'),'update'];function createListener(_0x4b5b45,_0x2a6a68){return function(_0xb09c5c){_0x2a6a68[_0xde12('0x2')](_0x4b5b45,_0xb09c5c);};}function removeListener(_0x5d3797,_0xeaa3e0){return function(){UserProfileEvents[_0xde12('0x3')](_0x5d3797,_0xeaa3e0);};}exports[_0xde12('0x4')]=function(_0x1a206d){for(var _0x39307c=0x0,_0x5c8cab=events[_0xde12('0x5')];_0x39307c<_0x5c8cab;_0x39307c++){var _0x2b47c2=events[_0x39307c];var _0x181749=createListener(_0xde12('0x6')+_0x2b47c2,_0x1a206d);UserProfileEvents['on'](_0x2b47c2,_0x181749);}}; \ No newline at end of file +var _0xd699=['update','emit','removeListener','register','userProfile:','./userProfile.events','save','remove'];(function(_0x327e47,_0x1f69a3){var _0xd2b5cd=function(_0x53feec){while(--_0x53feec){_0x327e47['push'](_0x327e47['shift']());}};_0xd2b5cd(++_0x1f69a3);}(_0xd699,0x185));var _0x9d69=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xd699[_0x2f45ea];return _0x485a84;};'use strict';var UserProfileEvents=require(_0x9d69('0x0'));var events=[_0x9d69('0x1'),_0x9d69('0x2'),_0x9d69('0x3')];function createListener(_0x428e75,_0x3342a1){return function(_0x27866c){_0x3342a1[_0x9d69('0x4')](_0x428e75,_0x27866c);};}function removeListener(_0x23e3b8,_0x5ed3a1){return function(){UserProfileEvents[_0x9d69('0x5')](_0x23e3b8,_0x5ed3a1);};}exports[_0x9d69('0x6')]=function(_0x444932){for(var _0x52bc74=0x0,_0x59751b=events['length'];_0x52bc74<_0x59751b;_0x52bc74++){var _0x30c233=events[_0x52bc74];var _0x3a245f=createListener(_0x9d69('0x7')+_0x30c233,_0x444932);UserProfileEvents['on'](_0x30c233,_0x3a245f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 4cbe831..19058ca 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 _0xb7a8=['Router','fs-extra','../../components/auth/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5ee507,_0x59e998){var _0x223caf=function(_0x39bfad){while(--_0x39bfad){_0x5ee507['push'](_0x5ee507['shift']());}};_0x223caf(++_0x59e998);}(_0xb7a8,0x95));var _0x8b7a=function(_0x3252f2,_0x16e1a9){_0x3252f2=_0x3252f2-0x0;var _0xa8d43b=_0xb7a8[_0x3252f2];return _0xa8d43b;};'use strict';var multer=require(_0x8b7a('0x0'));var util=require(_0x8b7a('0x1'));var path=require(_0x8b7a('0x2'));var timeout=require(_0x8b7a('0x3'));var express=require(_0x8b7a('0x4'));var router=express[_0x8b7a('0x5')]();var fs_extra=require(_0x8b7a('0x6'));var auth=require(_0x8b7a('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8b7a('0x8'));router[_0x8b7a('0x9')]('/',auth[_0x8b7a('0xa')](),controller[_0x8b7a('0xb')]);router[_0x8b7a('0x9')](_0x8b7a('0xc'),auth[_0x8b7a('0xa')](),controller['describe']);router['get'](_0x8b7a('0xd'),auth[_0x8b7a('0xa')](),controller[_0x8b7a('0xe')]);router[_0x8b7a('0xf')]('/',auth[_0x8b7a('0xa')](),controller[_0x8b7a('0x10')]);router[_0x8b7a('0x11')](_0x8b7a('0xd'),auth[_0x8b7a('0xa')](),controller[_0x8b7a('0x12')]);router[_0x8b7a('0x13')](_0x8b7a('0xd'),auth['isAuthenticated'](),controller[_0x8b7a('0x14')]);module[_0x8b7a('0x15')]=router; \ No newline at end of file +var _0xdb8d=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','isAuthenticated','get','describe','/:id','post','create','put','update'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xdb8d,0x88));var _0xddb8=function(_0x407e73,_0x281dad){_0x407e73=_0x407e73-0x0;var _0x2600e5=_0xdb8d[_0x407e73];return _0x2600e5;};'use strict';var multer=require(_0xddb8('0x0'));var util=require(_0xddb8('0x1'));var path=require('path');var timeout=require(_0xddb8('0x2'));var express=require(_0xddb8('0x3'));var router=express[_0xddb8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xddb8('0x5'));var interaction=require(_0xddb8('0x6'));var config=require('../../config/environment');var controller=require(_0xddb8('0x7'));router['get']('/',auth[_0xddb8('0x8')](),controller['index']);router[_0xddb8('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xddb8('0xa')]);router['get'](_0xddb8('0xb'),auth[_0xddb8('0x8')](),controller['show']);router[_0xddb8('0xc')]('/',auth['isAuthenticated'](),controller[_0xddb8('0xd')]);router[_0xddb8('0xe')]('/:id',auth[_0xddb8('0x8')](),controller[_0xddb8('0xf')]);router[_0xddb8('0x10')](_0xddb8('0xb'),auth['isAuthenticated'](),controller[_0xddb8('0x11')]);module[_0xddb8('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 158b10b..dd8660b 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 _0xe05a=['STRING','INTEGER','sequelize','exports'];(function(_0x3e8fb3,_0x488d23){var _0x18b133=function(_0x1870c0){while(--_0x1870c0){_0x3e8fb3['push'](_0x3e8fb3['shift']());}};_0x18b133(++_0x488d23);}(_0xe05a,0x12a));var _0xae05=function(_0x5320a6,_0x11cd2f){_0x5320a6=_0x5320a6-0x0;var _0x163aa9=_0xe05a[_0x5320a6];return _0x163aa9;};'use strict';var Sequelize=require(_0xae05('0x0'));module[_0xae05('0x1')]={'name':{'type':Sequelize[_0xae05('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xae05('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xae05('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe4d0=['STRING','INTEGER','sequelize','exports'];(function(_0x49de88,_0x3030f2){var _0x4cc5dd=function(_0x24668c){while(--_0x24668c){_0x49de88['push'](_0x49de88['shift']());}};_0x4cc5dd(++_0x3030f2);}(_0xe4d0,0x10e));var _0x0e4d=function(_0x4d05a0,_0x53aa7e){_0x4d05a0=_0x4d05a0-0x0;var _0x4c999c=_0xe4d0[_0x4d05a0];return _0x4c999c;};'use strict';var Sequelize=require(_0x0e4d('0x0'));module[_0x0e4d('0x1')]={'name':{'type':Sequelize[_0x0e4d('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x0e4d('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 6c399e7..a0f07b9 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 _0x33af=['findAll','rows','catch','show','params','length','include','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','merge','VIRTUAL','filter','includeAll'];(function(_0x1eb97d,_0x1b9afc){var _0x26b785=function(_0x1d524c){while(--_0x1d524c){_0x1eb97d['push'](_0x1eb97d['shift']());}};_0x26b785(++_0x1b9afc);}(_0x33af,0xec));var _0xf33a=function(_0x11f0a6,_0x1ce59d){_0x11f0a6=_0x11f0a6-0x0;var _0xa5ab4b=_0x33af[_0x11f0a6];return _0xa5ab4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['UserProfileResource'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')](_0xecc82f[_0xf33a('0x48')],{})[_0xf33a('0x26')](respondWithResult(_0x1a98f9,0xc9))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x190a2b,_0x6b79da){if(_0x190a2b[_0xf33a('0x48')]['id']){delete _0x190a2b[_0xf33a('0x48')]['id'];}return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x190a2b[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x6b79da,null))[_0xf33a('0x26')](saveUpdates(_0x190a2b[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x6b79da,null))[_0xf33a('0x42')](handleError(_0x6b79da,null));};exports[_0xf33a('0x27')]=function(_0x1b15a1,_0x3bab07){return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x1b15a1['params']['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x3bab07,null))[_0xf33a('0x26')](removeEntity(_0x3bab07,null))['catch'](handleError(_0x3bab07,null));};exports[_0xf33a('0x4a')]=function(_0xd40707,_0x36cba8){return db['UserProfileResource'][_0xf33a('0x4a')]()[_0xf33a('0x26')](respondWithResult(_0x36cba8,null))[_0xf33a('0x42')](handleError(_0x36cba8,null));}; \ No newline at end of file +var _0xc1c6=['filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','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','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','UserProfileResource','rawAttributes','type','key','model','query'];(function(_0x299751,_0x2d6274){var _0x571904=function(_0x269c38){while(--_0x269c38){_0x299751['push'](_0x299751['shift']());}};_0x571904(++_0x2d6274);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x31c322,_0x30d41c){_0x31c322=_0x31c322-0x0;var _0x1e4b03=_0xc1c6[_0x31c322];return _0x1e4b03;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['UserProfileResource']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['UserProfileResource'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['UserProfileResource'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['UserProfileResource']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));};exports[_0x6c1c('0x49')]=function(_0x2450ab,_0x5489ac){return db['UserProfileResource'][_0x6c1c('0x49')]()[_0x6c1c('0x25')](respondWithResult(_0x5489ac,null))['catch'](handleError(_0x5489ac,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 31fd335..fbbc25c 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 _0x0719=['moment','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','sectionId','lodash','../../config/logger','api'];(function(_0x9aad68,_0x45377){var _0x281340=function(_0x494ac1){while(--_0x494ac1){_0x9aad68['push'](_0x9aad68['shift']());}};_0x281340(++_0x45377);}(_0x0719,0x1b9));var _0x9071=function(_0x10fbc1,_0x476574){_0x10fbc1=_0x10fbc1-0x0;var _0x4972f9=_0x0719[_0x10fbc1];return _0x4972f9;};'use strict';var _=require(_0x9071('0x0'));var util=require('util');var logger=require(_0x9071('0x1'))(_0x9071('0x2'));var moment=require(_0x9071('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9071('0x4'));var config=require(_0x9071('0x5'));var attributes=require(_0x9071('0x6'));module[_0x9071('0x7')]=function(_0x30f2b6,_0x2971c8){return _0x30f2b6[_0x9071('0x8')](_0x9071('0x9'),attributes,{'tableName':_0x9071('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x9071('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x45c6=['compositeIndex','sectionId','util','../../config/logger','api','rimraf','../../config/environment','./userProfileResource.attributes','define','user_profile_has_resources'];(function(_0x3cde87,_0x51f278){var _0xed0c48=function(_0x2e55f0){while(--_0x2e55f0){_0x3cde87['push'](_0x3cde87['shift']());}};_0xed0c48(++_0x51f278);}(_0x45c6,0xf2));var _0x645c=function(_0x228afc,_0x220e5f){_0x228afc=_0x228afc-0x0;var _0x5020ce=_0x45c6[_0x228afc];return _0x5020ce;};'use strict';var _=require('lodash');var util=require(_0x645c('0x0'));var logger=require(_0x645c('0x1'))(_0x645c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x645c('0x3'));var config=require(_0x645c('0x4'));var attributes=require(_0x645c('0x5'));module['exports']=function(_0x3a22c7,_0x55b951){return _0x3a22c7[_0x645c('0x6')]('UserProfileResource',attributes,{'tableName':_0x645c('0x7'),'paranoid':![],'indexes':[{'name':_0x645c('0x8'),'fields':['resourceId',_0x645c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index ada12c0..f81e79d 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 _0x7a3e=['message','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a3e,0xf4));var _0xe7a3=function(_0x40ef63,_0x4a5ba1){_0x40ef63=_0x40ef63-0x0;var _0x3fcb6c=_0x7a3e[_0x40ef63];return _0x3fcb6c;};'use strict';var _=require('lodash');var util=require(_0xe7a3('0x0'));var moment=require(_0xe7a3('0x1'));var BPromise=require(_0xe7a3('0x2'));var rs=require(_0xe7a3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe7a3('0x4'));var logger=require(_0xe7a3('0x5'))(_0xe7a3('0x6'));var config=require(_0xe7a3('0x7'));var jayson=require(_0xe7a3('0x8'));var client=jayson[_0xe7a3('0x9')][_0xe7a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e2398,_0x2913a4,_0x840571){return new BPromise(function(_0x533fd6,_0x2b5750){return client['request'](_0x4e2398,_0x840571)[_0xe7a3('0xb')](function(_0x2c4b2c){logger[_0xe7a3('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x2913a4,_0xe7a3('0xd'));logger[_0xe7a3('0xe')](_0xe7a3('0xf'),_0x2913a4,_0xe7a3('0xd'),JSON[_0xe7a3('0x10')](_0x2c4b2c));if(_0x2c4b2c[_0xe7a3('0x11')]){if(_0x2c4b2c[_0xe7a3('0x11')][_0xe7a3('0x12')]===0x1f4){logger[_0xe7a3('0x11')](_0xe7a3('0x13'),_0x2913a4,_0x2c4b2c[_0xe7a3('0x11')]['message']);return _0x2b5750(_0x2c4b2c[_0xe7a3('0x11')][_0xe7a3('0x14')]);}logger[_0xe7a3('0x11')](_0xe7a3('0x13'),_0x2913a4,_0x2c4b2c[_0xe7a3('0x11')]['message']);return _0x533fd6(_0x2c4b2c[_0xe7a3('0x11')][_0xe7a3('0x14')]);}else{logger['info'](_0xe7a3('0x13'),_0x2913a4,'request\x20sent');_0x533fd6(_0x2c4b2c['result'][_0xe7a3('0x14')]);}})[_0xe7a3('0x15')](function(_0x51b575){logger[_0xe7a3('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x2913a4,_0x51b575);_0x2b5750(_0x51b575);});});} \ No newline at end of file +var _0x75d8=['http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x59cfc7,_0x2a7cb3){var _0x46e307=function(_0x404e26){while(--_0x404e26){_0x59cfc7['push'](_0x59cfc7['shift']());}};_0x46e307(++_0x2a7cb3);}(_0x75d8,0x19b));var _0x875d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x875d('0x0'));var util=require('util');var moment=require(_0x875d('0x1'));var BPromise=require(_0x875d('0x2'));var rs=require(_0x875d('0x3'));var fs=require('fs');var Redis=require(_0x875d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x875d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x875d('0x6'));var jayson=require(_0x875d('0x7'));var client=jayson[_0x875d('0x8')][_0x875d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ac9b5,_0x278d6a,_0x575199){return new BPromise(function(_0x3a3651,_0x2d1080){return client[_0x875d('0xa')](_0x2ac9b5,_0x575199)[_0x875d('0xb')](function(_0x1f6ef9){logger[_0x875d('0xc')](_0x875d('0xd'),_0x278d6a,_0x875d('0xe'));logger['debug'](_0x875d('0xf'),_0x278d6a,_0x875d('0xe'),JSON['stringify'](_0x1f6ef9));if(_0x1f6ef9[_0x875d('0x10')]){if(_0x1f6ef9[_0x875d('0x10')]['code']===0x1f4){logger['error'](_0x875d('0xd'),_0x278d6a,_0x1f6ef9[_0x875d('0x10')][_0x875d('0x11')]);return _0x2d1080(_0x1f6ef9[_0x875d('0x10')][_0x875d('0x11')]);}logger['error'](_0x875d('0xd'),_0x278d6a,_0x1f6ef9[_0x875d('0x10')][_0x875d('0x11')]);return _0x3a3651(_0x1f6ef9['error'][_0x875d('0x11')]);}else{logger['info'](_0x875d('0xd'),_0x278d6a,'request\x20sent');_0x3a3651(_0x1f6ef9[_0x875d('0x12')][_0x875d('0x11')]);}})[_0x875d('0x13')](function(_0x42ab71){logger[_0x875d('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x278d6a,_0x42ab71);_0x2d1080(_0x42ab71);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 80e1fd4..5832b14 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 _0xf5ea=['post','create','put','isAuthenticated','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','describe','/:id','show'];(function(_0x499a97,_0x3c278d){var _0xb916fc=function(_0x439f4d){while(--_0x439f4d){_0x499a97['push'](_0x499a97['shift']());}};_0xb916fc(++_0x3c278d);}(_0xf5ea,0x7a));var _0xaf5e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf5ea[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xaf5e('0x0'));var util=require('util');var path=require(_0xaf5e('0x1'));var timeout=require(_0xaf5e('0x2'));var express=require(_0xaf5e('0x3'));var router=express[_0xaf5e('0x4')]();var fs_extra=require(_0xaf5e('0x5'));var auth=require(_0xaf5e('0x6'));var interaction=require(_0xaf5e('0x7'));var config=require(_0xaf5e('0x8'));var controller=require(_0xaf5e('0x9'));router[_0xaf5e('0xa')]('/',auth['isAuthenticated'](),controller[_0xaf5e('0xb')]);router['get'](_0xaf5e('0xc'),auth['isAuthenticated'](),controller[_0xaf5e('0xd')]);router[_0xaf5e('0xa')](_0xaf5e('0xe'),auth['isAuthenticated'](),controller[_0xaf5e('0xf')]);router[_0xaf5e('0x10')]('/',auth['isAuthenticated'](),controller[_0xaf5e('0x11')]);router[_0xaf5e('0x12')](_0xaf5e('0xe'),auth[_0xaf5e('0x13')](),controller[_0xaf5e('0x14')]);router[_0xaf5e('0x15')]('/:id',auth[_0xaf5e('0x13')](),controller[_0xaf5e('0x16')]);module['exports']=router; \ No newline at end of file +var _0x1827=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','multer'];(function(_0x3b4455,_0x3e4395){var _0x34dd09=function(_0x5006d3){while(--_0x5006d3){_0x3b4455['push'](_0x3b4455['shift']());}};_0x34dd09(++_0x3e4395);}(_0x1827,0xaa));var _0x7182=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x1827[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0x7182('0x0'));var util=require(_0x7182('0x1'));var path=require(_0x7182('0x2'));var timeout=require(_0x7182('0x3'));var express=require(_0x7182('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7182('0x5'));var interaction=require(_0x7182('0x6'));var config=require('../../config/environment');var controller=require(_0x7182('0x7'));router['get']('/',auth[_0x7182('0x8')](),controller[_0x7182('0x9')]);router[_0x7182('0xa')](_0x7182('0xb'),auth[_0x7182('0x8')](),controller[_0x7182('0xc')]);router[_0x7182('0xa')](_0x7182('0xd'),auth[_0x7182('0x8')](),controller[_0x7182('0xe')]);router[_0x7182('0xf')]('/',auth[_0x7182('0x8')](),controller[_0x7182('0x10')]);router[_0x7182('0x11')](_0x7182('0xd'),auth['isAuthenticated'](),controller[_0x7182('0x12')]);router['delete'](_0x7182('0xd'),auth[_0x7182('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index eb921de..9ee0225 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 _0x57f8=['join','getDataValue','split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions'];(function(_0x4ea413,_0x51ff3a){var _0x51cf25=function(_0x3c6456){while(--_0x3c6456){_0x4ea413['push'](_0x4ea413['shift']());}};_0x51cf25(++_0x51ff3a);}(_0x57f8,0x198));var _0x857f=function(_0x4e664c,_0x47abb9){_0x4e664c=_0x4e664c-0x0;var _0x5f3913=_0x57f8[_0x4e664c];return _0x5f3913;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'name':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x857f('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x857f('0x1')],'set':function(_0x6f054b){this[_0x857f('0x4')](_0x857f('0x5'),_0x6f054b?_0x6f054b[_0x857f('0x6')](''):[]);},'get':function(){return this[_0x857f('0x7')]('crudPermissions')?this[_0x857f('0x7')](_0x857f('0x5'))[_0x857f('0x8')](''):[];}}}; \ No newline at end of file +var _0x6cb4=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','getDataValue','split','sequelize'];(function(_0x5a2ee0,_0x1a2fe9){var _0x478fe7=function(_0x388b03){while(--_0x388b03){_0x5a2ee0['push'](_0x5a2ee0['shift']());}};_0x478fe7(++_0x1a2fe9);}(_0x6cb4,0xff));var _0x46cb=function(_0x3633db,_0x4f223d){_0x3633db=_0x3633db-0x0;var _0x3e077c=_0x6cb4[_0x3633db];return _0x3e077c;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'name':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x46cb('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x46cb('0x2')],'set':function(_0x2efd19){this['setDataValue'](_0x46cb('0x5'),_0x2efd19?_0x2efd19['join'](''):[]);},'get':function(){return this[_0x46cb('0x6')]('crudPermissions')?this[_0x46cb('0x6')](_0x46cb('0x5'))[_0x46cb('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 87ef4f3..03c0a66 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 _0x7d69=['index','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','options','UserProfileSection','includeAll','findAll','rows','catch','include','find','create','body','update','params','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','ejs','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','then','error','stack','name','send'];(function(_0x5f39e3,_0x146b26){var _0x28bc83=function(_0x1aaf4d){while(--_0x1aaf4d){_0x5f39e3['push'](_0x5f39e3['shift']());}};_0x28bc83(++_0x146b26);}(_0x7d69,0x1ed));var _0x97d6=function(_0x459f30,_0x51c800){_0x459f30=_0x459f30-0x0;var _0xb7b8e8=_0x7d69[_0x459f30];return _0xb7b8e8;};'use strict';var emlformat=require(_0x97d6('0x0'));var rimraf=require(_0x97d6('0x1'));var zipdir=require(_0x97d6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x97d6('0x3'));var BPromise=require(_0x97d6('0x4'));var Mustache=require(_0x97d6('0x5'));var util=require('util');var path=require(_0x97d6('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x97d6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x97d6('0x8'));var crypto=require('crypto');var jsforce=require(_0x97d6('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x97d6('0xa'));var Redis=require('ioredis');var authService=require(_0x97d6('0xb'));var qs=require(_0x97d6('0xc'));var as=require(_0x97d6('0xd'));var hardwareService=require(_0x97d6('0xe'));var logger=require(_0x97d6('0xf'))(_0x97d6('0x10'));var utils=require(_0x97d6('0x11'));var config=require(_0x97d6('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x97d6('0x13'))['db'];function respondWithStatusCode(_0x5fae3f,_0x36653c){_0x36653c=_0x36653c||0xcc;return function(_0x302cd0){if(_0x302cd0){return _0x5fae3f['sendStatus'](_0x36653c);}return _0x5fae3f[_0x97d6('0x14')](_0x36653c)[_0x97d6('0x15')]();};}function respondWithResult(_0x29f8e5,_0x549c45){_0x549c45=_0x549c45||0xc8;return function(_0x77c02a){if(_0x77c02a){return _0x29f8e5[_0x97d6('0x14')](_0x549c45)[_0x97d6('0x16')](_0x77c02a);}};}function respondWithFilteredResult(_0x52278e,_0x57e22e){return function(_0x273d9f){if(_0x273d9f){var _0x56c5f1=typeof _0x57e22e[_0x97d6('0x17')]==='undefined'&&typeof _0x57e22e[_0x97d6('0x18')]===_0x97d6('0x19');var _0x309a55=_0x273d9f['count'];var _0xa61f9a=_0x56c5f1?0x0:_0x57e22e['offset'];var _0x44e926=_0x56c5f1?_0x273d9f[_0x97d6('0x1a')]:_0x57e22e[_0x97d6('0x17')]+_0x57e22e['limit'];var _0x38f2ad;if(_0x44e926>=_0x309a55){_0x44e926=_0x309a55;_0x38f2ad=0xc8;}else{_0x38f2ad=0xce;}_0x52278e[_0x97d6('0x14')](_0x38f2ad);return _0x52278e['set'](_0x97d6('0x1b'),_0xa61f9a+'-'+_0x44e926+'/'+_0x309a55)[_0x97d6('0x16')](_0x273d9f);}return null;};}function patchUpdates(_0xc8382f){return function(_0x5756d6){try{jsonpatch[_0x97d6('0x1c')](_0x5756d6,_0xc8382f,!![]);}catch(_0x9633af){return BPromise[_0x97d6('0x1d')](_0x9633af);}return _0x5756d6['save']();};}function saveUpdates(_0x2e757f,_0x210882){return function(_0x5b940d){if(_0x5b940d){return _0x5b940d['update'](_0x2e757f)[_0x97d6('0x1e')](function(_0x444282){return _0x444282;});}return null;};}function removeEntity(_0x351aad,_0x3a3bb5){return function(_0x2bf134){if(_0x2bf134){return _0x2bf134['destroy']()[_0x97d6('0x1e')](function(){_0x351aad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c70f0,_0x27b43f){return function(_0x3a03f0){if(!_0x3a03f0){_0x3c70f0['sendStatus'](0x194);}return _0x3a03f0;};}function handleError(_0x3e2f50,_0x780e1c){_0x780e1c=_0x780e1c||0x1f4;return function(_0x45aae2){logger[_0x97d6('0x1f')](_0x45aae2[_0x97d6('0x20')]);if(_0x45aae2[_0x97d6('0x21')]){delete _0x45aae2['name'];}_0x3e2f50[_0x97d6('0x14')](_0x780e1c)[_0x97d6('0x22')](_0x45aae2);};}exports[_0x97d6('0x23')]=function(_0x3e9d12,_0x5e0b40){var _0x17f8e6={},_0x1b7e19={},_0x3c9009={'count':0x0,'rows':[]};var _0x461f46=_['map'](db['UserProfileSection']['rawAttributes'],function(_0x1ee2ca){return{'name':_0x1ee2ca['fieldName'],'type':_0x1ee2ca[_0x97d6('0x24')]['key']};});_0x1b7e19['model']=_['map'](_0x461f46,_0x97d6('0x21'));_0x1b7e19[_0x97d6('0x25')]=_[_0x97d6('0x26')](_0x3e9d12[_0x97d6('0x25')]);_0x1b7e19[_0x97d6('0x27')]=_[_0x97d6('0x28')](_0x1b7e19['model'],_0x1b7e19[_0x97d6('0x25')]);_0x17f8e6[_0x97d6('0x29')]=_[_0x97d6('0x28')](_0x1b7e19[_0x97d6('0x2a')],qs[_0x97d6('0x2b')](_0x3e9d12['query'][_0x97d6('0x2b')]));_0x17f8e6[_0x97d6('0x29')]=_0x17f8e6[_0x97d6('0x29')][_0x97d6('0x2c')]?_0x17f8e6['attributes']:_0x1b7e19[_0x97d6('0x2a')];if(!_0x3e9d12[_0x97d6('0x25')][_0x97d6('0x2d')](_0x97d6('0x2e'))){_0x17f8e6[_0x97d6('0x18')]=qs[_0x97d6('0x18')](_0x3e9d12[_0x97d6('0x25')][_0x97d6('0x18')]);_0x17f8e6['offset']=qs[_0x97d6('0x17')](_0x3e9d12[_0x97d6('0x25')][_0x97d6('0x17')]);}_0x17f8e6[_0x97d6('0x2f')]=qs['sort'](_0x3e9d12[_0x97d6('0x25')]['sort']);_0x17f8e6[_0x97d6('0x30')]=qs[_0x97d6('0x27')](_['pick'](_0x3e9d12[_0x97d6('0x25')],_0x1b7e19[_0x97d6('0x27')]),_0x461f46);if(_0x3e9d12['query'][_0x97d6('0x31')]){_0x17f8e6[_0x97d6('0x30')]=_['merge'](_0x17f8e6[_0x97d6('0x30')],{'$or':_['map'](_0x461f46,function(_0x2c3217){if(_0x2c3217[_0x97d6('0x24')]!==_0x97d6('0x32')){var _0x20306c={};_0x20306c[_0x2c3217[_0x97d6('0x21')]]={'$like':'%'+_0x3e9d12[_0x97d6('0x25')][_0x97d6('0x31')]+'%'};return _0x20306c;}})});}_0x17f8e6=_[_0x97d6('0x33')]({},_0x17f8e6,_0x3e9d12[_0x97d6('0x34')]);var _0x22470={'where':_0x17f8e6[_0x97d6('0x30')]};return db[_0x97d6('0x35')][_0x97d6('0x1a')](_0x22470)[_0x97d6('0x1e')](function(_0x3817d3){_0x3c9009['count']=_0x3817d3;if(_0x3e9d12['query'][_0x97d6('0x36')]){_0x17f8e6['include']=[{'all':!![]}];}return db[_0x97d6('0x35')][_0x97d6('0x37')](_0x17f8e6);})[_0x97d6('0x1e')](function(_0x3c97a6){_0x3c9009[_0x97d6('0x38')]=_0x3c97a6;return _0x3c9009;})[_0x97d6('0x1e')](respondWithFilteredResult(_0x5e0b40,_0x17f8e6))[_0x97d6('0x39')](handleError(_0x5e0b40,null));};exports['show']=function(_0x1d24af,_0x2369ec){var _0x11f808={'raw':![],'where':{'id':_0x1d24af['params']['id']}},_0x4de8a5={};_0x4de8a5['model']=_[_0x97d6('0x26')](db[_0x97d6('0x35')]['rawAttributes']);_0x4de8a5['query']=_[_0x97d6('0x26')](_0x1d24af[_0x97d6('0x25')]);_0x4de8a5[_0x97d6('0x27')]=_[_0x97d6('0x28')](_0x4de8a5[_0x97d6('0x2a')],_0x4de8a5[_0x97d6('0x25')]);_0x11f808[_0x97d6('0x29')]=_[_0x97d6('0x28')](_0x4de8a5['model'],qs['fields'](_0x1d24af[_0x97d6('0x25')]['fields']));_0x11f808['attributes']=_0x11f808['attributes'][_0x97d6('0x2c')]?_0x11f808['attributes']:_0x4de8a5[_0x97d6('0x2a')];if(_0x1d24af[_0x97d6('0x25')]['includeAll']){_0x11f808[_0x97d6('0x3a')]=[{'all':!![]}];}_0x11f808=_[_0x97d6('0x33')]({},_0x11f808,_0x1d24af['options']);return db['UserProfileSection'][_0x97d6('0x3b')](_0x11f808)[_0x97d6('0x1e')](handleEntityNotFound(_0x2369ec,null))['then'](respondWithResult(_0x2369ec,null))[_0x97d6('0x39')](handleError(_0x2369ec,null));};exports[_0x97d6('0x3c')]=function(_0x1b7dc7,_0x3c54d1){return db[_0x97d6('0x35')]['create'](_0x1b7dc7[_0x97d6('0x3d')],{})[_0x97d6('0x1e')](respondWithResult(_0x3c54d1,0xc9))[_0x97d6('0x39')](handleError(_0x3c54d1,null));};exports[_0x97d6('0x3e')]=function(_0xe02f89,_0x325dcb){if(_0xe02f89[_0x97d6('0x3d')]['id']){delete _0xe02f89[_0x97d6('0x3d')]['id'];}return db[_0x97d6('0x35')][_0x97d6('0x3b')]({'where':{'id':_0xe02f89[_0x97d6('0x3f')]['id']}})[_0x97d6('0x1e')](handleEntityNotFound(_0x325dcb,null))[_0x97d6('0x1e')](saveUpdates(_0xe02f89['body'],null))[_0x97d6('0x1e')](respondWithResult(_0x325dcb,null))['catch'](handleError(_0x325dcb,null));};exports[_0x97d6('0x40')]=function(_0x3423bd,_0x50d1f4){return db[_0x97d6('0x35')][_0x97d6('0x3b')]({'where':{'id':_0x3423bd[_0x97d6('0x3f')]['id']}})[_0x97d6('0x1e')](handleEntityNotFound(_0x50d1f4,null))[_0x97d6('0x1e')](removeEntity(_0x50d1f4,null))[_0x97d6('0x39')](handleError(_0x50d1f4,null));};exports['describe']=function(_0x28efff,_0x1c152b){return db['UserProfileSection'][_0x97d6('0x41')]()['then'](respondWithResult(_0x1c152b,null))[_0x97d6('0x39')](handleError(_0x1c152b,null));}; \ No newline at end of file +var _0x23b6=['save','update','then','destroy','end','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','offset','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','findAll','rows','catch','include','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x2ec9c5,_0xdef260){var _0x236adf=function(_0x100e50){while(--_0x100e50){_0x2ec9c5['push'](_0x2ec9c5['shift']());}};_0x236adf(++_0xdef260);}(_0x23b6,0x108));var _0x623b=function(_0x480957,_0x2632b7){_0x480957=_0x480957-0x0;var _0x5101d3=_0x23b6[_0x480957];return _0x5101d3;};'use strict';var emlformat=require(_0x623b('0x0'));var rimraf=require(_0x623b('0x1'));var zipdir=require(_0x623b('0x2'));var jsonpatch=require(_0x623b('0x3'));var rp=require(_0x623b('0x4'));var moment=require(_0x623b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x623b('0x6'));var util=require(_0x623b('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x623b('0x8'));var fs=require('fs');var fs_extra=require(_0x623b('0x9'));var _=require(_0x623b('0xa'));var squel=require('squel');var crypto=require(_0x623b('0xb'));var jsforce=require(_0x623b('0xc'));var deskjs=require(_0x623b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x623b('0xe'));var Papa=require('papaparse');var Redis=require(_0x623b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x623b('0x10'));var as=require(_0x623b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x623b('0x12'))('api');var utils=require(_0x623b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x623b('0x14'));var db=require(_0x623b('0x15'))['db'];function respondWithStatusCode(_0xaa1d8,_0x12cd26){_0x12cd26=_0x12cd26||0xcc;return function(_0x260312){if(_0x260312){return _0xaa1d8[_0x623b('0x16')](_0x12cd26);}return _0xaa1d8[_0x623b('0x17')](_0x12cd26)['end']();};}function respondWithResult(_0x449a96,_0x401ba5){_0x401ba5=_0x401ba5||0xc8;return function(_0x11503f){if(_0x11503f){return _0x449a96[_0x623b('0x17')](_0x401ba5)[_0x623b('0x18')](_0x11503f);}};}function respondWithFilteredResult(_0x5510a4,_0x1ef953){return function(_0x4a7bf2){if(_0x4a7bf2){var _0x178814=typeof _0x1ef953['offset']===_0x623b('0x19')&&typeof _0x1ef953[_0x623b('0x1a')]==='undefined';var _0x196638=_0x4a7bf2['count'];var _0x25d653=_0x178814?0x0:_0x1ef953['offset'];var _0x542b69=_0x178814?_0x4a7bf2[_0x623b('0x1b')]:_0x1ef953['offset']+_0x1ef953[_0x623b('0x1a')];var _0xddeb7a;if(_0x542b69>=_0x196638){_0x542b69=_0x196638;_0xddeb7a=0xc8;}else{_0xddeb7a=0xce;}_0x5510a4[_0x623b('0x17')](_0xddeb7a);return _0x5510a4[_0x623b('0x1c')](_0x623b('0x1d'),_0x25d653+'-'+_0x542b69+'/'+_0x196638)[_0x623b('0x18')](_0x4a7bf2);}return null;};}function patchUpdates(_0x5e48f5){return function(_0x271db2){try{jsonpatch[_0x623b('0x1e')](_0x271db2,_0x5e48f5,!![]);}catch(_0x26e092){return BPromise[_0x623b('0x1f')](_0x26e092);}return _0x271db2[_0x623b('0x20')]();};}function saveUpdates(_0x3d6443,_0x82de29){return function(_0x109f35){if(_0x109f35){return _0x109f35[_0x623b('0x21')](_0x3d6443)[_0x623b('0x22')](function(_0x263261){return _0x263261;});}return null;};}function removeEntity(_0x19e15e,_0x40efc6){return function(_0x1b64bc){if(_0x1b64bc){return _0x1b64bc[_0x623b('0x23')]()[_0x623b('0x22')](function(){_0x19e15e[_0x623b('0x17')](0xcc)[_0x623b('0x24')]();});}};}function handleEntityNotFound(_0x3a389a,_0x441e1f){return function(_0x4f73b3){if(!_0x4f73b3){_0x3a389a[_0x623b('0x16')](0x194);}return _0x4f73b3;};}function handleError(_0x13d283,_0x3dce59){_0x3dce59=_0x3dce59||0x1f4;return function(_0x174d49){logger[_0x623b('0x25')](_0x174d49[_0x623b('0x26')]);if(_0x174d49[_0x623b('0x27')]){delete _0x174d49[_0x623b('0x27')];}_0x13d283[_0x623b('0x17')](_0x3dce59)[_0x623b('0x28')](_0x174d49);};}exports[_0x623b('0x29')]=function(_0x462d6e,_0x5aec36){var _0x3ef60c={},_0x30415c={},_0x585a74={'count':0x0,'rows':[]};var _0xc61add=_[_0x623b('0x2a')](db[_0x623b('0x2b')][_0x623b('0x2c')],function(_0x2b7544){return{'name':_0x2b7544[_0x623b('0x2d')],'type':_0x2b7544['type'][_0x623b('0x2e')]};});_0x30415c['model']=_['map'](_0xc61add,_0x623b('0x27'));_0x30415c[_0x623b('0x2f')]=_[_0x623b('0x30')](_0x462d6e['query']);_0x30415c['filters']=_[_0x623b('0x31')](_0x30415c[_0x623b('0x32')],_0x30415c[_0x623b('0x2f')]);_0x3ef60c[_0x623b('0x33')]=_[_0x623b('0x31')](_0x30415c[_0x623b('0x32')],qs[_0x623b('0x34')](_0x462d6e[_0x623b('0x2f')][_0x623b('0x34')]));_0x3ef60c[_0x623b('0x33')]=_0x3ef60c['attributes'][_0x623b('0x35')]?_0x3ef60c[_0x623b('0x33')]:_0x30415c[_0x623b('0x32')];if(!_0x462d6e['query']['hasOwnProperty'](_0x623b('0x36'))){_0x3ef60c[_0x623b('0x1a')]=qs[_0x623b('0x1a')](_0x462d6e[_0x623b('0x2f')][_0x623b('0x1a')]);_0x3ef60c[_0x623b('0x37')]=qs[_0x623b('0x37')](_0x462d6e['query'][_0x623b('0x37')]);}_0x3ef60c[_0x623b('0x38')]=qs[_0x623b('0x39')](_0x462d6e[_0x623b('0x2f')]['sort']);_0x3ef60c[_0x623b('0x3a')]=qs[_0x623b('0x3b')](_[_0x623b('0x3c')](_0x462d6e[_0x623b('0x2f')],_0x30415c[_0x623b('0x3b')]),_0xc61add);if(_0x462d6e[_0x623b('0x2f')]['filter']){_0x3ef60c[_0x623b('0x3a')]=_['merge'](_0x3ef60c['where'],{'$or':_['map'](_0xc61add,function(_0x3327c3){if(_0x3327c3['type']!==_0x623b('0x3d')){var _0xa7f31={};_0xa7f31[_0x3327c3[_0x623b('0x27')]]={'$like':'%'+_0x462d6e['query']['filter']+'%'};return _0xa7f31;}})});}_0x3ef60c=_[_0x623b('0x3e')]({},_0x3ef60c,_0x462d6e[_0x623b('0x3f')]);var _0x11c310={'where':_0x3ef60c[_0x623b('0x3a')]};return db[_0x623b('0x2b')][_0x623b('0x1b')](_0x11c310)['then'](function(_0x5c5cd8){_0x585a74[_0x623b('0x1b')]=_0x5c5cd8;if(_0x462d6e[_0x623b('0x2f')][_0x623b('0x40')]){_0x3ef60c['include']=[{'all':!![]}];}return db[_0x623b('0x2b')][_0x623b('0x41')](_0x3ef60c);})[_0x623b('0x22')](function(_0x36310d){_0x585a74[_0x623b('0x42')]=_0x36310d;return _0x585a74;})['then'](respondWithFilteredResult(_0x5aec36,_0x3ef60c))[_0x623b('0x43')](handleError(_0x5aec36,null));};exports['show']=function(_0x56eca3,_0x2a5c4c){var _0x26d499={'raw':![],'where':{'id':_0x56eca3['params']['id']}},_0x300e8e={};_0x300e8e['model']=_['keys'](db['UserProfileSection'][_0x623b('0x2c')]);_0x300e8e[_0x623b('0x2f')]=_['keys'](_0x56eca3[_0x623b('0x2f')]);_0x300e8e[_0x623b('0x3b')]=_['intersection'](_0x300e8e['model'],_0x300e8e[_0x623b('0x2f')]);_0x26d499[_0x623b('0x33')]=_[_0x623b('0x31')](_0x300e8e[_0x623b('0x32')],qs[_0x623b('0x34')](_0x56eca3[_0x623b('0x2f')]['fields']));_0x26d499[_0x623b('0x33')]=_0x26d499[_0x623b('0x33')]['length']?_0x26d499['attributes']:_0x300e8e[_0x623b('0x32')];if(_0x56eca3['query'][_0x623b('0x40')]){_0x26d499[_0x623b('0x44')]=[{'all':!![]}];}_0x26d499=_[_0x623b('0x3e')]({},_0x26d499,_0x56eca3[_0x623b('0x3f')]);return db[_0x623b('0x2b')]['find'](_0x26d499)[_0x623b('0x22')](handleEntityNotFound(_0x2a5c4c,null))['then'](respondWithResult(_0x2a5c4c,null))['catch'](handleError(_0x2a5c4c,null));};exports[_0x623b('0x45')]=function(_0x2d29b2,_0x37a5cd){return db[_0x623b('0x2b')][_0x623b('0x45')](_0x2d29b2[_0x623b('0x46')],{})[_0x623b('0x22')](respondWithResult(_0x37a5cd,0xc9))[_0x623b('0x43')](handleError(_0x37a5cd,null));};exports['update']=function(_0x436193,_0x3fceb2){if(_0x436193[_0x623b('0x46')]['id']){delete _0x436193['body']['id'];}return db['UserProfileSection'][_0x623b('0x47')]({'where':{'id':_0x436193[_0x623b('0x48')]['id']}})['then'](handleEntityNotFound(_0x3fceb2,null))[_0x623b('0x22')](saveUpdates(_0x436193['body'],null))[_0x623b('0x22')](respondWithResult(_0x3fceb2,null))['catch'](handleError(_0x3fceb2,null));};exports[_0x623b('0x23')]=function(_0x669b2a,_0x5c17a9){return db[_0x623b('0x2b')][_0x623b('0x47')]({'where':{'id':_0x669b2a[_0x623b('0x48')]['id']}})[_0x623b('0x22')](handleEntityNotFound(_0x5c17a9,null))['then'](removeEntity(_0x5c17a9,null))[_0x623b('0x43')](handleError(_0x5c17a9,null));};exports[_0x623b('0x49')]=function(_0x1e9a62,_0x1ba8a0){return db[_0x623b('0x2b')][_0x623b('0x49')]()[_0x623b('0x22')](respondWithResult(_0x1ba8a0,null))[_0x623b('0x43')](handleError(_0x1ba8a0,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 438a876..8b59da2 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 _0x3ada=['user_profile_has_sections','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x3ada,0x12f));var _0xa3ad=function(_0x39ebdb,_0x2ae24a){_0x39ebdb=_0x39ebdb-0x0;var _0x402bcd=_0x3ada[_0x39ebdb];return _0x402bcd;};'use strict';var _=require(_0xa3ad('0x0'));var util=require(_0xa3ad('0x1'));var logger=require(_0xa3ad('0x2'))(_0xa3ad('0x3'));var moment=require(_0xa3ad('0x4'));var BPromise=require('bluebird');var rp=require(_0xa3ad('0x5'));var fs=require('fs');var path=require(_0xa3ad('0x6'));var rimraf=require('rimraf');var config=require(_0xa3ad('0x7'));var attributes=require(_0xa3ad('0x8'));module[_0xa3ad('0x9')]=function(_0x515743,_0xb89c1f){return _0x515743[_0xa3ad('0xa')](_0xa3ad('0xb'),attributes,{'tableName':_0xa3ad('0xc'),'paranoid':![],'indexes':[{'name':_0xa3ad('0xd'),'fields':[_0xa3ad('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5341=['userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define'];(function(_0x3b3dcb,_0x5c873f){var _0x4054b4=function(_0xe22238){while(--_0xe22238){_0x3b3dcb['push'](_0x3b3dcb['shift']());}};_0x4054b4(++_0x5c873f);}(_0x5341,0x194));var _0x1534=function(_0x4e43fa,_0x455817){_0x4e43fa=_0x4e43fa-0x0;var _0x2bab3e=_0x5341[_0x4e43fa];return _0x2bab3e;};'use strict';var _=require(_0x1534('0x0'));var util=require(_0x1534('0x1'));var logger=require(_0x1534('0x2'))(_0x1534('0x3'));var moment=require(_0x1534('0x4'));var BPromise=require(_0x1534('0x5'));var rp=require(_0x1534('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1534('0x7'));var config=require(_0x1534('0x8'));var attributes=require(_0x1534('0x9'));module[_0x1534('0xa')]=function(_0x1f329c,_0x5b6d51){return _0x1f329c[_0x1534('0xb')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x1534('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 6a79225..4b885b9 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 _0x6d31=['rpc','../../config/environment','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x6d31,0x1d2));var _0x16d3=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x6d31[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x16d3('0x0'));var util=require(_0x16d3('0x1'));var moment=require(_0x16d3('0x2'));var BPromise=require(_0x16d3('0x3'));var rs=require(_0x16d3('0x4'));var fs=require('fs');var Redis=require(_0x16d3('0x5'));var db=require(_0x16d3('0x6'))['db'];var utils=require(_0x16d3('0x7'));var logger=require(_0x16d3('0x8'))(_0x16d3('0x9'));var config=require(_0x16d3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x16d3('0xb')][_0x16d3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50039f,_0x56472c,_0x545ce4){return new BPromise(function(_0x555f13,_0x750aae){return client[_0x16d3('0xd')](_0x50039f,_0x545ce4)[_0x16d3('0xe')](function(_0x5f2a80){logger[_0x16d3('0xf')](_0x16d3('0x10'),_0x56472c,_0x16d3('0x11'));logger[_0x16d3('0x12')](_0x16d3('0x13'),_0x56472c,'request\x20sent',JSON[_0x16d3('0x14')](_0x5f2a80));if(_0x5f2a80[_0x16d3('0x15')]){if(_0x5f2a80[_0x16d3('0x15')][_0x16d3('0x16')]===0x1f4){logger[_0x16d3('0x15')](_0x16d3('0x10'),_0x56472c,_0x5f2a80['error']['message']);return _0x750aae(_0x5f2a80[_0x16d3('0x15')][_0x16d3('0x17')]);}logger[_0x16d3('0x15')](_0x16d3('0x10'),_0x56472c,_0x5f2a80[_0x16d3('0x15')][_0x16d3('0x17')]);return _0x555f13(_0x5f2a80[_0x16d3('0x15')][_0x16d3('0x17')]);}else{logger[_0x16d3('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x56472c,_0x16d3('0x11'));_0x555f13(_0x5f2a80['result'][_0x16d3('0x17')]);}})[_0x16d3('0x18')](function(_0x278ff8){logger[_0x16d3('0x15')](_0x16d3('0x10'),_0x56472c,_0x278ff8);_0x750aae(_0x278ff8);});});} \ No newline at end of file +var _0xb190=['UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent'];(function(_0x417d6a,_0x51c87a){var _0x305d2b=function(_0x574890){while(--_0x574890){_0x417d6a['push'](_0x417d6a['shift']());}};_0x305d2b(++_0x51c87a);}(_0xb190,0xce));var _0x0b19=function(_0x20f644,_0x157f57){_0x20f644=_0x20f644-0x0;var _0xfb015a=_0xb190[_0x20f644];return _0xfb015a;};'use strict';var _=require(_0x0b19('0x0'));var util=require(_0x0b19('0x1'));var moment=require(_0x0b19('0x2'));var BPromise=require(_0x0b19('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b19('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b19('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0b19('0x6'));var client=jayson[_0x0b19('0x7')][_0x0b19('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x580631,_0x2eee82,_0x4d8ad0){return new BPromise(function(_0x4c52a7,_0x4bc54b){return client[_0x0b19('0x9')](_0x580631,_0x4d8ad0)[_0x0b19('0xa')](function(_0x116562){logger[_0x0b19('0xb')](_0x0b19('0xc'),_0x2eee82,_0x0b19('0xd'));logger['debug'](_0x0b19('0xe'),_0x2eee82,_0x0b19('0xd'),JSON[_0x0b19('0xf')](_0x116562));if(_0x116562[_0x0b19('0x10')]){if(_0x116562['error'][_0x0b19('0x11')]===0x1f4){logger['error'](_0x0b19('0xc'),_0x2eee82,_0x116562[_0x0b19('0x10')][_0x0b19('0x12')]);return _0x4bc54b(_0x116562[_0x0b19('0x10')][_0x0b19('0x12')]);}logger['error'](_0x0b19('0xc'),_0x2eee82,_0x116562[_0x0b19('0x10')][_0x0b19('0x12')]);return _0x4c52a7(_0x116562[_0x0b19('0x10')][_0x0b19('0x12')]);}else{logger[_0x0b19('0xb')](_0x0b19('0xc'),_0x2eee82,_0x0b19('0xd'));_0x4c52a7(_0x116562['result'][_0x0b19('0x12')]);}})[_0x0b19('0x13')](function(_0x345e80){logger[_0x0b19('0x10')](_0x0b19('0xc'),_0x2eee82,_0x345e80);_0x4bc54b(_0x345e80);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 1781cc6..47efd77 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x505684,_0x2c1dc9){var _0x4389b0=function(_0x86b26e){while(--_0x86b26e){_0x505684['push'](_0x505684['shift']());}};_0x4389b0(++_0x2c1dc9);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'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(_0x45001e,_0x5d8c96){var _0x2ae97c=function(_0x8b8528){while(--_0x8b8528){_0x45001e['push'](_0x45001e['shift']());}};_0x2ae97c(++_0x5d8c96);}(_0x70e0,0x17b));var _0x070e=function(_0x497af8,_0x3d0a0c){_0x497af8=_0x497af8-0x0;var _0x1fe7c7=_0x70e0[_0x497af8];return _0x1fe7c7;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 1948fa9..0b2116c 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 _0xaf08=['sequelize','INTEGER'];(function(_0x317cb1,_0x2ada0b){var _0x302c43=function(_0x5c5250){while(--_0x5c5250){_0x317cb1['push'](_0x317cb1['shift']());}};_0x302c43(++_0x2ada0b);}(_0xaf08,0x1a0));var _0x8af0=function(_0x10e8ed,_0x384a0d){_0x10e8ed=_0x10e8ed-0x0;var _0x4aea4a=_0xaf08[_0x10e8ed];return _0x4aea4a;};'use strict';var Sequelize=require(_0x8af0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8af0('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9acd=['sequelize','exports'];(function(_0xbb5075,_0x50d7f5){var _0x902d8=function(_0x172f20){while(--_0x172f20){_0xbb5075['push'](_0xbb5075['shift']());}};_0x902d8(++_0x50d7f5);}(_0x9acd,0x76));var _0xd9ac=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9acd[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0xd9ac('0x0'));module[_0xd9ac('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 9e0a92b..e5e671a 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 _0xe944=['define','UserSmsQueue','user_has_sms_queues','lodash','api','request-promise','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x38c337,_0x53d9bd){var _0x3ff8d0=function(_0x269ca8){while(--_0x269ca8){_0x38c337['push'](_0x38c337['shift']());}};_0x3ff8d0(++_0x53d9bd);}(_0xe944,0x174));var _0x4e94=function(_0x5b2f0b,_0x3c8643){_0x5b2f0b=_0x5b2f0b-0x0;var _0x209b96=_0xe944[_0x5b2f0b];return _0x209b96;};'use strict';var _=require(_0x4e94('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4e94('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e94('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4e94('0x3'));var attributes=require(_0x4e94('0x4'));module[_0x4e94('0x5')]=function(_0xbb43ae,_0x4d00e5){return _0xbb43ae[_0x4e94('0x6')](_0x4e94('0x7'),attributes,{'tableName':_0x4e94('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb22=['./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0xcb22,0xc8));var _0x2cb2=function(_0x15715b,_0x13d172){_0x15715b=_0x15715b-0x0;var _0x50b870=_0xcb22[_0x15715b];return _0x50b870;};'use strict';var _=require(_0x2cb2('0x0'));var util=require(_0x2cb2('0x1'));var logger=require(_0x2cb2('0x2'))(_0x2cb2('0x3'));var moment=require(_0x2cb2('0x4'));var BPromise=require(_0x2cb2('0x5'));var rp=require(_0x2cb2('0x6'));var fs=require('fs');var path=require(_0x2cb2('0x7'));var rimraf=require(_0x2cb2('0x8'));var config=require(_0x2cb2('0x9'));var attributes=require(_0x2cb2('0xa'));module['exports']=function(_0x77ae56,_0x3582d7){return _0x77ae56[_0x2cb2('0xb')](_0x2cb2('0xc'),attributes,{'tableName':_0x2cb2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 52d10a5..1d999ea 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 _0x9609=['UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c9bd4,_0x187233){var _0x17ab46=function(_0x295cf7){while(--_0x295cf7){_0x3c9bd4['push'](_0x3c9bd4['shift']());}};_0x17ab46(++_0x187233);}(_0x9609,0x11d));var _0x9960=function(_0x455b4f,_0x437b0e){_0x455b4f=_0x455b4f-0x0;var _0x258e3=_0x9609[_0x455b4f];return _0x258e3;};'use strict';var _=require(_0x9960('0x0'));var util=require(_0x9960('0x1'));var moment=require('moment');var BPromise=require(_0x9960('0x2'));var rs=require(_0x9960('0x3'));var fs=require('fs');var Redis=require(_0x9960('0x4'));var db=require(_0x9960('0x5'))['db'];var utils=require(_0x9960('0x6'));var logger=require('../../config/logger')(_0x9960('0x7'));var config=require(_0x9960('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9960('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a84ad,_0x40d7c8,_0x584ffc){return new BPromise(function(_0x406d85,_0x316d82){return client[_0x9960('0xa')](_0x1a84ad,_0x584ffc)['then'](function(_0x127c4d){logger[_0x9960('0xb')](_0x9960('0xc'),_0x40d7c8,_0x9960('0xd'));logger[_0x9960('0xe')](_0x9960('0xf'),_0x40d7c8,_0x9960('0xd'),JSON['stringify'](_0x127c4d));if(_0x127c4d[_0x9960('0x10')]){if(_0x127c4d[_0x9960('0x10')]['code']===0x1f4){logger[_0x9960('0x10')](_0x9960('0xc'),_0x40d7c8,_0x127c4d[_0x9960('0x10')][_0x9960('0x11')]);return _0x316d82(_0x127c4d[_0x9960('0x10')][_0x9960('0x11')]);}logger[_0x9960('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x40d7c8,_0x127c4d[_0x9960('0x10')][_0x9960('0x11')]);return _0x406d85(_0x127c4d[_0x9960('0x10')][_0x9960('0x11')]);}else{logger[_0x9960('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x40d7c8,'request\x20sent');_0x406d85(_0x127c4d[_0x9960('0x12')][_0x9960('0x11')]);}})[_0x9960('0x13')](function(_0x50078a){logger['error'](_0x9960('0xc'),_0x40d7c8,_0x50078a);_0x316d82(_0x50078a);});});} \ No newline at end of file +var _0xa2f8=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x4be4a7,_0x61cf04){var _0x446899=function(_0x26affc){while(--_0x26affc){_0x4be4a7['push'](_0x4be4a7['shift']());}};_0x446899(++_0x61cf04);}(_0xa2f8,0xb9));var _0x8a2f=function(_0x40c098,_0x361fc6){_0x40c098=_0x40c098-0x0;var _0x4fe0b4=_0xa2f8[_0x40c098];return _0x4fe0b4;};'use strict';var _=require(_0x8a2f('0x0'));var util=require('util');var moment=require(_0x8a2f('0x1'));var BPromise=require(_0x8a2f('0x2'));var rs=require(_0x8a2f('0x3'));var fs=require('fs');var Redis=require(_0x8a2f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a2f('0x5'));var logger=require(_0x8a2f('0x6'))(_0x8a2f('0x7'));var config=require('../../config/environment');var jayson=require(_0x8a2f('0x8'));var client=jayson[_0x8a2f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4484ab,_0x319ce6,_0x1adfb8){return new BPromise(function(_0x3a6b44,_0x34c772){return client[_0x8a2f('0xa')](_0x4484ab,_0x1adfb8)[_0x8a2f('0xb')](function(_0x19a275){logger[_0x8a2f('0xc')](_0x8a2f('0xd'),_0x319ce6,_0x8a2f('0xe'));logger['debug'](_0x8a2f('0xf'),_0x319ce6,_0x8a2f('0xe'),JSON[_0x8a2f('0x10')](_0x19a275));if(_0x19a275[_0x8a2f('0x11')]){if(_0x19a275[_0x8a2f('0x11')][_0x8a2f('0x12')]===0x1f4){logger[_0x8a2f('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x319ce6,_0x19a275[_0x8a2f('0x11')]['message']);return _0x34c772(_0x19a275[_0x8a2f('0x11')][_0x8a2f('0x13')]);}logger[_0x8a2f('0x11')](_0x8a2f('0xd'),_0x319ce6,_0x19a275[_0x8a2f('0x11')][_0x8a2f('0x13')]);return _0x3a6b44(_0x19a275[_0x8a2f('0x11')][_0x8a2f('0x13')]);}else{logger['info'](_0x8a2f('0xd'),_0x319ce6,_0x8a2f('0xe'));_0x3a6b44(_0x19a275[_0x8a2f('0x14')][_0x8a2f('0x13')]);}})[_0x8a2f('0x15')](function(_0x32420c){logger[_0x8a2f('0x11')](_0x8a2f('0xd'),_0x319ce6,_0x32420c);_0x34c772(_0x32420c);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 574b80a..dda7e72 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 _0xb97c=['exports','INTEGER'];(function(_0x1d39f6,_0x146f4a){var _0x3dbd7a=function(_0x4486f2){while(--_0x4486f2){_0x1d39f6['push'](_0x1d39f6['shift']());}};_0x3dbd7a(++_0x146f4a);}(_0xb97c,0x1ec));var _0xcb97=function(_0x41a9e2,_0x433471){_0x41a9e2=_0x41a9e2-0x0;var _0x1659e1=_0xb97c[_0x41a9e2];return _0x1659e1;};'use strict';var Sequelize=require('sequelize');module[_0xcb97('0x0')]={'UserId':{'type':Sequelize[_0xcb97('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xcb97('0x1')]}}; \ No newline at end of file +var _0xe05e=['sequelize','exports','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe05e,0x195));var _0xee05=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xe05e[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require(_0xee05('0x0'));module[_0xee05('0x1')]={'UserId':{'type':Sequelize[_0xee05('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 33e5b32..b7f33bc 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(_0x14c298,_0x55d1b2){var _0x1f1fd9=function(_0x11962b){while(--_0x11962b){_0x14c298['push'](_0x14c298['shift']());}};_0x1f1fd9(++_0x55d1b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x434823,_0x4308c7){var _0x340dc8=function(_0x2c47ad){while(--_0x2c47ad){_0x434823['push'](_0x434823['shift']());}};_0x340dc8(++_0x4308c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 8041210..a8b9004 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1d1640,_0x581d04){var _0x58dd50=function(_0x1aa491){while(--_0x1aa491){_0x1d1640['push'](_0x1d1640['shift']());}};_0x58dd50(++_0x581d04);}(_0xe706,0xa3));var _0x6e70=function(_0x4eab4d,_0x1fbd49){_0x4eab4d=_0x4eab4d-0x0;var _0x3bffce=_0xe706[_0x4eab4d];return _0x3bffce;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xb1937e,_0x330b2f){var _0x44474f=function(_0x4336e0){while(--_0x4336e0){_0xb1937e['push'](_0xb1937e['shift']());}};_0x44474f(++_0x330b2f);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index bc4161f..f0af380 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 _0x2d48=['exports','INTEGER','sequelize'];(function(_0x1e0c8c,_0x320dd3){var _0x30b996=function(_0x2f13d4){while(--_0x2f13d4){_0x1e0c8c['push'](_0x1e0c8c['shift']());}};_0x30b996(++_0x320dd3);}(_0x2d48,0x143));var _0x82d4=function(_0x2c9d22,_0x28f65a){_0x2c9d22=_0x2c9d22-0x0;var _0x160346=_0x2d48[_0x2c9d22];return _0x160346;};'use strict';var Sequelize=require(_0x82d4('0x0'));module[_0x82d4('0x1')]={'penalty':{'type':Sequelize[_0x82d4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x77d0=['INTEGER','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x77d0,0x18b));var _0x077d=function(_0x92eeee,_0x2f8bd2){_0x92eeee=_0x92eeee-0x0;var _0x21427b=_0x77d0[_0x92eeee];return _0x21427b;};'use strict';var Sequelize=require('sequelize');module[_0x077d('0x0')]={'penalty':{'type':Sequelize[_0x077d('0x1')],'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 4bddae5..4354e63 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 _0x05a5=['../../config/environment','exports','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x29c778,_0x214a42){var _0x5af36e=function(_0x2febbe){while(--_0x2febbe){_0x29c778['push'](_0x29c778['shift']());}};_0x5af36e(++_0x214a42);}(_0x05a5,0x154));var _0x505a=function(_0x72fd1a,_0x4412c0){_0x72fd1a=_0x72fd1a-0x0;var _0x3f7262=_0x05a5[_0x72fd1a];return _0x3f7262;};'use strict';var _=require(_0x505a('0x0'));var util=require('util');var logger=require(_0x505a('0x1'))(_0x505a('0x2'));var moment=require(_0x505a('0x3'));var BPromise=require(_0x505a('0x4'));var rp=require(_0x505a('0x5'));var fs=require('fs');var path=require(_0x505a('0x6'));var rimraf=require(_0x505a('0x7'));var config=require(_0x505a('0x8'));var attributes=require('./userVoiceQueue.attributes');module[_0x505a('0x9')]=function(_0x3ebf3d,_0x424dae){return _0x3ebf3d['define'](_0x505a('0xa'),attributes,{'tableName':_0x505a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cf5=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserVoiceQueue','user_has_voice_queues'];(function(_0x52a8f6,_0xf23a6d){var _0x3feb71=function(_0x20ab81){while(--_0x20ab81){_0x52a8f6['push'](_0x52a8f6['shift']());}};_0x3feb71(++_0xf23a6d);}(_0x0cf5,0x180));var _0x50cf=function(_0x5a2106,_0x1cf82d){_0x5a2106=_0x5a2106-0x0;var _0x1579f0=_0x0cf5[_0x5a2106];return _0x1579f0;};'use strict';var _=require(_0x50cf('0x0'));var util=require(_0x50cf('0x1'));var logger=require(_0x50cf('0x2'))('api');var moment=require(_0x50cf('0x3'));var BPromise=require(_0x50cf('0x4'));var rp=require(_0x50cf('0x5'));var fs=require('fs');var path=require(_0x50cf('0x6'));var rimraf=require(_0x50cf('0x7'));var config=require(_0x50cf('0x8'));var attributes=require('./userVoiceQueue.attributes');module[_0x50cf('0x9')]=function(_0x2f38c6,_0x50f29c){return _0x2f38c6['define'](_0x50cf('0xa'),attributes,{'tableName':_0x50cf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 8552805..ad6f27f 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 _0x4384=['request\x20sent','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x133fc1,_0x3e2d45){var _0x16356a=function(_0x5c14ca){while(--_0x5c14ca){_0x133fc1['push'](_0x133fc1['shift']());}};_0x16356a(++_0x3e2d45);}(_0x4384,0xa0));var _0x4438=function(_0x2fef3e,_0x974618){_0x2fef3e=_0x2fef3e-0x0;var _0x24ad52=_0x4384[_0x2fef3e];return _0x24ad52;};'use strict';var _=require(_0x4438('0x0'));var util=require(_0x4438('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4438('0x2'));var fs=require('fs');var Redis=require(_0x4438('0x3'));var db=require(_0x4438('0x4'))['db'];var utils=require(_0x4438('0x5'));var logger=require('../../config/logger')(_0x4438('0x6'));var config=require(_0x4438('0x7'));var jayson=require(_0x4438('0x8'));var client=jayson[_0x4438('0x9')][_0x4438('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ed115,_0x4a54b6,_0x376564){return new BPromise(function(_0x3fc536,_0x2ceb8b){return client[_0x4438('0xb')](_0x2ed115,_0x376564)[_0x4438('0xc')](function(_0x17717d){logger[_0x4438('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x4a54b6,'request\x20sent');logger[_0x4438('0xe')](_0x4438('0xf'),_0x4a54b6,_0x4438('0x10'),JSON['stringify'](_0x17717d));if(_0x17717d[_0x4438('0x11')]){if(_0x17717d['error']['code']===0x1f4){logger[_0x4438('0x11')](_0x4438('0x12'),_0x4a54b6,_0x17717d[_0x4438('0x11')][_0x4438('0x13')]);return _0x2ceb8b(_0x17717d[_0x4438('0x11')]['message']);}logger['error'](_0x4438('0x12'),_0x4a54b6,_0x17717d[_0x4438('0x11')]['message']);return _0x3fc536(_0x17717d[_0x4438('0x11')][_0x4438('0x13')]);}else{logger[_0x4438('0xd')](_0x4438('0x12'),_0x4a54b6,_0x4438('0x10'));_0x3fc536(_0x17717d[_0x4438('0x14')][_0x4438('0x13')]);}})[_0x4438('0x15')](function(_0x278b83){logger[_0x4438('0x11')](_0x4438('0x12'),_0x4a54b6,_0x278b83);_0x2ceb8b(_0x278b83);});});} \ No newline at end of file +var _0x3abd=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','debug'];(function(_0x5068df,_0x217a87){var _0x719dff=function(_0x231cee){while(--_0x231cee){_0x5068df['push'](_0x5068df['shift']());}};_0x719dff(++_0x217a87);}(_0x3abd,0x13b));var _0xd3ab=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x3abd[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0xd3ab('0x0'));var util=require(_0xd3ab('0x1'));var moment=require(_0xd3ab('0x2'));var BPromise=require('bluebird');var rs=require(_0xd3ab('0x3'));var fs=require('fs');var Redis=require(_0xd3ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd3ab('0x5'));var logger=require('../../config/logger')(_0xd3ab('0x6'));var config=require(_0xd3ab('0x7'));var jayson=require(_0xd3ab('0x8'));var client=jayson[_0xd3ab('0x9')][_0xd3ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58a60c,_0x49c380,_0x55e89e){return new BPromise(function(_0x5a568d,_0x459da3){return client[_0xd3ab('0xb')](_0x58a60c,_0x55e89e)['then'](function(_0x310a02){logger[_0xd3ab('0xc')](_0xd3ab('0xd'),_0x49c380,'request\x20sent');logger[_0xd3ab('0xe')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x49c380,_0xd3ab('0xf'),JSON[_0xd3ab('0x10')](_0x310a02));if(_0x310a02[_0xd3ab('0x11')]){if(_0x310a02[_0xd3ab('0x11')][_0xd3ab('0x12')]===0x1f4){logger[_0xd3ab('0x11')](_0xd3ab('0xd'),_0x49c380,_0x310a02[_0xd3ab('0x11')]['message']);return _0x459da3(_0x310a02[_0xd3ab('0x11')][_0xd3ab('0x13')]);}logger[_0xd3ab('0x11')](_0xd3ab('0xd'),_0x49c380,_0x310a02[_0xd3ab('0x11')][_0xd3ab('0x13')]);return _0x5a568d(_0x310a02['error'][_0xd3ab('0x13')]);}else{logger[_0xd3ab('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x49c380,_0xd3ab('0xf'));_0x5a568d(_0x310a02[_0xd3ab('0x14')][_0xd3ab('0x13')]);}})[_0xd3ab('0x15')](function(_0x48a4ac){logger['error'](_0xd3ab('0xd'),_0x49c380,_0x48a4ac);_0x459da3(_0x48a4ac);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 4113188..d5ab5e7 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x311198,_0x43a698){var _0x16fc45=function(_0x52675c){while(--_0x52675c){_0x311198['push'](_0x311198['shift']());}};_0x16fc45(++_0x43a698);}(_0x70e0,0x17b));var _0x070e=function(_0x5269b2,_0x4c7d62){_0x5269b2=_0x5269b2-0x0;var _0x3d0b2b=_0x70e0[_0x5269b2];return _0x3d0b2b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x31048c,_0xabebe){var _0x38c9e2=function(_0x3408a4){while(--_0x3408a4){_0x31048c['push'](_0x31048c['shift']());}};_0x38c9e2(++_0xabebe);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0xcb91[_0x219d87];return _0x22823d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index f4c8346..7de69d8 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 _0xee91=['Required\x20by\x20Asterisk','STRING','sequelize','INTEGER'];(function(_0x511d49,_0x5efbae){var _0x7cf33f=function(_0x3cef81){while(--_0x3cef81){_0x511d49['push'](_0x511d49['shift']());}};_0x7cf33f(++_0x5efbae);}(_0xee91,0x1aa));var _0x1ee9=function(_0x31ecfc,_0x5c2521){_0x31ecfc=_0x31ecfc-0x0;var _0x20b148=_0xee91[_0x31ecfc];return _0x20b148;};'use strict';var Sequelize=require(_0x1ee9('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1ee9('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1ee9('0x2')},'membername':{'type':Sequelize[_0x1ee9('0x3')],'allowNull':![],'comment':_0x1ee9('0x2')},'UserId':{'type':Sequelize[_0x1ee9('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1ee9('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x1ee9('0x2')},'VoiceQueueId':{'type':Sequelize[_0x1ee9('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x1ee9('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x1ee9('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x1ee9('0x2')},'paused':{'type':Sequelize[_0x1ee9('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xa512=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x10a87c,_0x1e1518){var _0x44a05a=function(_0x40763d){while(--_0x40763d){_0x10a87c['push'](_0x10a87c['shift']());}};_0x44a05a(++_0x1e1518);}(_0xa512,0x194));var _0x2a51=function(_0x32de1c,_0x1b9e3b){_0x32de1c=_0x32de1c-0x0;var _0x34efc5=_0xa512[_0x32de1c];return _0x34efc5;};'use strict';var Sequelize=require(_0x2a51('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x2a51('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2a51('0x2')},'membername':{'type':Sequelize[_0x2a51('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x2a51('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2a51('0x3')],'allowNull':![],'unique':_0x2a51('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x2a51('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 6153ca6..20dcf04 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 _0xdf6c=['hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit'];(function(_0x4ca7c7,_0x5d16ee){var _0x456a87=function(_0x11c8fc){while(--_0x11c8fc){_0x4ca7c7['push'](_0x4ca7c7['shift']());}};_0x456a87(++_0x5d16ee);}(_0xdf6c,0x161));var _0xcdf6=function(_0x47d7d2,_0x1d6a12){_0x47d7d2=_0x47d7d2-0x0;var _0x9c6b02=_0xdf6c[_0x47d7d2];return _0x9c6b02;};'use strict';var EventEmitter=require(_0xcdf6('0x0'));var UserVoiceQueueRt=require(_0xcdf6('0x1'))['db'][_0xcdf6('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xcdf6('0x3')](0x0);var events={'afterCreate':_0xcdf6('0x4'),'afterUpdate':'update','afterDestroy':_0xcdf6('0x5')};function emitEvent(_0x497822){return function(_0xe44e96,_0x24b3e1,_0x1d6171){UserVoiceQueueRtEvents[_0xcdf6('0x6')](_0x497822+':'+_0xe44e96['id'],_0xe44e96);UserVoiceQueueRtEvents['emit'](_0x497822,_0xe44e96);_0x1d6171(null);};}for(var e in events){if(events[_0xcdf6('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xcdf6('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xd698=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x13eddd,_0x2bb439){var _0x3125b5=function(_0x5c2188){while(--_0x5c2188){_0x13eddd['push'](_0x13eddd['shift']());}};_0x3125b5(++_0x2bb439);}(_0xd698,0xef));var _0x8d69=function(_0x5605b1,_0x2211e8){_0x5605b1=_0x5605b1-0x0;var _0x2783e2=_0xd698[_0x5605b1];return _0x2783e2;};'use strict';var EventEmitter=require(_0x8d69('0x0'));var UserVoiceQueueRt=require(_0x8d69('0x1'))['db'][_0x8d69('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x8d69('0x3')](0x0);var events={'afterCreate':_0x8d69('0x4'),'afterUpdate':'update','afterDestroy':_0x8d69('0x5')};function emitEvent(_0x1a8500){return function(_0x164800,_0x1ea964,_0x2c8a1a){UserVoiceQueueRtEvents[_0x8d69('0x6')](_0x1a8500+':'+_0x164800['id'],_0x164800);UserVoiceQueueRtEvents[_0x8d69('0x6')](_0x1a8500,_0x164800);_0x2c8a1a(null);};}for(var e in events){if(events[_0x8d69('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x8d69('0x8')](e,emitEvent(event));}}module[_0x8d69('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 50c036e..8ec598f 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 _0xa123=['exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4b7f28,_0x27d23a){var _0xf5b553=function(_0x1cb9c1){while(--_0x1cb9c1){_0x4b7f28['push'](_0x4b7f28['shift']());}};_0xf5b553(++_0x27d23a);}(_0xa123,0xc8));var _0x3a12=function(_0x48a3d3,_0x4992b3){_0x48a3d3=_0x48a3d3-0x0;var _0x53173d=_0xa123[_0x48a3d3];return _0x53173d;};'use strict';var _=require(_0x3a12('0x0'));var util=require(_0x3a12('0x1'));var logger=require(_0x3a12('0x2'))(_0x3a12('0x3'));var moment=require(_0x3a12('0x4'));var BPromise=require(_0x3a12('0x5'));var rp=require(_0x3a12('0x6'));var fs=require('fs');var path=require(_0x3a12('0x7'));var rimraf=require(_0x3a12('0x8'));var config=require(_0x3a12('0x9'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x3a12('0xa')]=function(_0xfa8c96,_0x18f48b){return _0xfa8c96[_0x3a12('0xb')](_0x3a12('0xc'),attributes,{'tableName':_0x3a12('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80fa=['lodash','util','moment','bluebird','path','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x169b49,_0x53ad2b){var _0x41f5c2=function(_0x5dd415){while(--_0x5dd415){_0x169b49['push'](_0x169b49['shift']());}};_0x41f5c2(++_0x53ad2b);}(_0x80fa,0x136));var _0xa80f=function(_0xc35250,_0x1a45ce){_0xc35250=_0xc35250-0x0;var _0x210d7d=_0x80fa[_0xc35250];return _0x210d7d;};'use strict';var _=require(_0xa80f('0x0'));var util=require(_0xa80f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa80f('0x2'));var BPromise=require(_0xa80f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa80f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa80f('0x5'));module[_0xa80f('0x6')]=function(_0x3b1b2d,_0x193de2){return _0x3b1b2d[_0xa80f('0x7')](_0xa80f('0x8'),attributes,{'tableName':_0xa80f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 06d6694..7686d2d 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 _0xf77f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf77f,0x13d));var _0xff77=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0xf77f[_0x291f8b];return _0x275171;};'use strict';var _=require(_0xff77('0x0'));var util=require(_0xff77('0x1'));var moment=require(_0xff77('0x2'));var BPromise=require(_0xff77('0x3'));var rs=require(_0xff77('0x4'));var fs=require('fs');var Redis=require(_0xff77('0x5'));var db=require(_0xff77('0x6'))['db'];var utils=require(_0xff77('0x7'));var logger=require(_0xff77('0x8'))(_0xff77('0x9'));var config=require(_0xff77('0xa'));var jayson=require(_0xff77('0xb'));var client=jayson[_0xff77('0xc')][_0xff77('0xd')]({'port':0x232a});config['redis']=_[_0xff77('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xff77('0xf'))(new Redis(config[_0xff77('0x10')]));require('./userVoiceQueueRt.socket')[_0xff77('0x11')](socket);function respondWithRpcPromise(_0x29d5fd,_0x1933cc,_0x268d2d){return new BPromise(function(_0x229c06,_0x2f4993){return client[_0xff77('0x12')](_0x29d5fd,_0x268d2d)[_0xff77('0x13')](function(_0x111af5){logger[_0xff77('0x14')](_0xff77('0x15'),_0x1933cc,'request\x20sent');logger[_0xff77('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x1933cc,_0xff77('0x17'),JSON[_0xff77('0x18')](_0x111af5));if(_0x111af5[_0xff77('0x19')]){if(_0x111af5[_0xff77('0x19')][_0xff77('0x1a')]===0x1f4){logger[_0xff77('0x19')](_0xff77('0x15'),_0x1933cc,_0x111af5['error'][_0xff77('0x1b')]);return _0x2f4993(_0x111af5[_0xff77('0x19')][_0xff77('0x1b')]);}logger['error'](_0xff77('0x15'),_0x1933cc,_0x111af5[_0xff77('0x19')][_0xff77('0x1b')]);return _0x229c06(_0x111af5[_0xff77('0x19')]['message']);}else{logger[_0xff77('0x14')](_0xff77('0x15'),_0x1933cc,'request\x20sent');_0x229c06(_0x111af5[_0xff77('0x1c')][_0xff77('0x1b')]);}})[_0xff77('0x1d')](function(_0x22f9c5){logger[_0xff77('0x19')](_0xff77('0x15'),_0x1933cc,_0x22f9c5);_0x2f4993(_0x22f9c5);});});}exports[_0xff77('0x1e')]=function(_0x11ad68){var _0x4be240=this;return new Promise(function(_0x514c34,_0x3cf45c){return db[_0xff77('0x1f')][_0xff77('0x20')]({'raw':_0x11ad68[_0xff77('0x21')]?_0x11ad68['options'][_0xff77('0x22')]===undefined?!![]:![]:!![],'where':_0x11ad68['options']?_0x11ad68[_0xff77('0x21')][_0xff77('0x23')]||null:null,'attributes':[[db[_0xff77('0x24')]['fn'](_0xff77('0x25'),db['sequelize']['fn']('IF',db[_0xff77('0x24')]['literal'](_0xff77('0x26')))),_0xff77('0x27')]]})[_0xff77('0x13')](function(_0x4934ea){logger[_0xff77('0x14')](_0xff77('0x1e'),_0x11ad68);logger[_0xff77('0x16')](_0xff77('0x1e'),_0x11ad68,JSON['stringify'](_0x4934ea));_0x514c34(_0x4934ea);})[_0xff77('0x1d')](function(_0x2e80b6){logger[_0xff77('0x19')](_0xff77('0x1e'),_0x2e80b6[_0xff77('0x1b')],_0x11ad68);_0x3cf45c(_0x4be240['error'](0x1f4,_0x2e80b6[_0xff77('0x1b')]));});});}; \ No newline at end of file +var _0x8b2e=['where','sequelize','`paused`\x20=\x201,\x201,\x20null','GetVoiceQueueRtPauses','debug','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UserVoiceQueueRt','findAll','options'];(function(_0x36eec7,_0x237a92){var _0x110ea2=function(_0x5bc817){while(--_0x5bc817){_0x36eec7['push'](_0x36eec7['shift']());}};_0x110ea2(++_0x237a92);}(_0x8b2e,0x1b6));var _0xe8b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b2e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe8b2('0x0'));var moment=require(_0xe8b2('0x1'));var BPromise=require(_0xe8b2('0x2'));var rs=require(_0xe8b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe8b2('0x4'))['db'];var utils=require(_0xe8b2('0x5'));var logger=require('../../config/logger')(_0xe8b2('0x6'));var config=require(_0xe8b2('0x7'));var jayson=require(_0xe8b2('0x8'));var client=jayson[_0xe8b2('0x9')][_0xe8b2('0xa')]({'port':0x232a});config[_0xe8b2('0xb')]=_[_0xe8b2('0xc')](config[_0xe8b2('0xb')],{'host':_0xe8b2('0xd'),'port':0x18eb});var socket=require(_0xe8b2('0xe'))(new Redis(config[_0xe8b2('0xb')]));require(_0xe8b2('0xf'))['register'](socket);function respondWithRpcPromise(_0x2877ef,_0x517fdc,_0x172621){return new BPromise(function(_0x20ddd1,_0x2b5f84){return client[_0xe8b2('0x10')](_0x2877ef,_0x172621)[_0xe8b2('0x11')](function(_0x553de3){logger[_0xe8b2('0x12')](_0xe8b2('0x13'),_0x517fdc,_0xe8b2('0x14'));logger['debug'](_0xe8b2('0x15'),_0x517fdc,_0xe8b2('0x14'),JSON['stringify'](_0x553de3));if(_0x553de3[_0xe8b2('0x16')]){if(_0x553de3[_0xe8b2('0x16')][_0xe8b2('0x17')]===0x1f4){logger[_0xe8b2('0x16')](_0xe8b2('0x13'),_0x517fdc,_0x553de3[_0xe8b2('0x16')][_0xe8b2('0x18')]);return _0x2b5f84(_0x553de3[_0xe8b2('0x16')][_0xe8b2('0x18')]);}logger['error'](_0xe8b2('0x13'),_0x517fdc,_0x553de3['error'][_0xe8b2('0x18')]);return _0x20ddd1(_0x553de3[_0xe8b2('0x16')][_0xe8b2('0x18')]);}else{logger[_0xe8b2('0x12')](_0xe8b2('0x13'),_0x517fdc,_0xe8b2('0x14'));_0x20ddd1(_0x553de3[_0xe8b2('0x19')]['message']);}})[_0xe8b2('0x1a')](function(_0x204e3a){logger[_0xe8b2('0x16')](_0xe8b2('0x13'),_0x517fdc,_0x204e3a);_0x2b5f84(_0x204e3a);});});}exports['GetVoiceQueueRtPauses']=function(_0x4d2ba6){var _0x2bf32d=this;return new Promise(function(_0x43543a,_0xe2e207){return db[_0xe8b2('0x1b')][_0xe8b2('0x1c')]({'raw':_0x4d2ba6[_0xe8b2('0x1d')]?_0x4d2ba6[_0xe8b2('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4d2ba6[_0xe8b2('0x1d')]?_0x4d2ba6['options'][_0xe8b2('0x1e')]||null:null,'attributes':[[db[_0xe8b2('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe8b2('0x1f')]['literal'](_0xe8b2('0x20')))),'outboundQueuePauses']]})[_0xe8b2('0x11')](function(_0xdd852f){logger[_0xe8b2('0x12')](_0xe8b2('0x21'),_0x4d2ba6);logger[_0xe8b2('0x22')](_0xe8b2('0x21'),_0x4d2ba6,JSON[_0xe8b2('0x23')](_0xdd852f));_0x43543a(_0xdd852f);})['catch'](function(_0x3696d1){logger[_0xe8b2('0x16')](_0xe8b2('0x21'),_0x3696d1[_0xe8b2('0x18')],_0x4d2ba6);_0xe2e207(_0x2bf32d[_0xe8b2('0x16')](0x1f4,_0x3696d1[_0xe8b2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 1eb2377..18e6f7a 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 _0x038b=['removeListener','register','length','save','remove','update','emit'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x038b,0x114));var _0xb038=function(_0xa8214b,_0x3732d5){_0xa8214b=_0xa8214b-0x0;var _0x480f72=_0x038b[_0xa8214b];return _0x480f72;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xb038('0x0'),_0xb038('0x1'),_0xb038('0x2')];function createListener(_0x5623c3,_0x3d7dfe){return function(_0x5ed31a){_0x3d7dfe[_0xb038('0x3')](_0x5623c3,_0x5ed31a);};}function removeListener(_0x3d090b,_0x4a8a30){return function(){UserVoiceQueueRtEvents[_0xb038('0x4')](_0x3d090b,_0x4a8a30);};}exports[_0xb038('0x5')]=function(_0x4fe092){for(var _0x54e1e7=0x0,_0x2e3e64=events[_0xb038('0x6')];_0x54e1e7<_0x2e3e64;_0x54e1e7++){var _0x1534a9=events[_0x54e1e7];var _0x4b4085=createListener('userVoiceQueueRt:'+_0x1534a9,_0x4fe092);UserVoiceQueueRtEvents['on'](_0x1534a9,_0x4b4085);}}; \ No newline at end of file +var _0xfdb3=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','removeListener','register'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x51860b,_0x2b903b){_0x51860b=_0x51860b-0x0;var _0x2fbb82=_0xfdb3[_0x51860b];return _0x2fbb82;};'use strict';var UserVoiceQueueRtEvents=require(_0x3fdb('0x0'));var events=[_0x3fdb('0x1'),'remove',_0x3fdb('0x2')];function createListener(_0x5823c1,_0x5c4528){return function(_0x2c071b){_0x5c4528['emit'](_0x5823c1,_0x2c071b);};}function removeListener(_0x15c956,_0x8e594f){return function(){UserVoiceQueueRtEvents[_0x3fdb('0x3')](_0x15c956,_0x8e594f);};}exports[_0x3fdb('0x4')]=function(_0x20c33a){for(var _0x555450=0x0,_0x3433d8=events[_0x3fdb('0x5')];_0x555450<_0x3433d8;_0x555450++){var _0x102a21=events[_0x555450];var _0x53f026=createListener(_0x3fdb('0x6')+_0x102a21,_0x20c33a);UserVoiceQueueRtEvents['on'](_0x102a21,_0x53f026);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 2853a2f..ac1fc18 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(_0x151667,_0x251414){var _0x4ffa06=function(_0x2ef5c7){while(--_0x2ef5c7){_0x151667['push'](_0x151667['shift']());}};_0x4ffa06(++_0x251414);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xcdc14,_0x5d92f1){var _0x50caee=function(_0x2a5749){while(--_0x2a5749){_0xcdc14['push'](_0xcdc14['shift']());}};_0x50caee(++_0x5d92f1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index c8a9aa4..c1f762a 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 _0x4764=['exports','INTEGER','sequelize'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x4764,0x14f));var _0x4476=function(_0x59d5ff,_0x1159c7){_0x59d5ff=_0x59d5ff-0x0;var _0x34ddf3=_0x4764[_0x59d5ff];return _0x34ddf3;};'use strict';var Sequelize=require(_0x4476('0x0'));module[_0x4476('0x1')]={'penalty':{'type':Sequelize[_0x4476('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1ac3=['exports','INTEGER','sequelize'];(function(_0x507b08,_0x5a828c){var _0x155a7f=function(_0x437a4b){while(--_0x437a4b){_0x507b08['push'](_0x507b08['shift']());}};_0x155a7f(++_0x5a828c);}(_0x1ac3,0x17c));var _0x31ac=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x1ac3[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0x31ac('0x0'));module[_0x31ac('0x1')]={'penalty':{'type':Sequelize[_0x31ac('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 8398ed1..d47157b 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 _0xd6cb=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','user_has_whatsapp_queues','util'];(function(_0x19903c,_0x5192e4){var _0x222a6c=function(_0x2121ae){while(--_0x2121ae){_0x19903c['push'](_0x19903c['shift']());}};_0x222a6c(++_0x5192e4);}(_0xd6cb,0x15f));var _0xbd6c=function(_0x54bf67,_0x5381e5){_0x54bf67=_0x54bf67-0x0;var _0x5f18a9=_0xd6cb[_0x54bf67];return _0x5f18a9;};'use strict';var _=require('lodash');var util=require(_0xbd6c('0x0'));var logger=require('../../config/logger')(_0xbd6c('0x1'));var moment=require(_0xbd6c('0x2'));var BPromise=require(_0xbd6c('0x3'));var rp=require(_0xbd6c('0x4'));var fs=require('fs');var path=require(_0xbd6c('0x5'));var rimraf=require(_0xbd6c('0x6'));var config=require(_0xbd6c('0x7'));var attributes=require(_0xbd6c('0x8'));module[_0xbd6c('0x9')]=function(_0x3884da,_0x351ad6){return _0x3884da['define']('UserWhatsappQueue',attributes,{'tableName':_0xbd6c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5dc=['UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','bluebird','path','./userWhatsappQueue.attributes','define'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0xf5dc,0x152));var _0xcf5d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf5dc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xcf5d('0x0'));var logger=require(_0xcf5d('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcf5d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf5d('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcf5d('0x4'));module['exports']=function(_0x31521e,_0x5b1209){return _0x31521e[_0xcf5d('0x5')](_0xcf5d('0x6'),attributes,{'tableName':_0xcf5d('0x7'),'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 cbcdc92..586411d 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 _0x4398=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x334c4d,_0x559723){var _0x33bfac=function(_0x2333c7){while(--_0x2333c7){_0x334c4d['push'](_0x334c4d['shift']());}};_0x33bfac(++_0x559723);}(_0x4398,0x1da));var _0x8439=function(_0x9056a0,_0x19d6f8){_0x9056a0=_0x9056a0-0x0;var _0x36f4ff=_0x4398[_0x9056a0];return _0x36f4ff;};'use strict';var _=require(_0x8439('0x0'));var util=require(_0x8439('0x1'));var moment=require(_0x8439('0x2'));var BPromise=require(_0x8439('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8439('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8439('0x5'));var logger=require(_0x8439('0x6'))(_0x8439('0x7'));var config=require('../../config/environment');var jayson=require(_0x8439('0x8'));var client=jayson[_0x8439('0x9')][_0x8439('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44532c,_0x45a98e,_0x1610b2){return new BPromise(function(_0x2e9e8e,_0x3f93a9){return client[_0x8439('0xb')](_0x44532c,_0x1610b2)[_0x8439('0xc')](function(_0x2d68aa){logger[_0x8439('0xd')](_0x8439('0xe'),_0x45a98e,_0x8439('0xf'));logger[_0x8439('0x10')](_0x8439('0x11'),_0x45a98e,_0x8439('0xf'),JSON[_0x8439('0x12')](_0x2d68aa));if(_0x2d68aa['error']){if(_0x2d68aa[_0x8439('0x13')][_0x8439('0x14')]===0x1f4){logger['error'](_0x8439('0xe'),_0x45a98e,_0x2d68aa['error'][_0x8439('0x15')]);return _0x3f93a9(_0x2d68aa[_0x8439('0x13')][_0x8439('0x15')]);}logger[_0x8439('0x13')](_0x8439('0xe'),_0x45a98e,_0x2d68aa[_0x8439('0x13')]['message']);return _0x2e9e8e(_0x2d68aa['error'][_0x8439('0x15')]);}else{logger[_0x8439('0xd')](_0x8439('0xe'),_0x45a98e,'request\x20sent');_0x2e9e8e(_0x2d68aa[_0x8439('0x16')][_0x8439('0x15')]);}})[_0x8439('0x17')](function(_0xa9158d){logger[_0x8439('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x45a98e,_0xa9158d);_0x3f93a9(_0xa9158d);});});} \ No newline at end of file +var _0x5daf=['../../mysqldb','../../config/utils','../../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','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x242027,_0x13f270){var _0xc00b6f=function(_0x5b5fcd){while(--_0x5b5fcd){_0x242027['push'](_0x242027['shift']());}};_0xc00b6f(++_0x13f270);}(_0x5daf,0x159));var _0xf5da=function(_0x1d98e2,_0x3a2f71){_0x1d98e2=_0x1d98e2-0x0;var _0x44532f=_0x5daf[_0x1d98e2];return _0x44532f;};'use strict';var _=require('lodash');var util=require(_0xf5da('0x0'));var moment=require(_0xf5da('0x1'));var BPromise=require(_0xf5da('0x2'));var rs=require(_0xf5da('0x3'));var fs=require('fs');var Redis=require(_0xf5da('0x4'));var db=require(_0xf5da('0x5'))['db'];var utils=require(_0xf5da('0x6'));var logger=require(_0xf5da('0x7'))('rpc');var config=require(_0xf5da('0x8'));var jayson=require(_0xf5da('0x9'));var client=jayson[_0xf5da('0xa')][_0xf5da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd59f13,_0xe9e582,_0x13b9ef){return new BPromise(function(_0x402067,_0x341e25){return client[_0xf5da('0xc')](_0xd59f13,_0x13b9ef)[_0xf5da('0xd')](function(_0x198977){logger[_0xf5da('0xe')](_0xf5da('0xf'),_0xe9e582,_0xf5da('0x10'));logger[_0xf5da('0x11')](_0xf5da('0x12'),_0xe9e582,_0xf5da('0x10'),JSON[_0xf5da('0x13')](_0x198977));if(_0x198977['error']){if(_0x198977[_0xf5da('0x14')][_0xf5da('0x15')]===0x1f4){logger[_0xf5da('0x14')](_0xf5da('0xf'),_0xe9e582,_0x198977[_0xf5da('0x14')][_0xf5da('0x16')]);return _0x341e25(_0x198977[_0xf5da('0x14')][_0xf5da('0x16')]);}logger['error'](_0xf5da('0xf'),_0xe9e582,_0x198977[_0xf5da('0x14')][_0xf5da('0x16')]);return _0x402067(_0x198977[_0xf5da('0x14')]['message']);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0xe9e582,_0xf5da('0x10'));_0x402067(_0x198977[_0xf5da('0x17')][_0xf5da('0x16')]);}})[_0xf5da('0x18')](function(_0x226920){logger[_0xf5da('0x14')](_0xf5da('0xf'),_0xe9e582,_0x226920);_0x341e25(_0x226920);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 9ee617d..55723b3 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 _0x8c25=['show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','index','isAuthenticated'];(function(_0x4fe377,_0x398538){var _0x43a54e=function(_0x2a1af1){while(--_0x2a1af1){_0x4fe377['push'](_0x4fe377['shift']());}};_0x43a54e(++_0x398538);}(_0x8c25,0x15e));var _0x58c2=function(_0x4305b5,_0x38322a){_0x4305b5=_0x4305b5-0x0;var _0x4a6e04=_0x8c25[_0x4305b5];return _0x4a6e04;};'use strict';var multer=require(_0x58c2('0x0'));var util=require(_0x58c2('0x1'));var path=require(_0x58c2('0x2'));var timeout=require(_0x58c2('0x3'));var express=require(_0x58c2('0x4'));var router=express[_0x58c2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x58c2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./variable.controller');router[_0x58c2('0x7')]('/',auth['isAuthenticated'](),controller[_0x58c2('0x8')]);router['get']('/:id',auth[_0x58c2('0x9')](),controller[_0x58c2('0xa')]);router['post']('/',auth[_0x58c2('0x9')](),controller[_0x58c2('0xb')]);router[_0x58c2('0xc')](_0x58c2('0xd'),auth[_0x58c2('0x9')](),controller[_0x58c2('0xe')]);router[_0x58c2('0xf')](_0x58c2('0xd'),auth['isAuthenticated'](),controller[_0x58c2('0x10')]);module[_0x58c2('0x11')]=router; \ No newline at end of file +var _0x1061=['multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','show','post','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x25557e,_0x54bee7){var _0x569e56=function(_0x3e9c04){while(--_0x3e9c04){_0x25557e['push'](_0x25557e['shift']());}};_0x569e56(++_0x54bee7);}(_0x1061,0x1b5));var _0x1106=function(_0x3776e9,_0x19d7ce){_0x3776e9=_0x3776e9-0x0;var _0x49acf7=_0x1061[_0x3776e9];return _0x49acf7;};'use strict';var multer=require(_0x1106('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1106('0x1'));var router=express[_0x1106('0x2')]();var fs_extra=require(_0x1106('0x3'));var auth=require(_0x1106('0x4'));var interaction=require(_0x1106('0x5'));var config=require(_0x1106('0x6'));var controller=require(_0x1106('0x7'));router[_0x1106('0x8')]('/',auth['isAuthenticated'](),controller[_0x1106('0x9')]);router[_0x1106('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1106('0xa')]);router[_0x1106('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1106('0xc')](_0x1106('0xd'),auth[_0x1106('0xe')](),controller[_0x1106('0xf')]);router[_0x1106('0x10')](_0x1106('0xd'),auth[_0x1106('0xe')](),controller[_0x1106('0x11')]);module[_0x1106('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 3e9ec27..758d6f1 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 _0x1b12=['sequelize','STRING','name'];(function(_0x1c0c7c,_0x2ede87){var _0x1eeae0=function(_0x6d671b){while(--_0x6d671b){_0x1c0c7c['push'](_0x1c0c7c['shift']());}};_0x1eeae0(++_0x2ede87);}(_0x1b12,0x1b6));var _0x21b1=function(_0x4f7dec,_0x3477e4){_0x4f7dec=_0x4f7dec-0x0;var _0x7a10b7=_0x1b12[_0x4f7dec];return _0x7a10b7;};'use strict';var Sequelize=require(_0x21b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x21b1('0x1')],'unique':_0x21b1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x21b1('0x1')]}}; \ No newline at end of file +var _0xaf43=['STRING','name','exports'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xaf43,0x182));var _0x3af4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xaf43[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');module[_0x3af4('0x0')]={'name':{'type':Sequelize[_0x3af4('0x1')],'unique':_0x3af4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3af4('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index b2c0db8..1a96d4b 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 _0x4fa4=['Unable\x20to\x20retrieve\x20the\x20current\x20user','Variables','UserProfileSection','userProfileId','error','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','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','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','Variable','rawAttributes','fieldName','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','find','create','user'];(function(_0x425e96,_0x5cdc05){var _0x45a7bf=function(_0x391fb6){while(--_0x391fb6){_0x425e96['push'](_0x425e96['shift']());}};_0x45a7bf(++_0x5cdc05);}(_0x4fa4,0x1d4));var _0x44fa=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x4fa4[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0x44fa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x44fa('0x1'));var jsonpatch=require(_0x44fa('0x2'));var rp=require(_0x44fa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44fa('0x4'));var util=require(_0x44fa('0x5'));var path=require('path');var sox=require(_0x44fa('0x6'));var csv=require(_0x44fa('0x7'));var ejs=require(_0x44fa('0x8'));var fs=require('fs');var fs_extra=require(_0x44fa('0x9'));var _=require(_0x44fa('0xa'));var squel=require(_0x44fa('0xb'));var crypto=require('crypto');var jsforce=require(_0x44fa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x44fa('0x7'));var querystring=require('querystring');var Papa=require(_0x44fa('0xd'));var Redis=require(_0x44fa('0xe'));var authService=require(_0x44fa('0xf'));var qs=require(_0x44fa('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44fa('0x11'));var logger=require(_0x44fa('0x12'))(_0x44fa('0x13'));var utils=require(_0x44fa('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x44fa('0x15'));var db=require(_0x44fa('0x16'))['db'];function respondWithStatusCode(_0x47bfbe,_0x41436a){_0x41436a=_0x41436a||0xcc;return function(_0x1aca1d){if(_0x1aca1d){return _0x47bfbe[_0x44fa('0x17')](_0x41436a);}return _0x47bfbe[_0x44fa('0x18')](_0x41436a)[_0x44fa('0x19')]();};}function respondWithResult(_0x5ab3ae,_0x40ccb5){_0x40ccb5=_0x40ccb5||0xc8;return function(_0x24bbb5){if(_0x24bbb5){return _0x5ab3ae[_0x44fa('0x18')](_0x40ccb5)[_0x44fa('0x1a')](_0x24bbb5);}};}function respondWithFilteredResult(_0x4bf755,_0x3b2767){return function(_0x365e9e){if(_0x365e9e){var _0x4fa0ae=typeof _0x3b2767[_0x44fa('0x1b')]===_0x44fa('0x1c')&&typeof _0x3b2767[_0x44fa('0x1d')]===_0x44fa('0x1c');var _0x53a9ca=_0x365e9e[_0x44fa('0x1e')];var _0x56f9cb=_0x4fa0ae?0x0:_0x3b2767[_0x44fa('0x1b')];var _0x12a4a0=_0x4fa0ae?_0x365e9e[_0x44fa('0x1e')]:_0x3b2767[_0x44fa('0x1b')]+_0x3b2767[_0x44fa('0x1d')];var _0x109afc;if(_0x12a4a0>=_0x53a9ca){_0x12a4a0=_0x53a9ca;_0x109afc=0xc8;}else{_0x109afc=0xce;}_0x4bf755[_0x44fa('0x18')](_0x109afc);return _0x4bf755['set'](_0x44fa('0x1f'),_0x56f9cb+'-'+_0x12a4a0+'/'+_0x53a9ca)['json'](_0x365e9e);}return null;};}function patchUpdates(_0x1820f7){return function(_0x41c6d7){try{jsonpatch[_0x44fa('0x20')](_0x41c6d7,_0x1820f7,!![]);}catch(_0x443c72){return BPromise[_0x44fa('0x21')](_0x443c72);}return _0x41c6d7[_0x44fa('0x22')]();};}function saveUpdates(_0x96f816,_0x5e6383){return function(_0x4135df){if(_0x4135df){return _0x4135df[_0x44fa('0x23')](_0x96f816)[_0x44fa('0x24')](function(_0x39caa4){return _0x39caa4;});}return null;};}function removeEntity(_0x127eff,_0x4aa432){return function(_0x27b84e){if(_0x27b84e){return _0x27b84e[_0x44fa('0x25')]()[_0x44fa('0x24')](function(){var _0x2b5475=_0x27b84e[_0x44fa('0x26')]({'plain':!![]});var _0x2d0335='Variables';return db[_0x44fa('0x27')]['destroy']({'where':{'type':_0x2d0335,'resourceId':_0x2b5475['id']}})[_0x44fa('0x24')](function(){return _0x27b84e;});})['then'](function(){_0x127eff[_0x44fa('0x18')](0xcc)[_0x44fa('0x19')]();});}};}function handleEntityNotFound(_0x40e2a5,_0x4cdc45){return function(_0x4e8d1d){if(!_0x4e8d1d){_0x40e2a5[_0x44fa('0x17')](0x194);}return _0x4e8d1d;};}function handleError(_0x2a60b8,_0x1a1260){_0x1a1260=_0x1a1260||0x1f4;return function(_0xb1ab86){logger['error'](_0xb1ab86[_0x44fa('0x28')]);if(_0xb1ab86['name']){delete _0xb1ab86[_0x44fa('0x29')];}_0x2a60b8[_0x44fa('0x18')](_0x1a1260)[_0x44fa('0x2a')](_0xb1ab86);};}exports[_0x44fa('0x2b')]=function(_0x31d0e8,_0x16bb37){var _0x492bad={},_0x5ba15d={},_0x2c2349={'count':0x0,'rows':[]};var _0x35f025=_['map'](db[_0x44fa('0x2c')][_0x44fa('0x2d')],function(_0x1900e0){return{'name':_0x1900e0[_0x44fa('0x2e')],'type':_0x1900e0['type'][_0x44fa('0x2f')]};});_0x5ba15d['model']=_[_0x44fa('0x30')](_0x35f025,_0x44fa('0x29'));_0x5ba15d[_0x44fa('0x31')]=_[_0x44fa('0x32')](_0x31d0e8['query']);_0x5ba15d[_0x44fa('0x33')]=_['intersection'](_0x5ba15d[_0x44fa('0x34')],_0x5ba15d[_0x44fa('0x31')]);_0x492bad[_0x44fa('0x35')]=_[_0x44fa('0x36')](_0x5ba15d['model'],qs[_0x44fa('0x37')](_0x31d0e8[_0x44fa('0x31')][_0x44fa('0x37')]));_0x492bad['attributes']=_0x492bad['attributes']['length']?_0x492bad[_0x44fa('0x35')]:_0x5ba15d[_0x44fa('0x34')];if(!_0x31d0e8[_0x44fa('0x31')][_0x44fa('0x38')]('nolimit')){_0x492bad[_0x44fa('0x1d')]=qs[_0x44fa('0x1d')](_0x31d0e8[_0x44fa('0x31')][_0x44fa('0x1d')]);_0x492bad['offset']=qs[_0x44fa('0x1b')](_0x31d0e8[_0x44fa('0x31')][_0x44fa('0x1b')]);}_0x492bad['order']=qs[_0x44fa('0x39')](_0x31d0e8['query'][_0x44fa('0x39')]);_0x492bad[_0x44fa('0x3a')]=qs[_0x44fa('0x33')](_[_0x44fa('0x3b')](_0x31d0e8[_0x44fa('0x31')],_0x5ba15d[_0x44fa('0x33')]),_0x35f025);if(_0x31d0e8[_0x44fa('0x31')][_0x44fa('0x3c')]){_0x492bad[_0x44fa('0x3a')]=_[_0x44fa('0x3d')](_0x492bad[_0x44fa('0x3a')],{'$or':_[_0x44fa('0x30')](_0x35f025,function(_0xdf4fe8){if(_0xdf4fe8['type']!==_0x44fa('0x3e')){var _0x56868d={};_0x56868d[_0xdf4fe8[_0x44fa('0x29')]]={'$like':'%'+_0x31d0e8[_0x44fa('0x31')][_0x44fa('0x3c')]+'%'};return _0x56868d;}})});}_0x492bad=_[_0x44fa('0x3d')]({},_0x492bad,_0x31d0e8[_0x44fa('0x3f')]);var _0x45e515={'where':_0x492bad[_0x44fa('0x3a')]};return db[_0x44fa('0x2c')][_0x44fa('0x1e')](_0x45e515)[_0x44fa('0x24')](function(_0x26a21b){_0x2c2349[_0x44fa('0x1e')]=_0x26a21b;if(_0x31d0e8[_0x44fa('0x31')]['includeAll']){_0x492bad[_0x44fa('0x40')]=[{'all':!![]}];}return db[_0x44fa('0x2c')]['findAll'](_0x492bad);})[_0x44fa('0x24')](function(_0x4bf187){_0x2c2349[_0x44fa('0x41')]=_0x4bf187;return _0x2c2349;})['then'](respondWithFilteredResult(_0x16bb37,_0x492bad))[_0x44fa('0x42')](handleError(_0x16bb37,null));};exports['show']=function(_0x17dd73,_0x36e812){var _0x5a7f8b={'raw':!![],'where':{'id':_0x17dd73[_0x44fa('0x43')]['id']}},_0x3c04e8={};_0x3c04e8['model']=_['keys'](db[_0x44fa('0x2c')]['rawAttributes']);_0x3c04e8[_0x44fa('0x31')]=_[_0x44fa('0x32')](_0x17dd73[_0x44fa('0x31')]);_0x3c04e8[_0x44fa('0x33')]=_[_0x44fa('0x36')](_0x3c04e8[_0x44fa('0x34')],_0x3c04e8['query']);_0x5a7f8b['attributes']=_['intersection'](_0x3c04e8[_0x44fa('0x34')],qs['fields'](_0x17dd73[_0x44fa('0x31')]['fields']));_0x5a7f8b[_0x44fa('0x35')]=_0x5a7f8b['attributes']['length']?_0x5a7f8b[_0x44fa('0x35')]:_0x3c04e8[_0x44fa('0x34')];if(_0x17dd73[_0x44fa('0x31')]['includeAll']){_0x5a7f8b[_0x44fa('0x40')]=[{'all':!![]}];}_0x5a7f8b=_['merge']({},_0x5a7f8b,_0x17dd73[_0x44fa('0x3f')]);return db['Variable'][_0x44fa('0x44')](_0x5a7f8b)[_0x44fa('0x24')](handleEntityNotFound(_0x36e812,null))[_0x44fa('0x24')](respondWithResult(_0x36e812,null))[_0x44fa('0x42')](handleError(_0x36e812,null));};exports['create']=function(_0x4d34cb,_0xe9c259){return db[_0x44fa('0x2c')][_0x44fa('0x45')](_0x4d34cb['body'],{})['then'](function(_0x35c980){var _0x3f778a=_0x4d34cb[_0x44fa('0x46')][_0x44fa('0x26')]({'plain':!![]});if(!_0x3f778a)throw new Error(_0x44fa('0x47'));if(_0x3f778a['role']===_0x44fa('0x46')){var _0x487a2c=_0x35c980['get']({'plain':!![]});var _0x3bcaee=_0x44fa('0x48');return db[_0x44fa('0x49')][_0x44fa('0x44')]({'where':{'name':_0x3bcaee,'userProfileId':_0x3f778a[_0x44fa('0x4a')]},'raw':!![]})[_0x44fa('0x24')](function(_0x5da14a){if(_0x5da14a&&_0x5da14a['autoAssociation']===0x0){return db[_0x44fa('0x27')]['create']({'name':_0x487a2c[_0x44fa('0x29')],'resourceId':_0x487a2c['id'],'type':_0x5da14a[_0x44fa('0x29')],'sectionId':_0x5da14a['id']},{})['then'](function(){return _0x35c980;});}else{return _0x35c980;}})[_0x44fa('0x42')](function(_0xd07079){logger[_0x44fa('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd07079);throw _0xd07079;});}return _0x35c980;})[_0x44fa('0x24')](respondWithResult(_0xe9c259,0xc9))[_0x44fa('0x42')](handleError(_0xe9c259,null));};exports['update']=function(_0x2f8f3c,_0x1ddfed){if(_0x2f8f3c[_0x44fa('0x4c')]['id']){delete _0x2f8f3c[_0x44fa('0x4c')]['id'];}return db[_0x44fa('0x2c')][_0x44fa('0x44')]({'where':{'id':_0x2f8f3c[_0x44fa('0x43')]['id']}})['then'](handleEntityNotFound(_0x1ddfed,null))[_0x44fa('0x24')](saveUpdates(_0x2f8f3c[_0x44fa('0x4c')],null))['then'](respondWithResult(_0x1ddfed,null))[_0x44fa('0x42')](handleError(_0x1ddfed,null));};exports[_0x44fa('0x25')]=function(_0x1cc22b,_0x50377f){return db[_0x44fa('0x2c')][_0x44fa('0x44')]({'where':{'id':_0x1cc22b[_0x44fa('0x43')]['id']}})[_0x44fa('0x24')](handleEntityNotFound(_0x50377f,null))[_0x44fa('0x24')](removeEntity(_0x50377f,null))[_0x44fa('0x42')](handleError(_0x50377f,null));}; \ No newline at end of file +var _0xf38a=['map','Variable','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','order','sort','pick','filter','merge','where','type','VIRTUAL','include','params','length','includeAll','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','Variables','UserProfileResource','error','name','send','index'];(function(_0x4cd0a2,_0x3c735e){var _0x3ec208=function(_0x193e69){while(--_0x193e69){_0x4cd0a2['push'](_0x4cd0a2['shift']());}};_0x3ec208(++_0x3c735e);}(_0xf38a,0xc7));var _0xaf38=function(_0x198446,_0x119c8f){_0x198446=_0x198446-0x0;var _0x38d7b7=_0xf38a[_0x198446];return _0x38d7b7;};'use strict';var emlformat=require(_0xaf38('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaf38('0x1'));var rp=require(_0xaf38('0x2'));var moment=require(_0xaf38('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaf38('0x4'));var util=require(_0xaf38('0x5'));var path=require(_0xaf38('0x6'));var sox=require(_0xaf38('0x7'));var csv=require(_0xaf38('0x8'));var ejs=require(_0xaf38('0x9'));var fs=require('fs');var fs_extra=require(_0xaf38('0xa'));var _=require(_0xaf38('0xb'));var squel=require(_0xaf38('0xc'));var crypto=require(_0xaf38('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaf38('0x8'));var querystring=require(_0xaf38('0xe'));var Papa=require(_0xaf38('0xf'));var Redis=require(_0xaf38('0x10'));var authService=require(_0xaf38('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaf38('0x12'));var hardwareService=require(_0xaf38('0x13'));var logger=require(_0xaf38('0x14'))(_0xaf38('0x15'));var utils=require(_0xaf38('0x16'));var config=require(_0xaf38('0x17'));var licenseUtil=require(_0xaf38('0x18'));var db=require(_0xaf38('0x19'))['db'];function respondWithStatusCode(_0x1dc0b1,_0x3f9a6b){_0x3f9a6b=_0x3f9a6b||0xcc;return function(_0x3ff46a){if(_0x3ff46a){return _0x1dc0b1[_0xaf38('0x1a')](_0x3f9a6b);}return _0x1dc0b1[_0xaf38('0x1b')](_0x3f9a6b)[_0xaf38('0x1c')]();};}function respondWithResult(_0x53900c,_0x288348){_0x288348=_0x288348||0xc8;return function(_0x4276ba){if(_0x4276ba){return _0x53900c[_0xaf38('0x1b')](_0x288348)[_0xaf38('0x1d')](_0x4276ba);}};}function respondWithFilteredResult(_0x5ac595,_0x6d6184){return function(_0x149136){if(_0x149136){var _0x44607e=typeof _0x6d6184[_0xaf38('0x1e')]===_0xaf38('0x1f')&&typeof _0x6d6184[_0xaf38('0x20')]===_0xaf38('0x1f');var _0x23e1b6=_0x149136['count'];var _0x80a378=_0x44607e?0x0:_0x6d6184[_0xaf38('0x1e')];var _0xbcf9f6=_0x44607e?_0x149136[_0xaf38('0x21')]:_0x6d6184[_0xaf38('0x1e')]+_0x6d6184[_0xaf38('0x20')];var _0x1bc257;if(_0xbcf9f6>=_0x23e1b6){_0xbcf9f6=_0x23e1b6;_0x1bc257=0xc8;}else{_0x1bc257=0xce;}_0x5ac595['status'](_0x1bc257);return _0x5ac595[_0xaf38('0x22')]('Content-Range',_0x80a378+'-'+_0xbcf9f6+'/'+_0x23e1b6)[_0xaf38('0x1d')](_0x149136);}return null;};}function patchUpdates(_0x3fe7b4){return function(_0x3e7677){try{jsonpatch[_0xaf38('0x23')](_0x3e7677,_0x3fe7b4,!![]);}catch(_0x429238){return BPromise[_0xaf38('0x24')](_0x429238);}return _0x3e7677[_0xaf38('0x25')]();};}function saveUpdates(_0x23a424,_0x3a16cb){return function(_0x369e92){if(_0x369e92){return _0x369e92[_0xaf38('0x26')](_0x23a424)['then'](function(_0xb9bb0f){return _0xb9bb0f;});}return null;};}function removeEntity(_0x305beb,_0x850e2e){return function(_0x4cd5e9){if(_0x4cd5e9){return _0x4cd5e9[_0xaf38('0x27')]()[_0xaf38('0x28')](function(){var _0x57344c=_0x4cd5e9['get']({'plain':!![]});var _0x20fe09=_0xaf38('0x29');return db[_0xaf38('0x2a')]['destroy']({'where':{'type':_0x20fe09,'resourceId':_0x57344c['id']}})[_0xaf38('0x28')](function(){return _0x4cd5e9;});})['then'](function(){_0x305beb[_0xaf38('0x1b')](0xcc)[_0xaf38('0x1c')]();});}};}function handleEntityNotFound(_0x40aee8,_0x3aaea8){return function(_0x2169dd){if(!_0x2169dd){_0x40aee8[_0xaf38('0x1a')](0x194);}return _0x2169dd;};}function handleError(_0x5d07ab,_0x51fde2){_0x51fde2=_0x51fde2||0x1f4;return function(_0x150551){logger[_0xaf38('0x2b')](_0x150551['stack']);if(_0x150551[_0xaf38('0x2c')]){delete _0x150551[_0xaf38('0x2c')];}_0x5d07ab['status'](_0x51fde2)[_0xaf38('0x2d')](_0x150551);};}exports[_0xaf38('0x2e')]=function(_0x302165,_0x32c82d){var _0x1aa522={},_0x1470ad={},_0x3ba54d={'count':0x0,'rows':[]};var _0x141167=_[_0xaf38('0x2f')](db[_0xaf38('0x30')][_0xaf38('0x31')],function(_0x4c70db){return{'name':_0x4c70db[_0xaf38('0x32')],'type':_0x4c70db['type'][_0xaf38('0x33')]};});_0x1470ad['model']=_[_0xaf38('0x2f')](_0x141167,'name');_0x1470ad[_0xaf38('0x34')]=_[_0xaf38('0x35')](_0x302165[_0xaf38('0x34')]);_0x1470ad[_0xaf38('0x36')]=_[_0xaf38('0x37')](_0x1470ad[_0xaf38('0x38')],_0x1470ad[_0xaf38('0x34')]);_0x1aa522[_0xaf38('0x39')]=_[_0xaf38('0x37')](_0x1470ad[_0xaf38('0x38')],qs[_0xaf38('0x3a')](_0x302165[_0xaf38('0x34')][_0xaf38('0x3a')]));_0x1aa522[_0xaf38('0x39')]=_0x1aa522[_0xaf38('0x39')]['length']?_0x1aa522[_0xaf38('0x39')]:_0x1470ad['model'];if(!_0x302165[_0xaf38('0x34')]['hasOwnProperty']('nolimit')){_0x1aa522['limit']=qs['limit'](_0x302165[_0xaf38('0x34')][_0xaf38('0x20')]);_0x1aa522['offset']=qs['offset'](_0x302165[_0xaf38('0x34')][_0xaf38('0x1e')]);}_0x1aa522[_0xaf38('0x3b')]=qs['sort'](_0x302165['query'][_0xaf38('0x3c')]);_0x1aa522['where']=qs[_0xaf38('0x36')](_[_0xaf38('0x3d')](_0x302165['query'],_0x1470ad[_0xaf38('0x36')]),_0x141167);if(_0x302165['query'][_0xaf38('0x3e')]){_0x1aa522['where']=_[_0xaf38('0x3f')](_0x1aa522[_0xaf38('0x40')],{'$or':_[_0xaf38('0x2f')](_0x141167,function(_0x2e35df){if(_0x2e35df[_0xaf38('0x41')]!==_0xaf38('0x42')){var _0x32fc32={};_0x32fc32[_0x2e35df['name']]={'$like':'%'+_0x302165[_0xaf38('0x34')][_0xaf38('0x3e')]+'%'};return _0x32fc32;}})});}_0x1aa522=_['merge']({},_0x1aa522,_0x302165['options']);var _0x358191={'where':_0x1aa522['where']};return db['Variable'][_0xaf38('0x21')](_0x358191)[_0xaf38('0x28')](function(_0x14dea8){_0x3ba54d[_0xaf38('0x21')]=_0x14dea8;if(_0x302165[_0xaf38('0x34')]['includeAll']){_0x1aa522[_0xaf38('0x43')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x1aa522);})[_0xaf38('0x28')](function(_0x1968ce){_0x3ba54d['rows']=_0x1968ce;return _0x3ba54d;})['then'](respondWithFilteredResult(_0x32c82d,_0x1aa522))['catch'](handleError(_0x32c82d,null));};exports['show']=function(_0x5ea217,_0x3b6397){var _0x4dee03={'raw':!![],'where':{'id':_0x5ea217[_0xaf38('0x44')]['id']}},_0x51ce12={};_0x51ce12['model']=_[_0xaf38('0x35')](db['Variable'][_0xaf38('0x31')]);_0x51ce12[_0xaf38('0x34')]=_[_0xaf38('0x35')](_0x5ea217['query']);_0x51ce12[_0xaf38('0x36')]=_['intersection'](_0x51ce12[_0xaf38('0x38')],_0x51ce12[_0xaf38('0x34')]);_0x4dee03[_0xaf38('0x39')]=_['intersection'](_0x51ce12[_0xaf38('0x38')],qs['fields'](_0x5ea217[_0xaf38('0x34')]['fields']));_0x4dee03[_0xaf38('0x39')]=_0x4dee03[_0xaf38('0x39')][_0xaf38('0x45')]?_0x4dee03['attributes']:_0x51ce12[_0xaf38('0x38')];if(_0x5ea217['query'][_0xaf38('0x46')]){_0x4dee03[_0xaf38('0x43')]=[{'all':!![]}];}_0x4dee03=_[_0xaf38('0x3f')]({},_0x4dee03,_0x5ea217[_0xaf38('0x47')]);return db[_0xaf38('0x30')][_0xaf38('0x48')](_0x4dee03)['then'](handleEntityNotFound(_0x3b6397,null))[_0xaf38('0x28')](respondWithResult(_0x3b6397,null))[_0xaf38('0x49')](handleError(_0x3b6397,null));};exports[_0xaf38('0x4a')]=function(_0x14230f,_0x31d950){return db[_0xaf38('0x30')]['create'](_0x14230f[_0xaf38('0x4b')],{})[_0xaf38('0x28')](function(_0x1aeed7){var _0x108028=_0x14230f[_0xaf38('0x4c')][_0xaf38('0x4d')]({'plain':!![]});if(!_0x108028)throw new Error(_0xaf38('0x4e'));if(_0x108028[_0xaf38('0x4f')]===_0xaf38('0x4c')){var _0x25cf2f=_0x1aeed7[_0xaf38('0x4d')]({'plain':!![]});var _0xf76d4a=_0xaf38('0x29');return db['UserProfileSection']['find']({'where':{'name':_0xf76d4a,'userProfileId':_0x108028['userProfileId']},'raw':!![]})['then'](function(_0x386622){if(_0x386622&&_0x386622[_0xaf38('0x50')]===0x0){return db[_0xaf38('0x2a')][_0xaf38('0x4a')]({'name':_0x25cf2f[_0xaf38('0x2c')],'resourceId':_0x25cf2f['id'],'type':_0x386622['name'],'sectionId':_0x386622['id']},{})[_0xaf38('0x28')](function(){return _0x1aeed7;});}else{return _0x1aeed7;}})[_0xaf38('0x49')](function(_0x549dcd){logger[_0xaf38('0x2b')](_0xaf38('0x51'),_0x549dcd);throw _0x549dcd;});}return _0x1aeed7;})[_0xaf38('0x28')](respondWithResult(_0x31d950,0xc9))[_0xaf38('0x49')](handleError(_0x31d950,null));};exports['update']=function(_0x3cfa7e,_0x3e82f3){if(_0x3cfa7e['body']['id']){delete _0x3cfa7e[_0xaf38('0x4b')]['id'];}return db[_0xaf38('0x30')][_0xaf38('0x48')]({'where':{'id':_0x3cfa7e['params']['id']}})[_0xaf38('0x28')](handleEntityNotFound(_0x3e82f3,null))[_0xaf38('0x28')](saveUpdates(_0x3cfa7e[_0xaf38('0x4b')],null))[_0xaf38('0x28')](respondWithResult(_0x3e82f3,null))['catch'](handleError(_0x3e82f3,null));};exports[_0xaf38('0x27')]=function(_0x370caf,_0x5de38b){return db['Variable'][_0xaf38('0x48')]({'where':{'id':_0x370caf[_0xaf38('0x44')]['id']}})['then'](handleEntityNotFound(_0x5de38b,null))[_0xaf38('0x28')](removeEntity(_0x5de38b,null))['catch'](handleError(_0x5de38b,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2e19d08..9f47bb8 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 _0x6b0b=['exports','Variable','tools_variables','lodash','moment','bluebird','rimraf','./variable.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b0b,0xd3));var _0xb6b0=function(_0x1a1f45,_0x382389){_0x1a1f45=_0x1a1f45-0x0;var _0x2bc637=_0x6b0b[_0x1a1f45];return _0x2bc637;};'use strict';var _=require(_0xb6b0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6b0('0x1'));var BPromise=require(_0xb6b0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb6b0('0x3'));var config=require('../../config/environment');var attributes=require(_0xb6b0('0x4'));module[_0xb6b0('0x5')]=function(_0x3c84fd,_0x310128){return _0x3c84fd['define'](_0xb6b0('0x6'),attributes,{'tableName':_0xb6b0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa90f=['request-promise','path','rimraf','./variable.attributes','exports','define','Variable','tools_variables','lodash','../../config/logger','api'];(function(_0x118020,_0x23f397){var _0x428dd4=function(_0x3bdf0d){while(--_0x3bdf0d){_0x118020['push'](_0x118020['shift']());}};_0x428dd4(++_0x23f397);}(_0xa90f,0x1b5));var _0xfa90=function(_0x2d4647,_0x457cdf){_0x2d4647=_0x2d4647-0x0;var _0x244448=_0xa90f[_0x2d4647];return _0x244448;};'use strict';var _=require(_0xfa90('0x0'));var util=require('util');var logger=require(_0xfa90('0x1'))(_0xfa90('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfa90('0x3'));var fs=require('fs');var path=require(_0xfa90('0x4'));var rimraf=require(_0xfa90('0x5'));var config=require('../../config/environment');var attributes=require(_0xfa90('0x6'));module[_0xfa90('0x7')]=function(_0x2b5826,_0x4e436a){return _0x2b5826[_0xfa90('0x8')](_0xfa90('0x9'),attributes,{'tableName':_0xfa90('0xa'),'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 bd6ff6f..72ba358 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 _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x257125,_0x321f95){var _0x15f782=function(_0x4daf0d){while(--_0x4daf0d){_0x257125['push'](_0x257125['shift']());}};_0x15f782(++_0x321f95);}(_0xf494,0x1c6));var _0x4f49=function(_0x415ae6,_0x4ebd9d){_0x415ae6=_0x415ae6-0x0;var _0x5bf3ea=_0xf494[_0x415ae6];return _0x5bf3ea;};'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);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x21fc96,_0x2df0fe){var _0x2e00b0=function(_0x439cde){while(--_0x439cde){_0x21fc96['push'](_0x21fc96['shift']());}};_0x2e00b0(++_0x2df0fe);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4b6817,_0x3f5651){_0x4b6817=_0x4b6817-0x0;var _0x5cc3db=_0x1cb9[_0x4b6817];return _0x5cc3db;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 94bb296..921f895 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 _0x680e=['fetch','/reset','reset','/pull','restart','/migrations','exports','express','Router','get','index','/fetch','isAuthenticated','canUpdate'];(function(_0x2084f3,_0x423d9a){var _0x1e0ea3=function(_0x24d764){while(--_0x24d764){_0x2084f3['push'](_0x2084f3['shift']());}};_0x1e0ea3(++_0x423d9a);}(_0x680e,0x69));var _0xe680=function(_0x2380ed,_0x16def3){_0x2380ed=_0x2380ed-0x0;var _0x4dcdda=_0x680e[_0x2380ed];return _0x4dcdda;};'use strict';var express=require(_0xe680('0x0'));var router=express[_0xe680('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0xe680('0x2')]('/',controller[_0xe680('0x3')]);router['get'](_0xe680('0x4'),auth[_0xe680('0x5')](),auth[_0xe680('0x6')](),controller[_0xe680('0x7')]);router[_0xe680('0x2')](_0xe680('0x8'),auth[_0xe680('0x5')](),auth[_0xe680('0x6')](),controller[_0xe680('0x9')]);router[_0xe680('0x2')](_0xe680('0xa'),auth[_0xe680('0x5')](),auth[_0xe680('0x6')](),controller['pull']);router[_0xe680('0x2')]('/restart',auth['isAuthenticated'](),controller[_0xe680('0xb')]);router[_0xe680('0x2')](_0xe680('0xc'),controller['migrations']);module[_0xe680('0xd')]=router; \ No newline at end of file +var _0xd28c=['Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','/migrations','migrations','exports','express'];(function(_0x5ebf76,_0x5a5ed6){var _0x45f1b2=function(_0x30b02f){while(--_0x30b02f){_0x5ebf76['push'](_0x5ebf76['shift']());}};_0x45f1b2(++_0x5a5ed6);}(_0xd28c,0x153));var _0xcd28=function(_0x57d521,_0x4e09f0){_0x57d521=_0x57d521-0x0;var _0x413678=_0xd28c[_0x57d521];return _0x413678;};'use strict';var express=require(_0xcd28('0x0'));var router=express[_0xcd28('0x1')]();var auth=require(_0xcd28('0x2'));var controller=require(_0xcd28('0x3'));router[_0xcd28('0x4')]('/',controller['index']);router[_0xcd28('0x4')](_0xcd28('0x5'),auth[_0xcd28('0x6')](),auth[_0xcd28('0x7')](),controller[_0xcd28('0x8')]);router[_0xcd28('0x4')](_0xcd28('0x9'),auth[_0xcd28('0x6')](),auth[_0xcd28('0x7')](),controller[_0xcd28('0xa')]);router[_0xcd28('0x4')](_0xcd28('0xb'),auth[_0xcd28('0x6')](),auth[_0xcd28('0x7')](),controller[_0xcd28('0xc')]);router[_0xcd28('0x4')](_0xcd28('0xd'),auth[_0xcd28('0x6')](),controller['restart']);router[_0xcd28('0x4')](_0xcd28('0xe'),controller[_0xcd28('0xf')]);module[_0xcd28('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 2fac49d..1951e43 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 _0xfc70=['catch','join','server','migrations','length','.js','push','sort','sequelize','Migration','root','Database\x20migrated\x20successfully\x20from\x20version\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','index','query','latest','fetch','exports','json','status','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfc70,0x10d));var _0x0fc7=function(_0x24c376,_0x46e8f6){_0x24c376=_0x24c376-0x0;var _0x1757e0=_0xfc70[_0x24c376];return _0x1757e0;};'use strict';var Umzug=require(_0x0fc7('0x0'));var path=require(_0x0fc7('0x1'));var fs=require('fs');var _=require(_0x0fc7('0x2'));var pkginfo=require(_0x0fc7('0x3'))(module,_0x0fc7('0x4'));var compareVersions=require(_0x0fc7('0x5'));var exec=require(_0x0fc7('0x6'))[_0x0fc7('0x7')];var db=require(_0x0fc7('0x8'))['db'];var config=require('../../config/environment');var pm2=require(_0x0fc7('0x9'));var logger=require(_0x0fc7('0xa'))(_0x0fc7('0xb'));var git=require(_0x0fc7('0xc'))(config['root']);exports[_0x0fc7('0xd')]=function(_0x4ed41e,_0x3ff2d4){var _0x25a59e={'current':module['exports'][_0x0fc7('0x4')],'phonebar':0x2};if(_0x4ed41e[_0x0fc7('0xe')]&&_0x4ed41e[_0x0fc7('0xe')][_0x0fc7('0xf')]){return git[_0x0fc7('0x10')]()['tags'](function(_0x26b96c,_0x3059a8){_0x25a59e['latest']=(_0x26b96c?module[_0x0fc7('0x11')][_0x0fc7('0x4')]:_0x3059a8[_0x0fc7('0xf')])||'2.0.0';return _0x3ff2d4['status'](0xc8)[_0x0fc7('0x12')](_0x25a59e);});}else{return _0x3ff2d4[_0x0fc7('0x13')](0xc8)['json'](_0x25a59e);}};exports['fetch']=function(_0x4efc65,_0x460798){return git[_0x0fc7('0x10')]([_0x0fc7('0x14'),_0x0fc7('0x15')],function(_0x45051d){if(_0x45051d){logger[_0x0fc7('0x16')](_0x45051d);return _0x460798[_0x0fc7('0x13')](0x1f4)[_0x0fc7('0x12')](_0x45051d);}logger[_0x0fc7('0x17')]('git\x20fetch');return _0x460798[_0x0fc7('0x13')](0xc8)[_0x0fc7('0x12')]({'output':_0x0fc7('0x18')});});};exports[_0x0fc7('0x19')]=function(_0x1d691b,_0x4e428a){return git[_0x0fc7('0x19')]([_0x0fc7('0x1a'),_0x0fc7('0x1b')],function(_0x5eae36){if(_0x5eae36){logger[_0x0fc7('0x16')](_0x5eae36);return _0x4e428a[_0x0fc7('0x13')](0x1f4)['json'](_0x5eae36);}logger[_0x0fc7('0x17')](_0x0fc7('0x1c'));return _0x4e428a[_0x0fc7('0x13')](0xc8)[_0x0fc7('0x12')]({'output':_0x0fc7('0x1d')});});};exports[_0x0fc7('0x1e')]=function(_0x4f1aaa,_0x317b56){exec(_0x0fc7('0x1f'),function(_0x1e8717,_0x3e868c,_0x56a9c6){logger[_0x0fc7('0x17')](_0x3e868c);logger[_0x0fc7('0x17')](_0x56a9c6);if(_0x1e8717){logger['error'](_0x1e8717);return _0x317b56[_0x0fc7('0x13')](0x1f4)[_0x0fc7('0x12')](_0x1e8717);}return _0x317b56[_0x0fc7('0x13')](0xc8)[_0x0fc7('0x12')]({'output':_0x3e868c});});};exports['restart']=function(_0x55b40e,_0x26d7d6){return pm2[_0x0fc7('0x20')](_0x0fc7('0x21'))[_0x0fc7('0x22')](function(_0xb99e48){logger[_0x0fc7('0x17')](_0x0fc7('0x23'),_0xb99e48);return _0x26d7d6[_0x0fc7('0x13')](0xc8)[_0x0fc7('0x12')]({'output':_0x0fc7('0x24')});})[_0x0fc7('0x25')](function(_0x15352e){logger['error'](_0x15352e);return _0x26d7d6[_0x0fc7('0x13')](0x1f4)[_0x0fc7('0x12')](_0x15352e);});};exports['migrations']=function(_0x2b228a,_0x1c2b17){var _0x1b9d1a=fs['readdirSync'](path[_0x0fc7('0x26')](config['root'],_0x0fc7('0x27'),_0x0fc7('0x28')));var _0x2e308e=[];for(var _0x4453bd=0x0;_0x4453bd<_0x1b9d1a[_0x0fc7('0x29')];_0x4453bd++){var _0x32afc6=_0x1b9d1a[_0x4453bd]['replace'](_0x0fc7('0x2a'),'');if(compareVersions(module['exports'][_0x0fc7('0x4')],_0x32afc6)===-0x1){_0x2e308e[_0x0fc7('0x2b')](_0x32afc6);}}if(_0x2e308e['length']){var _0x17039b=_0x2e308e[_0x0fc7('0x2c')](compareVersions);var _0xd2b29c=new Umzug({'storage':_0x0fc7('0x2d'),'storageOptions':{'model':db['Migration'],'modelName':_0x0fc7('0x2e'),'columnName':_0x0fc7('0x4')},'migrations':{'params':[db[_0x0fc7('0x2d')]['getQueryInterface'](),db['sequelize']['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config[_0x0fc7('0x2f')],_0x0fc7('0x27'),_0x0fc7('0x28')),'pattern':/\.js$/}});_0xd2b29c['up']({'migrations':_['map'](_0x17039b,function(_0x24145f){return _0x24145f+'.js';})})[_0x0fc7('0x22')](function(){return _0x1c2b17[_0x0fc7('0x13')](0xc8)[_0x0fc7('0x12')]({'output':_0x0fc7('0x30')+module['exports'][_0x0fc7('0x4')]+'\x20to\x20'+_['last'](_0x17039b),'migrations':_['join'](_0x17039b)});})[_0x0fc7('0x25')](function(_0x4f4cb5){if(_0x4f4cb5 instanceof db[_0x0fc7('0x2d')][_0x0fc7('0x31')]){return _0x1c2b17['status'](0xc8)[_0x0fc7('0x12')]({'output':_0x0fc7('0x32')});}else{return _0x1c2b17[_0x0fc7('0x13')](0x1f4)[_0x0fc7('0x12')](_0x4f4cb5);}});}else{return _0x1c2b17['status'](0xc8)[_0x0fc7('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x5fd3=['--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','error','readdirSync','join','root','server','migrations','length','replace','version','push','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.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','child_process','exec','../../mysqldb','../../config/logger','update','simple-git','index','exports','query','fetch','tags','latest','2.0.0','status','json','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset'];(function(_0x45f694,_0x47f8d5){var _0x50ae67=function(_0x8be2ba){while(--_0x8be2ba){_0x45f694['push'](_0x45f694['shift']());}};_0x50ae67(++_0x47f8d5);}(_0x5fd3,0xc4));var _0x35fd=function(_0x17d845,_0x28a0cc){_0x17d845=_0x17d845-0x0;var _0x4a1cce=_0x5fd3[_0x17d845];return _0x4a1cce;};'use strict';var Umzug=require(_0x35fd('0x0'));var path=require(_0x35fd('0x1'));var fs=require('fs');var _=require(_0x35fd('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x35fd('0x3'));var exec=require(_0x35fd('0x4'))[_0x35fd('0x5')];var db=require(_0x35fd('0x6'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0x35fd('0x7'))(_0x35fd('0x8'));var git=require(_0x35fd('0x9'))(config['root']);exports[_0x35fd('0xa')]=function(_0x2b5903,_0x14977a){var _0x143037={'current':module[_0x35fd('0xb')]['version'],'phonebar':0x2};if(_0x2b5903[_0x35fd('0xc')]&&_0x2b5903[_0x35fd('0xc')]['latest']){return git[_0x35fd('0xd')]()[_0x35fd('0xe')](function(_0x37ddf8,_0x49e0ff){_0x143037[_0x35fd('0xf')]=(_0x37ddf8?module[_0x35fd('0xb')]['version']:_0x49e0ff[_0x35fd('0xf')])||_0x35fd('0x10');return _0x14977a[_0x35fd('0x11')](0xc8)['json'](_0x143037);});}else{return _0x14977a['status'](0xc8)[_0x35fd('0x12')](_0x143037);}};exports[_0x35fd('0xd')]=function(_0x18c7bb,_0x30083d){return git['fetch'](['origin',_0x35fd('0x13')],function(_0xfce629){if(_0xfce629){logger['error'](_0xfce629);return _0x30083d[_0x35fd('0x11')](0x1f4)[_0x35fd('0x12')](_0xfce629);}logger[_0x35fd('0x14')](_0x35fd('0x15'));return _0x30083d[_0x35fd('0x11')](0xc8)['json']({'output':_0x35fd('0x16')});});};exports[_0x35fd('0x17')]=function(_0x147406,_0x36536b){return git[_0x35fd('0x17')]([_0x35fd('0x18'),_0x35fd('0x19')],function(_0x5d1dc6){if(_0x5d1dc6){logger['error'](_0x5d1dc6);return _0x36536b[_0x35fd('0x11')](0x1f4)[_0x35fd('0x12')](_0x5d1dc6);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x36536b[_0x35fd('0x11')](0xc8)[_0x35fd('0x12')]({'output':_0x35fd('0x1a')});});};exports[_0x35fd('0x1b')]=function(_0x4ed6da,_0x3c1f35){exec(_0x35fd('0x1c'),function(_0x588a02,_0x3dba7b,_0xfb845c){logger['info'](_0x3dba7b);logger[_0x35fd('0x14')](_0xfb845c);if(_0x588a02){logger['error'](_0x588a02);return _0x3c1f35[_0x35fd('0x11')](0x1f4)['json'](_0x588a02);}return _0x3c1f35[_0x35fd('0x11')](0xc8)[_0x35fd('0x12')]({'output':_0x3dba7b});});};exports['restart']=function(_0x15b059,_0x4a9d9f){return pm2[_0x35fd('0x1d')](_0x35fd('0x1e'))[_0x35fd('0x1f')](function(_0x26d55c){logger[_0x35fd('0x14')](_0x35fd('0x20'),_0x26d55c);return _0x4a9d9f['status'](0xc8)[_0x35fd('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x35fd('0x21')](function(_0x4e9128){logger[_0x35fd('0x22')](_0x4e9128);return _0x4a9d9f[_0x35fd('0x11')](0x1f4)[_0x35fd('0x12')](_0x4e9128);});};exports['migrations']=function(_0x4d888c,_0x137351){var _0x316195=fs[_0x35fd('0x23')](path[_0x35fd('0x24')](config[_0x35fd('0x25')],_0x35fd('0x26'),_0x35fd('0x27')));var _0x3c1dbb=[];for(var _0xc3fd8b=0x0;_0xc3fd8b<_0x316195[_0x35fd('0x28')];_0xc3fd8b++){var _0x39e330=_0x316195[_0xc3fd8b][_0x35fd('0x29')]('.js','');if(compareVersions(module[_0x35fd('0xb')][_0x35fd('0x2a')],_0x39e330)===-0x1){_0x3c1dbb[_0x35fd('0x2b')](_0x39e330);}}if(_0x3c1dbb['length']){var _0xf0ea09=_0x3c1dbb[_0x35fd('0x2c')](compareVersions);var _0x2010bb=new Umzug({'storage':_0x35fd('0x2d'),'storageOptions':{'model':db['Migration'],'modelName':_0x35fd('0x2e'),'columnName':_0x35fd('0x2a')},'migrations':{'params':[db['sequelize'][_0x35fd('0x2f')](),db[_0x35fd('0x2d')]['constructor'],function(){throw new Error(_0x35fd('0x30'));}],'path':path[_0x35fd('0x24')](config[_0x35fd('0x25')],_0x35fd('0x26'),'migrations'),'pattern':/\.js$/}});_0x2010bb['up']({'migrations':_[_0x35fd('0x31')](_0xf0ea09,function(_0x4ef7d8){return _0x4ef7d8+_0x35fd('0x32');})})[_0x35fd('0x1f')](function(){return _0x137351['status'](0xc8)[_0x35fd('0x12')]({'output':_0x35fd('0x33')+module['exports'][_0x35fd('0x2a')]+_0x35fd('0x34')+_[_0x35fd('0x35')](_0xf0ea09),'migrations':_[_0x35fd('0x24')](_0xf0ea09)});})['catch'](function(_0x585545){if(_0x585545 instanceof db[_0x35fd('0x2d')]['UniqueConstraintError']){return _0x137351[_0x35fd('0x11')](0xc8)['json']({'output':_0x35fd('0x36')});}else{return _0x137351[_0x35fd('0x11')](0x1f4)[_0x35fd('0x12')](_0x585545);}});}else{return _0x137351['status'](0xc8)['json']({'output':_0x35fd('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 3c152d1..5985041 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 _0x0aa3=['../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x1996de,_0x353085){var _0xea2718=function(_0x5bac11){while(--_0x5bac11){_0x1996de['push'](_0x1996de['shift']());}};_0xea2718(++_0x353085);}(_0x0aa3,0x111));var _0x30aa=function(_0x4cb70f,_0xa28452){_0x4cb70f=_0x4cb70f-0x0;var _0x30dd48=_0x0aa3[_0x4cb70f];return _0x30dd48;};'use strict';var multer=require(_0x30aa('0x0'));var util=require(_0x30aa('0x1'));var path=require(_0x30aa('0x2'));var timeout=require(_0x30aa('0x3'));var express=require(_0x30aa('0x4'));var router=express['Router']();var fs_extra=require(_0x30aa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x30aa('0x6'));var config=require(_0x30aa('0x7'));var controller=require(_0x30aa('0x8'));router[_0x30aa('0x9')]('/',auth[_0x30aa('0xa')](),controller[_0x30aa('0xb')]);router['get']('/describe',auth[_0x30aa('0xa')](),controller[_0x30aa('0xc')]);router[_0x30aa('0x9')](_0x30aa('0xd'),auth[_0x30aa('0xa')](),controller['show']);router[_0x30aa('0xe')]('/',auth[_0x30aa('0xa')](),controller[_0x30aa('0xf')]);router['put'](_0x30aa('0xd'),auth[_0x30aa('0xa')](),controller[_0x30aa('0x10')]);router[_0x30aa('0x11')](_0x30aa('0xd'),auth[_0x30aa('0xa')](),controller[_0x30aa('0x12')]);module[_0x30aa('0x13')]=router; \ No newline at end of file +var _0xa530=['describe','/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe'];(function(_0x4e8a33,_0x217d95){var _0x4d9f9b=function(_0x49b7fb){while(--_0x49b7fb){_0x4e8a33['push'](_0x4e8a33['shift']());}};_0x4d9f9b(++_0x217d95);}(_0xa530,0x7a));var _0x0a53=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0xa530[_0x29d2d2];return _0x3f6476;};'use strict';var multer=require(_0x0a53('0x0'));var util=require(_0x0a53('0x1'));var path=require('path');var timeout=require(_0x0a53('0x2'));var express=require(_0x0a53('0x3'));var router=express[_0x0a53('0x4')]();var fs_extra=require(_0x0a53('0x5'));var auth=require(_0x0a53('0x6'));var interaction=require(_0x0a53('0x7'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x0a53('0x8')]('/',auth[_0x0a53('0x9')](),controller['index']);router[_0x0a53('0x8')](_0x0a53('0xa'),auth[_0x0a53('0x9')](),controller[_0x0a53('0xb')]);router[_0x0a53('0x8')](_0x0a53('0xc'),auth[_0x0a53('0x9')](),controller[_0x0a53('0xd')]);router['post']('/',auth[_0x0a53('0x9')](),controller[_0x0a53('0xe')]);router['put'](_0x0a53('0xc'),auth['isAuthenticated'](),controller[_0x0a53('0xf')]);router[_0x0a53('0x10')](_0x0a53('0xc'),auth[_0x0a53('0x9')](),controller[_0x0a53('0x11')]);module[_0x0a53('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index d366a34..08b724d 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 _0x3264=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3264,0x7f));var _0x4326=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x3264[_0x2aa0e7];return _0x1472c0;};'use strict';var Sequelize=require('sequelize');module[_0x4326('0x0')]={'type':{'type':Sequelize[_0x4326('0x1')]},'uniqueid':{'type':Sequelize[_0x4326('0x1')]},'calleridnum':{'type':Sequelize[_0x4326('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x4326('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x4326('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x4326('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x4326('0x2')]},'agentdumpAt':{'type':Sequelize[_0x4326('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4326('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4326('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4326('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4326('0x4')]},'agentacw':{'type':Sequelize[_0x4326('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4326('0x4')]},'reason':{'type':Sequelize[_0x4326('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x4326('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4326('0x1')]},'connectedlinenum':{'type':Sequelize[_0x4326('0x1')]},'connectedlinename':{'type':Sequelize[_0x4326('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4326('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4326('0x1')]},'destchannel':{'type':Sequelize[_0x4326('0x1')]},'destchannelstate':{'type':Sequelize[_0x4326('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x4326('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x4326('0x1')]},'destaccountcode':{'type':Sequelize[_0x4326('0x1')]},'destcontext':{'type':Sequelize[_0x4326('0x1')]},'destexten':{'type':Sequelize[_0x4326('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x4326('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4326('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x4326('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4326('0x1')],'comment':_0x4326('0x5')},'transferexten':{'type':Sequelize[_0x4326('0x1')]},'transferuniqueid':{'type':Sequelize[_0x4326('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd4f4=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x52fdb0,_0x47f76e){_0x52fdb0=_0x52fdb0-0x0;var _0x58ee58=_0xd4f4[_0x52fdb0];return _0x58ee58;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'type':{'type':Sequelize[_0x4d4f('0x2')]},'uniqueid':{'type':Sequelize[_0x4d4f('0x2')]},'calleridnum':{'type':Sequelize[_0x4d4f('0x2')]},'calleridname':{'type':Sequelize[_0x4d4f('0x2')]},'queue':{'type':Sequelize[_0x4d4f('0x2')]},'interface':{'type':Sequelize[_0x4d4f('0x2')]},'membername':{'type':Sequelize[_0x4d4f('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4d4f('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4d4f('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x4d4f('0x4')]},'agentcomplete':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4d4f('0x4')]},'agentacw':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4d4f('0x4')]},'reason':{'type':Sequelize[_0x4d4f('0x2')]},'lastevent':{'type':Sequelize[_0x4d4f('0x2')]},'channel':{'type':Sequelize[_0x4d4f('0x2')]},'channelstate':{'type':Sequelize[_0x4d4f('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4d4f('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4d4f('0x2')]},'connectedlinename':{'type':Sequelize[_0x4d4f('0x2')]},'language':{'type':Sequelize[_0x4d4f('0x2')]},'accountcode':{'type':Sequelize[_0x4d4f('0x2')]},'context':{'type':Sequelize[_0x4d4f('0x2')]},'exten':{'type':Sequelize[_0x4d4f('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4d4f('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4d4f('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4d4f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4d4f('0x2')]},'destlanguage':{'type':Sequelize[_0x4d4f('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4d4f('0x2')]},'destexten':{'type':Sequelize[_0x4d4f('0x2')]},'destpriority':{'type':Sequelize[_0x4d4f('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4d4f('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4d4f('0x2')],'comment':_0x4d4f('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x4d4f('0x2')]},'agententerreason':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 17fb9a9..72a0bea 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(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 bd52c74..0385f14 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 _0xdb70=['request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x111e37,_0x24a7bf){var _0x38196e=function(_0x4dfa4e){while(--_0x4dfa4e){_0x111e37['push'](_0x111e37['shift']());}};_0x38196e(++_0x24a7bf);}(_0xdb70,0xa0));var _0x0db7=function(_0x98c9b4,_0x31b540){_0x98c9b4=_0x98c9b4-0x0;var _0x57f252=_0xdb70[_0x98c9b4];return _0x57f252;};'use strict';var _=require(_0x0db7('0x0'));var util=require(_0x0db7('0x1'));var logger=require(_0x0db7('0x2'))('api');var moment=require(_0x0db7('0x3'));var BPromise=require(_0x0db7('0x4'));var rp=require(_0x0db7('0x5'));var fs=require('fs');var path=require(_0x0db7('0x6'));var rimraf=require(_0x0db7('0x7'));var config=require(_0x0db7('0x8'));var attributes=require(_0x0db7('0x9'));module[_0x0db7('0xa')]=function(_0x13fcf7,_0xbefc2a){return _0x13fcf7[_0x0db7('0xb')]('VoiceAgentReport',attributes,{'tableName':_0x0db7('0xc'),'paranoid':![],'indexes':[{'fields':[_0x0db7('0xd'),_0x0db7('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa23f=['define','report_agent','destuniqueid','lodash','util','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa23f,0x7c));var _0xfa23=function(_0x3a16f9,_0x2ea293){_0x3a16f9=_0x3a16f9-0x0;var _0x3e0f7f=_0xa23f[_0x3a16f9];return _0x3e0f7f;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfa23('0x2'));var BPromise=require(_0xfa23('0x3'));var rp=require(_0xfa23('0x4'));var fs=require('fs');var path=require(_0xfa23('0x5'));var rimraf=require('rimraf');var config=require(_0xfa23('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0xfa23('0x7')]=function(_0x2df2f5,_0x4c3f4){return _0x2df2f5[_0xfa23('0x8')]('VoiceAgentReport',attributes,{'tableName':_0xfa23('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xfa23('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 8fa37d3..e3a8353 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 _0x6e56=['create','options','raw','catch','UpdateVoiceAgentReport','VoiceAgentReport','update','body','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateVoiceAgentReport'];(function(_0x2fa2a0,_0x1cfd07){var _0x142861=function(_0xadf4b9){while(--_0xadf4b9){_0x2fa2a0['push'](_0x2fa2a0['shift']());}};_0x142861(++_0x1cfd07);}(_0x6e56,0x155));var _0x66e5=function(_0x24310a,_0x22f59f){_0x24310a=_0x24310a-0x0;var _0x34fe89=_0x6e56[_0x24310a];return _0x34fe89;};'use strict';var _=require(_0x66e5('0x0'));var util=require(_0x66e5('0x1'));var moment=require(_0x66e5('0x2'));var BPromise=require('bluebird');var rs=require(_0x66e5('0x3'));var fs=require('fs');var Redis=require(_0x66e5('0x4'));var db=require(_0x66e5('0x5'))['db'];var utils=require(_0x66e5('0x6'));var logger=require(_0x66e5('0x7'))(_0x66e5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x66e5('0x9')][_0x66e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d92c1,_0x521a5e,_0x5cfffd){return new BPromise(function(_0x19f08c,_0x569a14){return client['request'](_0x5d92c1,_0x5cfffd)[_0x66e5('0xb')](function(_0x2c6d6d){logger[_0x66e5('0xc')](_0x66e5('0xd'),_0x521a5e,_0x66e5('0xe'));logger[_0x66e5('0xf')](_0x66e5('0x10'),_0x521a5e,_0x66e5('0xe'),JSON[_0x66e5('0x11')](_0x2c6d6d));if(_0x2c6d6d[_0x66e5('0x12')]){if(_0x2c6d6d[_0x66e5('0x12')][_0x66e5('0x13')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x521a5e,_0x2c6d6d[_0x66e5('0x12')][_0x66e5('0x14')]);return _0x569a14(_0x2c6d6d[_0x66e5('0x12')][_0x66e5('0x14')]);}logger[_0x66e5('0x12')](_0x66e5('0xd'),_0x521a5e,_0x2c6d6d[_0x66e5('0x12')]['message']);return _0x19f08c(_0x2c6d6d['error'][_0x66e5('0x14')]);}else{logger[_0x66e5('0xc')](_0x66e5('0xd'),_0x521a5e,_0x66e5('0xe'));_0x19f08c(_0x2c6d6d['result'][_0x66e5('0x14')]);}})['catch'](function(_0x107c78){logger['error'](_0x66e5('0xd'),_0x521a5e,_0x107c78);_0x569a14(_0x107c78);});});}exports[_0x66e5('0x15')]=function(_0x275b0f){var _0x4f07b2=this;return new Promise(function(_0x298d90,_0x48b328){return db['VoiceAgentReport'][_0x66e5('0x16')](_0x275b0f['body'],{'raw':_0x275b0f['options']?_0x275b0f[_0x66e5('0x17')][_0x66e5('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5d45ea){logger['info'](_0x66e5('0x15'),_0x275b0f);logger[_0x66e5('0xf')](_0x66e5('0x15'),_0x275b0f,JSON[_0x66e5('0x11')](_0x5d45ea));_0x298d90(_0x5d45ea);})[_0x66e5('0x19')](function(_0x571dfc){logger[_0x66e5('0x12')]('CreateVoiceAgentReport',_0x571dfc[_0x66e5('0x14')],_0x275b0f);_0x48b328(_0x4f07b2['error'](0x1f4,_0x571dfc[_0x66e5('0x14')]));});});};exports[_0x66e5('0x1a')]=function(_0x165ebd){var _0x493764=this;return new Promise(function(_0x2325d9,_0x2c153b){return db[_0x66e5('0x1b')][_0x66e5('0x1c')](_0x165ebd[_0x66e5('0x1d')],{'raw':_0x165ebd['options']?_0x165ebd[_0x66e5('0x17')][_0x66e5('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x165ebd['options']?_0x165ebd[_0x66e5('0x17')][_0x66e5('0x1e')]||null:null,'attributes':_0x165ebd[_0x66e5('0x17')]?_0x165ebd['options'][_0x66e5('0x1f')]||null:null,'limit':_0x165ebd[_0x66e5('0x17')]?_0x165ebd[_0x66e5('0x17')][_0x66e5('0x20')]||null:null})[_0x66e5('0xb')](function(_0x14b43e){logger['info'](_0x66e5('0x1a'),_0x165ebd);logger[_0x66e5('0xf')]('UpdateVoiceAgentReport',_0x165ebd,JSON['stringify'](_0x14b43e));_0x2325d9(_0x14b43e);})['catch'](function(_0x2d08f2){logger[_0x66e5('0x12')](_0x66e5('0x1a'),_0x2d08f2[_0x66e5('0x14')],_0x165ebd);_0x2c153b(_0x493764[_0x66e5('0x12')](0x1f4,_0x2d08f2[_0x66e5('0x14')]));});});}; \ No newline at end of file +var _0xfea9=['UpdateVoiceAgentReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','stringify','catch'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xfea9,0x6b));var _0x9fea=function(_0x2ebf6d,_0x53fca7){_0x2ebf6d=_0x2ebf6d-0x0;var _0x3905d1=_0xfea9[_0x2ebf6d];return _0x3905d1;};'use strict';var _=require('lodash');var util=require(_0x9fea('0x0'));var moment=require(_0x9fea('0x1'));var BPromise=require(_0x9fea('0x2'));var rs=require(_0x9fea('0x3'));var fs=require('fs');var Redis=require(_0x9fea('0x4'));var db=require(_0x9fea('0x5'))['db'];var utils=require(_0x9fea('0x6'));var logger=require(_0x9fea('0x7'))('rpc');var config=require(_0x9fea('0x8'));var jayson=require(_0x9fea('0x9'));var client=jayson[_0x9fea('0xa')][_0x9fea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdfdfb4,_0x48e87b,_0x4df588){return new BPromise(function(_0x20f68c,_0x46bdff){return client[_0x9fea('0xc')](_0xdfdfb4,_0x4df588)[_0x9fea('0xd')](function(_0x44961b){logger[_0x9fea('0xe')](_0x9fea('0xf'),_0x48e87b,_0x9fea('0x10'));logger[_0x9fea('0x11')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x48e87b,'request\x20sent',JSON['stringify'](_0x44961b));if(_0x44961b[_0x9fea('0x12')]){if(_0x44961b[_0x9fea('0x12')][_0x9fea('0x13')]===0x1f4){logger['error'](_0x9fea('0xf'),_0x48e87b,_0x44961b[_0x9fea('0x12')][_0x9fea('0x14')]);return _0x46bdff(_0x44961b[_0x9fea('0x12')][_0x9fea('0x14')]);}logger[_0x9fea('0x12')](_0x9fea('0xf'),_0x48e87b,_0x44961b['error'][_0x9fea('0x14')]);return _0x20f68c(_0x44961b['error'][_0x9fea('0x14')]);}else{logger[_0x9fea('0xe')](_0x9fea('0xf'),_0x48e87b,_0x9fea('0x10'));_0x20f68c(_0x44961b['result']['message']);}})['catch'](function(_0x324d81){logger[_0x9fea('0x12')](_0x9fea('0xf'),_0x48e87b,_0x324d81);_0x46bdff(_0x324d81);});});}exports[_0x9fea('0x15')]=function(_0x4c8ddd){var _0x59fbca=this;return new Promise(function(_0x831a2f,_0x3bd40a){return db[_0x9fea('0x16')][_0x9fea('0x17')](_0x4c8ddd[_0x9fea('0x18')],{'raw':_0x4c8ddd[_0x9fea('0x19')]?_0x4c8ddd[_0x9fea('0x19')][_0x9fea('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3f5049){logger[_0x9fea('0xe')](_0x9fea('0x15'),_0x4c8ddd);logger[_0x9fea('0x11')](_0x9fea('0x15'),_0x4c8ddd,JSON[_0x9fea('0x1b')](_0x3f5049));_0x831a2f(_0x3f5049);})[_0x9fea('0x1c')](function(_0x262b5e){logger[_0x9fea('0x12')]('CreateVoiceAgentReport',_0x262b5e[_0x9fea('0x14')],_0x4c8ddd);_0x3bd40a(_0x59fbca[_0x9fea('0x12')](0x1f4,_0x262b5e['message']));});});};exports[_0x9fea('0x1d')]=function(_0x52e415){var _0x573e6e=this;return new Promise(function(_0x299124,_0x4232a2){return db[_0x9fea('0x16')][_0x9fea('0x1e')](_0x52e415[_0x9fea('0x18')],{'raw':_0x52e415['options']?_0x52e415[_0x9fea('0x19')][_0x9fea('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52e415[_0x9fea('0x19')]?_0x52e415[_0x9fea('0x19')][_0x9fea('0x1f')]||null:null,'attributes':_0x52e415['options']?_0x52e415[_0x9fea('0x19')][_0x9fea('0x20')]||null:null,'limit':_0x52e415['options']?_0x52e415['options'][_0x9fea('0x21')]||null:null})[_0x9fea('0xd')](function(_0x4f79c1){logger['info'](_0x9fea('0x1d'),_0x52e415);logger['debug'](_0x9fea('0x1d'),_0x52e415,JSON[_0x9fea('0x1b')](_0x4f79c1));_0x299124(_0x4f79c1);})[_0x9fea('0x1c')](function(_0x3bee21){logger[_0x9fea('0x12')](_0x9fea('0x1d'),_0x3bee21[_0x9fea('0x14')],_0x52e415);_0x4232a2(_0x573e6e[_0x9fea('0x12')](0x1f4,_0x3bee21[_0x9fea('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 820782b..9b7fc3e 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 _0x826a=['post','create','put','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x1ac565,_0xec228f){var _0x34208e=function(_0x3d0243){while(--_0x3d0243){_0x1ac565['push'](_0x1ac565['shift']());}};_0x34208e(++_0xec228f);}(_0x826a,0x1aa));var _0xa826=function(_0x1d518d,_0x518ef4){_0x1d518d=_0x1d518d-0x0;var _0x11dd87=_0x826a[_0x1d518d];return _0x11dd87;};'use strict';var multer=require('multer');var util=require(_0xa826('0x0'));var path=require('path');var timeout=require(_0xa826('0x1'));var express=require('express');var router=express[_0xa826('0x2')]();var fs_extra=require(_0xa826('0x3'));var auth=require(_0xa826('0x4'));var interaction=require(_0xa826('0x5'));var config=require('../../config/environment');var controller=require(_0xa826('0x6'));router[_0xa826('0x7')]('/',auth[_0xa826('0x8')](),controller[_0xa826('0x9')]);router[_0xa826('0x7')](_0xa826('0xa'),auth[_0xa826('0x8')](),controller[_0xa826('0xb')]);router[_0xa826('0x7')](_0xa826('0xc'),auth[_0xa826('0x8')](),controller[_0xa826('0xd')]);router[_0xa826('0xe')]('/',auth[_0xa826('0x8')](),controller[_0xa826('0xf')]);router[_0xa826('0x10')]('/:id',auth[_0xa826('0x8')](),controller['update']);router[_0xa826('0x11')](_0xa826('0xc'),auth[_0xa826('0x8')](),controller[_0xa826('0x12')]);module[_0xa826('0x13')]=router; \ No newline at end of file +var _0x425d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x317d61,_0x5e6335){var _0x3abc20=function(_0x556876){while(--_0x556876){_0x317d61['push'](_0x317d61['shift']());}};_0x3abc20(++_0x5e6335);}(_0x425d,0x1e0));var _0xd425=function(_0xe4cd7d,_0x3c7064){_0xe4cd7d=_0xe4cd7d-0x0;var _0x2ff977=_0x425d[_0xe4cd7d];return _0x2ff977;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var fs_extra=require(_0xd425('0x5'));var auth=require(_0xd425('0x6'));var interaction=require(_0xd425('0x7'));var config=require('../../config/environment');var controller=require(_0xd425('0x8'));router[_0xd425('0x9')]('/',auth[_0xd425('0xa')](),controller[_0xd425('0xb')]);router[_0xd425('0x9')](_0xd425('0xc'),auth['isAuthenticated'](),controller[_0xd425('0xd')]);router[_0xd425('0x9')](_0xd425('0xe'),auth[_0xd425('0xa')](),controller[_0xd425('0xf')]);router[_0xd425('0x10')]('/',auth[_0xd425('0xa')](),controller[_0xd425('0x11')]);router[_0xd425('0x12')](_0xd425('0xe'),auth[_0xd425('0xa')](),controller[_0xd425('0x13')]);router[_0xd425('0x14')](_0xd425('0xe'),auth[_0xd425('0xa')](),controller[_0xd425('0x15')]);module[_0xd425('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 457c583..be6527f 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 _0xf8cd=['sequelize','exports','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xf8cd,0xf7));var _0xdf8c=function(_0x58e1ba,_0x5edc7e){_0x58e1ba=_0x58e1ba-0x0;var _0x3100f9=_0xf8cd[_0x58e1ba];return _0x3100f9;};'use strict';var Sequelize=require(_0xdf8c('0x0'));module[_0xdf8c('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xdf8c('0x2')](_0xdf8c('0x3'),_0xdf8c('0x4'),_0xdf8c('0x5'),_0xdf8c('0x6'),_0xdf8c('0x7'),_0xdf8c('0x8'))},'tag':{'type':Sequelize[_0xdf8c('0x9')]},'accountcode':{'type':Sequelize[_0xdf8c('0x9')]},'source':{'type':Sequelize[_0xdf8c('0x9')]},'destination':{'type':Sequelize[_0xdf8c('0x9')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xdf8c('0x9')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xdf8c('0xa')]},'starttime':{'type':Sequelize[_0xdf8c('0xb')]},'systemanswertime':{'type':Sequelize[_0xdf8c('0xb')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xdf8c('0xb')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xdf8c('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdf8c('0x9')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xdf8c('0x9')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xdf8c('0x9')]},'prefix':{'type':Sequelize[_0xdf8c('0x9')]},'routeid':{'type':Sequelize[_0xdf8c('0xc')]},'sipcallid':{'type':Sequelize[_0xdf8c('0x9')]}}; \ No newline at end of file +var _0x1c9a=['DATE','INTEGER','sequelize','STRING','inbound','internal','outbound','outbound-fax','dialer','TEXT'];(function(_0x1d1bf1,_0x283b2e){var _0x35849b=function(_0x2772d4){while(--_0x2772d4){_0x1d1bf1['push'](_0x1d1bf1['shift']());}};_0x35849b(++_0x283b2e);}(_0x1c9a,0x98));var _0xa1c9=function(_0x569ae9,_0x2a3bec){_0x569ae9=_0x569ae9-0x0;var _0x449f83=_0x1c9a[_0x569ae9];return _0x449f83;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa1c9('0x1')]},'type':{'type':Sequelize['ENUM'](_0xa1c9('0x2'),_0xa1c9('0x3'),_0xa1c9('0x4'),'inbound-fax',_0xa1c9('0x5'),_0xa1c9('0x6'))},'tag':{'type':Sequelize[_0xa1c9('0x1')]},'accountcode':{'type':Sequelize[_0xa1c9('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xa1c9('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa1c9('0x1')]},'channel':{'type':Sequelize[_0xa1c9('0x1')]},'destinationchannel':{'type':Sequelize[_0xa1c9('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xa1c9('0x7')]},'starttime':{'type':Sequelize[_0xa1c9('0x8')]},'systemanswertime':{'type':Sequelize[_0xa1c9('0x8')]},'answertime':{'type':Sequelize[_0xa1c9('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xa1c9('0x9')]},'billableseconds':{'type':Sequelize[_0xa1c9('0x9')]},'mohtime':{'type':Sequelize[_0xa1c9('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa1c9('0x1')]},'amaflags':{'type':Sequelize[_0xa1c9('0x1')]},'userfield':{'type':Sequelize[_0xa1c9('0x1')]},'userDisposition':{'type':Sequelize[_0xa1c9('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xa1c9('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xa1c9('0x1')]},'note':{'type':Sequelize[_0xa1c9('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xa1c9('0x9')]},'sipcallid':{'type':Sequelize[_0xa1c9('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 84aee80..f144b43 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x526744,_0xe9a4e2){var _0xebcb29=function(_0x5bb816){while(--_0x5bb816){_0x526744['push'](_0x526744['shift']());}};_0xebcb29(++_0xe9a4e2);}(_0xdb28,0x106));var _0x8db2=function(_0x1414d1,_0x300d17){_0x1414d1=_0x1414d1-0x0;var _0x228c05=_0xdb28[_0x1414d1];return _0x228c05;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x4676fe,_0x13f2fb){_0x4676fe=_0x4676fe-0x0;var _0x1d5b3a=_0x2032[_0x4676fe];return _0x1d5b3a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 2d91d21..9927f75 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 _0xba59=['rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xba59,0x1a8));var _0x9ba5=function(_0x459b74,_0x5773bd){_0x459b74=_0x459b74-0x0;var _0x46cb16=_0xba59[_0x459b74];return _0x46cb16;};'use strict';var _=require(_0x9ba5('0x0'));var util=require('util');var logger=require(_0x9ba5('0x1'))(_0x9ba5('0x2'));var moment=require('moment');var BPromise=require(_0x9ba5('0x3'));var rp=require(_0x9ba5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ba5('0x5'));var config=require('../../config/environment');var attributes=require(_0x9ba5('0x6'));module[_0x9ba5('0x7')]=function(_0x8896cc,_0x8a4399){return _0x8896cc[_0x9ba5('0x8')](_0x9ba5('0x9'),attributes,{'tableName':_0x9ba5('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd353=['./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid','lodash','util','api','moment','path','../../config/environment'];(function(_0x2d6327,_0x489fd1){var _0x10505d=function(_0x47e7b2){while(--_0x47e7b2){_0x2d6327['push'](_0x2d6327['shift']());}};_0x10505d(++_0x489fd1);}(_0xd353,0x7e));var _0x3d35=function(_0x21cbe9,_0x3ad218){_0x21cbe9=_0x21cbe9-0x0;var _0x147eef=_0xd353[_0x21cbe9];return _0x147eef;};'use strict';var _=require(_0x3d35('0x0'));var util=require(_0x3d35('0x1'));var logger=require('../../config/logger')(_0x3d35('0x2'));var moment=require(_0x3d35('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d35('0x4'));var rimraf=require('rimraf');var config=require(_0x3d35('0x5'));var attributes=require(_0x3d35('0x6'));module[_0x3d35('0x7')]=function(_0xb43971,_0x16965f){return _0xb43971[_0x3d35('0x8')](_0x3d35('0x9'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x3d35('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 9bcdee1..c83a708 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 _0x799d=['request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','limit','include','map','attributes','model','CreateVoiceCallReport','create','UpdateVoiceCallReport','body','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s'];(function(_0x5d9ceb,_0x1a49f5){var _0x33ce82=function(_0x583915){while(--_0x583915){_0x5d9ceb['push'](_0x5d9ceb['shift']());}};_0x33ce82(++_0x1a49f5);}(_0x799d,0x16d));var _0xd799=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x799d[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0xd799('0x0'));var moment=require(_0xd799('0x1'));var BPromise=require(_0xd799('0x2'));var rs=require(_0xd799('0x3'));var fs=require('fs');var Redis=require(_0xd799('0x4'));var db=require(_0xd799('0x5'))['db'];var utils=require(_0xd799('0x6'));var logger=require(_0xd799('0x7'))(_0xd799('0x8'));var config=require('../../config/environment');var jayson=require(_0xd799('0x9'));var client=jayson[_0xd799('0xa')][_0xd799('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x812bf1,_0x3bfb7c,_0x76eaf4){return new BPromise(function(_0x11a1c2,_0x51ac92){return client['request'](_0x812bf1,_0x76eaf4)[_0xd799('0xc')](function(_0x24edbb){logger[_0xd799('0xd')](_0xd799('0xe'),_0x3bfb7c,_0xd799('0xf'));logger[_0xd799('0x10')](_0xd799('0x11'),_0x3bfb7c,_0xd799('0xf'),JSON[_0xd799('0x12')](_0x24edbb));if(_0x24edbb['error']){if(_0x24edbb[_0xd799('0x13')][_0xd799('0x14')]===0x1f4){logger['error'](_0xd799('0xe'),_0x3bfb7c,_0x24edbb['error']['message']);return _0x51ac92(_0x24edbb[_0xd799('0x13')][_0xd799('0x15')]);}logger['error'](_0xd799('0xe'),_0x3bfb7c,_0x24edbb[_0xd799('0x13')][_0xd799('0x15')]);return _0x11a1c2(_0x24edbb[_0xd799('0x13')][_0xd799('0x15')]);}else{logger[_0xd799('0xd')](_0xd799('0xe'),_0x3bfb7c,_0xd799('0xf'));_0x11a1c2(_0x24edbb['result'][_0xd799('0x15')]);}})[_0xd799('0x16')](function(_0x3c2955){logger[_0xd799('0x13')](_0xd799('0xe'),_0x3bfb7c,_0x3c2955);_0x51ac92(_0x3c2955);});});}exports[_0xd799('0x17')]=function(_0x5b4de6){var _0x417d79=this;return new Promise(function(_0x4df82d,_0x193436){return db[_0xd799('0x18')][_0xd799('0x19')]({'raw':_0x5b4de6['options']?_0x5b4de6[_0xd799('0x1a')][_0xd799('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b4de6[_0xd799('0x1a')]?_0x5b4de6[_0xd799('0x1a')][_0xd799('0x1c')]||null:null,'attributes':_0x5b4de6['options']?_0x5b4de6['options']['attributes']||null:null,'limit':_0x5b4de6[_0xd799('0x1a')]?_0x5b4de6[_0xd799('0x1a')][_0xd799('0x1d')]||null:null,'include':_0x5b4de6[_0xd799('0x1a')]?_0x5b4de6[_0xd799('0x1a')][_0xd799('0x1e')]?_[_0xd799('0x1f')](_0x5b4de6[_0xd799('0x1a')][_0xd799('0x1e')],function(_0x1db4e2){return{'model':db[_0x1db4e2['model']],'as':_0x1db4e2['as'],'attributes':_0x1db4e2[_0xd799('0x20')],'include':_0x1db4e2['include']?_[_0xd799('0x1f')](_0x1db4e2[_0xd799('0x1e')],function(_0x36849c){return{'model':db[_0x36849c[_0xd799('0x21')]],'as':_0x36849c['as'],'attributes':_0x36849c[_0xd799('0x20')],'include':_0x36849c[_0xd799('0x1e')]?_['map'](_0x36849c['include'],function(_0x14c990){return{'model':db[_0x14c990[_0xd799('0x21')]],'as':_0x14c990['as'],'attributes':_0x14c990['attributes']};}):[]};}):[]};}):[]:[]})[_0xd799('0xc')](function(_0x4e9ee7){logger[_0xd799('0xd')](_0xd799('0x17'),_0x5b4de6);logger[_0xd799('0x10')](_0xd799('0x17'),_0x5b4de6,JSON[_0xd799('0x12')](_0x4e9ee7));_0x4df82d(_0x4e9ee7);})[_0xd799('0x16')](function(_0x542ce1){logger['error']('GetVoiceCallReport',_0x542ce1[_0xd799('0x15')],_0x5b4de6);_0x193436(_0x417d79[_0xd799('0x13')](0x1f4,_0x542ce1[_0xd799('0x15')]));});});};exports[_0xd799('0x22')]=function(_0x465235){var _0x1c96f1=this;return new Promise(function(_0x1be026,_0x28e693){return db[_0xd799('0x18')][_0xd799('0x23')](_0x465235['body'],{'raw':_0x465235[_0xd799('0x1a')]?_0x465235[_0xd799('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xd799('0xc')](function(_0x19f044){logger[_0xd799('0xd')](_0xd799('0x22'),_0x465235);logger[_0xd799('0x10')](_0xd799('0x22'),_0x465235,JSON['stringify'](_0x19f044));_0x1be026(_0x19f044);})[_0xd799('0x16')](function(_0x375fe3){logger['error']('CreateVoiceCallReport',_0x375fe3[_0xd799('0x15')],_0x465235);_0x28e693(_0x1c96f1[_0xd799('0x13')](0x1f4,_0x375fe3[_0xd799('0x15')]));});});};exports[_0xd799('0x24')]=function(_0x1b3c54){var _0x456a59=this;return new Promise(function(_0x1c4f74,_0x206639){return db[_0xd799('0x18')]['update'](_0x1b3c54[_0xd799('0x25')],{'raw':_0x1b3c54[_0xd799('0x1a')]?_0x1b3c54[_0xd799('0x1a')][_0xd799('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b3c54['options']?_0x1b3c54[_0xd799('0x1a')]['where']||null:null,'attributes':_0x1b3c54['options']?_0x1b3c54[_0xd799('0x1a')][_0xd799('0x20')]||null:null,'limit':_0x1b3c54[_0xd799('0x1a')]?_0x1b3c54['options'][_0xd799('0x1d')]||null:null})[_0xd799('0xc')](function(_0x295393){logger[_0xd799('0xd')](_0xd799('0x24'),_0x1b3c54);logger['debug'](_0xd799('0x24'),_0x1b3c54,JSON[_0xd799('0x12')](_0x295393));_0x1c4f74(_0x295393);})[_0xd799('0x16')](function(_0x48b93c){logger[_0xd799('0x13')](_0xd799('0x24'),_0x48b93c[_0xd799('0x15')],_0x1b3c54);_0x206639(_0x456a59[_0xd799('0x13')](0x1f4,_0x48b93c[_0xd799('0x15')]));});});}; \ No newline at end of file +var _0xdf4e=['message','result','catch','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceCallReport,\x20%s,\x20%s'];(function(_0x4de3fb,_0x76194f){var _0x3499f5=function(_0x17805a){while(--_0x17805a){_0x4de3fb['push'](_0x4de3fb['shift']());}};_0x3499f5(++_0x76194f);}(_0xdf4e,0x88));var _0xedf4=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xdf4e[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0xedf4('0x0'));var util=require(_0xedf4('0x1'));var moment=require(_0xedf4('0x2'));var BPromise=require('bluebird');var rs=require(_0xedf4('0x3'));var fs=require('fs');var Redis=require(_0xedf4('0x4'));var db=require(_0xedf4('0x5'))['db'];var utils=require(_0xedf4('0x6'));var logger=require(_0xedf4('0x7'))(_0xedf4('0x8'));var config=require(_0xedf4('0x9'));var jayson=require(_0xedf4('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x42b2e4,_0x5f0918,_0xaa23b3){return new BPromise(function(_0x5f5158,_0x584b4c){return client[_0xedf4('0xb')](_0x42b2e4,_0xaa23b3)[_0xedf4('0xc')](function(_0x5243d9){logger[_0xedf4('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x5f0918,'request\x20sent');logger[_0xedf4('0xe')](_0xedf4('0xf'),_0x5f0918,_0xedf4('0x10'),JSON[_0xedf4('0x11')](_0x5243d9));if(_0x5243d9['error']){if(_0x5243d9[_0xedf4('0x12')]['code']===0x1f4){logger[_0xedf4('0x12')](_0xedf4('0x13'),_0x5f0918,_0x5243d9[_0xedf4('0x12')]['message']);return _0x584b4c(_0x5243d9[_0xedf4('0x12')][_0xedf4('0x14')]);}logger[_0xedf4('0x12')](_0xedf4('0x13'),_0x5f0918,_0x5243d9[_0xedf4('0x12')][_0xedf4('0x14')]);return _0x5f5158(_0x5243d9[_0xedf4('0x12')][_0xedf4('0x14')]);}else{logger[_0xedf4('0xd')](_0xedf4('0x13'),_0x5f0918,_0xedf4('0x10'));_0x5f5158(_0x5243d9[_0xedf4('0x15')][_0xedf4('0x14')]);}})[_0xedf4('0x16')](function(_0x29e987){logger['error'](_0xedf4('0x13'),_0x5f0918,_0x29e987);_0x584b4c(_0x29e987);});});}exports['GetVoiceCallReport']=function(_0x2e56a6){var _0x3f9213=this;return new Promise(function(_0x28510c,_0x4d30d0){return db[_0xedf4('0x17')][_0xedf4('0x18')]({'raw':_0x2e56a6[_0xedf4('0x19')]?_0x2e56a6[_0xedf4('0x19')][_0xedf4('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e56a6[_0xedf4('0x19')]?_0x2e56a6[_0xedf4('0x19')]['where']||null:null,'attributes':_0x2e56a6[_0xedf4('0x19')]?_0x2e56a6['options'][_0xedf4('0x1b')]||null:null,'limit':_0x2e56a6[_0xedf4('0x19')]?_0x2e56a6['options'][_0xedf4('0x1c')]||null:null,'include':_0x2e56a6[_0xedf4('0x19')]?_0x2e56a6[_0xedf4('0x19')][_0xedf4('0x1d')]?_[_0xedf4('0x1e')](_0x2e56a6['options'][_0xedf4('0x1d')],function(_0x238f41){return{'model':db[_0x238f41[_0xedf4('0x1f')]],'as':_0x238f41['as'],'attributes':_0x238f41['attributes'],'include':_0x238f41[_0xedf4('0x1d')]?_[_0xedf4('0x1e')](_0x238f41[_0xedf4('0x1d')],function(_0xd5c4d8){return{'model':db[_0xd5c4d8[_0xedf4('0x1f')]],'as':_0xd5c4d8['as'],'attributes':_0xd5c4d8[_0xedf4('0x1b')],'include':_0xd5c4d8[_0xedf4('0x1d')]?_[_0xedf4('0x1e')](_0xd5c4d8[_0xedf4('0x1d')],function(_0x976f09){return{'model':db[_0x976f09['model']],'as':_0x976f09['as'],'attributes':_0x976f09['attributes']};}):[]};}):[]};}):[]:[]})[_0xedf4('0xc')](function(_0xc40bb6){logger['info'](_0xedf4('0x20'),_0x2e56a6);logger[_0xedf4('0xe')](_0xedf4('0x20'),_0x2e56a6,JSON[_0xedf4('0x11')](_0xc40bb6));_0x28510c(_0xc40bb6);})[_0xedf4('0x16')](function(_0x4c43e0){logger[_0xedf4('0x12')]('GetVoiceCallReport',_0x4c43e0[_0xedf4('0x14')],_0x2e56a6);_0x4d30d0(_0x3f9213[_0xedf4('0x12')](0x1f4,_0x4c43e0[_0xedf4('0x14')]));});});};exports[_0xedf4('0x21')]=function(_0x52df4c){var _0x4f8ad5=this;return new Promise(function(_0x36a681,_0x20eb2b){return db[_0xedf4('0x17')][_0xedf4('0x22')](_0x52df4c[_0xedf4('0x23')],{'raw':_0x52df4c[_0xedf4('0x19')]?_0x52df4c[_0xedf4('0x19')][_0xedf4('0x1a')]===undefined?!![]:![]:!![]})[_0xedf4('0xc')](function(_0x1410f3){logger[_0xedf4('0xd')](_0xedf4('0x21'),_0x52df4c);logger['debug'](_0xedf4('0x21'),_0x52df4c,JSON['stringify'](_0x1410f3));_0x36a681(_0x1410f3);})[_0xedf4('0x16')](function(_0x304112){logger[_0xedf4('0x12')](_0xedf4('0x21'),_0x304112[_0xedf4('0x14')],_0x52df4c);_0x20eb2b(_0x4f8ad5['error'](0x1f4,_0x304112[_0xedf4('0x14')]));});});};exports[_0xedf4('0x24')]=function(_0x118abd){var _0x3e15b9=this;return new Promise(function(_0xd0e4d2,_0x5e2c71){return db[_0xedf4('0x17')][_0xedf4('0x25')](_0x118abd[_0xedf4('0x23')],{'raw':_0x118abd['options']?_0x118abd['options'][_0xedf4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x118abd[_0xedf4('0x19')]?_0x118abd['options'][_0xedf4('0x26')]||null:null,'attributes':_0x118abd[_0xedf4('0x19')]?_0x118abd[_0xedf4('0x19')][_0xedf4('0x1b')]||null:null,'limit':_0x118abd[_0xedf4('0x19')]?_0x118abd[_0xedf4('0x19')]['limit']||null:null})[_0xedf4('0xc')](function(_0x3fd3a4){logger[_0xedf4('0xd')](_0xedf4('0x24'),_0x118abd);logger[_0xedf4('0xe')](_0xedf4('0x24'),_0x118abd,JSON[_0xedf4('0x11')](_0x3fd3a4));_0xd0e4d2(_0x3fd3a4);})['catch'](function(_0x117817){logger['error'](_0xedf4('0x24'),_0x117817[_0xedf4('0x14')],_0x118abd);_0x5e2c71(_0x3e15b9[_0xedf4('0x12')](0x1f4,_0x117817['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index da0bcae..5e98ac5 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 _0xcee5=['update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceChanSpy.controller','get','index','/:id','show','post','put','isAuthenticated'];(function(_0x2e1e96,_0x341008){var _0x329177=function(_0xe56ea5){while(--_0xe56ea5){_0x2e1e96['push'](_0x2e1e96['shift']());}};_0x329177(++_0x341008);}(_0xcee5,0x18f));var _0x5cee=function(_0x46f604,_0x54ede5){_0x46f604=_0x46f604-0x0;var _0x191c6e=_0xcee5[_0x46f604];return _0x191c6e;};'use strict';var multer=require(_0x5cee('0x0'));var util=require(_0x5cee('0x1'));var path=require(_0x5cee('0x2'));var timeout=require(_0x5cee('0x3'));var express=require('express');var router=express[_0x5cee('0x4')]();var fs_extra=require(_0x5cee('0x5'));var auth=require(_0x5cee('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5cee('0x7'));router[_0x5cee('0x8')]('/',auth['isAuthenticated'](),controller[_0x5cee('0x9')]);router[_0x5cee('0x8')](_0x5cee('0xa'),auth['isAuthenticated'](),controller[_0x5cee('0xb')]);router[_0x5cee('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5cee('0xd')]('/:id',auth[_0x5cee('0xe')](),controller[_0x5cee('0xf')]);router['delete']('/:id',auth[_0x5cee('0xe')](),controller[_0x5cee('0x10')]);module[_0x5cee('0x11')]=router; \ No newline at end of file +var _0x5217=['multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','isAuthenticated','show','create','put','/:id','update','destroy','exports'];(function(_0x53215b,_0x23bcc2){var _0x3b0ae3=function(_0x1f8f97){while(--_0x1f8f97){_0x53215b['push'](_0x53215b['shift']());}};_0x3b0ae3(++_0x23bcc2);}(_0x5217,0xbb));var _0x7521=function(_0x41251b,_0xc9554){_0x41251b=_0x41251b-0x0;var _0x3e6b9d=_0x5217[_0x41251b];return _0x3e6b9d;};'use strict';var multer=require(_0x7521('0x0'));var util=require('util');var path=require(_0x7521('0x1'));var timeout=require('connect-timeout');var express=require(_0x7521('0x2'));var router=express[_0x7521('0x3')]();var fs_extra=require(_0x7521('0x4'));var auth=require(_0x7521('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7521('0x6'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7521('0x7')]);router[_0x7521('0x8')]('/:id',auth[_0x7521('0x9')](),controller[_0x7521('0xa')]);router['post']('/',auth[_0x7521('0x9')](),controller[_0x7521('0xb')]);router[_0x7521('0xc')](_0x7521('0xd'),auth[_0x7521('0x9')](),controller[_0x7521('0xe')]);router['delete'](_0x7521('0xd'),auth['isAuthenticated'](),controller[_0x7521('0xf')]);module[_0x7521('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index d87977d..8442b29 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 _0xd0c3=['join','options','sequelize','STRING','name'];(function(_0x5ae250,_0x3ea242){var _0x4a9d92=function(_0x304b7a){while(--_0x304b7a){_0x5ae250['push'](_0x5ae250['shift']());}};_0x4a9d92(++_0x3ea242);}(_0xd0c3,0x1f1));var _0x3d0c=function(_0x13d158,_0x4923a4){_0x13d158=_0x13d158-0x0;var _0x5a74ef=_0xd0c3[_0x13d158];return _0x5a74ef;};'use strict';var Sequelize=require(_0x3d0c('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d0c('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x3d0c('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x3d0c('0x1')],'set':function(_0x25627a){this['setDataValue']('options',_0x25627a?_0x25627a[_0x3d0c('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0x3d0c('0x4'))?this['getDataValue'](_0x3d0c('0x4'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x3d0c('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x3d0c('0x1')]},'description':{'type':Sequelize[_0x3d0c('0x1')]}}; \ No newline at end of file +var _0xab12=['STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0x5cb326,_0x51c573){var _0x509f3d=function(_0x22c263){while(--_0x22c263){_0x5cb326['push'](_0x5cb326['shift']());}};_0x509f3d(++_0x51c573);}(_0xab12,0x1b0));var _0x2ab1=function(_0x5eccc2,_0x54b240){_0x5eccc2=_0x5eccc2-0x0;var _0x1d8794=_0xab12[_0x5eccc2];return _0x1d8794;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2ab1('0x0')]},'prefix':{'type':Sequelize[_0x2ab1('0x0')],'unique':_0x2ab1('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x2ab1('0x0')],'set':function(_0x19a6b4){this[_0x2ab1('0x2')](_0x2ab1('0x3'),_0x19a6b4?_0x19a6b4[_0x2ab1('0x4')](''):[]);},'get':function(){return this[_0x2ab1('0x5')](_0x2ab1('0x3'))?this['getDataValue'](_0x2ab1('0x3'))[_0x2ab1('0x6')](''):[];}},'auth':{'type':Sequelize[_0x2ab1('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x2ab1('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2ab1('0x0')]},'description':{'type':Sequelize[_0x2ab1('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index eba798c..13154ba 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 _0x063c=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','get','UserProfileResource','end','error','stack','name','send','VoiceChanSpy','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes'];(function(_0x17be8a,_0xc4f89b){var _0x3ef88f=function(_0x2f12a5){while(--_0x2f12a5){_0x17be8a['push'](_0x17be8a['shift']());}};_0x3ef88f(++_0xc4f89b);}(_0x063c,0xba));var _0xc063=function(_0xd45a2d,_0x539724){_0xd45a2d=_0xd45a2d-0x0;var _0x4b2cf3=_0x063c[_0xd45a2d];return _0x4b2cf3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc063('0x0'));var zipdir=require(_0xc063('0x1'));var jsonpatch=require(_0xc063('0x2'));var rp=require(_0xc063('0x3'));var moment=require(_0xc063('0x4'));var BPromise=require(_0xc063('0x5'));var Mustache=require('mustache');var util=require(_0xc063('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc063('0x7'));var fs=require('fs');var fs_extra=require(_0xc063('0x8'));var _=require('lodash');var squel=require(_0xc063('0x9'));var crypto=require(_0xc063('0xa'));var jsforce=require(_0xc063('0xb'));var deskjs=require(_0xc063('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc063('0xd'));var Papa=require(_0xc063('0xe'));var Redis=require('ioredis');var authService=require(_0xc063('0xf'));var qs=require(_0xc063('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc063('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc063('0x12'));var licenseUtil=require(_0xc063('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8fc3dc,_0x5d0d2a){_0x5d0d2a=_0x5d0d2a||0xcc;return function(_0x14f55e){if(_0x14f55e){return _0x8fc3dc[_0xc063('0x14')](_0x5d0d2a);}return _0x8fc3dc[_0xc063('0x15')](_0x5d0d2a)['end']();};}function respondWithResult(_0x364264,_0x1249b2){_0x1249b2=_0x1249b2||0xc8;return function(_0x21b8da){if(_0x21b8da){return _0x364264[_0xc063('0x15')](_0x1249b2)[_0xc063('0x16')](_0x21b8da);}};}function respondWithFilteredResult(_0x391910,_0xf7fe54){return function(_0xac1724){if(_0xac1724){var _0x3baaeb=typeof _0xf7fe54['offset']===_0xc063('0x17')&&typeof _0xf7fe54[_0xc063('0x18')]==='undefined';var _0x89bb1e=_0xac1724[_0xc063('0x19')];var _0x4dcef1=_0x3baaeb?0x0:_0xf7fe54[_0xc063('0x1a')];var _0x13cc09=_0x3baaeb?_0xac1724[_0xc063('0x19')]:_0xf7fe54[_0xc063('0x1a')]+_0xf7fe54['limit'];var _0x234f33;if(_0x13cc09>=_0x89bb1e){_0x13cc09=_0x89bb1e;_0x234f33=0xc8;}else{_0x234f33=0xce;}_0x391910[_0xc063('0x15')](_0x234f33);return _0x391910[_0xc063('0x1b')]('Content-Range',_0x4dcef1+'-'+_0x13cc09+'/'+_0x89bb1e)[_0xc063('0x16')](_0xac1724);}return null;};}function patchUpdates(_0x5fa053){return function(_0x5741e0){try{jsonpatch[_0xc063('0x1c')](_0x5741e0,_0x5fa053,!![]);}catch(_0x4606eb){return BPromise[_0xc063('0x1d')](_0x4606eb);}return _0x5741e0[_0xc063('0x1e')]();};}function saveUpdates(_0x1ba785,_0x4a82eb){return function(_0x59c960){if(_0x59c960){return _0x59c960['update'](_0x1ba785)[_0xc063('0x1f')](function(_0x552560){return _0x552560;});}return null;};}function removeEntity(_0x4fb406,_0x481a6b){return function(_0x382f79){if(_0x382f79){return _0x382f79[_0xc063('0x20')]()[_0xc063('0x1f')](function(){var _0x10c8e2=_0x382f79[_0xc063('0x21')]({'plain':!![]});var _0x49f26e='ChanSpies';return db[_0xc063('0x22')]['destroy']({'where':{'type':_0x49f26e,'resourceId':_0x10c8e2['id']}})[_0xc063('0x1f')](function(){return _0x382f79;});})[_0xc063('0x1f')](function(){_0x4fb406[_0xc063('0x15')](0xcc)[_0xc063('0x23')]();});}};}function handleEntityNotFound(_0x3bb999,_0x3efd0b){return function(_0x459fea){if(!_0x459fea){_0x3bb999[_0xc063('0x14')](0x194);}return _0x459fea;};}function handleError(_0x5bd61b,_0x3a8663){_0x3a8663=_0x3a8663||0x1f4;return function(_0xb48cc9){logger[_0xc063('0x24')](_0xb48cc9[_0xc063('0x25')]);if(_0xb48cc9[_0xc063('0x26')]){delete _0xb48cc9[_0xc063('0x26')];}_0x5bd61b[_0xc063('0x15')](_0x3a8663)[_0xc063('0x27')](_0xb48cc9);};}exports['index']=function(_0x1f3282,_0x436723){var _0x55f71f={},_0x4bb7f1={},_0x5b0ed3={'count':0x0,'rows':[]};var _0x1bb941=_['map'](db[_0xc063('0x28')][_0xc063('0x29')],function(_0x41df84){return{'name':_0x41df84[_0xc063('0x2a')],'type':_0x41df84['type'][_0xc063('0x2b')]};});_0x4bb7f1[_0xc063('0x2c')]=_[_0xc063('0x2d')](_0x1bb941,'name');_0x4bb7f1[_0xc063('0x2e')]=_['keys'](_0x1f3282[_0xc063('0x2e')]);_0x4bb7f1[_0xc063('0x2f')]=_['intersection'](_0x4bb7f1['model'],_0x4bb7f1[_0xc063('0x2e')]);_0x55f71f['attributes']=_[_0xc063('0x30')](_0x4bb7f1[_0xc063('0x2c')],qs[_0xc063('0x31')](_0x1f3282['query']['fields']));_0x55f71f['attributes']=_0x55f71f[_0xc063('0x32')]['length']?_0x55f71f[_0xc063('0x32')]:_0x4bb7f1['model'];if(!_0x1f3282[_0xc063('0x2e')][_0xc063('0x33')](_0xc063('0x34'))){_0x55f71f[_0xc063('0x18')]=qs['limit'](_0x1f3282[_0xc063('0x2e')][_0xc063('0x18')]);_0x55f71f[_0xc063('0x1a')]=qs['offset'](_0x1f3282[_0xc063('0x2e')][_0xc063('0x1a')]);}_0x55f71f[_0xc063('0x35')]=qs[_0xc063('0x36')](_0x1f3282[_0xc063('0x2e')][_0xc063('0x36')]);_0x55f71f[_0xc063('0x37')]=qs[_0xc063('0x2f')](_[_0xc063('0x38')](_0x1f3282[_0xc063('0x2e')],_0x4bb7f1['filters']),_0x1bb941);if(_0x1f3282[_0xc063('0x2e')][_0xc063('0x39')]){_0x55f71f[_0xc063('0x37')]=_[_0xc063('0x3a')](_0x55f71f[_0xc063('0x37')],{'$or':_[_0xc063('0x2d')](_0x1bb941,function(_0x348ff3){if(_0x348ff3[_0xc063('0x3b')]!=='VIRTUAL'){var _0x550fad={};_0x550fad[_0x348ff3['name']]={'$like':'%'+_0x1f3282['query'][_0xc063('0x39')]+'%'};return _0x550fad;}})});}_0x55f71f=_[_0xc063('0x3a')]({},_0x55f71f,_0x1f3282[_0xc063('0x3c')]);var _0x973833={'where':_0x55f71f[_0xc063('0x37')]};return db[_0xc063('0x28')][_0xc063('0x19')](_0x973833)[_0xc063('0x1f')](function(_0x581dfd){_0x5b0ed3[_0xc063('0x19')]=_0x581dfd;if(_0x1f3282[_0xc063('0x2e')][_0xc063('0x3d')]){_0x55f71f[_0xc063('0x3e')]=[{'all':!![]}];}return db[_0xc063('0x28')]['findAll'](_0x55f71f);})['then'](function(_0x510593){_0x5b0ed3[_0xc063('0x3f')]=_0x510593;return _0x5b0ed3;})[_0xc063('0x1f')](respondWithFilteredResult(_0x436723,_0x55f71f))[_0xc063('0x40')](handleError(_0x436723,null));};exports[_0xc063('0x41')]=function(_0x1ae54a,_0x112d26){var _0xa69627={'raw':![],'where':{'id':_0x1ae54a['params']['id']}},_0x176542={};_0x176542[_0xc063('0x2c')]=_[_0xc063('0x42')](db['VoiceChanSpy'][_0xc063('0x29')]);_0x176542[_0xc063('0x2e')]=_['keys'](_0x1ae54a[_0xc063('0x2e')]);_0x176542[_0xc063('0x2f')]=_[_0xc063('0x30')](_0x176542[_0xc063('0x2c')],_0x176542['query']);_0xa69627[_0xc063('0x32')]=_[_0xc063('0x30')](_0x176542[_0xc063('0x2c')],qs['fields'](_0x1ae54a['query'][_0xc063('0x31')]));_0xa69627[_0xc063('0x32')]=_0xa69627[_0xc063('0x32')][_0xc063('0x43')]?_0xa69627[_0xc063('0x32')]:_0x176542['model'];if(_0x1ae54a[_0xc063('0x2e')][_0xc063('0x3d')]){_0xa69627[_0xc063('0x3e')]=[{'all':!![]}];}_0xa69627=_[_0xc063('0x3a')]({},_0xa69627,_0x1ae54a['options']);return db[_0xc063('0x28')][_0xc063('0x44')](_0xa69627)['then'](handleEntityNotFound(_0x112d26,null))[_0xc063('0x1f')](respondWithResult(_0x112d26,null))['catch'](handleError(_0x112d26,null));};exports[_0xc063('0x45')]=function(_0x1cf271,_0x253e6f){return db[_0xc063('0x28')]['create'](_0x1cf271[_0xc063('0x46')],{})[_0xc063('0x1f')](function(_0x15074d){var _0x190223=_0x1cf271[_0xc063('0x47')]['get']({'plain':!![]});if(!_0x190223)throw new Error(_0xc063('0x48'));if(_0x190223['role']===_0xc063('0x47')){var _0x17416f=_0x15074d[_0xc063('0x21')]({'plain':!![]});var _0x3bd533=_0xc063('0x49');return db[_0xc063('0x4a')][_0xc063('0x44')]({'where':{'name':_0x3bd533,'userProfileId':_0x190223[_0xc063('0x4b')]},'raw':!![]})[_0xc063('0x1f')](function(_0x144797){if(_0x144797&&_0x144797['autoAssociation']===0x0){return db['UserProfileResource'][_0xc063('0x45')]({'name':_0x17416f[_0xc063('0x26')],'resourceId':_0x17416f['id'],'type':_0x144797[_0xc063('0x26')],'sectionId':_0x144797['id']},{})[_0xc063('0x1f')](function(){return _0x15074d;});}else{return _0x15074d;}})['catch'](function(_0x24bec2){logger[_0xc063('0x24')](_0xc063('0x4c'),_0x24bec2);throw _0x24bec2;});}return _0x15074d;})[_0xc063('0x1f')](respondWithResult(_0x253e6f,0xc9))[_0xc063('0x40')](handleError(_0x253e6f,null));};exports[_0xc063('0x4d')]=function(_0x571c86,_0x4f2bad){if(_0x571c86[_0xc063('0x46')]['id']){delete _0x571c86[_0xc063('0x46')]['id'];}return db[_0xc063('0x28')][_0xc063('0x44')]({'where':{'id':_0x571c86[_0xc063('0x4e')]['id']}})[_0xc063('0x1f')](handleEntityNotFound(_0x4f2bad,null))[_0xc063('0x1f')](saveUpdates(_0x571c86[_0xc063('0x46')],null))[_0xc063('0x1f')](respondWithResult(_0x4f2bad,null))[_0xc063('0x40')](handleError(_0x4f2bad,null));};exports[_0xc063('0x20')]=function(_0x2fa6d3,_0x5b67ae){return db[_0xc063('0x28')][_0xc063('0x44')]({'where':{'id':_0x2fa6d3['params']['id']}})[_0xc063('0x1f')](handleEntityNotFound(_0x5b67ae,null))['then'](removeEntity(_0x5b67ae,null))[_0xc063('0x40')](handleError(_0x5b67ae,null));}; \ No newline at end of file +var _0x7217=['userProfileId','autoAssociation','destroy','zip-dir','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/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','get','ChanSpies','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','VoiceChanSpy','show','params','includeAll','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find'];(function(_0x3731c8,_0x898adb){var _0x1b9c08=function(_0x11c746){while(--_0x11c746){_0x3731c8['push'](_0x3731c8['shift']());}};_0x1b9c08(++_0x898adb);}(_0x7217,0xa9));var _0x7721=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7217[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7721('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var BPromise=require(_0x7721('0x3'));var Mustache=require(_0x7721('0x4'));var util=require(_0x7721('0x5'));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('lodash');var squel=require(_0x7721('0xb'));var crypto=require(_0x7721('0xc'));var jsforce=require(_0x7721('0xd'));var deskjs=require(_0x7721('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7721('0xf'));var Papa=require(_0x7721('0x10'));var Redis=require('ioredis');var authService=require(_0x7721('0x11'));var qs=require(_0x7721('0x12'));var as=require(_0x7721('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7721('0x14'))(_0x7721('0x15'));var utils=require(_0x7721('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7721('0x17'));var db=require(_0x7721('0x18'))['db'];function respondWithStatusCode(_0x4db091,_0x290415){_0x290415=_0x290415||0xcc;return function(_0xcbb8d5){if(_0xcbb8d5){return _0x4db091['sendStatus'](_0x290415);}return _0x4db091[_0x7721('0x19')](_0x290415)[_0x7721('0x1a')]();};}function respondWithResult(_0xedb98,_0x36f8a0){_0x36f8a0=_0x36f8a0||0xc8;return function(_0x22a78b){if(_0x22a78b){return _0xedb98['status'](_0x36f8a0)[_0x7721('0x1b')](_0x22a78b);}};}function respondWithFilteredResult(_0x353249,_0x2fdfec){return function(_0x281dfd){if(_0x281dfd){var _0x488c09=typeof _0x2fdfec[_0x7721('0x1c')]==='undefined'&&typeof _0x2fdfec[_0x7721('0x1d')]==='undefined';var _0x378dfb=_0x281dfd['count'];var _0x4b64ab=_0x488c09?0x0:_0x2fdfec[_0x7721('0x1c')];var _0x499b28=_0x488c09?_0x281dfd[_0x7721('0x1e')]:_0x2fdfec['offset']+_0x2fdfec[_0x7721('0x1d')];var _0x19f3b4;if(_0x499b28>=_0x378dfb){_0x499b28=_0x378dfb;_0x19f3b4=0xc8;}else{_0x19f3b4=0xce;}_0x353249['status'](_0x19f3b4);return _0x353249[_0x7721('0x1f')](_0x7721('0x20'),_0x4b64ab+'-'+_0x499b28+'/'+_0x378dfb)[_0x7721('0x1b')](_0x281dfd);}return null;};}function patchUpdates(_0x519768){return function(_0x4083dd){try{jsonpatch['apply'](_0x4083dd,_0x519768,!![]);}catch(_0x49b37b){return BPromise[_0x7721('0x21')](_0x49b37b);}return _0x4083dd[_0x7721('0x22')]();};}function saveUpdates(_0x528664,_0x45c389){return function(_0x16c9c4){if(_0x16c9c4){return _0x16c9c4[_0x7721('0x23')](_0x528664)['then'](function(_0x159117){return _0x159117;});}return null;};}function removeEntity(_0x5b7e03,_0x6ab534){return function(_0x1c5511){if(_0x1c5511){return _0x1c5511['destroy']()[_0x7721('0x24')](function(){var _0x485fb3=_0x1c5511[_0x7721('0x25')]({'plain':!![]});var _0x6b932b=_0x7721('0x26');return db[_0x7721('0x27')]['destroy']({'where':{'type':_0x6b932b,'resourceId':_0x485fb3['id']}})[_0x7721('0x24')](function(){return _0x1c5511;});})[_0x7721('0x24')](function(){_0x5b7e03[_0x7721('0x19')](0xcc)[_0x7721('0x1a')]();});}};}function handleEntityNotFound(_0x3ca94e,_0x4e9aaa){return function(_0x34f9e8){if(!_0x34f9e8){_0x3ca94e[_0x7721('0x28')](0x194);}return _0x34f9e8;};}function handleError(_0x197f69,_0x370262){_0x370262=_0x370262||0x1f4;return function(_0xbb3ce4){logger[_0x7721('0x29')](_0xbb3ce4[_0x7721('0x2a')]);if(_0xbb3ce4[_0x7721('0x2b')]){delete _0xbb3ce4[_0x7721('0x2b')];}_0x197f69['status'](_0x370262)[_0x7721('0x2c')](_0xbb3ce4);};}exports[_0x7721('0x2d')]=function(_0xe638a9,_0x3903f4){var _0x52b798={},_0x373a18={},_0x1efe73={'count':0x0,'rows':[]};var _0x20520b=_['map'](db['VoiceChanSpy'][_0x7721('0x2e')],function(_0x3d2b8d){return{'name':_0x3d2b8d[_0x7721('0x2f')],'type':_0x3d2b8d[_0x7721('0x30')][_0x7721('0x31')]};});_0x373a18[_0x7721('0x32')]=_[_0x7721('0x33')](_0x20520b,_0x7721('0x2b'));_0x373a18['query']=_[_0x7721('0x34')](_0xe638a9['query']);_0x373a18[_0x7721('0x35')]=_['intersection'](_0x373a18[_0x7721('0x32')],_0x373a18[_0x7721('0x36')]);_0x52b798[_0x7721('0x37')]=_[_0x7721('0x38')](_0x373a18[_0x7721('0x32')],qs[_0x7721('0x39')](_0xe638a9[_0x7721('0x36')]['fields']));_0x52b798[_0x7721('0x37')]=_0x52b798['attributes'][_0x7721('0x3a')]?_0x52b798[_0x7721('0x37')]:_0x373a18[_0x7721('0x32')];if(!_0xe638a9['query'][_0x7721('0x3b')](_0x7721('0x3c'))){_0x52b798['limit']=qs[_0x7721('0x1d')](_0xe638a9[_0x7721('0x36')][_0x7721('0x1d')]);_0x52b798[_0x7721('0x1c')]=qs['offset'](_0xe638a9[_0x7721('0x36')][_0x7721('0x1c')]);}_0x52b798['order']=qs[_0x7721('0x3d')](_0xe638a9['query'][_0x7721('0x3d')]);_0x52b798['where']=qs['filters'](_[_0x7721('0x3e')](_0xe638a9['query'],_0x373a18[_0x7721('0x35')]),_0x20520b);if(_0xe638a9[_0x7721('0x36')]['filter']){_0x52b798[_0x7721('0x3f')]=_[_0x7721('0x40')](_0x52b798[_0x7721('0x3f')],{'$or':_[_0x7721('0x33')](_0x20520b,function(_0x460abd){if(_0x460abd[_0x7721('0x30')]!==_0x7721('0x41')){var _0xc30c42={};_0xc30c42[_0x460abd[_0x7721('0x2b')]]={'$like':'%'+_0xe638a9[_0x7721('0x36')]['filter']+'%'};return _0xc30c42;}})});}_0x52b798=_[_0x7721('0x40')]({},_0x52b798,_0xe638a9[_0x7721('0x42')]);var _0x4c8d53={'where':_0x52b798[_0x7721('0x3f')]};return db[_0x7721('0x43')][_0x7721('0x1e')](_0x4c8d53)[_0x7721('0x24')](function(_0x5d56a9){_0x1efe73[_0x7721('0x1e')]=_0x5d56a9;if(_0xe638a9[_0x7721('0x36')]['includeAll']){_0x52b798['include']=[{'all':!![]}];}return db[_0x7721('0x43')]['findAll'](_0x52b798);})[_0x7721('0x24')](function(_0x21c9cb){_0x1efe73['rows']=_0x21c9cb;return _0x1efe73;})['then'](respondWithFilteredResult(_0x3903f4,_0x52b798))['catch'](handleError(_0x3903f4,null));};exports[_0x7721('0x44')]=function(_0x2eeca9,_0x2d2123){var _0x12d5b5={'raw':![],'where':{'id':_0x2eeca9[_0x7721('0x45')]['id']}},_0x2802f7={};_0x2802f7[_0x7721('0x32')]=_[_0x7721('0x34')](db[_0x7721('0x43')][_0x7721('0x2e')]);_0x2802f7[_0x7721('0x36')]=_['keys'](_0x2eeca9['query']);_0x2802f7[_0x7721('0x35')]=_[_0x7721('0x38')](_0x2802f7[_0x7721('0x32')],_0x2802f7[_0x7721('0x36')]);_0x12d5b5[_0x7721('0x37')]=_[_0x7721('0x38')](_0x2802f7[_0x7721('0x32')],qs[_0x7721('0x39')](_0x2eeca9[_0x7721('0x36')][_0x7721('0x39')]));_0x12d5b5[_0x7721('0x37')]=_0x12d5b5[_0x7721('0x37')][_0x7721('0x3a')]?_0x12d5b5[_0x7721('0x37')]:_0x2802f7[_0x7721('0x32')];if(_0x2eeca9['query'][_0x7721('0x46')]){_0x12d5b5[_0x7721('0x47')]=[{'all':!![]}];}_0x12d5b5=_['merge']({},_0x12d5b5,_0x2eeca9[_0x7721('0x42')]);return db[_0x7721('0x43')]['find'](_0x12d5b5)[_0x7721('0x24')](handleEntityNotFound(_0x2d2123,null))[_0x7721('0x24')](respondWithResult(_0x2d2123,null))[_0x7721('0x48')](handleError(_0x2d2123,null));};exports[_0x7721('0x49')]=function(_0x26357d,_0x4ac85f){return db['VoiceChanSpy'][_0x7721('0x49')](_0x26357d[_0x7721('0x4a')],{})[_0x7721('0x24')](function(_0x1ed110){var _0xf7b93f=_0x26357d[_0x7721('0x4b')][_0x7721('0x25')]({'plain':!![]});if(!_0xf7b93f)throw new Error(_0x7721('0x4c'));if(_0xf7b93f[_0x7721('0x4d')]===_0x7721('0x4b')){var _0x3ce861=_0x1ed110['get']({'plain':!![]});var _0x333c90='ChanSpies';return db[_0x7721('0x4e')][_0x7721('0x4f')]({'where':{'name':_0x333c90,'userProfileId':_0xf7b93f[_0x7721('0x50')]},'raw':!![]})['then'](function(_0x19a6ac){if(_0x19a6ac&&_0x19a6ac[_0x7721('0x51')]===0x0){return db[_0x7721('0x27')][_0x7721('0x49')]({'name':_0x3ce861[_0x7721('0x2b')],'resourceId':_0x3ce861['id'],'type':_0x19a6ac[_0x7721('0x2b')],'sectionId':_0x19a6ac['id']},{})[_0x7721('0x24')](function(){return _0x1ed110;});}else{return _0x1ed110;}})['catch'](function(_0x50a529){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50a529);throw _0x50a529;});}return _0x1ed110;})[_0x7721('0x24')](respondWithResult(_0x4ac85f,0xc9))[_0x7721('0x48')](handleError(_0x4ac85f,null));};exports[_0x7721('0x23')]=function(_0xebf0b,_0x11ed59){if(_0xebf0b[_0x7721('0x4a')]['id']){delete _0xebf0b[_0x7721('0x4a')]['id'];}return db['VoiceChanSpy'][_0x7721('0x4f')]({'where':{'id':_0xebf0b[_0x7721('0x45')]['id']}})['then'](handleEntityNotFound(_0x11ed59,null))[_0x7721('0x24')](saveUpdates(_0xebf0b[_0x7721('0x4a')],null))[_0x7721('0x24')](respondWithResult(_0x11ed59,null))['catch'](handleError(_0x11ed59,null));};exports[_0x7721('0x52')]=function(_0x20bb7a,_0x5dcbbb){return db[_0x7721('0x43')][_0x7721('0x4f')]({'where':{'id':_0x20bb7a[_0x7721('0x45')]['id']}})[_0x7721('0x24')](handleEntityNotFound(_0x5dcbbb,null))[_0x7721('0x24')](removeEntity(_0x5dcbbb,null))['catch'](handleError(_0x5dcbbb,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 08445b6..6eabd7c 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 _0x0150=['chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','then','exports','models','VoiceChanSpy','VoiceExtension','catch','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','push','merge','Set'];(function(_0x59dfce,_0x4bdf51){var _0x1aca80=function(_0x27cc54){while(--_0x27cc54){_0x59dfce['push'](_0x59dfce['shift']());}};_0x1aca80(++_0x4bdf51);}(_0x0150,0x18d));var _0x0015=function(_0x118abc,_0x26ad94){_0x118abc=_0x118abc-0x0;var _0x2c3549=_0x0150[_0x118abc];return _0x2c3549;};'use strict';var _=require(_0x0015('0x0'));var util=require(_0x0015('0x1'));var BPromise=require('bluebird');var attributes=require(_0x0015('0x2'));var getUserApplications=function(_0x2c76f6,_0x2bb59f,_0x5bbd1d){var _0x41253b=0x1;var _0x418b08=[];var _0x2bf9f9={'context':_0x2bb59f[_0x0015('0x3')]||_0x0015('0x4'),'exten':util[_0x0015('0x5')](_0x0015('0x6'),_0x2c76f6['prefix'],_0x5bbd1d),'type':_0x0015('0x7'),'isApp':![],'ChanSpyId':_0x2c76f6['id'],'UserId':_0x2bb59f['id']};_0x418b08[_0x0015('0x8')](_[_0x0015('0x9')]({'app':_0x0015('0xa'),'appdata':util[_0x0015('0x5')]('CDR(type)=%s',_0x0015('0xb')),'priority':_0x41253b++},_0x2bf9f9));if(_0x2c76f6[_0x0015('0xc')]){_0x418b08['push'](_[_0x0015('0x9')]({'app':_0x0015('0xd'),'appdata':util[_0x0015('0x5')](_0x0015('0xe'),_0x2c76f6[_0x0015('0xf')]),'priority':_0x41253b++},_0x2bf9f9));}if(_0x2c76f6['auth']){_0x418b08[_0x0015('0x8')](_[_0x0015('0x9')]({'app':_0x0015('0x10'),'appdata':_0x2c76f6[_0x0015('0x11')],'priority':_0x41253b++},_0x2bf9f9));}_0x418b08[_0x0015('0x8')](_[_0x0015('0x9')]({'app':'ChanSpy','appdata':util[_0x0015('0x5')]('SIP/%s,%s',_0x2bb59f[_0x0015('0x12')],_0x2c76f6[_0x0015('0x13')]?_0x2c76f6[_0x0015('0x13')][_0x0015('0x14')](''):''),'priority':_0x41253b++},_0x2bf9f9));if(_0x2c76f6[_0x0015('0xc')]){_0x418b08[_0x0015('0x8')](_['merge']({'app':_0x0015('0x15'),'priority':_0x41253b++},_0x2bf9f9));}return _0x418b08;};var getChanSpyApplications=function(_0x42dd8d,_0x1f55ab){var _0x4a3620=[];for(var _0x2c9137=0x0,_0x4bb6f0=0x1;_0x2c9137<_0x1f55ab[_0x0015('0x16')];_0x2c9137++,_0x4bb6f0=0x1){_0x4a3620=_0x4a3620[_0x0015('0x17')](getUserApplications(_0x42dd8d,_0x1f55ab[_0x2c9137],_0x1f55ab[_0x2c9137][_0x0015('0x18')]));if(_0x1f55ab[_0x2c9137][_0x0015('0x18')]!=_0x1f55ab[_0x2c9137][_0x0015('0x12')]){_0x4a3620=_0x4a3620[_0x0015('0x17')](getUserApplications(_0x42dd8d,_0x1f55ab[_0x2c9137],_0x1f55ab[_0x2c9137][_0x0015('0x12')]));}}return _0x4a3620;};var getChanSpyPromise=function(_0x3bea77,_0x173b78){return new BPromise(function(_0x1641ad,_0x54ede7){return _0x3bea77[_0x0015('0x19')][_0x0015('0x1a')]({'attributes':['id',_0x0015('0x12'),'internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x0015('0x1b')](function(_0x3550b7){if(_0x3550b7){return _0x1641ad(getChanSpyApplications(_0x173b78,_0x3550b7));}return _0x1641ad([]);})['catch'](function(_0x210d1d){_0x54ede7(_0x210d1d);});});};module[_0x0015('0x1c')]=function(_0x47bdeb,_0x263b70){var _0x3466ad=_0x47bdeb[_0x0015('0x1d')];return _0x47bdeb['define'](_0x0015('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2458a0,_0x513f39,_0x532ba1){return getChanSpyPromise(_0x3466ad,_0x2458a0)[_0x0015('0x1b')](function(_0x5928c3){if(_0x5928c3&&_0x5928c3[_0x0015('0x16')]){return _0x3466ad[_0x0015('0x1f')]['bulkCreate'](_0x5928c3);}})[_0x0015('0x1b')](function(){_0x532ba1();})[_0x0015('0x20')](function(_0x41e7a6){_0x532ba1(_0x41e7a6);});},'afterUpdate':function(_0x5668e2,_0x10240a,_0x2f1aa4){return _0x3466ad[_0x0015('0x1f')][_0x0015('0x21')]({'where':{'ChanSpyId':_0x5668e2['id']}})['then'](function(){return getChanSpyPromise(_0x3466ad,_0x5668e2);})[_0x0015('0x1b')](function(_0x228117){if(_0x228117&&_0x228117[_0x0015('0x16')]){return _0x3466ad['VoiceExtension']['bulkCreate'](_0x228117);}})[_0x0015('0x1b')](function(){_0x2f1aa4();})[_0x0015('0x20')](function(_0x393cb9){_0x2f1aa4(_0x393cb9);});},'afterDestroy':function(_0x4e38e4,_0xad041a,_0x13a4b7){return _0x3466ad[_0x0015('0x1f')][_0x0015('0x21')]({'where':{'ChanSpyId':_0x4e38e4['id']}})[_0x0015('0x1b')](function(){_0x13a4b7();})['catch'](function(_0xd3f4ad){_0x13a4b7(_0xd3f4ad);});}}});}; \ No newline at end of file +var _0x559a=['options','join','record','StopMixMonitor','length','internal','name','agent','then','catch','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','lodash','bluebird','context','from-sip','format','%s%s','prefix','system','push','merge','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','SIP/%s,%s'];(function(_0xa15305,_0x48d409){var _0x31534c=function(_0x34ad83){while(--_0x34ad83){_0xa15305['push'](_0xa15305['shift']());}};_0x31534c(++_0x48d409);}(_0x559a,0xfe));var _0xa559=function(_0x112592,_0x1e5e27){_0x112592=_0x112592-0x0;var _0x3ed1b2=_0x559a[_0x112592];return _0x3ed1b2;};'use strict';var _=require(_0xa559('0x0'));var util=require('util');var BPromise=require(_0xa559('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3399e9,_0x469eb3,_0x3be9c9){var _0x175bfb=0x1;var _0x3c4f8f=[];var _0x42cf49={'context':_0x469eb3[_0xa559('0x2')]||_0xa559('0x3'),'exten':util[_0xa559('0x4')](_0xa559('0x5'),_0x3399e9[_0xa559('0x6')],_0x3be9c9),'type':_0xa559('0x7'),'isApp':![],'ChanSpyId':_0x3399e9['id'],'UserId':_0x469eb3['id']};_0x3c4f8f[_0xa559('0x8')](_[_0xa559('0x9')]({'app':'Set','appdata':util[_0xa559('0x4')](_0xa559('0xa'),_0xa559('0xb')),'priority':_0x175bfb++},_0x42cf49));if(_0x3399e9['record']){_0x3c4f8f[_0xa559('0x8')](_[_0xa559('0x9')]({'app':_0xa559('0xc'),'appdata':util[_0xa559('0x4')](_0xa559('0xd'),_0x3399e9[_0xa559('0xe')]),'priority':_0x175bfb++},_0x42cf49));}if(_0x3399e9['auth']){_0x3c4f8f['push'](_[_0xa559('0x9')]({'app':'Authenticate','appdata':_0x3399e9[_0xa559('0xf')],'priority':_0x175bfb++},_0x42cf49));}_0x3c4f8f['push'](_[_0xa559('0x9')]({'app':_0xa559('0x10'),'appdata':util['format'](_0xa559('0x11'),_0x469eb3['name'],_0x3399e9[_0xa559('0x12')]?_0x3399e9[_0xa559('0x12')][_0xa559('0x13')](''):''),'priority':_0x175bfb++},_0x42cf49));if(_0x3399e9[_0xa559('0x14')]){_0x3c4f8f[_0xa559('0x8')](_[_0xa559('0x9')]({'app':_0xa559('0x15'),'priority':_0x175bfb++},_0x42cf49));}return _0x3c4f8f;};var getChanSpyApplications=function(_0x38dd66,_0x19e105){var _0x3e6dd7=[];for(var _0x1d4647=0x0,_0x3c8ad1=0x1;_0x1d4647<_0x19e105[_0xa559('0x16')];_0x1d4647++,_0x3c8ad1=0x1){_0x3e6dd7=_0x3e6dd7['concat'](getUserApplications(_0x38dd66,_0x19e105[_0x1d4647],_0x19e105[_0x1d4647][_0xa559('0x17')]));if(_0x19e105[_0x1d4647][_0xa559('0x17')]!=_0x19e105[_0x1d4647][_0xa559('0x18')]){_0x3e6dd7=_0x3e6dd7['concat'](getUserApplications(_0x38dd66,_0x19e105[_0x1d4647],_0x19e105[_0x1d4647]['name']));}}return _0x3e6dd7;};var getChanSpyPromise=function(_0xd9fd2d,_0x3c3fa6){return new BPromise(function(_0x35a924,_0x3eb220){return _0xd9fd2d['User']['findAll']({'attributes':['id',_0xa559('0x18'),_0xa559('0x17')],'where':{'role':_0xa559('0x19'),'chanspy':!![]},'raw':!![]})[_0xa559('0x1a')](function(_0x1f6d74){if(_0x1f6d74){return _0x35a924(getChanSpyApplications(_0x3c3fa6,_0x1f6d74));}return _0x35a924([]);})[_0xa559('0x1b')](function(_0x423638){_0x3eb220(_0x423638);});});};module[_0xa559('0x1c')]=function(_0x21790c,_0x119223){var _0xe7e2c6=_0x21790c[_0xa559('0x1d')];return _0x21790c['define'](_0xa559('0x1e'),attributes,{'tableName':_0xa559('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x307bcf,_0x337be8,_0x52a3d0){return getChanSpyPromise(_0xe7e2c6,_0x307bcf)[_0xa559('0x1a')](function(_0x24c654){if(_0x24c654&&_0x24c654[_0xa559('0x16')]){return _0xe7e2c6[_0xa559('0x20')]['bulkCreate'](_0x24c654);}})['then'](function(){_0x52a3d0();})[_0xa559('0x1b')](function(_0x37b8d1){_0x52a3d0(_0x37b8d1);});},'afterUpdate':function(_0x56a842,_0x450f46,_0x8bd999){return _0xe7e2c6[_0xa559('0x20')]['destroy']({'where':{'ChanSpyId':_0x56a842['id']}})['then'](function(){return getChanSpyPromise(_0xe7e2c6,_0x56a842);})[_0xa559('0x1a')](function(_0x1bc512){if(_0x1bc512&&_0x1bc512[_0xa559('0x16')]){return _0xe7e2c6[_0xa559('0x20')]['bulkCreate'](_0x1bc512);}})['then'](function(){_0x8bd999();})[_0xa559('0x1b')](function(_0x1f12de){_0x8bd999(_0x1f12de);});},'afterDestroy':function(_0x35e1e1,_0x4bf94b,_0x490736){return _0xe7e2c6['VoiceExtension'][_0xa559('0x21')]({'where':{'ChanSpyId':_0x35e1e1['id']}})[_0xa559('0x1a')](function(){_0x490736();})['catch'](function(_0x25819c){_0x490736(_0x25819c);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 9c91b70..afcf816 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 _0x26c2=['message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x59bb17,_0x2a1cc5){var _0x57fda3=function(_0x475844){while(--_0x475844){_0x59bb17['push'](_0x59bb17['shift']());}};_0x57fda3(++_0x2a1cc5);}(_0x26c2,0x130));var _0x226c=function(_0x7c7d40,_0x5eb5ca){_0x7c7d40=_0x7c7d40-0x0;var _0x2d58dd=_0x26c2[_0x7c7d40];return _0x2d58dd;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x226c('0x0'));var rs=require(_0x226c('0x1'));var fs=require('fs');var Redis=require(_0x226c('0x2'));var db=require(_0x226c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x226c('0x4'))(_0x226c('0x5'));var config=require('../../config/environment');var jayson=require(_0x226c('0x6'));var client=jayson[_0x226c('0x7')][_0x226c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c4e5d,_0x4306c9,_0x59804e){return new BPromise(function(_0x34cbc3,_0x461773){return client[_0x226c('0x9')](_0x3c4e5d,_0x59804e)[_0x226c('0xa')](function(_0x127f10){logger['info'](_0x226c('0xb'),_0x4306c9,_0x226c('0xc'));logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4306c9,_0x226c('0xc'),JSON[_0x226c('0xd')](_0x127f10));if(_0x127f10[_0x226c('0xe')]){if(_0x127f10[_0x226c('0xe')][_0x226c('0xf')]===0x1f4){logger[_0x226c('0xe')](_0x226c('0xb'),_0x4306c9,_0x127f10['error']['message']);return _0x461773(_0x127f10[_0x226c('0xe')][_0x226c('0x10')]);}logger[_0x226c('0xe')](_0x226c('0xb'),_0x4306c9,_0x127f10['error']['message']);return _0x34cbc3(_0x127f10[_0x226c('0xe')][_0x226c('0x10')]);}else{logger[_0x226c('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x4306c9,'request\x20sent');_0x34cbc3(_0x127f10[_0x226c('0x12')][_0x226c('0x10')]);}})[_0x226c('0x13')](function(_0x45a804){logger[_0x226c('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x4306c9,_0x45a804);_0x461773(_0x45a804);});});} \ No newline at end of file +var _0xaaa2=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0x3a63ce,_0x3c826c){var _0x8103a6=function(_0xff07b4){while(--_0xff07b4){_0x3a63ce['push'](_0x3a63ce['shift']());}};_0x8103a6(++_0x3c826c);}(_0xaaa2,0xac));var _0x2aaa=function(_0x408aa7,_0x42353a){_0x408aa7=_0x408aa7-0x0;var _0x245d68=_0xaaa2[_0x408aa7];return _0x245d68;};'use strict';var _=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var moment=require(_0x2aaa('0x2'));var BPromise=require(_0x2aaa('0x3'));var rs=require(_0x2aaa('0x4'));var fs=require('fs');var Redis=require(_0x2aaa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2aaa('0x6'));var logger=require('../../config/logger')(_0x2aaa('0x7'));var config=require(_0x2aaa('0x8'));var jayson=require(_0x2aaa('0x9'));var client=jayson[_0x2aaa('0xa')][_0x2aaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x106af9,_0x4f51e6,_0x2f16d7){return new BPromise(function(_0x514c32,_0x505fe8){return client[_0x2aaa('0xc')](_0x106af9,_0x2f16d7)['then'](function(_0x1ad6e9){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'));logger[_0x2aaa('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'),JSON[_0x2aaa('0xf')](_0x1ad6e9));if(_0x1ad6e9[_0x2aaa('0x10')]){if(_0x1ad6e9['error'][_0x2aaa('0x11')]===0x1f4){logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);return _0x505fe8(_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);}logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);return _0x514c32(_0x1ad6e9[_0x2aaa('0x10')]['message']);}else{logger[_0x2aaa('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'));_0x514c32(_0x1ad6e9[_0x2aaa('0x15')]['message']);}})['catch'](function(_0x50a767){logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x50a767);_0x505fe8(_0x50a767);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 50085a3..75bbe5f 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 _0x7c3b=['util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','multer'];(function(_0x355078,_0x54cad7){var _0xb5ef44=function(_0x32f8dd){while(--_0x32f8dd){_0x355078['push'](_0x355078['shift']());}};_0xb5ef44(++_0x54cad7);}(_0x7c3b,0x175));var _0xb7c3=function(_0x5a9985,_0x5716b2){_0x5a9985=_0x5a9985-0x0;var _0x151abf=_0x7c3b[_0x5a9985];return _0x151abf;};'use strict';var multer=require(_0xb7c3('0x0'));var util=require(_0xb7c3('0x1'));var path=require(_0xb7c3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb7c3('0x3'));var interaction=require(_0xb7c3('0x4'));var config=require(_0xb7c3('0x5'));var controller=require(_0xb7c3('0x6'));router[_0xb7c3('0x7')]('/',auth[_0xb7c3('0x8')](),controller[_0xb7c3('0x9')]);router[_0xb7c3('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb7c3('0xa')]);router[_0xb7c3('0xb')]('/',auth[_0xb7c3('0x8')](),controller[_0xb7c3('0xc')]);router[_0xb7c3('0xd')](_0xb7c3('0xe'),auth[_0xb7c3('0x8')](),controller[_0xb7c3('0xf')]);router[_0xb7c3('0x10')](_0xb7c3('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x54e9=['put','update','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','show'];(function(_0x569a1d,_0x4db8f5){var _0x2ed86f=function(_0x29cd9e){while(--_0x29cd9e){_0x569a1d['push'](_0x569a1d['shift']());}};_0x2ed86f(++_0x4db8f5);}(_0x54e9,0x153));var _0x954e=function(_0x39195c,_0x509c6c){_0x39195c=_0x39195c-0x0;var _0xd4ddfb=_0x54e9[_0x39195c];return _0xd4ddfb;};'use strict';var multer=require(_0x954e('0x0'));var util=require(_0x954e('0x1'));var path=require('path');var timeout=require(_0x954e('0x2'));var express=require(_0x954e('0x3'));var router=express[_0x954e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x954e('0x5'));var config=require(_0x954e('0x6'));var controller=require(_0x954e('0x7'));router[_0x954e('0x8')]('/',auth['isAuthenticated'](),controller[_0x954e('0x9')]);router[_0x954e('0x8')](_0x954e('0xa'),auth[_0x954e('0xb')](),controller[_0x954e('0xc')]);router['post']('/',auth[_0x954e('0xb')](),controller['create']);router[_0x954e('0xd')](_0x954e('0xa'),auth[_0x954e('0xb')](),controller[_0x954e('0xe')]);router['delete'](_0x954e('0xa'),auth[_0x954e('0xb')](),controller['destroy']);module[_0x954e('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index f3e7fe7..55a8d44 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 _0x2ad6=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x30f090,_0x2e46d2){var _0x26484c=function(_0xafbc64){while(--_0xafbc64){_0x30f090['push'](_0x30f090['shift']());}};_0x26484c(++_0x2e46d2);}(_0x2ad6,0x189));var _0x62ad=function(_0x310e1c,_0x161a71){_0x310e1c=_0x310e1c-0x0;var _0x212d3e=_0x2ad6[_0x310e1c];return _0x212d3e;};'use strict';var Sequelize=require(_0x62ad('0x0'));module[_0x62ad('0x1')]={'name':{'type':Sequelize[_0x62ad('0x2')],'unique':_0x62ad('0x3')},'description':{'type':Sequelize[_0x62ad('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x62ad('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf06c=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x3eac78,_0x55617c){var _0x2d5dbc=function(_0x1c0c8d){while(--_0x1c0c8d){_0x3eac78['push'](_0x3eac78['shift']());}};_0x2d5dbc(++_0x55617c);}(_0xf06c,0x1a7));var _0xcf06=function(_0x3c6a84,_0x5224ec){_0x3c6a84=_0x3c6a84-0x0;var _0xda6483=_0xf06c[_0x3c6a84];return _0xda6483;};'use strict';var Sequelize=require(_0xcf06('0x0'));module[_0xcf06('0x1')]={'name':{'type':Sequelize[_0xcf06('0x2')],'unique':_0xcf06('0x3')},'description':{'type':Sequelize[_0xcf06('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xcf06('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 bc30cd9..6f51c33 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 _0x7a28=['end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','Contexts','UserProfileResource','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','create','body','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','utf8','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','http','request','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','status'];(function(_0x583dd3,_0x525ebf){var _0xea1285=function(_0x3d7898){while(--_0x3d7898){_0x583dd3['push'](_0x583dd3['shift']());}};_0xea1285(++_0x525ebf);}(_0x7a28,0x184));var _0x87a2=function(_0x295e3a,_0x32026d){_0x295e3a=_0x295e3a-0x0;var _0x421b20=_0x7a28[_0x295e3a];return _0x421b20;};'use strict';var emlformat=require(_0x87a2('0x0'));var rimraf=require(_0x87a2('0x1'));var zipdir=require(_0x87a2('0x2'));var jsonpatch=require(_0x87a2('0x3'));var rp=require(_0x87a2('0x4'));var moment=require('moment');var BPromise=require(_0x87a2('0x5'));var Mustache=require(_0x87a2('0x6'));var util=require(_0x87a2('0x7'));var path=require(_0x87a2('0x8'));var sox=require(_0x87a2('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87a2('0xa'));var _=require('lodash');var squel=require(_0x87a2('0xb'));var crypto=require(_0x87a2('0xc'));var jsforce=require(_0x87a2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x87a2('0xe'));var querystring=require(_0x87a2('0xf'));var Papa=require(_0x87a2('0x10'));var Redis=require(_0x87a2('0x11'));var authService=require(_0x87a2('0x12'));var qs=require(_0x87a2('0x13'));var as=require(_0x87a2('0x14'));var hardwareService=require(_0x87a2('0x15'));var logger=require(_0x87a2('0x16'))(_0x87a2('0x17'));var utils=require('../../config/utils');var config=require(_0x87a2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x87a2('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x87a2('0x1a')][_0x87a2('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3f2f5e,_0x17dfec,_0x2b25c1,_0x35885e){return new BPromise(function(_0x500938,_0x54760f){var _0xf534ad=_0x35885e||client;return _0xf534ad[_0x87a2('0x1c')](_0x3f2f5e,_0x2b25c1)['then'](function(_0x4fb661){logger[_0x87a2('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x17dfec,'request\x20sent');logger[_0x87a2('0x1e')](_0x87a2('0x1f'),_0x17dfec,_0x87a2('0x20'),JSON['stringify'](_0x4fb661));if(_0x4fb661[_0x87a2('0x21')]){if(_0x4fb661[_0x87a2('0x21')][_0x87a2('0x22')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x17dfec,_0x4fb661['error']['message']);return _0x54760f(_0x4fb661[_0x87a2('0x21')]['message']);}logger[_0x87a2('0x21')](_0x87a2('0x23'),_0x17dfec,_0x4fb661[_0x87a2('0x21')][_0x87a2('0x24')]);return _0x500938(_0x4fb661['error'][_0x87a2('0x24')]);}else{logger['info'](_0x87a2('0x23'),_0x17dfec,_0x87a2('0x20'));_0x500938(_0x4fb661['result'][_0x87a2('0x24')]);}})[_0x87a2('0x25')](function(_0x33e513){logger[_0x87a2('0x21')](_0x87a2('0x23'),_0x17dfec,_0x33e513);_0x54760f(_0x33e513);});});}function respondWithStatusCode(_0x53918b,_0x230a82){_0x230a82=_0x230a82||0xcc;return function(_0x24f81a){if(_0x24f81a){return _0x53918b[_0x87a2('0x26')](_0x230a82);}return _0x53918b[_0x87a2('0x27')](_0x230a82)[_0x87a2('0x28')]();};}function respondWithResult(_0x31cb,_0x42d1d7){_0x42d1d7=_0x42d1d7||0xc8;return function(_0x279575){if(_0x279575){return _0x31cb['status'](_0x42d1d7)[_0x87a2('0x29')](_0x279575);}};}function respondWithFilteredResult(_0x5a338c,_0x5ce5bf){return function(_0x259dee){if(_0x259dee){var _0x2b91c7=typeof _0x5ce5bf['offset']===_0x87a2('0x2a')&&typeof _0x5ce5bf[_0x87a2('0x2b')]==='undefined';var _0x274cb2=_0x259dee[_0x87a2('0x2c')];var _0x185adf=_0x2b91c7?0x0:_0x5ce5bf[_0x87a2('0x2d')];var _0xdc055c=_0x2b91c7?_0x259dee[_0x87a2('0x2c')]:_0x5ce5bf[_0x87a2('0x2d')]+_0x5ce5bf['limit'];var _0x43f143;if(_0xdc055c>=_0x274cb2){_0xdc055c=_0x274cb2;_0x43f143=0xc8;}else{_0x43f143=0xce;}_0x5a338c[_0x87a2('0x27')](_0x43f143);return _0x5a338c[_0x87a2('0x2e')](_0x87a2('0x2f'),_0x185adf+'-'+_0xdc055c+'/'+_0x274cb2)[_0x87a2('0x29')](_0x259dee);}return null;};}function patchUpdates(_0xef18c2){return function(_0x161f5d){try{jsonpatch[_0x87a2('0x30')](_0x161f5d,_0xef18c2,!![]);}catch(_0xaeec42){return BPromise[_0x87a2('0x31')](_0xaeec42);}return _0x161f5d[_0x87a2('0x32')]();};}function saveUpdates(_0x39e0f7,_0x282124){return function(_0x22217e){if(_0x22217e){return _0x22217e['update'](_0x39e0f7)[_0x87a2('0x33')](function(_0x55e04e){return _0x55e04e;});}return null;};}function removeEntity(_0x195fce,_0x3c3d62){return function(_0x2aaa39){if(_0x2aaa39){return _0x2aaa39[_0x87a2('0x34')]()[_0x87a2('0x33')](function(){var _0xaae182=_0x2aaa39['get']({'plain':!![]});var _0xc10203=_0x87a2('0x35');return db[_0x87a2('0x36')][_0x87a2('0x34')]({'where':{'type':_0xc10203,'resourceId':_0xaae182['id']}})[_0x87a2('0x33')](function(){return _0x2aaa39;});})[_0x87a2('0x33')](function(){_0x195fce[_0x87a2('0x27')](0xcc)[_0x87a2('0x28')]();});}};}function handleEntityNotFound(_0x2d3915,_0x38ee43){return function(_0x3c5e0e){if(!_0x3c5e0e){_0x2d3915[_0x87a2('0x26')](0x194);}return _0x3c5e0e;};}function handleError(_0x492d2d,_0x153c8a){_0x153c8a=_0x153c8a||0x1f4;return function(_0x30745a){logger[_0x87a2('0x21')](_0x30745a[_0x87a2('0x37')]);if(_0x30745a[_0x87a2('0x38')]){delete _0x30745a[_0x87a2('0x38')];}_0x492d2d['status'](_0x153c8a)[_0x87a2('0x39')](_0x30745a);};}exports['index']=function(_0x56a1aa,_0x4bb400){var _0x4564e0={},_0x3a1fe7={},_0x592bcf={'count':0x0,'rows':[]};var _0x4e36d6=_[_0x87a2('0x3a')](db[_0x87a2('0x3b')][_0x87a2('0x3c')],function(_0x133c31){return{'name':_0x133c31[_0x87a2('0x3d')],'type':_0x133c31[_0x87a2('0x3e')][_0x87a2('0x3f')]};});_0x3a1fe7[_0x87a2('0x40')]=_['map'](_0x4e36d6,_0x87a2('0x38'));_0x3a1fe7[_0x87a2('0x41')]=_[_0x87a2('0x42')](_0x56a1aa[_0x87a2('0x41')]);_0x3a1fe7[_0x87a2('0x43')]=_['intersection'](_0x3a1fe7[_0x87a2('0x40')],_0x3a1fe7[_0x87a2('0x41')]);_0x4564e0[_0x87a2('0x44')]=_[_0x87a2('0x45')](_0x3a1fe7['model'],qs[_0x87a2('0x46')](_0x56a1aa[_0x87a2('0x41')][_0x87a2('0x46')]));_0x4564e0[_0x87a2('0x44')]=_0x4564e0[_0x87a2('0x44')]['length']?_0x4564e0[_0x87a2('0x44')]:_0x3a1fe7[_0x87a2('0x40')];if(!_0x56a1aa[_0x87a2('0x41')]['hasOwnProperty'](_0x87a2('0x47'))){_0x4564e0[_0x87a2('0x2b')]=qs[_0x87a2('0x2b')](_0x56a1aa[_0x87a2('0x41')]['limit']);_0x4564e0[_0x87a2('0x2d')]=qs[_0x87a2('0x2d')](_0x56a1aa['query'][_0x87a2('0x2d')]);}_0x4564e0[_0x87a2('0x48')]=qs['sort'](_0x56a1aa[_0x87a2('0x41')][_0x87a2('0x49')]);_0x4564e0[_0x87a2('0x4a')]=qs[_0x87a2('0x43')](_[_0x87a2('0x4b')](_0x56a1aa[_0x87a2('0x41')],_0x3a1fe7[_0x87a2('0x43')]),_0x4e36d6);if(_0x56a1aa['query']['filter']){_0x4564e0['where']=_[_0x87a2('0x4c')](_0x4564e0[_0x87a2('0x4a')],{'$or':_[_0x87a2('0x3a')](_0x4e36d6,function(_0xbd5251){if(_0xbd5251['type']!==_0x87a2('0x4d')){var _0x12b63a={};_0x12b63a[_0xbd5251[_0x87a2('0x38')]]={'$like':'%'+_0x56a1aa[_0x87a2('0x41')][_0x87a2('0x4e')]+'%'};return _0x12b63a;}})});}_0x4564e0=_[_0x87a2('0x4c')]({},_0x4564e0,_0x56a1aa[_0x87a2('0x4f')]);var _0x21f9bd={'where':_0x4564e0[_0x87a2('0x4a')]};return db['VoiceContext']['count'](_0x21f9bd)[_0x87a2('0x33')](function(_0x2c107a){_0x592bcf[_0x87a2('0x2c')]=_0x2c107a;if(_0x56a1aa['query'][_0x87a2('0x50')]){_0x4564e0[_0x87a2('0x51')]=[{'all':!![]}];}return db[_0x87a2('0x3b')][_0x87a2('0x52')](_0x4564e0);})[_0x87a2('0x33')](function(_0x252960){_0x592bcf[_0x87a2('0x53')]=_0x252960;return _0x592bcf;})[_0x87a2('0x33')](respondWithFilteredResult(_0x4bb400,_0x4564e0))[_0x87a2('0x25')](handleError(_0x4bb400,null));};exports[_0x87a2('0x54')]=function(_0x3d9e61,_0x30c0ce){var _0x4c3414={'raw':![],'where':{'id':_0x3d9e61[_0x87a2('0x55')]['id']}},_0x4b5e41={};_0x4b5e41['model']=_[_0x87a2('0x42')](db[_0x87a2('0x3b')]['rawAttributes']);_0x4b5e41[_0x87a2('0x41')]=_[_0x87a2('0x42')](_0x3d9e61[_0x87a2('0x41')]);_0x4b5e41[_0x87a2('0x43')]=_['intersection'](_0x4b5e41[_0x87a2('0x40')],_0x4b5e41[_0x87a2('0x41')]);_0x4c3414['attributes']=_[_0x87a2('0x45')](_0x4b5e41[_0x87a2('0x40')],qs[_0x87a2('0x46')](_0x3d9e61[_0x87a2('0x41')][_0x87a2('0x46')]));_0x4c3414['attributes']=_0x4c3414[_0x87a2('0x44')]['length']?_0x4c3414['attributes']:_0x4b5e41[_0x87a2('0x40')];if(_0x3d9e61[_0x87a2('0x41')][_0x87a2('0x50')]){_0x4c3414['include']=[{'all':!![]}];}_0x4c3414=_[_0x87a2('0x4c')]({},_0x4c3414,_0x3d9e61[_0x87a2('0x4f')]);return db[_0x87a2('0x3b')]['find'](_0x4c3414)[_0x87a2('0x33')](handleEntityNotFound(_0x30c0ce,null))[_0x87a2('0x33')](respondWithResult(_0x30c0ce,null))[_0x87a2('0x25')](handleError(_0x30c0ce,null));};exports[_0x87a2('0x56')]=function(_0x20ce30,_0x1a3669,_0x2f507d){var _0x3b3638;return db['VoiceContext']['create'](_0x20ce30[_0x87a2('0x57')],{'raw':!![]})[_0x87a2('0x33')](function(_0x22b166){_0x3b3638=_0x22b166;return db[_0x87a2('0x3b')]['findAll']({'raw':!![]});})[_0x87a2('0x33')](function(_0x3f6c0f){var _0xf911fa=fs[_0x87a2('0x58')](path[_0x87a2('0x59')](config[_0x87a2('0x5a')],_0x87a2('0x5b')),'utf8');var _0x5d9122=ejs[_0x87a2('0x5c')](_0xf911fa,{'contexts':_0x3f6c0f||[]});fs[_0x87a2('0x5d')](_0x87a2('0x5e'),_0x5d9122);})['then'](function(){return respondWithRpcPromise('Reload',_0x87a2('0x56'),{'module':_0x87a2('0x5f')});})[_0x87a2('0x33')](function(){var _0x10b719=_0x20ce30[_0x87a2('0x60')][_0x87a2('0x61')]({'plain':!![]});if(!_0x10b719)throw new Error(_0x87a2('0x62'));if(_0x10b719[_0x87a2('0x63')]===_0x87a2('0x60')){var _0x29c053=_0x3b3638['get']({'plain':!![]});return db[_0x87a2('0x64')][_0x87a2('0x65')]({'where':{'name':'Contexts','userProfileId':_0x10b719[_0x87a2('0x66')]},'raw':!![]})[_0x87a2('0x33')](function(_0x2a0ebe){if(_0x2a0ebe&&_0x2a0ebe[_0x87a2('0x67')]===0x0){return db['UserProfileResource']['create']({'name':_0x29c053[_0x87a2('0x38')],'resourceId':_0x29c053['id'],'type':_0x2a0ebe['name'],'sectionId':_0x2a0ebe['id']},{})[_0x87a2('0x33')](function(){return _0x3b3638;});}else{return _0x3b3638;}})[_0x87a2('0x25')](function(_0x1a2604){logger['error'](_0x87a2('0x68'),_0x1a2604);throw _0x1a2604;});}return _0x3b3638;})[_0x87a2('0x33')](respondWithResult(_0x1a3669,0xc9))['catch'](handleError(_0x1a3669,null));};exports['update']=function(_0x2c6996,_0x59c58d,_0x3cb2ca){var _0x3a858e;return db[_0x87a2('0x3b')][_0x87a2('0x65')]({'where':{'id':_0x2c6996[_0x87a2('0x55')]['id']}})['then'](handleEntityNotFound(_0x59c58d,null))['then'](saveUpdates(_0x2c6996['body'],null))[_0x87a2('0x33')](function(_0x4222d6){if(_0x4222d6){_0x3a858e=_0x4222d6;return db[_0x87a2('0x3b')][_0x87a2('0x52')]({'raw':!![]});}})[_0x87a2('0x33')](function(_0x12c011){var _0x12eeec=fs[_0x87a2('0x58')](path[_0x87a2('0x59')](config['root'],_0x87a2('0x5b')),_0x87a2('0x69'));var _0x21441d=ejs[_0x87a2('0x5c')](_0x12eeec,{'contexts':_0x12c011||[]});fs[_0x87a2('0x5d')](_0x87a2('0x5e'),_0x21441d);})[_0x87a2('0x33')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x87a2('0x5f')});})['then'](function(){return _0x3a858e;})[_0x87a2('0x33')](respondWithResult(_0x59c58d,null))[_0x87a2('0x25')](handleError(_0x59c58d,null));};exports['destroy']=function(_0x55cd,_0x16ae6f,_0x3be83d){var _0x3483f5;return db[_0x87a2('0x3b')][_0x87a2('0x65')]({'where':{'id':_0x55cd[_0x87a2('0x55')]['id']}})[_0x87a2('0x33')](handleEntityNotFound(_0x16ae6f,null))[_0x87a2('0x33')](removeEntity(_0x16ae6f,null))['then'](function(){return db['VoiceContext'][_0x87a2('0x52')]({'raw':!![]});})['then'](function(_0x3439c4){var _0x550b59=fs[_0x87a2('0x58')](path[_0x87a2('0x59')](config[_0x87a2('0x5a')],'server/files/templates/context.ejs'),'utf8');var _0x52faa4=ejs[_0x87a2('0x5c')](_0x550b59,{'contexts':_0x3439c4});fs[_0x87a2('0x5d')](_0x87a2('0x5e'),_0x52faa4);return respondWithRpcPromise(_0x87a2('0x6a'),'destroy',{'module':_0x87a2('0x5f')});})[_0x87a2('0x25')](handleError(_0x16ae6f,null));}; \ No newline at end of file +var _0x8d6e=['nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','length','find','create','join','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','root','utf8','readFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','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','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','get','Contexts','UserProfileResource','stack','name','index','map','VoiceContext','type','key','model','query','keys','filters','intersection','attributes'];(function(_0xa0be12,_0x33d075){var _0x21857f=function(_0x1898b7){while(--_0x1898b7){_0xa0be12['push'](_0xa0be12['shift']());}};_0x21857f(++_0x33d075);}(_0x8d6e,0x8c));var _0xe8d6=function(_0x22eab4,_0x432b17){_0x22eab4=_0x22eab4-0x0;var _0xcb2904=_0x8d6e[_0x22eab4];return _0xcb2904;};'use strict';var emlformat=require(_0xe8d6('0x0'));var rimraf=require(_0xe8d6('0x1'));var zipdir=require(_0xe8d6('0x2'));var jsonpatch=require(_0xe8d6('0x3'));var rp=require(_0xe8d6('0x4'));var moment=require(_0xe8d6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe8d6('0x6'));var path=require('path');var sox=require(_0xe8d6('0x7'));var csv=require(_0xe8d6('0x8'));var ejs=require(_0xe8d6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe8d6('0xa'));var squel=require('squel');var crypto=require(_0xe8d6('0xb'));var jsforce=require(_0xe8d6('0xc'));var deskjs=require(_0xe8d6('0xd'));var toCsv=require(_0xe8d6('0x8'));var querystring=require(_0xe8d6('0xe'));var Papa=require('papaparse');var Redis=require(_0xe8d6('0xf'));var authService=require(_0xe8d6('0x10'));var qs=require(_0xe8d6('0x11'));var as=require(_0xe8d6('0x12'));var hardwareService=require(_0xe8d6('0x13'));var logger=require(_0xe8d6('0x14'))(_0xe8d6('0x15'));var utils=require(_0xe8d6('0x16'));var config=require(_0xe8d6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe8d6('0x18'))['db'];var jayson=require(_0xe8d6('0x19'));var client=jayson[_0xe8d6('0x1a')][_0xe8d6('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x55ab96,_0x2452b5,_0x18ace5,_0x210637){return new BPromise(function(_0x4f30c6,_0x45dccd){var _0x5b613c=_0x210637||client;return _0x5b613c[_0xe8d6('0x1c')](_0x55ab96,_0x18ace5)[_0xe8d6('0x1d')](function(_0x177848){logger['info'](_0xe8d6('0x1e'),_0x2452b5,_0xe8d6('0x1f'));logger['debug'](_0xe8d6('0x20'),_0x2452b5,_0xe8d6('0x1f'),JSON['stringify'](_0x177848));if(_0x177848[_0xe8d6('0x21')]){if(_0x177848[_0xe8d6('0x21')][_0xe8d6('0x22')]===0x1f4){logger[_0xe8d6('0x21')]('VoiceContext,\x20%s,\x20%s',_0x2452b5,_0x177848[_0xe8d6('0x21')][_0xe8d6('0x23')]);return _0x45dccd(_0x177848[_0xe8d6('0x21')]['message']);}logger[_0xe8d6('0x21')](_0xe8d6('0x1e'),_0x2452b5,_0x177848['error'][_0xe8d6('0x23')]);return _0x4f30c6(_0x177848['error'][_0xe8d6('0x23')]);}else{logger[_0xe8d6('0x24')]('VoiceContext,\x20%s,\x20%s',_0x2452b5,_0xe8d6('0x1f'));_0x4f30c6(_0x177848[_0xe8d6('0x25')][_0xe8d6('0x23')]);}})[_0xe8d6('0x26')](function(_0x296d93){logger['error'](_0xe8d6('0x1e'),_0x2452b5,_0x296d93);_0x45dccd(_0x296d93);});});}function respondWithStatusCode(_0x4e5945,_0x2e2aeb){_0x2e2aeb=_0x2e2aeb||0xcc;return function(_0x567c6d){if(_0x567c6d){return _0x4e5945[_0xe8d6('0x27')](_0x2e2aeb);}return _0x4e5945[_0xe8d6('0x28')](_0x2e2aeb)[_0xe8d6('0x29')]();};}function respondWithResult(_0x1d13cf,_0x5e1471){_0x5e1471=_0x5e1471||0xc8;return function(_0x512fcd){if(_0x512fcd){return _0x1d13cf['status'](_0x5e1471)[_0xe8d6('0x2a')](_0x512fcd);}};}function respondWithFilteredResult(_0x10ff06,_0x2e033d){return function(_0x309693){if(_0x309693){var _0x4c1e54=typeof _0x2e033d[_0xe8d6('0x2b')]===_0xe8d6('0x2c')&&typeof _0x2e033d['limit']===_0xe8d6('0x2c');var _0x2c08aa=_0x309693[_0xe8d6('0x2d')];var _0x370c92=_0x4c1e54?0x0:_0x2e033d['offset'];var _0x1ebb82=_0x4c1e54?_0x309693[_0xe8d6('0x2d')]:_0x2e033d['offset']+_0x2e033d[_0xe8d6('0x2e')];var _0x4f1ed2;if(_0x1ebb82>=_0x2c08aa){_0x1ebb82=_0x2c08aa;_0x4f1ed2=0xc8;}else{_0x4f1ed2=0xce;}_0x10ff06[_0xe8d6('0x28')](_0x4f1ed2);return _0x10ff06[_0xe8d6('0x2f')](_0xe8d6('0x30'),_0x370c92+'-'+_0x1ebb82+'/'+_0x2c08aa)[_0xe8d6('0x2a')](_0x309693);}return null;};}function patchUpdates(_0x29339a){return function(_0x20f11d){try{jsonpatch['apply'](_0x20f11d,_0x29339a,!![]);}catch(_0xbb527){return BPromise[_0xe8d6('0x31')](_0xbb527);}return _0x20f11d[_0xe8d6('0x32')]();};}function saveUpdates(_0x35eef8,_0x281fd9){return function(_0x231dc1){if(_0x231dc1){return _0x231dc1['update'](_0x35eef8)[_0xe8d6('0x1d')](function(_0x3990a5){return _0x3990a5;});}return null;};}function removeEntity(_0x43ecf2,_0x3bb46b){return function(_0x1e147d){if(_0x1e147d){return _0x1e147d[_0xe8d6('0x33')]()[_0xe8d6('0x1d')](function(){var _0x56439e=_0x1e147d[_0xe8d6('0x34')]({'plain':!![]});var _0x16a492=_0xe8d6('0x35');return db[_0xe8d6('0x36')][_0xe8d6('0x33')]({'where':{'type':_0x16a492,'resourceId':_0x56439e['id']}})[_0xe8d6('0x1d')](function(){return _0x1e147d;});})[_0xe8d6('0x1d')](function(){_0x43ecf2[_0xe8d6('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a63b6,_0x498513){return function(_0x4181fd){if(!_0x4181fd){_0x1a63b6[_0xe8d6('0x27')](0x194);}return _0x4181fd;};}function handleError(_0x15519a,_0x5e2223){_0x5e2223=_0x5e2223||0x1f4;return function(_0xcf8342){logger[_0xe8d6('0x21')](_0xcf8342[_0xe8d6('0x37')]);if(_0xcf8342['name']){delete _0xcf8342[_0xe8d6('0x38')];}_0x15519a[_0xe8d6('0x28')](_0x5e2223)['send'](_0xcf8342);};}exports[_0xe8d6('0x39')]=function(_0x334b56,_0x2b8e24){var _0x9cd10c={},_0x133770={},_0xae3ca2={'count':0x0,'rows':[]};var _0x3fb6c4=_[_0xe8d6('0x3a')](db[_0xe8d6('0x3b')]['rawAttributes'],function(_0x4ac46f){return{'name':_0x4ac46f['fieldName'],'type':_0x4ac46f[_0xe8d6('0x3c')][_0xe8d6('0x3d')]};});_0x133770[_0xe8d6('0x3e')]=_[_0xe8d6('0x3a')](_0x3fb6c4,'name');_0x133770[_0xe8d6('0x3f')]=_[_0xe8d6('0x40')](_0x334b56[_0xe8d6('0x3f')]);_0x133770[_0xe8d6('0x41')]=_[_0xe8d6('0x42')](_0x133770[_0xe8d6('0x3e')],_0x133770['query']);_0x9cd10c[_0xe8d6('0x43')]=_[_0xe8d6('0x42')](_0x133770[_0xe8d6('0x3e')],qs['fields'](_0x334b56['query']['fields']));_0x9cd10c[_0xe8d6('0x43')]=_0x9cd10c['attributes']['length']?_0x9cd10c[_0xe8d6('0x43')]:_0x133770[_0xe8d6('0x3e')];if(!_0x334b56[_0xe8d6('0x3f')]['hasOwnProperty'](_0xe8d6('0x44'))){_0x9cd10c[_0xe8d6('0x2e')]=qs[_0xe8d6('0x2e')](_0x334b56['query'][_0xe8d6('0x2e')]);_0x9cd10c['offset']=qs[_0xe8d6('0x2b')](_0x334b56[_0xe8d6('0x3f')][_0xe8d6('0x2b')]);}_0x9cd10c[_0xe8d6('0x45')]=qs['sort'](_0x334b56[_0xe8d6('0x3f')][_0xe8d6('0x46')]);_0x9cd10c[_0xe8d6('0x47')]=qs[_0xe8d6('0x41')](_['pick'](_0x334b56[_0xe8d6('0x3f')],_0x133770[_0xe8d6('0x41')]),_0x3fb6c4);if(_0x334b56[_0xe8d6('0x3f')][_0xe8d6('0x48')]){_0x9cd10c['where']=_['merge'](_0x9cd10c[_0xe8d6('0x47')],{'$or':_[_0xe8d6('0x3a')](_0x3fb6c4,function(_0x114093){if(_0x114093[_0xe8d6('0x3c')]!==_0xe8d6('0x49')){var _0x32e49f={};_0x32e49f[_0x114093[_0xe8d6('0x38')]]={'$like':'%'+_0x334b56['query'][_0xe8d6('0x48')]+'%'};return _0x32e49f;}})});}_0x9cd10c=_['merge']({},_0x9cd10c,_0x334b56[_0xe8d6('0x4a')]);var _0x350b28={'where':_0x9cd10c['where']};return db[_0xe8d6('0x3b')][_0xe8d6('0x2d')](_0x350b28)[_0xe8d6('0x1d')](function(_0x3ac411){_0xae3ca2['count']=_0x3ac411;if(_0x334b56[_0xe8d6('0x3f')][_0xe8d6('0x4b')]){_0x9cd10c[_0xe8d6('0x4c')]=[{'all':!![]}];}return db['VoiceContext'][_0xe8d6('0x4d')](_0x9cd10c);})['then'](function(_0x10241e){_0xae3ca2[_0xe8d6('0x4e')]=_0x10241e;return _0xae3ca2;})[_0xe8d6('0x1d')](respondWithFilteredResult(_0x2b8e24,_0x9cd10c))[_0xe8d6('0x26')](handleError(_0x2b8e24,null));};exports[_0xe8d6('0x4f')]=function(_0x172665,_0x2f0ed5){var _0x1e5456={'raw':![],'where':{'id':_0x172665[_0xe8d6('0x50')]['id']}},_0x2945a9={};_0x2945a9[_0xe8d6('0x3e')]=_[_0xe8d6('0x40')](db[_0xe8d6('0x3b')][_0xe8d6('0x51')]);_0x2945a9[_0xe8d6('0x3f')]=_[_0xe8d6('0x40')](_0x172665[_0xe8d6('0x3f')]);_0x2945a9[_0xe8d6('0x41')]=_['intersection'](_0x2945a9[_0xe8d6('0x3e')],_0x2945a9[_0xe8d6('0x3f')]);_0x1e5456[_0xe8d6('0x43')]=_[_0xe8d6('0x42')](_0x2945a9[_0xe8d6('0x3e')],qs[_0xe8d6('0x52')](_0x172665['query'][_0xe8d6('0x52')]));_0x1e5456[_0xe8d6('0x43')]=_0x1e5456[_0xe8d6('0x43')][_0xe8d6('0x53')]?_0x1e5456[_0xe8d6('0x43')]:_0x2945a9[_0xe8d6('0x3e')];if(_0x172665[_0xe8d6('0x3f')]['includeAll']){_0x1e5456['include']=[{'all':!![]}];}_0x1e5456=_['merge']({},_0x1e5456,_0x172665[_0xe8d6('0x4a')]);return db['VoiceContext'][_0xe8d6('0x54')](_0x1e5456)['then'](handleEntityNotFound(_0x2f0ed5,null))[_0xe8d6('0x1d')](respondWithResult(_0x2f0ed5,null))[_0xe8d6('0x26')](handleError(_0x2f0ed5,null));};exports[_0xe8d6('0x55')]=function(_0x5b895f,_0x3776df,_0x118e22){var _0x32877a;return db[_0xe8d6('0x3b')][_0xe8d6('0x55')](_0x5b895f['body'],{'raw':!![]})[_0xe8d6('0x1d')](function(_0x3becc7){_0x32877a=_0x3becc7;return db[_0xe8d6('0x3b')]['findAll']({'raw':!![]});})[_0xe8d6('0x1d')](function(_0x2217d8){var _0x151546=fs['readFileSync'](path[_0xe8d6('0x56')](config['root'],_0xe8d6('0x57')),'utf8');var _0x3f996e=ejs[_0xe8d6('0x58')](_0x151546,{'contexts':_0x2217d8||[]});fs[_0xe8d6('0x59')](_0xe8d6('0x5a'),_0x3f996e);})[_0xe8d6('0x1d')](function(){return respondWithRpcPromise(_0xe8d6('0x5b'),'create',{'module':_0xe8d6('0x5c')});})['then'](function(){var _0xef5898=_0x5b895f['user'][_0xe8d6('0x34')]({'plain':!![]});if(!_0xef5898)throw new Error(_0xe8d6('0x5d'));if(_0xef5898[_0xe8d6('0x5e')]==='user'){var _0x1b0855=_0x32877a['get']({'plain':!![]});return db[_0xe8d6('0x5f')][_0xe8d6('0x54')]({'where':{'name':_0xe8d6('0x35'),'userProfileId':_0xef5898[_0xe8d6('0x60')]},'raw':!![]})[_0xe8d6('0x1d')](function(_0x327458){if(_0x327458&&_0x327458[_0xe8d6('0x61')]===0x0){return db['UserProfileResource'][_0xe8d6('0x55')]({'name':_0x1b0855[_0xe8d6('0x38')],'resourceId':_0x1b0855['id'],'type':_0x327458[_0xe8d6('0x38')],'sectionId':_0x327458['id']},{})[_0xe8d6('0x1d')](function(){return _0x32877a;});}else{return _0x32877a;}})[_0xe8d6('0x26')](function(_0x22e587){logger[_0xe8d6('0x21')](_0xe8d6('0x62'),_0x22e587);throw _0x22e587;});}return _0x32877a;})[_0xe8d6('0x1d')](respondWithResult(_0x3776df,0xc9))[_0xe8d6('0x26')](handleError(_0x3776df,null));};exports[_0xe8d6('0x63')]=function(_0x31066b,_0x13dbf5,_0x47de71){var _0x1bc999;return db['VoiceContext'][_0xe8d6('0x54')]({'where':{'id':_0x31066b['params']['id']}})[_0xe8d6('0x1d')](handleEntityNotFound(_0x13dbf5,null))[_0xe8d6('0x1d')](saveUpdates(_0x31066b[_0xe8d6('0x64')],null))[_0xe8d6('0x1d')](function(_0x40a145){if(_0x40a145){_0x1bc999=_0x40a145;return db[_0xe8d6('0x3b')][_0xe8d6('0x4d')]({'raw':!![]});}})['then'](function(_0x728b40){var _0x507c37=fs['readFileSync'](path[_0xe8d6('0x56')](config[_0xe8d6('0x65')],_0xe8d6('0x57')),_0xe8d6('0x66'));var _0xdb5b4=ejs['render'](_0x507c37,{'contexts':_0x728b40||[]});fs[_0xe8d6('0x59')](_0xe8d6('0x5a'),_0xdb5b4);})[_0xe8d6('0x1d')](function(){return respondWithRpcPromise(_0xe8d6('0x5b'),'update',{'module':'chan_sip.so'});})['then'](function(){return _0x1bc999;})['then'](respondWithResult(_0x13dbf5,null))['catch'](handleError(_0x13dbf5,null));};exports[_0xe8d6('0x33')]=function(_0x461746,_0x53f414,_0x534933){var _0x398840;return db[_0xe8d6('0x3b')][_0xe8d6('0x54')]({'where':{'id':_0x461746['params']['id']}})[_0xe8d6('0x1d')](handleEntityNotFound(_0x53f414,null))[_0xe8d6('0x1d')](removeEntity(_0x53f414,null))['then'](function(){return db[_0xe8d6('0x3b')]['findAll']({'raw':!![]});})[_0xe8d6('0x1d')](function(_0x2329af){var _0x46823c=fs[_0xe8d6('0x67')](path[_0xe8d6('0x56')](config[_0xe8d6('0x65')],_0xe8d6('0x57')),_0xe8d6('0x66'));var _0x5daefc=ejs['render'](_0x46823c,{'contexts':_0x2329af});fs[_0xe8d6('0x59')](_0xe8d6('0x5a'),_0x5daefc);return respondWithRpcPromise(_0xe8d6('0x5b'),_0xe8d6('0x33'),{'module':_0xe8d6('0x5c')});})[_0xe8d6('0x26')](handleError(_0x53f414,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 879aa3d..49c83d7 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 _0xf00a=['../../config/environment','./voiceContext.attributes','define','voice_contexts','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x2f9529,_0x33b880){var _0x2d07c8=function(_0x579c84){while(--_0x579c84){_0x2f9529['push'](_0x2f9529['shift']());}};_0x2d07c8(++_0x33b880);}(_0xf00a,0x164));var _0xaf00=function(_0x44b249,_0x5b4811){_0x44b249=_0x44b249-0x0;var _0x23b853=_0xf00a[_0x44b249];return _0x23b853;};'use strict';var _=require(_0xaf00('0x0'));var util=require(_0xaf00('0x1'));var logger=require('../../config/logger')(_0xaf00('0x2'));var moment=require(_0xaf00('0x3'));var BPromise=require(_0xaf00('0x4'));var rp=require(_0xaf00('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf00('0x6'));var config=require(_0xaf00('0x7'));var attributes=require(_0xaf00('0x8'));module['exports']=function(_0x2b21c3,_0x5535fe){return _0x2b21c3[_0xaf00('0x9')]('VoiceContext',attributes,{'tableName':_0xaf00('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x376c=['exports','define','VoiceContext','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x18b398,_0x167a8f){var _0x57df83=function(_0x5acf53){while(--_0x5acf53){_0x18b398['push'](_0x18b398['shift']());}};_0x57df83(++_0x167a8f);}(_0x376c,0x1e4));var _0xc376=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x376c[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xc376('0x0'));var util=require(_0xc376('0x1'));var logger=require(_0xc376('0x2'))(_0xc376('0x3'));var moment=require(_0xc376('0x4'));var BPromise=require(_0xc376('0x5'));var rp=require(_0xc376('0x6'));var fs=require('fs');var path=require(_0xc376('0x7'));var rimraf=require(_0xc376('0x8'));var config=require('../../config/environment');var attributes=require(_0xc376('0x9'));module[_0xc376('0xa')]=function(_0x5e9a19,_0x8e4e08){return _0x5e9a19[_0xc376('0xb')](_0xc376('0xc'),attributes,{'tableName':'voice_contexts','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 5337f42..3ad60e5 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 _0x4ad3=['../../config/environment','jayson/promise','client','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','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x4ad3,0x1b1));var _0x34ad=function(_0x23a079,_0xb8c9aa){_0x23a079=_0x23a079-0x0;var _0x53f2a5=_0x4ad3[_0x23a079];return _0x53f2a5;};'use strict';var _=require(_0x34ad('0x0'));var util=require(_0x34ad('0x1'));var moment=require(_0x34ad('0x2'));var BPromise=require(_0x34ad('0x3'));var rs=require(_0x34ad('0x4'));var fs=require('fs');var Redis=require(_0x34ad('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ad('0x6'));var logger=require(_0x34ad('0x7'))(_0x34ad('0x8'));var config=require(_0x34ad('0x9'));var jayson=require(_0x34ad('0xa'));var client=jayson[_0x34ad('0xb')][_0x34ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b927b,_0x674cc7,_0x10d356){return new BPromise(function(_0x4b6c38,_0x582178){return client[_0x34ad('0xd')](_0x3b927b,_0x10d356)[_0x34ad('0xe')](function(_0xb6c4f5){logger[_0x34ad('0xf')]('VoiceContext,\x20%s,\x20%s',_0x674cc7,_0x34ad('0x10'));logger[_0x34ad('0x11')](_0x34ad('0x12'),_0x674cc7,_0x34ad('0x10'),JSON[_0x34ad('0x13')](_0xb6c4f5));if(_0xb6c4f5[_0x34ad('0x14')]){if(_0xb6c4f5[_0x34ad('0x14')][_0x34ad('0x15')]===0x1f4){logger[_0x34ad('0x14')](_0x34ad('0x16'),_0x674cc7,_0xb6c4f5[_0x34ad('0x14')][_0x34ad('0x17')]);return _0x582178(_0xb6c4f5[_0x34ad('0x14')][_0x34ad('0x17')]);}logger[_0x34ad('0x14')](_0x34ad('0x16'),_0x674cc7,_0xb6c4f5['error'][_0x34ad('0x17')]);return _0x4b6c38(_0xb6c4f5[_0x34ad('0x14')][_0x34ad('0x17')]);}else{logger['info'](_0x34ad('0x16'),_0x674cc7,_0x34ad('0x10'));_0x4b6c38(_0xb6c4f5[_0x34ad('0x18')][_0x34ad('0x17')]);}})[_0x34ad('0x19')](function(_0x48e90a){logger[_0x34ad('0x14')]('VoiceContext,\x20%s,\x20%s',_0x674cc7,_0x48e90a);_0x582178(_0x48e90a);});});} \ No newline at end of file +var _0xd403=['info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x28407a,_0x2a7269){var _0x8bd6ef=function(_0x3c886f){while(--_0x3c886f){_0x28407a['push'](_0x28407a['shift']());}};_0x8bd6ef(++_0x2a7269);}(_0xd403,0x1d5));var _0x3d40=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xd403[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x3d40('0x0'));var util=require(_0x3d40('0x1'));var moment=require(_0x3d40('0x2'));var BPromise=require(_0x3d40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d40('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d40('0x5'));var logger=require(_0x3d40('0x6'))(_0x3d40('0x7'));var config=require(_0x3d40('0x8'));var jayson=require(_0x3d40('0x9'));var client=jayson[_0x3d40('0xa')][_0x3d40('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfd5569,_0x14dc5b,_0x1f488d){return new BPromise(function(_0x210104,_0x266868){return client[_0x3d40('0xc')](_0xfd5569,_0x1f488d)[_0x3d40('0xd')](function(_0xd96d5e){logger[_0x3d40('0xe')]('VoiceContext,\x20%s,\x20%s',_0x14dc5b,_0x3d40('0xf'));logger['debug'](_0x3d40('0x10'),_0x14dc5b,_0x3d40('0xf'),JSON[_0x3d40('0x11')](_0xd96d5e));if(_0xd96d5e['error']){if(_0xd96d5e[_0x3d40('0x12')][_0x3d40('0x13')]===0x1f4){logger[_0x3d40('0x12')]('VoiceContext,\x20%s,\x20%s',_0x14dc5b,_0xd96d5e[_0x3d40('0x12')][_0x3d40('0x14')]);return _0x266868(_0xd96d5e['error']['message']);}logger[_0x3d40('0x12')](_0x3d40('0x15'),_0x14dc5b,_0xd96d5e[_0x3d40('0x12')]['message']);return _0x210104(_0xd96d5e[_0x3d40('0x12')][_0x3d40('0x14')]);}else{logger[_0x3d40('0xe')](_0x3d40('0x15'),_0x14dc5b,_0x3d40('0xf'));_0x210104(_0xd96d5e[_0x3d40('0x16')][_0x3d40('0x14')]);}})['catch'](function(_0x496dfd){logger[_0x3d40('0x12')](_0x3d40('0x15'),_0x14dc5b,_0x496dfd);_0x266868(_0x496dfd);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 29d43df..90f355f 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 _0x9456=['post','create','put','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x41ac07,_0x54917a){var _0x49446a=function(_0x43267d){while(--_0x43267d){_0x41ac07['push'](_0x41ac07['shift']());}};_0x49446a(++_0x54917a);}(_0x9456,0x1f4));var _0x6945=function(_0x5cdf5d,_0x616e66){_0x5cdf5d=_0x5cdf5d-0x0;var _0x2b947a=_0x9456[_0x5cdf5d];return _0x2b947a;};'use strict';var multer=require(_0x6945('0x0'));var util=require('util');var path=require(_0x6945('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6945('0x2')]();var fs_extra=require(_0x6945('0x3'));var auth=require(_0x6945('0x4'));var interaction=require(_0x6945('0x5'));var config=require(_0x6945('0x6'));var controller=require('./voiceDialReport.controller');router[_0x6945('0x7')]('/',auth[_0x6945('0x8')](),controller[_0x6945('0x9')]);router['get'](_0x6945('0xa'),auth[_0x6945('0x8')](),controller['describe']);router[_0x6945('0x7')](_0x6945('0xb'),auth[_0x6945('0x8')](),controller[_0x6945('0xc')]);router[_0x6945('0xd')]('/',auth[_0x6945('0x8')](),controller[_0x6945('0xe')]);router[_0x6945('0xf')](_0x6945('0xb'),auth[_0x6945('0x8')](),controller['update']);router[_0x6945('0x10')](_0x6945('0xb'),auth[_0x6945('0x8')](),controller[_0x6945('0x11')]);module[_0x6945('0x12')]=router; \ No newline at end of file +var _0x3dc0=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1be75e,_0x1af06d){var _0x3a544d=function(_0x3896a9){while(--_0x3896a9){_0x1be75e['push'](_0x1be75e['shift']());}};_0x3a544d(++_0x1af06d);}(_0x3dc0,0xad));var _0x03dc=function(_0x1956fd,_0x22c77f){_0x1956fd=_0x1956fd-0x0;var _0x3f72d3=_0x3dc0[_0x1956fd];return _0x3f72d3;};'use strict';var multer=require(_0x03dc('0x0'));var util=require(_0x03dc('0x1'));var path=require(_0x03dc('0x2'));var timeout=require(_0x03dc('0x3'));var express=require(_0x03dc('0x4'));var router=express[_0x03dc('0x5')]();var fs_extra=require(_0x03dc('0x6'));var auth=require(_0x03dc('0x7'));var interaction=require(_0x03dc('0x8'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0x03dc('0x9')]('/',auth[_0x03dc('0xa')](),controller[_0x03dc('0xb')]);router['get'](_0x03dc('0xc'),auth[_0x03dc('0xa')](),controller['describe']);router[_0x03dc('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x03dc('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x03dc('0xe')](_0x03dc('0xf'),auth[_0x03dc('0xa')](),controller[_0x03dc('0x10')]);router[_0x03dc('0x11')](_0x03dc('0xf'),auth[_0x03dc('0xa')](),controller[_0x03dc('0x12')]);module[_0x03dc('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index f8e2392..3570b57 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 _0x9a19=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x403381,_0xf2faa4){var _0x48840a=function(_0x414612){while(--_0x414612){_0x403381['push'](_0x403381['shift']());}};_0x48840a(++_0xf2faa4);}(_0x9a19,0x114));var _0x99a1=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0x9a19[_0x52b7b9];return _0x5b5d30;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'privilege':{'type':Sequelize[_0x99a1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x99a1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'calleridnum':{'type':Sequelize[_0x99a1('0x2')]},'calleridname':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'language':{'type':Sequelize[_0x99a1('0x2')]},'accountcode':{'type':Sequelize[_0x99a1('0x2')]},'context':{'type':Sequelize[_0x99a1('0x2')]},'exten':{'type':Sequelize[_0x99a1('0x2')]},'priority':{'type':Sequelize[_0x99a1('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x99a1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'destlanguage':{'type':Sequelize[_0x99a1('0x2')]},'destaccountcode':{'type':Sequelize[_0x99a1('0x2')]},'destcontext':{'type':Sequelize[_0x99a1('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x99a1('0x3')]},'destuniqueid':{'type':Sequelize[_0x99a1('0x2')]},'destlinkedid':{'type':Sequelize[_0x99a1('0x2')]},'dialstring':{'type':Sequelize[_0x99a1('0x2')]},'dialstatus':{'type':Sequelize[_0x99a1('0x2')]},'starttime':{'type':Sequelize[_0x99a1('0x4')]},'answertime':{'type':Sequelize[_0x99a1('0x4')]},'endtime':{'type':Sequelize[_0x99a1('0x4')]},'lastevent':{'type':Sequelize[_0x99a1('0x2')],'comment':_0x99a1('0x5')},'routeId':{'type':Sequelize[_0x99a1('0x3')]},'duration':{'type':Sequelize[_0x99a1('0x3')]},'holdtime':{'type':Sequelize[_0x99a1('0x3')]},'billableseconds':{'type':Sequelize[_0x99a1('0x3')]}}; \ No newline at end of file +var _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x37b723,_0x4a261c){var _0x4dd80f=function(_0xa35d08){while(--_0xa35d08){_0x37b723['push'](_0x37b723['shift']());}};_0x4dd80f(++_0x4a261c);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 93fdf91..574ecd2 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 _0xc65f=['length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','apply','reject','save','update','then','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','key','keys','query','intersection','model','attributes','fields'];(function(_0x31ad0e,_0x350296){var _0x2940f6=function(_0x28d3cf){while(--_0x28d3cf){_0x31ad0e['push'](_0x31ad0e['shift']());}};_0x2940f6(++_0x350296);}(_0xc65f,0x1f0));var _0xfc65=function(_0xf8a475,_0x17818e){_0xf8a475=_0xf8a475-0x0;var _0x58c2a7=_0xc65f[_0xf8a475];return _0x58c2a7;};'use strict';var emlformat=require(_0xfc65('0x0'));var rimraf=require(_0xfc65('0x1'));var zipdir=require(_0xfc65('0x2'));var jsonpatch=require(_0xfc65('0x3'));var rp=require(_0xfc65('0x4'));var moment=require('moment');var BPromise=require(_0xfc65('0x5'));var Mustache=require('mustache');var util=require(_0xfc65('0x6'));var path=require(_0xfc65('0x7'));var sox=require(_0xfc65('0x8'));var csv=require(_0xfc65('0x9'));var ejs=require(_0xfc65('0xa'));var fs=require('fs');var fs_extra=require(_0xfc65('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfc65('0xc'));var toCsv=require(_0xfc65('0x9'));var querystring=require('querystring');var Papa=require(_0xfc65('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfc65('0xe'));var hardwareService=require(_0xfc65('0xf'));var logger=require(_0xfc65('0x10'))('api');var utils=require(_0xfc65('0x11'));var config=require(_0xfc65('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xfc65('0x13'))['db'];function respondWithStatusCode(_0x3b80f8,_0x2b2a97){_0x2b2a97=_0x2b2a97||0xcc;return function(_0x482344){if(_0x482344){return _0x3b80f8[_0xfc65('0x14')](_0x2b2a97);}return _0x3b80f8[_0xfc65('0x15')](_0x2b2a97)[_0xfc65('0x16')]();};}function respondWithResult(_0xcddf97,_0x47f494){_0x47f494=_0x47f494||0xc8;return function(_0x554f4d){if(_0x554f4d){return _0xcddf97[_0xfc65('0x15')](_0x47f494)[_0xfc65('0x17')](_0x554f4d);}};}function respondWithFilteredResult(_0x2f5255,_0xc22daa){return function(_0x186e3c){if(_0x186e3c){var _0x8e2d66=typeof _0xc22daa['offset']===_0xfc65('0x18')&&typeof _0xc22daa['limit']===_0xfc65('0x18');var _0xfadfc4=_0x186e3c[_0xfc65('0x19')];var _0x2c4aac=_0x8e2d66?0x0:_0xc22daa[_0xfc65('0x1a')];var _0x44add8=_0x8e2d66?_0x186e3c['count']:_0xc22daa[_0xfc65('0x1a')]+_0xc22daa[_0xfc65('0x1b')];var _0x7c4614;if(_0x44add8>=_0xfadfc4){_0x44add8=_0xfadfc4;_0x7c4614=0xc8;}else{_0x7c4614=0xce;}_0x2f5255['status'](_0x7c4614);return _0x2f5255['set']('Content-Range',_0x2c4aac+'-'+_0x44add8+'/'+_0xfadfc4)[_0xfc65('0x17')](_0x186e3c);}return null;};}function patchUpdates(_0x12da59){return function(_0x10bb92){try{jsonpatch[_0xfc65('0x1c')](_0x10bb92,_0x12da59,!![]);}catch(_0x11f857){return BPromise[_0xfc65('0x1d')](_0x11f857);}return _0x10bb92[_0xfc65('0x1e')]();};}function saveUpdates(_0x487693,_0x4fb8de){return function(_0x58559c){if(_0x58559c){return _0x58559c[_0xfc65('0x1f')](_0x487693)['then'](function(_0x5c8c8b){return _0x5c8c8b;});}return null;};}function removeEntity(_0x4ab5d8,_0x493a32){return function(_0x6263a8){if(_0x6263a8){return _0x6263a8['destroy']()[_0xfc65('0x20')](function(){_0x4ab5d8[_0xfc65('0x15')](0xcc)[_0xfc65('0x16')]();});}};}function handleEntityNotFound(_0x1716b6,_0x2de687){return function(_0x129e1c){if(!_0x129e1c){_0x1716b6[_0xfc65('0x14')](0x194);}return _0x129e1c;};}function handleError(_0x35e8e8,_0x45c22a){_0x45c22a=_0x45c22a||0x1f4;return function(_0x51487d){logger['error'](_0x51487d[_0xfc65('0x21')]);if(_0x51487d['name']){delete _0x51487d[_0xfc65('0x22')];}_0x35e8e8[_0xfc65('0x15')](_0x45c22a)[_0xfc65('0x23')](_0x51487d);};}exports[_0xfc65('0x24')]=function(_0x5965a9,_0x4eb027){var _0x109fc5={},_0x636d1c={},_0x2759c1={'count':0x0,'rows':[]};var _0x112f95=_[_0xfc65('0x25')](db[_0xfc65('0x26')][_0xfc65('0x27')],function(_0x4c2a59){return{'name':_0x4c2a59['fieldName'],'type':_0x4c2a59[_0xfc65('0x28')][_0xfc65('0x29')]};});_0x636d1c['model']=_[_0xfc65('0x25')](_0x112f95,_0xfc65('0x22'));_0x636d1c['query']=_[_0xfc65('0x2a')](_0x5965a9[_0xfc65('0x2b')]);_0x636d1c['filters']=_[_0xfc65('0x2c')](_0x636d1c[_0xfc65('0x2d')],_0x636d1c[_0xfc65('0x2b')]);_0x109fc5[_0xfc65('0x2e')]=_['intersection'](_0x636d1c[_0xfc65('0x2d')],qs[_0xfc65('0x2f')](_0x5965a9['query'][_0xfc65('0x2f')]));_0x109fc5[_0xfc65('0x2e')]=_0x109fc5[_0xfc65('0x2e')][_0xfc65('0x30')]?_0x109fc5[_0xfc65('0x2e')]:_0x636d1c[_0xfc65('0x2d')];if(!_0x5965a9['query']['hasOwnProperty'](_0xfc65('0x31'))){_0x109fc5[_0xfc65('0x1b')]=qs[_0xfc65('0x1b')](_0x5965a9[_0xfc65('0x2b')]['limit']);_0x109fc5[_0xfc65('0x1a')]=qs['offset'](_0x5965a9[_0xfc65('0x2b')]['offset']);}_0x109fc5[_0xfc65('0x32')]=qs['sort'](_0x5965a9[_0xfc65('0x2b')][_0xfc65('0x33')]);_0x109fc5['where']=qs[_0xfc65('0x34')](_[_0xfc65('0x35')](_0x5965a9[_0xfc65('0x2b')],_0x636d1c[_0xfc65('0x34')]),_0x112f95);if(_0x5965a9[_0xfc65('0x2b')][_0xfc65('0x36')]){_0x109fc5[_0xfc65('0x37')]=_[_0xfc65('0x38')](_0x109fc5[_0xfc65('0x37')],{'$or':_[_0xfc65('0x25')](_0x112f95,function(_0xb20ec9){if(_0xb20ec9[_0xfc65('0x28')]!==_0xfc65('0x39')){var _0x5b494d={};_0x5b494d[_0xb20ec9[_0xfc65('0x22')]]={'$like':'%'+_0x5965a9['query'][_0xfc65('0x36')]+'%'};return _0x5b494d;}})});}_0x109fc5=_[_0xfc65('0x38')]({},_0x109fc5,_0x5965a9[_0xfc65('0x3a')]);var _0x49d4df={'where':_0x109fc5['where']};return db[_0xfc65('0x26')][_0xfc65('0x19')](_0x49d4df)[_0xfc65('0x20')](function(_0x318fcb){_0x2759c1[_0xfc65('0x19')]=_0x318fcb;if(_0x5965a9[_0xfc65('0x2b')]['includeAll']){_0x109fc5[_0xfc65('0x3b')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x109fc5);})[_0xfc65('0x20')](function(_0x1766a){_0x2759c1['rows']=_0x1766a;return _0x2759c1;})[_0xfc65('0x20')](respondWithFilteredResult(_0x4eb027,_0x109fc5))[_0xfc65('0x3c')](handleError(_0x4eb027,null));};exports[_0xfc65('0x3d')]=function(_0x412407,_0x1cdd36){var _0x843edc={'raw':!![],'where':{'id':_0x412407[_0xfc65('0x3e')]['id']}},_0xc74da={};_0xc74da[_0xfc65('0x2d')]=_[_0xfc65('0x2a')](db[_0xfc65('0x26')]['rawAttributes']);_0xc74da[_0xfc65('0x2b')]=_[_0xfc65('0x2a')](_0x412407[_0xfc65('0x2b')]);_0xc74da[_0xfc65('0x34')]=_[_0xfc65('0x2c')](_0xc74da[_0xfc65('0x2d')],_0xc74da['query']);_0x843edc[_0xfc65('0x2e')]=_['intersection'](_0xc74da[_0xfc65('0x2d')],qs[_0xfc65('0x2f')](_0x412407[_0xfc65('0x2b')][_0xfc65('0x2f')]));_0x843edc[_0xfc65('0x2e')]=_0x843edc[_0xfc65('0x2e')][_0xfc65('0x30')]?_0x843edc[_0xfc65('0x2e')]:_0xc74da[_0xfc65('0x2d')];if(_0x412407[_0xfc65('0x2b')][_0xfc65('0x3f')]){_0x843edc['include']=[{'all':!![]}];}_0x843edc=_[_0xfc65('0x38')]({},_0x843edc,_0x412407[_0xfc65('0x3a')]);return db['VoiceDialReport'][_0xfc65('0x40')](_0x843edc)[_0xfc65('0x20')](handleEntityNotFound(_0x1cdd36,null))[_0xfc65('0x20')](respondWithResult(_0x1cdd36,null))[_0xfc65('0x3c')](handleError(_0x1cdd36,null));};exports[_0xfc65('0x41')]=function(_0x3bae01,_0x1ccd41){return db['VoiceDialReport'][_0xfc65('0x41')](_0x3bae01[_0xfc65('0x42')],{})[_0xfc65('0x20')](respondWithResult(_0x1ccd41,0xc9))['catch'](handleError(_0x1ccd41,null));};exports['update']=function(_0x3046ba,_0x5382fa){if(_0x3046ba[_0xfc65('0x42')]['id']){delete _0x3046ba[_0xfc65('0x42')]['id'];}return db[_0xfc65('0x26')][_0xfc65('0x40')]({'where':{'id':_0x3046ba[_0xfc65('0x3e')]['id']}})[_0xfc65('0x20')](handleEntityNotFound(_0x5382fa,null))[_0xfc65('0x20')](saveUpdates(_0x3046ba[_0xfc65('0x42')],null))['then'](respondWithResult(_0x5382fa,null))[_0xfc65('0x3c')](handleError(_0x5382fa,null));};exports[_0xfc65('0x43')]=function(_0x498c6a,_0x507efd){return db['VoiceDialReport'][_0xfc65('0x40')]({'where':{'id':_0x498c6a[_0xfc65('0x3e')]['id']}})[_0xfc65('0x20')](handleEntityNotFound(_0x507efd,null))[_0xfc65('0x20')](removeEntity(_0x507efd,null))[_0xfc65('0x3c')](handleError(_0x507efd,null));};exports['describe']=function(_0x390d15,_0x974003){return db[_0xfc65('0x26')]['describe']()[_0xfc65('0x20')](respondWithResult(_0x974003,null))[_0xfc65('0x3c')](handleError(_0x974003,null));}; \ No newline at end of file +var _0xa662=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x203f90,_0x1f112d){var _0x3f8714=function(_0x541065){while(--_0x541065){_0x203f90['push'](_0x203f90['shift']());}};_0x3f8714(++_0x1f112d);}(_0xa662,0x15b));var _0x2a66=function(_0x5dde58,_0x4b4902){_0x5dde58=_0x5dde58-0x0;var _0x395cca=_0xa662[_0x5dde58];return _0x395cca;};'use strict';var emlformat=require(_0x2a66('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2a66('0x1'));var jsonpatch=require(_0x2a66('0x2'));var rp=require(_0x2a66('0x3'));var moment=require(_0x2a66('0x4'));var BPromise=require(_0x2a66('0x5'));var Mustache=require(_0x2a66('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2a66('0x7'));var csv=require('to-csv');var ejs=require(_0x2a66('0x8'));var fs=require('fs');var fs_extra=require(_0x2a66('0x9'));var _=require(_0x2a66('0xa'));var squel=require(_0x2a66('0xb'));var crypto=require(_0x2a66('0xc'));var jsforce=require(_0x2a66('0xd'));var deskjs=require(_0x2a66('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2a66('0xf'));var Redis=require(_0x2a66('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a66('0x11'));var logger=require(_0x2a66('0x12'))(_0x2a66('0x13'));var utils=require(_0x2a66('0x14'));var config=require(_0x2a66('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a66('0x16'))['db'];function respondWithStatusCode(_0x4319af,_0x39b538){_0x39b538=_0x39b538||0xcc;return function(_0x202703){if(_0x202703){return _0x4319af[_0x2a66('0x17')](_0x39b538);}return _0x4319af[_0x2a66('0x18')](_0x39b538)[_0x2a66('0x19')]();};}function respondWithResult(_0x502c3a,_0x1f5e5e){_0x1f5e5e=_0x1f5e5e||0xc8;return function(_0x30b801){if(_0x30b801){return _0x502c3a[_0x2a66('0x18')](_0x1f5e5e)[_0x2a66('0x1a')](_0x30b801);}};}function respondWithFilteredResult(_0x371cf4,_0x1350b5){return function(_0xfe4afc){if(_0xfe4afc){var _0x45d846=typeof _0x1350b5[_0x2a66('0x1b')]===_0x2a66('0x1c')&&typeof _0x1350b5[_0x2a66('0x1d')]===_0x2a66('0x1c');var _0x129d95=_0xfe4afc['count'];var _0x13e814=_0x45d846?0x0:_0x1350b5['offset'];var _0x550800=_0x45d846?_0xfe4afc[_0x2a66('0x1e')]:_0x1350b5[_0x2a66('0x1b')]+_0x1350b5[_0x2a66('0x1d')];var _0x56c8e5;if(_0x550800>=_0x129d95){_0x550800=_0x129d95;_0x56c8e5=0xc8;}else{_0x56c8e5=0xce;}_0x371cf4[_0x2a66('0x18')](_0x56c8e5);return _0x371cf4[_0x2a66('0x1f')](_0x2a66('0x20'),_0x13e814+'-'+_0x550800+'/'+_0x129d95)[_0x2a66('0x1a')](_0xfe4afc);}return null;};}function patchUpdates(_0x41c752){return function(_0x41da46){try{jsonpatch['apply'](_0x41da46,_0x41c752,!![]);}catch(_0x3af935){return BPromise[_0x2a66('0x21')](_0x3af935);}return _0x41da46[_0x2a66('0x22')]();};}function saveUpdates(_0x21e569,_0x164fec){return function(_0x4932c9){if(_0x4932c9){return _0x4932c9[_0x2a66('0x23')](_0x21e569)[_0x2a66('0x24')](function(_0x2790c4){return _0x2790c4;});}return null;};}function removeEntity(_0x7a8150,_0x2fddda){return function(_0x484089){if(_0x484089){return _0x484089[_0x2a66('0x25')]()['then'](function(){_0x7a8150[_0x2a66('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x67965d,_0x13b5cb){return function(_0x4c81c9){if(!_0x4c81c9){_0x67965d['sendStatus'](0x194);}return _0x4c81c9;};}function handleError(_0x19eee5,_0x24d82a){_0x24d82a=_0x24d82a||0x1f4;return function(_0x423efd){logger[_0x2a66('0x26')](_0x423efd[_0x2a66('0x27')]);if(_0x423efd[_0x2a66('0x28')]){delete _0x423efd[_0x2a66('0x28')];}_0x19eee5[_0x2a66('0x18')](_0x24d82a)[_0x2a66('0x29')](_0x423efd);};}exports['index']=function(_0x2e6bf8,_0x1d849a){var _0x10a1c3={},_0x1a679c={},_0x4bfce1={'count':0x0,'rows':[]};var _0xd8aaaa=_[_0x2a66('0x2a')](db[_0x2a66('0x2b')][_0x2a66('0x2c')],function(_0x2c6c8f){return{'name':_0x2c6c8f[_0x2a66('0x2d')],'type':_0x2c6c8f[_0x2a66('0x2e')][_0x2a66('0x2f')]};});_0x1a679c[_0x2a66('0x30')]=_[_0x2a66('0x2a')](_0xd8aaaa,_0x2a66('0x28'));_0x1a679c['query']=_[_0x2a66('0x31')](_0x2e6bf8[_0x2a66('0x32')]);_0x1a679c['filters']=_[_0x2a66('0x33')](_0x1a679c[_0x2a66('0x30')],_0x1a679c[_0x2a66('0x32')]);_0x10a1c3[_0x2a66('0x34')]=_['intersection'](_0x1a679c['model'],qs['fields'](_0x2e6bf8['query'][_0x2a66('0x35')]));_0x10a1c3[_0x2a66('0x34')]=_0x10a1c3[_0x2a66('0x34')][_0x2a66('0x36')]?_0x10a1c3[_0x2a66('0x34')]:_0x1a679c[_0x2a66('0x30')];if(!_0x2e6bf8[_0x2a66('0x32')][_0x2a66('0x37')]('nolimit')){_0x10a1c3[_0x2a66('0x1d')]=qs[_0x2a66('0x1d')](_0x2e6bf8[_0x2a66('0x32')][_0x2a66('0x1d')]);_0x10a1c3[_0x2a66('0x1b')]=qs[_0x2a66('0x1b')](_0x2e6bf8[_0x2a66('0x32')][_0x2a66('0x1b')]);}_0x10a1c3[_0x2a66('0x38')]=qs[_0x2a66('0x39')](_0x2e6bf8[_0x2a66('0x32')][_0x2a66('0x39')]);_0x10a1c3[_0x2a66('0x3a')]=qs[_0x2a66('0x3b')](_[_0x2a66('0x3c')](_0x2e6bf8[_0x2a66('0x32')],_0x1a679c[_0x2a66('0x3b')]),_0xd8aaaa);if(_0x2e6bf8[_0x2a66('0x32')]['filter']){_0x10a1c3[_0x2a66('0x3a')]=_['merge'](_0x10a1c3['where'],{'$or':_['map'](_0xd8aaaa,function(_0x370145){if(_0x370145[_0x2a66('0x2e')]!==_0x2a66('0x3d')){var _0x2ee25f={};_0x2ee25f[_0x370145[_0x2a66('0x28')]]={'$like':'%'+_0x2e6bf8[_0x2a66('0x32')]['filter']+'%'};return _0x2ee25f;}})});}_0x10a1c3=_[_0x2a66('0x3e')]({},_0x10a1c3,_0x2e6bf8[_0x2a66('0x3f')]);var _0x5f2872={'where':_0x10a1c3['where']};return db[_0x2a66('0x2b')]['count'](_0x5f2872)[_0x2a66('0x24')](function(_0x46048a){_0x4bfce1[_0x2a66('0x1e')]=_0x46048a;if(_0x2e6bf8[_0x2a66('0x32')][_0x2a66('0x40')]){_0x10a1c3[_0x2a66('0x41')]=[{'all':!![]}];}return db[_0x2a66('0x2b')][_0x2a66('0x42')](_0x10a1c3);})[_0x2a66('0x24')](function(_0x43d3b7){_0x4bfce1['rows']=_0x43d3b7;return _0x4bfce1;})[_0x2a66('0x24')](respondWithFilteredResult(_0x1d849a,_0x10a1c3))[_0x2a66('0x43')](handleError(_0x1d849a,null));};exports[_0x2a66('0x44')]=function(_0x12f423,_0x2a5582){var _0x1f635f={'raw':!![],'where':{'id':_0x12f423[_0x2a66('0x45')]['id']}},_0x48fb59={};_0x48fb59[_0x2a66('0x30')]=_['keys'](db[_0x2a66('0x2b')][_0x2a66('0x2c')]);_0x48fb59[_0x2a66('0x32')]=_[_0x2a66('0x31')](_0x12f423[_0x2a66('0x32')]);_0x48fb59['filters']=_[_0x2a66('0x33')](_0x48fb59[_0x2a66('0x30')],_0x48fb59['query']);_0x1f635f[_0x2a66('0x34')]=_[_0x2a66('0x33')](_0x48fb59[_0x2a66('0x30')],qs[_0x2a66('0x35')](_0x12f423[_0x2a66('0x32')][_0x2a66('0x35')]));_0x1f635f['attributes']=_0x1f635f['attributes'][_0x2a66('0x36')]?_0x1f635f['attributes']:_0x48fb59[_0x2a66('0x30')];if(_0x12f423[_0x2a66('0x32')][_0x2a66('0x40')]){_0x1f635f['include']=[{'all':!![]}];}_0x1f635f=_['merge']({},_0x1f635f,_0x12f423[_0x2a66('0x3f')]);return db[_0x2a66('0x2b')][_0x2a66('0x46')](_0x1f635f)[_0x2a66('0x24')](handleEntityNotFound(_0x2a5582,null))['then'](respondWithResult(_0x2a5582,null))[_0x2a66('0x43')](handleError(_0x2a5582,null));};exports[_0x2a66('0x47')]=function(_0x45263c,_0x555e48){return db[_0x2a66('0x2b')][_0x2a66('0x47')](_0x45263c[_0x2a66('0x48')],{})[_0x2a66('0x24')](respondWithResult(_0x555e48,0xc9))[_0x2a66('0x43')](handleError(_0x555e48,null));};exports[_0x2a66('0x23')]=function(_0x5166f6,_0x52a303){if(_0x5166f6[_0x2a66('0x48')]['id']){delete _0x5166f6[_0x2a66('0x48')]['id'];}return db[_0x2a66('0x2b')]['find']({'where':{'id':_0x5166f6[_0x2a66('0x45')]['id']}})[_0x2a66('0x24')](handleEntityNotFound(_0x52a303,null))['then'](saveUpdates(_0x5166f6[_0x2a66('0x48')],null))['then'](respondWithResult(_0x52a303,null))[_0x2a66('0x43')](handleError(_0x52a303,null));};exports[_0x2a66('0x25')]=function(_0x3604db,_0x36bb89){return db[_0x2a66('0x2b')][_0x2a66('0x46')]({'where':{'id':_0x3604db['params']['id']}})['then'](handleEntityNotFound(_0x36bb89,null))['then'](removeEntity(_0x36bb89,null))['catch'](handleError(_0x36bb89,null));};exports[_0x2a66('0x49')]=function(_0x50973d,_0x1941b3){return db[_0x2a66('0x2b')][_0x2a66('0x49')]()[_0x2a66('0x24')](respondWithResult(_0x1941b3,null))[_0x2a66('0x43')](handleError(_0x1941b3,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 1103114..75920c6 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 _0xd306=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','VoiceDialReport','report_dial'];(function(_0x5db761,_0x19178b){var _0x3e91f3=function(_0x3098dd){while(--_0x3098dd){_0x5db761['push'](_0x5db761['shift']());}};_0x3e91f3(++_0x19178b);}(_0xd306,0x69));var _0x6d30=function(_0x3acb40,_0x28d69b){_0x3acb40=_0x3acb40-0x0;var _0x1ebaee=_0xd306[_0x3acb40];return _0x1ebaee;};'use strict';var _=require(_0x6d30('0x0'));var util=require(_0x6d30('0x1'));var logger=require(_0x6d30('0x2'))(_0x6d30('0x3'));var moment=require('moment');var BPromise=require(_0x6d30('0x4'));var rp=require(_0x6d30('0x5'));var fs=require('fs');var path=require(_0x6d30('0x6'));var rimraf=require('rimraf');var config=require(_0x6d30('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0x6d30('0x8')]=function(_0x28b4ed,_0x922d53){return _0x28b4ed[_0x6d30('0x9')](_0x6d30('0xa'),attributes,{'tableName':_0x6d30('0xb'),'paranoid':![],'indexes':[{'fields':[_0x6d30('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x21d1=['bluebird','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x1a7052,_0x2af89e){var _0x2cb9cf=function(_0x1f55e5){while(--_0x1f55e5){_0x1a7052['push'](_0x1a7052['shift']());}};_0x2cb9cf(++_0x2af89e);}(_0x21d1,0x1c9));var _0x121d=function(_0x509aab,_0x5c5194){_0x509aab=_0x509aab-0x0;var _0x1fca60=_0x21d1[_0x509aab];return _0x1fca60;};'use strict';var _=require(_0x121d('0x0'));var util=require(_0x121d('0x1'));var logger=require(_0x121d('0x2'))(_0x121d('0x3'));var moment=require(_0x121d('0x4'));var BPromise=require(_0x121d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x121d('0x6'));var config=require(_0x121d('0x7'));var attributes=require(_0x121d('0x8'));module[_0x121d('0x9')]=function(_0x2f3987,_0x4c47ee){return _0x2f3987[_0x121d('0xa')](_0x121d('0xb'),attributes,{'tableName':_0x121d('0xc'),'paranoid':![],'indexes':[{'fields':[_0x121d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 8afc882..d9a7c89 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 _0x80eb=['request','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','catch','CreateVoiceDialReport','VoiceDialReport','options','raw','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x456be1,_0x248c6e){var _0x43fa66=function(_0x8c0df9){while(--_0x8c0df9){_0x456be1['push'](_0x456be1['shift']());}};_0x43fa66(++_0x248c6e);}(_0x80eb,0x74));var _0xb80e=function(_0x546b17,_0x586b71){_0x546b17=_0x546b17-0x0;var _0x1f45bf=_0x80eb[_0x546b17];return _0x1f45bf;};'use strict';var _=require(_0xb80e('0x0'));var util=require(_0xb80e('0x1'));var moment=require('moment');var BPromise=require(_0xb80e('0x2'));var rs=require(_0xb80e('0x3'));var fs=require('fs');var Redis=require(_0xb80e('0x4'));var db=require(_0xb80e('0x5'))['db'];var utils=require(_0xb80e('0x6'));var logger=require(_0xb80e('0x7'))('rpc');var config=require(_0xb80e('0x8'));var jayson=require(_0xb80e('0x9'));var client=jayson[_0xb80e('0xa')][_0xb80e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x144859,_0x50a116,_0x310f4a){return new BPromise(function(_0x186e6e,_0x2819f4){return client[_0xb80e('0xc')](_0x144859,_0x310f4a)[_0xb80e('0xd')](function(_0x1a5b27){logger[_0xb80e('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x50a116,'request\x20sent');logger[_0xb80e('0xf')](_0xb80e('0x10'),_0x50a116,_0xb80e('0x11'),JSON[_0xb80e('0x12')](_0x1a5b27));if(_0x1a5b27[_0xb80e('0x13')]){if(_0x1a5b27[_0xb80e('0x13')]['code']===0x1f4){logger[_0xb80e('0x13')](_0xb80e('0x14'),_0x50a116,_0x1a5b27[_0xb80e('0x13')]['message']);return _0x2819f4(_0x1a5b27[_0xb80e('0x13')][_0xb80e('0x15')]);}logger['error'](_0xb80e('0x14'),_0x50a116,_0x1a5b27[_0xb80e('0x13')][_0xb80e('0x15')]);return _0x186e6e(_0x1a5b27[_0xb80e('0x13')][_0xb80e('0x15')]);}else{logger[_0xb80e('0xe')](_0xb80e('0x14'),_0x50a116,_0xb80e('0x11'));_0x186e6e(_0x1a5b27['result'][_0xb80e('0x15')]);}})[_0xb80e('0x16')](function(_0x229736){logger[_0xb80e('0x13')](_0xb80e('0x14'),_0x50a116,_0x229736);_0x2819f4(_0x229736);});});}exports[_0xb80e('0x17')]=function(_0x40f832){var _0x2fc06e=this;return new Promise(function(_0x51cc56,_0x372fd1){return db[_0xb80e('0x18')]['create'](_0x40f832['body'],{'raw':_0x40f832[_0xb80e('0x19')]?_0x40f832['options'][_0xb80e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4049c1){logger['info'](_0xb80e('0x17'),_0x40f832);logger[_0xb80e('0xf')]('CreateVoiceDialReport',_0x40f832,JSON[_0xb80e('0x12')](_0x4049c1));_0x51cc56(_0x4049c1);})['catch'](function(_0x50a59b){logger[_0xb80e('0x13')]('CreateVoiceDialReport',_0x50a59b['message'],_0x40f832);_0x372fd1(_0x2fc06e[_0xb80e('0x13')](0x1f4,_0x50a59b[_0xb80e('0x15')]));});});};exports[_0xb80e('0x1b')]=function(_0x14a36e){var _0x403a3d=this;return new Promise(function(_0x37fb54,_0x15ffbd){return db['VoiceDialReport'][_0xb80e('0x1c')](_0x14a36e['body'],{'raw':_0x14a36e[_0xb80e('0x19')]?_0x14a36e[_0xb80e('0x19')][_0xb80e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14a36e[_0xb80e('0x19')]?_0x14a36e['options'][_0xb80e('0x1d')]||null:null,'attributes':_0x14a36e['options']?_0x14a36e[_0xb80e('0x19')][_0xb80e('0x1e')]||null:null,'limit':_0x14a36e[_0xb80e('0x19')]?_0x14a36e[_0xb80e('0x19')][_0xb80e('0x1f')]||null:null})[_0xb80e('0xd')](function(_0x5df1d8){logger['info'](_0xb80e('0x1b'),_0x14a36e);logger[_0xb80e('0xf')]('UpdateVoiceDialReport',_0x14a36e,JSON[_0xb80e('0x12')](_0x5df1d8));_0x37fb54(_0x5df1d8);})[_0xb80e('0x16')](function(_0x471257){logger['error']('UpdateVoiceDialReport',_0x471257['message'],_0x14a36e);_0x15ffbd(_0x403a3d[_0xb80e('0x13')](0x1f4,_0x471257[_0xb80e('0x15')]));});});}; \ No newline at end of file +var _0x0f48=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','debug','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','bluebird','randomstring'];(function(_0xd87241,_0x3f36b6){var _0x5c618f=function(_0x320cc2){while(--_0x320cc2){_0xd87241['push'](_0xd87241['shift']());}};_0x5c618f(++_0x3f36b6);}(_0x0f48,0x104));var _0x80f4=function(_0x5d66d6,_0x4f3ae9){_0x5d66d6=_0x5d66d6-0x0;var _0x25f9a0=_0x0f48[_0x5d66d6];return _0x25f9a0;};'use strict';var _=require(_0x80f4('0x0'));var util=require(_0x80f4('0x1'));var moment=require('moment');var BPromise=require(_0x80f4('0x2'));var rs=require(_0x80f4('0x3'));var fs=require('fs');var Redis=require(_0x80f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x80f4('0x5'));var logger=require(_0x80f4('0x6'))('rpc');var config=require(_0x80f4('0x7'));var jayson=require(_0x80f4('0x8'));var client=jayson[_0x80f4('0x9')][_0x80f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x570d4c,_0x29a762,_0x4aa123){return new BPromise(function(_0x102460,_0xca3a4a){return client[_0x80f4('0xb')](_0x570d4c,_0x4aa123)[_0x80f4('0xc')](function(_0x49b917){logger[_0x80f4('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x29a762,_0x80f4('0xe'));logger['debug'](_0x80f4('0xf'),_0x29a762,_0x80f4('0xe'),JSON[_0x80f4('0x10')](_0x49b917));if(_0x49b917['error']){if(_0x49b917[_0x80f4('0x11')]['code']===0x1f4){logger[_0x80f4('0x11')](_0x80f4('0x12'),_0x29a762,_0x49b917[_0x80f4('0x11')][_0x80f4('0x13')]);return _0xca3a4a(_0x49b917[_0x80f4('0x11')][_0x80f4('0x13')]);}logger[_0x80f4('0x11')](_0x80f4('0x12'),_0x29a762,_0x49b917['error']['message']);return _0x102460(_0x49b917[_0x80f4('0x11')][_0x80f4('0x13')]);}else{logger[_0x80f4('0xd')](_0x80f4('0x12'),_0x29a762,_0x80f4('0xe'));_0x102460(_0x49b917[_0x80f4('0x14')]['message']);}})[_0x80f4('0x15')](function(_0x512d01){logger[_0x80f4('0x11')](_0x80f4('0x12'),_0x29a762,_0x512d01);_0xca3a4a(_0x512d01);});});}exports[_0x80f4('0x16')]=function(_0x23c836){var _0x4ece2c=this;return new Promise(function(_0x6aad8c,_0x35abd8){return db[_0x80f4('0x17')]['create'](_0x23c836[_0x80f4('0x18')],{'raw':_0x23c836[_0x80f4('0x19')]?_0x23c836['options'][_0x80f4('0x1a')]===undefined?!![]:![]:!![]})[_0x80f4('0xc')](function(_0x2faf32){logger[_0x80f4('0xd')](_0x80f4('0x16'),_0x23c836);logger[_0x80f4('0x1b')](_0x80f4('0x16'),_0x23c836,JSON[_0x80f4('0x10')](_0x2faf32));_0x6aad8c(_0x2faf32);})[_0x80f4('0x15')](function(_0x332cbe){logger[_0x80f4('0x11')](_0x80f4('0x16'),_0x332cbe[_0x80f4('0x13')],_0x23c836);_0x35abd8(_0x4ece2c[_0x80f4('0x11')](0x1f4,_0x332cbe['message']));});});};exports[_0x80f4('0x1c')]=function(_0x12179d){var _0x49d9ae=this;return new Promise(function(_0x488d9b,_0x3b0642){return db[_0x80f4('0x17')][_0x80f4('0x1d')](_0x12179d[_0x80f4('0x18')],{'raw':_0x12179d[_0x80f4('0x19')]?_0x12179d['options'][_0x80f4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12179d[_0x80f4('0x19')]?_0x12179d[_0x80f4('0x19')][_0x80f4('0x1e')]||null:null,'attributes':_0x12179d[_0x80f4('0x19')]?_0x12179d[_0x80f4('0x19')][_0x80f4('0x1f')]||null:null,'limit':_0x12179d[_0x80f4('0x19')]?_0x12179d[_0x80f4('0x19')][_0x80f4('0x20')]||null:null})[_0x80f4('0xc')](function(_0xa64f7){logger[_0x80f4('0xd')](_0x80f4('0x1c'),_0x12179d);logger[_0x80f4('0x1b')](_0x80f4('0x1c'),_0x12179d,JSON[_0x80f4('0x10')](_0xa64f7));_0x488d9b(_0xa64f7);})[_0x80f4('0x15')](function(_0x5dad82){logger[_0x80f4('0x11')](_0x80f4('0x1c'),_0x5dad82[_0x80f4('0x13')],_0x12179d);_0x3b0642(_0x49d9ae['error'](0x1f4,_0x5dad82[_0x80f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index b8e1826..5cea807 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 _0xf0d3=['../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post','/:id/applications','addApplications','put','/:id','update','exports','multer','util','../../components/interaction/service'];(function(_0x34e030,_0x57c46d){var _0x1a6406=function(_0x74f5ca){while(--_0x74f5ca){_0x34e030['push'](_0x34e030['shift']());}};_0x1a6406(++_0x57c46d);}(_0xf0d3,0xcd));var _0x3f0d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf0d3[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x3f0d('0x0'));var util=require(_0x3f0d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3f0d('0x2'));var config=require(_0x3f0d('0x3'));var controller=require(_0x3f0d('0x4'));router[_0x3f0d('0x5')]('/',auth[_0x3f0d('0x6')](),controller[_0x3f0d('0x7')]);router[_0x3f0d('0x5')]('/:id',auth[_0x3f0d('0x6')](),controller[_0x3f0d('0x8')]);router['post']('/',auth[_0x3f0d('0x6')](),controller['create']);router[_0x3f0d('0x9')](_0x3f0d('0xa'),auth[_0x3f0d('0x6')](),controller[_0x3f0d('0xb')]);router[_0x3f0d('0xc')](_0x3f0d('0xd'),auth['isAuthenticated'](),controller[_0x3f0d('0xe')]);router['delete'](_0x3f0d('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x3f0d('0xf')]=router; \ No newline at end of file +var _0xf6df=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post','create','addApplications','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xf6df,0x126));var _0xff6d=function(_0x4c5789,_0x1eb016){_0x4c5789=_0x4c5789-0x0;var _0xef4781=_0xf6df[_0x4c5789];return _0xef4781;};'use strict';var multer=require(_0xff6d('0x0'));var util=require(_0xff6d('0x1'));var path=require(_0xff6d('0x2'));var timeout=require(_0xff6d('0x3'));var express=require(_0xff6d('0x4'));var router=express[_0xff6d('0x5')]();var fs_extra=require(_0xff6d('0x6'));var auth=require(_0xff6d('0x7'));var interaction=require(_0xff6d('0x8'));var config=require(_0xff6d('0x9'));var controller=require(_0xff6d('0xa'));router[_0xff6d('0xb')]('/',auth[_0xff6d('0xc')](),controller[_0xff6d('0xd')]);router[_0xff6d('0xb')]('/:id',auth[_0xff6d('0xc')](),controller[_0xff6d('0xe')]);router[_0xff6d('0xf')]('/',auth['isAuthenticated'](),controller[_0xff6d('0x10')]);router[_0xff6d('0xf')]('/:id/applications',auth[_0xff6d('0xc')](),controller[_0xff6d('0x11')]);router[_0xff6d('0x12')]('/:id',auth[_0xff6d('0xc')](),controller[_0xff6d('0x13')]);router[_0xff6d('0x14')](_0xff6d('0x15'),auth[_0xff6d('0xc')](),controller['destroy']);module[_0xff6d('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 4a60772..2c3fb1a 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 _0xa992=['*,*,*,*','INTEGER','BOOLEAN','wav','exten','sequelize','STRING','compositeIndex','inbound','outbound','outbound-fax'];(function(_0x218e8e,_0x52f635){var _0x30084a=function(_0x328ee1){while(--_0x328ee1){_0x218e8e['push'](_0x218e8e['shift']());}};_0x30084a(++_0x52f635);}(_0xa992,0x139));var _0x2a99=function(_0x15ff82,_0x386032){_0x15ff82=_0x15ff82-0x0;var _0x155666=_0xa992[_0x15ff82];return _0x155666;};'use strict';var Sequelize=require(_0x2a99('0x0'));module['exports']={'context':{'type':Sequelize[_0x2a99('0x1')],'allowNull':![],'unique':_0x2a99('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x2a99('0x1')],'allowNull':![],'unique':_0x2a99('0x2')},'priority':{'type':Sequelize[_0x2a99('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x2a99('0x2')},'tag':{'type':Sequelize[_0x2a99('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x2a99('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x2a99('0x3'),_0x2a99('0x4'),'internal','inbound-fax',_0x2a99('0x5'),'system','any'),'allowNull':![]},'description':{'type':Sequelize[_0x2a99('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2a99('0x6')},'IntervalId':{'type':Sequelize[_0x2a99('0x7')]},'isApp':{'type':Sequelize[_0x2a99('0x8')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x2a99('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x2a99('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x2a99('0x8')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x2a99('0x7')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x2a99('0x9')},'answer':{'type':Sequelize[_0x2a99('0x8')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5b82d5){return this['getDataValue'](_0x2a99('0xa'));}},'alias':{'type':Sequelize[_0x2a99('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xcb30=['exten','sequelize','exports','STRING','compositeIndex','inbound','outbound','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL'];(function(_0xc6736e,_0x21aee4){var _0x3cbd8b=function(_0x506f75){while(--_0x506f75){_0xc6736e['push'](_0xc6736e['shift']());}};_0x3cbd8b(++_0x21aee4);}(_0xcb30,0x178));var _0x0cb3=function(_0x1ca93c,_0x3271ab){_0x1ca93c=_0x1ca93c-0x0;var _0x185169=_0xcb30[_0x1ca93c];return _0x185169;};'use strict';var Sequelize=require(_0x0cb3('0x0'));module[_0x0cb3('0x1')]={'context':{'type':Sequelize[_0x0cb3('0x2')],'allowNull':![],'unique':_0x0cb3('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0cb3('0x2')],'allowNull':![],'unique':_0x0cb3('0x3')},'priority':{'type':Sequelize[_0x0cb3('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x0cb3('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0cb3('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x0cb3('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0cb3('0x4'),_0x0cb3('0x5'),'internal','inbound-fax',_0x0cb3('0x6'),_0x0cb3('0x7'),_0x0cb3('0x8')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0cb3('0x9')},'IntervalId':{'type':Sequelize[_0x0cb3('0xa')]},'isApp':{'type':Sequelize[_0x0cb3('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0cb3('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0cb3('0xa')]},'recordingFormat':{'type':Sequelize[_0x0cb3('0x2')],'defaultValue':_0x0cb3('0xc')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x0cb3('0xd')],'get':function(_0xd97c13){return this['getDataValue'](_0x0cb3('0xe'));}},'alias':{'type':Sequelize[_0x0cb3('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 c2f8423..08064e7 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 _0x7244=['body','startsWith','exten','concat','create','user','inbound','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','priority','stack','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','end','status','offset','limit','undefined','count','set','Content-Range','json','destroy','then','get','InboundRoutes','OutboundRoutes','outbound','internal','filter','ignore','map','value','type','find','UserProfileResource','sendStatus','error','name','send','index','VoiceExtension','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include'];(function(_0x245ff8,_0x2e81f8){var _0x5a4faa=function(_0x26af9e){while(--_0x26af9e){_0x245ff8['push'](_0x245ff8['shift']());}};_0x5a4faa(++_0x2e81f8);}(_0x7244,0x14c));var _0x4724=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x7244[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x4724('0x0'));var Redis=require(_0x4724('0x1'));var qs=require(_0x4724('0x2'));var logger=require(_0x4724('0x3'))(_0x4724('0x4'));var config=require(_0x4724('0x5'));var db=require(_0x4724('0x6'))['db'];config[_0x4724('0x7')]=_[_0x4724('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4724('0x9'))(new Redis(config[_0x4724('0x7')]));require(_0x4724('0xa'))[_0x4724('0xb')](socket);function respondWithStatusCode(_0x43e1b7,_0x1cbd3a){_0x1cbd3a=_0x1cbd3a||0xcc;return function(_0x4d4a48){if(_0x4d4a48){return _0x43e1b7['sendStatus'](_0x1cbd3a);}return _0x43e1b7['status'](_0x1cbd3a)[_0x4724('0xc')]();};}function respondWithResult(_0x1631a5,_0x22beb2){_0x22beb2=_0x22beb2||0xc8;return function(_0x1d047c){if(_0x1d047c){return _0x1631a5[_0x4724('0xd')](_0x22beb2)['json'](_0x1d047c);}};}function respondWithFilteredResult(_0x3becf8,_0x2635d3){return function(_0x598864){if(_0x598864){var _0x5d4d3a=typeof _0x2635d3[_0x4724('0xe')]==='undefined'&&typeof _0x2635d3[_0x4724('0xf')]===_0x4724('0x10');var _0x336312=_0x598864['count'];var _0x4e901b=_0x5d4d3a?0x0:_0x2635d3['offset'];var _0x250da2=_0x5d4d3a?_0x598864[_0x4724('0x11')]:_0x2635d3[_0x4724('0xe')]+_0x2635d3[_0x4724('0xf')];var _0x8e5cca;if(_0x250da2>=_0x336312){_0x250da2=_0x336312;_0x8e5cca=0xc8;}else{_0x8e5cca=0xce;}_0x3becf8['status'](_0x8e5cca);return _0x3becf8[_0x4724('0x12')](_0x4724('0x13'),_0x4e901b+'-'+_0x250da2+'/'+_0x336312)[_0x4724('0x14')](_0x598864);}return null;};}function removeEntity(_0x5a40d3){return function(_0x5c2eb9){if(_0x5c2eb9){return _0x5c2eb9[_0x4724('0x15')]()[_0x4724('0x16')](function(){var _0x19ecbd=_0x5c2eb9[_0x4724('0x17')]({'plain':!![]});var _0x1e70d1=[{'name':_0x4724('0x18'),'value':'inbound','ignore':![]},{'name':_0x4724('0x19'),'value':_0x4724('0x1a'),'ignore':![]},{'name':'InternalRoutes','value':_0x4724('0x1b'),'ignore':![]}];var _0x44efaa=_(_0x1e70d1)[_0x4724('0x1c')](_0x4724('0x1d'))[_0x4724('0x1e')](_0x4724('0x1f'))['value']();if(_['includes'](_0x44efaa,_0x19ecbd[_0x4724('0x20')])){return;}var _0x13e956=_[_0x4724('0x21')](_0x1e70d1,[_0x4724('0x1f'),_0x19ecbd[_0x4724('0x20')]])['name'];return db[_0x4724('0x22')][_0x4724('0x15')]({'where':{'type':_0x13e956,'resourceId':_0x19ecbd['id']}})['then'](function(){return _0x5c2eb9;});})['then'](function(){_0x5a40d3[_0x4724('0xd')](0xcc)[_0x4724('0xc')]();});}};}function handleEntityNotFound(_0x2233ad){return function(_0x130e19){if(!_0x130e19){_0x2233ad[_0x4724('0x23')](0x194);}return _0x130e19;};}function handleError(_0x586c7c,_0x30eb6f){_0x30eb6f=_0x30eb6f||0x1f4;return function(_0x1c70f0){logger[_0x4724('0x24')](_0x1c70f0['stack']);if(_0x1c70f0[_0x4724('0x25')]){delete _0x1c70f0[_0x4724('0x25')];}_0x586c7c['status'](_0x30eb6f)[_0x4724('0x26')](_0x1c70f0);};}exports[_0x4724('0x27')]=function(_0x282302,_0x1b1a7b){var _0x43f517={},_0x341c31={},_0x25daac={'count':0x0,'rows':[]};var _0x291856=_[_0x4724('0x1e')](db[_0x4724('0x28')]['rawAttributes'],function(_0x52c18f){return{'name':_0x52c18f[_0x4724('0x29')],'type':_0x52c18f[_0x4724('0x20')][_0x4724('0x2a')]};});_0x341c31['model']=_[_0x4724('0x1e')](_0x291856,_0x4724('0x25'));_0x341c31[_0x4724('0x2b')]=_['keys'](_0x282302[_0x4724('0x2b')]);_0x341c31[_0x4724('0x2c')]=_[_0x4724('0x2d')](_0x341c31[_0x4724('0x2e')],_0x341c31[_0x4724('0x2b')]);_0x43f517[_0x4724('0x2f')]=_['intersection'](_0x341c31[_0x4724('0x2e')],qs[_0x4724('0x30')](_0x282302[_0x4724('0x2b')][_0x4724('0x30')]));_0x43f517[_0x4724('0x2f')]=_0x43f517[_0x4724('0x2f')][_0x4724('0x31')]?_0x43f517[_0x4724('0x2f')]:_0x341c31['model'];if(!_0x282302[_0x4724('0x2b')][_0x4724('0x32')](_0x4724('0x33'))){_0x43f517[_0x4724('0xf')]=qs['limit'](_0x282302['query']['limit']);_0x43f517[_0x4724('0xe')]=qs[_0x4724('0xe')](_0x282302[_0x4724('0x2b')][_0x4724('0xe')]);}_0x43f517[_0x4724('0x34')]=qs[_0x4724('0x35')](_0x282302[_0x4724('0x2b')][_0x4724('0x35')]);_0x43f517[_0x4724('0x36')]=qs[_0x4724('0x2c')](_[_0x4724('0x37')](_0x282302[_0x4724('0x2b')],_0x341c31[_0x4724('0x2c')]),_0x291856);if(_0x282302[_0x4724('0x2b')][_0x4724('0x1c')]){_0x43f517[_0x4724('0x36')]=_[_0x4724('0x38')](_0x43f517[_0x4724('0x36')],{'$or':_[_0x4724('0x1e')](_0x291856,function(_0x359adc){if(_0x359adc[_0x4724('0x20')]!==_0x4724('0x39')){var _0x22a7a7={};_0x22a7a7[_0x359adc[_0x4724('0x25')]]={'$like':'%'+_0x282302[_0x4724('0x2b')][_0x4724('0x1c')]+'%'};return _0x22a7a7;}})});}_0x43f517=_['merge']({},_0x43f517,_0x282302[_0x4724('0x3a')]);var _0x49aaf9={'where':_0x43f517[_0x4724('0x36')]};return db[_0x4724('0x28')][_0x4724('0x11')](_0x49aaf9)[_0x4724('0x16')](function(_0xe0646e){_0x25daac[_0x4724('0x11')]=_0xe0646e;if(_0x282302[_0x4724('0x2b')][_0x4724('0x3b')]){_0x43f517['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x4724('0x3c')](_0x43f517);})[_0x4724('0x16')](function(_0x2f0763){_0x25daac[_0x4724('0x3d')]=_0x2f0763;return _0x25daac;})['then'](respondWithFilteredResult(_0x1b1a7b,_0x43f517))[_0x4724('0x3e')](handleError(_0x1b1a7b,null));};exports[_0x4724('0x3f')]=function(_0x2fe67c,_0xe2996f){var _0x176d03={'raw':![],'where':{'id':_0x2fe67c[_0x4724('0x40')]['id']}},_0x20925d={};_0x20925d[_0x4724('0x2e')]=_[_0x4724('0x41')](db[_0x4724('0x28')][_0x4724('0x42')]);_0x20925d[_0x4724('0x2b')]=_[_0x4724('0x41')](_0x2fe67c[_0x4724('0x2b')]);_0x20925d[_0x4724('0x2c')]=_[_0x4724('0x2d')](_0x20925d['model'],_0x20925d[_0x4724('0x2b')]);_0x176d03[_0x4724('0x2f')]=_[_0x4724('0x2d')](_0x20925d[_0x4724('0x2e')],qs[_0x4724('0x30')](_0x2fe67c[_0x4724('0x2b')][_0x4724('0x30')]));_0x176d03['attributes']=_0x176d03[_0x4724('0x2f')][_0x4724('0x31')]?_0x176d03[_0x4724('0x2f')]:_0x20925d[_0x4724('0x2e')];if(_0x2fe67c[_0x4724('0x2b')][_0x4724('0x3b')]){_0x176d03[_0x4724('0x43')]=[{'all':!![]}];}_0x176d03=_[_0x4724('0x38')]({},_0x176d03,_0x2fe67c[_0x4724('0x3a')]);return db[_0x4724('0x28')]['find'](_0x176d03)[_0x4724('0x16')](handleEntityNotFound(_0xe2996f,null))['then'](respondWithResult(_0xe2996f,null))[_0x4724('0x3e')](handleError(_0xe2996f,null));};exports['destroy']=function(_0x3e9441,_0x3dc0ca){return db[_0x4724('0x28')][_0x4724('0x21')]({'where':{'id':_0x3e9441[_0x4724('0x40')]['id']}})[_0x4724('0x16')](handleEntityNotFound(_0x3dc0ca,null))[_0x4724('0x16')](removeEntity(_0x3dc0ca,null))['catch'](handleError(_0x3dc0ca,null));};exports['create']=function(_0x29f0cb,_0x2f8c0b){if(_0x29f0cb[_0x4724('0x44')][_0x4724('0x20')]==='outbound'&&!_[_0x4724('0x45')](_0x29f0cb['body'][_0x4724('0x46')],'_')){_0x29f0cb[_0x4724('0x44')][_0x4724('0x46')]='_'[_0x4724('0x47')](_0x29f0cb[_0x4724('0x44')]['exten']);}return db['VoiceExtension'][_0x4724('0x48')](_0x29f0cb[_0x4724('0x44')],{'raw':![]})[_0x4724('0x16')](function(_0x294c0f){var _0x5c8495=_0x29f0cb[_0x4724('0x49')]['get']({'plain':!![]});if(!_0x5c8495)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c8495['role']===_0x4724('0x49')){var _0x2ab66c=_0x294c0f[_0x4724('0x17')]({'plain':!![]});var _0xe44e00=[{'name':_0x4724('0x18'),'value':_0x4724('0x4a')},{'name':'OutboundRoutes','value':_0x4724('0x1a')},{'name':_0x4724('0x4b'),'value':'internal'}];var _0x1bf06a=_[_0x4724('0x21')](_0xe44e00,['value',_0x2ab66c['type']])[_0x4724('0x25')];return db[_0x4724('0x4c')][_0x4724('0x21')]({'where':{'name':_0x1bf06a,'userProfileId':_0x5c8495[_0x4724('0x4d')]},'raw':!![]})[_0x4724('0x16')](function(_0x314862){if(_0x314862&&_0x314862[_0x4724('0x4e')]===0x0){return db['UserProfileResource'][_0x4724('0x48')]({'name':_0x2ab66c['name'],'resourceId':_0x2ab66c['id'],'type':_0x314862[_0x4724('0x25')],'sectionId':_0x314862['id']},{})[_0x4724('0x16')](function(){return _0x294c0f;});}else{return _0x294c0f;}})['catch'](function(_0x581d31){logger[_0x4724('0x24')](_0x4724('0x4f'),_0x581d31);throw _0x581d31;});}return _0x294c0f;})[_0x4724('0x16')](respondWithResult(_0x2f8c0b,0xc9))['catch'](handleError(_0x2f8c0b,null));};exports[_0x4724('0x50')]=function(_0x969f28,_0x472b78){if(_0x969f28[_0x4724('0x44')]['id']){delete _0x969f28[_0x4724('0x44')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x969f28[_0x4724('0x40')]['id']}})['then'](handleEntityNotFound(_0x472b78,null))[_0x4724('0x16')](function(_0x201c36){if(_0x201c36){return db['VoiceExtension'][_0x4724('0x50')](_[_0x4724('0x37')](_0x969f28[_0x4724('0x44')],[_0x4724('0x46'),'context',_0x4724('0x51'),_0x4724('0x52'),_0x4724('0x53'),_0x4724('0x54'),_0x4724('0x55')]),{'where':{'context':_0x201c36[_0x4724('0x56')],'exten':_0x201c36['exten']},'individualHooks':!![]})[_0x4724('0x16')](function(_0x1011c4){return _0x1011c4;});}return null;})['then'](respondWithStatusCode(_0x472b78,null))[_0x4724('0x3e')](handleError(_0x472b78,null));};exports[_0x4724('0x57')]=function(_0xeb9c4b,_0xabdeb8){var _0x2b9395=_0xeb9c4b[_0x4724('0x40')]['id'];var _0x445ee0=_0xeb9c4b[_0x4724('0x44')];var _0x1dddbe=0xc8;var _0x4c2dec=null;return db['sequelize'][_0x4724('0x58')]({'isolationLevel':db['sequelize']['Transaction'][_0x4724('0x59')][_0x4724('0x5a')]},function(_0x415725){return db[_0x4724('0x28')][_0x4724('0x5b')]({'where':{'id':_0x2b9395},'transaction':_0x415725})[_0x4724('0x16')](function(_0x28d1a5){if(_0x28d1a5){return db['VoiceExtension'][_0x4724('0x15')]({'where':{'VoiceExtensionId':_0x2b9395},'transaction':_0x415725})[_0x4724('0x16')](function(){var _0x5bc7ac=_[_0x4724('0x1e')](_0x445ee0,function(_0x7247d1){_0x7247d1[_0x4724('0x5c')]=_0x2b9395;_0x7247d1[_0x4724('0x5d')]=!![];return _0x7247d1;});return _0x28d1a5[_0x4724('0x5e')](_0x5bc7ac);})[_0x4724('0x16')](function(_0x4a9a02){return db['VoiceExtension'][_0x4724('0x5f')](_0x4a9a02,{'transaction':_0x415725});});}else{_0x1dddbe=0x194;_0x4c2dec=[];}});})[_0x4724('0x16')](function(){if(_0x1dddbe!==0x194){return db[_0x4724('0x28')][_0x4724('0x60')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2b9395},'order':_0x4724('0x61')})[_0x4724('0x16')](function(_0x4b6123){_0x4c2dec=_0x4b6123;});}})[_0x4724('0x3e')](function(_0x5ea241){_0x1dddbe=0x1f4;logger[_0x4724('0x24')](_0x5ea241[_0x4724('0x62')]);if(_0x5ea241[_0x4724('0x25')]){delete _0x5ea241[_0x4724('0x25')];}_0x4c2dec=_0x5ea241;})[_0x4724('0x63')](function(){if(_0x4c2dec===null){_0xabdeb8[_0x4724('0x23')](_0x1dddbe);}else{if(_0x1dddbe===0x1f4){_0xabdeb8[_0x4724('0xd')](_0x1dddbe)[_0x4724('0x26')](_0x4c2dec);}else{_0xabdeb8['status'](_0x1dddbe)[_0x4724('0x14')](_0x4c2dec);}}});}; \ No newline at end of file +var _0x57be=['context','description','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','priority','stack','lodash','../../components/parsers/qs','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','map','includes','value','type','name','UserProfileResource','destroy','error','send','index','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','find','catch','create','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x57be,0xbd));var _0xe57b=function(_0xf7e6b3,_0x5e9777){_0xf7e6b3=_0xf7e6b3-0x0;var _0x30b037=_0x57be[_0xf7e6b3];return _0x30b037;};'use strict';var _=require(_0xe57b('0x0'));var Redis=require('ioredis');var qs=require(_0xe57b('0x1'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xe57b('0x2')](config[_0xe57b('0x3')],{'host':_0xe57b('0x4'),'port':0x18eb});var socket=require(_0xe57b('0x5'))(new Redis(config[_0xe57b('0x3')]));require(_0xe57b('0x6'))[_0xe57b('0x7')](socket);function respondWithStatusCode(_0x10f6f6,_0x18abe0){_0x18abe0=_0x18abe0||0xcc;return function(_0x464c3a){if(_0x464c3a){return _0x10f6f6[_0xe57b('0x8')](_0x18abe0);}return _0x10f6f6[_0xe57b('0x9')](_0x18abe0)[_0xe57b('0xa')]();};}function respondWithResult(_0x261a04,_0x528c4e){_0x528c4e=_0x528c4e||0xc8;return function(_0x2549a9){if(_0x2549a9){return _0x261a04[_0xe57b('0x9')](_0x528c4e)[_0xe57b('0xb')](_0x2549a9);}};}function respondWithFilteredResult(_0x1cd86b,_0x374d57){return function(_0x5ba871){if(_0x5ba871){var _0x258c38=typeof _0x374d57[_0xe57b('0xc')]==='undefined'&&typeof _0x374d57[_0xe57b('0xd')]===_0xe57b('0xe');var _0x5b2d76=_0x5ba871[_0xe57b('0xf')];var _0x41e65e=_0x258c38?0x0:_0x374d57['offset'];var _0x5ac0a7=_0x258c38?_0x5ba871[_0xe57b('0xf')]:_0x374d57['offset']+_0x374d57[_0xe57b('0xd')];var _0x142aab;if(_0x5ac0a7>=_0x5b2d76){_0x5ac0a7=_0x5b2d76;_0x142aab=0xc8;}else{_0x142aab=0xce;}_0x1cd86b['status'](_0x142aab);return _0x1cd86b['set'](_0xe57b('0x10'),_0x41e65e+'-'+_0x5ac0a7+'/'+_0x5b2d76)[_0xe57b('0xb')](_0x5ba871);}return null;};}function removeEntity(_0x44e4cd){return function(_0x50d0ba){if(_0x50d0ba){return _0x50d0ba['destroy']()[_0xe57b('0x11')](function(){var _0x1804c2=_0x50d0ba[_0xe57b('0x12')]({'plain':!![]});var _0x50ff07=[{'name':_0xe57b('0x13'),'value':_0xe57b('0x14'),'ignore':![]},{'name':_0xe57b('0x15'),'value':_0xe57b('0x16'),'ignore':![]},{'name':'InternalRoutes','value':_0xe57b('0x17'),'ignore':![]}];var _0x83ba53=_(_0x50ff07)[_0xe57b('0x18')]('ignore')[_0xe57b('0x19')]('value')['value']();if(_[_0xe57b('0x1a')](_0x83ba53,_0x1804c2['type'])){return;}var _0xb1b532=_['find'](_0x50ff07,[_0xe57b('0x1b'),_0x1804c2[_0xe57b('0x1c')]])[_0xe57b('0x1d')];return db[_0xe57b('0x1e')][_0xe57b('0x1f')]({'where':{'type':_0xb1b532,'resourceId':_0x1804c2['id']}})[_0xe57b('0x11')](function(){return _0x50d0ba;});})[_0xe57b('0x11')](function(){_0x44e4cd[_0xe57b('0x9')](0xcc)[_0xe57b('0xa')]();});}};}function handleEntityNotFound(_0x56c059){return function(_0x24f7d4){if(!_0x24f7d4){_0x56c059[_0xe57b('0x8')](0x194);}return _0x24f7d4;};}function handleError(_0x16b050,_0x23eef4){_0x23eef4=_0x23eef4||0x1f4;return function(_0x451837){logger[_0xe57b('0x20')](_0x451837['stack']);if(_0x451837[_0xe57b('0x1d')]){delete _0x451837[_0xe57b('0x1d')];}_0x16b050[_0xe57b('0x9')](_0x23eef4)[_0xe57b('0x21')](_0x451837);};}exports[_0xe57b('0x22')]=function(_0x3189ce,_0x5b1913){var _0x2257e7={},_0x5087c3={},_0x357f5e={'count':0x0,'rows':[]};var _0x1bfed5=_[_0xe57b('0x19')](db['VoiceExtension'][_0xe57b('0x23')],function(_0x3cd83a){return{'name':_0x3cd83a[_0xe57b('0x24')],'type':_0x3cd83a[_0xe57b('0x1c')][_0xe57b('0x25')]};});_0x5087c3[_0xe57b('0x26')]=_[_0xe57b('0x19')](_0x1bfed5,_0xe57b('0x1d'));_0x5087c3['query']=_[_0xe57b('0x27')](_0x3189ce[_0xe57b('0x28')]);_0x5087c3[_0xe57b('0x29')]=_[_0xe57b('0x2a')](_0x5087c3[_0xe57b('0x26')],_0x5087c3[_0xe57b('0x28')]);_0x2257e7[_0xe57b('0x2b')]=_[_0xe57b('0x2a')](_0x5087c3[_0xe57b('0x26')],qs[_0xe57b('0x2c')](_0x3189ce[_0xe57b('0x28')][_0xe57b('0x2c')]));_0x2257e7['attributes']=_0x2257e7[_0xe57b('0x2b')][_0xe57b('0x2d')]?_0x2257e7['attributes']:_0x5087c3[_0xe57b('0x26')];if(!_0x3189ce[_0xe57b('0x28')][_0xe57b('0x2e')](_0xe57b('0x2f'))){_0x2257e7[_0xe57b('0xd')]=qs[_0xe57b('0xd')](_0x3189ce[_0xe57b('0x28')]['limit']);_0x2257e7['offset']=qs[_0xe57b('0xc')](_0x3189ce[_0xe57b('0x28')][_0xe57b('0xc')]);}_0x2257e7[_0xe57b('0x30')]=qs['sort'](_0x3189ce['query'][_0xe57b('0x31')]);_0x2257e7['where']=qs[_0xe57b('0x29')](_[_0xe57b('0x32')](_0x3189ce[_0xe57b('0x28')],_0x5087c3['filters']),_0x1bfed5);if(_0x3189ce[_0xe57b('0x28')]['filter']){_0x2257e7[_0xe57b('0x33')]=_[_0xe57b('0x34')](_0x2257e7[_0xe57b('0x33')],{'$or':_[_0xe57b('0x19')](_0x1bfed5,function(_0x4534d9){if(_0x4534d9[_0xe57b('0x1c')]!==_0xe57b('0x35')){var _0x38acbf={};_0x38acbf[_0x4534d9[_0xe57b('0x1d')]]={'$like':'%'+_0x3189ce['query'][_0xe57b('0x18')]+'%'};return _0x38acbf;}})});}_0x2257e7=_[_0xe57b('0x34')]({},_0x2257e7,_0x3189ce[_0xe57b('0x36')]);var _0x355f57={'where':_0x2257e7[_0xe57b('0x33')]};return db[_0xe57b('0x37')][_0xe57b('0xf')](_0x355f57)[_0xe57b('0x11')](function(_0xc470dd){_0x357f5e[_0xe57b('0xf')]=_0xc470dd;if(_0x3189ce[_0xe57b('0x28')][_0xe57b('0x38')]){_0x2257e7[_0xe57b('0x39')]=[{'all':!![]}];}return db[_0xe57b('0x37')][_0xe57b('0x3a')](_0x2257e7);})[_0xe57b('0x11')](function(_0x50c57c){_0x357f5e[_0xe57b('0x3b')]=_0x50c57c;return _0x357f5e;})[_0xe57b('0x11')](respondWithFilteredResult(_0x5b1913,_0x2257e7))['catch'](handleError(_0x5b1913,null));};exports['show']=function(_0x4ac4c7,_0x453866){var _0x3818d0={'raw':![],'where':{'id':_0x4ac4c7['params']['id']}},_0x58c225={};_0x58c225[_0xe57b('0x26')]=_[_0xe57b('0x27')](db['VoiceExtension'][_0xe57b('0x23')]);_0x58c225[_0xe57b('0x28')]=_[_0xe57b('0x27')](_0x4ac4c7['query']);_0x58c225['filters']=_[_0xe57b('0x2a')](_0x58c225[_0xe57b('0x26')],_0x58c225[_0xe57b('0x28')]);_0x3818d0[_0xe57b('0x2b')]=_[_0xe57b('0x2a')](_0x58c225[_0xe57b('0x26')],qs[_0xe57b('0x2c')](_0x4ac4c7[_0xe57b('0x28')][_0xe57b('0x2c')]));_0x3818d0[_0xe57b('0x2b')]=_0x3818d0[_0xe57b('0x2b')]['length']?_0x3818d0[_0xe57b('0x2b')]:_0x58c225['model'];if(_0x4ac4c7['query']['includeAll']){_0x3818d0[_0xe57b('0x39')]=[{'all':!![]}];}_0x3818d0=_[_0xe57b('0x34')]({},_0x3818d0,_0x4ac4c7[_0xe57b('0x36')]);return db[_0xe57b('0x37')]['find'](_0x3818d0)[_0xe57b('0x11')](handleEntityNotFound(_0x453866,null))[_0xe57b('0x11')](respondWithResult(_0x453866,null))['catch'](handleError(_0x453866,null));};exports[_0xe57b('0x1f')]=function(_0x2be698,_0x4e5500){return db[_0xe57b('0x37')][_0xe57b('0x3c')]({'where':{'id':_0x2be698['params']['id']}})[_0xe57b('0x11')](handleEntityNotFound(_0x4e5500,null))[_0xe57b('0x11')](removeEntity(_0x4e5500,null))[_0xe57b('0x3d')](handleError(_0x4e5500,null));};exports[_0xe57b('0x3e')]=function(_0x2f56d4,_0x2ffdd5){if(_0x2f56d4[_0xe57b('0x3f')][_0xe57b('0x1c')]===_0xe57b('0x16')&&!_['startsWith'](_0x2f56d4[_0xe57b('0x3f')][_0xe57b('0x40')],'_')){_0x2f56d4[_0xe57b('0x3f')]['exten']='_'['concat'](_0x2f56d4['body'][_0xe57b('0x40')]);}return db[_0xe57b('0x37')][_0xe57b('0x3e')](_0x2f56d4[_0xe57b('0x3f')],{'raw':![]})['then'](function(_0x51d407){var _0x3cc256=_0x2f56d4[_0xe57b('0x41')]['get']({'plain':!![]});if(!_0x3cc256)throw new Error(_0xe57b('0x42'));if(_0x3cc256[_0xe57b('0x43')]===_0xe57b('0x41')){var _0x5944ae=_0x51d407['get']({'plain':!![]});var _0x20efb2=[{'name':_0xe57b('0x13'),'value':_0xe57b('0x14')},{'name':_0xe57b('0x15'),'value':'outbound'},{'name':'InternalRoutes','value':'internal'}];var _0x5076c5=_[_0xe57b('0x3c')](_0x20efb2,[_0xe57b('0x1b'),_0x5944ae[_0xe57b('0x1c')]])[_0xe57b('0x1d')];return db[_0xe57b('0x44')][_0xe57b('0x3c')]({'where':{'name':_0x5076c5,'userProfileId':_0x3cc256['userProfileId']},'raw':!![]})['then'](function(_0x5a78d5){if(_0x5a78d5&&_0x5a78d5[_0xe57b('0x45')]===0x0){return db['UserProfileResource']['create']({'name':_0x5944ae[_0xe57b('0x1d')],'resourceId':_0x5944ae['id'],'type':_0x5a78d5[_0xe57b('0x1d')],'sectionId':_0x5a78d5['id']},{})[_0xe57b('0x11')](function(){return _0x51d407;});}else{return _0x51d407;}})[_0xe57b('0x3d')](function(_0x222302){logger[_0xe57b('0x20')](_0xe57b('0x46'),_0x222302);throw _0x222302;});}return _0x51d407;})[_0xe57b('0x11')](respondWithResult(_0x2ffdd5,0xc9))[_0xe57b('0x3d')](handleError(_0x2ffdd5,null));};exports[_0xe57b('0x47')]=function(_0x46fa92,_0x1908f0){if(_0x46fa92[_0xe57b('0x3f')]['id']){delete _0x46fa92[_0xe57b('0x3f')]['id'];}return db[_0xe57b('0x37')]['find']({'where':{'id':_0x46fa92['params']['id']}})[_0xe57b('0x11')](handleEntityNotFound(_0x1908f0,null))[_0xe57b('0x11')](function(_0x24b94b){if(_0x24b94b){return db[_0xe57b('0x37')][_0xe57b('0x47')](_['pick'](_0x46fa92[_0xe57b('0x3f')],[_0xe57b('0x40'),_0xe57b('0x48'),_0xe57b('0x49'),'recordingFormat','cutdigits','mandatoryDisposition',_0xe57b('0x4a')]),{'where':{'context':_0x24b94b['context'],'exten':_0x24b94b[_0xe57b('0x40')]},'individualHooks':!![]})[_0xe57b('0x11')](function(_0x52cec8){return _0x52cec8;});}return null;})[_0xe57b('0x11')](respondWithStatusCode(_0x1908f0,null))['catch'](handleError(_0x1908f0,null));};exports[_0xe57b('0x4b')]=function(_0x58a719,_0x41b3d0){var _0x47aa5b=_0x58a719['params']['id'];var _0x1c8b4a=_0x58a719[_0xe57b('0x3f')];var _0xa97b90=0xc8;var _0x370441=null;return db[_0xe57b('0x4c')][_0xe57b('0x4d')]({'isolationLevel':db[_0xe57b('0x4c')][_0xe57b('0x4e')][_0xe57b('0x4f')][_0xe57b('0x50')]},function(_0x3d2063){return db[_0xe57b('0x37')]['findOne']({'where':{'id':_0x47aa5b},'transaction':_0x3d2063})['then'](function(_0x25de37){if(_0x25de37){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x47aa5b},'transaction':_0x3d2063})[_0xe57b('0x11')](function(){var _0x433fc2=_[_0xe57b('0x19')](_0x1c8b4a,function(_0x3b7a4c){_0x3b7a4c[_0xe57b('0x51')]=_0x47aa5b;_0x3b7a4c[_0xe57b('0x52')]=!![];return _0x3b7a4c;});return _0x25de37['createRouting'](_0x433fc2);})['then'](function(_0x5abb4e){return db[_0xe57b('0x37')][_0xe57b('0x53')](_0x5abb4e,{'transaction':_0x3d2063});});}else{_0xa97b90=0x194;_0x370441=[];}});})[_0xe57b('0x11')](function(){if(_0xa97b90!==0x194){return db['VoiceExtension'][_0xe57b('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x47aa5b},'order':_0xe57b('0x55')})[_0xe57b('0x11')](function(_0x293c5a){_0x370441=_0x293c5a;});}})[_0xe57b('0x3d')](function(_0x11e12b){_0xa97b90=0x1f4;logger['error'](_0x11e12b[_0xe57b('0x56')]);if(_0x11e12b[_0xe57b('0x1d')]){delete _0x11e12b[_0xe57b('0x1d')];}_0x370441=_0x11e12b;})['finally'](function(){if(_0x370441===null){_0x41b3d0[_0xe57b('0x8')](_0xa97b90);}else{if(_0xa97b90===0x1f4){_0x41b3d0[_0xe57b('0x9')](_0xa97b90)[_0xe57b('0x21')](_0x370441);}else{_0x41b3d0[_0xe57b('0x9')](_0xa97b90)[_0xe57b('0xb')](_0x370441);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index cb15e11..d12398c 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 _0x5a47=['hook','exports','events','VoiceExtension','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x3ace0e,_0x2b70fd){var _0x4b91c6=function(_0x4eac32){while(--_0x4eac32){_0x3ace0e['push'](_0x3ace0e['shift']());}};_0x4b91c6(++_0x2b70fd);}(_0x5a47,0x1df));var _0x75a4=function(_0x3b855c,_0x36b8fe){_0x3b855c=_0x3b855c-0x0;var _0x364fd5=_0x5a47[_0x3b855c];return _0x364fd5;};'use strict';var EventEmitter=require(_0x75a4('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x75a4('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x75a4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x75a4('0x3'),'afterDestroy':_0x75a4('0x4')};function emitEvent(_0x231bd3){return function(_0x570abe,_0x5f4c9e,_0xf5733c){VoiceExtensionEvents['emit'](_0x231bd3+':'+_0x570abe['id'],_0x570abe);VoiceExtensionEvents[_0x75a4('0x5')](_0x231bd3,_0x570abe);_0xf5733c(null);};}for(var e in events){if(events[_0x75a4('0x6')](e)){var event=events[e];VoiceExtension[_0x75a4('0x7')](e,emitEvent(event));}}module[_0x75a4('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xff4d=['hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x2efd43,_0x4c82c5){var _0x224752=function(_0x3a4b03){while(--_0x3a4b03){_0x2efd43['push'](_0x2efd43['shift']());}};_0x224752(++_0x4c82c5);}(_0xff4d,0x110));var _0xdff4=function(_0x392ec2,_0x4e9f85){_0x392ec2=_0x392ec2-0x0;var _0x16e517=_0xff4d[_0x392ec2];return _0x16e517;};'use strict';var EventEmitter=require(_0xdff4('0x0'));var VoiceExtension=require(_0xdff4('0x1'))['db'][_0xdff4('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xdff4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdff4('0x4'),'afterDestroy':_0xdff4('0x5')};function emitEvent(_0x3a9389){return function(_0x5f4a18,_0x434678,_0x217df9){VoiceExtensionEvents[_0xdff4('0x6')](_0x3a9389+':'+_0x5f4a18['id'],_0x5f4a18);VoiceExtensionEvents[_0xdff4('0x6')](_0x3a9389,_0x5f4a18);_0x217df9(null);};}for(var e in events){if(events[_0xdff4('0x7')](e)){var event=events[e];VoiceExtension[_0xdff4('0x8')](e,emitEvent(event));}}module[_0xdff4('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 09c2314..f440bc7 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 _0x41fe=['wav','trunk','options','split','length','name','param','phone','prefix','SIP','none','indexOf','U(xcally-mixmonitor-context)','replace','join','Interval','interval','IntervalId','then','*,*,*,*','intervals','map','tag','toLowerCase','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime','priority','last','concat','catch','VoiceExtension','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','NoOp','CDR(routeAlias)=','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','alias','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT='];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x41fe,0xd1));var _0xe41f=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0x41fe[_0x46f1a6];return _0x38429a;};'use strict';var _=require(_0xe41f('0x0'));var attributes=require(_0xe41f('0x1'));module[_0xe41f('0x2')]=function(_0x2c527f){var _0x850827=_0x2c527f[_0xe41f('0x3')];function _0x3afc14(_0x2fad9a){var _0x2e580b=0x2;var _0x1c9625=[{'type':_0x2fad9a[_0xe41f('0x4')],'app':_0xe41f('0x5'),'appdata':_0xe41f('0x6')+_0x2fad9a[_0xe41f('0x4')],'context':_0x2fad9a[_0xe41f('0x7')],'exten':_0x2fad9a[_0xe41f('0x8')],'priority':_0x2e580b++,'VoiceExtensionId':_0x2fad9a['id']},{'type':_0x2fad9a[_0xe41f('0x4')],'app':_0x2fad9a['alias']?_0xe41f('0x5'):_0xe41f('0x9'),'appdata':_0x2fad9a['alias']?_0xe41f('0xa')+_0x2fad9a['alias']:'No\x20alias\x20set','context':_0x2fad9a['context'],'exten':_0x2fad9a[_0xe41f('0x8')],'priority':_0x2e580b++,'VoiceExtensionId':_0x2fad9a['id']}];if(_0x2fad9a['type']==='inbound'){_0x1c9625['push']({'type':_0xe41f('0xb'),'app':_0xe41f('0x5'),'appdata':_0xe41f('0xc')+_0x2fad9a['id'],'context':_0x2fad9a[_0xe41f('0x7')],'exten':_0x2fad9a[_0xe41f('0x8')],'priority':_0x2e580b++,'VoiceExtensionId':_0x2fad9a['id']});}_0x1c9625[_0xe41f('0xd')]({'type':_0x2fad9a[_0xe41f('0x4')],'app':_0xe41f('0x5'),'appdata':_0xe41f('0xe'),'context':_0x2fad9a[_0xe41f('0x7')],'exten':_0x2fad9a['exten'],'priority':_0x2e580b++,'VoiceExtensionId':_0x2fad9a['id']},{'type':_0x2fad9a[_0xe41f('0x4')],'app':_0xe41f('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2fad9a[_0xe41f('0x7')],'exten':_0x2fad9a[_0xe41f('0x8')],'priority':_0x2e580b++,'VoiceExtensionId':_0x2fad9a['id']},{'type':_0x2fad9a[_0xe41f('0x4')],'app':_0xe41f('0x5'),'appdata':_0xe41f('0xf'),'context':_0x2fad9a[_0xe41f('0x7')],'exten':_0x2fad9a[_0xe41f('0x8')],'priority':_0x2e580b++,'VoiceExtensionId':_0x2fad9a['id']});return _0x1c9625;}function _0x54635b(_0x4a21fd){var _0x2b5688=0x2;var _0x5e59e2=[{'type':'outbound','app':_0xe41f('0x5'),'appdata':_0xe41f('0x10'),'context':_0x4a21fd[_0xe41f('0x7')],'exten':_0x4a21fd[_0xe41f('0x8')],'priority':_0x2b5688++,'VoiceExtensionId':_0x4a21fd['id']},{'type':_0xe41f('0x11'),'app':_0x4a21fd['alias']?_0xe41f('0x5'):'NoOp','appdata':_0x4a21fd[_0xe41f('0x12')]?_0xe41f('0xa')+_0x4a21fd['alias']:_0xe41f('0x13'),'context':_0x4a21fd[_0xe41f('0x7')],'exten':_0x4a21fd[_0xe41f('0x8')],'priority':_0x2b5688++,'VoiceExtensionId':_0x4a21fd['id']},{'type':'outbound','app':_0xe41f('0x5'),'appdata':_0xe41f('0x14')+(_0x4a21fd[_0xe41f('0x15')]?_0xe41f('0x16')+_0x4a21fd[_0xe41f('0x15')]+'}':_0xe41f('0x17')),'context':_0x4a21fd[_0xe41f('0x7')],'exten':_0x4a21fd['exten'],'priority':_0x2b5688++,'VoiceExtensionId':_0x4a21fd['id']},{'type':_0xe41f('0x11'),'app':'Set','appdata':'CDR(routeid)='+_0x4a21fd['id'],'context':_0x4a21fd[_0xe41f('0x7')],'exten':_0x4a21fd[_0xe41f('0x8')],'priority':_0x2b5688++,'VoiceExtensionId':_0x4a21fd['id']},{'type':_0xe41f('0x11'),'app':'ExecIf','appdata':_0xe41f('0x18')+(_0x2b5688+0x2)+_0xe41f('0x19')+(_0x2b5688+0x1)+')','context':_0x4a21fd[_0xe41f('0x7')],'exten':_0x4a21fd['exten'],'priority':_0x2b5688++,'VoiceExtensionId':_0x4a21fd['id']},{'type':_0xe41f('0x11'),'app':'Set','appdata':_0x4a21fd[_0xe41f('0x15')]?_0xe41f('0x1a')+_0x4a21fd['cutdigits']+'}':_0xe41f('0x1b'),'context':_0x4a21fd[_0xe41f('0x7')],'exten':_0x4a21fd[_0xe41f('0x8')],'priority':_0x2b5688++,'VoiceExtensionId':_0x4a21fd['id']},{'type':_0xe41f('0x11'),'app':_0xe41f('0x5'),'appdata':_0xe41f('0xe'),'context':_0x4a21fd[_0xe41f('0x7')],'exten':_0x4a21fd[_0xe41f('0x8')],'priority':_0x2b5688++,'VoiceExtensionId':_0x4a21fd['id']},{'type':_0xe41f('0x11'),'app':_0xe41f('0x5'),'appdata':_0xe41f('0x1c'),'context':_0x4a21fd[_0xe41f('0x7')],'exten':_0x4a21fd[_0xe41f('0x8')],'priority':_0x2b5688++,'VoiceExtensionId':_0x4a21fd['id']},{'type':_0xe41f('0x11'),'app':_0xe41f('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4a21fd[_0xe41f('0x7')],'exten':_0x4a21fd[_0xe41f('0x8')],'priority':_0x2b5688++,'VoiceExtensionId':_0x4a21fd['id']},{'type':_0xe41f('0x11'),'app':_0xe41f('0x5'),'appdata':_0xe41f('0x1d')+_0x4a21fd['id'],'context':_0x4a21fd['context'],'exten':_0x4a21fd[_0xe41f('0x8')],'priority':_0x2b5688++,'VoiceExtensionId':_0x4a21fd['id']}];if(_0x4a21fd[_0xe41f('0x1e')](_0xe41f('0x1f'))&&_0x4a21fd[_0xe41f('0x1f')]!=='none'){_0x5e59e2['push']({'type':'outbound','app':_0xe41f('0x5'),'appdata':_0xe41f('0x20'),'context':_0x4a21fd[_0xe41f('0x7')],'exten':_0x4a21fd['exten'],'priority':_0x2b5688++,'VoiceExtensionId':_0x4a21fd['id']},{'type':_0xe41f('0x11'),'app':_0xe41f('0x5'),'appdata':_0xe41f('0x21')+_0x4a21fd[_0xe41f('0x1f')]||_0xe41f('0x22'),'context':_0x4a21fd[_0xe41f('0x7')],'exten':_0x4a21fd[_0xe41f('0x8')],'priority':_0x2b5688++,'VoiceExtensionId':_0x4a21fd['id']});}return _0x5e59e2;}function _0x2bc67a(_0x1c8ef2,_0x23b69a){var _0x35b724=[{'name':_0xe41f('0x23'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xe41f('0x24'),'param':0x2},{'name':'url','param':0x3}];var _0x137c7a={};var _0x57caae=_0x23b69a[_0xe41f('0x25')](',');var _0x498acc=[];for(var _0x5830ff=0x0;_0x5830ff<_0x35b724[_0xe41f('0x26')];_0x5830ff++){switch(_0x35b724[_0x5830ff][_0xe41f('0x27')]){case _0xe41f('0x23'):_0x137c7a[_0xe41f('0x23')]=_0x57caae[_0x35b724[_0x5830ff][_0xe41f('0x28')]]['split']('/')[0x1];_0x137c7a[_0xe41f('0x29')]=_0x57caae[_0x35b724[_0x5830ff][_0xe41f('0x28')]][_0xe41f('0x25')]('/')[0x2];_0x137c7a[_0xe41f('0x2a')]=_0x137c7a[_0xe41f('0x29')]?_0x137c7a[_0xe41f('0x29')][_0xe41f('0x25')]('$')[0x0]:undefined;_0x137c7a['phone']=_0x1c8ef2[_0xe41f('0x15')]?(_0x137c7a[_0xe41f('0x2a')]||'')+_0xe41f('0x16')+_0x1c8ef2[_0xe41f('0x15')]+'}':(_0x137c7a[_0xe41f('0x2a')]||'')+_0xe41f('0x17');_0x498acc[_0x35b724[_0x5830ff][_0xe41f('0x28')]]=[_0xe41f('0x2b'),_0x137c7a[_0xe41f('0x23')],_0x137c7a['phone']]['join']('/');break;case _0xe41f('0x24'):_0x137c7a['options']=_0x57caae[_0x35b724[_0x5830ff][_0xe41f('0x28')]];if(_0x1c8ef2[_0xe41f('0x1f')]!==_0xe41f('0x2c')){if(_0x137c7a['options'][_0xe41f('0x2d')](_0xe41f('0x2e'))<0x0){_0x137c7a['options']+='U(xcally-mixmonitor-context)';}}else{_0x137c7a[_0xe41f('0x24')]=_0x137c7a[_0xe41f('0x24')][_0xe41f('0x2f')](_0xe41f('0x2e'),'');}_0x498acc[_0x35b724[_0x5830ff][_0xe41f('0x28')]]=_0x137c7a[_0xe41f('0x24')];break;default:_0x498acc[_0x35b724[_0x5830ff][_0xe41f('0x28')]]=_0x57caae[_0x35b724[_0x5830ff]['param']];}}return _0x498acc[_0xe41f('0x30')](',');}function _0x1c5444(_0x54b95d,_0x2bb953,_0x4a0d40){return new Promise(function(_0x20d101,_0x374e9d){var _0x1b8332=[];if(_['isEmpty'](_0x2bb953))return _0x20d101(_0x1b8332);_0x850827[_0xe41f('0x31')]['findAll']({'attributes':['id',_0xe41f('0x32'),_0xe41f('0x33')],'raw':!![]})[_0xe41f('0x34')](function(_0x16fd5c){for(var _0x1c075d=0x0,_0x40d343=0x0;_0x1c075d<_0x2bb953[_0xe41f('0x26')];_0x1c075d++,_0x40d343=0x0){var _0x3adafb=_0x2bb953[_0x1c075d];var _0x4f7350=[];var _0x27b961=[];delete _0x3adafb['id'];if(_0x3adafb['interval']!==_0xe41f('0x35')){_0x3adafb['intervals']=[_0x3adafb[_0xe41f('0x32')]];}else{_0x3adafb[_0xe41f('0x36')]=_0x3adafb[_0xe41f('0x33')]?_[_0xe41f('0x37')](_['filter'](_0x16fd5c,{'IntervalId':_0x3adafb[_0xe41f('0x33')]}),'interval'):[];}_0x3adafb[_0xe41f('0x7')]=_0x54b95d[_0xe41f('0x7')];_0x3adafb[_0xe41f('0x8')]=_0x54b95d[_0xe41f('0x8')];if(_0x3adafb['type'])_0x3adafb[_0xe41f('0x4')]=_0x3adafb['type']['toLowerCase']();if(_0x54b95d['type']===_0xe41f('0x11')){if(_0x3adafb[_0xe41f('0x1e')]('tag')&&_0x3adafb[_0xe41f('0x38')]&&_0x3adafb[_0xe41f('0x38')]!=='--'){_0x4f7350[_0xe41f('0xd')]({'type':_0x3adafb[_0xe41f('0x4')][_0xe41f('0x39')](),'app':_0xe41f('0x5'),'appdata':_0xe41f('0x3a')+_0x3adafb[_0xe41f('0x38')],'context':_0x54b95d[_0xe41f('0x7')],'exten':_0x54b95d[_0xe41f('0x8')],'priority':_0x3adafb['intervals'][_0xe41f('0x26')]+_0x4a0d40+_0x40d343++,'VoiceExtensionId':_0x54b95d['id']});}_0x4f7350[_0xe41f('0xd')]({'type':_0x3adafb[_0xe41f('0x4')]['toLowerCase'](),'app':_0xe41f('0x3b'),'appdata':_0xe41f('0x3c')+(_0x3adafb[_0xe41f('0x3d')]?_0xe41f('0x3e')+_0x3adafb[_0xe41f('0x3d')]+')':'NoOp(No\x20number\x20available)'),'context':_0x54b95d[_0xe41f('0x7')],'exten':_0x54b95d[_0xe41f('0x8')],'priority':_0x3adafb['intervals']['length']+_0x4a0d40+_0x40d343++,'VoiceExtensionId':_0x54b95d['id']});}else{if(_0x3adafb['hasOwnProperty'](_0xe41f('0x3f'))){if([_0xe41f('0x40'),_0xe41f('0x41')][_0xe41f('0x42')](_0x3adafb[_0xe41f('0x43')][_0xe41f('0x39')]())&&_0x3adafb[_0xe41f('0x44')]!==_0xe41f('0x45')){if(_0x3adafb['answer']){_0x4f7350[_0xe41f('0xd')]({'type':_0x3adafb[_0xe41f('0x4')]['toLowerCase'](),'app':_0xe41f('0x3b'),'appdata':_0xe41f('0x46'),'context':_0x54b95d['context'],'exten':_0x54b95d[_0xe41f('0x8')],'priority':_0x3adafb[_0xe41f('0x36')]['length']+_0x4a0d40+_0x40d343++,'VoiceExtensionId':_0x54b95d['id']});_0x4f7350[_0xe41f('0xd')]({'type':_0x3adafb[_0xe41f('0x4')][_0xe41f('0x39')](),'app':_0xe41f('0x5'),'appdata':_0xe41f('0x47'),'context':_0x54b95d[_0xe41f('0x7')],'exten':_0x54b95d['exten'],'priority':_0x3adafb[_0xe41f('0x36')][_0xe41f('0x26')]+_0x4a0d40+_0x40d343++,'VoiceExtensionId':_0x54b95d['id']});}else{_0x4f7350['push']({'type':_0x3adafb[_0xe41f('0x4')][_0xe41f('0x39')](),'app':_0xe41f('0x3b'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x54b95d[_0xe41f('0x7')],'exten':_0x54b95d[_0xe41f('0x8')],'priority':_0x3adafb[_0xe41f('0x36')][_0xe41f('0x26')]+_0x4a0d40+_0x40d343++,'VoiceExtensionId':_0x54b95d['id']});_0x4f7350['push']({'type':_0x3adafb[_0xe41f('0x4')][_0xe41f('0x39')](),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x54b95d[_0xe41f('0x7')],'exten':_0x54b95d[_0xe41f('0x8')],'priority':_0x3adafb['intervals'][_0xe41f('0x26')]+_0x4a0d40+_0x40d343++,'VoiceExtensionId':_0x54b95d['id']});}}}}for(var _0x2933fa=0x0;_0x2933fa<_0x3adafb[_0xe41f('0x36')]['length'];_0x2933fa++){var _0x293583=_0x4a0d40+_0x3adafb['intervals'][_0xe41f('0x26')];var _0x3e7a5c=_0x2933fa===_0x3adafb[_0xe41f('0x36')][_0xe41f('0x26')]-0x1?_0x4a0d40+_0x4f7350[_0xe41f('0x26')]+_0x27b961[_0xe41f('0x26')]+0x2:_0x4a0d40+_0x2933fa+0x1;_0x4f7350[_0xe41f('0x48')](_0x2933fa,0x0,{'type':_0x54b95d['type'],'app':_0xe41f('0x49'),'appdata':_0x3adafb[_0xe41f('0x36')][_0x2933fa]+'?'+_0x54b95d[_0xe41f('0x7')]+',${EXTEN},'+_0x293583+':'+_0x54b95d['context']+',${EXTEN},'+_0x3e7a5c,'exten':_0x54b95d[_0xe41f('0x8')],'context':_0x54b95d['context'],'priority':_0x4a0d40+_0x2933fa,'VoiceExtensionId':_0x54b95d['id']});}if(_0x3adafb[_0xe41f('0x44')]==='outboundDial')_0x3adafb['appdata']=_0x2bc67a(_0x54b95d,_0x3adafb['appdata']);_0x3adafb[_0xe41f('0x4a')]=_0x4f7350[_0xe41f('0x26')]?_[_0xe41f('0x4b')](_0x4f7350)[_0xe41f('0x4a')]+0x1:_0x4a0d40;_0x1b8332=_[_0xe41f('0x4c')](_0x1b8332,_0x4f7350,[_0x3adafb],_0x27b961);_0x4a0d40=_['last'](_0x1b8332)[_0xe41f('0x4a')]+0x1;}return _0x20d101(_0x1b8332);})[_0xe41f('0x4d')](function(_0x5abf91){_0x374e9d(_0x5abf91);});});}return _0x2c527f['define'](_0xe41f('0x4e'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4738b8){var _0x199e91=this[_0xe41f('0x4f')]({'plain':!![]});var _0x4a9ec1=_0x199e91[_0xe41f('0x4')]==='outbound'?_0x54635b(_0x199e91):_0x3afc14(_0x199e91);return _0x1c5444(_0x199e91,_0x4738b8,_['last'](_0x4a9ec1)['priority']+0x1)['then'](function(_0x349287){var _0x3a333c=_[_0xe41f('0x4c')](_0x4a9ec1,_0x349287);_0x3a333c[_0xe41f('0xd')]({'type':_0x199e91[_0xe41f('0x4')],'app':_0xe41f('0x50'),'exten':_0x199e91[_0xe41f('0x8')],'context':_0x199e91[_0xe41f('0x7')],'priority':_[_0xe41f('0x4b')](_0x3a333c)['priority']+0x1,'VoiceExtensionId':_0x199e91['id']});return _0x3a333c;});}}});}; \ No newline at end of file +var _0x56da=['*,*,*,*','intervals','interval','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','last','concat','catch','define','VoiceExtension','voice_extensions','get','then','Hangup','priority','lodash','exports','models','type','Set','CDR(type)=','context','exten','NoOp','alias','CDR(routeAlias)=','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','length','name','param','prefix','phone','SIP','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','IntervalId'];(function(_0x224ef7,_0x2d4a1c){var _0x1e52c5=function(_0x3df78c){while(--_0x3df78c){_0x224ef7['push'](_0x224ef7['shift']());}};_0x1e52c5(++_0x2d4a1c);}(_0x56da,0x119));var _0xa56d=function(_0x9df3d8,_0x4074e3){_0x9df3d8=_0x9df3d8-0x0;var _0x366da1=_0x56da[_0x9df3d8];return _0x366da1;};'use strict';var _=require(_0xa56d('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xa56d('0x1')]=function(_0xcbe8f){var _0x5b212f=_0xcbe8f[_0xa56d('0x2')];function _0x1271f4(_0x3d209d){var _0x20d100=0x2;var _0x7acff=[{'type':_0x3d209d[_0xa56d('0x3')],'app':_0xa56d('0x4'),'appdata':_0xa56d('0x5')+_0x3d209d[_0xa56d('0x3')],'context':_0x3d209d[_0xa56d('0x6')],'exten':_0x3d209d[_0xa56d('0x7')],'priority':_0x20d100++,'VoiceExtensionId':_0x3d209d['id']},{'type':_0x3d209d['type'],'app':_0x3d209d['alias']?_0xa56d('0x4'):_0xa56d('0x8'),'appdata':_0x3d209d[_0xa56d('0x9')]?_0xa56d('0xa')+_0x3d209d[_0xa56d('0x9')]:'No\x20alias\x20set','context':_0x3d209d['context'],'exten':_0x3d209d[_0xa56d('0x7')],'priority':_0x20d100++,'VoiceExtensionId':_0x3d209d['id']}];if(_0x3d209d[_0xa56d('0x3')]===_0xa56d('0xb')){_0x7acff['push']({'type':_0xa56d('0xb'),'app':_0xa56d('0x4'),'appdata':_0xa56d('0xc')+_0x3d209d['id'],'context':_0x3d209d['context'],'exten':_0x3d209d[_0xa56d('0x7')],'priority':_0x20d100++,'VoiceExtensionId':_0x3d209d['id']});}_0x7acff[_0xa56d('0xd')]({'type':_0x3d209d[_0xa56d('0x3')],'app':_0xa56d('0x4'),'appdata':_0xa56d('0xe'),'context':_0x3d209d[_0xa56d('0x6')],'exten':_0x3d209d[_0xa56d('0x7')],'priority':_0x20d100++,'VoiceExtensionId':_0x3d209d['id']},{'type':_0x3d209d[_0xa56d('0x3')],'app':'Set','appdata':_0xa56d('0xf'),'context':_0x3d209d[_0xa56d('0x6')],'exten':_0x3d209d['exten'],'priority':_0x20d100++,'VoiceExtensionId':_0x3d209d['id']},{'type':_0x3d209d['type'],'app':_0xa56d('0x4'),'appdata':_0xa56d('0x10'),'context':_0x3d209d[_0xa56d('0x6')],'exten':_0x3d209d[_0xa56d('0x7')],'priority':_0x20d100++,'VoiceExtensionId':_0x3d209d['id']});return _0x7acff;}function _0x23c01f(_0x5883ae){var _0x24fd18=0x2;var _0x4e3e18=[{'type':_0xa56d('0x11'),'app':_0xa56d('0x4'),'appdata':_0xa56d('0x12'),'context':_0x5883ae[_0xa56d('0x6')],'exten':_0x5883ae[_0xa56d('0x7')],'priority':_0x24fd18++,'VoiceExtensionId':_0x5883ae['id']},{'type':_0xa56d('0x11'),'app':_0x5883ae['alias']?_0xa56d('0x4'):'NoOp','appdata':_0x5883ae[_0xa56d('0x9')]?_0xa56d('0xa')+_0x5883ae[_0xa56d('0x9')]:_0xa56d('0x13'),'context':_0x5883ae[_0xa56d('0x6')],'exten':_0x5883ae[_0xa56d('0x7')],'priority':_0x24fd18++,'VoiceExtensionId':_0x5883ae['id']},{'type':_0xa56d('0x11'),'app':_0xa56d('0x4'),'appdata':_0xa56d('0x14')+(_0x5883ae['cutdigits']?_0xa56d('0x15')+_0x5883ae[_0xa56d('0x16')]+'}':_0xa56d('0x17')),'context':_0x5883ae['context'],'exten':_0x5883ae['exten'],'priority':_0x24fd18++,'VoiceExtensionId':_0x5883ae['id']},{'type':_0xa56d('0x11'),'app':'Set','appdata':'CDR(routeid)='+_0x5883ae['id'],'context':_0x5883ae[_0xa56d('0x6')],'exten':_0x5883ae[_0xa56d('0x7')],'priority':_0x24fd18++,'VoiceExtensionId':_0x5883ae['id']},{'type':_0xa56d('0x11'),'app':_0xa56d('0x18'),'appdata':_0xa56d('0x19')+(_0x24fd18+0x2)+_0xa56d('0x1a')+(_0x24fd18+0x1)+')','context':_0x5883ae[_0xa56d('0x6')],'exten':_0x5883ae[_0xa56d('0x7')],'priority':_0x24fd18++,'VoiceExtensionId':_0x5883ae['id']},{'type':_0xa56d('0x11'),'app':'Set','appdata':_0x5883ae[_0xa56d('0x16')]?_0xa56d('0x1b')+_0x5883ae[_0xa56d('0x16')]+'}':_0xa56d('0x1c'),'context':_0x5883ae[_0xa56d('0x6')],'exten':_0x5883ae[_0xa56d('0x7')],'priority':_0x24fd18++,'VoiceExtensionId':_0x5883ae['id']},{'type':_0xa56d('0x11'),'app':_0xa56d('0x4'),'appdata':_0xa56d('0xe'),'context':_0x5883ae[_0xa56d('0x6')],'exten':_0x5883ae[_0xa56d('0x7')],'priority':_0x24fd18++,'VoiceExtensionId':_0x5883ae['id']},{'type':'outbound','app':_0xa56d('0x4'),'appdata':_0xa56d('0xf'),'context':_0x5883ae[_0xa56d('0x6')],'exten':_0x5883ae['exten'],'priority':_0x24fd18++,'VoiceExtensionId':_0x5883ae['id']},{'type':_0xa56d('0x11'),'app':_0xa56d('0x4'),'appdata':_0xa56d('0x10'),'context':_0x5883ae[_0xa56d('0x6')],'exten':_0x5883ae[_0xa56d('0x7')],'priority':_0x24fd18++,'VoiceExtensionId':_0x5883ae['id']},{'type':_0xa56d('0x11'),'app':_0xa56d('0x4'),'appdata':_0xa56d('0x1d')+_0x5883ae['id'],'context':_0x5883ae[_0xa56d('0x6')],'exten':_0x5883ae[_0xa56d('0x7')],'priority':_0x24fd18++,'VoiceExtensionId':_0x5883ae['id']}];if(_0x5883ae['hasOwnProperty'](_0xa56d('0x1e'))&&_0x5883ae[_0xa56d('0x1e')]!=='none'){_0x4e3e18[_0xa56d('0xd')]({'type':_0xa56d('0x11'),'app':'Set','appdata':_0xa56d('0x1f'),'context':_0x5883ae[_0xa56d('0x6')],'exten':_0x5883ae[_0xa56d('0x7')],'priority':_0x24fd18++,'VoiceExtensionId':_0x5883ae['id']},{'type':_0xa56d('0x11'),'app':_0xa56d('0x4'),'appdata':_0xa56d('0x20')+_0x5883ae[_0xa56d('0x1e')]||_0xa56d('0x21'),'context':_0x5883ae['context'],'exten':_0x5883ae['exten'],'priority':_0x24fd18++,'VoiceExtensionId':_0x5883ae['id']});}return _0x4e3e18;}function _0x11edf6(_0xf9b4ce,_0x5e6b8b){var _0x5e5082=[{'name':_0xa56d('0x22'),'param':0x0},{'name':_0xa56d('0x23'),'param':0x1},{'name':_0xa56d('0x24'),'param':0x2},{'name':'url','param':0x3}];var _0x31c7e4={};var _0x319e5a=_0x5e6b8b[_0xa56d('0x25')](',');var _0x24f6e4=[];for(var _0x5eb2a5=0x0;_0x5eb2a5<_0x5e5082[_0xa56d('0x26')];_0x5eb2a5++){switch(_0x5e5082[_0x5eb2a5][_0xa56d('0x27')]){case'trunk':_0x31c7e4[_0xa56d('0x22')]=_0x319e5a[_0x5e5082[_0x5eb2a5]['param']]['split']('/')[0x1];_0x31c7e4['phone']=_0x319e5a[_0x5e5082[_0x5eb2a5][_0xa56d('0x28')]]['split']('/')[0x2];_0x31c7e4[_0xa56d('0x29')]=_0x31c7e4[_0xa56d('0x2a')]?_0x31c7e4[_0xa56d('0x2a')][_0xa56d('0x25')]('$')[0x0]:undefined;_0x31c7e4[_0xa56d('0x2a')]=_0xf9b4ce[_0xa56d('0x16')]?(_0x31c7e4[_0xa56d('0x29')]||'')+'${EXTEN:'+_0xf9b4ce[_0xa56d('0x16')]+'}':(_0x31c7e4[_0xa56d('0x29')]||'')+_0xa56d('0x17');_0x24f6e4[_0x5e5082[_0x5eb2a5][_0xa56d('0x28')]]=[_0xa56d('0x2b'),_0x31c7e4['trunk'],_0x31c7e4[_0xa56d('0x2a')]]['join']('/');break;case _0xa56d('0x24'):_0x31c7e4[_0xa56d('0x24')]=_0x319e5a[_0x5e5082[_0x5eb2a5][_0xa56d('0x28')]];if(_0xf9b4ce[_0xa56d('0x1e')]!=='none'){if(_0x31c7e4[_0xa56d('0x24')][_0xa56d('0x2c')](_0xa56d('0x2d'))<0x0){_0x31c7e4[_0xa56d('0x24')]+=_0xa56d('0x2d');}}else{_0x31c7e4[_0xa56d('0x24')]=_0x31c7e4[_0xa56d('0x24')][_0xa56d('0x2e')](_0xa56d('0x2d'),'');}_0x24f6e4[_0x5e5082[_0x5eb2a5][_0xa56d('0x28')]]=_0x31c7e4['options'];break;default:_0x24f6e4[_0x5e5082[_0x5eb2a5][_0xa56d('0x28')]]=_0x319e5a[_0x5e5082[_0x5eb2a5][_0xa56d('0x28')]];}}return _0x24f6e4['join'](',');}function _0x176a65(_0x25ab60,_0x4ae08b,_0x332e19){return new Promise(function(_0xfa0ce1,_0x5d9bb3){var _0x1d6776=[];if(_[_0xa56d('0x2f')](_0x4ae08b))return _0xfa0ce1(_0x1d6776);_0x5b212f[_0xa56d('0x30')][_0xa56d('0x31')]({'attributes':['id','interval',_0xa56d('0x32')],'raw':!![]})['then'](function(_0x1a9d59){for(var _0x425a28=0x0,_0x259a2d=0x0;_0x425a28<_0x4ae08b[_0xa56d('0x26')];_0x425a28++,_0x259a2d=0x0){var _0x19a563=_0x4ae08b[_0x425a28];var _0x12a40b=[];var _0x913b6f=[];delete _0x19a563['id'];if(_0x19a563['interval']!==_0xa56d('0x33')){_0x19a563[_0xa56d('0x34')]=[_0x19a563[_0xa56d('0x35')]];}else{_0x19a563['intervals']=_0x19a563[_0xa56d('0x32')]?_['map'](_['filter'](_0x1a9d59,{'IntervalId':_0x19a563[_0xa56d('0x32')]}),_0xa56d('0x35')):[];}_0x19a563['context']=_0x25ab60[_0xa56d('0x6')];_0x19a563[_0xa56d('0x7')]=_0x25ab60['exten'];if(_0x19a563['type'])_0x19a563[_0xa56d('0x3')]=_0x19a563[_0xa56d('0x3')][_0xa56d('0x36')]();if(_0x25ab60[_0xa56d('0x3')]===_0xa56d('0x11')){if(_0x19a563[_0xa56d('0x37')](_0xa56d('0x38'))&&_0x19a563[_0xa56d('0x38')]&&_0x19a563['tag']!=='--'){_0x12a40b[_0xa56d('0xd')]({'type':_0x19a563[_0xa56d('0x3')][_0xa56d('0x36')](),'app':'Set','appdata':_0xa56d('0x39')+_0x19a563[_0xa56d('0x38')],'context':_0x25ab60[_0xa56d('0x6')],'exten':_0x25ab60[_0xa56d('0x7')],'priority':_0x19a563[_0xa56d('0x34')][_0xa56d('0x26')]+_0x332e19+_0x259a2d++,'VoiceExtensionId':_0x25ab60['id']});}_0x12a40b[_0xa56d('0xd')]({'type':_0x19a563[_0xa56d('0x3')]['toLowerCase'](),'app':_0xa56d('0x18'),'appdata':_0xa56d('0x3a')+(_0x19a563[_0xa56d('0x3b')]?_0xa56d('0x3c')+_0x19a563[_0xa56d('0x3b')]+')':_0xa56d('0x3d')),'context':_0x25ab60['context'],'exten':_0x25ab60[_0xa56d('0x7')],'priority':_0x19a563[_0xa56d('0x34')][_0xa56d('0x26')]+_0x332e19+_0x259a2d++,'VoiceExtensionId':_0x25ab60['id']});}else{if(_0x19a563[_0xa56d('0x37')](_0xa56d('0x3e'))){if([_0xa56d('0x3f'),_0xa56d('0x40')]['includes'](_0x19a563[_0xa56d('0x41')][_0xa56d('0x36')]())&&_0x19a563[_0xa56d('0x42')]!==_0xa56d('0x43')){if(_0x19a563[_0xa56d('0x3e')]){_0x12a40b[_0xa56d('0xd')]({'type':_0x19a563['type'][_0xa56d('0x36')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x25ab60[_0xa56d('0x6')],'exten':_0x25ab60['exten'],'priority':_0x19a563[_0xa56d('0x34')][_0xa56d('0x26')]+_0x332e19+_0x259a2d++,'VoiceExtensionId':_0x25ab60['id']});_0x12a40b[_0xa56d('0xd')]({'type':_0x19a563[_0xa56d('0x3')][_0xa56d('0x36')](),'app':_0xa56d('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x25ab60[_0xa56d('0x6')],'exten':_0x25ab60[_0xa56d('0x7')],'priority':_0x19a563[_0xa56d('0x34')][_0xa56d('0x26')]+_0x332e19+_0x259a2d++,'VoiceExtensionId':_0x25ab60['id']});}else{_0x12a40b['push']({'type':_0x19a563[_0xa56d('0x3')]['toLowerCase'](),'app':_0xa56d('0x18'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x25ab60[_0xa56d('0x6')],'exten':_0x25ab60[_0xa56d('0x7')],'priority':_0x19a563[_0xa56d('0x34')][_0xa56d('0x26')]+_0x332e19+_0x259a2d++,'VoiceExtensionId':_0x25ab60['id']});_0x12a40b['push']({'type':_0x19a563[_0xa56d('0x3')][_0xa56d('0x36')](),'app':_0xa56d('0x4'),'appdata':_0xa56d('0x44'),'context':_0x25ab60['context'],'exten':_0x25ab60[_0xa56d('0x7')],'priority':_0x19a563[_0xa56d('0x34')][_0xa56d('0x26')]+_0x332e19+_0x259a2d++,'VoiceExtensionId':_0x25ab60['id']});}}}}for(var _0x433668=0x0;_0x433668<_0x19a563[_0xa56d('0x34')]['length'];_0x433668++){var _0x5965ed=_0x332e19+_0x19a563['intervals']['length'];var _0xfa79a6=_0x433668===_0x19a563[_0xa56d('0x34')][_0xa56d('0x26')]-0x1?_0x332e19+_0x12a40b['length']+_0x913b6f[_0xa56d('0x26')]+0x2:_0x332e19+_0x433668+0x1;_0x12a40b['splice'](_0x433668,0x0,{'type':_0x25ab60['type'],'app':_0xa56d('0x45'),'appdata':_0x19a563[_0xa56d('0x34')][_0x433668]+'?'+_0x25ab60[_0xa56d('0x6')]+_0xa56d('0x46')+_0x5965ed+':'+_0x25ab60[_0xa56d('0x6')]+_0xa56d('0x46')+_0xfa79a6,'exten':_0x25ab60[_0xa56d('0x7')],'context':_0x25ab60[_0xa56d('0x6')],'priority':_0x332e19+_0x433668,'VoiceExtensionId':_0x25ab60['id']});}if(_0x19a563[_0xa56d('0x42')]===_0xa56d('0x47'))_0x19a563[_0xa56d('0x48')]=_0x11edf6(_0x25ab60,_0x19a563['appdata']);_0x19a563['priority']=_0x12a40b['length']?_[_0xa56d('0x49')](_0x12a40b)['priority']+0x1:_0x332e19;_0x1d6776=_[_0xa56d('0x4a')](_0x1d6776,_0x12a40b,[_0x19a563],_0x913b6f);_0x332e19=_[_0xa56d('0x49')](_0x1d6776)['priority']+0x1;}return _0xfa0ce1(_0x1d6776);})[_0xa56d('0x4b')](function(_0x2ca5a7){_0x5d9bb3(_0x2ca5a7);});});}return _0xcbe8f[_0xa56d('0x4c')](_0xa56d('0x4d'),attributes,{'tableName':_0xa56d('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1ab0bc){var _0x3ca506=this[_0xa56d('0x4f')]({'plain':!![]});var _0x32ea3c=_0x3ca506[_0xa56d('0x3')]===_0xa56d('0x11')?_0x23c01f(_0x3ca506):_0x1271f4(_0x3ca506);return _0x176a65(_0x3ca506,_0x1ab0bc,_[_0xa56d('0x49')](_0x32ea3c)['priority']+0x1)[_0xa56d('0x50')](function(_0x57c6a8){var _0x5c4233=_[_0xa56d('0x4a')](_0x32ea3c,_0x57c6a8);_0x5c4233[_0xa56d('0xd')]({'type':_0x3ca506['type'],'app':_0xa56d('0x51'),'exten':_0x3ca506[_0xa56d('0x7')],'context':_0x3ca506[_0xa56d('0x6')],'priority':_[_0xa56d('0x49')](_0x5c4233)[_0xa56d('0x52')]+0x1,'VoiceExtensionId':_0x3ca506['id']});return _0x5c4233;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 1af30a8..d2cdde6 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 _0x02b6=['debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','findAll','options','attributes','limit','include','model','map','GetVoiceExtension','stringify','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s'];(function(_0x54e2d6,_0x20cf2f){var _0x100976=function(_0x394017){while(--_0x394017){_0x54e2d6['push'](_0x54e2d6['shift']());}};_0x100976(++_0x20cf2f);}(_0x02b6,0xfe));var _0x602b=function(_0x1d7801,_0x24510b){_0x1d7801=_0x1d7801-0x0;var _0x1f023f=_0x02b6[_0x1d7801];return _0x1f023f;};'use strict';var _=require(_0x602b('0x0'));var util=require('util');var moment=require(_0x602b('0x1'));var BPromise=require(_0x602b('0x2'));var rs=require(_0x602b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x602b('0x4'));var logger=require(_0x602b('0x5'))(_0x602b('0x6'));var config=require(_0x602b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x602b('0x8')]['http']({'port':0x232a});config[_0x602b('0x9')]=_[_0x602b('0xa')](config[_0x602b('0x9')],{'host':_0x602b('0xb'),'port':0x18eb});var socket=require(_0x602b('0xc'))(new Redis(config[_0x602b('0x9')]));require(_0x602b('0xd'))[_0x602b('0xe')](socket);function respondWithRpcPromise(_0x20c7cf,_0x1687ca,_0x4fb0a2){return new BPromise(function(_0x470cf0,_0x5ca85d){return client['request'](_0x20c7cf,_0x4fb0a2)[_0x602b('0xf')](function(_0x568461){logger[_0x602b('0x10')](_0x602b('0x11'),_0x1687ca,'request\x20sent');logger[_0x602b('0x12')](_0x602b('0x13'),_0x1687ca,_0x602b('0x14'),JSON['stringify'](_0x568461));if(_0x568461[_0x602b('0x15')]){if(_0x568461[_0x602b('0x15')][_0x602b('0x16')]===0x1f4){logger[_0x602b('0x15')](_0x602b('0x11'),_0x1687ca,_0x568461[_0x602b('0x15')][_0x602b('0x17')]);return _0x5ca85d(_0x568461['error']['message']);}logger[_0x602b('0x15')](_0x602b('0x11'),_0x1687ca,_0x568461[_0x602b('0x15')][_0x602b('0x17')]);return _0x470cf0(_0x568461[_0x602b('0x15')][_0x602b('0x17')]);}else{logger[_0x602b('0x10')](_0x602b('0x11'),_0x1687ca,_0x602b('0x14'));_0x470cf0(_0x568461['result'][_0x602b('0x17')]);}})[_0x602b('0x18')](function(_0x3ddabd){logger['error'](_0x602b('0x11'),_0x1687ca,_0x3ddabd);_0x5ca85d(_0x3ddabd);});});}exports['GetVoiceExtension']=function(_0x4ddfe0){var _0x311da8=this;return new Promise(function(_0x4e888d,_0x28eadf){return db['VoiceExtension'][_0x602b('0x19')]({'raw':_0x4ddfe0[_0x602b('0x1a')]?_0x4ddfe0[_0x602b('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4ddfe0[_0x602b('0x1a')]?_0x4ddfe0[_0x602b('0x1a')]['where']||null:null,'attributes':_0x4ddfe0[_0x602b('0x1a')]?_0x4ddfe0[_0x602b('0x1a')][_0x602b('0x1b')]||null:null,'limit':_0x4ddfe0[_0x602b('0x1a')]?_0x4ddfe0[_0x602b('0x1a')][_0x602b('0x1c')]||null:null,'include':_0x4ddfe0[_0x602b('0x1a')]?_0x4ddfe0[_0x602b('0x1a')][_0x602b('0x1d')]?_['map'](_0x4ddfe0[_0x602b('0x1a')][_0x602b('0x1d')],function(_0x5ce51b){return{'model':db[_0x5ce51b[_0x602b('0x1e')]],'as':_0x5ce51b['as'],'attributes':_0x5ce51b[_0x602b('0x1b')],'include':_0x5ce51b['include']?_[_0x602b('0x1f')](_0x5ce51b[_0x602b('0x1d')],function(_0x22cd69){return{'model':db[_0x22cd69[_0x602b('0x1e')]],'as':_0x22cd69['as'],'attributes':_0x22cd69[_0x602b('0x1b')],'include':_0x22cd69[_0x602b('0x1d')]?_[_0x602b('0x1f')](_0x22cd69[_0x602b('0x1d')],function(_0x3e82bc){return{'model':db[_0x3e82bc[_0x602b('0x1e')]],'as':_0x3e82bc['as'],'attributes':_0x3e82bc[_0x602b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23a7f4){logger['info'](_0x602b('0x20'),_0x4ddfe0);logger[_0x602b('0x12')](_0x602b('0x20'),_0x4ddfe0,JSON[_0x602b('0x21')](_0x23a7f4));_0x4e888d(_0x23a7f4);})[_0x602b('0x18')](function(_0x3647cf){logger[_0x602b('0x15')](_0x602b('0x20'),_0x3647cf[_0x602b('0x17')],_0x4ddfe0);_0x28eadf(_0x311da8[_0x602b('0x15')](0x1f4,_0x3647cf[_0x602b('0x17')]));});});}; \ No newline at end of file +var _0x0ec6=['stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','findAll','options','raw','attributes','limit','include','model','map','GetVoiceExtension','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./voiceExtension.socket','register','request','then','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x152df9,_0x13a618){_0x152df9=_0x152df9-0x0;var _0x3484c1=_0x0ec6[_0x152df9];return _0x3484c1;};'use strict';var _=require(_0x60ec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x60ec('0x1'));var rs=require(_0x60ec('0x2'));var fs=require('fs');var Redis=require(_0x60ec('0x3'));var db=require(_0x60ec('0x4'))['db'];var utils=require(_0x60ec('0x5'));var logger=require(_0x60ec('0x6'))(_0x60ec('0x7'));var config=require('../../config/environment');var jayson=require(_0x60ec('0x8'));var client=jayson[_0x60ec('0x9')][_0x60ec('0xa')]({'port':0x232a});config[_0x60ec('0xb')]=_['defaults'](config[_0x60ec('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x60ec('0xc'))(new Redis(config[_0x60ec('0xb')]));require(_0x60ec('0xd'))[_0x60ec('0xe')](socket);function respondWithRpcPromise(_0x2edd4f,_0x316fd4,_0x48e5c3){return new BPromise(function(_0x49fe3b,_0x309e0d){return client[_0x60ec('0xf')](_0x2edd4f,_0x48e5c3)[_0x60ec('0x10')](function(_0x14e27b){logger[_0x60ec('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x316fd4,'request\x20sent');logger[_0x60ec('0x12')](_0x60ec('0x13'),_0x316fd4,_0x60ec('0x14'),JSON[_0x60ec('0x15')](_0x14e27b));if(_0x14e27b[_0x60ec('0x16')]){if(_0x14e27b['error'][_0x60ec('0x17')]===0x1f4){logger[_0x60ec('0x16')](_0x60ec('0x18'),_0x316fd4,_0x14e27b[_0x60ec('0x16')][_0x60ec('0x19')]);return _0x309e0d(_0x14e27b[_0x60ec('0x16')][_0x60ec('0x19')]);}logger[_0x60ec('0x16')](_0x60ec('0x18'),_0x316fd4,_0x14e27b['error'][_0x60ec('0x19')]);return _0x49fe3b(_0x14e27b[_0x60ec('0x16')][_0x60ec('0x19')]);}else{logger[_0x60ec('0x11')](_0x60ec('0x18'),_0x316fd4,_0x60ec('0x14'));_0x49fe3b(_0x14e27b[_0x60ec('0x1a')][_0x60ec('0x19')]);}})[_0x60ec('0x1b')](function(_0x1e0c6e){logger[_0x60ec('0x16')](_0x60ec('0x18'),_0x316fd4,_0x1e0c6e);_0x309e0d(_0x1e0c6e);});});}exports['GetVoiceExtension']=function(_0x288964){var _0x44c745=this;return new Promise(function(_0x1b6fe0,_0x278ae3){return db['VoiceExtension'][_0x60ec('0x1c')]({'raw':_0x288964[_0x60ec('0x1d')]?_0x288964[_0x60ec('0x1d')][_0x60ec('0x1e')]===undefined?!![]:![]:!![],'where':_0x288964[_0x60ec('0x1d')]?_0x288964[_0x60ec('0x1d')]['where']||null:null,'attributes':_0x288964['options']?_0x288964['options'][_0x60ec('0x1f')]||null:null,'limit':_0x288964[_0x60ec('0x1d')]?_0x288964[_0x60ec('0x1d')][_0x60ec('0x20')]||null:null,'include':_0x288964['options']?_0x288964['options']['include']?_['map'](_0x288964[_0x60ec('0x1d')][_0x60ec('0x21')],function(_0x42d1c2){return{'model':db[_0x42d1c2[_0x60ec('0x22')]],'as':_0x42d1c2['as'],'attributes':_0x42d1c2[_0x60ec('0x1f')],'include':_0x42d1c2[_0x60ec('0x21')]?_[_0x60ec('0x23')](_0x42d1c2[_0x60ec('0x21')],function(_0x1da3bb){return{'model':db[_0x1da3bb['model']],'as':_0x1da3bb['as'],'attributes':_0x1da3bb[_0x60ec('0x1f')],'include':_0x1da3bb[_0x60ec('0x21')]?_[_0x60ec('0x23')](_0x1da3bb[_0x60ec('0x21')],function(_0xf3817d){return{'model':db[_0xf3817d[_0x60ec('0x22')]],'as':_0xf3817d['as'],'attributes':_0xf3817d[_0x60ec('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x60ec('0x10')](function(_0x24153c){logger[_0x60ec('0x11')]('GetVoiceExtension',_0x288964);logger['debug'](_0x60ec('0x24'),_0x288964,JSON[_0x60ec('0x15')](_0x24153c));_0x1b6fe0(_0x24153c);})['catch'](function(_0x48d814){logger[_0x60ec('0x16')]('GetVoiceExtension',_0x48d814[_0x60ec('0x19')],_0x288964);_0x278ae3(_0x44c745[_0x60ec('0x16')](0x1f4,_0x48d814[_0x60ec('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 4d6b00a..f061c72 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 _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x24eb2a,_0xe23133){var _0x1687a7=function(_0xfca1b){while(--_0xfca1b){_0x24eb2a['push'](_0x24eb2a['shift']());}};_0x1687a7(++_0xe23133);}(_0x5fab,0x177));var _0xb5fa=function(_0x44585b,_0x5c43fc){_0x44585b=_0x44585b-0x0;var _0x173bf9=_0x5fab[_0x44585b];return _0x173bf9;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x235b7d,_0x12b3e1){var _0x5ade6b=function(_0x3b78d8){while(--_0x3b78d8){_0x235b7d['push'](_0x235b7d['shift']());}};_0x5ade6b(++_0x12b3e1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 6bb47fd..a3e5f1b 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 _0x90b1=['getMessages','post','create','put','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','/:id/messages'];(function(_0x3d7af5,_0x308d72){var _0x11b446=function(_0x3ff3e4){while(--_0x3ff3e4){_0x3d7af5['push'](_0x3d7af5['shift']());}};_0x11b446(++_0x308d72);}(_0x90b1,0x1bb));var _0x190b=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0x90b1[_0x2bf888];return _0x3038d6;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var fs_extra=require(_0x190b('0x4'));var auth=require(_0x190b('0x5'));var interaction=require(_0x190b('0x6'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x190b('0x7')]);router[_0x190b('0x8')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xb')]);router[_0x190b('0x8')](_0x190b('0xc'),auth['isAuthenticated'](),controller[_0x190b('0xd')]);router[_0x190b('0xe')]('/',auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0x10')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0x11')]);router['delete'](_0x190b('0x9'),auth[_0x190b('0xa')](),controller['destroy']);module[_0x190b('0x12')]=router; \ No newline at end of file +var _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x177e7e,_0x444934){var _0x60e826=function(_0x562fb3){while(--_0x562fb3){_0x177e7e['push'](_0x177e7e['shift']());}};_0x60e826(++_0x444934);}(_0x7a54,0x106));var _0x47a5=function(_0x105356,_0x1e68e1){_0x105356=_0x105356-0x0;var _0x991a4d=_0x7a54[_0x105356];return _0x991a4d;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index c780d39..464c570 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 _0x4e6d=['yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','trim','central','ENUM'];(function(_0x57e00e,_0x36e79a){var _0x415e60=function(_0x5cd7fa){while(--_0x5cd7fa){_0x57e00e['push'](_0x57e00e['shift']());}};_0x415e60(++_0x36e79a);}(_0x4e6d,0x1b8));var _0xd4e6=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0x4e6d[_0x492535];return _0x256620;};'use strict';var Sequelize=require(_0xd4e6('0x0'));module[_0xd4e6('0x1')]={'customer_id':{'type':Sequelize[_0xd4e6('0x2')]},'context':{'type':Sequelize[_0xd4e6('0x2')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xd4e6('0x3')},'password':{'type':Sequelize[_0xd4e6('0x2')]},'fullname':{'type':Sequelize[_0xd4e6('0x2')]},'email':{'type':Sequelize[_0xd4e6('0x2')],'validate':{'isEmail':!![]},'set':function(_0x49ced9){this[_0xd4e6('0x4')]('email',typeof _0x49ced9==='string'&&_0x49ced9[_0xd4e6('0x5')]()?_0x49ced9[_0xd4e6('0x5')]():null);}},'pager':{'type':Sequelize[_0xd4e6('0x2')]},'tz':{'type':Sequelize[_0xd4e6('0x2')],'defaultValue':_0xd4e6('0x6')},'attach':{'type':Sequelize[_0xd4e6('0x7')](_0xd4e6('0x8'),'no'),'defaultValue':_0xd4e6('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xd4e6('0x7')]('yes','no'),'defaultValue':_0xd4e6('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xd4e6('0x2')]},'callback':{'type':Sequelize[_0xd4e6('0x2')]},'review':{'type':Sequelize[_0xd4e6('0x7')](_0xd4e6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xd4e6('0x7')](_0xd4e6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xd4e6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xd4e6('0x7')](_0xd4e6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xd4e6('0x7')](_0xd4e6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd4e6('0x7')](_0xd4e6('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xd4e6('0x7')](_0xd4e6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xd4e6('0x7')](_0xd4e6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xd4e6('0x7')](_0xd4e6('0x8'),'no'),'defaultValue':_0xd4e6('0x8'),'allowNull':![]},'stamp':{'type':_0xd4e6('0x9')},'emailsubject':{'type':Sequelize[_0xd4e6('0x2')]},'emailbody':{'type':Sequelize[_0xd4e6('0x2')]},'maxsecs':{'type':Sequelize[_0xd4e6('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd4e6('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xd4e6('0xb')],'get':function(){return this[_0xd4e6('0xc')](_0xd4e6('0xd'))+_0xd4e6('0xe')+this['getDataValue'](_0xd4e6('0xf'));}}}; \ No newline at end of file +var _0x25ba=['yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','trim','ENUM'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x25ba,0x1ca));var _0xa25b=function(_0x36ad25,_0x1d1e3f){_0x36ad25=_0x36ad25-0x0;var _0xfb9a0f=_0x25ba[_0x36ad25];return _0xfb9a0f;};'use strict';var Sequelize=require(_0xa25b('0x0'));module[_0xa25b('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa25b('0x2')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xa25b('0x2')],'defaultValue':'','allowNull':![],'unique':_0xa25b('0x3')},'password':{'type':Sequelize[_0xa25b('0x2')]},'fullname':{'type':Sequelize[_0xa25b('0x2')]},'email':{'type':Sequelize[_0xa25b('0x2')],'validate':{'isEmail':!![]},'set':function(_0x52cdc9){this[_0xa25b('0x4')]('email',typeof _0x52cdc9==='string'&&_0x52cdc9[_0xa25b('0x5')]()?_0x52cdc9[_0xa25b('0x5')]():null);}},'pager':{'type':Sequelize[_0xa25b('0x2')]},'tz':{'type':Sequelize[_0xa25b('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xa25b('0x6')](_0xa25b('0x7'),'no'),'defaultValue':_0xa25b('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0xa25b('0x6')](_0xa25b('0x7'),'no'),'defaultValue':_0xa25b('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0xa25b('0x2')]},'callback':{'type':Sequelize[_0xa25b('0x2')]},'review':{'type':Sequelize[_0xa25b('0x6')](_0xa25b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xa25b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xa25b('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xa25b('0x6')](_0xa25b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xa25b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xa25b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xa25b('0x6')](_0xa25b('0x7'),'no'),'defaultValue':_0xa25b('0x7'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xa25b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xa25b('0x6')](_0xa25b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xa25b('0x6')]('yes','no'),'defaultValue':_0xa25b('0x7'),'allowNull':![]},'stamp':{'type':_0xa25b('0x8')},'emailsubject':{'type':Sequelize[_0xa25b('0x2')]},'emailbody':{'type':Sequelize[_0xa25b('0x2')]},'maxsecs':{'type':Sequelize[_0xa25b('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xa25b('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xa25b('0xa')],'get':function(){return this[_0xa25b('0xb')](_0xa25b('0xc'))+_0xa25b('0xd')+this['getDataValue'](_0xa25b('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 22c8b57..6bcb806 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 _0x1be1=['set','Content-Range','apply','reject','save','update','then','get','Voicemails','destroy','sendStatus','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','include','findAll','rows','show','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','findOne','VoiceMailMessage','length','mailbox','findAndCountAll','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count'];(function(_0x54536f,_0x1948c5){var _0x4befc1=function(_0x105e9d){while(--_0x105e9d){_0x54536f['push'](_0x54536f['shift']());}};_0x4befc1(++_0x1948c5);}(_0x1be1,0x192));var _0x11be=function(_0x291060,_0x2cf374){_0x291060=_0x291060-0x0;var _0x192b12=_0x1be1[_0x291060];return _0x192b12;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11be('0x0'));var jsonpatch=require(_0x11be('0x1'));var rp=require('request-promise');var moment=require(_0x11be('0x2'));var BPromise=require(_0x11be('0x3'));var Mustache=require(_0x11be('0x4'));var util=require(_0x11be('0x5'));var path=require('path');var sox=require(_0x11be('0x6'));var csv=require(_0x11be('0x7'));var ejs=require(_0x11be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11be('0x9'));var squel=require('squel');var crypto=require(_0x11be('0xa'));var jsforce=require(_0x11be('0xb'));var deskjs=require(_0x11be('0xc'));var toCsv=require(_0x11be('0x7'));var querystring=require(_0x11be('0xd'));var Papa=require('papaparse');var Redis=require(_0x11be('0xe'));var authService=require(_0x11be('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x11be('0x10'));var hardwareService=require(_0x11be('0x11'));var logger=require(_0x11be('0x12'))(_0x11be('0x13'));var utils=require('../../config/utils');var config=require(_0x11be('0x14'));var licenseUtil=require(_0x11be('0x15'));var db=require(_0x11be('0x16'))['db'];function respondWithStatusCode(_0x4b36c8,_0x3ff31f){_0x3ff31f=_0x3ff31f||0xcc;return function(_0x2dad05){if(_0x2dad05){return _0x4b36c8['sendStatus'](_0x3ff31f);}return _0x4b36c8[_0x11be('0x17')](_0x3ff31f)['end']();};}function respondWithResult(_0x49228e,_0x569842){_0x569842=_0x569842||0xc8;return function(_0x4b6e7e){if(_0x4b6e7e){return _0x49228e['status'](_0x569842)['json'](_0x4b6e7e);}};}function respondWithFilteredResult(_0x588871,_0x2280e2){return function(_0x52bbef){if(_0x52bbef){var _0x31047c=typeof _0x2280e2[_0x11be('0x18')]===_0x11be('0x19')&&typeof _0x2280e2[_0x11be('0x1a')]==='undefined';var _0x2ed725=_0x52bbef[_0x11be('0x1b')];var _0x56ab61=_0x31047c?0x0:_0x2280e2[_0x11be('0x18')];var _0xc3263c=_0x31047c?_0x52bbef[_0x11be('0x1b')]:_0x2280e2['offset']+_0x2280e2['limit'];var _0x141391;if(_0xc3263c>=_0x2ed725){_0xc3263c=_0x2ed725;_0x141391=0xc8;}else{_0x141391=0xce;}_0x588871[_0x11be('0x17')](_0x141391);return _0x588871[_0x11be('0x1c')](_0x11be('0x1d'),_0x56ab61+'-'+_0xc3263c+'/'+_0x2ed725)['json'](_0x52bbef);}return null;};}function patchUpdates(_0x12a5bd){return function(_0x45136f){try{jsonpatch[_0x11be('0x1e')](_0x45136f,_0x12a5bd,!![]);}catch(_0x452315){return BPromise[_0x11be('0x1f')](_0x452315);}return _0x45136f[_0x11be('0x20')]();};}function saveUpdates(_0xa944ac,_0x17678d){return function(_0x3aea14){if(_0x3aea14){return _0x3aea14[_0x11be('0x21')](_0xa944ac)['then'](function(_0xfe3737){return _0xfe3737;});}return null;};}function removeEntity(_0x46b7c2,_0x2fe43c){return function(_0x5d1690){if(_0x5d1690){return _0x5d1690['destroy']()[_0x11be('0x22')](function(){var _0x10ce04=_0x5d1690[_0x11be('0x23')]({'plain':!![]});var _0x4cb27f=_0x11be('0x24');return db['UserProfileResource'][_0x11be('0x25')]({'where':{'type':_0x4cb27f,'resourceId':_0x10ce04['id']}})['then'](function(){return _0x5d1690;});})[_0x11be('0x22')](function(){_0x46b7c2[_0x11be('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48029b,_0x28b3a0){return function(_0x1d3b5c){if(!_0x1d3b5c){_0x48029b[_0x11be('0x26')](0x194);}return _0x1d3b5c;};}function handleError(_0x30427b,_0x17c67f){_0x17c67f=_0x17c67f||0x1f4;return function(_0xf5a6ac){logger[_0x11be('0x27')](_0xf5a6ac[_0x11be('0x28')]);if(_0xf5a6ac['name']){delete _0xf5a6ac[_0x11be('0x29')];}_0x30427b['status'](_0x17c67f)[_0x11be('0x2a')](_0xf5a6ac);};}exports[_0x11be('0x2b')]=function(_0x510476,_0x584d4c){var _0x49fd5c={},_0x265fc9={},_0x5e8f9a={'count':0x0,'rows':[]};var _0x66316d=_[_0x11be('0x2c')](db[_0x11be('0x2d')][_0x11be('0x2e')],function(_0x25e214){return{'name':_0x25e214[_0x11be('0x2f')],'type':_0x25e214['type'][_0x11be('0x30')]};});_0x265fc9[_0x11be('0x31')]=_[_0x11be('0x2c')](_0x66316d,_0x11be('0x29'));_0x265fc9[_0x11be('0x32')]=_[_0x11be('0x33')](_0x510476['query']);_0x265fc9[_0x11be('0x34')]=_[_0x11be('0x35')](_0x265fc9[_0x11be('0x31')],_0x265fc9[_0x11be('0x32')]);_0x49fd5c[_0x11be('0x36')]=_['intersection'](_0x265fc9[_0x11be('0x31')],qs[_0x11be('0x37')](_0x510476[_0x11be('0x32')]['fields']));_0x49fd5c[_0x11be('0x36')]=_0x49fd5c['attributes']['length']?_0x49fd5c['attributes']:_0x265fc9['model'];if(!_0x510476[_0x11be('0x32')][_0x11be('0x38')](_0x11be('0x39'))){_0x49fd5c['limit']=qs[_0x11be('0x1a')](_0x510476[_0x11be('0x32')]['limit']);_0x49fd5c[_0x11be('0x18')]=qs['offset'](_0x510476[_0x11be('0x32')]['offset']);}_0x49fd5c[_0x11be('0x3a')]=qs[_0x11be('0x3b')](_0x510476[_0x11be('0x32')][_0x11be('0x3b')]);_0x49fd5c['where']=qs[_0x11be('0x34')](_[_0x11be('0x3c')](_0x510476[_0x11be('0x32')],_0x265fc9[_0x11be('0x34')]),_0x66316d);if(_0x510476['query'][_0x11be('0x3d')]){_0x49fd5c[_0x11be('0x3e')]=_[_0x11be('0x3f')](_0x49fd5c[_0x11be('0x3e')],{'$or':_[_0x11be('0x2c')](_0x66316d,function(_0x1b1aac){if(_0x1b1aac[_0x11be('0x40')]!=='VIRTUAL'){var _0x2618f5={};_0x2618f5[_0x1b1aac[_0x11be('0x29')]]={'$like':'%'+_0x510476['query'][_0x11be('0x3d')]+'%'};return _0x2618f5;}})});}_0x49fd5c=_[_0x11be('0x3f')]({},_0x49fd5c,_0x510476['options']);var _0x30b67a={'where':_0x49fd5c['where']};return db[_0x11be('0x2d')]['count'](_0x30b67a)[_0x11be('0x22')](function(_0x30be21){_0x5e8f9a['count']=_0x30be21;if(_0x510476[_0x11be('0x32')]['includeAll']){_0x49fd5c[_0x11be('0x41')]=[{'all':!![]}];}return db[_0x11be('0x2d')][_0x11be('0x42')](_0x49fd5c);})[_0x11be('0x22')](function(_0x2b847a){_0x5e8f9a[_0x11be('0x43')]=_0x2b847a;return _0x5e8f9a;})[_0x11be('0x22')](respondWithFilteredResult(_0x584d4c,_0x49fd5c))['catch'](handleError(_0x584d4c,null));};exports[_0x11be('0x44')]=function(_0x18cddf,_0x9610a1){var _0x317e2d={'raw':!![],'where':{'id':_0x18cddf['params']['id']}},_0x589ac4={};_0x589ac4['model']=_[_0x11be('0x33')](db['VoiceMail'][_0x11be('0x2e')]);_0x589ac4['query']=_[_0x11be('0x33')](_0x18cddf[_0x11be('0x32')]);_0x589ac4[_0x11be('0x34')]=_[_0x11be('0x35')](_0x589ac4[_0x11be('0x31')],_0x589ac4[_0x11be('0x32')]);_0x317e2d[_0x11be('0x36')]=_['intersection'](_0x589ac4[_0x11be('0x31')],qs['fields'](_0x18cddf[_0x11be('0x32')][_0x11be('0x37')]));_0x317e2d[_0x11be('0x36')]=_0x317e2d['attributes']['length']?_0x317e2d['attributes']:_0x589ac4[_0x11be('0x31')];if(_0x18cddf[_0x11be('0x32')]['includeAll']){_0x317e2d['include']=[{'all':!![]}];}_0x317e2d=_['merge']({},_0x317e2d,_0x18cddf[_0x11be('0x45')]);return db[_0x11be('0x2d')][_0x11be('0x46')](_0x317e2d)[_0x11be('0x22')](handleEntityNotFound(_0x9610a1,null))[_0x11be('0x22')](respondWithResult(_0x9610a1,null))[_0x11be('0x47')](handleError(_0x9610a1,null));};exports[_0x11be('0x48')]=function(_0x3f2070,_0x2ce110){return db[_0x11be('0x2d')][_0x11be('0x48')](_0x3f2070['body'],{})[_0x11be('0x22')](function(_0x29f82f){var _0x534ee7=_0x3f2070['user']['get']({'plain':!![]});if(!_0x534ee7)throw new Error(_0x11be('0x49'));if(_0x534ee7['role']===_0x11be('0x4a')){var _0x1c1626=_0x29f82f[_0x11be('0x23')]({'plain':!![]});var _0x1fb48d=_0x11be('0x24');return db[_0x11be('0x4b')][_0x11be('0x46')]({'where':{'name':_0x1fb48d,'userProfileId':_0x534ee7[_0x11be('0x4c')]},'raw':!![]})[_0x11be('0x22')](function(_0x4c873a){if(_0x4c873a&&_0x4c873a[_0x11be('0x4d')]===0x0){return db['UserProfileResource'][_0x11be('0x48')]({'name':_0x1c1626[_0x11be('0x29')],'resourceId':_0x1c1626['id'],'type':_0x4c873a['name'],'sectionId':_0x4c873a['id']},{})[_0x11be('0x22')](function(){return _0x29f82f;});}else{return _0x29f82f;}})[_0x11be('0x47')](function(_0x4c0e37){logger[_0x11be('0x27')](_0x11be('0x4e'),_0x4c0e37);throw _0x4c0e37;});}return _0x29f82f;})['then'](respondWithResult(_0x2ce110,0xc9))['catch'](handleError(_0x2ce110,null));};exports[_0x11be('0x21')]=function(_0x2886ac,_0x50eeab){if(_0x2886ac['body']['id']){delete _0x2886ac[_0x11be('0x4f')]['id'];}return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x2886ac['params']['id']}})['then'](handleEntityNotFound(_0x50eeab,null))['then'](saveUpdates(_0x2886ac[_0x11be('0x4f')],null))[_0x11be('0x22')](respondWithResult(_0x50eeab,null))[_0x11be('0x47')](handleError(_0x50eeab,null));};exports['destroy']=function(_0x4db963,_0x33409c){return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x4db963[_0x11be('0x50')]['id']}})['then'](handleEntityNotFound(_0x33409c,null))[_0x11be('0x22')](removeEntity(_0x33409c,null))['catch'](handleError(_0x33409c,null));};exports['getMessages']=function(_0x568f20,_0x5aa6bf,_0x1a43df){return db[_0x11be('0x2d')][_0x11be('0x51')]({'where':{'id':_0x568f20[_0x11be('0x50')]['id']}})[_0x11be('0x22')](handleEntityNotFound(_0x5aa6bf,null))[_0x11be('0x22')](function(_0xb97604){var _0x55e79d;var _0x54e52a={},_0x7c1ee5={};_0x7c1ee5[_0x11be('0x31')]=_[_0x11be('0x33')](db[_0x11be('0x52')][_0x11be('0x2e')]);_0x7c1ee5[_0x11be('0x32')]=_[_0x11be('0x33')](_0x568f20[_0x11be('0x32')]);_0x7c1ee5[_0x11be('0x34')]=_['intersection'](_0x7c1ee5[_0x11be('0x31')],_0x7c1ee5[_0x11be('0x32')]);_0x54e52a[_0x11be('0x36')]=_['intersection'](_0x7c1ee5[_0x11be('0x31')],qs[_0x11be('0x37')](_0x568f20['query']['fields']));_0x54e52a[_0x11be('0x36')]=_0x54e52a[_0x11be('0x36')][_0x11be('0x53')]?_0x54e52a[_0x11be('0x36')]:_0x7c1ee5['model'];if(!_0x568f20[_0x11be('0x32')][_0x11be('0x38')](_0x11be('0x39'))){_0x54e52a[_0x11be('0x1a')]=qs[_0x11be('0x1a')](_0x568f20[_0x11be('0x32')][_0x11be('0x1a')]);_0x54e52a[_0x11be('0x18')]=qs[_0x11be('0x18')](_0x568f20['query']['offset']);}_0x54e52a[_0x11be('0x3a')]=qs[_0x11be('0x3b')](_0x568f20['query'][_0x11be('0x3b')]);_0x54e52a[_0x11be('0x3e')]=qs[_0x11be('0x34')](_[_0x11be('0x3c')](_0x568f20[_0x11be('0x32')],_0x7c1ee5[_0x11be('0x34')]));if(_0x568f20[_0x11be('0x32')]['filter']){_0x54e52a['where']=_[_0x11be('0x3f')](_0x54e52a[_0x11be('0x3e')],{'$or':_[_0x11be('0x2c')](_0x54e52a['attributes'],function(_0x82c02c){var _0x422696={};_0x422696[_0x82c02c]={'$like':'%'+_0x568f20[_0x11be('0x32')][_0x11be('0x3d')]+'%'};return _0x422696;})});}_0x54e52a[_0x11be('0x3e')]=_[_0x11be('0x3f')](_0x54e52a[_0x11be('0x3e')],{'mailboxuser':_0xb97604[_0x11be('0x54')]});_0x54e52a=_[_0x11be('0x3f')]({},_0x54e52a,_0x568f20[_0x11be('0x45')]);return db[_0x11be('0x52')][_0x11be('0x55')](_0x54e52a)[_0x11be('0x22')](respondWithFilteredResult(_0x5aa6bf,_0x54e52a));})[_0x11be('0x47')](handleError(_0x5aa6bf,null));}; \ No newline at end of file +var _0x02ce=['lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update','then','destroy','Voicemails','UserProfileResource','end','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','user','get','role','UserProfileSection','getMessages','findOne','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x02ce,0x1ac));var _0xe02c=function(_0x92c880,_0x3d7806){_0x92c880=_0x92c880-0x0;var _0xc07bc8=_0x02ce[_0x92c880];return _0xc07bc8;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];function respondWithStatusCode(_0x23d886,_0x32fc45){_0x32fc45=_0x32fc45||0xcc;return function(_0x5d6d13){if(_0x5d6d13){return _0x23d886[_0xe02c('0x1c')](_0x32fc45);}return _0x23d886['status'](_0x32fc45)['end']();};}function respondWithResult(_0x3f4e28,_0x56405a){_0x56405a=_0x56405a||0xc8;return function(_0x221910){if(_0x221910){return _0x3f4e28['status'](_0x56405a)[_0xe02c('0x1d')](_0x221910);}};}function respondWithFilteredResult(_0x4e9c6d,_0x256311){return function(_0x366893){if(_0x366893){var _0x59f2f6=typeof _0x256311[_0xe02c('0x1e')]===_0xe02c('0x1f')&&typeof _0x256311['limit']===_0xe02c('0x1f');var _0x20f492=_0x366893['count'];var _0x52917f=_0x59f2f6?0x0:_0x256311[_0xe02c('0x1e')];var _0x49604a=_0x59f2f6?_0x366893[_0xe02c('0x20')]:_0x256311[_0xe02c('0x1e')]+_0x256311[_0xe02c('0x21')];var _0x36fed0;if(_0x49604a>=_0x20f492){_0x49604a=_0x20f492;_0x36fed0=0xc8;}else{_0x36fed0=0xce;}_0x4e9c6d[_0xe02c('0x22')](_0x36fed0);return _0x4e9c6d['set'](_0xe02c('0x23'),_0x52917f+'-'+_0x49604a+'/'+_0x20f492)['json'](_0x366893);}return null;};}function patchUpdates(_0x4ea9b5){return function(_0x393621){try{jsonpatch[_0xe02c('0x24')](_0x393621,_0x4ea9b5,!![]);}catch(_0x480b9a){return BPromise[_0xe02c('0x25')](_0x480b9a);}return _0x393621[_0xe02c('0x26')]();};}function saveUpdates(_0x4ce5ee,_0x38dce2){return function(_0x45fd82){if(_0x45fd82){return _0x45fd82[_0xe02c('0x27')](_0x4ce5ee)[_0xe02c('0x28')](function(_0x2d44c8){return _0x2d44c8;});}return null;};}function removeEntity(_0x557142,_0x3e80e3){return function(_0xf41d4c){if(_0xf41d4c){return _0xf41d4c[_0xe02c('0x29')]()[_0xe02c('0x28')](function(){var _0x60b65e=_0xf41d4c['get']({'plain':!![]});var _0xefd882=_0xe02c('0x2a');return db[_0xe02c('0x2b')][_0xe02c('0x29')]({'where':{'type':_0xefd882,'resourceId':_0x60b65e['id']}})[_0xe02c('0x28')](function(){return _0xf41d4c;});})[_0xe02c('0x28')](function(){_0x557142[_0xe02c('0x22')](0xcc)[_0xe02c('0x2c')]();});}};}function handleEntityNotFound(_0x55ef2a,_0x55e475){return function(_0x3790eb){if(!_0x3790eb){_0x55ef2a[_0xe02c('0x1c')](0x194);}return _0x3790eb;};}function handleError(_0x481e02,_0x18b572){_0x18b572=_0x18b572||0x1f4;return function(_0x2d1d98){logger[_0xe02c('0x2d')](_0x2d1d98[_0xe02c('0x2e')]);if(_0x2d1d98[_0xe02c('0x2f')]){delete _0x2d1d98[_0xe02c('0x2f')];}_0x481e02[_0xe02c('0x22')](_0x18b572)[_0xe02c('0x30')](_0x2d1d98);};}exports[_0xe02c('0x31')]=function(_0x288004,_0x17d5b3){var _0x5a2da0={},_0x3c3d2c={},_0x3c1858={'count':0x0,'rows':[]};var _0x22b783=_[_0xe02c('0x32')](db[_0xe02c('0x33')][_0xe02c('0x34')],function(_0x58bf16){return{'name':_0x58bf16[_0xe02c('0x35')],'type':_0x58bf16[_0xe02c('0x36')]['key']};});_0x3c3d2c[_0xe02c('0x37')]=_[_0xe02c('0x32')](_0x22b783,_0xe02c('0x2f'));_0x3c3d2c[_0xe02c('0x38')]=_[_0xe02c('0x39')](_0x288004['query']);_0x3c3d2c['filters']=_[_0xe02c('0x3a')](_0x3c3d2c[_0xe02c('0x37')],_0x3c3d2c['query']);_0x5a2da0[_0xe02c('0x3b')]=_['intersection'](_0x3c3d2c[_0xe02c('0x37')],qs[_0xe02c('0x3c')](_0x288004[_0xe02c('0x38')][_0xe02c('0x3c')]));_0x5a2da0[_0xe02c('0x3b')]=_0x5a2da0['attributes'][_0xe02c('0x3d')]?_0x5a2da0['attributes']:_0x3c3d2c[_0xe02c('0x37')];if(!_0x288004[_0xe02c('0x38')][_0xe02c('0x3e')](_0xe02c('0x3f'))){_0x5a2da0[_0xe02c('0x21')]=qs[_0xe02c('0x21')](_0x288004['query'][_0xe02c('0x21')]);_0x5a2da0[_0xe02c('0x1e')]=qs['offset'](_0x288004[_0xe02c('0x38')][_0xe02c('0x1e')]);}_0x5a2da0['order']=qs[_0xe02c('0x40')](_0x288004['query'][_0xe02c('0x40')]);_0x5a2da0[_0xe02c('0x41')]=qs['filters'](_[_0xe02c('0x42')](_0x288004[_0xe02c('0x38')],_0x3c3d2c[_0xe02c('0x43')]),_0x22b783);if(_0x288004[_0xe02c('0x38')][_0xe02c('0x44')]){_0x5a2da0[_0xe02c('0x41')]=_['merge'](_0x5a2da0[_0xe02c('0x41')],{'$or':_['map'](_0x22b783,function(_0x5ae8cd){if(_0x5ae8cd[_0xe02c('0x36')]!==_0xe02c('0x45')){var _0x42fbac={};_0x42fbac[_0x5ae8cd[_0xe02c('0x2f')]]={'$like':'%'+_0x288004['query'][_0xe02c('0x44')]+'%'};return _0x42fbac;}})});}_0x5a2da0=_[_0xe02c('0x46')]({},_0x5a2da0,_0x288004[_0xe02c('0x47')]);var _0x5baef6={'where':_0x5a2da0['where']};return db[_0xe02c('0x33')][_0xe02c('0x20')](_0x5baef6)[_0xe02c('0x28')](function(_0x2313d2){_0x3c1858[_0xe02c('0x20')]=_0x2313d2;if(_0x288004[_0xe02c('0x38')][_0xe02c('0x48')]){_0x5a2da0[_0xe02c('0x49')]=[{'all':!![]}];}return db[_0xe02c('0x33')]['findAll'](_0x5a2da0);})[_0xe02c('0x28')](function(_0x5ef4a1){_0x3c1858['rows']=_0x5ef4a1;return _0x3c1858;})[_0xe02c('0x28')](respondWithFilteredResult(_0x17d5b3,_0x5a2da0))[_0xe02c('0x4a')](handleError(_0x17d5b3,null));};exports[_0xe02c('0x4b')]=function(_0x1719cf,_0x24d506){var _0x12ca0e={'raw':!![],'where':{'id':_0x1719cf[_0xe02c('0x4c')]['id']}},_0x165f4a={};_0x165f4a['model']=_['keys'](db[_0xe02c('0x33')][_0xe02c('0x34')]);_0x165f4a[_0xe02c('0x38')]=_['keys'](_0x1719cf[_0xe02c('0x38')]);_0x165f4a[_0xe02c('0x43')]=_[_0xe02c('0x3a')](_0x165f4a[_0xe02c('0x37')],_0x165f4a[_0xe02c('0x38')]);_0x12ca0e[_0xe02c('0x3b')]=_[_0xe02c('0x3a')](_0x165f4a[_0xe02c('0x37')],qs[_0xe02c('0x3c')](_0x1719cf[_0xe02c('0x38')]['fields']));_0x12ca0e[_0xe02c('0x3b')]=_0x12ca0e[_0xe02c('0x3b')][_0xe02c('0x3d')]?_0x12ca0e[_0xe02c('0x3b')]:_0x165f4a[_0xe02c('0x37')];if(_0x1719cf[_0xe02c('0x38')][_0xe02c('0x48')]){_0x12ca0e[_0xe02c('0x49')]=[{'all':!![]}];}_0x12ca0e=_[_0xe02c('0x46')]({},_0x12ca0e,_0x1719cf[_0xe02c('0x47')]);return db[_0xe02c('0x33')][_0xe02c('0x4d')](_0x12ca0e)[_0xe02c('0x28')](handleEntityNotFound(_0x24d506,null))['then'](respondWithResult(_0x24d506,null))[_0xe02c('0x4a')](handleError(_0x24d506,null));};exports['create']=function(_0x15b05c,_0x324911){return db[_0xe02c('0x33')][_0xe02c('0x4e')](_0x15b05c[_0xe02c('0x4f')],{})[_0xe02c('0x28')](function(_0x160969){var _0xc2b5dd=_0x15b05c[_0xe02c('0x50')][_0xe02c('0x51')]({'plain':!![]});if(!_0xc2b5dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc2b5dd[_0xe02c('0x52')]===_0xe02c('0x50')){var _0xeb4214=_0x160969['get']({'plain':!![]});var _0xdab6cb='Voicemails';return db[_0xe02c('0x53')]['find']({'where':{'name':_0xdab6cb,'userProfileId':_0xc2b5dd['userProfileId']},'raw':!![]})['then'](function(_0x55cf99){if(_0x55cf99&&_0x55cf99['autoAssociation']===0x0){return db['UserProfileResource'][_0xe02c('0x4e')]({'name':_0xeb4214[_0xe02c('0x2f')],'resourceId':_0xeb4214['id'],'type':_0x55cf99[_0xe02c('0x2f')],'sectionId':_0x55cf99['id']},{})[_0xe02c('0x28')](function(){return _0x160969;});}else{return _0x160969;}})['catch'](function(_0x274beb){logger[_0xe02c('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x274beb);throw _0x274beb;});}return _0x160969;})[_0xe02c('0x28')](respondWithResult(_0x324911,0xc9))[_0xe02c('0x4a')](handleError(_0x324911,null));};exports[_0xe02c('0x27')]=function(_0x51f940,_0x57a00f){if(_0x51f940[_0xe02c('0x4f')]['id']){delete _0x51f940[_0xe02c('0x4f')]['id'];}return db[_0xe02c('0x33')]['find']({'where':{'id':_0x51f940[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x57a00f,null))['then'](saveUpdates(_0x51f940[_0xe02c('0x4f')],null))[_0xe02c('0x28')](respondWithResult(_0x57a00f,null))['catch'](handleError(_0x57a00f,null));};exports[_0xe02c('0x29')]=function(_0x849eea,_0x1ead72){return db['VoiceMail'][_0xe02c('0x4d')]({'where':{'id':_0x849eea[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ead72,null))[_0xe02c('0x28')](removeEntity(_0x1ead72,null))[_0xe02c('0x4a')](handleError(_0x1ead72,null));};exports[_0xe02c('0x54')]=function(_0x1c7206,_0x446c71,_0x188046){return db[_0xe02c('0x33')][_0xe02c('0x55')]({'where':{'id':_0x1c7206[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x446c71,null))['then'](function(_0x47f61c){var _0x130fca;var _0x299770={},_0x42f2fd={};_0x42f2fd['model']=_['keys'](db[_0xe02c('0x56')][_0xe02c('0x34')]);_0x42f2fd[_0xe02c('0x38')]=_[_0xe02c('0x39')](_0x1c7206[_0xe02c('0x38')]);_0x42f2fd['filters']=_[_0xe02c('0x3a')](_0x42f2fd[_0xe02c('0x37')],_0x42f2fd['query']);_0x299770['attributes']=_[_0xe02c('0x3a')](_0x42f2fd['model'],qs['fields'](_0x1c7206['query'][_0xe02c('0x3c')]));_0x299770[_0xe02c('0x3b')]=_0x299770[_0xe02c('0x3b')][_0xe02c('0x3d')]?_0x299770[_0xe02c('0x3b')]:_0x42f2fd[_0xe02c('0x37')];if(!_0x1c7206['query'][_0xe02c('0x3e')]('nolimit')){_0x299770['limit']=qs[_0xe02c('0x21')](_0x1c7206[_0xe02c('0x38')][_0xe02c('0x21')]);_0x299770[_0xe02c('0x1e')]=qs['offset'](_0x1c7206[_0xe02c('0x38')][_0xe02c('0x1e')]);}_0x299770['order']=qs[_0xe02c('0x40')](_0x1c7206[_0xe02c('0x38')]['sort']);_0x299770[_0xe02c('0x41')]=qs[_0xe02c('0x43')](_[_0xe02c('0x42')](_0x1c7206[_0xe02c('0x38')],_0x42f2fd[_0xe02c('0x43')]));if(_0x1c7206[_0xe02c('0x38')][_0xe02c('0x44')]){_0x299770['where']=_[_0xe02c('0x46')](_0x299770['where'],{'$or':_['map'](_0x299770['attributes'],function(_0x3a4dd3){var _0x9b3be5={};_0x9b3be5[_0x3a4dd3]={'$like':'%'+_0x1c7206[_0xe02c('0x38')][_0xe02c('0x44')]+'%'};return _0x9b3be5;})});}_0x299770['where']=_[_0xe02c('0x46')](_0x299770[_0xe02c('0x41')],{'mailboxuser':_0x47f61c['mailbox']});_0x299770=_['merge']({},_0x299770,_0x1c7206['options']);return db[_0xe02c('0x56')][_0xe02c('0x57')](_0x299770)['then'](respondWithFilteredResult(_0x446c71,_0x299770));})['catch'](handleError(_0x446c71,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index fef05ef..0dca1bf 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 _0x898d=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','exports','define','mailbox_context','context','lodash'];(function(_0x1565b6,_0x25fdb5){var _0x4cebd8=function(_0x339cf9){while(--_0x339cf9){_0x1565b6['push'](_0x1565b6['shift']());}};_0x4cebd8(++_0x25fdb5);}(_0x898d,0xed));var _0xd898=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0x898d[_0x3cbe1c];return _0x5ee08b;};'use strict';var _=require(_0xd898('0x0'));var util=require(_0xd898('0x1'));var logger=require(_0xd898('0x2'))(_0xd898('0x3'));var moment=require(_0xd898('0x4'));var BPromise=require(_0xd898('0x5'));var rp=require(_0xd898('0x6'));var fs=require('fs');var path=require(_0xd898('0x7'));var rimraf=require('rimraf');var config=require(_0xd898('0x8'));var attributes=require(_0xd898('0x9'));module[_0xd898('0xa')]=function(_0x49ac7e,_0x3559ff){return _0x49ac7e[_0xd898('0xb')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xd898('0xc'),'fields':['mailbox',_0xd898('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2901=['context','util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','voice_voicemail','mailbox_context','mailbox'];(function(_0x2abf7f,_0x23b05a){var _0x248bce=function(_0x4c836d){while(--_0x4c836d){_0x2abf7f['push'](_0x2abf7f['shift']());}};_0x248bce(++_0x23b05a);}(_0x2901,0x139));var _0x1290=function(_0x4c4be2,_0x103ad5){_0x4c4be2=_0x4c4be2-0x0;var _0x1ba56f=_0x2901[_0x4c4be2];return _0x1ba56f;};'use strict';var _=require('lodash');var util=require(_0x1290('0x0'));var logger=require(_0x1290('0x1'))(_0x1290('0x2'));var moment=require(_0x1290('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1290('0x4'));var rimraf=require(_0x1290('0x5'));var config=require(_0x1290('0x6'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x1ed662,_0x31d940){return _0x1ed662[_0x1290('0x7')]('VoiceMail',attributes,{'tableName':_0x1290('0x8'),'paranoid':![],'indexes':[{'name':_0x1290('0x9'),'fields':[_0x1290('0xa'),_0x1290('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 b293750..d8992c2 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 _0x0bcf=['../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x263d5b,_0x506119){var _0x3ea2e1=function(_0x416895){while(--_0x416895){_0x263d5b['push'](_0x263d5b['shift']());}};_0x3ea2e1(++_0x506119);}(_0x0bcf,0x1af));var _0xf0bc=function(_0x4fd375,_0x5b255c){_0x4fd375=_0x4fd375-0x0;var _0x3f74e8=_0x0bcf[_0x4fd375];return _0x3f74e8;};'use strict';var _=require(_0xf0bc('0x0'));var util=require(_0xf0bc('0x1'));var moment=require(_0xf0bc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0bc('0x3'))['db'];var utils=require(_0xf0bc('0x4'));var logger=require(_0xf0bc('0x5'))('rpc');var config=require(_0xf0bc('0x6'));var jayson=require(_0xf0bc('0x7'));var client=jayson['client'][_0xf0bc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51a221,_0x9d48fb,_0x10c7a6){return new BPromise(function(_0xc9e2d8,_0x1a91fd){return client[_0xf0bc('0x9')](_0x51a221,_0x10c7a6)[_0xf0bc('0xa')](function(_0x583fe5){logger[_0xf0bc('0xb')](_0xf0bc('0xc'),_0x9d48fb,'request\x20sent');logger[_0xf0bc('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x9d48fb,_0xf0bc('0xe'),JSON[_0xf0bc('0xf')](_0x583fe5));if(_0x583fe5['error']){if(_0x583fe5[_0xf0bc('0x10')]['code']===0x1f4){logger['error'](_0xf0bc('0xc'),_0x9d48fb,_0x583fe5['error'][_0xf0bc('0x11')]);return _0x1a91fd(_0x583fe5[_0xf0bc('0x10')][_0xf0bc('0x11')]);}logger[_0xf0bc('0x10')](_0xf0bc('0xc'),_0x9d48fb,_0x583fe5['error']['message']);return _0xc9e2d8(_0x583fe5['error'][_0xf0bc('0x11')]);}else{logger[_0xf0bc('0xb')](_0xf0bc('0xc'),_0x9d48fb,'request\x20sent');_0xc9e2d8(_0x583fe5['result'][_0xf0bc('0x11')]);}})[_0xf0bc('0x12')](function(_0x253d1e){logger[_0xf0bc('0x10')](_0xf0bc('0xc'),_0x9d48fb,_0x253d1e);_0x1a91fd(_0x253d1e);});});} \ No newline at end of file +var _0x2e04=['VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2e04,0x1ea));var _0x42e0=function(_0x27058e,_0x5449e1){_0x27058e=_0x27058e-0x0;var _0x557a40=_0x2e04[_0x27058e];return _0x557a40;};'use strict';var _=require('lodash');var util=require(_0x42e0('0x0'));var moment=require(_0x42e0('0x1'));var BPromise=require(_0x42e0('0x2'));var rs=require(_0x42e0('0x3'));var fs=require('fs');var Redis=require(_0x42e0('0x4'));var db=require(_0x42e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x42e0('0x6'))(_0x42e0('0x7'));var config=require(_0x42e0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x42e0('0x9')][_0x42e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a8164,_0x284a26,_0x1346da){return new BPromise(function(_0x3ad1f1,_0x53357f){return client['request'](_0x4a8164,_0x1346da)[_0x42e0('0xb')](function(_0x29e4fa){logger[_0x42e0('0xc')](_0x42e0('0xd'),_0x284a26,_0x42e0('0xe'));logger[_0x42e0('0xf')](_0x42e0('0x10'),_0x284a26,_0x42e0('0xe'),JSON[_0x42e0('0x11')](_0x29e4fa));if(_0x29e4fa[_0x42e0('0x12')]){if(_0x29e4fa[_0x42e0('0x12')][_0x42e0('0x13')]===0x1f4){logger[_0x42e0('0x12')]('VoiceMail,\x20%s,\x20%s',_0x284a26,_0x29e4fa['error']['message']);return _0x53357f(_0x29e4fa[_0x42e0('0x12')]['message']);}logger[_0x42e0('0x12')](_0x42e0('0xd'),_0x284a26,_0x29e4fa[_0x42e0('0x12')][_0x42e0('0x14')]);return _0x3ad1f1(_0x29e4fa[_0x42e0('0x12')][_0x42e0('0x14')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x284a26,_0x42e0('0xe'));_0x3ad1f1(_0x29e4fa['result'][_0x42e0('0x14')]);}})[_0x42e0('0x15')](function(_0x5398cb){logger[_0x42e0('0x12')](_0x42e0('0xd'),_0x284a26,_0x5398cb);_0x53357f(_0x5398cb);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index c24750b..9ffa26a 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 _0x3fe8=['update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','put'];(function(_0x102701,_0x12ee46){var _0x172a35=function(_0x53b275){while(--_0x53b275){_0x102701['push'](_0x102701['shift']());}};_0x172a35(++_0x12ee46);}(_0x3fe8,0x135));var _0x83fe=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0x3fe8[_0x3fd3a3];return _0xa3e4d5;};'use strict';var multer=require(_0x83fe('0x0'));var util=require(_0x83fe('0x1'));var path=require(_0x83fe('0x2'));var timeout=require(_0x83fe('0x3'));var express=require('express');var router=express[_0x83fe('0x4')]();var fs_extra=require(_0x83fe('0x5'));var auth=require(_0x83fe('0x6'));var interaction=require(_0x83fe('0x7'));var config=require(_0x83fe('0x8'));var controller=require('./voiceMailMessage.controller');router[_0x83fe('0x9')]('/',auth[_0x83fe('0xa')](),controller[_0x83fe('0xb')]);router['get'](_0x83fe('0xc'),auth['isAuthenticated'](),controller[_0x83fe('0xd')]);router[_0x83fe('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x83fe('0xe')](_0x83fe('0xc'),auth['isAuthenticated'](),controller[_0x83fe('0xf')]);router[_0x83fe('0x10')](_0x83fe('0xc'),auth['isAuthenticated'](),controller[_0x83fe('0x11')]);module['exports']=router; \ No newline at end of file +var _0x023b=['../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','/:id/download','download','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x023b,0x112));var _0xb023=function(_0x3bf984,_0x42b0b3){_0x3bf984=_0x3bf984-0x0;var _0x41e695=_0x023b[_0x3bf984];return _0x41e695;};'use strict';var multer=require(_0xb023('0x0'));var util=require('util');var path=require(_0xb023('0x1'));var timeout=require('connect-timeout');var express=require(_0xb023('0x2'));var router=express[_0xb023('0x3')]();var fs_extra=require(_0xb023('0x4'));var auth=require(_0xb023('0x5'));var interaction=require(_0xb023('0x6'));var config=require('../../config/environment');var controller=require(_0xb023('0x7'));router['get']('/',auth[_0xb023('0x8')](),controller[_0xb023('0x9')]);router[_0xb023('0xa')](_0xb023('0xb'),auth[_0xb023('0x8')](),controller['show']);router['get'](_0xb023('0xc'),auth[_0xb023('0x8')](),controller[_0xb023('0xd')]);router['post']('/',auth[_0xb023('0x8')](),controller[_0xb023('0xe')]);router[_0xb023('0xf')]('/:id',auth[_0xb023('0x8')](),controller[_0xb023('0x10')]);router[_0xb023('0x11')](_0xb023('0xb'),auth['isAuthenticated'](),controller[_0xb023('0x12')]);module[_0xb023('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index d58fac3..9a75de5 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 _0x0afd=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0x0afd,0x130));var _0xd0af=function(_0x8cc8d3,_0x1abb42){_0x8cc8d3=_0x8cc8d3-0x0;var _0x2dc3ca=_0x0afd[_0x8cc8d3];return _0x2dc3ca;};'use strict';var Sequelize=require(_0xd0af('0x0'));module['exports']={'name':{'type':Sequelize[_0xd0af('0x1')],'get':function(_0xf42fec){return this[_0xd0af('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xd0af('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd0af('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xd0af('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xd0af('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xd0af('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd0af('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xd0af('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xd0af('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xd0af('0x5')](_0xd0af('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xd0af('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xd0af('0x7'),'defaultValue':Sequelize['literal'](_0xd0af('0x8'))}}; \ No newline at end of file +var _0x8bdc=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','INTEGER','STRING','literal'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0x8bdc,0x1f3));var _0xc8bd=function(_0x5aaa81,_0x43c5fe){_0x5aaa81=_0x5aaa81-0x0;var _0xf68e50=_0x8bdc[_0x5aaa81];return _0xf68e50;};'use strict';var Sequelize=require(_0xc8bd('0x0'));module[_0xc8bd('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x23e350){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xc8bd('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc8bd('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xc8bd('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xc8bd('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xc8bd('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xc8bd('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xc8bd('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc8bd('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xc8bd('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xc8bd('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xc8bd('0x4')](_0xc8bd('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index b03e530..a73d434 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 _0x5aa3=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','map','VoiceMailMessage','fieldName','key','differenceBy','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','create','body','find','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service'];(function(_0x21b974,_0x80274e){var _0x83183a=function(_0x51ddb0){while(--_0x51ddb0){_0x21b974['push'](_0x21b974['shift']());}};_0x83183a(++_0x80274e);}(_0x5aa3,0xe2));var _0x35aa=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x5aa3[_0x4c445a];return _0x2f611c;};'use strict';var emlformat=require(_0x35aa('0x0'));var rimraf=require(_0x35aa('0x1'));var zipdir=require(_0x35aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35aa('0x3'));var moment=require(_0x35aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x35aa('0x5'));var util=require(_0x35aa('0x6'));var path=require(_0x35aa('0x7'));var sox=require(_0x35aa('0x8'));var csv=require(_0x35aa('0x9'));var ejs=require(_0x35aa('0xa'));var fs=require('fs');var fs_extra=require(_0x35aa('0xb'));var _=require(_0x35aa('0xc'));var squel=require(_0x35aa('0xd'));var crypto=require(_0x35aa('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x35aa('0x9'));var querystring=require(_0x35aa('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x35aa('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x35aa('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35aa('0x12'))(_0x35aa('0x13'));var utils=require(_0x35aa('0x14'));var config=require(_0x35aa('0x15'));var licenseUtil=require(_0x35aa('0x16'));var db=require(_0x35aa('0x17'))['db'];function respondWithStatusCode(_0x524f71,_0x416057){_0x416057=_0x416057||0xcc;return function(_0xa77553){if(_0xa77553){return _0x524f71[_0x35aa('0x18')](_0x416057);}return _0x524f71['status'](_0x416057)[_0x35aa('0x19')]();};}function respondWithResult(_0x588c56,_0x269bd6){_0x269bd6=_0x269bd6||0xc8;return function(_0x6eb9af){if(_0x6eb9af){return _0x588c56[_0x35aa('0x1a')](_0x269bd6)[_0x35aa('0x1b')](_0x6eb9af);}};}function respondWithFilteredResult(_0x3ed4b3,_0x446412){return function(_0x19dbf3){if(_0x19dbf3){var _0x40f777=typeof _0x446412[_0x35aa('0x1c')]===_0x35aa('0x1d')&&typeof _0x446412['limit']===_0x35aa('0x1d');var _0x1ee97e=_0x19dbf3[_0x35aa('0x1e')];var _0x3f86cb=_0x40f777?0x0:_0x446412['offset'];var _0x34befa=_0x40f777?_0x19dbf3['count']:_0x446412['offset']+_0x446412[_0x35aa('0x1f')];var _0x54392c;if(_0x34befa>=_0x1ee97e){_0x34befa=_0x1ee97e;_0x54392c=0xc8;}else{_0x54392c=0xce;}_0x3ed4b3[_0x35aa('0x1a')](_0x54392c);return _0x3ed4b3[_0x35aa('0x20')](_0x35aa('0x21'),_0x3f86cb+'-'+_0x34befa+'/'+_0x1ee97e)[_0x35aa('0x1b')](_0x19dbf3);}return null;};}function patchUpdates(_0xd09075){return function(_0x5502ca){try{jsonpatch[_0x35aa('0x22')](_0x5502ca,_0xd09075,!![]);}catch(_0x4f590f){return BPromise['reject'](_0x4f590f);}return _0x5502ca[_0x35aa('0x23')]();};}function saveUpdates(_0x2081cd,_0xc81d8e){return function(_0x540a03){if(_0x540a03){return _0x540a03[_0x35aa('0x24')](_0x2081cd)[_0x35aa('0x25')](function(_0x314f9b){return _0x314f9b;});}return null;};}function removeEntity(_0x4a80f3,_0x3b51c8){return function(_0x28d684){if(_0x28d684){return _0x28d684[_0x35aa('0x26')]()[_0x35aa('0x25')](function(){_0x4a80f3[_0x35aa('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c2f24,_0x1f618e){return function(_0x512adf){if(!_0x512adf){_0x2c2f24['sendStatus'](0x194);}return _0x512adf;};}function handleError(_0x150775,_0x4e84d7){_0x4e84d7=_0x4e84d7||0x1f4;return function(_0x3ba114){logger[_0x35aa('0x27')](_0x3ba114['stack']);if(_0x3ba114[_0x35aa('0x28')]){delete _0x3ba114[_0x35aa('0x28')];}_0x150775[_0x35aa('0x1a')](_0x4e84d7)[_0x35aa('0x29')](_0x3ba114);};}exports['index']=function(_0x2e10bf,_0xd45ba4){var _0x4618d4={},_0x152814={},_0x564193={'count':0x0,'rows':[]};var _0x66977c=_[_0x35aa('0x2a')](db[_0x35aa('0x2b')]['rawAttributes'],function(_0x26800f){return{'name':_0x26800f[_0x35aa('0x2c')],'type':_0x26800f['type'][_0x35aa('0x2d')]};});_0x152814['model']=_[_0x35aa('0x2e')](_['map'](_0x66977c,_0x35aa('0x28')),['name']);_0x152814[_0x35aa('0x2f')]=_[_0x35aa('0x30')](_0x2e10bf['query']);_0x152814[_0x35aa('0x31')]=_[_0x35aa('0x32')](_0x152814['model'],_0x152814[_0x35aa('0x2f')]);_0x4618d4[_0x35aa('0x33')]=_[_0x35aa('0x32')](_0x152814[_0x35aa('0x34')],qs[_0x35aa('0x35')](_0x2e10bf[_0x35aa('0x2f')][_0x35aa('0x35')]));_0x4618d4[_0x35aa('0x33')]=_0x4618d4['attributes'][_0x35aa('0x36')]?_0x4618d4[_0x35aa('0x33')]:_0x152814[_0x35aa('0x34')];if(!_0x2e10bf[_0x35aa('0x2f')][_0x35aa('0x37')](_0x35aa('0x38'))){_0x4618d4[_0x35aa('0x1f')]=qs[_0x35aa('0x1f')](_0x2e10bf[_0x35aa('0x2f')][_0x35aa('0x1f')]);_0x4618d4[_0x35aa('0x1c')]=qs[_0x35aa('0x1c')](_0x2e10bf[_0x35aa('0x2f')]['offset']);}_0x4618d4['order']=qs[_0x35aa('0x39')](_0x2e10bf[_0x35aa('0x2f')]['sort']);_0x4618d4[_0x35aa('0x3a')]=qs[_0x35aa('0x31')](_[_0x35aa('0x3b')](_0x2e10bf[_0x35aa('0x2f')],_0x152814[_0x35aa('0x31')]),_0x66977c);if(_0x2e10bf[_0x35aa('0x2f')][_0x35aa('0x3c')]){_0x4618d4[_0x35aa('0x3a')]=_[_0x35aa('0x3d')](_0x4618d4[_0x35aa('0x3a')],{'$or':_[_0x35aa('0x2a')](_0x66977c,function(_0x1412bf){if(_0x1412bf['type']!==_0x35aa('0x3e')){var _0x58a9f3={};_0x58a9f3[_0x1412bf[_0x35aa('0x28')]]={'$like':'%'+_0x2e10bf['query'][_0x35aa('0x3c')]+'%'};return _0x58a9f3;}})});}_0x4618d4=_[_0x35aa('0x3d')]({},_0x4618d4,_0x2e10bf[_0x35aa('0x3f')]);var _0x3f6264={'where':_0x4618d4['where']};return db[_0x35aa('0x2b')][_0x35aa('0x1e')](_0x3f6264)[_0x35aa('0x25')](function(_0x52a60f){_0x564193['count']=_0x52a60f;if(_0x2e10bf[_0x35aa('0x2f')]['includeAll']){_0x4618d4[_0x35aa('0x40')]=[{'all':!![]}];}return db[_0x35aa('0x2b')]['findAll'](_0x4618d4);})['then'](function(_0x590992){_0x564193[_0x35aa('0x41')]=_0x590992;return _0x564193;})[_0x35aa('0x25')](respondWithFilteredResult(_0xd45ba4,_0x4618d4))[_0x35aa('0x42')](handleError(_0xd45ba4,null));};exports[_0x35aa('0x43')]=function(_0x123dff,_0x2a04fe){var _0x2dea0d={'raw':!![],'where':{'id':_0x123dff[_0x35aa('0x44')]['id']}},_0x1315a7={};_0x1315a7[_0x35aa('0x34')]=_[_0x35aa('0x30')](db[_0x35aa('0x2b')][_0x35aa('0x45')]);_0x1315a7['query']=_[_0x35aa('0x30')](_0x123dff['query']);_0x1315a7[_0x35aa('0x31')]=_[_0x35aa('0x32')](_0x1315a7[_0x35aa('0x34')],_0x1315a7[_0x35aa('0x2f')]);_0x2dea0d[_0x35aa('0x33')]=_[_0x35aa('0x32')](_0x1315a7['model'],qs['fields'](_0x123dff[_0x35aa('0x2f')][_0x35aa('0x35')]));_0x2dea0d['attributes']=_0x2dea0d[_0x35aa('0x33')][_0x35aa('0x36')]?_0x2dea0d['attributes']:_0x1315a7[_0x35aa('0x34')];if(_0x123dff['query']['includeAll']){_0x2dea0d[_0x35aa('0x40')]=[{'all':!![]}];}_0x2dea0d=_[_0x35aa('0x3d')]({},_0x2dea0d,_0x123dff['options']);return db[_0x35aa('0x2b')]['find'](_0x2dea0d)[_0x35aa('0x25')](handleEntityNotFound(_0x2a04fe,null))[_0x35aa('0x25')](respondWithResult(_0x2a04fe,null))['catch'](handleError(_0x2a04fe,null));};exports[_0x35aa('0x46')]=function(_0x519e83,_0xf6fbe){return db[_0x35aa('0x2b')]['create'](_0x519e83[_0x35aa('0x47')],{})[_0x35aa('0x25')](respondWithResult(_0xf6fbe,0xc9))[_0x35aa('0x42')](handleError(_0xf6fbe,null));};exports[_0x35aa('0x24')]=function(_0x4ce514,_0x2c8140){if(_0x4ce514[_0x35aa('0x47')]['id']){delete _0x4ce514[_0x35aa('0x47')]['id'];}return db[_0x35aa('0x2b')][_0x35aa('0x48')]({'where':{'id':_0x4ce514[_0x35aa('0x44')]['id']}})[_0x35aa('0x25')](handleEntityNotFound(_0x2c8140,null))[_0x35aa('0x25')](saveUpdates(_0x4ce514['body'],null))[_0x35aa('0x25')](respondWithResult(_0x2c8140,null))[_0x35aa('0x42')](handleError(_0x2c8140,null));};exports[_0x35aa('0x26')]=function(_0x2c3835,_0x520c4c){return db[_0x35aa('0x2b')]['find']({'where':{'id':_0x2c3835[_0x35aa('0x44')]['id']}})[_0x35aa('0x25')](handleEntityNotFound(_0x520c4c,null))['then'](removeEntity(_0x520c4c,null))[_0x35aa('0x42')](handleError(_0x520c4c,null));};exports['download']=function(_0x196c28,_0x4c427c,_0x265021){return db[_0x35aa('0x2b')][_0x35aa('0x48')]({'where':{'id':_0x196c28['params']['id']},'attributes':['id',_0x35aa('0x49'),'msg_id']})['then'](handleEntityNotFound(_0x4c427c,null))['then'](function(_0x31ab46){if(_0x31ab46){if(!_0x31ab46[_0x35aa('0x49')]){throw new db[(_0x35aa('0x4a'))]['ValidationError'](_0x35aa('0x4b'));}var _0x40ca70={'Content-Type':_0x35aa('0x4c'),'Content-Disposition':_0x35aa('0x4d')};if(_0x31ab46['msg_id']){_0x40ca70[_0x35aa('0x4e')]=_0x35aa('0x4f')+_0x31ab46['msg_id']+_0x35aa('0x50');}_0x4c427c[_0x35aa('0x20')](_0x40ca70);return _0x4c427c[_0x35aa('0x29')](new Buffer(_0x31ab46[_0x35aa('0x49')]));}})[_0x35aa('0x42')](handleError(_0x4c427c,null));}; \ No newline at end of file +var _0x3398=['hasOwnProperty','order','sort','filter','where','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','recording','Sequelize','VoiceMailMessage\x20not\x20found','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','name','query','keys','filters','intersection','attributes','fields'];(function(_0x47a40b,_0x443ecf){var _0x19610c=function(_0x4b8ce1){while(--_0x4b8ce1){_0x47a40b['push'](_0x47a40b['shift']());}};_0x19610c(++_0x443ecf);}(_0x3398,0xc4));var _0x8339=function(_0xdc4ed6,_0x5c1650){_0xdc4ed6=_0xdc4ed6-0x0;var _0x4c4d55=_0x3398[_0xdc4ed6];return _0x4c4d55;};'use strict';var emlformat=require(_0x8339('0x0'));var rimraf=require(_0x8339('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8339('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8339('0x3'));var Mustache=require(_0x8339('0x4'));var util=require(_0x8339('0x5'));var path=require(_0x8339('0x6'));var sox=require(_0x8339('0x7'));var csv=require(_0x8339('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8339('0x9'));var squel=require(_0x8339('0xa'));var crypto=require(_0x8339('0xb'));var jsforce=require(_0x8339('0xc'));var deskjs=require(_0x8339('0xd'));var toCsv=require(_0x8339('0x8'));var querystring=require(_0x8339('0xe'));var Papa=require(_0x8339('0xf'));var Redis=require(_0x8339('0x10'));var authService=require(_0x8339('0x11'));var qs=require(_0x8339('0x12'));var as=require(_0x8339('0x13'));var hardwareService=require(_0x8339('0x14'));var logger=require(_0x8339('0x15'))(_0x8339('0x16'));var utils=require(_0x8339('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8339('0x18'));var db=require(_0x8339('0x19'))['db'];function respondWithStatusCode(_0x1c38c3,_0x235470){_0x235470=_0x235470||0xcc;return function(_0x2a7b0d){if(_0x2a7b0d){return _0x1c38c3[_0x8339('0x1a')](_0x235470);}return _0x1c38c3['status'](_0x235470)[_0x8339('0x1b')]();};}function respondWithResult(_0x140ef6,_0x2153d1){_0x2153d1=_0x2153d1||0xc8;return function(_0x5569a6){if(_0x5569a6){return _0x140ef6[_0x8339('0x1c')](_0x2153d1)['json'](_0x5569a6);}};}function respondWithFilteredResult(_0xa052a8,_0x161950){return function(_0x30d51a){if(_0x30d51a){var _0x1bdcc8=typeof _0x161950[_0x8339('0x1d')]===_0x8339('0x1e')&&typeof _0x161950[_0x8339('0x1f')]===_0x8339('0x1e');var _0x3bd2d5=_0x30d51a[_0x8339('0x20')];var _0x53c18a=_0x1bdcc8?0x0:_0x161950[_0x8339('0x1d')];var _0x5af975=_0x1bdcc8?_0x30d51a[_0x8339('0x20')]:_0x161950[_0x8339('0x1d')]+_0x161950['limit'];var _0x133ffd;if(_0x5af975>=_0x3bd2d5){_0x5af975=_0x3bd2d5;_0x133ffd=0xc8;}else{_0x133ffd=0xce;}_0xa052a8['status'](_0x133ffd);return _0xa052a8[_0x8339('0x21')]('Content-Range',_0x53c18a+'-'+_0x5af975+'/'+_0x3bd2d5)[_0x8339('0x22')](_0x30d51a);}return null;};}function patchUpdates(_0xe67e4e){return function(_0x1f17e8){try{jsonpatch[_0x8339('0x23')](_0x1f17e8,_0xe67e4e,!![]);}catch(_0x30d011){return BPromise[_0x8339('0x24')](_0x30d011);}return _0x1f17e8[_0x8339('0x25')]();};}function saveUpdates(_0x1dea7e,_0x5f2dbd){return function(_0x54bc1b){if(_0x54bc1b){return _0x54bc1b[_0x8339('0x26')](_0x1dea7e)[_0x8339('0x27')](function(_0x4af83e){return _0x4af83e;});}return null;};}function removeEntity(_0x2e878b,_0x13b465){return function(_0x5cb25b){if(_0x5cb25b){return _0x5cb25b[_0x8339('0x28')]()[_0x8339('0x27')](function(){_0x2e878b[_0x8339('0x1c')](0xcc)[_0x8339('0x1b')]();});}};}function handleEntityNotFound(_0x24c4fd,_0x5bc7e9){return function(_0x2ef8ed){if(!_0x2ef8ed){_0x24c4fd[_0x8339('0x1a')](0x194);}return _0x2ef8ed;};}function handleError(_0x43f8f3,_0xd879d){_0xd879d=_0xd879d||0x1f4;return function(_0x55a095){logger[_0x8339('0x29')](_0x55a095[_0x8339('0x2a')]);if(_0x55a095['name']){delete _0x55a095['name'];}_0x43f8f3['status'](_0xd879d)['send'](_0x55a095);};}exports[_0x8339('0x2b')]=function(_0x144142,_0x2553a0){var _0x3f28e5={},_0x524c09={},_0x592a7e={'count':0x0,'rows':[]};var _0x19bf15=_[_0x8339('0x2c')](db[_0x8339('0x2d')][_0x8339('0x2e')],function(_0xe66ffb){return{'name':_0xe66ffb[_0x8339('0x2f')],'type':_0xe66ffb[_0x8339('0x30')][_0x8339('0x31')]};});_0x524c09[_0x8339('0x32')]=_[_0x8339('0x33')](_[_0x8339('0x2c')](_0x19bf15,_0x8339('0x34')),[_0x8339('0x34')]);_0x524c09[_0x8339('0x35')]=_[_0x8339('0x36')](_0x144142['query']);_0x524c09[_0x8339('0x37')]=_[_0x8339('0x38')](_0x524c09['model'],_0x524c09[_0x8339('0x35')]);_0x3f28e5[_0x8339('0x39')]=_[_0x8339('0x38')](_0x524c09['model'],qs[_0x8339('0x3a')](_0x144142[_0x8339('0x35')][_0x8339('0x3a')]));_0x3f28e5[_0x8339('0x39')]=_0x3f28e5['attributes']['length']?_0x3f28e5[_0x8339('0x39')]:_0x524c09['model'];if(!_0x144142[_0x8339('0x35')][_0x8339('0x3b')]('nolimit')){_0x3f28e5[_0x8339('0x1f')]=qs['limit'](_0x144142['query'][_0x8339('0x1f')]);_0x3f28e5['offset']=qs['offset'](_0x144142[_0x8339('0x35')][_0x8339('0x1d')]);}_0x3f28e5[_0x8339('0x3c')]=qs[_0x8339('0x3d')](_0x144142[_0x8339('0x35')][_0x8339('0x3d')]);_0x3f28e5['where']=qs['filters'](_['pick'](_0x144142[_0x8339('0x35')],_0x524c09[_0x8339('0x37')]),_0x19bf15);if(_0x144142['query'][_0x8339('0x3e')]){_0x3f28e5[_0x8339('0x3f')]=_[_0x8339('0x40')](_0x3f28e5[_0x8339('0x3f')],{'$or':_[_0x8339('0x2c')](_0x19bf15,function(_0x419f31){if(_0x419f31['type']!=='VIRTUAL'){var _0x234aa4={};_0x234aa4[_0x419f31[_0x8339('0x34')]]={'$like':'%'+_0x144142[_0x8339('0x35')][_0x8339('0x3e')]+'%'};return _0x234aa4;}})});}_0x3f28e5=_[_0x8339('0x40')]({},_0x3f28e5,_0x144142[_0x8339('0x41')]);var _0x1bce4a={'where':_0x3f28e5[_0x8339('0x3f')]};return db[_0x8339('0x2d')]['count'](_0x1bce4a)[_0x8339('0x27')](function(_0x149a1e){_0x592a7e[_0x8339('0x20')]=_0x149a1e;if(_0x144142[_0x8339('0x35')][_0x8339('0x42')]){_0x3f28e5[_0x8339('0x43')]=[{'all':!![]}];}return db[_0x8339('0x2d')][_0x8339('0x44')](_0x3f28e5);})[_0x8339('0x27')](function(_0x22789d){_0x592a7e['rows']=_0x22789d;return _0x592a7e;})[_0x8339('0x27')](respondWithFilteredResult(_0x2553a0,_0x3f28e5))[_0x8339('0x45')](handleError(_0x2553a0,null));};exports[_0x8339('0x46')]=function(_0x59f4a4,_0x299093){var _0x451c9c={'raw':!![],'where':{'id':_0x59f4a4[_0x8339('0x47')]['id']}},_0x271d55={};_0x271d55[_0x8339('0x32')]=_[_0x8339('0x36')](db[_0x8339('0x2d')][_0x8339('0x2e')]);_0x271d55[_0x8339('0x35')]=_[_0x8339('0x36')](_0x59f4a4['query']);_0x271d55[_0x8339('0x37')]=_[_0x8339('0x38')](_0x271d55[_0x8339('0x32')],_0x271d55[_0x8339('0x35')]);_0x451c9c[_0x8339('0x39')]=_[_0x8339('0x38')](_0x271d55[_0x8339('0x32')],qs['fields'](_0x59f4a4[_0x8339('0x35')][_0x8339('0x3a')]));_0x451c9c['attributes']=_0x451c9c['attributes'][_0x8339('0x48')]?_0x451c9c[_0x8339('0x39')]:_0x271d55[_0x8339('0x32')];if(_0x59f4a4[_0x8339('0x35')][_0x8339('0x42')]){_0x451c9c[_0x8339('0x43')]=[{'all':!![]}];}_0x451c9c=_[_0x8339('0x40')]({},_0x451c9c,_0x59f4a4[_0x8339('0x41')]);return db['VoiceMailMessage'][_0x8339('0x49')](_0x451c9c)[_0x8339('0x27')](handleEntityNotFound(_0x299093,null))[_0x8339('0x27')](respondWithResult(_0x299093,null))['catch'](handleError(_0x299093,null));};exports[_0x8339('0x4a')]=function(_0x11113a,_0x495c95){return db['VoiceMailMessage'][_0x8339('0x4a')](_0x11113a['body'],{})[_0x8339('0x27')](respondWithResult(_0x495c95,0xc9))[_0x8339('0x45')](handleError(_0x495c95,null));};exports['update']=function(_0xc07b53,_0x11cf54){if(_0xc07b53[_0x8339('0x4b')]['id']){delete _0xc07b53[_0x8339('0x4b')]['id'];}return db[_0x8339('0x2d')][_0x8339('0x49')]({'where':{'id':_0xc07b53[_0x8339('0x47')]['id']}})[_0x8339('0x27')](handleEntityNotFound(_0x11cf54,null))[_0x8339('0x27')](saveUpdates(_0xc07b53['body'],null))[_0x8339('0x27')](respondWithResult(_0x11cf54,null))[_0x8339('0x45')](handleError(_0x11cf54,null));};exports['destroy']=function(_0x1ec52b,_0x1287fa){return db[_0x8339('0x2d')][_0x8339('0x49')]({'where':{'id':_0x1ec52b[_0x8339('0x47')]['id']}})[_0x8339('0x27')](handleEntityNotFound(_0x1287fa,null))[_0x8339('0x27')](removeEntity(_0x1287fa,null))['catch'](handleError(_0x1287fa,null));};exports['download']=function(_0x507802,_0xc0711a,_0x2653f3){return db[_0x8339('0x2d')]['find']({'where':{'id':_0x507802['params']['id']},'attributes':['id','recording','msg_id']})[_0x8339('0x27')](handleEntityNotFound(_0xc0711a,null))[_0x8339('0x27')](function(_0x26e87c){if(_0x26e87c){if(!_0x26e87c[_0x8339('0x4c')]){throw new db[(_0x8339('0x4d'))]['ValidationError'](_0x8339('0x4e'));}var _0x3ce00b={'Content-Type':'audio/wav','Content-Disposition':_0x8339('0x4f')};if(_0x26e87c[_0x8339('0x50')]){_0x3ce00b[_0x8339('0x51')]=_0x8339('0x52')+_0x26e87c[_0x8339('0x50')]+_0x8339('0x53');}_0xc0711a[_0x8339('0x21')](_0x3ce00b);return _0xc0711a[_0x8339('0x54')](new Buffer(_0x26e87c[_0x8339('0x4c')]));}})['catch'](handleError(_0xc0711a,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 3d5fc64..6ff8dca 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 _0x8450=['VoiceMailMessage','voice_voicemail_messages','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x538f26,_0x33678a){var _0x26de91=function(_0x3b23d1){while(--_0x3b23d1){_0x538f26['push'](_0x538f26['shift']());}};_0x26de91(++_0x33678a);}(_0x8450,0x10a));var _0x0845=function(_0x1a6555,_0x2a8260){_0x1a6555=_0x1a6555-0x0;var _0x4afed9=_0x8450[_0x1a6555];return _0x4afed9;};'use strict';var _=require(_0x0845('0x0'));var util=require(_0x0845('0x1'));var logger=require(_0x0845('0x2'))(_0x0845('0x3'));var moment=require(_0x0845('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0845('0x5'));var rimraf=require(_0x0845('0x6'));var config=require(_0x0845('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0x0845('0x8')]=function(_0x38ebab,_0x4dcc28){return _0x38ebab['define'](_0x0845('0x9'),attributes,{'tableName':_0x0845('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x83ea=['moment','bluebird','../../config/environment','exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0x83ea,0xd9));var _0xa83e=function(_0x416e73,_0x5561fe){_0x416e73=_0x416e73-0x0;var _0x2f38d1=_0x83ea[_0x416e73];return _0x2f38d1;};'use strict';var _=require(_0xa83e('0x0'));var util=require(_0xa83e('0x1'));var logger=require(_0xa83e('0x2'))('api');var moment=require(_0xa83e('0x3'));var BPromise=require(_0xa83e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa83e('0x5'));var attributes=require('./voiceMailMessage.attributes');module[_0xa83e('0x6')]=function(_0x2b5233,_0x313585){return _0x2b5233['define'](_0xa83e('0x7'),attributes,{'tableName':_0xa83e('0x8'),'paranoid':![],'indexes':[{'name':_0xa83e('0x9'),'fields':[_0xa83e('0x9')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index b42c927..fc9e80b 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 _0x07ab=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x3d73ba,_0x356e23){var _0x47e406=function(_0x90df31){while(--_0x90df31){_0x3d73ba['push'](_0x3d73ba['shift']());}};_0x47e406(++_0x356e23);}(_0x07ab,0xce));var _0xb07a=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x07ab[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0xb07a('0x0'));var util=require(_0xb07a('0x1'));var moment=require('moment');var BPromise=require(_0xb07a('0x2'));var rs=require(_0xb07a('0x3'));var fs=require('fs');var Redis=require(_0xb07a('0x4'));var db=require(_0xb07a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb07a('0x6'))(_0xb07a('0x7'));var config=require(_0xb07a('0x8'));var jayson=require(_0xb07a('0x9'));var client=jayson['client'][_0xb07a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59e39d,_0x18bfbe,_0x234c35){return new BPromise(function(_0x13a355,_0x58f520){return client['request'](_0x59e39d,_0x234c35)[_0xb07a('0xb')](function(_0x4bb5f0){logger[_0xb07a('0xc')](_0xb07a('0xd'),_0x18bfbe,_0xb07a('0xe'));logger[_0xb07a('0xf')](_0xb07a('0x10'),_0x18bfbe,_0xb07a('0xe'),JSON[_0xb07a('0x11')](_0x4bb5f0));if(_0x4bb5f0[_0xb07a('0x12')]){if(_0x4bb5f0['error'][_0xb07a('0x13')]===0x1f4){logger[_0xb07a('0x12')](_0xb07a('0xd'),_0x18bfbe,_0x4bb5f0[_0xb07a('0x12')][_0xb07a('0x14')]);return _0x58f520(_0x4bb5f0['error'][_0xb07a('0x14')]);}logger['error'](_0xb07a('0xd'),_0x18bfbe,_0x4bb5f0[_0xb07a('0x12')][_0xb07a('0x14')]);return _0x13a355(_0x4bb5f0[_0xb07a('0x12')]['message']);}else{logger[_0xb07a('0xc')](_0xb07a('0xd'),_0x18bfbe,_0xb07a('0xe'));_0x13a355(_0x4bb5f0[_0xb07a('0x15')][_0xb07a('0x14')]);}})[_0xb07a('0x16')](function(_0x5a75c3){logger[_0xb07a('0x12')](_0xb07a('0xd'),_0x18bfbe,_0x5a75c3);_0x58f520(_0x5a75c3);});});} \ No newline at end of file +var _0x960c=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1b318e,_0x23b2b1){var _0x3c2521=function(_0xb53796){while(--_0xb53796){_0x1b318e['push'](_0x1b318e['shift']());}};_0x3c2521(++_0x23b2b1);}(_0x960c,0x1de));var _0xc960=function(_0x2ca637,_0x52ce06){_0x2ca637=_0x2ca637-0x0;var _0x9e6a84=_0x960c[_0x2ca637];return _0x9e6a84;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc960('0x0'));var BPromise=require(_0xc960('0x1'));var rs=require(_0xc960('0x2'));var fs=require('fs');var Redis=require(_0xc960('0x3'));var db=require(_0xc960('0x4'))['db'];var utils=require(_0xc960('0x5'));var logger=require(_0xc960('0x6'))('rpc');var config=require(_0xc960('0x7'));var jayson=require(_0xc960('0x8'));var client=jayson[_0xc960('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37c336,_0x5ea3b,_0x3ecb56){return new BPromise(function(_0x35e2fb,_0x208896){return client[_0xc960('0xa')](_0x37c336,_0x3ecb56)[_0xc960('0xb')](function(_0x27c2ec){logger[_0xc960('0xc')](_0xc960('0xd'),_0x5ea3b,'request\x20sent');logger[_0xc960('0xe')](_0xc960('0xf'),_0x5ea3b,_0xc960('0x10'),JSON[_0xc960('0x11')](_0x27c2ec));if(_0x27c2ec[_0xc960('0x12')]){if(_0x27c2ec[_0xc960('0x12')][_0xc960('0x13')]===0x1f4){logger[_0xc960('0x12')](_0xc960('0xd'),_0x5ea3b,_0x27c2ec['error']['message']);return _0x208896(_0x27c2ec['error'][_0xc960('0x14')]);}logger['error'](_0xc960('0xd'),_0x5ea3b,_0x27c2ec['error']['message']);return _0x35e2fb(_0x27c2ec[_0xc960('0x12')]['message']);}else{logger[_0xc960('0xc')](_0xc960('0xd'),_0x5ea3b,_0xc960('0x10'));_0x35e2fb(_0x27c2ec[_0xc960('0x15')][_0xc960('0x14')]);}})[_0xc960('0x16')](function(_0x3a4014){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x5ea3b,_0x3a4014);_0x208896(_0x3a4014);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index bc3ffa2..2d3da43 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 _0x9b8f=['addSound','update','delete','destroy','/:id/sounds/:id2','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id','show','/:id/sounds','getSounds','post'];(function(_0xe3524d,_0x409caa){var _0x296279=function(_0x2848f2){while(--_0x2848f2){_0xe3524d['push'](_0xe3524d['shift']());}};_0x296279(++_0x409caa);}(_0x9b8f,0x1d3));var _0xf9b8=function(_0x55e3d1,_0x5a8425){_0x55e3d1=_0x55e3d1-0x0;var _0x2ac29d=_0x9b8f[_0x55e3d1];return _0x2ac29d;};'use strict';var multer=require(_0xf9b8('0x0'));var util=require(_0xf9b8('0x1'));var path=require(_0xf9b8('0x2'));var timeout=require(_0xf9b8('0x3'));var express=require(_0xf9b8('0x4'));var router=express['Router']();var fs_extra=require(_0xf9b8('0x5'));var auth=require(_0xf9b8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf9b8('0x7'));var controller=require(_0xf9b8('0x8'));router['get']('/',auth[_0xf9b8('0x9')](),controller[_0xf9b8('0xa')]);router[_0xf9b8('0xb')](_0xf9b8('0xc'),auth[_0xf9b8('0x9')](),controller[_0xf9b8('0xd')]);router[_0xf9b8('0xb')](_0xf9b8('0xe'),auth[_0xf9b8('0x9')](),controller[_0xf9b8('0xf')]);router[_0xf9b8('0x10')]('/',auth[_0xf9b8('0x9')](),controller['create']);router[_0xf9b8('0x10')](_0xf9b8('0xe'),auth['isAuthenticated'](),controller[_0xf9b8('0x11')]);router['put'](_0xf9b8('0xc'),auth['isAuthenticated'](),controller[_0xf9b8('0x12')]);router[_0xf9b8('0x13')](_0xf9b8('0xc'),auth[_0xf9b8('0x9')](),controller[_0xf9b8('0x14')]);router[_0xf9b8('0x13')](_0xf9b8('0x15'),auth[_0xf9b8('0x9')](),controller['removeSound']);module['exports']=router; \ No newline at end of file +var _0xfb96=['show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfb96,0x1d4));var _0x6fb9=function(_0x507a03,_0x129a26){_0x507a03=_0x507a03-0x0;var _0x3a7c9e=_0xfb96[_0x507a03];return _0x3a7c9e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6fb9('0x0'));var timeout=require(_0x6fb9('0x1'));var express=require(_0x6fb9('0x2'));var router=express[_0x6fb9('0x3')]();var fs_extra=require(_0x6fb9('0x4'));var auth=require(_0x6fb9('0x5'));var interaction=require(_0x6fb9('0x6'));var config=require('../../config/environment');var controller=require(_0x6fb9('0x7'));router[_0x6fb9('0x8')]('/',auth['isAuthenticated'](),controller[_0x6fb9('0x9')]);router[_0x6fb9('0x8')](_0x6fb9('0xa'),auth[_0x6fb9('0xb')](),controller[_0x6fb9('0xc')]);router[_0x6fb9('0x8')](_0x6fb9('0xd'),auth[_0x6fb9('0xb')](),controller[_0x6fb9('0xe')]);router[_0x6fb9('0xf')]('/',auth[_0x6fb9('0xb')](),controller[_0x6fb9('0x10')]);router['post'](_0x6fb9('0xd'),auth[_0x6fb9('0xb')](),controller[_0x6fb9('0x11')]);router[_0x6fb9('0x12')](_0x6fb9('0xa'),auth[_0x6fb9('0xb')](),controller[_0x6fb9('0x13')]);router[_0x6fb9('0x14')](_0x6fb9('0xa'),auth['isAuthenticated'](),controller[_0x6fb9('0x15')]);router[_0x6fb9('0x14')](_0x6fb9('0x16'),auth[_0x6fb9('0xb')](),controller['removeSound']);module[_0x6fb9('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 9a71073..01b0bd2 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 _0xcdd8=['mp3nb','quietmp3','mp3','files','alpha','BOOLEAN','exports','STRING','name','ENUM','custom'];(function(_0x211bc3,_0x5860c8){var _0x34c9a2=function(_0x4bfa37){while(--_0x4bfa37){_0x211bc3['push'](_0x211bc3['shift']());}};_0x34c9a2(++_0x5860c8);}(_0xcdd8,0x10e));var _0x8cdd=function(_0x178946,_0x5bbb59){_0x178946=_0x178946-0x0;var _0x1aff35=_0xcdd8[_0x178946];return _0x1aff35;};'use strict';var Sequelize=require('sequelize');module[_0x8cdd('0x0')]={'name':{'type':Sequelize[_0x8cdd('0x1')],'allowNull':![],'unique':_0x8cdd('0x2')},'mode':{'type':Sequelize[_0x8cdd('0x3')](_0x8cdd('0x4'),'files',_0x8cdd('0x5'),'quietmp3nb',_0x8cdd('0x6'),_0x8cdd('0x7')),'allowNull':!![],'defaultValue':_0x8cdd('0x8')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x8cdd('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x8cdd('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x8cdd('0x1')],'allowNull':!![],'defaultValue':_0x8cdd('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x8cdd('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0950=['ENUM','custom','files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x4adb6e,_0x52fa74){var _0xaf7b3d=function(_0xc3a1c4){while(--_0xc3a1c4){_0x4adb6e['push'](_0x4adb6e['shift']());}};_0xaf7b3d(++_0x52fa74);}(_0x0950,0x15b));var _0x0095=function(_0x17e3c4,_0x821010){_0x17e3c4=_0x17e3c4-0x0;var _0x2211b9=_0x0950[_0x17e3c4];return _0x2211b9;};'use strict';var Sequelize=require(_0x0095('0x0'));module[_0x0095('0x1')]={'name':{'type':Sequelize[_0x0095('0x2')],'allowNull':![],'unique':_0x0095('0x3')},'mode':{'type':Sequelize[_0x0095('0x4')](_0x0095('0x5'),_0x0095('0x6'),'mp3nb',_0x0095('0x7'),_0x0095('0x8'),_0x0095('0x9')),'allowNull':!![],'defaultValue':_0x0095('0x6')},'directory':{'type':Sequelize[_0x0095('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x0095('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0095('0xa')},'format':{'type':Sequelize[_0x0095('0x2')],'allowNull':!![]},'stamp':{'type':_0x0095('0xb')},'defaultEntry':{'type':Sequelize[_0x0095('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 8081064..f6e411c 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 _0xa5c3=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','findAll','rows','catch','show','params','include','find','body','create','mode','files','directory','join','root','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','rmdirSync','Sequelize','message','addSound','sequelize','Sound','findOne','save_name','server/files/sounds/converted','format','basename','extname','converted_format','server/files/moh','%s.%s','symlinkSync','ValidationError','removeSound','id2','createdAt','unlinkSync','getSounds','eml-format','rimraf','zip-dir','request-promise','path','sox','to-csv','fs-extra','lodash','crypto'];(function(_0x3b6abe,_0x36856f){var _0x478e7f=function(_0xd4d309){while(--_0xd4d309){_0x3b6abe['push'](_0x3b6abe['shift']());}};_0x478e7f(++_0x36856f);}(_0xa5c3,0x149));var _0x3a5c=function(_0x576f39,_0x7f447e){_0x576f39=_0x576f39-0x0;var _0x5ba81d=_0xa5c3[_0x576f39];return _0x5ba81d;};'use strict';var emlformat=require(_0x3a5c('0x0'));var rimraf=require(_0x3a5c('0x1'));var zipdir=require(_0x3a5c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a5c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3a5c('0x4'));var sox=require(_0x3a5c('0x5'));var csv=require(_0x3a5c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a5c('0x7'));var _=require(_0x3a5c('0x8'));var squel=require('squel');var crypto=require(_0x3a5c('0x9'));var jsforce=require(_0x3a5c('0xa'));var deskjs=require(_0x3a5c('0xb'));var toCsv=require(_0x3a5c('0x6'));var querystring=require('querystring');var Papa=require(_0x3a5c('0xc'));var Redis=require(_0x3a5c('0xd'));var authService=require(_0x3a5c('0xe'));var qs=require(_0x3a5c('0xf'));var as=require(_0x3a5c('0x10'));var hardwareService=require(_0x3a5c('0x11'));var logger=require('../../config/logger')(_0x3a5c('0x12'));var utils=require(_0x3a5c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3a5c('0x14'));var db=require(_0x3a5c('0x15'))['db'];function respondWithStatusCode(_0x1b6a56,_0x28b8ff){_0x28b8ff=_0x28b8ff||0xcc;return function(_0x23292a){if(_0x23292a){return _0x1b6a56[_0x3a5c('0x16')](_0x28b8ff);}return _0x1b6a56['status'](_0x28b8ff)[_0x3a5c('0x17')]();};}function respondWithResult(_0x487136,_0x297734){_0x297734=_0x297734||0xc8;return function(_0x2cda01){if(_0x2cda01){return _0x487136[_0x3a5c('0x18')](_0x297734)[_0x3a5c('0x19')](_0x2cda01);}};}function respondWithFilteredResult(_0x4a9ccb,_0x23535b){return function(_0x4428aa){if(_0x4428aa){var _0x272e97=typeof _0x23535b[_0x3a5c('0x1a')]===_0x3a5c('0x1b')&&typeof _0x23535b[_0x3a5c('0x1c')]==='undefined';var _0x215c7b=_0x4428aa[_0x3a5c('0x1d')];var _0x15365e=_0x272e97?0x0:_0x23535b[_0x3a5c('0x1a')];var _0x2e4509=_0x272e97?_0x4428aa[_0x3a5c('0x1d')]:_0x23535b[_0x3a5c('0x1a')]+_0x23535b[_0x3a5c('0x1c')];var _0xd7b2fb;if(_0x2e4509>=_0x215c7b){_0x2e4509=_0x215c7b;_0xd7b2fb=0xc8;}else{_0xd7b2fb=0xce;}_0x4a9ccb[_0x3a5c('0x18')](_0xd7b2fb);return _0x4a9ccb['set'](_0x3a5c('0x1e'),_0x15365e+'-'+_0x2e4509+'/'+_0x215c7b)[_0x3a5c('0x19')](_0x4428aa);}return null;};}function patchUpdates(_0x4013d6){return function(_0x308575){try{jsonpatch[_0x3a5c('0x1f')](_0x308575,_0x4013d6,!![]);}catch(_0x26db69){return BPromise[_0x3a5c('0x20')](_0x26db69);}return _0x308575[_0x3a5c('0x21')]();};}function saveUpdates(_0x18c98e,_0x49ec62){return function(_0x348c35){if(_0x348c35){return _0x348c35[_0x3a5c('0x22')](_0x18c98e)[_0x3a5c('0x23')](function(_0x57eefd){return _0x57eefd;});}return null;};}function removeEntity(_0x484856,_0x4e68d9){return function(_0x1e97c9){if(_0x1e97c9){return _0x1e97c9[_0x3a5c('0x24')]()[_0x3a5c('0x23')](function(){var _0x42f60b=_0x1e97c9[_0x3a5c('0x25')]({'plain':!![]});var _0x364c40=_0x3a5c('0x26');return db[_0x3a5c('0x27')][_0x3a5c('0x24')]({'where':{'type':_0x364c40,'resourceId':_0x42f60b['id']}})[_0x3a5c('0x23')](function(){return _0x1e97c9;});})[_0x3a5c('0x23')](function(){_0x484856[_0x3a5c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x273a62,_0x1ed0c1){return function(_0x513c5e){if(!_0x513c5e){_0x273a62[_0x3a5c('0x16')](0x194);}return _0x513c5e;};}function handleError(_0xe40b57,_0x135f47){_0x135f47=_0x135f47||0x1f4;return function(_0x4313bc){logger[_0x3a5c('0x28')](_0x4313bc[_0x3a5c('0x29')]);if(_0x4313bc[_0x3a5c('0x2a')]){delete _0x4313bc[_0x3a5c('0x2a')];}_0xe40b57[_0x3a5c('0x18')](_0x135f47)[_0x3a5c('0x2b')](_0x4313bc);};}exports[_0x3a5c('0x2c')]=function(_0x31861f,_0xbe21a1){var _0x2c371f={},_0x47ba37={},_0x380d9e={'count':0x0,'rows':[]};var _0xac5d13=_[_0x3a5c('0x2d')](db['VoiceMusicOnHold'][_0x3a5c('0x2e')],function(_0x21d65d){return{'name':_0x21d65d[_0x3a5c('0x2f')],'type':_0x21d65d[_0x3a5c('0x30')][_0x3a5c('0x31')]};});_0x47ba37[_0x3a5c('0x32')]=_[_0x3a5c('0x2d')](_0xac5d13,_0x3a5c('0x2a'));_0x47ba37['query']=_[_0x3a5c('0x33')](_0x31861f[_0x3a5c('0x34')]);_0x47ba37[_0x3a5c('0x35')]=_[_0x3a5c('0x36')](_0x47ba37[_0x3a5c('0x32')],_0x47ba37[_0x3a5c('0x34')]);_0x2c371f['attributes']=_['intersection'](_0x47ba37[_0x3a5c('0x32')],qs[_0x3a5c('0x37')](_0x31861f['query']['fields']));_0x2c371f['attributes']=_0x2c371f[_0x3a5c('0x38')][_0x3a5c('0x39')]?_0x2c371f[_0x3a5c('0x38')]:_0x47ba37[_0x3a5c('0x32')];if(!_0x31861f[_0x3a5c('0x34')][_0x3a5c('0x3a')](_0x3a5c('0x3b'))){_0x2c371f['limit']=qs[_0x3a5c('0x1c')](_0x31861f[_0x3a5c('0x34')]['limit']);_0x2c371f[_0x3a5c('0x1a')]=qs[_0x3a5c('0x1a')](_0x31861f[_0x3a5c('0x34')][_0x3a5c('0x1a')]);}_0x2c371f[_0x3a5c('0x3c')]=qs[_0x3a5c('0x3d')](_0x31861f[_0x3a5c('0x34')][_0x3a5c('0x3d')]);delete _0x31861f[_0x3a5c('0x34')]['sort'];_0x2c371f[_0x3a5c('0x3e')]=qs[_0x3a5c('0x35')](_[_0x3a5c('0x3f')](_0x31861f[_0x3a5c('0x34')],_0x47ba37[_0x3a5c('0x35')]),_0xac5d13);if(_0x31861f[_0x3a5c('0x34')][_0x3a5c('0x40')]){_0x2c371f[_0x3a5c('0x3e')]=_[_0x3a5c('0x41')](_0x2c371f[_0x3a5c('0x3e')],{'$or':_['map'](_0xac5d13,function(_0x538a80){if(_0x538a80[_0x3a5c('0x30')]!==_0x3a5c('0x42')){var _0x37558c={};_0x37558c[_0x538a80[_0x3a5c('0x2a')]]={'$like':'%'+_0x31861f[_0x3a5c('0x34')]['filter']+'%'};return _0x37558c;}})});}_0x2c371f=_[_0x3a5c('0x41')]({},_0x2c371f,_0x31861f[_0x3a5c('0x43')]);var _0x4f821d={'where':_0x2c371f[_0x3a5c('0x3e')]};return db[_0x3a5c('0x44')]['count'](_0x4f821d)[_0x3a5c('0x23')](function(_0x49818d){_0x380d9e['count']=_0x49818d;if(_0x31861f[_0x3a5c('0x34')][_0x3a5c('0x45')]){_0x2c371f['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x3a5c('0x46')](_0x2c371f);})[_0x3a5c('0x23')](function(_0x1dde4f){_0x380d9e[_0x3a5c('0x47')]=_0x1dde4f;return _0x380d9e;})['then'](respondWithFilteredResult(_0xbe21a1,_0x2c371f))[_0x3a5c('0x48')](handleError(_0xbe21a1,null));};exports[_0x3a5c('0x49')]=function(_0x1f7f38,_0x23dce2){var _0x30ca38={'raw':![],'where':{'id':_0x1f7f38[_0x3a5c('0x4a')]['id']}},_0x3944e5={};_0x3944e5['model']=_[_0x3a5c('0x33')](db[_0x3a5c('0x44')][_0x3a5c('0x2e')]);_0x3944e5[_0x3a5c('0x34')]=_[_0x3a5c('0x33')](_0x1f7f38[_0x3a5c('0x34')]);_0x3944e5[_0x3a5c('0x35')]=_[_0x3a5c('0x36')](_0x3944e5[_0x3a5c('0x32')],_0x3944e5['query']);_0x30ca38[_0x3a5c('0x38')]=_[_0x3a5c('0x36')](_0x3944e5[_0x3a5c('0x32')],qs[_0x3a5c('0x37')](_0x1f7f38[_0x3a5c('0x34')][_0x3a5c('0x37')]));_0x30ca38[_0x3a5c('0x38')]=_0x30ca38[_0x3a5c('0x38')][_0x3a5c('0x39')]?_0x30ca38[_0x3a5c('0x38')]:_0x3944e5[_0x3a5c('0x32')];if(_0x1f7f38[_0x3a5c('0x34')][_0x3a5c('0x45')]){_0x30ca38[_0x3a5c('0x4b')]=[{'all':!![]}];}_0x30ca38=_[_0x3a5c('0x41')]({},_0x30ca38,_0x1f7f38[_0x3a5c('0x43')]);return db[_0x3a5c('0x44')][_0x3a5c('0x4c')](_0x30ca38)['then'](handleEntityNotFound(_0x23dce2,null))[_0x3a5c('0x23')](respondWithResult(_0x23dce2,null))[_0x3a5c('0x48')](handleError(_0x23dce2,null));};exports[_0x3a5c('0x22')]=function(_0x1c814b,_0x38dba8){if(_0x1c814b[_0x3a5c('0x4d')]['id']){delete _0x1c814b[_0x3a5c('0x4d')]['id'];}return db[_0x3a5c('0x44')][_0x3a5c('0x4c')]({'where':{'id':_0x1c814b['params']['id']}})['then'](handleEntityNotFound(_0x38dba8,null))[_0x3a5c('0x23')](saveUpdates(_0x1c814b[_0x3a5c('0x4d')],null))[_0x3a5c('0x23')](respondWithResult(_0x38dba8,null))[_0x3a5c('0x48')](handleError(_0x38dba8,null));};exports[_0x3a5c('0x4e')]=function(_0x114a1a,_0x2e5a12,_0x3fd63b){return db['sequelize']['transaction'](function(_0x3104d5){if(_0x114a1a[_0x3a5c('0x4d')][_0x3a5c('0x4f')]===_0x3a5c('0x50')){_0x114a1a[_0x3a5c('0x4d')][_0x3a5c('0x51')]=path[_0x3a5c('0x52')](config[_0x3a5c('0x53')],'server/files/moh',_0x114a1a[_0x3a5c('0x4d')]['name']);}return db[_0x3a5c('0x44')][_0x3a5c('0x4e')](_0x114a1a[_0x3a5c('0x4d')],{'transaction':_0x3104d5})[_0x3a5c('0x23')](function(_0x50c752){if(_0x114a1a[_0x3a5c('0x4d')][_0x3a5c('0x4f')]===_0x3a5c('0x50')){fs[_0x3a5c('0x54')](_0x50c752[_0x3a5c('0x51')],parseInt('0777',0x8));}var _0x30b2df=_0x114a1a['user'][_0x3a5c('0x25')]({'plain':!![]});if(!_0x30b2df)throw new Error(_0x3a5c('0x55'));if(_0x30b2df[_0x3a5c('0x56')]===_0x3a5c('0x57')){var _0xfbaea7=_0x50c752[_0x3a5c('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x3a5c('0x4c')]({'where':{'name':_0x3a5c('0x26'),'userProfileId':_0x30b2df['userProfileId']},'raw':!![]})[_0x3a5c('0x23')](function(_0x10ebf8){if(_0x10ebf8&&_0x10ebf8['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xfbaea7['name'],'resourceId':_0xfbaea7['id'],'type':_0x10ebf8[_0x3a5c('0x2a')],'sectionId':_0x10ebf8['id']},{})[_0x3a5c('0x23')](function(){return _0x50c752;});}else{return _0x50c752;}})['catch'](function(_0x21c8cb){logger[_0x3a5c('0x28')](_0x3a5c('0x58'),_0x21c8cb);});}return _0x50c752;});})[_0x3a5c('0x23')](respondWithResult(_0x2e5a12,0xc9))['catch'](handleError(_0x2e5a12,null));};exports[_0x3a5c('0x24')]=function(_0x10c576,_0x5bcdce,_0x1b791a){var _0x1b877d;return db[_0x3a5c('0x44')]['find']({'where':{'id':_0x10c576['params']['id']}})[_0x3a5c('0x23')](function(_0x4b3c46){if(_0x4b3c46){return db['sequelize'][_0x3a5c('0x59')](function(_0x58af2e){return _0x4b3c46[_0x3a5c('0x24')]({'transaction':_0x58af2e,'raw':!![]})[_0x3a5c('0x23')](function(_0x54fd11){if(_0x54fd11[_0x3a5c('0x51')]){fs[_0x3a5c('0x5a')](_0x54fd11[_0x3a5c('0x51')])['forEach'](function(_0x4b9d17){fs['unlinkSync'](path[_0x3a5c('0x52')](_0x54fd11[_0x3a5c('0x51')],_0x4b9d17));});fs[_0x3a5c('0x5b')](_0x54fd11[_0x3a5c('0x51')]);}return _0x54fd11;});})['catch'](function(_0x1f0635){throw new db[(_0x3a5c('0x5c'))]['ValidationError'](_0x1f0635[_0x3a5c('0x5d')]);});}})[_0x3a5c('0x23')](handleEntityNotFound(_0x5bcdce,null))['then'](removeEntity(_0x5bcdce,null))[_0x3a5c('0x48')](handleError(_0x5bcdce,null));};exports[_0x3a5c('0x5e')]=function(_0x4b1887,_0x425f7d,_0x471f5c){return db[_0x3a5c('0x5f')]['transaction'](function(_0x25ad98){var _0x7eecb9;return db[_0x3a5c('0x44')][_0x3a5c('0x4c')]({'where':{'id':_0x4b1887['params']['id']}})[_0x3a5c('0x23')](function(_0x28a73a){if(_0x28a73a){_0x7eecb9=_0x28a73a;return _0x28a73a[_0x3a5c('0x5e')](_0x4b1887[_0x3a5c('0x4d')]['id'],{'transaction':_0x25ad98});}})['then'](function(_0x1ba121){if(_0x1ba121){return db[_0x3a5c('0x60')][_0x3a5c('0x61')]({'where':{'id':_0x4b1887[_0x3a5c('0x4d')]['id']},'attributes':['id',_0x3a5c('0x2a'),_0x3a5c('0x62'),'converted_format','createdAt'],'raw':!![]});}})[_0x3a5c('0x23')](function(_0x470ba){if(_0x470ba){var _0x2a8a81=path[_0x3a5c('0x52')](config[_0x3a5c('0x53')],_0x3a5c('0x63'),util[_0x3a5c('0x64')]('%s.%s',path[_0x3a5c('0x65')](_0x470ba[_0x3a5c('0x62')],path[_0x3a5c('0x66')](_0x470ba[_0x3a5c('0x62')])),_0x470ba[_0x3a5c('0x67')]));var _0x1b6347=path[_0x3a5c('0x52')](config[_0x3a5c('0x53')],_0x3a5c('0x68'),_0x7eecb9[_0x3a5c('0x2a')],util['format'](_0x3a5c('0x69'),_0x470ba[_0x3a5c('0x2a')],_0x470ba[_0x3a5c('0x67')]));fs[_0x3a5c('0x6a')](_0x2a8a81,_0x1b6347);return _0x470ba;}})['catch'](function(_0x288036){throw new db[(_0x3a5c('0x5c'))][(_0x3a5c('0x6b'))](_0x288036[_0x3a5c('0x5d')]);});})[_0x3a5c('0x23')](handleEntityNotFound(_0x425f7d,null))[_0x3a5c('0x23')](respondWithResult(_0x425f7d,0xc9))[_0x3a5c('0x48')](handleError(_0x425f7d,null));};exports[_0x3a5c('0x6c')]=function(_0x27de73,_0x261cc4,_0x26a2b0){return db['sequelize'][_0x3a5c('0x59')](function(_0x2ed89b){var _0x26c283;return db['VoiceMusicOnHold'][_0x3a5c('0x61')]({'where':{'id':_0x27de73[_0x3a5c('0x4a')]['id']}})[_0x3a5c('0x23')](handleEntityNotFound(_0x261cc4,null))[_0x3a5c('0x23')](function(_0x5e1c32){if(_0x5e1c32){_0x26c283=_0x5e1c32;return _0x5e1c32[_0x3a5c('0x6c')](_0x27de73[_0x3a5c('0x4a')][_0x3a5c('0x6d')]);}})[_0x3a5c('0x23')](function(_0x124e0e){if(_0x124e0e){return db[_0x3a5c('0x60')]['findOne']({'where':{'id':_0x27de73[_0x3a5c('0x4a')][_0x3a5c('0x6d')]},'attributes':['id',_0x3a5c('0x2a'),_0x3a5c('0x62'),_0x3a5c('0x67'),_0x3a5c('0x6e')],'raw':!![]});}})[_0x3a5c('0x23')](function(_0x495bb5){if(_0x495bb5){fs[_0x3a5c('0x6f')](path['join'](_0x26c283['directory'],util[_0x3a5c('0x64')](_0x3a5c('0x69'),_0x495bb5[_0x3a5c('0x2a')],_0x495bb5[_0x3a5c('0x67')])));return _0x495bb5;}})['catch'](function(_0x4e624c){throw new db[(_0x3a5c('0x5c'))][(_0x3a5c('0x6b'))](_0x4e624c['message']);});})['then'](handleEntityNotFound(_0x261cc4,null))[_0x3a5c('0x23')](respondWithStatusCode(_0x261cc4,0xcc))['catch'](handleError(_0x261cc4,null));};exports['getSounds']=function(_0x29de46,_0x2b7e98,_0x5ade78){var _0x10a5ba={};var _0x1b529c={};var _0x44e581;var _0x129685;return db[_0x3a5c('0x44')][_0x3a5c('0x61')]({'where':{'id':_0x29de46[_0x3a5c('0x4a')]['id']}})[_0x3a5c('0x23')](handleEntityNotFound(_0x2b7e98,null))[_0x3a5c('0x23')](function(_0x3887bb){if(_0x3887bb){_0x44e581=_0x3887bb;_0x1b529c[_0x3a5c('0x32')]=_[_0x3a5c('0x33')](db['Sound']['rawAttributes']);_0x1b529c[_0x3a5c('0x34')]=_[_0x3a5c('0x33')](_0x29de46[_0x3a5c('0x34')]);_0x1b529c['filters']=_['intersection'](_0x1b529c[_0x3a5c('0x32')],_0x1b529c[_0x3a5c('0x34')]);_0x10a5ba[_0x3a5c('0x38')]=_[_0x3a5c('0x36')](_0x1b529c[_0x3a5c('0x32')],qs[_0x3a5c('0x37')](_0x29de46['query'][_0x3a5c('0x37')]));_0x10a5ba[_0x3a5c('0x38')]=_0x10a5ba[_0x3a5c('0x38')][_0x3a5c('0x39')]?_0x10a5ba[_0x3a5c('0x38')]:_0x1b529c[_0x3a5c('0x32')];_0x10a5ba[_0x3a5c('0x3c')]=qs['sort'](_0x29de46['query'][_0x3a5c('0x3d')]);_0x10a5ba[_0x3a5c('0x3e')]=qs[_0x3a5c('0x35')](_[_0x3a5c('0x3f')](_0x29de46[_0x3a5c('0x34')],_0x1b529c['filters']));if(_0x29de46[_0x3a5c('0x34')]['filter']){_0x10a5ba[_0x3a5c('0x3e')]=_['merge'](_0x10a5ba[_0x3a5c('0x3e')],{'$or':_[_0x3a5c('0x2d')](_0x10a5ba[_0x3a5c('0x38')],function(_0x55390a){var _0x78bf61={};_0x78bf61[_0x55390a]={'$like':'%'+_0x29de46['query'][_0x3a5c('0x40')]+'%'};return _0x78bf61;})});}_0x10a5ba=_['merge']({},_0x10a5ba,_0x29de46['options']);return _0x44e581[_0x3a5c('0x70')](_0x10a5ba);}})[_0x3a5c('0x23')](function(_0x394926){if(_0x394926){_0x129685=_0x394926[_0x3a5c('0x39')];if(!_0x29de46[_0x3a5c('0x34')][_0x3a5c('0x3a')](_0x3a5c('0x3b'))){_0x10a5ba[_0x3a5c('0x1c')]=qs[_0x3a5c('0x1c')](_0x29de46[_0x3a5c('0x34')][_0x3a5c('0x1c')]);_0x10a5ba[_0x3a5c('0x1a')]=qs[_0x3a5c('0x1a')](_0x29de46[_0x3a5c('0x34')]['offset']);}return _0x44e581['getSounds'](_0x10a5ba);}})[_0x3a5c('0x23')](function(_0x5f0ca4){if(_0x5f0ca4){return _0x5f0ca4?{'count':_0x129685,'rows':_0x5f0ca4}:null;}})[_0x3a5c('0x23')](respondWithResult(_0x2b7e98,null))[_0x3a5c('0x48')](handleError(_0x2b7e98,null));}; \ No newline at end of file +var _0x84aa=['findAll','show','params','fields','options','find','catch','sequelize','transaction','body','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','role','user','userProfileId','autoAssociation','create','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','save_name','converted_format','server/files/sounds/converted','format','%s.%s','extname','symlinkSync','removeSound','id2','findOne','getSounds','hasOwnProperty','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84aa,0x1d2));var _0xa84a=function(_0x5ee291,_0x119ec1){_0x5ee291=_0x5ee291-0x0;var _0x1503e1=_0x84aa[_0x5ee291];return _0x1503e1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa84a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa84a('0x1'));var moment=require(_0xa84a('0x2'));var BPromise=require(_0xa84a('0x3'));var Mustache=require('mustache');var util=require(_0xa84a('0x4'));var path=require(_0xa84a('0x5'));var sox=require(_0xa84a('0x6'));var csv=require(_0xa84a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa84a('0x8'));var squel=require(_0xa84a('0x9'));var crypto=require(_0xa84a('0xa'));var jsforce=require(_0xa84a('0xb'));var deskjs=require(_0xa84a('0xc'));var toCsv=require(_0xa84a('0x7'));var querystring=require(_0xa84a('0xd'));var Papa=require(_0xa84a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa84a('0xf'));var as=require(_0xa84a('0x10'));var hardwareService=require(_0xa84a('0x11'));var logger=require('../../config/logger')(_0xa84a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa84a('0x13'))['db'];function respondWithStatusCode(_0x36ef1b,_0xe469db){_0xe469db=_0xe469db||0xcc;return function(_0x459ba8){if(_0x459ba8){return _0x36ef1b[_0xa84a('0x14')](_0xe469db);}return _0x36ef1b[_0xa84a('0x15')](_0xe469db)[_0xa84a('0x16')]();};}function respondWithResult(_0x438065,_0x178d81){_0x178d81=_0x178d81||0xc8;return function(_0xad0a2e){if(_0xad0a2e){return _0x438065[_0xa84a('0x15')](_0x178d81)['json'](_0xad0a2e);}};}function respondWithFilteredResult(_0x489af3,_0x23985d){return function(_0x346692){if(_0x346692){var _0x3f20b4=typeof _0x23985d[_0xa84a('0x17')]===_0xa84a('0x18')&&typeof _0x23985d['limit']===_0xa84a('0x18');var _0x1dbcfb=_0x346692['count'];var _0xecaafe=_0x3f20b4?0x0:_0x23985d[_0xa84a('0x17')];var _0x14066e=_0x3f20b4?_0x346692[_0xa84a('0x19')]:_0x23985d[_0xa84a('0x17')]+_0x23985d[_0xa84a('0x1a')];var _0x244f27;if(_0x14066e>=_0x1dbcfb){_0x14066e=_0x1dbcfb;_0x244f27=0xc8;}else{_0x244f27=0xce;}_0x489af3[_0xa84a('0x15')](_0x244f27);return _0x489af3[_0xa84a('0x1b')](_0xa84a('0x1c'),_0xecaafe+'-'+_0x14066e+'/'+_0x1dbcfb)[_0xa84a('0x1d')](_0x346692);}return null;};}function patchUpdates(_0x36070d){return function(_0x20c50a){try{jsonpatch[_0xa84a('0x1e')](_0x20c50a,_0x36070d,!![]);}catch(_0x4c58c3){return BPromise[_0xa84a('0x1f')](_0x4c58c3);}return _0x20c50a[_0xa84a('0x20')]();};}function saveUpdates(_0x332642,_0x17ff29){return function(_0x138a6d){if(_0x138a6d){return _0x138a6d['update'](_0x332642)[_0xa84a('0x21')](function(_0x5f44d4){return _0x5f44d4;});}return null;};}function removeEntity(_0x3a7edb,_0x185ca9){return function(_0x30d44e){if(_0x30d44e){return _0x30d44e[_0xa84a('0x22')]()[_0xa84a('0x21')](function(){var _0x4b97b6=_0x30d44e[_0xa84a('0x23')]({'plain':!![]});var _0x5bcf03=_0xa84a('0x24');return db[_0xa84a('0x25')]['destroy']({'where':{'type':_0x5bcf03,'resourceId':_0x4b97b6['id']}})[_0xa84a('0x21')](function(){return _0x30d44e;});})['then'](function(){_0x3a7edb[_0xa84a('0x15')](0xcc)[_0xa84a('0x16')]();});}};}function handleEntityNotFound(_0x4db0ac,_0x1c5815){return function(_0x20b99e){if(!_0x20b99e){_0x4db0ac['sendStatus'](0x194);}return _0x20b99e;};}function handleError(_0x3b2554,_0x5aada9){_0x5aada9=_0x5aada9||0x1f4;return function(_0xdbc564){logger['error'](_0xdbc564[_0xa84a('0x26')]);if(_0xdbc564[_0xa84a('0x27')]){delete _0xdbc564['name'];}_0x3b2554[_0xa84a('0x15')](_0x5aada9)[_0xa84a('0x28')](_0xdbc564);};}exports[_0xa84a('0x29')]=function(_0x46cf2f,_0x56bd88){var _0x271d8c={},_0x2f4994={},_0x23e65a={'count':0x0,'rows':[]};var _0x1fffac=_[_0xa84a('0x2a')](db[_0xa84a('0x2b')]['rawAttributes'],function(_0x49ca6b){return{'name':_0x49ca6b[_0xa84a('0x2c')],'type':_0x49ca6b[_0xa84a('0x2d')][_0xa84a('0x2e')]};});_0x2f4994[_0xa84a('0x2f')]=_[_0xa84a('0x2a')](_0x1fffac,_0xa84a('0x27'));_0x2f4994[_0xa84a('0x30')]=_[_0xa84a('0x31')](_0x46cf2f[_0xa84a('0x30')]);_0x2f4994[_0xa84a('0x32')]=_[_0xa84a('0x33')](_0x2f4994['model'],_0x2f4994[_0xa84a('0x30')]);_0x271d8c[_0xa84a('0x34')]=_[_0xa84a('0x33')](_0x2f4994['model'],qs['fields'](_0x46cf2f['query']['fields']));_0x271d8c[_0xa84a('0x34')]=_0x271d8c[_0xa84a('0x34')][_0xa84a('0x35')]?_0x271d8c[_0xa84a('0x34')]:_0x2f4994['model'];if(!_0x46cf2f[_0xa84a('0x30')]['hasOwnProperty'](_0xa84a('0x36'))){_0x271d8c[_0xa84a('0x1a')]=qs[_0xa84a('0x1a')](_0x46cf2f[_0xa84a('0x30')][_0xa84a('0x1a')]);_0x271d8c[_0xa84a('0x17')]=qs[_0xa84a('0x17')](_0x46cf2f[_0xa84a('0x30')]['offset']);}_0x271d8c[_0xa84a('0x37')]=qs[_0xa84a('0x38')](_0x46cf2f[_0xa84a('0x30')][_0xa84a('0x38')]);delete _0x46cf2f['query'][_0xa84a('0x38')];_0x271d8c[_0xa84a('0x39')]=qs[_0xa84a('0x32')](_[_0xa84a('0x3a')](_0x46cf2f[_0xa84a('0x30')],_0x2f4994[_0xa84a('0x32')]),_0x1fffac);if(_0x46cf2f[_0xa84a('0x30')][_0xa84a('0x3b')]){_0x271d8c[_0xa84a('0x39')]=_[_0xa84a('0x3c')](_0x271d8c[_0xa84a('0x39')],{'$or':_[_0xa84a('0x2a')](_0x1fffac,function(_0x3f1bce){if(_0x3f1bce[_0xa84a('0x2d')]!==_0xa84a('0x3d')){var _0x55a862={};_0x55a862[_0x3f1bce[_0xa84a('0x27')]]={'$like':'%'+_0x46cf2f['query']['filter']+'%'};return _0x55a862;}})});}_0x271d8c=_['merge']({},_0x271d8c,_0x46cf2f['options']);var _0x47e67a={'where':_0x271d8c['where']};return db[_0xa84a('0x2b')][_0xa84a('0x19')](_0x47e67a)['then'](function(_0x1d0b87){_0x23e65a[_0xa84a('0x19')]=_0x1d0b87;if(_0x46cf2f[_0xa84a('0x30')][_0xa84a('0x3e')]){_0x271d8c[_0xa84a('0x3f')]=[{'all':!![]}];}return db[_0xa84a('0x2b')][_0xa84a('0x40')](_0x271d8c);})['then'](function(_0x2ae1c7){_0x23e65a['rows']=_0x2ae1c7;return _0x23e65a;})[_0xa84a('0x21')](respondWithFilteredResult(_0x56bd88,_0x271d8c))['catch'](handleError(_0x56bd88,null));};exports[_0xa84a('0x41')]=function(_0x2df63b,_0xc8c9f){var _0x249052={'raw':![],'where':{'id':_0x2df63b[_0xa84a('0x42')]['id']}},_0x1cb832={};_0x1cb832[_0xa84a('0x2f')]=_[_0xa84a('0x31')](db[_0xa84a('0x2b')]['rawAttributes']);_0x1cb832[_0xa84a('0x30')]=_['keys'](_0x2df63b[_0xa84a('0x30')]);_0x1cb832[_0xa84a('0x32')]=_[_0xa84a('0x33')](_0x1cb832[_0xa84a('0x2f')],_0x1cb832[_0xa84a('0x30')]);_0x249052[_0xa84a('0x34')]=_[_0xa84a('0x33')](_0x1cb832['model'],qs[_0xa84a('0x43')](_0x2df63b[_0xa84a('0x30')]['fields']));_0x249052[_0xa84a('0x34')]=_0x249052[_0xa84a('0x34')]['length']?_0x249052[_0xa84a('0x34')]:_0x1cb832[_0xa84a('0x2f')];if(_0x2df63b['query'][_0xa84a('0x3e')]){_0x249052['include']=[{'all':!![]}];}_0x249052=_['merge']({},_0x249052,_0x2df63b[_0xa84a('0x44')]);return db[_0xa84a('0x2b')][_0xa84a('0x45')](_0x249052)[_0xa84a('0x21')](handleEntityNotFound(_0xc8c9f,null))[_0xa84a('0x21')](respondWithResult(_0xc8c9f,null))['catch'](handleError(_0xc8c9f,null));};exports['update']=function(_0x38a024,_0x8282b4){if(_0x38a024['body']['id']){delete _0x38a024['body']['id'];}return db[_0xa84a('0x2b')][_0xa84a('0x45')]({'where':{'id':_0x38a024['params']['id']}})[_0xa84a('0x21')](handleEntityNotFound(_0x8282b4,null))[_0xa84a('0x21')](saveUpdates(_0x38a024['body'],null))[_0xa84a('0x21')](respondWithResult(_0x8282b4,null))[_0xa84a('0x46')](handleError(_0x8282b4,null));};exports['create']=function(_0x1388e4,_0x7156cd,_0x33b641){return db[_0xa84a('0x47')][_0xa84a('0x48')](function(_0x51a94d){if(_0x1388e4[_0xa84a('0x49')][_0xa84a('0x4a')]===_0xa84a('0x4b')){_0x1388e4[_0xa84a('0x49')][_0xa84a('0x4c')]=path[_0xa84a('0x4d')](config[_0xa84a('0x4e')],_0xa84a('0x4f'),_0x1388e4[_0xa84a('0x49')][_0xa84a('0x27')]);}return db[_0xa84a('0x2b')]['create'](_0x1388e4[_0xa84a('0x49')],{'transaction':_0x51a94d})['then'](function(_0x12af7d){if(_0x1388e4[_0xa84a('0x49')][_0xa84a('0x4a')]==='files'){fs[_0xa84a('0x50')](_0x12af7d['directory'],parseInt(_0xa84a('0x51'),0x8));}var _0x169c5b=_0x1388e4['user'][_0xa84a('0x23')]({'plain':!![]});if(!_0x169c5b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x169c5b[_0xa84a('0x52')]===_0xa84a('0x53')){var _0x1b3064=_0x12af7d[_0xa84a('0x23')]({'plain':!![]});return db['UserProfileSection'][_0xa84a('0x45')]({'where':{'name':'MusicOnHolds','userProfileId':_0x169c5b[_0xa84a('0x54')]},'raw':!![]})[_0xa84a('0x21')](function(_0x8e8558){if(_0x8e8558&&_0x8e8558[_0xa84a('0x55')]===0x0){return db[_0xa84a('0x25')][_0xa84a('0x56')]({'name':_0x1b3064[_0xa84a('0x27')],'resourceId':_0x1b3064['id'],'type':_0x8e8558[_0xa84a('0x27')],'sectionId':_0x8e8558['id']},{})['then'](function(){return _0x12af7d;});}else{return _0x12af7d;}})[_0xa84a('0x46')](function(_0xe25d7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe25d7);});}return _0x12af7d;});})['then'](respondWithResult(_0x7156cd,0xc9))[_0xa84a('0x46')](handleError(_0x7156cd,null));};exports[_0xa84a('0x22')]=function(_0x225872,_0x27fc95,_0x4d2208){var _0x178f3b;return db['VoiceMusicOnHold'][_0xa84a('0x45')]({'where':{'id':_0x225872[_0xa84a('0x42')]['id']}})[_0xa84a('0x21')](function(_0x1a8b52){if(_0x1a8b52){return db[_0xa84a('0x47')]['transaction'](function(_0x1cf74e){return _0x1a8b52[_0xa84a('0x22')]({'transaction':_0x1cf74e,'raw':!![]})['then'](function(_0x41cd0b){if(_0x41cd0b[_0xa84a('0x4c')]){fs['readdirSync'](_0x41cd0b[_0xa84a('0x4c')])[_0xa84a('0x57')](function(_0x416545){fs[_0xa84a('0x58')](path[_0xa84a('0x4d')](_0x41cd0b['directory'],_0x416545));});fs['rmdirSync'](_0x41cd0b['directory']);}return _0x41cd0b;});})[_0xa84a('0x46')](function(_0x2e9000){throw new db[(_0xa84a('0x59'))][(_0xa84a('0x5a'))](_0x2e9000[_0xa84a('0x5b')]);});}})[_0xa84a('0x21')](handleEntityNotFound(_0x27fc95,null))['then'](removeEntity(_0x27fc95,null))[_0xa84a('0x46')](handleError(_0x27fc95,null));};exports['addSound']=function(_0x5bae7b,_0x1b2e44,_0x5a768a){return db[_0xa84a('0x47')][_0xa84a('0x48')](function(_0x4346c0){var _0x38614c;return db[_0xa84a('0x2b')]['find']({'where':{'id':_0x5bae7b[_0xa84a('0x42')]['id']}})[_0xa84a('0x21')](function(_0x34e3bc){if(_0x34e3bc){_0x38614c=_0x34e3bc;return _0x34e3bc[_0xa84a('0x5c')](_0x5bae7b[_0xa84a('0x49')]['id'],{'transaction':_0x4346c0});}})[_0xa84a('0x21')](function(_0x569dfa){if(_0x569dfa){return db[_0xa84a('0x5d')]['findOne']({'where':{'id':_0x5bae7b[_0xa84a('0x49')]['id']},'attributes':['id',_0xa84a('0x27'),_0xa84a('0x5e'),_0xa84a('0x5f'),'createdAt'],'raw':!![]});}})[_0xa84a('0x21')](function(_0x23b90e){if(_0x23b90e){var _0xbc1c74=path['join'](config[_0xa84a('0x4e')],_0xa84a('0x60'),util[_0xa84a('0x61')](_0xa84a('0x62'),path['basename'](_0x23b90e[_0xa84a('0x5e')],path[_0xa84a('0x63')](_0x23b90e[_0xa84a('0x5e')])),_0x23b90e['converted_format']));var _0x1ee42f=path[_0xa84a('0x4d')](config[_0xa84a('0x4e')],'server/files/moh',_0x38614c[_0xa84a('0x27')],util['format']('%s.%s',_0x23b90e[_0xa84a('0x27')],_0x23b90e['converted_format']));fs[_0xa84a('0x64')](_0xbc1c74,_0x1ee42f);return _0x23b90e;}})[_0xa84a('0x46')](function(_0x4c6b24){throw new db[(_0xa84a('0x59'))][(_0xa84a('0x5a'))](_0x4c6b24[_0xa84a('0x5b')]);});})['then'](handleEntityNotFound(_0x1b2e44,null))[_0xa84a('0x21')](respondWithResult(_0x1b2e44,0xc9))[_0xa84a('0x46')](handleError(_0x1b2e44,null));};exports[_0xa84a('0x65')]=function(_0x4b91ac,_0x60009,_0x209b2c){return db[_0xa84a('0x47')]['transaction'](function(_0xd007ce){var _0x10118f;return db[_0xa84a('0x2b')]['findOne']({'where':{'id':_0x4b91ac['params']['id']}})[_0xa84a('0x21')](handleEntityNotFound(_0x60009,null))[_0xa84a('0x21')](function(_0x4ed43c){if(_0x4ed43c){_0x10118f=_0x4ed43c;return _0x4ed43c[_0xa84a('0x65')](_0x4b91ac[_0xa84a('0x42')][_0xa84a('0x66')]);}})[_0xa84a('0x21')](function(_0x1d0ecd){if(_0x1d0ecd){return db['Sound'][_0xa84a('0x67')]({'where':{'id':_0x4b91ac[_0xa84a('0x42')][_0xa84a('0x66')]},'attributes':['id','name',_0xa84a('0x5e'),_0xa84a('0x5f'),'createdAt'],'raw':!![]});}})[_0xa84a('0x21')](function(_0x312f48){if(_0x312f48){fs[_0xa84a('0x58')](path[_0xa84a('0x4d')](_0x10118f[_0xa84a('0x4c')],util[_0xa84a('0x61')]('%s.%s',_0x312f48[_0xa84a('0x27')],_0x312f48['converted_format'])));return _0x312f48;}})[_0xa84a('0x46')](function(_0x5bf3c5){throw new db['Sequelize'][(_0xa84a('0x5a'))](_0x5bf3c5[_0xa84a('0x5b')]);});})[_0xa84a('0x21')](handleEntityNotFound(_0x60009,null))[_0xa84a('0x21')](respondWithStatusCode(_0x60009,0xcc))['catch'](handleError(_0x60009,null));};exports[_0xa84a('0x68')]=function(_0x84029e,_0xe7f026,_0x2cf152){var _0x4473cf={};var _0x18aa85={};var _0x529df6;var _0x42a28c;return db[_0xa84a('0x2b')][_0xa84a('0x67')]({'where':{'id':_0x84029e[_0xa84a('0x42')]['id']}})[_0xa84a('0x21')](handleEntityNotFound(_0xe7f026,null))[_0xa84a('0x21')](function(_0x308c7a){if(_0x308c7a){_0x529df6=_0x308c7a;_0x18aa85[_0xa84a('0x2f')]=_[_0xa84a('0x31')](db['Sound']['rawAttributes']);_0x18aa85[_0xa84a('0x30')]=_[_0xa84a('0x31')](_0x84029e[_0xa84a('0x30')]);_0x18aa85[_0xa84a('0x32')]=_[_0xa84a('0x33')](_0x18aa85[_0xa84a('0x2f')],_0x18aa85[_0xa84a('0x30')]);_0x4473cf[_0xa84a('0x34')]=_[_0xa84a('0x33')](_0x18aa85[_0xa84a('0x2f')],qs[_0xa84a('0x43')](_0x84029e[_0xa84a('0x30')][_0xa84a('0x43')]));_0x4473cf[_0xa84a('0x34')]=_0x4473cf['attributes'][_0xa84a('0x35')]?_0x4473cf[_0xa84a('0x34')]:_0x18aa85['model'];_0x4473cf['order']=qs[_0xa84a('0x38')](_0x84029e[_0xa84a('0x30')][_0xa84a('0x38')]);_0x4473cf[_0xa84a('0x39')]=qs[_0xa84a('0x32')](_[_0xa84a('0x3a')](_0x84029e[_0xa84a('0x30')],_0x18aa85[_0xa84a('0x32')]));if(_0x84029e[_0xa84a('0x30')][_0xa84a('0x3b')]){_0x4473cf[_0xa84a('0x39')]=_['merge'](_0x4473cf['where'],{'$or':_[_0xa84a('0x2a')](_0x4473cf[_0xa84a('0x34')],function(_0x554e62){var _0x331509={};_0x331509[_0x554e62]={'$like':'%'+_0x84029e[_0xa84a('0x30')][_0xa84a('0x3b')]+'%'};return _0x331509;})});}_0x4473cf=_[_0xa84a('0x3c')]({},_0x4473cf,_0x84029e[_0xa84a('0x44')]);return _0x529df6[_0xa84a('0x68')](_0x4473cf);}})[_0xa84a('0x21')](function(_0xfbf811){if(_0xfbf811){_0x42a28c=_0xfbf811[_0xa84a('0x35')];if(!_0x84029e['query'][_0xa84a('0x69')](_0xa84a('0x36'))){_0x4473cf[_0xa84a('0x1a')]=qs['limit'](_0x84029e[_0xa84a('0x30')][_0xa84a('0x1a')]);_0x4473cf[_0xa84a('0x17')]=qs[_0xa84a('0x17')](_0x84029e['query']['offset']);}return _0x529df6[_0xa84a('0x68')](_0x4473cf);}})[_0xa84a('0x21')](function(_0x18c8d2){if(_0x18c8d2){return _0x18c8d2?{'count':_0x42a28c,'rows':_0x18c8d2}:null;}})[_0xa84a('0x21')](respondWithResult(_0xe7f026,null))[_0xa84a('0x46')](handleError(_0xe7f026,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 97fcb2d..906d106 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 _0x5de7=['rimraf','../../config/environment','define','voice_musiconhold','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x31e725,_0x1a6dee){var _0x5add66=function(_0x1c6765){while(--_0x1c6765){_0x31e725['push'](_0x31e725['shift']());}};_0x5add66(++_0x1a6dee);}(_0x5de7,0x1bc));var _0x75de=function(_0x3b3c6b,_0x52d4cd){_0x3b3c6b=_0x3b3c6b-0x0;var _0x5bf36a=_0x5de7[_0x3b3c6b];return _0x5bf36a;};'use strict';var _=require(_0x75de('0x0'));var util=require('util');var logger=require(_0x75de('0x1'))(_0x75de('0x2'));var moment=require(_0x75de('0x3'));var BPromise=require('bluebird');var rp=require(_0x75de('0x4'));var fs=require('fs');var path=require(_0x75de('0x5'));var rimraf=require(_0x75de('0x6'));var config=require(_0x75de('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x3239ac,_0x16be68){return _0x3239ac[_0x75de('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x75de('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ccf=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment'];(function(_0x4e9310,_0x5296e4){var _0x346b79=function(_0x2b0d41){while(--_0x2b0d41){_0x4e9310['push'](_0x4e9310['shift']());}};_0x346b79(++_0x5296e4);}(_0x4ccf,0x109));var _0xf4cc=function(_0x23031a,_0x3fb0f7){_0x23031a=_0x23031a-0x0;var _0x2916d7=_0x4ccf[_0x23031a];return _0x2916d7;};'use strict';var _=require(_0xf4cc('0x0'));var util=require(_0xf4cc('0x1'));var logger=require(_0xf4cc('0x2'))(_0xf4cc('0x3'));var moment=require(_0xf4cc('0x4'));var BPromise=require(_0xf4cc('0x5'));var rp=require(_0xf4cc('0x6'));var fs=require('fs');var path=require(_0xf4cc('0x7'));var rimraf=require(_0xf4cc('0x8'));var config=require(_0xf4cc('0x9'));var attributes=require(_0xf4cc('0xa'));module[_0xf4cc('0xb')]=function(_0x429903,_0x330b7d){return _0x429903[_0xf4cc('0xc')](_0xf4cc('0xd'),attributes,{'tableName':_0xf4cc('0xe'),'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 c019b5e..8f49ae9 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x28d138,_0x21196d){var _0x4beedb=function(_0xab4abc){while(--_0xab4abc){_0x28d138['push'](_0x28d138['shift']());}};_0x4beedb(++_0x21196d);}(_0xedd9,0xfc));var _0x9edd=function(_0x152d5a,_0x493b21){_0x152d5a=_0x152d5a-0x0;var _0x26b85d=_0xedd9[_0x152d5a];return _0x26b85d;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x77e915,_0xa4968e){var _0x19712d=function(_0x1aa6c4){while(--_0x1aa6c4){_0x77e915['push'](_0x77e915['shift']());}};_0x19712d(++_0xa4968e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 8be81f0..28e6e76 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 _0xe233=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/users','/:id/teams','getTeams','post','addAgents','addTeams','delete','destroy','removeAgents','removeTeams','exports','multer','connect-timeout','fs-extra'];(function(_0x152de0,_0x4bbb4f){var _0x29395c=function(_0x443fee){while(--_0x443fee){_0x152de0['push'](_0x152de0['shift']());}};_0x29395c(++_0x4bbb4f);}(_0xe233,0x15b));var _0x3e23=function(_0x52331b,_0x11c9a0){_0x52331b=_0x52331b-0x0;var _0x51f898=_0xe233[_0x52331b];return _0x51f898;};'use strict';var multer=require(_0x3e23('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3e23('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3e23('0x2'));var auth=require(_0x3e23('0x3'));var interaction=require(_0x3e23('0x4'));var config=require(_0x3e23('0x5'));var controller=require(_0x3e23('0x6'));router['get']('/',auth[_0x3e23('0x7')](),controller[_0x3e23('0x8')]);router[_0x3e23('0x9')](_0x3e23('0xa'),auth[_0x3e23('0x7')](),controller[_0x3e23('0xb')]);router[_0x3e23('0x9')](_0x3e23('0xc'),auth[_0x3e23('0x7')](),controller[_0x3e23('0xd')]);router[_0x3e23('0x9')](_0x3e23('0xe'),auth[_0x3e23('0x7')](),controller['getAgents']);router['get'](_0x3e23('0xf'),auth[_0x3e23('0x7')](),controller[_0x3e23('0x10')]);router[_0x3e23('0x11')]('/',auth[_0x3e23('0x7')](),controller['create']);router['post']('/:id/users',auth[_0x3e23('0x7')](),controller[_0x3e23('0x12')]);router[_0x3e23('0x11')](_0x3e23('0xf'),auth[_0x3e23('0x7')](),controller[_0x3e23('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3e23('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3e23('0x15')]);router[_0x3e23('0x14')](_0x3e23('0xe'),auth['isAuthenticated'](),controller[_0x3e23('0x16')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0x3e23('0x17')]);module[_0x3e23('0x18')]=router; \ No newline at end of file +var _0xdfcc=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','/describe','describe','get','/:id/users','getAgents','/:id/teams','post','addAgents','addTeams','put','update'];(function(_0x5b5c45,_0x199467){var _0x2cd0dd=function(_0x3f3266){while(--_0x3f3266){_0x5b5c45['push'](_0x5b5c45['shift']());}};_0x2cd0dd(++_0x199467);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0xdfcc[_0x1a0600];return _0x734670;};'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('./voicePrefix.controller');router['get']('/',auth[_0xcdfc('0x7')](),controller[_0xcdfc('0x8')]);router['get'](_0xcdfc('0x9'),auth[_0xcdfc('0x7')](),controller[_0xcdfc('0xa')]);router[_0xcdfc('0xb')]('/:id',auth[_0xcdfc('0x7')](),controller['show']);router[_0xcdfc('0xb')](_0xcdfc('0xc'),auth[_0xcdfc('0x7')](),controller[_0xcdfc('0xd')]);router[_0xcdfc('0xb')](_0xcdfc('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0xcdfc('0xf')]('/',auth[_0xcdfc('0x7')](),controller['create']);router[_0xcdfc('0xf')](_0xcdfc('0xc'),auth['isAuthenticated'](),controller[_0xcdfc('0x10')]);router[_0xcdfc('0xf')](_0xcdfc('0xe'),auth['isAuthenticated'](),controller[_0xcdfc('0x11')]);router[_0xcdfc('0x12')]('/:id',auth[_0xcdfc('0x7')](),controller[_0xcdfc('0x13')]);router[_0xcdfc('0x14')]('/:id',auth[_0xcdfc('0x7')](),controller[_0xcdfc('0x15')]);router['delete'](_0xcdfc('0xc'),auth[_0xcdfc('0x7')](),controller['removeAgents']);router[_0xcdfc('0x14')](_0xcdfc('0xe'),auth[_0xcdfc('0x7')](),controller['removeTeams']);module[_0xcdfc('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index ea0c859..1e154e2 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 _0xde6d=['VIRTUAL','system-','INTEGER','sequelize','exports','STRING','name'];(function(_0x3148ed,_0x39decf){var _0x199b05=function(_0x8d1f6e){while(--_0x8d1f6e){_0x3148ed['push'](_0x3148ed['shift']());}};_0x199b05(++_0x39decf);}(_0xde6d,0x137));var _0xdde6=function(_0x1291aa,_0x4965bc){_0x1291aa=_0x1291aa-0x0;var _0x10d84d=_0xde6d[_0x1291aa];return _0x10d84d;};'use strict';var Sequelize=require(_0xdde6('0x0'));module[_0xdde6('0x1')]={'name':{'type':Sequelize[_0xdde6('0x2')],'allowNull':![],'unique':_0xdde6('0x3')},'prefix':{'type':Sequelize[_0xdde6('0x4')],'get':function(_0x178360){return _0xdde6('0x5')+this['getDataValue'](_0xdde6('0x3'))+'-';}},'description':{'type':Sequelize[_0xdde6('0x2')]},'callerIdAll':{'type':Sequelize[_0xdde6('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xdde6('0x6')]}}; \ No newline at end of file +var _0xc9ea=['STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports'];(function(_0x5d31d6,_0xce7a0f){var _0x2f0387=function(_0x5dcc2f){while(--_0x5dcc2f){_0x5d31d6['push'](_0x5d31d6['shift']());}};_0x2f0387(++_0xce7a0f);}(_0xc9ea,0x15e));var _0xac9e=function(_0x21fd2b,_0x2104c2){_0x21fd2b=_0x21fd2b-0x0;var _0xc310cc=_0xc9ea[_0x21fd2b];return _0xc310cc;};'use strict';var Sequelize=require(_0xac9e('0x0'));module[_0xac9e('0x1')]={'name':{'type':Sequelize[_0xac9e('0x2')],'allowNull':![],'unique':_0xac9e('0x3')},'prefix':{'type':Sequelize[_0xac9e('0x4')],'get':function(_0x2c8e74){return _0xac9e('0x5')+this[_0xac9e('0x6')](_0xac9e('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xac9e('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xac9e('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 0c968f5..f478632 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 _0x5f66=['map','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoicePrefix','count','includeAll','include','findAll','rows','catch','find','destroy','describe','create','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','goto','charAt','system-','findById','params','addAgents','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','getAgents','hasOwnProperty','getTeams','Team','online','voicePause','interface','flatMap','Agents','sequelize','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','User','select','from','team_has_voice_prefixes','join','user_has_teams','clone','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','reject','update','get','VoicePrefixes','UserProfileResource','then','error','stack','send'];(function(_0x36856f,_0x98b59e){var _0x43ac52=function(_0x36bc47){while(--_0x36bc47){_0x36856f['push'](_0x36856f['shift']());}};_0x43ac52(++_0x98b59e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'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'];config[_0x65f6('0x14')]=_['defaults'](config[_0x65f6('0x14')],{'host':_0x65f6('0x15'),'port':0x18eb});var socket=require(_0x65f6('0x16'))(new Redis(config[_0x65f6('0x14')]));require(_0x65f6('0x17'))[_0x65f6('0x18')](socket);function respondWithStatusCode(_0x44144b,_0xb1d40a){_0xb1d40a=_0xb1d40a||0xcc;return function(_0x46dbc6){if(_0x46dbc6){return _0x44144b[_0x65f6('0x19')](_0xb1d40a);}return _0x44144b['status'](_0xb1d40a)[_0x65f6('0x1a')]();};}function respondWithResult(_0x49a913,_0x5dd324){_0x5dd324=_0x5dd324||0xc8;return function(_0x1693e6){if(_0x1693e6){return _0x49a913[_0x65f6('0x1b')](_0x5dd324)[_0x65f6('0x1c')](_0x1693e6);}};}function respondWithFilteredResult(_0x1c955c,_0x1b1cbb){return function(_0x1f974c){if(_0x1f974c){var _0xc8660c=typeof _0x1b1cbb[_0x65f6('0x1d')]==='undefined'&&typeof _0x1b1cbb['limit']===_0x65f6('0x1e');var _0x5b4055=_0x1f974c['count'];var _0x5c5b91=_0xc8660c?0x0:_0x1b1cbb[_0x65f6('0x1d')];var _0x21ea88=_0xc8660c?_0x1f974c['count']:_0x1b1cbb[_0x65f6('0x1d')]+_0x1b1cbb[_0x65f6('0x1f')];var _0xbee6a4;if(_0x21ea88>=_0x5b4055){_0x21ea88=_0x5b4055;_0xbee6a4=0xc8;}else{_0xbee6a4=0xce;}_0x1c955c[_0x65f6('0x1b')](_0xbee6a4);return _0x1c955c[_0x65f6('0x20')](_0x65f6('0x21'),_0x5c5b91+'-'+_0x21ea88+'/'+_0x5b4055)['json'](_0x1f974c);}return null;};}function patchUpdates(_0x197a49){return function(_0x4bb39e){try{jsonpatch['apply'](_0x4bb39e,_0x197a49,!![]);}catch(_0x212247){return BPromise[_0x65f6('0x22')](_0x212247);}return _0x4bb39e['save']();};}function saveUpdates(_0x1eeaaa,_0x471a33){return function(_0x2317ce){if(_0x2317ce){return _0x2317ce[_0x65f6('0x23')](_0x1eeaaa)['then'](function(_0x9d7bb0){return _0x9d7bb0;});}return null;};}function removeEntity(_0x59ea32,_0x20a161){return function(_0x5963e0){if(_0x5963e0){return _0x5963e0['destroy']()['then'](function(){var _0x29abdb=_0x5963e0[_0x65f6('0x24')]({'plain':!![]});var _0x4b2292=_0x65f6('0x25');return db[_0x65f6('0x26')]['destroy']({'where':{'type':_0x4b2292,'resourceId':_0x29abdb['id']}})[_0x65f6('0x27')](function(){return _0x5963e0;});})[_0x65f6('0x27')](function(){_0x59ea32[_0x65f6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac04b,_0x488d36){return function(_0x266cfe){if(!_0x266cfe){_0x4ac04b[_0x65f6('0x19')](0x194);}return _0x266cfe;};}function handleError(_0x4344b3,_0x408ccc){_0x408ccc=_0x408ccc||0x1f4;return function(_0x518cac){logger[_0x65f6('0x28')](_0x518cac[_0x65f6('0x29')]);if(_0x518cac['name']){delete _0x518cac['name'];}_0x4344b3[_0x65f6('0x1b')](_0x408ccc)[_0x65f6('0x2a')](_0x518cac);};}exports['index']=function(_0x4e50c0,_0x10b368){var _0x1ce43c={},_0x11fe3b={},_0xc53cb7={'count':0x0,'rows':[]};var _0x1217fd=_[_0x65f6('0x2b')](db['VoicePrefix'][_0x65f6('0x2c')],function(_0x38f3c6){return{'name':_0x38f3c6[_0x65f6('0x2d')],'type':_0x38f3c6['type'][_0x65f6('0x2e')]};});_0x11fe3b[_0x65f6('0x2f')]=_[_0x65f6('0x2b')](_0x1217fd,_0x65f6('0x30'));_0x11fe3b[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x4e50c0['query']);_0x11fe3b[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x11fe3b['model'],_0x11fe3b[_0x65f6('0x31')]);_0x1ce43c['attributes']=_[_0x65f6('0x34')](_0x11fe3b['model'],qs[_0x65f6('0x35')](_0x4e50c0[_0x65f6('0x31')]['fields']));_0x1ce43c[_0x65f6('0x36')]=_0x1ce43c[_0x65f6('0x36')][_0x65f6('0x37')]?_0x1ce43c['attributes']:_0x11fe3b['model'];if(!_0x4e50c0[_0x65f6('0x31')]['hasOwnProperty'](_0x65f6('0x38'))){_0x1ce43c['limit']=qs[_0x65f6('0x1f')](_0x4e50c0[_0x65f6('0x31')]['limit']);_0x1ce43c[_0x65f6('0x1d')]=qs['offset'](_0x4e50c0['query'][_0x65f6('0x1d')]);}_0x1ce43c[_0x65f6('0x39')]=qs[_0x65f6('0x3a')](_0x4e50c0[_0x65f6('0x31')][_0x65f6('0x3a')]);_0x1ce43c[_0x65f6('0x3b')]=qs[_0x65f6('0x33')](_[_0x65f6('0x3c')](_0x4e50c0['query'],_0x11fe3b[_0x65f6('0x33')]),_0x1217fd);if(_0x4e50c0['query'][_0x65f6('0x3d')]){_0x1ce43c[_0x65f6('0x3b')]=_[_0x65f6('0x3e')](_0x1ce43c[_0x65f6('0x3b')],{'$or':_['map'](_0x1217fd,function(_0x32148f){if(_0x32148f[_0x65f6('0x3f')]!==_0x65f6('0x40')){var _0x3fb1c6={};_0x3fb1c6[_0x32148f[_0x65f6('0x30')]]={'$like':'%'+_0x4e50c0[_0x65f6('0x31')][_0x65f6('0x3d')]+'%'};return _0x3fb1c6;}})});}_0x1ce43c=_[_0x65f6('0x3e')]({},_0x1ce43c,_0x4e50c0[_0x65f6('0x41')]);var _0x5d8e48={'where':_0x1ce43c[_0x65f6('0x3b')]};return db[_0x65f6('0x42')][_0x65f6('0x43')](_0x5d8e48)[_0x65f6('0x27')](function(_0x83e2d9){_0xc53cb7[_0x65f6('0x43')]=_0x83e2d9;if(_0x4e50c0[_0x65f6('0x31')][_0x65f6('0x44')]){_0x1ce43c[_0x65f6('0x45')]=[{'all':!![]}];}return db[_0x65f6('0x42')][_0x65f6('0x46')](_0x1ce43c);})[_0x65f6('0x27')](function(_0x6c4d94){_0xc53cb7[_0x65f6('0x47')]=_0x6c4d94;return _0xc53cb7;})[_0x65f6('0x27')](respondWithFilteredResult(_0x10b368,_0x1ce43c))[_0x65f6('0x48')](handleError(_0x10b368,null));};exports['show']=function(_0x2dd16c,_0x37cd36){var _0x2d8c45={'raw':![],'where':{'id':_0x2dd16c['params']['id']}},_0x3828c9={};_0x3828c9[_0x65f6('0x2f')]=_[_0x65f6('0x32')](db[_0x65f6('0x42')]['rawAttributes']);_0x3828c9[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x2dd16c[_0x65f6('0x31')]);_0x3828c9[_0x65f6('0x33')]=_['intersection'](_0x3828c9[_0x65f6('0x2f')],_0x3828c9['query']);_0x2d8c45[_0x65f6('0x36')]=_[_0x65f6('0x34')](_0x3828c9['model'],qs[_0x65f6('0x35')](_0x2dd16c['query'][_0x65f6('0x35')]));_0x2d8c45[_0x65f6('0x36')]=_0x2d8c45[_0x65f6('0x36')][_0x65f6('0x37')]?_0x2d8c45[_0x65f6('0x36')]:_0x3828c9[_0x65f6('0x2f')];if(_0x2dd16c['query']['includeAll']){_0x2d8c45[_0x65f6('0x45')]=[{'all':!![]}];}_0x2d8c45=_[_0x65f6('0x3e')]({},_0x2d8c45,_0x2dd16c[_0x65f6('0x41')]);return db[_0x65f6('0x42')][_0x65f6('0x49')](_0x2d8c45)[_0x65f6('0x27')](handleEntityNotFound(_0x37cd36,null))[_0x65f6('0x27')](respondWithResult(_0x37cd36,null))[_0x65f6('0x48')](handleError(_0x37cd36,null));};exports[_0x65f6('0x4a')]=function(_0x517a47,_0x1f16cf){return db[_0x65f6('0x42')][_0x65f6('0x49')]({'where':{'id':_0x517a47['params']['id']}})[_0x65f6('0x27')](handleEntityNotFound(_0x1f16cf,null))[_0x65f6('0x27')](removeEntity(_0x1f16cf,null))['catch'](handleError(_0x1f16cf,null));};exports[_0x65f6('0x4b')]=function(_0x253d52,_0x57eb04){return db[_0x65f6('0x42')]['describe']()[_0x65f6('0x27')](respondWithResult(_0x57eb04,null))[_0x65f6('0x48')](handleError(_0x57eb04,null));};exports[_0x65f6('0x4c')]=function(_0x4b9f0a,_0x1646c5){var _0x43a52e;return db['sequelize'][_0x65f6('0x4d')](function(_0x34312c){return db['VoicePrefix'][_0x65f6('0x4c')](_0x4b9f0a[_0x65f6('0x4e')],{'transaction':_0x34312c})[_0x65f6('0x27')](function(_0x25d504){_0x43a52e=_0x25d504[_0x65f6('0x24')]({'plain':!![]});return db[_0x65f6('0x4f')][_0x65f6('0x49')]({'where':{'id':_0x43a52e[_0x65f6('0x50')]},'raw':!![]})['then'](function(_0x52c5a4){return createVoicePrefixExtensions(_0x43a52e,_0x52c5a4,_0x34312c);});});})['then'](function(){var _0x19f40c=_0x4b9f0a[_0x65f6('0x51')][_0x65f6('0x24')]({'plain':!![]});if(!_0x19f40c)throw new Error(_0x65f6('0x52'));if(_0x19f40c['role']===_0x65f6('0x51')){var _0x2032b9=_0x43a52e;return db[_0x65f6('0x53')]['find']({'where':{'name':_0x65f6('0x25'),'userProfileId':_0x19f40c[_0x65f6('0x54')]},'raw':!![]})[_0x65f6('0x27')](function(_0x4e289e){if(_0x4e289e&&_0x4e289e['autoAssociation']===0x0){return db[_0x65f6('0x26')][_0x65f6('0x4c')]({'name':_0x2032b9[_0x65f6('0x30')],'resourceId':_0x2032b9['id'],'type':_0x4e289e[_0x65f6('0x30')],'sectionId':_0x4e289e['id']},{})[_0x65f6('0x27')](function(){return _0x43a52e;});}else{return _0x43a52e;}})[_0x65f6('0x48')](function(_0x35d77f){logger[_0x65f6('0x28')](_0x65f6('0x55'),_0x35d77f);throw _0x35d77f;});}return _0x43a52e;})[_0x65f6('0x27')](respondWithResult(_0x1646c5,null))[_0x65f6('0x48')](handleError(_0x1646c5,null));};function Extension(_0x141fcc,_0x30adee,_0x3e3143,_0x5ba9c6){this[_0x65f6('0x56')]=_0x65f6('0x57');this[_0x65f6('0x58')]=_0x141fcc;this['app']=_0x3e3143;this[_0x65f6('0x3f')]=_0x65f6('0x59');this[_0x65f6('0x5a')]=_0x65f6('0x5b');this['priority']=_0x30adee;this[_0x65f6('0x5c')]=_0x5ba9c6;}function createVoicePrefixExtensions(_0x4227f5,_0xe5fc65,_0x3e0d8b){return new BPromise(function(_0x553ff0,_0x2923ff){var _0x2fc20f=new Extension(formatPrefixName(_0x4227f5['prefix']),0x1,_0x65f6('0x5d'),_0x65f6('0x5e'));_0x2fc20f[_0x65f6('0x5f')]=_0x4227f5['id'];return db['VoiceExtension'][_0x65f6('0x4c')](_0x2fc20f,{'transaction':_0x3e0d8b})[_0x65f6('0x27')](function(_0x3974ef){var _0x3c23e3=_0x3974ef[_0x65f6('0x24')]({'plain':!![]});var _0x334fa1=_['map'](addVoicePrefixExtensions(_0x4227f5,_0xe5fc65),function(_0x4ee8bd){_0x4ee8bd['VoiceExtensionId']=_0x3c23e3['id'];_0x4ee8bd[_0x65f6('0x5f')]=_0x4227f5['id'];return _0x4ee8bd;});return db[_0x65f6('0x4f')][_0x65f6('0x60')](_0x334fa1,{'transaction':_0x3e0d8b})[_0x65f6('0x27')](function(_0xab6f0){if(!_0xab6f0){return _0x2923ff(_0x65f6('0x61'));}else{return _0x553ff0(_0xab6f0);}})['catch'](function(_0xfbfebc){return _0x2923ff(_0xfbfebc);});});;});};function addVoicePrefixExtensions(_0x1d1532,_0x54b569){var _0x225aeb=[];var _0x39c244=formatPrefixName(_0x1d1532[_0x65f6('0x62')]);_0x225aeb['push'](new Extension(_0x39c244,0x2,_0x65f6('0x63'),_0x65f6('0x64')+_0x1d1532['name']));if(_0x1d1532[_0x65f6('0x65')]){_0x225aeb[_0x65f6('0x66')](new Extension(_0x39c244,0x3,_0x65f6('0x63'),_0x65f6('0x67')+_0x1d1532[_0x65f6('0x65')]));}else{_0x225aeb[_0x65f6('0x66')](new Extension(_0x39c244,0x3,_0x65f6('0x5d'),'No\x20callerid\x20available'));}_0x225aeb['push'](new Extension(_0x39c244,0x4,_0x65f6('0x68'),_0x54b569[_0x65f6('0x56')]+','+'${EXTEN:'+(0x8+_0x1d1532[_0x65f6('0x30')]['length'])+'}'+','+0x1));return _0x225aeb;}function formatPrefixName(_0x3a483b){var _0x4e0450='_';for(var _0x440df1=0x0;_0x440df1<_0x3a483b[_0x65f6('0x37')];_0x440df1++){if(_0x3a483b[_0x65f6('0x69')](_0x440df1)=='-'){_0x4e0450+=_0x3a483b[_0x65f6('0x69')](_0x440df1);}else{_0x4e0450+='['+_0x3a483b[_0x65f6('0x69')](_0x440df1)+']';}}_0x4e0450+='.';return _0x4e0450;}exports[_0x65f6('0x23')]=function(_0x1aaf75,_0x1cc66a,_0x2405a7){var _0x4b7ecd=_0x1aaf75['body'];_0x4b7ecd[_0x65f6('0x62')]=_0x65f6('0x6a')+_0x4b7ecd[_0x65f6('0x30')]+'-';return db['sequelize']['transaction'](function(_0x2dbec2){return db[_0x65f6('0x42')][_0x65f6('0x23')](_0x4b7ecd,{'where':{'id':_0x4b7ecd['id']},'transaction':_0x2dbec2})[_0x65f6('0x27')](function(){return db[_0x65f6('0x4f')][_0x65f6('0x4a')]({'where':{'VoicePrefixId':_0x4b7ecd['id']},'transaction':_0x2dbec2})['then'](function(){return db['VoiceExtension'][_0x65f6('0x49')]({'where':{'id':_0x4b7ecd[_0x65f6('0x50')]},'raw':!![]})['then'](function(_0x219bf8){return createVoicePrefixExtensions(_0x4b7ecd,_0x219bf8,_0x2dbec2);});});});})['then'](function(){return db[_0x65f6('0x42')][_0x65f6('0x6b')](_0x4b7ecd['id']);})[_0x65f6('0x27')](respondWithResult(_0x1cc66a,null))[_0x65f6('0x48')](handleError(_0x1cc66a,null));};exports['addAgents']=function(_0x34ab7b,_0x351d43,_0x11411c){return db['VoicePrefix']['find']({'where':{'id':_0x34ab7b[_0x65f6('0x6c')]['id']}})['then'](handleEntityNotFound(_0x351d43,null))[_0x65f6('0x27')](function(_0xf6de){if(_0xf6de){return _0xf6de[_0x65f6('0x6d')](_0x34ab7b[_0x65f6('0x4e')]['ids'],_['omit'](_0x34ab7b['body'],[_0x65f6('0x6e'),'id'])||{})[_0x65f6('0x6f')](function(_0x161fb2){for(var _0x57464e=0x0;_0x57464e<_0x34ab7b[_0x65f6('0x4e')][_0x65f6('0x6e')][_0x65f6('0x37')];_0x57464e+=0x1){socket['emit'](_0x65f6('0x70'),{'UserId':Number(_0x34ab7b[_0x65f6('0x4e')]['ids'][_0x57464e]),'VoicePrefixId':Number(_0x34ab7b[_0x65f6('0x6c')]['id'])});}return _0x161fb2;});}})[_0x65f6('0x27')](respondWithResult(_0x351d43,null))['catch'](handleError(_0x351d43,null));};exports[_0x65f6('0x71')]=function(_0x5ef825,_0xe8449b,_0x55ea91){return db[_0x65f6('0x42')][_0x65f6('0x49')]({'where':{'id':_0x5ef825['params']['id']}})[_0x65f6('0x27')](handleEntityNotFound(_0xe8449b,null))[_0x65f6('0x27')](function(_0x2a700b){if(_0x2a700b){return _0x2a700b[_0x65f6('0x71')](_0x5ef825[_0x65f6('0x31')][_0x65f6('0x6e')])[_0x65f6('0x27')](function(){if(_[_0x65f6('0x72')](_0x5ef825[_0x65f6('0x31')][_0x65f6('0x6e')])){for(var _0x288eb0=0x0;_0x288eb0<_0x5ef825['query'][_0x65f6('0x6e')][_0x65f6('0x37')];_0x288eb0+=0x1){socket[_0x65f6('0x73')](_0x65f6('0x74'),{'UserId':Number(_0x5ef825['query'][_0x65f6('0x6e')][_0x288eb0]),'VoicePrefixId':Number(_0x5ef825[_0x65f6('0x6c')]['id'])});}}else{socket['emit'](_0x65f6('0x74'),{'UserId':Number(_0x5ef825['query'][_0x65f6('0x6e')]),'VoicePrefixId':Number(_0x5ef825['params']['id'])});}});}})[_0x65f6('0x27')](respondWithStatusCode(_0xe8449b,null))[_0x65f6('0x48')](handleError(_0xe8449b,null));};exports['getAgents']=function(_0x4946c7,_0xa4a742,_0x413c21){var _0x5158c9={};var _0x2d86c8={};var _0x3b3bd5;var _0x73d359;return db['VoicePrefix'][_0x65f6('0x75')]({'where':{'id':_0x4946c7[_0x65f6('0x6c')]['id']}})['then'](handleEntityNotFound(_0xa4a742,null))[_0x65f6('0x27')](function(_0x504b39){if(_0x504b39){_0x3b3bd5=_0x504b39;_0x2d86c8[_0x65f6('0x2f')]=_['keys'](db['User'][_0x65f6('0x2c')]);_0x2d86c8[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x4946c7[_0x65f6('0x31')]);_0x2d86c8[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x2d86c8[_0x65f6('0x2f')],_0x2d86c8[_0x65f6('0x31')]);_0x5158c9['attributes']=_['intersection'](_0x2d86c8[_0x65f6('0x2f')],qs['fields'](_0x4946c7[_0x65f6('0x31')][_0x65f6('0x35')]));_0x5158c9[_0x65f6('0x36')]=_0x5158c9[_0x65f6('0x36')][_0x65f6('0x37')]?_0x5158c9['attributes']:_0x2d86c8[_0x65f6('0x2f')];_0x5158c9[_0x65f6('0x39')]=qs[_0x65f6('0x3a')](_0x4946c7['query'][_0x65f6('0x3a')]);_0x5158c9[_0x65f6('0x3b')]=qs[_0x65f6('0x33')](_[_0x65f6('0x3c')](_0x4946c7[_0x65f6('0x31')],_0x2d86c8[_0x65f6('0x33')]));if(_0x4946c7['query']['filter']){_0x5158c9[_0x65f6('0x3b')]=_[_0x65f6('0x3e')](_0x5158c9[_0x65f6('0x3b')],{'$or':_[_0x65f6('0x2b')](_0x5158c9['attributes'],function(_0x4bda86){var _0x336076={};_0x336076[_0x4bda86]={'$like':'%'+_0x4946c7[_0x65f6('0x31')][_0x65f6('0x3d')]+'%'};return _0x336076;})});}_0x5158c9=_[_0x65f6('0x3e')]({},_0x5158c9,_0x4946c7[_0x65f6('0x41')]);return _0x3b3bd5[_0x65f6('0x76')](_0x5158c9);}})['then'](function(_0x4d607a){if(_0x4d607a){_0x73d359=_0x4d607a['length'];if(!_0x4946c7[_0x65f6('0x31')][_0x65f6('0x77')](_0x65f6('0x38'))){_0x5158c9[_0x65f6('0x1f')]=qs['limit'](_0x4946c7['query'][_0x65f6('0x1f')]);_0x5158c9[_0x65f6('0x1d')]=qs['offset'](_0x4946c7[_0x65f6('0x31')]['offset']);}return _0x3b3bd5[_0x65f6('0x76')](_0x5158c9);}})['then'](function(_0x3a30ed){if(_0x3a30ed){return _0x3a30ed?{'count':_0x73d359,'rows':_0x3a30ed}:null;}})[_0x65f6('0x27')](respondWithResult(_0xa4a742,null))['catch'](handleError(_0xa4a742,null));};exports[_0x65f6('0x78')]=function(_0x330e18,_0x13c03b,_0x9f6e0c){var _0xec6a56={};var _0x144db0={};var _0x584ea4;var _0x45b3e6;return db['VoicePrefix'][_0x65f6('0x75')]({'where':{'id':_0x330e18['params']['id']}})[_0x65f6('0x27')](handleEntityNotFound(_0x13c03b,null))[_0x65f6('0x27')](function(_0xdf396c){if(_0xdf396c){_0x584ea4=_0xdf396c;_0x144db0[_0x65f6('0x2f')]=_['keys'](db[_0x65f6('0x79')][_0x65f6('0x2c')]);_0x144db0[_0x65f6('0x31')]=_['keys'](_0x330e18['query']);_0x144db0[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x144db0['model'],_0x144db0[_0x65f6('0x31')]);_0xec6a56[_0x65f6('0x36')]=_[_0x65f6('0x34')](_0x144db0['model'],qs[_0x65f6('0x35')](_0x330e18[_0x65f6('0x31')]['fields']));_0xec6a56[_0x65f6('0x36')]=_0xec6a56[_0x65f6('0x36')][_0x65f6('0x37')]?_0xec6a56['attributes']:_0x144db0[_0x65f6('0x2f')];_0xec6a56[_0x65f6('0x39')]=qs[_0x65f6('0x3a')](_0x330e18['query'][_0x65f6('0x3a')]);_0xec6a56['where']=qs[_0x65f6('0x33')](_[_0x65f6('0x3c')](_0x330e18[_0x65f6('0x31')],_0x144db0[_0x65f6('0x33')]));if(_0x330e18[_0x65f6('0x31')][_0x65f6('0x3d')]){_0xec6a56['where']=_[_0x65f6('0x3e')](_0xec6a56[_0x65f6('0x3b')],{'$or':_[_0x65f6('0x2b')](_0xec6a56[_0x65f6('0x36')],function(_0x207d15){var _0x59407d={};_0x59407d[_0x207d15]={'$like':'%'+_0x330e18['query']['filter']+'%'};return _0x59407d;})});}_0xec6a56=_[_0x65f6('0x3e')]({},_0xec6a56,_0x330e18[_0x65f6('0x41')]);return _0x584ea4[_0x65f6('0x78')](_0xec6a56);}})['then'](function(_0x151cee){if(_0x151cee){_0x45b3e6=_0x151cee['length'];if(!_0x330e18['query'][_0x65f6('0x77')](_0x65f6('0x38'))){_0xec6a56['limit']=qs[_0x65f6('0x1f')](_0x330e18[_0x65f6('0x31')][_0x65f6('0x1f')]);_0xec6a56[_0x65f6('0x1d')]=qs[_0x65f6('0x1d')](_0x330e18[_0x65f6('0x31')][_0x65f6('0x1d')]);}return _0x584ea4[_0x65f6('0x78')](_0xec6a56);}})[_0x65f6('0x27')](function(_0x350641){if(_0x350641){return _0x350641?{'count':_0x45b3e6,'rows':_0x350641}:null;}})[_0x65f6('0x27')](respondWithResult(_0x13c03b,null))[_0x65f6('0x48')](handleError(_0x13c03b,null));};exports['addTeams']=function(_0x349af7,_0x52dc75,_0x55355f){var _0x24d524=_0x349af7[_0x65f6('0x4e')][_0x65f6('0x6e')];var _0x3727f9;return db['Team'][_0x65f6('0x46')]({'where':{'id':_0x24d524},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x65f6('0x30'),_0x65f6('0x7a'),_0x65f6('0x7b'),_0x65f6('0x7c')],'raw':!![]}]})[_0x65f6('0x27')](function(_0xcdfebe){if(_0xcdfebe){_0x3727f9=_0xcdfebe;var _0x5a33cf=_[_0x65f6('0x7d')](_0xcdfebe,function(_0x56bf49){var _0x1ef2a0=_0x56bf49[_0x65f6('0x24')]({'plain':!![]});return _0x1ef2a0[_0x65f6('0x7e')];});return db['VoicePrefix'][_0x65f6('0x49')]({'where':{'id':_0x349af7['params']['id']}})['then'](function(_0x377d5e){return db[_0x65f6('0x7f')][_0x65f6('0x4d')](function(_0xf364a9){return _0x377d5e[_0x65f6('0x80')](_0x24d524,{'transaction':_0xf364a9})['then'](function(){return BPromise[_0x65f6('0x81')](_0x3727f9,function(_0x400633){return db[_0x65f6('0x82')][_0x65f6('0x83')]({'TeamId':_0x400633['id'],'VoicePrefixId':_0x349af7['params']['id']},{'transaction':_0xf364a9});});})[_0x65f6('0x27')](function(){return BPromise[_0x65f6('0x81')](_0x5a33cf,function(_0x344163){return db[_0x65f6('0x84')][_0x65f6('0x85')]({'where':{'UserId':_0x344163['id'],'VoicePrefixId':_0x349af7[_0x65f6('0x6c')]['id']},'transaction':_0xf364a9});});})[_0x65f6('0x27')](function(){_0x5a33cf[_0x65f6('0x86')](function(_0x558410){socket[_0x65f6('0x73')](_0x65f6('0x70'),{'UserId':_0x558410['id'],'VoicePrefixId':_0x377d5e['id']});});});});});}})[_0x65f6('0x27')](respondWithStatusCode(_0x52dc75,null))[_0x65f6('0x48')](handleError(_0x52dc75,null));};exports[_0x65f6('0x87')]=function(_0x4171a1,_0x57667e,_0x3fd6ee){return db[_0x65f6('0x79')]['findAll']({'where':{'id':_0x4171a1[_0x65f6('0x31')]['ids']},'attributes':['id'],'include':[{'model':db[_0x65f6('0x88')],'as':_0x65f6('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x27')](handleEntityNotFound(_0x57667e,null))[_0x65f6('0x27')](function(_0x2177f1){var _0x55c9bd=_[_0x65f6('0x2b')](_0x2177f1,'id');var _0x395642=[];var _0x2394eb=[];var _0x31870f=squel[_0x65f6('0x89')]();_0x31870f['field']('tq.TeamId')[_0x65f6('0x8a')](_0x65f6('0x8b'),'tq')[_0x65f6('0x8c')](_0x65f6('0x8d'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('VoicePrefixId\x20=\x20?',_0x4171a1[_0x65f6('0x6c')]['id']);for(var _0x3b0a97=0x0;_0x3b0a97<_0x2177f1[_0x65f6('0x37')];_0x3b0a97+=0x1){let _0x50e159=_0x2177f1[_0x3b0a97];for(var _0x12730b=0x0;_0x12730b<_0x50e159[_0x65f6('0x7e')][_0x65f6('0x37')];_0x12730b+=0x1){let _0x18c6a8=_0x50e159[_0x65f6('0x7e')][_0x12730b];var _0x54e258=_0x31870f[_0x65f6('0x8e')]();_0x54e258[_0x65f6('0x3b')]('ut.UserId\x20=\x20?',_0x18c6a8['id']);_0x2394eb['push'](db[_0x65f6('0x7f')][_0x65f6('0x31')](_0x54e258[_0x65f6('0x8f')](),{'type':db[_0x65f6('0x7f')][_0x65f6('0x90')]['SELECT']})[_0x65f6('0x27')](function(_0x4b080a){if(_0x4b080a[_0x65f6('0x37')]===0x1){return _0x18c6a8['id'];}else{var _0x5d181a=_[_0x65f6('0x91')](_['map'](_0x4b080a,_0x65f6('0x92')),function(_0x48a9df){return _[_0x65f6('0x93')](_0x55c9bd,_0x48a9df);});if(_0x5d181a){return _0x18c6a8['id'];}}}));}}return BPromise[_0x65f6('0x94')](_0x2394eb)['then'](function(_0x4f2f43){_0x395642=_(_0x395642)[_0x65f6('0x95')](_0x4f2f43)[_0x65f6('0x96')]()[_0x65f6('0x97')]();return db[_0x65f6('0x42')][_0x65f6('0x49')]({'where':{'id':_0x4171a1[_0x65f6('0x6c')]['id']}})[_0x65f6('0x27')](function(_0x1b5957){return db[_0x65f6('0x7f')][_0x65f6('0x4d')](function(_0x4a90e3){return _0x1b5957[_0x65f6('0x87')](_0x4171a1[_0x65f6('0x31')][_0x65f6('0x6e')],{'transaction':_0x4a90e3})[_0x65f6('0x27')](function(){if(!_[_0x65f6('0x98')](_0x395642)){return _0x1b5957[_0x65f6('0x71')](_0x395642,{'transaction':_0x4a90e3});}})['then'](function(){_0x395642[_0x65f6('0x86')](function(_0x91d7bf){socket[_0x65f6('0x73')](_0x65f6('0x74'),{'UserId':_0x91d7bf,'VoicePrefixId':_0x1b5957['id']});});});});});});})[_0x65f6('0x27')](respondWithStatusCode(_0x57667e,null))[_0x65f6('0x48')](handleError(_0x57667e,null));}; \ No newline at end of file +var _0x236c=['User','getAgents','getTeams','Team','pick','addTeams','findAll','Agents','online','interface','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','includes','all','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./voicePrefix.socket','register','status','end','undefined','count','offset','limit','set','json','apply','reject','save','update','then','UserProfileResource','sendStatus','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','find','destroy','params','describe','create','sequelize','transaction','get','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','context','exten','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','system-','findById','addAgents','ids','omit','spread','removeAgents','isArray','emit','userVoicePrefix:remove','findOne'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x236c,0x155));var _0xc236=function(_0xe79acc,_0x3bdf73){_0xe79acc=_0xe79acc-0x0;var _0xefec82=_0x236c[_0xe79acc];return _0xefec82;};'use strict';var emlformat=require(_0xc236('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc236('0x1'));var jsonpatch=require(_0xc236('0x2'));var rp=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var Mustache=require('mustache');var util=require(_0xc236('0x6'));var path=require(_0xc236('0x7'));var sox=require(_0xc236('0x8'));var csv=require(_0xc236('0x9'));var ejs=require(_0xc236('0xa'));var fs=require('fs');var fs_extra=require(_0xc236('0xb'));var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var authService=require(_0xc236('0x10'));var qs=require(_0xc236('0x11'));var as=require(_0xc236('0x12'));var hardwareService=require(_0xc236('0x13'));var logger=require('../../config/logger')(_0xc236('0x14'));var utils=require(_0xc236('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc236('0x16'));var db=require(_0xc236('0x17'))['db'];config['redis']=_[_0xc236('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc236('0x19'))(new Redis(config[_0xc236('0x1a')]));require(_0xc236('0x1b'))[_0xc236('0x1c')](socket);function respondWithStatusCode(_0x5052db,_0x13a42b){_0x13a42b=_0x13a42b||0xcc;return function(_0x55b188){if(_0x55b188){return _0x5052db['sendStatus'](_0x13a42b);}return _0x5052db[_0xc236('0x1d')](_0x13a42b)[_0xc236('0x1e')]();};}function respondWithResult(_0x443a46,_0x1aeafc){_0x1aeafc=_0x1aeafc||0xc8;return function(_0x267913){if(_0x267913){return _0x443a46['status'](_0x1aeafc)['json'](_0x267913);}};}function respondWithFilteredResult(_0x57355b,_0x3f5884){return function(_0x76f45){if(_0x76f45){var _0x11ec65=typeof _0x3f5884['offset']===_0xc236('0x1f')&&typeof _0x3f5884['limit']==='undefined';var _0x1eafba=_0x76f45[_0xc236('0x20')];var _0x3a6183=_0x11ec65?0x0:_0x3f5884[_0xc236('0x21')];var _0x2b6d3f=_0x11ec65?_0x76f45[_0xc236('0x20')]:_0x3f5884[_0xc236('0x21')]+_0x3f5884[_0xc236('0x22')];var _0x54ffac;if(_0x2b6d3f>=_0x1eafba){_0x2b6d3f=_0x1eafba;_0x54ffac=0xc8;}else{_0x54ffac=0xce;}_0x57355b[_0xc236('0x1d')](_0x54ffac);return _0x57355b[_0xc236('0x23')]('Content-Range',_0x3a6183+'-'+_0x2b6d3f+'/'+_0x1eafba)[_0xc236('0x24')](_0x76f45);}return null;};}function patchUpdates(_0x34d73a){return function(_0x3bd41b){try{jsonpatch[_0xc236('0x25')](_0x3bd41b,_0x34d73a,!![]);}catch(_0x27afba){return BPromise[_0xc236('0x26')](_0x27afba);}return _0x3bd41b[_0xc236('0x27')]();};}function saveUpdates(_0xf921e6,_0x1d65e2){return function(_0x3b4059){if(_0x3b4059){return _0x3b4059[_0xc236('0x28')](_0xf921e6)['then'](function(_0x308cd6){return _0x308cd6;});}return null;};}function removeEntity(_0x21d78f,_0x356042){return function(_0x9017ec){if(_0x9017ec){return _0x9017ec['destroy']()[_0xc236('0x29')](function(){var _0x5da4b2=_0x9017ec['get']({'plain':!![]});var _0x15ead8='VoicePrefixes';return db[_0xc236('0x2a')]['destroy']({'where':{'type':_0x15ead8,'resourceId':_0x5da4b2['id']}})[_0xc236('0x29')](function(){return _0x9017ec;});})['then'](function(){_0x21d78f[_0xc236('0x1d')](0xcc)[_0xc236('0x1e')]();});}};}function handleEntityNotFound(_0x4f5175,_0x5a61b5){return function(_0x265c8d){if(!_0x265c8d){_0x4f5175[_0xc236('0x2b')](0x194);}return _0x265c8d;};}function handleError(_0x1f4995,_0x6ad83f){_0x6ad83f=_0x6ad83f||0x1f4;return function(_0x5f3891){logger['error'](_0x5f3891[_0xc236('0x2c')]);if(_0x5f3891['name']){delete _0x5f3891[_0xc236('0x2d')];}_0x1f4995['status'](_0x6ad83f)[_0xc236('0x2e')](_0x5f3891);};}exports[_0xc236('0x2f')]=function(_0x57c99e,_0x5a5ec3){var _0x2537f9={},_0x3053a3={},_0xbda858={'count':0x0,'rows':[]};var _0x2f64bd=_[_0xc236('0x30')](db[_0xc236('0x31')][_0xc236('0x32')],function(_0x22a2ca){return{'name':_0x22a2ca[_0xc236('0x33')],'type':_0x22a2ca['type']['key']};});_0x3053a3['model']=_[_0xc236('0x30')](_0x2f64bd,_0xc236('0x2d'));_0x3053a3[_0xc236('0x34')]=_[_0xc236('0x35')](_0x57c99e[_0xc236('0x34')]);_0x3053a3[_0xc236('0x36')]=_[_0xc236('0x37')](_0x3053a3['model'],_0x3053a3[_0xc236('0x34')]);_0x2537f9[_0xc236('0x38')]=_[_0xc236('0x37')](_0x3053a3['model'],qs[_0xc236('0x39')](_0x57c99e[_0xc236('0x34')][_0xc236('0x39')]));_0x2537f9[_0xc236('0x38')]=_0x2537f9['attributes'][_0xc236('0x3a')]?_0x2537f9[_0xc236('0x38')]:_0x3053a3[_0xc236('0x3b')];if(!_0x57c99e[_0xc236('0x34')][_0xc236('0x3c')](_0xc236('0x3d'))){_0x2537f9[_0xc236('0x22')]=qs[_0xc236('0x22')](_0x57c99e[_0xc236('0x34')][_0xc236('0x22')]);_0x2537f9[_0xc236('0x21')]=qs[_0xc236('0x21')](_0x57c99e[_0xc236('0x34')][_0xc236('0x21')]);}_0x2537f9[_0xc236('0x3e')]=qs[_0xc236('0x3f')](_0x57c99e[_0xc236('0x34')]['sort']);_0x2537f9['where']=qs['filters'](_['pick'](_0x57c99e[_0xc236('0x34')],_0x3053a3['filters']),_0x2f64bd);if(_0x57c99e[_0xc236('0x34')][_0xc236('0x40')]){_0x2537f9[_0xc236('0x41')]=_[_0xc236('0x42')](_0x2537f9[_0xc236('0x41')],{'$or':_[_0xc236('0x30')](_0x2f64bd,function(_0x427de1){if(_0x427de1[_0xc236('0x43')]!==_0xc236('0x44')){var _0x12a270={};_0x12a270[_0x427de1[_0xc236('0x2d')]]={'$like':'%'+_0x57c99e[_0xc236('0x34')][_0xc236('0x40')]+'%'};return _0x12a270;}})});}_0x2537f9=_[_0xc236('0x42')]({},_0x2537f9,_0x57c99e[_0xc236('0x45')]);var _0x594ffc={'where':_0x2537f9[_0xc236('0x41')]};return db[_0xc236('0x31')]['count'](_0x594ffc)[_0xc236('0x29')](function(_0x5b0bc5){_0xbda858[_0xc236('0x20')]=_0x5b0bc5;if(_0x57c99e['query'][_0xc236('0x46')]){_0x2537f9[_0xc236('0x47')]=[{'all':!![]}];}return db[_0xc236('0x31')]['findAll'](_0x2537f9);})[_0xc236('0x29')](function(_0x429e08){_0xbda858[_0xc236('0x48')]=_0x429e08;return _0xbda858;})['then'](respondWithFilteredResult(_0x5a5ec3,_0x2537f9))[_0xc236('0x49')](handleError(_0x5a5ec3,null));};exports[_0xc236('0x4a')]=function(_0x317431,_0x408312){var _0xc35ef9={'raw':![],'where':{'id':_0x317431['params']['id']}},_0x3235b0={};_0x3235b0[_0xc236('0x3b')]=_['keys'](db[_0xc236('0x31')][_0xc236('0x32')]);_0x3235b0[_0xc236('0x34')]=_[_0xc236('0x35')](_0x317431[_0xc236('0x34')]);_0x3235b0[_0xc236('0x36')]=_[_0xc236('0x37')](_0x3235b0['model'],_0x3235b0[_0xc236('0x34')]);_0xc35ef9['attributes']=_[_0xc236('0x37')](_0x3235b0[_0xc236('0x3b')],qs['fields'](_0x317431[_0xc236('0x34')][_0xc236('0x39')]));_0xc35ef9[_0xc236('0x38')]=_0xc35ef9[_0xc236('0x38')][_0xc236('0x3a')]?_0xc35ef9[_0xc236('0x38')]:_0x3235b0[_0xc236('0x3b')];if(_0x317431['query']['includeAll']){_0xc35ef9[_0xc236('0x47')]=[{'all':!![]}];}_0xc35ef9=_[_0xc236('0x42')]({},_0xc35ef9,_0x317431['options']);return db[_0xc236('0x31')][_0xc236('0x4b')](_0xc35ef9)[_0xc236('0x29')](handleEntityNotFound(_0x408312,null))[_0xc236('0x29')](respondWithResult(_0x408312,null))[_0xc236('0x49')](handleError(_0x408312,null));};exports[_0xc236('0x4c')]=function(_0x300523,_0x14a83d){return db[_0xc236('0x31')]['find']({'where':{'id':_0x300523[_0xc236('0x4d')]['id']}})[_0xc236('0x29')](handleEntityNotFound(_0x14a83d,null))[_0xc236('0x29')](removeEntity(_0x14a83d,null))[_0xc236('0x49')](handleError(_0x14a83d,null));};exports[_0xc236('0x4e')]=function(_0x28e6b4,_0x3ea045){return db['VoicePrefix'][_0xc236('0x4e')]()[_0xc236('0x29')](respondWithResult(_0x3ea045,null))[_0xc236('0x49')](handleError(_0x3ea045,null));};exports[_0xc236('0x4f')]=function(_0x4860d8,_0xa34c01){var _0x3e6da6;return db[_0xc236('0x50')][_0xc236('0x51')](function(_0x9d81c8){return db['VoicePrefix'][_0xc236('0x4f')](_0x4860d8['body'],{'transaction':_0x9d81c8})[_0xc236('0x29')](function(_0x93904b){_0x3e6da6=_0x93904b[_0xc236('0x52')]({'plain':!![]});return db[_0xc236('0x53')][_0xc236('0x4b')]({'where':{'id':_0x3e6da6['VoiceExtensionId']},'raw':!![]})['then'](function(_0x3bee67){return createVoicePrefixExtensions(_0x3e6da6,_0x3bee67,_0x9d81c8);});});})[_0xc236('0x29')](function(){var _0x205d09=_0x4860d8[_0xc236('0x54')][_0xc236('0x52')]({'plain':!![]});if(!_0x205d09)throw new Error(_0xc236('0x55'));if(_0x205d09[_0xc236('0x56')]===_0xc236('0x54')){var _0x24af08=_0x3e6da6;return db[_0xc236('0x57')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x205d09[_0xc236('0x58')]},'raw':!![]})[_0xc236('0x29')](function(_0x8e19c6){if(_0x8e19c6&&_0x8e19c6[_0xc236('0x59')]===0x0){return db['UserProfileResource'][_0xc236('0x4f')]({'name':_0x24af08[_0xc236('0x2d')],'resourceId':_0x24af08['id'],'type':_0x8e19c6['name'],'sectionId':_0x8e19c6['id']},{})[_0xc236('0x29')](function(){return _0x3e6da6;});}else{return _0x3e6da6;}})[_0xc236('0x49')](function(_0x445f03){logger[_0xc236('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x445f03);throw _0x445f03;});}return _0x3e6da6;})[_0xc236('0x29')](respondWithResult(_0xa34c01,null))[_0xc236('0x49')](handleError(_0xa34c01,null));};function Extension(_0x35955c,_0x2602f8,_0x41a160,_0x1edbae){this[_0xc236('0x5b')]='from-sip';this[_0xc236('0x5c')]=_0x35955c;this['app']=_0x41a160;this[_0xc236('0x43')]=_0xc236('0x5d');this[_0xc236('0x5e')]=_0xc236('0x5f');this['priority']=_0x2602f8;this[_0xc236('0x60')]=_0x1edbae;}function createVoicePrefixExtensions(_0x3f1a5f,_0x379e99,_0x4ed4fc){return new BPromise(function(_0x175d5d,_0x2bc7f0){var _0x2ecad1=new Extension(formatPrefixName(_0x3f1a5f[_0xc236('0x61')]),0x1,_0xc236('0x62'),_0xc236('0x63'));_0x2ecad1['VoicePrefixId']=_0x3f1a5f['id'];return db['VoiceExtension'][_0xc236('0x4f')](_0x2ecad1,{'transaction':_0x4ed4fc})[_0xc236('0x29')](function(_0x125f9a){var _0x1e9ad8=_0x125f9a[_0xc236('0x52')]({'plain':!![]});var _0x4649a3=_[_0xc236('0x30')](addVoicePrefixExtensions(_0x3f1a5f,_0x379e99),function(_0x553f58){_0x553f58['VoiceExtensionId']=_0x1e9ad8['id'];_0x553f58['VoicePrefixId']=_0x3f1a5f['id'];return _0x553f58;});return db[_0xc236('0x53')][_0xc236('0x64')](_0x4649a3,{'transaction':_0x4ed4fc})[_0xc236('0x29')](function(_0x2d6b00){if(!_0x2d6b00){return _0x2bc7f0('Extensions\x20creation\x20failed');}else{return _0x175d5d(_0x2d6b00);}})['catch'](function(_0x506910){return _0x2bc7f0(_0x506910);});});;});};function addVoicePrefixExtensions(_0x528d3d,_0x145e86){var _0x5df2ba=[];var _0x20a1eb=formatPrefixName(_0x528d3d['prefix']);_0x5df2ba[_0xc236('0x65')](new Extension(_0x20a1eb,0x2,_0xc236('0x66'),_0xc236('0x67')+_0x528d3d[_0xc236('0x2d')]));if(_0x528d3d[_0xc236('0x68')]){_0x5df2ba[_0xc236('0x65')](new Extension(_0x20a1eb,0x3,_0xc236('0x66'),'PREFIX-CALLERIDALL='+_0x528d3d[_0xc236('0x68')]));}else{_0x5df2ba['push'](new Extension(_0x20a1eb,0x3,_0xc236('0x62'),_0xc236('0x69')));}_0x5df2ba[_0xc236('0x65')](new Extension(_0x20a1eb,0x4,_0xc236('0x6a'),_0x145e86[_0xc236('0x5b')]+','+_0xc236('0x6b')+(0x8+_0x528d3d['name'][_0xc236('0x3a')])+'}'+','+0x1));return _0x5df2ba;}function formatPrefixName(_0x94f65d){var _0x4bb0c6='_';for(var _0x2fb86f=0x0;_0x2fb86f<_0x94f65d[_0xc236('0x3a')];_0x2fb86f++){if(_0x94f65d[_0xc236('0x6c')](_0x2fb86f)=='-'){_0x4bb0c6+=_0x94f65d['charAt'](_0x2fb86f);}else{_0x4bb0c6+='['+_0x94f65d[_0xc236('0x6c')](_0x2fb86f)+']';}}_0x4bb0c6+='.';return _0x4bb0c6;}exports[_0xc236('0x28')]=function(_0x5897a1,_0x2c8f89,_0x340f7c){var _0x1c07d7=_0x5897a1[_0xc236('0x6d')];_0x1c07d7[_0xc236('0x61')]=_0xc236('0x6e')+_0x1c07d7[_0xc236('0x2d')]+'-';return db[_0xc236('0x50')][_0xc236('0x51')](function(_0x5d627d){return db[_0xc236('0x31')][_0xc236('0x28')](_0x1c07d7,{'where':{'id':_0x1c07d7['id']},'transaction':_0x5d627d})[_0xc236('0x29')](function(){return db['VoiceExtension'][_0xc236('0x4c')]({'where':{'VoicePrefixId':_0x1c07d7['id']},'transaction':_0x5d627d})[_0xc236('0x29')](function(){return db[_0xc236('0x53')][_0xc236('0x4b')]({'where':{'id':_0x1c07d7['VoiceExtensionId']},'raw':!![]})[_0xc236('0x29')](function(_0x4a433e){return createVoicePrefixExtensions(_0x1c07d7,_0x4a433e,_0x5d627d);});});});})[_0xc236('0x29')](function(){return db['VoicePrefix'][_0xc236('0x6f')](_0x1c07d7['id']);})[_0xc236('0x29')](respondWithResult(_0x2c8f89,null))['catch'](handleError(_0x2c8f89,null));};exports['addAgents']=function(_0x4ec6d1,_0x930527,_0x4e9624){return db[_0xc236('0x31')][_0xc236('0x4b')]({'where':{'id':_0x4ec6d1['params']['id']}})[_0xc236('0x29')](handleEntityNotFound(_0x930527,null))[_0xc236('0x29')](function(_0x4d7e8d){if(_0x4d7e8d){return _0x4d7e8d[_0xc236('0x70')](_0x4ec6d1[_0xc236('0x6d')][_0xc236('0x71')],_[_0xc236('0x72')](_0x4ec6d1['body'],[_0xc236('0x71'),'id'])||{})[_0xc236('0x73')](function(_0x14cbad){for(var _0x1a27c9=0x0;_0x1a27c9<_0x4ec6d1[_0xc236('0x6d')][_0xc236('0x71')][_0xc236('0x3a')];_0x1a27c9+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x4ec6d1[_0xc236('0x6d')][_0xc236('0x71')][_0x1a27c9]),'VoicePrefixId':Number(_0x4ec6d1[_0xc236('0x4d')]['id'])});}return _0x14cbad;});}})[_0xc236('0x29')](respondWithResult(_0x930527,null))[_0xc236('0x49')](handleError(_0x930527,null));};exports[_0xc236('0x74')]=function(_0x8967c,_0x1c6923,_0x4df1a5){return db['VoicePrefix'][_0xc236('0x4b')]({'where':{'id':_0x8967c['params']['id']}})[_0xc236('0x29')](handleEntityNotFound(_0x1c6923,null))[_0xc236('0x29')](function(_0x25d982){if(_0x25d982){return _0x25d982['removeAgents'](_0x8967c[_0xc236('0x34')]['ids'])[_0xc236('0x29')](function(){if(_[_0xc236('0x75')](_0x8967c[_0xc236('0x34')][_0xc236('0x71')])){for(var _0x48cf03=0x0;_0x48cf03<_0x8967c[_0xc236('0x34')][_0xc236('0x71')]['length'];_0x48cf03+=0x1){socket[_0xc236('0x76')](_0xc236('0x77'),{'UserId':Number(_0x8967c[_0xc236('0x34')][_0xc236('0x71')][_0x48cf03]),'VoicePrefixId':Number(_0x8967c[_0xc236('0x4d')]['id'])});}}else{socket[_0xc236('0x76')](_0xc236('0x77'),{'UserId':Number(_0x8967c['query'][_0xc236('0x71')]),'VoicePrefixId':Number(_0x8967c[_0xc236('0x4d')]['id'])});}});}})[_0xc236('0x29')](respondWithStatusCode(_0x1c6923,null))[_0xc236('0x49')](handleError(_0x1c6923,null));};exports['getAgents']=function(_0x3646c6,_0x1ee8d0,_0x50d1c6){var _0x40fd6d={};var _0x593b62={};var _0x25f91e;var _0xfc94e8;return db['VoicePrefix'][_0xc236('0x78')]({'where':{'id':_0x3646c6[_0xc236('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1ee8d0,null))['then'](function(_0x2a9308){if(_0x2a9308){_0x25f91e=_0x2a9308;_0x593b62[_0xc236('0x3b')]=_[_0xc236('0x35')](db[_0xc236('0x79')][_0xc236('0x32')]);_0x593b62[_0xc236('0x34')]=_['keys'](_0x3646c6[_0xc236('0x34')]);_0x593b62[_0xc236('0x36')]=_[_0xc236('0x37')](_0x593b62[_0xc236('0x3b')],_0x593b62['query']);_0x40fd6d[_0xc236('0x38')]=_[_0xc236('0x37')](_0x593b62[_0xc236('0x3b')],qs[_0xc236('0x39')](_0x3646c6[_0xc236('0x34')]['fields']));_0x40fd6d['attributes']=_0x40fd6d[_0xc236('0x38')]['length']?_0x40fd6d[_0xc236('0x38')]:_0x593b62[_0xc236('0x3b')];_0x40fd6d[_0xc236('0x3e')]=qs[_0xc236('0x3f')](_0x3646c6['query'][_0xc236('0x3f')]);_0x40fd6d['where']=qs[_0xc236('0x36')](_['pick'](_0x3646c6[_0xc236('0x34')],_0x593b62[_0xc236('0x36')]));if(_0x3646c6[_0xc236('0x34')][_0xc236('0x40')]){_0x40fd6d[_0xc236('0x41')]=_[_0xc236('0x42')](_0x40fd6d[_0xc236('0x41')],{'$or':_[_0xc236('0x30')](_0x40fd6d[_0xc236('0x38')],function(_0x577ace){var _0x4849a6={};_0x4849a6[_0x577ace]={'$like':'%'+_0x3646c6[_0xc236('0x34')][_0xc236('0x40')]+'%'};return _0x4849a6;})});}_0x40fd6d=_[_0xc236('0x42')]({},_0x40fd6d,_0x3646c6[_0xc236('0x45')]);return _0x25f91e[_0xc236('0x7a')](_0x40fd6d);}})[_0xc236('0x29')](function(_0x557ad9){if(_0x557ad9){_0xfc94e8=_0x557ad9[_0xc236('0x3a')];if(!_0x3646c6[_0xc236('0x34')][_0xc236('0x3c')](_0xc236('0x3d'))){_0x40fd6d[_0xc236('0x22')]=qs[_0xc236('0x22')](_0x3646c6[_0xc236('0x34')][_0xc236('0x22')]);_0x40fd6d[_0xc236('0x21')]=qs[_0xc236('0x21')](_0x3646c6[_0xc236('0x34')][_0xc236('0x21')]);}return _0x25f91e[_0xc236('0x7a')](_0x40fd6d);}})[_0xc236('0x29')](function(_0x475c8f){if(_0x475c8f){return _0x475c8f?{'count':_0xfc94e8,'rows':_0x475c8f}:null;}})['then'](respondWithResult(_0x1ee8d0,null))[_0xc236('0x49')](handleError(_0x1ee8d0,null));};exports[_0xc236('0x7b')]=function(_0x17080e,_0x1070a3,_0x2bc6ed){var _0x4ed695={};var _0x424b51={};var _0x7bbb2c;var _0x1a938e;return db['VoicePrefix'][_0xc236('0x78')]({'where':{'id':_0x17080e['params']['id']}})['then'](handleEntityNotFound(_0x1070a3,null))[_0xc236('0x29')](function(_0x436845){if(_0x436845){_0x7bbb2c=_0x436845;_0x424b51[_0xc236('0x3b')]=_[_0xc236('0x35')](db[_0xc236('0x7c')]['rawAttributes']);_0x424b51[_0xc236('0x34')]=_[_0xc236('0x35')](_0x17080e[_0xc236('0x34')]);_0x424b51[_0xc236('0x36')]=_[_0xc236('0x37')](_0x424b51['model'],_0x424b51['query']);_0x4ed695[_0xc236('0x38')]=_[_0xc236('0x37')](_0x424b51[_0xc236('0x3b')],qs[_0xc236('0x39')](_0x17080e['query'][_0xc236('0x39')]));_0x4ed695[_0xc236('0x38')]=_0x4ed695[_0xc236('0x38')][_0xc236('0x3a')]?_0x4ed695[_0xc236('0x38')]:_0x424b51['model'];_0x4ed695[_0xc236('0x3e')]=qs[_0xc236('0x3f')](_0x17080e[_0xc236('0x34')][_0xc236('0x3f')]);_0x4ed695[_0xc236('0x41')]=qs['filters'](_[_0xc236('0x7d')](_0x17080e[_0xc236('0x34')],_0x424b51['filters']));if(_0x17080e[_0xc236('0x34')][_0xc236('0x40')]){_0x4ed695[_0xc236('0x41')]=_[_0xc236('0x42')](_0x4ed695[_0xc236('0x41')],{'$or':_['map'](_0x4ed695[_0xc236('0x38')],function(_0x182750){var _0x32f936={};_0x32f936[_0x182750]={'$like':'%'+_0x17080e[_0xc236('0x34')][_0xc236('0x40')]+'%'};return _0x32f936;})});}_0x4ed695=_[_0xc236('0x42')]({},_0x4ed695,_0x17080e['options']);return _0x7bbb2c[_0xc236('0x7b')](_0x4ed695);}})['then'](function(_0x391ad3){if(_0x391ad3){_0x1a938e=_0x391ad3['length'];if(!_0x17080e[_0xc236('0x34')]['hasOwnProperty'](_0xc236('0x3d'))){_0x4ed695['limit']=qs[_0xc236('0x22')](_0x17080e[_0xc236('0x34')][_0xc236('0x22')]);_0x4ed695[_0xc236('0x21')]=qs[_0xc236('0x21')](_0x17080e[_0xc236('0x34')]['offset']);}return _0x7bbb2c[_0xc236('0x7b')](_0x4ed695);}})[_0xc236('0x29')](function(_0x32d1cc){if(_0x32d1cc){return _0x32d1cc?{'count':_0x1a938e,'rows':_0x32d1cc}:null;}})[_0xc236('0x29')](respondWithResult(_0x1070a3,null))[_0xc236('0x49')](handleError(_0x1070a3,null));};exports[_0xc236('0x7e')]=function(_0x424875,_0x14177d,_0x30e7b3){var _0x23fc57=_0x424875[_0xc236('0x6d')][_0xc236('0x71')];var _0x2bed4b;return db[_0xc236('0x7c')][_0xc236('0x7f')]({'where':{'id':_0x23fc57},'attributes':['id'],'include':[{'model':db[_0xc236('0x79')],'as':_0xc236('0x80'),'attributes':['id',_0xc236('0x2d'),_0xc236('0x81'),'voicePause',_0xc236('0x82')],'raw':!![]}]})[_0xc236('0x29')](function(_0x210989){if(_0x210989){_0x2bed4b=_0x210989;var _0x5164e5=_[_0xc236('0x83')](_0x210989,function(_0x32765e){var _0x4f9faf=_0x32765e[_0xc236('0x52')]({'plain':!![]});return _0x4f9faf[_0xc236('0x80')];});return db['VoicePrefix'][_0xc236('0x4b')]({'where':{'id':_0x424875[_0xc236('0x4d')]['id']}})[_0xc236('0x29')](function(_0xfb7a98){return db['sequelize'][_0xc236('0x51')](function(_0x53287f){return _0xfb7a98[_0xc236('0x7e')](_0x23fc57,{'transaction':_0x53287f})[_0xc236('0x29')](function(){return BPromise[_0xc236('0x84')](_0x2bed4b,function(_0x2900ed){return db[_0xc236('0x85')]['upsert']({'TeamId':_0x2900ed['id'],'VoicePrefixId':_0x424875[_0xc236('0x4d')]['id']},{'transaction':_0x53287f});});})[_0xc236('0x29')](function(){return BPromise[_0xc236('0x84')](_0x5164e5,function(_0x29131a){return db[_0xc236('0x86')][_0xc236('0x87')]({'where':{'UserId':_0x29131a['id'],'VoicePrefixId':_0x424875[_0xc236('0x4d')]['id']},'transaction':_0x53287f});});})[_0xc236('0x29')](function(){_0x5164e5[_0xc236('0x88')](function(_0x833f85){socket[_0xc236('0x76')]('userVoicePrefix:save',{'UserId':_0x833f85['id'],'VoicePrefixId':_0xfb7a98['id']});});});});});}})['then'](respondWithStatusCode(_0x14177d,null))[_0xc236('0x49')](handleError(_0x14177d,null));};exports[_0xc236('0x89')]=function(_0x2207a8,_0x36fd37,_0x2494d9){return db[_0xc236('0x7c')][_0xc236('0x7f')]({'where':{'id':_0x2207a8[_0xc236('0x34')][_0xc236('0x71')]},'attributes':['id'],'include':[{'model':db[_0xc236('0x79')],'as':_0xc236('0x80'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x36fd37,null))[_0xc236('0x29')](function(_0x1669c4){var _0x29ae97=_[_0xc236('0x30')](_0x1669c4,'id');var _0x2a8f63=[];var _0x38aecf=[];var _0x2b46e4=squel[_0xc236('0x8a')]();_0x2b46e4['field']('tq.TeamId')['from'](_0xc236('0x8b'),'tq')['join'](_0xc236('0x8c'),'ut',_0xc236('0x8d'))[_0xc236('0x41')](_0xc236('0x8e'),_0x2207a8[_0xc236('0x4d')]['id']);for(var _0x43216e=0x0;_0x43216e<_0x1669c4[_0xc236('0x3a')];_0x43216e+=0x1){let _0x49d232=_0x1669c4[_0x43216e];for(var _0x870908=0x0;_0x870908<_0x49d232[_0xc236('0x80')][_0xc236('0x3a')];_0x870908+=0x1){let _0x364d8d=_0x49d232[_0xc236('0x80')][_0x870908];var _0x53cd27=_0x2b46e4[_0xc236('0x8f')]();_0x53cd27[_0xc236('0x41')](_0xc236('0x90'),_0x364d8d['id']);_0x38aecf[_0xc236('0x65')](db[_0xc236('0x50')][_0xc236('0x34')](_0x53cd27[_0xc236('0x91')](),{'type':db[_0xc236('0x50')][_0xc236('0x92')]['SELECT']})[_0xc236('0x29')](function(_0x281d3c){if(_0x281d3c[_0xc236('0x3a')]===0x1){return _0x364d8d['id'];}else{var _0x33cdb2=_['every'](_[_0xc236('0x30')](_0x281d3c,_0xc236('0x93')),function(_0x5ca99c){return _[_0xc236('0x94')](_0x29ae97,_0x5ca99c);});if(_0x33cdb2){return _0x364d8d['id'];}}}));}}return BPromise[_0xc236('0x95')](_0x38aecf)[_0xc236('0x29')](function(_0x32658a){_0x2a8f63=_(_0x2a8f63)[_0xc236('0x96')](_0x32658a)[_0xc236('0x97')]()[_0xc236('0x98')]();return db[_0xc236('0x31')]['find']({'where':{'id':_0x2207a8[_0xc236('0x4d')]['id']}})[_0xc236('0x29')](function(_0x26c461){return db[_0xc236('0x50')][_0xc236('0x51')](function(_0x57a83b){return _0x26c461[_0xc236('0x89')](_0x2207a8['query'][_0xc236('0x71')],{'transaction':_0x57a83b})[_0xc236('0x29')](function(){if(!_[_0xc236('0x99')](_0x2a8f63)){return _0x26c461[_0xc236('0x74')](_0x2a8f63,{'transaction':_0x57a83b});}})[_0xc236('0x29')](function(){_0x2a8f63[_0xc236('0x88')](function(_0x2e4215){socket[_0xc236('0x76')](_0xc236('0x77'),{'UserId':_0x2e4215,'VoicePrefixId':_0x26c461['id']});});});});});});})[_0xc236('0x29')](respondWithStatusCode(_0x36fd37,null))[_0xc236('0x49')](handleError(_0x36fd37,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 494b2f1..558f2b8 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 _0xe89b=['exports','events','VoicePrefix','save','remove','hasOwnProperty'];(function(_0x3046d6,_0x1c19a8){var _0xe20080=function(_0x110070){while(--_0x110070){_0x3046d6['push'](_0x3046d6['shift']());}};_0xe20080(++_0x1c19a8);}(_0xe89b,0x103));var _0xbe89=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe89b[_0x1035c1];return _0x308d67;};'use strict';var EventEmitter=require(_0xbe89('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xbe89('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe89('0x2'),'afterUpdate':'update','afterDestroy':_0xbe89('0x3')};function emitEvent(_0x490ecc){return function(_0x31b6f5,_0x2cf1cf,_0x1ced8b){VoicePrefixEvents['emit'](_0x490ecc+':'+_0x31b6f5['id'],_0x31b6f5);VoicePrefixEvents['emit'](_0x490ecc,_0x31b6f5);_0x1ced8b(null);};}for(var e in events){if(events[_0xbe89('0x4')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xbe89('0x5')]=VoicePrefixEvents; \ No newline at end of file +var _0x88e5=['VoicePrefix','update','remove','emit','hook','exports','events'];(function(_0x3afbdf,_0x9e463b){var _0x5b6861=function(_0x31d287){while(--_0x31d287){_0x3afbdf['push'](_0x3afbdf['shift']());}};_0x5b6861(++_0x9e463b);}(_0x88e5,0x11e));var _0x588e=function(_0x50035c,_0x5294f2){_0x50035c=_0x50035c-0x0;var _0x35b25b=_0x88e5[_0x50035c];return _0x35b25b;};'use strict';var EventEmitter=require(_0x588e('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x588e('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x588e('0x2'),'afterDestroy':_0x588e('0x3')};function emitEvent(_0x810351){return function(_0x59fde1,_0xce2d3f,_0x5787c0){VoicePrefixEvents[_0x588e('0x4')](_0x810351+':'+_0x59fde1['id'],_0x59fde1);VoicePrefixEvents[_0x588e('0x4')](_0x810351,_0x59fde1);_0x5787c0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x588e('0x5')](e,emitEvent(event));}}module[_0x588e('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 6a27c65..41ec348 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 _0x4fef=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash'];(function(_0x5b400e,_0x9fc487){var _0x20459c=function(_0x12dbe8){while(--_0x12dbe8){_0x5b400e['push'](_0x5b400e['shift']());}};_0x20459c(++_0x9fc487);}(_0x4fef,0x1b1));var _0xf4fe=function(_0x103f2b,_0x207d68){_0x103f2b=_0x103f2b-0x0;var _0x51dea1=_0x4fef[_0x103f2b];return _0x51dea1;};'use strict';var _=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var logger=require(_0xf4fe('0x2'))(_0xf4fe('0x3'));var moment=require(_0xf4fe('0x4'));var BPromise=require(_0xf4fe('0x5'));var rp=require(_0xf4fe('0x6'));var fs=require('fs');var path=require(_0xf4fe('0x7'));var rimraf=require(_0xf4fe('0x8'));var config=require('../../config/environment');var attributes=require(_0xf4fe('0x9'));module[_0xf4fe('0xa')]=function(_0x1901fe,_0x2f7fbb){return _0x1901fe[_0xf4fe('0xb')](_0xf4fe('0xc'),attributes,{'tableName':_0xf4fe('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8684=['util','../../config/logger','bluebird','request-promise','path','rimraf','exports','define','VoicePrefix','voice_prefixes','lodash'];(function(_0x4e55a9,_0x241b22){var _0x4a9b67=function(_0x2a3bd1){while(--_0x2a3bd1){_0x4e55a9['push'](_0x4e55a9['shift']());}};_0x4a9b67(++_0x241b22);}(_0x8684,0x107));var _0x4868=function(_0x12df74,_0x3240fd){_0x12df74=_0x12df74-0x0;var _0x3f994a=_0x8684[_0x12df74];return _0x3f994a;};'use strict';var _=require(_0x4868('0x0'));var util=require(_0x4868('0x1'));var logger=require(_0x4868('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4868('0x3'));var rp=require(_0x4868('0x4'));var fs=require('fs');var path=require(_0x4868('0x5'));var rimraf=require(_0x4868('0x6'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0x4868('0x7')]=function(_0x13513c,_0x87271e){return _0x13513c[_0x4868('0x8')](_0x4868('0x9'),attributes,{'tableName':_0x4868('0xa'),'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 86fe6f2..3509447 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 _0x022a=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x111c3d,_0x29e93b){var _0x2ca569=function(_0x30561a){while(--_0x30561a){_0x111c3d['push'](_0x111c3d['shift']());}};_0x2ca569(++_0x29e93b);}(_0x022a,0x1f0));var _0xa022=function(_0x3ab5bd,_0x56fbcf){_0x3ab5bd=_0x3ab5bd-0x0;var _0xe4109d=_0x022a[_0x3ab5bd];return _0xe4109d;};'use strict';var _=require(_0xa022('0x0'));var util=require(_0xa022('0x1'));var moment=require(_0xa022('0x2'));var BPromise=require(_0xa022('0x3'));var rs=require(_0xa022('0x4'));var fs=require('fs');var Redis=require(_0xa022('0x5'));var db=require(_0xa022('0x6'))['db'];var utils=require(_0xa022('0x7'));var logger=require(_0xa022('0x8'))(_0xa022('0x9'));var config=require(_0xa022('0xa'));var jayson=require(_0xa022('0xb'));var client=jayson['client'][_0xa022('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa022('0xd')],{'host':_0xa022('0xe'),'port':0x18eb});var socket=require(_0xa022('0xf'))(new Redis(config[_0xa022('0xd')]));require(_0xa022('0x10'))[_0xa022('0x11')](socket);function respondWithRpcPromise(_0x45caf1,_0x57ff2f,_0x112ac4){return new BPromise(function(_0x23fdb0,_0x308b67){return client['request'](_0x45caf1,_0x112ac4)[_0xa022('0x12')](function(_0x55e550){logger[_0xa022('0x13')](_0xa022('0x14'),_0x57ff2f,'request\x20sent');logger['debug'](_0xa022('0x15'),_0x57ff2f,_0xa022('0x16'),JSON[_0xa022('0x17')](_0x55e550));if(_0x55e550[_0xa022('0x18')]){if(_0x55e550['error']['code']===0x1f4){logger[_0xa022('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x57ff2f,_0x55e550[_0xa022('0x18')][_0xa022('0x19')]);return _0x308b67(_0x55e550[_0xa022('0x18')][_0xa022('0x19')]);}logger[_0xa022('0x18')](_0xa022('0x14'),_0x57ff2f,_0x55e550[_0xa022('0x18')][_0xa022('0x19')]);return _0x23fdb0(_0x55e550[_0xa022('0x18')][_0xa022('0x19')]);}else{logger[_0xa022('0x13')](_0xa022('0x14'),_0x57ff2f,_0xa022('0x16'));_0x23fdb0(_0x55e550[_0xa022('0x1a')]['message']);}})[_0xa022('0x1b')](function(_0x20498f){logger[_0xa022('0x18')](_0xa022('0x14'),_0x57ff2f,_0x20498f);_0x308b67(_0x20498f);});});} \ No newline at end of file +var _0xfaf2=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','request','info','VoicePrefix,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x267486,_0x4ba81d){var _0xe8cfd8=function(_0x3d812b){while(--_0x3d812b){_0x267486['push'](_0x267486['shift']());}};_0xe8cfd8(++_0x4ba81d);}(_0xfaf2,0x169));var _0x2faf=function(_0xb5090b,_0x4e16ea){_0xb5090b=_0xb5090b-0x0;var _0x3dd48b=_0xfaf2[_0xb5090b];return _0x3dd48b;};'use strict';var _=require(_0x2faf('0x0'));var util=require(_0x2faf('0x1'));var moment=require(_0x2faf('0x2'));var BPromise=require(_0x2faf('0x3'));var rs=require(_0x2faf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2faf('0x5'))['db'];var utils=require(_0x2faf('0x6'));var logger=require(_0x2faf('0x7'))(_0x2faf('0x8'));var config=require(_0x2faf('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x2faf('0xa')]=_[_0x2faf('0xb')](config[_0x2faf('0xa')],{'host':_0x2faf('0xc'),'port':0x18eb});var socket=require(_0x2faf('0xd'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x2faf('0xe')](socket);function respondWithRpcPromise(_0x262959,_0x4ca336,_0x4f041a){return new BPromise(function(_0x3ec8cc,_0x3fa4b0){return client[_0x2faf('0xf')](_0x262959,_0x4f041a)['then'](function(_0x515eb6){logger[_0x2faf('0x10')](_0x2faf('0x11'),_0x4ca336,'request\x20sent');logger[_0x2faf('0x12')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x4ca336,_0x2faf('0x13'),JSON[_0x2faf('0x14')](_0x515eb6));if(_0x515eb6[_0x2faf('0x15')]){if(_0x515eb6[_0x2faf('0x15')][_0x2faf('0x16')]===0x1f4){logger[_0x2faf('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x4ca336,_0x515eb6[_0x2faf('0x15')][_0x2faf('0x17')]);return _0x3fa4b0(_0x515eb6['error'][_0x2faf('0x17')]);}logger[_0x2faf('0x15')](_0x2faf('0x11'),_0x4ca336,_0x515eb6[_0x2faf('0x15')]['message']);return _0x3ec8cc(_0x515eb6[_0x2faf('0x15')][_0x2faf('0x17')]);}else{logger[_0x2faf('0x10')](_0x2faf('0x11'),_0x4ca336,'request\x20sent');_0x3ec8cc(_0x515eb6[_0x2faf('0x18')][_0x2faf('0x17')]);}})[_0x2faf('0x19')](function(_0x2b226b){logger[_0x2faf('0x15')](_0x2faf('0x11'),_0x4ca336,_0x2b226b);_0x3fa4b0(_0x2b226b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 06e113a..8810375 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 _0xffda=['emit','register','length','./voicePrefix.events','save','remove','update'];(function(_0x227e1e,_0x53bd7a){var _0x535a0d=function(_0x5c439f){while(--_0x5c439f){_0x227e1e['push'](_0x227e1e['shift']());}};_0x535a0d(++_0x53bd7a);}(_0xffda,0x73));var _0xaffd=function(_0x35f525,_0x147f8f){_0x35f525=_0x35f525-0x0;var _0x2ab067=_0xffda[_0x35f525];return _0x2ab067;};'use strict';var VoicePrefixEvents=require(_0xaffd('0x0'));var events=[_0xaffd('0x1'),_0xaffd('0x2'),_0xaffd('0x3')];function createListener(_0x594ab8,_0x18e6bf){return function(_0x197651){_0x18e6bf[_0xaffd('0x4')](_0x594ab8,_0x197651);};}function removeListener(_0x4b6295,_0x242061){return function(){VoicePrefixEvents['removeListener'](_0x4b6295,_0x242061);};}exports[_0xaffd('0x5')]=function(_0x400bb8){for(var _0x5747e0=0x0,_0x4ca99e=events[_0xaffd('0x6')];_0x5747e0<_0x4ca99e;_0x5747e0++){var _0x12865c=events[_0x5747e0];var _0x3647e1=createListener('voicePrefix:'+_0x12865c,_0x400bb8);VoicePrefixEvents['on'](_0x12865c,_0x3647e1);}}; \ No newline at end of file +var _0x8d53=['./voicePrefix.events','save','update','emit','removeListener','voicePrefix:'];(function(_0x1d447c,_0x1bae8c){var _0x4ee889=function(_0x1ab771){while(--_0x1ab771){_0x1d447c['push'](_0x1d447c['shift']());}};_0x4ee889(++_0x1bae8c);}(_0x8d53,0x1c2));var _0x38d5=function(_0xe20fdf,_0x4790a3){_0xe20fdf=_0xe20fdf-0x0;var _0x5eab04=_0x8d53[_0xe20fdf];return _0x5eab04;};'use strict';var VoicePrefixEvents=require(_0x38d5('0x0'));var events=[_0x38d5('0x1'),'remove',_0x38d5('0x2')];function createListener(_0x34de32,_0x108137){return function(_0x453bf8){_0x108137[_0x38d5('0x3')](_0x34de32,_0x453bf8);};}function removeListener(_0x19c115,_0x1c8c53){return function(){VoicePrefixEvents[_0x38d5('0x4')](_0x19c115,_0x1c8c53);};}exports['register']=function(_0x31ccc0){for(var _0x5c6cc6=0x0,_0xeb7913=events['length'];_0x5c6cc6<_0xeb7913;_0x5c6cc6++){var _0x5ebf9a=events[_0x5c6cc6];var _0x284f7b=createListener(_0x38d5('0x5')+_0x5ebf9a,_0x31ccc0);VoicePrefixEvents['on'](_0x5ebf9a,_0x284f7b);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index e53ffce..8e8b1d3 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a5011,_0x3778b9){_0x5a5011=_0x5a5011-0x0;var _0x2e6ee1=_0xb10b[_0x5a5011];return _0x2e6ee1;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _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(_0x3af398,_0x17603a){var _0x3f35ed=function(_0x109447){while(--_0x109447){_0x3af398['push'](_0x3af398['shift']());}};_0x3f35ed(++_0x17603a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 7f8368b..8276be2 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 _0x3876=['FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','exports','name','ENUM','inbound','outbound','STRING','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','progressive','predictive','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','wrapuptime','BOOLEAN','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x3876,0xd6));var _0x6387=function(_0x2d6772,_0x43dc14){_0x2d6772=_0x2d6772-0x0;var _0x3b48bf=_0x3876[_0x2d6772];return _0x3b48bf;};'use strict';var Sequelize=require(_0x6387('0x0'));module[_0x6387('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6387('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6387('0x3')](_0x6387('0x4'),_0x6387('0x5')),'allowNull':![],'defaultValue':_0x6387('0x4')},'musiconhold':{'type':Sequelize[_0x6387('0x6')],'defaultValue':_0x6387('0x7')},'announce':{'type':Sequelize[_0x6387('0x6')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x6387('0x8'),_0x6387('0x9'),_0x6387('0xa'),_0x6387('0xb'),_0x6387('0xc'),_0x6387('0xd'),_0x6387('0xe'),_0x6387('0xf')),'allowNull':![],'defaultValue':_0x6387('0x8'),'set':function(_0x1debf8){this[_0x6387('0x10')](_0x6387('0x11'),_0x1debf8?_0x1debf8:_0x6387('0xc'));},'get':function(){var _0xd461f7=this[_0x6387('0x12')](_0x6387('0x13'));var _0xb40f6a=this[_0x6387('0x12')](_0x6387('0x14'));var _0xae66e9=this[_0x6387('0x12')]('strategy');if(_0xd461f7===_0x6387('0x4')){return _0xae66e9;}if(_0xb40f6a===_0x6387('0x15')&&_0xae66e9===_0x6387('0xc')||_0xb40f6a===_0x6387('0x15')&&_0xae66e9==='roundrobin'){return _0xae66e9;}if(_0xb40f6a===_0x6387('0x16')||_0xb40f6a===_0x6387('0x17')||_0xb40f6a==='power'){return _0xae66e9;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x6387('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x6387('0x18')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x6387('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x6387('0x6')]},'weight':{'type':Sequelize[_0x6387('0x18')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x6387('0x3')]('yes','no'),'defaultValue':_0x6387('0x19')},'autopause':{'type':Sequelize[_0x6387('0x3')](_0x6387('0x19'),'no',_0x6387('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x6387('0x18')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x6387('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x6387('0x3')](_0x6387('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x6387('0x18')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x6387('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x6387('0x3')](_0x6387('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x6387('0x3')](_0x6387('0x19'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x6387('0x3')](_0x6387('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x6387('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x6387('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x6387('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x6387('0x3')](_0x6387('0x19'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x6387('0x3')](_0x6387('0x19'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x6387('0x3')](_0x6387('0x19'),'no',_0x6387('0x1b')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x6387('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x6387('0x3')](_0x6387('0x19'),'no')},'announce_position_limit':{'type':Sequelize[_0x6387('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x6387('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x6387('0x6')]},'queue_youarenext':{'type':Sequelize[_0x6387('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x6387('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x6387('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x6387('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x6387('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x6387('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x6387('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x6387('0x6')]},'queue_periodic_announce':{'type':Sequelize[_0x6387('0x6')]},'queue_less_than':{'type':Sequelize[_0x6387('0x6')]},'periodic_announce':{'type':Sequelize[_0x6387('0x1c')],'set':function(_0x413a10){this['setDataValue'](_0x6387('0x1d'),_0x413a10?_0x413a10[_0x6387('0x1e')](','):[]);},'get':function(){return this[_0x6387('0x12')](_0x6387('0x1d'))?this[_0x6387('0x12')](_0x6387('0x1d'))[_0x6387('0x1f')](','):[];}},'joinempty':{'type':Sequelize[_0x6387('0x6')],'defaultValue':_0x6387('0x19'),'set':function(_0x3c2d44){this[_0x6387('0x10')]('joinempty',_0x3c2d44?_0x3c2d44[_0x6387('0x1e')](','):undefined);},'get':function(){return this[_0x6387('0x12')](_0x6387('0x20'))?this[_0x6387('0x12')]('joinempty')[_0x6387('0x1f')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x6387('0x6')],'defaultValue':'no','set':function(_0xc53145){this['setDataValue']('leavewhenempty',_0xc53145?_0xc53145[_0x6387('0x1e')](','):undefined);},'get':function(){return this[_0x6387('0x12')](_0x6387('0x21'))?this[_0x6387('0x12')](_0x6387('0x21'))[_0x6387('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x6387('0x3')](_0x6387('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x6387('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x6387('0x3')](_0x6387('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x6387('0x6')]},'description':{'type':Sequelize[_0x6387('0x6')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x4b1d12){this[_0x6387('0x10')]('acw',_0x4b1d12);if(_0x4b1d12){if(this['getDataValue'](_0x6387('0x22'))<0x2){this[_0x6387('0x10')](_0x6387('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x6387('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x6387('0x23')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x6387('0x3')]('preview','progressive',_0x6387('0x24'),_0x6387('0x17'),_0x6387('0x15')),'defaultValue':_0x6387('0x16'),'comment':_0x6387('0x25')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x6387('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6387('0x27')},'dialLimitQueue':{'type':Sequelize[_0x6387('0x18')](0x4)[_0x6387('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6387('0x28')},'dialPowerLevel':{'type':Sequelize[_0x6387('0x29')](0x2)[_0x6387('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x6387('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0x6387('0x3')](_0x6387('0x2b'),_0x6387('0x2c')),'defaultValue':_0x6387('0x2c'),'comment':_0x6387('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x6387('0x29')](0x2)[_0x6387('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x6387('0x2e')},'dialPredictiveInterval':{'type':Sequelize[_0x6387('0x18')](0x3)[_0x6387('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x6387('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6387('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x6387('0x18')](0x3)[_0x6387('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6387('0x30')},'dialQueueOptions':{'type':Sequelize[_0x6387('0x6')],'defaultValue':'tTxX','comment':_0x6387('0x31')},'dialQueueTimeout':{'type':Sequelize[_0x6387('0x18')](0x3)[_0x6387('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6387('0x32')},'dialQueueProject':{'type':Sequelize[_0x6387('0x6')],'comment':_0x6387('0x33')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6387('0x18')](0x3)[_0x6387('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6387('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6387('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6387('0x35')},'dialBusyMaxRetry':{'type':Sequelize[_0x6387('0x18')](0x3)[_0x6387('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6387('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6387('0x18')](0x5)[_0x6387('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6387('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6387('0x18')](0x3)[_0x6387('0x26')],'defaultValue':0x3,'comment':_0x6387('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6387('0x39')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6387('0x18')](0x3)[_0x6387('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6387('0x3a')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6387('0x6')],'defaultValue':_0x6387('0x3b')},'dialPrefix':{'type':Sequelize[_0x6387('0x6')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x6387('0x3c'),_0x6387('0x3d'),_0x6387('0x3e')),'defaultValue':_0x6387('0x3c')},'dialAMDActive':{'type':Sequelize[_0x6387('0x23')],'defaultValue':0x0,'comment':_0x6387('0x3f')},'dialAMDInitialSilence':{'type':Sequelize[_0x6387('0x18')](0x9)[_0x6387('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6387('0x40')},'dialAMDGreeting':{'type':Sequelize[_0x6387('0x18')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6387('0x41')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6387('0x18')](0x9)[_0x6387('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6387('0x42')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6387('0x18')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x6387('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6387('0x43')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6387('0x18')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6387('0x18')](0x9)[_0x6387('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x6387('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6387('0x44')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6387('0x18')](0x9)[_0x6387('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6387('0x45')},'dialRecallMeTimeout':{'type':Sequelize[_0x6387('0x18')](0x5)[_0x6387('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x6387('0x46')},'dialRecallInQueue':{'type':Sequelize[_0x6387('0x23')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x6387('0x3')]('DESC',_0x6387('0x47')),'defaultValue':_0x6387('0x48')},'dialQueueProject2':{'type':Sequelize[_0x6387('0x6')],'comment':_0x6387('0x33')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x6387('0x23')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6387('0x18')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6387('0x49')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x6387('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6387('0x4a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6387('0x18')](0x3)[_0x6387('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6387('0x4b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6387('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6387('0x4c')},'dialDropMaxRetry':{'type':Sequelize[_0x6387('0x18')](0x3)[_0x6387('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6387('0x4d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6387('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6387('0x18')](0x3)[_0x6387('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6387('0x4e')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6387('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6387('0x4f')},'dialMachineMaxRetry':{'type':Sequelize[_0x6387('0x18')](0x3)[_0x6387('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6387('0x50')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6387('0x18')](0x5)[_0x6387('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6387('0x51')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6387('0x18')](0x3)[_0x6387('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6387('0x52')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6387('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x6387('0x53')},'mandatoryDisposition':{'type':Sequelize[_0x6387('0x23')],'defaultValue':![],'comment':_0x6387('0x54'),'set':function(_0x2fd708){if(!_0x2fd708)this[_0x6387('0x10')]('mandatoryDispositionPauseId',null);this[_0x6387('0x10')]('mandatoryDisposition',_0x2fd708);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x6387('0x18')](0x3)[_0x6387('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x6387('0x18')](0x3)[_0x6387('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x8f99=['setDataValue','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','default','leastrecent','random','rrmemory','linear','wrandom','rrordered'];(function(_0xf709da,_0x5a742c){var _0x2e30a2=function(_0x1b9145){while(--_0x1b9145){_0xf709da['push'](_0xf709da['shift']());}};_0x2e30a2(++_0x5a742c);}(_0x8f99,0x97));var _0x98f9=function(_0x4dc2d1,_0x4e24d9){_0x4dc2d1=_0x4dc2d1-0x0;var _0x485bb6=_0x8f99[_0x4dc2d1];return _0x485bb6;};'use strict';var Sequelize=require(_0x98f9('0x0'));module[_0x98f9('0x1')]={'name':{'type':Sequelize[_0x98f9('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x98f9('0x3')](_0x98f9('0x4'),_0x98f9('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x98f9('0x6')},'announce':{'type':Sequelize[_0x98f9('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x98f9('0x3')]('rr','ringall',_0x98f9('0x7'),'fewestcalls',_0x98f9('0x8'),_0x98f9('0x9'),_0x98f9('0xa'),_0x98f9('0xb'),_0x98f9('0xc')),'allowNull':![],'defaultValue':'ringall','set':function(_0x245c74){this[_0x98f9('0xd')]('strategy',_0x245c74?_0x245c74:'rrmemory');},'get':function(){var _0x15eb81=this[_0x98f9('0xe')](_0x98f9('0xf'));var _0x432ee0=this[_0x98f9('0xe')](_0x98f9('0x10'));var _0x10789f=this[_0x98f9('0xe')]('strategy');if(_0x15eb81===_0x98f9('0x4')){return _0x10789f;}if(_0x432ee0===_0x98f9('0x11')&&_0x10789f===_0x98f9('0x9')||_0x432ee0===_0x98f9('0x11')&&_0x10789f===_0x98f9('0x12')){return _0x10789f;}if(_0x432ee0===_0x98f9('0x13')||_0x432ee0===_0x98f9('0x14')||_0x432ee0===_0x98f9('0x15')){return _0x10789f;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x98f9('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x98f9('0x16')](0xb)},'timeout':{'type':Sequelize[_0x98f9('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x98f9('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x98f9('0x2')]},'weight':{'type':Sequelize[_0x98f9('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x98f9('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x98f9('0x3')](_0x98f9('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x98f9('0x3')]('yes','no',_0x98f9('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x98f9('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x98f9('0x3')](_0x98f9('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x98f9('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x98f9('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x98f9('0x3')](_0x98f9('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x98f9('0x3')](_0x98f9('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x98f9('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x98f9('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x98f9('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x98f9('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x98f9('0x3')](_0x98f9('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x98f9('0x3')](_0x98f9('0x17'),'no'),'defaultValue':_0x98f9('0x17')},'announce_holdtime':{'type':Sequelize[_0x98f9('0x3')](_0x98f9('0x17'),'no',_0x98f9('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x98f9('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x98f9('0x3')](_0x98f9('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x98f9('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x98f9('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x98f9('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x98f9('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x98f9('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x98f9('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x98f9('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x98f9('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x98f9('0x2')]},'queue_quantity2':{'type':Sequelize[_0x98f9('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x98f9('0x2')]},'queue_less_than':{'type':Sequelize[_0x98f9('0x2')]},'periodic_announce':{'type':Sequelize[_0x98f9('0x1a')],'set':function(_0x1965d2){this[_0x98f9('0xd')](_0x98f9('0x1b'),_0x1965d2?_0x1965d2[_0x98f9('0x1c')](','):[]);},'get':function(){return this[_0x98f9('0xe')](_0x98f9('0x1b'))?this[_0x98f9('0xe')](_0x98f9('0x1b'))[_0x98f9('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x98f9('0x2')],'defaultValue':_0x98f9('0x17'),'set':function(_0x52203b){this[_0x98f9('0xd')](_0x98f9('0x1e'),_0x52203b?_0x52203b[_0x98f9('0x1c')](','):undefined);},'get':function(){return this[_0x98f9('0xe')](_0x98f9('0x1e'))?this[_0x98f9('0xe')](_0x98f9('0x1e'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x98f9('0x2')],'defaultValue':'no','set':function(_0x123f84){this[_0x98f9('0xd')]('leavewhenempty',_0x123f84?_0x123f84[_0x98f9('0x1c')](','):undefined);},'get':function(){return this[_0x98f9('0xe')](_0x98f9('0x1f'))?this['getDataValue'](_0x98f9('0x1f'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x98f9('0x3')](_0x98f9('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x98f9('0x3')](_0x98f9('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x98f9('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x98f9('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x98f9('0x2')]},'description':{'type':Sequelize[_0x98f9('0x2')]},'acw':{'type':Sequelize[_0x98f9('0x20')],'defaultValue':0x0,'set':function(_0x1f36e5){this[_0x98f9('0xd')](_0x98f9('0x21'),_0x1f36e5);if(_0x1f36e5){if(this[_0x98f9('0xe')](_0x98f9('0x22'))<0x2){this[_0x98f9('0xd')](_0x98f9('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x98f9('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x98f9('0x20')],'defaultValue':0x0,'comment':_0x98f9('0x23')},'dialMethod':{'type':Sequelize[_0x98f9('0x3')](_0x98f9('0x24'),'progressive',_0x98f9('0x15'),_0x98f9('0x14'),_0x98f9('0x11')),'defaultValue':_0x98f9('0x13'),'comment':_0x98f9('0x25')},'dialLimitChannel':{'type':Sequelize[_0x98f9('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x98f9('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x98f9('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x98f9('0x28')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x98f9('0x29'),_0x98f9('0x2a')),'defaultValue':_0x98f9('0x2a'),'comment':_0x98f9('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x98f9('0x2c')](0x2)[_0x98f9('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x98f9('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x98f9('0x16')](0x3)[_0x98f9('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x98f9('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x98f9('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x98f9('0x16')](0x3)[_0x98f9('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x98f9('0x2e'),'comment':_0x98f9('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x98f9('0x16')](0x3)[_0x98f9('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x98f9('0x30')},'dialQueueProject':{'type':Sequelize[_0x98f9('0x2')],'comment':_0x98f9('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0x98f9('0x16')](0x3)[_0x98f9('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x98f9('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x98f9('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x98f9('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0x98f9('0x16')](0x3)[_0x98f9('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x98f9('0x34')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x98f9('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x98f9('0x27')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x98f9('0x16')](0x5)[_0x98f9('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x98f9('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0x98f9('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x98f9('0x37')},'dialTimezone':{'type':Sequelize[_0x98f9('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x98f9('0x2')],'defaultValue':_0x98f9('0x38')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x98f9('0x3')](_0x98f9('0x39'),_0x98f9('0x3a'),_0x98f9('0x3b')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x98f9('0x20')],'defaultValue':0x0,'comment':_0x98f9('0x3c')},'dialAMDInitialSilence':{'type':Sequelize[_0x98f9('0x16')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x98f9('0x16')](0x9)[_0x98f9('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x98f9('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x98f9('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x98f9('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x98f9('0x16')](0x9)[_0x98f9('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x98f9('0x16')](0x9)[_0x98f9('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x98f9('0x16')](0x9)[_0x98f9('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x98f9('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x98f9('0x16')](0x9)[_0x98f9('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x98f9('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x98f9('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x98f9('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x98f9('0x16')](0x9)[_0x98f9('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x98f9('0x16')](0x5)[_0x98f9('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x98f9('0x42')},'dialRecallInQueue':{'type':Sequelize[_0x98f9('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x98f9('0x3')](_0x98f9('0x43'),_0x98f9('0x44')),'defaultValue':_0x98f9('0x43')},'dialQueueProject2':{'type':Sequelize[_0x98f9('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x98f9('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x98f9('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x98f9('0x45')},'dialCutDigit':{'type':Sequelize[_0x98f9('0x16')](0x3)[_0x98f9('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x98f9('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x98f9('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x98f9('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x98f9('0x16')](0x5)[_0x98f9('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x98f9('0x48')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x98f9('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x98f9('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0x98f9('0x16')](0x5)[_0x98f9('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x98f9('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x98f9('0x16')](0x3)[_0x98f9('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x98f9('0x4b')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x98f9('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x98f9('0x16')](0x5)[_0x98f9('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x98f9('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x98f9('0x16')](0x3)[_0x98f9('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x98f9('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x98f9('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x98f9('0x4f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2137b5){if(!_0x2137b5)this[_0x98f9('0xd')](_0x98f9('0x50'),null);this['setDataValue'](_0x98f9('0x51'),_0x2137b5);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x98f9('0x16')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x98f9('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 2a12274..622f147 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 _0xebbd=['ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','TeamId','all','union','compact','ids','isEmpty','removeAgents','UserVoiceQueueRt','addAgents','spread','isArray','userVoiceQueue:remove','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','into','phone','scheduledAt','ContactId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','fromQuery','ListId','push','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','error','stack','send','index','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','options','VoiceQueue','findAll','catch','show','params','includeAll','include','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','clone','omit','createdAt','updatedAt','destroy','getHoppers','CmHopper','hasOwnProperty','VoiceQueueId','rows','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams'];(function(_0x5ebcda,_0x5aaa0a){var _0x179c8e=function(_0x253a48){while(--_0x253a48){_0x5ebcda['push'](_0x5ebcda['shift']());}};_0x179c8e(++_0x5aaa0a);}(_0xebbd,0xf0));var _0xdebb=function(_0x3cf2ce,_0x4a34f6){_0x3cf2ce=_0x3cf2ce-0x0;var _0x47d881=_0xebbd[_0x3cf2ce];return _0x47d881;};'use strict';var emlformat=require(_0xdebb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdebb('0x1'));var jsonpatch=require(_0xdebb('0x2'));var rp=require(_0xdebb('0x3'));var moment=require(_0xdebb('0x4'));var BPromise=require(_0xdebb('0x5'));var Mustache=require('mustache');var util=require(_0xdebb('0x6'));var path=require(_0xdebb('0x7'));var sox=require(_0xdebb('0x8'));var csv=require(_0xdebb('0x9'));var ejs=require(_0xdebb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdebb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdebb('0xc'));var deskjs=require(_0xdebb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdebb('0xe'));var Redis=require('ioredis');var authService=require(_0xdebb('0xf'));var qs=require(_0xdebb('0x10'));var as=require(_0xdebb('0x11'));var hardwareService=require(_0xdebb('0x12'));var logger=require(_0xdebb('0x13'))(_0xdebb('0x14'));var utils=require(_0xdebb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdebb('0x16'));var db=require(_0xdebb('0x17'))['db'];config['redis']=_[_0xdebb('0x18')](config[_0xdebb('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xdebb('0x1a'))(new Redis(config[_0xdebb('0x19')]));require(_0xdebb('0x1b'))['register'](socket);function respondWithStatusCode(_0x36e03c,_0x349733){_0x349733=_0x349733||0xcc;return function(_0x36368c){if(_0x36368c){return _0x36e03c[_0xdebb('0x1c')](_0x349733);}return _0x36e03c['status'](_0x349733)[_0xdebb('0x1d')]();};}function respondWithResult(_0x2762d4,_0x1f6d43){_0x1f6d43=_0x1f6d43||0xc8;return function(_0x263b89){if(_0x263b89){return _0x2762d4[_0xdebb('0x1e')](_0x1f6d43)[_0xdebb('0x1f')](_0x263b89);}};}function respondWithFilteredResult(_0x5229f9,_0x500aa8){return function(_0x437ed5){if(_0x437ed5){var _0x8cb092=typeof _0x500aa8[_0xdebb('0x20')]===_0xdebb('0x21')&&typeof _0x500aa8[_0xdebb('0x22')]===_0xdebb('0x21');var _0xc2c23c=_0x437ed5[_0xdebb('0x23')];var _0xda9b35=_0x8cb092?0x0:_0x500aa8[_0xdebb('0x20')];var _0x3440e7=_0x8cb092?_0x437ed5[_0xdebb('0x23')]:_0x500aa8[_0xdebb('0x20')]+_0x500aa8[_0xdebb('0x22')];var _0x3c16cf;if(_0x3440e7>=_0xc2c23c){_0x3440e7=_0xc2c23c;_0x3c16cf=0xc8;}else{_0x3c16cf=0xce;}_0x5229f9['status'](_0x3c16cf);return _0x5229f9[_0xdebb('0x24')](_0xdebb('0x25'),_0xda9b35+'-'+_0x3440e7+'/'+_0xc2c23c)[_0xdebb('0x1f')](_0x437ed5);}return null;};}function patchUpdates(_0x5c841f){return function(_0x5477a2){try{jsonpatch[_0xdebb('0x26')](_0x5477a2,_0x5c841f,!![]);}catch(_0x423bd5){return BPromise['reject'](_0x423bd5);}return _0x5477a2[_0xdebb('0x27')]();};}function saveUpdates(_0x45e5fd,_0x33e3b2){return function(_0x2f5996){if(_0x2f5996){return _0x2f5996['update'](_0x45e5fd)[_0xdebb('0x28')](function(_0x9e727a){return _0x9e727a;});}return null;};}function removeEntity(_0x418dba,_0x588b0b){return function(_0xfc6ee3){if(_0xfc6ee3){return _0xfc6ee3['destroy']()['then'](function(){var _0x18e668=_0xfc6ee3[_0xdebb('0x29')]({'plain':!![]});var _0x2c5d1c=[{'name':_0xdebb('0x2a'),'value':_0xdebb('0x2b'),'ignore':![]},{'name':_0xdebb('0x2c'),'value':_0xdebb('0x2d'),'ignore':![]}];var _0x24d3c0=_(_0x2c5d1c)[_0xdebb('0x2e')](_0xdebb('0x2f'))[_0xdebb('0x30')](_0xdebb('0x31'))['value']();if(_[_0xdebb('0x32')](_0x24d3c0,_0x18e668[_0xdebb('0x33')])){return;}var _0x35c0de=_['find'](_0x2c5d1c,[_0xdebb('0x31'),_0x18e668['type']])[_0xdebb('0x34')];return db['UserProfileResource']['destroy']({'where':{'type':_0x35c0de,'resourceId':_0x18e668['id']}})[_0xdebb('0x28')](function(){return _0xfc6ee3;});})[_0xdebb('0x28')](function(){_0x418dba[_0xdebb('0x1e')](0xcc)[_0xdebb('0x1d')]();});}};}function handleEntityNotFound(_0x5a6077,_0x5778d4){return function(_0x12bf31){if(!_0x12bf31){_0x5a6077['sendStatus'](0x194);}return _0x12bf31;};}function handleError(_0xc822ec,_0x259682){_0x259682=_0x259682||0x1f4;return function(_0x369aa1){logger[_0xdebb('0x35')](_0x369aa1[_0xdebb('0x36')]);if(_0x369aa1['name']){delete _0x369aa1['name'];}_0xc822ec['status'](_0x259682)[_0xdebb('0x37')](_0x369aa1);};}exports[_0xdebb('0x38')]=function(_0x4ca625,_0x451a80){var _0x1f9264={},_0x5808cf={},_0x364094={'count':0x0,'rows':[]};var _0x2df3c3=_['map'](db['VoiceQueue'][_0xdebb('0x39')],function(_0x5dd772){return{'name':_0x5dd772[_0xdebb('0x3a')],'type':_0x5dd772[_0xdebb('0x33')][_0xdebb('0x3b')]};});_0x5808cf['model']=_[_0xdebb('0x30')](_0x2df3c3,_0xdebb('0x34'));_0x5808cf['query']=_[_0xdebb('0x3c')](_0x4ca625[_0xdebb('0x3d')]);_0x5808cf[_0xdebb('0x3e')]=_[_0xdebb('0x3f')](_0x5808cf['model'],_0x5808cf['query']);_0x1f9264[_0xdebb('0x40')]=_[_0xdebb('0x3f')](_0x5808cf[_0xdebb('0x41')],qs[_0xdebb('0x42')](_0x4ca625[_0xdebb('0x3d')]['fields']));_0x1f9264[_0xdebb('0x40')]=_0x1f9264[_0xdebb('0x40')][_0xdebb('0x43')]?_0x1f9264[_0xdebb('0x40')]:_0x5808cf[_0xdebb('0x41')];if(!_0x4ca625[_0xdebb('0x3d')]['hasOwnProperty'](_0xdebb('0x44'))){_0x1f9264[_0xdebb('0x22')]=qs[_0xdebb('0x22')](_0x4ca625[_0xdebb('0x3d')]['limit']);_0x1f9264['offset']=qs['offset'](_0x4ca625[_0xdebb('0x3d')][_0xdebb('0x20')]);}_0x1f9264[_0xdebb('0x45')]=qs['sort'](_0x4ca625[_0xdebb('0x3d')][_0xdebb('0x46')]);_0x1f9264[_0xdebb('0x47')]=qs['filters'](_[_0xdebb('0x48')](_0x4ca625[_0xdebb('0x3d')],_0x5808cf['filters']),_0x2df3c3);if(_0x4ca625[_0xdebb('0x3d')][_0xdebb('0x2e')]){_0x1f9264[_0xdebb('0x47')]=_[_0xdebb('0x49')](_0x1f9264[_0xdebb('0x47')],{'$or':_[_0xdebb('0x30')](_0x2df3c3,function(_0x3b3158){if(_0x3b3158['type']!=='VIRTUAL'){var _0x21de26={};_0x21de26[_0x3b3158['name']]={'$like':'%'+_0x4ca625[_0xdebb('0x3d')][_0xdebb('0x2e')]+'%'};return _0x21de26;}})});}_0x1f9264=_[_0xdebb('0x49')]({},_0x1f9264,_0x4ca625[_0xdebb('0x4a')]);var _0x4499a3={'where':_0x1f9264[_0xdebb('0x47')]};return db[_0xdebb('0x4b')][_0xdebb('0x23')](_0x4499a3)[_0xdebb('0x28')](function(_0x42682a){_0x364094[_0xdebb('0x23')]=_0x42682a;if(_0x4ca625[_0xdebb('0x3d')]['includeAll']){_0x1f9264['include']=[{'all':!![]}];}return db[_0xdebb('0x4b')][_0xdebb('0x4c')](_0x1f9264);})[_0xdebb('0x28')](function(_0x28ed12){_0x364094['rows']=_0x28ed12;return _0x364094;})[_0xdebb('0x28')](respondWithFilteredResult(_0x451a80,_0x1f9264))[_0xdebb('0x4d')](handleError(_0x451a80,null));};exports[_0xdebb('0x4e')]=function(_0xba477b,_0x528cc6){var _0x52485c={'raw':![],'where':{'id':_0xba477b[_0xdebb('0x4f')]['id']}},_0x4c4989={};_0x4c4989[_0xdebb('0x41')]=_[_0xdebb('0x3c')](db['VoiceQueue'][_0xdebb('0x39')]);_0x4c4989[_0xdebb('0x3d')]=_['keys'](_0xba477b[_0xdebb('0x3d')]);_0x4c4989['filters']=_[_0xdebb('0x3f')](_0x4c4989[_0xdebb('0x41')],_0x4c4989[_0xdebb('0x3d')]);_0x52485c[_0xdebb('0x40')]=_[_0xdebb('0x3f')](_0x4c4989[_0xdebb('0x41')],qs[_0xdebb('0x42')](_0xba477b[_0xdebb('0x3d')]['fields']));_0x52485c[_0xdebb('0x40')]=_0x52485c['attributes'][_0xdebb('0x43')]?_0x52485c[_0xdebb('0x40')]:_0x4c4989[_0xdebb('0x41')];if(_0xba477b['query'][_0xdebb('0x50')]){_0x52485c[_0xdebb('0x51')]=[{'all':!![]}];}_0x52485c=_[_0xdebb('0x49')]({},_0x52485c,_0xba477b[_0xdebb('0x4a')]);return db[_0xdebb('0x4b')][_0xdebb('0x52')](_0x52485c)[_0xdebb('0x28')](handleEntityNotFound(_0x528cc6,null))['then'](respondWithResult(_0x528cc6,null))[_0xdebb('0x4d')](handleError(_0x528cc6,null));};exports[_0xdebb('0x53')]=function(_0x5d51eb,_0x5a3479){return db['VoiceQueue']['create'](_0x5d51eb[_0xdebb('0x54')],{})[_0xdebb('0x28')](function(_0x51594f){var _0x78d2f6=_0x5d51eb[_0xdebb('0x55')][_0xdebb('0x29')]({'plain':!![]});if(!_0x78d2f6)throw new Error(_0xdebb('0x56'));if(_0x78d2f6[_0xdebb('0x57')]===_0xdebb('0x55')){var _0x530c2b=_0x51594f[_0xdebb('0x29')]({'plain':!![]});var _0x3e7b2e=[{'name':_0xdebb('0x2a'),'value':_0xdebb('0x2b')},{'name':_0xdebb('0x2c'),'value':'outbound'}];var _0x3663d3=_[_0xdebb('0x52')](_0x3e7b2e,[_0xdebb('0x31'),_0x530c2b[_0xdebb('0x33')]])[_0xdebb('0x34')];return db[_0xdebb('0x58')][_0xdebb('0x52')]({'where':{'name':_0x3663d3,'userProfileId':_0x78d2f6[_0xdebb('0x59')]},'raw':!![]})['then'](function(_0xae9033){if(_0xae9033&&_0xae9033[_0xdebb('0x5a')]===0x0){return db[_0xdebb('0x5b')]['create']({'name':_0x530c2b[_0xdebb('0x34')],'resourceId':_0x530c2b['id'],'type':_0xae9033[_0xdebb('0x34')],'sectionId':_0xae9033['id']},{})[_0xdebb('0x28')](function(){return _0x51594f;});}else{return _0x51594f;}})[_0xdebb('0x4d')](function(_0x55dacb){logger[_0xdebb('0x35')](_0xdebb('0x5c'),_0x55dacb);throw _0x55dacb;});}return _0x51594f;})['then'](respondWithResult(_0x5a3479,0xc9))['catch'](handleError(_0x5a3479,null));};exports[_0xdebb('0x5d')]=function(_0x13475e,_0x1b1d9a){var _0x22fa40={'where':{'id':_0x13475e[_0xdebb('0x4f')]['id']}},_0x31f0c5={};_0x31f0c5[_0xdebb('0x41')]=_[_0xdebb('0x3c')](db['VoiceQueue']['rawAttributes']);_0x22fa40[_0xdebb('0x40')]=_[_0xdebb('0x3f')](_0x31f0c5[_0xdebb('0x41')],qs[_0xdebb('0x42')](_0x13475e['query'][_0xdebb('0x42')]));_0x22fa40['attributes']=_0x22fa40['attributes'][_0xdebb('0x43')]?_0x22fa40[_0xdebb('0x40')]:_0x31f0c5[_0xdebb('0x41')];if(_0x13475e[_0xdebb('0x3d')][_0xdebb('0x50')]){_0x22fa40['include']=[{'all':!![]}];}_0x22fa40=_[_0xdebb('0x49')]({},_0x22fa40,_0x13475e[_0xdebb('0x4a')]);return db['VoiceQueue']['find'](_0x22fa40)[_0xdebb('0x28')](handleEntityNotFound(_0x1b1d9a,null))['then'](function(_0x37a4d4){if(_0x37a4d4){var _0x58f93b=_0x37a4d4['get']({'plain':!![]});_0x58f93b=qs[_0xdebb('0x5e')](_0x58f93b,['id',_0xdebb('0x5f'),_0xdebb('0x60')]);_0x13475e[_0xdebb('0x54')]=_['omit'](_0x13475e[_0xdebb('0x54')],['id',_0xdebb('0x5f'),_0xdebb('0x60')]);return db[_0xdebb('0x4b')][_0xdebb('0x53')](_[_0xdebb('0x49')](_0x58f93b,_0x13475e['body']),{'include':_0x13475e[_0xdebb('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xdebb('0x28')](function(_0x153ecb){var _0xf2b339=_0x13475e[_0xdebb('0x55')][_0xdebb('0x29')]({'plain':!![]});if(!_0xf2b339)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf2b339['role']===_0xdebb('0x55')){var _0x435301=_0x153ecb['get']({'plain':!![]});var _0x2f3ab6=[{'name':_0xdebb('0x2a'),'value':_0xdebb('0x2b')},{'name':_0xdebb('0x2c'),'value':_0xdebb('0x2d')}];var _0xf27662=_[_0xdebb('0x52')](_0x2f3ab6,[_0xdebb('0x31'),_0x435301[_0xdebb('0x33')]])['name'];return db['UserProfileSection'][_0xdebb('0x52')]({'where':{'name':_0xf27662,'userProfileId':_0xf2b339[_0xdebb('0x59')]},'raw':!![]})['then'](function(_0x2783a8){if(_0x2783a8&&_0x2783a8[_0xdebb('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x435301[_0xdebb('0x34')],'resourceId':_0x435301['id'],'type':_0x2783a8[_0xdebb('0x34')],'sectionId':_0x2783a8['id']},{})['then'](function(){return _0x153ecb;});}else{return _0x153ecb;}})[_0xdebb('0x4d')](function(_0x28c792){logger[_0xdebb('0x35')](_0xdebb('0x5c'),_0x28c792);throw _0x28c792;});}return _0x153ecb;});}})[_0xdebb('0x28')](respondWithResult(_0x1b1d9a,0xc9))[_0xdebb('0x4d')](handleError(_0x1b1d9a,null));};exports['update']=function(_0x21ea05,_0x4a99df){if(_0x21ea05['body']['id']){delete _0x21ea05[_0xdebb('0x54')]['id'];}return db[_0xdebb('0x4b')][_0xdebb('0x52')]({'where':{'id':_0x21ea05[_0xdebb('0x4f')]['id']}})[_0xdebb('0x28')](handleEntityNotFound(_0x4a99df,null))[_0xdebb('0x28')](saveUpdates(_0x21ea05[_0xdebb('0x54')],null))[_0xdebb('0x28')](respondWithResult(_0x4a99df,null))[_0xdebb('0x4d')](handleError(_0x4a99df,null));};exports[_0xdebb('0x61')]=function(_0x4a5da7,_0x304900){return db['VoiceQueue']['find']({'where':{'id':_0x4a5da7[_0xdebb('0x4f')]['id']}})[_0xdebb('0x28')](handleEntityNotFound(_0x304900,null))[_0xdebb('0x28')](removeEntity(_0x304900,null))['catch'](handleError(_0x304900,null));};exports[_0xdebb('0x62')]=function(_0x211fef,_0x1bb457,_0x3d9215){var _0x250759={'raw':![],'where':{}};var _0x2a25ac={};var _0x3f19e3={'count':0x0,'rows':[]};return db[_0xdebb('0x4b')]['findOne']({'where':{'id':_0x211fef['params']['id']}})['then'](handleEntityNotFound(_0x1bb457,null))[_0xdebb('0x28')](function(_0x454a34){if(_0x454a34){_0x2a25ac[_0xdebb('0x41')]=_[_0xdebb('0x3c')](db[_0xdebb('0x63')][_0xdebb('0x39')]);_0x2a25ac[_0xdebb('0x3d')]=_[_0xdebb('0x3c')](_0x211fef[_0xdebb('0x3d')]);_0x2a25ac[_0xdebb('0x3e')]=_[_0xdebb('0x3f')](_0x2a25ac['model'],_0x2a25ac[_0xdebb('0x3d')]);_0x250759[_0xdebb('0x40')]=_['intersection'](_0x2a25ac[_0xdebb('0x41')],qs[_0xdebb('0x42')](_0x211fef[_0xdebb('0x3d')][_0xdebb('0x42')]));_0x250759[_0xdebb('0x40')]=_0x250759[_0xdebb('0x40')]['length']?_0x250759[_0xdebb('0x40')]:_0x2a25ac[_0xdebb('0x41')];if(!_0x211fef[_0xdebb('0x3d')][_0xdebb('0x64')](_0xdebb('0x44'))){_0x250759[_0xdebb('0x22')]=qs['limit'](_0x211fef[_0xdebb('0x3d')][_0xdebb('0x22')]);_0x250759[_0xdebb('0x20')]=qs[_0xdebb('0x20')](_0x211fef['query']['offset']);}_0x250759[_0xdebb('0x45')]=qs[_0xdebb('0x46')](_0x211fef['query']['sort']);_0x250759[_0xdebb('0x47')]=qs['filters'](_[_0xdebb('0x48')](_0x211fef[_0xdebb('0x3d')],_0x2a25ac[_0xdebb('0x3e')]));_0x250759[_0xdebb('0x47')][_0xdebb('0x65')]=_0x454a34['id'];if(_0x211fef[_0xdebb('0x3d')][_0xdebb('0x2e')]){_0x250759[_0xdebb('0x47')]=_[_0xdebb('0x49')](_0x250759[_0xdebb('0x47')],{'$or':_['map'](_0x250759['attributes'],function(_0xfc75f0){var _0x2c7631={};_0x2c7631[_0xfc75f0]={'$like':'%'+_0x211fef[_0xdebb('0x3d')][_0xdebb('0x2e')]+'%'};return _0x2c7631;})});}_0x250759=_['merge']({},_0x250759,_0x211fef[_0xdebb('0x4a')]);return db['CmHopper'][_0xdebb('0x23')]({'where':_0x250759[_0xdebb('0x47')]})['then'](function(_0x10ca65){_0x3f19e3[_0xdebb('0x23')]=_0x10ca65;if(_0x211fef[_0xdebb('0x3d')]['includeAll']){_0x250759[_0xdebb('0x51')]=[{'all':!![]}];}return db[_0xdebb('0x63')][_0xdebb('0x4c')](_0x250759);})[_0xdebb('0x28')](function(_0x3923eb){_0x3f19e3[_0xdebb('0x66')]=_0x3923eb;return _0x3f19e3;});}})[_0xdebb('0x28')](respondWithFilteredResult(_0x1bb457,_0x250759))[_0xdebb('0x4d')](handleError(_0x1bb457,null));};exports['getHopperHistories']=function(_0x55170c,_0x41accc,_0x376ac4){var _0x56a6bb={'raw':!![],'where':{}};var _0x22ef93={};var _0x1b0199={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xdebb('0x67')]({'where':{'id':_0x55170c[_0xdebb('0x4f')]['id']}})['then'](handleEntityNotFound(_0x41accc,null))['then'](function(_0x3c894b){if(_0x3c894b){_0x22ef93[_0xdebb('0x41')]=_[_0xdebb('0x3c')](db[_0xdebb('0x68')][_0xdebb('0x39')]);_0x22ef93[_0xdebb('0x3d')]=_[_0xdebb('0x3c')](_0x55170c[_0xdebb('0x3d')]);_0x22ef93[_0xdebb('0x3e')]=_[_0xdebb('0x3f')](_0x22ef93[_0xdebb('0x41')],_0x22ef93[_0xdebb('0x3d')]);_0x56a6bb['attributes']=_[_0xdebb('0x3f')](_0x22ef93[_0xdebb('0x41')],qs['fields'](_0x55170c[_0xdebb('0x3d')][_0xdebb('0x42')]));_0x56a6bb[_0xdebb('0x40')]=_0x56a6bb[_0xdebb('0x40')][_0xdebb('0x43')]?_0x56a6bb[_0xdebb('0x40')]:_0x22ef93[_0xdebb('0x41')];if(!_0x55170c[_0xdebb('0x3d')][_0xdebb('0x64')](_0xdebb('0x44'))){_0x56a6bb[_0xdebb('0x22')]=qs[_0xdebb('0x22')](_0x55170c[_0xdebb('0x3d')]['limit']);_0x56a6bb[_0xdebb('0x20')]=qs[_0xdebb('0x20')](_0x55170c['query'][_0xdebb('0x20')]);}_0x56a6bb[_0xdebb('0x45')]=qs[_0xdebb('0x46')](_0x55170c[_0xdebb('0x3d')][_0xdebb('0x46')]);_0x56a6bb[_0xdebb('0x47')]=qs[_0xdebb('0x3e')](_['pick'](_0x55170c[_0xdebb('0x3d')],_0x22ef93['filters']));_0x56a6bb['where']['VoiceQueueId']=_0x3c894b['id'];if(_0x55170c['query'][_0xdebb('0x2e')]){_0x56a6bb[_0xdebb('0x47')]=_[_0xdebb('0x49')](_0x56a6bb[_0xdebb('0x47')],{'$or':_[_0xdebb('0x30')](_0x56a6bb['attributes'],function(_0x3999a1){var _0x491838={};_0x491838[_0x3999a1]={'$like':'%'+_0x55170c[_0xdebb('0x3d')]['filter']+'%'};return _0x491838;})});}_0x56a6bb=_[_0xdebb('0x49')]({},_0x56a6bb,_0x55170c['options']);return db['CmHopperHistory']['count']({'where':_0x56a6bb[_0xdebb('0x47')]})['then'](function(_0x2fa5e0){_0x1b0199[_0xdebb('0x23')]=_0x2fa5e0;if(_0x55170c[_0xdebb('0x3d')][_0xdebb('0x50')]){_0x56a6bb[_0xdebb('0x51')]=[{'all':!![]}];}return db[_0xdebb('0x68')][_0xdebb('0x4c')](_0x56a6bb);})['then'](function(_0x3dad5f){_0x1b0199['rows']=_0x3dad5f;return _0x1b0199;});}})[_0xdebb('0x28')](respondWithFilteredResult(_0x41accc,_0x56a6bb))[_0xdebb('0x4d')](handleError(_0x41accc,null));};exports[_0xdebb('0x69')]=function(_0x42f8fe,_0x5db23a,_0x45bf6e){var _0x6c5ac6={'raw':!![],'where':{}};var _0x10be2a={};var _0x31974a={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xdebb('0x67')]({'where':{'id':_0x42f8fe[_0xdebb('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5db23a,null))[_0xdebb('0x28')](function(_0x29330b){if(_0x29330b){_0x10be2a[_0xdebb('0x41')]=_['keys'](db[_0xdebb('0x6a')][_0xdebb('0x39')]);_0x10be2a['query']=_[_0xdebb('0x3c')](_0x42f8fe[_0xdebb('0x3d')]);_0x10be2a[_0xdebb('0x3e')]=_[_0xdebb('0x3f')](_0x10be2a['model'],_0x10be2a[_0xdebb('0x3d')]);_0x6c5ac6[_0xdebb('0x40')]=_[_0xdebb('0x3f')](_0x10be2a[_0xdebb('0x41')],qs[_0xdebb('0x42')](_0x42f8fe[_0xdebb('0x3d')][_0xdebb('0x42')]));_0x6c5ac6[_0xdebb('0x40')]=_0x6c5ac6[_0xdebb('0x40')][_0xdebb('0x43')]?_0x6c5ac6['attributes']:_0x10be2a[_0xdebb('0x41')];if(!_0x42f8fe[_0xdebb('0x3d')][_0xdebb('0x64')](_0xdebb('0x44'))){_0x6c5ac6[_0xdebb('0x22')]=qs[_0xdebb('0x22')](_0x42f8fe['query'][_0xdebb('0x22')]);_0x6c5ac6[_0xdebb('0x20')]=qs['offset'](_0x42f8fe['query'][_0xdebb('0x20')]);}_0x6c5ac6['order']=qs['sort'](_0x42f8fe[_0xdebb('0x3d')][_0xdebb('0x46')]);_0x6c5ac6[_0xdebb('0x47')]=qs[_0xdebb('0x3e')](_['pick'](_0x42f8fe[_0xdebb('0x3d')],_0x10be2a[_0xdebb('0x3e')]));_0x6c5ac6[_0xdebb('0x47')][_0xdebb('0x65')]=_0x29330b['id'];if(_0x42f8fe[_0xdebb('0x3d')][_0xdebb('0x2e')]){_0x6c5ac6['where']=_[_0xdebb('0x49')](_0x6c5ac6[_0xdebb('0x47')],{'$or':_[_0xdebb('0x30')](_0x6c5ac6[_0xdebb('0x40')],function(_0x39897a){var _0x3f586a={};_0x3f586a[_0x39897a]={'$like':'%'+_0x42f8fe[_0xdebb('0x3d')][_0xdebb('0x2e')]+'%'};return _0x3f586a;})});}_0x6c5ac6=_[_0xdebb('0x49')]({},_0x6c5ac6,_0x42f8fe['options']);return db[_0xdebb('0x6a')][_0xdebb('0x23')]({'where':_0x6c5ac6[_0xdebb('0x47')]})[_0xdebb('0x28')](function(_0x491752){_0x31974a[_0xdebb('0x23')]=_0x491752;if(_0x42f8fe['query'][_0xdebb('0x50')]){_0x6c5ac6[_0xdebb('0x51')]=[{'all':!![]}];}return db[_0xdebb('0x6a')][_0xdebb('0x4c')](_0x6c5ac6);})[_0xdebb('0x28')](function(_0xef2ef2){_0x31974a[_0xdebb('0x66')]=_0xef2ef2;return _0x31974a;});}})['then'](respondWithFilteredResult(_0x5db23a,_0x6c5ac6))[_0xdebb('0x4d')](handleError(_0x5db23a,null));};exports[_0xdebb('0x6b')]=function(_0x15b5db,_0x165cd0,_0x194abd){var _0x23217b={'raw':!![],'where':{}};var _0x16c58a={};var _0x37854a={'count':0x0,'rows':[]};return db[_0xdebb('0x4b')][_0xdebb('0x67')]({'where':{'id':_0x15b5db['params']['id']}})[_0xdebb('0x28')](handleEntityNotFound(_0x165cd0,null))[_0xdebb('0x28')](function(_0x414e19){if(_0x414e19){_0x16c58a['model']=_[_0xdebb('0x3c')](db[_0xdebb('0x6c')][_0xdebb('0x39')]);_0x16c58a['query']=_[_0xdebb('0x3c')](_0x15b5db[_0xdebb('0x3d')]);_0x16c58a['filters']=_['intersection'](_0x16c58a[_0xdebb('0x41')],_0x16c58a[_0xdebb('0x3d')]);_0x23217b[_0xdebb('0x40')]=_[_0xdebb('0x3f')](_0x16c58a[_0xdebb('0x41')],qs['fields'](_0x15b5db['query'][_0xdebb('0x42')]));_0x23217b[_0xdebb('0x40')]=_0x23217b['attributes'][_0xdebb('0x43')]?_0x23217b['attributes']:_0x16c58a[_0xdebb('0x41')];if(!_0x15b5db[_0xdebb('0x3d')][_0xdebb('0x64')]('nolimit')){_0x23217b[_0xdebb('0x22')]=qs[_0xdebb('0x22')](_0x15b5db[_0xdebb('0x3d')]['limit']);_0x23217b[_0xdebb('0x20')]=qs[_0xdebb('0x20')](_0x15b5db[_0xdebb('0x3d')][_0xdebb('0x20')]);}_0x23217b[_0xdebb('0x45')]=qs[_0xdebb('0x46')](_0x15b5db['query'][_0xdebb('0x46')]);_0x23217b[_0xdebb('0x47')]=qs[_0xdebb('0x3e')](_[_0xdebb('0x48')](_0x15b5db[_0xdebb('0x3d')],_0x16c58a[_0xdebb('0x3e')]));_0x23217b[_0xdebb('0x47')]['VoiceQueueId']=_0x414e19['id'];if(_0x15b5db[_0xdebb('0x3d')][_0xdebb('0x2e')]){_0x23217b[_0xdebb('0x47')]=_[_0xdebb('0x49')](_0x23217b[_0xdebb('0x47')],{'$or':_[_0xdebb('0x30')](_0x23217b[_0xdebb('0x40')],function(_0x2da3a0){var _0x1b7df4={};_0x1b7df4[_0x2da3a0]={'$like':'%'+_0x15b5db[_0xdebb('0x3d')]['filter']+'%'};return _0x1b7df4;})});}_0x23217b=_[_0xdebb('0x49')]({},_0x23217b,_0x15b5db[_0xdebb('0x4a')]);return db[_0xdebb('0x6c')][_0xdebb('0x23')]({'where':_0x23217b[_0xdebb('0x47')]})['then'](function(_0x5249c6){_0x37854a[_0xdebb('0x23')]=_0x5249c6;if(_0x15b5db[_0xdebb('0x3d')][_0xdebb('0x50')]){_0x23217b[_0xdebb('0x51')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xdebb('0x4c')](_0x23217b);})[_0xdebb('0x28')](function(_0x492e44){_0x37854a[_0xdebb('0x66')]=_0x492e44;return _0x37854a;});}})[_0xdebb('0x28')](respondWithFilteredResult(_0x165cd0,_0x23217b))['catch'](handleError(_0x165cd0,null));};exports['getTeams']=function(_0x4ada4b,_0x2e1c71,_0x3640ff){var _0x45b343={};var _0x86394d={};var _0xd1b2b3;var _0x12a5bb;return db[_0xdebb('0x4b')][_0xdebb('0x67')]({'where':{'id':_0x4ada4b[_0xdebb('0x4f')]['id']}})[_0xdebb('0x28')](handleEntityNotFound(_0x2e1c71,null))[_0xdebb('0x28')](function(_0x2db81b){if(_0x2db81b){_0xd1b2b3=_0x2db81b;_0x86394d['model']=_[_0xdebb('0x3c')](db[_0xdebb('0x6d')]['rawAttributes']);_0x86394d[_0xdebb('0x3d')]=_[_0xdebb('0x3c')](_0x4ada4b[_0xdebb('0x3d')]);_0x86394d[_0xdebb('0x3e')]=_[_0xdebb('0x3f')](_0x86394d[_0xdebb('0x41')],_0x86394d[_0xdebb('0x3d')]);_0x45b343[_0xdebb('0x40')]=_[_0xdebb('0x3f')](_0x86394d[_0xdebb('0x41')],qs['fields'](_0x4ada4b[_0xdebb('0x3d')][_0xdebb('0x42')]));_0x45b343[_0xdebb('0x40')]=_0x45b343['attributes'][_0xdebb('0x43')]?_0x45b343['attributes']:_0x86394d[_0xdebb('0x41')];_0x45b343[_0xdebb('0x45')]=qs['sort'](_0x4ada4b[_0xdebb('0x3d')]['sort']);_0x45b343[_0xdebb('0x47')]=qs[_0xdebb('0x3e')](_['pick'](_0x4ada4b[_0xdebb('0x3d')],_0x86394d[_0xdebb('0x3e')]));if(_0x4ada4b[_0xdebb('0x3d')][_0xdebb('0x2e')]){_0x45b343[_0xdebb('0x47')]=_[_0xdebb('0x49')](_0x45b343['where'],{'$or':_[_0xdebb('0x30')](_0x45b343[_0xdebb('0x40')],function(_0x4c5dbd){var _0x2ccf13={};_0x2ccf13[_0x4c5dbd]={'$like':'%'+_0x4ada4b[_0xdebb('0x3d')][_0xdebb('0x2e')]+'%'};return _0x2ccf13;})});}_0x45b343=_[_0xdebb('0x49')]({},_0x45b343,_0x4ada4b[_0xdebb('0x4a')]);return _0xd1b2b3[_0xdebb('0x6e')](_0x45b343);}})[_0xdebb('0x28')](function(_0x46e4c0){if(_0x46e4c0){_0x12a5bb=_0x46e4c0[_0xdebb('0x43')];if(!_0x4ada4b['query'][_0xdebb('0x64')]('nolimit')){_0x45b343[_0xdebb('0x22')]=qs[_0xdebb('0x22')](_0x4ada4b[_0xdebb('0x3d')][_0xdebb('0x22')]);_0x45b343[_0xdebb('0x20')]=qs[_0xdebb('0x20')](_0x4ada4b['query'][_0xdebb('0x20')]);}return _0xd1b2b3[_0xdebb('0x6e')](_0x45b343);}})[_0xdebb('0x28')](function(_0xceb3fb){if(_0xceb3fb){return _0xceb3fb?{'count':_0x12a5bb,'rows':_0xceb3fb}:null;}})[_0xdebb('0x28')](respondWithResult(_0x2e1c71,null))[_0xdebb('0x4d')](handleError(_0x2e1c71,null));};exports[_0xdebb('0x6f')]=function(_0x753c58,_0x16728d,_0x2280ed){var _0x4754f6=_0x753c58[_0xdebb('0x54')][_0xdebb('0x70')];var _0x2ce758=_[_0xdebb('0x30')](_0x4754f6,'id');return db[_0xdebb('0x6d')][_0xdebb('0x4c')]({'where':{'id':_0x2ce758},'attributes':['id'],'include':[{'model':db[_0xdebb('0x71')],'as':_0xdebb('0x72'),'attributes':['id',_0xdebb('0x34'),_0xdebb('0x73'),_0xdebb('0x74'),_0xdebb('0x75')],'raw':!![]}]})[_0xdebb('0x28')](function(_0x5ee30c){if(_0x5ee30c){var _0xce6b6d=_[_0xdebb('0x76')](_0x5ee30c,function(_0x38b9c4){var _0x4fe36f=_0x38b9c4['get']({'plain':!![]});_0x4fe36f[_0xdebb('0x72')][_0xdebb('0x77')](function(_0x46a80f){_0x46a80f[_0xdebb('0x78')]=_[_0xdebb('0x52')](_0x4754f6,{'id':_0x4fe36f['id']})[_0xdebb('0x78')];});return _0x4fe36f[_0xdebb('0x72')];});return db[_0xdebb('0x4b')][_0xdebb('0x52')]({'where':{'id':_0x753c58[_0xdebb('0x4f')]['id']}})['then'](function(_0x58bc46){return db['sequelize'][_0xdebb('0x79')](function(_0x243f35){return _0x58bc46['addTeams'](_0x2ce758,{'transaction':_0x243f35})[_0xdebb('0x28')](function(){return BPromise[_0xdebb('0x7a')](_0x4754f6,function(_0x5457ad){return db[_0xdebb('0x7b')][_0xdebb('0x7c')]({'TeamId':_0x5457ad['id'],'VoiceQueueId':_0x753c58['params']['id'],'penalty':_0x5457ad[_0xdebb('0x78')]},{'transaction':_0x243f35});});})[_0xdebb('0x28')](function(){return BPromise[_0xdebb('0x7a')](_0xce6b6d,function(_0x40d3b6){return db[_0xdebb('0x7d')][_0xdebb('0x7e')]({'where':{'UserId':_0x40d3b6['id'],'VoiceQueueId':_0x753c58[_0xdebb('0x4f')]['id']},'defaults':{'penalty':_0x40d3b6[_0xdebb('0x78')]},'transaction':_0x243f35});});})[_0xdebb('0x28')](function(){return BPromise['each'](_[_0xdebb('0x2e')](_0xce6b6d,{'online':!![]}),function(_0x2cf957){return db['UserVoiceQueueRt']['upsert']({'membername':_0x2cf957[_0xdebb('0x34')],'UserId':_0x2cf957['id'],'queue_name':_0x58bc46[_0xdebb('0x34')],'VoiceQueueId':_0x58bc46['id'],'interface':_[_0xdebb('0x7f')](_0x2cf957[_0xdebb('0x75')])?util[_0xdebb('0x80')](_0xdebb('0x81'),_0x2cf957[_0xdebb('0x34')]):_0x2cf957[_0xdebb('0x75')],'paused':_0x2cf957[_0xdebb('0x74')]||![],'penalty':_0x2cf957['penalty']},{'transaction':_0x243f35});});})[_0xdebb('0x28')](function(){_0xce6b6d[_0xdebb('0x77')](function(_0x16b058){socket[_0xdebb('0x82')](_0xdebb('0x83'),{'UserId':_0x16b058['id'],'VoiceQueueId':_0x58bc46['id']});});});});});}})[_0xdebb('0x28')](respondWithStatusCode(_0x16728d,null))[_0xdebb('0x4d')](handleError(_0x16728d,null));};exports[_0xdebb('0x84')]=function(_0xbcb6e2,_0x4a031f,_0x53c528){return db[_0xdebb('0x6d')][_0xdebb('0x4c')]({'where':{'id':_0xbcb6e2[_0xdebb('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0xdebb('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4a031f,null))[_0xdebb('0x28')](function(_0x1e86ac){var _0x420249=_['map'](_0x1e86ac,'id');var _0x3bf50c=[];var _0x2f1fff=[];var _0x509298=squel[_0xdebb('0x85')]();_0x509298[_0xdebb('0x86')](_0xdebb('0x87'))[_0xdebb('0x88')](_0xdebb('0x89'),'tq')[_0xdebb('0x8a')](_0xdebb('0x8b'),'ut',_0xdebb('0x8c'))[_0xdebb('0x47')](_0xdebb('0x8d'),_0xbcb6e2[_0xdebb('0x4f')]['id']);for(var _0x17d2a7=0x0;_0x17d2a7<_0x1e86ac[_0xdebb('0x43')];_0x17d2a7+=0x1){let _0x169281=_0x1e86ac[_0x17d2a7];for(var _0x879622=0x0;_0x879622<_0x169281[_0xdebb('0x72')][_0xdebb('0x43')];_0x879622+=0x1){let _0x2ebf54=_0x169281['Agents'][_0x879622];var _0x4b8448=_0x509298[_0xdebb('0x5d')]();_0x4b8448[_0xdebb('0x47')](_0xdebb('0x8e'),_0x2ebf54['id']);_0x2f1fff['push'](db[_0xdebb('0x8f')]['query'](_0x4b8448[_0xdebb('0x90')](),{'type':db[_0xdebb('0x8f')][_0xdebb('0x91')][_0xdebb('0x92')]})[_0xdebb('0x28')](function(_0x3b0926){if(_0x3b0926[_0xdebb('0x43')]===0x1){return _0x2ebf54['id'];}else{var _0x58ca70=_['every'](_[_0xdebb('0x30')](_0x3b0926,_0xdebb('0x93')),function(_0x188ecb){return _[_0xdebb('0x32')](_0x420249,_0x188ecb);});if(_0x58ca70){return _0x2ebf54['id'];}}}));}}return BPromise[_0xdebb('0x94')](_0x2f1fff)[_0xdebb('0x28')](function(_0x5072da){_0x3bf50c=_(_0x3bf50c)[_0xdebb('0x95')](_0x5072da)[_0xdebb('0x96')]()[_0xdebb('0x31')]();return db['VoiceQueue'][_0xdebb('0x52')]({'where':{'id':_0xbcb6e2[_0xdebb('0x4f')]['id']}})[_0xdebb('0x28')](function(_0x30e3a2){return db['sequelize'][_0xdebb('0x79')](function(_0x156249){return _0x30e3a2[_0xdebb('0x84')](_0xbcb6e2[_0xdebb('0x3d')][_0xdebb('0x97')],{'transaction':_0x156249})[_0xdebb('0x28')](function(){if(!_[_0xdebb('0x98')](_0x3bf50c)){return _0x30e3a2[_0xdebb('0x99')](_0x3bf50c,{'transaction':_0x156249})[_0xdebb('0x28')](function(){return db[_0xdebb('0x9a')]['destroy']({'where':{'VoiceQueueId':_0xbcb6e2[_0xdebb('0x4f')]['id'],'UserId':_0x3bf50c},'transaction':_0x156249});});}})['then'](function(){_0x3bf50c[_0xdebb('0x77')](function(_0x26229d){socket[_0xdebb('0x82')]('userVoiceQueue:remove',{'UserId':_0x26229d,'VoiceQueueId':_0x30e3a2['id']});});});});});});})[_0xdebb('0x28')](respondWithStatusCode(_0x4a031f,null))[_0xdebb('0x4d')](handleError(_0x4a031f,null));};exports[_0xdebb('0x9b')]=function(_0x50cd64,_0x4bc1b7,_0x4eef30){var _0x2a4c78,_0x42bee5;return db[_0xdebb('0x4b')][_0xdebb('0x52')]({'where':{'id':_0x50cd64['params']['id']}})[_0xdebb('0x28')](handleEntityNotFound(_0x4bc1b7,null))[_0xdebb('0x28')](function(_0x4f923b){if(_0x4f923b){_0x42bee5=_0x4f923b;return _0x4f923b[_0xdebb('0x9b')](_0x50cd64[_0xdebb('0x54')]['ids'],_[_0xdebb('0x5e')](_0x50cd64[_0xdebb('0x54')],[_0xdebb('0x97'),'id'])||{})[_0xdebb('0x9c')](function(_0x1b34fa){for(var _0x1798dc=0x0;_0x1798dc<_0x50cd64[_0xdebb('0x54')]['ids'][_0xdebb('0x43')];_0x1798dc+=0x1){socket[_0xdebb('0x82')](_0xdebb('0x83'),{'UserId':Number(_0x50cd64[_0xdebb('0x54')][_0xdebb('0x97')][_0x1798dc]),'VoiceQueueId':Number(_0x50cd64['params']['id'])});}return _0x1b34fa;});}})[_0xdebb('0x28')](function(_0x1d5402){_0x2a4c78=_0x1d5402||[];if(_0x42bee5){return db['User'][_0xdebb('0x4c')]({'where':{'id':_0x50cd64[_0xdebb('0x54')][_0xdebb('0x97')]},'attributes':['id',_0xdebb('0x34'),_0xdebb('0x73'),_0xdebb('0x74'),_0xdebb('0x75')],'raw':!![]});}})['then'](function(_0x21718e){if(!_[_0xdebb('0x98')](_0x21718e)){var _0x25271c=[];for(var _0xbc5110=0x0;_0xbc5110<_0x21718e[_0xdebb('0x43')];_0xbc5110++){if(_0x21718e[_0xbc5110][_0xdebb('0x73')]){_0x25271c['push'](db['UserVoiceQueueRt'][_0xdebb('0x7c')]({'membername':_0x21718e[_0xbc5110][_0xdebb('0x34')],'UserId':_0x21718e[_0xbc5110]['id'],'queue_name':_0x42bee5[_0xdebb('0x34')],'VoiceQueueId':_0x42bee5['id'],'interface':_[_0xdebb('0x7f')](_0x21718e[_0xbc5110][_0xdebb('0x75')])?util[_0xdebb('0x80')]('SIP/%s',_0x21718e[_0xbc5110][_0xdebb('0x34')]):_0x21718e[_0xbc5110][_0xdebb('0x75')],'paused':_0x21718e[_0xbc5110]['voicePause']||![],'penalty':_0x50cd64['body']['penalty']||0x0}));}}return BPromise[_0xdebb('0x94')](_0x25271c);}})[_0xdebb('0x28')](function(){return _0x2a4c78;})[_0xdebb('0x28')](respondWithResult(_0x4bc1b7,null))[_0xdebb('0x4d')](handleError(_0x4bc1b7,null));};exports[_0xdebb('0x99')]=function(_0x524ac6,_0x1a6c1c,_0xc0e7bc){return db[_0xdebb('0x4b')][_0xdebb('0x52')]({'where':{'id':_0x524ac6[_0xdebb('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1a6c1c,null))[_0xdebb('0x28')](function(_0x438f93){if(_0x438f93){return _0x438f93[_0xdebb('0x99')](_0x524ac6[_0xdebb('0x3d')][_0xdebb('0x97')])[_0xdebb('0x28')](function(){if(_[_0xdebb('0x9d')](_0x524ac6['query'][_0xdebb('0x97')])){for(var _0x2c2f18=0x0;_0x2c2f18<_0x524ac6[_0xdebb('0x3d')][_0xdebb('0x97')]['length'];_0x2c2f18+=0x1){socket[_0xdebb('0x82')](_0xdebb('0x9e'),{'UserId':Number(_0x524ac6[_0xdebb('0x3d')][_0xdebb('0x97')][_0x2c2f18]),'VoiceQueueId':Number(_0x524ac6[_0xdebb('0x4f')]['id'])});}}else{socket[_0xdebb('0x82')](_0xdebb('0x9e'),{'UserId':Number(_0x524ac6[_0xdebb('0x3d')]['ids']),'VoiceQueueId':Number(_0x524ac6['params']['id'])});}});}})[_0xdebb('0x28')](function(_0xd59492){return db[_0xdebb('0x9a')]['destroy']({'where':{'VoiceQueueId':_0x524ac6[_0xdebb('0x4f')]['id'],'UserId':_0x524ac6[_0xdebb('0x3d')]['ids']}})[_0xdebb('0x28')](function(){return _0xd59492;});})[_0xdebb('0x28')](respondWithStatusCode(_0x1a6c1c,null))[_0xdebb('0x4d')](handleError(_0x1a6c1c,null));};exports[_0xdebb('0x9f')]=function(_0x5a6992,_0xa8d79a,_0x51767a){var _0x1195dd={};var _0x5dcc8e={};var _0x4ff57a;var _0x20e066;return db[_0xdebb('0x4b')][_0xdebb('0x67')]({'where':{'id':_0x5a6992[_0xdebb('0x4f')]['id']}})['then'](handleEntityNotFound(_0xa8d79a,null))[_0xdebb('0x28')](function(_0x5204e1){if(_0x5204e1){_0x4ff57a=_0x5204e1;_0x5dcc8e[_0xdebb('0x41')]=_[_0xdebb('0x3c')](db[_0xdebb('0x71')][_0xdebb('0x39')]);_0x5dcc8e['query']=_[_0xdebb('0x3c')](_0x5a6992[_0xdebb('0x3d')]);_0x5dcc8e[_0xdebb('0x3e')]=_[_0xdebb('0x3f')](_0x5dcc8e[_0xdebb('0x41')],_0x5dcc8e['query']);_0x1195dd[_0xdebb('0x40')]=_[_0xdebb('0x3f')](_0x5dcc8e[_0xdebb('0x41')],qs[_0xdebb('0x42')](_0x5a6992[_0xdebb('0x3d')][_0xdebb('0x42')]));_0x1195dd[_0xdebb('0x40')]=_0x1195dd[_0xdebb('0x40')]['length']?_0x1195dd['attributes']:_0x5dcc8e['model'];_0x1195dd[_0xdebb('0x45')]=qs['sort'](_0x5a6992[_0xdebb('0x3d')][_0xdebb('0x46')]);_0x1195dd[_0xdebb('0x47')]=qs[_0xdebb('0x3e')](_[_0xdebb('0x48')](_0x5a6992[_0xdebb('0x3d')],_0x5dcc8e[_0xdebb('0x3e')]));if(_0x5a6992[_0xdebb('0x3d')][_0xdebb('0x2e')]){_0x1195dd[_0xdebb('0x47')]=_[_0xdebb('0x49')](_0x1195dd['where'],{'$or':_[_0xdebb('0x30')](_0x1195dd['attributes'],function(_0xa585a8){var _0x55bbdb={};_0x55bbdb[_0xa585a8]={'$like':'%'+_0x5a6992[_0xdebb('0x3d')][_0xdebb('0x2e')]+'%'};return _0x55bbdb;})});}_0x1195dd=_['merge']({},_0x1195dd,_0x5a6992[_0xdebb('0x4a')]);return _0x4ff57a['getAgents'](_0x1195dd);}})['then'](function(_0x1fe8c4){if(_0x1fe8c4){_0x20e066=_0x1fe8c4[_0xdebb('0x43')];if(!_0x5a6992[_0xdebb('0x3d')][_0xdebb('0x64')](_0xdebb('0x44'))){_0x1195dd[_0xdebb('0x22')]=qs[_0xdebb('0x22')](_0x5a6992[_0xdebb('0x3d')][_0xdebb('0x22')]);_0x1195dd['offset']=qs[_0xdebb('0x20')](_0x5a6992['query'][_0xdebb('0x20')]);}return _0x4ff57a['getAgents'](_0x1195dd);}})[_0xdebb('0x28')](function(_0x32b996){if(_0x32b996){return _0x32b996?{'count':_0x20e066,'rows':_0x32b996}:null;}})['then'](respondWithResult(_0xa8d79a,null))[_0xdebb('0x4d')](handleError(_0xa8d79a,null));};exports[_0xdebb('0xa0')]=function(_0x28d776,_0x433730,_0x2196c8){var _0x171243={};var _0x5b5d17={};var _0x35130d;var _0x252819;return db[_0xdebb('0x4b')][_0xdebb('0x67')]({'where':{'id':_0x28d776['params']['id']}})[_0xdebb('0x28')](handleEntityNotFound(_0x433730,null))[_0xdebb('0x28')](function(_0x5ab675){if(_0x5ab675){_0x35130d=_0x5ab675;_0x5b5d17['model']=_[_0xdebb('0x3c')](db[_0xdebb('0x9a')]['rawAttributes']);_0x5b5d17['query']=_[_0xdebb('0x3c')](_0x28d776[_0xdebb('0x3d')]);_0x5b5d17['filters']=_['intersection'](_0x5b5d17[_0xdebb('0x41')],_0x5b5d17[_0xdebb('0x3d')]);_0x171243['attributes']=_[_0xdebb('0x3f')](_0x5b5d17[_0xdebb('0x41')],qs[_0xdebb('0x42')](_0x28d776[_0xdebb('0x3d')][_0xdebb('0x42')]));_0x171243[_0xdebb('0x40')]=_0x171243[_0xdebb('0x40')][_0xdebb('0x43')]?_0x171243['attributes']:_0x5b5d17[_0xdebb('0x41')];_0x171243[_0xdebb('0x45')]=qs[_0xdebb('0x46')](_0x28d776[_0xdebb('0x3d')][_0xdebb('0x46')]);_0x171243[_0xdebb('0x47')]=qs[_0xdebb('0x3e')](_['pick'](_0x28d776[_0xdebb('0x3d')],_0x5b5d17[_0xdebb('0x3e')]));if(_0x28d776[_0xdebb('0x3d')][_0xdebb('0x2e')]){_0x171243[_0xdebb('0x47')]=_[_0xdebb('0x49')](_0x171243['where'],{'$or':_['map'](_0x171243[_0xdebb('0x40')],function(_0x360142){var _0x3c5839={};_0x3c5839[_0x360142]={'$like':'%'+_0x28d776[_0xdebb('0x3d')][_0xdebb('0x2e')]+'%'};return _0x3c5839;})});}_0x171243=_[_0xdebb('0x49')]({},_0x171243,_0x28d776[_0xdebb('0x4a')]);return _0x35130d[_0xdebb('0xa0')](_0x171243);}})[_0xdebb('0x28')](function(_0x4f5137){if(_0x4f5137){_0x252819=_0x4f5137['length'];if(!_0x28d776[_0xdebb('0x3d')][_0xdebb('0x64')]('nolimit')){_0x171243['limit']=qs[_0xdebb('0x22')](_0x28d776[_0xdebb('0x3d')]['limit']);_0x171243['offset']=qs[_0xdebb('0x20')](_0x28d776[_0xdebb('0x3d')]['offset']);}return _0x35130d[_0xdebb('0xa0')](_0x171243);}})[_0xdebb('0x28')](function(_0x46d711){return _0x46d711?{'count':_0x252819,'rows':_0x46d711}:null;})[_0xdebb('0x28')](respondWithResult(_0x433730,null))['catch'](handleError(_0x433730,null));};exports['getLists']=function(_0x3906ba,_0xb90181,_0x5db9af){var _0x19f876={};var _0x180bc7={};var _0x3cfb66;var _0x3d5176;return db[_0xdebb('0x4b')][_0xdebb('0x67')]({'where':{'id':_0x3906ba[_0xdebb('0x4f')]['id']}})[_0xdebb('0x28')](handleEntityNotFound(_0xb90181,null))['then'](function(_0x2a7148){if(_0x2a7148){_0x3cfb66=_0x2a7148;_0x180bc7['model']=_['keys'](db[_0xdebb('0xa1')][_0xdebb('0x39')]);_0x180bc7[_0xdebb('0x3d')]=_[_0xdebb('0x3c')](_0x3906ba[_0xdebb('0x3d')]);_0x180bc7[_0xdebb('0x3e')]=_[_0xdebb('0x3f')](_0x180bc7[_0xdebb('0x41')],_0x180bc7['query']);_0x19f876[_0xdebb('0x40')]=_[_0xdebb('0x3f')](_0x180bc7['model'],qs['fields'](_0x3906ba['query'][_0xdebb('0x42')]));_0x19f876[_0xdebb('0x40')]=_0x19f876[_0xdebb('0x40')][_0xdebb('0x43')]?_0x19f876['attributes']:_0x180bc7[_0xdebb('0x41')];_0x19f876['order']=qs[_0xdebb('0x46')](_0x3906ba[_0xdebb('0x3d')][_0xdebb('0x46')]);_0x19f876[_0xdebb('0x47')]=qs[_0xdebb('0x3e')](_[_0xdebb('0x48')](_0x3906ba[_0xdebb('0x3d')],_0x180bc7['filters']));if(_0x3906ba[_0xdebb('0x3d')][_0xdebb('0x2e')]){_0x19f876[_0xdebb('0x47')]=_[_0xdebb('0x49')](_0x19f876[_0xdebb('0x47')],{'$or':_['map'](_0x19f876[_0xdebb('0x40')],function(_0xe338f6){var _0x28a6ee={};_0x28a6ee[_0xe338f6]={'$like':'%'+_0x3906ba[_0xdebb('0x3d')][_0xdebb('0x2e')]+'%'};return _0x28a6ee;})});}_0x19f876=_['merge']({},_0x19f876,_0x3906ba[_0xdebb('0x4a')]);return _0x3cfb66[_0xdebb('0xa2')](_0x19f876);}})[_0xdebb('0x28')](function(_0x36c07a){if(_0x36c07a){_0x3d5176=_0x36c07a[_0xdebb('0x43')];if(!_0x3906ba[_0xdebb('0x3d')][_0xdebb('0x64')](_0xdebb('0x44'))){_0x19f876[_0xdebb('0x22')]=qs[_0xdebb('0x22')](_0x3906ba[_0xdebb('0x3d')][_0xdebb('0x22')]);_0x19f876['offset']=qs[_0xdebb('0x20')](_0x3906ba[_0xdebb('0x3d')]['offset']);}return _0x3cfb66[_0xdebb('0xa2')](_0x19f876);}})[_0xdebb('0x28')](function(_0x373a02){if(_0x373a02){return _0x373a02?{'count':_0x3d5176,'rows':_0x373a02}:null;}})[_0xdebb('0x28')](respondWithResult(_0xb90181,null))[_0xdebb('0x4d')](handleError(_0xb90181,null));};exports[_0xdebb('0xa3')]=function(_0x4793c7,_0x52c701,_0x23e0cf){var _0x18f06b,_0x48476f;return db['VoiceQueue'][_0xdebb('0x52')]({'where':{'id':_0x4793c7[_0xdebb('0x4f')]['id']}})[_0xdebb('0x28')](handleEntityNotFound(_0x52c701,null))['then'](function(_0x5bba2c){if(_0x5bba2c){_0x48476f=_0x5bba2c;return _0x5bba2c['addLists'](_0x4793c7[_0xdebb('0x54')]['ids'],_[_0xdebb('0x5e')](_0x4793c7[_0xdebb('0x54')],[_0xdebb('0x97'),'id'])||{});}return null;})[_0xdebb('0x9c')](function(_0x2a2683){var _0x223d23;_0x18f06b=_0x2a2683||[];var _0x3ad1a9=[];if(_0x2a2683){for(var _0x5cd079=0x0;_0x5cd079<_0x2a2683['length'];_0x5cd079+=0x1){var _0x365fa0=_0x2a2683[_0x5cd079][_0xdebb('0x29')]({'plain':!![]});_0x48476f[_0xdebb('0xa4')]=_0x4793c7[_0xdebb('0x54')]['dialCheckDuplicateType']?_0x4793c7['body'][_0xdebb('0xa4')]:_0x48476f[_0xdebb('0xa4')];switch(_0x48476f[_0xdebb('0xa4')]){case _0xdebb('0xa5'):_0x223d23=squel['insert']()[_0xdebb('0xa6')]('cm_hopper')['fromQuery']([_0xdebb('0xa7'),_0xdebb('0xa8'),_0xdebb('0xa9'),'ListId',_0xdebb('0x65'),'createdAt','updatedAt'],squel[_0xdebb('0x85')]()[_0xdebb('0x86')](_0xdebb('0xa7'),_0xdebb('0xa7'))['field'](_0xdebb('0xaa'),_0xdebb('0xa8'))[_0xdebb('0x86')]('id',_0xdebb('0xa9'))[_0xdebb('0x86')](_0x365fa0[_0xdebb('0xab')]['toString'](),'ListId')[_0xdebb('0x86')](_0x4793c7['params']['id'][_0xdebb('0x90')](),_0xdebb('0x65'))['field'](_0xdebb('0xaa'),'createdAt')['field'](_0xdebb('0xaa'),'updatedAt')[_0xdebb('0x88')](_0xdebb('0xac'))[_0xdebb('0x47')](_0xdebb('0xad'))[_0xdebb('0x47')](_0xdebb('0xae'),_0x365fa0['CmListId'][_0xdebb('0x90')]())[_0xdebb('0x47')](_0xdebb('0xaf'))['where'](_0xdebb('0xb0'),squel[_0xdebb('0x85')]()['field'](_0xdebb('0xb1'))[_0xdebb('0x88')](_0xdebb('0xb2'))[_0xdebb('0x47')]('VoiceQueueId\x20=\x20?',_0x4793c7[_0xdebb('0x4f')]['id'][_0xdebb('0x90')]()))[_0xdebb('0x47')](_0xdebb('0xb0'),squel[_0xdebb('0x85')]()[_0xdebb('0x86')](_0xdebb('0xb3'))['from'](_0xdebb('0xb4'))[_0xdebb('0x47')](_0xdebb('0x8d'),_0x4793c7[_0xdebb('0x4f')]['id']['toString']())))[_0xdebb('0x90')]();break;case _0xdebb('0xb5'):_0x223d23=squel[_0xdebb('0xb6')]()[_0xdebb('0xa6')](_0xdebb('0xb4'))[_0xdebb('0xb7')]([_0xdebb('0xa7'),'scheduledAt','ContactId',_0xdebb('0xb8'),'VoiceQueueId','createdAt',_0xdebb('0x60')],squel[_0xdebb('0x85')]()['field'](_0xdebb('0xa7'),_0xdebb('0xa7'))['field'](_0xdebb('0xaa'),_0xdebb('0xa8'))[_0xdebb('0x86')]('id',_0xdebb('0xa9'))[_0xdebb('0x86')](_0x365fa0['CmListId'][_0xdebb('0x90')](),_0xdebb('0xb8'))['field'](_0x4793c7[_0xdebb('0x4f')]['id'][_0xdebb('0x90')](),_0xdebb('0x65'))[_0xdebb('0x86')](_0xdebb('0xaa'),'createdAt')[_0xdebb('0x86')]('NOW()',_0xdebb('0x60'))[_0xdebb('0x88')](_0xdebb('0xac'))['where'](_0xdebb('0xad'))[_0xdebb('0x47')](_0xdebb('0xae'),_0x365fa0['CmListId'][_0xdebb('0x90')]())['where'](_0xdebb('0xaf'))[_0xdebb('0x47')](_0xdebb('0xb0'),squel[_0xdebb('0x85')]()[_0xdebb('0x86')](_0xdebb('0xb3'))[_0xdebb('0x88')]('cm_hopper')['where'](_0xdebb('0x8d'),_0x4793c7[_0xdebb('0x4f')]['id']['toString']())))[_0xdebb('0x90')]();break;default:_0x223d23=squel[_0xdebb('0xb6')]()[_0xdebb('0xa6')](_0xdebb('0xb4'))[_0xdebb('0xb7')](['phone',_0xdebb('0xa8'),'ContactId',_0xdebb('0xb8'),_0xdebb('0x65'),_0xdebb('0x5f'),_0xdebb('0x60')],squel['select']()[_0xdebb('0x86')]('phone',_0xdebb('0xa7'))[_0xdebb('0x86')](_0xdebb('0xaa'),_0xdebb('0xa8'))['field']('id',_0xdebb('0xa9'))[_0xdebb('0x86')](_0x365fa0[_0xdebb('0xab')][_0xdebb('0x90')](),_0xdebb('0xb8'))['field'](_0x4793c7['params']['id'][_0xdebb('0x90')](),_0xdebb('0x65'))[_0xdebb('0x86')](_0xdebb('0xaa'),_0xdebb('0x5f'))[_0xdebb('0x86')](_0xdebb('0xaa'),'updatedAt')[_0xdebb('0x88')](_0xdebb('0xac'))[_0xdebb('0x47')](_0xdebb('0xad'))[_0xdebb('0x47')](_0xdebb('0xae'),_0x365fa0[_0xdebb('0xab')][_0xdebb('0x90')]())[_0xdebb('0x47')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x3ad1a9[_0xdebb('0xb9')](db['sequelize'][_0xdebb('0x3d')](_0x223d23));}return BPromise[_0xdebb('0x94')](_0x3ad1a9);}})[_0xdebb('0x28')](function(){return _0x18f06b;})['then'](respondWithResult(_0x52c701,null))[_0xdebb('0x4d')](handleError(_0x52c701,null));};exports['removeLists']=function(_0xd930df,_0x2f0bc5,_0x1842e6){return db[_0xdebb('0x4b')]['find']({'where':{'id':_0xd930df[_0xdebb('0x4f')]['id']}})[_0xdebb('0x28')](handleEntityNotFound(_0x2f0bc5,null))['then'](function(_0x172e43){if(_0x172e43){return _0x172e43[_0xdebb('0xba')](_0xd930df['query'][_0xdebb('0x97')]);}})[_0xdebb('0x28')](function(_0x45fc27){if(_0x45fc27){return db['CmHopper'][_0xdebb('0x61')]({'where':{'ListId':_0xd930df[_0xdebb('0x3d')][_0xdebb('0x97')],'VoiceQueueId':_0xd930df[_0xdebb('0x4f')]['id']}})[_0xdebb('0x28')](function(){return _0x45fc27;});}})['then'](respondWithStatusCode(_0x2f0bc5,null))['catch'](handleError(_0x2f0bc5,null));};exports[_0xdebb('0xbb')]=function(_0x59b2c2,_0x1f686c,_0x28a017){var _0x10638a={};var _0x4114f2={};var _0x78ec36;var _0x51fb91;return db['VoiceQueue'][_0xdebb('0x67')]({'where':{'id':_0x59b2c2[_0xdebb('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1f686c,null))[_0xdebb('0x28')](function(_0x417291){if(_0x417291){_0x78ec36=_0x417291;_0x4114f2[_0xdebb('0x41')]=_[_0xdebb('0x3c')](db[_0xdebb('0xa1')][_0xdebb('0x39')]);_0x4114f2['query']=_['keys'](_0x59b2c2[_0xdebb('0x3d')]);_0x4114f2[_0xdebb('0x3e')]=_['intersection'](_0x4114f2['model'],_0x4114f2['query']);_0x10638a['attributes']=_[_0xdebb('0x3f')](_0x4114f2['model'],qs['fields'](_0x59b2c2[_0xdebb('0x3d')][_0xdebb('0x42')]));_0x10638a[_0xdebb('0x40')]=_0x10638a[_0xdebb('0x40')]['length']?_0x10638a[_0xdebb('0x40')]:_0x4114f2[_0xdebb('0x41')];_0x10638a[_0xdebb('0x45')]=qs['sort'](_0x59b2c2[_0xdebb('0x3d')]['sort']);_0x10638a[_0xdebb('0x47')]=qs[_0xdebb('0x3e')](_[_0xdebb('0x48')](_0x59b2c2[_0xdebb('0x3d')],_0x4114f2['filters']));if(_0x59b2c2[_0xdebb('0x3d')]['filter']){_0x10638a[_0xdebb('0x47')]=_[_0xdebb('0x49')](_0x10638a[_0xdebb('0x47')],{'$or':_[_0xdebb('0x30')](_0x10638a[_0xdebb('0x40')],function(_0x5c460d){var _0x33ad4f={};_0x33ad4f[_0x5c460d]={'$like':'%'+_0x59b2c2[_0xdebb('0x3d')][_0xdebb('0x2e')]+'%'};return _0x33ad4f;})});}_0x10638a=_[_0xdebb('0x49')]({},_0x10638a,_0x59b2c2[_0xdebb('0x4a')]);return _0x78ec36['getBlackLists'](_0x10638a);}})[_0xdebb('0x28')](function(_0x10b34d){if(_0x10b34d){_0x51fb91=_0x10b34d[_0xdebb('0x43')];if(!_0x59b2c2[_0xdebb('0x3d')][_0xdebb('0x64')](_0xdebb('0x44'))){_0x10638a[_0xdebb('0x22')]=qs[_0xdebb('0x22')](_0x59b2c2[_0xdebb('0x3d')][_0xdebb('0x22')]);_0x10638a[_0xdebb('0x20')]=qs[_0xdebb('0x20')](_0x59b2c2['query'][_0xdebb('0x20')]);}return _0x78ec36['getBlackLists'](_0x10638a);}})[_0xdebb('0x28')](function(_0x34e7ed){if(_0x34e7ed){return _0x34e7ed?{'count':_0x51fb91,'rows':_0x34e7ed}:null;}})[_0xdebb('0x28')](respondWithResult(_0x1f686c,null))[_0xdebb('0x4d')](handleError(_0x1f686c,null));};exports['addBlackLists']=function(_0x2923d8,_0x46d304,_0x257f7e){var _0x4bff40,_0x3fb85d;return db['VoiceQueue'][_0xdebb('0x52')]({'where':{'id':_0x2923d8[_0xdebb('0x4f')]['id']}})[_0xdebb('0x28')](handleEntityNotFound(_0x46d304,null))['then'](function(_0x59aafc){if(_0x59aafc){_0x3fb85d=_0x59aafc;return _0x59aafc[_0xdebb('0xbc')](_0x2923d8[_0xdebb('0x54')][_0xdebb('0x97')],_[_0xdebb('0x5e')](_0x2923d8[_0xdebb('0x54')],[_0xdebb('0x97'),'id'])||{});}return null;})['spread'](function(_0x3c37e7){var _0x34c752;_0x4bff40=_0x3c37e7||[];var _0x3038c0=[];if(_0x3c37e7){for(var _0x195665=0x0;_0x195665<_0x3c37e7[_0xdebb('0x43')];_0x195665+=0x1){var _0x2aff0f=_0x3c37e7[_0x195665][_0xdebb('0x29')]({'plain':!![]});_0x34c752=squel[_0xdebb('0xb6')]()[_0xdebb('0xa6')]('cm_hopper_black')[_0xdebb('0xb7')]([_0xdebb('0xa7'),_0xdebb('0xa9'),'ListId',_0xdebb('0x65'),_0xdebb('0x5f'),_0xdebb('0x60')],squel[_0xdebb('0x85')]()[_0xdebb('0x86')]('phone',_0xdebb('0xa7'))[_0xdebb('0x86')]('id',_0xdebb('0xa9'))[_0xdebb('0x86')](_0x2aff0f['CmListId'][_0xdebb('0x90')](),_0xdebb('0xb8'))[_0xdebb('0x86')](_0x2923d8[_0xdebb('0x4f')]['id'][_0xdebb('0x90')](),'VoiceQueueId')[_0xdebb('0x86')](_0xdebb('0xaa'),_0xdebb('0x5f'))[_0xdebb('0x86')](_0xdebb('0xaa'),_0xdebb('0x60'))[_0xdebb('0x88')]('cm_contacts')['where'](_0xdebb('0xad'))[_0xdebb('0x47')]('ListId\x20=\x20?',_0x2aff0f['CmListId'][_0xdebb('0x90')]())[_0xdebb('0x47')](_0xdebb('0xaf')))[_0xdebb('0x90')]();_0x3038c0[_0xdebb('0xb9')](db[_0xdebb('0x8f')]['query'](_0x34c752));}return BPromise[_0xdebb('0x94')](_0x3038c0);}})[_0xdebb('0x28')](function(){return _0x4bff40;})[_0xdebb('0x28')](respondWithResult(_0x46d304,null))['catch'](handleError(_0x46d304,null));};exports[_0xdebb('0xbd')]=function(_0x2d01a0,_0x52482b,_0x223d47){return db['VoiceQueue'][_0xdebb('0x52')]({'where':{'id':_0x2d01a0[_0xdebb('0x4f')]['id']}})[_0xdebb('0x28')](handleEntityNotFound(_0x52482b,null))[_0xdebb('0x28')](function(_0x40aaf1){if(_0x40aaf1){return _0x40aaf1[_0xdebb('0xbd')](_0x2d01a0[_0xdebb('0x3d')][_0xdebb('0x97')]);}})['then'](function(_0x202bae){if(_0x202bae){return db[_0xdebb('0x6c')][_0xdebb('0x61')]({'where':{'ListId':_0x2d01a0['query']['ids'],'VoiceQueueId':_0x2d01a0[_0xdebb('0x4f')]['id']}})[_0xdebb('0x28')](function(){return _0x202bae;});}})['then'](respondWithStatusCode(_0x52482b,null))[_0xdebb('0x4d')](handleError(_0x52482b,null));}; \ No newline at end of file +var _0x6f34=['User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','emit','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','all','isEmpty','userVoiceQueue:remove','addAgents','spread','SIP/%s','removeAgents','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','ListId','field','ContactId','CmListId','NOW()','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','scheduledAt','cm_contacts','into','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','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','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./voiceQueue.socket','register','end','status','offset','limit','undefined','count','set','Content-Range','reject','update','then','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','destroy','sendStatus','stack','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','pick','where','merge','VIRTUAL','VoiceQueue','includeAll','include','rows','catch','show','params','keys','length','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','clone','updatedAt','omit','createdAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','nolimit','sort','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','Team','getTeams','teams'];(function(_0x4124c0,_0x534630){var _0x50432b=function(_0x23f45f){while(--_0x23f45f){_0x4124c0['push'](_0x4124c0['shift']());}};_0x50432b(++_0x534630);}(_0x6f34,0x1ab));var _0x46f3=function(_0x34bedb,_0x472594){_0x34bedb=_0x34bedb-0x0;var _0xed3e47=_0x6f34[_0x34bedb];return _0xed3e47;};'use strict';var emlformat=require(_0x46f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x46f3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x46f3('0x2'));var BPromise=require(_0x46f3('0x3'));var Mustache=require(_0x46f3('0x4'));var util=require(_0x46f3('0x5'));var path=require(_0x46f3('0x6'));var sox=require('sox');var csv=require(_0x46f3('0x7'));var ejs=require(_0x46f3('0x8'));var fs=require('fs');var fs_extra=require(_0x46f3('0x9'));var _=require(_0x46f3('0xa'));var squel=require('squel');var crypto=require(_0x46f3('0xb'));var jsforce=require(_0x46f3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x46f3('0x7'));var querystring=require(_0x46f3('0xd'));var Papa=require(_0x46f3('0xe'));var Redis=require(_0x46f3('0xf'));var authService=require(_0x46f3('0x10'));var qs=require(_0x46f3('0x11'));var as=require(_0x46f3('0x12'));var hardwareService=require(_0x46f3('0x13'));var logger=require('../../config/logger')(_0x46f3('0x14'));var utils=require(_0x46f3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x46f3('0x16'));var db=require(_0x46f3('0x17'))['db'];config[_0x46f3('0x18')]=_[_0x46f3('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x46f3('0x18')]));require(_0x46f3('0x1a'))[_0x46f3('0x1b')](socket);function respondWithStatusCode(_0x3f6f1d,_0x49ad04){_0x49ad04=_0x49ad04||0xcc;return function(_0x2b2197){if(_0x2b2197){return _0x3f6f1d['sendStatus'](_0x49ad04);}return _0x3f6f1d['status'](_0x49ad04)[_0x46f3('0x1c')]();};}function respondWithResult(_0x13568a,_0x328d20){_0x328d20=_0x328d20||0xc8;return function(_0x40ea45){if(_0x40ea45){return _0x13568a[_0x46f3('0x1d')](_0x328d20)['json'](_0x40ea45);}};}function respondWithFilteredResult(_0x1ad8cb,_0x1b4bc6){return function(_0x500eea){if(_0x500eea){var _0x48e2b9=typeof _0x1b4bc6[_0x46f3('0x1e')]==='undefined'&&typeof _0x1b4bc6[_0x46f3('0x1f')]===_0x46f3('0x20');var _0x547301=_0x500eea[_0x46f3('0x21')];var _0x54f259=_0x48e2b9?0x0:_0x1b4bc6[_0x46f3('0x1e')];var _0x48ce82=_0x48e2b9?_0x500eea[_0x46f3('0x21')]:_0x1b4bc6[_0x46f3('0x1e')]+_0x1b4bc6[_0x46f3('0x1f')];var _0xd6f3ac;if(_0x48ce82>=_0x547301){_0x48ce82=_0x547301;_0xd6f3ac=0xc8;}else{_0xd6f3ac=0xce;}_0x1ad8cb[_0x46f3('0x1d')](_0xd6f3ac);return _0x1ad8cb[_0x46f3('0x22')](_0x46f3('0x23'),_0x54f259+'-'+_0x48ce82+'/'+_0x547301)['json'](_0x500eea);}return null;};}function patchUpdates(_0x2841cf){return function(_0x2317ac){try{jsonpatch['apply'](_0x2317ac,_0x2841cf,!![]);}catch(_0x73dbf5){return BPromise[_0x46f3('0x24')](_0x73dbf5);}return _0x2317ac['save']();};}function saveUpdates(_0x4f23ab,_0x3b3499){return function(_0x57a394){if(_0x57a394){return _0x57a394[_0x46f3('0x25')](_0x4f23ab)[_0x46f3('0x26')](function(_0x13ee20){return _0x13ee20;});}return null;};}function removeEntity(_0x4cd6f9,_0x47e042){return function(_0x8f1439){if(_0x8f1439){return _0x8f1439['destroy']()[_0x46f3('0x26')](function(){var _0x336fa2=_0x8f1439['get']({'plain':!![]});var _0x3cf256=[{'name':_0x46f3('0x27'),'value':_0x46f3('0x28'),'ignore':![]},{'name':_0x46f3('0x29'),'value':_0x46f3('0x2a'),'ignore':![]}];var _0x22298e=_(_0x3cf256)[_0x46f3('0x2b')](_0x46f3('0x2c'))[_0x46f3('0x2d')]('value')[_0x46f3('0x2e')]();if(_[_0x46f3('0x2f')](_0x22298e,_0x336fa2['type'])){return;}var _0x54ab65=_['find'](_0x3cf256,[_0x46f3('0x2e'),_0x336fa2[_0x46f3('0x30')]])[_0x46f3('0x31')];return db[_0x46f3('0x32')][_0x46f3('0x33')]({'where':{'type':_0x54ab65,'resourceId':_0x336fa2['id']}})[_0x46f3('0x26')](function(){return _0x8f1439;});})['then'](function(){_0x4cd6f9[_0x46f3('0x1d')](0xcc)[_0x46f3('0x1c')]();});}};}function handleEntityNotFound(_0x23cd9f,_0x2c50a9){return function(_0x2e7815){if(!_0x2e7815){_0x23cd9f[_0x46f3('0x34')](0x194);}return _0x2e7815;};}function handleError(_0x5510df,_0x342ad6){_0x342ad6=_0x342ad6||0x1f4;return function(_0x37c835){logger['error'](_0x37c835[_0x46f3('0x35')]);if(_0x37c835[_0x46f3('0x31')]){delete _0x37c835['name'];}_0x5510df[_0x46f3('0x1d')](_0x342ad6)['send'](_0x37c835);};}exports['index']=function(_0x5214f7,_0x473383){var _0x5d8adf={},_0x461867={},_0x222f3b={'count':0x0,'rows':[]};var _0x1ee3d1=_[_0x46f3('0x2d')](db['VoiceQueue'][_0x46f3('0x36')],function(_0x272960){return{'name':_0x272960['fieldName'],'type':_0x272960[_0x46f3('0x30')][_0x46f3('0x37')]};});_0x461867[_0x46f3('0x38')]=_['map'](_0x1ee3d1,'name');_0x461867[_0x46f3('0x39')]=_['keys'](_0x5214f7['query']);_0x461867[_0x46f3('0x3a')]=_[_0x46f3('0x3b')](_0x461867[_0x46f3('0x38')],_0x461867[_0x46f3('0x39')]);_0x5d8adf[_0x46f3('0x3c')]=_[_0x46f3('0x3b')](_0x461867[_0x46f3('0x38')],qs[_0x46f3('0x3d')](_0x5214f7['query'][_0x46f3('0x3d')]));_0x5d8adf[_0x46f3('0x3c')]=_0x5d8adf[_0x46f3('0x3c')]['length']?_0x5d8adf['attributes']:_0x461867[_0x46f3('0x38')];if(!_0x5214f7[_0x46f3('0x39')][_0x46f3('0x3e')]('nolimit')){_0x5d8adf['limit']=qs[_0x46f3('0x1f')](_0x5214f7[_0x46f3('0x39')]['limit']);_0x5d8adf[_0x46f3('0x1e')]=qs[_0x46f3('0x1e')](_0x5214f7['query']['offset']);}_0x5d8adf[_0x46f3('0x3f')]=qs['sort'](_0x5214f7[_0x46f3('0x39')]['sort']);_0x5d8adf['where']=qs[_0x46f3('0x3a')](_[_0x46f3('0x40')](_0x5214f7[_0x46f3('0x39')],_0x461867['filters']),_0x1ee3d1);if(_0x5214f7[_0x46f3('0x39')]['filter']){_0x5d8adf[_0x46f3('0x41')]=_[_0x46f3('0x42')](_0x5d8adf[_0x46f3('0x41')],{'$or':_[_0x46f3('0x2d')](_0x1ee3d1,function(_0x16b922){if(_0x16b922[_0x46f3('0x30')]!==_0x46f3('0x43')){var _0x343e91={};_0x343e91[_0x16b922[_0x46f3('0x31')]]={'$like':'%'+_0x5214f7[_0x46f3('0x39')][_0x46f3('0x2b')]+'%'};return _0x343e91;}})});}_0x5d8adf=_[_0x46f3('0x42')]({},_0x5d8adf,_0x5214f7['options']);var _0x26055f={'where':_0x5d8adf['where']};return db[_0x46f3('0x44')]['count'](_0x26055f)[_0x46f3('0x26')](function(_0x2b54f1){_0x222f3b['count']=_0x2b54f1;if(_0x5214f7[_0x46f3('0x39')][_0x46f3('0x45')]){_0x5d8adf[_0x46f3('0x46')]=[{'all':!![]}];}return db[_0x46f3('0x44')]['findAll'](_0x5d8adf);})[_0x46f3('0x26')](function(_0x5f445c){_0x222f3b[_0x46f3('0x47')]=_0x5f445c;return _0x222f3b;})[_0x46f3('0x26')](respondWithFilteredResult(_0x473383,_0x5d8adf))[_0x46f3('0x48')](handleError(_0x473383,null));};exports[_0x46f3('0x49')]=function(_0x20fb48,_0x136a26){var _0x587b8d={'raw':![],'where':{'id':_0x20fb48[_0x46f3('0x4a')]['id']}},_0x3dfe54={};_0x3dfe54[_0x46f3('0x38')]=_[_0x46f3('0x4b')](db['VoiceQueue'][_0x46f3('0x36')]);_0x3dfe54['query']=_[_0x46f3('0x4b')](_0x20fb48[_0x46f3('0x39')]);_0x3dfe54[_0x46f3('0x3a')]=_[_0x46f3('0x3b')](_0x3dfe54[_0x46f3('0x38')],_0x3dfe54['query']);_0x587b8d[_0x46f3('0x3c')]=_[_0x46f3('0x3b')](_0x3dfe54[_0x46f3('0x38')],qs[_0x46f3('0x3d')](_0x20fb48['query'][_0x46f3('0x3d')]));_0x587b8d[_0x46f3('0x3c')]=_0x587b8d[_0x46f3('0x3c')][_0x46f3('0x4c')]?_0x587b8d[_0x46f3('0x3c')]:_0x3dfe54['model'];if(_0x20fb48['query']['includeAll']){_0x587b8d[_0x46f3('0x46')]=[{'all':!![]}];}_0x587b8d=_[_0x46f3('0x42')]({},_0x587b8d,_0x20fb48[_0x46f3('0x4d')]);return db[_0x46f3('0x44')][_0x46f3('0x4e')](_0x587b8d)['then'](handleEntityNotFound(_0x136a26,null))[_0x46f3('0x26')](respondWithResult(_0x136a26,null))[_0x46f3('0x48')](handleError(_0x136a26,null));};exports[_0x46f3('0x4f')]=function(_0x275def,_0x25ca02){return db['VoiceQueue']['create'](_0x275def[_0x46f3('0x50')],{})['then'](function(_0x2247f4){var _0x47cbde=_0x275def['user'][_0x46f3('0x51')]({'plain':!![]});if(!_0x47cbde)throw new Error(_0x46f3('0x52'));if(_0x47cbde[_0x46f3('0x53')]===_0x46f3('0x54')){var _0x32329b=_0x2247f4[_0x46f3('0x51')]({'plain':!![]});var _0x16636c=[{'name':_0x46f3('0x27'),'value':_0x46f3('0x28')},{'name':'QueueCampaigns','value':_0x46f3('0x2a')}];var _0x3a687f=_['find'](_0x16636c,['value',_0x32329b[_0x46f3('0x30')]])[_0x46f3('0x31')];return db[_0x46f3('0x55')]['find']({'where':{'name':_0x3a687f,'userProfileId':_0x47cbde['userProfileId']},'raw':!![]})[_0x46f3('0x26')](function(_0x490c23){if(_0x490c23&&_0x490c23[_0x46f3('0x56')]===0x0){return db[_0x46f3('0x32')][_0x46f3('0x4f')]({'name':_0x32329b['name'],'resourceId':_0x32329b['id'],'type':_0x490c23[_0x46f3('0x31')],'sectionId':_0x490c23['id']},{})[_0x46f3('0x26')](function(){return _0x2247f4;});}else{return _0x2247f4;}})['catch'](function(_0x4dabc8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4dabc8);throw _0x4dabc8;});}return _0x2247f4;})[_0x46f3('0x26')](respondWithResult(_0x25ca02,0xc9))['catch'](handleError(_0x25ca02,null));};exports[_0x46f3('0x57')]=function(_0x35f1d8,_0x4d57c3){var _0x2c1ab3={'where':{'id':_0x35f1d8[_0x46f3('0x4a')]['id']}},_0x322db9={};_0x322db9[_0x46f3('0x38')]=_[_0x46f3('0x4b')](db[_0x46f3('0x44')]['rawAttributes']);_0x2c1ab3[_0x46f3('0x3c')]=_['intersection'](_0x322db9[_0x46f3('0x38')],qs['fields'](_0x35f1d8[_0x46f3('0x39')][_0x46f3('0x3d')]));_0x2c1ab3[_0x46f3('0x3c')]=_0x2c1ab3[_0x46f3('0x3c')][_0x46f3('0x4c')]?_0x2c1ab3[_0x46f3('0x3c')]:_0x322db9[_0x46f3('0x38')];if(_0x35f1d8[_0x46f3('0x39')][_0x46f3('0x45')]){_0x2c1ab3[_0x46f3('0x46')]=[{'all':!![]}];}_0x2c1ab3=_[_0x46f3('0x42')]({},_0x2c1ab3,_0x35f1d8[_0x46f3('0x4d')]);return db['VoiceQueue'][_0x46f3('0x4e')](_0x2c1ab3)['then'](handleEntityNotFound(_0x4d57c3,null))[_0x46f3('0x26')](function(_0x4b5d2a){if(_0x4b5d2a){var _0x3fdda0=_0x4b5d2a[_0x46f3('0x51')]({'plain':!![]});_0x3fdda0=qs['omit'](_0x3fdda0,['id','createdAt',_0x46f3('0x58')]);_0x35f1d8['body']=_[_0x46f3('0x59')](_0x35f1d8[_0x46f3('0x50')],['id',_0x46f3('0x5a'),_0x46f3('0x58')]);return db[_0x46f3('0x44')][_0x46f3('0x4f')](_[_0x46f3('0x42')](_0x3fdda0,_0x35f1d8[_0x46f3('0x50')]),{'include':_0x35f1d8[_0x46f3('0x39')][_0x46f3('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x585abe){var _0x27d95b=_0x35f1d8[_0x46f3('0x54')][_0x46f3('0x51')]({'plain':!![]});if(!_0x27d95b)throw new Error(_0x46f3('0x52'));if(_0x27d95b['role']===_0x46f3('0x54')){var _0x270e64=_0x585abe[_0x46f3('0x51')]({'plain':!![]});var _0x2e956e=[{'name':_0x46f3('0x27'),'value':'inbound'},{'name':_0x46f3('0x29'),'value':_0x46f3('0x2a')}];var _0x1ac5c2=_[_0x46f3('0x4e')](_0x2e956e,['value',_0x270e64[_0x46f3('0x30')]])[_0x46f3('0x31')];return db[_0x46f3('0x55')][_0x46f3('0x4e')]({'where':{'name':_0x1ac5c2,'userProfileId':_0x27d95b[_0x46f3('0x5b')]},'raw':!![]})[_0x46f3('0x26')](function(_0x162de7){if(_0x162de7&&_0x162de7[_0x46f3('0x56')]===0x0){return db['UserProfileResource'][_0x46f3('0x4f')]({'name':_0x270e64['name'],'resourceId':_0x270e64['id'],'type':_0x162de7[_0x46f3('0x31')],'sectionId':_0x162de7['id']},{})[_0x46f3('0x26')](function(){return _0x585abe;});}else{return _0x585abe;}})[_0x46f3('0x48')](function(_0x190619){logger['error'](_0x46f3('0x5c'),_0x190619);throw _0x190619;});}return _0x585abe;});}})[_0x46f3('0x26')](respondWithResult(_0x4d57c3,0xc9))['catch'](handleError(_0x4d57c3,null));};exports[_0x46f3('0x25')]=function(_0x2fb77f,_0xb1e60c){if(_0x2fb77f[_0x46f3('0x50')]['id']){delete _0x2fb77f[_0x46f3('0x50')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x2fb77f[_0x46f3('0x4a')]['id']}})[_0x46f3('0x26')](handleEntityNotFound(_0xb1e60c,null))['then'](saveUpdates(_0x2fb77f[_0x46f3('0x50')],null))['then'](respondWithResult(_0xb1e60c,null))[_0x46f3('0x48')](handleError(_0xb1e60c,null));};exports[_0x46f3('0x33')]=function(_0xdbbf5c,_0x1f6409){return db['VoiceQueue']['find']({'where':{'id':_0xdbbf5c[_0x46f3('0x4a')]['id']}})[_0x46f3('0x26')](handleEntityNotFound(_0x1f6409,null))[_0x46f3('0x26')](removeEntity(_0x1f6409,null))['catch'](handleError(_0x1f6409,null));};exports['getHoppers']=function(_0x578153,_0x492cf0,_0x36814e){var _0x24cb4d={'raw':![],'where':{}};var _0x3725a7={};var _0x4d19fe={'count':0x0,'rows':[]};return db[_0x46f3('0x44')][_0x46f3('0x5d')]({'where':{'id':_0x578153[_0x46f3('0x4a')]['id']}})[_0x46f3('0x26')](handleEntityNotFound(_0x492cf0,null))[_0x46f3('0x26')](function(_0x18f161){if(_0x18f161){_0x3725a7[_0x46f3('0x38')]=_[_0x46f3('0x4b')](db[_0x46f3('0x5e')][_0x46f3('0x36')]);_0x3725a7[_0x46f3('0x39')]=_[_0x46f3('0x4b')](_0x578153[_0x46f3('0x39')]);_0x3725a7['filters']=_[_0x46f3('0x3b')](_0x3725a7[_0x46f3('0x38')],_0x3725a7[_0x46f3('0x39')]);_0x24cb4d['attributes']=_[_0x46f3('0x3b')](_0x3725a7[_0x46f3('0x38')],qs[_0x46f3('0x3d')](_0x578153['query']['fields']));_0x24cb4d['attributes']=_0x24cb4d[_0x46f3('0x3c')][_0x46f3('0x4c')]?_0x24cb4d['attributes']:_0x3725a7['model'];if(!_0x578153['query']['hasOwnProperty'](_0x46f3('0x5f'))){_0x24cb4d[_0x46f3('0x1f')]=qs[_0x46f3('0x1f')](_0x578153[_0x46f3('0x39')][_0x46f3('0x1f')]);_0x24cb4d[_0x46f3('0x1e')]=qs[_0x46f3('0x1e')](_0x578153[_0x46f3('0x39')][_0x46f3('0x1e')]);}_0x24cb4d[_0x46f3('0x3f')]=qs['sort'](_0x578153[_0x46f3('0x39')][_0x46f3('0x60')]);_0x24cb4d[_0x46f3('0x41')]=qs[_0x46f3('0x3a')](_[_0x46f3('0x40')](_0x578153[_0x46f3('0x39')],_0x3725a7['filters']));_0x24cb4d['where'][_0x46f3('0x61')]=_0x18f161['id'];if(_0x578153[_0x46f3('0x39')]['filter']){_0x24cb4d[_0x46f3('0x41')]=_[_0x46f3('0x42')](_0x24cb4d[_0x46f3('0x41')],{'$or':_[_0x46f3('0x2d')](_0x24cb4d[_0x46f3('0x3c')],function(_0x4192f8){var _0x5c002b={};_0x5c002b[_0x4192f8]={'$like':'%'+_0x578153[_0x46f3('0x39')]['filter']+'%'};return _0x5c002b;})});}_0x24cb4d=_[_0x46f3('0x42')]({},_0x24cb4d,_0x578153[_0x46f3('0x4d')]);return db[_0x46f3('0x5e')]['count']({'where':_0x24cb4d[_0x46f3('0x41')]})[_0x46f3('0x26')](function(_0xd4a35e){_0x4d19fe[_0x46f3('0x21')]=_0xd4a35e;if(_0x578153[_0x46f3('0x39')][_0x46f3('0x45')]){_0x24cb4d[_0x46f3('0x46')]=[{'all':!![]}];}return db[_0x46f3('0x5e')][_0x46f3('0x62')](_0x24cb4d);})[_0x46f3('0x26')](function(_0x1046a2){_0x4d19fe[_0x46f3('0x47')]=_0x1046a2;return _0x4d19fe;});}})[_0x46f3('0x26')](respondWithFilteredResult(_0x492cf0,_0x24cb4d))[_0x46f3('0x48')](handleError(_0x492cf0,null));};exports[_0x46f3('0x63')]=function(_0x18ff34,_0x561f42,_0x5d05c1){var _0x16a2d3={'raw':!![],'where':{}};var _0x1a38bc={};var _0x2e53a0={'count':0x0,'rows':[]};return db[_0x46f3('0x44')]['findOne']({'where':{'id':_0x18ff34['params']['id']}})['then'](handleEntityNotFound(_0x561f42,null))[_0x46f3('0x26')](function(_0x57d1ce){if(_0x57d1ce){_0x1a38bc['model']=_[_0x46f3('0x4b')](db[_0x46f3('0x64')]['rawAttributes']);_0x1a38bc[_0x46f3('0x39')]=_[_0x46f3('0x4b')](_0x18ff34['query']);_0x1a38bc[_0x46f3('0x3a')]=_[_0x46f3('0x3b')](_0x1a38bc[_0x46f3('0x38')],_0x1a38bc[_0x46f3('0x39')]);_0x16a2d3[_0x46f3('0x3c')]=_[_0x46f3('0x3b')](_0x1a38bc[_0x46f3('0x38')],qs['fields'](_0x18ff34['query']['fields']));_0x16a2d3[_0x46f3('0x3c')]=_0x16a2d3['attributes'][_0x46f3('0x4c')]?_0x16a2d3[_0x46f3('0x3c')]:_0x1a38bc[_0x46f3('0x38')];if(!_0x18ff34['query'][_0x46f3('0x3e')](_0x46f3('0x5f'))){_0x16a2d3[_0x46f3('0x1f')]=qs['limit'](_0x18ff34[_0x46f3('0x39')][_0x46f3('0x1f')]);_0x16a2d3['offset']=qs['offset'](_0x18ff34[_0x46f3('0x39')][_0x46f3('0x1e')]);}_0x16a2d3[_0x46f3('0x3f')]=qs[_0x46f3('0x60')](_0x18ff34[_0x46f3('0x39')]['sort']);_0x16a2d3[_0x46f3('0x41')]=qs[_0x46f3('0x3a')](_['pick'](_0x18ff34[_0x46f3('0x39')],_0x1a38bc[_0x46f3('0x3a')]));_0x16a2d3[_0x46f3('0x41')][_0x46f3('0x61')]=_0x57d1ce['id'];if(_0x18ff34[_0x46f3('0x39')][_0x46f3('0x2b')]){_0x16a2d3[_0x46f3('0x41')]=_[_0x46f3('0x42')](_0x16a2d3[_0x46f3('0x41')],{'$or':_[_0x46f3('0x2d')](_0x16a2d3[_0x46f3('0x3c')],function(_0x5ed495){var _0x4ae0c0={};_0x4ae0c0[_0x5ed495]={'$like':'%'+_0x18ff34[_0x46f3('0x39')][_0x46f3('0x2b')]+'%'};return _0x4ae0c0;})});}_0x16a2d3=_[_0x46f3('0x42')]({},_0x16a2d3,_0x18ff34[_0x46f3('0x4d')]);return db[_0x46f3('0x64')][_0x46f3('0x21')]({'where':_0x16a2d3[_0x46f3('0x41')]})[_0x46f3('0x26')](function(_0x29060c){_0x2e53a0[_0x46f3('0x21')]=_0x29060c;if(_0x18ff34[_0x46f3('0x39')][_0x46f3('0x45')]){_0x16a2d3['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x46f3('0x62')](_0x16a2d3);})[_0x46f3('0x26')](function(_0x377473){_0x2e53a0[_0x46f3('0x47')]=_0x377473;return _0x2e53a0;});}})[_0x46f3('0x26')](respondWithFilteredResult(_0x561f42,_0x16a2d3))['catch'](handleError(_0x561f42,null));};exports[_0x46f3('0x65')]=function(_0x33fe78,_0x4d6c70,_0x2b1fdf){var _0x377479={'raw':!![],'where':{}};var _0x3fa17a={};var _0x210e9d={'count':0x0,'rows':[]};return db[_0x46f3('0x44')][_0x46f3('0x5d')]({'where':{'id':_0x33fe78[_0x46f3('0x4a')]['id']}})[_0x46f3('0x26')](handleEntityNotFound(_0x4d6c70,null))['then'](function(_0x1d8da5){if(_0x1d8da5){_0x3fa17a[_0x46f3('0x38')]=_['keys'](db[_0x46f3('0x66')][_0x46f3('0x36')]);_0x3fa17a[_0x46f3('0x39')]=_[_0x46f3('0x4b')](_0x33fe78[_0x46f3('0x39')]);_0x3fa17a['filters']=_[_0x46f3('0x3b')](_0x3fa17a[_0x46f3('0x38')],_0x3fa17a[_0x46f3('0x39')]);_0x377479[_0x46f3('0x3c')]=_[_0x46f3('0x3b')](_0x3fa17a[_0x46f3('0x38')],qs[_0x46f3('0x3d')](_0x33fe78[_0x46f3('0x39')][_0x46f3('0x3d')]));_0x377479[_0x46f3('0x3c')]=_0x377479[_0x46f3('0x3c')]['length']?_0x377479['attributes']:_0x3fa17a[_0x46f3('0x38')];if(!_0x33fe78['query'][_0x46f3('0x3e')]('nolimit')){_0x377479['limit']=qs[_0x46f3('0x1f')](_0x33fe78[_0x46f3('0x39')][_0x46f3('0x1f')]);_0x377479['offset']=qs[_0x46f3('0x1e')](_0x33fe78[_0x46f3('0x39')][_0x46f3('0x1e')]);}_0x377479[_0x46f3('0x3f')]=qs['sort'](_0x33fe78['query']['sort']);_0x377479[_0x46f3('0x41')]=qs[_0x46f3('0x3a')](_[_0x46f3('0x40')](_0x33fe78[_0x46f3('0x39')],_0x3fa17a['filters']));_0x377479[_0x46f3('0x41')]['VoiceQueueId']=_0x1d8da5['id'];if(_0x33fe78[_0x46f3('0x39')][_0x46f3('0x2b')]){_0x377479[_0x46f3('0x41')]=_[_0x46f3('0x42')](_0x377479[_0x46f3('0x41')],{'$or':_['map'](_0x377479['attributes'],function(_0x179b5e){var _0x4e3fcf={};_0x4e3fcf[_0x179b5e]={'$like':'%'+_0x33fe78[_0x46f3('0x39')][_0x46f3('0x2b')]+'%'};return _0x4e3fcf;})});}_0x377479=_[_0x46f3('0x42')]({},_0x377479,_0x33fe78['options']);return db[_0x46f3('0x66')][_0x46f3('0x21')]({'where':_0x377479[_0x46f3('0x41')]})[_0x46f3('0x26')](function(_0x1c701d){_0x210e9d['count']=_0x1c701d;if(_0x33fe78[_0x46f3('0x39')][_0x46f3('0x45')]){_0x377479[_0x46f3('0x46')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x377479);})[_0x46f3('0x26')](function(_0x52377c){_0x210e9d[_0x46f3('0x47')]=_0x52377c;return _0x210e9d;});}})[_0x46f3('0x26')](respondWithFilteredResult(_0x4d6c70,_0x377479))['catch'](handleError(_0x4d6c70,null));};exports['getHopperBlacks']=function(_0x167859,_0x1e3644,_0x1bb582){var _0x2b0f09={'raw':!![],'where':{}};var _0x164421={};var _0xacdc57={'count':0x0,'rows':[]};return db[_0x46f3('0x44')][_0x46f3('0x5d')]({'where':{'id':_0x167859[_0x46f3('0x4a')]['id']}})[_0x46f3('0x26')](handleEntityNotFound(_0x1e3644,null))[_0x46f3('0x26')](function(_0x56da74){if(_0x56da74){_0x164421[_0x46f3('0x38')]=_[_0x46f3('0x4b')](db[_0x46f3('0x67')][_0x46f3('0x36')]);_0x164421[_0x46f3('0x39')]=_['keys'](_0x167859[_0x46f3('0x39')]);_0x164421[_0x46f3('0x3a')]=_['intersection'](_0x164421[_0x46f3('0x38')],_0x164421[_0x46f3('0x39')]);_0x2b0f09[_0x46f3('0x3c')]=_['intersection'](_0x164421[_0x46f3('0x38')],qs[_0x46f3('0x3d')](_0x167859['query'][_0x46f3('0x3d')]));_0x2b0f09['attributes']=_0x2b0f09[_0x46f3('0x3c')][_0x46f3('0x4c')]?_0x2b0f09[_0x46f3('0x3c')]:_0x164421['model'];if(!_0x167859[_0x46f3('0x39')]['hasOwnProperty'](_0x46f3('0x5f'))){_0x2b0f09['limit']=qs[_0x46f3('0x1f')](_0x167859[_0x46f3('0x39')]['limit']);_0x2b0f09[_0x46f3('0x1e')]=qs[_0x46f3('0x1e')](_0x167859[_0x46f3('0x39')][_0x46f3('0x1e')]);}_0x2b0f09[_0x46f3('0x3f')]=qs['sort'](_0x167859['query'][_0x46f3('0x60')]);_0x2b0f09[_0x46f3('0x41')]=qs[_0x46f3('0x3a')](_[_0x46f3('0x40')](_0x167859['query'],_0x164421[_0x46f3('0x3a')]));_0x2b0f09[_0x46f3('0x41')][_0x46f3('0x61')]=_0x56da74['id'];if(_0x167859[_0x46f3('0x39')][_0x46f3('0x2b')]){_0x2b0f09['where']=_[_0x46f3('0x42')](_0x2b0f09['where'],{'$or':_[_0x46f3('0x2d')](_0x2b0f09[_0x46f3('0x3c')],function(_0x2bcc3e){var _0x1c522a={};_0x1c522a[_0x2bcc3e]={'$like':'%'+_0x167859[_0x46f3('0x39')][_0x46f3('0x2b')]+'%'};return _0x1c522a;})});}_0x2b0f09=_[_0x46f3('0x42')]({},_0x2b0f09,_0x167859[_0x46f3('0x4d')]);return db[_0x46f3('0x67')][_0x46f3('0x21')]({'where':_0x2b0f09[_0x46f3('0x41')]})[_0x46f3('0x26')](function(_0xf4c085){_0xacdc57[_0x46f3('0x21')]=_0xf4c085;if(_0x167859['query'][_0x46f3('0x45')]){_0x2b0f09[_0x46f3('0x46')]=[{'all':!![]}];}return db[_0x46f3('0x67')][_0x46f3('0x62')](_0x2b0f09);})['then'](function(_0x434c27){_0xacdc57[_0x46f3('0x47')]=_0x434c27;return _0xacdc57;});}})[_0x46f3('0x26')](respondWithFilteredResult(_0x1e3644,_0x2b0f09))[_0x46f3('0x48')](handleError(_0x1e3644,null));};exports['getTeams']=function(_0xa4ad8b,_0x531478,_0xf94318){var _0x4c73dd={};var _0x4d88ec={};var _0x318eb9;var _0xb26ed5;return db[_0x46f3('0x44')]['findOne']({'where':{'id':_0xa4ad8b[_0x46f3('0x4a')]['id']}})[_0x46f3('0x26')](handleEntityNotFound(_0x531478,null))[_0x46f3('0x26')](function(_0x36e1e8){if(_0x36e1e8){_0x318eb9=_0x36e1e8;_0x4d88ec[_0x46f3('0x38')]=_[_0x46f3('0x4b')](db[_0x46f3('0x68')][_0x46f3('0x36')]);_0x4d88ec[_0x46f3('0x39')]=_[_0x46f3('0x4b')](_0xa4ad8b[_0x46f3('0x39')]);_0x4d88ec[_0x46f3('0x3a')]=_[_0x46f3('0x3b')](_0x4d88ec['model'],_0x4d88ec['query']);_0x4c73dd[_0x46f3('0x3c')]=_[_0x46f3('0x3b')](_0x4d88ec['model'],qs['fields'](_0xa4ad8b['query'][_0x46f3('0x3d')]));_0x4c73dd[_0x46f3('0x3c')]=_0x4c73dd[_0x46f3('0x3c')][_0x46f3('0x4c')]?_0x4c73dd[_0x46f3('0x3c')]:_0x4d88ec[_0x46f3('0x38')];_0x4c73dd[_0x46f3('0x3f')]=qs[_0x46f3('0x60')](_0xa4ad8b[_0x46f3('0x39')]['sort']);_0x4c73dd[_0x46f3('0x41')]=qs['filters'](_[_0x46f3('0x40')](_0xa4ad8b[_0x46f3('0x39')],_0x4d88ec[_0x46f3('0x3a')]));if(_0xa4ad8b[_0x46f3('0x39')][_0x46f3('0x2b')]){_0x4c73dd['where']=_[_0x46f3('0x42')](_0x4c73dd[_0x46f3('0x41')],{'$or':_[_0x46f3('0x2d')](_0x4c73dd[_0x46f3('0x3c')],function(_0x45b57b){var _0x1e25b2={};_0x1e25b2[_0x45b57b]={'$like':'%'+_0xa4ad8b[_0x46f3('0x39')][_0x46f3('0x2b')]+'%'};return _0x1e25b2;})});}_0x4c73dd=_['merge']({},_0x4c73dd,_0xa4ad8b[_0x46f3('0x4d')]);return _0x318eb9[_0x46f3('0x69')](_0x4c73dd);}})[_0x46f3('0x26')](function(_0x533aea){if(_0x533aea){_0xb26ed5=_0x533aea[_0x46f3('0x4c')];if(!_0xa4ad8b[_0x46f3('0x39')][_0x46f3('0x3e')](_0x46f3('0x5f'))){_0x4c73dd[_0x46f3('0x1f')]=qs[_0x46f3('0x1f')](_0xa4ad8b[_0x46f3('0x39')][_0x46f3('0x1f')]);_0x4c73dd[_0x46f3('0x1e')]=qs[_0x46f3('0x1e')](_0xa4ad8b[_0x46f3('0x39')][_0x46f3('0x1e')]);}return _0x318eb9[_0x46f3('0x69')](_0x4c73dd);}})['then'](function(_0x25d7a5){if(_0x25d7a5){return _0x25d7a5?{'count':_0xb26ed5,'rows':_0x25d7a5}:null;}})[_0x46f3('0x26')](respondWithResult(_0x531478,null))[_0x46f3('0x48')](handleError(_0x531478,null));};exports['addTeams']=function(_0x1318e7,_0x3a1594,_0xe20b80){var _0x27192a=_0x1318e7[_0x46f3('0x50')][_0x46f3('0x6a')];var _0x2188e6=_[_0x46f3('0x2d')](_0x27192a,'id');return db['Team']['findAll']({'where':{'id':_0x2188e6},'attributes':['id'],'include':[{'model':db[_0x46f3('0x6b')],'as':_0x46f3('0x6c'),'attributes':['id',_0x46f3('0x31'),_0x46f3('0x6d'),_0x46f3('0x6e'),_0x46f3('0x6f')],'raw':!![]}]})[_0x46f3('0x26')](function(_0x37aa9c){if(_0x37aa9c){var _0x320ac6=_[_0x46f3('0x70')](_0x37aa9c,function(_0x53285a){var _0x5ce086=_0x53285a[_0x46f3('0x51')]({'plain':!![]});_0x5ce086['Agents'][_0x46f3('0x71')](function(_0x1350b4){_0x1350b4[_0x46f3('0x72')]=_[_0x46f3('0x4e')](_0x27192a,{'id':_0x5ce086['id']})[_0x46f3('0x72')];});return _0x5ce086[_0x46f3('0x6c')];});return db[_0x46f3('0x44')]['find']({'where':{'id':_0x1318e7[_0x46f3('0x4a')]['id']}})[_0x46f3('0x26')](function(_0x30fdb2){return db[_0x46f3('0x73')][_0x46f3('0x74')](function(_0x422a7b){return _0x30fdb2[_0x46f3('0x75')](_0x2188e6,{'transaction':_0x422a7b})['then'](function(){return BPromise[_0x46f3('0x76')](_0x27192a,function(_0x565fac){return db['TeamVoiceQueue'][_0x46f3('0x77')]({'TeamId':_0x565fac['id'],'VoiceQueueId':_0x1318e7[_0x46f3('0x4a')]['id'],'penalty':_0x565fac['penalty']},{'transaction':_0x422a7b});});})[_0x46f3('0x26')](function(){return BPromise[_0x46f3('0x76')](_0x320ac6,function(_0xfa2ed5){return db[_0x46f3('0x78')]['findOrCreate']({'where':{'UserId':_0xfa2ed5['id'],'VoiceQueueId':_0x1318e7[_0x46f3('0x4a')]['id']},'defaults':{'penalty':_0xfa2ed5['penalty']},'transaction':_0x422a7b});});})['then'](function(){return BPromise[_0x46f3('0x76')](_['filter'](_0x320ac6,{'online':!![]}),function(_0x3ece95){return db[_0x46f3('0x79')][_0x46f3('0x77')]({'membername':_0x3ece95['name'],'UserId':_0x3ece95['id'],'queue_name':_0x30fdb2[_0x46f3('0x31')],'VoiceQueueId':_0x30fdb2['id'],'interface':_[_0x46f3('0x7a')](_0x3ece95[_0x46f3('0x6f')])?util['format']('SIP/%s',_0x3ece95[_0x46f3('0x31')]):_0x3ece95[_0x46f3('0x6f')],'paused':_0x3ece95['voicePause']||![],'penalty':_0x3ece95['penalty']},{'transaction':_0x422a7b});});})[_0x46f3('0x26')](function(){_0x320ac6[_0x46f3('0x71')](function(_0x497424){socket[_0x46f3('0x7b')](_0x46f3('0x7c'),{'UserId':_0x497424['id'],'VoiceQueueId':_0x30fdb2['id']});});});});});}})['then'](respondWithStatusCode(_0x3a1594,null))[_0x46f3('0x48')](handleError(_0x3a1594,null));};exports[_0x46f3('0x7d')]=function(_0x7fd928,_0x1d1726,_0x2c3858){return db[_0x46f3('0x68')]['findAll']({'where':{'id':_0x7fd928[_0x46f3('0x39')][_0x46f3('0x7e')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1d1726,null))[_0x46f3('0x26')](function(_0x303a44){var _0x1e6dce=_[_0x46f3('0x2d')](_0x303a44,'id');var _0x119e62=[];var _0x49898c=[];var _0x4892b4=squel[_0x46f3('0x7f')]();_0x4892b4['field'](_0x46f3('0x80'))[_0x46f3('0x81')]('team_has_voice_queues','tq')[_0x46f3('0x82')](_0x46f3('0x83'),'ut',_0x46f3('0x84'))['where'](_0x46f3('0x85'),_0x7fd928['params']['id']);for(var _0x25aff5=0x0;_0x25aff5<_0x303a44[_0x46f3('0x4c')];_0x25aff5+=0x1){let _0x2aa4ad=_0x303a44[_0x25aff5];for(var _0x29ecf0=0x0;_0x29ecf0<_0x2aa4ad[_0x46f3('0x6c')][_0x46f3('0x4c')];_0x29ecf0+=0x1){let _0x44f1e9=_0x2aa4ad['Agents'][_0x29ecf0];var _0x10957e=_0x4892b4['clone']();_0x10957e[_0x46f3('0x41')](_0x46f3('0x86'),_0x44f1e9['id']);_0x49898c[_0x46f3('0x87')](db[_0x46f3('0x73')][_0x46f3('0x39')](_0x10957e[_0x46f3('0x88')](),{'type':db['sequelize']['QueryTypes'][_0x46f3('0x89')]})[_0x46f3('0x26')](function(_0x553c55){if(_0x553c55[_0x46f3('0x4c')]===0x1){return _0x44f1e9['id'];}else{var _0x5cf549=_['every'](_[_0x46f3('0x2d')](_0x553c55,_0x46f3('0x8a')),function(_0x39d368){return _[_0x46f3('0x2f')](_0x1e6dce,_0x39d368);});if(_0x5cf549){return _0x44f1e9['id'];}}}));}}return BPromise[_0x46f3('0x8b')](_0x49898c)[_0x46f3('0x26')](function(_0x3533ae){_0x119e62=_(_0x119e62)['union'](_0x3533ae)['compact']()[_0x46f3('0x2e')]();return db['VoiceQueue']['find']({'where':{'id':_0x7fd928[_0x46f3('0x4a')]['id']}})['then'](function(_0x443847){return db[_0x46f3('0x73')][_0x46f3('0x74')](function(_0x430c8a){return _0x443847[_0x46f3('0x7d')](_0x7fd928[_0x46f3('0x39')][_0x46f3('0x7e')],{'transaction':_0x430c8a})['then'](function(){if(!_[_0x46f3('0x8c')](_0x119e62)){return _0x443847['removeAgents'](_0x119e62,{'transaction':_0x430c8a})[_0x46f3('0x26')](function(){return db[_0x46f3('0x79')][_0x46f3('0x33')]({'where':{'VoiceQueueId':_0x7fd928['params']['id'],'UserId':_0x119e62},'transaction':_0x430c8a});});}})[_0x46f3('0x26')](function(){_0x119e62[_0x46f3('0x71')](function(_0x18a037){socket[_0x46f3('0x7b')](_0x46f3('0x8d'),{'UserId':_0x18a037,'VoiceQueueId':_0x443847['id']});});});});});});})[_0x46f3('0x26')](respondWithStatusCode(_0x1d1726,null))[_0x46f3('0x48')](handleError(_0x1d1726,null));};exports[_0x46f3('0x8e')]=function(_0x2259b1,_0x2884d5,_0x1bda95){var _0x5f09f8,_0x5af13a;return db[_0x46f3('0x44')][_0x46f3('0x4e')]({'where':{'id':_0x2259b1[_0x46f3('0x4a')]['id']}})[_0x46f3('0x26')](handleEntityNotFound(_0x2884d5,null))['then'](function(_0x5b9c42){if(_0x5b9c42){_0x5af13a=_0x5b9c42;return _0x5b9c42[_0x46f3('0x8e')](_0x2259b1[_0x46f3('0x50')][_0x46f3('0x7e')],_[_0x46f3('0x59')](_0x2259b1['body'],['ids','id'])||{})[_0x46f3('0x8f')](function(_0x99a2ef){for(var _0x37f034=0x0;_0x37f034<_0x2259b1[_0x46f3('0x50')][_0x46f3('0x7e')][_0x46f3('0x4c')];_0x37f034+=0x1){socket[_0x46f3('0x7b')]('userVoiceQueue:save',{'UserId':Number(_0x2259b1[_0x46f3('0x50')][_0x46f3('0x7e')][_0x37f034]),'VoiceQueueId':Number(_0x2259b1['params']['id'])});}return _0x99a2ef;});}})[_0x46f3('0x26')](function(_0x592626){_0x5f09f8=_0x592626||[];if(_0x5af13a){return db[_0x46f3('0x6b')][_0x46f3('0x62')]({'where':{'id':_0x2259b1['body']['ids']},'attributes':['id','name',_0x46f3('0x6d'),_0x46f3('0x6e'),'interface'],'raw':!![]});}})[_0x46f3('0x26')](function(_0x1795fc){if(!_['isEmpty'](_0x1795fc)){var _0x1f0b85=[];for(var _0x260d2b=0x0;_0x260d2b<_0x1795fc[_0x46f3('0x4c')];_0x260d2b++){if(_0x1795fc[_0x260d2b][_0x46f3('0x6d')]){_0x1f0b85['push'](db['UserVoiceQueueRt'][_0x46f3('0x77')]({'membername':_0x1795fc[_0x260d2b]['name'],'UserId':_0x1795fc[_0x260d2b]['id'],'queue_name':_0x5af13a['name'],'VoiceQueueId':_0x5af13a['id'],'interface':_['isNil'](_0x1795fc[_0x260d2b][_0x46f3('0x6f')])?util['format'](_0x46f3('0x90'),_0x1795fc[_0x260d2b][_0x46f3('0x31')]):_0x1795fc[_0x260d2b]['interface'],'paused':_0x1795fc[_0x260d2b][_0x46f3('0x6e')]||![],'penalty':_0x2259b1[_0x46f3('0x50')]['penalty']||0x0}));}}return BPromise[_0x46f3('0x8b')](_0x1f0b85);}})[_0x46f3('0x26')](function(){return _0x5f09f8;})[_0x46f3('0x26')](respondWithResult(_0x2884d5,null))[_0x46f3('0x48')](handleError(_0x2884d5,null));};exports[_0x46f3('0x91')]=function(_0x483e56,_0x6d25e1,_0x48633a){return db[_0x46f3('0x44')][_0x46f3('0x4e')]({'where':{'id':_0x483e56[_0x46f3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x6d25e1,null))[_0x46f3('0x26')](function(_0xf08c26){if(_0xf08c26){return _0xf08c26[_0x46f3('0x91')](_0x483e56['query'][_0x46f3('0x7e')])[_0x46f3('0x26')](function(){if(_[_0x46f3('0x92')](_0x483e56[_0x46f3('0x39')][_0x46f3('0x7e')])){for(var _0x2e0bde=0x0;_0x2e0bde<_0x483e56[_0x46f3('0x39')][_0x46f3('0x7e')][_0x46f3('0x4c')];_0x2e0bde+=0x1){socket['emit'](_0x46f3('0x8d'),{'UserId':Number(_0x483e56['query'][_0x46f3('0x7e')][_0x2e0bde]),'VoiceQueueId':Number(_0x483e56[_0x46f3('0x4a')]['id'])});}}else{socket[_0x46f3('0x7b')]('userVoiceQueue:remove',{'UserId':Number(_0x483e56[_0x46f3('0x39')][_0x46f3('0x7e')]),'VoiceQueueId':Number(_0x483e56[_0x46f3('0x4a')]['id'])});}});}})[_0x46f3('0x26')](function(_0x4a038b){return db[_0x46f3('0x79')]['destroy']({'where':{'VoiceQueueId':_0x483e56['params']['id'],'UserId':_0x483e56['query'][_0x46f3('0x7e')]}})['then'](function(){return _0x4a038b;});})['then'](respondWithStatusCode(_0x6d25e1,null))[_0x46f3('0x48')](handleError(_0x6d25e1,null));};exports[_0x46f3('0x93')]=function(_0x2b879a,_0x1592a8,_0x145cf6){var _0x5de0cb={};var _0x4d7faa={};var _0x4bea35;var _0xb1ba40;return db[_0x46f3('0x44')]['findOne']({'where':{'id':_0x2b879a[_0x46f3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1592a8,null))['then'](function(_0x9bd46e){if(_0x9bd46e){_0x4bea35=_0x9bd46e;_0x4d7faa[_0x46f3('0x38')]=_['keys'](db[_0x46f3('0x6b')][_0x46f3('0x36')]);_0x4d7faa[_0x46f3('0x39')]=_[_0x46f3('0x4b')](_0x2b879a[_0x46f3('0x39')]);_0x4d7faa[_0x46f3('0x3a')]=_[_0x46f3('0x3b')](_0x4d7faa[_0x46f3('0x38')],_0x4d7faa['query']);_0x5de0cb[_0x46f3('0x3c')]=_[_0x46f3('0x3b')](_0x4d7faa[_0x46f3('0x38')],qs[_0x46f3('0x3d')](_0x2b879a[_0x46f3('0x39')][_0x46f3('0x3d')]));_0x5de0cb[_0x46f3('0x3c')]=_0x5de0cb[_0x46f3('0x3c')]['length']?_0x5de0cb[_0x46f3('0x3c')]:_0x4d7faa[_0x46f3('0x38')];_0x5de0cb[_0x46f3('0x3f')]=qs['sort'](_0x2b879a[_0x46f3('0x39')]['sort']);_0x5de0cb[_0x46f3('0x41')]=qs[_0x46f3('0x3a')](_[_0x46f3('0x40')](_0x2b879a['query'],_0x4d7faa[_0x46f3('0x3a')]));if(_0x2b879a['query'][_0x46f3('0x2b')]){_0x5de0cb['where']=_['merge'](_0x5de0cb[_0x46f3('0x41')],{'$or':_[_0x46f3('0x2d')](_0x5de0cb[_0x46f3('0x3c')],function(_0x48ba47){var _0x5e60cc={};_0x5e60cc[_0x48ba47]={'$like':'%'+_0x2b879a[_0x46f3('0x39')]['filter']+'%'};return _0x5e60cc;})});}_0x5de0cb=_['merge']({},_0x5de0cb,_0x2b879a[_0x46f3('0x4d')]);return _0x4bea35[_0x46f3('0x93')](_0x5de0cb);}})[_0x46f3('0x26')](function(_0x3c53be){if(_0x3c53be){_0xb1ba40=_0x3c53be[_0x46f3('0x4c')];if(!_0x2b879a[_0x46f3('0x39')]['hasOwnProperty'](_0x46f3('0x5f'))){_0x5de0cb[_0x46f3('0x1f')]=qs[_0x46f3('0x1f')](_0x2b879a[_0x46f3('0x39')][_0x46f3('0x1f')]);_0x5de0cb[_0x46f3('0x1e')]=qs[_0x46f3('0x1e')](_0x2b879a[_0x46f3('0x39')][_0x46f3('0x1e')]);}return _0x4bea35[_0x46f3('0x93')](_0x5de0cb);}})[_0x46f3('0x26')](function(_0x354607){if(_0x354607){return _0x354607?{'count':_0xb1ba40,'rows':_0x354607}:null;}})[_0x46f3('0x26')](respondWithResult(_0x1592a8,null))[_0x46f3('0x48')](handleError(_0x1592a8,null));};exports[_0x46f3('0x94')]=function(_0x7b2d44,_0x1923eb,_0xe20c4e){var _0x2dd233={};var _0xa51a7={};var _0x345c4d;var _0x5096da;return db[_0x46f3('0x44')][_0x46f3('0x5d')]({'where':{'id':_0x7b2d44[_0x46f3('0x4a')]['id']}})[_0x46f3('0x26')](handleEntityNotFound(_0x1923eb,null))[_0x46f3('0x26')](function(_0x385307){if(_0x385307){_0x345c4d=_0x385307;_0xa51a7[_0x46f3('0x38')]=_['keys'](db[_0x46f3('0x79')]['rawAttributes']);_0xa51a7[_0x46f3('0x39')]=_[_0x46f3('0x4b')](_0x7b2d44['query']);_0xa51a7[_0x46f3('0x3a')]=_[_0x46f3('0x3b')](_0xa51a7['model'],_0xa51a7[_0x46f3('0x39')]);_0x2dd233[_0x46f3('0x3c')]=_[_0x46f3('0x3b')](_0xa51a7['model'],qs[_0x46f3('0x3d')](_0x7b2d44[_0x46f3('0x39')][_0x46f3('0x3d')]));_0x2dd233[_0x46f3('0x3c')]=_0x2dd233[_0x46f3('0x3c')][_0x46f3('0x4c')]?_0x2dd233['attributes']:_0xa51a7[_0x46f3('0x38')];_0x2dd233['order']=qs[_0x46f3('0x60')](_0x7b2d44[_0x46f3('0x39')]['sort']);_0x2dd233[_0x46f3('0x41')]=qs[_0x46f3('0x3a')](_[_0x46f3('0x40')](_0x7b2d44[_0x46f3('0x39')],_0xa51a7[_0x46f3('0x3a')]));if(_0x7b2d44[_0x46f3('0x39')]['filter']){_0x2dd233[_0x46f3('0x41')]=_[_0x46f3('0x42')](_0x2dd233[_0x46f3('0x41')],{'$or':_[_0x46f3('0x2d')](_0x2dd233['attributes'],function(_0x48726d){var _0x1ef6e8={};_0x1ef6e8[_0x48726d]={'$like':'%'+_0x7b2d44[_0x46f3('0x39')][_0x46f3('0x2b')]+'%'};return _0x1ef6e8;})});}_0x2dd233=_[_0x46f3('0x42')]({},_0x2dd233,_0x7b2d44['options']);return _0x345c4d[_0x46f3('0x94')](_0x2dd233);}})[_0x46f3('0x26')](function(_0x98a66f){if(_0x98a66f){_0x5096da=_0x98a66f[_0x46f3('0x4c')];if(!_0x7b2d44['query']['hasOwnProperty'](_0x46f3('0x5f'))){_0x2dd233[_0x46f3('0x1f')]=qs['limit'](_0x7b2d44[_0x46f3('0x39')][_0x46f3('0x1f')]);_0x2dd233['offset']=qs[_0x46f3('0x1e')](_0x7b2d44[_0x46f3('0x39')]['offset']);}return _0x345c4d[_0x46f3('0x94')](_0x2dd233);}})[_0x46f3('0x26')](function(_0x36594d){return _0x36594d?{'count':_0x5096da,'rows':_0x36594d}:null;})[_0x46f3('0x26')](respondWithResult(_0x1923eb,null))['catch'](handleError(_0x1923eb,null));};exports['getLists']=function(_0x47e906,_0x5c7210,_0x2d97d8){var _0x4af121={};var _0x14c785={};var _0x442eba;var _0x5ba082;return db[_0x46f3('0x44')][_0x46f3('0x5d')]({'where':{'id':_0x47e906[_0x46f3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5c7210,null))['then'](function(_0x85dd52){if(_0x85dd52){_0x442eba=_0x85dd52;_0x14c785[_0x46f3('0x38')]=_[_0x46f3('0x4b')](db[_0x46f3('0x95')][_0x46f3('0x36')]);_0x14c785[_0x46f3('0x39')]=_['keys'](_0x47e906['query']);_0x14c785[_0x46f3('0x3a')]=_[_0x46f3('0x3b')](_0x14c785[_0x46f3('0x38')],_0x14c785[_0x46f3('0x39')]);_0x4af121['attributes']=_[_0x46f3('0x3b')](_0x14c785[_0x46f3('0x38')],qs[_0x46f3('0x3d')](_0x47e906[_0x46f3('0x39')]['fields']));_0x4af121[_0x46f3('0x3c')]=_0x4af121[_0x46f3('0x3c')][_0x46f3('0x4c')]?_0x4af121[_0x46f3('0x3c')]:_0x14c785[_0x46f3('0x38')];_0x4af121[_0x46f3('0x3f')]=qs[_0x46f3('0x60')](_0x47e906[_0x46f3('0x39')]['sort']);_0x4af121['where']=qs[_0x46f3('0x3a')](_[_0x46f3('0x40')](_0x47e906[_0x46f3('0x39')],_0x14c785[_0x46f3('0x3a')]));if(_0x47e906['query']['filter']){_0x4af121[_0x46f3('0x41')]=_[_0x46f3('0x42')](_0x4af121[_0x46f3('0x41')],{'$or':_[_0x46f3('0x2d')](_0x4af121[_0x46f3('0x3c')],function(_0x34669f){var _0x420ed4={};_0x420ed4[_0x34669f]={'$like':'%'+_0x47e906['query']['filter']+'%'};return _0x420ed4;})});}_0x4af121=_['merge']({},_0x4af121,_0x47e906[_0x46f3('0x4d')]);return _0x442eba[_0x46f3('0x96')](_0x4af121);}})[_0x46f3('0x26')](function(_0x35f231){if(_0x35f231){_0x5ba082=_0x35f231[_0x46f3('0x4c')];if(!_0x47e906['query'][_0x46f3('0x3e')](_0x46f3('0x5f'))){_0x4af121[_0x46f3('0x1f')]=qs['limit'](_0x47e906[_0x46f3('0x39')][_0x46f3('0x1f')]);_0x4af121['offset']=qs['offset'](_0x47e906['query'][_0x46f3('0x1e')]);}return _0x442eba[_0x46f3('0x96')](_0x4af121);}})[_0x46f3('0x26')](function(_0x331c99){if(_0x331c99){return _0x331c99?{'count':_0x5ba082,'rows':_0x331c99}:null;}})[_0x46f3('0x26')](respondWithResult(_0x5c7210,null))[_0x46f3('0x48')](handleError(_0x5c7210,null));};exports[_0x46f3('0x97')]=function(_0x2054da,_0x59e92f,_0x2c0742){var _0x22f0fd,_0x370d9c;return db[_0x46f3('0x44')][_0x46f3('0x4e')]({'where':{'id':_0x2054da['params']['id']}})['then'](handleEntityNotFound(_0x59e92f,null))[_0x46f3('0x26')](function(_0x6b40d6){if(_0x6b40d6){_0x370d9c=_0x6b40d6;return _0x6b40d6['addLists'](_0x2054da[_0x46f3('0x50')][_0x46f3('0x7e')],_[_0x46f3('0x59')](_0x2054da[_0x46f3('0x50')],[_0x46f3('0x7e'),'id'])||{});}return null;})[_0x46f3('0x8f')](function(_0xf7759b){var _0x22efb3;_0x22f0fd=_0xf7759b||[];var _0x417bd2=[];if(_0xf7759b){for(var _0x81c5b8=0x0;_0x81c5b8<_0xf7759b[_0x46f3('0x4c')];_0x81c5b8+=0x1){var _0x4b0620=_0xf7759b[_0x81c5b8][_0x46f3('0x51')]({'plain':!![]});_0x370d9c['dialCheckDuplicateType']=_0x2054da['body'][_0x46f3('0x98')]?_0x2054da[_0x46f3('0x50')][_0x46f3('0x98')]:_0x370d9c[_0x46f3('0x98')];switch(_0x370d9c[_0x46f3('0x98')]){case _0x46f3('0x99'):_0x22efb3=squel[_0x46f3('0x9a')]()['into'](_0x46f3('0x9b'))[_0x46f3('0x9c')]([_0x46f3('0x9d'),'scheduledAt','ContactId',_0x46f3('0x9e'),'VoiceQueueId',_0x46f3('0x5a'),_0x46f3('0x58')],squel['select']()['field']('phone',_0x46f3('0x9d'))[_0x46f3('0x9f')]('NOW()','scheduledAt')[_0x46f3('0x9f')]('id',_0x46f3('0xa0'))['field'](_0x4b0620[_0x46f3('0xa1')][_0x46f3('0x88')](),'ListId')[_0x46f3('0x9f')](_0x2054da[_0x46f3('0x4a')]['id'][_0x46f3('0x88')](),_0x46f3('0x61'))[_0x46f3('0x9f')]('NOW()','createdAt')[_0x46f3('0x9f')](_0x46f3('0xa2'),_0x46f3('0x58'))[_0x46f3('0x81')]('cm_contacts')[_0x46f3('0x41')](_0x46f3('0xa3'))[_0x46f3('0x41')](_0x46f3('0xa4'),_0x4b0620['CmListId'][_0x46f3('0x88')]())[_0x46f3('0x41')](_0x46f3('0xa5'))['where'](_0x46f3('0xa6'),squel[_0x46f3('0x7f')]()[_0x46f3('0x9f')]('COALESCE(calleridnum,\x27\x27)')[_0x46f3('0x81')](_0x46f3('0xa7'))['where'](_0x46f3('0x85'),_0x2054da[_0x46f3('0x4a')]['id'][_0x46f3('0x88')]()))['where'](_0x46f3('0xa6'),squel[_0x46f3('0x7f')]()['field'](_0x46f3('0xa8'))['from'](_0x46f3('0x9b'))[_0x46f3('0x41')](_0x46f3('0x85'),_0x2054da[_0x46f3('0x4a')]['id'][_0x46f3('0x88')]())))[_0x46f3('0x88')]();break;case _0x46f3('0xa9'):_0x22efb3=squel[_0x46f3('0x9a')]()['into'](_0x46f3('0x9b'))[_0x46f3('0x9c')](['phone',_0x46f3('0xaa'),'ContactId',_0x46f3('0x9e'),_0x46f3('0x61'),_0x46f3('0x5a'),_0x46f3('0x58')],squel['select']()['field'](_0x46f3('0x9d'),'phone')[_0x46f3('0x9f')](_0x46f3('0xa2'),_0x46f3('0xaa'))[_0x46f3('0x9f')]('id',_0x46f3('0xa0'))[_0x46f3('0x9f')](_0x4b0620['CmListId']['toString'](),'ListId')[_0x46f3('0x9f')](_0x2054da[_0x46f3('0x4a')]['id'][_0x46f3('0x88')](),_0x46f3('0x61'))[_0x46f3('0x9f')](_0x46f3('0xa2'),_0x46f3('0x5a'))['field'](_0x46f3('0xa2'),_0x46f3('0x58'))[_0x46f3('0x81')](_0x46f3('0xab'))[_0x46f3('0x41')](_0x46f3('0xa3'))['where']('ListId\x20=\x20?',_0x4b0620[_0x46f3('0xa1')]['toString']())[_0x46f3('0x41')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x46f3('0x9f')](_0x46f3('0xa8'))[_0x46f3('0x81')](_0x46f3('0x9b'))['where'](_0x46f3('0x85'),_0x2054da[_0x46f3('0x4a')]['id'][_0x46f3('0x88')]())))['toString']();break;default:_0x22efb3=squel[_0x46f3('0x9a')]()[_0x46f3('0xac')]('cm_hopper')[_0x46f3('0x9c')](['phone',_0x46f3('0xaa'),'ContactId',_0x46f3('0x9e'),'VoiceQueueId','createdAt',_0x46f3('0x58')],squel['select']()[_0x46f3('0x9f')](_0x46f3('0x9d'),_0x46f3('0x9d'))['field'](_0x46f3('0xa2'),_0x46f3('0xaa'))[_0x46f3('0x9f')]('id',_0x46f3('0xa0'))[_0x46f3('0x9f')](_0x4b0620['CmListId'][_0x46f3('0x88')](),_0x46f3('0x9e'))[_0x46f3('0x9f')](_0x2054da[_0x46f3('0x4a')]['id'][_0x46f3('0x88')](),'VoiceQueueId')[_0x46f3('0x9f')](_0x46f3('0xa2'),'createdAt')[_0x46f3('0x9f')]('NOW()',_0x46f3('0x58'))['from'](_0x46f3('0xab'))[_0x46f3('0x41')](_0x46f3('0xa3'))[_0x46f3('0x41')](_0x46f3('0xa4'),_0x4b0620[_0x46f3('0xa1')][_0x46f3('0x88')]())['where'](_0x46f3('0xa5')))[_0x46f3('0x88')]();}_0x417bd2[_0x46f3('0x87')](db[_0x46f3('0x73')]['query'](_0x22efb3));}return BPromise[_0x46f3('0x8b')](_0x417bd2);}})['then'](function(){return _0x22f0fd;})[_0x46f3('0x26')](respondWithResult(_0x59e92f,null))[_0x46f3('0x48')](handleError(_0x59e92f,null));};exports[_0x46f3('0xad')]=function(_0x26535b,_0x4154cc,_0x25e4ea){return db[_0x46f3('0x44')]['find']({'where':{'id':_0x26535b['params']['id']}})[_0x46f3('0x26')](handleEntityNotFound(_0x4154cc,null))[_0x46f3('0x26')](function(_0x126f35){if(_0x126f35){return _0x126f35[_0x46f3('0xad')](_0x26535b[_0x46f3('0x39')][_0x46f3('0x7e')]);}})[_0x46f3('0x26')](function(_0x2f285c){if(_0x2f285c){return db[_0x46f3('0x5e')]['destroy']({'where':{'ListId':_0x26535b[_0x46f3('0x39')]['ids'],'VoiceQueueId':_0x26535b['params']['id']}})[_0x46f3('0x26')](function(){return _0x2f285c;});}})[_0x46f3('0x26')](respondWithStatusCode(_0x4154cc,null))[_0x46f3('0x48')](handleError(_0x4154cc,null));};exports[_0x46f3('0xae')]=function(_0x48836c,_0x247bef,_0x8efc6b){var _0x306621={};var _0x1df3b1={};var _0x45d410;var _0x288af6;return db['VoiceQueue'][_0x46f3('0x5d')]({'where':{'id':_0x48836c[_0x46f3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x247bef,null))[_0x46f3('0x26')](function(_0x149c90){if(_0x149c90){_0x45d410=_0x149c90;_0x1df3b1[_0x46f3('0x38')]=_['keys'](db[_0x46f3('0x95')][_0x46f3('0x36')]);_0x1df3b1['query']=_[_0x46f3('0x4b')](_0x48836c[_0x46f3('0x39')]);_0x1df3b1['filters']=_[_0x46f3('0x3b')](_0x1df3b1[_0x46f3('0x38')],_0x1df3b1[_0x46f3('0x39')]);_0x306621[_0x46f3('0x3c')]=_['intersection'](_0x1df3b1[_0x46f3('0x38')],qs[_0x46f3('0x3d')](_0x48836c['query'][_0x46f3('0x3d')]));_0x306621[_0x46f3('0x3c')]=_0x306621[_0x46f3('0x3c')]['length']?_0x306621['attributes']:_0x1df3b1[_0x46f3('0x38')];_0x306621['order']=qs[_0x46f3('0x60')](_0x48836c['query'][_0x46f3('0x60')]);_0x306621[_0x46f3('0x41')]=qs[_0x46f3('0x3a')](_[_0x46f3('0x40')](_0x48836c[_0x46f3('0x39')],_0x1df3b1['filters']));if(_0x48836c[_0x46f3('0x39')][_0x46f3('0x2b')]){_0x306621[_0x46f3('0x41')]=_[_0x46f3('0x42')](_0x306621[_0x46f3('0x41')],{'$or':_[_0x46f3('0x2d')](_0x306621[_0x46f3('0x3c')],function(_0x5bd90e){var _0x2ad970={};_0x2ad970[_0x5bd90e]={'$like':'%'+_0x48836c['query'][_0x46f3('0x2b')]+'%'};return _0x2ad970;})});}_0x306621=_[_0x46f3('0x42')]({},_0x306621,_0x48836c[_0x46f3('0x4d')]);return _0x45d410['getBlackLists'](_0x306621);}})[_0x46f3('0x26')](function(_0x326150){if(_0x326150){_0x288af6=_0x326150['length'];if(!_0x48836c['query'][_0x46f3('0x3e')](_0x46f3('0x5f'))){_0x306621[_0x46f3('0x1f')]=qs['limit'](_0x48836c[_0x46f3('0x39')][_0x46f3('0x1f')]);_0x306621[_0x46f3('0x1e')]=qs['offset'](_0x48836c[_0x46f3('0x39')][_0x46f3('0x1e')]);}return _0x45d410[_0x46f3('0xae')](_0x306621);}})[_0x46f3('0x26')](function(_0x1cd625){if(_0x1cd625){return _0x1cd625?{'count':_0x288af6,'rows':_0x1cd625}:null;}})[_0x46f3('0x26')](respondWithResult(_0x247bef,null))[_0x46f3('0x48')](handleError(_0x247bef,null));};exports[_0x46f3('0xaf')]=function(_0xa6ccde,_0x3d7ff3,_0x5dfff2){var _0x5667a0,_0x1c82ef;return db['VoiceQueue'][_0x46f3('0x4e')]({'where':{'id':_0xa6ccde[_0x46f3('0x4a')]['id']}})[_0x46f3('0x26')](handleEntityNotFound(_0x3d7ff3,null))[_0x46f3('0x26')](function(_0x52a8b4){if(_0x52a8b4){_0x1c82ef=_0x52a8b4;return _0x52a8b4[_0x46f3('0xaf')](_0xa6ccde[_0x46f3('0x50')][_0x46f3('0x7e')],_[_0x46f3('0x59')](_0xa6ccde[_0x46f3('0x50')],['ids','id'])||{});}return null;})['spread'](function(_0x154a3c){var _0x48dfaf;_0x5667a0=_0x154a3c||[];var _0x47e111=[];if(_0x154a3c){for(var _0xe771a1=0x0;_0xe771a1<_0x154a3c[_0x46f3('0x4c')];_0xe771a1+=0x1){var _0x4573da=_0x154a3c[_0xe771a1][_0x46f3('0x51')]({'plain':!![]});_0x48dfaf=squel[_0x46f3('0x9a')]()[_0x46f3('0xac')](_0x46f3('0xb0'))[_0x46f3('0x9c')]([_0x46f3('0x9d'),_0x46f3('0xa0'),_0x46f3('0x9e'),'VoiceQueueId',_0x46f3('0x5a'),_0x46f3('0x58')],squel[_0x46f3('0x7f')]()[_0x46f3('0x9f')](_0x46f3('0x9d'),_0x46f3('0x9d'))[_0x46f3('0x9f')]('id','ContactId')['field'](_0x4573da[_0x46f3('0xa1')][_0x46f3('0x88')](),'ListId')[_0x46f3('0x9f')](_0xa6ccde['params']['id'][_0x46f3('0x88')](),_0x46f3('0x61'))[_0x46f3('0x9f')]('NOW()','createdAt')[_0x46f3('0x9f')](_0x46f3('0xa2'),_0x46f3('0x58'))['from'](_0x46f3('0xab'))[_0x46f3('0x41')](_0x46f3('0xa3'))[_0x46f3('0x41')](_0x46f3('0xa4'),_0x4573da[_0x46f3('0xa1')][_0x46f3('0x88')]())[_0x46f3('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0x46f3('0x88')]();_0x47e111['push'](db[_0x46f3('0x73')][_0x46f3('0x39')](_0x48dfaf));}return BPromise[_0x46f3('0x8b')](_0x47e111);}})[_0x46f3('0x26')](function(){return _0x5667a0;})[_0x46f3('0x26')](respondWithResult(_0x3d7ff3,null))[_0x46f3('0x48')](handleError(_0x3d7ff3,null));};exports[_0x46f3('0xb1')]=function(_0x3abfca,_0x20bac7,_0x1d6b00){return db['VoiceQueue'][_0x46f3('0x4e')]({'where':{'id':_0x3abfca[_0x46f3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x20bac7,null))['then'](function(_0x10d425){if(_0x10d425){return _0x10d425[_0x46f3('0xb1')](_0x3abfca[_0x46f3('0x39')][_0x46f3('0x7e')]);}})[_0x46f3('0x26')](function(_0x14fd61){if(_0x14fd61){return db['CmHopperBlack'][_0x46f3('0x33')]({'where':{'ListId':_0x3abfca[_0x46f3('0x39')][_0x46f3('0x7e')],'VoiceQueueId':_0x3abfca[_0x46f3('0x4a')]['id']}})[_0x46f3('0x26')](function(){return _0x14fd61;});}})[_0x46f3('0x26')](respondWithStatusCode(_0x20bac7,null))[_0x46f3('0x48')](handleError(_0x20bac7,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 831ad1f..011db8b 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 _0x8e71=['hook','VoiceQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e71,0x104));var _0x18e7=function(_0x217ff6,_0x36f75d){_0x217ff6=_0x217ff6-0x0;var _0x417c93=_0x8e71[_0x217ff6];return _0x417c93;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0x18e7('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x18e7('0x1'),'afterUpdate':_0x18e7('0x2'),'afterDestroy':_0x18e7('0x3')};function emitEvent(_0x255293){return function(_0x4289e9,_0x24286f,_0x7a8c47){VoiceQueueEvents['emit'](_0x255293+':'+_0x4289e9['id'],_0x4289e9);VoiceQueueEvents[_0x18e7('0x4')](_0x255293,_0x4289e9);_0x7a8c47(null);};}for(var e in events){if(events[_0x18e7('0x5')](e)){var event=events[e];VoiceQueue[_0x18e7('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x0612=['emit','hasOwnProperty','hook','../../mysqldb','VoiceQueue','setMaxListeners','save','remove'];(function(_0x5e492a,_0x2b64ac){var _0x341d02=function(_0x239250){while(--_0x239250){_0x5e492a['push'](_0x5e492a['shift']());}};_0x341d02(++_0x2b64ac);}(_0x0612,0x1bb));var _0x2061=function(_0x37deae,_0x3123ac){_0x37deae=_0x37deae-0x0;var _0x5eba6b=_0x0612[_0x37deae];return _0x5eba6b;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x2061('0x0'))['db'][_0x2061('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x2061('0x2')](0x0);var events={'afterCreate':_0x2061('0x3'),'afterUpdate':'update','afterDestroy':_0x2061('0x4')};function emitEvent(_0x16fb33){return function(_0x133754,_0x819890,_0x35b678){VoiceQueueEvents[_0x2061('0x5')](_0x16fb33+':'+_0x133754['id'],_0x133754);VoiceQueueEvents['emit'](_0x16fb33,_0x133754);_0x35b678(null);};}for(var e in events){if(events[_0x2061('0x6')](e)){var event=events[e];VoiceQueue[_0x2061('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 53efa48..9baa6eb 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 _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2d3590,_0x4d4d05){var _0x59febc=function(_0x1c5a7f){while(--_0x1c5a7f){_0x2d3590['push'](_0x2d3590['shift']());}};_0x59febc(++_0x4d4d05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3ef5bb,_0x4a664a){var _0x6a1a79=function(_0x21d84e){while(--_0x21d84e){_0x3ef5bb['push'](_0x3ef5bb['shift']());}};_0x6a1a79(++_0x4a664a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index e2622bd..398048a 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 _0xca47=['localhost','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','VoiceQueue','options','raw','where','attributes','include','model','map','GetVoiceQueue','ShowVoiceQueue','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xca47,0x16a));var _0x7ca4=function(_0x49d639,_0x287a74){_0x49d639=_0x49d639-0x0;var _0x22b4b5=_0xca47[_0x49d639];return _0x22b4b5;};'use strict';var _=require(_0x7ca4('0x0'));var util=require('util');var moment=require(_0x7ca4('0x1'));var BPromise=require('bluebird');var rs=require(_0x7ca4('0x2'));var fs=require('fs');var Redis=require(_0x7ca4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ca4('0x4'));var logger=require('../../config/logger')(_0x7ca4('0x5'));var config=require(_0x7ca4('0x6'));var jayson=require(_0x7ca4('0x7'));var client=jayson[_0x7ca4('0x8')][_0x7ca4('0x9')]({'port':0x232a});config[_0x7ca4('0xa')]=_[_0x7ca4('0xb')](config['redis'],{'host':_0x7ca4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ca4('0xa')]));require('./voiceQueue.socket')[_0x7ca4('0xd')](socket);function respondWithRpcPromise(_0x3bdebd,_0x305340,_0x3e1d73){return new BPromise(function(_0x292982,_0xbf241d){return client['request'](_0x3bdebd,_0x3e1d73)[_0x7ca4('0xe')](function(_0xca58a9){logger[_0x7ca4('0xf')](_0x7ca4('0x10'),_0x305340,_0x7ca4('0x11'));logger[_0x7ca4('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x305340,_0x7ca4('0x11'),JSON[_0x7ca4('0x13')](_0xca58a9));if(_0xca58a9['error']){if(_0xca58a9[_0x7ca4('0x14')]['code']===0x1f4){logger[_0x7ca4('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x305340,_0xca58a9[_0x7ca4('0x14')][_0x7ca4('0x15')]);return _0xbf241d(_0xca58a9[_0x7ca4('0x14')][_0x7ca4('0x15')]);}logger[_0x7ca4('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x305340,_0xca58a9[_0x7ca4('0x14')]['message']);return _0x292982(_0xca58a9['error'][_0x7ca4('0x15')]);}else{logger[_0x7ca4('0xf')](_0x7ca4('0x10'),_0x305340,_0x7ca4('0x11'));_0x292982(_0xca58a9[_0x7ca4('0x16')][_0x7ca4('0x15')]);}})[_0x7ca4('0x17')](function(_0x54c052){logger['error'](_0x7ca4('0x10'),_0x305340,_0x54c052);_0xbf241d(_0x54c052);});});}exports['GetVoiceQueue']=function(_0x2bff2d){var _0x5d3270=this;return new Promise(function(_0x19faa7,_0x75fa41){return db[_0x7ca4('0x18')]['findAll']({'raw':_0x2bff2d[_0x7ca4('0x19')]?_0x2bff2d[_0x7ca4('0x19')][_0x7ca4('0x1a')]===undefined?!![]:![]:!![],'where':_0x2bff2d[_0x7ca4('0x19')]?_0x2bff2d[_0x7ca4('0x19')][_0x7ca4('0x1b')]||null:null,'attributes':_0x2bff2d['options']?_0x2bff2d[_0x7ca4('0x19')][_0x7ca4('0x1c')]||null:null,'limit':_0x2bff2d['options']?_0x2bff2d[_0x7ca4('0x19')]['limit']||null:null,'include':_0x2bff2d['options']?_0x2bff2d['options'][_0x7ca4('0x1d')]?_['map'](_0x2bff2d[_0x7ca4('0x19')][_0x7ca4('0x1d')],function(_0x47a66d){return{'model':db[_0x47a66d[_0x7ca4('0x1e')]],'as':_0x47a66d['as'],'attributes':_0x47a66d['attributes'],'include':_0x47a66d['include']?_[_0x7ca4('0x1f')](_0x47a66d[_0x7ca4('0x1d')],function(_0x592ee4){return{'model':db[_0x592ee4['model']],'as':_0x592ee4['as'],'attributes':_0x592ee4[_0x7ca4('0x1c')],'include':_0x592ee4[_0x7ca4('0x1d')]?_['map'](_0x592ee4[_0x7ca4('0x1d')],function(_0x1cf51f){return{'model':db[_0x1cf51f[_0x7ca4('0x1e')]],'as':_0x1cf51f['as'],'attributes':_0x1cf51f[_0x7ca4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7ca4('0xe')](function(_0x586248){logger[_0x7ca4('0xf')]('GetVoiceQueue',_0x2bff2d);logger[_0x7ca4('0x12')](_0x7ca4('0x20'),_0x2bff2d,JSON[_0x7ca4('0x13')](_0x586248));_0x19faa7(_0x586248);})[_0x7ca4('0x17')](function(_0x33e136){logger[_0x7ca4('0x14')]('GetVoiceQueue',_0x33e136[_0x7ca4('0x15')],_0x2bff2d);_0x75fa41(_0x5d3270[_0x7ca4('0x14')](0x1f4,_0x33e136[_0x7ca4('0x15')]));});});};exports['ShowVoiceQueue']=function(_0xc92b6){var _0x2a8516=this;return new Promise(function(_0x544980,_0x4f819c){return db[_0x7ca4('0x18')]['find']({'raw':_0xc92b6[_0x7ca4('0x19')]?_0xc92b6[_0x7ca4('0x19')][_0x7ca4('0x1a')]===undefined?!![]:![]:!![],'where':_0xc92b6[_0x7ca4('0x19')]?_0xc92b6[_0x7ca4('0x19')][_0x7ca4('0x1b')]||null:null,'attributes':_0xc92b6['options']?_0xc92b6['options']['attributes']||null:null,'include':_0xc92b6[_0x7ca4('0x19')]?_0xc92b6['options']['include']?_['map'](_0xc92b6[_0x7ca4('0x19')][_0x7ca4('0x1d')],function(_0x2bd364){return{'model':db[_0x2bd364[_0x7ca4('0x1e')]],'as':_0x2bd364['as'],'attributes':_0x2bd364['attributes'],'include':_0x2bd364[_0x7ca4('0x1d')]?_['map'](_0x2bd364[_0x7ca4('0x1d')],function(_0x1aa666){return{'model':db[_0x1aa666[_0x7ca4('0x1e')]],'as':_0x1aa666['as'],'attributes':_0x1aa666[_0x7ca4('0x1c')],'include':_0x1aa666['include']?_[_0x7ca4('0x1f')](_0x1aa666[_0x7ca4('0x1d')],function(_0x34e59e){return{'model':db[_0x34e59e[_0x7ca4('0x1e')]],'as':_0x34e59e['as'],'attributes':_0x34e59e[_0x7ca4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7ca4('0xe')](function(_0x664914){logger[_0x7ca4('0xf')]('ShowVoiceQueue',_0xc92b6);logger['debug'](_0x7ca4('0x21'),_0xc92b6,JSON[_0x7ca4('0x13')](_0x664914));_0x544980(_0x664914);})[_0x7ca4('0x17')](function(_0x17bc47){logger['error']('ShowVoiceQueue',_0x17bc47[_0x7ca4('0x15')],_0xc92b6);_0x4f819c(_0x2a8516[_0x7ca4('0x14')](0x1f4,_0x17bc47[_0x7ca4('0x15')]));});});}; \ No newline at end of file +var _0xe868=['attributes','include','map','model','debug','find','where','ShowVoiceQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','options'];(function(_0x1151ce,_0x28e2ed){var _0x346a36=function(_0x4b2c2e){while(--_0x4b2c2e){_0x1151ce['push'](_0x1151ce['shift']());}};_0x346a36(++_0x28e2ed);}(_0xe868,0x138));var _0x8e86=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe868[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8e86('0x0'));var util=require('util');var moment=require(_0x8e86('0x1'));var BPromise=require(_0x8e86('0x2'));var rs=require(_0x8e86('0x3'));var fs=require('fs');var Redis=require(_0x8e86('0x4'));var db=require(_0x8e86('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e86('0x6'))(_0x8e86('0x7'));var config=require('../../config/environment');var jayson=require(_0x8e86('0x8'));var client=jayson[_0x8e86('0x9')]['http']({'port':0x232a});config[_0x8e86('0xa')]=_[_0x8e86('0xb')](config[_0x8e86('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8e86('0xc'))(new Redis(config[_0x8e86('0xa')]));require(_0x8e86('0xd'))[_0x8e86('0xe')](socket);function respondWithRpcPromise(_0x5bba74,_0x241a00,_0x2535df){return new BPromise(function(_0x447249,_0x56acec){return client[_0x8e86('0xf')](_0x5bba74,_0x2535df)[_0x8e86('0x10')](function(_0x46a9c8){logger['info'](_0x8e86('0x11'),_0x241a00,'request\x20sent');logger['debug'](_0x8e86('0x12'),_0x241a00,_0x8e86('0x13'),JSON[_0x8e86('0x14')](_0x46a9c8));if(_0x46a9c8['error']){if(_0x46a9c8[_0x8e86('0x15')][_0x8e86('0x16')]===0x1f4){logger['error'](_0x8e86('0x11'),_0x241a00,_0x46a9c8[_0x8e86('0x15')][_0x8e86('0x17')]);return _0x56acec(_0x46a9c8[_0x8e86('0x15')][_0x8e86('0x17')]);}logger[_0x8e86('0x15')](_0x8e86('0x11'),_0x241a00,_0x46a9c8[_0x8e86('0x15')][_0x8e86('0x17')]);return _0x447249(_0x46a9c8[_0x8e86('0x15')]['message']);}else{logger[_0x8e86('0x18')](_0x8e86('0x11'),_0x241a00,_0x8e86('0x13'));_0x447249(_0x46a9c8[_0x8e86('0x19')][_0x8e86('0x17')]);}})[_0x8e86('0x1a')](function(_0x45e7f5){logger[_0x8e86('0x15')](_0x8e86('0x11'),_0x241a00,_0x45e7f5);_0x56acec(_0x45e7f5);});});}exports[_0x8e86('0x1b')]=function(_0xd01b8a){var _0x5cc7b3=this;return new Promise(function(_0x4aaec5,_0x4e798f){return db[_0x8e86('0x1c')]['findAll']({'raw':_0xd01b8a[_0x8e86('0x1d')]?_0xd01b8a[_0x8e86('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xd01b8a[_0x8e86('0x1d')]?_0xd01b8a['options']['where']||null:null,'attributes':_0xd01b8a[_0x8e86('0x1d')]?_0xd01b8a['options'][_0x8e86('0x1e')]||null:null,'limit':_0xd01b8a[_0x8e86('0x1d')]?_0xd01b8a['options']['limit']||null:null,'include':_0xd01b8a[_0x8e86('0x1d')]?_0xd01b8a[_0x8e86('0x1d')][_0x8e86('0x1f')]?_[_0x8e86('0x20')](_0xd01b8a['options'][_0x8e86('0x1f')],function(_0x2c3df3){return{'model':db[_0x2c3df3[_0x8e86('0x21')]],'as':_0x2c3df3['as'],'attributes':_0x2c3df3[_0x8e86('0x1e')],'include':_0x2c3df3[_0x8e86('0x1f')]?_['map'](_0x2c3df3[_0x8e86('0x1f')],function(_0x26a05b){return{'model':db[_0x26a05b['model']],'as':_0x26a05b['as'],'attributes':_0x26a05b[_0x8e86('0x1e')],'include':_0x26a05b[_0x8e86('0x1f')]?_[_0x8e86('0x20')](_0x26a05b[_0x8e86('0x1f')],function(_0x13395c){return{'model':db[_0x13395c['model']],'as':_0x13395c['as'],'attributes':_0x13395c['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e86('0x10')](function(_0x3d9588){logger['info'](_0x8e86('0x1b'),_0xd01b8a);logger[_0x8e86('0x22')](_0x8e86('0x1b'),_0xd01b8a,JSON[_0x8e86('0x14')](_0x3d9588));_0x4aaec5(_0x3d9588);})[_0x8e86('0x1a')](function(_0x3d9a14){logger['error']('GetVoiceQueue',_0x3d9a14[_0x8e86('0x17')],_0xd01b8a);_0x4e798f(_0x5cc7b3[_0x8e86('0x15')](0x1f4,_0x3d9a14[_0x8e86('0x17')]));});});};exports['ShowVoiceQueue']=function(_0x2b5e3c){var _0x1e1f0f=this;return new Promise(function(_0x380008,_0x17c74c){return db[_0x8e86('0x1c')][_0x8e86('0x23')]({'raw':_0x2b5e3c[_0x8e86('0x1d')]?_0x2b5e3c['options']['raw']===undefined?!![]:![]:!![],'where':_0x2b5e3c['options']?_0x2b5e3c[_0x8e86('0x1d')][_0x8e86('0x24')]||null:null,'attributes':_0x2b5e3c[_0x8e86('0x1d')]?_0x2b5e3c[_0x8e86('0x1d')][_0x8e86('0x1e')]||null:null,'include':_0x2b5e3c[_0x8e86('0x1d')]?_0x2b5e3c[_0x8e86('0x1d')][_0x8e86('0x1f')]?_['map'](_0x2b5e3c[_0x8e86('0x1d')]['include'],function(_0xd23c2){return{'model':db[_0xd23c2['model']],'as':_0xd23c2['as'],'attributes':_0xd23c2[_0x8e86('0x1e')],'include':_0xd23c2['include']?_['map'](_0xd23c2['include'],function(_0x49ea7e){return{'model':db[_0x49ea7e['model']],'as':_0x49ea7e['as'],'attributes':_0x49ea7e[_0x8e86('0x1e')],'include':_0x49ea7e[_0x8e86('0x1f')]?_[_0x8e86('0x20')](_0x49ea7e['include'],function(_0x39950c){return{'model':db[_0x39950c[_0x8e86('0x21')]],'as':_0x39950c['as'],'attributes':_0x39950c[_0x8e86('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20d777){logger[_0x8e86('0x18')](_0x8e86('0x25'),_0x2b5e3c);logger[_0x8e86('0x22')]('ShowVoiceQueue',_0x2b5e3c,JSON[_0x8e86('0x14')](_0x20d777));_0x380008(_0x20d777);})['catch'](function(_0x4d0ed0){logger[_0x8e86('0x15')]('ShowVoiceQueue',_0x4d0ed0[_0x8e86('0x17')],_0x2b5e3c);_0x17c74c(_0x1e1f0f[_0x8e86('0x15')](0x1f4,_0x4d0ed0[_0x8e86('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 955ed5d..f6a2ee1 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 _0x7034=['register','voiceQueue:','./voiceQueue.events','save','remove','emit'];(function(_0x59e2b9,_0x384a7a){var _0x29e81d=function(_0x145843){while(--_0x145843){_0x59e2b9['push'](_0x59e2b9['shift']());}};_0x29e81d(++_0x384a7a);}(_0x7034,0xc2));var _0x4703=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x7034[_0x68c979];return _0x4f0001;};'use strict';var VoiceQueueEvents=require(_0x4703('0x0'));var events=[_0x4703('0x1'),_0x4703('0x2'),'update'];function createListener(_0x5358b5,_0x17f2a8){return function(_0x5c098c){_0x17f2a8[_0x4703('0x3')](_0x5358b5,_0x5c098c);};}function removeListener(_0x58cae0,_0x1067fc){return function(){VoiceQueueEvents['removeListener'](_0x58cae0,_0x1067fc);};}exports[_0x4703('0x4')]=function(_0x410e31){for(var _0x43de24=0x0,_0x360f1b=events['length'];_0x43de24<_0x360f1b;_0x43de24++){var _0x1da66f=events[_0x43de24];var _0xb53b4a=createListener(_0x4703('0x5')+_0x1da66f,_0x410e31);VoiceQueueEvents['on'](_0x1da66f,_0xb53b4a);}}; \ No newline at end of file +var _0xa0b7=['voiceQueue:','save','remove','update','length'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xa0b7,0x1a5));var _0x7a0b=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xa0b7[_0x209941];return _0x1e8729;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x7a0b('0x0'),_0x7a0b('0x1'),_0x7a0b('0x2')];function createListener(_0x227b79,_0x3b7318){return function(_0x3d4a8c){_0x3b7318['emit'](_0x227b79,_0x3d4a8c);};}function removeListener(_0x106c88,_0x3175c7){return function(){VoiceQueueEvents['removeListener'](_0x106c88,_0x3175c7);};}exports['register']=function(_0x4c38b9){for(var _0x593e04=0x0,_0x5f3534=events[_0x7a0b('0x3')];_0x593e04<_0x5f3534;_0x593e04++){var _0x30cf2a=events[_0x593e04];var _0x33ac54=createListener(_0x7a0b('0x4')+_0x30cf2a,_0x4c38b9);VoiceQueueEvents['on'](_0x30cf2a,_0x33ac54);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 30d7b1e..c2a564d 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 _0x1750=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','get','/index','/:id','show','post','put','delete','util','path'];(function(_0x2eb828,_0x5b4396){var _0xdb47b7=function(_0x5797cb){while(--_0x5797cb){_0x2eb828['push'](_0x2eb828['shift']());}};_0xdb47b7(++_0x5b4396);}(_0x1750,0x19c));var _0x0175=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x1750[_0x187ee1];return _0x388160;};'use strict';var multer=require('multer');var util=require(_0x0175('0x0'));var path=require(_0x0175('0x1'));var timeout=require(_0x0175('0x2'));var express=require(_0x0175('0x3'));var router=express[_0x0175('0x4')]();var fs_extra=require(_0x0175('0x5'));var auth=require(_0x0175('0x6'));var interaction=require(_0x0175('0x7'));var config=require(_0x0175('0x8'));var controller=require(_0x0175('0x9'));router['get']('/',auth[_0x0175('0xa')](),controller['index']);router['get']('/describe',auth[_0x0175('0xa')](),controller['describe']);router[_0x0175('0xb')](_0x0175('0xc'),auth[_0x0175('0xa')](),controller['getVoiceQueuesReport']);router[_0x0175('0xb')](_0x0175('0xd'),auth[_0x0175('0xa')](),controller[_0x0175('0xe')]);router[_0x0175('0xf')]('/',auth[_0x0175('0xa')](),controller['create']);router[_0x0175('0x10')](_0x0175('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0175('0x11')](_0x0175('0xd'),auth[_0x0175('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa8e8=['show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa8e8,0x1bc));var _0x8a8e=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0xa8e8[_0x104e21];return _0x605b37;};'use strict';var multer=require(_0x8a8e('0x0'));var util=require(_0x8a8e('0x1'));var path=require(_0x8a8e('0x2'));var timeout=require(_0x8a8e('0x3'));var express=require('express');var router=express[_0x8a8e('0x4')]();var fs_extra=require(_0x8a8e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8a8e('0x6'));var config=require('../../config/environment');var controller=require(_0x8a8e('0x7'));router[_0x8a8e('0x8')]('/',auth[_0x8a8e('0x9')](),controller[_0x8a8e('0xa')]);router['get'](_0x8a8e('0xb'),auth['isAuthenticated'](),controller[_0x8a8e('0xc')]);router[_0x8a8e('0x8')](_0x8a8e('0xd'),auth[_0x8a8e('0x9')](),controller[_0x8a8e('0xe')]);router[_0x8a8e('0x8')](_0x8a8e('0xf'),auth[_0x8a8e('0x9')](),controller[_0x8a8e('0x10')]);router[_0x8a8e('0x11')]('/',auth[_0x8a8e('0x9')](),controller[_0x8a8e('0x12')]);router[_0x8a8e('0x13')](_0x8a8e('0xf'),auth[_0x8a8e('0x9')](),controller[_0x8a8e('0x14')]);router[_0x8a8e('0x15')](_0x8a8e('0xf'),auth[_0x8a8e('0x9')](),controller[_0x8a8e('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index f385b60..a9335ba 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 _0xcee1=['setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','queuecallerjoinAt','format','seconds'];(function(_0x56e0e8,_0x16ef91){var _0x2dab50=function(_0x4fe720){while(--_0x4fe720){_0x56e0e8['push'](_0x56e0e8['shift']());}};_0x2dab50(++_0x16ef91);}(_0xcee1,0x1e7));var _0x1cee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcee1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1cee('0x0'));var moment=require('moment');module[_0x1cee('0x1')]={'type':{'type':Sequelize[_0x1cee('0x2')]},'uniqueid':{'type':Sequelize[_0x1cee('0x2')]},'calleridnum':{'type':Sequelize[_0x1cee('0x2')]},'calleridname':{'type':Sequelize[_0x1cee('0x2')]},'queue':{'type':Sequelize[_0x1cee('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x1cee('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x1cee('0x3')],'set':function(_0x15c71){var _0x64cd86=moment(_0x15c71);var _0x3faf2e=moment(this['getDataValue'](_0x1cee('0x4')))[_0x1cee('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x177f3b=_0x64cd86['diff'](_0x3faf2e,_0x1cee('0x6'));this[_0x1cee('0x7')](_0x1cee('0x8'),_0x15c71);this[_0x1cee('0x7')]('holdtime',_0x177f3b||null);}},'position':{'type':Sequelize[_0x1cee('0x9')]},'count':{'type':Sequelize[_0x1cee('0x9')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1cee('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x1cee('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1cee('0x3')]},'queuecallerexit':{'type':Sequelize[_0x1cee('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1cee('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x1cee('0x2')],'comment':_0x1cee('0xb')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x1cee('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1cee('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1cee('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1cee('0x2')]},'priority':{'type':Sequelize[_0x1cee('0x2')]},'holdtime':{'type':Sequelize[_0x1cee('0x9')]},'mohtime':{'type':Sequelize[_0x1cee('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1cee('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1cee('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1cee('0x2')],'comment':_0x1cee('0xc')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1cee('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc801=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','diff','setDataValue','queuecallerleaveAt','holdtime'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_0xc801,0xe3));var _0x1c80=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xc801[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x1c80('0x0'));var moment=require(_0x1c80('0x1'));module[_0x1c80('0x2')]={'type':{'type':Sequelize[_0x1c80('0x3')]},'uniqueid':{'type':Sequelize[_0x1c80('0x3')]},'calleridnum':{'type':Sequelize[_0x1c80('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1c80('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x1c80('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x1c80('0x4')],'set':function(_0x5dbbd4){var _0x40b691=moment(_0x5dbbd4);var _0x45d4c1=moment(this['getDataValue'](_0x1c80('0x5')))[_0x1c80('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x59b0b3=_0x40b691[_0x1c80('0x7')](_0x45d4c1,'seconds');this[_0x1c80('0x8')](_0x1c80('0x9'),_0x5dbbd4);this[_0x1c80('0x8')](_0x1c80('0xa'),_0x59b0b3||null);}},'position':{'type':Sequelize[_0x1c80('0xb')]},'count':{'type':Sequelize[_0x1c80('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x1c80('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1c80('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x1c80('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1c80('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x1c80('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x1c80('0x3')]},'connectedlinenum':{'type':Sequelize[_0x1c80('0x3')]},'connectedlinename':{'type':Sequelize[_0x1c80('0x3')]},'accountcode':{'type':Sequelize[_0x1c80('0x3')]},'context':{'type':Sequelize[_0x1c80('0x3')]},'exten':{'type':Sequelize[_0x1c80('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x1c80('0xb')]},'mohtime':{'type':Sequelize[_0x1c80('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1c80('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x1c80('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1c80('0x3')],'comment':_0x1c80('0xd')},'transferexten':{'type':Sequelize[_0x1c80('0x3')]},'transferuniqueid':{'type':Sequelize[_0x1c80('0x3')]},'disposition':{'type':Sequelize[_0x1c80('0x3')]},'secondDisposition':{'type':Sequelize[_0x1c80('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1c80('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x1c80('0xb')],'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 68b7a01..382b3b1 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 _0xd7f4=['../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','merge','create','body','find','describe','getVoiceQueuesReport','nolimit','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xb5ea68,_0x49331f){var _0x1d317e=function(_0x14bab1){while(--_0x14bab1){_0xb5ea68['push'](_0xb5ea68['shift']());}};_0x1d317e(++_0x49331f);}(_0xd7f4,0x198));var _0x4d7f=function(_0x2e9454,_0xf69209){_0x2e9454=_0x2e9454-0x0;var _0x5a86f9=_0xd7f4[_0x2e9454];return _0x5a86f9;};'use strict';var emlformat=require(_0x4d7f('0x0'));var rimraf=require(_0x4d7f('0x1'));var zipdir=require(_0x4d7f('0x2'));var jsonpatch=require(_0x4d7f('0x3'));var rp=require(_0x4d7f('0x4'));var moment=require(_0x4d7f('0x5'));var BPromise=require(_0x4d7f('0x6'));var Mustache=require(_0x4d7f('0x7'));var util=require(_0x4d7f('0x8'));var path=require(_0x4d7f('0x9'));var sox=require(_0x4d7f('0xa'));var csv=require('to-csv');var ejs=require(_0x4d7f('0xb'));var fs=require('fs');var fs_extra=require(_0x4d7f('0xc'));var _=require(_0x4d7f('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4d7f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4d7f('0xf'));var querystring=require(_0x4d7f('0x10'));var Papa=require(_0x4d7f('0x11'));var Redis=require(_0x4d7f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4d7f('0x13'));var as=require(_0x4d7f('0x14'));var hardwareService=require(_0x4d7f('0x15'));var logger=require(_0x4d7f('0x16'))(_0x4d7f('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4d7f('0x18'));var db=require(_0x4d7f('0x19'))['db'];config[_0x4d7f('0x1a')]=_[_0x4d7f('0x1b')](config[_0x4d7f('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d7f('0x1a')]));require(_0x4d7f('0x1c'))[_0x4d7f('0x1d')](socket);function respondWithStatusCode(_0x129382,_0x3260bb){_0x3260bb=_0x3260bb||0xcc;return function(_0x33f8a5){if(_0x33f8a5){return _0x129382[_0x4d7f('0x1e')](_0x3260bb);}return _0x129382[_0x4d7f('0x1f')](_0x3260bb)[_0x4d7f('0x20')]();};}function respondWithResult(_0x19fb85,_0x2fb970){_0x2fb970=_0x2fb970||0xc8;return function(_0x1b9d2d){if(_0x1b9d2d){return _0x19fb85[_0x4d7f('0x1f')](_0x2fb970)['json'](_0x1b9d2d);}};}function respondWithFilteredResult(_0x537eff,_0x3d297e){return function(_0x465ec8){if(_0x465ec8){var _0x3faa63=typeof _0x3d297e[_0x4d7f('0x21')]===_0x4d7f('0x22')&&typeof _0x3d297e[_0x4d7f('0x23')]==='undefined';var _0x3e1096=_0x465ec8[_0x4d7f('0x24')];var _0x459368=_0x3faa63?0x0:_0x3d297e[_0x4d7f('0x21')];var _0x249c6d=_0x3faa63?_0x465ec8[_0x4d7f('0x24')]:_0x3d297e['offset']+_0x3d297e['limit'];var _0x41c9e1;if(_0x249c6d>=_0x3e1096){_0x249c6d=_0x3e1096;_0x41c9e1=0xc8;}else{_0x41c9e1=0xce;}_0x537eff[_0x4d7f('0x1f')](_0x41c9e1);return _0x537eff['set'](_0x4d7f('0x25'),_0x459368+'-'+_0x249c6d+'/'+_0x3e1096)[_0x4d7f('0x26')](_0x465ec8);}return null;};}function patchUpdates(_0x1e809b){return function(_0x2c05ec){try{jsonpatch[_0x4d7f('0x27')](_0x2c05ec,_0x1e809b,!![]);}catch(_0x3eac1d){return BPromise[_0x4d7f('0x28')](_0x3eac1d);}return _0x2c05ec[_0x4d7f('0x29')]();};}function saveUpdates(_0x2f7e01,_0x18dd24){return function(_0x132e28){if(_0x132e28){return _0x132e28[_0x4d7f('0x2a')](_0x2f7e01)[_0x4d7f('0x2b')](function(_0x3550b9){return _0x3550b9;});}return null;};}function removeEntity(_0x3238d1,_0x56ea60){return function(_0x479e54){if(_0x479e54){return _0x479e54[_0x4d7f('0x2c')]()[_0x4d7f('0x2b')](function(){_0x3238d1[_0x4d7f('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x401b5e,_0x97a101){return function(_0x15fafd){if(!_0x15fafd){_0x401b5e['sendStatus'](0x194);}return _0x15fafd;};}function handleError(_0x134821,_0x461033){_0x461033=_0x461033||0x1f4;return function(_0x61767b){logger[_0x4d7f('0x2d')](_0x61767b[_0x4d7f('0x2e')]);if(_0x61767b[_0x4d7f('0x2f')]){delete _0x61767b['name'];}_0x134821[_0x4d7f('0x1f')](_0x461033)[_0x4d7f('0x30')](_0x61767b);};}exports[_0x4d7f('0x31')]=function(_0x5110b1,_0x1afbe3){var _0x2c5286={},_0x38caa1={},_0x33f315={'count':0x0,'rows':[]};var _0x1d6f5=_[_0x4d7f('0x32')](db[_0x4d7f('0x33')][_0x4d7f('0x34')],function(_0x176bf1){return{'name':_0x176bf1[_0x4d7f('0x35')],'type':_0x176bf1[_0x4d7f('0x36')][_0x4d7f('0x37')]};});_0x38caa1['model']=_[_0x4d7f('0x32')](_0x1d6f5,_0x4d7f('0x2f'));_0x38caa1[_0x4d7f('0x38')]=_[_0x4d7f('0x39')](_0x5110b1['query']);_0x38caa1[_0x4d7f('0x3a')]=_[_0x4d7f('0x3b')](_0x38caa1[_0x4d7f('0x3c')],_0x38caa1[_0x4d7f('0x38')]);_0x2c5286[_0x4d7f('0x3d')]=_[_0x4d7f('0x3b')](_0x38caa1[_0x4d7f('0x3c')],qs['fields'](_0x5110b1[_0x4d7f('0x38')][_0x4d7f('0x3e')]));_0x2c5286[_0x4d7f('0x3d')]=_0x2c5286['attributes']['length']?_0x2c5286[_0x4d7f('0x3d')]:_0x38caa1[_0x4d7f('0x3c')];if(!_0x5110b1['query'][_0x4d7f('0x3f')]('nolimit')){_0x2c5286[_0x4d7f('0x23')]=qs['limit'](_0x5110b1[_0x4d7f('0x38')][_0x4d7f('0x23')]);_0x2c5286[_0x4d7f('0x21')]=qs[_0x4d7f('0x21')](_0x5110b1[_0x4d7f('0x38')][_0x4d7f('0x21')]);}_0x2c5286[_0x4d7f('0x40')]=qs[_0x4d7f('0x41')](_0x5110b1[_0x4d7f('0x38')][_0x4d7f('0x41')]);_0x2c5286[_0x4d7f('0x42')]=qs['filters'](_[_0x4d7f('0x43')](_0x5110b1[_0x4d7f('0x38')],_0x38caa1[_0x4d7f('0x3a')]),_0x1d6f5);if(_0x5110b1['query'][_0x4d7f('0x44')]){_0x2c5286[_0x4d7f('0x42')]=_['merge'](_0x2c5286['where'],{'$or':_[_0x4d7f('0x32')](_0x1d6f5,function(_0x36e657){if(_0x36e657[_0x4d7f('0x36')]!==_0x4d7f('0x45')){var _0x431a02={};_0x431a02[_0x36e657[_0x4d7f('0x2f')]]={'$like':'%'+_0x5110b1[_0x4d7f('0x38')][_0x4d7f('0x44')]+'%'};return _0x431a02;}})});}_0x2c5286=_['merge']({},_0x2c5286,_0x5110b1[_0x4d7f('0x46')]);var _0x1f26ae={'where':_0x2c5286[_0x4d7f('0x42')]};return db[_0x4d7f('0x33')][_0x4d7f('0x24')](_0x1f26ae)[_0x4d7f('0x2b')](function(_0x5fae9b){_0x33f315[_0x4d7f('0x24')]=_0x5fae9b;if(_0x5110b1[_0x4d7f('0x38')][_0x4d7f('0x47')]){_0x2c5286[_0x4d7f('0x48')]=[{'all':!![]}];}return db[_0x4d7f('0x33')]['findAll'](_0x2c5286);})['then'](function(_0x7808a0){_0x33f315[_0x4d7f('0x49')]=_0x7808a0;return _0x33f315;})[_0x4d7f('0x2b')](respondWithFilteredResult(_0x1afbe3,_0x2c5286))[_0x4d7f('0x4a')](handleError(_0x1afbe3,null));};exports[_0x4d7f('0x4b')]=function(_0x1e04af,_0x5e141b){var _0x3ca234={'raw':![],'where':{'id':_0x1e04af[_0x4d7f('0x4c')]['id']}},_0x12d96f={};_0x12d96f[_0x4d7f('0x3c')]=_[_0x4d7f('0x39')](db['VoiceQueueReport'][_0x4d7f('0x34')]);_0x12d96f['query']=_['keys'](_0x1e04af[_0x4d7f('0x38')]);_0x12d96f[_0x4d7f('0x3a')]=_[_0x4d7f('0x3b')](_0x12d96f[_0x4d7f('0x3c')],_0x12d96f[_0x4d7f('0x38')]);_0x3ca234[_0x4d7f('0x3d')]=_[_0x4d7f('0x3b')](_0x12d96f[_0x4d7f('0x3c')],qs['fields'](_0x1e04af['query']['fields']));_0x3ca234['attributes']=_0x3ca234[_0x4d7f('0x3d')][_0x4d7f('0x4d')]?_0x3ca234[_0x4d7f('0x3d')]:_0x12d96f[_0x4d7f('0x3c')];if(_0x1e04af['query'][_0x4d7f('0x47')]){_0x3ca234[_0x4d7f('0x48')]=[{'all':!![]}];}_0x3ca234=_[_0x4d7f('0x4e')]({},_0x3ca234,_0x1e04af[_0x4d7f('0x46')]);return db[_0x4d7f('0x33')]['find'](_0x3ca234)['then'](handleEntityNotFound(_0x5e141b,null))[_0x4d7f('0x2b')](respondWithResult(_0x5e141b,null))[_0x4d7f('0x4a')](handleError(_0x5e141b,null));};exports[_0x4d7f('0x4f')]=function(_0xb26bb7,_0x27f718){return db['VoiceQueueReport'][_0x4d7f('0x4f')](_0xb26bb7[_0x4d7f('0x50')],{})['then'](respondWithResult(_0x27f718,0xc9))[_0x4d7f('0x4a')](handleError(_0x27f718,null));};exports['update']=function(_0x2dae4d,_0x20e3de){if(_0x2dae4d[_0x4d7f('0x50')]['id']){delete _0x2dae4d[_0x4d7f('0x50')]['id'];}return db[_0x4d7f('0x33')][_0x4d7f('0x51')]({'where':{'id':_0x2dae4d[_0x4d7f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x20e3de,null))['then'](saveUpdates(_0x2dae4d[_0x4d7f('0x50')],null))['then'](respondWithResult(_0x20e3de,null))[_0x4d7f('0x4a')](handleError(_0x20e3de,null));};exports[_0x4d7f('0x2c')]=function(_0xfb3eb7,_0x4bd15a){return db['VoiceQueueReport'][_0x4d7f('0x51')]({'where':{'id':_0xfb3eb7[_0x4d7f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4bd15a,null))[_0x4d7f('0x2b')](removeEntity(_0x4bd15a,null))[_0x4d7f('0x4a')](handleError(_0x4bd15a,null));};exports[_0x4d7f('0x52')]=function(_0x3050df,_0x45917e){return db[_0x4d7f('0x33')][_0x4d7f('0x52')]()[_0x4d7f('0x2b')](respondWithResult(_0x45917e,null))[_0x4d7f('0x4a')](handleError(_0x45917e,null));};exports[_0x4d7f('0x53')]=function(_0x1d8f6c,_0x4d13e5){var _0x375067={},_0x3c4622={},_0x159c7c={'count':0x0,'rows':[]};_0x3c4622['model']=_['keys'](db[_0x4d7f('0x33')][_0x4d7f('0x34')]);_0x3c4622['query']=_['keys'](_0x1d8f6c['query']);_0x3c4622[_0x4d7f('0x3a')]=_['intersection'](_0x3c4622[_0x4d7f('0x3c')],_0x3c4622[_0x4d7f('0x38')]);_0x375067[_0x4d7f('0x3d')]=_[_0x4d7f('0x3b')](_0x3c4622[_0x4d7f('0x3c')],qs[_0x4d7f('0x3e')](_0x1d8f6c[_0x4d7f('0x38')][_0x4d7f('0x3e')]));_0x375067[_0x4d7f('0x3d')]=_0x375067['attributes'][_0x4d7f('0x4d')]?_0x375067[_0x4d7f('0x3d')]:_0x3c4622[_0x4d7f('0x3c')];if(!_0x1d8f6c[_0x4d7f('0x38')][_0x4d7f('0x3f')](_0x4d7f('0x54'))){_0x375067[_0x4d7f('0x23')]=qs[_0x4d7f('0x23')](_0x1d8f6c[_0x4d7f('0x38')][_0x4d7f('0x23')]);_0x375067['offset']=qs[_0x4d7f('0x21')](_0x1d8f6c[_0x4d7f('0x38')][_0x4d7f('0x21')]);}_0x375067['order']=qs[_0x4d7f('0x41')](_0x1d8f6c[_0x4d7f('0x38')][_0x4d7f('0x41')]);_0x375067[_0x4d7f('0x42')]=qs[_0x4d7f('0x3a')](_[_0x4d7f('0x43')](_0x1d8f6c[_0x4d7f('0x38')],_0x3c4622['filters']));if(_0x1d8f6c[_0x4d7f('0x38')][_0x4d7f('0x44')]){_0x375067[_0x4d7f('0x42')]=_[_0x4d7f('0x4e')](_0x375067[_0x4d7f('0x42')],{'$or':_['map'](_0x375067[_0x4d7f('0x3d')],function(_0x5726e1){var _0x31d37f={};_0x31d37f[_0x5726e1]={'$like':'%'+_0x1d8f6c[_0x4d7f('0x38')]['filter']+'%'};return _0x31d37f;})});}_0x375067=_['merge']({},_0x375067,_0x1d8f6c[_0x4d7f('0x46')]);var _0x28f91b={'where':_0x375067[_0x4d7f('0x42')]};return db['VoiceQueueReport'][_0x4d7f('0x24')](_0x28f91b)[_0x4d7f('0x2b')](function(_0x264cff){_0x159c7c[_0x4d7f('0x24')]=_0x264cff;if(_0x1d8f6c[_0x4d7f('0x38')]['includeAll']){_0x375067[_0x4d7f('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x4d7f('0x55')](_0x375067);})['then'](function(_0x5832be){_0x159c7c[_0x4d7f('0x49')]=_0x5832be;return _0x159c7c;})['then'](respondWithFilteredResult(_0x4d13e5,_0x375067,_0x4d7f('0x53')))[_0x4d7f('0x4a')](handleError(_0x4d13e5,null,_0x4d7f('0x53')));}; \ No newline at end of file +var _0xffb2=['pick','filter','where','merge','VIRTUAL','options','includeAll','show','params','rawAttributes','include','find','create','body','catch','describe','getVoiceQueuesReport','findAll','rows','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceQueueReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3dd92e,_0x163b49){var _0x17ff78=function(_0x12fb91){while(--_0x12fb91){_0x3dd92e['push'](_0x3dd92e['shift']());}};_0x17ff78(++_0x163b49);}(_0xffb2,0xc1));var _0x2ffb=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0xffb2[_0x593564];return _0x211a89;};'use strict';var emlformat=require(_0x2ffb('0x0'));var rimraf=require(_0x2ffb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ffb('0x2'));var rp=require(_0x2ffb('0x3'));var moment=require(_0x2ffb('0x4'));var BPromise=require(_0x2ffb('0x5'));var Mustache=require(_0x2ffb('0x6'));var util=require(_0x2ffb('0x7'));var path=require(_0x2ffb('0x8'));var sox=require(_0x2ffb('0x9'));var csv=require(_0x2ffb('0xa'));var ejs=require(_0x2ffb('0xb'));var fs=require('fs');var fs_extra=require(_0x2ffb('0xc'));var _=require(_0x2ffb('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2ffb('0xe'));var deskjs=require(_0x2ffb('0xf'));var toCsv=require(_0x2ffb('0xa'));var querystring=require(_0x2ffb('0x10'));var Papa=require(_0x2ffb('0x11'));var Redis=require(_0x2ffb('0x12'));var authService=require(_0x2ffb('0x13'));var qs=require(_0x2ffb('0x14'));var as=require(_0x2ffb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ffb('0x16'))(_0x2ffb('0x17'));var utils=require(_0x2ffb('0x18'));var config=require(_0x2ffb('0x19'));var licenseUtil=require(_0x2ffb('0x1a'));var db=require('../../mysqldb')['db'];config[_0x2ffb('0x1b')]=_[_0x2ffb('0x1c')](config['redis'],{'host':_0x2ffb('0x1d'),'port':0x18eb});var socket=require(_0x2ffb('0x1e'))(new Redis(config['redis']));require(_0x2ffb('0x1f'))['register'](socket);function respondWithStatusCode(_0x18a922,_0x167a7d){_0x167a7d=_0x167a7d||0xcc;return function(_0x280674){if(_0x280674){return _0x18a922[_0x2ffb('0x20')](_0x167a7d);}return _0x18a922[_0x2ffb('0x21')](_0x167a7d)[_0x2ffb('0x22')]();};}function respondWithResult(_0x4eaedb,_0x4dcf5e){_0x4dcf5e=_0x4dcf5e||0xc8;return function(_0x553873){if(_0x553873){return _0x4eaedb[_0x2ffb('0x21')](_0x4dcf5e)[_0x2ffb('0x23')](_0x553873);}};}function respondWithFilteredResult(_0x49a0b3,_0x49fe42){return function(_0x5f203f){if(_0x5f203f){var _0x2d3e8a=typeof _0x49fe42['offset']===_0x2ffb('0x24')&&typeof _0x49fe42[_0x2ffb('0x25')]===_0x2ffb('0x24');var _0x31f731=_0x5f203f['count'];var _0x41a4e2=_0x2d3e8a?0x0:_0x49fe42['offset'];var _0x55d0f8=_0x2d3e8a?_0x5f203f[_0x2ffb('0x26')]:_0x49fe42[_0x2ffb('0x27')]+_0x49fe42[_0x2ffb('0x25')];var _0x3d8368;if(_0x55d0f8>=_0x31f731){_0x55d0f8=_0x31f731;_0x3d8368=0xc8;}else{_0x3d8368=0xce;}_0x49a0b3[_0x2ffb('0x21')](_0x3d8368);return _0x49a0b3[_0x2ffb('0x28')]('Content-Range',_0x41a4e2+'-'+_0x55d0f8+'/'+_0x31f731)[_0x2ffb('0x23')](_0x5f203f);}return null;};}function patchUpdates(_0x167b7d){return function(_0x45c84c){try{jsonpatch[_0x2ffb('0x29')](_0x45c84c,_0x167b7d,!![]);}catch(_0x1d565f){return BPromise[_0x2ffb('0x2a')](_0x1d565f);}return _0x45c84c[_0x2ffb('0x2b')]();};}function saveUpdates(_0x1cd2fe,_0x3dba15){return function(_0x385d35){if(_0x385d35){return _0x385d35[_0x2ffb('0x2c')](_0x1cd2fe)[_0x2ffb('0x2d')](function(_0x1fec66){return _0x1fec66;});}return null;};}function removeEntity(_0x4c3f02,_0x3fd753){return function(_0xfe3876){if(_0xfe3876){return _0xfe3876[_0x2ffb('0x2e')]()[_0x2ffb('0x2d')](function(){_0x4c3f02['status'](0xcc)[_0x2ffb('0x22')]();});}};}function handleEntityNotFound(_0x41cf8d,_0x3ecc0c){return function(_0xf35654){if(!_0xf35654){_0x41cf8d[_0x2ffb('0x20')](0x194);}return _0xf35654;};}function handleError(_0x3022a5,_0x356425){_0x356425=_0x356425||0x1f4;return function(_0xf59f2f){logger[_0x2ffb('0x2f')](_0xf59f2f[_0x2ffb('0x30')]);if(_0xf59f2f[_0x2ffb('0x31')]){delete _0xf59f2f[_0x2ffb('0x31')];}_0x3022a5[_0x2ffb('0x21')](_0x356425)[_0x2ffb('0x32')](_0xf59f2f);};}exports['index']=function(_0x57a662,_0x494b74){var _0x434278={},_0xa4cee6={},_0x27a5ab={'count':0x0,'rows':[]};var _0x2a7b0c=_[_0x2ffb('0x33')](db[_0x2ffb('0x34')]['rawAttributes'],function(_0xa8d067){return{'name':_0xa8d067[_0x2ffb('0x35')],'type':_0xa8d067[_0x2ffb('0x36')][_0x2ffb('0x37')]};});_0xa4cee6['model']=_['map'](_0x2a7b0c,_0x2ffb('0x31'));_0xa4cee6[_0x2ffb('0x38')]=_[_0x2ffb('0x39')](_0x57a662[_0x2ffb('0x38')]);_0xa4cee6[_0x2ffb('0x3a')]=_[_0x2ffb('0x3b')](_0xa4cee6[_0x2ffb('0x3c')],_0xa4cee6['query']);_0x434278[_0x2ffb('0x3d')]=_['intersection'](_0xa4cee6[_0x2ffb('0x3c')],qs[_0x2ffb('0x3e')](_0x57a662['query']['fields']));_0x434278[_0x2ffb('0x3d')]=_0x434278[_0x2ffb('0x3d')][_0x2ffb('0x3f')]?_0x434278['attributes']:_0xa4cee6[_0x2ffb('0x3c')];if(!_0x57a662[_0x2ffb('0x38')][_0x2ffb('0x40')](_0x2ffb('0x41'))){_0x434278['limit']=qs[_0x2ffb('0x25')](_0x57a662['query'][_0x2ffb('0x25')]);_0x434278['offset']=qs[_0x2ffb('0x27')](_0x57a662[_0x2ffb('0x38')][_0x2ffb('0x27')]);}_0x434278[_0x2ffb('0x42')]=qs[_0x2ffb('0x43')](_0x57a662['query'][_0x2ffb('0x43')]);_0x434278['where']=qs[_0x2ffb('0x3a')](_[_0x2ffb('0x44')](_0x57a662[_0x2ffb('0x38')],_0xa4cee6[_0x2ffb('0x3a')]),_0x2a7b0c);if(_0x57a662[_0x2ffb('0x38')][_0x2ffb('0x45')]){_0x434278[_0x2ffb('0x46')]=_[_0x2ffb('0x47')](_0x434278['where'],{'$or':_['map'](_0x2a7b0c,function(_0x4be8cf){if(_0x4be8cf[_0x2ffb('0x36')]!==_0x2ffb('0x48')){var _0x3695fc={};_0x3695fc[_0x4be8cf[_0x2ffb('0x31')]]={'$like':'%'+_0x57a662[_0x2ffb('0x38')][_0x2ffb('0x45')]+'%'};return _0x3695fc;}})});}_0x434278=_[_0x2ffb('0x47')]({},_0x434278,_0x57a662[_0x2ffb('0x49')]);var _0x3bf476={'where':_0x434278['where']};return db[_0x2ffb('0x34')][_0x2ffb('0x26')](_0x3bf476)[_0x2ffb('0x2d')](function(_0x4612dc){_0x27a5ab[_0x2ffb('0x26')]=_0x4612dc;if(_0x57a662[_0x2ffb('0x38')][_0x2ffb('0x4a')]){_0x434278['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x434278);})[_0x2ffb('0x2d')](function(_0x24b8f7){_0x27a5ab['rows']=_0x24b8f7;return _0x27a5ab;})['then'](respondWithFilteredResult(_0x494b74,_0x434278))['catch'](handleError(_0x494b74,null));};exports[_0x2ffb('0x4b')]=function(_0x18ba81,_0x3d7c1c){var _0x169ba3={'raw':![],'where':{'id':_0x18ba81[_0x2ffb('0x4c')]['id']}},_0x37a2e3={};_0x37a2e3[_0x2ffb('0x3c')]=_['keys'](db[_0x2ffb('0x34')][_0x2ffb('0x4d')]);_0x37a2e3[_0x2ffb('0x38')]=_[_0x2ffb('0x39')](_0x18ba81[_0x2ffb('0x38')]);_0x37a2e3[_0x2ffb('0x3a')]=_['intersection'](_0x37a2e3[_0x2ffb('0x3c')],_0x37a2e3['query']);_0x169ba3[_0x2ffb('0x3d')]=_['intersection'](_0x37a2e3[_0x2ffb('0x3c')],qs[_0x2ffb('0x3e')](_0x18ba81[_0x2ffb('0x38')][_0x2ffb('0x3e')]));_0x169ba3[_0x2ffb('0x3d')]=_0x169ba3['attributes'][_0x2ffb('0x3f')]?_0x169ba3['attributes']:_0x37a2e3['model'];if(_0x18ba81[_0x2ffb('0x38')][_0x2ffb('0x4a')]){_0x169ba3[_0x2ffb('0x4e')]=[{'all':!![]}];}_0x169ba3=_[_0x2ffb('0x47')]({},_0x169ba3,_0x18ba81[_0x2ffb('0x49')]);return db['VoiceQueueReport'][_0x2ffb('0x4f')](_0x169ba3)['then'](handleEntityNotFound(_0x3d7c1c,null))[_0x2ffb('0x2d')](respondWithResult(_0x3d7c1c,null))['catch'](handleError(_0x3d7c1c,null));};exports[_0x2ffb('0x50')]=function(_0x5187a2,_0x47ac65){return db[_0x2ffb('0x34')][_0x2ffb('0x50')](_0x5187a2[_0x2ffb('0x51')],{})['then'](respondWithResult(_0x47ac65,0xc9))[_0x2ffb('0x52')](handleError(_0x47ac65,null));};exports[_0x2ffb('0x2c')]=function(_0x2e547b,_0x172ef6){if(_0x2e547b[_0x2ffb('0x51')]['id']){delete _0x2e547b[_0x2ffb('0x51')]['id'];}return db[_0x2ffb('0x34')][_0x2ffb('0x4f')]({'where':{'id':_0x2e547b['params']['id']}})[_0x2ffb('0x2d')](handleEntityNotFound(_0x172ef6,null))[_0x2ffb('0x2d')](saveUpdates(_0x2e547b[_0x2ffb('0x51')],null))[_0x2ffb('0x2d')](respondWithResult(_0x172ef6,null))[_0x2ffb('0x52')](handleError(_0x172ef6,null));};exports['destroy']=function(_0x27bba9,_0x585dda){return db[_0x2ffb('0x34')][_0x2ffb('0x4f')]({'where':{'id':_0x27bba9['params']['id']}})[_0x2ffb('0x2d')](handleEntityNotFound(_0x585dda,null))[_0x2ffb('0x2d')](removeEntity(_0x585dda,null))[_0x2ffb('0x52')](handleError(_0x585dda,null));};exports['describe']=function(_0x4a072c,_0x2b469a){return db[_0x2ffb('0x34')][_0x2ffb('0x53')]()[_0x2ffb('0x2d')](respondWithResult(_0x2b469a,null))[_0x2ffb('0x52')](handleError(_0x2b469a,null));};exports[_0x2ffb('0x54')]=function(_0x49e2b7,_0x3f61c5){var _0x586b20={},_0x128207={},_0x363b4a={'count':0x0,'rows':[]};_0x128207[_0x2ffb('0x3c')]=_['keys'](db[_0x2ffb('0x34')][_0x2ffb('0x4d')]);_0x128207[_0x2ffb('0x38')]=_['keys'](_0x49e2b7[_0x2ffb('0x38')]);_0x128207[_0x2ffb('0x3a')]=_[_0x2ffb('0x3b')](_0x128207[_0x2ffb('0x3c')],_0x128207['query']);_0x586b20[_0x2ffb('0x3d')]=_[_0x2ffb('0x3b')](_0x128207[_0x2ffb('0x3c')],qs['fields'](_0x49e2b7[_0x2ffb('0x38')][_0x2ffb('0x3e')]));_0x586b20['attributes']=_0x586b20[_0x2ffb('0x3d')][_0x2ffb('0x3f')]?_0x586b20['attributes']:_0x128207[_0x2ffb('0x3c')];if(!_0x49e2b7[_0x2ffb('0x38')][_0x2ffb('0x40')](_0x2ffb('0x41'))){_0x586b20[_0x2ffb('0x25')]=qs[_0x2ffb('0x25')](_0x49e2b7[_0x2ffb('0x38')][_0x2ffb('0x25')]);_0x586b20[_0x2ffb('0x27')]=qs[_0x2ffb('0x27')](_0x49e2b7[_0x2ffb('0x38')]['offset']);}_0x586b20[_0x2ffb('0x42')]=qs[_0x2ffb('0x43')](_0x49e2b7[_0x2ffb('0x38')][_0x2ffb('0x43')]);_0x586b20[_0x2ffb('0x46')]=qs['filters'](_[_0x2ffb('0x44')](_0x49e2b7[_0x2ffb('0x38')],_0x128207[_0x2ffb('0x3a')]));if(_0x49e2b7[_0x2ffb('0x38')][_0x2ffb('0x45')]){_0x586b20[_0x2ffb('0x46')]=_[_0x2ffb('0x47')](_0x586b20[_0x2ffb('0x46')],{'$or':_[_0x2ffb('0x33')](_0x586b20['attributes'],function(_0x3cafc9){var _0xd88418={};_0xd88418[_0x3cafc9]={'$like':'%'+_0x49e2b7[_0x2ffb('0x38')][_0x2ffb('0x45')]+'%'};return _0xd88418;})});}_0x586b20=_[_0x2ffb('0x47')]({},_0x586b20,_0x49e2b7[_0x2ffb('0x49')]);var _0x167423={'where':_0x586b20[_0x2ffb('0x46')]};return db[_0x2ffb('0x34')][_0x2ffb('0x26')](_0x167423)['then'](function(_0x3df016){_0x363b4a[_0x2ffb('0x26')]=_0x3df016;if(_0x49e2b7[_0x2ffb('0x38')]['includeAll']){_0x586b20[_0x2ffb('0x4e')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x2ffb('0x55')](_0x586b20);})[_0x2ffb('0x2d')](function(_0x3f65cf){_0x363b4a[_0x2ffb('0x56')]=_0x3f65cf;return _0x363b4a;})[_0x2ffb('0x2d')](respondWithFilteredResult(_0x3f61c5,_0x586b20,_0x2ffb('0x54')))['catch'](handleError(_0x3f61c5,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 dd8c900..37186a0 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 _0xdd60=['emit','hasOwnProperty','events','setMaxListeners','save','update','remove'];(function(_0x2b0d04,_0x51edc0){var _0x5a7203=function(_0x4fe0c9){while(--_0x4fe0c9){_0x2b0d04['push'](_0x2b0d04['shift']());}};_0x5a7203(++_0x51edc0);}(_0xdd60,0x64));var _0x0dd6=function(_0x44e6f7,_0x1cba6a){_0x44e6f7=_0x44e6f7-0x0;var _0x3fda57=_0xdd60[_0x44e6f7];return _0x3fda57;};'use strict';var EventEmitter=require(_0x0dd6('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x0dd6('0x1')](0x0);var events={'afterCreate':_0x0dd6('0x2'),'afterUpdate':_0x0dd6('0x3'),'afterDestroy':_0x0dd6('0x4')};function emitEvent(_0x393205){return function(_0xe40027,_0x537cc6,_0x2a62ae){VoiceQueueReportEvents[_0x0dd6('0x5')](_0x393205+':'+_0xe40027['id'],_0xe40027);VoiceQueueReportEvents[_0x0dd6('0x5')](_0x393205,_0xe40027);_0x2a62ae(null);};}for(var e in events){if(events[_0x0dd6('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xd29c=['setMaxListeners','update','remove','hasOwnProperty','exports','events','VoiceQueueReport'];(function(_0x3f341b,_0x4aba85){var _0x5b0950=function(_0x4ab48e){while(--_0x4ab48e){_0x3f341b['push'](_0x3f341b['shift']());}};_0x5b0950(++_0x4aba85);}(_0xd29c,0x7c));var _0xcd29=function(_0x13fdd6,_0xc9b988){_0x13fdd6=_0x13fdd6-0x0;var _0x3f3e33=_0xd29c[_0x13fdd6];return _0x3f3e33;};'use strict';var EventEmitter=require(_0xcd29('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xcd29('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xcd29('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcd29('0x3'),'afterDestroy':_0xcd29('0x4')};function emitEvent(_0x66980a){return function(_0x578733,_0x5ce891,_0x3b944d){VoiceQueueReportEvents['emit'](_0x66980a+':'+_0x578733['id'],_0x578733);VoiceQueueReportEvents['emit'](_0x66980a,_0x578733);_0x3b944d(null);};}for(var e in events){if(events[_0xcd29('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xcd29('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index c30f279..03ca102 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 _0x6754=['request-promise','path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x6db7c5,_0x107621){var _0x336c96=function(_0x34c804){while(--_0x34c804){_0x6db7c5['push'](_0x6db7c5['shift']());}};_0x336c96(++_0x107621);}(_0x6754,0x1ba));var _0x4675=function(_0x47cb6b,_0x32b8f5){_0x47cb6b=_0x47cb6b-0x0;var _0x3fcba4=_0x6754[_0x47cb6b];return _0x3fcba4;};'use strict';var _=require(_0x4675('0x0'));var util=require(_0x4675('0x1'));var logger=require(_0x4675('0x2'))(_0x4675('0x3'));var moment=require(_0x4675('0x4'));var BPromise=require(_0x4675('0x5'));var rp=require(_0x4675('0x6'));var fs=require('fs');var path=require(_0x4675('0x7'));var rimraf=require(_0x4675('0x8'));var config=require('../../config/environment');var attributes=require(_0x4675('0x9'));module[_0x4675('0xa')]=function(_0x546632,_0x6a27c8){return _0x546632[_0x4675('0xb')](_0x4675('0xc'),attributes,{'tableName':_0x4675('0xd'),'paranoid':![],'indexes':[{'fields':[_0x4675('0xe')]},{'fields':[_0x4675('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x87ee=['define','report_queue','uniqueid','calleridnum','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x1b65eb,_0x3f511f){var _0x33ff7b=function(_0x5ca09b){while(--_0x5ca09b){_0x1b65eb['push'](_0x1b65eb['shift']());}};_0x33ff7b(++_0x3f511f);}(_0x87ee,0x10e));var _0xe87e=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x87ee[_0x543084];return _0x306a57;};'use strict';var _=require(_0xe87e('0x0'));var util=require(_0xe87e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe87e('0x2'));var BPromise=require(_0xe87e('0x3'));var rp=require(_0xe87e('0x4'));var fs=require('fs');var path=require(_0xe87e('0x5'));var rimraf=require(_0xe87e('0x6'));var config=require(_0xe87e('0x7'));var attributes=require(_0xe87e('0x8'));module[_0xe87e('0x9')]=function(_0x5d5389,_0x2c9f29){return _0x5d5389[_0xe87e('0xa')]('VoiceQueueReport',attributes,{'tableName':_0xe87e('0xb'),'paranoid':![],'indexes':[{'fields':[_0xe87e('0xc')]},{'fields':[_0xe87e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index ba6deaf..dcd9e51 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 _0x70d2=['CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch'];(function(_0x4121cc,_0x3b5a38){var _0x25ec50=function(_0x185805){while(--_0x185805){_0x4121cc['push'](_0x4121cc['shift']());}};_0x25ec50(++_0x3b5a38);}(_0x70d2,0xac));var _0x270d=function(_0x353706,_0x382a63){_0x353706=_0x353706-0x0;var _0x281580=_0x70d2[_0x353706];return _0x281580;};'use strict';var _=require('lodash');var util=require(_0x270d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x270d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x270d('0x2'))['db'];var utils=require(_0x270d('0x3'));var logger=require(_0x270d('0x4'))(_0x270d('0x5'));var config=require(_0x270d('0x6'));var jayson=require(_0x270d('0x7'));var client=jayson['client'][_0x270d('0x8')]({'port':0x232a});config[_0x270d('0x9')]=_[_0x270d('0xa')](config[_0x270d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x270d('0xb'))(new Redis(config[_0x270d('0x9')]));require(_0x270d('0xc'))[_0x270d('0xd')](socket);function respondWithRpcPromise(_0x1ead32,_0x25d401,_0x37f5a2){return new BPromise(function(_0x52a7b5,_0x11a7e6){return client[_0x270d('0xe')](_0x1ead32,_0x37f5a2)[_0x270d('0xf')](function(_0x12e2b6){logger[_0x270d('0x10')](_0x270d('0x11'),_0x25d401,_0x270d('0x12'));logger[_0x270d('0x13')](_0x270d('0x14'),_0x25d401,'request\x20sent',JSON['stringify'](_0x12e2b6));if(_0x12e2b6[_0x270d('0x15')]){if(_0x12e2b6['error'][_0x270d('0x16')]===0x1f4){logger[_0x270d('0x15')](_0x270d('0x11'),_0x25d401,_0x12e2b6[_0x270d('0x15')]['message']);return _0x11a7e6(_0x12e2b6[_0x270d('0x15')][_0x270d('0x17')]);}logger[_0x270d('0x15')](_0x270d('0x11'),_0x25d401,_0x12e2b6['error'][_0x270d('0x17')]);return _0x52a7b5(_0x12e2b6[_0x270d('0x15')][_0x270d('0x17')]);}else{logger[_0x270d('0x10')](_0x270d('0x11'),_0x25d401,'request\x20sent');_0x52a7b5(_0x12e2b6[_0x270d('0x18')][_0x270d('0x17')]);}})['catch'](function(_0x576b99){logger[_0x270d('0x15')](_0x270d('0x11'),_0x25d401,_0x576b99);_0x11a7e6(_0x576b99);});});}exports[_0x270d('0x19')]=function(_0x237536){var _0xb9487a=this;return new Promise(function(_0x490d7e,_0x159d46){return db[_0x270d('0x1a')][_0x270d('0x1b')]({'raw':_0x237536[_0x270d('0x1c')]?_0x237536[_0x270d('0x1c')][_0x270d('0x1d')]===undefined?!![]:![]:!![],'where':_0x237536[_0x270d('0x1c')]?_0x237536['options'][_0x270d('0x1e')]||null:null,'attributes':_0x237536[_0x270d('0x1c')]?_0x237536[_0x270d('0x1c')][_0x270d('0x1f')]||null:null,'limit':_0x237536[_0x270d('0x1c')]?_0x237536[_0x270d('0x1c')][_0x270d('0x20')]||null:null,'include':_0x237536[_0x270d('0x1c')]?_0x237536[_0x270d('0x1c')]['include']?_[_0x270d('0x21')](_0x237536[_0x270d('0x1c')][_0x270d('0x22')],function(_0x3f8868){return{'model':db[_0x3f8868[_0x270d('0x23')]],'as':_0x3f8868['as'],'attributes':_0x3f8868[_0x270d('0x1f')],'include':_0x3f8868[_0x270d('0x22')]?_[_0x270d('0x21')](_0x3f8868[_0x270d('0x22')],function(_0x4115cc){return{'model':db[_0x4115cc[_0x270d('0x23')]],'as':_0x4115cc['as'],'attributes':_0x4115cc['attributes'],'include':_0x4115cc[_0x270d('0x22')]?_[_0x270d('0x21')](_0x4115cc[_0x270d('0x22')],function(_0x3b991d){return{'model':db[_0x3b991d[_0x270d('0x23')]],'as':_0x3b991d['as'],'attributes':_0x3b991d[_0x270d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x270d('0xf')](function(_0x25dc43){logger[_0x270d('0x10')](_0x270d('0x19'),_0x237536);logger[_0x270d('0x13')](_0x270d('0x19'),_0x237536,JSON[_0x270d('0x24')](_0x25dc43));_0x490d7e(_0x25dc43);})[_0x270d('0x25')](function(_0x376293){logger[_0x270d('0x15')](_0x270d('0x19'),_0x376293[_0x270d('0x17')],_0x237536);_0x159d46(_0xb9487a[_0x270d('0x15')](0x1f4,_0x376293[_0x270d('0x17')]));});});};exports[_0x270d('0x26')]=function(_0x4bc63a){var _0x120f35=this;return new Promise(function(_0x518dd2,_0x368e7a){return db[_0x270d('0x1a')]['create'](_0x4bc63a[_0x270d('0x27')],{'raw':_0x4bc63a[_0x270d('0x1c')]?_0x4bc63a[_0x270d('0x1c')][_0x270d('0x1d')]===undefined?!![]:![]:!![]})[_0x270d('0xf')](function(_0x5c3215){logger[_0x270d('0x10')](_0x270d('0x26'),_0x4bc63a);logger[_0x270d('0x13')](_0x270d('0x26'),_0x4bc63a,JSON[_0x270d('0x24')](_0x5c3215));_0x518dd2(_0x5c3215);})[_0x270d('0x25')](function(_0x4e2cef){logger[_0x270d('0x15')](_0x270d('0x26'),_0x4e2cef[_0x270d('0x17')],_0x4bc63a);_0x368e7a(_0x120f35[_0x270d('0x15')](0x1f4,_0x4e2cef['message']));});});};exports[_0x270d('0x28')]=function(_0x3cd748){var _0x51b204=this;return new Promise(function(_0x498fe7,_0x381fc6){return db[_0x270d('0x1a')][_0x270d('0x29')](_0x3cd748[_0x270d('0x27')],{'raw':_0x3cd748[_0x270d('0x1c')]?_0x3cd748[_0x270d('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cd748[_0x270d('0x1c')]?_0x3cd748[_0x270d('0x1c')][_0x270d('0x1e')]||null:null,'attributes':_0x3cd748[_0x270d('0x1c')]?_0x3cd748[_0x270d('0x1c')][_0x270d('0x1f')]||null:null,'limit':_0x3cd748[_0x270d('0x1c')]?_0x3cd748[_0x270d('0x1c')][_0x270d('0x20')]||null:null})['then'](function(_0x12969c){logger[_0x270d('0x10')](_0x270d('0x28'),_0x3cd748);logger[_0x270d('0x13')](_0x270d('0x28'),_0x3cd748,JSON['stringify'](_0x12969c));_0x498fe7(_0x12969c);})[_0x270d('0x25')](function(_0x4c7f46){logger[_0x270d('0x15')](_0x270d('0x28'),_0x4c7f46[_0x270d('0x17')],_0x3cd748);_0x381fc6(_0x51b204[_0x270d('0x15')](0x1f4,_0x4c7f46[_0x270d('0x17')]));});});}; \ No newline at end of file +var _0xa3be=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','./voiceQueueReport.socket','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','raw','options','include','map','model','attributes','stringify','CreateVoiceQueueReport','create','then','UpdateVoiceQueueReport','where','limit','lodash','util','randomstring','ioredis'];(function(_0x373b3e,_0x347ac7){var _0xa4ce3=function(_0x5ab1ac){while(--_0x5ab1ac){_0x373b3e['push'](_0x373b3e['shift']());}};_0xa4ce3(++_0x347ac7);}(_0xa3be,0x94));var _0xea3b=function(_0x12397d,_0x2b8449){_0x12397d=_0x12397d-0x0;var _0xd77393=_0xa3be[_0x12397d];return _0xd77393;};'use strict';var _=require(_0xea3b('0x0'));var util=require(_0xea3b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xea3b('0x2'));var fs=require('fs');var Redis=require(_0xea3b('0x3'));var db=require(_0xea3b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xea3b('0x5'))('rpc');var config=require(_0xea3b('0x6'));var jayson=require(_0xea3b('0x7'));var client=jayson['client'][_0xea3b('0x8')]({'port':0x232a});config[_0xea3b('0x9')]=_['defaults'](config['redis'],{'host':_0xea3b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea3b('0x9')]));require(_0xea3b('0xb'))['register'](socket);function respondWithRpcPromise(_0x194c6d,_0x482de6,_0x5dc077){return new BPromise(function(_0x218bfe,_0x5d318a){return client['request'](_0x194c6d,_0x5dc077)['then'](function(_0x10e26d){logger[_0xea3b('0xc')]('VoiceQueueReport,\x20%s,\x20%s',_0x482de6,_0xea3b('0xd'));logger[_0xea3b('0xe')](_0xea3b('0xf'),_0x482de6,'request\x20sent',JSON['stringify'](_0x10e26d));if(_0x10e26d[_0xea3b('0x10')]){if(_0x10e26d[_0xea3b('0x10')][_0xea3b('0x11')]===0x1f4){logger[_0xea3b('0x10')](_0xea3b('0x12'),_0x482de6,_0x10e26d[_0xea3b('0x10')][_0xea3b('0x13')]);return _0x5d318a(_0x10e26d['error'][_0xea3b('0x13')]);}logger[_0xea3b('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x482de6,_0x10e26d[_0xea3b('0x10')][_0xea3b('0x13')]);return _0x218bfe(_0x10e26d['error'][_0xea3b('0x13')]);}else{logger[_0xea3b('0xc')]('VoiceQueueReport,\x20%s,\x20%s',_0x482de6,_0xea3b('0xd'));_0x218bfe(_0x10e26d[_0xea3b('0x14')]['message']);}})[_0xea3b('0x15')](function(_0x2a2565){logger[_0xea3b('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x482de6,_0x2a2565);_0x5d318a(_0x2a2565);});});}exports[_0xea3b('0x16')]=function(_0x301cb0){var _0x291ac0=this;return new Promise(function(_0x271e23,_0xa80d45){return db[_0xea3b('0x17')][_0xea3b('0x18')]({'raw':_0x301cb0['options']?_0x301cb0['options'][_0xea3b('0x19')]===undefined?!![]:![]:!![],'where':_0x301cb0[_0xea3b('0x1a')]?_0x301cb0[_0xea3b('0x1a')]['where']||null:null,'attributes':_0x301cb0[_0xea3b('0x1a')]?_0x301cb0['options']['attributes']||null:null,'limit':_0x301cb0[_0xea3b('0x1a')]?_0x301cb0[_0xea3b('0x1a')]['limit']||null:null,'include':_0x301cb0[_0xea3b('0x1a')]?_0x301cb0[_0xea3b('0x1a')][_0xea3b('0x1b')]?_[_0xea3b('0x1c')](_0x301cb0[_0xea3b('0x1a')]['include'],function(_0x4ce30d){return{'model':db[_0x4ce30d[_0xea3b('0x1d')]],'as':_0x4ce30d['as'],'attributes':_0x4ce30d[_0xea3b('0x1e')],'include':_0x4ce30d[_0xea3b('0x1b')]?_[_0xea3b('0x1c')](_0x4ce30d[_0xea3b('0x1b')],function(_0x541cdc){return{'model':db[_0x541cdc[_0xea3b('0x1d')]],'as':_0x541cdc['as'],'attributes':_0x541cdc[_0xea3b('0x1e')],'include':_0x541cdc[_0xea3b('0x1b')]?_[_0xea3b('0x1c')](_0x541cdc['include'],function(_0x6e7e5){return{'model':db[_0x6e7e5['model']],'as':_0x6e7e5['as'],'attributes':_0x6e7e5[_0xea3b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26146b){logger[_0xea3b('0xc')]('GetVoiceQueueReport',_0x301cb0);logger['debug']('GetVoiceQueueReport',_0x301cb0,JSON[_0xea3b('0x1f')](_0x26146b));_0x271e23(_0x26146b);})[_0xea3b('0x15')](function(_0x17d0d2){logger[_0xea3b('0x10')]('GetVoiceQueueReport',_0x17d0d2[_0xea3b('0x13')],_0x301cb0);_0xa80d45(_0x291ac0[_0xea3b('0x10')](0x1f4,_0x17d0d2['message']));});});};exports[_0xea3b('0x20')]=function(_0x16c1f2){var _0x1d68dc=this;return new Promise(function(_0x4a416c,_0x12b823){return db[_0xea3b('0x17')][_0xea3b('0x21')](_0x16c1f2['body'],{'raw':_0x16c1f2[_0xea3b('0x1a')]?_0x16c1f2['options']['raw']===undefined?!![]:![]:!![]})[_0xea3b('0x22')](function(_0x1924bc){logger['info'](_0xea3b('0x20'),_0x16c1f2);logger[_0xea3b('0xe')]('CreateVoiceQueueReport',_0x16c1f2,JSON[_0xea3b('0x1f')](_0x1924bc));_0x4a416c(_0x1924bc);})[_0xea3b('0x15')](function(_0x48b367){logger[_0xea3b('0x10')](_0xea3b('0x20'),_0x48b367['message'],_0x16c1f2);_0x12b823(_0x1d68dc[_0xea3b('0x10')](0x1f4,_0x48b367[_0xea3b('0x13')]));});});};exports[_0xea3b('0x23')]=function(_0x3b9702){var _0x2b5f02=this;return new Promise(function(_0x114115,_0x3942e1){return db[_0xea3b('0x17')]['update'](_0x3b9702['body'],{'raw':_0x3b9702[_0xea3b('0x1a')]?_0x3b9702[_0xea3b('0x1a')][_0xea3b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b9702[_0xea3b('0x1a')]?_0x3b9702[_0xea3b('0x1a')][_0xea3b('0x24')]||null:null,'attributes':_0x3b9702[_0xea3b('0x1a')]?_0x3b9702[_0xea3b('0x1a')]['attributes']||null:null,'limit':_0x3b9702[_0xea3b('0x1a')]?_0x3b9702[_0xea3b('0x1a')][_0xea3b('0x25')]||null:null})[_0xea3b('0x22')](function(_0xd32be){logger[_0xea3b('0xc')](_0xea3b('0x23'),_0x3b9702);logger[_0xea3b('0xe')](_0xea3b('0x23'),_0x3b9702,JSON[_0xea3b('0x1f')](_0xd32be));_0x114115(_0xd32be);})[_0xea3b('0x15')](function(_0x1707b3){logger[_0xea3b('0x10')](_0xea3b('0x23'),_0x1707b3[_0xea3b('0x13')],_0x3b9702);_0x3942e1(_0x2b5f02[_0xea3b('0x10')](0x1f4,_0x1707b3[_0xea3b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index da02548..fe7702a 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 _0x74eb=['./voiceQueueReport.events','save','remove','emit','register'];(function(_0x11b812,_0x5d1820){var _0x430554=function(_0xf3e5f8){while(--_0xf3e5f8){_0x11b812['push'](_0x11b812['shift']());}};_0x430554(++_0x5d1820);}(_0x74eb,0x13b));var _0xb74e=function(_0x227b71,_0x541ac8){_0x227b71=_0x227b71-0x0;var _0x1de72a=_0x74eb[_0x227b71];return _0x1de72a;};'use strict';var VoiceQueueReportEvents=require(_0xb74e('0x0'));var events=[_0xb74e('0x1'),_0xb74e('0x2'),'update'];function createListener(_0x16f1d5,_0x228930){return function(_0x466de6){_0x228930[_0xb74e('0x3')](_0x16f1d5,_0x466de6);};}function removeListener(_0x11701d,_0x459811){return function(){VoiceQueueReportEvents['removeListener'](_0x11701d,_0x459811);};}exports[_0xb74e('0x4')]=function(_0x4f49f9){for(var _0x329dc1=0x0,_0x4307f8=events['length'];_0x329dc1<_0x4307f8;_0x329dc1++){var _0x2d0773=events[_0x329dc1];var _0x56483b=createListener('voiceQueueReport:'+_0x2d0773,_0x4f49f9);VoiceQueueReportEvents['on'](_0x2d0773,_0x56483b);}}; \ No newline at end of file +var _0x9ec3=['voiceQueueReport:','./voiceQueueReport.events','save','emit','removeListener','register'];(function(_0xe6ce24,_0x51e66f){var _0x927bad=function(_0x5d4764){while(--_0x5d4764){_0xe6ce24['push'](_0xe6ce24['shift']());}};_0x927bad(++_0x51e66f);}(_0x9ec3,0xcd));var _0x39ec=function(_0xbdf03f,_0x595215){_0xbdf03f=_0xbdf03f-0x0;var _0x2bbe9e=_0x9ec3[_0xbdf03f];return _0x2bbe9e;};'use strict';var VoiceQueueReportEvents=require(_0x39ec('0x0'));var events=[_0x39ec('0x1'),'remove','update'];function createListener(_0x3295d1,_0x49c92a){return function(_0x388a9d){_0x49c92a[_0x39ec('0x2')](_0x3295d1,_0x388a9d);};}function removeListener(_0x3ef850,_0x2e696d){return function(){VoiceQueueReportEvents[_0x39ec('0x3')](_0x3ef850,_0x2e696d);};}exports[_0x39ec('0x4')]=function(_0x261dca){for(var _0x23b448=0x0,_0x58db37=events['length'];_0x23b448<_0x58db37;_0x23b448++){var _0x1ea981=events[_0x23b448];var _0x482679=createListener(_0x39ec('0x5')+_0x1ea981,_0x261dca);VoiceQueueReportEvents['on'](_0x1ea981,_0x482679);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 5e2d897..42fbb7b 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 _0x89b9=['get','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller'];(function(_0x1b7fcc,_0x3dc7f0){var _0x5e520c=function(_0x1e600a){while(--_0x1e600a){_0x1b7fcc['push'](_0x1b7fcc['shift']());}};_0x5e520c(++_0x3dc7f0);}(_0x89b9,0x17a));var _0x989b=function(_0x2c9665,_0x40698d){_0x2c9665=_0x2c9665-0x0;var _0x5b81e0=_0x89b9[_0x2c9665];return _0x5b81e0;};'use strict';var multer=require(_0x989b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x989b('0x1')]();var fs_extra=require(_0x989b('0x2'));var auth=require(_0x989b('0x3'));var interaction=require(_0x989b('0x4'));var config=require('../../config/environment');var controller=require(_0x989b('0x5'));router[_0x989b('0x6')]('/',auth[_0x989b('0x7')](),controller['index']);router[_0x989b('0x6')]('/:id',auth[_0x989b('0x7')](),controller[_0x989b('0x8')]);router[_0x989b('0x9')]('/',auth[_0x989b('0x7')](),controller[_0x989b('0xa')]);router[_0x989b('0xb')](_0x989b('0xc'),auth[_0x989b('0x7')](),controller[_0x989b('0xd')]);router['delete'](_0x989b('0xc'),auth[_0x989b('0x7')](),controller[_0x989b('0xe')]);module[_0x989b('0xf')]=router; \ No newline at end of file +var _0xabbe=['index','/:id','show','post','update','destroy','exports','multer','path','express','Router','fs-extra','../../config/environment','./voiceQueuesLog.controller','isAuthenticated'];(function(_0x366bf9,_0xc18730){var _0x1b72a4=function(_0x4ddd3f){while(--_0x4ddd3f){_0x366bf9['push'](_0x366bf9['shift']());}};_0x1b72a4(++_0xc18730);}(_0xabbe,0x70));var _0xeabb=function(_0x4b2f71,_0x3cb802){_0x4b2f71=_0x4b2f71-0x0;var _0x2ec388=_0xabbe[_0x4b2f71];return _0x2ec388;};'use strict';var multer=require(_0xeabb('0x0'));var util=require('util');var path=require(_0xeabb('0x1'));var timeout=require('connect-timeout');var express=require(_0xeabb('0x2'));var router=express[_0xeabb('0x3')]();var fs_extra=require(_0xeabb('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xeabb('0x5'));var controller=require(_0xeabb('0x6'));router['get']('/',auth[_0xeabb('0x7')](),controller[_0xeabb('0x8')]);router['get'](_0xeabb('0x9'),auth[_0xeabb('0x7')](),controller[_0xeabb('0xa')]);router[_0xeabb('0xb')]('/',auth[_0xeabb('0x7')](),controller['create']);router['put'](_0xeabb('0x9'),auth[_0xeabb('0x7')](),controller[_0xeabb('0xc')]);router['delete'](_0xeabb('0x9'),auth[_0xeabb('0x7')](),controller[_0xeabb('0xd')]);module[_0xeabb('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 9cfd9cd..0f56519 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 _0x3432=['format','moment','STRING','DATE'];(function(_0x21ba39,_0x413046){var _0x7a1e4f=function(_0x734831){while(--_0x734831){_0x21ba39['push'](_0x21ba39['shift']());}};_0x7a1e4f(++_0x413046);}(_0x3432,0x199));var _0x2343=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3432[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2343('0x0'));module['exports']={'time':{'type':Sequelize[_0x2343('0x1')]},'callid':{'type':Sequelize[_0x2343('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x2343('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x2343('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x2343('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x2343('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x2343('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x2343('0x2')],'allowNull':![],'defaultValue':moment()[_0x2343('0x3')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xb164=['format','YYYY-MM-DD\x20HH:mm:ss','exports','STRING','DATE'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xb164,0x188));var _0x4b16=function(_0x47f8b4,_0xd80692){_0x47f8b4=_0x47f8b4-0x0;var _0x1b62de=_0xb164[_0x47f8b4];return _0x1b62de;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x4b16('0x0')]={'time':{'type':Sequelize[_0x4b16('0x1')]},'callid':{'type':Sequelize[_0x4b16('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4b16('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x4b16('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x4b16('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4b16('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4b16('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4b16('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4b16('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x4b16('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4b16('0x2')],'allowNull':![],'defaultValue':moment()[_0x4b16('0x3')](_0x4b16('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 7cc54b5..03513ed 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 _0xc0ea=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','index','map','VoiceQueuesLog','type','key','model','name','query','filters','intersection','attributes','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x4926e3,_0xef6fc8){var _0x429a68=function(_0x40339d){while(--_0x40339d){_0x4926e3['push'](_0x4926e3['shift']());}};_0x429a68(++_0xef6fc8);}(_0xc0ea,0x11b));var _0xac0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc0ea[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xac0e('0x0'));var rimraf=require(_0xac0e('0x1'));var zipdir=require(_0xac0e('0x2'));var jsonpatch=require(_0xac0e('0x3'));var rp=require('request-promise');var moment=require(_0xac0e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xac0e('0x5'));var util=require(_0xac0e('0x6'));var path=require(_0xac0e('0x7'));var sox=require(_0xac0e('0x8'));var csv=require(_0xac0e('0x9'));var ejs=require(_0xac0e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac0e('0xb'));var squel=require(_0xac0e('0xc'));var crypto=require(_0xac0e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xac0e('0xe'));var Papa=require(_0xac0e('0xf'));var Redis=require(_0xac0e('0x10'));var authService=require(_0xac0e('0x11'));var qs=require(_0xac0e('0x12'));var as=require(_0xac0e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac0e('0x14'))(_0xac0e('0x15'));var utils=require(_0xac0e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xac0e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31f185,_0x5036f2){_0x5036f2=_0x5036f2||0xcc;return function(_0xf26b42){if(_0xf26b42){return _0x31f185[_0xac0e('0x18')](_0x5036f2);}return _0x31f185[_0xac0e('0x19')](_0x5036f2)['end']();};}function respondWithResult(_0x256876,_0x4a23ff){_0x4a23ff=_0x4a23ff||0xc8;return function(_0x44ed17){if(_0x44ed17){return _0x256876[_0xac0e('0x19')](_0x4a23ff)[_0xac0e('0x1a')](_0x44ed17);}};}function respondWithFilteredResult(_0x3f4094,_0x2e8d11){return function(_0xde1cfb){if(_0xde1cfb){var _0x544162=typeof _0x2e8d11[_0xac0e('0x1b')]===_0xac0e('0x1c')&&typeof _0x2e8d11[_0xac0e('0x1d')]===_0xac0e('0x1c');var _0x330f7f=_0xde1cfb['count'];var _0x32bbae=_0x544162?0x0:_0x2e8d11[_0xac0e('0x1b')];var _0x1ca86b=_0x544162?_0xde1cfb[_0xac0e('0x1e')]:_0x2e8d11[_0xac0e('0x1b')]+_0x2e8d11['limit'];var _0x1a2f34;if(_0x1ca86b>=_0x330f7f){_0x1ca86b=_0x330f7f;_0x1a2f34=0xc8;}else{_0x1a2f34=0xce;}_0x3f4094['status'](_0x1a2f34);return _0x3f4094[_0xac0e('0x1f')](_0xac0e('0x20'),_0x32bbae+'-'+_0x1ca86b+'/'+_0x330f7f)[_0xac0e('0x1a')](_0xde1cfb);}return null;};}function patchUpdates(_0x55a2dc){return function(_0x3e58d1){try{jsonpatch[_0xac0e('0x21')](_0x3e58d1,_0x55a2dc,!![]);}catch(_0x1e3a12){return BPromise[_0xac0e('0x22')](_0x1e3a12);}return _0x3e58d1[_0xac0e('0x23')]();};}function saveUpdates(_0x1d45b1,_0x50e83c){return function(_0x4c05bd){if(_0x4c05bd){return _0x4c05bd[_0xac0e('0x24')](_0x1d45b1)[_0xac0e('0x25')](function(_0x2c3bfa){return _0x2c3bfa;});}return null;};}function removeEntity(_0x1419f4,_0x540a2a){return function(_0x143b54){if(_0x143b54){return _0x143b54[_0xac0e('0x26')]()['then'](function(){_0x1419f4['status'](0xcc)[_0xac0e('0x27')]();});}};}function handleEntityNotFound(_0x21fd7c,_0x28af6c){return function(_0x550f65){if(!_0x550f65){_0x21fd7c['sendStatus'](0x194);}return _0x550f65;};}function handleError(_0xdc02c2,_0xccc752){_0xccc752=_0xccc752||0x1f4;return function(_0x499826){logger['error'](_0x499826[_0xac0e('0x28')]);if(_0x499826['name']){delete _0x499826['name'];}_0xdc02c2[_0xac0e('0x19')](_0xccc752)['send'](_0x499826);};}exports[_0xac0e('0x29')]=function(_0x4472c4,_0x4ba8e0){var _0x343845={},_0x111e64={},_0x5038ad={'count':0x0,'rows':[]};var _0x50fa7b=_[_0xac0e('0x2a')](db[_0xac0e('0x2b')]['rawAttributes'],function(_0x593580){return{'name':_0x593580['fieldName'],'type':_0x593580[_0xac0e('0x2c')][_0xac0e('0x2d')]};});_0x111e64[_0xac0e('0x2e')]=_[_0xac0e('0x2a')](_0x50fa7b,_0xac0e('0x2f'));_0x111e64['query']=_['keys'](_0x4472c4[_0xac0e('0x30')]);_0x111e64[_0xac0e('0x31')]=_[_0xac0e('0x32')](_0x111e64['model'],_0x111e64['query']);_0x343845[_0xac0e('0x33')]=_[_0xac0e('0x32')](_0x111e64[_0xac0e('0x2e')],qs['fields'](_0x4472c4[_0xac0e('0x30')]['fields']));_0x343845['attributes']=_0x343845[_0xac0e('0x33')]['length']?_0x343845['attributes']:_0x111e64[_0xac0e('0x2e')];if(!_0x4472c4['query']['hasOwnProperty'](_0xac0e('0x34'))){_0x343845[_0xac0e('0x1d')]=qs['limit'](_0x4472c4[_0xac0e('0x30')][_0xac0e('0x1d')]);_0x343845['offset']=qs['offset'](_0x4472c4[_0xac0e('0x30')][_0xac0e('0x1b')]);}_0x343845[_0xac0e('0x35')]=qs['sort'](_0x4472c4[_0xac0e('0x30')][_0xac0e('0x36')]);_0x343845['where']=qs[_0xac0e('0x31')](_[_0xac0e('0x37')](_0x4472c4[_0xac0e('0x30')],_0x111e64[_0xac0e('0x31')]),_0x50fa7b);if(_0x4472c4[_0xac0e('0x30')][_0xac0e('0x38')]){_0x343845[_0xac0e('0x39')]=_['merge'](_0x343845['where'],{'$or':_[_0xac0e('0x2a')](_0x50fa7b,function(_0x3de693){if(_0x3de693['type']!==_0xac0e('0x3a')){var _0x45a6ec={};_0x45a6ec[_0x3de693[_0xac0e('0x2f')]]={'$like':'%'+_0x4472c4[_0xac0e('0x30')][_0xac0e('0x38')]+'%'};return _0x45a6ec;}})});}_0x343845=_['merge']({},_0x343845,_0x4472c4[_0xac0e('0x3b')]);var _0x55da03={'where':_0x343845[_0xac0e('0x39')]};return db[_0xac0e('0x2b')][_0xac0e('0x1e')](_0x55da03)[_0xac0e('0x25')](function(_0x39a910){_0x5038ad[_0xac0e('0x1e')]=_0x39a910;if(_0x4472c4[_0xac0e('0x30')][_0xac0e('0x3c')]){_0x343845[_0xac0e('0x3d')]=[{'all':!![]}];}return db[_0xac0e('0x2b')]['findAll'](_0x343845);})[_0xac0e('0x25')](function(_0x24463f){_0x5038ad[_0xac0e('0x3e')]=_0x24463f;return _0x5038ad;})['then'](respondWithFilteredResult(_0x4ba8e0,_0x343845))[_0xac0e('0x3f')](handleError(_0x4ba8e0,null));};exports[_0xac0e('0x40')]=function(_0x2e9cb1,_0x3ef877){var _0x5efd2f={'raw':!![],'where':{'id':_0x2e9cb1[_0xac0e('0x41')]['id']}},_0x175ec3={};_0x175ec3['model']=_[_0xac0e('0x42')](db['VoiceQueuesLog'][_0xac0e('0x43')]);_0x175ec3['query']=_['keys'](_0x2e9cb1[_0xac0e('0x30')]);_0x175ec3['filters']=_[_0xac0e('0x32')](_0x175ec3[_0xac0e('0x2e')],_0x175ec3[_0xac0e('0x30')]);_0x5efd2f[_0xac0e('0x33')]=_[_0xac0e('0x32')](_0x175ec3[_0xac0e('0x2e')],qs['fields'](_0x2e9cb1[_0xac0e('0x30')]['fields']));_0x5efd2f[_0xac0e('0x33')]=_0x5efd2f['attributes'][_0xac0e('0x44')]?_0x5efd2f[_0xac0e('0x33')]:_0x175ec3['model'];if(_0x2e9cb1['query'][_0xac0e('0x3c')]){_0x5efd2f['include']=[{'all':!![]}];}_0x5efd2f=_['merge']({},_0x5efd2f,_0x2e9cb1[_0xac0e('0x3b')]);return db['VoiceQueuesLog'][_0xac0e('0x45')](_0x5efd2f)[_0xac0e('0x25')](handleEntityNotFound(_0x3ef877,null))[_0xac0e('0x25')](respondWithResult(_0x3ef877,null))[_0xac0e('0x3f')](handleError(_0x3ef877,null));};exports[_0xac0e('0x46')]=function(_0x24af9e,_0x5ea71c){return db[_0xac0e('0x2b')][_0xac0e('0x46')](_0x24af9e[_0xac0e('0x47')],{})[_0xac0e('0x25')](respondWithResult(_0x5ea71c,0xc9))[_0xac0e('0x3f')](handleError(_0x5ea71c,null));};exports[_0xac0e('0x24')]=function(_0xffaa69,_0x125d7a){if(_0xffaa69[_0xac0e('0x47')]['id']){delete _0xffaa69[_0xac0e('0x47')]['id'];}return db['VoiceQueuesLog'][_0xac0e('0x45')]({'where':{'id':_0xffaa69['params']['id']}})[_0xac0e('0x25')](handleEntityNotFound(_0x125d7a,null))[_0xac0e('0x25')](saveUpdates(_0xffaa69[_0xac0e('0x47')],null))['then'](respondWithResult(_0x125d7a,null))['catch'](handleError(_0x125d7a,null));};exports[_0xac0e('0x26')]=function(_0x318968,_0x5e65b5){return db['VoiceQueuesLog'][_0xac0e('0x45')]({'where':{'id':_0x318968['params']['id']}})[_0xac0e('0x25')](handleEntityNotFound(_0x5e65b5,null))['then'](removeEntity(_0x5e65b5,null))[_0xac0e('0x3f')](handleError(_0x5e65b5,null));}; \ No newline at end of file +var _0x3bfe=['stack','name','send','VoiceQueuesLog','rawAttributes','type','key','map','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','count','limit','apply','reject','save','update','then','destroy','end','error'];(function(_0x44e8f1,_0xc171a5){var _0x4dc7b0=function(_0x2218f5){while(--_0x2218f5){_0x44e8f1['push'](_0x44e8f1['shift']());}};_0x4dc7b0(++_0xc171a5);}(_0x3bfe,0xb8));var _0xe3bf=function(_0x50c103,_0x15347c){_0x50c103=_0x50c103-0x0;var _0x41b2ce=_0x3bfe[_0x50c103];return _0x41b2ce;};'use strict';var emlformat=require(_0xe3bf('0x0'));var rimraf=require(_0xe3bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe3bf('0x2'));var rp=require(_0xe3bf('0x3'));var moment=require(_0xe3bf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe3bf('0x5'));var util=require(_0xe3bf('0x6'));var path=require(_0xe3bf('0x7'));var sox=require(_0xe3bf('0x8'));var csv=require(_0xe3bf('0x9'));var ejs=require(_0xe3bf('0xa'));var fs=require('fs');var fs_extra=require(_0xe3bf('0xb'));var _=require(_0xe3bf('0xc'));var squel=require(_0xe3bf('0xd'));var crypto=require(_0xe3bf('0xe'));var jsforce=require(_0xe3bf('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe3bf('0x9'));var querystring=require(_0xe3bf('0x10'));var Papa=require(_0xe3bf('0x11'));var Redis=require(_0xe3bf('0x12'));var authService=require(_0xe3bf('0x13'));var qs=require(_0xe3bf('0x14'));var as=require(_0xe3bf('0x15'));var hardwareService=require(_0xe3bf('0x16'));var logger=require(_0xe3bf('0x17'))(_0xe3bf('0x18'));var utils=require('../../config/utils');var config=require(_0xe3bf('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe3bf('0x1a'))['db'];function respondWithStatusCode(_0x2f518c,_0x2caae8){_0x2caae8=_0x2caae8||0xcc;return function(_0x52ab12){if(_0x52ab12){return _0x2f518c[_0xe3bf('0x1b')](_0x2caae8);}return _0x2f518c['status'](_0x2caae8)['end']();};}function respondWithResult(_0x2dde63,_0x5ab11a){_0x5ab11a=_0x5ab11a||0xc8;return function(_0x263827){if(_0x263827){return _0x2dde63[_0xe3bf('0x1c')](_0x5ab11a)[_0xe3bf('0x1d')](_0x263827);}};}function respondWithFilteredResult(_0x4966e8,_0x245fad){return function(_0x19a805){if(_0x19a805){var _0x5eb69a=typeof _0x245fad[_0xe3bf('0x1e')]==='undefined'&&typeof _0x245fad['limit']==='undefined';var _0x1ef556=_0x19a805[_0xe3bf('0x1f')];var _0x197fc3=_0x5eb69a?0x0:_0x245fad[_0xe3bf('0x1e')];var _0x1b994c=_0x5eb69a?_0x19a805['count']:_0x245fad[_0xe3bf('0x1e')]+_0x245fad[_0xe3bf('0x20')];var _0x207672;if(_0x1b994c>=_0x1ef556){_0x1b994c=_0x1ef556;_0x207672=0xc8;}else{_0x207672=0xce;}_0x4966e8[_0xe3bf('0x1c')](_0x207672);return _0x4966e8['set']('Content-Range',_0x197fc3+'-'+_0x1b994c+'/'+_0x1ef556)[_0xe3bf('0x1d')](_0x19a805);}return null;};}function patchUpdates(_0x16e45d){return function(_0x381864){try{jsonpatch[_0xe3bf('0x21')](_0x381864,_0x16e45d,!![]);}catch(_0x28b17c){return BPromise[_0xe3bf('0x22')](_0x28b17c);}return _0x381864[_0xe3bf('0x23')]();};}function saveUpdates(_0x6f1c5c,_0xb8d193){return function(_0x4fee3a){if(_0x4fee3a){return _0x4fee3a[_0xe3bf('0x24')](_0x6f1c5c)[_0xe3bf('0x25')](function(_0x56afbf){return _0x56afbf;});}return null;};}function removeEntity(_0x1b1813,_0x46475a){return function(_0x98a2bc){if(_0x98a2bc){return _0x98a2bc[_0xe3bf('0x26')]()[_0xe3bf('0x25')](function(){_0x1b1813[_0xe3bf('0x1c')](0xcc)[_0xe3bf('0x27')]();});}};}function handleEntityNotFound(_0x5bea6e,_0x48ef70){return function(_0x53b2c9){if(!_0x53b2c9){_0x5bea6e['sendStatus'](0x194);}return _0x53b2c9;};}function handleError(_0x19a192,_0x4d7a79){_0x4d7a79=_0x4d7a79||0x1f4;return function(_0x1767c0){logger[_0xe3bf('0x28')](_0x1767c0[_0xe3bf('0x29')]);if(_0x1767c0[_0xe3bf('0x2a')]){delete _0x1767c0[_0xe3bf('0x2a')];}_0x19a192['status'](_0x4d7a79)[_0xe3bf('0x2b')](_0x1767c0);};}exports['index']=function(_0x558289,_0x22fb97){var _0x1dcc99={},_0x235801={},_0xe27022={'count':0x0,'rows':[]};var _0x282686=_['map'](db[_0xe3bf('0x2c')][_0xe3bf('0x2d')],function(_0x339640){return{'name':_0x339640['fieldName'],'type':_0x339640[_0xe3bf('0x2e')][_0xe3bf('0x2f')]};});_0x235801['model']=_[_0xe3bf('0x30')](_0x282686,_0xe3bf('0x2a'));_0x235801['query']=_[_0xe3bf('0x31')](_0x558289[_0xe3bf('0x32')]);_0x235801[_0xe3bf('0x33')]=_[_0xe3bf('0x34')](_0x235801['model'],_0x235801['query']);_0x1dcc99[_0xe3bf('0x35')]=_['intersection'](_0x235801['model'],qs[_0xe3bf('0x36')](_0x558289[_0xe3bf('0x32')][_0xe3bf('0x36')]));_0x1dcc99['attributes']=_0x1dcc99[_0xe3bf('0x35')][_0xe3bf('0x37')]?_0x1dcc99['attributes']:_0x235801[_0xe3bf('0x38')];if(!_0x558289[_0xe3bf('0x32')][_0xe3bf('0x39')](_0xe3bf('0x3a'))){_0x1dcc99[_0xe3bf('0x20')]=qs[_0xe3bf('0x20')](_0x558289[_0xe3bf('0x32')][_0xe3bf('0x20')]);_0x1dcc99[_0xe3bf('0x1e')]=qs[_0xe3bf('0x1e')](_0x558289[_0xe3bf('0x32')]['offset']);}_0x1dcc99['order']=qs[_0xe3bf('0x3b')](_0x558289[_0xe3bf('0x32')][_0xe3bf('0x3b')]);_0x1dcc99[_0xe3bf('0x3c')]=qs[_0xe3bf('0x33')](_[_0xe3bf('0x3d')](_0x558289[_0xe3bf('0x32')],_0x235801[_0xe3bf('0x33')]),_0x282686);if(_0x558289[_0xe3bf('0x32')]['filter']){_0x1dcc99[_0xe3bf('0x3c')]=_['merge'](_0x1dcc99[_0xe3bf('0x3c')],{'$or':_[_0xe3bf('0x30')](_0x282686,function(_0x3629e2){if(_0x3629e2[_0xe3bf('0x2e')]!=='VIRTUAL'){var _0x44c7bd={};_0x44c7bd[_0x3629e2[_0xe3bf('0x2a')]]={'$like':'%'+_0x558289[_0xe3bf('0x32')][_0xe3bf('0x3e')]+'%'};return _0x44c7bd;}})});}_0x1dcc99=_['merge']({},_0x1dcc99,_0x558289[_0xe3bf('0x3f')]);var _0x371546={'where':_0x1dcc99['where']};return db['VoiceQueuesLog']['count'](_0x371546)[_0xe3bf('0x25')](function(_0x290b17){_0xe27022[_0xe3bf('0x1f')]=_0x290b17;if(_0x558289[_0xe3bf('0x32')][_0xe3bf('0x40')]){_0x1dcc99[_0xe3bf('0x41')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xe3bf('0x42')](_0x1dcc99);})[_0xe3bf('0x25')](function(_0x454aab){_0xe27022[_0xe3bf('0x43')]=_0x454aab;return _0xe27022;})[_0xe3bf('0x25')](respondWithFilteredResult(_0x22fb97,_0x1dcc99))['catch'](handleError(_0x22fb97,null));};exports[_0xe3bf('0x44')]=function(_0x432e14,_0x28f7e6){var _0x9ff9b2={'raw':!![],'where':{'id':_0x432e14[_0xe3bf('0x45')]['id']}},_0x1d0f7f={};_0x1d0f7f['model']=_[_0xe3bf('0x31')](db['VoiceQueuesLog'][_0xe3bf('0x2d')]);_0x1d0f7f[_0xe3bf('0x32')]=_[_0xe3bf('0x31')](_0x432e14[_0xe3bf('0x32')]);_0x1d0f7f['filters']=_['intersection'](_0x1d0f7f[_0xe3bf('0x38')],_0x1d0f7f['query']);_0x9ff9b2['attributes']=_['intersection'](_0x1d0f7f['model'],qs[_0xe3bf('0x36')](_0x432e14['query']['fields']));_0x9ff9b2[_0xe3bf('0x35')]=_0x9ff9b2['attributes'][_0xe3bf('0x37')]?_0x9ff9b2['attributes']:_0x1d0f7f['model'];if(_0x432e14['query']['includeAll']){_0x9ff9b2[_0xe3bf('0x41')]=[{'all':!![]}];}_0x9ff9b2=_[_0xe3bf('0x46')]({},_0x9ff9b2,_0x432e14['options']);return db[_0xe3bf('0x2c')][_0xe3bf('0x47')](_0x9ff9b2)[_0xe3bf('0x25')](handleEntityNotFound(_0x28f7e6,null))['then'](respondWithResult(_0x28f7e6,null))[_0xe3bf('0x48')](handleError(_0x28f7e6,null));};exports[_0xe3bf('0x49')]=function(_0x499406,_0x2886a7){return db[_0xe3bf('0x2c')][_0xe3bf('0x49')](_0x499406['body'],{})[_0xe3bf('0x25')](respondWithResult(_0x2886a7,0xc9))[_0xe3bf('0x48')](handleError(_0x2886a7,null));};exports[_0xe3bf('0x24')]=function(_0xaab1b,_0x318806){if(_0xaab1b['body']['id']){delete _0xaab1b[_0xe3bf('0x4a')]['id'];}return db[_0xe3bf('0x2c')][_0xe3bf('0x47')]({'where':{'id':_0xaab1b['params']['id']}})['then'](handleEntityNotFound(_0x318806,null))['then'](saveUpdates(_0xaab1b[_0xe3bf('0x4a')],null))[_0xe3bf('0x25')](respondWithResult(_0x318806,null))[_0xe3bf('0x48')](handleError(_0x318806,null));};exports[_0xe3bf('0x26')]=function(_0x2dd9c5,_0x2cf3e4){return db[_0xe3bf('0x2c')]['find']({'where':{'id':_0x2dd9c5['params']['id']}})[_0xe3bf('0x25')](handleEntityNotFound(_0x2cf3e4,null))['then'](removeEntity(_0x2cf3e4,null))[_0xe3bf('0x48')](handleError(_0x2cf3e4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 736f738..e09180e 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 _0x8ec8=['event','dtm','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','event_dtm'];(function(_0x5b5ffe,_0x1c5874){var _0x2d12bc=function(_0x14d075){while(--_0x14d075){_0x5b5ffe['push'](_0x5b5ffe['shift']());}};_0x2d12bc(++_0x1c5874);}(_0x8ec8,0x154));var _0x88ec=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x8ec8[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x88ec('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x88ec('0x1'));var moment=require(_0x88ec('0x2'));var BPromise=require('bluebird');var rp=require(_0x88ec('0x3'));var fs=require('fs');var path=require(_0x88ec('0x4'));var rimraf=require(_0x88ec('0x5'));var config=require(_0x88ec('0x6'));var attributes=require(_0x88ec('0x7'));module[_0x88ec('0x8')]=function(_0x3d3aa4,_0x359da2){return _0x3d3aa4['define'](_0x88ec('0x9'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x88ec('0xa'),'fields':[_0x88ec('0xb'),_0x88ec('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x323b=['util','../../config/logger','api','bluebird','request-promise','rimraf','./voiceQueuesLog.attributes','exports','define','event_dtm','event','dtm'];(function(_0x565a37,_0x3e26b7){var _0x2a60e2=function(_0x3b4c77){while(--_0x3b4c77){_0x565a37['push'](_0x565a37['shift']());}};_0x2a60e2(++_0x3e26b7);}(_0x323b,0x144));var _0xb323=function(_0x1fe5a4,_0x1bc843){_0x1fe5a4=_0x1fe5a4-0x0;var _0x33c16d=_0x323b[_0x1fe5a4];return _0x33c16d;};'use strict';var _=require('lodash');var util=require(_0xb323('0x0'));var logger=require(_0xb323('0x1'))(_0xb323('0x2'));var moment=require('moment');var BPromise=require(_0xb323('0x3'));var rp=require(_0xb323('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb323('0x5'));var config=require('../../config/environment');var attributes=require(_0xb323('0x6'));module[_0xb323('0x7')]=function(_0x17f67d,_0x15c76d){return _0x17f67d[_0xb323('0x8')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xb323('0x9'),'fields':[_0xb323('0xa'),_0xb323('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 3ea1604..6ead8c3 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 _0x02c5=['request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','catch','lodash','util','bluebird','../../mysqldb','../../config/environment','request','then','info'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x02c5,0x178));var _0x502c=function(_0x167b19,_0x56081a){_0x167b19=_0x167b19-0x0;var _0x1fcca2=_0x02c5[_0x167b19];return _0x1fcca2;};'use strict';var _=require(_0x502c('0x0'));var util=require(_0x502c('0x1'));var moment=require('moment');var BPromise=require(_0x502c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x502c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x502c('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b1c5c,_0x42da3a,_0x205346){return new BPromise(function(_0x53818a,_0x969ae0){return client[_0x502c('0x5')](_0x5b1c5c,_0x205346)[_0x502c('0x6')](function(_0x1b942c){logger[_0x502c('0x7')]('VoiceQueuesLog,\x20%s,\x20%s',_0x42da3a,_0x502c('0x8'));logger[_0x502c('0x9')](_0x502c('0xa'),_0x42da3a,_0x502c('0x8'),JSON[_0x502c('0xb')](_0x1b942c));if(_0x1b942c['error']){if(_0x1b942c['error']['code']===0x1f4){logger[_0x502c('0xc')](_0x502c('0xd'),_0x42da3a,_0x1b942c[_0x502c('0xc')][_0x502c('0xe')]);return _0x969ae0(_0x1b942c[_0x502c('0xc')][_0x502c('0xe')]);}logger[_0x502c('0xc')](_0x502c('0xd'),_0x42da3a,_0x1b942c['error']['message']);return _0x53818a(_0x1b942c['error'][_0x502c('0xe')]);}else{logger[_0x502c('0x7')](_0x502c('0xd'),_0x42da3a,'request\x20sent');_0x53818a(_0x1b942c['result'][_0x502c('0xe')]);}})[_0x502c('0xf')](function(_0x461ede){logger[_0x502c('0xc')](_0x502c('0xd'),_0x42da3a,_0x461ede);_0x969ae0(_0x461ede);});});} \ No newline at end of file +var _0xc65f=['error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4b9f63,_0x374268){var _0x1c2118=function(_0xcd4197){while(--_0xcd4197){_0x4b9f63['push'](_0x4b9f63['shift']());}};_0x1c2118(++_0x374268);}(_0xc65f,0x76));var _0xfc65=function(_0xd687e9,_0x3736fd){_0xd687e9=_0xd687e9-0x0;var _0x1dc846=_0xc65f[_0xd687e9];return _0x1dc846;};'use strict';var _=require(_0xfc65('0x0'));var util=require(_0xfc65('0x1'));var moment=require(_0xfc65('0x2'));var BPromise=require(_0xfc65('0x3'));var rs=require(_0xfc65('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc65('0x5'))['db'];var utils=require(_0xfc65('0x6'));var logger=require(_0xfc65('0x7'))(_0xfc65('0x8'));var config=require(_0xfc65('0x9'));var jayson=require(_0xfc65('0xa'));var client=jayson[_0xfc65('0xb')][_0xfc65('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x328608,_0x598809,_0x4338da){return new BPromise(function(_0xba6ab3,_0x5e2473){return client[_0xfc65('0xd')](_0x328608,_0x4338da)[_0xfc65('0xe')](function(_0x4f349b){logger[_0xfc65('0xf')](_0xfc65('0x10'),_0x598809,_0xfc65('0x11'));logger[_0xfc65('0x12')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x598809,_0xfc65('0x11'),JSON[_0xfc65('0x13')](_0x4f349b));if(_0x4f349b[_0xfc65('0x14')]){if(_0x4f349b[_0xfc65('0x14')]['code']===0x1f4){logger[_0xfc65('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x598809,_0x4f349b[_0xfc65('0x14')][_0xfc65('0x15')]);return _0x5e2473(_0x4f349b['error'][_0xfc65('0x15')]);}logger['error'](_0xfc65('0x10'),_0x598809,_0x4f349b[_0xfc65('0x14')][_0xfc65('0x15')]);return _0xba6ab3(_0x4f349b[_0xfc65('0x14')][_0xfc65('0x15')]);}else{logger[_0xfc65('0xf')](_0xfc65('0x10'),_0x598809,_0xfc65('0x11'));_0xba6ab3(_0x4f349b['result'][_0xfc65('0x15')]);}})[_0xfc65('0x16')](function(_0x18e9c8){logger[_0xfc65('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x598809,_0x18e9c8);_0x5e2473(_0x18e9c8);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c8458b9..dd85296 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 _0xd28f=['get','/:id/download','/:id/downloads','post','create','runTranscribe','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','/describe','/:id','show'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xd28f,0x1c0));var _0xfd28=function(_0x1cce5a,_0x470e1c){_0x1cce5a=_0x1cce5a-0x0;var _0x4978e8=_0xd28f[_0x1cce5a];return _0x4978e8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfd28('0x0'));var timeout=require(_0xfd28('0x1'));var express=require(_0xfd28('0x2'));var router=express[_0xfd28('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfd28('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfd28('0x5'));var controller=require(_0xfd28('0x6'));router['get']('/',auth[_0xfd28('0x7')](),controller[_0xfd28('0x8')]);router['get'](_0xfd28('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xfd28('0xa'),auth['isAuthenticated'](),controller[_0xfd28('0xb')]);router[_0xfd28('0xc')](_0xfd28('0xd'),auth['isAuthenticated'](),controller['download']);router[_0xfd28('0xc')](_0xfd28('0xe'),controller['downloads']);router[_0xfd28('0xc')]('/:id/transcribe',auth[_0xfd28('0x7')](),controller['downloadTranscribe']);router[_0xfd28('0xf')]('/',auth[_0xfd28('0x7')](),controller[_0xfd28('0x10')]);router[_0xfd28('0xf')]('/:id/transcribe',auth[_0xfd28('0x7')](),controller[_0xfd28('0x11')]);router[_0xfd28('0x12')]('/:id',auth[_0xfd28('0x7')](),controller[_0xfd28('0x13')]);router[_0xfd28('0x14')](_0xfd28('0xa'),auth[_0xfd28('0x7')](),controller[_0xfd28('0x15')]);module[_0xfd28('0x16')]=router; \ No newline at end of file +var _0xf375=['index','describe','get','/:id','show','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated'];(function(_0x296981,_0x3be478){var _0x187a2b=function(_0x18aee8){while(--_0x18aee8){_0x296981['push'](_0x296981['shift']());}};_0x187a2b(++_0x3be478);}(_0xf375,0x103));var _0x5f37=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf375[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x5f37('0x0'));var util=require(_0x5f37('0x1'));var path=require(_0x5f37('0x2'));var timeout=require(_0x5f37('0x3'));var express=require(_0x5f37('0x4'));var router=express[_0x5f37('0x5')]();var fs_extra=require(_0x5f37('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5f37('0x7'));var config=require(_0x5f37('0x8'));var controller=require(_0x5f37('0x9'));router['get']('/',auth[_0x5f37('0xa')](),controller[_0x5f37('0xb')]);router['get']('/describe',auth[_0x5f37('0xa')](),controller[_0x5f37('0xc')]);router[_0x5f37('0xd')](_0x5f37('0xe'),auth[_0x5f37('0xa')](),controller[_0x5f37('0xf')]);router[_0x5f37('0xd')](_0x5f37('0x10'),auth[_0x5f37('0xa')](),controller[_0x5f37('0x11')]);router[_0x5f37('0xd')]('/:id/downloads',controller[_0x5f37('0x12')]);router[_0x5f37('0xd')](_0x5f37('0x13'),auth[_0x5f37('0xa')](),controller[_0x5f37('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5f37('0x15')]);router[_0x5f37('0x16')](_0x5f37('0x13'),auth[_0x5f37('0xa')](),controller[_0x5f37('0x17')]);router[_0x5f37('0x18')](_0x5f37('0xe'),auth[_0x5f37('0xa')](),controller[_0x5f37('0x19')]);router['delete'](_0x5f37('0xe'),auth[_0x5f37('0xa')](),controller[_0x5f37('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 2e960c4..9b17986 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(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 59c0733..f690097 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 _0xf96c=['show','params','rawAttributes','merge','options','find','create','body','describe','download','type','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','../../components/encryptor','sequelize','MD5','col','token','push','$and','Sequelize','extname','destroy','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','downloadTranscribe','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','index','map','VoiceRecording','fieldName','key','model','differenceBy','format','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','includeAll','include','findAll','rows','catch'];(function(_0x4e99f9,_0x515f1e){var _0x1a548e=function(_0x39889c){while(--_0x39889c){_0x4e99f9['push'](_0x4e99f9['shift']());}};_0x1a548e(++_0x515f1e);}(_0xf96c,0x188));var _0xcf96=function(_0x236173,_0x1d3110){_0x236173=_0x236173-0x0;var _0x45eda9=_0xf96c[_0x236173];return _0x45eda9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf96('0x0'));var zipdir=require(_0xcf96('0x1'));var jsonpatch=require(_0xcf96('0x2'));var rp=require('request-promise');var moment=require(_0xcf96('0x3'));var BPromise=require(_0xcf96('0x4'));var Mustache=require('mustache');var util=require(_0xcf96('0x5'));var path=require(_0xcf96('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcf96('0x7'));var fs=require('fs');var fs_extra=require(_0xcf96('0x8'));var _=require(_0xcf96('0x9'));var squel=require('squel');var crypto=require(_0xcf96('0xa'));var jsforce=require(_0xcf96('0xb'));var deskjs=require(_0xcf96('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcf96('0xd'));var Papa=require('papaparse');var AWS=require(_0xcf96('0xe'));var uuidv4=require('uuid/v4');var Redis=require(_0xcf96('0xf'));var authService=require(_0xcf96('0x10'));var qs=require(_0xcf96('0x11'));var as=require(_0xcf96('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf96('0x13'))(_0xcf96('0x14'));var utils=require(_0xcf96('0x15'));var config=require(_0xcf96('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf96('0x17'))['db'];function respondWithStatusCode(_0x26f3aa,_0x570b6f){_0x570b6f=_0x570b6f||0xcc;return function(_0x13d134){if(_0x13d134){return _0x26f3aa[_0xcf96('0x18')](_0x570b6f);}return _0x26f3aa[_0xcf96('0x19')](_0x570b6f)[_0xcf96('0x1a')]();};}function respondWithResult(_0xb591da,_0x463535){_0x463535=_0x463535||0xc8;return function(_0x5670c6){if(_0x5670c6){return _0xb591da['status'](_0x463535)[_0xcf96('0x1b')](_0x5670c6);}};}function respondWithFilteredResult(_0x383717,_0x2f4077){return function(_0x271a10){if(_0x271a10){var _0x4e20a7=typeof _0x2f4077[_0xcf96('0x1c')]===_0xcf96('0x1d')&&typeof _0x2f4077[_0xcf96('0x1e')]===_0xcf96('0x1d');var _0x27c127=_0x271a10['count'];var _0x2b0d52=_0x4e20a7?0x0:_0x2f4077[_0xcf96('0x1c')];var _0x53bb5c=_0x4e20a7?_0x271a10[_0xcf96('0x1f')]:_0x2f4077[_0xcf96('0x1c')]+_0x2f4077[_0xcf96('0x1e')];var _0x9d86b2;if(_0x53bb5c>=_0x27c127){_0x53bb5c=_0x27c127;_0x9d86b2=0xc8;}else{_0x9d86b2=0xce;}_0x383717['status'](_0x9d86b2);return _0x383717[_0xcf96('0x20')](_0xcf96('0x21'),_0x2b0d52+'-'+_0x53bb5c+'/'+_0x27c127)[_0xcf96('0x1b')](_0x271a10);}return null;};}function patchUpdates(_0x553f91){return function(_0x384adf){try{jsonpatch[_0xcf96('0x22')](_0x384adf,_0x553f91,!![]);}catch(_0x5c8c15){return BPromise[_0xcf96('0x23')](_0x5c8c15);}return _0x384adf[_0xcf96('0x24')]();};}function saveUpdates(_0x1a6433,_0x47a515){return function(_0xbdf501){if(_0xbdf501){return _0xbdf501[_0xcf96('0x25')](_0x1a6433)[_0xcf96('0x26')](function(_0x4c8842){return _0x4c8842;});}return null;};}function removeEntity(_0x11f60f,_0x82fbe3){return function(_0x1813f4){if(_0x1813f4){return _0x1813f4['destroy']()[_0xcf96('0x26')](function(){_0x11f60f['status'](0xcc)[_0xcf96('0x1a')]();});}};}function handleEntityNotFound(_0x8170bb,_0x440e1e){return function(_0x2341f1){if(!_0x2341f1){_0x8170bb['sendStatus'](0x194);}return _0x2341f1;};}function handleError(_0x2ebd9a,_0x2635f3){_0x2635f3=_0x2635f3||0x1f4;return function(_0x28aef7){logger[_0xcf96('0x27')](_0x28aef7['stack']);if(_0x28aef7[_0xcf96('0x28')]){delete _0x28aef7[_0xcf96('0x28')];}_0x2ebd9a[_0xcf96('0x19')](_0x2635f3)['send'](_0x28aef7);};}exports[_0xcf96('0x29')]=function(_0x37a7b7,_0x5492df){var _0x2d5030={},_0xdc3911={},_0x594fb2={'count':0x0,'rows':[]};var _0xa286ac=_[_0xcf96('0x2a')](db[_0xcf96('0x2b')]['rawAttributes'],function(_0x14f6a3){return{'name':_0x14f6a3[_0xcf96('0x2c')],'type':_0x14f6a3['type'][_0xcf96('0x2d')]};});_0xdc3911[_0xcf96('0x2e')]=_[_0xcf96('0x2f')](_[_0xcf96('0x2a')](_0xa286ac,_0xcf96('0x28')),[_0xcf96('0x30')]);_0xdc3911[_0xcf96('0x31')]=_[_0xcf96('0x32')](_0x37a7b7['query']);_0xdc3911['filters']=_['intersection'](_0xdc3911[_0xcf96('0x2e')],_0xdc3911[_0xcf96('0x31')]);_0x2d5030['attributes']=_[_0xcf96('0x33')](_0xdc3911[_0xcf96('0x2e')],qs[_0xcf96('0x34')](_0x37a7b7[_0xcf96('0x31')][_0xcf96('0x34')]));_0x2d5030[_0xcf96('0x35')]=_0x2d5030[_0xcf96('0x35')][_0xcf96('0x36')]?_0x2d5030[_0xcf96('0x35')]:_0xdc3911[_0xcf96('0x2e')];if(!_0x37a7b7[_0xcf96('0x31')][_0xcf96('0x37')](_0xcf96('0x38'))){_0x2d5030[_0xcf96('0x1e')]=qs[_0xcf96('0x1e')](_0x37a7b7[_0xcf96('0x31')][_0xcf96('0x1e')]);_0x2d5030[_0xcf96('0x1c')]=qs[_0xcf96('0x1c')](_0x37a7b7[_0xcf96('0x31')][_0xcf96('0x1c')]);}_0x2d5030['order']=qs[_0xcf96('0x39')](_0x37a7b7[_0xcf96('0x31')][_0xcf96('0x39')]);_0x2d5030[_0xcf96('0x3a')]=qs[_0xcf96('0x3b')](_[_0xcf96('0x3c')](_0x37a7b7[_0xcf96('0x31')],_0xdc3911[_0xcf96('0x3b')]),_0xa286ac);if(_0x37a7b7['query'][_0xcf96('0x3d')]){_0x2d5030[_0xcf96('0x3a')]=_['merge'](_0x2d5030[_0xcf96('0x3a')],{'$or':_[_0xcf96('0x2a')](_0xa286ac,function(_0x37206b){if(_0x37206b['type']!=='VIRTUAL'){var _0x845001={};_0x845001[_0x37206b['name']]={'$like':'%'+_0x37a7b7[_0xcf96('0x31')][_0xcf96('0x3d')]+'%'};return _0x845001;}})});}_0x2d5030=_['merge']({},_0x2d5030,_0x37a7b7['options']);var _0x53bc5d={'where':_0x2d5030['where']};return db[_0xcf96('0x2b')][_0xcf96('0x1f')](_0x53bc5d)[_0xcf96('0x26')](function(_0x59a674){_0x594fb2['count']=_0x59a674;if(_0x37a7b7[_0xcf96('0x31')][_0xcf96('0x3e')]){_0x2d5030[_0xcf96('0x3f')]=[{'all':!![]}];}return db[_0xcf96('0x2b')][_0xcf96('0x40')](_0x2d5030);})[_0xcf96('0x26')](function(_0x1103df){_0x594fb2[_0xcf96('0x41')]=_0x1103df;return _0x594fb2;})[_0xcf96('0x26')](respondWithFilteredResult(_0x5492df,_0x2d5030))[_0xcf96('0x42')](handleError(_0x5492df,null));};exports[_0xcf96('0x43')]=function(_0x221c1d,_0x2a5075){var _0x1282ab={'raw':![],'where':{'id':_0x221c1d[_0xcf96('0x44')]['id']}},_0x18ceb0={};_0x18ceb0[_0xcf96('0x2e')]=_[_0xcf96('0x32')](db[_0xcf96('0x2b')][_0xcf96('0x45')]);_0x18ceb0[_0xcf96('0x31')]=_[_0xcf96('0x32')](_0x221c1d[_0xcf96('0x31')]);_0x18ceb0[_0xcf96('0x3b')]=_[_0xcf96('0x33')](_0x18ceb0[_0xcf96('0x2e')],_0x18ceb0[_0xcf96('0x31')]);_0x1282ab[_0xcf96('0x35')]=_['intersection'](_0x18ceb0['model'],qs[_0xcf96('0x34')](_0x221c1d[_0xcf96('0x31')][_0xcf96('0x34')]));_0x1282ab[_0xcf96('0x35')]=_0x1282ab[_0xcf96('0x35')]['length']?_0x1282ab[_0xcf96('0x35')]:_0x18ceb0[_0xcf96('0x2e')];if(_0x221c1d[_0xcf96('0x31')]['includeAll']){_0x1282ab[_0xcf96('0x3f')]=[{'all':!![]}];}_0x1282ab=_[_0xcf96('0x46')]({},_0x1282ab,_0x221c1d[_0xcf96('0x47')]);return db[_0xcf96('0x2b')][_0xcf96('0x48')](_0x1282ab)[_0xcf96('0x26')](handleEntityNotFound(_0x2a5075,null))[_0xcf96('0x26')](respondWithResult(_0x2a5075,null))[_0xcf96('0x42')](handleError(_0x2a5075,null));};exports[_0xcf96('0x49')]=function(_0x18f1d8,_0x475fe5){return db[_0xcf96('0x2b')]['create'](_0x18f1d8[_0xcf96('0x4a')],{})[_0xcf96('0x26')](respondWithResult(_0x475fe5,0xc9))[_0xcf96('0x42')](handleError(_0x475fe5,null));};exports[_0xcf96('0x25')]=function(_0x5d2fa6,_0x2f95f9){if(_0x5d2fa6['body']['id']){delete _0x5d2fa6[_0xcf96('0x4a')]['id'];}return db[_0xcf96('0x2b')][_0xcf96('0x48')]({'where':{'id':_0x5d2fa6[_0xcf96('0x44')]['id']}})[_0xcf96('0x26')](handleEntityNotFound(_0x2f95f9,null))[_0xcf96('0x26')](saveUpdates(_0x5d2fa6[_0xcf96('0x4a')],null))[_0xcf96('0x26')](respondWithResult(_0x2f95f9,null))[_0xcf96('0x42')](handleError(_0x2f95f9,null));};exports[_0xcf96('0x4b')]=function(_0x334d5e,_0x53e038){return db[_0xcf96('0x2b')][_0xcf96('0x4b')]()[_0xcf96('0x26')](respondWithResult(_0x53e038,null))[_0xcf96('0x42')](handleError(_0x53e038,null));};exports[_0xcf96('0x4c')]=function(_0x395afe,_0x431ff7,_0x393ccb){var _0x3d307b=require('../../components/encryptor');var _0x14b455=![];var _0x1e6208={};if(_0x395afe[_0xcf96('0x31')]['type']&&_0x395afe[_0xcf96('0x31')][_0xcf96('0x4d')]===_0xcf96('0x4e')){_0x1e6208[_0xcf96('0x4e')]=_0x395afe[_0xcf96('0x44')]['id'];}else{_0x1e6208['id']=_0x395afe[_0xcf96('0x44')]['id'];}return db[_0xcf96('0x2b')][_0xcf96('0x48')]({'where':_0x1e6208,'attributes':['id',_0xcf96('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x431ff7,null))[_0xcf96('0x26')](function(_0x3a8025){if(_0x3a8025){var _0x587f50=_0x3a8025[_0xcf96('0x4f')];var _0x1fcf93=util[_0xcf96('0x30')](_0xcf96('0x50'),_0x587f50);if(fs[_0xcf96('0x51')](_0x1fcf93)){_0x14b455=!![];return _0x3d307b[_0xcf96('0x52')](_0x1fcf93,_0x587f50,config[_0xcf96('0x53')][_0xcf96('0x54')])[_0xcf96('0x26')](function(){return _0x3a8025;});}return _0x3a8025;}})['then'](function(_0x5706f0){if(_0x5706f0){var _0x13b154=_0x5706f0[_0xcf96('0x4f')];if(!fs['existsSync'](_0x13b154)){throw new db['Sequelize'][(_0xcf96('0x55'))](_0xcf96('0x56'));}if(_0x5706f0[_0xcf96('0x57')]){return _0x431ff7[_0xcf96('0x4c')](_0x13b154,_0x5706f0[_0xcf96('0x57')]+path['extname'](_0x13b154),function(){if(_0x14b455){fs[_0xcf96('0x58')](_0x13b154);}});}else{return _0x431ff7[_0xcf96('0x4c')](_0x13b154,function(_0x2876eb){if(_0x14b455){fs[_0xcf96('0x58')](_0x13b154);}});}}})[_0xcf96('0x42')](function(_0x41dd14){if(_0x41dd14[_0xcf96('0x59')]===_0xcf96('0x56')){_0x431ff7[_0xcf96('0x19')](0x194)['send'](_0xcf96('0x5a'));}else{return handleError(_0x431ff7,null);}});};exports['downloads']=function(_0x9d37f9,_0x3473ea,_0x3547c6){var _0x1669ae=require(_0xcf96('0x5b'));var _0x1cbaa6=![];var _0x25a525={'$and':[db['sequelize'][_0xcf96('0x3a')](db[_0xcf96('0x5c')]['fn'](_0xcf96('0x5d'),db[_0xcf96('0x5c')][_0xcf96('0x5e')](_0xcf96('0x4e'))),_0x9d37f9['query'][_0xcf96('0x5f')])]};if(_0x9d37f9[_0xcf96('0x31')][_0xcf96('0x4d')]&&_0x9d37f9[_0xcf96('0x31')]['type']===_0xcf96('0x4e')){_0x25a525['$and'][_0xcf96('0x60')]({'uniqueid':_0x9d37f9[_0xcf96('0x44')]['id']});}else{_0x25a525[_0xcf96('0x61')][_0xcf96('0x60')]({'id':_0x9d37f9[_0xcf96('0x44')]['id']});}return db[_0xcf96('0x2b')]['find']({'where':_0x25a525,'attributes':['id',_0xcf96('0x4f')],'raw':!![]})[_0xcf96('0x26')](handleEntityNotFound(_0x3473ea,null))[_0xcf96('0x26')](function(_0x225a7e){if(_0x225a7e){var _0x17a4d1=util[_0xcf96('0x30')](_0xcf96('0x50'),_0x225a7e['value']);if(fs[_0xcf96('0x51')](_0x17a4d1)){_0x1cbaa6=!![];return _0x1669ae[_0xcf96('0x52')](_0x17a4d1,_0x225a7e['value'],config[_0xcf96('0x53')][_0xcf96('0x54')])['then'](function(){return _0x225a7e;});}return _0x225a7e;}})[_0xcf96('0x26')](function(_0x59241d){if(_0x59241d){if(!fs[_0xcf96('0x51')](_0x59241d[_0xcf96('0x4f')])){throw new db[(_0xcf96('0x62'))][(_0xcf96('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x59241d[_0xcf96('0x57')]){return _0x3473ea[_0xcf96('0x4c')](_0x59241d['value'],_0x59241d[_0xcf96('0x57')]+path[_0xcf96('0x63')](_0x59241d[_0xcf96('0x4f')]),function(){if(_0x1cbaa6){fs[_0xcf96('0x58')](_0x59241d[_0xcf96('0x4f')]);}});}else{return _0x3473ea[_0xcf96('0x4c')](_0x59241d[_0xcf96('0x4f')],function(_0x5a82bb){if(_0x1cbaa6){fs[_0xcf96('0x58')](_0x59241d[_0xcf96('0x4f')]);}});}}})[_0xcf96('0x42')](handleError(_0x3473ea,null));};exports[_0xcf96('0x64')]=function(_0x257c81,_0x5d0e4a){return db[_0xcf96('0x2b')][_0xcf96('0x48')]({'where':{'id':_0x257c81[_0xcf96('0x44')]['id']}})[_0xcf96('0x26')](function(_0x42734b){if(_['isNil'](_0x42734b)){throw new ReferenceError('Entity\x20not\x20found');}return _0x42734b;})[_0xcf96('0x26')](function(_0x1872d6){var _0x386f76=_0x1872d6[_0xcf96('0x4f')];logger[_0xcf96('0x65')](_0xcf96('0x66'),_0x386f76);if(!_['isNil'](_0x1872d6[_0xcf96('0x4f')])&&fs['existsSync'](_0x386f76)){logger['info'](_0xcf96('0x67')+_0x386f76+_0xcf96('0x68'));fs[_0xcf96('0x69')](_0x386f76);}_0x386f76=_0x386f76+_0xcf96('0x6a');if(!_[_0xcf96('0x6b')](_0x1872d6['value'])&&fs[_0xcf96('0x51')](_0x386f76)){logger[_0xcf96('0x65')]('File:\x20\x22'+_0x386f76+_0xcf96('0x68'));fs[_0xcf96('0x69')](_0x386f76);}return _0x1872d6;})['then'](function(_0x49587f){if(!_0x49587f)throw new InternalError();return _0x49587f['destroy']();})[_0xcf96('0x26')](function(){_0x5d0e4a[_0xcf96('0x19')](0xcc)[_0xcf96('0x1a')]();})['catch'](handleError(_0x5d0e4a,null));};function getBucketslist(_0x171656,_0x36d62c,_0x5b934e){return new Promise(function(_0x1600a9,_0xa1a5b8){var _0x1bffc6=new AWS['S3']({'accessKeyId':_0x36d62c,'secretAccessKey':_0x171656,'region':_0x5b934e});_0x1bffc6[_0xcf96('0x6c')]({},function(_0x42251c,_0x87cca3){if(_0x42251c){return _0xa1a5b8(_0x42251c);}else{return _0x1600a9(_0x87cca3);}});});}function createBucket(_0x59b0e8,_0x1a2a97,_0xff63eb,_0x5c5493){return new Promise(function(_0x402867,_0x32d86c){var _0x4fff92=new AWS['S3']({'accessKeyId':_0x1a2a97,'secretAccessKey':_0x59b0e8,'region':_0xff63eb});_0x4fff92[_0xcf96('0x6d')]({'Bucket':_0x5c5493},function(_0x5435cd,_0xd6a9e){if(_0x5435cd){return _0x32d86c(_0x5435cd);}else{return _0x402867(_0xd6a9e);}});});}function uploadFile(_0x28de7d,_0x2c09a9,_0x169d2a,_0x5e0402,_0x689344,_0xf27ff0){return new Promise(function(_0x2d9637,_0x58b8b9){var _0xfd345=new AWS['S3']({'accessKeyId':_0x2c09a9,'secretAccessKey':_0x28de7d,'region':_0x169d2a});_0xfd345[_0xcf96('0x6e')]({'Bucket':_0x5e0402,'Key':_0x689344,'Body':_0xf27ff0},function(_0x4912da,_0x310f9e){if(_0x4912da){return _0x58b8b9(_0x4912da);}else{return _0x2d9637(_0x310f9e);}});});}function startTranscribe(_0x186ed5,_0x4a1fa5,_0x53b03e,_0x42c6f9,_0x536eb3,_0x1b1dfb){return new Promise(function(_0x214705,_0x446dee){var _0x1f11a0=new AWS['TranscribeService']({'accessKeyId':_0x4a1fa5,'secretAccessKey':_0x186ed5,'region':_0x53b03e});_0x1f11a0[_0xcf96('0x6f')]({'TranscriptionJobName':_0x42c6f9,'LanguageCode':_0x536eb3,'Media':{'MediaFileUri':_0x1b1dfb}},function(_0x3e4e08,_0x42818c){if(_0x3e4e08){return _0x446dee(_0x3e4e08);}else{return _0x214705(_0x42818c);}});});}function transcribe(_0x2a1a5d,_0xc8d4a1,_0x1424ce,_0x22282b,_0xc2baf8,_0x372652,_0xc92967){return new Promise(function(_0x3f0004,_0x2970a8){var _0x4ca006={};logger[_0xcf96('0x65')](util['format'](_0xcf96('0x70'),_0x2a1a5d,_0xc2baf8));return uploadFile(_0xc8d4a1,_0x1424ce,_0x22282b,_0xc2baf8,path['basename'](_0x372652),fs[_0xcf96('0x71')](_0x372652))[_0xcf96('0x26')](function(_0x20c0ea){logger['info'](util[_0xcf96('0x30')](_0xcf96('0x72'),_0x2a1a5d,_0xc2baf8,_0x20c0ea['Location']));_0x4ca006[_0xcf96('0x73')]=_0x20c0ea[_0xcf96('0x74')];_0x4ca006['location']=_0x20c0ea[_0xcf96('0x75')];logger[_0xcf96('0x65')](util['format'](_0xcf96('0x76'),_0x2a1a5d));return startTranscribe(_0xc8d4a1,_0x1424ce,_0x22282b,uuidv4(),_0xc92967,_0x20c0ea[_0xcf96('0x75')]);})[_0xcf96('0x26')](function(_0x7aa996){logger[_0xcf96('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x2a1a5d,_0x7aa996[_0xcf96('0x77')][_0xcf96('0x78')]));_0x4ca006[_0xcf96('0x79')]=_0x7aa996['TranscriptionJob'][_0xcf96('0x78')];_0x4ca006[_0xcf96('0x7a')]=_0x7aa996['TranscriptionJob'][_0xcf96('0x7b')];return _0x3f0004(_0x4ca006);})[_0xcf96('0x42')](function(_0x1b2513){return _0x2970a8(_0x1b2513);});});}exports[_0xcf96('0x7c')]=function(_0x442998,_0x4978f6,_0x319074){var _0x2f5f6a;var _0x35e38f;var _0x32d5da;var _0xcd79b1=require(_0xcf96('0x5b'));return db[_0xcf96('0x2b')][_0xcf96('0x7d')]({'where':{'id':_0x442998['params']['id']}})['then'](function(_0x72a7e3){if(_0x72a7e3){var _0x38a3c6=util[_0xcf96('0x30')](_0xcf96('0x50'),_0x72a7e3[_0xcf96('0x4f')]);if(fs[_0xcf96('0x51')](_0x38a3c6)){cypher=!![];return _0xcd79b1['decryptFile'](_0x38a3c6,_0x72a7e3['value'],config[_0xcf96('0x53')][_0xcf96('0x54')])[_0xcf96('0x26')](function(){return _0x72a7e3;});}return _0x72a7e3;}})[_0xcf96('0x26')](function(_0x41f963){if(!_0x41f963){throw new db[(_0xcf96('0x62'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x35e38f=_0x41f963;return db['Setting'][_0xcf96('0x7d')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x4978f6,null))[_0xcf96('0x26')](function(_0x5eae14){if(_0x5eae14){_0x2f5f6a=_0x5eae14;if(!_0x2f5f6a[_0xcf96('0x7e')]||!_0x2f5f6a[_0xcf96('0x7f')]||!_0x2f5f6a[_0xcf96('0x80')]||!_0x2f5f6a[_0xcf96('0x81')]||!_0x2f5f6a[_0xcf96('0x73')]){throw new db['Sequelize'][(_0xcf96('0x55'))](_0xcf96('0x82'));}if(_0x442998[_0xcf96('0x4a')][_0xcf96('0x83')]&&(!_0x2f5f6a[_0xcf96('0x84')]||!_0x2f5f6a[_0xcf96('0x85')]||!_0x2f5f6a['sentimentRegion']||!_0x2f5f6a[_0xcf96('0x81')]||!_0x2f5f6a['bucket'])){throw new db[(_0xcf96('0x62'))][(_0xcf96('0x55'))](_0xcf96('0x86'));}return db[_0xcf96('0x87')][_0xcf96('0x7d')]({'where':{'id':_0x2f5f6a[_0xcf96('0x7f')]}});}})[_0xcf96('0x26')](function(_0x4e6e8e){if(!_0x4e6e8e){throw new db[(_0xcf96('0x62'))][(_0xcf96('0x55'))](_0xcf96('0x88'));}if(!_0x4e6e8e['data1']||!_0x4e6e8e['data2']){throw new db[(_0xcf96('0x62'))]['ValidationError'](_0xcf96('0x89'));}_0x32d5da=_0x4e6e8e;return getBucketslist(_0x32d5da[_0xcf96('0x8a')],_0x32d5da['data2'],_0x2f5f6a[_0xcf96('0x80')]);})[_0xcf96('0x26')](function(_0x3081e3){if(_0x3081e3&&_0x3081e3[_0xcf96('0x8b')]){var _0x5544a3=_[_0xcf96('0x48')](_0x3081e3['Buckets'],function(_0x4a3537){return _0x4a3537[_0xcf96('0x8c')]===_0x2f5f6a[_0xcf96('0x73')];});if(!_0x5544a3){logger[_0xcf96('0x65')](util[_0xcf96('0x30')](_0xcf96('0x8d'),_0x442998[_0xcf96('0x44')]['id'],_0x2f5f6a[_0xcf96('0x73')]));return createBucket(_0x32d5da[_0xcf96('0x8a')],_0x32d5da[_0xcf96('0x8e')],_0x2f5f6a[_0xcf96('0x80')],_0x2f5f6a[_0xcf96('0x73')]);}logger[_0xcf96('0x65')](util['format'](_0xcf96('0x8f'),_0x442998['params']['id'],_0x2f5f6a['bucket']));return;}})[_0xcf96('0x26')](function(_0x2dd232){if(_0x35e38f[_0xcf96('0x7a')]===_0xcf96('0x90')){return transcribe(_0x442998['params']['id'],_0x32d5da['data1'],_0x32d5da[_0xcf96('0x8e')],_0x2f5f6a['transcribeRegion'],_0x2f5f6a[_0xcf96('0x73')],_0x35e38f[_0xcf96('0x4f')],_0x2f5f6a[_0xcf96('0x81')]);}else{logger[_0xcf96('0x65')](util[_0xcf96('0x30')](_0xcf96('0x91'),_0x442998[_0xcf96('0x44')]['id']));return{'transcribeStatus':_0xcf96('0x92')};}})['then'](function(_0x156cfc){if(_0x156cfc){_0x156cfc['tempSentiment']=_0x442998[_0xcf96('0x4a')][_0xcf96('0x83')];return _0x35e38f[_0xcf96('0x93')](_0x156cfc);}})[_0xcf96('0x26')](respondWithResult(_0x4978f6,null))[_0xcf96('0x42')](handleError(_0x4978f6,null));};function writeFile(_0x4350a5,_0x51c7b4){return new Promise(function(_0x392b5c,_0x8d0f8a){fs['writeFile'](_0x51c7b4,_0x4350a5,function(_0x409afc,_0x33f9a8){if(_0x409afc){return _0x8d0f8a(_0x409afc);}else{return _0x392b5c(_0x33f9a8);}});});}exports[_0xcf96('0x94')]=function(_0x3a8adf,_0x13a093,_0x1eba8d){return db[_0xcf96('0x2b')][_0xcf96('0x7d')]({'where':{'id':_0x3a8adf[_0xcf96('0x44')]['id']}})[_0xcf96('0x26')](handleEntityNotFound(_0x13a093))[_0xcf96('0x26')](function(_0x7b3386){if(_0x7b3386&&_0x7b3386['fileText']){var _0x51b6b0=_0x7b3386['fileText'];var _0x121283=config[_0xcf96('0x95')]+_0xcf96('0x96')+_0x7b3386['id']+_0xcf96('0x97');if(fs['existsSync'](_0x121283)){return _0x121283;}return writeFile(_0x51b6b0,_0x121283)[_0xcf96('0x26')](function(){return _0x121283;});}else{throw new db['Sequelize'][(_0xcf96('0x55'))](_0xcf96('0x98'));}})['then'](function(_0x516f56){return _0x13a093[_0xcf96('0x4c')](_0x516f56);})[_0xcf96('0x42')](handleError(_0x13a093));}; \ No newline at end of file +var _0x86bf=['index','VoiceRecording','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','length','find','catch','create','body','describe','uniqueid','value','existsSync','decryptFile','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','message','Not\x20found','downloads','sequelize','col','token','$and','push','format','%s.cypher','unlink','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','end','listBuckets','createBucket','upload','[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','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','../../components/encryptor','findOne','secrets','recording','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','language','sentiment','sentimentAccountId','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','json','limit','undefined','count','offset','status','Content-Range','save','then','stack','name','send'];(function(_0x2782f6,_0x85385f){var _0x503a87=function(_0x59c342){while(--_0x59c342){_0x2782f6['push'](_0x2782f6['shift']());}};_0x503a87(++_0x85385f);}(_0x86bf,0x195));var _0xf86b=function(_0x566888,_0x31ea03){_0x566888=_0x566888-0x0;var _0x1265d6=_0x86bf[_0x566888];return _0x1265d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf86b('0x0'));var zipdir=require(_0xf86b('0x1'));var jsonpatch=require(_0xf86b('0x2'));var rp=require(_0xf86b('0x3'));var moment=require(_0xf86b('0x4'));var BPromise=require(_0xf86b('0x5'));var Mustache=require(_0xf86b('0x6'));var util=require('util');var path=require(_0xf86b('0x7'));var sox=require(_0xf86b('0x8'));var csv=require(_0xf86b('0x9'));var ejs=require(_0xf86b('0xa'));var fs=require('fs');var fs_extra=require(_0xf86b('0xb'));var _=require(_0xf86b('0xc'));var squel=require('squel');var crypto=require(_0xf86b('0xd'));var jsforce=require(_0xf86b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf86b('0x9'));var querystring=require(_0xf86b('0xf'));var Papa=require(_0xf86b('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0xf86b('0x11'));var Redis=require('ioredis');var authService=require(_0xf86b('0x12'));var qs=require(_0xf86b('0x13'));var as=require(_0xf86b('0x14'));var hardwareService=require(_0xf86b('0x15'));var logger=require(_0xf86b('0x16'))(_0xf86b('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf86b('0x18'));var db=require(_0xf86b('0x19'))['db'];function respondWithStatusCode(_0x3d9862,_0x31162b){_0x31162b=_0x31162b||0xcc;return function(_0x8768a2){if(_0x8768a2){return _0x3d9862[_0xf86b('0x1a')](_0x31162b);}return _0x3d9862['status'](_0x31162b)['end']();};}function respondWithResult(_0x4d0f36,_0x14ad0f){_0x14ad0f=_0x14ad0f||0xc8;return function(_0x17b17d){if(_0x17b17d){return _0x4d0f36['status'](_0x14ad0f)[_0xf86b('0x1b')](_0x17b17d);}};}function respondWithFilteredResult(_0x59f19b,_0x26171c){return function(_0x3c91bd){if(_0x3c91bd){var _0x66db1=typeof _0x26171c['offset']==='undefined'&&typeof _0x26171c[_0xf86b('0x1c')]===_0xf86b('0x1d');var _0x4353e0=_0x3c91bd[_0xf86b('0x1e')];var _0x10f91b=_0x66db1?0x0:_0x26171c[_0xf86b('0x1f')];var _0x3f290a=_0x66db1?_0x3c91bd[_0xf86b('0x1e')]:_0x26171c[_0xf86b('0x1f')]+_0x26171c['limit'];var _0x189148;if(_0x3f290a>=_0x4353e0){_0x3f290a=_0x4353e0;_0x189148=0xc8;}else{_0x189148=0xce;}_0x59f19b[_0xf86b('0x20')](_0x189148);return _0x59f19b['set'](_0xf86b('0x21'),_0x10f91b+'-'+_0x3f290a+'/'+_0x4353e0)[_0xf86b('0x1b')](_0x3c91bd);}return null;};}function patchUpdates(_0x356ead){return function(_0x110027){try{jsonpatch['apply'](_0x110027,_0x356ead,!![]);}catch(_0x31ecbb){return BPromise['reject'](_0x31ecbb);}return _0x110027[_0xf86b('0x22')]();};}function saveUpdates(_0x5cdb0c,_0x213d6c){return function(_0x2c3333){if(_0x2c3333){return _0x2c3333['update'](_0x5cdb0c)[_0xf86b('0x23')](function(_0x4aeec7){return _0x4aeec7;});}return null;};}function removeEntity(_0x43e513,_0x308ba4){return function(_0x4df346){if(_0x4df346){return _0x4df346['destroy']()[_0xf86b('0x23')](function(){_0x43e513['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e02ee,_0x4ade4a){return function(_0x2f8bf3){if(!_0x2f8bf3){_0x3e02ee['sendStatus'](0x194);}return _0x2f8bf3;};}function handleError(_0x5098da,_0xbb29d7){_0xbb29d7=_0xbb29d7||0x1f4;return function(_0x56d6f5){logger['error'](_0x56d6f5[_0xf86b('0x24')]);if(_0x56d6f5[_0xf86b('0x25')]){delete _0x56d6f5[_0xf86b('0x25')];}_0x5098da[_0xf86b('0x20')](_0xbb29d7)[_0xf86b('0x26')](_0x56d6f5);};}exports[_0xf86b('0x27')]=function(_0x13c875,_0x2a8224){var _0x55b2af={},_0x3de85c={},_0xd4b0f3={'count':0x0,'rows':[]};var _0x1eeaa6=_['map'](db[_0xf86b('0x28')]['rawAttributes'],function(_0x1e1981){return{'name':_0x1e1981['fieldName'],'type':_0x1e1981[_0xf86b('0x29')]['key']};});_0x3de85c[_0xf86b('0x2a')]=_['differenceBy'](_['map'](_0x1eeaa6,'name'),['format']);_0x3de85c[_0xf86b('0x2b')]=_[_0xf86b('0x2c')](_0x13c875['query']);_0x3de85c[_0xf86b('0x2d')]=_[_0xf86b('0x2e')](_0x3de85c[_0xf86b('0x2a')],_0x3de85c[_0xf86b('0x2b')]);_0x55b2af['attributes']=_[_0xf86b('0x2e')](_0x3de85c[_0xf86b('0x2a')],qs[_0xf86b('0x2f')](_0x13c875['query'][_0xf86b('0x2f')]));_0x55b2af['attributes']=_0x55b2af[_0xf86b('0x30')]['length']?_0x55b2af[_0xf86b('0x30')]:_0x3de85c[_0xf86b('0x2a')];if(!_0x13c875['query'][_0xf86b('0x31')](_0xf86b('0x32'))){_0x55b2af[_0xf86b('0x1c')]=qs[_0xf86b('0x1c')](_0x13c875[_0xf86b('0x2b')][_0xf86b('0x1c')]);_0x55b2af['offset']=qs[_0xf86b('0x1f')](_0x13c875['query'][_0xf86b('0x1f')]);}_0x55b2af[_0xf86b('0x33')]=qs[_0xf86b('0x34')](_0x13c875['query']['sort']);_0x55b2af[_0xf86b('0x35')]=qs[_0xf86b('0x2d')](_[_0xf86b('0x36')](_0x13c875[_0xf86b('0x2b')],_0x3de85c[_0xf86b('0x2d')]),_0x1eeaa6);if(_0x13c875['query'][_0xf86b('0x37')]){_0x55b2af[_0xf86b('0x35')]=_[_0xf86b('0x38')](_0x55b2af[_0xf86b('0x35')],{'$or':_[_0xf86b('0x39')](_0x1eeaa6,function(_0xb3dad9){if(_0xb3dad9[_0xf86b('0x29')]!==_0xf86b('0x3a')){var _0xdafd9d={};_0xdafd9d[_0xb3dad9['name']]={'$like':'%'+_0x13c875[_0xf86b('0x2b')][_0xf86b('0x37')]+'%'};return _0xdafd9d;}})});}_0x55b2af=_['merge']({},_0x55b2af,_0x13c875['options']);var _0x3b8178={'where':_0x55b2af[_0xf86b('0x35')]};return db[_0xf86b('0x28')][_0xf86b('0x1e')](_0x3b8178)['then'](function(_0x213e34){_0xd4b0f3[_0xf86b('0x1e')]=_0x213e34;if(_0x13c875[_0xf86b('0x2b')][_0xf86b('0x3b')]){_0x55b2af[_0xf86b('0x3c')]=[{'all':!![]}];}return db[_0xf86b('0x28')][_0xf86b('0x3d')](_0x55b2af);})[_0xf86b('0x23')](function(_0x2c5d2a){_0xd4b0f3['rows']=_0x2c5d2a;return _0xd4b0f3;})[_0xf86b('0x23')](respondWithFilteredResult(_0x2a8224,_0x55b2af))['catch'](handleError(_0x2a8224,null));};exports[_0xf86b('0x3e')]=function(_0x281e3c,_0x2cc827){var _0x489d9a={'raw':![],'where':{'id':_0x281e3c[_0xf86b('0x3f')]['id']}},_0x5ab8d7={};_0x5ab8d7[_0xf86b('0x2a')]=_[_0xf86b('0x2c')](db[_0xf86b('0x28')][_0xf86b('0x40')]);_0x5ab8d7[_0xf86b('0x2b')]=_[_0xf86b('0x2c')](_0x281e3c[_0xf86b('0x2b')]);_0x5ab8d7[_0xf86b('0x2d')]=_[_0xf86b('0x2e')](_0x5ab8d7[_0xf86b('0x2a')],_0x5ab8d7[_0xf86b('0x2b')]);_0x489d9a['attributes']=_[_0xf86b('0x2e')](_0x5ab8d7[_0xf86b('0x2a')],qs[_0xf86b('0x2f')](_0x281e3c[_0xf86b('0x2b')]['fields']));_0x489d9a[_0xf86b('0x30')]=_0x489d9a[_0xf86b('0x30')][_0xf86b('0x41')]?_0x489d9a[_0xf86b('0x30')]:_0x5ab8d7[_0xf86b('0x2a')];if(_0x281e3c[_0xf86b('0x2b')][_0xf86b('0x3b')]){_0x489d9a['include']=[{'all':!![]}];}_0x489d9a=_[_0xf86b('0x38')]({},_0x489d9a,_0x281e3c['options']);return db[_0xf86b('0x28')][_0xf86b('0x42')](_0x489d9a)[_0xf86b('0x23')](handleEntityNotFound(_0x2cc827,null))[_0xf86b('0x23')](respondWithResult(_0x2cc827,null))[_0xf86b('0x43')](handleError(_0x2cc827,null));};exports['create']=function(_0x2d90fb,_0x2a1879){return db[_0xf86b('0x28')][_0xf86b('0x44')](_0x2d90fb['body'],{})[_0xf86b('0x23')](respondWithResult(_0x2a1879,0xc9))[_0xf86b('0x43')](handleError(_0x2a1879,null));};exports['update']=function(_0x4d3b3d,_0x19bb05){if(_0x4d3b3d[_0xf86b('0x45')]['id']){delete _0x4d3b3d[_0xf86b('0x45')]['id'];}return db[_0xf86b('0x28')][_0xf86b('0x42')]({'where':{'id':_0x4d3b3d[_0xf86b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x19bb05,null))[_0xf86b('0x23')](saveUpdates(_0x4d3b3d[_0xf86b('0x45')],null))['then'](respondWithResult(_0x19bb05,null))['catch'](handleError(_0x19bb05,null));};exports[_0xf86b('0x46')]=function(_0x317667,_0x5d223d){return db[_0xf86b('0x28')]['describe']()[_0xf86b('0x23')](respondWithResult(_0x5d223d,null))[_0xf86b('0x43')](handleError(_0x5d223d,null));};exports['download']=function(_0x22841f,_0x23ba26,_0x46480b){var _0x30b10f=require('../../components/encryptor');var _0x4d423d=![];var _0x181b0a={};if(_0x22841f[_0xf86b('0x2b')][_0xf86b('0x29')]&&_0x22841f[_0xf86b('0x2b')][_0xf86b('0x29')]===_0xf86b('0x47')){_0x181b0a['uniqueid']=_0x22841f[_0xf86b('0x3f')]['id'];}else{_0x181b0a['id']=_0x22841f['params']['id'];}return db[_0xf86b('0x28')][_0xf86b('0x42')]({'where':_0x181b0a,'attributes':['id',_0xf86b('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x23ba26,null))['then'](function(_0x2cb06e){if(_0x2cb06e){var _0x5e1ad3=_0x2cb06e[_0xf86b('0x48')];var _0xd0001e=util['format']('%s.cypher',_0x5e1ad3);if(fs[_0xf86b('0x49')](_0xd0001e)){_0x4d423d=!![];return _0x30b10f[_0xf86b('0x4a')](_0xd0001e,_0x5e1ad3,config['secrets']['recording'])[_0xf86b('0x23')](function(){return _0x2cb06e;});}return _0x2cb06e;}})[_0xf86b('0x23')](function(_0x286e07){if(_0x286e07){var _0x5cd49d=_0x286e07[_0xf86b('0x48')];if(!fs['existsSync'](_0x5cd49d)){throw new db[(_0xf86b('0x4b'))][(_0xf86b('0x4c'))](_0xf86b('0x4d'));}if(_0x286e07[_0xf86b('0x4e')]){return _0x23ba26[_0xf86b('0x4f')](_0x5cd49d,_0x286e07[_0xf86b('0x4e')]+path[_0xf86b('0x50')](_0x5cd49d),function(){if(_0x4d423d){fs['unlink'](_0x5cd49d);}});}else{return _0x23ba26[_0xf86b('0x4f')](_0x5cd49d,function(_0x15b81a){if(_0x4d423d){fs['unlink'](_0x5cd49d);}});}}})[_0xf86b('0x43')](function(_0x3e7008){if(_0x3e7008[_0xf86b('0x51')]===_0xf86b('0x4d')){_0x23ba26[_0xf86b('0x20')](0x194)[_0xf86b('0x26')](_0xf86b('0x52'));}else{return handleError(_0x23ba26,null);}});};exports[_0xf86b('0x53')]=function(_0x2e1029,_0x15d1a7,_0xd9a151){var _0x3f2920=require('../../components/encryptor');var _0x209064=![];var _0x4d86bf={'$and':[db[_0xf86b('0x54')][_0xf86b('0x35')](db['sequelize']['fn']('MD5',db[_0xf86b('0x54')][_0xf86b('0x55')](_0xf86b('0x47'))),_0x2e1029[_0xf86b('0x2b')][_0xf86b('0x56')])]};if(_0x2e1029[_0xf86b('0x2b')]['type']&&_0x2e1029[_0xf86b('0x2b')]['type']===_0xf86b('0x47')){_0x4d86bf[_0xf86b('0x57')][_0xf86b('0x58')]({'uniqueid':_0x2e1029[_0xf86b('0x3f')]['id']});}else{_0x4d86bf[_0xf86b('0x57')][_0xf86b('0x58')]({'id':_0x2e1029[_0xf86b('0x3f')]['id']});}return db[_0xf86b('0x28')][_0xf86b('0x42')]({'where':_0x4d86bf,'attributes':['id',_0xf86b('0x48')],'raw':!![]})[_0xf86b('0x23')](handleEntityNotFound(_0x15d1a7,null))[_0xf86b('0x23')](function(_0x3467d5){if(_0x3467d5){var _0xeedb38=util[_0xf86b('0x59')](_0xf86b('0x5a'),_0x3467d5[_0xf86b('0x48')]);if(fs[_0xf86b('0x49')](_0xeedb38)){_0x209064=!![];return _0x3f2920[_0xf86b('0x4a')](_0xeedb38,_0x3467d5[_0xf86b('0x48')],config['secrets']['recording'])['then'](function(){return _0x3467d5;});}return _0x3467d5;}})['then'](function(_0x49a476){if(_0x49a476){if(!fs['existsSync'](_0x49a476[_0xf86b('0x48')])){throw new db[(_0xf86b('0x4b'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x49a476[_0xf86b('0x4e')]){return _0x15d1a7['download'](_0x49a476[_0xf86b('0x48')],_0x49a476[_0xf86b('0x4e')]+path[_0xf86b('0x50')](_0x49a476[_0xf86b('0x48')]),function(){if(_0x209064){fs[_0xf86b('0x5b')](_0x49a476[_0xf86b('0x48')]);}});}else{return _0x15d1a7[_0xf86b('0x4f')](_0x49a476[_0xf86b('0x48')],function(_0x2a0d45){if(_0x209064){fs[_0xf86b('0x5b')](_0x49a476[_0xf86b('0x48')]);}});}}})[_0xf86b('0x43')](handleError(_0x15d1a7,null));};exports[_0xf86b('0x5c')]=function(_0x28c13b,_0x4b61f2){return db[_0xf86b('0x28')][_0xf86b('0x42')]({'where':{'id':_0x28c13b[_0xf86b('0x3f')]['id']}})[_0xf86b('0x23')](function(_0x176627){if(_[_0xf86b('0x5d')](_0x176627)){throw new ReferenceError('Entity\x20not\x20found');}return _0x176627;})['then'](function(_0x56db3c){var _0x2fc461=_0x56db3c[_0xf86b('0x48')];logger[_0xf86b('0x5e')](_0xf86b('0x5f'),_0x2fc461);if(!_['isNil'](_0x56db3c['value'])&&fs[_0xf86b('0x49')](_0x2fc461)){logger[_0xf86b('0x5e')](_0xf86b('0x60')+_0x2fc461+_0xf86b('0x61'));fs[_0xf86b('0x62')](_0x2fc461);}_0x2fc461=_0x2fc461+_0xf86b('0x63');if(!_[_0xf86b('0x5d')](_0x56db3c[_0xf86b('0x48')])&&fs[_0xf86b('0x49')](_0x2fc461)){logger['info'](_0xf86b('0x60')+_0x2fc461+_0xf86b('0x61'));fs[_0xf86b('0x62')](_0x2fc461);}return _0x56db3c;})[_0xf86b('0x23')](function(_0x159976){if(!_0x159976)throw new InternalError();return _0x159976[_0xf86b('0x5c')]();})['then'](function(){_0x4b61f2[_0xf86b('0x20')](0xcc)[_0xf86b('0x64')]();})[_0xf86b('0x43')](handleError(_0x4b61f2,null));};function getBucketslist(_0x3b011f,_0xb81ec8,_0x3eed9a){return new Promise(function(_0x4049ee,_0x5dfecf){var _0x66269=new AWS['S3']({'accessKeyId':_0xb81ec8,'secretAccessKey':_0x3b011f,'region':_0x3eed9a});_0x66269[_0xf86b('0x65')]({},function(_0x189a3d,_0x494ceb){if(_0x189a3d){return _0x5dfecf(_0x189a3d);}else{return _0x4049ee(_0x494ceb);}});});}function createBucket(_0x454bff,_0x557197,_0x3f063c,_0x29808c){return new Promise(function(_0x36cb73,_0x1f2f15){var _0x34fe10=new AWS['S3']({'accessKeyId':_0x557197,'secretAccessKey':_0x454bff,'region':_0x3f063c});_0x34fe10[_0xf86b('0x66')]({'Bucket':_0x29808c},function(_0xab0af9,_0x4d1186){if(_0xab0af9){return _0x1f2f15(_0xab0af9);}else{return _0x36cb73(_0x4d1186);}});});}function uploadFile(_0x295b3e,_0x2ae520,_0x4af3c7,_0x2a2f74,_0x4a3e93,_0x1991af){return new Promise(function(_0x547518,_0x36f7ec){var _0xc59590=new AWS['S3']({'accessKeyId':_0x2ae520,'secretAccessKey':_0x295b3e,'region':_0x4af3c7});_0xc59590[_0xf86b('0x67')]({'Bucket':_0x2a2f74,'Key':_0x4a3e93,'Body':_0x1991af},function(_0x76b0f5,_0x37c7c6){if(_0x76b0f5){return _0x36f7ec(_0x76b0f5);}else{return _0x547518(_0x37c7c6);}});});}function startTranscribe(_0x180a39,_0x55ada3,_0x51e5a9,_0x522f19,_0x4ebe3c,_0x83bc3f){return new Promise(function(_0x3e9639,_0x156985){var _0x3eadb9=new AWS['TranscribeService']({'accessKeyId':_0x55ada3,'secretAccessKey':_0x180a39,'region':_0x51e5a9});_0x3eadb9['startTranscriptionJob']({'TranscriptionJobName':_0x522f19,'LanguageCode':_0x4ebe3c,'Media':{'MediaFileUri':_0x83bc3f}},function(_0x5db691,_0x3752c6){if(_0x5db691){return _0x156985(_0x5db691);}else{return _0x3e9639(_0x3752c6);}});});}function transcribe(_0xdce14e,_0x383936,_0x141f3e,_0x8bdb30,_0x25db01,_0xa1f0c4,_0x421569){return new Promise(function(_0x13aa46,_0x4b3278){var _0x3b04e1={};logger[_0xf86b('0x5e')](util[_0xf86b('0x59')](_0xf86b('0x68'),_0xdce14e,_0x25db01));return uploadFile(_0x383936,_0x141f3e,_0x8bdb30,_0x25db01,path[_0xf86b('0x69')](_0xa1f0c4),fs['readFileSync'](_0xa1f0c4))[_0xf86b('0x23')](function(_0x3f3cb7){logger[_0xf86b('0x5e')](util[_0xf86b('0x59')](_0xf86b('0x6a'),_0xdce14e,_0x25db01,_0x3f3cb7[_0xf86b('0x6b')]));_0x3b04e1[_0xf86b('0x6c')]=_0x3f3cb7[_0xf86b('0x6d')];_0x3b04e1[_0xf86b('0x6e')]=_0x3f3cb7[_0xf86b('0x6b')];logger[_0xf86b('0x5e')](util[_0xf86b('0x59')](_0xf86b('0x6f'),_0xdce14e));return startTranscribe(_0x383936,_0x141f3e,_0x8bdb30,uuidv4(),_0x421569,_0x3f3cb7[_0xf86b('0x6b')]);})[_0xf86b('0x23')](function(_0x4d6e91){logger['info'](util[_0xf86b('0x59')](_0xf86b('0x70'),_0xdce14e,_0x4d6e91[_0xf86b('0x71')][_0xf86b('0x72')]));_0x3b04e1['transcribeName']=_0x4d6e91[_0xf86b('0x71')][_0xf86b('0x72')];_0x3b04e1['transcribeStatus']=_0x4d6e91[_0xf86b('0x71')][_0xf86b('0x73')];return _0x13aa46(_0x3b04e1);})[_0xf86b('0x43')](function(_0x123e46){return _0x4b3278(_0x123e46);});});}exports['runTranscribe']=function(_0x49db26,_0x523006,_0x4616af){var _0x77b1c1;var _0x451d56;var _0x6fd7b5;var _0x3221eb=require(_0xf86b('0x74'));return db[_0xf86b('0x28')][_0xf86b('0x75')]({'where':{'id':_0x49db26[_0xf86b('0x3f')]['id']}})[_0xf86b('0x23')](function(_0x211bfb){if(_0x211bfb){var _0x1cf004=util['format']('%s.cypher',_0x211bfb[_0xf86b('0x48')]);if(fs[_0xf86b('0x49')](_0x1cf004)){cypher=!![];return _0x3221eb[_0xf86b('0x4a')](_0x1cf004,_0x211bfb['value'],config[_0xf86b('0x76')][_0xf86b('0x77')])[_0xf86b('0x23')](function(){return _0x211bfb;});}return _0x211bfb;}})[_0xf86b('0x23')](function(_0x67d740){if(!_0x67d740){throw new db[(_0xf86b('0x4b'))][(_0xf86b('0x4c'))](_0xf86b('0x78'));}_0x451d56=_0x67d740;return db[_0xf86b('0x79')][_0xf86b('0x75')]({'where':{'id':0x1}});})[_0xf86b('0x23')](handleEntityNotFound(_0x523006,null))[_0xf86b('0x23')](function(_0x4e425a){if(_0x4e425a){_0x77b1c1=_0x4e425a;if(!_0x77b1c1[_0xf86b('0x7a')]||!_0x77b1c1['transcribeAccountId']||!_0x77b1c1[_0xf86b('0x7b')]||!_0x77b1c1[_0xf86b('0x7c')]||!_0x77b1c1[_0xf86b('0x6c')]){throw new db[(_0xf86b('0x4b'))][(_0xf86b('0x4c'))]('Transcribe\x20not\x20configured');}if(_0x49db26[_0xf86b('0x45')]['runSentiment']&&(!_0x77b1c1[_0xf86b('0x7d')]||!_0x77b1c1[_0xf86b('0x7e')]||!_0x77b1c1['sentimentRegion']||!_0x77b1c1['language']||!_0x77b1c1[_0xf86b('0x6c')])){throw new db[(_0xf86b('0x4b'))][(_0xf86b('0x4c'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xf86b('0x7f')]['findOne']({'where':{'id':_0x77b1c1[_0xf86b('0x80')]}});}})[_0xf86b('0x23')](function(_0x5bed1c){if(!_0x5bed1c){throw new db['Sequelize']['ValidationError'](_0xf86b('0x81'));}if(!_0x5bed1c[_0xf86b('0x82')]||!_0x5bed1c[_0xf86b('0x83')]){throw new db[(_0xf86b('0x4b'))][(_0xf86b('0x4c'))](_0xf86b('0x84'));}_0x6fd7b5=_0x5bed1c;return getBucketslist(_0x6fd7b5[_0xf86b('0x82')],_0x6fd7b5[_0xf86b('0x83')],_0x77b1c1[_0xf86b('0x7b')]);})[_0xf86b('0x23')](function(_0x489056){if(_0x489056&&_0x489056[_0xf86b('0x85')]){var _0x27b5e3=_[_0xf86b('0x42')](_0x489056[_0xf86b('0x85')],function(_0x1259a4){return _0x1259a4[_0xf86b('0x86')]===_0x77b1c1[_0xf86b('0x6c')];});if(!_0x27b5e3){logger[_0xf86b('0x5e')](util[_0xf86b('0x59')](_0xf86b('0x87'),_0x49db26[_0xf86b('0x3f')]['id'],_0x77b1c1[_0xf86b('0x6c')]));return createBucket(_0x6fd7b5[_0xf86b('0x82')],_0x6fd7b5[_0xf86b('0x83')],_0x77b1c1[_0xf86b('0x7b')],_0x77b1c1['bucket']);}logger[_0xf86b('0x5e')](util[_0xf86b('0x59')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x49db26[_0xf86b('0x3f')]['id'],_0x77b1c1[_0xf86b('0x6c')]));return;}})['then'](function(_0x6a8b6e){if(_0x451d56[_0xf86b('0x88')]===_0xf86b('0x89')){return transcribe(_0x49db26[_0xf86b('0x3f')]['id'],_0x6fd7b5[_0xf86b('0x82')],_0x6fd7b5[_0xf86b('0x83')],_0x77b1c1['transcribeRegion'],_0x77b1c1[_0xf86b('0x6c')],_0x451d56[_0xf86b('0x48')],_0x77b1c1['language']);}else{logger[_0xf86b('0x5e')](util[_0xf86b('0x59')](_0xf86b('0x8a'),_0x49db26[_0xf86b('0x3f')]['id']));return{'transcribeStatus':_0xf86b('0x8b')};}})['then'](function(_0xc85cb1){if(_0xc85cb1){_0xc85cb1[_0xf86b('0x8c')]=_0x49db26['body']['runSentiment'];return _0x451d56[_0xf86b('0x8d')](_0xc85cb1);}})[_0xf86b('0x23')](respondWithResult(_0x523006,null))[_0xf86b('0x43')](handleError(_0x523006,null));};function writeFile(_0x3119cb,_0x8a63c2){return new Promise(function(_0x16cb75,_0x42c869){fs[_0xf86b('0x8e')](_0x8a63c2,_0x3119cb,function(_0x45a70d,_0x11e286){if(_0x45a70d){return _0x42c869(_0x45a70d);}else{return _0x16cb75(_0x11e286);}});});}exports[_0xf86b('0x8f')]=function(_0x52de2b,_0x1de28b,_0x122441){return db[_0xf86b('0x28')][_0xf86b('0x75')]({'where':{'id':_0x52de2b[_0xf86b('0x3f')]['id']}})[_0xf86b('0x23')](handleEntityNotFound(_0x1de28b))[_0xf86b('0x23')](function(_0x5e8395){if(_0x5e8395&&_0x5e8395[_0xf86b('0x90')]){var _0x28bea9=_0x5e8395[_0xf86b('0x90')];var _0x4e4f5b=config['root']+_0xf86b('0x91')+_0x5e8395['id']+_0xf86b('0x92');if(fs[_0xf86b('0x49')](_0x4e4f5b)){return _0x4e4f5b;}return writeFile(_0x28bea9,_0x4e4f5b)[_0xf86b('0x23')](function(){return _0x4e4f5b;});}else{throw new db[(_0xf86b('0x4b'))][(_0xf86b('0x4c'))](_0xf86b('0x93'));}})['then'](function(_0x4cab72){return _0x1de28b[_0xf86b('0x4f')](_0x4cab72);})[_0xf86b('0x43')](handleError(_0x1de28b));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 16a5dd6..a13b8d2 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 _0x46af=['exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes'];(function(_0x26a1dc,_0x380fb3){var _0x529678=function(_0x2c8c14){while(--_0x2c8c14){_0x26a1dc['push'](_0x26a1dc['shift']());}};_0x529678(++_0x380fb3);}(_0x46af,0x1a9));var _0xf46a=function(_0x1dd219,_0x1ec3cb){_0x1dd219=_0x1dd219-0x0;var _0x3a25a1=_0x46af[_0x1dd219];return _0x3a25a1;};'use strict';var _=require(_0xf46a('0x0'));var util=require('util');var logger=require(_0xf46a('0x1'))(_0xf46a('0x2'));var moment=require(_0xf46a('0x3'));var BPromise=require(_0xf46a('0x4'));var rp=require(_0xf46a('0x5'));var fs=require('fs');var path=require(_0xf46a('0x6'));var rimraf=require(_0xf46a('0x7'));var config=require(_0xf46a('0x8'));var attributes=require(_0xf46a('0x9'));module[_0xf46a('0xa')]=function(_0x2b28d3,_0x2cd230){return _0x2b28d3[_0xf46a('0xb')](_0xf46a('0xc'),attributes,{'tableName':_0xf46a('0xd'),'paranoid':![],'indexes':[{'name':_0xf46a('0xe'),'fields':[_0xf46a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeeeb=['path','rimraf','../../config/environment','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xbe9008,_0x5dbaa5){var _0x1e10e6=function(_0xa4ac0e){while(--_0xa4ac0e){_0xbe9008['push'](_0xbe9008['shift']());}};_0x1e10e6(++_0x5dbaa5);}(_0xeeeb,0x1d9));var _0xbeee=function(_0x65906,_0x4ccbff){_0x65906=_0x65906-0x0;var _0x3aebbe=_0xeeeb[_0x65906];return _0x3aebbe;};'use strict';var _=require(_0xbeee('0x0'));var util=require(_0xbeee('0x1'));var logger=require(_0xbeee('0x2'))(_0xbeee('0x3'));var moment=require(_0xbeee('0x4'));var BPromise=require(_0xbeee('0x5'));var rp=require(_0xbeee('0x6'));var fs=require('fs');var path=require(_0xbeee('0x7'));var rimraf=require(_0xbeee('0x8'));var config=require(_0xbeee('0x9'));var attributes=require(_0xbeee('0xa'));module[_0xbeee('0xb')]=function(_0xe5c536,_0x47a187){return _0xe5c536['define'](_0xbeee('0xc'),attributes,{'tableName':_0xbeee('0xd'),'paranoid':![],'indexes':[{'name':_0xbeee('0xe'),'fields':[_0xbeee('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 9db6004..bc08597 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 _0x5c3c=['../../config/environment','jayson/promise','client','http','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x16ae01,_0x198e7d){var _0x2d73f9=function(_0x4d5f9f){while(--_0x4d5f9f){_0x16ae01['push'](_0x16ae01['shift']());}};_0x2d73f9(++_0x198e7d);}(_0x5c3c,0x132));var _0xc5c3=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x5c3c[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});}exports[_0xc5c3('0x17')]=function(_0x2ff158){var _0x13c867=this;return new Promise(function(_0x28bae6,_0x5e11d5){return db[_0xc5c3('0x18')][_0xc5c3('0x19')](_0x2ff158[_0xc5c3('0x1a')],{'raw':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158[_0xc5c3('0x1b')][_0xc5c3('0x1d')]||null:null,'attributes':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1e')]||null:null,'limit':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158[_0xc5c3('0x1b')][_0xc5c3('0x1f')]||null:null})[_0xc5c3('0xd')](function(_0x67445){logger[_0xc5c3('0x15')]('UpdateVoiceRecording',_0x2ff158);logger['debug'](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x67445));_0x28bae6(_0x67445);})['catch'](function(_0x5c7329){logger[_0xc5c3('0x12')](_0xc5c3('0x17'),_0x5c7329[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x5c7329['message']));});});};exports[_0xc5c3('0x20')]=function(_0x22f607){var _0x20c506=this;return new Promise(function(_0x29791c,_0x5caf85){var _0x21efd6=require('../../components/encryptor');var _0x2eacec;return db['Setting'][_0xc5c3('0x21')]({'attributes':['id',_0xc5c3('0x22')],'where':{'id':0x1},'raw':!![]})[_0xc5c3('0xd')](function(_0x4773c5){_0x2eacec=_0x4773c5;return db[_0xc5c3('0x18')][_0xc5c3('0x23')](_0x22f607[_0xc5c3('0x1a')]);})['then'](function(_0xbcafd6){if(_0x2eacec['callRecordingEncryption']&&fs[_0xc5c3('0x24')](_0xbcafd6[_0xc5c3('0x25')])){var _0x5b26e9=util['format'](_0xc5c3('0x26'),_0xbcafd6[_0xc5c3('0x25')]);return _0x21efd6[_0xc5c3('0x27')](_0xbcafd6[_0xc5c3('0x25')],_0x5b26e9,config['secrets'][_0xc5c3('0x28')])[_0xc5c3('0xd')](function(){fs[_0xc5c3('0x29')](_0xbcafd6[_0xc5c3('0x25')]);logger[_0xc5c3('0x15')](_0xc5c3('0x2a'));return _0xbcafd6;});}return _0xbcafd6;})[_0xc5c3('0xd')](function(_0x1e6749){logger[_0xc5c3('0x15')]('CreateVoiceRecording',_0x22f607);logger[_0xc5c3('0x2b')](_0xc5c3('0x20'),_0x22f607,JSON[_0xc5c3('0x11')](_0x1e6749));_0x29791c(_0x1e6749);})[_0xc5c3('0x2c')](function(_0x330391){logger[_0xc5c3('0x12')](_0xc5c3('0x20'),_0x330391['message'],_0x22f607);_0x5caf85(_0x20c506['error'](0x1f4,_0x330391[_0xc5c3('0x14')]));});});}; \ No newline at end of file +var _0x5430=['info','request\x20sent','debug','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','UpdateVoiceRecording','VoiceRecording','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','format','%s.cypher','value','encryptFile','secrets','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x1d890c,_0x2a0caf){var _0x120b4f=function(_0x5a8a64){while(--_0x5a8a64){_0x1d890c['push'](_0x1d890c['shift']());}};_0x120b4f(++_0x2a0caf);}(_0x5430,0x10c));var _0x0543=function(_0x546bf6,_0x295662){_0x546bf6=_0x546bf6-0x0;var _0x34dc03=_0x5430[_0x546bf6];return _0x34dc03;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['update'](_0x20b396['body'],{'raw':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b396['options']?_0x20b396[_0x0543('0x17')]['where']||null:null,'attributes':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')]['attributes']||null:null,'limit':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x19')]||null:null})[_0x0543('0xb')](function(_0x37347e){logger[_0x0543('0xc')]('UpdateVoiceRecording',_0x20b396);logger['debug']('UpdateVoiceRecording',_0x20b396,JSON[_0x0543('0xf')](_0x37347e));_0x577cf0(_0x37347e);})[_0x0543('0x1a')](function(_0x15ebeb){logger[_0x0543('0x10')](_0x0543('0x15'),_0x15ebeb[_0x0543('0x13')],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x15ebeb[_0x0543('0x13')]));});});};exports[_0x0543('0x1b')]=function(_0xf1eccf){var _0x40a261=this;return new Promise(function(_0x21fc63,_0x547a88){var _0x25e6f1=require(_0x0543('0x1c'));var _0x30ad9e;return db['Setting'][_0x0543('0x1d')]({'attributes':['id',_0x0543('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0543('0xb')](function(_0x10b881){_0x30ad9e=_0x10b881;return db['VoiceRecording'][_0x0543('0x1f')](_0xf1eccf[_0x0543('0x20')]);})['then'](function(_0x576084){if(_0x30ad9e[_0x0543('0x1e')]&&fs[_0x0543('0x21')](_0x576084['value'])){var _0x3b879b=util[_0x0543('0x22')](_0x0543('0x23'),_0x576084[_0x0543('0x24')]);return _0x25e6f1[_0x0543('0x25')](_0x576084[_0x0543('0x24')],_0x3b879b,config[_0x0543('0x26')]['recording'])[_0x0543('0xb')](function(){fs['unlink'](_0x576084[_0x0543('0x24')]);logger[_0x0543('0xc')](_0x0543('0x27'));return _0x576084;});}return _0x576084;})[_0x0543('0xb')](function(_0x28307f){logger['info'](_0x0543('0x1b'),_0xf1eccf);logger['debug'](_0x0543('0x1b'),_0xf1eccf,JSON[_0x0543('0xf')](_0x28307f));_0x21fc63(_0x28307f);})[_0x0543('0x1a')](function(_0x327027){logger['error'](_0x0543('0x1b'),_0x327027['message'],_0xf1eccf);_0x547a88(_0x40a261[_0x0543('0x10')](0x1f4,_0x327027[_0x0543('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 6a127c0..f65945d 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 _0xbe9f=['../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x17489a,_0x46fece){var _0x2024a8=function(_0x51620c){while(--_0x51620c){_0x17489a['push'](_0x17489a['shift']());}};_0x2024a8(++_0x46fece);}(_0xbe9f,0x12b));var _0xfbe9=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xbe9f[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0xfbe9('0x0'));var util=require(_0xfbe9('0x1'));var path=require(_0xfbe9('0x2'));var timeout=require('connect-timeout');var express=require(_0xfbe9('0x3'));var router=express[_0xfbe9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfbe9('0x5'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0xfbe9('0x6')]('/',auth[_0xfbe9('0x7')](),controller[_0xfbe9('0x8')]);router[_0xfbe9('0x6')]('/describe',auth[_0xfbe9('0x7')](),controller[_0xfbe9('0x9')]);router['get'](_0xfbe9('0xa'),auth['isAuthenticated'](),controller[_0xfbe9('0xb')]);router[_0xfbe9('0xc')]('/',auth[_0xfbe9('0x7')](),controller[_0xfbe9('0xd')]);router[_0xfbe9('0xe')](_0xfbe9('0xa'),auth['isAuthenticated'](),controller[_0xfbe9('0xf')]);router[_0xfbe9('0x10')]('/:id',auth[_0xfbe9('0x7')](),controller[_0xfbe9('0x11')]);module[_0xfbe9('0x12')]=router; \ No newline at end of file +var _0xf53d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x46041d,_0x42cd6b){var _0xf9e9ee=function(_0x5f59ef){while(--_0x5f59ef){_0x46041d['push'](_0x46041d['shift']());}};_0xf9e9ee(++_0x42cd6b);}(_0xf53d,0x15a));var _0xdf53=function(_0x59a795,_0x30e016){_0x59a795=_0x59a795-0x0;var _0x284c39=_0xf53d[_0x59a795];return _0x284c39;};'use strict';var multer=require(_0xdf53('0x0'));var util=require(_0xdf53('0x1'));var path=require(_0xdf53('0x2'));var timeout=require(_0xdf53('0x3'));var express=require(_0xdf53('0x4'));var router=express['Router']();var fs_extra=require(_0xdf53('0x5'));var auth=require(_0xdf53('0x6'));var interaction=require(_0xdf53('0x7'));var config=require(_0xdf53('0x8'));var controller=require(_0xdf53('0x9'));router[_0xdf53('0xa')]('/',auth[_0xdf53('0xb')](),controller['index']);router[_0xdf53('0xa')](_0xdf53('0xc'),auth[_0xdf53('0xb')](),controller[_0xdf53('0xd')]);router[_0xdf53('0xa')](_0xdf53('0xe'),auth[_0xdf53('0xb')](),controller[_0xdf53('0xf')]);router[_0xdf53('0x10')]('/',auth['isAuthenticated'](),controller[_0xdf53('0x11')]);router[_0xdf53('0x12')](_0xdf53('0xe'),auth[_0xdf53('0xb')](),controller[_0xdf53('0x13')]);router[_0xdf53('0x14')](_0xdf53('0xe'),auth[_0xdf53('0xb')](),controller['destroy']);module[_0xdf53('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 0abefb6..054a0a1 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 _0xa59f=['ENUM','blind','STRING','Yes','sequelize','moment','exports'];(function(_0x4639ca,_0x214206){var _0x412b10=function(_0x1033f6){while(--_0x1033f6){_0x4639ca['push'](_0x4639ca['shift']());}};_0x412b10(++_0x214206);}(_0xa59f,0x177));var _0xfa59=function(_0x2942ec,_0x30597e){_0x2942ec=_0x2942ec-0x0;var _0x192ec9=_0xa59f[_0x2942ec];return _0x192ec9;};'use strict';var Sequelize=require(_0xfa59('0x0'));var moment=require(_0xfa59('0x1'));module[_0xfa59('0x2')]={'type':{'type':Sequelize[_0xfa59('0x3')](_0xfa59('0x4'),'attended')},'result':{'type':Sequelize[_0xfa59('0x5')]},'transfererchannel':{'type':Sequelize[_0xfa59('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xfa59('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xfa59('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xfa59('0x5')]},'transferercontext':{'type':Sequelize[_0xfa59('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xfa59('0x5')]},'transfereechannel':{'type':Sequelize[_0xfa59('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xfa59('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xfa59('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xfa59('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xfa59('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xfa59('0x5')]},'transfereecontext':{'type':Sequelize[_0xfa59('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0xfa59('0x6'),'No')},'context':{'type':Sequelize[_0xfa59('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa0c7=['Yes','sequelize','ENUM','blind','attended','STRING'];(function(_0x2275e1,_0x4241b9){var _0x18cb53=function(_0x2443e7){while(--_0x2443e7){_0x2275e1['push'](_0x2275e1['shift']());}};_0x18cb53(++_0x4241b9);}(_0xa0c7,0xf1));var _0x7a0c=function(_0x1ccbcb,_0x3c7d5a){_0x1ccbcb=_0x1ccbcb-0x0;var _0x187568=_0xa0c7[_0x1ccbcb];return _0x187568;};'use strict';var Sequelize=require(_0x7a0c('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x7a0c('0x1')](_0x7a0c('0x2'),_0x7a0c('0x3'))},'result':{'type':Sequelize[_0x7a0c('0x4')]},'transfererchannel':{'type':Sequelize[_0x7a0c('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x7a0c('0x4')]},'transferercalleridname':{'type':Sequelize[_0x7a0c('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7a0c('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x7a0c('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x7a0c('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x7a0c('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x7a0c('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x7a0c('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x7a0c('0x4')]},'transfereecontext':{'type':Sequelize[_0x7a0c('0x4')]},'transfereeexten':{'type':Sequelize[_0x7a0c('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x7a0c('0x1')](_0x7a0c('0x5'),'No')},'context':{'type':Sequelize[_0x7a0c('0x4')]},'extension':{'type':Sequelize[_0x7a0c('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index ef96cb7..3c2513e 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 _0x9a26=['stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x54620d,_0x178332){var _0x4ce2b7=function(_0xd4d4fa){while(--_0xd4d4fa){_0x54620d['push'](_0x54620d['shift']());}};_0x4ce2b7(++_0x178332);}(_0x9a26,0x75));var _0x69a2=function(_0x406466,_0x296188){_0x406466=_0x406466-0x0;var _0x38d3da=_0x9a26[_0x406466];return _0x38d3da;};'use strict';var emlformat=require(_0x69a2('0x0'));var rimraf=require(_0x69a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x69a2('0x2'));var rp=require(_0x69a2('0x3'));var moment=require(_0x69a2('0x4'));var BPromise=require(_0x69a2('0x5'));var Mustache=require('mustache');var util=require(_0x69a2('0x6'));var path=require('path');var sox=require(_0x69a2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x69a2('0x8'));var _=require(_0x69a2('0x9'));var squel=require(_0x69a2('0xa'));var crypto=require(_0x69a2('0xb'));var jsforce=require(_0x69a2('0xc'));var deskjs=require(_0x69a2('0xd'));var toCsv=require(_0x69a2('0xe'));var querystring=require('querystring');var Papa=require(_0x69a2('0xf'));var Redis=require(_0x69a2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x69a2('0x11'));var as=require(_0x69a2('0x12'));var hardwareService=require(_0x69a2('0x13'));var logger=require(_0x69a2('0x14'))(_0x69a2('0x15'));var utils=require('../../config/utils');var config=require(_0x69a2('0x16'));var licenseUtil=require(_0x69a2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfe6882,_0x1007d6){_0x1007d6=_0x1007d6||0xcc;return function(_0x58fef2){if(_0x58fef2){return _0xfe6882[_0x69a2('0x18')](_0x1007d6);}return _0xfe6882[_0x69a2('0x19')](_0x1007d6)[_0x69a2('0x1a')]();};}function respondWithResult(_0x1a7d74,_0x1b275a){_0x1b275a=_0x1b275a||0xc8;return function(_0x37ea5a){if(_0x37ea5a){return _0x1a7d74[_0x69a2('0x19')](_0x1b275a)[_0x69a2('0x1b')](_0x37ea5a);}};}function respondWithFilteredResult(_0x982d7b,_0x230967){return function(_0x24a863){if(_0x24a863){var _0x3999f3=typeof _0x230967[_0x69a2('0x1c')]==='undefined'&&typeof _0x230967[_0x69a2('0x1d')]===_0x69a2('0x1e');var _0x3305fd=_0x24a863[_0x69a2('0x1f')];var _0x559d58=_0x3999f3?0x0:_0x230967[_0x69a2('0x1c')];var _0x2d2dad=_0x3999f3?_0x24a863[_0x69a2('0x1f')]:_0x230967['offset']+_0x230967[_0x69a2('0x1d')];var _0x1b4e11;if(_0x2d2dad>=_0x3305fd){_0x2d2dad=_0x3305fd;_0x1b4e11=0xc8;}else{_0x1b4e11=0xce;}_0x982d7b[_0x69a2('0x19')](_0x1b4e11);return _0x982d7b[_0x69a2('0x20')](_0x69a2('0x21'),_0x559d58+'-'+_0x2d2dad+'/'+_0x3305fd)[_0x69a2('0x1b')](_0x24a863);}return null;};}function patchUpdates(_0x480b1e){return function(_0x54f684){try{jsonpatch[_0x69a2('0x22')](_0x54f684,_0x480b1e,!![]);}catch(_0x56f89b){return BPromise[_0x69a2('0x23')](_0x56f89b);}return _0x54f684[_0x69a2('0x24')]();};}function saveUpdates(_0x2e683e,_0x4202e0){return function(_0x1f2fee){if(_0x1f2fee){return _0x1f2fee[_0x69a2('0x25')](_0x2e683e)[_0x69a2('0x26')](function(_0x524927){return _0x524927;});}return null;};}function removeEntity(_0x4385d9,_0x350dec){return function(_0xa17fd5){if(_0xa17fd5){return _0xa17fd5[_0x69a2('0x27')]()[_0x69a2('0x26')](function(){_0x4385d9[_0x69a2('0x19')](0xcc)[_0x69a2('0x1a')]();});}};}function handleEntityNotFound(_0x531a93,_0x360a94){return function(_0x51ebed){if(!_0x51ebed){_0x531a93[_0x69a2('0x18')](0x194);}return _0x51ebed;};}function handleError(_0x268fd7,_0x166718){_0x166718=_0x166718||0x1f4;return function(_0x25e3f7){logger[_0x69a2('0x28')](_0x25e3f7[_0x69a2('0x29')]);if(_0x25e3f7[_0x69a2('0x2a')]){delete _0x25e3f7[_0x69a2('0x2a')];}_0x268fd7['status'](_0x166718)[_0x69a2('0x2b')](_0x25e3f7);};}exports['index']=function(_0x3734b,_0xf6e825){var _0x223e04={},_0x58d669={},_0x21f84c={'count':0x0,'rows':[]};var _0x528cc0=_[_0x69a2('0x2c')](db[_0x69a2('0x2d')][_0x69a2('0x2e')],function(_0x4b74bd){return{'name':_0x4b74bd[_0x69a2('0x2f')],'type':_0x4b74bd[_0x69a2('0x30')][_0x69a2('0x31')]};});_0x58d669[_0x69a2('0x32')]=_[_0x69a2('0x2c')](_0x528cc0,_0x69a2('0x2a'));_0x58d669[_0x69a2('0x33')]=_[_0x69a2('0x34')](_0x3734b[_0x69a2('0x33')]);_0x58d669[_0x69a2('0x35')]=_['intersection'](_0x58d669[_0x69a2('0x32')],_0x58d669[_0x69a2('0x33')]);_0x223e04[_0x69a2('0x36')]=_[_0x69a2('0x37')](_0x58d669[_0x69a2('0x32')],qs[_0x69a2('0x38')](_0x3734b['query'][_0x69a2('0x38')]));_0x223e04[_0x69a2('0x36')]=_0x223e04['attributes'][_0x69a2('0x39')]?_0x223e04['attributes']:_0x58d669[_0x69a2('0x32')];if(!_0x3734b[_0x69a2('0x33')][_0x69a2('0x3a')](_0x69a2('0x3b'))){_0x223e04[_0x69a2('0x1d')]=qs[_0x69a2('0x1d')](_0x3734b['query'][_0x69a2('0x1d')]);_0x223e04[_0x69a2('0x1c')]=qs['offset'](_0x3734b['query'][_0x69a2('0x1c')]);}_0x223e04[_0x69a2('0x3c')]=qs[_0x69a2('0x3d')](_0x3734b[_0x69a2('0x33')][_0x69a2('0x3d')]);_0x223e04['where']=qs[_0x69a2('0x35')](_[_0x69a2('0x3e')](_0x3734b[_0x69a2('0x33')],_0x58d669['filters']),_0x528cc0);if(_0x3734b[_0x69a2('0x33')][_0x69a2('0x3f')]){_0x223e04[_0x69a2('0x40')]=_['merge'](_0x223e04[_0x69a2('0x40')],{'$or':_[_0x69a2('0x2c')](_0x528cc0,function(_0x561caa){if(_0x561caa[_0x69a2('0x30')]!==_0x69a2('0x41')){var _0x455ca1={};_0x455ca1[_0x561caa[_0x69a2('0x2a')]]={'$like':'%'+_0x3734b['query']['filter']+'%'};return _0x455ca1;}})});}_0x223e04=_[_0x69a2('0x42')]({},_0x223e04,_0x3734b[_0x69a2('0x43')]);var _0x3a3297={'where':_0x223e04['where']};return db[_0x69a2('0x2d')][_0x69a2('0x1f')](_0x3a3297)[_0x69a2('0x26')](function(_0x56db80){_0x21f84c[_0x69a2('0x1f')]=_0x56db80;if(_0x3734b['query']['includeAll']){_0x223e04[_0x69a2('0x44')]=[{'all':!![]}];}return db[_0x69a2('0x2d')][_0x69a2('0x45')](_0x223e04);})[_0x69a2('0x26')](function(_0x10637d){_0x21f84c[_0x69a2('0x46')]=_0x10637d;return _0x21f84c;})['then'](respondWithFilteredResult(_0xf6e825,_0x223e04))[_0x69a2('0x47')](handleError(_0xf6e825,null));};exports[_0x69a2('0x48')]=function(_0x293e44,_0x308b9e){var _0x2ea1b9={'raw':!![],'where':{'id':_0x293e44['params']['id']}},_0x5cc1ee={};_0x5cc1ee[_0x69a2('0x32')]=_[_0x69a2('0x34')](db['VoiceTransferReport'][_0x69a2('0x2e')]);_0x5cc1ee[_0x69a2('0x33')]=_[_0x69a2('0x34')](_0x293e44['query']);_0x5cc1ee[_0x69a2('0x35')]=_[_0x69a2('0x37')](_0x5cc1ee[_0x69a2('0x32')],_0x5cc1ee[_0x69a2('0x33')]);_0x2ea1b9[_0x69a2('0x36')]=_[_0x69a2('0x37')](_0x5cc1ee[_0x69a2('0x32')],qs['fields'](_0x293e44['query'][_0x69a2('0x38')]));_0x2ea1b9[_0x69a2('0x36')]=_0x2ea1b9['attributes'][_0x69a2('0x39')]?_0x2ea1b9['attributes']:_0x5cc1ee[_0x69a2('0x32')];if(_0x293e44[_0x69a2('0x33')][_0x69a2('0x49')]){_0x2ea1b9[_0x69a2('0x44')]=[{'all':!![]}];}_0x2ea1b9=_[_0x69a2('0x42')]({},_0x2ea1b9,_0x293e44['options']);return db[_0x69a2('0x2d')][_0x69a2('0x4a')](_0x2ea1b9)[_0x69a2('0x26')](handleEntityNotFound(_0x308b9e,null))['then'](respondWithResult(_0x308b9e,null))['catch'](handleError(_0x308b9e,null));};exports['create']=function(_0x2b9346,_0x5b3dd1){return db[_0x69a2('0x2d')][_0x69a2('0x4b')](_0x2b9346[_0x69a2('0x4c')],{})[_0x69a2('0x26')](respondWithResult(_0x5b3dd1,0xc9))[_0x69a2('0x47')](handleError(_0x5b3dd1,null));};exports['update']=function(_0x1b113c,_0x3e1d3a){if(_0x1b113c[_0x69a2('0x4c')]['id']){delete _0x1b113c[_0x69a2('0x4c')]['id'];}return db['VoiceTransferReport'][_0x69a2('0x4a')]({'where':{'id':_0x1b113c[_0x69a2('0x4d')]['id']}})[_0x69a2('0x26')](handleEntityNotFound(_0x3e1d3a,null))['then'](saveUpdates(_0x1b113c['body'],null))[_0x69a2('0x26')](respondWithResult(_0x3e1d3a,null))[_0x69a2('0x47')](handleError(_0x3e1d3a,null));};exports['destroy']=function(_0x3e0ed4,_0x26a5a0){return db[_0x69a2('0x2d')][_0x69a2('0x4a')]({'where':{'id':_0x3e0ed4['params']['id']}})[_0x69a2('0x26')](handleEntityNotFound(_0x26a5a0,null))['then'](removeEntity(_0x26a5a0,null))['catch'](handleError(_0x26a5a0,null));};exports[_0x69a2('0x4e')]=function(_0xd09c44,_0x52aa17){return db['VoiceTransferReport'][_0x69a2('0x4e')]()[_0x69a2('0x26')](respondWithResult(_0x52aa17,null))[_0x69a2('0x47')](handleError(_0x52aa17,null));}; \ No newline at end of file +var _0xf6eb=['hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','length','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields'];(function(_0x4e4708,_0x4c8d1a){var _0x3991e7=function(_0x2e9563){while(--_0x2e9563){_0x4e4708['push'](_0x4e4708['shift']());}};_0x3991e7(++_0x4c8d1a);}(_0xf6eb,0x101));var _0xbf6e=function(_0x23365d,_0xa7d9f3){_0x23365d=_0x23365d-0x0;var _0x171465=_0xf6eb[_0x23365d];return _0x171465;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf6e('0x0'));var zipdir=require(_0xbf6e('0x1'));var jsonpatch=require(_0xbf6e('0x2'));var rp=require(_0xbf6e('0x3'));var moment=require('moment');var BPromise=require(_0xbf6e('0x4'));var Mustache=require(_0xbf6e('0x5'));var util=require(_0xbf6e('0x6'));var path=require(_0xbf6e('0x7'));var sox=require(_0xbf6e('0x8'));var csv=require(_0xbf6e('0x9'));var ejs=require(_0xbf6e('0xa'));var fs=require('fs');var fs_extra=require(_0xbf6e('0xb'));var _=require(_0xbf6e('0xc'));var squel=require(_0xbf6e('0xd'));var crypto=require(_0xbf6e('0xe'));var jsforce=require(_0xbf6e('0xf'));var deskjs=require(_0xbf6e('0x10'));var toCsv=require(_0xbf6e('0x9'));var querystring=require(_0xbf6e('0x11'));var Papa=require(_0xbf6e('0x12'));var Redis=require(_0xbf6e('0x13'));var authService=require(_0xbf6e('0x14'));var qs=require(_0xbf6e('0x15'));var as=require(_0xbf6e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf6e('0x17'))(_0xbf6e('0x18'));var utils=require(_0xbf6e('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbf6e('0x1a'))['db'];function respondWithStatusCode(_0x23ed50,_0x149139){_0x149139=_0x149139||0xcc;return function(_0x13e871){if(_0x13e871){return _0x23ed50['sendStatus'](_0x149139);}return _0x23ed50[_0xbf6e('0x1b')](_0x149139)[_0xbf6e('0x1c')]();};}function respondWithResult(_0x1d957a,_0x51e41e){_0x51e41e=_0x51e41e||0xc8;return function(_0x14a728){if(_0x14a728){return _0x1d957a[_0xbf6e('0x1b')](_0x51e41e)[_0xbf6e('0x1d')](_0x14a728);}};}function respondWithFilteredResult(_0x371aa7,_0x2a903d){return function(_0x478466){if(_0x478466){var _0x3819e3=typeof _0x2a903d[_0xbf6e('0x1e')]===_0xbf6e('0x1f')&&typeof _0x2a903d[_0xbf6e('0x20')]===_0xbf6e('0x1f');var _0x3d62fa=_0x478466['count'];var _0x433fe3=_0x3819e3?0x0:_0x2a903d['offset'];var _0x16dea0=_0x3819e3?_0x478466[_0xbf6e('0x21')]:_0x2a903d[_0xbf6e('0x1e')]+_0x2a903d[_0xbf6e('0x20')];var _0x195564;if(_0x16dea0>=_0x3d62fa){_0x16dea0=_0x3d62fa;_0x195564=0xc8;}else{_0x195564=0xce;}_0x371aa7['status'](_0x195564);return _0x371aa7[_0xbf6e('0x22')](_0xbf6e('0x23'),_0x433fe3+'-'+_0x16dea0+'/'+_0x3d62fa)['json'](_0x478466);}return null;};}function patchUpdates(_0x2c12c7){return function(_0x505018){try{jsonpatch[_0xbf6e('0x24')](_0x505018,_0x2c12c7,!![]);}catch(_0x106eb8){return BPromise[_0xbf6e('0x25')](_0x106eb8);}return _0x505018[_0xbf6e('0x26')]();};}function saveUpdates(_0x2e77dc,_0x43bb1a){return function(_0x2f3a7c){if(_0x2f3a7c){return _0x2f3a7c[_0xbf6e('0x27')](_0x2e77dc)[_0xbf6e('0x28')](function(_0x280fb2){return _0x280fb2;});}return null;};}function removeEntity(_0x6d0046,_0x162ef5){return function(_0x57e58e){if(_0x57e58e){return _0x57e58e[_0xbf6e('0x29')]()[_0xbf6e('0x28')](function(){_0x6d0046[_0xbf6e('0x1b')](0xcc)[_0xbf6e('0x1c')]();});}};}function handleEntityNotFound(_0xb2af8d,_0x201e29){return function(_0x26a9a9){if(!_0x26a9a9){_0xb2af8d[_0xbf6e('0x2a')](0x194);}return _0x26a9a9;};}function handleError(_0x26c38e,_0x573c94){_0x573c94=_0x573c94||0x1f4;return function(_0x5e3a44){logger[_0xbf6e('0x2b')](_0x5e3a44[_0xbf6e('0x2c')]);if(_0x5e3a44[_0xbf6e('0x2d')]){delete _0x5e3a44[_0xbf6e('0x2d')];}_0x26c38e[_0xbf6e('0x1b')](_0x573c94)['send'](_0x5e3a44);};}exports[_0xbf6e('0x2e')]=function(_0x2eff50,_0x372745){var _0x284c34={},_0x1b52a4={},_0x234ae2={'count':0x0,'rows':[]};var _0x43c1c4=_[_0xbf6e('0x2f')](db[_0xbf6e('0x30')][_0xbf6e('0x31')],function(_0x5f22bb){return{'name':_0x5f22bb[_0xbf6e('0x32')],'type':_0x5f22bb[_0xbf6e('0x33')]['key']};});_0x1b52a4[_0xbf6e('0x34')]=_['map'](_0x43c1c4,'name');_0x1b52a4['query']=_[_0xbf6e('0x35')](_0x2eff50['query']);_0x1b52a4[_0xbf6e('0x36')]=_['intersection'](_0x1b52a4[_0xbf6e('0x34')],_0x1b52a4[_0xbf6e('0x37')]);_0x284c34[_0xbf6e('0x38')]=_[_0xbf6e('0x39')](_0x1b52a4[_0xbf6e('0x34')],qs[_0xbf6e('0x3a')](_0x2eff50[_0xbf6e('0x37')][_0xbf6e('0x3a')]));_0x284c34['attributes']=_0x284c34[_0xbf6e('0x38')]['length']?_0x284c34['attributes']:_0x1b52a4[_0xbf6e('0x34')];if(!_0x2eff50[_0xbf6e('0x37')][_0xbf6e('0x3b')](_0xbf6e('0x3c'))){_0x284c34['limit']=qs['limit'](_0x2eff50['query'][_0xbf6e('0x20')]);_0x284c34['offset']=qs[_0xbf6e('0x1e')](_0x2eff50['query'][_0xbf6e('0x1e')]);}_0x284c34[_0xbf6e('0x3d')]=qs[_0xbf6e('0x3e')](_0x2eff50['query'][_0xbf6e('0x3e')]);_0x284c34[_0xbf6e('0x3f')]=qs[_0xbf6e('0x36')](_[_0xbf6e('0x40')](_0x2eff50[_0xbf6e('0x37')],_0x1b52a4[_0xbf6e('0x36')]),_0x43c1c4);if(_0x2eff50[_0xbf6e('0x37')]['filter']){_0x284c34[_0xbf6e('0x3f')]=_[_0xbf6e('0x41')](_0x284c34[_0xbf6e('0x3f')],{'$or':_['map'](_0x43c1c4,function(_0x1cfb87){if(_0x1cfb87['type']!==_0xbf6e('0x42')){var _0x19bd6a={};_0x19bd6a[_0x1cfb87['name']]={'$like':'%'+_0x2eff50[_0xbf6e('0x37')][_0xbf6e('0x43')]+'%'};return _0x19bd6a;}})});}_0x284c34=_['merge']({},_0x284c34,_0x2eff50['options']);var _0x37b4ff={'where':_0x284c34[_0xbf6e('0x3f')]};return db[_0xbf6e('0x30')][_0xbf6e('0x21')](_0x37b4ff)[_0xbf6e('0x28')](function(_0xd6979){_0x234ae2[_0xbf6e('0x21')]=_0xd6979;if(_0x2eff50[_0xbf6e('0x37')]['includeAll']){_0x284c34[_0xbf6e('0x44')]=[{'all':!![]}];}return db[_0xbf6e('0x30')][_0xbf6e('0x45')](_0x284c34);})[_0xbf6e('0x28')](function(_0x5408f3){_0x234ae2[_0xbf6e('0x46')]=_0x5408f3;return _0x234ae2;})['then'](respondWithFilteredResult(_0x372745,_0x284c34))[_0xbf6e('0x47')](handleError(_0x372745,null));};exports['show']=function(_0x527431,_0x4e05a0){var _0x3cbe46={'raw':!![],'where':{'id':_0x527431['params']['id']}},_0x1fe3c8={};_0x1fe3c8[_0xbf6e('0x34')]=_[_0xbf6e('0x35')](db['VoiceTransferReport'][_0xbf6e('0x31')]);_0x1fe3c8['query']=_[_0xbf6e('0x35')](_0x527431['query']);_0x1fe3c8[_0xbf6e('0x36')]=_[_0xbf6e('0x39')](_0x1fe3c8[_0xbf6e('0x34')],_0x1fe3c8['query']);_0x3cbe46[_0xbf6e('0x38')]=_[_0xbf6e('0x39')](_0x1fe3c8[_0xbf6e('0x34')],qs[_0xbf6e('0x3a')](_0x527431[_0xbf6e('0x37')][_0xbf6e('0x3a')]));_0x3cbe46[_0xbf6e('0x38')]=_0x3cbe46['attributes'][_0xbf6e('0x48')]?_0x3cbe46[_0xbf6e('0x38')]:_0x1fe3c8[_0xbf6e('0x34')];if(_0x527431[_0xbf6e('0x37')][_0xbf6e('0x49')]){_0x3cbe46[_0xbf6e('0x44')]=[{'all':!![]}];}_0x3cbe46=_['merge']({},_0x3cbe46,_0x527431['options']);return db[_0xbf6e('0x30')][_0xbf6e('0x4a')](_0x3cbe46)[_0xbf6e('0x28')](handleEntityNotFound(_0x4e05a0,null))[_0xbf6e('0x28')](respondWithResult(_0x4e05a0,null))[_0xbf6e('0x47')](handleError(_0x4e05a0,null));};exports[_0xbf6e('0x4b')]=function(_0x46a17c,_0x1dd7a1){return db[_0xbf6e('0x30')]['create'](_0x46a17c['body'],{})['then'](respondWithResult(_0x1dd7a1,0xc9))[_0xbf6e('0x47')](handleError(_0x1dd7a1,null));};exports[_0xbf6e('0x27')]=function(_0x356972,_0x536a98){if(_0x356972[_0xbf6e('0x4c')]['id']){delete _0x356972[_0xbf6e('0x4c')]['id'];}return db[_0xbf6e('0x30')][_0xbf6e('0x4a')]({'where':{'id':_0x356972[_0xbf6e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x536a98,null))[_0xbf6e('0x28')](saveUpdates(_0x356972[_0xbf6e('0x4c')],null))[_0xbf6e('0x28')](respondWithResult(_0x536a98,null))['catch'](handleError(_0x536a98,null));};exports[_0xbf6e('0x29')]=function(_0x51abac,_0x3e9667){return db[_0xbf6e('0x30')]['find']({'where':{'id':_0x51abac[_0xbf6e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3e9667,null))[_0xbf6e('0x28')](removeEntity(_0x3e9667,null))['catch'](handleError(_0x3e9667,null));};exports[_0xbf6e('0x4e')]=function(_0x5eed0a,_0x44d1a1){return db[_0xbf6e('0x30')][_0xbf6e('0x4e')]()[_0xbf6e('0x28')](respondWithResult(_0x44d1a1,null))['catch'](handleError(_0x44d1a1,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 4b1fb5b..231ee6d 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 _0x6f6e=['bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','util','api'];(function(_0x235ba6,_0x315773){var _0x2aa7c4=function(_0x4d7040){while(--_0x4d7040){_0x235ba6['push'](_0x235ba6['shift']());}};_0x2aa7c4(++_0x315773);}(_0x6f6e,0xad));var _0xe6f6=function(_0x7d8ac,_0x564b51){_0x7d8ac=_0x7d8ac-0x0;var _0x12ae51=_0x6f6e[_0x7d8ac];return _0x12ae51;};'use strict';var _=require(_0xe6f6('0x0'));var util=require(_0xe6f6('0x1'));var logger=require('../../config/logger')(_0xe6f6('0x2'));var moment=require('moment');var BPromise=require(_0xe6f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6f6('0x4'));var rimraf=require(_0xe6f6('0x5'));var config=require(_0xe6f6('0x6'));var attributes=require(_0xe6f6('0x7'));module['exports']=function(_0x505b5f,_0xab2828){return _0x505b5f[_0xe6f6('0x8')](_0xe6f6('0x9'),attributes,{'tableName':_0xe6f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb769=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xd920f2,_0x23a97c){var _0x6388dd=function(_0x398ef4){while(--_0x398ef4){_0xd920f2['push'](_0xd920f2['shift']());}};_0x6388dd(++_0x23a97c);}(_0xb769,0x94));var _0x9b76=function(_0x162aad,_0x325bff){_0x162aad=_0x162aad-0x0;var _0x48cf25=_0xb769[_0x162aad];return _0x48cf25;};'use strict';var _=require(_0x9b76('0x0'));var util=require(_0x9b76('0x1'));var logger=require(_0x9b76('0x2'))('api');var moment=require(_0x9b76('0x3'));var BPromise=require(_0x9b76('0x4'));var rp=require(_0x9b76('0x5'));var fs=require('fs');var path=require(_0x9b76('0x6'));var rimraf=require(_0x9b76('0x7'));var config=require('../../config/environment');var attributes=require(_0x9b76('0x8'));module[_0x9b76('0x9')]=function(_0x27cfc0,_0x374226){return _0x27cfc0[_0x9b76('0xa')](_0x9b76('0xb'),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 c0f5476..e23a523 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 _0x7a4b=['lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateVoiceTransferReport','create','options','raw'];(function(_0x3a304a,_0x93bbf9){var _0x1757a3=function(_0x3b0b6d){while(--_0x3b0b6d){_0x3a304a['push'](_0x3a304a['shift']());}};_0x1757a3(++_0x93bbf9);}(_0x7a4b,0x8a));var _0xb7a4=function(_0x2ddc1b,_0x5047d2){_0x2ddc1b=_0x2ddc1b-0x0;var _0x2a00f9=_0x7a4b[_0x2ddc1b];return _0x2a00f9;};'use strict';var _=require(_0xb7a4('0x0'));var util=require(_0xb7a4('0x1'));var moment=require(_0xb7a4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7a4('0x3'))['db'];var utils=require(_0xb7a4('0x4'));var logger=require(_0xb7a4('0x5'))(_0xb7a4('0x6'));var config=require('../../config/environment');var jayson=require(_0xb7a4('0x7'));var client=jayson[_0xb7a4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26e1a5,_0x3abfd8,_0x443186){return new BPromise(function(_0x36538d,_0x3f4f48){return client['request'](_0x26e1a5,_0x443186)[_0xb7a4('0x9')](function(_0x4b31ef){logger['info'](_0xb7a4('0xa'),_0x3abfd8,_0xb7a4('0xb'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x3abfd8,'request\x20sent',JSON[_0xb7a4('0xc')](_0x4b31ef));if(_0x4b31ef[_0xb7a4('0xd')]){if(_0x4b31ef['error'][_0xb7a4('0xe')]===0x1f4){logger[_0xb7a4('0xd')](_0xb7a4('0xa'),_0x3abfd8,_0x4b31ef[_0xb7a4('0xd')]['message']);return _0x3f4f48(_0x4b31ef['error'][_0xb7a4('0xf')]);}logger[_0xb7a4('0xd')](_0xb7a4('0xa'),_0x3abfd8,_0x4b31ef[_0xb7a4('0xd')][_0xb7a4('0xf')]);return _0x36538d(_0x4b31ef[_0xb7a4('0xd')]['message']);}else{logger[_0xb7a4('0x10')](_0xb7a4('0xa'),_0x3abfd8,_0xb7a4('0xb'));_0x36538d(_0x4b31ef[_0xb7a4('0x11')][_0xb7a4('0xf')]);}})[_0xb7a4('0x12')](function(_0x2e355d){logger[_0xb7a4('0xd')](_0xb7a4('0xa'),_0x3abfd8,_0x2e355d);_0x3f4f48(_0x2e355d);});});}exports[_0xb7a4('0x13')]=function(_0x3d850f){var _0x347985=this;return new Promise(function(_0x36ea6a,_0x12cb44){return db['VoiceTransferReport'][_0xb7a4('0x14')](_0x3d850f['body'],{'raw':_0x3d850f[_0xb7a4('0x15')]?_0x3d850f[_0xb7a4('0x15')][_0xb7a4('0x16')]===undefined?!![]:![]:!![]})[_0xb7a4('0x9')](function(_0x43deb9){logger[_0xb7a4('0x10')]('CreateVoiceTransferReport',_0x3d850f);logger['debug'](_0xb7a4('0x13'),_0x3d850f,JSON[_0xb7a4('0xc')](_0x43deb9));_0x36ea6a(_0x43deb9);})['catch'](function(_0x2ae312){logger[_0xb7a4('0xd')](_0xb7a4('0x13'),_0x2ae312[_0xb7a4('0xf')],_0x3d850f);_0x12cb44(_0x347985[_0xb7a4('0xd')](0x1f4,_0x2ae312[_0xb7a4('0xf')]));});});}; \ No newline at end of file +var _0x464d=['request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x9b31ab,_0x165a13){var _0xc2aacd=function(_0x2ebb8f){while(--_0x2ebb8f){_0x9b31ab['push'](_0x9b31ab['shift']());}};_0xc2aacd(++_0x165a13);}(_0x464d,0x107));var _0xd464=function(_0x2321a3,_0x4e70c8){_0x2321a3=_0x2321a3-0x0;var _0x40eb57=_0x464d[_0x2321a3];return _0x40eb57;};'use strict';var _=require(_0xd464('0x0'));var util=require(_0xd464('0x1'));var moment=require(_0xd464('0x2'));var BPromise=require(_0xd464('0x3'));var rs=require(_0xd464('0x4'));var fs=require('fs');var Redis=require(_0xd464('0x5'));var db=require(_0xd464('0x6'))['db'];var utils=require(_0xd464('0x7'));var logger=require(_0xd464('0x8'))(_0xd464('0x9'));var config=require('../../config/environment');var jayson=require(_0xd464('0xa'));var client=jayson[_0xd464('0xb')][_0xd464('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d98bf,_0x5b9f70,_0x257725){return new BPromise(function(_0x25d78e,_0x161aca){return client[_0xd464('0xd')](_0x5d98bf,_0x257725)[_0xd464('0xe')](function(_0x136216){logger['info'](_0xd464('0xf'),_0x5b9f70,_0xd464('0x10'));logger[_0xd464('0x11')](_0xd464('0x12'),_0x5b9f70,_0xd464('0x10'),JSON[_0xd464('0x13')](_0x136216));if(_0x136216[_0xd464('0x14')]){if(_0x136216[_0xd464('0x14')][_0xd464('0x15')]===0x1f4){logger[_0xd464('0x14')](_0xd464('0xf'),_0x5b9f70,_0x136216['error'][_0xd464('0x16')]);return _0x161aca(_0x136216[_0xd464('0x14')][_0xd464('0x16')]);}logger[_0xd464('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x5b9f70,_0x136216[_0xd464('0x14')]['message']);return _0x25d78e(_0x136216['error']['message']);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x5b9f70,_0xd464('0x10'));_0x25d78e(_0x136216['result'][_0xd464('0x16')]);}})[_0xd464('0x17')](function(_0x2bb700){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x5b9f70,_0x2bb700);_0x161aca(_0x2bb700);});});}exports[_0xd464('0x18')]=function(_0x5cfd63){var _0x1864f9=this;return new Promise(function(_0x5942b8,_0x3f6417){return db[_0xd464('0x19')][_0xd464('0x1a')](_0x5cfd63[_0xd464('0x1b')],{'raw':_0x5cfd63[_0xd464('0x1c')]?_0x5cfd63[_0xd464('0x1c')][_0xd464('0x1d')]===undefined?!![]:![]:!![]})[_0xd464('0xe')](function(_0x4a31dd){logger[_0xd464('0x1e')](_0xd464('0x18'),_0x5cfd63);logger[_0xd464('0x11')](_0xd464('0x18'),_0x5cfd63,JSON[_0xd464('0x13')](_0x4a31dd));_0x5942b8(_0x4a31dd);})['catch'](function(_0x33f365){logger[_0xd464('0x14')](_0xd464('0x18'),_0x33f365[_0xd464('0x16')],_0x5cfd63);_0x3f6417(_0x1864f9[_0xd464('0x14')](0x1f4,_0x33f365[_0xd464('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 9327594..a52cd6f 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 _0x0bb5=['unhold','/calls','calls','/transfer','exports','express','Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','/unhold'];(function(_0x2b2f7e,_0x2c1b5b){var _0x42dd81=function(_0x3e25cc){while(--_0x3e25cc){_0x2b2f7e['push'](_0x2b2f7e['shift']());}};_0x42dd81(++_0x2c1b5b);}(_0x0bb5,0x148));var _0x50bb=function(_0x147a49,_0x5ade6a){_0x147a49=_0x147a49-0x0;var _0x59b525=_0x0bb5[_0x147a49];return _0x59b525;};'use strict';var express=require(_0x50bb('0x0'));var router=express[_0x50bb('0x1')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0x50bb('0x2')](_0x50bb('0x3'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0x6')]);router[_0x50bb('0x2')](_0x50bb('0x7'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller['hangup']);router[_0x50bb('0x2')](_0x50bb('0x8'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['answer']);router['post'](_0x50bb('0x9'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xa')]);router['post'](_0x50bb('0xb'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xc')]);router[_0x50bb('0x2')](_0x50bb('0xd'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller[_0x50bb('0xe')]);router['post'](_0x50bb('0xf'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['transfer']);module[_0x50bb('0x10')]=router; \ No newline at end of file +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(_0x454918,_0x1dbc64){var _0x3a814b=function(_0x3d1c39){while(--_0x3d1c39){_0x454918['push'](_0x454918['shift']());}};_0x3a814b(++_0x1dbc64);}(_0x34e8,0x12c));var _0x834e=function(_0x58f67c,_0x4fcc3e){_0x58f67c=_0x58f67c-0x0;var _0x5331d8=_0x34e8[_0x58f67c];return _0x5331d8;};'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 diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index c2aa94c..fbbd2fd 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 _0x0eaa=['transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','defaults','socket.io-emitter','redis','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','info','stringify','emit','error','stack','name','status','send','request','code','message','catch','User','findOne','agent','then','all','filter','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','userId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','validate','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer'];(function(_0x18328b,_0x527c62){var _0x4f16e0=function(_0x3fe225){while(--_0x3fe225){_0x18328b['push'](_0x18328b['shift']());}};_0x4f16e0(++_0x527c62);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x1ef813,_0x164001){_0x1ef813=_0x1ef813-0x0;var _0x5a3939=_0x0eaa[_0x1ef813];return _0x5a3939;};'use strict';var path=require(_0xa0ea('0x0'));var fs=require('fs');var _=require(_0xa0ea('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0xa0ea('0x2'));var BPromise=require(_0xa0ea('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa0ea('0x4')][_0xa0ea('0x5')]({'port':0x232a});var logger=require(_0xa0ea('0x6'))(_0xa0ea('0x7'));var Redis=require(_0xa0ea('0x8'));config['redis']=_[_0xa0ea('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa0ea('0xa'))(new Redis(config[_0xa0ea('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa0ea('0xc')]},'callNumber':{'type':_0xa0ea('0xd'),'required':[!![],_0xa0ea('0xe')]},'callerId':{'type':_0xa0ea('0xd')},'callbackUrl':{'type':_0xa0ea('0xd')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa0ea('0xc')]},'sessionId':{'type':_0xa0ea('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa0ea('0xf'),'required':[!![],_0xa0ea('0xc')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa0ea('0xf'),'required':[!![],_0xa0ea('0xc')]},'sessionId':{'type':_0xa0ea('0xd'),'required':[!![],_0xa0ea('0x10')]},'transferNumber':{'type':_0xa0ea('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xa0ea('0xf'),'required':[!![],_0xa0ea('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa0ea('0xf'),'required':[!![],_0xa0ea('0xc')]},'sessionId':{'type':_0xa0ea('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa0ea('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xa0ea('0xf'),'required':[!![],_0xa0ea('0xc')]}});function emit(_0x4274c2,_0x130156,_0x10d8f9){logger[_0xa0ea('0x11')](_0x4274c2,_0x130156,JSON[_0xa0ea('0x12')](_0x10d8f9));io['to'](_0x4274c2)[_0xa0ea('0x13')](_0x130156,_0x10d8f9);}function handleError(_0x345fb6){return function(_0x405f7f){console['log']('handleError:',_0x405f7f,_0x405f7f instanceof RangeError);logger[_0xa0ea('0x14')](_0x405f7f[_0xa0ea('0x15')]);if(_0x405f7f instanceof RangeError){if(_0x405f7f[_0xa0ea('0x16')]){delete _0x405f7f[_0xa0ea('0x16')];}_0x345fb6[_0xa0ea('0x17')](0x194)[_0xa0ea('0x18')](_0x405f7f);}else{if(_0x405f7f[_0xa0ea('0x16')]){delete _0x405f7f['name'];}_0x345fb6[_0xa0ea('0x17')](0x1f4)[_0xa0ea('0x18')](_0x405f7f);}};}function checkError(){return function(_0x94806e){if(!_0x94806e){throw new RangeError('NotFound');}return _0x94806e;};}function respondWithRpcPromise(_0x103e4f,_0x345d27){return new BPromise(function(_0x45fda4,_0x12cda2){var _0x2b5af5=amiClient;return _0x2b5af5[_0xa0ea('0x19')](_0x103e4f,_0x345d27)['then'](function(_0x35faa4){if(_0x35faa4['error']){if(_0x35faa4['error'][_0xa0ea('0x1a')]===0x1f4){return _0x12cda2(_0x35faa4[_0xa0ea('0x14')][_0xa0ea('0x1b')]);}return _0x45fda4(_0x35faa4['error'][_0xa0ea('0x1b')]);}else{_0x45fda4(_0x35faa4['result']);}})[_0xa0ea('0x1c')](function(_0x51cfbd){_0x12cda2(_0x51cfbd);});});}function getAgent(_0xcf155b){return db[_0xa0ea('0x1d')][_0xa0ea('0x1e')]({'where':{'id':_0xcf155b,'role':_0xa0ea('0x1f')}})[_0xa0ea('0x20')](checkError());}function getAgentCheckSession(_0x287728,_0x380e09){return new BPromise(function(_0x208c8,_0x4b6541){var _0x15534e=respondWithRpcPromise('VoiceChannels');var _0x21640c=getAgent(_0x287728);Promise[_0xa0ea('0x21')]([_0x15534e,_0x21640c])[_0xa0ea('0x20')](function(_0x705022){var _0x389050=_0x705022[0x0];var _0x129130=_0x705022[0x1];var _0x4e9748=_[_0xa0ea('0x22')](_0x389050['rows'],function(_0x210ce3){return _0x210ce3['UserId']==_0x129130['id']&&_0x210ce3[_0xa0ea('0x23')]==_0x380e09;});if(_0x4e9748[_0xa0ea('0x24')]==0x1){_0x208c8(_0x129130);}else{_0x4b6541(new RangeError(_0xa0ea('0x25')+_0x380e09+'\x20not\x20found!'));}});});}exports[_0xa0ea('0x26')]=function(_0x37a5b3,_0x502df5){logger[_0xa0ea('0x11')](_0xa0ea('0x27'),_0x37a5b3[_0xa0ea('0x28')]);var _0x4e8975=originateValidation['validate'](_0x37a5b3[_0xa0ea('0x28')]);if(_0x4e8975[_0xa0ea('0x24')]>0x0){return _0x502df5[_0xa0ea('0x17')](0x190)['json'](_0x4e8975);}var _0x610345=_0x37a5b3[_0xa0ea('0x28')][_0xa0ea('0x29')];var _0x41be34=_0x37a5b3[_0xa0ea('0x28')]['callNumber'];var _0x49a7fa=_0x37a5b3[_0xa0ea('0x28')]['callerId'];var _0x272dca=_0x37a5b3[_0xa0ea('0x28')][_0xa0ea('0x2a')];return getAgent(_0x610345)[_0xa0ea('0x20')](function(_0x628464){logger['info'](_0xa0ea('0x2b'),_0x628464[_0xa0ea('0x16')]);emit(util[_0xa0ea('0x2c')](_0xa0ea('0x2d'),_0x628464[_0xa0ea('0x16')]),_0xa0ea('0x2e'),{'callNumber':_0x41be34,'callerId':_0x49a7fa,'callbackUrl':_0x272dca});return _0x502df5[_0xa0ea('0x17')](0xc8)[_0xa0ea('0x2f')]({'error':![],'message':_0xa0ea('0x30')});})[_0xa0ea('0x1c')](handleError(_0x502df5));};exports['hangup']=function(_0x412364,_0x479008){logger[_0xa0ea('0x11')]('hangup\x20fired:',_0x412364[_0xa0ea('0x28')]);var _0x5b8159=hangupValidation[_0xa0ea('0x31')](_0x412364[_0xa0ea('0x28')]);if(_0x5b8159[_0xa0ea('0x24')]>0x0){return _0x479008[_0xa0ea('0x17')](0x190)['json'](_0x5b8159);}var _0x26f8aa=_0x412364[_0xa0ea('0x28')][_0xa0ea('0x29')];var _0x139496=_0x412364[_0xa0ea('0x28')][_0xa0ea('0x23')];return getAgent(_0x26f8aa)[_0xa0ea('0x20')](function(_0x24ac13){logger[_0xa0ea('0x11')]('entityFound:',_0x24ac13[_0xa0ea('0x16')]);emit(util['format'](_0xa0ea('0x2d'),_0x24ac13[_0xa0ea('0x16')]),_0xa0ea('0x32'),{'sessionId':_0x139496});return _0x479008[_0xa0ea('0x17')](0xc8)[_0xa0ea('0x2f')]({'error':![],'message':_0xa0ea('0x33')});})[_0xa0ea('0x1c')](handleError(_0x479008));};exports[_0xa0ea('0x34')]=function(_0x15d3ab,_0x21a2d5){logger[_0xa0ea('0x11')](_0xa0ea('0x35'),_0x15d3ab[_0xa0ea('0x28')]);var _0x37e38b=answerValidation[_0xa0ea('0x31')](_0x15d3ab['body']);if(_0x37e38b[_0xa0ea('0x24')]>0x0){return _0x21a2d5['status'](0x190)[_0xa0ea('0x2f')](_0x37e38b);}var _0x59e305=_0x15d3ab['body']['userId'];var _0x53606e=_0x15d3ab[_0xa0ea('0x28')][_0xa0ea('0x23')];return getAgent(_0x59e305)['then'](function(_0x3e17be){logger[_0xa0ea('0x11')](_0xa0ea('0x2b'),_0x3e17be['name']);emit(util['format']('user:%s',_0x3e17be[_0xa0ea('0x16')]),_0xa0ea('0x36'),{'sessionId':_0x53606e});return _0x21a2d5[_0xa0ea('0x17')](0xc8)[_0xa0ea('0x2f')]({'error':![],'message':_0xa0ea('0x37')});})[_0xa0ea('0x1c')](handleError(_0x21a2d5));};exports[_0xa0ea('0x38')]=function(_0xf7d20f,_0x541463){logger[_0xa0ea('0x11')](_0xa0ea('0x39'),_0xf7d20f[_0xa0ea('0x28')]);var _0x54161d=holdValidation[_0xa0ea('0x31')](_0xf7d20f[_0xa0ea('0x28')]);if(_0x54161d[_0xa0ea('0x24')]>0x0){return _0x541463[_0xa0ea('0x17')](0x190)['json'](_0x54161d);}var _0x482601=_0xf7d20f[_0xa0ea('0x28')][_0xa0ea('0x29')];var _0x1b841a=_0xf7d20f[_0xa0ea('0x28')][_0xa0ea('0x23')];return getAgent(_0x482601)[_0xa0ea('0x20')](function(_0x219540){logger[_0xa0ea('0x11')](_0xa0ea('0x2b'),_0x219540[_0xa0ea('0x16')]);emit(util['format'](_0xa0ea('0x2d'),_0x219540[_0xa0ea('0x16')]),_0xa0ea('0x3a'),{'sessionId':_0x1b841a});return _0x541463[_0xa0ea('0x17')](0xc8)[_0xa0ea('0x2f')]({'error':![],'message':_0xa0ea('0x3b')});})[_0xa0ea('0x1c')](handleError(_0x541463));};exports['unhold']=function(_0x140155,_0x176f68){logger['info'](_0xa0ea('0x3c'),_0x140155['body']);var _0x3feeb0=unholdValidation[_0xa0ea('0x31')](_0x140155[_0xa0ea('0x28')]);if(_0x3feeb0[_0xa0ea('0x24')]>0x0){return _0x176f68[_0xa0ea('0x17')](0x190)['json'](_0x3feeb0);}var _0x3b5861=_0x140155['body'][_0xa0ea('0x29')];var _0x4afa03=_0x140155[_0xa0ea('0x28')][_0xa0ea('0x23')];return getAgent(_0x3b5861)['then'](function(_0x2fbc9b){logger[_0xa0ea('0x11')](_0xa0ea('0x2b'),_0x2fbc9b['name']);emit(util[_0xa0ea('0x2c')]('user:%s',_0x2fbc9b[_0xa0ea('0x16')]),_0xa0ea('0x3d'),{'sessionId':_0x4afa03});return _0x176f68[_0xa0ea('0x17')](0xc8)[_0xa0ea('0x2f')]({'error':![],'message':_0xa0ea('0x3e')});})['catch'](handleError(_0x176f68));};exports[_0xa0ea('0x3f')]=function(_0x4ea7d1,_0x493676){logger[_0xa0ea('0x11')](_0xa0ea('0x40'),_0x493676[_0xa0ea('0x28')]);var _0x4c8aa7=callsValidation[_0xa0ea('0x31')](_0x4ea7d1[_0xa0ea('0x28')]);if(_0x4c8aa7[_0xa0ea('0x24')]>0x0){return _0x493676[_0xa0ea('0x17')](0x190)[_0xa0ea('0x2f')](_0x4c8aa7);}var _0xf4bf41=_0x4ea7d1[_0xa0ea('0x28')][_0xa0ea('0x29')];var _0x4e5a3f=respondWithRpcPromise(_0xa0ea('0x41'));var _0x3c79d0=getAgent(_0xf4bf41);return Promise[_0xa0ea('0x21')]([_0x4e5a3f,_0x3c79d0])['then'](function(_0x1ae398){var _0x545ad7=_0x1ae398[0x0];var _0x16026b=_0x1ae398[0x1];var _0x406586=_[_0xa0ea('0x22')](_0x545ad7[_0xa0ea('0x42')],function(_0x293de2){return _0x293de2['UserId']==_0x16026b['id'];});return _0x493676[_0xa0ea('0x17')](0xc8)[_0xa0ea('0x2f')]({'count':_0x406586[_0xa0ea('0x24')],'rows':_0x406586});})[_0xa0ea('0x1c')](handleError(_0x493676));};exports[_0xa0ea('0x43')]=function(_0x422b93,_0x4d2ec3){logger[_0xa0ea('0x11')](_0xa0ea('0x44'),_0x422b93[_0xa0ea('0x28')]);var _0x4abb20=conferenceValidation[_0xa0ea('0x31')](_0x422b93[_0xa0ea('0x28')]);if(_0x4abb20[_0xa0ea('0x24')]>0x0){return _0x4d2ec3[_0xa0ea('0x17')](0x190)[_0xa0ea('0x2f')](_0x4abb20);}var _0x2f94a5=_0x422b93[_0xa0ea('0x28')][_0xa0ea('0x29')];return getAgent(_0x2f94a5)['then'](function(_0x4cb062){logger['info'](_0xa0ea('0x2b'),_0x4cb062['name']);emit(util[_0xa0ea('0x2c')](_0xa0ea('0x2d'),_0x4cb062[_0xa0ea('0x16')]),_0xa0ea('0x45'));return _0x4d2ec3[_0xa0ea('0x17')](0xc8)['json']({'error':![],'message':_0xa0ea('0x46')});})[_0xa0ea('0x1c')](handleError(_0x4d2ec3));};exports[_0xa0ea('0x47')]=function(_0x1f792a,_0x532a29){logger[_0xa0ea('0x11')](_0xa0ea('0x48'),_0x1f792a['body']);var _0x145630=transferValidation['validate'](_0x1f792a['body']);if(_0x145630[_0xa0ea('0x24')]>0x0){return _0x532a29['status'](0x190)[_0xa0ea('0x2f')](_0x145630);}var _0x6f5039=_0x1f792a['body'][_0xa0ea('0x29')];var _0x1d57e8=_0x1f792a[_0xa0ea('0x28')][_0xa0ea('0x23')];var _0x4ca3fd=_0x1f792a[_0xa0ea('0x28')]['transferNumber'];return getAgent(_0x6f5039)[_0xa0ea('0x20')](function(_0x4052ed){logger[_0xa0ea('0x11')](_0xa0ea('0x2b'),_0x4052ed[_0xa0ea('0x16')]);emit(util[_0xa0ea('0x2c')]('user:%s',_0x4052ed['name']),_0xa0ea('0x49'),{'sessionId':_0x1d57e8,'transferNumber':_0x4ca3fd});return _0x532a29['status'](0xc8)[_0xa0ea('0x2f')]({'error':![],'message':_0xa0ea('0x4a')});})[_0xa0ea('0x1c')](handleError(_0x532a29));}; \ No newline at end of file +var _0xe205=['hold\x20fired:','hold\x20executed!','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','status','send','request','then','code','message','result','catch','User','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','hangup','hangup\x20fired:','userId','format','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold'];(function(_0x45314b,_0x2c69bc){var _0x626025=function(_0x225e6b){while(--_0x225e6b){_0x45314b['push'](_0x45314b['shift']());}};_0x626025(++_0x2c69bc);}(_0xe205,0xa7));var _0x5e20=function(_0x23cc42,_0x237bbd){_0x23cc42=_0x23cc42-0x0;var _0x10ea82=_0xe205[_0x23cc42];return _0x10ea82;};'use strict';var path=require(_0x5e20('0x0'));var fs=require('fs');var _=require(_0x5e20('0x1'));var db=require(_0x5e20('0x2'))['db'];var config=require(_0x5e20('0x3'));var util=require(_0x5e20('0x4'));var BPromise=require(_0x5e20('0x5'));var jayson=require(_0x5e20('0x6'));var amiClient=jayson[_0x5e20('0x7')][_0x5e20('0x8')]({'port':0x232a});var logger=require('../../config/logger')(_0x5e20('0x9'));var Redis=require(_0x5e20('0xa'));config[_0x5e20('0xb')]=_[_0x5e20('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5e20('0xd'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],_0x5e20('0xf')]},'callNumber':{'type':'string','required':[!![],_0x5e20('0x10')]},'callerId':{'type':_0x5e20('0x11')},'callbackUrl':{'type':_0x5e20('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5e20('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],_0x5e20('0xf')]},'sessionId':{'type':_0x5e20('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],_0x5e20('0xf')]},'sessionId':{'type':'string','required':[!![],_0x5e20('0x12')]},'transferNumber':{'type':_0x5e20('0x11'),'required':[!![],_0x5e20('0x13')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5e20('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5e20('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],_0x5e20('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],_0x5e20('0xf')]}});function emit(_0x542b3c,_0xeaeb77,_0x9a59ce){logger[_0x5e20('0x14')](_0x542b3c,_0xeaeb77,JSON[_0x5e20('0x15')](_0x9a59ce));io['to'](_0x542b3c)[_0x5e20('0x16')](_0xeaeb77,_0x9a59ce);}function handleError(_0x3b353f){return function(_0x1cc706){console[_0x5e20('0x17')]('handleError:',_0x1cc706,_0x1cc706 instanceof RangeError);logger[_0x5e20('0x18')](_0x1cc706[_0x5e20('0x19')]);if(_0x1cc706 instanceof RangeError){if(_0x1cc706['name']){delete _0x1cc706[_0x5e20('0x1a')];}_0x3b353f[_0x5e20('0x1b')](0x194)[_0x5e20('0x1c')](_0x1cc706);}else{if(_0x1cc706[_0x5e20('0x1a')]){delete _0x1cc706['name'];}_0x3b353f[_0x5e20('0x1b')](0x1f4)['send'](_0x1cc706);}};}function checkError(){return function(_0x4a3587){if(!_0x4a3587){throw new RangeError('NotFound');}return _0x4a3587;};}function respondWithRpcPromise(_0x5d0d1a,_0xe562ba){return new BPromise(function(_0x5cca90,_0x3d89e4){var _0x29b111=amiClient;return _0x29b111[_0x5e20('0x1d')](_0x5d0d1a,_0xe562ba)[_0x5e20('0x1e')](function(_0x3ef7fa){if(_0x3ef7fa[_0x5e20('0x18')]){if(_0x3ef7fa['error'][_0x5e20('0x1f')]===0x1f4){return _0x3d89e4(_0x3ef7fa['error']['message']);}return _0x5cca90(_0x3ef7fa[_0x5e20('0x18')][_0x5e20('0x20')]);}else{_0x5cca90(_0x3ef7fa[_0x5e20('0x21')]);}})[_0x5e20('0x22')](function(_0xbf7a24){_0x3d89e4(_0xbf7a24);});});}function getAgent(_0x200774){return db[_0x5e20('0x23')]['findOne']({'where':{'id':_0x200774,'role':_0x5e20('0x24')}})[_0x5e20('0x1e')](checkError());}function getAgentCheckSession(_0x238758,_0x3032ef){return new BPromise(function(_0x4c799d,_0x3a0f06){var _0x2c5d80=respondWithRpcPromise(_0x5e20('0x25'));var _0x222e7a=getAgent(_0x238758);Promise[_0x5e20('0x26')]([_0x2c5d80,_0x222e7a])[_0x5e20('0x1e')](function(_0x5ec45b){var _0xbc2b0e=_0x5ec45b[0x0];var _0x34a3d6=_0x5ec45b[0x1];var _0x543c29=_[_0x5e20('0x27')](_0xbc2b0e[_0x5e20('0x28')],function(_0x335f1e){return _0x335f1e[_0x5e20('0x29')]==_0x34a3d6['id']&&_0x335f1e[_0x5e20('0x2a')]==_0x3032ef;});if(_0x543c29[_0x5e20('0x2b')]==0x1){_0x4c799d(_0x34a3d6);}else{_0x3a0f06(new RangeError('sessionId\x20'+_0x3032ef+_0x5e20('0x2c')));}});});}exports[_0x5e20('0x2d')]=function(_0x330341,_0x5f2f1d){logger[_0x5e20('0x14')](_0x5e20('0x2e'),_0x330341[_0x5e20('0x2f')]);var _0x1ed59d=originateValidation[_0x5e20('0x30')](_0x330341[_0x5e20('0x2f')]);if(_0x1ed59d[_0x5e20('0x2b')]>0x0){return _0x5f2f1d['status'](0x190)[_0x5e20('0x31')](_0x1ed59d);}var _0x1a9fff=_0x330341[_0x5e20('0x2f')]['userId'];var _0x9469cd=_0x330341[_0x5e20('0x2f')][_0x5e20('0x32')];var _0x2e367e=_0x330341[_0x5e20('0x2f')][_0x5e20('0x33')];var _0x1114ae=_0x330341[_0x5e20('0x2f')][_0x5e20('0x34')];return getAgent(_0x1a9fff)[_0x5e20('0x1e')](function(_0x36e825){logger[_0x5e20('0x14')](_0x5e20('0x35'),_0x36e825[_0x5e20('0x1a')]);emit(util['format'](_0x5e20('0x36'),_0x36e825['name']),'webbar:originate',{'callNumber':_0x9469cd,'callerId':_0x2e367e,'callbackUrl':_0x1114ae});return _0x5f2f1d[_0x5e20('0x1b')](0xc8)[_0x5e20('0x31')]({'error':![],'message':'originate\x20executed!'});})[_0x5e20('0x22')](handleError(_0x5f2f1d));};exports[_0x5e20('0x37')]=function(_0x4f34c0,_0x3f3908){logger[_0x5e20('0x14')](_0x5e20('0x38'),_0x4f34c0[_0x5e20('0x2f')]);var _0x15ce1d=hangupValidation[_0x5e20('0x30')](_0x4f34c0[_0x5e20('0x2f')]);if(_0x15ce1d[_0x5e20('0x2b')]>0x0){return _0x3f3908[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x15ce1d);}var _0x473b69=_0x4f34c0[_0x5e20('0x2f')][_0x5e20('0x39')];var _0x1cb3f0=_0x4f34c0[_0x5e20('0x2f')][_0x5e20('0x2a')];return getAgent(_0x473b69)[_0x5e20('0x1e')](function(_0x17feb4){logger['info'](_0x5e20('0x35'),_0x17feb4[_0x5e20('0x1a')]);emit(util[_0x5e20('0x3a')](_0x5e20('0x36'),_0x17feb4[_0x5e20('0x1a')]),'webbar:hangup',{'sessionId':_0x1cb3f0});return _0x3f3908[_0x5e20('0x1b')](0xc8)[_0x5e20('0x31')]({'error':![],'message':_0x5e20('0x3b')});})[_0x5e20('0x22')](handleError(_0x3f3908));};exports[_0x5e20('0x3c')]=function(_0x30d3ef,_0x5c7ae8){logger[_0x5e20('0x14')](_0x5e20('0x3d'),_0x30d3ef[_0x5e20('0x2f')]);var _0x5a21f0=answerValidation[_0x5e20('0x30')](_0x30d3ef[_0x5e20('0x2f')]);if(_0x5a21f0[_0x5e20('0x2b')]>0x0){return _0x5c7ae8[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x5a21f0);}var _0x336d61=_0x30d3ef[_0x5e20('0x2f')][_0x5e20('0x39')];var _0x5c9504=_0x30d3ef[_0x5e20('0x2f')][_0x5e20('0x2a')];return getAgent(_0x336d61)[_0x5e20('0x1e')](function(_0x503cb6){logger[_0x5e20('0x14')]('entityFound:',_0x503cb6[_0x5e20('0x1a')]);emit(util[_0x5e20('0x3a')](_0x5e20('0x36'),_0x503cb6[_0x5e20('0x1a')]),_0x5e20('0x3e'),{'sessionId':_0x5c9504});return _0x5c7ae8['status'](0xc8)[_0x5e20('0x31')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x5c7ae8));};exports[_0x5e20('0x3f')]=function(_0x28f155,_0x9d9d62){logger[_0x5e20('0x14')](_0x5e20('0x40'),_0x28f155[_0x5e20('0x2f')]);var _0x57c794=holdValidation['validate'](_0x28f155['body']);if(_0x57c794[_0x5e20('0x2b')]>0x0){return _0x9d9d62[_0x5e20('0x1b')](0x190)['json'](_0x57c794);}var _0x22b84e=_0x28f155[_0x5e20('0x2f')][_0x5e20('0x39')];var _0x3bd5b8=_0x28f155[_0x5e20('0x2f')]['sessionId'];return getAgent(_0x22b84e)[_0x5e20('0x1e')](function(_0x245b52){logger[_0x5e20('0x14')](_0x5e20('0x35'),_0x245b52[_0x5e20('0x1a')]);emit(util[_0x5e20('0x3a')](_0x5e20('0x36'),_0x245b52[_0x5e20('0x1a')]),'webbar:hold',{'sessionId':_0x3bd5b8});return _0x9d9d62['status'](0xc8)['json']({'error':![],'message':_0x5e20('0x41')});})[_0x5e20('0x22')](handleError(_0x9d9d62));};exports['unhold']=function(_0x4392ca,_0x4bfea7){logger[_0x5e20('0x14')]('unhold\x20fired:',_0x4392ca[_0x5e20('0x2f')]);var _0x59372c=unholdValidation[_0x5e20('0x30')](_0x4392ca[_0x5e20('0x2f')]);if(_0x59372c[_0x5e20('0x2b')]>0x0){return _0x4bfea7[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x59372c);}var _0x200094=_0x4392ca[_0x5e20('0x2f')][_0x5e20('0x39')];var _0x19c128=_0x4392ca[_0x5e20('0x2f')][_0x5e20('0x2a')];return getAgent(_0x200094)[_0x5e20('0x1e')](function(_0x278b0e){logger[_0x5e20('0x14')](_0x5e20('0x35'),_0x278b0e[_0x5e20('0x1a')]);emit(util[_0x5e20('0x3a')](_0x5e20('0x36'),_0x278b0e['name']),'webbar:unhold',{'sessionId':_0x19c128});return _0x4bfea7[_0x5e20('0x1b')](0xc8)['json']({'error':![],'message':_0x5e20('0x42')});})[_0x5e20('0x22')](handleError(_0x4bfea7));};exports[_0x5e20('0x43')]=function(_0x596971,_0x457552){logger[_0x5e20('0x14')](_0x5e20('0x44'),_0x457552['body']);var _0x5d2aa2=callsValidation['validate'](_0x596971[_0x5e20('0x2f')]);if(_0x5d2aa2[_0x5e20('0x2b')]>0x0){return _0x457552[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x5d2aa2);}var _0xbacc1f=_0x596971[_0x5e20('0x2f')]['userId'];var _0x393724=respondWithRpcPromise('VoiceChannels');var _0x2913e7=getAgent(_0xbacc1f);return Promise['all']([_0x393724,_0x2913e7])[_0x5e20('0x1e')](function(_0x2eff14){var _0x141743=_0x2eff14[0x0];var _0x5f025b=_0x2eff14[0x1];var _0x1f6a32=_[_0x5e20('0x27')](_0x141743[_0x5e20('0x28')],function(_0x4309b8){return _0x4309b8[_0x5e20('0x29')]==_0x5f025b['id'];});return _0x457552[_0x5e20('0x1b')](0xc8)[_0x5e20('0x31')]({'count':_0x1f6a32['length'],'rows':_0x1f6a32});})[_0x5e20('0x22')](handleError(_0x457552));};exports[_0x5e20('0x45')]=function(_0x1a03e4,_0x2f9089){logger['info'](_0x5e20('0x46'),_0x1a03e4[_0x5e20('0x2f')]);var _0x23f07d=conferenceValidation[_0x5e20('0x30')](_0x1a03e4['body']);if(_0x23f07d[_0x5e20('0x2b')]>0x0){return _0x2f9089[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x23f07d);}var _0x53ddd4=_0x1a03e4['body']['userId'];return getAgent(_0x53ddd4)[_0x5e20('0x1e')](function(_0x1eb84c){logger['info'](_0x5e20('0x35'),_0x1eb84c[_0x5e20('0x1a')]);emit(util[_0x5e20('0x3a')]('user:%s',_0x1eb84c[_0x5e20('0x1a')]),_0x5e20('0x47'));return _0x2f9089['status'](0xc8)[_0x5e20('0x31')]({'error':![],'message':_0x5e20('0x48')});})['catch'](handleError(_0x2f9089));};exports[_0x5e20('0x49')]=function(_0x9993ae,_0x1e531d){logger[_0x5e20('0x14')]('transfer\x20fired:',_0x9993ae[_0x5e20('0x2f')]);var _0x59bff7=transferValidation['validate'](_0x9993ae[_0x5e20('0x2f')]);if(_0x59bff7[_0x5e20('0x2b')]>0x0){return _0x1e531d[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x59bff7);}var _0x54cd1=_0x9993ae[_0x5e20('0x2f')]['userId'];var _0x4bccbe=_0x9993ae[_0x5e20('0x2f')][_0x5e20('0x2a')];var _0x17f248=_0x9993ae['body'][_0x5e20('0x4a')];return getAgent(_0x54cd1)[_0x5e20('0x1e')](function(_0x52f8ef){logger[_0x5e20('0x14')]('entityFound:',_0x52f8ef['name']);emit(util[_0x5e20('0x3a')]('user:%s',_0x52f8ef[_0x5e20('0x1a')]),_0x5e20('0x4b'),{'sessionId':_0x4bccbe,'transferNumber':_0x17f248});return _0x1e531d[_0x5e20('0x1b')](0xc8)['json']({'error':![],'message':_0x5e20('0x4c')});})[_0x5e20('0x22')](handleError(_0x1e531d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index e55fda9..f24d514 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 _0x14a0=['update','delete','destroy','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAgents','addApplications','/:id/notify','notify','/:id/send','put','/:id'];(function(_0x44fb3d,_0x206053){var _0x3bdaed=function(_0x5a9e96){while(--_0x5a9e96){_0x44fb3d['push'](_0x44fb3d['shift']());}};_0x3bdaed(++_0x206053);}(_0x14a0,0x8e));var _0x014a=function(_0x465089,_0x823030){_0x465089=_0x465089-0x0;var _0x3c47ba=_0x14a0[_0x465089];return _0x3c47ba;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['get']('/:id',auth[_0x014a('0x9')](),controller['show']);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['get'](_0x014a('0xd'),auth[_0x014a('0x9')](),controller['getAnswers']);router[_0x014a('0x8')](_0x014a('0xe'),auth[_0x014a('0x9')](),controller[_0x014a('0xf')]);router[_0x014a('0x8')](_0x014a('0x10'),auth[_0x014a('0x9')](),controller[_0x014a('0x11')]);router[_0x014a('0x12')]('/',auth[_0x014a('0x9')](),controller[_0x014a('0x13')]);router[_0x014a('0x12')]('/:id/dispositions',auth[_0x014a('0x9')](),controller[_0x014a('0x14')]);router['post'](_0x014a('0xd'),auth[_0x014a('0x9')](),controller['addAnswer']);router[_0x014a('0x12')](_0x014a('0xe'),auth[_0x014a('0x9')](),controller[_0x014a('0x15')]);router[_0x014a('0x12')](_0x014a('0x10'),auth[_0x014a('0x9')](),controller[_0x014a('0x16')]);router[_0x014a('0x12')](_0x014a('0x17'),controller[_0x014a('0x18')]);router[_0x014a('0x12')](_0x014a('0x19'),auth[_0x014a('0x9')](),controller['send']);router[_0x014a('0x1a')](_0x014a('0x1b'),auth[_0x014a('0x9')](),controller[_0x014a('0x1c')]);router[_0x014a('0x1d')](_0x014a('0x1b'),auth[_0x014a('0x9')](),controller[_0x014a('0x1e')]);router[_0x014a('0x1d')]('/:id/dispositions',auth[_0x014a('0x9')](),controller['removeDispositions']);router[_0x014a('0x1d')](_0x014a('0xd'),auth[_0x014a('0x9')](),controller[_0x014a('0x1f')]);router[_0x014a('0x1d')](_0x014a('0xe'),auth[_0x014a('0x9')](),controller[_0x014a('0x20')]);module[_0x014a('0x21')]=router; \ No newline at end of file +var _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAgents','addApplications','notify','send','put','update','delete','destroy','removeAnswers','exports'];(function(_0x4c8486,_0x511f26){var _0x2c9a87=function(_0x209bd5){while(--_0x209bd5){_0x4c8486['push'](_0x4c8486['shift']());}};_0x2c9a87(++_0x511f26);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'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('./whatsappAccount.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['show']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/canned_answers',auth[_0x65f6('0x8')](),controller['getAnswers']);router['get'](_0x65f6('0xe'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);router['get'](_0x65f6('0x10'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);router[_0x65f6('0x12')]('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0x13')]);router[_0x65f6('0x12')](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x14')]);router['post'](_0x65f6('0x15'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x65f6('0x12')](_0x65f6('0xe'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x16')]);router[_0x65f6('0x12')](_0x65f6('0x10'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x17')]);router['post']('/:id/notify',controller[_0x65f6('0x18')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x65f6('0x19')]);router[_0x65f6('0x1a')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0x1b')]);router[_0x65f6('0x1c')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1d')]);router['delete'](_0x65f6('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x65f6('0x1c')](_0x65f6('0x15'),auth['isAuthenticated'](),controller[_0x65f6('0x1e')]);router[_0x65f6('0x1c')](_0x65f6('0xe'),auth[_0x65f6('0x8')](),controller['removeAgents']);module[_0x65f6('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 01037a8..e066ba4 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 _0x124a=['INTEGER','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x2330b4,_0x1a04ca){var _0xc2a648=function(_0x181c56){while(--_0x181c56){_0x2330b4['push'](_0x2330b4['shift']());}};_0xc2a648(++_0x1a04ca);}(_0x124a,0xc9));var _0xa124=function(_0xa4b8e1,_0x49d30b){_0xa4b8e1=_0xa4b8e1-0x0;var _0x507e42=_0x124a[_0xa4b8e1];return _0x507e42;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xa124('0x0')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xa124('0x0')],'allowNull':![]},'remote':{'type':Sequelize[_0xa124('0x0')],'allowNull':![]},'token':{'type':Sequelize[_0xa124('0x0')],'defaultValue':function(){return rs[_0xa124('0x1')]();}},'phone':{'type':Sequelize[_0xa124('0x0')]},'type':{'type':Sequelize[_0xa124('0x2')](_0xa124('0x3'),_0xa124('0x4'))},'accountSid':{'type':Sequelize[_0xa124('0x0')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xa124('0x0')]},'notificationTemplate':{'type':Sequelize[_0xa124('0x5')],'defaultValue':function(){return _0xa124('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa124('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa124('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa124('0x8')],'defaultValue':![],'comment':_0xa124('0x9'),'set':function(_0x30b484){if(!_0x30b484){this[_0xa124('0xa')](_0xa124('0xb'),null);}this['setDataValue'](_0xa124('0xc'),_0x30b484);}},'description':{'type':Sequelize[_0xa124('0x0')]}}; \ No newline at end of file +var _0x8493=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','STRING','sinch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8493,0xa4));var _0x3849=function(_0x1e48d3,_0x5d8c43){_0x1e48d3=_0x1e48d3-0x0;var _0x2852b1=_0x8493[_0x1e48d3];return _0x2852b1;};'use strict';var Sequelize=require(_0x3849('0x0'));var rs=require('randomstring');module[_0x3849('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3849('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x3849('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3849('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x3849('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0x3849('0x4'))},'accountSid':{'type':Sequelize[_0x3849('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x3849('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3849('0x5')],'defaultValue':function(){return _0x3849('0x6');}},'notificationSound':{'type':Sequelize[_0x3849('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x3849('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3849('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3849('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3849('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3849('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3849('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3849('0x7')],'defaultValue':![],'comment':_0x3849('0x9'),'set':function(_0x45471f){if(!_0x45471f){this[_0x3849('0xa')](_0x3849('0xb'),null);}this[_0x3849('0xa')](_0x3849('0xc'),_0x45471f);}},'description':{'type':Sequelize[_0x3849('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 82054b8..49282b8 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 _0xd3cd=['priority','CmContact','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','messageId','MessageSid','notifications','isNil','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','autoclose','push','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','startRouting','Start','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','defaults','Messages','dataValues','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','name','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','filters','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','stack','finally','send','getApplications','whatsapp','account','sinch','statuses','read','timestamp','message_id','applications','orderBy','Applications'];(function(_0x384a8c,_0x17b07a){var _0x26fda4=function(_0x4d2939){while(--_0x4d2939){_0x384a8c['push'](_0x384a8c['shift']());}};_0x26fda4(++_0x17b07a);}(_0xd3cd,0x1b3));var _0xdd3c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd3cd[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xdd3c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdd3c('0x1'));var rp=require('request-promise');var moment=require(_0xdd3c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xdd3c('0x3'));var util=require('util');var path=require(_0xdd3c('0x4'));var sox=require(_0xdd3c('0x5'));var csv=require(_0xdd3c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd3c('0x7'));var _=require(_0xdd3c('0x8'));var squel=require(_0xdd3c('0x9'));var crypto=require(_0xdd3c('0xa'));var jsforce=require(_0xdd3c('0xb'));var deskjs=require(_0xdd3c('0xc'));var toCsv=require(_0xdd3c('0x6'));var querystring=require(_0xdd3c('0xd'));var Papa=require(_0xdd3c('0xe'));var Redis=require(_0xdd3c('0xf'));var authService=require(_0xdd3c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdd3c('0x11'));var hardwareService=require(_0xdd3c('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xdd3c('0x13'));var config=require(_0xdd3c('0x14'));var licenseUtil=require(_0xdd3c('0x15'));var db=require(_0xdd3c('0x16'))['db'];config[_0xdd3c('0x17')]=_['defaults'](config[_0xdd3c('0x17')],{'host':_0xdd3c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdd3c('0x19'))[_0xdd3c('0x1a')](socket);var jayson=require(_0xdd3c('0x1b'));var client=jayson[_0xdd3c('0x1c')][_0xdd3c('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x1f0b51,_0x560725,_0x47e5a9,_0x42a79e){return new BPromise(function(_0xfd447c,_0x396307){var _0x40e17c=_0x42a79e||client;return _0x40e17c['request'](_0x1f0b51,_0x47e5a9)[_0xdd3c('0x1e')](function(_0x1f14d2){logger[_0xdd3c('0x1f')](_0xdd3c('0x20'),_0x560725,_0xdd3c('0x21'));logger[_0xdd3c('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x560725,_0xdd3c('0x21'),JSON[_0xdd3c('0x23')](_0x1f14d2));if(_0x1f14d2[_0xdd3c('0x24')]){if(_0x1f14d2[_0xdd3c('0x24')][_0xdd3c('0x25')]===0x1f4){logger['error'](_0xdd3c('0x20'),_0x560725,_0x1f14d2['error']['message']);return _0x396307(_0x1f14d2[_0xdd3c('0x24')][_0xdd3c('0x26')]);}logger[_0xdd3c('0x24')](_0xdd3c('0x20'),_0x560725,_0x1f14d2['error'][_0xdd3c('0x26')]);return _0xfd447c(_0x1f14d2[_0xdd3c('0x24')][_0xdd3c('0x26')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x560725,_0xdd3c('0x21'));_0xfd447c(_0x1f14d2[_0xdd3c('0x27')][_0xdd3c('0x26')]);}})[_0xdd3c('0x28')](function(_0x369f73){logger[_0xdd3c('0x24')](_0xdd3c('0x20'),_0x560725,_0x369f73);_0x396307(_0x369f73);});});}function respondWithStatusCode(_0x147518,_0x260016){_0x260016=_0x260016||0xcc;return function(_0x34c893){if(_0x34c893){return _0x147518[_0xdd3c('0x29')](_0x260016);}return _0x147518[_0xdd3c('0x2a')](_0x260016)[_0xdd3c('0x2b')]();};}function respondWithResult(_0x2154f0,_0x5ce419){_0x5ce419=_0x5ce419||0xc8;return function(_0x4eb84f){if(_0x4eb84f){return _0x2154f0['status'](_0x5ce419)['json'](_0x4eb84f);}};}function respondWithFilteredResult(_0x568422,_0x2bb131){return function(_0x56738f){if(_0x56738f){var _0x581dc7=typeof _0x2bb131[_0xdd3c('0x2c')]==='undefined'&&typeof _0x2bb131['limit']===_0xdd3c('0x2d');var _0x1d9568=_0x56738f[_0xdd3c('0x2e')];var _0x4c3af6=_0x581dc7?0x0:_0x2bb131['offset'];var _0x288478=_0x581dc7?_0x56738f[_0xdd3c('0x2e')]:_0x2bb131['offset']+_0x2bb131[_0xdd3c('0x2f')];var _0x455c89;if(_0x288478>=_0x1d9568){_0x288478=_0x1d9568;_0x455c89=0xc8;}else{_0x455c89=0xce;}_0x568422[_0xdd3c('0x2a')](_0x455c89);return _0x568422['set'](_0xdd3c('0x30'),_0x4c3af6+'-'+_0x288478+'/'+_0x1d9568)[_0xdd3c('0x31')](_0x56738f);}return null;};}function patchUpdates(_0x39db1b){return function(_0x53d1d8){try{jsonpatch[_0xdd3c('0x32')](_0x53d1d8,_0x39db1b,!![]);}catch(_0x18d823){return BPromise[_0xdd3c('0x33')](_0x18d823);}return _0x53d1d8[_0xdd3c('0x34')]();};}function saveUpdates(_0x5536fa,_0x48dbd0){return function(_0x4d7f67){if(_0x4d7f67){return _0x4d7f67[_0xdd3c('0x35')](_0x5536fa)[_0xdd3c('0x1e')](function(_0x4c074c){return _0x4c074c;});}return null;};}function removeEntity(_0x2b4041,_0x54e444){return function(_0x1a2b27){if(_0x1a2b27){return _0x1a2b27[_0xdd3c('0x36')]()[_0xdd3c('0x1e')](function(){var _0x544b11=_0x1a2b27[_0xdd3c('0x37')]({'plain':!![]});var _0x227e01=_0xdd3c('0x38');return db[_0xdd3c('0x39')]['destroy']({'where':{'type':_0x227e01,'resourceId':_0x544b11['id']}})[_0xdd3c('0x1e')](function(){return _0x1a2b27;});})[_0xdd3c('0x1e')](function(){_0x2b4041[_0xdd3c('0x2a')](0xcc)[_0xdd3c('0x2b')]();});}};}function handleEntityNotFound(_0x2a5a71,_0x44a5e0){return function(_0x200847){if(!_0x200847){_0x2a5a71['sendStatus'](0x194);}return _0x200847;};}function handleError(_0x47d9d6,_0x2bba4d){_0x2bba4d=_0x2bba4d||0x1f4;return function(_0x168e8c){logger[_0xdd3c('0x24')](_0x168e8c['stack']);if(_0x168e8c[_0xdd3c('0x3a')]){delete _0x168e8c['name'];}_0x47d9d6['status'](_0x2bba4d)['send'](_0x168e8c);};}exports['index']=function(_0xc62238,_0x4b8256){var _0x2bfbad={'include':[{'model':db[_0xdd3c('0x3b')],'as':_0xdd3c('0x3c')}]},_0x4b1ae7={},_0x52bfe0={'count':0x0,'rows':[]};var _0x22a6e2=_[_0xdd3c('0x3d')](db['WhatsappAccount'][_0xdd3c('0x3e')],function(_0x480b81){return{'name':_0x480b81[_0xdd3c('0x3f')],'type':_0x480b81[_0xdd3c('0x40')][_0xdd3c('0x41')]};});_0x4b1ae7['model']=_[_0xdd3c('0x3d')](_0x22a6e2,_0xdd3c('0x3a'));_0x4b1ae7[_0xdd3c('0x42')]=_['keys'](_0xc62238[_0xdd3c('0x42')]);_0x4b1ae7['filters']=_['intersection'](_0x4b1ae7[_0xdd3c('0x43')],_0x4b1ae7[_0xdd3c('0x42')]);_0x2bfbad[_0xdd3c('0x44')]=_[_0xdd3c('0x45')](_0x4b1ae7['model'],qs[_0xdd3c('0x46')](_0xc62238[_0xdd3c('0x42')][_0xdd3c('0x46')]));_0x2bfbad['attributes']=_0x2bfbad[_0xdd3c('0x44')][_0xdd3c('0x47')]?_0x2bfbad[_0xdd3c('0x44')]:_0x4b1ae7[_0xdd3c('0x43')];if(!_0xc62238[_0xdd3c('0x42')][_0xdd3c('0x48')](_0xdd3c('0x49'))){_0x2bfbad[_0xdd3c('0x2f')]=qs[_0xdd3c('0x2f')](_0xc62238[_0xdd3c('0x42')][_0xdd3c('0x2f')]);_0x2bfbad[_0xdd3c('0x2c')]=qs[_0xdd3c('0x2c')](_0xc62238[_0xdd3c('0x42')]['offset']);}_0x2bfbad[_0xdd3c('0x4a')]=qs[_0xdd3c('0x4b')](_0xc62238[_0xdd3c('0x42')][_0xdd3c('0x4b')]);_0x2bfbad[_0xdd3c('0x4c')]=qs['filters'](_[_0xdd3c('0x4d')](_0xc62238[_0xdd3c('0x42')],_0x4b1ae7['filters']),_0x22a6e2);if(_0xc62238[_0xdd3c('0x42')][_0xdd3c('0x4e')]){_0x2bfbad['where']=_[_0xdd3c('0x4f')](_0x2bfbad[_0xdd3c('0x4c')],{'$or':_[_0xdd3c('0x3d')](_0x22a6e2,function(_0x15245b){if(_0x15245b['type']!==_0xdd3c('0x50')){var _0x199ff6={};_0x199ff6[_0x15245b[_0xdd3c('0x3a')]]={'$like':'%'+_0xc62238[_0xdd3c('0x42')]['filter']+'%'};return _0x199ff6;}})});}_0x2bfbad=_[_0xdd3c('0x4f')]({},_0x2bfbad,_0xc62238[_0xdd3c('0x51')]);var _0x2a119f={'where':_0x2bfbad['where']};return db[_0xdd3c('0x52')][_0xdd3c('0x2e')](_0x2a119f)[_0xdd3c('0x1e')](function(_0x161f3f){_0x52bfe0['count']=_0x161f3f;if(_0xc62238['query'][_0xdd3c('0x53')]){_0x2bfbad[_0xdd3c('0x54')]=[{'all':!![]}];}return db[_0xdd3c('0x52')][_0xdd3c('0x55')](_0x2bfbad);})[_0xdd3c('0x1e')](function(_0xdf70c8){_0x52bfe0[_0xdd3c('0x56')]=_0xdf70c8;return _0x52bfe0;})[_0xdd3c('0x1e')](respondWithFilteredResult(_0x4b8256,_0x2bfbad))[_0xdd3c('0x28')](handleError(_0x4b8256,null));};exports['show']=function(_0x1c61ec,_0x4dc871){var _0x1eb35e={'raw':![],'where':{'id':_0x1c61ec[_0xdd3c('0x57')]['id']},'include':[{'model':db[_0xdd3c('0x3b')],'as':_0xdd3c('0x3c')}]},_0x3a3bb5={};_0x3a3bb5[_0xdd3c('0x43')]=_[_0xdd3c('0x58')](db['WhatsappAccount']['rawAttributes']);_0x3a3bb5[_0xdd3c('0x42')]=_['keys'](_0x1c61ec[_0xdd3c('0x42')]);_0x3a3bb5['filters']=_[_0xdd3c('0x45')](_0x3a3bb5[_0xdd3c('0x43')],_0x3a3bb5[_0xdd3c('0x42')]);_0x1eb35e['attributes']=_[_0xdd3c('0x45')](_0x3a3bb5['model'],qs[_0xdd3c('0x46')](_0x1c61ec['query'][_0xdd3c('0x46')]));_0x1eb35e[_0xdd3c('0x44')]=_0x1eb35e[_0xdd3c('0x44')][_0xdd3c('0x47')]?_0x1eb35e['attributes']:_0x3a3bb5[_0xdd3c('0x43')];if(_0x1c61ec[_0xdd3c('0x42')][_0xdd3c('0x53')]){_0x1eb35e['include']=[{'all':!![]}];}_0x1eb35e=_[_0xdd3c('0x4f')]({},_0x1eb35e,_0x1c61ec['options']);return db[_0xdd3c('0x52')][_0xdd3c('0x59')](_0x1eb35e)[_0xdd3c('0x1e')](handleEntityNotFound(_0x4dc871,null))[_0xdd3c('0x1e')](respondWithResult(_0x4dc871,null))[_0xdd3c('0x28')](handleError(_0x4dc871,null));};exports[_0xdd3c('0x5a')]=function(_0x12d2c0,_0x3e16a9){return db['WhatsappAccount'][_0xdd3c('0x5a')](_0x12d2c0[_0xdd3c('0x5b')],{})[_0xdd3c('0x1e')](function(_0x587f9d){var _0x45ed1c=_0x12d2c0[_0xdd3c('0x5c')][_0xdd3c('0x37')]({'plain':!![]});if(!_0x45ed1c)throw new Error(_0xdd3c('0x5d'));if(_0x45ed1c['role']==='user'){var _0x562826=_0x587f9d[_0xdd3c('0x37')]({'plain':!![]});var _0x1e0e23=_0xdd3c('0x38');return db['UserProfileSection'][_0xdd3c('0x59')]({'where':{'name':_0x1e0e23,'userProfileId':_0x45ed1c[_0xdd3c('0x5e')]},'raw':!![]})[_0xdd3c('0x1e')](function(_0x15d209){if(_0x15d209&&_0x15d209[_0xdd3c('0x5f')]===0x0){return db['UserProfileResource'][_0xdd3c('0x5a')]({'name':_0x562826[_0xdd3c('0x3a')],'resourceId':_0x562826['id'],'type':_0x15d209['name'],'sectionId':_0x15d209['id']},{})[_0xdd3c('0x1e')](function(){return _0x587f9d;});}else{return _0x587f9d;}})[_0xdd3c('0x28')](function(_0x3a7ada){logger['error'](_0xdd3c('0x60'),_0x3a7ada);throw _0x3a7ada;});}return _0x587f9d;})[_0xdd3c('0x1e')](respondWithResult(_0x3e16a9,0xc9))[_0xdd3c('0x28')](handleError(_0x3e16a9,null));};exports[_0xdd3c('0x35')]=function(_0x1f7212,_0x206b0e){if(_0x1f7212[_0xdd3c('0x5b')]['id']){delete _0x1f7212[_0xdd3c('0x5b')]['id'];}return db[_0xdd3c('0x52')][_0xdd3c('0x59')]({'where':{'id':_0x1f7212[_0xdd3c('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xdd3c('0x3c')}]})['then'](handleEntityNotFound(_0x206b0e,null))[_0xdd3c('0x1e')](saveUpdates(_0x1f7212[_0xdd3c('0x5b')],null))[_0xdd3c('0x1e')](respondWithResult(_0x206b0e,null))[_0xdd3c('0x28')](handleError(_0x206b0e,null));};exports[_0xdd3c('0x36')]=function(_0x4304c8,_0xe5e2f){return db[_0xdd3c('0x52')][_0xdd3c('0x59')]({'where':{'id':_0x4304c8[_0xdd3c('0x57')]['id']}})['then'](handleEntityNotFound(_0xe5e2f,null))[_0xdd3c('0x1e')](removeEntity(_0xe5e2f,null))[_0xdd3c('0x28')](handleError(_0xe5e2f,null));};exports[_0xdd3c('0x61')]=function(_0x58ac0f,_0xdb4a4c){return db[_0xdd3c('0x52')]['describe']()[_0xdd3c('0x1e')](respondWithResult(_0xdb4a4c,null))['catch'](handleError(_0xdb4a4c,null));};exports[_0xdd3c('0x62')]=function(_0xecc1b3,_0x3dc262,_0x3d7e4e){if(_0xecc1b3['body']['id']){delete _0xecc1b3[_0xdd3c('0x5b')]['id'];}return db['WhatsappAccount'][_0xdd3c('0x59')]({'where':{'id':_0xecc1b3[_0xdd3c('0x57')]['id']}})['then'](handleEntityNotFound(_0x3dc262,null))[_0xdd3c('0x1e')](function(_0x1e0167){if(_0x1e0167){_0xecc1b3[_0xdd3c('0x5b')][_0xdd3c('0x63')]=_0x1e0167['id'];return db[_0xdd3c('0x64')][_0xdd3c('0x5a')](_0xecc1b3[_0xdd3c('0x5b')]);}})[_0xdd3c('0x1e')](respondWithResult(_0x3dc262,null))[_0xdd3c('0x28')](handleError(_0x3dc262,null));};exports[_0xdd3c('0x65')]=function(_0x550e2f,_0x83f62c,_0x4c445b){var _0x145d92={'raw':![],'where':{}};var _0x274dd5={};var _0xe84f88={'count':0x0,'rows':[]};return db[_0xdd3c('0x52')][_0xdd3c('0x66')]({'where':{'id':_0x550e2f[_0xdd3c('0x57')]['id']}})[_0xdd3c('0x1e')](handleEntityNotFound(_0x83f62c,null))[_0xdd3c('0x1e')](function(_0x23ccf4){if(_0x23ccf4){_0x274dd5[_0xdd3c('0x43')]=_[_0xdd3c('0x58')](db[_0xdd3c('0x64')][_0xdd3c('0x3e')]);_0x274dd5[_0xdd3c('0x42')]=_[_0xdd3c('0x58')](_0x550e2f[_0xdd3c('0x42')]);_0x274dd5[_0xdd3c('0x67')]=_[_0xdd3c('0x45')](_0x274dd5[_0xdd3c('0x43')],_0x274dd5[_0xdd3c('0x42')]);_0x145d92[_0xdd3c('0x44')]=_[_0xdd3c('0x45')](_0x274dd5['model'],qs[_0xdd3c('0x46')](_0x550e2f['query'][_0xdd3c('0x46')]));_0x145d92[_0xdd3c('0x44')]=_0x145d92[_0xdd3c('0x44')][_0xdd3c('0x47')]?_0x145d92[_0xdd3c('0x44')]:_0x274dd5[_0xdd3c('0x43')];if(!_0x550e2f[_0xdd3c('0x42')][_0xdd3c('0x48')]('nolimit')){_0x145d92['limit']=qs['limit'](_0x550e2f[_0xdd3c('0x42')][_0xdd3c('0x2f')]);_0x145d92[_0xdd3c('0x2c')]=qs[_0xdd3c('0x2c')](_0x550e2f['query']['offset']);}_0x145d92[_0xdd3c('0x4a')]=qs['sort'](_0x550e2f['query'][_0xdd3c('0x4b')]);_0x145d92[_0xdd3c('0x4c')]=qs['filters'](_[_0xdd3c('0x4d')](_0x550e2f[_0xdd3c('0x42')],_0x274dd5[_0xdd3c('0x67')]));_0x145d92[_0xdd3c('0x4c')]['WhatsappAccountId']=_0x23ccf4['id'];if(_0x550e2f[_0xdd3c('0x42')]['filter']){_0x145d92[_0xdd3c('0x4c')]=_[_0xdd3c('0x4f')](_0x145d92[_0xdd3c('0x4c')],{'$or':_['map'](_0x145d92[_0xdd3c('0x44')],function(_0x2530c2){var _0x4bfdf2={};_0x4bfdf2[_0x2530c2]={'$like':'%'+_0x550e2f[_0xdd3c('0x42')][_0xdd3c('0x4e')]+'%'};return _0x4bfdf2;})});}_0x145d92=_[_0xdd3c('0x4f')]({},_0x145d92,_0x550e2f['options']);return db[_0xdd3c('0x64')][_0xdd3c('0x2e')]({'where':_0x145d92['where']})[_0xdd3c('0x1e')](function(_0xf709d4){_0xe84f88['count']=_0xf709d4;if(_0x550e2f[_0xdd3c('0x42')][_0xdd3c('0x53')]){_0x145d92['include']=[{'all':!![]}];}return db[_0xdd3c('0x64')]['findAll'](_0x145d92);})[_0xdd3c('0x1e')](function(_0x301a36){_0xe84f88[_0xdd3c('0x56')]=_0x301a36;return _0xe84f88;});}})['then'](respondWithFilteredResult(_0x83f62c,_0x145d92))[_0xdd3c('0x28')](handleError(_0x83f62c,null));};exports[_0xdd3c('0x68')]=function(_0x268009,_0xfd2c86,_0x200f7d){return db[_0xdd3c('0x52')][_0xdd3c('0x59')]({'where':{'id':_0x268009['params']['id']}})[_0xdd3c('0x1e')](handleEntityNotFound(_0xfd2c86,null))[_0xdd3c('0x1e')](function(_0x302c6f){if(_0x302c6f){return _0x302c6f[_0xdd3c('0x68')](_0x268009[_0xdd3c('0x42')][_0xdd3c('0x69')]);}})[_0xdd3c('0x1e')](respondWithStatusCode(_0xfd2c86,null))[_0xdd3c('0x28')](handleError(_0xfd2c86,null));};exports[_0xdd3c('0x6a')]=function(_0x28b8d3,_0x1f55e0,_0x24b74b){if(_0x28b8d3[_0xdd3c('0x5b')]['id']){delete _0x28b8d3[_0xdd3c('0x5b')]['id'];}return db[_0xdd3c('0x52')][_0xdd3c('0x59')]({'where':{'id':_0x28b8d3[_0xdd3c('0x57')]['id']}})[_0xdd3c('0x1e')](handleEntityNotFound(_0x1f55e0,null))[_0xdd3c('0x1e')](function(_0x583e96){if(_0x583e96){_0x28b8d3[_0xdd3c('0x5b')]['WhatsappAccountId']=_0x583e96['id'];return db[_0xdd3c('0x6b')][_0xdd3c('0x5a')](_0x28b8d3[_0xdd3c('0x5b')]);}})[_0xdd3c('0x1e')](respondWithResult(_0x1f55e0,null))[_0xdd3c('0x28')](handleError(_0x1f55e0,null));};exports[_0xdd3c('0x6c')]=function(_0x2e922c,_0x342b,_0x5bb5ef){var _0x5aab8b={'raw':![],'where':{}};var _0x407b64={};var _0x2143d5={'count':0x0,'rows':[]};return db[_0xdd3c('0x52')][_0xdd3c('0x66')]({'where':{'id':_0x2e922c[_0xdd3c('0x57')]['id']}})['then'](handleEntityNotFound(_0x342b,null))[_0xdd3c('0x1e')](function(_0x368ec3){if(_0x368ec3){_0x407b64[_0xdd3c('0x43')]=_[_0xdd3c('0x58')](db['CannedAnswer']['rawAttributes']);_0x407b64[_0xdd3c('0x42')]=_[_0xdd3c('0x58')](_0x2e922c[_0xdd3c('0x42')]);_0x407b64[_0xdd3c('0x67')]=_[_0xdd3c('0x45')](_0x407b64['model'],_0x407b64[_0xdd3c('0x42')]);_0x5aab8b[_0xdd3c('0x44')]=_['intersection'](_0x407b64['model'],qs[_0xdd3c('0x46')](_0x2e922c[_0xdd3c('0x42')][_0xdd3c('0x46')]));_0x5aab8b[_0xdd3c('0x44')]=_0x5aab8b[_0xdd3c('0x44')][_0xdd3c('0x47')]?_0x5aab8b[_0xdd3c('0x44')]:_0x407b64[_0xdd3c('0x43')];if(!_0x2e922c[_0xdd3c('0x42')][_0xdd3c('0x48')](_0xdd3c('0x49'))){_0x5aab8b[_0xdd3c('0x2f')]=qs[_0xdd3c('0x2f')](_0x2e922c[_0xdd3c('0x42')][_0xdd3c('0x2f')]);_0x5aab8b['offset']=qs['offset'](_0x2e922c[_0xdd3c('0x42')][_0xdd3c('0x2c')]);}_0x5aab8b[_0xdd3c('0x4a')]=qs[_0xdd3c('0x4b')](_0x2e922c['query'][_0xdd3c('0x4b')]);_0x5aab8b[_0xdd3c('0x4c')]=qs[_0xdd3c('0x67')](_[_0xdd3c('0x4d')](_0x2e922c[_0xdd3c('0x42')],_0x407b64[_0xdd3c('0x67')]));_0x5aab8b[_0xdd3c('0x4c')]['WhatsappAccountId']=_0x368ec3['id'];if(_0x2e922c[_0xdd3c('0x42')][_0xdd3c('0x4e')]){_0x5aab8b[_0xdd3c('0x4c')]=_[_0xdd3c('0x4f')](_0x5aab8b[_0xdd3c('0x4c')],{'$or':_[_0xdd3c('0x3d')](_0x5aab8b[_0xdd3c('0x44')],function(_0xd08a2c){var _0x5019aa={};_0x5019aa[_0xd08a2c]={'$like':'%'+_0x2e922c['query'][_0xdd3c('0x4e')]+'%'};return _0x5019aa;})});}_0x5aab8b=_[_0xdd3c('0x4f')]({},_0x5aab8b,_0x2e922c[_0xdd3c('0x51')]);return db[_0xdd3c('0x6b')][_0xdd3c('0x2e')]({'where':_0x5aab8b[_0xdd3c('0x4c')]})['then'](function(_0x34388b){_0x2143d5['count']=_0x34388b;if(_0x2e922c['query'][_0xdd3c('0x53')]){_0x5aab8b[_0xdd3c('0x54')]=[{'all':!![]}];}return db[_0xdd3c('0x6b')][_0xdd3c('0x55')](_0x5aab8b);})[_0xdd3c('0x1e')](function(_0xafe5fc){_0x2143d5[_0xdd3c('0x56')]=_0xafe5fc;return _0x2143d5;});}})[_0xdd3c('0x1e')](respondWithFilteredResult(_0x342b,_0x5aab8b))[_0xdd3c('0x28')](handleError(_0x342b,null));};exports['removeAnswers']=function(_0x3d9798,_0x25c6d3,_0x430ead){return db[_0xdd3c('0x52')][_0xdd3c('0x59')]({'where':{'id':_0x3d9798[_0xdd3c('0x57')]['id']}})['then'](handleEntityNotFound(_0x25c6d3,null))[_0xdd3c('0x1e')](function(_0x555bdf){if(_0x555bdf){return _0x555bdf['removeAnswers'](_0x3d9798['query'][_0xdd3c('0x69')]);}})[_0xdd3c('0x1e')](respondWithStatusCode(_0x25c6d3,null))[_0xdd3c('0x28')](handleError(_0x25c6d3,null));};exports[_0xdd3c('0x6d')]=function(_0x3d8578,_0x222806,_0x5afb3a){return db[_0xdd3c('0x52')][_0xdd3c('0x59')]({'where':{'id':_0x3d8578['params']['id']}})[_0xdd3c('0x1e')](handleEntityNotFound(_0x222806,null))[_0xdd3c('0x1e')](function(_0x33fc25){if(_0x33fc25){return _0x33fc25['addAgents'](_0x3d8578[_0xdd3c('0x5b')]['ids'],_[_0xdd3c('0x6e')](_0x3d8578[_0xdd3c('0x5b')],[_0xdd3c('0x69'),'id'])||{})[_0xdd3c('0x6f')](function(_0x8ec545){for(var _0x4f023e=0x0;_0x4f023e<_0x3d8578[_0xdd3c('0x5b')][_0xdd3c('0x69')][_0xdd3c('0x47')];_0x4f023e+=0x1){socket[_0xdd3c('0x70')]('userWhatsappAccount:save',{'UserId':Number(_0x3d8578[_0xdd3c('0x5b')]['ids'][_0x4f023e]),'WhatsappAccountId':Number(_0x3d8578[_0xdd3c('0x57')]['id'])});}return _0x8ec545;});}})[_0xdd3c('0x1e')](respondWithResult(_0x222806,null))[_0xdd3c('0x28')](handleError(_0x222806,null));};exports[_0xdd3c('0x71')]=function(_0x184d38,_0x3dc1fe,_0x2cd148){return db['WhatsappAccount']['find']({'where':{'id':_0x184d38[_0xdd3c('0x57')]['id']}})['then'](handleEntityNotFound(_0x3dc1fe,null))['then'](function(_0x53ba42){if(_0x53ba42){return _0x53ba42[_0xdd3c('0x71')](_0x184d38['query'][_0xdd3c('0x69')])['then'](function(){if(_[_0xdd3c('0x72')](_0x184d38[_0xdd3c('0x42')][_0xdd3c('0x69')])){for(var _0x9e0399=0x0;_0x9e0399<_0x184d38[_0xdd3c('0x42')][_0xdd3c('0x69')][_0xdd3c('0x47')];_0x9e0399+=0x1){socket['emit'](_0xdd3c('0x73'),{'UserId':Number(_0x184d38[_0xdd3c('0x42')]['ids'][_0x9e0399]),'WhatsappAccountId':Number(_0x184d38[_0xdd3c('0x57')]['id'])});}}else{socket[_0xdd3c('0x70')](_0xdd3c('0x73'),{'UserId':Number(_0x184d38[_0xdd3c('0x42')]['ids']),'WhatsappAccountId':Number(_0x184d38[_0xdd3c('0x57')]['id'])});}});}})[_0xdd3c('0x1e')](respondWithStatusCode(_0x3dc1fe,null))[_0xdd3c('0x28')](handleError(_0x3dc1fe,null));};exports[_0xdd3c('0x74')]=function(_0x2eec3b,_0x49faff,_0x1c6cbf){var _0x35a546={};var _0x1365fe={};var _0x14fc02;var _0x107830;return db[_0xdd3c('0x52')][_0xdd3c('0x66')]({'where':{'id':_0x2eec3b[_0xdd3c('0x57')]['id']}})[_0xdd3c('0x1e')](handleEntityNotFound(_0x49faff,null))['then'](function(_0x3e5df5){if(_0x3e5df5){_0x14fc02=_0x3e5df5;_0x1365fe[_0xdd3c('0x43')]=_[_0xdd3c('0x58')](db['User'][_0xdd3c('0x3e')]);_0x1365fe[_0xdd3c('0x42')]=_[_0xdd3c('0x58')](_0x2eec3b[_0xdd3c('0x42')]);_0x1365fe['filters']=_[_0xdd3c('0x45')](_0x1365fe['model'],_0x1365fe[_0xdd3c('0x42')]);_0x35a546[_0xdd3c('0x44')]=_[_0xdd3c('0x45')](_0x1365fe[_0xdd3c('0x43')],qs[_0xdd3c('0x46')](_0x2eec3b[_0xdd3c('0x42')]['fields']));_0x35a546[_0xdd3c('0x44')]=_0x35a546[_0xdd3c('0x44')][_0xdd3c('0x47')]?_0x35a546[_0xdd3c('0x44')]:_0x1365fe[_0xdd3c('0x43')];_0x35a546[_0xdd3c('0x4a')]=qs[_0xdd3c('0x4b')](_0x2eec3b['query'][_0xdd3c('0x4b')]);_0x35a546[_0xdd3c('0x4c')]=qs[_0xdd3c('0x67')](_[_0xdd3c('0x4d')](_0x2eec3b[_0xdd3c('0x42')],_0x1365fe[_0xdd3c('0x67')]));if(_0x2eec3b[_0xdd3c('0x42')]['filter']){_0x35a546[_0xdd3c('0x4c')]=_[_0xdd3c('0x4f')](_0x35a546['where'],{'$or':_['map'](_0x35a546[_0xdd3c('0x44')],function(_0x97dc04){var _0x18d3ed={};_0x18d3ed[_0x97dc04]={'$like':'%'+_0x2eec3b['query'][_0xdd3c('0x4e')]+'%'};return _0x18d3ed;})});}_0x35a546=_[_0xdd3c('0x4f')]({},_0x35a546,_0x2eec3b[_0xdd3c('0x51')]);return _0x14fc02[_0xdd3c('0x74')](_0x35a546);}})[_0xdd3c('0x1e')](function(_0x4e6684){if(_0x4e6684){_0x107830=_0x4e6684['length'];if(!_0x2eec3b['query']['hasOwnProperty'](_0xdd3c('0x49'))){_0x35a546['limit']=qs[_0xdd3c('0x2f')](_0x2eec3b[_0xdd3c('0x42')][_0xdd3c('0x2f')]);_0x35a546[_0xdd3c('0x2c')]=qs[_0xdd3c('0x2c')](_0x2eec3b[_0xdd3c('0x42')]['offset']);}return _0x14fc02[_0xdd3c('0x74')](_0x35a546);}})['then'](function(_0x4d327c){if(_0x4d327c){return _0x4d327c?{'count':_0x107830,'rows':_0x4d327c}:null;}})[_0xdd3c('0x1e')](respondWithResult(_0x49faff,null))['catch'](handleError(_0x49faff,null));};exports[_0xdd3c('0x75')]=function(_0x1eea9d,_0x4d376d){var _0x449efe=_0x1eea9d['params']['id'];var _0x135066=_0x1eea9d[_0xdd3c('0x5b')];var _0x263152=0xc8;var _0x4d7a96=null;return db[_0xdd3c('0x76')][_0xdd3c('0x77')]({'isolationLevel':db[_0xdd3c('0x76')][_0xdd3c('0x78')][_0xdd3c('0x79')]['READ_COMMITTED']},function(_0x40cf22){return db[_0xdd3c('0x52')][_0xdd3c('0x66')]({'where':{'id':_0x449efe},'transaction':_0x40cf22})[_0xdd3c('0x1e')](function(_0x45e5bb){if(_0x45e5bb){return db[_0xdd3c('0x7a')]['destroy']({'where':{'WhatsappAccountId':_0x449efe},'transaction':_0x40cf22})[_0xdd3c('0x1e')](function(){var _0x3f063d=_[_0xdd3c('0x3d')](_0x135066,function(_0x4131e6){_0x4131e6[_0xdd3c('0x63')]=_0x449efe;return _0x4131e6;});return db[_0xdd3c('0x7a')]['bulkCreate'](_0x3f063d,{'transaction':_0x40cf22});});}else{_0x263152=0x194;_0x4d7a96=[];}});})[_0xdd3c('0x1e')](function(){if(_0x263152!==0x194){return db[_0xdd3c('0x7a')][_0xdd3c('0x7b')]({'where':{'WhatsappAccountId':_0x449efe},'order':'priority'})[_0xdd3c('0x1e')](function(_0x51be46){_0x4d7a96=_0x51be46;});}})['catch'](function(_0x5f5dd8){_0x263152=0x1f4;logger[_0xdd3c('0x24')](_0x5f5dd8[_0xdd3c('0x7c')]);if(_0x5f5dd8['name']){delete _0x5f5dd8[_0xdd3c('0x3a')];}_0x4d7a96=_0x5f5dd8;})[_0xdd3c('0x7d')](function(){if(_0x4d7a96===null){_0x4d376d['sendStatus'](_0x263152);}else{if(_0x263152===0x1f4){_0x4d376d[_0xdd3c('0x2a')](_0x263152)[_0xdd3c('0x7e')](_0x4d7a96);}else{_0x4d376d[_0xdd3c('0x2a')](_0x263152)[_0xdd3c('0x31')](_0x4d7a96);}}});};exports[_0xdd3c('0x7f')]=function(_0x3448b1,_0x277503,_0x188a38){var _0x1ea816={};var _0x10f13b={};var _0x152fc8;var _0x3aa2a1;return db[_0xdd3c('0x52')][_0xdd3c('0x66')]({'where':{'id':_0x3448b1[_0xdd3c('0x57')]['id']}})[_0xdd3c('0x1e')](handleEntityNotFound(_0x277503,null))[_0xdd3c('0x1e')](function(_0x74b553){if(_0x74b553){_0x152fc8=_0x74b553;_0x10f13b['model']=_[_0xdd3c('0x58')](db[_0xdd3c('0x7a')][_0xdd3c('0x3e')]);_0x10f13b['query']=_[_0xdd3c('0x58')](_0x3448b1['query']);_0x10f13b[_0xdd3c('0x67')]=_[_0xdd3c('0x45')](_0x10f13b['model'],_0x10f13b[_0xdd3c('0x42')]);_0x1ea816['attributes']=_[_0xdd3c('0x45')](_0x10f13b[_0xdd3c('0x43')],qs[_0xdd3c('0x46')](_0x3448b1[_0xdd3c('0x42')][_0xdd3c('0x46')]));_0x1ea816[_0xdd3c('0x44')]=_0x1ea816[_0xdd3c('0x44')][_0xdd3c('0x47')]?_0x1ea816[_0xdd3c('0x44')]:_0x10f13b[_0xdd3c('0x43')];_0x1ea816[_0xdd3c('0x4a')]=qs['sort'](_0x3448b1[_0xdd3c('0x42')][_0xdd3c('0x4b')]);_0x1ea816[_0xdd3c('0x4c')]=qs[_0xdd3c('0x67')](_[_0xdd3c('0x4d')](_0x3448b1[_0xdd3c('0x42')],_0x10f13b[_0xdd3c('0x67')]));if(_0x3448b1[_0xdd3c('0x42')]['filter']){_0x1ea816[_0xdd3c('0x4c')]=_['merge'](_0x1ea816[_0xdd3c('0x4c')],{'$or':_[_0xdd3c('0x3d')](_0x1ea816['attributes'],function(_0x19b8c5){var _0x5a7f7b={};_0x5a7f7b[_0x19b8c5]={'$like':'%'+_0x3448b1[_0xdd3c('0x42')][_0xdd3c('0x4e')]+'%'};return _0x5a7f7b;})});}_0x1ea816=_[_0xdd3c('0x4f')]({},_0x1ea816,_0x3448b1[_0xdd3c('0x51')]);return _0x152fc8['getApplications'](_0x1ea816);}})[_0xdd3c('0x1e')](function(_0x348c52){if(_0x348c52){_0x3aa2a1=_0x348c52[_0xdd3c('0x47')];if(!_0x3448b1['query'][_0xdd3c('0x48')](_0xdd3c('0x49'))){_0x1ea816[_0xdd3c('0x2f')]=qs['limit'](_0x3448b1[_0xdd3c('0x42')][_0xdd3c('0x2f')]);_0x1ea816[_0xdd3c('0x2c')]=qs[_0xdd3c('0x2c')](_0x3448b1[_0xdd3c('0x42')][_0xdd3c('0x2c')]);}return _0x152fc8[_0xdd3c('0x7f')](_0x1ea816);}})[_0xdd3c('0x1e')](function(_0xbe70e7){if(_0xbe70e7){return _0xbe70e7?{'count':_0x3aa2a1,'rows':_0xbe70e7}:null;}})[_0xdd3c('0x1e')](respondWithResult(_0x277503,null))['catch'](handleError(_0x277503,null));};exports['notify']=function(_0x1bf572,_0x5bb6a2,_0x12be95){var _0x35656e={'channel':_0xdd3c('0x80')};var _0x3efd7e=[];var _0x25a589=[];var _0x3ac45d={};return db[_0xdd3c('0x52')]['find']({'where':{'id':_0x1bf572[_0xdd3c('0x57')]['id']},'include':[{'model':db[_0xdd3c('0x7a')],'as':'Applications'}]})[_0xdd3c('0x1e')](handleEntityNotFound(_0x5bb6a2,null))[_0xdd3c('0x1e')](function(_0x2abec5){_0x35656e[_0xdd3c('0x81')]=_0x2abec5;if(_0x35656e[_0xdd3c('0x81')]&&_0x35656e[_0xdd3c('0x81')]['type']===_0xdd3c('0x82')&&_0x1bf572['body'][_0xdd3c('0x83')]){if(_0x1bf572['body'][_0xdd3c('0x83')][_0xdd3c('0x47')]===0x0)return;if(_0x1bf572[_0xdd3c('0x5b')]['statuses'][0x0]['state']!==_0xdd3c('0x84'))return;return db['WhatsappMessage'][_0xdd3c('0x35')]({'read':!![],'readAt':_0x1bf572[_0xdd3c('0x5b')][_0xdd3c('0x83')][0x0][_0xdd3c('0x85')]},{'where':{'messageId':_0x1bf572[_0xdd3c('0x5b')]['statuses'][0x0][_0xdd3c('0x86')]},'individualHooks':!![]})['then'](function(_0x5cf215){return _0x5bb6a2[_0xdd3c('0x2a')](0xc8)[_0xdd3c('0x31')](_0x5cf215);});}_0x35656e[_0xdd3c('0x87')]=_[_0xdd3c('0x88')](_0x2abec5[_0xdd3c('0x89')],[_0xdd3c('0x8a')],['asc']);if(_0x35656e[_0xdd3c('0x81')]['Applications']){delete _0x35656e['account']['Applications'];}return db[_0xdd3c('0x8b')][_0xdd3c('0x61')]()[_0xdd3c('0x1e')](function(_0x281bea){if(!_0x281bea){throw new db['Sequelize']['ValidationError'](_0xdd3c('0x8c'));}_0x3efd7e=_[_0xdd3c('0x8d')](_[_0xdd3c('0x58')](_0x281bea),['createdAt',_0xdd3c('0x8e')]);_0x25a589=_['difference'](_[_0xdd3c('0x58')](_0x281bea),['createdAt',_0xdd3c('0x8e'),_0xdd3c('0x8f'),_0xdd3c('0x90')]);_0x35656e[_0xdd3c('0x5b')]={'mapKey':'mobile'};if(_0x35656e[_0xdd3c('0x81')]&&_0x35656e[_0xdd3c('0x81')][_0xdd3c('0x40')]===_0xdd3c('0x91')){_0x35656e[_0xdd3c('0x5b')][_0xdd3c('0x92')]=_0x1bf572[_0xdd3c('0x5b')][_0xdd3c('0x93')][_0xdd3c('0x94')](_0xdd3c('0x95'),'');_0x35656e[_0xdd3c('0x5b')]['body']=_0x1bf572[_0xdd3c('0x5b')]['Body'];_0x35656e['body'][_0xdd3c('0x96')]=_0x1bf572[_0xdd3c('0x5b')][_0xdd3c('0x97')];}if(_0x35656e[_0xdd3c('0x81')]&&_0x35656e[_0xdd3c('0x81')][_0xdd3c('0x40')]===_0xdd3c('0x82')){_0x35656e[_0xdd3c('0x5b')][_0xdd3c('0x92')]=_0x1bf572['body'][_0xdd3c('0x98')][0x0][_0xdd3c('0x92')];_0x35656e[_0xdd3c('0x5b')][_0xdd3c('0x5b')]=_0x1bf572['body'][_0xdd3c('0x98')][0x0][_0xdd3c('0x26')][_0xdd3c('0x5b')];_0x35656e[_0xdd3c('0x5b')][_0xdd3c('0x96')]=_0x1bf572[_0xdd3c('0x5b')]['notifications'][0x0][_0xdd3c('0x86')];}if(_0x35656e[_0xdd3c('0x5b')]['id']){delete _0x35656e[_0xdd3c('0x5b')]['id'];}if(_[_0xdd3c('0x99')](_0x35656e[_0xdd3c('0x5b')]['from'])){throw new db[(_0xdd3c('0x9a'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x35656e[_0xdd3c('0x5b')][_0xdd3c('0x5b')])||_0x35656e[_0xdd3c('0x5b')]['body']===''){throw new db['Sequelize'][(_0xdd3c('0x9b'))](_0xdd3c('0x9c'));}if(_['isNil'](_0x35656e[_0xdd3c('0x5b')][_0xdd3c('0x9d')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x25a589);}if(!_[_0xdd3c('0x9e')](_0x25a589,_0x35656e[_0xdd3c('0x5b')][_0xdd3c('0x9d')])){throw new db['Sequelize'][(_0xdd3c('0x9b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x25a589);}_0x3ac45d[_0x35656e['body'][_0xdd3c('0x9d')]]=_0x35656e[_0xdd3c('0x5b')][_0xdd3c('0x92')];return db[_0xdd3c('0x9f')][_0xdd3c('0x59')]({'where':{'id':_0x35656e['account'][_0xdd3c('0x90')]},'include':[{'model':db[_0xdd3c('0x8b')],'as':_0xdd3c('0xa0'),'where':_0x3ac45d,'limit':0x1,'order':[[_0xdd3c('0x8e'),_0xdd3c('0xa1')]]}]});})[_0xdd3c('0x1e')](handleEntityNotFound(_0x5bb6a2,null))['then'](function(_0x5e7bdb){if(_0x5e7bdb){_0x35656e[_0xdd3c('0xa2')]=_[_0xdd3c('0x6e')](_0x5e7bdb,[_0xdd3c('0xa0')]);if(_0x5e7bdb[_0xdd3c('0xa0')][_0xdd3c('0x47')]){return _0x5e7bdb[_0xdd3c('0xa0')][0x0];}var _0x2cc0af=_['defaults'](_0x35656e[_0xdd3c('0x5b')],{'firstName':_0x35656e['body'][_0xdd3c('0x92')],'ListId':_0x5e7bdb['id']});_0x2cc0af[_0x35656e[_0xdd3c('0x5b')][_0xdd3c('0x9d')]]=_0x35656e[_0xdd3c('0x5b')][_0xdd3c('0x92')];return db[_0xdd3c('0x8b')][_0xdd3c('0x5a')](_0x2cc0af,{'fields':_0x3efd7e,'raw':!![]});}})['then'](handleEntityNotFound(_0x5bb6a2,null))['then'](function(_0x5dd7e5){if(_0x5dd7e5){_0x35656e[_0xdd3c('0xa3')]=_0x5dd7e5;var _0x11ebff={'ContactId':_0x5dd7e5['id'],'phone':_0x35656e[_0xdd3c('0x5b')][_0xdd3c('0x92')],'WhatsappAccountId':_0x1bf572[_0xdd3c('0x57')]['id']};var _0x1031e4={'ContactId':_0x5dd7e5['id'],'WhatsappAccountId':_0x1bf572[_0xdd3c('0x57')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xdd3c('0x59')]({'where':_0x1031e4})['then'](function(_0xff9db8){if(_0xff9db8){return[_0xff9db8,![]];}return db[_0xdd3c('0xa4')][_0xdd3c('0x5a')](_0x11ebff)['then'](function(_0xe5518d){return[_0xe5518d,!![]];});});}})[_0xdd3c('0x6f')](function(_0x3ca7c4,_0x5c21a1){_0x35656e[_0xdd3c('0xa5')]=_0x3ca7c4[_0xdd3c('0x37')]({'plain':!![]});_0x35656e[_0xdd3c('0xa5')]['created']=![];if(_0x5c21a1){if(_0x35656e[_0xdd3c('0x81')][_0xdd3c('0xa6')]){_0x35656e[_0xdd3c('0x87')][_0xdd3c('0xa7')]({'id':0x0,'priority':_0x35656e[_0xdd3c('0x87')][_0xdd3c('0x47')]+0x1,'app':'close','appdata':_0xdd3c('0xa8'),'interval':_0xdd3c('0xa9')});}_0x35656e[_0xdd3c('0xa5')]['created']=!![];}return db[_0xdd3c('0xaa')][_0xdd3c('0x5a')]({'phone':_0x35656e[_0xdd3c('0x5b')]['from'],'messageId':_0x35656e[_0xdd3c('0x5b')]['messageId'],'body':_0x35656e[_0xdd3c('0x5b')]['body'],'WhatsappAccountId':_0x1bf572[_0xdd3c('0x57')]['id'],'WhatsappInteractionId':_0x3ca7c4['id'],'direction':'in','ContactId':_0x3ca7c4[_0xdd3c('0xab')],'AttachmentId':_0x35656e['body'][_0xdd3c('0xac')]});})['then'](function(_0x2f868e){_0x35656e['message']=_0x2f868e;if(_0x35656e[_0xdd3c('0xa5')][_0xdd3c('0xad')]){return db[_0xdd3c('0xae')][_0xdd3c('0x59')]({'attributes':['id',_0xdd3c('0x3a')],'where':{'id':_0x35656e[_0xdd3c('0xa5')][_0xdd3c('0xad')]}})[_0xdd3c('0x1e')](function(_0x3ec185){if(_0x3ec185){_0x35656e['applications'][_0xdd3c('0xaf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3ec185['name']+','+(_0x35656e[_0xdd3c('0x81')][_0xdd3c('0xb0')]||0xa),'interval':_0xdd3c('0xa9')});}return respondWithRpcPromise('Start',_0xdd3c('0xb1'),_0x35656e);});}return respondWithRpcPromise(_0xdd3c('0xb2'),_0xdd3c('0xb1'),_0x35656e);})['then'](function(_0xbff5ab){if(_0xbff5ab){var _0x1fb8df=0xc8;var _0x317b65='receiveMessage';logger[_0xdd3c('0x1f')](_0xdd3c('0xb3'),_0x317b65,_0x1fb8df,_0xdd3c('0xb4'));logger['debug'](_0xdd3c('0xb5'),_0x317b65,_0x1fb8df,_0xdd3c('0xb4'),JSON['stringify'](_0xbff5ab));if(_0x35656e[_0xdd3c('0x81')]['type']===_0xdd3c('0x91')){return _0x5bb6a2[_0xdd3c('0x2a')](_0x1fb8df)[_0xdd3c('0xb6')](_0xdd3c('0xb7'),_0xdd3c('0xb8'))[_0xdd3c('0x7e')](_0xdd3c('0xb9'));}else{return _0x5bb6a2[_0xdd3c('0x2a')](_0x1fb8df)[_0xdd3c('0x31')](_0xbff5ab);}}});})[_0xdd3c('0x28')](handleError(_0x5bb6a2,null));};exports[_0xdd3c('0x7e')]=function(_0x56c307,_0x1dc45b,_0x4f4e4c){var _0x2a3b1e,_0x140f9e,_0x23c624;if(_[_0xdd3c('0x99')](_0x56c307[_0xdd3c('0x5b')][_0xdd3c('0x5b')])||_0x56c307['body'][_0xdd3c('0x5b')]===''){throw new db[(_0xdd3c('0x9a'))][(_0xdd3c('0x9b'))](_0xdd3c('0x9c'));}if(_[_0xdd3c('0x99')](_0x56c307[_0xdd3c('0x5b')]['to'])){throw new db[(_0xdd3c('0x9a'))]['ValidationError'](_0xdd3c('0xba'));}_0x2a3b1e=_0x56c307[_0xdd3c('0x5b')]['to'];return db[_0xdd3c('0x52')][_0xdd3c('0x59')]({'where':{'id':_0x56c307[_0xdd3c('0x57')]['id']},'include':[{'model':db[_0xdd3c('0x9f')],'as':_0xdd3c('0xbb'),'include':[{'model':db[_0xdd3c('0x8b')],'as':'Contacts','where':{'mobile':_0x2a3b1e},'limit':0x1,'order':[[_0xdd3c('0x8e'),_0xdd3c('0xa1')]]}]}]})[_0xdd3c('0x1e')](handleEntityNotFound(_0x1dc45b,null))[_0xdd3c('0x1e')](function(_0x235773){if(_0x235773&&_0x235773['List']){_0x140f9e=_0x235773['get']({'plain':!![]});if(_0x140f9e['List']&&_0x140f9e[_0xdd3c('0xbb')][_0xdd3c('0xa0')][_0xdd3c('0x47')]){return _0x140f9e['List'][_0xdd3c('0xa0')][0x0];}return db[_0xdd3c('0x8b')]['create'](_[_0xdd3c('0xbc')](_0x56c307[_0xdd3c('0x5b')],{'firstName':_0x2a3b1e,'mobile':_0x2a3b1e,'phone':_0x2a3b1e,'ListId':_0x140f9e[_0xdd3c('0x90')]}));}})[_0xdd3c('0x1e')](handleEntityNotFound(_0x1dc45b,null))[_0xdd3c('0x1e')](function(_0xb54331){if(_0xb54331){_0x23c624=_0xb54331;return db[_0xdd3c('0xa4')][_0xdd3c('0x59')]({'where':{'ContactId':_0x23c624['id'],'closed':![],'WhatsappAccountId':_0x140f9e['id']}})[_0xdd3c('0x1e')](function(_0x4395b0){if(_0x4395b0){return[_0x4395b0,![]];}return db['WhatsappInteraction'][_0xdd3c('0x5a')]({'UserId':_0x56c307[_0xdd3c('0x5c')]['id'],'ContactId':_0x23c624['id'],'WhatsappAccountId':_0x140f9e['id'],'phone':_0x2a3b1e,'firstMsgDirection':'out','Messages':[_[_0xdd3c('0x4f')](_0x56c307[_0xdd3c('0x5b')],{'read':![],'body':_0x56c307[_0xdd3c('0x5b')][_0xdd3c('0x5b')],'phone':_0x2a3b1e,'WhatsappAccountId':_0x140f9e['id'],'UserId':_0x56c307[_0xdd3c('0x5c')]['id'],'ContactId':_0x23c624['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xdd3c('0xbd')}]})[_0xdd3c('0x1e')](function(_0x1a69f7){return[_0x1a69f7,!![]];});});}})[_0xdd3c('0x6f')](function(_0x2450c9,_0x5c544c){if(_0x5c544c){return _0x2450c9;}return db[_0xdd3c('0xaa')][_0xdd3c('0x5a')](_[_0xdd3c('0x4f')](_0x56c307['body'],{'read':![],'body':_0x56c307[_0xdd3c('0x5b')][_0xdd3c('0x5b')],'phone':_0x2a3b1e,'WhatsappAccountId':_0x140f9e['id'],'WhatsappInteractionId':_0x2450c9['id'],'UserId':_0x56c307[_0xdd3c('0x5c')]['id'],'ContactId':_0x23c624['id']}))[_0xdd3c('0x1e')](function(_0x2d45d6){_0x2450c9[_0xdd3c('0xbe')][_0xdd3c('0xbd')]=[];_0x2450c9[_0xdd3c('0xbe')]['Messages'][_0xdd3c('0xa7')](_0x2d45d6[_0xdd3c('0xbe')]);return _0x2450c9;});})[_0xdd3c('0x1e')](respondWithResult(_0x1dc45b,null))[_0xdd3c('0x28')](handleError(_0x1dc45b,null));}; \ No newline at end of file +var _0x0d89=['WhatsappMessage','message_id','applications','asc','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','messageId','MessageSid','notifications','isNil','Sequelize','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','CmContact','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','AttachmentId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','text/xml','\x0a','to\x20is\x20mandatory','List','out','user','Messages','dataValues','zip-dir','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','destroy','get','WhatsappAccounts','end','stack','name','send','index','Pause','map','WhatsappAccount','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','include','findAll','rows','catch','filters','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','params','describe','addDisposition','WhatsappAccountId','findOne','Disposition','order','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','emit','getAgents','User','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','priority','sendStatus','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read'];(function(_0x2924c2,_0x3a0343){var _0x2fe2a1=function(_0x5a444b){while(--_0x5a444b){_0x2924c2['push'](_0x2924c2['shift']());}};_0x2fe2a1(++_0x3a0343);}(_0x0d89,0xf2));var _0x90d8=function(_0x3ee9b2,_0xa090bb){_0x3ee9b2=_0x3ee9b2-0x0;var _0x51ac3e=_0x0d89[_0x3ee9b2];return _0x51ac3e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x90d8('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x90d8('0x1'));var util=require(_0x90d8('0x2'));var path=require('path');var sox=require(_0x90d8('0x3'));var csv=require(_0x90d8('0x4'));var ejs=require(_0x90d8('0x5'));var fs=require('fs');var fs_extra=require(_0x90d8('0x6'));var _=require(_0x90d8('0x7'));var squel=require(_0x90d8('0x8'));var crypto=require(_0x90d8('0x9'));var jsforce=require(_0x90d8('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x90d8('0xb'));var authService=require(_0x90d8('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x90d8('0xd'));var hardwareService=require(_0x90d8('0xe'));var logger=require(_0x90d8('0xf'))('api');var utils=require(_0x90d8('0x10'));var config=require(_0x90d8('0x11'));var licenseUtil=require(_0x90d8('0x12'));var db=require(_0x90d8('0x13'))['db'];config[_0x90d8('0x14')]=_[_0x90d8('0x15')](config[_0x90d8('0x14')],{'host':_0x90d8('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x90d8('0x14')]));require('./whatsappAccount.socket')[_0x90d8('0x17')](socket);var jayson=require(_0x90d8('0x18'));var client=jayson[_0x90d8('0x19')][_0x90d8('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x60e436,_0x4a085f,_0x3c596f,_0x568312){return new BPromise(function(_0x37d6f0,_0x4b3f59){var _0x2006b4=_0x568312||client;return _0x2006b4[_0x90d8('0x1b')](_0x60e436,_0x3c596f)[_0x90d8('0x1c')](function(_0x1aadbc){logger[_0x90d8('0x1d')](_0x90d8('0x1e'),_0x4a085f,_0x90d8('0x1f'));logger[_0x90d8('0x20')](_0x90d8('0x21'),_0x4a085f,'request\x20sent',JSON['stringify'](_0x1aadbc));if(_0x1aadbc['error']){if(_0x1aadbc[_0x90d8('0x22')][_0x90d8('0x23')]===0x1f4){logger[_0x90d8('0x22')](_0x90d8('0x1e'),_0x4a085f,_0x1aadbc['error'][_0x90d8('0x24')]);return _0x4b3f59(_0x1aadbc[_0x90d8('0x22')][_0x90d8('0x24')]);}logger[_0x90d8('0x22')](_0x90d8('0x1e'),_0x4a085f,_0x1aadbc[_0x90d8('0x22')][_0x90d8('0x24')]);return _0x37d6f0(_0x1aadbc[_0x90d8('0x22')][_0x90d8('0x24')]);}else{logger[_0x90d8('0x1d')](_0x90d8('0x1e'),_0x4a085f,_0x90d8('0x1f'));_0x37d6f0(_0x1aadbc[_0x90d8('0x25')][_0x90d8('0x24')]);}})['catch'](function(_0x387e19){logger[_0x90d8('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x4a085f,_0x387e19);_0x4b3f59(_0x387e19);});});}function respondWithStatusCode(_0x207368,_0xe41382){_0xe41382=_0xe41382||0xcc;return function(_0x3f22c4){if(_0x3f22c4){return _0x207368['sendStatus'](_0xe41382);}return _0x207368[_0x90d8('0x26')](_0xe41382)['end']();};}function respondWithResult(_0x564ed5,_0xec9e49){_0xec9e49=_0xec9e49||0xc8;return function(_0x2875b2){if(_0x2875b2){return _0x564ed5[_0x90d8('0x26')](_0xec9e49)['json'](_0x2875b2);}};}function respondWithFilteredResult(_0x5f1107,_0x16aba6){return function(_0x1ed9e4){if(_0x1ed9e4){var _0x267081=typeof _0x16aba6[_0x90d8('0x27')]===_0x90d8('0x28')&&typeof _0x16aba6['limit']==='undefined';var _0x37e02c=_0x1ed9e4[_0x90d8('0x29')];var _0x6e7c=_0x267081?0x0:_0x16aba6[_0x90d8('0x27')];var _0x32d7e1=_0x267081?_0x1ed9e4[_0x90d8('0x29')]:_0x16aba6[_0x90d8('0x27')]+_0x16aba6[_0x90d8('0x2a')];var _0x20ef01;if(_0x32d7e1>=_0x37e02c){_0x32d7e1=_0x37e02c;_0x20ef01=0xc8;}else{_0x20ef01=0xce;}_0x5f1107[_0x90d8('0x26')](_0x20ef01);return _0x5f1107[_0x90d8('0x2b')](_0x90d8('0x2c'),_0x6e7c+'-'+_0x32d7e1+'/'+_0x37e02c)[_0x90d8('0x2d')](_0x1ed9e4);}return null;};}function patchUpdates(_0x1e9291){return function(_0x36102e){try{jsonpatch[_0x90d8('0x2e')](_0x36102e,_0x1e9291,!![]);}catch(_0x263180){return BPromise['reject'](_0x263180);}return _0x36102e[_0x90d8('0x2f')]();};}function saveUpdates(_0x8ee46d,_0x75e514){return function(_0x47f24a){if(_0x47f24a){return _0x47f24a[_0x90d8('0x30')](_0x8ee46d)['then'](function(_0x4e5dff){return _0x4e5dff;});}return null;};}function removeEntity(_0xeecd89,_0x1e1a84){return function(_0x2eb079){if(_0x2eb079){return _0x2eb079[_0x90d8('0x31')]()[_0x90d8('0x1c')](function(){var _0x48ab5f=_0x2eb079[_0x90d8('0x32')]({'plain':!![]});var _0x2275ce=_0x90d8('0x33');return db['UserProfileResource'][_0x90d8('0x31')]({'where':{'type':_0x2275ce,'resourceId':_0x48ab5f['id']}})[_0x90d8('0x1c')](function(){return _0x2eb079;});})[_0x90d8('0x1c')](function(){_0xeecd89['status'](0xcc)[_0x90d8('0x34')]();});}};}function handleEntityNotFound(_0x47f9ce,_0x4bad55){return function(_0x257eef){if(!_0x257eef){_0x47f9ce['sendStatus'](0x194);}return _0x257eef;};}function handleError(_0x5cfe44,_0x4f2cb0){_0x4f2cb0=_0x4f2cb0||0x1f4;return function(_0x250b4c){logger['error'](_0x250b4c[_0x90d8('0x35')]);if(_0x250b4c[_0x90d8('0x36')]){delete _0x250b4c[_0x90d8('0x36')];}_0x5cfe44[_0x90d8('0x26')](_0x4f2cb0)[_0x90d8('0x37')](_0x250b4c);};}exports[_0x90d8('0x38')]=function(_0x4b0c58,_0x27416e){var _0x22fa08={'include':[{'model':db[_0x90d8('0x39')],'as':'mandatoryDispositionPause'}]},_0x4d3fc0={},_0x278f1={'count':0x0,'rows':[]};var _0x51f7c9=_[_0x90d8('0x3a')](db[_0x90d8('0x3b')][_0x90d8('0x3c')],function(_0x1d20ed){return{'name':_0x1d20ed[_0x90d8('0x3d')],'type':_0x1d20ed[_0x90d8('0x3e')]['key']};});_0x4d3fc0['model']=_['map'](_0x51f7c9,_0x90d8('0x36'));_0x4d3fc0['query']=_[_0x90d8('0x3f')](_0x4b0c58[_0x90d8('0x40')]);_0x4d3fc0['filters']=_[_0x90d8('0x41')](_0x4d3fc0[_0x90d8('0x42')],_0x4d3fc0[_0x90d8('0x40')]);_0x22fa08[_0x90d8('0x43')]=_[_0x90d8('0x41')](_0x4d3fc0[_0x90d8('0x42')],qs[_0x90d8('0x44')](_0x4b0c58[_0x90d8('0x40')][_0x90d8('0x44')]));_0x22fa08[_0x90d8('0x43')]=_0x22fa08['attributes'][_0x90d8('0x45')]?_0x22fa08['attributes']:_0x4d3fc0[_0x90d8('0x42')];if(!_0x4b0c58[_0x90d8('0x40')][_0x90d8('0x46')](_0x90d8('0x47'))){_0x22fa08['limit']=qs[_0x90d8('0x2a')](_0x4b0c58['query']['limit']);_0x22fa08['offset']=qs[_0x90d8('0x27')](_0x4b0c58['query'][_0x90d8('0x27')]);}_0x22fa08['order']=qs[_0x90d8('0x48')](_0x4b0c58['query'][_0x90d8('0x48')]);_0x22fa08[_0x90d8('0x49')]=qs['filters'](_['pick'](_0x4b0c58[_0x90d8('0x40')],_0x4d3fc0['filters']),_0x51f7c9);if(_0x4b0c58[_0x90d8('0x40')][_0x90d8('0x4a')]){_0x22fa08[_0x90d8('0x49')]=_[_0x90d8('0x4b')](_0x22fa08['where'],{'$or':_[_0x90d8('0x3a')](_0x51f7c9,function(_0xe9cfeb){if(_0xe9cfeb['type']!=='VIRTUAL'){var _0x211b56={};_0x211b56[_0xe9cfeb[_0x90d8('0x36')]]={'$like':'%'+_0x4b0c58['query'][_0x90d8('0x4a')]+'%'};return _0x211b56;}})});}_0x22fa08=_[_0x90d8('0x4b')]({},_0x22fa08,_0x4b0c58['options']);var _0x2b6655={'where':_0x22fa08[_0x90d8('0x49')]};return db[_0x90d8('0x3b')][_0x90d8('0x29')](_0x2b6655)['then'](function(_0xf27c3){_0x278f1['count']=_0xf27c3;if(_0x4b0c58[_0x90d8('0x40')]['includeAll']){_0x22fa08[_0x90d8('0x4c')]=[{'all':!![]}];}return db[_0x90d8('0x3b')][_0x90d8('0x4d')](_0x22fa08);})['then'](function(_0x2768b7){_0x278f1[_0x90d8('0x4e')]=_0x2768b7;return _0x278f1;})[_0x90d8('0x1c')](respondWithFilteredResult(_0x27416e,_0x22fa08))[_0x90d8('0x4f')](handleError(_0x27416e,null));};exports['show']=function(_0x2c221a,_0x240b5d){var _0x5b8fd9={'raw':![],'where':{'id':_0x2c221a['params']['id']},'include':[{'model':db[_0x90d8('0x39')],'as':'mandatoryDispositionPause'}]},_0x6d2610={};_0x6d2610[_0x90d8('0x42')]=_['keys'](db[_0x90d8('0x3b')][_0x90d8('0x3c')]);_0x6d2610['query']=_[_0x90d8('0x3f')](_0x2c221a[_0x90d8('0x40')]);_0x6d2610[_0x90d8('0x50')]=_['intersection'](_0x6d2610[_0x90d8('0x42')],_0x6d2610[_0x90d8('0x40')]);_0x5b8fd9[_0x90d8('0x43')]=_[_0x90d8('0x41')](_0x6d2610[_0x90d8('0x42')],qs[_0x90d8('0x44')](_0x2c221a[_0x90d8('0x40')]['fields']));_0x5b8fd9['attributes']=_0x5b8fd9[_0x90d8('0x43')][_0x90d8('0x45')]?_0x5b8fd9[_0x90d8('0x43')]:_0x6d2610['model'];if(_0x2c221a['query'][_0x90d8('0x51')]){_0x5b8fd9[_0x90d8('0x4c')]=[{'all':!![]}];}_0x5b8fd9=_[_0x90d8('0x4b')]({},_0x5b8fd9,_0x2c221a[_0x90d8('0x52')]);return db['WhatsappAccount'][_0x90d8('0x53')](_0x5b8fd9)[_0x90d8('0x1c')](handleEntityNotFound(_0x240b5d,null))[_0x90d8('0x1c')](respondWithResult(_0x240b5d,null))[_0x90d8('0x4f')](handleError(_0x240b5d,null));};exports[_0x90d8('0x54')]=function(_0x4c7bf5,_0x37fe16){return db[_0x90d8('0x3b')][_0x90d8('0x54')](_0x4c7bf5[_0x90d8('0x55')],{})['then'](function(_0x2aac61){var _0x460e24=_0x4c7bf5['user'][_0x90d8('0x32')]({'plain':!![]});if(!_0x460e24)throw new Error(_0x90d8('0x56'));if(_0x460e24['role']==='user'){var _0x37a7f2=_0x2aac61[_0x90d8('0x32')]({'plain':!![]});var _0x3cd58f=_0x90d8('0x33');return db[_0x90d8('0x57')]['find']({'where':{'name':_0x3cd58f,'userProfileId':_0x460e24['userProfileId']},'raw':!![]})['then'](function(_0x1dd95f){if(_0x1dd95f&&_0x1dd95f[_0x90d8('0x58')]===0x0){return db[_0x90d8('0x59')][_0x90d8('0x54')]({'name':_0x37a7f2[_0x90d8('0x36')],'resourceId':_0x37a7f2['id'],'type':_0x1dd95f['name'],'sectionId':_0x1dd95f['id']},{})['then'](function(){return _0x2aac61;});}else{return _0x2aac61;}})[_0x90d8('0x4f')](function(_0x59ed3b){logger[_0x90d8('0x22')](_0x90d8('0x5a'),_0x59ed3b);throw _0x59ed3b;});}return _0x2aac61;})[_0x90d8('0x1c')](respondWithResult(_0x37fe16,0xc9))[_0x90d8('0x4f')](handleError(_0x37fe16,null));};exports[_0x90d8('0x30')]=function(_0x1b8802,_0x1415b6){if(_0x1b8802[_0x90d8('0x55')]['id']){delete _0x1b8802['body']['id'];}return db['WhatsappAccount'][_0x90d8('0x53')]({'where':{'id':_0x1b8802['params']['id']},'include':[{'model':db[_0x90d8('0x39')],'as':_0x90d8('0x5b')}]})['then'](handleEntityNotFound(_0x1415b6,null))[_0x90d8('0x1c')](saveUpdates(_0x1b8802['body'],null))['then'](respondWithResult(_0x1415b6,null))[_0x90d8('0x4f')](handleError(_0x1415b6,null));};exports['destroy']=function(_0x17acf4,_0x1de672){return db[_0x90d8('0x3b')][_0x90d8('0x53')]({'where':{'id':_0x17acf4[_0x90d8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1de672,null))[_0x90d8('0x1c')](removeEntity(_0x1de672,null))[_0x90d8('0x4f')](handleError(_0x1de672,null));};exports['describe']=function(_0xa13d5f,_0x4d8081){return db[_0x90d8('0x3b')][_0x90d8('0x5d')]()[_0x90d8('0x1c')](respondWithResult(_0x4d8081,null))[_0x90d8('0x4f')](handleError(_0x4d8081,null));};exports[_0x90d8('0x5e')]=function(_0x1ae308,_0x30e182,_0x542386){if(_0x1ae308[_0x90d8('0x55')]['id']){delete _0x1ae308[_0x90d8('0x55')]['id'];}return db[_0x90d8('0x3b')]['find']({'where':{'id':_0x1ae308[_0x90d8('0x5c')]['id']}})[_0x90d8('0x1c')](handleEntityNotFound(_0x30e182,null))[_0x90d8('0x1c')](function(_0x3aaebc){if(_0x3aaebc){_0x1ae308[_0x90d8('0x55')][_0x90d8('0x5f')]=_0x3aaebc['id'];return db['Disposition'][_0x90d8('0x54')](_0x1ae308[_0x90d8('0x55')]);}})[_0x90d8('0x1c')](respondWithResult(_0x30e182,null))[_0x90d8('0x4f')](handleError(_0x30e182,null));};exports['getDispositions']=function(_0x2b0d8b,_0x5734c5,_0x395146){var _0x1fabe1={'raw':![],'where':{}};var _0x376263={};var _0x46e84a={'count':0x0,'rows':[]};return db[_0x90d8('0x3b')][_0x90d8('0x60')]({'where':{'id':_0x2b0d8b[_0x90d8('0x5c')]['id']}})[_0x90d8('0x1c')](handleEntityNotFound(_0x5734c5,null))[_0x90d8('0x1c')](function(_0x3bbaff){if(_0x3bbaff){_0x376263['model']=_['keys'](db[_0x90d8('0x61')][_0x90d8('0x3c')]);_0x376263['query']=_[_0x90d8('0x3f')](_0x2b0d8b[_0x90d8('0x40')]);_0x376263['filters']=_[_0x90d8('0x41')](_0x376263[_0x90d8('0x42')],_0x376263[_0x90d8('0x40')]);_0x1fabe1[_0x90d8('0x43')]=_[_0x90d8('0x41')](_0x376263['model'],qs['fields'](_0x2b0d8b['query'][_0x90d8('0x44')]));_0x1fabe1[_0x90d8('0x43')]=_0x1fabe1[_0x90d8('0x43')]['length']?_0x1fabe1[_0x90d8('0x43')]:_0x376263[_0x90d8('0x42')];if(!_0x2b0d8b['query'][_0x90d8('0x46')]('nolimit')){_0x1fabe1['limit']=qs['limit'](_0x2b0d8b[_0x90d8('0x40')][_0x90d8('0x2a')]);_0x1fabe1[_0x90d8('0x27')]=qs[_0x90d8('0x27')](_0x2b0d8b['query'][_0x90d8('0x27')]);}_0x1fabe1[_0x90d8('0x62')]=qs[_0x90d8('0x48')](_0x2b0d8b[_0x90d8('0x40')][_0x90d8('0x48')]);_0x1fabe1['where']=qs['filters'](_[_0x90d8('0x63')](_0x2b0d8b['query'],_0x376263[_0x90d8('0x50')]));_0x1fabe1[_0x90d8('0x49')][_0x90d8('0x5f')]=_0x3bbaff['id'];if(_0x2b0d8b[_0x90d8('0x40')]['filter']){_0x1fabe1[_0x90d8('0x49')]=_[_0x90d8('0x4b')](_0x1fabe1[_0x90d8('0x49')],{'$or':_[_0x90d8('0x3a')](_0x1fabe1[_0x90d8('0x43')],function(_0x28fa91){var _0x1e263b={};_0x1e263b[_0x28fa91]={'$like':'%'+_0x2b0d8b[_0x90d8('0x40')][_0x90d8('0x4a')]+'%'};return _0x1e263b;})});}_0x1fabe1=_[_0x90d8('0x4b')]({},_0x1fabe1,_0x2b0d8b['options']);return db[_0x90d8('0x61')]['count']({'where':_0x1fabe1[_0x90d8('0x49')]})[_0x90d8('0x1c')](function(_0x19c343){_0x46e84a[_0x90d8('0x29')]=_0x19c343;if(_0x2b0d8b['query']['includeAll']){_0x1fabe1[_0x90d8('0x4c')]=[{'all':!![]}];}return db[_0x90d8('0x61')]['findAll'](_0x1fabe1);})[_0x90d8('0x1c')](function(_0x16d347){_0x46e84a[_0x90d8('0x4e')]=_0x16d347;return _0x46e84a;});}})[_0x90d8('0x1c')](respondWithFilteredResult(_0x5734c5,_0x1fabe1))[_0x90d8('0x4f')](handleError(_0x5734c5,null));};exports['removeDispositions']=function(_0x53106f,_0x57401c,_0x48660b){return db['WhatsappAccount']['find']({'where':{'id':_0x53106f[_0x90d8('0x5c')]['id']}})[_0x90d8('0x1c')](handleEntityNotFound(_0x57401c,null))[_0x90d8('0x1c')](function(_0x1d0a55){if(_0x1d0a55){return _0x1d0a55[_0x90d8('0x64')](_0x53106f['query'][_0x90d8('0x65')]);}})[_0x90d8('0x1c')](respondWithStatusCode(_0x57401c,null))['catch'](handleError(_0x57401c,null));};exports[_0x90d8('0x66')]=function(_0x46d9ed,_0x5a3cdc,_0x55f18f){if(_0x46d9ed[_0x90d8('0x55')]['id']){delete _0x46d9ed[_0x90d8('0x55')]['id'];}return db[_0x90d8('0x3b')][_0x90d8('0x53')]({'where':{'id':_0x46d9ed[_0x90d8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5a3cdc,null))[_0x90d8('0x1c')](function(_0x53cc6f){if(_0x53cc6f){_0x46d9ed[_0x90d8('0x55')]['WhatsappAccountId']=_0x53cc6f['id'];return db['CannedAnswer']['create'](_0x46d9ed[_0x90d8('0x55')]);}})[_0x90d8('0x1c')](respondWithResult(_0x5a3cdc,null))[_0x90d8('0x4f')](handleError(_0x5a3cdc,null));};exports[_0x90d8('0x67')]=function(_0x3eaf59,_0x1c37aa,_0x369e0f){var _0x51e1aa={'raw':![],'where':{}};var _0x42cc49={};var _0x14fcdb={'count':0x0,'rows':[]};return db[_0x90d8('0x3b')][_0x90d8('0x60')]({'where':{'id':_0x3eaf59[_0x90d8('0x5c')]['id']}})[_0x90d8('0x1c')](handleEntityNotFound(_0x1c37aa,null))['then'](function(_0x589a3f){if(_0x589a3f){_0x42cc49[_0x90d8('0x42')]=_[_0x90d8('0x3f')](db['CannedAnswer'][_0x90d8('0x3c')]);_0x42cc49[_0x90d8('0x40')]=_[_0x90d8('0x3f')](_0x3eaf59[_0x90d8('0x40')]);_0x42cc49[_0x90d8('0x50')]=_[_0x90d8('0x41')](_0x42cc49['model'],_0x42cc49[_0x90d8('0x40')]);_0x51e1aa[_0x90d8('0x43')]=_[_0x90d8('0x41')](_0x42cc49[_0x90d8('0x42')],qs[_0x90d8('0x44')](_0x3eaf59[_0x90d8('0x40')][_0x90d8('0x44')]));_0x51e1aa['attributes']=_0x51e1aa[_0x90d8('0x43')]['length']?_0x51e1aa[_0x90d8('0x43')]:_0x42cc49[_0x90d8('0x42')];if(!_0x3eaf59[_0x90d8('0x40')][_0x90d8('0x46')]('nolimit')){_0x51e1aa[_0x90d8('0x2a')]=qs[_0x90d8('0x2a')](_0x3eaf59[_0x90d8('0x40')][_0x90d8('0x2a')]);_0x51e1aa['offset']=qs[_0x90d8('0x27')](_0x3eaf59[_0x90d8('0x40')][_0x90d8('0x27')]);}_0x51e1aa['order']=qs[_0x90d8('0x48')](_0x3eaf59[_0x90d8('0x40')][_0x90d8('0x48')]);_0x51e1aa['where']=qs[_0x90d8('0x50')](_[_0x90d8('0x63')](_0x3eaf59[_0x90d8('0x40')],_0x42cc49['filters']));_0x51e1aa[_0x90d8('0x49')]['WhatsappAccountId']=_0x589a3f['id'];if(_0x3eaf59[_0x90d8('0x40')][_0x90d8('0x4a')]){_0x51e1aa[_0x90d8('0x49')]=_[_0x90d8('0x4b')](_0x51e1aa[_0x90d8('0x49')],{'$or':_[_0x90d8('0x3a')](_0x51e1aa[_0x90d8('0x43')],function(_0x3f5fdb){var _0x1d445d={};_0x1d445d[_0x3f5fdb]={'$like':'%'+_0x3eaf59[_0x90d8('0x40')]['filter']+'%'};return _0x1d445d;})});}_0x51e1aa=_[_0x90d8('0x4b')]({},_0x51e1aa,_0x3eaf59[_0x90d8('0x52')]);return db[_0x90d8('0x68')]['count']({'where':_0x51e1aa['where']})[_0x90d8('0x1c')](function(_0x54f5f9){_0x14fcdb['count']=_0x54f5f9;if(_0x3eaf59['query'][_0x90d8('0x51')]){_0x51e1aa[_0x90d8('0x4c')]=[{'all':!![]}];}return db[_0x90d8('0x68')]['findAll'](_0x51e1aa);})[_0x90d8('0x1c')](function(_0x20239c){_0x14fcdb[_0x90d8('0x4e')]=_0x20239c;return _0x14fcdb;});}})[_0x90d8('0x1c')](respondWithFilteredResult(_0x1c37aa,_0x51e1aa))[_0x90d8('0x4f')](handleError(_0x1c37aa,null));};exports['removeAnswers']=function(_0x48aea8,_0x82f566,_0x178a20){return db[_0x90d8('0x3b')][_0x90d8('0x53')]({'where':{'id':_0x48aea8[_0x90d8('0x5c')]['id']}})[_0x90d8('0x1c')](handleEntityNotFound(_0x82f566,null))[_0x90d8('0x1c')](function(_0x56982d){if(_0x56982d){return _0x56982d[_0x90d8('0x69')](_0x48aea8['query'][_0x90d8('0x65')]);}})[_0x90d8('0x1c')](respondWithStatusCode(_0x82f566,null))[_0x90d8('0x4f')](handleError(_0x82f566,null));};exports['addAgents']=function(_0x374b3c,_0x244198,_0x1789c9){return db[_0x90d8('0x3b')][_0x90d8('0x53')]({'where':{'id':_0x374b3c[_0x90d8('0x5c')]['id']}})[_0x90d8('0x1c')](handleEntityNotFound(_0x244198,null))['then'](function(_0x1cdbaf){if(_0x1cdbaf){return _0x1cdbaf[_0x90d8('0x6a')](_0x374b3c['body']['ids'],_[_0x90d8('0x6b')](_0x374b3c[_0x90d8('0x55')],[_0x90d8('0x65'),'id'])||{})[_0x90d8('0x6c')](function(_0xa04e35){for(var _0x27f6f7=0x0;_0x27f6f7<_0x374b3c[_0x90d8('0x55')][_0x90d8('0x65')][_0x90d8('0x45')];_0x27f6f7+=0x1){socket['emit'](_0x90d8('0x6d'),{'UserId':Number(_0x374b3c[_0x90d8('0x55')][_0x90d8('0x65')][_0x27f6f7]),'WhatsappAccountId':Number(_0x374b3c[_0x90d8('0x5c')]['id'])});}return _0xa04e35;});}})['then'](respondWithResult(_0x244198,null))[_0x90d8('0x4f')](handleError(_0x244198,null));};exports[_0x90d8('0x6e')]=function(_0x102ec3,_0x73990,_0x330bf4){return db['WhatsappAccount'][_0x90d8('0x53')]({'where':{'id':_0x102ec3[_0x90d8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x73990,null))['then'](function(_0x35e3c1){if(_0x35e3c1){return _0x35e3c1[_0x90d8('0x6e')](_0x102ec3['query'][_0x90d8('0x65')])['then'](function(){if(_[_0x90d8('0x6f')](_0x102ec3[_0x90d8('0x40')][_0x90d8('0x65')])){for(var _0x2eb341=0x0;_0x2eb341<_0x102ec3[_0x90d8('0x40')]['ids']['length'];_0x2eb341+=0x1){socket['emit'](_0x90d8('0x70'),{'UserId':Number(_0x102ec3[_0x90d8('0x40')]['ids'][_0x2eb341]),'WhatsappAccountId':Number(_0x102ec3[_0x90d8('0x5c')]['id'])});}}else{socket[_0x90d8('0x71')](_0x90d8('0x70'),{'UserId':Number(_0x102ec3[_0x90d8('0x40')]['ids']),'WhatsappAccountId':Number(_0x102ec3['params']['id'])});}});}})[_0x90d8('0x1c')](respondWithStatusCode(_0x73990,null))['catch'](handleError(_0x73990,null));};exports[_0x90d8('0x72')]=function(_0x32f978,_0x3c4780,_0x19ef15){var _0x25cfcb={};var _0x123d5b={};var _0x46aa86;var _0x20f34b;return db[_0x90d8('0x3b')][_0x90d8('0x60')]({'where':{'id':_0x32f978[_0x90d8('0x5c')]['id']}})[_0x90d8('0x1c')](handleEntityNotFound(_0x3c4780,null))[_0x90d8('0x1c')](function(_0x5ca37a){if(_0x5ca37a){_0x46aa86=_0x5ca37a;_0x123d5b[_0x90d8('0x42')]=_[_0x90d8('0x3f')](db[_0x90d8('0x73')]['rawAttributes']);_0x123d5b[_0x90d8('0x40')]=_[_0x90d8('0x3f')](_0x32f978[_0x90d8('0x40')]);_0x123d5b['filters']=_[_0x90d8('0x41')](_0x123d5b[_0x90d8('0x42')],_0x123d5b['query']);_0x25cfcb[_0x90d8('0x43')]=_[_0x90d8('0x41')](_0x123d5b[_0x90d8('0x42')],qs[_0x90d8('0x44')](_0x32f978[_0x90d8('0x40')][_0x90d8('0x44')]));_0x25cfcb[_0x90d8('0x43')]=_0x25cfcb[_0x90d8('0x43')]['length']?_0x25cfcb[_0x90d8('0x43')]:_0x123d5b['model'];_0x25cfcb[_0x90d8('0x62')]=qs[_0x90d8('0x48')](_0x32f978[_0x90d8('0x40')][_0x90d8('0x48')]);_0x25cfcb[_0x90d8('0x49')]=qs[_0x90d8('0x50')](_[_0x90d8('0x63')](_0x32f978[_0x90d8('0x40')],_0x123d5b[_0x90d8('0x50')]));if(_0x32f978[_0x90d8('0x40')][_0x90d8('0x4a')]){_0x25cfcb['where']=_['merge'](_0x25cfcb['where'],{'$or':_['map'](_0x25cfcb[_0x90d8('0x43')],function(_0x1bf4a1){var _0xa49ecc={};_0xa49ecc[_0x1bf4a1]={'$like':'%'+_0x32f978[_0x90d8('0x40')][_0x90d8('0x4a')]+'%'};return _0xa49ecc;})});}_0x25cfcb=_['merge']({},_0x25cfcb,_0x32f978[_0x90d8('0x52')]);return _0x46aa86['getAgents'](_0x25cfcb);}})[_0x90d8('0x1c')](function(_0x4c1350){if(_0x4c1350){_0x20f34b=_0x4c1350[_0x90d8('0x45')];if(!_0x32f978['query'][_0x90d8('0x46')](_0x90d8('0x47'))){_0x25cfcb['limit']=qs[_0x90d8('0x2a')](_0x32f978[_0x90d8('0x40')][_0x90d8('0x2a')]);_0x25cfcb['offset']=qs[_0x90d8('0x27')](_0x32f978[_0x90d8('0x40')][_0x90d8('0x27')]);}return _0x46aa86[_0x90d8('0x72')](_0x25cfcb);}})[_0x90d8('0x1c')](function(_0x43bc74){if(_0x43bc74){return _0x43bc74?{'count':_0x20f34b,'rows':_0x43bc74}:null;}})['then'](respondWithResult(_0x3c4780,null))['catch'](handleError(_0x3c4780,null));};exports['addApplications']=function(_0x377491,_0x3cc4e4){var _0x2a32f8=_0x377491['params']['id'];var _0x529bee=_0x377491[_0x90d8('0x55')];var _0x1c16fe=0xc8;var _0x36e833=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x90d8('0x74')][_0x90d8('0x75')]['READ_COMMITTED']},function(_0x803e1b){return db[_0x90d8('0x3b')][_0x90d8('0x60')]({'where':{'id':_0x2a32f8},'transaction':_0x803e1b})[_0x90d8('0x1c')](function(_0x506747){if(_0x506747){return db[_0x90d8('0x76')]['destroy']({'where':{'WhatsappAccountId':_0x2a32f8},'transaction':_0x803e1b})[_0x90d8('0x1c')](function(){var _0x407644=_[_0x90d8('0x3a')](_0x529bee,function(_0x577b91){_0x577b91[_0x90d8('0x5f')]=_0x2a32f8;return _0x577b91;});return db['WhatsappApplication'][_0x90d8('0x77')](_0x407644,{'transaction':_0x803e1b});});}else{_0x1c16fe=0x194;_0x36e833=[];}});})[_0x90d8('0x1c')](function(){if(_0x1c16fe!==0x194){return db[_0x90d8('0x76')][_0x90d8('0x78')]({'where':{'WhatsappAccountId':_0x2a32f8},'order':_0x90d8('0x79')})[_0x90d8('0x1c')](function(_0x238e08){_0x36e833=_0x238e08;});}})['catch'](function(_0x3ed586){_0x1c16fe=0x1f4;logger[_0x90d8('0x22')](_0x3ed586[_0x90d8('0x35')]);if(_0x3ed586[_0x90d8('0x36')]){delete _0x3ed586['name'];}_0x36e833=_0x3ed586;})['finally'](function(){if(_0x36e833===null){_0x3cc4e4[_0x90d8('0x7a')](_0x1c16fe);}else{if(_0x1c16fe===0x1f4){_0x3cc4e4[_0x90d8('0x26')](_0x1c16fe)[_0x90d8('0x37')](_0x36e833);}else{_0x3cc4e4[_0x90d8('0x26')](_0x1c16fe)[_0x90d8('0x2d')](_0x36e833);}}});};exports['getApplications']=function(_0x5444a4,_0x40bf74,_0x3b798c){var _0x5db87f={};var _0x229e46={};var _0x19cb0c;var _0x4eaacd;return db['WhatsappAccount'][_0x90d8('0x60')]({'where':{'id':_0x5444a4[_0x90d8('0x5c')]['id']}})[_0x90d8('0x1c')](handleEntityNotFound(_0x40bf74,null))[_0x90d8('0x1c')](function(_0x6fd13b){if(_0x6fd13b){_0x19cb0c=_0x6fd13b;_0x229e46[_0x90d8('0x42')]=_[_0x90d8('0x3f')](db['WhatsappApplication'][_0x90d8('0x3c')]);_0x229e46['query']=_[_0x90d8('0x3f')](_0x5444a4['query']);_0x229e46[_0x90d8('0x50')]=_[_0x90d8('0x41')](_0x229e46[_0x90d8('0x42')],_0x229e46['query']);_0x5db87f[_0x90d8('0x43')]=_[_0x90d8('0x41')](_0x229e46[_0x90d8('0x42')],qs['fields'](_0x5444a4['query'][_0x90d8('0x44')]));_0x5db87f[_0x90d8('0x43')]=_0x5db87f[_0x90d8('0x43')][_0x90d8('0x45')]?_0x5db87f[_0x90d8('0x43')]:_0x229e46[_0x90d8('0x42')];_0x5db87f[_0x90d8('0x62')]=qs[_0x90d8('0x48')](_0x5444a4['query']['sort']);_0x5db87f[_0x90d8('0x49')]=qs['filters'](_[_0x90d8('0x63')](_0x5444a4['query'],_0x229e46[_0x90d8('0x50')]));if(_0x5444a4[_0x90d8('0x40')]['filter']){_0x5db87f[_0x90d8('0x49')]=_[_0x90d8('0x4b')](_0x5db87f[_0x90d8('0x49')],{'$or':_[_0x90d8('0x3a')](_0x5db87f['attributes'],function(_0x5dbc03){var _0x5a108c={};_0x5a108c[_0x5dbc03]={'$like':'%'+_0x5444a4[_0x90d8('0x40')][_0x90d8('0x4a')]+'%'};return _0x5a108c;})});}_0x5db87f=_[_0x90d8('0x4b')]({},_0x5db87f,_0x5444a4[_0x90d8('0x52')]);return _0x19cb0c[_0x90d8('0x7b')](_0x5db87f);}})[_0x90d8('0x1c')](function(_0x207a85){if(_0x207a85){_0x4eaacd=_0x207a85['length'];if(!_0x5444a4[_0x90d8('0x40')]['hasOwnProperty'](_0x90d8('0x47'))){_0x5db87f[_0x90d8('0x2a')]=qs[_0x90d8('0x2a')](_0x5444a4[_0x90d8('0x40')][_0x90d8('0x2a')]);_0x5db87f[_0x90d8('0x27')]=qs[_0x90d8('0x27')](_0x5444a4[_0x90d8('0x40')][_0x90d8('0x27')]);}return _0x19cb0c[_0x90d8('0x7b')](_0x5db87f);}})[_0x90d8('0x1c')](function(_0x4b5489){if(_0x4b5489){return _0x4b5489?{'count':_0x4eaacd,'rows':_0x4b5489}:null;}})[_0x90d8('0x1c')](respondWithResult(_0x40bf74,null))[_0x90d8('0x4f')](handleError(_0x40bf74,null));};exports[_0x90d8('0x7c')]=function(_0x22c455,_0x1f761d,_0x37847f){var _0x570e76={'channel':_0x90d8('0x7d')};var _0x575d63=[];var _0x11edbe=[];var _0x5dbcf7={};return db['WhatsappAccount'][_0x90d8('0x53')]({'where':{'id':_0x22c455[_0x90d8('0x5c')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x90d8('0x7e')}]})[_0x90d8('0x1c')](handleEntityNotFound(_0x1f761d,null))[_0x90d8('0x1c')](function(_0x3e81c2){_0x570e76[_0x90d8('0x7f')]=_0x3e81c2;if(_0x570e76['account']&&_0x570e76[_0x90d8('0x7f')][_0x90d8('0x3e')]===_0x90d8('0x80')&&_0x22c455[_0x90d8('0x55')][_0x90d8('0x81')]){if(_0x22c455['body'][_0x90d8('0x81')][_0x90d8('0x45')]===0x0)return;if(_0x22c455[_0x90d8('0x55')][_0x90d8('0x81')][0x0][_0x90d8('0x82')]!==_0x90d8('0x83'))return;return db[_0x90d8('0x84')][_0x90d8('0x30')]({'read':!![],'readAt':_0x22c455[_0x90d8('0x55')][_0x90d8('0x81')][0x0]['timestamp']},{'where':{'messageId':_0x22c455[_0x90d8('0x55')][_0x90d8('0x81')][0x0][_0x90d8('0x85')]},'individualHooks':!![]})[_0x90d8('0x1c')](function(_0x2cca08){return _0x1f761d['status'](0xc8)['json'](_0x2cca08);});}_0x570e76[_0x90d8('0x86')]=_['orderBy'](_0x3e81c2[_0x90d8('0x7e')],[_0x90d8('0x79')],[_0x90d8('0x87')]);if(_0x570e76['account'][_0x90d8('0x7e')]){delete _0x570e76['account']['Applications'];}return db['CmContact'][_0x90d8('0x5d')]()['then'](function(_0x28a8a6){if(!_0x28a8a6){throw new db['Sequelize']['ValidationError'](_0x90d8('0x88'));}_0x575d63=_[_0x90d8('0x89')](_[_0x90d8('0x3f')](_0x28a8a6),[_0x90d8('0x8a'),'updatedAt']);_0x11edbe=_[_0x90d8('0x89')](_[_0x90d8('0x3f')](_0x28a8a6),['createdAt',_0x90d8('0x8b'),_0x90d8('0x8c'),_0x90d8('0x8d')]);_0x570e76[_0x90d8('0x55')]={'mapKey':_0x90d8('0x8e')};if(_0x570e76['account']&&_0x570e76['account']['type']===_0x90d8('0x8f')){_0x570e76[_0x90d8('0x55')][_0x90d8('0x90')]=_0x22c455[_0x90d8('0x55')]['From'][_0x90d8('0x91')](_0x90d8('0x92'),'');_0x570e76[_0x90d8('0x55')][_0x90d8('0x55')]=_0x22c455[_0x90d8('0x55')]['Body'];_0x570e76['body'][_0x90d8('0x93')]=_0x22c455[_0x90d8('0x55')][_0x90d8('0x94')];}if(_0x570e76[_0x90d8('0x7f')]&&_0x570e76[_0x90d8('0x7f')][_0x90d8('0x3e')]===_0x90d8('0x80')){_0x570e76[_0x90d8('0x55')]['from']=_0x22c455['body']['notifications'][0x0]['from'];_0x570e76['body'][_0x90d8('0x55')]=_0x22c455['body']['notifications'][0x0][_0x90d8('0x24')][_0x90d8('0x55')];_0x570e76[_0x90d8('0x55')][_0x90d8('0x93')]=_0x22c455[_0x90d8('0x55')][_0x90d8('0x95')][0x0]['message_id'];}if(_0x570e76[_0x90d8('0x55')]['id']){delete _0x570e76[_0x90d8('0x55')]['id'];}if(_[_0x90d8('0x96')](_0x570e76[_0x90d8('0x55')][_0x90d8('0x90')])){throw new db[(_0x90d8('0x97'))]['ValidationError'](_0x90d8('0x98'));}if(_['isNil'](_0x570e76['body']['body'])||_0x570e76[_0x90d8('0x55')][_0x90d8('0x55')]===''){throw new db['Sequelize'][(_0x90d8('0x99'))](_0x90d8('0x9a'));}if(_['isNil'](_0x570e76['body'][_0x90d8('0x9b')])){throw new db[(_0x90d8('0x97'))][(_0x90d8('0x99'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11edbe);}if(!_[_0x90d8('0x9c')](_0x11edbe,_0x570e76[_0x90d8('0x55')][_0x90d8('0x9b')])){throw new db[(_0x90d8('0x97'))][(_0x90d8('0x99'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11edbe);}_0x5dbcf7[_0x570e76[_0x90d8('0x55')][_0x90d8('0x9b')]]=_0x570e76[_0x90d8('0x55')][_0x90d8('0x90')];return db[_0x90d8('0x9d')]['find']({'where':{'id':_0x570e76[_0x90d8('0x7f')][_0x90d8('0x8d')]},'include':[{'model':db[_0x90d8('0x9e')],'as':_0x90d8('0x9f'),'where':_0x5dbcf7,'limit':0x1,'order':[[_0x90d8('0x8b'),_0x90d8('0xa0')]]}]});})[_0x90d8('0x1c')](handleEntityNotFound(_0x1f761d,null))['then'](function(_0x3e68c5){if(_0x3e68c5){_0x570e76[_0x90d8('0xa1')]=_[_0x90d8('0x6b')](_0x3e68c5,[_0x90d8('0x9f')]);if(_0x3e68c5['Contacts'][_0x90d8('0x45')]){return _0x3e68c5[_0x90d8('0x9f')][0x0];}var _0x2e68ee=_[_0x90d8('0x15')](_0x570e76[_0x90d8('0x55')],{'firstName':_0x570e76['body']['from'],'ListId':_0x3e68c5['id']});_0x2e68ee[_0x570e76[_0x90d8('0x55')][_0x90d8('0x9b')]]=_0x570e76['body'][_0x90d8('0x90')];return db['CmContact']['create'](_0x2e68ee,{'fields':_0x575d63,'raw':!![]});}})['then'](handleEntityNotFound(_0x1f761d,null))['then'](function(_0x55cee1){if(_0x55cee1){_0x570e76[_0x90d8('0xa2')]=_0x55cee1;var _0x30b47f={'ContactId':_0x55cee1['id'],'phone':_0x570e76['body'][_0x90d8('0x90')],'WhatsappAccountId':_0x22c455[_0x90d8('0x5c')]['id']};var _0x31644f={'ContactId':_0x55cee1['id'],'WhatsappAccountId':_0x22c455[_0x90d8('0x5c')]['id'],'closed':![]};return db[_0x90d8('0xa3')][_0x90d8('0x53')]({'where':_0x31644f})[_0x90d8('0x1c')](function(_0x23544d){if(_0x23544d){return[_0x23544d,![]];}return db['WhatsappInteraction'][_0x90d8('0x54')](_0x30b47f)[_0x90d8('0x1c')](function(_0xfb6ead){return[_0xfb6ead,!![]];});});}})[_0x90d8('0x6c')](function(_0x1f592c,_0x3b7455){_0x570e76[_0x90d8('0xa4')]=_0x1f592c['get']({'plain':!![]});_0x570e76[_0x90d8('0xa4')][_0x90d8('0xa5')]=![];if(_0x3b7455){if(_0x570e76['account']['autoclose']){_0x570e76[_0x90d8('0x86')][_0x90d8('0xa6')]({'id':0x0,'priority':_0x570e76[_0x90d8('0x86')][_0x90d8('0x45')]+0x1,'app':_0x90d8('0xa7'),'appdata':_0x90d8('0xa8'),'interval':'*,*,*,*'});}_0x570e76[_0x90d8('0xa4')][_0x90d8('0xa5')]=!![];}return db[_0x90d8('0x84')][_0x90d8('0x54')]({'phone':_0x570e76[_0x90d8('0x55')]['from'],'messageId':_0x570e76[_0x90d8('0x55')][_0x90d8('0x93')],'body':_0x570e76[_0x90d8('0x55')][_0x90d8('0x55')],'WhatsappAccountId':_0x22c455['params']['id'],'WhatsappInteractionId':_0x1f592c['id'],'direction':'in','ContactId':_0x1f592c['ContactId'],'AttachmentId':_0x570e76['body'][_0x90d8('0xa9')]});})['then'](function(_0x3aeba2){_0x570e76[_0x90d8('0x24')]=_0x3aeba2;if(_0x570e76[_0x90d8('0xa4')][_0x90d8('0xaa')]){return db[_0x90d8('0x73')][_0x90d8('0x53')]({'attributes':['id','name'],'where':{'id':_0x570e76[_0x90d8('0xa4')][_0x90d8('0xaa')]}})[_0x90d8('0x1c')](function(_0x255984){if(_0x255984){_0x570e76['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x90d8('0xab'),'appdata':_0x255984[_0x90d8('0x36')]+','+(_0x570e76[_0x90d8('0x7f')][_0x90d8('0xac')]||0xa),'interval':_0x90d8('0xad')});}return respondWithRpcPromise('Start',_0x90d8('0xae'),_0x570e76);});}return respondWithRpcPromise('Start',_0x90d8('0xae'),_0x570e76);})[_0x90d8('0x1c')](function(_0x4cf8ca){if(_0x4cf8ca){var _0x35001e=0xc8;var _0x4b4b81=_0x90d8('0xaf');logger[_0x90d8('0x1d')](_0x90d8('0x21'),_0x4b4b81,_0x35001e,_0x90d8('0xb0'));logger['debug'](_0x90d8('0xb1'),_0x4b4b81,_0x35001e,'entity\x20found',JSON[_0x90d8('0xb2')](_0x4cf8ca));if(_0x570e76['account'][_0x90d8('0x3e')]==='twilio'){return _0x1f761d[_0x90d8('0x26')](_0x35001e)[_0x90d8('0x2b')]('Content-Type',_0x90d8('0xb3'))[_0x90d8('0x37')](_0x90d8('0xb4'));}else{return _0x1f761d[_0x90d8('0x26')](_0x35001e)[_0x90d8('0x2d')](_0x4cf8ca);}}});})[_0x90d8('0x4f')](handleError(_0x1f761d,null));};exports['send']=function(_0x2e27ea,_0x470b0a,_0x3f54f0){var _0xe77c5a,_0x572305,_0x2f75a0;if(_[_0x90d8('0x96')](_0x2e27ea[_0x90d8('0x55')][_0x90d8('0x55')])||_0x2e27ea['body'][_0x90d8('0x55')]===''){throw new db[(_0x90d8('0x97'))]['ValidationError'](_0x90d8('0x9a'));}if(_[_0x90d8('0x96')](_0x2e27ea['body']['to'])){throw new db[(_0x90d8('0x97'))][(_0x90d8('0x99'))](_0x90d8('0xb5'));}_0xe77c5a=_0x2e27ea[_0x90d8('0x55')]['to'];return db[_0x90d8('0x3b')][_0x90d8('0x53')]({'where':{'id':_0x2e27ea[_0x90d8('0x5c')]['id']},'include':[{'model':db[_0x90d8('0x9d')],'as':'List','include':[{'model':db['CmContact'],'as':_0x90d8('0x9f'),'where':{'mobile':_0xe77c5a},'limit':0x1,'order':[['updatedAt',_0x90d8('0xa0')]]}]}]})[_0x90d8('0x1c')](handleEntityNotFound(_0x470b0a,null))[_0x90d8('0x1c')](function(_0x5c5899){if(_0x5c5899&&_0x5c5899[_0x90d8('0xb6')]){_0x572305=_0x5c5899[_0x90d8('0x32')]({'plain':!![]});if(_0x572305[_0x90d8('0xb6')]&&_0x572305[_0x90d8('0xb6')][_0x90d8('0x9f')]['length']){return _0x572305[_0x90d8('0xb6')][_0x90d8('0x9f')][0x0];}return db[_0x90d8('0x9e')][_0x90d8('0x54')](_[_0x90d8('0x15')](_0x2e27ea[_0x90d8('0x55')],{'firstName':_0xe77c5a,'mobile':_0xe77c5a,'phone':_0xe77c5a,'ListId':_0x572305['ListId']}));}})[_0x90d8('0x1c')](handleEntityNotFound(_0x470b0a,null))[_0x90d8('0x1c')](function(_0x5db19a){if(_0x5db19a){_0x2f75a0=_0x5db19a;return db[_0x90d8('0xa3')][_0x90d8('0x53')]({'where':{'ContactId':_0x2f75a0['id'],'closed':![],'WhatsappAccountId':_0x572305['id']}})['then'](function(_0x5b19f1){if(_0x5b19f1){return[_0x5b19f1,![]];}return db[_0x90d8('0xa3')][_0x90d8('0x54')]({'UserId':_0x2e27ea['user']['id'],'ContactId':_0x2f75a0['id'],'WhatsappAccountId':_0x572305['id'],'phone':_0xe77c5a,'firstMsgDirection':_0x90d8('0xb7'),'Messages':[_[_0x90d8('0x4b')](_0x2e27ea['body'],{'read':![],'body':_0x2e27ea['body']['body'],'phone':_0xe77c5a,'WhatsappAccountId':_0x572305['id'],'UserId':_0x2e27ea[_0x90d8('0xb8')]['id'],'ContactId':_0x2f75a0['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x90d8('0xb9')}]})[_0x90d8('0x1c')](function(_0x3ed0ed){return[_0x3ed0ed,!![]];});});}})[_0x90d8('0x6c')](function(_0x9b649e,_0x23bae5){if(_0x23bae5){return _0x9b649e;}return db[_0x90d8('0x84')][_0x90d8('0x54')](_[_0x90d8('0x4b')](_0x2e27ea[_0x90d8('0x55')],{'read':![],'body':_0x2e27ea[_0x90d8('0x55')][_0x90d8('0x55')],'phone':_0xe77c5a,'WhatsappAccountId':_0x572305['id'],'WhatsappInteractionId':_0x9b649e['id'],'UserId':_0x2e27ea['user']['id'],'ContactId':_0x2f75a0['id']}))['then'](function(_0x49f609){_0x9b649e[_0x90d8('0xba')][_0x90d8('0xb9')]=[];_0x9b649e[_0x90d8('0xba')][_0x90d8('0xb9')][_0x90d8('0xa6')](_0x49f609['dataValues']);return _0x9b649e;});})[_0x90d8('0x1c')](respondWithResult(_0x470b0a,null))[_0x90d8('0x4f')](handleError(_0x470b0a,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 2499bd4..e290414 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 _0x4f18=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0x5b9a8b,_0x2a047a){var _0x146d8b=function(_0xfee609){while(--_0xfee609){_0x5b9a8b['push'](_0x5b9a8b['shift']());}};_0x146d8b(++_0x2a047a);}(_0x4f18,0xd7));var _0x84f1=function(_0x282135,_0x4a4f9a){_0x282135=_0x282135-0x0;var _0x3e659d=_0x4f18[_0x282135];return _0x3e659d;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x84f1('0x0'))['db'][_0x84f1('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x84f1('0x2')](0x0);var events={'afterCreate':_0x84f1('0x3'),'afterUpdate':_0x84f1('0x4'),'afterDestroy':_0x84f1('0x5')};function emitEvent(_0x69d25f){return function(_0x420205,_0x2ddb53,_0x5cd969){WhatsappAccountEvents[_0x84f1('0x6')](_0x69d25f+':'+_0x420205['id'],_0x420205);WhatsappAccountEvents[_0x84f1('0x6')](_0x69d25f,_0x420205);_0x5cd969(null);};}for(var e in events){if(events[_0x84f1('0x7')](e)){var event=events[e];WhatsappAccount[_0x84f1('0x8')](e,emitEvent(event));}}module[_0x84f1('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xe5aa=['events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x584d1f,_0x138f6b){var _0x18c666=function(_0x299ee9){while(--_0x299ee9){_0x584d1f['push'](_0x584d1f['shift']());}};_0x18c666(++_0x138f6b);}(_0xe5aa,0x129));var _0xae5a=function(_0x214ce1,_0x5d0455){_0x214ce1=_0x214ce1-0x0;var _0x355b63=_0xe5aa[_0x214ce1];return _0x355b63;};'use strict';var EventEmitter=require(_0xae5a('0x0'));var WhatsappAccount=require(_0xae5a('0x1'))['db'][_0xae5a('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xae5a('0x3')](0x0);var events={'afterCreate':_0xae5a('0x4'),'afterUpdate':_0xae5a('0x5'),'afterDestroy':_0xae5a('0x6')};function emitEvent(_0x31199d){return function(_0x1ec315,_0x5e9736,_0xe33e32){WhatsappAccountEvents[_0xae5a('0x7')](_0x31199d+':'+_0x1ec315['id'],_0x1ec315);WhatsappAccountEvents[_0xae5a('0x7')](_0x31199d,_0x1ec315);_0xe33e32(null);};}for(var e in events){if(events[_0xae5a('0x8')](e)){var event=events[e];WhatsappAccount[_0xae5a('0x9')](e,emitEvent(event));}}module[_0xae5a('0xa')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 6d2b3b2..efa3ee7 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 _0xf5bf=['lodash','api','moment','request-promise','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x989a90,_0xcadf18){var _0x313149=function(_0x274598){while(--_0x274598){_0x989a90['push'](_0x989a90['shift']());}};_0x313149(++_0xcadf18);}(_0xf5bf,0x122));var _0xff5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5bf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xff5b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xff5b('0x1'));var moment=require(_0xff5b('0x2'));var BPromise=require('bluebird');var rp=require(_0xff5b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xff5b('0x4'));var attributes=require(_0xff5b('0x5'));module[_0xff5b('0x6')]=function(_0x1a4d2c,_0x36651a){return _0x1a4d2c[_0xff5b('0x7')](_0xff5b('0x8'),attributes,{'tableName':_0xff5b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2e1=['api','moment','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger'];(function(_0x3a9f90,_0x5ded15){var _0x3c440a=function(_0x136496){while(--_0x136496){_0x3a9f90['push'](_0x3a9f90['shift']());}};_0x3c440a(++_0x5ded15);}(_0xa2e1,0x11c));var _0x1a2e=function(_0x3e05f3,_0x4cd845){_0x3e05f3=_0x3e05f3-0x0;var _0x3c60fe=_0xa2e1[_0x3e05f3];return _0x3c60fe;};'use strict';var _=require('lodash');var util=require(_0x1a2e('0x0'));var logger=require(_0x1a2e('0x1'))(_0x1a2e('0x2'));var moment=require(_0x1a2e('0x3'));var BPromise=require(_0x1a2e('0x4'));var rp=require(_0x1a2e('0x5'));var fs=require('fs');var path=require(_0x1a2e('0x6'));var rimraf=require('rimraf');var config=require(_0x1a2e('0x7'));var attributes=require(_0x1a2e('0x8'));module[_0x1a2e('0x9')]=function(_0x4e349b,_0x305d15){return _0x4e349b[_0x1a2e('0xa')](_0x1a2e('0xb'),attributes,{'tableName':_0x1a2e('0xc'),'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 2fe4c1a..0a3a21c 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 _0x2fed=['localhost','socket.io-emitter','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','find','options','raw','attributes','map','include','model','then','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults'];(function(_0x35bb8f,_0x528806){var _0x42e35f=function(_0x2a5231){while(--_0x2a5231){_0x35bb8f['push'](_0x35bb8f['shift']());}};_0x42e35f(++_0x528806);}(_0x2fed,0x11b));var _0xd2fe=function(_0x5f2d81,_0x4d88c4){_0x5f2d81=_0x5f2d81-0x0;var _0x2bbf07=_0x2fed[_0x5f2d81];return _0x2bbf07;};'use strict';var _=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var moment=require(_0xd2fe('0x2'));var BPromise=require('bluebird');var rs=require(_0xd2fe('0x3'));var fs=require('fs');var Redis=require(_0xd2fe('0x4'));var db=require(_0xd2fe('0x5'))['db'];var utils=require(_0xd2fe('0x6'));var logger=require(_0xd2fe('0x7'))(_0xd2fe('0x8'));var config=require(_0xd2fe('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd2fe('0xa')]({'port':0x232a});config[_0xd2fe('0xb')]=_[_0xd2fe('0xc')](config[_0xd2fe('0xb')],{'host':_0xd2fe('0xd'),'port':0x18eb});var socket=require(_0xd2fe('0xe'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0xd2fe('0xf')](socket);function respondWithRpcPromise(_0x342018,_0x1a55f7,_0x465c9b){return new BPromise(function(_0xcb4ff8,_0x31d3e9){return client[_0xd2fe('0x10')](_0x342018,_0x465c9b)['then'](function(_0x38c41e){logger[_0xd2fe('0x11')](_0xd2fe('0x12'),_0x1a55f7,_0xd2fe('0x13'));logger['debug'](_0xd2fe('0x14'),_0x1a55f7,_0xd2fe('0x13'),JSON[_0xd2fe('0x15')](_0x38c41e));if(_0x38c41e[_0xd2fe('0x16')]){if(_0x38c41e['error'][_0xd2fe('0x17')]===0x1f4){logger[_0xd2fe('0x16')](_0xd2fe('0x12'),_0x1a55f7,_0x38c41e[_0xd2fe('0x16')][_0xd2fe('0x18')]);return _0x31d3e9(_0x38c41e[_0xd2fe('0x16')][_0xd2fe('0x18')]);}logger[_0xd2fe('0x16')](_0xd2fe('0x12'),_0x1a55f7,_0x38c41e[_0xd2fe('0x16')][_0xd2fe('0x18')]);return _0xcb4ff8(_0x38c41e['error'][_0xd2fe('0x18')]);}else{logger[_0xd2fe('0x11')](_0xd2fe('0x12'),_0x1a55f7,'request\x20sent');_0xcb4ff8(_0x38c41e[_0xd2fe('0x19')][_0xd2fe('0x18')]);}})[_0xd2fe('0x1a')](function(_0x742479){logger[_0xd2fe('0x16')](_0xd2fe('0x12'),_0x1a55f7,_0x742479);_0x31d3e9(_0x742479);});});}exports[_0xd2fe('0x1b')]=function(_0x59e67b){var _0x2a1478=this;return new Promise(function(_0x2659b8,_0x34c26b){return db['WhatsappAccount'][_0xd2fe('0x1c')]({'raw':_0x59e67b['options']?_0x59e67b[_0xd2fe('0x1d')][_0xd2fe('0x1e')]===undefined?!![]:![]:!![],'where':_0x59e67b[_0xd2fe('0x1d')]?_0x59e67b[_0xd2fe('0x1d')]['where']||null:null,'attributes':_0x59e67b['options']?_0x59e67b[_0xd2fe('0x1d')][_0xd2fe('0x1f')]||null:null,'include':_0x59e67b[_0xd2fe('0x1d')]?_0x59e67b['options']['include']?_[_0xd2fe('0x20')](_0x59e67b[_0xd2fe('0x1d')][_0xd2fe('0x21')],function(_0xf3f54b){return{'model':db[_0xf3f54b[_0xd2fe('0x22')]],'as':_0xf3f54b['as'],'attributes':_0xf3f54b[_0xd2fe('0x1f')],'include':_0xf3f54b[_0xd2fe('0x21')]?_[_0xd2fe('0x20')](_0xf3f54b['include'],function(_0x472781){return{'model':db[_0x472781[_0xd2fe('0x22')]],'as':_0x472781['as'],'attributes':_0x472781[_0xd2fe('0x1f')],'include':_0x472781[_0xd2fe('0x21')]?_['map'](_0x472781['include'],function(_0x17bc94){return{'model':db[_0x17bc94['model']],'as':_0x17bc94['as'],'attributes':_0x17bc94[_0xd2fe('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd2fe('0x23')](function(_0x33450a){logger[_0xd2fe('0x11')](_0xd2fe('0x1b'),_0x59e67b);logger[_0xd2fe('0x24')](_0xd2fe('0x1b'),_0x59e67b,JSON[_0xd2fe('0x15')](_0x33450a));_0x2659b8(_0x33450a);})[_0xd2fe('0x1a')](function(_0x593100){logger[_0xd2fe('0x16')](_0xd2fe('0x1b'),_0x593100[_0xd2fe('0x18')],_0x59e67b);_0x34c26b(_0x2a1478[_0xd2fe('0x16')](0x1f4,_0x593100[_0xd2fe('0x18')]));});});}; \ No newline at end of file +var _0xf791=['info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','WhatsappAccount','find','options','include','model','attributes','map','ShowWhatsappAccount','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf791,0x1aa));var _0x1f79=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xf791[_0x186376];return _0x2dbdd9;};'use strict';var _=require(_0x1f79('0x0'));var util=require(_0x1f79('0x1'));var moment=require(_0x1f79('0x2'));var BPromise=require('bluebird');var rs=require(_0x1f79('0x3'));var fs=require('fs');var Redis=require(_0x1f79('0x4'));var db=require(_0x1f79('0x5'))['db'];var utils=require(_0x1f79('0x6'));var logger=require(_0x1f79('0x7'))(_0x1f79('0x8'));var config=require('../../config/environment');var jayson=require(_0x1f79('0x9'));var client=jayson[_0x1f79('0xa')]['http']({'port':0x232a});config[_0x1f79('0xb')]=_['defaults'](config[_0x1f79('0xb')],{'host':_0x1f79('0xc'),'port':0x18eb});var socket=require(_0x1f79('0xd'))(new Redis(config[_0x1f79('0xb')]));require(_0x1f79('0xe'))['register'](socket);function respondWithRpcPromise(_0x5a2d51,_0x39813b,_0xf03cc5){return new BPromise(function(_0x18971a,_0x49d821){return client[_0x1f79('0xf')](_0x5a2d51,_0xf03cc5)['then'](function(_0x421fc6){logger[_0x1f79('0x10')](_0x1f79('0x11'),_0x39813b,_0x1f79('0x12'));logger[_0x1f79('0x13')](_0x1f79('0x14'),_0x39813b,_0x1f79('0x12'),JSON['stringify'](_0x421fc6));if(_0x421fc6['error']){if(_0x421fc6['error']['code']===0x1f4){logger[_0x1f79('0x15')](_0x1f79('0x11'),_0x39813b,_0x421fc6[_0x1f79('0x15')][_0x1f79('0x16')]);return _0x49d821(_0x421fc6[_0x1f79('0x15')][_0x1f79('0x16')]);}logger['error'](_0x1f79('0x11'),_0x39813b,_0x421fc6['error'][_0x1f79('0x16')]);return _0x18971a(_0x421fc6[_0x1f79('0x15')]['message']);}else{logger[_0x1f79('0x10')](_0x1f79('0x11'),_0x39813b,'request\x20sent');_0x18971a(_0x421fc6[_0x1f79('0x17')][_0x1f79('0x16')]);}})[_0x1f79('0x18')](function(_0x3a2218){logger[_0x1f79('0x15')](_0x1f79('0x11'),_0x39813b,_0x3a2218);_0x49d821(_0x3a2218);});});}exports['ShowWhatsappAccount']=function(_0x50ff86){var _0x42f517=this;return new Promise(function(_0x26400f,_0x3ae9ca){return db[_0x1f79('0x19')][_0x1f79('0x1a')]({'raw':_0x50ff86[_0x1f79('0x1b')]?_0x50ff86[_0x1f79('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x50ff86[_0x1f79('0x1b')]?_0x50ff86[_0x1f79('0x1b')]['where']||null:null,'attributes':_0x50ff86[_0x1f79('0x1b')]?_0x50ff86[_0x1f79('0x1b')]['attributes']||null:null,'include':_0x50ff86[_0x1f79('0x1b')]?_0x50ff86['options'][_0x1f79('0x1c')]?_['map'](_0x50ff86[_0x1f79('0x1b')]['include'],function(_0xc61a38){return{'model':db[_0xc61a38[_0x1f79('0x1d')]],'as':_0xc61a38['as'],'attributes':_0xc61a38[_0x1f79('0x1e')],'include':_0xc61a38[_0x1f79('0x1c')]?_[_0x1f79('0x1f')](_0xc61a38['include'],function(_0x105b16){return{'model':db[_0x105b16[_0x1f79('0x1d')]],'as':_0x105b16['as'],'attributes':_0x105b16['attributes'],'include':_0x105b16[_0x1f79('0x1c')]?_['map'](_0x105b16[_0x1f79('0x1c')],function(_0x159ca1){return{'model':db[_0x159ca1[_0x1f79('0x1d')]],'as':_0x159ca1['as'],'attributes':_0x159ca1[_0x1f79('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4770df){logger['info'](_0x1f79('0x20'),_0x50ff86);logger['debug'](_0x1f79('0x20'),_0x50ff86,JSON[_0x1f79('0x21')](_0x4770df));_0x26400f(_0x4770df);})[_0x1f79('0x18')](function(_0x5251c6){logger[_0x1f79('0x15')](_0x1f79('0x20'),_0x5251c6[_0x1f79('0x16')],_0x50ff86);_0x3ae9ca(_0x42f517[_0x1f79('0x15')](0x1f4,_0x5251c6[_0x1f79('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 5d3c19b..35dc47d 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 _0xbb45=['register','length','./whatsappAccount.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb45,0x92));var _0x5bb4=function(_0x5142f5,_0x382614){_0x5142f5=_0x5142f5-0x0;var _0x460bf2=_0xbb45[_0x5142f5];return _0x460bf2;};'use strict';var WhatsappAccountEvents=require(_0x5bb4('0x0'));var events=[_0x5bb4('0x1'),'remove','update'];function createListener(_0x3457fa,_0x258e61){return function(_0x570d6f){_0x258e61['emit'](_0x3457fa,_0x570d6f);};}function removeListener(_0x12c5dd,_0x269ecb){return function(){WhatsappAccountEvents['removeListener'](_0x12c5dd,_0x269ecb);};}exports[_0x5bb4('0x2')]=function(_0x3cbe96){for(var _0x386de2=0x0,_0xddf664=events[_0x5bb4('0x3')];_0x386de2<_0xddf664;_0x386de2++){var _0xbbd935=events[_0x386de2];var _0x2c081c=createListener('whatsappAccount:'+_0xbbd935,_0x3cbe96);WhatsappAccountEvents['on'](_0xbbd935,_0x2c081c);}}; \ No newline at end of file +var _0x11eb=['update','removeListener','register','length','save','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x11eb,0xf4));var _0xb11e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x11eb[_0x432682];return _0x463d05;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xb11e('0x0'),_0xb11e('0x1'),_0xb11e('0x2')];function createListener(_0x54d30f,_0x1f0771){return function(_0x5669c2){_0x1f0771['emit'](_0x54d30f,_0x5669c2);};}function removeListener(_0x366e85,_0x546710){return function(){WhatsappAccountEvents[_0xb11e('0x3')](_0x366e85,_0x546710);};}exports[_0xb11e('0x4')]=function(_0x5191bd){for(var _0x31f02e=0x0,_0x3bec84=events[_0xb11e('0x5')];_0x31f02e<_0x3bec84;_0x31f02e++){var _0x5c4d9b=events[_0x31f02e];var _0x33686d=createListener('whatsappAccount:'+_0x5c4d9b,_0x5191bd);WhatsappAccountEvents['on'](_0x5c4d9b,_0x33686d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 5dc50b6..9189b0a 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 _0x083d=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x3fd750,_0x120661){var _0x4f15d9=function(_0x3181b8){while(--_0x3181b8){_0x3fd750['push'](_0x3fd750['shift']());}};_0x4f15d9(++_0x120661);}(_0x083d,0x1e1));var _0xd083=function(_0x3ad625,_0x3739ef){_0x3ad625=_0x3ad625-0x0;var _0x264f91=_0x083d[_0x3ad625];return _0x264f91;};'use strict';var multer=require(_0xd083('0x0'));var util=require('util');var path=require(_0xd083('0x1'));var timeout=require(_0xd083('0x2'));var express=require('express');var router=express[_0xd083('0x3')]();var fs_extra=require(_0xd083('0x4'));var auth=require(_0xd083('0x5'));var interaction=require(_0xd083('0x6'));var config=require(_0xd083('0x7'));var controller=require(_0xd083('0x8'));router[_0xd083('0x9')]('/',auth[_0xd083('0xa')](),controller[_0xd083('0xb')]);router['get'](_0xd083('0xc'),auth[_0xd083('0xa')](),controller[_0xd083('0xd')]);router[_0xd083('0xe')]('/',auth[_0xd083('0xa')](),controller[_0xd083('0xf')]);router[_0xd083('0x10')]('/:id',auth[_0xd083('0xa')](),controller[_0xd083('0x11')]);router[_0xd083('0x12')](_0xd083('0xc'),auth[_0xd083('0xa')](),controller['destroy']);module[_0xd083('0x13')]=router; \ No newline at end of file +var _0x0d58=['destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','./whatsappApplication.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete'];(function(_0x518d82,_0x218926){var _0x583393=function(_0x2588cd){while(--_0x2588cd){_0x518d82['push'](_0x518d82['shift']());}};_0x583393(++_0x218926);}(_0x0d58,0x78));var _0x80d5=function(_0x1e7345,_0x18bcce){_0x1e7345=_0x1e7345-0x0;var _0x33017c=_0x0d58[_0x1e7345];return _0x33017c;};'use strict';var multer=require(_0x80d5('0x0'));var util=require('util');var path=require(_0x80d5('0x1'));var timeout=require(_0x80d5('0x2'));var express=require(_0x80d5('0x3'));var router=express[_0x80d5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x80d5('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x80d5('0x6'));router[_0x80d5('0x7')]('/',auth[_0x80d5('0x8')](),controller[_0x80d5('0x9')]);router[_0x80d5('0x7')]('/:id',auth[_0x80d5('0x8')](),controller['show']);router[_0x80d5('0xa')]('/',auth[_0x80d5('0x8')](),controller[_0x80d5('0xb')]);router[_0x80d5('0xc')](_0x80d5('0xd'),auth[_0x80d5('0x8')](),controller[_0x80d5('0xe')]);router[_0x80d5('0xf')](_0x80d5('0xd'),auth[_0x80d5('0x8')](),controller[_0x80d5('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index ed8786f..01d854b 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 _0x25d4=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x2d91eb,_0x257cf0){var _0x1ab075=function(_0x3d8240){while(--_0x3d8240){_0x2d91eb['push'](_0x2d91eb['shift']());}};_0x1ab075(++_0x257cf0);}(_0x25d4,0xdd));var _0x425d=function(_0x2c152e,_0x479b4d){_0x2c152e=_0x2c152e-0x0;var _0x5d1539=_0x25d4[_0x2c152e];return _0x5d1539;};'use strict';var Sequelize=require(_0x425d('0x0'));module['exports']={'priority':{'type':Sequelize[_0x425d('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x425d('0x2')},'appdata':{'type':Sequelize[_0x425d('0x3')]()},'description':{'type':Sequelize[_0x425d('0x4')]},'interval':{'type':Sequelize[_0x425d('0x4')],'defaultValue':_0x425d('0x5')}}; \ No newline at end of file +var _0x4b99=['noop','*,*,*,*','sequelize','exports','STRING'];(function(_0x5c80d6,_0x54c683){var _0x2b28a8=function(_0x123bad){while(--_0x123bad){_0x5c80d6['push'](_0x5c80d6['shift']());}};_0x2b28a8(++_0x54c683);}(_0x4b99,0xa2));var _0x94b9=function(_0x154f82,_0x3c046e){_0x154f82=_0x154f82-0x0;var _0x977a6c=_0x4b99[_0x154f82];return _0x977a6c;};'use strict';var Sequelize=require(_0x94b9('0x0'));module[_0x94b9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x94b9('0x2')],'allowNull':![],'defaultValue':_0x94b9('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x94b9('0x2')]},'interval':{'type':Sequelize[_0x94b9('0x2')],'defaultValue':_0x94b9('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 1f83276..d982bc4 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 _0x689b=['reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','length','find','create','body','params','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply'];(function(_0x5786f5,_0x6c8063){var _0x4cdd0c=function(_0x4fd55d){while(--_0x4fd55d){_0x5786f5['push'](_0x5786f5['shift']());}};_0x4cdd0c(++_0x6c8063);}(_0x689b,0x142));var _0xb689=function(_0x16d6bc,_0x3f37c2){_0x16d6bc=_0x16d6bc-0x0;var _0x51821d=_0x689b[_0x16d6bc];return _0x51821d;};'use strict';var emlformat=require(_0xb689('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb689('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb689('0x2'));var BPromise=require(_0xb689('0x3'));var Mustache=require(_0xb689('0x4'));var util=require(_0xb689('0x5'));var path=require(_0xb689('0x6'));var sox=require(_0xb689('0x7'));var csv=require(_0xb689('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb689('0x9'));var _=require(_0xb689('0xa'));var squel=require(_0xb689('0xb'));var crypto=require(_0xb689('0xc'));var jsforce=require(_0xb689('0xd'));var deskjs=require(_0xb689('0xe'));var toCsv=require(_0xb689('0x8'));var querystring=require('querystring');var Papa=require(_0xb689('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb689('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb689('0x11'));var logger=require('../../config/logger')(_0xb689('0x12'));var utils=require(_0xb689('0x13'));var config=require(_0xb689('0x14'));var licenseUtil=require(_0xb689('0x15'));var db=require(_0xb689('0x16'))['db'];function respondWithStatusCode(_0x3b8460,_0x18a8f6){_0x18a8f6=_0x18a8f6||0xcc;return function(_0x3160a7){if(_0x3160a7){return _0x3b8460[_0xb689('0x17')](_0x18a8f6);}return _0x3b8460['status'](_0x18a8f6)[_0xb689('0x18')]();};}function respondWithResult(_0x320640,_0xa8ddb){_0xa8ddb=_0xa8ddb||0xc8;return function(_0x45f044){if(_0x45f044){return _0x320640[_0xb689('0x19')](_0xa8ddb)[_0xb689('0x1a')](_0x45f044);}};}function respondWithFilteredResult(_0x59094e,_0xf09cd4){return function(_0x1ec1b4){if(_0x1ec1b4){var _0x5f2456=typeof _0xf09cd4[_0xb689('0x1b')]==='undefined'&&typeof _0xf09cd4[_0xb689('0x1c')]==='undefined';var _0x5d59be=_0x1ec1b4[_0xb689('0x1d')];var _0x143b5c=_0x5f2456?0x0:_0xf09cd4['offset'];var _0x4439ef=_0x5f2456?_0x1ec1b4['count']:_0xf09cd4[_0xb689('0x1b')]+_0xf09cd4['limit'];var _0x3091eb;if(_0x4439ef>=_0x5d59be){_0x4439ef=_0x5d59be;_0x3091eb=0xc8;}else{_0x3091eb=0xce;}_0x59094e[_0xb689('0x19')](_0x3091eb);return _0x59094e[_0xb689('0x1e')](_0xb689('0x1f'),_0x143b5c+'-'+_0x4439ef+'/'+_0x5d59be)[_0xb689('0x1a')](_0x1ec1b4);}return null;};}function patchUpdates(_0x4a9b09){return function(_0x36000e){try{jsonpatch[_0xb689('0x20')](_0x36000e,_0x4a9b09,!![]);}catch(_0x5a591d){return BPromise[_0xb689('0x21')](_0x5a591d);}return _0x36000e[_0xb689('0x22')]();};}function saveUpdates(_0x5a1970,_0x5aea04){return function(_0x404435){if(_0x404435){return _0x404435[_0xb689('0x23')](_0x5a1970)[_0xb689('0x24')](function(_0x197a29){return _0x197a29;});}return null;};}function removeEntity(_0x2f7d0f,_0x1db07b){return function(_0x17a31d){if(_0x17a31d){return _0x17a31d[_0xb689('0x25')]()[_0xb689('0x24')](function(){_0x2f7d0f[_0xb689('0x19')](0xcc)[_0xb689('0x18')]();});}};}function handleEntityNotFound(_0x3855b6,_0x44e2f4){return function(_0x22a456){if(!_0x22a456){_0x3855b6[_0xb689('0x17')](0x194);}return _0x22a456;};}function handleError(_0x54d1c4,_0x1d8fb4){_0x1d8fb4=_0x1d8fb4||0x1f4;return function(_0x20440c){logger[_0xb689('0x26')](_0x20440c[_0xb689('0x27')]);if(_0x20440c[_0xb689('0x28')]){delete _0x20440c[_0xb689('0x28')];}_0x54d1c4[_0xb689('0x19')](_0x1d8fb4)[_0xb689('0x29')](_0x20440c);};}exports[_0xb689('0x2a')]=function(_0x513412,_0x4c4b80){var _0xd73d16={},_0x363443={},_0x4216cc={'count':0x0,'rows':[]};var _0x3864af=_[_0xb689('0x2b')](db[_0xb689('0x2c')][_0xb689('0x2d')],function(_0x5ef406){return{'name':_0x5ef406['fieldName'],'type':_0x5ef406['type'][_0xb689('0x2e')]};});_0x363443[_0xb689('0x2f')]=_[_0xb689('0x2b')](_0x3864af,_0xb689('0x28'));_0x363443[_0xb689('0x30')]=_[_0xb689('0x31')](_0x513412['query']);_0x363443[_0xb689('0x32')]=_[_0xb689('0x33')](_0x363443[_0xb689('0x2f')],_0x363443[_0xb689('0x30')]);_0xd73d16['attributes']=_[_0xb689('0x33')](_0x363443[_0xb689('0x2f')],qs['fields'](_0x513412[_0xb689('0x30')][_0xb689('0x34')]));_0xd73d16['attributes']=_0xd73d16[_0xb689('0x35')]['length']?_0xd73d16[_0xb689('0x35')]:_0x363443[_0xb689('0x2f')];if(!_0x513412[_0xb689('0x30')]['hasOwnProperty'](_0xb689('0x36'))){_0xd73d16[_0xb689('0x1c')]=qs[_0xb689('0x1c')](_0x513412[_0xb689('0x30')]['limit']);_0xd73d16[_0xb689('0x1b')]=qs[_0xb689('0x1b')](_0x513412[_0xb689('0x30')][_0xb689('0x1b')]);}_0xd73d16['order']=qs[_0xb689('0x37')](_0x513412[_0xb689('0x30')]['sort']);_0xd73d16[_0xb689('0x38')]=qs[_0xb689('0x32')](_[_0xb689('0x39')](_0x513412[_0xb689('0x30')],_0x363443['filters']),_0x3864af);if(_0x513412[_0xb689('0x30')][_0xb689('0x3a')]){_0xd73d16[_0xb689('0x38')]=_[_0xb689('0x3b')](_0xd73d16[_0xb689('0x38')],{'$or':_[_0xb689('0x2b')](_0x3864af,function(_0x53debb){if(_0x53debb['type']!==_0xb689('0x3c')){var _0x1b7c63={};_0x1b7c63[_0x53debb[_0xb689('0x28')]]={'$like':'%'+_0x513412[_0xb689('0x30')][_0xb689('0x3a')]+'%'};return _0x1b7c63;}})});}_0xd73d16=_[_0xb689('0x3b')]({},_0xd73d16,_0x513412[_0xb689('0x3d')]);var _0x55543c={'where':_0xd73d16[_0xb689('0x38')]};return db[_0xb689('0x2c')][_0xb689('0x1d')](_0x55543c)[_0xb689('0x24')](function(_0x8a3421){_0x4216cc[_0xb689('0x1d')]=_0x8a3421;if(_0x513412[_0xb689('0x30')][_0xb689('0x3e')]){_0xd73d16[_0xb689('0x3f')]=[{'all':!![]}];}return db[_0xb689('0x2c')][_0xb689('0x40')](_0xd73d16);})[_0xb689('0x24')](function(_0x2ba4a2){_0x4216cc['rows']=_0x2ba4a2;return _0x4216cc;})['then'](respondWithFilteredResult(_0x4c4b80,_0xd73d16))[_0xb689('0x41')](handleError(_0x4c4b80,null));};exports['show']=function(_0x273c77,_0x24f52a){var _0x16abde={'raw':!![],'where':{'id':_0x273c77['params']['id']}},_0x4dd712={};_0x4dd712[_0xb689('0x2f')]=_['keys'](db[_0xb689('0x2c')]['rawAttributes']);_0x4dd712['query']=_[_0xb689('0x31')](_0x273c77['query']);_0x4dd712[_0xb689('0x32')]=_[_0xb689('0x33')](_0x4dd712[_0xb689('0x2f')],_0x4dd712['query']);_0x16abde['attributes']=_[_0xb689('0x33')](_0x4dd712[_0xb689('0x2f')],qs[_0xb689('0x34')](_0x273c77[_0xb689('0x30')][_0xb689('0x34')]));_0x16abde[_0xb689('0x35')]=_0x16abde['attributes'][_0xb689('0x42')]?_0x16abde[_0xb689('0x35')]:_0x4dd712[_0xb689('0x2f')];if(_0x273c77['query'][_0xb689('0x3e')]){_0x16abde[_0xb689('0x3f')]=[{'all':!![]}];}_0x16abde=_['merge']({},_0x16abde,_0x273c77[_0xb689('0x3d')]);return db[_0xb689('0x2c')][_0xb689('0x43')](_0x16abde)[_0xb689('0x24')](handleEntityNotFound(_0x24f52a,null))['then'](respondWithResult(_0x24f52a,null))['catch'](handleError(_0x24f52a,null));};exports[_0xb689('0x44')]=function(_0x194fc2,_0x2312c0){return db[_0xb689('0x2c')]['create'](_0x194fc2[_0xb689('0x45')],{})[_0xb689('0x24')](respondWithResult(_0x2312c0,0xc9))[_0xb689('0x41')](handleError(_0x2312c0,null));};exports['update']=function(_0x31a102,_0x125ad4){if(_0x31a102[_0xb689('0x45')]['id']){delete _0x31a102[_0xb689('0x45')]['id'];}return db[_0xb689('0x2c')][_0xb689('0x43')]({'where':{'id':_0x31a102['params']['id']}})['then'](handleEntityNotFound(_0x125ad4,null))[_0xb689('0x24')](saveUpdates(_0x31a102['body'],null))[_0xb689('0x24')](respondWithResult(_0x125ad4,null))[_0xb689('0x41')](handleError(_0x125ad4,null));};exports[_0xb689('0x25')]=function(_0x4a39cd,_0x205d7f){return db[_0xb689('0x2c')]['find']({'where':{'id':_0x4a39cd[_0xb689('0x46')]['id']}})['then'](handleEntityNotFound(_0x205d7f,null))[_0xb689('0x24')](removeEntity(_0x205d7f,null))[_0xb689('0x41')](handleError(_0x205d7f,null));}; \ No newline at end of file +var _0xbbbc=['fieldName','type','key','model','query','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','filters','includeAll','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','WhatsappApplication','rawAttributes'];(function(_0x2e80e1,_0x2290db){var _0x464687=function(_0x46144b){while(--_0x46144b){_0x2e80e1['push'](_0x2e80e1['shift']());}};_0x464687(++_0x2290db);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x135cd7,_0x6bdc01){_0x135cd7=_0x135cd7-0x0;var _0x300a1d=_0xbbbc[_0x135cd7];return _0x300a1d;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];function respondWithStatusCode(_0x53e651,_0x56f81){_0x56f81=_0x56f81||0xcc;return function(_0x523c50){if(_0x523c50){return _0x53e651[_0xcbbb('0x18')](_0x56f81);}return _0x53e651[_0xcbbb('0x19')](_0x56f81)[_0xcbbb('0x1a')]();};}function respondWithResult(_0x47ea6a,_0x27ba56){_0x27ba56=_0x27ba56||0xc8;return function(_0x3ff767){if(_0x3ff767){return _0x47ea6a[_0xcbbb('0x19')](_0x27ba56)[_0xcbbb('0x1b')](_0x3ff767);}};}function respondWithFilteredResult(_0x47e679,_0x5af226){return function(_0x1bba39){if(_0x1bba39){var _0x30297d=typeof _0x5af226[_0xcbbb('0x1c')]===_0xcbbb('0x1d')&&typeof _0x5af226['limit']===_0xcbbb('0x1d');var _0x4ff973=_0x1bba39[_0xcbbb('0x1e')];var _0x3436af=_0x30297d?0x0:_0x5af226[_0xcbbb('0x1c')];var _0x5052df=_0x30297d?_0x1bba39['count']:_0x5af226['offset']+_0x5af226[_0xcbbb('0x1f')];var _0x3ae91b;if(_0x5052df>=_0x4ff973){_0x5052df=_0x4ff973;_0x3ae91b=0xc8;}else{_0x3ae91b=0xce;}_0x47e679[_0xcbbb('0x19')](_0x3ae91b);return _0x47e679[_0xcbbb('0x20')](_0xcbbb('0x21'),_0x3436af+'-'+_0x5052df+'/'+_0x4ff973)[_0xcbbb('0x1b')](_0x1bba39);}return null;};}function patchUpdates(_0x45de5f){return function(_0x2be36c){try{jsonpatch[_0xcbbb('0x22')](_0x2be36c,_0x45de5f,!![]);}catch(_0x2d4335){return BPromise['reject'](_0x2d4335);}return _0x2be36c[_0xcbbb('0x23')]();};}function saveUpdates(_0xe07b0,_0x159c62){return function(_0x42aaf1){if(_0x42aaf1){return _0x42aaf1[_0xcbbb('0x24')](_0xe07b0)[_0xcbbb('0x25')](function(_0x297eae){return _0x297eae;});}return null;};}function removeEntity(_0xabb565,_0x3ca570){return function(_0x5e3970){if(_0x5e3970){return _0x5e3970[_0xcbbb('0x26')]()[_0xcbbb('0x25')](function(){_0xabb565['status'](0xcc)[_0xcbbb('0x1a')]();});}};}function handleEntityNotFound(_0x4ffa80,_0x48dfc4){return function(_0x575d56){if(!_0x575d56){_0x4ffa80[_0xcbbb('0x18')](0x194);}return _0x575d56;};}function handleError(_0x548440,_0x59c422){_0x59c422=_0x59c422||0x1f4;return function(_0x5499a1){logger[_0xcbbb('0x27')](_0x5499a1['stack']);if(_0x5499a1['name']){delete _0x5499a1[_0xcbbb('0x28')];}_0x548440[_0xcbbb('0x19')](_0x59c422)[_0xcbbb('0x29')](_0x5499a1);};}exports[_0xcbbb('0x2a')]=function(_0x372024,_0x39ba8b){var _0x3d4c0d={},_0x1c986d={},_0x2a023f={'count':0x0,'rows':[]};var _0x26c05e=_[_0xcbbb('0x2b')](db[_0xcbbb('0x2c')][_0xcbbb('0x2d')],function(_0x1ce741){return{'name':_0x1ce741[_0xcbbb('0x2e')],'type':_0x1ce741[_0xcbbb('0x2f')][_0xcbbb('0x30')]};});_0x1c986d[_0xcbbb('0x31')]=_['map'](_0x26c05e,_0xcbbb('0x28'));_0x1c986d[_0xcbbb('0x32')]=_['keys'](_0x372024[_0xcbbb('0x32')]);_0x1c986d['filters']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],_0x1c986d[_0xcbbb('0x32')]);_0x3d4c0d['attributes']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x3d4c0d[_0xcbbb('0x35')]=_0x3d4c0d[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x3d4c0d[_0xcbbb('0x35')]:_0x1c986d[_0xcbbb('0x31')];if(!_0x372024['query']['hasOwnProperty']('nolimit')){_0x3d4c0d['limit']=qs[_0xcbbb('0x1f')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1f')]);_0x3d4c0d[_0xcbbb('0x1c')]=qs[_0xcbbb('0x1c')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1c')]);}_0x3d4c0d[_0xcbbb('0x37')]=qs[_0xcbbb('0x38')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x38')]);_0x3d4c0d[_0xcbbb('0x39')]=qs['filters'](_['pick'](_0x372024[_0xcbbb('0x32')],_0x1c986d['filters']),_0x26c05e);if(_0x372024['query']['filter']){_0x3d4c0d[_0xcbbb('0x39')]=_[_0xcbbb('0x3a')](_0x3d4c0d[_0xcbbb('0x39')],{'$or':_[_0xcbbb('0x2b')](_0x26c05e,function(_0x38e59d){if(_0x38e59d[_0xcbbb('0x2f')]!==_0xcbbb('0x3b')){var _0x14c1a2={};_0x14c1a2[_0x38e59d[_0xcbbb('0x28')]]={'$like':'%'+_0x372024[_0xcbbb('0x32')][_0xcbbb('0x3c')]+'%'};return _0x14c1a2;}})});}_0x3d4c0d=_['merge']({},_0x3d4c0d,_0x372024[_0xcbbb('0x3d')]);var _0x55d349={'where':_0x3d4c0d[_0xcbbb('0x39')]};return db[_0xcbbb('0x2c')][_0xcbbb('0x1e')](_0x55d349)[_0xcbbb('0x25')](function(_0x433065){_0x2a023f[_0xcbbb('0x1e')]=_0x433065;if(_0x372024['query']['includeAll']){_0x3d4c0d['include']=[{'all':!![]}];}return db[_0xcbbb('0x2c')][_0xcbbb('0x3e')](_0x3d4c0d);})[_0xcbbb('0x25')](function(_0x162979){_0x2a023f[_0xcbbb('0x3f')]=_0x162979;return _0x2a023f;})[_0xcbbb('0x25')](respondWithFilteredResult(_0x39ba8b,_0x3d4c0d))[_0xcbbb('0x40')](handleError(_0x39ba8b,null));};exports['show']=function(_0x1a7799,_0x22076a){var _0x5550d2={'raw':!![],'where':{'id':_0x1a7799[_0xcbbb('0x41')]['id']}},_0x15b3bc={};_0x15b3bc[_0xcbbb('0x31')]=_[_0xcbbb('0x42')](db[_0xcbbb('0x2c')]['rawAttributes']);_0x15b3bc[_0xcbbb('0x32')]=_['keys'](_0x1a7799['query']);_0x15b3bc[_0xcbbb('0x43')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],_0x15b3bc[_0xcbbb('0x32')]);_0x5550d2[_0xcbbb('0x35')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x5550d2[_0xcbbb('0x35')]=_0x5550d2[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x5550d2[_0xcbbb('0x35')]:_0x15b3bc['model'];if(_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x44')]){_0x5550d2[_0xcbbb('0x45')]=[{'all':!![]}];}_0x5550d2=_[_0xcbbb('0x3a')]({},_0x5550d2,_0x1a7799['options']);return db['WhatsappApplication']['find'](_0x5550d2)[_0xcbbb('0x25')](handleEntityNotFound(_0x22076a,null))[_0xcbbb('0x25')](respondWithResult(_0x22076a,null))[_0xcbbb('0x40')](handleError(_0x22076a,null));};exports[_0xcbbb('0x46')]=function(_0x146f37,_0x1ef25b){return db[_0xcbbb('0x2c')]['create'](_0x146f37[_0xcbbb('0x47')],{})[_0xcbbb('0x25')](respondWithResult(_0x1ef25b,0xc9))[_0xcbbb('0x40')](handleError(_0x1ef25b,null));};exports[_0xcbbb('0x24')]=function(_0x478c22,_0x3378cd){if(_0x478c22[_0xcbbb('0x47')]['id']){delete _0x478c22[_0xcbbb('0x47')]['id'];}return db[_0xcbbb('0x2c')]['find']({'where':{'id':_0x478c22['params']['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3378cd,null))[_0xcbbb('0x25')](saveUpdates(_0x478c22[_0xcbbb('0x47')],null))['then'](respondWithResult(_0x3378cd,null))['catch'](handleError(_0x3378cd,null));};exports['destroy']=function(_0x189a40,_0x3070d9){return db['WhatsappApplication'][_0xcbbb('0x48')]({'where':{'id':_0x189a40[_0xcbbb('0x41')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3070d9,null))[_0xcbbb('0x25')](removeEntity(_0x3070d9,null))['catch'](handleError(_0x3070d9,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 7a5a1be..28045f3 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 _0x0fda=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4'];(function(_0x26bf51,_0x5e261a){var _0x503415=function(_0x92b028){while(--_0x92b028){_0x26bf51['push'](_0x26bf51['shift']());}};_0x503415(++_0x5e261a);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x552245,_0x1e349f){_0x552245=_0x552245-0x0;var _0xaef82b=_0x0fda[_0x552245];return _0xaef82b;};'use strict';var _=require(_0xa0fd('0x0'));var util=require('util');var logger=require(_0xa0fd('0x1'))(_0xa0fd('0x2'));var moment=require(_0xa0fd('0x3'));var BPromise=require(_0xa0fd('0x4'));var rp=require(_0xa0fd('0x5'));var fs=require('fs');var path=require(_0xa0fd('0x6'));var rimraf=require(_0xa0fd('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0xa0fd('0x8')]=function(_0x4aec58,_0x49b3c1){return _0x4aec58[_0xa0fd('0x9')](_0xa0fd('0xa'),attributes,{'tableName':_0xa0fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa0fd('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x423b=['utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication'];(function(_0x58d26e,_0x59fa0a){var _0x510689=function(_0x4d2c6b){while(--_0x4d2c6b){_0x58d26e['push'](_0x58d26e['shift']());}};_0x510689(++_0x59fa0a);}(_0x423b,0x12b));var _0xb423=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x423b[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0xb423('0x0'));var logger=require('../../config/logger')(_0xb423('0x1'));var moment=require('moment');var BPromise=require(_0xb423('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb423('0x3'));var attributes=require(_0xb423('0x4'));module['exports']=function(_0x1be92e,_0x3e6b18){return _0x1be92e[_0xb423('0x5')](_0xb423('0x6'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb423('0x7'),'collate':_0xb423('0x8')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 652115d..d51c1b5 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 _0xda55=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x2cc9e6,_0x17e138){var _0x4b0d89=function(_0x3c5c44){while(--_0x3c5c44){_0x2cc9e6['push'](_0x2cc9e6['shift']());}};_0x4b0d89(++_0x17e138);}(_0xda55,0x6d));var _0x5da5=function(_0x54b5bd,_0x133fe1){_0x54b5bd=_0x54b5bd-0x0;var _0xcba844=_0xda55[_0x54b5bd];return _0xcba844;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});} \ No newline at end of file +var _0xd6d6=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3eac0e,_0x22f7b0){var _0x2106c6=function(_0x218c08){while(--_0x218c08){_0x3eac0e['push'](_0x3eac0e['shift']());}};_0x2106c6(++_0x22f7b0);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x4b3335,_0x10ec60){_0x4b3335=_0x4b3335-0x0;var _0x3db27f=_0xd6d6[_0x4b3335];return _0x3db27f;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){return client[_0x6d6d('0xc')](_0x1bf731,_0x18f824)['then'](function(_0x51dd38){logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,_0x6d6d('0xf'));logger[_0x6d6d('0x10')](_0x6d6d('0x11'),_0x44f83d,'request\x20sent',JSON[_0x6d6d('0x12')](_0x51dd38));if(_0x51dd38[_0x6d6d('0x13')]){if(_0x51dd38['error']['code']===0x1f4){logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);return _0x408f88(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38['error'][_0x6d6d('0x14')]);return _0xd49f57(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}else{logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,'request\x20sent');_0xd49f57(_0x51dd38[_0x6d6d('0x15')]['message']);}})[_0x6d6d('0x16')](function(_0x2cbc86){logger[_0x6d6d('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x44f83d,_0x2cbc86);_0x408f88(_0x2cbc86);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 4311c98..6960c51 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 _0x723e=['../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x359c88,_0xeafc31){var _0xd78529=function(_0x5a51c1){while(--_0x5a51c1){_0x359c88['push'](_0x359c88['shift']());}};_0xd78529(++_0xeafc31);}(_0x723e,0x179));var _0xe723=function(_0xf4add4,_0x5b9cc1){_0xf4add4=_0xf4add4-0x0;var _0x1c42fb=_0x723e[_0xf4add4];return _0x1c42fb;};'use strict';var multer=require('multer');var util=require(_0xe723('0x0'));var path=require(_0xe723('0x1'));var timeout=require(_0xe723('0x2'));var express=require(_0xe723('0x3'));var router=express[_0xe723('0x4')]();var fs_extra=require(_0xe723('0x5'));var auth=require(_0xe723('0x6'));var interaction=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var controller=require(_0xe723('0x9'));router['get']('/',auth[_0xe723('0xa')](),controller[_0xe723('0xb')]);router[_0xe723('0xc')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller[_0xe723('0xe')]);router[_0xe723('0xc')](_0xe723('0xf'),auth['isAuthenticated'](),controller[_0xe723('0x10')]);router[_0xe723('0xc')](_0xe723('0x11'),auth['isAuthenticated'](),controller[_0xe723('0x12')]);router[_0xe723('0xc')](_0xe723('0x13'),auth['isAuthenticated'](),controller[_0xe723('0x14')]);router[_0xe723('0x15')]('/',auth[_0xe723('0xa')](),controller[_0xe723('0x16')]);router[_0xe723('0x15')]('/:id/messages',auth[_0xe723('0xa')](),controller['addMessage']);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0xe723('0x17')](_0xe723('0x18'),_0xe723('0x19')),controller[_0xe723('0x1a')]);router[_0xe723('0x1b')]('/:id',auth[_0xe723('0xa')](),interaction[_0xe723('0x17')](_0xe723('0x18'),_0xe723('0x1c')),controller[_0xe723('0x1d')]);router[_0xe723('0x1e')](_0xe723('0xf'),auth[_0xe723('0xa')](),interaction[_0xe723('0x17')](_0xe723('0x18'),_0xe723('0x1f')),controller[_0xe723('0x20')]);router[_0xe723('0x1e')](_0xe723('0x21'),auth['isAuthenticated'](),controller['removeTags']);module[_0xe723('0x22')]=router; \ No newline at end of file +var _0xafc4=['show','/:id/messages','download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','/:id'];(function(_0x45564a,_0x160043){var _0x1184c7=function(_0x529f16){while(--_0x529f16){_0x45564a['push'](_0x45564a['shift']());}};_0x1184c7(++_0x160043);}(_0xafc4,0x69));var _0x4afc=function(_0x2bada0,_0x102c42){_0x2bada0=_0x2bada0-0x0;var _0x51a4d6=_0xafc4[_0x2bada0];return _0x51a4d6;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var fs_extra=require(_0x4afc('0x4'));var auth=require(_0x4afc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x4afc('0x6')]('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0x8')]);router[_0x4afc('0x6')](_0x4afc('0x9'),auth[_0x4afc('0x7')](),controller['describe']);router[_0x4afc('0x6')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),controller[_0x4afc('0xb')]);router[_0x4afc('0x6')](_0x4afc('0xc'),auth['isAuthenticated'](),controller['getMessages']);router[_0x4afc('0x6')]('/:id/download',auth[_0x4afc('0x7')](),controller[_0x4afc('0xd')]);router['post']('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0xe')]);router[_0x4afc('0xf')](_0x4afc('0xc'),auth[_0x4afc('0x7')](),controller[_0x4afc('0x10')]);router[_0x4afc('0xf')](_0x4afc('0x11'),auth['isAuthenticated'](),interaction[_0x4afc('0x12')](_0x4afc('0x13'),_0x4afc('0x14')),controller[_0x4afc('0x15')]);router['put']('/:id',auth[_0x4afc('0x7')](),interaction['tracked'](_0x4afc('0x13'),_0x4afc('0x16')),controller[_0x4afc('0x17')]);router[_0x4afc('0x18')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),interaction[_0x4afc('0x12')](_0x4afc('0x13'),_0x4afc('0x19')),controller[_0x4afc('0x1a')]);router[_0x4afc('0x18')]('/:id/tags',auth[_0x4afc('0x7')](),controller[_0x4afc('0x1b')]);module[_0x4afc('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 6d62803..1f1da1a 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 _0xce22=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0xc8868c,_0x70caf1){var _0x3ef63a=function(_0x48faaa){while(--_0x48faaa){_0xc8868c['push'](_0xc8868c['shift']());}};_0x3ef63a(++_0x70caf1);}(_0xce22,0xea));var _0x2ce2=function(_0x1aff57,_0xc71ff1){_0x1aff57=_0x1aff57-0x0;var _0x4898a8=_0xce22[_0x1aff57];return _0x4898a8;};'use strict';var Sequelize=require(_0x2ce2('0x0'));var moment=require(_0x2ce2('0x1'));module[_0x2ce2('0x2')]={'closed':{'type':Sequelize[_0x2ce2('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2ce2('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2ce2('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2ce2('0x5')]},'phone':{'type':Sequelize[_0x2ce2('0x5')]},'read1stAt':{'type':Sequelize[_0x2ce2('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2ce2('0x6')]('in',_0x2ce2('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2ce2('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x2ce2('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2ce2('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xb66c=['out','BOOLEAN','sequelize','exports','DATE','STRING','ENUM'];(function(_0x56c1b1,_0x589ecb){var _0x56af77=function(_0x52c088){while(--_0x52c088){_0x56c1b1['push'](_0x56c1b1['shift']());}};_0x56af77(++_0x589ecb);}(_0xb66c,0x175));var _0xcb66=function(_0x5e8835,_0x4e32aa){_0x5e8835=_0x5e8835-0x0;var _0x111733=_0xb66c[_0x5e8835];return _0x111733;};'use strict';var Sequelize=require(_0xcb66('0x0'));var moment=require('moment');module[_0xcb66('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcb66('0x2')]},'disposition':{'type':Sequelize[_0xcb66('0x3')]},'secondDisposition':{'type':Sequelize[_0xcb66('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xcb66('0x3')]},'phone':{'type':Sequelize[_0xcb66('0x3')]},'read1stAt':{'type':Sequelize[_0xcb66('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xcb66('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcb66('0x4')]('in',_0xcb66('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcb66('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 8ca2d53..ac2b94c 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 _0xd33b=['end','status','undefined','limit','count','offset','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','fullname','TagIds','forEach','Tags','push','catch','index','WhatsappInteraction','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','field','color','from','tools_tags','u.fullname','ui.WhatsappInteractionId','left_join','users','u.id\x20=\x20ui.UserId','select','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','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','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','read','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','length','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','show','params','include','merge','options','create','describe','addMessage','ids','omit','getMessages','WhatsappMessage','rawAttributes','format','includeAll','findAll','addTags','setTags','spread','emit','removeTags','unix','join','root','files','tmp','server','attachments','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','createWriteStream','out','System','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','log','eml-format','rimraf','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xd33b,0x1af));var _0xbd33=function(_0x3cb4ab,_0x4101c5){_0x3cb4ab=_0x3cb4ab-0x0;var _0x1e5463=_0xd33b[_0x3cb4ab];return _0x1e5463;};'use strict';var emlformat=require(_0xbd33('0x0'));var rimraf=require(_0xbd33('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd33('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbd33('0x3'));var util=require(_0xbd33('0x4'));var path=require('path');var sox=require(_0xbd33('0x5'));var csv=require(_0xbd33('0x6'));var ejs=require(_0xbd33('0x7'));var fs=require('fs');var fs_extra=require(_0xbd33('0x8'));var _=require('lodash');var squel=require(_0xbd33('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd33('0xa'));var deskjs=require(_0xbd33('0xb'));var toCsv=require(_0xbd33('0x6'));var querystring=require(_0xbd33('0xc'));var Papa=require(_0xbd33('0xd'));var Redis=require(_0xbd33('0xe'));var authService=require(_0xbd33('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbd33('0x10'));var pdf=require(_0xbd33('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd33('0x12'))(_0xbd33('0x13'));var utils=require(_0xbd33('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbd33('0x15'));var db=require(_0xbd33('0x16'))['db'];config[_0xbd33('0x17')]=_[_0xbd33('0x18')](config[_0xbd33('0x17')],{'host':_0xbd33('0x19'),'port':0x18eb});var socket=require(_0xbd33('0x1a'))(new Redis(config['redis']));require(_0xbd33('0x1b'))[_0xbd33('0x1c')](socket);function respondWithStatusCode(_0x3366f3,_0x4e6b5c){_0x4e6b5c=_0x4e6b5c||0xcc;return function(_0x5130a0){if(_0x5130a0){return _0x3366f3['sendStatus'](_0x4e6b5c);}return _0x3366f3['status'](_0x4e6b5c)[_0xbd33('0x1d')]();};}function respondWithResult(_0x322341,_0x4ba160){_0x4ba160=_0x4ba160||0xc8;return function(_0x296391){if(_0x296391){return _0x322341[_0xbd33('0x1e')](_0x4ba160)['json'](_0x296391);}};}function respondWithFilteredResult(_0x13bcda,_0x381a36){return function(_0x21b8dc){if(_0x21b8dc){var _0xcd198f=typeof _0x381a36['offset']===_0xbd33('0x1f')&&typeof _0x381a36[_0xbd33('0x20')]===_0xbd33('0x1f');var _0x3ff7fb=_0x21b8dc[_0xbd33('0x21')];var _0x2c909c=_0xcd198f?0x0:_0x381a36['offset'];var _0x52aa09=_0xcd198f?_0x21b8dc['count']:_0x381a36[_0xbd33('0x22')]+_0x381a36[_0xbd33('0x20')];var _0x500c80;if(_0x52aa09>=_0x3ff7fb){_0x52aa09=_0x3ff7fb;_0x500c80=0xc8;}else{_0x500c80=0xce;}_0x13bcda['status'](_0x500c80);return _0x13bcda['set']('Content-Range',_0x2c909c+'-'+_0x52aa09+'/'+_0x3ff7fb)[_0xbd33('0x23')](_0x21b8dc);}return null;};}function patchUpdates(_0x5601ca){return function(_0x325aac){try{jsonpatch[_0xbd33('0x24')](_0x325aac,_0x5601ca,!![]);}catch(_0x11f6a1){return BPromise[_0xbd33('0x25')](_0x11f6a1);}return _0x325aac[_0xbd33('0x26')]();};}function saveUpdates(_0x483952,_0x4a91f5){return function(_0x2cc435){if(_0x2cc435){return _0x2cc435[_0xbd33('0x27')](_0x483952)[_0xbd33('0x28')](function(_0x142253){return _0x142253;});}return null;};}function removeEntity(_0x1be515,_0x463f36){return function(_0x2ccdcb){if(_0x2ccdcb){return _0x2ccdcb[_0xbd33('0x29')]()[_0xbd33('0x28')](function(){_0x1be515[_0xbd33('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d51ab,_0x4f4b63){return function(_0x3f2c91){if(!_0x3f2c91){_0x5d51ab[_0xbd33('0x2a')](0x194);}return _0x3f2c91;};}function handleError(_0xd78285,_0x22a9c9){_0x22a9c9=_0x22a9c9||0x1f4;return function(_0x11105f){logger[_0xbd33('0x2b')](_0x11105f['stack']);if(_0x11105f[_0xbd33('0x2c')]){delete _0x11105f[_0xbd33('0x2c')];}_0xd78285[_0xbd33('0x1e')](_0x22a9c9)[_0xbd33('0x2d')](_0x11105f);};}function getInteractionUsers(_0x98b0a,_0x29204f){return new BPromise(function(_0x53c359,_0x50663f){try{if(_0x29204f[_0x98b0a['id']]){_0x98b0a['Users']=_[_0xbd33('0x2e')](_0x29204f[_0x98b0a['id']],function(_0x57ef17){return{'id':_0x57ef17['id'],'fullname':_0x57ef17[_0xbd33('0x2f')]};});}}catch(_0x1f82b4){_0x50663f(_0x1f82b4);}_0x53c359(_0x98b0a);});}function getInteractionTags(_0x22c33f,_0x348c4b){return new BPromise(function(_0x5675e3,_0xe1e323){try{if(_0x22c33f[_0xbd33('0x30')]){_0x22c33f['Tags']=[];_0x22c33f[_0xbd33('0x30')]['split'](',')[_0xbd33('0x31')](function(_0x174e52){_0x22c33f[_0xbd33('0x32')][_0xbd33('0x33')](_0x348c4b[_0x174e52]);});}delete _0x22c33f[_0xbd33('0x30')];}catch(_0x4bc639){_0xe1e323(_0x4bc639);}_0x5675e3(_0x22c33f);});}function updateWhatsappInteraction(_0x41f446,_0x5d3588,_0x2ffd45){return new BPromise(function(_0x3c04d6,_0x8a4336){return getInteractionUsers(_0x41f446,_0x2ffd45)[_0xbd33('0x28')](function(_0x551266){return getInteractionTags(_0x551266,_0x5d3588);})[_0xbd33('0x28')](function(_0x19c0de){_0x3c04d6(_0x19c0de);})[_0xbd33('0x34')](function(_0x700a4b){_0x8a4336(_0x700a4b);});});}exports[_0xbd33('0x35')]=function(_0x128750,_0x4701d6){var _0x1651a9={},_0x47c1f3={},_0xf89c1a={'count':0x0,'rows':[]};var _0x1b6055=_[_0xbd33('0x2e')](db[_0xbd33('0x36')]['rawAttributes'],function(_0x45ee1d){return{'name':_0x45ee1d[_0xbd33('0x37')],'type':_0x45ee1d[_0xbd33('0x38')]['key']};});_0x47c1f3[_0xbd33('0x39')]=_['map'](_0x1b6055,'name');_0x47c1f3[_0xbd33('0x3a')]=_[_0xbd33('0x3b')](_0x128750[_0xbd33('0x3a')]);_0x47c1f3[_0xbd33('0x3c')]=_['intersection'](_0x47c1f3[_0xbd33('0x39')],_0x47c1f3[_0xbd33('0x3a')]);_0x1651a9[_0xbd33('0x3d')]=_[_0xbd33('0x3e')](_0x47c1f3[_0xbd33('0x39')],qs[_0xbd33('0x3f')](_0x128750[_0xbd33('0x3a')][_0xbd33('0x3f')]));_0x1651a9['attributes']=_0x1651a9[_0xbd33('0x3d')]['length']?_0x1651a9[_0xbd33('0x3d')]:_0x47c1f3[_0xbd33('0x39')];if(!_0x128750[_0xbd33('0x3a')][_0xbd33('0x40')](_0xbd33('0x41'))){_0x1651a9['limit']=qs[_0xbd33('0x20')](_0x128750[_0xbd33('0x3a')][_0xbd33('0x20')]);_0x1651a9[_0xbd33('0x22')]=qs[_0xbd33('0x22')](_0x128750[_0xbd33('0x3a')][_0xbd33('0x22')]);}_0x1651a9[_0xbd33('0x42')]=qs[_0xbd33('0x43')](_0x128750['query'][_0xbd33('0x43')]);_0x1651a9['where']=qs['filters'](_[_0xbd33('0x44')](_0x128750[_0xbd33('0x3a')],_0x47c1f3['filters']),_0x1b6055);var _0x20861f=[];var _0x2022cc=squel['select']()[_0xbd33('0x45')]('id')[_0xbd33('0x45')](_0xbd33('0x2c'))[_0xbd33('0x45')](_0xbd33('0x46'))[_0xbd33('0x47')](_0xbd33('0x48'));var _0x55062c=squel['select']()[_0xbd33('0x45')]('u.id')[_0xbd33('0x45')](_0xbd33('0x49'))['field'](_0xbd33('0x4a'))['from']('user_has_whatsapp_interactions','ui')[_0xbd33('0x4b')](_0xbd33('0x4c'),'u',_0xbd33('0x4d'));var _0x4ce9c7=squel[_0xbd33('0x4e')]()[_0xbd33('0x47')](_0xbd33('0x4f'),'i')[_0xbd33('0x4b')]('cm_contacts','c',_0xbd33('0x50'))[_0xbd33('0x4b')]('users','o',_0xbd33('0x51'))[_0xbd33('0x4b')](_0xbd33('0x52'),'a',_0xbd33('0x53'))[_0xbd33('0x4b')](_0xbd33('0x54'),'me',_0xbd33('0x55'))[_0xbd33('0x4b')](_0xbd33('0x56'),'it',_0xbd33('0x57'))['left_join'](_0xbd33('0x48'),'t',_0xbd33('0x58'));var _0x5516dc=squel[_0xbd33('0x59')]();var _0x38331e=[];var _0x4278c3=squel[_0xbd33('0x59')]();var _0x5850e8;if(_0x128750[_0xbd33('0x3a')][_0xbd33('0x5a')]){_0x5850e8=as[_0xbd33('0x5b')](_0x128750[_0xbd33('0x3a')]['search']);var _0x1baf5e=_0x5850e8[_0xbd33('0x5c')];for(var _0x13ba5d=0x0;_0x13ba5d<_0x5850e8['conditions']['length'];_0x13ba5d++){var _0x31b1a0=_0x5850e8['conditions'][_0x13ba5d];var _0x59819b='i';var _0x15688e=_[_0xbd33('0x5d')](_0x1b6055,['name',_0x31b1a0[_0xbd33('0x45')]]);if(!_0x15688e){switch(_0x31b1a0['field']){case'unreadMessages':if(_0x31b1a0[_0xbd33('0x5e')]==0x1){_0x4ce9c7[_0xbd33('0x5f')]('`'+_0x31b1a0['field']+_0xbd33('0x60'));}else{_0x4ce9c7[_0xbd33('0x5f')]('`'+_0x31b1a0['field']+_0xbd33('0x61'));}break;case _0xbd33('0x62'):if(_0x31b1a0[_0xbd33('0x63')]==='$substring'){if(_0x31b1a0[_0xbd33('0x5e')][_0xbd33('0x64')]('\x20')['length']>0x1){_0x5516dc[_0x1baf5e](_0xbd33('0x65'),qs[_0xbd33('0x66')](_0x31b1a0['value']),null);}else{var _0x37221f='%'+_0x31b1a0[_0xbd33('0x5e')]+'%';_0x5516dc[_0x1baf5e](_0xbd33('0x67'),_0x37221f,_0x37221f,_0x37221f);}}else{_0x15688e=_[_0xbd33('0x5d')](_0x1b6055,['name',_0xbd33('0x68')]);_0x31b1a0[_0xbd33('0x45')]=_0xbd33('0x68');_0x327d66=as['buildExpression'](_0x59819b,_0x15688e['type'],_0x31b1a0);_0x5516dc[_0x1baf5e](_0x327d66[_0xbd33('0x69')],_0x327d66[_0xbd33('0x5e')][_0xbd33('0x6a')],_0x327d66[_0xbd33('0x5e')][_0xbd33('0x1d')]);}break;case _0xbd33('0x6b'):var _0x527ea4=_0x31b1a0[_0xbd33('0x5e')]['split'](',')[_0xbd33('0x2e')](function(_0x42a8d8){return Number(_0x42a8d8);});_0x527ea4[_0xbd33('0x31')](function(_0x10f1b3){_0x4278c3['or'](_0xbd33('0x6c'),'%,'+_0x10f1b3+',%');});_0x38331e=_['union'](_0x38331e,_0x527ea4);break;case _0xbd33('0x6d'):if(_0x31b1a0['operator']===_0xbd33('0x6e')){_0x5516dc[_0x1baf5e](_0xbd33('0x6f'),'%'+_0x31b1a0[_0xbd33('0x5e')]+'%',null);}else{_0x15688e=_[_0xbd33('0x5d')](_0x1b6055,[_0xbd33('0x2c'),_0xbd33('0x70')]);_0x31b1a0[_0xbd33('0x45')]=_0xbd33('0x70');_0x327d66=as[_0xbd33('0x71')](_0x59819b,_0x15688e[_0xbd33('0x38')],_0x31b1a0);_0x5516dc[_0x1baf5e](_0x327d66[_0xbd33('0x69')],_0x327d66['value'][_0xbd33('0x6a')],_0x327d66[_0xbd33('0x5e')][_0xbd33('0x1d')]);}break;case _0xbd33('0x72'):_0x327d66=as[_0xbd33('0x71')]('me',null,_0x31b1a0);_0x5516dc[_0x1baf5e](_0x327d66[_0xbd33('0x69')],_0x327d66[_0xbd33('0x5e')]['start'],_0x327d66[_0xbd33('0x5e')][_0xbd33('0x1d')]);break;}}else{var _0x327d66=as[_0xbd33('0x71')](_0x59819b,_0x15688e['type'],_0x31b1a0);_0x5516dc[_0x1baf5e](_0x327d66[_0xbd33('0x69')],_0x327d66[_0xbd33('0x5e')][_0xbd33('0x6a')],_0x327d66[_0xbd33('0x5e')][_0xbd33('0x1d')]);}}}else{var _0x29456e=_(_0x128750[_0xbd33('0x3a')])[_0xbd33('0x3b')]()['map'](function(_0xf00d44){return _[_0xbd33('0x73')](_0x1b6055,[_0xbd33('0x2c'),_0xf00d44])?_0xf00d44:undefined;})[_0xbd33('0x74')]()[_0xbd33('0x5e')]();if(!_[_0xbd33('0x75')](_0x29456e)){_0x29456e[_0xbd33('0x31')](function(_0x20b3f2){if(_0x20b3f2===_0xbd33('0x76')){_0x4ce9c7[_0xbd33('0x77')](_0xbd33('0x78'),[][_0xbd33('0x79')](_0x128750[_0xbd33('0x3a')][_0x20b3f2]));}else if(_0x20b3f2===_0xbd33('0x7a')){var _0x2f7dd6=JSON[_0xbd33('0x7b')](_0x128750[_0xbd33('0x3a')][_0x20b3f2])[_0xbd33('0x7c')];var _0x2b79a2=JSON[_0xbd33('0x7b')](_0x128750[_0xbd33('0x3a')][_0x20b3f2])[_0xbd33('0x7d')];_0x4ce9c7[_0xbd33('0x77')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2f7dd6,_0x2b79a2);}else{if(_0x128750[_0xbd33('0x3a')][_0x20b3f2]===_0xbd33('0x7e')){_0x4ce9c7[_0xbd33('0x77')]('i.'+_0x20b3f2+_0xbd33('0x7f'));}else{_0x4ce9c7['where']('i.'+_0x20b3f2+'\x20=\x20?',_0x128750[_0xbd33('0x3a')][_0x20b3f2]);}}});}if(_0x128750[_0xbd33('0x3a')][_0xbd33('0x80')]){if(_0x128750['query']['read']==0x1){_0x4ce9c7['having']('`unreadMessages`\x20=\x200');}else{_0x4ce9c7['having']('`unreadMessages`\x20>\x200');}}if(_0x128750[_0xbd33('0x3a')]['tag']){_0x38331e=_['isArray'](_0x128750['query'][_0xbd33('0x81')])?_0x128750['query']['tag']:new Array(_0x128750['query'][_0xbd33('0x81')]);_0x38331e[_0xbd33('0x31')](function(_0x117979){_0x4278c3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x117979+',%');});}if(_0x128750['query'][_0xbd33('0x82')]){var _0x1903e7=_0x128750[_0xbd33('0x3a')][_0xbd33('0x82')][_0xbd33('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xbd33('0x84')](_0x1903e7)){_0x5516dc['or']('i.id\x20LIKE\x20?',_0x1903e7+'%')['or'](_0xbd33('0x85'),_0x1903e7+'%');}else{_0x5516dc['or'](_0xbd33('0x86'),qs[_0xbd33('0x66')](_0x1903e7))['or'](_0xbd33('0x87'),_0x1903e7+'%');}}}_0x4ce9c7['where'](_0x5516dc);_0x4ce9c7[_0xbd33('0x88')]('i.id');var _0x203265={'type':db[_0xbd33('0x89')]['QueryTypes']['SELECT'],'raw':!![]};var _0xa1585b=_0x4ce9c7[_0xbd33('0x8a')]();_0xa1585b['field'](_0xbd33('0x8b'));_0xa1585b[_0xbd33('0x45')](_0xbd33('0x8c'),_0xbd33('0x8d'));if(_0x1651a9[_0xbd33('0x42')]){_0x1651a9[_0xbd33('0x42')][_0xbd33('0x31')](function(_0x407a16){var _0x557ce8=_0x407a16[0x0]===_0xbd33('0x8e')?_0x407a16[0x0]:'i.'+_0x407a16[0x0];_0x4ce9c7[_0xbd33('0x42')](_0x557ce8,_0x407a16[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x38331e)){_0x4ce9c7[_0xbd33('0x5f')](_0x4278c3);_0xa1585b['where'](_0xbd33('0x8f'),_0x38331e);}BPromise[_0xbd33('0x90')]()['then'](function(){if(!_0x5850e8){if(_0x128750[_0xbd33('0x3a')]['WhatsappAccountId'])return;_0xa1585b[_0xbd33('0x77')](_0xbd33('0x91'));_0x4ce9c7[_0xbd33('0x77')](_0xbd33('0x91'));return;}if(_0x128750['user']['role']!=='agent')return;return _0x128750[_0xbd33('0x92')][_0xbd33('0x93')]({'attributes':['id'],'raw':!![]})[_0xbd33('0x28')](function(_0x2e6acf){if(_[_0xbd33('0x75')](_0x2e6acf)){_0xa1585b[_0xbd33('0x77')]('i.WhatsappAccountId\x20IS\x20NULL');_0x4ce9c7[_0xbd33('0x77')](_0xbd33('0x94'));}else{_0xa1585b[_0xbd33('0x77')](_0xbd33('0x78'),_[_0xbd33('0x2e')](_0x2e6acf,'id'));_0x4ce9c7[_0xbd33('0x77')](_0xbd33('0x78'),_[_0xbd33('0x2e')](_0x2e6acf,'id'));}});})['then'](function(){if(_0x128750[_0xbd33('0x92')][_0xbd33('0x95')]==='agent'&&!_0x5850e8&&!_0x128750[_0xbd33('0x3a')]['WhatsappAccountId'])return[];return db[_0xbd33('0x96')][_0xbd33('0x3a')](_0xa1585b['toString'](),_0x203265);})[_0xbd33('0x28')](function(_0x5531ff){_0xf89c1a['count']=_0x5531ff[_0xbd33('0x97')];if(_0xf89c1a[_0xbd33('0x21')]===0x0)return[];return db[_0xbd33('0x96')]['query'](_0x2022cc[_0xbd33('0x98')](),_0x203265)[_0xbd33('0x28')](function(_0x5cef56){_0x20861f=_[_0xbd33('0x99')](_0x5cef56,'id');_0x203265=_['merge'](_0x203265,{'model':db[_0xbd33('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x128750[_0xbd33('0x3a')][_0xbd33('0x3f')]){_0x1651a9[_0xbd33('0x3d')][_0xbd33('0x31')](function(_0x4d61b5){_0x4ce9c7[_0xbd33('0x45')]('i.'+_0x4d61b5);});}else{_0x4ce9c7[_0xbd33('0x45')](_0xbd33('0x8c'),'unreadMessages');_0x4ce9c7[_0xbd33('0x45')](_0xbd33('0x9a'),_0xbd33('0x9b'));_0x4ce9c7[_0xbd33('0x45')]('a.mandatoryDisposition',_0xbd33('0x9c'));_0x4ce9c7[_0xbd33('0x45')](_0xbd33('0x9d'),_0xbd33('0x8e'));_0x4ce9c7[_0xbd33('0x45')](_0xbd33('0x9e'));_0x4ce9c7[_0xbd33('0x45')](_0xbd33('0x9f'),_0xbd33('0xa0'));_0x4ce9c7['field'](_0xbd33('0xa1'),_0xbd33('0xa2'));_0x4ce9c7[_0xbd33('0x45')]('c.email',_0xbd33('0xa3'));_0x4ce9c7[_0xbd33('0x45')]('c.phone','Contact.phone');_0x4ce9c7[_0xbd33('0x45')]('c.mobile',_0xbd33('0xa4'));_0x4ce9c7['field'](_0xbd33('0xa5'),_0xbd33('0xa6'));_0x4ce9c7['field'](_0xbd33('0xa7'),_0xbd33('0xa8'));_0x4ce9c7['field']('o.internal',_0xbd33('0xa9'));_0x4ce9c7[_0xbd33('0x45')](_0xbd33('0xaa'),'TagIds');}if(_0x1651a9[_0xbd33('0x20')])_0x4ce9c7[_0xbd33('0x20')](_0x1651a9['limit']);if(_0x1651a9[_0xbd33('0x22')])_0x4ce9c7[_0xbd33('0x22')](_0x1651a9[_0xbd33('0x22')]);return db['sequelize'][_0xbd33('0x3a')](_0x4ce9c7[_0xbd33('0x98')](),_0x203265);})[_0xbd33('0x28')](function(_0x3d34e5){if(_0x3d34e5['length']>0x0)_0x55062c[_0xbd33('0x77')](_0xbd33('0xab'),_[_0xbd33('0x2e')](_0x3d34e5,'id'));return db[_0xbd33('0x96')][_0xbd33('0x3a')](_0x55062c[_0xbd33('0x98')](),_0x203265)[_0xbd33('0x28')](function(_0x5bab2b){var _0x3089d8=_[_0xbd33('0xac')](_0x5bab2b,_0xbd33('0xad'));var _0x46e50b=[];_0x3d34e5[_0xbd33('0x31')](function(_0x18906f){_0x46e50b[_0xbd33('0x33')](updateWhatsappInteraction(_0x18906f,_0x20861f,_0x3089d8));});return BPromise['all'](_0x46e50b);});});})[_0xbd33('0x28')](function(_0x33ef7d){_0xf89c1a['rows']=_0x33ef7d;return _0xf89c1a;})[_0xbd33('0x28')](respondWithFilteredResult(_0x4701d6,_0x1651a9))[_0xbd33('0x34')](handleError(_0x4701d6,null));};exports[_0xbd33('0xae')]=function(_0x1c5c42,_0x11748f){var _0x3bc935={'raw':![],'where':{'id':_0x1c5c42[_0xbd33('0xaf')]['id']}},_0x183b4c={};_0x183b4c['model']=_[_0xbd33('0x3b')](db[_0xbd33('0x36')]['rawAttributes']);_0x183b4c[_0xbd33('0x3a')]=_[_0xbd33('0x3b')](_0x1c5c42[_0xbd33('0x3a')]);_0x183b4c[_0xbd33('0x3c')]=_['intersection'](_0x183b4c[_0xbd33('0x39')],_0x183b4c[_0xbd33('0x3a')]);_0x3bc935[_0xbd33('0x3d')]=_[_0xbd33('0x3e')](_0x183b4c[_0xbd33('0x39')],qs['fields'](_0x1c5c42[_0xbd33('0x3a')][_0xbd33('0x3f')]));_0x3bc935[_0xbd33('0x3d')]=_0x3bc935[_0xbd33('0x3d')][_0xbd33('0x97')]?_0x3bc935[_0xbd33('0x3d')]:_0x183b4c[_0xbd33('0x39')];if(_0x1c5c42[_0xbd33('0x3a')]['includeAll']){_0x3bc935[_0xbd33('0xb0')]=[{'all':!![]}];}_0x3bc935=_[_0xbd33('0xb1')]({},_0x3bc935,_0x1c5c42[_0xbd33('0xb2')]);return db[_0xbd33('0x36')][_0xbd33('0x5d')](_0x3bc935)[_0xbd33('0x28')](handleEntityNotFound(_0x11748f,null))[_0xbd33('0x28')](respondWithResult(_0x11748f,null))[_0xbd33('0x34')](handleError(_0x11748f,null));};exports['create']=function(_0x44aba7,_0x7c37c){return db[_0xbd33('0x36')][_0xbd33('0xb3')](_0x44aba7['body'],{})[_0xbd33('0x28')](respondWithResult(_0x7c37c,0xc9))[_0xbd33('0x34')](handleError(_0x7c37c,null));};exports[_0xbd33('0x27')]=function(_0x46b3fa,_0x59e5b6){if(_0x46b3fa[_0xbd33('0x72')]['id']){delete _0x46b3fa['body']['id'];}return db[_0xbd33('0x36')][_0xbd33('0x5d')]({'where':{'id':_0x46b3fa[_0xbd33('0xaf')]['id']}})[_0xbd33('0x28')](handleEntityNotFound(_0x59e5b6,null))[_0xbd33('0x28')](saveUpdates(_0x46b3fa[_0xbd33('0x72')],null))['then'](respondWithResult(_0x59e5b6,null))[_0xbd33('0x34')](handleError(_0x59e5b6,null));};exports[_0xbd33('0x29')]=function(_0x56ced0,_0x3c3c98){return db['WhatsappInteraction']['find']({'where':{'id':_0x56ced0[_0xbd33('0xaf')]['id']}})[_0xbd33('0x28')](handleEntityNotFound(_0x3c3c98,null))[_0xbd33('0x28')](removeEntity(_0x3c3c98,null))[_0xbd33('0x34')](handleError(_0x3c3c98,null));};exports[_0xbd33('0xb4')]=function(_0x19b7b1,_0x101389){return db[_0xbd33('0x36')][_0xbd33('0xb4')]()['then'](respondWithResult(_0x101389,null))[_0xbd33('0x34')](handleError(_0x101389,null));};exports[_0xbd33('0xb5')]=function(_0x44aba5,_0x2166af,_0x364684){return db['WhatsappMessage'][_0xbd33('0x5d')]({'where':{'id':_0x44aba5[_0xbd33('0xaf')]['id']}})[_0xbd33('0x28')](handleEntityNotFound(_0x2166af,null))['then'](function(_0x435ecf){if(_0x435ecf){return _0x435ecf[_0xbd33('0xb5')](_0x44aba5[_0xbd33('0x72')][_0xbd33('0xb6')],_[_0xbd33('0xb7')](_0x44aba5[_0xbd33('0x72')],['ids','id'])||{});}})[_0xbd33('0x28')](respondWithResult(_0x2166af,null))[_0xbd33('0x34')](handleError(_0x2166af,null));};exports[_0xbd33('0xb8')]=function(_0x90912f,_0x43a825,_0x45b1cb){var _0x4e67be={'raw':![],'where':{}};var _0x3a0195={};var _0x1a88f6={'count':0x0,'rows':[]};return db[_0xbd33('0x36')]['findOne']({'where':{'id':_0x90912f[_0xbd33('0xaf')]['id']}})[_0xbd33('0x28')](handleEntityNotFound(_0x43a825,null))[_0xbd33('0x28')](function(_0x2f7853){if(_0x2f7853){_0x3a0195[_0xbd33('0x39')]=_[_0xbd33('0x3b')](db[_0xbd33('0xb9')][_0xbd33('0xba')]);_0x3a0195[_0xbd33('0x3a')]=_[_0xbd33('0x3b')](_0x90912f[_0xbd33('0x3a')]);_0x3a0195[_0xbd33('0x3c')]=_[_0xbd33('0x3e')](_0x3a0195['model'],_0x3a0195[_0xbd33('0x3a')]);_0x4e67be[_0xbd33('0x3d')]=_[_0xbd33('0x3e')](_0x3a0195[_0xbd33('0x39')],qs['fields'](_0x90912f['query'][_0xbd33('0x3f')]));_0x4e67be['attributes']=_0x4e67be[_0xbd33('0x3d')][_0xbd33('0x97')]?_0x4e67be[_0xbd33('0x3d')]:_0x3a0195['model'];if(!_0x90912f[_0xbd33('0x3a')][_0xbd33('0x40')]('nolimit')){_0x4e67be[_0xbd33('0x20')]=qs['limit'](_0x90912f[_0xbd33('0x3a')][_0xbd33('0x20')]);_0x4e67be[_0xbd33('0x22')]=qs[_0xbd33('0x22')](_0x90912f[_0xbd33('0x3a')]['offset']);}_0x4e67be[_0xbd33('0x42')]=qs[_0xbd33('0x43')](_0x90912f['query'][_0xbd33('0x43')]);_0x4e67be[_0xbd33('0x77')]=qs['filters'](_[_0xbd33('0x44')](_0x90912f[_0xbd33('0x3a')],_0x3a0195[_0xbd33('0x3c')]));_0x4e67be[_0xbd33('0x77')][_0xbd33('0xad')]=_0x2f7853['id'];if(_0x90912f['query'][_0xbd33('0x82')]){_0x4e67be[_0xbd33('0x77')]=_[_0xbd33('0xb1')](_0x4e67be[_0xbd33('0x77')],{'$or':_['map'](_0x4e67be[_0xbd33('0x3d')],function(_0x56ec0d){var _0x160715={};_0x160715[_0x56ec0d]={'$like':'%'+_0x90912f[_0xbd33('0x3a')][_0xbd33('0x82')]+'%'};return _0x160715;})});}if(_0x90912f[_0xbd33('0x3a')][_0xbd33('0x7c')]){var _0x4e27cc=_0x90912f[_0xbd33('0x3a')][_0xbd33('0x7c')][_0xbd33('0x64')](',');var _0x2d2cb2={};_0x2d2cb2[_0x4e27cc[0x0]]={'$gte':moment(_0x4e27cc[0x1])[_0xbd33('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4e67be[_0xbd33('0x77')]=_[_0xbd33('0xb1')](_0x4e67be['where'],_0x2d2cb2);}_0x4e67be=_[_0xbd33('0xb1')]({},_0x4e67be,_0x90912f['options']);return db[_0xbd33('0xb9')]['count']({'where':_0x4e67be['where']})[_0xbd33('0x28')](function(_0x1d520e){_0x1a88f6[_0xbd33('0x21')]=_0x1d520e;if(_0x90912f['query'][_0xbd33('0xbc')]){_0x4e67be[_0xbd33('0xb0')]=[{'all':!![]}];}return db[_0xbd33('0xb9')][_0xbd33('0xbd')](_0x4e67be);})[_0xbd33('0x28')](function(_0x21d83e){_0x1a88f6['rows']=_0x21d83e;return _0x1a88f6;});}})['then'](respondWithFilteredResult(_0x43a825,_0x4e67be))[_0xbd33('0x34')](handleError(_0x43a825,null));};exports[_0xbd33('0xbe')]=function(_0x3735ae,_0x51761c,_0xfdc2d9){return db[_0xbd33('0x36')]['find']({'where':{'id':_0x3735ae[_0xbd33('0xaf')]['id']}})[_0xbd33('0x28')](handleEntityNotFound(_0x51761c,null))[_0xbd33('0x28')](function(_0x302c2a){if(_0x302c2a){return _0x302c2a[_0xbd33('0xbf')](_0x3735ae[_0xbd33('0x72')]['ids'],_[_0xbd33('0xb7')](_0x3735ae[_0xbd33('0x72')],[_0xbd33('0xb6'),'id'])||{})[_0xbd33('0xc0')](function(){return db[_0xbd33('0x6b')]['findAll']({'attributes':['id',_0xbd33('0x2c'),'color'],'where':{'id':_0x3735ae[_0xbd33('0x72')][_0xbd33('0xb6')]}});})[_0xbd33('0x28')](function(_0x33397a){socket[_0xbd33('0xc1')]('whatsappInteractionTags:save',{'id':Number(_0x3735ae[_0xbd33('0xaf')]['id']),'tags':_0x33397a||[]});return{'id':Number(_0x3735ae[_0xbd33('0xaf')]['id']),'tags':_0x33397a||[]};});}})['then'](respondWithResult(_0x51761c,null))[_0xbd33('0x34')](handleError(_0x51761c,null));};exports[_0xbd33('0xc2')]=function(_0x21419c,_0x5093b9,_0x5410ad){return db['WhatsappInteraction'][_0xbd33('0x5d')]({'where':{'id':_0x21419c[_0xbd33('0xaf')]['id']}})[_0xbd33('0x28')](handleEntityNotFound(_0x5093b9,null))['then'](function(_0x52b164){if(_0x52b164){return _0x52b164[_0xbd33('0xc2')](_0x21419c[_0xbd33('0x3a')][_0xbd33('0xb6')]);}})[_0xbd33('0x28')](respondWithStatusCode(_0x5093b9,null))[_0xbd33('0x34')](handleError(_0x5093b9,null));};exports['download']=function(_0x5068de,_0x39012a){var _0xabdb47=moment()[_0xbd33('0xc3')]()['toString']();var _0xc2cddc=path[_0xbd33('0xc4')](config[_0xbd33('0xc5')],'server',_0xbd33('0xc6'),_0xbd33('0xc7'));var _0x3aba6a=path['join'](config[_0xbd33('0xc5')],_0xbd33('0xc8'),'files',_0xbd33('0xc9'));var _0x576a84=path['join'](_0xc2cddc,_0xabdb47);var _0x320f94=util['format']('transcript-%d-%s.zip',_0x5068de[_0xbd33('0xaf')]['id'],_0xabdb47);var _0x135aee=path['join'](_0xc2cddc,_0x320f94);var _0x482a5c=[];_0x482a5c[_0xbd33('0x33')]({'model':db[_0xbd33('0x6d')],'as':_0xbd33('0x6d'),'attributes':['id',_0xbd33('0x2f')],'raw':!![]});_0x482a5c[_0xbd33('0x33')]({'model':db[_0xbd33('0xca')],'as':_0xbd33('0x62'),'attributes':['id',_0xbd33('0xcb'),_0xbd33('0xcc')],'raw':!![]});if(_0x5068de[_0xbd33('0x3a')][_0xbd33('0xc9')]){_0x482a5c['push']({'model':db[_0xbd33('0xcd')],'as':'Attachment','raw':!![]});}var _0x50e7c5=[{'model':db['WhatsappMessage'],'as':_0xbd33('0xce'),'attributes':['id',_0xbd33('0x72'),_0xbd33('0x7a'),_0xbd33('0xcf'),_0xbd33('0xd0'),_0xbd33('0x80')],'include':_0x482a5c}];_0x50e7c5[_0xbd33('0x33')]({'model':db[_0xbd33('0xd1')],'as':_0xbd33('0xd2'),'attributes':['id',_0xbd33('0x2c')]});_0x50e7c5[_0xbd33('0x33')]({'model':db[_0xbd33('0x6d')],'as':_0xbd33('0xd3'),'attributes':['id',_0xbd33('0x2f')]});return db[_0xbd33('0x36')]['find']({'where':{'id':_0x5068de[_0xbd33('0xaf')]['id']},'include':_0x50e7c5})['then'](handleEntityNotFound(_0x39012a,null))[_0xbd33('0x28')](function(_0x20ede1){if(_0x20ede1){var _0x2f4f94=_0x20ede1['get']({'plain':!![]});fs[_0xbd33('0xd4')](_0x576a84);var _0x2bb8b0={'channel':_0xbd33('0xd5'),'account':_0x2f4f94[_0xbd33('0xd2')][_0xbd33('0x2c')],'agent':_0x2f4f94['Owner']?_0x2f4f94['Owner']['fullname']:_0xbd33('0xd6'),'createdAt':moment(_0x2f4f94[_0xbd33('0x7a')])[_0xbd33('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbd33('0x98')](),'closedAt':_0x2f4f94[_0xbd33('0xd7')]?moment(_0x2f4f94[_0xbd33('0xd8')])[_0xbd33('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbd33('0x98')]():'','disposition':_0x2f4f94[_0xbd33('0xd9')],'messages':_(_0x2f4f94[_0xbd33('0xce')])[_0xbd33('0x82')]({'secret':![]})[_0xbd33('0x2e')](function(_0x1149e3){if(_0x1149e3[_0xbd33('0xcd')]){var _0xd6af9e=path[_0xbd33('0xc4')](_0x3aba6a,_0x1149e3[_0xbd33('0xcd')][_0xbd33('0xda')]);if(fs[_0xbd33('0xdb')](_0xd6af9e)){fs[_0xbd33('0xdc')](_0xd6af9e)['pipe'](fs[_0xbd33('0xdd')](path[_0xbd33('0xc4')](_0x576a84,_0x1149e3[_0xbd33('0xcd')][_0xbd33('0xda')])));}}return{'date':moment(_0x1149e3['createdAt'])[_0xbd33('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbd33('0x98')](),'sender':_0x1149e3['direction']===_0xbd33('0xde')?_0x1149e3[_0xbd33('0x6d')]?_0x1149e3['User'][_0xbd33('0x2f')]:_0xbd33('0xdf'):_0x1149e3[_0xbd33('0x62')]['firstName']+(_0x1149e3['Contact'][_0xbd33('0xcc')]?'\x20'+_0x1149e3[_0xbd33('0x62')][_0xbd33('0xcc')]:''),'body':_0x1149e3['Attachment']?_0x1149e3[_0xbd33('0xcd')][_0xbd33('0xda')]:_0x1149e3[_0xbd33('0x72')],'direction':_0x1149e3[_0xbd33('0xcf')]===_0xbd33('0xde')?'A':'C','secret':_0x1149e3[_0xbd33('0xd0')],'read':_0x1149e3[_0xbd33('0x80')],'attachment':_0x1149e3[_0xbd33('0xcd')]};})[_0xbd33('0x5e')]()};return ejs['renderFile'](path[_0xbd33('0xc4')](config[_0xbd33('0xc5')],'server',_0xbd33('0xe0'),_0xbd33('0xe1')),{'interaction':_0x2bb8b0})[_0xbd33('0x28')](function(_0x3da328){var _0xaf2973=path['join'](_0x576a84,'transcript-'+_0x2f4f94['id']+'-'+_0xabdb47+_0xbd33('0xe2'));var _0x53f6f5={'path':_0xaf2973,'channel':_0xbd33('0xd5'),'interactionId':_0x2f4f94['id']};return pdf[_0xbd33('0xe3')](_0x3da328,_0x53f6f5);})['then'](function(){return new BPromise(function(_0x2a065c,_0x509240){zipdir(_0x576a84,{'saveTo':_0x135aee},function(_0x35d35e,_0x12fec0){if(_0x35d35e)return _0x509240(_0x35d35e);return _0x2a065c(_0x12fec0);});})['then'](function(){return new BPromise(function(_0x4df5fc,_0x2d4e31){rimraf(_0x576a84,function(_0xe106bb){if(_0xe106bb)_0x2d4e31(_0xe106bb);return _0x4df5fc();});});})[_0xbd33('0x28')](function(){return _0x39012a[_0xbd33('0xe4')](_0x135aee,_0x320f94,function(_0x39f686){if(_0x39f686){console[_0xbd33('0xe5')]('err',_0x39f686);}else{fs['unlinkSync'](_0x135aee);}});});});}else{return _0x39012a[_0xbd33('0x2a')](0xc8);}})['catch'](handleError(_0x39012a,null));}; \ No newline at end of file +var _0x4be8=['ContactId','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','text','start','some','compact','isEmpty','WhatsappAccountId','where','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','show','params','keys','rawAttributes','includeAll','include','options','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','format','findAll','rows','addTags','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','Attachment','direction','WhatsappAccount','Account','Owner','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','lastName','Contact','secret','renderFile','views','downloadInteraction.ejs','transcript-','Whatsapp','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./whatsappInteraction.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','apply','reject','update','then','destroy','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','WhatsappInteraction','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?'];(function(_0xbda849,_0x2dcb1a){var _0x2d3e9d=function(_0x2c8f10){while(--_0x2c8f10){_0xbda849['push'](_0xbda849['shift']());}};_0x2d3e9d(++_0x2dcb1a);}(_0x4be8,0x17f));var _0x84be=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x4be8[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0x84be('0x0'));var rimraf=require(_0x84be('0x1'));var zipdir=require(_0x84be('0x2'));var jsonpatch=require(_0x84be('0x3'));var rp=require(_0x84be('0x4'));var moment=require(_0x84be('0x5'));var BPromise=require(_0x84be('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x84be('0x7'));var sox=require(_0x84be('0x8'));var csv=require(_0x84be('0x9'));var ejs=require(_0x84be('0xa'));var fs=require('fs');var fs_extra=require(_0x84be('0xb'));var _=require(_0x84be('0xc'));var squel=require('squel');var crypto=require(_0x84be('0xd'));var jsforce=require(_0x84be('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84be('0x9'));var querystring=require(_0x84be('0xf'));var Papa=require('papaparse');var Redis=require(_0x84be('0x10'));var authService=require(_0x84be('0x11'));var qs=require(_0x84be('0x12'));var as=require(_0x84be('0x13'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x84be('0x14'));var logger=require(_0x84be('0x15'))(_0x84be('0x16'));var utils=require('../../config/utils');var config=require(_0x84be('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x84be('0x18'))['db'];config[_0x84be('0x19')]=_[_0x84be('0x1a')](config[_0x84be('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x84be('0x1b'))[_0x84be('0x1c')](socket);function respondWithStatusCode(_0x22d557,_0x87aa41){_0x87aa41=_0x87aa41||0xcc;return function(_0x52b0bc){if(_0x52b0bc){return _0x22d557[_0x84be('0x1d')](_0x87aa41);}return _0x22d557[_0x84be('0x1e')](_0x87aa41)[_0x84be('0x1f')]();};}function respondWithResult(_0x982ebd,_0x3c965d){_0x3c965d=_0x3c965d||0xc8;return function(_0x3ef933){if(_0x3ef933){return _0x982ebd[_0x84be('0x1e')](_0x3c965d)['json'](_0x3ef933);}};}function respondWithFilteredResult(_0x5d0916,_0x1854c4){return function(_0x56abf7){if(_0x56abf7){var _0x324b41=typeof _0x1854c4['offset']===_0x84be('0x20')&&typeof _0x1854c4['limit']===_0x84be('0x20');var _0x45edc8=_0x56abf7[_0x84be('0x21')];var _0x1d1e9a=_0x324b41?0x0:_0x1854c4[_0x84be('0x22')];var _0x3b57a6=_0x324b41?_0x56abf7['count']:_0x1854c4['offset']+_0x1854c4[_0x84be('0x23')];var _0x28f53b;if(_0x3b57a6>=_0x45edc8){_0x3b57a6=_0x45edc8;_0x28f53b=0xc8;}else{_0x28f53b=0xce;}_0x5d0916['status'](_0x28f53b);return _0x5d0916[_0x84be('0x24')]('Content-Range',_0x1d1e9a+'-'+_0x3b57a6+'/'+_0x45edc8)['json'](_0x56abf7);}return null;};}function patchUpdates(_0x6f7ce){return function(_0x247b1f){try{jsonpatch[_0x84be('0x25')](_0x247b1f,_0x6f7ce,!![]);}catch(_0x1939b4){return BPromise[_0x84be('0x26')](_0x1939b4);}return _0x247b1f['save']();};}function saveUpdates(_0x135f95,_0x265ed6){return function(_0x54e51){if(_0x54e51){return _0x54e51[_0x84be('0x27')](_0x135f95)[_0x84be('0x28')](function(_0x252fe8){return _0x252fe8;});}return null;};}function removeEntity(_0x5691fe,_0x1c5e0f){return function(_0xea2d9b){if(_0xea2d9b){return _0xea2d9b[_0x84be('0x29')]()['then'](function(){_0x5691fe['status'](0xcc)[_0x84be('0x1f')]();});}};}function handleEntityNotFound(_0x53f05,_0x9eccc9){return function(_0x4ea7a9){if(!_0x4ea7a9){_0x53f05[_0x84be('0x1d')](0x194);}return _0x4ea7a9;};}function handleError(_0x1ac393,_0x2f7f8d){_0x2f7f8d=_0x2f7f8d||0x1f4;return function(_0x3d353c){logger['error'](_0x3d353c[_0x84be('0x2a')]);if(_0x3d353c[_0x84be('0x2b')]){delete _0x3d353c['name'];}_0x1ac393[_0x84be('0x1e')](_0x2f7f8d)['send'](_0x3d353c);};}function getInteractionUsers(_0x67943b,_0xc97501){return new BPromise(function(_0xa2f281,_0x4f2659){try{if(_0xc97501[_0x67943b['id']]){_0x67943b[_0x84be('0x2c')]=_[_0x84be('0x2d')](_0xc97501[_0x67943b['id']],function(_0x5ac49f){return{'id':_0x5ac49f['id'],'fullname':_0x5ac49f[_0x84be('0x2e')]};});}}catch(_0x327f23){_0x4f2659(_0x327f23);}_0xa2f281(_0x67943b);});}function getInteractionTags(_0x55b691,_0x1e7438){return new BPromise(function(_0x4233d3,_0x63abfa){try{if(_0x55b691[_0x84be('0x2f')]){_0x55b691[_0x84be('0x30')]=[];_0x55b691[_0x84be('0x2f')][_0x84be('0x31')](',')[_0x84be('0x32')](function(_0x2a89f8){_0x55b691[_0x84be('0x30')][_0x84be('0x33')](_0x1e7438[_0x2a89f8]);});}delete _0x55b691[_0x84be('0x2f')];}catch(_0x8a2a39){_0x63abfa(_0x8a2a39);}_0x4233d3(_0x55b691);});}function updateWhatsappInteraction(_0x24b981,_0x383c08,_0xa3b9a){return new BPromise(function(_0x347e71,_0xb40ffc){return getInteractionUsers(_0x24b981,_0xa3b9a)[_0x84be('0x28')](function(_0x40c6df){return getInteractionTags(_0x40c6df,_0x383c08);})[_0x84be('0x28')](function(_0x396b96){_0x347e71(_0x396b96);})[_0x84be('0x34')](function(_0x410b27){_0xb40ffc(_0x410b27);});});}exports[_0x84be('0x35')]=function(_0x1eaaf2,_0x4c927d){var _0x1fa2f5={},_0x364693={},_0xe55200={'count':0x0,'rows':[]};var _0x1ccbcc=_['map'](db[_0x84be('0x36')]['rawAttributes'],function(_0x4d913d){return{'name':_0x4d913d[_0x84be('0x37')],'type':_0x4d913d[_0x84be('0x38')][_0x84be('0x39')]};});_0x364693['model']=_[_0x84be('0x2d')](_0x1ccbcc,_0x84be('0x2b'));_0x364693[_0x84be('0x3a')]=_['keys'](_0x1eaaf2['query']);_0x364693[_0x84be('0x3b')]=_[_0x84be('0x3c')](_0x364693[_0x84be('0x3d')],_0x364693[_0x84be('0x3a')]);_0x1fa2f5[_0x84be('0x3e')]=_[_0x84be('0x3c')](_0x364693['model'],qs[_0x84be('0x3f')](_0x1eaaf2['query'][_0x84be('0x3f')]));_0x1fa2f5[_0x84be('0x3e')]=_0x1fa2f5[_0x84be('0x3e')]['length']?_0x1fa2f5[_0x84be('0x3e')]:_0x364693['model'];if(!_0x1eaaf2['query'][_0x84be('0x40')](_0x84be('0x41'))){_0x1fa2f5['limit']=qs[_0x84be('0x23')](_0x1eaaf2[_0x84be('0x3a')][_0x84be('0x23')]);_0x1fa2f5['offset']=qs['offset'](_0x1eaaf2['query']['offset']);}_0x1fa2f5[_0x84be('0x42')]=qs[_0x84be('0x43')](_0x1eaaf2[_0x84be('0x3a')][_0x84be('0x43')]);_0x1fa2f5['where']=qs[_0x84be('0x3b')](_[_0x84be('0x44')](_0x1eaaf2[_0x84be('0x3a')],_0x364693[_0x84be('0x3b')]),_0x1ccbcc);var _0x7aaa7=[];var _0x2d3596=squel[_0x84be('0x45')]()[_0x84be('0x46')]('id')['field'](_0x84be('0x2b'))[_0x84be('0x46')](_0x84be('0x47'))[_0x84be('0x48')](_0x84be('0x49'));var _0x1c7808=squel['select']()[_0x84be('0x46')]('u.id')[_0x84be('0x46')](_0x84be('0x4a'))['field'](_0x84be('0x4b'))[_0x84be('0x48')](_0x84be('0x4c'),'ui')[_0x84be('0x4d')](_0x84be('0x4e'),'u',_0x84be('0x4f'));var _0x422dc0=squel[_0x84be('0x45')]()['from'](_0x84be('0x50'),'i')['left_join']('cm_contacts','c',_0x84be('0x51'))['left_join']('users','o',_0x84be('0x52'))['left_join']('whatsapp_accounts','a',_0x84be('0x53'))[_0x84be('0x4d')]('whatsapp_messages','me',_0x84be('0x54'))[_0x84be('0x4d')](_0x84be('0x55'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x84be('0x4d')](_0x84be('0x49'),'t',_0x84be('0x56'));var _0x2d4790=squel[_0x84be('0x57')]();var _0x3114d1=[];var _0x3cd50f=squel[_0x84be('0x57')]();var _0x380eca;if(_0x1eaaf2[_0x84be('0x3a')][_0x84be('0x58')]){_0x380eca=as['parseSearch'](_0x1eaaf2['query'][_0x84be('0x58')]);var _0x36bb24=_0x380eca[_0x84be('0x59')];for(var _0xb4ea6c=0x0;_0xb4ea6c<_0x380eca[_0x84be('0x5a')][_0x84be('0x5b')];_0xb4ea6c++){var _0x3495e0=_0x380eca[_0x84be('0x5a')][_0xb4ea6c];var _0xc11091='i';var _0x2c36a1=_[_0x84be('0x5c')](_0x1ccbcc,['name',_0x3495e0[_0x84be('0x46')]]);if(!_0x2c36a1){switch(_0x3495e0[_0x84be('0x46')]){case'unreadMessages':if(_0x3495e0[_0x84be('0x5d')]==0x1){_0x422dc0[_0x84be('0x5e')]('`'+_0x3495e0[_0x84be('0x46')]+'`\x20=\x200');}else{_0x422dc0[_0x84be('0x5e')]('`'+_0x3495e0[_0x84be('0x46')]+_0x84be('0x5f'));}break;case'Contact':if(_0x3495e0[_0x84be('0x60')]===_0x84be('0x61')){if(_0x3495e0[_0x84be('0x5d')][_0x84be('0x31')]('\x20')[_0x84be('0x5b')]>0x1){_0x2d4790[_0x36bb24](_0x84be('0x62'),qs[_0x84be('0x63')](_0x3495e0[_0x84be('0x5d')]),null);}else{var _0x54135c='%'+_0x3495e0[_0x84be('0x5d')]+'%';_0x2d4790[_0x36bb24](_0x84be('0x64'),_0x54135c,_0x54135c,_0x54135c);}}else{_0x2c36a1=_[_0x84be('0x5c')](_0x1ccbcc,[_0x84be('0x2b'),_0x84be('0x65')]);_0x3495e0['field']='ContactId';_0x32094b=as['buildExpression'](_0xc11091,_0x2c36a1[_0x84be('0x38')],_0x3495e0);_0x2d4790[_0x36bb24](_0x32094b['text'],_0x32094b[_0x84be('0x5d')]['start'],_0x32094b['value'][_0x84be('0x1f')]);}break;case _0x84be('0x66'):var _0x572064=_0x3495e0[_0x84be('0x5d')][_0x84be('0x31')](',')[_0x84be('0x2d')](function(_0x5d54ee){return Number(_0x5d54ee);});_0x572064['forEach'](function(_0x22f2a5){_0x3cd50f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x22f2a5+',%');});_0x3114d1=_[_0x84be('0x67')](_0x3114d1,_0x572064);break;case _0x84be('0x68'):if(_0x3495e0[_0x84be('0x60')]===_0x84be('0x61')){_0x2d4790[_0x36bb24](_0x84be('0x69'),'%'+_0x3495e0[_0x84be('0x5d')]+'%',null);}else{_0x2c36a1=_[_0x84be('0x5c')](_0x1ccbcc,[_0x84be('0x2b'),_0x84be('0x6a')]);_0x3495e0[_0x84be('0x46')]=_0x84be('0x6a');_0x32094b=as[_0x84be('0x6b')](_0xc11091,_0x2c36a1['type'],_0x3495e0);_0x2d4790[_0x36bb24](_0x32094b['text'],_0x32094b['value']['start'],_0x32094b[_0x84be('0x5d')][_0x84be('0x1f')]);}break;case _0x84be('0x6c'):_0x32094b=as['buildExpression']('me',null,_0x3495e0);_0x2d4790[_0x36bb24](_0x32094b[_0x84be('0x6d')],_0x32094b[_0x84be('0x5d')][_0x84be('0x6e')],_0x32094b[_0x84be('0x5d')][_0x84be('0x1f')]);break;}}else{var _0x32094b=as[_0x84be('0x6b')](_0xc11091,_0x2c36a1[_0x84be('0x38')],_0x3495e0);_0x2d4790[_0x36bb24](_0x32094b[_0x84be('0x6d')],_0x32094b[_0x84be('0x5d')]['start'],_0x32094b[_0x84be('0x5d')]['end']);}}}else{var _0x54c04d=_(_0x1eaaf2['query'])['keys']()[_0x84be('0x2d')](function(_0x17f3e4){return _[_0x84be('0x6f')](_0x1ccbcc,[_0x84be('0x2b'),_0x17f3e4])?_0x17f3e4:undefined;})[_0x84be('0x70')]()[_0x84be('0x5d')]();if(!_[_0x84be('0x71')](_0x54c04d)){_0x54c04d['forEach'](function(_0x3b5bff){if(_0x3b5bff===_0x84be('0x72')){_0x422dc0[_0x84be('0x73')]('i.WhatsappAccountId\x20IN\x20?',[][_0x84be('0x74')](_0x1eaaf2['query'][_0x3b5bff]));}else if(_0x3b5bff===_0x84be('0x75')){var _0x42a93d=JSON[_0x84be('0x76')](_0x1eaaf2['query'][_0x3b5bff])[_0x84be('0x77')];var _0x2d2314=JSON['parse'](_0x1eaaf2['query'][_0x3b5bff])[_0x84be('0x78')];_0x422dc0['where'](_0x84be('0x79'),_0x42a93d,_0x2d2314);}else{if(_0x1eaaf2[_0x84be('0x3a')][_0x3b5bff]===_0x84be('0x7a')){_0x422dc0[_0x84be('0x73')]('i.'+_0x3b5bff+_0x84be('0x7b'));}else{_0x422dc0[_0x84be('0x73')]('i.'+_0x3b5bff+_0x84be('0x7c'),_0x1eaaf2['query'][_0x3b5bff]);}}});}if(_0x1eaaf2[_0x84be('0x3a')][_0x84be('0x7d')]){if(_0x1eaaf2[_0x84be('0x3a')]['read']==0x1){_0x422dc0[_0x84be('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x422dc0[_0x84be('0x5e')](_0x84be('0x7e'));}}if(_0x1eaaf2['query'][_0x84be('0x7f')]){_0x3114d1=_[_0x84be('0x80')](_0x1eaaf2[_0x84be('0x3a')]['tag'])?_0x1eaaf2[_0x84be('0x3a')][_0x84be('0x7f')]:new Array(_0x1eaaf2['query']['tag']);_0x3114d1[_0x84be('0x32')](function(_0x28357d){_0x3cd50f['or'](_0x84be('0x81'),'%,'+_0x28357d+',%');});}if(_0x1eaaf2[_0x84be('0x3a')][_0x84be('0x82')]){var _0x1fd165=_0x1eaaf2[_0x84be('0x3a')][_0x84be('0x82')][_0x84be('0x83')]('\x5c','\x5c\x5c')[_0x84be('0x83')](/'/g,'\x27\x27');if(qs[_0x84be('0x84')](_0x1fd165)){_0x2d4790['or'](_0x84be('0x85'),_0x1fd165+'%')['or']('i.phone\x20LIKE\x20?',_0x1fd165+'%');}else{_0x2d4790['or'](_0x84be('0x86'),qs[_0x84be('0x63')](_0x1fd165))['or'](_0x84be('0x87'),_0x1fd165+'%');}}}_0x422dc0[_0x84be('0x73')](_0x2d4790);_0x422dc0[_0x84be('0x88')](_0x84be('0x89'));var _0x1ad1c5={'type':db[_0x84be('0x8a')][_0x84be('0x8b')][_0x84be('0x8c')],'raw':!![]};var _0x2889e3=_0x422dc0[_0x84be('0x8d')]();_0x2889e3[_0x84be('0x46')](_0x84be('0x89'));_0x2889e3[_0x84be('0x46')](_0x84be('0x8e'),_0x84be('0x8f'));if(_0x1fa2f5[_0x84be('0x42')]){_0x1fa2f5[_0x84be('0x42')]['forEach'](function(_0xe07b5f){var _0x34b1dd=_0xe07b5f[0x0]===_0x84be('0x90')?_0xe07b5f[0x0]:'i.'+_0xe07b5f[0x0];_0x422dc0['order'](_0x34b1dd,_0xe07b5f[0x1]===_0x84be('0x91')?![]:!![]);});}if(!_[_0x84be('0x71')](_0x3114d1)){_0x422dc0[_0x84be('0x5e')](_0x3cd50f);_0x2889e3['where'](_0x84be('0x92'),_0x3114d1);}BPromise[_0x84be('0x93')]()['then'](function(){if(!_0x380eca){if(_0x1eaaf2[_0x84be('0x3a')][_0x84be('0x72')])return;_0x2889e3['where'](_0x84be('0x94'));_0x422dc0[_0x84be('0x73')](_0x84be('0x94'));return;}if(_0x1eaaf2[_0x84be('0x95')][_0x84be('0x96')]!==_0x84be('0x97'))return;return _0x1eaaf2[_0x84be('0x95')][_0x84be('0x98')]({'attributes':['id'],'raw':!![]})[_0x84be('0x28')](function(_0x19e3d4){if(_[_0x84be('0x71')](_0x19e3d4)){_0x2889e3[_0x84be('0x73')](_0x84be('0x99'));_0x422dc0[_0x84be('0x73')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x2889e3[_0x84be('0x73')](_0x84be('0x9a'),_[_0x84be('0x2d')](_0x19e3d4,'id'));_0x422dc0['where'](_0x84be('0x9a'),_[_0x84be('0x2d')](_0x19e3d4,'id'));}});})['then'](function(){if(_0x1eaaf2[_0x84be('0x95')][_0x84be('0x96')]===_0x84be('0x97')&&!_0x380eca&&!_0x1eaaf2['query'][_0x84be('0x72')])return[];return db[_0x84be('0x9b')][_0x84be('0x3a')](_0x2889e3[_0x84be('0x9c')](),_0x1ad1c5);})[_0x84be('0x28')](function(_0x202828){_0xe55200[_0x84be('0x21')]=_0x202828['length'];if(_0xe55200[_0x84be('0x21')]===0x0)return[];return db[_0x84be('0x9b')][_0x84be('0x3a')](_0x2d3596[_0x84be('0x9c')](),_0x1ad1c5)[_0x84be('0x28')](function(_0x4df180){_0x7aaa7=_[_0x84be('0x9d')](_0x4df180,'id');_0x1ad1c5=_[_0x84be('0x9e')](_0x1ad1c5,{'model':db[_0x84be('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1eaaf2[_0x84be('0x3a')][_0x84be('0x3f')]){_0x1fa2f5[_0x84be('0x3e')]['forEach'](function(_0x38cfcd){_0x422dc0['field']('i.'+_0x38cfcd);});}else{_0x422dc0[_0x84be('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x84be('0x8f'));_0x422dc0[_0x84be('0x46')](_0x84be('0x9f'),_0x84be('0xa0'));_0x422dc0[_0x84be('0x46')]('a.mandatoryDisposition',_0x84be('0xa1'));_0x422dc0[_0x84be('0x46')](_0x84be('0xa2'),_0x84be('0x90'));_0x422dc0[_0x84be('0x46')]('i.*');_0x422dc0[_0x84be('0x46')](_0x84be('0xa3'),'Contact.firstName');_0x422dc0[_0x84be('0x46')](_0x84be('0xa4'),_0x84be('0xa5'));_0x422dc0[_0x84be('0x46')](_0x84be('0xa6'),_0x84be('0xa7'));_0x422dc0[_0x84be('0x46')](_0x84be('0xa8'),_0x84be('0xa9'));_0x422dc0[_0x84be('0x46')]('c.mobile',_0x84be('0xaa'));_0x422dc0[_0x84be('0x46')](_0x84be('0xab'),_0x84be('0xac'));_0x422dc0['field'](_0x84be('0xad'),_0x84be('0xae'));_0x422dc0['field'](_0x84be('0xaf'),_0x84be('0xb0'));_0x422dc0['field'](_0x84be('0xb1'),_0x84be('0x2f'));}if(_0x1fa2f5[_0x84be('0x23')])_0x422dc0[_0x84be('0x23')](_0x1fa2f5['limit']);if(_0x1fa2f5[_0x84be('0x22')])_0x422dc0[_0x84be('0x22')](_0x1fa2f5['offset']);return db['sequelize'][_0x84be('0x3a')](_0x422dc0[_0x84be('0x9c')](),_0x1ad1c5);})[_0x84be('0x28')](function(_0x349ef1){if(_0x349ef1['length']>0x0)_0x1c7808['where'](_0x84be('0xb2'),_[_0x84be('0x2d')](_0x349ef1,'id'));return db[_0x84be('0x9b')][_0x84be('0x3a')](_0x1c7808[_0x84be('0x9c')](),_0x1ad1c5)[_0x84be('0x28')](function(_0x360487){var _0x7bd429=_[_0x84be('0xb3')](_0x360487,_0x84be('0xb4'));var _0x405421=[];_0x349ef1[_0x84be('0x32')](function(_0x5cdda6){_0x405421[_0x84be('0x33')](updateWhatsappInteraction(_0x5cdda6,_0x7aaa7,_0x7bd429));});return BPromise[_0x84be('0xb5')](_0x405421);});});})['then'](function(_0x2765a0){_0xe55200['rows']=_0x2765a0;return _0xe55200;})[_0x84be('0x28')](respondWithFilteredResult(_0x4c927d,_0x1fa2f5))[_0x84be('0x34')](handleError(_0x4c927d,null));};exports[_0x84be('0xb6')]=function(_0x974894,_0x4d506e){var _0x1631fa={'raw':![],'where':{'id':_0x974894[_0x84be('0xb7')]['id']}},_0x15b2c5={};_0x15b2c5['model']=_[_0x84be('0xb8')](db[_0x84be('0x36')][_0x84be('0xb9')]);_0x15b2c5[_0x84be('0x3a')]=_[_0x84be('0xb8')](_0x974894[_0x84be('0x3a')]);_0x15b2c5[_0x84be('0x3b')]=_[_0x84be('0x3c')](_0x15b2c5[_0x84be('0x3d')],_0x15b2c5[_0x84be('0x3a')]);_0x1631fa['attributes']=_['intersection'](_0x15b2c5[_0x84be('0x3d')],qs[_0x84be('0x3f')](_0x974894['query']['fields']));_0x1631fa['attributes']=_0x1631fa['attributes'][_0x84be('0x5b')]?_0x1631fa[_0x84be('0x3e')]:_0x15b2c5[_0x84be('0x3d')];if(_0x974894[_0x84be('0x3a')][_0x84be('0xba')]){_0x1631fa[_0x84be('0xbb')]=[{'all':!![]}];}_0x1631fa=_['merge']({},_0x1631fa,_0x974894[_0x84be('0xbc')]);return db['WhatsappInteraction']['find'](_0x1631fa)[_0x84be('0x28')](handleEntityNotFound(_0x4d506e,null))[_0x84be('0x28')](respondWithResult(_0x4d506e,null))[_0x84be('0x34')](handleError(_0x4d506e,null));};exports[_0x84be('0xbd')]=function(_0x21d2ee,_0x58ad36){return db[_0x84be('0x36')]['create'](_0x21d2ee[_0x84be('0x6c')],{})[_0x84be('0x28')](respondWithResult(_0x58ad36,0xc9))[_0x84be('0x34')](handleError(_0x58ad36,null));};exports[_0x84be('0x27')]=function(_0x12bb56,_0x386386){if(_0x12bb56[_0x84be('0x6c')]['id']){delete _0x12bb56[_0x84be('0x6c')]['id'];}return db[_0x84be('0x36')][_0x84be('0x5c')]({'where':{'id':_0x12bb56['params']['id']}})[_0x84be('0x28')](handleEntityNotFound(_0x386386,null))['then'](saveUpdates(_0x12bb56[_0x84be('0x6c')],null))[_0x84be('0x28')](respondWithResult(_0x386386,null))[_0x84be('0x34')](handleError(_0x386386,null));};exports[_0x84be('0x29')]=function(_0x3d637e,_0x4242b2){return db[_0x84be('0x36')]['find']({'where':{'id':_0x3d637e[_0x84be('0xb7')]['id']}})['then'](handleEntityNotFound(_0x4242b2,null))['then'](removeEntity(_0x4242b2,null))[_0x84be('0x34')](handleError(_0x4242b2,null));};exports[_0x84be('0xbe')]=function(_0x2c9edb,_0x323825){return db[_0x84be('0x36')][_0x84be('0xbe')]()[_0x84be('0x28')](respondWithResult(_0x323825,null))[_0x84be('0x34')](handleError(_0x323825,null));};exports[_0x84be('0xbf')]=function(_0x4f2874,_0x29c5fa,_0x5bfee6){return db[_0x84be('0xc0')][_0x84be('0x5c')]({'where':{'id':_0x4f2874[_0x84be('0xb7')]['id']}})['then'](handleEntityNotFound(_0x29c5fa,null))[_0x84be('0x28')](function(_0x2400fb){if(_0x2400fb){return _0x2400fb[_0x84be('0xbf')](_0x4f2874[_0x84be('0x6c')][_0x84be('0xc1')],_[_0x84be('0xc2')](_0x4f2874[_0x84be('0x6c')],[_0x84be('0xc1'),'id'])||{});}})[_0x84be('0x28')](respondWithResult(_0x29c5fa,null))[_0x84be('0x34')](handleError(_0x29c5fa,null));};exports[_0x84be('0xc3')]=function(_0x44bf2c,_0x2b2944,_0x4b3576){var _0x2bb68d={'raw':![],'where':{}};var _0x20a119={};var _0x43dfa6={'count':0x0,'rows':[]};return db[_0x84be('0x36')][_0x84be('0xc4')]({'where':{'id':_0x44bf2c[_0x84be('0xb7')]['id']}})[_0x84be('0x28')](handleEntityNotFound(_0x2b2944,null))[_0x84be('0x28')](function(_0x4fe481){if(_0x4fe481){_0x20a119[_0x84be('0x3d')]=_['keys'](db[_0x84be('0xc0')][_0x84be('0xb9')]);_0x20a119[_0x84be('0x3a')]=_[_0x84be('0xb8')](_0x44bf2c[_0x84be('0x3a')]);_0x20a119[_0x84be('0x3b')]=_['intersection'](_0x20a119['model'],_0x20a119['query']);_0x2bb68d[_0x84be('0x3e')]=_['intersection'](_0x20a119[_0x84be('0x3d')],qs[_0x84be('0x3f')](_0x44bf2c[_0x84be('0x3a')][_0x84be('0x3f')]));_0x2bb68d[_0x84be('0x3e')]=_0x2bb68d[_0x84be('0x3e')][_0x84be('0x5b')]?_0x2bb68d[_0x84be('0x3e')]:_0x20a119[_0x84be('0x3d')];if(!_0x44bf2c[_0x84be('0x3a')][_0x84be('0x40')](_0x84be('0x41'))){_0x2bb68d[_0x84be('0x23')]=qs[_0x84be('0x23')](_0x44bf2c[_0x84be('0x3a')][_0x84be('0x23')]);_0x2bb68d[_0x84be('0x22')]=qs[_0x84be('0x22')](_0x44bf2c[_0x84be('0x3a')][_0x84be('0x22')]);}_0x2bb68d[_0x84be('0x42')]=qs[_0x84be('0x43')](_0x44bf2c[_0x84be('0x3a')][_0x84be('0x43')]);_0x2bb68d[_0x84be('0x73')]=qs['filters'](_[_0x84be('0x44')](_0x44bf2c[_0x84be('0x3a')],_0x20a119[_0x84be('0x3b')]));_0x2bb68d[_0x84be('0x73')]['WhatsappInteractionId']=_0x4fe481['id'];if(_0x44bf2c[_0x84be('0x3a')]['filter']){_0x2bb68d[_0x84be('0x73')]=_[_0x84be('0x9e')](_0x2bb68d[_0x84be('0x73')],{'$or':_[_0x84be('0x2d')](_0x2bb68d[_0x84be('0x3e')],function(_0xe4a3d1){var _0x17765c={};_0x17765c[_0xe4a3d1]={'$like':'%'+_0x44bf2c[_0x84be('0x3a')]['filter']+'%'};return _0x17765c;})});}if(_0x44bf2c[_0x84be('0x3a')][_0x84be('0x77')]){var _0x27f8d8=_0x44bf2c[_0x84be('0x3a')][_0x84be('0x77')]['split'](',');var _0x191fd3={};_0x191fd3[_0x27f8d8[0x0]]={'$gte':moment(_0x27f8d8[0x1])[_0x84be('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2bb68d[_0x84be('0x73')]=_[_0x84be('0x9e')](_0x2bb68d[_0x84be('0x73')],_0x191fd3);}_0x2bb68d=_['merge']({},_0x2bb68d,_0x44bf2c[_0x84be('0xbc')]);return db[_0x84be('0xc0')]['count']({'where':_0x2bb68d['where']})[_0x84be('0x28')](function(_0x3775e5){_0x43dfa6[_0x84be('0x21')]=_0x3775e5;if(_0x44bf2c['query'][_0x84be('0xba')]){_0x2bb68d[_0x84be('0xbb')]=[{'all':!![]}];}return db[_0x84be('0xc0')][_0x84be('0xc6')](_0x2bb68d);})['then'](function(_0x4bd21b){_0x43dfa6[_0x84be('0xc7')]=_0x4bd21b;return _0x43dfa6;});}})[_0x84be('0x28')](respondWithFilteredResult(_0x2b2944,_0x2bb68d))[_0x84be('0x34')](handleError(_0x2b2944,null));};exports[_0x84be('0xc8')]=function(_0x111fa9,_0x17824a,_0x5cdd9c){return db['WhatsappInteraction']['find']({'where':{'id':_0x111fa9[_0x84be('0xb7')]['id']}})['then'](handleEntityNotFound(_0x17824a,null))['then'](function(_0xfc4635){if(_0xfc4635){return _0xfc4635['setTags'](_0x111fa9['body'][_0x84be('0xc1')],_['omit'](_0x111fa9[_0x84be('0x6c')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x84be('0xc6')]({'attributes':['id',_0x84be('0x2b'),_0x84be('0x47')],'where':{'id':_0x111fa9[_0x84be('0x6c')]['ids']}});})['then'](function(_0x31c366){socket[_0x84be('0xc9')](_0x84be('0xca'),{'id':Number(_0x111fa9[_0x84be('0xb7')]['id']),'tags':_0x31c366||[]});return{'id':Number(_0x111fa9[_0x84be('0xb7')]['id']),'tags':_0x31c366||[]};});}})[_0x84be('0x28')](respondWithResult(_0x17824a,null))[_0x84be('0x34')](handleError(_0x17824a,null));};exports['removeTags']=function(_0x1d708e,_0xd03812,_0x1dacd8){return db[_0x84be('0x36')][_0x84be('0x5c')]({'where':{'id':_0x1d708e[_0x84be('0xb7')]['id']}})['then'](handleEntityNotFound(_0xd03812,null))['then'](function(_0x15d064){if(_0x15d064){return _0x15d064[_0x84be('0xcb')](_0x1d708e[_0x84be('0x3a')][_0x84be('0xc1')]);}})[_0x84be('0x28')](respondWithStatusCode(_0xd03812,null))[_0x84be('0x34')](handleError(_0xd03812,null));};exports[_0x84be('0xcc')]=function(_0x1f2e71,_0x51be85){var _0x5efc7c=moment()[_0x84be('0xcd')]()[_0x84be('0x9c')]();var _0x50aed8=path[_0x84be('0xce')](config[_0x84be('0xcf')],_0x84be('0xd0'),_0x84be('0xd1'),_0x84be('0xd2'));var _0x56620c=path['join'](config['root'],'server',_0x84be('0xd1'),_0x84be('0xd3'));var _0x3dc45e=path[_0x84be('0xce')](_0x50aed8,_0x5efc7c);var _0x11b18c=util[_0x84be('0xc5')](_0x84be('0xd4'),_0x1f2e71['params']['id'],_0x5efc7c);var _0x3df578=path[_0x84be('0xce')](_0x50aed8,_0x11b18c);var _0x8594af=[];_0x8594af['push']({'model':db['User'],'as':'User','attributes':['id',_0x84be('0x2e')],'raw':!![]});_0x8594af[_0x84be('0x33')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x84be('0xd5'),'lastName'],'raw':!![]});if(_0x1f2e71[_0x84be('0x3a')][_0x84be('0xd3')]){_0x8594af[_0x84be('0x33')]({'model':db[_0x84be('0xd6')],'as':_0x84be('0xd6'),'raw':!![]});}var _0x1fa2a8=[{'model':db[_0x84be('0xc0')],'as':'Messages','attributes':['id','body','createdAt',_0x84be('0xd7'),'secret',_0x84be('0x7d')],'include':_0x8594af}];_0x1fa2a8['push']({'model':db[_0x84be('0xd8')],'as':_0x84be('0xd9'),'attributes':['id',_0x84be('0x2b')]});_0x1fa2a8['push']({'model':db[_0x84be('0x68')],'as':_0x84be('0xda'),'attributes':['id',_0x84be('0x2e')]});return db[_0x84be('0x36')][_0x84be('0x5c')]({'where':{'id':_0x1f2e71[_0x84be('0xb7')]['id']},'include':_0x1fa2a8})[_0x84be('0x28')](handleEntityNotFound(_0x51be85,null))[_0x84be('0x28')](function(_0xdfd3cd){if(_0xdfd3cd){var _0x9ad726=_0xdfd3cd['get']({'plain':!![]});fs[_0x84be('0xdb')](_0x3dc45e);var _0x4291b1={'channel':'Whatsapp','account':_0x9ad726[_0x84be('0xd9')]['name'],'agent':_0x9ad726[_0x84be('0xda')]?_0x9ad726[_0x84be('0xda')]['fullname']:_0x84be('0xdc'),'createdAt':moment(_0x9ad726[_0x84be('0x75')])[_0x84be('0xc5')](_0x84be('0xdd'))['toString'](),'closedAt':_0x9ad726[_0x84be('0xde')]?moment(_0x9ad726['closedAt'])[_0x84be('0xc5')](_0x84be('0xdd'))[_0x84be('0x9c')]():'','disposition':_0x9ad726[_0x84be('0xdf')],'messages':_(_0x9ad726[_0x84be('0xe0')])[_0x84be('0x82')]({'secret':![]})[_0x84be('0x2d')](function(_0x4b5588){if(_0x4b5588[_0x84be('0xd6')]){var _0xcdbe4f=path[_0x84be('0xce')](_0x56620c,_0x4b5588[_0x84be('0xd6')]['basename']);if(fs[_0x84be('0xe1')](_0xcdbe4f)){fs[_0x84be('0xe2')](_0xcdbe4f)[_0x84be('0xe3')](fs[_0x84be('0xe4')](path[_0x84be('0xce')](_0x3dc45e,_0x4b5588['Attachment'][_0x84be('0xe5')])));}}return{'date':moment(_0x4b5588[_0x84be('0x75')])[_0x84be('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')[_0x84be('0x9c')](),'sender':_0x4b5588['direction']===_0x84be('0xe6')?_0x4b5588[_0x84be('0x68')]?_0x4b5588[_0x84be('0x68')]['fullname']:_0x84be('0xe7'):_0x4b5588['Contact']['firstName']+(_0x4b5588['Contact'][_0x84be('0xe8')]?'\x20'+_0x4b5588[_0x84be('0xe9')][_0x84be('0xe8')]:''),'body':_0x4b5588[_0x84be('0xd6')]?_0x4b5588[_0x84be('0xd6')][_0x84be('0xe5')]:_0x4b5588[_0x84be('0x6c')],'direction':_0x4b5588[_0x84be('0xd7')]===_0x84be('0xe6')?'A':'C','secret':_0x4b5588[_0x84be('0xea')],'read':_0x4b5588[_0x84be('0x7d')],'attachment':_0x4b5588['Attachment']};})[_0x84be('0x5d')]()};return ejs[_0x84be('0xeb')](path['join'](config[_0x84be('0xcf')],_0x84be('0xd0'),_0x84be('0xec'),_0x84be('0xed')),{'interaction':_0x4291b1})[_0x84be('0x28')](function(_0x340292){var _0x3cdbc6=path[_0x84be('0xce')](_0x3dc45e,_0x84be('0xee')+_0x9ad726['id']+'-'+_0x5efc7c+'.pdf');var _0x26a156={'path':_0x3cdbc6,'channel':_0x84be('0xef'),'interactionId':_0x9ad726['id']};return pdf['createPdfFromHTML'](_0x340292,_0x26a156);})['then'](function(){return new BPromise(function(_0x715673,_0xef92f6){zipdir(_0x3dc45e,{'saveTo':_0x3df578},function(_0x2a993d,_0x325d28){if(_0x2a993d)return _0xef92f6(_0x2a993d);return _0x715673(_0x325d28);});})[_0x84be('0x28')](function(){return new BPromise(function(_0x28b3f4,_0x449001){rimraf(_0x3dc45e,function(_0x5e2c01){if(_0x5e2c01)_0x449001(_0x5e2c01);return _0x28b3f4();});});})[_0x84be('0x28')](function(){return _0x51be85[_0x84be('0xcc')](_0x3df578,_0x11b18c,function(_0x282eb8){if(_0x282eb8){console[_0x84be('0xf0')](_0x84be('0xf1'),_0x282eb8);}else{fs['unlinkSync'](_0x3df578);}});});});}else{return _0x51be85[_0x84be('0x1d')](0xc8);}})[_0x84be('0x34')](handleError(_0x51be85,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 38a6a2a..04bbf76 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 _0xca2b=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','then','setDataValue','unreadMessages'];(function(_0x5d58d5,_0x32e523){var _0x11a51d=function(_0x1f43d5){while(--_0x1f43d5){_0x5d58d5['push'](_0x5d58d5['shift']());}};_0x11a51d(++_0x32e523);}(_0xca2b,0x156));var _0xbca2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xca2b[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xbca2('0x0'));var WhatsappInteraction=require(_0xbca2('0x1'))['db'][_0xbca2('0x2')];var WhatsappMessage=require(_0xbca2('0x1'))['db'][_0xbca2('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbca2('0x4')](0x0);var events={'afterCreate':_0xbca2('0x5'),'afterUpdate':_0xbca2('0x6'),'afterDestroy':'remove'};function emitEvent(_0x24af48){return function(_0x166cdd,_0x4d8f7c,_0x17439f){_0x166cdd['getUsers']({'attributes':['id'],'raw':!![]})[_0xbca2('0x7')](function(_0x214cdf){_0x166cdd[_0xbca2('0x8')]('Users',_0x214cdf['map'](function(_0xddc139){return{'id':_0xddc139['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x166cdd['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3216c6){_0x166cdd[_0xbca2('0x8')](_0xbca2('0x9'),_0x3216c6[_0xbca2('0xa')]);WhatsappInteractionEvents[_0xbca2('0xb')](_0x24af48+':'+_0x166cdd['id'],_0x166cdd);WhatsappInteractionEvents[_0xbca2('0xb')](_0x24af48,_0x166cdd);_0x17439f(null);})[_0xbca2('0xc')](_0x17439f(null));};}for(var e in events){if(events[_0xbca2('0xd')](e)){var event=events[e];WhatsappInteraction[_0xbca2('0xe')](e,emitEvent(event));}}module[_0xbca2('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xdeb7=['remove','getUsers','then','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update'];(function(_0x4399f3,_0x588adb){var _0xd22395=function(_0x1898f7){while(--_0x1898f7){_0x4399f3['push'](_0x4399f3['shift']());}};_0xd22395(++_0x588adb);}(_0xdeb7,0x77));var _0x7deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb7[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x7deb('0x0'));var WhatsappInteraction=require(_0x7deb('0x1'))['db'][_0x7deb('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x7deb('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x7deb('0x4')](0x0);var events={'afterCreate':_0x7deb('0x5'),'afterUpdate':_0x7deb('0x6'),'afterDestroy':_0x7deb('0x7')};function emitEvent(_0x5b89a9){return function(_0x370d71,_0x39505e,_0x9283e7){_0x370d71[_0x7deb('0x8')]({'attributes':['id'],'raw':!![]})[_0x7deb('0x9')](function(_0x1a5058){_0x370d71['setDataValue'](_0x7deb('0xa'),_0x1a5058[_0x7deb('0xb')](function(_0x3cb5d4){return{'id':_0x3cb5d4['id']};}));return WhatsappMessage[_0x7deb('0xc')]({'where':{'WhatsappInteractionId':_0x370d71['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1c771d){_0x370d71['setDataValue']('unreadMessages',_0x1c771d[_0x7deb('0xd')]);WhatsappInteractionEvents['emit'](_0x5b89a9+':'+_0x370d71['id'],_0x370d71);WhatsappInteractionEvents[_0x7deb('0xe')](_0x5b89a9,_0x370d71);_0x9283e7(null);})[_0x7deb('0xf')](_0x9283e7(null));};}for(var e in events){if(events[_0x7deb('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x7deb('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 7db53f3..daf1d97 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 _0x3994=['define','WhatsappInteraction','whatsapp_interactions','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x3994,0x123));var _0x4399=function(_0x1d8512,_0x53a678){_0x1d8512=_0x1d8512-0x0;var _0x2826ca=_0x3994[_0x1d8512];return _0x2826ca;};'use strict';var _=require(_0x4399('0x0'));var util=require(_0x4399('0x1'));var logger=require(_0x4399('0x2'))(_0x4399('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4399('0x4'));var fs=require('fs');var path=require(_0x4399('0x5'));var rimraf=require('rimraf');var config=require(_0x4399('0x6'));var attributes=require('./whatsappInteraction.attributes');module[_0x4399('0x7')]=function(_0x204b07,_0x21d990){return _0x204b07[_0x4399('0x8')](_0x4399('0x9'),attributes,{'tableName':_0x4399('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11f811,_0x4a9509,_0x32f444){if(_0x11f811['changed']('closed')){_0x11f811['closedAt']=moment()[_0x4399('0xb')](_0x4399('0xc'));}_0x32f444(null,_0x11f811);}}});}; \ No newline at end of file +var _0x5e92=['closedAt','format','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','changed'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5e92,0x1d0));var _0x25e9=function(_0x20ed7b,_0x19eb40){_0x20ed7b=_0x20ed7b-0x0;var _0x318c55=_0x5e92[_0x20ed7b];return _0x318c55;};'use strict';var _=require('lodash');var util=require(_0x25e9('0x0'));var logger=require(_0x25e9('0x1'))(_0x25e9('0x2'));var moment=require(_0x25e9('0x3'));var BPromise=require(_0x25e9('0x4'));var rp=require(_0x25e9('0x5'));var fs=require('fs');var path=require(_0x25e9('0x6'));var rimraf=require('rimraf');var config=require(_0x25e9('0x7'));var attributes=require(_0x25e9('0x8'));module['exports']=function(_0x8bac56,_0x45637c){return _0x8bac56[_0x25e9('0x9')](_0x25e9('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5807bb,_0x4260d1,_0x47d568){if(_0x5807bb[_0x25e9('0xb')]('closed')){_0x5807bb[_0x25e9('0xc')]=moment()[_0x25e9('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x47d568(null,_0x5807bb);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index bd9684f..1e90926 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 _0xe453=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','WhatsappInteraction','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','ids','omit','spread'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xe453,0xfd));var _0x3e45=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe453[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x3e45('0x0'));var util=require(_0x3e45('0x1'));var moment=require(_0x3e45('0x2'));var BPromise=require(_0x3e45('0x3'));var rs=require(_0x3e45('0x4'));var fs=require('fs');var Redis=require(_0x3e45('0x5'));var db=require(_0x3e45('0x6'))['db'];var utils=require(_0x3e45('0x7'));var logger=require(_0x3e45('0x8'))(_0x3e45('0x9'));var config=require(_0x3e45('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3e45('0xb')]['http']({'port':0x232a});config[_0x3e45('0xc')]=_[_0x3e45('0xd')](config[_0x3e45('0xc')],{'host':_0x3e45('0xe'),'port':0x18eb});var socket=require(_0x3e45('0xf'))(new Redis(config[_0x3e45('0xc')]));require('./whatsappInteraction.socket')[_0x3e45('0x10')](socket);function respondWithRpcPromise(_0x3dd760,_0x43e96b,_0x338e11){return new BPromise(function(_0x56febf,_0x3616de){return client['request'](_0x3dd760,_0x338e11)[_0x3e45('0x11')](function(_0x325c06){logger[_0x3e45('0x12')](_0x3e45('0x13'),_0x43e96b,_0x3e45('0x14'));logger[_0x3e45('0x15')](_0x3e45('0x16'),_0x43e96b,_0x3e45('0x14'),JSON[_0x3e45('0x17')](_0x325c06));if(_0x325c06[_0x3e45('0x18')]){if(_0x325c06[_0x3e45('0x18')]['code']===0x1f4){logger[_0x3e45('0x18')](_0x3e45('0x13'),_0x43e96b,_0x325c06[_0x3e45('0x18')][_0x3e45('0x19')]);return _0x3616de(_0x325c06[_0x3e45('0x18')][_0x3e45('0x19')]);}logger['error'](_0x3e45('0x13'),_0x43e96b,_0x325c06['error'][_0x3e45('0x19')]);return _0x56febf(_0x325c06[_0x3e45('0x18')][_0x3e45('0x19')]);}else{logger[_0x3e45('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x43e96b,'request\x20sent');_0x56febf(_0x325c06[_0x3e45('0x1a')]['message']);}})[_0x3e45('0x1b')](function(_0x10f565){logger[_0x3e45('0x18')](_0x3e45('0x13'),_0x43e96b,_0x10f565);_0x3616de(_0x10f565);});});}exports['UpdateWhatsappInteraction']=function(_0x20e4f6){var _0x493cde=this;return new Promise(function(_0xaaf50f,_0x504907){return db[_0x3e45('0x1c')][_0x3e45('0x1d')](_0x20e4f6[_0x3e45('0x1e')],{'raw':_0x20e4f6[_0x3e45('0x1f')]?_0x20e4f6[_0x3e45('0x1f')][_0x3e45('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20e4f6[_0x3e45('0x1f')]?_0x20e4f6[_0x3e45('0x1f')][_0x3e45('0x21')]||null:null,'attributes':_0x20e4f6[_0x3e45('0x1f')]?_0x20e4f6[_0x3e45('0x1f')][_0x3e45('0x22')]||null:null,'limit':_0x20e4f6[_0x3e45('0x1f')]?_0x20e4f6[_0x3e45('0x1f')][_0x3e45('0x23')]||null:null})[_0x3e45('0x11')](function(_0x4eb8e8){logger[_0x3e45('0x12')](_0x3e45('0x24'),_0x20e4f6);logger[_0x3e45('0x15')](_0x3e45('0x24'),_0x20e4f6,JSON[_0x3e45('0x17')](_0x4eb8e8));_0xaaf50f(_0x4eb8e8);})[_0x3e45('0x1b')](function(_0x5b8666){logger[_0x3e45('0x18')](_0x3e45('0x24'),_0x5b8666[_0x3e45('0x19')],_0x20e4f6);_0x504907(_0x493cde[_0x3e45('0x18')](0x1f4,_0x5b8666[_0x3e45('0x19')]));});});};exports[_0x3e45('0x25')]=function(_0x267fdc){return new Promise(function(_0x283cdc,_0x1111b1){return db['WhatsappInteraction']['find']({'where':_0x267fdc[_0x3e45('0x1f')]?_0x267fdc['options'][_0x3e45('0x21')]||null:null})[_0x3e45('0x11')](function(_0x7f3e72){if(_0x7f3e72){return _0x7f3e72['addTags'](_0x267fdc[_0x3e45('0x1e')][_0x3e45('0x26')],_[_0x3e45('0x27')](_0x267fdc[_0x3e45('0x1e')],[_0x3e45('0x26'),'id'])||{});}})[_0x3e45('0x28')](function(_0x7b19f0){logger[_0x3e45('0x12')](_0x3e45('0x29'),_0x267fdc);logger[_0x3e45('0x15')](_0x3e45('0x29'),_0x267fdc,JSON[_0x3e45('0x17')](_0x7b19f0));_0x283cdc(_0x7b19f0);})[_0x3e45('0x1b')](function(_0x3abbdc){logger[_0x3e45('0x18')]('AddTags',_0x3abbdc['message'],_0x267fdc);_0x1111b1(_this['error'](0x1f4,_0x3abbdc[_0x3e45('0x19')]));});});}; \ No newline at end of file +var _0x47f5=['redis','localhost','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','raw','options','attributes','limit','AddTagsToWhatsappInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x500f19,_0x5590a2){var _0x11ba6b=function(_0x2609d3){while(--_0x2609d3){_0x500f19['push'](_0x500f19['shift']());}};_0x11ba6b(++_0x5590a2);}(_0x47f5,0xe4));var _0x547f=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0x47f5[_0x218994];return _0x3f350b;};'use strict';var _=require(_0x547f('0x0'));var util=require(_0x547f('0x1'));var moment=require(_0x547f('0x2'));var BPromise=require(_0x547f('0x3'));var rs=require(_0x547f('0x4'));var fs=require('fs');var Redis=require(_0x547f('0x5'));var db=require(_0x547f('0x6'))['db'];var utils=require(_0x547f('0x7'));var logger=require(_0x547f('0x8'))(_0x547f('0x9'));var config=require('../../config/environment');var jayson=require(_0x547f('0xa'));var client=jayson[_0x547f('0xb')]['http']({'port':0x232a});config[_0x547f('0xc')]=_['defaults'](config[_0x547f('0xc')],{'host':_0x547f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x547f('0xe')](socket);function respondWithRpcPromise(_0x55f3f5,_0x1c5b1c,_0x2f69b9){return new BPromise(function(_0x1b0fbd,_0x4e0c9f){return client['request'](_0x55f3f5,_0x2f69b9)[_0x547f('0xf')](function(_0xeb1a81){logger[_0x547f('0x10')](_0x547f('0x11'),_0x1c5b1c,_0x547f('0x12'));logger[_0x547f('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1c5b1c,'request\x20sent',JSON[_0x547f('0x14')](_0xeb1a81));if(_0xeb1a81[_0x547f('0x15')]){if(_0xeb1a81[_0x547f('0x15')]['code']===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x1c5b1c,_0xeb1a81['error']['message']);return _0x4e0c9f(_0xeb1a81[_0x547f('0x15')][_0x547f('0x16')]);}logger[_0x547f('0x15')](_0x547f('0x11'),_0x1c5b1c,_0xeb1a81[_0x547f('0x15')]['message']);return _0x1b0fbd(_0xeb1a81[_0x547f('0x15')]['message']);}else{logger[_0x547f('0x10')](_0x547f('0x11'),_0x1c5b1c,'request\x20sent');_0x1b0fbd(_0xeb1a81[_0x547f('0x17')][_0x547f('0x16')]);}})[_0x547f('0x18')](function(_0x2b66e0){logger[_0x547f('0x15')](_0x547f('0x11'),_0x1c5b1c,_0x2b66e0);_0x4e0c9f(_0x2b66e0);});});}exports[_0x547f('0x19')]=function(_0x302cae){var _0x52027a=this;return new Promise(function(_0x40b7cc,_0x38cf96){return db[_0x547f('0x1a')]['update'](_0x302cae[_0x547f('0x1b')],{'raw':_0x302cae['options']?_0x302cae['options'][_0x547f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x302cae[_0x547f('0x1d')]?_0x302cae[_0x547f('0x1d')]['where']||null:null,'attributes':_0x302cae[_0x547f('0x1d')]?_0x302cae[_0x547f('0x1d')][_0x547f('0x1e')]||null:null,'limit':_0x302cae['options']?_0x302cae[_0x547f('0x1d')][_0x547f('0x1f')]||null:null})[_0x547f('0xf')](function(_0x2b0444){logger[_0x547f('0x10')]('UpdateWhatsappInteraction',_0x302cae);logger[_0x547f('0x13')](_0x547f('0x19'),_0x302cae,JSON[_0x547f('0x14')](_0x2b0444));_0x40b7cc(_0x2b0444);})['catch'](function(_0x2951ba){logger[_0x547f('0x15')](_0x547f('0x19'),_0x2951ba[_0x547f('0x16')],_0x302cae);_0x38cf96(_0x52027a[_0x547f('0x15')](0x1f4,_0x2951ba['message']));});});};exports[_0x547f('0x20')]=function(_0x9364a5){return new Promise(function(_0x10af21,_0x486ae6){return db[_0x547f('0x1a')][_0x547f('0x21')]({'where':_0x9364a5[_0x547f('0x1d')]?_0x9364a5[_0x547f('0x1d')][_0x547f('0x22')]||null:null})[_0x547f('0xf')](function(_0x3bc5b0){if(_0x3bc5b0){return _0x3bc5b0[_0x547f('0x23')](_0x9364a5[_0x547f('0x1b')][_0x547f('0x24')],_[_0x547f('0x25')](_0x9364a5[_0x547f('0x1b')],['ids','id'])||{});}})[_0x547f('0x26')](function(_0x4c4aa7){logger[_0x547f('0x10')](_0x547f('0x27'),_0x9364a5);logger[_0x547f('0x13')]('AddTags',_0x9364a5,JSON[_0x547f('0x14')](_0x4c4aa7));_0x10af21(_0x4c4aa7);})[_0x547f('0x18')](function(_0x2f5181){logger[_0x547f('0x15')](_0x547f('0x27'),_0x2f5181['message'],_0x9364a5);_0x486ae6(_this[_0x547f('0x15')](0x1f4,_0x2f5181[_0x547f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 742e46d..730cfb6 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 _0x9191=['emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x476af8,_0x342fae){var _0x406e1f=function(_0xc7d963){while(--_0xc7d963){_0x476af8['push'](_0x476af8['shift']());}};_0x406e1f(++_0x342fae);}(_0x9191,0x8b));var _0x1919=function(_0x5bccd3,_0x4e2b7b){_0x5bccd3=_0x5bccd3-0x0;var _0x322dbc=_0x9191[_0x5bccd3];return _0x322dbc;};'use strict';var WhatsappInteractionEvents=require(_0x1919('0x0'));var events=['save','remove','update'];function createListener(_0x6e6e0,_0x542c35){return function(_0x2ef5db){_0x542c35[_0x1919('0x1')](_0x6e6e0,_0x2ef5db);};}function removeListener(_0x3f095e,_0xb5087f){return function(){WhatsappInteractionEvents[_0x1919('0x2')](_0x3f095e,_0xb5087f);};}exports[_0x1919('0x3')]=function(_0x4fdf9e){for(var _0x5fc108=0x0,_0x50fb6d=events['length'];_0x5fc108<_0x50fb6d;_0x5fc108++){var _0x47833b=events[_0x5fc108];var _0x422895=createListener(_0x1919('0x4')+_0x47833b,_0x4fdf9e);WhatsappInteractionEvents['on'](_0x47833b,_0x422895);}}; \ No newline at end of file +var _0x0928=['emit','update'];(function(_0x3d3f8d,_0x1c78ab){var _0x1805b5=function(_0x16de51){while(--_0x16de51){_0x3d3f8d['push'](_0x3d3f8d['shift']());}};_0x1805b5(++_0x1c78ab);}(_0x0928,0x97));var _0x8092=function(_0x19ba1b,_0x44a0f4){_0x19ba1b=_0x19ba1b-0x0;var _0x178a61=_0x0928[_0x19ba1b];return _0x178a61;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save','remove',_0x8092('0x0')];function createListener(_0xb4925b,_0x565865){return function(_0x399312){_0x565865[_0x8092('0x1')](_0xb4925b,_0x399312);};}function removeListener(_0x495498,_0x1a00d6){return function(){WhatsappInteractionEvents['removeListener'](_0x495498,_0x1a00d6);};}exports['register']=function(_0x3cca0a){for(var _0x334b62=0x0,_0x766f12=events['length'];_0x334b62<_0x766f12;_0x334b62++){var _0x21b964=events[_0x334b62];var _0x3955f8=createListener('whatsappInteraction:'+_0x21b964,_0x3cca0a);WhatsappInteractionEvents['on'](_0x21b964,_0x3955f8);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index fac0426..d2b7642 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 _0x3ce3=['../../config/environment','./whatsappMessage.controller','get','/describe','describe','isAuthenticated','show','post','tracked','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1a496c,_0x205019){var _0x482000=function(_0x458509){while(--_0x458509){_0x1a496c['push'](_0x1a496c['shift']());}};_0x482000(++_0x205019);}(_0x3ce3,0x170));var _0x33ce=function(_0x56c758,_0x540591){_0x56c758=_0x56c758-0x0;var _0x9bb0db=_0x3ce3[_0x56c758];return _0x9bb0db;};'use strict';var multer=require(_0x33ce('0x0'));var util=require(_0x33ce('0x1'));var path=require(_0x33ce('0x2'));var timeout=require(_0x33ce('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x33ce('0x4'));var auth=require(_0x33ce('0x5'));var interaction=require(_0x33ce('0x6'));var config=require(_0x33ce('0x7'));var controller=require(_0x33ce('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x33ce('0x9')](_0x33ce('0xa'),auth['isAuthenticated'](),controller[_0x33ce('0xb')]);router[_0x33ce('0x9')]('/:id',auth[_0x33ce('0xc')](),controller[_0x33ce('0xd')]);router[_0x33ce('0xe')]('/',auth[_0x33ce('0xc')](),interaction[_0x33ce('0xf')]('whatsapp','whatsappmessage:create'),controller['create']);router[_0x33ce('0xe')](_0x33ce('0x10'),controller['status']);router[_0x33ce('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x33ce('0x12')]);router['put'](_0x33ce('0x13'),auth[_0x33ce('0xc')](),controller[_0x33ce('0x14')]);router[_0x33ce('0x11')](_0x33ce('0x15'),auth[_0x33ce('0xc')](),controller[_0x33ce('0x16')]);router[_0x33ce('0x17')]('/:id',auth[_0x33ce('0xc')](),controller[_0x33ce('0x18')]);module['exports']=router; \ No newline at end of file +var _0xd49a=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','describe','show','tracked','whatsapp','whatsappmessage:create','create','post','status','put','/:id','update','/:id/reject','reject','delete','destroy'];(function(_0x5a5a7b,_0xc7bb9e){var _0x1ca7e5=function(_0xe71939){while(--_0xe71939){_0x5a5a7b['push'](_0x5a5a7b['shift']());}};_0x1ca7e5(++_0xc7bb9e);}(_0xd49a,0x1b1));var _0xad49=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd49a[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xad49('0x0'));var util=require(_0xad49('0x1'));var path=require(_0xad49('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xad49('0x3')]();var fs_extra=require(_0xad49('0x4'));var auth=require(_0xad49('0x5'));var interaction=require(_0xad49('0x6'));var config=require(_0xad49('0x7'));var controller=require(_0xad49('0x8'));router[_0xad49('0x9')]('/',auth[_0xad49('0xa')](),controller['index']);router[_0xad49('0x9')]('/describe',auth[_0xad49('0xa')](),controller[_0xad49('0xb')]);router[_0xad49('0x9')]('/:id',auth[_0xad49('0xa')](),controller[_0xad49('0xc')]);router['post']('/',auth[_0xad49('0xa')](),interaction[_0xad49('0xd')](_0xad49('0xe'),_0xad49('0xf')),controller[_0xad49('0x10')]);router[_0xad49('0x11')]('/:id/status',controller[_0xad49('0x12')]);router[_0xad49('0x13')](_0xad49('0x14'),auth[_0xad49('0xa')](),controller[_0xad49('0x15')]);router[_0xad49('0x13')]('/:id/accept',auth[_0xad49('0xa')](),controller['accept']);router['put'](_0xad49('0x16'),auth[_0xad49('0xa')](),controller[_0xad49('0x17')]);router[_0xad49('0x18')](_0xad49('0x14'),auth[_0xad49('0xa')](),controller[_0xad49('0x19')]);module[_0xad49('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index c2e8231..b9229fa 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 _0x826a=['BOOLEAN','out','STRING','DATE','TEXT'];(function(_0x387872,_0x4ae9aa){var _0x5ec22c=function(_0x223c8f){while(--_0x223c8f){_0x387872['push'](_0x387872['shift']());}};_0x5ec22c(++_0x4ae9aa);}(_0x826a,0xae));var _0xa826=function(_0x380987,_0x2a5565){_0x380987=_0x380987-0x0;var _0x22e7f1=_0x826a[_0x380987];return _0x22e7f1;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xa826('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa826('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa826('0x2')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xa826('0x3')]},'readAt':{'type':Sequelize[_0xa826('0x4')]},'secret':{'type':Sequelize[_0xa826('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa826('0x3')]},'providerResponse':{'type':Sequelize[_0xa826('0x0')]}}; \ No newline at end of file +var _0x6a5c=['STRING','DATE','exports','BOOLEAN','out'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x6a5c,0x9d));var _0xc6a5=function(_0x169045,_0x36511c){_0x169045=_0x169045-0x0;var _0x5a78ef=_0x6a5c[_0x169045];return _0x5a78ef;};'use strict';var Sequelize=require('sequelize');module[_0xc6a5('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc6a5('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc6a5('0x2')),'defaultValue':_0xc6a5('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc6a5('0x3')](0xbe)},'phone':{'type':Sequelize[_0xc6a5('0x3')]},'readAt':{'type':Sequelize[_0xc6a5('0x4')]},'secret':{'type':Sequelize[_0xc6a5('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc6a5('0x3')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index fe6fefd..f3a1f95 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 _0x9c5a=['get','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','agent','internal','manual','interface','SIP/%s','motionChannel','channel','event','accept','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','type','twilio','MessageSid','messageId','MessageStatus','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','end','stack','send','index','map','WhatsappMessage','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','options','findAll','params','rawAttributes','length','includeAll','find','create','body','describe','whatsapp-interactions','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId'];(function(_0x56d7f6,_0x1d458c){var _0x908d81=function(_0x5c1832){while(--_0x5c1832){_0x56d7f6['push'](_0x56d7f6['shift']());}};_0x908d81(++_0x1d458c);}(_0x9c5a,0x1b8));var _0xa9c5=function(_0x353b53,_0x1d090e){_0x353b53=_0x353b53-0x0;var _0x21d82f=_0x9c5a[_0x353b53];return _0x21d82f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa9c5('0x0'));var zipdir=require(_0xa9c5('0x1'));var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require(_0xa9c5('0x6'));var util=require(_0xa9c5('0x7'));var path=require(_0xa9c5('0x8'));var sox=require(_0xa9c5('0x9'));var csv=require(_0xa9c5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0xb'));var _=require(_0xa9c5('0xc'));var squel=require('squel');var crypto=require(_0xa9c5('0xd'));var jsforce=require(_0xa9c5('0xe'));var deskjs=require(_0xa9c5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0x10'));var Papa=require(_0xa9c5('0x11'));var Redis=require(_0xa9c5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa9c5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9c5('0x14'));var logger=require(_0xa9c5('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa9c5('0x16')]=_[_0xa9c5('0x17')](config['redis'],{'host':_0xa9c5('0x18'),'port':0x18eb});var socket=require(_0xa9c5('0x19'))(new Redis(config[_0xa9c5('0x16')]));require(_0xa9c5('0x1a'))[_0xa9c5('0x1b')](socket);var jayson=require(_0xa9c5('0x1c'));var client=jayson[_0xa9c5('0x1d')][_0xa9c5('0x1e')]({'port':0x232c});var client9002=jayson[_0xa9c5('0x1d')][_0xa9c5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1f0f5e,_0x4960e0,_0x438967,_0x104cd3){return new BPromise(function(_0x2fce5a,_0x2bcf90){var _0x21b7ac=_0x104cd3||client;return _0x21b7ac[_0xa9c5('0x1f')](_0x1f0f5e,_0x438967)[_0xa9c5('0x20')](function(_0x407714){logger['info'](_0xa9c5('0x21'),_0x4960e0,_0xa9c5('0x22'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4960e0,_0xa9c5('0x22'),JSON['stringify'](_0x407714));if(_0x407714[_0xa9c5('0x23')]){if(_0x407714[_0xa9c5('0x23')][_0xa9c5('0x24')]===0x1f4){logger['error'](_0xa9c5('0x21'),_0x4960e0,_0x407714['error'][_0xa9c5('0x25')]);return _0x2bcf90(_0x407714[_0xa9c5('0x23')][_0xa9c5('0x25')]);}logger[_0xa9c5('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x4960e0,_0x407714[_0xa9c5('0x23')][_0xa9c5('0x25')]);return _0x2fce5a(_0x407714[_0xa9c5('0x23')][_0xa9c5('0x25')]);}else{logger[_0xa9c5('0x26')](_0xa9c5('0x21'),_0x4960e0,_0xa9c5('0x22'));_0x2fce5a(_0x407714[_0xa9c5('0x27')][_0xa9c5('0x25')]);}})[_0xa9c5('0x28')](function(_0x5992e5){logger[_0xa9c5('0x23')](_0xa9c5('0x21'),_0x4960e0,_0x5992e5);_0x2bcf90(_0x5992e5);});});}function respondWithStatusCode(_0x4fba35,_0x572588){_0x572588=_0x572588||0xcc;return function(_0x9ac060){if(_0x9ac060){return _0x4fba35[_0xa9c5('0x29')](_0x572588);}return _0x4fba35[_0xa9c5('0x2a')](_0x572588)['end']();};}function respondWithResult(_0x97f150,_0x2c647a){_0x2c647a=_0x2c647a||0xc8;return function(_0x1f7086){if(_0x1f7086){return _0x97f150[_0xa9c5('0x2a')](_0x2c647a)[_0xa9c5('0x2b')](_0x1f7086);}};}function respondWithFilteredResult(_0x2c0930,_0x3a5538){return function(_0x169d53){if(_0x169d53){var _0x18ac92=typeof _0x3a5538[_0xa9c5('0x2c')]===_0xa9c5('0x2d')&&typeof _0x3a5538[_0xa9c5('0x2e')]===_0xa9c5('0x2d');var _0x138e26=_0x169d53[_0xa9c5('0x2f')];var _0x26685c=_0x18ac92?0x0:_0x3a5538[_0xa9c5('0x2c')];var _0x133fbe=_0x18ac92?_0x169d53[_0xa9c5('0x2f')]:_0x3a5538['offset']+_0x3a5538[_0xa9c5('0x2e')];var _0x1284ec;if(_0x133fbe>=_0x138e26){_0x133fbe=_0x138e26;_0x1284ec=0xc8;}else{_0x1284ec=0xce;}_0x2c0930['status'](_0x1284ec);return _0x2c0930['set']('Content-Range',_0x26685c+'-'+_0x133fbe+'/'+_0x138e26)[_0xa9c5('0x2b')](_0x169d53);}return null;};}function patchUpdates(_0x536697){return function(_0x21fd7c){try{jsonpatch[_0xa9c5('0x30')](_0x21fd7c,_0x536697,!![]);}catch(_0x5c7198){return BPromise[_0xa9c5('0x31')](_0x5c7198);}return _0x21fd7c[_0xa9c5('0x32')]();};}function saveUpdates(_0x312f98,_0x2cfb70){return function(_0x621aec){if(_0x621aec){return _0x621aec[_0xa9c5('0x33')](_0x312f98)[_0xa9c5('0x20')](function(_0x4f4269){return _0x4f4269;});}return null;};}function removeEntity(_0x36ae37,_0x45413b){return function(_0x556076){if(_0x556076){return _0x556076[_0xa9c5('0x34')]()['then'](function(){_0x36ae37[_0xa9c5('0x2a')](0xcc)[_0xa9c5('0x35')]();});}};}function handleEntityNotFound(_0x29f791,_0x3c36bb){return function(_0x1761e2){if(!_0x1761e2){_0x29f791[_0xa9c5('0x29')](0x194);}return _0x1761e2;};}function handleError(_0x2e3e74,_0x1bae71){_0x1bae71=_0x1bae71||0x1f4;return function(_0x298130){logger[_0xa9c5('0x23')](_0x298130[_0xa9c5('0x36')]);if(_0x298130['name']){delete _0x298130['name'];}_0x2e3e74['status'](_0x1bae71)[_0xa9c5('0x37')](_0x298130);};}exports[_0xa9c5('0x38')]=function(_0x1e5bce,_0x1f3f3b){var _0x2695f3={},_0x1891f3={},_0x3ee629={'count':0x0,'rows':[]};var _0x6f715b=_[_0xa9c5('0x39')](db[_0xa9c5('0x3a')]['rawAttributes'],function(_0xe6f587){return{'name':_0xe6f587[_0xa9c5('0x3b')],'type':_0xe6f587['type'][_0xa9c5('0x3c')]};});_0x1891f3[_0xa9c5('0x3d')]=_[_0xa9c5('0x39')](_0x6f715b,_0xa9c5('0x3e'));_0x1891f3[_0xa9c5('0x3f')]=_[_0xa9c5('0x40')](_0x1e5bce['query']);_0x1891f3[_0xa9c5('0x41')]=_[_0xa9c5('0x42')](_0x1891f3[_0xa9c5('0x3d')],_0x1891f3[_0xa9c5('0x3f')]);_0x2695f3[_0xa9c5('0x43')]=_[_0xa9c5('0x42')](_0x1891f3[_0xa9c5('0x3d')],qs[_0xa9c5('0x44')](_0x1e5bce[_0xa9c5('0x3f')]['fields']));_0x2695f3[_0xa9c5('0x43')]=_0x2695f3['attributes']['length']?_0x2695f3['attributes']:_0x1891f3['model'];if(!_0x1e5bce[_0xa9c5('0x3f')]['hasOwnProperty'](_0xa9c5('0x45'))){_0x2695f3[_0xa9c5('0x2e')]=qs[_0xa9c5('0x2e')](_0x1e5bce[_0xa9c5('0x3f')][_0xa9c5('0x2e')]);_0x2695f3[_0xa9c5('0x2c')]=qs[_0xa9c5('0x2c')](_0x1e5bce['query'][_0xa9c5('0x2c')]);}_0x2695f3[_0xa9c5('0x46')]=qs[_0xa9c5('0x47')](_0x1e5bce[_0xa9c5('0x3f')][_0xa9c5('0x47')]);_0x2695f3['where']=qs[_0xa9c5('0x41')](_['pick'](_0x1e5bce[_0xa9c5('0x3f')],_0x1891f3[_0xa9c5('0x41')]),_0x6f715b);if(_0x1e5bce[_0xa9c5('0x3f')]['filter']){_0x2695f3[_0xa9c5('0x48')]=_[_0xa9c5('0x49')](_0x2695f3['where'],{'$or':_[_0xa9c5('0x39')](_0x6f715b,function(_0x5dcc55){if(_0x5dcc55['type']!==_0xa9c5('0x4a')){var _0x1b5b20={};_0x1b5b20[_0x5dcc55['name']]={'$like':'%'+_0x1e5bce[_0xa9c5('0x3f')]['filter']+'%'};return _0x1b5b20;}})});}_0x2695f3=_[_0xa9c5('0x49')]({},_0x2695f3,_0x1e5bce[_0xa9c5('0x4b')]);var _0x29c77b={'where':_0x2695f3[_0xa9c5('0x48')]};return db['WhatsappMessage'][_0xa9c5('0x2f')](_0x29c77b)[_0xa9c5('0x20')](function(_0x2c9e1e){_0x3ee629[_0xa9c5('0x2f')]=_0x2c9e1e;if(_0x1e5bce[_0xa9c5('0x3f')]['includeAll']){_0x2695f3['include']=[{'all':!![]}];}return db[_0xa9c5('0x3a')][_0xa9c5('0x4c')](_0x2695f3);})[_0xa9c5('0x20')](function(_0x253ccf){_0x3ee629['rows']=_0x253ccf;return _0x3ee629;})['then'](respondWithFilteredResult(_0x1f3f3b,_0x2695f3))['catch'](handleError(_0x1f3f3b,null));};exports['show']=function(_0x4c8cc3,_0x276318){var _0x495ee5={'raw':!![],'where':{'id':_0x4c8cc3[_0xa9c5('0x4d')]['id']}},_0x4234ad={};_0x4234ad[_0xa9c5('0x3d')]=_[_0xa9c5('0x40')](db[_0xa9c5('0x3a')][_0xa9c5('0x4e')]);_0x4234ad[_0xa9c5('0x3f')]=_[_0xa9c5('0x40')](_0x4c8cc3[_0xa9c5('0x3f')]);_0x4234ad['filters']=_['intersection'](_0x4234ad[_0xa9c5('0x3d')],_0x4234ad[_0xa9c5('0x3f')]);_0x495ee5['attributes']=_['intersection'](_0x4234ad['model'],qs['fields'](_0x4c8cc3[_0xa9c5('0x3f')][_0xa9c5('0x44')]));_0x495ee5['attributes']=_0x495ee5[_0xa9c5('0x43')][_0xa9c5('0x4f')]?_0x495ee5[_0xa9c5('0x43')]:_0x4234ad[_0xa9c5('0x3d')];if(_0x4c8cc3[_0xa9c5('0x3f')][_0xa9c5('0x50')]){_0x495ee5['include']=[{'all':!![]}];}_0x495ee5=_['merge']({},_0x495ee5,_0x4c8cc3[_0xa9c5('0x4b')]);return db['WhatsappMessage'][_0xa9c5('0x51')](_0x495ee5)['then'](handleEntityNotFound(_0x276318,null))[_0xa9c5('0x20')](respondWithResult(_0x276318,null))[_0xa9c5('0x28')](handleError(_0x276318,null));};exports[_0xa9c5('0x52')]=function(_0x5a1187,_0x237832){return db[_0xa9c5('0x3a')][_0xa9c5('0x52')](_0x5a1187[_0xa9c5('0x53')],{})[_0xa9c5('0x20')](respondWithResult(_0x237832,0xc9))[_0xa9c5('0x28')](handleError(_0x237832,null));};exports[_0xa9c5('0x33')]=function(_0x48bebb,_0x7039e0){if(_0x48bebb[_0xa9c5('0x53')]['id']){delete _0x48bebb[_0xa9c5('0x53')]['id'];}return db['WhatsappMessage'][_0xa9c5('0x51')]({'where':{'id':_0x48bebb[_0xa9c5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x7039e0,null))[_0xa9c5('0x20')](saveUpdates(_0x48bebb[_0xa9c5('0x53')],null))[_0xa9c5('0x20')](respondWithResult(_0x7039e0,null))['catch'](handleError(_0x7039e0,null));};exports[_0xa9c5('0x34')]=function(_0xbca3a7,_0x17afa8){return db[_0xa9c5('0x3a')][_0xa9c5('0x51')]({'where':{'id':_0xbca3a7[_0xa9c5('0x4d')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x17afa8,null))[_0xa9c5('0x20')](removeEntity(_0x17afa8,null))[_0xa9c5('0x28')](handleError(_0x17afa8,null));};exports[_0xa9c5('0x54')]=function(_0x9fc9cd,_0x137eaa){return db[_0xa9c5('0x3a')]['describe']()['then'](respondWithResult(_0x137eaa,null))[_0xa9c5('0x28')](handleError(_0x137eaa,null));};var interaction_log=require(_0xa9c5('0x15'))(_0xa9c5('0x55'));exports['accept']=function(_0x391858,_0xd1e16e,_0x592673){var _0x471a9f={'agent':{},'channel':_0xa9c5('0x56')};if(_0x391858[_0xa9c5('0x53')]['id']){delete _0x391858[_0xa9c5('0x53')]['id'];}_0x391858['body'][_0xa9c5('0x57')]=!![];_0x391858[_0xa9c5('0x53')][_0xa9c5('0x58')]=moment()[_0xa9c5('0x59')](_0xa9c5('0x5a'));_0x391858[_0xa9c5('0x53')]['UserId']=_0x391858[_0xa9c5('0x53')][_0xa9c5('0x5b')]||_0x391858['user']['id'];_0x471a9f['agent']['id']=_0x391858[_0xa9c5('0x53')][_0xa9c5('0x5b')];return db[_0xa9c5('0x3a')][_0xa9c5('0x51')]({'where':{'id':_0x391858['params']['id'],'UserId':null}})[_0xa9c5('0x20')](handleEntityNotFound(_0xd1e16e,null))['then'](saveUpdates(_0x391858[_0xa9c5('0x53')],null))[_0xa9c5('0x20')](function(_0x58e364){if(_0x58e364){_0x471a9f[_0xa9c5('0x25')]=_0x58e364[_0xa9c5('0x5c')]({'plain':!![]});return db[_0xa9c5('0x5d')]['find']({'where':{'id':_0x58e364[_0xa9c5('0x5e')]}});}return null;})[_0xa9c5('0x20')](handleEntityNotFound(_0xd1e16e,null))[_0xa9c5('0x20')](function(_0x4f996c){if(_0x4f996c){return _0x4f996c['update']({'UserId':_0x391858['body'][_0xa9c5('0x5b')],'read1stAt':_[_0xa9c5('0x5f')](_0x4f996c['read1stAt'])?moment()[_0xa9c5('0x59')](_0xa9c5('0x5a')):undefined});}return null;})[_0xa9c5('0x20')](function(_0x1503c1){if(_0x1503c1){_0x471a9f[_0xa9c5('0x60')]=_0x1503c1['get']({'plain':!![]});interaction_log[_0xa9c5('0x26')](_0xa9c5('0x61'),_0x391858[_0xa9c5('0x62')]['id'],_0x391858[_0xa9c5('0x62')][_0xa9c5('0x3e')],_0x391858[_0xa9c5('0x62')][_0xa9c5('0x63')],_0x471a9f[_0xa9c5('0x60')]['id'],_0x391858[_0xa9c5('0x53')]?JSON[_0xa9c5('0x64')](_0x391858[_0xa9c5('0x53')]):_0xa9c5('0x65'));return respondWithRpcPromise(_0xa9c5('0x66'),_0xa9c5('0x67'),_0x471a9f);}return null;})[_0xa9c5('0x20')](function(_0x337ffe){var _0x4d1531=_0xa9c5('0x68')+_0x337ffe[_0xa9c5('0x25')][_0xa9c5('0x69')];return db[_0xa9c5('0x6a')][_0xa9c5('0x3f')](_0x4d1531,{'type':db[_0xa9c5('0x6b')]['QueryTypes']['SELECT'],'raw':!![]})[_0xa9c5('0x20')](function(_0x2fab3e){return _0x2fab3e;});})['then'](function(_0x40588d){if(_0x40588d){_0x471a9f[_0xa9c5('0x25')][_0xa9c5('0x6c')]=_0x40588d[0x0];if(!_0x391858['body'][_0xa9c5('0x5b')])return;return db[_0xa9c5('0x6d')]['find']({'where':{'id':_0x391858['body']['UserId'],'role':_0xa9c5('0x6e')},'attributes':['id',_0xa9c5('0x3e'),'fullname','email',_0xa9c5('0x6f')],'raw':!![]});}return null;})[_0xa9c5('0x20')](function(_0x3af9e5){if(!_0x3af9e5)return null;_0x471a9f[_0xa9c5('0x25')][_0xa9c5('0x6e')]=_0x3af9e5;return _0x471a9f;})[_0xa9c5('0x20')](function(_0x53c96){if(_0x53c96){if(_0x391858[_0xa9c5('0x53')][_0xa9c5('0x70')]){_0x471a9f[_0xa9c5('0x25')][_0xa9c5('0x71')]=util[_0xa9c5('0x59')](_0xa9c5('0x72'),_0x391858[_0xa9c5('0x62')][_0xa9c5('0x3e')]);_0x471a9f[_0xa9c5('0x25')]['channel']=_0x471a9f['channel'];_0x471a9f['message'][_0xa9c5('0x73')]=_0x471a9f[_0xa9c5('0x74')];_0x471a9f['message'][_0xa9c5('0x75')]=_0xa9c5('0x76');return respondWithRpcPromise(_0xa9c5('0x77'),'EventManager',{'event':'acceptmessage','message':_0x471a9f['message']},client9002)[_0xa9c5('0x20')](function(){return _0x471a9f;});}return _0x471a9f;}return null;})[_0xa9c5('0x20')](respondWithResult(_0xd1e16e,null))[_0xa9c5('0x28')](handleError(_0xd1e16e,null));};var interaction_log=require('../../config/logger')(_0xa9c5('0x55'));exports[_0xa9c5('0x31')]=function(_0x295728,_0x4cd8c5,_0xccc843){var _0x534b7a={'agent':{},'channel':_0xa9c5('0x56')};if(_0x295728[_0xa9c5('0x53')]['id']){delete _0x295728[_0xa9c5('0x53')]['id'];}_0x295728[_0xa9c5('0x53')][_0xa9c5('0x5b')]=_0x295728[_0xa9c5('0x53')][_0xa9c5('0x5b')]||_0x295728[_0xa9c5('0x62')]['id'];_0x534b7a[_0xa9c5('0x6e')]['id']=_0x295728[_0xa9c5('0x53')]['UserId'];return db[_0xa9c5('0x3a')][_0xa9c5('0x51')]({'where':{'id':_0x295728[_0xa9c5('0x4d')]['id'],'UserId':null}})[_0xa9c5('0x20')](handleEntityNotFound(_0x4cd8c5,null))[_0xa9c5('0x20')](function(_0x46d509){if(_0x46d509){_0x534b7a[_0xa9c5('0x25')]=_0x46d509[_0xa9c5('0x5c')]({'plain':!![]});return db['WhatsappInteraction'][_0xa9c5('0x51')]({'where':{'id':_0x46d509['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4cd8c5,null))[_0xa9c5('0x20')](function(_0x395574){if(_0x395574){_0x534b7a[_0xa9c5('0x60')]=_0x395574[_0xa9c5('0x5c')]({'plain':!![]});interaction_log[_0xa9c5('0x26')](_0xa9c5('0x78'),_0x295728[_0xa9c5('0x62')]['id'],_0x295728['user'][_0xa9c5('0x3e')],_0x295728['user']['role'],_0x534b7a[_0xa9c5('0x60')]['id'],_0x295728[_0xa9c5('0x53')]?JSON['stringify'](_0x295728[_0xa9c5('0x53')]):'null');return respondWithRpcPromise(_0xa9c5('0x79'),'rejectMessage',_0x534b7a);}return null;})[_0xa9c5('0x20')](function(_0x1d485e){var _0x4c41eb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1d485e[_0xa9c5('0x25')][_0xa9c5('0x69')];return db[_0xa9c5('0x6a')][_0xa9c5('0x3f')](_0x4c41eb,{'type':db[_0xa9c5('0x6b')][_0xa9c5('0x7a')]['SELECT'],'raw':!![]})[_0xa9c5('0x20')](function(_0x55474b){return _0x55474b;});})[_0xa9c5('0x20')](function(_0x5b265f){if(_0x5b265f){_0x534b7a['message'][_0xa9c5('0x6c')]=_0x5b265f[0x0];if(!_0x295728[_0xa9c5('0x53')][_0xa9c5('0x5b')])return;return db['User']['find']({'where':{'id':_0x295728['body']['UserId'],'role':_0xa9c5('0x6e')},'attributes':['id',_0xa9c5('0x3e'),'fullname','email',_0xa9c5('0x6f')],'raw':!![]});}return null;})[_0xa9c5('0x20')](function(_0x88243d){if(!_0x88243d)return null;_0x534b7a[_0xa9c5('0x25')][_0xa9c5('0x6e')]=_0x88243d;return _0x534b7a;})[_0xa9c5('0x20')](function(_0x9c8d2e){if(_0x9c8d2e){_0x9c8d2e['message']['interface']=util[_0xa9c5('0x59')]('SIP/%s',_0x295728['user'][_0xa9c5('0x3e')]);_0x9c8d2e[_0xa9c5('0x25')]['channel']=_0x534b7a[_0xa9c5('0x74')];_0x9c8d2e[_0xa9c5('0x25')][_0xa9c5('0x73')]=_0x534b7a[_0xa9c5('0x74')];_0x9c8d2e[_0xa9c5('0x25')][_0xa9c5('0x75')]=_0xa9c5('0x31');respondWithRpcPromise(_0xa9c5('0x77'),_0xa9c5('0x77'),{'event':_0xa9c5('0x7b'),'message':_0x9c8d2e['message']},client9002);return _0x534b7a;}return null;})[_0xa9c5('0x20')](respondWithResult(_0x4cd8c5,null))['catch'](handleError(_0x4cd8c5,null));};exports[_0xa9c5('0x2a')]=function(_0x360c31,_0x3af10,_0x4a5955){if(_0x360c31['body']['id']){delete _0x360c31[_0xa9c5('0x53')]['id'];}var _0xa30736;return db['WhatsappMessage'][_0xa9c5('0x51')]({'where':{'id':_0x360c31[_0xa9c5('0x4d')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x3af10,null))[_0xa9c5('0x20')](function(_0x37e1f8){if(_0x37e1f8){_0xa30736=_0x37e1f8;return db[_0xa9c5('0x7c')][_0xa9c5('0x51')]({'where':{'id':_0x37e1f8['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x3af10,null))[_0xa9c5('0x20')](function(_0x4464c3){if(_0x4464c3){logger['debug'](_0xa9c5('0x7d'),_0xa9c5('0x2a'),_0xa9c5('0x7e'),_0x4464c3['type'],util[_0xa9c5('0x7f')](_0x360c31[_0xa9c5('0x53')],{'showHidden':![],'depth':null}));switch(_0x4464c3[_0xa9c5('0x80')]){case _0xa9c5('0x81'):if(_0x360c31[_0xa9c5('0x53')][_0xa9c5('0x82')]&&_0x360c31[_0xa9c5('0x53')][_0xa9c5('0x82')]===_0xa30736[_0xa9c5('0x83')]&&_0x360c31[_0xa9c5('0x53')][_0xa9c5('0x84')]&&_0x360c31['body'][_0xa9c5('0x84')]===_0xa9c5('0x57')){return _0xa30736[_0xa9c5('0x33')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xa9c5('0x2a'),_0xa9c5('0x81'),util[_0xa9c5('0x7f')](_0x360c31[_0xa9c5('0x53')],{'showHidden':![],'depth':null}));}break;}return _0xa30736;}})['then'](respondWithResult(_0x3af10,null))[_0xa9c5('0x28')](handleError(_0x3af10,null));}; \ No newline at end of file +var _0x3478=['format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','email','internal','manual','channel','motionChannel','event','accept','EventManager','acceptmessage','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','SELECT','fullname','interface','SIP/%s','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','send','WhatsappMessage','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','length','attributes','nolimit','sort','where','pick','filter','type','options','includeAll','include','findAll','rows','params','create','body','find','describe','whatsapp-interactions','read','readAt'];(function(_0xd31621,_0x17b567){var _0x2e7ac0=function(_0x3c5a8d){while(--_0x3c5a8d){_0xd31621['push'](_0xd31621['shift']());}};_0x2e7ac0(++_0x17b567);}(_0x3478,0x1c2));var _0x8347=function(_0x4aaa25,_0x1238f0){_0x4aaa25=_0x4aaa25-0x0;var _0x124483=_0x3478[_0x4aaa25];return _0x124483;};'use strict';var emlformat=require(_0x8347('0x0'));var rimraf=require(_0x8347('0x1'));var zipdir=require(_0x8347('0x2'));var jsonpatch=require(_0x8347('0x3'));var rp=require(_0x8347('0x4'));var moment=require('moment');var BPromise=require(_0x8347('0x5'));var Mustache=require(_0x8347('0x6'));var util=require(_0x8347('0x7'));var path=require(_0x8347('0x8'));var sox=require(_0x8347('0x9'));var csv=require(_0x8347('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8347('0xb'));var squel=require(_0x8347('0xc'));var crypto=require(_0x8347('0xd'));var jsforce=require(_0x8347('0xe'));var deskjs=require(_0x8347('0xf'));var toCsv=require(_0x8347('0xa'));var querystring=require(_0x8347('0x10'));var Papa=require(_0x8347('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8347('0x12'));var as=require(_0x8347('0x13'));var hardwareService=require(_0x8347('0x14'));var logger=require(_0x8347('0x15'))(_0x8347('0x16'));var utils=require(_0x8347('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8347('0x18'));var db=require(_0x8347('0x19'))['db'];config[_0x8347('0x1a')]=_[_0x8347('0x1b')](config[_0x8347('0x1a')],{'host':_0x8347('0x1c'),'port':0x18eb});var socket=require(_0x8347('0x1d'))(new Redis(config[_0x8347('0x1a')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x8347('0x1e'));var client=jayson['client'][_0x8347('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x8347('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x873162,_0x2eab61,_0x431a6c,_0x3edd95){return new BPromise(function(_0xa64154,_0x58658e){var _0x3485e9=_0x3edd95||client;return _0x3485e9['request'](_0x873162,_0x431a6c)[_0x8347('0x20')](function(_0x52af2a){logger[_0x8347('0x21')](_0x8347('0x22'),_0x2eab61,_0x8347('0x23'));logger[_0x8347('0x24')](_0x8347('0x25'),_0x2eab61,_0x8347('0x23'),JSON[_0x8347('0x26')](_0x52af2a));if(_0x52af2a[_0x8347('0x27')]){if(_0x52af2a[_0x8347('0x27')]['code']===0x1f4){logger[_0x8347('0x27')](_0x8347('0x22'),_0x2eab61,_0x52af2a[_0x8347('0x27')][_0x8347('0x28')]);return _0x58658e(_0x52af2a[_0x8347('0x27')][_0x8347('0x28')]);}logger[_0x8347('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x2eab61,_0x52af2a[_0x8347('0x27')][_0x8347('0x28')]);return _0xa64154(_0x52af2a['error'][_0x8347('0x28')]);}else{logger[_0x8347('0x21')](_0x8347('0x22'),_0x2eab61,_0x8347('0x23'));_0xa64154(_0x52af2a[_0x8347('0x29')]['message']);}})[_0x8347('0x2a')](function(_0x50abcb){logger[_0x8347('0x27')](_0x8347('0x22'),_0x2eab61,_0x50abcb);_0x58658e(_0x50abcb);});});}function respondWithStatusCode(_0x136015,_0x304009){_0x304009=_0x304009||0xcc;return function(_0x198bed){if(_0x198bed){return _0x136015[_0x8347('0x2b')](_0x304009);}return _0x136015[_0x8347('0x2c')](_0x304009)[_0x8347('0x2d')]();};}function respondWithResult(_0x2fcdb9,_0x371df9){_0x371df9=_0x371df9||0xc8;return function(_0xfaf8f2){if(_0xfaf8f2){return _0x2fcdb9[_0x8347('0x2c')](_0x371df9)['json'](_0xfaf8f2);}};}function respondWithFilteredResult(_0x16c2bc,_0x344765){return function(_0x474860){if(_0x474860){var _0x86ad44=typeof _0x344765[_0x8347('0x2e')]===_0x8347('0x2f')&&typeof _0x344765[_0x8347('0x30')]===_0x8347('0x2f');var _0x4b77c9=_0x474860[_0x8347('0x31')];var _0x5265dd=_0x86ad44?0x0:_0x344765[_0x8347('0x2e')];var _0x1bb824=_0x86ad44?_0x474860['count']:_0x344765['offset']+_0x344765[_0x8347('0x30')];var _0x5db1f3;if(_0x1bb824>=_0x4b77c9){_0x1bb824=_0x4b77c9;_0x5db1f3=0xc8;}else{_0x5db1f3=0xce;}_0x16c2bc[_0x8347('0x2c')](_0x5db1f3);return _0x16c2bc[_0x8347('0x32')](_0x8347('0x33'),_0x5265dd+'-'+_0x1bb824+'/'+_0x4b77c9)['json'](_0x474860);}return null;};}function patchUpdates(_0x1e7d74){return function(_0x453264){try{jsonpatch[_0x8347('0x34')](_0x453264,_0x1e7d74,!![]);}catch(_0x5a47f7){return BPromise[_0x8347('0x35')](_0x5a47f7);}return _0x453264[_0x8347('0x36')]();};}function saveUpdates(_0x42793d,_0x512510){return function(_0x5bad80){if(_0x5bad80){return _0x5bad80[_0x8347('0x37')](_0x42793d)[_0x8347('0x20')](function(_0x3cc84c){return _0x3cc84c;});}return null;};}function removeEntity(_0x13bdeb,_0x120d6a){return function(_0x52c301){if(_0x52c301){return _0x52c301[_0x8347('0x38')]()['then'](function(){_0x13bdeb['status'](0xcc)[_0x8347('0x2d')]();});}};}function handleEntityNotFound(_0x45c80a,_0x2d0545){return function(_0x183ba4){if(!_0x183ba4){_0x45c80a[_0x8347('0x2b')](0x194);}return _0x183ba4;};}function handleError(_0x5a86d9,_0x54663e){_0x54663e=_0x54663e||0x1f4;return function(_0x534f6f){logger[_0x8347('0x27')](_0x534f6f['stack']);if(_0x534f6f[_0x8347('0x39')]){delete _0x534f6f[_0x8347('0x39')];}_0x5a86d9['status'](_0x54663e)[_0x8347('0x3a')](_0x534f6f);};}exports['index']=function(_0x54e8a7,_0x38d06a){var _0xbe7a67={},_0x2b90a2={},_0x38791f={'count':0x0,'rows':[]};var _0x2b320d=_['map'](db[_0x8347('0x3b')][_0x8347('0x3c')],function(_0x1e3747){return{'name':_0x1e3747[_0x8347('0x3d')],'type':_0x1e3747['type']['key']};});_0x2b90a2[_0x8347('0x3e')]=_[_0x8347('0x3f')](_0x2b320d,_0x8347('0x39'));_0x2b90a2[_0x8347('0x40')]=_[_0x8347('0x41')](_0x54e8a7['query']);_0x2b90a2[_0x8347('0x42')]=_[_0x8347('0x43')](_0x2b90a2[_0x8347('0x3e')],_0x2b90a2[_0x8347('0x40')]);_0xbe7a67['attributes']=_[_0x8347('0x43')](_0x2b90a2[_0x8347('0x3e')],qs[_0x8347('0x44')](_0x54e8a7['query'][_0x8347('0x44')]));_0xbe7a67['attributes']=_0xbe7a67['attributes'][_0x8347('0x45')]?_0xbe7a67[_0x8347('0x46')]:_0x2b90a2[_0x8347('0x3e')];if(!_0x54e8a7[_0x8347('0x40')]['hasOwnProperty'](_0x8347('0x47'))){_0xbe7a67[_0x8347('0x30')]=qs[_0x8347('0x30')](_0x54e8a7[_0x8347('0x40')][_0x8347('0x30')]);_0xbe7a67[_0x8347('0x2e')]=qs['offset'](_0x54e8a7[_0x8347('0x40')][_0x8347('0x2e')]);}_0xbe7a67['order']=qs[_0x8347('0x48')](_0x54e8a7[_0x8347('0x40')]['sort']);_0xbe7a67[_0x8347('0x49')]=qs['filters'](_[_0x8347('0x4a')](_0x54e8a7['query'],_0x2b90a2[_0x8347('0x42')]),_0x2b320d);if(_0x54e8a7[_0x8347('0x40')][_0x8347('0x4b')]){_0xbe7a67[_0x8347('0x49')]=_['merge'](_0xbe7a67[_0x8347('0x49')],{'$or':_[_0x8347('0x3f')](_0x2b320d,function(_0x4dd810){if(_0x4dd810[_0x8347('0x4c')]!=='VIRTUAL'){var _0x51c6df={};_0x51c6df[_0x4dd810['name']]={'$like':'%'+_0x54e8a7[_0x8347('0x40')][_0x8347('0x4b')]+'%'};return _0x51c6df;}})});}_0xbe7a67=_['merge']({},_0xbe7a67,_0x54e8a7[_0x8347('0x4d')]);var _0x56f465={'where':_0xbe7a67['where']};return db[_0x8347('0x3b')]['count'](_0x56f465)['then'](function(_0x27cc65){_0x38791f['count']=_0x27cc65;if(_0x54e8a7[_0x8347('0x40')][_0x8347('0x4e')]){_0xbe7a67[_0x8347('0x4f')]=[{'all':!![]}];}return db[_0x8347('0x3b')][_0x8347('0x50')](_0xbe7a67);})[_0x8347('0x20')](function(_0xcf9eea){_0x38791f[_0x8347('0x51')]=_0xcf9eea;return _0x38791f;})[_0x8347('0x20')](respondWithFilteredResult(_0x38d06a,_0xbe7a67))[_0x8347('0x2a')](handleError(_0x38d06a,null));};exports['show']=function(_0x16f118,_0x37d19a){var _0x54b225={'raw':!![],'where':{'id':_0x16f118[_0x8347('0x52')]['id']}},_0x4b6933={};_0x4b6933[_0x8347('0x3e')]=_[_0x8347('0x41')](db[_0x8347('0x3b')]['rawAttributes']);_0x4b6933['query']=_['keys'](_0x16f118[_0x8347('0x40')]);_0x4b6933[_0x8347('0x42')]=_[_0x8347('0x43')](_0x4b6933[_0x8347('0x3e')],_0x4b6933[_0x8347('0x40')]);_0x54b225[_0x8347('0x46')]=_[_0x8347('0x43')](_0x4b6933[_0x8347('0x3e')],qs['fields'](_0x16f118['query'][_0x8347('0x44')]));_0x54b225['attributes']=_0x54b225['attributes']['length']?_0x54b225[_0x8347('0x46')]:_0x4b6933[_0x8347('0x3e')];if(_0x16f118['query'][_0x8347('0x4e')]){_0x54b225[_0x8347('0x4f')]=[{'all':!![]}];}_0x54b225=_['merge']({},_0x54b225,_0x16f118[_0x8347('0x4d')]);return db[_0x8347('0x3b')]['find'](_0x54b225)[_0x8347('0x20')](handleEntityNotFound(_0x37d19a,null))[_0x8347('0x20')](respondWithResult(_0x37d19a,null))[_0x8347('0x2a')](handleError(_0x37d19a,null));};exports[_0x8347('0x53')]=function(_0x4b02fe,_0x317029){return db[_0x8347('0x3b')][_0x8347('0x53')](_0x4b02fe[_0x8347('0x54')],{})[_0x8347('0x20')](respondWithResult(_0x317029,0xc9))['catch'](handleError(_0x317029,null));};exports['update']=function(_0x444cfe,_0x3f79cd){if(_0x444cfe['body']['id']){delete _0x444cfe['body']['id'];}return db[_0x8347('0x3b')][_0x8347('0x55')]({'where':{'id':_0x444cfe[_0x8347('0x52')]['id']}})[_0x8347('0x20')](handleEntityNotFound(_0x3f79cd,null))[_0x8347('0x20')](saveUpdates(_0x444cfe[_0x8347('0x54')],null))[_0x8347('0x20')](respondWithResult(_0x3f79cd,null))[_0x8347('0x2a')](handleError(_0x3f79cd,null));};exports[_0x8347('0x38')]=function(_0x45f706,_0xa82da6){return db[_0x8347('0x3b')][_0x8347('0x55')]({'where':{'id':_0x45f706[_0x8347('0x52')]['id']}})['then'](handleEntityNotFound(_0xa82da6,null))[_0x8347('0x20')](removeEntity(_0xa82da6,null))['catch'](handleError(_0xa82da6,null));};exports[_0x8347('0x56')]=function(_0x6f81e1,_0x4b2016){return db[_0x8347('0x3b')][_0x8347('0x56')]()[_0x8347('0x20')](respondWithResult(_0x4b2016,null))[_0x8347('0x2a')](handleError(_0x4b2016,null));};var interaction_log=require('../../config/logger')(_0x8347('0x57'));exports['accept']=function(_0x478139,_0x1f1e1a,_0x2d3348){var _0x115bee={'agent':{},'channel':'whatsapp'};if(_0x478139[_0x8347('0x54')]['id']){delete _0x478139[_0x8347('0x54')]['id'];}_0x478139[_0x8347('0x54')][_0x8347('0x58')]=!![];_0x478139[_0x8347('0x54')][_0x8347('0x59')]=moment()[_0x8347('0x5a')](_0x8347('0x5b'));_0x478139[_0x8347('0x54')][_0x8347('0x5c')]=_0x478139['body']['UserId']||_0x478139[_0x8347('0x5d')]['id'];_0x115bee[_0x8347('0x5e')]['id']=_0x478139[_0x8347('0x54')]['UserId'];return db[_0x8347('0x3b')][_0x8347('0x55')]({'where':{'id':_0x478139[_0x8347('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1f1e1a,null))[_0x8347('0x20')](saveUpdates(_0x478139[_0x8347('0x54')],null))[_0x8347('0x20')](function(_0x3376c3){if(_0x3376c3){_0x115bee[_0x8347('0x28')]=_0x3376c3[_0x8347('0x5f')]({'plain':!![]});return db[_0x8347('0x60')][_0x8347('0x55')]({'where':{'id':_0x3376c3[_0x8347('0x61')]}});}return null;})[_0x8347('0x20')](handleEntityNotFound(_0x1f1e1a,null))[_0x8347('0x20')](function(_0x5cc1b9){if(_0x5cc1b9){return _0x5cc1b9[_0x8347('0x37')]({'UserId':_0x478139['body']['UserId'],'read1stAt':_['isNil'](_0x5cc1b9[_0x8347('0x62')])?moment()['format'](_0x8347('0x5b')):undefined});}return null;})[_0x8347('0x20')](function(_0x101cdd){if(_0x101cdd){_0x115bee[_0x8347('0x63')]=_0x101cdd[_0x8347('0x5f')]({'plain':!![]});interaction_log[_0x8347('0x21')](_0x8347('0x64'),_0x478139[_0x8347('0x5d')]['id'],_0x478139['user'][_0x8347('0x39')],_0x478139[_0x8347('0x5d')][_0x8347('0x65')],_0x115bee['interaction']['id'],_0x478139[_0x8347('0x54')]?JSON[_0x8347('0x26')](_0x478139[_0x8347('0x54')]):'null');return respondWithRpcPromise(_0x8347('0x66'),_0x8347('0x67'),_0x115bee);}return null;})[_0x8347('0x20')](function(_0xb71799){var _0x4ed210=_0x8347('0x68')+_0xb71799['message'][_0x8347('0x69')];return db[_0x8347('0x6a')][_0x8347('0x40')](_0x4ed210,{'type':db[_0x8347('0x6b')][_0x8347('0x6c')]['SELECT'],'raw':!![]})['then'](function(_0x3f50dc){return _0x3f50dc;});})[_0x8347('0x20')](function(_0x375474){if(_0x375474){_0x115bee[_0x8347('0x28')][_0x8347('0x6d')]=_0x375474[0x0];if(!_0x478139['body'][_0x8347('0x5c')])return;return db[_0x8347('0x6e')][_0x8347('0x55')]({'where':{'id':_0x478139[_0x8347('0x54')][_0x8347('0x5c')],'role':'agent'},'attributes':['id',_0x8347('0x39'),'fullname',_0x8347('0x6f'),_0x8347('0x70')],'raw':!![]});}return null;})[_0x8347('0x20')](function(_0xcf4029){if(!_0xcf4029)return null;_0x115bee[_0x8347('0x28')][_0x8347('0x5e')]=_0xcf4029;return _0x115bee;})[_0x8347('0x20')](function(_0x43c58c){if(_0x43c58c){if(_0x478139[_0x8347('0x54')][_0x8347('0x71')]){_0x115bee[_0x8347('0x28')]['interface']=util[_0x8347('0x5a')]('SIP/%s',_0x478139[_0x8347('0x5d')][_0x8347('0x39')]);_0x115bee['message'][_0x8347('0x72')]=_0x115bee[_0x8347('0x72')];_0x115bee[_0x8347('0x28')][_0x8347('0x73')]=_0x115bee['channel'];_0x115bee[_0x8347('0x28')][_0x8347('0x74')]=_0x8347('0x75');return respondWithRpcPromise(_0x8347('0x76'),'EventManager',{'event':_0x8347('0x77'),'message':_0x115bee[_0x8347('0x28')]},client9002)[_0x8347('0x20')](function(){return _0x115bee;});}return _0x115bee;}return null;})[_0x8347('0x20')](respondWithResult(_0x1f1e1a,null))['catch'](handleError(_0x1f1e1a,null));};var interaction_log=require(_0x8347('0x15'))(_0x8347('0x57'));exports[_0x8347('0x35')]=function(_0x4e70b1,_0x192ed2,_0x2679f3){var _0x532e27={'agent':{},'channel':_0x8347('0x78')};if(_0x4e70b1[_0x8347('0x54')]['id']){delete _0x4e70b1['body']['id'];}_0x4e70b1['body']['UserId']=_0x4e70b1[_0x8347('0x54')][_0x8347('0x5c')]||_0x4e70b1[_0x8347('0x5d')]['id'];_0x532e27[_0x8347('0x5e')]['id']=_0x4e70b1[_0x8347('0x54')][_0x8347('0x5c')];return db[_0x8347('0x3b')][_0x8347('0x55')]({'where':{'id':_0x4e70b1[_0x8347('0x52')]['id'],'UserId':null}})[_0x8347('0x20')](handleEntityNotFound(_0x192ed2,null))[_0x8347('0x20')](function(_0x20ad59){if(_0x20ad59){_0x532e27[_0x8347('0x28')]=_0x20ad59[_0x8347('0x5f')]({'plain':!![]});return db[_0x8347('0x60')][_0x8347('0x55')]({'where':{'id':_0x20ad59['WhatsappInteractionId']}});}return null;})[_0x8347('0x20')](handleEntityNotFound(_0x192ed2,null))['then'](function(_0x3d6767){if(_0x3d6767){_0x532e27[_0x8347('0x63')]=_0x3d6767[_0x8347('0x5f')]({'plain':!![]});interaction_log[_0x8347('0x21')](_0x8347('0x79'),_0x4e70b1[_0x8347('0x5d')]['id'],_0x4e70b1[_0x8347('0x5d')][_0x8347('0x39')],_0x4e70b1[_0x8347('0x5d')][_0x8347('0x65')],_0x532e27['interaction']['id'],_0x4e70b1[_0x8347('0x54')]?JSON[_0x8347('0x26')](_0x4e70b1[_0x8347('0x54')]):_0x8347('0x7a'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x532e27);}return null;})['then'](function(_0x39a900){var _0x57f434=_0x8347('0x68')+_0x39a900[_0x8347('0x28')][_0x8347('0x69')];return db['sequelize']['query'](_0x57f434,{'type':db['Sequelize'][_0x8347('0x6c')][_0x8347('0x7b')],'raw':!![]})[_0x8347('0x20')](function(_0xd144f){return _0xd144f;});})[_0x8347('0x20')](function(_0xf5157f){if(_0xf5157f){_0x532e27['message'][_0x8347('0x6d')]=_0xf5157f[0x0];if(!_0x4e70b1[_0x8347('0x54')][_0x8347('0x5c')])return;return db[_0x8347('0x6e')][_0x8347('0x55')]({'where':{'id':_0x4e70b1[_0x8347('0x54')][_0x8347('0x5c')],'role':_0x8347('0x5e')},'attributes':['id',_0x8347('0x39'),_0x8347('0x7c'),_0x8347('0x6f'),'internal'],'raw':!![]});}return null;})[_0x8347('0x20')](function(_0x858db8){if(!_0x858db8)return null;_0x532e27[_0x8347('0x28')]['agent']=_0x858db8;return _0x532e27;})['then'](function(_0x2a4439){if(_0x2a4439){_0x2a4439[_0x8347('0x28')][_0x8347('0x7d')]=util[_0x8347('0x5a')](_0x8347('0x7e'),_0x4e70b1[_0x8347('0x5d')][_0x8347('0x39')]);_0x2a4439['message'][_0x8347('0x72')]=_0x532e27[_0x8347('0x72')];_0x2a4439[_0x8347('0x28')][_0x8347('0x73')]=_0x532e27['channel'];_0x2a4439[_0x8347('0x28')][_0x8347('0x74')]=_0x8347('0x35');respondWithRpcPromise(_0x8347('0x76'),_0x8347('0x76'),{'event':'rejectmessage','message':_0x2a4439[_0x8347('0x28')]},client9002);return _0x532e27;}return null;})[_0x8347('0x20')](respondWithResult(_0x192ed2,null))[_0x8347('0x2a')](handleError(_0x192ed2,null));};exports[_0x8347('0x2c')]=function(_0x3d7068,_0x2bf622,_0xf73e4c){if(_0x3d7068[_0x8347('0x54')]['id']){delete _0x3d7068[_0x8347('0x54')]['id'];}var _0x35b4b6;return db['WhatsappMessage']['find']({'where':{'id':_0x3d7068[_0x8347('0x52')]['id']}})[_0x8347('0x20')](handleEntityNotFound(_0x2bf622,null))[_0x8347('0x20')](function(_0x5c4403){if(_0x5c4403){_0x35b4b6=_0x5c4403;return db[_0x8347('0x7f')][_0x8347('0x55')]({'where':{'id':_0x5c4403[_0x8347('0x80')]}});}})[_0x8347('0x20')](handleEntityNotFound(_0x2bf622,null))[_0x8347('0x20')](function(_0x511bad){if(_0x511bad){logger['debug'](_0x8347('0x81'),_0x8347('0x2c'),_0x8347('0x82'),_0x511bad[_0x8347('0x4c')],util[_0x8347('0x83')](_0x3d7068[_0x8347('0x54')],{'showHidden':![],'depth':null}));switch(_0x511bad[_0x8347('0x4c')]){case _0x8347('0x84'):if(_0x3d7068[_0x8347('0x54')]['MessageSid']&&_0x3d7068[_0x8347('0x54')]['MessageSid']===_0x35b4b6['messageId']&&_0x3d7068[_0x8347('0x54')][_0x8347('0x85')]&&_0x3d7068[_0x8347('0x54')][_0x8347('0x85')]===_0x8347('0x58')){return _0x35b4b6[_0x8347('0x37')]({'read':!![]});}else{logger['error'](_0x8347('0x86'),'status',_0x8347('0x84'),util[_0x8347('0x83')](_0x3d7068[_0x8347('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x35b4b6;}})[_0x8347('0x20')](respondWithResult(_0x2bf622,null))[_0x8347('0x2a')](handleError(_0x2bf622,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 4dcaa9d..bdad585 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 _0x04b8=['exports','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x1f8685,_0x31b799){var _0x144705=function(_0x4840b8){while(--_0x4840b8){_0x1f8685['push'](_0x1f8685['shift']());}};_0x144705(++_0x31b799);}(_0x04b8,0x159));var _0x804b=function(_0x73df09,_0x5b217b){_0x73df09=_0x73df09-0x0;var _0x2c23a0=_0x04b8[_0x73df09];return _0x2c23a0;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x804b('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x804b('0x1')](0x0);var events={'afterCreate':_0x804b('0x2'),'afterUpdate':'update','afterDestroy':_0x804b('0x3')};function emitEvent(_0x1cd188){return function(_0x5857dc,_0x3530f6,_0x1c3474){WhatsappMessageEvents[_0x804b('0x4')](_0x1cd188+':'+_0x5857dc['id'],_0x5857dc);WhatsappMessageEvents['emit'](_0x1cd188,_0x5857dc);_0x1c3474(null);};}for(var e in events){if(events[_0x804b('0x5')](e)){var event=events[e];WhatsappMessage[_0x804b('0x6')](e,emitEvent(event));}}module[_0x804b('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x174b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xb5e297,_0x457634){var _0x34d9fa=function(_0x54df2d){while(--_0x54df2d){_0xb5e297['push'](_0xb5e297['shift']());}};_0x34d9fa(++_0x457634);}(_0x174b,0x19d));var _0xb174=function(_0x459035,_0x38838c){_0x459035=_0x459035-0x0;var _0x535e96=_0x174b[_0x459035];return _0x535e96;};'use strict';var EventEmitter=require(_0xb174('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xb174('0x1')](0x0);var events={'afterCreate':_0xb174('0x2'),'afterUpdate':_0xb174('0x3'),'afterDestroy':_0xb174('0x4')};function emitEvent(_0xe89462){return function(_0x3c1d7d,_0x553d1b,_0x515f54){WhatsappMessageEvents[_0xb174('0x5')](_0xe89462+':'+_0x3c1d7d['id'],_0x3c1d7d);WhatsappMessageEvents[_0xb174('0x5')](_0xe89462,_0x3c1d7d);_0x515f54(null);};}for(var e in events){if(events[_0xb174('0x6')](e)){var event=events[e];WhatsappMessage[_0xb174('0x7')](e,emitEvent(event));}}module[_0xb174('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 1d2e970..a4fcb38 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 _0xcf1e=['baseUrl','/whatsapp/v1/','/messages/','POST','application/json','statuses','err','finally','utf8mb4','utf8mb4_unicode_ci','util','bluebird','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','catch','error','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','create','body','whatsapp:','/api/whatsapp/messages/','token','update','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch'];(function(_0x3d07f2,_0x19854d){var _0x26052a=function(_0x213834){while(--_0x213834){_0x3d07f2['push'](_0x3d07f2['shift']());}};_0x26052a(++_0x19854d);}(_0xcf1e,0x192));var _0xecf1=function(_0x2e235e,_0x52674c){_0x2e235e=_0x2e235e-0x0;var _0xdc541d=_0xcf1e[_0x2e235e];return _0xdc541d;};'use strict';var _=require('lodash');var util=require(_0xecf1('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xecf1('0x1'));var rp=require('request-promise');var fetch=require(_0xecf1('0x2'));var fs=require('fs');var path=require(_0xecf1('0x3'));var rimraf=require(_0xecf1('0x4'));var config=require(_0xecf1('0x5'));var attributes=require(_0xecf1('0x6'));module[_0xecf1('0x7')]=function(_0x2cf23f,_0x4b4964){return _0x2cf23f[_0xecf1('0x8')](_0xecf1('0x9'),attributes,{'tableName':_0xecf1('0xa'),'paranoid':![],'indexes':[{'name':_0xecf1('0xb'),'fields':['messageId']},{'name':_0xecf1('0xc'),'fields':['body'],'type':_0xecf1('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57f041,_0x3a107b,_0x95b7ae){var _0x345555=_0x2cf23f[_0xecf1('0xe')];var _0x19f06b=_0x57f041[_0xecf1('0xf')]({'plain':!![]});if(_0x19f06b[_0xecf1('0x10')]['toLowerCase']()==='in'||_0x19f06b[_0xecf1('0x10')][_0xecf1('0x11')]()===_0xecf1('0x12')&&!_0x19f06b[_0xecf1('0x13')]&&!_['isNil'](_0x19f06b[_0xecf1('0x14')])){_0x345555[_0xecf1('0x15')][_0xecf1('0x16')]({'where':{'id':_0x19f06b[_0xecf1('0x17')]}})[_0xecf1('0x18')](function(_0x588e0a){if(_0x588e0a){_0x588e0a['update']({'lastMsgAt':_0x19f06b['createdAt'],'lastMsgDirection':_0x19f06b['direction'][_0xecf1('0x11')]()});}})[_0xecf1('0x19')](function(_0x235f4d){console[_0xecf1('0x1a')](_0x235f4d);});}if(_0x19f06b[_0xecf1('0x10')]===_0xecf1('0x12')&&!_0x19f06b['secret']){var _0x16c4b7;_0x345555['WhatsappAccount'][_0xecf1('0x1b')]({'where':{'id':_0x19f06b[_0xecf1('0x1c')]},'raw':!![]})[_0xecf1('0x18')](function(_0x4f6995){_0x16c4b7=_0x4f6995;if(_0x16c4b7&&_0x16c4b7[_0xecf1('0x1d')]){switch(_0x16c4b7[_0xecf1('0x1d')]){case _0xecf1('0x1e'):var _0x2c53a2=require(_0xecf1('0x1e'));if(_0x16c4b7[_0xecf1('0x1f')]&&_0x16c4b7[_0xecf1('0x20')]&&_0x16c4b7[_0xecf1('0x21')]){var _0x1d85cc=new _0x2c53a2(_0x16c4b7[_0xecf1('0x1f')],_0x16c4b7['authToken']);_0x1d85cc['messages'][_0xecf1('0x22')]({'body':_0x19f06b[_0xecf1('0x23')],'to':'whatsapp:'+_0x19f06b[_0xecf1('0x21')],'from':_0xecf1('0x24')+_0x16c4b7[_0xecf1('0x21')],'statusCallback':_0x16c4b7['remote']+_0xecf1('0x25')+_0x19f06b['id']+'/status?token='+_0x16c4b7[_0xecf1('0x26')]})[_0xecf1('0x18')](function(_0x7b3773){if(_0x7b3773['sid']){return _0x57f041[_0xecf1('0x27')]({'messageId':_0x7b3773[_0xecf1('0x28')]});}})[_0xecf1('0x19')](function(_0x29c3fe){logger[_0xecf1('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xecf1('0x29'),_0xecf1('0x1e'),util[_0xecf1('0x2a')](_0x29c3fe,{'showHidden':![],'depth':null}));});}else{logger[_0xecf1('0x1a')](_0xecf1('0x2b'),_0xecf1('0x29'),_0xecf1('0x1e'),_0xecf1('0x2c'));}break;case _0xecf1('0x2d'):var _0x3720e8=_0x16c4b7[_0xecf1('0x1f')];var _0x7d3d60=_0x16c4b7['authToken'];var _0x4c71ab=_0x16c4b7[_0xecf1('0x2e')]+_0xecf1('0x2f')+_0x3720e8+_0xecf1('0x30');var _0x29e6d6={'to':[_0x19f06b[_0xecf1('0x21')]],'message':{'type':'text','text':_0x19f06b[_0xecf1('0x23')]}};var _0xe3223a={'method':_0xecf1('0x31'),'uri':_0x4c71ab,'headers':{'Authorization':'Bearer\x20'+_0x7d3d60,'Content-Type':_0xecf1('0x32')},'body':_0x29e6d6,'json':!![]};rp(_0xe3223a)[_0xecf1('0x18')](function(_0xf4864f){if(_0xf4864f[_0xecf1('0x33')][0x0]['message_id']){return _0x57f041[_0xecf1('0x27')]({'messageId':_0xf4864f[_0xecf1('0x33')][0x0]['message_id']});}})[_0xecf1('0x19')](function(_0x2377e8){logger[_0xecf1('0x34')]('WhatsappMessage,\x20%s',_0x2377e8);});break;}}})[_0xecf1('0x35')](function(){_0x95b7ae();});}else{_0x95b7ae();}}},'charset':_0xecf1('0x36'),'collate':_0xecf1('0x37')});}; \ No newline at end of file +var _0xb7f2=['token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','whatsapp:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb7f2,0x15a));var _0x2b7f=function(_0x516851,_0x57cb02){_0x516851=_0x516851-0x0;var _0x3633d4=_0xb7f2[_0x516851];return _0x3633d4;};'use strict';var _=require(_0x2b7f('0x0'));var util=require('util');var logger=require(_0x2b7f('0x1'))('api');var moment=require(_0x2b7f('0x2'));var BPromise=require(_0x2b7f('0x3'));var rp=require(_0x2b7f('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x2b7f('0x5'));var rimraf=require('rimraf');var config=require(_0x2b7f('0x6'));var attributes=require(_0x2b7f('0x7'));module[_0x2b7f('0x8')]=function(_0x1863fc,_0x21a805){return _0x1863fc[_0x2b7f('0x9')](_0x2b7f('0xa'),attributes,{'tableName':_0x2b7f('0xb'),'paranoid':![],'indexes':[{'name':_0x2b7f('0xc'),'fields':[_0x2b7f('0xc')]},{'name':_0x2b7f('0xd'),'fields':[_0x2b7f('0xe')],'type':_0x2b7f('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f8e61,_0x5742f7,_0x3abb70){var _0x518d79=_0x1863fc['models'];var _0x2e405a=_0x2f8e61[_0x2b7f('0x10')]({'plain':!![]});if(_0x2e405a[_0x2b7f('0x11')]['toLowerCase']()==='in'||_0x2e405a[_0x2b7f('0x11')][_0x2b7f('0x12')]()==='out'&&!_0x2e405a['secret']&&!_[_0x2b7f('0x13')](_0x2e405a['UserId'])){_0x518d79[_0x2b7f('0x14')][_0x2b7f('0x15')]({'where':{'id':_0x2e405a[_0x2b7f('0x16')]}})[_0x2b7f('0x17')](function(_0x37e329){if(_0x37e329){_0x37e329[_0x2b7f('0x18')]({'lastMsgAt':_0x2e405a[_0x2b7f('0x19')],'lastMsgDirection':_0x2e405a[_0x2b7f('0x11')][_0x2b7f('0x12')]()});}})[_0x2b7f('0x1a')](function(_0x5ad693){console[_0x2b7f('0x1b')](_0x5ad693);});}if(_0x2e405a[_0x2b7f('0x11')]===_0x2b7f('0x1c')&&!_0x2e405a['secret']){var _0x180b0b;_0x518d79[_0x2b7f('0x1d')][_0x2b7f('0x1e')]({'where':{'id':_0x2e405a[_0x2b7f('0x1f')]},'raw':!![]})[_0x2b7f('0x17')](function(_0x4256be){_0x180b0b=_0x4256be;if(_0x180b0b&&_0x180b0b['type']){switch(_0x180b0b[_0x2b7f('0x20')]){case'twilio':var _0x50de75=require(_0x2b7f('0x21'));if(_0x180b0b[_0x2b7f('0x22')]&&_0x180b0b[_0x2b7f('0x23')]&&_0x180b0b[_0x2b7f('0x24')]){var _0x5664ad=new _0x50de75(_0x180b0b['accountSid'],_0x180b0b[_0x2b7f('0x23')]);_0x5664ad[_0x2b7f('0x25')]['create']({'body':_0x2e405a['body'],'to':'whatsapp:'+_0x2e405a['phone'],'from':_0x2b7f('0x26')+_0x180b0b['phone'],'statusCallback':_0x180b0b['remote']+'/api/whatsapp/messages/'+_0x2e405a['id']+'/status?token='+_0x180b0b[_0x2b7f('0x27')]})['then'](function(_0xe1152e){if(_0xe1152e[_0x2b7f('0x28')]){return _0x2f8e61[_0x2b7f('0x18')]({'messageId':_0xe1152e[_0x2b7f('0x28')]});}})[_0x2b7f('0x1a')](function(_0x23fee7){logger[_0x2b7f('0x1b')](_0x2b7f('0x29'),_0x2b7f('0x2a'),_0x2b7f('0x21'),util[_0x2b7f('0x2b')](_0x23fee7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2b7f('0x29'),_0x2b7f('0x2a'),_0x2b7f('0x21'),_0x2b7f('0x2c'));}break;case _0x2b7f('0x2d'):var _0x4eff13=_0x180b0b[_0x2b7f('0x22')];var _0x9f3048=_0x180b0b[_0x2b7f('0x23')];var _0x21d49d=_0x180b0b['baseUrl']+_0x2b7f('0x2e')+_0x4eff13+'/messages/';var _0x12b10d={'to':[_0x2e405a[_0x2b7f('0x24')]],'message':{'type':'text','text':_0x2e405a[_0x2b7f('0xe')]}};var _0x247266={'method':_0x2b7f('0x2f'),'uri':_0x21d49d,'headers':{'Authorization':'Bearer\x20'+_0x9f3048,'Content-Type':_0x2b7f('0x30')},'body':_0x12b10d,'json':!![]};rp(_0x247266)[_0x2b7f('0x17')](function(_0x544739){if(_0x544739[_0x2b7f('0x31')][0x0]['message_id']){return _0x2f8e61['update']({'messageId':_0x544739['statuses'][0x0][_0x2b7f('0x32')]});}})[_0x2b7f('0x1a')](function(_0xa2cdce){logger[_0x2b7f('0x33')](_0x2b7f('0x34'),_0xa2cdce);});break;}}})[_0x2b7f('0x35')](function(){_0x3abb70();});}else{_0x3abb70();}}},'charset':_0x2b7f('0x36'),'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 950d95c..f82157b 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 _0xf69e=['util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','create','body','options','raw','CreateWhatsappMessage','debug','stringify','lodash'];(function(_0x4db88d,_0x467b52){var _0x146f89=function(_0x50947a){while(--_0x50947a){_0x4db88d['push'](_0x4db88d['shift']());}};_0x146f89(++_0x467b52);}(_0xf69e,0xdf));var _0xef69=function(_0x5e9a1b,_0x4e397c){_0x5e9a1b=_0x5e9a1b-0x0;var _0x4462a7=_0xf69e[_0x5e9a1b];return _0x4462a7;};'use strict';var _=require(_0xef69('0x0'));var util=require(_0xef69('0x1'));var moment=require(_0xef69('0x2'));var BPromise=require(_0xef69('0x3'));var rs=require(_0xef69('0x4'));var fs=require('fs');var Redis=require(_0xef69('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xef69('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xef69('0x7'));var client=jayson[_0xef69('0x8')][_0xef69('0x9')]({'port':0x232a});config[_0xef69('0xa')]=_[_0xef69('0xb')](config[_0xef69('0xa')],{'host':_0xef69('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappMessage.socket')[_0xef69('0xd')](socket);function respondWithRpcPromise(_0x2c5efa,_0x1ce72d,_0x1bba11){return new BPromise(function(_0x1485b6,_0x385a1a){return client[_0xef69('0xe')](_0x2c5efa,_0x1bba11)[_0xef69('0xf')](function(_0x439a4a){logger[_0xef69('0x10')](_0xef69('0x11'),_0x1ce72d,'request\x20sent');logger['debug'](_0xef69('0x12'),_0x1ce72d,_0xef69('0x13'),JSON['stringify'](_0x439a4a));if(_0x439a4a[_0xef69('0x14')]){if(_0x439a4a['error'][_0xef69('0x15')]===0x1f4){logger[_0xef69('0x14')](_0xef69('0x11'),_0x1ce72d,_0x439a4a[_0xef69('0x14')]['message']);return _0x385a1a(_0x439a4a[_0xef69('0x14')][_0xef69('0x16')]);}logger[_0xef69('0x14')](_0xef69('0x11'),_0x1ce72d,_0x439a4a[_0xef69('0x14')][_0xef69('0x16')]);return _0x1485b6(_0x439a4a['error'][_0xef69('0x16')]);}else{logger[_0xef69('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x1ce72d,_0xef69('0x13'));_0x1485b6(_0x439a4a[_0xef69('0x17')][_0xef69('0x16')]);}})[_0xef69('0x18')](function(_0x1c4892){logger[_0xef69('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x1ce72d,_0x1c4892);_0x385a1a(_0x1c4892);});});}exports['CreateWhatsappMessage']=function(_0x125030){var _0x3018bd=this;return new Promise(function(_0x2fe790,_0x30283f){return db['WhatsappMessage'][_0xef69('0x19')](_0x125030[_0xef69('0x1a')],{'raw':_0x125030[_0xef69('0x1b')]?_0x125030['options'][_0xef69('0x1c')]===undefined?!![]:![]:!![]})[_0xef69('0xf')](function(_0x51637e){logger['info'](_0xef69('0x1d'),_0x125030);logger[_0xef69('0x1e')](_0xef69('0x1d'),_0x125030,JSON[_0xef69('0x1f')](_0x51637e));_0x2fe790(_0x51637e);})[_0xef69('0x18')](function(_0x318caf){logger[_0xef69('0x14')](_0xef69('0x1d'),_0x318caf[_0xef69('0x16')],_0x125030);_0x30283f(_0x3018bd[_0xef69('0x14')](0x1f4,_0x318caf[_0xef69('0x16')]));});});}; \ No newline at end of file +var _0x28e7=['../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./whatsappMessage.socket','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappMessage','body','options','then','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x42f0d1,_0x45fe4a){var _0x43f981=function(_0x5882e8){while(--_0x5882e8){_0x42f0d1['push'](_0x42f0d1['shift']());}};_0x43f981(++_0x45fe4a);}(_0x28e7,0x1bb));var _0x728e=function(_0x6a38ee,_0x454645){_0x6a38ee=_0x6a38ee-0x0;var _0x1d4ebb=_0x28e7[_0x6a38ee];return _0x1d4ebb;};'use strict';var _=require(_0x728e('0x0'));var util=require('util');var moment=require(_0x728e('0x1'));var BPromise=require(_0x728e('0x2'));var rs=require(_0x728e('0x3'));var fs=require('fs');var Redis=require(_0x728e('0x4'));var db=require(_0x728e('0x5'))['db'];var utils=require(_0x728e('0x6'));var logger=require(_0x728e('0x7'))(_0x728e('0x8'));var config=require(_0x728e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x728e('0xa')]({'port':0x232a});config[_0x728e('0xb')]=_[_0x728e('0xc')](config['redis'],{'host':_0x728e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x728e('0xb')]));require(_0x728e('0xe'))['register'](socket);function respondWithRpcPromise(_0x3d5ae7,_0x118659,_0x3f31a0){return new BPromise(function(_0x13ff36,_0x2c432b){return client[_0x728e('0xf')](_0x3d5ae7,_0x3f31a0)['then'](function(_0x3fef66){logger[_0x728e('0x10')](_0x728e('0x11'),_0x118659,_0x728e('0x12'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x118659,'request\x20sent',JSON[_0x728e('0x13')](_0x3fef66));if(_0x3fef66[_0x728e('0x14')]){if(_0x3fef66[_0x728e('0x14')][_0x728e('0x15')]===0x1f4){logger['error'](_0x728e('0x11'),_0x118659,_0x3fef66[_0x728e('0x14')][_0x728e('0x16')]);return _0x2c432b(_0x3fef66['error'][_0x728e('0x16')]);}logger[_0x728e('0x14')](_0x728e('0x11'),_0x118659,_0x3fef66[_0x728e('0x14')][_0x728e('0x16')]);return _0x13ff36(_0x3fef66['error'][_0x728e('0x16')]);}else{logger[_0x728e('0x10')](_0x728e('0x11'),_0x118659,_0x728e('0x12'));_0x13ff36(_0x3fef66[_0x728e('0x17')][_0x728e('0x16')]);}})[_0x728e('0x18')](function(_0x19caa0){logger['error'](_0x728e('0x11'),_0x118659,_0x19caa0);_0x2c432b(_0x19caa0);});});}exports[_0x728e('0x19')]=function(_0x1385a8){var _0x43215a=this;return new Promise(function(_0x29fcc8,_0x5460f6){return db['WhatsappMessage']['create'](_0x1385a8[_0x728e('0x1a')],{'raw':_0x1385a8[_0x728e('0x1b')]?_0x1385a8['options']['raw']===undefined?!![]:![]:!![]})[_0x728e('0x1c')](function(_0x35ed6d){logger[_0x728e('0x10')](_0x728e('0x19'),_0x1385a8);logger[_0x728e('0x1d')](_0x728e('0x19'),_0x1385a8,JSON[_0x728e('0x13')](_0x35ed6d));_0x29fcc8(_0x35ed6d);})[_0x728e('0x18')](function(_0x247e62){logger[_0x728e('0x14')]('CreateWhatsappMessage',_0x247e62[_0x728e('0x16')],_0x1385a8);_0x5460f6(_0x43215a[_0x728e('0x14')](0x1f4,_0x247e62[_0x728e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 1355169..b02be1f 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 _0xa48a=['emit','length','whatsappMessage:','./whatsappMessage.events','save','remove','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa48a,0x7a));var _0xaa48=function(_0x5defd7,_0x786911){_0x5defd7=_0x5defd7-0x0;var _0x11b880=_0xa48a[_0x5defd7];return _0x11b880;};'use strict';var WhatsappMessageEvents=require(_0xaa48('0x0'));var events=[_0xaa48('0x1'),_0xaa48('0x2'),_0xaa48('0x3')];function createListener(_0x497889,_0x2ddead){return function(_0x23382e){_0x2ddead[_0xaa48('0x4')](_0x497889,_0x23382e);};}function removeListener(_0x432de2,_0xc6e07){return function(){WhatsappMessageEvents['removeListener'](_0x432de2,_0xc6e07);};}exports['register']=function(_0x47e1f3){for(var _0x27b2f2=0x0,_0xa99d3b=events[_0xaa48('0x5')];_0x27b2f2<_0xa99d3b;_0x27b2f2++){var _0x5937e6=events[_0x27b2f2];var _0x4becf9=createListener(_0xaa48('0x6')+_0x5937e6,_0x47e1f3);WhatsappMessageEvents['on'](_0x5937e6,_0x4becf9);}}; \ No newline at end of file +var _0xd764=['./whatsappMessage.events','save','remove','update','removeListener','register','length'];(function(_0x385a5e,_0x4a3ea8){var _0x3f1661=function(_0x2ab9b5){while(--_0x2ab9b5){_0x385a5e['push'](_0x385a5e['shift']());}};_0x3f1661(++_0x4a3ea8);}(_0xd764,0x7e));var _0x4d76=function(_0x4b1459,_0x3d4ae9){_0x4b1459=_0x4b1459-0x0;var _0x41bba4=_0xd764[_0x4b1459];return _0x41bba4;};'use strict';var WhatsappMessageEvents=require(_0x4d76('0x0'));var events=[_0x4d76('0x1'),_0x4d76('0x2'),_0x4d76('0x3')];function createListener(_0x148cae,_0x524e33){return function(_0x4c2772){_0x524e33['emit'](_0x148cae,_0x4c2772);};}function removeListener(_0x361b9b,_0x284c0c){return function(){WhatsappMessageEvents[_0x4d76('0x4')](_0x361b9b,_0x284c0c);};}exports[_0x4d76('0x5')]=function(_0x10d7cf){for(var _0x37815a=0x0,_0xd188bb=events[_0x4d76('0x6')];_0x37815a<_0xd188bb;_0x37815a++){var _0x2040b5=events[_0x37815a];var _0xf3fd2c=createListener('whatsappMessage:'+_0x2040b5,_0x10d7cf);WhatsappMessageEvents['on'](_0x2040b5,_0xf3fd2c);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 532b170..2c56abf 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 _0xb167=['getTeams','/:id/users','getAgents','post','addAgents','update','delete','destroy','removeTeams','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb167,0x1c9));var _0x7b16=function(_0x5d02ba,_0x12d4c0){_0x5d02ba=_0x5d02ba-0x0;var _0x3b44cc=_0xb167[_0x5d02ba];return _0x3b44cc;};'use strict';var multer=require(_0x7b16('0x0'));var util=require(_0x7b16('0x1'));var path=require(_0x7b16('0x2'));var timeout=require(_0x7b16('0x3'));var express=require('express');var router=express[_0x7b16('0x4')]();var fs_extra=require(_0x7b16('0x5'));var auth=require(_0x7b16('0x6'));var interaction=require(_0x7b16('0x7'));var config=require(_0x7b16('0x8'));var controller=require('./whatsappQueue.controller');router[_0x7b16('0x9')]('/',auth[_0x7b16('0xa')](),controller[_0x7b16('0xb')]);router[_0x7b16('0x9')](_0x7b16('0xc'),auth[_0x7b16('0xa')](),controller[_0x7b16('0xd')]);router[_0x7b16('0x9')](_0x7b16('0xe'),auth[_0x7b16('0xa')](),controller[_0x7b16('0xf')]);router[_0x7b16('0x9')](_0x7b16('0x10'),auth[_0x7b16('0xa')](),controller[_0x7b16('0x11')]);router[_0x7b16('0x9')](_0x7b16('0x12'),auth['isAuthenticated'](),controller[_0x7b16('0x13')]);router[_0x7b16('0x9')](_0x7b16('0x14'),auth[_0x7b16('0xa')](),controller[_0x7b16('0x15')]);router[_0x7b16('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7b16('0x16')](_0x7b16('0x12'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x7b16('0x14'),auth['isAuthenticated'](),controller[_0x7b16('0x17')]);router['put'](_0x7b16('0xe'),auth[_0x7b16('0xa')](),controller[_0x7b16('0x18')]);router[_0x7b16('0x19')](_0x7b16('0xe'),auth[_0x7b16('0xa')](),controller[_0x7b16('0x1a')]);router['delete'](_0x7b16('0x12'),auth['isAuthenticated'](),controller[_0x7b16('0x1b')]);router['delete'](_0x7b16('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x62a0=['delete','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','update','destroy','removeTeams'];(function(_0x1f52f5,_0x404fcc){var _0x3921be=function(_0x3085b5){while(--_0x3085b5){_0x1f52f5['push'](_0x1f52f5['shift']());}};_0x3921be(++_0x404fcc);}(_0x62a0,0x11a));var _0x062a=function(_0x5aa0a1,_0x58d7d4){_0x5aa0a1=_0x5aa0a1-0x0;var _0x38934b=_0x62a0[_0x5aa0a1];return _0x38934b;};'use strict';var multer=require('multer');var util=require(_0x062a('0x0'));var path=require(_0x062a('0x1'));var timeout=require(_0x062a('0x2'));var express=require('express');var router=express[_0x062a('0x3')]();var fs_extra=require(_0x062a('0x4'));var auth=require(_0x062a('0x5'));var interaction=require(_0x062a('0x6'));var config=require(_0x062a('0x7'));var controller=require(_0x062a('0x8'));router[_0x062a('0x9')]('/',auth[_0x062a('0xa')](),controller[_0x062a('0xb')]);router['get'](_0x062a('0xc'),auth['isAuthenticated'](),controller[_0x062a('0xd')]);router['get'](_0x062a('0xe'),auth[_0x062a('0xa')](),controller[_0x062a('0xf')]);router['get'](_0x062a('0x10'),auth[_0x062a('0xa')](),controller[_0x062a('0x11')]);router[_0x062a('0x9')](_0x062a('0x12'),auth[_0x062a('0xa')](),controller['getTeams']);router[_0x062a('0x9')](_0x062a('0x13'),auth[_0x062a('0xa')](),controller[_0x062a('0x14')]);router[_0x062a('0x15')]('/',auth[_0x062a('0xa')](),controller[_0x062a('0x16')]);router[_0x062a('0x15')](_0x062a('0x12'),auth[_0x062a('0xa')](),controller[_0x062a('0x17')]);router[_0x062a('0x15')]('/:id/users',auth[_0x062a('0xa')](),controller[_0x062a('0x18')]);router['put'](_0x062a('0xe'),auth[_0x062a('0xa')](),controller[_0x062a('0x19')]);router['delete'](_0x062a('0xe'),auth[_0x062a('0xa')](),controller[_0x062a('0x1a')]);router['delete'](_0x062a('0x12'),auth[_0x062a('0xa')](),controller[_0x062a('0x1b')]);router[_0x062a('0x1c')]('/:id/users',auth['isAuthenticated'](),controller[_0x062a('0x1d')]);module[_0x062a('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 53a6aa1..8b87008 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 _0x6ff1=['rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x4e86a9,_0xa48c11){var _0xe19410=function(_0x580c3d){while(--_0x580c3d){_0x4e86a9['push'](_0x4e86a9['shift']());}};_0xe19410(++_0xa48c11);}(_0x6ff1,0x10a));var _0x16ff=function(_0x34e15d,_0xdaa148){_0x34e15d=_0x34e15d-0x0;var _0x460d2e=_0x6ff1[_0x34e15d];return _0x460d2e;};'use strict';var Sequelize=require(_0x16ff('0x0'));module[_0x16ff('0x1')]={'name':{'type':Sequelize[_0x16ff('0x2')],'unique':_0x16ff('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x16ff('0x4'),'beepall',_0x16ff('0x5'))},'description':{'type':Sequelize[_0x16ff('0x2')]}}; \ No newline at end of file +var _0x9567=['INTEGER','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x1d3791,_0x51c613){var _0x40fbf5=function(_0xe5d147){while(--_0xe5d147){_0x1d3791['push'](_0x1d3791['shift']());}};_0x40fbf5(++_0x51c613);}(_0x9567,0xdc));var _0x7956=function(_0xa3db86,_0x1e6212){_0xa3db86=_0xa3db86-0x0;var _0x54a7e7=_0x9567[_0xa3db86];return _0x54a7e7;};'use strict';var Sequelize=require(_0x7956('0x0'));module[_0x7956('0x1')]={'name':{'type':Sequelize[_0x7956('0x2')],'unique':_0x7956('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7956('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x7956('0x5'),_0x7956('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 6523854..85df75c 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 _0x16bb=['findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','%s/%s','SIP','getTeams','Team','options','online','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','end','error','name','map','rawAttributes','fieldName','type','key','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','WhatsappQueue','includeAll','include','findAll','rows','catch','show','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User'];(function(_0x6afa07,_0xc2859e){var _0x3a9c2d=function(_0x36c13b){while(--_0x36c13b){_0x6afa07['push'](_0x6afa07['shift']());}};_0x3a9c2d(++_0xc2859e);}(_0x16bb,0x1cc));var _0xb16b=function(_0x2e5eac,_0xc1f49c){_0x2e5eac=_0x2e5eac-0x0;var _0x3fb2ec=_0x16bb[_0x2e5eac];return _0x3fb2ec;};'use strict';var emlformat=require(_0xb16b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb16b('0x1'));var jsonpatch=require(_0xb16b('0x2'));var rp=require(_0xb16b('0x3'));var moment=require('moment');var BPromise=require(_0xb16b('0x4'));var Mustache=require(_0xb16b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb16b('0x6'));var ejs=require(_0xb16b('0x7'));var fs=require('fs');var fs_extra=require(_0xb16b('0x8'));var _=require(_0xb16b('0x9'));var squel=require(_0xb16b('0xa'));var crypto=require(_0xb16b('0xb'));var jsforce=require(_0xb16b('0xc'));var deskjs=require(_0xb16b('0xd'));var toCsv=require(_0xb16b('0x6'));var querystring=require(_0xb16b('0xe'));var Papa=require(_0xb16b('0xf'));var Redis=require(_0xb16b('0x10'));var authService=require(_0xb16b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb16b('0x12'))(_0xb16b('0x13'));var utils=require('../../config/utils');var config=require(_0xb16b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb16b('0x15'))['db'];config[_0xb16b('0x16')]=_[_0xb16b('0x17')](config[_0xb16b('0x16')],{'host':_0xb16b('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x5788be,_0x154d4e){_0x154d4e=_0x154d4e||0xcc;return function(_0x44d11a){if(_0x44d11a){return _0x5788be[_0xb16b('0x19')](_0x154d4e);}return _0x5788be[_0xb16b('0x1a')](_0x154d4e)['end']();};}function respondWithResult(_0x591ec2,_0xaf4862){_0xaf4862=_0xaf4862||0xc8;return function(_0x29ef09){if(_0x29ef09){return _0x591ec2['status'](_0xaf4862)[_0xb16b('0x1b')](_0x29ef09);}};}function respondWithFilteredResult(_0x54dd8d,_0xaa9ad4){return function(_0x5bb7f9){if(_0x5bb7f9){var _0x5a1f59=typeof _0xaa9ad4[_0xb16b('0x1c')]===_0xb16b('0x1d')&&typeof _0xaa9ad4[_0xb16b('0x1e')]==='undefined';var _0x5cd4b7=_0x5bb7f9[_0xb16b('0x1f')];var _0x158d9a=_0x5a1f59?0x0:_0xaa9ad4[_0xb16b('0x1c')];var _0x51ca36=_0x5a1f59?_0x5bb7f9[_0xb16b('0x1f')]:_0xaa9ad4[_0xb16b('0x1c')]+_0xaa9ad4[_0xb16b('0x1e')];var _0x50ba25;if(_0x51ca36>=_0x5cd4b7){_0x51ca36=_0x5cd4b7;_0x50ba25=0xc8;}else{_0x50ba25=0xce;}_0x54dd8d['status'](_0x50ba25);return _0x54dd8d['set'](_0xb16b('0x20'),_0x158d9a+'-'+_0x51ca36+'/'+_0x5cd4b7)[_0xb16b('0x1b')](_0x5bb7f9);}return null;};}function patchUpdates(_0x114332){return function(_0x467a90){try{jsonpatch[_0xb16b('0x21')](_0x467a90,_0x114332,!![]);}catch(_0x548243){return BPromise[_0xb16b('0x22')](_0x548243);}return _0x467a90[_0xb16b('0x23')]();};}function saveUpdates(_0x4996c7,_0x291ecd){return function(_0x4b1c20){if(_0x4b1c20){return _0x4b1c20[_0xb16b('0x24')](_0x4996c7)[_0xb16b('0x25')](function(_0x36f356){return _0x36f356;});}return null;};}function removeEntity(_0x2e7b5f,_0x18413e){return function(_0xc3f5a6){if(_0xc3f5a6){return _0xc3f5a6[_0xb16b('0x26')]()[_0xb16b('0x25')](function(){var _0x1e8c37=_0xc3f5a6[_0xb16b('0x27')]({'plain':!![]});var _0x19a7af=_0xb16b('0x28');return db['UserProfileResource'][_0xb16b('0x26')]({'where':{'type':_0x19a7af,'resourceId':_0x1e8c37['id']}})[_0xb16b('0x25')](function(){return _0xc3f5a6;});})[_0xb16b('0x25')](function(){_0x2e7b5f[_0xb16b('0x1a')](0xcc)[_0xb16b('0x29')]();});}};}function handleEntityNotFound(_0x25ee9d,_0x494545){return function(_0x2300cb){if(!_0x2300cb){_0x25ee9d[_0xb16b('0x19')](0x194);}return _0x2300cb;};}function handleError(_0x40f5fc,_0x5cde42){_0x5cde42=_0x5cde42||0x1f4;return function(_0x3929b8){logger[_0xb16b('0x2a')](_0x3929b8['stack']);if(_0x3929b8[_0xb16b('0x2b')]){delete _0x3929b8[_0xb16b('0x2b')];}_0x40f5fc[_0xb16b('0x1a')](_0x5cde42)['send'](_0x3929b8);};}exports['index']=function(_0x4189af,_0x3b59fd){var _0x1e1dbc={},_0x1eeef3={},_0x5e613a={'count':0x0,'rows':[]};var _0x59c931=_[_0xb16b('0x2c')](db['WhatsappQueue'][_0xb16b('0x2d')],function(_0x229931){return{'name':_0x229931[_0xb16b('0x2e')],'type':_0x229931[_0xb16b('0x2f')][_0xb16b('0x30')]};});_0x1eeef3['model']=_['map'](_0x59c931,_0xb16b('0x2b'));_0x1eeef3['query']=_[_0xb16b('0x31')](_0x4189af[_0xb16b('0x32')]);_0x1eeef3[_0xb16b('0x33')]=_['intersection'](_0x1eeef3[_0xb16b('0x34')],_0x1eeef3[_0xb16b('0x32')]);_0x1e1dbc['attributes']=_[_0xb16b('0x35')](_0x1eeef3[_0xb16b('0x34')],qs['fields'](_0x4189af[_0xb16b('0x32')][_0xb16b('0x36')]));_0x1e1dbc['attributes']=_0x1e1dbc[_0xb16b('0x37')][_0xb16b('0x38')]?_0x1e1dbc[_0xb16b('0x37')]:_0x1eeef3[_0xb16b('0x34')];if(!_0x4189af[_0xb16b('0x32')][_0xb16b('0x39')](_0xb16b('0x3a'))){_0x1e1dbc[_0xb16b('0x1e')]=qs['limit'](_0x4189af['query']['limit']);_0x1e1dbc[_0xb16b('0x1c')]=qs[_0xb16b('0x1c')](_0x4189af[_0xb16b('0x32')][_0xb16b('0x1c')]);}_0x1e1dbc[_0xb16b('0x3b')]=qs[_0xb16b('0x3c')](_0x4189af[_0xb16b('0x32')][_0xb16b('0x3c')]);_0x1e1dbc[_0xb16b('0x3d')]=qs[_0xb16b('0x33')](_[_0xb16b('0x3e')](_0x4189af[_0xb16b('0x32')],_0x1eeef3[_0xb16b('0x33')]),_0x59c931);if(_0x4189af['query'][_0xb16b('0x3f')]){_0x1e1dbc[_0xb16b('0x3d')]=_['merge'](_0x1e1dbc['where'],{'$or':_[_0xb16b('0x2c')](_0x59c931,function(_0x22bab5){if(_0x22bab5[_0xb16b('0x2f')]!==_0xb16b('0x40')){var _0x40e877={};_0x40e877[_0x22bab5[_0xb16b('0x2b')]]={'$like':'%'+_0x4189af[_0xb16b('0x32')][_0xb16b('0x3f')]+'%'};return _0x40e877;}})});}_0x1e1dbc=_[_0xb16b('0x41')]({},_0x1e1dbc,_0x4189af['options']);var _0x50333e={'where':_0x1e1dbc[_0xb16b('0x3d')]};return db[_0xb16b('0x42')][_0xb16b('0x1f')](_0x50333e)[_0xb16b('0x25')](function(_0x322c2a){_0x5e613a[_0xb16b('0x1f')]=_0x322c2a;if(_0x4189af[_0xb16b('0x32')][_0xb16b('0x43')]){_0x1e1dbc[_0xb16b('0x44')]=[{'all':!![]}];}return db[_0xb16b('0x42')][_0xb16b('0x45')](_0x1e1dbc);})[_0xb16b('0x25')](function(_0x4c70ff){_0x5e613a[_0xb16b('0x46')]=_0x4c70ff;return _0x5e613a;})[_0xb16b('0x25')](respondWithFilteredResult(_0x3b59fd,_0x1e1dbc))[_0xb16b('0x47')](handleError(_0x3b59fd,null));};exports[_0xb16b('0x48')]=function(_0xccfa88,_0x4264f3){var _0x20594d={'raw':!![],'where':{'id':_0xccfa88['params']['id']}},_0x21e745={};_0x21e745[_0xb16b('0x34')]=_[_0xb16b('0x31')](db[_0xb16b('0x42')][_0xb16b('0x2d')]);_0x21e745[_0xb16b('0x32')]=_[_0xb16b('0x31')](_0xccfa88[_0xb16b('0x32')]);_0x21e745[_0xb16b('0x33')]=_[_0xb16b('0x35')](_0x21e745[_0xb16b('0x34')],_0x21e745['query']);_0x20594d[_0xb16b('0x37')]=_['intersection'](_0x21e745[_0xb16b('0x34')],qs['fields'](_0xccfa88[_0xb16b('0x32')]['fields']));_0x20594d['attributes']=_0x20594d['attributes']['length']?_0x20594d['attributes']:_0x21e745[_0xb16b('0x34')];if(_0xccfa88[_0xb16b('0x32')]['includeAll']){_0x20594d[_0xb16b('0x44')]=[{'all':!![]}];}_0x20594d=_[_0xb16b('0x41')]({},_0x20594d,_0xccfa88['options']);return db[_0xb16b('0x42')][_0xb16b('0x49')](_0x20594d)['then'](handleEntityNotFound(_0x4264f3,null))[_0xb16b('0x25')](respondWithResult(_0x4264f3,null))[_0xb16b('0x47')](handleError(_0x4264f3,null));};exports[_0xb16b('0x4a')]=function(_0xbfa6cb,_0x1e9dfa){return db[_0xb16b('0x42')][_0xb16b('0x4a')](_0xbfa6cb[_0xb16b('0x4b')],{})[_0xb16b('0x25')](function(_0x367f13){var _0x5d171b=_0xbfa6cb[_0xb16b('0x4c')][_0xb16b('0x27')]({'plain':!![]});if(!_0x5d171b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d171b['role']===_0xb16b('0x4c')){var _0x10ca27=_0x367f13[_0xb16b('0x27')]({'plain':!![]});var _0x412e8d='WhatsappQueues';return db[_0xb16b('0x4d')][_0xb16b('0x49')]({'where':{'name':_0x412e8d,'userProfileId':_0x5d171b[_0xb16b('0x4e')]},'raw':!![]})[_0xb16b('0x25')](function(_0x14e68e){if(_0x14e68e&&_0x14e68e[_0xb16b('0x4f')]===0x0){return db['UserProfileResource'][_0xb16b('0x4a')]({'name':_0x10ca27[_0xb16b('0x2b')],'resourceId':_0x10ca27['id'],'type':_0x14e68e['name'],'sectionId':_0x14e68e['id']},{})[_0xb16b('0x25')](function(){return _0x367f13;});}else{return _0x367f13;}})[_0xb16b('0x47')](function(_0x4d04af){logger[_0xb16b('0x2a')](_0xb16b('0x50'),_0x4d04af);throw _0x4d04af;});}return _0x367f13;})[_0xb16b('0x25')](respondWithResult(_0x1e9dfa,0xc9))['catch'](handleError(_0x1e9dfa,null));};exports['update']=function(_0x43c35d,_0x3ed0ee){if(_0x43c35d[_0xb16b('0x4b')]['id']){delete _0x43c35d['body']['id'];}return db[_0xb16b('0x42')][_0xb16b('0x49')]({'where':{'id':_0x43c35d[_0xb16b('0x51')]['id']}})[_0xb16b('0x25')](handleEntityNotFound(_0x3ed0ee,null))[_0xb16b('0x25')](saveUpdates(_0x43c35d['body'],null))[_0xb16b('0x25')](respondWithResult(_0x3ed0ee,null))[_0xb16b('0x47')](handleError(_0x3ed0ee,null));};exports['destroy']=function(_0x3e60be,_0x22501b){return db[_0xb16b('0x42')][_0xb16b('0x49')]({'where':{'id':_0x3e60be['params']['id']}})['then'](handleEntityNotFound(_0x22501b,null))[_0xb16b('0x25')](removeEntity(_0x22501b,null))[_0xb16b('0x47')](handleError(_0x22501b,null));};exports['describe']=function(_0x564840,_0x5dc7be){return db[_0xb16b('0x42')][_0xb16b('0x52')]()[_0xb16b('0x25')](respondWithResult(_0x5dc7be,null))['catch'](handleError(_0x5dc7be,null));};exports[_0xb16b('0x53')]=function(_0x23e02a,_0x3a168d,_0x565a4f){var _0x7b4c79={'raw':!![],'where':{}},_0x10b6cc={},_0x4683e5;return db[_0xb16b('0x42')][_0xb16b('0x54')]({'where':{'id':_0x23e02a[_0xb16b('0x51')]['id']}})[_0xb16b('0x25')](handleEntityNotFound(_0x3a168d,null))[_0xb16b('0x25')](function(_0x2a1e07){if(_0x2a1e07){_0x4683e5=_0x2a1e07[_0xb16b('0x27')]({'plain':!![]});_0x10b6cc[_0xb16b('0x34')]=_[_0xb16b('0x31')](db[_0xb16b('0x55')][_0xb16b('0x2d')]);_0x10b6cc[_0xb16b('0x32')]=_[_0xb16b('0x31')](_0x23e02a['query']);_0x10b6cc[_0xb16b('0x33')]=_['intersection'](_0x10b6cc['model'],_0x10b6cc['query']);_0x7b4c79['attributes']=_['intersection'](_0x10b6cc[_0xb16b('0x34')],qs['fields'](_0x23e02a[_0xb16b('0x32')][_0xb16b('0x36')]));_0x7b4c79['attributes']=_0x7b4c79[_0xb16b('0x37')]['length']?_0x7b4c79[_0xb16b('0x37')]:_0x10b6cc[_0xb16b('0x34')];if(!_0x23e02a[_0xb16b('0x32')][_0xb16b('0x39')](_0xb16b('0x3a'))){_0x7b4c79[_0xb16b('0x1e')]=qs[_0xb16b('0x1e')](_0x23e02a['query'][_0xb16b('0x1e')]);_0x7b4c79['offset']=qs['offset'](_0x23e02a[_0xb16b('0x32')][_0xb16b('0x1c')]);}_0x7b4c79[_0xb16b('0x3b')]=qs[_0xb16b('0x3c')](_0x23e02a[_0xb16b('0x32')]['sort']);_0x7b4c79[_0xb16b('0x3d')]=qs[_0xb16b('0x33')](_[_0xb16b('0x3e')](_0x23e02a[_0xb16b('0x32')],_0x10b6cc[_0xb16b('0x33')]));_0x7b4c79[_0xb16b('0x3d')][_0xb16b('0x56')]=_0x2a1e07['id'];if(_0x23e02a[_0xb16b('0x32')][_0xb16b('0x3f')]){_0x7b4c79['where']=_[_0xb16b('0x41')](_0x7b4c79[_0xb16b('0x3d')],{'$or':_['map'](_0x7b4c79[_0xb16b('0x37')],function(_0x1b5eaa){var _0x3a04db={};_0x3a04db[_0x1b5eaa]={'$like':'%'+_0x23e02a[_0xb16b('0x32')][_0xb16b('0x3f')]+'%'};return _0x3a04db;})});}_0x7b4c79=_[_0xb16b('0x41')]({},_0x7b4c79,_0x23e02a['options']);return db['UserWhatsappQueue'][_0xb16b('0x45')](_0x7b4c79);}})[_0xb16b('0x25')](function(_0x383d78){if(_0x383d78){return db[_0xb16b('0x57')][_0xb16b('0x58')]({'where':{'id':_[_0xb16b('0x2c')](_0x383d78,_0xb16b('0x59')),'role':_0xb16b('0x5a')},'attributes':['id',_0xb16b('0x2b'),_0xb16b('0x5b'),_0xb16b('0x5c'),'createdAt']});}})[_0xb16b('0x25')](function(_0x577368){if(_0x577368){return{'count':_0x577368[_0xb16b('0x1f')],'rows':_[_0xb16b('0x2c')](_0x577368[_0xb16b('0x46')],function(_0x5ebb6c){return{'membername':_0x5ebb6c[_0xb16b('0x2b')],'UserId':_0x5ebb6c['id'],'queue_name':_0x4683e5[_0xb16b('0x2b')],'WhatsappQueueId':_0x4683e5['id'],'interface':util[_0xb16b('0x5d')](_0xb16b('0x5e'),_0xb16b('0x5f'),_0x5ebb6c[_0xb16b('0x2b')]),'penalty':0x0,'paused':_0x5ebb6c[_0xb16b('0x5b')],'createdAt':_0x5ebb6c['createdAt'],'updatedAt':_0x5ebb6c[_0xb16b('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb16b('0x25')](respondWithFilteredResult(_0x3a168d,_0x7b4c79))[_0xb16b('0x47')](handleError(_0x3a168d,null));};exports[_0xb16b('0x60')]=function(_0x5abf80,_0x362836,_0x74f8a0){var _0x49675d={};var _0x160040={};var _0x2a661b;var _0x531464;return db[_0xb16b('0x42')][_0xb16b('0x54')]({'where':{'id':_0x5abf80[_0xb16b('0x51')]['id']}})[_0xb16b('0x25')](handleEntityNotFound(_0x362836,null))['then'](function(_0x41b95c){if(_0x41b95c){_0x2a661b=_0x41b95c;_0x160040['model']=_[_0xb16b('0x31')](db[_0xb16b('0x61')][_0xb16b('0x2d')]);_0x160040[_0xb16b('0x32')]=_[_0xb16b('0x31')](_0x5abf80['query']);_0x160040['filters']=_['intersection'](_0x160040[_0xb16b('0x34')],_0x160040[_0xb16b('0x32')]);_0x49675d['attributes']=_[_0xb16b('0x35')](_0x160040[_0xb16b('0x34')],qs[_0xb16b('0x36')](_0x5abf80[_0xb16b('0x32')][_0xb16b('0x36')]));_0x49675d[_0xb16b('0x37')]=_0x49675d[_0xb16b('0x37')]['length']?_0x49675d[_0xb16b('0x37')]:_0x160040[_0xb16b('0x34')];_0x49675d['order']=qs[_0xb16b('0x3c')](_0x5abf80[_0xb16b('0x32')][_0xb16b('0x3c')]);_0x49675d['where']=qs['filters'](_[_0xb16b('0x3e')](_0x5abf80[_0xb16b('0x32')],_0x160040[_0xb16b('0x33')]));if(_0x5abf80[_0xb16b('0x32')][_0xb16b('0x3f')]){_0x49675d[_0xb16b('0x3d')]=_[_0xb16b('0x41')](_0x49675d[_0xb16b('0x3d')],{'$or':_[_0xb16b('0x2c')](_0x49675d[_0xb16b('0x37')],function(_0xa13c88){var _0x33ab44={};_0x33ab44[_0xa13c88]={'$like':'%'+_0x5abf80[_0xb16b('0x32')]['filter']+'%'};return _0x33ab44;})});}_0x49675d=_[_0xb16b('0x41')]({},_0x49675d,_0x5abf80[_0xb16b('0x62')]);return _0x2a661b['getTeams'](_0x49675d);}})['then'](function(_0x32be37){if(_0x32be37){_0x531464=_0x32be37['length'];if(!_0x5abf80['query'][_0xb16b('0x39')]('nolimit')){_0x49675d[_0xb16b('0x1e')]=qs[_0xb16b('0x1e')](_0x5abf80[_0xb16b('0x32')][_0xb16b('0x1e')]);_0x49675d['offset']=qs[_0xb16b('0x1c')](_0x5abf80[_0xb16b('0x32')][_0xb16b('0x1c')]);}return _0x2a661b['getTeams'](_0x49675d);}})[_0xb16b('0x25')](function(_0x3d27a1){if(_0x3d27a1){return _0x3d27a1?{'count':_0x531464,'rows':_0x3d27a1}:null;}})['then'](respondWithResult(_0x362836,null))['catch'](handleError(_0x362836,null));};exports['addTeams']=function(_0x42fde0,_0x2cdf5d,_0x2caddc){var _0x37b026=_0x42fde0[_0xb16b('0x4b')]['ids'];return db[_0xb16b('0x61')][_0xb16b('0x45')]({'where':{'id':_0x37b026},'attributes':['id'],'include':[{'model':db[_0xb16b('0x57')],'as':'Agents','attributes':['id',_0xb16b('0x2b'),_0xb16b('0x63'),'voicePause','interface'],'raw':!![]}]})[_0xb16b('0x25')](function(_0x5367e1){if(_0x5367e1){var _0x2f06e1=_[_0xb16b('0x64')](_0x5367e1,function(_0x40fe26){var _0x5b8dc0=_0x40fe26[_0xb16b('0x27')]({'plain':!![]});return _0x5b8dc0[_0xb16b('0x65')];});return db[_0xb16b('0x42')][_0xb16b('0x49')]({'where':{'id':_0x42fde0[_0xb16b('0x51')]['id']}})['then'](function(_0x295d9c){return db[_0xb16b('0x66')][_0xb16b('0x67')](function(_0x2e7bbb){return _0x295d9c['addTeams'](_0x37b026,{'transaction':_0x2e7bbb})[_0xb16b('0x25')](function(){return BPromise['each'](_0x2f06e1,function(_0x3a00d5){return db[_0xb16b('0x55')][_0xb16b('0x68')]({'where':{'UserId':_0x3a00d5['id'],'WhatsappQueueId':_0x42fde0[_0xb16b('0x51')]['id']},'transaction':_0x2e7bbb});});})['then'](function(){_0x2f06e1[_0xb16b('0x69')](function(_0x151d79){socket[_0xb16b('0x6a')](_0xb16b('0x6b'),{'UserId':_0x151d79['id'],'WhatsappQueueId':_0x295d9c['id']});});});});});}})[_0xb16b('0x25')](respondWithStatusCode(_0x2cdf5d,null))['catch'](handleError(_0x2cdf5d,null));};exports[_0xb16b('0x6c')]=function(_0x47442e,_0x4e3b36,_0x2a8d84){return db[_0xb16b('0x61')][_0xb16b('0x45')]({'where':{'id':_0x47442e['query'][_0xb16b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb16b('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb16b('0x25')](handleEntityNotFound(_0x4e3b36,null))[_0xb16b('0x25')](function(_0x41a95e){var _0x40b175=_[_0xb16b('0x2c')](_0x41a95e,'id');var _0x576a12=[];var _0xede929=[];var _0xb33bb2=squel['select']();_0xb33bb2['field'](_0xb16b('0x6e'))[_0xb16b('0x6f')](_0xb16b('0x70'),'tq')[_0xb16b('0x71')](_0xb16b('0x72'),'ut',_0xb16b('0x73'))[_0xb16b('0x3d')](_0xb16b('0x74'),_0x47442e[_0xb16b('0x51')]['id']);for(var _0x2890c1=0x0;_0x2890c1<_0x41a95e[_0xb16b('0x38')];_0x2890c1+=0x1){let _0x4237b5=_0x41a95e[_0x2890c1];for(var _0x4933a8=0x0;_0x4933a8<_0x4237b5[_0xb16b('0x65')][_0xb16b('0x38')];_0x4933a8+=0x1){let _0x5b226a=_0x4237b5[_0xb16b('0x65')][_0x4933a8];var _0x21c93a=_0xb33bb2[_0xb16b('0x75')]();_0x21c93a[_0xb16b('0x3d')](_0xb16b('0x76'),_0x5b226a['id']);_0xede929['push'](db[_0xb16b('0x66')][_0xb16b('0x32')](_0x21c93a[_0xb16b('0x77')](),{'type':db[_0xb16b('0x66')][_0xb16b('0x78')][_0xb16b('0x79')]})[_0xb16b('0x25')](function(_0x58a6df){if(_0x58a6df[_0xb16b('0x38')]===0x1){return _0x5b226a['id'];}else{var _0x642254=_[_0xb16b('0x7a')](_[_0xb16b('0x2c')](_0x58a6df,_0xb16b('0x7b')),function(_0x413c91){return _[_0xb16b('0x7c')](_0x40b175,_0x413c91);});if(_0x642254){return _0x5b226a['id'];}}}));}}return BPromise[_0xb16b('0x7d')](_0xede929)[_0xb16b('0x25')](function(_0x4942a6){_0x576a12=_(_0x576a12)[_0xb16b('0x7e')](_0x4942a6)[_0xb16b('0x7f')]()[_0xb16b('0x80')]();return db[_0xb16b('0x42')]['find']({'where':{'id':_0x47442e[_0xb16b('0x51')]['id']}})[_0xb16b('0x25')](function(_0x1b2b36){return db[_0xb16b('0x66')]['transaction'](function(_0xb29c06){return _0x1b2b36[_0xb16b('0x6c')](_0x47442e[_0xb16b('0x32')]['ids'],{'transaction':_0xb29c06})[_0xb16b('0x25')](function(){if(!_[_0xb16b('0x81')](_0x576a12)){return _0x1b2b36[_0xb16b('0x82')](_0x576a12,{'transaction':_0xb29c06});}})['then'](function(){_0x576a12[_0xb16b('0x69')](function(_0x478fc5){socket['emit'](_0xb16b('0x83'),{'UserId':_0x478fc5,'WhatsappQueueId':_0x1b2b36['id']});});});});});});})['then'](respondWithStatusCode(_0x4e3b36,null))['catch'](handleError(_0x4e3b36,null));};exports[_0xb16b('0x84')]=function(_0x3f8eae,_0x127bae,_0x31c7b9){return db['WhatsappQueue'][_0xb16b('0x49')]({'where':{'id':_0x3f8eae[_0xb16b('0x51')]['id']}})['then'](handleEntityNotFound(_0x127bae,null))[_0xb16b('0x25')](function(_0x59f713){if(_0x59f713){return _0x59f713[_0xb16b('0x84')](_0x3f8eae[_0xb16b('0x4b')]['ids'],_[_0xb16b('0x85')](_0x3f8eae[_0xb16b('0x4b')],[_0xb16b('0x6d'),'id'])||{})[_0xb16b('0x86')](function(_0x27415e){for(var _0x7e5b81=0x0;_0x7e5b81<_0x3f8eae[_0xb16b('0x4b')]['ids']['length'];_0x7e5b81+=0x1){socket[_0xb16b('0x6a')](_0xb16b('0x6b'),{'UserId':Number(_0x3f8eae[_0xb16b('0x4b')][_0xb16b('0x6d')][_0x7e5b81]),'WhatsappQueueId':Number(_0x3f8eae['params']['id'])});}return _0x27415e;});}})[_0xb16b('0x25')](respondWithResult(_0x127bae,null))[_0xb16b('0x47')](handleError(_0x127bae,null));};exports[_0xb16b('0x82')]=function(_0x5ddecf,_0x42aba8,_0x1f378f){return db[_0xb16b('0x42')][_0xb16b('0x49')]({'where':{'id':_0x5ddecf[_0xb16b('0x51')]['id']}})['then'](handleEntityNotFound(_0x42aba8,null))[_0xb16b('0x25')](function(_0x37243d){if(_0x37243d){return _0x37243d[_0xb16b('0x82')](_0x5ddecf['query'][_0xb16b('0x6d')])['then'](function(){if(_[_0xb16b('0x87')](_0x5ddecf[_0xb16b('0x32')]['ids'])){for(var _0x57ac3e=0x0;_0x57ac3e<_0x5ddecf[_0xb16b('0x32')][_0xb16b('0x6d')]['length'];_0x57ac3e+=0x1){socket['emit'](_0xb16b('0x83'),{'UserId':Number(_0x5ddecf['query'][_0xb16b('0x6d')][_0x57ac3e]),'WhatsappQueueId':Number(_0x5ddecf[_0xb16b('0x51')]['id'])});}}else{socket['emit'](_0xb16b('0x83'),{'UserId':Number(_0x5ddecf[_0xb16b('0x32')][_0xb16b('0x6d')]),'WhatsappQueueId':Number(_0x5ddecf[_0xb16b('0x51')]['id'])});}});}})[_0xb16b('0x25')](respondWithStatusCode(_0x42aba8,null))[_0xb16b('0x47')](handleError(_0x42aba8,null));};exports[_0xb16b('0x88')]=function(_0x511cba,_0x3032ec,_0x112734){var _0x2667e5={};var _0x3f8c3a={};var _0x315fb7;var _0x5f50c2;return db['WhatsappQueue'][_0xb16b('0x54')]({'where':{'id':_0x511cba['params']['id']}})[_0xb16b('0x25')](handleEntityNotFound(_0x3032ec,null))['then'](function(_0x4fff46){if(_0x4fff46){_0x315fb7=_0x4fff46;_0x3f8c3a['model']=_['keys'](db[_0xb16b('0x57')][_0xb16b('0x2d')]);_0x3f8c3a['query']=_[_0xb16b('0x31')](_0x511cba['query']);_0x3f8c3a[_0xb16b('0x33')]=_[_0xb16b('0x35')](_0x3f8c3a[_0xb16b('0x34')],_0x3f8c3a[_0xb16b('0x32')]);_0x2667e5[_0xb16b('0x37')]=_[_0xb16b('0x35')](_0x3f8c3a['model'],qs[_0xb16b('0x36')](_0x511cba['query'][_0xb16b('0x36')]));_0x2667e5[_0xb16b('0x37')]=_0x2667e5[_0xb16b('0x37')][_0xb16b('0x38')]?_0x2667e5['attributes']:_0x3f8c3a[_0xb16b('0x34')];_0x2667e5[_0xb16b('0x3b')]=qs[_0xb16b('0x3c')](_0x511cba[_0xb16b('0x32')][_0xb16b('0x3c')]);_0x2667e5[_0xb16b('0x3d')]=qs['filters'](_['pick'](_0x511cba[_0xb16b('0x32')],_0x3f8c3a[_0xb16b('0x33')]));if(_0x511cba[_0xb16b('0x32')]['filter']){_0x2667e5[_0xb16b('0x3d')]=_[_0xb16b('0x41')](_0x2667e5['where'],{'$or':_[_0xb16b('0x2c')](_0x2667e5[_0xb16b('0x37')],function(_0x58558f){var _0x433c94={};_0x433c94[_0x58558f]={'$like':'%'+_0x511cba['query'][_0xb16b('0x3f')]+'%'};return _0x433c94;})});}_0x2667e5=_[_0xb16b('0x41')]({},_0x2667e5,_0x511cba[_0xb16b('0x62')]);return _0x315fb7[_0xb16b('0x88')](_0x2667e5);}})[_0xb16b('0x25')](function(_0x359726){if(_0x359726){_0x5f50c2=_0x359726['length'];if(!_0x511cba[_0xb16b('0x32')]['hasOwnProperty']('nolimit')){_0x2667e5[_0xb16b('0x1e')]=qs[_0xb16b('0x1e')](_0x511cba[_0xb16b('0x32')][_0xb16b('0x1e')]);_0x2667e5[_0xb16b('0x1c')]=qs[_0xb16b('0x1c')](_0x511cba[_0xb16b('0x32')][_0xb16b('0x1c')]);}return _0x315fb7['getAgents'](_0x2667e5);}})[_0xb16b('0x25')](function(_0x3115f2){if(_0x3115f2){return _0x3115f2?{'count':_0x5f50c2,'rows':_0x3115f2}:null;}})[_0xb16b('0x25')](respondWithResult(_0x3032ec,null))[_0xb16b('0x47')](handleError(_0x3032ec,null));}; \ No newline at end of file +var _0xd465=['findOne','UserWhatsappQueue','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','addTeams','online','voicePause','interface','flatMap','Agents','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','sequelize','toString','SELECT','every','TeamId','includes','union','compact','value','transaction','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','emit','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappQueue.socket','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','create','body','user','get','WhatsappQueues','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers'];(function(_0x5e76d9,_0x317195){var _0x12c575=function(_0x4b56b9){while(--_0x4b56b9){_0x5e76d9['push'](_0x5e76d9['shift']());}};_0x12c575(++_0x317195);}(_0xd465,0x1db));var _0x5d46=function(_0x4ba00a,_0x470945){_0x4ba00a=_0x4ba00a-0x0;var _0x3a5eea=_0xd465[_0x4ba00a];return _0x3a5eea;};'use strict';var emlformat=require(_0x5d46('0x0'));var rimraf=require(_0x5d46('0x1'));var zipdir=require(_0x5d46('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d46('0x3'));var moment=require(_0x5d46('0x4'));var BPromise=require(_0x5d46('0x5'));var Mustache=require(_0x5d46('0x6'));var util=require(_0x5d46('0x7'));var path=require('path');var sox=require(_0x5d46('0x8'));var csv=require(_0x5d46('0x9'));var ejs=require(_0x5d46('0xa'));var fs=require('fs');var fs_extra=require(_0x5d46('0xb'));var _=require('lodash');var squel=require(_0x5d46('0xc'));var crypto=require(_0x5d46('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5d46('0xe'));var toCsv=require(_0x5d46('0x9'));var querystring=require(_0x5d46('0xf'));var Papa=require('papaparse');var Redis=require(_0x5d46('0x10'));var authService=require(_0x5d46('0x11'));var qs=require(_0x5d46('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d46('0x13'));var logger=require(_0x5d46('0x14'))(_0x5d46('0x15'));var utils=require(_0x5d46('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5d46('0x17'));var db=require(_0x5d46('0x18'))['db'];config['redis']=_[_0x5d46('0x19')](config[_0x5d46('0x1a')],{'host':_0x5d46('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d46('0x1a')]));require(_0x5d46('0x1c'))['register'](socket);function respondWithStatusCode(_0x3a6f4a,_0xd0e699){_0xd0e699=_0xd0e699||0xcc;return function(_0x177803){if(_0x177803){return _0x3a6f4a['sendStatus'](_0xd0e699);}return _0x3a6f4a[_0x5d46('0x1d')](_0xd0e699)['end']();};}function respondWithResult(_0x14cfda,_0x57bbf9){_0x57bbf9=_0x57bbf9||0xc8;return function(_0x40abe2){if(_0x40abe2){return _0x14cfda[_0x5d46('0x1d')](_0x57bbf9)[_0x5d46('0x1e')](_0x40abe2);}};}function respondWithFilteredResult(_0x256160,_0x16c144){return function(_0x3bc505){if(_0x3bc505){var _0x2920c7=typeof _0x16c144[_0x5d46('0x1f')]===_0x5d46('0x20')&&typeof _0x16c144[_0x5d46('0x21')]===_0x5d46('0x20');var _0x34b5c6=_0x3bc505[_0x5d46('0x22')];var _0x23f71e=_0x2920c7?0x0:_0x16c144[_0x5d46('0x1f')];var _0xe98fb5=_0x2920c7?_0x3bc505[_0x5d46('0x22')]:_0x16c144[_0x5d46('0x1f')]+_0x16c144[_0x5d46('0x21')];var _0xcc9c1c;if(_0xe98fb5>=_0x34b5c6){_0xe98fb5=_0x34b5c6;_0xcc9c1c=0xc8;}else{_0xcc9c1c=0xce;}_0x256160['status'](_0xcc9c1c);return _0x256160[_0x5d46('0x23')](_0x5d46('0x24'),_0x23f71e+'-'+_0xe98fb5+'/'+_0x34b5c6)['json'](_0x3bc505);}return null;};}function patchUpdates(_0x415853){return function(_0x2351e8){try{jsonpatch['apply'](_0x2351e8,_0x415853,!![]);}catch(_0x3dcd83){return BPromise[_0x5d46('0x25')](_0x3dcd83);}return _0x2351e8['save']();};}function saveUpdates(_0x18653c,_0x4c8314){return function(_0x3cc984){if(_0x3cc984){return _0x3cc984[_0x5d46('0x26')](_0x18653c)[_0x5d46('0x27')](function(_0x246ce1){return _0x246ce1;});}return null;};}function removeEntity(_0x3df2d4,_0x2442f5){return function(_0x259fbd){if(_0x259fbd){return _0x259fbd[_0x5d46('0x28')]()[_0x5d46('0x27')](function(){var _0x569547=_0x259fbd['get']({'plain':!![]});var _0x5efda9='WhatsappQueues';return db[_0x5d46('0x29')][_0x5d46('0x28')]({'where':{'type':_0x5efda9,'resourceId':_0x569547['id']}})[_0x5d46('0x27')](function(){return _0x259fbd;});})['then'](function(){_0x3df2d4[_0x5d46('0x1d')](0xcc)[_0x5d46('0x2a')]();});}};}function handleEntityNotFound(_0x23e15f,_0x43e73a){return function(_0x1b5419){if(!_0x1b5419){_0x23e15f[_0x5d46('0x2b')](0x194);}return _0x1b5419;};}function handleError(_0x241815,_0x5632b7){_0x5632b7=_0x5632b7||0x1f4;return function(_0x4d8087){logger[_0x5d46('0x2c')](_0x4d8087[_0x5d46('0x2d')]);if(_0x4d8087[_0x5d46('0x2e')]){delete _0x4d8087[_0x5d46('0x2e')];}_0x241815[_0x5d46('0x1d')](_0x5632b7)[_0x5d46('0x2f')](_0x4d8087);};}exports[_0x5d46('0x30')]=function(_0x2c4a75,_0xe40589){var _0x3c3463={},_0x3edf5d={},_0x6e626d={'count':0x0,'rows':[]};var _0x2f59d9=_[_0x5d46('0x31')](db[_0x5d46('0x32')][_0x5d46('0x33')],function(_0x5af8da){return{'name':_0x5af8da[_0x5d46('0x34')],'type':_0x5af8da['type']['key']};});_0x3edf5d[_0x5d46('0x35')]=_[_0x5d46('0x31')](_0x2f59d9,_0x5d46('0x2e'));_0x3edf5d['query']=_['keys'](_0x2c4a75[_0x5d46('0x36')]);_0x3edf5d['filters']=_[_0x5d46('0x37')](_0x3edf5d[_0x5d46('0x35')],_0x3edf5d[_0x5d46('0x36')]);_0x3c3463[_0x5d46('0x38')]=_[_0x5d46('0x37')](_0x3edf5d[_0x5d46('0x35')],qs[_0x5d46('0x39')](_0x2c4a75[_0x5d46('0x36')][_0x5d46('0x39')]));_0x3c3463[_0x5d46('0x38')]=_0x3c3463[_0x5d46('0x38')][_0x5d46('0x3a')]?_0x3c3463[_0x5d46('0x38')]:_0x3edf5d[_0x5d46('0x35')];if(!_0x2c4a75[_0x5d46('0x36')][_0x5d46('0x3b')](_0x5d46('0x3c'))){_0x3c3463[_0x5d46('0x21')]=qs['limit'](_0x2c4a75[_0x5d46('0x36')]['limit']);_0x3c3463['offset']=qs[_0x5d46('0x1f')](_0x2c4a75[_0x5d46('0x36')]['offset']);}_0x3c3463[_0x5d46('0x3d')]=qs[_0x5d46('0x3e')](_0x2c4a75[_0x5d46('0x36')][_0x5d46('0x3e')]);_0x3c3463['where']=qs[_0x5d46('0x3f')](_[_0x5d46('0x40')](_0x2c4a75[_0x5d46('0x36')],_0x3edf5d['filters']),_0x2f59d9);if(_0x2c4a75[_0x5d46('0x36')]['filter']){_0x3c3463[_0x5d46('0x41')]=_[_0x5d46('0x42')](_0x3c3463[_0x5d46('0x41')],{'$or':_['map'](_0x2f59d9,function(_0x191d56){if(_0x191d56[_0x5d46('0x43')]!==_0x5d46('0x44')){var _0x5a2b0a={};_0x5a2b0a[_0x191d56[_0x5d46('0x2e')]]={'$like':'%'+_0x2c4a75[_0x5d46('0x36')]['filter']+'%'};return _0x5a2b0a;}})});}_0x3c3463=_['merge']({},_0x3c3463,_0x2c4a75[_0x5d46('0x45')]);var _0x5cea0c={'where':_0x3c3463['where']};return db[_0x5d46('0x32')]['count'](_0x5cea0c)['then'](function(_0x512686){_0x6e626d[_0x5d46('0x22')]=_0x512686;if(_0x2c4a75[_0x5d46('0x36')][_0x5d46('0x46')]){_0x3c3463[_0x5d46('0x47')]=[{'all':!![]}];}return db[_0x5d46('0x32')][_0x5d46('0x48')](_0x3c3463);})['then'](function(_0x437ec8){_0x6e626d['rows']=_0x437ec8;return _0x6e626d;})[_0x5d46('0x27')](respondWithFilteredResult(_0xe40589,_0x3c3463))[_0x5d46('0x49')](handleError(_0xe40589,null));};exports[_0x5d46('0x4a')]=function(_0x46c3bb,_0x3c679a){var _0x4dface={'raw':!![],'where':{'id':_0x46c3bb['params']['id']}},_0x4f2d64={};_0x4f2d64['model']=_[_0x5d46('0x4b')](db[_0x5d46('0x32')]['rawAttributes']);_0x4f2d64['query']=_[_0x5d46('0x4b')](_0x46c3bb[_0x5d46('0x36')]);_0x4f2d64[_0x5d46('0x3f')]=_['intersection'](_0x4f2d64[_0x5d46('0x35')],_0x4f2d64[_0x5d46('0x36')]);_0x4dface['attributes']=_['intersection'](_0x4f2d64[_0x5d46('0x35')],qs[_0x5d46('0x39')](_0x46c3bb['query'][_0x5d46('0x39')]));_0x4dface[_0x5d46('0x38')]=_0x4dface[_0x5d46('0x38')][_0x5d46('0x3a')]?_0x4dface[_0x5d46('0x38')]:_0x4f2d64['model'];if(_0x46c3bb[_0x5d46('0x36')][_0x5d46('0x46')]){_0x4dface[_0x5d46('0x47')]=[{'all':!![]}];}_0x4dface=_['merge']({},_0x4dface,_0x46c3bb[_0x5d46('0x45')]);return db['WhatsappQueue']['find'](_0x4dface)[_0x5d46('0x27')](handleEntityNotFound(_0x3c679a,null))[_0x5d46('0x27')](respondWithResult(_0x3c679a,null))[_0x5d46('0x49')](handleError(_0x3c679a,null));};exports[_0x5d46('0x4c')]=function(_0x396f00,_0x2972c5){return db['WhatsappQueue']['create'](_0x396f00[_0x5d46('0x4d')],{})['then'](function(_0x3de5e6){var _0x195992=_0x396f00[_0x5d46('0x4e')][_0x5d46('0x4f')]({'plain':!![]});if(!_0x195992)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x195992['role']===_0x5d46('0x4e')){var _0x4ac4b9=_0x3de5e6[_0x5d46('0x4f')]({'plain':!![]});var _0x21050f=_0x5d46('0x50');return db[_0x5d46('0x51')][_0x5d46('0x52')]({'where':{'name':_0x21050f,'userProfileId':_0x195992[_0x5d46('0x53')]},'raw':!![]})[_0x5d46('0x27')](function(_0x5bb234){if(_0x5bb234&&_0x5bb234[_0x5d46('0x54')]===0x0){return db[_0x5d46('0x29')][_0x5d46('0x4c')]({'name':_0x4ac4b9[_0x5d46('0x2e')],'resourceId':_0x4ac4b9['id'],'type':_0x5bb234[_0x5d46('0x2e')],'sectionId':_0x5bb234['id']},{})['then'](function(){return _0x3de5e6;});}else{return _0x3de5e6;}})['catch'](function(_0x448634){logger['error'](_0x5d46('0x55'),_0x448634);throw _0x448634;});}return _0x3de5e6;})[_0x5d46('0x27')](respondWithResult(_0x2972c5,0xc9))[_0x5d46('0x49')](handleError(_0x2972c5,null));};exports['update']=function(_0xf6a3,_0x4cce53){if(_0xf6a3[_0x5d46('0x4d')]['id']){delete _0xf6a3[_0x5d46('0x4d')]['id'];}return db[_0x5d46('0x32')][_0x5d46('0x52')]({'where':{'id':_0xf6a3[_0x5d46('0x56')]['id']}})[_0x5d46('0x27')](handleEntityNotFound(_0x4cce53,null))[_0x5d46('0x27')](saveUpdates(_0xf6a3[_0x5d46('0x4d')],null))[_0x5d46('0x27')](respondWithResult(_0x4cce53,null))['catch'](handleError(_0x4cce53,null));};exports['destroy']=function(_0x4fa4bd,_0x4ae99f){return db[_0x5d46('0x32')][_0x5d46('0x52')]({'where':{'id':_0x4fa4bd[_0x5d46('0x56')]['id']}})[_0x5d46('0x27')](handleEntityNotFound(_0x4ae99f,null))[_0x5d46('0x27')](removeEntity(_0x4ae99f,null))[_0x5d46('0x49')](handleError(_0x4ae99f,null));};exports['describe']=function(_0x561bc1,_0xa54c1){return db[_0x5d46('0x32')][_0x5d46('0x57')]()[_0x5d46('0x27')](respondWithResult(_0xa54c1,null))['catch'](handleError(_0xa54c1,null));};exports[_0x5d46('0x58')]=function(_0x34d827,_0x3c916e,_0x350e63){var _0x533bb2={'raw':!![],'where':{}},_0x4c9c36={},_0x558e22;return db['WhatsappQueue'][_0x5d46('0x59')]({'where':{'id':_0x34d827[_0x5d46('0x56')]['id']}})['then'](handleEntityNotFound(_0x3c916e,null))[_0x5d46('0x27')](function(_0xc71a44){if(_0xc71a44){_0x558e22=_0xc71a44[_0x5d46('0x4f')]({'plain':!![]});_0x4c9c36[_0x5d46('0x35')]=_[_0x5d46('0x4b')](db[_0x5d46('0x5a')][_0x5d46('0x33')]);_0x4c9c36[_0x5d46('0x36')]=_[_0x5d46('0x4b')](_0x34d827['query']);_0x4c9c36[_0x5d46('0x3f')]=_[_0x5d46('0x37')](_0x4c9c36['model'],_0x4c9c36[_0x5d46('0x36')]);_0x533bb2['attributes']=_['intersection'](_0x4c9c36[_0x5d46('0x35')],qs[_0x5d46('0x39')](_0x34d827[_0x5d46('0x36')][_0x5d46('0x39')]));_0x533bb2[_0x5d46('0x38')]=_0x533bb2[_0x5d46('0x38')]['length']?_0x533bb2[_0x5d46('0x38')]:_0x4c9c36[_0x5d46('0x35')];if(!_0x34d827[_0x5d46('0x36')][_0x5d46('0x3b')](_0x5d46('0x3c'))){_0x533bb2[_0x5d46('0x21')]=qs[_0x5d46('0x21')](_0x34d827[_0x5d46('0x36')][_0x5d46('0x21')]);_0x533bb2[_0x5d46('0x1f')]=qs['offset'](_0x34d827[_0x5d46('0x36')][_0x5d46('0x1f')]);}_0x533bb2[_0x5d46('0x3d')]=qs[_0x5d46('0x3e')](_0x34d827['query'][_0x5d46('0x3e')]);_0x533bb2[_0x5d46('0x41')]=qs[_0x5d46('0x3f')](_[_0x5d46('0x40')](_0x34d827[_0x5d46('0x36')],_0x4c9c36[_0x5d46('0x3f')]));_0x533bb2[_0x5d46('0x41')][_0x5d46('0x5b')]=_0xc71a44['id'];if(_0x34d827[_0x5d46('0x36')][_0x5d46('0x5c')]){_0x533bb2[_0x5d46('0x41')]=_[_0x5d46('0x42')](_0x533bb2[_0x5d46('0x41')],{'$or':_[_0x5d46('0x31')](_0x533bb2[_0x5d46('0x38')],function(_0x1ac564){var _0x3399d2={};_0x3399d2[_0x1ac564]={'$like':'%'+_0x34d827[_0x5d46('0x36')]['filter']+'%'};return _0x3399d2;})});}_0x533bb2=_['merge']({},_0x533bb2,_0x34d827[_0x5d46('0x45')]);return db['UserWhatsappQueue'][_0x5d46('0x48')](_0x533bb2);}})[_0x5d46('0x27')](function(_0x24e4f5){if(_0x24e4f5){return db[_0x5d46('0x5d')][_0x5d46('0x5e')]({'where':{'id':_[_0x5d46('0x31')](_0x24e4f5,_0x5d46('0x5f')),'role':_0x5d46('0x60')},'attributes':['id',_0x5d46('0x2e'),'whatsappPause',_0x5d46('0x61'),_0x5d46('0x62')]});}})[_0x5d46('0x27')](function(_0x2d244a){if(_0x2d244a){return{'count':_0x2d244a[_0x5d46('0x22')],'rows':_[_0x5d46('0x31')](_0x2d244a['rows'],function(_0x4fdf1a){return{'membername':_0x4fdf1a[_0x5d46('0x2e')],'UserId':_0x4fdf1a['id'],'queue_name':_0x558e22[_0x5d46('0x2e')],'WhatsappQueueId':_0x558e22['id'],'interface':util['format'](_0x5d46('0x63'),_0x5d46('0x64'),_0x4fdf1a[_0x5d46('0x2e')]),'penalty':0x0,'paused':_0x4fdf1a['whatsappPause'],'createdAt':_0x4fdf1a['createdAt'],'updatedAt':_0x4fdf1a[_0x5d46('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3c916e,_0x533bb2))[_0x5d46('0x49')](handleError(_0x3c916e,null));};exports['getTeams']=function(_0x3aba6f,_0x2b2a9,_0x4436bd){var _0x7c4d60={};var _0x4659c7={};var _0x34b812;var _0x551f36;return db[_0x5d46('0x32')][_0x5d46('0x59')]({'where':{'id':_0x3aba6f['params']['id']}})[_0x5d46('0x27')](handleEntityNotFound(_0x2b2a9,null))[_0x5d46('0x27')](function(_0x15331c){if(_0x15331c){_0x34b812=_0x15331c;_0x4659c7[_0x5d46('0x35')]=_[_0x5d46('0x4b')](db['Team'][_0x5d46('0x33')]);_0x4659c7[_0x5d46('0x36')]=_[_0x5d46('0x4b')](_0x3aba6f[_0x5d46('0x36')]);_0x4659c7['filters']=_['intersection'](_0x4659c7[_0x5d46('0x35')],_0x4659c7[_0x5d46('0x36')]);_0x7c4d60[_0x5d46('0x38')]=_['intersection'](_0x4659c7[_0x5d46('0x35')],qs[_0x5d46('0x39')](_0x3aba6f['query'][_0x5d46('0x39')]));_0x7c4d60[_0x5d46('0x38')]=_0x7c4d60[_0x5d46('0x38')][_0x5d46('0x3a')]?_0x7c4d60[_0x5d46('0x38')]:_0x4659c7[_0x5d46('0x35')];_0x7c4d60['order']=qs[_0x5d46('0x3e')](_0x3aba6f['query'][_0x5d46('0x3e')]);_0x7c4d60[_0x5d46('0x41')]=qs[_0x5d46('0x3f')](_[_0x5d46('0x40')](_0x3aba6f['query'],_0x4659c7[_0x5d46('0x3f')]));if(_0x3aba6f[_0x5d46('0x36')][_0x5d46('0x5c')]){_0x7c4d60['where']=_[_0x5d46('0x42')](_0x7c4d60['where'],{'$or':_[_0x5d46('0x31')](_0x7c4d60[_0x5d46('0x38')],function(_0x200493){var _0x31e95f={};_0x31e95f[_0x200493]={'$like':'%'+_0x3aba6f[_0x5d46('0x36')][_0x5d46('0x5c')]+'%'};return _0x31e95f;})});}_0x7c4d60=_[_0x5d46('0x42')]({},_0x7c4d60,_0x3aba6f[_0x5d46('0x45')]);return _0x34b812['getTeams'](_0x7c4d60);}})['then'](function(_0x592939){if(_0x592939){_0x551f36=_0x592939[_0x5d46('0x3a')];if(!_0x3aba6f[_0x5d46('0x36')]['hasOwnProperty'](_0x5d46('0x3c'))){_0x7c4d60[_0x5d46('0x21')]=qs[_0x5d46('0x21')](_0x3aba6f[_0x5d46('0x36')][_0x5d46('0x21')]);_0x7c4d60[_0x5d46('0x1f')]=qs[_0x5d46('0x1f')](_0x3aba6f[_0x5d46('0x36')][_0x5d46('0x1f')]);}return _0x34b812['getTeams'](_0x7c4d60);}})[_0x5d46('0x27')](function(_0x3c2b31){if(_0x3c2b31){return _0x3c2b31?{'count':_0x551f36,'rows':_0x3c2b31}:null;}})[_0x5d46('0x27')](respondWithResult(_0x2b2a9,null))[_0x5d46('0x49')](handleError(_0x2b2a9,null));};exports[_0x5d46('0x65')]=function(_0x24c619,_0x3778ad,_0x2c7fc2){var _0x580417=_0x24c619['body']['ids'];return db['Team'][_0x5d46('0x48')]({'where':{'id':_0x580417},'attributes':['id'],'include':[{'model':db[_0x5d46('0x5d')],'as':'Agents','attributes':['id',_0x5d46('0x2e'),_0x5d46('0x66'),_0x5d46('0x67'),_0x5d46('0x68')],'raw':!![]}]})[_0x5d46('0x27')](function(_0x3089f9){if(_0x3089f9){var _0x416642=_[_0x5d46('0x69')](_0x3089f9,function(_0x1cf465){var _0x3b3b1c=_0x1cf465[_0x5d46('0x4f')]({'plain':!![]});return _0x3b3b1c[_0x5d46('0x6a')];});return db[_0x5d46('0x32')][_0x5d46('0x52')]({'where':{'id':_0x24c619[_0x5d46('0x56')]['id']}})[_0x5d46('0x27')](function(_0x39a5d8){return db['sequelize']['transaction'](function(_0x4a3dcc){return _0x39a5d8[_0x5d46('0x65')](_0x580417,{'transaction':_0x4a3dcc})[_0x5d46('0x27')](function(){return BPromise[_0x5d46('0x6b')](_0x416642,function(_0x40bc13){return db[_0x5d46('0x5a')][_0x5d46('0x6c')]({'where':{'UserId':_0x40bc13['id'],'WhatsappQueueId':_0x24c619[_0x5d46('0x56')]['id']},'transaction':_0x4a3dcc});});})[_0x5d46('0x27')](function(){_0x416642[_0x5d46('0x6d')](function(_0xdecd74){socket['emit'](_0x5d46('0x6e'),{'UserId':_0xdecd74['id'],'WhatsappQueueId':_0x39a5d8['id']});});});});});}})[_0x5d46('0x27')](respondWithStatusCode(_0x3778ad,null))[_0x5d46('0x49')](handleError(_0x3778ad,null));};exports[_0x5d46('0x6f')]=function(_0x1bb5e4,_0x190105,_0x1036b7){return db['Team'][_0x5d46('0x48')]({'where':{'id':_0x1bb5e4[_0x5d46('0x36')][_0x5d46('0x70')]},'attributes':['id'],'include':[{'model':db[_0x5d46('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x190105,null))[_0x5d46('0x27')](function(_0x3f4c38){var _0x3490f3=_[_0x5d46('0x31')](_0x3f4c38,'id');var _0x382771=[];var _0x59022a=[];var _0x76dfb3=squel[_0x5d46('0x71')]();_0x76dfb3[_0x5d46('0x72')](_0x5d46('0x73'))['from'](_0x5d46('0x74'),'tq')['join'](_0x5d46('0x75'),'ut',_0x5d46('0x76'))[_0x5d46('0x41')](_0x5d46('0x77'),_0x1bb5e4[_0x5d46('0x56')]['id']);for(var _0x185bfc=0x0;_0x185bfc<_0x3f4c38[_0x5d46('0x3a')];_0x185bfc+=0x1){let _0x5934f7=_0x3f4c38[_0x185bfc];for(var _0x2a248c=0x0;_0x2a248c<_0x5934f7[_0x5d46('0x6a')][_0x5d46('0x3a')];_0x2a248c+=0x1){let _0x3e9a7b=_0x5934f7[_0x5d46('0x6a')][_0x2a248c];var _0x226687=_0x76dfb3[_0x5d46('0x78')]();_0x226687[_0x5d46('0x41')]('ut.UserId\x20=\x20?',_0x3e9a7b['id']);_0x59022a[_0x5d46('0x79')](db[_0x5d46('0x7a')][_0x5d46('0x36')](_0x226687[_0x5d46('0x7b')](),{'type':db[_0x5d46('0x7a')]['QueryTypes'][_0x5d46('0x7c')]})[_0x5d46('0x27')](function(_0x290083){if(_0x290083[_0x5d46('0x3a')]===0x1){return _0x3e9a7b['id'];}else{var _0x22ea95=_[_0x5d46('0x7d')](_['map'](_0x290083,_0x5d46('0x7e')),function(_0x26d8cf){return _[_0x5d46('0x7f')](_0x3490f3,_0x26d8cf);});if(_0x22ea95){return _0x3e9a7b['id'];}}}));}}return BPromise['all'](_0x59022a)[_0x5d46('0x27')](function(_0x1ab10f){_0x382771=_(_0x382771)[_0x5d46('0x80')](_0x1ab10f)[_0x5d46('0x81')]()[_0x5d46('0x82')]();return db[_0x5d46('0x32')][_0x5d46('0x52')]({'where':{'id':_0x1bb5e4[_0x5d46('0x56')]['id']}})['then'](function(_0x53d551){return db['sequelize'][_0x5d46('0x83')](function(_0xfe45d9){return _0x53d551[_0x5d46('0x6f')](_0x1bb5e4[_0x5d46('0x36')][_0x5d46('0x70')],{'transaction':_0xfe45d9})['then'](function(){if(!_[_0x5d46('0x84')](_0x382771)){return _0x53d551[_0x5d46('0x85')](_0x382771,{'transaction':_0xfe45d9});}})[_0x5d46('0x27')](function(){_0x382771[_0x5d46('0x6d')](function(_0x494850){socket['emit'](_0x5d46('0x86'),{'UserId':_0x494850,'WhatsappQueueId':_0x53d551['id']});});});});});});})[_0x5d46('0x27')](respondWithStatusCode(_0x190105,null))[_0x5d46('0x49')](handleError(_0x190105,null));};exports[_0x5d46('0x87')]=function(_0x204379,_0x52c2b6,_0x2d109c){return db[_0x5d46('0x32')][_0x5d46('0x52')]({'where':{'id':_0x204379['params']['id']}})[_0x5d46('0x27')](handleEntityNotFound(_0x52c2b6,null))[_0x5d46('0x27')](function(_0x54a2b7){if(_0x54a2b7){return _0x54a2b7[_0x5d46('0x87')](_0x204379[_0x5d46('0x4d')][_0x5d46('0x70')],_[_0x5d46('0x88')](_0x204379[_0x5d46('0x4d')],[_0x5d46('0x70'),'id'])||{})[_0x5d46('0x89')](function(_0x340a93){for(var _0x32189e=0x0;_0x32189e<_0x204379[_0x5d46('0x4d')][_0x5d46('0x70')][_0x5d46('0x3a')];_0x32189e+=0x1){socket['emit'](_0x5d46('0x6e'),{'UserId':Number(_0x204379[_0x5d46('0x4d')][_0x5d46('0x70')][_0x32189e]),'WhatsappQueueId':Number(_0x204379[_0x5d46('0x56')]['id'])});}return _0x340a93;});}})[_0x5d46('0x27')](respondWithResult(_0x52c2b6,null))[_0x5d46('0x49')](handleError(_0x52c2b6,null));};exports['removeAgents']=function(_0xa5bd43,_0x480883,_0x2c1b11){return db[_0x5d46('0x32')][_0x5d46('0x52')]({'where':{'id':_0xa5bd43[_0x5d46('0x56')]['id']}})[_0x5d46('0x27')](handleEntityNotFound(_0x480883,null))['then'](function(_0x58dcc6){if(_0x58dcc6){return _0x58dcc6[_0x5d46('0x85')](_0xa5bd43['query'][_0x5d46('0x70')])['then'](function(){if(_[_0x5d46('0x8a')](_0xa5bd43[_0x5d46('0x36')][_0x5d46('0x70')])){for(var _0x2b156d=0x0;_0x2b156d<_0xa5bd43[_0x5d46('0x36')][_0x5d46('0x70')][_0x5d46('0x3a')];_0x2b156d+=0x1){socket[_0x5d46('0x8b')](_0x5d46('0x86'),{'UserId':Number(_0xa5bd43[_0x5d46('0x36')][_0x5d46('0x70')][_0x2b156d]),'WhatsappQueueId':Number(_0xa5bd43['params']['id'])});}}else{socket[_0x5d46('0x8b')]('userWhatsappQueue:remove',{'UserId':Number(_0xa5bd43[_0x5d46('0x36')][_0x5d46('0x70')]),'WhatsappQueueId':Number(_0xa5bd43[_0x5d46('0x56')]['id'])});}});}})[_0x5d46('0x27')](respondWithStatusCode(_0x480883,null))[_0x5d46('0x49')](handleError(_0x480883,null));};exports[_0x5d46('0x8c')]=function(_0x3dc505,_0x144915,_0x4a50c2){var _0x31034={};var _0x5abdeb={};var _0x8cb660;var _0x5097da;return db[_0x5d46('0x32')][_0x5d46('0x59')]({'where':{'id':_0x3dc505[_0x5d46('0x56')]['id']}})[_0x5d46('0x27')](handleEntityNotFound(_0x144915,null))['then'](function(_0x1334ce){if(_0x1334ce){_0x8cb660=_0x1334ce;_0x5abdeb['model']=_[_0x5d46('0x4b')](db[_0x5d46('0x5d')][_0x5d46('0x33')]);_0x5abdeb[_0x5d46('0x36')]=_['keys'](_0x3dc505[_0x5d46('0x36')]);_0x5abdeb['filters']=_[_0x5d46('0x37')](_0x5abdeb[_0x5d46('0x35')],_0x5abdeb[_0x5d46('0x36')]);_0x31034[_0x5d46('0x38')]=_[_0x5d46('0x37')](_0x5abdeb[_0x5d46('0x35')],qs[_0x5d46('0x39')](_0x3dc505[_0x5d46('0x36')][_0x5d46('0x39')]));_0x31034[_0x5d46('0x38')]=_0x31034['attributes']['length']?_0x31034[_0x5d46('0x38')]:_0x5abdeb[_0x5d46('0x35')];_0x31034['order']=qs[_0x5d46('0x3e')](_0x3dc505['query'][_0x5d46('0x3e')]);_0x31034['where']=qs[_0x5d46('0x3f')](_[_0x5d46('0x40')](_0x3dc505[_0x5d46('0x36')],_0x5abdeb['filters']));if(_0x3dc505[_0x5d46('0x36')][_0x5d46('0x5c')]){_0x31034[_0x5d46('0x41')]=_[_0x5d46('0x42')](_0x31034[_0x5d46('0x41')],{'$or':_[_0x5d46('0x31')](_0x31034[_0x5d46('0x38')],function(_0x27451f){var _0xc2f08e={};_0xc2f08e[_0x27451f]={'$like':'%'+_0x3dc505[_0x5d46('0x36')][_0x5d46('0x5c')]+'%'};return _0xc2f08e;})});}_0x31034=_[_0x5d46('0x42')]({},_0x31034,_0x3dc505[_0x5d46('0x45')]);return _0x8cb660[_0x5d46('0x8c')](_0x31034);}})[_0x5d46('0x27')](function(_0x344ebb){if(_0x344ebb){_0x5097da=_0x344ebb['length'];if(!_0x3dc505[_0x5d46('0x36')][_0x5d46('0x3b')]('nolimit')){_0x31034[_0x5d46('0x21')]=qs['limit'](_0x3dc505[_0x5d46('0x36')][_0x5d46('0x21')]);_0x31034[_0x5d46('0x1f')]=qs[_0x5d46('0x1f')](_0x3dc505['query'][_0x5d46('0x1f')]);}return _0x8cb660[_0x5d46('0x8c')](_0x31034);}})[_0x5d46('0x27')](function(_0x52f6a7){if(_0x52f6a7){return _0x52f6a7?{'count':_0x5097da,'rows':_0x52f6a7}:null;}})[_0x5d46('0x27')](respondWithResult(_0x144915,null))[_0x5d46('0x49')](handleError(_0x144915,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index fab1173..52a4867 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 _0x07a2=['save','update','remove','emit','hasOwnProperty','hook','exports','setMaxListeners'];(function(_0xb9ce3a,_0x42fdff){var _0xdaa30f=function(_0x369291){while(--_0x369291){_0xb9ce3a['push'](_0xb9ce3a['shift']());}};_0xdaa30f(++_0x42fdff);}(_0x07a2,0xa7));var _0x207a=function(_0x16c467,_0x53d6fa){_0x16c467=_0x16c467-0x0;var _0x22db4f=_0x07a2[_0x16c467];return _0x22db4f;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x207a('0x0')](0x0);var events={'afterCreate':_0x207a('0x1'),'afterUpdate':_0x207a('0x2'),'afterDestroy':_0x207a('0x3')};function emitEvent(_0x1a4826){return function(_0x55331d,_0x67ef79,_0x4e7f09){WhatsappQueueEvents[_0x207a('0x4')](_0x1a4826+':'+_0x55331d['id'],_0x55331d);WhatsappQueueEvents[_0x207a('0x4')](_0x1a4826,_0x55331d);_0x4e7f09(null);};}for(var e in events){if(events[_0x207a('0x5')](e)){var event=events[e];WhatsappQueue[_0x207a('0x6')](e,emitEvent(event));}}module[_0x207a('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xdae8=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3618fe,_0x39273c){var _0x5d90ac=function(_0x1e5ad1){while(--_0x1e5ad1){_0x3618fe['push'](_0x3618fe['shift']());}};_0x5d90ac(++_0x39273c);}(_0xdae8,0x1e7));var _0x8dae=function(_0x169e53,_0x46be55){_0x169e53=_0x169e53-0x0;var _0x252bb3=_0xdae8[_0x169e53];return _0x252bb3;};'use strict';var EventEmitter=require(_0x8dae('0x0'));var WhatsappQueue=require(_0x8dae('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8dae('0x2')](0x0);var events={'afterCreate':_0x8dae('0x3'),'afterUpdate':_0x8dae('0x4'),'afterDestroy':_0x8dae('0x5')};function emitEvent(_0x3ea1ca){return function(_0x29eb0c,_0x3ada4c,_0x2a2710){WhatsappQueueEvents[_0x8dae('0x6')](_0x3ea1ca+':'+_0x29eb0c['id'],_0x29eb0c);WhatsappQueueEvents[_0x8dae('0x6')](_0x3ea1ca,_0x29eb0c);_0x2a2710(null);};}for(var e in events){if(events[_0x8dae('0x7')](e)){var event=events[e];WhatsappQueue[_0x8dae('0x8')](e,emitEvent(event));}}module[_0x8dae('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 86bf702..3c5fb76 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 _0x79c2=['request-promise','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x79c2,0xa3));var _0x279c=function(_0x5ebf44,_0x4e543e){_0x5ebf44=_0x5ebf44-0x0;var _0x2fef12=_0x79c2[_0x5ebf44];return _0x2fef12;};'use strict';var _=require(_0x279c('0x0'));var util=require(_0x279c('0x1'));var logger=require(_0x279c('0x2'))(_0x279c('0x3'));var moment=require('moment');var BPromise=require(_0x279c('0x4'));var rp=require(_0x279c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x279c('0x6'));var attributes=require(_0x279c('0x7'));module[_0x279c('0x8')]=function(_0x2d7b2a,_0xdd9d7f){return _0x2d7b2a[_0x279c('0x9')](_0x279c('0xa'),attributes,{'tableName':_0x279c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c7d=['WhatsappQueue','whatsapp_queues','lodash','api','bluebird','request-promise','path','../../config/environment','define'];(function(_0xc8bd0a,_0x50c7b7){var _0x361343=function(_0x4497ec){while(--_0x4497ec){_0xc8bd0a['push'](_0xc8bd0a['shift']());}};_0x361343(++_0x50c7b7);}(_0x3c7d,0x1d6));var _0xd3c7=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x3c7d[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0xd3c7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd3c7('0x1'));var moment=require('moment');var BPromise=require(_0xd3c7('0x2'));var rp=require(_0xd3c7('0x3'));var fs=require('fs');var path=require(_0xd3c7('0x4'));var rimraf=require('rimraf');var config=require(_0xd3c7('0x5'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x2d842d,_0x6b847c){return _0x2d842d[_0xd3c7('0x6')](_0xd3c7('0x7'),attributes,{'tableName':_0xd3c7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 4bb8e1f..6730b7d 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 _0xa593=['options','where','attributes','limit','map','model','include','stringify','find','raw','ShowWhatsappQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll'];(function(_0x3ef934,_0x12521e){var _0x2a3505=function(_0xeae77){while(--_0xeae77){_0x3ef934['push'](_0x3ef934['shift']());}};_0x2a3505(++_0x12521e);}(_0xa593,0xaf));var _0x3a59=function(_0x249f1e,_0x4d1305){_0x249f1e=_0x249f1e-0x0;var _0x499f9a=_0xa593[_0x249f1e];return _0x499f9a;};'use strict';var _=require('lodash');var util=require(_0x3a59('0x0'));var moment=require(_0x3a59('0x1'));var BPromise=require(_0x3a59('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a59('0x3'));var db=require(_0x3a59('0x4'))['db'];var utils=require(_0x3a59('0x5'));var logger=require(_0x3a59('0x6'))(_0x3a59('0x7'));var config=require(_0x3a59('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3a59('0x9')][_0x3a59('0xa')]({'port':0x232a});config['redis']=_[_0x3a59('0xb')](config[_0x3a59('0xc')],{'host':_0x3a59('0xd'),'port':0x18eb});var socket=require(_0x3a59('0xe'))(new Redis(config[_0x3a59('0xc')]));require('./whatsappQueue.socket')[_0x3a59('0xf')](socket);function respondWithRpcPromise(_0x4c86ee,_0x5ea57f,_0x5e0191){return new BPromise(function(_0x33a219,_0x24614f){return client[_0x3a59('0x10')](_0x4c86ee,_0x5e0191)[_0x3a59('0x11')](function(_0x2148ec){logger['info'](_0x3a59('0x12'),_0x5ea57f,_0x3a59('0x13'));logger[_0x3a59('0x14')](_0x3a59('0x15'),_0x5ea57f,_0x3a59('0x13'),JSON['stringify'](_0x2148ec));if(_0x2148ec[_0x3a59('0x16')]){if(_0x2148ec[_0x3a59('0x16')]['code']===0x1f4){logger[_0x3a59('0x16')](_0x3a59('0x12'),_0x5ea57f,_0x2148ec['error'][_0x3a59('0x17')]);return _0x24614f(_0x2148ec[_0x3a59('0x16')][_0x3a59('0x17')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x5ea57f,_0x2148ec[_0x3a59('0x16')]['message']);return _0x33a219(_0x2148ec[_0x3a59('0x16')]['message']);}else{logger[_0x3a59('0x18')](_0x3a59('0x12'),_0x5ea57f,'request\x20sent');_0x33a219(_0x2148ec[_0x3a59('0x19')][_0x3a59('0x17')]);}})[_0x3a59('0x1a')](function(_0x5da42a){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x5ea57f,_0x5da42a);_0x24614f(_0x5da42a);});});}exports[_0x3a59('0x1b')]=function(_0x454cc1){var _0x26b8cc=this;return new Promise(function(_0x3843a6,_0x490bc5){return db[_0x3a59('0x1c')][_0x3a59('0x1d')]({'raw':_0x454cc1[_0x3a59('0x1e')]?_0x454cc1[_0x3a59('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x454cc1[_0x3a59('0x1e')]?_0x454cc1[_0x3a59('0x1e')][_0x3a59('0x1f')]||null:null,'attributes':_0x454cc1[_0x3a59('0x1e')]?_0x454cc1[_0x3a59('0x1e')][_0x3a59('0x20')]||null:null,'limit':_0x454cc1[_0x3a59('0x1e')]?_0x454cc1[_0x3a59('0x1e')][_0x3a59('0x21')]||null:null,'include':_0x454cc1[_0x3a59('0x1e')]?_0x454cc1[_0x3a59('0x1e')]['include']?_[_0x3a59('0x22')](_0x454cc1[_0x3a59('0x1e')]['include'],function(_0x44ba00){return{'model':db[_0x44ba00[_0x3a59('0x23')]],'as':_0x44ba00['as'],'attributes':_0x44ba00[_0x3a59('0x20')],'include':_0x44ba00[_0x3a59('0x24')]?_[_0x3a59('0x22')](_0x44ba00['include'],function(_0x2fd9d7){return{'model':db[_0x2fd9d7[_0x3a59('0x23')]],'as':_0x2fd9d7['as'],'attributes':_0x2fd9d7['attributes'],'include':_0x2fd9d7['include']?_[_0x3a59('0x22')](_0x2fd9d7[_0x3a59('0x24')],function(_0x17aa7e){return{'model':db[_0x17aa7e[_0x3a59('0x23')]],'as':_0x17aa7e['as'],'attributes':_0x17aa7e[_0x3a59('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3a59('0x11')](function(_0x4c7f9b){logger['info'](_0x3a59('0x1b'),_0x454cc1);logger[_0x3a59('0x14')](_0x3a59('0x1b'),_0x454cc1,JSON[_0x3a59('0x25')](_0x4c7f9b));_0x3843a6(_0x4c7f9b);})['catch'](function(_0x1105e4){logger[_0x3a59('0x16')](_0x3a59('0x1b'),_0x1105e4[_0x3a59('0x17')],_0x454cc1);_0x490bc5(_0x26b8cc[_0x3a59('0x16')](0x1f4,_0x1105e4[_0x3a59('0x17')]));});});};exports['ShowWhatsappQueue']=function(_0x34ec52){var _0x48ce50=this;return new Promise(function(_0x4f33cf,_0x15a397){return db[_0x3a59('0x1c')][_0x3a59('0x26')]({'raw':_0x34ec52['options']?_0x34ec52[_0x3a59('0x1e')][_0x3a59('0x27')]===undefined?!![]:![]:!![],'where':_0x34ec52[_0x3a59('0x1e')]?_0x34ec52['options'][_0x3a59('0x1f')]||null:null,'attributes':_0x34ec52[_0x3a59('0x1e')]?_0x34ec52['options'][_0x3a59('0x20')]||null:null,'include':_0x34ec52[_0x3a59('0x1e')]?_0x34ec52[_0x3a59('0x1e')]['include']?_[_0x3a59('0x22')](_0x34ec52[_0x3a59('0x1e')]['include'],function(_0x4f3431){return{'model':db[_0x4f3431[_0x3a59('0x23')]],'as':_0x4f3431['as'],'attributes':_0x4f3431[_0x3a59('0x20')],'include':_0x4f3431[_0x3a59('0x24')]?_[_0x3a59('0x22')](_0x4f3431['include'],function(_0x32fbad){return{'model':db[_0x32fbad[_0x3a59('0x23')]],'as':_0x32fbad['as'],'attributes':_0x32fbad[_0x3a59('0x20')],'include':_0x32fbad['include']?_['map'](_0x32fbad[_0x3a59('0x24')],function(_0x2e64e8){return{'model':db[_0x2e64e8[_0x3a59('0x23')]],'as':_0x2e64e8['as'],'attributes':_0x2e64e8[_0x3a59('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3a59('0x11')](function(_0x21abc3){logger[_0x3a59('0x18')]('ShowWhatsappQueue',_0x34ec52);logger[_0x3a59('0x14')](_0x3a59('0x28'),_0x34ec52,JSON['stringify'](_0x21abc3));_0x4f33cf(_0x21abc3);})[_0x3a59('0x1a')](function(_0x4600f5){logger[_0x3a59('0x16')](_0x3a59('0x28'),_0x4600f5[_0x3a59('0x17')],_0x34ec52);_0x15a397(_0x48ce50[_0x3a59('0x16')](0x1f4,_0x4600f5[_0x3a59('0x17')]));});});}; \ No newline at end of file +var _0xda43=['then','ShowWhatsappQueue','WhatsappQueue','find','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetWhatsappQueue','findAll','options','raw','where','limit','include','map','model'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xda43,0x124));var _0x3da4=function(_0x4d7c3e,_0x46e758){_0x4d7c3e=_0x4d7c3e-0x0;var _0x42e97e=_0xda43[_0x4d7c3e];return _0x42e97e;};'use strict';var _=require(_0x3da4('0x0'));var util=require('util');var moment=require(_0x3da4('0x1'));var BPromise=require(_0x3da4('0x2'));var rs=require(_0x3da4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3da4('0x4'))['db'];var utils=require(_0x3da4('0x5'));var logger=require(_0x3da4('0x6'))(_0x3da4('0x7'));var config=require('../../config/environment');var jayson=require(_0x3da4('0x8'));var client=jayson[_0x3da4('0x9')][_0x3da4('0xa')]({'port':0x232a});config[_0x3da4('0xb')]=_[_0x3da4('0xc')](config[_0x3da4('0xb')],{'host':_0x3da4('0xd'),'port':0x18eb});var socket=require(_0x3da4('0xe'))(new Redis(config[_0x3da4('0xb')]));require(_0x3da4('0xf'))[_0x3da4('0x10')](socket);function respondWithRpcPromise(_0x58b359,_0x5d75e2,_0x10972d){return new BPromise(function(_0x4ff31e,_0x17492f){return client['request'](_0x58b359,_0x10972d)['then'](function(_0x528ebf){logger['info'](_0x3da4('0x11'),_0x5d75e2,'request\x20sent');logger[_0x3da4('0x12')](_0x3da4('0x13'),_0x5d75e2,'request\x20sent',JSON[_0x3da4('0x14')](_0x528ebf));if(_0x528ebf[_0x3da4('0x15')]){if(_0x528ebf[_0x3da4('0x15')][_0x3da4('0x16')]===0x1f4){logger['error'](_0x3da4('0x11'),_0x5d75e2,_0x528ebf[_0x3da4('0x15')][_0x3da4('0x17')]);return _0x17492f(_0x528ebf['error']['message']);}logger[_0x3da4('0x15')](_0x3da4('0x11'),_0x5d75e2,_0x528ebf['error'][_0x3da4('0x17')]);return _0x4ff31e(_0x528ebf['error'][_0x3da4('0x17')]);}else{logger[_0x3da4('0x18')](_0x3da4('0x11'),_0x5d75e2,'request\x20sent');_0x4ff31e(_0x528ebf[_0x3da4('0x19')][_0x3da4('0x17')]);}})[_0x3da4('0x1a')](function(_0x54a374){logger[_0x3da4('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x5d75e2,_0x54a374);_0x17492f(_0x54a374);});});}exports[_0x3da4('0x1b')]=function(_0xa002a2){var _0x145c19=this;return new Promise(function(_0xd1a005,_0x441ae5){return db['WhatsappQueue'][_0x3da4('0x1c')]({'raw':_0xa002a2[_0x3da4('0x1d')]?_0xa002a2['options'][_0x3da4('0x1e')]===undefined?!![]:![]:!![],'where':_0xa002a2[_0x3da4('0x1d')]?_0xa002a2['options'][_0x3da4('0x1f')]||null:null,'attributes':_0xa002a2[_0x3da4('0x1d')]?_0xa002a2['options']['attributes']||null:null,'limit':_0xa002a2[_0x3da4('0x1d')]?_0xa002a2['options'][_0x3da4('0x20')]||null:null,'include':_0xa002a2[_0x3da4('0x1d')]?_0xa002a2['options'][_0x3da4('0x21')]?_[_0x3da4('0x22')](_0xa002a2[_0x3da4('0x1d')]['include'],function(_0x5edb10){return{'model':db[_0x5edb10['model']],'as':_0x5edb10['as'],'attributes':_0x5edb10['attributes'],'include':_0x5edb10[_0x3da4('0x21')]?_[_0x3da4('0x22')](_0x5edb10['include'],function(_0x3c7d16){return{'model':db[_0x3c7d16[_0x3da4('0x23')]],'as':_0x3c7d16['as'],'attributes':_0x3c7d16['attributes'],'include':_0x3c7d16[_0x3da4('0x21')]?_['map'](_0x3c7d16[_0x3da4('0x21')],function(_0x54d08b){return{'model':db[_0x54d08b[_0x3da4('0x23')]],'as':_0x54d08b['as'],'attributes':_0x54d08b['attributes']};}):[]};}):[]};}):[]:[]})[_0x3da4('0x24')](function(_0x34a0ec){logger[_0x3da4('0x18')](_0x3da4('0x1b'),_0xa002a2);logger[_0x3da4('0x12')](_0x3da4('0x1b'),_0xa002a2,JSON[_0x3da4('0x14')](_0x34a0ec));_0xd1a005(_0x34a0ec);})[_0x3da4('0x1a')](function(_0x2121c9){logger['error'](_0x3da4('0x1b'),_0x2121c9[_0x3da4('0x17')],_0xa002a2);_0x441ae5(_0x145c19[_0x3da4('0x15')](0x1f4,_0x2121c9['message']));});});};exports[_0x3da4('0x25')]=function(_0x2dc471){var _0x17fc1b=this;return new Promise(function(_0x46a739,_0x2be2c2){return db[_0x3da4('0x26')][_0x3da4('0x27')]({'raw':_0x2dc471['options']?_0x2dc471['options']['raw']===undefined?!![]:![]:!![],'where':_0x2dc471['options']?_0x2dc471[_0x3da4('0x1d')][_0x3da4('0x1f')]||null:null,'attributes':_0x2dc471[_0x3da4('0x1d')]?_0x2dc471[_0x3da4('0x1d')][_0x3da4('0x28')]||null:null,'include':_0x2dc471[_0x3da4('0x1d')]?_0x2dc471[_0x3da4('0x1d')][_0x3da4('0x21')]?_['map'](_0x2dc471['options'][_0x3da4('0x21')],function(_0x2a97d5){return{'model':db[_0x2a97d5[_0x3da4('0x23')]],'as':_0x2a97d5['as'],'attributes':_0x2a97d5[_0x3da4('0x28')],'include':_0x2a97d5[_0x3da4('0x21')]?_[_0x3da4('0x22')](_0x2a97d5[_0x3da4('0x21')],function(_0x415412){return{'model':db[_0x415412['model']],'as':_0x415412['as'],'attributes':_0x415412[_0x3da4('0x28')],'include':_0x415412[_0x3da4('0x21')]?_[_0x3da4('0x22')](_0x415412[_0x3da4('0x21')],function(_0x3bee32){return{'model':db[_0x3bee32[_0x3da4('0x23')]],'as':_0x3bee32['as'],'attributes':_0x3bee32['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5906cb){logger[_0x3da4('0x18')](_0x3da4('0x25'),_0x2dc471);logger[_0x3da4('0x12')]('ShowWhatsappQueue',_0x2dc471,JSON['stringify'](_0x5906cb));_0x46a739(_0x5906cb);})[_0x3da4('0x1a')](function(_0x2184e9){logger[_0x3da4('0x15')](_0x3da4('0x25'),_0x2184e9[_0x3da4('0x17')],_0x2dc471);_0x2be2c2(_0x17fc1b['error'](0x1f4,_0x2184e9[_0x3da4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 3ce74de..a2eff3b 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 _0xa12d=['whatsappQueue:','./whatsappQueue.events','save','update','emit','removeListener','length'];(function(_0x286b5b,_0x43f280){var _0x15a3b8=function(_0x41b0db){while(--_0x41b0db){_0x286b5b['push'](_0x286b5b['shift']());}};_0x15a3b8(++_0x43f280);}(_0xa12d,0x6a));var _0xda12=function(_0x5845a7,_0x45b76c){_0x5845a7=_0x5845a7-0x0;var _0xd1e754=_0xa12d[_0x5845a7];return _0xd1e754;};'use strict';var WhatsappQueueEvents=require(_0xda12('0x0'));var events=[_0xda12('0x1'),'remove',_0xda12('0x2')];function createListener(_0x4d4024,_0x440abf){return function(_0x8447e1){_0x440abf[_0xda12('0x3')](_0x4d4024,_0x8447e1);};}function removeListener(_0x288c4d,_0x5c8e0c){return function(){WhatsappQueueEvents[_0xda12('0x4')](_0x288c4d,_0x5c8e0c);};}exports['register']=function(_0x13e246){for(var _0x242766=0x0,_0x4d4436=events[_0xda12('0x5')];_0x242766<_0x4d4436;_0x242766++){var _0x12b44d=events[_0x242766];var _0x969608=createListener(_0xda12('0x6')+_0x12b44d,_0x13e246);WhatsappQueueEvents['on'](_0x12b44d,_0x969608);}}; \ No newline at end of file +var _0xe52a=['save','removeListener','register','length','whatsappQueue:'];(function(_0x56f244,_0x56ccf4){var _0x11ea35=function(_0x28f2c0){while(--_0x28f2c0){_0x56f244['push'](_0x56f244['shift']());}};_0x11ea35(++_0x56ccf4);}(_0xe52a,0xc8));var _0xae52=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xe52a[_0x8de54f];return _0x14cba4;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xae52('0x0'),'remove','update'];function createListener(_0x22f5c5,_0x97781d){return function(_0x5184a8){_0x97781d['emit'](_0x22f5c5,_0x5184a8);};}function removeListener(_0x5d949b,_0x250767){return function(){WhatsappQueueEvents[_0xae52('0x1')](_0x5d949b,_0x250767);};}exports[_0xae52('0x2')]=function(_0x1de957){for(var _0x438e54=0x0,_0x15612e=events[_0xae52('0x3')];_0x438e54<_0x15612e;_0x438e54++){var _0x2acb81=events[_0x438e54];var _0xf57524=createListener(_0xae52('0x4')+_0x2acb81,_0x1de957);WhatsappQueueEvents['on'](_0x2acb81,_0xf57524);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 88d7ce6..268278c 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 _0xeb9b=['update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x2a6a89,_0x20b98d){var _0x36d98c=function(_0x4e349b){while(--_0x4e349b){_0x2a6a89['push'](_0x2a6a89['shift']());}};_0x36d98c(++_0x20b98d);}(_0xeb9b,0x1a7));var _0xbeb9=function(_0x4cbe17,_0x300320){_0x4cbe17=_0x4cbe17-0x0;var _0x3070ef=_0xeb9b[_0x4cbe17];return _0x3070ef;};'use strict';var multer=require(_0xbeb9('0x0'));var util=require('util');var path=require(_0xbeb9('0x1'));var timeout=require(_0xbeb9('0x2'));var express=require(_0xbeb9('0x3'));var router=express[_0xbeb9('0x4')]();var fs_extra=require(_0xbeb9('0x5'));var auth=require(_0xbeb9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbeb9('0x7'));var controller=require(_0xbeb9('0x8'));router[_0xbeb9('0x9')]('/',auth[_0xbeb9('0xa')](),controller[_0xbeb9('0xb')]);router[_0xbeb9('0x9')](_0xbeb9('0xc'),auth[_0xbeb9('0xa')](),controller[_0xbeb9('0xd')]);router[_0xbeb9('0x9')](_0xbeb9('0xe'),auth['isAuthenticated'](),controller[_0xbeb9('0xf')]);router[_0xbeb9('0x10')]('/',auth[_0xbeb9('0xa')](),controller['create']);router['put'](_0xbeb9('0xe'),auth[_0xbeb9('0xa')](),controller[_0xbeb9('0x11')]);router[_0xbeb9('0x12')](_0xbeb9('0xe'),auth[_0xbeb9('0xa')](),controller['destroy']);module[_0xbeb9('0x13')]=router; \ No newline at end of file +var _0x7cd2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','describe','post','/:id','update','destroy','exports','multer','util','express','Router'];(function(_0x3d2049,_0x556ba9){var _0x510800=function(_0x1c5410){while(--_0x1c5410){_0x3d2049['push'](_0x3d2049['shift']());}};_0x510800(++_0x556ba9);}(_0x7cd2,0x13f));var _0x27cd=function(_0x11a725,_0x2031b3){_0x11a725=_0x11a725-0x0;var _0x30946b=_0x7cd2[_0x11a725];return _0x30946b;};'use strict';var multer=require(_0x27cd('0x0'));var util=require(_0x27cd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x27cd('0x2'));var router=express[_0x27cd('0x3')]();var fs_extra=require(_0x27cd('0x4'));var auth=require(_0x27cd('0x5'));var interaction=require(_0x27cd('0x6'));var config=require(_0x27cd('0x7'));var controller=require(_0x27cd('0x8'));router['get']('/',auth[_0x27cd('0x9')](),controller[_0x27cd('0xa')]);router[_0x27cd('0xb')](_0x27cd('0xc'),auth['isAuthenticated'](),controller[_0x27cd('0xd')]);router[_0x27cd('0xb')]('/:id',auth[_0x27cd('0x9')](),controller['show']);router[_0x27cd('0xe')]('/',auth[_0x27cd('0x9')](),controller['create']);router['put'](_0x27cd('0xf'),auth[_0x27cd('0x9')](),controller[_0x27cd('0x10')]);router['delete'](_0x27cd('0xf'),auth[_0x27cd('0x9')](),controller[_0x27cd('0x11')]);module[_0x27cd('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 2418f9c..f85fcf6 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(_0x54c5ae,_0xa014d5){var _0x12f0d3=function(_0xf505c){while(--_0xf505c){_0x54c5ae['push'](_0x54c5ae['shift']());}};_0x12f0d3(++_0xa014d5);}(_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 +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0xabc41a,_0x52a234){var _0x1f0034=function(_0xdcea30){while(--_0xdcea30){_0xabc41a['push'](_0xabc41a['shift']());}};_0x1f0034(++_0x52a234);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 977fa32..55e677a 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 _0xae60=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','index','WhatsappQueueReport','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x32eef4,_0x2556a0){var _0x1742d4=function(_0x42a8a0){while(--_0x42a8a0){_0x32eef4['push'](_0x32eef4['shift']());}};_0x1742d4(++_0x2556a0);}(_0xae60,0x1c7));var _0x0ae6=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xae60[_0x616290];return _0x453879;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];function respondWithStatusCode(_0x3b05a4,_0x30f8f9){_0x30f8f9=_0x30f8f9||0xcc;return function(_0x1aefd5){if(_0x1aefd5){return _0x3b05a4[_0x0ae6('0x1c')](_0x30f8f9);}return _0x3b05a4[_0x0ae6('0x1d')](_0x30f8f9)[_0x0ae6('0x1e')]();};}function respondWithResult(_0x4d2da8,_0x3809c6){_0x3809c6=_0x3809c6||0xc8;return function(_0x10c3bc){if(_0x10c3bc){return _0x4d2da8[_0x0ae6('0x1d')](_0x3809c6)[_0x0ae6('0x1f')](_0x10c3bc);}};}function respondWithFilteredResult(_0xce3e23,_0x3a1e26){return function(_0x151144){if(_0x151144){var _0x3b64ac=typeof _0x3a1e26[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x3a1e26[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xa97151=_0x151144[_0x0ae6('0x23')];var _0xda4f01=_0x3b64ac?0x0:_0x3a1e26[_0x0ae6('0x20')];var _0x2fdf25=_0x3b64ac?_0x151144[_0x0ae6('0x23')]:_0x3a1e26[_0x0ae6('0x20')]+_0x3a1e26[_0x0ae6('0x22')];var _0x26b369;if(_0x2fdf25>=_0xa97151){_0x2fdf25=_0xa97151;_0x26b369=0xc8;}else{_0x26b369=0xce;}_0xce3e23[_0x0ae6('0x1d')](_0x26b369);return _0xce3e23['set'](_0x0ae6('0x24'),_0xda4f01+'-'+_0x2fdf25+'/'+_0xa97151)[_0x0ae6('0x1f')](_0x151144);}return null;};}function patchUpdates(_0x140a3b){return function(_0x1027c2){try{jsonpatch[_0x0ae6('0x25')](_0x1027c2,_0x140a3b,!![]);}catch(_0xb4e6af){return BPromise[_0x0ae6('0x26')](_0xb4e6af);}return _0x1027c2[_0x0ae6('0x27')]();};}function saveUpdates(_0x515f3d,_0x39b22e){return function(_0x2a6484){if(_0x2a6484){return _0x2a6484[_0x0ae6('0x28')](_0x515f3d)[_0x0ae6('0x29')](function(_0x31ad85){return _0x31ad85;});}return null;};}function removeEntity(_0x4eba72,_0x296a9d){return function(_0x4e1242){if(_0x4e1242){return _0x4e1242[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){_0x4eba72[_0x0ae6('0x1d')](0xcc)[_0x0ae6('0x1e')]();});}};}function handleEntityNotFound(_0x5b86fe,_0x3630e6){return function(_0x2dcdb7){if(!_0x2dcdb7){_0x5b86fe['sendStatus'](0x194);}return _0x2dcdb7;};}function handleError(_0x55dbe1,_0x44eb95){_0x44eb95=_0x44eb95||0x1f4;return function(_0x3255a7){logger[_0x0ae6('0x2b')](_0x3255a7['stack']);if(_0x3255a7[_0x0ae6('0x2c')]){delete _0x3255a7[_0x0ae6('0x2c')];}_0x55dbe1[_0x0ae6('0x1d')](_0x44eb95)['send'](_0x3255a7);};}exports[_0x0ae6('0x2d')]=function(_0x29fef3,_0x449c33){var _0x232fbd={},_0x14eed5={},_0x257af5={'count':0x0,'rows':[]};var _0x4fc7bd=_['map'](db[_0x0ae6('0x2e')][_0x0ae6('0x2f')],function(_0x4e6df8){return{'name':_0x4e6df8['fieldName'],'type':_0x4e6df8[_0x0ae6('0x30')][_0x0ae6('0x31')]};});_0x14eed5[_0x0ae6('0x32')]=_[_0x0ae6('0x33')](_0x4fc7bd,'name');_0x14eed5[_0x0ae6('0x34')]=_[_0x0ae6('0x35')](_0x29fef3[_0x0ae6('0x34')]);_0x14eed5['filters']=_[_0x0ae6('0x36')](_0x14eed5[_0x0ae6('0x32')],_0x14eed5[_0x0ae6('0x34')]);_0x232fbd[_0x0ae6('0x37')]=_[_0x0ae6('0x36')](_0x14eed5[_0x0ae6('0x32')],qs[_0x0ae6('0x38')](_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x38')]));_0x232fbd[_0x0ae6('0x37')]=_0x232fbd['attributes'][_0x0ae6('0x39')]?_0x232fbd[_0x0ae6('0x37')]:_0x14eed5['model'];if(!_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x3a')](_0x0ae6('0x3b'))){_0x232fbd['limit']=qs[_0x0ae6('0x22')](_0x29fef3['query']['limit']);_0x232fbd[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x20')]);}_0x232fbd[_0x0ae6('0x3c')]=qs['sort'](_0x29fef3['query'][_0x0ae6('0x3d')]);_0x232fbd['where']=qs[_0x0ae6('0x3e')](_['pick'](_0x29fef3[_0x0ae6('0x34')],_0x14eed5['filters']),_0x4fc7bd);if(_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x3f')]){_0x232fbd[_0x0ae6('0x40')]=_[_0x0ae6('0x41')](_0x232fbd['where'],{'$or':_['map'](_0x4fc7bd,function(_0x43414c){if(_0x43414c[_0x0ae6('0x30')]!==_0x0ae6('0x42')){var _0x59480a={};_0x59480a[_0x43414c[_0x0ae6('0x2c')]]={'$like':'%'+_0x29fef3['query'][_0x0ae6('0x3f')]+'%'};return _0x59480a;}})});}_0x232fbd=_[_0x0ae6('0x41')]({},_0x232fbd,_0x29fef3[_0x0ae6('0x43')]);var _0x19403c={'where':_0x232fbd[_0x0ae6('0x40')]};return db[_0x0ae6('0x2e')]['count'](_0x19403c)[_0x0ae6('0x29')](function(_0x601ef9){_0x257af5[_0x0ae6('0x23')]=_0x601ef9;if(_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x44')]){_0x232fbd[_0x0ae6('0x45')]=[{'all':!![]}];}return db[_0x0ae6('0x2e')][_0x0ae6('0x46')](_0x232fbd);})['then'](function(_0x38faeb){_0x257af5[_0x0ae6('0x47')]=_0x38faeb;return _0x257af5;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x449c33,_0x232fbd))[_0x0ae6('0x48')](handleError(_0x449c33,null));};exports[_0x0ae6('0x49')]=function(_0x167ed1,_0x24c021){var _0x21431e={'raw':!![],'where':{'id':_0x167ed1[_0x0ae6('0x4a')]['id']}},_0xb38cbb={};_0xb38cbb[_0x0ae6('0x32')]=_[_0x0ae6('0x35')](db[_0x0ae6('0x2e')][_0x0ae6('0x2f')]);_0xb38cbb[_0x0ae6('0x34')]=_[_0x0ae6('0x35')](_0x167ed1[_0x0ae6('0x34')]);_0xb38cbb[_0x0ae6('0x3e')]=_['intersection'](_0xb38cbb[_0x0ae6('0x32')],_0xb38cbb[_0x0ae6('0x34')]);_0x21431e[_0x0ae6('0x37')]=_[_0x0ae6('0x36')](_0xb38cbb[_0x0ae6('0x32')],qs[_0x0ae6('0x38')](_0x167ed1['query'][_0x0ae6('0x38')]));_0x21431e[_0x0ae6('0x37')]=_0x21431e[_0x0ae6('0x37')][_0x0ae6('0x39')]?_0x21431e['attributes']:_0xb38cbb['model'];if(_0x167ed1['query'][_0x0ae6('0x44')]){_0x21431e[_0x0ae6('0x45')]=[{'all':!![]}];}_0x21431e=_[_0x0ae6('0x41')]({},_0x21431e,_0x167ed1['options']);return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')](_0x21431e)['then'](handleEntityNotFound(_0x24c021,null))[_0x0ae6('0x29')](respondWithResult(_0x24c021,null))[_0x0ae6('0x48')](handleError(_0x24c021,null));};exports['create']=function(_0x354efd,_0x3d1e75){return db['WhatsappQueueReport'][_0x0ae6('0x4c')](_0x354efd[_0x0ae6('0x4d')],{})[_0x0ae6('0x29')](respondWithResult(_0x3d1e75,0xc9))['catch'](handleError(_0x3d1e75,null));};exports[_0x0ae6('0x28')]=function(_0x21de54,_0x46075a){if(_0x21de54[_0x0ae6('0x4d')]['id']){delete _0x21de54[_0x0ae6('0x4d')]['id'];}return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')]({'where':{'id':_0x21de54['params']['id']}})['then'](handleEntityNotFound(_0x46075a,null))[_0x0ae6('0x29')](saveUpdates(_0x21de54[_0x0ae6('0x4d')],null))[_0x0ae6('0x29')](respondWithResult(_0x46075a,null))['catch'](handleError(_0x46075a,null));};exports[_0x0ae6('0x2a')]=function(_0x51df5c,_0x582a5e){return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')]({'where':{'id':_0x51df5c[_0x0ae6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x582a5e,null))[_0x0ae6('0x29')](removeEntity(_0x582a5e,null))[_0x0ae6('0x48')](handleError(_0x582a5e,null));};exports[_0x0ae6('0x4e')]=function(_0x327b55,_0x173acd){return db[_0x0ae6('0x2e')][_0x0ae6('0x4e')]()[_0x0ae6('0x29')](respondWithResult(_0x173acd,null))[_0x0ae6('0x48')](handleError(_0x173acd,null));}; \ No newline at end of file +var _0x58a4=['key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','include','create','body','update','find','params','describe','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','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','sendStatus','error','name','index','map','WhatsappQueueReport','fieldName'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x58a4,0xbf));var _0x458a=function(_0xfee10f,_0x53470e){_0xfee10f=_0xfee10f-0x0;var _0xb91051=_0x58a4[_0xfee10f];return _0xb91051;};'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'];function respondWithStatusCode(_0xee09c6,_0x2a4934){_0x2a4934=_0x2a4934||0xcc;return function(_0x2e788b){if(_0x2e788b){return _0xee09c6['sendStatus'](_0x2a4934);}return _0xee09c6['status'](_0x2a4934)[_0x458a('0x1a')]();};}function respondWithResult(_0x56436f,_0x2c7528){_0x2c7528=_0x2c7528||0xc8;return function(_0x44f683){if(_0x44f683){return _0x56436f[_0x458a('0x1b')](_0x2c7528)[_0x458a('0x1c')](_0x44f683);}};}function respondWithFilteredResult(_0xad80f9,_0x29acee){return function(_0x507b0f){if(_0x507b0f){var _0x4b26be=typeof _0x29acee['offset']===_0x458a('0x1d')&&typeof _0x29acee[_0x458a('0x1e')]===_0x458a('0x1d');var _0x5c5b41=_0x507b0f[_0x458a('0x1f')];var _0x260c87=_0x4b26be?0x0:_0x29acee[_0x458a('0x20')];var _0x392986=_0x4b26be?_0x507b0f[_0x458a('0x1f')]:_0x29acee['offset']+_0x29acee['limit'];var _0x178db9;if(_0x392986>=_0x5c5b41){_0x392986=_0x5c5b41;_0x178db9=0xc8;}else{_0x178db9=0xce;}_0xad80f9['status'](_0x178db9);return _0xad80f9[_0x458a('0x21')](_0x458a('0x22'),_0x260c87+'-'+_0x392986+'/'+_0x5c5b41)['json'](_0x507b0f);}return null;};}function patchUpdates(_0x468416){return function(_0x55a588){try{jsonpatch[_0x458a('0x23')](_0x55a588,_0x468416,!![]);}catch(_0x1c79cb){return BPromise['reject'](_0x1c79cb);}return _0x55a588[_0x458a('0x24')]();};}function saveUpdates(_0xead884,_0x5a2bcb){return function(_0xa6b8ff){if(_0xa6b8ff){return _0xa6b8ff['update'](_0xead884)[_0x458a('0x25')](function(_0x5bca42){return _0x5bca42;});}return null;};}function removeEntity(_0x4080fc,_0x5dfc6c){return function(_0x36b08e){if(_0x36b08e){return _0x36b08e[_0x458a('0x26')]()[_0x458a('0x25')](function(){_0x4080fc[_0x458a('0x1b')](0xcc)[_0x458a('0x1a')]();});}};}function handleEntityNotFound(_0x19bd5,_0x340375){return function(_0x3012c7){if(!_0x3012c7){_0x19bd5[_0x458a('0x27')](0x194);}return _0x3012c7;};}function handleError(_0xfc6b24,_0x52efed){_0x52efed=_0x52efed||0x1f4;return function(_0x327fcb){logger[_0x458a('0x28')](_0x327fcb['stack']);if(_0x327fcb[_0x458a('0x29')]){delete _0x327fcb[_0x458a('0x29')];}_0xfc6b24['status'](_0x52efed)['send'](_0x327fcb);};}exports[_0x458a('0x2a')]=function(_0x596fe2,_0x33c5d8){var _0x29f9b5={},_0x223f73={},_0x4a49e4={'count':0x0,'rows':[]};var _0xa6fdf=_[_0x458a('0x2b')](db[_0x458a('0x2c')]['rawAttributes'],function(_0x47e20d){return{'name':_0x47e20d[_0x458a('0x2d')],'type':_0x47e20d['type'][_0x458a('0x2e')]};});_0x223f73['model']=_[_0x458a('0x2b')](_0xa6fdf,_0x458a('0x29'));_0x223f73['query']=_[_0x458a('0x2f')](_0x596fe2[_0x458a('0x30')]);_0x223f73[_0x458a('0x31')]=_['intersection'](_0x223f73[_0x458a('0x32')],_0x223f73[_0x458a('0x30')]);_0x29f9b5[_0x458a('0x33')]=_[_0x458a('0x34')](_0x223f73[_0x458a('0x32')],qs['fields'](_0x596fe2[_0x458a('0x30')][_0x458a('0x35')]));_0x29f9b5[_0x458a('0x33')]=_0x29f9b5[_0x458a('0x33')][_0x458a('0x36')]?_0x29f9b5[_0x458a('0x33')]:_0x223f73['model'];if(!_0x596fe2[_0x458a('0x30')][_0x458a('0x37')](_0x458a('0x38'))){_0x29f9b5[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x596fe2[_0x458a('0x30')][_0x458a('0x1e')]);_0x29f9b5[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x596fe2['query'][_0x458a('0x20')]);}_0x29f9b5[_0x458a('0x39')]=qs[_0x458a('0x3a')](_0x596fe2[_0x458a('0x30')][_0x458a('0x3a')]);_0x29f9b5[_0x458a('0x3b')]=qs[_0x458a('0x31')](_[_0x458a('0x3c')](_0x596fe2[_0x458a('0x30')],_0x223f73[_0x458a('0x31')]),_0xa6fdf);if(_0x596fe2[_0x458a('0x30')][_0x458a('0x3d')]){_0x29f9b5[_0x458a('0x3b')]=_[_0x458a('0x3e')](_0x29f9b5[_0x458a('0x3b')],{'$or':_['map'](_0xa6fdf,function(_0x226cf0){if(_0x226cf0[_0x458a('0x3f')]!==_0x458a('0x40')){var _0x12dad4={};_0x12dad4[_0x226cf0[_0x458a('0x29')]]={'$like':'%'+_0x596fe2[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x12dad4;}})});}_0x29f9b5=_[_0x458a('0x3e')]({},_0x29f9b5,_0x596fe2[_0x458a('0x41')]);var _0x44c5ba={'where':_0x29f9b5[_0x458a('0x3b')]};return db['WhatsappQueueReport'][_0x458a('0x1f')](_0x44c5ba)[_0x458a('0x25')](function(_0x5da57a){_0x4a49e4[_0x458a('0x1f')]=_0x5da57a;if(_0x596fe2[_0x458a('0x30')][_0x458a('0x42')]){_0x29f9b5['include']=[{'all':!![]}];}return db[_0x458a('0x2c')][_0x458a('0x43')](_0x29f9b5);})[_0x458a('0x25')](function(_0x1e51d2){_0x4a49e4[_0x458a('0x44')]=_0x1e51d2;return _0x4a49e4;})[_0x458a('0x25')](respondWithFilteredResult(_0x33c5d8,_0x29f9b5))[_0x458a('0x45')](handleError(_0x33c5d8,null));};exports[_0x458a('0x46')]=function(_0x5883ab,_0x296385){var _0x145e3c={'raw':!![],'where':{'id':_0x5883ab['params']['id']}},_0x2b9030={};_0x2b9030[_0x458a('0x32')]=_[_0x458a('0x2f')](db['WhatsappQueueReport'][_0x458a('0x47')]);_0x2b9030[_0x458a('0x30')]=_[_0x458a('0x2f')](_0x5883ab[_0x458a('0x30')]);_0x2b9030[_0x458a('0x31')]=_['intersection'](_0x2b9030['model'],_0x2b9030[_0x458a('0x30')]);_0x145e3c[_0x458a('0x33')]=_[_0x458a('0x34')](_0x2b9030[_0x458a('0x32')],qs['fields'](_0x5883ab[_0x458a('0x30')][_0x458a('0x35')]));_0x145e3c['attributes']=_0x145e3c[_0x458a('0x33')]['length']?_0x145e3c[_0x458a('0x33')]:_0x2b9030[_0x458a('0x32')];if(_0x5883ab[_0x458a('0x30')]['includeAll']){_0x145e3c[_0x458a('0x48')]=[{'all':!![]}];}_0x145e3c=_[_0x458a('0x3e')]({},_0x145e3c,_0x5883ab[_0x458a('0x41')]);return db['WhatsappQueueReport']['find'](_0x145e3c)[_0x458a('0x25')](handleEntityNotFound(_0x296385,null))[_0x458a('0x25')](respondWithResult(_0x296385,null))[_0x458a('0x45')](handleError(_0x296385,null));};exports['create']=function(_0x5e7a64,_0x3a7005){return db[_0x458a('0x2c')][_0x458a('0x49')](_0x5e7a64[_0x458a('0x4a')],{})[_0x458a('0x25')](respondWithResult(_0x3a7005,0xc9))[_0x458a('0x45')](handleError(_0x3a7005,null));};exports[_0x458a('0x4b')]=function(_0x30cdaf,_0xb22232){if(_0x30cdaf[_0x458a('0x4a')]['id']){delete _0x30cdaf[_0x458a('0x4a')]['id'];}return db[_0x458a('0x2c')][_0x458a('0x4c')]({'where':{'id':_0x30cdaf[_0x458a('0x4d')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0xb22232,null))[_0x458a('0x25')](saveUpdates(_0x30cdaf['body'],null))[_0x458a('0x25')](respondWithResult(_0xb22232,null))[_0x458a('0x45')](handleError(_0xb22232,null));};exports[_0x458a('0x26')]=function(_0x396bb3,_0x44670a){return db['WhatsappQueueReport']['find']({'where':{'id':_0x396bb3['params']['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x44670a,null))['then'](removeEntity(_0x44670a,null))[_0x458a('0x45')](handleError(_0x44670a,null));};exports[_0x458a('0x4e')]=function(_0x2a35a9,_0x649553){return db[_0x458a('0x2c')]['describe']()['then'](respondWithResult(_0x649553,null))[_0x458a('0x45')](handleError(_0x649553,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 18f4a72..3ecedfd 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 _0xf99c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api'];(function(_0x2c8639,_0x5ccbc4){var _0x3f02e7=function(_0xa2bcd1){while(--_0xa2bcd1){_0x2c8639['push'](_0x2c8639['shift']());}};_0x3f02e7(++_0x5ccbc4);}(_0xf99c,0x138));var _0xcf99=function(_0x916406,_0x549340){_0x916406=_0x916406-0x0;var _0x455e62=_0xf99c[_0x916406];return _0x455e62;};'use strict';var _=require('lodash');var util=require(_0xcf99('0x0'));var logger=require(_0xcf99('0x1'))(_0xcf99('0x2'));var moment=require(_0xcf99('0x3'));var BPromise=require(_0xcf99('0x4'));var rp=require(_0xcf99('0x5'));var fs=require('fs');var path=require(_0xcf99('0x6'));var rimraf=require(_0xcf99('0x7'));var config=require(_0xcf99('0x8'));var attributes=require(_0xcf99('0x9'));module[_0xcf99('0xa')]=function(_0x339c3d,_0x2eafc4){return _0x339c3d[_0xcf99('0xb')](_0xcf99('0xc'),attributes,{'tableName':_0xcf99('0xd'),'paranoid':![],'indexes':[{'name':_0xcf99('0xe'),'fields':[_0xcf99('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x515b=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0x515b,0x1a8));var _0xb515=function(_0x2a8177,_0x396476){_0x2a8177=_0x2a8177-0x0;var _0x1fea78=_0x515b[_0x2a8177];return _0x1fea78;};'use strict';var _=require(_0xb515('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb515('0x1'));var moment=require(_0xb515('0x2'));var BPromise=require(_0xb515('0x3'));var rp=require(_0xb515('0x4'));var fs=require('fs');var path=require(_0xb515('0x5'));var rimraf=require('rimraf');var config=require(_0xb515('0x6'));var attributes=require(_0xb515('0x7'));module['exports']=function(_0x2b865e,_0xbcefc9){return _0x2b865e[_0xb515('0x8')](_0xb515('0x9'),attributes,{'tableName':_0xb515('0xa'),'paranoid':![],'indexes':[{'name':_0xb515('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index ffeb413..662fa63 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 _0xcbe6=['../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','raw','stringify','update','where','options','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5dc95d,_0x395e54){var _0x4caedd=function(_0x53fca1){while(--_0x53fca1){_0x5dc95d['push'](_0x5dc95d['shift']());}};_0x4caedd(++_0x395e54);}(_0xcbe6,0x106));var _0x6cbe=function(_0x58c6a9,_0x3a0caf){_0x58c6a9=_0x58c6a9-0x0;var _0x394f21=_0xcbe6[_0x58c6a9];return _0x394f21;};'use strict';var _=require(_0x6cbe('0x0'));var util=require(_0x6cbe('0x1'));var moment=require(_0x6cbe('0x2'));var BPromise=require(_0x6cbe('0x3'));var rs=require(_0x6cbe('0x4'));var fs=require('fs');var Redis=require(_0x6cbe('0x5'));var db=require(_0x6cbe('0x6'))['db'];var utils=require(_0x6cbe('0x7'));var logger=require(_0x6cbe('0x8'))(_0x6cbe('0x9'));var config=require(_0x6cbe('0xa'));var jayson=require(_0x6cbe('0xb'));var client=jayson[_0x6cbe('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21a172,_0xfca9b3,_0x35f6e8){return new BPromise(function(_0xd2f6f,_0x182a21){return client[_0x6cbe('0xd')](_0x21a172,_0x35f6e8)[_0x6cbe('0xe')](function(_0x527c13){logger[_0x6cbe('0xf')](_0x6cbe('0x10'),_0xfca9b3,_0x6cbe('0x11'));logger[_0x6cbe('0x12')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0xfca9b3,_0x6cbe('0x11'),JSON['stringify'](_0x527c13));if(_0x527c13['error']){if(_0x527c13[_0x6cbe('0x13')][_0x6cbe('0x14')]===0x1f4){logger[_0x6cbe('0x13')](_0x6cbe('0x10'),_0xfca9b3,_0x527c13['error'][_0x6cbe('0x15')]);return _0x182a21(_0x527c13[_0x6cbe('0x13')][_0x6cbe('0x15')]);}logger[_0x6cbe('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0xfca9b3,_0x527c13[_0x6cbe('0x13')][_0x6cbe('0x15')]);return _0xd2f6f(_0x527c13[_0x6cbe('0x13')]['message']);}else{logger[_0x6cbe('0xf')](_0x6cbe('0x10'),_0xfca9b3,_0x6cbe('0x11'));_0xd2f6f(_0x527c13['result'][_0x6cbe('0x15')]);}})[_0x6cbe('0x16')](function(_0x3ba94a){logger['error'](_0x6cbe('0x10'),_0xfca9b3,_0x3ba94a);_0x182a21(_0x3ba94a);});});}exports[_0x6cbe('0x17')]=function(_0x436769){var _0x261677=this;return new Promise(function(_0x562e74,_0x52587f){return db[_0x6cbe('0x18')][_0x6cbe('0x19')](_0x436769[_0x6cbe('0x1a')],{'raw':_0x436769['options']?_0x436769['options'][_0x6cbe('0x1b')]===undefined?!![]:![]:!![]})[_0x6cbe('0xe')](function(_0x426dc){logger[_0x6cbe('0xf')]('CreateWhatsappQueueReport',_0x436769);logger[_0x6cbe('0x12')](_0x6cbe('0x17'),_0x436769,JSON[_0x6cbe('0x1c')](_0x426dc));_0x562e74(_0x426dc);})[_0x6cbe('0x16')](function(_0x117bbd){logger['error']('CreateWhatsappQueueReport',_0x117bbd[_0x6cbe('0x15')],_0x436769);_0x52587f(_0x261677['error'](0x1f4,_0x117bbd['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x48ca07){var _0x129fe6=this;return new Promise(function(_0x118654,_0x3bee7f){return db['WhatsappQueueReport'][_0x6cbe('0x1d')](_0x48ca07[_0x6cbe('0x1a')],{'raw':_0x48ca07['options']?_0x48ca07['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48ca07['options']?_0x48ca07['options'][_0x6cbe('0x1e')]||null:null,'attributes':_0x48ca07[_0x6cbe('0x1f')]?_0x48ca07[_0x6cbe('0x1f')]['attributes']||null:null,'limit':_0x48ca07[_0x6cbe('0x1f')]?_0x48ca07[_0x6cbe('0x1f')][_0x6cbe('0x20')]||null:null})['then'](function(_0x541e64){logger['info'](_0x6cbe('0x21'),_0x48ca07);logger['debug'](_0x6cbe('0x21'),_0x48ca07,JSON[_0x6cbe('0x1c')](_0x541e64));_0x118654(_0x541e64);})[_0x6cbe('0x16')](function(_0x3626f9){logger['error'](_0x6cbe('0x21'),_0x3626f9[_0x6cbe('0x15')],_0x48ca07);_0x3bee7f(_0x129fe6[_0x6cbe('0x13')](0x1f4,_0x3626f9[_0x6cbe('0x15')]));});});}; \ No newline at end of file +var _0x457f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','then','body','raw','where','attributes','UpdateWhatsappQueueReport','lodash'];(function(_0x8486a4,_0x33ce32){var _0x114e55=function(_0x5168f0){while(--_0x5168f0){_0x8486a4['push'](_0x8486a4['shift']());}};_0x114e55(++_0x33ce32);}(_0x457f,0x117));var _0xf457=function(_0x2f209c,_0x26bf39){_0x2f209c=_0x2f209c-0x0;var _0x32ed8a=_0x457f[_0x2f209c];return _0x32ed8a;};'use strict';var _=require(_0xf457('0x0'));var util=require(_0xf457('0x1'));var moment=require(_0xf457('0x2'));var BPromise=require(_0xf457('0x3'));var rs=require(_0xf457('0x4'));var fs=require('fs');var Redis=require(_0xf457('0x5'));var db=require(_0xf457('0x6'))['db'];var utils=require(_0xf457('0x7'));var logger=require(_0xf457('0x8'))(_0xf457('0x9'));var config=require(_0xf457('0xa'));var jayson=require(_0xf457('0xb'));var client=jayson['client'][_0xf457('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5dde00,_0x320389,_0x560fa8){return new BPromise(function(_0x24d591,_0x430387){return client[_0xf457('0xd')](_0x5dde00,_0x560fa8)['then'](function(_0x18cfdf){logger[_0xf457('0xe')](_0xf457('0xf'),_0x320389,_0xf457('0x10'));logger[_0xf457('0x11')](_0xf457('0x12'),_0x320389,_0xf457('0x10'),JSON[_0xf457('0x13')](_0x18cfdf));if(_0x18cfdf['error']){if(_0x18cfdf[_0xf457('0x14')][_0xf457('0x15')]===0x1f4){logger[_0xf457('0x14')](_0xf457('0xf'),_0x320389,_0x18cfdf[_0xf457('0x14')]['message']);return _0x430387(_0x18cfdf[_0xf457('0x14')][_0xf457('0x16')]);}logger['error'](_0xf457('0xf'),_0x320389,_0x18cfdf[_0xf457('0x14')][_0xf457('0x16')]);return _0x24d591(_0x18cfdf[_0xf457('0x14')][_0xf457('0x16')]);}else{logger[_0xf457('0xe')](_0xf457('0xf'),_0x320389,_0xf457('0x10'));_0x24d591(_0x18cfdf[_0xf457('0x17')][_0xf457('0x16')]);}})[_0xf457('0x18')](function(_0x3a5ffb){logger[_0xf457('0x14')](_0xf457('0xf'),_0x320389,_0x3a5ffb);_0x430387(_0x3a5ffb);});});}exports[_0xf457('0x19')]=function(_0x5a15fb){var _0xcbd90c=this;return new Promise(function(_0x54f4dd,_0x368265){return db[_0xf457('0x1a')][_0xf457('0x1b')](_0x5a15fb['body'],{'raw':_0x5a15fb[_0xf457('0x1c')]?_0x5a15fb[_0xf457('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xf457('0x1d')](function(_0x5d1f1e){logger[_0xf457('0xe')](_0xf457('0x19'),_0x5a15fb);logger[_0xf457('0x11')]('CreateWhatsappQueueReport',_0x5a15fb,JSON[_0xf457('0x13')](_0x5d1f1e));_0x54f4dd(_0x5d1f1e);})['catch'](function(_0x4faa65){logger[_0xf457('0x14')]('CreateWhatsappQueueReport',_0x4faa65[_0xf457('0x16')],_0x5a15fb);_0x368265(_0xcbd90c['error'](0x1f4,_0x4faa65['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x32959d){var _0x5e0193=this;return new Promise(function(_0x3168b7,_0x32e846){return db[_0xf457('0x1a')]['update'](_0x32959d[_0xf457('0x1e')],{'raw':_0x32959d['options']?_0x32959d[_0xf457('0x1c')][_0xf457('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32959d['options']?_0x32959d[_0xf457('0x1c')][_0xf457('0x20')]||null:null,'attributes':_0x32959d[_0xf457('0x1c')]?_0x32959d[_0xf457('0x1c')][_0xf457('0x21')]||null:null,'limit':_0x32959d[_0xf457('0x1c')]?_0x32959d[_0xf457('0x1c')]['limit']||null:null})['then'](function(_0xdf5563){logger['info'](_0xf457('0x22'),_0x32959d);logger['debug']('UpdateWhatsappQueueReport',_0x32959d,JSON[_0xf457('0x13')](_0xdf5563));_0x3168b7(_0xdf5563);})[_0xf457('0x18')](function(_0x478a8a){logger[_0xf457('0x14')](_0xf457('0x22'),_0x478a8a[_0xf457('0x16')],_0x32959d);_0x32e846(_0x5e0193['error'](0x1f4,_0x478a8a[_0xf457('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 3465622..b4b4b0b 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 _0x3aa2=['get','show','create','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','./whatsappTransferReport.controller','isAuthenticated','index'];(function(_0x21c76e,_0x657e32){var _0x1c28c7=function(_0x1053ed){while(--_0x1053ed){_0x21c76e['push'](_0x21c76e['shift']());}};_0x1c28c7(++_0x657e32);}(_0x3aa2,0x1c8));var _0x23aa=function(_0x1f09fa,_0x3265ca){_0x1f09fa=_0x1f09fa-0x0;var _0x197c8d=_0x3aa2[_0x1f09fa];return _0x197c8d;};'use strict';var multer=require(_0x23aa('0x0'));var util=require('util');var path=require(_0x23aa('0x1'));var timeout=require(_0x23aa('0x2'));var express=require(_0x23aa('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x23aa('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x23aa('0x5'));router['get']('/',auth[_0x23aa('0x6')](),controller[_0x23aa('0x7')]);router[_0x23aa('0x8')]('/describe',auth[_0x23aa('0x6')](),controller['describe']);router['get']('/:id',auth[_0x23aa('0x6')](),controller[_0x23aa('0x9')]);router['post']('/',auth[_0x23aa('0x6')](),controller[_0x23aa('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x23aa('0xb')]);router[_0x23aa('0xc')](_0x23aa('0xd'),auth[_0x23aa('0x6')](),controller[_0x23aa('0xe')]);module[_0x23aa('0xf')]=router; \ No newline at end of file +var _0x4be7=['Router','fs-extra','../../components/auth/service','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','update','delete','exports','multer','util','express'];(function(_0x536ae9,_0x191263){var _0xd7e70e=function(_0x1ae89d){while(--_0x1ae89d){_0x536ae9['push'](_0x536ae9['shift']());}};_0xd7e70e(++_0x191263);}(_0x4be7,0xc3));var _0x74be=function(_0x260b6f,_0x1edc36){_0x260b6f=_0x260b6f-0x0;var _0x3f672e=_0x4be7[_0x260b6f];return _0x3f672e;};'use strict';var multer=require(_0x74be('0x0'));var util=require(_0x74be('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x74be('0x2'));var router=express[_0x74be('0x3')]();var fs_extra=require(_0x74be('0x4'));var auth=require(_0x74be('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x74be('0x6'));router[_0x74be('0x7')]('/',auth['isAuthenticated'](),controller[_0x74be('0x8')]);router['get'](_0x74be('0x9'),auth[_0x74be('0xa')](),controller[_0x74be('0xb')]);router['get'](_0x74be('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x74be('0xd')]('/',auth['isAuthenticated'](),controller[_0x74be('0xe')]);router['put'](_0x74be('0xc'),auth[_0x74be('0xa')](),controller[_0x74be('0xf')]);router[_0x74be('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x74be('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 72d4a97..9f514e1 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 _0x4f9b=['ENUM','account','agent','queue','DATE','sequelize','exports','STRING'];(function(_0x25ffcb,_0x280444){var _0xd28675=function(_0x1f9925){while(--_0x1f9925){_0x25ffcb['push'](_0x25ffcb['shift']());}};_0xd28675(++_0x280444);}(_0x4f9b,0x6d));var _0xb4f9=function(_0x4dde9a,_0x330085){_0x4dde9a=_0x4dde9a-0x0;var _0x562f39=_0x4f9b[_0x4dde9a];return _0x562f39;};'use strict';var Sequelize=require(_0xb4f9('0x0'));module[_0xb4f9('0x1')]={'uniqueid':{'type':Sequelize[_0xb4f9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb4f9('0x3')](_0xb4f9('0x4'),_0xb4f9('0x5'),_0xb4f9('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xb4f9('0x7')]}}; \ No newline at end of file +var _0xa057=['account','agent','DATE','sequelize','exports','ENUM'];(function(_0x4acfd2,_0x5b9374){var _0x12afbe=function(_0x5bc178){while(--_0x5bc178){_0x4acfd2['push'](_0x4acfd2['shift']());}};_0x12afbe(++_0x5b9374);}(_0xa057,0x123));var _0x7a05=function(_0x25f8af,_0x16389b){_0x25f8af=_0x25f8af-0x0;var _0x3624ea=_0xa057[_0x25f8af];return _0x3624ea;};'use strict';var Sequelize=require(_0x7a05('0x0'));module[_0x7a05('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7a05('0x2')](_0x7a05('0x3'),_0x7a05('0x4'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7a05('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index bff70b2..c8bf62a 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 _0xa2fa=['bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','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','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','WhatsappTransferReport','include','findAll','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x546c06,_0x44a1cf){var _0x8d9f55=function(_0x495cf0){while(--_0x495cf0){_0x546c06['push'](_0x546c06['shift']());}};_0x8d9f55(++_0x44a1cf);}(_0xa2fa,0x95));var _0xaa2f=function(_0xd7d2ae,_0x99f8b2){_0xd7d2ae=_0xd7d2ae-0x0;var _0xc899a3=_0xa2fa[_0xd7d2ae];return _0xc899a3;};'use strict';var emlformat=require(_0xaa2f('0x0'));var rimraf=require(_0xaa2f('0x1'));var zipdir=require(_0xaa2f('0x2'));var jsonpatch=require(_0xaa2f('0x3'));var rp=require(_0xaa2f('0x4'));var moment=require('moment');var BPromise=require(_0xaa2f('0x5'));var Mustache=require(_0xaa2f('0x6'));var util=require(_0xaa2f('0x7'));var path=require(_0xaa2f('0x8'));var sox=require(_0xaa2f('0x9'));var csv=require(_0xaa2f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa2f('0xb'));var _=require(_0xaa2f('0xc'));var squel=require('squel');var crypto=require(_0xaa2f('0xd'));var jsforce=require(_0xaa2f('0xe'));var deskjs=require(_0xaa2f('0xf'));var toCsv=require(_0xaa2f('0xa'));var querystring=require(_0xaa2f('0x10'));var Papa=require(_0xaa2f('0x11'));var Redis=require(_0xaa2f('0x12'));var authService=require(_0xaa2f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaa2f('0x14'));var hardwareService=require(_0xaa2f('0x15'));var logger=require(_0xaa2f('0x16'))(_0xaa2f('0x17'));var utils=require(_0xaa2f('0x18'));var config=require(_0xaa2f('0x19'));var licenseUtil=require(_0xaa2f('0x1a'));var db=require(_0xaa2f('0x1b'))['db'];function respondWithStatusCode(_0x24c9da,_0x2edd43){_0x2edd43=_0x2edd43||0xcc;return function(_0x3743a3){if(_0x3743a3){return _0x24c9da[_0xaa2f('0x1c')](_0x2edd43);}return _0x24c9da['status'](_0x2edd43)[_0xaa2f('0x1d')]();};}function respondWithResult(_0x126d37,_0x9a0e59){_0x9a0e59=_0x9a0e59||0xc8;return function(_0x4a78e4){if(_0x4a78e4){return _0x126d37[_0xaa2f('0x1e')](_0x9a0e59)[_0xaa2f('0x1f')](_0x4a78e4);}};}function respondWithFilteredResult(_0x4cb69,_0x405f0e){return function(_0x5cb8e8){if(_0x5cb8e8){var _0x18a9c5=typeof _0x405f0e[_0xaa2f('0x20')]===_0xaa2f('0x21')&&typeof _0x405f0e['limit']===_0xaa2f('0x21');var _0x52af56=_0x5cb8e8[_0xaa2f('0x22')];var _0x171762=_0x18a9c5?0x0:_0x405f0e[_0xaa2f('0x20')];var _0x32448f=_0x18a9c5?_0x5cb8e8[_0xaa2f('0x22')]:_0x405f0e[_0xaa2f('0x20')]+_0x405f0e[_0xaa2f('0x23')];var _0x2636dd;if(_0x32448f>=_0x52af56){_0x32448f=_0x52af56;_0x2636dd=0xc8;}else{_0x2636dd=0xce;}_0x4cb69[_0xaa2f('0x1e')](_0x2636dd);return _0x4cb69[_0xaa2f('0x24')](_0xaa2f('0x25'),_0x171762+'-'+_0x32448f+'/'+_0x52af56)[_0xaa2f('0x1f')](_0x5cb8e8);}return null;};}function patchUpdates(_0x57cb7b){return function(_0x331c78){try{jsonpatch[_0xaa2f('0x26')](_0x331c78,_0x57cb7b,!![]);}catch(_0x186a6e){return BPromise[_0xaa2f('0x27')](_0x186a6e);}return _0x331c78['save']();};}function saveUpdates(_0x1e7cf4,_0x459dc8){return function(_0x4ab436){if(_0x4ab436){return _0x4ab436[_0xaa2f('0x28')](_0x1e7cf4)[_0xaa2f('0x29')](function(_0x32c95c){return _0x32c95c;});}return null;};}function removeEntity(_0x1a084a,_0x1979ac){return function(_0x14bbac){if(_0x14bbac){return _0x14bbac[_0xaa2f('0x2a')]()[_0xaa2f('0x29')](function(){_0x1a084a[_0xaa2f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39fc45,_0x537947){return function(_0x267be6){if(!_0x267be6){_0x39fc45['sendStatus'](0x194);}return _0x267be6;};}function handleError(_0x1bff96,_0x1f8132){_0x1f8132=_0x1f8132||0x1f4;return function(_0x4e1315){logger[_0xaa2f('0x2b')](_0x4e1315[_0xaa2f('0x2c')]);if(_0x4e1315['name']){delete _0x4e1315[_0xaa2f('0x2d')];}_0x1bff96['status'](_0x1f8132)[_0xaa2f('0x2e')](_0x4e1315);};}exports['index']=function(_0x2f478d,_0x546ff3){var _0x47956d={},_0x25476d={},_0x42cafb={'count':0x0,'rows':[]};var _0x46d800=_[_0xaa2f('0x2f')](db['WhatsappTransferReport'][_0xaa2f('0x30')],function(_0x32878d){return{'name':_0x32878d['fieldName'],'type':_0x32878d[_0xaa2f('0x31')]['key']};});_0x25476d[_0xaa2f('0x32')]=_[_0xaa2f('0x2f')](_0x46d800,'name');_0x25476d[_0xaa2f('0x33')]=_['keys'](_0x2f478d[_0xaa2f('0x33')]);_0x25476d['filters']=_['intersection'](_0x25476d[_0xaa2f('0x32')],_0x25476d[_0xaa2f('0x33')]);_0x47956d[_0xaa2f('0x34')]=_[_0xaa2f('0x35')](_0x25476d['model'],qs[_0xaa2f('0x36')](_0x2f478d[_0xaa2f('0x33')][_0xaa2f('0x36')]));_0x47956d[_0xaa2f('0x34')]=_0x47956d[_0xaa2f('0x34')][_0xaa2f('0x37')]?_0x47956d[_0xaa2f('0x34')]:_0x25476d[_0xaa2f('0x32')];if(!_0x2f478d[_0xaa2f('0x33')][_0xaa2f('0x38')](_0xaa2f('0x39'))){_0x47956d[_0xaa2f('0x23')]=qs[_0xaa2f('0x23')](_0x2f478d['query']['limit']);_0x47956d[_0xaa2f('0x20')]=qs[_0xaa2f('0x20')](_0x2f478d[_0xaa2f('0x33')]['offset']);}_0x47956d['order']=qs[_0xaa2f('0x3a')](_0x2f478d[_0xaa2f('0x33')][_0xaa2f('0x3a')]);_0x47956d[_0xaa2f('0x3b')]=qs[_0xaa2f('0x3c')](_[_0xaa2f('0x3d')](_0x2f478d[_0xaa2f('0x33')],_0x25476d[_0xaa2f('0x3c')]),_0x46d800);if(_0x2f478d[_0xaa2f('0x33')][_0xaa2f('0x3e')]){_0x47956d[_0xaa2f('0x3b')]=_['merge'](_0x47956d[_0xaa2f('0x3b')],{'$or':_[_0xaa2f('0x2f')](_0x46d800,function(_0x367f2e){if(_0x367f2e[_0xaa2f('0x31')]!==_0xaa2f('0x3f')){var _0x225605={};_0x225605[_0x367f2e[_0xaa2f('0x2d')]]={'$like':'%'+_0x2f478d[_0xaa2f('0x33')][_0xaa2f('0x3e')]+'%'};return _0x225605;}})});}_0x47956d=_[_0xaa2f('0x40')]({},_0x47956d,_0x2f478d[_0xaa2f('0x41')]);var _0x5270f3={'where':_0x47956d[_0xaa2f('0x3b')]};return db[_0xaa2f('0x42')][_0xaa2f('0x22')](_0x5270f3)[_0xaa2f('0x29')](function(_0x43c608){_0x42cafb[_0xaa2f('0x22')]=_0x43c608;if(_0x2f478d[_0xaa2f('0x33')]['includeAll']){_0x47956d[_0xaa2f('0x43')]=[{'all':!![]}];}return db[_0xaa2f('0x42')][_0xaa2f('0x44')](_0x47956d);})['then'](function(_0x1a6a80){_0x42cafb['rows']=_0x1a6a80;return _0x42cafb;})[_0xaa2f('0x29')](respondWithFilteredResult(_0x546ff3,_0x47956d))[_0xaa2f('0x45')](handleError(_0x546ff3,null));};exports[_0xaa2f('0x46')]=function(_0x358def,_0x4dd7d3){var _0x3a060c={'raw':!![],'where':{'id':_0x358def[_0xaa2f('0x47')]['id']}},_0x15646a={};_0x15646a[_0xaa2f('0x32')]=_['keys'](db[_0xaa2f('0x42')]['rawAttributes']);_0x15646a[_0xaa2f('0x33')]=_[_0xaa2f('0x48')](_0x358def['query']);_0x15646a[_0xaa2f('0x3c')]=_[_0xaa2f('0x35')](_0x15646a[_0xaa2f('0x32')],_0x15646a['query']);_0x3a060c[_0xaa2f('0x34')]=_[_0xaa2f('0x35')](_0x15646a['model'],qs[_0xaa2f('0x36')](_0x358def[_0xaa2f('0x33')][_0xaa2f('0x36')]));_0x3a060c[_0xaa2f('0x34')]=_0x3a060c[_0xaa2f('0x34')][_0xaa2f('0x37')]?_0x3a060c[_0xaa2f('0x34')]:_0x15646a[_0xaa2f('0x32')];if(_0x358def[_0xaa2f('0x33')]['includeAll']){_0x3a060c['include']=[{'all':!![]}];}_0x3a060c=_[_0xaa2f('0x40')]({},_0x3a060c,_0x358def[_0xaa2f('0x41')]);return db[_0xaa2f('0x42')][_0xaa2f('0x49')](_0x3a060c)['then'](handleEntityNotFound(_0x4dd7d3,null))[_0xaa2f('0x29')](respondWithResult(_0x4dd7d3,null))[_0xaa2f('0x45')](handleError(_0x4dd7d3,null));};exports[_0xaa2f('0x4a')]=function(_0xf8f6f9,_0x48a32d){return db['WhatsappTransferReport']['create'](_0xf8f6f9[_0xaa2f('0x4b')],{})[_0xaa2f('0x29')](respondWithResult(_0x48a32d,0xc9))[_0xaa2f('0x45')](handleError(_0x48a32d,null));};exports['update']=function(_0xbe260e,_0x512ccd){if(_0xbe260e[_0xaa2f('0x4b')]['id']){delete _0xbe260e[_0xaa2f('0x4b')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0xbe260e[_0xaa2f('0x47')]['id']}})[_0xaa2f('0x29')](handleEntityNotFound(_0x512ccd,null))['then'](saveUpdates(_0xbe260e[_0xaa2f('0x4b')],null))['then'](respondWithResult(_0x512ccd,null))[_0xaa2f('0x45')](handleError(_0x512ccd,null));};exports[_0xaa2f('0x2a')]=function(_0x5c01c1,_0x3d45b8){return db[_0xaa2f('0x42')][_0xaa2f('0x49')]({'where':{'id':_0x5c01c1['params']['id']}})[_0xaa2f('0x29')](handleEntityNotFound(_0x3d45b8,null))['then'](removeEntity(_0x3d45b8,null))['catch'](handleError(_0x3d45b8,null));};exports[_0xaa2f('0x4c')]=function(_0x200d4b,_0x11649e){return db['WhatsappTransferReport'][_0xaa2f('0x4c')]()['then'](respondWithResult(_0x11649e,null))['catch'](handleError(_0x11649e,null));}; \ No newline at end of file +var _0xabf0=['include','findAll','rows','catch','show','keys','fields','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','query','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','where','type','VIRTUAL','options','includeAll'];(function(_0x1fe666,_0x52a29d){var _0x37fa85=function(_0x761218){while(--_0x761218){_0x1fe666['push'](_0x1fe666['shift']());}};_0x37fa85(++_0x52a29d);}(_0xabf0,0x183));var _0x0abf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xabf0[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0abf('0x0'));var zipdir=require(_0x0abf('0x1'));var jsonpatch=require(_0x0abf('0x2'));var rp=require(_0x0abf('0x3'));var moment=require('moment');var BPromise=require(_0x0abf('0x4'));var Mustache=require('mustache');var util=require(_0x0abf('0x5'));var path=require(_0x0abf('0x6'));var sox=require(_0x0abf('0x7'));var csv=require(_0x0abf('0x8'));var ejs=require(_0x0abf('0x9'));var fs=require('fs');var fs_extra=require(_0x0abf('0xa'));var _=require('lodash');var squel=require(_0x0abf('0xb'));var crypto=require(_0x0abf('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0abf('0x8'));var querystring=require(_0x0abf('0xd'));var Papa=require(_0x0abf('0xe'));var Redis=require('ioredis');var authService=require(_0x0abf('0xf'));var qs=require(_0x0abf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0abf('0x11'));var logger=require('../../config/logger')(_0x0abf('0x12'));var utils=require(_0x0abf('0x13'));var config=require(_0x0abf('0x14'));var licenseUtil=require(_0x0abf('0x15'));var db=require(_0x0abf('0x16'))['db'];function respondWithStatusCode(_0x26137c,_0x517f3f){_0x517f3f=_0x517f3f||0xcc;return function(_0x21bea2){if(_0x21bea2){return _0x26137c[_0x0abf('0x17')](_0x517f3f);}return _0x26137c[_0x0abf('0x18')](_0x517f3f)[_0x0abf('0x19')]();};}function respondWithResult(_0x2b75df,_0x4ca536){_0x4ca536=_0x4ca536||0xc8;return function(_0x41a248){if(_0x41a248){return _0x2b75df[_0x0abf('0x18')](_0x4ca536)[_0x0abf('0x1a')](_0x41a248);}};}function respondWithFilteredResult(_0x1e1db8,_0x125528){return function(_0x4d7e4f){if(_0x4d7e4f){var _0x1aeb02=typeof _0x125528['offset']==='undefined'&&typeof _0x125528[_0x0abf('0x1b')]===_0x0abf('0x1c');var _0x4b1f48=_0x4d7e4f[_0x0abf('0x1d')];var _0x5675f1=_0x1aeb02?0x0:_0x125528[_0x0abf('0x1e')];var _0x4a266a=_0x1aeb02?_0x4d7e4f[_0x0abf('0x1d')]:_0x125528[_0x0abf('0x1e')]+_0x125528['limit'];var _0x4d11c3;if(_0x4a266a>=_0x4b1f48){_0x4a266a=_0x4b1f48;_0x4d11c3=0xc8;}else{_0x4d11c3=0xce;}_0x1e1db8[_0x0abf('0x18')](_0x4d11c3);return _0x1e1db8[_0x0abf('0x1f')](_0x0abf('0x20'),_0x5675f1+'-'+_0x4a266a+'/'+_0x4b1f48)[_0x0abf('0x1a')](_0x4d7e4f);}return null;};}function patchUpdates(_0x1c7339){return function(_0x13f0dc){try{jsonpatch[_0x0abf('0x21')](_0x13f0dc,_0x1c7339,!![]);}catch(_0x1b53f7){return BPromise[_0x0abf('0x22')](_0x1b53f7);}return _0x13f0dc['save']();};}function saveUpdates(_0x3bdd7e,_0x1e1b9c){return function(_0x5610c3){if(_0x5610c3){return _0x5610c3[_0x0abf('0x23')](_0x3bdd7e)[_0x0abf('0x24')](function(_0x52a964){return _0x52a964;});}return null;};}function removeEntity(_0x3f88ff,_0x5b5452){return function(_0xeb6f92){if(_0xeb6f92){return _0xeb6f92[_0x0abf('0x25')]()['then'](function(){_0x3f88ff[_0x0abf('0x18')](0xcc)[_0x0abf('0x19')]();});}};}function handleEntityNotFound(_0x159bb5,_0x4882f5){return function(_0xad1621){if(!_0xad1621){_0x159bb5['sendStatus'](0x194);}return _0xad1621;};}function handleError(_0x17e384,_0x16450c){_0x16450c=_0x16450c||0x1f4;return function(_0x4785e2){logger['error'](_0x4785e2['stack']);if(_0x4785e2[_0x0abf('0x26')]){delete _0x4785e2[_0x0abf('0x26')];}_0x17e384[_0x0abf('0x18')](_0x16450c)['send'](_0x4785e2);};}exports[_0x0abf('0x27')]=function(_0x13e9e0,_0xb94e8b){var _0x45472a={},_0x151902={},_0x26d11e={'count':0x0,'rows':[]};var _0x2f3984=_[_0x0abf('0x28')](db[_0x0abf('0x29')][_0x0abf('0x2a')],function(_0x56e36d){return{'name':_0x56e36d[_0x0abf('0x2b')],'type':_0x56e36d['type'][_0x0abf('0x2c')]};});_0x151902['model']=_[_0x0abf('0x28')](_0x2f3984,_0x0abf('0x26'));_0x151902['query']=_['keys'](_0x13e9e0[_0x0abf('0x2d')]);_0x151902['filters']=_['intersection'](_0x151902[_0x0abf('0x2e')],_0x151902['query']);_0x45472a[_0x0abf('0x2f')]=_[_0x0abf('0x30')](_0x151902[_0x0abf('0x2e')],qs['fields'](_0x13e9e0[_0x0abf('0x2d')]['fields']));_0x45472a[_0x0abf('0x2f')]=_0x45472a[_0x0abf('0x2f')][_0x0abf('0x31')]?_0x45472a[_0x0abf('0x2f')]:_0x151902[_0x0abf('0x2e')];if(!_0x13e9e0[_0x0abf('0x2d')][_0x0abf('0x32')](_0x0abf('0x33'))){_0x45472a[_0x0abf('0x1b')]=qs[_0x0abf('0x1b')](_0x13e9e0[_0x0abf('0x2d')][_0x0abf('0x1b')]);_0x45472a['offset']=qs[_0x0abf('0x1e')](_0x13e9e0[_0x0abf('0x2d')]['offset']);}_0x45472a[_0x0abf('0x34')]=qs['sort'](_0x13e9e0[_0x0abf('0x2d')][_0x0abf('0x35')]);_0x45472a['where']=qs['filters'](_[_0x0abf('0x36')](_0x13e9e0[_0x0abf('0x2d')],_0x151902[_0x0abf('0x37')]),_0x2f3984);if(_0x13e9e0[_0x0abf('0x2d')][_0x0abf('0x38')]){_0x45472a['where']=_[_0x0abf('0x39')](_0x45472a[_0x0abf('0x3a')],{'$or':_['map'](_0x2f3984,function(_0x1894ea){if(_0x1894ea[_0x0abf('0x3b')]!==_0x0abf('0x3c')){var _0x2517ed={};_0x2517ed[_0x1894ea[_0x0abf('0x26')]]={'$like':'%'+_0x13e9e0[_0x0abf('0x2d')]['filter']+'%'};return _0x2517ed;}})});}_0x45472a=_[_0x0abf('0x39')]({},_0x45472a,_0x13e9e0[_0x0abf('0x3d')]);var _0x560207={'where':_0x45472a[_0x0abf('0x3a')]};return db[_0x0abf('0x29')]['count'](_0x560207)[_0x0abf('0x24')](function(_0x38266){_0x26d11e[_0x0abf('0x1d')]=_0x38266;if(_0x13e9e0[_0x0abf('0x2d')][_0x0abf('0x3e')]){_0x45472a[_0x0abf('0x3f')]=[{'all':!![]}];}return db[_0x0abf('0x29')][_0x0abf('0x40')](_0x45472a);})[_0x0abf('0x24')](function(_0x34b528){_0x26d11e[_0x0abf('0x41')]=_0x34b528;return _0x26d11e;})[_0x0abf('0x24')](respondWithFilteredResult(_0xb94e8b,_0x45472a))[_0x0abf('0x42')](handleError(_0xb94e8b,null));};exports[_0x0abf('0x43')]=function(_0x5363d6,_0x4c6b16){var _0x50cdb3={'raw':!![],'where':{'id':_0x5363d6['params']['id']}},_0x6df629={};_0x6df629['model']=_[_0x0abf('0x44')](db[_0x0abf('0x29')][_0x0abf('0x2a')]);_0x6df629[_0x0abf('0x2d')]=_[_0x0abf('0x44')](_0x5363d6[_0x0abf('0x2d')]);_0x6df629[_0x0abf('0x37')]=_[_0x0abf('0x30')](_0x6df629[_0x0abf('0x2e')],_0x6df629[_0x0abf('0x2d')]);_0x50cdb3[_0x0abf('0x2f')]=_['intersection'](_0x6df629[_0x0abf('0x2e')],qs[_0x0abf('0x45')](_0x5363d6[_0x0abf('0x2d')][_0x0abf('0x45')]));_0x50cdb3[_0x0abf('0x2f')]=_0x50cdb3[_0x0abf('0x2f')][_0x0abf('0x31')]?_0x50cdb3[_0x0abf('0x2f')]:_0x6df629[_0x0abf('0x2e')];if(_0x5363d6[_0x0abf('0x2d')]['includeAll']){_0x50cdb3[_0x0abf('0x3f')]=[{'all':!![]}];}_0x50cdb3=_[_0x0abf('0x39')]({},_0x50cdb3,_0x5363d6[_0x0abf('0x3d')]);return db[_0x0abf('0x29')]['find'](_0x50cdb3)[_0x0abf('0x24')](handleEntityNotFound(_0x4c6b16,null))[_0x0abf('0x24')](respondWithResult(_0x4c6b16,null))[_0x0abf('0x42')](handleError(_0x4c6b16,null));};exports[_0x0abf('0x46')]=function(_0x239a50,_0x57831b){return db[_0x0abf('0x29')][_0x0abf('0x46')](_0x239a50[_0x0abf('0x47')],{})[_0x0abf('0x24')](respondWithResult(_0x57831b,0xc9))[_0x0abf('0x42')](handleError(_0x57831b,null));};exports[_0x0abf('0x23')]=function(_0x1f617d,_0x4798df){if(_0x1f617d[_0x0abf('0x47')]['id']){delete _0x1f617d[_0x0abf('0x47')]['id'];}return db['WhatsappTransferReport'][_0x0abf('0x48')]({'where':{'id':_0x1f617d[_0x0abf('0x49')]['id']}})[_0x0abf('0x24')](handleEntityNotFound(_0x4798df,null))[_0x0abf('0x24')](saveUpdates(_0x1f617d[_0x0abf('0x47')],null))[_0x0abf('0x24')](respondWithResult(_0x4798df,null))['catch'](handleError(_0x4798df,null));};exports['destroy']=function(_0x47323d,_0x4cdc15){return db['WhatsappTransferReport'][_0x0abf('0x48')]({'where':{'id':_0x47323d[_0x0abf('0x49')]['id']}})['then'](handleEntityNotFound(_0x4cdc15,null))['then'](removeEntity(_0x4cdc15,null))[_0x0abf('0x42')](handleError(_0x4cdc15,null));};exports[_0x0abf('0x4a')]=function(_0x16a0a1,_0x5b6f42){return db[_0x0abf('0x29')]['describe']()[_0x0abf('0x24')](respondWithResult(_0x5b6f42,null))[_0x0abf('0x42')](handleError(_0x5b6f42,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 6232ae1..21b612e 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 _0x7290=['../../config/logger','bluebird','rimraf','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x7290,0x1b6));var _0x0729=function(_0x4178af,_0x388652){_0x4178af=_0x4178af-0x0;var _0x20f4b1=_0x7290[_0x4178af];return _0x20f4b1;};'use strict';var _=require(_0x0729('0x0'));var util=require(_0x0729('0x1'));var logger=require(_0x0729('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0729('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0729('0x4'));var config=require(_0x0729('0x5'));var attributes=require('./whatsappTransferReport.attributes');module[_0x0729('0x6')]=function(_0x3baf28,_0x1e9c5f){return _0x3baf28[_0x0729('0x7')](_0x0729('0x8'),attributes,{'tableName':_0x0729('0x9'),'paranoid':![],'indexes':[{'name':_0x0729('0xa'),'fields':[_0x0729('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1358=['WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappTransferReport.attributes','exports','define'];(function(_0x372268,_0x155c8d){var _0x2b39af=function(_0x3e971c){while(--_0x3e971c){_0x372268['push'](_0x372268['shift']());}};_0x2b39af(++_0x155c8d);}(_0x1358,0xd3));var _0x8135=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x1358[_0xae7c2f];return _0x5d7001;};'use strict';var _=require('lodash');var util=require(_0x8135('0x0'));var logger=require(_0x8135('0x1'))(_0x8135('0x2'));var moment=require(_0x8135('0x3'));var BPromise=require(_0x8135('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8135('0x5'));var rimraf=require(_0x8135('0x6'));var config=require('../../config/environment');var attributes=require(_0x8135('0x7'));module[_0x8135('0x8')]=function(_0x3cd618,_0x15a197){return _0x3cd618[_0x8135('0x9')](_0x8135('0xa'),attributes,{'tableName':_0x8135('0xb'),'paranoid':![],'indexes':[{'name':_0x8135('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 580e094..ff3a5d1 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 _0xa1ca=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x58c851,_0x1f3d96){var _0x534d8a=function(_0x10c1a0){while(--_0x10c1a0){_0x58c851['push'](_0x58c851['shift']());}};_0x534d8a(++_0x1f3d96);}(_0xa1ca,0xdf));var _0xaa1c=function(_0x4d0d85,_0x1d2bdb){_0x4d0d85=_0x4d0d85-0x0;var _0xf8b08e=_0xa1ca[_0x4d0d85];return _0xf8b08e;};'use strict';var _=require(_0xaa1c('0x0'));var util=require(_0xaa1c('0x1'));var moment=require(_0xaa1c('0x2'));var BPromise=require(_0xaa1c('0x3'));var rs=require(_0xaa1c('0x4'));var fs=require('fs');var Redis=require(_0xaa1c('0x5'));var db=require(_0xaa1c('0x6'))['db'];var utils=require(_0xaa1c('0x7'));var logger=require(_0xaa1c('0x8'))(_0xaa1c('0x9'));var config=require(_0xaa1c('0xa'));var jayson=require(_0xaa1c('0xb'));var client=jayson['client'][_0xaa1c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b0bd0,_0x16a30b,_0x44cdf5){return new BPromise(function(_0x592a8,_0x168faf){return client[_0xaa1c('0xd')](_0x4b0bd0,_0x44cdf5)['then'](function(_0x312b5a){logger[_0xaa1c('0xe')](_0xaa1c('0xf'),_0x16a30b,'request\x20sent');logger[_0xaa1c('0x10')](_0xaa1c('0x11'),_0x16a30b,_0xaa1c('0x12'),JSON['stringify'](_0x312b5a));if(_0x312b5a[_0xaa1c('0x13')]){if(_0x312b5a['error']['code']===0x1f4){logger['error'](_0xaa1c('0xf'),_0x16a30b,_0x312b5a[_0xaa1c('0x13')]['message']);return _0x168faf(_0x312b5a[_0xaa1c('0x13')][_0xaa1c('0x14')]);}logger[_0xaa1c('0x13')](_0xaa1c('0xf'),_0x16a30b,_0x312b5a['error'][_0xaa1c('0x14')]);return _0x592a8(_0x312b5a['error'][_0xaa1c('0x14')]);}else{logger[_0xaa1c('0xe')](_0xaa1c('0xf'),_0x16a30b,_0xaa1c('0x12'));_0x592a8(_0x312b5a[_0xaa1c('0x15')]['message']);}})['catch'](function(_0x1ae740){logger[_0xaa1c('0x13')](_0xaa1c('0xf'),_0x16a30b,_0x1ae740);_0x168faf(_0x1ae740);});});} \ No newline at end of file +var _0x9a98=['http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x478095,_0x2f2bae){var _0x505de8=function(_0x1d61dd){while(--_0x1d61dd){_0x478095['push'](_0x478095['shift']());}};_0x505de8(++_0x2f2bae);}(_0x9a98,0x68));var _0x89a9=function(_0x392d70,_0xfa76a3){_0x392d70=_0x392d70-0x0;var _0x5b1414=_0x9a98[_0x392d70];return _0x5b1414;};'use strict';var _=require(_0x89a9('0x0'));var util=require(_0x89a9('0x1'));var moment=require(_0x89a9('0x2'));var BPromise=require(_0x89a9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89a9('0x4'));var db=require(_0x89a9('0x5'))['db'];var utils=require(_0x89a9('0x6'));var logger=require(_0x89a9('0x7'))(_0x89a9('0x8'));var config=require('../../config/environment');var jayson=require(_0x89a9('0x9'));var client=jayson[_0x89a9('0xa')][_0x89a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43a894,_0x303956,_0x31bb9e){return new BPromise(function(_0x57d1a0,_0x27274b){return client[_0x89a9('0xc')](_0x43a894,_0x31bb9e)[_0x89a9('0xd')](function(_0x546db8){logger['info'](_0x89a9('0xe'),_0x303956,_0x89a9('0xf'));logger[_0x89a9('0x10')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x303956,_0x89a9('0xf'),JSON[_0x89a9('0x11')](_0x546db8));if(_0x546db8[_0x89a9('0x12')]){if(_0x546db8[_0x89a9('0x12')][_0x89a9('0x13')]===0x1f4){logger[_0x89a9('0x12')](_0x89a9('0xe'),_0x303956,_0x546db8[_0x89a9('0x12')][_0x89a9('0x14')]);return _0x27274b(_0x546db8['error'][_0x89a9('0x14')]);}logger[_0x89a9('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x303956,_0x546db8[_0x89a9('0x12')][_0x89a9('0x14')]);return _0x57d1a0(_0x546db8[_0x89a9('0x12')][_0x89a9('0x14')]);}else{logger[_0x89a9('0x15')](_0x89a9('0xe'),_0x303956,_0x89a9('0xf'));_0x57d1a0(_0x546db8['result']['message']);}})[_0x89a9('0x16')](function(_0x2a9a35){logger['error'](_0x89a9('0xe'),_0x303956,_0x2a9a35);_0x27274b(_0x2a9a35);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 7de53e1..62eb5be 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa52=['exit','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule/chat','./config/schedule/whatsapp','sequelize','then','listen','start','info','Online\x20apps:','map','filter','online','join','status','name','seedDB','./config/seedDB','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s'];(function(_0x560370,_0x135a93){var _0x16aef1=function(_0x468863){while(--_0x468863){_0x560370['push'](_0x560370['shift']());}};_0x16aef1(++_0x135a93);}(_0xaa52,0x1bb));var _0x2aa5=function(_0x4735c8,_0x3078fe){_0x4735c8=_0x4735c8-0x0;var _0x5315fe=_0xaa52[_0x4735c8];return _0x5315fe;};'use strict';var _=require(_0x2aa5('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x2aa5('0x1'));var config=require(_0x2aa5('0x2'));var logger=require(_0x2aa5('0x3'))(_0x2aa5('0x4'));var pm2=require(_0x2aa5('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0x2aa5('0x6'));var whatsapp=require(_0x2aa5('0x7'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x2aa5('0x8')]['sync']()[_0x2aa5('0x9')](function(){return rpc[_0x2aa5('0xa')]();})['then'](function(_0x49221f){logger['info'](_0x49221f);return chat[_0x2aa5('0xb')]();})[_0x2aa5('0x9')](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})[_0x2aa5('0x9')](function(){return transcribe[_0x2aa5('0xb')]();})['then'](function(_0x176a48){logger[_0x2aa5('0xc')](_0x176a48);return pm2[_0x2aa5('0xb')](pm2Config);})[_0x2aa5('0x9')](function(_0x44ff46){logger[_0x2aa5('0xc')](_0x2aa5('0xd'),_[_0x2aa5('0xe')](_[_0x2aa5('0xf')](_0x44ff46,{'status':_0x2aa5('0x10')}),'name')[_0x2aa5('0x11')]());logger[_0x2aa5('0xc')]('Offline\x20apps:',_[_0x2aa5('0xe')](_[_0x2aa5('0xf')](_0x44ff46,function(_0x5cd0b5){return _0x5cd0b5[_0x2aa5('0x12')]!==_0x2aa5('0x10');}),_0x2aa5('0x13'))[_0x2aa5('0x11')]()||'None');config[_0x2aa5('0x14')]&&require(_0x2aa5('0x15'))['default']();require('./config/license')['default']();})[_0x2aa5('0x16')](function(_0x5d4fd9){logger[_0x2aa5('0x17')](_0x2aa5('0x18'),_0x5d4fd9);process[_0x2aa5('0x19')](0x1);});}main(); \ No newline at end of file +var _0x5c0e=['lodash','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','then','listen','start','info','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','seedDB','./config/seedDB','default','./config/license','catch','error','exit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5c0e,0x16c));var _0xe5c0=function(_0x56fb33,_0x37be08){_0x56fb33=_0x56fb33-0x0;var _0x435ee4=_0x5c0e[_0x56fb33];return _0x435ee4;};'use strict';var _=require(_0xe5c0('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0xe5c0('0x1'));var config=require('./config/environment');var logger=require(_0xe5c0('0x2'))(_0xe5c0('0x3'));var pm2=require(_0xe5c0('0x4'));var pm2Config=require(_0xe5c0('0x5'));var schedule=require(_0xe5c0('0x6'));var chat=require(_0xe5c0('0x7'));var whatsapp=require(_0xe5c0('0x8'));var transcribe=require(_0xe5c0('0x9'));function main(){return mysqldb['db']['sequelize']['sync']()[_0xe5c0('0xa')](function(){return rpc[_0xe5c0('0xb')]();})[_0xe5c0('0xa')](function(_0xfe3407){logger['info'](_0xfe3407);return chat[_0xe5c0('0xc')]();})[_0xe5c0('0xa')](function(){return whatsapp[_0xe5c0('0xc')]();})[_0xe5c0('0xa')](function(){return schedule['start']();})['then'](function(){return transcribe[_0xe5c0('0xc')]();})[_0xe5c0('0xa')](function(_0x2385d6){logger[_0xe5c0('0xd')](_0x2385d6);return pm2[_0xe5c0('0xc')](pm2Config);})[_0xe5c0('0xa')](function(_0x3ac930){logger[_0xe5c0('0xd')](_0xe5c0('0xe'),_[_0xe5c0('0xf')](_[_0xe5c0('0x10')](_0x3ac930,{'status':_0xe5c0('0x11')}),_0xe5c0('0x12'))[_0xe5c0('0x13')]());logger[_0xe5c0('0xd')](_0xe5c0('0x14'),_['map'](_[_0xe5c0('0x10')](_0x3ac930,function(_0x47e0ae){return _0x47e0ae['status']!==_0xe5c0('0x11');}),_0xe5c0('0x12'))[_0xe5c0('0x13')]()||'None');config[_0xe5c0('0x15')]&&require(_0xe5c0('0x16'))[_0xe5c0('0x17')]();require(_0xe5c0('0x18'))[_0xe5c0('0x17')]();})[_0xe5c0('0x19')](function(_0x1d0513){logger[_0xe5c0('0x1a')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1d0513);process[_0xe5c0('0x1b')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index f5d776e..8cac64b 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 _0x1a09=['bluebird','util','moment','secrets','role','fullname','name','internal','email','userpic','permissions','md5secret','chatPause','faxPause','smsPause','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','wssPort','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','isChatInteractionAuthorized','use','user','findOne','params','closed','disposition','then','status','unmanaged','json','Forbidden.','catch','isAuthenticated','headers','authorization','Basic','User','find','authenticate','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','isNil','generateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','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\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','session','randomBytes','hex','floor','now','HS512','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','crypto'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x1a09,0x16e));var _0x91a0=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x1a09[_0x3899d1];return _0xeb4a7d;};'use strict';var db=require(_0x91a0('0x0'))['db'];var config=require(_0x91a0('0x1'));var hardwareConf=require(_0x91a0('0x2'));var licenseUtil=require(_0x91a0('0x3'));var encryptor=require(_0x91a0('0x4'));var _=require('lodash');var jwt=require(_0x91a0('0x5'));var expressJwt=require(_0x91a0('0x6'));var compose=require(_0x91a0('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x91a0('0x8'));var BPromise=require(_0x91a0('0x9'));var util=require(_0x91a0('0xa'));var moment=require(_0x91a0('0xb'));var validateJwt=expressJwt({'secret':config[_0x91a0('0xc')]['session']});var userAttributes=['id',_0x91a0('0xd'),_0x91a0('0xe'),_0x91a0('0xf'),_0x91a0('0x10'),_0x91a0('0x11'),_0x91a0('0x12'),_0x91a0('0x13'),_0x91a0('0x14'),'voicePause',_0x91a0('0x15'),'mailPause',_0x91a0('0x16'),_0x91a0('0x17'),'openchannelPause','pauseType','showWebBar',_0x91a0('0x18'),_0x91a0('0x19'),_0x91a0('0x1a'),_0x91a0('0x1b'),_0x91a0('0x1c'),_0x91a0('0x1d'),_0x91a0('0x1e'),_0x91a0('0x1f'),_0x91a0('0x20'),'phoneBarEnableRecording',_0x91a0('0x21'),_0x91a0('0x22'),_0x91a0('0x23'),_0x91a0('0x24'),'phoneBarRemoteControl',_0x91a0('0x25'),'hotdesk',_0x91a0('0x26'),_0x91a0('0x27'),'privacyEnabled',_0x91a0('0x28'),_0x91a0('0x29'),'downloadVoiceRecordings',_0x91a0('0x2a'),'downloadAttachments',_0x91a0('0x2b'),'selectRecallMeCampaign'];exports[_0x91a0('0x2c')]=function(){return this['isAuthenticated'](!![])[_0x91a0('0x2d')](function(_0x260f48,_0x59badd,_0x2a52b6){if(_0x260f48[_0x91a0('0x2e')]){_0x2a52b6();}else{return db['ChatInteraction'][_0x91a0('0x2f')]({'where':{'id':_0x260f48[_0x91a0('0x30')]['id']},'attributes':['id',_0x91a0('0x31'),_0x91a0('0x32')],'raw':!![]})[_0x91a0('0x33')](function(_0x4db50a){if(_0x4db50a&&_0x4db50a[_0x91a0('0x31')]){return _0x59badd[_0x91a0('0x34')](_0x4db50a[_0x91a0('0x32')]===_0x91a0('0x35')?0x195:0x193)[_0x91a0('0x36')]({'message':_0x4db50a['disposition']==='unmanaged'?'Unmanaged.':_0x91a0('0x37')});}else{_0x2a52b6();}})[_0x91a0('0x38')](function(_0x3cff60){_0x2a52b6(_0x3cff60);});}});};exports[_0x91a0('0x39')]=function isAuthenticated(_0x5e26bb){return compose()[_0x91a0('0x2d')](function(_0x226ded,_0x66ed92,_0x933195){var _0x5e8719;if(_0x226ded[_0x91a0('0x3a')][_0x91a0('0x3b')]){if(_['startsWith'](_0x226ded[_0x91a0('0x3a')][_0x91a0('0x3b')],_0x91a0('0x3c'))){var _0xa05937=basicAuth(_0x226ded);db[_0x91a0('0x3d')][_0x91a0('0x3e')]({'where':{'name':_0xa05937[_0x91a0('0xf')]}})['then'](function(_0x2c1f18){if(!_0x2c1f18||!_0x2c1f18[_0x91a0('0x3f')](_0xa05937['pass'])){return _0x66ed92[_0x91a0('0x34')](0x191)[_0x91a0('0x36')]({'message':_0x91a0('0x40')});}_0x226ded[_0x91a0('0x2e')]={'id':_0x2c1f18['id']};_0x933195();})[_0x91a0('0x38')](function(_0x2bcb58){_0x933195(_0x2bcb58);});}else if(_['startsWith'](_0x226ded[_0x91a0('0x3a')][_0x91a0('0x3b')],_0x91a0('0x41'))){validateJwt(_0x226ded,_0x66ed92,_0x933195);}else{if(_0x5e26bb){_0x933195();}else{return _0x66ed92['status'](0x193)[_0x91a0('0x36')]({'message':_0x91a0('0x42')});}}}else if(_0x226ded[_0x91a0('0x43')][_0x91a0('0x44')]){try{var _0x411357={'audience':hardwareConf[_0x91a0('0x45')](),'issuer':hardwareConf[_0x91a0('0x45')]()};verifyJwt(_0x226ded[_0x91a0('0x43')]['apikey'],_0x411357)['then'](function(_0x310611){return db[_0x91a0('0x3d')][_0x91a0('0x3e')]({'where':{'id':_0x310611[_0x91a0('0x46')]}})['then'](function(_0x52db7d){_0x5e8719=_0x52db7d;return db[_0x91a0('0x47')]['findOne']({'where':{'id':0x1},'attributes':[_0x91a0('0x48'),_0x91a0('0x49')],'raw':!![]});})[_0x91a0('0x33')](function(_0x30affb){if(!_0x5e8719||!_[_0x91a0('0x4a')](_0x5e8719[_0x91a0('0x4b')],_0x310611[_0x91a0('0x4c')])){return _0x66ed92['status'](0x191)[_0x91a0('0x36')]({'message':_0x91a0('0x4d')});}if(_0x5e8719[_0x91a0('0x4e')]){return _0x66ed92[_0x91a0('0x34')](0x191)[_0x91a0('0x36')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x5e8719['blocked']){if(_0x30affb[_0x91a0('0x49')]>0x0){if(moment(_0x5e8719['blockedAt'])[_0x91a0('0x4f')](_0x30affb[_0x91a0('0x49')],_0x91a0('0x50'))>moment()){return _0x66ed92['status'](0x191)['json']({'message':_0x91a0('0x51')});}}else{return _0x66ed92[_0x91a0('0x34')](0x191)[_0x91a0('0x36')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x226ded[_0x91a0('0x2e')]={'id':_0x5e8719['id']};_0x933195();});})[_0x91a0('0x38')](function(){return _0x66ed92['status'](0x191)[_0x91a0('0x36')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x4e5364){_0x933195(_0x4e5364);}}else if(_0x5e26bb){_0x933195();}else{return _0x66ed92[_0x91a0('0x34')](0x193)[_0x91a0('0x36')]({'message':_0x91a0('0x42')});}})[_0x91a0('0x2d')](function(_0x2f54f3,_0x59cf26,_0x1e854a){if(_0x2f54f3[_0x91a0('0x2e')]){db[_0x91a0('0x3d')][_0x91a0('0x3e')]({'where':{'id':_0x2f54f3['user']['id']},'attributes':userAttributes})['then'](function(_0x4ad3ed){if(!_0x4ad3ed){return _0x59cf26[_0x91a0('0x34')](0x194)[_0x91a0('0x36')]({'message':_0x91a0('0x52')});}_0x2f54f3['user']=_0x4ad3ed;_0x1e854a();})[_0x91a0('0x38')](function(_0x54d35c){_0x1e854a(_0x54d35c);});}else if(_0x5e26bb){_0x1e854a();}else{return _0x59cf26[_0x91a0('0x34')](0x194)[_0x91a0('0x36')]({'message':_0x91a0('0x53')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x91a0('0x2d')](function(_0x3825e7,_0x2aee5b,_0x1273ca){return licenseUtil[_0x91a0('0x54')]()[_0x91a0('0x33')](function(_0x1fd06b){if(_0x1fd06b[_0x91a0('0x55')]){_0x1273ca();}else{return _0x2aee5b['status'](0x193)[_0x91a0('0x36')]({'message':_0x91a0('0x56')});}})[_0x91a0('0x38')](function(_0x276d5b){_0x1273ca(_0x276d5b);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x91a0('0x2d')](function(_0x556d21,_0x105b2e,_0x43ac05){return licenseUtil[_0x91a0('0x54')]()[_0x91a0('0x33')](function(_0x5ebc80){if(_0x5ebc80[_0x91a0('0x57')]){_0x43ac05();}else{return _0x105b2e[_0x91a0('0x34')](0x193)[_0x91a0('0x36')]({'message':_0x91a0('0x56')});}})[_0x91a0('0x38')](function(_0x293754){_0x43ac05(_0x293754);});});};exports[_0x91a0('0x58')]=function(_0x29cc2a,_0x5655ee,_0xd6813a){_0x29cc2a[_0x91a0('0x58')]=!![];return _0xd6813a();};exports[_0x91a0('0x59')]=function signToken(_0x1ea1fc){return signJwt(_0x1ea1fc);};exports['setTokenCookie']=function(_0x3cc754,_0x10744d){if(!_0x3cc754[_0x91a0('0x2e')]){return _0x10744d[_0x91a0('0x34')](0x194)[_0x91a0('0x36')]({'message':_0x91a0('0x5a')});}var _0x47db1c={'payload':{'id':_0x3cc754[_0x91a0('0x2e')]['id'],'role':_0x3cc754[_0x91a0('0x2e')][_0x91a0('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x47db1c)[_0x91a0('0x33')](function(_0x5d0e47){_0x10744d['cookie'](_0x91a0('0x5b'),_0x5d0e47);_0x10744d[_0x91a0('0x5c')](_0x91a0('0x5d'));})[_0x91a0('0x38')](function(_0x41c59e){return _0x10744d[_0x91a0('0x34')](0x1f4)['send'](_0x41c59e);});};exports['retrieveApiKey']=function(_0x9a31a3){if(_['isNil'](_0x9a31a3[_0x91a0('0x4b')])||_[_0x91a0('0x5e')](_0x9a31a3['apiKeyIat'])){return null;}else{return createJwt(_0x9a31a3);}};exports[_0x91a0('0x5f')]=function(_0x577745){_0x577745[_0x91a0('0x4b')]=generateNonce();_0x577745[_0x91a0('0x60')]=generateIssuedAt();return createJwt(_0x577745);};exports['regenerateApiKey']=function(_0x114252,_0x28cc24){var _0x34a8d5=_0x114252[_0x91a0('0x43')][_0x91a0('0x44')];if(_0x34a8d5){var _0x1991f6={'nonce':_0x28cc24['apiKeyNonce'],'iat':_0x28cc24['apiKeyIat'],'audience':hardwareConf[_0x91a0('0x45')](),'issuer':hardwareConf[_0x91a0('0x45')]()};return verifyJwt(_0x34a8d5,_0x1991f6)['then'](function(){return generateApiKey(_0x28cc24);});}else{throw{'message':_0x91a0('0x61')};}};exports['validatePasswordPattern']=function(_0x4db026){var _0x3612fc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3612fc['test'](_0x4db026))throw new db['Sequelize']['ValidationError'](_0x91a0('0x62'));return;};exports[_0x91a0('0x63')]=function(_0x4cb6af,_0x554f0c,_0xcf81a9){var _0x2ea9ba=encryptor[_0x91a0('0x64')](_0x554f0c)[_0x91a0('0x65')](',');for(var _0x3b9387=0x0;_0x3b9387<_0xcf81a9;_0x3b9387++){if(!_0x2ea9ba[_0x3b9387])break;if(_0x4cb6af[_0x91a0('0x66')]()===_0x2ea9ba[_0x3b9387]['toLowerCase']()){var _0x15dc16=util['format'](_0x91a0('0x67'),_0xcf81a9);if(_0xcf81a9===0x1){_0x15dc16='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x91a0('0x68'))][(_0x91a0('0x69'))](_0x15dc16);}}return;};exports[_0x91a0('0x6a')]=function(_0xed5a89,_0x263448){var _0x177893=_0x263448?encryptor[_0x91a0('0x64')](_0x263448)[_0x91a0('0x65')](','):[];if(_0x177893[_0x91a0('0x6b')]===0x5){_0x177893[_0x91a0('0x6c')](-0x1,0x1);}_0x177893[_0x91a0('0x6d')](_0xed5a89);return encryptor[_0x91a0('0x6e')](_0x177893[_0x91a0('0x6f')](','));};function signJwt(_0x3dcd17){var _0x15e301=BPromise[_0x91a0('0x70')](jwt[_0x91a0('0x71')],{'context':jwt});var _0x2cbaf3=_0x3dcd17[_0x91a0('0x72')]||config[_0x91a0('0xc')]['session'];return new BPromise(function(_0x26f967,_0x2164b9){_0x15e301(_0x3dcd17[_0x91a0('0x73')],_0x2cbaf3,_0x3dcd17[_0x91a0('0x74')])[_0x91a0('0x33')](function(_0x3748cf){_0x26f967(_0x3748cf);})[_0x91a0('0x38')](function(_0x350a7f){_0x2164b9(_0x350a7f);});});}function verifyJwt(_0x9f0f9c,_0x515c97,_0x30bc79){var _0x3de84c=BPromise[_0x91a0('0x70')](jwt[_0x91a0('0x75')],{'context':jwt});var _0x3461f7=_0x30bc79||config[_0x91a0('0xc')][_0x91a0('0x76')];return new BPromise(function(_0x2f7a85,_0x5727e6){_0x3de84c(_0x9f0f9c,_0x3461f7,_0x515c97)[_0x91a0('0x33')](function(_0x208a00){_0x2f7a85(_0x208a00);})['catch'](function(_0x3b727f){_0x5727e6(_0x3b727f);});});}function generateNonce(){return crypto[_0x91a0('0x77')](0x10)['toString'](_0x91a0('0x78'));}function generateIssuedAt(){return Math[_0x91a0('0x79')](Date[_0x91a0('0x7a')]()/0x3e8)['toString']();}function createJwt(_0x407f9f){var _0x5cbbd4={'payload':{'iat':_0x407f9f[_0x91a0('0x60')],'nonce':_0x407f9f[_0x91a0('0x4b')]},'options':{'algorithm':_0x91a0('0x7b'),'subject':_0x407f9f['id'][_0x91a0('0x7c')](),'issuer':hardwareConf[_0x91a0('0x45')](),'audience':hardwareConf[_0x91a0('0x45')]()}};return signJwt(_0x5cbbd4)[_0x91a0('0x33')](function(_0x349c0a){return{'iat':_0x407f9f[_0x91a0('0x60')],'nonce':_0x407f9f[_0x91a0('0x4b')],'token':_0x349c0a};});} \ No newline at end of file +var _0xa9ec=['User','find','name','then','authenticate','json','Wrong\x20credentials.','catch','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','motion.token','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','split','length','unshift','join','sign','secret','promisify','verify','randomBytes','hex','floor','now','HS512','toString','../../mysqldb','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','secrets','session','role','fullname','internal','userpic','permissions','voicePause','chatPause','mailPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','status','disposition','unmanaged','Unmanaged.','Forbidden.','use','headers','authorization','startsWith','Basic'];(function(_0x232aba,_0x3305bf){var _0xde7721=function(_0x252aa7){while(--_0x252aa7){_0x232aba['push'](_0x232aba['shift']());}};_0xde7721(++_0x3305bf);}(_0xa9ec,0x13b));var _0xca9e=function(_0x1f5974,_0x11540c){_0x1f5974=_0x1f5974-0x0;var _0x5cb353=_0xa9ec[_0x1f5974];return _0x5cb353;};'use strict';var db=require(_0xca9e('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xca9e('0x1'));var licenseUtil=require(_0xca9e('0x2'));var encryptor=require('../encryptor');var _=require(_0xca9e('0x3'));var jwt=require(_0xca9e('0x4'));var expressJwt=require(_0xca9e('0x5'));var compose=require(_0xca9e('0x6'));var basicAuth=require(_0xca9e('0x7'));var crypto=require(_0xca9e('0x8'));var BPromise=require(_0xca9e('0x9'));var util=require(_0xca9e('0xa'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xca9e('0xb')][_0xca9e('0xc')]});var userAttributes=['id',_0xca9e('0xd'),_0xca9e('0xe'),'name',_0xca9e('0xf'),'email',_0xca9e('0x10'),_0xca9e('0x11'),'md5secret',_0xca9e('0x12'),_0xca9e('0x13'),_0xca9e('0x14'),'faxPause','smsPause',_0xca9e('0x15'),_0xca9e('0x16'),_0xca9e('0x17'),_0xca9e('0x18'),'lastPauseAt',_0xca9e('0x19'),'allowmessenger',_0xca9e('0x1a'),_0xca9e('0x1b'),_0xca9e('0x1c'),_0xca9e('0x1d'),_0xca9e('0x1e'),_0xca9e('0x1f'),_0xca9e('0x20'),_0xca9e('0x21'),'phoneBarExpires',_0xca9e('0x22'),_0xca9e('0x23'),_0xca9e('0x24'),_0xca9e('0x25'),'interface','userProfileId',_0xca9e('0x26'),'settingsEnabled',_0xca9e('0x27'),_0xca9e('0x28'),_0xca9e('0x29'),'downloadAttachments',_0xca9e('0x2a'),'selectRecallMeCampaign'];exports[_0xca9e('0x2b')]=function(){return this[_0xca9e('0x2c')](!![])['use'](function(_0x5b5dd9,_0xe702a,_0x17bd16){if(_0x5b5dd9[_0xca9e('0x2d')]){_0x17bd16();}else{return db[_0xca9e('0x2e')][_0xca9e('0x2f')]({'where':{'id':_0x5b5dd9[_0xca9e('0x30')]['id']},'attributes':['id',_0xca9e('0x31'),'disposition'],'raw':!![]})['then'](function(_0xeaccf2){if(_0xeaccf2&&_0xeaccf2[_0xca9e('0x31')]){return _0xe702a[_0xca9e('0x32')](_0xeaccf2[_0xca9e('0x33')]===_0xca9e('0x34')?0x195:0x193)['json']({'message':_0xeaccf2['disposition']==='unmanaged'?_0xca9e('0x35'):_0xca9e('0x36')});}else{_0x17bd16();}})['catch'](function(_0x7a9f7f){_0x17bd16(_0x7a9f7f);});}});};exports[_0xca9e('0x2c')]=function isAuthenticated(_0x2fff49){return compose()[_0xca9e('0x37')](function(_0x1fd376,_0x18d20f,_0x5cb2ae){var _0xf71033;if(_0x1fd376[_0xca9e('0x38')][_0xca9e('0x39')]){if(_[_0xca9e('0x3a')](_0x1fd376['headers'][_0xca9e('0x39')],_0xca9e('0x3b'))){var _0x5eb82e=basicAuth(_0x1fd376);db[_0xca9e('0x3c')][_0xca9e('0x3d')]({'where':{'name':_0x5eb82e[_0xca9e('0x3e')]}})[_0xca9e('0x3f')](function(_0x36efc1){if(!_0x36efc1||!_0x36efc1[_0xca9e('0x40')](_0x5eb82e['pass'])){return _0x18d20f[_0xca9e('0x32')](0x191)[_0xca9e('0x41')]({'message':_0xca9e('0x42')});}_0x1fd376['user']={'id':_0x36efc1['id']};_0x5cb2ae();})[_0xca9e('0x43')](function(_0x3c001e){_0x5cb2ae(_0x3c001e);});}else if(_['startsWith'](_0x1fd376[_0xca9e('0x38')][_0xca9e('0x39')],'Bearer')){validateJwt(_0x1fd376,_0x18d20f,_0x5cb2ae);}else{if(_0x2fff49){_0x5cb2ae();}else{return _0x18d20f['status'](0x193)['json']({'message':_0xca9e('0x44')});}}}else if(_0x1fd376[_0xca9e('0x45')][_0xca9e('0x46')]){try{var _0x3159a7={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xca9e('0x47')]()};verifyJwt(_0x1fd376[_0xca9e('0x45')][_0xca9e('0x46')],_0x3159a7)[_0xca9e('0x3f')](function(_0x4b8467){return db[_0xca9e('0x3c')][_0xca9e('0x3d')]({'where':{'id':_0x4b8467[_0xca9e('0x48')]}})[_0xca9e('0x3f')](function(_0x4879f0){_0xf71033=_0x4879f0;return db[_0xca9e('0x49')][_0xca9e('0x2f')]({'where':{'id':0x1},'attributes':[_0xca9e('0x4a'),_0xca9e('0x4b')],'raw':!![]});})[_0xca9e('0x3f')](function(_0x87320b){if(!_0xf71033||!_[_0xca9e('0x4c')](_0xf71033[_0xca9e('0x4d')],_0x4b8467[_0xca9e('0x4e')])){return _0x18d20f[_0xca9e('0x32')](0x191)[_0xca9e('0x41')]({'message':_0xca9e('0x4f')});}if(_0xf71033[_0xca9e('0x50')]){return _0x18d20f[_0xca9e('0x32')](0x191)['json']({'message':_0xca9e('0x51')});}if(_0xf71033['blocked']){if(_0x87320b[_0xca9e('0x4b')]>0x0){if(moment(_0xf71033[_0xca9e('0x52')])[_0xca9e('0x53')](_0x87320b['blockDuration'],_0xca9e('0x54'))>moment()){return _0x18d20f[_0xca9e('0x32')](0x191)[_0xca9e('0x41')]({'message':_0xca9e('0x51')});}}else{return _0x18d20f[_0xca9e('0x32')](0x191)[_0xca9e('0x41')]({'message':_0xca9e('0x51')});}}_0x1fd376['user']={'id':_0xf71033['id']};_0x5cb2ae();});})[_0xca9e('0x43')](function(){return _0x18d20f[_0xca9e('0x32')](0x191)[_0xca9e('0x41')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x4d2fee){_0x5cb2ae(_0x4d2fee);}}else if(_0x2fff49){_0x5cb2ae();}else{return _0x18d20f[_0xca9e('0x32')](0x193)[_0xca9e('0x41')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x228b46,_0x2d241d,_0x9ad820){if(_0x228b46[_0xca9e('0x2d')]){db[_0xca9e('0x3c')][_0xca9e('0x3d')]({'where':{'id':_0x228b46['user']['id']},'attributes':userAttributes})['then'](function(_0x3a276a){if(!_0x3a276a){return _0x2d241d[_0xca9e('0x32')](0x194)['json']({'message':_0xca9e('0x55')});}_0x228b46[_0xca9e('0x2d')]=_0x3a276a;_0x9ad820();})[_0xca9e('0x43')](function(_0xae05e4){_0x9ad820(_0xae05e4);});}else if(_0x2fff49){_0x9ad820();}else{return _0x2d241d['status'](0x194)[_0xca9e('0x41')]({'message':_0xca9e('0x56')});}});};exports[_0xca9e('0x57')]=function canUpdate(){return compose()[_0xca9e('0x37')](function(_0xdce416,_0x238481,_0x4030d0){return licenseUtil['getLicense']()[_0xca9e('0x3f')](function(_0xba8d6b){if(_0xba8d6b[_0xca9e('0x58')]){_0x4030d0();}else{return _0x238481[_0xca9e('0x32')](0x193)['json']({'message':_0xca9e('0x59')});}})[_0xca9e('0x43')](function(_0x46f517){_0x4030d0(_0x46f517);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xca9e('0x37')](function(_0x1f391c,_0x1307d8,_0x4f6fa8){return licenseUtil['getLicense']()[_0xca9e('0x3f')](function(_0x4113a2){if(_0x4113a2[_0xca9e('0x5a')]){_0x4f6fa8();}else{return _0x1307d8['status'](0x193)[_0xca9e('0x41')]({'message':'Forbidden'});}})[_0xca9e('0x43')](function(_0x434ca4){_0x4f6fa8(_0x434ca4);});});};exports['isMiddleware']=function(_0x49d018,_0x13f9dc,_0x4edea3){_0x49d018[_0xca9e('0x5b')]=!![];return _0x4edea3();};exports[_0xca9e('0x5c')]=function signToken(_0x37f31d){return signJwt(_0x37f31d);};exports[_0xca9e('0x5d')]=function(_0x1fe48b,_0x5056b8){if(!_0x1fe48b[_0xca9e('0x2d')]){return _0x5056b8['status'](0x194)[_0xca9e('0x41')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x1f3d62={'payload':{'id':_0x1fe48b[_0xca9e('0x2d')]['id'],'role':_0x1fe48b['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x1f3d62)[_0xca9e('0x3f')](function(_0x866675){_0x5056b8['cookie'](_0xca9e('0x5e'),_0x866675);_0x5056b8['redirect'](_0xca9e('0x5f'));})[_0xca9e('0x43')](function(_0x2ebdb3){return _0x5056b8[_0xca9e('0x32')](0x1f4)[_0xca9e('0x60')](_0x2ebdb3);});};exports['retrieveApiKey']=function(_0x34442e){if(_[_0xca9e('0x61')](_0x34442e[_0xca9e('0x4d')])||_[_0xca9e('0x61')](_0x34442e[_0xca9e('0x62')])){return null;}else{return createJwt(_0x34442e);}};exports[_0xca9e('0x63')]=function(_0x4982d6){_0x4982d6[_0xca9e('0x4d')]=generateNonce();_0x4982d6[_0xca9e('0x62')]=generateIssuedAt();return createJwt(_0x4982d6);};exports[_0xca9e('0x64')]=function(_0x4f8761,_0x13d008){var _0x2320fa=_0x4f8761['query'][_0xca9e('0x46')];if(_0x2320fa){var _0x3ae166={'nonce':_0x13d008[_0xca9e('0x4d')],'iat':_0x13d008[_0xca9e('0x62')],'audience':hardwareConf[_0xca9e('0x47')](),'issuer':hardwareConf[_0xca9e('0x47')]()};return verifyJwt(_0x2320fa,_0x3ae166)[_0xca9e('0x3f')](function(){return generateApiKey(_0x13d008);});}else{throw{'message':_0xca9e('0x65')};}};exports['validatePasswordPattern']=function(_0x177dd1){var _0xc44387=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xc44387['test'](_0x177dd1))throw new db[(_0xca9e('0x66'))]['ValidationError'](_0xca9e('0x67'));return;};exports[_0xca9e('0x68')]=function(_0x59dca9,_0xec17a1,_0x3f1d09){var _0x24a065=encryptor[_0xca9e('0x69')](_0xec17a1)['split'](',');for(var _0xfbd00a=0x0;_0xfbd00a<_0x3f1d09;_0xfbd00a++){if(!_0x24a065[_0xfbd00a])break;if(_0x59dca9[_0xca9e('0x6a')]()===_0x24a065[_0xfbd00a][_0xca9e('0x6a')]()){var _0x5f0fcd=util['format'](_0xca9e('0x6b'),_0x3f1d09);if(_0x3f1d09===0x1){_0x5f0fcd=_0xca9e('0x6c');}throw new db[(_0xca9e('0x66'))][(_0xca9e('0x6d'))](_0x5f0fcd);}}return;};exports[_0xca9e('0x6e')]=function(_0x179f37,_0x27728f){var _0x379b24=_0x27728f?encryptor[_0xca9e('0x69')](_0x27728f)[_0xca9e('0x6f')](','):[];if(_0x379b24[_0xca9e('0x70')]===0x5){_0x379b24['splice'](-0x1,0x1);}_0x379b24[_0xca9e('0x71')](_0x179f37);return encryptor['encryptString'](_0x379b24[_0xca9e('0x72')](','));};function signJwt(_0x615e08){var _0x1cec2b=BPromise['promisify'](jwt[_0xca9e('0x73')],{'context':jwt});var _0x57abd3=_0x615e08[_0xca9e('0x74')]||config[_0xca9e('0xb')]['session'];return new BPromise(function(_0x8c13ce,_0x5f3624){_0x1cec2b(_0x615e08['payload'],_0x57abd3,_0x615e08['options'])['then'](function(_0x38816b){_0x8c13ce(_0x38816b);})[_0xca9e('0x43')](function(_0x17c761){_0x5f3624(_0x17c761);});});}function verifyJwt(_0x5b24c8,_0x53659e,_0x246579){var _0x24464c=BPromise[_0xca9e('0x75')](jwt[_0xca9e('0x76')],{'context':jwt});var _0x446e83=_0x246579||config[_0xca9e('0xb')][_0xca9e('0xc')];return new BPromise(function(_0x45c64e,_0x46c97c){_0x24464c(_0x5b24c8,_0x446e83,_0x53659e)[_0xca9e('0x3f')](function(_0xf89047){_0x45c64e(_0xf89047);})[_0xca9e('0x43')](function(_0x588fe6){_0x46c97c(_0x588fe6);});});}function generateNonce(){return crypto[_0xca9e('0x77')](0x10)['toString'](_0xca9e('0x78'));}function generateIssuedAt(){return Math[_0xca9e('0x79')](Date[_0xca9e('0x7a')]()/0x3e8)['toString']();}function createJwt(_0x21dcf5){var _0x2b2542={'payload':{'iat':_0x21dcf5['apiKeyIat'],'nonce':_0x21dcf5[_0xca9e('0x4d')]},'options':{'algorithm':_0xca9e('0x7b'),'subject':_0x21dcf5['id'][_0xca9e('0x7c')](),'issuer':hardwareConf[_0xca9e('0x47')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x2b2542)[_0xca9e('0x3f')](function(_0x2cb5c6){return{'iat':_0x21dcf5['apiKeyIat'],'nonce':_0x21dcf5[_0xca9e('0x4d')],'token':_0x2cb5c6};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index fad84f1..ad2ecc2 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 _0x5374=['data','update','binary','end','final','close','unlink','decryptFile','createDecipher','write','encryptString','secret','base64','decryptString','utf8','crypto','bluebird','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher'];(function(_0x3de0d8,_0x162b3f){var _0x189d1f=function(_0x1863a1){while(--_0x1863a1){_0x3de0d8['push'](_0x3de0d8['shift']());}};_0x189d1f(++_0x162b3f);}(_0x5374,0xfd));var _0x4537=function(_0x5e40cd,_0x20c9cc){_0x5e40cd=_0x5e40cd-0x0;var _0x556640=_0x5374[_0x5e40cd];return _0x556640;};'use strict';var crypto=require(_0x4537('0x0'));var fs=require('fs');var BPromise=require(_0x4537('0x1'));var _=require('lodash');var config=require(_0x4537('0x2'));var logger=require(_0x4537('0x3'))(_0x4537('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4537('0x5')][_0x4537('0x6')],'algorithm':_0x4537('0x7')};const fileOptions={'algorithm':_0x4537('0x8')};if(config['encrypt']&&config[_0x4537('0x9')][_0x4537('0xa')]){var isSupported=isAlgorithmSupported(config[_0x4537('0x9')][_0x4537('0xa')]);if(isSupported){fileOptions[_0x4537('0xa')]=config['encrypt'][_0x4537('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x4537('0xb')](config[_0x4537('0x9')][_0x4537('0xa')],_0x4537('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x2474c6){return AES_SUPPORTED_RX[_0x4537('0xd')](_0x2474c6);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x3a6bb8){return getSupportedCiphers()[_0x4537('0xe')](_0x3a6bb8)>-0x1;}function combineOptions(_0x5e74de){var _0x5a9ab4={};for(var _0x2c159d in fileOptions){if(fileOptions['hasOwnProperty'](_0x2c159d)){_0x5a9ab4[_0x2c159d]=fileOptions[_0x2c159d];}}if(_0x5e74de){for(var _0x2244af in _0x5e74de){if(_0x5e74de[_0x4537('0xf')](_0x2244af)){_0x5a9ab4[_0x2244af]=_0x5e74de[_0x2244af];}}}return _0x5a9ab4;}exports[_0x4537('0x10')]=function(_0x405437,_0x2a15cc,_0x505b8c,_0xa85a3f){return new BPromise(function(_0x4caa0a,_0x34ffff){_0xa85a3f=combineOptions(_0xa85a3f);var _0x3d6f2b=new Buffer(_0x505b8c);var _0x52ee8e=fs[_0x4537('0x11')](_0x405437);var _0x464ec7=fs['createWriteStream'](_0x2a15cc);var _0x3e505d=crypto[_0x4537('0x12')](_0xa85a3f[_0x4537('0xa')],_0x3d6f2b);_0x52ee8e['on'](_0x4537('0x13'),function(_0x559776){var _0x26654b=new Buffer(_0x3e505d[_0x4537('0x14')](_0x559776),_0x4537('0x15'));_0x464ec7['write'](_0x26654b);});_0x52ee8e['on'](_0x4537('0x16'),function(){try{var _0x198397=new Buffer(_0x3e505d[_0x4537('0x17')](_0x4537('0x15')),_0x4537('0x15'));_0x464ec7['write'](_0x198397);_0x464ec7[_0x4537('0x16')]();_0x464ec7['on'](_0x4537('0x18'),function(){return _0x4caa0a(_0x2a15cc);});}catch(_0x498f2f){fs[_0x4537('0x19')](_0x2a15cc);return _0x34ffff(_0x498f2f);}});});};exports[_0x4537('0x1a')]=function(_0x2fe4b9,_0xd13bd4,_0x23896d,_0x1b74b1){return new BPromise(function(_0x8db8e2,_0x1d2af6){_0x1b74b1=combineOptions(_0x1b74b1);var _0xa0b17=new Buffer(_0x23896d);var _0x46d399=fs[_0x4537('0x11')](_0x2fe4b9);var _0x8df184=fs['createWriteStream'](_0xd13bd4);var _0x31da39=crypto[_0x4537('0x1b')](_0x1b74b1[_0x4537('0xa')],_0xa0b17);_0x46d399['on'](_0x4537('0x13'),function(_0x1890f8){var _0x5ca826=new Buffer(_0x31da39[_0x4537('0x14')](_0x1890f8),_0x4537('0x15'));_0x8df184[_0x4537('0x1c')](_0x5ca826);});_0x46d399['on'](_0x4537('0x16'),function(){try{var _0xa51665=new Buffer(_0x31da39[_0x4537('0x17')](_0x4537('0x15')),_0x4537('0x15'));_0x8df184['write'](_0xa51665);_0x8df184[_0x4537('0x16')]();_0x8df184['on'](_0x4537('0x18'),function(){return _0x8db8e2(_0xd13bd4);});}catch(_0x46e037){fs[_0x4537('0x19')](_0xd13bd4);return _0x1d2af6(_0x46e037);}});});};exports[_0x4537('0x1d')]=function(_0x30f4c3,_0xd19151,_0x100387){var _0x3d15f2=_0x100387||stringOptions[_0x4537('0xa')];var _0x12810f=_0xd19151||stringOptions[_0x4537('0x1e')];var _0x9bc9f8=crypto[_0x4537('0x12')](_0x3d15f2,_0x12810f);var _0x57baf8=_0x9bc9f8['update'](_0x30f4c3,'utf8',_0x4537('0x1f'));_0x57baf8+=_0x9bc9f8[_0x4537('0x17')]('base64');return _0x57baf8;};exports[_0x4537('0x20')]=function(_0x16d7f2,_0x4b6eb6,_0x5973b7){var _0x15f49d=_0x5973b7||stringOptions[_0x4537('0xa')];var _0x2bcb62=_0x4b6eb6||stringOptions[_0x4537('0x1e')];var _0xc2006c=crypto['createDecipher'](_0x15f49d,_0x2bcb62);var _0x2a831f=_0xc2006c['update'](_0x16d7f2,_0x4537('0x1f'),_0x4537('0x21'));_0x2a831f+=_0xc2006c[_0x4537('0x17')](_0x4537('0x21'));return _0x2a831f;}; \ No newline at end of file +var _0x7f94=['createCipher','binary','write','end','final','close','createDecipher','update','unlink','utf8','base64','secret','crypto','lodash','app','secrets','session','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream'];(function(_0x22a051,_0xfbb7e1){var _0xe6f34c=function(_0x2bebe1){while(--_0x2bebe1){_0x22a051['push'](_0x22a051['shift']());}};_0xe6f34c(++_0xfbb7e1);}(_0x7f94,0x150));var _0x47f9=function(_0x11daa4,_0x572bf1){_0x11daa4=_0x11daa4-0x0;var _0x2af825=_0x7f94[_0x11daa4];return _0x2af825;};'use strict';var crypto=require(_0x47f9('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x47f9('0x1'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x47f9('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x47f9('0x3')][_0x47f9('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x47f9('0x5')};if(config[_0x47f9('0x6')]&&config[_0x47f9('0x6')][_0x47f9('0x7')]){var isSupported=isAlgorithmSupported(config[_0x47f9('0x6')][_0x47f9('0x7')]);if(isSupported){fileOptions[_0x47f9('0x7')]=config[_0x47f9('0x6')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x47f9('0x6')][_0x47f9('0x7')],_0x47f9('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0xec8af){return AES_SUPPORTED_RX['test'](_0xec8af);}function getSupportedCiphers(){return crypto[_0x47f9('0x9')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x1c69b0){return getSupportedCiphers()[_0x47f9('0xa')](_0x1c69b0)>-0x1;}function combineOptions(_0x408f64){var _0x56831e={};for(var _0x15ddf7 in fileOptions){if(fileOptions[_0x47f9('0xb')](_0x15ddf7)){_0x56831e[_0x15ddf7]=fileOptions[_0x15ddf7];}}if(_0x408f64){for(var _0x1ba155 in _0x408f64){if(_0x408f64['hasOwnProperty'](_0x1ba155)){_0x56831e[_0x1ba155]=_0x408f64[_0x1ba155];}}}return _0x56831e;}exports[_0x47f9('0xc')]=function(_0x45abee,_0x55fec2,_0x5c38b2,_0x68da7d){return new BPromise(function(_0x2f6c32,_0x329124){_0x68da7d=combineOptions(_0x68da7d);var _0x3fe648=new Buffer(_0x5c38b2);var _0x181115=fs[_0x47f9('0xd')](_0x45abee);var _0x472090=fs[_0x47f9('0xe')](_0x55fec2);var _0x5b4f8b=crypto[_0x47f9('0xf')](_0x68da7d[_0x47f9('0x7')],_0x3fe648);_0x181115['on']('data',function(_0x2d047c){var _0x43f15f=new Buffer(_0x5b4f8b['update'](_0x2d047c),_0x47f9('0x10'));_0x472090[_0x47f9('0x11')](_0x43f15f);});_0x181115['on'](_0x47f9('0x12'),function(){try{var _0x113339=new Buffer(_0x5b4f8b[_0x47f9('0x13')](_0x47f9('0x10')),_0x47f9('0x10'));_0x472090['write'](_0x113339);_0x472090[_0x47f9('0x12')]();_0x472090['on'](_0x47f9('0x14'),function(){return _0x2f6c32(_0x55fec2);});}catch(_0xb0f5e3){fs['unlink'](_0x55fec2);return _0x329124(_0xb0f5e3);}});});};exports['decryptFile']=function(_0x26fade,_0x5bbb36,_0xb4aaa5,_0x1b5232){return new BPromise(function(_0x46dc22,_0x68e1b4){_0x1b5232=combineOptions(_0x1b5232);var _0x5e92f9=new Buffer(_0xb4aaa5);var _0x84ccfc=fs[_0x47f9('0xd')](_0x26fade);var _0x40c3c5=fs[_0x47f9('0xe')](_0x5bbb36);var _0xa4afc7=crypto[_0x47f9('0x15')](_0x1b5232[_0x47f9('0x7')],_0x5e92f9);_0x84ccfc['on']('data',function(_0x45764d){var _0x149a47=new Buffer(_0xa4afc7[_0x47f9('0x16')](_0x45764d),_0x47f9('0x10'));_0x40c3c5[_0x47f9('0x11')](_0x149a47);});_0x84ccfc['on'](_0x47f9('0x12'),function(){try{var _0x29f9b5=new Buffer(_0xa4afc7[_0x47f9('0x13')](_0x47f9('0x10')),_0x47f9('0x10'));_0x40c3c5[_0x47f9('0x11')](_0x29f9b5);_0x40c3c5[_0x47f9('0x12')]();_0x40c3c5['on'](_0x47f9('0x14'),function(){return _0x46dc22(_0x5bbb36);});}catch(_0x4004c4){fs[_0x47f9('0x17')](_0x5bbb36);return _0x68e1b4(_0x4004c4);}});});};exports['encryptString']=function(_0x175e81,_0x4e3b5c,_0xd73af8){var _0x35f3e7=_0xd73af8||stringOptions[_0x47f9('0x7')];var _0x2d8cd7=_0x4e3b5c||stringOptions['secret'];var _0x314729=crypto[_0x47f9('0xf')](_0x35f3e7,_0x2d8cd7);var _0x1f980d=_0x314729[_0x47f9('0x16')](_0x175e81,_0x47f9('0x18'),_0x47f9('0x19'));_0x1f980d+=_0x314729[_0x47f9('0x13')]('base64');return _0x1f980d;};exports['decryptString']=function(_0x2f02e2,_0x2f0a3f,_0x1d8ff6){var _0x8f5a94=_0x1d8ff6||stringOptions[_0x47f9('0x7')];var _0x2d48f6=_0x2f0a3f||stringOptions[_0x47f9('0x1a')];var _0x28e0b8=crypto[_0x47f9('0x15')](_0x8f5a94,_0x2d48f6);var _0x528a44=_0x28e0b8[_0x47f9('0x16')](_0x2f02e2,_0x47f9('0x19'),_0x47f9('0x18'));_0x528a44+=_0x28e0b8[_0x47f9('0x13')](_0x47f9('0x18'));return _0x528a44;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 08948b7..2718172 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 _0x1b3e=['csv','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','num','Empty','split','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','join','mkdirSync','each'];(function(_0xc2522b,_0x217fca){var _0x4ca1df=function(_0x2af13a){while(--_0x2af13a){_0xc2522b['push'](_0xc2522b['shift']());}};_0x4ca1df(++_0x217fca);}(_0x1b3e,0x6b));var _0xe1b3=function(_0x43c438,_0xa082ce){_0x43c438=_0x43c438-0x0;var _0x449eed=_0x1b3e[_0x43c438];return _0x449eed;};'use strict';var util=require(_0xe1b3('0x0'));var path=require('path');var _=require('lodash');var csv=require(_0xe1b3('0x1'));var fs=require('fs');var BPromise=require(_0xe1b3('0x2'));var zipdir=require(_0xe1b3('0x3'));var rimraf=require(_0xe1b3('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xe1b3('0x5'))[_0xe1b3('0x6')];var logger=require(_0xe1b3('0x7'))(_0xe1b3('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xe1b3('0x9')][0x2]);var QUERY=process[_0xe1b3('0x9')][0x3];var PATH=process[_0xe1b3('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x25b714,_0x49d36a){var _0x3bb51e={'status':_0x25b714};var _0xd665e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x49d36a){_0x3bb51e['savename']=_0x49d36a;}return db[_0xe1b3('0xa')]['update'](_0x3bb51e,_0xd665e);}function main(){var _0x1b0ff3=0x1388;var _0x336f5d;logger[_0xe1b3('0xb')](util[_0xe1b3('0xc')](_0xe1b3('0xd'),EXTRACTED_REPORT_ID,_0xe1b3('0xe')));return db['Setting'][_0xe1b3('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xe1b3('0x10')]})[_0xe1b3('0x11')](function(_0x10379b){if(_0x10379b){_0x336f5d=_0x10379b;_0x1b0ff3=_0x336f5d[_0xe1b3('0x10')]||0x1388;}})[_0xe1b3('0x11')](function(){return dbH['sequelize'][_0xe1b3('0x12')](util[_0xe1b3('0xc')](_0xe1b3('0x13'),QUERY),{'type':dbH[_0xe1b3('0x14')][_0xe1b3('0x15')]['SELECT']});})[_0xe1b3('0x11')](function(_0xea5b89){if(!_0xea5b89[0x0][_0xe1b3('0x16')]){return analyticExtractedReport(_0xe1b3('0x17'));}var _0x1c804d=[];var _0x31ad52=0x0;if(_0x336f5d[_0xe1b3('0x18')]){if(_0xea5b89&&_0xea5b89[_0xe1b3('0x19')]){var _0x1c8639=_[_0xe1b3('0x1a')](_0xea5b89[0x0][_0xe1b3('0x16')]/_0x1b0ff3);var _0x378f14=Number[_0xe1b3('0x1b')](_0xea5b89[0x0][_0xe1b3('0x16')]/_0x1b0ff3)?_0xea5b89[0x0][_0xe1b3('0x16')]%_0x1b0ff3:0x0;_0x1c8639['forEach'](function(_0x1af946){if(_0x1af946>0x0){_0x31ad52+=_0x1b0ff3;}_0x1c804d[_0xe1b3('0x1c')](dbH['sequelize'][_0xe1b3('0x12')](util[_0xe1b3('0xc')](_0xe1b3('0x1d'),QUERY,_0x1b0ff3,_0x31ad52),{'type':dbH[_0xe1b3('0x14')][_0xe1b3('0x15')][_0xe1b3('0x1e')]}));});if(_0x378f14>0x0){_0x31ad52+=_0x1b0ff3;_0x1c804d[_0xe1b3('0x1c')](dbH[_0xe1b3('0x14')][_0xe1b3('0x12')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x378f14,_0x31ad52),{'type':dbH[_0xe1b3('0x14')][_0xe1b3('0x15')][_0xe1b3('0x1e')]}));}}}else{_0x1c804d[_0xe1b3('0x1c')](dbH[_0xe1b3('0x14')][_0xe1b3('0x12')](QUERY,{'type':dbH[_0xe1b3('0x14')][_0xe1b3('0x15')][_0xe1b3('0x1e')]}));}var _0x1ddecb=path[_0xe1b3('0x1f')](PATH);var _0x2f9015=path[_0xe1b3('0x20')](PATH,_0xe1b3('0x21'));var _0x234396=_0x336f5d['split']&&_0x1c804d[_0xe1b3('0x19')]>0x1;var _0x1d8924=[];if(!fs['existsSync'](path[_0xe1b3('0x22')](_0x1ddecb,_0x2f9015))&&_0x234396){fs[_0xe1b3('0x23')](path[_0xe1b3('0x22')](_0x1ddecb,_0x2f9015));}return BPromise[_0xe1b3('0x24')](_0x1c804d,function(_0x2530a8){_0x1d8924[_0xe1b3('0x1c')](_0x2530a8);})[_0xe1b3('0x11')](function(){for(var _0x14a799=0x0;_0x14a799<_0x1d8924[_0xe1b3('0x19')];_0x14a799+=0x1){var _0xdf8943;var _0x3ee4b0=_0x1d8924[_0x14a799];if(_0x234396){_0xdf8943=path['join'](_0x1ddecb,_0x2f9015,util[_0xe1b3('0xc')]('%s%d.%s',_0x2f9015,_0x14a799,_0xe1b3('0x25')));}else{_0xdf8943=path[_0xe1b3('0x22')](_0x1ddecb,util[_0xe1b3('0xc')]('%s.%s',_0x2f9015,_0xe1b3('0x25')));}fs[_0xe1b3('0x26')](_0xdf8943,csv(_0x3ee4b0));}})[_0xe1b3('0x11')](function(){if(_0x234396){return new Promise(function(_0x25039f){zipdir(path['join'](_0x1ddecb,_0x2f9015),{'saveTo':path[_0xe1b3('0x22')](_0x1ddecb,util[_0xe1b3('0xc')](_0xe1b3('0x27'),_0x2f9015,_0xe1b3('0x28')))},function(_0x4b977a,_0x294565){rimraf(path[_0xe1b3('0x22')](_0x1ddecb,_0x2f9015),function(){});_0x25039f('zip\x20finished');});});}})['then'](function(){logger[_0xe1b3('0xb')](util[_0xe1b3('0xc')](_0xe1b3('0x29'),EXTRACTED_REPORT_ID,_0xe1b3('0xe')));return analyticExtractedReport('Completed',_0x234396?util['format']('%s.%s',_0x2f9015,_0x234396?'zip':'csv'):null);});})[_0xe1b3('0x2a')](function(_0x3c3e9f){logger[_0xe1b3('0xb')](util[_0xe1b3('0xc')](_0xe1b3('0x2b'),EXTRACTED_REPORT_ID,_0xe1b3('0xe')),util[_0xe1b3('0x2c')](_0x3c3e9f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe1b3('0x2d'));})[_0xe1b3('0x2e')](function(){process[_0xe1b3('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x8c74=['Failed','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Setting','find','split','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','inspect'];(function(_0x2a512e,_0x3912b2){var _0x26bfb9=function(_0x2fe0b4){while(--_0x2fe0b4){_0x2a512e['push'](_0x2a512e['shift']());}};_0x26bfb9(++_0x3912b2);}(_0x8c74,0xc5));var _0x48c7=function(_0x187826,_0x357251){_0x187826=_0x187826-0x0;var _0x2c22f5=_0x8c74[_0x187826];return _0x2c22f5;};'use strict';var util=require(_0x48c7('0x0'));var path=require(_0x48c7('0x1'));var _=require(_0x48c7('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x48c7('0x3'));var zipdir=require(_0x48c7('0x4'));var rimraf=require(_0x48c7('0x5'));var db=require(_0x48c7('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x48c7('0x7'))(_0x48c7('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x48c7('0x9')][0x2]);var QUERY=process[_0x48c7('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1c2781,_0xb31ecd){var _0x427786={'status':_0x1c2781};var _0x399933={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb31ecd){_0x427786[_0x48c7('0xa')]=_0xb31ecd;}return db[_0x48c7('0xb')][_0x48c7('0xc')](_0x427786,_0x399933);}function main(){var _0x566977=0x1388;var _0x46b8b3;logger[_0x48c7('0xd')](util[_0x48c7('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0x48c7('0xf')][_0x48c7('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x48c7('0x11'),'splitSizeCsv']})[_0x48c7('0x12')](function(_0x4f6693){if(_0x4f6693){_0x46b8b3=_0x4f6693;_0x566977=_0x46b8b3['splitSizeCsv']||0x1388;}})[_0x48c7('0x12')](function(){return dbH[_0x48c7('0x13')][_0x48c7('0x14')](util[_0x48c7('0xe')](_0x48c7('0x15'),QUERY),{'type':dbH[_0x48c7('0x13')][_0x48c7('0x16')]['SELECT']});})[_0x48c7('0x12')](function(_0xfe34ca){if(!_0xfe34ca[0x0][_0x48c7('0x17')]){return analyticExtractedReport('Empty');}var _0x239841=[];var _0x5e6534=0x0;if(_0x46b8b3[_0x48c7('0x11')]){if(_0xfe34ca&&_0xfe34ca[_0x48c7('0x18')]){var _0x49c413=_[_0x48c7('0x19')](_0xfe34ca[0x0][_0x48c7('0x17')]/_0x566977);var _0x4ec87b=Number[_0x48c7('0x1a')](_0xfe34ca[0x0][_0x48c7('0x17')]/_0x566977)?_0xfe34ca[0x0][_0x48c7('0x17')]%_0x566977:0x0;_0x49c413[_0x48c7('0x1b')](function(_0x12bdfd){if(_0x12bdfd>0x0){_0x5e6534+=_0x566977;}_0x239841[_0x48c7('0x1c')](dbH[_0x48c7('0x13')][_0x48c7('0x14')](util[_0x48c7('0xe')](_0x48c7('0x1d'),QUERY,_0x566977,_0x5e6534),{'type':dbH[_0x48c7('0x13')][_0x48c7('0x16')]['SELECT']}));});if(_0x4ec87b>0x0){_0x5e6534+=_0x566977;_0x239841[_0x48c7('0x1c')](dbH[_0x48c7('0x13')][_0x48c7('0x14')](util[_0x48c7('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4ec87b,_0x5e6534),{'type':dbH[_0x48c7('0x13')][_0x48c7('0x16')]['SELECT']}));}}}else{_0x239841[_0x48c7('0x1c')](dbH[_0x48c7('0x13')]['query'](QUERY,{'type':dbH[_0x48c7('0x13')][_0x48c7('0x16')][_0x48c7('0x1e')]}));}var _0x57cf77=path[_0x48c7('0x1f')](PATH);var _0x4de6b0=path[_0x48c7('0x20')](PATH,_0x48c7('0x21'));var _0x2267d2=_0x46b8b3[_0x48c7('0x11')]&&_0x239841[_0x48c7('0x18')]>0x1;var _0x4d6443=[];if(!fs[_0x48c7('0x22')](path[_0x48c7('0x23')](_0x57cf77,_0x4de6b0))&&_0x2267d2){fs[_0x48c7('0x24')](path['join'](_0x57cf77,_0x4de6b0));}return BPromise[_0x48c7('0x25')](_0x239841,function(_0x29814f){_0x4d6443[_0x48c7('0x1c')](_0x29814f);})['then'](function(){for(var _0xa074b1=0x0;_0xa074b1<_0x4d6443['length'];_0xa074b1+=0x1){var _0x66f96d;var _0x4bd8e1=_0x4d6443[_0xa074b1];if(_0x2267d2){_0x66f96d=path[_0x48c7('0x23')](_0x57cf77,_0x4de6b0,util[_0x48c7('0xe')](_0x48c7('0x26'),_0x4de6b0,_0xa074b1,'csv'));}else{_0x66f96d=path['join'](_0x57cf77,util[_0x48c7('0xe')]('%s.%s',_0x4de6b0,_0x48c7('0x27')));}fs[_0x48c7('0x28')](_0x66f96d,csv(_0x4bd8e1));}})[_0x48c7('0x12')](function(){if(_0x2267d2){return new Promise(function(_0x53b8cd){zipdir(path[_0x48c7('0x23')](_0x57cf77,_0x4de6b0),{'saveTo':path[_0x48c7('0x23')](_0x57cf77,util['format'](_0x48c7('0x29'),_0x4de6b0,_0x48c7('0x2a')))},function(_0x35c99e,_0x34eb88){rimraf(path[_0x48c7('0x23')](_0x57cf77,_0x4de6b0),function(){});_0x53b8cd('zip\x20finished');});});}})[_0x48c7('0x12')](function(){logger[_0x48c7('0xd')](util[_0x48c7('0xe')](_0x48c7('0x2b'),EXTRACTED_REPORT_ID,_0x48c7('0x2c')));return analyticExtractedReport(_0x48c7('0x2d'),_0x2267d2?util[_0x48c7('0xe')](_0x48c7('0x29'),_0x4de6b0,_0x2267d2?'zip':'csv'):null);});})[_0x48c7('0x2e')](function(_0x75929e){logger[_0x48c7('0xd')](util[_0x48c7('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0x48c7('0x2f')](_0x75929e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x48c7('0x30'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 47c64b9..8fe114d 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 _0xbf3e=['query','dirname','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','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','lodash','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','length','auto','body','push','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','header','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','forEach','sequelize','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0xbf3e,0x83));var _0xebf3=function(_0x2e217f,_0x5d9522){_0x2e217f=_0x2e217f-0x0;var _0x36a077=_0xbf3e[_0x2e217f];return _0x36a077;};'use strict';var _=require(_0xebf3('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xebf3('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0xebf3('0x2'));var PdfPrinter=require(_0xebf3('0x3'));var zipdir=require(_0xebf3('0x4'));var rimraf=require(_0xebf3('0x5'));var JSDOM=require(_0xebf3('0x6'))[_0xebf3('0x7')];var window=new JSDOM('')[_0xebf3('0x8')];var BPromise=require(_0xebf3('0x9'));var db=require(_0xebf3('0xa'))['db'];var dbH=require(_0xebf3('0xa'))[_0xebf3('0xb')];var logger=require(_0xebf3('0xc'))(_0xebf3('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xebf3('0xe')][0x3];var PATH=process[_0xebf3('0xe')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x33c9fe,_0x57740c){var _0x1aeee0={'status':_0x33c9fe};var _0x1bf62={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x57740c){_0x1aeee0[_0xebf3('0xf')]=_0x57740c;}return db[_0xebf3('0x10')][_0xebf3('0x11')](_0x1aeee0,_0x1bf62);}function getHeaders(_0x149f06){return _[_0xebf3('0x12')](_0x149f06,function(_0x3767a6){return{'text':_0x3767a6,'style':_0xebf3('0x13')};});}function getRows(_0x3f335a,_0x2a4b22){return _[_0xebf3('0x12')](_0x2a4b22,function(_0x7fef4f){return _(_0x7fef4f)[_0xebf3('0x14')](_0x3f335a)[_0xebf3('0x12')](function(_0x398d52){return _0x398d52?_[_0xebf3('0x15')](_0x398d52):'';})[_0xebf3('0x16')]();});}function createTable(_0x3ee831,_0x166092){var _0x14d78b={'widths':_['fill'](Array(_0x3ee831[_0xebf3('0x17')]),0x91),'heights':function(_0x57cbcd){return _0x57cbcd===0x0?_0xebf3('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x34e076=getHeaders(_0x3ee831);_0x14d78b[_0xebf3('0x19')][_0xebf3('0x1a')](_0x34e076);var _0x2db53b=getRows(_0x3ee831,_0x166092);_0x14d78b[_0xebf3('0x19')]=_0x14d78b[_0xebf3('0x19')]['concat'](_0x2db53b);return _0x14d78b;}function createTables(_0x308f42){var _0x4f569c=[];var _0xd0938=_[_0xebf3('0x1b')](Object[_0xebf3('0x1c')](_0x308f42[0x0]),0x5);_0xd0938['forEach'](function(_0x4bb941){_0x4f569c[_0xebf3('0x1a')](createTable(_0x4bb941,_0x308f42));});return _0x4f569c;}function getPDFDocDefinition(_0x152196){var _0x448f5c=util[_0xebf3('0x1d')](_0xebf3('0x1e'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xebf3('0x1f')])[_0xebf3('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xebf3('0x1d')](FORMAT));var _0xc54893=[];for(var _0x3720f5=0x0;_0x3720f5<_0x152196['length'];_0x3720f5++){var _0x597e19=[];if(_0x3720f5===0x0){_0x597e19['push']({'text':_0x448f5c,'style':_0xebf3('0x20')});}var _0x50dc8e={'table':_0x152196[_0x3720f5]};if(_0x3720f5>0x0){_0x50dc8e['pageBreak']=_0xebf3('0x21');_0x50dc8e[_0xebf3('0x22')]=[0x0,0x46,0x0,0x0];}_0x597e19[_0xebf3('0x1a')](_0x50dc8e);_0xc54893[_0xebf3('0x1a')](_0x597e19);}return{'pageSize':'A4','pageOrientation':_0xebf3('0x23'),'content':_0xc54893,'footer':function(_0x1c1be4,_0x3f96b2){return{'text':_0x1c1be4[_0xebf3('0x15')]()+_0xebf3('0x24')+_0x3f96b2,'style':_0xebf3('0x25')};},'defaultStyle':{'font':_0xebf3('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xebf3('0x27')},'footer':{'alignment':_0xebf3('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xabc95){var _0x1a21c9=0x1388;var _0x402acf;if(!_0xabc95[0x0][_0xebf3('0x29')]){return analyticExtractedReport(_0xebf3('0x2a'));}return db[_0xebf3('0x2b')][_0xebf3('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xebf3('0x2d'),_0xebf3('0x2e')]})[_0xebf3('0x2f')](function(_0x35a8d2){if(_0x35a8d2){_0x402acf=_0x35a8d2;_0x1a21c9=_0x402acf[_0xebf3('0x2e')]||0x3e8;}})[_0xebf3('0x2f')](function(){var _0xbaa96=[];var _0x1aca3f=0x0;if(_0x402acf[_0xebf3('0x2d')]){if(_0xabc95&&_0xabc95['length']){var _0x506847=_[_0xebf3('0x30')](_0xabc95[0x0][_0xebf3('0x29')]/_0x1a21c9);var _0xd145af=Number[_0xebf3('0x31')](_0xabc95[0x0][_0xebf3('0x29')]/_0x1a21c9)?_0xabc95[0x0][_0xebf3('0x29')]%_0x1a21c9:0x0;_0x506847[_0xebf3('0x32')](function(_0x309359){if(_0x309359>0x0){_0x1aca3f+=_0x1a21c9;}_0xbaa96[_0xebf3('0x1a')](dbH[_0xebf3('0x33')]['query'](util[_0xebf3('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1a21c9,_0x1aca3f),{'type':dbH[_0xebf3('0x33')]['QueryTypes'][_0xebf3('0x34')]}));});if(_0xd145af>0x0){_0x1aca3f+=_0x1a21c9;_0xbaa96[_0xebf3('0x1a')](dbH[_0xebf3('0x33')]['query'](util[_0xebf3('0x1d')](_0xebf3('0x35'),QUERY,_0xd145af,_0x1aca3f),{'type':dbH[_0xebf3('0x33')][_0xebf3('0x36')]['SELECT']}));}}}else{_0xbaa96['push'](dbH[_0xebf3('0x33')][_0xebf3('0x37')](QUERY,{'type':dbH[_0xebf3('0x33')][_0xebf3('0x36')]['SELECT']}));}var _0x5bd9f5=path[_0xebf3('0x38')](PATH);var _0x211b00=path['basename'](PATH,'.pdf');var _0x4a8577=_0x402acf[_0xebf3('0x2d')]&&_0xbaa96['length']>0x1;var _0x176d74=[];if(!fs[_0xebf3('0x39')](path[_0xebf3('0x3a')](_0x5bd9f5,_0x211b00))&&_0x4a8577){fs[_0xebf3('0x3b')](path[_0xebf3('0x3a')](_0x5bd9f5,_0x211b00));}return BPromise[_0xebf3('0x3c')](_0xbaa96,function(_0x3b1786){_0x176d74[_0xebf3('0x1a')](_0x3b1786);})[_0xebf3('0x2f')](function(){var _0x5771cd=[];for(var _0x353790=0x0;_0x353790<_0x176d74['length'];_0x353790+=0x1){var _0x4a25c7=_0x176d74[_0x353790];var _0x2fe9ce=createTables(_[_0xebf3('0x3d')](_0x4a25c7));var _0x240d42;var _0x52655d=getPDFDocDefinition(_0x2fe9ce);var _0x1782fd=getPDFPrinter();var _0x2a727a=_0x1782fd[_0xebf3('0x3e')](_0x52655d);if(_0x4a8577){_0x240d42=path['join'](_0x5bd9f5,_0x211b00,util[_0xebf3('0x1d')]('%s%d.%s',_0x211b00,_0x353790,_0xebf3('0x3f')));}else{_0x240d42=path[_0xebf3('0x3a')](_0x5bd9f5,util['format'](_0xebf3('0x40'),_0x211b00,'pdf'));}_0x5771cd['push'](writePDFDocument(_0x2a727a,_0x240d42));}return Promise[_0xebf3('0x41')](_0x5771cd);})[_0xebf3('0x2f')](function(){if(_0x4a8577){return new Promise(function(_0x5bb49a){zipdir(path[_0xebf3('0x3a')](_0x5bd9f5,_0x211b00),{'saveTo':path[_0xebf3('0x3a')](_0x5bd9f5,util[_0xebf3('0x1d')](_0xebf3('0x40'),_0x211b00,_0xebf3('0x42')))},function(){rimraf(path[_0xebf3('0x3a')](_0x5bd9f5,_0x211b00),function(){});_0x5bb49a('zip\x20finished');});});}})[_0xebf3('0x2f')](function(){if(!_0x4a8577)return;rimraf(path[_0xebf3('0x3a')](_0x5bd9f5,_0x211b00),function(){});})[_0xebf3('0x2f')](function(){logger[_0xebf3('0x43')](util['format'](_0xebf3('0x44'),EXTRACTED_REPORT_ID,_0xebf3('0x45')));return analyticExtractedReport(_0xebf3('0x46'),_0x4a8577?util[_0xebf3('0x1d')]('%s.%s',_0x211b00,_0x4a8577?'zip':'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xebf3('0x43')](util[_0xebf3('0x1d')](_0xebf3('0x47'),EXTRACTED_REPORT_ID,_0xebf3('0x45')));return db[_0xebf3('0x10')][_0xebf3('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xebf3('0x2f')](function(_0x3b3d9b){EXTRACTED_REPORT=_0x3b3d9b;return dbH['sequelize'][_0xebf3('0x37')](util[_0xebf3('0x1d')](_0xebf3('0x49'),QUERY),{'type':dbH[_0xebf3('0x33')][_0xebf3('0x36')][_0xebf3('0x34')]});})[_0xebf3('0x2f')](extractReport)['catch'](function(_0x4ebbd5){logger[_0xebf3('0x43')](util[_0xebf3('0x1d')](_0xebf3('0x4a'),EXTRACTED_REPORT_ID,'PDF'),util[_0xebf3('0x4b')](_0x4ebbd5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xebf3('0x4c')](function(){process[_0xebf3('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3f9c88=new PdfPrinter({'Arial':{'normal':__dirname+_0xebf3('0x4e'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xebf3('0x4f'),'bolditalics':__dirname+_0xebf3('0x50')}});return _0x3f9c88;}function getPDFDocDefinitionFromHTML(_0x267be9,_0x12213e){var _0x2374a9=util['format'](_0xebf3('0x51'),_0x12213e[_0xebf3('0x52')],_0x12213e[_0xebf3('0x53')]);var _0x1c220e=moment()[_0xebf3('0x1d')](_0xebf3('0x54'))[_0xebf3('0x15')]();var _0x11a966=htmlToPdfmake(_0x267be9,{'window':window,'tableAutoSize':!![]});return{'content':[_0x11a966],'defaultStyle':{'font':_0xebf3('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xebf3('0x55'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xebf3('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xebf3('0x55')}},'header':function(){return[{'text':_0xebf3('0x56'),'style':'header'}];},'footer':function(_0x2e859,_0x107f2a){return[{'text':util[_0xebf3('0x1d')](_0xebf3('0x57'),_0x2374a9,_0x2e859,_0x107f2a,_0x1c220e),'style':_0xebf3('0x25')}];}};}function writePDFDocument(_0x3ebbb4,_0x1eae9e){return new Promise(function(_0x2ff555,_0x250f89){var _0x5dd701=_0x3ebbb4[_0xebf3('0x58')](fs[_0xebf3('0x59')](_0x1eae9e));_0x5dd701['on'](_0xebf3('0x5a'),function(){_0x2ff555(_0xebf3('0x5a'));});_0x5dd701['on'](_0xebf3('0x5b'),function(_0x37a60b){_0x250f89(_0x37a60b);});_0x3ebbb4[_0xebf3('0x5c')]();});}exports['createPdfFromHTML']=function(_0x71c50,_0x33f01e){var _0x1aef00=getPDFPrinter();var _0x3679af=getPDFDocDefinitionFromHTML(_0x71c50,_0x33f01e);var _0x3bb277=_0x1aef00['createPdfKitDocument'](_0x3679af);return writePDFDocument(_0x3bb277,_0x33f01e[_0xebf3('0x1')])['catch'](function(_0x386087){throw _0x386087;});}; \ No newline at end of file +var _0x599b=['moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','value','body','chunk','keys','forEach','push','format','startDate','endDate','length','before','margin','landscape','toString','\x20/\x20','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','dirname','basename','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument','pdf','all','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','%s.%s','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','center','Interaction\x20Transcript','header','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path'];(function(_0x9f1972,_0x5952ba){var _0x3103db=function(_0x5dd9d7){while(--_0x5dd9d7){_0x9f1972['push'](_0x9f1972['shift']());}};_0x3103db(++_0x5952ba);}(_0x599b,0x159));var _0xb599=function(_0x8080ed,_0x50363d){_0x8080ed=_0x8080ed-0x0;var _0x2514d9=_0x599b[_0x8080ed];return _0x2514d9;};'use strict';var _=require(_0xb599('0x0'));var fs=require('fs');var util=require(_0xb599('0x1'));var path=require(_0xb599('0x2'));var moment=require(_0xb599('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xb599('0x4'));var zipdir=require(_0xb599('0x5'));var rimraf=require(_0xb599('0x6'));var JSDOM=require(_0xb599('0x7'))[_0xb599('0x8')];var window=new JSDOM('')[_0xb599('0x9')];var BPromise=require('bluebird');var db=require(_0xb599('0xa'))['db'];var dbH=require('../../mysqldb')[_0xb599('0xb')];var logger=require(_0xb599('0xc'))(_0xb599('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xb599('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xb599('0xe')][0x5];var FORMAT=_0xb599('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x44b0cf,_0x2dc660){var _0x1605ea={'status':_0x44b0cf};var _0x1dee71={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2dc660){_0x1605ea[_0xb599('0x10')]=_0x2dc660;}return db['AnalyticExtractedReport'][_0xb599('0x11')](_0x1605ea,_0x1dee71);}function getHeaders(_0x139409){return _[_0xb599('0x12')](_0x139409,function(_0x210074){return{'text':_0x210074,'style':_0xb599('0x13')};});}function getRows(_0x25c406,_0x4738a0){return _[_0xb599('0x12')](_0x4738a0,function(_0x42414e){return _(_0x42414e)['pick'](_0x25c406)[_0xb599('0x12')](function(_0x81fd96){return _0x81fd96?_['toString'](_0x81fd96):'';})[_0xb599('0x14')]();});}function createTable(_0x1743dd,_0x1df14b){var _0x2c62fb={'widths':_['fill'](Array(_0x1743dd['length']),0x91),'heights':function(_0xa67d4c){return _0xa67d4c===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5b2d03=getHeaders(_0x1743dd);_0x2c62fb[_0xb599('0x15')]['push'](_0x5b2d03);var _0x4413af=getRows(_0x1743dd,_0x1df14b);_0x2c62fb[_0xb599('0x15')]=_0x2c62fb[_0xb599('0x15')]['concat'](_0x4413af);return _0x2c62fb;}function createTables(_0x8458a0){var _0x3b804d=[];var _0x380b85=_[_0xb599('0x16')](Object[_0xb599('0x17')](_0x8458a0[0x0]),0x5);_0x380b85[_0xb599('0x18')](function(_0x1fca0e){_0x3b804d[_0xb599('0x19')](createTable(_0x1fca0e,_0x8458a0));});return _0x3b804d;}function getPDFDocDefinition(_0x462847){var _0x5271ff=util[_0xb599('0x1a')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xb599('0x1b')])[_0xb599('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0xb599('0x1c')])[_0xb599('0x1a')](FORMAT));var _0x31f4c9=[];for(var _0x47da29=0x0;_0x47da29<_0x462847[_0xb599('0x1d')];_0x47da29++){var _0x36da63=[];if(_0x47da29===0x0){_0x36da63[_0xb599('0x19')]({'text':_0x5271ff,'style':'header'});}var _0x5728f2={'table':_0x462847[_0x47da29]};if(_0x47da29>0x0){_0x5728f2['pageBreak']=_0xb599('0x1e');_0x5728f2[_0xb599('0x1f')]=[0x0,0x46,0x0,0x0];}_0x36da63['push'](_0x5728f2);_0x31f4c9[_0xb599('0x19')](_0x36da63);}return{'pageSize':'A4','pageOrientation':_0xb599('0x20'),'content':_0x31f4c9,'footer':function(_0x22fc8e,_0x55972d){return{'text':_0x22fc8e[_0xb599('0x21')]()+_0xb599('0x22')+_0x55972d,'style':'footer'};},'defaultStyle':{'font':_0xb599('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xb599('0x24')},'footer':{'alignment':_0xb599('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5b2b7c){var _0x379bbb=0x1388;var _0x59ff1b;if(!_0x5b2b7c[0x0][_0xb599('0x26')]){return analyticExtractedReport(_0xb599('0x27'));}return db[_0xb599('0x28')][_0xb599('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb599('0x2a'),_0xb599('0x2b')]})[_0xb599('0x2c')](function(_0x59a01b){if(_0x59a01b){_0x59ff1b=_0x59a01b;_0x379bbb=_0x59ff1b[_0xb599('0x2b')]||0x3e8;}})[_0xb599('0x2c')](function(){var _0x4c71a1=[];var _0x340e58=0x0;if(_0x59ff1b[_0xb599('0x2a')]){if(_0x5b2b7c&&_0x5b2b7c[_0xb599('0x1d')]){var _0x42d2a1=_[_0xb599('0x2d')](_0x5b2b7c[0x0][_0xb599('0x26')]/_0x379bbb);var _0x8e410=Number[_0xb599('0x2e')](_0x5b2b7c[0x0][_0xb599('0x26')]/_0x379bbb)?_0x5b2b7c[0x0][_0xb599('0x26')]%_0x379bbb:0x0;_0x42d2a1[_0xb599('0x18')](function(_0x32576b){if(_0x32576b>0x0){_0x340e58+=_0x379bbb;}_0x4c71a1[_0xb599('0x19')](dbH['sequelize']['query'](util[_0xb599('0x1a')](_0xb599('0x2f'),QUERY,_0x379bbb,_0x340e58),{'type':dbH[_0xb599('0x30')][_0xb599('0x31')][_0xb599('0x32')]}));});if(_0x8e410>0x0){_0x340e58+=_0x379bbb;_0x4c71a1[_0xb599('0x19')](dbH[_0xb599('0x30')][_0xb599('0x33')](util[_0xb599('0x1a')](_0xb599('0x2f'),QUERY,_0x8e410,_0x340e58),{'type':dbH['sequelize'][_0xb599('0x31')]['SELECT']}));}}}else{_0x4c71a1[_0xb599('0x19')](dbH['sequelize'][_0xb599('0x33')](QUERY,{'type':dbH[_0xb599('0x30')]['QueryTypes'][_0xb599('0x32')]}));}var _0x335704=path[_0xb599('0x34')](PATH);var _0x4cf07e=path[_0xb599('0x35')](PATH,'.pdf');var _0x31908c=_0x59ff1b[_0xb599('0x2a')]&&_0x4c71a1[_0xb599('0x1d')]>0x1;var _0x5036f9=[];if(!fs[_0xb599('0x36')](path['join'](_0x335704,_0x4cf07e))&&_0x31908c){fs[_0xb599('0x37')](path[_0xb599('0x38')](_0x335704,_0x4cf07e));}return BPromise[_0xb599('0x39')](_0x4c71a1,function(_0x5f3c92){_0x5036f9['push'](_0x5f3c92);})[_0xb599('0x2c')](function(){var _0x48c854=[];for(var _0x16d67c=0x0;_0x16d67c<_0x5036f9[_0xb599('0x1d')];_0x16d67c+=0x1){var _0x56ebad=_0x5036f9[_0x16d67c];var _0xe4e127=createTables(_[_0xb599('0x3a')](_0x56ebad));var _0x4e4e14;var _0x459ac0=getPDFDocDefinition(_0xe4e127);var _0x42cda1=getPDFPrinter();var _0x2bf2ad=_0x42cda1[_0xb599('0x3b')](_0x459ac0);if(_0x31908c){_0x4e4e14=path[_0xb599('0x38')](_0x335704,_0x4cf07e,util['format']('%s%d.%s',_0x4cf07e,_0x16d67c,_0xb599('0x3c')));}else{_0x4e4e14=path[_0xb599('0x38')](_0x335704,util[_0xb599('0x1a')]('%s.%s',_0x4cf07e,_0xb599('0x3c')));}_0x48c854[_0xb599('0x19')](writePDFDocument(_0x2bf2ad,_0x4e4e14));}return Promise[_0xb599('0x3d')](_0x48c854);})[_0xb599('0x2c')](function(){if(_0x31908c){return new Promise(function(_0x51ae99){zipdir(path[_0xb599('0x38')](_0x335704,_0x4cf07e),{'saveTo':path[_0xb599('0x38')](_0x335704,util[_0xb599('0x1a')]('%s.%s',_0x4cf07e,_0xb599('0x3e')))},function(){rimraf(path[_0xb599('0x38')](_0x335704,_0x4cf07e),function(){});_0x51ae99('zip\x20finished');});});}})[_0xb599('0x2c')](function(){if(!_0x31908c)return;rimraf(path['join'](_0x335704,_0x4cf07e),function(){});})[_0xb599('0x2c')](function(){logger['info'](util['format'](_0xb599('0x3f'),EXTRACTED_REPORT_ID,_0xb599('0x40')));return analyticExtractedReport('Completed',_0x31908c?util[_0xb599('0x1a')](_0xb599('0x41'),_0x4cf07e,_0x31908c?_0xb599('0x3e'):_0xb599('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xb599('0x42')](util['format'](_0xb599('0x43'),EXTRACTED_REPORT_ID,_0xb599('0x40')));return db[_0xb599('0x44')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xb599('0x2c')](function(_0x395e0a){EXTRACTED_REPORT=_0x395e0a;return dbH[_0xb599('0x30')][_0xb599('0x33')](util['format'](_0xb599('0x45'),QUERY),{'type':dbH[_0xb599('0x30')]['QueryTypes']['SELECT']});})[_0xb599('0x2c')](extractReport)[_0xb599('0x46')](function(_0xddc98){logger['info'](util[_0xb599('0x1a')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb599('0x40')),util[_0xb599('0x47')](_0xddc98,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb599('0x48'));})[_0xb599('0x49')](function(){process[_0xb599('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x44fe26=new PdfPrinter({'Arial':{'normal':__dirname+_0xb599('0x4b'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xb599('0x4c'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x44fe26;}function getPDFDocDefinitionFromHTML(_0x28797d,_0x1e67e8){var _0x2a32c8=util[_0xb599('0x1a')](_0xb599('0x4d'),_0x1e67e8[_0xb599('0x4e')],_0x1e67e8['interactionId']);var _0x162208=moment()[_0xb599('0x1a')]('YYYY-MM-DD')[_0xb599('0x21')]();var _0x5a4212=htmlToPdfmake(_0x28797d,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5a4212],'defaultStyle':{'font':_0xb599('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xb599('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xb599('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xb599('0x4f')}},'header':function(){return[{'text':_0xb599('0x50'),'style':_0xb599('0x51')}];},'footer':function(_0xcc9314,_0x59a855){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x2a32c8,_0xcc9314,_0x59a855,_0x162208),'style':'footer'}];}};}function writePDFDocument(_0x39ed76,_0x9ac502){return new Promise(function(_0x3eab1b,_0xf6fc4){var _0x527a1c=_0x39ed76['pipe'](fs[_0xb599('0x52')](_0x9ac502));_0x527a1c['on'](_0xb599('0x53'),function(){_0x3eab1b('finish');});_0x527a1c['on'](_0xb599('0x54'),function(_0x54d6d2){_0xf6fc4(_0x54d6d2);});_0x39ed76[_0xb599('0x55')]();});}exports[_0xb599('0x56')]=function(_0x1c6d0c,_0x3b1ac3){var _0x19ac96=getPDFPrinter();var _0x37ebf2=getPDFDocDefinitionFromHTML(_0x1c6d0c,_0x3b1ac3);var _0x478361=_0x19ac96[_0xb599('0x3b')](_0x37ebf2);return writePDFDocument(_0x478361,_0x3b1ac3['path'])['catch'](function(_0x23d223){throw _0x23d223;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 62a0d7b..fa14770 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 _0x9afc=['inspect','Failed','finally','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','analytics','argv','update','info','format','XLSX','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','join','mkdirSync','xlsx','binary','%s.%s','zip','zip\x20finished','Completed','catch'];(function(_0x2d90a8,_0x1fad1d){var _0x5dd911=function(_0xd7c848){while(--_0xd7c848){_0x2d90a8['push'](_0x2d90a8['shift']());}};_0x5dd911(++_0x1fad1d);}(_0x9afc,0xe4));var _0xc9af=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x9afc[_0x5c6244];return _0x5800ce;};'use strict';var util=require(_0xc9af('0x0'));var path=require(_0xc9af('0x1'));var _=require(_0xc9af('0x2'));var fs=require('fs');var json2xls=require(_0xc9af('0x3'));var BPromise=require(_0xc9af('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xc9af('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc9af('0x6'))[_0xc9af('0x7')];var logger=require('../../config/logger')(_0xc9af('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xc9af('0x9')][0x2]);var QUERY=process[_0xc9af('0x9')][0x3];var PATH=process[_0xc9af('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xc87205,_0x44fcfa){var _0x3a122a={'status':_0xc87205};var _0x2d706a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x44fcfa){_0x3a122a['savename']=_0x44fcfa;}return db['AnalyticExtractedReport'][_0xc9af('0xa')](_0x3a122a,_0x2d706a);}function main(){var _0x14a2b3=0x1388;var _0x294a88;logger[_0xc9af('0xb')](util[_0xc9af('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc9af('0xd')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xc9af('0xe')]})[_0xc9af('0xf')](function(_0x47de91){if(_0x47de91){_0x294a88=_0x47de91;_0x14a2b3=_0x294a88[_0xc9af('0xe')]||0x1388;}})['then'](function(){return dbH[_0xc9af('0x10')][_0xc9af('0x11')](util['format'](_0xc9af('0x12'),QUERY),{'type':dbH['sequelize'][_0xc9af('0x13')][_0xc9af('0x14')]});})[_0xc9af('0xf')](function(_0x214bfd){if(!_0x214bfd[0x0][_0xc9af('0x15')]){return analyticExtractedReport(_0xc9af('0x16'));}var _0x4b7c87=[];var _0x465d4d=0x0;if(_0x294a88[_0xc9af('0x17')]){if(_0x214bfd&&_0x214bfd[_0xc9af('0x18')]){var _0x46faa7=_[_0xc9af('0x19')](_0x214bfd[0x0][_0xc9af('0x15')]/_0x14a2b3);var _0x5b5c98=Number[_0xc9af('0x1a')](_0x214bfd[0x0][_0xc9af('0x15')]/_0x14a2b3)?_0x214bfd[0x0]['num']%_0x14a2b3:0x0;_0x46faa7[_0xc9af('0x1b')](function(_0x2703f2){if(_0x2703f2>0x0){_0x465d4d+=_0x14a2b3;}_0x4b7c87[_0xc9af('0x1c')](dbH[_0xc9af('0x10')][_0xc9af('0x11')](util['format'](_0xc9af('0x1d'),QUERY,_0x14a2b3,_0x465d4d),{'type':dbH[_0xc9af('0x10')]['QueryTypes']['SELECT']}));});if(_0x5b5c98>0x0){_0x465d4d+=_0x14a2b3;_0x4b7c87[_0xc9af('0x1c')](dbH[_0xc9af('0x10')]['query'](util[_0xc9af('0xc')](_0xc9af('0x1d'),QUERY,_0x5b5c98,_0x465d4d),{'type':dbH[_0xc9af('0x10')]['QueryTypes'][_0xc9af('0x14')]}));}}}else{_0x4b7c87[_0xc9af('0x1c')](dbH['sequelize'][_0xc9af('0x11')](QUERY,{'type':dbH[_0xc9af('0x10')][_0xc9af('0x13')][_0xc9af('0x14')]}));}var _0x38711c=path[_0xc9af('0x1e')](PATH);var _0x19f3e2=path['basename'](PATH,_0xc9af('0x1f'));var _0x1b1d62=_0x294a88['split']&&_0x4b7c87[_0xc9af('0x18')]>0x1;var _0x3e7581=[];if(!fs[_0xc9af('0x20')](path[_0xc9af('0x21')](_0x38711c,_0x19f3e2))&&_0x1b1d62){fs[_0xc9af('0x22')](path[_0xc9af('0x21')](_0x38711c,_0x19f3e2));}return BPromise['each'](_0x4b7c87,function(_0x2ebba6){_0x3e7581[_0xc9af('0x1c')](_0x2ebba6);})[_0xc9af('0xf')](function(){for(var _0x5ab2df=0x0;_0x5ab2df<_0x3e7581['length'];_0x5ab2df+=0x1){var _0x493ac1;var _0xe2cc08=_0x3e7581[_0x5ab2df];if(_0x1b1d62){_0x493ac1=path[_0xc9af('0x21')](_0x38711c,_0x19f3e2,util[_0xc9af('0xc')]('%s%d.%s',_0x19f3e2,_0x5ab2df,_0xc9af('0x23')));}else{_0x493ac1=path[_0xc9af('0x21')](_0x38711c,util[_0xc9af('0xc')]('%s.%s',_0x19f3e2,_0xc9af('0x23')));}fs['writeFileSync'](_0x493ac1,json2xls(_0xe2cc08),_0xc9af('0x24'));}})[_0xc9af('0xf')](function(){if(_0x1b1d62){return new Promise(function(_0x371cf7){zipdir(path[_0xc9af('0x21')](_0x38711c,_0x19f3e2),{'saveTo':path[_0xc9af('0x21')](_0x38711c,util['format'](_0xc9af('0x25'),_0x19f3e2,_0xc9af('0x26')))},function(_0x1e7048,_0x2c3feb){rimraf(path[_0xc9af('0x21')](_0x38711c,_0x19f3e2),function(){});_0x371cf7(_0xc9af('0x27'));});});}})[_0xc9af('0xf')](function(){logger[_0xc9af('0xb')](util[_0xc9af('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xc9af('0xd')));return analyticExtractedReport(_0xc9af('0x28'),_0x1b1d62?util['format'](_0xc9af('0x25'),_0x19f3e2,_0x1b1d62?'zip':'xlsx'):null);});})[_0xc9af('0x29')](function(_0x1b1448){logger[_0xc9af('0xb')](util[_0xc9af('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0xc9af('0x2a')](_0x1b1448,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc9af('0x2b'));})[_0xc9af('0x2c')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4d08=['bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','join','mkdirSync','each','length','%s%d.%s','xlsx','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','inspect','Failed','finally','exit','util','lodash','json2xls'];(function(_0x40a10f,_0x40c1c7){var _0x5f34c9=function(_0x4883a9){while(--_0x4883a9){_0x40a10f['push'](_0x40a10f['shift']());}};_0x5f34c9(++_0x40c1c7);}(_0x4d08,0x1a5));var _0x84d0=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x4d08[_0x236d24];return _0x1574cf;};'use strict';var util=require(_0x84d0('0x0'));var path=require('path');var _=require(_0x84d0('0x1'));var fs=require('fs');var json2xls=require(_0x84d0('0x2'));var BPromise=require(_0x84d0('0x3'));var zipdir=require(_0x84d0('0x4'));var rimraf=require(_0x84d0('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x84d0('0x6'))[_0x84d0('0x7')];var logger=require(_0x84d0('0x8'))(_0x84d0('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x84d0('0xa')][0x2]);var QUERY=process[_0x84d0('0xa')][0x3];var PATH=process[_0x84d0('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x832446,_0x306e3b){var _0x3d8b60={'status':_0x832446};var _0x1b2ac0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x306e3b){_0x3d8b60[_0x84d0('0xb')]=_0x306e3b;}return db[_0x84d0('0xc')]['update'](_0x3d8b60,_0x1b2ac0);}function main(){var _0x58a549=0x1388;var _0x4a5838;logger[_0x84d0('0xd')](util[_0x84d0('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x84d0('0xf')][_0x84d0('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x84d0('0x11'),_0x84d0('0x12')]})['then'](function(_0x4dd600){if(_0x4dd600){_0x4a5838=_0x4dd600;_0x58a549=_0x4a5838['splitSizeXlsx']||0x1388;}})[_0x84d0('0x13')](function(){return dbH[_0x84d0('0x14')][_0x84d0('0x15')](util[_0x84d0('0xe')](_0x84d0('0x16'),QUERY),{'type':dbH[_0x84d0('0x14')][_0x84d0('0x17')][_0x84d0('0x18')]});})[_0x84d0('0x13')](function(_0x1add3d){if(!_0x1add3d[0x0]['num']){return analyticExtractedReport('Empty');}var _0x2beef2=[];var _0x12b452=0x0;if(_0x4a5838[_0x84d0('0x11')]){if(_0x1add3d&&_0x1add3d['length']){var _0x4f622c=_[_0x84d0('0x19')](_0x1add3d[0x0][_0x84d0('0x1a')]/_0x58a549);var _0x2c1443=Number[_0x84d0('0x1b')](_0x1add3d[0x0]['num']/_0x58a549)?_0x1add3d[0x0][_0x84d0('0x1a')]%_0x58a549:0x0;_0x4f622c[_0x84d0('0x1c')](function(_0x492a6b){if(_0x492a6b>0x0){_0x12b452+=_0x58a549;}_0x2beef2[_0x84d0('0x1d')](dbH['sequelize'][_0x84d0('0x15')](util[_0x84d0('0xe')](_0x84d0('0x1e'),QUERY,_0x58a549,_0x12b452),{'type':dbH['sequelize'][_0x84d0('0x17')][_0x84d0('0x18')]}));});if(_0x2c1443>0x0){_0x12b452+=_0x58a549;_0x2beef2[_0x84d0('0x1d')](dbH[_0x84d0('0x14')]['query'](util[_0x84d0('0xe')](_0x84d0('0x1e'),QUERY,_0x2c1443,_0x12b452),{'type':dbH['sequelize'][_0x84d0('0x17')][_0x84d0('0x18')]}));}}}else{_0x2beef2['push'](dbH[_0x84d0('0x14')][_0x84d0('0x15')](QUERY,{'type':dbH['sequelize'][_0x84d0('0x17')][_0x84d0('0x18')]}));}var _0x31fada=path[_0x84d0('0x1f')](PATH);var _0x4bd31e=path['basename'](PATH,_0x84d0('0x20'));var _0x59e6f4=_0x4a5838[_0x84d0('0x11')]&&_0x2beef2['length']>0x1;var _0x3f1fbc=[];if(!fs[_0x84d0('0x21')](path[_0x84d0('0x22')](_0x31fada,_0x4bd31e))&&_0x59e6f4){fs[_0x84d0('0x23')](path[_0x84d0('0x22')](_0x31fada,_0x4bd31e));}return BPromise[_0x84d0('0x24')](_0x2beef2,function(_0x5dab03){_0x3f1fbc['push'](_0x5dab03);})[_0x84d0('0x13')](function(){for(var _0x5680e8=0x0;_0x5680e8<_0x3f1fbc[_0x84d0('0x25')];_0x5680e8+=0x1){var _0x3c0543;var _0x435ede=_0x3f1fbc[_0x5680e8];if(_0x59e6f4){_0x3c0543=path[_0x84d0('0x22')](_0x31fada,_0x4bd31e,util[_0x84d0('0xe')](_0x84d0('0x26'),_0x4bd31e,_0x5680e8,_0x84d0('0x27')));}else{_0x3c0543=path[_0x84d0('0x22')](_0x31fada,util[_0x84d0('0xe')]('%s.%s',_0x4bd31e,_0x84d0('0x27')));}fs[_0x84d0('0x28')](_0x3c0543,json2xls(_0x435ede),_0x84d0('0x29'));}})[_0x84d0('0x13')](function(){if(_0x59e6f4){return new Promise(function(_0x24329e){zipdir(path[_0x84d0('0x22')](_0x31fada,_0x4bd31e),{'saveTo':path['join'](_0x31fada,util[_0x84d0('0xe')]('%s.%s',_0x4bd31e,_0x84d0('0x2a')))},function(_0x5c8099,_0x4046eb){rimraf(path[_0x84d0('0x22')](_0x31fada,_0x4bd31e),function(){});_0x24329e('zip\x20finished');});});}})['then'](function(){logger[_0x84d0('0xd')](util[_0x84d0('0xe')](_0x84d0('0x2b'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x84d0('0x2c'),_0x59e6f4?util['format'](_0x84d0('0x2d'),_0x4bd31e,_0x59e6f4?_0x84d0('0x2a'):_0x84d0('0x27')):null);});})[_0x84d0('0x2e')](function(_0x35b21e){logger['info'](util[_0x84d0('0xe')](_0x84d0('0x2f'),EXTRACTED_REPORT_ID,_0x84d0('0x30')),util[_0x84d0('0x31')](_0x35b21e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x84d0('0x32'));})[_0x84d0('0x33')](function(){process[_0x84d0('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index a1161df..10e6e29 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 _0x1268=['last','concat','Hangup','destroy','sortBy','catch','error','rewrite','lodash','util','Interval','then','intervals','models','VoiceExtension','findAll','IntervalId','map','CAST(priority\x20AS\x20UNSIGNED)','exten','queue','hasOwnProperty','extensions','extension','find','push','type','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','Set','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},'];(function(_0x3c5b3b,_0x40d269){var _0x2be801=function(_0x19c30d){while(--_0x19c30d){_0x3c5b3b['push'](_0x3c5b3b['shift']());}};_0x2be801(++_0x40d269);}(_0x1268,0xcb));var _0x8126=function(_0x51fb1a,_0x5717a1){_0x51fb1a=_0x51fb1a-0x0;var _0xe4767b=_0x1268[_0x51fb1a];return _0xe4767b;};'use strict';var _=require(_0x8126('0x0'));var util=require(_0x8126('0x1'));function rewrite(_0x59eecc,_0x48d64b){var _0x297981=this;return _0x59eecc['models'][_0x8126('0x2')]['findAll']({'raw':!![]})[_0x8126('0x3')](function(_0x248a86){_0x297981[_0x8126('0x4')]=_0x248a86;return _0x59eecc[_0x8126('0x5')][_0x8126('0x6')][_0x8126('0x7')]({'where':{'IntervalId':_0x48d64b[_0x8126('0x8')]},'raw':!![]});})[_0x8126('0x3')](function(_0x1023e5){return _0x59eecc['models'][_0x8126('0x6')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x8126('0x9')](_0x1023e5,'exten'))}},'order':[{'raw':_0x8126('0xa')}],'raw':!![]});})['then'](function(_0x110196){var _0xb90216=_['filter'](_0x110196,{'priority':'1'});var _0x461ca3=_['filter'](_0x110196,{'isApp':0x1});var _0x31fcbe=_['groupBy'](_0x461ca3,_0x8126('0xb'));var _0x1d2236=[_0x8126('0xc'),'playback'];var _0x11591f=[];var _0xc55e2e=[];for(var _0x28988b in _0x31fcbe){if(_0x31fcbe[_0x8126('0xd')](_0x28988b)){_0x297981['priority']=0x2;_0x297981[_0x8126('0xe')]=[];_0x297981[_0x8126('0xf')]=_[_0x8126('0x10')](_0xb90216,{'exten':_0x31fcbe[_0x28988b][0x0]['exten']});_0x297981['extensions'][_0x8126('0x11')]({'type':_0x31fcbe[_0x28988b][0x0][_0x8126('0x12')],'app':'Set','appdata':util[_0x8126('0x13')](_0x8126('0x14'),_0x31fcbe[_0x28988b][0x0][_0x8126('0x12')]),'context':_0x31fcbe[_0x28988b][0x0][_0x8126('0x15')],'exten':_0x31fcbe[_0x28988b][0x0][_0x8126('0xb')],'priority':_0x297981[_0x8126('0x16')]++,'VoiceExtensionId':_0x31fcbe[_0x28988b][0x0][_0x8126('0x17')]});if(_0x31fcbe[_0x28988b][0x0]['type']===_0x8126('0x18')){_0x297981[_0x8126('0xe')][_0x8126('0x11')]({'type':_0x31fcbe[_0x28988b][0x0][_0x8126('0x12')],'app':_0x8126('0x19'),'appdata':'CDR(routeid)='+_0x31fcbe[_0x28988b][0x0][_0x8126('0x17')],'context':_0x31fcbe[_0x28988b][0x0][_0x8126('0x15')],'exten':_0x31fcbe[_0x28988b][0x0][_0x8126('0xb')],'priority':_0x297981[_0x8126('0x16')]++,'VoiceExtensionId':_0x31fcbe[_0x28988b][0x0]['VoiceExtensionId']});}else if(_0x31fcbe[_0x28988b][0x0][_0x8126('0x12')]==='outbound'){if(_0x297981[_0x8126('0xf')]){_0x297981[_0x8126('0xe')]['push']({'type':_0x31fcbe[_0x28988b][0x0]['type'],'app':_0x8126('0x19'),'appdata':'CDR(destination)='+(_0x297981[_0x8126('0xf')][_0x8126('0x1a')]?_0x8126('0x1b')+_0x297981[_0x8126('0xf')][_0x8126('0x1a')]+'}':_0x8126('0x1c')),'context':_0x31fcbe[_0x28988b][0x0]['context'],'exten':_0x31fcbe[_0x28988b][0x0]['exten'],'priority':_0x297981['priority']++,'VoiceExtensionId':_0x31fcbe[_0x28988b][0x0][_0x8126('0x17')]});}_0x297981[_0x8126('0xe')][_0x8126('0x11')]({'type':_0x31fcbe[_0x28988b][0x0][_0x8126('0x12')],'app':_0x8126('0x19'),'appdata':'CDR(routeid)='+_0x31fcbe[_0x28988b][0x0][_0x8126('0x17')],'context':_0x31fcbe[_0x28988b][0x0][_0x8126('0x15')],'exten':_0x31fcbe[_0x28988b][0x0][_0x8126('0xb')],'priority':_0x297981[_0x8126('0x16')]++,'VoiceExtensionId':_0x31fcbe[_0x28988b][0x0]['VoiceExtensionId']});var _0xdfaa28=_0x297981[_0x8126('0x16')]++;_0x297981['extensions'][_0x8126('0x11')]({'type':_0x31fcbe[_0x28988b][0x0]['type'],'app':_0x8126('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0xdfaa28+0x2)+_0x8126('0x1e')+(_0xdfaa28+0x1)+')','context':_0x31fcbe[_0x28988b][0x0][_0x8126('0x15')],'exten':_0x31fcbe[_0x28988b][0x0][_0x8126('0xb')],'priority':_0xdfaa28,'VoiceExtensionId':_0x31fcbe[_0x28988b][0x0]['VoiceExtensionId']});if(_0x297981[_0x8126('0xf')]){_0x297981[_0x8126('0xe')][_0x8126('0x11')]({'type':_0x31fcbe[_0x28988b][0x0][_0x8126('0x12')],'app':'Set','appdata':_0x297981[_0x8126('0xf')][_0x8126('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x297981[_0x8126('0xf')]['cutdigits']+'}':_0x8126('0x1f'),'context':_0x31fcbe[_0x28988b][0x0][_0x8126('0x15')],'exten':_0x31fcbe[_0x28988b][0x0][_0x8126('0xb')],'priority':_0x297981[_0x8126('0x16')]++,'VoiceExtensionId':_0x31fcbe[_0x28988b][0x0][_0x8126('0x17')]});}_0x297981[_0x8126('0xe')][_0x8126('0x11')]({'type':_0x31fcbe[_0x28988b][0x0][_0x8126('0x12')],'app':_0x8126('0x19'),'appdata':_0x8126('0x20')+_0x31fcbe[_0x28988b][0x0][_0x8126('0x17')],'context':_0x31fcbe[_0x28988b][0x0][_0x8126('0x15')],'exten':_0x31fcbe[_0x28988b][0x0][_0x8126('0xb')],'priority':_0x297981[_0x8126('0x16')]++,'VoiceExtensionId':_0x31fcbe[_0x28988b][0x0]['VoiceExtensionId']});if(_0x297981[_0x8126('0xf')]&&_0x297981[_0x8126('0xf')][_0x8126('0xd')](_0x8126('0x21'))&&_0x297981[_0x8126('0xf')][_0x8126('0x21')]!=='none'){_0x297981[_0x8126('0xe')][_0x8126('0x11')]({'type':_0x31fcbe[_0x28988b][0x0][_0x8126('0x12')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x31fcbe[_0x28988b][0x0]['context'],'exten':_0x31fcbe[_0x28988b][0x0]['exten'],'priority':_0x297981[_0x8126('0x16')]++,'VoiceExtensionId':_0x31fcbe[_0x28988b][0x0][_0x8126('0x17')]});_0x297981[_0x8126('0xe')][_0x8126('0x11')]({'type':_0x31fcbe[_0x28988b][0x0][_0x8126('0x12')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x297981[_0x8126('0xf')]['recordingFormat']||_0x8126('0x22'),'context':_0x31fcbe[_0x28988b][0x0][_0x8126('0x15')],'exten':_0x31fcbe[_0x28988b][0x0][_0x8126('0xb')],'priority':_0x297981['priority']++,'VoiceExtensionId':_0x31fcbe[_0x28988b][0x0]['VoiceExtensionId']});}}_0x297981[_0x8126('0xe')][_0x8126('0x11')]({'type':_0x31fcbe[_0x28988b][0x0][_0x8126('0x12')],'app':_0x8126('0x19'),'appdata':_0x8126('0x23'),'context':_0x31fcbe[_0x28988b][0x0][_0x8126('0x15')],'exten':_0x31fcbe[_0x28988b][0x0][_0x8126('0xb')],'priority':_0x297981[_0x8126('0x16')]++,'VoiceExtensionId':_0x31fcbe[_0x28988b][0x0][_0x8126('0x17')]});_0x297981[_0x8126('0xe')][_0x8126('0x11')]({'type':_0x31fcbe[_0x28988b][0x0]['type'],'app':_0x8126('0x19'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x31fcbe[_0x28988b][0x0][_0x8126('0x15')],'exten':_0x31fcbe[_0x28988b][0x0][_0x8126('0xb')],'priority':_0x297981[_0x8126('0x16')]++,'VoiceExtensionId':_0x31fcbe[_0x28988b][0x0][_0x8126('0x17')]});_0x297981[_0x8126('0xe')][_0x8126('0x11')]({'type':_0x31fcbe[_0x28988b][0x0][_0x8126('0x12')],'app':_0x8126('0x19'),'appdata':_0x8126('0x24'),'context':_0x31fcbe[_0x28988b][0x0][_0x8126('0x15')],'exten':_0x31fcbe[_0x28988b][0x0]['exten'],'priority':_0x297981[_0x8126('0x16')]++,'VoiceExtensionId':_0x31fcbe[_0x28988b][0x0][_0x8126('0x17')]});for(var _0x8ffd2e=0x0,_0x4d04b5=0x0;_0x8ffd2e<_0x31fcbe[_0x28988b][_0x8126('0x25')];_0x8ffd2e+=0x1,_0x4d04b5=0x0){var _0x24fe3e=_0x31fcbe[_0x28988b][_0x8ffd2e];if(_0x24fe3e['type']){_0x24fe3e[_0x8126('0x12')]=_0x24fe3e[_0x8126('0x12')][_0x8126('0x26')]();}var _0x349261=[];var _0x462fdc=[];delete _0x24fe3e['id'];delete _0x24fe3e[_0x8126('0x27')];delete _0x24fe3e['updatedAt'];var _0x304ba5=_0x24fe3e[_0x8126('0x28')]!==_0x8126('0x29')?[_0x24fe3e[_0x8126('0x28')]]:_0x24fe3e['IntervalId']?_[_0x8126('0x9')](_['filter'](_0x297981['intervals'],{'IntervalId':_0x24fe3e[_0x8126('0x8')]}),_0x8126('0x28')):[];if(_0x24fe3e[_0x8126('0xd')](_0x8126('0x2a'))){if(_0x24fe3e[_0x8126('0x2a')]&&_0x24fe3e[_0x8126('0x2a')]!=='--'){_0x349261[_0x8126('0x11')]({'type':_0x24fe3e[_0x8126('0x12')],'app':_0x8126('0x19'),'appdata':_0x8126('0x2b')+_0x24fe3e[_0x8126('0x2a')],'context':_0x24fe3e[_0x8126('0x15')],'exten':_0x24fe3e['exten'],'priority':_0x304ba5[_0x8126('0x25')]+_0x297981[_0x8126('0x16')]+_0x4d04b5++,'VoiceExtensionId':_0x24fe3e[_0x8126('0x17')]});}}if(_0x24fe3e[_0x8126('0x12')]===_0x8126('0x2c')&&_0x24fe3e['hasOwnProperty']('callerID')){if(_0x24fe3e[_0x8126('0x2d')]){_0x349261['push']({'type':_0x24fe3e[_0x8126('0x12')],'app':_0x8126('0x1d'),'appdata':_0x8126('0x2e')+_0x24fe3e[_0x8126('0x2d')]+')','context':_0x24fe3e[_0x8126('0x15')],'exten':_0x24fe3e[_0x8126('0xb')],'priority':_0x304ba5[_0x8126('0x25')]+_0x297981[_0x8126('0x16')]+_0x4d04b5++,'VoiceExtensionId':_0x24fe3e[_0x8126('0x17')]});}else{_0x349261[_0x8126('0x11')]({'type':_0x24fe3e[_0x8126('0x12')],'app':_0x8126('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x24fe3e[_0x8126('0x15')],'exten':_0x24fe3e[_0x8126('0xb')],'priority':_0x304ba5[_0x8126('0x25')]+_0x297981['priority']+_0x4d04b5++,'VoiceExtensionId':_0x24fe3e[_0x8126('0x17')]});}}if(_0x24fe3e['hasOwnProperty'](_0x8126('0x2f'))){if(_0x1d2236[_0x8126('0x30')](_0x24fe3e[_0x8126('0x31')]['toLowerCase']())>=0x0&&_0x24fe3e['appType']!==_0x8126('0x32')){if(_0x24fe3e[_0x8126('0x2f')]){_0x349261[_0x8126('0x11')]({'type':_0x24fe3e['type'],'app':_0x8126('0x1d'),'appdata':_0x8126('0x33'),'context':_0x24fe3e[_0x8126('0x15')],'exten':_0x24fe3e[_0x8126('0xb')],'priority':_0x304ba5[_0x8126('0x25')]+_0x297981[_0x8126('0x16')]+_0x4d04b5++,'VoiceExtensionId':_0x24fe3e[_0x8126('0x17')]});_0x349261[_0x8126('0x11')]({'type':_0x24fe3e[_0x8126('0x12')],'app':'Set','appdata':_0x8126('0x34'),'context':_0x24fe3e['context'],'exten':_0x24fe3e['exten'],'priority':_0x304ba5[_0x8126('0x25')]+_0x297981[_0x8126('0x16')]+_0x4d04b5++,'VoiceExtensionId':_0x24fe3e['VoiceExtensionId']});}else{_0x349261['push']({'type':_0x24fe3e[_0x8126('0x12')],'app':_0x8126('0x1d'),'appdata':_0x8126('0x35'),'context':_0x24fe3e[_0x8126('0x15')],'exten':_0x24fe3e[_0x8126('0xb')],'priority':_0x304ba5[_0x8126('0x25')]+_0x297981[_0x8126('0x16')]+_0x4d04b5++,'VoiceExtensionId':_0x24fe3e[_0x8126('0x17')]});_0x349261[_0x8126('0x11')]({'type':_0x24fe3e['type'],'app':'Set','appdata':_0x8126('0x36'),'context':_0x24fe3e[_0x8126('0x15')],'exten':_0x24fe3e['exten'],'priority':_0x304ba5[_0x8126('0x25')]+_0x297981[_0x8126('0x16')]+_0x4d04b5++,'VoiceExtensionId':_0x24fe3e[_0x8126('0x17')]});}}}for(var _0x355b6f=0x0;_0x355b6f<_0x304ba5[_0x8126('0x25')];_0x355b6f+=0x1){var _0x5dc1bd=_0x297981['priority']+_0x304ba5['length'];var _0x499a26=_0x355b6f===_0x304ba5[_0x8126('0x25')]-0x1?_0x297981[_0x8126('0x16')]+_0x349261[_0x8126('0x25')]+_0x462fdc[_0x8126('0x25')]+0x2:_0x297981[_0x8126('0x16')]+_0x355b6f+0x1;_0x349261[_0x8126('0x37')](_0x355b6f,0x0,{'type':_0x24fe3e['type'],'app':'GotoIfTime','appdata':_0x304ba5[_0x355b6f]+'?'+_0x24fe3e[_0x8126('0x15')]+',${EXTEN},'+_0x5dc1bd+':'+_0x24fe3e['context']+_0x8126('0x38')+_0x499a26,'exten':_0x24fe3e[_0x8126('0xb')],'context':_0x24fe3e[_0x8126('0x15')],'priority':_0x297981['priority']+_0x355b6f,'VoiceExtensionId':_0x31fcbe[_0x28988b][0x0][_0x8126('0x17')]});}_0x24fe3e[_0x8126('0x16')]=_0x349261['length']?_[_0x8126('0x39')](_0x349261)[_0x8126('0x16')]+0x1:_0x297981[_0x8126('0x16')];_0x297981['priority']=(_0x462fdc[_0x8126('0x25')]?_['last'](_0x462fdc)[_0x8126('0x16')]:_0x24fe3e['priority'])+0x1;_0x297981[_0x8126('0xe')]=_[_0x8126('0x3a')](_0x297981[_0x8126('0xe')],_0x349261,[_0x24fe3e],_0x462fdc);}_0x297981[_0x8126('0xe')][_0x8126('0x11')]({'type':_0x31fcbe[_0x28988b][0x0]['type'],'app':_0x8126('0x3b'),'exten':_0x31fcbe[_0x28988b][0x0][_0x8126('0xb')],'context':_0x31fcbe[_0x28988b][0x0]['context'],'priority':_0x297981[_0x8126('0x16')],'VoiceExtensionId':_0x31fcbe[_0x28988b][0x0]['VoiceExtensionId']});_0x11591f['push'](_0x31fcbe[_0x28988b][0x0]['VoiceExtensionId']);_0xc55e2e=_[_0x8126('0x3a')](_0xc55e2e,_0x297981[_0x8126('0xe')]);}}return _0x59eecc['transaction'](function(_0x580ed8){return _0x59eecc[_0x8126('0x5')]['VoiceExtension'][_0x8126('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x11591f}},'transaction':_0x580ed8})[_0x8126('0x3')](function(_0x5596c5){return _0x59eecc[_0x8126('0x5')][_0x8126('0x6')]['bulkCreate'](_[_0x8126('0x3d')](_0xc55e2e,_0x8126('0x16')),{'transaction':_0x580ed8});});});})[_0x8126('0x3e')](function(_0x3673a4){console[_0x8126('0x3f')](_0x3673a4);});}exports[_0x8126('0x40')]=rewrite; \ No newline at end of file +var _0x3a72=['outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','interval','*,*,*,*','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','rewrite','lodash','util','Interval','findAll','then','intervals','VoiceExtension','IntervalId','models','uniq','map','exten','filter','queue','playback','hasOwnProperty','priority','extension','find','extensions','push','Set','format','CDR(type)=%s','type','context','inbound','CDR(routeid)=','VoiceExtensionId','outbound','cutdigits','${EXTEN:','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix'];(function(_0x5b37f9,_0x311ec1){var _0x5945e2=function(_0x5af157){while(--_0x5af157){_0x5b37f9['push'](_0x5b37f9['shift']());}};_0x5945e2(++_0x311ec1);}(_0x3a72,0x12c));var _0x23a7=function(_0x4f283c,_0x5db666){_0x4f283c=_0x4f283c-0x0;var _0xd26777=_0x3a72[_0x4f283c];return _0xd26777;};'use strict';var _=require(_0x23a7('0x0'));var util=require(_0x23a7('0x1'));function rewrite(_0x21ea4a,_0x2e2e78){var _0x3791ef=this;return _0x21ea4a['models'][_0x23a7('0x2')][_0x23a7('0x3')]({'raw':!![]})[_0x23a7('0x4')](function(_0x5cad04){_0x3791ef[_0x23a7('0x5')]=_0x5cad04;return _0x21ea4a['models'][_0x23a7('0x6')][_0x23a7('0x3')]({'where':{'IntervalId':_0x2e2e78[_0x23a7('0x7')]},'raw':!![]});})[_0x23a7('0x4')](function(_0xeacd13){return _0x21ea4a[_0x23a7('0x8')][_0x23a7('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x23a7('0x9')](_[_0x23a7('0xa')](_0xeacd13,_0x23a7('0xb')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x23a7('0x4')](function(_0x1758dd){var _0x1d41ce=_[_0x23a7('0xc')](_0x1758dd,{'priority':'1'});var _0x1afc86=_[_0x23a7('0xc')](_0x1758dd,{'isApp':0x1});var _0x45d0e0=_['groupBy'](_0x1afc86,'exten');var _0x48a163=[_0x23a7('0xd'),_0x23a7('0xe')];var _0x4ee0fa=[];var _0x1df1d0=[];for(var _0xa71be6 in _0x45d0e0){if(_0x45d0e0[_0x23a7('0xf')](_0xa71be6)){_0x3791ef[_0x23a7('0x10')]=0x2;_0x3791ef['extensions']=[];_0x3791ef[_0x23a7('0x11')]=_[_0x23a7('0x12')](_0x1d41ce,{'exten':_0x45d0e0[_0xa71be6][0x0]['exten']});_0x3791ef[_0x23a7('0x13')][_0x23a7('0x14')]({'type':_0x45d0e0[_0xa71be6][0x0]['type'],'app':_0x23a7('0x15'),'appdata':util[_0x23a7('0x16')](_0x23a7('0x17'),_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x18')]),'context':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x19')],'exten':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0xb')],'priority':_0x3791ef['priority']++,'VoiceExtensionId':_0x45d0e0[_0xa71be6][0x0]['VoiceExtensionId']});if(_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x18')]===_0x23a7('0x1a')){_0x3791ef['extensions'][_0x23a7('0x14')]({'type':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x18')],'app':_0x23a7('0x15'),'appdata':_0x23a7('0x1b')+_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x1c')],'context':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x19')],'exten':_0x45d0e0[_0xa71be6][0x0]['exten'],'priority':_0x3791ef[_0x23a7('0x10')]++,'VoiceExtensionId':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x1c')]});}else if(_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x18')]===_0x23a7('0x1d')){if(_0x3791ef[_0x23a7('0x11')]){_0x3791ef['extensions']['push']({'type':_0x45d0e0[_0xa71be6][0x0]['type'],'app':_0x23a7('0x15'),'appdata':'CDR(destination)='+(_0x3791ef[_0x23a7('0x11')][_0x23a7('0x1e')]?_0x23a7('0x1f')+_0x3791ef[_0x23a7('0x11')][_0x23a7('0x1e')]+'}':'${EXTEN}'),'context':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x19')],'exten':_0x45d0e0[_0xa71be6][0x0]['exten'],'priority':_0x3791ef[_0x23a7('0x10')]++,'VoiceExtensionId':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x1c')]});}_0x3791ef[_0x23a7('0x13')][_0x23a7('0x14')]({'type':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x18')],'app':_0x23a7('0x15'),'appdata':'CDR(routeid)='+_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x1c')],'context':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x19')],'exten':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0xb')],'priority':_0x3791ef[_0x23a7('0x10')]++,'VoiceExtensionId':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x1c')]});var _0x3b68e3=_0x3791ef[_0x23a7('0x10')]++;_0x3791ef[_0x23a7('0x13')][_0x23a7('0x14')]({'type':_0x45d0e0[_0xa71be6][0x0]['type'],'app':'ExecIf','appdata':_0x23a7('0x20')+(_0x3b68e3+0x2)+'):Goto('+(_0x3b68e3+0x1)+')','context':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x19')],'exten':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0xb')],'priority':_0x3b68e3,'VoiceExtensionId':_0x45d0e0[_0xa71be6][0x0]['VoiceExtensionId']});if(_0x3791ef[_0x23a7('0x11')]){_0x3791ef[_0x23a7('0x13')]['push']({'type':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x18')],'app':'Set','appdata':_0x3791ef['extension'][_0x23a7('0x1e')]?_0x23a7('0x21')+_0x3791ef[_0x23a7('0x11')][_0x23a7('0x1e')]+'}':_0x23a7('0x22'),'context':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x19')],'exten':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0xb')],'priority':_0x3791ef[_0x23a7('0x10')]++,'VoiceExtensionId':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x1c')]});}_0x3791ef[_0x23a7('0x13')][_0x23a7('0x14')]({'type':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x18')],'app':_0x23a7('0x15'),'appdata':_0x23a7('0x23')+_0x45d0e0[_0xa71be6][0x0]['VoiceExtensionId'],'context':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x19')],'exten':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0xb')],'priority':_0x3791ef['priority']++,'VoiceExtensionId':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x1c')]});if(_0x3791ef['extension']&&_0x3791ef[_0x23a7('0x11')][_0x23a7('0xf')]('recordingFormat')&&_0x3791ef[_0x23a7('0x11')][_0x23a7('0x24')]!=='none'){_0x3791ef[_0x23a7('0x13')][_0x23a7('0x14')]({'type':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x18')],'app':'Set','appdata':_0x23a7('0x25'),'context':_0x45d0e0[_0xa71be6][0x0]['context'],'exten':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0xb')],'priority':_0x3791ef[_0x23a7('0x10')]++,'VoiceExtensionId':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x1c')]});_0x3791ef['extensions'][_0x23a7('0x14')]({'type':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x18')],'app':_0x23a7('0x15'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3791ef['extension'][_0x23a7('0x24')]||_0x23a7('0x26'),'context':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x19')],'exten':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0xb')],'priority':_0x3791ef[_0x23a7('0x10')]++,'VoiceExtensionId':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x1c')]});}}_0x3791ef[_0x23a7('0x13')][_0x23a7('0x14')]({'type':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x18')],'app':_0x23a7('0x15'),'appdata':_0x23a7('0x27'),'context':_0x45d0e0[_0xa71be6][0x0]['context'],'exten':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0xb')],'priority':_0x3791ef[_0x23a7('0x10')]++,'VoiceExtensionId':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x1c')]});_0x3791ef[_0x23a7('0x13')][_0x23a7('0x14')]({'type':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x18')],'app':_0x23a7('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x19')],'exten':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0xb')],'priority':_0x3791ef[_0x23a7('0x10')]++,'VoiceExtensionId':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x1c')]});_0x3791ef[_0x23a7('0x13')]['push']({'type':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x18')],'app':'Set','appdata':_0x23a7('0x28'),'context':_0x45d0e0[_0xa71be6][0x0]['context'],'exten':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0xb')],'priority':_0x3791ef['priority']++,'VoiceExtensionId':_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x1c')]});for(var _0x10a5d6=0x0,_0x1daebc=0x0;_0x10a5d6<_0x45d0e0[_0xa71be6][_0x23a7('0x29')];_0x10a5d6+=0x1,_0x1daebc=0x0){var _0x1577aa=_0x45d0e0[_0xa71be6][_0x10a5d6];if(_0x1577aa[_0x23a7('0x18')]){_0x1577aa[_0x23a7('0x18')]=_0x1577aa[_0x23a7('0x18')][_0x23a7('0x2a')]();}var _0x3c24f0=[];var _0x3f3850=[];delete _0x1577aa['id'];delete _0x1577aa['createdAt'];delete _0x1577aa['updatedAt'];var _0x51273c=_0x1577aa[_0x23a7('0x2b')]!==_0x23a7('0x2c')?[_0x1577aa[_0x23a7('0x2b')]]:_0x1577aa['IntervalId']?_[_0x23a7('0xa')](_[_0x23a7('0xc')](_0x3791ef[_0x23a7('0x5')],{'IntervalId':_0x1577aa[_0x23a7('0x7')]}),_0x23a7('0x2b')):[];if(_0x1577aa[_0x23a7('0xf')](_0x23a7('0x2d'))){if(_0x1577aa['tag']&&_0x1577aa['tag']!=='--'){_0x3c24f0[_0x23a7('0x14')]({'type':_0x1577aa[_0x23a7('0x18')],'app':'Set','appdata':'CDR(tag)='+_0x1577aa[_0x23a7('0x2d')],'context':_0x1577aa[_0x23a7('0x19')],'exten':_0x1577aa[_0x23a7('0xb')],'priority':_0x51273c[_0x23a7('0x29')]+_0x3791ef[_0x23a7('0x10')]+_0x1daebc++,'VoiceExtensionId':_0x1577aa[_0x23a7('0x1c')]});}}if(_0x1577aa[_0x23a7('0x18')]===_0x23a7('0x1d')&&_0x1577aa[_0x23a7('0xf')](_0x23a7('0x2e'))){if(_0x1577aa[_0x23a7('0x2e')]){_0x3c24f0[_0x23a7('0x14')]({'type':_0x1577aa['type'],'app':'ExecIf','appdata':_0x23a7('0x2f')+_0x1577aa[_0x23a7('0x2e')]+')','context':_0x1577aa[_0x23a7('0x19')],'exten':_0x1577aa[_0x23a7('0xb')],'priority':_0x51273c[_0x23a7('0x29')]+_0x3791ef['priority']+_0x1daebc++,'VoiceExtensionId':_0x1577aa[_0x23a7('0x1c')]});}else{_0x3c24f0['push']({'type':_0x1577aa[_0x23a7('0x18')],'app':_0x23a7('0x30'),'appdata':_0x23a7('0x31'),'context':_0x1577aa[_0x23a7('0x19')],'exten':_0x1577aa[_0x23a7('0xb')],'priority':_0x51273c[_0x23a7('0x29')]+_0x3791ef[_0x23a7('0x10')]+_0x1daebc++,'VoiceExtensionId':_0x1577aa['VoiceExtensionId']});}}if(_0x1577aa[_0x23a7('0xf')]('answer')){if(_0x48a163[_0x23a7('0x32')](_0x1577aa['app']['toLowerCase']())>=0x0&&_0x1577aa[_0x23a7('0x33')]!=='custom'){if(_0x1577aa[_0x23a7('0x34')]){_0x3c24f0[_0x23a7('0x14')]({'type':_0x1577aa[_0x23a7('0x18')],'app':_0x23a7('0x30'),'appdata':_0x23a7('0x35'),'context':_0x1577aa[_0x23a7('0x19')],'exten':_0x1577aa[_0x23a7('0xb')],'priority':_0x51273c[_0x23a7('0x29')]+_0x3791ef['priority']+_0x1daebc++,'VoiceExtensionId':_0x1577aa[_0x23a7('0x1c')]});_0x3c24f0[_0x23a7('0x14')]({'type':_0x1577aa[_0x23a7('0x18')],'app':_0x23a7('0x15'),'appdata':_0x23a7('0x36'),'context':_0x1577aa[_0x23a7('0x19')],'exten':_0x1577aa[_0x23a7('0xb')],'priority':_0x51273c['length']+_0x3791ef['priority']+_0x1daebc++,'VoiceExtensionId':_0x1577aa[_0x23a7('0x1c')]});}else{_0x3c24f0[_0x23a7('0x14')]({'type':_0x1577aa['type'],'app':_0x23a7('0x30'),'appdata':_0x23a7('0x37'),'context':_0x1577aa[_0x23a7('0x19')],'exten':_0x1577aa[_0x23a7('0xb')],'priority':_0x51273c[_0x23a7('0x29')]+_0x3791ef[_0x23a7('0x10')]+_0x1daebc++,'VoiceExtensionId':_0x1577aa[_0x23a7('0x1c')]});_0x3c24f0['push']({'type':_0x1577aa[_0x23a7('0x18')],'app':'Set','appdata':_0x23a7('0x38'),'context':_0x1577aa[_0x23a7('0x19')],'exten':_0x1577aa[_0x23a7('0xb')],'priority':_0x51273c[_0x23a7('0x29')]+_0x3791ef['priority']+_0x1daebc++,'VoiceExtensionId':_0x1577aa['VoiceExtensionId']});}}}for(var _0x320483=0x0;_0x320483<_0x51273c[_0x23a7('0x29')];_0x320483+=0x1){var _0x8743ea=_0x3791ef[_0x23a7('0x10')]+_0x51273c[_0x23a7('0x29')];var _0x27c0da=_0x320483===_0x51273c[_0x23a7('0x29')]-0x1?_0x3791ef[_0x23a7('0x10')]+_0x3c24f0[_0x23a7('0x29')]+_0x3f3850['length']+0x2:_0x3791ef[_0x23a7('0x10')]+_0x320483+0x1;_0x3c24f0[_0x23a7('0x39')](_0x320483,0x0,{'type':_0x1577aa[_0x23a7('0x18')],'app':'GotoIfTime','appdata':_0x51273c[_0x320483]+'?'+_0x1577aa['context']+_0x23a7('0x3a')+_0x8743ea+':'+_0x1577aa['context']+_0x23a7('0x3a')+_0x27c0da,'exten':_0x1577aa[_0x23a7('0xb')],'context':_0x1577aa[_0x23a7('0x19')],'priority':_0x3791ef[_0x23a7('0x10')]+_0x320483,'VoiceExtensionId':_0x45d0e0[_0xa71be6][0x0]['VoiceExtensionId']});}_0x1577aa['priority']=_0x3c24f0['length']?_[_0x23a7('0x3b')](_0x3c24f0)['priority']+0x1:_0x3791ef[_0x23a7('0x10')];_0x3791ef[_0x23a7('0x10')]=(_0x3f3850[_0x23a7('0x29')]?_[_0x23a7('0x3b')](_0x3f3850)[_0x23a7('0x10')]:_0x1577aa['priority'])+0x1;_0x3791ef['extensions']=_[_0x23a7('0x3c')](_0x3791ef[_0x23a7('0x13')],_0x3c24f0,[_0x1577aa],_0x3f3850);}_0x3791ef[_0x23a7('0x13')][_0x23a7('0x14')]({'type':_0x45d0e0[_0xa71be6][0x0]['type'],'app':_0x23a7('0x3d'),'exten':_0x45d0e0[_0xa71be6][0x0]['exten'],'context':_0x45d0e0[_0xa71be6][0x0]['context'],'priority':_0x3791ef[_0x23a7('0x10')],'VoiceExtensionId':_0x45d0e0[_0xa71be6][0x0]['VoiceExtensionId']});_0x4ee0fa['push'](_0x45d0e0[_0xa71be6][0x0][_0x23a7('0x1c')]);_0x1df1d0=_[_0x23a7('0x3c')](_0x1df1d0,_0x3791ef[_0x23a7('0x13')]);}}return _0x21ea4a[_0x23a7('0x3e')](function(_0x44678b){return _0x21ea4a[_0x23a7('0x8')][_0x23a7('0x6')][_0x23a7('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x4ee0fa}},'transaction':_0x44678b})['then'](function(_0xbbe6c5){return _0x21ea4a[_0x23a7('0x8')]['VoiceExtension'][_0x23a7('0x40')](_['sortBy'](_0x1df1d0,'priority'),{'transaction':_0x44678b});});});})[_0x23a7('0x41')](function(_0x2dd191){console['error'](_0x2dd191);});}exports[_0x23a7('0x42')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 44003e1..5df5d1d 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 _0xe63d=['ContactId','createdAt','updatedAt','select','field','phone','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','\x20=\x20?','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','insert','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','all','onlyIfOpen','CampaignId','Campaign','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','stringify','finally','emit','contact:csv_','unlinkSync','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','length','find','Duplicate\x20Contact','CmContact','create','then','push','catch','cmContact','inspect','into','cm_hopper','scheduledAt'];(function(_0x3bc537,_0x4ac5e7){var _0x2da5fc=function(_0x15aa49){while(--_0x15aa49){_0x3bc537['push'](_0x3bc537['shift']());}};_0x2da5fc(++_0x4ac5e7);}(_0xe63d,0x1c9));var _0xde63=function(_0x817388,_0x58547f){_0x817388=_0x817388-0x0;var _0x12d106=_0xe63d[_0x817388];return _0x12d106;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0xde63('0x0'));var Papa=require(_0xde63('0x1'));var Redis=require('ioredis');var db=require(_0xde63('0x2'))['db'];var config=require(_0xde63('0x3'));var logger=require(_0xde63('0x4'))(_0xde63('0x5'));config[_0xde63('0x6')]=_[_0xde63('0x7')](config[_0xde63('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xde63('0x8'))(new Redis(config[_0xde63('0x6')]));require(_0xde63('0x9'))['register'](socket);try{if(!process[_0xde63('0xa')][0x2]||process['argv'][0x2]===_0xde63('0xb')||process[_0xde63('0xa')][0x2]===_0xde63('0xc')){throw new Error(_0xde63('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0xde63('0xa')][0x3]||process[_0xde63('0xa')][0x3]===_0xde63('0xb')||process[_0xde63('0xa')][0x3]==='null'||!process[_0xde63('0xa')][0x4]||process[_0xde63('0xa')][0x4]===_0xde63('0xb')||process[_0xde63('0xa')][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xde63('0xe')](process[_0xde63('0xa')][0x3]['split'](','),process[_0xde63('0xa')][0x4][_0xde63('0xf')](','));if(!process[_0xde63('0xa')][0x5]||process[_0xde63('0xa')][0x5]===_0xde63('0xb')||process[_0xde63('0xa')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xde63('0xa')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xde63('0xa')][0x6]!==_0xde63('0xb')&&process[_0xde63('0xa')][0x6]!=='null'?process[_0xde63('0xa')][0x6]:null;var DUPLICATES=process[_0xde63('0xa')][0x7]&&process['argv'][0x7]!==_0xde63('0xb')&&process[_0xde63('0xa')][0x7]!=='null'?process[_0xde63('0xa')][0x7]:null;if(!process['argv'][0x8]||process[_0xde63('0xa')][0x8]===_0xde63('0xb')||process[_0xde63('0xa')][0x8]==='null'){throw new Error(_0xde63('0x10'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x3cde35){logger[_0xde63('0x11')](_0x3cde35);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(_0x4af7fc,_0x4f4840,_0x31fc62,_0x100357){var _0x14a64b={'message':_0x4f4840};_0x14a64b[_0x4af7fc]=!![];if(_0x31fc62){_0x14a64b[_0xde63('0x12')]=_0x31fc62;}if(_0x100357){_0x14a64b[_0xde63('0x13')]=_0x100357;}return _0x14a64b;}function isEmail(_0x3771cf){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x3771cf);}function checkRow(_0x4abc2b,_0x1be1d5,_0x4f1c52){return new BPromise(function(_0x4f8e93,_0x90bafd){if(_[_0xde63('0x14')](_0x4abc2b)){return _0x90bafd(handleCheckRowError(_0xde63('0x11'),_0xde63('0x15'),null,_0x4f1c52));}if(_0x4abc2b[_0xde63('0x16')]&&_0x4abc2b[_0xde63('0x16')]['length']){var _0x59da8a=_[_0xde63('0x17')](_0x4abc2b['errors'],_0xde63('0x18'))[_0xde63('0x19')](';');return _0x90bafd(handleCheckRowError(_0xde63('0x11'),_0x59da8a,null,_0x4f1c52));}var _0x3791df={};for(var _0x29ffa5 in FIELDS){if(FIELDS[_0xde63('0x1a')](_0x29ffa5)&&FIELDS[_0x29ffa5]){_0x3791df[_0x29ffa5]=_0x4abc2b[_0xde63('0x1b')][0x0][FIELDS[_0x29ffa5]]||_0x4abc2b[_0xde63('0x1b')][0x0]['\ufeff'+FIELDS[_0x29ffa5]];}}if(!_0x3791df[_0xde63('0x1c')]){return _0x90bafd(handleCheckRowError('error',_0xde63('0x1d'),null,_0x4f1c52));}if(!_0x3791df['phone']){return _0x90bafd(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x4f1c52));}if(_0x3791df[_0xde63('0x1e')]){var _0xc5072d=moment(_0x3791df[_0xde63('0x1e')],_0xde63('0x1f'));if(!_0xc5072d['isValid']()){return _0x90bafd(handleCheckRowError('error',_0xde63('0x20'),null,_0x4f1c52));}}if(_0x3791df[_0xde63('0x21')]){if(!isEmail(_0x3791df[_0xde63('0x21')])){return _0x90bafd(handleCheckRowError(_0xde63('0x11'),'email\x20format\x20is\x20not\x20valid!',null,_0x4f1c52));}}_0x3791df[_0xde63('0x22')]=LISTID;_0x3791df['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xde63('0x23')]&&_0x1be1d5){var _0x4db4cc={};for(var _0x1c367b=0x0,_0x1a4f52=DUPLICATES[_0xde63('0x23')];_0x1c367b<_0x1a4f52;_0x1c367b+=0x1){_0x4db4cc[DUPLICATES[_0x1c367b]]=_0x3791df[DUPLICATES[_0x1c367b]];}var _0x34c254=_[_0xde63('0x24')](_0x1be1d5,_0x4db4cc);if(_0x34c254){return _0x90bafd(handleCheckRowError('duplicate',_0xde63('0x25'),_0x34c254,_0x4f1c52));}}return db[_0xde63('0x26')][_0xde63('0x27')](_0x3791df,{'raw':!![],'hooks':![],'fields':_['keys'](_0x3791df)})[_0xde63('0x28')](function(_0x4059bc){if(DUPLICATES&&DUPLICATES[_0xde63('0x23')]&&_0x1be1d5){_0x1be1d5[_0xde63('0x29')](_['pick'](_0x3791df,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4059bc['id'];return _0x4f8e93();})[_0xde63('0x2a')](function(_0x3f9d0d){return _0x90bafd(handleCheckRowError(_0xde63('0x11'),'Error\x20while\x20creating\x20contact:\x20'+(_0x3f9d0d[_0xde63('0x18')]||JSON['stringify'](_0x3f9d0d)),null,_0x4f1c52));});});}function checkHopper(){function _0x5921ea(){return function(_0x9438ad){logger[_0xde63('0x11')](_0xde63('0x2b'),'checkHopper',util[_0xde63('0x2c')](_0x9438ad,{'showHidden':![],'depth':null}));};}var _0x1450b4=function(_0x5f22c9,_0x1703a7){var _0xf920=squel['insert']()[_0xde63('0x2d')](_0xde63('0x2e'))['fromQuery'](['phone',_0xde63('0x2f'),_0xde63('0x30'),'ListId',_0x1703a7,_0xde63('0x31'),_0xde63('0x32')],squel[_0xde63('0x33')]()[_0xde63('0x34')](_0xde63('0x35'),_0xde63('0x35'))['field'](_0xde63('0x36'),_0xde63('0x2f'))[_0xde63('0x34')]('id','ContactId')['field'](LISTID[_0xde63('0x37')](),'ListId')['field'](_0x5f22c9['id'][_0xde63('0x37')](),_0x1703a7)['field'](_0xde63('0x36'),'createdAt')[_0xde63('0x34')](_0xde63('0x36'),_0xde63('0x32'))[_0xde63('0x38')]('cm_contacts')[_0xde63('0x39')](_0xde63('0x3a'))['where'](_0xde63('0x3b'),LISTID[_0xde63('0x37')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xde63('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0xde63('0x33')]()[_0xde63('0x34')](_0xde63('0x35'))[_0xde63('0x38')](_0xde63('0x2e'))[_0xde63('0x39')](_0x1703a7+_0xde63('0x3c'),_0x5f22c9['id']['toString']())))['toString']();return _0xf920;};var _0x26cb17=function(_0x3ee71f,_0x504db8){var _0xf3ac1c=squel['insert']()[_0xde63('0x2d')](_0xde63('0x2e'))[_0xde63('0x3d')]([_0xde63('0x35'),_0xde63('0x2f'),_0xde63('0x30'),_0xde63('0x22'),_0x504db8,_0xde63('0x31'),_0xde63('0x32')],squel['select']()['field']('phone',_0xde63('0x35'))[_0xde63('0x34')](_0xde63('0x36'),'scheduledAt')[_0xde63('0x34')]('id','ContactId')[_0xde63('0x34')](LISTID['toString'](),_0xde63('0x22'))[_0xde63('0x34')](_0x3ee71f['id'][_0xde63('0x37')](),_0x504db8)['field'](_0xde63('0x36'),_0xde63('0x31'))[_0xde63('0x34')]('NOW()','updatedAt')[_0xde63('0x38')]('cm_contacts')[_0xde63('0x39')]('deletedAt\x20IS\x20NULL')[_0xde63('0x39')](_0xde63('0x3b'),LISTID[_0xde63('0x37')]())[_0xde63('0x39')](_0xde63('0x3e'),squel[_0xde63('0x3f')](hopperContacts))['where'](_0xde63('0x40'))[_0xde63('0x39')](_0xde63('0x41'),squel[_0xde63('0x33')]()[_0xde63('0x34')](_0xde63('0x42'))[_0xde63('0x38')](_0xde63('0x43'))['where'](_0x504db8+'\x20=\x20?',_0x3ee71f['id'][_0xde63('0x37')]()))[_0xde63('0x39')](_0xde63('0x41'),squel[_0xde63('0x33')]()[_0xde63('0x34')]('phone')[_0xde63('0x38')](_0xde63('0x2e'))[_0xde63('0x39')](_0x504db8+_0xde63('0x3c'),_0x3ee71f['id'][_0xde63('0x37')]())))[_0xde63('0x37')]();return _0xf3ac1c;};function _0x46049b(_0xd093cc,_0xde781d){var _0x5dd2aa=squel[_0xde63('0x44')]()['into'](_0xde63('0x2e'))[_0xde63('0x3d')]([_0xde63('0x35'),'scheduledAt','ContactId',_0xde63('0x22'),_0xde781d,_0xde63('0x31'),_0xde63('0x32')],squel[_0xde63('0x33')]()[_0xde63('0x34')](_0xde63('0x35'),'phone')[_0xde63('0x34')](_0xde63('0x36'),_0xde63('0x2f'))['field']('id','ContactId')[_0xde63('0x34')](LISTID[_0xde63('0x37')](),'ListId')[_0xde63('0x34')](_0xd093cc['id'][_0xde63('0x37')](),_0xde781d)[_0xde63('0x34')]('NOW()',_0xde63('0x31'))[_0xde63('0x34')](_0xde63('0x36'),_0xde63('0x32'))[_0xde63('0x38')]('cm_contacts')[_0xde63('0x39')](_0xde63('0x3a'))[_0xde63('0x39')](_0xde63('0x3b'),LISTID[_0xde63('0x37')]())[_0xde63('0x39')](_0xde63('0x3e'),squel['str'](hopperContacts))[_0xde63('0x39')](_0xde63('0x40')))['toString']();return _0x5dd2aa;}function _0x4c0325(_0x502c71,_0xd56366){var _0xb0acce=squel[_0xde63('0x44')]()[_0xde63('0x2d')]('cm_hopper_black')[_0xde63('0x3d')]([_0xde63('0x35'),_0xde63('0x30'),'ListId',_0xd56366,_0xde63('0x31'),_0xde63('0x32')],squel[_0xde63('0x33')]()[_0xde63('0x34')]('phone',_0xde63('0x35'))['field']('id',_0xde63('0x30'))[_0xde63('0x34')](LISTID[_0xde63('0x37')](),_0xde63('0x22'))[_0xde63('0x34')](_0x502c71['id'][_0xde63('0x37')](),_0xd56366)[_0xde63('0x34')](_0xde63('0x36'),'createdAt')[_0xde63('0x34')](_0xde63('0x36'),_0xde63('0x32'))[_0xde63('0x38')]('cm_contacts')[_0xde63('0x39')](_0xde63('0x3a'))[_0xde63('0x39')](_0xde63('0x3b'),LISTID[_0xde63('0x37')]())[_0xde63('0x39')]('id\x20IN\x20?',squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xde63('0x37')]();return _0xb0acce;}return db[_0xde63('0x45')][_0xde63('0x46')]({'where':{'type':_0xde63('0x47')},'attributes':['id',_0xde63('0x48')],'include':[{'model':db[_0xde63('0x49')],'as':_0xde63('0x4a'),'where':{'id':LISTID}}]})[_0xde63('0x28')](function(_0x1d7789){var _0x4fbac6=[];if(_0x1d7789){var _0x4d7aac;for(var _0xb9e3f=0x0,_0xc40dba;_0xb9e3f<_0x1d7789[_0xde63('0x23')];_0xb9e3f+=0x1){_0xc40dba=_0x1d7789[_0xb9e3f][_0xde63('0x4b')]({'plain':!![]});switch(_0xc40dba[_0xde63('0x48')]){case _0xde63('0x4c'):_0x4fbac6[_0xde63('0x29')](db[_0xde63('0x4d')][_0xde63('0x4e')](_0x26cb17(_0xc40dba,_0xde63('0x4f')))[_0xde63('0x28')](function(){})['catch'](_0x5921ea()));break;case'onlyIfOpen':_0x4fbac6[_0xde63('0x29')](db[_0xde63('0x4d')]['query'](_0x1450b4(_0xc40dba,_0xde63('0x4f')))[_0xde63('0x28')](function(){})[_0xde63('0x2a')](_0x5921ea()));break;default:_0x4fbac6[_0xde63('0x29')](db[_0xde63('0x4d')][_0xde63('0x4e')](_0x46049b(_0xc40dba,_0xde63('0x4f')))[_0xde63('0x28')](function(){})[_0xde63('0x2a')](_0x5921ea()));}}}return _0x4fbac6;})[_0xde63('0x50')]()[_0xde63('0x28')](function(){return db[_0xde63('0x45')][_0xde63('0x46')]({'where':{'type':_0xde63('0x47')},'attributes':['id'],'include':[{'model':db[_0xde63('0x49')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xde63('0x28')](function(_0x7dee75){var _0x4d4029=[];if(_0x7dee75){var _0x480b1b;for(var _0x3749bf=0x0,_0x54cb15;_0x3749bf<_0x7dee75[_0xde63('0x23')];_0x3749bf+=0x1){_0x54cb15=_0x7dee75[_0x3749bf]['get']({'plain':!![]});_0x4d4029[_0xde63('0x29')](db[_0xde63('0x4d')][_0xde63('0x4e')](_0x4c0325(_0x54cb15,_0xde63('0x4f')))[_0xde63('0x28')](function(){})[_0xde63('0x2a')](_0x5921ea()));}}return _0x4d4029;})['all']();})[_0xde63('0x28')](function(){return db['Campaign'][_0xde63('0x46')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xde63('0x49')],'as':_0xde63('0x4a'),'where':{'id':LISTID}}]})[_0xde63('0x28')](function(_0x555b07){var _0x52ea2c=[];if(_0x555b07){for(var _0x255e83=0x0,_0x503efa;_0x255e83<_0x555b07['length'];_0x255e83+=0x1){_0x503efa=_0x555b07[_0x255e83]['get']({'plain':!![]});switch(_0x503efa[_0xde63('0x48')]){case _0xde63('0x4c'):_0x52ea2c[_0xde63('0x29')](db['sequelize'][_0xde63('0x4e')](_0x26cb17(_0x503efa,'CampaignId'))['then'](function(){})[_0xde63('0x2a')](_0x5921ea()));break;case _0xde63('0x51'):_0x52ea2c[_0xde63('0x29')](db['sequelize'][_0xde63('0x4e')](_0x1450b4(_0x503efa,_0xde63('0x52')))[_0xde63('0x28')](function(){})['catch'](_0x5921ea()));break;default:_0x52ea2c[_0xde63('0x29')](db[_0xde63('0x4d')][_0xde63('0x4e')](_0x46049b(_0x503efa,_0xde63('0x52')))[_0xde63('0x28')](function(){})[_0xde63('0x2a')](_0x5921ea()));}}}return _0x52ea2c;})[_0xde63('0x50')]();})[_0xde63('0x28')](function(){return db[_0xde63('0x53')][_0xde63('0x46')]({'attributes':['id'],'include':[{'model':db[_0xde63('0x49')],'as':_0xde63('0x54'),'where':{'id':LISTID}}]})[_0xde63('0x28')](function(_0x1504d7){var _0x7d22a5=[];if(_0x1504d7){for(var _0x3a1ff9=0x0,_0x3a7986;_0x3a1ff9<_0x1504d7[_0xde63('0x23')];_0x3a1ff9+=0x1){_0x3a7986=_0x1504d7[_0x3a1ff9]['get']({'plain':!![]});_0x7d22a5[_0xde63('0x29')](db['sequelize'][_0xde63('0x4e')](_0x4c0325(_0x3a7986,_0xde63('0x52')))[_0xde63('0x28')](function(){})['catch'](_0x5921ea()));}}return _0x7d22a5;})[_0xde63('0x50')]();})['catch'](function(_0x22d5e4){logger[_0xde63('0x11')](_0xde63('0x55'),_0xde63('0x56'),_0x22d5e4[_0xde63('0x18')]);});}var processPromises=function(_0x565adc){return BPromise['all'](promises)[_0xde63('0x28')](function(_0x52d74b){})['catch'](function(_0x2fd959){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0xde63('0x57')](_0x2fd959));})[_0xde63('0x58')](function(){socket[_0xde63('0x59')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x565adc){return _0x565adc['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xde63('0x28')](function(){socket[_0xde63('0x59')](_0xde63('0x5a')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xde63('0x5b')](FILEPATH);}catch(_0x4e6f07){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xde63('0x57')](_0x4e6f07));}finally{process[_0xde63('0x5c')](0x0);}});};process['on']('SIGINT',function(){logger[_0xde63('0x5d')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0xde63('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xde63('0xf')](',');return db[_0xde63('0x26')][_0xde63('0x46')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xde63('0x28')](function(_0x497096){var _0x3e601a=fs[_0xde63('0x5e')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xde63('0x5f')](_0x3e601a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x106139,_0x130070){total+=0x1;var _0x153f54=total;promises[_0xde63('0x29')](checkRow(_0x106139,_0x497096,_0x153f54)[_0xde63('0x28')](function(){success+=0x1;})[_0xde63('0x2a')](function(_0x157e36){if(_0x157e36[_0xde63('0x11')]){errors+=0x1;delete _0x157e36[_0xde63('0x11')];}else if(_0x157e36[_0xde63('0x60')]){duplicates+=0x1;delete _0x157e36[_0xde63('0x60')];}rows[_0xde63('0x29')](_0x157e36);}));if(total%0xc8===0x0){_0x130070[_0xde63('0x61')]();return processPromises(_0x130070);}},'complete':function(){return processPromises()[_0xde63('0x28')](function(){logger[_0xde63('0x5d')](_0xde63('0x62'));endCsv();});},'error':function(_0x15fef0,_0xf1199a){logger[_0xde63('0x5d')](_0xde63('0x63'),JSON[_0xde63('0x57')](_0x15fef0));endCsv();}});})[_0xde63('0x2a')](function(_0x55b331){logger[_0xde63('0x11')](_0xde63('0x64'),JSON[_0xde63('0x57')](_0x55b331));});}main(); \ No newline at end of file +var _0xd66b=['../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20socket_timestamp\x20parameter!','error','contact','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','\x20=\x20?','insert','ListId','from','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','phone\x20IS\x20NOT\x20NULL','cm_hopper_black','VoiceQueue','dialCheckDuplicateType','CmList','Lists','get','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','ioredis'];(function(_0x4920f2,_0xa4bfbf){var _0x1f27cf=function(_0x4d94ad){while(--_0x4d94ad){_0x4920f2['push'](_0x4920f2['shift']());}};_0x1f27cf(++_0xa4bfbf);}(_0xd66b,0x6a));var _0xbd66=function(_0x37bd36,_0x55f720){_0x37bd36=_0x37bd36-0x0;var _0x483d61=_0xd66b[_0x37bd36];return _0x483d61;};'use strict';var BPromise=require(_0xbd66('0x0'));var util=require(_0xbd66('0x1'));var _=require(_0xbd66('0x2'));var fs=require('fs');var squel=require(_0xbd66('0x3'));var Papa=require('papaparse');var Redis=require(_0xbd66('0x4'));var db=require(_0xbd66('0x5'))['db'];var config=require(_0xbd66('0x6'));var logger=require(_0xbd66('0x7'))(_0xbd66('0x8'));config[_0xbd66('0x9')]=_[_0xbd66('0xa')](config[_0xbd66('0x9')],{'host':_0xbd66('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd66('0x9')]));require(_0xbd66('0xc'))[_0xbd66('0xd')](socket);try{if(!process[_0xbd66('0xe')][0x2]||process[_0xbd66('0xe')][0x2]===_0xbd66('0xf')||process[_0xbd66('0xe')][0x2]===_0xbd66('0x10')){throw new Error(_0xbd66('0x11'));}var FILEPATH=process[_0xbd66('0xe')][0x2];if(!process['argv'][0x3]||process[_0xbd66('0xe')][0x3]===_0xbd66('0xf')||process[_0xbd66('0xe')][0x3]===_0xbd66('0x10')||!process[_0xbd66('0xe')][0x4]||process[_0xbd66('0xe')][0x4]===_0xbd66('0xf')||process['argv'][0x4]===_0xbd66('0x10')){throw new Error(_0xbd66('0x12'));}var FIELDS=_['zipObject'](process[_0xbd66('0xe')][0x3][_0xbd66('0x13')](','),process[_0xbd66('0xe')][0x4][_0xbd66('0x13')](','));if(!process[_0xbd66('0xe')][0x5]||process['argv'][0x5]===_0xbd66('0xf')||process['argv'][0x5]===_0xbd66('0x10')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xbd66('0xe')][0x5];var COMPANYID=process[_0xbd66('0xe')][0x6]&&process[_0xbd66('0xe')][0x6]!==_0xbd66('0xf')&&process[_0xbd66('0xe')][0x6]!=='null'?process[_0xbd66('0xe')][0x6]:null;var DUPLICATES=process[_0xbd66('0xe')][0x7]&&process[_0xbd66('0xe')][0x7]!==_0xbd66('0xf')&&process[_0xbd66('0xe')][0x7]!==_0xbd66('0x10')?process[_0xbd66('0xe')][0x7]:null;if(!process[_0xbd66('0xe')][0x8]||process[_0xbd66('0xe')][0x8]===_0xbd66('0xf')||process[_0xbd66('0xe')][0x8]===_0xbd66('0x10')){throw new Error(_0xbd66('0x14'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x5ca4d1){logger[_0xbd66('0x15')](_0x5ca4d1);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(_0x2e259a,_0x4d81fd,_0x25605c,_0x3476b3){var _0x52a78a={'message':_0x4d81fd};_0x52a78a[_0x2e259a]=!![];if(_0x25605c){_0x52a78a[_0xbd66('0x16')]=_0x25605c;}if(_0x3476b3){_0x52a78a['index']=_0x3476b3;}return _0x52a78a;}function isEmail(_0x56ec3c){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))*$/[_0xbd66('0x17')](_0x56ec3c);}function checkRow(_0x4d8e36,_0x129ec4,_0x2c83ce){return new BPromise(function(_0x3227f9,_0x5cddeb){if(_['isNil'](_0x4d8e36)){return _0x5cddeb(handleCheckRowError(_0xbd66('0x15'),_0xbd66('0x18'),null,_0x2c83ce));}if(_0x4d8e36['errors']&&_0x4d8e36['errors'][_0xbd66('0x19')]){var _0x2a3da9=_[_0xbd66('0x1a')](_0x4d8e36['errors'],_0xbd66('0x1b'))[_0xbd66('0x1c')](';');return _0x5cddeb(handleCheckRowError(_0xbd66('0x15'),_0x2a3da9,null,_0x2c83ce));}var _0x579b76={};for(var _0x55d521 in FIELDS){if(FIELDS[_0xbd66('0x1d')](_0x55d521)&&FIELDS[_0x55d521]){_0x579b76[_0x55d521]=_0x4d8e36[_0xbd66('0x1e')][0x0][FIELDS[_0x55d521]]||_0x4d8e36[_0xbd66('0x1e')][0x0]['\ufeff'+FIELDS[_0x55d521]];}}if(!_0x579b76['firstName']){return _0x5cddeb(handleCheckRowError('error',_0xbd66('0x1f'),null,_0x2c83ce));}if(!_0x579b76['phone']){return _0x5cddeb(handleCheckRowError(_0xbd66('0x15'),_0xbd66('0x20'),null,_0x2c83ce));}if(_0x579b76[_0xbd66('0x21')]){var _0x4548e6=moment(_0x579b76[_0xbd66('0x21')],_0xbd66('0x22'));if(!_0x4548e6[_0xbd66('0x23')]()){return _0x5cddeb(handleCheckRowError(_0xbd66('0x15'),_0xbd66('0x24'),null,_0x2c83ce));}}if(_0x579b76[_0xbd66('0x25')]){if(!isEmail(_0x579b76[_0xbd66('0x25')])){return _0x5cddeb(handleCheckRowError('error',_0xbd66('0x26'),null,_0x2c83ce));}}_0x579b76['ListId']=LISTID;_0x579b76['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xbd66('0x19')]&&_0x129ec4){var _0x4c5c2={};for(var _0x323ba0=0x0,_0x5ed0de=DUPLICATES['length'];_0x323ba0<_0x5ed0de;_0x323ba0+=0x1){_0x4c5c2[DUPLICATES[_0x323ba0]]=_0x579b76[DUPLICATES[_0x323ba0]];}var _0xd5a4a2=_['find'](_0x129ec4,_0x4c5c2);if(_0xd5a4a2){return _0x5cddeb(handleCheckRowError(_0xbd66('0x27'),_0xbd66('0x28'),_0xd5a4a2,_0x2c83ce));}}return db[_0xbd66('0x29')][_0xbd66('0x2a')](_0x579b76,{'raw':!![],'hooks':![],'fields':_[_0xbd66('0x2b')](_0x579b76)})[_0xbd66('0x2c')](function(_0x2d3e5c){if(DUPLICATES&&DUPLICATES[_0xbd66('0x19')]&&_0x129ec4){_0x129ec4['push'](_['pick'](_0x579b76,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2d3e5c['id'];return _0x3227f9();})[_0xbd66('0x2d')](function(_0x272196){return _0x5cddeb(handleCheckRowError('error',_0xbd66('0x2e')+(_0x272196[_0xbd66('0x1b')]||JSON['stringify'](_0x272196)),null,_0x2c83ce));});});}function checkHopper(){function _0x585228(){return function(_0x7079db){logger[_0xbd66('0x15')](_0xbd66('0x2f'),_0xbd66('0x30'),util[_0xbd66('0x31')](_0x7079db,{'showHidden':![],'depth':null}));};}var _0x52207a=function(_0x9fe7b5,_0x37222c){var _0x58a71f=squel['insert']()[_0xbd66('0x32')](_0xbd66('0x33'))[_0xbd66('0x34')]([_0xbd66('0x35'),_0xbd66('0x36'),_0xbd66('0x37'),'ListId',_0x37222c,_0xbd66('0x38'),_0xbd66('0x39')],squel[_0xbd66('0x3a')]()[_0xbd66('0x3b')]('phone',_0xbd66('0x35'))[_0xbd66('0x3b')](_0xbd66('0x3c'),_0xbd66('0x36'))['field']('id',_0xbd66('0x37'))[_0xbd66('0x3b')](LISTID[_0xbd66('0x3d')](),'ListId')[_0xbd66('0x3b')](_0x9fe7b5['id'][_0xbd66('0x3d')](),_0x37222c)[_0xbd66('0x3b')](_0xbd66('0x3c'),_0xbd66('0x38'))[_0xbd66('0x3b')](_0xbd66('0x3c'),_0xbd66('0x39'))['from'](_0xbd66('0x3e'))[_0xbd66('0x3f')](_0xbd66('0x40'))[_0xbd66('0x3f')]('ListId\x20=\x20?',LISTID[_0xbd66('0x3d')]())[_0xbd66('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0xbd66('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xbd66('0x3b')]('phone')['from'](_0xbd66('0x33'))['where'](_0x37222c+_0xbd66('0x41'),_0x9fe7b5['id'][_0xbd66('0x3d')]())))[_0xbd66('0x3d')]();return _0x58a71f;};var _0x7dd697=function(_0x22c7ef,_0x49a390){var _0x4394a1=squel[_0xbd66('0x42')]()[_0xbd66('0x32')](_0xbd66('0x33'))[_0xbd66('0x34')]([_0xbd66('0x35'),'scheduledAt',_0xbd66('0x37'),_0xbd66('0x43'),_0x49a390,_0xbd66('0x38'),_0xbd66('0x39')],squel[_0xbd66('0x3a')]()['field'](_0xbd66('0x35'),_0xbd66('0x35'))['field'](_0xbd66('0x3c'),_0xbd66('0x36'))[_0xbd66('0x3b')]('id',_0xbd66('0x37'))['field'](LISTID[_0xbd66('0x3d')](),'ListId')[_0xbd66('0x3b')](_0x22c7ef['id'][_0xbd66('0x3d')](),_0x49a390)[_0xbd66('0x3b')](_0xbd66('0x3c'),_0xbd66('0x38'))['field'](_0xbd66('0x3c'),_0xbd66('0x39'))[_0xbd66('0x44')]('cm_contacts')[_0xbd66('0x3f')](_0xbd66('0x40'))[_0xbd66('0x3f')](_0xbd66('0x45'),LISTID[_0xbd66('0x3d')]())[_0xbd66('0x3f')](_0xbd66('0x46'),squel[_0xbd66('0x47')](hopperContacts))[_0xbd66('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0xbd66('0x3f')](_0xbd66('0x48'),squel[_0xbd66('0x3a')]()[_0xbd66('0x3b')](_0xbd66('0x49'))['from']('cm_hopper_final')[_0xbd66('0x3f')](_0x49a390+_0xbd66('0x41'),_0x22c7ef['id']['toString']()))[_0xbd66('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbd66('0x3a')]()['field'](_0xbd66('0x35'))[_0xbd66('0x44')](_0xbd66('0x33'))[_0xbd66('0x3f')](_0x49a390+_0xbd66('0x41'),_0x22c7ef['id'][_0xbd66('0x3d')]())))[_0xbd66('0x3d')]();return _0x4394a1;};function _0x2f476d(_0x202bf1,_0x3a6647){var _0x1ef020=squel['insert']()['into'](_0xbd66('0x33'))[_0xbd66('0x34')](['phone',_0xbd66('0x36'),_0xbd66('0x37'),_0xbd66('0x43'),_0x3a6647,_0xbd66('0x38'),_0xbd66('0x39')],squel[_0xbd66('0x3a')]()['field'](_0xbd66('0x35'),_0xbd66('0x35'))['field'](_0xbd66('0x3c'),_0xbd66('0x36'))[_0xbd66('0x3b')]('id',_0xbd66('0x37'))[_0xbd66('0x3b')](LISTID[_0xbd66('0x3d')](),_0xbd66('0x43'))[_0xbd66('0x3b')](_0x202bf1['id'][_0xbd66('0x3d')](),_0x3a6647)['field'](_0xbd66('0x3c'),'createdAt')[_0xbd66('0x3b')](_0xbd66('0x3c'),_0xbd66('0x39'))[_0xbd66('0x44')]('cm_contacts')[_0xbd66('0x3f')](_0xbd66('0x40'))['where'](_0xbd66('0x45'),LISTID[_0xbd66('0x3d')]())[_0xbd66('0x3f')](_0xbd66('0x46'),squel[_0xbd66('0x47')](hopperContacts))[_0xbd66('0x3f')](_0xbd66('0x4a')))['toString']();return _0x1ef020;}function _0x86eb16(_0x14f652,_0x484861){var _0x1433fb=squel[_0xbd66('0x42')]()[_0xbd66('0x32')](_0xbd66('0x4b'))[_0xbd66('0x34')]([_0xbd66('0x35'),_0xbd66('0x37'),_0xbd66('0x43'),_0x484861,_0xbd66('0x38'),_0xbd66('0x39')],squel[_0xbd66('0x3a')]()[_0xbd66('0x3b')](_0xbd66('0x35'),'phone')[_0xbd66('0x3b')]('id',_0xbd66('0x37'))[_0xbd66('0x3b')](LISTID[_0xbd66('0x3d')](),_0xbd66('0x43'))[_0xbd66('0x3b')](_0x14f652['id']['toString'](),_0x484861)[_0xbd66('0x3b')](_0xbd66('0x3c'),_0xbd66('0x38'))[_0xbd66('0x3b')](_0xbd66('0x3c'),_0xbd66('0x39'))[_0xbd66('0x44')]('cm_contacts')[_0xbd66('0x3f')]('deletedAt\x20IS\x20NULL')[_0xbd66('0x3f')](_0xbd66('0x45'),LISTID[_0xbd66('0x3d')]())[_0xbd66('0x3f')](_0xbd66('0x46'),squel['str'](hopperContacts))[_0xbd66('0x3f')](_0xbd66('0x4a')))['toString']();return _0x1433fb;}return db[_0xbd66('0x4c')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0xbd66('0x4d')],'include':[{'model':db[_0xbd66('0x4e')],'as':_0xbd66('0x4f'),'where':{'id':LISTID}}]})[_0xbd66('0x2c')](function(_0x9b5ca0){var _0x3f01f6=[];if(_0x9b5ca0){var _0xfbe07f;for(var _0x4130b5=0x0,_0x4c199e;_0x4130b5<_0x9b5ca0[_0xbd66('0x19')];_0x4130b5+=0x1){_0x4c199e=_0x9b5ca0[_0x4130b5][_0xbd66('0x50')]({'plain':!![]});switch(_0x4c199e[_0xbd66('0x4d')]){case _0xbd66('0x51'):_0x3f01f6[_0xbd66('0x52')](db[_0xbd66('0x53')][_0xbd66('0x54')](_0x7dd697(_0x4c199e,_0xbd66('0x55')))['then'](function(){})[_0xbd66('0x2d')](_0x585228()));break;case _0xbd66('0x56'):_0x3f01f6[_0xbd66('0x52')](db['sequelize'][_0xbd66('0x54')](_0x52207a(_0x4c199e,_0xbd66('0x55')))[_0xbd66('0x2c')](function(){})[_0xbd66('0x2d')](_0x585228()));break;default:_0x3f01f6['push'](db[_0xbd66('0x53')][_0xbd66('0x54')](_0x2f476d(_0x4c199e,'VoiceQueueId'))[_0xbd66('0x2c')](function(){})['catch'](_0x585228()));}}}return _0x3f01f6;})[_0xbd66('0x57')]()[_0xbd66('0x2c')](function(){return db[_0xbd66('0x4c')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xbd66('0x4e')],'as':_0xbd66('0x58'),'where':{'id':LISTID}}]})[_0xbd66('0x2c')](function(_0x509689){var _0x2e3197=[];if(_0x509689){var _0x1ce7a3;for(var _0x1a6469=0x0,_0xa24fae;_0x1a6469<_0x509689[_0xbd66('0x19')];_0x1a6469+=0x1){_0xa24fae=_0x509689[_0x1a6469][_0xbd66('0x50')]({'plain':!![]});_0x2e3197['push'](db['sequelize']['query'](_0x86eb16(_0xa24fae,_0xbd66('0x55')))[_0xbd66('0x2c')](function(){})[_0xbd66('0x2d')](_0x585228()));}}return _0x2e3197;})[_0xbd66('0x57')]();})['then'](function(){return db[_0xbd66('0x59')][_0xbd66('0x5a')]({'attributes':['id',_0xbd66('0x4d')],'include':[{'model':db[_0xbd66('0x4e')],'as':_0xbd66('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x35c964){var _0x3d066c=[];if(_0x35c964){for(var _0x4987b2=0x0,_0x464e20;_0x4987b2<_0x35c964[_0xbd66('0x19')];_0x4987b2+=0x1){_0x464e20=_0x35c964[_0x4987b2]['get']({'plain':!![]});switch(_0x464e20[_0xbd66('0x4d')]){case _0xbd66('0x51'):_0x3d066c[_0xbd66('0x52')](db[_0xbd66('0x53')]['query'](_0x7dd697(_0x464e20,_0xbd66('0x5b')))[_0xbd66('0x2c')](function(){})[_0xbd66('0x2d')](_0x585228()));break;case _0xbd66('0x56'):_0x3d066c[_0xbd66('0x52')](db[_0xbd66('0x53')][_0xbd66('0x54')](_0x52207a(_0x464e20,_0xbd66('0x5b')))[_0xbd66('0x2c')](function(){})[_0xbd66('0x2d')](_0x585228()));break;default:_0x3d066c['push'](db[_0xbd66('0x53')][_0xbd66('0x54')](_0x2f476d(_0x464e20,_0xbd66('0x5b')))[_0xbd66('0x2c')](function(){})[_0xbd66('0x2d')](_0x585228()));}}}return _0x3d066c;})['all']();})[_0xbd66('0x2c')](function(){return db[_0xbd66('0x59')][_0xbd66('0x5a')]({'attributes':['id'],'include':[{'model':db[_0xbd66('0x4e')],'as':_0xbd66('0x58'),'where':{'id':LISTID}}]})[_0xbd66('0x2c')](function(_0x1ba58d){var _0x1b0dba=[];if(_0x1ba58d){for(var _0x384fab=0x0,_0x567b37;_0x384fab<_0x1ba58d['length'];_0x384fab+=0x1){_0x567b37=_0x1ba58d[_0x384fab][_0xbd66('0x50')]({'plain':!![]});_0x1b0dba[_0xbd66('0x52')](db[_0xbd66('0x53')][_0xbd66('0x54')](_0x86eb16(_0x567b37,_0xbd66('0x5b')))['then'](function(){})[_0xbd66('0x2d')](_0x585228()));}}return _0x1b0dba;})[_0xbd66('0x57')]();})[_0xbd66('0x2d')](function(_0x3afdca){logger[_0xbd66('0x15')](_0xbd66('0x5c'),_0xbd66('0x5d'),_0x3afdca[_0xbd66('0x1b')]);});}var processPromises=function(_0x1bbe69){return BPromise['all'](promises)[_0xbd66('0x2c')](function(_0x33c43c){})['catch'](function(_0xdce861){logger['error'](_0xbd66('0x5e'),JSON[_0xbd66('0x5f')](_0xdce861));})[_0xbd66('0x60')](function(){socket['emit'](_0xbd66('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1bbe69){return _0x1bbe69[_0xbd66('0x62')]();}});};var endCsv=function(){return BPromise[_0xbd66('0x63')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xbd66('0x2c')](function(){socket[_0xbd66('0x64')](_0xbd66('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xbd66('0x65')](FILEPATH);}catch(_0x372b1d){logger[_0xbd66('0x15')](_0xbd66('0x66'),JSON['stringify'](_0x372b1d));}finally{process[_0xbd66('0x67')](0x0);}});};process['on'](_0xbd66('0x68'),function(){logger[_0xbd66('0x69')](_0xbd66('0x6a'));endCsv();});function main(){return BPromise[_0xbd66('0x63')]()[_0xbd66('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xbd66('0x29')][_0xbd66('0x5a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xbd66('0x2c')](function(_0x47feae){var _0x5f4f13=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x5f4f13,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1bbd8f,_0x30a197){total+=0x1;var _0x788c64=total;promises['push'](checkRow(_0x1bbd8f,_0x47feae,_0x788c64)[_0xbd66('0x2c')](function(){success+=0x1;})[_0xbd66('0x2d')](function(_0x1ba13b){if(_0x1ba13b[_0xbd66('0x15')]){errors+=0x1;delete _0x1ba13b[_0xbd66('0x15')];}else if(_0x1ba13b[_0xbd66('0x27')]){duplicates+=0x1;delete _0x1ba13b[_0xbd66('0x27')];}rows[_0xbd66('0x52')](_0x1ba13b);}));if(total%0xc8===0x0){_0x30a197[_0xbd66('0x6b')]();return processPromises(_0x30a197);}},'complete':function(){return processPromises()[_0xbd66('0x2c')](function(){logger['info'](_0xbd66('0x6c'));endCsv();});},'error':function(_0x4b1775,_0x1dac8e){logger[_0xbd66('0x69')](_0xbd66('0x6d'),JSON[_0xbd66('0x5f')](_0x4b1775));endCsv();}});})[_0xbd66('0x2d')](function(_0xc0bfb3){logger[_0xbd66('0x15')](_0xbd66('0x6e'),JSON[_0xbd66('0x5f')](_0xc0bfb3));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index a04c3e1..4ada461 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 _0xaaa3=['recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','cm_hopper_black','createdAt','cm_contacts','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','concat','keys','updatedAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','push','catch','info','main','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','data','hasOwnProperty','trim','replace','isNaN','isNumber','includes','agent\x20not\x20exists','email','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','length','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','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','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','priority','UserId'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xaaa3,0x16c));var _0x3aaa=function(_0x1e519a,_0x3d7da1){_0x1e519a=_0x1e519a-0x0;var _0x2e37b7=_0xaaa3[_0x1e519a];return _0x2e37b7;};'use strict';var fs=require('fs');var path=require(_0x3aaa('0x0'));var _=require(_0x3aaa('0x1'));var Papa=require(_0x3aaa('0x2'));var util=require(_0x3aaa('0x3'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x3aaa('0x4'));var Redis=require(_0x3aaa('0x5'));var db=require(_0x3aaa('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x3aaa('0x7'))(_0x3aaa('0x8'));config[_0x3aaa('0x9')]=_['defaults'](config[_0x3aaa('0x9')],{'host':_0x3aaa('0xa'),'port':0x18eb});var socket=require(_0x3aaa('0xb'))(new Redis(config[_0x3aaa('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x3aaa('0xc'));function isEmail(_0x210f0b){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))*$/[_0x3aaa('0xd')](_0x210f0b);}function selectNotIn(_0x2d0b20,_0xdc975f,_0x54e1c2,_0x492615,_0x38b740){return squel[_0x3aaa('0xe')]()[_0x3aaa('0xf')]('phone')[_0x3aaa('0x10')](_0x492615)[_0x3aaa('0x11')](_0xdc975f,null,_0xdc975f+_0x3aaa('0x12')+_0x492615+'.'+_0x54e1c2)[_0x3aaa('0x13')](_0x492615+'.'+_0x54e1c2+'\x20=\x20'+_0x2d0b20+'.'+_0x54e1c2)[_0x3aaa('0x13')](_0xdc975f+_0x3aaa('0x14')+_0x38b740['join']()+')');}function insertCmHopper(_0x9e87db,_0x59a9ad,_0x27a26b,_0x380e3a,_0x3fb936){var _0x544083=['cm_contacts.phone','cm_contacts.scheduledat',_0x3aaa('0x15'),'cm_contacts.ListId',_0x59a9ad+'.'+_0x380e3a,_0x3aaa('0x16'),'cm_contacts.updatedAt',_0x3aaa('0x17'),_0x3aaa('0x18'),'\x22'+_0x3fb936+'\x22'];return squel[_0x3aaa('0x19')]()[_0x3aaa('0x1a')](_0x3aaa('0x1b'))[_0x3aaa('0x1c')]([_0x3aaa('0x1d'),_0x3aaa('0x1e'),_0x3aaa('0x1f'),_0x3aaa('0x20'),_0x380e3a,'createdAt','updatedAt',_0x3aaa('0x21'),_0x3aaa('0x22'),_0x3aaa('0x23')],squel[_0x3aaa('0xe')]()[_0x3aaa('0x24')](_0x544083)['from'](_0x59a9ad)[_0x3aaa('0x11')]('cm_contacts',null,_0x3aaa('0x25')+_0x59a9ad+_0x3aaa('0x26'))['join'](_0x27a26b,null,_0x27a26b+_0x3aaa('0x12')+_0x59a9ad+'.'+_0x380e3a)['where'](_0x59a9ad+_0x3aaa('0x27'),_0x9e87db)[_0x3aaa('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x3aaa('0x13')](_0x3aaa('0x28'),selectNotIn(_0x59a9ad,_0x27a26b,_0x380e3a,_0x3aaa('0x1b'),[_0x3aaa('0x29'),_0x3aaa('0x2a')]))['where'](_0x3aaa('0x28'),selectNotIn(_0x59a9ad,_0x27a26b,_0x380e3a,_0x3aaa('0x1b'),[_0x3aaa('0x29')])))[_0x3aaa('0x2b')]();}function insertCmHopperBlack(_0xcabee2,_0x31b448,_0x3d1a5c,_0x52880a){var _0x56f56c=['cm_contacts.phone',_0x3aaa('0x15'),'cm_contacts.ListId',_0x31b448+'.'+_0x52880a,_0x3aaa('0x16'),_0x3aaa('0x2c')];return squel[_0x3aaa('0x19')]()[_0x3aaa('0x1a')](_0x3aaa('0x2d'))[_0x3aaa('0x1c')]([_0x3aaa('0x1d'),'ContactId','ListId',_0x52880a,_0x3aaa('0x2e'),'updatedAt'],squel[_0x3aaa('0xe')]()['fields'](_0x56f56c)[_0x3aaa('0x10')](_0x31b448)[_0x3aaa('0x11')](_0x3aaa('0x2f'),null,_0x3aaa('0x25')+_0x31b448+_0x3aaa('0x26'))[_0x3aaa('0x11')](_0x3d1a5c,null,_0x3d1a5c+_0x3aaa('0x12')+_0x31b448+'.'+_0x52880a)[_0x3aaa('0x13')](_0x31b448+_0x3aaa('0x27'),_0xcabee2)[_0x3aaa('0x13')](_0x3aaa('0x30'),NOW)[_0x3aaa('0x13')](_0x3aaa('0x28'),squel[_0x3aaa('0xe')]()[_0x3aaa('0xf')](_0x3aaa('0x1d'))['from'](_0x3aaa('0x2d'))[_0x3aaa('0x13')](_0x3aaa('0x31'),_0xcabee2)[_0x3aaa('0x13')](_0x52880a+'\x20=\x20?',_0x31b448+'.'+_0x52880a)))[_0x3aaa('0x2b')]();}function insertCmContact(_0x413780,_0x325d5f,_0x3970c6,_0x65a23c){var _0x48202f=_[_0x3aaa('0x32')](_[_0x3aaa('0x33')](_0x65a23c),[_0x3aaa('0x20'),'CompanyId',_0x3aaa('0x2e'),_0x3aaa('0x34')]);return squel[_0x3aaa('0x19')]()[_0x3aaa('0x1a')](_0x3aaa('0x2f'))[_0x3aaa('0x1c')](_0x48202f,squel[_0x3aaa('0xe')]()[_0x3aaa('0x24')](_0x48202f)[_0x3aaa('0x10')](_0x325d5f)[_0x3aaa('0x13')]('('+_0x3970c6[_0x3aaa('0x11')](',')+_0x3aaa('0x35'),squel[_0x3aaa('0xe')]()['fields'](_0x3970c6)[_0x3aaa('0x10')](_0x3aaa('0x2f'))[_0x3aaa('0x13')](_0x3aaa('0x31'),_0x413780)[_0x3aaa('0x13')](_0x3aaa('0x36')))[_0x3aaa('0x13')](_0x3aaa('0x37'),squel[_0x3aaa('0xe')]()[_0x3aaa('0xf')](_0x3aaa('0x38'),'min_id')[_0x3aaa('0x10')](_0x325d5f)['group'](_0x3970c6['join'](','))))[_0x3aaa('0x2b')]();}function handleStop(){logger['info'](_0x3aaa('0x39'));stopped=!![];}function handleUncaughtException(_0x117b6f){logger[_0x3aaa('0x3a')](_0x117b6f[_0x3aaa('0x3b')]);process[_0x3aaa('0x3c')](0x1);}function handleError(_0x4fcc11,_0x47d887){stats[_0x3aaa('0x3d')]['push']({'name':_0x47d887[_0x3aaa('0x3e')],'message':_0x47d887['message'],'row':_0x4fcc11});}function handleQuery(_0x1229a2){logger['info'](_0x1229a2);return db[_0x3aaa('0x3f')][_0x3aaa('0x40')](_0x1229a2)[_0x3aaa('0x41')](function(_0x2b55c6){results[_0x3aaa('0x42')](_0x2b55c6);})[_0x3aaa('0x43')](function(_0x16d841){logger['error'](_0x16d841[_0x3aaa('0x3b')]);});}function main(_0x4f1042,_0x5bdf27,_0x318f8b,_0x512948){logger[_0x3aaa('0x44')](_0x3aaa('0x45'),_0x4f1042,JSON['stringify'](_0x5bdf27));process[_0x3aaa('0x46')](_0x3aaa('0x47'));var _0x4ffa15=_0x5bdf27[_0x3aaa('0x48')];var _0x17abf7=_0x5bdf27[_0x3aaa('0x49')];var _0x54bf2a=path[_0x3aaa('0x11')](config[_0x3aaa('0x4a')],_0x3aaa('0x4b'),_0x17abf7+_0x3aaa('0x4c'));var _0x406cba=_[_0x3aaa('0x33')](_0x4ffa15)['join']();logger[_0x3aaa('0x44')](_0x3aaa('0x4d'),_0x406cba);fs[_0x3aaa('0x4e')](_0x54bf2a,_0x406cba+'\x0a');Papa[_0x3aaa('0x4f')](fs['createReadStream'](_0x4f1042),{'header':!![],'skipEmptyLines':!![],'step':function(_0x59d2fc,_0x563c29){try{for(var _0x4f115e=0x0,_0xeeb58b=[];_0x4f115e<_0x59d2fc['data']['length'];_0x4f115e++){stats['rows']+=0x1;if(_0x59d2fc['errors'][_0x4f115e]){handleError(_0x59d2fc[_0x3aaa('0x50')][_0x4f115e],_0x59d2fc[_0x3aaa('0x3d')][_0x4f115e]);}else{var _0x2f47b2=[];for(var _0x184b28 in _0x4ffa15){if(_0x4ffa15[_0x3aaa('0x51')](_0x184b28)){if(_0x59d2fc['data'][_0x4f115e][_0x4ffa15[_0x184b28]]){var _0x111a83=_[_0x3aaa('0x52')](_0x59d2fc[_0x3aaa('0x50')][_0x4f115e][_0x4ffa15[_0x184b28]][_0x3aaa('0x53')](/"/g,'\x27'));switch(_0x184b28){case _0x3aaa('0x1e'):var _0x189a6f=moment(_0x111a83,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x189a6f['isValid']()){_0xeeb58b[_0x3aaa('0x42')]('\x22'+_0x111a83+'\x22');}else{_0x2f47b2['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x43b64c=parseInt(_0x111a83);_0x111a83=_[_0x3aaa('0x54')](_0x43b64c)||_0x43b64c<0x0||_0x43b64c>0x4?_0x512948?0x3:0x2:_0x43b64c;_0xeeb58b[_0x3aaa('0x42')]('\x22'+_0x111a83+'\x22');break;case _0x3aaa('0x22'):var _0x234a7d=parseInt(_0x111a83);if(_[_0x3aaa('0x55')](_0x234a7d)&&_[_0x3aaa('0x56')](_0x318f8b,_0x234a7d)){_0xeeb58b[_0x3aaa('0x42')]('\x22'+_0x234a7d+'\x22');}else{_0x2f47b2[_0x3aaa('0x42')](_0x3aaa('0x57'));}break;case _0x3aaa('0x58'):if(isEmail(_0x111a83)){_0xeeb58b[_0x3aaa('0x42')]('\x22'+_0x111a83+'\x22');}else{_0x2f47b2[_0x3aaa('0x42')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x49bc84=moment(_0x111a83,_0x3aaa('0x59'),!![]);if(_0x49bc84[_0x3aaa('0x5a')]()){_0xeeb58b['push']('\x22'+_0x111a83+'\x22');}else{_0x2f47b2['push'](_0x3aaa('0x5b'));}break;default:_0xeeb58b[_0x3aaa('0x42')]('\x22'+_0x111a83+'\x22');}}else{switch(_0x184b28){case _0x3aaa('0x5c'):case _0x3aaa('0x1d'):_0x2f47b2[_0x3aaa('0x42')](_0x184b28+_0x3aaa('0x5d'));break;default:_0xeeb58b[_0x3aaa('0x42')]('\x22\x22');}}}}if(_0x2f47b2[_0x3aaa('0x5e')]){handleError(_0x59d2fc['data'][_0x4f115e],{'code':_0x3aaa('0x5f'),'message':_0x2f47b2[_0x3aaa('0x11')]()});}else{fs[_0x3aaa('0x60')](_0x54bf2a,_0xeeb58b['join']()+'\x0a');}_0xeeb58b=[];}if(!(stats[_0x3aaa('0x61')]%0xc8)){socket[_0x3aaa('0x62')](_0x3aaa('0x63')+_0x17abf7,stats);stats[_0x3aaa('0x3d')]=[];}}if(stopped){logger['info'](_0x3aaa('0x64'));_0x563c29[_0x3aaa('0x65')]();}}catch(_0x398d17){handleError(_0x59d2fc[_0x3aaa('0x50')][_0x4f115e],{'code':_0x3aaa('0x66'),'message':_0x398d17[_0x3aaa('0x3b')]});logger[_0x3aaa('0x3a')](_0x3aaa('0x67'),_0x398d17[_0x3aaa('0x3b')]);}},'complete':function(){try{var _0x300a12=[];var _0x3ff64a=_0x3aaa('0x2f');if(_0x5bdf27[_0x3aaa('0x68')]&&_0x5bdf27[_0x3aaa('0x68')][_0x3aaa('0x5e')]){_0x3ff64a=_0x3aaa('0x69')+_0x17abf7;_0x300a12[_0x3aaa('0x42')](_0x3aaa('0x6a')+_0x3ff64a+'\x20LIKE\x20cm_contacts;');}var _0x34f877=util[_0x3aaa('0x6b')](_0x3aaa('0x6c'),_0x54bf2a,_0x3ff64a,_0x406cba,_0x5bdf27[_0x3aaa('0x20')],_0x5bdf27['CompanyId']||null,NOW,NOW);if(_[_0x3aaa('0x6d')](_0x4ffa15[_0x3aaa('0x1e')])){_0x34f877+=_0x3aaa('0x6e');}_0x300a12[_0x3aaa('0x42')](_0x34f877);if(_0x5bdf27[_0x3aaa('0x68')]&&_0x5bdf27[_0x3aaa('0x68')][_0x3aaa('0x5e')]){_0x300a12[_0x3aaa('0x42')](insertCmContact(_0x5bdf27[_0x3aaa('0x20')],_0x3ff64a,_0x5bdf27['duplicates'],_0x4ffa15));_0x300a12[_0x3aaa('0x42')](_0x3aaa('0x6f')+_0x3ff64a+';');}_0x300a12[_0x3aaa('0x42')](insertCmHopper(_0x5bdf27['ListId'],_0x3aaa('0x70'),_0x3aaa('0x71'),_0x3aaa('0x72'),_0x512948));_0x300a12['push'](insertCmHopperBlack(_0x5bdf27[_0x3aaa('0x20')],_0x3aaa('0x73'),_0x3aaa('0x71'),_0x3aaa('0x72')));_0x300a12['push'](insertCmHopper(_0x5bdf27[_0x3aaa('0x20')],_0x3aaa('0x74'),_0x3aaa('0x75'),'CampaignId',_0x512948));_0x300a12[_0x3aaa('0x42')](insertCmHopperBlack(_0x5bdf27[_0x3aaa('0x20')],_0x3aaa('0x76'),'campaigns','CampaignId'));BPromise['each'](_0x300a12,handleQuery)[_0x3aaa('0x77')](function(_0x1bc403){stats[_0x3aaa('0x78')]=!![];stats[_0x3aaa('0x79')]=_0x5bdf27[_0x3aaa('0x68')]&&_0x5bdf27[_0x3aaa('0x68')][_0x3aaa('0x5e')]?results[0x2][_0x3aaa('0x79')]:results[0x0]['affectedRows'];socket['emit'](_0x3aaa('0x63')+_0x17abf7,stats);fs['unlink'](_0x4f1042);fs[_0x3aaa('0x7a')](_0x54bf2a);process[_0x3aaa('0x3c')](0x0);})['catch'](function(_0x2898fd){logger[_0x3aaa('0x3a')](_0x2898fd['message']);process[_0x3aaa('0x3c')](0x1);});}catch(_0x10d918){logger[_0x3aaa('0x3a')](_0x3aaa('0x7b'),_0x10d918[_0x3aaa('0x3b')]);process[_0x3aaa('0x3c')](0x1);}},'error':function(_0x19ba97,_0x3c949b,_0x11d9cb,_0x1cdfce){throw new Error(_0x1cdfce);}});}function validate(){if(process['argv']&&process[_0x3aaa('0x7c')]['length']<0x4){throw new Error(_0x3aaa('0x7d'));}var _0x45fb41=path[_0x3aaa('0x11')](config[_0x3aaa('0x4a')],_0x3aaa('0x4b'),process[_0x3aaa('0x7c')][0x2]);if(!fs[_0x3aaa('0x7e')](_0x45fb41)){throw new Error(_0x3aaa('0x7f'));}var _0x584218={};try{_0x584218=JSON[_0x3aaa('0x4f')](process[_0x3aaa('0x7c')][0x3]);if(!_0x584218[_0x3aaa('0x48')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x584218[_0x3aaa('0x48')][_0x3aaa('0x1d')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x584218[_0x3aaa('0x48')][_0x3aaa('0x5c')]){throw new Error(_0x3aaa('0x80'));}var _0x19d54c=0x0;if(_0x584218[_0x3aaa('0x48')]['UserId']){_0x19d54c=0x1;}if(!_0x584218[_0x3aaa('0x20')]){throw new Error(_0x3aaa('0x81'));}}catch(_0x195bed){throw new Error(_0x3aaa('0x82'));}var _0x32f670=[];try{_0x32f670=_['map'](JSON[_0x3aaa('0x4f')](process[_0x3aaa('0x7c')][0x4]),'id');}catch(_0x401d89){logger[_0x3aaa('0x44')](_0x3aaa('0x83'));}main(_0x45fb41,_0x584218,_0x32f670,_0x19d54c);}validate();process['on']('SIGINT',handleStop);process['on'](_0x3aaa('0x84'),handleUncaughtException); \ No newline at end of file +var _0x94fb=['\x20=\x20?','concat','keys','CompanyId','deletedAt\x20IS\x20NULL','field','MIN(id)','min_id','group','toString','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','spread','catch','main','stringify','send','start','binding','socket_timestamp','server/files/tmp','.csv','parse','createReadStream','rows','data','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','length','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','each','then','finish','affectedRows','unlink','complete','arguments\x20\x20\x20','root','argv','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','ListId','cm_hopper_black','ListId\x20=\x20?'];(function(_0x257378,_0x2b9ae7){var _0x195515=function(_0x132a5d){while(--_0x132a5d){_0x257378['push'](_0x257378['shift']());}};_0x195515(++_0x2b9ae7);}(_0x94fb,0xdd));var _0xb94f=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x94fb[_0x33032e];return _0x13316b;};'use strict';var fs=require('fs');var path=require(_0xb94f('0x0'));var _=require(_0xb94f('0x1'));var Papa=require(_0xb94f('0x2'));var util=require(_0xb94f('0x3'));var BPromise=require(_0xb94f('0x4'));var moment=require(_0xb94f('0x5'));var squel=require(_0xb94f('0x6'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xb94f('0x7'));var logger=require(_0xb94f('0x8'))(_0xb94f('0x9'));config[_0xb94f('0xa')]=_[_0xb94f('0xb')](config['redis'],{'host':_0xb94f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xb94f('0xd')](_0xb94f('0xe'));function isEmail(_0xaf797a){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))*$/[_0xb94f('0xf')](_0xaf797a);}function selectNotIn(_0x2a36a8,_0x461686,_0x4d6ecb,_0x181c7d,_0x531a44){return squel[_0xb94f('0x10')]()['field'](_0xb94f('0x11'))[_0xb94f('0x12')](_0x181c7d)[_0xb94f('0x13')](_0x461686,null,_0x461686+_0xb94f('0x14')+_0x181c7d+'.'+_0x4d6ecb)[_0xb94f('0x15')](_0x181c7d+'.'+_0x4d6ecb+_0xb94f('0x16')+_0x2a36a8+'.'+_0x4d6ecb)[_0xb94f('0x15')](_0x461686+_0xb94f('0x17')+_0x531a44[_0xb94f('0x13')]()+')');}function insertCmHopper(_0x16efdd,_0xd9122,_0x326caf,_0x5ecf53,_0x3dd844){var _0x54e418=[_0xb94f('0x18'),_0xb94f('0x19'),_0xb94f('0x1a'),'cm_contacts.ListId',_0xd9122+'.'+_0x5ecf53,_0xb94f('0x1b'),_0xb94f('0x1c'),_0xb94f('0x1d'),'cm_contacts.UserId','\x22'+_0x3dd844+'\x22'];return squel[_0xb94f('0x1e')]()[_0xb94f('0x1f')](_0xb94f('0x20'))[_0xb94f('0x21')]([_0xb94f('0x11'),_0xb94f('0x22'),_0xb94f('0x23'),'ListId',_0x5ecf53,_0xb94f('0x24'),_0xb94f('0x25'),'priority',_0xb94f('0x26'),_0xb94f('0x27')],squel['select']()[_0xb94f('0x28')](_0x54e418)[_0xb94f('0x12')](_0xd9122)[_0xb94f('0x13')](_0xb94f('0x29'),null,_0xb94f('0x2a')+_0xd9122+'.CmListId')[_0xb94f('0x13')](_0x326caf,null,_0x326caf+'.id\x20=\x20'+_0xd9122+'.'+_0x5ecf53)[_0xb94f('0x15')](_0xd9122+'.CmListId\x20=\x20?',_0x16efdd)[_0xb94f('0x15')](_0xb94f('0x2b'),NOW)[_0xb94f('0x15')](_0xb94f('0x2c'),selectNotIn(_0xd9122,_0x326caf,_0x5ecf53,_0xb94f('0x20'),['\x22always\x22',_0xb94f('0x2d')]))[_0xb94f('0x15')](_0xb94f('0x2c'),selectNotIn(_0xd9122,_0x326caf,_0x5ecf53,'cm_hopper',['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x470624,_0x4a374a,_0xdafa18,_0x31b584){var _0x36bc87=['cm_contacts.phone',_0xb94f('0x1a'),'cm_contacts.ListId',_0x4a374a+'.'+_0x31b584,_0xb94f('0x1b'),'cm_contacts.updatedAt'];return squel['insert']()[_0xb94f('0x1f')]('cm_hopper_black')[_0xb94f('0x21')]([_0xb94f('0x11'),'ContactId',_0xb94f('0x2e'),_0x31b584,_0xb94f('0x24'),_0xb94f('0x25')],squel[_0xb94f('0x10')]()[_0xb94f('0x28')](_0x36bc87)[_0xb94f('0x12')](_0x4a374a)[_0xb94f('0x13')](_0xb94f('0x29'),null,_0xb94f('0x2a')+_0x4a374a+'.CmListId')[_0xb94f('0x13')](_0xdafa18,null,_0xdafa18+_0xb94f('0x14')+_0x4a374a+'.'+_0x31b584)['where'](_0x4a374a+'.CmListId\x20=\x20?',_0x470624)[_0xb94f('0x15')](_0xb94f('0x2b'),NOW)[_0xb94f('0x15')](_0xb94f('0x2c'),squel[_0xb94f('0x10')]()['field'](_0xb94f('0x11'))['from'](_0xb94f('0x2f'))['where'](_0xb94f('0x30'),_0x470624)[_0xb94f('0x15')](_0x31b584+_0xb94f('0x31'),_0x4a374a+'.'+_0x31b584)))['toString']();}function insertCmContact(_0x3b0a9e,_0x5d8ae0,_0x360e7d,_0x25527e){var _0x448e08=_[_0xb94f('0x32')](_[_0xb94f('0x33')](_0x25527e),[_0xb94f('0x2e'),_0xb94f('0x34'),'createdAt','updatedAt']);return squel['insert']()[_0xb94f('0x1f')](_0xb94f('0x29'))[_0xb94f('0x21')](_0x448e08,squel[_0xb94f('0x10')]()['fields'](_0x448e08)[_0xb94f('0x12')](_0x5d8ae0)['where']('('+_0x360e7d[_0xb94f('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0xb94f('0x10')]()[_0xb94f('0x28')](_0x360e7d)[_0xb94f('0x12')](_0xb94f('0x29'))[_0xb94f('0x15')]('ListId\x20=\x20?',_0x3b0a9e)[_0xb94f('0x15')](_0xb94f('0x35')))[_0xb94f('0x15')]('id\x20IN\x20?',squel[_0xb94f('0x10')]()[_0xb94f('0x36')](_0xb94f('0x37'),_0xb94f('0x38'))[_0xb94f('0x12')](_0x5d8ae0)[_0xb94f('0x39')](_0x360e7d[_0xb94f('0x13')](','))))[_0xb94f('0x3a')]();}function handleStop(){logger[_0xb94f('0x3b')](_0xb94f('0x3c'));stopped=!![];}function handleUncaughtException(_0x514171){logger[_0xb94f('0x3d')](_0x514171[_0xb94f('0x3e')]);process[_0xb94f('0x3f')](0x1);}function handleError(_0x12d76d,_0x7eda15){stats[_0xb94f('0x40')][_0xb94f('0x41')]({'name':_0x7eda15[_0xb94f('0x42')],'message':_0x7eda15[_0xb94f('0x3e')],'row':_0x12d76d});}function handleQuery(_0x1a193e){logger['info'](_0x1a193e);return db[_0xb94f('0x43')]['query'](_0x1a193e)[_0xb94f('0x44')](function(_0x349ad8){results['push'](_0x349ad8);})[_0xb94f('0x45')](function(_0x350db0){logger[_0xb94f('0x3d')](_0x350db0[_0xb94f('0x3e')]);});}function main(_0x1402d0,_0x28d971,_0x22f0cb,_0x297e90){logger[_0xb94f('0x3b')](_0xb94f('0x46'),_0x1402d0,JSON[_0xb94f('0x47')](_0x28d971));process[_0xb94f('0x48')](_0xb94f('0x49'));var _0xd6fa19=_0x28d971[_0xb94f('0x4a')];var _0x367dc8=_0x28d971[_0xb94f('0x4b')];var _0x407db3=path[_0xb94f('0x13')](config['root'],_0xb94f('0x4c'),_0x367dc8+_0xb94f('0x4d'));var _0x39210b=_[_0xb94f('0x33')](_0xd6fa19)[_0xb94f('0x13')]();logger[_0xb94f('0x3b')]('header',_0x39210b);fs['writeFileSync'](_0x407db3,_0x39210b+'\x0a');Papa[_0xb94f('0x4e')](fs[_0xb94f('0x4f')](_0x1402d0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x52e2bd,_0xf232d7){try{for(var _0x114772=0x0,_0x3f71d1=[];_0x114772<_0x52e2bd['data']['length'];_0x114772++){stats[_0xb94f('0x50')]+=0x1;if(_0x52e2bd[_0xb94f('0x40')][_0x114772]){handleError(_0x52e2bd[_0xb94f('0x51')][_0x114772],_0x52e2bd[_0xb94f('0x40')][_0x114772]);}else{var _0x4df028=[];for(var _0x30de36 in _0xd6fa19){if(_0xd6fa19[_0xb94f('0x52')](_0x30de36)){if(_0x52e2bd[_0xb94f('0x51')][_0x114772][_0xd6fa19[_0x30de36]]){var _0x36f59c=_[_0xb94f('0x53')](_0x52e2bd['data'][_0x114772][_0xd6fa19[_0x30de36]][_0xb94f('0x54')](/"/g,'\x27'));switch(_0x30de36){case _0xb94f('0x22'):var _0x537c3f=moment(_0x36f59c,_0xb94f('0xe'),!![]);if(_0x537c3f[_0xb94f('0x55')]()){_0x3f71d1[_0xb94f('0x41')]('\x22'+_0x36f59c+'\x22');}else{_0x4df028['push'](_0xb94f('0x56'));}break;case _0xb94f('0x57'):var _0x4b5e00=parseInt(_0x36f59c);_0x36f59c=_[_0xb94f('0x58')](_0x4b5e00)||_0x4b5e00<0x0||_0x4b5e00>0x4?_0x297e90?0x3:0x2:_0x4b5e00;_0x3f71d1['push']('\x22'+_0x36f59c+'\x22');break;case'UserId':var _0x479842=parseInt(_0x36f59c);if(_[_0xb94f('0x59')](_0x479842)&&_[_0xb94f('0x5a')](_0x22f0cb,_0x479842)){_0x3f71d1[_0xb94f('0x41')]('\x22'+_0x479842+'\x22');}else{_0x4df028[_0xb94f('0x41')]('agent\x20not\x20exists');}break;case _0xb94f('0x5b'):if(isEmail(_0x36f59c)){_0x3f71d1[_0xb94f('0x41')]('\x22'+_0x36f59c+'\x22');}else{_0x4df028[_0xb94f('0x41')](_0xb94f('0x5c'));}break;case _0xb94f('0x5d'):var _0x16df58=moment(_0x36f59c,_0xb94f('0x5e'),!![]);if(_0x16df58[_0xb94f('0x55')]()){_0x3f71d1[_0xb94f('0x41')]('\x22'+_0x36f59c+'\x22');}else{_0x4df028[_0xb94f('0x41')](_0xb94f('0x5f'));}break;default:_0x3f71d1[_0xb94f('0x41')]('\x22'+_0x36f59c+'\x22');}}else{switch(_0x30de36){case _0xb94f('0x60'):case _0xb94f('0x11'):_0x4df028[_0xb94f('0x41')](_0x30de36+_0xb94f('0x61'));break;default:_0x3f71d1[_0xb94f('0x41')]('\x22\x22');}}}}if(_0x4df028['length']){handleError(_0x52e2bd[_0xb94f('0x51')][_0x114772],{'code':'SystemRow','message':_0x4df028[_0xb94f('0x13')]()});}else{fs[_0xb94f('0x62')](_0x407db3,_0x3f71d1['join']()+'\x0a');}_0x3f71d1=[];}if(!(stats[_0xb94f('0x50')]%0xc8)){socket[_0xb94f('0x63')](_0xb94f('0x64')+_0x367dc8,stats);stats[_0xb94f('0x40')]=[];}}if(stopped){logger[_0xb94f('0x3b')](_0xb94f('0x65'));_0xf232d7[_0xb94f('0x66')]();}}catch(_0x3da824){handleError(_0x52e2bd[_0xb94f('0x51')][_0x114772],{'code':_0xb94f('0x67'),'message':_0x3da824[_0xb94f('0x3e')]});logger[_0xb94f('0x3d')]('step',_0x3da824['message']);}},'complete':function(){try{var _0x5bd1aa=[];var _0x3e98ab=_0xb94f('0x29');if(_0x28d971[_0xb94f('0x68')]&&_0x28d971['duplicates'][_0xb94f('0x69')]){_0x3e98ab=_0xb94f('0x6a')+_0x367dc8;_0x5bd1aa[_0xb94f('0x41')](_0xb94f('0x6b')+_0x3e98ab+_0xb94f('0x6c'));}var _0x4fade1=util[_0xb94f('0xd')](_0xb94f('0x6d'),_0x407db3,_0x3e98ab,_0x39210b,_0x28d971[_0xb94f('0x2e')],_0x28d971[_0xb94f('0x34')]||null,NOW,NOW);if(_['isNil'](_0xd6fa19[_0xb94f('0x22')])){_0x4fade1+=_0xb94f('0x6e');}_0x5bd1aa[_0xb94f('0x41')](_0x4fade1);if(_0x28d971[_0xb94f('0x68')]&&_0x28d971['duplicates'][_0xb94f('0x69')]){_0x5bd1aa[_0xb94f('0x41')](insertCmContact(_0x28d971['ListId'],_0x3e98ab,_0x28d971['duplicates'],_0xd6fa19));_0x5bd1aa[_0xb94f('0x41')](_0xb94f('0x6f')+_0x3e98ab+';');}_0x5bd1aa[_0xb94f('0x41')](insertCmHopper(_0x28d971[_0xb94f('0x2e')],'voice_queues_has_cm_lists','voice_queues',_0xb94f('0x70'),_0x297e90));_0x5bd1aa['push'](insertCmHopperBlack(_0x28d971[_0xb94f('0x2e')],_0xb94f('0x71'),'voice_queues','VoiceQueueId'));_0x5bd1aa[_0xb94f('0x41')](insertCmHopper(_0x28d971[_0xb94f('0x2e')],_0xb94f('0x72'),_0xb94f('0x73'),'CampaignId',_0x297e90));_0x5bd1aa['push'](insertCmHopperBlack(_0x28d971[_0xb94f('0x2e')],'campaigns_has_cm_blacklists',_0xb94f('0x73'),_0xb94f('0x74')));BPromise[_0xb94f('0x75')](_0x5bd1aa,handleQuery)[_0xb94f('0x76')](function(_0x5db393){stats[_0xb94f('0x77')]=!![];stats[_0xb94f('0x78')]=_0x28d971[_0xb94f('0x68')]&&_0x28d971['duplicates'][_0xb94f('0x69')]?results[0x2][_0xb94f('0x78')]:results[0x0][_0xb94f('0x78')];socket[_0xb94f('0x63')](_0xb94f('0x64')+_0x367dc8,stats);fs[_0xb94f('0x79')](_0x1402d0);fs[_0xb94f('0x79')](_0x407db3);process[_0xb94f('0x3f')](0x0);})[_0xb94f('0x45')](function(_0x3f59e0){logger['error'](_0x3f59e0[_0xb94f('0x3e')]);process[_0xb94f('0x3f')](0x1);});}catch(_0x1d8a37){logger[_0xb94f('0x3d')](_0xb94f('0x7a'),_0x1d8a37[_0xb94f('0x3e')]);process[_0xb94f('0x3f')](0x1);}},'error':function(_0x4a810b,_0x55dac2,_0x1e3aa6,_0x5c55e0){throw new Error(_0x5c55e0);}});}function validate(){if(process['argv']&&process['argv'][_0xb94f('0x69')]<0x4){throw new Error(_0xb94f('0x7b'));}var _0x28d0f4=path[_0xb94f('0x13')](config[_0xb94f('0x7c')],_0xb94f('0x4c'),process[_0xb94f('0x7d')][0x2]);if(!fs[_0xb94f('0x7e')](_0x28d0f4)){throw new Error(_0xb94f('0x7f'));}var _0xe0596c={};try{_0xe0596c=JSON['parse'](process[_0xb94f('0x7d')][0x3]);if(!_0xe0596c[_0xb94f('0x4a')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0xe0596c['binding']['phone']){throw new Error(_0xb94f('0x80'));}if(!_0xe0596c[_0xb94f('0x4a')][_0xb94f('0x60')]){throw new Error(_0xb94f('0x81'));}var _0x3cfd93=0x0;if(_0xe0596c[_0xb94f('0x4a')][_0xb94f('0x26')]){_0x3cfd93=0x1;}if(!_0xe0596c[_0xb94f('0x2e')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x5112e5){throw new Error(_0xb94f('0x82'));}var _0x19d2ed=[];try{_0x19d2ed=_[_0xb94f('0x83')](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x336c1f){logger['info'](_0xb94f('0x84'));}main(_0x28d0f4,_0xe0596c,_0x19d2ed,_0x3cfd93);}validate();process['on'](_0xb94f('0x85'),handleStop);process['on'](_0xb94f('0x86'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 9e742f4..db2b344 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2c3=['Caller\x20Number','Caller\x20Name','calleridname','destexten','Queue','queue','UniqueId','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','***\x20Call\x20Info\x20***','destcalleridnum','membername','uniqueid','***\x20Time\x20Info\x20***','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','toLowerCase','inbound','variable','push','calleridnum','outbound','voice','keyValue'];(function(_0xf36050,_0x5b50bb){var _0x566cca=function(_0xe7b852){while(--_0xe7b852){_0xf36050['push'](_0xf36050['shift']());}};_0x566cca(++_0x5b50bb);}(_0xd2c3,0x1ee));var _0x3d2c=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xd2c3[_0x2d2c16];return _0x53f2fb;};'use strict';exports[_0x3d2c('0x0')]=function(_0x5c9373,_0x38e046){var _0x523fb8=[{'type':_0x3d2c('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x5c9373[_0x3d2c('0x2')]()){case'voice':switch(_0x38e046[_0x3d2c('0x2')]()){case _0x3d2c('0x3'):_0x523fb8['push']({'type':_0x3d2c('0x4'),'content':'','variableName':'queue'});_0x523fb8[_0x3d2c('0x5')]({'type':_0x3d2c('0x4'),'content':'','variableName':_0x3d2c('0x6')});break;case _0x3d2c('0x7'):_0x523fb8['push']({'type':_0x3d2c('0x1'),'content':'Outbound\x20Call','variableName':null});_0x523fb8[_0x3d2c('0x5')]({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x523fb8;};exports['getDescriptions']=function(_0x5945fb,_0x2086df){var _0x56f1ad=[];switch(_0x5945fb[_0x3d2c('0x2')]()){case _0x3d2c('0x8'):switch(_0x2086df[_0x3d2c('0x2')]()){case _0x3d2c('0x3'):_0x56f1ad=[{'type':_0x3d2c('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x3d2c('0x9'),'content':'','key':_0x3d2c('0xa'),'keyType':'variable','variableName':_0x3d2c('0x6')},{'type':_0x3d2c('0x9'),'content':'','key':_0x3d2c('0xb'),'keyType':'variable','variableName':_0x3d2c('0xc')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x3d2c('0x4'),'variableName':_0x3d2c('0xd')},{'type':_0x3d2c('0x9'),'content':'','key':_0x3d2c('0xe'),'keyType':'variable','variableName':_0x3d2c('0xf')},{'type':_0x3d2c('0x9'),'content':'','key':_0x3d2c('0x10'),'keyType':_0x3d2c('0x4'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0x3d2c('0x11'),'keyType':_0x3d2c('0x4'),'variableName':'agentcalledAt'},{'type':_0x3d2c('0x1'),'content':_0x3d2c('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0x3d2c('0x9'),'content':'','key':_0x3d2c('0x13'),'keyType':_0x3d2c('0x4'),'variableName':'destcalleridname'},{'type':_0x3d2c('0x9'),'content':'','key':_0x3d2c('0x14'),'keyType':_0x3d2c('0x4'),'variableName':'destcalleridnum'},{'type':_0x3d2c('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x3d2c('0x9'),'content':'','key':_0x3d2c('0x15'),'keyType':_0x3d2c('0x4'),'variableName':_0x3d2c('0x16')},{'type':_0x3d2c('0x9'),'content':'','key':_0x3d2c('0x17'),'keyType':_0x3d2c('0x4'),'variableName':_0x3d2c('0x18')},{'type':_0x3d2c('0x9'),'content':'','key':_0x3d2c('0x19'),'keyType':'variable','variableName':_0x3d2c('0x1a')},{'type':_0x3d2c('0x9'),'content':'','key':_0x3d2c('0x1b'),'keyType':_0x3d2c('0x4'),'variableName':_0x3d2c('0x1c')},{'type':_0x3d2c('0x9'),'content':'','key':'Talk\x20Time','keyType':_0x3d2c('0x4'),'variableName':_0x3d2c('0x1d')}];break;case _0x3d2c('0x7'):_0x56f1ad=[{'type':_0x3d2c('0x1'),'content':_0x3d2c('0x1e'),'variableName':null},{'type':_0x3d2c('0x9'),'content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0x3d2c('0x1f')},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':_0x3d2c('0x4'),'keyContent':'','variableName':_0x3d2c('0x20')},{'type':_0x3d2c('0x9'),'content':'','key':_0x3d2c('0x10'),'keyType':_0x3d2c('0x4'),'keyContent':'','variableName':_0x3d2c('0x21')},{'type':_0x3d2c('0x9'),'content':'','key':_0x3d2c('0x11'),'keyType':_0x3d2c('0x4'),'keyContent':'','variableName':'starttime'},{'type':_0x3d2c('0x1'),'content':_0x3d2c('0x22')},{'type':_0x3d2c('0x9'),'content':'','key':'Answer\x20Time','keyType':_0x3d2c('0x4'),'keyContent':'','variableName':_0x3d2c('0x23')},{'type':_0x3d2c('0x9'),'content':'','key':_0x3d2c('0x24'),'keyType':_0x3d2c('0x4'),'keyContent':'','variableName':_0x3d2c('0x25')},{'type':_0x3d2c('0x9'),'content':'','key':_0x3d2c('0x26'),'keyType':_0x3d2c('0x4'),'keyContent':'','variableName':_0x3d2c('0x27')},{'type':_0x3d2c('0x9'),'content':'','key':_0x3d2c('0x28'),'keyType':'variable','keyContent':'','variableName':_0x3d2c('0x29')}];break;}}return _0x56f1ad;}; \ No newline at end of file +var _0x559f=['destcalleridnum','getDescriptions','keyValue','calleridnum','calleridname','Call\x20To','destexten','Queue','UniqueId','***\x20Agent\x20Info\x20***','Agent\x20Name','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','uniqueid','Date','starttime','Answer\x20Time','Duration','duration','Billable\x20Time','billableseconds','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','queue','push','outbound','string'];(function(_0x5759ec,_0x6ede11){var _0x1b7edb=function(_0x6f8b98){while(--_0x6f8b98){_0x5759ec['push'](_0x5759ec['shift']());}};_0x1b7edb(++_0x6ede11);}(_0x559f,0x116));var _0xf559=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x559f[_0x3dd15e];return _0x231fd0;};'use strict';exports['getSubjects']=function(_0x1b55fe,_0x40fe70){var _0xb80f2d=[{'type':'string','content':_0xf559('0x0'),'variableName':null}];switch(_0x1b55fe[_0xf559('0x1')]()){case _0xf559('0x2'):switch(_0x40fe70[_0xf559('0x1')]()){case _0xf559('0x3'):_0xb80f2d['push']({'type':_0xf559('0x4'),'content':'','variableName':_0xf559('0x5')});_0xb80f2d[_0xf559('0x6')]({'type':_0xf559('0x4'),'content':'','variableName':'calleridnum'});break;case _0xf559('0x7'):_0xb80f2d['push']({'type':_0xf559('0x8'),'content':'Outbound\x20Call','variableName':null});_0xb80f2d[_0xf559('0x6')]({'type':_0xf559('0x4'),'content':'','variableName':_0xf559('0x9')});break;}}return _0xb80f2d;};exports[_0xf559('0xa')]=function(_0x2e2375,_0x5575ea){var _0xacf61f=[];switch(_0x2e2375['toLowerCase']()){case _0xf559('0x2'):switch(_0x5575ea['toLowerCase']()){case _0xf559('0x3'):_0xacf61f=[{'type':_0xf559('0x8'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xf559('0xb'),'content':'','key':'Caller\x20Number','keyType':_0xf559('0x4'),'variableName':_0xf559('0xc')},{'type':_0xf559('0xb'),'content':'','key':'Caller\x20Name','keyType':'variable','variableName':_0xf559('0xd')},{'type':_0xf559('0xb'),'content':'','key':_0xf559('0xe'),'keyType':_0xf559('0x4'),'variableName':_0xf559('0xf')},{'type':'keyValue','content':'','key':_0xf559('0x10'),'keyType':_0xf559('0x4'),'variableName':'queue'},{'type':_0xf559('0xb'),'content':'','key':_0xf559('0x11'),'keyType':_0xf559('0x4'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':'variable','variableName':'agentcalledAt'},{'type':_0xf559('0x8'),'content':_0xf559('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0xf559('0xb'),'content':'','key':_0xf559('0x13'),'keyType':_0xf559('0x4'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':'Agent\x20Number','keyType':'variable','variableName':_0xf559('0x9')},{'type':'string','content':_0xf559('0x14'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xf559('0x15'),'keyType':_0xf559('0x4'),'variableName':_0xf559('0x16')},{'type':'keyValue','content':'','key':_0xf559('0x17'),'keyType':_0xf559('0x4'),'variableName':_0xf559('0x18')},{'type':_0xf559('0xb'),'content':'','key':'Agent\x20Complete','keyType':_0xf559('0x4'),'variableName':_0xf559('0x19')},{'type':'keyValue','content':'','key':_0xf559('0x1a'),'keyType':_0xf559('0x4'),'variableName':_0xf559('0x1b')},{'type':_0xf559('0xb'),'content':'','key':_0xf559('0x1c'),'keyType':_0xf559('0x4'),'variableName':_0xf559('0x1d')}];break;case'outbound':_0xacf61f=[{'type':_0xf559('0x8'),'content':_0xf559('0x1e'),'variableName':null},{'type':_0xf559('0xb'),'content':'','key':_0xf559('0x1f'),'keyType':_0xf559('0x4'),'keyContent':'','variableName':_0xf559('0x9')},{'type':_0xf559('0xb'),'content':'','key':_0xf559('0x20'),'keyType':_0xf559('0x4'),'keyContent':'','variableName':'membername'},{'type':_0xf559('0xb'),'content':'','key':_0xf559('0x11'),'keyType':_0xf559('0x4'),'keyContent':'','variableName':_0xf559('0x21')},{'type':_0xf559('0xb'),'content':'','key':_0xf559('0x22'),'keyType':_0xf559('0x4'),'keyContent':'','variableName':_0xf559('0x23')},{'type':_0xf559('0x8'),'content':_0xf559('0x14')},{'type':'keyValue','content':'','key':_0xf559('0x24'),'keyType':_0xf559('0x4'),'keyContent':'','variableName':'answertime'},{'type':_0xf559('0xb'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0xf559('0xb'),'content':'','key':_0xf559('0x25'),'keyType':_0xf559('0x4'),'keyContent':'','variableName':_0xf559('0x26')},{'type':_0xf559('0xb'),'content':'','key':_0xf559('0x27'),'keyType':'variable','keyContent':'','variableName':_0xf559('0x28')}];break;}}return _0xacf61f;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 16489ed..b21d1cc 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0be9=['stringify','null','Interaction','findOne','then','update','info','catch','error','tracked','user','query','clone','body','omit','html','phone','fax','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role'];(function(_0x2f14db,_0x5b73d1){var _0x452eea=function(_0x432dc9){while(--_0x432dc9){_0x2f14db['push'](_0x2f14db['shift']());}};_0x452eea(++_0x5b73d1);}(_0x0be9,0x15c));var _0x90be=function(_0x179233,_0x3a50d4){_0x179233=_0x179233-0x0;var _0x4f8da5=_0x0be9[_0x179233];return _0x4f8da5;};'use strict';var _=require('lodash');var db=require(_0x90be('0x0'))['db'];var loggers={'openchannel':require(_0x90be('0x1'))('openchannel-interactions'),'mail':require(_0x90be('0x1'))(_0x90be('0x2')),'fax':require(_0x90be('0x1'))(_0x90be('0x3')),'sms':require(_0x90be('0x1'))(_0x90be('0x4')),'chat':require(_0x90be('0x1'))(_0x90be('0x5')),'whatsapp':require('../../config/logger')(_0x90be('0x6'))};function getInteractionId(_0x55b4c6,_0x30d2cf,_0x4e67fd){if(_0x55b4c6&&_0x55b4c6[_[_0x90be('0x7')](_0x4e67fd)+_0x90be('0x8')]){return _0x55b4c6[_[_0x90be('0x7')](_0x4e67fd)+_0x90be('0x8')];}else if(_0x55b4c6&&_0x55b4c6['id']){return _0x55b4c6['id'];}else if(_0x30d2cf&&_0x30d2cf['id']){return _0x30d2cf['id'];}else{return _0x90be('0x9');}}function log(_0x11c15c,_0x4b296e,_0x32829f,_0x590aa6,_0xd57a3,_0x3dbf48){loggers[_0xd57a3[_0x90be('0xa')]()][_0x11c15c](_0x90be('0xb'),_0x3dbf48[_0x90be('0xc')](),_0x4b296e?_0x4b296e['id']:null,_0x4b296e?_0x4b296e[_0x90be('0xd')]:null,_0x4b296e?_0x4b296e[_0x90be('0xe')]:null,getInteractionId(_0x32829f,_0x590aa6,_0xd57a3),_0x32829f?JSON[_0x90be('0xf')](_0x32829f):_0x90be('0x10'));}function updateUser(_0xe512e5,_0x358001,_0x440a22,_0x54e946,_0x5ba0fa){db[_['upperFirst'](_0x54e946)+_0x90be('0x11')][_0x90be('0x12')]({'where':{'id':getInteractionId(_0x358001,_0x440a22,_0x54e946)}})[_0x90be('0x13')](function(_0x124066){if(_0x124066){return _0x124066[_0x90be('0x14')]({'UserId':_0xe512e5?_0xe512e5['id']:null});}})[_0x90be('0x13')](function(_0x2cc2c9){if(_0x2cc2c9){log(_0x90be('0x15'),_0xe512e5,_0x358001,_0x440a22,_0x54e946,_0x5ba0fa);}})[_0x90be('0x16')](function(){log(_0x90be('0x17'),_0xe512e5,_0x358001,_0x440a22,_0x54e946,_0x5ba0fa);});}exports[_0x90be('0x18')]=function(_0xf233d0,_0x47858a){return function(_0x7812ca,_0x6f6051,_0x111866){var _0x19826e=_0x7812ca[_0x90be('0x19')];var _0xc93691={};var _0x5641d8=_0x7812ca[_0x90be('0x1a')];if(_0xc93691){_0xc93691=_[_0x90be('0x1b')](_0x7812ca[_0x90be('0x1c')]);_0xc93691=_[_0x90be('0x1d')](_0xc93691,['body',_0x90be('0x1e'),_0x90be('0x1f'),_0x90be('0x20'),'mobile']);}updateUser(_0x19826e,_0xc93691,_0x5641d8,_0xf233d0,_0x47858a);_0x111866(null);};}; \ No newline at end of file +var _0xecea=['name','role','stringify','null','Interaction','findOne','then','update','info','catch','error','tracked','query','clone','body','omit','html','phone','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase'];(function(_0x48c1f6,_0x487f44){var _0x30bdcf=function(_0x279605){while(--_0x279605){_0x48c1f6['push'](_0x48c1f6['shift']());}};_0x30bdcf(++_0x487f44);}(_0xecea,0x11b));var _0xaece=function(_0x52fa85,_0x13d239){_0x52fa85=_0x52fa85-0x0;var _0x3e679b=_0xecea[_0x52fa85];return _0x3e679b;};'use strict';var _=require(_0xaece('0x0'));var db=require(_0xaece('0x1'))['db'];var loggers={'openchannel':require(_0xaece('0x2'))(_0xaece('0x3')),'mail':require(_0xaece('0x2'))(_0xaece('0x4')),'fax':require(_0xaece('0x2'))(_0xaece('0x5')),'sms':require(_0xaece('0x2'))(_0xaece('0x6')),'chat':require('../../config/logger')(_0xaece('0x7')),'whatsapp':require(_0xaece('0x2'))('whatsapp-interactions')};function getInteractionId(_0x59b486,_0x3ff499,_0x127515){if(_0x59b486&&_0x59b486[_[_0xaece('0x8')](_0x127515)+'InteractionId']){return _0x59b486[_[_0xaece('0x8')](_0x127515)+_0xaece('0x9')];}else if(_0x59b486&&_0x59b486['id']){return _0x59b486['id'];}else if(_0x3ff499&&_0x3ff499['id']){return _0x3ff499['id'];}else{return _0xaece('0xa');}}function log(_0xa7eb74,_0x432502,_0x5d64e5,_0x3ee2db,_0x3ba062,_0x43c7d6){loggers[_0x3ba062[_0xaece('0xb')]()][_0xa7eb74](_0xaece('0xc'),_0x43c7d6[_0xaece('0xd')](),_0x432502?_0x432502['id']:null,_0x432502?_0x432502[_0xaece('0xe')]:null,_0x432502?_0x432502[_0xaece('0xf')]:null,getInteractionId(_0x5d64e5,_0x3ee2db,_0x3ba062),_0x5d64e5?JSON[_0xaece('0x10')](_0x5d64e5):_0xaece('0x11'));}function updateUser(_0x5939fa,_0x3daf3d,_0x58f1a0,_0x1ddc51,_0x1ad399){db[_[_0xaece('0x8')](_0x1ddc51)+_0xaece('0x12')][_0xaece('0x13')]({'where':{'id':getInteractionId(_0x3daf3d,_0x58f1a0,_0x1ddc51)}})[_0xaece('0x14')](function(_0x3ef25b){if(_0x3ef25b){return _0x3ef25b[_0xaece('0x15')]({'UserId':_0x5939fa?_0x5939fa['id']:null});}})[_0xaece('0x14')](function(_0x13efa0){if(_0x13efa0){log(_0xaece('0x16'),_0x5939fa,_0x3daf3d,_0x58f1a0,_0x1ddc51,_0x1ad399);}})[_0xaece('0x17')](function(){log(_0xaece('0x18'),_0x5939fa,_0x3daf3d,_0x58f1a0,_0x1ddc51,_0x1ad399);});}exports[_0xaece('0x19')]=function(_0x537e21,_0x2b7ec1){return function(_0x2714a7,_0xb574a7,_0xa3c41){var _0x498599=_0x2714a7['user'];var _0x430de0={};var _0x10d884=_0x2714a7[_0xaece('0x1a')];if(_0x430de0){_0x430de0=_[_0xaece('0x1b')](_0x2714a7[_0xaece('0x1c')]);_0x430de0=_[_0xaece('0x1d')](_0x430de0,[_0xaece('0x1c'),_0xaece('0x1e'),_0xaece('0x1f'),'fax',_0xaece('0x20')]);}updateUser(_0x498599,_0x430de0,_0x10d884,_0x537e21,_0x2b7ec1);_0xa3c41(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 7314c54..34ddb6e 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4dcb=['use','then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty'];(function(_0x4840cd,_0x4bcd9e){var _0x2b4952=function(_0x4c52d0){while(--_0x4c52d0){_0x4840cd['push'](_0x4840cd['shift']());}};_0x2b4952(++_0x4bcd9e);}(_0x4dcb,0x186));var _0xb4dc=function(_0x10574a,_0x28fd92){_0x10574a=_0x10574a-0x0;var _0x2e3a7e=_0x4dcb[_0x10574a];return _0x2e3a7e;};'use strict';var crypto=require('crypto');var util=require(_0xb4dc('0x0'));var compose=require(_0xb4dc('0x1'));var db=require(_0xb4dc('0x2'))['db'];var config=require(_0xb4dc('0x3'));function getValueFromLicense(_0x183583,_0x1fad90){if(_0x183583&&_0x1fad90){if(_0x1fad90[_0xb4dc('0x4')]&&_0x1fad90[_0xb4dc('0x5')]){var _0x161991=_0x1fad90['data1'];var _0x5c031c=_0x1fad90[_0xb4dc('0x5')];var _0x5be4d1=_0x161991[_0xb4dc('0x6')]('-')[0x4];var _0x14790e=_0x161991[_0xb4dc('0x6')]('-')[0x0];var _0x34c857=crypto[_0xb4dc('0x7')](_0xb4dc('0x8'),util['format'](_0xb4dc('0x9'),_0x5be4d1,_0x161991,_0x14790e));var _0x43e354=_0x34c857[_0xb4dc('0xa')](_0x5c031c,_0xb4dc('0xb'),_0xb4dc('0xc'));_0x43e354+=_0x34c857[_0xb4dc('0xd')](_0xb4dc('0xc'));var _0x2f6e88=JSON[_0xb4dc('0xe')](_0x43e354);return _0x2f6e88[_0xb4dc('0xf')](_0x183583)?_0x2f6e88[_0x183583]:null;}}return null;}function isLimit(_0x2730ca,_0x29fff0,_0x41bc3c,_0x5d5ec0){var _0x17669f=_0x29fff0;return compose()[_0xb4dc('0x10')](function(_0x186a6d,_0x311af9,_0x242f58){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0xb4dc('0x11')](function(_0x1ecca2){var _0x2144c4=getValueFromLicense(_0x2730ca,_0x1ecca2);return _0x2144c4?_0x2144c4:_0x17669f;})[_0xb4dc('0x11')](function(_0x35e5dd){_0x17669f=_0x35e5dd;return _0x41bc3c[_0xb4dc('0x12')](_0x5d5ec0);})['then'](function(_0x5da161){if(_0x5da161>=_0x17669f){return _0x311af9[_0xb4dc('0x13')](0x193)[_0xb4dc('0x14')]({'message':util[_0xb4dc('0x15')](_0xb4dc('0x16'),_0x2730ca)});}_0x242f58();})[_0xb4dc('0x17')](function(_0x218f72){_0x242f58(_0x218f72);});});}function isUserLimit(){return isLimit(_0xb4dc('0x18'),0x1,db[_0xb4dc('0x19')],{'where':{'$or':[{'role':_0xb4dc('0x1a')},{'role':_0xb4dc('0x1b')}]}});}exports[_0xb4dc('0x1c')]=isUserLimit; \ No newline at end of file +var _0x8635=['aes-256-ctr','%s:%s:%s','update','final','utf8','parse','hasOwnProperty','use','License','findOne','then','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','isUserLimit','util','composable-middleware','license','data1','split','createDecipher'];(function(_0x2af981,_0x59d094){var _0x5d30b9=function(_0x9df5e3){while(--_0x9df5e3){_0x2af981['push'](_0x2af981['shift']());}};_0x5d30b9(++_0x59d094);}(_0x8635,0x90));var _0x5863=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0x8635[_0xadde88];return _0x3b8eb6;};'use strict';var crypto=require('crypto');var util=require(_0x5863('0x0'));var compose=require(_0x5863('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x8e44ed,_0x447e95){if(_0x8e44ed&&_0x447e95){if(_0x447e95['data1']&&_0x447e95[_0x5863('0x2')]){var _0x4324d=_0x447e95[_0x5863('0x3')];var _0x4628bc=_0x447e95[_0x5863('0x2')];var _0x5433c4=_0x4324d[_0x5863('0x4')]('-')[0x4];var _0x2fc374=_0x4324d[_0x5863('0x4')]('-')[0x0];var _0x2c5a0f=crypto[_0x5863('0x5')](_0x5863('0x6'),util['format'](_0x5863('0x7'),_0x5433c4,_0x4324d,_0x2fc374));var _0x4c6061=_0x2c5a0f[_0x5863('0x8')](_0x4628bc,'base64','utf8');_0x4c6061+=_0x2c5a0f[_0x5863('0x9')](_0x5863('0xa'));var _0x296b49=JSON[_0x5863('0xb')](_0x4c6061);return _0x296b49[_0x5863('0xc')](_0x8e44ed)?_0x296b49[_0x8e44ed]:null;}}return null;}function isLimit(_0x37b531,_0x39c061,_0x4c5222,_0x5671d1){var _0x5e4b0e=_0x39c061;return compose()[_0x5863('0xd')](function(_0x216baf,_0x56eb3e,_0x53ab22){return db[_0x5863('0xe')][_0x5863('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x5863('0x10')](function(_0x1b8493){var _0x43ca88=getValueFromLicense(_0x37b531,_0x1b8493);return _0x43ca88?_0x43ca88:_0x5e4b0e;})[_0x5863('0x10')](function(_0x264ee8){_0x5e4b0e=_0x264ee8;return _0x4c5222['count'](_0x5671d1);})[_0x5863('0x10')](function(_0x2fc079){if(_0x2fc079>=_0x5e4b0e){return _0x56eb3e[_0x5863('0x11')](0x193)[_0x5863('0x12')]({'message':util[_0x5863('0x13')](_0x5863('0x14'),_0x37b531)});}_0x53ab22();})[_0x5863('0x15')](function(_0x28707e){_0x53ab22(_0x28707e);});});}function isUserLimit(){return isLimit(_0x5863('0x16'),0x1,db[_0x5863('0x17')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x5863('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 298d026..7f9bc0a 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 _0x4456=['YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$startsWith','LIKE\x20?','>\x20?','$lte','$gte','>=\x20?','start','$endsWith','shift','utcOffset','hours','minutes','seconds','lodash','parseSearch','startsWith','[$or]','and','replace','[$and]','length','split','slice','forEach','match','filter','map','conditions','push','buildExpression','operator','$eq','$between','value','includes','$gt','add','days','format'];(function(_0x3abf6b,_0x2c77e3){var _0x36f046=function(_0x16c7a5){while(--_0x16c7a5){_0x3abf6b['push'](_0x3abf6b['shift']());}};_0x36f046(++_0x2c77e3);}(_0x4456,0x11e));var _0x6445=function(_0x19a975,_0x4cde36){_0x19a975=_0x19a975-0x0;var _0x180281=_0x4456[_0x19a975];return _0x180281;};'use strict';var _=require(_0x6445('0x0'));var moment=require('moment');exports[_0x6445('0x1')]=function(_0x295335){var _0x312a5e={'conditions':[]};_0x312a5e['sqlOperator']=_[_0x6445('0x2')](_0x295335,_0x6445('0x3'))?'or':_0x6445('0x4');var _0x537088=_0x295335[_0x6445('0x5')](_0x6445('0x6'),'')[_0x6445('0x5')]('[$or]','')['split']('||');for(var _0x545e88=0x0;_0x545e88<_0x537088[_0x6445('0x7')];_0x545e88++){var _0x2d050c=_0x537088[_0x545e88][_0x6445('0x8')](':=');var _0x4f37cb=_0x2d050c[0x0];var _0x514693=_0x2d050c[_0x6445('0x9')](0x1);_0x514693[_0x6445('0xa')](function(_0x28ee71){var _0x200bd0=_0x28ee71['split']('[')['shift']();var _0x17b014=_0x28ee71[_0x6445('0xb')](/\[(.*?)\]/g);_0x17b014[_0x6445('0xa')](function(_0x598cec){var _0x763128=_0x598cec[_0x6445('0x8')]('[')[_0x6445('0xc')](function(_0x28ebe0){return _0x28ebe0['indexOf'](']')>-0x1;})[_0x6445('0xd')](function(_0x2176ef){return _0x2176ef[_0x6445('0x8')](']')[0x0];})[0x0];_0x312a5e[_0x6445('0xe')][_0x6445('0xf')]({'field':_0x4f37cb,'operator':_0x200bd0,'value':_0x763128});});});}return _0x312a5e;};exports[_0x6445('0x10')]=function(_0x1f818c,_0x7a9422,_0x2986b5){var _0x8d66f0={};if(_0x7a9422==='DATE'){if(_0x2986b5[_0x6445('0x11')]===_0x6445('0x12')){_0x2986b5[_0x6445('0x11')]=_0x6445('0x13');_0x2986b5[_0x6445('0x14')]+=','+_0x2986b5[_0x6445('0x14')];}else if(_[_0x6445('0x15')]([_0x6445('0x16'),'$lte'],_0x2986b5[_0x6445('0x11')])){_0x2986b5[_0x6445('0x14')]=moment(_0x2986b5[_0x6445('0x14')])[_0x6445('0x17')](0x1,_0x6445('0x18'))[_0x6445('0x19')](_0x6445('0x1a'));}}if(_0x2986b5[_0x6445('0x1b')]){_0x7a9422=_0x2986b5[_0x6445('0x1b')];_0x8d66f0[_0x6445('0x1c')]=_0x6445('0x1d')+_0x1f818c+'.'+_0x2986b5[_0x6445('0x1e')]+_0x6445('0x1f')+_0x2986b5[_0x6445('0x1b')]+')\x20'+parseOperator(_0x2986b5['operator']);}else{_0x8d66f0[_0x6445('0x1c')]=_0x1f818c+'.'+_0x2986b5[_0x6445('0x1e')]+'\x20'+parseOperator(_0x2986b5[_0x6445('0x11')]);}if(_[_0x6445('0x15')]([_0x6445('0x20'),_0x6445('0x21')],_0x2986b5[_0x6445('0x11')]))_0x8d66f0[_0x6445('0x1c')]='('+_0x8d66f0[_0x6445('0x1c')]+'\x20OR\x20'+_0x1f818c+'.'+_0x2986b5[_0x6445('0x1e')]+_0x6445('0x22');_0x8d66f0[_0x6445('0x14')]=parseValue(_0x7a9422,_0x2986b5[_0x6445('0x11')],_0x2986b5['value']);return _0x8d66f0;};function parseOperator(_0x2c9407){var _0x5686b4;switch(_0x2c9407){case _0x6445('0x23'):_0x5686b4=_0x6445('0x24');break;case _0x6445('0x21'):_0x5686b4=_0x6445('0x25');break;case _0x6445('0x12'):_0x5686b4='=\x20?';break;case'$ne':_0x5686b4=_0x6445('0x26');break;case'$substring':case _0x6445('0x27'):case'$endsWith':_0x5686b4=_0x6445('0x28');break;case'$lt':_0x5686b4='<\x20?';break;case _0x6445('0x16'):_0x5686b4=_0x6445('0x29');break;case _0x6445('0x2a'):_0x5686b4='<=\x20?';break;case _0x6445('0x2b'):_0x5686b4=_0x6445('0x2c');break;case'$between':_0x5686b4='BETWEEN\x20?\x20AND\x20?';break;}return _0x5686b4;}function parseValue(_0x332443,_0x55912a,_0x509861){var _0x41081c={'start':undefined,'end':undefined};switch(_0x55912a){case _0x6445('0x23'):case _0x6445('0x21'):_0x41081c['start']=_0x509861[_0x6445('0x8')](',');break;case'$substring':_0x41081c[_0x6445('0x2d')]='%'+_0x509861+'%';break;case _0x6445('0x27'):_0x41081c[_0x6445('0x2d')]=_0x509861+'%';break;case _0x6445('0x2e'):_0x41081c[_0x6445('0x2d')]='%'+_0x509861;break;case _0x6445('0x13'):var _0x4bd517=_0x509861[_0x6445('0x8')](',');var _0x509861=_0x4bd517[_0x6445('0x2f')]();var _0x1bc7df=_0x4bd517['pop']();if(_0x332443==='DATE'){_0x509861=moment(_0x509861)['utcOffset'](0x0,!![])[_0x6445('0x19')]();_0x1bc7df=moment(_0x1bc7df)[_0x6445('0x30')](0x0,!![])[_0x6445('0x17')](0x17,_0x6445('0x31'))[_0x6445('0x17')](0x3b,_0x6445('0x32'))['add'](0x3b,_0x6445('0x33'))[_0x6445('0x19')]();}_0x41081c={'start':_0x509861,'end':_0x1bc7df};break;default:_0x41081c[_0x6445('0x2d')]=_0x509861;break;}return _0x41081c;} \ No newline at end of file +var _0xbe3e=['lodash','moment','sqlOperator','startsWith','[$or]','and','replace','split','length','shift','filter','indexOf','map','conditions','DATE','operator','$between','value','includes','add','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$startsWith','$endsWith','$lt','<\x20?','>\x20?','$lte','<=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$substring','utcOffset','format','hours','minutes','seconds'];(function(_0x2587ca,_0x231303){var _0x5aada1=function(_0x2d21e1){while(--_0x2d21e1){_0x2587ca['push'](_0x2587ca['shift']());}};_0x5aada1(++_0x231303);}(_0xbe3e,0x1c2));var _0xebe3=function(_0x15193d,_0x13ba1f){_0x15193d=_0x15193d-0x0;var _0xfa2c0=_0xbe3e[_0x15193d];return _0xfa2c0;};'use strict';var _=require(_0xebe3('0x0'));var moment=require(_0xebe3('0x1'));exports['parseSearch']=function(_0x50f3bb){var _0x4b8b1f={'conditions':[]};_0x4b8b1f[_0xebe3('0x2')]=_[_0xebe3('0x3')](_0x50f3bb,_0xebe3('0x4'))?'or':_0xebe3('0x5');var _0x180a80=_0x50f3bb[_0xebe3('0x6')]('[$and]','')[_0xebe3('0x6')]('[$or]','')[_0xebe3('0x7')]('||');for(var _0x3d150e=0x0;_0x3d150e<_0x180a80[_0xebe3('0x8')];_0x3d150e++){var _0x2775e4=_0x180a80[_0x3d150e][_0xebe3('0x7')](':=');var _0x2b688c=_0x2775e4[0x0];var _0x538784=_0x2775e4['slice'](0x1);_0x538784['forEach'](function(_0x36f92e){var _0xfd1e07=_0x36f92e['split']('[')[_0xebe3('0x9')]();var _0x2402fd=_0x36f92e['match'](/\[(.*?)\]/g);_0x2402fd['forEach'](function(_0x1a83c7){var _0x803ad1=_0x1a83c7['split']('[')[_0xebe3('0xa')](function(_0x2b18f0){return _0x2b18f0[_0xebe3('0xb')](']')>-0x1;})[_0xebe3('0xc')](function(_0x27b30b){return _0x27b30b[_0xebe3('0x7')](']')[0x0];})[0x0];_0x4b8b1f[_0xebe3('0xd')]['push']({'field':_0x2b688c,'operator':_0xfd1e07,'value':_0x803ad1});});});}return _0x4b8b1f;};exports['buildExpression']=function(_0x5cb968,_0x2e5c68,_0x28e43f){var _0x1a857d={};if(_0x2e5c68===_0xebe3('0xe')){if(_0x28e43f[_0xebe3('0xf')]==='$eq'){_0x28e43f[_0xebe3('0xf')]=_0xebe3('0x10');_0x28e43f['value']+=','+_0x28e43f[_0xebe3('0x11')];}else if(_[_0xebe3('0x12')](['$gt','$lte'],_0x28e43f[_0xebe3('0xf')])){_0x28e43f['value']=moment(_0x28e43f[_0xebe3('0x11')])[_0xebe3('0x13')](0x1,'days')['format'](_0xebe3('0x14'));}}if(_0x28e43f[_0xebe3('0x15')]){_0x2e5c68=_0x28e43f[_0xebe3('0x15')];_0x1a857d[_0xebe3('0x16')]=_0xebe3('0x17')+_0x5cb968+'.'+_0x28e43f[_0xebe3('0x18')]+_0xebe3('0x19')+_0x28e43f[_0xebe3('0x15')]+')\x20'+parseOperator(_0x28e43f['operator']);}else{_0x1a857d[_0xebe3('0x16')]=_0x5cb968+'.'+_0x28e43f[_0xebe3('0x18')]+'\x20'+parseOperator(_0x28e43f['operator']);}if(_[_0xebe3('0x12')]([_0xebe3('0x1a'),_0xebe3('0x1b')],_0x28e43f[_0xebe3('0xf')]))_0x1a857d[_0xebe3('0x16')]='('+_0x1a857d[_0xebe3('0x16')]+_0xebe3('0x1c')+_0x5cb968+'.'+_0x28e43f[_0xebe3('0x18')]+'\x20IS\x20NULL)';_0x1a857d[_0xebe3('0x11')]=parseValue(_0x2e5c68,_0x28e43f['operator'],_0x28e43f[_0xebe3('0x11')]);return _0x1a857d;};function parseOperator(_0x12033d){var _0x5aa76f;switch(_0x12033d){case'$in':_0x5aa76f=_0xebe3('0x1d');break;case'$notIn':_0x5aa76f=_0xebe3('0x1e');break;case _0xebe3('0x1f'):_0x5aa76f=_0xebe3('0x20');break;case'$ne':_0x5aa76f=_0xebe3('0x21');break;case'$substring':case _0xebe3('0x22'):case _0xebe3('0x23'):_0x5aa76f='LIKE\x20?';break;case _0xebe3('0x24'):_0x5aa76f=_0xebe3('0x25');break;case'$gt':_0x5aa76f=_0xebe3('0x26');break;case _0xebe3('0x27'):_0x5aa76f=_0xebe3('0x28');break;case'$gte':_0x5aa76f='>=\x20?';break;case'$between':_0x5aa76f=_0xebe3('0x29');break;}return _0x5aa76f;}function parseValue(_0x412e80,_0x582edb,_0x338f15){var _0x724fad={'start':undefined,'end':undefined};switch(_0x582edb){case _0xebe3('0x2a'):case _0xebe3('0x1b'):_0x724fad[_0xebe3('0x2b')]=_0x338f15[_0xebe3('0x7')](',');break;case _0xebe3('0x2c'):_0x724fad[_0xebe3('0x2b')]='%'+_0x338f15+'%';break;case'$startsWith':_0x724fad[_0xebe3('0x2b')]=_0x338f15+'%';break;case'$endsWith':_0x724fad[_0xebe3('0x2b')]='%'+_0x338f15;break;case _0xebe3('0x10'):var _0x16a2c5=_0x338f15['split'](',');var _0x338f15=_0x16a2c5['shift']();var _0x11f976=_0x16a2c5['pop']();if(_0x412e80===_0xebe3('0xe')){_0x338f15=moment(_0x338f15)[_0xebe3('0x2d')](0x0,!![])[_0xebe3('0x2e')]();_0x11f976=moment(_0x11f976)['utcOffset'](0x0,!![])[_0xebe3('0x13')](0x17,_0xebe3('0x2f'))[_0xebe3('0x13')](0x3b,_0xebe3('0x30'))[_0xebe3('0x13')](0x3b,_0xebe3('0x31'))['format']();}_0x724fad={'start':_0x338f15,'end':_0x11f976};break;default:_0x724fad[_0xebe3('0x2b')]=_0x338f15;break;}return _0x724fad;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index f76bbb2..8d1cc14 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 _0xabec=['isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','sort','map','indexOf','priority','cast','col','DESC','unsigned','ASC','omit','length','isObject','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','push','join','getOptions','query','$id','intersection','model','attributes','hasOwnProperty','nolimit','limit','offset','order','where','pick','filter','columns','merge','type','VIRTUAL','lower','sequelize','keys','fields','split','filters','forOwn','find','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabec,0x15a));var _0xcabe=function(_0x149ad5,_0x12b417){_0x149ad5=_0x149ad5-0x0;var _0x2566b7=_0xabec[_0x149ad5];return _0x2566b7;};'use strict';var _=require('lodash');var sequelize=require(_0xcabe('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x566f14){var _0x23babb=['ne'];try{var _0x2f6366=JSON['parse'](_0x566f14);var _0x1cac37=Object[_0xcabe('0x1')](_0x2f6366)[0x0];return _0x23babb['includes'](_0x1cac37);}catch(_0x27c9fe){return![];}}function getOperatorValue(_0x38336d){var _0x52718d=JSON['parse'](_0x38336d);var _0x31f103=Object[_0xcabe('0x1')](_0x52718d)[0x0];var _0x21c741=_0x52718d[_0x31f103];return{['$'+_0x31f103]:_0x21c741};}exports[_0xcabe('0x2')]=function(_0x24a399){var _0x5ea1c5=null;if(_0x24a399){_0x5ea1c5=_0x24a399[_0xcabe('0x3')](',');}return _0x5ea1c5;};exports[_0xcabe('0x4')]=function(_0x35c101,_0x595b85){var _0x4d9cdf={};if(!_['isEmpty'](_0x35c101)){_[_0xcabe('0x5')](_0x35c101,function(_0x4419a8,_0x860756){try{if(_0x595b85){var _0x3570ef=_[_0xcabe('0x6')](_0x595b85,{'name':_0x860756})||{};if(hasSequelizeOperator(_0x4419a8)){_0x4d9cdf[_0x860756]=getOperatorValue(_0x4419a8);}else if(_0x3570ef['type']===_0xcabe('0x7')&&_[_0xcabe('0x8')](_0x4419a8)){var _0x28f492=JSON[_0xcabe('0x9')](_0x4419a8);var _0x134ff8={'$gte':moment(moment(_0x28f492[_0xcabe('0xa')])[_0xcabe('0xb')](_0xcabe('0xc')))[_0xcabe('0xd')]()[_0xcabe('0xb')](),'$lte':moment(moment(_0x28f492[_0xcabe('0xe')])[_0xcabe('0xb')](_0xcabe('0xc')))[_0xcabe('0xd')]()[_0xcabe('0xf')](0x1,'s')[_0xcabe('0xb')]()};_0x4d9cdf[_0x860756]=_0x134ff8;}else if(_0x3570ef[_0xcabe('0x10')]===_0xcabe('0x11')){_0x4d9cdf[_0x860756]=_0x4419a8;}else{_0x4d9cdf[_0x860756]=_['isArray'](_0x4419a8)?_0x4419a8:JSON['parse'](_0x4419a8);}}else{_0x4d9cdf[_0x860756]=_[_0xcabe('0x12')](_0x4419a8)?_0x4419a8:JSON['parse'](_0x4419a8);}}catch(_0x5ef260){_0x4d9cdf[_0x860756]=_0x4419a8[_0xcabe('0x3')](',');}});}return _0x4d9cdf;};exports['limit']=function(_0x445fe5){_0x445fe5=parseInt(_0x445fe5,0xa);if(!_0x445fe5||_0x445fe5<0x0){_0x445fe5=LIMIT_VALUE;}return _0x445fe5;};exports['offset']=function(_0x38c846){_0x38c846=parseInt(_0x38c846,0xa);if(!_0x38c846||_0x38c846<0x0){_0x38c846=0x0;}return _0x38c846;};exports[_0xcabe('0x13')]=function(_0x598706){var _0x1918f9,_0xba0085=null;if(_0x598706){_0x1918f9=_0x598706[_0xcabe('0x3')](',');_0xba0085=_[_0xcabe('0x14')](_0x1918f9,function(_0x164c6a){if(_0x164c6a[_0xcabe('0x15')]('-')===0x0){return[_0x164c6a===_0xcabe('0x16')?sequelize[_0xcabe('0x17')](sequelize[_0xcabe('0x18')](_0xcabe('0x16')),'unsigned'):_0x164c6a['substr'](0x1),_0xcabe('0x19')];}else{return[_0x164c6a===_0xcabe('0x16')?sequelize[_0xcabe('0x17')](sequelize[_0xcabe('0x18')]('priority'),_0xcabe('0x1a')):_0x164c6a,_0xcabe('0x1b')];}});}return _0xba0085;};exports[_0xcabe('0x1c')]=function(_0x3abd01,_0x7e26e8){if(_['isEmpty'](_0x3abd01)){return _0x3abd01;}if(_[_0xcabe('0x12')](_0x3abd01)){for(var _0x395938=0x0;_0x395938<_0x3abd01[_0xcabe('0x1d')];_0x395938+=0x1){_0x3abd01[_0x395938]=this['omit'](_0x3abd01[_0x395938],_0x7e26e8);}return _0x3abd01;}if(!_[_0xcabe('0x1e')](_0x3abd01)){return _0x3abd01;}if(_['isString'](_0x7e26e8)){_0x7e26e8=[_0x7e26e8];}if(!_[_0xcabe('0x12')](_0x7e26e8)){return _0x3abd01;}for(var _0x5c0d0c=0x0;_0x5c0d0c<_0x7e26e8[_0xcabe('0x1d')];_0x5c0d0c+=0x1){_[_0xcabe('0x1f')](_0x3abd01,_0x7e26e8[_0x5c0d0c]);}for(var _0x111cd1 in _0x3abd01){if(_0x3abd01['hasOwnProperty'](_0x111cd1)){_0x3abd01[_0x111cd1]=this['omit'](_0x3abd01[_0x111cd1],_0x7e26e8);}}return _0x3abd01;};exports[_0xcabe('0x20')]=function(_0x838bd8){return _0x838bd8[_0xcabe('0x21')](RegExp(_0xcabe('0x22')))?!![]:![];};exports[_0xcabe('0x23')]=function(_0x3dfc8d){return _0x3dfc8d[_0xcabe('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0xcabe('0x24')]=function(_0x2bc002){var _0x3d31ae=[];_0x2bc002[_0xcabe('0x3')](/[ ,]+/)[_0xcabe('0x25')](function(_0x5ad104){_0x5ad104=_0x5ad104['replace'](/([^:]")"+/g,'$1');_0x5ad104='+'+_0x5ad104+'*';if(_0x5ad104['includes']('@'))_0x5ad104='\x22'+_0x5ad104+'\x22';_0x3d31ae[_0xcabe('0x26')](_0x5ad104);});return _0x3d31ae[_0xcabe('0x27')]('\x20');};exports[_0xcabe('0x28')]=function(_0x5756d0,_0x3cb04f,_0xcc05a){var _0x4327d4={},_0x39f0be={};if(_0x3cb04f[_0xcabe('0x29')][_0xcabe('0x2a')]){_0x3cb04f[_0xcabe('0x29')]['id']=_0x3cb04f[_0xcabe('0x29')][_0xcabe('0x2a')];delete _0x3cb04f[_0xcabe('0x29')][_0xcabe('0x2a')];}_0x4327d4['model']=_['map'](_0x5756d0,_0xcabe('0x10'));_0x4327d4['query']=_[_0xcabe('0x1')](_0x3cb04f[_0xcabe('0x29')]);_0x4327d4[_0xcabe('0x4')]=_[_0xcabe('0x2b')](_0x4327d4[_0xcabe('0x2c')],_0x4327d4[_0xcabe('0x29')]);_0x39f0be[_0xcabe('0x2d')]=_[_0xcabe('0x2b')](_0x4327d4[_0xcabe('0x2c')],this['fields'](_0x3cb04f[_0xcabe('0x29')][_0xcabe('0x2')]));_0x39f0be[_0xcabe('0x2d')]=_0x39f0be[_0xcabe('0x2d')][_0xcabe('0x1d')]?_0x39f0be['attributes']:_0x4327d4[_0xcabe('0x2c')];if(!_0x3cb04f[_0xcabe('0x29')][_0xcabe('0x2e')](_0xcabe('0x2f'))){_0x39f0be[_0xcabe('0x30')]=this[_0xcabe('0x30')](_0x3cb04f['query'][_0xcabe('0x30')]);_0x39f0be[_0xcabe('0x31')]=this[_0xcabe('0x31')](_0x3cb04f[_0xcabe('0x29')][_0xcabe('0x31')]);}_0x39f0be[_0xcabe('0x32')]=this[_0xcabe('0x13')](_0x3cb04f[_0xcabe('0x29')][_0xcabe('0x13')]);_0x39f0be[_0xcabe('0x33')]=this[_0xcabe('0x4')](_[_0xcabe('0x34')](_0x3cb04f[_0xcabe('0x29')],_0x4327d4[_0xcabe('0x4')]),_0x5756d0);if(_0x3cb04f[_0xcabe('0x29')]['filter']){var _0x8e7a21=_0x5756d0;var _0x517ed8=_0x3cb04f[_0xcabe('0x29')][_0xcabe('0x35')];if(typeof _0x517ed8==='object'){_0x8e7a21=_[_0xcabe('0x35')](_0x5756d0,function(_0x303b0c){return _['includes'](_0x517ed8[_0xcabe('0x36')],_0x303b0c[_0xcabe('0x10')]);});_0x517ed8=_0x517ed8['value'];}_0x39f0be[_0xcabe('0x33')]=_[_0xcabe('0x37')](_0x39f0be[_0xcabe('0x33')],{'$or':_[_0xcabe('0x14')](_0x8e7a21,function(_0x3a3bbf){if(_0x3a3bbf[_0xcabe('0x38')]!==_0xcabe('0x39')){if(_0xcc05a){return sequelize[_0xcabe('0x33')](sequelize['fn'](_0xcabe('0x3a'),sequelize[_0xcabe('0x18')](_0x3a3bbf[_0xcabe('0x10')])),{'$like':sequelize['fn'](_0xcabe('0x3a'),'%'+_0x3cb04f[_0xcabe('0x29')]['filter']+'%')});}else{var _0x1507b4={};_0x1507b4[_0x3a3bbf[_0xcabe('0x10')]]={'$like':'%'+_0x3cb04f[_0xcabe('0x29')][_0xcabe('0x35')]+'%'};return _0x1507b4;}}})});}_0x39f0be=_['merge']({},_0x39f0be,_0x3cb04f['options']);return _0x39f0be;}; \ No newline at end of file +var _0xee65=['$lte','utc','subtract','name','uniqueid','isArray','split','offset','sort','map','cast','col','priority','unsigned','substr','DESC','omit','unset','isNumeric','isEmail','getFullTextValue','forEach','push','getOptions','query','$id','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','pick','filter','object','columns','value','merge','where','type','lower','lodash','sequelize','parse','includes','keys','filters','isEmpty','forOwn','DATE','isPlainObject','$gte','YYYY-MM-DD','format'];(function(_0x2244e7,_0x3fd34e){var _0x15a15d=function(_0x5dc3c4){while(--_0x5dc3c4){_0x2244e7['push'](_0x2244e7['shift']());}};_0x15a15d(++_0x3fd34e);}(_0xee65,0x1bb));var _0x5ee6=function(_0x49e9b9,_0x4c4d38){_0x49e9b9=_0x49e9b9-0x0;var _0x34828a=_0xee65[_0x49e9b9];return _0x34828a;};'use strict';var _=require(_0x5ee6('0x0'));var sequelize=require(_0x5ee6('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3c6305){var _0xb9be80=['ne'];try{var _0x38234b=JSON[_0x5ee6('0x2')](_0x3c6305);var _0x58d65c=Object['keys'](_0x38234b)[0x0];return _0xb9be80[_0x5ee6('0x3')](_0x58d65c);}catch(_0x46075c){return![];}}function getOperatorValue(_0x2be5ff){var _0x2bc8ac=JSON[_0x5ee6('0x2')](_0x2be5ff);var _0x23f518=Object[_0x5ee6('0x4')](_0x2bc8ac)[0x0];var _0x577fad=_0x2bc8ac[_0x23f518];return{['$'+_0x23f518]:_0x577fad};}exports['fields']=function(_0x56002a){var _0x564863=null;if(_0x56002a){_0x564863=_0x56002a['split'](',');}return _0x564863;};exports[_0x5ee6('0x5')]=function(_0x4d4679,_0x30f8aa){var _0x24a718={};if(!_[_0x5ee6('0x6')](_0x4d4679)){_[_0x5ee6('0x7')](_0x4d4679,function(_0x3bb6aa,_0x36e398){try{if(_0x30f8aa){var _0x26a56f=_['find'](_0x30f8aa,{'name':_0x36e398})||{};if(hasSequelizeOperator(_0x3bb6aa)){_0x24a718[_0x36e398]=getOperatorValue(_0x3bb6aa);}else if(_0x26a56f['type']===_0x5ee6('0x8')&&_[_0x5ee6('0x9')](_0x3bb6aa)){var _0x29ddfa=JSON[_0x5ee6('0x2')](_0x3bb6aa);var _0x6201d1={'$gte':moment(moment(_0x29ddfa[_0x5ee6('0xa')])['format'](_0x5ee6('0xb')))['utc']()[_0x5ee6('0xc')](),'$lte':moment(moment(_0x29ddfa[_0x5ee6('0xd')])[_0x5ee6('0xc')](_0x5ee6('0xb')))[_0x5ee6('0xe')]()[_0x5ee6('0xf')](0x1,'s')['format']()};_0x24a718[_0x36e398]=_0x6201d1;}else if(_0x26a56f[_0x5ee6('0x10')]===_0x5ee6('0x11')){_0x24a718[_0x36e398]=_0x3bb6aa;}else{_0x24a718[_0x36e398]=_['isArray'](_0x3bb6aa)?_0x3bb6aa:JSON[_0x5ee6('0x2')](_0x3bb6aa);}}else{_0x24a718[_0x36e398]=_[_0x5ee6('0x12')](_0x3bb6aa)?_0x3bb6aa:JSON['parse'](_0x3bb6aa);}}catch(_0xc8c9bd){_0x24a718[_0x36e398]=_0x3bb6aa[_0x5ee6('0x13')](',');}});}return _0x24a718;};exports['limit']=function(_0x37df73){_0x37df73=parseInt(_0x37df73,0xa);if(!_0x37df73||_0x37df73<0x0){_0x37df73=LIMIT_VALUE;}return _0x37df73;};exports[_0x5ee6('0x14')]=function(_0x3f54dc){_0x3f54dc=parseInt(_0x3f54dc,0xa);if(!_0x3f54dc||_0x3f54dc<0x0){_0x3f54dc=0x0;}return _0x3f54dc;};exports[_0x5ee6('0x15')]=function(_0x17ca06){var _0x244ed9,_0x11e3d9=null;if(_0x17ca06){_0x244ed9=_0x17ca06[_0x5ee6('0x13')](',');_0x11e3d9=_[_0x5ee6('0x16')](_0x244ed9,function(_0x2e3436){if(_0x2e3436['indexOf']('-')===0x0){return[_0x2e3436==='priority'?sequelize[_0x5ee6('0x17')](sequelize[_0x5ee6('0x18')](_0x5ee6('0x19')),_0x5ee6('0x1a')):_0x2e3436[_0x5ee6('0x1b')](0x1),_0x5ee6('0x1c')];}else{return[_0x2e3436===_0x5ee6('0x19')?sequelize[_0x5ee6('0x17')](sequelize['col'](_0x5ee6('0x19')),_0x5ee6('0x1a')):_0x2e3436,'ASC'];}});}return _0x11e3d9;};exports[_0x5ee6('0x1d')]=function(_0x51d7c4,_0x1ea90c){if(_[_0x5ee6('0x6')](_0x51d7c4)){return _0x51d7c4;}if(_[_0x5ee6('0x12')](_0x51d7c4)){for(var _0x28286e=0x0;_0x28286e<_0x51d7c4['length'];_0x28286e+=0x1){_0x51d7c4[_0x28286e]=this['omit'](_0x51d7c4[_0x28286e],_0x1ea90c);}return _0x51d7c4;}if(!_['isObject'](_0x51d7c4)){return _0x51d7c4;}if(_['isString'](_0x1ea90c)){_0x1ea90c=[_0x1ea90c];}if(!_[_0x5ee6('0x12')](_0x1ea90c)){return _0x51d7c4;}for(var _0x5f3084=0x0;_0x5f3084<_0x1ea90c['length'];_0x5f3084+=0x1){_[_0x5ee6('0x1e')](_0x51d7c4,_0x1ea90c[_0x5f3084]);}for(var _0x25e565 in _0x51d7c4){if(_0x51d7c4['hasOwnProperty'](_0x25e565)){_0x51d7c4[_0x25e565]=this[_0x5ee6('0x1d')](_0x51d7c4[_0x25e565],_0x1ea90c);}}return _0x51d7c4;};exports[_0x5ee6('0x1f')]=function(_0x5801ca){return _0x5801ca['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x5ee6('0x20')]=function(_0x4961c2){return _0x4961c2['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x5ee6('0x21')]=function(_0x5df88e){var _0x572153=[];_0x5df88e['split'](/[ ,]+/)[_0x5ee6('0x22')](function(_0x11e75d){_0x11e75d=_0x11e75d['replace'](/([^:]")"+/g,'$1');_0x11e75d='+'+_0x11e75d+'*';if(_0x11e75d[_0x5ee6('0x3')]('@'))_0x11e75d='\x22'+_0x11e75d+'\x22';_0x572153[_0x5ee6('0x23')](_0x11e75d);});return _0x572153['join']('\x20');};exports[_0x5ee6('0x24')]=function(_0x31797f,_0x58d76f,_0x3aeb09){var _0x117323={},_0x19ea63={};if(_0x58d76f[_0x5ee6('0x25')]['$id']){_0x58d76f[_0x5ee6('0x25')]['id']=_0x58d76f[_0x5ee6('0x25')][_0x5ee6('0x26')];delete _0x58d76f['query'][_0x5ee6('0x26')];}_0x117323[_0x5ee6('0x27')]=_[_0x5ee6('0x16')](_0x31797f,_0x5ee6('0x10'));_0x117323['query']=_[_0x5ee6('0x4')](_0x58d76f[_0x5ee6('0x25')]);_0x117323[_0x5ee6('0x5')]=_[_0x5ee6('0x28')](_0x117323[_0x5ee6('0x27')],_0x117323[_0x5ee6('0x25')]);_0x19ea63['attributes']=_[_0x5ee6('0x28')](_0x117323[_0x5ee6('0x27')],this['fields'](_0x58d76f[_0x5ee6('0x25')][_0x5ee6('0x29')]));_0x19ea63[_0x5ee6('0x2a')]=_0x19ea63[_0x5ee6('0x2a')][_0x5ee6('0x2b')]?_0x19ea63[_0x5ee6('0x2a')]:_0x117323[_0x5ee6('0x27')];if(!_0x58d76f['query'][_0x5ee6('0x2c')](_0x5ee6('0x2d'))){_0x19ea63[_0x5ee6('0x2e')]=this['limit'](_0x58d76f[_0x5ee6('0x25')][_0x5ee6('0x2e')]);_0x19ea63['offset']=this[_0x5ee6('0x14')](_0x58d76f[_0x5ee6('0x25')]['offset']);}_0x19ea63[_0x5ee6('0x2f')]=this[_0x5ee6('0x15')](_0x58d76f[_0x5ee6('0x25')][_0x5ee6('0x15')]);_0x19ea63['where']=this[_0x5ee6('0x5')](_[_0x5ee6('0x30')](_0x58d76f[_0x5ee6('0x25')],_0x117323[_0x5ee6('0x5')]),_0x31797f);if(_0x58d76f[_0x5ee6('0x25')][_0x5ee6('0x31')]){var _0x469b20=_0x31797f;var _0x263ac8=_0x58d76f[_0x5ee6('0x25')][_0x5ee6('0x31')];if(typeof _0x263ac8===_0x5ee6('0x32')){_0x469b20=_[_0x5ee6('0x31')](_0x31797f,function(_0xeb8549){return _[_0x5ee6('0x3')](_0x263ac8[_0x5ee6('0x33')],_0xeb8549['name']);});_0x263ac8=_0x263ac8[_0x5ee6('0x34')];}_0x19ea63['where']=_[_0x5ee6('0x35')](_0x19ea63[_0x5ee6('0x36')],{'$or':_[_0x5ee6('0x16')](_0x469b20,function(_0x478fd3){if(_0x478fd3[_0x5ee6('0x37')]!=='VIRTUAL'){if(_0x3aeb09){return sequelize[_0x5ee6('0x36')](sequelize['fn'](_0x5ee6('0x38'),sequelize[_0x5ee6('0x18')](_0x478fd3['name'])),{'$like':sequelize['fn'](_0x5ee6('0x38'),'%'+_0x58d76f[_0x5ee6('0x25')]['filter']+'%')});}else{var _0x246a32={};_0x246a32[_0x478fd3[_0x5ee6('0x10')]]={'$like':'%'+_0x58d76f[_0x5ee6('0x25')][_0x5ee6('0x31')]+'%'};return _0x246a32;}}})});}_0x19ea63=_[_0x5ee6('0x35')]({},_0x19ea63,_0x58d76f['options']);return _0x19ea63;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 59b6d63..afa55ce 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6c8=['initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','production','set','appPath','join','public','root','client','use','toISOString','split','static','/server/views','engine','html','ejs','view\x20engine','urlencoded','json','50mb'];(function(_0x10fcbb,_0x4cca39){var _0x16232d=function(_0x500da0){while(--_0x500da0){_0x10fcbb['push'](_0x10fcbb['shift']());}};_0x16232d(++_0x4cca39);}(_0xd6c8,0x16c));var _0x8d6c=function(_0x557f5f,_0x31d8e7){_0x557f5f=_0x557f5f-0x0;var _0x196eba=_0xd6c8[_0x557f5f];return _0x196eba;};'use strict';var express=require(_0x8d6c('0x0'));var favicon=require(_0x8d6c('0x1'));var bodyParser=require(_0x8d6c('0x2'));var methodOverride=require(_0x8d6c('0x3'));var cookieParser=require(_0x8d6c('0x4'));var errorHandler=require(_0x8d6c('0x5'));var path=require(_0x8d6c('0x6'));var passport=require(_0x8d6c('0x7'));var cors=require(_0x8d6c('0x8'));var moment=require(_0x8d6c('0x9'));var config=require(_0x8d6c('0xa'));var db=require(_0x8d6c('0xb'))['db'];exports[_0x8d6c('0xc')]=function(_0x5c04d5){var _0x2bfcfe=_0x5c04d5['get']('env');if(_0x2bfcfe===_0x8d6c('0xd')){_0x5c04d5[_0x8d6c('0xe')](_0x8d6c('0xf'),path[_0x8d6c('0x10')](config['root'],_0x8d6c('0x11')));}if(_0x2bfcfe==='development'||_0x2bfcfe==='test'){_0x5c04d5['set'](_0x8d6c('0xf'),path[_0x8d6c('0x10')](config[_0x8d6c('0x12')],_0x8d6c('0x13')));_0x5c04d5[_0x8d6c('0x14')](errorHandler());}_0x5c04d5[_0x8d6c('0xe')]('json\x20replacer',function(_0x16c942,_0x371591){if(this[_0x16c942]instanceof Date){_0x371591=this[_0x16c942][_0x8d6c('0x15')]()[_0x8d6c('0x16')]('.')[0x0]+'Z';}return _0x371591;});_0x5c04d5['use'](express[_0x8d6c('0x17')](_0x5c04d5['get']('appPath')));_0x5c04d5[_0x8d6c('0xe')]('views',config['root']+_0x8d6c('0x18'));_0x5c04d5[_0x8d6c('0x19')](_0x8d6c('0x1a'),require(_0x8d6c('0x1b'))['renderFile']);_0x5c04d5[_0x8d6c('0xe')](_0x8d6c('0x1c'),'html');_0x5c04d5['use'](bodyParser[_0x8d6c('0x1d')]({'limit':'50mb','extended':!![]}));_0x5c04d5[_0x8d6c('0x14')](bodyParser[_0x8d6c('0x1e')]({'limit':_0x8d6c('0x1f')}));_0x5c04d5[_0x8d6c('0x14')](cors());_0x5c04d5['use'](methodOverride());_0x5c04d5[_0x8d6c('0x14')](cookieParser());_0x5c04d5[_0x8d6c('0x14')](passport[_0x8d6c('0x20')]());}; \ No newline at end of file +var _0x6fa5=['root','public','development','test','use','json\x20replacer','toISOString','split','static','views','html','renderFile','view\x20engine','urlencoded','50mb','json','initialize','serve-favicon','body-parser','method-override','cookie-parser','path','passport','cors','./environment','../mysqldb','default','get','env','production','set','appPath','join'];(function(_0x3c36a7,_0x5716d3){var _0x51a883=function(_0x3f3625){while(--_0x3f3625){_0x3c36a7['push'](_0x3c36a7['shift']());}};_0x51a883(++_0x5716d3);}(_0x6fa5,0x74));var _0x56fa=function(_0x47ac42,_0x1c351a){_0x47ac42=_0x47ac42-0x0;var _0x2d93ec=_0x6fa5[_0x47ac42];return _0x2d93ec;};'use strict';var express=require('express');var favicon=require(_0x56fa('0x0'));var bodyParser=require(_0x56fa('0x1'));var methodOverride=require(_0x56fa('0x2'));var cookieParser=require(_0x56fa('0x3'));var errorHandler=require('errorhandler');var path=require(_0x56fa('0x4'));var passport=require(_0x56fa('0x5'));var cors=require(_0x56fa('0x6'));var moment=require('moment');var config=require(_0x56fa('0x7'));var db=require(_0x56fa('0x8'))['db'];exports[_0x56fa('0x9')]=function(_0x47fb2e){var _0x27e5ff=_0x47fb2e[_0x56fa('0xa')](_0x56fa('0xb'));if(_0x27e5ff===_0x56fa('0xc')){_0x47fb2e[_0x56fa('0xd')](_0x56fa('0xe'),path[_0x56fa('0xf')](config[_0x56fa('0x10')],_0x56fa('0x11')));}if(_0x27e5ff===_0x56fa('0x12')||_0x27e5ff===_0x56fa('0x13')){_0x47fb2e[_0x56fa('0xd')](_0x56fa('0xe'),path['join'](config['root'],'client'));_0x47fb2e[_0x56fa('0x14')](errorHandler());}_0x47fb2e[_0x56fa('0xd')](_0x56fa('0x15'),function(_0x23fa63,_0x4f6dfe){if(this[_0x23fa63]instanceof Date){_0x4f6dfe=this[_0x23fa63][_0x56fa('0x16')]()[_0x56fa('0x17')]('.')[0x0]+'Z';}return _0x4f6dfe;});_0x47fb2e[_0x56fa('0x14')](express[_0x56fa('0x18')](_0x47fb2e['get'](_0x56fa('0xe'))));_0x47fb2e[_0x56fa('0xd')](_0x56fa('0x19'),config['root']+'/server/views');_0x47fb2e['engine'](_0x56fa('0x1a'),require('ejs')[_0x56fa('0x1b')]);_0x47fb2e[_0x56fa('0xd')](_0x56fa('0x1c'),_0x56fa('0x1a'));_0x47fb2e['use'](bodyParser[_0x56fa('0x1d')]({'limit':_0x56fa('0x1e'),'extended':!![]}));_0x47fb2e[_0x56fa('0x14')](bodyParser[_0x56fa('0x1f')]({'limit':'50mb'}));_0x47fb2e[_0x56fa('0x14')](cors());_0x47fb2e['use'](methodOverride());_0x47fb2e[_0x56fa('0x14')](cookieParser());_0x47fb2e[_0x56fa('0x14')](passport[_0x56fa('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index b870859..e2dc434 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 _0x5d29=['concat','mac','00:00:00:00:00:00','address','127.0.0.1','map','model','createHash','md5','update','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','substring','bimedia-machine-uuid','execSync','../environment','orderBy','keys','family','IPv4','internal'];(function(_0x2f19d1,_0x2867df){var _0x9fd241=function(_0x181c13){while(--_0x181c13){_0x2f19d1['push'](_0x2f19d1['shift']());}};_0x9fd241(++_0x2867df);}(_0x5d29,0xca));var _0x95d2=function(_0x594751,_0x3b5010){_0x594751=_0x594751-0x0;var _0x4c2d07=_0x5d29[_0x594751];return _0x4c2d07;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x95d2('0x0'));var exec=require('child_process')[_0x95d2('0x1')];var config=require(_0x95d2('0x2'));function getInterfaces(){var _0x43b645=[];var _0x11c134=os['networkInterfaces']();var _0x26043d=_[_0x95d2('0x3')](_[_0x95d2('0x4')](_0x11c134));for(var _0xd1328b=0x0;_0xd1328b<_0x26043d['length'];_0xd1328b++){var _0x3a674c=_0x11c134[_0x26043d[_0xd1328b]]['filter'](function(_0x2139a8){return _0x2139a8[_0x95d2('0x5')]===_0x95d2('0x6')&&_0x2139a8[_0x95d2('0x7')]===![];});_0x43b645=_0x43b645[_0x95d2('0x8')](_0x3a674c);}return _0x43b645;}function getFirstInterface(){var _0x1f924d=_['head'](getInterfaces());return{'macAddress':_0x1f924d&&_0x1f924d[_0x95d2('0x9')]?_0x1f924d[_0x95d2('0x9')]:_0x95d2('0xa'),'ipAddress':_0x1f924d&&_0x1f924d[_0x95d2('0xb')]?_0x1f924d['address']:_0x95d2('0xc')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xb6f2de=_[_0x95d2('0x3')](os['cpus']()[_0x95d2('0xd')](function(_0x563b16){return _0x563b16[_0x95d2('0xe')];}))['join'](':');return crypto[_0x95d2('0xf')](_0x95d2('0x10'))[_0x95d2('0x11')](_0xb6f2de)['digest'](_0x95d2('0x12'));}exports[_0x95d2('0x13')]=function(){var _0x45c4c4=os[_0x95d2('0x14')]();var _0x8d147a=/[0-9a-f-]{36}/;if(config[_0x95d2('0x15')]&&_0x8d147a[_0x95d2('0x16')](config[_0x95d2('0x15')])){return config['licenseToken'];}else if(_0x45c4c4===_0x95d2('0x17')){return exec(_0x95d2('0x18'),{'encoding':'utf8'})[_0x95d2('0x19')]('\x0d\x0a','');}else{var _0xa1e85=getFirstInterface();var _0x1ebb4a=getCPUhash();var _0x3cbcfe=_0x1ebb4a+'|'+os[_0x95d2('0x1a')]()+'|'+_0xa1e85[_0x95d2('0x1b')]+'|'+_0xa1e85[_0x95d2('0x1c')];var _0x2c83f5=crypto[_0x95d2('0xf')](_0x95d2('0x10'))[_0x95d2('0x11')](_0x3cbcfe)['digest']('hex');return _0x2c83f5[_0x95d2('0x1d')](0x0,0x8)+'-'+_0x2c83f5[_0x95d2('0x1d')](0x8,0xc)+'-'+_0x2c83f5['substring'](0xc,0x10)+'-'+_0x2c83f5[_0x95d2('0x1d')](0x10,0x14)+'-'+_0x2c83f5['substring'](0x14);}}; \ No newline at end of file +var _0xbc35=['replace','ipAddress','md5','digest','hex','substring','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','join','createHash','update','getUuid','licenseToken','dmidecode\x20--string\x20system-uuid'];(function(_0x21ba0e,_0x16ec33){var _0x25257b=function(_0x476642){while(--_0x476642){_0x21ba0e['push'](_0x21ba0e['shift']());}};_0x25257b(++_0x16ec33);}(_0xbc35,0x172));var _0x5bc3=function(_0x4d4008,_0x520e7e){_0x4d4008=_0x4d4008-0x0;var _0x2c4984=_0xbc35[_0x4d4008];return _0x2c4984;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x5bc3('0x0'));var machine=require(_0x5bc3('0x1'));var exec=require('child_process')[_0x5bc3('0x2')];var config=require(_0x5bc3('0x3'));function getInterfaces(){var _0x30ef4a=[];var _0x3cd52a=os[_0x5bc3('0x4')]();var _0x3351c6=_[_0x5bc3('0x5')](_[_0x5bc3('0x6')](_0x3cd52a));for(var _0x77177e=0x0;_0x77177e<_0x3351c6[_0x5bc3('0x7')];_0x77177e++){var _0x174ca1=_0x3cd52a[_0x3351c6[_0x77177e]][_0x5bc3('0x8')](function(_0xc4160c){return _0xc4160c[_0x5bc3('0x9')]==='IPv4'&&_0xc4160c['internal']===![];});_0x30ef4a=_0x30ef4a['concat'](_0x174ca1);}return _0x30ef4a;}function getFirstInterface(){var _0x21443=_[_0x5bc3('0xa')](getInterfaces());return{'macAddress':_0x21443&&_0x21443[_0x5bc3('0xb')]?_0x21443['mac']:_0x5bc3('0xc'),'ipAddress':_0x21443&&_0x21443['address']?_0x21443[_0x5bc3('0xd')]:_0x5bc3('0xe')};}exports[_0x5bc3('0xf')]=getFirstInterface;function getCPUhash(){var _0x3fb177=_[_0x5bc3('0x5')](os['cpus']()['map'](function(_0x17b747){return _0x17b747['model'];}))[_0x5bc3('0x10')](':');return crypto[_0x5bc3('0x11')]('md5')[_0x5bc3('0x12')](_0x3fb177)['digest']('hex');}exports[_0x5bc3('0x13')]=function(){var _0x2670db=os['platform']();var _0x10a014=/[0-9a-f-]{36}/;if(config[_0x5bc3('0x14')]&&_0x10a014['test'](config[_0x5bc3('0x14')])){return config[_0x5bc3('0x14')];}else if(_0x2670db==='win32'){return exec(_0x5bc3('0x15'),{'encoding':'utf8'})[_0x5bc3('0x16')]('\x0d\x0a','');}else{var _0x56ef84=getFirstInterface();var _0xb55e08=getCPUhash();var _0x65cdd0=_0xb55e08+'|'+os['hostname']()+'|'+_0x56ef84['macAddress']+'|'+_0x56ef84[_0x5bc3('0x17')];var _0x41b999=crypto['createHash'](_0x5bc3('0x18'))[_0x5bc3('0x12')](_0x65cdd0)[_0x5bc3('0x19')](_0x5bc3('0x1a'));return _0x41b999['substring'](0x0,0x8)+'-'+_0x41b999[_0x5bc3('0x1b')](0x8,0xc)+'-'+_0x41b999[_0x5bc3('0x1b')](0xc,0x10)+'-'+_0x41b999[_0x5bc3('0x1b')](0x10,0x14)+'-'+_0x41b999[_0x5bc3('0x1b')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index f83498b..8d3f269 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 _0x432c=['request-promise','bluebird','version','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','get','data1','data2','active','info','update','Disabled','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','encryptString','YYYY-MM-DD\x20HH:mm','diff','days','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','message','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x432c,0xfa));var _0xc432=function(_0x4cefc8,_0x16d44e){_0x4cefc8=_0x4cefc8-0x0;var _0xe9ccd5=_0x432c[_0x4cefc8];return _0xe9ccd5;};'use strict';var util=require(_0xc432('0x0'));var moment=require(_0xc432('0x1'));var rp=require(_0xc432('0x2'));var BPromise=require(_0xc432('0x3'));var pkginfo=require('pkginfo')(module,_0xc432('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xc432('0x5'));var hardware=require(_0xc432('0x6'));var logger=require(_0xc432('0x7'))(_0xc432('0x8'));var HOST=_0xc432('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x36689d){return new BPromise(function(_0x478064,_0x3d00e7){var _0xb13016=util[_0xc432('0xa')](_0xc432('0xb'),HOST,_0x36689d,module['exports'][_0xc432('0x4')]);if(oldToken){_0xb13016=util['format'](_0xc432('0xc'),HOST,_0x36689d,module[_0xc432('0xd')]['version'],oldToken);}var _0x3fecee={'uri':_0xb13016,'method':_0xc432('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x3fecee)[_0xc432('0xf')](function(_0x24c3d4){_0x478064(_0x24c3d4);})['catch'](function(_0x328416){_0x3d00e7(_0x328416);});});}function manageLicense(_0x4e4d53,_0x4eef10){var _0x45c9de=_0x4eef10[_0xc432('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x45c9de[_0xc432('0x11')]!==_0x4e4d53&&!_0x45c9de[_0xc432('0x12')]){oldToken=_0x45c9de[_0xc432('0x11')];}httpRequest(_0x4e4d53)[_0xc432('0xf')](function(_0x513a9c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x513a9c[_0xc432('0x13')]){isOldTokenSent=![];if(!_0x45c9de[_0xc432('0x8')]&&_0x45c9de['license']!=_0x513a9c[_0xc432('0x8')]||_0x45c9de[_0xc432('0x8')]&&_0x45c9de[_0xc432('0x12')]){logger[_0xc432('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x45c9de[_0xc432('0x8')]&&!_0x45c9de[_0xc432('0x12')]&&_0x45c9de[_0xc432('0x8')]!=_0x513a9c[_0xc432('0x8')]){logger[_0xc432('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x45c9de[_0xc432('0x8')]&&!_0x45c9de[_0xc432('0x12')]&&_0x45c9de[_0xc432('0x8')]==_0x513a9c[_0xc432('0x8')]){return _0x4eef10;}return _0x4eef10[_0xc432('0x15')]({'data1':_0x4e4d53,'data2':null,'license':_0x513a9c[_0xc432('0x8')]});}else{if(_0x513a9c[_0xc432('0x8')]||_0x45c9de['license']){if(!_0x45c9de['data2']){if(_0x45c9de[_0xc432('0x11')]==_0x4e4d53){GRAY_PERIOD_REASON=_0xc432('0x16');logger[_0xc432('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0xc432('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x45c9de[_0xc432('0x11')],_0x4e4d53);}logger[_0xc432('0x14')](_0xc432('0x17'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xc432('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x4eef10[_0xc432('0x15')]({'data2':encryptor[_0xc432('0x18')](moment()['format'](_0xc432('0x19')))});}else{if(moment()[_0xc432('0x1a')](encryptor['decryptString'](_0x45c9de[_0xc432('0x12')]),_0xc432('0x1b'))>DAYS){logger[_0xc432('0x14')]('DEMO\x20START\x20AT\x20%s',moment()[_0xc432('0xa')](_0xc432('0x19')));isOldTokenSent=![];return _0x4eef10['update']({'data1':_0x4e4d53,'data2':null,'license':null});}}}else{if(_0x45c9de['data1']!=_0x4e4d53){logger[_0xc432('0x14')](_0xc432('0x1c'),_0x45c9de['data1'],_0x4e4d53);return _0x4eef10[_0xc432('0x15')]({'data1':_0x4e4d53,'data2':null,'license':null});}}}return _0x4eef10;})[_0xc432('0xf')](function(_0x8b2e2b){_0x4eef10=_0x8b2e2b;})[_0xc432('0x1d')](function(_0x3484fd){logger['error'](_0x3484fd[_0xc432('0x1e')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xc432('0x1f')](),_0x4eef10);},TIME);});}function defaultLicense(){var _0x3a09ab=hardware[_0xc432('0x1f')]();if(_0x3a09ab){return db[_0xc432('0x20')][_0xc432('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x3a09ab}})['spread'](function(_0x58d496,_0x2aa968){logger['info'](_0xc432('0x22'),_0x3a09ab);manageLicense(_0x3a09ab,_0x58d496);})['catch'](function(_0x12ea9a){logger['error'](_0x12ea9a['message']);});}}exports[_0xc432('0x23')]=defaultLicense; \ No newline at end of file +var _0xb853=['SERVICE\x20LICENSE\x20STARTED\x20%s','message','util','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data2','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','getUuid','License','spread'];(function(_0x2b98d4,_0x1de753){var _0x76ce5b=function(_0x5bfe11){while(--_0x5bfe11){_0x2b98d4['push'](_0x2b98d4['shift']());}};_0x76ce5b(++_0x1de753);}(_0xb853,0x17e));var _0x3b85=function(_0x5658dd,_0x5b0265){_0x5658dd=_0x5658dd-0x0;var _0x1052f3=_0xb853[_0x5658dd];return _0x1052f3;};'use strict';var util=require(_0x3b85('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x3b85('0x1'));var db=require(_0x3b85('0x2'))['db'];var encryptor=require(_0x3b85('0x3'));var hardware=require(_0x3b85('0x4'));var logger=require(_0x3b85('0x5'))(_0x3b85('0x6'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4c0ef8){return new BPromise(function(_0x535e4e,_0x45ee95){var _0x555473=util[_0x3b85('0x7')](_0x3b85('0x8'),HOST,_0x4c0ef8,module[_0x3b85('0x9')][_0x3b85('0x1')]);if(oldToken){_0x555473=util[_0x3b85('0x7')](_0x3b85('0xa'),HOST,_0x4c0ef8,module[_0x3b85('0x9')][_0x3b85('0x1')],oldToken);}var _0xb916={'uri':_0x555473,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0xb916)[_0x3b85('0xb')](function(_0x420f99){_0x535e4e(_0x420f99);})[_0x3b85('0xc')](function(_0x1e99c6){_0x45ee95(_0x1e99c6);});});}function manageLicense(_0x20c59a,_0x14d2ca){var _0x398ea0=_0x14d2ca[_0x3b85('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x398ea0['data1']!==_0x20c59a&&!_0x398ea0[_0x3b85('0xe')]){oldToken=_0x398ea0[_0x3b85('0xf')];}httpRequest(_0x20c59a)[_0x3b85('0xb')](function(_0x22b3bc){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x22b3bc[_0x3b85('0x10')]){isOldTokenSent=![];if(!_0x398ea0[_0x3b85('0x6')]&&_0x398ea0[_0x3b85('0x6')]!=_0x22b3bc['license']||_0x398ea0['license']&&_0x398ea0[_0x3b85('0xe')]){logger[_0x3b85('0x11')](_0x3b85('0x12'));}if(_0x398ea0[_0x3b85('0x6')]&&!_0x398ea0[_0x3b85('0xe')]&&_0x398ea0[_0x3b85('0x6')]!=_0x22b3bc[_0x3b85('0x6')]){logger[_0x3b85('0x11')](_0x3b85('0x13'));}if(_0x398ea0[_0x3b85('0x6')]&&!_0x398ea0[_0x3b85('0xe')]&&_0x398ea0[_0x3b85('0x6')]==_0x22b3bc[_0x3b85('0x6')]){return _0x14d2ca;}return _0x14d2ca[_0x3b85('0x14')]({'data1':_0x20c59a,'data2':null,'license':_0x22b3bc[_0x3b85('0x6')]});}else{if(_0x22b3bc[_0x3b85('0x6')]||_0x398ea0[_0x3b85('0x6')]){if(!_0x398ea0[_0x3b85('0xe')]){if(_0x398ea0['data1']==_0x20c59a){GRAY_PERIOD_REASON=_0x3b85('0x15');logger[_0x3b85('0x11')](_0x3b85('0x16'));}else{GRAY_PERIOD_REASON=_0x3b85('0x17');logger[_0x3b85('0x11')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x398ea0[_0x3b85('0xf')],_0x20c59a);}logger[_0x3b85('0x11')](_0x3b85('0x18'),GRAY_PERIOD_REASON[_0x3b85('0x19')](),moment()['format'](_0x3b85('0x1a')));return _0x14d2ca[_0x3b85('0x14')]({'data2':encryptor[_0x3b85('0x1b')](moment()[_0x3b85('0x7')](_0x3b85('0x1a')))});}else{if(moment()[_0x3b85('0x1c')](encryptor['decryptString'](_0x398ea0[_0x3b85('0xe')]),_0x3b85('0x1d'))>DAYS){logger[_0x3b85('0x11')](_0x3b85('0x1e'),moment()['format'](_0x3b85('0x1a')));isOldTokenSent=![];return _0x14d2ca[_0x3b85('0x14')]({'data1':_0x20c59a,'data2':null,'license':null});}}}else{if(_0x398ea0[_0x3b85('0xf')]!=_0x20c59a){logger[_0x3b85('0x11')](_0x3b85('0x1f'),_0x398ea0[_0x3b85('0xf')],_0x20c59a);return _0x14d2ca[_0x3b85('0x14')]({'data1':_0x20c59a,'data2':null,'license':null});}}}return _0x14d2ca;})[_0x3b85('0xb')](function(_0x11e435){_0x14d2ca=_0x11e435;})['catch'](function(_0x2c8779){logger[_0x3b85('0x20')](_0x2c8779['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x3b85('0x21')](),_0x14d2ca);},TIME);});}function defaultLicense(){var _0x54c6f9=hardware[_0x3b85('0x21')]();if(_0x54c6f9){return db[_0x3b85('0x22')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x54c6f9}})[_0x3b85('0x23')](function(_0x802f77,_0x3899d5){logger[_0x3b85('0x11')](_0x3b85('0x24'),_0x54c6f9);manageLicense(_0x54c6f9,_0x802f77);})[_0x3b85('0xc')](function(_0x507293){logger[_0x3b85('0x20')](_0x507293[_0x3b85('0x25')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 8822913..cae6cfe 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 _0x0d4d=['../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','catch','uuid','data1','license','data2','split','format','%s:%s:%s','parse','demo','machineUuid','decryptString','gray','deadline','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','user','users','forEach','admin','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0d4d,0xe7));var _0xd0d4=function(_0x3c68a1,_0x4e08b8){_0x3c68a1=_0x3c68a1-0x0;var _0x264f47=_0x0d4d[_0x3c68a1];return _0x264f47;};'use strict';var util=require('util');var _=require(_0xd0d4('0x0'));var moment=require(_0xd0d4('0x1'));var BPromise=require(_0xd0d4('0x2'));var hardware=require(_0xd0d4('0x3'));var encryptor=require(_0xd0d4('0x4'));var db=require(_0xd0d4('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd0d4('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd0d4('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd0d4('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xd0d4('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4484a7){return new BPromise(function(_0x4b13a2,_0x4068e3){return db[_0xd0d4('0x9')][_0xd0d4('0xa')](_[_0xd0d4('0xb')](_0x4484a7,{'raw':!![],'where':{'id':0x1}}))[_0xd0d4('0xc')](function(_0x4fa4c4){return checkLicense(_0x4fa4c4,null);})[_0xd0d4('0xc')](function(_0x25686b){_0x4b13a2(_0x25686b);return;})[_0xd0d4('0xd')](function(_0x25b9e7){_0x4068e3(_0x25b9e7);});});}function checkLicense(_0x1fe59f,_0x4c14cb){if(!_0x1fe59f){demoLicense[_0xd0d4('0xe')]=_0x1fe59f[_0xd0d4('0xf')];return demoLicense;}try{var _0x49d0c2=_0x4c14cb||_0x1fe59f[_0xd0d4('0x10')];if(_['isEmpty'](_0x49d0c2)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x37517b=_0x1fe59f[_0xd0d4('0xf')];var _0x37c00f=_0x1fe59f[_0xd0d4('0x11')];var _0x32b065=_0x37517b['split']('-')[0x4];var _0x59faa2=_0x37517b[_0xd0d4('0x12')]('-')[0x0];var _0x3e948a=encryptor['decryptString'](_0x49d0c2,util[_0xd0d4('0x13')](_0xd0d4('0x14'),_0x32b065,_0x37517b,_0x59faa2));var _0x16ba9a=JSON[_0xd0d4('0x15')](_0x3e948a);_0x16ba9a[_0xd0d4('0x16')]=![];_0x16ba9a[_0xd0d4('0xe')]=_0x37517b;_0x16ba9a[_0xd0d4('0x17')]=hardware[_0xd0d4('0x8')]();if(_0x37c00f){var _0x510930=encryptor[_0xd0d4('0x18')](_0x37c00f);_0x16ba9a[_0xd0d4('0x19')]=_0x510930;_0x16ba9a[_0xd0d4('0x1a')]=moment(_0x510930)['add'](0x7,_0xd0d4('0x1b'))[_0xd0d4('0x13')]();_0x16ba9a[_0xd0d4('0x1c')]=_0x16ba9a[_0xd0d4('0xe')]!=_0x16ba9a['machineUuid']?_0xd0d4('0x1d'):_0xd0d4('0x1e');}return _0x16ba9a;}catch(_0x5673d8){breakingLicense['uuid']=_0x1fe59f['data1'];breakingLicense[_0xd0d4('0x1f')]=_0x5673d8[_0xd0d4('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3c161a,_0x599a44){getLicense()['then'](function(_0x20068f){return db[_0xd0d4('0x20')][_0xd0d4('0x21')]({'attributes':[_0xd0d4('0x22'),[db[_0xd0d4('0x23')]['fn'](_0xd0d4('0x24'),db[_0xd0d4('0x23')][_0xd0d4('0x25')](_0xd0d4('0x22'))),_0xd0d4('0x26')]],'group':_0xd0d4('0x22'),'where':{'role':{'$or':['admin',_0xd0d4('0x27'),'telephone']}},'raw':!![]})[_0xd0d4('0xc')](function(_0xe09f2e){var _0xb3cea8={'user':_0x20068f[_0xd0d4('0x28')]||0x0,'telephone':_0x20068f['telephones']||0x0};_0xe09f2e[_0xd0d4('0x29')](function(_0x4f874e){var _0x2c60fe=_0x4f874e['role']===_0xd0d4('0x2a')?'user':_0x4f874e[_0xd0d4('0x22')];_0xb3cea8[_0x2c60fe]-=_0x4f874e['count'];if(_0xb3cea8[_0x2c60fe]<0x0)_0xb3cea8[_0x2c60fe]=0x0;});_0x3c161a(_0xb3cea8);return;});})[_0xd0d4('0xd')](function(_0x32ef04){_0x599a44(_0x32ef04);});});}function checkUserLimits(_0xd1f4d2){return new BPromise(function(_0x3a414d,_0x5c028f){getLimits()[_0xd0d4('0xc')](function(_0x31ae23){var _0x5be42e=_['pick'](_['countBy'](_0xd1f4d2,'role'),[_0xd0d4('0x2a'),_0xd0d4('0x27'),_0xd0d4('0x2b')]);var _0x155533=(_0x5be42e[_0xd0d4('0x2a')]||0x0)+(_0x5be42e[_0xd0d4('0x27')]||0x0);var _0x4bf40=_0x5be42e[_0xd0d4('0x2b')]||0x0;if(_0x155533>_0x31ae23[_0xd0d4('0x27')])return _0x5c028f(_0xd0d4('0x2c'));if(_0x4bf40>_0x31ae23['telephone'])return _0x5c028f(_0xd0d4('0x2d'));return _0x3a414d();})[_0xd0d4('0xd')](function(_0x22c1d0){_0x5c028f(_0x22c1d0);});});}module[_0xd0d4('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x2783=['user','users','telephones','forEach','count','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','decryptString','format','demo','gray','deadline','add','grayReason','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','admin'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0x2783,0x162));var _0x3278=function(_0x48d59e,_0x49a53a){_0x48d59e=_0x48d59e-0x0;var _0x559559=_0x2783[_0x48d59e];return _0x559559;};'use strict';var util=require(_0x3278('0x0'));var _=require(_0x3278('0x1'));var moment=require(_0x3278('0x2'));var BPromise=require(_0x3278('0x3'));var hardware=require(_0x3278('0x4'));var encryptor=require(_0x3278('0x5'));var db=require(_0x3278('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3278('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x3278('0x8'),'machineUuid':hardware[_0x3278('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3278('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x3278('0xa'),'machineUuid':hardware[_0x3278('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4446cf){return new BPromise(function(_0x3a3385,_0x419109){return db['License'][_0x3278('0xb')](_['defaults'](_0x4446cf,{'raw':!![],'where':{'id':0x1}}))[_0x3278('0xc')](function(_0x459f0e){return checkLicense(_0x459f0e,null);})[_0x3278('0xc')](function(_0x237dae){_0x3a3385(_0x237dae);return;})[_0x3278('0xd')](function(_0x5c04f9){_0x419109(_0x5c04f9);});});}function checkLicense(_0x189aa9,_0x2f2452){if(!_0x189aa9){demoLicense[_0x3278('0xe')]=_0x189aa9['data1'];return demoLicense;}try{var _0x3e53a6=_0x2f2452||_0x189aa9[_0x3278('0xf')];if(_[_0x3278('0x10')](_0x3e53a6)){throw new Error(_0x3278('0x11'));}var _0x5bfcc7=_0x189aa9[_0x3278('0x12')];var _0x1eba69=_0x189aa9[_0x3278('0x13')];var _0x15552c=_0x5bfcc7['split']('-')[0x4];var _0x582212=_0x5bfcc7['split']('-')[0x0];var _0xba5cf=encryptor[_0x3278('0x14')](_0x3e53a6,util[_0x3278('0x15')]('%s:%s:%s',_0x15552c,_0x5bfcc7,_0x582212));var _0x1b282a=JSON['parse'](_0xba5cf);_0x1b282a[_0x3278('0x16')]=![];_0x1b282a[_0x3278('0xe')]=_0x5bfcc7;_0x1b282a['machineUuid']=hardware[_0x3278('0x9')]();if(_0x1eba69){var _0x4cb62d=encryptor[_0x3278('0x14')](_0x1eba69);_0x1b282a[_0x3278('0x17')]=_0x4cb62d;_0x1b282a[_0x3278('0x18')]=moment(_0x4cb62d)[_0x3278('0x19')](0x7,'days')[_0x3278('0x15')]();_0x1b282a[_0x3278('0x1a')]=_0x1b282a[_0x3278('0xe')]!=_0x1b282a[_0x3278('0x1b')]?_0x3278('0x1c'):_0x3278('0x1d');}return _0x1b282a;}catch(_0x376e75){breakingLicense[_0x3278('0xe')]=_0x189aa9[_0x3278('0x12')];breakingLicense[_0x3278('0x1e')]=_0x376e75[_0x3278('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x246357,_0x58998b){getLicense()[_0x3278('0xc')](function(_0x2dfe22){return db[_0x3278('0x1f')][_0x3278('0x20')]({'attributes':[_0x3278('0x21'),[db[_0x3278('0x22')]['fn'](_0x3278('0x23'),db[_0x3278('0x22')][_0x3278('0x24')](_0x3278('0x21'))),'count']],'group':_0x3278('0x21'),'where':{'role':{'$or':[_0x3278('0x25'),_0x3278('0x26'),'telephone']}},'raw':!![]})[_0x3278('0xc')](function(_0x181823){var _0x2e521d={'user':_0x2dfe22[_0x3278('0x27')]||0x0,'telephone':_0x2dfe22[_0x3278('0x28')]||0x0};_0x181823[_0x3278('0x29')](function(_0x55c50a){var _0x1d080e=_0x55c50a[_0x3278('0x21')]===_0x3278('0x25')?_0x3278('0x26'):_0x55c50a[_0x3278('0x21')];_0x2e521d[_0x1d080e]-=_0x55c50a[_0x3278('0x2a')];if(_0x2e521d[_0x1d080e]<0x0)_0x2e521d[_0x1d080e]=0x0;});_0x246357(_0x2e521d);return;});})[_0x3278('0xd')](function(_0x3cdd6b){_0x58998b(_0x3cdd6b);});});}function checkUserLimits(_0x4ca62c){return new BPromise(function(_0x2da6dd,_0x5bd6ae){getLimits()[_0x3278('0xc')](function(_0x324529){var _0xea4613=_[_0x3278('0x2b')](_[_0x3278('0x2c')](_0x4ca62c,_0x3278('0x21')),[_0x3278('0x25'),_0x3278('0x26'),_0x3278('0x2d')]);var _0x4040a3=(_0xea4613[_0x3278('0x25')]||0x0)+(_0xea4613[_0x3278('0x26')]||0x0);var _0x135974=_0xea4613[_0x3278('0x2d')]||0x0;if(_0x4040a3>_0x324529[_0x3278('0x26')])return _0x5bd6ae(_0x3278('0x2e'));if(_0x135974>_0x324529['telephone'])return _0x5bd6ae(_0x3278('0x2f'));return _0x2da6dd();})['catch'](function(_0x1d4d4a){_0x5bd6ae(_0x1d4d4a);});});}module[_0x3278('0x30')]={'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 cce9b5b..2a9c660 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 _0xb62e=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x1d8264,_0x205ccb){var _0x561054=function(_0x3f2e06){while(--_0x3f2e06){_0x1d8264['push'](_0x1d8264['shift']());}};_0x561054(++_0x205ccb);}(_0xb62e,0x1de));var _0xeb62=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb62e[_0x3b380d];return _0x54502b;};'use strict';module[_0xeb62('0x0')]={'DOMAIN':_0xeb62('0x1'),'SESSION_SECRET':_0xeb62('0x2'),'GOOGLE_ID':_0xeb62('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x6343=['myappanuglar-secret','app-id'];(function(_0x302681,_0xcbab6e){var _0x2549b3=function(_0x4bb8fd){while(--_0x4bb8fd){_0x302681['push'](_0x302681['shift']());}};_0x2549b3(++_0xcbab6e);}(_0x6343,0x168));var _0x3634=function(_0xd5227d,_0x5cdffd){_0xd5227d=_0xd5227d-0x0;var _0x3f4fd2=_0x6343[_0xd5227d];return _0x3f4fd2;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3634('0x0'),'GOOGLE_ID':_0x3634('0x1'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 817d5bb..d560624 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54f1=['message','replace','{{{','}}}','level','toUpperCase','exports','Logger','transports','%s-%s','error','File','info','Console','env','debugLevel','winston','util','INFO','/var','log','format'];(function(_0x38d6e8,_0x21c3b9){var _0x37e27f=function(_0x2e9a3e){while(--_0x2e9a3e){_0x38d6e8['push'](_0x38d6e8['shift']());}};_0x37e27f(++_0x21c3b9);}(_0x54f1,0x1c8));var _0x154f=function(_0x364086,_0x309f2b){_0x364086=_0x364086-0x0;var _0x6952de=_0x54f1[_0x364086];return _0x6952de;};'use strict';var moment=require('moment');var winston=require(_0x154f('0x0'));var util=require(_0x154f('0x1'));var path=require('path');var debugLevel=_0x154f('0x2');function filename(_0x465012,_0x5ceb5a){return path['join'](_0x154f('0x3'),_0x154f('0x4'),'xcally',util[_0x154f('0x5')]('%s-%s.log',_0x465012,_0x5ceb5a));}function formatter(_0x57ccba,_0x502ed5){_0x502ed5[_0x154f('0x6')]=_0x502ed5['message'][_0x154f('0x7')](/@@{/g,_0x154f('0x8'))[_0x154f('0x7')](/}@@/g,_0x154f('0x9'))['replace'](/@{/g,'{{')[_0x154f('0x7')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x154f('0x5')]('YYYY-MM-DD\x20HH:mm:ss'),_0x502ed5[_0x154f('0xa')][_0x154f('0xb')](),_0x57ccba,_0x502ed5[_0x154f('0x6')]);}module[_0x154f('0xc')]=function(_0x561528){return new winston[(_0x154f('0xd'))]({'transports':[new winston[(_0x154f('0xe'))]['File']({'name':util[_0x154f('0x5')](_0x154f('0xf'),_0x561528,_0x154f('0x10')),'filename':filename(_0x561528,_0x154f('0x10')),'level':_0x154f('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5bd802){return formatter(_0x561528,_0x5bd802);}}),new winston[(_0x154f('0xe'))][(_0x154f('0x11'))]({'name':util[_0x154f('0x5')]('%s-%s',_0x561528,_0x154f('0x12')),'filename':filename(_0x561528,_0x154f('0x12')),'level':_0x154f('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x494c00){return formatter(_0x561528,_0x494c00);}}),new winston[(_0x154f('0xe'))][(_0x154f('0x13'))]({'level':process[_0x154f('0x14')][_0x154f('0x15')]||debugLevel,'json':![],'formatter':function(_0x50db2b){return formatter(_0x561528,_0x50db2b);}})]});}; \ No newline at end of file +var _0x6d9b=['env','debugLevel','moment','util','path','INFO','join','/var','log','format','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','exports','File','%s-%s','error','transports','info','Console'];(function(_0x4038e9,_0x22a92c){var _0x2c7ac3=function(_0x2e5ad9){while(--_0x2e5ad9){_0x4038e9['push'](_0x4038e9['shift']());}};_0x2c7ac3(++_0x22a92c);}(_0x6d9b,0x70));var _0xb6d9=function(_0x439fb3,_0x37545a){_0x439fb3=_0x439fb3-0x0;var _0x5531a5=_0x6d9b[_0x439fb3];return _0x5531a5;};'use strict';var moment=require(_0xb6d9('0x0'));var winston=require('winston');var util=require(_0xb6d9('0x1'));var path=require(_0xb6d9('0x2'));var debugLevel=_0xb6d9('0x3');function filename(_0x39ae0d,_0x98b3ba){return path[_0xb6d9('0x4')](_0xb6d9('0x5'),_0xb6d9('0x6'),'xcally',util[_0xb6d9('0x7')]('%s-%s.log',_0x39ae0d,_0x98b3ba));}function formatter(_0x4b21dd,_0x5d920c){_0x5d920c['message']=_0x5d920c['message'][_0xb6d9('0x8')](/@@{/g,'{{{')['replace'](/}@@/g,_0xb6d9('0x9'))[_0xb6d9('0x8')](/@{/g,'{{')[_0xb6d9('0x8')](/}@/g,'}}');return util[_0xb6d9('0x7')](_0xb6d9('0xa'),moment()['format'](_0xb6d9('0xb')),_0x5d920c[_0xb6d9('0xc')]['toUpperCase'](),_0x4b21dd,_0x5d920c['message']);}module[_0xb6d9('0xd')]=function(_0xbda58){return new winston['Logger']({'transports':[new winston['transports'][(_0xb6d9('0xe'))]({'name':util['format'](_0xb6d9('0xf'),_0xbda58,_0xb6d9('0x10')),'filename':filename(_0xbda58,_0xb6d9('0x10')),'level':_0xb6d9('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1d53e5){return formatter(_0xbda58,_0x1d53e5);}}),new winston[(_0xb6d9('0x11'))]['File']({'name':util['format'](_0xb6d9('0xf'),_0xbda58,_0xb6d9('0x12')),'filename':filename(_0xbda58,'info'),'level':_0xb6d9('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x44df28){return formatter(_0xbda58,_0x44df28);}}),new winston[(_0xb6d9('0x11'))][(_0xb6d9('0x13'))]({'level':process[_0xb6d9('0x14')][_0xb6d9('0x15')]||debugLevel,'json':![],'formatter':function(_0x432c71){return formatter(_0xbda58,_0x432c71);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index c13d362..47965d3 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 _0x79b2=['../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join'];(function(_0x2bfb31,_0xdd9aae){var _0x2b00ce=function(_0x3ddbfa){while(--_0x3ddbfa){_0x2bfb31['push'](_0x2bfb31['shift']());}};_0x2b00ce(++_0xdd9aae);}(_0x79b2,0xeb));var _0x279b=function(_0x251c18,_0x11f6b0){_0x251c18=_0x251c18-0x0;var _0x274283=_0x79b2[_0x251c18];return _0x274283;};'use strict';var path=require(_0x279b('0x0'));var os=require('os');var config={'apps':[{'name':_0x279b('0x1'),'script':path[_0x279b('0x2')](__dirname,_0x279b('0x3'))},{'name':_0x279b('0x4'),'script':path[_0x279b('0x2')](__dirname,_0x279b('0x5'))},{'name':_0x279b('0x6'),'script':path['join'](__dirname,_0x279b('0x7'))},{'name':'email','script':path[_0x279b('0x2')](__dirname,_0x279b('0x8'))},{'name':_0x279b('0x9'),'script':path[_0x279b('0x2')](__dirname,_0x279b('0xa'))},{'name':_0x279b('0xb'),'script':path['join'](__dirname,_0x279b('0xc'))}]};module[_0x279b('0xd')]=config; \ No newline at end of file +var _0x04be=['exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing'];(function(_0x238066,_0x3cfee2){var _0x3211a6=function(_0xa47081){while(--_0xa47081){_0x238066['push'](_0x238066['shift']());}};_0x3211a6(++_0x3cfee2);}(_0x04be,0x1da));var _0xe04b=function(_0x12fdfb,_0x9d0e9){_0x12fdfb=_0x12fdfb-0x0;var _0x2d6d46=_0x04be[_0x12fdfb];return _0x2d6d46;};'use strict';var path=require(_0xe04b('0x0'));var os=require('os');var config={'apps':[{'name':_0xe04b('0x1'),'script':path[_0xe04b('0x2')](__dirname,_0xe04b('0x3'))},{'name':_0xe04b('0x4'),'script':path[_0xe04b('0x2')](__dirname,_0xe04b('0x5'))},{'name':_0xe04b('0x6'),'script':path[_0xe04b('0x2')](__dirname,_0xe04b('0x7'))},{'name':'email','script':path['join'](__dirname,_0xe04b('0x8'))},{'name':_0xe04b('0x9'),'script':path['join'](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0xe04b('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0xe04b('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index aea7052..e83931c 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 _0xcf96=['stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','start','then','disconnect'];(function(_0x37673d,_0x2c8055){var _0x26ac85=function(_0x493a4a){while(--_0x493a4a){_0x37673d['push'](_0x37673d['shift']());}};_0x26ac85(++_0x2c8055);}(_0xcf96,0x149));var _0x6cf9=function(_0x464e1f,_0x2aa86f){_0x464e1f=_0x464e1f-0x0;var _0x1c1ce2=_0xcf96[_0x464e1f];return _0x1c1ce2;};'use strict';var pm2=require(_0x6cf9('0x0'));var BPromise=require(_0x6cf9('0x1'));var config=require(_0x6cf9('0x2'));function connect(){return new BPromise(function(_0x56a79a,_0x5f0c3e){return pm2[_0x6cf9('0x3')](function(_0x37f61e){if(_0x37f61e){return _0x5f0c3e(_0x37f61e);}return _0x56a79a('connected');});});};exports[_0x6cf9('0x4')]=function(_0x207255){return connect()[_0x6cf9('0x5')](function(){return new BPromise(function(_0x3c09b0,_0x1505d4){return pm2[_0x6cf9('0x4')](_0x207255,function(_0x3b41e9,_0x24d3f){if(_0x3b41e9){return _0x1505d4(_0x3b41e9);}pm2[_0x6cf9('0x6')]();return _0x3c09b0(_0x24d3f);});});});};exports[_0x6cf9('0x7')]=function(_0xc20a22){return connect()[_0x6cf9('0x5')](function(){return new BPromise(function(_0x392ce7,_0x3003ea){return pm2[_0x6cf9('0x7')](_0xc20a22,function(_0x2246ea,_0x31b1bf){if(_0x2246ea){return _0x3003ea(_0x2246ea);}pm2['disconnect']();return _0x392ce7(_0x31b1bf);});});});};exports[_0x6cf9('0x8')]=function(_0x162257){return connect()['then'](function(){return new BPromise(function(_0x4e24c0,_0x29e2ee){return pm2[_0x6cf9('0x8')](_0x162257,function(_0x4b228c,_0x4befe7){if(_0x4b228c){return _0x29e2ee(_0x4b228c);}pm2['disconnect']();return _0x4e24c0(_0x4befe7);});});});};exports[_0x6cf9('0x9')]=function(){return connect()[_0x6cf9('0x5')](function(){return new BPromise(function(_0x51ca01,_0x324432){return pm2[_0x6cf9('0x9')](function(_0x37d478,_0xab312e){if(_0x37d478){return _0x324432(_0x37d478);}pm2['disconnect']();return _0x51ca01(_0xab312e);});});});};exports['describe']=function(_0x37e8fb){return connect()[_0x6cf9('0x5')](function(){return new BPromise(function(_0xf077f4,_0x23a69e){return pm2[_0x6cf9('0xa')](_0x37e8fb,function(_0x23eeab,_0x5b7006){if(_0x23eeab){return _0x23a69e(_0x23eeab);}pm2[_0x6cf9('0x6')]();return _0xf077f4(_0x5b7006);});});});};exports[_0x6cf9('0xb')]=function(_0x3a1ebc){return connect()[_0x6cf9('0x5')](function(){return new BPromise(function(_0x3bb89c,_0x3cd7bb){return pm2['delete'](_0x3a1ebc,function(_0x4811e2,_0x22c344){if(_0x4811e2){return _0x3cd7bb(_0x4811e2);}pm2[_0x6cf9('0x6')]();return _0x3bb89c(_0x22c344);});});});};exports[_0x6cf9('0xc')]=function(){return connect()[_0x6cf9('0x5')](function(){return new BPromise(function(_0x214b62,_0x54575e){return pm2[_0x6cf9('0xc')](function(_0x999bb7){if(_0x999bb7){return _0x54575e(_0x999bb7);}return _0x214b62(_0x6cf9('0xd'));});});});}; \ No newline at end of file +var _0x76af=['stop','restart','list','describe','delete','pm2','bluebird','./config','connect','connected','then','start','disconnect'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x76af,0x171));var _0xf76a=function(_0x437d7f,_0x1feb46){_0x437d7f=_0x437d7f-0x0;var _0x31058c=_0x76af[_0x437d7f];return _0x31058c;};'use strict';var pm2=require(_0xf76a('0x0'));var BPromise=require(_0xf76a('0x1'));var config=require(_0xf76a('0x2'));function connect(){return new BPromise(function(_0x2afec3,_0x5b168e){return pm2[_0xf76a('0x3')](function(_0x3920ea){if(_0x3920ea){return _0x5b168e(_0x3920ea);}return _0x2afec3(_0xf76a('0x4'));});});};exports['start']=function(_0x5ec151){return connect()[_0xf76a('0x5')](function(){return new BPromise(function(_0x957370,_0x7cddc8){return pm2[_0xf76a('0x6')](_0x5ec151,function(_0x5f4681,_0x141f3c){if(_0x5f4681){return _0x7cddc8(_0x5f4681);}pm2[_0xf76a('0x7')]();return _0x957370(_0x141f3c);});});});};exports[_0xf76a('0x8')]=function(_0x2e7bd8){return connect()['then'](function(){return new BPromise(function(_0x3ace57,_0x1b8ff7){return pm2[_0xf76a('0x8')](_0x2e7bd8,function(_0x549aa9,_0x33dd84){if(_0x549aa9){return _0x1b8ff7(_0x549aa9);}pm2['disconnect']();return _0x3ace57(_0x33dd84);});});});};exports[_0xf76a('0x9')]=function(_0xbec136){return connect()[_0xf76a('0x5')](function(){return new BPromise(function(_0x4f6697,_0x61e3f9){return pm2[_0xf76a('0x9')](_0xbec136,function(_0x459eb1,_0x53b6f8){if(_0x459eb1){return _0x61e3f9(_0x459eb1);}pm2[_0xf76a('0x7')]();return _0x4f6697(_0x53b6f8);});});});};exports[_0xf76a('0xa')]=function(){return connect()[_0xf76a('0x5')](function(){return new BPromise(function(_0x25c145,_0x5370b6){return pm2['list'](function(_0x4d5bf1,_0x21cda8){if(_0x4d5bf1){return _0x5370b6(_0x4d5bf1);}pm2[_0xf76a('0x7')]();return _0x25c145(_0x21cda8);});});});};exports[_0xf76a('0xb')]=function(_0x1020a9){return connect()[_0xf76a('0x5')](function(){return new BPromise(function(_0x1cb0ac,_0x2299d6){return pm2[_0xf76a('0xb')](_0x1020a9,function(_0x3132e4,_0x4727c5){if(_0x3132e4){return _0x2299d6(_0x3132e4);}pm2[_0xf76a('0x7')]();return _0x1cb0ac(_0x4727c5);});});});};exports[_0xf76a('0xc')]=function(_0x578c77){return connect()[_0xf76a('0x5')](function(){return new BPromise(function(_0x34fb69,_0x89e2f6){return pm2[_0xf76a('0xc')](_0x578c77,function(_0xd85ab0,_0x175bba){if(_0xd85ab0){return _0x89e2f6(_0xd85ab0);}pm2[_0xf76a('0x7')]();return _0x34fb69(_0x175bba);});});});};exports['dump']=function(){return connect()[_0xf76a('0x5')](function(){return new BPromise(function(_0x5a23f,_0x224066){return pm2['dump'](function(_0x509201){if(_0x509201){return _0x224066(_0x509201);}return _0x5a23f('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 76ebb68..08ef845 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 _0x42ed=['inspect','moment','ioredis','../../config/environment','../logger','schedule','localhost','redis','find','chatTimeout','then','lastMsgAt','subtract','minutes','length','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions'];(function(_0x4e16c6,_0x39649a){var _0x1902d5=function(_0x35500e){while(--_0x35500e){_0x4e16c6['push'](_0x4e16c6['shift']());}};_0x1902d5(++_0x39649a);}(_0x42ed,0x1c3));var _0xd42e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x42ed[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0xd42e('0x0'));var Redis=require(_0xd42e('0x1'));var util=require('util');var config=require(_0xd42e('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xd42e('0x3'))(_0xd42e('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0xd42e('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd42e('0x6')]));function closeInteractions(){var _0x143fbb=0x0;var _0x3a919a=[];return db['Setting'][_0xd42e('0x7')]({'raw':!![],'attributes':['id',_0xd42e('0x8')],'where':{'id':0x1}})[_0xd42e('0x9')](function(_0x46f6f4){_0x143fbb=_0x46f6f4[_0xd42e('0x8')];if(_0x143fbb){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0xd42e('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd42e('0xb')](_0x46f6f4[_0xd42e('0x8')],_0xd42e('0xc'))}}});}else{return[];}})['then'](function(_0x5b9307){if(_0x5b9307&&_0x5b9307[_0xd42e('0xd')]){_0x3a919a=_['map'](_0x5b9307||[],'id');logger['info'](_0xd42e('0xe'),_0x3a919a[_0xd42e('0xf')]());return db[_0xd42e('0x10')][_0xd42e('0x11')]({'closeReason':_0xd42e('0x12'),'disposition':_0xd42e('0x13'),'closed':!![],'closedAt':moment()[_0xd42e('0x14')](_0xd42e('0x15'))},{'where':{'id':_0x3a919a}});}})[_0xd42e('0x9')](function(){if(_0x3a919a&&_0x3a919a[_0xd42e('0xd')]){logger[_0xd42e('0x16')](_0xd42e('0x17'),_0x3a919a[_0xd42e('0xf')]());for(var _0x1773bc=0x0;_0x1773bc<_0x3a919a['length'];_0x1773bc++){io[_0xd42e('0x18')](_0xd42e('0x19'),{'id':_0x3a919a[_0x1773bc],'closed':!![]});}}})[_0xd42e('0x1a')](function(_0x11811e){logger[_0xd42e('0x1b')](_0xd42e('0x1c'),_0x11811e?util[_0xd42e('0x1d')](_0x11811e,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8e68=['YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','catch','inspect','lodash','ioredis','util','../../mysqldb','../logger','schedule','localhost','socket.io-emitter','redis','Setting','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','map','info','timeout','format'];(function(_0x3fc822,_0x4f2dfa){var _0x32cd23=function(_0xb7dba8){while(--_0xb7dba8){_0x3fc822['push'](_0x3fc822['shift']());}};_0x32cd23(++_0x4f2dfa);}(_0x8e68,0x77));var _0x88e6=function(_0x3d9906,_0x433b6e){_0x3d9906=_0x3d9906-0x0;var _0x3388e9=_0x8e68[_0x3d9906];return _0x3388e9;};'use strict';var _=require(_0x88e6('0x0'));var moment=require('moment');var Redis=require(_0x88e6('0x1'));var util=require(_0x88e6('0x2'));var config=require('../../config/environment');var db=require(_0x88e6('0x3'))['db'];var logger=require(_0x88e6('0x4'))(_0x88e6('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0x88e6('0x6'),'port':0x18eb});var io=require(_0x88e6('0x7'))(new Redis(config[_0x88e6('0x8')]));function closeInteractions(){var _0x3b6dbd=0x0;var _0x527369=[];return db[_0x88e6('0x9')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x88e6('0xa')](function(_0x23a7ff){_0x3b6dbd=_0x23a7ff[_0x88e6('0xb')];if(_0x3b6dbd){return db[_0x88e6('0xc')][_0x88e6('0xd')]({'raw':!![],'attributes':['id',_0x88e6('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x88e6('0xf')](_0x23a7ff[_0x88e6('0xb')],_0x88e6('0x10'))}}});}else{return[];}})[_0x88e6('0xa')](function(_0x55ef91){if(_0x55ef91&&_0x55ef91['length']){_0x527369=_[_0x88e6('0x11')](_0x55ef91||[],'id');logger[_0x88e6('0x12')]('[CHAT]\x20Interactions\x20to\x20close:',_0x527369['join']());return db['ChatInteraction']['update']({'closeReason':'system','disposition':_0x88e6('0x13'),'closed':!![],'closedAt':moment()[_0x88e6('0x14')](_0x88e6('0x15'))},{'where':{'id':_0x527369}});}})[_0x88e6('0xa')](function(){if(_0x527369&&_0x527369[_0x88e6('0x16')]){logger[_0x88e6('0x12')](_0x88e6('0x17'),_0x527369[_0x88e6('0x18')]());for(var _0x34c66d=0x0;_0x34c66d<_0x527369[_0x88e6('0x16')];_0x34c66d++){io[_0x88e6('0x19')]('chatInteraction:update',{'id':_0x527369[_0x34c66d],'closed':!![]});}}})[_0x88e6('0x1a')](function(_0x575481){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x575481?util[_0x88e6('0x1b')](_0x575481,{'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/index.js b/server/config/schedule/index.js index 82be518..0e76fc7 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 _0x1222=['run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','subtractUnit','../../files/reports','savename','basename','extname','join','existsSync','status','Sent','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','findAll','MailServerOut','keys','map','keyBy','toString','difference','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','cron','active','isBetween','start','add\x20cron','stop\x20cron','exists','startAt','endAt','update'];(function(_0x4cfa2e,_0x5752b5){var _0x279b50=function(_0x3f817b){while(--_0x3f817b){_0x4cfa2e['push'](_0x4cfa2e['shift']());}};_0x279b50(++_0x5752b5);}(_0x1222,0x112));var _0x2122=function(_0x2f3954,_0x34af5e){_0x2f3954=_0x2f3954-0x0;var _0x471554=_0x1222[_0x2f3954];return _0x471554;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x2122('0x0'));var _=require(_0x2122('0x1'));var moment=require(_0x2122('0x2'));var CronJobManager=require(_0x2122('0x3'));var jayson=require(_0x2122('0x4'));var BPromise=require(_0x2122('0x5'));var logger=require(_0x2122('0x6'))(_0x2122('0x7'));var db=require(_0x2122('0x8'))['db'];var analyticCustomReportController=require(_0x2122('0x9'));var analyticDefaultReportController=require(_0x2122('0xa'));var client=jayson[_0x2122('0xb')][_0x2122('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4c1332,_0x3b676f){return function(){logger[_0x2122('0xd')](_0x2122('0xe'),_0x4c1332[_0x2122('0xf')]);var _0x3523e9=!![];var _0x7c50e7={'tls':{'rejectUnauthorized':![]}};if(_0x4c1332[_0x2122('0x10')][_0x2122('0x11')]['service']){_0x7c50e7['service']=_0x4c1332[_0x2122('0x10')][_0x2122('0x11')][_0x2122('0x12')];}else{_0x7c50e7[_0x2122('0x13')]=_0x4c1332[_0x2122('0x10')][_0x2122('0x11')]['host'];_0x7c50e7[_0x2122('0x14')]=_0x4c1332[_0x2122('0x10')][_0x2122('0x11')][_0x2122('0x14')];_0x7c50e7[_0x2122('0x15')]=_0x4c1332[_0x2122('0x10')][_0x2122('0x11')]['secure'];}if(_0x4c1332[_0x2122('0x10')][_0x2122('0x11')]['authentication']){_0x7c50e7[_0x2122('0x16')]={'user':_0x4c1332[_0x2122('0x10')][_0x2122('0x11')][_0x2122('0x17')],'pass':_0x4c1332['MailAccount']['Smtp'][_0x2122('0x18')]};}var _0x4f5544={'account':_0x7c50e7,'message':{'from':util[_0x2122('0x19')](_0x2122('0x1a'),_0x4c1332[_0x2122('0x10')][_0x2122('0x1b')],_0x4c1332[_0x2122('0x10')][_0x2122('0xf')]||_0x4c1332[_0x2122('0x10')][_0x2122('0x11')]['user']),'to':_0x4c1332[_0x2122('0xf')],'cc':_0x4c1332['cc'],'bcc':_0x4c1332[_0x2122('0x1c')],'subject':util[_0x2122('0x19')]('Report\x20%s\x20last\x20%s\x20%s',_0x3b676f[_0x2122('0x1b')],_0x4c1332['subtractNumber'],_0x4c1332[_0x2122('0x1d')])}};var _0x20ffdc=path['join'](__dirname,_0x2122('0x1e'));var _0x424882=_0x3b676f[_0x2122('0x1f')];var _0x2207d0=util['format']('%s.%s',path[_0x2122('0x20')](_0x3b676f['savename'],path[_0x2122('0x21')](_0x3b676f[_0x2122('0x1f')])),'zip');var _0x3ba3da=path[_0x2122('0x22')](_0x20ffdc,_0x424882);var _0x4b6ddc=path['join'](_0x20ffdc,_0x2207d0);if(fs[_0x2122('0x23')](_0x3ba3da)){_0x3b676f[_0x2122('0x24')]=_0x2122('0x25');_0x4f5544[_0x2122('0x26')]['attachments']=[{'filename':_0x424882,'path':_0x3ba3da}];_0x4f5544[_0x2122('0x26')]['text']=util[_0x2122('0x19')](_0x2122('0x27'),JSON[_0x2122('0x28')](_0x3b676f,null,0x2));}else if(fs[_0x2122('0x23')](_0x4b6ddc)){_0x3b676f[_0x2122('0x24')]='Sent';_0x4f5544['message']['attachments']=[{'filename':_0x2207d0,'path':_0x4b6ddc}];}else{_0x4f5544[_0x2122('0x26')][_0x2122('0x29')]=_0x2122('0x2a');if(!_0x4c1332[_0x2122('0x2b')]){_0x3523e9=![];logger[_0x2122('0xd')](_0x2122('0x2c'));}}if(_0x3523e9){return client[_0x2122('0x2d')](_0x2122('0x2e'),_0x4f5544)[_0x2122('0x2f')](function(_0x5e7b0c){if(_0x5e7b0c[_0x2122('0x30')]){return logger[_0x2122('0x30')](_0x2122('0x31'),JSON[_0x2122('0x28')](_0x5e7b0c));}return logger[_0x2122('0xd')]('email\x20sent');})[_0x2122('0x32')](function(_0x572713){return logger[_0x2122('0x30')](_0x2122('0x31'),JSON['stringify'](_0x572713));});}};}function handleError(){return function(_0x1926a7){return logger['error'](JSON['stringify'](_0x1926a7));};}function handleResult(_0x445e65){return function(_0x50e7c8){logger[_0x2122('0xd')](_0x2122('0x33'),JSON[_0x2122('0x28')](_0x50e7c8));if(_0x445e65[_0x2122('0x10')]&&_0x445e65[_0x2122('0x10')][_0x2122('0x11')]&&!_[_0x2122('0x34')](_0x445e65['email'])){setTimeout(handleSendEmail(_0x445e65,_0x50e7c8),0x3c*0x3e8);}};}function handleJob(_0x480dd6){return function(){try{if(_[_0x2122('0x34')](_0x480dd6[_0x2122('0x35')])){return logger[_0x2122('0xd')](_0x2122('0x36'));}if(_[_0x2122('0x34')](_0x480dd6['subtractUnit'])){return logger[_0x2122('0xd')](_0x2122('0x37'));}var _0x41d436={'startDate':moment()['subtract'](_0x480dd6[_0x2122('0x35')],_0x480dd6[_0x2122('0x1d')])[_0x2122('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x2122('0x38'),'output':_0x480dd6[_0x2122('0x39')],'name':_0x480dd6[_0x2122('0x1b')]};if(!_[_0x2122('0x34')](_0x480dd6[_0x2122('0x3a')])){logger['info'](_0x2122('0x3b'),_0x480dd6[_0x2122('0x3a')]);return analyticDefaultReportController[_0x2122('0x3c')]({'id':_0x480dd6[_0x2122('0x3a')]},_0x41d436)[_0x2122('0x2f')](handleResult(_0x480dd6))[_0x2122('0x32')](handleError());}if(!_[_0x2122('0x34')](_0x480dd6['CustomReportId'])){logger[_0x2122('0xd')](_0x2122('0x3d'),_0x480dd6[_0x2122('0x3e')]);return analyticCustomReportController[_0x2122('0x3c')]({'id':_0x480dd6[_0x2122('0x3e')]},_0x41d436)['then'](handleResult(_0x480dd6))[_0x2122('0x32')](handleError());}}catch(_0xddeb6){logger[_0x2122('0x30')](JSON[_0x2122('0x28')](_0xddeb6));}return logger['info'](_0x2122('0x3f'));};}function getJobs(_0x27c2aa){var _0x2365af={};if(_0x27c2aa){_0x2365af['id']=_0x27c2aa;}return db['Schedule'][_0x2122('0x40')]({'where':_0x2365af,'include':[{'model':db[_0x2122('0x10')],'attributes':['id','name',_0x2122('0xf')],'include':[{'model':db[_0x2122('0x41')],'as':_0x2122('0x11')}]}]})[_0x2122('0x2f')](function(_0x1111c1){var _0x3a9cb3=_[_0x2122('0x42')](manager['jobs']);var _0xe6239a=_[_0x2122('0x43')](_0x1111c1,function(_0x79743d){return _0x79743d['id']['toString']();});var _0x29bddf=_[_0x2122('0x44')](_0x1111c1,function(_0x5ae8fc){return _0x5ae8fc['id'][_0x2122('0x45')]();});var _0x3a4bf5=_0x27c2aa?_0xe6239a:_[_0x2122('0x46')](_0xe6239a,_0x3a9cb3);var _0x2295b6=_['intersection'](_0xe6239a,_0x3a9cb3);var _0x5503f3=_[_0x2122('0x46')](_0x3a9cb3,_0xe6239a);var _0x4d96b2;var _0x37f599;for(_0x4d96b2=0x0;_0x4d96b2<_0x5503f3['length']&&!_0x27c2aa;_0x4d96b2+=0x1){_0x37f599=_0x5503f3[_0x4d96b2][_0x2122('0x45')]();if(manager['exists'](_0x37f599)){manager[_0x2122('0x47')](_0x37f599);manager[_0x2122('0x48')](_0x37f599);logger[_0x2122('0xd')](_0x2122('0x49'),_0x37f599);}}logger[_0x2122('0xd')](_0x2122('0x4a'),JSON[_0x2122('0x28')](_0x3a4bf5));for(_0x4d96b2=0x0;_0x4d96b2<_0x3a4bf5[_0x2122('0x4b')];_0x4d96b2+=0x1){_0x37f599=_0x3a4bf5[_0x4d96b2][_0x2122('0x45')]();logger['info'](_0x2122('0x4c'),_0x37f599);if(_0x27c2aa){logger[_0x2122('0xd')](_0x2122('0x4d'),_0x27c2aa);logger['info'](JSON['stringify'](_0x29bddf[_0x37f599]));BPromise[_0x2122('0x4e')]()['then'](handleJob(_0x29bddf[_0x37f599]));logger[_0x2122('0xd')](_0x2122('0x4f'),_0x29bddf[_0x37f599][_0x2122('0x1b')],_0x29bddf[_0x37f599][_0x2122('0x50')]);}else if(_0x29bddf[_0x37f599][_0x2122('0x50')]&&_0x29bddf[_0x37f599][_0x2122('0x51')]&&moment()[_0x2122('0x52')](_0x29bddf[_0x37f599]['startAt'],_0x29bddf[_0x37f599]['endAt'])){manager['add'](_0x37f599,_0x29bddf[_0x37f599][_0x2122('0x50')],handleJob(_0x29bddf[_0x37f599]));manager[_0x2122('0x53')](_0x37f599);logger[_0x2122('0xd')](_0x2122('0x54'),_0x29bddf[_0x37f599][_0x2122('0x1b')],_0x29bddf[_0x37f599]['cron']);}else if(manager['exists'](_0x37f599)){manager[_0x2122('0x47')](_0x37f599);manager[_0x2122('0x48')](_0x37f599);logger[_0x2122('0xd')](_0x2122('0x55'),_0x29bddf[_0x37f599]['name'],_0x29bddf[_0x37f599]['cron']);}}for(_0x4d96b2=0x0,_0x37f599;_0x4d96b2<_0x2295b6['length']&&!_0x27c2aa;_0x4d96b2+=0x1){_0x37f599=_0x2295b6[_0x4d96b2][_0x2122('0x45')]();if(manager[_0x2122('0x56')](_0x37f599)){if(_0x29bddf[_0x37f599][_0x2122('0x50')]&&_0x29bddf[_0x37f599][_0x2122('0x51')]&&moment()['isBetween'](_0x29bddf[_0x37f599][_0x2122('0x57')],_0x29bddf[_0x37f599][_0x2122('0x58')])){manager[_0x2122('0x59')](_0x37f599,_0x29bddf[_0x37f599][_0x2122('0x50')],handleJob(_0x29bddf[_0x37f599]));logger[_0x2122('0xd')]('update\x20cron',_0x29bddf[_0x37f599][_0x2122('0x1b')],_0x29bddf[_0x37f599]['cron']);}else{manager['stop'](_0x37f599);manager[_0x2122('0x48')](_0x37f599);logger[_0x2122('0xd')]('stop\x20cron',_0x29bddf[_0x37f599]['name'],_0x29bddf[_0x37f599]['cron']);}}}})[_0x2122('0x32')](function(_0x4aaf33){logger[_0x2122('0x30')](JSON[_0x2122('0x28')](_0x4aaf33));});}exports[_0x2122('0x5a')]=function(_0x20748f){return getJobs(_0x20748f);};exports[_0x2122('0x53')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x4231=['name','bcc','format','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','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','length','exists','toRun','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop','stop\x20cron','update','update\x20cron','run','start','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','\x22%s\x22\x20<%s>'];(function(_0x1bbb77,_0x5b6788){var _0xec2e02=function(_0x1e87a4){while(--_0x1e87a4){_0x1bbb77['push'](_0x1bbb77['shift']());}};_0xec2e02(++_0x5b6788);}(_0x4231,0x1bc));var _0x1423=function(_0x11bc40,_0x537bbc){_0x11bc40=_0x11bc40-0x0;var _0x2b7a99=_0x4231[_0x11bc40];return _0x2b7a99;};'use strict';var fs=require('fs');var util=require(_0x1423('0x0'));var path=require(_0x1423('0x1'));var _=require(_0x1423('0x2'));var moment=require(_0x1423('0x3'));var CronJobManager=require(_0x1423('0x4'));var jayson=require(_0x1423('0x5'));var BPromise=require('bluebird');var logger=require(_0x1423('0x6'))(_0x1423('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x1423('0x8'));var analyticDefaultReportController=require(_0x1423('0x9'));var client=jayson[_0x1423('0xa')][_0x1423('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x58ff50,_0x1c01fd){return function(){logger[_0x1423('0xc')](_0x1423('0xd'),_0x58ff50[_0x1423('0xe')]);var _0x27f7a5=!![];var _0x1159fb={'tls':{'rejectUnauthorized':![]}};if(_0x58ff50[_0x1423('0xf')][_0x1423('0x10')][_0x1423('0x11')]){_0x1159fb[_0x1423('0x11')]=_0x58ff50[_0x1423('0xf')][_0x1423('0x10')][_0x1423('0x11')];}else{_0x1159fb[_0x1423('0x12')]=_0x58ff50[_0x1423('0xf')][_0x1423('0x10')][_0x1423('0x12')];_0x1159fb[_0x1423('0x13')]=_0x58ff50[_0x1423('0xf')][_0x1423('0x10')][_0x1423('0x13')];_0x1159fb[_0x1423('0x14')]=_0x58ff50['MailAccount'][_0x1423('0x10')][_0x1423('0x14')];}if(_0x58ff50['MailAccount'][_0x1423('0x10')][_0x1423('0x15')]){_0x1159fb[_0x1423('0x16')]={'user':_0x58ff50[_0x1423('0xf')]['Smtp'][_0x1423('0x17')],'pass':_0x58ff50['MailAccount']['Smtp'][_0x1423('0x18')]};}var _0x4e1c16={'account':_0x1159fb,'message':{'from':util['format'](_0x1423('0x19'),_0x58ff50[_0x1423('0xf')][_0x1423('0x1a')],_0x58ff50['MailAccount'][_0x1423('0xe')]||_0x58ff50['MailAccount'][_0x1423('0x10')][_0x1423('0x17')]),'to':_0x58ff50[_0x1423('0xe')],'cc':_0x58ff50['cc'],'bcc':_0x58ff50[_0x1423('0x1b')],'subject':util[_0x1423('0x1c')](_0x1423('0x1d'),_0x1c01fd[_0x1423('0x1a')],_0x58ff50[_0x1423('0x1e')],_0x58ff50[_0x1423('0x1f')])}};var _0xe307c0=path['join'](__dirname,'../../files/reports');var _0x51af82=_0x1c01fd[_0x1423('0x20')];var _0xf99be=util[_0x1423('0x1c')](_0x1423('0x21'),path[_0x1423('0x22')](_0x1c01fd[_0x1423('0x20')],path[_0x1423('0x23')](_0x1c01fd['savename'])),_0x1423('0x24'));var _0x459801=path[_0x1423('0x25')](_0xe307c0,_0x51af82);var _0x3a0ce3=path[_0x1423('0x25')](_0xe307c0,_0xf99be);if(fs[_0x1423('0x26')](_0x459801)){_0x1c01fd[_0x1423('0x27')]=_0x1423('0x28');_0x4e1c16[_0x1423('0x29')][_0x1423('0x2a')]=[{'filename':_0x51af82,'path':_0x459801}];_0x4e1c16[_0x1423('0x29')][_0x1423('0x2b')]=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[_0x1423('0x2c')](_0x1c01fd,null,0x2));}else if(fs[_0x1423('0x26')](_0x3a0ce3)){_0x1c01fd[_0x1423('0x27')]='Sent';_0x4e1c16['message'][_0x1423('0x2a')]=[{'filename':_0xf99be,'path':_0x3a0ce3}];}else{_0x4e1c16[_0x1423('0x29')][_0x1423('0x2b')]=_0x1423('0x2d');if(!_0x58ff50[_0x1423('0x2e')]){_0x27f7a5=![];logger[_0x1423('0xc')](_0x1423('0x2f'));}}if(_0x27f7a5){return client['request'](_0x1423('0x30'),_0x4e1c16)[_0x1423('0x31')](function(_0x44c6ba){if(_0x44c6ba['error']){return logger[_0x1423('0x32')](_0x1423('0x33'),JSON[_0x1423('0x2c')](_0x44c6ba));}return logger['info'](_0x1423('0x34'));})[_0x1423('0x35')](function(_0x369949){return logger['error'](_0x1423('0x33'),JSON[_0x1423('0x2c')](_0x369949));});}};}function handleError(){return function(_0x3f448f){return logger[_0x1423('0x32')](JSON['stringify'](_0x3f448f));};}function handleResult(_0x244e6b){return function(_0x36ce84){logger[_0x1423('0xc')](_0x1423('0x36'),JSON['stringify'](_0x36ce84));if(_0x244e6b[_0x1423('0xf')]&&_0x244e6b[_0x1423('0xf')][_0x1423('0x10')]&&!_['isNil'](_0x244e6b[_0x1423('0xe')])){setTimeout(handleSendEmail(_0x244e6b,_0x36ce84),0x3c*0x3e8);}};}function handleJob(_0x59c017){return function(){try{if(_[_0x1423('0x37')](_0x59c017[_0x1423('0x1e')])){return logger[_0x1423('0xc')](_0x1423('0x38'));}if(_['isNil'](_0x59c017[_0x1423('0x1f')])){return logger[_0x1423('0xc')](_0x1423('0x39'));}var _0x155133={'startDate':moment()[_0x1423('0x3a')](_0x59c017['subtractNumber'],_0x59c017[_0x1423('0x1f')])[_0x1423('0x1c')](_0x1423('0x3b')),'endDate':moment()['format'](_0x1423('0x3b')),'type':_0x1423('0x3c'),'output':_0x59c017[_0x1423('0x3d')],'name':_0x59c017['name']};if(!_['isNil'](_0x59c017[_0x1423('0x3e')])){logger['info'](_0x1423('0x3f'),_0x59c017[_0x1423('0x3e')]);return analyticDefaultReportController[_0x1423('0x40')]({'id':_0x59c017[_0x1423('0x3e')]},_0x155133)[_0x1423('0x31')](handleResult(_0x59c017))[_0x1423('0x35')](handleError());}if(!_[_0x1423('0x37')](_0x59c017[_0x1423('0x41')])){logger[_0x1423('0xc')](_0x1423('0x42'),_0x59c017[_0x1423('0x41')]);return analyticCustomReportController[_0x1423('0x40')]({'id':_0x59c017[_0x1423('0x41')]},_0x155133)['then'](handleResult(_0x59c017))[_0x1423('0x35')](handleError());}}catch(_0x1a88a0){logger[_0x1423('0x32')](JSON[_0x1423('0x2c')](_0x1a88a0));}return logger['info'](_0x1423('0x43'));};}function getJobs(_0x104e98){var _0x404876={};if(_0x104e98){_0x404876['id']=_0x104e98;}return db[_0x1423('0x44')][_0x1423('0x45')]({'where':_0x404876,'include':[{'model':db['MailAccount'],'attributes':['id',_0x1423('0x1a'),_0x1423('0xe')],'include':[{'model':db[_0x1423('0x46')],'as':_0x1423('0x10')}]}]})[_0x1423('0x31')](function(_0x38ffb6){var _0x41ad60=_[_0x1423('0x47')](manager[_0x1423('0x48')]);var _0x5ac89c=_[_0x1423('0x49')](_0x38ffb6,function(_0x81a190){return _0x81a190['id'][_0x1423('0x4a')]();});var _0x236743=_[_0x1423('0x4b')](_0x38ffb6,function(_0xe1de3f){return _0xe1de3f['id'][_0x1423('0x4a')]();});var _0x1eecd5=_0x104e98?_0x5ac89c:_['difference'](_0x5ac89c,_0x41ad60);var _0x127cab=_['intersection'](_0x5ac89c,_0x41ad60);var _0x237d6a=_[_0x1423('0x4c')](_0x41ad60,_0x5ac89c);var _0x42c2c0;var _0x5c8cd8;for(_0x42c2c0=0x0;_0x42c2c0<_0x237d6a[_0x1423('0x4d')]&&!_0x104e98;_0x42c2c0+=0x1){_0x5c8cd8=_0x237d6a[_0x42c2c0][_0x1423('0x4a')]();if(manager[_0x1423('0x4e')](_0x5c8cd8)){manager['stop'](_0x5c8cd8);manager['deleteJob'](_0x5c8cd8);logger['info']('delete\x20cron',_0x5c8cd8);}}logger['info'](_0x1423('0x4f'),JSON[_0x1423('0x2c')](_0x1eecd5));for(_0x42c2c0=0x0;_0x42c2c0<_0x1eecd5[_0x1423('0x4d')];_0x42c2c0+=0x1){_0x5c8cd8=_0x1eecd5[_0x42c2c0][_0x1423('0x4a')]();logger[_0x1423('0xc')]('index',_0x5c8cd8);if(_0x104e98){logger[_0x1423('0xc')]('my\x20id',_0x104e98);logger[_0x1423('0xc')](JSON[_0x1423('0x2c')](_0x236743[_0x5c8cd8]));BPromise['resolve']()[_0x1423('0x31')](handleJob(_0x236743[_0x5c8cd8]));logger['info'](_0x1423('0x50'),_0x236743[_0x5c8cd8][_0x1423('0x1a')],_0x236743[_0x5c8cd8][_0x1423('0x51')]);}else if(_0x236743[_0x5c8cd8]['cron']&&_0x236743[_0x5c8cd8][_0x1423('0x52')]&&moment()[_0x1423('0x53')](_0x236743[_0x5c8cd8][_0x1423('0x54')],_0x236743[_0x5c8cd8][_0x1423('0x55')])){manager[_0x1423('0x56')](_0x5c8cd8,_0x236743[_0x5c8cd8][_0x1423('0x51')],handleJob(_0x236743[_0x5c8cd8]));manager['start'](_0x5c8cd8);logger[_0x1423('0xc')](_0x1423('0x57'),_0x236743[_0x5c8cd8][_0x1423('0x1a')],_0x236743[_0x5c8cd8]['cron']);}else if(manager[_0x1423('0x4e')](_0x5c8cd8)){manager[_0x1423('0x58')](_0x5c8cd8);manager['deleteJob'](_0x5c8cd8);logger['info'](_0x1423('0x59'),_0x236743[_0x5c8cd8][_0x1423('0x1a')],_0x236743[_0x5c8cd8][_0x1423('0x51')]);}}for(_0x42c2c0=0x0,_0x5c8cd8;_0x42c2c0<_0x127cab[_0x1423('0x4d')]&&!_0x104e98;_0x42c2c0+=0x1){_0x5c8cd8=_0x127cab[_0x42c2c0]['toString']();if(manager[_0x1423('0x4e')](_0x5c8cd8)){if(_0x236743[_0x5c8cd8][_0x1423('0x51')]&&_0x236743[_0x5c8cd8][_0x1423('0x52')]&&moment()[_0x1423('0x53')](_0x236743[_0x5c8cd8][_0x1423('0x54')],_0x236743[_0x5c8cd8]['endAt'])){manager[_0x1423('0x5a')](_0x5c8cd8,_0x236743[_0x5c8cd8]['cron'],handleJob(_0x236743[_0x5c8cd8]));logger['info'](_0x1423('0x5b'),_0x236743[_0x5c8cd8][_0x1423('0x1a')],_0x236743[_0x5c8cd8][_0x1423('0x51')]);}else{manager['stop'](_0x5c8cd8);manager['deleteJob'](_0x5c8cd8);logger[_0x1423('0xc')]('stop\x20cron',_0x236743[_0x5c8cd8][_0x1423('0x1a')],_0x236743[_0x5c8cd8][_0x1423('0x51')]);}}}})[_0x1423('0x35')](function(_0x23cf97){logger[_0x1423('0x32')](JSON[_0x1423('0x2c')](_0x23cf97));});}exports[_0x1423('0x5c')]=function(_0x4281e3){return getJobs(_0x4281e3);};exports[_0x1423('0x5d')]=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 71d3ee8..67f864f 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 _0x61d0=['update','SentimentScore','Positive','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','Sentiment','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','catch','start','lodash','request-promise','util','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available'];(function(_0x28e375,_0x553147){var _0x467722=function(_0x1ae9b3){while(--_0x1ae9b3){_0x28e375['push'](_0x28e375['shift']());}};_0x467722(++_0x553147);}(_0x61d0,0x187));var _0x061d=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0x61d0[_0x134192];return _0x3cd080;};var _=require(_0x061d('0x0'));var AWS=require('aws-sdk');var rp=require(_0x061d('0x1'));var util=require(_0x061d('0x2'));var BPromise=require('bluebird');var db=require(_0x061d('0x3'))['db'];var logger=require('../../config/logger')(_0x061d('0x4'));function getTranscriptionJob(_0x21af8d,_0x48c88c,_0x441375,_0x152a73){return new Promise(function(_0x14e976,_0x255478){var _0x1edb0c=new AWS[(_0x061d('0x5'))]({'accessKeyId':_0x48c88c,'secretAccessKey':_0x21af8d,'region':_0x441375});_0x1edb0c[_0x061d('0x6')]({'TranscriptionJobName':_0x152a73},function(_0x572b0e,_0x4b6606){if(_0x572b0e){return _0x255478(_0x572b0e);}else{return _0x14e976(_0x4b6606);}});});}function sentiment(_0x54b498,_0x311d7c,_0x5d5a4b,_0x2443db,_0x148e76){return new Promise(function(_0x517437,_0x295620){var _0x1e9b5b=new AWS[(_0x061d('0x7'))]({'accessKeyId':_0x311d7c,'secretAccessKey':_0x54b498,'region':_0x5d5a4b});_0x1e9b5b[_0x061d('0x8')]({'Text':_0x2443db,'LanguageCode':_0x148e76[_0x061d('0x9')](0x0,0x2)},function(_0x14209b,_0x3872fd){if(_0x14209b){return _0x295620(_0x14209b);}else{return _0x517437(_0x3872fd);}});});}function checkTranscribeJob(_0x4827bc,_0x3fed5f,_0x35c760){var _0x1bbe47;return new BPromise(function(_0x237136,_0x35cdaf){logger[_0x061d('0xa')](util[_0x061d('0xb')](_0x061d('0xc'),_0x4827bc['id'],_0x4827bc[_0x061d('0xd')]));return getTranscriptionJob(_0x35c760[_0x061d('0xe')],_0x35c760['data2'],_0x3fed5f[_0x061d('0xf')],_0x4827bc[_0x061d('0xd')])[_0x061d('0x10')](function(_0x4f926b){logger[_0x061d('0xa')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x4827bc['id'],_0x4827bc[_0x061d('0xd')],_0x4f926b[_0x061d('0x11')][_0x061d('0x12')]));if(!_0x4827bc[_0x061d('0x13')]){switch(_0x4f926b['TranscriptionJob'][_0x061d('0x12')]){case _0x061d('0x14'):var _0x3ae47b={'transcribeStatus':_0x4f926b['TranscriptionJob'][_0x061d('0x12')],'fileUri':_0x4f926b[_0x061d('0x11')][_0x061d('0x15')][_0x061d('0x16')]};logger['info'](util[_0x061d('0xb')](_0x061d('0x17'),_0x4827bc['id']));return rp({'uri':_0x4f926b['TranscriptionJob'][_0x061d('0x15')][_0x061d('0x16')],'json':!![]})[_0x061d('0x10')](function(_0x2efddf){logger[_0x061d('0xa')](util[_0x061d('0xb')](_0x061d('0x18'),_0x4827bc['id']));if(_0x2efddf&&_0x2efddf[_0x061d('0x19')]&&_0x2efddf['results'][_0x061d('0x1a')]&&_0x2efddf[_0x061d('0x19')]['transcripts'][_0x061d('0x1b')]){_0x3ae47b[_0x061d('0x13')]='';for(var _0x5b884a=0x0;_0x5b884a<_0x2efddf['results'][_0x061d('0x1a')][_0x061d('0x1b')];_0x5b884a++){_0x3ae47b[_0x061d('0x13')]+=_0x2efddf[_0x061d('0x19')][_0x061d('0x1a')][_0x5b884a][_0x061d('0x1c')]+'';}}return _0x4827bc['update'](_0x3ae47b);})['then'](function(){logger[_0x061d('0xa')](util[_0x061d('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4827bc['id']));if(!_0x4827bc[_0x061d('0x1d')]){throw new db['Sequelize'][(_0x061d('0x1e'))](_0x061d('0x1f'));}if(!_0x3fed5f[_0x061d('0x20')]||!_0x3fed5f[_0x061d('0x21')]||!_0x3fed5f[_0x061d('0x22')]||!_0x3fed5f[_0x061d('0x23')]||!_0x3fed5f[_0x061d('0x24')]){throw new db[(_0x061d('0x25'))][(_0x061d('0x1e'))](_0x061d('0x26'));}if(!_0x3ae47b[_0x061d('0x13')]){throw new Error(_0x061d('0x27'));}if(_0x3fed5f['sentimentAccountId']===_0x35c760['id']){return _0x35c760;}else{return db[_0x061d('0x28')][_0x061d('0x29')]({'where':{'id':_settings[_0x061d('0x21')]}});}})[_0x061d('0x10')](function(_0x545d34){if(!_0x545d34){throw new db[(_0x061d('0x25'))]['ValidationError'](_0x061d('0x2a'));}if(!_0x545d34['data1']||!_0x545d34[_0x061d('0x2b')]){throw new db[(_0x061d('0x25'))]['ValidationError'](_0x061d('0x2c'));}_0x1bbe47=_0x545d34;logger['info'](util[_0x061d('0xb')](_0x061d('0x2d'),_0x4827bc['id']));return sentiment(_0x1bbe47[_0x061d('0xe')],_0x1bbe47[_0x061d('0x2b')],_0x3fed5f[_0x061d('0x22')],_0x3ae47b['fileText'],_0x3fed5f[_0x061d('0x23')]);})[_0x061d('0x10')](function(_0x2cc972){logger[_0x061d('0xa')](util[_0x061d('0xb')](_0x061d('0x2e'),_0x4827bc['id']));return _0x4827bc[_0x061d('0x2f')]({'sentiment':_0x2cc972['Sentiment'],'sPositive':_0x2cc972[_0x061d('0x30')][_0x061d('0x31')],'sNegative':_0x2cc972['SentimentScore'][_0x061d('0x32')],'sMixed':_0x2cc972['SentimentScore'][_0x061d('0x33')],'sNeutral':_0x2cc972[_0x061d('0x30')][_0x061d('0x34')]});})['then'](function(){logger[_0x061d('0xa')](util[_0x061d('0xb')](_0x061d('0x35'),_0x4827bc['id']));_0x237136();});case _0x061d('0x36'):return _0x4827bc['update']({'transcribeStatus':_0x061d('0x36'),'failureReason':_0x4f926b[_0x061d('0x11')][_0x061d('0x37')]})[_0x061d('0x10')](function(){logger[_0x061d('0xa')](util[_0x061d('0xb')](_0x061d('0x35'),_0x4827bc['id']));_0x237136();});default:logger[_0x061d('0xa')](util[_0x061d('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x4827bc['id']));break;}}else{return BPromise[_0x061d('0x38')]()['then'](function(){if(!_0x4827bc[_0x061d('0x1d')]){throw new db['Sequelize'][(_0x061d('0x1e'))](_0x061d('0x1f'));}if(!_0x3fed5f['sentiment']||!_0x3fed5f['sentimentAccountId']||!_0x3fed5f['sentimentRegion']||!_0x3fed5f[_0x061d('0x23')]||!_0x3fed5f[_0x061d('0x24')]){throw new db['Sequelize'][(_0x061d('0x1e'))](_0x061d('0x26'));}if(!_0x4827bc[_0x061d('0x13')]){throw new Error(_0x061d('0x27'));}if(_0x3fed5f[_0x061d('0x21')]===_0x35c760['id']){return _0x35c760;}else{return db[_0x061d('0x28')][_0x061d('0x29')]({'where':{'id':_settings[_0x061d('0x21')]}});}})[_0x061d('0x10')](function(_0x5cc40e){if(!_0x5cc40e){throw new db[(_0x061d('0x25'))]['ValidationError'](_0x061d('0x2a'));}if(!_0x5cc40e[_0x061d('0xe')]||!_0x5cc40e[_0x061d('0x2b')]){throw new db['Sequelize'][(_0x061d('0x1e'))](_0x061d('0x2c'));}_0x1bbe47=_0x5cc40e;logger[_0x061d('0xa')](util['format'](_0x061d('0x2d'),_0x4827bc['id']));return sentiment(_0x1bbe47[_0x061d('0xe')],_0x1bbe47[_0x061d('0x2b')],_0x3fed5f[_0x061d('0x22')],_0x4827bc[_0x061d('0x13')],_0x3fed5f[_0x061d('0x23')]);})[_0x061d('0x10')](function(_0x1145da){logger[_0x061d('0xa')](util[_0x061d('0xb')](_0x061d('0x2e'),_0x4827bc['id']));return _0x4827bc[_0x061d('0x2f')]({'sentiment':_0x1145da[_0x061d('0x39')],'sPositive':_0x1145da['SentimentScore']['Positive'],'sNegative':_0x1145da[_0x061d('0x30')]['Negative'],'sMixed':_0x1145da[_0x061d('0x30')][_0x061d('0x33')],'sNeutral':_0x1145da[_0x061d('0x30')][_0x061d('0x34')],'transcribeStatus':_0x061d('0x14')});})[_0x061d('0x10')](function(){logger[_0x061d('0xa')](util[_0x061d('0xb')](_0x061d('0x35'),_0x4827bc['id']));_0x237136();});}})['catch'](function(_0x5ee577){if(_0x5ee577){if(!_0x5ee577['name']||_0x5ee577[_0x061d('0x3a')]!==_0x061d('0x3b')){logger[_0x061d('0x3c')](util[_0x061d('0xb')](_0x061d('0x3d'),_0x4827bc['id']),util[_0x061d('0x3e')](_0x5ee577,{'showHidden':![],'depth':null}));}}_0x237136();});});}function checkTranscribe(){var _0x3a06bb;var _0x1e3871;var _0x577ff6;return db[_0x061d('0x3f')]['findAll']({'where':{'transcribeStatus':_0x061d('0x40')}})[_0x061d('0x10')](function(_0x1c9f51){if(!_0x1c9f51||!_0x1c9f51[_0x061d('0x1b')]){throw new db[(_0x061d('0x25'))][(_0x061d('0x1e'))](_0x061d('0x41'));}_0x3a06bb=_0x1c9f51;return db[_0x061d('0x42')][_0x061d('0x29')]({'where':{'id':0x1}});})[_0x061d('0x10')](function(_0x5caf08){if(!_0x5caf08){throw new db['Sequelize'][(_0x061d('0x1e'))](_0x061d('0x43'));}_0x1e3871=_0x5caf08;if(!_0x1e3871[_0x061d('0x4')]||!_0x1e3871['transcribeAccountId']||!_0x1e3871['transcribeRegion']||!_0x1e3871[_0x061d('0x23')]||!_0x1e3871[_0x061d('0x24')]){throw new db[(_0x061d('0x25'))][(_0x061d('0x1e'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x061d('0x29')]({'where':{'id':_0x1e3871[_0x061d('0x44')]}});})[_0x061d('0x10')](function(_0xb3051f){if(!_0xb3051f){throw new db[(_0x061d('0x25'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0xb3051f['data1']||!_0xb3051f['data2']){throw new db[(_0x061d('0x25'))][(_0x061d('0x1e'))](_0x061d('0x2c'));}_0x577ff6=_0xb3051f;var _0x17e213=[];_0x3a06bb[_0x061d('0x45')](function(_0x416c6a){_0x17e213[_0x061d('0x46')](checkTranscribeJob(_0x416c6a,_0x1e3871,_0x577ff6));});return BPromise['all'](_0x17e213);})[_0x061d('0x47')](function(_0xa564b4){if(_0xa564b4){if(!_0xa564b4[_0x061d('0x3a')]||_0xa564b4[_0x061d('0x3a')]!==_0x061d('0x3b')){logger[_0x061d('0x3c')](util['inspect'](_0xa564b4,{'showHidden':![],'depth':null}));}}});}exports[_0x061d('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x88c3=['Cloud\x20Provider\x20not\x20available','forEach','push','all','lodash','request-promise','../../mysqldb','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','results','transcripts','length','fileText','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','update','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Neutral','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','transcribeRegion'];(function(_0x3d56b5,_0x21e8ec){var _0x54fdc3=function(_0x5cb95d){while(--_0x5cb95d){_0x3d56b5['push'](_0x3d56b5['shift']());}};_0x54fdc3(++_0x21e8ec);}(_0x88c3,0x1ee));var _0x388c=function(_0xfdf35b,_0x1f806b){_0xfdf35b=_0xfdf35b-0x0;var _0x3068b5=_0x88c3[_0xfdf35b];return _0x3068b5;};var _=require(_0x388c('0x0'));var AWS=require('aws-sdk');var rp=require(_0x388c('0x1'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x388c('0x2'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x41e92c,_0xab6dbb,_0x2baa68,_0x33c1dc){return new Promise(function(_0x28ed4d,_0x23199c){var _0x5a1c0d=new AWS[(_0x388c('0x3'))]({'accessKeyId':_0xab6dbb,'secretAccessKey':_0x41e92c,'region':_0x2baa68});_0x5a1c0d[_0x388c('0x4')]({'TranscriptionJobName':_0x33c1dc},function(_0x26be80,_0xc157a){if(_0x26be80){return _0x23199c(_0x26be80);}else{return _0x28ed4d(_0xc157a);}});});}function sentiment(_0x105e93,_0x17dbf8,_0x2debe9,_0x31963c,_0x4f1639){return new Promise(function(_0x39604c,_0x4f0a81){var _0x58659e=new AWS[(_0x388c('0x5'))]({'accessKeyId':_0x17dbf8,'secretAccessKey':_0x105e93,'region':_0x2debe9});_0x58659e[_0x388c('0x6')]({'Text':_0x31963c,'LanguageCode':_0x4f1639[_0x388c('0x7')](0x0,0x2)},function(_0x14a335,_0x3ea92c){if(_0x14a335){return _0x4f0a81(_0x14a335);}else{return _0x39604c(_0x3ea92c);}});});}function checkTranscribeJob(_0x302ea5,_0x462e13,_0x45a3fe){var _0x262ed1;return new BPromise(function(_0x5e82b1,_0x59f5f8){logger['info'](util[_0x388c('0x8')](_0x388c('0x9'),_0x302ea5['id'],_0x302ea5['transcribeName']));return getTranscriptionJob(_0x45a3fe[_0x388c('0xa')],_0x45a3fe[_0x388c('0xb')],_0x462e13['transcribeRegion'],_0x302ea5['transcribeName'])[_0x388c('0xc')](function(_0x3c5444){logger[_0x388c('0xd')](util['format'](_0x388c('0xe'),_0x302ea5['id'],_0x302ea5['transcribeName'],_0x3c5444[_0x388c('0xf')][_0x388c('0x10')]));if(!_0x302ea5['fileText']){switch(_0x3c5444['TranscriptionJob'][_0x388c('0x10')]){case _0x388c('0x11'):var _0x671bb5={'transcribeStatus':_0x3c5444['TranscriptionJob'][_0x388c('0x10')],'fileUri':_0x3c5444['TranscriptionJob'][_0x388c('0x12')][_0x388c('0x13')]};logger[_0x388c('0xd')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x302ea5['id']));return rp({'uri':_0x3c5444['TranscriptionJob']['Transcript'][_0x388c('0x13')],'json':!![]})['then'](function(_0xfff1f5){logger['info'](util[_0x388c('0x8')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x302ea5['id']));if(_0xfff1f5&&_0xfff1f5[_0x388c('0x14')]&&_0xfff1f5['results'][_0x388c('0x15')]&&_0xfff1f5[_0x388c('0x14')][_0x388c('0x15')][_0x388c('0x16')]){_0x671bb5[_0x388c('0x17')]='';for(var _0x2ce6cc=0x0;_0x2ce6cc<_0xfff1f5[_0x388c('0x14')][_0x388c('0x15')][_0x388c('0x16')];_0x2ce6cc++){_0x671bb5['fileText']+=_0xfff1f5['results'][_0x388c('0x15')][_0x2ce6cc]['transcript']+'';}}return _0x302ea5['update'](_0x671bb5);})['then'](function(){logger[_0x388c('0xd')](util[_0x388c('0x8')](_0x388c('0x18'),_0x302ea5['id']));if(!_0x302ea5[_0x388c('0x19')]){throw new db[(_0x388c('0x1a'))][(_0x388c('0x1b'))](_0x388c('0x1c'));}if(!_0x462e13[_0x388c('0x1d')]||!_0x462e13[_0x388c('0x1e')]||!_0x462e13[_0x388c('0x1f')]||!_0x462e13[_0x388c('0x20')]||!_0x462e13[_0x388c('0x21')]){throw new db['Sequelize']['ValidationError'](_0x388c('0x22'));}if(!_0x671bb5[_0x388c('0x17')]){throw new Error(_0x388c('0x23'));}if(_0x462e13['sentimentAccountId']===_0x45a3fe['id']){return _0x45a3fe;}else{return db[_0x388c('0x24')][_0x388c('0x25')]({'where':{'id':_settings[_0x388c('0x1e')]}});}})['then'](function(_0x201004){if(!_0x201004){throw new db[(_0x388c('0x1a'))][(_0x388c('0x1b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x201004['data1']||!_0x201004['data2']){throw new db[(_0x388c('0x1a'))][(_0x388c('0x1b'))]('Cloud\x20Provider\x20not\x20configured');}_0x262ed1=_0x201004;logger[_0x388c('0xd')](util[_0x388c('0x8')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x302ea5['id']));return sentiment(_0x262ed1[_0x388c('0xa')],_0x262ed1[_0x388c('0xb')],_0x462e13[_0x388c('0x1f')],_0x671bb5[_0x388c('0x17')],_0x462e13[_0x388c('0x20')]);})[_0x388c('0xc')](function(_0x5c0a2d){logger[_0x388c('0xd')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x302ea5['id']));return _0x302ea5['update']({'sentiment':_0x5c0a2d[_0x388c('0x26')],'sPositive':_0x5c0a2d[_0x388c('0x27')][_0x388c('0x28')],'sNegative':_0x5c0a2d[_0x388c('0x27')][_0x388c('0x29')],'sMixed':_0x5c0a2d[_0x388c('0x27')][_0x388c('0x2a')],'sNeutral':_0x5c0a2d['SentimentScore']['Neutral']});})[_0x388c('0xc')](function(){logger[_0x388c('0xd')](util[_0x388c('0x8')](_0x388c('0x18'),_0x302ea5['id']));_0x5e82b1();});case _0x388c('0x2b'):return _0x302ea5[_0x388c('0x2c')]({'transcribeStatus':_0x388c('0x2b'),'failureReason':_0x3c5444[_0x388c('0xf')][_0x388c('0x2d')]})[_0x388c('0xc')](function(){logger[_0x388c('0xd')](util['format'](_0x388c('0x18'),_0x302ea5['id']));_0x5e82b1();});default:logger[_0x388c('0xd')](util['format'](_0x388c('0x2e'),_0x302ea5['id']));break;}}else{return BPromise['resolve']()[_0x388c('0xc')](function(){if(!_0x302ea5[_0x388c('0x19')]){throw new db[(_0x388c('0x1a'))]['ValidationError'](_0x388c('0x1c'));}if(!_0x462e13[_0x388c('0x1d')]||!_0x462e13['sentimentAccountId']||!_0x462e13[_0x388c('0x1f')]||!_0x462e13[_0x388c('0x20')]||!_0x462e13['bucket']){throw new db[(_0x388c('0x1a'))][(_0x388c('0x1b'))](_0x388c('0x22'));}if(!_0x302ea5[_0x388c('0x17')]){throw new Error(_0x388c('0x23'));}if(_0x462e13[_0x388c('0x1e')]===_0x45a3fe['id']){return _0x45a3fe;}else{return db[_0x388c('0x24')][_0x388c('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x551b12){if(!_0x551b12){throw new db[(_0x388c('0x1a'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x551b12[_0x388c('0xa')]||!_0x551b12[_0x388c('0xb')]){throw new db[(_0x388c('0x1a'))]['ValidationError'](_0x388c('0x2f'));}_0x262ed1=_0x551b12;logger[_0x388c('0xd')](util['format'](_0x388c('0x30'),_0x302ea5['id']));return sentiment(_0x262ed1[_0x388c('0xa')],_0x262ed1['data2'],_0x462e13[_0x388c('0x1f')],_0x302ea5['fileText'],_0x462e13[_0x388c('0x20')]);})['then'](function(_0x1192f3){logger[_0x388c('0xd')](util[_0x388c('0x8')](_0x388c('0x31'),_0x302ea5['id']));return _0x302ea5[_0x388c('0x2c')]({'sentiment':_0x1192f3[_0x388c('0x26')],'sPositive':_0x1192f3[_0x388c('0x27')]['Positive'],'sNegative':_0x1192f3[_0x388c('0x27')][_0x388c('0x29')],'sMixed':_0x1192f3['SentimentScore'][_0x388c('0x2a')],'sNeutral':_0x1192f3[_0x388c('0x27')][_0x388c('0x32')],'transcribeStatus':_0x388c('0x11')});})['then'](function(){logger['info'](util['format'](_0x388c('0x18'),_0x302ea5['id']));_0x5e82b1();});}})[_0x388c('0x33')](function(_0x26050a){if(_0x26050a){if(!_0x26050a[_0x388c('0x34')]||_0x26050a['name']!==_0x388c('0x35')){logger[_0x388c('0x36')](util[_0x388c('0x8')](_0x388c('0x37'),_0x302ea5['id']),util[_0x388c('0x38')](_0x26050a,{'showHidden':![],'depth':null}));}}_0x5e82b1();});});}function checkTranscribe(){var _0x313b57;var _0x160ab5;var _0x57beb1;return db[_0x388c('0x39')][_0x388c('0x3a')]({'where':{'transcribeStatus':_0x388c('0x3b')}})[_0x388c('0xc')](function(_0x2144f4){if(!_0x2144f4||!_0x2144f4[_0x388c('0x16')]){throw new db['Sequelize'][(_0x388c('0x1b'))](_0x388c('0x3c'));}_0x313b57=_0x2144f4;return db[_0x388c('0x3d')][_0x388c('0x25')]({'where':{'id':0x1}});})[_0x388c('0xc')](function(_0x1dea5b){if(!_0x1dea5b){throw new db[(_0x388c('0x1a'))][(_0x388c('0x1b'))](_0x388c('0x3e'));}_0x160ab5=_0x1dea5b;if(!_0x160ab5[_0x388c('0x3f')]||!_0x160ab5[_0x388c('0x40')]||!_0x160ab5[_0x388c('0x41')]||!_0x160ab5[_0x388c('0x20')]||!_0x160ab5[_0x388c('0x21')]){throw new db[(_0x388c('0x1a'))][(_0x388c('0x1b'))]('Transcribe\x20not\x20configured');}return db[_0x388c('0x24')][_0x388c('0x25')]({'where':{'id':_0x160ab5[_0x388c('0x40')]}});})[_0x388c('0xc')](function(_0x59f557){if(!_0x59f557){throw new db[(_0x388c('0x1a'))]['ValidationError'](_0x388c('0x42'));}if(!_0x59f557[_0x388c('0xa')]||!_0x59f557['data2']){throw new db['Sequelize']['ValidationError'](_0x388c('0x2f'));}_0x57beb1=_0x59f557;var _0x5cf86e=[];_0x313b57[_0x388c('0x43')](function(_0x448b62){_0x5cf86e[_0x388c('0x44')](checkTranscribeJob(_0x448b62,_0x160ab5,_0x57beb1));});return BPromise[_0x388c('0x45')](_0x5cf86e);})[_0x388c('0x33')](function(_0x3b2dfc){if(_0x3b2dfc){if(!_0x3b2dfc[_0x388c('0x34')]||_0x3b2dfc[_0x388c('0x34')]!=='SequelizeValidationError'){logger[_0x388c('0x36')](util[_0x388c('0x38')](_0x3b2dfc,{'showHidden':![],'depth':null}));}}});}exports['start']=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 0e43303..63467ef 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 _0xe16b=['start','lodash','moment','ioredis','util','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','subtract','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe16b,0x8d));var _0xbe16=function(_0x353b8c,_0x39c803){_0x353b8c=_0x353b8c-0x0;var _0x2fcbd3=_0xe16b[_0x353b8c];return _0x2fcbd3;};'use strict';var _=require(_0xbe16('0x0'));var moment=require(_0xbe16('0x1'));var Redis=require(_0xbe16('0x2'));var util=require(_0xbe16('0x3'));var config=require('../../config/environment');var db=require(_0xbe16('0x4'))['db'];var logger=require('../logger')(_0xbe16('0x5'));config[_0xbe16('0x6')]=_[_0xbe16('0x7')](config['redis'],{'host':_0xbe16('0x8'),'port':0x18eb});var io=require(_0xbe16('0x9'))(new Redis(config[_0xbe16('0x6')]));function closeInteractions(){var _0x5b3a16=[];return db[_0xbe16('0xa')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xbe16('0xb')](0x18,_0xbe16('0xc'))}}})[_0xbe16('0xd')](function(_0x46eb35){if(_0x46eb35&&_0x46eb35[_0xbe16('0xe')]){_0x5b3a16=_[_0xbe16('0xf')](_0x46eb35||[],'id');logger['info'](_0xbe16('0x10'),_0x5b3a16[_0xbe16('0x11')]());return db[_0xbe16('0xa')][_0xbe16('0x12')]({'closeReason':_0xbe16('0x13'),'disposition':_0xbe16('0x14'),'closed':!![],'closedAt':moment()[_0xbe16('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x5b3a16}});}})[_0xbe16('0xd')](function(){if(_0x5b3a16&&_0x5b3a16[_0xbe16('0xe')]){logger[_0xbe16('0x16')](_0xbe16('0x17'),_0x5b3a16['join']());for(var _0x3d857f=0x0;_0x3d857f<_0x5b3a16['length'];_0x3d857f++){io['emit']('whatsappInteraction:update',{'id':_0x5b3a16[_0x3d857f],'closed':!![]});}}})['catch'](function(_0x11c47a){logger[_0xbe16('0x18')](_0xbe16('0x19'),_0x11c47a?util[_0xbe16('0x1a')](_0x11c47a,{'showHidden':![],'depth':null}):'');});}exports[_0xbe16('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x7156=['join','emit','error','start','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','then','map','info','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x459573,_0x35679e){var _0x51ffcd=function(_0x37bb90){while(--_0x37bb90){_0x459573['push'](_0x459573['shift']());}};_0x51ffcd(++_0x35679e);}(_0x7156,0x122));var _0x6715=function(_0x7ec7b4,_0x1c8b0e){_0x7ec7b4=_0x7ec7b4-0x0;var _0x307680=_0x7156[_0x7ec7b4];return _0x307680;};'use strict';var _=require('lodash');var moment=require(_0x6715('0x0'));var Redis=require(_0x6715('0x1'));var util=require('util');var config=require(_0x6715('0x2'));var db=require(_0x6715('0x3'))['db'];var logger=require(_0x6715('0x4'))(_0x6715('0x5'));config['redis']=_['defaults'](config[_0x6715('0x6')],{'host':_0x6715('0x7'),'port':0x18eb});var io=require(_0x6715('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x3dab2e=[];return db[_0x6715('0x9')][_0x6715('0xa')]({'raw':!![],'attributes':['id',_0x6715('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x6715('0xc'))}}})[_0x6715('0xd')](function(_0x1c418a){if(_0x1c418a&&_0x1c418a['length']){_0x3dab2e=_[_0x6715('0xe')](_0x1c418a||[],'id');logger[_0x6715('0xf')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x3dab2e['join']());return db['WhatsappInteraction'][_0x6715('0x10')]({'closeReason':'system','disposition':_0x6715('0x11'),'closed':!![],'closedAt':moment()[_0x6715('0x12')](_0x6715('0x13'))},{'where':{'id':_0x3dab2e}});}})['then'](function(){if(_0x3dab2e&&_0x3dab2e[_0x6715('0x14')]){logger[_0x6715('0xf')](_0x6715('0x15'),_0x3dab2e[_0x6715('0x16')]());for(var _0x322863=0x0;_0x322863<_0x3dab2e[_0x6715('0x14')];_0x322863++){io[_0x6715('0x17')]('whatsappInteraction:update',{'id':_0x3dab2e[_0x322863],'closed':!![]});}}})['catch'](function(_0x4d8ab9){logger[_0x6715('0x18')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x4d8ab9?util['inspect'](_0x4d8ab9,{'showHidden':![],'depth':null}):'');});}exports[_0x6715('0x19')]=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 90141ee..1299016 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf027=['CmHopper','bulkCreate','log','finished\x20populating','hopper1','hopper2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','now','Biondo','@xcally.com','CmContact','then','contacts1'];(function(_0x3cb41d,_0x2d7f6d){var _0x4dc372=function(_0x2e7351){while(--_0x2e7351){_0x3cb41d['push'](_0x3cb41d['shift']());}};_0x4dc372(++_0x2d7f6d);}(_0xf027,0xdf));var _0x7f02=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf027[_0x3ab51d];return _0x29a04e;};'use strict';var util=require(_0x7f02('0x0'));var db=require(_0x7f02('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7f02('0x2')]({'id':i,'firstName':_0x7f02('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x7f02('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7f02('0x5')](),'updatedAt':Date[_0x7f02('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x7f02('0x3')+i,'lastName':_0x7f02('0x6')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x7f02('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7f02('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x7f02('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7f02('0x5')](),'updatedAt':Date[_0x7f02('0x5')]()});}db[_0x7f02('0x8')]['destroy']({'where':{}})[_0x7f02('0x9')](function(){return db['CmContact']['bulkCreate'](contacts);})[_0x7f02('0x9')](function(){console['log']('finished\x20populating',_0x7f02('0xa'));return db[_0x7f02('0xb')]['destroy']({'where':{}});})[_0x7f02('0x9')](function(){return db[_0x7f02('0xb')][_0x7f02('0xc')](hopper);})['then'](function(){console[_0x7f02('0xd')](_0x7f02('0xe'),_0x7f02('0xf'));return db[_0x7f02('0x8')][_0x7f02('0xc')](contacts2);})[_0x7f02('0x9')](function(){console['log'](_0x7f02('0xe'),'contacts2');return db[_0x7f02('0xb')][_0x7f02('0xc')](hopper2);})[_0x7f02('0x9')](function(){console[_0x7f02('0xd')]('finished\x20populating',_0x7f02('0x10'));})[_0x7f02('0x11')](function(_0x53a351){console['log'](_0x53a351);}); \ No newline at end of file +var _0xbeb4=['@xcally.com','now','CmContact','destroy','then','log','finished\x20populating','CmHopper','bulkCreate','hopper1','contacts2','catch','util','push','Innocenzo','innocenzo.biondo'];(function(_0x9cf5e2,_0x31466c){var _0x4d1955=function(_0x47394b){while(--_0x47394b){_0x9cf5e2['push'](_0x9cf5e2['shift']());}};_0x4d1955(++_0x31466c);}(_0xbeb4,0x14c));var _0x4beb=function(_0x474143,_0x267638){_0x474143=_0x474143-0x0;var _0x156964=_0xbeb4[_0x474143];return _0x156964;};'use strict';var util=require(_0x4beb('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4beb('0x1')]({'id':i,'firstName':_0x4beb('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x4beb('0x3')+i+_0x4beb('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x4beb('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4beb('0x5')](),'updatedAt':Date[_0x4beb('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4beb('0x1')]({'id':i,'firstName':_0x4beb('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x4beb('0x3')+i+_0x4beb('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4beb('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4beb('0x5')](),'updatedAt':Date[_0x4beb('0x5')]()});}db[_0x4beb('0x6')][_0x4beb('0x7')]({'where':{}})[_0x4beb('0x8')](function(){return db[_0x4beb('0x6')]['bulkCreate'](contacts);})[_0x4beb('0x8')](function(){console[_0x4beb('0x9')](_0x4beb('0xa'),'contacts1');return db[_0x4beb('0xb')]['destroy']({'where':{}});})[_0x4beb('0x8')](function(){return db['CmHopper'][_0x4beb('0xc')](hopper);})[_0x4beb('0x8')](function(){console[_0x4beb('0x9')](_0x4beb('0xa'),_0x4beb('0xd'));return db[_0x4beb('0x6')][_0x4beb('0xc')](contacts2);})['then'](function(){console[_0x4beb('0x9')]('finished\x20populating',_0x4beb('0xe'));return db[_0x4beb('0xb')][_0x4beb('0xc')](hopper2);})[_0x4beb('0x8')](function(){console[_0x4beb('0x9')]('finished\x20populating','hopper2');})[_0x4beb('0xf')](function(_0x70cebb){console[_0x4beb('0x9')](_0x70cebb);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index ea3cb4f..bf3323b 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d67=['%s%s@xcally.com','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','then','add\x20user','catch','log','util','../mysqldb','format','%s%s','agent'];(function(_0x29781a,_0x4797a8){var _0x9b90f4=function(_0x4b8f61){while(--_0x4b8f61){_0x29781a['push'](_0x29781a['shift']());}};_0x9b90f4(++_0x4797a8);}(_0x2d67,0xf7));var _0x72d6=function(_0x1a2581,_0x44dab6){_0x1a2581=_0x1a2581-0x0;var _0x21ef3e=_0x2d67[_0x1a2581];return _0x21ef3e;};'use strict';var util=require(_0x72d6('0x0'));var db=require(_0x72d6('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x72d6('0x2')](_0x72d6('0x3'),_0x72d6('0x4'),i),'fullname':util['format'](_0x72d6('0x3'),_0x72d6('0x4'),i),'email':util[_0x72d6('0x2')](_0x72d6('0x5'),_0x72d6('0x4'),i),'role':'agent','password':_0x72d6('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x72d6('0x7'),'ws',_0x72d6('0x8')],'disallow':[_0x72d6('0x9')],'allow':[_0x72d6('0xa')],'defaultuser':util['format']('%s%s',_0x72d6('0x4'),i),'encryption':_0x72d6('0xb'),'avpf':_0x72d6('0xb'),'force_avp':_0x72d6('0xb'),'icesupport':_0x72d6('0xb'),'dtlsenable':_0x72d6('0xb'),'dtlsverify':'no','dtlscertfile':_0x72d6('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x72d6('0xd'),'callerid':util[_0x72d6('0x2')]('\x22%s\x22\x20<%s>',util[_0x72d6('0x2')]('%s%s','agent',i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0x72d6('0xe')](function(){console['log'](_0x72d6('0xf'));})[_0x72d6('0x10')](function(_0x54f416){console[_0x72d6('0x11')](_0x54f416);}); \ No newline at end of file +var _0x5ac1=['\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','push','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0x5ac1,0x118));var _0x15ac=function(_0x56e4e8,_0x3f24c0){_0x56e4e8=_0x56e4e8-0x0;var _0x4cbf3b=_0x5ac1[_0x56e4e8];return _0x4cbf3b;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x15ac('0x0')]({'name':util['format'](_0x15ac('0x1'),_0x15ac('0x2'),i),'fullname':util[_0x15ac('0x3')](_0x15ac('0x1'),_0x15ac('0x2'),i),'email':util[_0x15ac('0x3')](_0x15ac('0x4'),_0x15ac('0x2'),i),'role':_0x15ac('0x2'),'password':_0x15ac('0x5'),'internal':0xfa0+i,'type':_0x15ac('0x6'),'transport':[_0x15ac('0x7'),'ws',_0x15ac('0x8')],'disallow':[_0x15ac('0x9')],'allow':[_0x15ac('0xa')],'defaultuser':util[_0x15ac('0x3')]('%s%s',_0x15ac('0x2'),i),'encryption':'yes','avpf':_0x15ac('0xb'),'force_avp':_0x15ac('0xb'),'icesupport':'yes','dtlsenable':_0x15ac('0xb'),'dtlsverify':'no','dtlscertfile':_0x15ac('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x15ac('0xd'),'callerid':util[_0x15ac('0x3')](_0x15ac('0xe'),util[_0x15ac('0x3')](_0x15ac('0x1'),_0x15ac('0x2'),i),0xfa0+i)});}db[_0x15ac('0xf')][_0x15ac('0x10')](users)[_0x15ac('0x11')](function(){console[_0x15ac('0x12')](_0x15ac('0x13'));})[_0x15ac('0x14')](function(_0x1c87a5){console[_0x15ac('0x12')](_0x1c87a5);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 83523b5..5b2df35 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b77=['format','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','FaxQueue','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','emit','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','User','role','agent','telephone','type','ivr','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','UserProfileResource','resourceId','map','where','Campaign'];(function(_0x1111d5,_0x2a79f9){var _0xf53a66=function(_0x5b699b){while(--_0x5b699b){_0x1111d5['push'](_0x1111d5['shift']());}};_0xf53a66(++_0x2a79f9);}(_0x7b77,0x179));var _0x77b7=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x7b77[_0x383356];return _0x32ee5a;};'use strict';var _=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var BPromise=require(_0x77b7('0x2'));var db=require(_0x77b7('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x77b7('0x4')],'include':[{'as':_0x77b7('0x5'),'model':db[_0x77b7('0x6')],'attributes':['id','name',_0x77b7('0x7')],'raw':!![],'where':{'role':_0x77b7('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x77b7('0x4')],'where':{'role':_0x77b7('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x77b7('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x77b7('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x77b7('0x4'),_0x77b7('0xa')],'where':{'type':_0x77b7('0xb')}};function getAssociatedResources(_0x4abf3a,_0x42a0e9,_0x4cfd3f){return db['UserProfileSection']['findOne']({'where':{'name':_0x4abf3a,'userProfileId':_0x42a0e9},'raw':!![]})[_0x77b7('0xc')](function(_0x2bf69a){if(_0x2bf69a){if(_0x2bf69a['autoAssociation']){switch(_0x4abf3a){case _0x77b7('0xd'):case _0x77b7('0xe'):case _0x77b7('0xf'):case _0x77b7('0x10'):case _0x77b7('0x11'):case _0x77b7('0x12'):case _0x77b7('0x13'):return db[_0x4cfd3f]['findAll'](queryQueues);case _0x77b7('0x14'):return db[_0x4cfd3f][_0x77b7('0x15')](queryTelephones);case'Trunks':return db[_0x4cfd3f]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x4cfd3f][_0x77b7('0x15')](queryCampaigns);}}else{return db[_0x77b7('0x16')][_0x77b7('0x15')]({'attributes':[_0x77b7('0x17')],'where':{'sectionId':_0x2bf69a['id']},'raw':!![]})[_0x77b7('0xc')](function(_0x17c826){if(_0x17c826){var _0x4dbe04={'where':{'id':_[_0x77b7('0x18')](_0x17c826,_0x77b7('0x17'))},'raw':!![]};switch(_0x4cfd3f){case _0x77b7('0x6'):_0x4dbe04[_0x77b7('0x19')][_0x77b7('0x7')]=_0x77b7('0x9');break;case _0x77b7('0x1a'):_0x4dbe04[_0x77b7('0x19')][_0x77b7('0xa')]='ivr';break;}return db[_0x4cfd3f]['findAll'](_0x4dbe04);}else{return[];}});}}else{return[];}})['then'](function(_0x3efa94){return _0x3efa94;});}function joinOrLeaveQueues(_0x5eff52,_0x4de2d2,_0x52983f,_0x57145c){_0x5eff52[_0x4de2d2](util[_0x77b7('0x1b')]('%s:queue:%s',_0x52983f,_0x57145c[_0x77b7('0x4')]));if(_0x57145c['Agents']){for(var _0x2107d7=0x0;_0x2107d7<_0x57145c['Agents'][_0x77b7('0x1c')];_0x2107d7+=0x1){_0x5eff52[_0x4de2d2](util['format'](_0x77b7('0x1d'),_0x57145c[_0x77b7('0x5')][_0x2107d7][_0x77b7('0x4')]));}}}function joinOrLeave(_0x345f5b,_0x289463,_0x45d105){var _0x29a892;if(_0x345f5b[_0x77b7('0x1e')][_0x77b7('0x1f')]['id']){db[_0x77b7('0x6')][_0x77b7('0x20')]({'attributes':['id',_0x77b7('0x4'),_0x77b7('0x7'),_0x77b7('0x21')],'where':{'id':_0x345f5b[_0x77b7('0x1e')][_0x77b7('0x1f')]['id']},'include':[{'model':db[_0x77b7('0x22')],'as':_0x77b7('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x77b7('0x24')],'as':_0x77b7('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x77b7('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x77b7('0x27')],'as':_0x77b7('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x77b7('0x29')],'as':_0x77b7('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x77b7('0xc')](function(_0x323363){if(_0x323363){_0x29a892=_0x323363;_0x345f5b[_0x289463](util[_0x77b7('0x1b')](_0x77b7('0x1d'),_0x323363[_0x77b7('0x4')]));var _0x525bb6=[];switch(_0x323363[_0x77b7('0x7')]){case _0x77b7('0x2b'):_0x345f5b[_0x289463](_0x77b7('0x2c'));_0x345f5b[_0x289463](_0x77b7('0x2d'));if(queryQueues[_0x77b7('0x2e')](_0x77b7('0x2f'))){delete queryQueues[_0x77b7('0x2f')];}_0x525bb6[_0x77b7('0x30')](db[_0x77b7('0x31')][_0x77b7('0x15')](queryQueues));_0x525bb6['push'](db[_0x77b7('0x32')][_0x77b7('0x15')](queryQueues));_0x525bb6[_0x77b7('0x30')](db['FaxQueue'][_0x77b7('0x15')](queryQueues));_0x525bb6['push'](db[_0x77b7('0x33')][_0x77b7('0x15')](queryQueues));_0x525bb6['push'](db[_0x77b7('0x34')]['findAll'](queryQueues));_0x525bb6[_0x77b7('0x30')](db[_0x77b7('0x35')][_0x77b7('0x15')](queryQueues));_0x525bb6['push'](db[_0x77b7('0x36')][_0x77b7('0x15')](queryQueues));_0x525bb6[_0x77b7('0x30')](db[_0x77b7('0x6')][_0x77b7('0x15')](queryTelephones));_0x525bb6[_0x77b7('0x30')](db[_0x77b7('0x37')][_0x77b7('0x15')](queryTrunks));_0x525bb6[_0x77b7('0x30')](db[_0x77b7('0x1a')][_0x77b7('0x15')](queryCampaigns));_0x525bb6[_0x77b7('0x30')](db[_0x77b7('0x6')]['findAll'](queryAgents));break;case _0x77b7('0x38'):_0x345f5b[_0x289463](_0x77b7('0x2c'));_0x345f5b[_0x289463](_0x77b7('0x2d'));_0x525bb6['push'](getAssociatedResources('VoiceQueues',_0x323363[_0x77b7('0x21')],_0x77b7('0x31')));_0x525bb6[_0x77b7('0x30')](getAssociatedResources(_0x77b7('0xe'),_0x323363[_0x77b7('0x21')],_0x77b7('0x32')));_0x525bb6[_0x77b7('0x30')](getAssociatedResources(_0x77b7('0xf'),_0x323363[_0x77b7('0x21')],_0x77b7('0x39')));_0x525bb6[_0x77b7('0x30')](getAssociatedResources(_0x77b7('0x10'),_0x323363[_0x77b7('0x21')],_0x77b7('0x33')));_0x525bb6[_0x77b7('0x30')](getAssociatedResources(_0x77b7('0x11'),_0x323363[_0x77b7('0x21')],_0x77b7('0x34')));_0x525bb6[_0x77b7('0x30')](getAssociatedResources(_0x77b7('0x12'),_0x323363[_0x77b7('0x21')],'OpenchannelQueue'));_0x525bb6[_0x77b7('0x30')](getAssociatedResources(_0x77b7('0x13'),_0x323363['userProfileId'],_0x77b7('0x36')));_0x525bb6['push'](getAssociatedResources(_0x77b7('0x14'),_0x323363[_0x77b7('0x21')],'User'));_0x525bb6[_0x77b7('0x30')](getAssociatedResources('Trunks',_0x323363['userProfileId'],_0x77b7('0x37')));_0x525bb6['push'](getAssociatedResources(_0x77b7('0x3a'),_0x323363['userProfileId'],_0x77b7('0x1a')));_0x525bb6[_0x77b7('0x30')](db[_0x77b7('0x6')][_0x77b7('0x15')](queryAgents));break;case _0x77b7('0x8'):_0x345f5b[_0x289463](_0x77b7('0x2c'));_0x345f5b[_0x289463]('voice:outbound');_0x525bb6[_0x77b7('0x30')](_0x323363[_0x77b7('0x3b')]({'attributes':['id',_0x77b7('0x4')]}));_0x525bb6[_0x77b7('0x30')](_0x323363[_0x77b7('0x3c')]({'attributes':['id',_0x77b7('0x4')]}));_0x525bb6[_0x77b7('0x30')](_0x323363[_0x77b7('0x3d')]({'attributes':['id','name']}));_0x525bb6[_0x77b7('0x30')](_0x323363['getSmsQueues']({'attributes':['id',_0x77b7('0x4')]}));_0x525bb6['push'](_0x323363[_0x77b7('0x3e')]({'attributes':['id',_0x77b7('0x4')]}));_0x525bb6[_0x77b7('0x30')](_0x323363[_0x77b7('0x3f')]({'attributes':['id',_0x77b7('0x4')]}));_0x525bb6[_0x77b7('0x30')](_0x323363[_0x77b7('0x40')]({'attributes':['id','name']}));break;}return BPromise[_0x77b7('0x41')](_0x525bb6);}})[_0x77b7('0xc')](function(_0x5c1041){if(_0x5c1041&&_0x5c1041['length']){for(var _0x309b0f=0x0;_0x309b0f<_0x5c1041['length'];_0x309b0f+=0x1){for(var _0x3a9d8b=0x0;_0x3a9d8b<_0x5c1041[_0x309b0f][_0x77b7('0x1c')];_0x3a9d8b+=0x1){switch(_0x309b0f){case 0x0:joinOrLeaveQueues(_0x345f5b,_0x289463,_0x77b7('0x42'),_0x5c1041[_0x309b0f][_0x3a9d8b]);break;case 0x1:joinOrLeaveQueues(_0x345f5b,_0x289463,_0x77b7('0x43'),_0x5c1041[_0x309b0f][_0x3a9d8b]);break;case 0x2:joinOrLeaveQueues(_0x345f5b,_0x289463,_0x77b7('0x44'),_0x5c1041[_0x309b0f][_0x3a9d8b]);break;case 0x3:joinOrLeaveQueues(_0x345f5b,_0x289463,_0x77b7('0x45'),_0x5c1041[_0x309b0f][_0x3a9d8b]);break;case 0x4:joinOrLeaveQueues(_0x345f5b,_0x289463,_0x77b7('0x46'),_0x5c1041[_0x309b0f][_0x3a9d8b]);break;case 0x5:joinOrLeaveQueues(_0x345f5b,_0x289463,_0x77b7('0x47'),_0x5c1041[_0x309b0f][_0x3a9d8b]);break;case 0x6:joinOrLeaveQueues(_0x345f5b,_0x289463,_0x77b7('0x48'),_0x5c1041[_0x309b0f][_0x3a9d8b]);break;case 0x7:if(_0x29a892[_0x77b7('0x7')]!==_0x77b7('0x8'))_0x345f5b[_0x289463](util[_0x77b7('0x1b')](_0x77b7('0x49'),_0x5c1041[_0x309b0f][_0x3a9d8b][_0x77b7('0x4')]));break;case 0x8:if(_0x29a892[_0x77b7('0x7')]!=='agent')_0x345f5b[_0x289463](util[_0x77b7('0x1b')]('trunk:%s',_0x5c1041[_0x309b0f][_0x3a9d8b][_0x77b7('0x4')]));break;case 0x9:if(_0x29a892['role']!==_0x77b7('0x8'))_0x345f5b[_0x289463](util[_0x77b7('0x1b')](_0x77b7('0x4a'),_0x5c1041[_0x309b0f][_0x3a9d8b][_0x77b7('0xa')],_0x5c1041[_0x309b0f][_0x3a9d8b]['name']));break;case 0xa:_0x345f5b[_0x289463](util[_0x77b7('0x1b')]('user:%s',_0x5c1041[_0x309b0f][_0x3a9d8b][_0x77b7('0x4')]));break;}}}}})[_0x77b7('0xc')](function(){if(_0x289463==='leave'){var _0x5af3be=_['map'](_0x29a892[_0x77b7('0x23')],'id');return _0x29a892['removeChatInteractions'](_0x5af3be)[_0x77b7('0xc')](function(){for(var _0x1f3559=0x0;_0x1f3559<_0x5af3be[_0x77b7('0x1c')];_0x1f3559+=0x1){_0x45d105[_0x77b7('0x4b')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x5af3be[_0x1f3559]),'UserId':Number(_0x29a892['id'])});}});}})[_0x77b7('0xc')](function(){if(_0x289463===_0x77b7('0x4c')){var _0x340a1=_[_0x77b7('0x18')](_0x29a892['MailInteractions'],'id');return _0x29a892[_0x77b7('0x4d')](_0x340a1)[_0x77b7('0xc')](function(){for(var _0x55870a=0x0;_0x55870a<_0x340a1[_0x77b7('0x1c')];_0x55870a+=0x1){_0x45d105[_0x77b7('0x4b')](_0x77b7('0x4e'),{'MailInteractionId':Number(_0x340a1[_0x55870a]),'UserId':Number(_0x29a892['id'])});}});}})[_0x77b7('0xc')](function(){if(_0x289463===_0x77b7('0x4c')){var _0x4624a1=_[_0x77b7('0x18')](_0x29a892['FaxInteractions'],'id');return _0x29a892[_0x77b7('0x4f')](_0x4624a1)[_0x77b7('0xc')](function(){for(var _0x5ced21=0x0;_0x5ced21<_0x4624a1[_0x77b7('0x1c')];_0x5ced21+=0x1){_0x45d105[_0x77b7('0x4b')](_0x77b7('0x50'),{'FaxInteractionId':Number(_0x4624a1[_0x5ced21]),'UserId':Number(_0x29a892['id'])});}});}})[_0x77b7('0xc')](function(){if(_0x289463==='leave'){var _0x50e6ab=_[_0x77b7('0x18')](_0x29a892[_0x77b7('0x51')],'id');return _0x29a892['removeSmsInteractions'](_0x50e6ab)['then'](function(){for(var _0x2f89ed=0x0;_0x2f89ed<_0x50e6ab[_0x77b7('0x1c')];_0x2f89ed+=0x1){_0x45d105[_0x77b7('0x4b')](_0x77b7('0x52'),{'SmsInteractionId':Number(_0x50e6ab[_0x2f89ed]),'UserId':Number(_0x29a892['id'])});}});}})[_0x77b7('0xc')](function(){if(_0x289463===_0x77b7('0x4c')){var _0x1f12d3=_[_0x77b7('0x18')](_0x29a892['OpenchannelInteractions'],'id');return _0x29a892['removeOpenchannelInteractions'](_0x1f12d3)[_0x77b7('0xc')](function(){for(var _0xb4bfdd=0x0;_0xb4bfdd<_0x1f12d3[_0x77b7('0x1c')];_0xb4bfdd+=0x1){_0x45d105[_0x77b7('0x4b')](_0x77b7('0x53'),{'OpenchannelInteractionId':Number(_0x1f12d3[_0xb4bfdd]),'UserId':Number(_0x29a892['id'])});}});}})['then'](function(){if(_0x289463==='leave'){var _0x642f7a=_[_0x77b7('0x18')](_0x29a892['WhatsappInteractions'],'id');return _0x29a892[_0x77b7('0x54')](_0x642f7a)['then'](function(){for(var _0x45c167=0x0;_0x45c167<_0x642f7a[_0x77b7('0x1c')];_0x45c167+=0x1){_0x45d105[_0x77b7('0x4b')](_0x77b7('0x55'),{'WhatsappInteractionId':Number(_0x642f7a[_0x45c167]),'UserId':Number(_0x29a892['id'])});}});}})[_0x77b7('0x56')](function(_0x346083){_0x345f5b[_0x77b7('0x57')](_0x346083);});}}function onDisconnect(_0x1f590e,_0x1092da){joinOrLeave(_0x1f590e,_0x77b7('0x4c'),_0x1092da);}function onConnect(_0x1be996){joinOrLeave(_0x1be996,'join');}exports[_0x77b7('0x58')]=function(_0x3badae){_0x3badae['on'](_0x77b7('0x59'),function(_0xf760e5){_0xf760e5[_0x77b7('0x5a')](0x0);_0xf760e5[_0x77b7('0x5b')]=_0xf760e5[_0x77b7('0x5c')]['connection'][_0x77b7('0x5d')]+':'+_0xf760e5[_0x77b7('0x5c')][_0x77b7('0x59')][_0x77b7('0x5e')];_0xf760e5[_0x77b7('0x5f')]=new Date();_0xf760e5[_0x77b7('0x57')]=function(_0x2e4b13){console[_0x77b7('0x57')](_0x77b7('0x60')+_0xf760e5[_0x77b7('0x61')][_0x77b7('0x4')]+'['+_0xf760e5[_0x77b7('0x5b')]+']',_0x2e4b13);};_0xf760e5['on'](_0x77b7('0x62'),function(){onDisconnect(_0xf760e5,_0x3badae);_0xf760e5[_0x77b7('0x57')](_0x77b7('0x63'));});onConnect(_0xf760e5);_0xf760e5[_0x77b7('0x57')](_0x77b7('0x64'));});}; \ No newline at end of file +var _0x14b2=['getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','emit','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','role','telephone','agent','type','findOne','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','then','map','resourceId','Campaign','where','ivr','format','%s:queue:%s','length','user:%s','handshake','query','User','find','userProfileId','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','OpenchannelQueue','ChatQueue','FaxQueues','SmsQueue','WhatsappQueue','Telephones','Trunk','getChatQueues'];(function(_0x4cec22,_0x3559b2){var _0x48f7ed=function(_0x40cd9e){while(--_0x40cd9e){_0x4cec22['push'](_0x4cec22['shift']());}};_0x48f7ed(++_0x3559b2);}(_0x14b2,0x1a1));var _0x214b=function(_0x53a439,_0x570abb){_0x53a439=_0x53a439-0x0;var _0x3ed2dd=_0x14b2[_0x53a439];return _0x3ed2dd;};'use strict';var _=require(_0x214b('0x0'));var util=require(_0x214b('0x1'));var BPromise=require('bluebird');var db=require(_0x214b('0x2'))['db'];var config=require(_0x214b('0x3'));var queryQueues={'attributes':['id',_0x214b('0x4')],'include':[{'as':_0x214b('0x5'),'model':db['User'],'attributes':['id',_0x214b('0x4'),_0x214b('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x214b('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x214b('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x214b('0x4')],'where':{'role':_0x214b('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x214b('0x4'),_0x214b('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x3dff9b,_0x50950f,_0x232e01){return db['UserProfileSection'][_0x214b('0xa')]({'where':{'name':_0x3dff9b,'userProfileId':_0x50950f},'raw':!![]})['then'](function(_0x5ccdfd){if(_0x5ccdfd){if(_0x5ccdfd['autoAssociation']){switch(_0x3dff9b){case _0x214b('0xb'):case _0x214b('0xc'):case'FaxQueues':case _0x214b('0xd'):case _0x214b('0xe'):case _0x214b('0xf'):case'WhatsappQueues':return db[_0x232e01][_0x214b('0x10')](queryQueues);case'Telephones':return db[_0x232e01]['findAll'](queryTelephones);case _0x214b('0x11'):return db[_0x232e01][_0x214b('0x10')](queryTrunks);case _0x214b('0x12'):return db[_0x232e01][_0x214b('0x10')](queryCampaigns);}}else{return db[_0x214b('0x13')][_0x214b('0x10')]({'attributes':['resourceId'],'where':{'sectionId':_0x5ccdfd['id']},'raw':!![]})[_0x214b('0x14')](function(_0x47f5fe){if(_0x47f5fe){var _0xd50b11={'where':{'id':_[_0x214b('0x15')](_0x47f5fe,_0x214b('0x16'))},'raw':!![]};switch(_0x232e01){case'User':_0xd50b11['where'][_0x214b('0x6')]='telephone';break;case _0x214b('0x17'):_0xd50b11[_0x214b('0x18')]['type']=_0x214b('0x19');break;}return db[_0x232e01]['findAll'](_0xd50b11);}else{return[];}});}}else{return[];}})[_0x214b('0x14')](function(_0x31da06){return _0x31da06;});}function joinOrLeaveQueues(_0x300794,_0x4b0b9c,_0x14c45c,_0x1e80bc){_0x300794[_0x4b0b9c](util[_0x214b('0x1a')](_0x214b('0x1b'),_0x14c45c,_0x1e80bc[_0x214b('0x4')]));if(_0x1e80bc['Agents']){for(var _0x54248e=0x0;_0x54248e<_0x1e80bc[_0x214b('0x5')][_0x214b('0x1c')];_0x54248e+=0x1){_0x300794[_0x4b0b9c](util[_0x214b('0x1a')](_0x214b('0x1d'),_0x1e80bc['Agents'][_0x54248e][_0x214b('0x4')]));}}}function joinOrLeave(_0x15cfd3,_0x168a18,_0x8eb464){var _0x55daef;if(_0x15cfd3[_0x214b('0x1e')][_0x214b('0x1f')]['id']){db[_0x214b('0x20')][_0x214b('0x21')]({'attributes':['id',_0x214b('0x4'),_0x214b('0x6'),_0x214b('0x22')],'where':{'id':_0x15cfd3[_0x214b('0x1e')][_0x214b('0x1f')]['id']},'include':[{'model':db[_0x214b('0x23')],'as':_0x214b('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x214b('0x25')],'as':_0x214b('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x214b('0x27')],'as':_0x214b('0x28'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x214b('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x214b('0x2a')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x411813){if(_0x411813){_0x55daef=_0x411813;_0x15cfd3[_0x168a18](util[_0x214b('0x1a')](_0x214b('0x1d'),_0x411813['name']));var _0x1b3a94=[];switch(_0x411813['role']){case'admin':_0x15cfd3[_0x168a18](_0x214b('0x2b'));_0x15cfd3[_0x168a18](_0x214b('0x2c'));if(queryQueues[_0x214b('0x2d')](_0x214b('0x2e'))){delete queryQueues[_0x214b('0x2e')];}_0x1b3a94[_0x214b('0x2f')](db[_0x214b('0x30')][_0x214b('0x10')](queryQueues));_0x1b3a94['push'](db['ChatQueue'][_0x214b('0x10')](queryQueues));_0x1b3a94[_0x214b('0x2f')](db[_0x214b('0x31')][_0x214b('0x10')](queryQueues));_0x1b3a94['push'](db['SmsQueue'][_0x214b('0x10')](queryQueues));_0x1b3a94[_0x214b('0x2f')](db['MailQueue'][_0x214b('0x10')](queryQueues));_0x1b3a94[_0x214b('0x2f')](db[_0x214b('0x32')][_0x214b('0x10')](queryQueues));_0x1b3a94[_0x214b('0x2f')](db['WhatsappQueue'][_0x214b('0x10')](queryQueues));_0x1b3a94[_0x214b('0x2f')](db['User'][_0x214b('0x10')](queryTelephones));_0x1b3a94['push'](db['Trunk'][_0x214b('0x10')](queryTrunks));_0x1b3a94['push'](db[_0x214b('0x17')]['findAll'](queryCampaigns));_0x1b3a94[_0x214b('0x2f')](db[_0x214b('0x20')][_0x214b('0x10')](queryAgents));break;case'user':_0x15cfd3[_0x168a18](_0x214b('0x2b'));_0x15cfd3[_0x168a18](_0x214b('0x2c'));_0x1b3a94[_0x214b('0x2f')](getAssociatedResources(_0x214b('0xb'),_0x411813[_0x214b('0x22')],'VoiceQueue'));_0x1b3a94[_0x214b('0x2f')](getAssociatedResources(_0x214b('0xc'),_0x411813[_0x214b('0x22')],_0x214b('0x33')));_0x1b3a94[_0x214b('0x2f')](getAssociatedResources(_0x214b('0x34'),_0x411813[_0x214b('0x22')],'FaxQueue'));_0x1b3a94[_0x214b('0x2f')](getAssociatedResources(_0x214b('0xd'),_0x411813[_0x214b('0x22')],_0x214b('0x35')));_0x1b3a94[_0x214b('0x2f')](getAssociatedResources('MailQueues',_0x411813['userProfileId'],'MailQueue'));_0x1b3a94[_0x214b('0x2f')](getAssociatedResources(_0x214b('0xf'),_0x411813[_0x214b('0x22')],_0x214b('0x32')));_0x1b3a94[_0x214b('0x2f')](getAssociatedResources('WhatsappQueues',_0x411813[_0x214b('0x22')],_0x214b('0x36')));_0x1b3a94[_0x214b('0x2f')](getAssociatedResources(_0x214b('0x37'),_0x411813[_0x214b('0x22')],_0x214b('0x20')));_0x1b3a94['push'](getAssociatedResources(_0x214b('0x11'),_0x411813[_0x214b('0x22')],_0x214b('0x38')));_0x1b3a94[_0x214b('0x2f')](getAssociatedResources(_0x214b('0x12'),_0x411813[_0x214b('0x22')],'Campaign'));_0x1b3a94['push'](db[_0x214b('0x20')][_0x214b('0x10')](queryAgents));break;case _0x214b('0x8'):_0x15cfd3[_0x168a18](_0x214b('0x2b'));_0x15cfd3[_0x168a18](_0x214b('0x2c'));_0x1b3a94[_0x214b('0x2f')](_0x411813['getVoiceQueues']({'attributes':['id',_0x214b('0x4')]}));_0x1b3a94[_0x214b('0x2f')](_0x411813[_0x214b('0x39')]({'attributes':['id',_0x214b('0x4')]}));_0x1b3a94[_0x214b('0x2f')](_0x411813[_0x214b('0x3a')]({'attributes':['id',_0x214b('0x4')]}));_0x1b3a94[_0x214b('0x2f')](_0x411813[_0x214b('0x3b')]({'attributes':['id',_0x214b('0x4')]}));_0x1b3a94[_0x214b('0x2f')](_0x411813[_0x214b('0x3c')]({'attributes':['id',_0x214b('0x4')]}));_0x1b3a94['push'](_0x411813[_0x214b('0x3d')]({'attributes':['id',_0x214b('0x4')]}));_0x1b3a94['push'](_0x411813['getWhatsappQueues']({'attributes':['id',_0x214b('0x4')]}));break;}return BPromise['all'](_0x1b3a94);}})[_0x214b('0x14')](function(_0x5c8c89){if(_0x5c8c89&&_0x5c8c89[_0x214b('0x1c')]){for(var _0x3df933=0x0;_0x3df933<_0x5c8c89[_0x214b('0x1c')];_0x3df933+=0x1){for(var _0x22e38c=0x0;_0x22e38c<_0x5c8c89[_0x3df933]['length'];_0x22e38c+=0x1){switch(_0x3df933){case 0x0:joinOrLeaveQueues(_0x15cfd3,_0x168a18,_0x214b('0x3e'),_0x5c8c89[_0x3df933][_0x22e38c]);break;case 0x1:joinOrLeaveQueues(_0x15cfd3,_0x168a18,_0x214b('0x3f'),_0x5c8c89[_0x3df933][_0x22e38c]);break;case 0x2:joinOrLeaveQueues(_0x15cfd3,_0x168a18,_0x214b('0x40'),_0x5c8c89[_0x3df933][_0x22e38c]);break;case 0x3:joinOrLeaveQueues(_0x15cfd3,_0x168a18,_0x214b('0x41'),_0x5c8c89[_0x3df933][_0x22e38c]);break;case 0x4:joinOrLeaveQueues(_0x15cfd3,_0x168a18,'mail',_0x5c8c89[_0x3df933][_0x22e38c]);break;case 0x5:joinOrLeaveQueues(_0x15cfd3,_0x168a18,_0x214b('0x42'),_0x5c8c89[_0x3df933][_0x22e38c]);break;case 0x6:joinOrLeaveQueues(_0x15cfd3,_0x168a18,_0x214b('0x43'),_0x5c8c89[_0x3df933][_0x22e38c]);break;case 0x7:if(_0x55daef['role']!==_0x214b('0x8'))_0x15cfd3[_0x168a18](util[_0x214b('0x1a')](_0x214b('0x44'),_0x5c8c89[_0x3df933][_0x22e38c]['name']));break;case 0x8:if(_0x55daef[_0x214b('0x6')]!==_0x214b('0x8'))_0x15cfd3[_0x168a18](util['format']('trunk:%s',_0x5c8c89[_0x3df933][_0x22e38c]['name']));break;case 0x9:if(_0x55daef[_0x214b('0x6')]!==_0x214b('0x8'))_0x15cfd3[_0x168a18](util[_0x214b('0x1a')](_0x214b('0x45'),_0x5c8c89[_0x3df933][_0x22e38c][_0x214b('0x9')],_0x5c8c89[_0x3df933][_0x22e38c]['name']));break;case 0xa:_0x15cfd3[_0x168a18](util[_0x214b('0x1a')](_0x214b('0x1d'),_0x5c8c89[_0x3df933][_0x22e38c][_0x214b('0x4')]));break;}}}}})[_0x214b('0x14')](function(){if(_0x168a18===_0x214b('0x46')){var _0x44f7eb=_[_0x214b('0x15')](_0x55daef[_0x214b('0x24')],'id');return _0x55daef[_0x214b('0x47')](_0x44f7eb)[_0x214b('0x14')](function(){for(var _0x53f1f0=0x0;_0x53f1f0<_0x44f7eb[_0x214b('0x1c')];_0x53f1f0+=0x1){_0x8eb464['emit'](_0x214b('0x48'),{'ChatInteractionId':Number(_0x44f7eb[_0x53f1f0]),'UserId':Number(_0x55daef['id'])});}});}})['then'](function(){if(_0x168a18===_0x214b('0x46')){var _0x20e289=_[_0x214b('0x15')](_0x55daef[_0x214b('0x49')],'id');return _0x55daef[_0x214b('0x4a')](_0x20e289)['then'](function(){for(var _0x401f99=0x0;_0x401f99<_0x20e289[_0x214b('0x1c')];_0x401f99+=0x1){_0x8eb464['emit'](_0x214b('0x4b'),{'MailInteractionId':Number(_0x20e289[_0x401f99]),'UserId':Number(_0x55daef['id'])});}});}})['then'](function(){if(_0x168a18==='leave'){var _0x188265=_[_0x214b('0x15')](_0x55daef['FaxInteractions'],'id');return _0x55daef[_0x214b('0x4c')](_0x188265)[_0x214b('0x14')](function(){for(var _0xef7db=0x0;_0xef7db<_0x188265[_0x214b('0x1c')];_0xef7db+=0x1){_0x8eb464[_0x214b('0x4d')](_0x214b('0x4e'),{'FaxInteractionId':Number(_0x188265[_0xef7db]),'UserId':Number(_0x55daef['id'])});}});}})['then'](function(){if(_0x168a18===_0x214b('0x46')){var _0x455928=_[_0x214b('0x15')](_0x55daef['SmsInteractions'],'id');return _0x55daef['removeSmsInteractions'](_0x455928)[_0x214b('0x14')](function(){for(var _0x315fce=0x0;_0x315fce<_0x455928[_0x214b('0x1c')];_0x315fce+=0x1){_0x8eb464[_0x214b('0x4d')](_0x214b('0x4f'),{'SmsInteractionId':Number(_0x455928[_0x315fce]),'UserId':Number(_0x55daef['id'])});}});}})['then'](function(){if(_0x168a18===_0x214b('0x46')){var _0x30e762=_[_0x214b('0x15')](_0x55daef[_0x214b('0x29')],'id');return _0x55daef[_0x214b('0x50')](_0x30e762)['then'](function(){for(var _0x431c81=0x0;_0x431c81<_0x30e762[_0x214b('0x1c')];_0x431c81+=0x1){_0x8eb464[_0x214b('0x4d')](_0x214b('0x51'),{'OpenchannelInteractionId':Number(_0x30e762[_0x431c81]),'UserId':Number(_0x55daef['id'])});}});}})[_0x214b('0x14')](function(){if(_0x168a18===_0x214b('0x46')){var _0x32ce79=_[_0x214b('0x15')](_0x55daef['WhatsappInteractions'],'id');return _0x55daef[_0x214b('0x52')](_0x32ce79)[_0x214b('0x14')](function(){for(var _0x3955b6=0x0;_0x3955b6<_0x32ce79[_0x214b('0x1c')];_0x3955b6+=0x1){_0x8eb464[_0x214b('0x4d')](_0x214b('0x53'),{'WhatsappInteractionId':Number(_0x32ce79[_0x3955b6]),'UserId':Number(_0x55daef['id'])});}});}})[_0x214b('0x54')](function(_0x3d905d){_0x15cfd3[_0x214b('0x55')](_0x3d905d);});}}function onDisconnect(_0x3294f8,_0x21f9e3){joinOrLeave(_0x3294f8,_0x214b('0x46'),_0x21f9e3);}function onConnect(_0x646227){joinOrLeave(_0x646227,_0x214b('0x56'));}exports['default']=function(_0x1e18e1){_0x1e18e1['on'](_0x214b('0x57'),function(_0x59f653){_0x59f653[_0x214b('0x58')](0x0);_0x59f653[_0x214b('0x59')]=_0x59f653['request'][_0x214b('0x57')]['remoteAddress']+':'+_0x59f653[_0x214b('0x5a')][_0x214b('0x57')][_0x214b('0x5b')];_0x59f653[_0x214b('0x5c')]=new Date();_0x59f653[_0x214b('0x55')]=function(_0x5ec1c2){console[_0x214b('0x55')](_0x214b('0x5d')+_0x59f653['nsp'][_0x214b('0x4')]+'['+_0x59f653['address']+']',_0x5ec1c2);};_0x59f653['on']('disconnect',function(){onDisconnect(_0x59f653,_0x1e18e1);_0x59f653[_0x214b('0x55')]('DISCONNECTED');});onConnect(_0x59f653);_0x59f653['log'](_0x214b('0x5e'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 794e4ba..7429d16 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 _0xa68f=['Openchannel','OpenchannelMessage','request','info','Trigger,\x20%s','EventManager','error','code','catch','get','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','then','contact','UserId','interface','format','SIP/%s','name','agent','channel','outgoingmessage','AfterCreateMessage','opened','AfterCreate','closed','changed','substatus','AfterUpdate','User','find','fullname','internal','default','length','hasOwnProperty','model','hook','condition','../../mysqldb','../logger','triggers','client','http','ChatInteraction','afterCreate','newinteraction','closedinteraction','Chat','newmessage','Sms','SmsInteraction','afterUpdate','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage'];(function(_0x4b71b1,_0x3a7f21){var _0x3ce2ef=function(_0x79ea23){while(--_0x79ea23){_0x4b71b1['push'](_0x4b71b1['shift']());}};_0x3ce2ef(++_0x3a7f21);}(_0xa68f,0x199));var _0xfa68=function(_0x6c8104,_0x4f2a7f){_0x6c8104=_0x6c8104-0x0;var _0x44847c=_0xa68f[_0x6c8104];return _0x44847c;};'use strict';var util=require('util');var db=require(_0xfa68('0x0'))['db'];var jayson=require('jayson/promise');var logger=require(_0xfa68('0x1'))(_0xfa68('0x2'));var client=jayson[_0xfa68('0x3')][_0xfa68('0x4')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xfa68('0x5'),'event':_0xfa68('0x6'),'condition':_0xfa68('0x7'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':'afterUpdate','condition':_0xfa68('0x8'),'callback':afterUpdate},{'channel':_0xfa68('0x9'),'model':'ChatMessage','event':_0xfa68('0x6'),'condition':_0xfa68('0xa'),'callback':afterCreateMessage},{'channel':_0xfa68('0xb'),'model':_0xfa68('0xc'),'event':_0xfa68('0x6'),'condition':_0xfa68('0x7'),'callback':afterCreate},{'channel':_0xfa68('0xb'),'model':'SmsInteraction','event':_0xfa68('0xd'),'condition':_0xfa68('0x8'),'callback':afterUpdate},{'channel':_0xfa68('0xb'),'model':'SmsMessage','event':_0xfa68('0x6'),'condition':_0xfa68('0xa'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xfa68('0xe'),'event':_0xfa68('0x6'),'condition':_0xfa68('0x7'),'callback':afterCreate},{'channel':_0xfa68('0xf'),'model':'WhatsappInteraction','event':_0xfa68('0xd'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xfa68('0xf'),'model':_0xfa68('0x10'),'event':'afterCreate','condition':_0xfa68('0xa'),'callback':afterCreateMessage},{'channel':_0xfa68('0x11'),'model':'FaxInteraction','event':_0xfa68('0x6'),'condition':_0xfa68('0x7'),'callback':afterCreate},{'channel':'Fax','model':_0xfa68('0x12'),'event':_0xfa68('0xd'),'condition':_0xfa68('0x8'),'callback':afterUpdate},{'channel':'Fax','model':_0xfa68('0x13'),'event':_0xfa68('0x6'),'condition':_0xfa68('0xa'),'callback':afterCreateMessage},{'channel':'Mail','model':_0xfa68('0x14'),'event':_0xfa68('0x6'),'condition':_0xfa68('0x7'),'callback':afterCreate},{'channel':'Mail','model':_0xfa68('0x14'),'event':_0xfa68('0xd'),'condition':_0xfa68('0x8'),'callback':afterUpdate},{'channel':_0xfa68('0x15'),'model':_0xfa68('0x16'),'event':_0xfa68('0x6'),'condition':_0xfa68('0xa'),'callback':afterCreateMessage},{'channel':_0xfa68('0x17'),'model':'OpenchannelInteraction','event':'afterCreate','condition':_0xfa68('0x7'),'callback':afterCreate},{'channel':_0xfa68('0x17'),'model':'OpenchannelInteraction','event':_0xfa68('0xd'),'condition':_0xfa68('0x8'),'callback':afterUpdate},{'channel':_0xfa68('0x17'),'model':_0xfa68('0x18'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage}];function request(_0x32e047){return client[_0xfa68('0x19')]('EventManager',_0x32e047)['then'](function(_0xe9b02b){logger[_0xfa68('0x1a')](_0xfa68('0x1b'),_0xfa68('0x1c'),_0xe9b02b);if(_0xe9b02b['error']){if(_0xe9b02b[_0xfa68('0x1d')][_0xfa68('0x1e')]===0x1f4){logger[_0xfa68('0x1d')](_0xfa68('0x1b'),_0xfa68('0x1c'),_0xe9b02b[_0xfa68('0x1d')]);}}})[_0xfa68('0x1f')](function(_0x4d9092){logger['error'](_0xfa68('0x1b'),_0xfa68('0x1c'),_0x4d9092);});}function afterCreateMessage(_0x113838){return function(_0x36077e){_0x36077e=_0x36077e[_0xfa68('0x20')]({'plain':!![]});_0x36077e['channel']=_0x113838;_0x36077e[_0xfa68('0x21')]=_0x113838;_0x36077e[_0xfa68('0x22')]=_0x36077e[_0xfa68('0x23')];Promise[_0xfa68('0x24')]()['then'](function(){if(typeof _0x36077e[_0xfa68('0x25')]===_0xfa68('0x26'))return null;var _0x522876=_0xfa68('0x27')+_0x36077e['ContactId'];return db[_0xfa68('0x28')][_0xfa68('0x29')](_0x522876,{'type':db[_0xfa68('0x2a')][_0xfa68('0x2b')][_0xfa68('0x2c')],'raw':!![]});})[_0xfa68('0x2d')](function(_0x64c571){if(_0x64c571){_0x36077e[_0xfa68('0x2e')]=_0x64c571[0x0];}if(typeof _0x36077e[_0xfa68('0x2f')]===_0xfa68('0x26'))return;return getAgent(_0x36077e['UserId']);})[_0xfa68('0x2d')](function(_0x84387b){if(_0x84387b){_0x36077e[_0xfa68('0x30')]=util[_0xfa68('0x31')](_0xfa68('0x32'),_0x84387b[_0xfa68('0x33')]);_0x36077e[_0xfa68('0x34')]=_0x84387b;_0x36077e[_0xfa68('0x35')]=_0x113838;return request({'event':'incomingmessage','message':_0x36077e});}else{return request({'event':_0xfa68('0x36'),'message':_0x36077e});}})[_0xfa68('0x1f')](function(_0x753ae8){logger['error']('Trigger,\x20%s',_0xfa68('0x37'),_0x753ae8);});};}function afterCreate(_0x412e59,_0x464498){return function(_0x2f500d){_0x2f500d=_0x2f500d['get']({'plain':!![]});_0x2f500d[_0xfa68('0x35')]=_0x412e59;_0x2f500d[_0xfa68('0x21')]=_0x412e59;_0x2f500d[_0xfa68('0x22')]=_0xfa68('0x38');Promise[_0xfa68('0x24')]()[_0xfa68('0x2d')](function(){var _0x4d6b68=_0xfa68('0x27')+_0x2f500d[_0xfa68('0x25')];return db[_0xfa68('0x28')][_0xfa68('0x29')](_0x4d6b68,{'type':db[_0xfa68('0x2a')][_0xfa68('0x2b')]['SELECT'],'raw':!![]});})[_0xfa68('0x2d')](function(_0x2d2d0f){if(_0x2d2d0f){_0x2f500d[_0xfa68('0x2e')]=_0x2d2d0f[0x0];}if(typeof _0x2f500d[_0xfa68('0x2f')]==='undefined')return;return getAgent(_0x2f500d[_0xfa68('0x2f')]);})['then'](function(_0x1e8fc5){if(_0x1e8fc5){_0x2f500d[_0xfa68('0x30')]=util['format']('SIP/%s',_0x1e8fc5['name']);_0x2f500d['agent']=_0x1e8fc5;}return request({'event':_0x464498,'message':_0x2f500d});})[_0xfa68('0x1f')](function(_0x2ed82f){logger['error'](_0xfa68('0x1b'),_0xfa68('0x39'),_0x2ed82f);});};}function afterUpdate(_0x5412c2){return function(_0x427234){var _0x244e40=_0x427234['changed'](_0xfa68('0x3a'))&&_0x427234[_0xfa68('0x3a')];var _0x5900da=_0x427234[_0xfa68('0x3b')](_0xfa68('0x3c'));if(_0x244e40||_0x5900da){var _0x10f873=_0x244e40?'closedinteraction':_0xfa68('0x3c');var _0x1be407=_0x427234[_0xfa68('0x20')]({'plain':!![]});_0x1be407[_0xfa68('0x35')]=_0x5412c2;_0x1be407[_0xfa68('0x21')]=_0x5412c2;_0x1be407['event']=_0x244e40?'closed':_0xfa68('0x3c');var _0x25a7f9=_0xfa68('0x27')+_0x1be407[_0xfa68('0x25')];return db['sequelize'][_0xfa68('0x29')](_0x25a7f9,{'type':db[_0xfa68('0x2a')][_0xfa68('0x2b')][_0xfa68('0x2c')],'raw':!![]})[_0xfa68('0x2d')](function(_0x1e5fe9){if(_0x1e5fe9){_0x1be407[_0xfa68('0x2e')]=_0x1e5fe9[0x0];}if(typeof _0x1be407[_0xfa68('0x2f')]==='undefined')return;return getAgent(_0x1be407[_0xfa68('0x2f')]);})[_0xfa68('0x2d')](function(_0x107300){if(_0x107300){_0x1be407[_0xfa68('0x30')]=util[_0xfa68('0x31')](_0xfa68('0x32'),_0x107300[_0xfa68('0x33')]);_0x1be407['agent']=_0x107300;}return request({'event':_0x10f873,'message':_0x1be407});})['catch'](function(_0x357108){logger[_0xfa68('0x1d')](_0xfa68('0x1b'),_0xfa68('0x3d'),_0x357108);});}};}function getAgent(_0x21f8e2){return db[_0xfa68('0x3e')][_0xfa68('0x3f')]({'where':{'id':_0x21f8e2},'attributes':['id',_0xfa68('0x33'),_0xfa68('0x40'),'email',_0xfa68('0x41')],'raw':!![]})['then'](function(_0x36afe8){return _0x36afe8;});}exports[_0xfa68('0x42')]=function(){for(var _0x55c745=0x0;_0x55c745=_0x2a3106[_0xbc24('0x11')]){throw Error(_0xbc24('0x12'));}_0x19c585(_0x4a8a98);})[_0xbc24('0x13')](function(_0xf63b3e){_0x5cae15(_0xf63b3e);});});}; \ No newline at end of file +var _0xb3d1=['whatsapp','getChannels','toLowerCase','clearBlockUser','isUndefined','updateAttributes','role','agent','User','count','then','agents','catch','lodash','bluebird','./license/util','voice','chat','fax','sms'];(function(_0x2534cf,_0x545be6){var _0x221461=function(_0x379e83){while(--_0x379e83){_0x2534cf['push'](_0x2534cf['shift']());}};_0x221461(++_0x545be6);}(_0xb3d1,0xfd));var _0x1b3d=function(_0x4b1f9c,_0x422fc9){_0x4b1f9c=_0x4b1f9c-0x0;var _0x3e0632=_0xb3d1[_0x4b1f9c];return _0x3e0632;};'use strict';var _=require(_0x1b3d('0x0'));var BPromise=require(_0x1b3d('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x1b3d('0x2'));var channels=[_0x1b3d('0x3'),'mail',_0x1b3d('0x4'),_0x1b3d('0x5'),_0x1b3d('0x6'),_0x1b3d('0x7'),'openchannel'];exports[_0x1b3d('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x15fb39){_0x15fb39=_0x15fb39[_0x1b3d('0x9')]();return _['includes'](channels,_0x15fb39);};exports[_0x1b3d('0xa')]=function(_0x5b7006,_0x4944da,_0x491ac8,_0x534c09){var _0x2df83b={'loginAttempts':_0x4944da,'blocked':_0x491ac8};if(!_[_0x1b3d('0xb')](_0x534c09)){_0x2df83b['blockedAt']=_0x534c09;}return _0x5b7006[_0x1b3d('0xc')](_0x2df83b);};exports['getLicense']=function(_0x38e948){return new BPromise(function(_0x57ebe5,_0x5a8f31){var _0x4936fb=0x0;if(_0x38e948[_0x1b3d('0xd')]!==_0x1b3d('0xe')){_0x57ebe5(_0x38e948);}db[_0x1b3d('0xf')][_0x1b3d('0x10')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x38e948['id']}}})['then'](function(_0x39ff59){_0x4936fb=_0x39ff59;return util['getLicense']();})[_0x1b3d('0x11')](function(_0x1e57a2){if(_0x1e57a2&&_0x1e57a2['agents']&&_0x4936fb>=_0x1e57a2[_0x1b3d('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x57ebe5(_0x38e948);})[_0x1b3d('0x13')](function(_0x4e5061){_0x5a8f31(_0x4e5061);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index d662e1f..432c5c1 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8cd4=['render','json','send','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8cd4,0x113));var _0x48cd=function(_0x414648,_0x34a290){_0x414648=_0x414648-0x0;var _0x3fae7=_0x8cd4[_0x414648];return _0x3fae7;};'use strict';module['exports'][0x194]=function pageNotFound(_0x2a5b66,_0x394c48){var _0x4361e8='404';var _0x5e1974=0x194;var _0x25cb5a={'status':_0x5e1974};_0x394c48[_0x48cd('0x0')](_0x25cb5a[_0x48cd('0x0')]);_0x394c48[_0x48cd('0x1')](_0x4361e8,{},function(_0x30da9e,_0x219e57){if(_0x30da9e){return _0x394c48[_0x48cd('0x0')](_0x25cb5a[_0x48cd('0x0')])[_0x48cd('0x2')](_0x25cb5a);}_0x394c48[_0x48cd('0x3')](_0x219e57);});}; \ No newline at end of file +var _0xd8b8=['404','status','render','json','send','exports'];(function(_0x1516c7,_0x535126){var _0x5e3acb=function(_0x317f60){while(--_0x317f60){_0x1516c7['push'](_0x1516c7['shift']());}};_0x5e3acb(++_0x535126);}(_0xd8b8,0x1c7));var _0x8d8b=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd8b8[_0x27af45];return _0x18df21;};'use strict';module[_0x8d8b('0x0')][0x194]=function pageNotFound(_0x477df1,_0x4c73fc){var _0x4a773a=_0x8d8b('0x1');var _0xb8756d=0x194;var _0x18ca4a={'status':_0xb8756d};_0x4c73fc[_0x8d8b('0x2')](_0x18ca4a['status']);_0x4c73fc[_0x8d8b('0x3')](_0x4a773a,{},function(_0x6d603f,_0x38bd0a){if(_0x6d603f){return _0x4c73fc[_0x8d8b('0x2')](_0x18ca4a[_0x8d8b('0x2')])[_0x8d8b('0x4')](_0x18ca4a);}_0x4c73fc[_0x8d8b('0x5')](_0x38bd0a);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index ec7370a..0299e04 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['HopperHistories','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','UserVoiceQueue','BlackLists','mailbox','mailboxuser','QueueCalls','VoiceAgentReport','AgentReports','uniqueid','ContactId','MailAccountId','MailServerOut','Imap','Smtp','CannedAnswer','Answers','Messages','Interactions','TemplateId','mandatoryDispositionPauseId','user_has_mail_accounts','Agents','team_has_mail_queues','Teams','Account','Owner','mail_interaction_has_tags','Tags','Users','user_has_mail_interactions','MailInteractionId','Contact','ChatWebsite','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','List','ListId','DashboardItem','Items','Dispositions','FaxAccountId','FaxApplication','Applications','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','ThroughTags','Interaction','UserFaxQueue','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ProactiveActions','ChatApplication','user_has_chat_websites','OpenchannelQueueReport','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','AttachmentId','Attachments','team_has_chat_queues','ChatGroupId','Contacts','CompanyId','Hoppers','Company','cm_user_has_contacts','cm_contact_has_tags','Queue','CampaignId','Automation','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','ParentId','Intervals','Extensions','MailApplications','FaxApplications','Schedule','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','DefaultReportId','MetricId','AccountId','SubjectId','Descriptions','DescriptionId','Subject','Description','Field','FieldId','Variable','Configurations','Subjects','VariableId','DeskAccount','int_desk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','FreshsalesAccount','FromId','JscriptyQuestionReport','SessionId','ProjectId','team_has_openchannel_queues','team_has_whatsapp_queues','TeamVoicePrefix','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToChatWebsiteId','FromUserId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','userProfileId','UserProfileSections','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappQueue','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','defaultsDeep','motion2','xcall','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','xC@LL1234','127.0.0.1','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','VoiceQueueReport','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','MailTransferReport','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','VoicePrefix','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','UserId','VoiceRecording','hasMany','VoiceQueuesRt','HopperHistory','ReportAgentPreview','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','belongsTo','UserProfile','ChatGroup','belongsToMany','CmList','Lists','cm_user_has_lists','user_has_teams','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','HopperFinals'];(function(_0x89311d,_0x991439){var _0x53ee33=function(_0x10f6d0){while(--_0x10f6d0){_0x89311d['push'](_0x89311d['shift']());}};_0x53ee33(++_0x991439);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var config=require(_0x0d8b('0x0'));var Sequelize=require(_0x0d8b('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0d8b('0x1')]=_[_0x0d8b('0x2')](config[_0x0d8b('0x1')],{'database':_0x0d8b('0x3'),'username':_0x0d8b('0x4'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x0d8b('0x5'),'dialectOptions':{'charset':_0x0d8b('0x6')},'logging':![],'timezone':timezone[_0x0d8b('0x7')](),'define':{'charset':'utf8','collate':_0x0d8b('0x8')}}});config[_0x0d8b('0x9')]=_['defaultsDeep'](config[_0x0d8b('0x9')],{'database':_0x0d8b('0x3'),'username':_0x0d8b('0x4'),'password':_0x0d8b('0xa'),'options':{'host':_0x0d8b('0xb'),'port':0xcea,'dialect':_0x0d8b('0x5'),'dialectOptions':{'charset':_0x0d8b('0x6')},'logging':![],'timezone':timezone[_0x0d8b('0x7')](),'define':{'charset':'utf8','collate':_0x0d8b('0x8')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x0d8b('0xc')],config[_0x0d8b('0x1')][_0x0d8b('0xd')],config[_0x0d8b('0x1')][_0x0d8b('0xe')],config[_0x0d8b('0x1')][_0x0d8b('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x0d8b('0x9')][_0x0d8b('0xc')],config[_0x0d8b('0x9')][_0x0d8b('0xd')],config[_0x0d8b('0x9')][_0x0d8b('0xe')],config[_0x0d8b('0x9')]['options'])};db[_0x0d8b('0x10')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x12'));db[_0x0d8b('0x13')]=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0x14'));db[_0x0d8b('0x15')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x16'));db[_0x0d8b('0x17')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0x18'));db[_0x0d8b('0x19')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x1a'));db[_0x0d8b('0x1b')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db[_0x0d8b('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x1c'));db[_0x0d8b('0x1d')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x1e'));db[_0x0d8b('0x1f')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0x20'));db[_0x0d8b('0x21')]=db['sequelize'][_0x0d8b('0x11')]('../api/voiceCallReport/voiceCallReport.model');db[_0x0d8b('0x22')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x0d8b('0x23')]=db['sequelize'][_0x0d8b('0x11')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x0d8b('0x24')]=db['sequelize'][_0x0d8b('0x11')]('../api/memberReport/memberReport.model');db[_0x0d8b('0x25')]=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0x26'));db[_0x0d8b('0x27')]=db['sequelize']['import']('../api/voiceTransferReport/voiceTransferReport.model');db[_0x0d8b('0x28')]=db['sequelize'][_0x0d8b('0x11')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x29'));db[_0x0d8b('0x2a')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x2b'));db[_0x0d8b('0x2c')]=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0x2d'));db['UserFaxQueue']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x2e'));db['UserSmsQueue']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x2f'));db[_0x0d8b('0x30')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0x31'));db[_0x0d8b('0x32')]=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0x33'));db[_0x0d8b('0x34')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0d8b('0x1')]['import']('../api/mailServerOut/mailServerOut.model');db[_0x0d8b('0x35')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x36'));db[_0x0d8b('0x37')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0x38'));db[_0x0d8b('0x39')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x3a'));db[_0x0d8b('0x3b')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0x3c'));db[_0x0d8b('0x3d')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/mailMessage/mailMessage.model');db[_0x0d8b('0x3e')]=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0x3f'));db[_0x0d8b('0x40')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x41'));db[_0x0d8b('0x42')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x43'));db['DashboardItem']=db['sequelize']['import']('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x44'));db['FaxApplication']=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0x45'));db[_0x0d8b('0x46')]=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0x47'));db['FaxMessage']=db['sequelize'][_0x0d8b('0x11')]('../api/faxMessage/faxMessage.model');db[_0x0d8b('0x48')]=db['sequelize']['import'](_0x0d8b('0x49'));db[_0x0d8b('0x4a')]=db['sequelize']['import']('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x4b'));db['SmsApplication']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x4c'));db[_0x0d8b('0x4d')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x4e'));db[_0x0d8b('0x4f')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x50'));db[_0x0d8b('0x51')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x52'));db[_0x0d8b('0x53')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x54'));db['OpenchannelApplication']=db[_0x0d8b('0x1')]['import']('../api/openchannelApplication/openchannelApplication.model');db[_0x0d8b('0x55')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x56'));db['OpenchannelMessage']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x57'));db[_0x0d8b('0x58')]=db[_0x0d8b('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0x59'));db['OpenchannelQueueReport']=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0x5a'));db['ChatApplication']=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0x5b'));db[_0x0d8b('0x5c')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/chatInteraction/chatInteraction.model');db[_0x0d8b('0x5d')]=db[_0x0d8b('0x1')]['import']('../api/chatMessage/chatMessage.model');db[_0x0d8b('0x5e')]=db[_0x0d8b('0x1')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0d8b('0x5f')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x60'));db['ChatGroup']=db[_0x0d8b('0x1')]['import']('../api/chatGroup/chatGroup.model');db[_0x0d8b('0x61')]=db[_0x0d8b('0x1')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0x0d8b('0x62')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x63'));db[_0x0d8b('0x64')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x65'));db['CmHopper']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x66'));db[_0x0d8b('0x67')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x68'));db[_0x0d8b('0x69')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0x6a'));db[_0x0d8b('0x6b')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x6c'));db['ReportAgentPreview']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x6d'));db[_0x0d8b('0x6e')]=db[_0x0d8b('0x1')]['import']('../api/cmCustomField/cmCustomField.model');db[_0x0d8b('0x6f')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x70'));db['Automation']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x71'));db['CannedAnswer']=db[_0x0d8b('0x1')]['import'](_0x0d8b('0x72'));db[_0x0d8b('0x73')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x74'));db[_0x0d8b('0x75')]=db['sequelize'][_0x0d8b('0x11')]('../api/condition/condition.model');db[_0x0d8b('0x76')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x77'));db['Pause']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x78'));db[_0x0d8b('0x79')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x7a'));db[_0x0d8b('0x7b')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/schedule/schedule.model');db[_0x0d8b('0x7c')]=db['sequelize']['import'](_0x0d8b('0x7d'));db[_0x0d8b('0x7e')]=db['sequelize']['import'](_0x0d8b('0x7f'));db[_0x0d8b('0x80')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x81'));db[_0x0d8b('0x82')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0x83'));db['Variable']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x84'));db[_0x0d8b('0x85')]=db['sequelize'][_0x0d8b('0x11')]('../api/integration/integration.model');db[_0x0d8b('0x86')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x87'));db[_0x0d8b('0x88')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x89'));db[_0x0d8b('0x8a')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0x8b'));db['AnalyticExtractedReport']=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x0d8b('0x8c')]=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0x8d'));db[_0x0d8b('0x8e')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x8f'));db[_0x0d8b('0x90')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0x91'));db[_0x0d8b('0x92')]=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0x93'));db[_0x0d8b('0x94')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x95'));db[_0x0d8b('0x96')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x97'));db[_0x0d8b('0x98')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0x99'));db[_0x0d8b('0x9a')]=db[_0x0d8b('0x1')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x0d8b('0x9b')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x9c'));db[_0x0d8b('0x9d')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0x9e'));db[_0x0d8b('0x9f')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xa0'));db[_0x0d8b('0xa1')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0xa2'));db[_0x0d8b('0xa3')]=db['sequelize']['import'](_0x0d8b('0xa4'));db[_0x0d8b('0xa5')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xa6'));db[_0x0d8b('0xa7')]=db['sequelize']['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0x0d8b('0xa8')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xa9'));db[_0x0d8b('0xaa')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0xab'));db[_0x0d8b('0xac')]=db['sequelize'][_0x0d8b('0x11')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x0d8b('0xad')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xae'));db[_0x0d8b('0xaf')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xb0'));db[_0x0d8b('0xb1')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xb2'));db['VtigerConfiguration']=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0xb3'));db[_0x0d8b('0xb4')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xb5'));db[_0x0d8b('0xb6')]=db['sequelize'][_0x0d8b('0x11')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x0d8b('0xb7')]=db['sequelize']['import'](_0x0d8b('0xb8'));db[_0x0d8b('0xb9')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xba'));db[_0x0d8b('0xbb')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xbc'));db[_0x0d8b('0xbd')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x0d8b('0xbe')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xbf'));db[_0x0d8b('0xc0')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x0d8b('0xc1')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xc2'));db[_0x0d8b('0x85')]=db['sequelize']['import'](_0x0d8b('0xc3'));db[_0x0d8b('0xc4')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0xc5'));db[_0x0d8b('0xc6')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0xc7'));db[_0x0d8b('0xc8')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xc9'));db[_0x0d8b('0xca')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xcb'));db['JscriptyQuestionReport']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xcc'));db[_0x0d8b('0xcd')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xce'));db[_0x0d8b('0xcf')]=db[_0x0d8b('0x1')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0x0d8b('0xd0')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xd1'));db['SquareDetailsReport']=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/squareReportDetail/squareReportDetail.model');db[_0x0d8b('0xd2')]=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0xd3'));db[_0x0d8b('0xd4')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xd5'));db[_0x0d8b('0xd6')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0xd7'));db['SquareProject']=db['sequelize'][_0x0d8b('0x11')]('../api/squareProject/squareProject.model');db[_0x0d8b('0xd8')]=db[_0x0d8b('0x1')]['import'](_0x0d8b('0xd9'));db['SquareMessage']=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0xda'));db[_0x0d8b('0xdb')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/team/team.model');db['License']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xdc'));db[_0x0d8b('0xdd')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xde'));db[_0x0d8b('0xdf')]=db['sequelize']['import'](_0x0d8b('0xe0'));db[_0x0d8b('0xe1')]=db['sequelize']['import']('../api/attachment/attachment.model');db[_0x0d8b('0xe2')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/plugin/plugin.model');db[_0x0d8b('0xe3')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0d8b('0xe4')]=db['sequelize'][_0x0d8b('0x11')]('../api/chatTransferReport/chatTransferReport.model');db[_0x0d8b('0xe5')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xe6'));db[_0x0d8b('0xe7')]=db['sequelize'][_0x0d8b('0x11')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x0d8b('0xe8')]=db['sequelize'][_0x0d8b('0x11')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/cmList/cmList.model');db[_0x0d8b('0xe9')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0xea'));db[_0x0d8b('0xeb')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xec'));db[_0x0d8b('0xed')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xee'));db['UserNotification']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xef'));db['WhatsappAccount']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xf0'));db[_0x0d8b('0xf1')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xf2'));db[_0x0d8b('0xf3')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xf4'));db[_0x0d8b('0xf5')]=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0xf6'));db[_0x0d8b('0xf7')]=db[_0x0d8b('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x0d8b('0xf8')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db['sequelize'][_0x0d8b('0x11')]('../api/whatsappQueue/whatsappQueue.model');db[_0x0d8b('0xf9')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xfa'));db[_0x0d8b('0xfb')]=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xfc'));db['TeamVoicePrefix']=db[_0x0d8b('0x1')][_0x0d8b('0x11')](_0x0d8b('0xfd'));db[_0x0d8b('0xfe')]=db['sequelize'][_0x0d8b('0x11')](_0x0d8b('0xff'));db[_0x0d8b('0x10')][_0x0d8b('0x100')](db['VoiceMail'],{'as':_0x0d8b('0x1d'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x102')});db[_0x0d8b('0x10')]['hasMany'](db[_0x0d8b('0x103')],{'as':'Recordings','foreignKey':_0x0d8b('0x102')});db['User'][_0x0d8b('0x104')](db['UserVoiceQueueRt'],{'as':_0x0d8b('0x105'),'foreignKey':'UserId'});db[_0x0d8b('0x10')]['hasMany'](db[_0x0d8b('0x17')],{'as':'Extensions','onDelete':_0x0d8b('0x101'),'hooks':!![]});db['User'][_0x0d8b('0x104')](db[_0x0d8b('0x69')],{'as':'HopperFinals','foreignKey':'UserId'});db['User'][_0x0d8b('0x104')](db['CmHopperHistory'],{'as':_0x0d8b('0x106'),'foreignKey':'UserId'});db[_0x0d8b('0x10')][_0x0d8b('0x104')](db[_0x0d8b('0x107')],{'as':_0x0d8b('0x107'),'foreignKey':_0x0d8b('0x102')});db[_0x0d8b('0x10')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x0d8b('0x108'),'foreignKey':'UserId'});db[_0x0d8b('0x10')][_0x0d8b('0x104')](db[_0x0d8b('0x5c')],{'as':'ChatInteractions','foreignKey':_0x0d8b('0x102')});db['User'][_0x0d8b('0x104')](db[_0x0d8b('0x4d')],{'as':_0x0d8b('0x109'),'foreignKey':_0x0d8b('0x102')});db['User'][_0x0d8b('0x104')](db[_0x0d8b('0x46')],{'as':_0x0d8b('0x10a'),'foreignKey':'UserId'});db[_0x0d8b('0x10')]['hasMany'](db[_0x0d8b('0x3b')],{'as':_0x0d8b('0x10b'),'foreignKey':_0x0d8b('0x102')});db[_0x0d8b('0x10')][_0x0d8b('0x104')](db[_0x0d8b('0xf3')],{'as':_0x0d8b('0x10c'),'foreignKey':_0x0d8b('0x102')});db[_0x0d8b('0x10')][_0x0d8b('0x104')](db[_0x0d8b('0x10d')],{'as':_0x0d8b('0x10e'),'foreignKey':'SenderId'});db[_0x0d8b('0x10')][_0x0d8b('0x10f')](db['UserProfile'],{'as':_0x0d8b('0x110'),'foreignKey':'userProfileId'});db[_0x0d8b('0x10')]['belongsToMany'](db[_0x0d8b('0x111')],{'as':'Groups','through':'chat_group_has_users'});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db['CmContact'],{'as':'Contacts','through':'cm_user_has_contacts'});db['User'][_0x0d8b('0x112')](db[_0x0d8b('0x113')],{'as':_0x0d8b('0x114'),'through':_0x0d8b('0x115')});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db[_0x0d8b('0xdb')],{'through':_0x0d8b('0x116')});db['User'][_0x0d8b('0x112')](db['MailInteraction'],{'as':_0x0d8b('0x10b'),'through':'user_has_mail_interactions'});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db[_0x0d8b('0x5c')],{'as':_0x0d8b('0x117'),'through':_0x0d8b('0x118')});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db[_0x0d8b('0x46')],{'as':_0x0d8b('0x10a'),'through':_0x0d8b('0x119')});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db[_0x0d8b('0x4d')],{'as':'SmsInteractions','through':_0x0d8b('0x11a')});db['User'][_0x0d8b('0x112')](db[_0x0d8b('0x55')],{'as':'OpenchannelInteractions','through':_0x0d8b('0x11b')});db['User'][_0x0d8b('0x112')](db['WhatsappInteraction'],{'as':_0x0d8b('0x10c'),'through':_0x0d8b('0x11c')});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db[_0x0d8b('0x1b')],{'as':_0x0d8b('0x11d'),'through':'UserVoiceQueue','required':![]});db[_0x0d8b('0x10')]['belongsToMany'](db[_0x0d8b('0xe9')],{'as':_0x0d8b('0x11e'),'through':_0x0d8b('0xfe'),'required':![]});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db['MailQueue'],{'as':_0x0d8b('0x11f'),'through':_0x0d8b('0x2c'),'required':![]});db['User'][_0x0d8b('0x112')](db[_0x0d8b('0x5f')],{'as':_0x0d8b('0x120'),'through':_0x0d8b('0x2a'),'required':![],'hooks':!![]});db['User'][_0x0d8b('0x112')](db['FaxQueue'],{'as':_0x0d8b('0x121'),'through':'UserFaxQueue','required':![]});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db['SmsQueue'],{'as':_0x0d8b('0x122'),'through':_0x0d8b('0x123'),'required':![]});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db['OpenchannelQueue'],{'as':_0x0d8b('0x124'),'through':'UserOpenchannelQueue','required':![]});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db['WhatsappQueue'],{'as':_0x0d8b('0x125'),'through':_0x0d8b('0x32'),'required':![]});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db[_0x0d8b('0x113')],{'through':_0x0d8b('0x115')});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db['ChatWebsite'],{'as':_0x0d8b('0x126'),'through':'user_has_chat_websites'});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db[_0x0d8b('0x127')],{'as':_0x0d8b('0x128'),'through':_0x0d8b('0x129')});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db[_0x0d8b('0x35')],{'as':_0x0d8b('0x12a'),'through':'user_has_mail_accounts'});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db['OpenchannelAccount'],{'as':_0x0d8b('0x12b'),'through':_0x0d8b('0x12c')});db['User'][_0x0d8b('0x112')](db[_0x0d8b('0x12d')],{'as':_0x0d8b('0x12e'),'through':_0x0d8b('0x12f')});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db[_0x0d8b('0x130')],{'as':_0x0d8b('0x131'),'through':'user_has_whatsapp_accounts'});db[_0x0d8b('0x10')][_0x0d8b('0x112')](db[_0x0d8b('0x132')],{'as':_0x0d8b('0x133'),'through':_0x0d8b('0x134')});db[_0x0d8b('0x13')][_0x0d8b('0x104')](db[_0x0d8b('0x17')],{'as':_0x0d8b('0x135'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x136')});db['VoiceContext']['hasMany'](db['VoiceExtension'],{'onDelete':'cascade'});db['VoiceExtension']['hasMany'](db[_0x0d8b('0x17')],{'as':'Applications','onDelete':_0x0d8b('0x101')});db[_0x0d8b('0x19')][_0x0d8b('0x112')](db[_0x0d8b('0x7c')],{'as':_0x0d8b('0x137'),'through':_0x0d8b('0x138')});db[_0x0d8b('0x1b')][_0x0d8b('0x104')](db[_0x0d8b('0x28')],{'as':_0x0d8b('0x139'),'foreignKey':_0x0d8b('0x13a')});db[_0x0d8b('0x1b')]['hasMany'](db[_0x0d8b('0x13b')],{'as':'Hoppers','foreignKey':_0x0d8b('0x13a')});db['VoiceQueue'][_0x0d8b('0x104')](db[_0x0d8b('0x69')],{'as':_0x0d8b('0x13c'),'foreignKey':_0x0d8b('0x13a')});db[_0x0d8b('0x1b')]['hasMany'](db[_0x0d8b('0x6b')],{'as':_0x0d8b('0x13d'),'foreignKey':'VoiceQueueId'});db[_0x0d8b('0x1b')]['hasMany'](db['ReportAgentPreview'],{'as':_0x0d8b('0x107'),'foreignKey':_0x0d8b('0x13a')});db[_0x0d8b('0x1b')][_0x0d8b('0x104')](db[_0x0d8b('0x67')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0d8b('0x104')](db[_0x0d8b('0xcd')],{'as':_0x0d8b('0x13e'),'foreignKey':_0x0d8b('0x13a')});db[_0x0d8b('0x1b')][_0x0d8b('0x10f')](db['Trunk'],{'as':_0x0d8b('0x25'),'foreignKey':_0x0d8b('0x13f')});db['VoiceQueue'][_0x0d8b('0x10f')](db[_0x0d8b('0x25')],{'as':_0x0d8b('0x140'),'foreignKey':_0x0d8b('0x141')});db[_0x0d8b('0x1b')]['belongsTo'](db['Interval'],{'as':_0x0d8b('0x76'),'foreignKey':_0x0d8b('0x142')});db['VoiceQueue'][_0x0d8b('0x10f')](db[_0x0d8b('0x143')],{'as':_0x0d8b('0x144'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0x0d8b('0x112')](db[_0x0d8b('0x113')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x0d8b('0x1b')]['belongsToMany'](db[_0x0d8b('0x10')],{'as':'Agents','through':_0x0d8b('0x145')});db[_0x0d8b('0x1b')]['belongsToMany'](db[_0x0d8b('0xdb')],{'as':'Teams','through':_0x0d8b('0xfb')});db[_0x0d8b('0x1b')][_0x0d8b('0x112')](db[_0x0d8b('0x113')],{'as':_0x0d8b('0x146'),'through':'voice_queues_has_cm_blacklists'});db[_0x0d8b('0x103')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'as':'User','foreignKey':_0x0d8b('0x102')});db['ScreenRecording'][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'as':'User','foreignKey':'UserId'});db['VoiceMail'][_0x0d8b('0x104')](db[_0x0d8b('0x1f')],{'as':'Messages','onDelete':_0x0d8b('0x101'),'foreignKey':'mailboxuser','sourceKey':_0x0d8b('0x147')});db[_0x0d8b('0x1f')][_0x0d8b('0x10f')](db[_0x0d8b('0x1d')],{'foreignKey':_0x0d8b('0x148'),'targetKey':_0x0d8b('0x147')});db[_0x0d8b('0x21')][_0x0d8b('0x104')](db['VoiceQueueReport'],{'as':_0x0d8b('0x149'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x0d8b('0x104')](db[_0x0d8b('0x14a')],{'as':_0x0d8b('0x14b'),'foreignKey':_0x0d8b('0x14c'),'constraints':![]});db[_0x0d8b('0x21')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'as':'User','foreignKey':_0x0d8b('0x102')});db['VoiceCallReport']['belongsTo'](db[_0x0d8b('0x64')],{'as':'Contact','foreignKey':_0x0d8b('0x14d')});db['MailServerIn']['belongsTo'](db[_0x0d8b('0x35')],{'as':_0x0d8b('0x35'),'foreignKey':_0x0d8b('0x14e')});db[_0x0d8b('0x14f')][_0x0d8b('0x10f')](db[_0x0d8b('0x35')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x0d8b('0x35')][_0x0d8b('0x100')](db[_0x0d8b('0x34')],{'as':_0x0d8b('0x150'),'onDelete':_0x0d8b('0x101')});db[_0x0d8b('0x35')][_0x0d8b('0x100')](db[_0x0d8b('0x14f')],{'as':_0x0d8b('0x151'),'onDelete':_0x0d8b('0x101')});db[_0x0d8b('0x35')][_0x0d8b('0x104')](db[_0x0d8b('0x73')],{'as':'Dispositions','foreignKey':'MailAccountId','onDelete':'cascade'});db[_0x0d8b('0x35')][_0x0d8b('0x104')](db[_0x0d8b('0x152')],{'as':_0x0d8b('0x153'),'foreignKey':_0x0d8b('0x14e')});db[_0x0d8b('0x35')][_0x0d8b('0x104')](db[_0x0d8b('0x3d')],{'as':_0x0d8b('0x154'),'foreignKey':_0x0d8b('0x14e')});db[_0x0d8b('0x35')][_0x0d8b('0x104')](db[_0x0d8b('0x3b')],{'as':_0x0d8b('0x155')});db[_0x0d8b('0x35')][_0x0d8b('0x104')](db[_0x0d8b('0x3e')],{'as':'Applications'});db['MailAccount'][_0x0d8b('0x10f')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0d8b('0x35')][_0x0d8b('0x10f')](db[_0x0d8b('0x80')],{'as':_0x0d8b('0x80'),'foreignKey':_0x0d8b('0x156')});db['MailAccount'][_0x0d8b('0x10f')](db[_0x0d8b('0x143')],{'as':_0x0d8b('0x144'),'foreignKey':_0x0d8b('0x157')});db['MailAccount']['belongsToMany'](db[_0x0d8b('0x10')],{'as':'Agents','through':_0x0d8b('0x158')});db[_0x0d8b('0x37')][_0x0d8b('0x112')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x159'),'through':_0x0d8b('0x2c')});db['MailQueue'][_0x0d8b('0x112')](db['Team'],{'through':_0x0d8b('0x15a'),'as':_0x0d8b('0x15b')});db[_0x0d8b('0x3b')][_0x0d8b('0x104')](db['MailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x0d8b('0x3b')][_0x0d8b('0x10f')](db[_0x0d8b('0x35')],{'as':_0x0d8b('0x15c'),'foreignKey':_0x0d8b('0x14e')});db[_0x0d8b('0x3b')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x0d8b('0x3b')][_0x0d8b('0x10f')](db['User'],{'as':_0x0d8b('0x15d'),'foreignKey':_0x0d8b('0x102')});db[_0x0d8b('0x3b')][_0x0d8b('0x112')](db[_0x0d8b('0x7e')],{'through':_0x0d8b('0x15e'),'as':_0x0d8b('0x15f')});db['MailInteraction'][_0x0d8b('0x112')](db[_0x0d8b('0x7e')],{'through':_0x0d8b('0x15e'),'as':'ThroughTags'});db[_0x0d8b('0x3b')][_0x0d8b('0x112')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x160'),'through':_0x0d8b('0x161'),'foreignKey':_0x0d8b('0x162')});db[_0x0d8b('0x3d')][_0x0d8b('0x104')](db[_0x0d8b('0xe1')],{'as':'Attachments','onDelete':'cascade'});db['MailMessage'][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x10')});db[_0x0d8b('0x3d')][_0x0d8b('0x10f')](db[_0x0d8b('0x64')],{'onDelete':_0x0d8b('0x101'),'as':_0x0d8b('0x163')});db[_0x0d8b('0x3d')][_0x0d8b('0x10f')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x0d8b('0x162')});db[_0x0d8b('0x3d')][_0x0d8b('0x10f')](db[_0x0d8b('0x35')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x0d8b('0x3d')][_0x0d8b('0x10f')](db[_0x0d8b('0x164')],{'as':_0x0d8b('0x164'),'foreignKey':_0x0d8b('0x165')});db['MailMessage']['belongsTo'](db[_0x0d8b('0x5e')],{'as':_0x0d8b('0x5e'),'foreignKey':_0x0d8b('0x166')});db[_0x0d8b('0x3e')]['belongsTo'](db[_0x0d8b('0x10')],{'onDelete':_0x0d8b('0x167')});db[_0x0d8b('0x3e')][_0x0d8b('0x10f')](db[_0x0d8b('0x37')],{'onDelete':_0x0d8b('0x167')});db['MailApplication'][_0x0d8b('0x10f')](db[_0x0d8b('0x35')],{'onDelete':_0x0d8b('0x167')});db['MailApplication'][_0x0d8b('0x10f')](db[_0x0d8b('0x76')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x0d8b('0x3e')][_0x0d8b('0x10f')](db[_0x0d8b('0x7e')],{'onDelete':_0x0d8b('0x167'),'foreignKey':_0x0d8b('0x168')});db['MailQueueReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x35')],{});db['MailQueueReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x113')],{'as':_0x0d8b('0x169'),'foreignKey':_0x0d8b('0x16a')});db[_0x0d8b('0x40')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x0d8b('0x14d')});db['MailQueueReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x3b')],{});db['MailQueueReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x3d')],{});db[_0x0d8b('0x40')]['belongsTo'](db['User'],{});db[_0x0d8b('0x40')]['belongsTo'](db['MailQueue'],{});db[_0x0d8b('0x42')][_0x0d8b('0x104')](db[_0x0d8b('0x16b')],{'as':_0x0d8b('0x16c'),'onDelete':_0x0d8b('0x101')});db[_0x0d8b('0x127')][_0x0d8b('0x104')](db['Disposition'],{'as':_0x0d8b('0x16d'),'foreignKey':'FaxAccountId','onDelete':_0x0d8b('0x101')});db['FaxAccount'][_0x0d8b('0x104')](db[_0x0d8b('0x152')],{'as':_0x0d8b('0x153'),'foreignKey':_0x0d8b('0x16e')});db[_0x0d8b('0x127')][_0x0d8b('0x104')](db[_0x0d8b('0x46')],{'as':'Interactions'});db[_0x0d8b('0x127')][_0x0d8b('0x104')](db[_0x0d8b('0x16f')],{'as':_0x0d8b('0x170')});db[_0x0d8b('0x127')][_0x0d8b('0x104')](db[_0x0d8b('0x17')],{'as':_0x0d8b('0x171'),'onDelete':'cascade'});db['FaxAccount'][_0x0d8b('0x104')](db[_0x0d8b('0x172')],{'as':_0x0d8b('0x154')});db['FaxAccount']['belongsTo'](db[_0x0d8b('0x25')],{'as':_0x0d8b('0x25')});db[_0x0d8b('0x127')][_0x0d8b('0x10f')](db['CmList'],{'as':_0x0d8b('0x169'),'foreignKey':_0x0d8b('0x16a')});db[_0x0d8b('0x127')][_0x0d8b('0x10f')](db[_0x0d8b('0x143')],{'as':_0x0d8b('0x144'),'foreignKey':_0x0d8b('0x157')});db['FaxAccount'][_0x0d8b('0x112')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x159'),'through':_0x0d8b('0x129')});db[_0x0d8b('0x16f')][_0x0d8b('0x10f')](db['User'],{'onDelete':_0x0d8b('0x167')});db[_0x0d8b('0x16f')][_0x0d8b('0x10f')](db['FaxQueue'],{'onDelete':_0x0d8b('0x167')});db['FaxApplication'][_0x0d8b('0x10f')](db[_0x0d8b('0x127')],{'onDelete':_0x0d8b('0x167')});db[_0x0d8b('0x16f')][_0x0d8b('0x10f')](db['Tag'],{'onDelete':_0x0d8b('0x167'),'foreignKey':'TagId'});db[_0x0d8b('0x46')]['hasMany'](db['FaxMessage'],{'as':_0x0d8b('0x154'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x173')});db['FaxInteraction'][_0x0d8b('0x10f')](db[_0x0d8b('0x127')],{'as':_0x0d8b('0x15c'),'foreignKey':_0x0d8b('0x16e')});db['FaxInteraction']['belongsTo'](db[_0x0d8b('0x64')],{'as':_0x0d8b('0x163'),'foreignKey':_0x0d8b('0x14d')});db['FaxInteraction'][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'as':'Owner','foreignKey':_0x0d8b('0x102')});db[_0x0d8b('0x46')]['belongsToMany'](db['Tag'],{'through':_0x0d8b('0x174'),'as':_0x0d8b('0x15f')});db['FaxInteraction'][_0x0d8b('0x112')](db['Tag'],{'through':_0x0d8b('0x174'),'as':_0x0d8b('0x175')});db['FaxInteraction'][_0x0d8b('0x112')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x160'),'through':_0x0d8b('0x119'),'foreignKey':_0x0d8b('0x173')});db[_0x0d8b('0x172')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'onDelete':_0x0d8b('0x101'),'as':_0x0d8b('0x10')});db[_0x0d8b('0x172')][_0x0d8b('0x10f')](db[_0x0d8b('0x46')],{'as':_0x0d8b('0x176'),'foreignKey':'FaxInteractionId'});db[_0x0d8b('0x172')][_0x0d8b('0x10f')](db[_0x0d8b('0x64')],{'onDelete':_0x0d8b('0x101'),'as':_0x0d8b('0x163')});db['FaxMessage']['belongsTo'](db['Attachment'],{'as':_0x0d8b('0xe1'),'foreignKey':'AttachmentId'});db['FaxMessage']['belongsTo'](db['FaxAccount'],{'as':_0x0d8b('0x15c'),'foreignKey':_0x0d8b('0x16e')});db['FaxQueue'][_0x0d8b('0x112')](db[_0x0d8b('0x10')],{'as':'Agents','through':_0x0d8b('0x177')});db['FaxQueue'][_0x0d8b('0x112')](db[_0x0d8b('0xdb')],{'through':_0x0d8b('0x178'),'as':'Teams'});db[_0x0d8b('0x4a')][_0x0d8b('0x10f')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x113')],{'as':'List','foreignKey':_0x0d8b('0x16a')});db[_0x0d8b('0x4a')][_0x0d8b('0x10f')](db['CmContact'],{'as':_0x0d8b('0x163'),'foreignKey':_0x0d8b('0x14d')});db[_0x0d8b('0x4a')]['belongsTo'](db[_0x0d8b('0x46')],{});db[_0x0d8b('0x4a')][_0x0d8b('0x10f')](db[_0x0d8b('0x172')],{});db['FaxQueueReport'][_0x0d8b('0x10f')](db['User'],{});db['FaxQueueReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x48')],{});db[_0x0d8b('0x12d')]['hasMany'](db[_0x0d8b('0x73')],{'as':_0x0d8b('0x16d'),'foreignKey':'SmsAccountId','onDelete':_0x0d8b('0x101')});db['SmsAccount'][_0x0d8b('0x104')](db[_0x0d8b('0x152')],{'as':'Answers','foreignKey':_0x0d8b('0x179')});db[_0x0d8b('0x12d')][_0x0d8b('0x104')](db[_0x0d8b('0x4f')],{'as':_0x0d8b('0x154'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db[_0x0d8b('0x4d')],{'as':_0x0d8b('0x155')});db[_0x0d8b('0x12d')][_0x0d8b('0x104')](db[_0x0d8b('0x17a')],{'as':_0x0d8b('0x170')});db[_0x0d8b('0x12d')][_0x0d8b('0x10f')](db[_0x0d8b('0x113')],{'as':_0x0d8b('0x169'),'foreignKey':_0x0d8b('0x16a')});db[_0x0d8b('0x12d')]['belongsTo'](db[_0x0d8b('0x143')],{'as':'mandatoryDispositionPause','foreignKey':_0x0d8b('0x157')});db[_0x0d8b('0x12d')][_0x0d8b('0x112')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x159'),'through':_0x0d8b('0x12f')});db['SmsApplication'][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'onDelete':'restrict'});db[_0x0d8b('0x17a')][_0x0d8b('0x10f')](db[_0x0d8b('0x51')],{'onDelete':_0x0d8b('0x167')});db[_0x0d8b('0x17a')][_0x0d8b('0x10f')](db[_0x0d8b('0x12d')],{'onDelete':_0x0d8b('0x167')});db['SmsApplication'][_0x0d8b('0x10f')](db[_0x0d8b('0x76')],{'onDelete':_0x0d8b('0x167'),'foreignKey':_0x0d8b('0x142')});db[_0x0d8b('0x17a')]['belongsTo'](db['Tag'],{'onDelete':_0x0d8b('0x167'),'foreignKey':_0x0d8b('0x168')});db[_0x0d8b('0x4d')][_0x0d8b('0x104')](db[_0x0d8b('0x4f')],{'as':'Messages','onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x17b')});db['SmsInteraction'][_0x0d8b('0x10f')](db['SmsAccount'],{'as':_0x0d8b('0x15c'),'foreignKey':'SmsAccountId'});db[_0x0d8b('0x4d')]['belongsTo'](db['CmContact'],{'as':_0x0d8b('0x163'),'foreignKey':_0x0d8b('0x14d')});db[_0x0d8b('0x4d')]['belongsTo'](db['User'],{'as':_0x0d8b('0x15d'),'foreignKey':_0x0d8b('0x102')});db[_0x0d8b('0x4d')][_0x0d8b('0x112')](db[_0x0d8b('0x7e')],{'through':_0x0d8b('0x17c'),'as':'Tags'});db[_0x0d8b('0x4d')]['belongsToMany'](db[_0x0d8b('0x7e')],{'through':'sms_interaction_has_tags','as':_0x0d8b('0x175')});db['SmsInteraction'][_0x0d8b('0x112')](db[_0x0d8b('0x10')],{'as':'Users','through':_0x0d8b('0x11a'),'foreignKey':_0x0d8b('0x17b')});db[_0x0d8b('0x4f')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x10')});db['SmsMessage']['belongsTo'](db[_0x0d8b('0x64')],{'onDelete':_0x0d8b('0x101'),'as':_0x0d8b('0x163')});db[_0x0d8b('0x4f')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0x0d8b('0x101'),'as':_0x0d8b('0x176'),'foreignKey':'SmsInteractionId'});db[_0x0d8b('0x4f')][_0x0d8b('0x10f')](db[_0x0d8b('0x12d')],{'as':_0x0d8b('0x15c'),'foreignKey':_0x0d8b('0x179')});db[_0x0d8b('0x51')][_0x0d8b('0x112')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x159'),'through':_0x0d8b('0x123'),'foreignKey':_0x0d8b('0x17d')});db['SmsQueue'][_0x0d8b('0x112')](db['Team'],{'through':_0x0d8b('0x17e'),'as':'Teams'});db[_0x0d8b('0x53')][_0x0d8b('0x104')](db['Disposition'],{'as':_0x0d8b('0x16d'),'foreignKey':_0x0d8b('0x17f'),'onDelete':'cascade'});db[_0x0d8b('0x53')]['hasMany'](db[_0x0d8b('0x152')],{'as':_0x0d8b('0x153'),'foreignKey':_0x0d8b('0x17f')});db['OpenchannelAccount'][_0x0d8b('0x104')](db[_0x0d8b('0x55')],{'as':_0x0d8b('0x155'),'foreignKey':_0x0d8b('0x17f')});db[_0x0d8b('0x53')][_0x0d8b('0x104')](db[_0x0d8b('0x180')],{'as':_0x0d8b('0x154'),'foreignKey':_0x0d8b('0x17f')});db['OpenchannelAccount'][_0x0d8b('0x104')](db[_0x0d8b('0x181')],{'as':_0x0d8b('0x170'),'foreignKey':'OpenchannelAccountId'});db[_0x0d8b('0x53')][_0x0d8b('0x10f')](db['CmList'],{'as':_0x0d8b('0x169'),'foreignKey':'ListId'});db[_0x0d8b('0x53')][_0x0d8b('0x10f')](db[_0x0d8b('0x143')],{'as':'mandatoryDispositionPause','foreignKey':_0x0d8b('0x157')});db[_0x0d8b('0x53')]['belongsToMany'](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x159'),'through':_0x0d8b('0x12c')});db[_0x0d8b('0x181')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'onDelete':_0x0d8b('0x167')});db['OpenchannelApplication'][_0x0d8b('0x10f')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0d8b('0x182')});db['OpenchannelApplication'][_0x0d8b('0x10f')](db[_0x0d8b('0x53')],{'onDelete':'restrict','foreignKey':_0x0d8b('0x17f')});db[_0x0d8b('0x181')][_0x0d8b('0x10f')](db['Interval'],{'onDelete':_0x0d8b('0x167'),'foreignKey':_0x0d8b('0x142')});db['OpenchannelApplication'][_0x0d8b('0x10f')](db['Tag'],{'onDelete':_0x0d8b('0x167'),'foreignKey':_0x0d8b('0x168')});db[_0x0d8b('0x55')][_0x0d8b('0x104')](db['OpenchannelMessage'],{'as':_0x0d8b('0x154'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x183')});db['OpenchannelInteraction']['belongsTo'](db[_0x0d8b('0x53')],{'as':_0x0d8b('0x15c'),'foreignKey':_0x0d8b('0x17f')});db['OpenchannelInteraction'][_0x0d8b('0x10f')](db['CmContact'],{'as':'Contact','foreignKey':_0x0d8b('0x14d')});db[_0x0d8b('0x55')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x15d'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0x0d8b('0x112')](db[_0x0d8b('0x7e')],{'through':_0x0d8b('0x184'),'as':'Tags'});db[_0x0d8b('0x55')][_0x0d8b('0x112')](db[_0x0d8b('0x7e')],{'through':_0x0d8b('0x184'),'as':_0x0d8b('0x175')});db['OpenchannelInteraction'][_0x0d8b('0x112')](db['User'],{'as':_0x0d8b('0x160'),'through':_0x0d8b('0x11b'),'foreignKey':_0x0d8b('0x183')});db[_0x0d8b('0x180')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'onDelete':_0x0d8b('0x101'),'as':'User'});db[_0x0d8b('0x180')][_0x0d8b('0x10f')](db[_0x0d8b('0x64')],{'onDelete':_0x0d8b('0x101'),'as':'Contact'});db[_0x0d8b('0x180')][_0x0d8b('0x10f')](db['OpenchannelInteraction'],{'onDelete':_0x0d8b('0x101'),'as':_0x0d8b('0x176'),'foreignKey':_0x0d8b('0x183')});db[_0x0d8b('0x180')][_0x0d8b('0x10f')](db['Attachment'],{'as':_0x0d8b('0xe1'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x0d8b('0x10f')](db[_0x0d8b('0x53')],{'as':_0x0d8b('0x15c'),'foreignKey':_0x0d8b('0x17f')});db[_0x0d8b('0x58')][_0x0d8b('0x112')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x159'),'through':'UserOpenchannelQueue','foreignKey':_0x0d8b('0x182')});db[_0x0d8b('0x58')]['belongsToMany'](db[_0x0d8b('0xdb')],{'through':'team_has_openchannel_queues','as':_0x0d8b('0x15b')});db[_0x0d8b('0x164')]['hasMany'](db['Disposition'],{'as':_0x0d8b('0x16d'),'foreignKey':_0x0d8b('0x165'),'onDelete':_0x0d8b('0x101')});db['ChatWebsite'][_0x0d8b('0x104')](db[_0x0d8b('0x152')],{'as':_0x0d8b('0x153'),'foreignKey':_0x0d8b('0x165')});db[_0x0d8b('0x164')]['hasMany'](db[_0x0d8b('0x61')],{'as':_0x0d8b('0x185')});db[_0x0d8b('0x164')][_0x0d8b('0x104')](db[_0x0d8b('0x5c')],{'as':_0x0d8b('0x155')});db[_0x0d8b('0x164')]['hasMany'](db[_0x0d8b('0x186')],{'as':_0x0d8b('0x170')});db[_0x0d8b('0x164')][_0x0d8b('0x104')](db['ChatMessage'],{'as':_0x0d8b('0x154')});db[_0x0d8b('0x164')][_0x0d8b('0x10f')](db[_0x0d8b('0x113')],{'as':_0x0d8b('0x169'),'foreignKey':'ListId'});db[_0x0d8b('0x164')][_0x0d8b('0x10f')](db['Interval'],{'as':_0x0d8b('0x76'),'foreignKey':_0x0d8b('0x142')});db['ChatWebsite'][_0x0d8b('0x10f')](db[_0x0d8b('0x35')],{'as':_0x0d8b('0x35'),'foreignKey':_0x0d8b('0x14e')});db[_0x0d8b('0x164')]['belongsTo'](db[_0x0d8b('0x143')],{'as':'mandatoryDispositionPause','foreignKey':_0x0d8b('0x157')});db[_0x0d8b('0x164')][_0x0d8b('0x112')](db['User'],{'as':_0x0d8b('0x159'),'through':_0x0d8b('0x187')});db[_0x0d8b('0x188')][_0x0d8b('0x10f')](db[_0x0d8b('0x53')],{});db[_0x0d8b('0x188')][_0x0d8b('0x10f')](db[_0x0d8b('0x113')],{'as':_0x0d8b('0x169'),'foreignKey':_0x0d8b('0x16a')});db[_0x0d8b('0x188')][_0x0d8b('0x10f')](db[_0x0d8b('0x64')],{'as':_0x0d8b('0x163'),'foreignKey':_0x0d8b('0x14d')});db[_0x0d8b('0x188')][_0x0d8b('0x10f')](db[_0x0d8b('0x55')],{});db[_0x0d8b('0x188')][_0x0d8b('0x10f')](db[_0x0d8b('0x180')],{});db[_0x0d8b('0x188')]['belongsTo'](db[_0x0d8b('0x10')],{});db[_0x0d8b('0x188')][_0x0d8b('0x10f')](db[_0x0d8b('0x58')],{});db[_0x0d8b('0x186')][_0x0d8b('0x10f')](db['User'],{'as':'Agent','foreignKey':'UserId','onDelete':_0x0d8b('0x167')});db[_0x0d8b('0x186')]['belongsTo'](db[_0x0d8b('0x5f')],{'as':'Queue','foreignKey':_0x0d8b('0x189'),'onDelete':_0x0d8b('0x167')});db[_0x0d8b('0x186')][_0x0d8b('0x10f')](db[_0x0d8b('0x164')],{'as':_0x0d8b('0x18a'),'foreignKey':_0x0d8b('0x165'),'onDelete':_0x0d8b('0x167')});db['ChatApplication'][_0x0d8b('0x10f')](db[_0x0d8b('0x7e')],{'onDelete':_0x0d8b('0x167'),'foreignKey':_0x0d8b('0x168')});db[_0x0d8b('0x5c')][_0x0d8b('0x104')](db['ChatMessage'],{'as':_0x0d8b('0x154'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x18b')});db['ChatInteraction']['belongsTo'](db[_0x0d8b('0x164')],{'as':'Account','foreignKey':_0x0d8b('0x165')});db[_0x0d8b('0x5c')][_0x0d8b('0x10f')](db['CmContact'],{'as':_0x0d8b('0x163'),'foreignKey':_0x0d8b('0x14d')});db[_0x0d8b('0x5c')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x15d'),'foreignKey':_0x0d8b('0x102')});db['ChatInteraction']['belongsToMany'](db[_0x0d8b('0x7e')],{'through':_0x0d8b('0x18c'),'as':'Tags'});db[_0x0d8b('0x5c')]['belongsToMany'](db['Tag'],{'through':_0x0d8b('0x18c'),'as':'ThroughTags'});db[_0x0d8b('0x5c')][_0x0d8b('0x112')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x160'),'through':_0x0d8b('0x118'),'foreignKey':_0x0d8b('0x18b')});db[_0x0d8b('0x5d')]['belongsTo'](db[_0x0d8b('0x10')],{'onDelete':_0x0d8b('0x101'),'as':_0x0d8b('0x10')});db[_0x0d8b('0x5d')][_0x0d8b('0x10f')](db['CmContact'],{'onDelete':_0x0d8b('0x101'),'as':_0x0d8b('0x163'),'foreignKey':'ContactId'});db[_0x0d8b('0x5d')][_0x0d8b('0x10f')](db[_0x0d8b('0x5c')],{'onDelete':_0x0d8b('0x101'),'as':'Interaction','foreignKey':_0x0d8b('0x18b')});db[_0x0d8b('0x5d')]['belongsTo'](db[_0x0d8b('0xe1')],{'as':_0x0d8b('0xe1'),'foreignKey':_0x0d8b('0x18d')});db[_0x0d8b('0x5d')][_0x0d8b('0x10f')](db[_0x0d8b('0x164')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0d8b('0x5e')][_0x0d8b('0x104')](db['Attachment'],{'as':_0x0d8b('0x18e'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x0d8b('0x101'),'hooks':!![]});db[_0x0d8b('0x5e')][_0x0d8b('0x10f')](db[_0x0d8b('0x64')],{'onDelete':_0x0d8b('0x101'),'as':_0x0d8b('0x163'),'foreignKey':_0x0d8b('0x14d')});db[_0x0d8b('0x5e')][_0x0d8b('0x10f')](db['ChatWebsite'],{'as':_0x0d8b('0x15c'),'foreignKey':_0x0d8b('0x165')});db['ChatQueue']['belongsToMany'](db[_0x0d8b('0x10')],{'as':'Agents','through':_0x0d8b('0x2a'),'hooks':!![]});db[_0x0d8b('0x5f')][_0x0d8b('0x112')](db['Team'],{'through':_0x0d8b('0x18f'),'as':_0x0d8b('0x15b')});db[_0x0d8b('0x111')][_0x0d8b('0x104')](db[_0x0d8b('0xc8')],{'as':_0x0d8b('0x154'),'foreignKey':_0x0d8b('0x190'),'onDelete':'cascade'});db[_0x0d8b('0x111')]['belongsToMany'](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x139'),'through':'chat_group_has_users'});db[_0x0d8b('0x61')]['belongsTo'](db[_0x0d8b('0x164')],{'as':_0x0d8b('0x18a'),'foreignKey':_0x0d8b('0x165')});db[_0x0d8b('0x62')][_0x0d8b('0x104')](db[_0x0d8b('0x64')],{'as':_0x0d8b('0x191'),'foreignKey':_0x0d8b('0x192')});db[_0x0d8b('0x64')][_0x0d8b('0x104')](db['CmHopper'],{'as':_0x0d8b('0x193'),'foreignKey':_0x0d8b('0x14d')});db[_0x0d8b('0x64')]['hasMany'](db[_0x0d8b('0x69')],{'as':_0x0d8b('0x13c'),'foreignKey':_0x0d8b('0x14d')});db[_0x0d8b('0x64')]['hasMany'](db[_0x0d8b('0x6b')],{'as':'HopperHistories','foreignKey':_0x0d8b('0x14d')});db[_0x0d8b('0x64')][_0x0d8b('0x104')](db[_0x0d8b('0x107')],{'as':_0x0d8b('0x107'),'foreignKey':_0x0d8b('0x14d')});db['CmContact'][_0x0d8b('0x104')](db['JscriptySessionReport'],{'as':_0x0d8b('0x13e'),'foreignKey':'ContactId'});db[_0x0d8b('0x64')][_0x0d8b('0x104')](db['OpenchannelInteraction'],{'as':_0x0d8b('0x108'),'foreignKey':_0x0d8b('0x14d'),'onDelete':'restrict'});db[_0x0d8b('0x64')]['hasMany'](db[_0x0d8b('0x5c')],{'as':_0x0d8b('0x117'),'foreignKey':_0x0d8b('0x14d'),'onDelete':_0x0d8b('0x167')});db[_0x0d8b('0x64')]['hasMany'](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0d8b('0x14d'),'onDelete':_0x0d8b('0x167')});db[_0x0d8b('0x64')][_0x0d8b('0x104')](db['FaxInteraction'],{'as':_0x0d8b('0x10a'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact']['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x0d8b('0x14d'),'onDelete':'restrict'});db['CmContact']['belongsTo'](db[_0x0d8b('0x62')],{'as':_0x0d8b('0x194'),'foreignKey':_0x0d8b('0x192')});db[_0x0d8b('0x64')][_0x0d8b('0x10f')](db[_0x0d8b('0x113')],{'as':_0x0d8b('0x169'),'foreignKey':_0x0d8b('0x16a'),'onDelete':_0x0d8b('0x101')});db[_0x0d8b('0x64')][_0x0d8b('0x112')](db['User'],{'as':_0x0d8b('0x160'),'through':_0x0d8b('0x195')});db['CmContact'][_0x0d8b('0x112')](db['Tag'],{'as':_0x0d8b('0x15f'),'through':_0x0d8b('0x196')});db[_0x0d8b('0x64')][_0x0d8b('0x112')](db[_0x0d8b('0x7e')],{'through':_0x0d8b('0x196'),'as':_0x0d8b('0x175')});db['CmHopper'][_0x0d8b('0x10f')](db[_0x0d8b('0x64')],{'as':_0x0d8b('0x163'),'foreignKey':_0x0d8b('0x14d'),'onDelete':_0x0d8b('0x101')});db[_0x0d8b('0x13b')]['belongsTo'](db[_0x0d8b('0x113')],{'as':_0x0d8b('0x169'),'foreignKey':_0x0d8b('0x16a'),'onDelete':_0x0d8b('0x101')});db[_0x0d8b('0x13b')][_0x0d8b('0x10f')](db['User'],{'as':'Agent','foreignKey':_0x0d8b('0x102')});db['CmHopper'][_0x0d8b('0x10f')](db[_0x0d8b('0x1b')],{'as':_0x0d8b('0x197'),'foreignKey':_0x0d8b('0x13a'),'onDelete':_0x0d8b('0x101')});db[_0x0d8b('0x13b')][_0x0d8b('0x10f')](db[_0x0d8b('0xdd')],{'as':'Campaign','foreignKey':_0x0d8b('0x198'),'onDelete':_0x0d8b('0x101')});db[_0x0d8b('0x13b')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x15d'),'foreignKey':'OwnerId'});db[_0x0d8b('0x67')]['belongsTo'](db[_0x0d8b('0x64')],{'as':'Contact','foreignKey':_0x0d8b('0x14d'),'onDelete':_0x0d8b('0x101')});db[_0x0d8b('0x67')]['belongsTo'](db['CmList'],{'as':_0x0d8b('0x169'),'foreignKey':_0x0d8b('0x16a'),'onDelete':_0x0d8b('0x101')});db[_0x0d8b('0x67')]['belongsTo'](db[_0x0d8b('0x1b')],{'as':_0x0d8b('0x197'),'foreignKey':_0x0d8b('0x13a'),'onDelete':'cascade'});db[_0x0d8b('0x67')][_0x0d8b('0x10f')](db['Campaign'],{'as':_0x0d8b('0xdd'),'foreignKey':_0x0d8b('0x198'),'onDelete':_0x0d8b('0x101')});db[_0x0d8b('0x199')][_0x0d8b('0x104')](db[_0x0d8b('0x75')],{'as':{'plural':_0x0d8b('0x19a'),'singular':_0x0d8b('0x19b')},'foreignKey':_0x0d8b('0x19c'),'onDelete':'cascade','hooks':!![]});db[_0x0d8b('0x199')][_0x0d8b('0x104')](db[_0x0d8b('0x75')],{'as':{'plural':'Any','singular':_0x0d8b('0x19d')},'foreignKey':_0x0d8b('0x19e'),'onDelete':_0x0d8b('0x101'),'hooks':!![]});db[_0x0d8b('0x199')][_0x0d8b('0x104')](db[_0x0d8b('0x6f')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x0d8b('0x101'),'hooks':!![]});db[_0x0d8b('0x73')]['hasMany'](db[_0x0d8b('0x73')],{'as':_0x0d8b('0x16d'),'foreignKey':_0x0d8b('0x19f'),'onDelete':'cascade'});db['Interval'][_0x0d8b('0x104')](db[_0x0d8b('0x76')],{'as':_0x0d8b('0x1a0'),'foreignKey':_0x0d8b('0x142'),'onDelete':_0x0d8b('0x101'),'hooks':!![],'required':![]});db[_0x0d8b('0x76')]['hasMany'](db[_0x0d8b('0x17')],{'as':_0x0d8b('0x1a1'),'foreignKey':_0x0d8b('0x142'),'onDelete':_0x0d8b('0x167')});db[_0x0d8b('0x76')][_0x0d8b('0x104')](db[_0x0d8b('0x3e')],{'as':_0x0d8b('0x1a2'),'foreignKey':_0x0d8b('0x142')});db[_0x0d8b('0x76')][_0x0d8b('0x104')](db[_0x0d8b('0x186')],{'as':'ChatApplications','foreignKey':_0x0d8b('0x142')});db[_0x0d8b('0x76')][_0x0d8b('0x104')](db['FaxApplication'],{'as':_0x0d8b('0x1a3'),'foreignKey':_0x0d8b('0x142')});db[_0x0d8b('0x76')][_0x0d8b('0x104')](db[_0x0d8b('0x17a')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x0d8b('0x1a4')][_0x0d8b('0x10f')](db['MailAccount'],{});db[_0x0d8b('0x1a4')][_0x0d8b('0x10f')](db[_0x0d8b('0x8a')],{'foreignKey':'DefaultReportId'});db[_0x0d8b('0x1a4')][_0x0d8b('0x10f')](db[_0x0d8b('0x88')],{'foreignKey':_0x0d8b('0x1a5')});db[_0x0d8b('0x7c')][_0x0d8b('0x112')](db['VoiceMusicOnHold'],{'as':_0x0d8b('0x1a6'),'through':_0x0d8b('0x138'),'onDelete':'restrict'});db['Tag']['belongsToMany'](db[_0x0d8b('0x64')],{'through':_0x0d8b('0x196')});db[_0x0d8b('0x7e')][_0x0d8b('0x112')](db[_0x0d8b('0x5c')],{'through':_0x0d8b('0x18c')});db[_0x0d8b('0x7e')][_0x0d8b('0x112')](db['MailInteraction'],{'through':_0x0d8b('0x15e')});db['Tag'][_0x0d8b('0x112')](db[_0x0d8b('0x4d')],{'through':_0x0d8b('0x17c')});db['Tag'][_0x0d8b('0x112')](db['FaxInteraction'],{'through':_0x0d8b('0x174')});db[_0x0d8b('0x7e')][_0x0d8b('0x112')](db[_0x0d8b('0x55')],{'through':_0x0d8b('0x184')});db[_0x0d8b('0x7e')]['belongsToMany'](db[_0x0d8b('0xf3')],{'through':_0x0d8b('0x1a7')});db['Trigger'][_0x0d8b('0x104')](db['Condition'],{'as':{'plural':_0x0d8b('0x1a8'),'singular':'AllCondition'},'foreignKey':_0x0d8b('0x1a9'),'onDelete':_0x0d8b('0x101'),'hooks':!![]});db[_0x0d8b('0x82')][_0x0d8b('0x104')](db[_0x0d8b('0x75')],{'as':{'plural':'AnyConditions','singular':_0x0d8b('0x1aa')},'foreignKey':_0x0d8b('0x1ab'),'onDelete':'cascade','hooks':!![]});db[_0x0d8b('0x82')][_0x0d8b('0x104')](db[_0x0d8b('0x6f')],{'as':_0x0d8b('0x1ac'),'foreignKey':_0x0d8b('0x1ad'),'onDelete':_0x0d8b('0x101'),'hooks':!![]});db[_0x0d8b('0x88')][_0x0d8b('0x104')](db[_0x0d8b('0x8e')],{'as':_0x0d8b('0x1ae'),'onDelete':'cascade','foreignKey':_0x0d8b('0x1a5'),'hooks':!![]});db[_0x0d8b('0x8a')][_0x0d8b('0x104')](db[_0x0d8b('0x8e')],{'as':_0x0d8b('0x1ae'),'onDelete':'cascade','foreignKey':_0x0d8b('0x1af')});db[_0x0d8b('0x8c')][_0x0d8b('0x104')](db[_0x0d8b('0x8e')],{'as':_0x0d8b('0x1ae'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b0')});db[_0x0d8b('0x8e')][_0x0d8b('0x10f')](db[_0x0d8b('0x8c')],{'foreignKey':_0x0d8b('0x1b0')});db[_0x0d8b('0x92')][_0x0d8b('0x104')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b1')});db[_0x0d8b('0x94')]['hasMany'](db[_0x0d8b('0x96')],{'as':'Subjects','onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b2')});db['SalesforceConfiguration'][_0x0d8b('0x104')](db['SalesforceField'],{'as':_0x0d8b('0x1b3'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b4')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x0d8b('0x1ae'),'onDelete':_0x0d8b('0x101'),'foreignKey':'FieldId'});db[_0x0d8b('0x94')][_0x0d8b('0x10f')](db['SalesforceAccount'],{'as':_0x0d8b('0x15c'),'foreignKey':_0x0d8b('0x1b1')});db[_0x0d8b('0x96')][_0x0d8b('0x104')](db[_0x0d8b('0x96')],{'as':_0x0d8b('0x1b5'),'foreignKey':_0x0d8b('0x1b2')});db[_0x0d8b('0x96')][_0x0d8b('0x104')](db['SalesforceField'],{'as':_0x0d8b('0x1b6'),'foreignKey':_0x0d8b('0x1b4')});db['SalesforceField'][_0x0d8b('0x104')](db[_0x0d8b('0x96')],{'as':_0x0d8b('0x1b7'),'foreignKey':_0x0d8b('0x1b8')});db['SalesforceField'][_0x0d8b('0x10f')](db['Variable'],{'as':_0x0d8b('0x1b9'),'foreignKey':'VariableId'});db[_0x0d8b('0x98')]['hasMany'](db[_0x0d8b('0x9a')],{'as':_0x0d8b('0x1ba'),'onDelete':_0x0d8b('0x101'),'foreignKey':'AccountId'});db[_0x0d8b('0x9a')][_0x0d8b('0x104')](db['SugarcrmField'],{'as':_0x0d8b('0x1bb'),'onDelete':_0x0d8b('0x101'),'foreignKey':'SubjectId'});db[_0x0d8b('0x9a')][_0x0d8b('0x104')](db[_0x0d8b('0x9b')],{'as':_0x0d8b('0x1b3'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b4')});db[_0x0d8b('0x9a')][_0x0d8b('0x104')](db[_0x0d8b('0x9b')],{'as':_0x0d8b('0x1ae'),'onDelete':'cascade','foreignKey':_0x0d8b('0x1b8')});db[_0x0d8b('0x9a')]['belongsTo'](db[_0x0d8b('0x98')],{'as':_0x0d8b('0x15c'),'foreignKey':_0x0d8b('0x1b1')});db[_0x0d8b('0x9b')]['hasMany'](db[_0x0d8b('0x9b')],{'as':_0x0d8b('0x1b5'),'foreignKey':_0x0d8b('0x1b2')});db[_0x0d8b('0x9b')][_0x0d8b('0x104')](db[_0x0d8b('0x9b')],{'as':_0x0d8b('0x1b6'),'foreignKey':'DescriptionId'});db[_0x0d8b('0x9b')][_0x0d8b('0x104')](db[_0x0d8b('0x9b')],{'as':_0x0d8b('0x1b7'),'foreignKey':_0x0d8b('0x1b8')});db['SugarcrmField'][_0x0d8b('0x10f')](db[_0x0d8b('0x1b9')],{'as':_0x0d8b('0x1b9'),'foreignKey':_0x0d8b('0x1bc')});db['DeskAccount'][_0x0d8b('0x104')](db['DeskConfiguration'],{'as':_0x0d8b('0x1ba'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b1')});db['DeskConfiguration'][_0x0d8b('0x104')](db['DeskField'],{'as':_0x0d8b('0x1bb'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b2')});db[_0x0d8b('0x9d')][_0x0d8b('0x104')](db[_0x0d8b('0x9f')],{'as':_0x0d8b('0x1b3'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b4')});db['DeskConfiguration'][_0x0d8b('0x104')](db[_0x0d8b('0x9f')],{'as':_0x0d8b('0x1ae'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b8')});db['DeskConfiguration'][_0x0d8b('0x10f')](db[_0x0d8b('0x1bd')],{'as':_0x0d8b('0x15c'),'foreignKey':'AccountId'});db[_0x0d8b('0x9d')]['belongsToMany'](db[_0x0d8b('0x7e')],{'through':_0x0d8b('0x1be')});db[_0x0d8b('0x9f')][_0x0d8b('0x104')](db[_0x0d8b('0x9f')],{'as':'Subject','foreignKey':_0x0d8b('0x1b2')});db[_0x0d8b('0x9f')][_0x0d8b('0x104')](db[_0x0d8b('0x9f')],{'as':_0x0d8b('0x1b6'),'foreignKey':_0x0d8b('0x1b4')});db[_0x0d8b('0x9f')][_0x0d8b('0x104')](db[_0x0d8b('0x9f')],{'as':_0x0d8b('0x1b7'),'foreignKey':'FieldId'});db['DeskField'][_0x0d8b('0x10f')](db[_0x0d8b('0x1b9')],{'as':'Variable','foreignKey':_0x0d8b('0x1bc')});db[_0x0d8b('0xa1')][_0x0d8b('0x104')](db['ZohoConfiguration'],{'as':_0x0d8b('0x1ba'),'onDelete':_0x0d8b('0x101'),'foreignKey':'AccountId'});db['ZohoConfiguration']['hasMany'](db[_0x0d8b('0xa5')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x0d8b('0x1b2')});db['ZohoConfiguration'][_0x0d8b('0x104')](db[_0x0d8b('0xa5')],{'as':_0x0d8b('0x1b3'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b4')});db[_0x0d8b('0xa3')][_0x0d8b('0x104')](db[_0x0d8b('0xa5')],{'as':'Fields','onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b8')});db[_0x0d8b('0xa3')]['belongsTo'](db[_0x0d8b('0xa1')],{'as':'Account','foreignKey':_0x0d8b('0x1b1')});db[_0x0d8b('0xa5')][_0x0d8b('0x104')](db[_0x0d8b('0xa5')],{'as':_0x0d8b('0x1b5'),'foreignKey':_0x0d8b('0x1b2')});db[_0x0d8b('0xa5')][_0x0d8b('0x104')](db[_0x0d8b('0xa5')],{'as':_0x0d8b('0x1b6'),'foreignKey':'DescriptionId'});db['ZohoField'][_0x0d8b('0x104')](db['ZohoField'],{'as':_0x0d8b('0x1b7'),'foreignKey':_0x0d8b('0x1b8')});db['ZohoField'][_0x0d8b('0x10f')](db['Variable'],{'as':_0x0d8b('0x1b9'),'foreignKey':_0x0d8b('0x1bc')});db['ZendeskAccount']['hasMany'](db[_0x0d8b('0xa8')],{'as':_0x0d8b('0x1ba'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b1')});db[_0x0d8b('0xa8')][_0x0d8b('0x104')](db[_0x0d8b('0xaa')],{'as':_0x0d8b('0x1bb'),'foreignKey':'SubjectId'});db[_0x0d8b('0xa8')][_0x0d8b('0x104')](db[_0x0d8b('0xaa')],{'as':_0x0d8b('0x1b3'),'foreignKey':_0x0d8b('0x1b4')});db[_0x0d8b('0xa8')][_0x0d8b('0x104')](db[_0x0d8b('0xaa')],{'as':'Fields','foreignKey':_0x0d8b('0x1b8')});db['ZendeskConfiguration'][_0x0d8b('0x10f')](db['ZendeskAccount'],{'as':_0x0d8b('0x15c'),'foreignKey':'AccountId'});db[_0x0d8b('0xa8')][_0x0d8b('0x112')](db[_0x0d8b('0x7e')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x0d8b('0x104')](db[_0x0d8b('0xaa')],{'as':'Subject','foreignKey':_0x0d8b('0x1b2')});db[_0x0d8b('0xaa')][_0x0d8b('0x104')](db[_0x0d8b('0xaa')],{'as':'Description','foreignKey':_0x0d8b('0x1b4')});db[_0x0d8b('0xaa')][_0x0d8b('0x104')](db[_0x0d8b('0xaa')],{'as':_0x0d8b('0x1b7'),'foreignKey':'FieldId'});db[_0x0d8b('0xaa')][_0x0d8b('0x10f')](db[_0x0d8b('0x1b9')],{'as':_0x0d8b('0x1b9'),'foreignKey':_0x0d8b('0x1bc')});db[_0x0d8b('0xac')][_0x0d8b('0x104')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x0d8b('0x1b1')});db[_0x0d8b('0xad')][_0x0d8b('0x104')](db[_0x0d8b('0xaf')],{'as':'Subjects','onDelete':_0x0d8b('0x101'),'foreignKey':'SubjectId'});db[_0x0d8b('0xad')][_0x0d8b('0x104')](db[_0x0d8b('0xaf')],{'as':_0x0d8b('0x1b3'),'onDelete':_0x0d8b('0x101'),'foreignKey':'DescriptionId'});db[_0x0d8b('0xad')][_0x0d8b('0x104')](db[_0x0d8b('0xaf')],{'as':_0x0d8b('0x1ae'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b8')});db[_0x0d8b('0xad')][_0x0d8b('0x10f')](db['FreshdeskAccount'],{'as':_0x0d8b('0x15c'),'foreignKey':_0x0d8b('0x1b1')});db['FreshdeskConfiguration'][_0x0d8b('0x112')](db[_0x0d8b('0x7e')],{'through':_0x0d8b('0x1bf')});db[_0x0d8b('0xaf')][_0x0d8b('0x104')](db[_0x0d8b('0xaf')],{'as':_0x0d8b('0x1b5'),'foreignKey':'SubjectId'});db[_0x0d8b('0xaf')]['hasMany'](db[_0x0d8b('0xaf')],{'as':_0x0d8b('0x1b6'),'foreignKey':_0x0d8b('0x1b4')});db[_0x0d8b('0xaf')]['hasMany'](db['FreshdeskField'],{'as':_0x0d8b('0x1b7'),'foreignKey':_0x0d8b('0x1b8')});db[_0x0d8b('0xaf')][_0x0d8b('0x10f')](db[_0x0d8b('0x1b9')],{'as':'Variable','foreignKey':_0x0d8b('0x1bc')});db[_0x0d8b('0xb1')][_0x0d8b('0x104')](db[_0x0d8b('0x1c0')],{'as':_0x0d8b('0x1ba'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b1')});db[_0x0d8b('0x1c0')][_0x0d8b('0x104')](db[_0x0d8b('0xb4')],{'as':_0x0d8b('0x1bb'),'foreignKey':_0x0d8b('0x1b2')});db[_0x0d8b('0x1c0')][_0x0d8b('0x104')](db[_0x0d8b('0xb4')],{'as':_0x0d8b('0x1b3'),'foreignKey':_0x0d8b('0x1b4')});db[_0x0d8b('0x1c0')][_0x0d8b('0x104')](db[_0x0d8b('0xb4')],{'as':_0x0d8b('0x1ae'),'foreignKey':_0x0d8b('0x1b8')});db['VtigerConfiguration'][_0x0d8b('0x10f')](db[_0x0d8b('0xb1')],{'as':_0x0d8b('0x15c'),'foreignKey':_0x0d8b('0x1b1')});db[_0x0d8b('0xb4')][_0x0d8b('0x104')](db['VtigerField'],{'as':_0x0d8b('0x1b5'),'foreignKey':_0x0d8b('0x1b2')});db[_0x0d8b('0xb4')][_0x0d8b('0x104')](db[_0x0d8b('0xb4')],{'as':_0x0d8b('0x1b6'),'foreignKey':_0x0d8b('0x1b4')});db['VtigerField']['hasMany'](db[_0x0d8b('0xb4')],{'as':'Field','foreignKey':'FieldId'});db['VtigerField'][_0x0d8b('0x10f')](db[_0x0d8b('0x1b9')],{'as':_0x0d8b('0x1b9'),'foreignKey':_0x0d8b('0x1bc')});db[_0x0d8b('0xb6')]['hasMany'](db[_0x0d8b('0xb7')],{'as':_0x0d8b('0x1ba'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b1')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':'Subjects','foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x0d8b('0x104')](db['ServicenowField'],{'as':_0x0d8b('0x1b3'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0x0d8b('0x104')](db[_0x0d8b('0xb9')],{'as':_0x0d8b('0x1ae'),'foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x0d8b('0x10f')](db['ServicenowAccount'],{'as':_0x0d8b('0x15c'),'foreignKey':_0x0d8b('0x1b1')});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':_0x0d8b('0x1b5'),'foreignKey':_0x0d8b('0x1b2')});db[_0x0d8b('0xb9')][_0x0d8b('0x104')](db['ServicenowField'],{'as':_0x0d8b('0x1b6'),'foreignKey':_0x0d8b('0x1b4')});db[_0x0d8b('0xb9')]['hasMany'](db[_0x0d8b('0xb9')],{'as':_0x0d8b('0x1b7'),'foreignKey':_0x0d8b('0x1b8')});db[_0x0d8b('0xb9')]['belongsTo'](db[_0x0d8b('0x1b9')],{'as':_0x0d8b('0x1b9'),'foreignKey':_0x0d8b('0x1bc')});db[_0x0d8b('0xbb')][_0x0d8b('0x104')](db['Dynamics365Configuration'],{'as':_0x0d8b('0x1ba'),'onDelete':'cascade','foreignKey':_0x0d8b('0x1b1')});db[_0x0d8b('0xbd')][_0x0d8b('0x104')](db[_0x0d8b('0xbe')],{'as':_0x0d8b('0x1bb'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b2')});db[_0x0d8b('0xbd')][_0x0d8b('0x104')](db['Dynamics365Field'],{'as':_0x0d8b('0x1b3'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b4')});db[_0x0d8b('0xbd')][_0x0d8b('0x104')](db[_0x0d8b('0xbe')],{'as':_0x0d8b('0x1ae'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b8')});db[_0x0d8b('0xbd')][_0x0d8b('0x10f')](db[_0x0d8b('0xbb')],{'as':'Account','foreignKey':_0x0d8b('0x1b1')});db[_0x0d8b('0xbe')][_0x0d8b('0x104')](db[_0x0d8b('0xbe')],{'as':_0x0d8b('0x1b5'),'foreignKey':_0x0d8b('0x1b2')});db[_0x0d8b('0xbe')][_0x0d8b('0x104')](db[_0x0d8b('0xbe')],{'as':_0x0d8b('0x1b6'),'foreignKey':_0x0d8b('0x1b4')});db['Dynamics365Field'][_0x0d8b('0x104')](db['Dynamics365Field'],{'as':_0x0d8b('0x1b7'),'foreignKey':_0x0d8b('0x1b8')});db[_0x0d8b('0xbe')][_0x0d8b('0x10f')](db['Variable'],{'as':_0x0d8b('0x1b9'),'foreignKey':_0x0d8b('0x1bc')});db[_0x0d8b('0x1c1')][_0x0d8b('0x104')](db[_0x0d8b('0xc0')],{'as':_0x0d8b('0x1ba'),'onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1b1')});db[_0x0d8b('0xc0')][_0x0d8b('0x104')](db[_0x0d8b('0xc1')],{'as':_0x0d8b('0x1bb'),'foreignKey':_0x0d8b('0x1b2')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0x0d8b('0x1b3'),'foreignKey':_0x0d8b('0x1b4')});db[_0x0d8b('0xc0')][_0x0d8b('0x104')](db[_0x0d8b('0xc1')],{'as':_0x0d8b('0x1ae'),'foreignKey':_0x0d8b('0x1b8')});db[_0x0d8b('0xc0')]['belongsTo'](db[_0x0d8b('0x1c1')],{'as':_0x0d8b('0x15c'),'foreignKey':_0x0d8b('0x1b1')});db[_0x0d8b('0xc1')][_0x0d8b('0x104')](db[_0x0d8b('0xc1')],{'as':_0x0d8b('0x1b5'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0x0d8b('0x104')](db['FreshsalesField'],{'as':_0x0d8b('0x1b6'),'foreignKey':_0x0d8b('0x1b4')});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':'Field','foreignKey':_0x0d8b('0x1b8')});db['FreshsalesField']['belongsTo'](db[_0x0d8b('0x1b9')],{'as':'Variable','foreignKey':_0x0d8b('0x1bc')});db['ChatQueueReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x164')],{});db[_0x0d8b('0xc6')][_0x0d8b('0x10f')](db[_0x0d8b('0x113')],{'as':_0x0d8b('0x169'),'foreignKey':_0x0d8b('0x16a')});db[_0x0d8b('0xc6')]['belongsTo'](db[_0x0d8b('0x64')],{'as':_0x0d8b('0x163'),'foreignKey':_0x0d8b('0x14d')});db[_0x0d8b('0xc6')][_0x0d8b('0x10f')](db[_0x0d8b('0x5c')],{});db[_0x0d8b('0xc6')]['belongsTo'](db['ChatMessage'],{});db[_0x0d8b('0xc6')]['belongsTo'](db[_0x0d8b('0x10')],{});db[_0x0d8b('0xc6')][_0x0d8b('0x10f')](db[_0x0d8b('0x5f')],{});db[_0x0d8b('0xc8')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'onDelete':'cascade','foreignKey':_0x0d8b('0x1c2')});db['ChatInternalMessage']['belongsTo'](db['User'],{'onDelete':_0x0d8b('0x101'),'foreignKey':'ToId'});db[_0x0d8b('0xcd')][_0x0d8b('0x104')](db[_0x0d8b('0x1c3')],{'foreignKey':_0x0d8b('0x1c4'),'onDelete':_0x0d8b('0x101')});db[_0x0d8b('0xcd')][_0x0d8b('0x104')](db['JscriptyAnswerReport'],{'foreignKey':_0x0d8b('0x1c4'),'onDelete':_0x0d8b('0x101')});db[_0x0d8b('0xcf')][_0x0d8b('0x10f')](db[_0x0d8b('0x12d')],{});db['SmsQueueReport'][_0x0d8b('0x10f')](db['CmList'],{'as':_0x0d8b('0x169'),'foreignKey':_0x0d8b('0x16a')});db[_0x0d8b('0xcf')][_0x0d8b('0x10f')](db['CmContact'],{'as':_0x0d8b('0x163'),'foreignKey':'ContactId'});db[_0x0d8b('0xcf')][_0x0d8b('0x10f')](db[_0x0d8b('0x4d')],{});db['SmsQueueReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x4f')],{});db['SmsQueueReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{});db[_0x0d8b('0xcf')][_0x0d8b('0x10f')](db[_0x0d8b('0x51')],{});db['JscriptyProject']['hasMany'](db[_0x0d8b('0xcd')],{'foreignKey':_0x0d8b('0x1c5')});db['JscriptyProject'][_0x0d8b('0x104')](db[_0x0d8b('0x1c3')],{'foreignKey':_0x0d8b('0x1c5')});db[_0x0d8b('0xd2')][_0x0d8b('0x104')](db[_0x0d8b('0xca')],{'foreignKey':_0x0d8b('0x1c5')});db[_0x0d8b('0x132')][_0x0d8b('0x112')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x160'),'through':_0x0d8b('0x134')});db['Team'][_0x0d8b('0x112')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x159'),'through':'user_has_teams'});db[_0x0d8b('0xdb')][_0x0d8b('0x112')](db[_0x0d8b('0x1b')],{'through':_0x0d8b('0xfb'),'as':_0x0d8b('0x11d')});db[_0x0d8b('0xdb')][_0x0d8b('0x112')](db['MailQueue'],{'through':'team_has_mail_queues','as':_0x0d8b('0x11f')});db[_0x0d8b('0xdb')]['belongsToMany'](db[_0x0d8b('0x5f')],{'through':_0x0d8b('0x18f'),'as':_0x0d8b('0x120')});db[_0x0d8b('0xdb')][_0x0d8b('0x112')](db[_0x0d8b('0x48')],{'through':_0x0d8b('0x178'),'as':_0x0d8b('0x121')});db[_0x0d8b('0xdb')]['belongsToMany'](db[_0x0d8b('0x51')],{'through':_0x0d8b('0x17e'),'as':_0x0d8b('0x122')});db[_0x0d8b('0xdb')][_0x0d8b('0x112')](db[_0x0d8b('0x58')],{'through':_0x0d8b('0x1c6'),'as':_0x0d8b('0x124')});db['Team'][_0x0d8b('0x112')](db['WhatsappQueue'],{'through':_0x0d8b('0x1c7'),'as':'WhatsappQueues'});db['Team']['belongsToMany'](db[_0x0d8b('0xe9')],{'through':_0x0d8b('0x1c8'),'as':_0x0d8b('0x11e')});db[_0x0d8b('0xdd')][_0x0d8b('0x104')](db[_0x0d8b('0x13b')],{'as':_0x0d8b('0x193'),'foreignKey':_0x0d8b('0x198')});db[_0x0d8b('0xdd')][_0x0d8b('0x104')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x0d8b('0x198')});db[_0x0d8b('0xdd')][_0x0d8b('0x104')](db[_0x0d8b('0x6b')],{'as':_0x0d8b('0x13d'),'foreignKey':'CampaignId'});db[_0x0d8b('0xdd')][_0x0d8b('0x104')](db[_0x0d8b('0x67')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db['Campaign'][_0x0d8b('0x10f')](db[_0x0d8b('0x25')],{'as':_0x0d8b('0x25'),'foreignKey':'TrunkId'});db[_0x0d8b('0xdd')][_0x0d8b('0x10f')](db[_0x0d8b('0x25')],{'as':_0x0d8b('0x140'),'foreignKey':_0x0d8b('0x141')});db[_0x0d8b('0xdd')][_0x0d8b('0x10f')](db[_0x0d8b('0x76')],{'as':_0x0d8b('0x76'),'foreignKey':_0x0d8b('0x142')});db['Campaign']['belongsTo'](db[_0x0d8b('0x132')],{'as':_0x0d8b('0x132'),'foreignKey':_0x0d8b('0x1c9')});db[_0x0d8b('0xdd')]['belongsToMany'](db[_0x0d8b('0x113')],{'as':_0x0d8b('0x114'),'through':_0x0d8b('0x1ca')});db[_0x0d8b('0xdd')][_0x0d8b('0x112')](db[_0x0d8b('0x113')],{'as':_0x0d8b('0x146'),'through':_0x0d8b('0x1cb')});db[_0x0d8b('0xe1')]['belongsTo'](db[_0x0d8b('0x5e')],{'as':_0x0d8b('0x5e'),'foreignKey':_0x0d8b('0x166')});db[_0x0d8b('0xe3')][_0x0d8b('0x10f')](db[_0x0d8b('0x3d')],{});db[_0x0d8b('0xe3')][_0x0d8b('0x10f')](db[_0x0d8b('0x3b')],{});db[_0x0d8b('0xe3')][_0x0d8b('0x10f')](db[_0x0d8b('0x35')],{'foreignKey':'FromMailAccountId','as':_0x0d8b('0x1cc')});db[_0x0d8b('0xe3')][_0x0d8b('0x10f')](db['User'],{'foreignKey':'FromUserId','as':_0x0d8b('0x1cd')});db['MailTransferReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'foreignKey':'ToUserId','as':_0x0d8b('0x1ce')});db[_0x0d8b('0xe3')]['belongsTo'](db['MailQueue'],{'foreignKey':_0x0d8b('0x1cf'),'as':_0x0d8b('0x1d0')});db['MailTransferReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x35')],{'foreignKey':_0x0d8b('0x1d1'),'as':_0x0d8b('0x1d2')});db[_0x0d8b('0xe4')][_0x0d8b('0x10f')](db['ChatMessage'],{});db[_0x0d8b('0xe4')][_0x0d8b('0x10f')](db['ChatInteraction'],{});db[_0x0d8b('0xe4')][_0x0d8b('0x10f')](db[_0x0d8b('0x164')],{'foreignKey':_0x0d8b('0x1d3'),'as':'FromAccount'});db[_0x0d8b('0xe4')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'foreignKey':'FromUserId','as':_0x0d8b('0x1cd')});db['ChatTransferReport'][_0x0d8b('0x10f')](db['User'],{'foreignKey':_0x0d8b('0x1d4'),'as':_0x0d8b('0x1ce')});db[_0x0d8b('0xe4')][_0x0d8b('0x10f')](db[_0x0d8b('0x5f')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0d8b('0x1d5'),'as':'ToAccount'});db[_0x0d8b('0xe5')][_0x0d8b('0x10f')](db['FaxMessage'],{});db[_0x0d8b('0xe5')][_0x0d8b('0x10f')](db[_0x0d8b('0x46')],{});db[_0x0d8b('0xe5')][_0x0d8b('0x10f')](db[_0x0d8b('0x127')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0x0d8b('0xe5')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'foreignKey':_0x0d8b('0x1d6'),'as':_0x0d8b('0x1cd')});db[_0x0d8b('0xe5')]['belongsTo'](db[_0x0d8b('0x10')],{'foreignKey':'ToUserId','as':_0x0d8b('0x1ce')});db['FaxTransferReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x48')],{'foreignKey':_0x0d8b('0x1d7'),'as':_0x0d8b('0x1d0')});db[_0x0d8b('0xe5')][_0x0d8b('0x10f')](db[_0x0d8b('0x127')],{'foreignKey':_0x0d8b('0x1d8'),'as':_0x0d8b('0x1d2')});db['OpenchannelTransferReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x180')],{});db[_0x0d8b('0xe7')][_0x0d8b('0x10f')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x0d8b('0x53')],{'foreignKey':_0x0d8b('0x1d9'),'as':_0x0d8b('0x1cc')});db['OpenchannelTransferReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'foreignKey':_0x0d8b('0x1d6'),'as':'FromAgent'});db[_0x0d8b('0xe7')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'foreignKey':_0x0d8b('0x1d4'),'as':_0x0d8b('0x1ce')});db[_0x0d8b('0xe7')][_0x0d8b('0x10f')](db[_0x0d8b('0x58')],{'foreignKey':_0x0d8b('0x1da'),'as':_0x0d8b('0x1d0')});db[_0x0d8b('0xe7')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x0d8b('0x1d2')});db['SmsTransferReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x4f')],{});db['SmsTransferReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x4d')],{});db[_0x0d8b('0xe8')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x0d8b('0x1db'),'as':_0x0d8b('0x1cc')});db['SmsTransferReport']['belongsTo'](db[_0x0d8b('0x10')],{'foreignKey':_0x0d8b('0x1d6'),'as':'FromAgent'});db[_0x0d8b('0xe8')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'foreignKey':_0x0d8b('0x1d4'),'as':_0x0d8b('0x1ce')});db['SmsTransferReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x51')],{'foreignKey':'ToSmsQueueId','as':_0x0d8b('0x1d0')});db['SmsTransferReport'][_0x0d8b('0x10f')](db['SmsAccount'],{'foreignKey':_0x0d8b('0x1dc'),'as':_0x0d8b('0x1d2')});db[_0x0d8b('0x113')][_0x0d8b('0x104')](db[_0x0d8b('0x73')],{'as':_0x0d8b('0x16d'),'foreignKey':'ListId','onDelete':_0x0d8b('0x101')});db[_0x0d8b('0x113')][_0x0d8b('0x104')](db[_0x0d8b('0x6e')],{'as':_0x0d8b('0x1dd'),'foreignKey':_0x0d8b('0x16a')});db['CmList']['hasMany'](db[_0x0d8b('0x64')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0x0d8b('0x16a')});db[_0x0d8b('0x113')]['hasMany'](db['CmHopperFinal'],{'as':_0x0d8b('0x13c'),'foreignKey':_0x0d8b('0x16a')});db[_0x0d8b('0x113')]['hasMany'](db[_0x0d8b('0x6b')],{'as':_0x0d8b('0x106'),'foreignKey':_0x0d8b('0x16a')});db[_0x0d8b('0x113')]['hasMany'](db[_0x0d8b('0x107')],{'as':_0x0d8b('0x107'),'foreignKey':_0x0d8b('0x16a')});db['CmList'][_0x0d8b('0x112')](db[_0x0d8b('0x1b')],{'as':_0x0d8b('0x1de'),'through':'voice_queues_has_cm_lists'});db[_0x0d8b('0x113')][_0x0d8b('0x112')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x159'),'through':'cm_user_has_lists'});db['VoicePrefix']['hasMany'](db['VoiceExtension'],{'as':_0x0d8b('0x1a1'),'onDelete':_0x0d8b('0x101')});db[_0x0d8b('0xe9')][_0x0d8b('0x112')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x159'),'through':_0x0d8b('0xfe')});db[_0x0d8b('0xe9')][_0x0d8b('0x112')](db[_0x0d8b('0xdb')],{'through':_0x0d8b('0x1c8'),'as':_0x0d8b('0x15b')});db[_0x0d8b('0x110')][_0x0d8b('0x104')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x160'),'foreignKey':_0x0d8b('0x1df')});db[_0x0d8b('0x110')]['hasMany'](db['UserProfileSection'],{'as':_0x0d8b('0x1e0'),'foreignKey':'userProfileId','onDelete':_0x0d8b('0x101')});db[_0x0d8b('0xeb')][_0x0d8b('0x104')](db[_0x0d8b('0xed')],{'as':'Resources','foreignKey':_0x0d8b('0x1e1'),'onDelete':_0x0d8b('0x101')});db[_0x0d8b('0x130')][_0x0d8b('0x104')](db[_0x0d8b('0x73')],{'as':'Dispositions','foreignKey':_0x0d8b('0x1e2'),'onDelete':'cascade'});db[_0x0d8b('0x130')][_0x0d8b('0x104')](db['CannedAnswer'],{'as':_0x0d8b('0x153'),'foreignKey':_0x0d8b('0x1e2')});db[_0x0d8b('0x130')][_0x0d8b('0x104')](db[_0x0d8b('0xf5')],{'as':_0x0d8b('0x154'),'foreignKey':'WhatsappAccountId'});db[_0x0d8b('0x130')][_0x0d8b('0x104')](db[_0x0d8b('0xf3')],{'as':_0x0d8b('0x155')});db['WhatsappAccount']['hasMany'](db[_0x0d8b('0xf1')],{'as':'Applications'});db['WhatsappAccount']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x0d8b('0x16a')});db[_0x0d8b('0x130')][_0x0d8b('0x10f')](db[_0x0d8b('0x143')],{'as':_0x0d8b('0x144'),'foreignKey':_0x0d8b('0x157')});db['WhatsappAccount']['belongsToMany'](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x159'),'through':_0x0d8b('0x1e3')});db[_0x0d8b('0xf1')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'onDelete':_0x0d8b('0x167')});db[_0x0d8b('0xf1')][_0x0d8b('0x10f')](db['WhatsappQueue'],{'onDelete':_0x0d8b('0x167')});db['WhatsappApplication'][_0x0d8b('0x10f')](db[_0x0d8b('0x130')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x0d8b('0x10f')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x0d8b('0xf1')][_0x0d8b('0x10f')](db[_0x0d8b('0x7e')],{'onDelete':_0x0d8b('0x167'),'foreignKey':'TagId'});db[_0x0d8b('0xf3')][_0x0d8b('0x104')](db[_0x0d8b('0xf5')],{'as':'Messages','onDelete':_0x0d8b('0x101'),'foreignKey':_0x0d8b('0x1e4')});db['WhatsappInteraction'][_0x0d8b('0x10f')](db['WhatsappAccount'],{'as':_0x0d8b('0x15c'),'foreignKey':'WhatsappAccountId'});db[_0x0d8b('0xf3')][_0x0d8b('0x10f')](db[_0x0d8b('0x64')],{'as':'Contact','foreignKey':_0x0d8b('0x14d')});db[_0x0d8b('0xf3')][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x15d'),'foreignKey':'UserId'});db[_0x0d8b('0xf3')][_0x0d8b('0x112')](db[_0x0d8b('0x7e')],{'through':_0x0d8b('0x1a7'),'as':_0x0d8b('0x15f')});db['WhatsappInteraction']['belongsToMany'](db['Tag'],{'through':_0x0d8b('0x1a7'),'as':_0x0d8b('0x175')});db[_0x0d8b('0xf3')]['belongsToMany'](db[_0x0d8b('0x10')],{'as':_0x0d8b('0x160'),'through':_0x0d8b('0x11c'),'foreignKey':'WhatsappInteractionId'});db[_0x0d8b('0xf5')][_0x0d8b('0x10f')](db['User'],{'as':_0x0d8b('0x10')});db[_0x0d8b('0xf5')]['belongsTo'](db[_0x0d8b('0x64')],{'onDelete':_0x0d8b('0x101'),'as':'Contact'});db[_0x0d8b('0xf5')][_0x0d8b('0x10f')](db[_0x0d8b('0xf3')],{'onDelete':_0x0d8b('0x101'),'as':_0x0d8b('0x176'),'foreignKey':_0x0d8b('0x1e4')});db[_0x0d8b('0xf5')][_0x0d8b('0x10f')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x0d8b('0x1e2')});db[_0x0d8b('0xf7')][_0x0d8b('0x10f')](db['WhatsappAccount'],{});db[_0x0d8b('0xf7')][_0x0d8b('0x10f')](db[_0x0d8b('0x113')],{'as':_0x0d8b('0x169'),'foreignKey':_0x0d8b('0x16a')});db[_0x0d8b('0xf7')][_0x0d8b('0x10f')](db['CmContact'],{'as':_0x0d8b('0x163'),'foreignKey':_0x0d8b('0x14d')});db[_0x0d8b('0xf7')][_0x0d8b('0x10f')](db[_0x0d8b('0xf3')],{});db[_0x0d8b('0xf7')][_0x0d8b('0x10f')](db[_0x0d8b('0x1e5')],{});db[_0x0d8b('0xf7')][_0x0d8b('0x10f')](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x10')],{});db['WhatsappTransferReport'][_0x0d8b('0x10f')](db[_0x0d8b('0xf5')],{});db[_0x0d8b('0xf8')]['belongsTo'](db[_0x0d8b('0xf3')],{});db[_0x0d8b('0xf8')]['belongsTo'](db[_0x0d8b('0x130')],{'foreignKey':'FromWhatsappAccountId','as':_0x0d8b('0x1cc')});db['WhatsappTransferReport'][_0x0d8b('0x10f')](db[_0x0d8b('0x130')],{'foreignKey':_0x0d8b('0x1e6'),'as':_0x0d8b('0x1d2')});db[_0x0d8b('0xf8')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0d8b('0x1e7'),'as':_0x0d8b('0x1d0')});db[_0x0d8b('0xf8')][_0x0d8b('0x10f')](db['User'],{'foreignKey':_0x0d8b('0x1d6'),'as':'FromAgent'});db[_0x0d8b('0xf8')][_0x0d8b('0x10f')](db['User'],{'foreignKey':'ToUserId','as':_0x0d8b('0x1ce')});db[_0x0d8b('0x1e5')]['belongsToMany'](db[_0x0d8b('0x10')],{'as':'Agents','through':_0x0d8b('0x32'),'foreignKey':_0x0d8b('0x1e8')});db['WhatsappQueue'][_0x0d8b('0x112')](db[_0x0d8b('0xdb')],{'through':'team_has_whatsapp_queues','as':_0x0d8b('0x15b')});module[_0x0d8b('0x1e9')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x1be1=['../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoField','../api/intZohoField/intZohoField.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','UserId','Recordings','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteraction','SenderId','belongsTo','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','WhatsappInteractions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueues','FaxQueues','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','Applications','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','Imap','Smtp','Answers','Interactions','List','ListId','TemplateId','team_has_mail_queues','Teams','Account','Contact','Owner','mail_interaction_has_tags','Tags','Tag','ThroughTags','Users','user_has_mail_interactions','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','restrict','TagId','Dispositions','FaxAccountId','Exntensions','fax_interaction_has_tags','FaxInteractionId','Attachment','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Agent','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','CmHopper','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','AnalyticFieldReport','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','VariableId','Field','DeskConfiguration','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowConfiguration','FromId','ToId','SessionId','ProjectId','user_has_square_projects','TeamVoiceQueue','ChatQueues','team_has_sms_queues','team_has_whatsapp_queues','TrunkBackup','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToAccount','FromAccount','ToAgent','ToChatQueueId','ToChatWebsiteId','ToFaxAccountId','FromOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','cm_user_has_lists','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','exports','lodash','jstz','sequelize','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','name','utf8_general_ci','sequelizeHistory','utf8mb4','utf8','database','username','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsApplication/smsApplication.model'];(function(_0x54a7ea,_0x4a3a90){var _0x17c047=function(_0x1b1b72){while(--_0x1b1b72){_0x54a7ea['push'](_0x54a7ea['shift']());}};_0x17c047(++_0x4a3a90);}(_0x1be1,0x192));var _0x11be=function(_0x13af3f,_0x5359cc){_0x13af3f=_0x13af3f-0x0;var _0x5f49b1=_0x1be1[_0x13af3f];return _0x5f49b1;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0x11be('0x0'));var jstz=require(_0x11be('0x1'));var timezone=jstz['determine']();config[_0x11be('0x2')]=_[_0x11be('0x3')](config[_0x11be('0x2')],{'database':_0x11be('0x4'),'username':'xcall','password':_0x11be('0x5'),'options':{'host':_0x11be('0x6'),'port':0xcea,'dialect':_0x11be('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x11be('0x8')](),'define':{'charset':'utf8','collate':_0x11be('0x9')}}});config[_0x11be('0xa')]=_[_0x11be('0x3')](config[_0x11be('0xa')],{'database':_0x11be('0x4'),'username':'xcall','password':_0x11be('0x5'),'options':{'host':_0x11be('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x11be('0xb')},'logging':![],'timezone':timezone[_0x11be('0x8')](),'define':{'charset':_0x11be('0xc'),'collate':_0x11be('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x11be('0xd')],config[_0x11be('0x2')][_0x11be('0xe')],config['sequelize'][_0x11be('0xf')],config[_0x11be('0x2')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x11be('0xa')]['database'],config['sequelizeHistory']['username'],config['sequelizeHistory']['password'],config['sequelizeHistory']['options'])};db[_0x11be('0x10')]=db['sequelize'][_0x11be('0x11')](_0x11be('0x12'));db[_0x11be('0x13')]=db[_0x11be('0x2')]['import'](_0x11be('0x14'));db[_0x11be('0x15')]=db['sequelize'][_0x11be('0x11')](_0x11be('0x16'));db[_0x11be('0x17')]=db['sequelize']['import'](_0x11be('0x18'));db[_0x11be('0x19')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x11be('0x1a')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x1b'));db[_0x11be('0x1c')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x1d'));db[_0x11be('0x1e')]=db[_0x11be('0x2')]['import'](_0x11be('0x1f'));db[_0x11be('0x20')]=db[_0x11be('0x2')]['import']('../api/voiceMail/voiceMail.model');db[_0x11be('0x21')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x11be('0x22')]=db['sequelize'][_0x11be('0x11')]('../api/voiceCallReport/voiceCallReport.model');db[_0x11be('0x23')]=db[_0x11be('0x2')]['import'](_0x11be('0x24'));db[_0x11be('0x25')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x26'));db[_0x11be('0x27')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x28'));db['MemberReport']=db[_0x11be('0x2')]['import'](_0x11be('0x29'));db[_0x11be('0x2a')]=db['sequelize']['import'](_0x11be('0x2b'));db[_0x11be('0x2c')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x2d'));db[_0x11be('0x2e')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x2f'));db['UserVoiceQueue']=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x30'));db[_0x11be('0x31')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/userChatQueue/userChatQueue.model');db[_0x11be('0x32')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x33'));db[_0x11be('0x34')]=db['sequelize'][_0x11be('0x11')](_0x11be('0x35'));db[_0x11be('0x36')]=db['sequelize'][_0x11be('0x11')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db['sequelize']['import'](_0x11be('0x37'));db[_0x11be('0x38')]=db[_0x11be('0x2')]['import'](_0x11be('0x39'));db[_0x11be('0x3a')]=db['sequelize'][_0x11be('0x11')]('../api/mailServerIn/mailServerIn.model');db[_0x11be('0x3b')]=db['sequelize'][_0x11be('0x11')](_0x11be('0x3c'));db[_0x11be('0x3d')]=db[_0x11be('0x2')]['import'](_0x11be('0x3e'));db[_0x11be('0x3f')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/mailQueue/mailQueue.model');db[_0x11be('0x40')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x41'));db[_0x11be('0x42')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/mailInteraction/mailInteraction.model');db[_0x11be('0x43')]=db[_0x11be('0x2')]['import'](_0x11be('0x44'));db[_0x11be('0x45')]=db['sequelize'][_0x11be('0x11')]('../api/mailApplication/mailApplication.model');db[_0x11be('0x46')]=db['sequelize'][_0x11be('0x11')](_0x11be('0x47'));db['Dashboard']=db[_0x11be('0x2')]['import'](_0x11be('0x48'));db[_0x11be('0x49')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x4a'));db[_0x11be('0x4b')]=db[_0x11be('0x2')]['import'](_0x11be('0x4c'));db[_0x11be('0x4d')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db['sequelize'][_0x11be('0x11')]('../api/faxInteraction/faxInteraction.model');db[_0x11be('0x4e')]=db['sequelize'][_0x11be('0x11')](_0x11be('0x4f'));db[_0x11be('0x50')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x51'));db[_0x11be('0x52')]=db['sequelize'][_0x11be('0x11')]('../api/faxQueueReport/faxQueueReport.model');db[_0x11be('0x53')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db['sequelize'][_0x11be('0x11')](_0x11be('0x54'));db['SmsInteraction']=db['sequelize']['import'](_0x11be('0x55'));db[_0x11be('0x56')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x57'));db[_0x11be('0x58')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x59'));db[_0x11be('0x5a')]=db[_0x11be('0x2')]['import'](_0x11be('0x5b'));db[_0x11be('0x5c')]=db['sequelize']['import']('../api/openchannelApplication/openchannelApplication.model');db[_0x11be('0x5d')]=db['sequelize'][_0x11be('0x11')](_0x11be('0x5e'));db[_0x11be('0x5f')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x60'));db[_0x11be('0x61')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/openchannelQueue/openchannelQueue.model');db[_0x11be('0x62')]=db['sequelize'][_0x11be('0x11')](_0x11be('0x63'));db['OpenchannelQueueReport']=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x64'));db[_0x11be('0x65')]=db[_0x11be('0x2')]['import']('../api/chatApplication/chatApplication.model');db[_0x11be('0x66')]=db[_0x11be('0x2')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x11be('0x67')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db['sequelize'][_0x11be('0x11')](_0x11be('0x68'));db[_0x11be('0x69')]=db['sequelize']['import'](_0x11be('0x6a'));db[_0x11be('0x6b')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/chatGroup/chatGroup.model');db[_0x11be('0x6c')]=db['sequelize']['import']('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x6d'));db[_0x11be('0x6e')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x6f'));db['CmHopper']=db['sequelize'][_0x11be('0x11')](_0x11be('0x70'));db[_0x11be('0x71')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x72'));db[_0x11be('0x73')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x11be('0x74')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x11be('0x75')]=db[_0x11be('0x2')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x11be('0x76')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x77'));db['Action']=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x78'));db[_0x11be('0x79')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x7a'));db[_0x11be('0x7b')]=db[_0x11be('0x2')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x11be('0x7c')]=db[_0x11be('0x2')]['import'](_0x11be('0x7d'));db[_0x11be('0x7e')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x7f'));db[_0x11be('0x80')]=db[_0x11be('0x2')]['import']('../api/interval/interval.model');db[_0x11be('0x81')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/pause/pause.model');db[_0x11be('0x82')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x83'));db[_0x11be('0x84')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x85'));db[_0x11be('0x86')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x87'));db[_0x11be('0x88')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x89'));db['Tag']=db['sequelize'][_0x11be('0x11')]('../api/tag/tag.model');db[_0x11be('0x8a')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x8b'));db[_0x11be('0x8c')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x8d'));db[_0x11be('0x8e')]=db['sequelize'][_0x11be('0x11')](_0x11be('0x8f'));db[_0x11be('0x90')]=db['sequelize'][_0x11be('0x11')](_0x11be('0x91'));db['IntegrationReport']=db['sequelize']['import']('../api/integrationReport/integrationReport.model');db[_0x11be('0x92')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x93'));db[_0x11be('0x94')]=db['sequelize'][_0x11be('0x11')](_0x11be('0x95'));db[_0x11be('0x96')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x11be('0x97')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x98'));db['AnalyticFieldReport']=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x99'));db[_0x11be('0x9a')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x11be('0x9b')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x9c'));db['SalesforceConfiguration']=db[_0x11be('0x2')]['import'](_0x11be('0x9d'));db[_0x11be('0x9e')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/intSalesforceField/intSalesforceField.model');db[_0x11be('0x9f')]=db[_0x11be('0x2')]['import'](_0x11be('0xa0'));db[_0x11be('0xa1')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x11be('0xa2')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xa3'));db[_0x11be('0xa4')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xa5'));db['DeskConfiguration']=db[_0x11be('0x2')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x11be('0xa6')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xa7'));db[_0x11be('0xa8')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0x11be('0x2')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x11be('0xa9')]=db['sequelize'][_0x11be('0x11')](_0x11be('0xaa'));db['ZendeskAccount']=db[_0x11be('0x2')][_0x11be('0x11')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x11be('0xab')]=db[_0x11be('0x2')]['import'](_0x11be('0xac'));db[_0x11be('0xad')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xae'));db[_0x11be('0xaf')]=db[_0x11be('0x2')]['import'](_0x11be('0xb0'));db[_0x11be('0xb1')]=db[_0x11be('0x2')]['import'](_0x11be('0xb2'));db[_0x11be('0xb3')]=db['sequelize'][_0x11be('0x11')](_0x11be('0xb4'));db[_0x11be('0xb5')]=db['sequelize']['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0x11be('0xb6')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xb7'));db[_0x11be('0xb8')]=db['sequelize'][_0x11be('0x11')](_0x11be('0xb9'));db[_0x11be('0xba')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xbb'));db['ServicenowConfiguration']=db['sequelize'][_0x11be('0x11')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x11be('0xbc')]=db[_0x11be('0x2')]['import'](_0x11be('0xbd'));db[_0x11be('0xbe')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xbf'));db[_0x11be('0xc0')]=db['sequelize'][_0x11be('0x11')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x11be('0xc1')]=db['sequelize'][_0x11be('0x11')](_0x11be('0xc2'));db[_0x11be('0xc3')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xc4'));db[_0x11be('0xc5')]=db[_0x11be('0x2')]['import'](_0x11be('0xc6'));db[_0x11be('0xc7')]=db['sequelize'][_0x11be('0x11')](_0x11be('0xc8'));db[_0x11be('0x90')]=db['sequelize']['import'](_0x11be('0x91'));db['Network']=db[_0x11be('0x2')]['import'](_0x11be('0xc9'));db[_0x11be('0xca')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/chatQueueReport/chatQueueReport.model');db[_0x11be('0xcb')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xcc'));db[_0x11be('0xcd')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xce'));db[_0x11be('0xcf')]=db[_0x11be('0x2')]['import'](_0x11be('0xd0'));db[_0x11be('0xd1')]=db[_0x11be('0x2')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x11be('0xd2')]=db[_0x11be('0x2')]['import'](_0x11be('0xd3'));db[_0x11be('0xd4')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xd5'));db['SquareDetailsReport']=db['sequelize'][_0x11be('0x11')](_0x11be('0xd6'));db[_0x11be('0xd7')]=db[_0x11be('0x2')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0x11be('0xd8')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/setting/setting.model');db[_0x11be('0xd9')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xda'));db[_0x11be('0xdb')]=db['sequelize'][_0x11be('0x11')]('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0x11be('0x2')][_0x11be('0x11')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db['sequelize'][_0x11be('0x11')](_0x11be('0xdc'));db[_0x11be('0xdd')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xde'));db['License']=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xdf'));db[_0x11be('0xe0')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xe1'));db[_0x11be('0xe2')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xe3'));db['Attachment']=db[_0x11be('0x2')]['import'](_0x11be('0xe4'));db[_0x11be('0xe5')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xe6'));db['MailTransferReport']=db[_0x11be('0x2')][_0x11be('0x11')]('../api/mailTransferReport/mailTransferReport.model');db[_0x11be('0xe7')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xe8'));db[_0x11be('0xe9')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/faxTransferReport/faxTransferReport.model');db[_0x11be('0xea')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xeb'));db['SmsTransferReport']=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xec'));db[_0x11be('0xed')]=db['sequelize'][_0x11be('0x11')](_0x11be('0xee'));db[_0x11be('0xef')]=db['sequelize'][_0x11be('0x11')](_0x11be('0xf0'));db[_0x11be('0xf1')]=db['sequelize'][_0x11be('0x11')]('../api/userProfile/userProfile.model');db[_0x11be('0xf2')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xf3'));db['UserProfileResource']=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xf4'));db[_0x11be('0xf5')]=db['sequelize'][_0x11be('0x11')](_0x11be('0xf6'));db['WhatsappAccount']=db['sequelize'][_0x11be('0x11')](_0x11be('0xf7'));db[_0x11be('0xf8')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xf9'));db['WhatsappInteraction']=db['sequelize'][_0x11be('0x11')](_0x11be('0xfa'));db[_0x11be('0xfb')]=db['sequelize'][_0x11be('0x11')](_0x11be('0xfc'));db[_0x11be('0xfd')]=db[_0x11be('0x2')][_0x11be('0x11')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x11be('0xfe')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0xff'));db['WhatsappQueue']=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x100'));db[_0x11be('0x101')]=db[_0x11be('0x2')]['import'](_0x11be('0x102'));db['TeamVoiceQueue']=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x103'));db[_0x11be('0x104')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x105'));db[_0x11be('0x106')]=db[_0x11be('0x2')][_0x11be('0x11')](_0x11be('0x107'));db[_0x11be('0x10')][_0x11be('0x108')](db[_0x11be('0x20')],{'as':'VoiceMail','onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x10a')});db[_0x11be('0x10')]['hasMany'](db[_0x11be('0x1c')],{'as':_0x11be('0x10b'),'foreignKey':_0x11be('0x10a')});db[_0x11be('0x10')][_0x11be('0x10c')](db[_0x11be('0x2e')],{'as':_0x11be('0x10d'),'foreignKey':_0x11be('0x10a')});db[_0x11be('0x10')][_0x11be('0x10c')](db[_0x11be('0x17')],{'as':_0x11be('0x10e'),'onDelete':_0x11be('0x109'),'hooks':!![]});db[_0x11be('0x10')][_0x11be('0x10c')](db[_0x11be('0x73')],{'as':_0x11be('0x10f'),'foreignKey':_0x11be('0x10a')});db[_0x11be('0x10')][_0x11be('0x10c')](db[_0x11be('0x74')],{'as':_0x11be('0x110'),'foreignKey':_0x11be('0x10a')});db[_0x11be('0x10')]['hasMany'](db[_0x11be('0x75')],{'as':_0x11be('0x75'),'foreignKey':_0x11be('0x10a')});db[_0x11be('0x10')]['hasMany'](db[_0x11be('0x5d')],{'as':_0x11be('0x111'),'foreignKey':'UserId'});db[_0x11be('0x10')][_0x11be('0x10c')](db[_0x11be('0x66')],{'as':_0x11be('0x112'),'foreignKey':_0x11be('0x10a')});db[_0x11be('0x10')][_0x11be('0x10c')](db[_0x11be('0x113')],{'as':_0x11be('0x114'),'foreignKey':_0x11be('0x10a')});db[_0x11be('0x10')]['hasMany'](db[_0x11be('0x115')],{'as':_0x11be('0x116'),'foreignKey':_0x11be('0x10a')});db[_0x11be('0x10')][_0x11be('0x10c')](db[_0x11be('0x42')],{'as':_0x11be('0x117'),'foreignKey':_0x11be('0x10a')});db['User'][_0x11be('0x10c')](db[_0x11be('0x118')],{'as':'WhatsappInteractions','foreignKey':_0x11be('0x10a')});db[_0x11be('0x10')][_0x11be('0x10c')](db[_0x11be('0xf5')],{'as':'UserNotifications','foreignKey':_0x11be('0x119')});db['User'][_0x11be('0x11a')](db['UserProfile'],{'as':_0x11be('0xf1'),'foreignKey':_0x11be('0x11b')});db['User'][_0x11be('0x11c')](db['ChatGroup'],{'as':_0x11be('0x11d'),'through':'chat_group_has_users'});db[_0x11be('0x10')][_0x11be('0x11c')](db['CmContact'],{'as':_0x11be('0x11e'),'through':_0x11be('0x11f')});db[_0x11be('0x10')][_0x11be('0x11c')](db['CmList'],{'as':_0x11be('0x120'),'through':'cm_user_has_lists'});db['User'][_0x11be('0x11c')](db[_0x11be('0xdd')],{'through':_0x11be('0x121')});db['User']['belongsToMany'](db[_0x11be('0x42')],{'as':_0x11be('0x117'),'through':'user_has_mail_interactions'});db[_0x11be('0x10')]['belongsToMany'](db[_0x11be('0x66')],{'as':_0x11be('0x112'),'through':_0x11be('0x122')});db[_0x11be('0x10')][_0x11be('0x11c')](db[_0x11be('0x115')],{'as':_0x11be('0x116'),'through':_0x11be('0x123')});db[_0x11be('0x10')][_0x11be('0x11c')](db['SmsInteraction'],{'as':_0x11be('0x114'),'through':_0x11be('0x124')});db['User'][_0x11be('0x11c')](db[_0x11be('0x5d')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db['User'][_0x11be('0x11c')](db[_0x11be('0x118')],{'as':_0x11be('0x125'),'through':'user_has_whatsapp_interactions'});db[_0x11be('0x10')]['belongsToMany'](db[_0x11be('0x1a')],{'as':_0x11be('0x126'),'through':_0x11be('0x127'),'required':![]});db[_0x11be('0x10')]['belongsToMany'](db[_0x11be('0xef')],{'as':_0x11be('0x128'),'through':_0x11be('0x106'),'required':![]});db['User'][_0x11be('0x11c')](db[_0x11be('0x3f')],{'as':_0x11be('0x129'),'through':_0x11be('0x32'),'required':![]});db['User'][_0x11be('0x11c')](db[_0x11be('0x69')],{'as':'ChatQueues','through':_0x11be('0x31'),'required':![],'hooks':!![]});db[_0x11be('0x10')][_0x11be('0x11c')](db['FaxQueue'],{'as':_0x11be('0x12a'),'through':_0x11be('0x34'),'required':![]});db[_0x11be('0x10')][_0x11be('0x11c')](db['SmsQueue'],{'as':_0x11be('0x12b'),'through':'UserSmsQueue','required':![]});db[_0x11be('0x10')][_0x11be('0x11c')](db[_0x11be('0x61')],{'as':_0x11be('0x12c'),'through':_0x11be('0x12d'),'required':![]});db[_0x11be('0x10')][_0x11be('0x11c')](db[_0x11be('0x12e')],{'as':_0x11be('0x12f'),'through':_0x11be('0x38'),'required':![]});db[_0x11be('0x10')]['belongsToMany'](db['CmList'],{'through':'cm_user_has_lists'});db[_0x11be('0x10')][_0x11be('0x11c')](db[_0x11be('0x62')],{'as':_0x11be('0x130'),'through':_0x11be('0x131')});db[_0x11be('0x10')][_0x11be('0x11c')](db[_0x11be('0x4b')],{'as':_0x11be('0x132'),'through':_0x11be('0x133')});db[_0x11be('0x10')][_0x11be('0x11c')](db['MailAccount'],{'as':_0x11be('0x134'),'through':_0x11be('0x135')});db['User']['belongsToMany'](db[_0x11be('0x5a')],{'as':'OpenchannelAccounts','through':_0x11be('0x136')});db[_0x11be('0x10')][_0x11be('0x11c')](db[_0x11be('0x53')],{'as':_0x11be('0x137'),'through':_0x11be('0x138')});db['User']['belongsToMany'](db[_0x11be('0x139')],{'as':_0x11be('0x13a'),'through':_0x11be('0x13b')});db[_0x11be('0x10')]['belongsToMany'](db['SquareProject'],{'as':_0x11be('0x13c'),'through':'user_has_square_projects'});db[_0x11be('0x13')]['hasMany'](db[_0x11be('0x17')],{'as':'SpiedAgents','onDelete':_0x11be('0x109'),'foreignKey':'ChanSpyId'});db[_0x11be('0x15')][_0x11be('0x10c')](db[_0x11be('0x17')],{'onDelete':_0x11be('0x109')});db[_0x11be('0x17')][_0x11be('0x10c')](db[_0x11be('0x17')],{'as':_0x11be('0x13d'),'onDelete':_0x11be('0x109')});db[_0x11be('0x19')][_0x11be('0x11c')](db['Sound'],{'as':_0x11be('0x13e'),'through':'moh_has_sounds'});db[_0x11be('0x1a')][_0x11be('0x10c')](db[_0x11be('0x2e')],{'as':_0x11be('0x13f'),'foreignKey':_0x11be('0x140')});db['VoiceQueue'][_0x11be('0x10c')](db['CmHopper'],{'as':_0x11be('0x141'),'foreignKey':_0x11be('0x140')});db[_0x11be('0x1a')][_0x11be('0x10c')](db[_0x11be('0x73')],{'as':_0x11be('0x10f'),'foreignKey':_0x11be('0x140')});db[_0x11be('0x1a')][_0x11be('0x10c')](db[_0x11be('0x74')],{'as':_0x11be('0x142'),'foreignKey':_0x11be('0x140')});db[_0x11be('0x1a')][_0x11be('0x10c')](db['ReportAgentPreview'],{'as':_0x11be('0x75'),'foreignKey':_0x11be('0x140')});db[_0x11be('0x1a')][_0x11be('0x10c')](db['CmHopperBlack'],{'as':_0x11be('0x143'),'foreignKey':_0x11be('0x140')});db[_0x11be('0x1a')]['hasMany'](db['JscriptySessionReport'],{'as':_0x11be('0x144'),'foreignKey':_0x11be('0x140')});db[_0x11be('0x1a')][_0x11be('0x11a')](db[_0x11be('0x2a')],{'as':_0x11be('0x2a'),'foreignKey':_0x11be('0x145')});db[_0x11be('0x1a')]['belongsTo'](db[_0x11be('0x2a')],{'as':'TrunkBackup','foreignKey':_0x11be('0x146')});db[_0x11be('0x1a')][_0x11be('0x11a')](db['Interval'],{'as':'Interval','foreignKey':_0x11be('0x147')});db[_0x11be('0x1a')][_0x11be('0x11a')](db[_0x11be('0x81')],{'as':_0x11be('0x148'),'foreignKey':_0x11be('0x149')});db[_0x11be('0x1a')][_0x11be('0x11c')](db[_0x11be('0xed')],{'as':'Lists','through':_0x11be('0x14a')});db[_0x11be('0x1a')]['belongsToMany'](db['User'],{'as':_0x11be('0x14b'),'through':_0x11be('0x127')});db[_0x11be('0x1a')]['belongsToMany'](db[_0x11be('0xdd')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0x11be('0x1a')][_0x11be('0x11c')](db['CmList'],{'as':_0x11be('0x14c'),'through':_0x11be('0x14d')});db[_0x11be('0x1c')][_0x11be('0x11a')](db[_0x11be('0x10')],{'as':_0x11be('0x10'),'foreignKey':'UserId'});db['ScreenRecording'][_0x11be('0x11a')](db['User'],{'as':_0x11be('0x10'),'foreignKey':_0x11be('0x10a')});db[_0x11be('0x20')][_0x11be('0x10c')](db[_0x11be('0x21')],{'as':_0x11be('0x14e'),'onDelete':_0x11be('0x109'),'foreignKey':'mailboxuser','sourceKey':_0x11be('0x14f')});db[_0x11be('0x21')]['belongsTo'](db[_0x11be('0x20')],{'foreignKey':_0x11be('0x150'),'targetKey':_0x11be('0x14f')});db[_0x11be('0x22')][_0x11be('0x10c')](db[_0x11be('0x27')],{'as':_0x11be('0x151'),'foreignKey':_0x11be('0x152'),'constraints':![]});db[_0x11be('0x22')][_0x11be('0x10c')](db[_0x11be('0x25')],{'as':_0x11be('0x153'),'foreignKey':_0x11be('0x152'),'constraints':![]});db[_0x11be('0x22')][_0x11be('0x11a')](db[_0x11be('0x10')],{'as':'User','foreignKey':_0x11be('0x10a')});db[_0x11be('0x22')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x11be('0x154')});db['MailServerIn']['belongsTo'](db[_0x11be('0x3d')],{'as':_0x11be('0x3d'),'foreignKey':_0x11be('0x155')});db['MailServerOut'][_0x11be('0x11a')](db[_0x11be('0x3d')],{'as':'MailAccount','foreignKey':_0x11be('0x155')});db[_0x11be('0x3d')][_0x11be('0x108')](db[_0x11be('0x3a')],{'as':_0x11be('0x156'),'onDelete':_0x11be('0x109')});db[_0x11be('0x3d')]['hasOne'](db[_0x11be('0x3b')],{'as':_0x11be('0x157'),'onDelete':_0x11be('0x109')});db['MailAccount'][_0x11be('0x10c')](db[_0x11be('0x7c')],{'as':'Dispositions','foreignKey':'MailAccountId','onDelete':_0x11be('0x109')});db['MailAccount']['hasMany'](db[_0x11be('0x7b')],{'as':_0x11be('0x158'),'foreignKey':_0x11be('0x155')});db['MailAccount']['hasMany'](db[_0x11be('0x43')],{'as':_0x11be('0x14e'),'foreignKey':_0x11be('0x155')});db[_0x11be('0x3d')][_0x11be('0x10c')](db[_0x11be('0x42')],{'as':_0x11be('0x159')});db[_0x11be('0x3d')][_0x11be('0x10c')](db[_0x11be('0x45')],{'as':_0x11be('0x13d')});db[_0x11be('0x3d')]['belongsTo'](db['CmList'],{'as':_0x11be('0x15a'),'foreignKey':_0x11be('0x15b')});db[_0x11be('0x3d')]['belongsTo'](db[_0x11be('0x8a')],{'as':_0x11be('0x8a'),'foreignKey':_0x11be('0x15c')});db[_0x11be('0x3d')]['belongsTo'](db[_0x11be('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0x11be('0x149')});db['MailAccount'][_0x11be('0x11c')](db['User'],{'as':_0x11be('0x14b'),'through':_0x11be('0x135')});db[_0x11be('0x3f')][_0x11be('0x11c')](db['User'],{'as':_0x11be('0x14b'),'through':_0x11be('0x32')});db['MailQueue'][_0x11be('0x11c')](db[_0x11be('0xdd')],{'through':_0x11be('0x15d'),'as':_0x11be('0x15e')});db[_0x11be('0x42')][_0x11be('0x10c')](db[_0x11be('0x43')],{'as':_0x11be('0x14e'),'onDelete':_0x11be('0x109'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0x11be('0x11a')](db[_0x11be('0x3d')],{'as':_0x11be('0x15f'),'foreignKey':_0x11be('0x155')});db[_0x11be('0x42')][_0x11be('0x11a')](db[_0x11be('0x6e')],{'as':_0x11be('0x160'),'foreignKey':_0x11be('0x154')});db[_0x11be('0x42')][_0x11be('0x11a')](db[_0x11be('0x10')],{'as':_0x11be('0x161'),'foreignKey':_0x11be('0x10a')});db['MailInteraction'][_0x11be('0x11c')](db['Tag'],{'through':_0x11be('0x162'),'as':_0x11be('0x163')});db['MailInteraction']['belongsToMany'](db[_0x11be('0x164')],{'through':_0x11be('0x162'),'as':_0x11be('0x165')});db['MailInteraction'][_0x11be('0x11c')](db[_0x11be('0x10')],{'as':_0x11be('0x166'),'through':_0x11be('0x167'),'foreignKey':_0x11be('0x168')});db['MailMessage']['hasMany'](db['Attachment'],{'as':_0x11be('0x169'),'onDelete':_0x11be('0x109')});db[_0x11be('0x43')][_0x11be('0x11a')](db[_0x11be('0x10')],{'as':'User'});db[_0x11be('0x43')]['belongsTo'](db[_0x11be('0x6e')],{'onDelete':'cascade','as':_0x11be('0x160')});db[_0x11be('0x43')][_0x11be('0x11a')](db[_0x11be('0x42')],{'as':_0x11be('0x16a'),'foreignKey':_0x11be('0x168')});db[_0x11be('0x43')][_0x11be('0x11a')](db['MailAccount'],{'as':_0x11be('0x15f'),'foreignKey':'MailAccountId'});db['MailMessage']['belongsTo'](db[_0x11be('0x62')],{'as':_0x11be('0x62'),'foreignKey':_0x11be('0x16b')});db[_0x11be('0x43')][_0x11be('0x11a')](db[_0x11be('0x16c')],{'as':_0x11be('0x16c'),'foreignKey':_0x11be('0x16d')});db[_0x11be('0x45')][_0x11be('0x11a')](db[_0x11be('0x10')],{'onDelete':_0x11be('0x16e')});db[_0x11be('0x45')][_0x11be('0x11a')](db[_0x11be('0x3f')],{'onDelete':_0x11be('0x16e')});db['MailApplication'][_0x11be('0x11a')](db['MailAccount'],{'onDelete':_0x11be('0x16e')});db[_0x11be('0x45')][_0x11be('0x11a')](db[_0x11be('0x80')],{'onDelete':_0x11be('0x16e'),'foreignKey':_0x11be('0x147')});db['MailApplication'][_0x11be('0x11a')](db[_0x11be('0x164')],{'onDelete':'restrict','foreignKey':_0x11be('0x16f')});db[_0x11be('0x46')][_0x11be('0x11a')](db[_0x11be('0x3d')],{});db[_0x11be('0x46')][_0x11be('0x11a')](db[_0x11be('0xed')],{'as':_0x11be('0x15a'),'foreignKey':'ListId'});db[_0x11be('0x46')]['belongsTo'](db[_0x11be('0x6e')],{'as':_0x11be('0x160'),'foreignKey':_0x11be('0x154')});db[_0x11be('0x46')][_0x11be('0x11a')](db[_0x11be('0x42')],{});db[_0x11be('0x46')][_0x11be('0x11a')](db[_0x11be('0x43')],{});db[_0x11be('0x46')][_0x11be('0x11a')](db['User'],{});db[_0x11be('0x46')][_0x11be('0x11a')](db[_0x11be('0x3f')],{});db['Dashboard'][_0x11be('0x10c')](db[_0x11be('0x49')],{'as':'Items','onDelete':_0x11be('0x109')});db['FaxAccount'][_0x11be('0x10c')](db[_0x11be('0x7c')],{'as':_0x11be('0x170'),'foreignKey':_0x11be('0x171'),'onDelete':_0x11be('0x109')});db['FaxAccount'][_0x11be('0x10c')](db[_0x11be('0x7b')],{'as':_0x11be('0x158'),'foreignKey':_0x11be('0x171')});db[_0x11be('0x4b')][_0x11be('0x10c')](db[_0x11be('0x115')],{'as':_0x11be('0x159')});db[_0x11be('0x4b')][_0x11be('0x10c')](db[_0x11be('0x4d')],{'as':_0x11be('0x13d')});db[_0x11be('0x4b')]['hasMany'](db[_0x11be('0x17')],{'as':_0x11be('0x172'),'onDelete':'cascade'});db['FaxAccount'][_0x11be('0x10c')](db[_0x11be('0x4e')],{'as':_0x11be('0x14e')});db[_0x11be('0x4b')][_0x11be('0x11a')](db[_0x11be('0x2a')],{'as':_0x11be('0x2a')});db[_0x11be('0x4b')][_0x11be('0x11a')](db['CmList'],{'as':_0x11be('0x15a'),'foreignKey':'ListId'});db[_0x11be('0x4b')]['belongsTo'](db['Pause'],{'as':_0x11be('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x11be('0x4b')][_0x11be('0x11c')](db['User'],{'as':'Agents','through':_0x11be('0x133')});db[_0x11be('0x4d')][_0x11be('0x11a')](db['User'],{'onDelete':_0x11be('0x16e')});db[_0x11be('0x4d')][_0x11be('0x11a')](db[_0x11be('0x50')],{'onDelete':_0x11be('0x16e')});db[_0x11be('0x4d')]['belongsTo'](db[_0x11be('0x4b')],{'onDelete':_0x11be('0x16e')});db['FaxApplication'][_0x11be('0x11a')](db[_0x11be('0x164')],{'onDelete':_0x11be('0x16e'),'foreignKey':'TagId'});db[_0x11be('0x115')][_0x11be('0x10c')](db['FaxMessage'],{'as':_0x11be('0x14e'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db[_0x11be('0x115')][_0x11be('0x11a')](db['FaxAccount'],{'as':_0x11be('0x15f'),'foreignKey':'FaxAccountId'});db[_0x11be('0x115')][_0x11be('0x11a')](db[_0x11be('0x6e')],{'as':_0x11be('0x160'),'foreignKey':'ContactId'});db[_0x11be('0x115')]['belongsTo'](db[_0x11be('0x10')],{'as':_0x11be('0x161'),'foreignKey':'UserId'});db[_0x11be('0x115')][_0x11be('0x11c')](db[_0x11be('0x164')],{'through':_0x11be('0x173'),'as':'Tags'});db[_0x11be('0x115')][_0x11be('0x11c')](db['Tag'],{'through':_0x11be('0x173'),'as':_0x11be('0x165')});db[_0x11be('0x115')][_0x11be('0x11c')](db[_0x11be('0x10')],{'as':_0x11be('0x166'),'through':_0x11be('0x123'),'foreignKey':_0x11be('0x174')});db[_0x11be('0x4e')][_0x11be('0x11a')](db['User'],{'onDelete':_0x11be('0x109'),'as':_0x11be('0x10')});db[_0x11be('0x4e')][_0x11be('0x11a')](db[_0x11be('0x115')],{'as':_0x11be('0x16a'),'foreignKey':_0x11be('0x174')});db[_0x11be('0x4e')][_0x11be('0x11a')](db['CmContact'],{'onDelete':_0x11be('0x109'),'as':_0x11be('0x160')});db[_0x11be('0x4e')]['belongsTo'](db[_0x11be('0x175')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x11be('0x4e')][_0x11be('0x11a')](db['FaxAccount'],{'as':_0x11be('0x15f'),'foreignKey':'FaxAccountId'});db[_0x11be('0x50')][_0x11be('0x11c')](db[_0x11be('0x10')],{'as':_0x11be('0x14b'),'through':_0x11be('0x34')});db[_0x11be('0x50')][_0x11be('0x11c')](db['Team'],{'through':_0x11be('0x176'),'as':'Teams'});db[_0x11be('0x52')][_0x11be('0x11a')](db[_0x11be('0x4b')],{});db[_0x11be('0x52')][_0x11be('0x11a')](db[_0x11be('0xed')],{'as':_0x11be('0x15a'),'foreignKey':_0x11be('0x15b')});db[_0x11be('0x52')][_0x11be('0x11a')](db[_0x11be('0x6e')],{'as':_0x11be('0x160'),'foreignKey':'ContactId'});db[_0x11be('0x52')][_0x11be('0x11a')](db[_0x11be('0x115')],{});db[_0x11be('0x52')]['belongsTo'](db[_0x11be('0x4e')],{});db[_0x11be('0x52')][_0x11be('0x11a')](db[_0x11be('0x10')],{});db[_0x11be('0x52')][_0x11be('0x11a')](db[_0x11be('0x50')],{});db[_0x11be('0x53')]['hasMany'](db[_0x11be('0x7c')],{'as':_0x11be('0x170'),'foreignKey':_0x11be('0x177'),'onDelete':_0x11be('0x109')});db[_0x11be('0x53')][_0x11be('0x10c')](db[_0x11be('0x7b')],{'as':'Answers','foreignKey':_0x11be('0x177')});db[_0x11be('0x53')][_0x11be('0x10c')](db['SmsMessage'],{'as':_0x11be('0x14e'),'foreignKey':_0x11be('0x177')});db['SmsAccount'][_0x11be('0x10c')](db['SmsInteraction'],{'as':_0x11be('0x159')});db['SmsAccount'][_0x11be('0x10c')](db['SmsApplication'],{'as':'Applications'});db[_0x11be('0x53')][_0x11be('0x11a')](db[_0x11be('0xed')],{'as':_0x11be('0x15a'),'foreignKey':_0x11be('0x15b')});db['SmsAccount'][_0x11be('0x11a')](db[_0x11be('0x81')],{'as':_0x11be('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount'][_0x11be('0x11c')](db['User'],{'as':'Agents','through':'user_has_sms_accounts'});db['SmsApplication'][_0x11be('0x11a')](db[_0x11be('0x10')],{'onDelete':_0x11be('0x16e')});db['SmsApplication'][_0x11be('0x11a')](db['SmsQueue'],{'onDelete':_0x11be('0x16e')});db[_0x11be('0x178')]['belongsTo'](db[_0x11be('0x53')],{'onDelete':_0x11be('0x16e')});db[_0x11be('0x178')][_0x11be('0x11a')](db[_0x11be('0x80')],{'onDelete':_0x11be('0x16e'),'foreignKey':_0x11be('0x147')});db[_0x11be('0x178')][_0x11be('0x11a')](db[_0x11be('0x164')],{'onDelete':'restrict','foreignKey':_0x11be('0x16f')});db[_0x11be('0x113')][_0x11be('0x10c')](db['SmsMessage'],{'as':_0x11be('0x14e'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x179')});db[_0x11be('0x113')][_0x11be('0x11a')](db[_0x11be('0x53')],{'as':_0x11be('0x15f'),'foreignKey':_0x11be('0x177')});db[_0x11be('0x113')]['belongsTo'](db[_0x11be('0x6e')],{'as':_0x11be('0x160'),'foreignKey':_0x11be('0x154')});db[_0x11be('0x113')][_0x11be('0x11a')](db[_0x11be('0x10')],{'as':'Owner','foreignKey':_0x11be('0x10a')});db[_0x11be('0x113')][_0x11be('0x11c')](db[_0x11be('0x164')],{'through':_0x11be('0x17a'),'as':_0x11be('0x163')});db[_0x11be('0x113')][_0x11be('0x11c')](db[_0x11be('0x164')],{'through':_0x11be('0x17a'),'as':_0x11be('0x165')});db[_0x11be('0x113')][_0x11be('0x11c')](db[_0x11be('0x10')],{'as':'Users','through':'user_has_sms_interactions','foreignKey':_0x11be('0x179')});db[_0x11be('0x56')][_0x11be('0x11a')](db[_0x11be('0x10')],{'as':'User'});db['SmsMessage'][_0x11be('0x11a')](db[_0x11be('0x6e')],{'onDelete':_0x11be('0x109'),'as':_0x11be('0x160')});db[_0x11be('0x56')][_0x11be('0x11a')](db['SmsInteraction'],{'onDelete':_0x11be('0x109'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0x11be('0x56')][_0x11be('0x11a')](db[_0x11be('0x53')],{'as':'Account','foreignKey':_0x11be('0x177')});db['SmsQueue'][_0x11be('0x11c')](db['User'],{'as':_0x11be('0x14b'),'through':_0x11be('0x36'),'foreignKey':'SmsQueueId'});db['SmsQueue']['belongsToMany'](db['Team'],{'through':'team_has_sms_queues','as':_0x11be('0x15e')});db[_0x11be('0x5a')][_0x11be('0x10c')](db['Disposition'],{'as':_0x11be('0x170'),'foreignKey':_0x11be('0x17b'),'onDelete':_0x11be('0x109')});db[_0x11be('0x5a')]['hasMany'](db[_0x11be('0x7b')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x11be('0x10c')](db[_0x11be('0x5d')],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0x11be('0x5a')]['hasMany'](db['OpenchannelMessage'],{'as':_0x11be('0x14e'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0x11be('0x5c')],{'as':'Applications','foreignKey':_0x11be('0x17b')});db[_0x11be('0x5a')][_0x11be('0x11a')](db['CmList'],{'as':_0x11be('0x15a'),'foreignKey':_0x11be('0x15b')});db['OpenchannelAccount']['belongsTo'](db[_0x11be('0x81')],{'as':_0x11be('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x11be('0x5a')][_0x11be('0x11c')](db[_0x11be('0x10')],{'as':_0x11be('0x14b'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x11be('0x11a')](db[_0x11be('0x10')],{'onDelete':_0x11be('0x16e')});db['OpenchannelApplication'][_0x11be('0x11a')](db['OpenchannelQueue'],{'onDelete':_0x11be('0x16e'),'foreignKey':_0x11be('0x17c')});db[_0x11be('0x5c')][_0x11be('0x11a')](db[_0x11be('0x5a')],{'onDelete':_0x11be('0x16e'),'foreignKey':_0x11be('0x17b')});db[_0x11be('0x5c')][_0x11be('0x11a')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x11be('0x147')});db['OpenchannelApplication']['belongsTo'](db[_0x11be('0x164')],{'onDelete':_0x11be('0x16e'),'foreignKey':_0x11be('0x16f')});db[_0x11be('0x5d')][_0x11be('0x10c')](db[_0x11be('0x5f')],{'as':_0x11be('0x14e'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x17d')});db[_0x11be('0x5d')][_0x11be('0x11a')](db[_0x11be('0x5a')],{'as':_0x11be('0x15f'),'foreignKey':_0x11be('0x17b')});db[_0x11be('0x5d')][_0x11be('0x11a')](db['CmContact'],{'as':_0x11be('0x160'),'foreignKey':_0x11be('0x154')});db['OpenchannelInteraction'][_0x11be('0x11a')](db['User'],{'as':_0x11be('0x161'),'foreignKey':_0x11be('0x10a')});db[_0x11be('0x5d')]['belongsToMany'](db[_0x11be('0x164')],{'through':'openchannel_interaction_has_tags','as':_0x11be('0x163')});db[_0x11be('0x5d')]['belongsToMany'](db[_0x11be('0x164')],{'through':_0x11be('0x17e'),'as':_0x11be('0x165')});db[_0x11be('0x5d')][_0x11be('0x11c')](db[_0x11be('0x10')],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':_0x11be('0x17d')});db[_0x11be('0x5f')]['belongsTo'](db[_0x11be('0x10')],{'onDelete':_0x11be('0x109'),'as':_0x11be('0x10')});db[_0x11be('0x5f')][_0x11be('0x11a')](db[_0x11be('0x6e')],{'onDelete':_0x11be('0x109'),'as':_0x11be('0x160')});db['OpenchannelMessage'][_0x11be('0x11a')](db[_0x11be('0x5d')],{'onDelete':_0x11be('0x109'),'as':_0x11be('0x16a'),'foreignKey':_0x11be('0x17d')});db[_0x11be('0x5f')]['belongsTo'](db[_0x11be('0x175')],{'as':_0x11be('0x175'),'foreignKey':_0x11be('0x17f')});db[_0x11be('0x5f')][_0x11be('0x11a')](db[_0x11be('0x5a')],{'as':_0x11be('0x15f'),'foreignKey':_0x11be('0x17b')});db[_0x11be('0x61')][_0x11be('0x11c')](db[_0x11be('0x10')],{'as':_0x11be('0x14b'),'through':_0x11be('0x12d'),'foreignKey':_0x11be('0x17c')});db[_0x11be('0x61')][_0x11be('0x11c')](db[_0x11be('0xdd')],{'through':_0x11be('0x180'),'as':_0x11be('0x15e')});db['ChatWebsite'][_0x11be('0x10c')](db[_0x11be('0x7c')],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':_0x11be('0x109')});db[_0x11be('0x62')][_0x11be('0x10c')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x11be('0x16b')});db[_0x11be('0x62')]['hasMany'](db[_0x11be('0x6c')],{'as':_0x11be('0x181')});db[_0x11be('0x62')][_0x11be('0x10c')](db[_0x11be('0x66')],{'as':_0x11be('0x159')});db['ChatWebsite'][_0x11be('0x10c')](db['ChatApplication'],{'as':_0x11be('0x13d')});db['ChatWebsite'][_0x11be('0x10c')](db['ChatMessage'],{'as':_0x11be('0x14e')});db['ChatWebsite'][_0x11be('0x11a')](db['CmList'],{'as':_0x11be('0x15a'),'foreignKey':_0x11be('0x15b')});db[_0x11be('0x62')]['belongsTo'](db[_0x11be('0x80')],{'as':_0x11be('0x80'),'foreignKey':_0x11be('0x147')});db[_0x11be('0x62')][_0x11be('0x11a')](db[_0x11be('0x3d')],{'as':_0x11be('0x3d'),'foreignKey':_0x11be('0x155')});db[_0x11be('0x62')][_0x11be('0x11a')](db[_0x11be('0x81')],{'as':_0x11be('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x11be('0x62')]['belongsToMany'](db['User'],{'as':_0x11be('0x14b'),'through':_0x11be('0x131')});db[_0x11be('0x182')][_0x11be('0x11a')](db[_0x11be('0x5a')],{});db[_0x11be('0x182')][_0x11be('0x11a')](db[_0x11be('0xed')],{'as':'List','foreignKey':_0x11be('0x15b')});db[_0x11be('0x182')][_0x11be('0x11a')](db['CmContact'],{'as':'Contact','foreignKey':_0x11be('0x154')});db['OpenchannelQueueReport'][_0x11be('0x11a')](db[_0x11be('0x5d')],{});db[_0x11be('0x182')]['belongsTo'](db[_0x11be('0x5f')],{});db[_0x11be('0x182')][_0x11be('0x11a')](db[_0x11be('0x10')],{});db[_0x11be('0x182')][_0x11be('0x11a')](db['OpenchannelQueue'],{});db[_0x11be('0x65')][_0x11be('0x11a')](db[_0x11be('0x10')],{'as':_0x11be('0x183'),'foreignKey':'UserId','onDelete':_0x11be('0x16e')});db[_0x11be('0x65')][_0x11be('0x11a')](db[_0x11be('0x69')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x11be('0x16e')});db[_0x11be('0x65')][_0x11be('0x11a')](db['ChatWebsite'],{'as':_0x11be('0x184'),'foreignKey':'ChatWebsiteId','onDelete':_0x11be('0x16e')});db[_0x11be('0x65')]['belongsTo'](db[_0x11be('0x164')],{'onDelete':_0x11be('0x16e'),'foreignKey':_0x11be('0x16f')});db[_0x11be('0x66')][_0x11be('0x10c')](db['ChatMessage'],{'as':_0x11be('0x14e'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x185')});db['ChatInteraction'][_0x11be('0x11a')](db[_0x11be('0x62')],{'as':_0x11be('0x15f'),'foreignKey':_0x11be('0x16b')});db[_0x11be('0x66')]['belongsTo'](db[_0x11be('0x6e')],{'as':_0x11be('0x160'),'foreignKey':_0x11be('0x154')});db[_0x11be('0x66')][_0x11be('0x11a')](db[_0x11be('0x10')],{'as':_0x11be('0x161'),'foreignKey':'UserId'});db['ChatInteraction']['belongsToMany'](db[_0x11be('0x164')],{'through':_0x11be('0x186'),'as':_0x11be('0x163')});db[_0x11be('0x66')][_0x11be('0x11c')](db[_0x11be('0x164')],{'through':_0x11be('0x186'),'as':_0x11be('0x165')});db[_0x11be('0x66')][_0x11be('0x11c')](db[_0x11be('0x10')],{'as':'Users','through':_0x11be('0x122'),'foreignKey':_0x11be('0x185')});db[_0x11be('0x67')][_0x11be('0x11a')](db[_0x11be('0x10')],{'onDelete':'cascade','as':_0x11be('0x10')});db[_0x11be('0x67')]['belongsTo'](db[_0x11be('0x6e')],{'onDelete':_0x11be('0x109'),'as':_0x11be('0x160'),'foreignKey':'ContactId'});db[_0x11be('0x67')][_0x11be('0x11a')](db['ChatInteraction'],{'onDelete':_0x11be('0x109'),'as':'Interaction','foreignKey':_0x11be('0x185')});db['ChatMessage'][_0x11be('0x11a')](db[_0x11be('0x175')],{'as':_0x11be('0x175'),'foreignKey':_0x11be('0x17f')});db['ChatMessage'][_0x11be('0x11a')](db['ChatWebsite'],{'as':_0x11be('0x15f'),'foreignKey':_0x11be('0x16b')});db[_0x11be('0x16c')]['hasMany'](db[_0x11be('0x175')],{'as':_0x11be('0x169'),'foreignKey':_0x11be('0x16d'),'onDelete':_0x11be('0x109'),'hooks':!![]});db[_0x11be('0x16c')][_0x11be('0x11a')](db[_0x11be('0x6e')],{'onDelete':_0x11be('0x109'),'as':_0x11be('0x160'),'foreignKey':_0x11be('0x154')});db[_0x11be('0x16c')][_0x11be('0x11a')](db['ChatWebsite'],{'as':_0x11be('0x15f'),'foreignKey':_0x11be('0x16b')});db[_0x11be('0x69')][_0x11be('0x11c')](db[_0x11be('0x10')],{'as':'Agents','through':_0x11be('0x31'),'hooks':!![]});db[_0x11be('0x69')]['belongsToMany'](db[_0x11be('0xdd')],{'through':_0x11be('0x187'),'as':_0x11be('0x15e')});db[_0x11be('0x6b')][_0x11be('0x10c')](db[_0x11be('0xcb')],{'as':_0x11be('0x14e'),'foreignKey':_0x11be('0x188'),'onDelete':'cascade'});db['ChatGroup'][_0x11be('0x11c')](db[_0x11be('0x10')],{'as':_0x11be('0x13f'),'through':'chat_group_has_users'});db[_0x11be('0x6c')][_0x11be('0x11a')](db[_0x11be('0x62')],{'as':_0x11be('0x184'),'foreignKey':_0x11be('0x16b')});db[_0x11be('0x189')]['hasMany'](db[_0x11be('0x6e')],{'as':_0x11be('0x11e'),'foreignKey':_0x11be('0x18a')});db['CmContact']['hasMany'](db[_0x11be('0x18b')],{'as':_0x11be('0x141'),'foreignKey':_0x11be('0x154')});db[_0x11be('0x6e')][_0x11be('0x10c')](db[_0x11be('0x73')],{'as':_0x11be('0x10f'),'foreignKey':_0x11be('0x154')});db[_0x11be('0x6e')][_0x11be('0x10c')](db[_0x11be('0x74')],{'as':_0x11be('0x142'),'foreignKey':_0x11be('0x154')});db[_0x11be('0x6e')][_0x11be('0x10c')](db[_0x11be('0x75')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0x11be('0x6e')]['hasMany'](db[_0x11be('0xd1')],{'as':'JscriptySessions','foreignKey':_0x11be('0x154')});db[_0x11be('0x6e')][_0x11be('0x10c')](db['OpenchannelInteraction'],{'as':_0x11be('0x111'),'foreignKey':_0x11be('0x154'),'onDelete':'restrict'});db['CmContact'][_0x11be('0x10c')](db[_0x11be('0x66')],{'as':'ChatInteractions','foreignKey':_0x11be('0x154'),'onDelete':'restrict'});db[_0x11be('0x6e')][_0x11be('0x10c')](db[_0x11be('0x113')],{'as':_0x11be('0x114'),'foreignKey':_0x11be('0x154'),'onDelete':'restrict'});db[_0x11be('0x6e')][_0x11be('0x10c')](db['FaxInteraction'],{'as':_0x11be('0x116'),'foreignKey':'ContactId','onDelete':_0x11be('0x16e')});db['CmContact'][_0x11be('0x10c')](db[_0x11be('0x42')],{'as':'MailInteractions','foreignKey':_0x11be('0x154'),'onDelete':_0x11be('0x16e')});db[_0x11be('0x6e')]['belongsTo'](db[_0x11be('0x189')],{'as':_0x11be('0x18c'),'foreignKey':_0x11be('0x18a')});db[_0x11be('0x6e')][_0x11be('0x11a')](db[_0x11be('0xed')],{'as':_0x11be('0x15a'),'foreignKey':_0x11be('0x15b'),'onDelete':'cascade'});db['CmContact'][_0x11be('0x11c')](db[_0x11be('0x10')],{'as':_0x11be('0x166'),'through':'cm_user_has_contacts'});db[_0x11be('0x6e')][_0x11be('0x11c')](db[_0x11be('0x164')],{'as':'Tags','through':_0x11be('0x18d')});db[_0x11be('0x6e')][_0x11be('0x11c')](db[_0x11be('0x164')],{'through':_0x11be('0x18d'),'as':'ThroughTags'});db[_0x11be('0x18b')][_0x11be('0x11a')](db[_0x11be('0x6e')],{'as':_0x11be('0x160'),'foreignKey':_0x11be('0x154'),'onDelete':_0x11be('0x109')});db['CmHopper'][_0x11be('0x11a')](db[_0x11be('0xed')],{'as':'List','foreignKey':_0x11be('0x15b'),'onDelete':_0x11be('0x109')});db[_0x11be('0x18b')]['belongsTo'](db[_0x11be('0x10')],{'as':_0x11be('0x183'),'foreignKey':_0x11be('0x10a')});db[_0x11be('0x18b')][_0x11be('0x11a')](db[_0x11be('0x1a')],{'as':_0x11be('0x18e'),'foreignKey':_0x11be('0x140'),'onDelete':_0x11be('0x109')});db['CmHopper'][_0x11be('0x11a')](db[_0x11be('0xe0')],{'as':_0x11be('0xe0'),'foreignKey':_0x11be('0x18f'),'onDelete':'cascade'});db[_0x11be('0x18b')]['belongsTo'](db[_0x11be('0x10')],{'as':_0x11be('0x161'),'foreignKey':_0x11be('0x190')});db[_0x11be('0x71')][_0x11be('0x11a')](db[_0x11be('0x6e')],{'as':_0x11be('0x160'),'foreignKey':_0x11be('0x154'),'onDelete':'cascade'});db[_0x11be('0x71')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x11be('0x15b'),'onDelete':'cascade'});db[_0x11be('0x71')][_0x11be('0x11a')](db[_0x11be('0x1a')],{'as':_0x11be('0x18e'),'foreignKey':_0x11be('0x140'),'onDelete':'cascade'});db[_0x11be('0x71')][_0x11be('0x11a')](db[_0x11be('0xe0')],{'as':_0x11be('0xe0'),'foreignKey':_0x11be('0x18f'),'onDelete':'cascade'});db['Automation']['hasMany'](db[_0x11be('0x7e')],{'as':{'plural':_0x11be('0x191'),'singular':_0x11be('0x192')},'foreignKey':_0x11be('0x193'),'onDelete':_0x11be('0x109'),'hooks':!![]});db[_0x11be('0x79')][_0x11be('0x10c')](db['Condition'],{'as':{'plural':_0x11be('0x194'),'singular':_0x11be('0x195')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x11be('0x79')][_0x11be('0x10c')](db['Action'],{'as':_0x11be('0x196'),'foreignKey':_0x11be('0x197'),'onDelete':_0x11be('0x109'),'hooks':!![]});db[_0x11be('0x7c')][_0x11be('0x10c')](db[_0x11be('0x7c')],{'as':_0x11be('0x170'),'foreignKey':'ParentId','onDelete':_0x11be('0x109')});db[_0x11be('0x80')][_0x11be('0x10c')](db[_0x11be('0x80')],{'as':_0x11be('0x198'),'foreignKey':_0x11be('0x147'),'onDelete':_0x11be('0x109'),'hooks':!![],'required':![]});db['Interval'][_0x11be('0x10c')](db['VoiceExtension'],{'as':_0x11be('0x10e'),'foreignKey':_0x11be('0x147'),'onDelete':_0x11be('0x16e')});db[_0x11be('0x80')][_0x11be('0x10c')](db[_0x11be('0x45')],{'as':_0x11be('0x199'),'foreignKey':'IntervalId'});db['Interval'][_0x11be('0x10c')](db[_0x11be('0x65')],{'as':_0x11be('0x19a'),'foreignKey':_0x11be('0x147')});db[_0x11be('0x80')][_0x11be('0x10c')](db[_0x11be('0x4d')],{'as':_0x11be('0x19b'),'foreignKey':_0x11be('0x147')});db[_0x11be('0x80')]['hasMany'](db[_0x11be('0x178')],{'as':_0x11be('0x19c'),'foreignKey':_0x11be('0x147')});db[_0x11be('0x86')][_0x11be('0x11a')](db['MailAccount'],{});db[_0x11be('0x86')][_0x11be('0x11a')](db[_0x11be('0x94')],{'foreignKey':_0x11be('0x19d')});db[_0x11be('0x86')][_0x11be('0x11a')](db[_0x11be('0x92')],{'foreignKey':_0x11be('0x19e')});db[_0x11be('0x88')][_0x11be('0x11c')](db['VoiceMusicOnHold'],{'as':_0x11be('0x19f'),'through':_0x11be('0x1a0'),'onDelete':_0x11be('0x16e')});db[_0x11be('0x164')]['belongsToMany'](db['CmContact'],{'through':_0x11be('0x18d')});db['Tag']['belongsToMany'](db[_0x11be('0x66')],{'through':'chat_interaction_has_tags'});db[_0x11be('0x164')][_0x11be('0x11c')](db[_0x11be('0x42')],{'through':_0x11be('0x162')});db[_0x11be('0x164')][_0x11be('0x11c')](db['SmsInteraction'],{'through':_0x11be('0x17a')});db[_0x11be('0x164')][_0x11be('0x11c')](db[_0x11be('0x115')],{'through':'fax_interaction_has_tags'});db[_0x11be('0x164')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0x11be('0x17e')});db[_0x11be('0x164')][_0x11be('0x11c')](db[_0x11be('0x118')],{'through':_0x11be('0x1a1')});db['Trigger'][_0x11be('0x10c')](db[_0x11be('0x7e')],{'as':{'plural':_0x11be('0x1a2'),'singular':_0x11be('0x1a3')},'foreignKey':_0x11be('0x1a4'),'onDelete':'cascade','hooks':!![]});db[_0x11be('0x8c')][_0x11be('0x10c')](db[_0x11be('0x7e')],{'as':{'plural':'AnyConditions','singular':_0x11be('0x1a5')},'foreignKey':_0x11be('0x1a6'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x11be('0x10c')](db['Action'],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0x11be('0x109'),'hooks':!![]});db[_0x11be('0x92')][_0x11be('0x10c')](db[_0x11be('0x1a7')],{'as':_0x11be('0x1a8'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x19e'),'hooks':!![]});db['AnalyticDefaultReport'][_0x11be('0x10c')](db[_0x11be('0x1a7')],{'as':_0x11be('0x1a8'),'onDelete':_0x11be('0x109'),'foreignKey':'DefaultReportId'});db[_0x11be('0x97')][_0x11be('0x10c')](db[_0x11be('0x1a7')],{'as':_0x11be('0x1a8'),'onDelete':_0x11be('0x109'),'foreignKey':'MetricId'});db[_0x11be('0x1a7')][_0x11be('0x11a')](db['AnalyticMetric'],{'foreignKey':_0x11be('0x1a9')});db[_0x11be('0x9b')][_0x11be('0x10c')](db[_0x11be('0x1aa')],{'as':_0x11be('0x1ab'),'onDelete':'cascade','foreignKey':_0x11be('0x1ac')});db['SalesforceConfiguration']['hasMany'](db[_0x11be('0x9e')],{'as':_0x11be('0x1ad'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1ae')});db[_0x11be('0x1aa')][_0x11be('0x10c')](db['SalesforceField'],{'as':_0x11be('0x1af'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1b0')});db[_0x11be('0x1aa')][_0x11be('0x10c')](db['SalesforceField'],{'as':_0x11be('0x1a8'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1b1')});db[_0x11be('0x1aa')]['belongsTo'](db[_0x11be('0x9b')],{'as':_0x11be('0x15f'),'foreignKey':_0x11be('0x1ac')});db[_0x11be('0x9e')][_0x11be('0x10c')](db[_0x11be('0x9e')],{'as':_0x11be('0x1b2'),'foreignKey':_0x11be('0x1ae')});db[_0x11be('0x9e')][_0x11be('0x10c')](db[_0x11be('0x9e')],{'as':_0x11be('0x1b3'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0x11be('0x10c')](db[_0x11be('0x9e')],{'as':'Field','foreignKey':'FieldId'});db[_0x11be('0x9e')][_0x11be('0x11a')](db[_0x11be('0x8e')],{'as':_0x11be('0x8e'),'foreignKey':_0x11be('0x1b4')});db[_0x11be('0x9f')]['hasMany'](db[_0x11be('0xa1')],{'as':'Configurations','onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1ac')});db[_0x11be('0xa1')][_0x11be('0x10c')](db[_0x11be('0xa2')],{'as':_0x11be('0x1ad'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1ae')});db[_0x11be('0xa1')][_0x11be('0x10c')](db[_0x11be('0xa2')],{'as':_0x11be('0x1af'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1b0')});db['SugarcrmConfiguration'][_0x11be('0x10c')](db['SugarcrmField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x11be('0x1b1')});db['SugarcrmConfiguration'][_0x11be('0x11a')](db['SugarcrmAccount'],{'as':_0x11be('0x15f'),'foreignKey':'AccountId'});db[_0x11be('0xa2')][_0x11be('0x10c')](db[_0x11be('0xa2')],{'as':_0x11be('0x1b2'),'foreignKey':_0x11be('0x1ae')});db[_0x11be('0xa2')]['hasMany'](db[_0x11be('0xa2')],{'as':_0x11be('0x1b3'),'foreignKey':_0x11be('0x1b0')});db[_0x11be('0xa2')]['hasMany'](db[_0x11be('0xa2')],{'as':_0x11be('0x1b5'),'foreignKey':'FieldId'});db[_0x11be('0xa2')][_0x11be('0x11a')](db['Variable'],{'as':_0x11be('0x8e'),'foreignKey':_0x11be('0x1b4')});db[_0x11be('0xa4')]['hasMany'](db[_0x11be('0x1b6')],{'as':_0x11be('0x1ab'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x11be('0x1b6')]['hasMany'](db[_0x11be('0xa6')],{'as':_0x11be('0x1ad'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1ae')});db[_0x11be('0x1b6')][_0x11be('0x10c')](db[_0x11be('0xa6')],{'as':'Descriptions','onDelete':_0x11be('0x109'),'foreignKey':'DescriptionId'});db[_0x11be('0x1b6')][_0x11be('0x10c')](db[_0x11be('0xa6')],{'as':_0x11be('0x1a8'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1b1')});db[_0x11be('0x1b6')][_0x11be('0x11a')](db['DeskAccount'],{'as':_0x11be('0x15f'),'foreignKey':_0x11be('0x1ac')});db[_0x11be('0x1b6')][_0x11be('0x11c')](db['Tag'],{'through':_0x11be('0x1b7')});db[_0x11be('0xa6')][_0x11be('0x10c')](db[_0x11be('0xa6')],{'as':_0x11be('0x1b2'),'foreignKey':'SubjectId'});db[_0x11be('0xa6')][_0x11be('0x10c')](db[_0x11be('0xa6')],{'as':_0x11be('0x1b3'),'foreignKey':_0x11be('0x1b0')});db[_0x11be('0xa6')][_0x11be('0x10c')](db[_0x11be('0xa6')],{'as':_0x11be('0x1b5'),'foreignKey':_0x11be('0x1b1')});db['DeskField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x11be('0x1b4')});db['ZohoAccount']['hasMany'](db[_0x11be('0x1b8')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x11be('0x1ac')});db[_0x11be('0x1b8')][_0x11be('0x10c')](db[_0x11be('0xa9')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x11be('0x1ae')});db[_0x11be('0x1b8')][_0x11be('0x10c')](db['ZohoField'],{'as':_0x11be('0x1af'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1b0')});db[_0x11be('0x1b8')][_0x11be('0x10c')](db[_0x11be('0xa9')],{'as':_0x11be('0x1a8'),'onDelete':'cascade','foreignKey':_0x11be('0x1b1')});db[_0x11be('0x1b8')][_0x11be('0x11a')](db[_0x11be('0xa8')],{'as':_0x11be('0x15f'),'foreignKey':_0x11be('0x1ac')});db[_0x11be('0xa9')][_0x11be('0x10c')](db['ZohoField'],{'as':_0x11be('0x1b2'),'foreignKey':_0x11be('0x1ae')});db['ZohoField']['hasMany'](db[_0x11be('0xa9')],{'as':_0x11be('0x1b3'),'foreignKey':_0x11be('0x1b0')});db['ZohoField'][_0x11be('0x10c')](db[_0x11be('0xa9')],{'as':_0x11be('0x1b5'),'foreignKey':_0x11be('0x1b1')});db[_0x11be('0xa9')][_0x11be('0x11a')](db[_0x11be('0x8e')],{'as':_0x11be('0x8e'),'foreignKey':_0x11be('0x1b4')});db['ZendeskAccount']['hasMany'](db[_0x11be('0xab')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x11be('0xab')]['hasMany'](db['ZendeskField'],{'as':_0x11be('0x1ad'),'foreignKey':_0x11be('0x1ae')});db['ZendeskConfiguration']['hasMany'](db[_0x11be('0xad')],{'as':_0x11be('0x1af'),'foreignKey':'DescriptionId'});db[_0x11be('0xab')][_0x11be('0x10c')](db[_0x11be('0xad')],{'as':_0x11be('0x1a8'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x11be('0x11a')](db[_0x11be('0x1b9')],{'as':_0x11be('0x15f'),'foreignKey':_0x11be('0x1ac')});db[_0x11be('0xab')][_0x11be('0x11c')](db[_0x11be('0x164')],{'through':_0x11be('0x1ba')});db[_0x11be('0xad')]['hasMany'](db[_0x11be('0xad')],{'as':_0x11be('0x1b2'),'foreignKey':'SubjectId'});db['ZendeskField'][_0x11be('0x10c')](db[_0x11be('0xad')],{'as':'Description','foreignKey':_0x11be('0x1b0')});db[_0x11be('0xad')][_0x11be('0x10c')](db[_0x11be('0xad')],{'as':_0x11be('0x1b5'),'foreignKey':_0x11be('0x1b1')});db[_0x11be('0xad')]['belongsTo'](db[_0x11be('0x8e')],{'as':_0x11be('0x8e'),'foreignKey':_0x11be('0x1b4')});db[_0x11be('0xaf')][_0x11be('0x10c')](db[_0x11be('0xb1')],{'as':'Configurations','onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1ac')});db['FreshdeskConfiguration']['hasMany'](db[_0x11be('0xb3')],{'as':_0x11be('0x1ad'),'onDelete':'cascade','foreignKey':_0x11be('0x1ae')});db[_0x11be('0xb1')][_0x11be('0x10c')](db[_0x11be('0xb3')],{'as':_0x11be('0x1af'),'onDelete':_0x11be('0x109'),'foreignKey':'DescriptionId'});db[_0x11be('0xb1')][_0x11be('0x10c')](db['FreshdeskField'],{'as':'Fields','onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1b1')});db['FreshdeskConfiguration'][_0x11be('0x11a')](db[_0x11be('0xaf')],{'as':_0x11be('0x15f'),'foreignKey':_0x11be('0x1ac')});db['FreshdeskConfiguration'][_0x11be('0x11c')](db[_0x11be('0x164')],{'through':_0x11be('0x1bb')});db[_0x11be('0xb3')][_0x11be('0x10c')](db[_0x11be('0xb3')],{'as':'Subject','foreignKey':_0x11be('0x1ae')});db[_0x11be('0xb3')][_0x11be('0x10c')](db[_0x11be('0xb3')],{'as':'Description','foreignKey':_0x11be('0x1b0')});db[_0x11be('0xb3')][_0x11be('0x10c')](db[_0x11be('0xb3')],{'as':'Field','foreignKey':_0x11be('0x1b1')});db[_0x11be('0xb3')]['belongsTo'](db['Variable'],{'as':_0x11be('0x8e'),'foreignKey':_0x11be('0x1b4')});db[_0x11be('0xb5')]['hasMany'](db[_0x11be('0xb6')],{'as':_0x11be('0x1ab'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1ac')});db[_0x11be('0xb6')][_0x11be('0x10c')](db[_0x11be('0xb8')],{'as':_0x11be('0x1ad'),'foreignKey':'SubjectId'});db['VtigerConfiguration'][_0x11be('0x10c')](db[_0x11be('0xb8')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x11be('0xb6')][_0x11be('0x10c')](db[_0x11be('0xb8')],{'as':_0x11be('0x1a8'),'foreignKey':'FieldId'});db['VtigerConfiguration'][_0x11be('0x11a')](db['VtigerAccount'],{'as':_0x11be('0x15f'),'foreignKey':_0x11be('0x1ac')});db[_0x11be('0xb8')][_0x11be('0x10c')](db[_0x11be('0xb8')],{'as':_0x11be('0x1b2'),'foreignKey':_0x11be('0x1ae')});db[_0x11be('0xb8')]['hasMany'](db[_0x11be('0xb8')],{'as':_0x11be('0x1b3'),'foreignKey':_0x11be('0x1b0')});db['VtigerField'][_0x11be('0x10c')](db[_0x11be('0xb8')],{'as':'Field','foreignKey':_0x11be('0x1b1')});db[_0x11be('0xb8')]['belongsTo'](db[_0x11be('0x8e')],{'as':'Variable','foreignKey':'VariableId'});db[_0x11be('0xba')]['hasMany'](db['ServicenowConfiguration'],{'as':_0x11be('0x1ab'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1ac')});db['ServicenowConfiguration']['hasMany'](db[_0x11be('0xbc')],{'as':'Subjects','foreignKey':_0x11be('0x1ae')});db['ServicenowConfiguration'][_0x11be('0x10c')](db[_0x11be('0xbc')],{'as':_0x11be('0x1af'),'foreignKey':'DescriptionId'});db[_0x11be('0x1bc')][_0x11be('0x10c')](db[_0x11be('0xbc')],{'as':'Fields','foreignKey':_0x11be('0x1b1')});db[_0x11be('0x1bc')][_0x11be('0x11a')](db[_0x11be('0xba')],{'as':'Account','foreignKey':_0x11be('0x1ac')});db[_0x11be('0xbc')][_0x11be('0x10c')](db[_0x11be('0xbc')],{'as':'Subject','foreignKey':_0x11be('0x1ae')});db[_0x11be('0xbc')]['hasMany'](db[_0x11be('0xbc')],{'as':_0x11be('0x1b3'),'foreignKey':_0x11be('0x1b0')});db[_0x11be('0xbc')][_0x11be('0x10c')](db['ServicenowField'],{'as':_0x11be('0x1b5'),'foreignKey':_0x11be('0x1b1')});db[_0x11be('0xbc')][_0x11be('0x11a')](db[_0x11be('0x8e')],{'as':_0x11be('0x8e'),'foreignKey':'VariableId'});db[_0x11be('0xbe')][_0x11be('0x10c')](db[_0x11be('0xc0')],{'as':_0x11be('0x1ab'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1ac')});db['Dynamics365Configuration']['hasMany'](db[_0x11be('0xc1')],{'as':'Subjects','onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1ae')});db[_0x11be('0xc0')][_0x11be('0x10c')](db[_0x11be('0xc1')],{'as':_0x11be('0x1af'),'onDelete':'cascade','foreignKey':_0x11be('0x1b0')});db[_0x11be('0xc0')][_0x11be('0x10c')](db[_0x11be('0xc1')],{'as':_0x11be('0x1a8'),'onDelete':'cascade','foreignKey':_0x11be('0x1b1')});db['Dynamics365Configuration'][_0x11be('0x11a')](db[_0x11be('0xbe')],{'as':_0x11be('0x15f'),'foreignKey':'AccountId'});db[_0x11be('0xc1')]['hasMany'](db[_0x11be('0xc1')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x11be('0xc1')]['hasMany'](db['Dynamics365Field'],{'as':_0x11be('0x1b3'),'foreignKey':_0x11be('0x1b0')});db[_0x11be('0xc1')][_0x11be('0x10c')](db[_0x11be('0xc1')],{'as':_0x11be('0x1b5'),'foreignKey':_0x11be('0x1b1')});db[_0x11be('0xc1')][_0x11be('0x11a')](db['Variable'],{'as':_0x11be('0x8e'),'foreignKey':_0x11be('0x1b4')});db['FreshsalesAccount'][_0x11be('0x10c')](db[_0x11be('0xc5')],{'as':_0x11be('0x1ab'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1ac')});db[_0x11be('0xc5')][_0x11be('0x10c')](db['FreshsalesField'],{'as':_0x11be('0x1ad'),'foreignKey':_0x11be('0x1ae')});db[_0x11be('0xc5')][_0x11be('0x10c')](db['FreshsalesField'],{'as':_0x11be('0x1af'),'foreignKey':_0x11be('0x1b0')});db[_0x11be('0xc5')][_0x11be('0x10c')](db[_0x11be('0xc7')],{'as':_0x11be('0x1a8'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0x11be('0x11a')](db[_0x11be('0xc3')],{'as':_0x11be('0x15f'),'foreignKey':_0x11be('0x1ac')});db[_0x11be('0xc7')][_0x11be('0x10c')](db[_0x11be('0xc7')],{'as':_0x11be('0x1b2'),'foreignKey':_0x11be('0x1ae')});db[_0x11be('0xc7')][_0x11be('0x10c')](db['FreshsalesField'],{'as':_0x11be('0x1b3'),'foreignKey':_0x11be('0x1b0')});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':_0x11be('0x1b5'),'foreignKey':_0x11be('0x1b1')});db[_0x11be('0xc7')][_0x11be('0x11a')](db[_0x11be('0x8e')],{'as':_0x11be('0x8e'),'foreignKey':_0x11be('0x1b4')});db[_0x11be('0xca')][_0x11be('0x11a')](db['ChatWebsite'],{});db[_0x11be('0xca')][_0x11be('0x11a')](db['CmList'],{'as':_0x11be('0x15a'),'foreignKey':'ListId'});db[_0x11be('0xca')][_0x11be('0x11a')](db['CmContact'],{'as':_0x11be('0x160'),'foreignKey':'ContactId'});db['ChatQueueReport']['belongsTo'](db[_0x11be('0x66')],{});db[_0x11be('0xca')][_0x11be('0x11a')](db[_0x11be('0x67')],{});db[_0x11be('0xca')][_0x11be('0x11a')](db[_0x11be('0x10')],{});db[_0x11be('0xca')][_0x11be('0x11a')](db[_0x11be('0x69')],{});db[_0x11be('0xcb')][_0x11be('0x11a')](db[_0x11be('0x10')],{'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1bd')});db[_0x11be('0xcb')][_0x11be('0x11a')](db['User'],{'onDelete':'cascade','foreignKey':_0x11be('0x1be')});db[_0x11be('0xd1')][_0x11be('0x10c')](db['JscriptyQuestionReport'],{'foreignKey':_0x11be('0x1bf'),'onDelete':_0x11be('0x109')});db[_0x11be('0xd1')][_0x11be('0x10c')](db[_0x11be('0xcd')],{'foreignKey':'SessionId','onDelete':'cascade'});db['SmsQueueReport']['belongsTo'](db[_0x11be('0x53')],{});db[_0x11be('0xd2')][_0x11be('0x11a')](db['CmList'],{'as':_0x11be('0x15a'),'foreignKey':_0x11be('0x15b')});db[_0x11be('0xd2')][_0x11be('0x11a')](db[_0x11be('0x6e')],{'as':_0x11be('0x160'),'foreignKey':'ContactId'});db[_0x11be('0xd2')][_0x11be('0x11a')](db['SmsInteraction'],{});db[_0x11be('0xd2')][_0x11be('0x11a')](db[_0x11be('0x56')],{});db[_0x11be('0xd2')][_0x11be('0x11a')](db[_0x11be('0x10')],{});db[_0x11be('0xd2')][_0x11be('0x11a')](db[_0x11be('0x58')],{});db['JscriptyProject'][_0x11be('0x10c')](db[_0x11be('0xd1')],{'foreignKey':'ProjectId'});db[_0x11be('0xd7')][_0x11be('0x10c')](db[_0x11be('0xcf')],{'foreignKey':'ProjectId'});db[_0x11be('0xd7')][_0x11be('0x10c')](db[_0x11be('0xcd')],{'foreignKey':_0x11be('0x1c0')});db[_0x11be('0xdb')][_0x11be('0x11c')](db[_0x11be('0x10')],{'as':_0x11be('0x166'),'through':_0x11be('0x1c1')});db['Team'][_0x11be('0x11c')](db[_0x11be('0x10')],{'as':_0x11be('0x14b'),'through':_0x11be('0x121')});db[_0x11be('0xdd')][_0x11be('0x11c')](db['VoiceQueue'],{'through':_0x11be('0x1c2'),'as':_0x11be('0x126')});db[_0x11be('0xdd')][_0x11be('0x11c')](db[_0x11be('0x3f')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0x11be('0xdd')][_0x11be('0x11c')](db[_0x11be('0x69')],{'through':_0x11be('0x187'),'as':_0x11be('0x1c3')});db[_0x11be('0xdd')][_0x11be('0x11c')](db['FaxQueue'],{'through':_0x11be('0x176'),'as':_0x11be('0x12a')});db[_0x11be('0xdd')][_0x11be('0x11c')](db[_0x11be('0x58')],{'through':_0x11be('0x1c4'),'as':_0x11be('0x12b')});db[_0x11be('0xdd')][_0x11be('0x11c')](db['OpenchannelQueue'],{'through':_0x11be('0x180'),'as':_0x11be('0x12c')});db[_0x11be('0xdd')][_0x11be('0x11c')](db[_0x11be('0x12e')],{'through':_0x11be('0x1c5'),'as':'WhatsappQueues'});db['Team'][_0x11be('0x11c')](db['VoicePrefix'],{'through':_0x11be('0x104'),'as':'VoicePrefixes'});db[_0x11be('0xe0')]['hasMany'](db[_0x11be('0x18b')],{'as':'Hoppers','foreignKey':_0x11be('0x18f')});db[_0x11be('0xe0')][_0x11be('0x10c')](db['CmHopperFinal'],{'as':_0x11be('0x10f'),'foreignKey':_0x11be('0x18f')});db[_0x11be('0xe0')][_0x11be('0x10c')](db[_0x11be('0x74')],{'as':_0x11be('0x142'),'foreignKey':'CampaignId'});db[_0x11be('0xe0')][_0x11be('0x10c')](db[_0x11be('0x71')],{'as':'HopperBlacks','foreignKey':_0x11be('0x18f')});db[_0x11be('0xe0')]['belongsTo'](db[_0x11be('0x2a')],{'as':_0x11be('0x2a'),'foreignKey':_0x11be('0x145')});db[_0x11be('0xe0')][_0x11be('0x11a')](db[_0x11be('0x2a')],{'as':_0x11be('0x1c6'),'foreignKey':_0x11be('0x146')});db['Campaign'][_0x11be('0x11a')](db[_0x11be('0x80')],{'as':'Interval','foreignKey':_0x11be('0x147')});db['Campaign'][_0x11be('0x11a')](db['SquareProject'],{'as':_0x11be('0xdb'),'foreignKey':_0x11be('0x1c7')});db['Campaign']['belongsToMany'](db[_0x11be('0xed')],{'as':_0x11be('0x120'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0x11be('0x11c')](db[_0x11be('0xed')],{'as':'BlackLists','through':_0x11be('0x1c8')});db[_0x11be('0x175')]['belongsTo'](db[_0x11be('0x16c')],{'as':'ChatOfflineMessage','foreignKey':_0x11be('0x16d')});db['MailTransferReport'][_0x11be('0x11a')](db['MailMessage'],{});db[_0x11be('0x1c9')][_0x11be('0x11a')](db[_0x11be('0x42')],{});db[_0x11be('0x1c9')][_0x11be('0x11a')](db['MailAccount'],{'foreignKey':_0x11be('0x1ca'),'as':'FromAccount'});db['MailTransferReport']['belongsTo'](db[_0x11be('0x10')],{'foreignKey':_0x11be('0x1cb'),'as':_0x11be('0x1cc')});db[_0x11be('0x1c9')][_0x11be('0x11a')](db[_0x11be('0x10')],{'foreignKey':_0x11be('0x1cd'),'as':'ToAgent'});db[_0x11be('0x1c9')][_0x11be('0x11a')](db['MailQueue'],{'foreignKey':_0x11be('0x1ce'),'as':_0x11be('0x1cf')});db[_0x11be('0x1c9')][_0x11be('0x11a')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x11be('0x1d0')});db[_0x11be('0xe7')]['belongsTo'](db[_0x11be('0x67')],{});db[_0x11be('0xe7')]['belongsTo'](db[_0x11be('0x66')],{});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0x11be('0x1d1')});db['ChatTransferReport'][_0x11be('0x11a')](db[_0x11be('0x10')],{'foreignKey':_0x11be('0x1cb'),'as':_0x11be('0x1cc')});db[_0x11be('0xe7')][_0x11be('0x11a')](db[_0x11be('0x10')],{'foreignKey':_0x11be('0x1cd'),'as':_0x11be('0x1d2')});db[_0x11be('0xe7')][_0x11be('0x11a')](db[_0x11be('0x69')],{'foreignKey':_0x11be('0x1d3'),'as':_0x11be('0x1cf')});db[_0x11be('0xe7')][_0x11be('0x11a')](db[_0x11be('0x62')],{'foreignKey':_0x11be('0x1d4'),'as':_0x11be('0x1d0')});db[_0x11be('0xe9')][_0x11be('0x11a')](db['FaxMessage'],{});db[_0x11be('0xe9')]['belongsTo'](db[_0x11be('0x115')],{});db[_0x11be('0xe9')][_0x11be('0x11a')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0x11be('0xe9')]['belongsTo'](db[_0x11be('0x10')],{'foreignKey':'FromUserId','as':'FromAgent'});db['FaxTransferReport'][_0x11be('0x11a')](db['User'],{'foreignKey':_0x11be('0x1cd'),'as':_0x11be('0x1d2')});db[_0x11be('0xe9')][_0x11be('0x11a')](db[_0x11be('0x50')],{'foreignKey':'ToFaxQueueId','as':_0x11be('0x1cf')});db[_0x11be('0xe9')][_0x11be('0x11a')](db[_0x11be('0x4b')],{'foreignKey':_0x11be('0x1d5'),'as':_0x11be('0x1d0')});db[_0x11be('0xea')]['belongsTo'](db[_0x11be('0x5f')],{});db[_0x11be('0xea')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x11be('0xea')][_0x11be('0x11a')](db[_0x11be('0x5a')],{'foreignKey':_0x11be('0x1d6'),'as':_0x11be('0x1d1')});db[_0x11be('0xea')][_0x11be('0x11a')](db['User'],{'foreignKey':_0x11be('0x1cb'),'as':_0x11be('0x1cc')});db[_0x11be('0xea')][_0x11be('0x11a')](db[_0x11be('0x10')],{'foreignKey':_0x11be('0x1cd'),'as':_0x11be('0x1d2')});db[_0x11be('0xea')][_0x11be('0x11a')](db[_0x11be('0x61')],{'foreignKey':'ToOpenchannelQueueId','as':_0x11be('0x1cf')});db[_0x11be('0xea')][_0x11be('0x11a')](db[_0x11be('0x5a')],{'foreignKey':'ToOpenchannelAccountId','as':_0x11be('0x1d0')});db[_0x11be('0x1d7')][_0x11be('0x11a')](db[_0x11be('0x56')],{});db[_0x11be('0x1d7')][_0x11be('0x11a')](db['SmsInteraction'],{});db[_0x11be('0x1d7')][_0x11be('0x11a')](db['SmsAccount'],{'foreignKey':_0x11be('0x1d8'),'as':'FromAccount'});db[_0x11be('0x1d7')][_0x11be('0x11a')](db[_0x11be('0x10')],{'foreignKey':'FromUserId','as':_0x11be('0x1cc')});db[_0x11be('0x1d7')][_0x11be('0x11a')](db[_0x11be('0x10')],{'foreignKey':_0x11be('0x1cd'),'as':_0x11be('0x1d2')});db['SmsTransferReport'][_0x11be('0x11a')](db[_0x11be('0x58')],{'foreignKey':_0x11be('0x1d9'),'as':_0x11be('0x1cf')});db[_0x11be('0x1d7')][_0x11be('0x11a')](db[_0x11be('0x53')],{'foreignKey':_0x11be('0x1da'),'as':_0x11be('0x1d0')});db[_0x11be('0xed')]['hasMany'](db[_0x11be('0x7c')],{'as':'Dispositions','foreignKey':_0x11be('0x15b'),'onDelete':_0x11be('0x109')});db[_0x11be('0xed')][_0x11be('0x10c')](db['CmCustomField'],{'as':_0x11be('0x1db'),'foreignKey':'ListId'});db[_0x11be('0xed')][_0x11be('0x10c')](db[_0x11be('0x6e')],{'as':_0x11be('0x11e'),'onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x15b')});db[_0x11be('0xed')][_0x11be('0x10c')](db[_0x11be('0x73')],{'as':_0x11be('0x10f'),'foreignKey':'ListId'});db[_0x11be('0xed')][_0x11be('0x10c')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x11be('0x15b')});db[_0x11be('0xed')]['hasMany'](db[_0x11be('0x75')],{'as':'ReportAgentPreview','foreignKey':_0x11be('0x15b')});db[_0x11be('0xed')][_0x11be('0x11c')](db[_0x11be('0x1a')],{'as':_0x11be('0x1dc'),'through':_0x11be('0x14a')});db[_0x11be('0xed')]['belongsToMany'](db[_0x11be('0x10')],{'as':'Agents','through':_0x11be('0x1dd')});db[_0x11be('0xef')][_0x11be('0x10c')](db[_0x11be('0x17')],{'as':_0x11be('0x10e'),'onDelete':_0x11be('0x109')});db['VoicePrefix'][_0x11be('0x11c')](db['User'],{'as':_0x11be('0x14b'),'through':_0x11be('0x106')});db['VoicePrefix']['belongsToMany'](db[_0x11be('0xdd')],{'through':_0x11be('0x104'),'as':'Teams'});db[_0x11be('0xf1')][_0x11be('0x10c')](db[_0x11be('0x10')],{'as':'Users','foreignKey':'userProfileId'});db[_0x11be('0xf1')][_0x11be('0x10c')](db[_0x11be('0xf2')],{'as':_0x11be('0x1de'),'foreignKey':_0x11be('0x11b'),'onDelete':_0x11be('0x109')});db[_0x11be('0xf2')]['hasMany'](db['UserProfileResource'],{'as':_0x11be('0x1df'),'foreignKey':'sectionId','onDelete':'cascade'});db['WhatsappAccount'][_0x11be('0x10c')](db[_0x11be('0x7c')],{'as':_0x11be('0x170'),'foreignKey':'WhatsappAccountId','onDelete':_0x11be('0x109')});db[_0x11be('0x139')][_0x11be('0x10c')](db[_0x11be('0x7b')],{'as':_0x11be('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x11be('0x139')][_0x11be('0x10c')](db[_0x11be('0xfb')],{'as':_0x11be('0x14e'),'foreignKey':_0x11be('0x1e0')});db[_0x11be('0x139')]['hasMany'](db['WhatsappInteraction'],{'as':_0x11be('0x159')});db[_0x11be('0x139')][_0x11be('0x10c')](db[_0x11be('0xf8')],{'as':_0x11be('0x13d')});db[_0x11be('0x139')]['belongsTo'](db[_0x11be('0xed')],{'as':_0x11be('0x15a'),'foreignKey':'ListId'});db[_0x11be('0x139')]['belongsTo'](db[_0x11be('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0x11be('0x149')});db[_0x11be('0x139')][_0x11be('0x11c')](db['User'],{'as':_0x11be('0x14b'),'through':_0x11be('0x13b')});db[_0x11be('0xf8')][_0x11be('0x11a')](db['User'],{'onDelete':_0x11be('0x16e')});db['WhatsappApplication'][_0x11be('0x11a')](db['WhatsappQueue'],{'onDelete':_0x11be('0x16e')});db['WhatsappApplication'][_0x11be('0x11a')](db['WhatsappAccount'],{'onDelete':_0x11be('0x16e')});db['WhatsappApplication'][_0x11be('0x11a')](db[_0x11be('0x80')],{'onDelete':_0x11be('0x16e'),'foreignKey':_0x11be('0x147')});db[_0x11be('0xf8')][_0x11be('0x11a')](db[_0x11be('0x164')],{'onDelete':_0x11be('0x16e'),'foreignKey':_0x11be('0x16f')});db['WhatsappInteraction'][_0x11be('0x10c')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x11be('0x109'),'foreignKey':_0x11be('0x1e1')});db[_0x11be('0x118')][_0x11be('0x11a')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x11be('0x1e0')});db[_0x11be('0x118')][_0x11be('0x11a')](db[_0x11be('0x6e')],{'as':'Contact','foreignKey':'ContactId'});db[_0x11be('0x118')]['belongsTo'](db['User'],{'as':_0x11be('0x161'),'foreignKey':'UserId'});db[_0x11be('0x118')][_0x11be('0x11c')](db['Tag'],{'through':_0x11be('0x1a1'),'as':_0x11be('0x163')});db[_0x11be('0x118')]['belongsToMany'](db[_0x11be('0x164')],{'through':_0x11be('0x1a1'),'as':_0x11be('0x165')});db[_0x11be('0x118')][_0x11be('0x11c')](db[_0x11be('0x10')],{'as':_0x11be('0x166'),'through':_0x11be('0x1e2'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x11be('0x11a')](db['User'],{'as':_0x11be('0x10')});db[_0x11be('0xfb')]['belongsTo'](db[_0x11be('0x6e')],{'onDelete':_0x11be('0x109'),'as':_0x11be('0x160')});db[_0x11be('0xfb')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':_0x11be('0x109'),'as':'Interaction','foreignKey':_0x11be('0x1e1')});db[_0x11be('0xfb')][_0x11be('0x11a')](db[_0x11be('0x139')],{'as':_0x11be('0x15f'),'foreignKey':_0x11be('0x1e0')});db['WhatsappQueueReport'][_0x11be('0x11a')](db[_0x11be('0x139')],{});db[_0x11be('0xfd')][_0x11be('0x11a')](db[_0x11be('0xed')],{'as':_0x11be('0x15a'),'foreignKey':_0x11be('0x15b')});db['WhatsappQueueReport'][_0x11be('0x11a')](db[_0x11be('0x6e')],{'as':_0x11be('0x160'),'foreignKey':_0x11be('0x154')});db[_0x11be('0xfd')][_0x11be('0x11a')](db[_0x11be('0x118')],{});db[_0x11be('0xfd')][_0x11be('0x11a')](db[_0x11be('0x12e')],{});db[_0x11be('0xfd')][_0x11be('0x11a')](db[_0x11be('0xfb')],{});db[_0x11be('0xfd')][_0x11be('0x11a')](db['User'],{});db['WhatsappTransferReport']['belongsTo'](db[_0x11be('0xfb')],{});db[_0x11be('0xfe')][_0x11be('0x11a')](db['WhatsappInteraction'],{});db[_0x11be('0xfe')][_0x11be('0x11a')](db[_0x11be('0x139')],{'foreignKey':_0x11be('0x1e3'),'as':_0x11be('0x1d1')});db[_0x11be('0xfe')][_0x11be('0x11a')](db[_0x11be('0x139')],{'foreignKey':_0x11be('0x1e4'),'as':_0x11be('0x1d0')});db['WhatsappTransferReport']['belongsTo'](db[_0x11be('0x12e')],{'foreignKey':'ToQueueId','as':_0x11be('0x1cf')});db[_0x11be('0xfe')][_0x11be('0x11a')](db[_0x11be('0x10')],{'foreignKey':_0x11be('0x1cb'),'as':'FromAgent'});db[_0x11be('0xfe')][_0x11be('0x11a')](db[_0x11be('0x10')],{'foreignKey':'ToUserId','as':_0x11be('0x1d2')});db[_0x11be('0x12e')]['belongsToMany'](db[_0x11be('0x10')],{'as':_0x11be('0x14b'),'through':_0x11be('0x38'),'foreignKey':_0x11be('0x1e5')});db['WhatsappQueue'][_0x11be('0x11c')](db[_0x11be('0xdd')],{'through':_0x11be('0x1c5'),'as':_0x11be('0x15e')});module[_0x11be('0x1e6')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index f8d9368..a0c65ff 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c77=['/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','./api/campaign','./api/migration','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','username','password','newPassword','apiKey','firstName','lastName','phone','mobile','fax','email','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerSecret','calleridnum','exten','clientEmail','secretaccesskey','key','pass','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','replace','@@{','}@@','includes','lodash','path','express-winston','util','./errors','./config/environment','./config/logger','api','auth','./safe-template','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','method','headers','x-forwarded-for','url','statusCode','user','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','remoteAddress','responseTime','name','role','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration'];(function(_0x6b5479,_0x3513a5){var _0x2d210e=function(_0x142631){while(--_0x142631){_0x6b5479['push'](_0x6b5479['shift']());}};_0x2d210e(++_0x3513a5);}(_0x8c77,0x1d6));var _0x78c7=function(_0x2b58d1,_0x7b1918){_0x2b58d1=_0x2b58d1-0x0;var _0x171fcf=_0x8c77[_0x2b58d1];return _0x171fcf;};'use strict';var _=require(_0x78c7('0x0'));var path=require(_0x78c7('0x1'));var express=require('express');var ewinston=require(_0x78c7('0x2'));var util=require(_0x78c7('0x3'));var errors=require(_0x78c7('0x4'));var config=require(_0x78c7('0x5'));var logger=require(_0x78c7('0x6'))(_0x78c7('0x7'));var authLogger=require(_0x78c7('0x6'))(_0x78c7('0x8'));var safeTemplate=require(_0x78c7('0x9'))['safeTemplate'];exports[_0x78c7('0xa')]=function(_0x5dad3d){_0x5dad3d[_0x78c7('0xb')](ewinston[_0x78c7('0xc')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xa56bc0,_0x16149f){var _0x548634=_0x78c7('0xd');if(!_['isEmpty'](_0xa56bc0[_0x78c7('0xe')])){_0x548634+='\x20body=%s';var _0x4c5268=_0xa56bc0[_0x78c7('0xe')];maskSensitiveData(_0x4c5268);}return safeTemplate(util[_0x78c7('0xf')](_0x548634,_0xa56bc0[_0x78c7('0x10')],_0xa56bc0[_0x78c7('0x11')][_0x78c7('0x12')]?_0xa56bc0[_0x78c7('0x11')][_0x78c7('0x12')]:_0xa56bc0['connection']['remoteAddress']||_0xa56bc0['ip'],_0xa56bc0[_0x78c7('0x13')],_0x16149f[_0x78c7('0x14')],_0x16149f['responseTime'],_0xa56bc0[_0x78c7('0x15')]?_0xa56bc0[_0x78c7('0x15')]['id']:null,_0xa56bc0['user']?_0xa56bc0['user']['name']:null,_0xa56bc0[_0x78c7('0x15')]?_0xa56bc0[_0x78c7('0x15')]['role']:null,_0x4c5268?util[_0x78c7('0x16')](_0x4c5268,![],null):''));}}));_0x5dad3d[_0x78c7('0xb')](ewinston[_0x78c7('0xc')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x3acf6c,_0x2f84b7){var _0x34dc0a=_0x78c7('0x17');if(_0x3acf6c[_0x78c7('0xe')]&&_0x3acf6c[_0x78c7('0xe')]['device']&&_0x3acf6c[_0x78c7('0xe')][_0x78c7('0x18')]){_0x34dc0a='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x78c7('0xf')](_0x34dc0a,_0x3acf6c[_0x78c7('0x10')],_0x3acf6c[_0x78c7('0x11')][_0x78c7('0x12')]?_0x3acf6c['headers'][_0x78c7('0x12')]:_0x3acf6c['connection'][_0x78c7('0x19')]||_0x3acf6c['ip'],_0x3acf6c[_0x78c7('0x13')],_0x2f84b7['statusCode'],_0x2f84b7[_0x78c7('0x1a')],_0x3acf6c[_0x78c7('0x15')]?_0x3acf6c[_0x78c7('0x15')]['id']:null,_0x3acf6c['user']?_0x3acf6c[_0x78c7('0x15')][_0x78c7('0x1b')]:null,_0x3acf6c[_0x78c7('0x15')]?_0x3acf6c[_0x78c7('0x15')][_0x78c7('0x1c')]:null,_0x3acf6c[_0x78c7('0xe')]&&_0x3acf6c['body'][_0x78c7('0x1d')]?_0x3acf6c['body']['device']:_0x78c7('0x1e'),_0x3acf6c['body']&&_0x3acf6c[_0x78c7('0xe')]['agent_id']?_0x3acf6c['body']['agent_id']:'',_0x3acf6c[_0x78c7('0xe')]&&_0x3acf6c[_0x78c7('0xe')][_0x78c7('0x1f')]?_0x3acf6c[_0x78c7('0xe')][_0x78c7('0x1f')]:'');},'ignoreRoute':function(_0x1c0400){var _0x4941a3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4941a3[_0x78c7('0x20')](_0x1c0400['url']);}}));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x21'),require(_0x78c7('0x22')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x23'),require(_0x78c7('0x24')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x25'),require(_0x78c7('0x26')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x27'),require(_0x78c7('0x28')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x29'),require(_0x78c7('0x2a')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x2b'),require(_0x78c7('0x2c')));_0x5dad3d['use'](_0x78c7('0x2d'),require(_0x78c7('0x2e')));_0x5dad3d['use'](_0x78c7('0x2f'),require(_0x78c7('0x30')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x31'),require(_0x78c7('0x32')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x33'),require(_0x78c7('0x34')));_0x5dad3d[_0x78c7('0xb')]('/api/voice/calls/reports',require(_0x78c7('0x35')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x36'),require(_0x78c7('0x37')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x38'),require('./api/voiceAgentReport'));_0x5dad3d[_0x78c7('0xb')]('/api/voice/queues/reports',require(_0x78c7('0x39')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x3a'),require('./api/memberReport'));_0x5dad3d[_0x78c7('0xb')]('/api/trunks',require(_0x78c7('0x3b')));_0x5dad3d[_0x78c7('0xb')]('/api/voice/transfers/reports',require(_0x78c7('0x3c')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x3d'),require(_0x78c7('0x3e')));_0x5dad3d[_0x78c7('0xb')]('/api/mail/accounts',require(_0x78c7('0x3f')));_0x5dad3d['use'](_0x78c7('0x40'),require(_0x78c7('0x41')));_0x5dad3d[_0x78c7('0xb')]('/api/mail/substatuses',require(_0x78c7('0x42')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x43'),require(_0x78c7('0x44')));_0x5dad3d[_0x78c7('0xb')]('/api/mail/messages',require(_0x78c7('0x45')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x46'),require(_0x78c7('0x47')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x48'),require(_0x78c7('0x49')));_0x5dad3d['use'](_0x78c7('0x4a'),require(_0x78c7('0x4b')));_0x5dad3d['use'](_0x78c7('0x4c'),require(_0x78c7('0x4d')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x4e'),require(_0x78c7('0x4f')));_0x5dad3d[_0x78c7('0xb')]('/api/fax/applications',require(_0x78c7('0x50')));_0x5dad3d[_0x78c7('0xb')]('/api/fax/interactions',require(_0x78c7('0x51')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x52'),require(_0x78c7('0x53')));_0x5dad3d[_0x78c7('0xb')]('/api/fax/queues',require(_0x78c7('0x54')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x55'),require(_0x78c7('0x56')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x57'),require(_0x78c7('0x58')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x59'),require(_0x78c7('0x5a')));_0x5dad3d[_0x78c7('0xb')]('/api/sms/interactions',require('./api/smsInteraction'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x5b'),require('./api/smsMessage'));_0x5dad3d['use'](_0x78c7('0x5c'),require('./api/smsQueue'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x5d'),require(_0x78c7('0x5e')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x5f'),require(_0x78c7('0x60')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x61'),require(_0x78c7('0x62')));_0x5dad3d['use'](_0x78c7('0x63'),require(_0x78c7('0x64')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x65'),require('./api/openchannelQueue'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x66'),require(_0x78c7('0x67')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x68'),require(_0x78c7('0x69')));_0x5dad3d['use']('/api/chat/applications',require(_0x78c7('0x6a')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x6b'),require(_0x78c7('0x6c')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x6d'),require(_0x78c7('0x6e')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x6f'),require(_0x78c7('0x70')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x71'),require(_0x78c7('0x72')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x73'),require(_0x78c7('0x74')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x75'),require(_0x78c7('0x76')));_0x5dad3d['use'](_0x78c7('0x77'),require(_0x78c7('0x78')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x79'),require('./api/cmContact'));_0x5dad3d['use'](_0x78c7('0x7a'),require(_0x78c7('0x7b')));_0x5dad3d['use'](_0x78c7('0x7c'),require(_0x78c7('0x7d')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x7e'),require(_0x78c7('0x7f')));_0x5dad3d['use'](_0x78c7('0x80'),require('./api/cmHopperHistory'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x81'),require(_0x78c7('0x82')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x83'),require('./api/action'));_0x5dad3d[_0x78c7('0xb')]('/api/automations',require('./api/automation'));_0x5dad3d['use']('/api/canned_answers',require(_0x78c7('0x84')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x85'),require('./api/disposition'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x86'),require(_0x78c7('0x87')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x88'),require(_0x78c7('0x89')));_0x5dad3d['use'](_0x78c7('0x8a'),require(_0x78c7('0x8b')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x8c'),require(_0x78c7('0x8d')));_0x5dad3d[_0x78c7('0xb')]('/api/voiceQueuesLog',require(_0x78c7('0x8e')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x8f'),require('./api/schedule'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x90'),require(_0x78c7('0x91')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x92'),require(_0x78c7('0x93')));_0x5dad3d['use'](_0x78c7('0x94'),require(_0x78c7('0x95')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x96'),require(_0x78c7('0x97')));_0x5dad3d[_0x78c7('0xb')]('/api/variables',require(_0x78c7('0x98')));_0x5dad3d['use'](_0x78c7('0x99'),require(_0x78c7('0x9a')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x9b'),require(_0x78c7('0x9c')));_0x5dad3d['use'](_0x78c7('0x9d'),require('./api/analyticCustomReport'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x9e'),require('./api/analyticDefaultReport'));_0x5dad3d['use'](_0x78c7('0x9f'),require('./api/analyticExtractedReport'));_0x5dad3d[_0x78c7('0xb')]('/api/analytics/metrics',require(_0x78c7('0xa0')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xa1'),require('./api/analyticFieldReport'));_0x5dad3d['use'](_0x78c7('0xa2'),require(_0x78c7('0xa3')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xa4'),require(_0x78c7('0xa5')));_0x5dad3d['use'](_0x78c7('0xa6'),require('./api/intSalesforceConfiguration'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xa7'),require(_0x78c7('0xa8')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xa9'),require(_0x78c7('0xaa')));_0x5dad3d[_0x78c7('0xb')]('/api/integrations/sugarcrm/configurations',require(_0x78c7('0xab')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xac'),require(_0x78c7('0xad')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xae'),require('./api/intDeskAccount'));_0x5dad3d[_0x78c7('0xb')]('/api/integrations/desk/configurations',require(_0x78c7('0xaf')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xb0'),require(_0x78c7('0xb1')));_0x5dad3d['use']('/api/integrations/zoho/accounts',require(_0x78c7('0xb2')));_0x5dad3d[_0x78c7('0xb')]('/api/integrations/zoho/configurations',require(_0x78c7('0xb3')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xb4'),require(_0x78c7('0xb5')));_0x5dad3d[_0x78c7('0xb')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xb6'),require('./api/intZendeskConfiguration'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xb7'),require(_0x78c7('0xb8')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xb9'),require('./api/intFreshdeskAccount'));_0x5dad3d['use'](_0x78c7('0xba'),require(_0x78c7('0xbb')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xbc'),require(_0x78c7('0xbd')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xbe'),require(_0x78c7('0xbf')));_0x5dad3d['use'](_0x78c7('0xc0'),require(_0x78c7('0xc1')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xc2'),require('./api/intVtigerField'));_0x5dad3d['use']('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xc3'),require('./api/intServicenowConfiguration'));_0x5dad3d['use'](_0x78c7('0xc4'),require('./api/intServicenowField'));_0x5dad3d[_0x78c7('0xb')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xc5'),require(_0x78c7('0xc6')));_0x5dad3d['use'](_0x78c7('0xc7'),require('./api/intDynamics365Field'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xc8'),require(_0x78c7('0xc9')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xca'),require(_0x78c7('0xcb')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xcc'),require(_0x78c7('0xcd')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xce'),require(_0x78c7('0xcf')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xd0'),require(_0x78c7('0xd1')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xd2'),require(_0x78c7('0xd3')));_0x5dad3d[_0x78c7('0xb')]('/api/jscripty/answers/reports',require(_0x78c7('0xd4')));_0x5dad3d['use'](_0x78c7('0xd5'),require('./api/jscriptyQuestionReport'));_0x5dad3d['use'](_0x78c7('0xd6'),require(_0x78c7('0xd7')));_0x5dad3d[_0x78c7('0xb')]('/api/sms/reports/queue',require(_0x78c7('0xd8')));_0x5dad3d[_0x78c7('0xb')]('/api/square/reports',require('./api/squareReport'));_0x5dad3d['use']('/api/square/details/reports',require(_0x78c7('0xd9')));_0x5dad3d['use']('/api/jscripty/projects',require(_0x78c7('0xda')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xdb'),require(_0x78c7('0xdc')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xdd'),require(_0x78c7('0xde')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xdf'),require(_0x78c7('0xe0')));_0x5dad3d[_0x78c7('0xb')]('/api/square/recordings',require(_0x78c7('0xe1')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xe2'),require(_0x78c7('0xe3')));_0x5dad3d[_0x78c7('0xb')]('/api/teams',require(_0x78c7('0xe4')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xe5'),require(_0x78c7('0xe6')));_0x5dad3d[_0x78c7('0xb')]('/api/campaigns',require(_0x78c7('0xe7')));_0x5dad3d[_0x78c7('0xb')]('/api/migrations',require(_0x78c7('0xe8')));_0x5dad3d[_0x78c7('0xb')]('/api/attachments',require(_0x78c7('0xe9')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xea'),require('./api/plugin'));_0x5dad3d['use'](_0x78c7('0xeb'),require(_0x78c7('0xec')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xed'),require(_0x78c7('0xee')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xef'),require(_0x78c7('0xf0')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xf1'),require('./api/openchannelTransferReport'));_0x5dad3d[_0x78c7('0xb')]('/api/sms/reports/transfer',require(_0x78c7('0xf2')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xf3'),require(_0x78c7('0xf4')));_0x5dad3d['use'](_0x78c7('0xf5'),require(_0x78c7('0xf6')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xf7'),require(_0x78c7('0xf8')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xf9'),require('./api/userProfileSection'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xfa'),require(_0x78c7('0xfb')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xfc'),require('./api/userNotification'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xfd'),require(_0x78c7('0xfe')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0xff'),require(_0x78c7('0x100')));_0x5dad3d['use'](_0x78c7('0x101'),require('./api/whatsappInteraction'));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x102'),require(_0x78c7('0x103')));_0x5dad3d['use'](_0x78c7('0x104'),require(_0x78c7('0x105')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x106'),require(_0x78c7('0x107')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x108'),require(_0x78c7('0x109')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x10a'),require(_0x78c7('0x10b')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x10c'),require(_0x78c7('0x10d')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x10e'),require(_0x78c7('0x10f')));_0x5dad3d[_0x78c7('0xb')]('/api/auth/google',require(_0x78c7('0x110')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x111'),require(_0x78c7('0x112')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x113'),require(_0x78c7('0x114')));_0x5dad3d[_0x78c7('0xb')]('/api/version',require(_0x78c7('0x115')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x116'),require(_0x78c7('0x117')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x118'),require(_0x78c7('0x119')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x11a'),require(_0x78c7('0x11b')));_0x5dad3d[_0x78c7('0xb')]('/apidoc',express[_0x78c7('0x11c')](path[_0x78c7('0x11d')](config[_0x78c7('0x11e')],_0x78c7('0x11f'))));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x120'),express[_0x78c7('0x11c')](path[_0x78c7('0x11d')](config[_0x78c7('0x11e')],_0x78c7('0x120'))));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x121'),express['static'](path['join'](config['root'],_0x78c7('0x121'))));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x122'),express[_0x78c7('0x11c')](path[_0x78c7('0x11d')](config[_0x78c7('0x11e')],_0x78c7('0x123'),'3.0.0')));_0x5dad3d[_0x78c7('0xb')](_0x78c7('0x124'),express[_0x78c7('0x11c')](path['join'](config['root'],_0x78c7('0x125'))));_0x5dad3d[_0x78c7('0x126')](_0x78c7('0x127'))['get'](errors[0x194]);_0x5dad3d[_0x78c7('0x126')]('/*')[_0x78c7('0x128')](function(_0x277b02,_0x43056f){_0x43056f[_0x78c7('0x129')](path[_0x78c7('0x12a')](_0x5dad3d[_0x78c7('0x128')]('appPath')+_0x78c7('0x12b')));});};var sensitiveFields=[_0x78c7('0x12c'),_0x78c7('0x12d'),_0x78c7('0x12e'),_0x78c7('0x12f'),_0x78c7('0x130'),_0x78c7('0x131'),'street',_0x78c7('0x132'),_0x78c7('0x133'),_0x78c7('0x134'),_0x78c7('0x135'),'clientId',_0x78c7('0x136'),_0x78c7('0x137'),'code',_0x78c7('0x138'),_0x78c7('0x139'),_0x78c7('0x13a'),_0x78c7('0x13b'),_0x78c7('0x13c'),_0x78c7('0x13d'),_0x78c7('0x13e'),'consumerKey',_0x78c7('0x13f'),'membername','calleridname',_0x78c7('0x140'),_0x78c7('0x141'),'vidaooApiKey',_0x78c7('0x142'),'privateKey','accesskeyid',_0x78c7('0x143'),_0x78c7('0x144'),_0x78c7('0x15'),_0x78c7('0x145'),_0x78c7('0x146'),'localstationid',_0x78c7('0x147'),_0x78c7('0x148'),_0x78c7('0x149'),_0x78c7('0x14a')];function maskSensitiveData(_0xa56bcf){var _0xea41c7=/(?!^)[\s\S](?!$)/g;if(!_[_0x78c7('0x14b')](_0xa56bcf))return;for(var _0x2bb6d7 in _0xa56bcf){if(_[_0x78c7('0x14c')](_0xa56bcf[_0x2bb6d7])){for(var _0x29434f=0x0;_0x29434f<_0xa56bcf[_0x2bb6d7]['length'];_0x29434f++){maskSensitiveData(_0xa56bcf[_0x2bb6d7][_0x29434f]);}}else if(_[_0x78c7('0x14b')](_0xa56bcf[_0x2bb6d7])){maskSensitiveData(_0xa56bcf[_0x2bb6d7]);}else if(_['isString'](_0xa56bcf[_0x2bb6d7])){_0xa56bcf[_0x2bb6d7]=_0xa56bcf[_0x2bb6d7][_0x78c7('0x14d')](/{{{/g,_0x78c7('0x14e'))[_0x78c7('0x14d')](/}}}/g,_0x78c7('0x14f'))[_0x78c7('0x14d')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x78c7('0x150')](sensitiveFields,_0x2bb6d7)){_0xa56bcf[_0x2bb6d7]=_0xa56bcf[_0x2bb6d7][_0x78c7('0x14d')](_0xea41c7,'*');}}}} \ No newline at end of file +var _0x9cbc=['./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/realtime','./api/realtime','./api/authLocal','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','route','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','apiKey','street','mobile','fax','email','clientId','clientSecret','securityToken','accessKey','tenantId','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridnum','vidaooApiKey','clientEmail','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isArray','isPlainObject','isString','replace','@@{','}@@','lodash','express','express-winston','./errors','./config/environment','./config/logger','api','safeTemplate','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','user','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','name','other','agent_name','test','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/template','/api/triggers','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport'];(function(_0x5d48b3,_0x2a69c4){var _0x3ee3fd=function(_0x54e0b6){while(--_0x54e0b6){_0x5d48b3['push'](_0x5d48b3['shift']());}};_0x3ee3fd(++_0x2a69c4);}(_0x9cbc,0x1f2));var _0xc9cb=function(_0x3ec5a3,_0x40cac0){_0x3ec5a3=_0x3ec5a3-0x0;var _0x3bc8dc=_0x9cbc[_0x3ec5a3];return _0x3bc8dc;};'use strict';var _=require(_0xc9cb('0x0'));var path=require('path');var express=require(_0xc9cb('0x1'));var ewinston=require(_0xc9cb('0x2'));var util=require('util');var errors=require(_0xc9cb('0x3'));var config=require(_0xc9cb('0x4'));var logger=require(_0xc9cb('0x5'))(_0xc9cb('0x6'));var authLogger=require(_0xc9cb('0x5'))('auth');var safeTemplate=require('./safe-template')[_0xc9cb('0x7')];exports[_0xc9cb('0x8')]=function(_0x3dd502){_0x3dd502[_0xc9cb('0x9')](ewinston[_0xc9cb('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x18f052,_0x71a694){var _0x2461f8=_0xc9cb('0xb');if(!_['isEmpty'](_0x18f052[_0xc9cb('0xc')])){_0x2461f8+=_0xc9cb('0xd');var _0x21dfcd=_0x18f052['body'];maskSensitiveData(_0x21dfcd);}return safeTemplate(util[_0xc9cb('0xe')](_0x2461f8,_0x18f052[_0xc9cb('0xf')],_0x18f052[_0xc9cb('0x10')][_0xc9cb('0x11')]?_0x18f052[_0xc9cb('0x10')][_0xc9cb('0x11')]:_0x18f052['connection'][_0xc9cb('0x12')]||_0x18f052['ip'],_0x18f052[_0xc9cb('0x13')],_0x71a694[_0xc9cb('0x14')],_0x71a694[_0xc9cb('0x15')],_0x18f052['user']?_0x18f052['user']['id']:null,_0x18f052[_0xc9cb('0x16')]?_0x18f052[_0xc9cb('0x16')]['name']:null,_0x18f052[_0xc9cb('0x16')]?_0x18f052[_0xc9cb('0x16')][_0xc9cb('0x17')]:null,_0x21dfcd?util['inspect'](_0x21dfcd,![],null):''));}}));_0x3dd502[_0xc9cb('0x9')](ewinston[_0xc9cb('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x41a7e8,_0x5cb62f){var _0x4e5dcf=_0xc9cb('0x18');if(_0x41a7e8[_0xc9cb('0xc')]&&_0x41a7e8['body'][_0xc9cb('0x19')]&&_0x41a7e8['body'][_0xc9cb('0x1a')]){_0x4e5dcf=_0xc9cb('0x1b');}return util['format'](_0x4e5dcf,_0x41a7e8[_0xc9cb('0xf')],_0x41a7e8[_0xc9cb('0x10')]['x-forwarded-for']?_0x41a7e8['headers'][_0xc9cb('0x11')]:_0x41a7e8[_0xc9cb('0x1c')]['remoteAddress']||_0x41a7e8['ip'],_0x41a7e8[_0xc9cb('0x13')],_0x5cb62f[_0xc9cb('0x14')],_0x5cb62f[_0xc9cb('0x15')],_0x41a7e8[_0xc9cb('0x16')]?_0x41a7e8['user']['id']:null,_0x41a7e8[_0xc9cb('0x16')]?_0x41a7e8[_0xc9cb('0x16')][_0xc9cb('0x1d')]:null,_0x41a7e8['user']?_0x41a7e8[_0xc9cb('0x16')][_0xc9cb('0x17')]:null,_0x41a7e8['body']&&_0x41a7e8[_0xc9cb('0xc')][_0xc9cb('0x19')]?_0x41a7e8[_0xc9cb('0xc')][_0xc9cb('0x19')]:_0xc9cb('0x1e'),_0x41a7e8[_0xc9cb('0xc')]&&_0x41a7e8['body'][_0xc9cb('0x1a')]?_0x41a7e8[_0xc9cb('0xc')][_0xc9cb('0x1a')]:'',_0x41a7e8['body']&&_0x41a7e8[_0xc9cb('0xc')][_0xc9cb('0x1f')]?_0x41a7e8[_0xc9cb('0xc')][_0xc9cb('0x1f')]:'');},'ignoreRoute':function(_0x2211c9){var _0x1fcf3c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1fcf3c[_0xc9cb('0x20')](_0x2211c9[_0xc9cb('0x13')]);}}));_0x3dd502[_0xc9cb('0x9')]('/api/users',require('./api/user'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x21'),require(_0xc9cb('0x22')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x23'),require('./api/voiceContext'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x24'),require(_0xc9cb('0x25')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x26'),require(_0xc9cb('0x27')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x28'),require(_0xc9cb('0x29')));_0x3dd502['use']('/api/voice/recordings',require(_0xc9cb('0x2a')));_0x3dd502['use'](_0xc9cb('0x2b'),require('./api/screenRecording'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x2c'),require(_0xc9cb('0x2d')));_0x3dd502[_0xc9cb('0x9')]('/api/voice/mails/messages',require(_0xc9cb('0x2e')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x2f'),require('./api/voiceCallReport'));_0x3dd502[_0xc9cb('0x9')]('/api/voice/dials/reports',require(_0xc9cb('0x30')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x31'),require(_0xc9cb('0x32')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x33'),require(_0xc9cb('0x34')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x35'),require(_0xc9cb('0x36')));_0x3dd502['use'](_0xc9cb('0x37'),require('./api/trunk'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x38'),require(_0xc9cb('0x39')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x3a'),require(_0xc9cb('0x3b')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x3c'),require(_0xc9cb('0x3d')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x3e'),require(_0xc9cb('0x3f')));_0x3dd502['use'](_0xc9cb('0x40'),require(_0xc9cb('0x41')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x42'),require(_0xc9cb('0x43')));_0x3dd502[_0xc9cb('0x9')]('/api/mail/messages',require(_0xc9cb('0x44')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x45'),require(_0xc9cb('0x46')));_0x3dd502[_0xc9cb('0x9')]('/api/mail/reports/queue',require(_0xc9cb('0x47')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x48'),require(_0xc9cb('0x49')));_0x3dd502['use']('/api/dashboards/items',require(_0xc9cb('0x4a')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x4b'),require(_0xc9cb('0x4c')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x4d'),require(_0xc9cb('0x4e')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x4f'),require(_0xc9cb('0x50')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x51'),require(_0xc9cb('0x52')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x53'),require(_0xc9cb('0x54')));_0x3dd502['use'](_0xc9cb('0x55'),require(_0xc9cb('0x56')));_0x3dd502['use'](_0xc9cb('0x57'),require(_0xc9cb('0x58')));_0x3dd502[_0xc9cb('0x9')]('/api/sms/applications',require(_0xc9cb('0x59')));_0x3dd502['use'](_0xc9cb('0x5a'),require(_0xc9cb('0x5b')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x5c'),require('./api/smsMessage'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x5d'),require(_0xc9cb('0x5e')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x5f'),require(_0xc9cb('0x60')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x61'),require(_0xc9cb('0x62')));_0x3dd502['use']('/api/openchannel/interactions',require(_0xc9cb('0x63')));_0x3dd502['use'](_0xc9cb('0x64'),require(_0xc9cb('0x65')));_0x3dd502[_0xc9cb('0x9')]('/api/openchannel/queues',require(_0xc9cb('0x66')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x67'),require(_0xc9cb('0x68')));_0x3dd502[_0xc9cb('0x9')]('/api/openchannel/reports/queue',require(_0xc9cb('0x69')));_0x3dd502['use'](_0xc9cb('0x6a'),require(_0xc9cb('0x6b')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x6c'),require('./api/chatInteraction'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x6d'),require(_0xc9cb('0x6e')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x6f'),require(_0xc9cb('0x70')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x71'),require(_0xc9cb('0x72')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x73'),require(_0xc9cb('0x74')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x75'),require(_0xc9cb('0x76')));_0x3dd502['use'](_0xc9cb('0x77'),require(_0xc9cb('0x78')));_0x3dd502['use'](_0xc9cb('0x79'),require(_0xc9cb('0x7a')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x7b'),require(_0xc9cb('0x7c')));_0x3dd502['use'](_0xc9cb('0x7d'),require(_0xc9cb('0x7e')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x7f'),require(_0xc9cb('0x80')));_0x3dd502[_0xc9cb('0x9')]('/api/cm/hopper_history',require(_0xc9cb('0x81')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x82'),require('./api/cmCustomField'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x83'),require(_0xc9cb('0x84')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x85'),require(_0xc9cb('0x86')));_0x3dd502[_0xc9cb('0x9')]('/api/canned_answers',require(_0xc9cb('0x87')));_0x3dd502['use']('/api/dispositions',require(_0xc9cb('0x88')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x89'),require(_0xc9cb('0x8a')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x8b'),require(_0xc9cb('0x8c')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x8d'),require(_0xc9cb('0x8e')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x8f'),require('./api/cdr'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x90'),require(_0xc9cb('0x91')));_0x3dd502['use'](_0xc9cb('0x92'),require(_0xc9cb('0x93')));_0x3dd502['use'](_0xc9cb('0x94'),require(_0xc9cb('0x95')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x96'),require(_0xc9cb('0x97')));_0x3dd502[_0xc9cb('0x9')]('/api/templates',require(_0xc9cb('0x98')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x99'),require('./api/trigger'));_0x3dd502[_0xc9cb('0x9')]('/api/variables',require(_0xc9cb('0x9a')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x9b'),require(_0xc9cb('0x9c')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x9d'),require(_0xc9cb('0x9e')));_0x3dd502[_0xc9cb('0x9')]('/api/analytics/custom_reports',require(_0xc9cb('0x9f')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xa0'),require(_0xc9cb('0xa1')));_0x3dd502['use']('/api/analytics/extracted_reports',require(_0xc9cb('0xa2')));_0x3dd502['use'](_0xc9cb('0xa3'),require(_0xc9cb('0xa4')));_0x3dd502['use'](_0xc9cb('0xa5'),require(_0xc9cb('0xa6')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xa7'),require(_0xc9cb('0xa8')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xa9'),require('./api/intSalesforceAccount'));_0x3dd502[_0xc9cb('0x9')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x3dd502['use'](_0xc9cb('0xaa'),require('./api/intSalesforceField'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xab'),require(_0xc9cb('0xac')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xad'),require(_0xc9cb('0xae')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xaf'),require(_0xc9cb('0xb0')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xb1'),require(_0xc9cb('0xb2')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xb3'),require(_0xc9cb('0xb4')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xb5'),require('./api/intDeskField'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xb6'),require(_0xc9cb('0xb7')));_0x3dd502['use'](_0xc9cb('0xb8'),require(_0xc9cb('0xb9')));_0x3dd502['use'](_0xc9cb('0xba'),require(_0xc9cb('0xbb')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xbc'),require('./api/intZendeskAccount'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xbd'),require(_0xc9cb('0xbe')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xbf'),require(_0xc9cb('0xc0')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xc1'),require('./api/intFreshdeskAccount'));_0x3dd502[_0xc9cb('0x9')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xc2'),require('./api/intFreshdeskField'));_0x3dd502[_0xc9cb('0x9')]('/api/integrations/vtiger/accounts',require(_0xc9cb('0xc3')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xc4'),require(_0xc9cb('0xc5')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xc6'),require(_0xc9cb('0xc7')));_0x3dd502['use'](_0xc9cb('0xc8'),require(_0xc9cb('0xc9')));_0x3dd502[_0xc9cb('0x9')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x3dd502[_0xc9cb('0x9')]('/api/integrations/servicenow/fields',require(_0xc9cb('0xca')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xcb'),require(_0xc9cb('0xcc')));_0x3dd502[_0xc9cb('0x9')]('/api/integrations/dynamics365/configurations',require(_0xc9cb('0xcd')));_0x3dd502[_0xc9cb('0x9')]('/api/integrations/dynamics365/fields',require(_0xc9cb('0xce')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xcf'),require(_0xc9cb('0xd0')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xd1'),require('./api/intFreshsalesConfiguration'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xd2'),require('./api/intFreshsalesField'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xd3'),require(_0xc9cb('0xd4')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xd5'),require(_0xc9cb('0xd6')));_0x3dd502['use']('/api/chat/internal/messages',require(_0xc9cb('0xd7')));_0x3dd502['use'](_0xc9cb('0xd8'),require(_0xc9cb('0xd9')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xda'),require(_0xc9cb('0xdb')));_0x3dd502['use']('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x3dd502['use'](_0xc9cb('0xdc'),require(_0xc9cb('0xdd')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xde'),require(_0xc9cb('0xdf')));_0x3dd502[_0xc9cb('0x9')]('/api/square/details/reports',require(_0xc9cb('0xe0')));_0x3dd502[_0xc9cb('0x9')]('/api/jscripty/projects',require(_0xc9cb('0xe1')));_0x3dd502['use'](_0xc9cb('0xe2'),require(_0xc9cb('0xe3')));_0x3dd502['use'](_0xc9cb('0xe4'),require('./api/squareOdbc'));_0x3dd502['use'](_0xc9cb('0xe5'),require(_0xc9cb('0xe6')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xe7'),require(_0xc9cb('0xe8')));_0x3dd502[_0xc9cb('0x9')]('/api/square/messages',require(_0xc9cb('0xe9')));_0x3dd502[_0xc9cb('0x9')]('/api/teams',require(_0xc9cb('0xea')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xeb'),require(_0xc9cb('0xec')));_0x3dd502[_0xc9cb('0x9')]('/api/campaigns',require('./api/campaign'));_0x3dd502[_0xc9cb('0x9')]('/api/migrations',require('./api/migration'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xed'),require(_0xc9cb('0xee')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xef'),require(_0xc9cb('0xf0')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xf1'),require(_0xc9cb('0xf2')));_0x3dd502['use']('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xf3'),require('./api/faxTransferReport'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xf4'),require(_0xc9cb('0xf5')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xf6'),require(_0xc9cb('0xf7')));_0x3dd502['use'](_0xc9cb('0xf8'),require(_0xc9cb('0xf9')));_0x3dd502[_0xc9cb('0x9')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x3dd502[_0xc9cb('0x9')]('/api/userProfiles',require('./api/userProfile'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xfa'),require(_0xc9cb('0xfb')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xfc'),require('./api/userProfileResource'));_0x3dd502[_0xc9cb('0x9')]('/api/userNotifications',require('./api/userNotification'));_0x3dd502[_0xc9cb('0x9')]('/api/whatsapp/accounts',require(_0xc9cb('0xfd')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0xfe'),require(_0xc9cb('0xff')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x100'),require(_0xc9cb('0x101')));_0x3dd502[_0xc9cb('0x9')]('/api/whatsapp/messages',require(_0xc9cb('0x102')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x103'),require('./api/whatsappQueueReport'));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x104'),require(_0xc9cb('0x105')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x106'),require(_0xc9cb('0x107')));_0x3dd502[_0xc9cb('0x9')]('/api/cloudProviders',require('./api/cloudProvider'));_0x3dd502['use'](_0xc9cb('0x108'),require(_0xc9cb('0x109')));_0x3dd502[_0xc9cb('0x9')]('/api/auth/local',require(_0xc9cb('0x10a')));_0x3dd502['use']('/api/auth/google',require(_0xc9cb('0x10b')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x10c'),require(_0xc9cb('0x10d')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x10e'),require(_0xc9cb('0x10f')));_0x3dd502['use'](_0xc9cb('0x110'),require('./api/version'));_0x3dd502['use'](_0xc9cb('0x111'),require(_0xc9cb('0x112')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x113'),require(_0xc9cb('0x114')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x115'),require(_0xc9cb('0x116')));_0x3dd502['use'](_0xc9cb('0x117'),express[_0xc9cb('0x118')](path[_0xc9cb('0x119')](config[_0xc9cb('0x11a')],_0xc9cb('0x117'))));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x11b'),express[_0xc9cb('0x118')](path[_0xc9cb('0x119')](config['root'],'/www')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x11c'),express[_0xc9cb('0x118')](path['join'](config[_0xc9cb('0x11a')],_0xc9cb('0x11c'))));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x11d'),express[_0xc9cb('0x118')](path[_0xc9cb('0x119')](config['root'],_0xc9cb('0x11e'),'3.0.0')));_0x3dd502[_0xc9cb('0x9')](_0xc9cb('0x11f'),express[_0xc9cb('0x118')](path[_0xc9cb('0x119')](config[_0xc9cb('0x11a')],'/server/files/plugins')));_0x3dd502[_0xc9cb('0x120')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xc9cb('0x121')](errors[0x194]);_0x3dd502[_0xc9cb('0x120')]('/*')[_0xc9cb('0x121')](function(_0x1e644e,_0x302e3d){_0x302e3d[_0xc9cb('0x122')](path[_0xc9cb('0x123')](_0x3dd502[_0xc9cb('0x121')](_0xc9cb('0x124'))+_0xc9cb('0x125')));});};var sensitiveFields=[_0xc9cb('0x126'),_0xc9cb('0x127'),_0xc9cb('0x128'),_0xc9cb('0x129'),'firstName','lastName',_0xc9cb('0x12a'),'phone',_0xc9cb('0x12b'),_0xc9cb('0x12c'),_0xc9cb('0x12d'),_0xc9cb('0x12e'),_0xc9cb('0x12f'),_0xc9cb('0x130'),'code',_0xc9cb('0x131'),_0xc9cb('0x132'),_0xc9cb('0x133'),'channelSecret','accessToken',_0xc9cb('0x134'),_0xc9cb('0x135'),_0xc9cb('0x136'),_0xc9cb('0x137'),_0xc9cb('0x138'),'calleridname',_0xc9cb('0x139'),'exten',_0xc9cb('0x13a'),_0xc9cb('0x13b'),'privateKey','accesskeyid','secretaccesskey',_0xc9cb('0x13c'),'user',_0xc9cb('0x13d'),_0xc9cb('0x13e'),_0xc9cb('0x13f'),_0xc9cb('0x140'),_0xc9cb('0x141'),_0xc9cb('0x142'),_0xc9cb('0x143')];function maskSensitiveData(_0xa1866f){var _0x587309=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0xa1866f))return;for(var _0x53c662 in _0xa1866f){if(_[_0xc9cb('0x144')](_0xa1866f[_0x53c662])){for(var _0xe2e2e7=0x0;_0xe2e2e7<_0xa1866f[_0x53c662]['length'];_0xe2e2e7++){maskSensitiveData(_0xa1866f[_0x53c662][_0xe2e2e7]);}}else if(_[_0xc9cb('0x145')](_0xa1866f[_0x53c662])){maskSensitiveData(_0xa1866f[_0x53c662]);}else if(_[_0xc9cb('0x146')](_0xa1866f[_0x53c662])){_0xa1866f[_0x53c662]=_0xa1866f[_0x53c662][_0xc9cb('0x147')](/{{{/g,_0xc9cb('0x148'))[_0xc9cb('0x147')](/}}}/g,_0xc9cb('0x149'))[_0xc9cb('0x147')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x53c662)){_0xa1866f[_0x53c662]=_0xa1866f[_0x53c662]['replace'](_0x587309,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index f3462c0..99f7492 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17d0=['../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc'];(function(_0xb851d7,_0x40b34a){var _0x5ad0f3=function(_0x185dcc){while(--_0x185dcc){_0xb851d7['push'](_0xb851d7['shift']());}};_0x5ad0f3(++_0x40b34a);}(_0x17d0,0x17f));var _0x017d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x17d0[_0x21a9d9];return _0x46adce;};'use strict';var jayson=require(_0x017d('0x0'));var BPromise=require(_0x017d('0x1'));var _=require('lodash');var config=require(_0x017d('0x2'));exports[_0x017d('0x3')]=function(){return new BPromise(function(_0x3a4dff,_0x5d45f8){var _0x45a8e5={};_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x5')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require('../api/voiceExtension/voiceExtension.rpc'));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x6')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x7')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x8')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x9')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0xa')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require('../api/trunk/trunk.rpc'));_0x45a8e5=_['merge'](_0x45a8e5,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0xb')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0xc')));_0x45a8e5=_['merge'](_0x45a8e5,require(_0x017d('0xd')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0xe')));_0x45a8e5=_['merge'](_0x45a8e5,require(_0x017d('0xf')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x10')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x11')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x12')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x13')));_0x45a8e5=_['merge'](_0x45a8e5,require('../api/faxInteraction/faxInteraction.rpc'));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x14')));_0x45a8e5=_['merge'](_0x45a8e5,require(_0x017d('0x15')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x16')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x17')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require('../api/smsInteraction/smsInteraction.rpc'));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x18')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x19')));_0x45a8e5=_['merge'](_0x45a8e5,require(_0x017d('0x1a')));_0x45a8e5=_['merge'](_0x45a8e5,require(_0x017d('0x1b')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x1c')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x45a8e5=_['merge'](_0x45a8e5,require(_0x017d('0x1d')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x1e')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require('../api/chatQueue/chatQueue.rpc'));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x1f')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x20')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x21')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x45a8e5=_['merge'](_0x45a8e5,require(_0x017d('0x22')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x23')));_0x45a8e5=_['merge'](_0x45a8e5,require(_0x017d('0x24')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x25')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x26')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x27')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x28')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require('../api/variable/variable.rpc'));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x29')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x2a')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x2b')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x2c')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x2d')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x2e')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x2f')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x30')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x31')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x32')));_0x45a8e5=_['merge'](_0x45a8e5,require(_0x017d('0x33')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x45a8e5=_['merge'](_0x45a8e5,require(_0x017d('0x34')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x35')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x36')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x37')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x38')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require('../api/squareRecording/squareRecording.rpc'));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x39')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x3a')));_0x45a8e5=_['merge'](_0x45a8e5,require(_0x017d('0x3b')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x3c')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x3d')));_0x45a8e5=_['merge'](_0x45a8e5,require(_0x017d('0x3e')));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x45a8e5=_[_0x017d('0x4')](_0x45a8e5,require(_0x017d('0x3f')));var _0x3a21a9=jayson[_0x017d('0x40')](_0x45a8e5)[_0x017d('0x41')]();var _0xde42ce=config[_0x017d('0x42')]['port']||config['port']+0x1;var _0x375163=config[_0x017d('0x42')]['ip']||_0x017d('0x43');_0x3a21a9['on'](_0x017d('0x44'),function(_0x2c81ea){return _0x5d45f8(_0x2c81ea);});_0x3a21a9[_0x017d('0x3')](_0xde42ce,_0x375163,function(){console[_0x017d('0x45')](_0x017d('0x46'),_0x375163,_0xde42ce);require(_0x017d('0x47'))[_0x017d('0x48')]();return _0x3a4dff(_0x017d('0x49')+_0x375163+':'+_0xde42ce);});});}; \ No newline at end of file +var _0x44e8=['../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','bluebird','lodash','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc'];(function(_0x34390a,_0x122bea){var _0x5d45b9=function(_0x2bcad2){while(--_0x2bcad2){_0x34390a['push'](_0x34390a['shift']());}};_0x5d45b9(++_0x122bea);}(_0x44e8,0x8b));var _0x844e=function(_0x40751d,_0x46f999){_0x40751d=_0x40751d-0x0;var _0x2f9633=_0x44e8[_0x40751d];return _0x2f9633;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x844e('0x0'));var _=require(_0x844e('0x1'));var config=require('../config/environment');exports['listen']=function(){return new BPromise(function(_0x16eb1e,_0x120686){var _0x41cd78={};_0x41cd78=_['merge'](_0x41cd78,require('../api/user/user.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/voiceExtension/voiceExtension.rpc'));_0x41cd78=_['merge'](_0x41cd78,require(_0x844e('0x3')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x4')));_0x41cd78=_['merge'](_0x41cd78,require(_0x844e('0x5')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x6')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x7')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x41cd78=_['merge'](_0x41cd78,require('../api/memberReport/memberReport.rpc'));_0x41cd78=_['merge'](_0x41cd78,require(_0x844e('0x8')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x9')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0xa')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0xb')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0xc')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/mailInteraction/mailInteraction.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0xd')));_0x41cd78=_['merge'](_0x41cd78,require(_0x844e('0xe')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0xf')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x10')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x11')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/faxInteraction/faxInteraction.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/faxMessage/faxMessage.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/faxQueue/faxQueue.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x12')));_0x41cd78=_['merge'](_0x41cd78,require('../api/smsAccount/smsAccount.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x13')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x14')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x15')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x41cd78=_['merge'](_0x41cd78,require(_0x844e('0x16')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x17')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x18')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x19')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x1a')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/cmHopper/cmHopper.rpc'));_0x41cd78=_['merge'](_0x41cd78,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x1b')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x1c')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x1d')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x1e')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x1f')));_0x41cd78=_['merge'](_0x41cd78,require(_0x844e('0x20')));_0x41cd78=_['merge'](_0x41cd78,require(_0x844e('0x21')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x22')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x23')));_0x41cd78=_['merge'](_0x41cd78,require(_0x844e('0x24')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x25')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x26')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x27')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x28')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x29')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x2a')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x2b')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x2c')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/setting/setting.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x2d')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x2e')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x2f')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x30')));_0x41cd78=_['merge'](_0x41cd78,require(_0x844e('0x31')));_0x41cd78=_['merge'](_0x41cd78,require('../api/attachment/attachment.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require('../api/plugin/plugin.rpc'));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x32')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x33')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x34')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x35')));_0x41cd78=_[_0x844e('0x2')](_0x41cd78,require(_0x844e('0x36')));var _0x70cf8e=jayson['server'](_0x41cd78)['http']();var _0xb4ffd0=config[_0x844e('0x37')][_0x844e('0x38')]||config[_0x844e('0x38')]+0x1;var _0x27afc5=config['rpc']['ip']||_0x844e('0x39');_0x70cf8e['on'](_0x844e('0x3a'),function(_0x46ebb3){return _0x120686(_0x46ebb3);});_0x70cf8e['listen'](_0xb4ffd0,_0x27afc5,function(){console[_0x844e('0x3b')](_0x844e('0x3c'),_0x27afc5,_0xb4ffd0);require('../config/triggers')['default']();return _0x16eb1e(_0x844e('0x3d')+_0x27afc5+':'+_0xb4ffd0);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index 934df25..e520464 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13f6=['isArray','map','keys','reduce','lodash','string'];(function(_0x1bba84,_0x55eff0){var _0x36a324=function(_0x406aa4){while(--_0x406aa4){_0x1bba84['push'](_0x1bba84['shift']());}};_0x36a324(++_0x55eff0);}(_0x13f6,0x124));var _0x613f=function(_0x37f592,_0x262aba){_0x37f592=_0x37f592-0x0;var _0x22621f=_0x13f6[_0x37f592];return _0x22621f;};var _=require(_0x613f('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x1844a4){return _0x1844a4==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0xd04cfd){var _0x13b50a=_0xd04cfd;if(typeof _0xd04cfd===_0x613f('0x1')){_0x13b50a=_0xd04cfd['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x613f('0x2')](_0xd04cfd)){_0x13b50a=_0xd04cfd[_0x613f('0x3')](function(_0x20af2f){return safeTemplate(_0x20af2f);});}else if(_['isPlainObject'](_0xd04cfd)){_0x13b50a=Object[_0x613f('0x4')](_0xd04cfd)[_0x613f('0x5')](function(_0x5618fa,_0x4b546b){_0x5618fa[_0x4b546b]=safeTemplate(_0xd04cfd[_0x4b546b]);return _0x5618fa;},{});}return _0x13b50a;}module['exports']['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x9ffd=['{\x20{\x20','string','replace','map','keys','reduce','exports','safeTemplate','lodash'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4e0bc9,_0x551bc4){_0x4e0bc9=_0x4e0bc9-0x0;var _0x340927=_0x9ffd[_0x4e0bc9];return _0x340927;};var _=require(_0xd9ff('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x413161){return _0x413161==='{{'?_0xd9ff('0x1'):'\x20}\x20}';}function safeTemplate(_0x3480c0){var _0x1530b1=_0x3480c0;if(typeof _0x3480c0===_0xd9ff('0x2')){_0x1530b1=_0x3480c0[_0xd9ff('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x3480c0)){_0x1530b1=_0x3480c0[_0xd9ff('0x4')](function(_0x111697){return safeTemplate(_0x111697);});}else if(_['isPlainObject'](_0x3480c0)){_0x1530b1=Object[_0xd9ff('0x5')](_0x3480c0)[_0xd9ff('0x6')](function(_0x13ea8c,_0x270eb2){_0x13ea8c[_0x270eb2]=safeTemplate(_0x3480c0[_0x270eb2]);return _0x13ea8c;},{});}return _0x1530b1;}module[_0xd9ff('0x7')][_0xd9ff('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 79ff0a2..e4f8511 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 _0xdbcd=['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','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','AGI','wait','WAIT','label','exports','util','lodash','./reply','./error','utf8','emit','ready','toLowerCase','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','substr','indexOf','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','command','destroy','inherits','prototype','sendRequest','answer','ANSWER','getData','beep'];(function(_0x1e62e0,_0x176ba3){var _0x1c697e=function(_0x530f5f){while(--_0x530f5f){_0x1e62e0['push'](_0x1e62e0['shift']());}};_0x1c697e(++_0x176ba3);}(_0xdbcd,0x1ba));var _0xddbc=function(_0x13ca9c,_0x5dc846){_0x13ca9c=_0x13ca9c-0x0;var _0x1ace61=_0xdbcd[_0x13ca9c];return _0x1ace61;};'use strict';var util=require(_0xddbc('0x0'));var _=require(_0xddbc('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require(_0xddbc('0x2'));var AGIError=require(_0xddbc('0x3'));function AGIChannel(_0x30c479){var _0x59c52a=this,_0x1ce7da=new AGIReply(),_0x11a04e=![],_0x4816af={};EventEmitter['call'](_0x59c52a);_0x30c479['setEncoding'](_0xddbc('0x4'));_0x30c479['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x1ce7da['setEncoding']('utf8');_0x1ce7da['on']('headers',function(_0x3b637c){for(var _0x2e4dd8 in _0x3b637c){_0x59c52a[_0x2e4dd8]=_0x3b637c[_0x2e4dd8];}_0x59c52a[_0xddbc('0x5')](_0xddbc('0x6'));});_0x1ce7da['on']('line',function(_0x4f90a9){if(_0x4f90a9[_0xddbc('0x7')]()=='hangup'){_0x59c52a[_0xddbc('0x5')]('hangup');return;}if(_0x4f90a9[_0xddbc('0x8')](0x0,0xb)==_0xddbc('0x9')){_0x11a04e=!![];}if(_0x11a04e){_0x4816af['rx']+=_0x4f90a9+'\x0a';if(_0x4f90a9[_0xddbc('0xa')](_0xddbc('0xb'))!=-0x1){_0x11a04e=![];}}else{_0x4816af['rx']=_0x4f90a9;}if(_0x11a04e){return;}if(typeof _0x4816af['cb']==_0xddbc('0xc')){var _0x3fb6bb=_0x4816af['rx'][_0xddbc('0x8')](0x0,0x3),_0x2e0a84=null,_0x4754ca=null;_0x3fb6bb=parseInt(_0x3fb6bb);if(isNaN(_0x3fb6bb)){_0x4816af['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xddbc('0xd')});return;}if(_0x3fb6bb!=0xc8){_0x4816af['cb'](null,{'code':_0x3fb6bb,'result':-0x1,'extra':'KO'});return;}_0x2e0a84=_0x4816af['rx'][_0xddbc('0x8')](0x4)[_0xddbc('0xe')]('result=','');if(_0x2e0a84['indexOf']('\x20')!=-0x1){_0x2e0a84=_0x2e0a84[_0xddbc('0xf')](0x0,_0x2e0a84[_0xddbc('0x10')]('\x20'));}if(_['startsWith'](_0x2e0a84,'-1')){_0x2e0a84=parseInt(_0x2e0a84);}_0x4754ca=_0x4816af['rx']['split']('\x20');if(_0x4754ca[_0xddbc('0x11')]==0x3){_0x4754ca=_0x4754ca[0x2][_0xddbc('0x8')](0x1,_0x4754ca[0x2][_0xddbc('0x11')]-0x1);}else if(_0x4754ca[_0xddbc('0x11')]>0x3){var _0x5427b0=/\((.+)\)/;var _0x52b701=_0x4816af['rx'][_0xddbc('0x12')](_0x5427b0);if(_0x52b701){_0x4754ca=_0x52b701[0x1];}else{_0x4754ca=null;}}else{_0x4754ca=null;}_0x4816af['cb'](null,{'code':_0x3fb6bb,'result':_0x2e0a84,'extra':_0x4754ca});}});_0x30c479['on'](_0xddbc('0x13'),function(_0x5d0a34){_0x59c52a['emit']('error',new AGIError(_0xddbc('0x14'),_0x5d0a34['code']));});_0x30c479['on'](_0xddbc('0x15'),function(){_0x59c52a[_0xddbc('0x5')](_0xddbc('0x15'),new AGIError(_0xddbc('0x16')));});_0x30c479['on'](_0xddbc('0x17'),function(){_0x59c52a[_0xddbc('0x5')]('timeout',new AGIError(_0xddbc('0x18')));_0x30c479['destroy']();});_0x30c479['pipe'](_0x1ce7da);this[_0xddbc('0x19')]=function(_0x480b46,_0xd31251){var _0x480b46=_0x480b46||'',_0xd31251=typeof _0xd31251==_0xddbc('0xc')?_0xd31251:new Function();_0x4816af={'tx':_0x480b46,'rx':'','cb':_0xd31251};_0x30c479['write'](_0x480b46+'\x0a');},this[_0xddbc('0x15')]=function(){_0x30c479[_0xddbc('0x1a')]();};}util[_0xddbc('0x1b')](AGIChannel,EventEmitter);AGIChannel[_0xddbc('0x1c')][_0xddbc('0x1d')]=function(_0x57eb60){return this['command']['sync'](this,_0x57eb60);};AGIChannel[_0xddbc('0x1c')][_0xddbc('0x1e')]=function(){return this[_0xddbc('0x1d')](_0xddbc('0x1f'));};AGIChannel[_0xddbc('0x1c')][_0xddbc('0x20')]=function(_0x177520,_0x58f1af,_0x2a7e0b){_0x177520=_0x177520===undefined?_0xddbc('0x21'):_0x177520;_0x58f1af=_0x58f1af===undefined?'5':_0x58f1af;_0x2a7e0b=_0x2a7e0b===undefined?'1':_0x2a7e0b;return this[_0xddbc('0x1d')](util[_0xddbc('0x22')](_0xddbc('0x23'),_0x177520,_0x58f1af*0x3e8,_0x2a7e0b));};AGIChannel[_0xddbc('0x1c')][_0xddbc('0x24')]=function(_0x56e8a0){_0x56e8a0=_0x56e8a0||_0xddbc('0x25');return this[_0xddbc('0x1d')](util[_0xddbc('0x22')](_0xddbc('0x26'),_0x56e8a0));};AGIChannel['prototype'][_0xddbc('0x27')]=function(_0x56042c,_0x49cc11){if(_[_0xddbc('0x28')](_0x49cc11)){return this[_0xddbc('0x1d')](util[_0xddbc('0x22')](_0xddbc('0x29'),_0x56042c,_0x49cc11[_0xddbc('0x2a')](',')));}return this[_0xddbc('0x1d')](util[_0xddbc('0x22')]('EXEC\x20%s\x20%s',_0x56042c,_0x49cc11));};AGIChannel[_0xddbc('0x1c')]['setContext']=function(_0x3286f1){return this[_0xddbc('0x1d')](util[_0xddbc('0x22')](_0xddbc('0x2b'),_0x3286f1));};AGIChannel[_0xddbc('0x1c')][_0xddbc('0x2c')]=function(_0x3f6e1f){return this[_0xddbc('0x1d')](util['format'](_0xddbc('0x2d'),_0x3f6e1f));};AGIChannel[_0xddbc('0x1c')][_0xddbc('0x2e')]=function(_0x5528da){return this[_0xddbc('0x1d')](util['format'](_0xddbc('0x2f'),_0x5528da));};AGIChannel[_0xddbc('0x1c')]['hangup']=function(){return this[_0xddbc('0x1d')]('HANGUP');};AGIChannel[_0xddbc('0x1c')]['setVariable']=function(_0x5b0a82,_0x363c59){var _0x569cff=_['isBoolean'](_0x363c59)||_[_0xddbc('0x30')](_0x363c59)?_0x363c59[_0xddbc('0x31')]():_0x363c59;return this[_0xddbc('0x1d')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x5b0a82,_0x569cff?_0x569cff[_0xddbc('0x31')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xddbc('0x1c')][_0xddbc('0x32')]=function(_0x44a022,_0xe56e7){return this[_0xddbc('0x1d')](util[_0xddbc('0x22')](_0xddbc('0x33'),_0x44a022,_0xe56e7));};AGIChannel[_0xddbc('0x1c')][_0xddbc('0x34')]=function(_0x9ff701,_0x48da11){return this[_0xddbc('0x1d')](util[_0xddbc('0x22')](_0xddbc('0x35'),_0x9ff701,_0x48da11));};AGIChannel['prototype'][_0xddbc('0x36')]=function(_0xffb700,_0xe3b2e){return this[_0xddbc('0x1d')](util[_0xddbc('0x22')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xffb700,_0xe3b2e));};AGIChannel['prototype'][_0xddbc('0x37')]=function(_0x34e514,_0x468089,_0x125698){_0x468089=_0x468089||this['extension'];_0x125698=_0x125698||0x1;this[_0xddbc('0x38')](_0x34e514);this[_0xddbc('0x2c')](_0x468089);this[_0xddbc('0x2e')](_0x125698);return this[_0xddbc('0x24')](util[_0xddbc('0x22')](_0xddbc('0x39'),_0x34e514,_0x468089,_0x125698));};AGIChannel[_0xddbc('0x1c')][_0xddbc('0x3a')]=function(_0x49be23){return this[_0xddbc('0x1d')](util[_0xddbc('0x22')]('GET\x20VARIABLE\x20\x22%s\x22',_0x49be23));};AGIChannel['prototype'][_0xddbc('0x3b')]=function(_0x402af7,_0x949bb7,_0x462c93,_0x4409eb,_0x575c18,_0x36ca0b){_0x949bb7=_0x949bb7||'wav';_0x462c93=_0x462c93||'';_0x4409eb=_0x4409eb===undefined?-0x1:_0x4409eb==='-1'?-0x1:_0x4409eb*0x3e8;_0x575c18=_0x575c18===undefined?'':'s='+_0x575c18;_0x36ca0b=_0x36ca0b?_0xddbc('0x3c'):'';return this[_0xddbc('0x1d')](util['format'](_0xddbc('0x3d'),_0x402af7,_0x949bb7,_0x462c93,_0x4409eb,_0x36ca0b,_0x575c18));};AGIChannel[_0xddbc('0x1c')][_0xddbc('0x3e')]=function(_0x5934fe,_0x4b39cd){_0x4b39cd=_0x4b39cd||'';return this['sendRequest'](util[_0xddbc('0x22')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x5934fe,_0x4b39cd));};AGIChannel['prototype']['agi']=function(_0x7c140a){return this[_0xddbc('0x27')](_0xddbc('0x3f'),_0x7c140a);};AGIChannel[_0xddbc('0x1c')][_0xddbc('0x40')]=function(_0x3fdc8b){return this[_0xddbc('0x27')](_0xddbc('0x41'),_0x3fdc8b);};AGIChannel[_0xddbc('0x1c')]['error']=function(_0xfafa0e,_0x3f7b56){this[_0xddbc('0x24')](util[_0xddbc('0x22')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0xfafa0e['id'],_0xfafa0e[_0xddbc('0x42')],_0x3f7b56));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xddbc('0x43')]=AGIChannel; \ No newline at end of file +var _0xc881=['replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','sendRequest','prototype','answer','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setPriority','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','label','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code'];(function(_0xe1db36,_0x722cab){var _0x5554ca=function(_0x2fb5ef){while(--_0x2fb5ef){_0xe1db36['push'](_0xe1db36['shift']());}};_0x5554ca(++_0x722cab);}(_0xc881,0xd2));var _0x1c88=function(_0x3259bf,_0x21afb7){_0x3259bf=_0x3259bf-0x0;var _0x2f9c30=_0xc881[_0x3259bf];return _0x2f9c30;};'use strict';var util=require(_0x1c88('0x0'));var _=require('lodash');var EventEmitter=require(_0x1c88('0x1'))[_0x1c88('0x2')];var AGIReply=require(_0x1c88('0x3'));var AGIError=require(_0x1c88('0x4'));function AGIChannel(_0x3a7043){var _0x70b639=this,_0x2e402e=new AGIReply(),_0x60ac0d=![],_0x5cf440={};EventEmitter[_0x1c88('0x5')](_0x70b639);_0x3a7043[_0x1c88('0x6')](_0x1c88('0x7'));_0x3a7043[_0x1c88('0x8')](0x8*0x3c*0x3c*0x3e8);_0x2e402e[_0x1c88('0x6')](_0x1c88('0x7'));_0x2e402e['on'](_0x1c88('0x9'),function(_0x121e6c){for(var _0x3e89ea in _0x121e6c){_0x70b639[_0x3e89ea]=_0x121e6c[_0x3e89ea];}_0x70b639[_0x1c88('0xa')](_0x1c88('0xb'));});_0x2e402e['on'](_0x1c88('0xc'),function(_0x58a885){if(_0x58a885[_0x1c88('0xd')]()==_0x1c88('0xe')){_0x70b639['emit']('hangup');return;}if(_0x58a885['substring'](0x0,0xb)==_0x1c88('0xf')){_0x60ac0d=!![];}if(_0x60ac0d){_0x5cf440['rx']+=_0x58a885+'\x0a';if(_0x58a885[_0x1c88('0x10')](_0x1c88('0x11'))!=-0x1){_0x60ac0d=![];}}else{_0x5cf440['rx']=_0x58a885;}if(_0x60ac0d){return;}if(typeof _0x5cf440['cb']==_0x1c88('0x12')){var _0x3abee6=_0x5cf440['rx'][_0x1c88('0x13')](0x0,0x3),_0x2d450c=null,_0x2a005e=null;_0x3abee6=parseInt(_0x3abee6);if(isNaN(_0x3abee6)){_0x5cf440['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1c88('0x14')});return;}if(_0x3abee6!=0xc8){_0x5cf440['cb'](null,{'code':_0x3abee6,'result':-0x1,'extra':'KO'});return;}_0x2d450c=_0x5cf440['rx'][_0x1c88('0x13')](0x4)[_0x1c88('0x15')](_0x1c88('0x16'),'');if(_0x2d450c[_0x1c88('0x17')]('\x20')!=-0x1){_0x2d450c=_0x2d450c[_0x1c88('0x18')](0x0,_0x2d450c[_0x1c88('0x17')]('\x20'));}if(_[_0x1c88('0x19')](_0x2d450c,'-1')){_0x2d450c=parseInt(_0x2d450c);}_0x2a005e=_0x5cf440['rx'][_0x1c88('0x1a')]('\x20');if(_0x2a005e[_0x1c88('0x1b')]==0x3){_0x2a005e=_0x2a005e[0x2][_0x1c88('0x13')](0x1,_0x2a005e[0x2]['length']-0x1);}else if(_0x2a005e['length']>0x3){var _0x150f56=/\((.+)\)/;var _0x470a53=_0x5cf440['rx'][_0x1c88('0x1c')](_0x150f56);if(_0x470a53){_0x2a005e=_0x470a53[0x1];}else{_0x2a005e=null;}}else{_0x2a005e=null;}_0x5cf440['cb'](null,{'code':_0x3abee6,'result':_0x2d450c,'extra':_0x2a005e});}});_0x3a7043['on'](_0x1c88('0x1d'),function(_0x3f067f){_0x70b639[_0x1c88('0xa')](_0x1c88('0x1d'),new AGIError(_0x1c88('0x1e'),_0x3f067f['code']));});_0x3a7043['on'](_0x1c88('0x1f'),function(){_0x70b639['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x3a7043['on']('timeout',function(){_0x70b639['emit'](_0x1c88('0x20'),new AGIError(_0x1c88('0x21')));_0x3a7043[_0x1c88('0x22')]();});_0x3a7043[_0x1c88('0x23')](_0x2e402e);this[_0x1c88('0x24')]=function(_0x187d19,_0x3cc0b1){var _0x187d19=_0x187d19||'',_0x3cc0b1=typeof _0x3cc0b1=='function'?_0x3cc0b1:new Function();_0x5cf440={'tx':_0x187d19,'rx':'','cb':_0x3cc0b1};_0x3a7043[_0x1c88('0x25')](_0x187d19+'\x0a');},this['close']=function(){_0x3a7043[_0x1c88('0x22')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x1c88('0x26')]=function(_0x3d9c33){return this[_0x1c88('0x24')]['sync'](this,_0x3d9c33);};AGIChannel[_0x1c88('0x27')][_0x1c88('0x28')]=function(){return this[_0x1c88('0x26')](_0x1c88('0x29'));};AGIChannel[_0x1c88('0x27')][_0x1c88('0x2a')]=function(_0x54e669,_0x5cf4d0,_0x99354d){_0x54e669=_0x54e669===undefined?'beep':_0x54e669;_0x5cf4d0=_0x5cf4d0===undefined?'5':_0x5cf4d0;_0x99354d=_0x99354d===undefined?'1':_0x99354d;return this[_0x1c88('0x26')](util['format'](_0x1c88('0x2b'),_0x54e669,_0x5cf4d0*0x3e8,_0x99354d));};AGIChannel[_0x1c88('0x27')][_0x1c88('0x2c')]=function(_0x36b677){_0x36b677=_0x36b677||_0x1c88('0x2d');return this[_0x1c88('0x26')](util[_0x1c88('0x2e')]('VERBOSE\x20\x22%s\x22',_0x36b677));};AGIChannel[_0x1c88('0x27')][_0x1c88('0x2f')]=function(_0x10c20b,_0x480f89){if(_[_0x1c88('0x30')](_0x480f89)){return this[_0x1c88('0x26')](util['format'](_0x1c88('0x31'),_0x10c20b,_0x480f89[_0x1c88('0x32')](',')));}return this[_0x1c88('0x26')](util[_0x1c88('0x2e')](_0x1c88('0x31'),_0x10c20b,_0x480f89));};AGIChannel['prototype'][_0x1c88('0x33')]=function(_0xb0580a){return this[_0x1c88('0x26')](util[_0x1c88('0x2e')]('SET\x20CONTEXT\x20%s',_0xb0580a));};AGIChannel[_0x1c88('0x27')]['setExtension']=function(_0xc9836d){return this[_0x1c88('0x26')](util[_0x1c88('0x2e')]('SET\x20EXTENSION\x20%s',_0xc9836d));};AGIChannel[_0x1c88('0x27')][_0x1c88('0x34')]=function(_0x5a2ce0){return this[_0x1c88('0x26')](util[_0x1c88('0x2e')]('SET\x20PRIORITY\x20%s',_0x5a2ce0));};AGIChannel[_0x1c88('0x27')][_0x1c88('0xe')]=function(){return this['sendRequest'](_0x1c88('0x35'));};AGIChannel[_0x1c88('0x27')][_0x1c88('0x36')]=function(_0x19285c,_0x278b77){var _0x195589=_[_0x1c88('0x37')](_0x278b77)||_[_0x1c88('0x38')](_0x278b77)?_0x278b77['toString']():_0x278b77;return this[_0x1c88('0x26')](util[_0x1c88('0x2e')](_0x1c88('0x39'),_0x19285c,_0x195589?_0x195589[_0x1c88('0x3a')]()[_0x1c88('0x15')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1c88('0x27')]['sayNumber']=function(_0x5f4991,_0x268ac6){return this[_0x1c88('0x26')](util['format'](_0x1c88('0x3b'),_0x5f4991,_0x268ac6));};AGIChannel['prototype'][_0x1c88('0x3c')]=function(_0x2f6ad6,_0x20192b){return this[_0x1c88('0x26')](util[_0x1c88('0x2e')](_0x1c88('0x3d'),_0x2f6ad6,_0x20192b));};AGIChannel[_0x1c88('0x27')]['sayPhonetic']=function(_0x426ea5,_0x3ba0dd){return this['sendRequest'](util['format'](_0x1c88('0x3e'),_0x426ea5,_0x3ba0dd));};AGIChannel[_0x1c88('0x27')][_0x1c88('0x3f')]=function(_0x4f7597,_0x461342,_0x1ecce5){_0x461342=_0x461342||this['extension'];_0x1ecce5=_0x1ecce5||0x1;this[_0x1c88('0x33')](_0x4f7597);this[_0x1c88('0x40')](_0x461342);this['setPriority'](_0x1ecce5);return this[_0x1c88('0x2c')](util[_0x1c88('0x2e')](_0x1c88('0x41'),_0x4f7597,_0x461342,_0x1ecce5));};AGIChannel['prototype']['getVariable']=function(_0x191578){return this[_0x1c88('0x26')](util[_0x1c88('0x2e')](_0x1c88('0x42'),_0x191578));};AGIChannel[_0x1c88('0x27')][_0x1c88('0x43')]=function(_0x5b4375,_0x5c7bc4,_0x16976d,_0x3fe290,_0x3fb211,_0x588c16){_0x5c7bc4=_0x5c7bc4||_0x1c88('0x44');_0x16976d=_0x16976d||'';_0x3fe290=_0x3fe290===undefined?-0x1:_0x3fe290==='-1'?-0x1:_0x3fe290*0x3e8;_0x3fb211=_0x3fb211===undefined?'':'s='+_0x3fb211;_0x588c16=_0x588c16?_0x1c88('0x45'):'';return this[_0x1c88('0x26')](util[_0x1c88('0x2e')](_0x1c88('0x46'),_0x5b4375,_0x5c7bc4,_0x16976d,_0x3fe290,_0x588c16,_0x3fb211));};AGIChannel[_0x1c88('0x27')]['streamFile']=function(_0x15a060,_0x194531){_0x194531=_0x194531||'';return this['sendRequest'](util[_0x1c88('0x2e')](_0x1c88('0x47'),_0x15a060,_0x194531));};AGIChannel[_0x1c88('0x27')][_0x1c88('0x48')]=function(_0x28b33e){return this[_0x1c88('0x2f')](_0x1c88('0x49'),_0x28b33e);};AGIChannel[_0x1c88('0x27')][_0x1c88('0x4a')]=function(_0x3d3986){return this[_0x1c88('0x2f')]('WAIT',_0x3d3986);};AGIChannel['prototype'][_0x1c88('0x1d')]=function(_0x1b4d71,_0x74348d){this[_0x1c88('0x2c')](util[_0x1c88('0x2e')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x1b4d71['id'],_0x1b4d71[_0x1c88('0x4b')],_0x74348d));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1c88('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index f391e75..5271861 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 _0xdafc=['util','Undefined\x20error.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','name'];(function(_0x111c9a,_0x137499){var _0x516158=function(_0x5f05dd){while(--_0x5f05dd){_0x111c9a['push'](_0x111c9a['shift']());}};_0x516158(++_0x137499);}(_0xdafc,0x193));var _0xcdaf=function(_0x1ba7e8,_0x5b6209){_0x1ba7e8=_0x1ba7e8-0x0;var _0x43b084=_0xdafc[_0x1ba7e8];return _0x43b084;};'use strict';var util=require(_0xcdaf('0x0'));var error={'E_AGI_UNDEFINED':_0xcdaf('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xcdaf('0x2'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xcdaf('0x3'),'E_AGI_SOCKET_ERROR':_0xcdaf('0x4'),'E_AGI_SOCKET_CLOSE':_0xcdaf('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xcdaf('0x6'),'E_AGI_IVR_ENTRY':_0xcdaf('0x7')};function AGIError(_0x5482b6){var _0x5482b6=_0x5482b6||null,_0x1ee796=_0x1ee796||[],_0x2b3d5f=0x1,_0x28474a='';if(!error[_0x5482b6]){_0x5482b6=_0xcdaf('0x8');}_0x1ee796[_0xcdaf('0x9')](error[_0x5482b6]);while(arguments[_0x2b3d5f]){_0x1ee796[_0xcdaf('0x9')](arguments[_0x2b3d5f]);_0x2b3d5f++;}_0x28474a=util[_0xcdaf('0xa')][_0xcdaf('0xb')](util,_0x1ee796);this['message']=_0x28474a;this[_0xcdaf('0xc')]=_0x5482b6;}module['exports']=AGIError; \ No newline at end of file +var _0x7641=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.'];(function(_0xaf5fa8,_0x1d1c6c){var _0x326bb1=function(_0x46e080){while(--_0x46e080){_0xaf5fa8['push'](_0xaf5fa8['shift']());}};_0x326bb1(++_0x1d1c6c);}(_0x7641,0x166));var _0x1764=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x7641[_0x565c49];return _0x20ca34;};'use strict';var util=require(_0x1764('0x0'));var error={'E_AGI_UNDEFINED':_0x1764('0x1'),'E_AGI_ARGUMENT_PORT':_0x1764('0x2'),'E_AGI_SERVER_ERROR':_0x1764('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x1764('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x1764('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x1764('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1764('0x7'),'E_AGI_IVR_ENTRY':_0x1764('0x8')};function AGIError(_0x4e334a){var _0x4e334a=_0x4e334a||null,_0x1238cf=_0x1238cf||[],_0x35b951=0x1,_0x216e2e='';if(!error[_0x4e334a]){_0x4e334a=_0x1764('0x9');}_0x1238cf[_0x1764('0xa')](error[_0x4e334a]);while(arguments[_0x35b951]){_0x1238cf[_0x1764('0xa')](arguments[_0x35b951]);_0x35b951++;}_0x216e2e=util['format']['apply'](util,_0x1238cf);this[_0x1764('0xb')]=_0x216e2e;this[_0x1764('0xc')]=_0x4e334a;}module[_0x1764('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index c84de83..2d3dcee 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 _0xbf1b=['vswitch','target','default','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand'];(function(_0x46e677,_0x1ecd0c){var _0x4f59c6=function(_0x44e29f){while(--_0x44e29f){_0x46e677['push'](_0x46e677['shift']());}};_0x4f59c6(++_0x1ecd0c);}(_0xbf1b,0x109));var _0xbbf1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xbf1b[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xbbf1('0x0'));var logger=require(_0xbbf1('0x1'))(_0xbbf1('0x2'));var verticesWithRetry=[_0xbbf1('0x3'),'getdigits',_0xbbf1('0x4')];var Graph=function(){this[_0xbbf1('0x5')]={};this[_0xbbf1('0x6')]={};this[_0xbbf1('0x7')]=0x0;};Graph[_0xbbf1('0x8')][_0xbbf1('0x9')]=function(_0x245544){this[_0xbbf1('0x5')][_0x245544['id']]=_0x245544;this[_0xbbf1('0x6')][_0x245544['id']]=[];};Graph[_0xbbf1('0x8')][_0xbbf1('0xa')]=function(_0x23092c,_0x18cec8,_0x47b997){this['edges'][_0x23092c][_0xbbf1('0xb')]({'target':_0x18cec8,'condition':_0x47b997});this[_0xbbf1('0x7')]+=0x1;};Graph[_0xbbf1('0x8')][_0xbbf1('0xc')]=function(){return _[_0xbbf1('0xc')](this[_0xbbf1('0x5')]);};Graph[_0xbbf1('0x8')][_0xbbf1('0xd')]=function(){return this['numberOfEdges'];};Graph[_0xbbf1('0x8')][_0xbbf1('0xe')]=function(_0xb36faa){return this[_0xbbf1('0x5')][_0xb36faa];};Graph[_0xbbf1('0x8')]['traverseBFS']=function(_0x222b61,_0x618a3e){if(!this['vertices'][_0x222b61]){return logger[_0xbbf1('0xf')](_0xbbf1('0x10'));}var _0x30ba1b=_0x618a3e(this['vertices'][_0x222b61]);if(!_0x30ba1b){return logger[_0xbbf1('0xf')](_0xbbf1('0x11'));}if(this[_0xbbf1('0x6')][_0x222b61][_0xbbf1('0x12')]===0x0){return logger[_0xbbf1('0xf')](_0xbbf1('0x13'));}for(var _0x445491=0x0,_0x1274be=[],_0x413e98=![];_0x445491\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','target','addEdge','source','value','getSquareProject','then','catch','agi_','inspect','variables','close','timeout','hangup','sync','production','start','stringify','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','response','result','evtHangup','isUndefined','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','debug','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','continueAt','extension','getLicense','callysquare'];(function(_0x1946ec,_0x27c21b){var _0x2e3bb3=function(_0x51023d){while(--_0x51023d){_0x1946ec['push'](_0x1946ec['shift']());}};_0x2e3bb3(++_0x27c21b);}(_0x1516,0xb8));var _0x6151=function(_0x45420e,_0xd9a7a2){_0x45420e=_0x45420e-0x0;var _0x1c7a21=_0x1516[_0x45420e];return _0x1c7a21;};'use strict';var parser=require(_0x6151('0x0'));var _=require(_0x6151('0x1'));var syncho=require(_0x6151('0x2'));var util=require(_0x6151('0x3'));var moment=require(_0x6151('0x4'));var config=require(_0x6151('0x5'));var logger=require(_0x6151('0x6'))(_0x6151('0x7'));var utilLicense=require(_0x6151('0x8'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0x6151('0x9'));var Vertices=require(_0x6151('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x6151('0x7')]=_[_0x6151('0xb')](config['agi'],{'ip':_0x6151('0xc'),'port':0x11dd});function connectionHandler(_0xde3b22){process[_0x6151('0xd')](function(){syncho(function(){try{setChannelVariables(_0xde3b22);agiHandler(_0xde3b22);}catch(_0x2b5c41){logger['error'](_0x2b5c41[_0x6151('0xe')]);}});});}function listeningHandler(){console[_0x6151('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x6151('0x7')][_0x6151('0x10')]);logger[_0x6151('0x11')](util[_0x6151('0x12')](_0x6151('0x13'),config[_0x6151('0x7')]['ip'],config['agi'][_0x6151('0x10')]));}function errorHandler(_0xa77562){if(_0xa77562&&_0xa77562[_0x6151('0x14')]&&_0xa77562['message']){logger[_0x6151('0x15')](util['format']('[%s]\x20%s',_0xa77562[_0x6151('0x14')],_0xa77562[_0x6151('0x16')]));}else{logger[_0x6151('0x15')](util[_0x6151('0x12')](_0x6151('0x17'),_0xa77562['stack']));}}function closeHandler(){logger['info'](util['format'](_0x6151('0x18'),this[_0x6151('0x19')],this[_0x6151('0x1a')],this['callerid'],this[_0x6151('0x1b')],this[_0x6151('0x1c')]));try{createSquareReport(this);}catch(_0x194ebc){logger['error'](_0x194ebc[_0x6151('0xe')]);}}function timeoutHandler(){logger[_0x6151('0x11')](util['format'](_0x6151('0x1d'),this['arg_1'],this[_0x6151('0x1a')],this[_0x6151('0x1e')],this[_0x6151('0x1b')],this[_0x6151('0x1c')]));}function hangupHandler(){logger['info'](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x6151('0x19')],this['calleridname'],this['callerid'],this[_0x6151('0x1b')],this[_0x6151('0x1c')]));this['evtHangup']=!![];}function getRoot(_0x17e3a1){return parser[_0x6151('0x1f')](_0x17e3a1,{'object':!![]})[_0x6151('0x20')]['root'];}function addVertex(_0x9f5d3,_0x2b2f4c,_0x4e6a11){_0x2b2f4c[_0x6151('0x21')]=_0x4e6a11;if(_0x2b2f4c[_0x6151('0x22')](_0x6151('0x23'))){_0x2b2f4c[_0x6151('0x24')]=parseInt(_0x2b2f4c[_0x6151('0x23')],0xa);}_0x9f5d3[_0x6151('0x25')](_[_0x6151('0x26')](_0x2b2f4c,_0x6151('0x27')));}function initGraph(_0x2cc222,_0xe37c59){var _0x3978d5=new Graph();for(var _0x4de971 in _0x2cc222){if(_0x2cc222[_0x6151('0x22')](_0x4de971)){if(_['isArray'](_0x2cc222[_0x4de971])){for(var _0x544bb2=0x0;_0x544bb2<_0x2cc222[_0x4de971][_0x6151('0x28')];_0x544bb2+=0x1){addVertex(_0x3978d5,_0x2cc222[_0x4de971][_0x544bb2],_0x4de971);}}else{addVertex(_0x3978d5,_0x2cc222[_0x4de971],_0x4de971);}}}for(var _0x14ec5c=0x0;_0x14ec5c<_0xe37c59['length'];_0x14ec5c+=0x1){if(_0xe37c59[_0x14ec5c]['source']&&_0xe37c59[_0x14ec5c][_0x6151('0x29')]){_0x3978d5[_0x6151('0x2a')](_0xe37c59[_0x14ec5c][_0x6151('0x2b')],_0xe37c59[_0x14ec5c][_0x6151('0x29')],_0xe37c59[_0x14ec5c][_0x6151('0x2c')]);}}return _0x3978d5;}function getSquareProject(_0xcdbe30,_0x3a88e3){rpc[_0x6151('0x2d')](_0xcdbe30)[_0x6151('0x2e')](function(_0x25d103){_0x3a88e3(null,_0x25d103);})[_0x6151('0x2f')](function(_0x26c143){_0x3a88e3(null,_0x26c143);});}function createSquareReport(_0x5d07c9,_0x1d626b){rpc['createSquareReport'](_0x5d07c9)[_0x6151('0x2e')](function(_0x382bf6){if(_0x1d626b){_0x1d626b(null,_0x382bf6);}})['catch'](function(_0x5cef64){if(_0x1d626b){_0x1d626b(null,_0x5cef64);}});}function setChannelVariables(_0x4b6a40){for(var _0x3b9d1d in _0x4b6a40){if(_0x4b6a40[_0x6151('0x22')](_0x3b9d1d)){if(_0x3b9d1d['indexOf'](_0x6151('0x30'))===0x0){_0x4b6a40[_0x3b9d1d['substring'](0x4)]=_0x4b6a40[_0x3b9d1d];delete _0x4b6a40[_0x3b9d1d];}}}}function getLogFromObject(_0x28a724){return util[_0x6151('0x31')](_0x28a724,{'showHidden':![],'depth':null});}function agiHandler(_0x3296f0){var _0x35a12e,_0x74811f,_0x2e49f6,_0x5e39f5,_0x81b83e;logger['debug'](_0x6151('0x32'),JSON['stringify'](_0x3296f0,null,0x2));logger['info'](util[_0x6151('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3296f0[_0x6151('0x19')],_0x3296f0[_0x6151('0x1a')],_0x3296f0[_0x6151('0x1e')],_0x3296f0['dnid'],_0x3296f0['uniqueid']));_0x3296f0['on'](_0x6151('0x15'),errorHandler);_0x3296f0['on'](_0x6151('0x33'),closeHandler);_0x3296f0['on'](_0x6151('0x34'),timeoutHandler);_0x3296f0['evtHangup']=![];_0x3296f0['on'](_0x6151('0x35'),hangupHandler);var _0x5e64db=getSquareProject[_0x6151('0x36')](null,_0x3296f0[_0x6151('0x19')]);if(_0x5e64db){if(_0x5e64db[_0x6151('0x37')]){_0x35a12e=getRoot(_0x5e64db[_0x6151('0x37')]);if(_0x35a12e&&_0x35a12e[_0x6151('0x38')]){logger['debug']('root',JSON[_0x6151('0x39')](_0x35a12e,null,0x2));_0x3296f0['joinAt']=moment()[_0x6151('0x12')](_0x6151('0x3a'));_0x74811f=initGraph(_[_0x6151('0x26')](_0x35a12e,_0x6151('0x27')),_0x35a12e['mxCell']);_0x2e49f6=new Vertices(_0x3296f0,rpc,mailRpc);logger[_0x6151('0x11')](util[_0x6151('0x12')](_0x6151('0x3b'),_0x3296f0[_0x6151('0x19')],_0x3296f0[_0x6151('0x1a')],_0x3296f0['callerid'],_0x3296f0[_0x6151('0x1b')],_0x3296f0[_0x6151('0x1c')]));_0x74811f[_0x6151('0x3c')](_0x35a12e[_0x6151('0x38')]['id'],function(_0x42ef49){try{_0x42ef49=_0x2e49f6[_0x6151('0x3d')](_0x42ef49);logger['debug'](_0x6151('0x3e'),JSON[_0x6151('0x39')](_0x42ef49,null,0x2));if(_0x42ef49[_0x6151('0x21')]===_0x6151('0x3f')){logger['info'](_0x6151('0x40'));_0x3296f0[_0x6151('0x41')]=_0x42ef49[_0x6151('0x41')]||_0x3296f0['context'];_0x3296f0['extension']=_0x42ef49['extension'];_0x3296f0['priority']=_0x42ef49[_0x6151('0x42')]?_0x42ef49[_0x6151('0x42')]-0x1:0x1;return null;}else if(_0x42ef49&&_0x2e49f6[_0x42ef49[_0x6151('0x21')]]){_0x81b83e=_0x2e49f6[_0x42ef49[_0x6151('0x21')]](_0x42ef49);logger['info'](_0x6151('0x43'),JSON[_0x6151('0x39')](_0x81b83e,null,0x2));if(_0x81b83e&&_0x81b83e['code']===AGI_CODE_SUCCESS&&_0x81b83e[_0x6151('0x44')]!==AGI_RESULT_ERROR&&!_0x3296f0[_0x6151('0x45')]){logger['debug'](_0x6151('0x43'),getLogFromObject(_0x81b83e));return _[_0x6151('0x46')](_0x81b83e[_0x6151('0x44')])?null:_0x81b83e[_0x6151('0x44')]['toString']();}else{logger[_0x6151('0x15')](_0x6151('0x43'),getLogFromObject(_0x81b83e));return null;}}else{logger['error'](_0x6151('0x47'));return null;}}catch(_0x5476a0){logger[_0x6151('0x15')](_0x5476a0[_0x6151('0xe')]);return null;}});if(_0x35a12e['finally']){logger[_0x6151('0x11')](util[_0x6151('0x12')](_0x6151('0x48'),_0x3296f0[_0x6151('0x19')],_0x3296f0[_0x6151('0x1a')],_0x3296f0['callerid'],_0x3296f0[_0x6151('0x1b')],_0x3296f0[_0x6151('0x1c')]));_0x74811f[_0x6151('0x3c')](_0x35a12e[_0x6151('0x49')]['id'],function(_0x1a9ba3){try{_0x1a9ba3=_0x2e49f6[_0x6151('0x3d')](_0x1a9ba3);logger[_0x6151('0x4a')]('vertex',JSON[_0x6151('0x39')](_0x1a9ba3,null,0x2));if(_0x1a9ba3&&_0x2e49f6[_0x1a9ba3['agicommand']]){_0x81b83e=_0x2e49f6[_0x1a9ba3[_0x6151('0x21')]](_0x1a9ba3);if(_0x81b83e){logger[_0x6151('0x4a')](_0x6151('0x43'),getLogFromObject(_0x81b83e));return _['isUndefined'](_0x81b83e[_0x6151('0x44')])?null:_0x81b83e[_0x6151('0x44')][_0x6151('0x4b')]();}else{logger[_0x6151('0x15')]('response',getLogFromObject(_0x81b83e));return null;}}else{logger[_0x6151('0x15')]('agicommand\x20not\x20found');return null;}}catch(_0x27268d){logger[_0x6151('0x15')](_0x27268d[_0x6151('0xe')]);return null;}});}logger[_0x6151('0x11')](util['format'](_0x6151('0x4c'),_0x3296f0[_0x6151('0x19')],_0x3296f0[_0x6151('0x1a')],_0x3296f0[_0x6151('0x1e')],_0x3296f0[_0x6151('0x1b')],_0x3296f0['uniqueid']));logger[_0x6151('0x11')](util[_0x6151('0x12')](_0x6151('0x4d'),_0x3296f0[_0x6151('0x41')],_0x3296f0['extension'],parseInt(_0x3296f0['priority'],0xa)+0x1));_0x3296f0['continueAt'](_0x3296f0[_0x6151('0x41')],_0x3296f0['extension'],parseInt(_0x3296f0[_0x6151('0x42')],0xa)+0x1);_0x3296f0[_0x6151('0x33')]();}}else{logger[_0x6151('0x15')](util['format'](_0x6151('0x4e'),_0x3296f0['arg_1']));_0x3296f0[_0x6151('0x4f')](_0x3296f0[_0x6151('0x41')],_0x3296f0['extension'],parseInt(_0x3296f0[_0x6151('0x42')],0xa)+0x1);_0x3296f0[_0x6151('0x33')]();}}else{logger[_0x6151('0x15')](util[_0x6151('0x12')]('Project\x20%s\x20not\x20found',_0x3296f0[_0x6151('0x19')]));_0x3296f0[_0x6151('0x4f')](_0x3296f0[_0x6151('0x41')],_0x3296f0[_0x6151('0x50')],parseInt(_0x3296f0[_0x6151('0x42')],0xa)+0x1);_0x3296f0[_0x6151('0x33')]();}}function main(){var _0x16cb97;return utilLicense[_0x6151('0x51')]()['then'](function(_0x505282){if(_0x505282){if(_0x505282['voice']){if(_0x505282[_0x6151('0x52')]&&_0x505282['callysquare']>0x0){logger[_0x6151('0x11')](util[_0x6151('0x12')](_0x6151('0x53'),_0x505282[_0x6151('0x52')]));_0x16cb97=_0x505282['callysquare'];}else{logger['info'](_0x6151('0x54'));}}else{logger[_0x6151('0x11')](_0x6151('0x55'));_0x16cb97=-0x1;}}})[_0x6151('0x2f')](function(_0x221dfa){logger['error']('[LICENSE]',_0x221dfa['stack']);})[_0x6151('0x49')](function(){var _0x32d721=require(_0x6151('0x56'))(config[_0x6151('0x7')][_0x6151('0x10')],config[_0x6151('0x7')]['ip'],_0x16cb97);_0x32d721['on'](_0x6151('0x15'),errorHandler);_0x32d721['on'](_0x6151('0x57'),listeningHandler);_0x32d721['on'](_0x6151('0x58'),connectionHandler);_0x32d721['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x86ba=['omit','mxCell','hasOwnProperty','length','target','addEdge','source','value','getSquareProject','catch','then','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20found','continueAt','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','syncho','util','moment','agi','../../config/license/util','./rpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','name','message','format','[ERROR]\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','toJson','mxGraphModel','root','agicommand','retry','maxRetry'];(function(_0x315179,_0x4495fb){var _0x5d838c=function(_0x184609){while(--_0x184609){_0x315179['push'](_0x315179['shift']());}};_0x5d838c(++_0x4495fb);}(_0x86ba,0x192));var _0xa86b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x86ba[_0x19e35c];return _0x3e1fe8;};'use strict';var parser=require('xml2json');var _=require('lodash');var syncho=require(_0xa86b('0x0'));var util=require(_0xa86b('0x1'));var moment=require(_0xa86b('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xa86b('0x3'));var utilLicense=require(_0xa86b('0x4'));var rpc=require(_0xa86b('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0xa86b('0x6'));var Vertices=require(_0xa86b('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xa86b('0x3')]=_[_0xa86b('0x8')](config[_0xa86b('0x3')],{'ip':_0xa86b('0x9'),'port':0x11dd});function connectionHandler(_0x5254e5){process[_0xa86b('0xa')](function(){syncho(function(){try{setChannelVariables(_0x5254e5);agiHandler(_0x5254e5);}catch(_0x1f5447){logger[_0xa86b('0xb')](_0x1f5447[_0xa86b('0xc')]);}});});}function listeningHandler(){console['log'](_0xa86b('0xd'),config['agi'][_0xa86b('0xe')]);logger[_0xa86b('0xf')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0xa86b('0x3')][_0xa86b('0xe')]));}function errorHandler(_0x3fdb78){if(_0x3fdb78&&_0x3fdb78[_0xa86b('0x10')]&&_0x3fdb78[_0xa86b('0x11')]){logger[_0xa86b('0xb')](util[_0xa86b('0x12')]('[%s]\x20%s',_0x3fdb78[_0xa86b('0x10')],_0x3fdb78[_0xa86b('0x11')]));}else{logger[_0xa86b('0xb')](util[_0xa86b('0x12')](_0xa86b('0x13'),_0x3fdb78[_0xa86b('0xc')]));}}function closeHandler(){logger[_0xa86b('0xf')](util[_0xa86b('0x12')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xa86b('0x14')],this[_0xa86b('0x15')],this[_0xa86b('0x16')],this[_0xa86b('0x17')],this[_0xa86b('0x18')]));try{createSquareReport(this);}catch(_0x461c8b){logger[_0xa86b('0xb')](_0x461c8b[_0xa86b('0xc')]);}}function timeoutHandler(){logger['info'](util[_0xa86b('0x12')](_0xa86b('0x19'),this[_0xa86b('0x14')],this[_0xa86b('0x15')],this[_0xa86b('0x16')],this[_0xa86b('0x17')],this[_0xa86b('0x18')]));}function hangupHandler(){logger[_0xa86b('0xf')](util[_0xa86b('0x12')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xa86b('0x14')],this['calleridname'],this['callerid'],this['dnid'],this[_0xa86b('0x18')]));this[_0xa86b('0x1a')]=!![];}function getRoot(_0x33debc){return parser[_0xa86b('0x1b')](_0x33debc,{'object':!![]})[_0xa86b('0x1c')][_0xa86b('0x1d')];}function addVertex(_0x649a21,_0x4810aa,_0x2e34b8){_0x4810aa[_0xa86b('0x1e')]=_0x2e34b8;if(_0x4810aa['hasOwnProperty'](_0xa86b('0x1f'))){_0x4810aa[_0xa86b('0x20')]=parseInt(_0x4810aa[_0xa86b('0x1f')],0xa);}_0x649a21['addVertex'](_[_0xa86b('0x21')](_0x4810aa,_0xa86b('0x22')));}function initGraph(_0x5e11e5,_0xd433a2){var _0x4ae48a=new Graph();for(var _0x535dbc in _0x5e11e5){if(_0x5e11e5[_0xa86b('0x23')](_0x535dbc)){if(_['isArray'](_0x5e11e5[_0x535dbc])){for(var _0xce2fba=0x0;_0xce2fba<_0x5e11e5[_0x535dbc][_0xa86b('0x24')];_0xce2fba+=0x1){addVertex(_0x4ae48a,_0x5e11e5[_0x535dbc][_0xce2fba],_0x535dbc);}}else{addVertex(_0x4ae48a,_0x5e11e5[_0x535dbc],_0x535dbc);}}}for(var _0x50ad9c=0x0;_0x50ad9c<_0xd433a2['length'];_0x50ad9c+=0x1){if(_0xd433a2[_0x50ad9c]['source']&&_0xd433a2[_0x50ad9c][_0xa86b('0x25')]){_0x4ae48a[_0xa86b('0x26')](_0xd433a2[_0x50ad9c][_0xa86b('0x27')],_0xd433a2[_0x50ad9c][_0xa86b('0x25')],_0xd433a2[_0x50ad9c][_0xa86b('0x28')]);}}return _0x4ae48a;}function getSquareProject(_0xbe8424,_0x3e3f5d){rpc[_0xa86b('0x29')](_0xbe8424)['then'](function(_0x51262b){_0x3e3f5d(null,_0x51262b);})[_0xa86b('0x2a')](function(_0xf3cdde){_0x3e3f5d(null,_0xf3cdde);});}function createSquareReport(_0x422dc1,_0x477782){rpc['createSquareReport'](_0x422dc1)[_0xa86b('0x2b')](function(_0x2f225d){if(_0x477782){_0x477782(null,_0x2f225d);}})['catch'](function(_0x47bf4d){if(_0x477782){_0x477782(null,_0x47bf4d);}});}function setChannelVariables(_0x305782){for(var _0x430d36 in _0x305782){if(_0x305782[_0xa86b('0x23')](_0x430d36)){if(_0x430d36[_0xa86b('0x2c')](_0xa86b('0x2d'))===0x0){_0x305782[_0x430d36[_0xa86b('0x2e')](0x4)]=_0x305782[_0x430d36];delete _0x305782[_0x430d36];}}}}function getLogFromObject(_0x23fddd){return util['inspect'](_0x23fddd,{'showHidden':![],'depth':null});}function agiHandler(_0x36d6bd){var _0x12d228,_0x278f68,_0x2443ee,_0x13a68d,_0x907632;logger[_0xa86b('0x2f')](_0xa86b('0x30'),JSON[_0xa86b('0x31')](_0x36d6bd,null,0x2));logger['info'](util['format'](_0xa86b('0x32'),_0x36d6bd['arg_1'],_0x36d6bd[_0xa86b('0x15')],_0x36d6bd[_0xa86b('0x16')],_0x36d6bd[_0xa86b('0x17')],_0x36d6bd[_0xa86b('0x18')]));_0x36d6bd['on']('error',errorHandler);_0x36d6bd['on'](_0xa86b('0x33'),closeHandler);_0x36d6bd['on'](_0xa86b('0x34'),timeoutHandler);_0x36d6bd['evtHangup']=![];_0x36d6bd['on'](_0xa86b('0x35'),hangupHandler);var _0x279a7c=getSquareProject['sync'](null,_0x36d6bd[_0xa86b('0x14')]);if(_0x279a7c){if(_0x279a7c[_0xa86b('0x36')]){_0x12d228=getRoot(_0x279a7c[_0xa86b('0x36')]);if(_0x12d228&&_0x12d228[_0xa86b('0x37')]){logger[_0xa86b('0x2f')](_0xa86b('0x1d'),JSON[_0xa86b('0x31')](_0x12d228,null,0x2));_0x36d6bd[_0xa86b('0x38')]=moment()['format'](_0xa86b('0x39'));_0x278f68=initGraph(_[_0xa86b('0x21')](_0x12d228,_0xa86b('0x22')),_0x12d228[_0xa86b('0x22')]);_0x2443ee=new Vertices(_0x36d6bd,rpc,mailRpc);logger['info'](util[_0xa86b('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x36d6bd[_0xa86b('0x14')],_0x36d6bd[_0xa86b('0x15')],_0x36d6bd[_0xa86b('0x16')],_0x36d6bd[_0xa86b('0x17')],_0x36d6bd[_0xa86b('0x18')]));_0x278f68[_0xa86b('0x3a')](_0x12d228[_0xa86b('0x37')]['id'],function(_0x3c173f){try{_0x3c173f=_0x2443ee[_0xa86b('0x3b')](_0x3c173f);logger['debug'](_0xa86b('0x3c'),JSON[_0xa86b('0x31')](_0x3c173f,null,0x2));if(_0x3c173f[_0xa86b('0x1e')]===_0xa86b('0x3d')){logger[_0xa86b('0xf')](_0xa86b('0x3e'));_0x36d6bd[_0xa86b('0x3f')]=_0x3c173f[_0xa86b('0x3f')]||_0x36d6bd[_0xa86b('0x3f')];_0x36d6bd[_0xa86b('0x40')]=_0x3c173f[_0xa86b('0x40')];_0x36d6bd[_0xa86b('0x41')]=_0x3c173f['priority']?_0x3c173f[_0xa86b('0x41')]-0x1:0x1;return null;}else if(_0x3c173f&&_0x2443ee[_0x3c173f[_0xa86b('0x1e')]]){_0x907632=_0x2443ee[_0x3c173f[_0xa86b('0x1e')]](_0x3c173f);logger['info'](_0xa86b('0x42'),JSON[_0xa86b('0x31')](_0x907632,null,0x2));if(_0x907632&&_0x907632[_0xa86b('0x43')]===AGI_CODE_SUCCESS&&_0x907632['result']!==AGI_RESULT_ERROR&&!_0x36d6bd[_0xa86b('0x1a')]){logger['debug'](_0xa86b('0x42'),getLogFromObject(_0x907632));return _[_0xa86b('0x44')](_0x907632['result'])?null:_0x907632[_0xa86b('0x45')]['toString']();}else{logger[_0xa86b('0xb')](_0xa86b('0x42'),getLogFromObject(_0x907632));return null;}}else{logger[_0xa86b('0xb')](_0xa86b('0x46'));return null;}}catch(_0x34eff0){logger[_0xa86b('0xb')](_0x34eff0[_0xa86b('0xc')]);return null;}});if(_0x12d228[_0xa86b('0x47')]){logger[_0xa86b('0xf')](util[_0xa86b('0x12')](_0xa86b('0x48'),_0x36d6bd[_0xa86b('0x14')],_0x36d6bd['calleridname'],_0x36d6bd[_0xa86b('0x16')],_0x36d6bd[_0xa86b('0x17')],_0x36d6bd[_0xa86b('0x18')]));_0x278f68['traverseBFS'](_0x12d228['finally']['id'],function(_0x2969b5){try{_0x2969b5=_0x2443ee[_0xa86b('0x3b')](_0x2969b5);logger[_0xa86b('0x2f')](_0xa86b('0x3c'),JSON[_0xa86b('0x31')](_0x2969b5,null,0x2));if(_0x2969b5&&_0x2443ee[_0x2969b5['agicommand']]){_0x907632=_0x2443ee[_0x2969b5[_0xa86b('0x1e')]](_0x2969b5);if(_0x907632){logger['debug'](_0xa86b('0x42'),getLogFromObject(_0x907632));return _[_0xa86b('0x44')](_0x907632[_0xa86b('0x45')])?null:_0x907632['result'][_0xa86b('0x49')]();}else{logger['error'](_0xa86b('0x42'),getLogFromObject(_0x907632));return null;}}else{logger['error'](_0xa86b('0x46'));return null;}}catch(_0x4b5676){logger[_0xa86b('0xb')](_0x4b5676[_0xa86b('0xc')]);return null;}});}logger[_0xa86b('0xf')](util[_0xa86b('0x12')](_0xa86b('0x4a'),_0x36d6bd[_0xa86b('0x14')],_0x36d6bd[_0xa86b('0x15')],_0x36d6bd[_0xa86b('0x16')],_0x36d6bd[_0xa86b('0x17')],_0x36d6bd[_0xa86b('0x18')]));logger[_0xa86b('0xf')](util[_0xa86b('0x12')](_0xa86b('0x4b'),_0x36d6bd['context'],_0x36d6bd['extension'],parseInt(_0x36d6bd['priority'],0xa)+0x1));_0x36d6bd['continueAt'](_0x36d6bd[_0xa86b('0x3f')],_0x36d6bd[_0xa86b('0x40')],parseInt(_0x36d6bd[_0xa86b('0x41')],0xa)+0x1);_0x36d6bd['close']();}}else{logger[_0xa86b('0xb')](util[_0xa86b('0x12')]('Project\x20%s\x20not\x20published',_0x36d6bd[_0xa86b('0x14')]));_0x36d6bd['continueAt'](_0x36d6bd['context'],_0x36d6bd['extension'],parseInt(_0x36d6bd[_0xa86b('0x41')],0xa)+0x1);_0x36d6bd[_0xa86b('0x33')]();}}else{logger[_0xa86b('0xb')](util['format'](_0xa86b('0x4c'),_0x36d6bd['arg_1']));_0x36d6bd[_0xa86b('0x4d')](_0x36d6bd[_0xa86b('0x3f')],_0x36d6bd[_0xa86b('0x40')],parseInt(_0x36d6bd[_0xa86b('0x41')],0xa)+0x1);_0x36d6bd[_0xa86b('0x33')]();}}function main(){var _0x4a079b;return utilLicense[_0xa86b('0x4e')]()[_0xa86b('0x2b')](function(_0x304865){if(_0x304865){if(_0x304865['voice']){if(_0x304865[_0xa86b('0x4f')]&&_0x304865['callysquare']>0x0){logger[_0xa86b('0xf')](util[_0xa86b('0x12')](_0xa86b('0x50'),_0x304865[_0xa86b('0x4f')]));_0x4a079b=_0x304865['callysquare'];}else{logger[_0xa86b('0xf')](_0xa86b('0x51'));}}else{logger[_0xa86b('0xf')](_0xa86b('0x52'));_0x4a079b=-0x1;}}})[_0xa86b('0x2a')](function(_0x595d08){logger[_0xa86b('0xb')](_0xa86b('0x53'),_0x595d08[_0xa86b('0xc')]);})[_0xa86b('0x47')](function(){var _0x4fed26=require(_0xa86b('0x54'))(config['agi'][_0xa86b('0xe')],config['agi']['ip'],_0x4a079b);_0x4fed26['on'](_0xa86b('0xb'),errorHandler);_0x4fed26['on'](_0xa86b('0x55'),listeningHandler);_0x4fed26['on'](_0xa86b('0x56'),connectionHandler);_0x4fed26['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index aa382b5..3553294 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 _0x196a=['client','http','request','then','error','result','SendMail','bluebird','jayson/promise'];(function(_0x199c03,_0x3254aa){var _0x11a7d4=function(_0x49e1da){while(--_0x49e1da){_0x199c03['push'](_0x199c03['shift']());}};_0x11a7d4(++_0x3254aa);}(_0x196a,0x16f));var _0xa196=function(_0x2e7449,_0x5dd5cc){_0x2e7449=_0x2e7449-0x0;var _0x4185b3=_0x196a[_0x2e7449];return _0x4185b3;};'use strict';var BPromise=require(_0xa196('0x0'));var jayson=require(_0xa196('0x1'));var client=jayson[_0xa196('0x2')][_0xa196('0x3')]({'port':0x232b});function request(_0x551ef8,_0x170d1a){return new BPromise(function(_0x67a9ba,_0x3f39da){return client[_0xa196('0x4')](_0x551ef8,_0x170d1a)[_0xa196('0x5')](function(_0x363a9c){if(_0x363a9c[_0xa196('0x6')]){return _0x3f39da(_0x363a9c['error']['message']);}else{return _0x67a9ba(_0x363a9c[_0xa196('0x7')]);}})['catch'](function(_0x22eb0f){return _0x3f39da(_0x22eb0f);});});}exports['sendMailMessage']=function(_0x36275f,_0x2e0de2){return request(_0xa196('0x8'),{'account':_0x36275f,'message':_0x2e0de2});}; \ No newline at end of file +var _0xb5eb=['catch','SendMail','bluebird','client','http','request','then','error','message','result'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb5eb,0x98));var _0xbb5e=function(_0x1bf732,_0x3f9c82){_0x1bf732=_0x1bf732-0x0;var _0x190af8=_0xb5eb[_0x1bf732];return _0x190af8;};'use strict';var BPromise=require(_0xbb5e('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xbb5e('0x1')][_0xbb5e('0x2')]({'port':0x232b});function request(_0x512582,_0x10f5e5){return new BPromise(function(_0x30e223,_0x573953){return client[_0xbb5e('0x3')](_0x512582,_0x10f5e5)[_0xbb5e('0x4')](function(_0x308105){if(_0x308105[_0xbb5e('0x5')]){return _0x573953(_0x308105[_0xbb5e('0x5')][_0xbb5e('0x6')]);}else{return _0x30e223(_0x308105[_0xbb5e('0x7')]);}})[_0xbb5e('0x8')](function(_0x1dd069){return _0x573953(_0x1dd069);});});}exports['sendMailMessage']=function(_0x148499,_0x590054){return request(_0xbb5e('0x9'),{'account':_0x148499,'message':_0x590054});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index c1f0c56..1c8099f 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 _0x4242=['exports','util','stream','Transform','_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','toString','substring','split','indexOf','slice','trim','emit','line','length','_localBuffer'];(function(_0x5a0937,_0x2b33bb){var _0x1f1466=function(_0x27d37a){while(--_0x27d37a){_0x5a0937['push'](_0x5a0937['shift']());}};_0x1f1466(++_0x2b33bb);}(_0x4242,0xb5));var _0x2424=function(_0xbaa22e,_0x1a5ada){_0xbaa22e=_0xbaa22e-0x0;var _0x17d491=_0x4242[_0xbaa22e];return _0x17d491;};'use strict';var util=require(_0x2424('0x0'));var Transform=require(_0x2424('0x1'))[_0x2424('0x2')];function AGIReply(_0x28ff5b){Transform['call'](this,_0x28ff5b);this['_localBuffer']='';this[_0x2424('0x3')]=![];}util[_0x2424('0x4')](AGIReply,Transform);AGIReply[_0x2424('0x5')]['_transform']=function(_0x1e6f8a,_0x154c4a,_0x3460ac){var _0x3890fd='\x0a',_0x95deff=['\x0a\x0a',_0x2424('0x6')],_0x4d725a=-0x1,_0x293dde=-0x1,_0x4b913a='',_0x5a7cfe=0x0,_0x21e0a8='',_0x291e4f='';this['_localBuffer']+=_0x1e6f8a[_0x2424('0x7')]();_0x21e0a8=this['_localBuffer'];if(!this[_0x2424('0x3')]){_0x5a7cfe=0x0;while(_0x95deff[_0x5a7cfe]){while((_0x293dde=_0x21e0a8['indexOf'](_0x95deff[_0x5a7cfe]))!=-0x1){_0x4b913a=_0x95deff[_0x5a7cfe];_0x291e4f=_0x21e0a8[_0x2424('0x8')](0x0,_0x293dde);_0x21e0a8=_0x21e0a8[_0x2424('0x8')](_0x293dde+_0x4b913a['length']);var _0x4fe69f=_0x291e4f[_0x2424('0x9')](_0x3890fd),_0xa98f4a=0x0,_0x5e3f57={},_0xa18032='',_0x35926e='',_0x4a0d97=-0x1;while(_0x4fe69f[_0xa98f4a]){_0x4a0d97=_0x4fe69f[_0xa98f4a][_0x2424('0xa')](':');if(_0x4a0d97!=-0x1){_0xa18032=_0x4fe69f[_0xa98f4a][_0x2424('0xb')](0x0,_0x4a0d97)[_0x2424('0xc')]();_0x35926e=_0x4fe69f[_0xa98f4a][_0x2424('0xb')](_0x4a0d97+0x1)[_0x2424('0xc')]();if(_0xa18032['length']>0x0){_0x5e3f57[_0xa18032]=_0x35926e;}}else{}_0xa98f4a++;}this[_0x2424('0xd')]('headers',_0x5e3f57);this['_inBody']=!![];}_0x5a7cfe++;}this['_localBuffer']=_0x21e0a8;}else{while((_0x4d725a=_0x21e0a8[_0x2424('0xa')](_0x3890fd))!=-0x1){_0x291e4f=_0x21e0a8['substring'](0x0,_0x4d725a);this[_0x2424('0xd')](_0x2424('0xe'),_0x291e4f);_0x21e0a8=_0x21e0a8[_0x2424('0x8')](_0x4d725a+_0x3890fd[_0x2424('0xf')]);}this[_0x2424('0x10')]=_0x21e0a8;}_0x3460ac();};module[_0x2424('0x11')]=AGIReply; \ No newline at end of file +var _0x0be4=['length','split','slice','trim','emit','headers','exports','util','stream','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x0be4,0x1ed));var _0x40be=function(_0x1468b5,_0x449382){_0x1468b5=_0x1468b5-0x0;var _0x1e871e=_0x0be4[_0x1468b5];return _0x1e871e;};'use strict';var util=require(_0x40be('0x0'));var Transform=require(_0x40be('0x1'))['Transform'];function AGIReply(_0x4114ec){Transform['call'](this,_0x4114ec);this['_localBuffer']='';this[_0x40be('0x2')]=![];}util[_0x40be('0x3')](AGIReply,Transform);AGIReply[_0x40be('0x4')][_0x40be('0x5')]=function(_0x55b46a,_0x28e949,_0x1114ee){var _0x47bde1='\x0a',_0x50b3da=['\x0a\x0a',_0x40be('0x6')],_0x256274=-0x1,_0x133b46=-0x1,_0x1e49e5='',_0xb37b9e=0x0,_0x50a1a0='',_0x22cfa6='';this[_0x40be('0x7')]+=_0x55b46a[_0x40be('0x8')]();_0x50a1a0=this[_0x40be('0x7')];if(!this[_0x40be('0x2')]){_0xb37b9e=0x0;while(_0x50b3da[_0xb37b9e]){while((_0x133b46=_0x50a1a0[_0x40be('0x9')](_0x50b3da[_0xb37b9e]))!=-0x1){_0x1e49e5=_0x50b3da[_0xb37b9e];_0x22cfa6=_0x50a1a0[_0x40be('0xa')](0x0,_0x133b46);_0x50a1a0=_0x50a1a0[_0x40be('0xa')](_0x133b46+_0x1e49e5[_0x40be('0xb')]);var _0x3e5c75=_0x22cfa6[_0x40be('0xc')](_0x47bde1),_0x2e097f=0x0,_0x52f43a={},_0x19f4a2='',_0xa01481='',_0x1f00e7=-0x1;while(_0x3e5c75[_0x2e097f]){_0x1f00e7=_0x3e5c75[_0x2e097f][_0x40be('0x9')](':');if(_0x1f00e7!=-0x1){_0x19f4a2=_0x3e5c75[_0x2e097f][_0x40be('0xd')](0x0,_0x1f00e7)[_0x40be('0xe')]();_0xa01481=_0x3e5c75[_0x2e097f][_0x40be('0xd')](_0x1f00e7+0x1)['trim']();if(_0x19f4a2[_0x40be('0xb')]>0x0){_0x52f43a[_0x19f4a2]=_0xa01481;}}else{}_0x2e097f++;}this[_0x40be('0xf')](_0x40be('0x10'),_0x52f43a);this['_inBody']=!![];}_0xb37b9e++;}this[_0x40be('0x7')]=_0x50a1a0;}else{while((_0x256274=_0x50a1a0['indexOf'](_0x47bde1))!=-0x1){_0x22cfa6=_0x50a1a0['substring'](0x0,_0x256274);this['emit']('line',_0x22cfa6);_0x50a1a0=_0x50a1a0['substring'](_0x256274+_0x47bde1['length']);}this[_0x40be('0x7')]=_0x50a1a0;}_0x1114ee();};module[_0x40be('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 51d66b1..e79f5cb 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 _0x44a4=['Smtp','name','email','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut'];(function(_0xc14721,_0x5a08dd){var _0xfd2a4b=function(_0x1aebe1){while(--_0x1aebe1){_0xc14721['push'](_0xc14721['shift']());}};_0xfd2a4b(++_0x5a08dd);}(_0x44a4,0x15d));var _0x444a=function(_0x1b3d52,_0x477807){_0x1b3d52=_0x1b3d52-0x0;var _0x4527a7=_0x44a4[_0x1b3d52];return _0x4527a7;};'use strict';var BPromise=require('bluebird');var moment=require(_0x444a('0x0'));var _=require(_0x444a('0x1'));var util=require(_0x444a('0x2'));var jayson=require(_0x444a('0x3'));var client=jayson[_0x444a('0x4')][_0x444a('0x5')]({'port':0x2329});function request(_0x30f429,_0x5d1c1e){return new BPromise(function(_0x2ef723,_0x3a302f){return client[_0x444a('0x6')](_0x30f429,_0x5d1c1e)[_0x444a('0x7')](function(_0x556668){if(_0x556668[_0x444a('0x8')]){return _0x3a302f(_0x556668[_0x444a('0x8')][_0x444a('0x9')]);}else{return _0x2ef723(_0x556668[_0x444a('0xa')]);}})[_0x444a('0xb')](function(_0x1f75ef){return _0x3a302f(_0x1f75ef);});});}exports[_0x444a('0xc')]=function(_0x4636f4){return request(_0x444a('0xd'),{'options':{'raw':![],'where':{'name':_0x4636f4},'attributes':['production']}});};exports[_0x444a('0xe')]=function(_0x5f4c0e){return request(_0x444a('0xf'),{'options':{'raw':![],'where':{'id':_0x5f4c0e},'include':[{'model':_0x444a('0x10'),'as':_0x444a('0x11')}],'attributes':['id',_0x444a('0x12'),_0x444a('0x13')]}});};exports['getSquareProjectById']=function(_0x21e0c9){return request(_0x444a('0xd'),{'options':{'where':{'id':_0x21e0c9},'attributes':[_0x444a('0x12')]}});};exports[_0x444a('0x14')]=function(_0x1b23ff){return request(_0x444a('0x15'),{'options':{'where':{'id':_0x1b23ff},'attributes':['name']}});};exports['getVariableById']=function(_0x503447){return request(_0x444a('0x16'),{'options':{'where':{'id':_0x503447},'attributes':['name']}});};exports[_0x444a('0x17')]=function(_0x21b637){return request(_0x444a('0x18'),{'options':{'where':{'id':_0x21b637},'attributes':[_0x444a('0x19')]}});};exports[_0x444a('0x1a')]=function(_0x3b475e){return request(_0x444a('0x1b'),{'options':{'where':{'id':_0x3b475e},'attributes':[_0x444a('0x12')]}});};exports[_0x444a('0x1c')]=function(_0x5a17ee){return request('ShowTrunk',{'options':{'where':{'id':_0x5a17ee},'attributes':[_0x444a('0x12')]}});};exports[_0x444a('0x1d')]=function(_0x5ec31d){return request(_0x444a('0x1e'),{'options':{'where':{'id':_0x5ec31d},'attributes':[_0x444a('0x1f')]}});};exports['getIntervalById']=function(_0x191327){return request(_0x444a('0x20'),{'options':{'raw':![],'where':{'id':_0x191327},'include':[{'model':_0x444a('0x21'),'as':_0x444a('0x22')}]}});};exports[_0x444a('0x23')]=function(_0x285271){return request(_0x444a('0x24'),{'options':{'where':{'id':_0x285271},'attributes':['id',_0x444a('0x12')]}});};exports[_0x444a('0x25')]=function(_0x56e577){return request(_0x444a('0x26'),{'body':_0x56e577});};exports[_0x444a('0x27')]=function(_0x4863d1){return request(_0x444a('0x28'),{'body':_0x4863d1});};exports[_0x444a('0x29')]=function(_0x5b68f8){return request(_0x444a('0x2a'),{'body':_[_0x444a('0x2b')](_0x5b68f8,{'project_name':_0x5b68f8['arg_1'],'prev_project_name':_0x5b68f8[_0x444a('0x2c')]||'','is_subproject':_0x5b68f8[_0x444a('0x2c')]?!![]:![],'leaveAt':moment()['format'](_0x444a('0x2d'))})});};exports[_0x444a('0x2e')]=function(_0x27151b){return request(_0x444a('0x2f'),{'body':_0x27151b});};exports[_0x444a('0x30')]=function(_0x14cffe){return request(_0x444a('0x31'),{'body':_0x14cffe});};exports[_0x444a('0x32')]=function(_0x5d4ec9){return request(_0x444a('0x33'),{'options':{'raw':![],'where':{'phone':_0x5d4ec9[_0x444a('0x34')],'ListId':_0x5d4ec9['ListId']}}})[_0x444a('0x7')](function(_0x59ea2d){if(_0x59ea2d){return _0x59ea2d;}return request(_0x444a('0x35'),{'body':_0x5d4ec9});});};exports['getPauseById']=function(_0x432d9c){return request(_0x444a('0x36'),{'options':{'where':{'id':_0x432d9c},'attributes':[_0x444a('0x12')]}});};exports[_0x444a('0x37')]=function(_0x185ebe,_0x478144){return request(_0x444a('0x38'),{'body':{'interface':_0x478144},'options':{'where':_0x185ebe}});};exports[_0x444a('0x39')]=function(_0x5a73d6,_0x44f18f,_0x5b3b57){return request('PauseUser',{'body':{'type':_0x44f18f,'uniqueid':_0x5b3b57},'options':{'where':_0x5a73d6}});};exports[_0x444a('0x3a')]=function(_0x5f1c78){return request(_0x444a('0x3b'),{'body':{},'options':{'where':_0x5f1c78}});};exports[_0x444a('0x3c')]=function(_0x1d76c7){return request('LogoutUser',{'body':{},'options':{'where':_0x1d76c7}});}; \ No newline at end of file +var _0xf963=['MailServerOut','Smtp','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','name','getVariableById','ShowVariable','getSquareOdbcById','getUserById','ShowUser','ShowTrunk','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','CreateSmsMessage','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','util','jayson/promise','then','error','message','catch','getMailAccountById','ShowMailAccount'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf963,0x11d));var _0x3f96=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xf963[_0xb0f7c3];return _0x28ea68;};'use strict';var BPromise=require(_0x3f96('0x0'));var moment=require('moment');var _=require('lodash');var util=require(_0x3f96('0x1'));var jayson=require(_0x3f96('0x2'));var client=jayson['client']['http']({'port':0x2329});function request(_0x1f30a1,_0x1e7cb9){return new BPromise(function(_0x3a6815,_0x1a91ab){return client['request'](_0x1f30a1,_0x1e7cb9)[_0x3f96('0x3')](function(_0x56c663){if(_0x56c663[_0x3f96('0x4')]){return _0x1a91ab(_0x56c663[_0x3f96('0x4')][_0x3f96('0x5')]);}else{return _0x3a6815(_0x56c663['result']);}})[_0x3f96('0x6')](function(_0x1b713d){return _0x1a91ab(_0x1b713d);});});}exports['getSquareProject']=function(_0x50a3bf){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x50a3bf},'attributes':['production']}});};exports[_0x3f96('0x7')]=function(_0x3342b8){return request(_0x3f96('0x8'),{'options':{'raw':![],'where':{'id':_0x3342b8},'include':[{'model':_0x3f96('0x9'),'as':_0x3f96('0xa')}],'attributes':['id','name',_0x3f96('0xb')]}});};exports[_0x3f96('0xc')]=function(_0x37432a){return request(_0x3f96('0xd'),{'options':{'where':{'id':_0x37432a},'attributes':['name']}});};exports[_0x3f96('0xe')]=function(_0x5ed774){return request(_0x3f96('0xf'),{'options':{'where':{'id':_0x5ed774},'attributes':[_0x3f96('0x10')]}});};exports[_0x3f96('0x11')]=function(_0x4c5236){return request(_0x3f96('0x12'),{'options':{'where':{'id':_0x4c5236},'attributes':['name']}});};exports[_0x3f96('0x13')]=function(_0x591ded){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x591ded},'attributes':['dsn']}});};exports[_0x3f96('0x14')]=function(_0x333dc0){return request(_0x3f96('0x15'),{'options':{'where':{'id':_0x333dc0},'attributes':[_0x3f96('0x10')]}});};exports['getTrunkById']=function(_0x234a34){return request(_0x3f96('0x16'),{'options':{'where':{'id':_0x234a34},'attributes':[_0x3f96('0x10')]}});};exports['getSoundById']=function(_0x239a9d){return request(_0x3f96('0x17'),{'options':{'where':{'id':_0x239a9d},'attributes':[_0x3f96('0x18')]}});};exports['getIntervalById']=function(_0x231ad4){return request(_0x3f96('0x19'),{'options':{'raw':![],'where':{'id':_0x231ad4},'include':[{'model':_0x3f96('0x1a'),'as':_0x3f96('0x1b')}]}});};exports[_0x3f96('0x1c')]=function(_0xb60019){return request('ShowSmsAccount',{'options':{'where':{'id':_0xb60019},'attributes':['id',_0x3f96('0x10')]}});};exports['createSmsMessage']=function(_0x422885){return request(_0x3f96('0x1d'),{'body':_0x422885});};exports['createSquareDetailsReport']=function(_0xd6ddf){return request(_0x3f96('0x1e'),{'body':_0xd6ddf});};exports['createSquareReport']=function(_0x14ef4e){return request(_0x3f96('0x1f'),{'body':_[_0x3f96('0x20')](_0x14ef4e,{'project_name':_0x14ef4e[_0x3f96('0x21')],'prev_project_name':_0x14ef4e[_0x3f96('0x22')]||'','is_subproject':_0x14ef4e[_0x3f96('0x22')]?!![]:![],'leaveAt':moment()[_0x3f96('0x23')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x39cccc){return request('CreateSquareRecording',{'body':_0x39cccc});};exports['createSquareMessage']=function(_0x34b9a2){return request('CreateSquareMessage',{'body':_0x34b9a2});};exports[_0x3f96('0x24')]=function(_0x5d0c7a){return request(_0x3f96('0x25'),{'options':{'raw':![],'where':{'phone':_0x5d0c7a[_0x3f96('0x26')],'ListId':_0x5d0c7a[_0x3f96('0x27')]}}})[_0x3f96('0x3')](function(_0x3a46ee){if(_0x3a46ee){return _0x3a46ee;}return request(_0x3f96('0x28'),{'body':_0x5d0c7a});});};exports['getPauseById']=function(_0x45616d){return request(_0x3f96('0x29'),{'options':{'where':{'id':_0x45616d},'attributes':['name']}});};exports[_0x3f96('0x2a')]=function(_0xcc4dbf,_0x562e74){return request(_0x3f96('0x2b'),{'body':{'interface':_0x562e74},'options':{'where':_0xcc4dbf}});};exports['agentPause']=function(_0x3a175b,_0x4fd850,_0xdf260b){return request(_0x3f96('0x2c'),{'body':{'type':_0x4fd850,'uniqueid':_0xdf260b},'options':{'where':_0x3a175b}});};exports[_0x3f96('0x2d')]=function(_0xa2b132){return request(_0x3f96('0x2e'),{'body':{},'options':{'where':_0xa2b132}});};exports[_0x3f96('0x2f')]=function(_0x46b69e){return request(_0x3f96('0x30'),{'body':{},'options':{'where':_0x46b69e}});}; \ 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 3bf08e3..736b2e5 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 _0x5db2=['./polly','./lex','exports'];(function(_0x909abb,_0x49bef3){var _0x421e71=function(_0x4d445c){while(--_0x4d445c){_0x909abb['push'](_0x909abb['shift']());}};_0x421e71(++_0x49bef3);}(_0x5db2,0xf3));var _0x25db=function(_0x5941a3,_0x358c94){_0x5941a3=_0x5941a3-0x0;var _0x127e7a=_0x5db2[_0x5941a3];return _0x127e7a;};var polly=require(_0x25db('0x0'));var lex=require(_0x25db('0x1'));module[_0x25db('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x4e47=['exports'];(function(_0x401517,_0xa3abb9){var _0x12afd9=function(_0x2ea25e){while(--_0x2ea25e){_0x401517['push'](_0x401517['shift']());}};_0x12afd9(++_0xa3abb9);}(_0x4e47,0x17f));var _0x74e4=function(_0xf78633,_0x1fb216){_0xf78633=_0xf78633-0x0;var _0x96633a=_0x4e47[_0xf78633];return _0x96633a;};var polly=require('./polly');var lex=require('./lex');module[_0x74e4('0x0')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 5eed614..07a7983 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 _0x878f=['exports'];(function(_0x3ac081,_0x4e2219){var _0x3f0a54=function(_0x481057){while(--_0x481057){_0x3ac081['push'](_0x3ac081['shift']());}};_0x3f0a54(++_0x4e2219);}(_0x878f,0x173));var _0xf878=function(_0x491773,_0x1d92f2){_0x491773=_0x491773-0x0;var _0x51378e=_0x878f[_0x491773];return _0x51378e;};'use strict';var lex=require('./lib/api');module[_0xf878('0x0')]=function(_0x658976,_0x2e1d23,_0x12df2b,_0x1b3d0b,_0x3d74cf,_0x9e6783){return lex(_0x658976,_0x2e1d23,_0x12df2b,_0x1b3d0b,_0x3d74cf,_0x9e6783);}; \ No newline at end of file +var _0xe5b5=['exports','./lib/api'];(function(_0x38fc40,_0x29bad8){var _0x405031=function(_0x331916){while(--_0x331916){_0x38fc40['push'](_0x38fc40['shift']());}};_0x405031(++_0x29bad8);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x1e9e56,_0x34a74a){_0x1e9e56=_0x1e9e56-0x0;var _0x5d5e2e=_0xe5b5[_0x1e9e56];return _0x5d5e2e;};'use strict';var lex=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]=function(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763){return lex(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763);}; \ 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 10ff814..f52d328 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(_0x46779a,_0x3c328a){var _0xd49994=function(_0x5b787e){while(--_0x5b787e){_0x46779a['push'](_0x46779a['shift']());}};_0xd49994(++_0x3c328a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0x4cc28c,_0x105f9d){var _0x3dad86=function(_0x1f4606){while(--_0x1f4606){_0x4cc28c['push'](_0x4cc28c['shift']());}};_0x3dad86(++_0x105f9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 2c86c33..a9c93f1 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 _0xc136=['exports','./lib/api'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xc136,0x169));var _0x6c13=function(_0x15423e,_0x1f0c52){_0x15423e=_0x15423e-0x0;var _0x28b997=_0xc136[_0x15423e];return _0x28b997;};'use strict';var polly=require(_0x6c13('0x0'));module[_0x6c13('0x1')]=function(_0x448b09,_0x480d57,_0x4579e6,_0x15ba4b,_0x20d859,_0x2c5d54,_0x198f32){return polly(_0x448b09,_0x480d57,_0x4579e6,_0x15ba4b,_0x20d859,_0x2c5d54,_0x198f32);}; \ No newline at end of file +var _0x8a44=['./lib/api'];(function(_0x156325,_0x3bb4a3){var _0x3b0385=function(_0x4b087c){while(--_0x4b087c){_0x156325['push'](_0x156325['shift']());}};_0x3b0385(++_0x3bb4a3);}(_0x8a44,0x6e));var _0x48a4=function(_0x89efac,_0x101341){_0x89efac=_0x89efac-0x0;var _0x26384f=_0x8a44[_0x89efac];return _0x26384f;};'use strict';var polly=require(_0x48a4('0x0'));module['exports']=function(_0x55b59f,_0x146bfb,_0x35d8b4,_0xcae7d4,_0x45dffe,_0x17e37c,_0x1b15c6){return polly(_0x55b59f,_0x146bfb,_0x35d8b4,_0xcae7d4,_0x45dffe,_0x17e37c,_0x1b15c6);}; \ 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 c4cab5e..6a4aac9 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 _0xa9b1=['bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile','exports','Polly','text','mp3'];(function(_0x209021,_0x455a3b){var _0x4bdceb=function(_0x5e4214){while(--_0x5e4214){_0x209021['push'](_0x209021['shift']());}};_0x4bdceb(++_0x455a3b);}(_0xa9b1,0xa2));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x1a9b('0x0'));var rs=require('randomstring');var AWS=require(_0x1a9b('0x1'));function pollyResult(_0x4d231,_0x32a568,_0xf18a48){return new BPromise(function(_0x43c75c,_0x1b33c0){_0x4d231[_0x1a9b('0x2')](_0x32a568,function(_0x5e9538,_0x47e9e1){if(_0x5e9538){_0x1b33c0(_0x5e9538);}else if(_0x47e9e1){if(_0x47e9e1[_0x1a9b('0x3')]instanceof Buffer){fs[_0x1a9b('0x4')](_0xf18a48,_0x47e9e1[_0x1a9b('0x3')],function(_0x5a2871){if(_0x5a2871){_0x1b33c0(_0x5a2871);}else{_0x43c75c();}});}else{_0x1b33c0(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x1b33c0(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x1a9b('0x5')]=function(_0x32e1e0,_0x3f547e,_0x5dad8c,_0x4963c9,_0x1d9f0d,_0x505761,_0xd665d8){var _0x509617=new AWS[(_0x1a9b('0x6'))]({'accessKeyId':_0x32e1e0,'secretAccessKey':_0x3f547e,'region':_0x5dad8c});var _0x108a35={'Text':_0x1d9f0d,'TextType':_0x505761||_0x1a9b('0x7'),'OutputFormat':_0x1a9b('0x8'),'VoiceId':_0x4963c9};return pollyResult(_0x509617,_0x108a35,_0xd665d8);}; \ No newline at end of file +var _0xbe56=['mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text'];(function(_0x174a4d,_0x203ae3){var _0x240fa1=function(_0x7139f){while(--_0x7139f){_0x174a4d['push'](_0x174a4d['shift']());}};_0x240fa1(++_0x203ae3);}(_0xbe56,0x15f));var _0x6be5=function(_0x5a44c0,_0x199a5b){_0x5a44c0=_0x5a44c0-0x0;var _0x336d74=_0xbe56[_0x5a44c0];return _0x336d74;};'use strict';var fs=require('fs');var path=require(_0x6be5('0x0'));var BPromise=require(_0x6be5('0x1'));var rs=require(_0x6be5('0x2'));var AWS=require(_0x6be5('0x3'));function pollyResult(_0x14bae8,_0x354b36,_0x144034){return new BPromise(function(_0x2ff734,_0x42be4c){_0x14bae8[_0x6be5('0x4')](_0x354b36,function(_0x53e43a,_0x503fe2){if(_0x53e43a){_0x42be4c(_0x53e43a);}else if(_0x503fe2){if(_0x503fe2['AudioStream']instanceof Buffer){fs[_0x6be5('0x5')](_0x144034,_0x503fe2['AudioStream'],function(_0xc2f1da){if(_0xc2f1da){_0x42be4c(_0xc2f1da);}else{_0x2ff734();}});}else{_0x42be4c(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x42be4c(new Error(_0x6be5('0x6')));}});});}module['exports']=function(_0x490626,_0x5ea453,_0x2f6f0b,_0x33fe23,_0x116bc6,_0x1d1b43,_0x13b603){var _0x495390=new AWS[(_0x6be5('0x7'))]({'accessKeyId':_0x490626,'secretAccessKey':_0x5ea453,'region':_0x2f6f0b});var _0x218ade={'Text':_0x116bc6,'TextType':_0x1d1b43||_0x6be5('0x8'),'OutputFormat':_0x6be5('0x9'),'VoiceId':_0x33fe23};return pollyResult(_0x495390,_0x218ade,_0x13b603);}; \ 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 f3c24b3..7957782 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 _0x5379=['exports','./lib/api'];(function(_0x1ce4ce,_0x56e879){var _0x205e45=function(_0x1da327){while(--_0x1da327){_0x1ce4ce['push'](_0x1ce4ce['shift']());}};_0x205e45(++_0x56e879);}(_0x5379,0x1b1));var _0x9537=function(_0xec52f9,_0x15955a){_0xec52f9=_0xec52f9-0x0;var _0x2c01ae=_0x5379[_0xec52f9];return _0x2c01ae;};'use strict';var asr=require(_0x9537('0x0'));module[_0x9537('0x1')]=function(_0x380286,_0x429c8f,_0x4593a3,_0x152954){return asr(_0x380286,_0x429c8f,_0x4593a3);}; \ No newline at end of file +var _0x4a98=['exports','./lib/api'];(function(_0x3813e2,_0xbab7d4){var _0x201f02=function(_0x1c5955){while(--_0x1c5955){_0x3813e2['push'](_0x3813e2['shift']());}};_0x201f02(++_0xbab7d4);}(_0x4a98,0x155));var _0x84a9=function(_0x2bb452,_0x2dbbc0){_0x2bb452=_0x2bb452-0x0;var _0x5f50a6=_0x4a98[_0x2bb452];return _0x5f50a6;};'use strict';var asr=require(_0x84a9('0x0'));module[_0x84a9('0x1')]=function(_0x2d3cd8,_0x4a2e1f,_0xf4adf1,_0x5106be){return asr(_0x2d3cd8,_0x4a2e1f,_0xf4adf1);}; \ 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 fb838b7..0a1de8b 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 _0x130d=['lang\x20should\x20be\x20a\x20string','toString','base64','/v1/speech:recognize?key=','LINEAR16','url','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var url=require(_0xd130('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xd130('0x1');module['exports']=function(_0x45f869,_0x389725,_0x3591d2){return new BPromise(function(_0x77d691,_0x321e49){var _0x2bc19d;if(typeof _0x45f869!==_0xd130('0x2')||_0x45f869[_0xd130('0x3')]===0x0){return _0x321e49(_0xd130('0x4'));}if(typeof _0x389725!==_0xd130('0x2')||_0x389725[_0xd130('0x3')]===0x0){return _0x321e49(_0xd130('0x5'));}if(typeof _0x3591d2!==_0xd130('0x6')&&(typeof _0x3591d2!==_0xd130('0x2')||_0x3591d2['length']===0x0)){return _0x321e49(_0xd130('0x7'));}try{_0x2bc19d=fs['readFileSync'](_0x45f869)[_0xd130('0x8')](_0xd130('0x9'));}catch(_0x3af355){return _0x321e49(_0x3af355);}return _0x77d691({'method':'POST','uri':host+_0xd130('0xa')+_0x389725,'body':{'config':{'encoding':_0xd130('0xb'),'sampleRateHertz':'8000','languageCode':_0x3591d2},'audio':{'content':_0x2bc19d}},'json':!![]});});}; \ No newline at end of file +var _0x9a19=['LINEAR16','url','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','base64','POST','/v1/speech:recognize?key='];(function(_0x18174c,_0x5b43ea){var _0x17f34b=function(_0x317d87){while(--_0x317d87){_0x18174c['push'](_0x18174c['shift']());}};_0x17f34b(++_0x5b43ea);}(_0x9a19,0x114));var _0x99a1=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0x9a19[_0x57add2];return _0x4e3670;};'use strict';var url=require(_0x99a1('0x0'));var BPromise=require(_0x99a1('0x1'));var fs=require('fs');var host=_0x99a1('0x2');module['exports']=function(_0x16fd8b,_0x2ba463,_0x112bcc){return new BPromise(function(_0x25da2d,_0x214082){var _0x3d73c5;if(typeof _0x16fd8b!==_0x99a1('0x3')||_0x16fd8b[_0x99a1('0x4')]===0x0){return _0x214082(_0x99a1('0x5'));}if(typeof _0x2ba463!==_0x99a1('0x3')||_0x2ba463[_0x99a1('0x4')]===0x0){return _0x214082('key\x20should\x20be\x20a\x20string');}if(typeof _0x112bcc!=='undefined'&&(typeof _0x112bcc!=='string'||_0x112bcc[_0x99a1('0x4')]===0x0)){return _0x214082(_0x99a1('0x6'));}try{_0x3d73c5=fs['readFileSync'](_0x16fd8b)['toString'](_0x99a1('0x7'));}catch(_0xd7b568){return _0x214082(_0xd7b568);}return _0x25da2d({'method':_0x99a1('0x8'),'uri':host+_0x99a1('0x9')+_0x2ba463,'body':{'config':{'encoding':_0x99a1('0xa'),'sampleRateHertz':'8000','languageCode':_0x112bcc},'audio':{'content':_0x3d73c5}},'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 c855ffd..ccfb072 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 _0x1033=['./asr'];(function(_0x595865,_0x14597c){var _0x43a72d=function(_0x5afa99){while(--_0x5afa99){_0x595865['push'](_0x595865['shift']());}};_0x43a72d(++_0x14597c);}(_0x1033,0x152));var _0x3103=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x1033[_0x1969a7];return _0x3d665f;};var asr=require(_0x3103('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x370a=['exports'];(function(_0x37bb0c,_0x514acc){var _0x299bc8=function(_0x28e227){while(--_0x28e227){_0x37bb0c['push'](_0x37bb0c['shift']());}};_0x299bc8(++_0x514acc);}(_0x370a,0x102));var _0xa370=function(_0x474131,_0x4d6e27){_0x474131=_0x474131-0x0;var _0x5252fe=_0x370a[_0x474131];return _0x5252fe;};var asr=require('./asr');module[_0xa370('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 595d89f..79502d8 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 _0xab1c=['url','parse','util','./aws','./google','./sestek','./tilde','agi','protocol','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','pipe','end','host','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','.wav','then','chmodSync','777','split','readFileSync','base64','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','\x22\x20might\x20not\x20exist','tmp','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','textRequest','result','source','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api'];(function(_0x5f2199,_0x294293){var _0x742122=function(_0x1cea19){while(--_0x1cea19){_0x5f2199['push'](_0x5f2199['shift']());}};_0x742122(++_0x294293);}(_0xab1c,0x19b));var _0xcab1=function(_0x3a409f,_0xa059a4){_0x3a409f=_0x3a409f-0x0;var _0x2e3651=_0xab1c[_0x3a409f];return _0x2e3651;};'use strict';var apiai=require(_0xcab1('0x0'));var BPromise=require(_0xcab1('0x1'));var dialogflow=require(_0xcab1('0x2'));var fs=require('fs');var http=require(_0xcab1('0x3'));var https=require(_0xcab1('0x4'));var md5=require(_0xcab1('0x5'));var path=require(_0xcab1('0x6'));var querystring=require(_0xcab1('0x7'));var rp=require(_0xcab1('0x8'));var rs=require(_0xcab1('0x9'));var sox=require(_0xcab1('0xa'));var tts=require(_0xcab1('0xb'));var urlParse=require(_0xcab1('0xc'))[_0xcab1('0xd')];var util=require(_0xcab1('0xe'));var aws=require(_0xcab1('0xf'));var google=require(_0xcab1('0x10'));var sestek=require(_0xcab1('0x11'));var tilde=require(_0xcab1('0x12'));var logger=require('../../../config/logger')(_0xcab1('0x13'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x35c845,_0x5403f3){return new BPromise(function(_0x5b71ea,_0x187c81){var _0x560475=urlParse(_0x35c845);var _0x4a28e5=_0x560475[_0xcab1('0x14')]===_0xcab1('0x15')?https:http;var _0x4a0b52={'host':_0x560475['host'],'path':_0x560475[_0xcab1('0x6')],'headers':{'user-agent':_0xcab1('0x16')}};_0x4a28e5[_0xcab1('0x17')](_0x4a0b52,function(_0x352f07){if(_0x352f07[_0xcab1('0x18')]!==0xc8){logger[_0xcab1('0x19')](_0xcab1('0x1a')+_0x35c845+_0xcab1('0x1b')+_0x352f07[_0xcab1('0x18')]+'\x20('+_0x352f07[_0xcab1('0x1c')]+')');_0x187c81(new Error(_0xcab1('0x1a')+_0x35c845+'\x20failed,\x20status\x20code\x20=\x20'+_0x352f07[_0xcab1('0x18')]+'\x20('+_0x352f07[_0xcab1('0x1c')]+')'));return;}var _0x16f326=fs[_0xcab1('0x1d')](_0x5403f3);_0x16f326['on'](_0xcab1('0x1e'),function(){logger[_0xcab1('0x1f')](_0xcab1('0x20'));_0x16f326['close'](_0x5b71ea);});_0x16f326['on'](_0xcab1('0x19'),function(_0x10e998){fs[_0xcab1('0x21')](_0x5403f3);logger['error']('download\x20error',_0x10e998);_0x187c81(_0x10e998);});_0x352f07[_0xcab1('0x22')](_0x16f326);})['on'](_0xcab1('0x19'),function(_0x3c097a){logger['error'](_0x3c097a);_0x187c81(_0x3c097a);})[_0xcab1('0x23')]();});}function uploadFile(_0x36a7d3){return new BPromise(function(_0x2a2ae9,_0x174766){var _0x19bd85=urlParse(_0x36a7d3);var _0x154dc5=_0x19bd85['protocol']==='https:'?https:http;var _0x521ea9={'host':_0x19bd85[_0xcab1('0x24')],'path':_0x19bd85['path'],'headers':{'user-agent':_0xcab1('0x16')}};_0x154dc5[_0xcab1('0x17')](_0x521ea9,function(_0xfae6f5){if(_0xfae6f5[_0xcab1('0x18')]!==0xc8){_0x174766(new Error('request\x20to\x20'+_0x36a7d3+_0xcab1('0x1b')+_0xfae6f5['statusCode']+'\x20('+_0xfae6f5[_0xcab1('0x1c')]+')'));return;}var _0x9243a1='';_0xfae6f5['on'](_0xcab1('0x25'),function(_0x16826c){_0x9243a1+=_0x16826c;});_0xfae6f5['on'](_0xcab1('0x23'),function(){_0x2a2ae9(_0x9243a1);});})['on']('error',function(_0x635007){_0x174766(_0x635007);})[_0xcab1('0x23')]();});}function convertFile(_0xa871f,_0x1da34d){return new BPromise(function(_0x32ca14,_0xe934db){var _0x21358b=sox[_0xcab1('0x26')](_0xa871f,_0x1da34d,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x21358b['on'](_0xcab1('0x19'),function(_0x31a3b4){logger['error'](_0xcab1('0x27'),_0x31a3b4);_0xe934db(_0x31a3b4);});_0x21358b['on'](_0xcab1('0x23'),function(){logger[_0xcab1('0x1f')](_0xcab1('0x28'));_0x32ca14();});_0x21358b[_0xcab1('0x29')]();});}function base64Decode(_0x33ba18,_0x3ad237){var _0x5c7bb4=path[_0xcab1('0x2a')](__dirname,'tmp',rs['generate'](0x4)+_0xcab1('0x2b'));fs['writeFileSync'](_0x5c7bb4,_0x33ba18,'base64');return convertFile(_0x5c7bb4,_0x3ad237)[_0xcab1('0x2c')](function(){try{fs['unlink'](_0x5c7bb4);fs[_0xcab1('0x2d')](_0x3ad237,_0xcab1('0x2e'));}catch(_0x5980d6){logger[_0xcab1('0x19')](_0x5980d6);}return _0x3ad237[_0xcab1('0x2f')]('.')[0x0];});}function base64Encode(_0x891d01){var _0x5ada67=fs[_0xcab1('0x30')](_0x891d01);return new Buffer(_0x5ada67)['toString'](_0xcab1('0x31'));}exports[_0xcab1('0x32')]=function(_0x17ed7f,_0x5bd8da,_0x54ab0a,_0x558739,_0x2a3628,_0x3a1586){var _0x3e7ec1,_0x341dd2;var _0x196159='https://texttospeech.googleapis.com/v1/';var _0x5e04d9=_0xcab1('0x33')+_0x17ed7f;var _0x29f1ee={};if(_0x5bd8da===_0xcab1('0x34')){_0x29f1ee[_0xcab1('0x35')]={'ssml':_0x54ab0a};}else{_0x29f1ee[_0xcab1('0x35')]={'text':_0x54ab0a};};_0x29f1ee[_0xcab1('0x36')]={'languageCode':_0x558739,'ssmlGender':_0x2a3628};_0x29f1ee[_0xcab1('0x37')]={'audioEncoding':_0xcab1('0x38'),'sampleRateHertz':0x1f40};var _0x579296={'url':_0x196159+_0xcab1('0x39')+_0x5e04d9,'method':_0xcab1('0x3a'),'json':!![],'body':_0x29f1ee};return rp(_0x579296)[_0xcab1('0x2c')](function(_0xf55029){return new BPromise(function(_0x12dc25,_0x46f205){_0x3e7ec1=path[_0xcab1('0x2a')](__dirname,'tmp',rs[_0xcab1('0x3b')](0x4)+_0xcab1('0x3c'));var _0x9523d8=Buffer[_0xcab1('0x3d')](_0xf55029[_0xcab1('0x3e')],_0xcab1('0x31'));return fs[_0xcab1('0x3f')](_0x3e7ec1,_0x9523d8,function(_0x560785){_0x46f205(_0x560785);},function(_0x15da4e){fs[_0xcab1('0x2d')](_0x3e7ec1,'777');_0x12dc25(_0x15da4e);});});})[_0xcab1('0x2c')](function(_0x1357df){_0x341dd2=path[_0xcab1('0x2a')](__dirname,'tmp',rs[_0xcab1('0x3b')](0x4)+_0xcab1('0x2b'));return convertFile(_0x3e7ec1,_0x341dd2);})[_0xcab1('0x2c')](function(){try{fs[_0xcab1('0x21')](_0x3e7ec1);fs[_0xcab1('0x2d')](_0x341dd2,'777');}catch(_0x4e3a0c){logger['error'](_0x4e3a0c);}logger[_0xcab1('0x1f')](_0xcab1('0x40'),_0x341dd2[_0xcab1('0x2f')]('.')[0x0]);return _0x341dd2[_0xcab1('0x2f')]('.')[0x0];});};exports[_0xcab1('0x41')]=function(_0x54f5d3,_0xf081ad){var _0x261e97=_0xcab1('0x42');var _0x45dfbd,_0x37560c;var _0x422600;var _0x49428f={'encoding':_0xcab1('0x43'),'method':'POST','timeout':0x2710,'url':_0x261e97,'headers':{'Content-Type':_0xcab1('0x44')},'body':'f.req='+encodeURIComponent(JSON[_0xcab1('0x45')]([[[_0xcab1('0x46'),JSON[_0xcab1('0x45')]([_0x54f5d3,_0xf081ad||'en',![],_0xcab1('0x47')]),null,'generic']]]))};return rp(_0x49428f)[_0xcab1('0x2c')](function(_0x528816){try{_0x422600=eval(_0x528816[_0xcab1('0x48')](0x5))[0x0][0x2];}catch(_0x35dabf){throw new Error(_0xcab1('0x49')+_0x528816[_0xcab1('0x25')]);}if(!_0x422600){if(_0x54f5d3['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0xf081ad+_0xcab1('0x4a'));}}try{_0x422600=eval(_0x422600)[0x0];}catch(_0xeb8f7b){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xcab1('0x25')]);}const _0x50d29a=_0x422600;_0x45dfbd=path['resolve'](__dirname,_0xcab1('0x4b'),rs[_0xcab1('0x3b')](0x4)+_0xcab1('0x3c'));fs['writeFileSync'](_0x45dfbd,_0x422600,{'encoding':_0xcab1('0x31')});_0x37560c=path[_0xcab1('0x2a')](__dirname,'tmp',rs[_0xcab1('0x3b')](0x4)+'.wav');return convertFile(_0x45dfbd,_0x37560c);})[_0xcab1('0x2c')](function(){try{fs[_0xcab1('0x21')](_0x45dfbd);fs[_0xcab1('0x2d')](_0x37560c,_0xcab1('0x2e'));}catch(_0xe69743){logger['error'](_0xe69743);}logger['info'](_0xcab1('0x4c'),_0x37560c[_0xcab1('0x2f')]('.')[0x0]);return _0x37560c['split']('.')[0x0];});};exports[_0xcab1('0x4d')]=function(_0x112d29,_0x3eefae,_0x4e16d6){return google[_0xcab1('0x4e')](_0x112d29,_0x3eefae,_0x4e16d6)[_0xcab1('0x2c')](function(_0x32a7d8){logger[_0xcab1('0x1f')](_0x32a7d8[_0xcab1('0x4f')]);return rp(_0x32a7d8);})['then'](function(_0x458287){var _0x348d2e='';var _0x27872f=0x0;try{fs[_0xcab1('0x21')](_0x112d29);}catch(_0x4c2671){logger[_0xcab1('0x19')](_0x4c2671);}if(_0x458287&&_0x458287[_0xcab1('0x50')]){_0x348d2e=_0x458287['results'][_0xcab1('0x51')](function(_0x4c8606){return _0x4c8606&&_0x4c8606['alternatives'][0x0]&&_0x4c8606[_0xcab1('0x52')][0x0][_0xcab1('0x53')]?_0x4c8606[_0xcab1('0x52')][0x0][_0xcab1('0x53')]:'';})[_0xcab1('0x54')]('\x0a');_0x27872f=_0x458287[_0xcab1('0x50')]['map'](function(_0x511ea9){return _0x511ea9&&_0x511ea9[_0xcab1('0x52')][0x0]&&_0x511ea9[_0xcab1('0x52')][0x0]['confidence']?_0x511ea9[_0xcab1('0x52')][0x0][_0xcab1('0x55')]:0x0;})['join']('\x0a');}logger[_0xcab1('0x1f')](_0xcab1('0x56'),_0x348d2e);logger[_0xcab1('0x1f')](_0xcab1('0x57'),_0x27872f);return{'transcript':_0x348d2e,'confidence':_0x27872f};})['catch'](function(_0xc587fc){logger[_0xcab1('0x19')](_0xcab1('0x58'),_0xc587fc[_0xcab1('0x18')],_0xc587fc[_0xcab1('0x59')],_0xc587fc[_0xcab1('0x5a')]);});};exports['googleDialogflow']=function(_0x1d6b6e,_0x5f0f0b,_0x152063,_0x3cb6ec){var _0x4084bb=apiai(_0x5f0f0b,{'language':_0x3cb6ec||'en'});return _0x4084bb[_0xcab1('0x5b')](_0x152063,{'sessionId':md5(_0x1d6b6e)})[_0xcab1('0x2c')](function(_0x2bf48f){logger[_0xcab1('0x1f')](JSON['stringify'](_0x2bf48f));return{'source':_0x2bf48f[_0xcab1('0x5c')][_0xcab1('0x5d')],'resolvedQuery':_0x2bf48f[_0xcab1('0x5c')]['resolvedQuery'],'action':_0x2bf48f[_0xcab1('0x5c')]['action'],'actionIncomplete':_0x2bf48f[_0xcab1('0x5c')][_0xcab1('0x5e')],'speech':_0x2bf48f['result'][_0xcab1('0x5f')][_0xcab1('0x60')],'score':_0x2bf48f['result'][_0xcab1('0x61')],'statusCode':_0x2bf48f[_0xcab1('0x62')][_0xcab1('0x63')],'endConversation':_0x2bf48f[_0xcab1('0x5c')][_0xcab1('0x64')][_0xcab1('0x65')]||![],'isFallbackIntent':_0x2bf48f['result'][_0xcab1('0x64')][_0xcab1('0x66')]};});};exports[_0xcab1('0x67')]=function(_0x3e700c,_0x5b7bb5,_0x46989c,_0x109c61,_0x45f0fe,_0x196f4c){var _0x5b0fa6=_0x109c61['replace'](/\\n/g,'\x0a');var _0x4b2eeb={'credentials':{'private_key':_0x5b0fa6,'client_email':_0x46989c}};var _0x1236cf=new dialogflow[(_0xcab1('0x68'))](_0x4b2eeb);var _0x584d4=_0x1236cf[_0xcab1('0x69')](_0x5b7bb5,md5(_0x3e700c));var _0x477616={'session':_0x584d4,'queryInput':{'text':{'text':_0x45f0fe,'languageCode':_0x196f4c}}};return _0x1236cf[_0xcab1('0x6a')](_0x477616)[_0xcab1('0x2c')](function(_0x3467ad){if(_0x3467ad&&_0x3467ad['length']){logger[_0xcab1('0x1f')](_0xcab1('0x6b'),JSON[_0xcab1('0x45')](_0x3467ad));var _0x2fea80=_0x3467ad[0x0];if(_0x2fea80){var _0x29e23a={'action':_0x2fea80[_0xcab1('0x6c')][_0xcab1('0x6d')],'allRequiredParamsPresent':_0x2fea80['queryResult'][_0xcab1('0x6e')],'endConversation':_0x2fea80[_0xcab1('0x6c')]['diagnosticInfo']&&_0x2fea80[_0xcab1('0x6c')][_0xcab1('0x6f')][_0xcab1('0x70')]?_0x2fea80[_0xcab1('0x6c')][_0xcab1('0x6f')][_0xcab1('0x70')][_0xcab1('0x71')][_0xcab1('0x72')]:![],'fulfillmentText':_0x2fea80[_0xcab1('0x6c')][_0xcab1('0x73')],'intentName':_0x2fea80[_0xcab1('0x6c')][_0xcab1('0x74')][_0xcab1('0x59')],'intentDisplayName':_0x2fea80[_0xcab1('0x6c')]['intent'][_0xcab1('0x75')],'isFallbackIntent':_0x2fea80[_0xcab1('0x6c')][_0xcab1('0x74')]['isFallback'],'languageCode':_0x2fea80['queryResult']['languageCode'],'queryText':_0x2fea80[_0xcab1('0x6c')][_0xcab1('0x76')],'responseId':_0x2fea80[_0xcab1('0x77')],'score':_0x2fea80[_0xcab1('0x6c')]['intentDetectionConfidence'],'speech':_0x2fea80[_0xcab1('0x6c')][_0xcab1('0x73')],'providerResponse':JSON[_0xcab1('0x45')](_0x3467ad)};return _0x29e23a;}}});};exports[_0xcab1('0x78')]=function(_0x1a0317,_0xa9b2a7,_0x595c91,_0x8f798d){return tilde[_0xcab1('0x4e')](_0x1a0317,_0xa9b2a7,_0x595c91,_0x8f798d)[_0xcab1('0x2c')](function(_0x183d9e){try{fs[_0xcab1('0x21')](_0x1a0317);}catch(_0x159020){logger[_0xcab1('0x19')](_0x159020);}logger[_0xcab1('0x1f')](_0xcab1('0x79'),_0x183d9e[_0xcab1('0x53')]);logger[_0xcab1('0x1f')](_0xcab1('0x7a'),_0x183d9e[_0xcab1('0x55')]);return _0x183d9e;});};exports[_0xcab1('0x7b')]=function(_0x96e976,_0x21b202,_0x3bdf42,_0x543ce2,_0x9e0bd0,_0x40d190){var _0x5c9dca=path[_0xcab1('0x2a')](__dirname,_0xcab1('0x4b'),rs[_0xcab1('0x3b')](0x4)+_0xcab1('0x3c'));var _0x4d0536;return aws[_0xcab1('0x7c')](_0x96e976,_0x21b202,_0x3bdf42,_0x543ce2,_0x9e0bd0,_0x40d190,_0x5c9dca)[_0xcab1('0x2c')](function(){_0x4d0536=path[_0xcab1('0x2a')](__dirname,_0xcab1('0x4b'),rs[_0xcab1('0x3b')](0x4)+'.wav');return convertFile(_0x5c9dca,_0x4d0536);})[_0xcab1('0x2c')](function(){try{fs[_0xcab1('0x21')](_0x5c9dca);fs[_0xcab1('0x2d')](_0x4d0536,_0xcab1('0x2e'));}catch(_0x23e44f){logger[_0xcab1('0x19')](_0x23e44f);}return _0x4d0536['split']('.')[0x0];});};exports[_0xcab1('0x7d')]=function(_0xbd2811,_0x49869f,_0x212f31,_0x1dab3b,_0x5cc233,_0x23d886){return aws['lex'](_0xbd2811,_0x49869f,_0x212f31,_0x1dab3b,_0x5cc233,_0x23d886)[_0xcab1('0x2c')](function(_0xb38666){logger[_0xcab1('0x1f')](JSON[_0xcab1('0x45')](_0xb38666));return _0xb38666;});};exports[_0xcab1('0x7e')]=function(_0x50ac2f,_0x57c164,_0x541557,_0x1e9382){var _0x50a755=util[_0xcab1('0x7f')](_0xcab1('0x80'),ISPEECH_API,_0x50ac2f,encodeURIComponent(_0x57c164),_0x541557,_0x1e9382);var _0x5e180b=path[_0xcab1('0x2a')](__dirname,_0xcab1('0x4b'),rs[_0xcab1('0x3b')](0x4)+'.mp3');var _0x181f13;return downloadFile(_0x50a755,_0x5e180b)['then'](function(){_0x181f13=path[_0xcab1('0x2a')](__dirname,_0xcab1('0x4b'),rs[_0xcab1('0x3b')](0x4)+_0xcab1('0x2b'));return convertFile(_0x5e180b,_0x181f13);})['then'](function(){try{fs[_0xcab1('0x21')](_0x5e180b);fs[_0xcab1('0x2d')](_0x181f13,_0xcab1('0x2e'));}catch(_0x32c9f8){logger['error'](_0x32c9f8);}return _0x181f13[_0xcab1('0x2f')]('.')[0x0];});};exports[_0xcab1('0x81')]=function(_0x3533fd,_0x214233,_0x31e9f9,_0x335f60){var _0x458218=util['format'](_0xcab1('0x82'),ISPEECH_API,_0x214233,_0x31e9f9,base64Encode(_0x3533fd),_0x335f60?util['format'](_0xcab1('0x83'),encodeURIComponent(_0x335f60)):_0xcab1('0x84'));return uploadFile(_0x458218)[_0xcab1('0x2c')](function(_0x2788ce){return querystring[_0xcab1('0xd')](_0x2788ce);});};exports[_0xcab1('0x85')]=function(_0x52d359,_0x236874){return sestek['nda'](_0x52d359,_0x236874)[_0xcab1('0x2c')](function(_0xdf8d24){logger[_0xcab1('0x1f')](JSON[_0xcab1('0x45')](_0xdf8d24));var _0x45ceb4={'speech':_0xdf8d24[_0xcab1('0x86')],'action':_0xdf8d24[_0xcab1('0x87')]?_0xdf8d24[_0xcab1('0x87')]['CustomAction']:undefined,'actiondata':_0xdf8d24['channelData']?_0xdf8d24[_0xcab1('0x87')][_0xcab1('0x88')]:undefined};if(_0xdf8d24['channelData']&&_0xdf8d24['channelData']['AudioFromTts']){return base64Decode(_0xdf8d24['channelData'][_0xcab1('0x89')][_0xcab1('0x8a')],path[_0xcab1('0x2a')](__dirname,'tmp',rs['generate'](0x4)+_0xcab1('0x2b')))[_0xcab1('0x2c')](function(_0x42dfb3){_0x45ceb4[_0xcab1('0x8b')]=_0x42dfb3;return _0x45ceb4;});}return _0x45ceb4;});};exports[_0xcab1('0x8c')]=function(){return __dirname;}; \ No newline at end of file +var _0x34d5=['actionIncomplete','fulfillment','speech','metadata','googleDialogflowV2','replace','length','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','ispeechTTS','format','ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','dirName','apiai-promise','dialogflow','http','https','md5','path','querystring','request-promise','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish\x20download\x20file','close','unlink','download\x20error','end','statusMessage','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','.wav','base64','then','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','tmp','.mp3','audioContent','chmodSync','generate','googleCloudTTS\x20path','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','slice','parse\x20response\x20failed:\x0a','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','asr','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','source'];(function(_0x1cd9c0,_0x7ff7d2){var _0x104425=function(_0x5bbe54){while(--_0x5bbe54){_0x1cd9c0['push'](_0x1cd9c0['shift']());}};_0x104425(++_0x7ff7d2);}(_0x34d5,0x12f));var _0x534d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x34d5[_0x57b54c];return _0x59cc19;};'use strict';var apiai=require(_0x534d('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x534d('0x1'));var fs=require('fs');var http=require(_0x534d('0x2'));var https=require(_0x534d('0x3'));var md5=require(_0x534d('0x4'));var path=require(_0x534d('0x5'));var querystring=require(_0x534d('0x6'));var rp=require(_0x534d('0x7'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0x534d('0x8'));var urlParse=require(_0x534d('0x9'))[_0x534d('0xa')];var util=require(_0x534d('0xb'));var aws=require(_0x534d('0xc'));var google=require(_0x534d('0xd'));var sestek=require(_0x534d('0xe'));var tilde=require(_0x534d('0xf'));var logger=require(_0x534d('0x10'))(_0x534d('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x24fcba,_0x72b441){return new BPromise(function(_0x12a1a7,_0x1cd113){var _0x16c6e1=urlParse(_0x24fcba);var _0x1c9290=_0x16c6e1[_0x534d('0x12')]===_0x534d('0x13')?https:http;var _0x4cae12={'host':_0x16c6e1[_0x534d('0x14')],'path':_0x16c6e1[_0x534d('0x5')],'headers':{'user-agent':_0x534d('0x15')}};_0x1c9290[_0x534d('0x16')](_0x4cae12,function(_0x17ca1f){if(_0x17ca1f[_0x534d('0x17')]!==0xc8){logger[_0x534d('0x18')](_0x534d('0x19')+_0x24fcba+_0x534d('0x1a')+_0x17ca1f[_0x534d('0x17')]+'\x20('+_0x17ca1f['statusMessage']+')');_0x1cd113(new Error(_0x534d('0x19')+_0x24fcba+_0x534d('0x1a')+_0x17ca1f[_0x534d('0x17')]+'\x20('+_0x17ca1f['statusMessage']+')'));return;}var _0x2b1fb5=fs[_0x534d('0x1b')](_0x72b441);_0x2b1fb5['on']('finish',function(){logger['info'](_0x534d('0x1c'));_0x2b1fb5[_0x534d('0x1d')](_0x12a1a7);});_0x2b1fb5['on'](_0x534d('0x18'),function(_0x5e1b33){fs[_0x534d('0x1e')](_0x72b441);logger['error'](_0x534d('0x1f'),_0x5e1b33);_0x1cd113(_0x5e1b33);});_0x17ca1f['pipe'](_0x2b1fb5);})['on'](_0x534d('0x18'),function(_0x2bed93){logger[_0x534d('0x18')](_0x2bed93);_0x1cd113(_0x2bed93);})[_0x534d('0x20')]();});}function uploadFile(_0x4dfdd5){return new BPromise(function(_0x2a1e40,_0x15c5e9){var _0x36d395=urlParse(_0x4dfdd5);var _0x3edc98=_0x36d395[_0x534d('0x12')]==='https:'?https:http;var _0x1a64b9={'host':_0x36d395[_0x534d('0x14')],'path':_0x36d395[_0x534d('0x5')],'headers':{'user-agent':_0x534d('0x15')}};_0x3edc98[_0x534d('0x16')](_0x1a64b9,function(_0x518975){if(_0x518975[_0x534d('0x17')]!==0xc8){_0x15c5e9(new Error('request\x20to\x20'+_0x4dfdd5+_0x534d('0x1a')+_0x518975[_0x534d('0x17')]+'\x20('+_0x518975[_0x534d('0x21')]+')'));return;}var _0x385028='';_0x518975['on'](_0x534d('0x22'),function(_0x34de86){_0x385028+=_0x34de86;});_0x518975['on'](_0x534d('0x20'),function(){_0x2a1e40(_0x385028);});})['on']('error',function(_0x2cf255){_0x15c5e9(_0x2cf255);})[_0x534d('0x20')]();});}function convertFile(_0xba8fc9,_0x5cbb4a){return new BPromise(function(_0x3bed69,_0x55465e){var _0x5765ec=sox[_0x534d('0x23')](_0xba8fc9,_0x5cbb4a,{'sampleRate':0x1f40,'format':_0x534d('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5765ec['on'](_0x534d('0x18'),function(_0x578b13){logger[_0x534d('0x18')](_0x534d('0x25'),_0x578b13);_0x55465e(_0x578b13);});_0x5765ec['on']('end',function(){logger[_0x534d('0x26')](_0x534d('0x27'));_0x3bed69();});_0x5765ec[_0x534d('0x28')]();});}function base64Decode(_0x31c726,_0x2014de){var _0x2e78e7=path[_0x534d('0x29')](__dirname,'tmp',rs['generate'](0x4)+_0x534d('0x2a'));fs['writeFileSync'](_0x2e78e7,_0x31c726,_0x534d('0x2b'));return convertFile(_0x2e78e7,_0x2014de)[_0x534d('0x2c')](function(){try{fs[_0x534d('0x1e')](_0x2e78e7);fs['chmodSync'](_0x2014de,_0x534d('0x2d'));}catch(_0x2a2f6b){logger[_0x534d('0x18')](_0x2a2f6b);}return _0x2014de[_0x534d('0x2e')]('.')[0x0];});}function base64Encode(_0x381453){var _0x13b311=fs[_0x534d('0x2f')](_0x381453);return new Buffer(_0x13b311)[_0x534d('0x30')](_0x534d('0x2b'));}exports[_0x534d('0x31')]=function(_0x442ee1,_0x22afd6,_0x12f833,_0x62dbc7,_0x8143eb,_0x2922c7){var _0x5c30e5,_0x472d76;var _0x21d603=_0x534d('0x32');var _0x211c14=_0x534d('0x33')+_0x442ee1;var _0x3da13b={};if(_0x22afd6===_0x534d('0x34')){_0x3da13b[_0x534d('0x35')]={'ssml':_0x12f833};}else{_0x3da13b[_0x534d('0x35')]={'text':_0x12f833};};_0x3da13b[_0x534d('0x36')]={'languageCode':_0x62dbc7,'ssmlGender':_0x8143eb};_0x3da13b[_0x534d('0x37')]={'audioEncoding':_0x534d('0x38'),'sampleRateHertz':0x1f40};var _0x2c673d={'url':_0x21d603+'text:synthesize'+_0x211c14,'method':_0x534d('0x39'),'json':!![],'body':_0x3da13b};return rp(_0x2c673d)[_0x534d('0x2c')](function(_0x5362ac){return new BPromise(function(_0x1ab485,_0x94eafe){_0x5c30e5=path[_0x534d('0x29')](__dirname,_0x534d('0x3a'),rs['generate'](0x4)+_0x534d('0x3b'));var _0x281146=Buffer['from'](_0x5362ac[_0x534d('0x3c')],_0x534d('0x2b'));return fs['writeFile'](_0x5c30e5,_0x281146,function(_0x1cc7fb){_0x94eafe(_0x1cc7fb);},function(_0x5387f9){fs[_0x534d('0x3d')](_0x5c30e5,'777');_0x1ab485(_0x5387f9);});});})[_0x534d('0x2c')](function(_0x56e18a){_0x472d76=path[_0x534d('0x29')](__dirname,_0x534d('0x3a'),rs[_0x534d('0x3e')](0x4)+_0x534d('0x2a'));return convertFile(_0x5c30e5,_0x472d76);})[_0x534d('0x2c')](function(){try{fs[_0x534d('0x1e')](_0x5c30e5);fs[_0x534d('0x3d')](_0x472d76,_0x534d('0x2d'));}catch(_0x51a4b2){logger[_0x534d('0x18')](_0x51a4b2);}logger[_0x534d('0x26')](_0x534d('0x3f'),_0x472d76[_0x534d('0x2e')]('.')[0x0]);return _0x472d76[_0x534d('0x2e')]('.')[0x0];});};exports['googleTTS']=function(_0x33d5c2,_0x242425){var _0x15427d='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x2f5165,_0x30eead;var _0x5035a4;var _0xc7226e={'encoding':_0x534d('0x40'),'method':_0x534d('0x39'),'timeout':0x2710,'url':_0x15427d,'headers':{'Content-Type':_0x534d('0x41')},'body':_0x534d('0x42')+encodeURIComponent(JSON[_0x534d('0x43')]([[['jQ1olc',JSON['stringify']([_0x33d5c2,_0x242425||'en',![],_0x534d('0x44')]),null,'generic']]]))};return rp(_0xc7226e)['then'](function(_0x39ad62){try{_0x5035a4=eval(_0x39ad62[_0x534d('0x45')](0x5))[0x0][0x2];}catch(_0x1af844){throw new Error(_0x534d('0x46')+_0x39ad62[_0x534d('0x22')]);}if(!_0x5035a4){if(_0x33d5c2['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x242425+_0x534d('0x47'));}}try{_0x5035a4=eval(_0x5035a4)[0x0];}catch(_0x4c4f3a){throw new Error(_0x534d('0x46')+res[_0x534d('0x22')]);}const _0x228b58=_0x5035a4;_0x2f5165=path[_0x534d('0x29')](__dirname,_0x534d('0x3a'),rs[_0x534d('0x3e')](0x4)+_0x534d('0x3b'));fs[_0x534d('0x48')](_0x2f5165,_0x5035a4,{'encoding':_0x534d('0x2b')});_0x30eead=path[_0x534d('0x29')](__dirname,'tmp',rs[_0x534d('0x3e')](0x4)+_0x534d('0x2a'));return convertFile(_0x2f5165,_0x30eead);})[_0x534d('0x2c')](function(){try{fs[_0x534d('0x1e')](_0x2f5165);fs['chmodSync'](_0x30eead,_0x534d('0x2d'));}catch(_0x248a23){logger[_0x534d('0x18')](_0x248a23);}logger[_0x534d('0x26')](_0x534d('0x49'),_0x30eead[_0x534d('0x2e')]('.')[0x0]);return _0x30eead[_0x534d('0x2e')]('.')[0x0];});};exports['googleASR']=function(_0x3ac98e,_0x384f8,_0x5996de){return google[_0x534d('0x4a')](_0x3ac98e,_0x384f8,_0x5996de)[_0x534d('0x2c')](function(_0x2eca2c){logger['info'](_0x2eca2c['uri']);return rp(_0x2eca2c);})[_0x534d('0x2c')](function(_0x389c2b){var _0xcd7316='';var _0x41773d=0x0;try{fs[_0x534d('0x1e')](_0x3ac98e);}catch(_0x119790){logger[_0x534d('0x18')](_0x119790);}if(_0x389c2b&&_0x389c2b[_0x534d('0x4b')]){_0xcd7316=_0x389c2b[_0x534d('0x4b')][_0x534d('0x4c')](function(_0x56df06){return _0x56df06&&_0x56df06[_0x534d('0x4d')][0x0]&&_0x56df06[_0x534d('0x4d')][0x0][_0x534d('0x4e')]?_0x56df06[_0x534d('0x4d')][0x0][_0x534d('0x4e')]:'';})['join']('\x0a');_0x41773d=_0x389c2b[_0x534d('0x4b')]['map'](function(_0x5ac9f9){return _0x5ac9f9&&_0x5ac9f9['alternatives'][0x0]&&_0x5ac9f9['alternatives'][0x0][_0x534d('0x4f')]?_0x5ac9f9[_0x534d('0x4d')][0x0][_0x534d('0x4f')]:0x0;})[_0x534d('0x50')]('\x0a');}logger[_0x534d('0x26')](_0x534d('0x51'),_0xcd7316);logger[_0x534d('0x26')](_0x534d('0x52'),_0x41773d);return{'transcript':_0xcd7316,'confidence':_0x41773d};})[_0x534d('0x53')](function(_0x14ab6f){logger['error']('[%s]\x20%s:%s',_0x14ab6f[_0x534d('0x17')],_0x14ab6f[_0x534d('0x54')],_0x14ab6f[_0x534d('0x55')]);});};exports[_0x534d('0x56')]=function(_0x100433,_0xd3ce02,_0x52bc33,_0xb8796a){var _0x37af05=apiai(_0xd3ce02,{'language':_0xb8796a||'en'});return _0x37af05[_0x534d('0x57')](_0x52bc33,{'sessionId':md5(_0x100433)})[_0x534d('0x2c')](function(_0x5218c1){logger['info'](JSON[_0x534d('0x43')](_0x5218c1));return{'source':_0x5218c1[_0x534d('0x58')][_0x534d('0x59')],'resolvedQuery':_0x5218c1[_0x534d('0x58')]['resolvedQuery'],'action':_0x5218c1['result']['action'],'actionIncomplete':_0x5218c1[_0x534d('0x58')][_0x534d('0x5a')],'speech':_0x5218c1[_0x534d('0x58')][_0x534d('0x5b')][_0x534d('0x5c')],'score':_0x5218c1[_0x534d('0x58')]['score'],'statusCode':_0x5218c1['status']['code'],'endConversation':_0x5218c1[_0x534d('0x58')][_0x534d('0x5d')]['endConversation']||![],'isFallbackIntent':_0x5218c1[_0x534d('0x58')][_0x534d('0x5d')]['isFallbackIntent']};});};exports[_0x534d('0x5e')]=function(_0x5d56b2,_0xfe2022,_0x5bf41a,_0x5c6833,_0x12e1a8,_0x148cad){var _0x240cae=_0x5c6833[_0x534d('0x5f')](/\\n/g,'\x0a');var _0x4fb1c8={'credentials':{'private_key':_0x240cae,'client_email':_0x5bf41a}};var _0x5bb39d=new dialogflow['SessionsClient'](_0x4fb1c8);var _0x273b92=_0x5bb39d['sessionPath'](_0xfe2022,md5(_0x5d56b2));var _0xa1448f={'session':_0x273b92,'queryInput':{'text':{'text':_0x12e1a8,'languageCode':_0x148cad}}};return _0x5bb39d['detectIntent'](_0xa1448f)[_0x534d('0x2c')](function(_0x25b277){if(_0x25b277&&_0x25b277[_0x534d('0x60')]){logger[_0x534d('0x26')](_0x534d('0x61'),JSON[_0x534d('0x43')](_0x25b277));var _0x1989ad=_0x25b277[0x0];if(_0x1989ad){var _0x463b2c={'action':_0x1989ad[_0x534d('0x62')][_0x534d('0x63')],'allRequiredParamsPresent':_0x1989ad['queryResult'][_0x534d('0x64')],'endConversation':_0x1989ad['queryResult']['diagnosticInfo']&&_0x1989ad[_0x534d('0x62')]['diagnosticInfo']['fields']?_0x1989ad[_0x534d('0x62')][_0x534d('0x65')][_0x534d('0x66')][_0x534d('0x67')][_0x534d('0x68')]:![],'fulfillmentText':_0x1989ad['queryResult'][_0x534d('0x69')],'intentName':_0x1989ad['queryResult'][_0x534d('0x6a')]['name'],'intentDisplayName':_0x1989ad[_0x534d('0x62')][_0x534d('0x6a')][_0x534d('0x6b')],'isFallbackIntent':_0x1989ad[_0x534d('0x62')][_0x534d('0x6a')][_0x534d('0x6c')],'languageCode':_0x1989ad[_0x534d('0x62')][_0x534d('0x6d')],'queryText':_0x1989ad[_0x534d('0x62')][_0x534d('0x6e')],'responseId':_0x1989ad[_0x534d('0x6f')],'score':_0x1989ad[_0x534d('0x62')][_0x534d('0x70')],'speech':_0x1989ad[_0x534d('0x62')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0x25b277)};return _0x463b2c;}}});};exports[_0x534d('0x71')]=function(_0x7ae371,_0x437b4c,_0x3efd16,_0x36e9e0){return tilde[_0x534d('0x4a')](_0x7ae371,_0x437b4c,_0x3efd16,_0x36e9e0)['then'](function(_0x5affcb){try{fs['unlink'](_0x7ae371);}catch(_0x3a6e0f){logger[_0x534d('0x18')](_0x3a6e0f);}logger['info'](_0x534d('0x72'),_0x5affcb['transcript']);logger[_0x534d('0x26')](_0x534d('0x73'),_0x5affcb[_0x534d('0x4f')]);return _0x5affcb;});};exports[_0x534d('0x74')]=function(_0x5e2cfe,_0x2a55c8,_0x5b8ad4,_0x533827,_0x208462,_0x270972){var _0x41c739=path[_0x534d('0x29')](__dirname,'tmp',rs[_0x534d('0x3e')](0x4)+'.mp3');var _0x3895c7;return aws['polly'](_0x5e2cfe,_0x2a55c8,_0x5b8ad4,_0x533827,_0x208462,_0x270972,_0x41c739)[_0x534d('0x2c')](function(){_0x3895c7=path['resolve'](__dirname,_0x534d('0x3a'),rs[_0x534d('0x3e')](0x4)+_0x534d('0x2a'));return convertFile(_0x41c739,_0x3895c7);})[_0x534d('0x2c')](function(){try{fs[_0x534d('0x1e')](_0x41c739);fs[_0x534d('0x3d')](_0x3895c7,'777');}catch(_0x239f19){logger[_0x534d('0x18')](_0x239f19);}return _0x3895c7['split']('.')[0x0];});};exports[_0x534d('0x75')]=function(_0x171437,_0x14f7e9,_0x139c8c,_0x226579,_0x4fce8e,_0x2e70c4){return aws['lex'](_0x171437,_0x14f7e9,_0x139c8c,_0x226579,_0x4fce8e,_0x2e70c4)['then'](function(_0x2856ae){logger[_0x534d('0x26')](JSON[_0x534d('0x43')](_0x2856ae));return _0x2856ae;});};exports[_0x534d('0x76')]=function(_0x400248,_0x1e5b74,_0x5b7a3d,_0x27dc50){var _0x552037=util[_0x534d('0x77')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x400248,encodeURIComponent(_0x1e5b74),_0x5b7a3d,_0x27dc50);var _0x35353f=path[_0x534d('0x29')](__dirname,_0x534d('0x3a'),rs['generate'](0x4)+'.mp3');var _0x313eb8;return downloadFile(_0x552037,_0x35353f)[_0x534d('0x2c')](function(){_0x313eb8=path[_0x534d('0x29')](__dirname,'tmp',rs[_0x534d('0x3e')](0x4)+_0x534d('0x2a'));return convertFile(_0x35353f,_0x313eb8);})[_0x534d('0x2c')](function(){try{fs[_0x534d('0x1e')](_0x35353f);fs['chmodSync'](_0x313eb8,_0x534d('0x2d'));}catch(_0x287412){logger[_0x534d('0x18')](_0x287412);}return _0x313eb8[_0x534d('0x2e')]('.')[0x0];});};exports[_0x534d('0x78')]=function(_0x140ab2,_0x4dd1b6,_0x52727b,_0x287f03){var _0x1355ba=util[_0x534d('0x77')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x4dd1b6,_0x52727b,base64Encode(_0x140ab2),_0x287f03?util[_0x534d('0x77')](_0x534d('0x79'),encodeURIComponent(_0x287f03)):_0x534d('0x7a'));return uploadFile(_0x1355ba)[_0x534d('0x2c')](function(_0x49e0ad){return querystring[_0x534d('0xa')](_0x49e0ad);});};exports[_0x534d('0x7b')]=function(_0x11fb06,_0x3d1280){return sestek[_0x534d('0x7c')](_0x11fb06,_0x3d1280)[_0x534d('0x2c')](function(_0x238b2d){logger[_0x534d('0x26')](JSON[_0x534d('0x43')](_0x238b2d));var _0x518727={'speech':_0x238b2d[_0x534d('0x7d')],'action':_0x238b2d['channelData']?_0x238b2d[_0x534d('0x7e')][_0x534d('0x7f')]:undefined,'actiondata':_0x238b2d[_0x534d('0x7e')]?_0x238b2d[_0x534d('0x7e')]['CustomActionData']:undefined};if(_0x238b2d['channelData']&&_0x238b2d[_0x534d('0x7e')]['AudioFromTts']){return base64Decode(_0x238b2d[_0x534d('0x7e')][_0x534d('0x80')][_0x534d('0x81')],path[_0x534d('0x29')](__dirname,_0x534d('0x3a'),rs[_0x534d('0x3e')](0x4)+_0x534d('0x2a')))[_0x534d('0x2c')](function(_0x5220aa){_0x518727['audiofile']=_0x5220aa;return _0x518727;});}return _0x518727;});};exports[_0x534d('0x82')]=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 36628c0..3fecd2a 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 _0xbe45=['exports','./nda'];(function(_0x2ea934,_0x4d6e84){var _0x5e372f=function(_0x2d83e2){while(--_0x2d83e2){_0x2ea934['push'](_0x2ea934['shift']());}};_0x5e372f(++_0x4d6e84);}(_0xbe45,0x119));var _0x5be4=function(_0x1bf150,_0x45eb66){_0x1bf150=_0x1bf150-0x0;var _0x2198c2=_0xbe45[_0x1bf150];return _0x2198c2;};var nda=require(_0x5be4('0x0'));module[_0x5be4('0x1')]={'nda':nda}; \ No newline at end of file +var _0x8390=['./nda'];(function(_0x5cd247,_0x2774a4){var _0x482446=function(_0x412993){while(--_0x412993){_0x5cd247['push'](_0x5cd247['shift']());}};_0x482446(++_0x2774a4);}(_0x8390,0x1a4));var _0x0839=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0x8390[_0x3181cc];return _0x547a4a;};var nda=require(_0x0839('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 05d5b74..5514cae 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 _0xa477=['agi','exports','POST','resolve','/token','password','username','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','custom_action_data','CustomActionData','info','request-promise','url'];(function(_0x10a4bd,_0x1fb723){var _0x3210f1=function(_0x316452){while(--_0x316452){_0x10a4bd['push'](_0x10a4bd['shift']());}};_0x3210f1(++_0x1fb723);}(_0xa477,0xe6));var _0x7a47=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa477[_0x21a9d9];return _0x46adce;};'use strict';var rp=require(_0x7a47('0x0'));var url=require(_0x7a47('0x1'));var logger=require('../../../../../config/logger')(_0x7a47('0x2'));module[_0x7a47('0x3')]=function(_0x25949c,_0x19697b){var _0x3ba650={'method':_0x7a47('0x4'),'uri':url[_0x7a47('0x5')](_0x19697b['ndauth_url'],_0x7a47('0x6')),'form':{'grant_type':_0x7a47('0x7'),'username':_0x19697b[_0x7a47('0x8')],'password':_0x19697b['password']},'json':!![]};return rp(_0x3ba650)['then'](function(_0x47f594){var _0x4276ed={'method':'POST','uri':url[_0x7a47('0x5')](_0x19697b[_0x7a47('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x19697b[_0x7a47('0xa')]||_0x7a47('0xb'),'channelId':_0x7a47('0xc'),'conversation':{'id':_0x25949c[_0x7a47('0xd')]},'from':{'id':_0x25949c[_0x7a47('0xe')],'name':_0x25949c['calleridname']},'recipient':{'id':_0x25949c[_0x7a47('0xf')],'name':_0x25949c[_0x7a47('0x10')]},'text':_0x19697b[_0x7a47('0x11')],'channelData':{}},'headers':{'Authorization':_0x7a47('0x12')+_0x47f594['access_token']},'json':!![]};if(_0x19697b[_0x7a47('0x13')]){_0x4276ed[_0x7a47('0x14')][_0x7a47('0x15')][_0x7a47('0x16')]=_0x19697b[_0x7a47('0x13')];}if(_0x19697b[_0x7a47('0x17')]=='1'){_0x4276ed[_0x7a47('0x14')][_0x7a47('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7a47('0x18')};}if(_0x19697b[_0x7a47('0x19')]){_0x4276ed[_0x7a47('0x14')][_0x7a47('0x15')]['CustomAction']=_0x19697b[_0x7a47('0x19')];if(_0x19697b[_0x7a47('0x1a')]){_0x4276ed['body']['channelData'][_0x7a47('0x1b')]=_0x19697b[_0x7a47('0x1a')];}}logger[_0x7a47('0x1c')](JSON['stringify'](_0x4276ed));return rp(_0x4276ed);});}; \ No newline at end of file +var _0x1978=['ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','access_token','project','ProjectName','ndagenerate_audio','body','channelData','audio/wav','CustomAction','custom_action_data','CustomActionData','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x10476a,_0x29f0aa){var _0x16a94f=function(_0x176c67){while(--_0x176c67){_0x10476a['push'](_0x10476a['shift']());}};_0x16a94f(++_0x29f0aa);}(_0x1978,0x174));var _0x8197=function(_0x28466b,_0x39cac1){_0x28466b=_0x28466b-0x0;var _0x2ed985=_0x1978[_0x28466b];return _0x2ed985;};'use strict';var rp=require('request-promise');var url=require(_0x8197('0x0'));var logger=require(_0x8197('0x1'))(_0x8197('0x2'));module[_0x8197('0x3')]=function(_0x203bf1,_0x2828d2){var _0x38fffe={'method':_0x8197('0x4'),'uri':url[_0x8197('0x5')](_0x2828d2[_0x8197('0x6')],'/token'),'form':{'grant_type':_0x8197('0x7'),'username':_0x2828d2[_0x8197('0x8')],'password':_0x2828d2[_0x8197('0x7')]},'json':!![]};return rp(_0x38fffe)[_0x8197('0x9')](function(_0x3e8799){var _0x1bc265={'method':_0x8197('0x4'),'uri':url[_0x8197('0x5')](_0x2828d2[_0x8197('0xa')],_0x8197('0xb')),'body':{'type':_0x2828d2[_0x8197('0xc')]||_0x8197('0xd'),'channelId':_0x8197('0xe'),'conversation':{'id':_0x203bf1[_0x8197('0xf')]},'from':{'id':_0x203bf1[_0x8197('0x10')],'name':_0x203bf1['calleridname']},'recipient':{'id':_0x203bf1[_0x8197('0x11')],'name':_0x203bf1[_0x8197('0x12')]},'text':_0x2828d2[_0x8197('0x13')],'channelData':{}},'headers':{'Authorization':_0x8197('0x14')+_0x3e8799[_0x8197('0x15')]},'json':!![]};if(_0x2828d2[_0x8197('0x16')]){_0x1bc265['body']['channelData'][_0x8197('0x17')]=_0x2828d2[_0x8197('0x16')];}if(_0x2828d2[_0x8197('0x18')]=='1'){_0x1bc265[_0x8197('0x19')][_0x8197('0x1a')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8197('0x1b')};}if(_0x2828d2['custom_action']){_0x1bc265[_0x8197('0x19')]['channelData'][_0x8197('0x1c')]=_0x2828d2['custom_action'];if(_0x2828d2[_0x8197('0x1d')]){_0x1bc265[_0x8197('0x19')]['channelData'][_0x8197('0x1e')]=_0x2828d2['custom_action_data'];}}logger['info'](JSON[_0x8197('0x1f')](_0x1bc265));return rp(_0x1bc265);});}; \ 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 5fc56ee..8c6287b 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88e4=['exports','./lib/api'];(function(_0x5e71ab,_0x22fff2){var _0x3ef2b9=function(_0xf3bc50){while(--_0xf3bc50){_0x5e71ab['push'](_0x5e71ab['shift']());}};_0x3ef2b9(++_0x22fff2);}(_0x88e4,0x99));var _0x488e=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x88e4[_0x5eaa0b];return _0x28b295;};'use strict';var asr=require(_0x488e('0x0'));module[_0x488e('0x1')]=function(_0x5600b8,_0x3f6e0f,_0x347658,_0x2fa472){return asr(_0x5600b8,_0x3f6e0f,_0x347658,_0x2fa472);}; \ No newline at end of file +var _0x054c=['exports'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x054c,0xb9));var _0xc054=function(_0x350526,_0x419a7e){_0x350526=_0x350526-0x0;var _0x2c80ff=_0x054c[_0x350526];return _0x2c80ff;};'use strict';var asr=require('./lib/api');module[_0xc054('0x0')]=function(_0x4e92d2,_0x1be79a,_0x22db09,_0xef3a1){return asr(_0x4e92d2,_0x1be79a,_0x22db09,_0xef3a1);}; \ 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 4e548f8..852b3da 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 _0x976f=['Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','moment','crypto','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','transcript','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.'];(function(_0x42c4ee,_0x31ae25){var _0x1aa597=function(_0x76de7){while(--_0x76de7){_0x42c4ee['push'](_0x42c4ee['shift']());}};_0x1aa597(++_0x31ae25);}(_0x976f,0x1f2));var _0xf976=function(_0x7a19d9,_0x2f4122){_0x7a19d9=_0x7a19d9-0x0;var _0x29bf47=_0x976f[_0x7a19d9];return _0x29bf47;};'use strict';var BPromise=require(_0xf976('0x0'));var _=require(_0xf976('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf976('0x2'));var crypto=require(_0xf976('0x3'));var logger=require('../../../../../../config/logger')(_0xf976('0x4'));module[_0xf976('0x5')]=function(_0x20240a,_0x3c7d75,_0x4d06a8,_0x5706b7){return new BPromise(function(_0x2c944c,_0x1601f7){logger[_0xf976('0x6')]('Tilde\x20URI',_0x5706b7||_0xf976('0x7'));var _0x55f4ca=new WebSocket(_0x5706b7||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x19a1c2='';var _0x24065c='0';var _0x47c06d='1';var _0x3965df=_0xf976('0x8');function _0x538d43(_0x3b88ca){var _0x5e2014=crypto[_0xf976('0x9')]('sha1');_0x5e2014[_0xf976('0xa')](_0x3b88ca);return _0x5e2014[_0xf976('0xb')](_0xf976('0xc'));}function _0x8e4a22(){try{logger[_0xf976('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x29f30a=moment()[_0xf976('0xd')]();var _0x386720=_0x538d43(_0x29f30a+_0x3c7d75+_0x4d06a8);_0x55f4ca[_0xf976('0xe')](JSON[_0xf976('0xf')]({'appID':_0x3c7d75,'timestamp':_0x29f30a,'appKey':_0x386720}));var _0xbfa51f=fs[_0xf976('0x10')](_0x20240a);_0xbfa51f['on'](_0xf976('0x11'),function(_0x4af12e){_0x55f4ca[_0xf976('0xe')](_0x4af12e);});_0xbfa51f['on'](_0xf976('0x12'),function(){_0x55f4ca['send'](_0xf976('0x13'));});}catch(_0x3db780){logger[_0xf976('0x14')](_0xf976('0x15'),JSON[_0xf976('0xf')](_0x3db780));_0x55f4ca[_0xf976('0x16')]();}}function _0x86d02(_0x4e2350){try{if(_0x4e2350){var _0x328ae8=JSON['parse'](_0x4e2350);switch(_0x328ae8[_0xf976('0x17')]){case 0x0:if(_0x328ae8[_0xf976('0x18')]){if(_0x328ae8[_0xf976('0x18')][_0xf976('0x19')]){logger[_0xf976('0x6')](_0xf976('0x1a'),JSON[_0xf976('0xf')](_0x328ae8['result']['hypotheses']));_0x19a1c2=_0x328ae8['result']['hypotheses'][0x0][_0xf976('0x1b')];_0x24065c=_0x328ae8[_0xf976('0x18')][_0xf976('0x1c')][0x0][_0xf976('0x1d')];_0x47c06d='0';_0x3965df=_0xf976('0x1e');_0x55f4ca[_0xf976('0x16')]();}}break;case 0x1:logger[_0xf976('0x6')](_0xf976('0x8'));_0x47c06d='1';_0x3965df=_0xf976('0x8');break;case 0x2:logger[_0xf976('0x6')](_0xf976('0x1f'));_0x47c06d='2';_0x3965df=_0xf976('0x1f');break;case 0x9:logger['info'](_0xf976('0x20'));_0x47c06d='9';_0x3965df=_0xf976('0x20');break;case 0xa:logger[_0xf976('0x6')](_0xf976('0x21'));_0x47c06d='10';_0x3965df=_0xf976('0x21');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x47c06d='11';_0x3965df=_0xf976('0x22');}}}catch(_0x472b33){logger['error'](_0xf976('0x23'),JSON[_0xf976('0xf')](_0x472b33));_0x55f4ca[_0xf976('0x16')]();}}function _0x58a13d(){logger[_0xf976('0x6')](_0xf976('0x24'));_0x2c944c({'transcript':_0x19a1c2,'confidence':_0x24065c,'status':_0x47c06d,'status_message':_0x3965df});}function _0x258724(_0x18007e){logger['error'](_0xf976('0x25'));if(!_['isNil'](_0x18007e)){logger[_0xf976('0x14')](_[_0xf976('0x26')](_0x18007e)?JSON[_0xf976('0xf')](_0x18007e):_0x18007e);}}_0x55f4ca['on'](_0xf976('0x27'),_0x8e4a22);_0x55f4ca['on'](_0xf976('0x28'),_0x86d02);_0x55f4ca['on'](_0xf976('0x12'),_0x58a13d);_0x55f4ca['on'](_0xf976('0x14'),_0x258724);});}; \ No newline at end of file +var _0x3bdb=['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','info','unix','stringify','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','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','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','lodash','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI'];(function(_0x254f4c,_0x2f1547){var _0x105015=function(_0xdf6aa8){while(--_0xdf6aa8){_0x254f4c['push'](_0x254f4c['shift']());}};_0x105015(++_0x2f1547);}(_0x3bdb,0x1b2));var _0xb3bd=function(_0x53c7d9,_0x2067ae){_0x53c7d9=_0x53c7d9-0x0;var _0x212904=_0x3bdb[_0x53c7d9];return _0x212904;};'use strict';var BPromise=require('bluebird');var _=require(_0xb3bd('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xb3bd('0x1'));var logger=require(_0xb3bd('0x2'))(_0xb3bd('0x3'));module[_0xb3bd('0x4')]=function(_0x56a375,_0x5d344e,_0x47c292,_0x571f7f){return new BPromise(function(_0x231d05,_0x5749c0){logger['info'](_0xb3bd('0x5'),_0x571f7f||_0xb3bd('0x6'));var _0x4c2cc1=new WebSocket(_0x571f7f||_0xb3bd('0x6'),{'perMessageDeflate':![]});var _0x3278e4='';var _0x354170='0';var _0x58af08='1';var _0x2c70c8=_0xb3bd('0x7');function _0x13e485(_0x5c3aa2){var _0x7caa9b=crypto[_0xb3bd('0x8')](_0xb3bd('0x9'));_0x7caa9b['update'](_0x5c3aa2);return _0x7caa9b[_0xb3bd('0xa')]('hex');}function _0x9414e(){try{logger[_0xb3bd('0xb')]('Open\x20Tilde\x20ASR\x20socket');var _0x543afb=moment()[_0xb3bd('0xc')]();var _0x15fa0e=_0x13e485(_0x543afb+_0x5d344e+_0x47c292);_0x4c2cc1['send'](JSON[_0xb3bd('0xd')]({'appID':_0x5d344e,'timestamp':_0x543afb,'appKey':_0x15fa0e}));var _0x1aae3c=fs[_0xb3bd('0xe')](_0x56a375);_0x1aae3c['on'](_0xb3bd('0xf'),function(_0x53e477){_0x4c2cc1[_0xb3bd('0x10')](_0x53e477);});_0x1aae3c['on'](_0xb3bd('0x11'),function(){_0x4c2cc1['send'](_0xb3bd('0x12'));});}catch(_0x1fcd3c){logger[_0xb3bd('0x13')](_0xb3bd('0x14'),JSON[_0xb3bd('0xd')](_0x1fcd3c));_0x4c2cc1[_0xb3bd('0x15')]();}}function _0x54af88(_0x105c8d){try{if(_0x105c8d){var _0x12f0c5=JSON[_0xb3bd('0x16')](_0x105c8d);switch(_0x12f0c5[_0xb3bd('0x17')]){case 0x0:if(_0x12f0c5[_0xb3bd('0x18')]){if(_0x12f0c5[_0xb3bd('0x18')][_0xb3bd('0x19')]){logger[_0xb3bd('0xb')](_0xb3bd('0x1a'),JSON[_0xb3bd('0xd')](_0x12f0c5[_0xb3bd('0x18')][_0xb3bd('0x1b')]));_0x3278e4=_0x12f0c5['result'][_0xb3bd('0x1b')][0x0][_0xb3bd('0x1c')];_0x354170=_0x12f0c5['result']['hypotheses'][0x0][_0xb3bd('0x1d')];_0x58af08='0';_0x2c70c8=_0xb3bd('0x1e');_0x4c2cc1[_0xb3bd('0x15')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x58af08='1';_0x2c70c8=_0xb3bd('0x7');break;case 0x2:logger[_0xb3bd('0xb')](_0xb3bd('0x1f'));_0x58af08='2';_0x2c70c8='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xb3bd('0xb')](_0xb3bd('0x20'));_0x58af08='9';_0x2c70c8='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0xb3bd('0x21'));_0x58af08='10';_0x2c70c8=_0xb3bd('0x21');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x58af08='11';_0x2c70c8=_0xb3bd('0x22');}}}catch(_0x2be138){logger[_0xb3bd('0x13')](_0xb3bd('0x23'),JSON[_0xb3bd('0xd')](_0x2be138));_0x4c2cc1[_0xb3bd('0x15')]();}}function _0x3f69a2(){logger[_0xb3bd('0xb')]('Close\x20Tilde\x20ASR\x20socket');_0x231d05({'transcript':_0x3278e4,'confidence':_0x354170,'status':_0x58af08,'status_message':_0x2c70c8});}function _0x50f3ba(_0x2f3759){logger[_0xb3bd('0x13')](_0xb3bd('0x24'));if(!_[_0xb3bd('0x25')](_0x2f3759)){logger[_0xb3bd('0x13')](_['isObject'](_0x2f3759)?JSON[_0xb3bd('0xd')](_0x2f3759):_0x2f3759);}}_0x4c2cc1['on'](_0xb3bd('0x26'),_0x9414e);_0x4c2cc1['on'](_0xb3bd('0x27'),_0x54af88);_0x4c2cc1['on']('close',_0x3f69a2);_0x4c2cc1['on'](_0xb3bd('0x13'),_0x50f3ba);});}; \ 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 8cbd46f..be3e568 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 _0xd7a8=['./asr'];(function(_0x515f78,_0x3b69be){var _0x506f6c=function(_0x14da41){while(--_0x14da41){_0x515f78['push'](_0x515f78['shift']());}};_0x506f6c(++_0x3b69be);}(_0xd7a8,0xa8));var _0x8d7a=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xd7a8[_0x1ae5ab];return _0x1ce001;};var asr=require(_0x8d7a('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x4e16=['exports','./asr'];(function(_0x339a4b,_0x4a2092){var _0x3cbae1=function(_0x31a136){while(--_0x31a136){_0x339a4b['push'](_0x339a4b['shift']());}};_0x3cbae1(++_0x4a2092);}(_0x4e16,0x1e1));var _0x64e1=function(_0x2bbb52,_0x41f248){_0x2bbb52=_0x2bbb52-0x0;var _0x2276df=_0x4e16[_0x2bbb52];return _0x2276df;};var asr=require(_0x64e1('0x0'));module[_0x64e1('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 7477026..1b4a957 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 _0xcbe3=['E_AGI_SERVER_CLOSE','nextTick','inherits','exports','EventEmitter','./channel','call','error','E_AGI_ARGUMENT_PORT','createServer','listen','emit','listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','code','close'];(function(_0x572846,_0x59109f){var _0x1f92c2=function(_0x81d0cf){while(--_0x81d0cf){_0x572846['push'](_0x572846['shift']());}};_0x1f92c2(++_0x59109f);}(_0xcbe3,0x72));var _0x3cbe=function(_0x14dd16,_0x3f7b0f){_0x14dd16=_0x14dd16-0x0;var _0x288cbf=_0xcbe3[_0x14dd16];return _0x288cbf;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require('events')[_0x3cbe('0x0')];var AGIError=require('./error');var AGIChannel=require(_0x3cbe('0x1'));var AGIServer=function(_0x4ee7fa,_0x34872f,_0x53ec31){var _0x44ed24=this,_0x4ee7fa=_0x4ee7fa||0x11dd,_0x34872f=_0x34872f||'127.0.0.1',_0x35f6cb=null,_0x5a4f92=0x0;EventEmitter[_0x3cbe('0x2')](_0x44ed24);function _0x1132c6(){if(!_0x4ee7fa){_0x44ed24['emit'](_0x3cbe('0x3'),new AGIError(_0x3cbe('0x4')));return![];}_0x35f6cb=net[_0x3cbe('0x5')]();_0x35f6cb[_0x3cbe('0x6')](_0x4ee7fa,_0x34872f);_0x35f6cb['on']('listening',function(){_0x44ed24[_0x3cbe('0x7')](_0x3cbe('0x8'));});_0x35f6cb['on']('connection',function(_0x2cf1de){_0x35f6cb[_0x3cbe('0x9')](function(_0x2ff892,_0x1a20a1){if(_0x2ff892){_0x44ed24[_0x3cbe('0x7')](_0x3cbe('0x3'),new AGIError(_0x3cbe('0xa'),_0x2ff892));}else if(_0x53ec31&&_0x53ec31<0x0){_0x44ed24[_0x3cbe('0x7')]('error',new AGIError(_0x3cbe('0xb')));_0x2cf1de[_0x3cbe('0xc')]();}else if(_0x53ec31&&_0x53ec31>0x0&&_0x53ec31<_0x1a20a1){_0x5a4f92+=0x1;_0x44ed24[_0x3cbe('0x7')]('error',new AGIError(_0x3cbe('0xd'),_0x5a4f92));_0x2cf1de[_0x3cbe('0xc')]();}else{var _0x571e24=new AGIChannel(_0x2cf1de);_0x571e24['on'](_0x3cbe('0xe'),function(){_0x44ed24[_0x3cbe('0x7')](_0x3cbe('0xf'),_0x571e24);});}});});_0x35f6cb['on'](_0x3cbe('0x3'),function(_0x4d91d7){_0x44ed24[_0x3cbe('0x7')](_0x3cbe('0x3'),new AGIError(_0x3cbe('0xa'),_0x4d91d7[_0x3cbe('0x10')]));});_0x35f6cb['on'](_0x3cbe('0x11'),function(){_0x44ed24['emit'](_0x3cbe('0x11'),new AGIError(_0x3cbe('0x12')));});}process[_0x3cbe('0x13')](function(){_0x1132c6();});};util[_0x3cbe('0x14')](AGIServer,EventEmitter);module[_0x3cbe('0x15')]=function(_0x1709ae,_0x4093b9,_0x3dc4d1){return new AGIServer(_0x1709ae,_0x4093b9,_0x3dc4d1);}; \ No newline at end of file +var _0xbc60=['./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','EventEmitter'];(function(_0x58792b,_0x3ae983){var _0x8836dd=function(_0x3a123b){while(--_0x3a123b){_0x58792b['push'](_0x58792b['shift']());}};_0x8836dd(++_0x3ae983);}(_0xbc60,0x129));var _0x0bc6=function(_0x516578,_0x535e59){_0x516578=_0x516578-0x0;var _0x7e548d=_0xbc60[_0x516578];return _0x7e548d;};'use strict';var util=require(_0x0bc6('0x0'));var net=require(_0x0bc6('0x1'));var EventEmitter=require('events')[_0x0bc6('0x2')];var AGIError=require(_0x0bc6('0x3'));var AGIChannel=require(_0x0bc6('0x4'));var AGIServer=function(_0x5bec06,_0x6d6826,_0x4d9e43){var _0x24398f=this,_0x5bec06=_0x5bec06||0x11dd,_0x6d6826=_0x6d6826||_0x0bc6('0x5'),_0x33d439=null,_0x41782f=0x0;EventEmitter[_0x0bc6('0x6')](_0x24398f);function _0x45e926(){if(!_0x5bec06){_0x24398f[_0x0bc6('0x7')](_0x0bc6('0x8'),new AGIError(_0x0bc6('0x9')));return![];}_0x33d439=net[_0x0bc6('0xa')]();_0x33d439['listen'](_0x5bec06,_0x6d6826);_0x33d439['on'](_0x0bc6('0xb'),function(){_0x24398f[_0x0bc6('0x7')](_0x0bc6('0xb'));});_0x33d439['on'](_0x0bc6('0xc'),function(_0x213c42){_0x33d439[_0x0bc6('0xd')](function(_0x12c449,_0x4ba05d){if(_0x12c449){_0x24398f[_0x0bc6('0x7')]('error',new AGIError(_0x0bc6('0xe'),_0x12c449));}else if(_0x4d9e43&&_0x4d9e43<0x0){_0x24398f[_0x0bc6('0x7')]('error',new AGIError(_0x0bc6('0xf')));_0x213c42['destroy']();}else if(_0x4d9e43&&_0x4d9e43>0x0&&_0x4d9e43<_0x4ba05d){_0x41782f+=0x1;_0x24398f[_0x0bc6('0x7')]('error',new AGIError(_0x0bc6('0x10'),_0x41782f));_0x213c42[_0x0bc6('0x11')]();}else{var _0x1e4b4a=new AGIChannel(_0x213c42);_0x1e4b4a['on'](_0x0bc6('0x12'),function(){_0x24398f['emit']('connection',_0x1e4b4a);});}});});_0x33d439['on'](_0x0bc6('0x8'),function(_0x45ab34){_0x24398f[_0x0bc6('0x7')](_0x0bc6('0x8'),new AGIError(_0x0bc6('0xe'),_0x45ab34[_0x0bc6('0x13')]));});_0x33d439['on'](_0x0bc6('0x14'),function(){_0x24398f[_0x0bc6('0x7')](_0x0bc6('0x14'),new AGIError(_0x0bc6('0x15')));});}process[_0x0bc6('0x16')](function(){_0x45e926();});};util[_0x0bc6('0x17')](AGIServer,EventEmitter);module[_0x0bc6('0x18')]=function(_0x4d7365,_0x5ae334,_0x3063e1){return new AGIServer(_0x4d7365,_0x5ae334,_0x3063e1);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b438303..e07ddba 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 _0xf603=['Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','phone','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','getSound','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','NOBEEP','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','intKey','unlink','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','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','no\x20variable\x20found','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','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','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','service','host','port','secure','authentication','auth','pass','debug','account_id','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','success','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','odbc','randomstring','moment','mustache','request-promise','agi','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','getVariable','getVariableById','then','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','name','getSquareOdbcById','dsn','getUser','getTrunk','getSoundPath','save_name','getMailAccount','getMailAccountById','mailRpc','getIntervals','IntervalId','Intervals','format','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','agicommand','arg_1','createSquareRecording','uniqueid','calleridname','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','agentPause','agent','callerid','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','googleCloudTTS','apiKey','google_cloud_tts_text_type','en-US','ssmlGender','audioEncoding','MP3','googleTTS','text','google_tts_language','restAPI','url','method','timeout','number','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','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','googleDialogflowV2','dialogflowV2_project_id','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','isConfigured','maxRetry','sync','retry','noop','no\x20text\x20configured','MRCPSynth','result','mrcprecog','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','label','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','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','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','replace','query:\x20%s','variable_id','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','DIAL','dialogflow'];(function(_0x4fdd90,_0x4d8479){var _0x45efb7=function(_0x225f36){while(--_0x225f36){_0x4fdd90['push'](_0x4fdd90['shift']());}};_0x45efb7(++_0x4d8479);}(_0xf603,0xeb));var _0x3f60=function(_0x35b64d,_0x5b133b){_0x35b64d=_0x35b64d-0x0;var _0xe3422d=_0xf603[_0x35b64d];return _0xe3422d;};'use strict';var fs=require('fs');var path=require(_0x3f60('0x0'));var util=require(_0x3f60('0x1'));var _=require(_0x3f60('0x2'));var sh=require('shelljs');var odbc=require(_0x3f60('0x3'))();var rs=require(_0x3f60('0x4'));var moment=require(_0x3f60('0x5'));var Mustache=require(_0x3f60('0x6'));var rp=require(_0x3f60('0x7'));var logger=require('../../config/logger')(_0x3f60('0x8'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0x3f60('0x9');var recursiveMapAttributes=[_0x3f60('0xa'),_0x3f60('0xb')];var verticesWithRetry=[_0x3f60('0xc'),_0x3f60('0xd'),_0x3f60('0xe')];var AGIVertices=function(_0x59b737,_0x326a7f,_0x33dcc8){this[_0x3f60('0xf')]=_0x59b737;this[_0x3f60('0x10')]=_0x326a7f;this['mailRpc']=_0x33dcc8;};AGIVertices['prototype'][_0x3f60('0x11')]=function(_0x234201,_0x3cfe74){this['rpc'][_0x3f60('0x12')](_0x234201)[_0x3f60('0x13')](function(_0xad12ff){_0x3cfe74(null,_0xad12ff?_0xad12ff['name']:![]);})[_0x3f60('0x14')](function(_0x1e52e3){_0x3cfe74(_0x1e52e3);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x16')]=function(_0x385250,_0x1c0dea){this[_0x3f60('0x10')][_0x3f60('0x17')](_0x385250)['then'](function(_0x4a46f1){_0x1c0dea(null,_0x4a46f1?_0x4a46f1['name']:![]);})[_0x3f60('0x14')](function(_0xa06f96){_0x1c0dea(_0xa06f96);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x18')]=function(_0x1de18b,_0x224982){this[_0x3f60('0x10')][_0x3f60('0x19')](_0x1de18b)[_0x3f60('0x13')](function(_0x4ddecc){_0x224982(null,_0x4ddecc?_0x4ddecc[_0x3f60('0x1a')]:![]);})[_0x3f60('0x14')](function(_0x1ed144){_0x224982(_0x1ed144);});};AGIVertices[_0x3f60('0x15')]['getSquareOdbc']=function(_0x48b0cf,_0x218159){this[_0x3f60('0x10')][_0x3f60('0x1b')](_0x48b0cf)[_0x3f60('0x13')](function(_0x4af884){_0x218159(null,_0x4af884?_0x4af884[_0x3f60('0x1c')]:![]);})[_0x3f60('0x14')](function(_0x587ba2){_0x218159(_0x587ba2);});};AGIVertices['prototype'][_0x3f60('0x1d')]=function(_0x8d2dc9,_0x13c089){this[_0x3f60('0x10')]['getUserById'](_0x8d2dc9)[_0x3f60('0x13')](function(_0x1bc95d){_0x13c089(null,_0x1bc95d?_0x1bc95d[_0x3f60('0x1a')]:![]);})[_0x3f60('0x14')](function(_0x1d2660){_0x13c089(_0x1d2660);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x1e')]=function(_0x42beb9,_0x435637){this[_0x3f60('0x10')]['getTrunkById'](_0x42beb9)[_0x3f60('0x13')](function(_0x37aafb){_0x435637(null,_0x37aafb?_0x37aafb[_0x3f60('0x1a')]:![]);})[_0x3f60('0x14')](function(_0x42dc63){_0x435637(_0x42dc63);});};AGIVertices[_0x3f60('0x15')]['getSound']=function(_0x20ec12,_0x3eecfc){var _0x44ea75=this;this['rpc']['getSoundById'](_0x20ec12)['then'](function(_0x4d50f4){_0x3eecfc(null,_0x4d50f4?_0x44ea75[_0x3f60('0x1f')](_0x4d50f4[_0x3f60('0x20')]):![]);})[_0x3f60('0x14')](function(_0x40deab){_0x3eecfc(_0x40deab);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x21')]=function(_0x52d88b,_0x46271a){this['rpc'][_0x3f60('0x22')](_0x52d88b)[_0x3f60('0x13')](function(_0x345e25){_0x46271a(null,_0x345e25?_0x345e25:![]);})[_0x3f60('0x14')](function(_0x4ef81e){_0x46271a(_0x4ef81e);});};AGIVertices[_0x3f60('0x15')]['sendMailMessage']=function(_0x3b9a4c,_0xc5840,_0x189a5d){this[_0x3f60('0x23')]['sendMailMessage'](_0x3b9a4c,_0xc5840)['then'](function(){_0x189a5d(null);})[_0x3f60('0x14')](function(_0x367455){_0x189a5d(_0x367455);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x24')]=function(_0x264622,_0x2accf9){this[_0x3f60('0x10')]['getIntervalById'](_0x264622)[_0x3f60('0x13')](function(_0x5b3bae){if(_0x5b3bae){if(_0x5b3bae[_0x3f60('0x25')]){_0x2accf9(null,[_0x5b3bae['interval']]);}else{_0x2accf9(null,_['map'](_0x5b3bae[_0x3f60('0x26')],'interval'));}}else{_0x2accf9(null,![]);}})[_0x3f60('0x14')](function(_0x655f97){_0x2accf9(_0x655f97);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x1f')]=function(_0x3a6e39){return util[_0x3f60('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x3a6e39);};AGIVertices[_0x3f60('0x15')][_0x3f60('0x28')]=function(_0xd29468,_0x5dd42e,_0x2484fa){odbc['open'](_0xd29468,function(_0x1a5cad){if(_0x1a5cad){logger[_0x3f60('0x29')](_0x3f60('0x2a'),_0x1a5cad);_0x2484fa(_0x1a5cad);}else{logger[_0x3f60('0x2b')](_0x3f60('0x2c'));odbc[_0x3f60('0x2d')](_0x5dd42e,function(_0x50701f,_0x51d602){if(_0x50701f){logger['info'](_0x3f60('0x2e'),_0x5dd42e);_0x2484fa(_0x50701f);}else{logger[_0x3f60('0x2b')](_0x3f60('0x2f'),_0x5dd42e);odbc[_0x3f60('0x30')](function(_0x22e308){if(_0x22e308){logger[_0x3f60('0x29')](_0x3f60('0x31'),_0x22e308);}_0x2484fa(null,_0x51d602);});}});}});};AGIVertices['prototype'][_0x3f60('0x32')]=function(_0x5a392d,_0x26bb68){this['rpc']['getSmsAccountById'](_0x5a392d)[_0x3f60('0x13')](function(_0x328a08){_0x26bb68(null,_0x328a08?_0x328a08:![]);})[_0x3f60('0x14')](function(_0x592660){_0x26bb68(_0x592660);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x33')]=function(_0x10bc5d,_0x319cf6){this[_0x3f60('0x10')]['createSmsMessage'](_0x10bc5d)[_0x3f60('0x13')](function(_0x3555b2){_0x319cf6(null,_0x3555b2);})[_0x3f60('0x14')](function(_0x57662f){_0x319cf6(_0x57662f);});};AGIVertices['prototype'][_0x3f60('0x34')]=function(_0x57a21f,_0x4e64da,_0x28338d){this[_0x3f60('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0x3f60('0xf')]['uniqueid'],'node':_0x57a21f['label'],'application':_0x57a21f[_0x3f60('0x35')],'data':_0x4e64da||null,'project_name':this[_0x3f60('0xf')][_0x3f60('0x36')],'callerid':this[_0x3f60('0xf')]['callerid']})['then'](function(_0x37f0d2){if(_0x28338d){_0x28338d(null,_0x37f0d2);}})[_0x3f60('0x14')](function(_0x50c448){if(_0x28338d){_0x28338d(_0x50c448);}});};AGIVertices['prototype'][_0x3f60('0x37')]=function(_0x45803d,_0x3cfb7b,_0x5a9ab8,_0x504334){this['rpc']['createSquareRecording']({'uniqueid':this[_0x3f60('0xf')][_0x3f60('0x38')],'callerid':this[_0x3f60('0xf')]['callerid'],'calleridname':this[_0x3f60('0xf')][_0x3f60('0x39')],'context':this[_0x3f60('0xf')]['context'],'extension':this[_0x3f60('0xf')]['extension'],'priority':this[_0x3f60('0xf')][_0x3f60('0x3a')],'accountcode':this[_0x3f60('0xf')][_0x3f60('0x3b')],'dnid':this[_0x3f60('0xf')][_0x3f60('0x3c')],'projectName':this[_0x3f60('0xf')][_0x3f60('0x36')],'saveName':_0x3cfb7b,'filename':_0x45803d[_0x3f60('0x3d')]||_0x3cfb7b,'savePath':_0x5a9ab8})['then'](function(_0x2f62ca){_0x504334(null,_0x2f62ca);})['catch'](function(_0x7a0bf8){_0x504334(_0x7a0bf8);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x3e')]=function(_0x81da,_0xf0ccb2,_0x11607f,_0x552b46,_0x36a3e6){this['rpc'][_0x3f60('0x3e')]({'uniqueid':this[_0x3f60('0xf')]['uniqueid'],'body':_0x81da,'direction':_0xf0ccb2,'providerName':_0x11607f,'providerResponse':_0x552b46})[_0x3f60('0x13')](function(_0x4ba46e){if(_0x36a3e6){_0x36a3e6(null,_0x4ba46e);}})['catch'](function(_0x280de0){if(_0x36a3e6){_0x36a3e6(_0x280de0);}});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x3f')]=function(_0x529000,_0x26c5a7){this[_0x3f60('0x10')][_0x3f60('0x3f')]({'firstName':_[_0x3f60('0x40')](_0x529000[_0x3f60('0x1a')])||_[_0x3f60('0x41')](_0x529000[_0x3f60('0x1a')])?_0x3f60('0x42')+Math['random']():_0x529000[_0x3f60('0x1a')],'lastName':_[_0x3f60('0x40')](_0x529000[_0x3f60('0x43')])||_['isNil'](_0x529000[_0x3f60('0x43')])?null:_0x529000['lastName'],'phone':_0x529000['phone'],'ListId':_0x529000['list_id'],'scheduledat':_0x529000[_0x3f60('0x44')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x3f60('0x45'),'description':_0x3f60('0x46')+_0x529000['scheduledAt'][_0x3f60('0x47')](),'priority':_0x529000[_0x3f60('0x48')]})[_0x3f60('0x13')](function(_0x4a01f7){_0x26c5a7(null,_0x4a01f7);})[_0x3f60('0x14')](function(_0xeb9d66){_0x26c5a7(_0xeb9d66);});};AGIVertices[_0x3f60('0x15')]['getPause']=function(_0x30ad65,_0x2198ba){this['rpc']['getPauseById'](_0x30ad65)[_0x3f60('0x13')](function(_0x22af2d){_0x2198ba(null,_0x22af2d?_0x22af2d[_0x3f60('0x1a')]:![]);})[_0x3f60('0x14')](function(_0xa3d141){_0x2198ba(_0xa3d141);});};AGIVertices['prototype'][_0x3f60('0x49')]=function(_0x1198e8,_0x5a9233,_0x3189cd){var _0x38bb87={'role':_0x3f60('0x4a')};_0x38bb87[_0x1198e8]=this[_0x3f60('0xf')][_0x3f60('0x4b')];this[_0x3f60('0x10')][_0x3f60('0x49')](_0x38bb87,_0x5a9233,this[_0x3f60('0xf')]['uniqueid'])['then'](function(_0x1e95b1){_0x3189cd(null,_[_0x3f60('0x41')](_0x1e95b1)?![]:!![]);})[_0x3f60('0x14')](function(_0x3f2f3f){logger[_0x3f60('0x29')](_0x3f2f3f);_0x3189cd(null,![]);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x4c')]=function(_0x199378,_0x4af82c){var _0x661848={'role':_0x3f60('0x4a')};_0x661848[_0x199378]=this[_0x3f60('0xf')]['callerid'];this[_0x3f60('0x10')][_0x3f60('0x4c')](_0x661848)[_0x3f60('0x13')](function(_0x530e97){_0x4af82c(null,_[_0x3f60('0x41')](_0x530e97)?![]:!![]);})['catch'](function(_0x10f998){logger[_0x3f60('0x29')](_0x10f998);_0x4af82c(null,![]);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x4d')]=function(_0xd870df,_0x2bfb51){var _0x5014cb={'role':_0x3f60('0x4a')};_0x5014cb[_0xd870df]=this[_0x3f60('0xf')][_0x3f60('0x4b')];this['rpc'][_0x3f60('0x4d')](_0x5014cb)[_0x3f60('0x13')](function(_0x5f4873){_0x2bfb51(null,_[_0x3f60('0x41')](_0x5f4873)?![]:!![]);})[_0x3f60('0x14')](function(_0x5bef55){logger['error'](_0x5bef55);_0x2bfb51(null,![]);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x4e')]=function(_0x21b0d5,_0x54b36d){var _0x27b869={'role':_0x3f60('0x4a')};_0x27b869[_0x21b0d5]=this[_0x3f60('0xf')][_0x3f60('0x4b')];var _0x48af9f=_0x21b0d5!=_0x3f60('0x4f')?util[_0x3f60('0x27')](_0x3f60('0x50'),_0x3f60('0x51'),this[_0x3f60('0xf')]['callerid']):undefined;this['rpc'][_0x3f60('0x4e')](_0x27b869,_0x48af9f)[_0x3f60('0x13')](function(_0x4f8262){_0x54b36d(null,_['isNil'](_0x4f8262)?![]:!![]);})[_0x3f60('0x14')](function(_0x1653f7){logger['error'](_0x1653f7);_0x54b36d(null,![]);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x52')]=function(_0x513eb8,_0x3af16e){sh[_0x3f60('0x53')](_['trim'](_0x513eb8),function(_0x50a899,_0x5e9962){var _0x4f35d0=_0x5e9962['replace'](/(\r\n|\n|\r)/gm,'');_0x3af16e(null,_0x4f35d0);});};AGIVertices['prototype'][_0x3f60('0x54')]=function(_0x43f61f,_0x66adcb){scripts[_0x3f60('0x54')](_0x43f61f[_0x3f60('0x55')],_0x43f61f[_0x3f60('0x56')]||'text',_0x43f61f['text'],_0x43f61f['languageCode']||_0x3f60('0x57'),_0x43f61f[_0x3f60('0x58')]||'MALE',_0x43f61f[_0x3f60('0x59')]||_0x3f60('0x5a'))[_0x3f60('0x13')](function(_0x24e6cc){_0x66adcb(null,_0x24e6cc);})[_0x3f60('0x14')](function(_0x2d435d){_0x66adcb(_0x2d435d);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x5b')]=function(_0x536fb8,_0x3e49fd){scripts[_0x3f60('0x5b')](_0x536fb8[_0x3f60('0x5c')],_0x536fb8[_0x3f60('0x5d')]||'en',0x1)[_0x3f60('0x13')](function(_0x2f941f){_0x3e49fd(null,_0x2f941f);})['catch'](function(_0x248ab5){_0x3e49fd(_0x248ab5);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x5e')]=function(_0x219b80,_0x3b6402){var _0x55cc64={'uri':_0x219b80[_0x3f60('0x5f')],'method':_0x219b80[_0x3f60('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x219b80[_0x3f60('0x61')])===_0x3f60('0x62')&&parseInt(_0x219b80['timeout'])>=0x1?parseInt(_0x219b80[_0x3f60('0x61')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0x3f60('0x63')],_0x55cc64[_0x3f60('0x60')][_0x3f60('0x64')]())){try{_0x55cc64[_0x3f60('0x65')]=_0x219b80[_0x3f60('0xb')]?JSON[_0x3f60('0x66')](_0x219b80[_0x3f60('0xb')]):{};}catch(_0x39758f){logger['error'](_0x3f60('0x67'),_0x39758f);}}try{_0x55cc64[_0x3f60('0x68')]=_0x219b80[_0x3f60('0xa')]?JSON[_0x3f60('0x66')](_0x219b80[_0x3f60('0xa')]):{};}catch(_0x5d1dcd){logger['error'](_0x3f60('0x69'),_0x5d1dcd);}if(_0x219b80[_0x3f60('0x6a')]){try{var _0x9f2a0e=require(_0x219b80[_0x3f60('0x6a')])['sync'](this,_0x55cc64);_0x55cc64[_0x3f60('0x6b')]=Mustache[_0x3f60('0x6c')](_0x219b80[_0x3f60('0x5f')],_0x9f2a0e,{},['$$','$$']);if(_0x55cc64['headers']){_0x55cc64['headers']=JSON[_0x3f60('0x66')](Mustache['render'](JSON['stringify'](_0x55cc64[_0x3f60('0x68')]),_0x9f2a0e,{},['$$','$$']));}if(_0x55cc64[_0x3f60('0x65')]){_0x55cc64[_0x3f60('0x65')]=JSON['parse'](Mustache['render'](JSON[_0x3f60('0x6d')](_0x55cc64[_0x3f60('0x65')]),_0x9f2a0e,{},['$$','$$']));}}catch(_0x2cc71e){logger['error'](_0x3f60('0x6e'),_0x2cc71e);}}rp(_0x55cc64)[_0x3f60('0x13')](function(_0x2937c4){var _0x6ebbe6={'statusCode':_0x2937c4[_0x3f60('0x6f')]||0xc8,'statusMessage':_0x2937c4[_0x3f60('0x70')]||'OK','headers':_0x2937c4[_0x3f60('0x68')]||{},'body':_0x2937c4['body']||{}};_0x3b6402(null,_0x6ebbe6);})[_0x3f60('0x14')](function(_0x56d1d1){var _0x53b436={'statusCode':_0x56d1d1[_0x3f60('0x6f')]||0x1f4,'statusMessage':_0x56d1d1[_0x3f60('0x71')]||_0x3f60('0x72'),'headers':_0x56d1d1[_0x3f60('0x73')][_0x3f60('0x68')]||{},'body':_0x56d1d1[_0x3f60('0x73')][_0x3f60('0x65')]||{}};_0x3b6402(null,_0x53b436);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x74')]=function(_0xce5724,_0x30b43b){scripts['googleDialogflow'](this[_0x3f60('0xf')][_0x3f60('0x38')],_0xce5724['key'],_0xce5724['text'],_0xce5724[_0x3f60('0x75')]||'en')[_0x3f60('0x13')](function(_0x5c0aba){_0x30b43b(null,_0x5c0aba);})[_0x3f60('0x14')](function(_0x5dfa90){_0x30b43b(_0x5dfa90);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x76')]=function(_0x25cc2a,_0x1404d7){scripts['googleDialogflowV2'](this[_0x3f60('0xf')][_0x3f60('0x38')],_0x25cc2a[_0x3f60('0x77')],_0x25cc2a['client_email'],_0x25cc2a['private_key'],_0x25cc2a['text'],_0x25cc2a['dialogflowV2_language']||'en')[_0x3f60('0x13')](function(_0x2fe216){_0x1404d7(null,_0x2fe216);})[_0x3f60('0x14')](function(_0x3ba4cb){_0x1404d7(_0x3ba4cb);});};AGIVertices['prototype'][_0x3f60('0x78')]=function(_0x4da690,_0x43f480){scripts[_0x3f60('0x78')](this['channel'],_0x4da690)[_0x3f60('0x13')](function(_0x27c8e0){_0x43f480(null,_0x27c8e0);})[_0x3f60('0x14')](function(_0x24c81a){_0x43f480(_0x24c81a);});};AGIVertices[_0x3f60('0x15')]['ispeechTTS']=function(_0x5730e8,_0x502582){scripts[_0x3f60('0x79')](_0x5730e8[_0x3f60('0x7a')],_0x5730e8[_0x3f60('0x5c')],_0x5730e8[_0x3f60('0x7b')]||_0x3f60('0x57'),_0x5730e8[_0x3f60('0x7c')])['then'](function(_0x588016){_0x502582(null,_0x588016);})[_0x3f60('0x14')](function(_0x4e2a23){_0x502582(_0x4e2a23);});};AGIVertices[_0x3f60('0x15')]['ispeechASR']=function(_0x1ed9d8,_0x20195a,_0x780ba){scripts[_0x3f60('0x7d')](_0x20195a,_0x1ed9d8[_0x3f60('0x7a')],_0x1ed9d8[_0x3f60('0x7e')]||_0x3f60('0x57'),this['isConfigured'](_0x1ed9d8[_0x3f60('0x7f')])?_0x1ed9d8['model']:undefined)[_0x3f60('0x13')](function(_0x4bbdf5){_0x780ba(null,_0x4bbdf5);})[_0x3f60('0x14')](function(_0x327210){_0x780ba(_0x327210);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x80')]=function(_0x8758fb,_0x49461b){scripts[_0x3f60('0x80')](_0x8758fb[_0x3f60('0x81')],_0x8758fb['aws_secret_access_key'],_0x8758fb[_0x3f60('0x82')],_0x8758fb[_0x3f60('0x83')]||_0x3f60('0x84'),_0x8758fb[_0x3f60('0x5c')],_0x8758fb[_0x3f60('0x85')]||'text')[_0x3f60('0x13')](function(_0x50a7d4){_0x49461b(null,_0x50a7d4);})[_0x3f60('0x14')](function(_0x5710df){_0x49461b(_0x5710df);});};AGIVertices[_0x3f60('0x15')]['awsLex']=function(_0x2886b1,_0xabbada){scripts[_0x3f60('0x86')](this[_0x3f60('0xf')][_0x3f60('0x38')],_0x2886b1['aws_access_key_id'],_0x2886b1[_0x3f60('0x87')],_0x2886b1['aws_lex_region'],_0x2886b1[_0x3f60('0x5c')],_0x2886b1[_0x3f60('0x88')])[_0x3f60('0x13')](function(_0x3a7f1e){_0xabbada(null,_0x3a7f1e);})[_0x3f60('0x14')](function(_0x3aee0b){_0xabbada(_0x3aee0b);});};AGIVertices['prototype'][_0x3f60('0x89')]=function(_0x1bcd87,_0x5e6b30,_0x173174){scripts[_0x3f60('0x89')](_0x5e6b30,_0x1bcd87[_0x3f60('0x7a')],_0x1bcd87[_0x3f60('0x8a')]||'en-US')[_0x3f60('0x13')](function(_0x44964c){_0x173174(null,_0x44964c);})[_0x3f60('0x14')](function(_0x2cdab5){_0x173174(_0x2cdab5);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x8b')]=function(_0x1f1f67,_0x376c55,_0x2176a8){scripts[_0x3f60('0x8b')](_0x376c55,_0x1f1f67['appid'],_0x1f1f67[_0x3f60('0x8c')],_0x1f1f67['uri'])[_0x3f60('0x13')](function(_0x229e73){_0x2176a8(null,_0x229e73);})[_0x3f60('0x14')](function(_0x5288a4){_0x2176a8(_0x5288a4);});};AGIVertices[_0x3f60('0x15')][_0x3f60('0x8d')]=function(_0x527002){var _0x2f666d=_[_0x3f60('0x8e')](verticesWithRetry,_0x527002[_0x3f60('0x35')])?_0x527002:_[_0x3f60('0x8f')](_0x527002);for(var _0x2b9dac in _0x2f666d){if(_0x2f666d[_0x3f60('0x90')](_0x2b9dac)){if(_0x2f666d[_0x2b9dac]&&_[_0x3f60('0x91')](_0x2f666d[_0x2b9dac])){if(_[_0x3f60('0x8e')](recursiveMapAttributes,_0x2b9dac)){_0x2f666d[_0x2b9dac]=this[_0x3f60('0x92')](_0x2f666d[_0x2b9dac]);}else{_0x2f666d[_0x2b9dac]=this[_0x3f60('0x93')](_0x2f666d[_0x2b9dac]);}}}}return _0x2f666d;};AGIVertices['prototype'][_0x3f60('0x94')]=function(_0xc3582c){for(var _0xffe32a in _0xc3582c){if(_0xc3582c[_0x3f60('0x90')](_0xffe32a)){if(_[_0x3f60('0x95')](_0xc3582c[_0xffe32a])){this[_0x3f60('0x94')](_0xc3582c[_0xffe32a]);}else if(_[_0x3f60('0x96')](_0xc3582c[_0xffe32a])){for(var _0x310750=0x0;_0x310750<_0xc3582c[_0xffe32a][_0x3f60('0x97')];_0x310750++){this[_0x3f60('0x94')](_0xc3582c[_0xffe32a][_0x310750]);}}else if(_[_0x3f60('0x91')](_0xc3582c[_0xffe32a])){_0xc3582c[_0xffe32a]=this[_0x3f60('0x93')](_0xc3582c[_0xffe32a]);}}}};AGIVertices[_0x3f60('0x15')][_0x3f60('0x98')]=function(_0x3af162,_0x5daf12){for(var _0x2de0f6 in _0x3af162){if(_0x3af162[_0x3f60('0x90')](_0x2de0f6)){if(_[_0x3f60('0x95')](_0x3af162[_0x2de0f6])){if(!_[_0x3f60('0x40')](_0x3af162[_0x2de0f6])){this['saveRestApiResult'](_0x3af162[_0x2de0f6],util[_0x3f60('0x27')](_0x3f60('0x99'),_0x5daf12,_0x2de0f6));}}else if(_[_0x3f60('0x96')](_0x3af162[_0x2de0f6])){for(var _0x561a1a=0x0;_0x561a1a<_0x3af162[_0x2de0f6][_0x3f60('0x97')];_0x561a1a++){this['saveRestApiResult'](_0x3af162[_0x2de0f6][_0x561a1a],util[_0x3f60('0x27')](_0x3f60('0x99'),_0x5daf12,_0x2de0f6+'['+_0x561a1a+']'));}}else{if(!_[_0x3f60('0x41')](_0x3af162[_0x2de0f6])){this[_0x3f60('0xf')]['setVariable'](util[_0x3f60('0x27')]('%s.%s',_0x5daf12,_0x2de0f6),_0x3af162[_0x2de0f6]);}}}}};AGIVertices[_0x3f60('0x15')][_0x3f60('0x92')]=function(_0x23dab2){try{var _0x248e64=JSON['parse'](_0x23dab2);this[_0x3f60('0x94')](_0x248e64);return JSON[_0x3f60('0x6d')](_0x248e64);}catch(_0x3f6981){return this[_0x3f60('0x93')](_0x23dab2);}};AGIVertices[_0x3f60('0x15')]['replaceAllVariables']=function(_0x3c716e){var _0x16da10=_0x3c716e[_0x3f60('0x9a')]('{');for(var _0x55d50a=0x1;_0x55d50a<_0x16da10[_0x3f60('0x97')];_0x55d50a+=0x1){var _0x5a3992=_0x16da10[_0x55d50a][_0x3f60('0x9a')]('}');if(_0x5a3992[_0x3f60('0x97')]>0x1){_0x3c716e=_0x3c716e[_0x3f60('0x9b')]('{'+_0x5a3992[0x0]+'}',this[_0x3f60('0xf')]['getVariable'](_0x5a3992[0x0])[_0x3f60('0x9c')]||_0x5a3992[0x0]);}}if(_0x16da10[_0x3f60('0x97')]===0x1){return _0x3c716e[_0x3f60('0x47')]();}return this[_0x3f60('0x93')](_0x3c716e);};AGIVertices['prototype'][_0x3f60('0x9d')]=function(_0x459954,_0x4d8dd0){var _0x329088=this[_0x3f60('0xf')][_0x3f60('0x11')](_0x459954);if(_0x329088['result']===-0x1){return _0x329088;}logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x9e'),_0x4d8dd0,_0x329088[_0x3f60('0x9c')]));return this['channel'][_0x3f60('0x9f')](_0x4d8dd0,_0x329088[_0x3f60('0x9c')]);};AGIVertices['prototype'][_0x3f60('0xa0')]=function(_0x254aa4){return _0x254aa4&&_0x254aa4!=='0'&&_0x254aa4!=='-1'&&_0x254aa4!=='';};AGIVertices[_0x3f60('0x15')][_0x3f60('0xa1')]=function(_0x3f1808){this['createSquareDetailsReport'][_0x3f60('0xa2')](this,_0x3f1808,'-');_0x3f1808[_0x3f60('0xa3')]=_0x3f1808[_0x3f60('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3f60('0x15')]['mrcpsynth']=function(_0x3563e2){logger['info'](util[_0x3f60('0x27')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x3563e2['label']));if(!this['isConfigured'](_0x3563e2[_0x3f60('0x5c')])){return this['channel'][_0x3f60('0xa4')](_0x3f60('0xa5'));}var _0x511046='\x22'+_0x3563e2[_0x3f60('0x5c')]+'\x22';if(this[_0x3f60('0xa0')](_0x3563e2[_0x3f60('0x73')])){_0x511046+=','+_0x3563e2[_0x3f60('0x73')];}var _0x2543bf=this[_0x3f60('0xf')][_0x3f60('0x53')](_0x3f60('0xa6'),_0x511046);if(_0x2543bf[_0x3f60('0xa7')]===-0x1){return _0x2543bf;}return this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x511046));};AGIVertices[_0x3f60('0x15')][_0x3f60('0xa8')]=function(_0x804dee){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x804dee['label']));if(!this[_0x3f60('0xa0')](_0x804dee['grammar'])){return this[_0x3f60('0xf')][_0x3f60('0xa4')]('no\x20grammar\x20configured');}var _0x33e405=_0x804dee['grammar'];if(this[_0x3f60('0xa0')](_0x804dee[_0x3f60('0x73')])){_0x33e405+=','+_0x804dee[_0x3f60('0x73')];}var _0x41f793=this[_0x3f60('0xf')][_0x3f60('0x53')](_0x3f60('0xa9'),_0x33e405);if(_0x41f793[_0x3f60('0xa7')]===-0x1){return _0x41f793;}var _0x422d98=this[_0x3f60('0x9d')](_0x3f60('0xaa'),'MRCP_RECOG_CONFIDENCE');if(_0x422d98[_0x3f60('0xa7')]===-0x1){return _0x422d98;}var _0xd9843=this['getAndSetVariable'](_0x3f60('0xab'),_0x3f60('0xac'));if(_0xd9843['result']===-0x1){return _0xd9843;}var _0x6556eb=this['getAndSetVariable'](_0x3f60('0xad'),_0x3f60('0xae'));if(_0x6556eb[_0x3f60('0xa7')]===-0x1){return _0x6556eb;}return this[_0x3f60('0xf')]['noop'](util[_0x3f60('0x27')](_0x3f60('0xaf'),_0x33e405));};AGIVertices[_0x3f60('0x15')][_0x3f60('0x8')]=function(_0x3ce8eb){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0xb0'),_0x3ce8eb[_0x3f60('0xb1')]));return this[_0x3f60('0xf')][_0x3f60('0x8')]([_0x3ce8eb[_0x3f60('0xb2')],_0x3ce8eb['args']]);};AGIVertices[_0x3f60('0x15')][_0x3f60('0xb3')]=function(_0x17dd8e){logger['info'](util[_0x3f60('0x27')](_0x3f60('0xb4'),_0x17dd8e['label']));if(this['isConfigured'](_0x17dd8e[_0x3f60('0x61')])){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0xb5'),_0x17dd8e['timeout']));var _0x5a1405=this[_0x3f60('0xf')][_0x3f60('0xb6')](_0x17dd8e[_0x3f60('0x61')]);if(_0x5a1405['result']===-0x1){return _0x5a1405;}}return this['channel']['answer']();};AGIVertices[_0x3f60('0x15')][_0x3f60('0x45')]=function(_0x410e38){logger['info'](util[_0x3f60('0x27')](_0x3f60('0xb7'),_0x410e38[_0x3f60('0xb1')]));if(!this[_0x3f60('0xa0')](_0x410e38[_0x3f60('0xb8')])){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x410e38,_0x3f60('0xb9'));}_0x410e38[_0x3f60('0x44')]=moment();if(this[_0x3f60('0xa0')](_0x410e38[_0x3f60('0xba')])){_0x410e38['scheduledAt']=moment()[_0x3f60('0xbb')](_0x410e38[_0x3f60('0xba')],_0x3f60('0xbc'));}if(!this[_0x3f60('0xa0')](_0x410e38[_0x3f60('0x48')])){_0x410e38[_0x3f60('0x48')]=0x2;}this[_0x3f60('0x3f')][_0x3f60('0xa2')](this,_0x410e38);return this[_0x3f60('0xf')]['noop'](util[_0x3f60('0x27')](_0x3f60('0xbd'),_0x410e38['phone'],_0x410e38[_0x3f60('0xb8')],_0x410e38[_0x3f60('0x44')]));};AGIVertices[_0x3f60('0x15')][_0x3f60('0xbe')]=function(_0x1f0273){logger[_0x3f60('0x2b')](util['format'](_0x3f60('0xbf'),_0x1f0273['label']));var _0xc20a99=this[_0x3f60('0xf')][_0x3f60('0x53')](_0x1f0273[_0x3f60('0xc0')],_0x1f0273[_0x3f60('0x73')]);if(_0xc20a99[_0x3f60('0xa7')]===-0x1){return _0xc20a99;}return this[_0x3f60('0xf')]['noop'](util[_0x3f60('0x27')](_0x3f60('0xc1'),_0x1f0273[_0x3f60('0xc0')],_0x1f0273['options']));};AGIVertices[_0x3f60('0x15')][_0x3f60('0xc2')]=function(_0x2f966c){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2f966c[_0x3f60('0xb1')]));if(!this[_0x3f60('0xa0')](_0x2f966c[_0x3f60('0x5c')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0xa5'));}var _0x44adaf='\x22'+_0x2f966c['text']+'\x22';if(this[_0x3f60('0xa0')](_0x2f966c['options'])){_0x44adaf+=','+_0x2f966c['options'];}var _0xd73799=this[_0x3f60('0xf')][_0x3f60('0x53')](_0x3f60('0xa6'),_0x44adaf);if(_0xd73799[_0x3f60('0xa7')]===-0x1){return _0xd73799;}return this[_0x3f60('0xf')]['noop'](util[_0x3f60('0x27')](_0x3f60('0xc3'),_0x44adaf));};AGIVertices[_0x3f60('0x15')]['sestektts']=function(_0x327f93){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0xc4'),_0x327f93[_0x3f60('0xb1')]));if(!this[_0x3f60('0xa0')](_0x327f93[_0x3f60('0x5c')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0xa5'));}var _0x31dfbd='\x22'+_0x327f93[_0x3f60('0x5c')]+'\x22';if(this[_0x3f60('0xa0')](_0x327f93['options'])){_0x31dfbd+=','+_0x327f93[_0x3f60('0x73')];}var _0x5f36f0=this[_0x3f60('0xf')]['exec'](_0x3f60('0xa6'),_0x31dfbd);if(_0x5f36f0['result']===-0x1){return _0x5f36f0;}return this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x31dfbd));};AGIVertices[_0x3f60('0x15')][_0x3f60('0xc5')]=function(_0x400f45){logger[_0x3f60('0x2b')](util['format'](_0x3f60('0xc6'),_0x400f45[_0x3f60('0xb1')]));if(!this[_0x3f60('0xa0')](_0x400f45[_0x3f60('0xc7')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')]('no\x20grammar\x20configured');}var _0xe35448=_0x400f45[_0x3f60('0xc7')];if(this[_0x3f60('0xa0')](_0x400f45[_0x3f60('0x73')])){_0xe35448+=','+_0x400f45[_0x3f60('0x73')];}var _0x2dcfbd=this[_0x3f60('0xf')][_0x3f60('0x53')](_0x3f60('0xa9'),_0xe35448);if(_0x2dcfbd[_0x3f60('0xa7')]===-0x1){return _0x2dcfbd;}var _0x5a19c9=this['getAndSetVariable']('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x5a19c9['result']===-0x1){return _0x5a19c9;}var _0x544ba8=this['getAndSetVariable']('RECOG_INPUT()',_0x3f60('0xc8'));if(_0x544ba8[_0x3f60('0xa7')]===-0x1){return _0x544ba8;}var _0x419256=this[_0x3f60('0x9d')](_0x3f60('0xad'),_0x3f60('0xc9'));if(_0x419256[_0x3f60('0xa7')]===-0x1){return _0x419256;}return this[_0x3f60('0xf')][_0x3f60('0xa4')](util['format'](_0x3f60('0xaf'),_0xe35448));};AGIVertices[_0x3f60('0x15')][_0x3f60('0xca')]=function(_0x2c7b8a){logger['info'](util[_0x3f60('0x27')](_0x3f60('0xcb'),_0x2c7b8a['label']));if(!this['isConfigured'](_0x2c7b8a[_0x3f60('0xc7')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0xcc'));}var _0x3ac98b=_0x2c7b8a['grammar'];if(this[_0x3f60('0xa0')](_0x2c7b8a['options'])){_0x3ac98b+=','+_0x2c7b8a[_0x3f60('0x73')];}var _0x1aef96=this[_0x3f60('0xf')][_0x3f60('0x53')]('MRCPRecog',_0x3ac98b);if(_0x1aef96[_0x3f60('0xa7')]===-0x1){return _0x1aef96;}var _0x5e0cf0=this[_0x3f60('0x9d')](_0x3f60('0xaa'),_0x3f60('0xcd'));if(_0x5e0cf0['result']===-0x1){return _0x5e0cf0;}var _0x37dedf=this[_0x3f60('0x9d')](_0x3f60('0xab'),_0x3f60('0xce'));if(_0x37dedf[_0x3f60('0xa7')]===-0x1){return _0x37dedf;}var _0x40b262=this[_0x3f60('0x9d')](_0x3f60('0xad'),_0x3f60('0xcf'));if(_0x40b262[_0x3f60('0xa7')]===-0x1){return _0x40b262;}return this[_0x3f60('0xf')]['noop'](util[_0x3f60('0x27')](_0x3f60('0xaf'),_0x3ac98b));};AGIVertices[_0x3f60('0x15')][_0x3f60('0xd0')]=function(_0x25d6da){logger['info'](util[_0x3f60('0x27')](_0x3f60('0xd1'),_0x25d6da['label']));if(!this['isConfigured'](_0x25d6da[_0x3f60('0xd2')])){return this[_0x3f60('0xf')]['error'](_0x25d6da,_0x3f60('0xd3'));}var _0x544c57=this[_0x3f60('0xd4')][_0x3f60('0xa2')](this,_0x25d6da[_0x3f60('0xd2')]);if(!_0x544c57){return this[_0x3f60('0xf')]['error'](_0x25d6da,'no\x20odbc\x20database\x20found');}if(!this[_0x3f60('0xa0')](_0x25d6da[_0x3f60('0x2d')])){return this[_0x3f60('0xf')]['error'](_0x25d6da,'no\x20query\x20configured');}var _0x46c043=_0x25d6da[_0x3f60('0x2d')][_0x3f60('0xd5')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0xd6'),_0x46c043));var _0x30a501=this[_0x3f60('0x28')][_0x3f60('0xa2')](this,_0x544c57,_0x46c043);this[_0x3f60('0x34')]['sync'](this,_0x25d6da,_0x46c043);if(!this[_0x3f60('0xa0')](_0x25d6da[_0x3f60('0xd7')])){return this['channel'][_0x3f60('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5aea7f=this[_0x3f60('0x11')][_0x3f60('0xa2')](this,_0x25d6da[_0x3f60('0xd7')]);if(!_0x5aea7f){return this[_0x3f60('0xf')]['error'](_0x25d6da,'no\x20variable\x20found');}var _0x36716b=this;_0x30a501['forEach'](function(_0x4f1ee0,_0x5c20d7){Object[_0x3f60('0xd8')](_0x4f1ee0)[_0x3f60('0xd9')](function(_0x444c39){_0x36716b[_0x3f60('0xf')]['setVariable'](util[_0x3f60('0x27')](_0x3f60('0xda'),_0x5aea7f,_0x5c20d7,_0x444c39),_0x4f1ee0[_0x444c39]);});});this[_0x3f60('0xf')][_0x3f60('0x9f')](util[_0x3f60('0x27')](_0x3f60('0xdb'),_0x5aea7f),_0x30a501[_0x3f60('0x97')]);return this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0xdc'),_0x5aea7f));};AGIVertices[_0x3f60('0x15')][_0x3f60('0xdd')]=function(_0x256112){logger['debug'](util['format'](_0x3f60('0xde'),_0x256112[_0x3f60('0xb1')]));if(!this[_0x3f60('0xa0')](_0x256112[_0x3f60('0xdf')])){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x256112,_0x3f60('0xe0'));}var _0x21bbf9=this[_0x3f60('0x1d')]['sync'](this,_0x256112[_0x3f60('0xdf')]);if(!_0x21bbf9){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x256112,_0x3f60('0xe1'));}var _0x1049db=this['channel'][_0x3f60('0x53')]('DIAL',[util['format'](_0x3f60('0xe2'),_0x21bbf9),_0x256112[_0x3f60('0x61')],_0x256112[_0x3f60('0xe3')],_0x256112[_0x3f60('0x5f')]]);if(_0x1049db['result']===-0x1){return _0x1049db;}return this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')]('Executed\x20command\x20%s',_0x3f60('0xe4')));};AGIVertices['prototype'][_0x3f60('0xe5')]=function(_0x1bb679){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0xe6'),_0x1bb679['label']));if(!this[_0x3f60('0xa0')](_0x1bb679['key'])){return this[_0x3f60('0xf')]['noop'](_0x3f60('0xe7'));}if(!this[_0x3f60('0xa0')](_0x1bb679[_0x3f60('0x5c')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0xa5'));}this[_0x3f60('0xf')][_0x3f60('0xe8')]=!![];this[_0x3f60('0x34')](_0x1bb679);this['createSquareMessage'](_0x1bb679[_0x3f60('0x5c')],'in','','');this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0xe9'),_0x1bb679[_0x3f60('0x5c')]));var _0x480bd0=this[_0x3f60('0x74')][_0x3f60('0xa2')](this,_0x1bb679);if(_0x480bd0){for(var _0x43299f in _0x480bd0){if(_0x480bd0['hasOwnProperty'](_0x43299f)){this[_0x3f60('0xf')][_0x3f60('0x9f')](util[_0x3f60('0x27')](_0x3f60('0xea'),_0x43299f['toUpperCase']()),_0x480bd0[_0x43299f]);}}this[_0x3f60('0x3e')](_0x480bd0['speech'],_0x3f60('0xeb'),_0x3f60('0xe5'),'');return this[_0x3f60('0xf')]['noop'](util[_0x3f60('0x27')]('Dialogflow\x20Result\x20%s',_0x480bd0[_0x3f60('0xec')]));}return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x1bb679,_0x3f60('0xed'));};AGIVertices[_0x3f60('0x15')]['dialogflowV2']=function(_0x3dbc52){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0xee'),_0x3dbc52['label']));if(!this['isConfigured'](_0x3dbc52[_0x3f60('0x77')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0xef'));}if(!this[_0x3f60('0xa0')](_0x3dbc52[_0x3f60('0xf0')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0xf1'));}if(!this[_0x3f60('0xa0')](_0x3dbc52[_0x3f60('0xf2')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0xf3'));}if(!this[_0x3f60('0xa0')](_0x3dbc52[_0x3f60('0xf4')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')]('no\x20anguage\x20configured');}if(!this[_0x3f60('0xa0')](_0x3dbc52['text'])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0xa5'));}this[_0x3f60('0xf')][_0x3f60('0xe8')]=!![];this[_0x3f60('0x34')](_0x3dbc52);this[_0x3f60('0x3e')](_0x3dbc52['text'],'in','','');this[_0x3f60('0xf')]['noop'](util[_0x3f60('0x27')](_0x3f60('0xf5'),_0x3dbc52[_0x3f60('0x5c')]));var _0x2c8bdd=this[_0x3f60('0x76')][_0x3f60('0xa2')](this,_0x3dbc52);if(_0x2c8bdd){for(var _0x3d301c in _0x2c8bdd){if(_0x2c8bdd[_0x3f60('0x90')](_0x3d301c)){if(_0x3d301c!==_0x3f60('0xf6')){this[_0x3f60('0xf')][_0x3f60('0x9f')](util['format'](_0x3f60('0xea'),_0x3d301c['toUpperCase']()),_0x2c8bdd[_0x3d301c]);}}}this[_0x3f60('0x3e')](_0x2c8bdd[_0x3f60('0xec')],_0x3f60('0xeb'),_0x3f60('0xf7'),_0x2c8bdd[_0x3f60('0xf6')]);return this[_0x3f60('0xf')][_0x3f60('0xa4')](util['format']('DialogflowV2\x20Result\x20%s',_0x2c8bdd[_0x3f60('0xec')]));}return this['channel']['error'](_0x3dbc52,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x3f60('0x15')][_0x3f60('0xf8')]=function(_0x3965ab){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0xf9'),_0x3965ab[_0x3f60('0xb1')]));if(!this[_0x3f60('0xa0')](_0x3965ab[_0x3f60('0xfa')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x3f60('0xa0')](_0x3965ab[_0x3f60('0xfb')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x3965ab['password'])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0xfc'));}if(!this[_0x3f60('0xa0')](_0x3965ab[_0x3f60('0xfd')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0xa5'));}this[_0x3f60('0xf')][_0x3f60('0xe8')]=!![];this[_0x3f60('0x34')](_0x3965ab);this[_0x3f60('0x3e')](_0x3965ab[_0x3f60('0x5c')],'in','','');this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0xfe'),_0x3965ab['text']));var _0x3a75e9=this[_0x3f60('0x78')]['sync'](this,_0x3965ab);if(_0x3a75e9){for(var _0x3ed4c0 in _0x3a75e9){if(_0x3a75e9[_0x3f60('0x90')](_0x3ed4c0)){this[_0x3f60('0xf')][_0x3f60('0x9f')](util[_0x3f60('0x27')](_0x3f60('0xff'),_0x3ed4c0[_0x3f60('0x64')]()),_0x3a75e9[_0x3ed4c0]);}}this[_0x3f60('0x3e')](_0x3a75e9[_0x3f60('0xec')],_0x3f60('0xeb'),_0x3f60('0xf8'),'');if(_0x3a75e9['audiofile']){this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x100'),_0x3a75e9[_0x3f60('0x101')]));var _0x4eadf3=this[_0x3f60('0xf')][_0x3f60('0x102')](_0x3a75e9[_0x3f60('0x101')]);try{fs['unlink'](_0x3a75e9[_0x3f60('0x101')]+_0x3f60('0x103'));}catch(_0x22b793){logger['error'](_0x22b793);}return _0x4eadf3;}else{return this[_0x3f60('0xf')]['noop'](util[_0x3f60('0x27')]('SestekNDA\x20Result\x20%s',_0x3a75e9['speech']));}}return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x3965ab,_0x3f60('0x104'));};AGIVertices[_0x3f60('0x15')]['end']=function(_0x205625){logger[_0x3f60('0x2b')](util['format'](_0x3f60('0x105'),_0x205625[_0x3f60('0xb1')]));return this[_0x3f60('0xf')]['noop']('end');};AGIVertices[_0x3f60('0x15')][_0x3f60('0x106')]=function(_0x4ded61){logger['info'](util[_0x3f60('0x27')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x4ded61[_0x3f60('0xb1')]));var _0x2c4bf0='';if(_0x4ded61[_0x3f60('0x107')]){if(!this[_0x3f60('0xa0')](_0x4ded61[_0x3f60('0x107')])){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x4ded61,'no\x20trunk\x20selected');}else{var _0x324c9a=parseInt(_0x4ded61[_0x3f60('0x107')],0xa);if(isNaN(_0x324c9a)){_0x2c4bf0=_0x4ded61[_0x3f60('0x107')];}else{_0x2c4bf0=this['getTrunk']['sync'](this,_0x4ded61['trunk_id']);if(!_0x2c4bf0){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x4ded61,_0x3f60('0x108'));}}}}else if(_0x4ded61[_0x3f60('0x109')]){_0x2c4bf0=_0x4ded61[_0x3f60('0x109')];}else{return this['channel'][_0x3f60('0x29')](_0x4ded61,_0x3f60('0x10a'));}var _0x56c190=this['channel'][_0x3f60('0x53')](_0x3f60('0xe4'),[util[_0x3f60('0x27')](_0x3f60('0x10b'),_0x2c4bf0,_0x4ded61[_0x3f60('0x10c')]),_0x4ded61[_0x3f60('0x61')],_0x4ded61['opts'],_0x4ded61['url']]);if(_0x56c190['result']===-0x1){return _0x56c190;}return this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x10d'),_0x3f60('0xe4')));};AGIVertices['prototype']['finally']=function(_0x2225df){logger[_0x3f60('0x2b')](util['format'](_0x3f60('0x10e'),_0x2225df[_0x3f60('0xb1')]));return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0x10f'));};AGIVertices[_0x3f60('0x15')]['getdigits']=function(_0x2575c5){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x110'),_0x2575c5[_0x3f60('0xb1')]));if(_0x2575c5[_0x3f60('0xa3')]===0x0){return this[_0x3f60('0xa1')](_0x2575c5);}_0x2575c5[_0x3f60('0xa3')]-=0x1;if(!this['isConfigured'](_0x2575c5[_0x3f60('0x111')])){return this['channel'][_0x3f60('0x29')](_0x2575c5,'no\x20file\x20audio\x20selected');}var _0x190246=this[_0x3f60('0x112')][_0x3f60('0xa2')](this,_0x2575c5[_0x3f60('0x111')]);if(!_0x190246){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x2575c5,_0x3f60('0x113'));}if(!this[_0x3f60('0xa0')](_0x2575c5['variable_id'])){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x3f60('0x114'));}var _0x12983e=this[_0x3f60('0xf')]['getData'](_0x190246,_0x2575c5[_0x3f60('0x115')],_0x2575c5[_0x3f60('0x116')]);var _0xb31b34=_0x12983e[_0x3f60('0xa7')]?_0x12983e['result']['toString']():'';logger[_0x3f60('0x2b')]('test',JSON[_0x3f60('0x6d')](_0x12983e));if(_0x12983e['result']===-0x1){this[_0x3f60('0x34')][_0x3f60('0xa2')](this,_0x2575c5,_0xb31b34);return _0x12983e;}else if(_0x12983e[_0x3f60('0x9c')]===_0x3f60('0x61')){_0x12983e[_0x3f60('0xa7')]=_0xb31b34[_0x3f60('0x97')]>=parseInt(_0x2575c5['mindigit'])?'x':'i';}else{_0x12983e[_0x3f60('0xa7')]=_0xb31b34['length']>=parseInt(_0x2575c5[_0x3f60('0x117')])&&_0xb31b34[_0x3f60('0x97')]<=parseInt(_0x2575c5['maxdigit'])?'x':'i';}var _0x38c21e=this[_0x3f60('0x11')]['sync'](this,_0x2575c5['variable_id']);if(!_0x38c21e){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x2575c5,'no\x20variable\x20found');}this[_0x3f60('0xf')][_0x3f60('0x9f')](_0x38c21e,_0xb31b34);if(this[_0x3f60('0xa0')](_0x2575c5[_0x3f60('0x118')])){var _0x28a923=parseInt(_0x2575c5['hiddendigitsnum'],0xa);var _0x48dee2=rs['generate']({'charset':'*','length':_0x28a923});var _0x21b23e=_0xb31b34[_0x3f60('0x97')];if(_0x21b23e>0x0){if(_0x21b23e>_0x28a923){this[_0x3f60('0x34')][_0x3f60('0xa2')](this,_0x2575c5,_0x2575c5[_0x3f60('0x119')]===_0x3f60('0x11a')?_0x48dee2+_0xb31b34['substr'](_0x28a923):_0xb31b34[_0x3f60('0x11b')](0x0,_0x21b23e-_0x28a923)+_0x48dee2);}else{this[_0x3f60('0x34')][_0x3f60('0xa2')](this,_0x2575c5,rs[_0x3f60('0x11c')]({'charset':'*','length':_0x21b23e}));}}else{this[_0x3f60('0x34')]['sync'](this,_0x2575c5,'');}}else{this[_0x3f60('0x34')][_0x3f60('0xa2')](this,_0x2575c5,_0xb31b34);}return _0x12983e;};AGIVertices[_0x3f60('0x15')][_0x3f60('0xe')]=function(_0x38c9b7){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x11d'),_0x38c9b7[_0x3f60('0xb1')]));return this[_0x3f60('0xd')](_0x38c9b7);};AGIVertices[_0x3f60('0x15')]['goal']=function(_0x32aaef){logger[_0x3f60('0x2b')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x32aaef[_0x3f60('0xb1')]));this[_0x3f60('0x34')][_0x3f60('0xa2')](this,_0x32aaef,_0x32aaef[_0x3f60('0x11e')]);return this['channel']['noop'](util[_0x3f60('0x27')](_0x3f60('0x11f'),_0x32aaef[_0x3f60('0x11e')]));};AGIVertices[_0x3f60('0x15')][_0x3f60('0x120')]=function(_0x3a4973){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x121'),_0x3a4973[_0x3f60('0xb1')]));if(!this['isConfigured'](_0x3a4973[_0x3f60('0x81')])||!this[_0x3f60('0xa0')](_0x3a4973['aws_secret_access_key'])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0x122'));}if(!this['isConfigured'](_0x3a4973[_0x3f60('0x5c')])){return this[_0x3f60('0xf')]['noop'](_0x3f60('0xa5'));}this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x123'),_0x3a4973['text']));var _0x1a3456=this['awsPolly'][_0x3f60('0xa2')](this,_0x3a4973);if(_0x1a3456){this[_0x3f60('0xf')]['noop'](util[_0x3f60('0x27')](_0x3f60('0x124'),_0x1a3456));var _0x113ed2=this[_0x3f60('0xf')][_0x3f60('0x102')](_0x1a3456);try{fs['unlink'](_0x1a3456+_0x3f60('0x103'));}catch(_0x307a09){logger['error'](_0x307a09);}return _0x113ed2;}return this[_0x3f60('0xf')]['error'](_0x3a4973,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x3f60('0x15')]['awslex']=function(_0x466a49){logger[_0x3f60('0x2b')](util['format'](_0x3f60('0x125'),_0x466a49['label']));if(!this[_0x3f60('0xa0')](_0x466a49['aws_access_key_id'])||!this['isConfigured'](_0x466a49[_0x3f60('0x87')])){return this[_0x3f60('0xf')]['noop'](_0x3f60('0x122'));}if(!this[_0x3f60('0xa0')](_0x466a49[_0x3f60('0x88')])){return this['channel']['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x3f60('0xa0')](_0x466a49[_0x3f60('0x5c')])){return this[_0x3f60('0xf')]['noop'](_0x3f60('0xa5'));}this[_0x3f60('0xf')][_0x3f60('0xe8')]=!![];this['createSquareDetailsReport'](_0x466a49);this[_0x3f60('0x3e')](_0x466a49[_0x3f60('0x5c')],'in','','');this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')]('Trying\x20Amazon\x20Lex:\x20%s',_0x466a49['text']));var _0x57b801=this[_0x3f60('0x86')][_0x3f60('0xa2')](this,_0x466a49);if(_0x57b801){for(var _0x102e75 in _0x57b801){if(_0x57b801[_0x3f60('0x90')](_0x102e75)&&_[_0x3f60('0x91')](_0x57b801[_0x102e75])){this[_0x3f60('0xf')][_0x3f60('0x9f')](util[_0x3f60('0x27')](_0x3f60('0x126'),_0x102e75[_0x3f60('0x64')]()),_0x57b801[_0x102e75]);}}if(_[_0x3f60('0x41')](_0x57b801[_0x3f60('0x71')])){return this[_0x3f60('0xf')]['noop'](_0x3f60('0x127'));}else{this[_0x3f60('0x3e')](_0x57b801[_0x3f60('0x71')],_0x3f60('0xeb'),_0x3f60('0x128'),'');return this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x129'),_0x57b801['message']));}}return this['channel'][_0x3f60('0x29')](_0x466a49,_0x3f60('0x12a'));};AGIVertices[_0x3f60('0x15')][_0x3f60('0x12b')]=function(_0x46ce45){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x46ce45['label'],_0x46ce45[_0x3f60('0x61')]));if(!this[_0x3f60('0xa0')](_0x46ce45[_0x3f60('0x7a')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0xe7'));}var _0x4c9c95=_0x3f60('0x12c');var _0x68dae=util['format'](_0x3f60('0x12d'),FILES_PATH,rs[_0x3f60('0x11c')](0x4));var _0xc67108=util[_0x3f60('0x27')](_0x3f60('0x99'),_0x68dae,_0x4c9c95);var _0xa52b63=!![];if(_0x46ce45[_0x3f60('0x12e')]===_0x3f60('0x12f')){_0xa52b63=![];}var _0x18af7b=this[_0x3f60('0xf')]['recordFile'](_0x68dae,_0x4c9c95,_0x46ce45['intKey'],_0x46ce45[_0x3f60('0x61')],undefined,_0xa52b63);if(_0x18af7b[_0x3f60('0xa7')]!==-0x1){this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x130'),_0xc67108));var _0x5f0785=this[_0x3f60('0x89')][_0x3f60('0xa2')](this,_0x46ce45,_0xc67108);if(_0x5f0785){for(var _0x54fd9a in _0x5f0785){if(_0x5f0785[_0x3f60('0x90')](_0x54fd9a)){this['channel'][_0x3f60('0x9f')](util[_0x3f60('0x27')](_0x3f60('0x131'),_0x54fd9a[_0x3f60('0x64')]()),_0x5f0785[_0x54fd9a]);}}return this[_0x3f60('0xf')][_0x3f60('0xa4')](util['format']('GoogleASR\x20Result\x20%s',JSON[_0x3f60('0x6d')](_0x5f0785)));}}return _0x18af7b;};AGIVertices[_0x3f60('0x15')][_0x3f60('0x132')]=function(_0x28b222){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x133'),_0x28b222['label']));if(!this[_0x3f60('0xa0')](_0x28b222[_0x3f60('0x134')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0x135'));}if(!this['isConfigured'](_0x28b222[_0x3f60('0x8c')])){return this['channel'][_0x3f60('0xa4')](_0x3f60('0x136'));}var _0x238160=_0x3f60('0x12c');var _0x3b55f0=util['format'](_0x3f60('0x12d'),FILES_PATH,rs[_0x3f60('0x11c')](0x4));var _0xf7ed60=util['format']('%s.%s',_0x3b55f0,_0x238160);var _0x4177b3=!![];if(_0x28b222[_0x3f60('0x12e')]===_0x3f60('0x12f')){_0x4177b3=![];}var _0x2a8c0c=this[_0x3f60('0xf')][_0x3f60('0x137')](_0x3b55f0,_0x238160,_0x28b222['intKey'],_0x28b222[_0x3f60('0x61')],undefined,_0x4177b3);if(_0x2a8c0c[_0x3f60('0xa7')]!==-0x1){this[_0x3f60('0xf')]['noop'](util[_0x3f60('0x27')](_0x3f60('0x138'),_0xf7ed60));var _0xaa022a=this['tildeASR']['sync'](this,_0x28b222,_0xf7ed60);if(_0xaa022a){for(var _0x148abd in _0xaa022a){if(_0xaa022a[_0x3f60('0x90')](_0x148abd)){this[_0x3f60('0xf')][_0x3f60('0x9f')](util[_0x3f60('0x27')](_0x3f60('0x139'),_0x148abd['toUpperCase']()),_0xaa022a[_0x148abd]);}}return this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x13a'),JSON[_0x3f60('0x6d')](_0xaa022a)));}}return _0x2a8c0c;};AGIVertices['prototype'][_0x3f60('0x13b')]=function(_0xefa3d9){logger[_0x3f60('0x2b')](util['format'](_0x3f60('0x13c'),_0xefa3d9[_0x3f60('0xb1')]));return this['channel']['continueAt'](_0xefa3d9['context'],_0xefa3d9[_0x3f60('0x13d')],_0xefa3d9['priority']);};AGIVertices[_0x3f60('0x15')][_0x3f60('0x13e')]=function(_0x354104){logger['info'](util[_0x3f60('0x27')](_0x3f60('0x13f'),_0x354104['label']));if(!this[_0x3f60('0xa0')](_0x354104[_0x3f60('0x140')])){return this['channel']['error'](_0x354104,_0x3f60('0x141'));}try{var _0x3e16a4=eval(_0x354104[_0x3f60('0x140')])?_0x3f60('0x142'):_0x3f60('0x143');this['channel']['noop'](util[_0x3f60('0x27')](_0x3f60('0x144'),_0x354104[_0x3f60('0x140')],_0x3e16a4));return{'code':0xc8,'result':_0x3e16a4};}catch(_0x21063a){return{'code':0xc8,'result':_0x3f60('0x143')};}};AGIVertices[_0x3f60('0x15')][_0x3f60('0x145')]=function(_0x4f371d){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x146'),_0x4f371d[_0x3f60('0xb1')]));if(!this[_0x3f60('0xa0')](_0x4f371d[_0x3f60('0x147')])){return this[_0x3f60('0xf')]['error'](_0x4f371d,_0x3f60('0x148'));}var _0x48df90=this[_0x3f60('0x24')][_0x3f60('0xa2')](this,_0x4f371d['interval_id']);if(!_0x48df90){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x4f371d,_0x3f60('0x149'));}for(var _0xd72610=0x0;_0xd72610<_0x48df90[_0x3f60('0x97')];_0xd72610+=0x1){var _0x27148c=this[_0x3f60('0xf')]['getVariable'](util[_0x3f60('0x27')]('IFTIME(%s?true:false)',_0x48df90[_0xd72610]));if(_0x27148c[_0x3f60('0xa7')]===-0x1){return _0x27148c;}logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x14a'),_0x48df90[_0xd72610],_0x27148c[_0x3f60('0x9c')]));if(_0x27148c[_0x3f60('0x9c')]==='true'){logger['info'](util['format'](_0x3f60('0x14a'),_0x48df90[_0xd72610],'true'));this[_0x3f60('0xf')]['noop'](util[_0x3f60('0x27')](_0x3f60('0x14a'),_0x48df90[_0xd72610],_0x3f60('0x142')));return{'code':0xc8,'result':_0x3f60('0x142')};}else{logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x14a'),_0x48df90[_0xd72610],_0x3f60('0x143')));this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x14a'),_0x48df90[_0xd72610],'false'));}}return{'code':0xc8,'result':_0x3f60('0x143')};};AGIVertices['prototype'][_0x3f60('0x14b')]=function(_0x4c0bfa){logger[_0x3f60('0x2b')](util['format'](_0x3f60('0x14c'),_0x4c0bfa[_0x3f60('0xb1')]));return this[_0x3f60('0xf')]['hangup']();};AGIVertices['prototype'][_0x3f60('0x14d')]=function(_0x3c99f0){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x3c99f0[_0x3f60('0xb1')]));if(!this[_0x3f60('0xa0')](_0x3c99f0[_0x3f60('0x7a')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0xe7'));}var _0x533068=_0x3f60('0x12c');var _0x2f3c14=util[_0x3f60('0x27')](_0x3f60('0x12d'),FILES_PATH,rs[_0x3f60('0x11c')](0x4));var _0x16a9f2=util['format']('%s.%s',_0x2f3c14,_0x533068);var _0xb9a7a4=!![];if(_0x3c99f0[_0x3f60('0x12e')]==='NOBEEP'){_0xb9a7a4=![];}var _0x33a928=this[_0x3f60('0xf')]['recordFile'](_0x2f3c14,_0x533068,_0x3c99f0['intKey'],_0x3c99f0['timeout'],undefined,_0xb9a7a4);if(_0x33a928[_0x3f60('0xa7')]!==-0x1){this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')]('ispeech\x20%s\x20file\x20created',_0x16a9f2));var _0x44d159=this['ispeechASR'][_0x3f60('0xa2')](this,_0x3c99f0,_0x16a9f2);if(_0x44d159){for(var _0x410c76 in _0x44d159){if(_0x44d159[_0x3f60('0x90')](_0x410c76)){this[_0x3f60('0xf')]['setVariable'](util[_0x3f60('0x27')](_0x3f60('0x14e'),_0x410c76['toUpperCase']()),_0x44d159[_0x410c76]);}}return this['channel'][_0x3f60('0xa4')](util[_0x3f60('0x27')]('IspeechASR\x20Result\x20%s',JSON[_0x3f60('0x6d')](_0x44d159)));}}return _0x33a928;};AGIVertices[_0x3f60('0x15')][_0x3f60('0x14f')]=function(_0x55e4ea){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x150'),_0x55e4ea['label']));if(!this[_0x3f60('0xa0')](_0x55e4ea[_0x3f60('0x7a')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')]('no\x20key\x20configured');}if(!this[_0x3f60('0xa0')](_0x55e4ea[_0x3f60('0x5c')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0xa5'));}this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x151'),_0x55e4ea[_0x3f60('0x5c')]));var _0x56dceb=this['ispeechTTS'][_0x3f60('0xa2')](this,_0x55e4ea);if(_0x56dceb){this['channel'][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x152'),_0x56dceb));var _0x18daac=this[_0x3f60('0xf')][_0x3f60('0x102')](_0x56dceb,_0x55e4ea[_0x3f60('0x153')]);try{fs[_0x3f60('0x154')](_0x56dceb+_0x3f60('0x103'));}catch(_0x32ea33){logger[_0x3f60('0x29')](_0x32ea33);}return _0x18daac;}return this[_0x3f60('0xf')]['error'](_0x55e4ea,_0x3f60('0x155'));};AGIVertices[_0x3f60('0x15')][_0x3f60('0x156')]=function(_0x239dc6){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x157'),_0x239dc6[_0x3f60('0xb1')]));if(!this[_0x3f60('0xa0')](_0x239dc6[_0x3f60('0x158')])){return this[_0x3f60('0xf')]['error'](_0x239dc6,_0x3f60('0x159'));}logger[_0x3f60('0x2b')](util['format'](_0x3f60('0x15a'),this[_0x3f60('0xf')][_0x3f60('0x4b')],_0x239dc6[_0x3f60('0x158')]));var _0x40e54d=this['agentLogin'][_0x3f60('0xa2')](this,_0x239dc6['findBy']);if(_0x40e54d){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x15b'),this[_0x3f60('0xf')][_0x3f60('0x4b')],_0x239dc6[_0x3f60('0x158')]));this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3f60('0xf')][_0x3f60('0x4b')],_0x239dc6[_0x3f60('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x15c'),this[_0x3f60('0xf')][_0x3f60('0x4b')],_0x239dc6[_0x3f60('0x158')]));this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x15c'),this['channel']['callerid'],_0x239dc6[_0x3f60('0x158')]));return{'code':0xc8,'result':_0x3f60('0x15d')};}};AGIVertices[_0x3f60('0x15')][_0x3f60('0x15e')]=function(_0xc023b8){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x15f'),_0xc023b8[_0x3f60('0xb1')]));if(!this[_0x3f60('0xa0')](_0xc023b8['findBy'])){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0xc023b8,_0x3f60('0x159'));}logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x15a'),this[_0x3f60('0xf')]['callerid'],_0xc023b8[_0x3f60('0x158')]));var _0x74bfd0=this[_0x3f60('0x4d')][_0x3f60('0xa2')](this,_0xc023b8[_0x3f60('0x158')]);if(_0x74bfd0){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x15b'),this[_0x3f60('0xf')][_0x3f60('0x4b')],_0xc023b8['findBy']));this['channel'][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x15b'),this[_0x3f60('0xf')][_0x3f60('0x4b')],_0xc023b8[_0x3f60('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x15c'),this[_0x3f60('0xf')][_0x3f60('0x4b')],_0xc023b8['findBy']));this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x15c'),this[_0x3f60('0xf')][_0x3f60('0x4b')],_0xc023b8[_0x3f60('0x158')]));return{'code':0xc8,'result':_0x3f60('0x15d')};}};AGIVertices[_0x3f60('0x15')]['math']=function(_0x3f0626){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x160'),_0x3f0626[_0x3f60('0xb1')]));if(!this[_0x3f60('0xa0')](_0x3f0626[_0x3f60('0x161')])){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x3f0626,_0x3f60('0x162'));}this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x163'),_0x3f0626[_0x3f60('0x161')]));var _0x338d0c=eval(_0x3f0626[_0x3f60('0x161')]);if(!this[_0x3f60('0xa0')](_0x3f0626[_0x3f60('0xd7')])){return this[_0x3f60('0xf')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4c6057=this[_0x3f60('0x11')][_0x3f60('0xa2')](this,_0x3f0626['variable_id']);if(!_0x4c6057){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x3f0626,_0x3f60('0x164'));}if(_[_0x3f60('0x96')](_0x338d0c)){var _0x55d44e=this;_0x338d0c['forEach'](function(_0x1ce7eb,_0x31553d){_0x55d44e[_0x3f60('0xf')]['setVariable'](util['format'](_0x3f60('0x165'),_0x4c6057,_0x31553d),_0x1ce7eb);});return this['channel'][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x166'),_0x4c6057));}else{return this['channel'][_0x3f60('0x9f')](_0x4c6057,_0x338d0c);}};AGIVertices['prototype'][_0x3f60('0xc')]=function(_0x4c5e88){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x167'),_0x4c5e88[_0x3f60('0xb1')]));if(_0x4c5e88[_0x3f60('0xa3')]===0x0){return this[_0x3f60('0xa1')](_0x4c5e88);}_0x4c5e88[_0x3f60('0xa3')]-=0x1;if(!this[_0x3f60('0xa0')](_0x4c5e88[_0x3f60('0x111')])){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x4c5e88,'no\x20file\x20audio\x20selected');}var _0x149fe6=this['getSound'][_0x3f60('0xa2')](this,_0x4c5e88[_0x3f60('0x111')]);if(!_0x149fe6){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x4c5e88,_0x3f60('0x113'));}var _0x2a78af=this[_0x3f60('0xf')][_0x3f60('0x168')](_0x149fe6,_0x4c5e88[_0x3f60('0x115')],_0x4c5e88[_0x3f60('0x169')]);var _0x5659d2=_0x2a78af[_0x3f60('0xa7')];if(_0x2a78af[_0x3f60('0xa7')]===-0x1){this[_0x3f60('0x34')][_0x3f60('0xa2')](this,_0x4c5e88,'-1');return _0x2a78af;}else if(_0x2a78af[_0x3f60('0x9c')]===_0x3f60('0x61')){_0x2a78af['result']=_0x2a78af['result'][_0x3f60('0x97')]>0x0?_0x2a78af[_0x3f60('0xa7')]:'t';}else if(_[_0x3f60('0x40')](_0x2a78af[_0x3f60('0xa7')])){_0x2a78af[_0x3f60('0xa7')]='#';_0x5659d2='#';}if(!this['isConfigured'](_0x4c5e88['variable_id'])){this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0x114'));}else{var _0x537c46=this[_0x3f60('0x11')][_0x3f60('0xa2')](this,_0x4c5e88['variable_id']);if(!_0x537c46){return this[_0x3f60('0xf')]['error'](_0x4c5e88,'no\x20variable\x20found');}this[_0x3f60('0xf')][_0x3f60('0x9f')](_0x537c46,_0x5659d2);}this['createSquareDetailsReport'][_0x3f60('0xa2')](this,_0x4c5e88,_0x5659d2);return _0x2a78af;};AGIVertices[_0x3f60('0x15')][_0x3f60('0xa4')]=function(_0x2a21ca){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x16a'),_0x2a21ca[_0x3f60('0xb1')]));return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x2a21ca[_0x3f60('0x16b')]||_0x2a21ca[_0x3f60('0xb1')]);};AGIVertices[_0x3f60('0x15')][_0x3f60('0x16c')]=function(_0x12bc8d){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x16d'),_0x12bc8d[_0x3f60('0xb1')]));if(!this[_0x3f60('0xa0')](_0x12bc8d[_0x3f60('0x158')])){return this[_0x3f60('0xf')]['error'](_0x12bc8d,_0x3f60('0x159'));}logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x15a'),this[_0x3f60('0xf')][_0x3f60('0x4b')],_0x12bc8d[_0x3f60('0x158')]));var _0xe28e10=this[_0x3f60('0x16e')][_0x3f60('0xa2')](this,_0x12bc8d[_0x3f60('0x16f')]);var _0x17a0e5=this['agentPause']['sync'](this,_0x12bc8d['findBy'],_0xe28e10);if(_0x17a0e5){logger['info'](util[_0x3f60('0x27')](_0x3f60('0x15b'),this[_0x3f60('0xf')][_0x3f60('0x4b')],_0x12bc8d[_0x3f60('0x158')]));this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3f60('0xf')][_0x3f60('0x4b')],_0x12bc8d[_0x3f60('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x15c'),this[_0x3f60('0xf')][_0x3f60('0x4b')],_0x12bc8d[_0x3f60('0x158')]));this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x15b'),this[_0x3f60('0xf')][_0x3f60('0x4b')],_0x12bc8d[_0x3f60('0x158')]));return{'code':0xc8,'result':_0x3f60('0x15d')};}};AGIVertices[_0x3f60('0x15')][_0x3f60('0x170')]=function(_0x4a5655){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x171'),_0x4a5655['label']));if(!this['isConfigured'](_0x4a5655['file_id'])){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x4a5655,_0x3f60('0x172'));}var _0x222943=this['getSound'][_0x3f60('0xa2')](this,_0x4a5655[_0x3f60('0x111')]);if(!_0x222943){return this['channel'][_0x3f60('0x29')](_0x4a5655,_0x3f60('0x113'));}var _0x4ac53f=this['channel'][_0x3f60('0x53')]('PLAYBACK',[_0x222943,_0x4a5655[_0x3f60('0xe3')]]);if(_0x4ac53f[_0x3f60('0xa7')]===-0x1){return _0x4ac53f;}return this[_0x3f60('0xf')][_0x3f60('0xa4')](util['format'](_0x3f60('0xc1'),'PLAYBACK',_0x222943));};AGIVertices[_0x3f60('0x15')]['queue']=function(_0x1124b3){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x1124b3[_0x3f60('0xb1')]));if(!this['isConfigured'](_0x1124b3[_0x3f60('0x173')])){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x1124b3,_0x3f60('0x174'));}var _0x16042f='';var _0x1bf14d=parseInt(_0x1124b3['queue_id'],0xa);if(isNaN(_0x1bf14d)){_0x16042f=_0x1124b3['queue_id'];}else{_0x16042f=this[_0x3f60('0x16')][_0x3f60('0xa2')](this,_0x1124b3[_0x3f60('0x173')]);if(!_0x16042f){return this[_0x3f60('0xf')]['error'](_0x1124b3,'no\x20queue\x20found');}}var _0x583f31='';if(this[_0x3f60('0xa0')](_0x1124b3['file_id'])){var _0x57f2c4=this[_0x3f60('0x112')]['sync'](this,_0x1124b3[_0x3f60('0x111')]);if(_0x57f2c4){_0x583f31=_0x57f2c4;}}this['createSquareDetailsReport'][_0x3f60('0xa2')](this,_0x1124b3,_0x16042f);if(_0x1124b3[_0x3f60('0xe3')][_0x3f60('0x175')]('x')<0x0){_0x1124b3[_0x3f60('0xe3')]+='x';}if(_0x1124b3['opts'][_0x3f60('0x175')]('X')<0x0){_0x1124b3['opts']+='X';}this['channel'][_0x3f60('0x9f')](_0x3f60('0x176'),_0x16042f?_0x16042f[_0x3f60('0x177')]():'');var _0x3633a1=this['channel'][_0x3f60('0x53')](_0x3f60('0x178'),[_0x16042f,_0x1124b3[_0x3f60('0xe3')],_0x1124b3[_0x3f60('0x5f')],_0x583f31,_0x1124b3['timeout'],_0x1124b3[_0x3f60('0x8')],_0x1124b3['macro'],_0x1124b3['gosub'],'',_0x1124b3[_0x3f60('0x179')]]);if(_0x3633a1[_0x3f60('0xa7')]===-0x1){return _0x3633a1;}return this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0xc1'),_0x3f60('0x178'),_0x16042f));};AGIVertices[_0x3f60('0x15')][_0x3f60('0x17a')]=function(_0x177757){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x177757[_0x3f60('0xb1')]));var _0x4a5ab9=_0x177757['recordingFormat']||'wav';var _0x516968=util[_0x3f60('0x27')](_0x3f60('0x17b'),this['channel'][_0x3f60('0x38')],rs[_0x3f60('0x11c')](0x5));var _0x552348=util[_0x3f60('0x27')](_0x3f60('0x17c'),FILES_PATH,_0x516968,_0x4a5ab9);var _0x1a79b9=util['format']('%s/recordings/%s',FILES_PATH,_0x516968);this['createSquareRecording'][_0x3f60('0xa2')](this,_0x177757,_0x516968,_0x552348);this[_0x3f60('0xf')][_0x3f60('0x9f')](_0x3f60('0x17d'),_0x516968);logger[_0x3f60('0x2b')](_0x3f60('0x17e'),_0x1a79b9,_0x4a5ab9,_0x177757['escape_digits'],_0x177757[_0x3f60('0x61')]);return this[_0x3f60('0xf')][_0x3f60('0x137')](_0x1a79b9,_0x4a5ab9,_0x177757[_0x3f60('0x17f')],_0x177757['timeout'],undefined,!![]);};AGIVertices[_0x3f60('0x15')][_0x3f60('0x180')]=function(_0x3e779a){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x181'),_0x3e779a[_0x3f60('0xb1')]));if(!this[_0x3f60('0xa0')](_0x3e779a[_0x3f60('0x5f')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0x182'));}var _0x497a0f=this[_0x3f60('0x5e')][_0x3f60('0xa2')](this,_0x3e779a);logger['info'](util['format']('Response:',util[_0x3f60('0x183')](_0x497a0f,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3e779a[_0x3f60('0xd7')])){return this['channel'][_0x3f60('0xa4')](_0x3f60('0x184'));}var _0x2fb22a=this['getVariable'][_0x3f60('0xa2')](this,_0x3e779a['variable_id']);if(!_0x2fb22a){return this['channel'][_0x3f60('0x29')](_0x3e779a,'no\x20variable\x20found');}this[_0x3f60('0xf')][_0x3f60('0x9f')](util[_0x3f60('0x27')](_0x3f60('0x185'),_0x2fb22a),_0x497a0f[_0x3f60('0x6f')]?_0x497a0f['statusCode']:'200');this['channel'][_0x3f60('0x9f')](util[_0x3f60('0x27')]('%s_STATUS_MESSAGE',_0x2fb22a),_0x497a0f[_0x3f60('0x70')]?_0x497a0f[_0x3f60('0x70')]:'OK');if(_0x497a0f[_0x3f60('0x65')]){try{this[_0x3f60('0x98')](_0x497a0f[_0x3f60('0x65')],_0x2fb22a);}catch(_0x3f1a23){logger[_0x3f60('0x29')](util[_0x3f60('0x27')](_0x3f60('0x186'),_0x2fb22a));}}return this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')]('variable\x20%s\x20set',_0x2fb22a));};AGIVertices['prototype']['saydigits']=function(_0x4be253){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x187'),_0x4be253[_0x3f60('0xb1')]));return this[_0x3f60('0xf')]['sayDigits'](_0x4be253[_0x3f60('0x188')]['replace'](/\s+/g,''),_0x4be253[_0x3f60('0x17f')]);};AGIVertices[_0x3f60('0x15')]['saynumber']=function(_0x1437e4){logger['info'](util[_0x3f60('0x27')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x1437e4[_0x3f60('0xb1')]));return this[_0x3f60('0xf')][_0x3f60('0x189')](_0x1437e4[_0x3f60('0x62')][_0x3f60('0xd5')](/\s+/g,''),_0x1437e4[_0x3f60('0x17f')]);};AGIVertices['prototype'][_0x3f60('0x18a')]=function(_0x4bd2a0){logger['info'](util[_0x3f60('0x27')](_0x3f60('0x18b'),_0x4bd2a0[_0x3f60('0xb1')]));return this[_0x3f60('0xf')][_0x3f60('0x18c')](_0x4bd2a0['text'],_0x4bd2a0['escape_digits']);};AGIVertices[_0x3f60('0x15')][_0x3f60('0x18d')]=function(_0x4cda3e){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x18e'),_0x4cda3e['label']));if(!this['isConfigured'](_0x4cda3e['account_id'])){return this[_0x3f60('0xf')][_0x3f60('0xa4')]('no\x20mail\x20account\x20configured');}var _0x8a7ac3=this[_0x3f60('0x21')]['sync'](this,_0x4cda3e['account_id']);if(!_0x8a7ac3||!_0x8a7ac3[_0x3f60('0x18f')]){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x4cda3e,_0x3f60('0x190'));}var _0xc9bef4={'from':util['format'](_0x3f60('0x191'),_0x8a7ac3[_0x3f60('0x1a')],_0x8a7ac3[_0x3f60('0x192')]||_0x8a7ac3[_0x3f60('0x18f')][_0x3f60('0x193')]),'to':_0x4cda3e['to']||'','cc':_0x4cda3e['cc']||'','bcc':_0x4cda3e['bcc']||'','subject':_0x4cda3e[_0x3f60('0x194')],'html':_0x4cda3e['text'],'text':_0x4cda3e[_0x3f60('0x5c')]};var _0x442752={'tls':{'rejectUnauthorized':![]}};if(_0x8a7ac3[_0x3f60('0x18f')][_0x3f60('0x195')]){_0x442752[_0x3f60('0x195')]=_0x8a7ac3['Smtp'][_0x3f60('0x195')];}else{_0x442752[_0x3f60('0x196')]=_0x8a7ac3[_0x3f60('0x18f')][_0x3f60('0x196')];_0x442752[_0x3f60('0x197')]=_0x8a7ac3['Smtp'][_0x3f60('0x197')];_0x442752[_0x3f60('0x198')]=_0x8a7ac3[_0x3f60('0x18f')][_0x3f60('0x198')];}if(_0x8a7ac3[_0x3f60('0x18f')][_0x3f60('0x199')]){_0x442752[_0x3f60('0x19a')]={'user':_0x8a7ac3['Smtp'][_0x3f60('0x193')],'pass':_0x8a7ac3[_0x3f60('0x18f')][_0x3f60('0x19b')]};}if(this[_0x3f60('0xa0')](_0x4cda3e['template_id'])){}logger[_0x3f60('0x19c')]('sendMail\x20message',JSON[_0x3f60('0x6d')](_0xc9bef4));this[_0x3f60('0x34')]['sync'](this,_0x4cda3e,_0x4cda3e[_0x3f60('0x19d')]);this[_0x3f60('0xf')]['noop'](util[_0x3f60('0x27')](_0x3f60('0x19e'),_0x8a7ac3[_0x3f60('0x1a')]));this[_0x3f60('0x19f')][_0x3f60('0xa2')](this,_0x442752,_0xc9bef4);return this[_0x3f60('0xf')][_0x3f60('0xa4')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x3f60('0x15')][_0x3f60('0x1a0')]=function(_0x33f6d2){logger['info'](util['format'](_0x3f60('0x1a1'),_0x33f6d2[_0x3f60('0xb1')]));return this['channel'][_0x3f60('0xa4')](_0x3f60('0x1a2'));};AGIVertices[_0x3f60('0x15')][_0x3f60('0x1a3')]=function(_0x235afc){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x1a4'),_0x235afc[_0x3f60('0xb1')]));if(!this[_0x3f60('0xa0')](_0x235afc[_0x3f60('0x1a5')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0x1a6'));}var _0x1f2c47=this[_0x3f60('0x32')]['sync'](this,_0x235afc[_0x3f60('0x1a5')]);if(!_0x1f2c47){return this['channel'][_0x3f60('0x29')](_0x235afc,_0x3f60('0x1a7'));}var _0x5b6e7c={'body':_0x235afc[_0x3f60('0x1a8')],'phone':_0x235afc['to']||'','SmsAccountId':_0x1f2c47['id']};logger['debug'](_0x3f60('0x1a9'),JSON[_0x3f60('0x6d')](_0x5b6e7c));this[_0x3f60('0x34')]['sync'](this,_0x235afc,_0x235afc[_0x3f60('0x1a5')]);this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x1f2c47[_0x3f60('0x1a')]));this['createSmsMessage'][_0x3f60('0xa2')](this,_0x5b6e7c);return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0x1aa'));};AGIVertices[_0x3f60('0x15')]['set']=function(_0x50a2c){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x1ab'),_0x50a2c['label']));if(!this['isConfigured'](_0x50a2c[_0x3f60('0xd7')])){return this['channel'][_0x3f60('0x29')](_0x50a2c,_0x3f60('0x1ac'));}var _0x1b8c79=this[_0x3f60('0x11')][_0x3f60('0xa2')](this,_0x50a2c[_0x3f60('0xd7')]);if(!_0x1b8c79){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x50a2c,_0x3f60('0x164'));}return this[_0x3f60('0xf')][_0x3f60('0x9f')](_0x1b8c79,_0x50a2c[_0x3f60('0x1ad')]);};AGIVertices['prototype'][_0x3f60('0x1ae')]=function(_0x51b244){logger[_0x3f60('0x2b')](util['format'](_0x3f60('0x1af'),_0x51b244[_0x3f60('0xb1')]));this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0x1b0'));if(_0x51b244[_0x3f60('0xb3')]===_0x3f60('0x1b1')){this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0x1b2'));return this[_0x3f60('0xf')][_0x3f60('0xb3')]();}return this[_0x3f60('0xf')]['noop'](_0x3f60('0x1b3'));};AGIVertices[_0x3f60('0x15')]['subproject']=function(_0xd1f737){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x1b4'),_0xd1f737[_0x3f60('0xb1')]));if(!this['isConfigured'](_0xd1f737['project_id'])){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0xd1f737,_0x3f60('0x1b5'));}var _0x49ef5c=this[_0x3f60('0x18')][_0x3f60('0xa2')](this,_0xd1f737['project_id']);if(!this[_0x3f60('0xa0')](_0x49ef5c)){return this[_0x3f60('0xf')]['error'](_0xd1f737,util[_0x3f60('0x27')](_0x3f60('0x1b6'),_0xd1f737[_0x3f60('0x1b7')]));}if(_0x49ef5c===this[_0x3f60('0xf')][_0x3f60('0x36')]){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0xd1f737,_0x3f60('0x1b8'));}this['createSquareDetailsReport'][_0x3f60('0xa2')](this,_0xd1f737,_0x49ef5c);var _0xf1d2a9=this[_0x3f60('0xf')][_0x3f60('0x53')](_0x3f60('0x1b9'),util[_0x3f60('0x27')](_0x3f60('0x1ba'),config['agi']['host']||_0x3f60('0x1bb'),_0x49ef5c,this[_0x3f60('0xf')][_0x3f60('0x36')]));if(_0xf1d2a9['result']===-0x1){return _0xf1d2a9;}return this[_0x3f60('0xf')][_0x3f60('0xa4')](util['format']('Executed\x20command\x20%s\x20%s',_0x3f60('0x1b9'),_0x49ef5c));};AGIVertices[_0x3f60('0x15')][_0x3f60('0x1bc')]=function(_0x27075c){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x27075c[_0x3f60('0xb1')]));var _0x2bd819=this[_0x3f60('0x52')][_0x3f60('0xa2')](this,_0x27075c[_0x3f60('0xb2')]);this['createSquareDetailsReport'][_0x3f60('0xa2')](this,_0x27075c,_0x27075c[_0x3f60('0xb2')]);if(this[_0x3f60('0xa0')](_0x27075c[_0x3f60('0xd7')])){var _0x3f4be2=this[_0x3f60('0x11')]['sync'](this,_0x27075c['variable_id']);if(_0x3f4be2){this[_0x3f60('0xf')]['setVariable'](_0x3f4be2,_0x2bd819);return this[_0x3f60('0xf')]['noop'](util['format'](_0x3f60('0x1bd'),_0x27075c[_0x3f60('0xb2')],_0x3f4be2));}}return this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x1be'),_0x27075c['command']));};AGIVertices[_0x3f60('0x15')][_0x3f60('0x1bf')]=function(_0x43598d){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x1c0'),_0x43598d[_0x3f60('0xb1')]));_0x43598d[_0x3f60('0x5c')]=_0x43598d[_0x3f60('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x43598d[_0x3f60('0x55')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0x1c1'));}if(!this['isConfigured'](_0x43598d[_0x3f60('0x5c')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0xa5'));}this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x43598d['text']));var _0xb340a9=this['googleCloudTTS'][_0x3f60('0xa2')](this,_0x43598d);if(_0xb340a9){this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x1c2'),_0xb340a9));var _0x533d0e=this[_0x3f60('0xf')][_0x3f60('0x102')](_0xb340a9);try{fs['unlink'](_0xb340a9+'.wav');}catch(_0x1d6c7a){logger[_0x3f60('0x29')](_0x1d6c7a);}return _0x533d0e;}return this['channel']['error'](_0x43598d,_0x3f60('0x1c3'));};AGIVertices[_0x3f60('0x15')][_0x3f60('0x1c4')]=function(_0x35e775){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x1c5'),_0x35e775[_0x3f60('0xb1')]));_0x35e775[_0x3f60('0x5c')]=_0x35e775['text'][_0x3f60('0xd5')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3f60('0xa0')](_0x35e775[_0x3f60('0x5c')])){return this[_0x3f60('0xf')][_0x3f60('0xa4')](_0x3f60('0xa5'));}this[_0x3f60('0xf')]['noop'](util['format'](_0x3f60('0x1c6'),_0x35e775[_0x3f60('0x5c')]));var _0x4aca67=this[_0x3f60('0x5b')][_0x3f60('0xa2')](this,_0x35e775);if(_0x4aca67){this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x1c7'),_0x4aca67));var _0x2055c7=this[_0x3f60('0xf')][_0x3f60('0x102')](_0x4aca67);try{fs['unlink'](_0x4aca67+'.wav');}catch(_0x3f32d7){logger[_0x3f60('0x29')](_0x3f32d7);}return _0x2055c7;}return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x35e775,_0x3f60('0x1c8'));};AGIVertices['prototype'][_0x3f60('0x1c9')]=function(_0x589b97){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x589b97[_0x3f60('0xb1')]));if(!this['isConfigured'](_0x589b97[_0x3f60('0x158')])){return this[_0x3f60('0xf')][_0x3f60('0x29')](_0x589b97,_0x3f60('0x159'));}logger[_0x3f60('0x2b')](util[_0x3f60('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3f60('0xf')][_0x3f60('0x4b')],_0x589b97[_0x3f60('0x158')]));var _0x230455=this[_0x3f60('0x4c')]['sync'](this,_0x589b97[_0x3f60('0x158')]);if(_0x230455){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3f60('0xf')][_0x3f60('0x4b')],_0x589b97[_0x3f60('0x158')]));this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x3f60('0x4b')],_0x589b97['findBy']));return{'code':0xc8,'result':_0x3f60('0x1ca')};}else{logger['info'](util[_0x3f60('0x27')](_0x3f60('0x15c'),this[_0x3f60('0xf')][_0x3f60('0x4b')],_0x589b97[_0x3f60('0x158')]));this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')](_0x3f60('0x15c'),this[_0x3f60('0xf')][_0x3f60('0x4b')],_0x589b97['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['voicemail']=function(_0x13bce1){logger[_0x3f60('0x2b')](util[_0x3f60('0x27')](_0x3f60('0x1cb'),_0x13bce1[_0x3f60('0xb1')]));var _0x357487=this[_0x3f60('0xf')][_0x3f60('0x53')]('VOICEMAIL',[_0x13bce1[_0x3f60('0x1cc')],_0x13bce1[_0x3f60('0x73')]]);if(_0x357487['result']===-0x1){return _0x357487;}return this[_0x3f60('0xf')][_0x3f60('0xa4')](util[_0x3f60('0x27')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x13bce1['mailbox']));};AGIVertices['prototype'][_0x3f60('0x1cd')]=function(_0x2e1402){logger['info'](util['format'](_0x3f60('0x1ce'),_0x2e1402[_0x3f60('0xb1')]));if(!this[_0x3f60('0xa0')](_0x2e1402[_0x3f60('0xd7')])){return this['channel']['error'](_0x2e1402,_0x3f60('0x1ac'));}var _0x35e387=this[_0x3f60('0x11')][_0x3f60('0xa2')](this,_0x2e1402[_0x3f60('0xd7')]);if(!_0x35e387){return this[_0x3f60('0xf')]['error'](_0x2e1402,'no\x20variable\x20found');}var _0x8aa715=this[_0x3f60('0xf')][_0x3f60('0x11')](_0x35e387);return{'code':0xc8,'result':_0x8aa715[_0x3f60('0x9c')]?_0x8aa715[_0x3f60('0x9c')]:'-'};};String[_0x3f60('0x15')][_0x3f60('0x9b')]=function(_0x264dd2,_0x242ee8){return this['split'](_0x264dd2)[_0x3f60('0x1cf')](_0x242ee8);};module[_0x3f60('0x1d0')]=AGIVertices; \ No newline at end of file +var _0x6da1=['getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','getVoiceQueue','getVoiceQueueById','name','catch','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getSoundPath','save_name','sendMailMessage','getIntervals','getIntervalById','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','callerid','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','LOCAL','agentLogin','shellCommand','trim','replace','googleCloudTTS','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','text','google_tts_language','method','timeout','number','includes','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','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','Dialogflow\x20Result\x20%s','speech','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','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','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','no\x20key\x20configured','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','%s/recordings/%s','NOBEEP','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','wav','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','%s_STATUS_MESSAGE','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','service','host','port','secure','authentication','user','pass','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','randomstring','mustache','request-promise','agi','../../config/environment','./scripts','rawBody','menu','getdigits'];(function(_0x10319c,_0x511e1d){var _0x4a808b=function(_0x510463){while(--_0x510463){_0x10319c['push'](_0x10319c['shift']());}};_0x4a808b(++_0x511e1d);}(_0x6da1,0x1b8));var _0x16da=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x6da1[_0x16d10f];return _0x50c823;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x16da('0x0'));var _=require('lodash');var sh=require(_0x16da('0x1'));var odbc=require(_0x16da('0x2'))();var rs=require(_0x16da('0x3'));var moment=require('moment');var Mustache=require(_0x16da('0x4'));var rp=require(_0x16da('0x5'));var logger=require('../../config/logger')(_0x16da('0x6'));var config=require(_0x16da('0x7'));var scripts=require(_0x16da('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x16da('0x9')];var verticesWithRetry=[_0x16da('0xa'),_0x16da('0xb'),_0x16da('0xc')];var AGIVertices=function(_0x48f27e,_0x9d5f42,_0x495f89){this[_0x16da('0xd')]=_0x48f27e;this[_0x16da('0xe')]=_0x9d5f42;this[_0x16da('0xf')]=_0x495f89;};AGIVertices[_0x16da('0x10')][_0x16da('0x11')]=function(_0x94742e,_0x44445b){this[_0x16da('0xe')][_0x16da('0x12')](_0x94742e)[_0x16da('0x13')](function(_0x7c6e17){_0x44445b(null,_0x7c6e17?_0x7c6e17['name']:![]);})['catch'](function(_0x51face){_0x44445b(_0x51face);});};AGIVertices[_0x16da('0x10')][_0x16da('0x14')]=function(_0x1225ff,_0x484b63){this[_0x16da('0xe')][_0x16da('0x15')](_0x1225ff)[_0x16da('0x13')](function(_0x542d91){_0x484b63(null,_0x542d91?_0x542d91[_0x16da('0x16')]:![]);})[_0x16da('0x17')](function(_0x469178){_0x484b63(_0x469178);});};AGIVertices[_0x16da('0x10')]['getSquareProject']=function(_0x24aad9,_0x30e761){this[_0x16da('0xe')][_0x16da('0x18')](_0x24aad9)[_0x16da('0x13')](function(_0x2f1170){_0x30e761(null,_0x2f1170?_0x2f1170[_0x16da('0x16')]:![]);})[_0x16da('0x17')](function(_0x2652c4){_0x30e761(_0x2652c4);});};AGIVertices[_0x16da('0x10')][_0x16da('0x19')]=function(_0x3f463b,_0x5f3035){this[_0x16da('0xe')][_0x16da('0x1a')](_0x3f463b)[_0x16da('0x13')](function(_0x931671){_0x5f3035(null,_0x931671?_0x931671[_0x16da('0x1b')]:![]);})[_0x16da('0x17')](function(_0x5a00c2){_0x5f3035(_0x5a00c2);});};AGIVertices['prototype'][_0x16da('0x1c')]=function(_0x2bd7e2,_0x2d606e){this['rpc'][_0x16da('0x1d')](_0x2bd7e2)[_0x16da('0x13')](function(_0x3b4f93){_0x2d606e(null,_0x3b4f93?_0x3b4f93[_0x16da('0x16')]:![]);})[_0x16da('0x17')](function(_0xae2a6e){_0x2d606e(_0xae2a6e);});};AGIVertices[_0x16da('0x10')]['getTrunk']=function(_0x4a5a6c,_0x5a81){this[_0x16da('0xe')]['getTrunkById'](_0x4a5a6c)[_0x16da('0x13')](function(_0x2d34db){_0x5a81(null,_0x2d34db?_0x2d34db[_0x16da('0x16')]:![]);})['catch'](function(_0x396652){_0x5a81(_0x396652);});};AGIVertices['prototype']['getSound']=function(_0x896e3e,_0x22f1d8){var _0x565774=this;this[_0x16da('0xe')]['getSoundById'](_0x896e3e)['then'](function(_0x52683f){_0x22f1d8(null,_0x52683f?_0x565774[_0x16da('0x1e')](_0x52683f[_0x16da('0x1f')]):![]);})[_0x16da('0x17')](function(_0x5a04e2){_0x22f1d8(_0x5a04e2);});};AGIVertices[_0x16da('0x10')]['getMailAccount']=function(_0x35a3f3,_0x4ef0a2){this[_0x16da('0xe')]['getMailAccountById'](_0x35a3f3)['then'](function(_0x5b1bbf){_0x4ef0a2(null,_0x5b1bbf?_0x5b1bbf:![]);})[_0x16da('0x17')](function(_0x33a7ce){_0x4ef0a2(_0x33a7ce);});};AGIVertices[_0x16da('0x10')]['sendMailMessage']=function(_0x185340,_0x2a8387,_0x25faed){this[_0x16da('0xf')][_0x16da('0x20')](_0x185340,_0x2a8387)[_0x16da('0x13')](function(){_0x25faed(null);})[_0x16da('0x17')](function(_0x5c4e92){_0x25faed(_0x5c4e92);});};AGIVertices[_0x16da('0x10')][_0x16da('0x21')]=function(_0xf34417,_0x238460){this[_0x16da('0xe')][_0x16da('0x22')](_0xf34417)[_0x16da('0x13')](function(_0xb1b90c){if(_0xb1b90c){if(_0xb1b90c['IntervalId']){_0x238460(null,[_0xb1b90c[_0x16da('0x23')]]);}else{_0x238460(null,_['map'](_0xb1b90c[_0x16da('0x24')],'interval'));}}else{_0x238460(null,![]);}})['catch'](function(_0x283fea){_0x238460(_0x283fea);});};AGIVertices[_0x16da('0x10')][_0x16da('0x1e')]=function(_0x331460){return util[_0x16da('0x25')](_0x16da('0x26'),FILES_PATH,_0x331460);};AGIVertices[_0x16da('0x10')][_0x16da('0x27')]=function(_0x3fdd14,_0x51e990,_0x44a75e){odbc[_0x16da('0x28')](_0x3fdd14,function(_0x353648){if(_0x353648){logger[_0x16da('0x29')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x353648);_0x44a75e(_0x353648);}else{logger[_0x16da('0x2a')](_0x16da('0x2b'));odbc[_0x16da('0x2c')](_0x51e990,function(_0x2abb81,_0x13de7c){if(_0x2abb81){logger['info'](_0x16da('0x2d'),_0x51e990);_0x44a75e(_0x2abb81);}else{logger[_0x16da('0x2a')](_0x16da('0x2e'),_0x51e990);odbc[_0x16da('0x2f')](function(_0x1b5688){if(_0x1b5688){logger[_0x16da('0x29')](_0x16da('0x30'),_0x1b5688);}_0x44a75e(null,_0x13de7c);});}});}});};AGIVertices[_0x16da('0x10')][_0x16da('0x31')]=function(_0x1c54ec,_0x4b6537){this[_0x16da('0xe')]['getSmsAccountById'](_0x1c54ec)[_0x16da('0x13')](function(_0x5c4d2d){_0x4b6537(null,_0x5c4d2d?_0x5c4d2d:![]);})[_0x16da('0x17')](function(_0x4fa96f){_0x4b6537(_0x4fa96f);});};AGIVertices[_0x16da('0x10')][_0x16da('0x32')]=function(_0x54fe14,_0x4b5858){this[_0x16da('0xe')]['createSmsMessage'](_0x54fe14)[_0x16da('0x13')](function(_0x42ddda){_0x4b5858(null,_0x42ddda);})['catch'](function(_0x236440){_0x4b5858(_0x236440);});};AGIVertices[_0x16da('0x10')][_0x16da('0x33')]=function(_0x1f8e50,_0x1d0ed4,_0x406a74){this[_0x16da('0xe')][_0x16da('0x33')]({'uniqueid':this[_0x16da('0xd')][_0x16da('0x34')],'node':_0x1f8e50[_0x16da('0x35')],'application':_0x1f8e50['agicommand'],'data':_0x1d0ed4||null,'project_name':this[_0x16da('0xd')][_0x16da('0x36')],'callerid':this['channel']['callerid']})[_0x16da('0x13')](function(_0x22b28d){if(_0x406a74){_0x406a74(null,_0x22b28d);}})[_0x16da('0x17')](function(_0x1b0877){if(_0x406a74){_0x406a74(_0x1b0877);}});};AGIVertices[_0x16da('0x10')]['createSquareRecording']=function(_0x4dbe3a,_0x31d9df,_0x4b4fbe,_0x2ad874){this[_0x16da('0xe')][_0x16da('0x37')]({'uniqueid':this[_0x16da('0xd')]['uniqueid'],'callerid':this[_0x16da('0xd')][_0x16da('0x38')],'calleridname':this['channel']['calleridname'],'context':this[_0x16da('0xd')][_0x16da('0x39')],'extension':this[_0x16da('0xd')][_0x16da('0x3a')],'priority':this[_0x16da('0xd')][_0x16da('0x3b')],'accountcode':this[_0x16da('0xd')][_0x16da('0x3c')],'dnid':this[_0x16da('0xd')][_0x16da('0x3d')],'projectName':this['channel'][_0x16da('0x36')],'saveName':_0x31d9df,'filename':_0x4dbe3a[_0x16da('0x3e')]||_0x31d9df,'savePath':_0x4b4fbe})[_0x16da('0x13')](function(_0x12b6db){_0x2ad874(null,_0x12b6db);})[_0x16da('0x17')](function(_0x159e7f){_0x2ad874(_0x159e7f);});};AGIVertices['prototype']['createSquareMessage']=function(_0x712f39,_0x128561,_0x1e2fd3,_0x2a25ab,_0x2aa1d8){this[_0x16da('0xe')][_0x16da('0x3f')]({'uniqueid':this['channel'][_0x16da('0x34')],'body':_0x712f39,'direction':_0x128561,'providerName':_0x1e2fd3,'providerResponse':_0x2a25ab})[_0x16da('0x13')](function(_0x3e2595){if(_0x2aa1d8){_0x2aa1d8(null,_0x3e2595);}})[_0x16da('0x17')](function(_0x406f6e){if(_0x2aa1d8){_0x2aa1d8(_0x406f6e);}});};AGIVertices['prototype'][_0x16da('0x40')]=function(_0x19ba7a,_0x49e9c1){this[_0x16da('0xe')][_0x16da('0x40')]({'firstName':_[_0x16da('0x41')](_0x19ba7a[_0x16da('0x16')])||_[_0x16da('0x42')](_0x19ba7a[_0x16da('0x16')])?_0x16da('0x43')+Math['random']():_0x19ba7a[_0x16da('0x16')],'lastName':_[_0x16da('0x41')](_0x19ba7a[_0x16da('0x44')])||_[_0x16da('0x42')](_0x19ba7a['lastName'])?null:_0x19ba7a[_0x16da('0x44')],'phone':_0x19ba7a[_0x16da('0x45')],'ListId':_0x19ba7a['list_id'],'scheduledat':_0x19ba7a[_0x16da('0x46')],'callbackUniqueid':this[_0x16da('0xd')]['uniqueid'],'tags':_0x16da('0x47'),'description':_0x16da('0x48')+_0x19ba7a[_0x16da('0x46')][_0x16da('0x49')](),'priority':_0x19ba7a[_0x16da('0x4a')]})['then'](function(_0x12aade){_0x49e9c1(null,_0x12aade);})['catch'](function(_0xc5958){_0x49e9c1(_0xc5958);});};AGIVertices[_0x16da('0x10')][_0x16da('0x4b')]=function(_0x494474,_0x4da080){this['rpc'][_0x16da('0x4c')](_0x494474)[_0x16da('0x13')](function(_0xab3e5b){_0x4da080(null,_0xab3e5b?_0xab3e5b['name']:![]);})['catch'](function(_0x4d42d1){_0x4da080(_0x4d42d1);});};AGIVertices['prototype'][_0x16da('0x4d')]=function(_0x26fd84,_0x15c062,_0x5e9e91){var _0x2f3c12={'role':_0x16da('0x4e')};_0x2f3c12[_0x26fd84]=this[_0x16da('0xd')][_0x16da('0x38')];this[_0x16da('0xe')]['agentPause'](_0x2f3c12,_0x15c062,this[_0x16da('0xd')][_0x16da('0x34')])[_0x16da('0x13')](function(_0x20126f){_0x5e9e91(null,_['isNil'](_0x20126f)?![]:!![]);})[_0x16da('0x17')](function(_0x514c46){logger[_0x16da('0x29')](_0x514c46);_0x5e9e91(null,![]);});};AGIVertices[_0x16da('0x10')][_0x16da('0x4f')]=function(_0x446f39,_0x348eda){var _0x22d913={'role':_0x16da('0x4e')};_0x22d913[_0x446f39]=this[_0x16da('0xd')][_0x16da('0x38')];this[_0x16da('0xe')]['agentUnpause'](_0x22d913)[_0x16da('0x13')](function(_0x19214){_0x348eda(null,_['isNil'](_0x19214)?![]:!![]);})[_0x16da('0x17')](function(_0x5e3525){logger[_0x16da('0x29')](_0x5e3525);_0x348eda(null,![]);});};AGIVertices[_0x16da('0x10')][_0x16da('0x50')]=function(_0x47625f,_0x4295f0){var _0x14dc95={'role':_0x16da('0x4e')};_0x14dc95[_0x47625f]=this[_0x16da('0xd')][_0x16da('0x38')];this[_0x16da('0xe')]['agentLogout'](_0x14dc95)['then'](function(_0x2aef0f){_0x4295f0(null,_['isNil'](_0x2aef0f)?![]:!![]);})['catch'](function(_0x16e31f){logger['error'](_0x16e31f);_0x4295f0(null,![]);});};AGIVertices[_0x16da('0x10')]['agentLogin']=function(_0x5cbb00,_0x14bad8){var _0x47cda8={'role':_0x16da('0x4e')};_0x47cda8[_0x5cbb00]=this[_0x16da('0xd')][_0x16da('0x38')];var _0x11956a=_0x5cbb00!=_0x16da('0x51')?util[_0x16da('0x25')]('%s/%s@from-sip/n',_0x16da('0x52'),this[_0x16da('0xd')]['callerid']):undefined;this[_0x16da('0xe')][_0x16da('0x53')](_0x47cda8,_0x11956a)[_0x16da('0x13')](function(_0x3da530){_0x14bad8(null,_[_0x16da('0x42')](_0x3da530)?![]:!![]);})['catch'](function(_0x4cc554){logger[_0x16da('0x29')](_0x4cc554);_0x14bad8(null,![]);});};AGIVertices['prototype'][_0x16da('0x54')]=function(_0x296740,_0x1d4e24){sh['exec'](_[_0x16da('0x55')](_0x296740),function(_0x125130,_0x44f11e){var _0x181b33=_0x44f11e[_0x16da('0x56')](/(\r\n|\n|\r)/gm,'');_0x1d4e24(null,_0x181b33);});};AGIVertices[_0x16da('0x10')]['googleCloudTTS']=function(_0x4fd071,_0x55afc9){scripts[_0x16da('0x57')](_0x4fd071['apiKey'],_0x4fd071['google_cloud_tts_text_type']||'text',_0x4fd071['text'],_0x4fd071['languageCode']||_0x16da('0x58'),_0x4fd071[_0x16da('0x59')]||_0x16da('0x5a'),_0x4fd071[_0x16da('0x5b')]||_0x16da('0x5c'))['then'](function(_0x4d1425){_0x55afc9(null,_0x4d1425);})[_0x16da('0x17')](function(_0x121d4d){_0x55afc9(_0x121d4d);});};AGIVertices[_0x16da('0x10')][_0x16da('0x5d')]=function(_0x39b706,_0x643aff){scripts[_0x16da('0x5d')](_0x39b706[_0x16da('0x5e')],_0x39b706[_0x16da('0x5f')]||'en',0x1)[_0x16da('0x13')](function(_0x3cfd2b){_0x643aff(null,_0x3cfd2b);})[_0x16da('0x17')](function(_0x42ad47){_0x643aff(_0x42ad47);});};AGIVertices[_0x16da('0x10')]['restAPI']=function(_0xfa5a9f,_0x4de737){var _0x18f137={'uri':_0xfa5a9f['url'],'method':_0xfa5a9f[_0x16da('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xfa5a9f[_0x16da('0x61')])===_0x16da('0x62')&&parseInt(_0xfa5a9f[_0x16da('0x61')])>=0x1?parseInt(_0xfa5a9f['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x16da('0x63')](['POST','PUT'],_0x18f137[_0x16da('0x60')][_0x16da('0x64')]())){try{_0x18f137[_0x16da('0x65')]=_0xfa5a9f['rawBody']?JSON[_0x16da('0x66')](_0xfa5a9f[_0x16da('0x9')]):{};}catch(_0x20dca9){logger[_0x16da('0x29')](_0x16da('0x67'),_0x20dca9);}}try{_0x18f137[_0x16da('0x68')]=_0xfa5a9f[_0x16da('0x69')]?JSON[_0x16da('0x66')](_0xfa5a9f[_0x16da('0x69')]):{};}catch(_0x418bb6){logger[_0x16da('0x29')](_0x16da('0x6a'),_0x418bb6);}if(_0xfa5a9f[_0x16da('0x6b')]){try{var _0x4843f6=require(_0xfa5a9f[_0x16da('0x6b')])[_0x16da('0x6c')](this,_0x18f137);_0x18f137[_0x16da('0x6d')]=Mustache[_0x16da('0x6e')](_0xfa5a9f[_0x16da('0x6f')],_0x4843f6,{},['$$','$$']);if(_0x18f137[_0x16da('0x68')]){_0x18f137[_0x16da('0x68')]=JSON[_0x16da('0x66')](Mustache['render'](JSON[_0x16da('0x70')](_0x18f137[_0x16da('0x68')]),_0x4843f6,{},['$$','$$']));}if(_0x18f137[_0x16da('0x65')]){_0x18f137[_0x16da('0x65')]=JSON['parse'](Mustache['render'](JSON[_0x16da('0x70')](_0x18f137[_0x16da('0x65')]),_0x4843f6,{},['$$','$$']));}}catch(_0x1ed6c7){logger[_0x16da('0x29')](_0x16da('0x71'),_0x1ed6c7);}}rp(_0x18f137)[_0x16da('0x13')](function(_0x42b4ba){var _0x1e93c2={'statusCode':_0x42b4ba['statusCode']||0xc8,'statusMessage':_0x42b4ba[_0x16da('0x72')]||'OK','headers':_0x42b4ba[_0x16da('0x68')]||{},'body':_0x42b4ba['body']||{}};_0x4de737(null,_0x1e93c2);})[_0x16da('0x17')](function(_0x109aab){var _0x2fef02={'statusCode':_0x109aab['statusCode']||0x1f4,'statusMessage':_0x109aab[_0x16da('0x73')]||_0x16da('0x74'),'headers':_0x109aab[_0x16da('0x75')][_0x16da('0x68')]||{},'body':_0x109aab[_0x16da('0x75')][_0x16da('0x65')]||{}};_0x4de737(null,_0x2fef02);});};AGIVertices[_0x16da('0x10')][_0x16da('0x76')]=function(_0x4121aa,_0x1c830e){scripts[_0x16da('0x76')](this[_0x16da('0xd')][_0x16da('0x34')],_0x4121aa[_0x16da('0x77')],_0x4121aa[_0x16da('0x5e')],_0x4121aa[_0x16da('0x78')]||'en')[_0x16da('0x13')](function(_0x320847){_0x1c830e(null,_0x320847);})[_0x16da('0x17')](function(_0x580145){_0x1c830e(_0x580145);});};AGIVertices[_0x16da('0x10')][_0x16da('0x79')]=function(_0x469ca2,_0xc8e6af){scripts[_0x16da('0x79')](this[_0x16da('0xd')][_0x16da('0x34')],_0x469ca2['dialogflowV2_project_id'],_0x469ca2['client_email'],_0x469ca2[_0x16da('0x7a')],_0x469ca2['text'],_0x469ca2[_0x16da('0x7b')]||'en')[_0x16da('0x13')](function(_0x48d3a){_0xc8e6af(null,_0x48d3a);})[_0x16da('0x17')](function(_0x4e4b97){_0xc8e6af(_0x4e4b97);});};AGIVertices['prototype'][_0x16da('0x7c')]=function(_0x4599b6,_0x4c33cc){scripts[_0x16da('0x7c')](this[_0x16da('0xd')],_0x4599b6)[_0x16da('0x13')](function(_0x180ac0){_0x4c33cc(null,_0x180ac0);})[_0x16da('0x17')](function(_0x26e855){_0x4c33cc(_0x26e855);});};AGIVertices[_0x16da('0x10')]['ispeechTTS']=function(_0x56b7e2,_0x4369cd){scripts[_0x16da('0x7d')](_0x56b7e2[_0x16da('0x77')],_0x56b7e2[_0x16da('0x5e')],_0x56b7e2[_0x16da('0x7e')]||'en-US',_0x56b7e2[_0x16da('0x7f')])['then'](function(_0x1786ae){_0x4369cd(null,_0x1786ae);})[_0x16da('0x17')](function(_0x3159b8){_0x4369cd(_0x3159b8);});};AGIVertices[_0x16da('0x10')]['ispeechASR']=function(_0x930a0f,_0x46ad2b,_0x438adb){scripts[_0x16da('0x80')](_0x46ad2b,_0x930a0f[_0x16da('0x77')],_0x930a0f['ispeech_asr_language']||_0x16da('0x58'),this['isConfigured'](_0x930a0f[_0x16da('0x81')])?_0x930a0f[_0x16da('0x81')]:undefined)[_0x16da('0x13')](function(_0x50902a){_0x438adb(null,_0x50902a);})[_0x16da('0x17')](function(_0x375cd6){_0x438adb(_0x375cd6);});};AGIVertices[_0x16da('0x10')][_0x16da('0x82')]=function(_0x4b696f,_0x5c8033){scripts[_0x16da('0x82')](_0x4b696f['aws_access_key_id'],_0x4b696f[_0x16da('0x83')],_0x4b696f[_0x16da('0x84')],_0x4b696f[_0x16da('0x85')]||'Amy',_0x4b696f['text'],_0x4b696f['aws_text_type']||_0x16da('0x5e'))[_0x16da('0x13')](function(_0x526d1b){_0x5c8033(null,_0x526d1b);})['catch'](function(_0x537c93){_0x5c8033(_0x537c93);});};AGIVertices['prototype']['awsLex']=function(_0x928c28,_0x4259d4){scripts[_0x16da('0x86')](this[_0x16da('0xd')][_0x16da('0x34')],_0x928c28[_0x16da('0x87')],_0x928c28[_0x16da('0x83')],_0x928c28[_0x16da('0x88')],_0x928c28[_0x16da('0x5e')],_0x928c28[_0x16da('0x89')])['then'](function(_0x191ff0){_0x4259d4(null,_0x191ff0);})[_0x16da('0x17')](function(_0x1bf0fd){_0x4259d4(_0x1bf0fd);});};AGIVertices[_0x16da('0x10')][_0x16da('0x8a')]=function(_0x367473,_0x224716,_0x1f0beb){scripts[_0x16da('0x8a')](_0x224716,_0x367473[_0x16da('0x77')],_0x367473[_0x16da('0x8b')]||'en-US')[_0x16da('0x13')](function(_0x39abe5){_0x1f0beb(null,_0x39abe5);})[_0x16da('0x17')](function(_0x5069ae){_0x1f0beb(_0x5069ae);});};AGIVertices['prototype'][_0x16da('0x8c')]=function(_0x42e140,_0x389982,_0x27b759){scripts[_0x16da('0x8c')](_0x389982,_0x42e140[_0x16da('0x8d')],_0x42e140[_0x16da('0x8e')],_0x42e140['uri'])[_0x16da('0x13')](function(_0x234633){_0x27b759(null,_0x234633);})[_0x16da('0x17')](function(_0x101b86){_0x27b759(_0x101b86);});};AGIVertices[_0x16da('0x10')]['clear']=function(_0x1209e8){var _0x417551=_['includes'](verticesWithRetry,_0x1209e8['agicommand'])?_0x1209e8:_[_0x16da('0x8f')](_0x1209e8);for(var _0x273a99 in _0x417551){if(_0x417551[_0x16da('0x90')](_0x273a99)){if(_0x417551[_0x273a99]&&_[_0x16da('0x91')](_0x417551[_0x273a99])){if(_[_0x16da('0x63')](recursiveMapAttributes,_0x273a99)){_0x417551[_0x273a99]=this[_0x16da('0x92')](_0x417551[_0x273a99]);}else{_0x417551[_0x273a99]=this[_0x16da('0x93')](_0x417551[_0x273a99]);}}}}return _0x417551;};AGIVertices[_0x16da('0x10')][_0x16da('0x94')]=function(_0x5a6a19){for(var _0x5c4658 in _0x5a6a19){if(_0x5a6a19[_0x16da('0x90')](_0x5c4658)){if(_[_0x16da('0x95')](_0x5a6a19[_0x5c4658])){this['recursiveNodeIndex'](_0x5a6a19[_0x5c4658]);}else if(_[_0x16da('0x96')](_0x5a6a19[_0x5c4658])){for(var _0x3f3e83=0x0;_0x3f3e83<_0x5a6a19[_0x5c4658][_0x16da('0x97')];_0x3f3e83++){this[_0x16da('0x94')](_0x5a6a19[_0x5c4658][_0x3f3e83]);}}else if(_[_0x16da('0x91')](_0x5a6a19[_0x5c4658])){_0x5a6a19[_0x5c4658]=this[_0x16da('0x93')](_0x5a6a19[_0x5c4658]);}}}};AGIVertices['prototype'][_0x16da('0x98')]=function(_0x10d9d2,_0x933f16){for(var _0x2ff3ff in _0x10d9d2){if(_0x10d9d2[_0x16da('0x90')](_0x2ff3ff)){if(_[_0x16da('0x95')](_0x10d9d2[_0x2ff3ff])){if(!_[_0x16da('0x41')](_0x10d9d2[_0x2ff3ff])){this[_0x16da('0x98')](_0x10d9d2[_0x2ff3ff],util[_0x16da('0x25')](_0x16da('0x99'),_0x933f16,_0x2ff3ff));}}else if(_[_0x16da('0x96')](_0x10d9d2[_0x2ff3ff])){for(var _0x18de0d=0x0;_0x18de0d<_0x10d9d2[_0x2ff3ff]['length'];_0x18de0d++){this['saveRestApiResult'](_0x10d9d2[_0x2ff3ff][_0x18de0d],util['format']('%s.%s',_0x933f16,_0x2ff3ff+'['+_0x18de0d+']'));}}else{if(!_[_0x16da('0x42')](_0x10d9d2[_0x2ff3ff])){this[_0x16da('0xd')][_0x16da('0x9a')](util[_0x16da('0x25')](_0x16da('0x99'),_0x933f16,_0x2ff3ff),_0x10d9d2[_0x2ff3ff]);}}}}};AGIVertices['prototype'][_0x16da('0x92')]=function(_0x43b77b){try{var _0x2224e5=JSON[_0x16da('0x66')](_0x43b77b);this['recursiveNodeIndex'](_0x2224e5);return JSON['stringify'](_0x2224e5);}catch(_0x626434){return this[_0x16da('0x93')](_0x43b77b);}};AGIVertices[_0x16da('0x10')][_0x16da('0x93')]=function(_0x4d1af8){var _0x2cdb13=_0x4d1af8['split']('{');for(var _0x3f2641=0x1;_0x3f2641<_0x2cdb13[_0x16da('0x97')];_0x3f2641+=0x1){var _0xdabf63=_0x2cdb13[_0x3f2641][_0x16da('0x9b')]('}');if(_0xdabf63[_0x16da('0x97')]>0x1){_0x4d1af8=_0x4d1af8['replaceAll']('{'+_0xdabf63[0x0]+'}',this[_0x16da('0xd')][_0x16da('0x11')](_0xdabf63[0x0])[_0x16da('0x9c')]||_0xdabf63[0x0]);}}if(_0x2cdb13[_0x16da('0x97')]===0x1){return _0x4d1af8[_0x16da('0x49')]();}return this['replaceAllVariables'](_0x4d1af8);};AGIVertices[_0x16da('0x10')][_0x16da('0x9d')]=function(_0x3cf028,_0x289d89){var _0x31cda8=this['channel'][_0x16da('0x11')](_0x3cf028);if(_0x31cda8[_0x16da('0x9e')]===-0x1){return _0x31cda8;}logger['info'](util[_0x16da('0x25')](_0x16da('0x9f'),_0x289d89,_0x31cda8[_0x16da('0x9c')]));return this['channel'][_0x16da('0x9a')](_0x289d89,_0x31cda8[_0x16da('0x9c')]);};AGIVertices[_0x16da('0x10')][_0x16da('0xa0')]=function(_0x291cfe){return _0x291cfe&&_0x291cfe!=='0'&&_0x291cfe!=='-1'&&_0x291cfe!=='';};AGIVertices[_0x16da('0x10')][_0x16da('0xa1')]=function(_0x1d22ac){this[_0x16da('0x33')][_0x16da('0x6c')](this,_0x1d22ac,'-');_0x1d22ac[_0x16da('0xa2')]=_0x1d22ac[_0x16da('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x16da('0x10')][_0x16da('0xa3')]=function(_0xc8db47){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0xa4'),_0xc8db47['label']));if(!this[_0x16da('0xa0')](_0xc8db47[_0x16da('0x5e')])){return this[_0x16da('0xd')][_0x16da('0xa5')](_0x16da('0xa6'));}var _0x337f38='\x22'+_0xc8db47['text']+'\x22';if(this[_0x16da('0xa0')](_0xc8db47['options'])){_0x337f38+=','+_0xc8db47[_0x16da('0x75')];}var _0x56ec6d=this['channel'][_0x16da('0xa7')](_0x16da('0xa8'),_0x337f38);if(_0x56ec6d[_0x16da('0x9e')]===-0x1){return _0x56ec6d;}return this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')]('Executed\x20command\x20MRCPSynth\x20%s',_0x337f38));};AGIVertices[_0x16da('0x10')]['mrcprecog']=function(_0x42b9e0){logger['info'](util['format'](_0x16da('0xa9'),_0x42b9e0[_0x16da('0x35')]));if(!this['isConfigured'](_0x42b9e0['grammar'])){return this['channel'][_0x16da('0xa5')]('no\x20grammar\x20configured');}var _0x4647e6=_0x42b9e0[_0x16da('0xaa')];if(this[_0x16da('0xa0')](_0x42b9e0[_0x16da('0x75')])){_0x4647e6+=','+_0x42b9e0[_0x16da('0x75')];}var _0x51e802=this[_0x16da('0xd')][_0x16da('0xa7')]('MRCPRecog',_0x4647e6);if(_0x51e802[_0x16da('0x9e')]===-0x1){return _0x51e802;}var _0x5b7345=this[_0x16da('0x9d')](_0x16da('0xab'),_0x16da('0xac'));if(_0x5b7345['result']===-0x1){return _0x5b7345;}var _0x556e30=this[_0x16da('0x9d')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x556e30[_0x16da('0x9e')]===-0x1){return _0x556e30;}var _0x68936=this[_0x16da('0x9d')](_0x16da('0xad'),'MRCP_RECOG_INSTANCE');if(_0x68936[_0x16da('0x9e')]===-0x1){return _0x68936;}return this['channel']['noop'](util[_0x16da('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4647e6));};AGIVertices[_0x16da('0x10')][_0x16da('0x6')]=function(_0xe67a60){logger['info'](util[_0x16da('0x25')](_0x16da('0xae'),_0xe67a60[_0x16da('0x35')]));return this[_0x16da('0xd')][_0x16da('0x6')]([_0xe67a60[_0x16da('0xaf')],_0xe67a60[_0x16da('0xb0')]]);};AGIVertices[_0x16da('0x10')][_0x16da('0xb1')]=function(_0x49ea2b){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0xb2'),_0x49ea2b[_0x16da('0x35')]));if(this[_0x16da('0xa0')](_0x49ea2b[_0x16da('0x61')])){logger['info'](util['format'](_0x16da('0xb3'),_0x49ea2b[_0x16da('0x61')]));var _0x413fa8=this[_0x16da('0xd')][_0x16da('0xb4')](_0x49ea2b['timeout']);if(_0x413fa8['result']===-0x1){return _0x413fa8;}}return this[_0x16da('0xd')][_0x16da('0xb1')]();};AGIVertices[_0x16da('0x10')]['callback']=function(_0x72fe5f){logger['info'](util[_0x16da('0x25')](_0x16da('0xb5'),_0x72fe5f[_0x16da('0x35')]));if(!this['isConfigured'](_0x72fe5f['list_id'])){return this[_0x16da('0xd')][_0x16da('0x29')](_0x72fe5f,_0x16da('0xb6'));}_0x72fe5f[_0x16da('0x46')]=moment();if(this[_0x16da('0xa0')](_0x72fe5f[_0x16da('0xb7')])){_0x72fe5f['scheduledAt']=moment()['add'](_0x72fe5f[_0x16da('0xb7')],'minutes');}if(!this['isConfigured'](_0x72fe5f[_0x16da('0x4a')])){_0x72fe5f[_0x16da('0x4a')]=0x2;}this[_0x16da('0x40')][_0x16da('0x6c')](this,_0x72fe5f);return this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0xb8'),_0x72fe5f[_0x16da('0x45')],_0x72fe5f['list_id'],_0x72fe5f[_0x16da('0x46')]));};AGIVertices['prototype'][_0x16da('0xb9')]=function(_0x2bc757){logger[_0x16da('0x2a')](util[_0x16da('0x25')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2bc757[_0x16da('0x35')]));var _0x23ed46=this['channel'][_0x16da('0xa7')](_0x2bc757[_0x16da('0xba')],_0x2bc757[_0x16da('0x75')]);if(_0x23ed46[_0x16da('0x9e')]===-0x1){return _0x23ed46;}return this[_0x16da('0xd')]['noop'](util[_0x16da('0x25')]('Executed\x20command\x20%s\x20%s',_0x2bc757[_0x16da('0xba')],_0x2bc757[_0x16da('0x75')]));};AGIVertices[_0x16da('0x10')][_0x16da('0xbb')]=function(_0x41c4ec){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0xbc'),_0x41c4ec[_0x16da('0x35')]));if(!this['isConfigured'](_0x41c4ec[_0x16da('0x5e')])){return this['channel'][_0x16da('0xa5')](_0x16da('0xa6'));}var _0x3783f7='\x22'+_0x41c4ec[_0x16da('0x5e')]+'\x22';if(this[_0x16da('0xa0')](_0x41c4ec[_0x16da('0x75')])){_0x3783f7+=','+_0x41c4ec[_0x16da('0x75')];}var _0x5e9bfd=this[_0x16da('0xd')][_0x16da('0xa7')](_0x16da('0xa8'),_0x3783f7);if(_0x5e9bfd[_0x16da('0x9e')]===-0x1){return _0x5e9bfd;}return this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0xbd'),_0x3783f7));};AGIVertices[_0x16da('0x10')][_0x16da('0xbe')]=function(_0x3e1438){logger[_0x16da('0x2a')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3e1438[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0x3e1438[_0x16da('0x5e')])){return this[_0x16da('0xd')][_0x16da('0xa5')](_0x16da('0xa6'));}var _0x38a439='\x22'+_0x3e1438['text']+'\x22';if(this[_0x16da('0xa0')](_0x3e1438[_0x16da('0x75')])){_0x38a439+=','+_0x3e1438[_0x16da('0x75')];}var _0x1a8fea=this[_0x16da('0xd')][_0x16da('0xa7')]('MRCPSynth',_0x38a439);if(_0x1a8fea['result']===-0x1){return _0x1a8fea;}return this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0xbd'),_0x38a439));};AGIVertices[_0x16da('0x10')][_0x16da('0xbf')]=function(_0x437202){logger[_0x16da('0x2a')](util[_0x16da('0x25')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x437202['label']));if(!this['isConfigured'](_0x437202[_0x16da('0xaa')])){return this['channel'][_0x16da('0xa5')]('no\x20grammar\x20configured');}var _0x5336ba=_0x437202[_0x16da('0xaa')];if(this[_0x16da('0xa0')](_0x437202[_0x16da('0x75')])){_0x5336ba+=','+_0x437202[_0x16da('0x75')];}var _0xd93db1=this[_0x16da('0xd')][_0x16da('0xa7')]('MRCPRecog',_0x5336ba);if(_0xd93db1['result']===-0x1){return _0xd93db1;}var _0x2f82f4=this[_0x16da('0x9d')](_0x16da('0xab'),_0x16da('0xc0'));if(_0x2f82f4[_0x16da('0x9e')]===-0x1){return _0x2f82f4;}var _0x3c0a29=this[_0x16da('0x9d')](_0x16da('0xc1'),_0x16da('0xc2'));if(_0x3c0a29[_0x16da('0x9e')]===-0x1){return _0x3c0a29;}var _0x1e62a4=this['getAndSetVariable']('RECOG_INSTANCE()',_0x16da('0xc3'));if(_0x1e62a4[_0x16da('0x9e')]===-0x1){return _0x1e62a4;}return this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0xc4'),_0x5336ba));};AGIVertices[_0x16da('0x10')][_0x16da('0xc5')]=function(_0x460ca8){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0xc6'),_0x460ca8[_0x16da('0x35')]));if(!this['isConfigured'](_0x460ca8[_0x16da('0xaa')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x2badd6=_0x460ca8[_0x16da('0xaa')];if(this[_0x16da('0xa0')](_0x460ca8[_0x16da('0x75')])){_0x2badd6+=','+_0x460ca8[_0x16da('0x75')];}var _0x154583=this[_0x16da('0xd')][_0x16da('0xa7')](_0x16da('0xc7'),_0x2badd6);if(_0x154583['result']===-0x1){return _0x154583;}var _0xb0ab6f=this['getAndSetVariable'](_0x16da('0xab'),_0x16da('0xc8'));if(_0xb0ab6f[_0x16da('0x9e')]===-0x1){return _0xb0ab6f;}var _0x267c35=this['getAndSetVariable'](_0x16da('0xc1'),_0x16da('0xc9'));if(_0x267c35['result']===-0x1){return _0x267c35;}var _0x270526=this[_0x16da('0x9d')](_0x16da('0xad'),'SESTEK_ASR_INSTANCE');if(_0x270526[_0x16da('0x9e')]===-0x1){return _0x270526;}return this[_0x16da('0xd')][_0x16da('0xa5')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x2badd6));};AGIVertices['prototype']['database']=function(_0x2433a1){logger[_0x16da('0x2a')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x2433a1['label']));if(!this[_0x16da('0xa0')](_0x2433a1[_0x16da('0xca')])){return this['channel'][_0x16da('0x29')](_0x2433a1,'no\x20database\x20selected');}var _0x24f04e=this['getSquareOdbc'][_0x16da('0x6c')](this,_0x2433a1[_0x16da('0xca')]);if(!_0x24f04e){return this['channel'][_0x16da('0x29')](_0x2433a1,_0x16da('0xcb'));}if(!this['isConfigured'](_0x2433a1['query'])){return this[_0x16da('0xd')]['error'](_0x2433a1,'no\x20query\x20configured');}var _0x199f5f=_0x2433a1['query'][_0x16da('0x56')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0xcc'),_0x199f5f));var _0x11ca25=this[_0x16da('0x27')][_0x16da('0x6c')](this,_0x24f04e,_0x199f5f);this[_0x16da('0x33')]['sync'](this,_0x2433a1,_0x199f5f);if(!this[_0x16da('0xa0')](_0x2433a1[_0x16da('0xcd')])){return this[_0x16da('0xd')][_0x16da('0xa5')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2577df=this[_0x16da('0x11')][_0x16da('0x6c')](this,_0x2433a1[_0x16da('0xcd')]);if(!_0x2577df){return this['channel'][_0x16da('0x29')](_0x2433a1,_0x16da('0xce'));}var _0x2180e9=this;_0x11ca25[_0x16da('0xcf')](function(_0x51339c,_0x1cdbd8){Object[_0x16da('0xd0')](_0x51339c)['forEach'](function(_0x17574a){_0x2180e9[_0x16da('0xd')][_0x16da('0x9a')](util['format'](_0x16da('0xd1'),_0x2577df,_0x1cdbd8,_0x17574a),_0x51339c[_0x17574a]);});});this[_0x16da('0xd')]['setVariable'](util[_0x16da('0x25')](_0x16da('0xd2'),_0x2577df),_0x11ca25['length']);return this[_0x16da('0xd')][_0x16da('0xa5')](util['format']('variable\x20%s\x20set',_0x2577df));};AGIVertices[_0x16da('0x10')][_0x16da('0xd3')]=function(_0x2f3636){logger['debug'](util['format'](_0x16da('0xd4'),_0x2f3636[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0x2f3636[_0x16da('0xd5')])){return this[_0x16da('0xd')]['error'](_0x2f3636,'no\x20user\x20selected');}var _0x4880a5=this['getUser'][_0x16da('0x6c')](this,_0x2f3636['sip_id']);if(!_0x4880a5){return this[_0x16da('0xd')][_0x16da('0x29')](_0x2f3636,_0x16da('0xd6'));}var _0x3fded0=this[_0x16da('0xd')][_0x16da('0xa7')](_0x16da('0xd7'),[util[_0x16da('0x25')]('SIP/%s',_0x4880a5),_0x2f3636['timeout'],_0x2f3636[_0x16da('0xd8')],_0x2f3636[_0x16da('0x6f')]]);if(_0x3fded0[_0x16da('0x9e')]===-0x1){return _0x3fded0;}return this[_0x16da('0xd')]['noop'](util[_0x16da('0x25')](_0x16da('0xd9'),_0x16da('0xd7')));};AGIVertices[_0x16da('0x10')][_0x16da('0xda')]=function(_0x4b2643){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0xdb'),_0x4b2643[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0x4b2643['key'])){return this[_0x16da('0xd')][_0x16da('0xa5')]('no\x20key\x20configured');}if(!this[_0x16da('0xa0')](_0x4b2643[_0x16da('0x5e')])){return this['channel'][_0x16da('0xa5')](_0x16da('0xa6'));}this[_0x16da('0xd')][_0x16da('0xdc')]=!![];this[_0x16da('0x33')](_0x4b2643);this[_0x16da('0x3f')](_0x4b2643[_0x16da('0x5e')],'in','','');this['channel'][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0xdd'),_0x4b2643['text']));var _0x2d9cfd=this[_0x16da('0x76')][_0x16da('0x6c')](this,_0x4b2643);if(_0x2d9cfd){for(var _0x5bd8bd in _0x2d9cfd){if(_0x2d9cfd[_0x16da('0x90')](_0x5bd8bd)){this[_0x16da('0xd')]['setVariable'](util['format'](_0x16da('0xde'),_0x5bd8bd[_0x16da('0x64')]()),_0x2d9cfd[_0x5bd8bd]);}}this[_0x16da('0x3f')](_0x2d9cfd['speech'],'out','dialogflow','');return this[_0x16da('0xd')]['noop'](util['format'](_0x16da('0xdf'),_0x2d9cfd[_0x16da('0xe0')]));}return this[_0x16da('0xd')][_0x16da('0x29')](_0x4b2643,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x16da('0x10')][_0x16da('0xe1')]=function(_0x3c55c2){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0xe2'),_0x3c55c2[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0x3c55c2[_0x16da('0xe3')])){return this[_0x16da('0xd')]['noop'](_0x16da('0xe4'));}if(!this['isConfigured'](_0x3c55c2['client_email'])){return this[_0x16da('0xd')][_0x16da('0xa5')](_0x16da('0xe5'));}if(!this[_0x16da('0xa0')](_0x3c55c2['private_key'])){return this[_0x16da('0xd')][_0x16da('0xa5')](_0x16da('0xe6'));}if(!this[_0x16da('0xa0')](_0x3c55c2[_0x16da('0x7b')])){return this[_0x16da('0xd')][_0x16da('0xa5')]('no\x20anguage\x20configured');}if(!this[_0x16da('0xa0')](_0x3c55c2[_0x16da('0x5e')])){return this[_0x16da('0xd')][_0x16da('0xa5')](_0x16da('0xa6'));}this['channel'][_0x16da('0xdc')]=!![];this[_0x16da('0x33')](_0x3c55c2);this['createSquareMessage'](_0x3c55c2[_0x16da('0x5e')],'in','','');this[_0x16da('0xd')][_0x16da('0xa5')](util['format'](_0x16da('0xe7'),_0x3c55c2['text']));var _0x3e233b=this[_0x16da('0x79')][_0x16da('0x6c')](this,_0x3c55c2);if(_0x3e233b){for(var _0x21e212 in _0x3e233b){if(_0x3e233b[_0x16da('0x90')](_0x21e212)){if(_0x21e212!=='providerResponse'){this['channel'][_0x16da('0x9a')](util[_0x16da('0x25')](_0x16da('0xde'),_0x21e212[_0x16da('0x64')]()),_0x3e233b[_0x21e212]);}}}this[_0x16da('0x3f')](_0x3e233b['speech'],'out',_0x16da('0xe1'),_0x3e233b[_0x16da('0xe8')]);return this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0xe9'),_0x3e233b[_0x16da('0xe0')]));}return this[_0x16da('0xd')][_0x16da('0x29')](_0x3c55c2,_0x16da('0xea'));};AGIVertices[_0x16da('0x10')]['sesteknda']=function(_0x49ea96){logger[_0x16da('0x2a')](util['format'](_0x16da('0xeb'),_0x49ea96[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0x49ea96[_0x16da('0xec')])){return this[_0x16da('0xd')]['noop'](_0x16da('0xed'));}if(!this[_0x16da('0xa0')](_0x49ea96[_0x16da('0xee')])){return this[_0x16da('0xd')]['noop'](_0x16da('0xef'));}if(!this[_0x16da('0xa0')](_0x49ea96[_0x16da('0xf0')])){return this[_0x16da('0xd')][_0x16da('0xa5')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x49ea96[_0x16da('0xf1')])){return this[_0x16da('0xd')][_0x16da('0xa5')](_0x16da('0xa6'));}this['channel'][_0x16da('0xdc')]=!![];this['createSquareDetailsReport'](_0x49ea96);this[_0x16da('0x3f')](_0x49ea96[_0x16da('0x5e')],'in','','');this['channel'][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0xf2'),_0x49ea96[_0x16da('0x5e')]));var _0x289797=this[_0x16da('0x7c')][_0x16da('0x6c')](this,_0x49ea96);if(_0x289797){for(var _0x45203d in _0x289797){if(_0x289797['hasOwnProperty'](_0x45203d)){this[_0x16da('0xd')][_0x16da('0x9a')](util[_0x16da('0x25')](_0x16da('0xf3'),_0x45203d[_0x16da('0x64')]()),_0x289797[_0x45203d]);}}this[_0x16da('0x3f')](_0x289797[_0x16da('0xe0')],_0x16da('0xf4'),'sesteknda','');if(_0x289797[_0x16da('0xf5')]){this['channel'][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0xf6'),_0x289797[_0x16da('0xf5')]));var _0x22f294=this['channel'][_0x16da('0xf7')](_0x289797[_0x16da('0xf5')]);try{fs[_0x16da('0xf8')](_0x289797[_0x16da('0xf5')]+_0x16da('0xf9'));}catch(_0x660582){logger[_0x16da('0x29')](_0x660582);}return _0x22f294;}else{return this['channel'][_0x16da('0xa5')](util['format'](_0x16da('0xfa'),_0x289797['speech']));}}return this[_0x16da('0xd')][_0x16da('0x29')](_0x49ea96,_0x16da('0xfb'));};AGIVertices[_0x16da('0x10')]['end']=function(_0x39baad){logger['info'](util['format'](_0x16da('0xfc'),_0x39baad[_0x16da('0x35')]));return this[_0x16da('0xd')][_0x16da('0xa5')]('end');};AGIVertices[_0x16da('0x10')]['ext_dial']=function(_0x451383){logger['info'](util[_0x16da('0x25')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x451383[_0x16da('0x35')]));var _0x4c0470='';if(_0x451383['trunk_id']){if(!this[_0x16da('0xa0')](_0x451383[_0x16da('0xfd')])){return this[_0x16da('0xd')][_0x16da('0x29')](_0x451383,_0x16da('0xfe'));}else{var _0x455538=parseInt(_0x451383[_0x16da('0xfd')],0xa);if(isNaN(_0x455538)){_0x4c0470=_0x451383[_0x16da('0xfd')];}else{_0x4c0470=this[_0x16da('0xff')][_0x16da('0x6c')](this,_0x451383[_0x16da('0xfd')]);if(!_0x4c0470){return this[_0x16da('0xd')][_0x16da('0x29')](_0x451383,'no\x20trunk\x20found');}}}}else if(_0x451383[_0x16da('0x100')]){_0x4c0470=_0x451383[_0x16da('0x100')];}else{return this[_0x16da('0xd')][_0x16da('0x29')](_0x451383,_0x16da('0xfe'));}var _0x256d43=this[_0x16da('0xd')][_0x16da('0xa7')]('DIAL',[util[_0x16da('0x25')](_0x16da('0x101'),_0x4c0470,_0x451383[_0x16da('0x45')]),_0x451383['timeout'],_0x451383[_0x16da('0xd8')],_0x451383['url']]);if(_0x256d43[_0x16da('0x9e')]===-0x1){return _0x256d43;}return this[_0x16da('0xd')][_0x16da('0xa5')](util['format'](_0x16da('0xd9'),'DIAL'));};AGIVertices[_0x16da('0x10')][_0x16da('0x102')]=function(_0x458f81){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x103'),_0x458f81[_0x16da('0x35')]));return this['channel'][_0x16da('0xa5')]('finally');};AGIVertices['prototype']['getdigits']=function(_0x4ac8b5){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x104'),_0x4ac8b5['label']));if(_0x4ac8b5[_0x16da('0xa2')]===0x0){return this[_0x16da('0xa1')](_0x4ac8b5);}_0x4ac8b5[_0x16da('0xa2')]-=0x1;if(!this[_0x16da('0xa0')](_0x4ac8b5[_0x16da('0x105')])){return this['channel']['error'](_0x4ac8b5,_0x16da('0x106'));}var _0x268ff4=this[_0x16da('0x107')]['sync'](this,_0x4ac8b5[_0x16da('0x105')]);if(!_0x268ff4){return this[_0x16da('0xd')][_0x16da('0x29')](_0x4ac8b5,_0x16da('0x108'));}if(!this['isConfigured'](_0x4ac8b5[_0x16da('0xcd')])){return this[_0x16da('0xd')][_0x16da('0x29')](_0x16da('0x109'));}var _0x4dc5f9=this['channel'][_0x16da('0x10a')](_0x268ff4,_0x4ac8b5[_0x16da('0x10b')],_0x4ac8b5['maxdigit']);var _0x131252=_0x4dc5f9[_0x16da('0x9e')]?_0x4dc5f9['result'][_0x16da('0x49')]():'';logger[_0x16da('0x2a')]('test',JSON['stringify'](_0x4dc5f9));if(_0x4dc5f9[_0x16da('0x9e')]===-0x1){this['createSquareDetailsReport'][_0x16da('0x6c')](this,_0x4ac8b5,_0x131252);return _0x4dc5f9;}else if(_0x4dc5f9[_0x16da('0x9c')]===_0x16da('0x61')){_0x4dc5f9[_0x16da('0x9e')]=_0x131252[_0x16da('0x97')]>=parseInt(_0x4ac8b5['mindigit'])?'x':'i';}else{_0x4dc5f9['result']=_0x131252[_0x16da('0x97')]>=parseInt(_0x4ac8b5[_0x16da('0x10c')])&&_0x131252[_0x16da('0x97')]<=parseInt(_0x4ac8b5['maxdigit'])?'x':'i';}var _0x5da4c9=this[_0x16da('0x11')][_0x16da('0x6c')](this,_0x4ac8b5[_0x16da('0xcd')]);if(!_0x5da4c9){return this[_0x16da('0xd')][_0x16da('0x29')](_0x4ac8b5,'no\x20variable\x20found');}this[_0x16da('0xd')][_0x16da('0x9a')](_0x5da4c9,_0x131252);if(this[_0x16da('0xa0')](_0x4ac8b5[_0x16da('0x10d')])){var _0x57fa96=parseInt(_0x4ac8b5['hiddendigitsnum'],0xa);var _0x122059=rs[_0x16da('0x10e')]({'charset':'*','length':_0x57fa96});var _0xd2faf7=_0x131252[_0x16da('0x97')];if(_0xd2faf7>0x0){if(_0xd2faf7>_0x57fa96){this[_0x16da('0x33')][_0x16da('0x6c')](this,_0x4ac8b5,_0x4ac8b5[_0x16da('0x10f')]===_0x16da('0x110')?_0x122059+_0x131252['substr'](_0x57fa96):_0x131252[_0x16da('0x111')](0x0,_0xd2faf7-_0x57fa96)+_0x122059);}else{this[_0x16da('0x33')][_0x16da('0x6c')](this,_0x4ac8b5,rs['generate']({'charset':'*','length':_0xd2faf7}));}}else{this[_0x16da('0x33')][_0x16da('0x6c')](this,_0x4ac8b5,'');}}else{this[_0x16da('0x33')]['sync'](this,_0x4ac8b5,_0x131252);}return _0x4dc5f9;};AGIVertices[_0x16da('0x10')][_0x16da('0xc')]=function(_0xb17a33){logger[_0x16da('0x2a')](util['format'](_0x16da('0x112'),_0xb17a33[_0x16da('0x35')]));return this['getdigits'](_0xb17a33);};AGIVertices[_0x16da('0x10')][_0x16da('0x113')]=function(_0x362b67){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x114'),_0x362b67['label']));this[_0x16da('0x33')]['sync'](this,_0x362b67,_0x362b67['goalname']);return this['channel'][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x115'),_0x362b67[_0x16da('0x116')]));};AGIVertices['prototype'][_0x16da('0x117')]=function(_0x57bb40){logger['info'](util[_0x16da('0x25')](_0x16da('0x118'),_0x57bb40['label']));if(!this[_0x16da('0xa0')](_0x57bb40[_0x16da('0x87')])||!this[_0x16da('0xa0')](_0x57bb40['aws_secret_access_key'])){return this[_0x16da('0xd')][_0x16da('0xa5')](_0x16da('0x119'));}if(!this['isConfigured'](_0x57bb40['text'])){return this[_0x16da('0xd')][_0x16da('0xa5')](_0x16da('0xa6'));}this[_0x16da('0xd')]['noop'](util[_0x16da('0x25')]('Trying\x20aws\x20Polly\x20%s',_0x57bb40['text']));var _0x2bd64e=this[_0x16da('0x82')][_0x16da('0x6c')](this,_0x57bb40);if(_0x2bd64e){this['channel'][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x11a'),_0x2bd64e));var _0x6a93d4=this[_0x16da('0xd')][_0x16da('0xf7')](_0x2bd64e);try{fs[_0x16da('0xf8')](_0x2bd64e+'.wav');}catch(_0x3dfda8){logger[_0x16da('0x29')](_0x3dfda8);}return _0x6a93d4;}return this[_0x16da('0xd')][_0x16da('0x29')](_0x57bb40,_0x16da('0x11b'));};AGIVertices[_0x16da('0x10')][_0x16da('0x11c')]=function(_0x2acd42){logger[_0x16da('0x2a')](util[_0x16da('0x25')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x2acd42[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0x2acd42['aws_access_key_id'])||!this[_0x16da('0xa0')](_0x2acd42[_0x16da('0x83')])){return this['channel'][_0x16da('0xa5')](_0x16da('0x119'));}if(!this[_0x16da('0xa0')](_0x2acd42[_0x16da('0x89')])){return this['channel'][_0x16da('0xa5')](_0x16da('0x11d'));}if(!this[_0x16da('0xa0')](_0x2acd42['text'])){return this[_0x16da('0xd')][_0x16da('0xa5')](_0x16da('0xa6'));}this[_0x16da('0xd')]['bot']=!![];this[_0x16da('0x33')](_0x2acd42);this[_0x16da('0x3f')](_0x2acd42[_0x16da('0x5e')],'in','','');this[_0x16da('0xd')]['noop'](util[_0x16da('0x25')]('Trying\x20Amazon\x20Lex:\x20%s',_0x2acd42[_0x16da('0x5e')]));var _0x5cf318=this[_0x16da('0x86')]['sync'](this,_0x2acd42);if(_0x5cf318){for(var _0x2da9e4 in _0x5cf318){if(_0x5cf318[_0x16da('0x90')](_0x2da9e4)&&_[_0x16da('0x91')](_0x5cf318[_0x2da9e4])){this[_0x16da('0xd')][_0x16da('0x9a')](util[_0x16da('0x25')](_0x16da('0x11e'),_0x2da9e4[_0x16da('0x64')]()),_0x5cf318[_0x2da9e4]);}}if(_[_0x16da('0x42')](_0x5cf318[_0x16da('0x73')])){return this['channel'][_0x16da('0xa5')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x16da('0x3f')](_0x5cf318['message'],'out',_0x16da('0x11f'),'');return this[_0x16da('0xd')][_0x16da('0xa5')](util['format'](_0x16da('0x120'),_0x5cf318[_0x16da('0x73')]));}}return this[_0x16da('0xd')][_0x16da('0x29')](_0x2acd42,_0x16da('0x121'));};AGIVertices['prototype'][_0x16da('0x122')]=function(_0x224c6b){logger['info'](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x224c6b[_0x16da('0x35')],_0x224c6b['timeout']));if(!this[_0x16da('0xa0')](_0x224c6b[_0x16da('0x77')])){return this[_0x16da('0xd')][_0x16da('0xa5')](_0x16da('0x123'));}var _0xf250a9='wav';var _0x430109=util[_0x16da('0x25')]('%s/recordings/%s',FILES_PATH,rs[_0x16da('0x10e')](0x4));var _0x31cbe2=util[_0x16da('0x25')](_0x16da('0x99'),_0x430109,_0xf250a9);var _0x3e4553=!![];if(_0x224c6b[_0x16da('0x124')]==='NOBEEP'){_0x3e4553=![];}var _0x4417e4=this[_0x16da('0xd')][_0x16da('0x125')](_0x430109,_0xf250a9,_0x224c6b[_0x16da('0x126')],_0x224c6b[_0x16da('0x61')],undefined,_0x3e4553);if(_0x4417e4['result']!==-0x1){this[_0x16da('0xd')]['noop'](util[_0x16da('0x25')](_0x16da('0x127'),_0x31cbe2));var _0x34af88=this['googleASR'][_0x16da('0x6c')](this,_0x224c6b,_0x31cbe2);if(_0x34af88){for(var _0x2a52b5 in _0x34af88){if(_0x34af88['hasOwnProperty'](_0x2a52b5)){this[_0x16da('0xd')][_0x16da('0x9a')](util[_0x16da('0x25')](_0x16da('0x128'),_0x2a52b5['toUpperCase']()),_0x34af88[_0x2a52b5]);}}return this[_0x16da('0xd')]['noop'](util['format'](_0x16da('0x129'),JSON[_0x16da('0x70')](_0x34af88)));}}return _0x4417e4;};AGIVertices[_0x16da('0x10')]['tildeasr']=function(_0xe11251){logger[_0x16da('0x2a')](util[_0x16da('0x25')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0xe11251[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0xe11251[_0x16da('0x8d')])){return this['channel'][_0x16da('0xa5')]('no\x20appid\x20configured');}if(!this[_0x16da('0xa0')](_0xe11251[_0x16da('0x8e')])){return this['channel'][_0x16da('0xa5')]('no\x20appsecret\x20configured');}var _0x22d9ca='wav';var _0x496a0c=util[_0x16da('0x25')](_0x16da('0x12a'),FILES_PATH,rs['generate'](0x4));var _0x100007=util['format'](_0x16da('0x99'),_0x496a0c,_0x22d9ca);var _0x2c7f6f=!![];if(_0xe11251['beep']===_0x16da('0x12b')){_0x2c7f6f=![];}var _0x56936f=this[_0x16da('0xd')]['recordFile'](_0x496a0c,_0x22d9ca,_0xe11251[_0x16da('0x126')],_0xe11251[_0x16da('0x61')],undefined,_0x2c7f6f);if(_0x56936f['result']!==-0x1){this['channel'][_0x16da('0xa5')](util['format'](_0x16da('0x12c'),_0x100007));var _0x5cb95a=this[_0x16da('0x8c')][_0x16da('0x6c')](this,_0xe11251,_0x100007);if(_0x5cb95a){for(var _0x69d47e in _0x5cb95a){if(_0x5cb95a[_0x16da('0x90')](_0x69d47e)){this[_0x16da('0xd')]['setVariable'](util[_0x16da('0x25')]('TILDE_ASR_%s',_0x69d47e[_0x16da('0x64')]()),_0x5cb95a[_0x69d47e]);}}return this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x12d'),JSON[_0x16da('0x70')](_0x5cb95a)));}}return _0x56936f;};AGIVertices[_0x16da('0x10')]['gotoc']=function(_0x2a6e69){logger[_0x16da('0x2a')](util[_0x16da('0x25')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x2a6e69[_0x16da('0x35')]));return this[_0x16da('0xd')][_0x16da('0x12e')](_0x2a6e69[_0x16da('0x39')],_0x2a6e69[_0x16da('0x3a')],_0x2a6e69[_0x16da('0x3b')]);};AGIVertices['prototype'][_0x16da('0x12f')]=function(_0x11ba6c){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x130'),_0x11ba6c[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0x11ba6c[_0x16da('0x131')])){return this['channel']['error'](_0x11ba6c,_0x16da('0x132'));}try{var _0x594f23=eval(_0x11ba6c[_0x16da('0x131')])?_0x16da('0x133'):'false';this['channel']['noop'](util[_0x16da('0x25')](_0x16da('0x134'),_0x11ba6c[_0x16da('0x131')],_0x594f23));return{'code':0xc8,'result':_0x594f23};}catch(_0x57c15e){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x16da('0x10')][_0x16da('0x135')]=function(_0x5106b8){logger[_0x16da('0x2a')](util[_0x16da('0x25')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5106b8['label']));if(!this['isConfigured'](_0x5106b8[_0x16da('0x136')])){return this[_0x16da('0xd')][_0x16da('0x29')](_0x5106b8,'no\x20interval\x20configured');}var _0x5459c9=this[_0x16da('0x21')]['sync'](this,_0x5106b8[_0x16da('0x136')]);if(!_0x5459c9){return this[_0x16da('0xd')][_0x16da('0x29')](_0x5106b8,_0x16da('0x137'));}for(var _0x2485a7=0x0;_0x2485a7<_0x5459c9['length'];_0x2485a7+=0x1){var _0x4122b2=this[_0x16da('0xd')][_0x16da('0x11')](util['format'](_0x16da('0x138'),_0x5459c9[_0x2485a7]));if(_0x4122b2[_0x16da('0x9e')]===-0x1){return _0x4122b2;}logger[_0x16da('0x2a')](util[_0x16da('0x25')]('IFTIME\x20%s\x20%s',_0x5459c9[_0x2485a7],_0x4122b2[_0x16da('0x9c')]));if(_0x4122b2[_0x16da('0x9c')]===_0x16da('0x133')){logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x5459c9[_0x2485a7],_0x16da('0x133')));this['channel']['noop'](util[_0x16da('0x25')](_0x16da('0x139'),_0x5459c9[_0x2485a7],'true'));return{'code':0xc8,'result':_0x16da('0x133')};}else{logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x139'),_0x5459c9[_0x2485a7],'false'));this[_0x16da('0xd')]['noop'](util[_0x16da('0x25')](_0x16da('0x139'),_0x5459c9[_0x2485a7],_0x16da('0x13a')));}}return{'code':0xc8,'result':_0x16da('0x13a')};};AGIVertices[_0x16da('0x10')][_0x16da('0x13b')]=function(_0x2eeca1){logger[_0x16da('0x2a')](util['format'](_0x16da('0x13c'),_0x2eeca1[_0x16da('0x35')]));return this[_0x16da('0xd')][_0x16da('0x13b')]();};AGIVertices['prototype'][_0x16da('0x13d')]=function(_0x5e78cd){logger['info'](util['format'](_0x16da('0x13e'),_0x5e78cd['label']));if(!this[_0x16da('0xa0')](_0x5e78cd[_0x16da('0x77')])){return this['channel'][_0x16da('0xa5')](_0x16da('0x123'));}var _0x17a45d=_0x16da('0x13f');var _0x351c0b=util['format'](_0x16da('0x12a'),FILES_PATH,rs['generate'](0x4));var _0x3ef5e0=util['format'](_0x16da('0x99'),_0x351c0b,_0x17a45d);var _0x4be3f7=!![];if(_0x5e78cd[_0x16da('0x124')]==='NOBEEP'){_0x4be3f7=![];}var _0x146a83=this['channel'][_0x16da('0x125')](_0x351c0b,_0x17a45d,_0x5e78cd[_0x16da('0x126')],_0x5e78cd['timeout'],undefined,_0x4be3f7);if(_0x146a83[_0x16da('0x9e')]!==-0x1){this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')]('ispeech\x20%s\x20file\x20created',_0x3ef5e0));var _0x3d11f6=this[_0x16da('0x80')][_0x16da('0x6c')](this,_0x5e78cd,_0x3ef5e0);if(_0x3d11f6){for(var _0x12a8d7 in _0x3d11f6){if(_0x3d11f6['hasOwnProperty'](_0x12a8d7)){this['channel'][_0x16da('0x9a')](util[_0x16da('0x25')](_0x16da('0x140'),_0x12a8d7[_0x16da('0x64')]()),_0x3d11f6[_0x12a8d7]);}}return this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x141'),JSON[_0x16da('0x70')](_0x3d11f6)));}}return _0x146a83;};AGIVertices['prototype']['ispeechtts']=function(_0x548391){logger['info'](util['format'](_0x16da('0x142'),_0x548391[_0x16da('0x35')]));if(!this['isConfigured'](_0x548391[_0x16da('0x77')])){return this[_0x16da('0xd')][_0x16da('0xa5')](_0x16da('0x123'));}if(!this[_0x16da('0xa0')](_0x548391[_0x16da('0x5e')])){return this[_0x16da('0xd')]['noop'](_0x16da('0xa6'));}this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x143'),_0x548391['text']));var _0x362988=this[_0x16da('0x7d')][_0x16da('0x6c')](this,_0x548391);if(_0x362988){this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x144'),_0x362988));var _0x3494a4=this[_0x16da('0xd')][_0x16da('0xf7')](_0x362988,_0x548391['intKey']);try{fs[_0x16da('0xf8')](_0x362988+_0x16da('0xf9'));}catch(_0x5d2624){logger['error'](_0x5d2624);}return _0x3494a4;}return this[_0x16da('0xd')][_0x16da('0x29')](_0x548391,_0x16da('0x145'));};AGIVertices[_0x16da('0x10')][_0x16da('0x146')]=function(_0xc0bc35){logger[_0x16da('0x2a')](util['format'](_0x16da('0x147'),_0xc0bc35[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0xc0bc35[_0x16da('0x148')])){return this[_0x16da('0xd')][_0x16da('0x29')](_0xc0bc35,_0x16da('0x149'));}logger['info'](util['format'](_0x16da('0x14a'),this[_0x16da('0xd')][_0x16da('0x38')],_0xc0bc35[_0x16da('0x148')]));var _0x33df4f=this['agentLogin'][_0x16da('0x6c')](this,_0xc0bc35[_0x16da('0x148')]);if(_0x33df4f){logger[_0x16da('0x2a')](util['format'](_0x16da('0x14b'),this[_0x16da('0xd')][_0x16da('0x38')],_0xc0bc35[_0x16da('0x148')]));this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x14b'),this[_0x16da('0xd')]['callerid'],_0xc0bc35[_0x16da('0x148')]));return{'code':0xc8,'result':_0x16da('0x14c')};}else{logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x14d'),this[_0x16da('0xd')]['callerid'],_0xc0bc35['findBy']));this['channel'][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x14d'),this['channel'][_0x16da('0x38')],_0xc0bc35['findBy']));return{'code':0xc8,'result':_0x16da('0x14e')};}};AGIVertices['prototype'][_0x16da('0x14f')]=function(_0x1e5b2d){logger[_0x16da('0x2a')](util[_0x16da('0x25')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x1e5b2d[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0x1e5b2d[_0x16da('0x148')])){return this[_0x16da('0xd')][_0x16da('0x29')](_0x1e5b2d,_0x16da('0x149'));}logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x14a'),this[_0x16da('0xd')][_0x16da('0x38')],_0x1e5b2d[_0x16da('0x148')]));var _0x89a5c7=this[_0x16da('0x50')][_0x16da('0x6c')](this,_0x1e5b2d[_0x16da('0x148')]);if(_0x89a5c7){logger[_0x16da('0x2a')](util[_0x16da('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x16da('0xd')][_0x16da('0x38')],_0x1e5b2d[_0x16da('0x148')]));this[_0x16da('0xd')]['noop'](util[_0x16da('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x16da('0xd')][_0x16da('0x38')],_0x1e5b2d[_0x16da('0x148')]));return{'code':0xc8,'result':'success'};}else{logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x14d'),this[_0x16da('0xd')][_0x16da('0x38')],_0x1e5b2d[_0x16da('0x148')]));this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x14d'),this[_0x16da('0xd')][_0x16da('0x38')],_0x1e5b2d[_0x16da('0x148')]));return{'code':0xc8,'result':_0x16da('0x14e')};}};AGIVertices[_0x16da('0x10')][_0x16da('0x150')]=function(_0xbc525d){logger['info'](util[_0x16da('0x25')](_0x16da('0x151'),_0xbc525d[_0x16da('0x35')]));if(!this['isConfigured'](_0xbc525d[_0x16da('0x152')])){return this[_0x16da('0xd')]['error'](_0xbc525d,'no\x20operation\x20configured');}this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')]('math\x20%s',_0xbc525d[_0x16da('0x152')]));var _0x31246a=eval(_0xbc525d['operation']);if(!this[_0x16da('0xa0')](_0xbc525d[_0x16da('0xcd')])){return this['channel'][_0x16da('0xa5')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x489cec=this['getVariable'][_0x16da('0x6c')](this,_0xbc525d[_0x16da('0xcd')]);if(!_0x489cec){return this['channel'][_0x16da('0x29')](_0xbc525d,'no\x20variable\x20found');}if(_[_0x16da('0x96')](_0x31246a)){var _0x301b45=this;_0x31246a['forEach'](function(_0x5453c6,_0x1a8bd3){_0x301b45[_0x16da('0xd')][_0x16da('0x9a')](util['format']('%s[%s]',_0x489cec,_0x1a8bd3),_0x5453c6);});return this[_0x16da('0xd')][_0x16da('0xa5')](util['format'](_0x16da('0x153'),_0x489cec));}else{return this[_0x16da('0xd')][_0x16da('0x9a')](_0x489cec,_0x31246a);}};AGIVertices[_0x16da('0x10')][_0x16da('0xa')]=function(_0x27484d){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x154'),_0x27484d[_0x16da('0x35')]));if(_0x27484d[_0x16da('0xa2')]===0x0){return this[_0x16da('0xa1')](_0x27484d);}_0x27484d[_0x16da('0xa2')]-=0x1;if(!this['isConfigured'](_0x27484d[_0x16da('0x105')])){return this[_0x16da('0xd')]['error'](_0x27484d,_0x16da('0x106'));}var _0x12b314=this['getSound'][_0x16da('0x6c')](this,_0x27484d['file_id']);if(!_0x12b314){return this[_0x16da('0xd')]['error'](_0x27484d,_0x16da('0x108'));}var _0x307715=this[_0x16da('0xd')]['getData'](_0x12b314,_0x27484d['response'],_0x27484d[_0x16da('0x155')]);var _0x1dcf8a=_0x307715[_0x16da('0x9e')];if(_0x307715[_0x16da('0x9e')]===-0x1){this[_0x16da('0x33')][_0x16da('0x6c')](this,_0x27484d,'-1');return _0x307715;}else if(_0x307715[_0x16da('0x9c')]==='timeout'){_0x307715['result']=_0x307715['result'][_0x16da('0x97')]>0x0?_0x307715[_0x16da('0x9e')]:'t';}else if(_[_0x16da('0x41')](_0x307715[_0x16da('0x9e')])){_0x307715[_0x16da('0x9e')]='#';_0x1dcf8a='#';}if(!this[_0x16da('0xa0')](_0x27484d[_0x16da('0xcd')])){this[_0x16da('0xd')][_0x16da('0xa5')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x41bf5e=this[_0x16da('0x11')]['sync'](this,_0x27484d[_0x16da('0xcd')]);if(!_0x41bf5e){return this[_0x16da('0xd')][_0x16da('0x29')](_0x27484d,_0x16da('0xce'));}this[_0x16da('0xd')][_0x16da('0x9a')](_0x41bf5e,_0x1dcf8a);}this[_0x16da('0x33')]['sync'](this,_0x27484d,_0x1dcf8a);return _0x307715;};AGIVertices[_0x16da('0x10')][_0x16da('0xa5')]=function(_0x1bdd8d){logger[_0x16da('0x2a')](util[_0x16da('0x25')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x1bdd8d[_0x16da('0x35')]));return this[_0x16da('0xd')][_0x16da('0xa5')](_0x1bdd8d[_0x16da('0x156')]||_0x1bdd8d[_0x16da('0x35')]);};AGIVertices[_0x16da('0x10')][_0x16da('0x157')]=function(_0x70655b){logger['info'](util[_0x16da('0x25')](_0x16da('0x158'),_0x70655b[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0x70655b[_0x16da('0x148')])){return this[_0x16da('0xd')][_0x16da('0x29')](_0x70655b,'no\x20find\x20by\x20configured');}logger[_0x16da('0x2a')](util[_0x16da('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x16da('0xd')][_0x16da('0x38')],_0x70655b['findBy']));var _0x594670=this[_0x16da('0x4b')][_0x16da('0x6c')](this,_0x70655b[_0x16da('0x159')]);var _0x5d98be=this[_0x16da('0x4d')][_0x16da('0x6c')](this,_0x70655b[_0x16da('0x148')],_0x594670);if(_0x5d98be){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x14b'),this[_0x16da('0xd')][_0x16da('0x38')],_0x70655b[_0x16da('0x148')]));this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x14b'),this[_0x16da('0xd')][_0x16da('0x38')],_0x70655b['findBy']));return{'code':0xc8,'result':_0x16da('0x14c')};}else{logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x14d'),this[_0x16da('0xd')][_0x16da('0x38')],_0x70655b['findBy']));this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x14b'),this[_0x16da('0xd')]['callerid'],_0x70655b[_0x16da('0x148')]));return{'code':0xc8,'result':_0x16da('0x14e')};}};AGIVertices[_0x16da('0x10')]['playback']=function(_0x24388e){logger['info'](util[_0x16da('0x25')](_0x16da('0x15a'),_0x24388e[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0x24388e['file_id'])){return this[_0x16da('0xd')][_0x16da('0x29')](_0x24388e,_0x16da('0x106'));}var _0xe57458=this[_0x16da('0x107')]['sync'](this,_0x24388e[_0x16da('0x105')]);if(!_0xe57458){return this[_0x16da('0xd')][_0x16da('0x29')](_0x24388e,_0x16da('0x108'));}var _0x21d426=this['channel'][_0x16da('0xa7')]('PLAYBACK',[_0xe57458,_0x24388e[_0x16da('0xd8')]]);if(_0x21d426[_0x16da('0x9e')]===-0x1){return _0x21d426;}return this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x15b'),_0x16da('0x15c'),_0xe57458));};AGIVertices[_0x16da('0x10')][_0x16da('0x15d')]=function(_0x50d9e5){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x15e'),_0x50d9e5[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0x50d9e5['queue_id'])){return this[_0x16da('0xd')][_0x16da('0x29')](_0x50d9e5,_0x16da('0x15f'));}var _0x37a891='';var _0x321065=parseInt(_0x50d9e5['queue_id'],0xa);if(isNaN(_0x321065)){_0x37a891=_0x50d9e5[_0x16da('0x160')];}else{_0x37a891=this[_0x16da('0x14')][_0x16da('0x6c')](this,_0x50d9e5[_0x16da('0x160')]);if(!_0x37a891){return this[_0x16da('0xd')][_0x16da('0x29')](_0x50d9e5,_0x16da('0x161'));}}var _0x44b753='';if(this['isConfigured'](_0x50d9e5['file_id'])){var _0x48b6c0=this[_0x16da('0x107')]['sync'](this,_0x50d9e5[_0x16da('0x105')]);if(_0x48b6c0){_0x44b753=_0x48b6c0;}}this['createSquareDetailsReport'][_0x16da('0x6c')](this,_0x50d9e5,_0x37a891);if(_0x50d9e5['opts']['indexOf']('x')<0x0){_0x50d9e5['opts']+='x';}if(_0x50d9e5[_0x16da('0xd8')]['indexOf']('X')<0x0){_0x50d9e5[_0x16da('0xd8')]+='X';}this[_0x16da('0xd')][_0x16da('0x9a')](_0x16da('0x162'),_0x37a891?_0x37a891[_0x16da('0x163')]():'');var _0x552f53=this[_0x16da('0xd')][_0x16da('0xa7')](_0x16da('0x164'),[_0x37a891,_0x50d9e5['opts'],_0x50d9e5[_0x16da('0x6f')],_0x44b753,_0x50d9e5['timeout'],_0x50d9e5[_0x16da('0x6')],_0x50d9e5[_0x16da('0x165')],_0x50d9e5[_0x16da('0x166')],'',_0x50d9e5[_0x16da('0x167')]]);if(_0x552f53[_0x16da('0x9e')]===-0x1){return _0x552f53;}return this[_0x16da('0xd')]['noop'](util[_0x16da('0x25')](_0x16da('0x15b'),_0x16da('0x164'),_0x37a891));};AGIVertices[_0x16da('0x10')]['record']=function(_0x5d75cf){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x168'),_0x5d75cf[_0x16da('0x35')]));var _0x1d6a07=_0x5d75cf[_0x16da('0x169')]||_0x16da('0x13f');var _0x4f84f1=util[_0x16da('0x25')]('%s_%s',this[_0x16da('0xd')][_0x16da('0x34')],rs[_0x16da('0x10e')](0x5));var _0xfcd17c=util[_0x16da('0x25')](_0x16da('0x16a'),FILES_PATH,_0x4f84f1,_0x1d6a07);var _0x4b3c4b=util[_0x16da('0x25')](_0x16da('0x12a'),FILES_PATH,_0x4f84f1);this[_0x16da('0x37')][_0x16da('0x6c')](this,_0x5d75cf,_0x4f84f1,_0xfcd17c);this['channel'][_0x16da('0x9a')](_0x16da('0x16b'),_0x4f84f1);logger[_0x16da('0x2a')](_0x16da('0x16c'),_0x4b3c4b,_0x1d6a07,_0x5d75cf[_0x16da('0x16d')],_0x5d75cf[_0x16da('0x61')]);return this['channel']['recordFile'](_0x4b3c4b,_0x1d6a07,_0x5d75cf[_0x16da('0x16d')],_0x5d75cf[_0x16da('0x61')],undefined,!![]);};AGIVertices[_0x16da('0x10')][_0x16da('0x16e')]=function(_0x26c6f8){logger['info'](util[_0x16da('0x25')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x26c6f8[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0x26c6f8[_0x16da('0x6f')])){return this[_0x16da('0xd')]['noop'](_0x16da('0x16f'));}var _0x32f91f=this[_0x16da('0x170')][_0x16da('0x6c')](this,_0x26c6f8);logger['info'](util[_0x16da('0x25')](_0x16da('0x171'),util[_0x16da('0x172')](_0x32f91f,{'showHidden':![],'depth':null})));if(!this[_0x16da('0xa0')](_0x26c6f8[_0x16da('0xcd')])){return this['channel'][_0x16da('0xa5')](_0x16da('0x173'));}var _0x17c79d=this[_0x16da('0x11')][_0x16da('0x6c')](this,_0x26c6f8['variable_id']);if(!_0x17c79d){return this[_0x16da('0xd')]['error'](_0x26c6f8,'no\x20variable\x20found');}this['channel'][_0x16da('0x9a')](util[_0x16da('0x25')](_0x16da('0x174'),_0x17c79d),_0x32f91f[_0x16da('0x175')]?_0x32f91f[_0x16da('0x175')]:_0x16da('0x176'));this[_0x16da('0xd')][_0x16da('0x9a')](util[_0x16da('0x25')](_0x16da('0x177'),_0x17c79d),_0x32f91f[_0x16da('0x72')]?_0x32f91f[_0x16da('0x72')]:'OK');if(_0x32f91f['body']){try{this[_0x16da('0x98')](_0x32f91f[_0x16da('0x65')],_0x17c79d);}catch(_0x5d5809){logger[_0x16da('0x29')](util[_0x16da('0x25')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x17c79d));}}return this[_0x16da('0xd')]['noop'](util[_0x16da('0x25')](_0x16da('0x178'),_0x17c79d));};AGIVertices[_0x16da('0x10')][_0x16da('0x179')]=function(_0x2c07e4){logger[_0x16da('0x2a')](util['format'](_0x16da('0x17a'),_0x2c07e4[_0x16da('0x35')]));return this[_0x16da('0xd')][_0x16da('0x17b')](_0x2c07e4[_0x16da('0x17c')][_0x16da('0x56')](/\s+/g,''),_0x2c07e4[_0x16da('0x16d')]);};AGIVertices['prototype'][_0x16da('0x17d')]=function(_0x547c48){logger['info'](util[_0x16da('0x25')](_0x16da('0x17e'),_0x547c48[_0x16da('0x35')]));return this['channel'][_0x16da('0x17f')](_0x547c48[_0x16da('0x62')][_0x16da('0x56')](/\s+/g,''),_0x547c48[_0x16da('0x16d')]);};AGIVertices[_0x16da('0x10')]['sayphonetic']=function(_0x1b3e21){logger['info'](util[_0x16da('0x25')](_0x16da('0x180'),_0x1b3e21[_0x16da('0x35')]));return this[_0x16da('0xd')][_0x16da('0x181')](_0x1b3e21[_0x16da('0x5e')],_0x1b3e21[_0x16da('0x16d')]);};AGIVertices[_0x16da('0x10')][_0x16da('0x182')]=function(_0x118395){logger['info'](util[_0x16da('0x25')](_0x16da('0x183'),_0x118395[_0x16da('0x35')]));if(!this['isConfigured'](_0x118395[_0x16da('0x184')])){return this[_0x16da('0xd')][_0x16da('0xa5')](_0x16da('0x185'));}var _0x5e8e36=this[_0x16da('0x186')][_0x16da('0x6c')](this,_0x118395[_0x16da('0x184')]);if(!_0x5e8e36||!_0x5e8e36[_0x16da('0x187')]){return this['channel']['error'](_0x118395,_0x16da('0x188'));}var _0x371b7c={'from':util[_0x16da('0x25')](_0x16da('0x189'),_0x5e8e36[_0x16da('0x16')],_0x5e8e36[_0x16da('0x18a')]||_0x5e8e36[_0x16da('0x187')]['user']),'to':_0x118395['to']||'','cc':_0x118395['cc']||'','bcc':_0x118395['bcc']||'','subject':_0x118395['subject'],'html':_0x118395[_0x16da('0x5e')],'text':_0x118395['text']};var _0x4ac788={'tls':{'rejectUnauthorized':![]}};if(_0x5e8e36[_0x16da('0x187')]['service']){_0x4ac788[_0x16da('0x18b')]=_0x5e8e36[_0x16da('0x187')][_0x16da('0x18b')];}else{_0x4ac788[_0x16da('0x18c')]=_0x5e8e36[_0x16da('0x187')][_0x16da('0x18c')];_0x4ac788[_0x16da('0x18d')]=_0x5e8e36['Smtp'][_0x16da('0x18d')];_0x4ac788[_0x16da('0x18e')]=_0x5e8e36[_0x16da('0x187')][_0x16da('0x18e')];}if(_0x5e8e36['Smtp'][_0x16da('0x18f')]){_0x4ac788['auth']={'user':_0x5e8e36[_0x16da('0x187')][_0x16da('0x190')],'pass':_0x5e8e36['Smtp'][_0x16da('0x191')]};}if(this[_0x16da('0xa0')](_0x118395['template_id'])){}logger[_0x16da('0x192')](_0x16da('0x193'),JSON[_0x16da('0x70')](_0x371b7c));this[_0x16da('0x33')][_0x16da('0x6c')](this,_0x118395,_0x118395[_0x16da('0x184')]);this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x194'),_0x5e8e36[_0x16da('0x16')]));this['sendMailMessage'][_0x16da('0x6c')](this,_0x4ac788,_0x371b7c);return this[_0x16da('0xd')]['noop'](_0x16da('0x195'));};AGIVertices[_0x16da('0x10')][_0x16da('0x196')]=function(_0x249cc6){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x197'),_0x249cc6['label']));return this[_0x16da('0xd')]['noop'](_0x16da('0x198'));};AGIVertices[_0x16da('0x10')][_0x16da('0x199')]=function(_0x3055ae){logger[_0x16da('0x2a')](util[_0x16da('0x25')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x3055ae[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0x3055ae[_0x16da('0x19a')])){return this[_0x16da('0xd')][_0x16da('0xa5')](_0x16da('0x19b'));}var _0xdf3e85=this[_0x16da('0x31')][_0x16da('0x6c')](this,_0x3055ae[_0x16da('0x19a')]);if(!_0xdf3e85){return this[_0x16da('0xd')][_0x16da('0x29')](_0x3055ae,_0x16da('0x19c'));}var _0x4c878e={'body':_0x3055ae[_0x16da('0x19d')],'phone':_0x3055ae['to']||'','SmsAccountId':_0xdf3e85['id']};logger[_0x16da('0x192')]('sendSMS\x20message',JSON[_0x16da('0x70')](_0x4c878e));this[_0x16da('0x33')][_0x16da('0x6c')](this,_0x3055ae,_0x3055ae[_0x16da('0x19a')]);this[_0x16da('0xd')]['noop'](util[_0x16da('0x25')](_0x16da('0x19e'),_0xdf3e85['name']));this['createSmsMessage'][_0x16da('0x6c')](this,_0x4c878e);return this['channel'][_0x16da('0xa5')](_0x16da('0x19f'));};AGIVertices['prototype'][_0x16da('0x1a0')]=function(_0x5b7b6f){logger[_0x16da('0x2a')](util[_0x16da('0x25')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x5b7b6f['label']));if(!this[_0x16da('0xa0')](_0x5b7b6f['variable_id'])){return this[_0x16da('0xd')][_0x16da('0x29')](_0x5b7b6f,_0x16da('0x1a1'));}var _0x379ed4=this[_0x16da('0x11')][_0x16da('0x6c')](this,_0x5b7b6f['variable_id']);if(!_0x379ed4){return this[_0x16da('0xd')]['error'](_0x5b7b6f,'no\x20variable\x20found');}return this[_0x16da('0xd')][_0x16da('0x9a')](_0x379ed4,_0x5b7b6f['variable_value']);};AGIVertices[_0x16da('0x10')][_0x16da('0x1a2')]=function(_0x7b5fea){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x1a3'),_0x7b5fea[_0x16da('0x35')]));this['channel'][_0x16da('0xa5')]('START\x20CALLY\x20SQUARE');if(_0x7b5fea[_0x16da('0xb1')]===_0x16da('0x1a4')){this['channel'][_0x16da('0xa5')]('Answer');return this['channel']['answer']();}return this['channel'][_0x16da('0xa5')](_0x16da('0x1a5'));};AGIVertices[_0x16da('0x10')][_0x16da('0x1a6')]=function(_0x533d47){logger['info'](util[_0x16da('0x25')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x533d47[_0x16da('0x35')]));if(!this[_0x16da('0xa0')](_0x533d47[_0x16da('0x1a7')])){return this['channel'][_0x16da('0x29')](_0x533d47,_0x16da('0x1a8'));}var _0x463efd=this[_0x16da('0x1a9')]['sync'](this,_0x533d47[_0x16da('0x1a7')]);if(!this['isConfigured'](_0x463efd)){return this[_0x16da('0xd')][_0x16da('0x29')](_0x533d47,util[_0x16da('0x25')](_0x16da('0x1aa'),_0x533d47['project_id']));}if(_0x463efd===this['channel'][_0x16da('0x36')]){return this[_0x16da('0xd')][_0x16da('0x29')](_0x533d47,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x16da('0x33')][_0x16da('0x6c')](this,_0x533d47,_0x463efd);var _0x41f48a=this['channel'][_0x16da('0xa7')](_0x16da('0x1ab'),util['format'](_0x16da('0x1ac'),config[_0x16da('0x6')]['host']||_0x16da('0x1ad'),_0x463efd,this[_0x16da('0xd')][_0x16da('0x36')]));if(_0x41f48a[_0x16da('0x9e')]===-0x1){return _0x41f48a;}return this['channel']['noop'](util[_0x16da('0x25')]('Executed\x20command\x20%s\x20%s',_0x16da('0x1ab'),_0x463efd));};AGIVertices['prototype'][_0x16da('0x1ae')]=function(_0x468f4b){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x1af'),_0x468f4b['label']));var _0x459e66=this[_0x16da('0x54')][_0x16da('0x6c')](this,_0x468f4b[_0x16da('0xaf')]);this[_0x16da('0x33')][_0x16da('0x6c')](this,_0x468f4b,_0x468f4b['command']);if(this[_0x16da('0xa0')](_0x468f4b[_0x16da('0xcd')])){var _0x46df6c=this['getVariable'][_0x16da('0x6c')](this,_0x468f4b[_0x16da('0xcd')]);if(_0x46df6c){this['channel'][_0x16da('0x9a')](_0x46df6c,_0x459e66);return this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x1b0'),_0x468f4b[_0x16da('0xaf')],_0x46df6c));}}return this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x1b1'),_0x468f4b[_0x16da('0xaf')]));};AGIVertices[_0x16da('0x10')]['google_cloud_tts']=function(_0x17d633){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x1b2'),_0x17d633['label']));_0x17d633[_0x16da('0x5e')]=_0x17d633[_0x16da('0x5e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x16da('0xa0')](_0x17d633[_0x16da('0x1b3')])){return this[_0x16da('0xd')][_0x16da('0xa5')]('no\x20apiKey\x20configured');}if(!this[_0x16da('0xa0')](_0x17d633[_0x16da('0x5e')])){return this['channel'][_0x16da('0xa5')](_0x16da('0xa6'));}this[_0x16da('0xd')]['noop'](util['format'](_0x16da('0x1b4'),_0x17d633['text']));var _0x1a7c11=this['googleCloudTTS'][_0x16da('0x6c')](this,_0x17d633);if(_0x1a7c11){this['channel'][_0x16da('0xa5')](util[_0x16da('0x25')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x1a7c11));var _0x273bed=this[_0x16da('0xd')][_0x16da('0xf7')](_0x1a7c11);try{fs[_0x16da('0xf8')](_0x1a7c11+'.wav');}catch(_0x315821){logger[_0x16da('0x29')](_0x315821);}return _0x273bed;}return this[_0x16da('0xd')]['error'](_0x17d633,_0x16da('0x1b5'));};AGIVertices[_0x16da('0x10')][_0x16da('0x1b6')]=function(_0x3abc42){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x1b7'),_0x3abc42[_0x16da('0x35')]));_0x3abc42['text']=_0x3abc42[_0x16da('0x5e')][_0x16da('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x16da('0xa0')](_0x3abc42[_0x16da('0x5e')])){return this[_0x16da('0xd')][_0x16da('0xa5')](_0x16da('0xa6'));}this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')]('Trying\x20Google\x20TTS\x20%s',_0x3abc42['text']));var _0x161ad9=this[_0x16da('0x5d')][_0x16da('0x6c')](this,_0x3abc42);if(_0x161ad9){this[_0x16da('0xd')][_0x16da('0xa5')](util['format'](_0x16da('0x1b8'),_0x161ad9));var _0x578e5e=this[_0x16da('0xd')][_0x16da('0xf7')](_0x161ad9);try{fs[_0x16da('0xf8')](_0x161ad9+_0x16da('0xf9'));}catch(_0x2f5fcf){logger[_0x16da('0x29')](_0x2f5fcf);}return _0x578e5e;}return this[_0x16da('0xd')]['error'](_0x3abc42,_0x16da('0x1b9'));};AGIVertices[_0x16da('0x10')][_0x16da('0x1ba')]=function(_0x215e07){logger['info'](util[_0x16da('0x25')](_0x16da('0x1bb'),_0x215e07['label']));if(!this[_0x16da('0xa0')](_0x215e07[_0x16da('0x148')])){return this[_0x16da('0xd')][_0x16da('0x29')](_0x215e07,'no\x20find\x20by\x20configured');}logger[_0x16da('0x2a')](util[_0x16da('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x16da('0x38')],_0x215e07['findBy']));var _0x532bb6=this[_0x16da('0x4f')]['sync'](this,_0x215e07[_0x16da('0x148')]);if(_0x532bb6){logger[_0x16da('0x2a')](util[_0x16da('0x25')](_0x16da('0x14b'),this[_0x16da('0xd')][_0x16da('0x38')],_0x215e07[_0x16da('0x148')]));this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x14b'),this[_0x16da('0xd')]['callerid'],_0x215e07['findBy']));return{'code':0xc8,'result':_0x16da('0x14c')};}else{logger[_0x16da('0x2a')](util[_0x16da('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x16da('0xd')]['callerid'],_0x215e07[_0x16da('0x148')]));this[_0x16da('0xd')]['noop'](util[_0x16da('0x25')](_0x16da('0x14d'),this[_0x16da('0xd')][_0x16da('0x38')],_0x215e07[_0x16da('0x148')]));return{'code':0xc8,'result':_0x16da('0x14e')};}};AGIVertices[_0x16da('0x10')][_0x16da('0x1bc')]=function(_0x2e0bf2){logger['info'](util[_0x16da('0x25')](_0x16da('0x1bd'),_0x2e0bf2[_0x16da('0x35')]));var _0x38b45e=this[_0x16da('0xd')][_0x16da('0xa7')](_0x16da('0x1be'),[_0x2e0bf2[_0x16da('0x1bf')],_0x2e0bf2[_0x16da('0x75')]]);if(_0x38b45e[_0x16da('0x9e')]===-0x1){return _0x38b45e;}return this[_0x16da('0xd')][_0x16da('0xa5')](util[_0x16da('0x25')](_0x16da('0x15b'),'VOICEMAIL',_0x2e0bf2['mailbox']));};AGIVertices[_0x16da('0x10')][_0x16da('0x1c0')]=function(_0x107553){logger['info'](util[_0x16da('0x25')](_0x16da('0x1c1'),_0x107553['label']));if(!this[_0x16da('0xa0')](_0x107553[_0x16da('0xcd')])){return this['channel'][_0x16da('0x29')](_0x107553,_0x16da('0x1a1'));}var _0x3ad89b=this[_0x16da('0x11')]['sync'](this,_0x107553[_0x16da('0xcd')]);if(!_0x3ad89b){return this[_0x16da('0xd')][_0x16da('0x29')](_0x107553,'no\x20variable\x20found');}var _0x38df5b=this[_0x16da('0xd')]['getVariable'](_0x3ad89b);return{'code':0xc8,'result':_0x38df5b[_0x16da('0x9c')]?_0x38df5b[_0x16da('0x9c')]:'-'};};String[_0x16da('0x10')]['replaceAll']=function(_0x39f87a,_0x59c3ae){return this[_0x16da('0x9b')](_0x39f87a)[_0x16da('0x1c2')](_0x59c3ae);};module[_0x16da('0x1c3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index e1c96e7..005ad51 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 _0xf620=['saveUnpause','update','catch','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','syncHangupRequest','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','message','[%s][TIMER][STOP][AGENT:%s]'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xf620,0x180));var _0x0f62=function(_0x3c9ea2,_0x23016b){_0x3c9ea2=_0x3c9ea2-0x0;var _0x3dfa3f=_0xf620[_0x3c9ea2];return _0x3dfa3f;};'use strict';var util=require(_0x0f62('0x0'));var _=require(_0x0f62('0x1'));var moment=require(_0x0f62('0x2'));var ami=require(_0x0f62('0x3'));var logger=require(_0x0f62('0x4'))(_0x0f62('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x0f62('0x6'));function Acw(_0x4a1752){this[_0x0f62('0x7')]=_0x4a1752[_0x0f62('0x7')];this[_0x0f62('0x8')]=_0x4a1752[_0x0f62('0x8')];this['timers']=_0x4a1752[_0x0f62('0x9')];this[_0x0f62('0xa')]={};ami['on'](_0x0f62('0xb'),this['syncAgentConnect'][_0x0f62('0xc')](this));ami['on'](_0x0f62('0xd'),this['syncHangupRequest'][_0x0f62('0xc')](this));ami['on'](_0x0f62('0xe'),this[_0x0f62('0xf')][_0x0f62('0xc')](this));ami['on']('agentringnoanswer',this[_0x0f62('0x10')]['bind'](this));ami['on'](_0x0f62('0x11'),this[_0x0f62('0x12')][_0x0f62('0xc')](this));ami['on'](_0x0f62('0x13'),this[_0x0f62('0x14')][_0x0f62('0xc')](this));ami['on'](_0x0f62('0x15'),this[_0x0f62('0x16')][_0x0f62('0xc')](this));}function getDiff(_0x2a1e93){var _0x2a2e96=moment()['milliseconds'](0x0);var _0x4dfb13=moment(_0x2a1e93)[_0x0f62('0x17')](0x0);return _0x2a2e96[_0x0f62('0x18')](_0x4dfb13,'seconds');}Acw[_0x0f62('0x19')][_0x0f62('0x1a')]=function(_0x2cac38){try{var _0x591933=this;var _0x469c88=this[_0x0f62('0xa')][_0x2cac38]['interface'];var _0x312942=this['channels'][_0x2cac38][_0x0f62('0x1b')];var _0x187b66=this[_0x0f62('0x7')][_0x312942];var _0x4d68c3=![];var _0x5ad7b4=_0x0f62('0x1c');if(_0x187b66[_0x0f62('0x1d')]){if(_0x187b66[_0x0f62('0x1e')][_0x0f62('0x1f')]){_0x4d68c3=!![];_0x5ad7b4=_0x187b66[_0x0f62('0x1e')][_0x0f62('0x1f')];}}ami[_0x0f62('0x20')]({'action':_0x0f62('0x21'),'interface':_0x469c88,'paused':!![],'reason':_0x5ad7b4})[_0x0f62('0x22')](function(_0x1f71c3){if(_0x591933['agents'][_0x469c88]){return RpcUser[_0x0f62('0x23')](_0x591933[_0x0f62('0x8')][_0x469c88]['id'])[_0x0f62('0x22')](function(_0x1cf115){if(_0x1cf115&&!_0x1cf115[_0x0f62('0x24')]){logger[_0x0f62('0x25')](_0x0f62('0x26'),_0x2cac38,_0x469c88,_0x312942);var _0x3d4acd=_0x591933[_0x0f62('0xa')][_0x2cac38][_0x0f62('0x27')]&&_0x591933[_0x0f62('0xa')][_0x2cac38][_0x0f62('0x28')]?_0x591933['channels'][_0x2cac38][_0x0f62('0x28')]:_0x2cac38;return RpcUser[_0x0f62('0x29')](_0x591933[_0x0f62('0x8')][_0x469c88],_0x5ad7b4,_0x3d4acd)['then'](function(_0x51939d){if(!_0x4d68c3){_0x591933[_0x0f62('0x9')][_0x469c88]={};logger[_0x0f62('0x25')](_0x0f62('0x2a'),_0x2cac38,_0x591933[_0x0f62('0x7')][_0x312942]['acwTimeout'],_0x469c88,_0x312942);_0x591933['timers'][_0x469c88][_0x0f62('0x2b')]=setTimeout(_0x591933[_0x0f62('0x2c')][_0x0f62('0xc')](_0x591933,_0x469c88),_0x591933[_0x0f62('0x7')][_0x312942][_0x0f62('0x2d')]*0x3e8);_0x591933[_0x0f62('0x9')][_0x469c88][_0x0f62('0x2e')]=moment()['format'](_0x0f62('0x2f'));_0x591933['timers'][_0x469c88][_0x0f62('0x30')]=_0x2cac38;_0x591933[_0x0f62('0x9')][_0x469c88][_0x0f62('0x1b')]=_0x312942;_0x591933[_0x0f62('0x9')][_0x469c88]['updateAcw']=function(){var _0x1516d6=getDiff(_0x591933['timers'][_0x469c88][_0x0f62('0x2e')]);clearTimeout(_0x591933[_0x0f62('0x9')][_0x469c88]['timer']);_0x591933[_0x0f62('0x9')][_0x469c88]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x1516d6},_0x591933['timers'][_0x469c88][_0x0f62('0x30')],_0x469c88)[_0x0f62('0x22')](function(_0x117a5e){logger['info'](_0x0f62('0x31'),_0x2cac38,_0x1516d6,_0x117a5e);})['catch'](function(_0x236491){logger['error'](_0x0f62('0x32'),_0x2cac38,_0x236491);});delete _0x591933['timers'][_0x469c88];};}});}else{logger[_0x0f62('0x25')](_0x0f62('0x33'),_0x2cac38,_0x469c88,_0x312942);}});}})['catch'](function(_0x10cd2a){logger[_0x0f62('0x34')](_0x0f62('0x2a'),_0x2cac38,_0x591933[_0x0f62('0x7')][_0x312942][_0x0f62('0x2d')],_0x469c88,_0x312942);})[_0x0f62('0x35')](function(){delete _0x591933[_0x0f62('0xa')][_0x2cac38];});}catch(_0x4a3f35){logger['error']('[ACW][START]\x20%s',_0x4a3f35[_0x0f62('0x36')]);}};Acw[_0x0f62('0x19')][_0x0f62('0x2c')]=function(_0x149b40){try{var _0x15e068=this;if(_0x15e068[_0x0f62('0x9')][_0x149b40]){_0x15e068[_0x0f62('0x9')][_0x149b40]['timer']=![];var _0x3ef088=_0x15e068[_0x0f62('0x9')][_0x149b40]['uniqueid'];var _0x491ee6=_0x15e068[_0x0f62('0x9')][_0x149b40][_0x0f62('0x1b')];var _0x21dcd8=_0x15e068[_0x0f62('0x7')][_0x491ee6]['acwTimeout'];logger['info'](_0x0f62('0x37'),_0x3ef088,_0x149b40);RpcUser[_0x0f62('0x38')](this[_0x0f62('0x8')][_0x149b40]);RpcVoiceAgentReport[_0x0f62('0x39')]({'acwtime':_0x21dcd8,'agentacw':!![]},_0x3ef088,_0x149b40)[_0x0f62('0x22')](function(_0x5e441c){logger[_0x0f62('0x25')](_0x0f62('0x31'),_0x3ef088,_0x21dcd8,_0x5e441c);})[_0x0f62('0x3a')](function(_0x4f6a43){logger[_0x0f62('0x34')]('[%s][UPDATE][ERRORS:%s]',_0x3ef088,_0x4f6a43);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x149b40);if(_0x15e068['timers']){logger[_0x0f62('0x25')](_0x0f62('0x3b'),JSON[_0x0f62('0x3c')](_0x15e068[_0x0f62('0x9')]));}}}catch(_0x4ac761){logger[_0x0f62('0x34')](_0x0f62('0x3d'),_0x4ac761[_0x0f62('0x36')]);}};Acw[_0x0f62('0x19')][_0x0f62('0x3e')]=function(_0x2fb6d3){try{if(this[_0x0f62('0x7')][_0x2fb6d3['queue']]&&(this[_0x0f62('0x7')][_0x2fb6d3[_0x0f62('0x1b')]][_0x0f62('0x5')]||this[_0x0f62('0x7')][_0x2fb6d3['queue']][_0x0f62('0x1d')])){if(this['agents'][_0x2fb6d3['interface']]){this[_0x0f62('0xa')][_0x2fb6d3[_0x0f62('0x30')]]={'queue':_0x2fb6d3[_0x0f62('0x1b')],'interface':_0x2fb6d3[_0x0f62('0x3f')],'destlinkedid':_0x2fb6d3[_0x0f62('0x28')]};}}}catch(_0x19c582){logger[_0x0f62('0x34')](_0x0f62('0x40'),_0x19c582[_0x0f62('0x36')]);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x52d7cb){try{if(this[_0x0f62('0x7')][_0x52d7cb[_0x0f62('0x1b')]]&&(this[_0x0f62('0x7')][_0x52d7cb[_0x0f62('0x1b')]][_0x0f62('0x5')]||this['voiceQueues'][_0x52d7cb[_0x0f62('0x1b')]][_0x0f62('0x1d')])){if(this[_0x0f62('0x8')][_0x52d7cb[_0x0f62('0x3f')]]){this['channels'][_0x52d7cb['uniqueid']]={'queue':_0x52d7cb['queue'],'interface':_0x52d7cb[_0x0f62('0x3f')]};}}}catch(_0x528a8a){logger[_0x0f62('0x34')]('[ACW][syncAgentConnectPreview]\x20%s',_0x528a8a[_0x0f62('0x36')]);}};Acw[_0x0f62('0x19')][_0x0f62('0x41')]=function(_0xba49c8){try{if(this[_0x0f62('0xa')][_0xba49c8[_0x0f62('0x30')]]&&_['isUndefined'](this[_0x0f62('0xa')][_0xba49c8['uniqueid']][_0x0f62('0x27')])){logger['info'](_0x0f62('0x42'),_0xba49c8[_0x0f62('0x30')]);this[_0x0f62('0x1a')](_0xba49c8['uniqueid']);}else if(this['channels'][_0xba49c8[_0x0f62('0x43')]]&&_['isUndefined'](this[_0x0f62('0xa')][_0xba49c8[_0x0f62('0x43')]][_0x0f62('0x27')])){logger[_0x0f62('0x25')](_0x0f62('0x44'),_0xba49c8[_0x0f62('0x43')]);this[_0x0f62('0x1a')](_0xba49c8['linkedid']);}}catch(_0x6e9ece){logger[_0x0f62('0x34')](_0x0f62('0x45'),_0x6e9ece['message']);}};Acw[_0x0f62('0x19')][_0x0f62('0xf')]=function(_0x36120f){try{if(this['channels'][_0x36120f[_0x0f62('0x30')]]&&this[_0x0f62('0xa')][_0x36120f[_0x0f62('0x30')]][_0x0f62('0x27')]){logger['info'](_0x0f62('0x46'),_0x36120f[_0x0f62('0x30')]);this['startAcw'](_0x36120f[_0x0f62('0x30')]);}else if(this['channels'][_0x36120f[_0x0f62('0x43')]]&&this[_0x0f62('0xa')][_0x36120f[_0x0f62('0x43')]][_0x0f62('0x27')]){logger[_0x0f62('0x25')](_0x0f62('0x47'),_0x36120f[_0x0f62('0x43')]);this[_0x0f62('0x1a')](_0x36120f[_0x0f62('0x43')]);}}catch(_0x754831){logger['error'](_0x0f62('0x48'),_0x754831['message']);}};Acw[_0x0f62('0x19')]['syncAttendedTransfer']=function(_0x384c04){try{if(!_[_0x0f62('0x49')](this[_0x0f62('0xa')][_0x384c04[_0x0f62('0x4a')]])){this['startAcw'](_0x384c04[_0x0f62('0x4a')]);if(this['channels'][_0x384c04[_0x0f62('0x4b')]]){this[_0x0f62('0xa')][_0x384c04[_0x0f62('0x4b')]][_0x0f62('0x27')]=!![];this['channels'][_0x384c04[_0x0f62('0x4c')]]=this[_0x0f62('0xa')][_0x384c04[_0x0f62('0x4b')]];delete this[_0x0f62('0xa')][_0x384c04['secondtransfereruniqueid']];}}else if(!_[_0x0f62('0x49')](this[_0x0f62('0xa')][_0x384c04['transfertargetuniqueid']])){this[_0x0f62('0x1a')](_0x384c04['transfertargetuniqueid']);if(this[_0x0f62('0xa')][_0x384c04[_0x0f62('0x4d')]]){this[_0x0f62('0xa')][_0x384c04['origtransfereruniqueid']][_0x0f62('0x27')]=!![];this[_0x0f62('0xa')][_0x384c04[_0x0f62('0x4a')]]=this[_0x0f62('0xa')][_0x384c04['origtransfereruniqueid']];delete this[_0x0f62('0xa')][_0x384c04['origtransfereruniqueid']];}}}catch(_0xd51a73){logger[_0x0f62('0x34')](_0x0f62('0x4e'),_0xd51a73[_0x0f62('0x36')]);}};Acw[_0x0f62('0x19')]['syncBlindTransfer']=function(_0x4ec050){try{if(this['channels'][_0x4ec050[_0x0f62('0x4f')]]){logger[_0x0f62('0x25')](_0x0f62('0x50'),JSON['stringify'](_0x4ec050['transfereruniqueid']));this['startAcw'](_0x4ec050[_0x0f62('0x4f')]);}else if(this[_0x0f62('0xa')][_0x4ec050[_0x0f62('0x51')]]){logger[_0x0f62('0x25')](_0x0f62('0x52'),JSON['stringify'](_0x4ec050[_0x0f62('0x51')]));this[_0x0f62('0x1a')](_0x4ec050[_0x0f62('0x51')]);}}catch(_0xbf61d3){logger[_0x0f62('0x34')](_0x0f62('0x53'),_0xbf61d3[_0x0f62('0x36')]);}};Acw[_0x0f62('0x19')][_0x0f62('0x10')]=function(_0x1dc1d1){try{if(this['voiceQueues'][_0x1dc1d1['queue']]&&this[_0x0f62('0x7')][_0x1dc1d1[_0x0f62('0x1b')]][_0x0f62('0x54')]==='all'){if(this[_0x0f62('0x8')][_0x1dc1d1[_0x0f62('0x3f')]]){logger[_0x0f62('0x25')](_0x0f62('0x55'),_0x1dc1d1['uniqueid'],_0x1dc1d1[_0x0f62('0x3f')],_0x1dc1d1[_0x0f62('0x1b')]);return RpcUser['savePause'](this[_0x0f62('0x8')][_0x1dc1d1[_0x0f62('0x3f')]],'Auto-Pause',_0x1dc1d1[_0x0f62('0x30')]);}}}catch(_0x2f3b49){logger['error'](_0x0f62('0x56'),_0x2f3b49['message']);}};module[_0x0f62('0x57')]=Acw; \ No newline at end of file +var _0x6cc6=['agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds','startAcw','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','then','timers','timer','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','catch','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][TIMERS]','prototype','acw','destlinkedid','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','transfereeuniqueid','secondtransfereruniqueid','isNil','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','exports','util','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup'];(function(_0x253a16,_0x46b21d){var _0x3cac98=function(_0x2640e4){while(--_0x2640e4){_0x253a16['push'](_0x253a16['shift']());}};_0x3cac98(++_0x46b21d);}(_0x6cc6,0xfd));var _0x66cc=function(_0x1ac00f,_0x42e6a6){_0x1ac00f=_0x1ac00f-0x0;var _0x5ada40=_0x6cc6[_0x1ac00f];return _0x5ada40;};'use strict';var util=require(_0x66cc('0x0'));var _=require(_0x66cc('0x1'));var moment=require(_0x66cc('0x2'));var ami=require(_0x66cc('0x3'));var logger=require(_0x66cc('0x4'))('acw');var RpcUser=require(_0x66cc('0x5'));var RpcVoiceAgentReport=require(_0x66cc('0x6'));function Acw(_0x399dc1){this[_0x66cc('0x7')]=_0x399dc1[_0x66cc('0x7')];this[_0x66cc('0x8')]=_0x399dc1[_0x66cc('0x8')];this['timers']=_0x399dc1['timers'];this[_0x66cc('0x9')]={};ami['on'](_0x66cc('0xa'),this[_0x66cc('0xb')][_0x66cc('0xc')](this));ami['on'](_0x66cc('0xd'),this[_0x66cc('0xe')][_0x66cc('0xc')](this));ami['on'](_0x66cc('0xf'),this[_0x66cc('0x10')][_0x66cc('0xc')](this));ami['on'](_0x66cc('0x11'),this[_0x66cc('0x12')][_0x66cc('0xc')](this));ami['on'](_0x66cc('0x13'),this['syncAttendedTransfer'][_0x66cc('0xc')](this));ami['on']('blindtransfer',this[_0x66cc('0x14')][_0x66cc('0xc')](this));ami['on'](_0x66cc('0x15'),this['syncAgentConnectPreview'][_0x66cc('0xc')](this));}function getDiff(_0xe1b7d9){var _0x39dd93=moment()[_0x66cc('0x16')](0x0);var _0x2d86f0=moment(_0xe1b7d9)['milliseconds'](0x0);return _0x39dd93['diff'](_0x2d86f0,_0x66cc('0x17'));}Acw['prototype'][_0x66cc('0x18')]=function(_0x4928bd){try{var _0xed10cd=this;var _0x82f5df=this[_0x66cc('0x9')][_0x4928bd][_0x66cc('0x19')];var _0x197b17=this['channels'][_0x4928bd][_0x66cc('0x1a')];var _0x2fbff0=this[_0x66cc('0x7')][_0x197b17];var _0x48d6ab=![];var _0x3ddd2b='ACW';if(_0x2fbff0[_0x66cc('0x1b')]){if(_0x2fbff0[_0x66cc('0x1c')][_0x66cc('0x1d')]){_0x48d6ab=!![];_0x3ddd2b=_0x2fbff0['mandatoryDispositionPause'][_0x66cc('0x1d')];}}ami[_0x66cc('0x1e')]({'action':_0x66cc('0x1f'),'interface':_0x82f5df,'paused':!![],'reason':_0x3ddd2b})['then'](function(_0x2d07c4){if(_0xed10cd[_0x66cc('0x8')][_0x82f5df]){return RpcUser[_0x66cc('0x20')](_0xed10cd['agents'][_0x82f5df]['id'])['then'](function(_0xc0fd9){if(_0xc0fd9&&!_0xc0fd9[_0x66cc('0x21')]){logger[_0x66cc('0x22')](_0x66cc('0x23'),_0x4928bd,_0x82f5df,_0x197b17);var _0xf0030d=_0xed10cd[_0x66cc('0x9')][_0x4928bd][_0x66cc('0x24')]&&_0xed10cd[_0x66cc('0x9')][_0x4928bd]['destlinkedid']?_0xed10cd[_0x66cc('0x9')][_0x4928bd]['destlinkedid']:_0x4928bd;return RpcUser['savePause'](_0xed10cd['agents'][_0x82f5df],_0x3ddd2b,_0xf0030d)[_0x66cc('0x25')](function(_0x3fb81c){if(!_0x48d6ab){_0xed10cd[_0x66cc('0x26')][_0x82f5df]={};logger[_0x66cc('0x22')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4928bd,_0xed10cd[_0x66cc('0x7')][_0x197b17]['acwTimeout'],_0x82f5df,_0x197b17);_0xed10cd['timers'][_0x82f5df][_0x66cc('0x27')]=setTimeout(_0xed10cd[_0x66cc('0x28')][_0x66cc('0xc')](_0xed10cd,_0x82f5df),_0xed10cd[_0x66cc('0x7')][_0x197b17][_0x66cc('0x29')]*0x3e8);_0xed10cd[_0x66cc('0x26')][_0x82f5df][_0x66cc('0x2a')]=moment()[_0x66cc('0x2b')](_0x66cc('0x2c'));_0xed10cd[_0x66cc('0x26')][_0x82f5df][_0x66cc('0x2d')]=_0x4928bd;_0xed10cd[_0x66cc('0x26')][_0x82f5df][_0x66cc('0x1a')]=_0x197b17;_0xed10cd[_0x66cc('0x26')][_0x82f5df][_0x66cc('0x2e')]=function(){var _0x4c09b8=getDiff(_0xed10cd[_0x66cc('0x26')][_0x82f5df][_0x66cc('0x2a')]);clearTimeout(_0xed10cd[_0x66cc('0x26')][_0x82f5df]['timer']);_0xed10cd['timers'][_0x82f5df][_0x66cc('0x27')]=![];RpcVoiceAgentReport[_0x66cc('0x2f')]({'acwtime':_0x4c09b8},_0xed10cd[_0x66cc('0x26')][_0x82f5df][_0x66cc('0x2d')],_0x82f5df)[_0x66cc('0x25')](function(_0x5a6067){logger[_0x66cc('0x22')](_0x66cc('0x30'),_0x4928bd,_0x4c09b8,_0x5a6067);})['catch'](function(_0x2f9d4c){logger[_0x66cc('0x31')](_0x66cc('0x32'),_0x4928bd,_0x2f9d4c);});delete _0xed10cd[_0x66cc('0x26')][_0x82f5df];};}});}else{logger[_0x66cc('0x22')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x4928bd,_0x82f5df,_0x197b17);}});}})[_0x66cc('0x33')](function(_0xa0dc5d){logger['error'](_0x66cc('0x34'),_0x4928bd,_0xed10cd[_0x66cc('0x7')][_0x197b17]['acwTimeout'],_0x82f5df,_0x197b17);})[_0x66cc('0x35')](function(){delete _0xed10cd[_0x66cc('0x9')][_0x4928bd];});}catch(_0x323089){logger[_0x66cc('0x31')](_0x66cc('0x36'),_0x323089[_0x66cc('0x37')]);}};Acw['prototype'][_0x66cc('0x28')]=function(_0x5630e5){try{var _0x1943e8=this;if(_0x1943e8[_0x66cc('0x26')][_0x5630e5]){_0x1943e8['timers'][_0x5630e5][_0x66cc('0x27')]=![];var _0x185a25=_0x1943e8['timers'][_0x5630e5][_0x66cc('0x2d')];var _0xf58b98=_0x1943e8['timers'][_0x5630e5]['queue'];var _0x40f976=_0x1943e8['voiceQueues'][_0xf58b98][_0x66cc('0x29')];logger['info'](_0x66cc('0x38'),_0x185a25,_0x5630e5);RpcUser[_0x66cc('0x39')](this[_0x66cc('0x8')][_0x5630e5]);RpcVoiceAgentReport[_0x66cc('0x2f')]({'acwtime':_0x40f976,'agentacw':!![]},_0x185a25,_0x5630e5)['then'](function(_0x37d0c3){logger[_0x66cc('0x22')](_0x66cc('0x30'),_0x185a25,_0x40f976,_0x37d0c3);})[_0x66cc('0x33')](function(_0x1c7cbc){logger[_0x66cc('0x31')](_0x66cc('0x32'),_0x185a25,_0x1c7cbc);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x5630e5);if(_0x1943e8[_0x66cc('0x26')]){logger[_0x66cc('0x22')](_0x66cc('0x3a'),JSON['stringify'](_0x1943e8[_0x66cc('0x26')]));}}}catch(_0x1bb221){logger[_0x66cc('0x31')]('[ACW][STOP]\x20%s',_0x1bb221['message']);}};Acw[_0x66cc('0x3b')][_0x66cc('0xb')]=function(_0x5e5d8e){try{if(this[_0x66cc('0x7')][_0x5e5d8e[_0x66cc('0x1a')]]&&(this[_0x66cc('0x7')][_0x5e5d8e['queue']][_0x66cc('0x3c')]||this[_0x66cc('0x7')][_0x5e5d8e[_0x66cc('0x1a')]][_0x66cc('0x1b')])){if(this[_0x66cc('0x8')][_0x5e5d8e[_0x66cc('0x19')]]){this[_0x66cc('0x9')][_0x5e5d8e['uniqueid']]={'queue':_0x5e5d8e['queue'],'interface':_0x5e5d8e[_0x66cc('0x19')],'destlinkedid':_0x5e5d8e[_0x66cc('0x3d')]};}}}catch(_0x2092f2){logger['error'](_0x66cc('0x3e'),_0x2092f2[_0x66cc('0x37')]);}};Acw[_0x66cc('0x3b')][_0x66cc('0x3f')]=function(_0xa88df1){try{if(this[_0x66cc('0x7')][_0xa88df1['queue']]&&(this[_0x66cc('0x7')][_0xa88df1[_0x66cc('0x1a')]]['acw']||this[_0x66cc('0x7')][_0xa88df1['queue']][_0x66cc('0x1b')])){if(this[_0x66cc('0x8')][_0xa88df1[_0x66cc('0x19')]]){this[_0x66cc('0x9')][_0xa88df1[_0x66cc('0x2d')]]={'queue':_0xa88df1[_0x66cc('0x1a')],'interface':_0xa88df1['interface']};}}}catch(_0x3afc94){logger[_0x66cc('0x31')](_0x66cc('0x40'),_0x3afc94[_0x66cc('0x37')]);}};Acw[_0x66cc('0x3b')]['syncHangupRequest']=function(_0x5962a0){try{if(this['channels'][_0x5962a0['uniqueid']]&&_[_0x66cc('0x41')](this[_0x66cc('0x9')][_0x5962a0['uniqueid']]['attended'])){logger[_0x66cc('0x22')](_0x66cc('0x42'),_0x5962a0['uniqueid']);this[_0x66cc('0x18')](_0x5962a0[_0x66cc('0x2d')]);}else if(this['channels'][_0x5962a0[_0x66cc('0x43')]]&&_[_0x66cc('0x41')](this[_0x66cc('0x9')][_0x5962a0['linkedid']][_0x66cc('0x24')])){logger[_0x66cc('0x22')](_0x66cc('0x44'),_0x5962a0[_0x66cc('0x43')]);this[_0x66cc('0x18')](_0x5962a0[_0x66cc('0x43')]);}}catch(_0x38ae55){logger[_0x66cc('0x31')](_0x66cc('0x45'),_0x38ae55[_0x66cc('0x37')]);}};Acw[_0x66cc('0x3b')][_0x66cc('0x10')]=function(_0x10551f){try{if(this[_0x66cc('0x9')][_0x10551f[_0x66cc('0x2d')]]&&this[_0x66cc('0x9')][_0x10551f[_0x66cc('0x2d')]][_0x66cc('0x24')]){logger[_0x66cc('0x22')](_0x66cc('0x46'),_0x10551f[_0x66cc('0x2d')]);this[_0x66cc('0x18')](_0x10551f['uniqueid']);}else if(this[_0x66cc('0x9')][_0x10551f[_0x66cc('0x43')]]&&this[_0x66cc('0x9')][_0x10551f[_0x66cc('0x43')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x10551f[_0x66cc('0x43')]);this[_0x66cc('0x18')](_0x10551f[_0x66cc('0x43')]);}}catch(_0x104111){logger[_0x66cc('0x31')](_0x66cc('0x47'),_0x104111['message']);}};Acw[_0x66cc('0x3b')][_0x66cc('0x48')]=function(_0x1323b2){try{if(!_['isNil'](this[_0x66cc('0x9')][_0x1323b2[_0x66cc('0x49')]])){this[_0x66cc('0x18')](_0x1323b2[_0x66cc('0x49')]);if(this['channels'][_0x1323b2[_0x66cc('0x4a')]]){this[_0x66cc('0x9')][_0x1323b2[_0x66cc('0x4a')]][_0x66cc('0x24')]=!![];this[_0x66cc('0x9')][_0x1323b2['transfertargetuniqueid']]=this[_0x66cc('0x9')][_0x1323b2[_0x66cc('0x4a')]];delete this[_0x66cc('0x9')][_0x1323b2['secondtransfereruniqueid']];}}else if(!_[_0x66cc('0x4b')](this['channels'][_0x1323b2[_0x66cc('0x4c')]])){this[_0x66cc('0x18')](_0x1323b2[_0x66cc('0x4c')]);if(this['channels'][_0x1323b2[_0x66cc('0x4d')]]){this['channels'][_0x1323b2[_0x66cc('0x4d')]][_0x66cc('0x24')]=!![];this['channels'][_0x1323b2[_0x66cc('0x49')]]=this[_0x66cc('0x9')][_0x1323b2[_0x66cc('0x4d')]];delete this[_0x66cc('0x9')][_0x1323b2[_0x66cc('0x4d')]];}}}catch(_0x10f9f3){logger[_0x66cc('0x31')](_0x66cc('0x4e'),_0x10f9f3[_0x66cc('0x37')]);}};Acw[_0x66cc('0x3b')][_0x66cc('0x14')]=function(_0x4d5bfc){try{if(this[_0x66cc('0x9')][_0x4d5bfc['transfereruniqueid']]){logger['info'](_0x66cc('0x4f'),JSON[_0x66cc('0x50')](_0x4d5bfc[_0x66cc('0x51')]));this[_0x66cc('0x18')](_0x4d5bfc[_0x66cc('0x51')]);}else if(this[_0x66cc('0x9')][_0x4d5bfc[_0x66cc('0x52')]]){logger[_0x66cc('0x22')](_0x66cc('0x53'),JSON['stringify'](_0x4d5bfc['transfererlinkedid']));this[_0x66cc('0x18')](_0x4d5bfc[_0x66cc('0x52')]);}}catch(_0xefb7dc){logger[_0x66cc('0x31')](_0x66cc('0x54'),_0xefb7dc[_0x66cc('0x37')]);}};Acw['prototype'][_0x66cc('0x12')]=function(_0x3fe994){try{if(this[_0x66cc('0x7')][_0x3fe994['queue']]&&this[_0x66cc('0x7')][_0x3fe994[_0x66cc('0x1a')]][_0x66cc('0x55')]==='all'){if(this[_0x66cc('0x8')][_0x3fe994['interface']]){logger['info'](_0x66cc('0x56'),_0x3fe994[_0x66cc('0x2d')],_0x3fe994['interface'],_0x3fe994[_0x66cc('0x1a')]);return RpcUser[_0x66cc('0x57')](this['agents'][_0x3fe994[_0x66cc('0x19')]],_0x66cc('0x58'),_0x3fe994[_0x66cc('0x2d')]);}}}catch(_0x10fbe8){logger[_0x66cc('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x10fbe8[_0x66cc('0x37')]);}};module[_0x66cc('0x59')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index f85c7c0..803200c 100644 --- a/server/services/ami/ami.js +++ b/server/services/ami/ami.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','exports','bluebird','moment','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList'];(function(_0x26a169,_0x54f908){var _0x1f07a1=function(_0x344027){while(--_0x344027){_0x26a169['push'](_0x26a169['shift']());}};_0x1f07a1(++_0x54f908);}(_0x757a,0xde));var _0xa757=function(_0x15c60b,_0x55d12a){_0x15c60b=_0x15c60b-0x0;var _0x4f6463=_0x757a[_0x15c60b];return _0x4f6463;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')(_0xa757('0x2'));var config=require(_0xa757('0x3'));var ami=new Manager(config[_0xa757('0x4')][_0xa757('0x5')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')]['username'],config[_0xa757('0x4')][_0xa757('0x6')],!![]);ami['keepConnected']();ami[_0xa757('0x7')]=BPromise[_0xa757('0x8')](ami[_0xa757('0x9')]);function error(_0x1a95ee){logger[_0xa757('0xa')](util['format'](_0xa757('0xb'),config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x1a95ee,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa757('0x4')]['ip'],config['asterisk']['port']));}ami[_0xa757('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xa757('0xf')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x10')});};};ami[_0xa757('0x11')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x12')});};};ami[_0xa757('0x13')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x14')});};};ami[_0xa757('0x15')]=function(){return function(){return ami['Action']({'action':_0xa757('0x16')});};};function connect(_0x44eab8){logger[_0xa757('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));ami[_0xa757('0x18')]('error',error);ami[_0xa757('0x18')]('close',close);}ami['on'](_0xa757('0x19'),connect);ami['on'](_0xa757('0x1a'),function(_0x14014c){logger[_0xa757('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x14014c,![],null)));});ami['on'](_0xa757('0x1b'),function(_0x21f1af){logger[_0xa757('0x17')](util['format'](_0xa757('0x1c'),config['asterisk'][_0xa757('0xc')],config['asterisk']['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));return BPromise[_0xa757('0x1d')]()['then'](ami[_0xa757('0xe')]())[_0xa757('0x1e')](ami[_0xa757('0xf')]())[_0xa757('0x1e')](ami['actionSipPeerStatus']())[_0xa757('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0xfdf69d){logger['error'](_0xa757('0x1f'),util[_0xa757('0xd')](_0xfdf69d,{'showHidden':![],'depth':null}));});});ami['once'](_0xa757('0xa'),error);ami['once'](_0xa757('0x20'),close);module[_0xa757('0x21')]=ami; \ No newline at end of file +var _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x434973,_0x95d438){var _0x11cf5e=function(_0x38696f){while(--_0x38696f){_0x434973['push'](_0x434973['shift']());}};_0x11cf5e(++_0x95d438);}(_0x0b0e,0x187));var _0xe0b0=function(_0xd3e0b9,_0xd80d4d){_0xd3e0b9=_0xd3e0b9-0x0;var _0x470133=_0x0b0e[_0xd3e0b9];return _0x470133;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),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 7a39627..6584a18 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 _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x3b56c0,_0xe100d8){var _0x377efe=function(_0x181589){while(--_0x181589){_0x3b56c0['push'](_0x3b56c0['shift']());}};_0x377efe(++_0xe100d8);}(_0xe706,0xa3));var _0x6e70=function(_0x524021,_0x25d5ea){_0x524021=_0x524021-0x0;var _0x269c3e=_0xe706[_0x524021];return _0x269c3e;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file +var _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x2ced4f,_0x54891c){var _0x5acd2a=function(_0x3ff619){while(--_0x3ff619){_0x2ced4f['push'](_0x2ced4f['shift']());}};_0x5acd2a(++_0x54891c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index b5b3f90..db15b2c 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 _0x22ea=['callbackuniqueid','callbackat','originatecalleridname','prototype','getCaller','dialCutDigit','exports','util','lodash','moment','isNil','string','voiceQueue','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback'];(function(_0xe07094,_0x1cd13b){var _0x2d447b=function(_0x417dc5){while(--_0x417dc5){_0xe07094['push'](_0xe07094['shift']());}};_0x2d447b(++_0x1cd13b);}(_0x22ea,0x14f));var _0xa22e=function(_0x33cf59,_0x5dc4f1){_0x33cf59=_0x33cf59-0x0;var _0xaa7d6b=_0x22ea[_0x33cf59];return _0xaa7d6b;};'use strict';var util=require(_0xa22e('0x0'));var _=require(_0xa22e('0x1'));var moment=require(_0xa22e('0x2'));function checkNameSurname(_0x10be0c,_0x482c13,_0x551261){var _0x3846a5='';if(!_[_0xa22e('0x3')](_0x482c13)&&_0xa22e('0x4')===typeof _0x482c13){_0x3846a5+=_0x482c13;}if(!_['isNil'](_0x551261)&&_0xa22e('0x4')===typeof _0x551261){_0x3846a5+='\x20'+_0x551261;}if(_0x3846a5!==''){return _0x3846a5;}return _0x10be0c;}function Action(_0x3f9bdc,_0x145d02,_0x5c426a){this[_0xa22e('0x5')]=_0x3f9bdc;this['uniqueid']=_0x5c426a||undefined;this[_0xa22e('0x6')]=checkNameSurname(_0x145d02[_0xa22e('0x7')][_0xa22e('0x8')],_0x145d02[_0xa22e('0x7')]['firstName'],_0x145d02[_0xa22e('0x7')][_0xa22e('0x9')]);this[_0xa22e('0xa')]=_0x145d02['Contact'][_0xa22e('0x8')];this[_0xa22e('0xb')]=_0x3f9bdc[_0xa22e('0x6')];this[_0xa22e('0xc')]=_0x145d02[_0xa22e('0xc')]||![];this['type']=_0x3f9bdc[_0xa22e('0xd')];this[_0xa22e('0xe')]=_0x3f9bdc[_0xa22e('0xe')]||0x3;this[_0xa22e('0xf')]=_0x145d02[_0xa22e('0xf')];this[_0xa22e('0x10')]=_0x145d02['countbusyretry'];this[_0xa22e('0x11')]=_0x145d02[_0xa22e('0x11')];this[_0xa22e('0x12')]=_0x145d02[_0xa22e('0x12')];this[_0xa22e('0x13')]=_0x145d02[_0xa22e('0x13')];this[_0xa22e('0x14')]=_0x145d02[_0xa22e('0x14')];this[_0xa22e('0x15')]=_0x145d02[_0xa22e('0x15')];this['countmachineretry']=_0x145d02[_0xa22e('0x16')];this[_0xa22e('0x17')]=_0x145d02[_0xa22e('0x17')];this['ContactId']=_0x145d02['ContactId'];this[_0xa22e('0x18')]=_0x145d02['ListId'];this['UserId']=_0x145d02[_0xa22e('0x19')];this[_0xa22e('0x1a')]=_0x145d02[_0xa22e('0x1a')];this['CampaignId']=_0x145d02[_0xa22e('0x1b')];this['idHopper']=_0x145d02['id'];this[_0xa22e('0x1c')]=_0x145d02[_0xa22e('0x7')][_0xa22e('0x1d')]||'';this[_0xa22e('0x1e')]=moment()[_0xa22e('0x1f')](_0xa22e('0x20'));this[_0xa22e('0x21')]=_0x145d02[_0xa22e('0x21')];this[_0xa22e('0x22')]=_0x145d02[_0xa22e('0x22')];this[_0xa22e('0x23')]=_0x145d02[_0xa22e('0x23')];this['recallme']=_0x145d02['recallme'];this['originatecalleridnum']='';this[_0xa22e('0x24')]='';}Action[_0xa22e('0x25')][_0xa22e('0x26')]=function(){return util[_0xa22e('0x1f')]('\x22%s\x22\x20<%s>',this[_0xa22e('0x6')],this[_0xa22e('0x5')]['dialCutDigit']>0x0?this[_0xa22e('0xa')]['substring'](this[_0xa22e('0x5')][_0xa22e('0x27')]):this['number']);};Action['prototype']['getQueue']=function(){return this[_0xa22e('0xb')];};module[_0xa22e('0x28')]=Action; \ No newline at end of file +var _0x17f8=['moment','isNil','string','voiceQueue','name','Contact','phone','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','getQueue','queue','exports','util','lodash'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x17f8,0xb6));var _0x817f=function(_0x40e00e,_0xe3ddfa){_0x40e00e=_0x40e00e-0x0;var _0x1050de=_0x17f8[_0x40e00e];return _0x1050de;};'use strict';var util=require(_0x817f('0x0'));var _=require(_0x817f('0x1'));var moment=require(_0x817f('0x2'));function checkNameSurname(_0x1ad9a7,_0x441745,_0x437b9a){var _0x5f31d5='';if(!_[_0x817f('0x3')](_0x441745)&&_0x817f('0x4')===typeof _0x441745){_0x5f31d5+=_0x441745;}if(!_[_0x817f('0x3')](_0x437b9a)&&_0x817f('0x4')===typeof _0x437b9a){_0x5f31d5+='\x20'+_0x437b9a;}if(_0x5f31d5!==''){return _0x5f31d5;}return _0x1ad9a7;}function Action(_0x5b803b,_0x175ab5,_0x176376){this[_0x817f('0x5')]=_0x5b803b;this['uniqueid']=_0x176376||undefined;this[_0x817f('0x6')]=checkNameSurname(_0x175ab5[_0x817f('0x7')][_0x817f('0x8')],_0x175ab5[_0x817f('0x7')]['firstName'],_0x175ab5[_0x817f('0x7')][_0x817f('0x9')]);this[_0x817f('0xa')]=_0x175ab5[_0x817f('0x7')][_0x817f('0x8')];this['queue']=_0x5b803b[_0x817f('0x6')];this[_0x817f('0xb')]=_0x175ab5[_0x817f('0xb')]||![];this[_0x817f('0xc')]=_0x5b803b[_0x817f('0xc')];this[_0x817f('0xd')]=_0x5b803b[_0x817f('0xd')]||0x3;this[_0x817f('0xe')]=_0x175ab5[_0x817f('0xe')];this[_0x817f('0xf')]=_0x175ab5['countbusyretry'];this[_0x817f('0x10')]=_0x175ab5[_0x817f('0x10')];this[_0x817f('0x11')]=_0x175ab5[_0x817f('0x11')];this['countnosuchnumberretry']=_0x175ab5[_0x817f('0x12')];this['countdropretry']=_0x175ab5['countdropretry'];this[_0x817f('0x13')]=_0x175ab5[_0x817f('0x13')];this[_0x817f('0x14')]=_0x175ab5[_0x817f('0x14')];this[_0x817f('0x15')]=_0x175ab5['countagentrejectretry'];this[_0x817f('0x16')]=_0x175ab5[_0x817f('0x16')];this[_0x817f('0x17')]=_0x175ab5[_0x817f('0x17')];this['UserId']=_0x175ab5[_0x817f('0x18')];this[_0x817f('0x19')]=_0x175ab5[_0x817f('0x19')];this[_0x817f('0x1a')]=_0x175ab5[_0x817f('0x1a')];this[_0x817f('0x1b')]=_0x175ab5['id'];this[_0x817f('0x1c')]=_0x175ab5['Contact'][_0x817f('0x1d')]||'';this[_0x817f('0x1e')]=moment()[_0x817f('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x817f('0x20')]=_0x175ab5[_0x817f('0x20')];this[_0x817f('0x21')]=_0x175ab5[_0x817f('0x21')];this[_0x817f('0x22')]=_0x175ab5['callbackat'];this[_0x817f('0x23')]=_0x175ab5['recallme'];this[_0x817f('0x24')]='';this[_0x817f('0x25')]='';}Action[_0x817f('0x26')][_0x817f('0x27')]=function(){return util[_0x817f('0x1f')](_0x817f('0x28'),this[_0x817f('0x6')],this[_0x817f('0x5')]['dialCutDigit']>0x0?this[_0x817f('0xa')][_0x817f('0x29')](this[_0x817f('0x5')][_0x817f('0x2a')]):this[_0x817f('0xa')]);};Action['prototype'][_0x817f('0x2b')]=function(){return this[_0x817f('0x2c')];};module[_0x817f('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index c03b6ee..5ccc91b 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 _0x8cff=['countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name','number','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0x8cff,0x19a));var _0xf8cf=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8cff[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0xf8cf('0x0'));var _=require('lodash');var moment=require(_0xf8cf('0x1'));function getSeconds(_0x2ab7d3,_0x2ba060){var _0x436351=moment(_0x2ab7d3)[_0xf8cf('0x2')](0x0);var _0x3bc352=moment(_0x2ba060)[_0xf8cf('0x2')](0x0);return _0x436351['diff'](_0x3bc352,'seconds');}function AgentComplete(_0x84b150,_0x52af83){this['state']=0x4;this['statedesc']=_0xf8cf('0x3');this[_0xf8cf('0x4')]=_0x84b150[_0xf8cf('0x4')];this[_0xf8cf('0x5')]=_0x84b150[_0xf8cf('0x5')];this[_0xf8cf('0x6')]=_0x84b150['type']==='outbound'?_0xf8cf('0x7'):_0x84b150[_0xf8cf('0x5')];this['countbusyretry']=_0x84b150[_0xf8cf('0x8')];this[_0xf8cf('0x9')]=_0x84b150[_0xf8cf('0x9')];this[_0xf8cf('0xa')]=_0x84b150[_0xf8cf('0xa')];this['countglobal']=_0x84b150[_0xf8cf('0x8')]+_0x84b150['countcongestionretry']+_0x84b150[_0xf8cf('0xa')]+_0x84b150['countnosuchnumberretry']+_0x84b150[_0xf8cf('0xb')]+_0x84b150[_0xf8cf('0xc')]+_0x84b150['countmachineretry']+_0x84b150[_0xf8cf('0xd')];this[_0xf8cf('0xe')]=_0x84b150[_0xf8cf('0xe')];this[_0xf8cf('0xb')]=_0x84b150[_0xf8cf('0xb')];this[_0xf8cf('0xc')]=_0x84b150[_0xf8cf('0xc')];this[_0xf8cf('0xf')]=_0x84b150[_0xf8cf('0xf')];this[_0xf8cf('0xd')]=_0x84b150[_0xf8cf('0xd')];this['uniqueid']=_0x52af83[_0xf8cf('0x10')];this[_0xf8cf('0x11')]=_0x84b150[_0xf8cf('0x12')];this['calleridnum']=_0x84b150[_0xf8cf('0x13')];this['starttime']=_0x84b150['starttime'];this[_0xf8cf('0x14')]=_0x84b150[_0xf8cf('0x14')];this[_0xf8cf('0x15')]=_0x84b150[_0xf8cf('0x15')];this[_0xf8cf('0x16')]=moment()['format'](_0xf8cf('0x17'));this[_0xf8cf('0x18')]=getSeconds(_0x84b150['responsetime'],_0x84b150[_0xf8cf('0x19')]);this[_0xf8cf('0x1a')]=getSeconds(_0x84b150[_0xf8cf('0x15')],_0x84b150['responsetime']);this[_0xf8cf('0x1b')]=getSeconds(this[_0xf8cf('0x16')],_0x84b150[_0xf8cf('0x15')]);this[_0xf8cf('0x7')]=_0x52af83['queue'];this['membername']=_0x52af83[_0xf8cf('0x1c')];this[_0xf8cf('0x1d')]=_0x52af83['reason'];this[_0xf8cf('0x1e')]=_0x84b150[_0xf8cf('0x1e')];this[_0xf8cf('0x1f')]=_0x84b150[_0xf8cf('0x1f')];this[_0xf8cf('0x20')]=_0x84b150[_0xf8cf('0x20')];this[_0xf8cf('0x21')]=_0x84b150['recallme'];this['ContactId']=_0x84b150[_0xf8cf('0x22')];this[_0xf8cf('0x23')]=_0x84b150[_0xf8cf('0x23')];this['UserId']=_0x84b150[_0xf8cf('0x24')];this[_0xf8cf('0x25')]=_0x84b150[_0xf8cf('0x25')];this[_0xf8cf('0x26')]=_0x84b150[_0xf8cf('0x26')];this['originatecalleridnum']=_0x84b150[_0xf8cf('0x27')]||'';this['originatecalleridname']=_0x84b150[_0xf8cf('0x28')]||'';}module[_0xf8cf('0x29')]=AgentComplete; \ No newline at end of file +var _0x6707=['seconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','moment','milliseconds'];(function(_0x3f0f2e,_0xf2b92d){var _0x49fc6f=function(_0x4a2274){while(--_0x4a2274){_0x3f0f2e['push'](_0x3f0f2e['shift']());}};_0x49fc6f(++_0xf2b92d);}(_0x6707,0x12b));var _0x7670=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x6707[_0x2eb5bc];return _0x51c7b1;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x7670('0x0'));function getSeconds(_0x5e7f97,_0x4ecbca){var _0x1d7c3a=moment(_0x5e7f97)[_0x7670('0x1')](0x0);var _0x352c75=moment(_0x4ecbca)['milliseconds'](0x0);return _0x1d7c3a['diff'](_0x352c75,_0x7670('0x2'));}function AgentComplete(_0x223b09,_0x2f549e){this[_0x7670('0x3')]=0x4;this[_0x7670('0x4')]=_0x7670('0x5');this[_0x7670('0x6')]=_0x223b09[_0x7670('0x6')];this[_0x7670('0x7')]=_0x223b09['type'];this[_0x7670('0x8')]=_0x223b09[_0x7670('0x7')]==='outbound'?_0x7670('0x9'):_0x223b09[_0x7670('0x7')];this[_0x7670('0xa')]=_0x223b09[_0x7670('0xa')];this['countcongestionretry']=_0x223b09[_0x7670('0xb')];this[_0x7670('0xc')]=_0x223b09[_0x7670('0xc')];this['countglobal']=_0x223b09[_0x7670('0xa')]+_0x223b09['countcongestionretry']+_0x223b09['countnoanswerretry']+_0x223b09['countnosuchnumberretry']+_0x223b09[_0x7670('0xd')]+_0x223b09[_0x7670('0xe')]+_0x223b09[_0x7670('0xf')]+_0x223b09[_0x7670('0x10')];this[_0x7670('0x11')]=_0x223b09[_0x7670('0x11')];this[_0x7670('0xd')]=_0x223b09[_0x7670('0xd')];this[_0x7670('0xe')]=_0x223b09[_0x7670('0xe')];this[_0x7670('0xf')]=_0x223b09['countmachineretry'];this[_0x7670('0x10')]=_0x223b09[_0x7670('0x10')];this[_0x7670('0x12')]=_0x2f549e[_0x7670('0x12')];this[_0x7670('0x13')]=_0x223b09[_0x7670('0x14')];this[_0x7670('0x15')]=_0x223b09[_0x7670('0x16')];this[_0x7670('0x17')]=_0x223b09[_0x7670('0x17')];this[_0x7670('0x18')]=_0x223b09['responsetime'];this[_0x7670('0x19')]=_0x223b09[_0x7670('0x19')];this[_0x7670('0x1a')]=moment()[_0x7670('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7670('0x1c')]=getSeconds(_0x223b09[_0x7670('0x18')],_0x223b09[_0x7670('0x17')]);this[_0x7670('0x1d')]=getSeconds(_0x223b09[_0x7670('0x19')],_0x223b09[_0x7670('0x18')]);this[_0x7670('0x1e')]=getSeconds(this[_0x7670('0x1a')],_0x223b09[_0x7670('0x19')]);this[_0x7670('0x9')]=_0x2f549e['queue'];this[_0x7670('0x1f')]=_0x2f549e[_0x7670('0x1f')];this[_0x7670('0x20')]=_0x2f549e[_0x7670('0x20')];this[_0x7670('0x21')]=_0x223b09[_0x7670('0x21')];this['callbackuniqueid']=_0x223b09[_0x7670('0x22')];this['callbackat']=_0x223b09[_0x7670('0x23')];this[_0x7670('0x24')]=_0x223b09[_0x7670('0x24')];this[_0x7670('0x25')]=_0x223b09[_0x7670('0x25')];this['ListId']=_0x223b09['ListId'];this[_0x7670('0x26')]=_0x223b09[_0x7670('0x26')];this[_0x7670('0x27')]=_0x223b09['VoiceQueueId'];this[_0x7670('0x28')]=_0x223b09['CampaignId'];this[_0x7670('0x29')]=_0x223b09[_0x7670('0x29')]||'';this['originatecalleridname']=_0x223b09['originatecalleridname']||'';}module[_0x7670('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index f3f4e7d..2913baa 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 _0x1af3=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x1af3,0x1ca));var _0x31af=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x1af3[_0x1cbcf1];return _0x3a06f0;};'use strict';var util=require(_0x31af('0x0'));var _=require(_0x31af('0x1'));var moment=require(_0x31af('0x2'));function getSeconds(_0x1f7c8f,_0x450506){var _0xf27e22=moment(_0x1f7c8f)[_0x31af('0x3')](0x0);var _0x1a6ea6=moment(_0x450506)[_0x31af('0x3')](0x0);return _0xf27e22[_0x31af('0x4')](_0x1a6ea6,'seconds');}function Final(_0x19acd1){this[_0x31af('0x5')]=_0x19acd1[_0x31af('0x5')];this[_0x31af('0x6')]=_0x19acd1['scheduledat'];this[_0x31af('0x7')]=_0x19acd1[_0x31af('0x7')];this[_0x31af('0x8')]=_0x19acd1['type']===_0x31af('0x9')?_0x31af('0xa'):_0x19acd1[_0x31af('0x7')];this[_0x31af('0xb')]=_0x19acd1[_0x31af('0xb')];this[_0x31af('0xc')]=_0x19acd1[_0x31af('0xc')];this[_0x31af('0xd')]=_0x19acd1['countnoanswerretry'];this[_0x31af('0xe')]=_0x19acd1[_0x31af('0xb')]+_0x19acd1[_0x31af('0xc')]+_0x19acd1[_0x31af('0xd')]+_0x19acd1[_0x31af('0xf')]+_0x19acd1['countdropretry']+_0x19acd1[_0x31af('0x10')]+_0x19acd1[_0x31af('0x11')]+_0x19acd1['countagentrejectretry'];this['countnosuchnumberretry']=_0x19acd1[_0x31af('0xf')];this[_0x31af('0x12')]=_0x19acd1[_0x31af('0x12')];this[_0x31af('0x10')]=_0x19acd1[_0x31af('0x10')];this[_0x31af('0x11')]=_0x19acd1[_0x31af('0x11')];this[_0x31af('0x13')]=_0x19acd1[_0x31af('0x13')];this[_0x31af('0xa')]=_0x19acd1[_0x31af('0xa')];this['calleridname']=_0x19acd1[_0x31af('0x14')];this[_0x31af('0x15')]=_0x19acd1[_0x31af('0x15')];this[_0x31af('0x16')]=_0x19acd1[_0x31af('0x16')];this[_0x31af('0x17')]=_0x19acd1[_0x31af('0x17')];this[_0x31af('0x18')]=_0x19acd1[_0x31af('0x17')];this['ringtime']=_0x19acd1[_0x31af('0x19')]||0x0;this[_0x31af('0x1a')]=_0x19acd1[_0x31af('0x1a')]||0x0;this[_0x31af('0x1b')]=_0x19acd1[_0x31af('0x1b')]||0x0;this['callback']=_0x19acd1[_0x31af('0x1c')];this[_0x31af('0x1d')]=_0x19acd1[_0x31af('0x1d')];this[_0x31af('0x1e')]=_0x19acd1[_0x31af('0x1e')];this[_0x31af('0x1f')]=_0x19acd1[_0x31af('0x1f')];this[_0x31af('0x20')]=_0x19acd1[_0x31af('0x20')];this[_0x31af('0x21')]=_0x19acd1[_0x31af('0x21')];this[_0x31af('0x22')]=_0x19acd1[_0x31af('0x22')];this[_0x31af('0x23')]=_0x19acd1[_0x31af('0x23')];this['CampaignId']=_0x19acd1['CampaignId'];this['originatecalleridnum']=_0x19acd1[_0x31af('0x24')]||'';this[_0x31af('0x25')]=_0x19acd1['originatecalleridname']||'';}module[_0x31af('0x26')]=Final; \ No newline at end of file +var _0x0d4d=['countmachineretry','countagentrejectretry','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x50404a,_0x70f5e3){var _0xa97ab2=function(_0x407955){while(--_0x407955){_0x50404a['push'](_0x50404a['shift']());}};_0xa97ab2(++_0x70f5e3);}(_0x0d4d,0x132));var _0xd0d4=function(_0x29d589,_0x14cf2f){_0x29d589=_0x29d589-0x0;var _0x49ed2d=_0x0d4d[_0x29d589];return _0x49ed2d;};'use strict';var util=require(_0xd0d4('0x0'));var _=require(_0xd0d4('0x1'));var moment=require(_0xd0d4('0x2'));function getSeconds(_0x24a4c4,_0x1f74ab){var _0x1515e0=moment(_0x24a4c4)['milliseconds'](0x0);var _0x984664=moment(_0x1f74ab)['milliseconds'](0x0);return _0x1515e0[_0xd0d4('0x3')](_0x984664,_0xd0d4('0x4'));}function Final(_0x582aaa){this[_0xd0d4('0x5')]=_0x582aaa[_0xd0d4('0x5')];this[_0xd0d4('0x6')]=_0x582aaa['scheduledat'];this[_0xd0d4('0x7')]=_0x582aaa['type'];this[_0xd0d4('0x8')]=_0x582aaa['type']===_0xd0d4('0x9')?_0xd0d4('0xa'):_0x582aaa[_0xd0d4('0x7')];this['countbusyretry']=_0x582aaa[_0xd0d4('0xb')];this[_0xd0d4('0xc')]=_0x582aaa[_0xd0d4('0xc')];this[_0xd0d4('0xd')]=_0x582aaa[_0xd0d4('0xd')];this[_0xd0d4('0xe')]=_0x582aaa['countbusyretry']+_0x582aaa[_0xd0d4('0xc')]+_0x582aaa[_0xd0d4('0xd')]+_0x582aaa[_0xd0d4('0xf')]+_0x582aaa[_0xd0d4('0x10')]+_0x582aaa[_0xd0d4('0x11')]+_0x582aaa[_0xd0d4('0x12')]+_0x582aaa['countagentrejectretry'];this[_0xd0d4('0xf')]=_0x582aaa[_0xd0d4('0xf')];this[_0xd0d4('0x10')]=_0x582aaa['countdropretry'];this['countabandonedretry']=_0x582aaa[_0xd0d4('0x11')];this[_0xd0d4('0x12')]=_0x582aaa['countmachineretry'];this[_0xd0d4('0x13')]=_0x582aaa[_0xd0d4('0x13')];this['queue']=_0x582aaa['queue'];this[_0xd0d4('0x14')]=_0x582aaa[_0xd0d4('0x14')];this[_0xd0d4('0x15')]=_0x582aaa['calleridnum'];this['starttime']=_0x582aaa['starttime'];this[_0xd0d4('0x16')]=_0x582aaa[_0xd0d4('0x16')];this[_0xd0d4('0x17')]=_0x582aaa['responsetime'];this['ringtime']=_0x582aaa[_0xd0d4('0x18')]||0x0;this['holdtime']=_0x582aaa[_0xd0d4('0x19')]||0x0;this[_0xd0d4('0x1a')]=_0x582aaa[_0xd0d4('0x1a')]||0x0;this['callback']=_0x582aaa[_0xd0d4('0x1b')];this['callbackuniqueid']=_0x582aaa['callbackuniqueid'];this[_0xd0d4('0x1c')]=_0x582aaa[_0xd0d4('0x1c')];this['recallme']=_0x582aaa['recallme'];this[_0xd0d4('0x1d')]=_0x582aaa[_0xd0d4('0x1d')];this[_0xd0d4('0x1e')]=_0x582aaa[_0xd0d4('0x1e')];this[_0xd0d4('0x1f')]=_0x582aaa[_0xd0d4('0x1f')];this['VoiceQueueId']=_0x582aaa[_0xd0d4('0x20')];this['CampaignId']=_0x582aaa[_0xd0d4('0x21')];this[_0xd0d4('0x22')]=_0x582aaa[_0xd0d4('0x22')]||'';this['originatecalleridname']=_0x582aaa['originatecalleridname']||'';}module[_0xd0d4('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index c074aa4..0350adf 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 _0x7059=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','endtime','format','responsetime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer'];(function(_0x3513b0,_0x2e3f72){var _0x33b9b4=function(_0xbe2a36){while(--_0xbe2a36){_0x3513b0['push'](_0x3513b0['shift']());}};_0x33b9b4(++_0x2e3f72);}(_0x7059,0x1ba));var _0x9705=function(_0x5185ee,_0x1921db){_0x5185ee=_0x5185ee-0x0;var _0x19d77d=_0x7059[_0x5185ee];return _0x19d77d;};'use strict';var util=require(_0x9705('0x0'));var _=require(_0x9705('0x1'));var moment=require(_0x9705('0x2'));function getSeconds(_0x4c5e04,_0x4664a8){var _0x2228c5=moment(_0x4c5e04)[_0x9705('0x3')](0x0);var _0x2c6f7f=moment(_0x4664a8)[_0x9705('0x3')](0x0);return _0x2228c5[_0x9705('0x4')](_0x2c6f7f,'seconds');}function Hangup(_0x265e96,_0x32ad5e){this[_0x9705('0x5')]=0x4;this[_0x9705('0x6')]=_0x9705('0x7');this[_0x9705('0x8')]=_0x265e96[_0x9705('0x8')];this[_0x9705('0x9')]=_0x265e96['type'];this[_0x9705('0xa')]=_0x265e96[_0x9705('0x9')]===_0x9705('0xb')?_0x9705('0xc'):_0x265e96[_0x9705('0x9')];this[_0x9705('0xd')]=_0x265e96[_0x9705('0xd')];this['countcongestionretry']=_0x265e96[_0x9705('0xe')];this[_0x9705('0xf')]=_0x265e96['countnoanswerretry'];this[_0x9705('0x10')]=_0x265e96['countbusyretry']+_0x265e96[_0x9705('0xe')]+_0x265e96[_0x9705('0xf')]+_0x265e96['countnosuchnumberretry']+_0x265e96[_0x9705('0x11')]+_0x265e96['countabandonedretry']+_0x265e96[_0x9705('0x12')]+_0x265e96[_0x9705('0x13')];this[_0x9705('0x14')]=_0x265e96[_0x9705('0x14')];this['countdropretry']=_0x265e96['countdropretry'];this[_0x9705('0x15')]=_0x265e96['countabandonedretry'];this['countmachineretry']=_0x265e96[_0x9705('0x12')];this[_0x9705('0x13')]=_0x265e96[_0x9705('0x13')];this[_0x9705('0x16')]=_0x32ad5e[_0x9705('0x16')];this[_0x9705('0x17')]=_0x265e96[_0x9705('0x18')];this['calleridnum']=_0x265e96[_0x9705('0x19')];this[_0x9705('0x1a')]=_0x265e96[_0x9705('0x1a')];this['responsetime']=_0x265e96['responsetime'];this[_0x9705('0x1b')]=moment()[_0x9705('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x265e96[_0x9705('0x1d')],_0x265e96['starttime']);this['holdtime']=0x0;this[_0x9705('0x1e')]=getSeconds(this[_0x9705('0x1b')],_0x265e96['responsetime']);this['queue']=_0x265e96[_0x9705('0xc')];this[_0x9705('0x1f')]=_0x9705('0x20');this[_0x9705('0x21')]=_0x32ad5e[_0x9705('0x22')];this['callback']=_0x265e96[_0x9705('0x23')];this['callbackuniqueid']=_0x265e96[_0x9705('0x24')];this[_0x9705('0x25')]=_0x265e96[_0x9705('0x25')];this[_0x9705('0x26')]=_0x265e96[_0x9705('0x26')];this[_0x9705('0x27')]=_0x265e96['ContactId'];this[_0x9705('0x28')]=_0x265e96['ListId'];this[_0x9705('0x29')]=_0x265e96['UserId'];this[_0x9705('0x2a')]=_0x265e96[_0x9705('0x2a')];this[_0x9705('0x2b')]=_0x265e96[_0x9705('0x2b')];}module[_0x9705('0x2c')]=Hangup; \ No newline at end of file +var _0xd572=['scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countmachineretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','name','number','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','milliseconds','diff','state','statedesc'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0xd572,0xc8));var _0x2d57=function(_0x4496ac,_0x28c2fe){_0x4496ac=_0x4496ac-0x0;var _0x562eed=_0xd572[_0x4496ac];return _0x562eed;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x2d57('0x0'));function getSeconds(_0x200655,_0x3fa393){var _0x1d8888=moment(_0x200655)[_0x2d57('0x1')](0x0);var _0x49232b=moment(_0x3fa393)[_0x2d57('0x1')](0x0);return _0x1d8888[_0x2d57('0x2')](_0x49232b,'seconds');}function Hangup(_0x51cdc0,_0x383b6e){this[_0x2d57('0x3')]=0x4;this[_0x2d57('0x4')]='Answer';this[_0x2d57('0x5')]=_0x51cdc0[_0x2d57('0x5')];this[_0x2d57('0x6')]=_0x51cdc0[_0x2d57('0x6')];this['campaigntype']=_0x51cdc0['type']===_0x2d57('0x7')?_0x2d57('0x8'):_0x51cdc0[_0x2d57('0x6')];this['countbusyretry']=_0x51cdc0['countbusyretry'];this[_0x2d57('0x9')]=_0x51cdc0[_0x2d57('0x9')];this[_0x2d57('0xa')]=_0x51cdc0['countnoanswerretry'];this[_0x2d57('0xb')]=_0x51cdc0[_0x2d57('0xc')]+_0x51cdc0[_0x2d57('0x9')]+_0x51cdc0[_0x2d57('0xa')]+_0x51cdc0['countnosuchnumberretry']+_0x51cdc0['countdropretry']+_0x51cdc0['countabandonedretry']+_0x51cdc0[_0x2d57('0xd')]+_0x51cdc0['countagentrejectretry'];this[_0x2d57('0xe')]=_0x51cdc0[_0x2d57('0xe')];this[_0x2d57('0xf')]=_0x51cdc0[_0x2d57('0xf')];this[_0x2d57('0x10')]=_0x51cdc0['countabandonedretry'];this[_0x2d57('0xd')]=_0x51cdc0[_0x2d57('0xd')];this[_0x2d57('0x11')]=_0x51cdc0['countagentrejectretry'];this[_0x2d57('0x12')]=_0x383b6e[_0x2d57('0x12')];this['calleridname']=_0x51cdc0[_0x2d57('0x13')];this['calleridnum']=_0x51cdc0[_0x2d57('0x14')];this[_0x2d57('0x15')]=_0x51cdc0['starttime'];this['responsetime']=_0x51cdc0[_0x2d57('0x16')];this[_0x2d57('0x17')]=moment()[_0x2d57('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2d57('0x19')]=getSeconds(_0x51cdc0[_0x2d57('0x16')],_0x51cdc0[_0x2d57('0x15')]);this[_0x2d57('0x1a')]=0x0;this[_0x2d57('0x1b')]=getSeconds(this['endtime'],_0x51cdc0[_0x2d57('0x16')]);this[_0x2d57('0x8')]=_0x51cdc0[_0x2d57('0x8')];this[_0x2d57('0x1c')]=_0x2d57('0x1d');this[_0x2d57('0x1e')]=_0x383b6e['cause-txt'];this['callback']=_0x51cdc0[_0x2d57('0x1f')];this[_0x2d57('0x20')]=_0x51cdc0[_0x2d57('0x20')];this[_0x2d57('0x21')]=_0x51cdc0['callbackat'];this[_0x2d57('0x22')]=_0x51cdc0['recallme'];this['ContactId']=_0x51cdc0[_0x2d57('0x23')];this[_0x2d57('0x24')]=_0x51cdc0[_0x2d57('0x24')];this[_0x2d57('0x25')]=_0x51cdc0[_0x2d57('0x25')];this[_0x2d57('0x26')]=_0x51cdc0[_0x2d57('0x26')];this[_0x2d57('0x27')]=_0x51cdc0[_0x2d57('0x27')];}module[_0x2d57('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 32c8882..cb57392 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 _0xe306=['countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xe306,0x19d));var _0x6e30=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xe306[_0x3635ce];return _0x97ecd0;};'use strict';var util=require(_0x6e30('0x0'));var _=require(_0x6e30('0x1'));var moment=require(_0x6e30('0x2'));function getSeconds(_0x3d6ba8,_0x3a253f){var _0x11eb1b=moment(_0x3d6ba8)[_0x6e30('0x3')](0x0);var _0x121e54=moment(_0x3a253f)[_0x6e30('0x3')](0x0);return _0x11eb1b[_0x6e30('0x4')](_0x121e54,'seconds');}function History(_0x423276){this[_0x6e30('0x5')]=_0x423276['uniqueid'];this['scheduledat']=_0x423276[_0x6e30('0x6')]||undefined;this[_0x6e30('0x7')]=_0x423276[_0x6e30('0x7')];this[_0x6e30('0x8')]=_0x423276[_0x6e30('0x7')]===_0x6e30('0x9')?_0x6e30('0xa'):_0x423276[_0x6e30('0x7')];this[_0x6e30('0xb')]=_0x423276[_0x6e30('0xb')];this[_0x6e30('0xc')]=_0x423276[_0x6e30('0xc')];this[_0x6e30('0xd')]=_0x423276['countnoanswerretry'];this[_0x6e30('0xe')]=_0x423276[_0x6e30('0xb')]+_0x423276[_0x6e30('0xc')]+_0x423276['countnoanswerretry']+_0x423276['countnosuchnumberretry']+_0x423276[_0x6e30('0xf')]+_0x423276[_0x6e30('0x10')]+_0x423276[_0x6e30('0x11')]+_0x423276[_0x6e30('0x12')];this['countnosuchnumberretry']=_0x423276[_0x6e30('0x13')];this[_0x6e30('0xf')]=_0x423276[_0x6e30('0xf')];this[_0x6e30('0x10')]=_0x423276[_0x6e30('0x10')];this[_0x6e30('0x11')]=_0x423276['countmachineretry'];this[_0x6e30('0x12')]=_0x423276[_0x6e30('0x12')];this[_0x6e30('0xa')]=_0x423276[_0x6e30('0xa')];this[_0x6e30('0x14')]=_0x423276[_0x6e30('0x15')];this[_0x6e30('0x16')]=_0x423276[_0x6e30('0x17')];this[_0x6e30('0x18')]=_0x423276['starttime'];this[_0x6e30('0x19')]=_0x423276[_0x6e30('0x19')];this[_0x6e30('0x1a')]=_0x423276[_0x6e30('0x19')];this[_0x6e30('0x1b')]=getSeconds(_0x423276['responsetime'],_0x423276[_0x6e30('0x18')]);this[_0x6e30('0x1c')]=0x0;this[_0x6e30('0x1d')]=0x0;this[_0x6e30('0x1e')]=_0x423276[_0x6e30('0x1e')];this[_0x6e30('0x1f')]=_0x423276[_0x6e30('0x1f')];this[_0x6e30('0x20')]=_0x423276['callbackat'];this[_0x6e30('0x21')]=_0x423276['recallme'];this['ContactId']=_0x423276['ContactId'];this['ListId']=_0x423276[_0x6e30('0x22')];this['UserId']=_0x423276[_0x6e30('0x23')];this[_0x6e30('0x24')]=_0x423276[_0x6e30('0x24')];this[_0x6e30('0x25')]=_0x423276[_0x6e30('0x25')];this[_0x6e30('0x26')]=_0x423276[_0x6e30('0x26')]||'';this['originatecalleridname']=_0x423276['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file +var _0xca53=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound'];(function(_0xee6c00,_0x2cfa83){var _0x27cf04=function(_0x2ef007){while(--_0x2ef007){_0xee6c00['push'](_0xee6c00['shift']());}};_0x27cf04(++_0x2cfa83);}(_0xca53,0x125));var _0x3ca5=function(_0x5a17e7,_0x528c7e){_0x5a17e7=_0x5a17e7-0x0;var _0xb8e1f1=_0xca53[_0x5a17e7];return _0xb8e1f1;};'use strict';var util=require(_0x3ca5('0x0'));var _=require(_0x3ca5('0x1'));var moment=require(_0x3ca5('0x2'));function getSeconds(_0x490ab7,_0x8f8840){var _0xe9ef8a=moment(_0x490ab7)[_0x3ca5('0x3')](0x0);var _0x1c88a6=moment(_0x8f8840)['milliseconds'](0x0);return _0xe9ef8a[_0x3ca5('0x4')](_0x1c88a6,_0x3ca5('0x5'));}function History(_0x584ec8){this['uniqueid']=_0x584ec8[_0x3ca5('0x6')];this[_0x3ca5('0x7')]=_0x584ec8['scheduledat']||undefined;this['type']=_0x584ec8[_0x3ca5('0x8')];this[_0x3ca5('0x9')]=_0x584ec8[_0x3ca5('0x8')]===_0x3ca5('0xa')?_0x3ca5('0xb'):_0x584ec8[_0x3ca5('0x8')];this[_0x3ca5('0xc')]=_0x584ec8['countbusyretry'];this[_0x3ca5('0xd')]=_0x584ec8['countcongestionretry'];this[_0x3ca5('0xe')]=_0x584ec8[_0x3ca5('0xe')];this['countglobal']=_0x584ec8[_0x3ca5('0xc')]+_0x584ec8[_0x3ca5('0xd')]+_0x584ec8[_0x3ca5('0xe')]+_0x584ec8['countnosuchnumberretry']+_0x584ec8[_0x3ca5('0xf')]+_0x584ec8['countabandonedretry']+_0x584ec8[_0x3ca5('0x10')]+_0x584ec8[_0x3ca5('0x11')];this[_0x3ca5('0x12')]=_0x584ec8[_0x3ca5('0x12')];this[_0x3ca5('0xf')]=_0x584ec8[_0x3ca5('0xf')];this['countabandonedretry']=_0x584ec8[_0x3ca5('0x13')];this[_0x3ca5('0x10')]=_0x584ec8[_0x3ca5('0x10')];this[_0x3ca5('0x11')]=_0x584ec8[_0x3ca5('0x11')];this[_0x3ca5('0xb')]=_0x584ec8[_0x3ca5('0xb')];this[_0x3ca5('0x14')]=_0x584ec8['name'];this[_0x3ca5('0x15')]=_0x584ec8['number'];this[_0x3ca5('0x16')]=_0x584ec8[_0x3ca5('0x16')];this[_0x3ca5('0x17')]=_0x584ec8['responsetime'];this['endtime']=_0x584ec8[_0x3ca5('0x17')];this['ringtime']=getSeconds(_0x584ec8['responsetime'],_0x584ec8[_0x3ca5('0x16')]);this[_0x3ca5('0x18')]=0x0;this[_0x3ca5('0x19')]=0x0;this['callback']=_0x584ec8[_0x3ca5('0x1a')];this[_0x3ca5('0x1b')]=_0x584ec8['callbackuniqueid'];this[_0x3ca5('0x1c')]=_0x584ec8[_0x3ca5('0x1c')];this[_0x3ca5('0x1d')]=_0x584ec8[_0x3ca5('0x1d')];this[_0x3ca5('0x1e')]=_0x584ec8[_0x3ca5('0x1e')];this[_0x3ca5('0x1f')]=_0x584ec8[_0x3ca5('0x1f')];this['UserId']=_0x584ec8[_0x3ca5('0x20')];this[_0x3ca5('0x21')]=_0x584ec8['VoiceQueueId'];this[_0x3ca5('0x22')]=_0x584ec8['CampaignId'];this['originatecalleridnum']=_0x584ec8[_0x3ca5('0x23')]||'';this['originatecalleridname']=_0x584ec8[_0x3ca5('0x24')]||'';}module[_0x3ca5('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index a485123..2387eb0 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 _0x7a24=['syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','varset','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Interval','[ifTime][Action]','stringify','milliseconds','outbound','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','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','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','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','starttime','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','then','[checkIsBlackList]\x20','checkIsBlackListIvr','resolve','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','saveInDb','merge','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact]','Success','SIP/%s','status','reachable','unmonitored','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countabandonedretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countglobal','countbusyretry','countnosuchnumberretry','dialGlobalMaxRetry','minutes','ivrAnswerCallsDay','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','Unknow','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','countdropretry','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','syncNewExten','actionid','locked','paused','stateinterface','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','finally','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','true','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','power','handlePower','dialPowerLevel','Queue','handleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','launchHandleIvr','[syncCampaigns]','pow','replace','random','match','actionOriginate','voiceQueue\x20is\x20undefine','Contact','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','Error','getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','Ts\x20=\x20','[abandonmentRate]','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','exports','util','lodash','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','agentconnect','syncAgentConnect','bind','queuecallerabandon'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7a24,0x1f0));var _0x47a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a24[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x47a2('0x0'));var _=require(_0x47a2('0x1'));var BPromise=require(_0x47a2('0x2'));var uuid=require(_0x47a2('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0x47a2('0x4'));var Redis=require(_0x47a2('0x5'));var ut=require(_0x47a2('0x6'));var config=require(_0x47a2('0x7'));var logger=require(_0x47a2('0x8'))(_0x47a2('0x9'));var loggerBooked=require(_0x47a2('0x8'))(_0x47a2('0xa'));var loggerPredictive=require(_0x47a2('0x8'))(_0x47a2('0xb'));var loggerPredictiveCalls=require(_0x47a2('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x47a2('0x8'))(_0x47a2('0xc'));var ami=require(_0x47a2('0xd'));config[_0x47a2('0xe')]=_['defaults'](config[_0x47a2('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x47a2('0xf'))(new Redis(config[_0x47a2('0xe')]));var cmHopper=require(_0x47a2('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x47a2('0x11'));var Action=require(_0x47a2('0x12'));var History=require(_0x47a2('0x13'));var Final=require(_0x47a2('0x14'));var AgentComplete=require(_0x47a2('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process['env'][_0x47a2('0x16')]||_0x47a2('0x17');var strategy={'rrmemory':_0x47a2('0x18'),'roundrobin':_0x47a2('0x19')};var Sequence=function(){};Sequence[_0x47a2('0x1a')][_0x47a2('0x1b')]=function(_0x5540eb){this[_0x47a2('0x1c')]=this[_0x47a2('0x1c')]?this[_0x47a2('0x1c')]['finally'](_0x5540eb):_0x5540eb();};function Dialer(_0x1afb6d,_0x1c5426){this[_0x47a2('0x1d')]=new Sequence();this[_0x47a2('0x1e')]=_0x1c5426;this[_0x47a2('0x1f')]=_0x1afb6d[_0x47a2('0x1f')];this[_0x47a2('0x20')]=_0x1afb6d[_0x47a2('0x20')];this[_0x47a2('0x21')]=_0x1afb6d[_0x47a2('0x21')];this[_0x47a2('0x22')]=_0x1afb6d[_0x47a2('0x22')];this[_0x47a2('0x23')]=config[_0x47a2('0x23')]||0x2;this[_0x47a2('0x24')]={};this[_0x47a2('0x25')]={};this[_0x47a2('0x26')]={};this[_0x47a2('0x27')]={};this[_0x47a2('0x28')]={};this[_0x47a2('0x29')]={};this[_0x47a2('0x2a')]={};this['ivrOriginated']={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0x47a2('0x2b'),this[_0x47a2('0x2c')][_0x47a2('0x2d')](this));ami['on'](_0x47a2('0x2e'),this[_0x47a2('0x2f')][_0x47a2('0x2d')](this));ami['on'](_0x47a2('0x30'),this[_0x47a2('0x31')][_0x47a2('0x2d')](this));ami['on']('agentcomplete',this[_0x47a2('0x32')][_0x47a2('0x2d')](this));ami['on'](_0x47a2('0x33'),this[_0x47a2('0xc')][_0x47a2('0x2d')](this));ami['on'](_0x47a2('0x34'),this[_0x47a2('0x35')][_0x47a2('0x2d')](this));ami['on'](_0x47a2('0x36'),this['syncNewExten'][_0x47a2('0x2d')](this));ami['on'](_0x47a2('0x37'),this['syncVarSet'][_0x47a2('0x2d')](this));ami['on']('queuemember',this[_0x47a2('0x38')][_0x47a2('0x2d')](this));ami['on']('queuestatuscomplete',this[_0x47a2('0x39')][_0x47a2('0x2d')](this));this['loopCampaigns']();this[_0x47a2('0x3a')]();}function isNotNull(_0x14ea04){return _0x14ea04!==null&&!_[_0x47a2('0x3b')](_0x14ea04);}function checkIsLoggedIn(_0x3c498a,_0xe15be7){return function(){if(_0xe15be7<=0x0){_0x3c498a[_0x47a2('0x3c')]=_0x47a2('0x3d');throw _0x3c498a['name']+_0x47a2('0x3e');}};}function isActive(_0x3d60ea){return _0x3d60ea;}function checkIsActive(_0xd0fd3c,_0x1fd70b){return function(){if(!isActive(_0x1fd70b)){_0xd0fd3c[_0x47a2('0x3c')]=_0x47a2('0x3f');throw _0xd0fd3c[_0x47a2('0x40')]+'\x20NOT\x20Active';}};}function checkInterval(_0x47c85a){return function(){if(!isNotNull(_0x47c85a['Interval'])){_0x47c85a[_0x47a2('0x3c')]=_0x47a2('0x41');throw _0x47c85a['name']+_0x47a2('0x42');}if(!isNotNull(_0x47c85a['Interval'][_0x47a2('0x43')])){_0x47c85a[_0x47a2('0x3c')]='INTERVAL_IS_NULL';throw _0x47c85a[_0x47a2('0x40')]+_0x47a2('0x42');}if(!isNotNull(_[_0x47a2('0x44')](_0x47c85a[_0x47a2('0x45')][_0x47a2('0x43')]))){_0x47c85a[_0x47a2('0x3c')]=_0x47a2('0x41');throw _0x47c85a[_0x47a2('0x40')]+_0x47a2('0x42');}};}function msgResponse(_0xf2adf1,_0x200415,_0x26241e){return{'action':_0xf2adf1,'response':_0x200415,'message':_0x26241e,'stack':_0x26241e};}function myreject(_0x4caf46){return function(_0x433245){return _0x4caf46(msgResponse(_0x47a2('0x46'),'Error',JSON[_0x47a2('0x47')](_0x433245)));};}function getSeconds(_0x54e373,_0xd6a70e){var _0x199d57=moment(_0x54e373)[_0x47a2('0x48')](0x0);var _0x4b83a9=moment(_0xd6a70e)['milliseconds'](0x0);return _0x199d57['diff'](_0x4b83a9,'seconds');}function emit(_0x225d0c,_0x27701c,_0x1ac4cb){io['to'](_0x225d0c)['emit'](_0x27701c,_0x1ac4cb);}function emitVoiceQueueSummary(_0x4d6743){if(_0x4d6743['type']===_0x47a2('0x49')){var _0x24786f={'id':_0x4d6743['id'],'name':_0x4d6743[_0x47a2('0x40')],'strategy':_0x4d6743[_0x47a2('0x4a')],'answered':_0x4d6743[_0x47a2('0x4b')],'available':_0x4d6743[_0x47a2('0x4c')],'loggedIn':_0x4d6743[_0x47a2('0x4d')],'pTalking':_0x4d6743[_0x47a2('0x4e')],'sumBillable':_0x4d6743['sumBillable'],'sumDuration':_0x4d6743[_0x47a2('0x4f')],'sumHoldTime':_0x4d6743[_0x47a2('0x50')]||0x0,'talking':_0x4d6743[_0x47a2('0x51')],'total':_0x4d6743['total'],'type':_0x4d6743[_0x47a2('0x52')],'unmanaged':_0x4d6743[_0x47a2('0x53')],'abandoned':_0x4d6743[_0x47a2('0x54')],'waiting':_0x4d6743[_0x47a2('0x55')],'loggedInDb':_0x4d6743[_0x47a2('0x56')],'dialActive':_0x4d6743['dialActive'],'dialMethod':_0x4d6743[_0x47a2('0x57')],'dialOriginateCallerIdName':_0x4d6743[_0x47a2('0x58')],'dialOriginateCallerIdNumber':_0x4d6743[_0x47a2('0x59')],'dialOriginateTimeout':_0x4d6743[_0x47a2('0x5a')],'dialPrefix':_0x4d6743[_0x47a2('0x5b')],'outboundAnswerAgiCallsDay':_0x4d6743['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x4d6743[_0x47a2('0x5c')],'outboundBlacklistCallsDay':_0x4d6743['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x4d6743['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4d6743['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x4d6743[_0x47a2('0x5d')],'outboundDropCallsDayCallersExit':_0x4d6743[_0x47a2('0x5e')],'outboundDropCallsDayTimeout':_0x4d6743[_0x47a2('0x5f')],'outboundNoAnswerCallsDay':_0x4d6743[_0x47a2('0x60')],'outboundNoSuchCallsDay':_0x4d6743[_0x47a2('0x61')],'outboundOriginateFailureCallsDay':_0x4d6743[_0x47a2('0x62')],'outboundReCallsDay':_0x4d6743[_0x47a2('0x63')],'outboundRejectCallsDay':_0x4d6743[_0x47a2('0x64')],'outboundUnknownCallsDay':_0x4d6743[_0x47a2('0x65')],'predictiveIntervalAnsweredCalls':_0x4d6743[_0x47a2('0x66')],'predictiveIntervalAvgHoldtime':_0x4d6743[_0x47a2('0x67')],'predictiveIntervalAvgTalktime':_0x4d6743[_0x47a2('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x4d6743['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4d6743[_0x47a2('0x69')],'predictiveIntervalErlangCalls':_0x4d6743[_0x47a2('0x6a')],'predictiveIntervalErlangCallsDroppedCalls':_0x4d6743[_0x47a2('0x6b')],'predictiveIntervalHitRate':_0x4d6743[_0x47a2('0x6c')],'predictiveIntervalMultiplicativeFactor':_0x4d6743[_0x47a2('0x6d')],'predictiveIntervalPauses':_0x4d6743['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x4d6743[_0x47a2('0x6e')],'predictiveIntervalTotalCalls':_0x4d6743[_0x47a2('0x6f')],'message':_0x4d6743[_0x47a2('0x3c')],'originated':_0x4d6743[_0x47a2('0x70')],'erlangCalls':_0x4d6743['erlangCalls'],'erlangCallToSecond':_0x4d6743['erlangCallToSecond'],'erlangAbandonmentRate':_0x4d6743[_0x47a2('0x71')],'erlangBusyFactor':_0x4d6743[_0x47a2('0x72')],'startPredictive':_0x4d6743[_0x47a2('0x29')],'startProgressive':_0x4d6743[_0x47a2('0x2a')]};if(_0x4d6743[_0x47a2('0x73')]){_0x24786f[_0x47a2('0x73')]={'id':_0x4d6743[_0x47a2('0x73')]['id'],'name':_0x4d6743[_0x47a2('0x73')]['name'],'active':_0x4d6743[_0x47a2('0x73')][_0x47a2('0x74')],'callerid':_0x4d6743[_0x47a2('0x73')][_0x47a2('0x75')]};}if(_0x4d6743[_0x47a2('0x45')]){_0x24786f['Interval']={'id':_0x4d6743[_0x47a2('0x45')]['id'],'name':_0x4d6743['Interval']['name']};}var _0x2fd700=md5(JSON[_0x47a2('0x47')](_0x24786f));if(_0x4d6743[_0x47a2('0x4')]!==_0x2fd700){_0x4d6743['md5']=_0x2fd700;emit(util[_0x47a2('0x76')](_0x47a2('0x77'),_0x24786f[_0x47a2('0x40')]),_0x47a2('0x78'),_0x24786f);}}}function emitCampaignSummary(_0x295459){if(_0x295459['type']===_0x47a2('0x79')){emit(util['format'](_0x47a2('0x7a'),_0x295459[_0x47a2('0x40')]),_0x47a2('0x7b'),_0x295459);}}function checkGetDataPredictive(_0x5c3ded){if(isNotNull(_0x5c3ded)&&!_[_0x47a2('0x44')](_0x5c3ded)){loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x7d'));loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x7e'),_0x5c3ded[_0x47a2('0x6f')]);loggerPredictive[_0x47a2('0x7c')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5c3ded[_0x47a2('0x66')]);loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x7f'),_0x5c3ded[_0x47a2('0x69')]);loggerPredictive['info'](_0x47a2('0x80'),_0x5c3ded[_0x47a2('0x81')]);loggerPredictive[_0x47a2('0x7c')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5c3ded['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x82'),_0x5c3ded['predictiveIntervalAvgTalktime']);loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x83'));if(_0x5c3ded[_0x47a2('0x6f')]>0x0){if(!_[_0x47a2('0x3b')](_0x5c3ded['predictiveIntervalAvgTalktime'])&&_0x5c3ded['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x47a2('0x7c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x47a2('0x3b')](_0x5c3ded[_0x47a2('0x67')])&&_0x5c3ded[_0x47a2('0x67')]>0x0){return!![];}loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x84'));}else{loggerPredictive['info'](_0x47a2('0x85'));}}else{loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x86'));}return![];}function mergeDataErlangB(_0x200a94){return function(_0x89a5fe){loggerPredictive[_0x47a2('0x7c')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x87'),_0x89a5fe[_0x47a2('0x88')]);loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x89'),_0x89a5fe[_0x47a2('0x8a')]);loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x8b'),_0x89a5fe[_0x47a2('0x71')]);loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x8c'),_0x89a5fe[_0x47a2('0x72')]);loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x8b'),_0x89a5fe[_0x47a2('0x71')]);loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x83'));_['merge'](_0x200a94,_0x89a5fe);};}function getDiff(_0x2b0cb9){var _0x2f9b6b=moment()[_0x47a2('0x48')](0x0);var _0x2299fa=moment(_0x2b0cb9)[_0x47a2('0x48')](0x0);return _0x2f9b6b['diff'](_0x2299fa,'seconds');}function ifInterval(_0x4e7f2f,_0x573ab0){if(_[_0x47a2('0x3b')](_0x573ab0)){return![];}return getDiff(_0x573ab0)<_0x4e7f2f*0x3c;}function freeVariablesPredictive(_0x56165e){if(isNotNull(_0x56165e)){if(!_[_0x47a2('0x3b')](_0x56165e[_0x47a2('0x2a')])){_0x56165e[_0x47a2('0x2a')]=undefined;loggerPredictive[_0x47a2('0x7c')](_0x56165e[_0x47a2('0x40')],_0x47a2('0x8d'));}if(!_[_0x47a2('0x3b')](_0x56165e[_0x47a2('0x29')])){_0x56165e['startPredictive']=undefined;loggerPredictive['info'](_0x56165e['name'],_0x47a2('0x8e'));}if(!_[_0x47a2('0x3b')](_0x56165e[_0x47a2('0x8f')])){clearInterval(_0x56165e['handlePredictive']);_0x56165e[_0x47a2('0x8f')]=undefined;loggerPredictive['info'](_0x56165e['name'],_0x47a2('0x90'));}}}function erlangb(_0x185424,_0x34bf40){if(_0x34bf40===0x0){return 0x0;}var _0x20b7c7=0x1;for(var _0x4e5fd3=0x1;_0x4e5fd3<=_0x34bf40;_0x4e5fd3+=0x1){_0x20b7c7=0x1+_0x20b7c7*_0x4e5fd3/_0x185424;}return 0x1/_0x20b7c7;}function isVoiceQueueOutbound(_0x5d6b54){return _0x5d6b54==='outbound';}function isNotPreview(_0x2c2441){return _0x2c2441!==_0x47a2('0x1e');}function isCampaignIvr(_0x164efa){return _0x164efa==='ivr';}function getCallerId(_0x318c0e,_0x2dc3ae,_0x4119e7){if(!_[_0x47a2('0x3b')](_0x4119e7)&&typeof _0x4119e7===_0x47a2('0x91')&&!_[_0x47a2('0x44')](_0x4119e7)){if(!_[_0x47a2('0x3b')](_0x2dc3ae)&&typeof _0x2dc3ae===_0x47a2('0x91')&&!_[_0x47a2('0x44')](_0x2dc3ae)){return util[_0x47a2('0x76')](_0x47a2('0x92'),_0x2dc3ae,_0x4119e7);}return util['format'](_0x47a2('0x92'),_0x4119e7,_0x4119e7);}if(!_[_0x47a2('0x3b')](_0x318c0e)&&typeof _0x318c0e===_0x47a2('0x91')&&!_['isEmpty'](_0x318c0e)){return _0x318c0e;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x221272,_0x2aef74){return function(_0x586f5f){freeVariablesPredictive(_0x2aef74);emitVoiceQueueSummary(_0x2aef74);emitCampaignSummary(_0x2aef74);loggerSyncQueueSummary[_0x47a2('0x93')](_0x221272,util[_0x47a2('0x94')](_0x586f5f,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x465a22,_0x2365c3){return function(_0x19fbb2){loggerPredictive[_0x47a2('0x93')](_0x2365c3[_0x47a2('0x40')],_0x465a22);loggerPredictive[_0x47a2('0x93')](_0x19fbb2[_0x47a2('0x95')]);freeVariablesPredictive(_0x2365c3);};}function loggerCatch(_0x5e218f){return function(_0x16ba38){logger[_0x47a2('0x93')](_0x5e218f,util[_0x47a2('0x94')](_0x16ba38,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3709d5){return _0x3709d5&&!_[_0x47a2('0x3b')](_0x3709d5)&&_0x3709d5[_0x47a2('0x96')]>0x0;}function decremetOriginate(_0x52408c){if(!_[_0x47a2('0x3b')](_0x52408c)&&_0x52408c!==null){if(typeof _0x52408c[_0x47a2('0x70')]!==_0x47a2('0x97')){if(_0x52408c[_0x47a2('0x70')]>0x0){_0x52408c[_0x47a2('0x70')]-=0x1;}else{logger[_0x47a2('0x93')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x47a2('0x93')](_0x47a2('0x98'));}}function checkContactLowerLimitOriginate(_0x5b811b,_0x411543,_0x2bfe6d){if(_0x411543>_0x2bfe6d){for(var _0x64bb28=0x0;_0x64bb28<_0x411543-_0x2bfe6d;_0x64bb28+=0x1){decremetOriginate(_0x5b811b);}}}function loggerGetContactDialer(_0x5f5a9c,_0xe7a89b,_0x3cad47){return function(_0x41d8aa){checkContactLowerLimitOriginate(_0xe7a89b,_0x3cad47,0x0);logger[_0x47a2('0x93')](_0x5f5a9c,util[_0x47a2('0x94')](_0x41d8aa,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x54a4bf){return function(_0xf9e3c6){if(isNotNull(_0xf9e3c6)&&isNotNull(_0xf9e3c6[0x0])){if(_0xf9e3c6[0x0][_0x47a2('0x99')]>0x0){_0x54a4bf[_0x47a2('0x3c')]=_0x47a2('0x9a');logger[_0x47a2('0x7c')]('[getContactDialer2][ReScheduled]'+_0x54a4bf[_0x47a2('0x40')],_0xf9e3c6[0x0]['contactsRescheduled'],_0x47a2('0x9b'));}else{_0x54a4bf[_0x47a2('0x3c')]=_0x47a2('0x9c');logger['info'](_0x47a2('0x9d')+_0x54a4bf['name']);}}};}function notSendMessagesQueue(_0x417ea0){if(_0x417ea0[_0x47a2('0x9e')]){freeVariablesPredictive(_0x417ea0);if(_0x417ea0[_0x47a2('0x70')]===0x0&&_0x417ea0[_0x47a2('0x51')]===0x0&&_0x417ea0[_0x47a2('0x55')]===0x0&&(_0x417ea0[_0x47a2('0x4e')]||0x0)===0x0){_0x417ea0[_0x47a2('0x9e')]=![];_0x417ea0['available']=0x0;_0x417ea0[_0x47a2('0x3c')]=_0x47a2('0x3f');loggerSyncQueueSummary[_0x47a2('0x93')](_0x47a2('0x9f'),_0x417ea0[_0x47a2('0x40')],_0x47a2('0xa0'));}else{_0x417ea0['message']=_0x47a2('0xa1');loggerSyncQueueSummary['error'](_0x47a2('0x9f'),_0x417ea0[_0x47a2('0x40')],'is\x20disactive');}emitVoiceQueueSummary(_0x417ea0);}}function notSendMessagesCampaign(_0x83211d){if(_0x83211d[_0x47a2('0x9e')]){if(_0x83211d[_0x47a2('0x70')]===0x0){_0x83211d[_0x47a2('0x9e')]=![];_0x83211d[_0x47a2('0x3c')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x47a2('0x93')](_0x47a2('0xa2'),_0x83211d[_0x47a2('0x40')],_0x47a2('0xa0'));}else{_0x83211d[_0x47a2('0x3c')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x47a2('0x93')](_0x47a2('0xa2'),_0x83211d[_0x47a2('0x40')],_0x47a2('0xa3'));}emitCampaignSummary(_0x83211d);}}function createObjHistory(_0x195cd1,_0x59e2ea,_0x1e80d9,_0x2b7ca1,_0x35c3b2){_0x195cd1['message']=_0x1e80d9;var _0x416db0=new Action(_0x195cd1,_0x59e2ea);var _0x2c2c8e=new History(_0x416db0);_0x2c2c8e[_0x47a2('0xa4')]=_0x2b7ca1;_0x2c2c8e[_0x47a2('0xa5')]=_0x35c3b2;_0x2c2c8e['endtime']=_0x416db0[_0x47a2('0xa6')];return _0x2c2c8e;}Dialer[_0x47a2('0x1a')][_0x47a2('0x3a')]=function(){var _0x1c9cdd=this;setInterval(function(){_0x1c9cdd[_0x47a2('0xa7')](_0x1c9cdd['uniqueId'],_0x47a2('0xa8'));_0x1c9cdd[_0x47a2('0xa7')](_0x1c9cdd[_0x47a2('0x25')],_0x47a2('0xa9'));},0x32c8);};Dialer['prototype'][_0x47a2('0xa7')]=function(_0x1d42de,_0x1d60f2){var _0x543202=this;for(var _0x3cc43c in _0x1d42de){if(typeof _0x1d42de[_0x3cc43c]!==_0x47a2('0x97')){this['sequence']['enqueue'](function(){if(!_[_0x47a2('0xaa')](_0x1d42de[_0x3cc43c])){return ami[_0x47a2('0xab')]({'action':'status','channel':_0x1d42de[_0x3cc43c][_0x47a2('0xac')]})[_0x47a2('0xad')](function(_0x230404){if(_0x230404[_0x47a2('0x3c')]===_0x47a2('0xae')){setTimeout(function(){if(_0x1d42de[_0x3cc43c]&&_0x1d42de[_0x3cc43c][_0x47a2('0x52')]!==_0x47a2('0x79')){_0x543202[_0x47a2('0xaf')](_0x543202[_0x47a2('0x1f')][_0x1d42de[_0x3cc43c]['queue']]);logger[_0x47a2('0x93')](_0x47a2('0xb0'),_0x1d60f2,_0x3cc43c,_0x1d42de[_0x3cc43c][_0x47a2('0xb1')]);delete _0x1d42de[_0x3cc43c];}if(_0x1d42de[_0x3cc43c]&&_0x1d42de[_0x3cc43c]['type']===_0x47a2('0x79')){_0x543202[_0x47a2('0xaf')](_0x543202[_0x47a2('0x20')][_0x1d42de[_0x3cc43c]['queue']]);logger[_0x47a2('0x93')](_0x47a2('0xb2'),_0x1d60f2,_0x3cc43c,_0x1d42de[_0x3cc43c]['queue']);delete _0x1d42de[_0x3cc43c];}},0x2328);}});}});}}};Dialer[_0x47a2('0x1a')][_0x47a2('0xb3')]=function(_0x5ecc59){return BPromise['resolve']()[_0x47a2('0xb4')](cmHopper[_0x47a2('0xb3')](_0x5ecc59))[_0x47a2('0xad')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x47a2('0x1a')]['checkIsBlackList']=function(_0x3e1bd4){return BPromise['resolve']()[_0x47a2('0xb4')](cmHopperBlack['checkIsBlackList'](_0x3e1bd4))[_0x47a2('0xad')](loggerCatch(_0x47a2('0xb5')));};Dialer[_0x47a2('0x1a')][_0x47a2('0xb6')]=function(_0xefcf8){return BPromise[_0x47a2('0xb7')]()[_0x47a2('0xb4')](cmHopperBlack[_0x47a2('0xb6')](_0xefcf8))[_0x47a2('0xad')](loggerCatch(_0x47a2('0xb8')));};Dialer[_0x47a2('0x1a')]['averageHandleTime']=function(_0x4c60fa){return BPromise[_0x47a2('0xb7')]()[_0x47a2('0xb4')](cmHopperHistory[_0x47a2('0xb9')](_0x4c60fa))[_0x47a2('0xad')](loggerCatch(_0x47a2('0xba')));};Dialer[_0x47a2('0x1a')][_0x47a2('0xbb')]=function(_0x392237){return BPromise[_0x47a2('0xb7')]()[_0x47a2('0xb4')](cmHopper[_0x47a2('0xbb')](_0x392237))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x47a2('0x1a')][_0x47a2('0xbc')]=function(_0x37d8b5,_0x15190b,_0x47c95d){return BPromise[_0x47a2('0xb7')]()[_0x47a2('0xb4')](cmHopper['unlockContact'](_0x37d8b5,_0x15190b,_0x47c95d))[_0x47a2('0xad')](loggerCatch(_0x47a2('0xbd')));};Dialer[_0x47a2('0x1a')][_0x47a2('0xbe')]=function(_0x47e45e,_0xb26e1f,_0x84e69b,_0x3c94f2,_0x278acb){return BPromise[_0x47a2('0xb7')]()[_0x47a2('0xb4')](cmHopper[_0x47a2('0xbe')](_0x47e45e,_0xb26e1f,_0x84e69b,_0x3c94f2))[_0x47a2('0xad')](function(_0xfe51b9){_0x278acb[_0x47a2('0xbf')]-=_0x84e69b;_0x278acb[_0x47a2('0xbf')]=_0x278acb['temp']>0x0?_0x278acb['temp']:0x0;loggerCatch('[getContactDialer]\x20')(_0xfe51b9);});};Dialer[_0x47a2('0x1a')][_0x47a2('0xc0')]=function(_0x3f2815,_0xc49b18,_0x2c63ec,_0x1ffc20){return BPromise[_0x47a2('0xb7')]()['then'](cmHopper['getContactDialerIvr'](_0x3f2815,_0xc49b18,_0x2c63ec))[_0x47a2('0xad')](function(_0x167f3a){_0x1ffc20[_0x47a2('0xbf')]-=_0xc49b18;_0x1ffc20[_0x47a2('0xbf')]=_0x1ffc20['temp']>0x0?_0x1ffc20[_0x47a2('0xbf')]:0x0;loggerCatch(_0x47a2('0xc1'))(_0x167f3a);});};Dialer['prototype'][_0x47a2('0xc2')]=function(_0x12509f){return BPromise[_0x47a2('0xb7')]()[_0x47a2('0xb4')](voiceQueueRt[_0x47a2('0xc2')](_0x12509f))[_0x47a2('0xad')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x47a2('0x1a')][_0x47a2('0xc3')]=function(_0x655cc7){return BPromise[_0x47a2('0xb7')]()[_0x47a2('0xb4')](cmHopper[_0x47a2('0xc3')](_0x655cc7))['catch'](loggerCatch(_0x47a2('0xc4')));};Dialer[_0x47a2('0x1a')]['createHistory']=function(_0x3ed027){return BPromise[_0x47a2('0xb7')]()[_0x47a2('0xb4')](cmHopperHistory[_0x47a2('0xc5')](_0x3ed027))['catch'](loggerCatch(_0x47a2('0xc6')));};Dialer[_0x47a2('0x1a')][_0x47a2('0xaf')]=function(_0x2b3d77){if(!_[_0x47a2('0x3b')](_0x2b3d77)&&_0x2b3d77!==null){if(typeof _0x2b3d77['originated']!==_0x47a2('0x97')){if(_0x2b3d77[_0x47a2('0x70')]>0x0){_0x2b3d77['originated']-=0x1;}else{logger[_0x47a2('0x93')](_0x47a2('0xc7'));}}}else{logger[_0x47a2('0x93')](_0x47a2('0xc8'));}};Dialer[_0x47a2('0x1a')]['loggerHandler']=function(_0x375ad5,_0x3fdd11){var _0x32c950=this;return function(_0x54a377){_0x32c950[_0x47a2('0xaf')](_0x3fdd11);logger['error'](_0x375ad5,util[_0x47a2('0x94')](_0x54a377,{'showHidden':![],'depth':null}));};};Dialer[_0x47a2('0x1a')][_0x47a2('0xc9')]=function(_0x1d4285,_0x439ac1,_0x31eabc){var _0x3fd933={'state':0x19,'statedesc':'notFound'};this[_0x47a2('0xaf')](_0x439ac1);this[_0x47a2('0xca')](_[_0x47a2('0xcb')](_0x3fd933,_[_0x47a2('0xcc')](_0x31eabc,[_0x47a2('0xcd'),_0x47a2('0xce'),_0x47a2('0xcf'),_0x47a2('0xd0'),'CampaignId'])),'[emptyContact][createHistory]',_0x47a2('0xd1'));logger['error'](_0x1d4285);};Dialer['prototype']['isSuccess']=function(_0x411de0){return _0x411de0===_0x47a2('0xd2');};Dialer[_0x47a2('0x1a')]['isTrunkReachable']=function(_0x3a8471){return!_[_0x47a2('0x3b')](_0x3a8471)&&_0x3a8471&&!_[_0x47a2('0x3b')](_0x3a8471[_0x47a2('0x40')])&&!_['isUndefined'](_0x3a8471[_0x47a2('0x74')])&&_0x3a8471[_0x47a2('0x74')]&&(this[_0x47a2('0x22')][util['format'](_0x47a2('0xd3'),_0x3a8471['name'])][_0x47a2('0xd4')]===_0x47a2('0xd5')||this[_0x47a2('0x22')][util[_0x47a2('0x76')](_0x47a2('0xd3'),_0x3a8471[_0x47a2('0x40')])][_0x47a2('0xd4')]===_0x47a2('0xd6'));};Dialer[_0x47a2('0x1a')][_0x47a2('0xca')]=function(_0x1f743f,_0x418914,_0x779f7){this['createHistory'](_0x1f743f)['catch'](loggerCatch(_0x418914));this[_0x47a2('0xc3')](_0x1f743f)['catch'](loggerCatch(_0x779f7));};Dialer[_0x47a2('0x1a')][_0x47a2('0xd7')]=function(_0x30ce07){var _0x311989=this[_0x47a2('0x27')][_0x30ce07[_0x47a2('0xd8')]];var _0xd33dd;if(!_[_0x47a2('0xaa')](_0x30ce07)&&!_[_0x47a2('0xaa')](_0x30ce07[_0x47a2('0xd9')])&&!_[_0x47a2('0xaa')](_0x30ce07[_0x47a2('0xd9')][_0x47a2('0xda')])&&_0x30ce07[_0x47a2('0xdb')]===_0x47a2('0xdc')&&_0x311989){if(_0x311989['type']!==_0x47a2('0x79')&&this[_0x47a2('0x1f')][_0x311989[_0x47a2('0xb1')]][_0x47a2('0xdd')]&&_0x30ce07[_0x47a2('0xde')]===_0x47a2('0xdf')){delete this['uniqueId'][_0x30ce07[_0x47a2('0xd8')]];this['updateOriginated'](this[_0x47a2('0x1f')][_0x311989['queue']]);this[_0x47a2('0x1f')][_0x311989[_0x47a2('0xb1')]]['outboundAnswerCallsDay']+=0x1;this[_0x47a2('0x1f')][_0x311989['queue']][_0x47a2('0xe0')]+=0x1;_0xd33dd=new Hangup(_0x311989,_0x30ce07);_0xd33dd['state']=0x12;_0xd33dd[_0x47a2('0xa5')]=_0x47a2('0xe1');_0xd33dd[_0x47a2('0xe2')]='AMD';ami[_0x47a2('0xe3')](_0x47a2('0xe4'),ut[_0x47a2('0xe5')](_0xd33dd,_0x47a2('0xe6')));this['saveInDb'](_0xd33dd,_0x47a2('0xe7'),_0x47a2('0xe8'));}if(_0x311989[_0x47a2('0x52')]!==_0x47a2('0x79')&&this[_0x47a2('0x1f')][_0x311989[_0x47a2('0xb1')]]['dialAMDActive']&&_0x30ce07['value']===_0x47a2('0xe9')){var _0x2140af=this;return new BPromise(function(_0x3a30d1,_0x338207){delete _0x2140af[_0x47a2('0x27')][_0x30ce07[_0x47a2('0xd8')]];_0x2140af['updateOriginated'](_0x2140af[_0x47a2('0x1f')][_0x311989[_0x47a2('0xb1')]]);_0x2140af['voiceQueues'][_0x311989['queue']][_0x47a2('0x5c')]+=0x1;_0x2140af['voiceQueues'][_0x311989['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x5701d2=_0x2140af[_0x47a2('0x1f')][_0x311989[_0x47a2('0xb1')]];var _0x389eac=new Hangup(_0x311989,_0x30ce07);_0x389eac[_0x47a2('0xa4')]=0x13;_0x389eac[_0x47a2('0xa5')]=_0x47a2('0xea');_0x389eac[_0x47a2('0xe2')]=_0x47a2('0xeb');_0x389eac[_0x47a2('0xec')]+=0x1;_0x389eac['countglobal']+=0x1;_0x389eac[_0x47a2('0xe6')]=!![];ami[_0x47a2('0xe3')](_0x47a2('0xe4'),ut[_0x47a2('0xe5')](_0x389eac,_0x47a2('0xe6')));_0x2140af['createHistory'](_0x389eac)[_0x47a2('0xad')](loggerCatch(_0x47a2('0xed')));if(_0x389eac['countbusyretry']+_0x389eac[_0x47a2('0xee')]+_0x389eac[_0x47a2('0xef')]+_0x389eac['countnosuchnumberretry']+_0x389eac['countdropretry']+_0x389eac[_0x47a2('0xf0')]+_0x389eac[_0x47a2('0xec')]+_0x389eac[_0x47a2('0xf1')]>=_0x5701d2['dialGlobalMaxRetry']){_0x2140af[_0x47a2('0xf2')](_0x389eac,_0x3a30d1,_0x338207,_0x47a2('0xf3'));}else{if(_0x389eac[_0x47a2('0xec')]>=_0x5701d2[_0x47a2('0xf4')]){_0x2140af[_0x47a2('0xf5')](_0x389eac,_0x3a30d1,_0x338207,_0x47a2('0xf6'));}else{_0x2140af[_0x47a2('0xbb')]({'active':![],'countmachineretry':_0x389eac['countmachineretry'],'scheduledat':moment()[_0x47a2('0xf7')](_0x5701d2[_0x47a2('0xf8')],'minutes')[_0x47a2('0x76')](_0x47a2('0xf9')),'ContactId':_0x389eac[_0x47a2('0xcd')],'ListId':_0x389eac['ListId'],'VoiceQueueId':_0x389eac[_0x47a2('0xd0')]||undefined,'CampaignId':_0x389eac[_0x47a2('0xfa')]||undefined})[_0x47a2('0xad')](loggerCatch(_0x47a2('0xfb')));_0x3a30d1({'reschedule':0x1});}}});}if(_0x311989[_0x47a2('0x52')]===_0x47a2('0x79')&&this['campaigns'][_0x311989[_0x47a2('0xb1')]][_0x47a2('0xdd')]&&_0x30ce07['value']===_0x47a2('0xdf')){delete this[_0x47a2('0x27')][_0x30ce07[_0x47a2('0xd8')]];this[_0x47a2('0xaf')](this[_0x47a2('0x20')][_0x311989[_0x47a2('0xb1')]]);_0xd33dd=new Hangup(_0x311989,_0x30ce07);_0xd33dd[_0x47a2('0xa4')]=0x12;_0xd33dd[_0x47a2('0xa5')]=_0x47a2('0xe1');_0xd33dd[_0x47a2('0xe2')]=_0x47a2('0xeb');ami['emit'](_0x47a2('0xe4'),ut[_0x47a2('0xe5')](_0xd33dd,_0x47a2('0xe6')));this['saveInDb'](_0xd33dd,_0x47a2('0xfc'),_0x47a2('0xfd'));}if(_0x311989['type']==='ivr'&&this['campaigns'][_0x311989[_0x47a2('0xb1')]][_0x47a2('0xdd')]&&_0x30ce07[_0x47a2('0xde')]===_0x47a2('0xe9')){var _0x2140af=this;return new BPromise(function(_0x46dd9b,_0x54db5b){delete _0x2140af[_0x47a2('0x27')][_0x30ce07['uniqueid']];_0x2140af['updateOriginated'](_0x2140af[_0x47a2('0x20')][_0x311989[_0x47a2('0xb1')]]);_0x2140af[_0x47a2('0x20')][_0x311989['queue']]['outboundAnswerCallsDay']+=0x1;_0x2140af[_0x47a2('0x20')][_0x311989[_0x47a2('0xb1')]][_0x47a2('0xe0')]+=0x1;var _0x30ccf9=_0x2140af[_0x47a2('0x20')][_0x311989['queue']];var _0x436874=new Hangup(_0x311989,_0x30ce07);_0x436874[_0x47a2('0xa4')]=0x13;_0x436874[_0x47a2('0xa5')]='Machine';_0x436874['membername']='AMD';_0x436874['countmachineretry']+=0x1;_0x436874[_0x47a2('0xfe')]+=0x1;_0x436874[_0x47a2('0xe6')]=!![];ami[_0x47a2('0xe3')]('custom:amd',ut['buildObj'](_0x436874,_0x47a2('0xe6')));_0x2140af['createHistory'](_0x436874)[_0x47a2('0xad')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x436874[_0x47a2('0xff')]+_0x436874[_0x47a2('0xee')]+_0x436874[_0x47a2('0xef')]+_0x436874[_0x47a2('0x100')]+_0x436874['countdropretry']+_0x436874[_0x47a2('0xf0')]+_0x436874[_0x47a2('0xec')]+_0x436874[_0x47a2('0xf1')]>=_0x30ccf9[_0x47a2('0x101')]){_0x2140af[_0x47a2('0xf2')](_0x436874,_0x46dd9b,_0x54db5b,_0x47a2('0xf3'));}else{if(_0x436874['countmachineretry']>=_0x30ccf9[_0x47a2('0xf4')]){_0x2140af[_0x47a2('0xf5')](_0x436874,_0x46dd9b,_0x54db5b,_0x47a2('0xf6'));}else{_0x2140af[_0x47a2('0xbb')]({'active':![],'countmachineretry':_0x436874['countmachineretry'],'scheduledat':moment()[_0x47a2('0xf7')](_0x30ccf9[_0x47a2('0xf8')],_0x47a2('0x102'))[_0x47a2('0x76')](_0x47a2('0xf9')),'ContactId':_0x436874['ContactId'],'ListId':_0x436874['ListId'],'VoiceQueueId':_0x436874[_0x47a2('0xd0')]||undefined,'CampaignId':_0x436874[_0x47a2('0xfa')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x46dd9b({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x47a2('0x35')]=function(_0xf3173d){var _0x53c125=this[_0x47a2('0x27')][_0xf3173d['uniqueid']];var _0x34b9b0=this;var _0x28bb9a;if(_0x53c125&&_0x53c125['type']===_0x47a2('0x79')){delete this[_0x47a2('0x27')][_0xf3173d[_0x47a2('0xd8')]];this[_0x47a2('0xaf')](this['campaigns'][_0x53c125[_0x47a2('0xb1')]]);this[_0x47a2('0x20')][_0x53c125[_0x47a2('0xb1')]][_0x47a2('0x103')]+=0x1;_0x28bb9a=new Hangup(_0x53c125,_0xf3173d);this['createHistory'](_0x28bb9a)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x47a2('0xc3')](_0x28bb9a)[_0x47a2('0xad')](loggerCatch(_0x47a2('0x104')));}if(_0x53c125&&_0x53c125[_0x47a2('0x52')]!==_0x47a2('0x79')&&isNotNull(this[_0x47a2('0x1f')][_0x53c125[_0x47a2('0xb1')]]['dialQueueProject'])){delete this[_0x47a2('0x27')][_0xf3173d[_0x47a2('0xd8')]];this[_0x47a2('0xaf')](this[_0x47a2('0x1f')][_0x53c125['queue']]);this[_0x47a2('0x1f')][_0x53c125['queue']][_0x47a2('0x5c')]+=0x1;this['voiceQueues'][_0x53c125['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x28bb9a=new Hangup(_0x53c125,_0xf3173d);_0x28bb9a['state']=0x10;_0x28bb9a['statedesc']=_0x47a2('0x105');_0x28bb9a['membername']=_0x47a2('0x106');this[_0x47a2('0xc5')](_0x28bb9a)[_0x47a2('0xad')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x28bb9a)[_0x47a2('0xad')](loggerCatch(_0x47a2('0x104')));}if(_0x53c125&&_0x53c125[_0x47a2('0x52')]!==_0x47a2('0x79')&&!isNotNull(this['voiceQueues'][_0x53c125[_0x47a2('0xb1')]][_0x47a2('0x107')])){delete this[_0x47a2('0x27')][_0xf3173d[_0x47a2('0xd8')]];this['updateOriginated'](this[_0x47a2('0x1f')][_0x53c125[_0x47a2('0xb1')]]);this['voiceQueues'][_0x53c125[_0x47a2('0xb1')]][_0x47a2('0x65')]+=0x1;_0x28bb9a=new Hangup(_0x53c125,_0xf3173d);_0x28bb9a[_0x47a2('0xa4')]=0xc;_0x28bb9a[_0x47a2('0xa5')]=_0xf3173d[_0x47a2('0x108')];_0x28bb9a[_0x47a2('0xe2')]=_0x47a2('0x109');this[_0x47a2('0xc5')](_0x28bb9a)[_0x47a2('0xad')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x47a2('0xc3')](_0x28bb9a)[_0x47a2('0xad')](loggerCatch(_0x47a2('0x104')));}};Dialer[_0x47a2('0x1a')][_0x47a2('0x32')]=function(_0x2144e6){var _0xb660ed=this[_0x47a2('0x27')][_0x2144e6[_0x47a2('0xd8')]];var _0x39fe16=this;if(this[_0x47a2('0x1f')][_0x2144e6[_0x47a2('0xb1')]]){if(_0xb660ed&&_0xb660ed['type']!==_0x47a2('0x79')){delete this[_0x47a2('0x27')][_0x2144e6['uniqueid']];this['voiceQueues'][_0x2144e6[_0x47a2('0xb1')]]['outboundAnswerCallsDay']+=0x1;var _0x581d2b=new AgentComplete(_0xb660ed,_0x2144e6);if(_0x2144e6[_0x47a2('0x10a')]==='agent'){_0x581d2b[_0x47a2('0x10b')]=this[_0x47a2('0x1f')][_0x2144e6[_0x47a2('0xb1')]][_0x47a2('0x10c')]&&this[_0x47a2('0x1f')][_0x2144e6[_0x47a2('0xb1')]]['dialAgiAfterHangupAgent']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x581d2b)[_0x47a2('0xad')](loggerCatch(_0x47a2('0x10d')));this[_0x47a2('0xc3')](_0x581d2b)[_0x47a2('0xad')](loggerCatch(_0x47a2('0x10e')));}}};Dialer[_0x47a2('0x1a')][_0x47a2('0x2c')]=function(_0x3858b7){if(this[_0x47a2('0x1f')][_0x3858b7['queue']]){if(this['uniqueId'][_0x3858b7['uniqueid']]&&this[_0x47a2('0x27')][_0x3858b7[_0x47a2('0xd8')]][_0x47a2('0x52')]!==_0x47a2('0x79')){this[_0x47a2('0xaf')](this[_0x47a2('0x1f')][_0x3858b7[_0x47a2('0xb1')]]);this[_0x47a2('0x27')][_0x3858b7[_0x47a2('0xd8')]]['answertime']=moment()['format'](_0x47a2('0xf9'));}}};Dialer[_0x47a2('0x1a')][_0x47a2('0x10f')]=function(_0x37215f){this[_0x47a2('0xc5')](_0x37215f)['catch'](loggerCatch(_0x47a2('0x10d')));this[_0x47a2('0xc3')](_0x37215f)['catch'](loggerCatch(_0x47a2('0x110')));};Dialer['prototype'][_0x47a2('0x2f')]=function(_0x301304){var _0x30258b=this[_0x47a2('0x27')][_0x301304[_0x47a2('0xd8')]];var _0x44906a=this;if(this[_0x47a2('0x1f')][_0x301304[_0x47a2('0xb1')]]){if(_0x30258b&&_0x30258b[_0x47a2('0x52')]!==_0x47a2('0x79')){delete this[_0x47a2('0x27')][_0x301304['uniqueid']];this[_0x47a2('0xaf')](this[_0x47a2('0x1f')][_0x301304[_0x47a2('0xb1')]]);_0x30258b[_0x47a2('0x111')]=moment()[_0x47a2('0x76')]('YYYY-MM-DD\x20HH:mm:ss');var _0x547236=new QueueCallerAbandon(_0x30258b,_0x301304);if(getSeconds(_0x30258b[_0x47a2('0x111')],_0x30258b[_0x47a2('0x112')])>=_0x30258b[_0x47a2('0x113')]){this[_0x47a2('0x1f')][_0x301304['queue']][_0x47a2('0x69')]+=0x1;this[_0x47a2('0x1f')][_0x301304[_0x47a2('0xb1')]][_0x47a2('0x5f')]+=0x1;this[_0x47a2('0x1f')][_0x301304['queue']][_0x47a2('0x6b')]+=0x1;_0x547236[_0x47a2('0xa4')]=0xa;_0x547236[_0x47a2('0xa5')]=_0x47a2('0x114');_0x547236[_0x47a2('0x115')]='TIMEOUT';_0x547236[_0x47a2('0x10b')]=this['voiceQueues'][_0x301304[_0x47a2('0xb1')]][_0x47a2('0x10c')]?moment()[_0x47a2('0x76')](_0x47a2('0xf9')):undefined;_0x547236[_0x47a2('0x116')]+=0x1;_0x547236[_0x47a2('0xfe')]+=0x1;if(_0x547236['countdropretry']>=this[_0x47a2('0x1f')][_0x301304[_0x47a2('0xb1')]][_0x47a2('0x117')]){this['queueCallerAbandonCreateState'](_0x547236);}else{this[_0x47a2('0xbb')]({'active':![],'countdropretry':_0x547236[_0x47a2('0x116')],'scheduledat':moment()['add'](this[_0x47a2('0x1f')][_0x301304['queue']][_0x47a2('0x118')],_0x47a2('0x102'))[_0x47a2('0x76')](_0x47a2('0xf9')),'ContactId':_0x30258b[_0x47a2('0xcd')],'ListId':_0x30258b[_0x47a2('0xce')],'VoiceQueueId':_0x30258b[_0x47a2('0xd0')]||undefined,'CampaignId':_0x30258b['CampaignId']||undefined})['catch'](loggerCatch(_0x47a2('0x119')));var _0x5ebe57=new History(_0x547236);_0x5ebe57[_0x47a2('0xa4')]=0xa;_0x5ebe57[_0x47a2('0xa5')]=_0x47a2('0x114');_0x5ebe57['starttime']=moment()[_0x47a2('0x76')](_0x47a2('0xf9'));_0x5ebe57[_0x47a2('0x11a')]=_0x5ebe57['starttime'];_0x5ebe57[_0x47a2('0x11b')]=_0x547236[_0x47a2('0x11b')];_0x5ebe57[_0x47a2('0x11c')]=_0x547236[_0x47a2('0x11c')];this[_0x47a2('0xc5')](_0x5ebe57)[_0x47a2('0xad')](loggerCatch(_0x47a2('0x11d')));}}else{this['voiceQueues'][_0x301304[_0x47a2('0xb1')]][_0x47a2('0x81')]+=0x1;this[_0x47a2('0x1f')][_0x301304['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x547236[_0x47a2('0xa4')]=0xb;_0x547236[_0x47a2('0xa5')]=_0x47a2('0x11e');_0x547236[_0x47a2('0x115')]=_0x47a2('0x11f');_0x547236[_0x47a2('0xf0')]+=0x1;_0x547236[_0x47a2('0xfe')]+=0x1;if(_0x547236[_0x47a2('0xf0')]>=this['voiceQueues'][_0x301304['queue']][_0x47a2('0x120')]){this[_0x47a2('0x10f')](_0x547236);}else{this[_0x47a2('0xbb')]({'active':![],'countabandonedretry':_0x547236[_0x47a2('0xf0')],'scheduledat':moment()[_0x47a2('0xf7')](this[_0x47a2('0x1f')][_0x301304[_0x47a2('0xb1')]][_0x47a2('0x121')],_0x47a2('0x102'))[_0x47a2('0x76')](_0x47a2('0xf9')),'ContactId':_0x30258b[_0x47a2('0xcd')],'ListId':_0x30258b[_0x47a2('0xce')],'VoiceQueueId':_0x30258b['VoiceQueueId']||undefined,'CampaignId':_0x30258b[_0x47a2('0xfa')]||undefined})['catch'](loggerCatch(_0x47a2('0x122')));var _0x5ebe57=new History(_0x547236);_0x5ebe57['state']=0xb;_0x5ebe57['statedesc']=_0x47a2('0x11e');_0x5ebe57[_0x47a2('0xa6')]=moment()[_0x47a2('0x76')](_0x47a2('0xf9'));_0x5ebe57['endtime']=_0x5ebe57[_0x47a2('0xa6')];_0x5ebe57['calleridname']=_0x547236[_0x47a2('0x11b')];_0x5ebe57[_0x47a2('0x11c')]=_0x547236[_0x47a2('0x11c')];this[_0x47a2('0xc5')](_0x5ebe57)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype'][_0x47a2('0x123')]=function(_0x191506){if(this[_0x47a2('0x25')][_0x191506[_0x47a2('0xd8')]]){this['actions'][_0x191506[_0x47a2('0xd8')]][_0x47a2('0xac')]=_0x191506[_0x47a2('0xac')];}if(this['uniqueId'][_0x191506[_0x47a2('0xd8')]]){this[_0x47a2('0x27')][_0x191506[_0x47a2('0xd8')]][_0x47a2('0xac')]=_0x191506[_0x47a2('0xac')];}};Dialer[_0x47a2('0x1a')][_0x47a2('0x38')]=function(_0x4f59d4){if(strategy[this[_0x47a2('0x1f')][this[_0x47a2('0x25')][_0x4f59d4[_0x47a2('0x124')]]['queue']][_0x47a2('0x4a')]]===_0x47a2('0x19')){if(this[_0x47a2('0x25')][_0x4f59d4['actionid']]&&_[_0x47a2('0xaa')](this[_0x47a2('0x25')][_0x4f59d4[_0x47a2('0x124')]][_0x47a2('0x125')])&&_0x4f59d4[_0x47a2('0xd4')]==='1'&&_0x4f59d4[_0x47a2('0x126')]==='0'){if(this[_0x47a2('0x21')][_0x4f59d4[_0x47a2('0x127')]]){if(!this[_0x47a2('0x21')][_0x4f59d4[_0x47a2('0x127')]][_0x47a2('0x125')]){this[_0x47a2('0x21')][_0x4f59d4[_0x47a2('0x127')]]['locked']=!![];this[_0x47a2('0x25')][_0x4f59d4[_0x47a2('0x124')]][_0x47a2('0x125')]=!![];this[_0x47a2('0x25')][_0x4f59d4[_0x47a2('0x124')]][_0x47a2('0x127')]=_0x4f59d4['stateinterface'];}}}}else if((strategy[this[_0x47a2('0x1f')][this[_0x47a2('0x25')][_0x4f59d4['actionid']]['queue']][_0x47a2('0x4a')]]||_0x47a2('0x18'))==='rrmemory'){if(this['actions'][_0x4f59d4[_0x47a2('0x124')]]){if(this[_0x47a2('0x21')][_0x4f59d4[_0x47a2('0x127')]]){this[_0x47a2('0x25')][_0x4f59d4['actionid']]['stateinterface']=_0x4f59d4[_0x47a2('0x127')];if(_[_0x47a2('0xaa')](this[_0x47a2('0x128')][this['actions'][_0x4f59d4['actionid']]['queue']])){this['queueBooked'][this[_0x47a2('0x25')][_0x4f59d4[_0x47a2('0x124')]][_0x47a2('0xb1')]]=[];}this[_0x47a2('0x128')][this[_0x47a2('0x25')][_0x4f59d4['actionid']][_0x47a2('0xb1')]][_0x47a2('0x129')](_[_0x47a2('0xcb')](_[_0x47a2('0xcc')](this['actions'][_0x4f59d4[_0x47a2('0x124')]],[_0x47a2('0x12a'),_0x47a2('0x127')]),{'status':_0x4f59d4['status'],'paused':_0x4f59d4['paused']}));}}}};function unlockQueueStatus(_0x5c996b,_0x2d58fd){setTimeout(function(){if(_['isUndefined'](_0x5c996b[_0x47a2('0x12b')])){loggerBooked[_0x47a2('0x93')](_0x47a2('0x12c'),_0x2d58fd);}_0x5c996b[_0x47a2('0x12b')]=!![];loggerBooked['info'](_0x47a2('0x12d'),_0x2d58fd,JSON[_0x47a2('0x47')](_[_0x47a2('0xcc')](_0x5c996b,[_0x47a2('0x40'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x47a2('0x1a')][_0x47a2('0x39')]=function(_0x21602a){var _0x1d8036=this;var _0x2a638a=_0x1d8036[_0x47a2('0x1f')][_0x1d8036[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]]['queue']];if(strategy[this[_0x47a2('0x1f')][this['actions'][_0x21602a[_0x47a2('0x124')]][_0x47a2('0xb1')]][_0x47a2('0x4a')]]===_0x47a2('0x19')){if(this[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]]&&this[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]]['stateinterface']){this[_0x47a2('0x1e')][_0x47a2('0x12e')](this[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]][_0x47a2('0x12a')],this['actions'][_0x21602a[_0x47a2('0x124')]][_0x47a2('0x127')])[_0x47a2('0xad')](function(_0x2866bc){logger[_0x47a2('0x93')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x2866bc,{'showHidden':![],'depth':null}));})[_0x47a2('0x12f')](function(){_0x1d8036[_0x47a2('0xaf')](_0x1d8036[_0x47a2('0x1f')][_0x1d8036[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]][_0x47a2('0xb1')]]);_0x1d8036['agents'][_0x1d8036[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]][_0x47a2('0x127')]][_0x47a2('0x125')]=![];delete _0x1d8036['actions'][_0x21602a[_0x47a2('0x124')]];unlockQueueStatus(_0x2a638a);});}else{this[_0x47a2('0xaf')](this[_0x47a2('0x1f')][this[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]][_0x47a2('0xb1')]]);this[_0x47a2('0xbb')]({'active':![],'ContactId':this[_0x47a2('0x25')][_0x21602a['actionid']][_0x47a2('0xcd')],'ListId':this['actions'][_0x21602a[_0x47a2('0x124')]][_0x47a2('0xce')],'VoiceQueueId':this[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]][_0x47a2('0xd0')]||undefined,'CampaignId':this['actions'][_0x21602a['actionid']][_0x47a2('0xfa')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]];unlockQueueStatus(_0x2a638a);}}else if((strategy[this['voiceQueues'][this[_0x47a2('0x25')][_0x21602a['actionid']][_0x47a2('0xb1')]][_0x47a2('0x4a')]]||_0x47a2('0x18'))===_0x47a2('0x18')){var _0x51579;if(this[_0x47a2('0x25')][_0x21602a['actionid']]&&!_[_0x47a2('0x44')](this[_0x47a2('0x128')][this[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]]['queue']])){if(this[_0x47a2('0x130')][_0x1d8036[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]][_0x47a2('0xb1')]]){this['queueBookedRR'][_0x1d8036['actions'][_0x21602a[_0x47a2('0x124')]]['queue']]=this[_0x47a2('0x130')][this[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]][_0x47a2('0xb1')]]?this['queueBookedRR'][this[_0x47a2('0x25')][_0x21602a['actionid']][_0x47a2('0xb1')]]:this[_0x47a2('0x128')][this[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]][_0x47a2('0xb1')]]?this[_0x47a2('0x128')][this[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]][_0x47a2('0xb1')]][_0x47a2('0x131')]||0x0:0x0;}this[_0x47a2('0x128')][this[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]]['queue']][_0x47a2('0x131')]=this[_0x47a2('0x130')][this[_0x47a2('0x25')][_0x21602a[_0x47a2('0x124')]][_0x47a2('0xb1')]];for(var _0x26e33d=0x0;_0x26e33d=0x0;})['catch'](myreject(_0x3d2b1d)));}}else{_0x54c063[_0x47a2('0x129')](ami[_0x47a2('0xab')]({'action':_0x47a2('0x14d'),'command':util[_0x47a2('0x76')](_0x47a2('0x14e'),_0x5c81e0,!_['isUndefined'](config[_0x47a2('0x149')][_0x42c117])?_0x42c117:'')})[_0x47a2('0xb4')](function(_0x5a3953){return _0x5a3953['content'][_0x47a2('0x151')]('true')>=0x0;})[_0x47a2('0xad')](myreject(_0x3d2b1d)));}BPromise[_0x47a2('0x152')](_0x54c063)[_0x47a2('0xb4')](function(_0x21946f){var _0x4e4112=_[_0x47a2('0x153')](_0x21946f);if(_0x4e4112){return _0x582f49(_0x4e4112);}else{_0x3b45b7[_0x47a2('0x3c')]=_0x463e96?_0x47a2('0x154'):_0x47a2('0x155');return _0x3d2b1d(msgResponse('[ifTime][promiseAll]',_0x47a2('0x146'),_0x47a2('0x156')+_0x463e96+'\x20'+_0x5ba93e+_0x47a2('0x157')+util[_0x47a2('0x94')](_0x5c81e0,{'showHidden':![],'depth':null})+_0x47a2('0x158')+_0x42c117));}})[_0x47a2('0xad')](function(_0x181771){return _0x3d2b1d(msgResponse(_0x47a2('0x145'),_0x47a2('0x146'),JSON['stringify'](_0x181771)));});});};Dialer['prototype'][_0x47a2('0x159')]=function(_0x4639b1){var _0x386cd7=this;return function(){switch(_0x4639b1[_0x47a2('0x57')]){case'progressive':freeVariablesPredictive(_0x4639b1);_0x386cd7['handlePower'](_0x4639b1,0x1);break;case _0x47a2('0x15a'):freeVariablesPredictive(_0x4639b1);_0x386cd7[_0x47a2('0x15b')](_0x4639b1,_0x4639b1[_0x47a2('0x15c')]);break;case _0x47a2('0xb'):_0x386cd7[_0x47a2('0xb')](_0x4639b1);break;case _0x47a2('0xa'):freeVariablesPredictive(_0x4639b1);_0x386cd7['handlePower'](_0x4639b1,0x1);break;default:freeVariablesPredictive(_0x4639b1);logger[_0x47a2('0x93')](_0x47a2('0x15d'),_0x4639b1[_0x47a2('0x40')],'method\x20not\x20recognized');}};};Dialer['prototype']['launchHandleIvr']=function(_0x245953){var _0x57a27e=this;return function(){_0x57a27e[_0x47a2('0x15e')](_0x245953);};};Dialer[_0x47a2('0x1a')][_0x47a2('0xc')]=function(_0x484bd5){var _0x159ed3=this;if(isNotPreview(_0x484bd5[_0x47a2('0x57')])){if(isVoiceQueueOutbound(_0x484bd5[_0x47a2('0x52')])&&isActive(_0x484bd5['dialActive'])){_0x484bd5[_0x47a2('0x9e')]=!![];BPromise['resolve']()[_0x47a2('0xb4')](checkIsLoggedIn(_0x484bd5,_0x484bd5[_0x47a2('0x4d')]))[_0x47a2('0xb4')](checkIsActive(_0x484bd5,_0x484bd5[_0x47a2('0x15f')]))[_0x47a2('0xb4')](checkInterval(_0x484bd5))['then'](_0x159ed3[_0x47a2('0x13f')](_0x484bd5))[_0x47a2('0xb4')](_0x159ed3[_0x47a2('0x143')](_0x484bd5[_0x47a2('0x160')],_0x484bd5[_0x47a2('0x161')],_0x484bd5[_0x47a2('0x40')],_0x484bd5))[_0x47a2('0xb4')](_0x159ed3[_0x47a2('0x144')](_0x484bd5[_0x47a2('0x45')],_0x484bd5[_0x47a2('0x161')],_0x484bd5[_0x47a2('0x40')],_0x484bd5))['then'](_0x159ed3[_0x47a2('0x159')](_0x484bd5))[_0x47a2('0xad')](loggerCatchQueueSummary(_0x47a2('0x162'),_0x484bd5));}else{notSendMessagesQueue(_0x484bd5);}}else{freeVariablesPredictive(_0x484bd5);}};Dialer[_0x47a2('0x1a')][_0x47a2('0x163')]=function(){var _0x1198ff=this;var _0xea1e75;for(var _0x44cf91 in this[_0x47a2('0x20')]){if(typeof this[_0x47a2('0x20')][_0x44cf91]!=='undefined'){_0xea1e75=this[_0x47a2('0x20')][_0x44cf91];if(isCampaignIvr(_0xea1e75[_0x47a2('0x52')])&&isActive(_0xea1e75[_0x47a2('0x74')])){_0xea1e75['sendMessageOneNotActive']=!![];BPromise[_0x47a2('0xb7')]()[_0x47a2('0xb4')](checkIsActive(_0xea1e75,_0xea1e75[_0x47a2('0x74')]))[_0x47a2('0xb4')](checkInterval(_0xea1e75))[_0x47a2('0xb4')](_0x1198ff[_0x47a2('0x13f')](_0xea1e75))['then'](_0x1198ff[_0x47a2('0x143')](_0xea1e75[_0x47a2('0x160')],_0xea1e75[_0x47a2('0x161')],_0xea1e75[_0x47a2('0x40')],_0xea1e75))[_0x47a2('0xb4')](_0x1198ff[_0x47a2('0x144')](_0xea1e75[_0x47a2('0x45')],_0xea1e75['dialTimezone'],_0xea1e75[_0x47a2('0x40')],_0xea1e75))['then'](_0x1198ff[_0x47a2('0x164')](_0xea1e75))[_0x47a2('0xad')](loggerCatchQueueSummary(_0x47a2('0x165'),_0xea1e75));}else{notSendMessagesCampaign(_0xea1e75);}}}};function getCallerIdRandom(_0x2f77cd,_0x7e3987){var _0x4a3f6d;var _0x1ee14e;var _0x311f1f;if(_0x7e3987<=0x0){_0x7e3987=0x1;}_0x4a3f6d=new RegExp('\x5cw{0,'+_0x7e3987+'}$');_0x1ee14e=Math[_0x47a2('0x166')](0xa,_0x7e3987-0x1);_0x311f1f=Math[_0x47a2('0x166')](0xa,_0x7e3987)-0x1;return util['format']('%s',_[_0x47a2('0x167')](_0x2f77cd,_0x4a3f6d,_[_0x47a2('0x168')](_0x1ee14e,_0x311f1f)));}function extractCalleridName(_0x5165f6){var _0x590fa1=_0x5165f6['match'](/"(.*?)"/);return _0x590fa1?_0x590fa1[0x1]:_0x5165f6;}function extractCalleridNumber(_0x24d844){var _0x565ce6=_0x24d844[_0x47a2('0x169')](/<(.*?)>/);return _0x565ce6?_0x565ce6[0x1]:_0x24d844;}Dialer['prototype'][_0x47a2('0x16a')]=function(_0x13a265,_0x332c42){var _0x16134d=this;var _0x158aa0=uuid['v4']();this[_0x47a2('0x25')][_0x158aa0]=new Action(_0x13a265,_0x332c42,_0x158aa0);return new BPromise(function(_0x519802,_0x20d8b2){if(_[_0x47a2('0x3b')](_0x13a265)&&typeof _0x13a265!=='object'){return _0x20d8b2(msgResponse('originate',_0x47a2('0x146'),_0x47a2('0x16b')));}if(_['isUndefined'](_0x332c42[_0x47a2('0x16c')][_0x47a2('0x16d')])||_0x332c42['Contact'][_0x47a2('0x16d')]===null){return _0x20d8b2(msgResponse(_0x47a2('0x16e'),_0x47a2('0x146'),'contact\x20is\x20undefine'));}var _0x4f77d5={'XMD-CALLERID':_0x16134d[_0x47a2('0x25')][_0x158aa0][_0x47a2('0x16f')](),'XMD-AGI':_0x13a265['dialQueueProject']?util[_0x47a2('0x76')](_0x47a2('0x170'),ipAgi,_0x13a265['dialQueueProject']):_0x47a2('0x171'),'XMD-AGIAFTER':_0x13a265[_0x47a2('0x10c')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x13a265[_0x47a2('0x10c')]):'NONE','XMD-QUEUE':_0x13a265[_0x47a2('0x52')]==='outbound'?util['format'](_0x47a2('0x172'),_0x13a265[_0x47a2('0x40')],_0x13a265[_0x47a2('0x173')]||'',_0x13a265['dialAgiAfterHangupAgent']?'c':'',_0x13a265[_0x47a2('0x113')]||0x3):_0x47a2('0x171'),'XMD-CONTACTID':_0x332c42[_0x47a2('0xcd')],'XMD-CDRTYPE':_0x47a2('0x9'),'CALLERID(all)':_0x16134d[_0x47a2('0x25')][_0x158aa0][_0x47a2('0x16f')](),'XMD-AMD':_0x13a265[_0x47a2('0xdd')]?'ACTIVE':'NONE','XMD-DESTINATION':_0x47a2('0xdc')};if(_0x13a265[_0x47a2('0xdd')]){_0x4f77d5[_0x47a2('0x174')]=_0x13a265[_0x47a2('0x175')]||0x9c4;_0x4f77d5[_0x47a2('0x176')]=_0x13a265[_0x47a2('0x177')]||0x5dc;_0x4f77d5[_0x47a2('0x178')]=_0x13a265['dialAMDAfterGreetingSilence']||0x320;_0x4f77d5[_0x47a2('0x179')]=_0x13a265[_0x47a2('0x17a')]||0x1388;_0x4f77d5[_0x47a2('0x17b')]=_0x13a265['dialAMDMinWordLength']||0x64;_0x4f77d5[_0x47a2('0x17c')]=_0x13a265[_0x47a2('0x17d')]||0x32;_0x4f77d5[_0x47a2('0x17e')]=_0x13a265[_0x47a2('0x17f')]||0x3;_0x4f77d5[_0x47a2('0x180')]=_0x13a265[_0x47a2('0x181')]||0x100;_0x4f77d5['XMD-AMDMAXIMUMWORDLENGTH']=_0x13a265[_0x47a2('0x182')]||0x1388;}if(_0x13a265[_0x47a2('0x52')]===_0x47a2('0x49')){_0x4f77d5[_0x47a2('0x183')]=_0x332c42[_0x47a2('0xd0')];}else{_0x4f77d5[_0x47a2('0x184')]=_0x332c42[_0x47a2('0xfa')];}for(var _0x33467c in _0x332c42[_0x47a2('0x16c')]){if(typeof _0x332c42[_0x47a2('0x16c')][_0x33467c]!==_0x47a2('0x97')){if(isNotNull(_0x332c42['Contact'][_0x33467c])&&_0x33467c!=='id'&&_0x33467c!==_0x47a2('0x185')&&_0x33467c!==_0x47a2('0x186')&&_0x33467c!==_0x47a2('0x187')){_0x4f77d5[util[_0x47a2('0x76')]('%s%s',_0x47a2('0x188'),_[_0x47a2('0x189')](_0x33467c))]=_0x332c42[_0x47a2('0x16c')][_0x33467c];}}}var _0x2e2c7e=_0x16134d[_0x47a2('0x140')](_0x13a265['Trunk'])?getCallerId(_0x13a265[_0x47a2('0x73')][_0x47a2('0x75')],_0x13a265[_0x47a2('0x58')],_0x13a265[_0x47a2('0x18a')]>0x0?getCallerIdRandom(_0x13a265[_0x47a2('0x59')],_0x13a265[_0x47a2('0x18a')]):_0x13a265['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x13a265['TrunkBackup'])?_0x13a265[_0x47a2('0x73')][_0x47a2('0x75')]:_0x13a265[_0x47a2('0x141')][_0x47a2('0x75')],_0x13a265[_0x47a2('0x58')],_0x13a265[_0x47a2('0x18a')]>0x0?getCallerIdRandom(_0x13a265[_0x47a2('0x59')],_0x13a265[_0x47a2('0x18a')]):_0x13a265[_0x47a2('0x59')]);if(_0x2e2c7e){_0x4f77d5[_0x47a2('0x18b')]=_0x16134d[_0x47a2('0x25')][_0x158aa0][_0x47a2('0x18c')]=extractCalleridName(_0x2e2c7e);_0x4f77d5['XMD-ORIGINATECALLERIDNUM']=_0x16134d[_0x47a2('0x25')][_0x158aa0]['originatecalleridnum']=extractCalleridNumber(_0x2e2c7e);}return ami[_0x47a2('0xab')]({'actionid':_0x158aa0,'action':_0x47a2('0x16e'),'channel':_0x16134d[_0x47a2('0x140')](_0x13a265[_0x47a2('0x73')])?util['format'](_0x47a2('0x18d'),_0x13a265[_0x47a2('0x73')]['name'],isNotNull(_0x13a265[_0x47a2('0x5b')])?_0x13a265['dialPrefix'][_0x47a2('0x18e')]()||'':'',_0x13a265[_0x47a2('0x18f')]>0x0?_0x332c42['Contact'][_0x47a2('0x16d')][_0x47a2('0x190')](_0x13a265[_0x47a2('0x18f')]):_0x332c42[_0x47a2('0x16c')][_0x47a2('0x16d')]):util[_0x47a2('0x76')](_0x47a2('0x18d'),_['isNil'](_0x13a265[_0x47a2('0x141')])?_0x13a265[_0x47a2('0x73')]['name']:_0x13a265[_0x47a2('0x141')][_0x47a2('0x40')],isNotNull(_0x13a265[_0x47a2('0x5b')])?_0x13a265[_0x47a2('0x5b')][_0x47a2('0x18e')]()||'':'',_0x13a265[_0x47a2('0x18f')]>0x0?_0x332c42['Contact']['phone'][_0x47a2('0x190')](_0x13a265['dialCutDigit']):_0x332c42[_0x47a2('0x16c')][_0x47a2('0x16d')]),'callerid':_0x2e2c7e,'Exten':_0x47a2('0xdc'),'Context':_0x47a2('0x191'),'Priority':'1','variable':_0x4f77d5,'timeout':(_0x13a265[_0x47a2('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x158aa0})[_0x47a2('0xb4')](function(_0x36db1a){return _0x519802(_0x36db1a);})[_0x47a2('0xad')](function(_0x3a36fb){_0x13a265[_0x47a2('0x62')]+=0x1;var _0x2a6ebe=new History(_0x16134d[_0x47a2('0x25')][_0x158aa0]);logger['error'](util['format'](_0x47a2('0x192'),JSON[_0x47a2('0x47')](_0x3a36fb)));_0x2a6ebe[_0x47a2('0xa4')]=0xe;_0x2a6ebe[_0x47a2('0xa5')]=_0x47a2('0x193');_0x2a6ebe[_0x47a2('0xa6')]=moment()[_0x47a2('0x76')](_0x47a2('0xf9'));_0x2a6ebe[_0x47a2('0x11a')]=_0x2a6ebe['starttime'];_0x16134d[_0x47a2('0xc5')](_0x2a6ebe)[_0x47a2('0xad')](loggerCatch(_0x47a2('0x194')));_0x16134d[_0x47a2('0xc3')](_0x2a6ebe)['catch'](loggerCatch(_0x47a2('0x194')))[_0x47a2('0x12f')](function(){delete _0x16134d['actions'][_0x158aa0];return _0x20d8b2(msgResponse(_0x47a2('0x16e'),_0x47a2('0x195'),'originate\x20action\x20Error'));});});});};Dialer[_0x47a2('0x1a')][_0x47a2('0x31')]=function(_0x51eb80){var _0xc82772=this['actions'][_0x51eb80[_0x47a2('0x124')]];if(_0xc82772){delete this['actions'][_0x51eb80[_0x47a2('0x124')]];_0xc82772[_0x47a2('0x112')]=moment()[_0x47a2('0x76')](_0x47a2('0xf9'));var _0x28557e=_0xc82772[_0x47a2('0x52')]===_0x47a2('0x79')?this[_0x47a2('0x20')][_0xc82772['queue']]:this[_0x47a2('0x1f')][_0xc82772[_0x47a2('0x196')]()];if(!this[_0x47a2('0x197')](_0x51eb80[_0x47a2('0x198')])){this[_0x47a2('0xaf')](_0x28557e);return this[_0x47a2('0x199')](_0xc82772,_0x28557e,_0x51eb80)[_0x47a2('0xad')](loggerCatch(_0x47a2('0x19a')));}this[_0x47a2('0x27')][_0x51eb80['uniqueid']]=_0xc82772;}};Dialer[_0x47a2('0x1a')]['checkRetriveMax']=function(_0x460e81,_0x48d9bd,_0x39a3e2){var _0x38ce33=new History(_0x48d9bd);if(_0x38ce33[_0x47a2('0xff')]+_0x38ce33[_0x47a2('0xee')]+_0x38ce33[_0x47a2('0xef')]+_0x38ce33[_0x47a2('0x100')]+_0x38ce33[_0x47a2('0x116')]+_0x38ce33['countabandonedretry']+_0x38ce33[_0x47a2('0xec')]+_0x38ce33[_0x47a2('0xf1')]>=_0x39a3e2[_0x47a2('0x101')]-0x1){return!![];}switch(_0x460e81){case 0x3:if(_0x38ce33[_0x47a2('0xef')]>=_0x39a3e2[_0x47a2('0x19b')]-0x1){return!![];}this[_0x47a2('0xbb')]({'active':![],'countnoanswerretry':_0x38ce33[_0x47a2('0xef')]+=0x1,'scheduledat':moment()[_0x47a2('0xf7')](_0x39a3e2[_0x47a2('0x19c')],'minutes')[_0x47a2('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x38ce33[_0x47a2('0xcd')],'ListId':_0x38ce33[_0x47a2('0xce')],'VoiceQueueId':_0x38ce33[_0x47a2('0xd0')]||undefined,'CampaignId':_0x38ce33[_0x47a2('0xfa')]||undefined})[_0x47a2('0xad')](loggerCatch(_0x47a2('0x19d')));break;case 0x5:if(_0x38ce33[_0x47a2('0xff')]>=_0x39a3e2[_0x47a2('0x19e')]-0x1){return!![];}this[_0x47a2('0xbb')]({'active':![],'countbusyretry':_0x38ce33[_0x47a2('0xff')]+=0x1,'scheduledat':moment()[_0x47a2('0xf7')](_0x39a3e2['dialBusyRetryFrequency'],_0x47a2('0x102'))[_0x47a2('0x76')](_0x47a2('0xf9')),'ContactId':_0x38ce33[_0x47a2('0xcd')],'ListId':_0x38ce33['ListId'],'VoiceQueueId':_0x38ce33[_0x47a2('0xd0')]||undefined,'CampaignId':_0x38ce33[_0x47a2('0xfa')]||undefined})['catch'](loggerCatch(_0x47a2('0x19f')));break;case 0x8:if(_0x38ce33[_0x47a2('0xee')]>=_0x39a3e2[_0x47a2('0x1a0')]-0x1){return!![];}this[_0x47a2('0xbb')]({'active':![],'countcongestionretry':_0x38ce33['countcongestionretry']+=0x1,'scheduledat':moment()[_0x47a2('0xf7')](_0x39a3e2[_0x47a2('0x1a1')],'minutes')[_0x47a2('0x76')](_0x47a2('0xf9')),'ContactId':_0x38ce33[_0x47a2('0xcd')],'ListId':_0x38ce33['ListId'],'VoiceQueueId':_0x38ce33[_0x47a2('0xd0')]||undefined,'CampaignId':_0x38ce33[_0x47a2('0xfa')]||undefined})[_0x47a2('0xad')](loggerCatch(_0x47a2('0x1a2')));break;case 0x0:if(_0x38ce33[_0x47a2('0x100')]>=_0x39a3e2[_0x47a2('0x1a3')]-0x1){return!![];}else{this[_0x47a2('0xbb')]({'active':![],'countnosuchnumberretry':_0x38ce33[_0x47a2('0x100')]+=0x1,'scheduledat':moment()[_0x47a2('0xf7')](_0x39a3e2[_0x47a2('0x1a4')],_0x47a2('0x102'))[_0x47a2('0x76')](_0x47a2('0xf9')),'ContactId':_0x38ce33[_0x47a2('0xcd')],'ListId':_0x38ce33[_0x47a2('0xce')],'VoiceQueueId':_0x38ce33[_0x47a2('0xd0')]||undefined,'CampaignId':_0x38ce33[_0x47a2('0xfa')]||undefined})['catch'](loggerCatch(_0x47a2('0x1a5')));}break;case 0xa:if(_0x38ce33[_0x47a2('0x116')]>=_0x39a3e2[_0x47a2('0x117')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x38ce33[_0x47a2('0x116')]+=0x1,'scheduledat':moment()['add'](_0x39a3e2[_0x47a2('0x118')],_0x47a2('0x102'))[_0x47a2('0x76')](_0x47a2('0xf9')),'ContactId':_0x38ce33[_0x47a2('0xcd')],'ListId':_0x38ce33[_0x47a2('0xce')],'VoiceQueueId':_0x38ce33[_0x47a2('0xd0')]||undefined,'CampaignId':_0x38ce33[_0x47a2('0xfa')]||undefined})[_0x47a2('0xad')](loggerCatch(_0x47a2('0x119')));break;case 0xb:if(_0x38ce33[_0x47a2('0xf0')]>=_0x39a3e2[_0x47a2('0x120')]-0x1){return!![];}this[_0x47a2('0xbb')]({'active':![],'countabandonedretry':_0x38ce33['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x39a3e2[_0x47a2('0x121')],'minutes')[_0x47a2('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x38ce33['ContactId'],'ListId':_0x38ce33[_0x47a2('0xce')],'VoiceQueueId':_0x38ce33[_0x47a2('0xd0')]||undefined,'CampaignId':_0x38ce33['CampaignId']||undefined})[_0x47a2('0xad')](loggerCatch(_0x47a2('0x122')));break;case 0x13:if(_0x38ce33['countmachineretry']>=_0x39a3e2[_0x47a2('0xf4')]-0x1){return!![];}this[_0x47a2('0xbb')]({'active':![],'countmachineretry':_0x38ce33[_0x47a2('0xec')]+=0x1,'scheduledat':moment()[_0x47a2('0xf7')](_0x39a3e2[_0x47a2('0xf8')],'minutes')[_0x47a2('0x76')](_0x47a2('0xf9')),'ContactId':_0x38ce33['ContactId'],'ListId':_0x38ce33[_0x47a2('0xce')],'VoiceQueueId':_0x38ce33['VoiceQueueId']||undefined,'CampaignId':_0x38ce33[_0x47a2('0xfa')]||undefined})['catch'](loggerCatch(_0x47a2('0xfb')));break;case 0x14:if(_0x38ce33[_0x47a2('0xf1')]>=_0x39a3e2[_0x47a2('0x1a6')]-0x1){return!![];}this[_0x47a2('0xbb')]({'active':![],'countagentrejectretry':_0x38ce33[_0x47a2('0xf1')]+=0x1,'scheduledat':moment()[_0x47a2('0xf7')](_0x39a3e2[_0x47a2('0x1a7')],_0x47a2('0x102'))['format'](_0x47a2('0xf9')),'ContactId':_0x38ce33['ContactId'],'ListId':_0x38ce33[_0x47a2('0xce')],'VoiceQueueId':_0x38ce33[_0x47a2('0xd0')]||undefined,'CampaignId':_0x38ce33[_0x47a2('0xfa')]||undefined})[_0x47a2('0xad')](loggerCatch(_0x47a2('0x1a8')));break;default:return!![];}};Dialer['prototype'][_0x47a2('0x199')]=function(_0x380af2,_0x3b58ff,_0x5b046d){var _0x1d06d0=this;var _0x58b6c3=new History(_0x380af2);return new BPromise(function(_0x53d7fd,_0x29e36b){if(_['isUndefined'](_0x3b58ff)&&typeof _0x3b58ff!==_0x47a2('0x1a9')){return _0x29e36b(msgResponse('[callProgressDetecting]',_0x47a2('0x146'),_0x47a2('0x1aa')));}if(_[_0x47a2('0x3b')](_0x5b046d)&&typeof _0x5b046d!==_0x47a2('0x1a9')){return _0x29e36b(msgResponse(_0x47a2('0x1ab'),'Failure',_0x47a2('0x1ac')));}switch(_0x5b046d['reason']){case'0':_0x3b58ff[_0x47a2('0x61')]+=0x1;_0x58b6c3['state']=0x0;_0x58b6c3[_0x47a2('0xa5')]='NoSuchNumber';_0x58b6c3['countnosuchnumberretry']+=0x1;_0x58b6c3[_0x47a2('0xfe')]+=0x1;ami[_0x47a2('0xe3')](_0x47a2('0x1ad'),ut['buildObj'](_0x380af2,_0x47a2('0x1ae')));_0x1d06d0[_0x47a2('0xc5')](_0x58b6c3)[_0x47a2('0xad')](loggerCatch(_0x47a2('0xed')));if(_0x1d06d0[_0x47a2('0x1af')](0x0,_0x380af2,_0x3b58ff)){if(_0x58b6c3[_0x47a2('0x100')]>=_0x3b58ff[_0x47a2('0x1a3')]){_0x1d06d0[_0x47a2('0xf5')](_0x58b6c3,_0x53d7fd,_0x29e36b,_0x47a2('0x1b0'));}else{_0x1d06d0[_0x47a2('0xf2')](_0x58b6c3,_0x53d7fd,_0x29e36b,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3b58ff[_0x47a2('0x60')]+=0x1;_0x58b6c3['state']=0x3;_0x58b6c3[_0x47a2('0xa5')]=_0x47a2('0x1b1');_0x58b6c3[_0x47a2('0xef')]+=0x1;_0x58b6c3[_0x47a2('0xfe')]+=0x1;ami[_0x47a2('0xe3')]('custom:agentnoanswer',ut[_0x47a2('0xe5')](_0x380af2,'noanswer'));_0x1d06d0[_0x47a2('0xc5')](_0x58b6c3)[_0x47a2('0xad')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1d06d0[_0x47a2('0x1af')](0x3,_0x380af2,_0x3b58ff)){if(_0x58b6c3['countnoanswerretry']>=_0x3b58ff[_0x47a2('0x19b')]){_0x1d06d0['createStateFinal'](_0x58b6c3,_0x53d7fd,_0x29e36b,_0x47a2('0x1b2'));}else{_0x1d06d0['stateGlobal'](_0x58b6c3,_0x53d7fd,_0x29e36b,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x3b58ff[_0x47a2('0x1b3')]+=0x1;_0x58b6c3[_0x47a2('0xa4')]=0x5;_0x58b6c3['statedesc']=_0x47a2('0x1b4');_0x58b6c3[_0x47a2('0xff')]+=0x1;_0x58b6c3[_0x47a2('0xfe')]+=0x1;ami[_0x47a2('0xe3')]('custom:agentbusy',ut[_0x47a2('0xe5')](_0x380af2,'busy'));_0x1d06d0[_0x47a2('0xc5')](_0x58b6c3)[_0x47a2('0xad')](loggerCatch(_0x47a2('0x1b5')));if(_0x1d06d0[_0x47a2('0x1af')](0x5,_0x380af2,_0x3b58ff)){if(_0x58b6c3['countbusyretry']>=_0x3b58ff[_0x47a2('0x19e')]){_0x1d06d0['createStateFinal'](_0x58b6c3,_0x53d7fd,_0x29e36b,_0x47a2('0x1b6'));}else{_0x1d06d0[_0x47a2('0xf2')](_0x58b6c3,_0x53d7fd,_0x29e36b,_0x47a2('0x1b6'));}}break;case'8':_0x3b58ff['outboundCongestionCallsDay']+=0x1;_0x58b6c3[_0x47a2('0xa4')]=0x8;_0x58b6c3[_0x47a2('0xa5')]=_0x47a2('0x1b7');_0x58b6c3[_0x47a2('0xee')]+=0x1;_0x58b6c3['countglobal']+=0x1;ami[_0x47a2('0xe3')](_0x47a2('0x1b8'),ut[_0x47a2('0xe5')](_0x380af2,_0x47a2('0x1b9')));_0x1d06d0[_0x47a2('0xc5')](_0x58b6c3)['catch'](loggerCatch(_0x47a2('0x1ba')));if(_0x1d06d0[_0x47a2('0x1af')](0x8,_0x380af2,_0x3b58ff)){if(_0x58b6c3[_0x47a2('0xee')]>=_0x3b58ff[_0x47a2('0x1a0')]){_0x1d06d0[_0x47a2('0xf5')](_0x58b6c3,_0x53d7fd,_0x29e36b,_0x47a2('0x1bb'));}else{_0x1d06d0[_0x47a2('0xf2')](_0x58b6c3,_0x53d7fd,_0x29e36b,_0x47a2('0x1bb'));}}break;case'11':_0x3b58ff[_0x47a2('0x1bc')]+=0x1;_0x58b6c3[_0x47a2('0xa4')]=0xb;_0x58b6c3[_0x47a2('0xa5')]=_0x47a2('0x11e');_0x58b6c3[_0x47a2('0xf0')]+=0x1;_0x58b6c3[_0x47a2('0xfe')]+=0x1;_0x1d06d0[_0x47a2('0xc5')](_0x58b6c3)[_0x47a2('0xad')](loggerCatch(_0x47a2('0x1bd')));if(_0x1d06d0[_0x47a2('0x1af')](0xb,_0x380af2,_0x3b58ff)){if(_0x58b6c3['countabandonedretry']>=_0x3b58ff[_0x47a2('0x120')]){_0x1d06d0[_0x47a2('0xf5')](_0x58b6c3,_0x53d7fd,_0x29e36b,'reason\x2011\x20abandoned');}else{_0x1d06d0['stateGlobal'](_0x58b6c3,_0x53d7fd,_0x29e36b,_0x47a2('0x1be'));}}break;case'20':_0x3b58ff[_0x47a2('0x64')]+=0x1;_0x58b6c3['state']=0x14;_0x58b6c3[_0x47a2('0xa5')]=_0x47a2('0x1bf');_0x58b6c3[_0x47a2('0xf1')]+=0x1;_0x58b6c3[_0x47a2('0xfe')]+=0x1;ami[_0x47a2('0xe3')](_0x47a2('0x1c0'),ut[_0x47a2('0xe5')](_0x380af2,_0x47a2('0x1c1')));_0x1d06d0[_0x47a2('0xc5')](_0x58b6c3)[_0x47a2('0xad')](loggerCatch(_0x47a2('0x1c2')));if(_0x1d06d0[_0x47a2('0x1af')](0x14,_0x380af2,_0x3b58ff)){if(_0x58b6c3[_0x47a2('0xf1')]>=_0x3b58ff[_0x47a2('0x1a6')]){_0x1d06d0[_0x47a2('0xf5')](_0x58b6c3,_0x53d7fd,_0x29e36b,_0x47a2('0x1c3'));}else{_0x1d06d0[_0x47a2('0xf2')](_0x58b6c3,_0x53d7fd,_0x29e36b,_0x47a2('0x1c3'));}}break;default:_0x3b58ff[_0x47a2('0x65')]+=0x1;_0x58b6c3['state']=0xc;_0x58b6c3[_0x47a2('0xa5')]=_0x5b046d[_0x47a2('0x10a')];_0x1d06d0[_0x47a2('0xc5')](_0x58b6c3)[_0x47a2('0xad')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x1d06d0[_0x47a2('0x1af')](_0x5b046d[_0x47a2('0x10a')],_0x380af2,_0x3b58ff)){if(_0x58b6c3[_0x47a2('0xff')]+_0x58b6c3[_0x47a2('0xee')]+_0x58b6c3['countnoanswerretry']+_0x58b6c3[_0x47a2('0x100')]+_0x58b6c3[_0x47a2('0x116')]+_0x58b6c3[_0x47a2('0xf0')]+_0x58b6c3[_0x47a2('0xec')]+_0x58b6c3[_0x47a2('0xf1')]>=_0x3b58ff[_0x47a2('0x101')]){_0x1d06d0[_0x47a2('0xf2')](_0x58b6c3,_0x53d7fd,_0x29e36b,_0x5b046d['reason']);}else{_0x1d06d0[_0x47a2('0xf5')](_0x58b6c3,_0x53d7fd,_0x29e36b,_0x5b046d['reason']);}}}});};Dialer[_0x47a2('0x1a')][_0x47a2('0xf2')]=function(_0x1908c8,_0x5c6dff,_0x55229f,_0x452422){var _0x36261b=new Final(_0x1908c8);_0x36261b[_0x47a2('0xa4')]=0xf;_0x36261b[_0x47a2('0xa5')]=_0x47a2('0x1c4');this[_0x47a2('0xf5')](_0x36261b,_0x5c6dff,_0x55229f,_0x452422);};Dialer[_0x47a2('0x1a')][_0x47a2('0xf5')]=function(_0x810173,_0x34f128,_0x43e324,_0x2d8c69){this['moveContactManagedDialer'](_0x810173)[_0x47a2('0xb4')](function(){return _0x34f128(msgResponse(_0x47a2('0x1ab'),_0x47a2('0xd2'),_0x2d8c69));})[_0x47a2('0xad')](function(){return _0x43e324(msgResponse(_0x47a2('0x1c5'),'Failure',_0x47a2('0x1c6')));});};Dialer[_0x47a2('0x1a')][_0x47a2('0xb')]=function(_0x2b1751){var _0x3e99eb=_0x2b1751[_0x47a2('0x1c7')]/0x64;var _0x3e8053=_0x2b1751[_0x47a2('0x5f')]/(_0x2b1751[_0x47a2('0x5f')]+_0x2b1751[_0x47a2('0x5c')]);var _0x4a1590=Math[_0x47a2('0x1c8')](_0x2b1751[_0x47a2('0x6e')]*(_0x2b1751['predictiveIntervalMaxThreshold']/0x64));var _0x547aa5=Math[_0x47a2('0x1c8')](_0x2b1751[_0x47a2('0x6e')]*(_0x2b1751[_0x47a2('0x1c9')]/0x64));var _0x3c3bde=_0x2b1751[_0x47a2('0x4c')]+_0x2b1751[_0x47a2('0x51')];var _0x27f96a=Math[_0x47a2('0x1ca')](_0x2b1751[_0x47a2('0x88')]*_0x2b1751[_0x47a2('0x71')]*_0x2b1751[_0x47a2('0x6c')]*_0x2b1751[_0x47a2('0x6d')]);if(_[_0x47a2('0x3b')](_0x2b1751[_0x47a2('0x2a')])){if(!_[_0x47a2('0x3b')](_0x2b1751[_0x47a2('0x29')])){_0x2b1751[_0x47a2('0x29')]=undefined;loggerPredictive[_0x47a2('0x93')](_0x47a2('0x1cb'),_0x47a2('0x1cc'));}if(!_[_0x47a2('0x3b')](_0x2b1751['handlePredictive'])){loggerPredictive['error'](_0x47a2('0x1cb'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2b1751[_0x47a2('0x8f')]);_0x2b1751[_0x47a2('0x8f')]=undefined;}_0x2b1751[_0x47a2('0x2a')]=moment()[_0x47a2('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x47a2('0x7c')](_0x2b1751[_0x47a2('0x40')],_0x47a2('0x1cd'),_0x2b1751['startProgressive']);this['handlePower'](_0x2b1751,0x1);}else if(ifInterval(_0x2b1751['dialPredictiveInterval'],_0x2b1751[_0x47a2('0x2a')])){this['handlePower'](_0x2b1751,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x2b1751[_0x47a2('0x2a')],_0x2b1751[_0x47a2('0x40')]);_0x2b1751[_0x47a2('0x88')]=0x0;_0x2b1751[_0x47a2('0x6b')]=0x0;}else if(_0x3e99eb<_0x3e8053&&_0x2b1751[_0x47a2('0x1ce')]===_0x47a2('0x1cf')){freeVariablesPredictive(_0x2b1751);loggerPredictive[_0x47a2('0x7c')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x47a2('0x1d0'),_0x3e8053,_0x47a2('0x2a'),_0x2b1751[_0x47a2('0x40')]);}else if(_0x27f96a<_0x2b1751[_0x47a2('0x6b')]&&_0x2b1751[_0x47a2('0x1ce')]===_0x47a2('0x1cf')){freeVariablesPredictive(_0x2b1751);loggerPredictive[_0x47a2('0x7c')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x47a2('0x1d1'),_0x27f96a,_0x47a2('0x1d2'),_0x2b1751['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x2b1751[_0x47a2('0x40')]);}else if(!ifInterval(_0x2b1751['dialPredictiveInterval'],_0x2b1751[_0x47a2('0x2a')])&&_[_0x47a2('0x3b')](_0x2b1751[_0x47a2('0x29')])&&!_[_0x47a2('0x3b')](_0x2b1751[_0x47a2('0x2a')])){_0x2b1751['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x47a2('0x7c')](_0x2b1751['name'],'started\x20in\x20predictive\x20at',_0x2b1751['startPredictive']);this['averageHandleTime'](_0x2b1751[_0x47a2('0x1d3')])[_0x47a2('0xb4')](this[_0x47a2('0x1d4')](_0x2b1751))[_0x47a2('0xb4')](mergeDataErlangB(_0x2b1751))[_0x47a2('0xb4')](this[_0x47a2('0x1d5')](_0x2b1751))[_0x47a2('0xad')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x2b1751));}else if(!ifInterval(_0x2b1751[_0x47a2('0x1d3')],_0x2b1751[_0x47a2('0x29')])){_0x2b1751[_0x47a2('0x6b')]=0x0;_0x2b1751[_0x47a2('0x29')]=moment()['format'](_0x47a2('0xf9'));loggerPredictive[_0x47a2('0x7c')](_0x2b1751[_0x47a2('0x40')],_0x47a2('0x1d6'),_0x2b1751[_0x47a2('0x29')]);clearInterval(_0x2b1751['handlePredictive']);_0x2b1751[_0x47a2('0x8f')]=undefined;this['averageHandleTime'](_0x2b1751[_0x47a2('0x1d3')])[_0x47a2('0xb4')](this[_0x47a2('0x1d4')](_0x2b1751))[_0x47a2('0xb4')](mergeDataErlangB(_0x2b1751))[_0x47a2('0xb4')](this[_0x47a2('0x1d5')](_0x2b1751))['catch'](loggerCatchPredictive(_0x47a2('0x1d7'),_0x2b1751));}else if(_0x2b1751[_0x47a2('0x6e')]&&_0x3c3bde<_0x2b1751[_0x47a2('0x6e')]-_0x547aa5){freeVariablesPredictive(_0x2b1751);loggerPredictive['info'](_0x2b1751['name'],_0x47a2('0x1d8'),_0x3c3bde,_0x47a2('0x1d9'),_0x2b1751[_0x47a2('0x6e')],'-',_0x547aa5,'=',_0x2b1751['predictiveIntervalAvailable']-_0x547aa5,')');}else if(_0x2b1751['predictiveIntervalAvailable']&&_0x3c3bde>_0x2b1751['predictiveIntervalAvailable']+_0x4a1590){freeVariablesPredictive(_0x2b1751);loggerPredictive['info'](_0x2b1751[_0x47a2('0x40')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3c3bde,_0x47a2('0x1da'),_0x2b1751[_0x47a2('0x6e')],'+',_0x4a1590,'=',_0x2b1751[_0x47a2('0x6e')]+_0x4a1590,')');}};Dialer[_0x47a2('0x1a')][_0x47a2('0x1d4')]=function(_0x22a963){var _0x2e77a7=this;return function(_0x4d5326){return new BPromise(function(_0x29fbe2,_0x13473b){_[_0x47a2('0xcb')](_0x22a963,_0x4d5326[0x0]);if(checkGetDataPredictive(_0x4d5326[0x0])){var _0x36293f=_0x22a963[_0x47a2('0x6e')]=_0x22a963[_0x47a2('0x51')]+_0x22a963[_0x47a2('0x4c')];var _0x1aa9b6=_0x22a963[_0x47a2('0x1d3')]*0x3c;var _0x23ee43=_0x4d5326[0x0][_0x47a2('0x68')]+_0x4d5326[0x0]['predictiveIntervalAvgHoldtime'];var _0x4f1308=(_0x4d5326[0x0][_0x47a2('0x66')]+_0x4d5326[0x0][_0x47a2('0x69')]+_0x4d5326[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4d5326[0x0]['predictiveIntervalTotalCalls'];_0x22a963[_0x47a2('0x6c')]=_0x4f1308>0x0?_0x4f1308:0x1;switch(_0x22a963[_0x47a2('0x1ce')]){case _0x47a2('0x1cf'):var _0x1dc881=_0x22a963[_0x47a2('0x1c7')]/0x64;return _0x2e77a7[_0x47a2('0x1db')](_0x36293f,_0x1aa9b6,_0x23ee43,_0x4f1308,_0x1dc881)[_0x47a2('0xb4')](function(_0xc2ff5){return _0x29fbe2(_0xc2ff5);});case _0x47a2('0x1dc'):var _0x264085=_0x22a963[_0x47a2('0x1c7')]/0x64;return _0x2e77a7[_0x47a2('0x1dd')](_0x36293f,_0x1aa9b6,_0x23ee43,_0x4f1308,_0x264085)[_0x47a2('0xb4')](function(_0x271cf1){return _0x29fbe2(_0x271cf1);});default:return _0x13473b(msgResponse(_0x47a2('0x1de'),_0x47a2('0x146'),_0x47a2('0x1df')));}}else{return _0x13473b(msgResponse(_0x47a2('0x1de'),_0x47a2('0x146'),_0x47a2('0x1e0')));}});};};Dialer[_0x47a2('0x1a')][_0x47a2('0x1e1')]=function(_0x330b59){var _0x579791=this;return function(_0x135f23){return new BPromise(function(_0x10b0dd,_0x111d95){_[_0x47a2('0xcb')](_0x330b59,_0x135f23[0x0]);if(checkGetDataPredictive(_0x135f23[0x0])){loggerPredictive['info'](JSON[_0x47a2('0x47')](_0x135f23[0x0]));if(_0x330b59[_0x47a2('0x1ce')]==='dropRate'){return _0x579791['getVoiceQueueRtPauses'](_0x330b59['id'])[_0x47a2('0xb4')](function(_0xff0dfb){var _0x252704=_0x330b59[_0x47a2('0x4d')]-_0xff0dfb[0x0][_0x47a2('0x1e2')];var _0x43074e=_0x330b59[_0x47a2('0x1d3')]*0x3c;var _0x3a4ed0=_0x135f23[0x0]['predictiveIntervalAvgTalktime']+_0x135f23[0x0][_0x47a2('0x67')];var _0x445dc5=(_0x135f23[0x0][_0x47a2('0x66')]+_0x135f23[0x0][_0x47a2('0x69')]+_0x135f23[0x0][_0x47a2('0x81')])/_0x135f23[0x0][_0x47a2('0x6f')];var _0xc3761e=_0x330b59[_0x47a2('0x1c7')]/0x64;_0x330b59['predictiveIntervalPauses']=_0xff0dfb[0x0]['outboundQueuePauses']||0x0;_0x330b59[_0x47a2('0x6c')]=_0x445dc5>0x0?_0x445dc5:0x1;return _0x579791['abandonmentRate'](_0x252704,_0x43074e,_0x3a4ed0,_0x445dc5,_0xc3761e);})['then'](function(_0x2e5692){return _0x10b0dd(_0x2e5692);})[_0x47a2('0xad')](function(_0xeb8114){return _0x111d95(msgResponse('[CatchErlangB]','Failure',JSON[_0x47a2('0x47')](_0xeb8114)));});}if(_0x330b59[_0x47a2('0x1ce')]==='agentBusyFactor'){return _0x579791[_0x47a2('0xc2')](_0x330b59['id'])['then'](function(_0x2b1771){var _0xb33c63=_0x330b59[_0x47a2('0x4d')]-_0x2b1771[0x0][_0x47a2('0x1e2')];var _0x939f56=_0x330b59[_0x47a2('0x1d3')]*0x3c;var _0x5dce88=_0x135f23[0x0][_0x47a2('0x68')]+_0x135f23[0x0]['predictiveIntervalAvgHoldtime'];var _0x524052=(_0x135f23[0x0][_0x47a2('0x66')]+_0x135f23[0x0][_0x47a2('0x69')]+_0x135f23[0x0][_0x47a2('0x81')])/_0x135f23[0x0][_0x47a2('0x6f')];var _0xc7171f=_0x330b59[_0x47a2('0x1c7')]/0x64;_0x330b59[_0x47a2('0x1e3')]=_0x2b1771[0x0][_0x47a2('0x1e2')]||0x0;_0x330b59[_0x47a2('0x6c')]=_0x524052>0x0?_0x524052:0x1;return _0x579791[_0x47a2('0x1dd')](_0xb33c63,_0x939f56,_0x5dce88,_0x524052,_0xc7171f);})[_0x47a2('0xb4')](function(_0x416574){return _0x10b0dd(_0x416574);})['catch'](function(_0x36dbbb){return _0x111d95(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x36dbbb)));});}}else{return _0x111d95(msgResponse(_0x47a2('0x1de'),_0x47a2('0x146'),_0x47a2('0x1e0')));}});};};Dialer[_0x47a2('0x1a')][_0x47a2('0x1d5')]=function(_0x26bb5a){var _0x2971b2=this;return function(){var _0x1c1bae=0x0;var _0x263d8d=Math[_0x47a2('0x1ca')](_0x26bb5a[_0x47a2('0x8a')]*0x3e8);if(_0x263d8d>0x0){_0x263d8d=_0x263d8d<0x64?0x64:_0x263d8d;loggerPredictive[_0x47a2('0x7c')](_0x26bb5a[_0x47a2('0x40')],_0x47a2('0x1e4'),_0x263d8d,'milliseconds');_0x26bb5a['handlePredictive']=setInterval(function(){_0x2971b2[_0x47a2('0x8f')](_0x26bb5a);loggerPredictiveCalls[_0x47a2('0x7c')](_0x47a2('0x1e5'),_0x1c1bae+=0x1);},_0x263d8d);}else{loggerPredictive[_0x47a2('0x7c')](_0x26bb5a[_0x47a2('0x40')],_0x47a2('0x1e6'));}};};Dialer[_0x47a2('0x1a')]['checkContactBlack']=function(_0x30d4bf,_0xc20a2){var _0x68e341=this;return function(_0x21cb42){if(_[_0x47a2('0x44')](_0x21cb42)){if(_[_0x47a2('0xaa')](_0xc20a2['UserId'])||!_0xc20a2[_0x47a2('0x1e7')]){if(_0x30d4bf['dialMethod']===_0x47a2('0xa')){_0x30d4bf['queueStatusComplete']=_[_0x47a2('0x3b')](_0x30d4bf[_0x47a2('0x12b')])?!![]:_0x30d4bf['queueStatusComplete'];var _0x3120da=uuid['v4']();_0x68e341[_0x47a2('0x25')][_0x3120da]=new Action(_0x30d4bf,_0xc20a2,_0x3120da);loggerBooked[_0x47a2('0x7c')](_0x47a2('0x1e8'),_0x3120da,'queueStatusComplete:\x20',JSON[_0x47a2('0x47')](_0x30d4bf[_0x47a2('0x12b')]),_0x47a2('0x1e9'),_0x30d4bf[_0x47a2('0x40')]);if(_0x30d4bf[_0x47a2('0x12b')]){_0x30d4bf[_0x47a2('0x12b')]=![];_0x68e341['queueBooked'][_0x68e341[_0x47a2('0x25')][_0x3120da][_0x47a2('0xb1')]]=[];ami[_0x47a2('0xab')]({'actionid':_0x3120da,'action':_0x47a2('0x1ea'),'queue':_0x30d4bf[_0x47a2('0x40')]})['catch'](function(){_0x68e341[_0x47a2('0xaf')](_0x30d4bf);_0x68e341[_0x47a2('0xbb')]({'active':![],'ContactId':_0x68e341[_0x47a2('0x25')][_0x3120da]['ContactId'],'ListId':_0x68e341['actions'][_0x3120da][_0x47a2('0xce')],'VoiceQueueId':_0x68e341['actions'][_0x3120da][_0x47a2('0xd0')]||undefined,'CampaignId':_0x68e341[_0x47a2('0x25')][_0x3120da]['CampaignId']||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x68e341[_0x47a2('0x25')][_0x3120da];});}else{loggerBooked[_0x47a2('0x7c')](_0x47a2('0x1eb'),JSON[_0x47a2('0x47')](_0x30d4bf[_0x47a2('0x12b')]),_0x47a2('0x1e9'),_0x30d4bf[_0x47a2('0x40')]);_0x68e341[_0x47a2('0xaf')](_0x30d4bf);_0x68e341[_0x47a2('0xbb')]({'active':![],'ContactId':_0x68e341[_0x47a2('0x25')][_0x3120da][_0x47a2('0xcd')],'ListId':_0x68e341[_0x47a2('0x25')][_0x3120da][_0x47a2('0xce')],'VoiceQueueId':_0x68e341[_0x47a2('0x25')][_0x3120da][_0x47a2('0xd0')]||undefined,'CampaignId':_0x68e341[_0x47a2('0x25')][_0x3120da][_0x47a2('0xfa')]||undefined})[_0x47a2('0xad')](loggerCatch(_0x47a2('0x1ec')));delete _0x68e341[_0x47a2('0x25')][_0x3120da];}}else{return _0x68e341['actionOriginate'](_0x30d4bf,_0xc20a2);}}else{if(getDiff(_0xc20a2[_0x47a2('0x1ed')])<_0x30d4bf[_0x47a2('0x1ee')]*0x3c){if(_0xc20a2[_0x47a2('0x1ef')]&&!_0xc20a2[_0x47a2('0x1ef')][_0x47a2('0x1f0')]){_0x68e341[_0x47a2('0x1e')][_0x47a2('0x12e')](_0xc20a2['id'])['finally'](function(){_0x68e341[_0x47a2('0xaf')](_0x30d4bf);});}else{_0x68e341['unlockContact']({'active':![]},_0xc20a2['id'],0x1)[_0x47a2('0x12f')](function(){_0x68e341[_0x47a2('0xaf')](_0x30d4bf);});}}else{_0x30d4bf['outboundReCallsDay']+=0x1;_0x68e341[_0x47a2('0xaf')](_0x30d4bf);if(_0x30d4bf[_0x47a2('0x1f1')]){_0x68e341[_0x47a2('0xbb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xc20a2[_0x47a2('0xcd')],'ListId':_0xc20a2[_0x47a2('0xce')],'VoiceQueueId':_0xc20a2['VoiceQueueId']||undefined,'CampaignId':_0xc20a2[_0x47a2('0xfa')]||undefined})[_0x47a2('0xad')](loggerCatch(_0x47a2('0x1f2')));_0x68e341['createHistory'](createObjHistory(_0x30d4bf,_0xc20a2,'RECALLINQUEUE',0x17,_0x47a2('0x1f3')))[_0x47a2('0xad')](loggerCatch(_0x47a2('0x1f4')));}else{_0x68e341[_0x47a2('0xca')](createObjHistory(_0x30d4bf,_0xc20a2,_0x47a2('0x1f5'),0x16,_0x47a2('0x1f6')),_0x47a2('0x1f7'),_0x47a2('0x1f8'));}}}}else{_0x30d4bf[_0x47a2('0x1f9')]+=0x1;_0x68e341['saveInDb'](createObjHistory(_0x30d4bf,_0xc20a2,_0x47a2('0x1fa'),0xd,_0x47a2('0x1fb')),'[Originate][historyBlacklist]',_0x47a2('0x1fc'));throw _0x47a2('0x1fd');}};};Dialer[_0x47a2('0x1a')][_0x47a2('0x15e')]=function(_0xf57f65){var _0x2b17df=this;var _0x118e23=_0xf57f65[_0x47a2('0x1fe')]-_0xf57f65[_0x47a2('0x70')]-_0xf57f65[_0x47a2('0xbf')];emitCampaignSummary(_0xf57f65);if(_0x118e23>0x0){if(_0x118e23>this[_0x47a2('0x23')]){_0x118e23=this['maxNumberOriginate'];}_0xf57f65[_0x47a2('0xbf')]+=_0x118e23;this['getContactDialerIvr'](_0xf57f65['id'],_0x118e23,_0xf57f65['dialOrderByScheduledAt'],_0xf57f65)[_0x47a2('0xb4')](function(_0x19e072){_0xf57f65[_0x47a2('0xbf')]-=_0x118e23;_0xf57f65[_0x47a2('0xbf')]=_0xf57f65['temp']>0x0?_0xf57f65[_0x47a2('0xbf')]:0x0;if(!checkContactEmpty(_0x19e072)){_0xf57f65[_0x47a2('0x3c')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x47a2('0x7c')](_0x47a2('0x1ff')+_0xf57f65[_0x47a2('0x40')]);}else{_0xf57f65[_0x47a2('0x70')]+=_0x19e072[_0x47a2('0x96')];_0xf57f65['message']=_0x47a2('0x200');for(var _0xe3d4c8=0x0;_0xe3d4c8<_0x19e072['length'];_0xe3d4c8+=0x1){_0xf57f65[_0x47a2('0x201')]+=0x1;if(_['isNil'](_0x19e072[_0xe3d4c8])||_[_0x47a2('0xaa')](_0x19e072[_0xe3d4c8][_0x47a2('0x16c')])||_[_0x47a2('0xaa')](_0x19e072[_0xe3d4c8][_0x47a2('0x16c')][_0x47a2('0x16d')])){_0x2b17df[_0x47a2('0xc9')](_0x47a2('0x202'),_0xf57f65,_0x19e072[_0xe3d4c8]);}else{_0x2b17df['checkIsBlackListIvr'](_[_0x47a2('0xcc')](_0x19e072[_0xe3d4c8],['CampaignId',_0x47a2('0x203')]))['then'](_0x2b17df[_0x47a2('0x204')](_0xf57f65,_0x19e072[_0xe3d4c8]))[_0x47a2('0xad')](_0x2b17df[_0x47a2('0x205')](_0x47a2('0x206'),_0xf57f65));}}}})['catch'](loggerGetContactDialer(_0x47a2('0x207'),_0xf57f65,_0x118e23));}};Dialer[_0x47a2('0x1a')][_0x47a2('0x15b')]=function(_0x54fe6b,_0x55b41d){var _0x23e9de=this;var _0x1fc9af=[];var _0x805eb3=_0x55b41d>=0x1?_0x55b41d:0x1;if(_0x54fe6b['dialMethod']===_0x47a2('0xa')){_0x805eb3=0x1;}var _0x55e445=Math[_0x47a2('0x1ca')](_0x54fe6b[_0x47a2('0x4c')]*_0x805eb3)-_0x54fe6b[_0x47a2('0x70')]-_0x54fe6b[_0x47a2('0xbf')];emitVoiceQueueSummary(_0x54fe6b);if(_0x54fe6b[_0x47a2('0x208')]>0x0){var _0x1654c1=_0x54fe6b[_0x47a2('0x208')]-_0x54fe6b[_0x47a2('0x70')]-_0x54fe6b[_0x47a2('0x51')]-_0x54fe6b[_0x47a2('0xbf')]-_0x54fe6b[_0x47a2('0x4e')];if(_0x55e445>_0x1654c1){_0x55e445=_0x1654c1;}}if(_0x55e445>0x0){if(_0x54fe6b[_0x47a2('0x57')]==='booked'){_0x55e445=0x1;}if(_0x55e445>this['maxNumberOriginate']){_0x55e445=this[_0x47a2('0x23')];}_0x54fe6b['temp']+=_0x55e445;for(var _0xbb0bc7 in this[_0x47a2('0x21')]){if(typeof this[_0x47a2('0x21')][_0xbb0bc7]!==_0x47a2('0x97')){if(this['agents'][_0xbb0bc7][_0x47a2('0xa4')]===_0x47a2('0x209')&&this['agents'][_0xbb0bc7]['status']===_0x47a2('0xd5')){_0x1fc9af[_0x47a2('0x129')](this['agents'][_0xbb0bc7]['id']);}}}this[_0x47a2('0xbe')](_0x54fe6b['id'],_0x1fc9af,_0x55e445,_0x54fe6b[_0x47a2('0x20a')],_0x54fe6b)[_0x47a2('0xb4')](function(_0x417055){_0x54fe6b['temp']-=_0x55e445;_0x54fe6b[_0x47a2('0xbf')]=_0x54fe6b[_0x47a2('0xbf')]>0x0?_0x54fe6b['temp']:0x0;if(!checkContactEmpty(_0x417055)){_0x23e9de[_0x47a2('0xb3')](_0x54fe6b)['then'](sendMessageReschedule(_0x54fe6b))[_0x47a2('0xad')](loggerCatch(_0x47a2('0x20b')));}else{_0x54fe6b[_0x47a2('0x70')]+=_0x417055[_0x47a2('0x96')];_0x54fe6b[_0x47a2('0x3c')]=_0x54fe6b[_0x47a2('0x57')]===_0x47a2('0xa')?'ACTIVE':_0x47a2('0x200');for(var _0x459400=0x0;_0x459400<_0x417055[_0x47a2('0x96')];_0x459400+=0x1){if(_[_0x47a2('0xaa')](_0x417055[_0x459400])||_[_0x47a2('0xaa')](_0x417055[_0x459400][_0x47a2('0x16c')])||_['isNil'](_0x417055[_0x459400][_0x47a2('0x16c')][_0x47a2('0x16d')])){_0x23e9de[_0x47a2('0xc9')](_0x47a2('0x202'),_0x54fe6b,_0x417055[_0x459400]);}else{_0x23e9de[_0x47a2('0x20c')](_[_0x47a2('0xcc')](_0x417055[_0x459400],[_0x47a2('0xd0'),_0x47a2('0x203')]))[_0x47a2('0xb4')](_0x23e9de[_0x47a2('0x204')](_0x54fe6b,_0x417055[_0x459400]))[_0x47a2('0xad')](_0x23e9de['loggerHandler'](_0x47a2('0x202'),_0x54fe6b));}}}})[_0x47a2('0xad')](loggerGetContactDialer(_0x47a2('0x20d'),_0x54fe6b,_0x55e445));}};Dialer['prototype'][_0x47a2('0x8f')]=function(_0x4e9df3){if(_0x4e9df3[_0x47a2('0x208')]>0x0){var _0x43e836=_0x4e9df3[_0x47a2('0x208')]-_0x4e9df3[_0x47a2('0x70')]-_0x4e9df3[_0x47a2('0x51')];if(_0x43e836>0x0){this[_0x47a2('0x20e')](_0x4e9df3);}else{loggerPredictiveCalls[_0x47a2('0x7c')](_0x47a2('0x20f'));}}else{this[_0x47a2('0x20e')](_0x4e9df3);}};Dialer['prototype'][_0x47a2('0x20e')]=function(_0x314fde){var _0x155fe1=this;var _0x1edd7a=[];_0x314fde['originated']+=0x1;for(var _0x939333 in this[_0x47a2('0x21')]){if(typeof this[_0x47a2('0x21')][_0x939333]!=='undefined'){if(this[_0x47a2('0x21')][_0x939333][_0x47a2('0xa4')]===_0x47a2('0x209')&&this[_0x47a2('0x21')][_0x939333][_0x47a2('0xd4')]==='reachable'){_0x1edd7a[_0x47a2('0x129')](this[_0x47a2('0x21')][_0x939333]['id']);}}}this['getContactDialer'](_0x314fde['id'],_0x1edd7a,0x1,_0x314fde[_0x47a2('0x20a')],_0x314fde)[_0x47a2('0xb4')](function(_0x5f94fd){if(!checkContactEmpty(_0x5f94fd)){checkContactLowerLimitOriginate(_0x314fde,0x1,0x0);_0x155fe1[_0x47a2('0xb3')](_0x314fde)['then'](sendMessageReschedule(_0x314fde))[_0x47a2('0xad')](loggerCatch(_0x47a2('0x20b')));}else{_0x314fde[_0x47a2('0x3c')]=_0x47a2('0x200');if(_[_0x47a2('0xaa')](_0x5f94fd[0x0])||_['isNil'](_0x5f94fd[0x0][_0x47a2('0x16c')])||_['isNil'](_0x5f94fd[0x0][_0x47a2('0x16c')][_0x47a2('0x16d')])){_0x155fe1[_0x47a2('0xc9')](_0x47a2('0x202'),_0x314fde,_0x5f94fd[0x0]);}else{_0x155fe1['checkIsBlackList'](_[_0x47a2('0xcc')](_0x5f94fd[0x0],['VoiceQueueId',_0x47a2('0x203')]))['then'](_0x155fe1['checkContactBlack'](_0x314fde,_0x5f94fd[0x0]))['catch'](_0x155fe1[_0x47a2('0x205')](_0x47a2('0x210'),_0x314fde));}}})[_0x47a2('0xad')](loggerGetContactDialer('[getContactDialerPredictive]',_0x314fde,0x1));emitVoiceQueueSummary(_0x314fde);};Dialer['prototype'][_0x47a2('0x1db')]=function(_0x17ea95,_0x32aa64,_0x19275a,_0x42f847,_0x15cb1b,_0x1ccf1b){loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x211'));loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x212'),_0x17ea95);loggerPredictive[_0x47a2('0x7c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x32aa64);loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x213'),_0x19275a);loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x214'),_0x42f847);loggerPredictive['info'](_0x47a2('0x215'),_0x15cb1b);loggerPredictive['info'](_0x47a2('0x83'));return new BPromise(function(_0x5f1524,_0x14a50d){if(_0x17ea95<=0x0||isNaN(_0x17ea95)){return _0x14a50d(msgResponse('[abandonmentRate]',_0x47a2('0x195'),_0x47a2('0x216')+_0x17ea95));}if(_0x19275a<=0x0||isNaN(_0x19275a)){return _0x14a50d(msgResponse('[abandonmentRate]',_0x47a2('0x195'),_0x47a2('0x217')+_0x19275a));}if(_0x42f847<=0x0||isNaN(_0x42f847)){return _0x14a50d(msgResponse(_0x47a2('0x218'),_0x47a2('0x195'),'p\x20=\x20'+_0x42f847));}if(_0x32aa64<=0x0||isNaN(_0x32aa64)){return _0x14a50d(msgResponse(_0x47a2('0x218'),_0x47a2('0x195'),_0x47a2('0x219')+_0x32aa64));}if(_0x15cb1b<=0x0||isNaN(_0x15cb1b)){return _0x14a50d(msgResponse(_0x47a2('0x218'),_0x47a2('0x195'),'Amax\x20=\x20'+_0x15cb1b));}_0x1ccf1b=_0x1ccf1b||0x0;var _0x890699=0x1/_0x19275a;var _0x1b6648=0x0;var _0x18d250=0x0;var _0x3ec9bb=0x0;var _0xab6fe6=0x0;for(var _0x2465dc=0x0;_0x3ec9bb<_0x15cb1b;_0x2465dc+=0x1){_0x18d250=_0x2465dc/_0x32aa64;_0x1b6648=(_0x42f847*_0x18d250+_0x1ccf1b)/_0x890699;_0x3ec9bb=erlangb(_0x1b6648,_0x17ea95);_0xab6fe6=_0x1b6648/_0x17ea95*(0x1-erlangb(_0x1b6648,_0x17ea95));}return _0x5f1524({'erlangCalls':_0x2465dc,'erlangCallToSecond':_0x32aa64/_0x2465dc,'erlangAbandonmentRate':_0x3ec9bb,'erlangBusyFactor':_0xab6fe6});});};Dialer[_0x47a2('0x1a')][_0x47a2('0x1dd')]=function(_0x32cc66,_0x321370,_0x51ff57,_0x12d387,_0xeabd5b,_0x277e7e){loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x21a'));loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x212'),_0x32cc66);loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x21b'),_0x321370);loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x213'),_0x51ff57);loggerPredictive[_0x47a2('0x7c')]('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',_0x12d387);loggerPredictive[_0x47a2('0x7c')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xeabd5b);loggerPredictive[_0x47a2('0x7c')](_0x47a2('0x83'));return new BPromise(function(_0x2dc63a,_0x315cae){if(_0x32cc66<=0x0||isNaN(_0x32cc66)){return _0x315cae(msgResponse(_0x47a2('0x21c'),_0x47a2('0x195'),'m\x20=\x20'+_0x32cc66));}if(_0x51ff57<=0x0||isNaN(_0x51ff57)){return _0x315cae(msgResponse(_0x47a2('0x21c'),_0x47a2('0x195'),_0x47a2('0x217')+_0x51ff57));}if(_0x12d387<=0x0||isNaN(_0x12d387)){return _0x315cae(msgResponse(_0x47a2('0x21c'),_0x47a2('0x195'),_0x47a2('0x21d')+_0x12d387));}if(_0x321370<=0x0||isNaN(_0x321370)){return _0x315cae(msgResponse(_0x47a2('0x21c'),_0x47a2('0x195'),_0x47a2('0x219')+_0x321370));}if(_0xeabd5b<=0x0||isNaN(_0xeabd5b)){return _0x315cae(msgResponse(_0x47a2('0x21c'),_0x47a2('0x195'),'Umin\x20=\x20'+_0xeabd5b));}_0x277e7e=_0x277e7e||0x0;var _0x4ca5df=0x1/_0x51ff57;var _0x27fb54=0x0;var _0x2a7c92=0x0;var _0x3019f9=0x0;var _0x205cfe=0x0;for(var _0x53ed08=0x0;_0x205cfe<_0xeabd5b;_0x53ed08+=0x1){_0x2a7c92=_0x53ed08/_0x321370;_0x27fb54=(_0x12d387*_0x2a7c92+_0x277e7e)/_0x4ca5df;_0x3019f9=erlangb(_0x27fb54,_0x32cc66);_0x205cfe=_0x27fb54/_0x32cc66*(0x1-erlangb(_0x27fb54,_0x32cc66));}return _0x2dc63a({'erlangCalls':_0x53ed08,'erlangCallToSecond':_0x321370/_0x53ed08,'erlangAbandonmentRate':_0x3019f9,'erlangBusyFactor':_0x205cfe});});};module[_0x47a2('0x21e')]=Dialer; \ No newline at end of file +var _0xf238=['./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','roundrobin','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','AGENTS_NOT_LOGGED','name','message','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangBusyFactor','Trunk','callerid','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','isUndefined','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','startProgressive','clearing\x20variable\x20start\x20progressive','handlePredictive','preview','string','error','inspect','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','enqueue','isNil','Action','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[createHistory]\x20','undefined','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','pick','ContactId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','active','SIP/%s','reachable','unmonitored','saveInDb','createHistory','exten','xcally-motion-dialer','dialAMDActive','value','uniqueid','HangupInAMD','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','membername','countmachineretry','countglobal','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','VoiceQueueId','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','MACHINE','Machine','dialGlobalMaxRetry','stateGlobal','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','Unknow','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dialDropMaxRetry','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','strategy','paused','stateinterface','locked','actionid','rrmemory','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','TIMEZONE_UNKNOW','isArray','interval','timezones','indexOf','command','iftime\x20%s,%s','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','power','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','[syncQueueSummary]','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','createdAt','updatedAt','%s%s','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countnosuchnumberretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','evt\x20is\x20undefine','reason','custom:agentnosuchnumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','busy','reason\x205\x20busy','congestion','[syncAgentComplete][createHistory][8]','outboundAbandonedCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','RUNNING','[getContactDialer2]','tryOriginatePredictive','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','[busyFactor]','Umin\x20=\x20','exports','lodash','bluebird','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history'];(function(_0xf75840,_0x871b3){var _0x3f1bbf=function(_0x2424f6){while(--_0x2424f6){_0xf75840['push'](_0xf75840['shift']());}};_0x3f1bbf(++_0x871b3);}(_0xf238,0x1ef));var _0x8f23=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0xf238[_0x33bc64];return _0x3fdd34;};'use strict';var util=require('util');var _=require(_0x8f23('0x0'));var BPromise=require(_0x8f23('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0x8f23('0x2'));var Redis=require(_0x8f23('0x3'));var ut=require('../preview/util/util');var config=require(_0x8f23('0x4'));var logger=require(_0x8f23('0x5'))(_0x8f23('0x6'));var loggerBooked=require(_0x8f23('0x5'))(_0x8f23('0x7'));var loggerPredictive=require('../../../config/logger')(_0x8f23('0x8'));var loggerPredictiveCalls=require(_0x8f23('0x5'))(_0x8f23('0x9'));var loggerSyncQueueSummary=require(_0x8f23('0x5'))('syncQueueSummary');var ami=require(_0x8f23('0xa'));config[_0x8f23('0xb')]=_[_0x8f23('0xc')](config[_0x8f23('0xb')],{'host':_0x8f23('0xd'),'port':0x18eb});var io=require(_0x8f23('0xe'))(new Redis(config[_0x8f23('0xb')]));var cmHopper=require(_0x8f23('0xf'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x8f23('0x10'));var voiceQueueRt=require(_0x8f23('0x11'));var Action=require(_0x8f23('0x12'));var History=require(_0x8f23('0x13'));var Final=require(_0x8f23('0x14'));var AgentComplete=require(_0x8f23('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x8f23('0x16'));var ipAgi=process[_0x8f23('0x17')][_0x8f23('0x18')]||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x8f23('0x19')};var Sequence=function(){};Sequence[_0x8f23('0x1a')]['enqueue']=function(_0x13422a){this[_0x8f23('0x1b')]=this[_0x8f23('0x1b')]?this[_0x8f23('0x1b')][_0x8f23('0x1c')](_0x13422a):_0x13422a();};function Dialer(_0x2c3970,_0xa32267){this[_0x8f23('0x1d')]=new Sequence();this['preview']=_0xa32267;this['voiceQueues']=_0x2c3970[_0x8f23('0x1e')];this['campaigns']=_0x2c3970[_0x8f23('0x1f')];this[_0x8f23('0x20')]=_0x2c3970[_0x8f23('0x20')];this['trunks']=_0x2c3970[_0x8f23('0x21')];this[_0x8f23('0x22')]=config[_0x8f23('0x22')]||0x2;this[_0x8f23('0x23')]={};this[_0x8f23('0x24')]={};this[_0x8f23('0x25')]={};this[_0x8f23('0x26')]={};this[_0x8f23('0x27')]={};this[_0x8f23('0x28')]={};this['startProgressive']={};this[_0x8f23('0x29')]={};this['queueBooked']={};this[_0x8f23('0x2a')]={};ami['on'](_0x8f23('0x2b'),this[_0x8f23('0x2c')][_0x8f23('0x2d')](this));ami['on']('queuecallerabandon',this[_0x8f23('0x2e')][_0x8f23('0x2d')](this));ami['on'](_0x8f23('0x2f'),this[_0x8f23('0x30')][_0x8f23('0x2d')](this));ami['on'](_0x8f23('0x31'),this['syncAgentComplete']['bind'](this));ami['on'](_0x8f23('0x32'),this[_0x8f23('0x33')][_0x8f23('0x2d')](this));ami['on'](_0x8f23('0x34'),this[_0x8f23('0x35')][_0x8f23('0x2d')](this));ami['on']('newexten',this[_0x8f23('0x36')][_0x8f23('0x2d')](this));ami['on'](_0x8f23('0x37'),this[_0x8f23('0x38')][_0x8f23('0x2d')](this));ami['on'](_0x8f23('0x39'),this['syncQueueMember']['bind'](this));ami['on'](_0x8f23('0x3a'),this['syncQueueStatusComplete'][_0x8f23('0x2d')](this));this[_0x8f23('0x3b')]();this[_0x8f23('0x3c')]();}function isNotNull(_0x5255cb){return _0x5255cb!==null&&!_['isUndefined'](_0x5255cb);}function checkIsLoggedIn(_0x490ec9,_0x109297){return function(){if(_0x109297<=0x0){_0x490ec9['message']=_0x8f23('0x3d');throw _0x490ec9[_0x8f23('0x3e')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x346300){return _0x346300;}function checkIsActive(_0xe1171,_0x909a4e){return function(){if(!isActive(_0x909a4e)){_0xe1171[_0x8f23('0x3f')]=_0x8f23('0x40');throw _0xe1171[_0x8f23('0x3e')]+_0x8f23('0x41');}};}function checkInterval(_0x4dd51c){return function(){if(!isNotNull(_0x4dd51c[_0x8f23('0x42')])){_0x4dd51c['message']='INTERVAL_IS_NULL';throw _0x4dd51c[_0x8f23('0x3e')]+_0x8f23('0x43');}if(!isNotNull(_0x4dd51c[_0x8f23('0x42')]['Intervals'])){_0x4dd51c[_0x8f23('0x3f')]=_0x8f23('0x44');throw _0x4dd51c[_0x8f23('0x3e')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x8f23('0x45')](_0x4dd51c['Interval'][_0x8f23('0x46')]))){_0x4dd51c[_0x8f23('0x3f')]=_0x8f23('0x44');throw _0x4dd51c[_0x8f23('0x3e')]+_0x8f23('0x43');}};}function msgResponse(_0x2e511b,_0x58addd,_0x16197f){return{'action':_0x2e511b,'response':_0x58addd,'message':_0x16197f,'stack':_0x16197f};}function myreject(_0x5f268a){return function(_0x3891d9){return _0x5f268a(msgResponse(_0x8f23('0x47'),'Error',JSON[_0x8f23('0x48')](_0x3891d9)));};}function getSeconds(_0x24c113,_0xd334af){var _0x4fba1c=moment(_0x24c113)[_0x8f23('0x49')](0x0);var _0x33894e=moment(_0xd334af)[_0x8f23('0x49')](0x0);return _0x4fba1c[_0x8f23('0x4a')](_0x33894e,_0x8f23('0x4b'));}function emit(_0x2ef804,_0x1f2c50,_0x8964e6){io['to'](_0x2ef804)[_0x8f23('0x4c')](_0x1f2c50,_0x8964e6);}function emitVoiceQueueSummary(_0x31c67b){if(_0x31c67b[_0x8f23('0x4d')]===_0x8f23('0x4e')){var _0x5e8406={'id':_0x31c67b['id'],'name':_0x31c67b['name'],'strategy':_0x31c67b['strategy'],'answered':_0x31c67b['answered'],'available':_0x31c67b[_0x8f23('0x4f')],'loggedIn':_0x31c67b[_0x8f23('0x50')],'pTalking':_0x31c67b[_0x8f23('0x51')],'sumBillable':_0x31c67b[_0x8f23('0x52')],'sumDuration':_0x31c67b['sumDuration'],'sumHoldTime':_0x31c67b[_0x8f23('0x53')]||0x0,'talking':_0x31c67b[_0x8f23('0x54')],'total':_0x31c67b[_0x8f23('0x55')],'type':_0x31c67b[_0x8f23('0x4d')],'unmanaged':_0x31c67b[_0x8f23('0x56')],'abandoned':_0x31c67b['abandoned'],'waiting':_0x31c67b[_0x8f23('0x57')],'loggedInDb':_0x31c67b[_0x8f23('0x58')],'dialActive':_0x31c67b[_0x8f23('0x59')],'dialMethod':_0x31c67b[_0x8f23('0x5a')],'dialOriginateCallerIdName':_0x31c67b[_0x8f23('0x5b')],'dialOriginateCallerIdNumber':_0x31c67b['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x31c67b[_0x8f23('0x5c')],'dialPrefix':_0x31c67b[_0x8f23('0x5d')],'outboundAnswerAgiCallsDay':_0x31c67b[_0x8f23('0x5e')],'outboundAnswerCallsDay':_0x31c67b[_0x8f23('0x5f')],'outboundBlacklistCallsDay':_0x31c67b[_0x8f23('0x60')],'outboundBusyCallsDay':_0x31c67b[_0x8f23('0x61')],'outboundCongestionCallsDay':_0x31c67b[_0x8f23('0x62')],'outboundDropCallsDayACS':_0x31c67b[_0x8f23('0x63')],'outboundDropCallsDayCallersExit':_0x31c67b[_0x8f23('0x64')],'outboundDropCallsDayTimeout':_0x31c67b[_0x8f23('0x65')],'outboundNoAnswerCallsDay':_0x31c67b[_0x8f23('0x66')],'outboundNoSuchCallsDay':_0x31c67b[_0x8f23('0x67')],'outboundOriginateFailureCallsDay':_0x31c67b['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x31c67b[_0x8f23('0x68')],'outboundRejectCallsDay':_0x31c67b[_0x8f23('0x69')],'outboundUnknownCallsDay':_0x31c67b[_0x8f23('0x6a')],'predictiveIntervalAnsweredCalls':_0x31c67b[_0x8f23('0x6b')],'predictiveIntervalAvgHoldtime':_0x31c67b[_0x8f23('0x6c')],'predictiveIntervalAvgTalktime':_0x31c67b['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x31c67b[_0x8f23('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0x31c67b['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x31c67b[_0x8f23('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0x31c67b['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x31c67b['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x31c67b['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x31c67b[_0x8f23('0x6f')],'predictiveIntervalAvailable':_0x31c67b['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x31c67b[_0x8f23('0x70')],'message':_0x31c67b[_0x8f23('0x3f')],'originated':_0x31c67b[_0x8f23('0x71')],'erlangCalls':_0x31c67b['erlangCalls'],'erlangCallToSecond':_0x31c67b['erlangCallToSecond'],'erlangAbandonmentRate':_0x31c67b['erlangAbandonmentRate'],'erlangBusyFactor':_0x31c67b[_0x8f23('0x72')],'startPredictive':_0x31c67b['startPredictive'],'startProgressive':_0x31c67b['startProgressive']};if(_0x31c67b[_0x8f23('0x73')]){_0x5e8406[_0x8f23('0x73')]={'id':_0x31c67b[_0x8f23('0x73')]['id'],'name':_0x31c67b[_0x8f23('0x73')]['name'],'active':_0x31c67b[_0x8f23('0x73')]['active'],'callerid':_0x31c67b[_0x8f23('0x73')][_0x8f23('0x74')]};}if(_0x31c67b[_0x8f23('0x42')]){_0x5e8406[_0x8f23('0x42')]={'id':_0x31c67b[_0x8f23('0x42')]['id'],'name':_0x31c67b[_0x8f23('0x42')][_0x8f23('0x3e')]};}var _0x226a92=md5(JSON[_0x8f23('0x48')](_0x5e8406));if(_0x31c67b[_0x8f23('0x2')]!==_0x226a92){_0x31c67b['md5']=_0x226a92;emit(util[_0x8f23('0x75')]('voice:queue:%s',_0x5e8406[_0x8f23('0x3e')]),_0x8f23('0x76'),_0x5e8406);}}}function emitCampaignSummary(_0x1daba5){if(_0x1daba5['type']===_0x8f23('0x77')){emit(util[_0x8f23('0x75')](_0x8f23('0x78'),_0x1daba5['name']),_0x8f23('0x79'),_0x1daba5);}}function checkGetDataPredictive(_0x1bea6c){if(isNotNull(_0x1bea6c)&&!_[_0x8f23('0x45')](_0x1bea6c)){loggerPredictive[_0x8f23('0x7a')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x8f23('0x7a')](_0x8f23('0x7b'),_0x1bea6c['predictiveIntervalTotalCalls']);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1bea6c[_0x8f23('0x6b')]);loggerPredictive[_0x8f23('0x7a')](_0x8f23('0x7c'),_0x1bea6c[_0x8f23('0x7d')]);loggerPredictive[_0x8f23('0x7a')](_0x8f23('0x7e'),_0x1bea6c[_0x8f23('0x6d')]);loggerPredictive['info'](_0x8f23('0x7f'),_0x1bea6c[_0x8f23('0x6c')]);loggerPredictive[_0x8f23('0x7a')](_0x8f23('0x80'),_0x1bea6c[_0x8f23('0x81')]);loggerPredictive[_0x8f23('0x7a')]('---------------------------');if(_0x1bea6c[_0x8f23('0x70')]>0x0){if(!_[_0x8f23('0x82')](_0x1bea6c['predictiveIntervalAvgTalktime'])&&_0x1bea6c[_0x8f23('0x81')]>0x0){return!![];}loggerPredictive[_0x8f23('0x7a')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x1bea6c['predictiveIntervalAvgHoldtime'])&&_0x1bea6c[_0x8f23('0x6c')]>0x0){return!![];}loggerPredictive[_0x8f23('0x7a')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x8f23('0x7a')](_0x8f23('0x83'));}}else{loggerPredictive[_0x8f23('0x7a')](_0x8f23('0x84'));}return![];}function mergeDataErlangB(_0x29cafc){return function(_0x3dc2e9){loggerPredictive[_0x8f23('0x7a')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x8f23('0x85'),_0x3dc2e9[_0x8f23('0x86')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3dc2e9[_0x8f23('0x87')]);loggerPredictive[_0x8f23('0x7a')](_0x8f23('0x88'),_0x3dc2e9[_0x8f23('0x89')]);loggerPredictive[_0x8f23('0x7a')](_0x8f23('0x8a'),_0x3dc2e9[_0x8f23('0x72')]);loggerPredictive[_0x8f23('0x7a')](_0x8f23('0x88'),_0x3dc2e9[_0x8f23('0x89')]);loggerPredictive['info'](_0x8f23('0x8b'));_[_0x8f23('0x8c')](_0x29cafc,_0x3dc2e9);};}function getDiff(_0x5af987){var _0xb72a5f=moment()[_0x8f23('0x49')](0x0);var _0x2628ca=moment(_0x5af987)[_0x8f23('0x49')](0x0);return _0xb72a5f[_0x8f23('0x4a')](_0x2628ca,_0x8f23('0x4b'));}function ifInterval(_0x56e69b,_0x29766e){if(_['isUndefined'](_0x29766e)){return![];}return getDiff(_0x29766e)<_0x56e69b*0x3c;}function freeVariablesPredictive(_0x37641c){if(isNotNull(_0x37641c)){if(!_['isUndefined'](_0x37641c[_0x8f23('0x8d')])){_0x37641c[_0x8f23('0x8d')]=undefined;loggerPredictive['info'](_0x37641c['name'],_0x8f23('0x8e'));}if(!_['isUndefined'](_0x37641c[_0x8f23('0x28')])){_0x37641c[_0x8f23('0x28')]=undefined;loggerPredictive[_0x8f23('0x7a')](_0x37641c['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x8f23('0x82')](_0x37641c['handlePredictive'])){clearInterval(_0x37641c['handlePredictive']);_0x37641c[_0x8f23('0x8f')]=undefined;loggerPredictive[_0x8f23('0x7a')](_0x37641c[_0x8f23('0x3e')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x20a6f3,_0x280cc2){if(_0x280cc2===0x0){return 0x0;}var _0x42424e=0x1;for(var _0x57b9f8=0x1;_0x57b9f8<=_0x280cc2;_0x57b9f8+=0x1){_0x42424e=0x1+_0x42424e*_0x57b9f8/_0x20a6f3;}return 0x1/_0x42424e;}function isVoiceQueueOutbound(_0x7d5bf9){return _0x7d5bf9==='outbound';}function isNotPreview(_0x282e3a){return _0x282e3a!==_0x8f23('0x90');}function isCampaignIvr(_0x35503c){return _0x35503c===_0x8f23('0x77');}function getCallerId(_0x2424b6,_0x5a9909,_0x286b3b){if(!_[_0x8f23('0x82')](_0x286b3b)&&typeof _0x286b3b===_0x8f23('0x91')&&!_[_0x8f23('0x45')](_0x286b3b)){if(!_[_0x8f23('0x82')](_0x5a9909)&&typeof _0x5a9909===_0x8f23('0x91')&&!_[_0x8f23('0x45')](_0x5a9909)){return util[_0x8f23('0x75')]('\x22%s\x22\x20<%s>',_0x5a9909,_0x286b3b);}return util[_0x8f23('0x75')]('\x22%s\x22\x20<%s>',_0x286b3b,_0x286b3b);}if(!_[_0x8f23('0x82')](_0x2424b6)&&typeof _0x2424b6===_0x8f23('0x91')&&!_['isEmpty'](_0x2424b6)){return _0x2424b6;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x632248,_0x56808){return function(_0x5c4a1f){freeVariablesPredictive(_0x56808);emitVoiceQueueSummary(_0x56808);emitCampaignSummary(_0x56808);loggerSyncQueueSummary['error'](_0x632248,util['inspect'](_0x5c4a1f,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xcbebde,_0x42173c){return function(_0x4ab3ff){loggerPredictive[_0x8f23('0x92')](_0x42173c[_0x8f23('0x3e')],_0xcbebde);loggerPredictive[_0x8f23('0x92')](_0x4ab3ff['stack']);freeVariablesPredictive(_0x42173c);};}function loggerCatch(_0x3382d2){return function(_0x4bd23e){logger[_0x8f23('0x92')](_0x3382d2,util[_0x8f23('0x93')](_0x4bd23e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x369486){return _0x369486&&!_[_0x8f23('0x82')](_0x369486)&&_0x369486['length']>0x0;}function decremetOriginate(_0xf59ccd){if(!_[_0x8f23('0x82')](_0xf59ccd)&&_0xf59ccd!==null){if(typeof _0xf59ccd[_0x8f23('0x71')]!=='undefined'){if(_0xf59ccd[_0x8f23('0x71')]>0x0){_0xf59ccd[_0x8f23('0x71')]-=0x1;}else{logger[_0x8f23('0x92')](_0x8f23('0x94'));}}}else{logger['error'](_0x8f23('0x95'));}}function checkContactLowerLimitOriginate(_0x5e6694,_0x45529a,_0x315dce){if(_0x45529a>_0x315dce){for(var _0x11852e=0x0;_0x11852e<_0x45529a-_0x315dce;_0x11852e+=0x1){decremetOriginate(_0x5e6694);}}}function loggerGetContactDialer(_0x30e504,_0x232d79,_0x488b70){return function(_0x3e0bb4){checkContactLowerLimitOriginate(_0x232d79,_0x488b70,0x0);logger['error'](_0x30e504,util[_0x8f23('0x93')](_0x3e0bb4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x196806){return function(_0x5b5ee8){if(isNotNull(_0x5b5ee8)&&isNotNull(_0x5b5ee8[0x0])){if(_0x5b5ee8[0x0][_0x8f23('0x96')]>0x0){_0x196806[_0x8f23('0x3f')]=_0x8f23('0x97');logger[_0x8f23('0x7a')](_0x8f23('0x98')+_0x196806[_0x8f23('0x3e')],_0x5b5ee8[0x0][_0x8f23('0x96')],_0x8f23('0x99'));}else{_0x196806['message']=_0x8f23('0x9a');logger[_0x8f23('0x7a')](_0x8f23('0x9b')+_0x196806[_0x8f23('0x3e')]);}}};}function notSendMessagesQueue(_0x3290e1){if(_0x3290e1[_0x8f23('0x9c')]){freeVariablesPredictive(_0x3290e1);if(_0x3290e1[_0x8f23('0x71')]===0x0&&_0x3290e1['talking']===0x0&&_0x3290e1[_0x8f23('0x57')]===0x0&&(_0x3290e1[_0x8f23('0x51')]||0x0)===0x0){_0x3290e1[_0x8f23('0x9c')]=![];_0x3290e1[_0x8f23('0x4f')]=0x0;_0x3290e1[_0x8f23('0x3f')]=_0x8f23('0x40');loggerSyncQueueSummary[_0x8f23('0x92')](_0x8f23('0x9d'),_0x3290e1['name'],'is\x20not\x20active');}else{_0x3290e1[_0x8f23('0x3f')]=_0x8f23('0x9e');loggerSyncQueueSummary[_0x8f23('0x92')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x3290e1[_0x8f23('0x3e')],_0x8f23('0x9f'));}emitVoiceQueueSummary(_0x3290e1);}}function notSendMessagesCampaign(_0x5cd456){if(_0x5cd456[_0x8f23('0x9c')]){if(_0x5cd456[_0x8f23('0x71')]===0x0){_0x5cd456[_0x8f23('0x9c')]=![];_0x5cd456[_0x8f23('0x3f')]=_0x8f23('0x40');loggerSyncQueueSummary['error'](_0x8f23('0xa0'),_0x5cd456[_0x8f23('0x3e')],_0x8f23('0xa1'));}else{_0x5cd456[_0x8f23('0x3f')]=_0x8f23('0x9e');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5cd456['name'],_0x8f23('0x9f'));}emitCampaignSummary(_0x5cd456);}}function createObjHistory(_0x16913d,_0x549ffd,_0x5627ae,_0x1a8267,_0x40ac1e){_0x16913d[_0x8f23('0x3f')]=_0x5627ae;var _0x334014=new Action(_0x16913d,_0x549ffd);var _0x3b2b54=new History(_0x334014);_0x3b2b54[_0x8f23('0xa2')]=_0x1a8267;_0x3b2b54[_0x8f23('0xa3')]=_0x40ac1e;_0x3b2b54[_0x8f23('0xa4')]=_0x334014[_0x8f23('0xa5')];return _0x3b2b54;}Dialer[_0x8f23('0x1a')][_0x8f23('0x3c')]=function(){var _0x132fb1=this;setInterval(function(){_0x132fb1[_0x8f23('0xa6')](_0x132fb1['uniqueId'],_0x8f23('0xa7'));_0x132fb1[_0x8f23('0xa6')](_0x132fb1[_0x8f23('0x24')],_0x8f23('0xa8'));},0x32c8);};Dialer[_0x8f23('0x1a')][_0x8f23('0xa6')]=function(_0x22893f,_0x2dd2fb){var _0x40c1b1=this;for(var _0x422b74 in _0x22893f){if(typeof _0x22893f[_0x422b74]!=='undefined'){this[_0x8f23('0x1d')][_0x8f23('0xa9')](function(){if(!_[_0x8f23('0xaa')](_0x22893f[_0x422b74])){return ami[_0x8f23('0xab')]({'action':_0x8f23('0xac'),'channel':_0x22893f[_0x422b74][_0x8f23('0xad')]})[_0x8f23('0xae')](function(_0x3f39b3){if(_0x3f39b3[_0x8f23('0x3f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x22893f[_0x422b74]&&_0x22893f[_0x422b74][_0x8f23('0x4d')]!==_0x8f23('0x77')){_0x40c1b1[_0x8f23('0xaf')](_0x40c1b1[_0x8f23('0x1e')][_0x22893f[_0x422b74]['queue']]);logger[_0x8f23('0x92')]('[Dialer][checkChannel]',_0x2dd2fb,_0x422b74,_0x22893f[_0x422b74][_0x8f23('0xb0')]);delete _0x22893f[_0x422b74];}if(_0x22893f[_0x422b74]&&_0x22893f[_0x422b74]['type']===_0x8f23('0x77')){_0x40c1b1['updateOriginated'](_0x40c1b1[_0x8f23('0x1f')][_0x22893f[_0x422b74][_0x8f23('0xb0')]]);logger[_0x8f23('0x92')](_0x8f23('0xb1'),_0x2dd2fb,_0x422b74,_0x22893f[_0x422b74][_0x8f23('0xb0')]);delete _0x22893f[_0x422b74];}},0x2328);}});}});}}};Dialer[_0x8f23('0x1a')][_0x8f23('0xb2')]=function(_0x571893){return BPromise[_0x8f23('0xb3')]()['then'](cmHopper[_0x8f23('0xb2')](_0x571893))[_0x8f23('0xae')](loggerCatch(_0x8f23('0xb4')));};Dialer[_0x8f23('0x1a')][_0x8f23('0xb5')]=function(_0x274c9d){return BPromise[_0x8f23('0xb3')]()[_0x8f23('0xb6')](cmHopperBlack['checkIsBlackList'](_0x274c9d))[_0x8f23('0xae')](loggerCatch(_0x8f23('0xb7')));};Dialer[_0x8f23('0x1a')][_0x8f23('0xb8')]=function(_0x3eb822){return BPromise[_0x8f23('0xb3')]()[_0x8f23('0xb6')](cmHopperBlack[_0x8f23('0xb8')](_0x3eb822))[_0x8f23('0xae')](loggerCatch(_0x8f23('0xb9')));};Dialer[_0x8f23('0x1a')][_0x8f23('0xba')]=function(_0x30aabf){return BPromise[_0x8f23('0xb3')]()[_0x8f23('0xb6')](cmHopperHistory[_0x8f23('0xbb')](_0x30aabf))[_0x8f23('0xae')](loggerCatch(_0x8f23('0xbc')));};Dialer[_0x8f23('0x1a')][_0x8f23('0xbd')]=function(_0x3e930f){return BPromise[_0x8f23('0xb3')]()[_0x8f23('0xb6')](cmHopper[_0x8f23('0xbd')](_0x3e930f))['catch'](loggerCatch(_0x8f23('0xbe')));};Dialer[_0x8f23('0x1a')][_0x8f23('0xbf')]=function(_0x1cc310,_0x35aab2,_0x296e7d){return BPromise['resolve']()[_0x8f23('0xb6')](cmHopper[_0x8f23('0xbf')](_0x1cc310,_0x35aab2,_0x296e7d))[_0x8f23('0xae')](loggerCatch(_0x8f23('0xc0')));};Dialer[_0x8f23('0x1a')][_0x8f23('0xc1')]=function(_0x4de97d,_0x5b7cdb,_0x5f04c0,_0x2fe8f3,_0x2c1e56){return BPromise[_0x8f23('0xb3')]()['then'](cmHopper[_0x8f23('0xc1')](_0x4de97d,_0x5b7cdb,_0x5f04c0,_0x2fe8f3))[_0x8f23('0xae')](function(_0xbff5dc){_0x2c1e56[_0x8f23('0xc2')]-=_0x5f04c0;_0x2c1e56[_0x8f23('0xc2')]=_0x2c1e56['temp']>0x0?_0x2c1e56[_0x8f23('0xc2')]:0x0;loggerCatch(_0x8f23('0xc3'))(_0xbff5dc);});};Dialer[_0x8f23('0x1a')]['getContactDialerIvr']=function(_0x5804c8,_0x25ea17,_0x251eda,_0x4c24a9){return BPromise[_0x8f23('0xb3')]()[_0x8f23('0xb6')](cmHopper[_0x8f23('0xc4')](_0x5804c8,_0x25ea17,_0x251eda))['catch'](function(_0x1e02b8){_0x4c24a9[_0x8f23('0xc2')]-=_0x25ea17;_0x4c24a9[_0x8f23('0xc2')]=_0x4c24a9[_0x8f23('0xc2')]>0x0?_0x4c24a9[_0x8f23('0xc2')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x1e02b8);});};Dialer[_0x8f23('0x1a')]['getVoiceQueueRtPauses']=function(_0x3fcba2){return BPromise['resolve']()[_0x8f23('0xb6')](voiceQueueRt[_0x8f23('0xc5')](_0x3fcba2))[_0x8f23('0xae')](loggerCatch(_0x8f23('0xc6')));};Dialer[_0x8f23('0x1a')][_0x8f23('0xc7')]=function(_0x4c7be6){return BPromise[_0x8f23('0xb3')]()[_0x8f23('0xb6')](cmHopper[_0x8f23('0xc7')](_0x4c7be6))[_0x8f23('0xae')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x8f23('0x1a')]['createHistory']=function(_0x378519){return BPromise['resolve']()['then'](cmHopperHistory['createHistory'](_0x378519))[_0x8f23('0xae')](loggerCatch(_0x8f23('0xc8')));};Dialer[_0x8f23('0x1a')]['updateOriginated']=function(_0x4bc8ca){if(!_[_0x8f23('0x82')](_0x4bc8ca)&&_0x4bc8ca!==null){if(typeof _0x4bc8ca[_0x8f23('0x71')]!==_0x8f23('0xc9')){if(_0x4bc8ca['originated']>0x0){_0x4bc8ca[_0x8f23('0x71')]-=0x1;}else{logger[_0x8f23('0x92')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x8f23('0x92')](_0x8f23('0xca'));}};Dialer[_0x8f23('0x1a')]['loggerHandler']=function(_0x1b6b71,_0x204dc3){var _0x3639d0=this;return function(_0x623125){_0x3639d0[_0x8f23('0xaf')](_0x204dc3);logger['error'](_0x1b6b71,util[_0x8f23('0x93')](_0x623125,{'showHidden':![],'depth':null}));};};Dialer[_0x8f23('0x1a')][_0x8f23('0xcb')]=function(_0x4896c5,_0x51b0a8,_0x3ba13d){var _0x22333f={'state':0x19,'statedesc':_0x8f23('0xcc')};this[_0x8f23('0xaf')](_0x51b0a8);this['saveInDb'](_[_0x8f23('0x8c')](_0x22333f,_[_0x8f23('0xcd')](_0x3ba13d,[_0x8f23('0xce'),'ListId',_0x8f23('0xcf'),'VoiceQueueId',_0x8f23('0xd0')])),_0x8f23('0xd1'),_0x8f23('0xd2'));logger['error'](_0x4896c5);};Dialer[_0x8f23('0x1a')][_0x8f23('0xd3')]=function(_0x206af1){return _0x206af1==='Success';};Dialer[_0x8f23('0x1a')][_0x8f23('0xd4')]=function(_0x21a67b){return!_[_0x8f23('0x82')](_0x21a67b)&&_0x21a67b&&!_[_0x8f23('0x82')](_0x21a67b[_0x8f23('0x3e')])&&!_[_0x8f23('0x82')](_0x21a67b[_0x8f23('0xd5')])&&_0x21a67b[_0x8f23('0xd5')]&&(this[_0x8f23('0x21')][util[_0x8f23('0x75')](_0x8f23('0xd6'),_0x21a67b[_0x8f23('0x3e')])][_0x8f23('0xac')]===_0x8f23('0xd7')||this[_0x8f23('0x21')][util[_0x8f23('0x75')](_0x8f23('0xd6'),_0x21a67b[_0x8f23('0x3e')])][_0x8f23('0xac')]===_0x8f23('0xd8'));};Dialer[_0x8f23('0x1a')][_0x8f23('0xd9')]=function(_0x1debf7,_0x1c0d9c,_0x358913){this[_0x8f23('0xda')](_0x1debf7)[_0x8f23('0xae')](loggerCatch(_0x1c0d9c));this[_0x8f23('0xc7')](_0x1debf7)['catch'](loggerCatch(_0x358913));};Dialer[_0x8f23('0x1a')][_0x8f23('0x38')]=function(_0x4662e5){var _0x96bf78=this[_0x8f23('0x26')][_0x4662e5['uniqueid']];var _0xc0f36;if(!_[_0x8f23('0xaa')](_0x4662e5)&&!_['isNil'](_0x4662e5['variable'])&&!_['isNil'](_0x4662e5['variable']['amdstatus'])&&_0x4662e5[_0x8f23('0xdb')]===_0x8f23('0xdc')&&_0x96bf78){if(_0x96bf78[_0x8f23('0x4d')]!==_0x8f23('0x77')&&this[_0x8f23('0x1e')][_0x96bf78['queue']][_0x8f23('0xdd')]&&_0x4662e5[_0x8f23('0xde')]==='HANGUP'){delete this[_0x8f23('0x26')][_0x4662e5[_0x8f23('0xdf')]];this[_0x8f23('0xaf')](this['voiceQueues'][_0x96bf78[_0x8f23('0xb0')]]);this[_0x8f23('0x1e')][_0x96bf78[_0x8f23('0xb0')]][_0x8f23('0x5f')]+=0x1;this[_0x8f23('0x1e')][_0x96bf78['queue']][_0x8f23('0x5e')]+=0x1;_0xc0f36=new Hangup(_0x96bf78,_0x4662e5);_0xc0f36[_0x8f23('0xa2')]=0x12;_0xc0f36[_0x8f23('0xa3')]=_0x8f23('0xe0');_0xc0f36['membername']=_0x8f23('0xe1');ami[_0x8f23('0x4c')](_0x8f23('0xe2'),ut[_0x8f23('0xe3')](_0xc0f36,_0x8f23('0xe4')));this[_0x8f23('0xd9')](_0xc0f36,_0x8f23('0xe5'),'[syncHangupInAMD]');}if(_0x96bf78[_0x8f23('0x4d')]!==_0x8f23('0x77')&&this[_0x8f23('0x1e')][_0x96bf78[_0x8f23('0xb0')]]['dialAMDActive']&&_0x4662e5[_0x8f23('0xde')]==='MACHINE'){var _0x26b392=this;return new BPromise(function(_0x48fcac,_0x88fbda){delete _0x26b392[_0x8f23('0x26')][_0x4662e5[_0x8f23('0xdf')]];_0x26b392[_0x8f23('0xaf')](_0x26b392[_0x8f23('0x1e')][_0x96bf78[_0x8f23('0xb0')]]);_0x26b392['voiceQueues'][_0x96bf78[_0x8f23('0xb0')]][_0x8f23('0x5f')]+=0x1;_0x26b392[_0x8f23('0x1e')][_0x96bf78[_0x8f23('0xb0')]][_0x8f23('0x5e')]+=0x1;var _0x164fac=_0x26b392[_0x8f23('0x1e')][_0x96bf78[_0x8f23('0xb0')]];var _0x54ff32=new Hangup(_0x96bf78,_0x4662e5);_0x54ff32[_0x8f23('0xa2')]=0x13;_0x54ff32[_0x8f23('0xa3')]='Machine';_0x54ff32[_0x8f23('0xe6')]=_0x8f23('0xe1');_0x54ff32[_0x8f23('0xe7')]+=0x1;_0x54ff32[_0x8f23('0xe8')]+=0x1;_0x54ff32[_0x8f23('0xe4')]=!![];ami['emit'](_0x8f23('0xe2'),ut[_0x8f23('0xe3')](_0x54ff32,_0x8f23('0xe4')));_0x26b392['createHistory'](_0x54ff32)[_0x8f23('0xae')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x54ff32[_0x8f23('0xe9')]+_0x54ff32[_0x8f23('0xea')]+_0x54ff32[_0x8f23('0xeb')]+_0x54ff32['countnosuchnumberretry']+_0x54ff32[_0x8f23('0xec')]+_0x54ff32[_0x8f23('0xed')]+_0x54ff32[_0x8f23('0xe7')]+_0x54ff32[_0x8f23('0xee')]>=_0x164fac['dialGlobalMaxRetry']){_0x26b392['stateGlobal'](_0x54ff32,_0x48fcac,_0x88fbda,'reason19\x20machine....');}else{if(_0x54ff32[_0x8f23('0xe7')]>=_0x164fac[_0x8f23('0xef')]){_0x26b392[_0x8f23('0xf0')](_0x54ff32,_0x48fcac,_0x88fbda,_0x8f23('0xf1'));}else{_0x26b392[_0x8f23('0xbd')]({'active':![],'countmachineretry':_0x54ff32[_0x8f23('0xe7')],'scheduledat':moment()[_0x8f23('0xf2')](_0x164fac['dialMachineRetryFrequency'],_0x8f23('0xf3'))['format'](_0x8f23('0xf4')),'ContactId':_0x54ff32[_0x8f23('0xce')],'ListId':_0x54ff32[_0x8f23('0xf5')],'VoiceQueueId':_0x54ff32[_0x8f23('0xf6')]||undefined,'CampaignId':_0x54ff32[_0x8f23('0xd0')]||undefined})[_0x8f23('0xae')](loggerCatch(_0x8f23('0xf7')));_0x48fcac({'reschedule':0x1});}}});}if(_0x96bf78[_0x8f23('0x4d')]===_0x8f23('0x77')&&this['campaigns'][_0x96bf78['queue']][_0x8f23('0xdd')]&&_0x4662e5[_0x8f23('0xde')]==='HANGUP'){delete this[_0x8f23('0x26')][_0x4662e5['uniqueid']];this['updateOriginated'](this[_0x8f23('0x1f')][_0x96bf78[_0x8f23('0xb0')]]);_0xc0f36=new Hangup(_0x96bf78,_0x4662e5);_0xc0f36[_0x8f23('0xa2')]=0x12;_0xc0f36[_0x8f23('0xa3')]=_0x8f23('0xe0');_0xc0f36['membername']=_0x8f23('0xe1');ami[_0x8f23('0x4c')](_0x8f23('0xe2'),ut[_0x8f23('0xe3')](_0xc0f36,_0x8f23('0xe4')));this[_0x8f23('0xd9')](_0xc0f36,'[syncHangupInAMDIvr][createHistory]',_0x8f23('0xf8'));}if(_0x96bf78['type']==='ivr'&&this[_0x8f23('0x1f')][_0x96bf78[_0x8f23('0xb0')]][_0x8f23('0xdd')]&&_0x4662e5['value']===_0x8f23('0xf9')){var _0x26b392=this;return new BPromise(function(_0x46fb47,_0x51a660){delete _0x26b392[_0x8f23('0x26')][_0x4662e5[_0x8f23('0xdf')]];_0x26b392[_0x8f23('0xaf')](_0x26b392[_0x8f23('0x1f')][_0x96bf78[_0x8f23('0xb0')]]);_0x26b392[_0x8f23('0x1f')][_0x96bf78[_0x8f23('0xb0')]][_0x8f23('0x5f')]+=0x1;_0x26b392[_0x8f23('0x1f')][_0x96bf78[_0x8f23('0xb0')]][_0x8f23('0x5e')]+=0x1;var _0x41131b=_0x26b392['campaigns'][_0x96bf78[_0x8f23('0xb0')]];var _0xeda442=new Hangup(_0x96bf78,_0x4662e5);_0xeda442[_0x8f23('0xa2')]=0x13;_0xeda442['statedesc']=_0x8f23('0xfa');_0xeda442[_0x8f23('0xe6')]='AMD';_0xeda442['countmachineretry']+=0x1;_0xeda442['countglobal']+=0x1;_0xeda442[_0x8f23('0xe4')]=!![];ami['emit'](_0x8f23('0xe2'),ut['buildObj'](_0xeda442,_0x8f23('0xe4')));_0x26b392['createHistory'](_0xeda442)[_0x8f23('0xae')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xeda442[_0x8f23('0xe9')]+_0xeda442[_0x8f23('0xea')]+_0xeda442['countnoanswerretry']+_0xeda442['countnosuchnumberretry']+_0xeda442['countdropretry']+_0xeda442[_0x8f23('0xed')]+_0xeda442[_0x8f23('0xe7')]+_0xeda442['countagentrejectretry']>=_0x41131b[_0x8f23('0xfb')]){_0x26b392[_0x8f23('0xfc')](_0xeda442,_0x46fb47,_0x51a660,'reason19\x20machine....');}else{if(_0xeda442[_0x8f23('0xe7')]>=_0x41131b[_0x8f23('0xef')]){_0x26b392[_0x8f23('0xf0')](_0xeda442,_0x46fb47,_0x51a660,_0x8f23('0xf1'));}else{_0x26b392[_0x8f23('0xbd')]({'active':![],'countmachineretry':_0xeda442[_0x8f23('0xe7')],'scheduledat':moment()[_0x8f23('0xf2')](_0x41131b[_0x8f23('0xfd')],_0x8f23('0xf3'))[_0x8f23('0x75')](_0x8f23('0xf4')),'ContactId':_0xeda442[_0x8f23('0xce')],'ListId':_0xeda442['ListId'],'VoiceQueueId':_0xeda442[_0x8f23('0xf6')]||undefined,'CampaignId':_0xeda442[_0x8f23('0xd0')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x46fb47({'reschedule':0x1});}}});}}};Dialer[_0x8f23('0x1a')]['syncHangup']=function(_0x2f9a75){var _0x9f6ae4=this[_0x8f23('0x26')][_0x2f9a75['uniqueid']];var _0x296dd1=this;var _0x2fe265;if(_0x9f6ae4&&_0x9f6ae4[_0x8f23('0x4d')]===_0x8f23('0x77')){delete this[_0x8f23('0x26')][_0x2f9a75['uniqueid']];this[_0x8f23('0xaf')](this[_0x8f23('0x1f')][_0x9f6ae4[_0x8f23('0xb0')]]);this[_0x8f23('0x1f')][_0x9f6ae4[_0x8f23('0xb0')]][_0x8f23('0xfe')]+=0x1;_0x2fe265=new Hangup(_0x9f6ae4,_0x2f9a75);this[_0x8f23('0xda')](_0x2fe265)[_0x8f23('0xae')](loggerCatch(_0x8f23('0xff')));this[_0x8f23('0xc7')](_0x2fe265)[_0x8f23('0xae')](loggerCatch(_0x8f23('0x100')));}if(_0x9f6ae4&&_0x9f6ae4[_0x8f23('0x4d')]!==_0x8f23('0x77')&&isNotNull(this[_0x8f23('0x1e')][_0x9f6ae4['queue']]['dialQueueProject'])){delete this['uniqueId'][_0x2f9a75[_0x8f23('0xdf')]];this[_0x8f23('0xaf')](this['voiceQueues'][_0x9f6ae4[_0x8f23('0xb0')]]);this['voiceQueues'][_0x9f6ae4['queue']][_0x8f23('0x5f')]+=0x1;this[_0x8f23('0x1e')][_0x9f6ae4[_0x8f23('0xb0')]][_0x8f23('0x5e')]+=0x1;_0x2fe265=new Hangup(_0x9f6ae4,_0x2f9a75);_0x2fe265[_0x8f23('0xa2')]=0x10;_0x2fe265[_0x8f23('0xa3')]=_0x8f23('0x101');_0x2fe265[_0x8f23('0xe6')]=_0x8f23('0x102');this[_0x8f23('0xda')](_0x2fe265)[_0x8f23('0xae')](loggerCatch(_0x8f23('0xff')));this['moveContactManagedDialer'](_0x2fe265)[_0x8f23('0xae')](loggerCatch('[syncHangupIvr]'));}if(_0x9f6ae4&&_0x9f6ae4[_0x8f23('0x4d')]!==_0x8f23('0x77')&&!isNotNull(this[_0x8f23('0x1e')][_0x9f6ae4[_0x8f23('0xb0')]]['dialQueueProject'])){delete this[_0x8f23('0x26')][_0x2f9a75[_0x8f23('0xdf')]];this[_0x8f23('0xaf')](this[_0x8f23('0x1e')][_0x9f6ae4[_0x8f23('0xb0')]]);this[_0x8f23('0x1e')][_0x9f6ae4['queue']]['outboundUnknownCallsDay']+=0x1;_0x2fe265=new Hangup(_0x9f6ae4,_0x2f9a75);_0x2fe265[_0x8f23('0xa2')]=0xc;_0x2fe265[_0x8f23('0xa3')]=_0x2f9a75['cause-txt'];_0x2fe265[_0x8f23('0xe6')]=_0x8f23('0x103');this[_0x8f23('0xda')](_0x2fe265)[_0x8f23('0xae')](loggerCatch(_0x8f23('0xff')));this[_0x8f23('0xc7')](_0x2fe265)[_0x8f23('0xae')](loggerCatch(_0x8f23('0x100')));}};Dialer[_0x8f23('0x1a')]['syncAgentComplete']=function(_0x1034b6){var _0xc750c=this[_0x8f23('0x26')][_0x1034b6[_0x8f23('0xdf')]];var _0xa68a1e=this;if(this[_0x8f23('0x1e')][_0x1034b6[_0x8f23('0xb0')]]){if(_0xc750c&&_0xc750c[_0x8f23('0x4d')]!==_0x8f23('0x77')){delete this['uniqueId'][_0x1034b6[_0x8f23('0xdf')]];this[_0x8f23('0x1e')][_0x1034b6[_0x8f23('0xb0')]][_0x8f23('0x5f')]+=0x1;var _0xa48d51=new AgentComplete(_0xc750c,_0x1034b6);if(_0x1034b6['reason']===_0x8f23('0x104')){_0xa48d51[_0x8f23('0x105')]=this[_0x8f23('0x1e')][_0x1034b6[_0x8f23('0xb0')]][_0x8f23('0x106')]&&this[_0x8f23('0x1e')][_0x1034b6[_0x8f23('0xb0')]]['dialAgiAfterHangupAgent']?moment()[_0x8f23('0x75')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0xa48d51)[_0x8f23('0xae')](loggerCatch(_0x8f23('0x107')));this[_0x8f23('0xc7')](_0xa48d51)[_0x8f23('0xae')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x8f23('0x1a')]['syncAgentConnect']=function(_0x578fea){if(this[_0x8f23('0x1e')][_0x578fea[_0x8f23('0xb0')]]){if(this[_0x8f23('0x26')][_0x578fea['uniqueid']]&&this[_0x8f23('0x26')][_0x578fea[_0x8f23('0xdf')]][_0x8f23('0x4d')]!==_0x8f23('0x77')){this[_0x8f23('0xaf')](this[_0x8f23('0x1e')][_0x578fea[_0x8f23('0xb0')]]);this['uniqueId'][_0x578fea[_0x8f23('0xdf')]]['answertime']=moment()[_0x8f23('0x75')](_0x8f23('0xf4'));}}};Dialer[_0x8f23('0x1a')][_0x8f23('0x108')]=function(_0x3e7885){this[_0x8f23('0xda')](_0x3e7885)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x8f23('0xc7')](_0x3e7885)['catch'](loggerCatch(_0x8f23('0x109')));};Dialer[_0x8f23('0x1a')]['syncQueueCallerAbandon']=function(_0x28dabd){var _0x3da831=this['uniqueId'][_0x28dabd[_0x8f23('0xdf')]];var _0x1cce75=this;if(this[_0x8f23('0x1e')][_0x28dabd[_0x8f23('0xb0')]]){if(_0x3da831&&_0x3da831[_0x8f23('0x4d')]!=='ivr'){delete this[_0x8f23('0x26')][_0x28dabd[_0x8f23('0xdf')]];this['updateOriginated'](this[_0x8f23('0x1e')][_0x28dabd[_0x8f23('0xb0')]]);_0x3da831[_0x8f23('0x10a')]=moment()[_0x8f23('0x75')]('YYYY-MM-DD\x20HH:mm:ss');var _0x236ef5=new QueueCallerAbandon(_0x3da831,_0x28dabd);if(getSeconds(_0x3da831['droptime'],_0x3da831[_0x8f23('0x10b')])>=_0x3da831[_0x8f23('0x10c')]){this[_0x8f23('0x1e')][_0x28dabd[_0x8f23('0xb0')]][_0x8f23('0x7d')]+=0x1;this[_0x8f23('0x1e')][_0x28dabd[_0x8f23('0xb0')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x28dabd[_0x8f23('0xb0')]][_0x8f23('0x10d')]+=0x1;_0x236ef5[_0x8f23('0xa2')]=0xa;_0x236ef5[_0x8f23('0xa3')]='Drop';_0x236ef5['dropreason']='TIMEOUT';_0x236ef5[_0x8f23('0x105')]=this[_0x8f23('0x1e')][_0x28dabd[_0x8f23('0xb0')]][_0x8f23('0x106')]?moment()[_0x8f23('0x75')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x236ef5[_0x8f23('0xec')]+=0x1;_0x236ef5[_0x8f23('0xe8')]+=0x1;if(_0x236ef5[_0x8f23('0xec')]>=this[_0x8f23('0x1e')][_0x28dabd[_0x8f23('0xb0')]][_0x8f23('0x10e')]){this[_0x8f23('0x108')](_0x236ef5);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x236ef5[_0x8f23('0xec')],'scheduledat':moment()[_0x8f23('0xf2')](this[_0x8f23('0x1e')][_0x28dabd[_0x8f23('0xb0')]]['dialDropRetryFrequency'],_0x8f23('0xf3'))[_0x8f23('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3da831[_0x8f23('0xce')],'ListId':_0x3da831[_0x8f23('0xf5')],'VoiceQueueId':_0x3da831[_0x8f23('0xf6')]||undefined,'CampaignId':_0x3da831[_0x8f23('0xd0')]||undefined})['catch'](loggerCatch(_0x8f23('0x10f')));var _0x34af6a=new History(_0x236ef5);_0x34af6a[_0x8f23('0xa2')]=0xa;_0x34af6a['statedesc']=_0x8f23('0x110');_0x34af6a[_0x8f23('0xa5')]=moment()[_0x8f23('0x75')](_0x8f23('0xf4'));_0x34af6a['endtime']=_0x34af6a[_0x8f23('0xa5')];_0x34af6a[_0x8f23('0x111')]=_0x236ef5[_0x8f23('0x111')];_0x34af6a[_0x8f23('0x112')]=_0x236ef5[_0x8f23('0x112')];this[_0x8f23('0xda')](_0x34af6a)['catch'](loggerCatch(_0x8f23('0x113')));}}else{this[_0x8f23('0x1e')][_0x28dabd['queue']][_0x8f23('0x6d')]+=0x1;this[_0x8f23('0x1e')][_0x28dabd[_0x8f23('0xb0')]][_0x8f23('0x64')]+=0x1;_0x236ef5['state']=0xb;_0x236ef5[_0x8f23('0xa3')]=_0x8f23('0x114');_0x236ef5[_0x8f23('0x115')]='CALLEREXIT';_0x236ef5['countabandonedretry']+=0x1;_0x236ef5[_0x8f23('0xe8')]+=0x1;if(_0x236ef5[_0x8f23('0xed')]>=this[_0x8f23('0x1e')][_0x28dabd[_0x8f23('0xb0')]][_0x8f23('0x116')]){this['queueCallerAbandonCreateState'](_0x236ef5);}else{this[_0x8f23('0xbd')]({'active':![],'countabandonedretry':_0x236ef5[_0x8f23('0xed')],'scheduledat':moment()['add'](this[_0x8f23('0x1e')][_0x28dabd[_0x8f23('0xb0')]][_0x8f23('0x117')],_0x8f23('0xf3'))['format'](_0x8f23('0xf4')),'ContactId':_0x3da831[_0x8f23('0xce')],'ListId':_0x3da831['ListId'],'VoiceQueueId':_0x3da831[_0x8f23('0xf6')]||undefined,'CampaignId':_0x3da831['CampaignId']||undefined})[_0x8f23('0xae')](loggerCatch(_0x8f23('0x118')));var _0x34af6a=new History(_0x236ef5);_0x34af6a[_0x8f23('0xa2')]=0xb;_0x34af6a[_0x8f23('0xa3')]=_0x8f23('0x114');_0x34af6a[_0x8f23('0xa5')]=moment()[_0x8f23('0x75')](_0x8f23('0xf4'));_0x34af6a[_0x8f23('0xa4')]=_0x34af6a[_0x8f23('0xa5')];_0x34af6a[_0x8f23('0x111')]=_0x236ef5[_0x8f23('0x111')];_0x34af6a[_0x8f23('0x112')]=_0x236ef5[_0x8f23('0x112')];this[_0x8f23('0xda')](_0x34af6a)['catch'](loggerCatch(_0x8f23('0x119')));}}}}};Dialer['prototype'][_0x8f23('0x36')]=function(_0x1ab475){if(this[_0x8f23('0x24')][_0x1ab475[_0x8f23('0xdf')]]){this['actions'][_0x1ab475[_0x8f23('0xdf')]][_0x8f23('0xad')]=_0x1ab475['channel'];}if(this[_0x8f23('0x26')][_0x1ab475[_0x8f23('0xdf')]]){this[_0x8f23('0x26')][_0x1ab475[_0x8f23('0xdf')]][_0x8f23('0xad')]=_0x1ab475['channel'];}};Dialer[_0x8f23('0x1a')]['syncQueueMember']=function(_0x283f19){if(strategy[this[_0x8f23('0x1e')][this[_0x8f23('0x24')][_0x283f19['actionid']]['queue']][_0x8f23('0x11a')]]===_0x8f23('0x19')){if(this[_0x8f23('0x24')][_0x283f19['actionid']]&&_['isNil'](this['actions'][_0x283f19['actionid']]['locked'])&&_0x283f19[_0x8f23('0xac')]==='1'&&_0x283f19[_0x8f23('0x11b')]==='0'){if(this[_0x8f23('0x20')][_0x283f19[_0x8f23('0x11c')]]){if(!this[_0x8f23('0x20')][_0x283f19[_0x8f23('0x11c')]]['locked']){this[_0x8f23('0x20')][_0x283f19[_0x8f23('0x11c')]][_0x8f23('0x11d')]=!![];this[_0x8f23('0x24')][_0x283f19[_0x8f23('0x11e')]]['locked']=!![];this['actions'][_0x283f19[_0x8f23('0x11e')]][_0x8f23('0x11c')]=_0x283f19[_0x8f23('0x11c')];}}}}else if((strategy[this['voiceQueues'][this[_0x8f23('0x24')][_0x283f19[_0x8f23('0x11e')]][_0x8f23('0xb0')]][_0x8f23('0x11a')]]||_0x8f23('0x11f'))===_0x8f23('0x11f')){if(this[_0x8f23('0x24')][_0x283f19['actionid']]){if(this[_0x8f23('0x20')][_0x283f19[_0x8f23('0x11c')]]){this[_0x8f23('0x24')][_0x283f19[_0x8f23('0x11e')]][_0x8f23('0x11c')]=_0x283f19[_0x8f23('0x11c')];if(_[_0x8f23('0xaa')](this[_0x8f23('0x120')][this['actions'][_0x283f19['actionid']][_0x8f23('0xb0')]])){this['queueBooked'][this[_0x8f23('0x24')][_0x283f19[_0x8f23('0x11e')]][_0x8f23('0xb0')]]=[];}this[_0x8f23('0x120')][this[_0x8f23('0x24')][_0x283f19[_0x8f23('0x11e')]]['queue']][_0x8f23('0x121')](_[_0x8f23('0x8c')](_[_0x8f23('0xcd')](this[_0x8f23('0x24')][_0x283f19[_0x8f23('0x11e')]],[_0x8f23('0x122'),_0x8f23('0x11c')]),{'status':_0x283f19[_0x8f23('0xac')],'paused':_0x283f19[_0x8f23('0x11b')]}));}}}};function unlockQueueStatus(_0x52ada3,_0x1e20f3){setTimeout(function(){if(_[_0x8f23('0x82')](_0x52ada3[_0x8f23('0x123')])){loggerBooked[_0x8f23('0x92')](_0x8f23('0x124'),_0x1e20f3);}_0x52ada3[_0x8f23('0x123')]=!![];loggerBooked[_0x8f23('0x7a')]('[booked][unlockQueueStatus]',_0x1e20f3,JSON['stringify'](_['pick'](_0x52ada3,[_0x8f23('0x3e'),_0x8f23('0x123')])));},0x1f3);}Dialer['prototype'][_0x8f23('0x125')]=function(_0x49c390){var _0x309a0e=this;var _0x596fa9=_0x309a0e[_0x8f23('0x1e')][_0x309a0e[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]][_0x8f23('0xb0')]];if(strategy[this[_0x8f23('0x1e')][this[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]][_0x8f23('0xb0')]][_0x8f23('0x11a')]]===_0x8f23('0x19')){if(this[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]]&&this[_0x8f23('0x24')][_0x49c390['actionid']]['stateinterface']){this['preview'][_0x8f23('0x126')](this[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]][_0x8f23('0x122')],this[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]][_0x8f23('0x11c')])[_0x8f23('0xae')](function(_0x3159ec){logger[_0x8f23('0x92')](_0x8f23('0x127'),util[_0x8f23('0x93')](_0x3159ec,{'showHidden':![],'depth':null}));})[_0x8f23('0x1c')](function(){_0x309a0e['updateOriginated'](_0x309a0e[_0x8f23('0x1e')][_0x309a0e['actions'][_0x49c390[_0x8f23('0x11e')]][_0x8f23('0xb0')]]);_0x309a0e[_0x8f23('0x20')][_0x309a0e[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]]['stateinterface']]['locked']=![];delete _0x309a0e[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]];unlockQueueStatus(_0x596fa9);});}else{this[_0x8f23('0xaf')](this['voiceQueues'][this[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x49c390[_0x8f23('0x11e')]][_0x8f23('0xce')],'ListId':this['actions'][_0x49c390['actionid']][_0x8f23('0xf5')],'VoiceQueueId':this[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]][_0x8f23('0xf6')]||undefined,'CampaignId':this[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]][_0x8f23('0xd0')]||undefined})[_0x8f23('0xae')](loggerCatch(_0x8f23('0x128')));delete this['actions'][_0x49c390[_0x8f23('0x11e')]];unlockQueueStatus(_0x596fa9);}}else if((strategy[this['voiceQueues'][this[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]][_0x8f23('0xb0')]][_0x8f23('0x11a')]]||_0x8f23('0x11f'))===_0x8f23('0x11f')){var _0x4d71cd;if(this[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]]&&!_[_0x8f23('0x45')](this[_0x8f23('0x120')][this[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]][_0x8f23('0xb0')]])){if(this['queueBookedRR'][_0x309a0e[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]]['queue']]){this[_0x8f23('0x2a')][_0x309a0e[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]][_0x8f23('0xb0')]]=this['queueBookedRR'][this['actions'][_0x49c390[_0x8f23('0x11e')]][_0x8f23('0xb0')]]?this[_0x8f23('0x2a')][this[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]]['queue']]:this[_0x8f23('0x120')][this['actions'][_0x49c390[_0x8f23('0x11e')]][_0x8f23('0xb0')]]?this['queueBooked'][this[_0x8f23('0x24')][_0x49c390['actionid']][_0x8f23('0xb0')]][_0x8f23('0x129')]||0x0:0x0;}this['queueBooked'][this[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]][_0x8f23('0xb0')]][_0x8f23('0x129')]=this[_0x8f23('0x2a')][this[_0x8f23('0x24')][_0x49c390[_0x8f23('0x11e')]][_0x8f23('0xb0')]];for(var _0x5e9071=0x0;_0x5e9071=0x0;})['catch'](myreject(_0x28732c)));}}else{_0x188833[_0x8f23('0x121')](ami[_0x8f23('0xab')]({'action':_0x8f23('0x140'),'command':util[_0x8f23('0x75')](_0x8f23('0x141'),_0x1bc238,!_[_0x8f23('0x82')](config[_0x8f23('0x13e')][_0x28ce41])?_0x28ce41:'')})[_0x8f23('0xb6')](function(_0x41dc61){return _0x41dc61['content'][_0x8f23('0x13f')](_0x8f23('0x142'))>=0x0;})['catch'](myreject(_0x28732c)));}BPromise['all'](_0x188833)[_0x8f23('0xb6')](function(_0x2a9263){var _0x42a1ef=_[_0x8f23('0x143')](_0x2a9263);if(_0x42a1ef){return _0x550ac4(_0x42a1ef);}else{_0x49a526[_0x8f23('0x3f')]=_0x3278e0?_0x8f23('0x144'):_0x8f23('0x145');return _0x28732c(msgResponse(_0x8f23('0x146'),_0x8f23('0x138'),'Global:\x20'+_0x3278e0+'\x20'+_0x5a3c7b+_0x8f23('0x147')+util[_0x8f23('0x93')](_0x1bc238,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x28ce41));}})[_0x8f23('0xae')](function(_0x20c693){return _0x28732c(msgResponse('ifTime',_0x8f23('0x138'),JSON[_0x8f23('0x48')](_0x20c693)));});});};Dialer[_0x8f23('0x1a')][_0x8f23('0x148')]=function(_0x5c795b){var _0x5b1223=this;return function(){switch(_0x5c795b['dialMethod']){case _0x8f23('0x149'):freeVariablesPredictive(_0x5c795b);_0x5b1223[_0x8f23('0x14a')](_0x5c795b,0x1);break;case _0x8f23('0x14b'):freeVariablesPredictive(_0x5c795b);_0x5b1223['handlePower'](_0x5c795b,_0x5c795b['dialPowerLevel']);break;case'predictive':_0x5b1223[_0x8f23('0x8')](_0x5c795b);break;case _0x8f23('0x7'):freeVariablesPredictive(_0x5c795b);_0x5b1223[_0x8f23('0x14a')](_0x5c795b,0x1);break;default:freeVariablesPredictive(_0x5c795b);logger[_0x8f23('0x92')]('Queue',_0x5c795b['name'],_0x8f23('0x14c'));}};};Dialer[_0x8f23('0x1a')][_0x8f23('0x14d')]=function(_0x48c52c){var _0x1541a0=this;return function(){_0x1541a0[_0x8f23('0x14e')](_0x48c52c);};};Dialer[_0x8f23('0x1a')]['syncQueueSummary']=function(_0x320802){var _0x17c56d=this;if(isNotPreview(_0x320802[_0x8f23('0x5a')])){if(isVoiceQueueOutbound(_0x320802[_0x8f23('0x4d')])&&isActive(_0x320802[_0x8f23('0x59')])){_0x320802[_0x8f23('0x9c')]=!![];BPromise[_0x8f23('0xb3')]()[_0x8f23('0xb6')](checkIsLoggedIn(_0x320802,_0x320802[_0x8f23('0x50')]))[_0x8f23('0xb6')](checkIsActive(_0x320802,_0x320802[_0x8f23('0x59')]))['then'](checkInterval(_0x320802))[_0x8f23('0xb6')](_0x17c56d[_0x8f23('0x132')](_0x320802))[_0x8f23('0xb6')](_0x17c56d[_0x8f23('0x135')](_0x320802[_0x8f23('0x14f')],_0x320802['dialTimezone'],_0x320802[_0x8f23('0x3e')],_0x320802))[_0x8f23('0xb6')](_0x17c56d[_0x8f23('0x137')](_0x320802[_0x8f23('0x42')],_0x320802['dialTimezone'],_0x320802[_0x8f23('0x3e')],_0x320802))[_0x8f23('0xb6')](_0x17c56d[_0x8f23('0x148')](_0x320802))[_0x8f23('0xae')](loggerCatchQueueSummary(_0x8f23('0x150'),_0x320802));}else{notSendMessagesQueue(_0x320802);}}else{freeVariablesPredictive(_0x320802);}};Dialer[_0x8f23('0x1a')][_0x8f23('0x131')]=function(){var _0x546302=this;var _0x41d31b;for(var _0x2028f2 in this[_0x8f23('0x1f')]){if(typeof this[_0x8f23('0x1f')][_0x2028f2]!=='undefined'){_0x41d31b=this['campaigns'][_0x2028f2];if(isCampaignIvr(_0x41d31b['type'])&&isActive(_0x41d31b[_0x8f23('0xd5')])){_0x41d31b[_0x8f23('0x9c')]=!![];BPromise[_0x8f23('0xb3')]()[_0x8f23('0xb6')](checkIsActive(_0x41d31b,_0x41d31b[_0x8f23('0xd5')]))[_0x8f23('0xb6')](checkInterval(_0x41d31b))[_0x8f23('0xb6')](_0x546302[_0x8f23('0x132')](_0x41d31b))[_0x8f23('0xb6')](_0x546302['checkIfTime'](_0x41d31b[_0x8f23('0x14f')],_0x41d31b[_0x8f23('0x151')],_0x41d31b[_0x8f23('0x3e')],_0x41d31b))['then'](_0x546302[_0x8f23('0x137')](_0x41d31b['Interval'],_0x41d31b[_0x8f23('0x151')],_0x41d31b[_0x8f23('0x3e')],_0x41d31b))[_0x8f23('0xb6')](_0x546302[_0x8f23('0x14d')](_0x41d31b))[_0x8f23('0xae')](loggerCatchQueueSummary(_0x8f23('0x152'),_0x41d31b));}else{notSendMessagesCampaign(_0x41d31b);}}}};function getCallerIdRandom(_0x20a5e0,_0x114c31){var _0x3b83c2;var _0x1d8547;var _0x2e3699;if(_0x114c31<=0x0){_0x114c31=0x1;}_0x3b83c2=new RegExp(_0x8f23('0x153')+_0x114c31+'}$');_0x1d8547=Math[_0x8f23('0x154')](0xa,_0x114c31-0x1);_0x2e3699=Math['pow'](0xa,_0x114c31)-0x1;return util['format']('%s',_[_0x8f23('0x155')](_0x20a5e0,_0x3b83c2,_[_0x8f23('0x156')](_0x1d8547,_0x2e3699)));}function extractCalleridName(_0x466167){var _0x2ae4a1=_0x466167[_0x8f23('0x157')](/"(.*?)"/);return _0x2ae4a1?_0x2ae4a1[0x1]:_0x466167;}function extractCalleridNumber(_0x3ae17c){var _0x255fd2=_0x3ae17c[_0x8f23('0x157')](/<(.*?)>/);return _0x255fd2?_0x255fd2[0x1]:_0x3ae17c;}Dialer[_0x8f23('0x1a')][_0x8f23('0x158')]=function(_0x5ecd98,_0x1cab53){var _0x449498=this;var _0x562784=uuid['v4']();this[_0x8f23('0x24')][_0x562784]=new Action(_0x5ecd98,_0x1cab53,_0x562784);return new BPromise(function(_0x362f5f,_0x22f084){if(_[_0x8f23('0x82')](_0x5ecd98)&&typeof _0x5ecd98!=='object'){return _0x22f084(msgResponse(_0x8f23('0x159'),_0x8f23('0x138'),_0x8f23('0x15a')));}if(_[_0x8f23('0x82')](_0x1cab53['Contact']['phone'])||_0x1cab53[_0x8f23('0x15b')][_0x8f23('0x15c')]===null){return _0x22f084(msgResponse(_0x8f23('0x159'),_0x8f23('0x138'),_0x8f23('0x15d')));}var _0x30a279={'XMD-CALLERID':_0x449498[_0x8f23('0x24')][_0x562784][_0x8f23('0x15e')](),'XMD-AGI':_0x5ecd98[_0x8f23('0x15f')]?util[_0x8f23('0x75')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5ecd98['dialQueueProject']):_0x8f23('0x160'),'XMD-AGIAFTER':_0x5ecd98[_0x8f23('0x106')]?util[_0x8f23('0x75')](_0x8f23('0x161'),ipAgi,_0x5ecd98[_0x8f23('0x106')]):_0x8f23('0x160'),'XMD-QUEUE':_0x5ecd98[_0x8f23('0x4d')]===_0x8f23('0x4e')?util[_0x8f23('0x75')]('\x22%s,%s%s,,,%s\x22',_0x5ecd98[_0x8f23('0x3e')],_0x5ecd98[_0x8f23('0x162')]||'',_0x5ecd98[_0x8f23('0x163')]?'c':'',_0x5ecd98['dialQueueTimeout']||0x3):_0x8f23('0x160'),'XMD-CONTACTID':_0x1cab53[_0x8f23('0xce')],'XMD-CDRTYPE':_0x8f23('0x6'),'CALLERID(all)':_0x449498[_0x8f23('0x24')][_0x562784]['getCaller'](),'XMD-AMD':_0x5ecd98[_0x8f23('0xdd')]?_0x8f23('0x164'):'NONE','XMD-DESTINATION':_0x8f23('0xdc')};if(_0x5ecd98[_0x8f23('0xdd')]){_0x30a279[_0x8f23('0x165')]=_0x5ecd98[_0x8f23('0x166')]||0x9c4;_0x30a279['XMD-AMDGREETING']=_0x5ecd98['dialAMDGreeting']||0x5dc;_0x30a279[_0x8f23('0x167')]=_0x5ecd98[_0x8f23('0x168')]||0x320;_0x30a279[_0x8f23('0x169')]=_0x5ecd98['dialAMDTotalAnalysisTime']||0x1388;_0x30a279[_0x8f23('0x16a')]=_0x5ecd98[_0x8f23('0x16b')]||0x64;_0x30a279[_0x8f23('0x16c')]=_0x5ecd98[_0x8f23('0x16d')]||0x32;_0x30a279['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x5ecd98[_0x8f23('0x16e')]||0x3;_0x30a279[_0x8f23('0x16f')]=_0x5ecd98[_0x8f23('0x170')]||0x100;_0x30a279['XMD-AMDMAXIMUMWORDLENGTH']=_0x5ecd98[_0x8f23('0x171')]||0x1388;}if(_0x5ecd98[_0x8f23('0x4d')]==='outbound'){_0x30a279['XMD-VOICEQUEUEID']=_0x1cab53[_0x8f23('0xf6')];}else{_0x30a279['XMD-CAMPAIGNID']=_0x1cab53[_0x8f23('0xd0')];}for(var _0xa3f531 in _0x1cab53[_0x8f23('0x15b')]){if(typeof _0x1cab53['Contact'][_0xa3f531]!==_0x8f23('0xc9')){if(isNotNull(_0x1cab53[_0x8f23('0x15b')][_0xa3f531])&&_0xa3f531!=='id'&&_0xa3f531!=='tags'&&_0xa3f531!==_0x8f23('0x172')&&_0xa3f531!==_0x8f23('0x173')){_0x30a279[util['format'](_0x8f23('0x174'),'XMD-',_['toUpper'](_0xa3f531))]=_0x1cab53[_0x8f23('0x15b')][_0xa3f531];}}}var _0x4140f3=_0x449498['isTrunkReachable'](_0x5ecd98[_0x8f23('0x73')])?getCallerId(_0x5ecd98[_0x8f23('0x73')][_0x8f23('0x74')],_0x5ecd98[_0x8f23('0x5b')],_0x5ecd98[_0x8f23('0x175')]>0x0?getCallerIdRandom(_0x5ecd98[_0x8f23('0x176')],_0x5ecd98['dialRandomLastDigitCallerIdNumber']):_0x5ecd98[_0x8f23('0x176')]):getCallerId(_[_0x8f23('0xaa')](_0x5ecd98[_0x8f23('0x133')])?_0x5ecd98['Trunk']['callerid']:_0x5ecd98[_0x8f23('0x133')]['callerid'],_0x5ecd98[_0x8f23('0x5b')],_0x5ecd98[_0x8f23('0x175')]>0x0?getCallerIdRandom(_0x5ecd98[_0x8f23('0x176')],_0x5ecd98[_0x8f23('0x175')]):_0x5ecd98['dialOriginateCallerIdNumber']);if(_0x4140f3){_0x30a279['XMD-ORIGINATECALLERIDNAME']=_0x449498[_0x8f23('0x24')][_0x562784][_0x8f23('0x177')]=extractCalleridName(_0x4140f3);_0x30a279[_0x8f23('0x178')]=_0x449498[_0x8f23('0x24')][_0x562784][_0x8f23('0x179')]=extractCalleridNumber(_0x4140f3);}return ami[_0x8f23('0xab')]({'actionid':_0x562784,'action':_0x8f23('0x159'),'channel':_0x449498[_0x8f23('0xd4')](_0x5ecd98['Trunk'])?util[_0x8f23('0x75')](_0x8f23('0x17a'),_0x5ecd98['Trunk']['name'],isNotNull(_0x5ecd98['dialPrefix'])?_0x5ecd98[_0x8f23('0x5d')][_0x8f23('0x17b')]()||'':'',_0x5ecd98[_0x8f23('0x17c')]>0x0?_0x1cab53[_0x8f23('0x15b')][_0x8f23('0x15c')][_0x8f23('0x17d')](_0x5ecd98[_0x8f23('0x17c')]):_0x1cab53['Contact'][_0x8f23('0x15c')]):util[_0x8f23('0x75')]('SIP/%s/%s%s',_[_0x8f23('0xaa')](_0x5ecd98['TrunkBackup'])?_0x5ecd98[_0x8f23('0x73')][_0x8f23('0x3e')]:_0x5ecd98[_0x8f23('0x133')][_0x8f23('0x3e')],isNotNull(_0x5ecd98[_0x8f23('0x5d')])?_0x5ecd98[_0x8f23('0x5d')][_0x8f23('0x17b')]()||'':'',_0x5ecd98['dialCutDigit']>0x0?_0x1cab53[_0x8f23('0x15b')]['phone'][_0x8f23('0x17d')](_0x5ecd98[_0x8f23('0x17c')]):_0x1cab53[_0x8f23('0x15b')][_0x8f23('0x15c')]),'callerid':_0x4140f3,'Exten':_0x8f23('0xdc'),'Context':_0x8f23('0x17e'),'Priority':'1','variable':_0x30a279,'timeout':(_0x5ecd98['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x562784})['then'](function(_0x4fce8f){return _0x362f5f(_0x4fce8f);})[_0x8f23('0xae')](function(_0x44c29f){_0x5ecd98['outboundOriginateFailureCallsDay']+=0x1;var _0x48bd7e=new History(_0x449498[_0x8f23('0x24')][_0x562784]);logger[_0x8f23('0x92')](util[_0x8f23('0x75')]('[originateError]:\x20%s',JSON[_0x8f23('0x48')](_0x44c29f)));_0x48bd7e['state']=0xe;_0x48bd7e['statedesc']=_0x8f23('0x17f');_0x48bd7e[_0x8f23('0xa5')]=moment()[_0x8f23('0x75')](_0x8f23('0xf4'));_0x48bd7e[_0x8f23('0xa4')]=_0x48bd7e[_0x8f23('0xa5')];_0x449498['createHistory'](_0x48bd7e)[_0x8f23('0xae')](loggerCatch(_0x8f23('0x180')));_0x449498[_0x8f23('0xc7')](_0x48bd7e)[_0x8f23('0xae')](loggerCatch(_0x8f23('0x180')))[_0x8f23('0x1c')](function(){delete _0x449498[_0x8f23('0x24')][_0x562784];return _0x22f084(msgResponse(_0x8f23('0x159'),_0x8f23('0x181'),_0x8f23('0x182')));});});});};Dialer[_0x8f23('0x1a')][_0x8f23('0x30')]=function(_0x456b4b){var _0x42f092=this[_0x8f23('0x24')][_0x456b4b[_0x8f23('0x11e')]];if(_0x42f092){delete this[_0x8f23('0x24')][_0x456b4b['actionid']];_0x42f092[_0x8f23('0x10b')]=moment()[_0x8f23('0x75')](_0x8f23('0xf4'));var _0x2b7e9c=_0x42f092[_0x8f23('0x4d')]===_0x8f23('0x77')?this[_0x8f23('0x1f')][_0x42f092[_0x8f23('0xb0')]]:this['voiceQueues'][_0x42f092[_0x8f23('0x183')]()];if(!this[_0x8f23('0xd3')](_0x456b4b[_0x8f23('0x184')])){this['updateOriginated'](_0x2b7e9c);return this[_0x8f23('0x185')](_0x42f092,_0x2b7e9c,_0x456b4b)[_0x8f23('0xae')](loggerCatch(_0x8f23('0x186')));}this[_0x8f23('0x26')][_0x456b4b[_0x8f23('0xdf')]]=_0x42f092;}};Dialer[_0x8f23('0x1a')][_0x8f23('0x187')]=function(_0x5dfacb,_0x7269dd,_0x120ece){var _0x305ee3=new History(_0x7269dd);if(_0x305ee3[_0x8f23('0xe9')]+_0x305ee3['countcongestionretry']+_0x305ee3[_0x8f23('0xeb')]+_0x305ee3[_0x8f23('0x188')]+_0x305ee3['countdropretry']+_0x305ee3[_0x8f23('0xed')]+_0x305ee3[_0x8f23('0xe7')]+_0x305ee3[_0x8f23('0xee')]>=_0x120ece[_0x8f23('0xfb')]-0x1){return!![];}switch(_0x5dfacb){case 0x3:if(_0x305ee3['countnoanswerretry']>=_0x120ece['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x8f23('0xbd')]({'active':![],'countnoanswerretry':_0x305ee3[_0x8f23('0xeb')]+=0x1,'scheduledat':moment()[_0x8f23('0xf2')](_0x120ece[_0x8f23('0x189')],'minutes')['format'](_0x8f23('0xf4')),'ContactId':_0x305ee3[_0x8f23('0xce')],'ListId':_0x305ee3[_0x8f23('0xf5')],'VoiceQueueId':_0x305ee3[_0x8f23('0xf6')]||undefined,'CampaignId':_0x305ee3['CampaignId']||undefined})[_0x8f23('0xae')](loggerCatch(_0x8f23('0x18a')));break;case 0x5:if(_0x305ee3[_0x8f23('0xe9')]>=_0x120ece['dialBusyMaxRetry']-0x1){return!![];}this[_0x8f23('0xbd')]({'active':![],'countbusyretry':_0x305ee3[_0x8f23('0xe9')]+=0x1,'scheduledat':moment()[_0x8f23('0xf2')](_0x120ece[_0x8f23('0x18b')],'minutes')[_0x8f23('0x75')](_0x8f23('0xf4')),'ContactId':_0x305ee3[_0x8f23('0xce')],'ListId':_0x305ee3['ListId'],'VoiceQueueId':_0x305ee3['VoiceQueueId']||undefined,'CampaignId':_0x305ee3['CampaignId']||undefined})[_0x8f23('0xae')](loggerCatch(_0x8f23('0x18c')));break;case 0x8:if(_0x305ee3['countcongestionretry']>=_0x120ece[_0x8f23('0x18d')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x305ee3[_0x8f23('0xea')]+=0x1,'scheduledat':moment()[_0x8f23('0xf2')](_0x120ece[_0x8f23('0x18e')],'minutes')[_0x8f23('0x75')](_0x8f23('0xf4')),'ContactId':_0x305ee3[_0x8f23('0xce')],'ListId':_0x305ee3[_0x8f23('0xf5')],'VoiceQueueId':_0x305ee3[_0x8f23('0xf6')]||undefined,'CampaignId':_0x305ee3[_0x8f23('0xd0')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x305ee3[_0x8f23('0x188')]>=_0x120ece[_0x8f23('0x18f')]-0x1){return!![];}else{this[_0x8f23('0xbd')]({'active':![],'countnosuchnumberretry':_0x305ee3[_0x8f23('0x188')]+=0x1,'scheduledat':moment()[_0x8f23('0xf2')](_0x120ece[_0x8f23('0x190')],_0x8f23('0xf3'))[_0x8f23('0x75')](_0x8f23('0xf4')),'ContactId':_0x305ee3['ContactId'],'ListId':_0x305ee3['ListId'],'VoiceQueueId':_0x305ee3[_0x8f23('0xf6')]||undefined,'CampaignId':_0x305ee3[_0x8f23('0xd0')]||undefined})[_0x8f23('0xae')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x305ee3[_0x8f23('0xec')]>=_0x120ece[_0x8f23('0x10e')]-0x1){return!![];}this[_0x8f23('0xbd')]({'active':![],'countdropretry':_0x305ee3[_0x8f23('0xec')]+=0x1,'scheduledat':moment()[_0x8f23('0xf2')](_0x120ece[_0x8f23('0x191')],_0x8f23('0xf3'))[_0x8f23('0x75')](_0x8f23('0xf4')),'ContactId':_0x305ee3[_0x8f23('0xce')],'ListId':_0x305ee3[_0x8f23('0xf5')],'VoiceQueueId':_0x305ee3[_0x8f23('0xf6')]||undefined,'CampaignId':_0x305ee3[_0x8f23('0xd0')]||undefined})['catch'](loggerCatch(_0x8f23('0x10f')));break;case 0xb:if(_0x305ee3[_0x8f23('0xed')]>=_0x120ece[_0x8f23('0x116')]-0x1){return!![];}this[_0x8f23('0xbd')]({'active':![],'countabandonedretry':_0x305ee3['countabandonedretry']+=0x1,'scheduledat':moment()[_0x8f23('0xf2')](_0x120ece[_0x8f23('0x117')],'minutes')[_0x8f23('0x75')](_0x8f23('0xf4')),'ContactId':_0x305ee3[_0x8f23('0xce')],'ListId':_0x305ee3[_0x8f23('0xf5')],'VoiceQueueId':_0x305ee3[_0x8f23('0xf6')]||undefined,'CampaignId':_0x305ee3['CampaignId']||undefined})['catch'](loggerCatch(_0x8f23('0x118')));break;case 0x13:if(_0x305ee3[_0x8f23('0xe7')]>=_0x120ece[_0x8f23('0xef')]-0x1){return!![];}this[_0x8f23('0xbd')]({'active':![],'countmachineretry':_0x305ee3[_0x8f23('0xe7')]+=0x1,'scheduledat':moment()['add'](_0x120ece[_0x8f23('0xfd')],_0x8f23('0xf3'))[_0x8f23('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x305ee3[_0x8f23('0xce')],'ListId':_0x305ee3[_0x8f23('0xf5')],'VoiceQueueId':_0x305ee3['VoiceQueueId']||undefined,'CampaignId':_0x305ee3[_0x8f23('0xd0')]||undefined})[_0x8f23('0xae')](loggerCatch(_0x8f23('0xf7')));break;case 0x14:if(_0x305ee3[_0x8f23('0xee')]>=_0x120ece[_0x8f23('0x192')]-0x1){return!![];}this[_0x8f23('0xbd')]({'active':![],'countagentrejectretry':_0x305ee3[_0x8f23('0xee')]+=0x1,'scheduledat':moment()[_0x8f23('0xf2')](_0x120ece[_0x8f23('0x193')],'minutes')[_0x8f23('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x305ee3[_0x8f23('0xce')],'ListId':_0x305ee3[_0x8f23('0xf5')],'VoiceQueueId':_0x305ee3['VoiceQueueId']||undefined,'CampaignId':_0x305ee3[_0x8f23('0xd0')]||undefined})[_0x8f23('0xae')](loggerCatch(_0x8f23('0x194')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x6e9fd1,_0x35f0f5,_0x2d0cee){var _0x50d402=this;var _0x14aa43=new History(_0x6e9fd1);return new BPromise(function(_0x1e9334,_0x43b51f){if(_[_0x8f23('0x82')](_0x35f0f5)&&typeof _0x35f0f5!==_0x8f23('0x195')){return _0x43b51f(msgResponse(_0x8f23('0x196'),_0x8f23('0x138'),'entity\x20is\x20undefine'));}if(_[_0x8f23('0x82')](_0x2d0cee)&&typeof _0x2d0cee!==_0x8f23('0x195')){return _0x43b51f(msgResponse(_0x8f23('0x196'),_0x8f23('0x138'),_0x8f23('0x197')));}switch(_0x2d0cee[_0x8f23('0x198')]){case'0':_0x35f0f5[_0x8f23('0x67')]+=0x1;_0x14aa43['state']=0x0;_0x14aa43['statedesc']='NoSuchNumber';_0x14aa43[_0x8f23('0x188')]+=0x1;_0x14aa43[_0x8f23('0xe8')]+=0x1;ami['emit'](_0x8f23('0x199'),ut[_0x8f23('0xe3')](_0x6e9fd1,'nosuchnumber'));_0x50d402[_0x8f23('0xda')](_0x14aa43)[_0x8f23('0xae')](loggerCatch(_0x8f23('0x19a')));if(_0x50d402[_0x8f23('0x187')](0x0,_0x6e9fd1,_0x35f0f5)){if(_0x14aa43[_0x8f23('0x188')]>=_0x35f0f5['dialNoSuchNumberMaxRetry']){_0x50d402[_0x8f23('0xf0')](_0x14aa43,_0x1e9334,_0x43b51f,_0x8f23('0x19b'));}else{_0x50d402[_0x8f23('0xfc')](_0x14aa43,_0x1e9334,_0x43b51f,_0x8f23('0x19b'));}}break;case'3':_0x35f0f5[_0x8f23('0x66')]+=0x1;_0x14aa43['state']=0x3;_0x14aa43[_0x8f23('0xa3')]=_0x8f23('0x19c');_0x14aa43['countnoanswerretry']+=0x1;_0x14aa43['countglobal']+=0x1;ami[_0x8f23('0x4c')]('custom:agentnoanswer',ut[_0x8f23('0xe3')](_0x6e9fd1,_0x8f23('0x19d')));_0x50d402[_0x8f23('0xda')](_0x14aa43)[_0x8f23('0xae')](loggerCatch(_0x8f23('0x19e')));if(_0x50d402['checkRetriveMax'](0x3,_0x6e9fd1,_0x35f0f5)){if(_0x14aa43[_0x8f23('0xeb')]>=_0x35f0f5[_0x8f23('0x19f')]){_0x50d402[_0x8f23('0xf0')](_0x14aa43,_0x1e9334,_0x43b51f,_0x8f23('0x1a0'));}else{_0x50d402['stateGlobal'](_0x14aa43,_0x1e9334,_0x43b51f,_0x8f23('0x1a0'));}}break;case'5':_0x35f0f5[_0x8f23('0x61')]+=0x1;_0x14aa43['state']=0x5;_0x14aa43[_0x8f23('0xa3')]=_0x8f23('0x1a1');_0x14aa43[_0x8f23('0xe9')]+=0x1;_0x14aa43[_0x8f23('0xe8')]+=0x1;ami[_0x8f23('0x4c')]('custom:agentbusy',ut[_0x8f23('0xe3')](_0x6e9fd1,_0x8f23('0x1a2')));_0x50d402[_0x8f23('0xda')](_0x14aa43)[_0x8f23('0xae')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x50d402[_0x8f23('0x187')](0x5,_0x6e9fd1,_0x35f0f5)){if(_0x14aa43['countbusyretry']>=_0x35f0f5['dialBusyMaxRetry']){_0x50d402[_0x8f23('0xf0')](_0x14aa43,_0x1e9334,_0x43b51f,_0x8f23('0x1a3'));}else{_0x50d402[_0x8f23('0xfc')](_0x14aa43,_0x1e9334,_0x43b51f,_0x8f23('0x1a3'));}}break;case'8':_0x35f0f5['outboundCongestionCallsDay']+=0x1;_0x14aa43[_0x8f23('0xa2')]=0x8;_0x14aa43[_0x8f23('0xa3')]='Congestion';_0x14aa43[_0x8f23('0xea')]+=0x1;_0x14aa43[_0x8f23('0xe8')]+=0x1;ami[_0x8f23('0x4c')]('custom:agentcongestion',ut[_0x8f23('0xe3')](_0x6e9fd1,_0x8f23('0x1a4')));_0x50d402[_0x8f23('0xda')](_0x14aa43)['catch'](loggerCatch(_0x8f23('0x1a5')));if(_0x50d402[_0x8f23('0x187')](0x8,_0x6e9fd1,_0x35f0f5)){if(_0x14aa43[_0x8f23('0xea')]>=_0x35f0f5[_0x8f23('0x18d')]){_0x50d402[_0x8f23('0xf0')](_0x14aa43,_0x1e9334,_0x43b51f,'reason\x208\x20congestion');}else{_0x50d402[_0x8f23('0xfc')](_0x14aa43,_0x1e9334,_0x43b51f,'reason\x208\x20congestion');}}break;case'11':_0x35f0f5[_0x8f23('0x1a6')]+=0x1;_0x14aa43[_0x8f23('0xa2')]=0xb;_0x14aa43['statedesc']='Abandoned';_0x14aa43[_0x8f23('0xed')]+=0x1;_0x14aa43[_0x8f23('0xe8')]+=0x1;_0x50d402[_0x8f23('0xda')](_0x14aa43)[_0x8f23('0xae')](loggerCatch(_0x8f23('0x119')));if(_0x50d402[_0x8f23('0x187')](0xb,_0x6e9fd1,_0x35f0f5)){if(_0x14aa43['countabandonedretry']>=_0x35f0f5[_0x8f23('0x116')]){_0x50d402[_0x8f23('0xf0')](_0x14aa43,_0x1e9334,_0x43b51f,'reason\x2011\x20abandoned');}else{_0x50d402[_0x8f23('0xfc')](_0x14aa43,_0x1e9334,_0x43b51f,'reason\x2011\x20abandoned');}}break;case'20':_0x35f0f5['outboundRejectCallsDay']+=0x1;_0x14aa43[_0x8f23('0xa2')]=0x14;_0x14aa43['statedesc']=_0x8f23('0x1a7');_0x14aa43['countagentrejectretry']+=0x1;_0x14aa43[_0x8f23('0xe8')]+=0x1;ami['emit'](_0x8f23('0x1a8'),ut[_0x8f23('0xe3')](_0x6e9fd1,_0x8f23('0x1a9')));_0x50d402['createHistory'](_0x14aa43)[_0x8f23('0xae')](loggerCatch(_0x8f23('0x1aa')));if(_0x50d402[_0x8f23('0x187')](0x14,_0x6e9fd1,_0x35f0f5)){if(_0x14aa43['countagentrejectretry']>=_0x35f0f5[_0x8f23('0x192')]){_0x50d402[_0x8f23('0xf0')](_0x14aa43,_0x1e9334,_0x43b51f,_0x8f23('0x1ab'));}else{_0x50d402[_0x8f23('0xfc')](_0x14aa43,_0x1e9334,_0x43b51f,'reason\x2020\x20agentreject');}}break;default:_0x35f0f5['outboundUnknownCallsDay']+=0x1;_0x14aa43[_0x8f23('0xa2')]=0xc;_0x14aa43['statedesc']=_0x2d0cee[_0x8f23('0x198')];_0x50d402[_0x8f23('0xda')](_0x14aa43)[_0x8f23('0xae')](loggerCatch(_0x8f23('0x1ac')));if(_0x50d402[_0x8f23('0x187')](_0x2d0cee[_0x8f23('0x198')],_0x6e9fd1,_0x35f0f5)){if(_0x14aa43[_0x8f23('0xe9')]+_0x14aa43[_0x8f23('0xea')]+_0x14aa43[_0x8f23('0xeb')]+_0x14aa43[_0x8f23('0x188')]+_0x14aa43['countdropretry']+_0x14aa43[_0x8f23('0xed')]+_0x14aa43[_0x8f23('0xe7')]+_0x14aa43['countagentrejectretry']>=_0x35f0f5[_0x8f23('0xfb')]){_0x50d402['stateGlobal'](_0x14aa43,_0x1e9334,_0x43b51f,_0x2d0cee[_0x8f23('0x198')]);}else{_0x50d402[_0x8f23('0xf0')](_0x14aa43,_0x1e9334,_0x43b51f,_0x2d0cee[_0x8f23('0x198')]);}}}});};Dialer[_0x8f23('0x1a')][_0x8f23('0xfc')]=function(_0x523fb4,_0x3ff8c2,_0x1ccf9e,_0x316fa6){var _0x59d668=new Final(_0x523fb4);_0x59d668['state']=0xf;_0x59d668[_0x8f23('0xa3')]='Global';this[_0x8f23('0xf0')](_0x59d668,_0x3ff8c2,_0x1ccf9e,_0x316fa6);};Dialer['prototype']['createStateFinal']=function(_0xa227b6,_0x5d1b46,_0x131d02,_0x4eb664){this['moveContactManagedDialer'](_0xa227b6)[_0x8f23('0xb6')](function(){return _0x5d1b46(msgResponse(_0x8f23('0x196'),'Success',_0x4eb664));})['catch'](function(){return _0x131d02(msgResponse(_0x8f23('0x1ad'),'Failure',_0x8f23('0x1ae')));});};Dialer[_0x8f23('0x1a')]['predictive']=function(_0x217eae){var _0x5a47b8=_0x217eae[_0x8f23('0x1af')]/0x64;var _0xc977f5=_0x217eae[_0x8f23('0x65')]/(_0x217eae['outboundDropCallsDayTimeout']+_0x217eae['outboundAnswerCallsDay']);var _0x374c11=Math[_0x8f23('0x1b0')](_0x217eae[_0x8f23('0x1b1')]*(_0x217eae['predictiveIntervalMaxThreshold']/0x64));var _0x5b896b=Math['round'](_0x217eae[_0x8f23('0x1b1')]*(_0x217eae[_0x8f23('0x1b2')]/0x64));var _0x5051cc=_0x217eae[_0x8f23('0x4f')]+_0x217eae['talking'];var _0x5993f7=Math[_0x8f23('0x1b3')](_0x217eae[_0x8f23('0x86')]*_0x217eae[_0x8f23('0x89')]*_0x217eae[_0x8f23('0x1b4')]*_0x217eae['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x217eae[_0x8f23('0x8d')])){if(!_[_0x8f23('0x82')](_0x217eae['startPredictive'])){_0x217eae[_0x8f23('0x28')]=undefined;loggerPredictive[_0x8f23('0x92')](_0x8f23('0x1b5'),_0x8f23('0x1b6'));}if(!_[_0x8f23('0x82')](_0x217eae['handlePredictive'])){loggerPredictive[_0x8f23('0x92')](_0x8f23('0x1b5'),_0x8f23('0x1b7'));clearInterval(_0x217eae[_0x8f23('0x8f')]);_0x217eae[_0x8f23('0x8f')]=undefined;}_0x217eae[_0x8f23('0x8d')]=moment()[_0x8f23('0x75')](_0x8f23('0xf4'));loggerPredictive[_0x8f23('0x7a')](_0x217eae[_0x8f23('0x3e')],'collection\x20data\x20in\x20progressive\x20at',_0x217eae[_0x8f23('0x8d')]);this[_0x8f23('0x14a')](_0x217eae,0x1);}else if(ifInterval(_0x217eae[_0x8f23('0x1b8')],_0x217eae['startProgressive'])){this['handlePower'](_0x217eae,0x1);loggerPredictiveCalls[_0x8f23('0x7a')](_0x8f23('0x1b9'),_0x217eae[_0x8f23('0x8d')],_0x217eae[_0x8f23('0x3e')]);_0x217eae[_0x8f23('0x86')]=0x0;_0x217eae[_0x8f23('0x10d')]=0x0;}else if(_0x5a47b8<_0xc977f5&&_0x217eae[_0x8f23('0x1ba')]===_0x8f23('0x1bb')){freeVariablesPredictive(_0x217eae);loggerPredictive[_0x8f23('0x7a')](_0x8f23('0x1bc'),_0x8f23('0x1bd'),_0xc977f5,_0x8f23('0x8d'),_0x217eae['name']);}else if(_0x5993f7<_0x217eae[_0x8f23('0x10d')]&&_0x217eae[_0x8f23('0x1ba')]===_0x8f23('0x1bb')){freeVariablesPredictive(_0x217eae);loggerPredictive[_0x8f23('0x7a')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x8f23('0x1be'),_0x5993f7,_0x8f23('0x1bf'),_0x217eae[_0x8f23('0x10d')],_0x8f23('0x8d'),_0x217eae[_0x8f23('0x3e')]);}else if(!ifInterval(_0x217eae['dialPredictiveInterval'],_0x217eae[_0x8f23('0x8d')])&&_[_0x8f23('0x82')](_0x217eae[_0x8f23('0x28')])&&!_[_0x8f23('0x82')](_0x217eae[_0x8f23('0x8d')])){_0x217eae[_0x8f23('0x28')]=moment()['format'](_0x8f23('0xf4'));loggerPredictive[_0x8f23('0x7a')](_0x217eae[_0x8f23('0x3e')],_0x8f23('0x1c0'),_0x217eae['startPredictive']);this[_0x8f23('0xba')](_0x217eae[_0x8f23('0x1b8')])[_0x8f23('0xb6')](this[_0x8f23('0x1c1')](_0x217eae))[_0x8f23('0xb6')](mergeDataErlangB(_0x217eae))[_0x8f23('0xb6')](this[_0x8f23('0x1c2')](_0x217eae))[_0x8f23('0xae')](loggerCatchPredictive(_0x8f23('0x1c3'),_0x217eae));}else if(!ifInterval(_0x217eae[_0x8f23('0x1b8')],_0x217eae[_0x8f23('0x28')])){_0x217eae[_0x8f23('0x10d')]=0x0;_0x217eae[_0x8f23('0x28')]=moment()['format'](_0x8f23('0xf4'));loggerPredictive[_0x8f23('0x7a')](_0x217eae[_0x8f23('0x3e')],_0x8f23('0x1c4'),_0x217eae['startPredictive']);clearInterval(_0x217eae[_0x8f23('0x8f')]);_0x217eae[_0x8f23('0x8f')]=undefined;this[_0x8f23('0xba')](_0x217eae['dialPredictiveInterval'])[_0x8f23('0xb6')](this[_0x8f23('0x1c1')](_0x217eae))[_0x8f23('0xb6')](mergeDataErlangB(_0x217eae))[_0x8f23('0xb6')](this[_0x8f23('0x1c2')](_0x217eae))[_0x8f23('0xae')](loggerCatchPredictive(_0x8f23('0x1c5'),_0x217eae));}else if(_0x217eae[_0x8f23('0x1b1')]&&_0x5051cc<_0x217eae[_0x8f23('0x1b1')]-_0x5b896b){freeVariablesPredictive(_0x217eae);loggerPredictive[_0x8f23('0x7a')](_0x217eae['name'],_0x8f23('0x1c6'),_0x5051cc,_0x8f23('0x1c7'),_0x217eae['predictiveIntervalAvailable'],'-',_0x5b896b,'=',_0x217eae[_0x8f23('0x1b1')]-_0x5b896b,')');}else if(_0x217eae[_0x8f23('0x1b1')]&&_0x5051cc>_0x217eae['predictiveIntervalAvailable']+_0x374c11){freeVariablesPredictive(_0x217eae);loggerPredictive[_0x8f23('0x7a')](_0x217eae[_0x8f23('0x3e')],_0x8f23('0x1c6'),_0x5051cc,_0x8f23('0x1c8'),_0x217eae['predictiveIntervalAvailable'],'+',_0x374c11,'=',_0x217eae['predictiveIntervalAvailable']+_0x374c11,')');}};Dialer[_0x8f23('0x1a')][_0x8f23('0x1c1')]=function(_0x493c93){var _0x3538d8=this;return function(_0x5702a0){return new BPromise(function(_0x3e1406,_0x1e750e){_[_0x8f23('0x8c')](_0x493c93,_0x5702a0[0x0]);if(checkGetDataPredictive(_0x5702a0[0x0])){var _0x150231=_0x493c93[_0x8f23('0x1b1')]=_0x493c93[_0x8f23('0x54')]+_0x493c93[_0x8f23('0x4f')];var _0x5c58b1=_0x493c93[_0x8f23('0x1b8')]*0x3c;var _0x495512=_0x5702a0[0x0]['predictiveIntervalAvgTalktime']+_0x5702a0[0x0][_0x8f23('0x6c')];var _0x576aa4=(_0x5702a0[0x0][_0x8f23('0x6b')]+_0x5702a0[0x0][_0x8f23('0x7d')]+_0x5702a0[0x0][_0x8f23('0x6d')])/_0x5702a0[0x0][_0x8f23('0x70')];_0x493c93[_0x8f23('0x1b4')]=_0x576aa4>0x0?_0x576aa4:0x1;switch(_0x493c93['dialPredictiveOptimization']){case _0x8f23('0x1bb'):var _0x1f8920=_0x493c93[_0x8f23('0x1af')]/0x64;return _0x3538d8[_0x8f23('0x1c9')](_0x150231,_0x5c58b1,_0x495512,_0x576aa4,_0x1f8920)[_0x8f23('0xb6')](function(_0x163c07){return _0x3e1406(_0x163c07);});case _0x8f23('0x1ca'):var _0x2e6199=_0x493c93[_0x8f23('0x1af')]/0x64;return _0x3538d8[_0x8f23('0x1cb')](_0x150231,_0x5c58b1,_0x495512,_0x576aa4,_0x2e6199)['then'](function(_0x155d38){return _0x3e1406(_0x155d38);});default:return _0x1e750e(msgResponse(_0x8f23('0x1cc'),_0x8f23('0x138'),_0x8f23('0x1cd')));}}else{return _0x1e750e(msgResponse(_0x8f23('0x1cc'),_0x8f23('0x138'),_0x8f23('0x1ce')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x4ae8d7){var _0x504e00=this;return function(_0x455ac1){return new BPromise(function(_0x452f55,_0x278aa8){_[_0x8f23('0x8c')](_0x4ae8d7,_0x455ac1[0x0]);if(checkGetDataPredictive(_0x455ac1[0x0])){loggerPredictive[_0x8f23('0x7a')](JSON[_0x8f23('0x48')](_0x455ac1[0x0]));if(_0x4ae8d7[_0x8f23('0x1ba')]===_0x8f23('0x1bb')){return _0x504e00[_0x8f23('0xc5')](_0x4ae8d7['id'])[_0x8f23('0xb6')](function(_0x46346e){var _0x42542c=_0x4ae8d7[_0x8f23('0x50')]-_0x46346e[0x0]['outboundQueuePauses'];var _0x79269c=_0x4ae8d7[_0x8f23('0x1b8')]*0x3c;var _0x874a4d=_0x455ac1[0x0][_0x8f23('0x81')]+_0x455ac1[0x0][_0x8f23('0x6c')];var _0x251f5d=(_0x455ac1[0x0][_0x8f23('0x6b')]+_0x455ac1[0x0][_0x8f23('0x7d')]+_0x455ac1[0x0][_0x8f23('0x6d')])/_0x455ac1[0x0][_0x8f23('0x70')];var _0xf62827=_0x4ae8d7[_0x8f23('0x1af')]/0x64;_0x4ae8d7[_0x8f23('0x6f')]=_0x46346e[0x0][_0x8f23('0x1cf')]||0x0;_0x4ae8d7[_0x8f23('0x1b4')]=_0x251f5d>0x0?_0x251f5d:0x1;return _0x504e00[_0x8f23('0x1c9')](_0x42542c,_0x79269c,_0x874a4d,_0x251f5d,_0xf62827);})[_0x8f23('0xb6')](function(_0x58f162){return _0x452f55(_0x58f162);})[_0x8f23('0xae')](function(_0x5a6413){return _0x278aa8(msgResponse(_0x8f23('0x1d0'),_0x8f23('0x138'),JSON[_0x8f23('0x48')](_0x5a6413)));});}if(_0x4ae8d7[_0x8f23('0x1ba')]===_0x8f23('0x1ca')){return _0x504e00[_0x8f23('0xc5')](_0x4ae8d7['id'])[_0x8f23('0xb6')](function(_0xafdfda){var _0x4cb214=_0x4ae8d7[_0x8f23('0x50')]-_0xafdfda[0x0][_0x8f23('0x1cf')];var _0x151990=_0x4ae8d7[_0x8f23('0x1b8')]*0x3c;var _0x38ecdb=_0x455ac1[0x0][_0x8f23('0x81')]+_0x455ac1[0x0][_0x8f23('0x6c')];var _0x3f5e9c=(_0x455ac1[0x0]['predictiveIntervalAnsweredCalls']+_0x455ac1[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x455ac1[0x0][_0x8f23('0x6d')])/_0x455ac1[0x0][_0x8f23('0x70')];var _0x75b72c=_0x4ae8d7[_0x8f23('0x1af')]/0x64;_0x4ae8d7[_0x8f23('0x6f')]=_0xafdfda[0x0]['outboundQueuePauses']||0x0;_0x4ae8d7['predictiveIntervalHitRate']=_0x3f5e9c>0x0?_0x3f5e9c:0x1;return _0x504e00['busyFactor'](_0x4cb214,_0x151990,_0x38ecdb,_0x3f5e9c,_0x75b72c);})[_0x8f23('0xb6')](function(_0x152d34){return _0x452f55(_0x152d34);})[_0x8f23('0xae')](function(_0x1278f0){return _0x278aa8(msgResponse(_0x8f23('0x1d0'),'Failure',JSON[_0x8f23('0x48')](_0x1278f0)));});}}else{return _0x278aa8(msgResponse(_0x8f23('0x1cc'),_0x8f23('0x138'),_0x8f23('0x1ce')));}});};};Dialer[_0x8f23('0x1a')][_0x8f23('0x1c2')]=function(_0x570de5){var _0x4fffb0=this;return function(){var _0x5de366=0x0;var _0x3acb4c=Math['floor'](_0x570de5[_0x8f23('0x87')]*0x3e8);if(_0x3acb4c>0x0){_0x3acb4c=_0x3acb4c<0x64?0x64:_0x3acb4c;loggerPredictive['info'](_0x570de5[_0x8f23('0x3e')],'one\x20call\x20every:',_0x3acb4c,'milliseconds');_0x570de5[_0x8f23('0x8f')]=setInterval(function(){_0x4fffb0[_0x8f23('0x8f')](_0x570de5);loggerPredictiveCalls['info'](_0x8f23('0x1d1'),_0x5de366+=0x1);},_0x3acb4c);}else{loggerPredictive[_0x8f23('0x7a')](_0x570de5['name'],_0x8f23('0x1d2'));}};};Dialer[_0x8f23('0x1a')][_0x8f23('0x1d3')]=function(_0x3b1aac,_0x4d2327){var _0xb393d6=this;return function(_0x4c650b){if(_[_0x8f23('0x45')](_0x4c650b)){if(_[_0x8f23('0xaa')](_0x4d2327[_0x8f23('0xcf')])||!_0x4d2327[_0x8f23('0x1d4')]){if(_0x3b1aac['dialMethod']===_0x8f23('0x7')){_0x3b1aac[_0x8f23('0x123')]=_[_0x8f23('0x82')](_0x3b1aac['queueStatusComplete'])?!![]:_0x3b1aac[_0x8f23('0x123')];var _0x4f850e=uuid['v4']();_0xb393d6[_0x8f23('0x24')][_0x4f850e]=new Action(_0x3b1aac,_0x4d2327,_0x4f850e);loggerBooked['info']('[booked][checkContactBlack]',_0x4f850e,_0x8f23('0x1d5'),JSON['stringify'](_0x3b1aac[_0x8f23('0x123')]),_0x8f23('0x1d6'),_0x3b1aac['name']);if(_0x3b1aac['queueStatusComplete']){_0x3b1aac[_0x8f23('0x123')]=![];_0xb393d6[_0x8f23('0x120')][_0xb393d6['actions'][_0x4f850e]['queue']]=[];ami[_0x8f23('0xab')]({'actionid':_0x4f850e,'action':_0x8f23('0x1d7'),'queue':_0x3b1aac['name']})[_0x8f23('0xae')](function(){_0xb393d6[_0x8f23('0xaf')](_0x3b1aac);_0xb393d6['rescheduleContact']({'active':![],'ContactId':_0xb393d6['actions'][_0x4f850e][_0x8f23('0xce')],'ListId':_0xb393d6[_0x8f23('0x24')][_0x4f850e][_0x8f23('0xf5')],'VoiceQueueId':_0xb393d6[_0x8f23('0x24')][_0x4f850e]['VoiceQueueId']||undefined,'CampaignId':_0xb393d6[_0x8f23('0x24')][_0x4f850e]['CampaignId']||undefined})['catch'](loggerCatch(_0x8f23('0x1d8')));delete _0xb393d6[_0x8f23('0x24')][_0x4f850e];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x8f23('0x48')](_0x3b1aac[_0x8f23('0x123')]),'Queue:\x20',_0x3b1aac[_0x8f23('0x3e')]);_0xb393d6['updateOriginated'](_0x3b1aac);_0xb393d6[_0x8f23('0xbd')]({'active':![],'ContactId':_0xb393d6[_0x8f23('0x24')][_0x4f850e][_0x8f23('0xce')],'ListId':_0xb393d6[_0x8f23('0x24')][_0x4f850e][_0x8f23('0xf5')],'VoiceQueueId':_0xb393d6['actions'][_0x4f850e][_0x8f23('0xf6')]||undefined,'CampaignId':_0xb393d6['actions'][_0x4f850e][_0x8f23('0xd0')]||undefined})[_0x8f23('0xae')](loggerCatch(_0x8f23('0x1d8')));delete _0xb393d6[_0x8f23('0x24')][_0x4f850e];}}else{return _0xb393d6[_0x8f23('0x158')](_0x3b1aac,_0x4d2327);}}else{if(getDiff(_0x4d2327[_0x8f23('0x1d9')])<_0x3b1aac['dialRecallMeTimeout']*0x3c){if(_0x4d2327[_0x8f23('0x1da')]&&!_0x4d2327['Agent'][_0x8f23('0x1db')]){_0xb393d6[_0x8f23('0x90')][_0x8f23('0x126')](_0x4d2327['id'])[_0x8f23('0x1c')](function(){_0xb393d6[_0x8f23('0xaf')](_0x3b1aac);});}else{_0xb393d6[_0x8f23('0xbf')]({'active':![]},_0x4d2327['id'],0x1)[_0x8f23('0x1c')](function(){_0xb393d6[_0x8f23('0xaf')](_0x3b1aac);});}}else{_0x3b1aac[_0x8f23('0x68')]+=0x1;_0xb393d6[_0x8f23('0xaf')](_0x3b1aac);if(_0x3b1aac[_0x8f23('0x1dc')]){_0xb393d6[_0x8f23('0xbd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4d2327[_0x8f23('0xce')],'ListId':_0x4d2327[_0x8f23('0xf5')],'VoiceQueueId':_0x4d2327['VoiceQueueId']||undefined,'CampaignId':_0x4d2327[_0x8f23('0xd0')]||undefined})[_0x8f23('0xae')](loggerCatch(_0x8f23('0x1dd')));_0xb393d6[_0x8f23('0xda')](createObjHistory(_0x3b1aac,_0x4d2327,_0x8f23('0x1de'),0x17,_0x8f23('0x1df')))[_0x8f23('0xae')](loggerCatch(_0x8f23('0x1e0')));}else{_0xb393d6[_0x8f23('0xd9')](createObjHistory(_0x3b1aac,_0x4d2327,_0x8f23('0x1e1'),0x16,_0x8f23('0x1e2')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x3b1aac[_0x8f23('0x60')]+=0x1;_0xb393d6['saveInDb'](createObjHistory(_0x3b1aac,_0x4d2327,_0x8f23('0x1e3'),0xd,'Blacklist'),_0x8f23('0x1e4'),_0x8f23('0x1e5'));throw _0x8f23('0x1e6');}};};Dialer[_0x8f23('0x1a')]['handleIvr']=function(_0x40f9ef){var _0x3c85b2=this;var _0x3c4cd9=_0x40f9ef[_0x8f23('0x1e7')]-_0x40f9ef[_0x8f23('0x71')]-_0x40f9ef[_0x8f23('0xc2')];emitCampaignSummary(_0x40f9ef);if(_0x3c4cd9>0x0){if(_0x3c4cd9>this[_0x8f23('0x22')]){_0x3c4cd9=this[_0x8f23('0x22')];}_0x40f9ef['temp']+=_0x3c4cd9;this[_0x8f23('0xc4')](_0x40f9ef['id'],_0x3c4cd9,_0x40f9ef[_0x8f23('0x1e8')],_0x40f9ef)[_0x8f23('0xb6')](function(_0x1e2f15){_0x40f9ef['temp']-=_0x3c4cd9;_0x40f9ef[_0x8f23('0xc2')]=_0x40f9ef['temp']>0x0?_0x40f9ef[_0x8f23('0xc2')]:0x0;if(!checkContactEmpty(_0x1e2f15)){_0x40f9ef[_0x8f23('0x3f')]=_0x8f23('0x9a');logger[_0x8f23('0x7a')](_0x8f23('0x1e9')+_0x40f9ef[_0x8f23('0x3e')]);}else{_0x40f9ef['originated']+=_0x1e2f15['length'];_0x40f9ef[_0x8f23('0x3f')]='RUNNING';for(var _0x14b59f=0x0;_0x14b59f<_0x1e2f15['length'];_0x14b59f+=0x1){_0x40f9ef[_0x8f23('0x1ea')]+=0x1;if(_['isNil'](_0x1e2f15[_0x14b59f])||_['isNil'](_0x1e2f15[_0x14b59f][_0x8f23('0x15b')])||_[_0x8f23('0xaa')](_0x1e2f15[_0x14b59f][_0x8f23('0x15b')][_0x8f23('0x15c')])){_0x3c85b2[_0x8f23('0xcb')](_0x8f23('0x1eb'),_0x40f9ef,_0x1e2f15[_0x14b59f]);}else{_0x3c85b2['checkIsBlackListIvr'](_['pick'](_0x1e2f15[_0x14b59f],[_0x8f23('0xd0'),_0x8f23('0x1ec')]))[_0x8f23('0xb6')](_0x3c85b2['checkContactBlack'](_0x40f9ef,_0x1e2f15[_0x14b59f]))[_0x8f23('0xae')](_0x3c85b2[_0x8f23('0x1ed')](_0x8f23('0x1ee'),_0x40f9ef));}}}})[_0x8f23('0xae')](loggerGetContactDialer(_0x8f23('0x1ef'),_0x40f9ef,_0x3c4cd9));}};Dialer[_0x8f23('0x1a')][_0x8f23('0x14a')]=function(_0x1a394d,_0x417c6e){var _0x8f396c=this;var _0x5ab3b0=[];var _0x2233ca=_0x417c6e>=0x1?_0x417c6e:0x1;if(_0x1a394d['dialMethod']===_0x8f23('0x7')){_0x2233ca=0x1;}var _0x31c734=Math[_0x8f23('0x1b3')](_0x1a394d['available']*_0x2233ca)-_0x1a394d[_0x8f23('0x71')]-_0x1a394d[_0x8f23('0xc2')];emitVoiceQueueSummary(_0x1a394d);if(_0x1a394d[_0x8f23('0x1f0')]>0x0){var _0x197896=_0x1a394d[_0x8f23('0x1f0')]-_0x1a394d['originated']-_0x1a394d[_0x8f23('0x54')]-_0x1a394d[_0x8f23('0xc2')]-_0x1a394d[_0x8f23('0x51')];if(_0x31c734>_0x197896){_0x31c734=_0x197896;}}if(_0x31c734>0x0){if(_0x1a394d['dialMethod']===_0x8f23('0x7')){_0x31c734=0x1;}if(_0x31c734>this[_0x8f23('0x22')]){_0x31c734=this['maxNumberOriginate'];}_0x1a394d[_0x8f23('0xc2')]+=_0x31c734;for(var _0x23cb15 in this['agents']){if(typeof this['agents'][_0x23cb15]!=='undefined'){if(this[_0x8f23('0x20')][_0x23cb15][_0x8f23('0xa2')]===_0x8f23('0x1f1')&&this[_0x8f23('0x20')][_0x23cb15]['status']===_0x8f23('0xd7')){_0x5ab3b0[_0x8f23('0x121')](this[_0x8f23('0x20')][_0x23cb15]['id']);}}}this[_0x8f23('0xc1')](_0x1a394d['id'],_0x5ab3b0,_0x31c734,_0x1a394d[_0x8f23('0x1e8')],_0x1a394d)['then'](function(_0x5b0ab5){_0x1a394d['temp']-=_0x31c734;_0x1a394d['temp']=_0x1a394d[_0x8f23('0xc2')]>0x0?_0x1a394d[_0x8f23('0xc2')]:0x0;if(!checkContactEmpty(_0x5b0ab5)){_0x8f396c[_0x8f23('0xb2')](_0x1a394d)[_0x8f23('0xb6')](sendMessageReschedule(_0x1a394d))[_0x8f23('0xae')](loggerCatch(_0x8f23('0xb4')));}else{_0x1a394d[_0x8f23('0x71')]+=_0x5b0ab5[_0x8f23('0x12a')];_0x1a394d[_0x8f23('0x3f')]=_0x1a394d['dialMethod']===_0x8f23('0x7')?'ACTIVE':_0x8f23('0x1f2');for(var _0x1b3a65=0x0;_0x1b3a65<_0x5b0ab5['length'];_0x1b3a65+=0x1){if(_[_0x8f23('0xaa')](_0x5b0ab5[_0x1b3a65])||_[_0x8f23('0xaa')](_0x5b0ab5[_0x1b3a65]['Contact'])||_[_0x8f23('0xaa')](_0x5b0ab5[_0x1b3a65][_0x8f23('0x15b')][_0x8f23('0x15c')])){_0x8f396c['emptyContact']('[actionOriginate]\x20',_0x1a394d,_0x5b0ab5[_0x1b3a65]);}else{_0x8f396c[_0x8f23('0xb5')](_[_0x8f23('0xcd')](_0x5b0ab5[_0x1b3a65],[_0x8f23('0xf6'),_0x8f23('0x1ec')]))[_0x8f23('0xb6')](_0x8f396c['checkContactBlack'](_0x1a394d,_0x5b0ab5[_0x1b3a65]))['catch'](_0x8f396c['loggerHandler'](_0x8f23('0x1eb'),_0x1a394d));}}}})[_0x8f23('0xae')](loggerGetContactDialer(_0x8f23('0x1f3'),_0x1a394d,_0x31c734));}};Dialer[_0x8f23('0x1a')]['handlePredictive']=function(_0xcb4601){if(_0xcb4601[_0x8f23('0x1f0')]>0x0){var _0x2044dd=_0xcb4601['dialLimitQueue']-_0xcb4601[_0x8f23('0x71')]-_0xcb4601[_0x8f23('0x54')];if(_0x2044dd>0x0){this[_0x8f23('0x1f4')](_0xcb4601);}else{loggerPredictiveCalls[_0x8f23('0x7a')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0xcb4601);}};Dialer[_0x8f23('0x1a')][_0x8f23('0x1f4')]=function(_0x56c3a7){var _0x37a1cf=this;var _0x17e3e0=[];_0x56c3a7[_0x8f23('0x71')]+=0x1;for(var _0x4fb715 in this[_0x8f23('0x20')]){if(typeof this['agents'][_0x4fb715]!==_0x8f23('0xc9')){if(this[_0x8f23('0x20')][_0x4fb715]['state']===_0x8f23('0x1f1')&&this[_0x8f23('0x20')][_0x4fb715]['status']===_0x8f23('0xd7')){_0x17e3e0['push'](this[_0x8f23('0x20')][_0x4fb715]['id']);}}}this['getContactDialer'](_0x56c3a7['id'],_0x17e3e0,0x1,_0x56c3a7[_0x8f23('0x1e8')],_0x56c3a7)['then'](function(_0x2f6649){if(!checkContactEmpty(_0x2f6649)){checkContactLowerLimitOriginate(_0x56c3a7,0x1,0x0);_0x37a1cf[_0x8f23('0xb2')](_0x56c3a7)['then'](sendMessageReschedule(_0x56c3a7))[_0x8f23('0xae')](loggerCatch(_0x8f23('0xb4')));}else{_0x56c3a7[_0x8f23('0x3f')]=_0x8f23('0x1f2');if(_[_0x8f23('0xaa')](_0x2f6649[0x0])||_[_0x8f23('0xaa')](_0x2f6649[0x0][_0x8f23('0x15b')])||_[_0x8f23('0xaa')](_0x2f6649[0x0][_0x8f23('0x15b')]['phone'])){_0x37a1cf['emptyContact'](_0x8f23('0x1eb'),_0x56c3a7,_0x2f6649[0x0]);}else{_0x37a1cf[_0x8f23('0xb5')](_[_0x8f23('0xcd')](_0x2f6649[0x0],['VoiceQueueId',_0x8f23('0x1ec')]))['then'](_0x37a1cf[_0x8f23('0x1d3')](_0x56c3a7,_0x2f6649[0x0]))[_0x8f23('0xae')](_0x37a1cf['loggerHandler']('[actionOriginatePredictive]\x20',_0x56c3a7));}}})[_0x8f23('0xae')](loggerGetContactDialer(_0x8f23('0x1f5'),_0x56c3a7,0x1));emitVoiceQueueSummary(_0x56c3a7);};Dialer['prototype'][_0x8f23('0x1c9')]=function(_0xeefb06,_0x1a0a41,_0x1c69b8,_0x4b5c5f,_0x34cfdf,_0x5bf3d5){loggerPredictive[_0x8f23('0x7a')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x8f23('0x7a')](_0x8f23('0x1f6'),_0xeefb06);loggerPredictive['info'](_0x8f23('0x1f7'),_0x1a0a41);loggerPredictive[_0x8f23('0x7a')](_0x8f23('0x1f8'),_0x1c69b8);loggerPredictive['info'](_0x8f23('0x1f9'),_0x4b5c5f);loggerPredictive[_0x8f23('0x7a')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x34cfdf);loggerPredictive[_0x8f23('0x7a')](_0x8f23('0x8b'));return new BPromise(function(_0x2c6fbe,_0x434f38){if(_0xeefb06<=0x0||isNaN(_0xeefb06)){return _0x434f38(msgResponse('[abandonmentRate]',_0x8f23('0x181'),_0x8f23('0x1fa')+_0xeefb06));}if(_0x1c69b8<=0x0||isNaN(_0x1c69b8)){return _0x434f38(msgResponse(_0x8f23('0x1fb'),'Error',_0x8f23('0x1fc')+_0x1c69b8));}if(_0x4b5c5f<=0x0||isNaN(_0x4b5c5f)){return _0x434f38(msgResponse(_0x8f23('0x1fb'),'Error',_0x8f23('0x1fd')+_0x4b5c5f));}if(_0x1a0a41<=0x0||isNaN(_0x1a0a41)){return _0x434f38(msgResponse(_0x8f23('0x1fb'),'Error',_0x8f23('0x1fe')+_0x1a0a41));}if(_0x34cfdf<=0x0||isNaN(_0x34cfdf)){return _0x434f38(msgResponse(_0x8f23('0x1fb'),'Error',_0x8f23('0x1ff')+_0x34cfdf));}_0x5bf3d5=_0x5bf3d5||0x0;var _0x2b6fa4=0x1/_0x1c69b8;var _0x4b510e=0x0;var _0x391527=0x0;var _0x378378=0x0;var _0x5623d2=0x0;for(var _0x19d0b9=0x0;_0x378378<_0x34cfdf;_0x19d0b9+=0x1){_0x391527=_0x19d0b9/_0x1a0a41;_0x4b510e=(_0x4b5c5f*_0x391527+_0x5bf3d5)/_0x2b6fa4;_0x378378=erlangb(_0x4b510e,_0xeefb06);_0x5623d2=_0x4b510e/_0xeefb06*(0x1-erlangb(_0x4b510e,_0xeefb06));}return _0x2c6fbe({'erlangCalls':_0x19d0b9,'erlangCallToSecond':_0x1a0a41/_0x19d0b9,'erlangAbandonmentRate':_0x378378,'erlangBusyFactor':_0x5623d2});});};Dialer[_0x8f23('0x1a')][_0x8f23('0x1cb')]=function(_0x26b542,_0x27ed64,_0x28ed93,_0x294c1a,_0x37f275,_0x2e4788){loggerPredictive[_0x8f23('0x7a')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x8f23('0x7a')](_0x8f23('0x1f6'),_0x26b542);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x27ed64);loggerPredictive[_0x8f23('0x7a')]('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',_0x28ed93);loggerPredictive[_0x8f23('0x7a')](_0x8f23('0x1f9'),_0x294c1a);loggerPredictive[_0x8f23('0x7a')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37f275);loggerPredictive['info'](_0x8f23('0x8b'));return new BPromise(function(_0x391031,_0x39a8af){if(_0x26b542<=0x0||isNaN(_0x26b542)){return _0x39a8af(msgResponse(_0x8f23('0x200'),'Error',_0x8f23('0x1fa')+_0x26b542));}if(_0x28ed93<=0x0||isNaN(_0x28ed93)){return _0x39a8af(msgResponse(_0x8f23('0x200'),_0x8f23('0x181'),_0x8f23('0x1fc')+_0x28ed93));}if(_0x294c1a<=0x0||isNaN(_0x294c1a)){return _0x39a8af(msgResponse(_0x8f23('0x200'),_0x8f23('0x181'),_0x8f23('0x1fd')+_0x294c1a));}if(_0x27ed64<=0x0||isNaN(_0x27ed64)){return _0x39a8af(msgResponse(_0x8f23('0x200'),_0x8f23('0x181'),'interval\x20=\x20'+_0x27ed64));}if(_0x37f275<=0x0||isNaN(_0x37f275)){return _0x39a8af(msgResponse('[busyFactor]',_0x8f23('0x181'),_0x8f23('0x201')+_0x37f275));}_0x2e4788=_0x2e4788||0x0;var _0x5df3c7=0x1/_0x28ed93;var _0x1c5e64=0x0;var _0xf6aba7=0x0;var _0x2c78a2=0x0;var _0x146095=0x0;for(var _0x3023bb=0x0;_0x146095<_0x37f275;_0x3023bb+=0x1){_0xf6aba7=_0x3023bb/_0x27ed64;_0x1c5e64=(_0x294c1a*_0xf6aba7+_0x2e4788)/_0x5df3c7;_0x2c78a2=erlangb(_0x1c5e64,_0x26b542);_0x146095=_0x1c5e64/_0x26b542*(0x1-erlangb(_0x1c5e64,_0x26b542));}return _0x391031({'erlangCalls':_0x3023bb,'erlangCallToSecond':_0x27ed64/_0x3023bb,'erlangAbandonmentRate':_0x2c78a2,'erlangBusyFactor':_0x146095});});};module[_0x8f23('0x202')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index b6b6602..ba66958 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 _0x6e2e=['countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime','holdtime','connectedlinename','reason','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry'];(function(_0xf0330b,_0x814253){var _0x538518=function(_0x9c7d43){while(--_0x9c7d43){_0xf0330b['push'](_0xf0330b['shift']());}};_0x538518(++_0x814253);}(_0x6e2e,0xd9));var _0xe6e2=function(_0x51b10b,_0x311567){_0x51b10b=_0x51b10b-0x0;var _0x45b2cf=_0x6e2e[_0x51b10b];return _0x45b2cf;};'use strict';var util=require(_0xe6e2('0x0'));var _=require('lodash');var moment=require(_0xe6e2('0x1'));function getSeconds(_0x874eaa,_0x4c1ebc){var _0x5ccb31=moment(_0x874eaa)[_0xe6e2('0x2')](0x0);var _0x15cb4c=moment(_0x4c1ebc)[_0xe6e2('0x2')](0x0);return _0x5ccb31[_0xe6e2('0x3')](_0x15cb4c,_0xe6e2('0x4'));}function QueueCallerAbandon(_0x28455f,_0x4f8fc8){this['scheduledat']=_0x28455f[_0xe6e2('0x5')];this[_0xe6e2('0x6')]=_0x28455f[_0xe6e2('0x6')];this[_0xe6e2('0x7')]=_0x28455f[_0xe6e2('0x6')]===_0xe6e2('0x8')?_0xe6e2('0x9'):_0x28455f[_0xe6e2('0x6')];this['countbusyretry']=_0x28455f[_0xe6e2('0xa')];this[_0xe6e2('0xb')]=_0x28455f[_0xe6e2('0xb')];this[_0xe6e2('0xc')]=_0x28455f['countnoanswerretry'];this[_0xe6e2('0xd')]=_0x28455f[_0xe6e2('0xa')]+_0x28455f['countcongestionretry']+_0x28455f['countnoanswerretry']+_0x28455f['countnosuchnumberretry']+_0x28455f[_0xe6e2('0xe')]+_0x28455f[_0xe6e2('0xf')]+_0x28455f[_0xe6e2('0x10')]+_0x28455f[_0xe6e2('0x11')];this['countnosuchnumberretry']=_0x28455f[_0xe6e2('0x12')];this[_0xe6e2('0xe')]=_0x28455f[_0xe6e2('0xe')];this[_0xe6e2('0xf')]=_0x28455f[_0xe6e2('0xf')];this[_0xe6e2('0x10')]=_0x28455f['countmachineretry'];this['countagentrejectretry']=_0x28455f['countagentrejectretry'];this[_0xe6e2('0x13')]=_0x4f8fc8['uniqueid'];this[_0xe6e2('0x14')]=_0x28455f[_0xe6e2('0x15')];this[_0xe6e2('0x16')]=_0x28455f['number'];this[_0xe6e2('0x17')]=_0x28455f['starttime'];this[_0xe6e2('0x18')]=_0x28455f[_0xe6e2('0x18')];this[_0xe6e2('0x19')]=_0x28455f['droptime'];this[_0xe6e2('0x1a')]=this[_0xe6e2('0x19')];this['ringtime']=getSeconds(_0x28455f[_0xe6e2('0x18')],_0x28455f[_0xe6e2('0x17')]);this[_0xe6e2('0x1b')]=getSeconds(this[_0xe6e2('0x19')],_0x28455f[_0xe6e2('0x18')]);this['talktime']=0x0;this[_0xe6e2('0x9')]=_0x4f8fc8[_0xe6e2('0x9')];this['membername']=_0x4f8fc8[_0xe6e2('0x1c')];this[_0xe6e2('0x1d')]=_0x4f8fc8[_0xe6e2('0x1d')];this['callback']=_0x28455f['callback'];this[_0xe6e2('0x1e')]=_0x28455f[_0xe6e2('0x1e')];this['callbackat']=_0x28455f['callbackat'];this[_0xe6e2('0x1f')]=_0x28455f['recallme'];this[_0xe6e2('0x20')]=_0x28455f[_0xe6e2('0x20')];this[_0xe6e2('0x21')]=_0x28455f[_0xe6e2('0x21')];this[_0xe6e2('0x22')]=_0x28455f[_0xe6e2('0x22')];this[_0xe6e2('0x23')]=_0x28455f['VoiceQueueId'];this[_0xe6e2('0x24')]=_0x28455f[_0xe6e2('0x24')];this[_0xe6e2('0x25')]=_0x28455f['originatecalleridnum']||'';this[_0xe6e2('0x26')]=_0x28455f[_0xe6e2('0x26')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xa338=['connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','milliseconds','seconds','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','talktime','queue','membername'];(function(_0x58c52d,_0x144547){var _0x5ec6cb=function(_0x18a2ca){while(--_0x18a2ca){_0x58c52d['push'](_0x58c52d['shift']());}};_0x5ec6cb(++_0x144547);}(_0xa338,0xa6));var _0x8a33=function(_0x41af96,_0x53e51d){_0x41af96=_0x41af96-0x0;var _0x4d234a=_0xa338[_0x41af96];return _0x4d234a;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x4baf28,_0x2c457f){var _0x2f020c=moment(_0x4baf28)[_0x8a33('0x0')](0x0);var _0x54d0d6=moment(_0x2c457f)[_0x8a33('0x0')](0x0);return _0x2f020c['diff'](_0x54d0d6,_0x8a33('0x1'));}function QueueCallerAbandon(_0x58808f,_0x402e61){this['scheduledat']=_0x58808f['scheduledat'];this[_0x8a33('0x2')]=_0x58808f[_0x8a33('0x2')];this[_0x8a33('0x3')]=_0x58808f[_0x8a33('0x2')]==='outbound'?'queue':_0x58808f[_0x8a33('0x2')];this[_0x8a33('0x4')]=_0x58808f[_0x8a33('0x4')];this['countcongestionretry']=_0x58808f[_0x8a33('0x5')];this['countnoanswerretry']=_0x58808f[_0x8a33('0x6')];this['countglobal']=_0x58808f[_0x8a33('0x4')]+_0x58808f['countcongestionretry']+_0x58808f['countnoanswerretry']+_0x58808f[_0x8a33('0x7')]+_0x58808f[_0x8a33('0x8')]+_0x58808f[_0x8a33('0x9')]+_0x58808f[_0x8a33('0xa')]+_0x58808f[_0x8a33('0xb')];this[_0x8a33('0x7')]=_0x58808f[_0x8a33('0x7')];this[_0x8a33('0x8')]=_0x58808f['countdropretry'];this[_0x8a33('0x9')]=_0x58808f[_0x8a33('0x9')];this['countmachineretry']=_0x58808f['countmachineretry'];this[_0x8a33('0xb')]=_0x58808f[_0x8a33('0xb')];this['uniqueid']=_0x402e61['uniqueid'];this[_0x8a33('0xc')]=_0x58808f[_0x8a33('0xd')];this[_0x8a33('0xe')]=_0x58808f[_0x8a33('0xf')];this[_0x8a33('0x10')]=_0x58808f['starttime'];this[_0x8a33('0x11')]=_0x58808f['responsetime'];this[_0x8a33('0x12')]=_0x58808f[_0x8a33('0x12')];this[_0x8a33('0x13')]=this[_0x8a33('0x12')];this['ringtime']=getSeconds(_0x58808f[_0x8a33('0x11')],_0x58808f[_0x8a33('0x10')]);this[_0x8a33('0x14')]=getSeconds(this[_0x8a33('0x12')],_0x58808f[_0x8a33('0x11')]);this[_0x8a33('0x15')]=0x0;this[_0x8a33('0x16')]=_0x402e61[_0x8a33('0x16')];this[_0x8a33('0x17')]=_0x402e61[_0x8a33('0x18')];this[_0x8a33('0x19')]=_0x402e61[_0x8a33('0x19')];this[_0x8a33('0x1a')]=_0x58808f[_0x8a33('0x1a')];this[_0x8a33('0x1b')]=_0x58808f[_0x8a33('0x1b')];this['callbackat']=_0x58808f[_0x8a33('0x1c')];this['recallme']=_0x58808f[_0x8a33('0x1d')];this[_0x8a33('0x1e')]=_0x58808f[_0x8a33('0x1e')];this[_0x8a33('0x1f')]=_0x58808f['ListId'];this['UserId']=_0x58808f[_0x8a33('0x20')];this[_0x8a33('0x21')]=_0x58808f[_0x8a33('0x21')];this[_0x8a33('0x22')]=_0x58808f[_0x8a33('0x22')];this[_0x8a33('0x23')]=_0x58808f['originatecalleridnum']||'';this[_0x8a33('0x24')]=_0x58808f[_0x8a33('0x24')]||'';}module[_0x8a33('0x25')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index eb17c9a..7c2ec79 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(_0x4168ff,_0x11832a){var _0x7311ed=function(_0x2222ef){while(--_0x2222ef){_0x4168ff['push'](_0x4168ff['shift']());}};_0x7311ed(++_0x11832a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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(_0x58f59d,_0x24d60e){var _0x5daff3=function(_0x59dd69){while(--_0x59dd69){_0x58f59d['push'](_0x58f59d['shift']());}};_0x5daff3(++_0x24d60e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 b77811b..c3662cf 100644 --- a/server/services/ami/fax/index.js +++ b/server/services/ami/fax/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d2d=['Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','tiff2pdf','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','message','create','parse','.pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','update','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','dir','path','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active'];(function(_0x4f6fe9,_0x123c6e){var _0xeac0a=function(_0x3837be){while(--_0x3837be){_0x4f6fe9['push'](_0x4f6fe9['shift']());}};_0xeac0a(++_0x123c6e);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x486489,_0x57f841){_0x486489=_0x486489-0x0;var _0x515156=_0x1d2d[_0x486489];return _0x515156;};'use strict';var util=require(_0xd1d2('0x0'));var _=require(_0xd1d2('0x1'));var BPromise=require(_0xd1d2('0x2'));var uuid=require(_0xd1d2('0x3'));var moment=require(_0xd1d2('0x4'));var path=require('path');var tiff2pdf=require(_0xd1d2('0x5'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0xd1d2('0x6'));var ami=require(_0xd1d2('0x7'));var rpcDb=require(_0xd1d2('0x8'));var Channel=require(_0xd1d2('0x9'));var ut=require(_0xd1d2('0xa'));var Action=require(_0xd1d2('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xd1d2('0xc'));var faxMessage=require(_0xd1d2('0xd'));function Fax(_0x35735f){this[_0xd1d2('0xe')]={};this[_0xd1d2('0xf')]=_0x35735f[_0xd1d2('0xf')];this[_0xd1d2('0x10')]=_0x35735f[_0xd1d2('0x10')];this[_0xd1d2('0x11')]={};ami['on'](_0xd1d2('0x12'),this[_0xd1d2('0x13')][_0xd1d2('0x14')](this));ami['on'](_0xd1d2('0x15'),this['syncVarSet'][_0xd1d2('0x14')](this));ami['on'](_0xd1d2('0x16'),this[_0xd1d2('0x17')][_0xd1d2('0x14')](this));ami['on'](_0xd1d2('0x18'),this[_0xd1d2('0x19')][_0xd1d2('0x14')](this));ami['on'](_0xd1d2('0x1a'),this[_0xd1d2('0x1b')][_0xd1d2('0x14')](this));ami['on']('receivefax',this[_0xd1d2('0x1c')][_0xd1d2('0x14')](this));ami['on'](_0xd1d2('0x1d'),this['syncHangup'][_0xd1d2('0x14')](this));ami['on'](_0xd1d2('0x1e'),this[_0xd1d2('0x1f')][_0xd1d2('0x14')](this));}Fax[_0xd1d2('0x20')][_0xd1d2('0x13')]=function(_0x275996){if(_0x275996['context']==='from-voip-provider'){for(var _0x3be186 in this['faxAccounts']){if(this[_0xd1d2('0xf')][_0xd1d2('0x21')](_0x3be186)){if(_0x275996[_0xd1d2('0x22')]===this[_0xd1d2('0xf')][_0x3be186]['localstationid']){this['channels'][_0x275996[_0xd1d2('0x23')]]={};this['channels'][_0x275996['uniqueid']][_0xd1d2('0x24')]=_0x275996[_0xd1d2('0x24')];this[_0xd1d2('0xe')][_0x275996[_0xd1d2('0x23')]]['id']=this['faxAccounts'][_0x3be186]['id'];this[_0xd1d2('0xe')][_0x275996[_0xd1d2('0x23')]][_0xd1d2('0x25')]=this['faxAccounts'][_0x3be186]['name'];logger[_0xd1d2('0x26')](_0x275996[_0xd1d2('0x23')],_0xd1d2('0x27'));}}}}if(this[_0xd1d2('0x11')][_0x275996[_0xd1d2('0x23')]]){this[_0xd1d2('0xe')][_0x275996[_0xd1d2('0x23')]]={};this['channels'][_0x275996[_0xd1d2('0x23')]][_0xd1d2('0x24')]=_0x275996[_0xd1d2('0x24')];logger[_0xd1d2('0x26')](_0x275996[_0xd1d2('0x23')],_0xd1d2('0x27'));}};Fax[_0xd1d2('0x20')][_0xd1d2('0x28')]=function(_0xe6ef3c){if(this[_0xd1d2('0xe')][_0xe6ef3c[_0xd1d2('0x23')]]){for(var _0x4e1bc2 in _0xe6ef3c['variable']){if(_0xe6ef3c[_0xd1d2('0x29')][_0xd1d2('0x21')](_0x4e1bc2)){this[_0xd1d2('0xe')][_0xe6ef3c[_0xd1d2('0x23')]][_0x4e1bc2]=_0xe6ef3c[_0xd1d2('0x2a')];}}}};Fax['prototype'][_0xd1d2('0x17')]=function(_0x41171c){if(this[_0xd1d2('0xe')][_0x41171c['uniqueid']]){this[_0xd1d2('0xe')][_0x41171c[_0xd1d2('0x23')]][_0xd1d2('0x2b')]=_0x41171c['channelstate'];this[_0xd1d2('0xe')][_0x41171c[_0xd1d2('0x23')]][_0xd1d2('0x2c')]=_0x41171c[_0xd1d2('0x2c')];}};Fax[_0xd1d2('0x20')][_0xd1d2('0x19')]=function(_0x42e89d){if(this[_0xd1d2('0xe')][_0x42e89d[_0xd1d2('0x23')]]){for(var _0x4501b6 in _0x42e89d[_0xd1d2('0x29')]){if(_0x42e89d[_0xd1d2('0x29')][_0xd1d2('0x21')](_0x4501b6)){this[_0xd1d2('0xe')][_0x42e89d[_0xd1d2('0x23')]][_0x4501b6]=_0x42e89d[_0xd1d2('0x2a')];}}}};Fax[_0xd1d2('0x20')][_0xd1d2('0x1b')]=function(_0x5c7efd){if(this[_0xd1d2('0xe')][_0x5c7efd[_0xd1d2('0x23')]]){this[_0xd1d2('0xe')][_0x5c7efd['uniqueid']][_0xd1d2('0x2d')]=_0x5c7efd['operation'];this['channels'][_0x5c7efd[_0xd1d2('0x23')]][_0xd1d2('0x2e')]=_0x5c7efd[_0xd1d2('0x2e')];this[_0xd1d2('0xe')][_0x5c7efd[_0xd1d2('0x23')]][_0xd1d2('0x2f')]=_0x5c7efd['localstationid'];this[_0xd1d2('0xe')][_0x5c7efd[_0xd1d2('0x23')]]['filename']=_0x5c7efd[_0xd1d2('0x30')];logger[_0xd1d2('0x26')](_0x5c7efd[_0xd1d2('0x23')],_0xd1d2('0x31'));}};Fax['prototype']['syncReceiveFax']=function(_0x2fd2c5){var _0x54fbbb=this;if(this['channels'][_0x2fd2c5['uniqueid']]){var _0x43e70f=this['channels'][_0x2fd2c5[_0xd1d2('0x23')]]['id'];this['channels'][_0x2fd2c5['uniqueid']]['remotestationid']=_0x2fd2c5[_0xd1d2('0x32')];this[_0xd1d2('0xe')][_0x2fd2c5[_0xd1d2('0x23')]][_0xd1d2('0x33')]=_0x2fd2c5[_0xd1d2('0x33')];this[_0xd1d2('0xe')][_0x2fd2c5[_0xd1d2('0x23')]][_0xd1d2('0x2f')]=_0x2fd2c5[_0xd1d2('0x2f')];this[_0xd1d2('0xe')][_0x2fd2c5[_0xd1d2('0x23')]][_0xd1d2('0x34')]=_0x2fd2c5[_0xd1d2('0x34')];this[_0xd1d2('0xe')][_0x2fd2c5['uniqueid']]['transferrate']=_0x2fd2c5[_0xd1d2('0x35')];this[_0xd1d2('0xe')][_0x2fd2c5[_0xd1d2('0x23')]]['filename']=_0x2fd2c5['filename'];this[_0xd1d2('0xe')][_0x2fd2c5[_0xd1d2('0x23')]]['calleridnum']=_0x2fd2c5[_0xd1d2('0x36')];if(this['channels'][_0x2fd2c5['uniqueid']][_0xd1d2('0x33')]>0x0){tiff2pdf(_0x2fd2c5['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x1825f2){logger[_0xd1d2('0x26')](_0x2fd2c5[_0xd1d2('0x23')],'\x20result\x20conversion\x20file\x20',_0x1825f2[_0xd1d2('0x37')]);attachment[_0xd1d2('0x38')]({'name':path[_0xd1d2('0x39')](_0x2fd2c5[_0xd1d2('0x30')])['name'],'basename':path[_0xd1d2('0x39')](_0x2fd2c5[_0xd1d2('0x30')])['name']+_0xd1d2('0x3a'),'type':'application/pdf'})[_0xd1d2('0x3b')](function(_0xd56adb){faxAccount[_0xd1d2('0x3c')](_0x43e70f,{'from':_0x2fd2c5[_0xd1d2('0x36')],'mapKey':_0xd1d2('0x6'),'body':path['parse'](_0x2fd2c5['filename'])[_0xd1d2('0x25')]+_0xd1d2('0x3a'),'AttachmentId':_0xd56adb['id']})['catch'](function(_0xa4c11d){logger[_0xd1d2('0x3d')](_0x2fd2c5[_0xd1d2('0x23')],_0xd1d2('0x3e'),JSON[_0xd1d2('0x3f')](_0xa4c11d));});})[_0xd1d2('0x40')](function(_0x112d67){logger['error'](_0x2fd2c5[_0xd1d2('0x23')],_0xd1d2('0x41'),JSON['stringify'](_0x112d67));});});}logger[_0xd1d2('0x26')](_0x2fd2c5[_0xd1d2('0x23')],'\x20receiveFax\x20');}};Fax['prototype'][_0xd1d2('0x1f')]=function(_0x182ea8){if(this['actions'][_0x182ea8[_0xd1d2('0x23')]]){_[_0xd1d2('0x42')](this[_0xd1d2('0xe')][_0x182ea8[_0xd1d2('0x23')]],_[_0xd1d2('0x43')](_0x182ea8,['response','reason']));}};function updateStatus(_0x314af3){if(_0x314af3['AttachmentId']){faxMessage[_0xd1d2('0x44')](_0x314af3[_0xd1d2('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xd1d2('0x3b')](function(_0x35d724){ut['logger']('[Fax][Message][Error][Updated]',_0x35d724);})[_0xd1d2('0x40')](function(_0x20ab8b){ut[_0xd1d2('0x46')](_0xd1d2('0x47'),_0x20ab8b);});}else{ut[_0xd1d2('0x46')](_0xd1d2('0x48'));}}Fax[_0xd1d2('0x20')][_0xd1d2('0x49')]=function(_0x33e332,_0x5e15cb,_0x1958f3){var _0x530db0=this;var _0x55c44f={};if(_0x5e15cb){_0x55c44f={'read':_0x5e15cb};}else{_0x55c44f={'failMessage':_0x1958f3};}if(this[_0xd1d2('0x11')][_0x33e332][_0xd1d2('0x45')]){faxMessage[_0xd1d2('0x44')](this[_0xd1d2('0x11')][_0x33e332][_0xd1d2('0x45')],_0x55c44f)[_0xd1d2('0x3b')](function(_0x35a51b){ut[_0xd1d2('0x46')](_0xd1d2('0x4a'),_0x35a51b);})[_0xd1d2('0x40')](function(_0x28173a){ut[_0xd1d2('0x46')](_0xd1d2('0x4b'),_0x28173a);})['finally'](function(){delete _0x530db0['channels'][_0x33e332];delete _0x530db0[_0xd1d2('0x11')][_0x33e332];});}else{ut[_0xd1d2('0x46')](_0xd1d2('0x4c'));delete this[_0xd1d2('0xe')][_0x33e332];delete this[_0xd1d2('0x11')][_0x33e332];}};Fax[_0xd1d2('0x20')][_0xd1d2('0x4d')]=function(_0x278a2a){var _0x3e22d2=this;if(this[_0xd1d2('0xe')][_0x278a2a[_0xd1d2('0x23')]]){if(this['actions'][_0x278a2a['uniqueid']]){this[_0xd1d2('0xe')][_0x278a2a[_0xd1d2('0x23')]]['id']=this[_0xd1d2('0x11')][_0x278a2a[_0xd1d2('0x23')]]['id'];this['channels'][_0x278a2a[_0xd1d2('0x23')]][_0xd1d2('0x25')]=this[_0xd1d2('0x11')][_0x278a2a[_0xd1d2('0x23')]][_0xd1d2('0x25')];}logger[_0xd1d2('0x26')](_0x278a2a[_0xd1d2('0x23')],this['actions'][_0x278a2a[_0xd1d2('0x23')]]?_0xd1d2('0x4e'):_0xd1d2('0x4f'),JSON['stringify'](this['channels'][_0x278a2a[_0xd1d2('0x23')]]));if(this[_0xd1d2('0x11')][_0x278a2a[_0xd1d2('0x23')]]){if(this[_0xd1d2('0xe')][_0x278a2a['uniqueid']][_0xd1d2('0x50')]>0x0&&this[_0xd1d2('0xe')][_0x278a2a[_0xd1d2('0x23')]]['faxstatus']===_0xd1d2('0x51')){this[_0xd1d2('0x49')](_0x278a2a['uniqueid'],!![]);}else{this[_0xd1d2('0x49')](_0x278a2a[_0xd1d2('0x23')],![],this[_0xd1d2('0xe')][_0x278a2a[_0xd1d2('0x23')]]['faxstatusstring']?_0xd1d2('0x52')+this[_0xd1d2('0xe')][_0x278a2a[_0xd1d2('0x23')]][_0xd1d2('0x53')]:_0xd1d2('0x54'));}}}};Fax['prototype']['send']=function(_0x500465){var _0x541676=this;return new BPromise(function(_0x59ca94,_0x105850){_0x541676[_0xd1d2('0x55')](_0x500465,_0x541676[_0xd1d2('0xf')][_0x500465['FaxAccountId']])[_0xd1d2('0x3b')](function(_0x17c4eb){ut[_0xd1d2('0x46')]('[Fax][execOriginate][success]',_0x17c4eb);_0x59ca94(ut[_0xd1d2('0x37')](_0xd1d2('0x56')));})[_0xd1d2('0x40')](function(_0x4a42d9){ut[_0xd1d2('0x46')](_0xd1d2('0x57'),_0x4a42d9);updateStatus(_0x500465);_0x105850(ut['message'](_0xd1d2('0x58')));});});};Fax[_0xd1d2('0x20')]['checkAfterSend']=function(_0x530335){var _0x21bfd4=this;return new BPromise(function(_0x1ea57a,_0x34877f){var _0x14cd07=_0x21bfd4['checkTrunk'](_0x21bfd4[_0xd1d2('0xf')][_0x530335[_0xd1d2('0x59')]][_0xd1d2('0x5a')],_0x530335);if(_0x14cd07[_0xd1d2('0x5b')]){_0x1ea57a(ut['message'](_0xd1d2('0x5c')));}else{_0x34877f(ut[_0xd1d2('0x37')](_0x14cd07[_0xd1d2('0x37')]));}});};function originate(_0x572b55,_0x46ff4d,_0x1ae9af){return new BPromise(function(_0x4c35cb,_0x2175ab){if(_0x1ae9af){var _0x32ae30=util[_0xd1d2('0x5d')](_0xd1d2('0x5e'),path[_0xd1d2('0x39')](_0x572b55['path'])[_0xd1d2('0x25')],_0x572b55['path']);gs['execute'](_0x32ae30)['then'](function(){_0x572b55['path']=util[_0xd1d2('0x5d')]('%s/%s.tif',path[_0xd1d2('0x39')](_0x572b55['path'])[_0xd1d2('0x5f')],path[_0xd1d2('0x39')](_0x572b55[_0xd1d2('0x60')])[_0xd1d2('0x25')]);_0x46ff4d[_0xd1d2('0x61')]=_0x572b55[_0xd1d2('0x60')];ut['logger'](_0xd1d2('0x62'),'');ami[_0xd1d2('0x63')](ut[_0xd1d2('0x64')](_0x572b55,_0x46ff4d))[_0xd1d2('0x3b')](function(_0x448134){_0x4c35cb(_0x448134);})[_0xd1d2('0x40')](function(_0x2b6bd6){_0x2175ab(_0x2b6bd6);});})[_0xd1d2('0x40')](function(_0x3614dc){_0x2175ab(_0x3614dc);});}else{ami[_0xd1d2('0x63')](ut['variablesAction'](_0x572b55,_0x46ff4d))[_0xd1d2('0x3b')](function(_0x428200){_0x4c35cb(_0x428200);})[_0xd1d2('0x40')](function(_0x2eaf42){_0x2175ab(_0x2eaf42);});}});}Fax['prototype'][_0xd1d2('0x55')]=function(_0x28958d,_0xb7bf6a){var _0x56c005=this;return new BPromise(function(_0x2fffe5,_0x17af73){var _0x53b36d=uuid['v4']();var _0x566435=ut[_0xd1d2('0x65')](_0x28958d,_0xb7bf6a);_0x56c005[_0xd1d2('0x11')][_0x53b36d]=new Action(_0x53b36d,_0xb7bf6a,_0x28958d);var _0x3fbd87=_0x56c005[_0xd1d2('0x11')][_0x53b36d];if(path[_0xd1d2('0x39')](_0x28958d[_0xd1d2('0x60')])[_0xd1d2('0x66')]==='.pdf'){originate(_0x3fbd87,_0x566435,!![])[_0xd1d2('0x3b')](function(_0x9a98d4){_0x2fffe5(_0x9a98d4);})[_0xd1d2('0x40')](function(_0x24b8d1){_0x17af73(_0x24b8d1);});}else{originate(_0x3fbd87,_0x566435,![])[_0xd1d2('0x3b')](function(_0x123006){_0x2fffe5(_0x123006);})[_0xd1d2('0x40')](function(_0x3dbc87){_0x17af73(_0x3dbc87);});}});};Fax[_0xd1d2('0x20')][_0xd1d2('0x67')]=function(_0x2c3650){return!_[_0xd1d2('0x68')](_0x2c3650)&&!_[_0xd1d2('0x68')](_0x2c3650[_0xd1d2('0x25')])&&!_['isNil'](_0x2c3650[_0xd1d2('0x69')])&&_0x2c3650[_0xd1d2('0x69')]&&!_[_0xd1d2('0x68')](this[_0xd1d2('0x10')][util[_0xd1d2('0x5d')](_0xd1d2('0x6a'),_0x2c3650[_0xd1d2('0x25')])])&&!_[_0xd1d2('0x68')](this[_0xd1d2('0x10')][util[_0xd1d2('0x5d')](_0xd1d2('0x6a'),_0x2c3650[_0xd1d2('0x25')])][_0xd1d2('0x2e')])&&(this['trunks'][util[_0xd1d2('0x5d')](_0xd1d2('0x6a'),_0x2c3650[_0xd1d2('0x25')])][_0xd1d2('0x2e')]===_0xd1d2('0x6b')||this[_0xd1d2('0x10')][util[_0xd1d2('0x5d')](_0xd1d2('0x6a'),_0x2c3650[_0xd1d2('0x25')])][_0xd1d2('0x2e')]===_0xd1d2('0x6c'));};Fax[_0xd1d2('0x20')]['checkTrunk']=function(_0x46375e,_0x234262){if(!this[_0xd1d2('0x67')](_0x46375e)){ut[_0xd1d2('0x46')](_0xd1d2('0x6d'),_['isNil'](_0x46375e)?'':_0x46375e[_0xd1d2('0x25')]+_0xd1d2('0x6e'));return{'isValid':![],'message':_0xd1d2('0x6f')};}if(_[_0xd1d2('0x68')](_0x234262['fax'])){ut[_0xd1d2('0x46')](_0xd1d2('0x70'),JSON[_0xd1d2('0x3f')](_0x234262));return{'isValid':![],'message':_0xd1d2('0x71')};}if(_[_0xd1d2('0x68')](_0x234262[_0xd1d2('0x60')])){ut[_0xd1d2('0x46')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xd1d2('0x3f')](_0x234262));return{'isValid':![],'message':_0xd1d2('0x72')};}return{'isValid':!![],'message':_0xd1d2('0x73')};};module[_0xd1d2('0x74')]=Fax; \ No newline at end of file +var _0xd914=['dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','isTrunkReachable','isNil','active','format','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','syncVarSet','bind','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','channelstate','channelstatedesc','variable','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20receiveFax\x20','stringify','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','Fax\x20failed','checkAfterSend','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','execute','%s/%s.tif'];(function(_0x1f26af,_0x2d9128){var _0x2bc522=function(_0x20841e){while(--_0x20841e){_0x1f26af['push'](_0x1f26af['shift']());}};_0x2bc522(++_0x2d9128);}(_0xd914,0x17f));var _0x4d91=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0xd914[_0x45346d];return _0x5ce7ca;};'use strict';var util=require(_0x4d91('0x0'));var _=require(_0x4d91('0x1'));var BPromise=require('bluebird');var uuid=require(_0x4d91('0x2'));var moment=require(_0x4d91('0x3'));var path=require(_0x4d91('0x4'));var tiff2pdf=require(_0x4d91('0x5'));var gs=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('fax');var ami=require(_0x4d91('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0x4d91('0x9'));var ut=require(_0x4d91('0xa'));var Action=require(_0x4d91('0xb'));var faxAccount=require(_0x4d91('0xc'));var attachment=require(_0x4d91('0xd'));var faxMessage=require(_0x4d91('0xe'));function Fax(_0x3016c0){this[_0x4d91('0xf')]={};this['faxAccounts']=_0x3016c0[_0x4d91('0x10')];this[_0x4d91('0x11')]=_0x3016c0[_0x4d91('0x11')];this[_0x4d91('0x12')]={};ami['on'](_0x4d91('0x13'),this[_0x4d91('0x14')]['bind'](this));ami['on']('varset',this[_0x4d91('0x15')][_0x4d91('0x16')](this));ami['on'](_0x4d91('0x17'),this[_0x4d91('0x18')][_0x4d91('0x16')](this));ami['on'](_0x4d91('0x19'),this['syncNewExten']['bind'](this));ami['on'](_0x4d91('0x1a'),this[_0x4d91('0x1b')][_0x4d91('0x16')](this));ami['on'](_0x4d91('0x1c'),this[_0x4d91('0x1d')][_0x4d91('0x16')](this));ami['on'](_0x4d91('0x1e'),this['syncHangup'][_0x4d91('0x16')](this));ami['on'](_0x4d91('0x1f'),this[_0x4d91('0x20')][_0x4d91('0x16')](this));}Fax[_0x4d91('0x21')]['syncNewchannel']=function(_0x1241a1){if(_0x1241a1[_0x4d91('0x22')]===_0x4d91('0x23')){for(var _0x44b9a7 in this['faxAccounts']){if(this[_0x4d91('0x10')][_0x4d91('0x24')](_0x44b9a7)){if(_0x1241a1[_0x4d91('0x25')]===this['faxAccounts'][_0x44b9a7][_0x4d91('0x26')]){this[_0x4d91('0xf')][_0x1241a1[_0x4d91('0x27')]]={};this[_0x4d91('0xf')][_0x1241a1[_0x4d91('0x27')]][_0x4d91('0x28')]=_0x1241a1[_0x4d91('0x28')];this[_0x4d91('0xf')][_0x1241a1[_0x4d91('0x27')]]['id']=this[_0x4d91('0x10')][_0x44b9a7]['id'];this['channels'][_0x1241a1[_0x4d91('0x27')]]['name']=this['faxAccounts'][_0x44b9a7][_0x4d91('0x29')];logger[_0x4d91('0x2a')](_0x1241a1[_0x4d91('0x27')],_0x4d91('0x2b'));}}}}if(this[_0x4d91('0x12')][_0x1241a1[_0x4d91('0x27')]]){this[_0x4d91('0xf')][_0x1241a1[_0x4d91('0x27')]]={};this['channels'][_0x1241a1['uniqueid']][_0x4d91('0x28')]=_0x1241a1[_0x4d91('0x28')];logger[_0x4d91('0x2a')](_0x1241a1[_0x4d91('0x27')],_0x4d91('0x2b'));}};Fax[_0x4d91('0x21')][_0x4d91('0x15')]=function(_0x560966){if(this[_0x4d91('0xf')][_0x560966[_0x4d91('0x27')]]){for(var _0x12ac74 in _0x560966['variable']){if(_0x560966['variable'][_0x4d91('0x24')](_0x12ac74)){this[_0x4d91('0xf')][_0x560966['uniqueid']][_0x12ac74]=_0x560966['value'];}}}};Fax[_0x4d91('0x21')][_0x4d91('0x18')]=function(_0x43371e){if(this[_0x4d91('0xf')][_0x43371e['uniqueid']]){this[_0x4d91('0xf')][_0x43371e[_0x4d91('0x27')]][_0x4d91('0x2c')]=_0x43371e[_0x4d91('0x2c')];this[_0x4d91('0xf')][_0x43371e[_0x4d91('0x27')]][_0x4d91('0x2d')]=_0x43371e['channelstatedesc'];}};Fax[_0x4d91('0x21')]['syncNewExten']=function(_0x4ad7bf){if(this[_0x4d91('0xf')][_0x4ad7bf[_0x4d91('0x27')]]){for(var _0x4f95f0 in _0x4ad7bf[_0x4d91('0x2e')]){if(_0x4ad7bf[_0x4d91('0x2e')][_0x4d91('0x24')](_0x4f95f0)){this[_0x4d91('0xf')][_0x4ad7bf[_0x4d91('0x27')]][_0x4f95f0]=_0x4ad7bf['value'];}}}};Fax[_0x4d91('0x21')][_0x4d91('0x1b')]=function(_0x36d7e0){if(this[_0x4d91('0xf')][_0x36d7e0[_0x4d91('0x27')]]){this[_0x4d91('0xf')][_0x36d7e0['uniqueid']][_0x4d91('0x2f')]=_0x36d7e0[_0x4d91('0x2f')];this['channels'][_0x36d7e0[_0x4d91('0x27')]][_0x4d91('0x30')]=_0x36d7e0[_0x4d91('0x30')];this['channels'][_0x36d7e0[_0x4d91('0x27')]][_0x4d91('0x26')]=_0x36d7e0[_0x4d91('0x26')];this[_0x4d91('0xf')][_0x36d7e0['uniqueid']][_0x4d91('0x31')]=_0x36d7e0[_0x4d91('0x31')];logger[_0x4d91('0x2a')](_0x36d7e0[_0x4d91('0x27')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x4d91('0x1d')]=function(_0x3dac76){var _0x524052=this;if(this[_0x4d91('0xf')][_0x3dac76[_0x4d91('0x27')]]){var _0x197ea6=this[_0x4d91('0xf')][_0x3dac76['uniqueid']]['id'];this[_0x4d91('0xf')][_0x3dac76[_0x4d91('0x27')]]['remotestationid']=_0x3dac76[_0x4d91('0x32')];this['channels'][_0x3dac76[_0x4d91('0x27')]]['pagestransferred']=_0x3dac76[_0x4d91('0x33')];this['channels'][_0x3dac76[_0x4d91('0x27')]][_0x4d91('0x26')]=_0x3dac76[_0x4d91('0x26')];this[_0x4d91('0xf')][_0x3dac76['uniqueid']]['resolution']=_0x3dac76[_0x4d91('0x34')];this['channels'][_0x3dac76[_0x4d91('0x27')]][_0x4d91('0x35')]=_0x3dac76['transferrate'];this[_0x4d91('0xf')][_0x3dac76[_0x4d91('0x27')]][_0x4d91('0x31')]=_0x3dac76[_0x4d91('0x31')];this[_0x4d91('0xf')][_0x3dac76[_0x4d91('0x27')]][_0x4d91('0x36')]=_0x3dac76['calleridnum'];if(this[_0x4d91('0xf')][_0x3dac76['uniqueid']][_0x4d91('0x33')]>0x0){tiff2pdf(_0x3dac76[_0x4d91('0x31')],_0x4d91('0x37'),function(_0x2483c4){logger[_0x4d91('0x2a')](_0x3dac76[_0x4d91('0x27')],'\x20result\x20conversion\x20file\x20',_0x2483c4['message']);attachment[_0x4d91('0x38')]({'name':path[_0x4d91('0x39')](_0x3dac76['filename'])[_0x4d91('0x29')],'basename':path[_0x4d91('0x39')](_0x3dac76[_0x4d91('0x31')])[_0x4d91('0x29')]+_0x4d91('0x3a'),'type':_0x4d91('0x3b')})[_0x4d91('0x3c')](function(_0x971da4){faxAccount[_0x4d91('0x3d')](_0x197ea6,{'from':_0x3dac76['calleridnum'],'mapKey':'fax','body':path[_0x4d91('0x39')](_0x3dac76['filename'])[_0x4d91('0x29')]+_0x4d91('0x3a'),'AttachmentId':_0x971da4['id']})[_0x4d91('0x3e')](function(_0x10b1bb){logger['error'](_0x3dac76[_0x4d91('0x27')],'\x20notify\x20',JSON['stringify'](_0x10b1bb));});})[_0x4d91('0x3e')](function(_0xfd7c52){logger[_0x4d91('0x3f')](_0x3dac76[_0x4d91('0x27')],_0x4d91('0x40'),JSON[_0x4d91('0x41')](_0xfd7c52));});});}logger['info'](_0x3dac76[_0x4d91('0x27')],_0x4d91('0x40'));}};Fax[_0x4d91('0x21')][_0x4d91('0x20')]=function(_0x106e5b){if(this[_0x4d91('0x12')][_0x106e5b[_0x4d91('0x27')]]){_[_0x4d91('0x42')](this[_0x4d91('0xf')][_0x106e5b[_0x4d91('0x27')]],_[_0x4d91('0x43')](_0x106e5b,['response',_0x4d91('0x44')]));}};function updateStatus(_0x5a5c03){if(_0x5a5c03[_0x4d91('0x45')]){faxMessage[_0x4d91('0x46')](_0x5a5c03[_0x4d91('0x45')],{'failMessage':_0x4d91('0x47')})[_0x4d91('0x3c')](function(_0x3edc43){ut[_0x4d91('0x48')](_0x4d91('0x49'),_0x3edc43);})['catch'](function(_0x63f708){ut[_0x4d91('0x48')](_0x4d91('0x4a'),_0x63f708);});}else{ut[_0x4d91('0x48')](_0x4d91('0x4b'));}}Fax[_0x4d91('0x21')][_0x4d91('0x4c')]=function(_0x4aae23,_0x392cc3,_0x2159e4){var _0x413b25=this;var _0x4382ff={};if(_0x392cc3){_0x4382ff={'read':_0x392cc3};}else{_0x4382ff={'failMessage':_0x2159e4};}if(this[_0x4d91('0x12')][_0x4aae23][_0x4d91('0x45')]){faxMessage[_0x4d91('0x46')](this[_0x4d91('0x12')][_0x4aae23][_0x4d91('0x45')],_0x4382ff)[_0x4d91('0x3c')](function(_0x8339dd){ut[_0x4d91('0x48')](_0x4d91('0x4d'),_0x8339dd);})[_0x4d91('0x3e')](function(_0x3e9154){ut[_0x4d91('0x48')](_0x4d91('0x4e'),_0x3e9154);})['finally'](function(){delete _0x413b25['channels'][_0x4aae23];delete _0x413b25['actions'][_0x4aae23];});}else{ut[_0x4d91('0x48')](_0x4d91('0x4f'));delete this[_0x4d91('0xf')][_0x4aae23];delete this['actions'][_0x4aae23];}};Fax[_0x4d91('0x21')][_0x4d91('0x50')]=function(_0x3985f3){var _0x4ac087=this;if(this['channels'][_0x3985f3['uniqueid']]){if(this[_0x4d91('0x12')][_0x3985f3[_0x4d91('0x27')]]){this[_0x4d91('0xf')][_0x3985f3[_0x4d91('0x27')]]['id']=this[_0x4d91('0x12')][_0x3985f3['uniqueid']]['id'];this[_0x4d91('0xf')][_0x3985f3[_0x4d91('0x27')]]['name']=this['actions'][_0x3985f3[_0x4d91('0x27')]]['name'];}logger[_0x4d91('0x2a')](_0x3985f3[_0x4d91('0x27')],this[_0x4d91('0x12')][_0x3985f3['uniqueid']]?_0x4d91('0x51'):_0x4d91('0x52'),JSON[_0x4d91('0x41')](this[_0x4d91('0xf')][_0x3985f3[_0x4d91('0x27')]]));if(this[_0x4d91('0x12')][_0x3985f3[_0x4d91('0x27')]]){if(this['channels'][_0x3985f3['uniqueid']]['faxpages']>0x0&&this['channels'][_0x3985f3[_0x4d91('0x27')]][_0x4d91('0x1a')]===_0x4d91('0x53')){this['updateStatus'](_0x3985f3[_0x4d91('0x27')],!![]);}else{this['updateStatus'](_0x3985f3[_0x4d91('0x27')],![],this[_0x4d91('0xf')][_0x3985f3['uniqueid']]['faxstatusstring']?_0x4d91('0x54')+this[_0x4d91('0xf')][_0x3985f3[_0x4d91('0x27')]][_0x4d91('0x55')]:_0x4d91('0x56'));}}}};Fax[_0x4d91('0x21')][_0x4d91('0x57')]=function(_0x42e550){var _0xd384a9=this;return new BPromise(function(_0xd660b3,_0x5bfb08){_0xd384a9['execOriginate'](_0x42e550,_0xd384a9[_0x4d91('0x10')][_0x42e550[_0x4d91('0x58')]])[_0x4d91('0x3c')](function(_0x13281d){ut[_0x4d91('0x48')](_0x4d91('0x59'),_0x13281d);_0xd660b3(ut[_0x4d91('0x5a')](_0x4d91('0x5b')));})[_0x4d91('0x3e')](function(_0x564885){ut['logger']('[Fax][execOriginate][failure]',_0x564885);updateStatus(_0x42e550);_0x5bfb08(ut['message'](_0x4d91('0x5c')));});});};Fax[_0x4d91('0x21')][_0x4d91('0x5d')]=function(_0x12f7de){var _0x8565e3=this;return new BPromise(function(_0x12fa2e,_0x37710b){var _0xa1b6e5=_0x8565e3[_0x4d91('0x5e')](_0x8565e3[_0x4d91('0x10')][_0x12f7de[_0x4d91('0x58')]][_0x4d91('0x5f')],_0x12f7de);if(_0xa1b6e5[_0x4d91('0x60')]){_0x12fa2e(ut[_0x4d91('0x5a')](_0x4d91('0x61')));}else{_0x37710b(ut[_0x4d91('0x5a')](_0xa1b6e5[_0x4d91('0x5a')]));}});};function originate(_0x5b3a38,_0x4062c6,_0x1be4b1){return new BPromise(function(_0xc4ef10,_0x2e2105){if(_0x1be4b1){var _0x1cad5b=util['format'](_0x4d91('0x62'),path[_0x4d91('0x39')](_0x5b3a38['path'])[_0x4d91('0x29')],_0x5b3a38[_0x4d91('0x4')]);gs[_0x4d91('0x63')](_0x1cad5b)[_0x4d91('0x3c')](function(){_0x5b3a38[_0x4d91('0x4')]=util['format'](_0x4d91('0x64'),path[_0x4d91('0x39')](_0x5b3a38['path'])[_0x4d91('0x65')],path[_0x4d91('0x39')](_0x5b3a38[_0x4d91('0x4')])['name']);_0x4062c6[_0x4d91('0x66')]=_0x5b3a38[_0x4d91('0x4')];ut[_0x4d91('0x48')](_0x4d91('0x67'),'');ami[_0x4d91('0x68')](ut[_0x4d91('0x69')](_0x5b3a38,_0x4062c6))[_0x4d91('0x3c')](function(_0x4fcc58){_0xc4ef10(_0x4fcc58);})[_0x4d91('0x3e')](function(_0x2e014b){_0x2e2105(_0x2e014b);});})['catch'](function(_0x221e44){_0x2e2105(_0x221e44);});}else{ami['Action'](ut['variablesAction'](_0x5b3a38,_0x4062c6))[_0x4d91('0x3c')](function(_0x4b19e2){_0xc4ef10(_0x4b19e2);})[_0x4d91('0x3e')](function(_0x1a4a33){_0x2e2105(_0x1a4a33);});}});}Fax[_0x4d91('0x21')][_0x4d91('0x6a')]=function(_0x10211f,_0x3fa0e0){var _0x17e61c=this;return new BPromise(function(_0x497f84,_0x485da1){var _0x1c27e7=uuid['v4']();var _0x431223=ut[_0x4d91('0x6b')](_0x10211f,_0x3fa0e0);_0x17e61c[_0x4d91('0x12')][_0x1c27e7]=new Action(_0x1c27e7,_0x3fa0e0,_0x10211f);var _0x1e3838=_0x17e61c['actions'][_0x1c27e7];if(path['parse'](_0x10211f[_0x4d91('0x4')])['ext']==='.pdf'){originate(_0x1e3838,_0x431223,!![])[_0x4d91('0x3c')](function(_0x54fea8){_0x497f84(_0x54fea8);})['catch'](function(_0x216c33){_0x485da1(_0x216c33);});}else{originate(_0x1e3838,_0x431223,![])[_0x4d91('0x3c')](function(_0x1987fa){_0x497f84(_0x1987fa);})['catch'](function(_0x5028c5){_0x485da1(_0x5028c5);});}});};Fax['prototype'][_0x4d91('0x6c')]=function(_0x8d84f3){return!_[_0x4d91('0x6d')](_0x8d84f3)&&!_[_0x4d91('0x6d')](_0x8d84f3[_0x4d91('0x29')])&&!_[_0x4d91('0x6d')](_0x8d84f3[_0x4d91('0x6e')])&&_0x8d84f3[_0x4d91('0x6e')]&&!_[_0x4d91('0x6d')](this['trunks'][util[_0x4d91('0x6f')]('SIP/%s',_0x8d84f3['name'])])&&!_[_0x4d91('0x6d')](this[_0x4d91('0x11')][util[_0x4d91('0x6f')](_0x4d91('0x70'),_0x8d84f3['name'])][_0x4d91('0x30')])&&(this[_0x4d91('0x11')][util[_0x4d91('0x6f')](_0x4d91('0x70'),_0x8d84f3[_0x4d91('0x29')])][_0x4d91('0x30')]===_0x4d91('0x71')||this['trunks'][util[_0x4d91('0x6f')](_0x4d91('0x70'),_0x8d84f3[_0x4d91('0x29')])]['status']===_0x4d91('0x72'));};Fax[_0x4d91('0x21')][_0x4d91('0x5e')]=function(_0x2f4796,_0xb3688a){if(!this[_0x4d91('0x6c')](_0x2f4796)){ut['logger'](_0x4d91('0x73'),_['isNil'](_0x2f4796)?'':_0x2f4796[_0x4d91('0x29')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x4d91('0x74')};}if(_[_0x4d91('0x6d')](_0xb3688a['fax'])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x4d91('0x41')](_0xb3688a));return{'isValid':![],'message':_0x4d91('0x75')};}if(_[_0x4d91('0x6d')](_0xb3688a[_0x4d91('0x4')])){ut[_0x4d91('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0xb3688a));return{'isValid':![],'message':_0x4d91('0x76')};}return{'isValid':!![],'message':_0x4d91('0x77')};};module[_0x4d91('0x78')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 38c34d5..a005c54 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 _0x70d1=['lodash','error','inspect','resolve','then','catch','[Notify]\x20','bluebird'];(function(_0x242cbb,_0x2e86cc){var _0x478ffc=function(_0x1d171a){while(--_0x1d171a){_0x242cbb['push'](_0x242cbb['shift']());}};_0x478ffc(++_0x2e86cc);}(_0x70d1,0x1a7));var _0x170d=function(_0x18a378,_0x46dc75){_0x18a378=_0x18a378-0x0;var _0x23760a=_0x70d1[_0x18a378];return _0x23760a;};'use strict';var util=require('util');var BPromise=require(_0x170d('0x0'));var logger=require('../../../config/logger')('preview');var _=require(_0x170d('0x1'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x2e9e57){return function(_0x56504c){logger[_0x170d('0x2')](_0x2e9e57,util[_0x170d('0x3')](_0x56504c,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x275c79,_0x39a321){return BPromise[_0x170d('0x4')]()[_0x170d('0x5')](faxAccount['notify'](_0x275c79,_0x39a321))[_0x170d('0x6')](loggerCatch(_0x170d('0x7')));}; \ No newline at end of file +var _0xade6=['[Notify]\x20','../../../config/logger','preview','error','inspect','notify','then','catch'];(function(_0x533d54,_0x29c8ab){var _0x4e03f5=function(_0x1e9f54){while(--_0x1e9f54){_0x533d54['push'](_0x533d54['shift']());}};_0x4e03f5(++_0x29c8ab);}(_0xade6,0x1e9));var _0x6ade=function(_0x51ec61,_0xf9d1e3){_0x51ec61=_0x51ec61-0x0;var _0x223200=_0xade6[_0x51ec61];return _0x223200;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x6ade('0x0'))(_0x6ade('0x1'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0xe0006b){return function(_0x5379f4){logger[_0x6ade('0x2')](_0xe0006b,util[_0x6ade('0x3')](_0x5379f4,{'showHidden':![],'depth':null}));};}exports[_0x6ade('0x4')]=function(_0x3fbce5,_0x551108){return BPromise['resolve']()[_0x6ade('0x5')](faxAccount[_0x6ade('0x4')](_0x3fbce5,_0x551108))[_0x6ade('0x6')](loggerCatch(_0x6ade('0x7')));}; \ 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 92af239..ddcc05a 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 _0xe371=['bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax'];(function(_0x62bed4,_0x5dc443){var _0x17f3e=function(_0x1fedfe){while(--_0x1fedfe){_0x62bed4['push'](_0x62bed4['shift']());}};_0x17f3e(++_0x5dc443);}(_0xe371,0x152));var _0x1e37=function(_0x5c534b,_0x2da243){_0x5c534b=_0x5c534b-0x0;var _0x209626=_0xe371[_0x5c534b];return _0x209626;};'use strict';var util=require('util');var logger=require(_0x1e37('0x0'))(_0x1e37('0x1'));var BPromise=require(_0x1e37('0x2'));var exec=require(_0x1e37('0x3'))[_0x1e37('0x4')];exports[_0x1e37('0x5')]=function(_0x191abd){return new BPromise(function(_0x166a7d,_0x2b98a2){exec(_0x191abd,function(_0x33f2e9,_0x517da2,_0xf230d0){logger[_0x1e37('0x6')](_0x1e37('0x7'),_0x517da2);if(_0x33f2e9){logger[_0x1e37('0x6')](_0x1e37('0x7'),_0x1e37('0x8'),util[_0x1e37('0x9')](_0x33f2e9,{'showHidden':![],'depth':null}),_0x517da2,_0xf230d0);_0x2b98a2(_0x33f2e9);}_0x166a7d(_0x517da2);});});}; \ No newline at end of file +var _0x1453=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','child_process'];(function(_0x136685,_0x3c435a){var _0x2561e4=function(_0x5a92eb){while(--_0x5a92eb){_0x136685['push'](_0x136685['shift']());}};_0x2561e4(++_0x3c435a);}(_0x1453,0x188));var _0x3145=function(_0x25ab63,_0x418a66){_0x25ab63=_0x25ab63-0x0;var _0x47e56b=_0x1453[_0x25ab63];return _0x47e56b;};'use strict';var util=require('util');var logger=require(_0x3145('0x0'))(_0x3145('0x1'));var BPromise=require(_0x3145('0x2'));var exec=require(_0x3145('0x3'))['exec'];exports[_0x3145('0x4')]=function(_0x14411f){return new BPromise(function(_0xb20477,_0xb2c25f){exec(_0x14411f,function(_0x58942c,_0x2f14b3,_0x55520a){logger[_0x3145('0x5')](_0x3145('0x6'),_0x2f14b3);if(_0x58942c){logger[_0x3145('0x5')](_0x3145('0x6'),_0x3145('0x7'),util[_0x3145('0x8')](_0x58942c,{'showHidden':![],'depth':null}),_0x2f14b3,_0x55520a);_0xb2c25f(_0x58942c);}_0xb20477(_0x2f14b3);});});}; \ 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 015c2af..f83654f 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 _0xc2bb=['inspect','addVariables','ecm','minrate','format','\x22%s\x22','modem','gateway','path','variablesAction','uniqueid','originate','from-sip','headerinfo','localstationid','util','moment','logger','info'];(function(_0x2ca985,_0x52a78c){var _0x5c9ce9=function(_0x2c303d){while(--_0x2c303d){_0x2ca985['push'](_0x2ca985['shift']());}};_0x5c9ce9(++_0x52a78c);}(_0xc2bb,0x19e));var _0xbc2b=function(_0x1805bd,_0x1c1e7d){_0x1805bd=_0x1805bd-0x0;var _0x56b6f1=_0xc2bb[_0x1805bd];return _0x56b6f1;};'use strict';var util=require(_0xbc2b('0x0'));var _=require('lodash');var moment=require(_0xbc2b('0x1'));var logger=require('../../../../config/logger')('fax');exports['message']=function(_0x38b960){return{'message':_0x38b960};};exports[_0xbc2b('0x2')]=function(_0x5c453d,_0x425d4c){logger[_0xbc2b('0x3')](_0x5c453d,util[_0xbc2b('0x4')](_0x425d4c,{'showHidden':![],'depth':null}));};exports[_0xbc2b('0x5')]=function(_0x4dcecd,_0x11f7c6){var _0x268427={'XMF-ECM':_0x11f7c6[_0xbc2b('0x6')],'XMF-HEADERINFO':_0x11f7c6['headerinfo'],'XMF-MINRATE':_0x11f7c6[_0xbc2b('0x7')],'XMF-MAXRATE':_0x11f7c6['maxrate'],'XMF-MODEM':util[_0xbc2b('0x8')](_0xbc2b('0x9'),_0x11f7c6[_0xbc2b('0xa')]),'XMF-GATEWAY':_0x11f7c6[_0xbc2b('0xb')],'XMF-FAXDETECT':_0x11f7c6['faxdetect'],'XMF-T38TIMEOUT':_0x11f7c6['t38timeout'],'XMF-LOCALSTATIONID':_0x11f7c6['localstationid'],'XMF-PATH':_0x4dcecd[_0xbc2b('0xc')]};return _0x268427;};exports[_0xbc2b('0xd')]=function(_0x4d1263,_0x3ca295){return{'actionid':_0x4d1263[_0xbc2b('0xe')],'action':_0xbc2b('0xf'),'channel':_0x4d1263['channel'],'Exten':'xcally-motion-fax','Context':_0xbc2b('0x10'),'Priority':'1','callerid':util[_0xbc2b('0x8')]('\x22%s\x22\x20<%s>',_0x4d1263[_0xbc2b('0x11')]?_0x4d1263['headerinfo']:'',_0x4d1263[_0xbc2b('0x12')]),'variable':_0x3ca295,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4d1263['uniqueid']};}; \ No newline at end of file +var _0x6db3=['moment','../../../../config/logger','fax','message','logger','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','variablesAction','uniqueid','from-sip','\x22%s\x22\x20<%s>'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6db3,0xc6));var _0x36db=function(_0x1c6ef2,_0x8d926a){_0x1c6ef2=_0x1c6ef2-0x0;var _0x404b8c=_0x6db3[_0x1c6ef2];return _0x404b8c;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x36db('0x0'));var logger=require(_0x36db('0x1'))(_0x36db('0x2'));exports[_0x36db('0x3')]=function(_0x55b8e1){return{'message':_0x55b8e1};};exports[_0x36db('0x4')]=function(_0x3040ad,_0x41c4f6){logger['info'](_0x3040ad,util[_0x36db('0x5')](_0x41c4f6,{'showHidden':![],'depth':null}));};exports[_0x36db('0x6')]=function(_0x4d932a,_0x177fc7){var _0x1948b5={'XMF-ECM':_0x177fc7[_0x36db('0x7')],'XMF-HEADERINFO':_0x177fc7[_0x36db('0x8')],'XMF-MINRATE':_0x177fc7[_0x36db('0x9')],'XMF-MAXRATE':_0x177fc7[_0x36db('0xa')],'XMF-MODEM':util[_0x36db('0xb')](_0x36db('0xc'),_0x177fc7[_0x36db('0xd')]),'XMF-GATEWAY':_0x177fc7[_0x36db('0xe')],'XMF-FAXDETECT':_0x177fc7['faxdetect'],'XMF-T38TIMEOUT':_0x177fc7[_0x36db('0xf')],'XMF-LOCALSTATIONID':_0x177fc7[_0x36db('0x10')],'XMF-PATH':_0x4d932a[_0x36db('0x11')]};return _0x1948b5;};exports[_0x36db('0x12')]=function(_0x14d965,_0x5be620){return{'actionid':_0x14d965[_0x36db('0x13')],'action':'originate','channel':_0x14d965['channel'],'Exten':'xcally-motion-fax','Context':_0x36db('0x14'),'Priority':'1','callerid':util[_0x36db('0xb')](_0x36db('0x15'),_0x14d965[_0x36db('0x8')]?_0x14d965[_0x36db('0x8')]:'',_0x14d965[_0x36db('0x10')]),'variable':_0x5be620,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x14d965['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 981da3e..ae7ded5 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 _0xf6c6=['getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','util','moment','./server','./realtime','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0xf6c6,0xe3));var _0x6f6c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf6c6[_0x4a9fb1];return _0x348672;};'use strict';var BPromise=require('bluebird');var util=require(_0x6f6c('0x0'));var moment=require(_0x6f6c('0x1'));var server=require(_0x6f6c('0x2'));var Realtime=require(_0x6f6c('0x3'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0x6f6c('0x4'));var Dialer=require(_0x6f6c('0x5'));var Preview=require(_0x6f6c('0x6'));var Fax=require('./fax');var user=require(_0x6f6c('0x7'));var voiceQueue=require(_0x6f6c('0x8'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x6f6c('0x9'));var trunk=require(_0x6f6c('0xa'));var trigger=require('./rpc/trigger');var template=require(_0x6f6c('0xb'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x6f6c('0xc'));var voiceExtension=require(_0x6f6c('0xd'));var faxAccount=require(_0x6f6c('0xe'));var zendesk=require(_0x6f6c('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x6f6c('0x10'));var freshdesk=require(_0x6f6c('0x11'));var desk=require(_0x6f6c('0x12'));var zoho=require(_0x6f6c('0x13'));var vtiger=require(_0x6f6c('0x14'));var freshsales=require(_0x6f6c('0x15'));var servicenow=require(_0x6f6c('0x16'));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('../../config/logger')(_0x6f6c('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x6f6c('0x18')](_0x6f6c('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6f6c('0x18')](_0x6f6c('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x6f6c('0x1a')]()[_0x6f6c('0x1b')](user[_0x6f6c('0x1c')]())[_0x6f6c('0x1b')](realtime[_0x6f6c('0x1d')]())[_0x6f6c('0x1b')](user[_0x6f6c('0x1e')]())[_0x6f6c('0x1b')](realtime[_0x6f6c('0x1f')]())[_0x6f6c('0x1b')](trunk[_0x6f6c('0x20')]())[_0x6f6c('0x1b')](realtime['initTrunks']())[_0x6f6c('0x1b')](voiceQueue[_0x6f6c('0x21')]())[_0x6f6c('0x1b')](realtime[_0x6f6c('0x22')]())[_0x6f6c('0x1b')](trigger[_0x6f6c('0x23')]())[_0x6f6c('0x1b')](realtime[_0x6f6c('0x24')]())[_0x6f6c('0x1b')](template[_0x6f6c('0x25')]())[_0x6f6c('0x1b')](realtime[_0x6f6c('0x26')]())[_0x6f6c('0x1b')](zendesk[_0x6f6c('0x27')]())['then'](realtime['initZendeskAccounts']())[_0x6f6c('0x1b')](salesforce[_0x6f6c('0x28')]())[_0x6f6c('0x1b')](realtime[_0x6f6c('0x29')]())[_0x6f6c('0x1b')](sugarcrm[_0x6f6c('0x2a')]())[_0x6f6c('0x1b')](realtime[_0x6f6c('0x2b')]())[_0x6f6c('0x1b')](freshdesk[_0x6f6c('0x2c')]())[_0x6f6c('0x1b')](realtime[_0x6f6c('0x2d')]())[_0x6f6c('0x1b')](desk[_0x6f6c('0x2e')]())['then'](realtime[_0x6f6c('0x2f')]())[_0x6f6c('0x1b')](zoho['getZohoAccounts']())['then'](realtime['initZohoAccounts']())[_0x6f6c('0x1b')](vtiger[_0x6f6c('0x30')]())['then'](realtime[_0x6f6c('0x31')]())[_0x6f6c('0x1b')](freshsales[_0x6f6c('0x32')]())[_0x6f6c('0x1b')](realtime['initFreshsalesAccounts']())[_0x6f6c('0x1b')](servicenow[_0x6f6c('0x33')]())[_0x6f6c('0x1b')](realtime[_0x6f6c('0x34')]())['then'](dynamics365[_0x6f6c('0x35')]())[_0x6f6c('0x1b')](realtime[_0x6f6c('0x36')]())['then'](campaign[_0x6f6c('0x37')]())['then'](realtime[_0x6f6c('0x38')]())[_0x6f6c('0x1b')](voiceExtension['getVoiceExtensions']())['then'](realtime['initVoiceExtensions']())['then'](faxAccount[_0x6f6c('0x39')]())[_0x6f6c('0x1b')](realtime[_0x6f6c('0x3a')]())[_0x6f6c('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0x6f6c('0x1a')]()[_0x6f6c('0x1b')](voiceQueueReport[_0x6f6c('0x3b')]())[_0x6f6c('0x1b')](realtime[_0x6f6c('0x3c')]())[_0x6f6c('0x1b')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x6f6c('0x1b')](realtime[_0x6f6c('0x3d')]())[_0x6f6c('0x1b')](cmHopperHistory[_0x6f6c('0x3e')]())[_0x6f6c('0x1b')](realtime[_0x6f6c('0x3f')]())[_0x6f6c('0x1b')](voiceCallReport[_0x6f6c('0x40')]())[_0x6f6c('0x1b')](realtime[_0x6f6c('0x41')]())[_0x6f6c('0x42')](function(_0xed9dd0){logger[_0x6f6c('0x43')]('[index.js][initParams]',util[_0x6f6c('0x44')](_0xed9dd0,{'showHidden':![],'depth':null}));});}function main(){return server[_0x6f6c('0x45')](realtime,preview,fax)[_0x6f6c('0x1b')](function(_0x5cd49b){return initRealtime();})[_0x6f6c('0x1b')](function(){return initParams();})[_0x6f6c('0x1b')](function(){report[_0x6f6c('0x46')]();setInterval(initRealtime,0x1388);})[_0x6f6c('0x42')](function(_0x4f174d){logger[_0x6f6c('0x43')]('[index.js][main]',util[_0x6f6c('0x44')](_0x4f174d,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x6c47=['./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','initVoiceCallReports','error','inspect','listen','sync','bluebird','util','moment','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory'];(function(_0x176b38,_0x113712){var _0x345045=function(_0xaf73a4){while(--_0xaf73a4){_0x176b38['push'](_0x176b38['shift']());}};_0x345045(++_0x113712);}(_0x6c47,0x188));var _0x76c4=function(_0x212716,_0x45a7a3){_0x212716=_0x212716-0x0;var _0x1a0df4=_0x6c47[_0x212716];return _0x1a0df4;};'use strict';var BPromise=require(_0x76c4('0x0'));var util=require(_0x76c4('0x1'));var moment=require(_0x76c4('0x2'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x76c4('0x3'));var Acw=require(_0x76c4('0x4'));var Trigger=require(_0x76c4('0x5'));var Dialer=require('./dialer');var Preview=require(_0x76c4('0x6'));var Fax=require(_0x76c4('0x7'));var user=require(_0x76c4('0x8'));var voiceQueue=require(_0x76c4('0x9'));var voiceQueueReport=require(_0x76c4('0xa'));var voiceCallReport=require(_0x76c4('0xb'));var trunk=require(_0x76c4('0xc'));var trigger=require(_0x76c4('0xd'));var template=require(_0x76c4('0xe'));var cmHopperHistory=require(_0x76c4('0xf'));var campaign=require(_0x76c4('0x10'));var voiceExtension=require(_0x76c4('0x11'));var faxAccount=require(_0x76c4('0x12'));var zendesk=require(_0x76c4('0x13'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x76c4('0x14'));var freshdesk=require(_0x76c4('0x15'));var desk=require(_0x76c4('0x16'));var zoho=require(_0x76c4('0x17'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x76c4('0x18'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x76c4('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x76c4('0x1a'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x76c4('0x1b')](_0x76c4('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x76c4('0x1b')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x76c4('0x1d')]()[_0x76c4('0x1e')](user[_0x76c4('0x1f')]())[_0x76c4('0x1e')](realtime[_0x76c4('0x20')]())[_0x76c4('0x1e')](user[_0x76c4('0x21')]())[_0x76c4('0x1e')](realtime[_0x76c4('0x22')]())['then'](trunk[_0x76c4('0x23')]())[_0x76c4('0x1e')](realtime[_0x76c4('0x24')]())[_0x76c4('0x1e')](voiceQueue[_0x76c4('0x25')]())[_0x76c4('0x1e')](realtime['initVoiceQueues']())[_0x76c4('0x1e')](trigger[_0x76c4('0x26')]())[_0x76c4('0x1e')](realtime['initTriggers']())['then'](template[_0x76c4('0x27')]())[_0x76c4('0x1e')](realtime[_0x76c4('0x28')]())[_0x76c4('0x1e')](zendesk['getZendeskAccounts']())[_0x76c4('0x1e')](realtime['initZendeskAccounts']())['then'](salesforce[_0x76c4('0x29')]())['then'](realtime[_0x76c4('0x2a')]())['then'](sugarcrm[_0x76c4('0x2b')]())[_0x76c4('0x1e')](realtime[_0x76c4('0x2c')]())[_0x76c4('0x1e')](freshdesk[_0x76c4('0x2d')]())[_0x76c4('0x1e')](realtime['initFreshdeskAccounts']())[_0x76c4('0x1e')](desk[_0x76c4('0x2e')]())['then'](realtime[_0x76c4('0x2f')]())[_0x76c4('0x1e')](zoho[_0x76c4('0x30')]())['then'](realtime[_0x76c4('0x31')]())['then'](vtiger[_0x76c4('0x32')]())[_0x76c4('0x1e')](realtime[_0x76c4('0x33')]())[_0x76c4('0x1e')](freshsales['getFreshsalesAccounts']())[_0x76c4('0x1e')](realtime[_0x76c4('0x34')]())[_0x76c4('0x1e')](servicenow['getServicenowAccounts']())[_0x76c4('0x1e')](realtime[_0x76c4('0x35')]())[_0x76c4('0x1e')](dynamics365[_0x76c4('0x36')]())[_0x76c4('0x1e')](realtime['initDynamics365Accounts']())['then'](campaign[_0x76c4('0x37')]())[_0x76c4('0x1e')](realtime['initCampaigns']())[_0x76c4('0x1e')](voiceExtension[_0x76c4('0x38')]())[_0x76c4('0x1e')](realtime[_0x76c4('0x39')]())[_0x76c4('0x1e')](faxAccount['getFaxAccounts']())['then'](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x76c4('0x1d')]()[_0x76c4('0x1e')](voiceQueueReport[_0x76c4('0x3a')]())[_0x76c4('0x1e')](realtime[_0x76c4('0x3b')]())['then'](cmHopperHistory[_0x76c4('0x3c')]())['then'](realtime[_0x76c4('0x3d')]())[_0x76c4('0x1e')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0x76c4('0x3e')]())['then'](voiceCallReport['getVoiceCallReports']())[_0x76c4('0x1e')](realtime[_0x76c4('0x3f')]())['catch'](function(_0x3460cb){logger[_0x76c4('0x40')]('[index.js][initParams]',util[_0x76c4('0x41')](_0x3460cb,{'showHidden':![],'depth':null}));});}function main(){return server[_0x76c4('0x42')](realtime,preview,fax)['then'](function(_0x15118a){return initRealtime();})[_0x76c4('0x1e')](function(){return initParams();})[_0x76c4('0x1e')](function(){report[_0x76c4('0x43')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x48ad65){logger[_0x76c4('0x40')]('[index.js][main]',util['inspect'](_0x48ad65,{'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 fa74951..5e70960 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0xf235cb,_0x14a0e4){var _0x5e0763=function(_0x1c4450){while(--_0x1c4450){_0xf235cb['push'](_0xf235cb['shift']());}};_0x5e0763(++_0x14a0e4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 61cbae9..27d67ad 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 _0x6b4a=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0xe5e5bd,_0x280535){var _0x57120e=function(_0x3461eb){while(--_0x3461eb){_0xe5e5bd['push'](_0xe5e5bd['shift']());}};_0x57120e(++_0x280535);}(_0x6b4a,0x13a));var _0xa6b4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6b4a[_0x14add3];return _0x4a174f;};'use strict';function Campaign(_0x5c6ed4){this['id']=_0x5c6ed4['id']||0x0;this['name']=_0x5c6ed4[_0xa6b4('0x0')]||'';this['type']=_0x5c6ed4[_0xa6b4('0x1')]||_0xa6b4('0x2');this[_0xa6b4('0x3')]=0x0;this[_0xa6b4('0x4')]=0x0;this[_0xa6b4('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xa6b4('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0xa6b4('0x7')]=_0x5c6ed4['active'];this[_0xa6b4('0x8')]=_0x5c6ed4[_0xa6b4('0x8')];this[_0xa6b4('0x9')]=_0x5c6ed4[_0xa6b4('0x9')]||null;this[_0xa6b4('0xa')]=_0x5c6ed4[_0xa6b4('0xa')]?_0x5c6ed4['dialGlobalInterval']:null;this[_0xa6b4('0xb')]=_0x5c6ed4[_0xa6b4('0xb')];this['dialOriginateCallerIdNumber']=_0x5c6ed4[_0xa6b4('0xc')];this[_0xa6b4('0xd')]=_0x5c6ed4[_0xa6b4('0xd')]||0x1e;this[_0xa6b4('0xe')]=_0x5c6ed4['dialCongestionMaxRetry'];this[_0xa6b4('0xf')]=_0x5c6ed4[_0xa6b4('0xf')];this['dialBusyMaxRetry']=_0x5c6ed4[_0xa6b4('0x10')];this[_0xa6b4('0x11')]=_0x5c6ed4[_0xa6b4('0x11')];this[_0xa6b4('0x12')]=_0x5c6ed4[_0xa6b4('0x12')];this['dialNoAnswerRetryFrequency']=_0x5c6ed4[_0xa6b4('0x13')];this[_0xa6b4('0x14')]=_0x5c6ed4[_0xa6b4('0x14')];this['dialNoSuchNumberMaxRetry']=_0x5c6ed4[_0xa6b4('0x15')]||0x3;this[_0xa6b4('0x16')]=_0x5c6ed4[_0xa6b4('0x16')]||0x96;this[_0xa6b4('0x17')]=_0x5c6ed4[_0xa6b4('0x17')]||0x3;this[_0xa6b4('0x18')]=_0x5c6ed4[_0xa6b4('0x18')]||0x96;this[_0xa6b4('0x19')]=_0x5c6ed4[_0xa6b4('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x5c6ed4['dialAbandonedRetryFrequency']||0x96;this[_0xa6b4('0x1a')]=_0x5c6ed4[_0xa6b4('0x1a')]||0x3;this[_0xa6b4('0x1b')]=_0x5c6ed4[_0xa6b4('0x1b')]||0x96;this[_0xa6b4('0x1c')]=_0x5c6ed4['dialAgentRejectMaxRetry']||0x3;this[_0xa6b4('0x1d')]=_0x5c6ed4[_0xa6b4('0x1d')]||0x96;this[_0xa6b4('0x1e')]=_0x5c6ed4[_0xa6b4('0x1e')]||_0xa6b4('0x1f');this[_0xa6b4('0x20')]=_0x5c6ed4[_0xa6b4('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x5c6ed4[_0xa6b4('0x21')]||undefined;this['dialCutDigit']=_0x5c6ed4[_0xa6b4('0x22')]||undefined;this[_0xa6b4('0x23')]=_0x5c6ed4[_0xa6b4('0x23')]?_0x5c6ed4['TrunkBackup']:undefined;this[_0xa6b4('0x24')]=_0x5c6ed4[_0xa6b4('0x24')]?_0x5c6ed4[_0xa6b4('0x24')]:undefined;this[_0xa6b4('0x25')]=_0x5c6ed4[_0xa6b4('0x25')]?_0x5c6ed4['Interval']:undefined;this[_0xa6b4('0x26')]=_0x5c6ed4[_0xa6b4('0x26')]?_0x5c6ed4[_0xa6b4('0x26')]:undefined;this[_0xa6b4('0x27')]=_0x5c6ed4[_0xa6b4('0x26')]?_0x5c6ed4[_0xa6b4('0x26')][_0xa6b4('0x0')]:undefined;this[_0xa6b4('0x28')]=_0x5c6ed4[_0xa6b4('0x28')]||![];this[_0xa6b4('0x29')]=_0x5c6ed4['dialAMDInitialSilence'];this[_0xa6b4('0x2a')]=_0x5c6ed4[_0xa6b4('0x2a')];this['dialAMDAfterGreetingSilence']=_0x5c6ed4[_0xa6b4('0x2b')];this[_0xa6b4('0x2c')]=_0x5c6ed4['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x5c6ed4[_0xa6b4('0x2d')];this[_0xa6b4('0x2e')]=_0x5c6ed4['dialAMDBetweenWordsSilence'];this[_0xa6b4('0x2f')]=_0x5c6ed4[_0xa6b4('0x2f')];this[_0xa6b4('0x30')]=_0x5c6ed4[_0xa6b4('0x30')];this['dialAMDMaximumWordLength']=_0x5c6ed4[_0xa6b4('0x31')];}module[_0xa6b4('0x32')]=Campaign; \ No newline at end of file +var _0xeb32=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x622035,_0x1a4b91){var _0x326cf2=function(_0x5c3002){while(--_0x5c3002){_0x622035['push'](_0x622035['shift']());}};_0x326cf2(++_0x1a4b91);}(_0xeb32,0x12b));var _0x2eb3=function(_0x4b2e59,_0x3b1f48){_0x4b2e59=_0x4b2e59-0x0;var _0x1313a6=_0xeb32[_0x4b2e59];return _0x1313a6;};'use strict';function Campaign(_0x4f00da){this['id']=_0x4f00da['id']||0x0;this[_0x2eb3('0x0')]=_0x4f00da['name']||'';this[_0x2eb3('0x1')]=_0x4f00da[_0x2eb3('0x1')]||_0x2eb3('0x2');this[_0x2eb3('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x2eb3('0x4')]=!![];this['active']=_0x4f00da[_0x2eb3('0x5')];this[_0x2eb3('0x6')]=_0x4f00da[_0x2eb3('0x6')];this['dialTimezone']=_0x4f00da[_0x2eb3('0x7')]||null;this[_0x2eb3('0x8')]=_0x4f00da[_0x2eb3('0x8')]?_0x4f00da[_0x2eb3('0x8')]:null;this['dialOriginateCallerIdName']=_0x4f00da['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x4f00da[_0x2eb3('0x9')];this[_0x2eb3('0xa')]=_0x4f00da[_0x2eb3('0xa')]||0x1e;this[_0x2eb3('0xb')]=_0x4f00da[_0x2eb3('0xb')];this['dialCongestionRetryFrequency']=_0x4f00da[_0x2eb3('0xc')];this['dialBusyMaxRetry']=_0x4f00da['dialBusyMaxRetry'];this[_0x2eb3('0xd')]=_0x4f00da[_0x2eb3('0xd')];this['dialNoAnswerMaxRetry']=_0x4f00da[_0x2eb3('0xe')];this[_0x2eb3('0xf')]=_0x4f00da['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x4f00da['dialGlobalMaxRetry'];this[_0x2eb3('0x10')]=_0x4f00da[_0x2eb3('0x10')]||0x3;this[_0x2eb3('0x11')]=_0x4f00da['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x4f00da['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x4f00da[_0x2eb3('0x12')]||0x96;this[_0x2eb3('0x13')]=_0x4f00da[_0x2eb3('0x13')]||0x3;this[_0x2eb3('0x14')]=_0x4f00da[_0x2eb3('0x14')]||0x96;this[_0x2eb3('0x15')]=_0x4f00da[_0x2eb3('0x15')]||0x3;this['dialMachineRetryFrequency']=_0x4f00da[_0x2eb3('0x16')]||0x96;this[_0x2eb3('0x17')]=_0x4f00da['dialAgentRejectMaxRetry']||0x3;this[_0x2eb3('0x18')]=_0x4f00da[_0x2eb3('0x18')]||0x96;this[_0x2eb3('0x19')]=_0x4f00da[_0x2eb3('0x19')]||_0x2eb3('0x1a');this[_0x2eb3('0x1b')]=_0x4f00da[_0x2eb3('0x1b')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x4f00da[_0x2eb3('0x1c')]||undefined;this[_0x2eb3('0x1d')]=_0x4f00da['dialCutDigit']||undefined;this[_0x2eb3('0x1e')]=_0x4f00da[_0x2eb3('0x1e')]?_0x4f00da['TrunkBackup']:undefined;this['Trunk']=_0x4f00da['Trunk']?_0x4f00da[_0x2eb3('0x1f')]:undefined;this[_0x2eb3('0x20')]=_0x4f00da[_0x2eb3('0x20')]?_0x4f00da[_0x2eb3('0x20')]:undefined;this[_0x2eb3('0x21')]=_0x4f00da[_0x2eb3('0x21')]?_0x4f00da[_0x2eb3('0x21')]:undefined;this[_0x2eb3('0x22')]=_0x4f00da[_0x2eb3('0x21')]?_0x4f00da[_0x2eb3('0x21')][_0x2eb3('0x0')]:undefined;this[_0x2eb3('0x23')]=_0x4f00da['dialAMDActive']||![];this[_0x2eb3('0x24')]=_0x4f00da[_0x2eb3('0x24')];this[_0x2eb3('0x25')]=_0x4f00da[_0x2eb3('0x25')];this[_0x2eb3('0x26')]=_0x4f00da[_0x2eb3('0x26')];this[_0x2eb3('0x27')]=_0x4f00da['dialAMDTotalAnalysisTime'];this[_0x2eb3('0x28')]=_0x4f00da[_0x2eb3('0x28')];this[_0x2eb3('0x29')]=_0x4f00da[_0x2eb3('0x29')];this['dialAMDMaximumNumberOfWords']=_0x4f00da[_0x2eb3('0x2a')];this['dialAMDSilenceThreshold']=_0x4f00da[_0x2eb3('0x2b')];this[_0x2eb3('0x2c')]=_0x4f00da[_0x2eb3('0x2c')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 2bc4e9a..2a72b0e 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 _0x6901=['unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitor','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel','calleridnum','connectedlinename','accountcode','linkedid','answertime','endtime'];(function(_0x1d3892,_0x47d5fe){var _0x574ff2=function(_0x5cc441){while(--_0x5cc441){_0x1d3892['push'](_0x1d3892['shift']());}};_0x574ff2(++_0x47d5fe);}(_0x6901,0x100));var _0x1690=function(_0x26a872,_0x3a1851){_0x26a872=_0x26a872-0x0;var _0x3913c5=_0x6901[_0x26a872];return _0x3913c5;};'use strict';function Channel(){this[_0x1690('0x0')]=null;this['channel']='';this[_0x1690('0x1')]='';this[_0x1690('0x2')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0x1690('0x3')]=undefined;this[_0x1690('0x4')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0x1690('0x5')]=0x0;this['exten']=0x0;this['answered']=![];this[_0x1690('0x6')]=null;this[_0x1690('0x7')]=null;this[_0x1690('0x8')]=![];this[_0x1690('0x9')]=![];this[_0x1690('0xa')]='';this[_0x1690('0xb')]='';this['duration']=0x0;this[_0x1690('0xc')]=0x0;this[_0x1690('0xd')]=0x0;this[_0x1690('0xe')]=null;this[_0x1690('0xf')]=null;this[_0x1690('0x10')]=null;this[_0x1690('0x11')]=![];this['monitorFilename']=null;this[_0x1690('0x12')]=null;this[_0x1690('0x13')]=[];this['transfercalleridnum']=undefined;this[_0x1690('0x14')]=undefined;this[_0x1690('0x15')]=undefined;this[_0x1690('0x16')]=0x0;}module[_0x1690('0x17')]=Channel; \ No newline at end of file +var _0xb6da=['calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','exten','answered','answertime','endtime','unmanaged','abandoned','lastdata','billableseconds','tag','disposition','monitorFilename','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel'];(function(_0x1d54b3,_0x328895){var _0x1164fd=function(_0x4ac186){while(--_0x4ac186){_0x1d54b3['push'](_0x1d54b3['shift']());}};_0x1164fd(++_0x328895);}(_0xb6da,0x8e));var _0xab6d=function(_0x1bba3c,_0x219e89){_0x1bba3c=_0x1bba3c-0x0;var _0x2a8973=_0xb6da[_0x1bba3c];return _0x2a8973;};'use strict';function Channel(){this[_0xab6d('0x0')]=null;this['channel']='';this[_0xab6d('0x1')]='';this[_0xab6d('0x2')]=0x0;this[_0xab6d('0x3')]='';this[_0xab6d('0x4')]=undefined;this[_0xab6d('0x5')]=undefined;this[_0xab6d('0x6')]=0x0;this[_0xab6d('0x7')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0xab6d('0x8')]=0x0;this[_0xab6d('0x9')]=![];this[_0xab6d('0xa')]=null;this[_0xab6d('0xb')]=null;this[_0xab6d('0xc')]=![];this[_0xab6d('0xd')]=![];this['lastapplication']='';this[_0xab6d('0xe')]='';this['duration']=0x0;this[_0xab6d('0xf')]=0x0;this['holdtime']=0x0;this['type']=null;this[_0xab6d('0x10')]=null;this[_0xab6d('0x11')]=null;this['monitor']=![];this[_0xab6d('0x12')]=null;this['queue']=null;this['monitors']=[];this[_0xab6d('0x13')]=undefined;this[_0xab6d('0x14')]=undefined;this[_0xab6d('0x15')]=undefined;this[_0xab6d('0x16')]=0x0;}module[_0xab6d('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index dde7793..2b6537d 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 _0x3ff1=['tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x3ff1,0x1e5));var _0x13ff=function(_0x554c2e,_0x52b498){_0x554c2e=_0x554c2e-0x0;var _0xd4cee9=_0x3ff1[_0x554c2e];return _0xd4cee9;};'use strict';function DeskAccount(_0x10f7c9){this['id']=_0x10f7c9['id']||0x0;this[_0x13ff('0x0')]=_0x10f7c9['name']||'';this['username']=_0x10f7c9['username']||'';this[_0x13ff('0x1')]=_0x10f7c9[_0x13ff('0x1')]||'';this[_0x13ff('0x2')]=_0x10f7c9[_0x13ff('0x2')]||'';this[_0x13ff('0x3')]=_0x10f7c9[_0x13ff('0x3')]||'';this['consumerKey']=_0x10f7c9[_0x13ff('0x4')]||'';this[_0x13ff('0x5')]=_0x10f7c9[_0x13ff('0x5')]||'';this['token']=_0x10f7c9[_0x13ff('0x6')]||'';this[_0x13ff('0x7')]=_0x10f7c9['tokenSecret']||'';this[_0x13ff('0x8')]=_0x10f7c9[_0x13ff('0x8')]||'';this[_0x13ff('0x9')]=_0x10f7c9[_0x13ff('0x9')]||'';this[_0x13ff('0xa')]=_0x10f7c9[_0x13ff('0xa')]||{};}module[_0x13ff('0xb')]=DeskAccount; \ No newline at end of file +var _0xe7ca=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe7ca,0xef));var _0xae7c=function(_0x3bf0a7,_0x207e7c){_0x3bf0a7=_0x3bf0a7-0x0;var _0x3d5450=_0xe7ca[_0x3bf0a7];return _0x3d5450;};'use strict';function DeskAccount(_0x4479e0){this['id']=_0x4479e0['id']||0x0;this[_0xae7c('0x0')]=_0x4479e0['name']||'';this[_0xae7c('0x1')]=_0x4479e0[_0xae7c('0x1')]||'';this[_0xae7c('0x2')]=_0x4479e0[_0xae7c('0x2')]||'';this[_0xae7c('0x3')]=_0x4479e0[_0xae7c('0x3')]||'';this['password']=_0x4479e0[_0xae7c('0x4')]||'';this[_0xae7c('0x5')]=_0x4479e0[_0xae7c('0x5')]||'';this[_0xae7c('0x6')]=_0x4479e0[_0xae7c('0x6')]||'';this[_0xae7c('0x7')]=_0x4479e0[_0xae7c('0x7')]||'';this[_0xae7c('0x8')]=_0x4479e0[_0xae7c('0x8')]||'';this[_0xae7c('0x9')]=_0x4479e0[_0xae7c('0x9')]||'';this[_0xae7c('0xa')]=_0x4479e0[_0xae7c('0xa')]||'';this[_0xae7c('0xb')]=_0x4479e0[_0xae7c('0xb')]||{};}module[_0xae7c('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 a54a7bd..6c511d7 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 _0xda3f=['clientId','serverUrl','Configurations','exports','name','password','remoteUri','tenantId'];(function(_0x36440e,_0x3aac71){var _0x45d810=function(_0x2cf5ff){while(--_0x2cf5ff){_0x36440e['push'](_0x36440e['shift']());}};_0x45d810(++_0x3aac71);}(_0xda3f,0xec));var _0xfda3=function(_0x54fcc7,_0x613e85){_0x54fcc7=_0x54fcc7-0x0;var _0x5171c7=_0xda3f[_0x54fcc7];return _0x5171c7;};'use strict';function Dynamics365Account(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['username']=_0x33f0ce['username']||'';this['password']=_0x33f0ce[_0xfda3('0x1')]||'';this['remoteUri']=_0x33f0ce[_0xfda3('0x2')]||'';this[_0xfda3('0x3')]=_0x33f0ce['tenantId']||'';this[_0xfda3('0x4')]=_0x33f0ce[_0xfda3('0x4')]||'';this['clientSecret']=_0x33f0ce['clientSecret']||{};this[_0xfda3('0x5')]=_0x33f0ce[_0xfda3('0x5')]||'';this[_0xfda3('0x6')]=_0x33f0ce[_0xfda3('0x6')]||{};}module[_0xfda3('0x7')]=Dynamics365Account; \ No newline at end of file +var _0x2547=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x2547,0x1cd));var _0x7254=function(_0x212b3a,_0x12833){_0x212b3a=_0x212b3a-0x0;var _0x64a2f8=_0x2547[_0x212b3a];return _0x64a2f8;};'use strict';function Dynamics365Account(_0x4cc9c6){this['id']=_0x4cc9c6['id']||0x0;this[_0x7254('0x0')]=_0x4cc9c6[_0x7254('0x0')]||'';this[_0x7254('0x1')]=_0x4cc9c6[_0x7254('0x1')]||'';this[_0x7254('0x2')]=_0x4cc9c6[_0x7254('0x2')]||'';this[_0x7254('0x3')]=_0x4cc9c6[_0x7254('0x3')]||'';this['tenantId']=_0x4cc9c6[_0x7254('0x4')]||'';this[_0x7254('0x5')]=_0x4cc9c6[_0x7254('0x5')]||'';this[_0x7254('0x6')]=_0x4cc9c6['clientSecret']||{};this[_0x7254('0x7')]=_0x4cc9c6[_0x7254('0x7')]||'';this[_0x7254('0x8')]=_0x4cc9c6['Configurations']||{};}module[_0x7254('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index e859eaa..d2ec8b4 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 _0xeff9=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','description','ecm','headerinfo','localstationid','minrate','modem'];(function(_0x39b3a9,_0x89164e){var _0x4118fe=function(_0x56e1d8){while(--_0x56e1d8){_0x39b3a9['push'](_0x39b3a9['shift']());}};_0x4118fe(++_0x89164e);}(_0xeff9,0x72));var _0x9eff=function(_0x587f62,_0x42bfa7){_0x587f62=_0x587f62-0x0;var _0x1d4762=_0xeff9[_0x587f62];return _0x1d4762;};'use strict';function FaxAccount(_0xc85226){this['id']=_0xc85226['id']||0x0;this['name']=_0xc85226['name']||'';this[_0x9eff('0x0')]=_0xc85226[_0x9eff('0x0')];this[_0x9eff('0x1')]=_0xc85226[_0x9eff('0x1')];this[_0x9eff('0x2')]=_0xc85226[_0x9eff('0x2')];this[_0x9eff('0x3')]=_0xc85226['localstationid'];this[_0x9eff('0x4')]=_0xc85226[_0x9eff('0x4')]||0x960;this['maxrate']=_0xc85226['maxrate']||0x3840;this[_0x9eff('0x5')]=_0xc85226['modem']||_0x9eff('0x6');this[_0x9eff('0x7')]=_0xc85226[_0x9eff('0x7')]||'no';this[_0x9eff('0x8')]=_0xc85226[_0x9eff('0x8')]||'no';this[_0x9eff('0x9')]=_0xc85226['t38timeout']||0x1388;this['tech']=_0xc85226[_0x9eff('0xa')]||_0x9eff('0xb');this['Trunk']=_0xc85226[_0x9eff('0xc')]?_0xc85226['Trunk']:undefined;this[_0x9eff('0xd')]=_0xc85226['ListId'];this[_0x9eff('0xe')]=_0xc85226[_0x9eff('0xe')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xe8c4=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xe8c4,0x184));var _0x4e8c=function(_0x469d57,_0x2f6d91){_0x469d57=_0x469d57-0x0;var _0xb03ec6=_0xe8c4[_0x469d57];return _0xb03ec6;};'use strict';function FaxAccount(_0x1c1fec){this['id']=_0x1c1fec['id']||0x0;this[_0x4e8c('0x0')]=_0x1c1fec[_0x4e8c('0x0')]||'';this['description']=_0x1c1fec[_0x4e8c('0x1')];this['ecm']=_0x1c1fec[_0x4e8c('0x2')];this[_0x4e8c('0x3')]=_0x1c1fec[_0x4e8c('0x3')];this[_0x4e8c('0x4')]=_0x1c1fec[_0x4e8c('0x4')];this[_0x4e8c('0x5')]=_0x1c1fec[_0x4e8c('0x5')]||0x960;this[_0x4e8c('0x6')]=_0x1c1fec[_0x4e8c('0x6')]||0x3840;this['modem']=_0x1c1fec[_0x4e8c('0x7')]||_0x4e8c('0x8');this[_0x4e8c('0x9')]=_0x1c1fec[_0x4e8c('0x9')]||'no';this['faxdetect']=_0x1c1fec[_0x4e8c('0xa')]||'no';this['t38timeout']=_0x1c1fec[_0x4e8c('0xb')]||0x1388;this['tech']=_0x1c1fec[_0x4e8c('0xc')]||_0x4e8c('0xd');this[_0x4e8c('0xe')]=_0x1c1fec['Trunk']?_0x1c1fec[_0x4e8c('0xe')]:undefined;this[_0x4e8c('0xf')]=_0x1c1fec[_0x4e8c('0xf')];this[_0x4e8c('0x10')]=_0x1c1fec['key'];}module[_0x4e8c('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 1bb8932..8f28f76 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 _0xaec6=['token','remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x58e989,_0x2b6e4a){var _0x2bf9bd=function(_0x583536){while(--_0x583536){_0x58e989['push'](_0x58e989['shift']());}};_0x2bf9bd(++_0x2b6e4a);}(_0xaec6,0x154));var _0x6aec=function(_0x2194f4,_0x39ea11){_0x2194f4=_0x2194f4-0x0;var _0x48a8bc=_0xaec6[_0x2194f4];return _0x48a8bc;};'use strict';function FreshdeskAccount(_0x640401){this['id']=_0x640401['id']||0x0;this[_0x6aec('0x0')]=_0x640401[_0x6aec('0x0')]||'';this[_0x6aec('0x1')]=_0x640401[_0x6aec('0x1')]||'';this[_0x6aec('0x2')]=_0x640401[_0x6aec('0x3')]||'';this[_0x6aec('0x4')]=_0x640401[_0x6aec('0x4')]||'';this[_0x6aec('0x5')]=_0x640401[_0x6aec('0x5')]||'';this[_0x6aec('0x6')]=_0x640401['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xf507=['Configurations','exports','name','username','remoteUri','serverUrl'];(function(_0x464705,_0x489383){var _0x3defcb=function(_0x10efed){while(--_0x10efed){_0x464705['push'](_0x464705['shift']());}};_0x3defcb(++_0x489383);}(_0xf507,0xda));var _0x7f50=function(_0x1e0152,_0x1693d9){_0x1e0152=_0x1e0152-0x0;var _0x36be50=_0xf507[_0x1e0152];return _0x36be50;};'use strict';function FreshdeskAccount(_0x294718){this['id']=_0x294718['id']||0x0;this[_0x7f50('0x0')]=_0x294718['name']||'';this[_0x7f50('0x1')]=_0x294718[_0x7f50('0x1')]||'';this['apiKey']=_0x294718['token']||'';this['remoteUri']=_0x294718[_0x7f50('0x2')]||'';this[_0x7f50('0x3')]=_0x294718['serverUrl']||'';this[_0x7f50('0x4')]=_0x294718['Configurations']||{};}module[_0x7f50('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 14b80f5..897a9cb 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 _0x7c22=['name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x91ff2b,_0x31f3ff){var _0x62be86=function(_0x229d60){while(--_0x229d60){_0x91ff2b['push'](_0x91ff2b['shift']());}};_0x62be86(++_0x31f3ff);}(_0x7c22,0x6c));var _0x27c2=function(_0x15cbe1,_0x29796b){_0x15cbe1=_0x15cbe1-0x0;var _0x24a635=_0x7c22[_0x15cbe1];return _0x24a635;};'use strict';function FreshsalesAccount(_0x40b7e0){this['id']=_0x40b7e0['id']||0x0;this[_0x27c2('0x0')]=_0x40b7e0['name']||'';this[_0x27c2('0x1')]=_0x40b7e0[_0x27c2('0x1')]||'';this['apiKey']=_0x40b7e0[_0x27c2('0x2')]||'';this[_0x27c2('0x3')]=_0x40b7e0['remoteUri']||'';this['serverUrl']=_0x40b7e0[_0x27c2('0x4')]||'';this['Configurations']=_0x40b7e0[_0x27c2('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xed08=['apiKey','token','remoteUri','serverUrl','Configurations','name','username'];(function(_0x457fe8,_0x51b75b){var _0x420f6b=function(_0x556d61){while(--_0x556d61){_0x457fe8['push'](_0x457fe8['shift']());}};_0x420f6b(++_0x51b75b);}(_0xed08,0x67));var _0x8ed0=function(_0x244e0f,_0x30b580){_0x244e0f=_0x244e0f-0x0;var _0x4219c4=_0xed08[_0x244e0f];return _0x4219c4;};'use strict';function FreshsalesAccount(_0x12c51f){this['id']=_0x12c51f['id']||0x0;this[_0x8ed0('0x0')]=_0x12c51f[_0x8ed0('0x0')]||'';this[_0x8ed0('0x1')]=_0x12c51f[_0x8ed0('0x1')]||'';this[_0x8ed0('0x2')]=_0x12c51f[_0x8ed0('0x3')]||'';this[_0x8ed0('0x4')]=_0x12c51f[_0x8ed0('0x4')]||'';this[_0x8ed0('0x5')]=_0x12c51f[_0x8ed0('0x5')]||'';this[_0x8ed0('0x6')]=_0x12c51f[_0x8ed0('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 9665413..e53af45 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 _0x311f=['exports','inbound','uniqueid','calleridnum','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinename','context','priority','holdtime','assigned','lastAssignedTo','motionChannel','mohtime','variables'];(function(_0x5b7bec,_0x33f4fe){var _0x529aa8=function(_0x5f5ad3){while(--_0x5f5ad3){_0x5b7bec['push'](_0x5b7bec['shift']());}};_0x529aa8(++_0x33f4fe);}(_0x311f,0x8b));var _0xf311=function(_0x5bebfe,_0x69d63a){_0x5bebfe=_0x5bebfe-0x0;var _0x46930d=_0x311f[_0x5bebfe];return _0x46930d;};'use strict';function QueueReport(){this['type']=_0xf311('0x0');this[_0xf311('0x1')]='';this[_0xf311('0x2')]='';this['calleridname']='';this['queue']='';this[_0xf311('0x3')]=null;this[_0xf311('0x4')]=null;this[_0xf311('0x5')]=0x1;this[_0xf311('0x6')]=0x1;this['queuecallerabandon']=![];this[_0xf311('0x7')]=null;this[_0xf311('0x8')]=![];this[_0xf311('0x9')]=null;this[_0xf311('0xa')]=![];this[_0xf311('0xb')]=null;this['originalposition']=0x1;this[_0xf311('0xc')]='';this['connectedlinenum']='';this[_0xf311('0xd')]='';this['accountcode']='';this[_0xf311('0xe')]='';this['exten']='';this[_0xf311('0xf')]='';this[_0xf311('0x10')]=0x0;this[_0xf311('0x11')]=![];this[_0xf311('0x12')]='';this[_0xf311('0x13')]='voice';this[_0xf311('0x14')]=0x0;this[_0xf311('0x15')]={};}module[_0xf311('0x16')]=QueueReport; \ No newline at end of file +var _0xf97f=['queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','exports','inbound','calleridnum','queue'];(function(_0x12bdb5,_0x210deb){var _0x2b9c88=function(_0x547e2d){while(--_0x547e2d){_0x12bdb5['push'](_0x12bdb5['shift']());}};_0x2b9c88(++_0x210deb);}(_0xf97f,0xf7));var _0xff97=function(_0x2e3a3b,_0x1f5941){_0x2e3a3b=_0x2e3a3b-0x0;var _0x449f57=_0xf97f[_0x2e3a3b];return _0x449f57;};'use strict';function QueueReport(){this['type']=_0xff97('0x0');this['uniqueid']='';this[_0xff97('0x1')]='';this['calleridname']='';this[_0xff97('0x2')]='';this[_0xff97('0x3')]=null;this['queuecallerleaveAt']=null;this[_0xff97('0x4')]=0x1;this[_0xff97('0x5')]=0x1;this[_0xff97('0x6')]=![];this[_0xff97('0x7')]=null;this[_0xff97('0x8')]=![];this['queuecallercompleteAt']=null;this[_0xff97('0x9')]=![];this[_0xff97('0xa')]=null;this['originalposition']=0x1;this[_0xff97('0xb')]='';this[_0xff97('0xc')]='';this[_0xff97('0xd')]='';this[_0xff97('0xe')]='';this[_0xff97('0xf')]='';this[_0xff97('0x10')]='';this[_0xff97('0x11')]='';this[_0xff97('0x12')]=0x0;this[_0xff97('0x13')]=![];this[_0xff97('0x14')]='';this[_0xff97('0x15')]=_0xff97('0x16');this[_0xff97('0x17')]=0x0;this['variables']={};}module[_0xff97('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 8eb2bb8..d7563e5 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 _0xa97d=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientSecret','securityToken','type'];(function(_0x37f971,_0x3b036a){var _0x83434c=function(_0x271515){while(--_0x271515){_0x37f971['push'](_0x37f971['shift']());}};_0x83434c(++_0x3b036a);}(_0xa97d,0x88));var _0xda97=function(_0x21a7aa,_0x2248dc){_0x21a7aa=_0x21a7aa-0x0;var _0x20c622=_0xa97d[_0x21a7aa];return _0x20c622;};'use strict';function SalesforceAccount(_0x5042f5){this['id']=_0x5042f5['id']||0x0;this[_0xda97('0x0')]=_0x5042f5[_0xda97('0x0')]||'';this[_0xda97('0x1')]=_0x5042f5['username']||'';this['remoteUri']=_0x5042f5[_0xda97('0x2')]||'';this[_0xda97('0x3')]=_0x5042f5[_0xda97('0x3')]||'';this['clientId']=_0x5042f5['clientId']||'';this[_0xda97('0x4')]=_0x5042f5['clientSecret']||'';this[_0xda97('0x5')]=_0x5042f5[_0xda97('0x5')]||'';this[_0xda97('0x6')]=_0x5042f5[_0xda97('0x6')]||_0xda97('0x7');this[_0xda97('0x8')]=_0x5042f5[_0xda97('0x8')]||'';this[_0xda97('0x9')]=_0x5042f5[_0xda97('0x9')]||{};}module[_0xda97('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xd2f5=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x25c4e7,_0x207bfd){var _0x85eca4=function(_0x1517e6){while(--_0x1517e6){_0x25c4e7['push'](_0x25c4e7['shift']());}};_0x85eca4(++_0x207bfd);}(_0xd2f5,0x12e));var _0x5d2f=function(_0x3f4289,_0x5d9e7a){_0x3f4289=_0x3f4289-0x0;var _0x4f03db=_0xd2f5[_0x3f4289];return _0x4f03db;};'use strict';function SalesforceAccount(_0x144f25){this['id']=_0x144f25['id']||0x0;this[_0x5d2f('0x0')]=_0x144f25[_0x5d2f('0x0')]||'';this[_0x5d2f('0x1')]=_0x144f25['username']||'';this[_0x5d2f('0x2')]=_0x144f25['remoteUri']||'';this['password']=_0x144f25[_0x5d2f('0x3')]||'';this[_0x5d2f('0x4')]=_0x144f25[_0x5d2f('0x4')]||'';this['clientSecret']=_0x144f25[_0x5d2f('0x5')]||'';this[_0x5d2f('0x6')]=_0x144f25[_0x5d2f('0x6')]||'';this['type']=_0x144f25[_0x5d2f('0x7')]||_0x5d2f('0x8');this[_0x5d2f('0x9')]=_0x144f25['serverUrl']||'';this['Configurations']=_0x144f25[_0x5d2f('0xa')]||{};}module[_0x5d2f('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 01b396c..e48cb9c 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 _0xd2dc=['password','serverUrl','Configurations','name','username'];(function(_0x5abae4,_0x2fad51){var _0x4491f4=function(_0x4d6c2a){while(--_0x4d6c2a){_0x5abae4['push'](_0x5abae4['shift']());}};_0x4491f4(++_0x2fad51);}(_0xd2dc,0x189));var _0xcd2d=function(_0x388b3e,_0x231f3a){_0x388b3e=_0x388b3e-0x0;var _0x5f0582=_0xd2dc[_0x388b3e];return _0x5f0582;};'use strict';function ServicenowAccount(_0x1e4b38){this['id']=_0x1e4b38['id']||0x0;this[_0xcd2d('0x0')]=_0x1e4b38[_0xcd2d('0x0')]||'';this[_0xcd2d('0x1')]=_0x1e4b38['username']||'';this[_0xcd2d('0x2')]=_0x1e4b38[_0xcd2d('0x2')]||'';this['remoteUri']=_0x1e4b38['remoteUri']||'';this[_0xcd2d('0x3')]=_0x1e4b38[_0xcd2d('0x3')]||'';this[_0xcd2d('0x4')]=_0x1e4b38[_0xcd2d('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x2f7a=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1c7502,_0x5d2c70){var _0x2165fa=function(_0x5a64a2){while(--_0x5a64a2){_0x1c7502['push'](_0x1c7502['shift']());}};_0x2165fa(++_0x5d2c70);}(_0x2f7a,0x67));var _0xa2f7=function(_0x2419b1,_0x4e7c55){_0x2419b1=_0x2419b1-0x0;var _0x377ba4=_0x2f7a[_0x2419b1];return _0x377ba4;};'use strict';function ServicenowAccount(_0x3be752){this['id']=_0x3be752['id']||0x0;this[_0xa2f7('0x0')]=_0x3be752[_0xa2f7('0x0')]||'';this[_0xa2f7('0x1')]=_0x3be752[_0xa2f7('0x1')]||'';this['password']=_0x3be752[_0xa2f7('0x2')]||'';this['remoteUri']=_0x3be752[_0xa2f7('0x3')]||'';this[_0xa2f7('0x4')]=_0x3be752[_0xa2f7('0x4')]||'';this[_0xa2f7('0x5')]=_0x3be752[_0xa2f7('0x5')]||{};}module[_0xa2f7('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 4b8ab12..ab747d0 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 _0xcb33=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x49aa7d,_0x5d46d8){var _0xdd0d26=function(_0x159df7){while(--_0x159df7){_0x49aa7d['push'](_0x49aa7d['shift']());}};_0xdd0d26(++_0x5d46d8);}(_0xcb33,0xae));var _0x3cb3=function(_0x2ee03f,_0x22d7aa){_0x2ee03f=_0x2ee03f-0x0;var _0xa027b8=_0xcb33[_0x2ee03f];return _0xa027b8;};'use strict';function SugarcrmAccount(_0x534f44){this['id']=_0x534f44['id']||0x0;this[_0x3cb3('0x0')]=_0x534f44[_0x3cb3('0x0')]||'';this['username']=_0x534f44[_0x3cb3('0x1')]||'';this['password']=_0x534f44[_0x3cb3('0x2')]||'';this[_0x3cb3('0x3')]=_0x534f44[_0x3cb3('0x3')]||'';this[_0x3cb3('0x4')]=_0x534f44['serverUrl']||'';this[_0x3cb3('0x5')]=_0x534f44[_0x3cb3('0x5')]||{};}module[_0x3cb3('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x17f0=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x17f0,0x91));var _0x017f=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x17f0[_0x1b6186];return _0x186121;};'use strict';function SugarcrmAccount(_0x498a68){this['id']=_0x498a68['id']||0x0;this[_0x017f('0x0')]=_0x498a68[_0x017f('0x0')]||'';this[_0x017f('0x1')]=_0x498a68[_0x017f('0x1')]||'';this[_0x017f('0x2')]=_0x498a68[_0x017f('0x2')]||'';this['remoteUri']=_0x498a68[_0x017f('0x3')]||'';this[_0x017f('0x4')]=_0x498a68[_0x017f('0x4')]||'';this[_0x017f('0x5')]=_0x498a68[_0x017f('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 5e5ecc3..69833bf 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 _0x7c35=['unknown','stateTime','exports','name','accountcode','state'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x7c35,0x135));var _0x57c3=function(_0x25407f,_0x3148a5){_0x25407f=_0x25407f-0x0;var _0x45f0cc=_0x7c35[_0x25407f];return _0x45f0cc;};'use strict';function Telephone(_0xfeb953){this['id']=_0xfeb953['id']||0x0;this[_0x57c3('0x0')]=_0xfeb953[_0x57c3('0x0')]||'';this[_0x57c3('0x1')]=_0xfeb953[_0x57c3('0x1')]||'';this[_0x57c3('0x2')]=_0x57c3('0x3');this[_0x57c3('0x4')]=0x0;this['status']=_0x57c3('0x3');this['address']='';}module[_0x57c3('0x5')]=Telephone; \ No newline at end of file +var _0x9434=['status','address','exports','name','accountcode','state','stateTime'];(function(_0x10a929,_0x56357e){var _0x1e4d82=function(_0x262611){while(--_0x262611){_0x10a929['push'](_0x10a929['shift']());}};_0x1e4d82(++_0x56357e);}(_0x9434,0x168));var _0x4943=function(_0x35e7b4,_0x2a2d1d){_0x35e7b4=_0x35e7b4-0x0;var _0x2c1382=_0x9434[_0x35e7b4];return _0x2c1382;};'use strict';function Telephone(_0x4fe66c){this['id']=_0x4fe66c['id']||0x0;this[_0x4943('0x0')]=_0x4fe66c[_0x4943('0x0')]||'';this[_0x4943('0x1')]=_0x4fe66c[_0x4943('0x1')]||'';this[_0x4943('0x2')]='unknown';this[_0x4943('0x3')]=0x0;this[_0x4943('0x4')]='unknown';this[_0x4943('0x5')]='';}module[_0x4943('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 4167e2f..b3a4644 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(_0x4baec3,_0x5068f5){var _0x3fe2a0=function(_0xd2c720){while(--_0xd2c720){_0x4baec3['push'](_0x4baec3['shift']());}};_0x3fe2a0(++_0x5068f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x20cb2,_0x214420){var _0x434a56=function(_0x23483a){while(--_0x23483a){_0x20cb2['push'](_0x20cb2['shift']());}};_0x434a56(++_0x214420);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 3d13261..de5dafc 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 _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x87fb9d,_0x2ba366){var _0x30dcf6=function(_0x21c9f9){while(--_0x21c9f9){_0x87fb9d['push'](_0x87fb9d['shift']());}};_0x30dcf6(++_0x2ba366);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xb7e7[_0x2f1762];return _0x8ab21;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x2caee0,_0x311080){var _0xee0509=function(_0x344675){while(--_0x344675){_0x2caee0['push'](_0x2caee0['shift']());}};_0xee0509(++_0x311080);}(_0x8603,0x190));var _0x3860=function(_0x11f247,_0x577d13){_0x11f247=_0x11f247-0x0;var _0x38828b=_0x8603[_0x11f247];return _0x38828b;};'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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 28a5424..7649a67 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 _0xca6c=['port','domain','domainport','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host'];(function(_0x388899,_0x17f370){var _0x3be17d=function(_0x19ad17){while(--_0x19ad17){_0x388899['push'](_0x388899['shift']());}};_0x3be17d(++_0x17f370);}(_0xca6c,0xc6));var _0xcca6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca6c[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x1d4e9a){this['id']=_0x1d4e9a['id']||0x0;this['active']=_0x1d4e9a[_0xcca6('0x0')]||![];this[_0xcca6('0x1')]=_0x1d4e9a[_0xcca6('0x1')]||'';this[_0xcca6('0x2')]=_0xcca6('0x3');this[_0xcca6('0x4')]=0x0;this[_0xcca6('0x5')]=_0xcca6('0x3');this[_0xcca6('0x6')]=_0x1d4e9a['registry']&&_0x1d4e9a['registry'][_0xcca6('0x7')](':')?_0x1d4e9a[_0xcca6('0x6')][_0xcca6('0x8')](':')[0x0]:'';this[_0xcca6('0x9')]='';this[_0xcca6('0xa')]='';this[_0xcca6('0xb')]='';this[_0xcca6('0xc')]='';this['refresh']='';this['stateRegistry']=_0xcca6('0x3');this['registrationtime']='';this[_0xcca6('0xd')]='';this[_0xcca6('0xe')]=_0x1d4e9a[_0xcca6('0xe')]||'';}module[_0xcca6('0xf')]=Trunk; \ No newline at end of file +var _0xc2ac=['defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','port','domain','refresh','stateRegistry','registrationtime','address'];(function(_0x2d53f4,_0xf5653a){var _0x2cf300=function(_0xbc73a9){while(--_0xbc73a9){_0x2d53f4['push'](_0x2d53f4['shift']());}};_0x2cf300(++_0xf5653a);}(_0xc2ac,0x19a));var _0xcc2a=function(_0xaada6a,_0x2ac9c7){_0xaada6a=_0xaada6a-0x0;var _0x106a81=_0xc2ac[_0xaada6a];return _0x106a81;};'use strict';function Trunk(_0x357fff){this['id']=_0x357fff['id']||0x0;this[_0xcc2a('0x0')]=_0x357fff[_0xcc2a('0x0')]||![];this[_0xcc2a('0x1')]=_0x357fff[_0xcc2a('0x1')]||'';this[_0xcc2a('0x2')]=_0xcc2a('0x3');this[_0xcc2a('0x4')]=0x0;this[_0xcc2a('0x5')]='unknown';this[_0xcc2a('0x6')]=_0x357fff[_0xcc2a('0x6')]&&_0x357fff['registry'][_0xcc2a('0x7')](':')?_0x357fff['registry'][_0xcc2a('0x8')](':')[0x0]:'';this['host']='';this[_0xcc2a('0x9')]='';this[_0xcc2a('0xa')]='';this['domainport']='';this[_0xcc2a('0xb')]='';this[_0xcc2a('0xc')]=_0xcc2a('0x3');this[_0xcc2a('0xd')]='';this[_0xcc2a('0xe')]='';this[_0xcc2a('0xf')]=_0x357fff[_0xcc2a('0xf')]||'';}module[_0xcc2a('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index f423434..3d1cbb7 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 _0x258b=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x258b,0x1e9));var _0xb258=function(_0xc38ae4,_0x1fb505){_0xc38ae4=_0xc38ae4-0x0;var _0x2661fc=_0x258b[_0xc38ae4];return _0x2661fc;};'use strict';function voiceExtension(_0x3b725f){this['id']=_0x3b725f['id']||0x0;this[_0xb258('0x0')]=_0x3b725f[_0xb258('0x0')]||'';this[_0xb258('0x1')]=_0x3b725f[_0xb258('0x1')]||_0xb258('0x2');this[_0xb258('0x3')]=_0x3b725f[_0xb258('0x3')]||![];}module[_0xb258('0x4')]=voiceExtension; \ No newline at end of file +var _0x89f6=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0xcf1eb9,_0x8404ef){var _0x4dfb4e=function(_0x2d960b){while(--_0x2d960b){_0xcf1eb9['push'](_0xcf1eb9['shift']());}};_0x4dfb4e(++_0x8404ef);}(_0x89f6,0xe3));var _0x689f=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0x89f6[_0x43d16c];return _0x208cce;};'use strict';function voiceExtension(_0x726807){this['id']=_0x726807['id']||0x0;this[_0x689f('0x0')]=_0x726807[_0x689f('0x0')]||'';this[_0x689f('0x1')]=_0x726807['recordingFormat']||_0x689f('0x2');this['mandatoryDisposition']=_0x726807[_0x689f('0x3')]||![];}module[_0x689f('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 95a2dc6..92549f2 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 _0xfc88=['dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','ringing','ringinuse','onhold','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x19d350,_0x3c843f){var _0x3bfc8d=function(_0xd89003){while(--_0xd89003){_0x19d350['push'](_0x19d350['shift']());}};_0x3bfc8d(++_0x3c843f);}(_0xfc88,0x199));var _0x8fc8=function(_0x19e043,_0x397d50){_0x19e043=_0x19e043-0x0;var _0x352a23=_0xfc88[_0x19e043];return _0x352a23;};'use strict';var statusDesc=[_0x8fc8('0x0'),_0x8fc8('0x1'),_0x8fc8('0x2'),_0x8fc8('0x3'),'invalid','unavailable',_0x8fc8('0x4'),_0x8fc8('0x5'),_0x8fc8('0x6')];var monitorFormat={'wav':'wav','wav49':_0x8fc8('0x7'),'gsm':_0x8fc8('0x8')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x8fc8('0x9')};function VoiceQueue(_0x17a3a4){this['id']=_0x17a3a4['id']||0x0;this[_0x8fc8('0xa')]=_0x17a3a4[_0x8fc8('0xa')]||'';this[_0x8fc8('0xb')]=_0x17a3a4[_0x8fc8('0xb')]||'';this[_0x8fc8('0xc')]=_0x17a3a4['type']||_0x8fc8('0xd');this[_0x8fc8('0xe')]=0x0;this['talking']=0x0;this[_0x8fc8('0xf')]=0x0;this[_0x8fc8('0x10')]=0x0;this[_0x8fc8('0x11')]=0x0;this[_0x8fc8('0x12')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0x8fc8('0x13')]=0x0;this['loggedIn']=0x0;this[_0x8fc8('0x14')]=0x0;this[_0x8fc8('0x15')]=_0x17a3a4[_0x8fc8('0x15')]||![];this['acwTimeout']=_0x17a3a4[_0x8fc8('0x16')]||0xa;this[_0x8fc8('0x17')]=_0x17a3a4[_0x8fc8('0x17')]||'no';this[_0x8fc8('0x18')]=!![];this[_0x8fc8('0x19')]='';this[_0x8fc8('0x1a')]=0x0;this[_0x8fc8('0x1b')]=0x0;this[_0x8fc8('0x1c')]=_0x17a3a4['dialTimezone']||null;this[_0x8fc8('0x1d')]=_0x17a3a4['dialGlobalInterval']?_0x17a3a4[_0x8fc8('0x1d')]:null;this['dialActive']=_0x17a3a4[_0x8fc8('0x1e')];this[_0x8fc8('0x1f')]=_0x17a3a4[_0x8fc8('0x1f')]||_0x8fc8('0x20');this[_0x8fc8('0x21')]=_0x17a3a4[_0x8fc8('0x21')]||0x0;this[_0x8fc8('0x22')]=_0x17a3a4[_0x8fc8('0x22')]||0x0;this[_0x8fc8('0x23')]=_0x17a3a4['dialPowerLevel']||0x1;this[_0x8fc8('0x24')]=_0x17a3a4[_0x8fc8('0x24')]||_0x8fc8('0x25');this[_0x8fc8('0x26')]=_0x17a3a4[_0x8fc8('0x26')]||0.03;this['dialPredictiveInterval']=_0x17a3a4[_0x8fc8('0x27')]||0x258;this['dialOriginateCallerIdName']=_0x17a3a4[_0x8fc8('0x28')]||_0x8fc8('0x29');this[_0x8fc8('0x2a')]=_0x17a3a4['dialOriginateCallerIdNumber']||_0x8fc8('0x29');this[_0x8fc8('0x2b')]=_0x17a3a4[_0x8fc8('0x2b')]||0x1e;this[_0x8fc8('0x2c')]=_0x17a3a4['dialQueueOptions']||_0x8fc8('0x2d');this[_0x8fc8('0x2e')]=_0x17a3a4[_0x8fc8('0x2e')]||0x3;this[_0x8fc8('0x2f')]=_0x17a3a4[_0x8fc8('0x2f')]||undefined;this[_0x8fc8('0x30')]=_0x17a3a4[_0x8fc8('0x30')]||0x3;this[_0x8fc8('0x31')]=_0x17a3a4[_0x8fc8('0x31')]||0x96;this[_0x8fc8('0x32')]=_0x17a3a4[_0x8fc8('0x32')]||0x3;this[_0x8fc8('0x33')]=_0x17a3a4[_0x8fc8('0x33')]||0x96;this[_0x8fc8('0x34')]=_0x17a3a4['dialNoAnswerMaxRetry']||0x3;this[_0x8fc8('0x35')]=_0x17a3a4[_0x8fc8('0x35')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x17a3a4[_0x8fc8('0x36')]||0x3;this[_0x8fc8('0x37')]=_0x17a3a4[_0x8fc8('0x37')]||0x96;this['dialDropMaxRetry']=_0x17a3a4[_0x8fc8('0x38')]||0x3;this[_0x8fc8('0x39')]=_0x17a3a4[_0x8fc8('0x39')]||0x96;this[_0x8fc8('0x3a')]=_0x17a3a4[_0x8fc8('0x3a')]||0x3;this[_0x8fc8('0x3b')]=_0x17a3a4['dialAbandonedRetryFrequency']||0x96;this[_0x8fc8('0x3c')]=_0x17a3a4[_0x8fc8('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0x17a3a4['dialMachineRetryFrequency']||0x96;this[_0x8fc8('0x3d')]=_0x17a3a4['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x17a3a4['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x17a3a4[_0x8fc8('0x3e')]||0x4;this['Trunk']=_0x17a3a4[_0x8fc8('0x3f')]?_0x17a3a4[_0x8fc8('0x3f')]:undefined;this[_0x8fc8('0x40')]=_0x17a3a4[_0x8fc8('0x40')]?_0x17a3a4[_0x8fc8('0x40')]:undefined;this[_0x8fc8('0x41')]=_0x17a3a4['dialPrefix']||undefined;this[_0x8fc8('0x42')]=_0x17a3a4['Interval']?_0x17a3a4[_0x8fc8('0x42')]:undefined;this[_0x8fc8('0x43')]=_0x17a3a4[_0x8fc8('0x43')]||_0x8fc8('0x44');this[_0x8fc8('0x45')]=_0x17a3a4['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x8fc8('0x46')]=_0x17a3a4[_0x8fc8('0x46')]||undefined;this['strategy']=strategy[_0x17a3a4[_0x8fc8('0x47')]]||_0x8fc8('0x48');this[_0x8fc8('0x49')]=!![];this[_0x8fc8('0x4a')]=_0x17a3a4[_0x8fc8('0x4a')]||![];this[_0x8fc8('0x4b')]=_0x17a3a4[_0x8fc8('0x4b')];this['dialAMDGreeting']=_0x17a3a4[_0x8fc8('0x4c')];this[_0x8fc8('0x4d')]=_0x17a3a4[_0x8fc8('0x4d')];this['dialAMDTotalAnalysisTime']=_0x17a3a4[_0x8fc8('0x4e')];this[_0x8fc8('0x4f')]=_0x17a3a4[_0x8fc8('0x4f')];this['dialAMDBetweenWordsSilence']=_0x17a3a4[_0x8fc8('0x50')];this[_0x8fc8('0x51')]=_0x17a3a4[_0x8fc8('0x51')];this[_0x8fc8('0x52')]=_0x17a3a4[_0x8fc8('0x52')];this['dialAMDMaximumWordLength']=_0x17a3a4[_0x8fc8('0x53')];this['outboundRejectCallsDay']=0x0;this[_0x8fc8('0x54')]=0x0;this[_0x8fc8('0x55')]=_0x17a3a4['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x8fc8('0x56')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x8fc8('0x57')]=0x0;this[_0x8fc8('0x58')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x8fc8('0x59')]=0x0;this[_0x8fc8('0x5a')]=0x0;this[_0x8fc8('0x5b')]=0x0;this[_0x8fc8('0x5c')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x8fc8('0x5d')]=0x0;this[_0x8fc8('0x5e')]=0x0;this[_0x8fc8('0x5f')]=undefined;this[_0x8fc8('0x60')]=undefined;this[_0x8fc8('0x61')]=undefined;this[_0x8fc8('0x62')]=1.05;this[_0x8fc8('0x63')]=0x0;this[_0x8fc8('0x64')]=0x0;this[_0x8fc8('0x65')]=0x0;this[_0x8fc8('0x66')]=0x0;this[_0x8fc8('0x67')]=0x0;this[_0x8fc8('0x68')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x8fc8('0x69')]=0x0;this[_0x8fc8('0x6a')]=_0x17a3a4[_0x8fc8('0x6b')]||0x14;this[_0x8fc8('0x6c')]=_0x17a3a4[_0x8fc8('0x6b')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x8fc8('0x6d')]=0x0;this[_0x8fc8('0x6e')]=0x1;this[_0x8fc8('0x6f')]=0x0;this[_0x8fc8('0x70')]=0x0;this[_0x8fc8('0x71')]=0x0;this['erlangBusyFactor']=0x0;this[_0x8fc8('0x72')]=_0x17a3a4[_0x8fc8('0x72')]||0x1e;this[_0x8fc8('0x73')]=_0x17a3a4[_0x8fc8('0x73')]||![];this[_0x8fc8('0x74')]=!!_0x17a3a4['dialPreviewAutoRecallMe']||![];this[_0x8fc8('0x75')]=_0x17a3a4[_0x8fc8('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x17a3a4[_0x8fc8('0x76')]||![];this[_0x8fc8('0x77')]=_0x17a3a4['dialAgiAfterHangupAgent']||![];this[_0x8fc8('0xb')]=monitorFormat[_0x17a3a4[_0x8fc8('0xb')]]?monitorFormat[_0x17a3a4[_0x8fc8('0xb')]]:undefined;this[_0x8fc8('0x78')]=_0x17a3a4['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x17a3a4['mandatoryDispositionPause']?_0x17a3a4[_0x8fc8('0x79')]:undefined;}module[_0x8fc8('0x7a')]=VoiceQueue; \ No newline at end of file +var _0x35b5=['gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','invalid','unavailable','ringing','onhold','wav'];(function(_0x319b06,_0x3e2a3f){var _0x37e045=function(_0x5a52a9){while(--_0x5a52a9){_0x319b06['push'](_0x319b06['shift']());}};_0x37e045(++_0x3e2a3f);}(_0x35b5,0x6d));var _0x535b=function(_0x3d2789,_0x4041d0){_0x3d2789=_0x3d2789-0x0;var _0x45610e=_0x35b5[_0x3d2789];return _0x45610e;};'use strict';var statusDesc=['unknown',_0x535b('0x0'),_0x535b('0x1'),'busy',_0x535b('0x2'),_0x535b('0x3'),_0x535b('0x4'),'ringinuse',_0x535b('0x5')];var monitorFormat={'wav':_0x535b('0x6'),'wav49':'wav49','gsm':_0x535b('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x535b('0x8')};function VoiceQueue(_0x4a4ee6){this['id']=_0x4a4ee6['id']||0x0;this['name']=_0x4a4ee6[_0x535b('0x9')]||'';this[_0x535b('0xa')]=_0x4a4ee6['monitor_format']||'';this['type']=_0x4a4ee6[_0x535b('0xb')]||_0x535b('0xc');this[_0x535b('0xd')]=0x0;this[_0x535b('0xe')]=0x0;this['total']=0x0;this[_0x535b('0xf')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x535b('0x10')]=0x0;this[_0x535b('0x11')]=0x0;this[_0x535b('0x12')]=0x0;this[_0x535b('0x13')]=0x0;this[_0x535b('0x14')]=0x0;this[_0x535b('0x15')]=_0x4a4ee6[_0x535b('0x15')]||![];this[_0x535b('0x16')]=_0x4a4ee6[_0x535b('0x16')]||0xa;this[_0x535b('0x17')]=_0x4a4ee6[_0x535b('0x17')]||'no';this[_0x535b('0x18')]=!![];this[_0x535b('0x19')]='';this[_0x535b('0x1a')]=0x0;this['temp']=0x0;this[_0x535b('0x1b')]=_0x4a4ee6['dialTimezone']||null;this[_0x535b('0x1c')]=_0x4a4ee6[_0x535b('0x1c')]?_0x4a4ee6[_0x535b('0x1c')]:null;this['dialActive']=_0x4a4ee6[_0x535b('0x1d')];this[_0x535b('0x1e')]=_0x4a4ee6[_0x535b('0x1e')]||'progressive';this[_0x535b('0x1f')]=_0x4a4ee6[_0x535b('0x1f')]||0x0;this[_0x535b('0x20')]=_0x4a4ee6[_0x535b('0x20')]||0x0;this[_0x535b('0x21')]=_0x4a4ee6[_0x535b('0x21')]||0x1;this[_0x535b('0x22')]=_0x4a4ee6[_0x535b('0x22')]||_0x535b('0x23');this[_0x535b('0x24')]=_0x4a4ee6[_0x535b('0x24')]||0.03;this[_0x535b('0x25')]=_0x4a4ee6[_0x535b('0x25')]||0x258;this[_0x535b('0x26')]=_0x4a4ee6[_0x535b('0x26')]||_0x535b('0x27');this['dialOriginateCallerIdNumber']=_0x4a4ee6[_0x535b('0x28')]||_0x535b('0x27');this[_0x535b('0x29')]=_0x4a4ee6[_0x535b('0x29')]||0x1e;this['dialQueueOptions']=_0x4a4ee6[_0x535b('0x2a')]||_0x535b('0x2b');this[_0x535b('0x2c')]=_0x4a4ee6['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x4a4ee6[_0x535b('0x2d')]||undefined;this['dialCongestionMaxRetry']=_0x4a4ee6[_0x535b('0x2e')]||0x3;this[_0x535b('0x2f')]=_0x4a4ee6[_0x535b('0x2f')]||0x96;this[_0x535b('0x30')]=_0x4a4ee6['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x4a4ee6[_0x535b('0x31')]||0x96;this[_0x535b('0x32')]=_0x4a4ee6[_0x535b('0x32')]||0x3;this[_0x535b('0x33')]=_0x4a4ee6['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x4a4ee6['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4a4ee6[_0x535b('0x34')]||0x96;this[_0x535b('0x35')]=_0x4a4ee6['dialDropMaxRetry']||0x3;this[_0x535b('0x36')]=_0x4a4ee6[_0x535b('0x36')]||0x96;this[_0x535b('0x37')]=_0x4a4ee6['dialAbandonedMaxRetry']||0x3;this[_0x535b('0x38')]=_0x4a4ee6[_0x535b('0x38')]||0x96;this[_0x535b('0x39')]=_0x4a4ee6[_0x535b('0x39')]||0x3;this[_0x535b('0x3a')]=_0x4a4ee6[_0x535b('0x3a')]||0x96;this[_0x535b('0x3b')]=_0x4a4ee6[_0x535b('0x3b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4a4ee6[_0x535b('0x3c')]||0x96;this[_0x535b('0x3d')]=_0x4a4ee6[_0x535b('0x3d')]||0x4;this[_0x535b('0x3e')]=_0x4a4ee6[_0x535b('0x3e')]?_0x4a4ee6['Trunk']:undefined;this[_0x535b('0x3f')]=_0x4a4ee6[_0x535b('0x3f')]?_0x4a4ee6['TrunkBackup']:undefined;this[_0x535b('0x40')]=_0x4a4ee6['dialPrefix']||undefined;this['Interval']=_0x4a4ee6['Interval']?_0x4a4ee6['Interval']:undefined;this[_0x535b('0x41')]=_0x4a4ee6[_0x535b('0x41')]||_0x535b('0x42');this[_0x535b('0x43')]=_0x4a4ee6[_0x535b('0x43')]||undefined;this[_0x535b('0x44')]=_0x4a4ee6['dialCutDigit']||undefined;this[_0x535b('0x45')]=strategy[_0x4a4ee6[_0x535b('0x45')]]||_0x535b('0x46');this[_0x535b('0x47')]=!![];this[_0x535b('0x48')]=_0x4a4ee6['dialAMDActive']||![];this[_0x535b('0x49')]=_0x4a4ee6[_0x535b('0x49')];this[_0x535b('0x4a')]=_0x4a4ee6[_0x535b('0x4a')];this[_0x535b('0x4b')]=_0x4a4ee6[_0x535b('0x4b')];this[_0x535b('0x4c')]=_0x4a4ee6[_0x535b('0x4c')];this[_0x535b('0x4d')]=_0x4a4ee6[_0x535b('0x4d')];this['dialAMDBetweenWordsSilence']=_0x4a4ee6[_0x535b('0x4e')];this[_0x535b('0x4f')]=_0x4a4ee6[_0x535b('0x4f')];this['dialAMDSilenceThreshold']=_0x4a4ee6['dialAMDSilenceThreshold'];this[_0x535b('0x50')]=_0x4a4ee6['dialAMDMaximumWordLength'];this[_0x535b('0x51')]=0x0;this[_0x535b('0x52')]=0x0;this['timeout']=_0x4a4ee6[_0x535b('0x53')];this[_0x535b('0x54')]=0x0;this[_0x535b('0x55')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0x535b('0x56')]=0x0;this[_0x535b('0x57')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x535b('0x58')]=0x0;this[_0x535b('0x59')]=0x0;this[_0x535b('0x5a')]=0x0;this[_0x535b('0x5b')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0x535b('0x5c')]=0x0;this[_0x535b('0x5d')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x535b('0x5e')]=1.05;this[_0x535b('0x5f')]=0x0;this[_0x535b('0x60')]=0x0;this[_0x535b('0x61')]=0x0;this[_0x535b('0x62')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x535b('0x63')]=0x0;this[_0x535b('0x64')]=_0x4a4ee6[_0x535b('0x65')]||0x14;this[_0x535b('0x66')]=_0x4a4ee6[_0x535b('0x65')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x535b('0x67')]=0x0;this[_0x535b('0x68')]=0x1;this[_0x535b('0x69')]=0x0;this['erlangCallToSecond']=0x0;this[_0x535b('0x6a')]=0x0;this['erlangBusyFactor']=0x0;this[_0x535b('0x6b')]=_0x4a4ee6[_0x535b('0x6b')]||0x1e;this[_0x535b('0x6c')]=_0x4a4ee6[_0x535b('0x6c')]||![];this['dialPreviewAutoRecallMe']=!!_0x4a4ee6[_0x535b('0x6d')]||![];this[_0x535b('0x6e')]=_0x4a4ee6[_0x535b('0x6e')]||undefined;this[_0x535b('0x6f')]=_0x4a4ee6['dialAgiAfterHangupClient']||![];this[_0x535b('0x70')]=_0x4a4ee6[_0x535b('0x70')]||![];this[_0x535b('0xa')]=monitorFormat[_0x4a4ee6[_0x535b('0xa')]]?monitorFormat[_0x4a4ee6[_0x535b('0xa')]]:undefined;this['mandatoryDisposition']=_0x4a4ee6[_0x535b('0x71')]||![];this['mandatoryDispositionPause']=_0x4a4ee6[_0x535b('0x72')]?_0x4a4ee6[_0x535b('0x72')]:undefined;}module[_0x535b('0x73')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 4c5984d..31e9800 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 _0xebde=['Configurations','exports','name','username','remoteUri','serverUrl'];(function(_0x1abfa6,_0x53242d){var _0x833568=function(_0xf990c9){while(--_0xf990c9){_0x1abfa6['push'](_0x1abfa6['shift']());}};_0x833568(++_0x53242d);}(_0xebde,0x92));var _0xeebd=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0xebde[_0x2e76a7];return _0x454cde;};'use strict';function VtigerAccount(_0x35c51b){this['id']=_0x35c51b['id']||0x0;this[_0xeebd('0x0')]=_0x35c51b['name']||'';this[_0xeebd('0x1')]=_0x35c51b[_0xeebd('0x1')]||'';this['accessKey']=_0x35c51b['accessKey']||'';this[_0xeebd('0x2')]=_0x35c51b['remoteUri']||'';this['serverUrl']=_0x35c51b[_0xeebd('0x3')]||'';this[_0xeebd('0x4')]=_0x35c51b['Configurations']||{};}module[_0xeebd('0x5')]=VtigerAccount; \ No newline at end of file +var _0xd307=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x9b5a9a,_0x277481){var _0x3d5b56=function(_0x11df7f){while(--_0x11df7f){_0x9b5a9a['push'](_0x9b5a9a['shift']());}};_0x3d5b56(++_0x277481);}(_0xd307,0x110));var _0x7d30=function(_0xc6f2bc,_0x5ee341){_0xc6f2bc=_0xc6f2bc-0x0;var _0x1cd3bb=_0xd307[_0xc6f2bc];return _0x1cd3bb;};'use strict';function VtigerAccount(_0x336c7d){this['id']=_0x336c7d['id']||0x0;this[_0x7d30('0x0')]=_0x336c7d[_0x7d30('0x0')]||'';this[_0x7d30('0x1')]=_0x336c7d[_0x7d30('0x1')]||'';this[_0x7d30('0x2')]=_0x336c7d[_0x7d30('0x2')]||'';this[_0x7d30('0x3')]=_0x336c7d['remoteUri']||'';this[_0x7d30('0x4')]=_0x336c7d[_0x7d30('0x4')]||'';this['Configurations']=_0x336c7d[_0x7d30('0x5')]||{};}module[_0x7d30('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 05c5250..679c5f1 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 _0xf236=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0x2eef3e,_0x4aa157){var _0x1558a1=function(_0x52954f){while(--_0x52954f){_0x2eef3e['push'](_0x2eef3e['shift']());}};_0x1558a1(++_0x4aa157);}(_0xf236,0x72));var _0x6f23=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0xf236[_0x276468];return _0x36dc3a;};'use strict';function ZendeskAccount(_0x3732b9){this['id']=_0x3732b9['id']||0x0;this[_0x6f23('0x0')]=_0x3732b9['name']||'';this[_0x6f23('0x1')]=_0x3732b9[_0x6f23('0x1')]||'';this['password']=_0x3732b9[_0x6f23('0x2')]||'';this['token']=_0x3732b9['token']||'';this[_0x6f23('0x3')]=_0x3732b9[_0x6f23('0x3')]||'';this[_0x6f23('0x4')]=_0x3732b9[_0x6f23('0x4')]||'';this[_0x6f23('0x5')]=_0x3732b9[_0x6f23('0x5')]||_0x6f23('0x6');this['serverUrl']=_0x3732b9[_0x6f23('0x7')]||'';this[_0x6f23('0x8')]=_0x3732b9['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x6450=['username','password','token','remoteUri','authType','type','Configurations','exports','name'];(function(_0x1f7839,_0x2a26e6){var _0x36b42e=function(_0x553222){while(--_0x553222){_0x1f7839['push'](_0x1f7839['shift']());}};_0x36b42e(++_0x2a26e6);}(_0x6450,0x15e));var _0x0645=function(_0x55d49e,_0x2a1e00){_0x55d49e=_0x55d49e-0x0;var _0x4bd0f8=_0x6450[_0x55d49e];return _0x4bd0f8;};'use strict';function ZendeskAccount(_0x2372cd){this['id']=_0x2372cd['id']||0x0;this['name']=_0x2372cd[_0x0645('0x0')]||'';this[_0x0645('0x1')]=_0x2372cd[_0x0645('0x1')]||'';this['password']=_0x2372cd[_0x0645('0x2')]||'';this[_0x0645('0x3')]=_0x2372cd[_0x0645('0x3')]||'';this[_0x0645('0x4')]=_0x2372cd[_0x0645('0x4')]||'';this['authType']=_0x2372cd[_0x0645('0x5')]||'';this['type']=_0x2372cd[_0x0645('0x6')]||'integrationTab';this['serverUrl']=_0x2372cd['serverUrl']||'';this[_0x0645('0x7')]=_0x2372cd[_0x0645('0x7')]||{};}module[_0x0645('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 19aff2f..1c163fc 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 _0xb33e=['clientId','clientSecret','serverUrl','code','refreshToken','name','description','host','zone'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb33e,0xcb));var _0xeb33=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb33e[_0x19e35c];return _0x3e1fe8;};'use strict';function ZohoAccount(_0x1a4bfd){this['id']=_0x1a4bfd['id']||0x0;this[_0xeb33('0x0')]=_0x1a4bfd[_0xeb33('0x0')]||'';this[_0xeb33('0x1')]=_0x1a4bfd[_0xeb33('0x1')]||'';this[_0xeb33('0x2')]=_0x1a4bfd[_0xeb33('0x2')]||'';this[_0xeb33('0x3')]=_0x1a4bfd['zone']||'';this[_0xeb33('0x4')]=_0x1a4bfd['clientId']||'';this[_0xeb33('0x5')]=_0x1a4bfd[_0xeb33('0x5')]||'';this['serverUrl']=_0x1a4bfd[_0xeb33('0x6')]||'';this[_0xeb33('0x7')]=_0x1a4bfd[_0xeb33('0x7')]||'';this[_0xeb33('0x8')]=_0x1a4bfd[_0xeb33('0x8')]||'';this['Configurations']=_0x1a4bfd['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x6860=['name','description','host','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x45ae0d,_0x1ea3b9){var _0x371826=function(_0x20e757){while(--_0x20e757){_0x45ae0d['push'](_0x45ae0d['shift']());}};_0x371826(++_0x1ea3b9);}(_0x6860,0x8c));var _0x0686=function(_0x5eaa3e,_0x4bfc2a){_0x5eaa3e=_0x5eaa3e-0x0;var _0x5231a8=_0x6860[_0x5eaa3e];return _0x5231a8;};'use strict';function ZohoAccount(_0x234318){this['id']=_0x234318['id']||0x0;this[_0x0686('0x0')]=_0x234318['name']||'';this[_0x0686('0x1')]=_0x234318[_0x0686('0x1')]||'';this['host']=_0x234318[_0x0686('0x2')]||'';this['zone']=_0x234318['zone']||'';this[_0x0686('0x3')]=_0x234318[_0x0686('0x3')]||'';this[_0x0686('0x4')]=_0x234318[_0x0686('0x4')]||'';this[_0x0686('0x5')]=_0x234318[_0x0686('0x5')]||'';this[_0x0686('0x6')]=_0x234318[_0x0686('0x6')]||'';this[_0x0686('0x7')]=_0x234318['refreshToken']||'';this[_0x0686('0x8')]=_0x234318[_0x0686('0x8')]||{};}module[_0x0686('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 f118bcf..a11cbe0 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 _0xb623=['prototype','getCaller','\x22%s\x22\x20<%s>','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','Agent','channelAgent','format','SIP/%s','membername','calleridname','phone','Contact','firstName','lastName','active','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname'];(function(_0x31ff3f,_0xd7a6cd){var _0x2daeb6=function(_0x125173){while(--_0x125173){_0x31ff3f['push'](_0x31ff3f['shift']());}};_0x2daeb6(++_0xd7a6cd);}(_0xb623,0x186));var _0x3b62=function(_0x1ba0e4,_0x1e5076){_0x1ba0e4=_0x1ba0e4-0x0;var _0x26a982=_0xb623[_0x1ba0e4];return _0x26a982;};'use strict';var util=require(_0x3b62('0x0'));var _=require(_0x3b62('0x1'));var moment=require(_0x3b62('0x2'));function checkNameSurname(_0x8fb934,_0x4d6268,_0x340456){var _0x5087a4='';if(!_[_0x3b62('0x3')](_0x4d6268)&&'string'===typeof _0x4d6268){_0x5087a4+=_0x4d6268;}if(!_[_0x3b62('0x3')](_0x340456)&&_0x3b62('0x4')===typeof _0x340456){_0x5087a4+='\x20'+_0x340456;}if(_0x5087a4!==''){return _0x5087a4;}return _0x8fb934;}function Action(_0x5c58f2,_0x58e091,_0xba486a,_0x2745f6,_0x29967f){this['uniqueid']=_0xba486a||undefined;this[_0x3b62('0x5')]=_0x5c58f2['id'];this[_0x3b62('0x6')]=_0x58e091[_0x3b62('0x7')];this[_0x3b62('0x8')]=_0x58e091[_0x3b62('0x8')];this[_0x3b62('0x9')]='queue';this['dialAnswer']=![];this['membername']=_[_0x3b62('0x3')](_0x5c58f2[_0x3b62('0xa')])?undefined:_0x5c58f2[_0x3b62('0xa')][_0x3b62('0x7')];this[_0x3b62('0xb')]=this['membername']?util[_0x3b62('0xc')](_0x3b62('0xd'),this[_0x3b62('0xe')]):_0x2745f6||undefined;this[_0x3b62('0xf')]=checkNameSurname(_0x5c58f2['Contact'][_0x3b62('0x10')],_0x5c58f2[_0x3b62('0x11')][_0x3b62('0x12')],_0x5c58f2['Contact'][_0x3b62('0x13')]);this['active']=_0x5c58f2[_0x3b62('0x14')]||![];this[_0x3b62('0x15')]=_0x5c58f2[_0x3b62('0x11')][_0x3b62('0x10')];this['scheduledat']=_0x5c58f2['scheduledat'];this[_0x3b62('0x16')]=_0x5c58f2[_0x3b62('0x16')]||0x0;this['countcongestionretry']=_0x5c58f2[_0x3b62('0x17')]||0x0;this['countnoanswerretry']=_0x5c58f2[_0x3b62('0x18')]||0x0;this[_0x3b62('0x19')]=(_0x5c58f2[_0x3b62('0x16')]||0x0)+(_0x5c58f2[_0x3b62('0x17')]||0x0)+(_0x5c58f2['countnoanswerretry']||0x0)+(_0x5c58f2['countnosuchnumberretry']||0x0)+(_0x5c58f2[_0x3b62('0x1a')]||0x0)+(_0x5c58f2[_0x3b62('0x1b')]||0x0)+(_0x5c58f2[_0x3b62('0x1c')]||0x0)+(_0x5c58f2[_0x3b62('0x1d')]||0x0);this['countnosuchnumberretry']=_0x5c58f2['countnosuchnumberretry']||0x0;this[_0x3b62('0x1a')]=_0x5c58f2[_0x3b62('0x1a')]||0x0;this['countabandonedretry']=_0x5c58f2[_0x3b62('0x1b')]||0x0;this[_0x3b62('0x1c')]=_0x5c58f2[_0x3b62('0x1c')]||0x0;this['countagentrejectretry']=_0x5c58f2[_0x3b62('0x1d')]||0x0;this[_0x3b62('0x1e')]=_0x5c58f2[_0x3b62('0x1e')];this[_0x3b62('0x1f')]=_0x5c58f2[_0x3b62('0x1f')];this[_0x3b62('0x20')]=_0x5c58f2[_0x3b62('0x20')];this[_0x3b62('0x21')]=_0x5c58f2['recallme'];this[_0x3b62('0x22')]=_0x5c58f2[_0x3b62('0x22')];this[_0x3b62('0x23')]=_0x5c58f2[_0x3b62('0x23')];this[_0x3b62('0x24')]=_[_0x3b62('0x3')](_0x5c58f2['Agent'])?_0x5c58f2[_0x3b62('0x24')]:_0x5c58f2[_0x3b62('0xa')]['id'];this[_0x3b62('0x25')]=_0x5c58f2['VoiceQueueId'];this[_0x3b62('0x26')]='';this[_0x3b62('0x27')]='';}Action[_0x3b62('0x28')][_0x3b62('0x29')]=function(){return util[_0x3b62('0xc')](_0x3b62('0x2a'),this[_0x3b62('0xf')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0x48b3=['prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname'];(function(_0x36adef,_0x1df9d9){var _0x1039ab=function(_0x3fe17c){while(--_0x3fe17c){_0x36adef['push'](_0x36adef['shift']());}};_0x1039ab(++_0x1df9d9);}(_0x48b3,0x165));var _0x348b=function(_0x5bbee5,_0x44c786){_0x5bbee5=_0x5bbee5-0x0;var _0x169a2c=_0x48b3[_0x5bbee5];return _0x169a2c;};'use strict';var util=require(_0x348b('0x0'));var _=require(_0x348b('0x1'));var moment=require(_0x348b('0x2'));function checkNameSurname(_0xe017c5,_0x2b8aa3,_0x1a9579){var _0x5f1c76='';if(!_[_0x348b('0x3')](_0x2b8aa3)&&'string'===typeof _0x2b8aa3){_0x5f1c76+=_0x2b8aa3;}if(!_[_0x348b('0x3')](_0x1a9579)&&_0x348b('0x4')===typeof _0x1a9579){_0x5f1c76+='\x20'+_0x1a9579;}if(_0x5f1c76!==''){return _0x5f1c76;}return _0xe017c5;}function Action(_0x7672c1,_0x3f2923,_0xe84e1d,_0x39177f,_0x29ffb9){this[_0x348b('0x5')]=_0xe84e1d||undefined;this[_0x348b('0x6')]=_0x7672c1['id'];this[_0x348b('0x7')]=_0x3f2923[_0x348b('0x8')];this[_0x348b('0x9')]=_0x3f2923[_0x348b('0x9')];this[_0x348b('0xa')]=_0x348b('0x7');this[_0x348b('0xb')]=![];this[_0x348b('0xc')]=_[_0x348b('0x3')](_0x7672c1[_0x348b('0xd')])?undefined:_0x7672c1[_0x348b('0xd')][_0x348b('0x8')];this[_0x348b('0xe')]=this[_0x348b('0xc')]?util[_0x348b('0xf')](_0x348b('0x10'),this[_0x348b('0xc')]):_0x39177f||undefined;this[_0x348b('0x11')]=checkNameSurname(_0x7672c1[_0x348b('0x12')][_0x348b('0x13')],_0x7672c1[_0x348b('0x12')]['firstName'],_0x7672c1[_0x348b('0x12')]['lastName']);this[_0x348b('0x14')]=_0x7672c1['active']||![];this['calleridnum']=_0x7672c1['Contact'][_0x348b('0x13')];this[_0x348b('0x15')]=_0x7672c1[_0x348b('0x15')];this[_0x348b('0x16')]=_0x7672c1[_0x348b('0x16')]||0x0;this[_0x348b('0x17')]=_0x7672c1[_0x348b('0x17')]||0x0;this[_0x348b('0x18')]=_0x7672c1[_0x348b('0x18')]||0x0;this[_0x348b('0x19')]=(_0x7672c1['countbusyretry']||0x0)+(_0x7672c1['countcongestionretry']||0x0)+(_0x7672c1[_0x348b('0x18')]||0x0)+(_0x7672c1['countnosuchnumberretry']||0x0)+(_0x7672c1['countdropretry']||0x0)+(_0x7672c1[_0x348b('0x1a')]||0x0)+(_0x7672c1[_0x348b('0x1b')]||0x0)+(_0x7672c1[_0x348b('0x1c')]||0x0);this['countnosuchnumberretry']=_0x7672c1['countnosuchnumberretry']||0x0;this[_0x348b('0x1d')]=_0x7672c1[_0x348b('0x1d')]||0x0;this[_0x348b('0x1a')]=_0x7672c1[_0x348b('0x1a')]||0x0;this['countmachineretry']=_0x7672c1[_0x348b('0x1b')]||0x0;this[_0x348b('0x1c')]=_0x7672c1[_0x348b('0x1c')]||0x0;this[_0x348b('0x1e')]=_0x7672c1[_0x348b('0x1e')];this[_0x348b('0x1f')]=_0x7672c1[_0x348b('0x1f')];this[_0x348b('0x20')]=_0x7672c1[_0x348b('0x20')];this['recallme']=_0x7672c1[_0x348b('0x21')];this['ContactId']=_0x7672c1[_0x348b('0x22')];this[_0x348b('0x23')]=_0x7672c1['ListId'];this[_0x348b('0x24')]=_['isNil'](_0x7672c1['Agent'])?_0x7672c1['UserId']:_0x7672c1['Agent']['id'];this[_0x348b('0x25')]=_0x7672c1[_0x348b('0x25')];this['originatecalleridnum']='';this[_0x348b('0x26')]='';}Action[_0x348b('0x27')][_0x348b('0x28')]=function(){return util[_0x348b('0xf')](_0x348b('0x29'),this[_0x348b('0x11')],this[_0x348b('0x2a')]);};module[_0x348b('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index b5229e3..aed90ee 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 _0x0b78=['object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','Contact','phone','Contact\x20is\x20undefined','isEmpty','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','reachable','SIP/%s','unmonitored','unlock','unlockContact','execRun','getContactPreview','recallme','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','lookAgent','logLookAgent','response','idContact','custom:agentringnoanswer','rejected','syncHangup','[syncHangup][talking]','callProgressDetectingCustomer','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','transfererlinkedid','util','lodash','uuid','moment','ioredis','../../../config/logger','preview','./rpcDb','./util/util','redis','defaults','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','name','active','callerid','Interval','stringify','md5','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','recallMe','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','Agent','run','catch','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','logger2','setMessage','sendMessageOneNotActive','IsNotLoggedIn','NOT_ACTIVE','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','responsetime','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','linkedid','BUSY','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','countbusyretry','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','unlockAgent','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerRetryFrequency','activeContact','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined'];(function(_0x139ce1,_0x1fbcac){var _0x4f5599=function(_0x2b9a12){while(--_0x2b9a12){_0x139ce1['push'](_0x139ce1['shift']());}};_0x4f5599(++_0x1fbcac);}(_0x0b78,0x1ad));var _0x80b7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0b78[_0x40a045];return _0x1a687c;};'use strict';var util=require(_0x80b7('0x0'));var _=require(_0x80b7('0x1'));var BPromise=require('bluebird');var uuid=require(_0x80b7('0x2'));var moment=require(_0x80b7('0x3'));var md5=require('md5');var Redis=require(_0x80b7('0x4'));var config=require('../../../config/environment');var logger=require(_0x80b7('0x5'))(_0x80b7('0x6'));var loggerAction=require(_0x80b7('0x5'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0x80b7('0x7'));var Action=require('./action');var ut=require(_0x80b7('0x8'));config[_0x80b7('0x9')]=_[_0x80b7('0xa')](config[_0x80b7('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x80b7('0xb'))(new Redis(config[_0x80b7('0x9')]));var Sequence=function(){};Sequence[_0x80b7('0xc')]['enqueue']=function(_0x467f38){this['tail']=this[_0x80b7('0xd')]?this[_0x80b7('0xd')][_0x80b7('0xe')](_0x467f38):_0x467f38();};function Preview(_0x7b971b){this[_0x80b7('0xf')]=new Sequence();this[_0x80b7('0x10')]=_0x7b971b[_0x80b7('0x11')];this[_0x80b7('0x12')]=_0x7b971b[_0x80b7('0x12')];this[_0x80b7('0x13')]={};this[_0x80b7('0x14')]=_0x7b971b['agents'];this[_0x80b7('0x15')]=0x0;ami['on'](_0x80b7('0x16'),this['syncOriginateResponse'][_0x80b7('0x17')](this));ami['on'](_0x80b7('0x18'),this['syncHangup'][_0x80b7('0x17')](this));ami['on'](_0x80b7('0x19'),this[_0x80b7('0x1a')][_0x80b7('0x17')](this));ami['on'](_0x80b7('0x1b'),this[_0x80b7('0x1c')][_0x80b7('0x17')](this));ami['on'](_0x80b7('0x1d'),this[_0x80b7('0x1e')][_0x80b7('0x17')](this));ami['on']('varset',this[_0x80b7('0x1f')][_0x80b7('0x17')](this));ami['on'](_0x80b7('0x20'),this[_0x80b7('0x21')]['bind'](this));ami['on']('blindtransfer',this[_0x80b7('0x22')][_0x80b7('0x17')](this));this[_0x80b7('0x23')](this[_0x80b7('0x10')]);}function emit(_0x574e5c,_0x4f6eec,_0x2aebe3){io['to'](_0x574e5c)[_0x80b7('0x24')](_0x4f6eec,_0x2aebe3);}function emitCampaignPreview(_0xa465d2){if(_0xa465d2[_0x80b7('0x25')]==='outbound'){var _0x18d407={'id':_0xa465d2['id'],'name':_0xa465d2['name'],'strategy':_0xa465d2['strategy'],'answered':_0xa465d2[_0x80b7('0x26')],'available':_0xa465d2[_0x80b7('0x27')],'loggedIn':_0xa465d2[_0x80b7('0x28')],'pTalking':_0xa465d2[_0x80b7('0x29')],'sumBillable':_0xa465d2[_0x80b7('0x2a')],'sumDuration':_0xa465d2[_0x80b7('0x2b')],'sumHoldTime':_0xa465d2[_0x80b7('0x2c')]||0x0,'talking':_0xa465d2[_0x80b7('0x2d')],'total':_0xa465d2[_0x80b7('0x2e')],'type':_0xa465d2[_0x80b7('0x25')],'unmanaged':_0xa465d2[_0x80b7('0x2f')],'abandoned':_0xa465d2[_0x80b7('0x30')],'waiting':_0xa465d2[_0x80b7('0x31')],'loggedInDb':_0xa465d2[_0x80b7('0x32')],'dialActive':_0xa465d2[_0x80b7('0x33')],'dialMethod':_0xa465d2['dialMethod'],'dialOriginateCallerIdName':_0xa465d2[_0x80b7('0x34')],'dialOriginateCallerIdNumber':_0xa465d2[_0x80b7('0x35')],'dialOriginateTimeout':_0xa465d2['dialOriginateTimeout'],'dialPrefix':_0xa465d2[_0x80b7('0x36')],'outboundAnswerAgiCallsDay':_0xa465d2[_0x80b7('0x37')],'outboundAnswerCallsDay':_0xa465d2[_0x80b7('0x38')],'outboundBlacklistCallsDay':_0xa465d2['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0xa465d2[_0x80b7('0x39')],'outboundCongestionCallsDay':_0xa465d2[_0x80b7('0x3a')],'outboundDropCallsDayACS':_0xa465d2[_0x80b7('0x3b')],'outboundDropCallsDayCallersExit':_0xa465d2[_0x80b7('0x3c')],'outboundDropCallsDayTimeout':_0xa465d2[_0x80b7('0x3d')],'outboundNoAnswerCallsDay':_0xa465d2[_0x80b7('0x3e')],'outboundNoSuchCallsDay':_0xa465d2[_0x80b7('0x3f')],'outboundOriginateFailureCallsDay':_0xa465d2[_0x80b7('0x40')],'outboundReCallsDay':_0xa465d2[_0x80b7('0x41')],'outboundRejectCallsDay':_0xa465d2[_0x80b7('0x42')],'outboundUnknownCallsDay':_0xa465d2[_0x80b7('0x43')],'outboundAbandonedCallsDay':_0xa465d2[_0x80b7('0x44')],'predictiveIntervalAnsweredCalls':_0xa465d2[_0x80b7('0x45')],'predictiveIntervalAvgHoldtime':_0xa465d2['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0xa465d2['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0xa465d2[_0x80b7('0x46')],'predictiveIntervalDroppedCallsTimeout':_0xa465d2[_0x80b7('0x47')],'predictiveIntervalErlangCalls':_0xa465d2['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0xa465d2['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xa465d2[_0x80b7('0x48')],'predictiveIntervalMultiplicativeFactor':_0xa465d2[_0x80b7('0x49')],'predictiveIntervalPauses':_0xa465d2[_0x80b7('0x4a')],'predictiveIntervalAvailable':_0xa465d2[_0x80b7('0x4b')],'predictiveIntervalTotalCalls':_0xa465d2[_0x80b7('0x4c')],'message':_0xa465d2[_0x80b7('0x4d')],'originated':_0xa465d2['originated'],'erlangCalls':_0xa465d2[_0x80b7('0x4e')],'erlangCallToSecond':_0xa465d2[_0x80b7('0x4f')],'erlangAbandonmentRate':_0xa465d2[_0x80b7('0x50')],'erlangBusyFactor':_0xa465d2[_0x80b7('0x51')],'startPredictive':_0xa465d2['startPredictive'],'startProgressive':_0xa465d2[_0x80b7('0x52')]};if(_0xa465d2[_0x80b7('0x53')]){_0x18d407['Trunk']={'id':_0xa465d2[_0x80b7('0x53')]['id'],'name':_0xa465d2[_0x80b7('0x53')][_0x80b7('0x54')],'active':_0xa465d2[_0x80b7('0x53')][_0x80b7('0x55')],'callerid':_0xa465d2[_0x80b7('0x53')][_0x80b7('0x56')]};}if(_0xa465d2[_0x80b7('0x57')]){_0x18d407['Interval']={'id':_0xa465d2['Interval']['id'],'name':_0xa465d2['Interval'][_0x80b7('0x54')]};}var _0x26da30=md5(JSON[_0x80b7('0x58')](_0x18d407));if(_0xa465d2[_0x80b7('0x59')]!==_0x26da30){_0xa465d2[_0x80b7('0x59')]=_0x26da30;emit(util[_0x80b7('0x5a')](_0x80b7('0x5b'),_0x18d407[_0x80b7('0x54')]),'voice_queue:save',_0x18d407);}}}function emitVoiceQueueChannelRemove(_0x2a34eb){logger[_0x80b7('0x5c')](_0x80b7('0x5d'),JSON[_0x80b7('0x58')](_0x2a34eb));emit(util[_0x80b7('0x5a')](_0x80b7('0x5b'),_0x2a34eb['name']),_0x80b7('0x5e'),_0x2a34eb);io['emit'](_0x80b7('0x5f'),_0x2a34eb);}function notSendMessagesQueue(_0x1a6e69){if(_0x1a6e69['sendMessageOneNotActive']){if(_0x1a6e69['originated']===0x0&&_0x1a6e69[_0x80b7('0x29')]===0x0){_0x1a6e69['sendMessageOneNotActive']=![];_0x1a6e69['available']=0x0;_0x1a6e69[_0x80b7('0x60')]=0x0;_0x1a6e69[_0x80b7('0x4d')]='NOT_ACTIVE';ut[_0x80b7('0x61')](_0x80b7('0x62'),_0x1a6e69['name']+'\x20is\x20not\x20active');}else{_0x1a6e69[_0x80b7('0x4d')]=_0x80b7('0x63');ut[_0x80b7('0x61')](_0x80b7('0x62'),_0x1a6e69[_0x80b7('0x54')]+_0x80b7('0x64'));}emitCampaignPreview(_0x1a6e69);}}Preview['prototype'][_0x80b7('0x23')]=function(){var _0x46f4e9=this;setInterval(function(){_0x46f4e9[_0x80b7('0x65')]();},0x7cf);};Preview[_0x80b7('0xc')]['syncCampaigns']=function(){var _0x20a9b9=this['campaignsPreview'];this[_0x80b7('0x15')]+=0x1;for(var _0x199c29 in _0x20a9b9){if(_0x20a9b9[_0x80b7('0x66')](_0x199c29)&&(_0x20a9b9[_0x199c29][_0x80b7('0x67')]===_0x80b7('0x6')||_0x20a9b9[_0x199c29][_0x80b7('0x67')]===_0x80b7('0x68'))&&_0x20a9b9[_0x199c29][_0x80b7('0x25')]===_0x80b7('0x69')){if(this[_0x80b7('0x15')]>0x7){this[_0x80b7('0x15')]=0x0;this[_0x80b7('0x6a')]();}}if(_0x20a9b9[_0x80b7('0x66')](_0x199c29)&&_0x20a9b9[_0x199c29]['dialMethod']===_0x80b7('0x6')&&_0x20a9b9[_0x199c29][_0x80b7('0x25')]==='outbound'){if(_0x20a9b9[_0x199c29][_0x80b7('0x33')]){this['setMessage'](_0x20a9b9[_0x199c29]);if(_0x20a9b9[_0x199c29]['dialPreviewAutoRecallMe'])this[_0x80b7('0x6b')](_0x20a9b9[_0x199c29]);}else{notSendMessagesQueue(_0x20a9b9[_0x199c29]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x300bac){var _0x449a90=this;this['sequence'][_0x80b7('0x6c')](function(){if(!_[_0x80b7('0x6d')](_0x449a90[_0x80b7('0x13')][_0x300bac])){loggerAction['info'](_0x80b7('0x6e'),_0x300bac,_0x80b7('0x6f'),_0x449a90[_0x80b7('0x13')][_0x300bac][_0x80b7('0x70')],'originated:\x20',JSON['stringify'](_0x449a90['campaignsPreview'][_0x449a90[_0x80b7('0x13')][_0x300bac][_0x80b7('0x70')]][_0x80b7('0x71')]),_0x80b7('0x72'),JSON[_0x80b7('0x58')](_0x449a90[_0x80b7('0x10')][_0x449a90[_0x80b7('0x13')][_0x300bac][_0x80b7('0x70')]]['pTalking']),JSON['stringify'](_0x449a90[_0x80b7('0x13')][_0x300bac][_0x80b7('0x73')]),JSON[_0x80b7('0x58')](_[_0x80b7('0x74')](_0x449a90[_0x80b7('0x13')][_0x300bac],[_0x80b7('0x75'),'UserId',_0x80b7('0x76'),_0x80b7('0x77')])));return ami['Action']({'action':_0x80b7('0x78'),'channel':_0x449a90[_0x80b7('0x13')][_0x300bac][_0x80b7('0x79')]})['catch'](function(_0x5e29df){if(_0x5e29df[_0x80b7('0x4d')]===_0x80b7('0x7a')){setTimeout(function(){if(_0x449a90[_0x80b7('0x13')][_0x300bac]){ut[_0x80b7('0x7b')](_0x449a90[_0x80b7('0x10')][_0x449a90[_0x80b7('0x13')][_0x300bac]['queue']],_0x80b7('0x7c'));if(_0x449a90[_0x80b7('0x13')][_0x300bac][_0x80b7('0x73')]===!![]){ut[_0x80b7('0x7d')](_0x449a90[_0x80b7('0x10')][_0x449a90['actions'][_0x300bac]['queue']],_0x80b7('0x7c'));ut[_0x80b7('0x7e')](_0x80b7('0x7f')+_0x300bac,_0x449a90['actions'][_0x300bac][_0x80b7('0x70')]);}ut['loggerError'](_0x80b7('0x80')+_0x300bac,_0x449a90[_0x80b7('0x13')][_0x300bac][_0x80b7('0x70')]);delete _0x449a90[_0x80b7('0x13')][_0x300bac];}},0x2328);}});}});};Preview[_0x80b7('0xc')][_0x80b7('0x6a')]=function(){var _0x3923ef=this;loggerAction[_0x80b7('0x5c')](_0x80b7('0x81'),_[_0x80b7('0x82')](this[_0x80b7('0x13')]));for(var _0x461998 in this[_0x80b7('0x13')]){if(_0x3923ef[_0x80b7('0x13')]['hasOwnProperty'](_0x461998)){_0x3923ef[_0x80b7('0x83')](_0x461998);}}};Preview[_0x80b7('0xc')][_0x80b7('0x6b')]=function(_0x41c23c){var _0x2bc40a=this;rpcDb[_0x80b7('0x84')](_0x41c23c['id'],ut[_0x80b7('0x85')](this['agents']))[_0x80b7('0x86')](function(_0x23f06f){if(!_[_0x80b7('0x6d')](_0x23f06f)){for(var _0x251b87=0x0;_0x251b87<_0x23f06f['length'];_0x251b87+=0x1){if(ut[_0x80b7('0x87')](_0x23f06f[_0x251b87][_0x80b7('0x88')])<_0x41c23c['dialRecallMeTimeout']*0x3c){if(_0x23f06f[_0x251b87][_0x80b7('0x89')]&&!_0x23f06f[_0x251b87][_0x80b7('0x89')]['voicePause']){_0x2bc40a[_0x80b7('0x8a')](_0x23f06f[_0x251b87]['id'])[_0x80b7('0x86')](ut['logger2']('[RecallMe]'))[_0x80b7('0x8b')](ut['logger2'](_0x80b7('0x8c')));}else{rpcDb[_0x80b7('0x8d')](_0x23f06f[_0x251b87]['id']);}}else{var _0x57d361=new Action(_0x23f06f[_0x251b87],_0x41c23c);_0x57d361[_0x80b7('0x8e')]=moment()[_0x80b7('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x41c23c[_0x80b7('0x41')]+=0x1;ut[_0x80b7('0x8f')](_0x57d361,0x17,_0x80b7('0x90'));if(_0x41c23c[_0x80b7('0x91')]){rpcDb[_0x80b7('0x92')](ut[_0x80b7('0x93')](_0x23f06f[_0x251b87]));rpcDb[_0x80b7('0x94')](_0x57d361,_0x80b7('0x95'));}else{ut[_0x80b7('0x8f')](_0x57d361,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x57d361,_0x80b7('0x96'));rpcDb['createCustomerFinal'](_0x57d361,_0x80b7('0x96'));}}}}})[_0x80b7('0x8b')](ut[_0x80b7('0x97')]('[getContactRecallMe]'));};Preview[_0x80b7('0xc')][_0x80b7('0x98')]=function(_0x50af8a){_0x50af8a[_0x80b7('0x99')]=!![];if(ut[_0x80b7('0x9a')](_0x50af8a[_0x80b7('0x28')])){_0x50af8a[_0x80b7('0x4d')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x50af8a[_0x80b7('0x33')])){_0x50af8a[_0x80b7('0x4d')]=_0x80b7('0x9b');}else if(!this['isTrunkReachable'](_0x50af8a['Trunk'])){if(!this[_0x80b7('0x9c')](_0x50af8a[_0x80b7('0x9d')])){_0x50af8a[_0x80b7('0x4d')]='TRUNK_IS_NOT_REACHABLE';}else{_0x50af8a[_0x80b7('0x4d')]=_0x80b7('0x9e');}}else{_0x50af8a[_0x80b7('0x4d')]=_0x80b7('0x9e');}emitCampaignPreview(_0x50af8a);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x32257f,_0x3615df,_0x5a3bb8){var _0x5cf1df=this;var _0x50a69b=this['actions'][_0x3615df];var _0x3e8d05=this['campaignsPreview'][_0x50a69b['queue']];var _0x3418b5;if(_0x3e8d05){switch(_0x5a3bb8){case'1':_0x3e8d05[_0x80b7('0x3f')]+=0x1;_0x50a69b[_0x80b7('0x9f')]+=0x1;_0x50a69b[_0x80b7('0xa0')]=ut[_0x80b7('0xa1')](_0x50a69b);ut[_0x80b7('0x8f')](_0x50a69b,0x0,_0x80b7('0xa2'));ami[_0x80b7('0x24')](_0x80b7('0xa3'),ut['buildObj'](_0x50a69b,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x50a69b,_0x80b7('0xa4'));if(ut[_0x80b7('0xa1')](_0x50a69b)>=_0x3e8d05[_0x80b7('0xa5')]){_0x3418b5=ut[_0x80b7('0xa6')](_0x50a69b,0xf,'Global');rpcDb[_0x80b7('0xa7')](_0x3418b5,_0x80b7('0xa8'));}else{if(_0x50a69b['countnosuchnumberretry']>=_0x3e8d05['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x50a69b,_0x80b7('0xa8'));}else{rpcDb[_0x80b7('0xa9')](ut['scheduledAt'](_0x50a69b,_0x80b7('0x9f'),_0x3e8d05['dialNoSuchNumberRetryFrequency']),_0x50a69b['unlockAgent'],_0x50a69b['activeContact']);}}delete this['actions'][_0x32257f['linkedid']];break;case'ANSWER':var _0x5e8526=moment()[_0x80b7('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x50a69b[_0x80b7('0xaa')]=_0x5e8526;_0x50a69b['answertime']=_0x5e8526;_0x50a69b[_0x80b7('0x73')]=!![];_0x3e8d05[_0x80b7('0x29')]+=0x1;logger[_0x80b7('0x5c')]('[syncHangup][talking][increment]',_0x50a69b[_0x80b7('0xab')],_0x80b7('0xac'),_0x3e8d05['name'],_0x80b7('0x72'),_0x3e8d05[_0x80b7('0x29')]);ami['emit'](_0x80b7('0xad'),ut[_0x80b7('0xae')](_0x50a69b,_0x80b7('0xaf'),this['campaignsPreview'][_0x50a69b[_0x80b7('0x70')]]));if(_0x3e8d05['acw']){ami['emit']('custom:agentConnectPreview',ut[_0x80b7('0xb0')](_0x50a69b));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x80b7('0xae')](_0x50a69b,_0x80b7('0xb1'),this[_0x80b7('0x10')][_0x50a69b[_0x80b7('0x70')]]));emitVoiceQueueChannelRemove(ut[_0x80b7('0xae')](_0x50a69b,_0x80b7('0xb1')));_0x3e8d05[_0x80b7('0x38')]+=0x1;_0x3e8d05[_0x80b7('0x2e')]+=0x1;_0x3e8d05[_0x80b7('0x26')]+=0x1;ut[_0x80b7('0x7d')](_0x3e8d05,_0x80b7('0xb2'));_0x50a69b[_0x80b7('0xa0')]=ut['totalGlobal'](_0x50a69b);ut[_0x80b7('0x8f')](_0x50a69b,0x4,_0x80b7('0xb3'));rpcDb[_0x80b7('0x94')](_0x50a69b,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x80b7('0xa7')](_0x50a69b,_0x80b7('0xb4'));rpcDb[_0x80b7('0xb5')](_0x50a69b);_0x3e8d05[_0x80b7('0x2b')]+=_0x50a69b[_0x80b7('0xb6')];_0x3e8d05[_0x80b7('0x2a')]+=_0x50a69b[_0x80b7('0xb6')];logger[_0x80b7('0x5c')]('[syncHangup][talking][decrement]',_0x50a69b[_0x80b7('0xab')],_0x80b7('0xac'),_0x3e8d05[_0x80b7('0x54')],'pTalking:\x20',_0x3e8d05['pTalking']);delete this[_0x80b7('0x13')][_0x32257f[_0x80b7('0xb7')]];break;case _0x80b7('0xb8'):_0x3e8d05[_0x80b7('0x39')]+=0x1;_0x50a69b['countbusyretry']+=0x1;_0x50a69b[_0x80b7('0xa0')]=ut[_0x80b7('0xa1')](_0x50a69b);ut[_0x80b7('0x8f')](_0x50a69b,0x5,_0x80b7('0xb9'));ami['emit'](_0x80b7('0xba'),ut[_0x80b7('0xae')](_0x50a69b,_0x80b7('0xbb')));rpcDb['createCustomerHistory'](_0x50a69b,_0x80b7('0xbc'));if(ut[_0x80b7('0xa1')](_0x50a69b)>=_0x3e8d05[_0x80b7('0xa5')]){_0x3418b5=ut[_0x80b7('0xa6')](_0x50a69b,0xf,_0x80b7('0xbd'));rpcDb[_0x80b7('0xa7')](_0x3418b5,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x50a69b[_0x80b7('0xbe')]>=_0x3e8d05[_0x80b7('0xbf')]){rpcDb[_0x80b7('0xa7')](_0x50a69b,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x80b7('0xa9')](ut[_0x80b7('0xc0')](_0x50a69b,_0x80b7('0xbe'),_0x3e8d05[_0x80b7('0xc1')]),_0x50a69b[_0x80b7('0xc2')],_0x50a69b['activeContact']);}}break;case _0x80b7('0xc3'):_0x3e8d05[_0x80b7('0x3e')]+=0x1;_0x50a69b['countnoanswerretry']+=0x1;_0x50a69b[_0x80b7('0xa0')]=ut['totalGlobal'](_0x50a69b);ut[_0x80b7('0x8f')](_0x50a69b,0x3,'NoAnswer');ami[_0x80b7('0x24')](_0x80b7('0xc4'),ut['buildObj'](_0x50a69b,_0x80b7('0xc5')));rpcDb[_0x80b7('0x94')](_0x50a69b,_0x80b7('0xc6'));if(ut[_0x80b7('0xa1')](_0x50a69b)>=_0x3e8d05[_0x80b7('0xa5')]){_0x3418b5=ut['cloneAction'](_0x50a69b,0xf,'Global');rpcDb['createCustomerFinal'](_0x3418b5,_0x80b7('0xc7'));}else{if(_0x50a69b[_0x80b7('0xc8')]>=_0x3e8d05['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x50a69b,_0x80b7('0xc6'));}else{rpcDb[_0x80b7('0xa9')](ut[_0x80b7('0xc0')](_0x50a69b,_0x80b7('0xc8'),_0x3e8d05[_0x80b7('0xc9')]),_0x50a69b[_0x80b7('0xc2')],_0x50a69b[_0x80b7('0xca')]);}}break;case'CONGESTION':_0x3e8d05[_0x80b7('0x3a')]+=0x1;_0x50a69b[_0x80b7('0xcb')]+=0x1;_0x50a69b[_0x80b7('0xa0')]=ut[_0x80b7('0xa1')](_0x50a69b);ut[_0x80b7('0x8f')](_0x50a69b,0x8,_0x80b7('0xcc'));ami[_0x80b7('0x24')](_0x80b7('0xcd'),ut[_0x80b7('0xae')](_0x50a69b,'congestion'));rpcDb[_0x80b7('0x94')](_0x50a69b,_0x80b7('0xce'));if(ut[_0x80b7('0xa1')](_0x50a69b)>=_0x3e8d05[_0x80b7('0xa5')]){_0x3418b5=ut['cloneAction'](_0x50a69b,0xf,_0x80b7('0xbd'));rpcDb[_0x80b7('0xa7')](_0x3418b5,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x50a69b[_0x80b7('0xcb')]>=_0x3e8d05[_0x80b7('0xcf')]){rpcDb[_0x80b7('0xa7')](_0x50a69b,_0x80b7('0xce'));}else{rpcDb['rescheduleContact'](ut[_0x80b7('0xc0')](_0x50a69b,_0x80b7('0xcb'),_0x3e8d05[_0x80b7('0xc1')]),_0x50a69b[_0x80b7('0xc2')],_0x50a69b['activeContact']);}}break;case _0x80b7('0xd0'):_0x3e8d05['outboundRejectCallsDay']+=0x1;_0x50a69b[_0x80b7('0xd1')]+=0x1;_0x50a69b[_0x80b7('0xa0')]=ut['totalGlobal'](_0x50a69b);ut[_0x80b7('0x8f')](_0x50a69b,0x14,_0x80b7('0xd2'));ami['emit'](_0x80b7('0xd3'),ut[_0x80b7('0xae')](_0x50a69b,'agentreject'));rpcDb[_0x80b7('0x94')](_0x50a69b,_0x80b7('0xd4'));if(ut[_0x80b7('0xa1')](_0x50a69b)>=_0x3e8d05['dialGlobalMaxRetry']){_0x3418b5=ut[_0x80b7('0xa6')](_0x50a69b,0x14,_0x80b7('0xd2'));rpcDb[_0x80b7('0xa7')](_0x3418b5,_0x80b7('0xd5'));}else{if(_0x50a69b[_0x80b7('0xd1')]>=_0x3e8d05[_0x80b7('0xd6')]){rpcDb[_0x80b7('0xa7')](_0x50a69b,_0x80b7('0xd5'));}else{rpcDb[_0x80b7('0xa9')](ut[_0x80b7('0xc0')](_0x50a69b,'countagentrejectretry',_0x3e8d05['dialAgentRejectRetryFrequency']),_0x50a69b[_0x80b7('0xc2')],_0x50a69b[_0x80b7('0xca')]);}}break;case _0x80b7('0xd7'):_0x3e8d05[_0x80b7('0x44')]+=0x1;_0x50a69b[_0x80b7('0xd8')]+=0x1;_0x50a69b['countglobal']=ut[_0x80b7('0xa1')](_0x50a69b);ut[_0x80b7('0x8f')](_0x50a69b,0xb,_0x80b7('0xd9'));rpcDb[_0x80b7('0x94')](_0x50a69b,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x50a69b)>=_0x3e8d05['dialGlobalMaxRetry']){_0x3418b5=ut[_0x80b7('0xa6')](_0x50a69b,0xf,'Global');rpcDb[_0x80b7('0xa7')](_0x3418b5,_0x80b7('0xda'));}else{if(_0x50a69b[_0x80b7('0xdb')]>=_0x3e8d05[_0x80b7('0xdc')]){rpcDb[_0x80b7('0xa7')](_0x50a69b,_0x80b7('0xda'));}else{rpcDb['rescheduleContact'](ut[_0x80b7('0xc0')](_0x50a69b,_0x80b7('0xd8'),_0x3e8d05[_0x80b7('0xdd')]),_0x50a69b[_0x80b7('0xc2')],_0x50a69b[_0x80b7('0xca')]);}}break;case'18':_0x3e8d05[_0x80b7('0x43')]+=0x1;_0x50a69b['countmachineretry']+=0x1;_0x50a69b[_0x80b7('0xa0')]=ut[_0x80b7('0xa1')](_0x50a69b);ut[_0x80b7('0x8f')](_0x50a69b,0x12,_0x32257f[_0x80b7('0xde')]||_0x32257f[_0x80b7('0xdf')]);ami['emit'](_0x80b7('0xe0'),ut[_0x80b7('0xae')](_0x50a69b,'amd'));rpcDb[_0x80b7('0x94')](_0x50a69b,_0x80b7('0xe1'));if(ut['totalGlobal'](_0x50a69b)>=_0x3e8d05[_0x80b7('0xa5')]){_0x3418b5=ut[_0x80b7('0xa6')](_0x50a69b,0xf,_0x80b7('0xbd'));rpcDb[_0x80b7('0xa7')](_0x3418b5,_0x80b7('0xe1'));}else{rpcDb[_0x80b7('0xa7')](_0x50a69b,'[callProgressDetectingCustomer][hangupInAMD]');}delete this['actions'][_0x32257f[_0x80b7('0xb7')]];break;case'19':_0x3e8d05['outboundUnknownCallsDay']+=0x1;_0x50a69b[_0x80b7('0xa0')]=ut[_0x80b7('0xa1')](_0x50a69b);ut[_0x80b7('0x8f')](_0x50a69b,0x13,_0x32257f['cause-txt']||_0x32257f[_0x80b7('0xdf')]);ami[_0x80b7('0x24')](_0x80b7('0xe0'),ut[_0x80b7('0xae')](_0x50a69b,_0x80b7('0xe2')));rpcDb[_0x80b7('0x94')](_0x50a69b,_0x80b7('0xe3'));if(ut['totalGlobal'](_0x50a69b)>=_0x3e8d05[_0x80b7('0xa5')]){_0x3418b5=ut[_0x80b7('0xa6')](_0x50a69b,0xf,_0x80b7('0xbd'));rpcDb['createCustomerFinal'](_0x3418b5,_0x80b7('0xe3'));}else{rpcDb['createCustomerFinal'](_0x50a69b,_0x80b7('0xe3'));}delete this['actions'][_0x32257f['linkedid']];break;default:if(_0x50a69b[_0x80b7('0x73')]){ut[_0x80b7('0x7d')](_0x3e8d05,_0x80b7('0xe4'));ut[_0x80b7('0x7e')](_0x80b7('0xe5')+_0x3e8d05[_0x80b7('0x54')],_0x32257f);}_0x3e8d05['outboundUnknownCallsDay']+=0x1;_0x50a69b[_0x80b7('0xa0')]=ut[_0x80b7('0xa1')](_0x50a69b);ut[_0x80b7('0x8f')](_0x50a69b,0xc,_0x32257f[_0x80b7('0xde')]||_0x32257f['dialstatus']);rpcDb[_0x80b7('0x94')](_0x50a69b,_0x80b7('0xe6'));if(ut[_0x80b7('0xa1')](_0x50a69b)>=_0x3e8d05[_0x80b7('0xa5')]){_0x3418b5=ut['cloneAction'](_0x50a69b,0xf,_0x80b7('0xbd'));rpcDb[_0x80b7('0xa7')](_0x3418b5,_0x80b7('0xe7'));}else{rpcDb[_0x80b7('0xa7')](_0x50a69b,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x80b7('0x13')][_0x32257f['linkedid']];}if(!(_0x50a69b[_0x80b7('0x73')]&&_0x5a3bb8==='16')){ut[_0x80b7('0x7b')](_0x3e8d05,_0x80b7('0xe8'));logger['info'](_0x80b7('0xe9'),_0x50a69b['uniqueid'],'\x20Queue',_0x3e8d05[_0x80b7('0x54')],_0x80b7('0xea'),_0x3e8d05['originated']);}if(_0x5a3bb8!==_0x80b7('0xeb')){delete this[_0x80b7('0x13')][_0x32257f['linkedid']];delete this[_0x80b7('0x13')][_0x32257f[_0x80b7('0xec')]];}}};Preview[_0x80b7('0xc')][_0x80b7('0xed')]=function(_0x16fbe4,_0x27a28e,_0x1347b4){if(_[_0x80b7('0xee')](_0x27a28e)&&_0x80b7('0xef')!==typeof _0x27a28e){return;}if(_['isUndefined'](_0x1347b4)&&_0x80b7('0xef')!==typeof _0x1347b4){return;}switch(_0x1347b4[_0x80b7('0xf0')]){case'0':ut['logAgent'](_0x16fbe4,0x0,_0x80b7('0xa2'));rpcDb[_0x80b7('0xf1')](_0x16fbe4,_0x80b7('0xf2'));break;case'3':ut[_0x80b7('0xf3')](_0x16fbe4,0x3,_0x80b7('0xf4'));rpcDb[_0x80b7('0xf1')](_0x16fbe4,_0x80b7('0xf5'));break;case'5':ut[_0x80b7('0xf3')](_0x16fbe4,0x5,_0x80b7('0xb9'));rpcDb['createAgentHistory'](_0x16fbe4,_0x80b7('0xf6'));break;case'8':ut[_0x80b7('0xf3')](_0x16fbe4,0x8,_0x80b7('0xcc'));rpcDb[_0x80b7('0xf1')](_0x16fbe4,_0x80b7('0xf7'));break;case'22':ut['logAgent'](_0x16fbe4,0x16,_0x80b7('0xf8'));rpcDb[_0x80b7('0xf1')](_0x16fbe4,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x80b7('0xf3')](_0x16fbe4,0xc,_0x1347b4['reason']);rpcDb['createAgentHistory'](_0x16fbe4,_0x80b7('0xf7'));}ut[_0x80b7('0x7b')](_0x27a28e,_0x80b7('0xf9'));logger[_0x80b7('0x5c')]('[originated][decrement][callProgressDetectingAgent]',_0x16fbe4[_0x80b7('0xab')],_0x80b7('0xac'),_0x27a28e[_0x80b7('0x54')],_0x80b7('0xea'),_0x27a28e['originated']);delete this[_0x80b7('0x13')][_0x16fbe4['uniqueid']];};Preview[_0x80b7('0xc')]['checkInBlack']=function(_0x1782b9,_0x305b7f,_0x2e3a5a,_0xf512f4,_0x5302e6){var _0x1a7f00=this;return new BPromise(function(_0x196e70,_0x1196b7){if(_[_0x80b7('0x6d')](_0x305b7f)||_[_0x80b7('0x6d')](_0x305b7f[_0x80b7('0xfa')])||_[_0x80b7('0x6d')](_0x305b7f[_0x80b7('0xfa')][_0x80b7('0xfb')])||_[_0x80b7('0x6d')](_0x305b7f[_0x80b7('0x76')])){_0x1196b7(ut[_0x80b7('0x4d')](_0x80b7('0xfc'),_0xf512f4,_0x5302e6));return;}var _0x76ed0f=uuid['v4']();var _0x3a8b2b=_0x1a7f00[_0x80b7('0x10')][_0x305b7f[_0x80b7('0x6f')][_0x80b7('0x54')]];var _0x3c7880=_0x2e3a5a?_0x1a7f00[_0x80b7('0x14')][_0x2e3a5a]['id']:undefined;_0x1a7f00['actions'][_0x76ed0f]=new Action(_0x305b7f,_0x3a8b2b,_0x76ed0f,_0x2e3a5a,_0x3c7880);var _0x18b01b=_0x1a7f00[_0x80b7('0x13')][_0x76ed0f];_0x18b01b[_0x80b7('0xc2')]=_0xf512f4;_0x18b01b[_0x80b7('0xca')]=_0x5302e6;_0x18b01b['lookAgent']=_0x2e3a5a;if(_[_0x80b7('0xfd')](_0x1782b9)){_0x1a7f00['execCall'](_0x18b01b,_0x3a8b2b,_0x305b7f,_0x2e3a5a)[_0x80b7('0x86')](function(_0x2fd949){logger[_0x80b7('0x5c')]('[Preview][execCall][success]',_0x80b7('0xfe')+_0x18b01b[_0x80b7('0x70')]+_0x80b7('0xff')+_0x18b01b['idContact'],JSON[_0x80b7('0x58')](_0x2fd949));ami[_0x80b7('0x24')](_0x80b7('0x100'),ut['buildObj'](_0x18b01b,'called',_0x1a7f00[_0x80b7('0x10')][_0x18b01b[_0x80b7('0x70')]]));_0x196e70(ut[_0x80b7('0x4d')](_0x80b7('0x101')));})['catch'](function(_0x20045b){ut['logger']('[Preview][execCall][failure]',_0x20045b);_0x1196b7(ut[_0x80b7('0x4d')](_0x80b7('0x102'),_0xf512f4,_0x5302e6));});}else{_0x3a8b2b[_0x80b7('0x103')]+=0x1;ut[_0x80b7('0x104')](_0x18b01b);rpcDb[_0x80b7('0x105')](_0x18b01b,'[Blacklist][error]');delete _0x1a7f00['actions'][_0x76ed0f];_0x1196b7(ut[_0x80b7('0x4d')](_0x80b7('0x106'),_0xf512f4,_0x5302e6));}});};Preview['prototype'][_0x80b7('0x9c')]=function(_0x5181a7){return!_[_0x80b7('0x6d')](_0x5181a7)&&!_[_0x80b7('0x6d')](_0x5181a7[_0x80b7('0x54')])&&!_[_0x80b7('0x6d')](_0x5181a7['active'])&&_0x5181a7['active']&&!_[_0x80b7('0x6d')](this['trunks'][util['format']('SIP/%s',_0x5181a7[_0x80b7('0x54')])])&&!_[_0x80b7('0x6d')](this[_0x80b7('0x12')][util['format']('SIP/%s',_0x5181a7['name'])][_0x80b7('0x78')])&&(this[_0x80b7('0x12')][util[_0x80b7('0x5a')]('SIP/%s',_0x5181a7[_0x80b7('0x54')])][_0x80b7('0x78')]===_0x80b7('0x107')||this[_0x80b7('0x12')][util[_0x80b7('0x5a')](_0x80b7('0x108'),_0x5181a7[_0x80b7('0x54')])][_0x80b7('0x78')]===_0x80b7('0x109'));};Preview['prototype'][_0x80b7('0x8a')]=function(_0x295bf5,_0x4513f1){var _0x36298c=this;return new BPromise(function(_0x38e029,_0x98b37d){_0x36298c['execRun'](_0x295bf5,_0x4513f1)[_0x80b7('0x86')](function(_0x5bb1e5){_0x38e029(_[_0x80b7('0x74')](_0x5bb1e5,[_0x80b7('0x4d')]));})[_0x80b7('0x8b')](function(_0x275191){if(_0x275191[_0x80b7('0x10a')]){rpcDb[_0x80b7('0x10b')](_0x295bf5);}if(_0x275191['active']){rpcDb[_0x80b7('0x8d')](_0x295bf5);}_0x98b37d(_[_0x80b7('0x74')](_0x275191,[_0x80b7('0x4d')]));});});};Preview[_0x80b7('0xc')][_0x80b7('0x10c')]=function(_0x11b66b,_0x2ae92c){var _0x203bd3=this;return new BPromise(function(_0x555a3a,_0x1a2ee3){var _0x50c7e4,_0x24cb81;rpcDb[_0x80b7('0x10d')](_0x11b66b)[_0x80b7('0x86')](function(_0x29da49){if(!_[_0x80b7('0x6d')](_0x29da49[0x0])){_0x24cb81=_0x29da49[0x0][_0x80b7('0x10e')]?![]:!![];_0x50c7e4=_0x29da49[0x0][_0x80b7('0x10e')]?!![]:![];_0x50c7e4=_0x2ae92c?!![]:_0x50c7e4;}var _0x4ad61c=_0x203bd3['validateContact'](_0x29da49);if(_0x4ad61c['isValid']){rpcDb[_0x80b7('0x10f')](_[_0x80b7('0x74')](_0x29da49[0x0],[_0x80b7('0x76'),_0x80b7('0x110')]))[_0x80b7('0x86')](function(_0xfe4feb){_0x203bd3['checkInBlack'](_0xfe4feb,_0x29da49[0x0],_0x2ae92c,_0x24cb81,_0x50c7e4)['then'](function(_0x5035a0){_0x555a3a(_0x5035a0);})[_0x80b7('0x8b')](function(_0x55fc57){_0x1a2ee3(_0x55fc57);});})['catch'](function(_0x390f40){ut['logger'](_0x80b7('0x111'),_0x390f40);_0x1a2ee3(ut[_0x80b7('0x4d')](_0x80b7('0x112'),_0x24cb81,_0x50c7e4));});}else{_0x1a2ee3(ut['message'](_0x4ad61c['message'],_0x24cb81,_0x50c7e4));}})[_0x80b7('0x8b')](function(_0x14b588){ut[_0x80b7('0x61')](_0x80b7('0x113'),_0x14b588);_0x1a2ee3(ut[_0x80b7('0x4d')](_0x80b7('0x112'),![],!![]));});});};Preview[_0x80b7('0xc')][_0x80b7('0x114')]=function(_0x1e5e08){if(_[_0x80b7('0x6d')](_0x1e5e08)||_['isEmpty'](_0x1e5e08)||!_[_0x80b7('0x6d')](_0x1e5e08[0x0][_0x80b7('0x89')])&&_[_0x80b7('0x6d')](_0x1e5e08[0x0]['Agent'][_0x80b7('0x54')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x1e5e08);return{'isValid':![],'message':_0x80b7('0x115')};}var _0x40f753=this[_0x80b7('0x10')][_0x1e5e08[0x0][_0x80b7('0x6f')][_0x80b7('0x54')]];_0x40f753[_0x80b7('0x4d')]='ACTIVE';if(_[_0x80b7('0x6d')](_0x40f753)){ut[_0x80b7('0x61')]('[Preview][validateContact][Empty\x20Campaign]',_0x40f753);return{'isValid':![],'message':_0x80b7('0x116')};}if(!this[_0x80b7('0x9c')](_0x40f753[_0x80b7('0x53')])){ut[_0x80b7('0x61')](_0x80b7('0x117'),'campaign\x20Name:\x20'+_0x40f753['name']+_0x80b7('0x118'));if(!this[_0x80b7('0x9c')](_0x40f753[_0x80b7('0x9d')])){ut[_0x80b7('0x61')](_0x80b7('0x117'),_0x40f753[_0x80b7('0x54')]+_0x80b7('0x119'));return{'isValid':![],'message':_0x80b7('0x11a')};}}if(!ut[_0x80b7('0x11b')](_0x40f753['dialActive'])){ut[_0x80b7('0x61')](_0x80b7('0x11c'),_0x40f753['name']+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x40f753['name']+_0x80b7('0x11d')};}return{'isValid':!![],'message':_0x80b7('0x11e')};};Preview[_0x80b7('0xc')][_0x80b7('0x11f')]=function(_0x1026ef,_0x40553a,_0x3dcbe6,_0x2f8c9d){var _0x452045=this;return new BPromise(function(_0x977c84,_0x162cda){var _0x404b81=_0x1026ef['uniqueid'];var _0x1acd1e=_0x452045[_0x80b7('0x9c')](_0x40553a['Trunk'])?util[_0x80b7('0x5a')](_0x80b7('0x120'),_0x40553a[_0x80b7('0x53')][_0x80b7('0x54')],_[_0x80b7('0x6d')](_0x40553a[_0x80b7('0x36')])?'':_0x40553a[_0x80b7('0x36')][_0x80b7('0x121')]()||'',_0x40553a[_0x80b7('0x122')]>0x0?_0x3dcbe6[_0x80b7('0xfa')][_0x80b7('0xfb')][_0x80b7('0x123')](_0x40553a[_0x80b7('0x122')]):_0x3dcbe6['Contact']['phone']):util[_0x80b7('0x5a')](_0x80b7('0x120'),_[_0x80b7('0x6d')](_0x40553a['TrunkBackup'])?_0x40553a[_0x80b7('0x53')][_0x80b7('0x54')]:_0x40553a[_0x80b7('0x9d')][_0x80b7('0x54')],_[_0x80b7('0x6d')](_0x40553a[_0x80b7('0x36')])?'':_0x40553a[_0x80b7('0x36')]['trim']()||'',_0x40553a[_0x80b7('0x122')]>0x0?_0x3dcbe6[_0x80b7('0xfa')][_0x80b7('0xfb')][_0x80b7('0x123')](_0x40553a[_0x80b7('0x122')]):_0x3dcbe6[_0x80b7('0xfa')][_0x80b7('0xfb')]);var _0x40f9b8=_0x452045[_0x80b7('0x9c')](_0x40553a[_0x80b7('0x53')])?ut[_0x80b7('0x124')](_0x40553a[_0x80b7('0x53')]['callerid'],_0x40553a[_0x80b7('0x34')],_0x40553a[_0x80b7('0x125')]>0x0?ut[_0x80b7('0x126')](_0x40553a[_0x80b7('0x35')],_0x40553a['dialRandomLastDigitCallerIdNumber']):_0x40553a[_0x80b7('0x35')]):ut[_0x80b7('0x124')](_[_0x80b7('0x6d')](_0x40553a[_0x80b7('0x9d')])?_0x40553a['Trunk'][_0x80b7('0x56')]:_0x40553a[_0x80b7('0x9d')]['callerid'],_0x40553a[_0x80b7('0x34')],_0x40553a[_0x80b7('0x125')]>0x0?ut[_0x80b7('0x126')](_0x40553a[_0x80b7('0x35')],_0x40553a['dialRandomLastDigitCallerIdNumber']):_0x40553a[_0x80b7('0x35')]);if(_0x40f9b8){_0x1026ef['originatecalleridname']=ut[_0x80b7('0x127')](_0x40f9b8);_0x1026ef[_0x80b7('0x128')]=ut[_0x80b7('0x129')](_0x40f9b8);}var _0x1a1408=ut['addVariables'](_0x40553a,_0x3dcbe6,_0x1acd1e,_0x40f9b8,_0x404b81,_0x1026ef);_[_0x80b7('0x12a')](_0x1026ef,ut[_0x80b7('0x12b')](_0x1a1408));_0x1026ef[_0x80b7('0x8e')]=moment()[_0x80b7('0x5a')](_0x80b7('0x12c'));ami['Action'](ut[_0x80b7('0x12d')](_0x1026ef,_0x40553a,_0x1a1408,_0x1026ef[_0x80b7('0xca')],_0x2f8c9d))[_0x80b7('0x86')](function(_0xe8eaf4){_0x40553a[_0x80b7('0x71')]+=0x1;logger[_0x80b7('0x5c')](_0x80b7('0x12e'),_0x404b81,_0x80b7('0xac'),_0x40553a[_0x80b7('0x54')],_0x80b7('0xea'),_0x40553a[_0x80b7('0x71')]);_0x977c84(_0xe8eaf4);})[_0x80b7('0x8b')](function(_0x38968c){ut[_0x80b7('0xf3')](_0x1026ef,0xe,_0x80b7('0x12f'));rpcDb[_0x80b7('0xf1')](_0x1026ef,_0x80b7('0x130'));_0x162cda(_0x38968c);});});};Preview[_0x80b7('0xc')][_0x80b7('0x1e')]=function(_0x4b2882){if(this[_0x80b7('0x13')][_0x4b2882[_0x80b7('0xb7')]]){this[_0x80b7('0x13')][_0x4b2882[_0x80b7('0xb7')]][_0x80b7('0x79')]=_0x4b2882[_0x80b7('0x79')];}};Preview[_0x80b7('0xc')][_0x80b7('0x131')]=function(_0x1de76f){var _0x43bafa=this;var _0x1a8785=this['actions'][_0x1de76f[_0x80b7('0x132')]];if(_0x1a8785){if(_0x1a8785[_0x80b7('0x133')]&&this[_0x80b7('0x14')][_0x1a8785[_0x80b7('0x133')]]){ut[_0x80b7('0x134')](_0x1a8785,this['agents'][_0x1a8785[_0x80b7('0x133')]][_0x80b7('0x54')],this[_0x80b7('0x14')][_0x1a8785[_0x80b7('0x133')]]['id']);}var _0x3f16c9=_['clone'](_0x1a8785);_0x3f16c9['responsetime']=moment()[_0x80b7('0x5a')](_0x80b7('0x12c'));var _0x39b665=_0x43bafa['campaignsPreview'][_0x1a8785['queue']];if(ut['isFailure'](_0x1de76f[_0x80b7('0x135')])){if(_0x1a8785[_0x80b7('0xc2')]){rpcDb[_0x80b7('0x10b')](_0x1a8785[_0x80b7('0x136')]);}if(_0x1a8785[_0x80b7('0xca')]){rpcDb[_0x80b7('0x8d')](_0x1a8785[_0x80b7('0x136')]);}ami[_0x80b7('0x24')](_0x80b7('0x137'),ut[_0x80b7('0xae')](_0x1a8785,_0x80b7('0x138'),this[_0x80b7('0x10')][_0x1a8785['queue']]));this['callProgressDetectingAgent'](_0x3f16c9,_0x39b665,_0x1de76f);}else{_0x1a8785['starttime']=moment()[_0x80b7('0x5a')](_0x80b7('0x12c'));ut['logAgent'](_0x3f16c9,0x4,_0x80b7('0xb3'));rpcDb[_0x80b7('0xf1')](_0x3f16c9,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x80b7('0xc')][_0x80b7('0x139')]=function(_0x31030b){var _0x4ebe2f=this;var _0xa6cbce=this[_0x80b7('0x13')][_0x31030b[_0x80b7('0xb7')]];var _0x467bb8;if(_0xa6cbce){_0x467bb8=this[_0x80b7('0x10')][_0xa6cbce[_0x80b7('0x70')]];logger['info'](_0x80b7('0x13a'),_0x31030b[_0x80b7('0xb7')],'\x20Queue',_0x467bb8[_0x80b7('0x54')],_0x80b7('0x72'),_0x467bb8[_0x80b7('0x29')]);}if(this['actions'][_0x31030b[_0x80b7('0xb7')]]&&_0x31030b[_0x80b7('0xb7')]!==_0x31030b[_0x80b7('0xab')]){if(_0x31030b['cause']==='16'&&this[_0x80b7('0x13')][_0x31030b[_0x80b7('0xb7')]][_0x80b7('0x73')]){this[_0x80b7('0x13b')](_0x31030b,_0x31030b[_0x80b7('0xb7')],_0x31030b[_0x80b7('0x13c')]);}else if(this[_0x80b7('0x13')][_0x31030b[_0x80b7('0xb7')]][_0x80b7('0x73')]){logger[_0x80b7('0x5c')](_0x80b7('0x13d'),_0x31030b[_0x80b7('0xb7')],_0x31030b['cause'],_0x80b7('0xac'),_0x467bb8[_0x80b7('0x54')],_0x80b7('0x72'),_0x467bb8[_0x80b7('0x29')]);this[_0x80b7('0x13b')](_0x31030b,_0x31030b[_0x80b7('0xb7')],_0x31030b[_0x80b7('0x13c')]);}}else if(_0xa6cbce&&_[_0x80b7('0x6d')](_0xa6cbce[_0x80b7('0x13e')])&&_0x467bb8[_0x80b7('0x13f')]&&_0x31030b[_0x80b7('0xb7')]===_0x31030b[_0x80b7('0xab')]&&_[_0x80b7('0x6d')](_0x31030b[_0x80b7('0xf0')])&&_0x31030b['cause']==='16'&&_0x31030b[_0x80b7('0x140')]==='6'&&_['isUndefined'](_0xa6cbce['transfer'])){if(_0xa6cbce[_0x80b7('0xc2')]){rpcDb[_0x80b7('0x10b')](_0xa6cbce['idContact']);}if(_0xa6cbce['activeContact']){rpcDb[_0x80b7('0x8d')](_0xa6cbce[_0x80b7('0x136')]);}_0x31030b[_0x80b7('0xf0')]='22';this[_0x80b7('0xed')](_0xa6cbce,_0x467bb8,_0x31030b);}else if(_0xa6cbce&&_0xa6cbce['transfer']){if(_0x31030b[_0x80b7('0x13c')]==='16'&&this[_0x80b7('0x13')][_0x31030b['linkedid']][_0x80b7('0x73')]){logger[_0x80b7('0x5c')](_0x80b7('0x141'),_0x31030b[_0x80b7('0xb7')],_0x31030b[_0x80b7('0x13c')],_0x80b7('0xac'),_0x467bb8[_0x80b7('0x54')],_0x80b7('0x72'),_0x467bb8[_0x80b7('0x29')]);this[_0x80b7('0x13b')](_0x31030b,_0x31030b[_0x80b7('0xb7')],_0x31030b[_0x80b7('0x13c')]);}else if(this[_0x80b7('0x13')][_0x31030b[_0x80b7('0xb7')]]['dialAnswer']){logger[_0x80b7('0x5c')]('[syncHangup][talking][cause]',_0x31030b[_0x80b7('0xb7')],_0x31030b[_0x80b7('0x13c')],_0x80b7('0xac'),_0x467bb8[_0x80b7('0x54')],_0x80b7('0x72'),_0x467bb8[_0x80b7('0x29')]);this[_0x80b7('0x13b')](_0x31030b,_0x31030b[_0x80b7('0xb7')],_0x31030b[_0x80b7('0x13c')]);}}};Preview['prototype'][_0x80b7('0x1c')]=function(_0x1a9000){if(this[_0x80b7('0x13')][_0x1a9000[_0x80b7('0xec')]]&&_0x1a9000[_0x80b7('0xec')]!==_0x1a9000[_0x80b7('0x142')]){this[_0x80b7('0x13b')](_0x1a9000,_0x1a9000[_0x80b7('0xec')],_0x1a9000[_0x80b7('0xdf')]);}};Preview[_0x80b7('0xc')][_0x80b7('0x1a')]=function(_0x33efd0){if(this[_0x80b7('0x13')][_0x33efd0[_0x80b7('0xb7')]]&&_0x33efd0['linkedid']!==_0x33efd0['uniqueid']&&!this[_0x80b7('0x13')][_0x33efd0[_0x80b7('0xb7')]][_0x80b7('0x73')]){if(_0x33efd0[_0x80b7('0x13c')]==='1'){this[_0x80b7('0x13b')](_0x33efd0,_0x33efd0['linkedid'],_0x33efd0[_0x80b7('0x13c')]);}}};Preview[_0x80b7('0xc')][_0x80b7('0x143')]=function(_0x3c72af,_0x34ca05,_0x1e1a2e){if(this['actions'][_0x3c72af]){if(_[_0x80b7('0x6d')](this['actions'][_0x3c72af][_0x80b7('0x144')])){this[_0x80b7('0x13')][_0x3c72af][_0x80b7('0x144')]={};}this[_0x80b7('0x13')][_0x3c72af][_0x80b7('0x144')][_0x34ca05]=_0x1e1a2e;}};Preview[_0x80b7('0xc')]['syncVarSet']=function(_0x55bbf6){try{if(!_[_0x80b7('0x6d')](_0x55bbf6)){if(ut[_0x80b7('0x145')](_[_0x80b7('0x146')](_0x55bbf6[_0x80b7('0x147')])[0x0])){this[_0x80b7('0x143')](_0x55bbf6[_0x80b7('0xab')],_[_0x80b7('0x146')](_0x55bbf6[_0x80b7('0x147')])[0x0],_0x55bbf6[_0x80b7('0x148')]);}}}catch(_0x1b7f52){logger['error'](_0x80b7('0x149'),util[_0x80b7('0x14a')](_0x1b7f52,{'showHidden':![],'depth':null}));}};Preview[_0x80b7('0xc')][_0x80b7('0x21')]=function(_0x373a0d){if(_0x373a0d){if(this['actions'][_0x373a0d[_0x80b7('0x14b')]]){this[_0x80b7('0x13')][_0x373a0d[_0x80b7('0x14b')]][_0x80b7('0x14c')]=!![];}}};Preview[_0x80b7('0xc')][_0x80b7('0x22')]=function(_0x62c89d){if(_0x62c89d){if(this[_0x80b7('0x13')][_0x62c89d[_0x80b7('0x14d')]]){this[_0x80b7('0x13')][_0x62c89d[_0x80b7('0x14d')]][_0x80b7('0x14c')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x008c=['dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','merge','toLowerVariables','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','starttime','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','isUndefined','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','variables','syncVarSet','filterKey','keys','variable','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','redis','prototype','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','dialend','syncDialEnd','newexten','attendedtransfer','type','outbound','name','strategy','answered','loggedIn','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialActive','dialMethod','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','md5','format','voice_queue:save','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','available','paused','message','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','booked','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','enqueue','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','clearZombieChannels','info','[action]','getContactRecallMe','agentReadyId','agents','isNil','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','then','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','unlockAgent','activeContact','linkedid','responsetime','answertime','uniqueid','custom:agentconnect','buildObj','connect','acw','buildAcw','custom:agentcomplete','complete','[callProgressDetectingCustomer][logAnswer]','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','pTalking:\x20','BUSY','countbusyretry','custom:agentbusy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','scheduledAt','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialBusyRetryFrequency','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','run','execRun','unlockContact','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','checkInBlack','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','phone','substring','getCallerId','dialOriginateCallerIdName'];(function(_0x4d121d,_0x3fe733){var _0xffa031=function(_0x1fec1b){while(--_0x1fec1b){_0x4d121d['push'](_0x4d121d['shift']());}};_0xffa031(++_0x3fe733);}(_0x008c,0x188));var _0xc008=function(_0x181728,_0x471cc4){_0x181728=_0x181728-0x0;var _0x3525db=_0x008c[_0x181728];return _0x3525db;};'use strict';var util=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var BPromise=require(_0xc008('0x2'));var uuid=require(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var md5=require('md5');var Redis=require(_0xc008('0x5'));var config=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var loggerAction=require(_0xc008('0x7'))(_0xc008('0x9'));var ami=require(_0xc008('0xa'));var rpcDb=require(_0xc008('0xb'));var Action=require(_0xc008('0xc'));var ut=require('./util/util');config[_0xc008('0xd')]=_['defaults'](config[_0xc008('0xd')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc008('0xd')]));var Sequence=function(){};Sequence[_0xc008('0xe')]['enqueue']=function(_0x51ba7d){this['tail']=this[_0xc008('0xf')]?this[_0xc008('0xf')]['finally'](_0x51ba7d):_0x51ba7d();};function Preview(_0xae2dab){this[_0xc008('0x10')]=new Sequence();this[_0xc008('0x11')]=_0xae2dab[_0xc008('0x12')];this[_0xc008('0x13')]=_0xae2dab[_0xc008('0x13')];this[_0xc008('0x14')]={};this['agents']=_0xae2dab['agents'];this[_0xc008('0x15')]=0x0;ami['on']('originateresponse',this[_0xc008('0x16')][_0xc008('0x17')](this));ami['on'](_0xc008('0x18'),this[_0xc008('0x19')][_0xc008('0x17')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0xc008('0x1a'),this[_0xc008('0x1b')][_0xc008('0x17')](this));ami['on'](_0xc008('0x1c'),this['syncNewExten']['bind'](this));ami['on']('varset',this['syncVarSet'][_0xc008('0x17')](this));ami['on'](_0xc008('0x1d'),this['syncAttendedTransfer'][_0xc008('0x17')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));this['loopCampaigns'](this[_0xc008('0x11')]);}function emit(_0x4b9726,_0x5560b1,_0x590a71){io['to'](_0x4b9726)['emit'](_0x5560b1,_0x590a71);}function emitCampaignPreview(_0x5a58bd){if(_0x5a58bd[_0xc008('0x1e')]===_0xc008('0x1f')){var _0x251db2={'id':_0x5a58bd['id'],'name':_0x5a58bd[_0xc008('0x20')],'strategy':_0x5a58bd[_0xc008('0x21')],'answered':_0x5a58bd[_0xc008('0x22')],'available':_0x5a58bd['available'],'loggedIn':_0x5a58bd[_0xc008('0x23')],'pTalking':_0x5a58bd['pTalking'],'sumBillable':_0x5a58bd['sumBillable'],'sumDuration':_0x5a58bd[_0xc008('0x24')],'sumHoldTime':_0x5a58bd[_0xc008('0x25')]||0x0,'talking':_0x5a58bd[_0xc008('0x26')],'total':_0x5a58bd[_0xc008('0x27')],'type':_0x5a58bd['type'],'unmanaged':_0x5a58bd['unmanaged'],'abandoned':_0x5a58bd['abandoned'],'waiting':_0x5a58bd[_0xc008('0x28')],'loggedInDb':_0x5a58bd[_0xc008('0x29')],'dialActive':_0x5a58bd[_0xc008('0x2a')],'dialMethod':_0x5a58bd[_0xc008('0x2b')],'dialOriginateCallerIdName':_0x5a58bd['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x5a58bd['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x5a58bd['dialOriginateTimeout'],'dialPrefix':_0x5a58bd['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5a58bd['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x5a58bd[_0xc008('0x2c')],'outboundBlacklistCallsDay':_0x5a58bd[_0xc008('0x2d')],'outboundBusyCallsDay':_0x5a58bd[_0xc008('0x2e')],'outboundCongestionCallsDay':_0x5a58bd['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x5a58bd[_0xc008('0x2f')],'outboundDropCallsDayCallersExit':_0x5a58bd[_0xc008('0x30')],'outboundDropCallsDayTimeout':_0x5a58bd[_0xc008('0x31')],'outboundNoAnswerCallsDay':_0x5a58bd[_0xc008('0x32')],'outboundNoSuchCallsDay':_0x5a58bd['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x5a58bd[_0xc008('0x33')],'outboundReCallsDay':_0x5a58bd[_0xc008('0x34')],'outboundRejectCallsDay':_0x5a58bd['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x5a58bd['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x5a58bd['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x5a58bd[_0xc008('0x35')],'predictiveIntervalAvgHoldtime':_0x5a58bd[_0xc008('0x36')],'predictiveIntervalAvgTalktime':_0x5a58bd[_0xc008('0x37')],'predictiveIntervalDroppedCallsCallersExit':_0x5a58bd[_0xc008('0x38')],'predictiveIntervalDroppedCallsTimeout':_0x5a58bd[_0xc008('0x39')],'predictiveIntervalErlangCalls':_0x5a58bd[_0xc008('0x3a')],'predictiveIntervalErlangCallsDroppedCalls':_0x5a58bd[_0xc008('0x3b')],'predictiveIntervalHitRate':_0x5a58bd[_0xc008('0x3c')],'predictiveIntervalMultiplicativeFactor':_0x5a58bd[_0xc008('0x3d')],'predictiveIntervalPauses':_0x5a58bd[_0xc008('0x3e')],'predictiveIntervalAvailable':_0x5a58bd[_0xc008('0x3f')],'predictiveIntervalTotalCalls':_0x5a58bd[_0xc008('0x40')],'message':_0x5a58bd['message'],'originated':_0x5a58bd[_0xc008('0x41')],'erlangCalls':_0x5a58bd[_0xc008('0x42')],'erlangCallToSecond':_0x5a58bd['erlangCallToSecond'],'erlangAbandonmentRate':_0x5a58bd[_0xc008('0x43')],'erlangBusyFactor':_0x5a58bd[_0xc008('0x44')],'startPredictive':_0x5a58bd[_0xc008('0x45')],'startProgressive':_0x5a58bd[_0xc008('0x46')]};if(_0x5a58bd[_0xc008('0x47')]){_0x251db2[_0xc008('0x47')]={'id':_0x5a58bd[_0xc008('0x47')]['id'],'name':_0x5a58bd[_0xc008('0x47')][_0xc008('0x20')],'active':_0x5a58bd['Trunk'][_0xc008('0x48')],'callerid':_0x5a58bd[_0xc008('0x47')][_0xc008('0x49')]};}if(_0x5a58bd[_0xc008('0x4a')]){_0x251db2[_0xc008('0x4a')]={'id':_0x5a58bd[_0xc008('0x4a')]['id'],'name':_0x5a58bd[_0xc008('0x4a')]['name']};}var _0x35f360=md5(JSON[_0xc008('0x4b')](_0x251db2));if(_0x5a58bd['md5']!==_0x35f360){_0x5a58bd[_0xc008('0x4c')]=_0x35f360;emit(util[_0xc008('0x4d')]('voice:queue:%s',_0x251db2[_0xc008('0x20')]),_0xc008('0x4e'),_0x251db2);}}}function emitVoiceQueueChannelRemove(_0x280e9b){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x280e9b));emit(util[_0xc008('0x4d')]('voice:queue:%s',_0x280e9b[_0xc008('0x20')]),_0xc008('0x4f'),_0x280e9b);io[_0xc008('0x50')](_0xc008('0x51'),_0x280e9b);}function notSendMessagesQueue(_0x3148e1){if(_0x3148e1[_0xc008('0x52')]){if(_0x3148e1[_0xc008('0x41')]===0x0&&_0x3148e1[_0xc008('0x53')]===0x0){_0x3148e1[_0xc008('0x52')]=![];_0x3148e1[_0xc008('0x54')]=0x0;_0x3148e1[_0xc008('0x55')]=0x0;_0x3148e1[_0xc008('0x56')]=_0xc008('0x57');ut[_0xc008('0x58')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3148e1[_0xc008('0x20')]+_0xc008('0x59'));}else{_0x3148e1[_0xc008('0x56')]=_0xc008('0x5a');ut['logger'](_0xc008('0x5b'),_0x3148e1[_0xc008('0x20')]+_0xc008('0x5c'));}emitCampaignPreview(_0x3148e1);}}Preview[_0xc008('0xe')][_0xc008('0x5d')]=function(){var _0x5706bb=this;setInterval(function(){_0x5706bb[_0xc008('0x5e')]();},0x7cf);};Preview[_0xc008('0xe')][_0xc008('0x5e')]=function(){var _0x3e9a99=this[_0xc008('0x11')];this['clockClearZombieChannels']+=0x1;for(var _0xf4cc4b in _0x3e9a99){if(_0x3e9a99[_0xc008('0x5f')](_0xf4cc4b)&&(_0x3e9a99[_0xf4cc4b][_0xc008('0x2b')]===_0xc008('0x8')||_0x3e9a99[_0xf4cc4b]['dialMethod']===_0xc008('0x60'))&&_0x3e9a99[_0xf4cc4b][_0xc008('0x1e')]===_0xc008('0x1f')){if(this['clockClearZombieChannels']>0x7){this[_0xc008('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x3e9a99[_0xc008('0x5f')](_0xf4cc4b)&&_0x3e9a99[_0xf4cc4b]['dialMethod']===_0xc008('0x8')&&_0x3e9a99[_0xf4cc4b][_0xc008('0x1e')]==='outbound'){if(_0x3e9a99[_0xf4cc4b][_0xc008('0x2a')]){this[_0xc008('0x61')](_0x3e9a99[_0xf4cc4b]);if(_0x3e9a99[_0xf4cc4b][_0xc008('0x62')])this['recallMe'](_0x3e9a99[_0xf4cc4b]);}else{notSendMessagesQueue(_0x3e9a99[_0xf4cc4b]);}}}};Preview[_0xc008('0xe')][_0xc008('0x63')]=function(_0x200469){var _0x44fc5d=this;this[_0xc008('0x10')][_0xc008('0x64')](function(){if(!_['isNil'](_0x44fc5d['actions'][_0x200469])){loggerAction['info'](_0xc008('0x65'),_0x200469,_0xc008('0x66'),_0x44fc5d[_0xc008('0x14')][_0x200469][_0xc008('0x67')],_0xc008('0x68'),JSON[_0xc008('0x4b')](_0x44fc5d[_0xc008('0x11')][_0x44fc5d[_0xc008('0x14')][_0x200469]['queue']]['originated']),'pTalking:\x20',JSON[_0xc008('0x4b')](_0x44fc5d[_0xc008('0x11')][_0x44fc5d[_0xc008('0x14')][_0x200469]['queue']][_0xc008('0x53')]),JSON[_0xc008('0x4b')](_0x44fc5d[_0xc008('0x14')][_0x200469][_0xc008('0x69')]),JSON[_0xc008('0x4b')](_[_0xc008('0x6a')](_0x44fc5d[_0xc008('0x14')][_0x200469],[_0xc008('0x6b'),_0xc008('0x6c'),_0xc008('0x6d'),'ListId'])));return ami['Action']({'action':_0xc008('0x6e'),'channel':_0x44fc5d['actions'][_0x200469][_0xc008('0x6f')]})[_0xc008('0x70')](function(_0x201e52){if(_0x201e52['message']===_0xc008('0x71')){setTimeout(function(){if(_0x44fc5d[_0xc008('0x14')][_0x200469]){ut[_0xc008('0x72')](_0x44fc5d[_0xc008('0x11')][_0x44fc5d[_0xc008('0x14')][_0x200469]['queue']],_0xc008('0x73'));if(_0x44fc5d[_0xc008('0x14')][_0x200469]['dialAnswer']===!![]){ut[_0xc008('0x74')](_0x44fc5d[_0xc008('0x11')][_0x44fc5d['actions'][_0x200469]['queue']],_0xc008('0x73'));ut[_0xc008('0x75')](_0xc008('0x76')+_0x200469,_0x44fc5d[_0xc008('0x14')][_0x200469][_0xc008('0x67')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x200469,_0x44fc5d[_0xc008('0x14')][_0x200469]['queue']);delete _0x44fc5d[_0xc008('0x14')][_0x200469];}},0x2328);}});}});};Preview[_0xc008('0xe')][_0xc008('0x77')]=function(){var _0x2f1105=this;loggerAction[_0xc008('0x78')](_0xc008('0x79'),_['size'](this[_0xc008('0x14')]));for(var _0xbd7422 in this[_0xc008('0x14')]){if(_0x2f1105[_0xc008('0x14')][_0xc008('0x5f')](_0xbd7422)){_0x2f1105['clearZombieChannel'](_0xbd7422);}}};Preview[_0xc008('0xe')]['recallMe']=function(_0x535e6e){var _0x5dbfca=this;rpcDb[_0xc008('0x7a')](_0x535e6e['id'],ut[_0xc008('0x7b')](this[_0xc008('0x7c')]))['then'](function(_0x3aeeab){if(!_[_0xc008('0x7d')](_0x3aeeab)){for(var _0x3dda82=0x0;_0x3dda82<_0x3aeeab['length'];_0x3dda82+=0x1){if(ut[_0xc008('0x7e')](_0x3aeeab[_0x3dda82][_0xc008('0x7f')])<_0x535e6e[_0xc008('0x80')]*0x3c){if(_0x3aeeab[_0x3dda82][_0xc008('0x81')]&&!_0x3aeeab[_0x3dda82]['Agent'][_0xc008('0x82')]){_0x5dbfca['run'](_0x3aeeab[_0x3dda82]['id'])[_0xc008('0x83')](ut[_0xc008('0x84')](_0xc008('0x85')))[_0xc008('0x70')](ut[_0xc008('0x84')](_0xc008('0x85')));}else{rpcDb['disableContact'](_0x3aeeab[_0x3dda82]['id']);}}else{var _0x375e71=new Action(_0x3aeeab[_0x3dda82],_0x535e6e);_0x375e71['starttime']=moment()['format'](_0xc008('0x86'));_0x535e6e[_0xc008('0x34')]+=0x1;ut['logCustomer'](_0x375e71,0x17,_0xc008('0x87'));if(_0x535e6e[_0xc008('0x88')]){rpcDb[_0xc008('0x89')](ut[_0xc008('0x8a')](_0x3aeeab[_0x3dda82]));rpcDb[_0xc008('0x8b')](_0x375e71,_0xc008('0x8c'));}else{ut[_0xc008('0x8d')](_0x375e71,0x16,'RecallFailedTimeout');rpcDb[_0xc008('0x8b')](_0x375e71,_0xc008('0x8e'));rpcDb[_0xc008('0x8f')](_0x375e71,_0xc008('0x8e'));}}}}})[_0xc008('0x70')](ut[_0xc008('0x84')](_0xc008('0x90')));};Preview[_0xc008('0xe')][_0xc008('0x61')]=function(_0x37d193){_0x37d193[_0xc008('0x52')]=!![];if(ut[_0xc008('0x91')](_0x37d193[_0xc008('0x23')])){_0x37d193[_0xc008('0x56')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xc008('0x92')](_0x37d193[_0xc008('0x2a')])){_0x37d193[_0xc008('0x56')]='NOT_ACTIVE';}else if(!this[_0xc008('0x93')](_0x37d193[_0xc008('0x47')])){if(!this['isTrunkReachable'](_0x37d193['TrunkBackup'])){_0x37d193[_0xc008('0x56')]=_0xc008('0x94');}else{_0x37d193[_0xc008('0x56')]=_0xc008('0x95');}}else{_0x37d193[_0xc008('0x56')]=_0xc008('0x95');}emitCampaignPreview(_0x37d193);};Preview[_0xc008('0xe')][_0xc008('0x96')]=function(_0x39e219,_0x1b059b,_0x383325){var _0x490a60=this;var _0x336516=this[_0xc008('0x14')][_0x1b059b];var _0xfdb5e3=this[_0xc008('0x11')][_0x336516['queue']];var _0x17ffb1;if(_0xfdb5e3){switch(_0x383325){case'1':_0xfdb5e3['outboundNoSuchCallsDay']+=0x1;_0x336516[_0xc008('0x97')]+=0x1;_0x336516[_0xc008('0x98')]=ut[_0xc008('0x99')](_0x336516);ut['logCustomer'](_0x336516,0x0,_0xc008('0x9a'));ami[_0xc008('0x50')](_0xc008('0x9b'),ut['buildObj'](_0x336516,_0xc008('0x9c')));rpcDb['createCustomerHistory'](_0x336516,_0xc008('0x9d'));if(ut[_0xc008('0x99')](_0x336516)>=_0xfdb5e3[_0xc008('0x9e')]){_0x17ffb1=ut[_0xc008('0x9f')](_0x336516,0xf,_0xc008('0xa0'));rpcDb['createCustomerFinal'](_0x17ffb1,_0xc008('0xa1'));}else{if(_0x336516[_0xc008('0x97')]>=_0xfdb5e3['dialNoSuchNumberMaxRetry']){rpcDb[_0xc008('0x8f')](_0x336516,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0xc008('0xa2')](ut['scheduledAt'](_0x336516,_0xc008('0x97'),_0xfdb5e3['dialNoSuchNumberRetryFrequency']),_0x336516[_0xc008('0xa3')],_0x336516[_0xc008('0xa4')]);}}delete this[_0xc008('0x14')][_0x39e219[_0xc008('0xa5')]];break;case'ANSWER':var _0x57752c=moment()[_0xc008('0x4d')](_0xc008('0x86'));_0x336516[_0xc008('0xa6')]=_0x57752c;_0x336516[_0xc008('0xa7')]=_0x57752c;_0x336516[_0xc008('0x69')]=!![];_0xfdb5e3[_0xc008('0x53')]+=0x1;logger[_0xc008('0x78')]('[syncHangup][talking][increment]',_0x336516[_0xc008('0xa8')],'\x20Queue',_0xfdb5e3['name'],'pTalking:\x20',_0xfdb5e3[_0xc008('0x53')]);ami[_0xc008('0x50')](_0xc008('0xa9'),ut[_0xc008('0xaa')](_0x336516,_0xc008('0xab'),this[_0xc008('0x11')][_0x336516[_0xc008('0x67')]]));if(_0xfdb5e3[_0xc008('0xac')]){ami[_0xc008('0x50')]('custom:agentConnectPreview',ut[_0xc008('0xad')](_0x336516));}break;case'16':ami[_0xc008('0x50')](_0xc008('0xae'),ut[_0xc008('0xaa')](_0x336516,_0xc008('0xaf'),this[_0xc008('0x11')][_0x336516[_0xc008('0x67')]]));emitVoiceQueueChannelRemove(ut[_0xc008('0xaa')](_0x336516,_0xc008('0xaf')));_0xfdb5e3[_0xc008('0x2c')]+=0x1;_0xfdb5e3[_0xc008('0x27')]+=0x1;_0xfdb5e3[_0xc008('0x22')]+=0x1;ut['decrementTalkink'](_0xfdb5e3,'[16]');_0x336516[_0xc008('0x98')]=ut[_0xc008('0x99')](_0x336516);ut[_0xc008('0x8d')](_0x336516,0x4,'Answer');rpcDb[_0xc008('0x8b')](_0x336516,_0xc008('0xb0'));rpcDb['createCustomerFinal'](_0x336516,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x336516);_0xfdb5e3[_0xc008('0x24')]+=_0x336516[_0xc008('0xb1')];_0xfdb5e3[_0xc008('0xb2')]+=_0x336516[_0xc008('0xb1')];logger[_0xc008('0x78')](_0xc008('0xb3'),_0x336516[_0xc008('0xa8')],_0xc008('0xb4'),_0xfdb5e3[_0xc008('0x20')],_0xc008('0xb5'),_0xfdb5e3['pTalking']);delete this['actions'][_0x39e219[_0xc008('0xa5')]];break;case _0xc008('0xb6'):_0xfdb5e3[_0xc008('0x2e')]+=0x1;_0x336516[_0xc008('0xb7')]+=0x1;_0x336516[_0xc008('0x98')]=ut[_0xc008('0x99')](_0x336516);ut['logCustomer'](_0x336516,0x5,'Busy');ami[_0xc008('0x50')](_0xc008('0xb8'),ut[_0xc008('0xaa')](_0x336516,'busy'));rpcDb['createCustomerHistory'](_0x336516,'[callProgressDetectingCustomer][logBusy]');if(ut['totalGlobal'](_0x336516)>=_0xfdb5e3['dialGlobalMaxRetry']){_0x17ffb1=ut['cloneAction'](_0x336516,0xf,_0xc008('0xa0'));rpcDb['createCustomerFinal'](_0x17ffb1,_0xc008('0xb9'));}else{if(_0x336516['countbusyretry']>=_0xfdb5e3[_0xc008('0xba')]){rpcDb[_0xc008('0x8f')](_0x336516,_0xc008('0xbb'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x336516,_0xc008('0xb7'),_0xfdb5e3['dialBusyRetryFrequency']),_0x336516[_0xc008('0xa3')],_0x336516[_0xc008('0xa4')]);}}break;case'NOANSWER':_0xfdb5e3[_0xc008('0x32')]+=0x1;_0x336516['countnoanswerretry']+=0x1;_0x336516['countglobal']=ut[_0xc008('0x99')](_0x336516);ut[_0xc008('0x8d')](_0x336516,0x3,'NoAnswer');ami[_0xc008('0x50')](_0xc008('0xbc'),ut[_0xc008('0xaa')](_0x336516,'noanswer'));rpcDb[_0xc008('0x8b')](_0x336516,_0xc008('0xbd'));if(ut[_0xc008('0x99')](_0x336516)>=_0xfdb5e3[_0xc008('0x9e')]){_0x17ffb1=ut[_0xc008('0x9f')](_0x336516,0xf,_0xc008('0xa0'));rpcDb['createCustomerFinal'](_0x17ffb1,_0xc008('0xbe'));}else{if(_0x336516[_0xc008('0xbf')]>=_0xfdb5e3[_0xc008('0xc0')]){rpcDb['createCustomerFinal'](_0x336516,_0xc008('0xbd'));}else{rpcDb[_0xc008('0xa2')](ut[_0xc008('0xc1')](_0x336516,'countnoanswerretry',_0xfdb5e3['dialNoAnswerRetryFrequency']),_0x336516['unlockAgent'],_0x336516[_0xc008('0xa4')]);}}break;case _0xc008('0xc2'):_0xfdb5e3[_0xc008('0xc3')]+=0x1;_0x336516[_0xc008('0xc4')]+=0x1;_0x336516[_0xc008('0x98')]=ut[_0xc008('0x99')](_0x336516);ut[_0xc008('0x8d')](_0x336516,0x8,_0xc008('0xc5'));ami['emit'](_0xc008('0xc6'),ut[_0xc008('0xaa')](_0x336516,'congestion'));rpcDb['createCustomerHistory'](_0x336516,_0xc008('0xc7'));if(ut[_0xc008('0x99')](_0x336516)>=_0xfdb5e3[_0xc008('0x9e')]){_0x17ffb1=ut[_0xc008('0x9f')](_0x336516,0xf,_0xc008('0xa0'));rpcDb['createCustomerFinal'](_0x17ffb1,_0xc008('0xc8'));}else{if(_0x336516[_0xc008('0xc4')]>=_0xfdb5e3['dialCongestionMaxRetry']){rpcDb[_0xc008('0x8f')](_0x336516,_0xc008('0xc7'));}else{rpcDb[_0xc008('0xa2')](ut[_0xc008('0xc1')](_0x336516,'countcongestionretry',_0xfdb5e3[_0xc008('0xc9')]),_0x336516[_0xc008('0xa3')],_0x336516[_0xc008('0xa4')]);}}break;case _0xc008('0xca'):_0xfdb5e3['outboundRejectCallsDay']+=0x1;_0x336516[_0xc008('0xcb')]+=0x1;_0x336516[_0xc008('0x98')]=ut['totalGlobal'](_0x336516);ut['logCustomer'](_0x336516,0x14,_0xc008('0xcc'));ami['emit'](_0xc008('0xcd'),ut[_0xc008('0xaa')](_0x336516,'agentreject'));rpcDb[_0xc008('0x8b')](_0x336516,_0xc008('0xce'));if(ut[_0xc008('0x99')](_0x336516)>=_0xfdb5e3[_0xc008('0x9e')]){_0x17ffb1=ut[_0xc008('0x9f')](_0x336516,0x14,_0xc008('0xcc'));rpcDb[_0xc008('0x8f')](_0x17ffb1,_0xc008('0xcf'));}else{if(_0x336516[_0xc008('0xcb')]>=_0xfdb5e3[_0xc008('0xd0')]){rpcDb['createCustomerFinal'](_0x336516,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xc008('0xa2')](ut[_0xc008('0xc1')](_0x336516,'countagentrejectretry',_0xfdb5e3[_0xc008('0xd1')]),_0x336516[_0xc008('0xa3')],_0x336516[_0xc008('0xa4')]);}}break;case'ABANDONED':_0xfdb5e3[_0xc008('0xd2')]+=0x1;_0x336516[_0xc008('0xd3')]+=0x1;_0x336516[_0xc008('0x98')]=ut[_0xc008('0x99')](_0x336516);ut[_0xc008('0x8d')](_0x336516,0xb,_0xc008('0xd4'));rpcDb[_0xc008('0x8b')](_0x336516,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xc008('0x99')](_0x336516)>=_0xfdb5e3['dialGlobalMaxRetry']){_0x17ffb1=ut[_0xc008('0x9f')](_0x336516,0xf,_0xc008('0xa0'));rpcDb[_0xc008('0x8f')](_0x17ffb1,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x336516[_0xc008('0xd5')]>=_0xfdb5e3[_0xc008('0xd6')]){rpcDb[_0xc008('0x8f')](_0x336516,_0xc008('0xd7'));}else{rpcDb[_0xc008('0xa2')](ut[_0xc008('0xc1')](_0x336516,_0xc008('0xd3'),_0xfdb5e3[_0xc008('0xd8')]),_0x336516[_0xc008('0xa3')],_0x336516[_0xc008('0xa4')]);}}break;case'18':_0xfdb5e3['outboundUnknownCallsDay']+=0x1;_0x336516[_0xc008('0xd9')]+=0x1;_0x336516[_0xc008('0x98')]=ut[_0xc008('0x99')](_0x336516);ut[_0xc008('0x8d')](_0x336516,0x12,_0x39e219[_0xc008('0xda')]||_0x39e219['dialstatus']);ami[_0xc008('0x50')](_0xc008('0xdb'),ut[_0xc008('0xaa')](_0x336516,_0xc008('0xdc')));rpcDb[_0xc008('0x8b')](_0x336516,_0xc008('0xdd'));if(ut[_0xc008('0x99')](_0x336516)>=_0xfdb5e3[_0xc008('0x9e')]){_0x17ffb1=ut[_0xc008('0x9f')](_0x336516,0xf,_0xc008('0xa0'));rpcDb[_0xc008('0x8f')](_0x17ffb1,_0xc008('0xdd'));}else{rpcDb[_0xc008('0x8f')](_0x336516,_0xc008('0xdd'));}delete this[_0xc008('0x14')][_0x39e219['linkedid']];break;case'19':_0xfdb5e3['outboundUnknownCallsDay']+=0x1;_0x336516[_0xc008('0x98')]=ut[_0xc008('0x99')](_0x336516);ut[_0xc008('0x8d')](_0x336516,0x13,_0x39e219[_0xc008('0xda')]||_0x39e219[_0xc008('0xde')]);ami[_0xc008('0x50')](_0xc008('0xdb'),ut[_0xc008('0xaa')](_0x336516,_0xc008('0xdc')));rpcDb['createCustomerHistory'](_0x336516,_0xc008('0xdf'));if(ut[_0xc008('0x99')](_0x336516)>=_0xfdb5e3['dialGlobalMaxRetry']){_0x17ffb1=ut[_0xc008('0x9f')](_0x336516,0xf,_0xc008('0xa0'));rpcDb[_0xc008('0x8f')](_0x17ffb1,_0xc008('0xdf'));}else{rpcDb[_0xc008('0x8f')](_0x336516,_0xc008('0xdf'));}delete this['actions'][_0x39e219[_0xc008('0xa5')]];break;default:if(_0x336516[_0xc008('0x69')]){ut[_0xc008('0x74')](_0xfdb5e3,_0xc008('0xe0'));ut['loggerError'](_0xc008('0xe1')+_0xfdb5e3['name'],_0x39e219);}_0xfdb5e3[_0xc008('0xe2')]+=0x1;_0x336516[_0xc008('0x98')]=ut['totalGlobal'](_0x336516);ut[_0xc008('0x8d')](_0x336516,0xc,_0x39e219['cause-txt']||_0x39e219[_0xc008('0xde')]);rpcDb['createCustomerHistory'](_0x336516,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x336516)>=_0xfdb5e3[_0xc008('0x9e')]){_0x17ffb1=ut[_0xc008('0x9f')](_0x336516,0xf,'Global');rpcDb[_0xc008('0x8f')](_0x17ffb1,_0xc008('0xe3'));}else{rpcDb['createCustomerFinal'](_0x336516,_0xc008('0xe3'));}delete this[_0xc008('0x14')][_0x39e219[_0xc008('0xa5')]];}if(!(_0x336516['dialAnswer']&&_0x383325==='16')){ut[_0xc008('0x72')](_0xfdb5e3,_0xc008('0xe4'));logger[_0xc008('0x78')](_0xc008('0xe5'),_0x336516[_0xc008('0xa8')],_0xc008('0xb4'),_0xfdb5e3[_0xc008('0x20')],_0xc008('0x68'),_0xfdb5e3[_0xc008('0x41')]);}if(_0x383325!==_0xc008('0xe6')){delete this[_0xc008('0x14')][_0x39e219['linkedid']];delete this[_0xc008('0x14')][_0x39e219[_0xc008('0xe7')]];}}};Preview[_0xc008('0xe')]['callProgressDetectingAgent']=function(_0xeaa37d,_0x1f2151,_0x3f6018){if(_['isUndefined'](_0x1f2151)&&_0xc008('0xe8')!==typeof _0x1f2151){return;}if(_['isUndefined'](_0x3f6018)&&_0xc008('0xe8')!==typeof _0x3f6018){return;}switch(_0x3f6018[_0xc008('0xe9')]){case'0':ut[_0xc008('0xea')](_0xeaa37d,0x0,'NoSuchNumber');rpcDb[_0xc008('0xeb')](_0xeaa37d,_0xc008('0xec'));break;case'3':ut[_0xc008('0xea')](_0xeaa37d,0x3,_0xc008('0xed'));rpcDb[_0xc008('0xeb')](_0xeaa37d,_0xc008('0xee'));break;case'5':ut[_0xc008('0xea')](_0xeaa37d,0x5,'Busy');rpcDb[_0xc008('0xeb')](_0xeaa37d,_0xc008('0xef'));break;case'8':ut[_0xc008('0xea')](_0xeaa37d,0x8,_0xc008('0xc5'));rpcDb['createAgentHistory'](_0xeaa37d,_0xc008('0xf0'));break;case'22':ut['logAgent'](_0xeaa37d,0x16,_0xc008('0xf1'));rpcDb[_0xc008('0xeb')](_0xeaa37d,_0xc008('0xf2'));break;default:ut[_0xc008('0xea')](_0xeaa37d,0xc,_0x3f6018[_0xc008('0xe9')]);rpcDb[_0xc008('0xeb')](_0xeaa37d,_0xc008('0xf0'));}ut['updateOriginated'](_0x1f2151,_0xc008('0xf3'));logger[_0xc008('0x78')](_0xc008('0xf4'),_0xeaa37d[_0xc008('0xa8')],'\x20Queue',_0x1f2151[_0xc008('0x20')],'originated:\x20',_0x1f2151[_0xc008('0x41')]);delete this[_0xc008('0x14')][_0xeaa37d[_0xc008('0xa8')]];};Preview['prototype']['checkInBlack']=function(_0x39bfc0,_0x5a8bac,_0x4016fc,_0x59596d,_0x1c2e63){var _0xaf3bed=this;return new BPromise(function(_0x58ae7b,_0x2ebd24){if(_[_0xc008('0x7d')](_0x5a8bac)||_['isNil'](_0x5a8bac['Contact'])||_[_0xc008('0x7d')](_0x5a8bac[_0xc008('0xf5')]['phone'])||_[_0xc008('0x7d')](_0x5a8bac[_0xc008('0x6d')])){_0x2ebd24(ut[_0xc008('0x56')](_0xc008('0xf6'),_0x59596d,_0x1c2e63));return;}var _0x47a463=uuid['v4']();var _0xa403ff=_0xaf3bed[_0xc008('0x11')][_0x5a8bac[_0xc008('0x66')][_0xc008('0x20')]];var _0x78b833=_0x4016fc?_0xaf3bed[_0xc008('0x7c')][_0x4016fc]['id']:undefined;_0xaf3bed[_0xc008('0x14')][_0x47a463]=new Action(_0x5a8bac,_0xa403ff,_0x47a463,_0x4016fc,_0x78b833);var _0x3ff1b2=_0xaf3bed[_0xc008('0x14')][_0x47a463];_0x3ff1b2[_0xc008('0xa3')]=_0x59596d;_0x3ff1b2[_0xc008('0xa4')]=_0x1c2e63;_0x3ff1b2[_0xc008('0xf7')]=_0x4016fc;if(_[_0xc008('0xf8')](_0x39bfc0)){_0xaf3bed['execCall'](_0x3ff1b2,_0xa403ff,_0x5a8bac,_0x4016fc)['then'](function(_0x43d76c){logger[_0xc008('0x78')](_0xc008('0xf9'),_0xc008('0xfa')+_0x3ff1b2[_0xc008('0x67')]+_0xc008('0xfb')+_0x3ff1b2[_0xc008('0xfc')],JSON['stringify'](_0x43d76c));ami['emit'](_0xc008('0xfd'),ut[_0xc008('0xaa')](_0x3ff1b2,_0xc008('0xfe'),_0xaf3bed['campaignsPreview'][_0x3ff1b2[_0xc008('0x67')]]));_0x58ae7b(ut[_0xc008('0x56')](_0xc008('0xff')));})[_0xc008('0x70')](function(_0x156ec3){ut[_0xc008('0x58')](_0xc008('0x100'),_0x156ec3);_0x2ebd24(ut[_0xc008('0x56')](_0xc008('0x101'),_0x59596d,_0x1c2e63));});}else{_0xa403ff[_0xc008('0x2d')]+=0x1;ut[_0xc008('0x102')](_0x3ff1b2);rpcDb[_0xc008('0x103')](_0x3ff1b2,'[Blacklist][error]');delete _0xaf3bed['actions'][_0x47a463];_0x2ebd24(ut[_0xc008('0x56')](_0xc008('0x104'),_0x59596d,_0x1c2e63));}});};Preview['prototype'][_0xc008('0x93')]=function(_0x1d44fa){return!_[_0xc008('0x7d')](_0x1d44fa)&&!_[_0xc008('0x7d')](_0x1d44fa[_0xc008('0x20')])&&!_[_0xc008('0x7d')](_0x1d44fa[_0xc008('0x48')])&&_0x1d44fa[_0xc008('0x48')]&&!_[_0xc008('0x7d')](this['trunks'][util['format']('SIP/%s',_0x1d44fa[_0xc008('0x20')])])&&!_['isNil'](this[_0xc008('0x13')][util[_0xc008('0x4d')](_0xc008('0x105'),_0x1d44fa[_0xc008('0x20')])][_0xc008('0x6e')])&&(this[_0xc008('0x13')][util[_0xc008('0x4d')](_0xc008('0x105'),_0x1d44fa[_0xc008('0x20')])][_0xc008('0x6e')]===_0xc008('0x106')||this[_0xc008('0x13')][util[_0xc008('0x4d')](_0xc008('0x105'),_0x1d44fa[_0xc008('0x20')])][_0xc008('0x6e')]===_0xc008('0x107'));};Preview['prototype'][_0xc008('0x108')]=function(_0x5b80f1,_0x3bbc4a){var _0x176dc8=this;return new BPromise(function(_0x31d06c,_0x52e7a3){_0x176dc8[_0xc008('0x109')](_0x5b80f1,_0x3bbc4a)[_0xc008('0x83')](function(_0x36cc83){_0x31d06c(_[_0xc008('0x6a')](_0x36cc83,[_0xc008('0x56')]));})[_0xc008('0x70')](function(_0x516590){if(_0x516590['unlock']){rpcDb[_0xc008('0x10a')](_0x5b80f1);}if(_0x516590[_0xc008('0x48')]){rpcDb[_0xc008('0x10b')](_0x5b80f1);}_0x52e7a3(_[_0xc008('0x6a')](_0x516590,['message']));});});};Preview['prototype']['execRun']=function(_0x5d9b86,_0x7cdb67){var _0x1b9158=this;return new BPromise(function(_0xfa6008,_0xdbe8ad){var _0x4db69f,_0x222668;rpcDb[_0xc008('0x10c')](_0x5d9b86)[_0xc008('0x83')](function(_0x567bfc){if(!_[_0xc008('0x7d')](_0x567bfc[0x0])){_0x222668=_0x567bfc[0x0]['recallme']?![]:!![];_0x4db69f=_0x567bfc[0x0][_0xc008('0x10d')]?!![]:![];_0x4db69f=_0x7cdb67?!![]:_0x4db69f;}var _0x48862b=_0x1b9158[_0xc008('0x10e')](_0x567bfc);if(_0x48862b[_0xc008('0x10f')]){rpcDb[_0xc008('0x110')](_[_0xc008('0x6a')](_0x567bfc[0x0],['VoiceQueueId',_0xc008('0x111')]))[_0xc008('0x83')](function(_0x30f35b){_0x1b9158[_0xc008('0x112')](_0x30f35b,_0x567bfc[0x0],_0x7cdb67,_0x222668,_0x4db69f)[_0xc008('0x83')](function(_0x196b09){_0xfa6008(_0x196b09);})[_0xc008('0x70')](function(_0x4c6cfa){_0xdbe8ad(_0x4c6cfa);});})[_0xc008('0x70')](function(_0x30b6af){ut[_0xc008('0x58')]('[Preview][checkIsBlackList]',_0x30b6af);_0xdbe8ad(ut['message'](_0xc008('0x113'),_0x222668,_0x4db69f));});}else{_0xdbe8ad(ut[_0xc008('0x56')](_0x48862b[_0xc008('0x56')],_0x222668,_0x4db69f));}})[_0xc008('0x70')](function(_0x590541){ut[_0xc008('0x58')](_0xc008('0x114'),_0x590541);_0xdbe8ad(ut['message']('Call\x20unsuccessful',![],!![]));});});};Preview['prototype'][_0xc008('0x10e')]=function(_0x573b21){if(_[_0xc008('0x7d')](_0x573b21)||_['isEmpty'](_0x573b21)||!_[_0xc008('0x7d')](_0x573b21[0x0][_0xc008('0x81')])&&_[_0xc008('0x7d')](_0x573b21[0x0][_0xc008('0x81')]['name'])){ut['logger'](_0xc008('0x115'),_0x573b21);return{'isValid':![],'message':_0xc008('0x116')};}var _0x347c78=this['campaignsPreview'][_0x573b21[0x0][_0xc008('0x66')][_0xc008('0x20')]];_0x347c78[_0xc008('0x56')]=_0xc008('0x95');if(_[_0xc008('0x7d')](_0x347c78)){ut[_0xc008('0x58')](_0xc008('0x117'),_0x347c78);return{'isValid':![],'message':_0xc008('0x118')};}if(!this[_0xc008('0x93')](_0x347c78[_0xc008('0x47')])){ut[_0xc008('0x58')]('[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'+_0x347c78[_0xc008('0x20')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xc008('0x93')](_0x347c78[_0xc008('0x119')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x347c78[_0xc008('0x20')]+_0xc008('0x11a'));return{'isValid':![],'message':_0xc008('0x11b')};}}if(!ut[_0xc008('0x92')](_0x347c78[_0xc008('0x2a')])){ut[_0xc008('0x58')]('[Preview][validateContact][Campaign\x20Active]',_0x347c78[_0xc008('0x20')]+_0xc008('0x11c'));return{'isValid':![],'message':_0xc008('0x11d')+_0x347c78['name']+_0xc008('0x11c')};}return{'isValid':!![],'message':_0xc008('0x11e')};};Preview[_0xc008('0xe')][_0xc008('0x11f')]=function(_0x49f92e,_0x4ae026,_0x26ca45,_0x4ad0b4){var _0x18d22d=this;return new BPromise(function(_0x12f652,_0x222a5d){var _0x22b77a=_0x49f92e[_0xc008('0xa8')];var _0x5b425e=_0x18d22d['isTrunkReachable'](_0x4ae026[_0xc008('0x47')])?util[_0xc008('0x4d')](_0xc008('0x120'),_0x4ae026[_0xc008('0x47')][_0xc008('0x20')],_[_0xc008('0x7d')](_0x4ae026[_0xc008('0x121')])?'':_0x4ae026['dialPrefix'][_0xc008('0x122')]()||'',_0x4ae026[_0xc008('0x123')]>0x0?_0x26ca45[_0xc008('0xf5')][_0xc008('0x124')][_0xc008('0x125')](_0x4ae026[_0xc008('0x123')]):_0x26ca45[_0xc008('0xf5')][_0xc008('0x124')]):util[_0xc008('0x4d')](_0xc008('0x120'),_[_0xc008('0x7d')](_0x4ae026[_0xc008('0x119')])?_0x4ae026['Trunk'][_0xc008('0x20')]:_0x4ae026[_0xc008('0x119')]['name'],_[_0xc008('0x7d')](_0x4ae026[_0xc008('0x121')])?'':_0x4ae026[_0xc008('0x121')][_0xc008('0x122')]()||'',_0x4ae026[_0xc008('0x123')]>0x0?_0x26ca45[_0xc008('0xf5')][_0xc008('0x124')][_0xc008('0x125')](_0x4ae026[_0xc008('0x123')]):_0x26ca45[_0xc008('0xf5')][_0xc008('0x124')]);var _0x487055=_0x18d22d[_0xc008('0x93')](_0x4ae026[_0xc008('0x47')])?ut[_0xc008('0x126')](_0x4ae026[_0xc008('0x47')][_0xc008('0x49')],_0x4ae026[_0xc008('0x127')],_0x4ae026[_0xc008('0x128')]>0x0?ut[_0xc008('0x129')](_0x4ae026[_0xc008('0x12a')],_0x4ae026[_0xc008('0x128')]):_0x4ae026[_0xc008('0x12a')]):ut[_0xc008('0x126')](_[_0xc008('0x7d')](_0x4ae026[_0xc008('0x119')])?_0x4ae026[_0xc008('0x47')][_0xc008('0x49')]:_0x4ae026['TrunkBackup']['callerid'],_0x4ae026['dialOriginateCallerIdName'],_0x4ae026[_0xc008('0x128')]>0x0?ut[_0xc008('0x129')](_0x4ae026[_0xc008('0x12a')],_0x4ae026[_0xc008('0x128')]):_0x4ae026[_0xc008('0x12a')]);if(_0x487055){_0x49f92e[_0xc008('0x12b')]=ut[_0xc008('0x12c')](_0x487055);_0x49f92e['originatecalleridnum']=ut[_0xc008('0x12d')](_0x487055);}var _0x47f491=ut['addVariables'](_0x4ae026,_0x26ca45,_0x5b425e,_0x487055,_0x22b77a,_0x49f92e);_[_0xc008('0x12e')](_0x49f92e,ut[_0xc008('0x12f')](_0x47f491));_0x49f92e['starttime']=moment()[_0xc008('0x4d')](_0xc008('0x86'));ami[_0xc008('0x130')](ut['variablesAction'](_0x49f92e,_0x4ae026,_0x47f491,_0x49f92e[_0xc008('0xa4')],_0x4ad0b4))[_0xc008('0x83')](function(_0x1414d2){_0x4ae026['originated']+=0x1;logger[_0xc008('0x78')](_0xc008('0x131'),_0x22b77a,_0xc008('0xb4'),_0x4ae026[_0xc008('0x20')],_0xc008('0x68'),_0x4ae026[_0xc008('0x41')]);_0x12f652(_0x1414d2);})[_0xc008('0x70')](function(_0x2b2dca){ut['logAgent'](_0x49f92e,0xe,_0xc008('0x132'));rpcDb[_0xc008('0xeb')](_0x49f92e,_0xc008('0x133'));_0x222a5d(_0x2b2dca);});});};Preview[_0xc008('0xe')][_0xc008('0x134')]=function(_0x5ea3be){if(this[_0xc008('0x14')][_0x5ea3be[_0xc008('0xa5')]]){this[_0xc008('0x14')][_0x5ea3be[_0xc008('0xa5')]][_0xc008('0x6f')]=_0x5ea3be[_0xc008('0x6f')];}};Preview[_0xc008('0xe')][_0xc008('0x16')]=function(_0x597ea3){var _0xf5fa90=this;var _0x231318=this[_0xc008('0x14')][_0x597ea3[_0xc008('0x135')]];if(_0x231318){if(_0x231318['lookAgent']&&this['agents'][_0x231318[_0xc008('0xf7')]]){ut[_0xc008('0x136')](_0x231318,this['agents'][_0x231318[_0xc008('0xf7')]][_0xc008('0x20')],this[_0xc008('0x7c')][_0x231318[_0xc008('0xf7')]]['id']);}var _0x2ecaff=_[_0xc008('0x137')](_0x231318);_0x2ecaff[_0xc008('0xa6')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x322884=_0xf5fa90['campaignsPreview'][_0x231318[_0xc008('0x67')]];if(ut[_0xc008('0x138')](_0x597ea3[_0xc008('0x139')])){if(_0x231318[_0xc008('0xa3')]){rpcDb[_0xc008('0x10a')](_0x231318[_0xc008('0xfc')]);}if(_0x231318[_0xc008('0xa4')]){rpcDb[_0xc008('0x10b')](_0x231318[_0xc008('0xfc')]);}ami[_0xc008('0x50')](_0xc008('0x13a'),ut['buildObj'](_0x231318,_0xc008('0x13b'),this[_0xc008('0x11')][_0x231318[_0xc008('0x67')]]));this[_0xc008('0x13c')](_0x2ecaff,_0x322884,_0x597ea3);}else{_0x231318[_0xc008('0x13d')]=moment()[_0xc008('0x4d')](_0xc008('0x86'));ut['logAgent'](_0x2ecaff,0x4,_0xc008('0x13e'));rpcDb[_0xc008('0xeb')](_0x2ecaff,_0xc008('0x13f'));}}};Preview['prototype'][_0xc008('0x19')]=function(_0xb09a76){var _0x41b8c4=this;var _0x3e3352=this[_0xc008('0x14')][_0xb09a76[_0xc008('0xa5')]];var _0x556e58;if(_0x3e3352){_0x556e58=this['campaignsPreview'][_0x3e3352[_0xc008('0x67')]];logger[_0xc008('0x78')](_0xc008('0x140'),_0xb09a76[_0xc008('0xa5')],_0xc008('0xb4'),_0x556e58['name'],_0xc008('0xb5'),_0x556e58['pTalking']);}if(this[_0xc008('0x14')][_0xb09a76[_0xc008('0xa5')]]&&_0xb09a76['linkedid']!==_0xb09a76[_0xc008('0xa8')]){if(_0xb09a76[_0xc008('0x141')]==='16'&&this[_0xc008('0x14')][_0xb09a76[_0xc008('0xa5')]]['dialAnswer']){this[_0xc008('0x96')](_0xb09a76,_0xb09a76[_0xc008('0xa5')],_0xb09a76[_0xc008('0x141')]);}else if(this[_0xc008('0x14')][_0xb09a76[_0xc008('0xa5')]]['dialAnswer']){logger[_0xc008('0x78')](_0xc008('0x142'),_0xb09a76[_0xc008('0xa5')],_0xb09a76['cause'],_0xc008('0xb4'),_0x556e58[_0xc008('0x20')],_0xc008('0xb5'),_0x556e58[_0xc008('0x53')]);this['callProgressDetectingCustomer'](_0xb09a76,_0xb09a76[_0xc008('0xa5')],_0xb09a76[_0xc008('0x141')]);}}else if(_0x3e3352&&_[_0xc008('0x7d')](_0x3e3352[_0xc008('0x143')])&&_0x556e58[_0xc008('0x144')]&&_0xb09a76['linkedid']===_0xb09a76[_0xc008('0xa8')]&&_['isNil'](_0xb09a76['reason'])&&_0xb09a76[_0xc008('0x141')]==='16'&&_0xb09a76['channelstate']==='6'&&_[_0xc008('0x145')](_0x3e3352[_0xc008('0x146')])){if(_0x3e3352[_0xc008('0xa3')]){rpcDb[_0xc008('0x10a')](_0x3e3352[_0xc008('0xfc')]);}if(_0x3e3352[_0xc008('0xa4')]){rpcDb[_0xc008('0x10b')](_0x3e3352['idContact']);}_0xb09a76[_0xc008('0xe9')]='22';this[_0xc008('0x13c')](_0x3e3352,_0x556e58,_0xb09a76);}else if(_0x3e3352&&_0x3e3352[_0xc008('0x146')]){if(_0xb09a76[_0xc008('0x141')]==='16'&&this[_0xc008('0x14')][_0xb09a76[_0xc008('0xa5')]]['dialAnswer']){logger[_0xc008('0x78')](_0xc008('0x147'),_0xb09a76[_0xc008('0xa5')],_0xb09a76[_0xc008('0x141')],_0xc008('0xb4'),_0x556e58[_0xc008('0x20')],_0xc008('0xb5'),_0x556e58[_0xc008('0x53')]);this['callProgressDetectingCustomer'](_0xb09a76,_0xb09a76['linkedid'],_0xb09a76[_0xc008('0x141')]);}else if(this[_0xc008('0x14')][_0xb09a76['linkedid']][_0xc008('0x69')]){logger['info'](_0xc008('0x142'),_0xb09a76[_0xc008('0xa5')],_0xb09a76[_0xc008('0x141')],_0xc008('0xb4'),_0x556e58[_0xc008('0x20')],_0xc008('0xb5'),_0x556e58[_0xc008('0x53')]);this['callProgressDetectingCustomer'](_0xb09a76,_0xb09a76[_0xc008('0xa5')],_0xb09a76['cause']);}}};Preview[_0xc008('0xe')][_0xc008('0x1b')]=function(_0x44d124){if(this[_0xc008('0x14')][_0x44d124[_0xc008('0xe7')]]&&_0x44d124[_0xc008('0xe7')]!==_0x44d124[_0xc008('0x148')]){this['callProgressDetectingCustomer'](_0x44d124,_0x44d124[_0xc008('0xe7')],_0x44d124[_0xc008('0xde')]);}};Preview['prototype'][_0xc008('0x149')]=function(_0x69e36){if(this[_0xc008('0x14')][_0x69e36[_0xc008('0xa5')]]&&_0x69e36[_0xc008('0xa5')]!==_0x69e36[_0xc008('0xa8')]&&!this['actions'][_0x69e36[_0xc008('0xa5')]][_0xc008('0x69')]){if(_0x69e36[_0xc008('0x141')]==='1'){this[_0xc008('0x96')](_0x69e36,_0x69e36['linkedid'],_0x69e36['cause']);}}};Preview['prototype'][_0xc008('0x14a')]=function(_0x3839d0,_0x4ca5d0,_0x56550e){if(this['actions'][_0x3839d0]){if(_['isNil'](this[_0xc008('0x14')][_0x3839d0][_0xc008('0x14b')])){this['actions'][_0x3839d0][_0xc008('0x14b')]={};}this[_0xc008('0x14')][_0x3839d0][_0xc008('0x14b')][_0x4ca5d0]=_0x56550e;}};Preview[_0xc008('0xe')][_0xc008('0x14c')]=function(_0x5718b3){try{if(!_['isNil'](_0x5718b3)){if(ut[_0xc008('0x14d')](_[_0xc008('0x14e')](_0x5718b3[_0xc008('0x14f')])[0x0])){this[_0xc008('0x14a')](_0x5718b3[_0xc008('0xa8')],_[_0xc008('0x14e')](_0x5718b3[_0xc008('0x14f')])[0x0],_0x5718b3['value']);}}}catch(_0x2ebe07){logger[_0xc008('0x150')](_0xc008('0x151'),util[_0xc008('0x152')](_0x2ebe07,{'showHidden':![],'depth':null}));}};Preview[_0xc008('0xe')][_0xc008('0x153')]=function(_0x2ff444){if(_0x2ff444){if(this['actions'][_0x2ff444['transfertargetlinkedid']]){this[_0xc008('0x14')][_0x2ff444[_0xc008('0x154')]][_0xc008('0x146')]=!![];}}};Preview[_0xc008('0xe')][_0xc008('0x155')]=function(_0x2cd075){if(_0x2cd075){if(this[_0xc008('0x14')][_0x2cd075[_0xc008('0x156')]]){this[_0xc008('0x14')][_0x2cd075[_0xc008('0x156')]][_0xc008('0x146')]=!![];}}};module[_0xc008('0x157')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index b22e96b..e295adf 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 _0x8bc2=['[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridname','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','exten','xcally-motion-preview','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled'];(function(_0x23d739,_0x268214){var _0x30bea9=function(_0x3e0d0c){while(--_0x3e0d0c){_0x23d739['push'](_0x23d739['shift']());}};_0x30bea9(++_0x268214);}(_0x8bc2,0x18e));var _0x28bc=function(_0x1fb0de,_0x4592c0){_0x1fb0de=_0x1fb0de-0x0;var _0x1d7df2=_0x8bc2[_0x1fb0de];return _0x1d7df2;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x28bc('0x0'))(_0x28bc('0x1'));var _=require(_0x28bc('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x28bc('0x3'));var cmHopperHistory=require(_0x28bc('0x4'));var cmHopperBlack=require(_0x28bc('0x5'));var voiceQueueRt=require(_0x28bc('0x6'));var agentReportPreview=require(_0x28bc('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x4fbdac){return function(_0x87b3b5){logger[_0x28bc('0x8')](_0x4fbdac,util[_0x28bc('0x9')](_0x87b3b5,{'showHidden':![],'depth':null}));};}function create(_0xe05bc1){return BPromise[_0x28bc('0xa')]()[_0x28bc('0xb')](cmHopperHistory[_0x28bc('0xc')](_0xe05bc1))[_0x28bc('0xd')](loggerCatch(_0x28bc('0xe')));}function createAgent(_0x505427){return BPromise[_0x28bc('0xa')]()[_0x28bc('0xb')](agentReportPreview['createHistory'](_0x505427))[_0x28bc('0xd')](loggerCatch(_0x28bc('0xe')));}function moveContact(_0x44e843){return BPromise[_0x28bc('0xa')]()['then'](cmHopper['moveContactManagedDialer'](_0x44e843,!![]))['catch'](loggerCatch(_0x28bc('0xf')));}exports['checkIsBlackList']=function(_0x48ab94){return BPromise[_0x28bc('0xa')]()[_0x28bc('0xb')](cmHopperBlack[_0x28bc('0x10')](_0x48ab94))[_0x28bc('0xd')](loggerCatch(_0x28bc('0x11')));};exports[_0x28bc('0x12')]=function(_0x4ed42c){return BPromise['resolve']()[_0x28bc('0xb')](cmHopper['getContactPreview'](_0x4ed42c))[_0x28bc('0xd')](loggerCatch('[getContactPreview]\x20'));};exports[_0x28bc('0xc')]=function(_0x3bf68a,_0x53703c){create(_0x3bf68a)[_0x28bc('0xd')](loggerCatch(_0x53703c));moveContact(_0x3bf68a)['catch'](loggerCatch(_0x53703c));};exports[_0x28bc('0x13')]=function(_0x12c6d1,_0x28c34d){createAgent(_0x12c6d1)[_0x28bc('0xd')](loggerCatch(_0x28c34d));};exports[_0x28bc('0x14')]=function(_0xd1506b,_0x3e4408){create(_0xd1506b)[_0x28bc('0xd')](loggerCatch(_0x3e4408));};exports[_0x28bc('0x15')]=function(_0x44396f,_0x319c8b){moveContact(_0x44396f)[_0x28bc('0xd')](loggerCatch(_0x319c8b));};exports[_0x28bc('0x16')]=function(_0x2f0a80,_0x203fbf,_0x3cc8bb){if(_0x203fbf){_0x2f0a80['UserId']=null;}if(_0x3cc8bb){_0x2f0a80[_0x28bc('0x17')]=![];}return BPromise['resolve']()['then'](cmHopper['rescheduleContact'](_0x2f0a80))[_0x28bc('0xd')](loggerCatch(_0x28bc('0x18')));};exports[_0x28bc('0x19')]=function(_0x2eb4d0){return BPromise[_0x28bc('0xa')]()[_0x28bc('0xb')](cmHopper[_0x28bc('0x19')](_0x2eb4d0))[_0x28bc('0xd')](loggerCatch(_0x28bc('0x1a')));};exports[_0x28bc('0x1b')]=function(_0x5b6899){return BPromise[_0x28bc('0xa')]()[_0x28bc('0xb')](cmHopper[_0x28bc('0x1b')]({'UserId':null},_0x5b6899,0x1))[_0x28bc('0xd')](loggerCatch(_0x28bc('0x1c')));};exports[_0x28bc('0x1d')]=function(_0xc9e4e9){return BPromise[_0x28bc('0xa')]()[_0x28bc('0xb')](cmHopper[_0x28bc('0x1b')]({'active':![]},_0xc9e4e9,0x1))[_0x28bc('0xd')](loggerCatch(_0x28bc('0x1e')));};exports[_0x28bc('0x1f')]=function(_0x522b55){var _0x4e50b7={};_0x4e50b7[_0x28bc('0x20')]=_0x522b55['type'];_0x4e50b7['uniqueid']=_0x522b55[_0x28bc('0x21')];_0x4e50b7['calleridnum']=_0x522b55['calleridnum'];_0x4e50b7[_0x28bc('0x22')]=_0x522b55['calleridname'];_0x4e50b7['queue']=_0x522b55['queue'];_0x4e50b7['queuecallerjoinAt']=_0x522b55['answertime'];_0x4e50b7[_0x28bc('0x23')]=_0x522b55[_0x28bc('0x24')];_0x4e50b7[_0x28bc('0x25')]=0x1;_0x4e50b7[_0x28bc('0x26')]=_0x522b55[_0x28bc('0x27')];_0x4e50b7['connectedlinename']=_0x522b55[_0x28bc('0x28')];_0x4e50b7[_0x28bc('0x29')]=_0x28bc('0x2a');_0x4e50b7[_0x28bc('0x2b')]=_0x28bc('0x2c');_0x4e50b7['holdtime']=0x0;_0x4e50b7[_0x28bc('0x2d')]=0x1;_0x4e50b7['lastAssignedTo']=_0x522b55[_0x28bc('0x28')];_0x4e50b7[_0x28bc('0x2e')]=_0x28bc('0x2f');return BPromise[_0x28bc('0xa')]()[_0x28bc('0xb')](voiceQueueReport[_0x28bc('0x30')](_0x4e50b7))[_0x28bc('0xd')](loggerCatch(_0x28bc('0x31')));};exports[_0x28bc('0x32')]=function(_0x2dcca1,_0x3f70c6){return BPromise[_0x28bc('0xa')]()[_0x28bc('0xb')](cmHopper[_0x28bc('0x32')](_0x2dcca1,_0x3f70c6))[_0x28bc('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x28bc('0x33')]=function(_0x5f457f){return BPromise[_0x28bc('0xa')]()['then'](cmHopper[_0x28bc('0x16')](_0x5f457f,!![],!![]))['catch'](loggerCatch(_0x28bc('0x34')));}; \ No newline at end of file +var _0x7695=['getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','context','from-sip','xcally-motion-preview','holdtime','assigned','membername','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7695,0x6c));var _0x5769=function(_0x2f765b,_0x55dab0){_0x2f765b=_0x2f765b-0x0;var _0x4d184d=_0x7695[_0x2f765b];return _0x4d184d;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x5769('0x0'));var _=require(_0x5769('0x1'));var cmHopper=require(_0x5769('0x2'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x5769('0x3'));var cmHopperBlack=require(_0x5769('0x4'));var voiceQueueRt=require(_0x5769('0x5'));var agentReportPreview=require(_0x5769('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x5d2725){return function(_0x1fa9a3){logger[_0x5769('0x7')](_0x5d2725,util[_0x5769('0x8')](_0x1fa9a3,{'showHidden':![],'depth':null}));};}function create(_0x5878d9){return BPromise[_0x5769('0x9')]()[_0x5769('0xa')](cmHopperHistory[_0x5769('0xb')](_0x5878d9))[_0x5769('0xc')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x167237){return BPromise[_0x5769('0x9')]()['then'](agentReportPreview[_0x5769('0xb')](_0x167237))[_0x5769('0xc')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x307968){return BPromise[_0x5769('0x9')]()[_0x5769('0xa')](cmHopper[_0x5769('0xd')](_0x307968,!![]))[_0x5769('0xc')](loggerCatch(_0x5769('0xe')));}exports[_0x5769('0xf')]=function(_0x20c2a0){return BPromise[_0x5769('0x9')]()[_0x5769('0xa')](cmHopperBlack['checkIsBlackList'](_0x20c2a0))[_0x5769('0xc')](loggerCatch(_0x5769('0x10')));};exports[_0x5769('0x11')]=function(_0x9be8c8){return BPromise[_0x5769('0x9')]()['then'](cmHopper[_0x5769('0x11')](_0x9be8c8))['catch'](loggerCatch(_0x5769('0x12')));};exports[_0x5769('0xb')]=function(_0x430a59,_0x3978ed){create(_0x430a59)[_0x5769('0xc')](loggerCatch(_0x3978ed));moveContact(_0x430a59)[_0x5769('0xc')](loggerCatch(_0x3978ed));};exports[_0x5769('0x13')]=function(_0x5a65e1,_0x5b4baf){createAgent(_0x5a65e1)['catch'](loggerCatch(_0x5b4baf));};exports[_0x5769('0x14')]=function(_0x224f36,_0x116310){create(_0x224f36)[_0x5769('0xc')](loggerCatch(_0x116310));};exports[_0x5769('0x15')]=function(_0x29d572,_0x811882){moveContact(_0x29d572)[_0x5769('0xc')](loggerCatch(_0x811882));};exports['rescheduleContact']=function(_0x45ce64,_0x8d0518,_0x4d7599){if(_0x8d0518){_0x45ce64[_0x5769('0x16')]=null;}if(_0x4d7599){_0x45ce64[_0x5769('0x17')]=![];}return BPromise['resolve']()[_0x5769('0xa')](cmHopper[_0x5769('0x18')](_0x45ce64))[_0x5769('0xc')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x5769('0x19')]=function(_0x48af5c){return BPromise[_0x5769('0x9')]()['then'](cmHopper[_0x5769('0x19')](_0x48af5c))[_0x5769('0xc')](loggerCatch(_0x5769('0x1a')));};exports['unlockContact']=function(_0x121e3a){return BPromise['resolve']()[_0x5769('0xa')](cmHopper[_0x5769('0x1b')]({'UserId':null},_0x121e3a,0x1))[_0x5769('0xc')](loggerCatch('[unlockContact]\x20'));};exports[_0x5769('0x1c')]=function(_0x4d7ac5){return BPromise['resolve']()[_0x5769('0xa')](cmHopper['unlockContact']({'active':![]},_0x4d7ac5,0x1))[_0x5769('0xc')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x316c2a){var _0x52a073={};_0x52a073[_0x5769('0x1d')]=_0x316c2a[_0x5769('0x1d')];_0x52a073[_0x5769('0x1e')]=_0x316c2a[_0x5769('0x1e')];_0x52a073[_0x5769('0x1f')]=_0x316c2a['calleridnum'];_0x52a073[_0x5769('0x20')]=_0x316c2a['calleridname'];_0x52a073['queue']=_0x316c2a[_0x5769('0x21')];_0x52a073[_0x5769('0x22')]=_0x316c2a[_0x5769('0x23')];_0x52a073[_0x5769('0x24')]=_0x316c2a['answertime'];_0x52a073[_0x5769('0x25')]=0x1;_0x52a073[_0x5769('0x26')]=_0x316c2a['endtime'];_0x52a073['connectedlinename']=_0x316c2a['membername'];_0x52a073[_0x5769('0x27')]=_0x5769('0x28');_0x52a073['exten']=_0x5769('0x29');_0x52a073[_0x5769('0x2a')]=0x0;_0x52a073[_0x5769('0x2b')]=0x1;_0x52a073['lastAssignedTo']=_0x316c2a[_0x5769('0x2c')];_0x52a073[_0x5769('0x2d')]=_0x5769('0x2e');return BPromise['resolve']()[_0x5769('0xa')](voiceQueueReport['create'](_0x52a073))['catch'](loggerCatch(_0x5769('0x2f')));};exports[_0x5769('0x30')]=function(_0x4a0120,_0x491ac7){return BPromise[_0x5769('0x9')]()[_0x5769('0xa')](cmHopper[_0x5769('0x30')](_0x4a0120,_0x491ac7))['catch'](loggerCatch(_0x5769('0x31')));};exports[_0x5769('0x32')]=function(_0x1f42ed){return BPromise[_0x5769('0x9')]()['then'](cmHopper['rescheduleContact'](_0x1f42ed,!![],!![]))[_0x5769('0xc')](loggerCatch(_0x5769('0x33')));}; \ 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 e09822b..55f19bb 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 _0x972a=['originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','endtime','logAgent','statedesc','ringtime','logLookAgent','membername','UserId','talktime','answertime','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','minutes','ContactId','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','motionChannel','mandatoryDisposition','agentReadyId','status','reachable','getDiff','diff','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','scheduledat','countglobal','callback','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','error','logger','info','inspect','loggerError','message','getCallerId','string','isEmpty','isUndefined','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)','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum'];(function(_0x43d809,_0x6853e6){var _0x75a20f=function(_0x19f0ed){while(--_0x19f0ed){_0x43d809['push'](_0x43d809['shift']());}};_0x75a20f(++_0x6853e6);}(_0x972a,0x66));var _0xa972=function(_0x499792,_0x20bf22){_0x499792=_0x499792-0x0;var _0x1ba806=_0x972a[_0x499792];return _0x1ba806;};'use strict';var util=require(_0xa972('0x0'));var _=require(_0xa972('0x1'));var moment=require(_0xa972('0x2'));var logger=require(_0xa972('0x3'))(_0xa972('0x4'));var ipAgi=process['env'][_0xa972('0x5')]||_0xa972('0x6');function getSeconds(_0x55427e,_0x2d8e69){var _0x5990f0=moment(_0x55427e)[_0xa972('0x7')](0x0);var _0x5b31d1=moment(_0x2d8e69)[_0xa972('0x7')](0x0);return _0x5990f0['diff'](_0x5b31d1,_0xa972('0x8'));}exports['loggerCatch']=function(_0x1c2a1a){return function(_0x212bf4){logger[_0xa972('0x9')](_0x1c2a1a,util['inspect'](_0x212bf4,{'showHidden':![],'depth':null}));};};exports[_0xa972('0xa')]=function(_0x5e046a,_0x4e59e3){logger[_0xa972('0xb')](_0x5e046a,util[_0xa972('0xc')](_0x4e59e3,{'showHidden':![],'depth':null}));};exports[_0xa972('0xd')]=function(_0x56e5f3,_0x1f52be){logger['error'](_0x56e5f3,util[_0xa972('0xc')](_0x1f52be,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x356320){return function(_0x536e81){logger['info'](_0x356320,util['inspect'](_0x536e81,{'showHidden':![],'depth':null}));};};exports[_0xa972('0xe')]=function(_0x1b8bb6,_0x4485ad,_0x3cac7f){return{'message':_0x1b8bb6,'unlock':_0x4485ad,'active':_0x3cac7f};};exports[_0xa972('0xf')]=function(_0x193db8,_0x4f4fbc,_0x30ca94){if(!_['isUndefined'](_0x30ca94)&&_0xa972('0x10')===typeof _0x30ca94&&!_[_0xa972('0x11')](_0x30ca94)){if(!_[_0xa972('0x12')](_0x4f4fbc)&&'string'===typeof _0x4f4fbc&&!_[_0xa972('0x11')](_0x4f4fbc)){return util[_0xa972('0x13')](_0xa972('0x14'),_0x4f4fbc,_0x30ca94);}return util[_0xa972('0x13')]('\x22%s\x22\x20<%s>',_0x30ca94,_0x30ca94);}if(!_[_0xa972('0x12')](_0x193db8)&&'string'===typeof _0x193db8&&!_[_0xa972('0x11')](_0x193db8)){return _0x193db8;}return _0xa972('0x15');};exports['isActive']=function(_0x41bed9){if(_[_0xa972('0x16')](_0x41bed9)){return![];}return _0x41bed9;};exports[_0xa972('0x17')]=function(_0xf5b1e4,_0x1a4c80,_0x56adb6,_0x23330b,_0x3211b6,_0x1a6dfa){var _0x54fdc1={'XMD-QUEUE':_0x1a4c80[_0xa972('0x18')]?_0x1a4c80[_0xa972('0x18')][_0xa972('0x19')]:'','XMD-CALLERID':_0x23330b,'XMD-CALLERID-PREVIEW':_0x1a6dfa?util[_0xa972('0x13')](_0xa972('0x14'),_0x1a6dfa[_0xa972('0x1a')],_0x1a6dfa[_0xa972('0x1b')]):_0x23330b,'XMD-DIALID':_0x3211b6,'XMD-CONTACTID':_0x1a4c80['ContactId'],'XMD-CDRTYPE':_0xa972('0x1c'),'CALLERID(all)':_0x23330b,'XMD-VOICEQUEUEID':_0x1a4c80['VoiceQueueId'],'XMD-DIALCHANNEL':_0x56adb6,'XMD-DIALTIMEOUT':_0xf5b1e4[_0xa972('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xa972('0x13')](_0xa972('0x1e'),_0xf5b1e4[_0xa972('0x1f')]?'g':'',_[_0xa972('0x11')](_0xf5b1e4[_0xa972('0x20')])?'':_0xa972('0x21')),'XMD-DIALURL':_0xf5b1e4['dialPreviewUrl']||'','XMD-AGI':_0xf5b1e4[_0xa972('0x22')]?util[_0xa972('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0xf5b1e4[_0xa972('0x22')]):_0xa972('0x23'),'XMD-AGIAFTER':_0xf5b1e4['dialQueueProject2']?util[_0xa972('0x13')](_0xa972('0x24'),ipAgi,_0xf5b1e4[_0xa972('0x1f')]):_0xa972('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x1a6dfa?_0x1a6dfa[_0xa972('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x1a6dfa?_0x1a6dfa[_0xa972('0x26')]:'','XMD-DESTINATION':_0xa972('0x27'),'SIPADDHEADER':_0xa972('0x28')};if(!_[_0xa972('0x11')](_0xf5b1e4[_0xa972('0x20')])){_0x54fdc1[util[_0xa972('0x13')]('%s',_0xa972('0x29'))]=_0xf5b1e4[_0xa972('0x20')];_0x54fdc1[util['format']('%s',_0xa972('0x2a'))]=_0x3211b6;}if(_0x1a4c80&&_0x1a4c80[_0xa972('0x2b')]){for(var _0xa4ca74 in _0x1a4c80[_0xa972('0x2b')]){if(_0x1a4c80[_0xa972('0x2b')][_0xa972('0x2c')](_0xa4ca74)){if(!_[_0xa972('0x16')](_0x1a4c80[_0xa972('0x2b')][_0xa4ca74])&&_0xa4ca74!=='id'&&_0xa4ca74!=='tags'&&_0xa4ca74!==_0xa972('0x2d')&&_0xa4ca74!=='updatedAt'){_0x54fdc1[util['format'](_0xa972('0x2e'),_0xa972('0x2f'),_['toUpper'](_0xa4ca74))]=_0x1a4c80[_0xa972('0x2b')][_0xa4ca74];}}}}return _0x54fdc1;};exports[_0xa972('0x30')]=function(_0x2ca6c9){var _0x1e3a6b={};for(var _0x379c70 in _0x2ca6c9){if(_0x2ca6c9['hasOwnProperty'](_0x379c70)){_0x1e3a6b[util[_0xa972('0x13')]('%s',_[_0xa972('0x31')](_0x379c70))]=_0x2ca6c9[_0x379c70];}}return{'variables':_0x1e3a6b};};exports[_0xa972('0x32')]=function(_0x258ae9,_0x298a4d){if(!_[_0xa972('0x16')](_0x258ae9)){if(_0x258ae9[_0xa972('0x2c')](_0xa972('0x33'))){if(_0x258ae9[_0xa972('0x33')]>0x0){_0x258ae9[_0xa972('0x33')]-=0x1;}else{logger[_0xa972('0x9')](_0xa972('0x34'),_0x298a4d);}}}else{logger[_0xa972('0x9')](_0xa972('0x35'),_0x298a4d);}};exports[_0xa972('0x36')]=function(_0x973e14){var _0x21057d=moment()[_0xa972('0x13')](_0xa972('0x37'));_0x973e14[_0xa972('0x38')]=0xd;_0x973e14['statedesc']='Blacklist';_0x973e14[_0xa972('0x39')]=_0x21057d;_0x973e14[_0xa972('0x3a')]=_0x21057d;_0x973e14[_0xa972('0x3b')]=_0x21057d;};exports[_0xa972('0x3c')]=function(_0x56b825,_0x4e3ac8,_0x537b37){var _0xc12ab=moment()['format'](_0xa972('0x37'));_0x56b825[_0xa972('0x38')]=_0x4e3ac8;_0x56b825[_0xa972('0x3d')]=_0x537b37;_0x56b825[_0xa972('0x3a')]=_0xc12ab;_0x56b825[_0xa972('0x3e')]=getSeconds(_0x56b825[_0xa972('0x3a')],_0x56b825[_0xa972('0x39')]);};exports[_0xa972('0x3f')]=function(_0x2251a9,_0x10088c,_0x3181c1){_0x2251a9[_0xa972('0x40')]=_0x10088c;_0x2251a9[_0xa972('0x41')]=_0x3181c1;};exports['logCustomer']=function(_0xddbb6e,_0x486eca,_0x29f941){var _0x194fb0=moment()[_0xa972('0x13')](_0xa972('0x37'));_0xddbb6e[_0xa972('0x38')]=_0x486eca;_0xddbb6e['statedesc']=_0x29f941;_0xddbb6e['responsetime']=_0xddbb6e[_0xa972('0x3a')]?_0xddbb6e[_0xa972('0x3a')]:_0x194fb0;_0xddbb6e[_0xa972('0x3b')]=_0xddbb6e[_0xa972('0x3b')]?_0xddbb6e[_0xa972('0x3b')]:_0x194fb0;_0xddbb6e[_0xa972('0x3e')]=getSeconds(_0xddbb6e[_0xa972('0x3a')]||0x0,_0xddbb6e[_0xa972('0x39')]||0x0);_0xddbb6e[_0xa972('0x42')]=_0xddbb6e[_0xa972('0x43')]?getSeconds(_0xddbb6e[_0xa972('0x3b')],_0xddbb6e[_0xa972('0x43')]):0x0;};exports['isFailure']=function(_0x887f65){return _0x887f65===_0xa972('0x44');};exports['variablesAction']=function(_0x222e3e,_0x4ddf39,_0x3f54e8,_0x250923,_0x384dc3){var _0x25feb3=_0x250923?_0xa972('0x45'):_0x222e3e[_0xa972('0x1a')];_0x25feb3=_0x384dc3?_0xa972('0x46'):_0x25feb3;return{'actionid':_0x222e3e[_0xa972('0x47')],'action':_0xa972('0x48'),'channel':_0x222e3e[_0xa972('0x49')],'callerid':util['format'](_0xa972('0x14'),_0x25feb3,_0x222e3e[_0xa972('0x1b')]),'Exten':_0xa972('0x27'),'Context':_0xa972('0x4a'),'Priority':'1','variable':_0x3f54e8,'timeout':(_0x4ddf39[_0xa972('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x222e3e[_0xa972('0x47')]};};exports[_0xa972('0x4c')]=function(_0x1abebd){return _0x1abebd[_0xa972('0x4d')]+_0x1abebd['countcongestionretry']+_0x1abebd[_0xa972('0x4e')]+_0x1abebd[_0xa972('0x4f')]+_0x1abebd[_0xa972('0x50')];};exports[_0xa972('0x51')]=function(_0x5b2175){var _0x423e1=_[_0xa972('0x52')](_0x5b2175);_0x423e1[_0xa972('0x38')]=0xf;_0x423e1[_0xa972('0x3d')]='Global';return _0x423e1;};exports[_0xa972('0x53')]=function(_0x3481cf,_0x440377,_0x38a7b3){var _0x3ec69f={};_0x3ec69f[_0x440377]=_0x3481cf[_0x440377];_0x3ec69f[_0xa972('0x54')]=![];_0x3ec69f['scheduledat']=moment()['add'](_0x38a7b3,_0xa972('0x55'))[_0xa972('0x13')](_0xa972('0x37'));_0x3ec69f[_0xa972('0x56')]=_0x3481cf[_0xa972('0x56')];_0x3ec69f[_0xa972('0x57')]=_0x3481cf['ListId'];_0x3ec69f[_0xa972('0x58')]=_0x3481cf['VoiceQueueId']||undefined;return _0x3ec69f;};exports[_0xa972('0x59')]=function(_0x491792,_0x51d489){if(!_['isNil'](_0x491792)){if(_0x491792[_0xa972('0x5a')]>0x0){_0x491792[_0xa972('0x5a')]-=0x1;}else{logger[_0xa972('0x9')](_0x51d489,_0xa972('0x5b'));}}else{logger[_0xa972('0x9')](_0x51d489,_0xa972('0x5c'));}};exports['IsNotLoggedIn']=function(_0x2472c1){if(_0x2472c1<=0x0){return!![];}return![];};exports['buildObj']=function(_0x5c2ce6,_0x1f5302,_0x4361d9){_0x5c2ce6[_0xa972('0x5d')]=_0x1f5302;_0x5c2ce6[_0xa972('0x19')]=_0x5c2ce6[_0xa972('0x5e')];_0x5c2ce6[_0xa972('0x5f')]=_0x5c2ce6['channelAgent'];_0x5c2ce6[_0xa972('0x60')]='voice';if(_0x4361d9){_0x5c2ce6['mandatoryDisposition']=_0x4361d9[_0xa972('0x61')];}return _0x5c2ce6;};exports['buildAcw']=function(_0x269e84){var _0x321ceb={};_0x321ceb[_0xa972('0x5e')]=_0x269e84[_0xa972('0x5e')];_0x321ceb['interface']=_0x269e84[_0xa972('0x49')];_0x321ceb['uniqueid']=_0x269e84[_0xa972('0x47')];return _0x321ceb;};exports[_0xa972('0x62')]=function(_0x1cfc82){var _0x2b27d4=[];for(var _0x2c4544 in _0x1cfc82){if(_0x1cfc82[_0xa972('0x2c')](_0x2c4544)){if(!_[_0xa972('0x16')](_0x1cfc82[_0x2c4544])&&_0x1cfc82[_0x2c4544][_0xa972('0x38')]==='not_inuse'&&_0x1cfc82[_0x2c4544][_0xa972('0x63')]===_0xa972('0x64')){_0x2b27d4['push'](_0x1cfc82[_0x2c4544]['id']);}}}return _0x2b27d4;};exports[_0xa972('0x65')]=function(_0x1cc557){var _0x5631d0=moment()[_0xa972('0x7')](0x0);var _0x44e286=moment(_0x1cc557)[_0xa972('0x7')](0x0);return _0x5631d0[_0xa972('0x66')](_0x44e286,_0xa972('0x8'));};exports[_0xa972('0x67')]=function(_0x373beb){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x373beb[_0xa972('0x56')],'ListId':_0x373beb[_0xa972('0x57')],'VoiceQueueId':_0x373beb['VoiceQueueId']||undefined,'CampaignId':_0x373beb[_0xa972('0x68')]||undefined};};exports[_0xa972('0x69')]=function(_0xd220a0){if(_0xd220a0===_0xa972('0x47')||_0xd220a0==='idContact'||_0xd220a0===_0xa972('0x5e')||_0xd220a0===_0xa972('0x6a')||_0xd220a0===_0xa972('0x6b')||_0xd220a0===_0xa972('0x6c')||_0xd220a0===_0xa972('0x40')||_0xd220a0===_0xa972('0x49')||_0xd220a0===_0xa972('0x1a')||_0xd220a0===_0xa972('0x54')||_0xd220a0==='calleridnum'||_0xd220a0===_0xa972('0x6d')||_0xd220a0==='countbusyretry'||_0xd220a0==='countcongestionretry'||_0xd220a0===_0xa972('0x4e')||_0xd220a0===_0xa972('0x6e')||_0xd220a0===_0xa972('0x6f')||_0xd220a0===_0xa972('0x70')||_0xd220a0===_0xa972('0x71')||_0xd220a0==='recallme'||_0xd220a0===_0xa972('0x56')||_0xd220a0===_0xa972('0x57')||_0xd220a0===_0xa972('0x41')||_0xd220a0===_0xa972('0x58')||_0xd220a0==='sipcallid'||_0xd220a0===_0xa972('0x72')||_0xd220a0===_0xa972('0x73')||_0xd220a0===_0xa972('0x74')||_0xd220a0==='xmd-listid'||_0xd220a0===_0xa972('0x75')||_0xd220a0===_0xa972('0x76')||_0xd220a0==='xmd-dialoptions'||_0xd220a0===_0xa972('0x77')||_0xd220a0===_0xa972('0x78')||_0xd220a0==='xmd-contactid'||_0xd220a0==='xmd-cdrtype'||_0xd220a0===_0xa972('0x79')||_0xd220a0===_0xa972('0x7a')||_0xd220a0===_0xa972('0x7b')||_0xd220a0===_0xa972('0x7c')||_0xd220a0===_0xa972('0x7d')||_0xd220a0==='rtpaudioqosjitter'||_0xd220a0===_0xa972('0x7e')||_0xd220a0===_0xa972('0x7f')||_0xd220a0===_0xa972('0x80')||_0xd220a0===_0xa972('0x81')||_0xd220a0===_0xa972('0x82')||_0xd220a0==='rtpaudioqos'||_0xd220a0===_0xa972('0x7d')||_0xd220a0===_0xa972('0x83')||_0xd220a0===_0xa972('0x7e')||_0xd220a0===_0xa972('0x7f')||_0xd220a0===_0xa972('0x80')||_0xd220a0==='rtpaudioqosrtt'||_0xd220a0===_0xa972('0x82')||_0xd220a0===_0xa972('0x84')||_0xd220a0===_0xa972('0x85')||_0xd220a0===_0xa972('0x38')||_0xd220a0===_0xa972('0x3d')){return![];}return!![];};exports[_0xa972('0x86')]=function(_0x381aa8,_0xc6de38){var _0x316951,_0x512194,_0x16b51e;if(_0xc6de38<=0x0){_0xc6de38=0x1;}_0x316951=new RegExp(_0xa972('0x87')+_0xc6de38+'}$');_0x512194=Math[_0xa972('0x88')](0xa,_0xc6de38-0x1);_0x16b51e=Math['pow'](0xa,_0xc6de38)-0x1;return util['format']('%s',_[_0xa972('0x89')](_0x381aa8,_0x316951,_['random'](_0x512194,_0x16b51e)));};exports['extractCalleridName']=function(_0x4bd19b){var _0x42b8ff=_0x4bd19b[_0xa972('0x8a')](/"(.*?)"/);return _0x42b8ff?_0x42b8ff[0x1]:_0x4bd19b;};exports[_0xa972('0x8b')]=function(_0x5d9de2){var _0x337db3=_0x5d9de2[_0xa972('0x8a')](/<(.*?)>/);return _0x337db3?_0x337db3[0x1]:_0x5d9de2;}; \ No newline at end of file +var _0x5ce9=['dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','type','campaigntype','dialAnswer','scheduledat','countglobal','callbackuniqueid','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter','xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosbridged','bridgepvtcallid','pow','replace','random','extractCalleridName','match','util','lodash','moment','../../../../config/logger','env','milliseconds','diff','seconds','loggerCatch','error','logger','info','loggerError','inspect','logger2','getCallerId','string','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId'];(function(_0x3397a6,_0xf0f210){var _0x264d3d=function(_0x58368a){while(--_0x58368a){_0x3397a6['push'](_0x3397a6['shift']());}};_0x264d3d(++_0xf0f210);}(_0x5ce9,0xfa));var _0x95ce=function(_0x632b19,_0x4b60bf){_0x632b19=_0x632b19-0x0;var _0x59fa74=_0x5ce9[_0x632b19];return _0x59fa74;};'use strict';var util=require(_0x95ce('0x0'));var _=require(_0x95ce('0x1'));var moment=require(_0x95ce('0x2'));var logger=require(_0x95ce('0x3'))('preview');var ipAgi=process[_0x95ce('0x4')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x18ed63,_0x5c5e12){var _0x295023=moment(_0x18ed63)[_0x95ce('0x5')](0x0);var _0x549d43=moment(_0x5c5e12)['milliseconds'](0x0);return _0x295023[_0x95ce('0x6')](_0x549d43,_0x95ce('0x7'));}exports[_0x95ce('0x8')]=function(_0x3bb136){return function(_0x526742){logger[_0x95ce('0x9')](_0x3bb136,util['inspect'](_0x526742,{'showHidden':![],'depth':null}));};};exports[_0x95ce('0xa')]=function(_0x383d89,_0x4ddf80){logger[_0x95ce('0xb')](_0x383d89,util['inspect'](_0x4ddf80,{'showHidden':![],'depth':null}));};exports[_0x95ce('0xc')]=function(_0x3b8702,_0x27d57f){logger[_0x95ce('0x9')](_0x3b8702,util[_0x95ce('0xd')](_0x27d57f,{'showHidden':![],'depth':null}));};exports[_0x95ce('0xe')]=function(_0x4f1300){return function(_0x5811e5){logger[_0x95ce('0xb')](_0x4f1300,util[_0x95ce('0xd')](_0x5811e5,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x135ca9,_0xf7b970,_0x527e0e){return{'message':_0x135ca9,'unlock':_0xf7b970,'active':_0x527e0e};};exports[_0x95ce('0xf')]=function(_0x144529,_0x260b65,_0x5aaf25){if(!_['isUndefined'](_0x5aaf25)&&_0x95ce('0x10')===typeof _0x5aaf25&&!_['isEmpty'](_0x5aaf25)){if(!_[_0x95ce('0x11')](_0x260b65)&&_0x95ce('0x10')===typeof _0x260b65&&!_[_0x95ce('0x12')](_0x260b65)){return util[_0x95ce('0x13')](_0x95ce('0x14'),_0x260b65,_0x5aaf25);}return util[_0x95ce('0x13')](_0x95ce('0x14'),_0x5aaf25,_0x5aaf25);}if(!_[_0x95ce('0x11')](_0x144529)&&_0x95ce('0x10')===typeof _0x144529&&!_[_0x95ce('0x12')](_0x144529)){return _0x144529;}return _0x95ce('0x15');};exports[_0x95ce('0x16')]=function(_0x19231f){if(_[_0x95ce('0x17')](_0x19231f)){return![];}return _0x19231f;};exports[_0x95ce('0x18')]=function(_0x54c8e3,_0x25c3e0,_0x42d405,_0x1e40ca,_0x1626f7,_0x56f369){var _0x2a16e0={'XMD-QUEUE':_0x25c3e0[_0x95ce('0x19')]?_0x25c3e0[_0x95ce('0x19')][_0x95ce('0x1a')]:'','XMD-CALLERID':_0x1e40ca,'XMD-CALLERID-PREVIEW':_0x56f369?util[_0x95ce('0x13')](_0x95ce('0x14'),_0x56f369[_0x95ce('0x1b')],_0x56f369[_0x95ce('0x1c')]):_0x1e40ca,'XMD-DIALID':_0x1626f7,'XMD-CONTACTID':_0x25c3e0[_0x95ce('0x1d')],'XMD-CDRTYPE':_0x95ce('0x1e'),'CALLERID(all)':_0x1e40ca,'XMD-VOICEQUEUEID':_0x25c3e0[_0x95ce('0x1f')],'XMD-DIALCHANNEL':_0x42d405,'XMD-DIALTIMEOUT':_0x54c8e3['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x95ce('0x13')](_0x95ce('0x20'),_0x54c8e3[_0x95ce('0x21')]?'g':'',_[_0x95ce('0x12')](_0x54c8e3[_0x95ce('0x22')])?'':_0x95ce('0x23')),'XMD-DIALURL':_0x54c8e3['dialPreviewUrl']||'','XMD-AGI':_0x54c8e3[_0x95ce('0x24')]?util[_0x95ce('0x13')](_0x95ce('0x25'),ipAgi,_0x54c8e3[_0x95ce('0x24')]):_0x95ce('0x26'),'XMD-AGIAFTER':_0x54c8e3[_0x95ce('0x21')]?util[_0x95ce('0x13')](_0x95ce('0x25'),ipAgi,_0x54c8e3[_0x95ce('0x21')]):_0x95ce('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x56f369?_0x56f369[_0x95ce('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x56f369?_0x56f369[_0x95ce('0x28')]:'','XMD-DESTINATION':_0x95ce('0x29'),'SIPADDHEADER':_0x95ce('0x2a')};if(!_['isEmpty'](_0x54c8e3[_0x95ce('0x22')])){_0x2a16e0[util[_0x95ce('0x13')]('%s',_0x95ce('0x2b'))]=_0x54c8e3[_0x95ce('0x22')];_0x2a16e0[util[_0x95ce('0x13')]('%s',_0x95ce('0x2c'))]=_0x1626f7;}if(_0x25c3e0&&_0x25c3e0['Contact']){for(var _0x405f21 in _0x25c3e0[_0x95ce('0x2d')]){if(_0x25c3e0[_0x95ce('0x2d')][_0x95ce('0x2e')](_0x405f21)){if(!_[_0x95ce('0x17')](_0x25c3e0[_0x95ce('0x2d')][_0x405f21])&&_0x405f21!=='id'&&_0x405f21!=='tags'&&_0x405f21!==_0x95ce('0x2f')&&_0x405f21!==_0x95ce('0x30')){_0x2a16e0[util[_0x95ce('0x13')](_0x95ce('0x31'),'XMD-',_[_0x95ce('0x32')](_0x405f21))]=_0x25c3e0[_0x95ce('0x2d')][_0x405f21];}}}}return _0x2a16e0;};exports[_0x95ce('0x33')]=function(_0x112439){var _0x47ac4a={};for(var _0x38480e in _0x112439){if(_0x112439[_0x95ce('0x2e')](_0x38480e)){_0x47ac4a[util[_0x95ce('0x13')]('%s',_[_0x95ce('0x34')](_0x38480e))]=_0x112439[_0x38480e];}}return{'variables':_0x47ac4a};};exports[_0x95ce('0x35')]=function(_0x1066c4,_0x25c0ba){if(!_['isNil'](_0x1066c4)){if(_0x1066c4[_0x95ce('0x2e')](_0x95ce('0x36'))){if(_0x1066c4[_0x95ce('0x36')]>0x0){_0x1066c4['originated']-=0x1;}else{logger[_0x95ce('0x9')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x25c0ba);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x25c0ba);}};exports[_0x95ce('0x37')]=function(_0x268061){var _0x4a5dd6=moment()['format'](_0x95ce('0x38'));_0x268061[_0x95ce('0x39')]=0xd;_0x268061[_0x95ce('0x3a')]=_0x95ce('0x3b');_0x268061[_0x95ce('0x3c')]=_0x4a5dd6;_0x268061[_0x95ce('0x3d')]=_0x4a5dd6;_0x268061[_0x95ce('0x3e')]=_0x4a5dd6;};exports[_0x95ce('0x3f')]=function(_0x5bf281,_0x32803f,_0xfb681f){var _0x4c87d6=moment()['format'](_0x95ce('0x38'));_0x5bf281[_0x95ce('0x39')]=_0x32803f;_0x5bf281[_0x95ce('0x3a')]=_0xfb681f;_0x5bf281[_0x95ce('0x3d')]=_0x4c87d6;_0x5bf281[_0x95ce('0x40')]=getSeconds(_0x5bf281[_0x95ce('0x3d')],_0x5bf281['starttime']);};exports['logLookAgent']=function(_0x335881,_0x519627,_0x488ac7){_0x335881[_0x95ce('0x41')]=_0x519627;_0x335881[_0x95ce('0x42')]=_0x488ac7;};exports[_0x95ce('0x43')]=function(_0x3c4d7e,_0x3af777,_0xbf0549){var _0x200b66=moment()['format'](_0x95ce('0x38'));_0x3c4d7e['state']=_0x3af777;_0x3c4d7e['statedesc']=_0xbf0549;_0x3c4d7e[_0x95ce('0x3d')]=_0x3c4d7e[_0x95ce('0x3d')]?_0x3c4d7e[_0x95ce('0x3d')]:_0x200b66;_0x3c4d7e[_0x95ce('0x3e')]=_0x3c4d7e[_0x95ce('0x3e')]?_0x3c4d7e['endtime']:_0x200b66;_0x3c4d7e[_0x95ce('0x40')]=getSeconds(_0x3c4d7e[_0x95ce('0x3d')]||0x0,_0x3c4d7e[_0x95ce('0x3c')]||0x0);_0x3c4d7e[_0x95ce('0x44')]=_0x3c4d7e[_0x95ce('0x45')]?getSeconds(_0x3c4d7e[_0x95ce('0x3e')],_0x3c4d7e[_0x95ce('0x45')]):0x0;};exports[_0x95ce('0x46')]=function(_0x48a9bc){return _0x48a9bc===_0x95ce('0x47');};exports[_0x95ce('0x48')]=function(_0xf5a456,_0x5e09b0,_0x5ebd28,_0x8a3358,_0x3060bc){var _0x5773fd=_0x8a3358?_0x95ce('0x49'):_0xf5a456[_0x95ce('0x1b')];_0x5773fd=_0x3060bc?_0x95ce('0x4a'):_0x5773fd;return{'actionid':_0xf5a456[_0x95ce('0x4b')],'action':_0x95ce('0x4c'),'channel':_0xf5a456['channelAgent'],'callerid':util[_0x95ce('0x13')]('\x22%s\x22\x20<%s>',_0x5773fd,_0xf5a456[_0x95ce('0x1c')]),'Exten':_0x95ce('0x29'),'Context':_0x95ce('0x4d'),'Priority':'1','variable':_0x5ebd28,'timeout':(_0x5e09b0[_0x95ce('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0xf5a456[_0x95ce('0x4b')]};};exports[_0x95ce('0x4f')]=function(_0x1a7516){return _0x1a7516[_0x95ce('0x50')]+_0x1a7516[_0x95ce('0x51')]+_0x1a7516[_0x95ce('0x52')]+_0x1a7516['countagentrejectretry']+_0x1a7516[_0x95ce('0x53')];};exports[_0x95ce('0x54')]=function(_0x2a990f){var _0x4e54b2=_[_0x95ce('0x55')](_0x2a990f);_0x4e54b2[_0x95ce('0x39')]=0xf;_0x4e54b2[_0x95ce('0x3a')]='Global';return _0x4e54b2;};exports[_0x95ce('0x56')]=function(_0x1c114b,_0x43cadc,_0x428ebb){var _0x1bc9b8={};_0x1bc9b8[_0x43cadc]=_0x1c114b[_0x43cadc];_0x1bc9b8[_0x95ce('0x57')]=![];_0x1bc9b8['scheduledat']=moment()[_0x95ce('0x58')](_0x428ebb,_0x95ce('0x59'))[_0x95ce('0x13')](_0x95ce('0x38'));_0x1bc9b8[_0x95ce('0x1d')]=_0x1c114b[_0x95ce('0x1d')];_0x1bc9b8[_0x95ce('0x5a')]=_0x1c114b[_0x95ce('0x5a')];_0x1bc9b8[_0x95ce('0x1f')]=_0x1c114b['VoiceQueueId']||undefined;return _0x1bc9b8;};exports[_0x95ce('0x5b')]=function(_0xc5e9a7,_0x34cea2){if(!_[_0x95ce('0x17')](_0xc5e9a7)){if(_0xc5e9a7['pTalking']>0x0){_0xc5e9a7[_0x95ce('0x5c')]-=0x1;}else{logger[_0x95ce('0x9')](_0x34cea2,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x95ce('0x9')](_0x34cea2,_0x95ce('0x5d'));}};exports[_0x95ce('0x5e')]=function(_0x538812){if(_0x538812<=0x0){return!![];}return![];};exports['buildObj']=function(_0x1c52d9,_0x2c68b0,_0x522990){_0x1c52d9['lastevent']=_0x2c68b0;_0x1c52d9['name']=_0x1c52d9[_0x95ce('0x5f')];_0x1c52d9[_0x95ce('0x60')]=_0x1c52d9[_0x95ce('0x61')];_0x1c52d9[_0x95ce('0x62')]=_0x95ce('0x63');if(_0x522990){_0x1c52d9[_0x95ce('0x64')]=_0x522990[_0x95ce('0x64')];}return _0x1c52d9;};exports['buildAcw']=function(_0x6360ea){var _0xc8f7b={};_0xc8f7b[_0x95ce('0x5f')]=_0x6360ea['queue'];_0xc8f7b[_0x95ce('0x60')]=_0x6360ea['channelAgent'];_0xc8f7b[_0x95ce('0x4b')]=_0x6360ea[_0x95ce('0x4b')];return _0xc8f7b;};exports[_0x95ce('0x65')]=function(_0x2afa5d){var _0x5069d7=[];for(var _0x3e64c3 in _0x2afa5d){if(_0x2afa5d[_0x95ce('0x2e')](_0x3e64c3)){if(!_[_0x95ce('0x17')](_0x2afa5d[_0x3e64c3])&&_0x2afa5d[_0x3e64c3][_0x95ce('0x39')]===_0x95ce('0x66')&&_0x2afa5d[_0x3e64c3][_0x95ce('0x67')]===_0x95ce('0x68')){_0x5069d7[_0x95ce('0x69')](_0x2afa5d[_0x3e64c3]['id']);}}}return _0x5069d7;};exports[_0x95ce('0x6a')]=function(_0x2d1e56){var _0x2c38f8=moment()[_0x95ce('0x5')](0x0);var _0x4ab434=moment(_0x2d1e56)[_0x95ce('0x5')](0x0);return _0x2c38f8[_0x95ce('0x6')](_0x4ab434,_0x95ce('0x7'));};exports[_0x95ce('0x6b')]=function(_0x26d326){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x26d326[_0x95ce('0x1d')],'ListId':_0x26d326[_0x95ce('0x5a')],'VoiceQueueId':_0x26d326['VoiceQueueId']||undefined,'CampaignId':_0x26d326[_0x95ce('0x6c')]||undefined};};exports['filterKey']=function(_0x3426ab){if(_0x3426ab===_0x95ce('0x4b')||_0x3426ab==='idContact'||_0x3426ab===_0x95ce('0x5f')||_0x3426ab===_0x95ce('0x6d')||_0x3426ab===_0x95ce('0x6e')||_0x3426ab===_0x95ce('0x6f')||_0x3426ab===_0x95ce('0x41')||_0x3426ab==='channelAgent'||_0x3426ab===_0x95ce('0x1b')||_0x3426ab===_0x95ce('0x57')||_0x3426ab===_0x95ce('0x1c')||_0x3426ab===_0x95ce('0x70')||_0x3426ab==='countbusyretry'||_0x3426ab===_0x95ce('0x51')||_0x3426ab==='countnoanswerretry'||_0x3426ab===_0x95ce('0x71')||_0x3426ab==='callback'||_0x3426ab===_0x95ce('0x72')||_0x3426ab==='callbackat'||_0x3426ab===_0x95ce('0x73')||_0x3426ab===_0x95ce('0x1d')||_0x3426ab===_0x95ce('0x5a')||_0x3426ab==='UserId'||_0x3426ab===_0x95ce('0x1f')||_0x3426ab==='sipcallid'||_0x3426ab===_0x95ce('0x74')||_0x3426ab===_0x95ce('0x75')||_0x3426ab===_0x95ce('0x76')||_0x3426ab==='xmd-listid'||_0x3426ab===_0x95ce('0x77')||_0x3426ab===_0x95ce('0x78')||_0x3426ab==='xmd-dialoptions'||_0x3426ab===_0x95ce('0x79')||_0x3426ab===_0x95ce('0x7a')||_0x3426ab===_0x95ce('0x7b')||_0x3426ab==='xmd-cdrtype'||_0x3426ab==='xmd-callerid'||_0x3426ab===_0x95ce('0x7c')||_0x3426ab===_0x95ce('0x7d')||_0x3426ab==='rtpaudioqos'||_0x3426ab==='rtpaudioqosbridged'||_0x3426ab===_0x95ce('0x7e')||_0x3426ab===_0x95ce('0x7f')||_0x3426ab===_0x95ce('0x80')||_0x3426ab===_0x95ce('0x81')||_0x3426ab===_0x95ce('0x82')||_0x3426ab===_0x95ce('0x83')||_0x3426ab===_0x95ce('0x84')||_0x3426ab===_0x95ce('0x85')||_0x3426ab===_0x95ce('0x7e')||_0x3426ab==='rtpaudioqosjitterbridged'||_0x3426ab==='rtpaudioqosloss'||_0x3426ab===_0x95ce('0x81')||_0x3426ab==='rtpaudioqosrtt'||_0x3426ab==='rtpaudioqosrttbridged'||_0x3426ab==='bridgepeer'||_0x3426ab===_0x95ce('0x86')||_0x3426ab===_0x95ce('0x39')||_0x3426ab===_0x95ce('0x3a')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x2043ec,_0x24e92b){var _0x399e26,_0x2a607f,_0x3783da;if(_0x24e92b<=0x0){_0x24e92b=0x1;}_0x399e26=new RegExp('\x5cw{0,'+_0x24e92b+'}$');_0x2a607f=Math[_0x95ce('0x87')](0xa,_0x24e92b-0x1);_0x3783da=Math[_0x95ce('0x87')](0xa,_0x24e92b)-0x1;return util[_0x95ce('0x13')]('%s',_[_0x95ce('0x88')](_0x2043ec,_0x399e26,_[_0x95ce('0x89')](_0x2a607f,_0x3783da)));};exports[_0x95ce('0x8a')]=function(_0x209451){var _0xa7a4fe=_0x209451[_0x95ce('0x8b')](/"(.*?)"/);return _0xa7a4fe?_0xa7a4fe[0x1]:_0x209451;};exports['extractCalleridNumber']=function(_0x456dde){var _0x342fed=_0x456dde[_0x95ce('0x8b')](/<(.*?)>/);return _0x342fed?_0x342fed[0x1]:_0x456dde;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 318a325..1637524 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 _0x91f1=['voicequeuechannelredirect','string','number','boolean','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x226356,_0x2f30e1){var _0x121c6d=function(_0x70d3fe){while(--_0x70d3fe){_0x226356['push'](_0x226356['shift']());}};_0x121c6d(++_0x2f30e1);}(_0x91f1,0x160));var _0x191f=function(_0x4b57bd,_0x3a5187){_0x4b57bd=_0x4b57bd-0x0;var _0x308a79=_0x91f1[_0x4b57bd];return _0x308a79;};'use strict';exports['queueadd']={'queue':{'type':_0x191f('0x0'),'required':!![]},'interface':{'type':_0x191f('0x0'),'required':!![]},'membername':{'type':_0x191f('0x0'),'required':!![]},'penalty':{'type':_0x191f('0x1'),'required':![]},'paused':{'type':_0x191f('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x191f('0x0'),'required':!![]}};exports[_0x191f('0x3')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x191f('0x2')},'reason':{'type':_0x191f('0x0'),'required':![]}};exports[_0x191f('0x4')]={'module':{'type':_0x191f('0x0'),'required':![]}};exports[_0x191f('0x5')]={'uniqueid':{'type':_0x191f('0x0'),'required':!![]}};exports[_0x191f('0x6')]={'uniqueid':{'type':_0x191f('0x0'),'required':!![]},'filename':{'type':_0x191f('0x0')},'format':{'type':'string'},'mixmonitorid':{'type':_0x191f('0x0')}};exports[_0x191f('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x191f('0x8')]={'uniqueid':{'type':_0x191f('0x0'),'required':!![]},'exten':{'type':_0x191f('0x0'),'required':!![]},'context':{'type':_0x191f('0x0')}}; \ No newline at end of file +var _0xa99e=['queuepause','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','boolean'];(function(_0x5ea911,_0x2a8a79){var _0x34ea74=function(_0x3c6d49){while(--_0x3c6d49){_0x5ea911['push'](_0x5ea911['shift']());}};_0x34ea74(++_0x2a8a79);}(_0xa99e,0xc9));var _0xea99=function(_0x15a772,_0x1e090d){_0x15a772=_0x15a772-0x0;var _0x31798d=_0xa99e[_0x15a772];return _0x31798d;};'use strict';exports['queueadd']={'queue':{'type':'string','required':!![]},'interface':{'type':_0xea99('0x0'),'required':!![]},'membername':{'type':_0xea99('0x0'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xea99('0x1'),'required':![]}};exports['queueremove']={'queue':{'type':_0xea99('0x0'),'required':!![]},'interface':{'type':_0xea99('0x0'),'required':!![]}};exports[_0xea99('0x2')]={'interface':{'type':_0xea99('0x0'),'required':!![]},'paused':{'type':_0xea99('0x1')},'reason':{'type':_0xea99('0x0'),'required':![]}};exports[_0xea99('0x3')]={'module':{'type':_0xea99('0x0'),'required':![]}};exports[_0xea99('0x4')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xea99('0x0'),'required':!![]},'filename':{'type':_0xea99('0x0')},'format':{'type':_0xea99('0x0')},'mixmonitorid':{'type':_0xea99('0x0')}};exports[_0xea99('0x5')]={'uniqueid':{'type':_0xea99('0x0'),'required':!![]}};exports[_0xea99('0x6')]={'uniqueid':{'type':_0xea99('0x0'),'required':!![]},'exten':{'type':_0xea99('0x0'),'required':!![]},'context':{'type':_0xea99('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 49bfbb0..d882b3a 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 _0xc220=['unmanaged','queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','outbound','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/zendeskAccount','../model/freshdeskAccount','../model/zohoAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','interface','hasOwnProperty','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','initAgents','length','mergeFromDatabase','initTelephones','telephones','isUndefined','initVoiceQueues','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid'];(function(_0x403b65,_0x15d912){var _0x515cfb=function(_0x3cc615){while(--_0x3cc615){_0x403b65['push'](_0x403b65['shift']());}};_0x515cfb(++_0x15d912);}(_0xc220,0xe2));var _0x0c22=function(_0x114b6e,_0x1fb0dd){_0x114b6e=_0x114b6e-0x0;var _0x10f56d=_0xc220[_0x114b6e];return _0x10f56d;};'use strict';var BPromise=require(_0x0c22('0x0'));var util=require(_0x0c22('0x1'));var _=require(_0x0c22('0x2'));var moment=require('moment');var Agent=require(_0x0c22('0x3'));var Telephone=require(_0x0c22('0x4'));var Trunk=require(_0x0c22('0x5'));var VoiceQueue=require(_0x0c22('0x6'));var Trigger=require(_0x0c22('0x7'));var Template=require(_0x0c22('0x8'));var Campaign=require('../model/campaign');var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x0c22('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x0c22('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x0c22('0xb'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x0c22('0xc'));var Dynamics365Account=require(_0x0c22('0xd'));var FreshsalesAccount=require(_0x0c22('0xe'));var FaxAccount=require(_0x0c22('0xf'));var Realtime=function(){this[_0x0c22('0x10')]={};this['telephones']={};this[_0x0c22('0x11')]={};this[_0x0c22('0x12')]={};this['triggers']={};this[_0x0c22('0x13')]={};this[_0x0c22('0x14')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x0c22('0x15')]={};this[_0x0c22('0x16')]={};this[_0x0c22('0x17')]={};this['outboundChannels']={};this[_0x0c22('0x18')]={};this['settings']={};this['zendeskAccounts']={};this[_0x0c22('0x19')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0x0c22('0x1a')]={};this[_0x0c22('0x1b')]={};this[_0x0c22('0x1c')]={};this[_0x0c22('0x1d')]={};this[_0x0c22('0x1e')]={};this[_0x0c22('0x1f')]={};this[_0x0c22('0x20')]={};};function freeIsNotKey(_0x586776,_0x2ccf62,_0x240bcb){var _0x52e066=_[_0x0c22('0x21')](_0x586776,function(_0x4eae08,_0x3eb4fc){return _0x4eae08[_0x240bcb];});for(var _0x404537 in _0x2ccf62){if(_0x2ccf62['hasOwnProperty'](_0x404537)){if(!_0x52e066[_0x404537]){delete _0x2ccf62[_0x404537];}}}}function freeIsNotKeySip(_0x112aec,_0x2559fa){var _0x3326c9=_['mapKeys'](_0x112aec,function(_0x3d8c68,_0x4b4461){return util[_0x0c22('0x22')](_0x0c22('0x23'),_0x3d8c68[_0x0c22('0x24')]);});for(var _0x3d1485 in _0x2559fa){if(_0x2559fa['hasOwnProperty'](_0x3d1485)){if(!_0x3326c9[_0x3d1485]){delete _0x2559fa[_0x3d1485];}}}}function freeIsNotKeyAgent(_0x2b9726,_0x366347){var _0x4084a5=_[_0x0c22('0x21')](_0x2b9726,function(_0x209ebe,_0x314e5c){var _0x33ea0c=_['isNil'](_0x209ebe[_0x0c22('0x25')])?util[_0x0c22('0x22')]('SIP/%s',_0x209ebe['name']):_0x209ebe['interface'];return _0x33ea0c;});for(var _0x48ffb8 in _0x366347){if(_0x366347[_0x0c22('0x26')](_0x48ffb8)){if(!_0x4084a5[_0x48ffb8]){delete _0x366347[_0x48ffb8];}}}}function clearVoiceCallReports(_0x414656){_0x414656[_0x0c22('0x27')]=0x0;_0x414656[_0x0c22('0x28')]=0x0;_0x414656[_0x0c22('0x29')]=0x0;_0x414656[_0x0c22('0x2a')]=0x0;_0x414656[_0x0c22('0x2b')]=0x0;}function clearCampaigns(_0x560727){if(!_[_0x0c22('0x2c')](_0x560727)){for(var _0x4a3083 in _0x560727){if(_0x560727[_0x0c22('0x26')](_0x4a3083)){_0x560727[_0x4a3083][_0x0c22('0x2d')]=0x0;_0x560727[_0x4a3083]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x551b1f){if(!_['isEmpty'](_0x551b1f)){for(var _0x5edd1e in _0x551b1f){if(_0x551b1f['hasOwnProperty'](_0x5edd1e)){_0x551b1f[_0x5edd1e]['total']=0x0;_0x551b1f[_0x5edd1e][_0x0c22('0x28')]=0x0;_0x551b1f[_0x5edd1e]['unmanaged']=0x0;_0x551b1f[_0x5edd1e]['abandoned']=0x0;_0x551b1f[_0x5edd1e]['sumHoldTime']=0x0;_0x551b1f[_0x5edd1e][_0x0c22('0x2a')]=0x0;_0x551b1f[_0x5edd1e][_0x0c22('0x2b')]=0x0;_0x551b1f[_0x5edd1e][_0x0c22('0x2e')]=0x0;_0x551b1f[_0x5edd1e][_0x0c22('0x2f')]=0x0;_0x551b1f[_0x5edd1e][_0x0c22('0x30')]=0x0;_0x551b1f[_0x5edd1e][_0x0c22('0x31')]=0x0;_0x551b1f[_0x5edd1e][_0x0c22('0x32')]=0x0;_0x551b1f[_0x5edd1e][_0x0c22('0x33')]=0x0;_0x551b1f[_0x5edd1e]['outboundDropCallsDayTimeout']=0x0;_0x551b1f[_0x5edd1e]['outboundDropCallsDayCallersExit']=0x0;_0x551b1f[_0x5edd1e]['outboundBlacklistCallsDay']=0x0;_0x551b1f[_0x5edd1e][_0x0c22('0x34')]=0x0;_0x551b1f[_0x5edd1e]['outboundRejectCallsDay']=0x0;_0x551b1f[_0x5edd1e][_0x0c22('0x35')]=0x0;_0x551b1f[_0x5edd1e][_0x0c22('0x2e')]=0x0;_0x551b1f[_0x5edd1e][_0x0c22('0x36')]=0x0;_0x551b1f[_0x5edd1e]['queueStatusComplete']=!![];}}}}Realtime[_0x0c22('0x37')]['mergeFromDatabase']=function(_0x524bc2,_0x24d721){for(var _0x122b91 in _0x24d721){if(_0x524bc2['hasOwnProperty'](_0x122b91)){_0x524bc2[_0x122b91]=_0x24d721[_0x122b91];}}};Realtime[_0x0c22('0x37')][_0x0c22('0x38')]=function(){var _0xfa80c5=this;return function(_0x488d4c){if(_0x488d4c){freeIsNotKeyAgent(_0x488d4c,_0xfa80c5[_0x0c22('0x10')]);for(var _0x1632cd=0x0,_0x2d75c5={},_0x3765c2={};_0x1632cd<_0x488d4c[_0x0c22('0x39')];_0x1632cd+=0x1){_0x2d75c5=_0x488d4c[_0x1632cd];var _0x11bd49=_['isNil'](_0x2d75c5[_0x0c22('0x25')])?util[_0x0c22('0x22')]('SIP/%s',_0x2d75c5[_0x0c22('0x24')]):_0x2d75c5[_0x0c22('0x25')];if(_['isUndefined'](_0xfa80c5['agents'][_0x11bd49])){_0xfa80c5[_0x0c22('0x10')][_0x11bd49]=new Agent(_0x2d75c5);}else{_0xfa80c5[_0x0c22('0x3a')](_0xfa80c5[_0x0c22('0x10')][_0x11bd49],_0x2d75c5);}}}return _0xfa80c5[_0x0c22('0x10')];};};Realtime[_0x0c22('0x37')][_0x0c22('0x3b')]=function(){var _0x57ff0e=this;return function(_0x3b46de){if(_0x3b46de){freeIsNotKeySip(_0x3b46de,_0x57ff0e[_0x0c22('0x3c')]);for(var _0x325dcd=0x0,_0x497159={},_0x5da9d7={};_0x325dcd<_0x3b46de[_0x0c22('0x39')];_0x325dcd+=0x1){_0x497159=_0x3b46de[_0x325dcd];if(_[_0x0c22('0x3d')](_0x57ff0e['telephones'][util['format'](_0x0c22('0x23'),_0x497159[_0x0c22('0x24')])])){_0x57ff0e[_0x0c22('0x3c')][util[_0x0c22('0x22')](_0x0c22('0x23'),_0x497159[_0x0c22('0x24')])]=new Telephone(_0x497159);}else{_0x57ff0e[_0x0c22('0x3a')](_0x57ff0e[_0x0c22('0x3c')][util['format'](_0x0c22('0x23'),_0x497159['name'])],_0x497159);}}}return _0x57ff0e[_0x0c22('0x3c')];};};Realtime['prototype']['initTrunks']=function(){var _0x50a6ce=this;return function(_0x31a594){if(_0x31a594){freeIsNotKeySip(_0x31a594,_0x50a6ce['trunks']);for(var _0x2de1fc=0x0,_0xadfd2b={},_0x297464={};_0x2de1fc<_0x31a594[_0x0c22('0x39')];_0x2de1fc+=0x1){_0xadfd2b=_0x31a594[_0x2de1fc];if(_[_0x0c22('0x3d')](_0x50a6ce[_0x0c22('0x11')][util[_0x0c22('0x22')](_0x0c22('0x23'),_0xadfd2b[_0x0c22('0x24')])])){_0x50a6ce[_0x0c22('0x11')][util[_0x0c22('0x22')](_0x0c22('0x23'),_0xadfd2b[_0x0c22('0x24')])]=new Trunk(_0xadfd2b);}else{_0x50a6ce[_0x0c22('0x3a')](_0x50a6ce['trunks'][util['format'](_0x0c22('0x23'),_0xadfd2b[_0x0c22('0x24')])],_0xadfd2b);}}}return _0x50a6ce[_0x0c22('0x11')];};};Realtime[_0x0c22('0x37')][_0x0c22('0x3e')]=function(){var _0x254119=this;return function(_0xcf0d2f){if(_0xcf0d2f){freeIsNotKey(_0xcf0d2f,_0x254119['voiceQueues'],_0x0c22('0x24'));for(var _0x2d179a=0x0,_0x373e28={},_0x4a1c40={};_0x2d179a<_0xcf0d2f[_0x0c22('0x39')];_0x2d179a+=0x1){_0x373e28=_0xcf0d2f[_0x2d179a];if(_['isUndefined'](_0x254119[_0x0c22('0x12')][_0x373e28[_0x0c22('0x24')]])){_0x254119[_0x0c22('0x12')][_0x373e28['name']]=new VoiceQueue(_0x373e28);}else{_0x254119[_0x0c22('0x3a')](_0x254119[_0x0c22('0x12')][_0x373e28[_0x0c22('0x24')]],_0x373e28);}}}return _0x254119['voiceQueues'];};};Realtime[_0x0c22('0x37')]['initTriggers']=function(){var _0x251a15=this;return function(_0x111459){if(_0x111459){freeIsNotKey(_0x111459,_0x251a15[_0x0c22('0x3f')],'id');for(var _0x218df1=0x0,_0x20a357={},_0x5e2e67={};_0x218df1<_0x111459['length'];_0x218df1+=0x1){_0x20a357=_0x111459[_0x218df1];if(_['isUndefined'](_0x251a15[_0x0c22('0x3f')][_0x20a357['id']])){_0x251a15[_0x0c22('0x3f')][_0x20a357['id']]=new Trigger(_0x20a357);}else{_0x251a15[_0x0c22('0x3a')](_0x251a15['triggers'][_0x20a357['id']],_0x20a357);}}}return _0x251a15[_0x0c22('0x3f')];};};Realtime[_0x0c22('0x37')][_0x0c22('0x40')]=function(){var _0x1b3ef1=this;return function(_0x4a677d){if(_0x4a677d){freeIsNotKey(_0x4a677d,_0x1b3ef1[_0x0c22('0x14')],'id');for(var _0x31bba6=0x0,_0x972371={},_0x1e7136={};_0x31bba6<_0x4a677d[_0x0c22('0x39')];_0x31bba6+=0x1){_0x972371=_0x4a677d[_0x31bba6];if(_[_0x0c22('0x3d')](_0x1b3ef1[_0x0c22('0x14')][_0x972371['id']])){_0x1b3ef1[_0x0c22('0x14')][_0x972371['id']]=new Template(_0x972371);}else{_0x1b3ef1[_0x0c22('0x3a')](_0x1b3ef1[_0x0c22('0x14')][_0x972371['id']],_0x972371);}}}return _0x1b3ef1[_0x0c22('0x14')];};};Realtime[_0x0c22('0x37')][_0x0c22('0x41')]=function(){var _0x4d8805=this;return function(_0x37e62a){if(_0x37e62a){freeIsNotKey(_0x37e62a,_0x4d8805['zendeskAccounts'],'id');for(var _0x8eb89a=0x0,_0x226b0b={},_0x51e297={};_0x8eb89a<_0x37e62a[_0x0c22('0x39')];_0x8eb89a+=0x1){_0x226b0b=_0x37e62a[_0x8eb89a];if(_[_0x0c22('0x3d')](_0x4d8805[_0x0c22('0x42')][_0x226b0b['id']])){_0x4d8805[_0x0c22('0x42')][_0x226b0b['id']]=new ZendeskAccount(_0x226b0b);}else{_0x4d8805[_0x0c22('0x3a')](_0x4d8805[_0x0c22('0x42')][_0x226b0b['id']],_0x226b0b);}}}return _0x4d8805[_0x0c22('0x42')];};};Realtime['prototype'][_0x0c22('0x43')]=function(){var _0x1c1c38=this;return function(_0x7c1239){if(_0x7c1239){freeIsNotKey(_0x7c1239,_0x1c1c38[_0x0c22('0x19')],'id');for(var _0x2f3913=0x0,_0x58a6c8={},_0x233285={};_0x2f3913<_0x7c1239[_0x0c22('0x39')];_0x2f3913+=0x1){_0x58a6c8=_0x7c1239[_0x2f3913];if(_[_0x0c22('0x3d')](_0x1c1c38[_0x0c22('0x19')][_0x58a6c8['id']])){_0x1c1c38['salesforceAccounts'][_0x58a6c8['id']]=new SalesforceAccount(_0x58a6c8);}else{_0x1c1c38[_0x0c22('0x3a')](_0x1c1c38[_0x0c22('0x19')][_0x58a6c8['id']],_0x58a6c8);}}}return _0x1c1c38[_0x0c22('0x19')];};};Realtime[_0x0c22('0x37')]['initFreshdeskAccounts']=function(){var _0x2c85fb=this;return function(_0x3733c8){if(_0x3733c8){freeIsNotKey(_0x3733c8,_0x2c85fb[_0x0c22('0x44')],'id');for(var _0x233245=0x0,_0xb2d915={},_0x475ff3={};_0x233245<_0x3733c8[_0x0c22('0x39')];_0x233245+=0x1){_0xb2d915=_0x3733c8[_0x233245];if(_[_0x0c22('0x3d')](_0x2c85fb[_0x0c22('0x44')][_0xb2d915['id']])){_0x2c85fb[_0x0c22('0x44')][_0xb2d915['id']]=new FreshdeskAccount(_0xb2d915);}else{_0x2c85fb['mergeFromDatabase'](_0x2c85fb['freshdeskAccounts'][_0xb2d915['id']],_0xb2d915);}}}return _0x2c85fb['freshdeskAccounts'];};};Realtime[_0x0c22('0x37')][_0x0c22('0x45')]=function(){var _0x69dd86=this;return function(_0x2cfdb3){if(_0x2cfdb3){freeIsNotKey(_0x2cfdb3,_0x69dd86[_0x0c22('0x1a')],'id');for(var _0x53abb0=0x0,_0x1eff21={},_0x4d14b2={};_0x53abb0<_0x2cfdb3['length'];_0x53abb0+=0x1){_0x1eff21=_0x2cfdb3[_0x53abb0];if(_[_0x0c22('0x3d')](_0x69dd86[_0x0c22('0x1a')][_0x1eff21['id']])){_0x69dd86[_0x0c22('0x1a')][_0x1eff21['id']]=new ZohoAccount(_0x1eff21);}else{_0x69dd86[_0x0c22('0x3a')](_0x69dd86[_0x0c22('0x1a')][_0x1eff21['id']],_0x1eff21);}}}return _0x69dd86[_0x0c22('0x1a')];};};Realtime[_0x0c22('0x37')][_0x0c22('0x46')]=function(){var _0x51108a=this;return function(_0x5b0b24){if(_0x5b0b24){freeIsNotKey(_0x5b0b24,_0x51108a[_0x0c22('0x1b')],'id');for(var _0x1709ca=0x0,_0xb222e9={},_0x38e53d={};_0x1709ca<_0x5b0b24['length'];_0x1709ca+=0x1){_0xb222e9=_0x5b0b24[_0x1709ca];if(_[_0x0c22('0x3d')](_0x51108a[_0x0c22('0x1b')][_0xb222e9['id']])){_0x51108a['deskAccounts'][_0xb222e9['id']]=new DeskAccount(_0xb222e9);}else{_0x51108a[_0x0c22('0x3a')](_0x51108a[_0x0c22('0x1b')][_0xb222e9['id']],_0xb222e9);}}}return _0x51108a[_0x0c22('0x1b')];};};Realtime[_0x0c22('0x37')][_0x0c22('0x47')]=function(){var _0x28fe5d=this;return function(_0x364a5d){if(_0x364a5d){freeIsNotKey(_0x364a5d,_0x28fe5d[_0x0c22('0x48')],'id');for(var _0x4682f7=0x0,_0x33b26a={},_0x5df7e5={};_0x4682f7<_0x364a5d[_0x0c22('0x39')];_0x4682f7+=0x1){_0x33b26a=_0x364a5d[_0x4682f7];if(_[_0x0c22('0x3d')](_0x28fe5d[_0x0c22('0x48')][_0x33b26a['id']])){_0x28fe5d[_0x0c22('0x48')][_0x33b26a['id']]=new SugarcrmAccount(_0x33b26a);}else{_0x28fe5d[_0x0c22('0x3a')](_0x28fe5d['sugarcrmAccounts'][_0x33b26a['id']],_0x33b26a);}}}return _0x28fe5d[_0x0c22('0x48')];};};Realtime[_0x0c22('0x37')][_0x0c22('0x49')]=function(){var _0x19f214=this;return function(_0x422b04){if(_0x422b04){freeIsNotKey(_0x422b04,_0x19f214[_0x0c22('0x1c')],'id');for(var _0x11adea=0x0,_0x398d2a={},_0x77a96a={};_0x11adea<_0x422b04[_0x0c22('0x39')];_0x11adea+=0x1){_0x398d2a=_0x422b04[_0x11adea];if(_[_0x0c22('0x3d')](_0x19f214[_0x0c22('0x1c')][_0x398d2a['id']])){_0x19f214[_0x0c22('0x1c')][_0x398d2a['id']]=new VtigerAccount(_0x398d2a);}else{_0x19f214[_0x0c22('0x3a')](_0x19f214['vtigerAccounts'][_0x398d2a['id']],_0x398d2a);}}}return _0x19f214[_0x0c22('0x1c')];};};Realtime[_0x0c22('0x37')][_0x0c22('0x4a')]=function(){var _0x148a5b=this;return function(_0x1f0f77){if(_0x1f0f77){freeIsNotKey(_0x1f0f77,_0x148a5b['servicenowAccounts'],'id');for(var _0x7d638=0x0,_0xd7b860={},_0x4479a2={};_0x7d638<_0x1f0f77[_0x0c22('0x39')];_0x7d638+=0x1){_0xd7b860=_0x1f0f77[_0x7d638];if(_[_0x0c22('0x3d')](_0x148a5b[_0x0c22('0x1d')][_0xd7b860['id']])){_0x148a5b['servicenowAccounts'][_0xd7b860['id']]=new ServicenowAccount(_0xd7b860);}else{_0x148a5b[_0x0c22('0x3a')](_0x148a5b[_0x0c22('0x1d')][_0xd7b860['id']],_0xd7b860);}}}return _0x148a5b[_0x0c22('0x1d')];};};Realtime[_0x0c22('0x37')][_0x0c22('0x4b')]=function(){var _0xe36f67=this;return function(_0x51ea67){if(_0x51ea67){freeIsNotKey(_0x51ea67,_0xe36f67[_0x0c22('0x1e')],'id');for(var _0x194da4=0x0,_0x5af3ab={},_0x134cc7={};_0x194da4<_0x51ea67[_0x0c22('0x39')];_0x194da4+=0x1){_0x5af3ab=_0x51ea67[_0x194da4];if(_[_0x0c22('0x3d')](_0xe36f67[_0x0c22('0x1e')][_0x5af3ab['id']])){_0xe36f67[_0x0c22('0x1e')][_0x5af3ab['id']]=new Dynamics365Account(_0x5af3ab);}else{_0xe36f67[_0x0c22('0x3a')](_0xe36f67[_0x0c22('0x1e')][_0x5af3ab['id']],_0x5af3ab);}}}return _0xe36f67[_0x0c22('0x1e')];};};Realtime[_0x0c22('0x37')]['initFreshsalesAccounts']=function(){var _0x219333=this;return function(_0x9788b7){if(_0x9788b7){freeIsNotKey(_0x9788b7,_0x219333[_0x0c22('0x1f')],'id');for(var _0x4ad40a=0x0,_0xce1f0={},_0x22fa3b={};_0x4ad40a<_0x9788b7[_0x0c22('0x39')];_0x4ad40a+=0x1){_0xce1f0=_0x9788b7[_0x4ad40a];if(_[_0x0c22('0x3d')](_0x219333[_0x0c22('0x1f')][_0xce1f0['id']])){_0x219333[_0x0c22('0x1f')][_0xce1f0['id']]=new FreshsalesAccount(_0xce1f0);}else{_0x219333['mergeFromDatabase'](_0x219333['freshsalesAccounts'][_0xce1f0['id']],_0xce1f0);}}}return _0x219333[_0x0c22('0x1f')];};};Realtime[_0x0c22('0x37')][_0x0c22('0x4c')]=function(){var _0x490e88=this;return function(_0x12a89d){for(var _0x41d190=0x0;_0x41d190<_0x12a89d[_0x0c22('0x39')];_0x41d190+=0x1){_[_0x0c22('0x4d')](_0x490e88[_0x0c22('0x12')][_0x12a89d[_0x41d190][_0x0c22('0x24')]],_0x12a89d[_0x41d190]);}return _0x490e88['voiceQueues'];};};Realtime['prototype'][_0x0c22('0x4e')]=function(){var _0x4763a6=this;return function(_0x1d05ef){clearVoiceQueues(_0x4763a6['voiceQueues']);if(_0x1d05ef){_0x1d05ef=_['groupBy'](_0x1d05ef,_0x0c22('0x4f'));for(var _0x582344 in _0x1d05ef){if(_0x1d05ef[_0x0c22('0x26')](_0x582344)){var _0x658906={};for(var _0x29aa95=0x0;_0x29aa95<_0x1d05ef[_0x582344][_0x0c22('0x39')];_0x29aa95+=0x1){var _0x1b7ad9=_0x1d05ef[_0x582344][_0x29aa95]['queue'];if(_0x4763a6[_0x0c22('0x12')][_0x1b7ad9]){if(_0x1d05ef[_0x582344][_0x29aa95]['queuecallerexit']){_0x4763a6[_0x0c22('0x12')][_0x1b7ad9][_0x0c22('0x50')]+=0x1;}if(_0x1d05ef[_0x582344][_0x29aa95][_0x0c22('0x51')]){_0x4763a6[_0x0c22('0x12')][_0x1b7ad9][_0x0c22('0x52')]+=0x1;}_0x4763a6[_0x0c22('0x12')][_0x1b7ad9][_0x0c22('0x29')]+=moment(_0x1d05ef[_0x582344][_0x29aa95][_0x0c22('0x53')])[_0x0c22('0x54')](moment(_0x1d05ef[_0x582344][_0x29aa95][_0x0c22('0x55')]),_0x0c22('0x56'))||0x0;if(_0x29aa95===_0x1d05ef[_0x582344][_0x0c22('0x39')]-0x1){_0x4763a6[_0x0c22('0x12')][_0x1b7ad9]['sumDuration']+=moment(_0x1d05ef[_0x582344][_0x29aa95][_0x0c22('0x57')]||_0x1d05ef[_0x582344][_0x29aa95][_0x0c22('0x58')]||_0x1d05ef[_0x582344][_0x29aa95][_0x0c22('0x59')])[_0x0c22('0x54')](moment(_0x1d05ef[_0x582344][_0x29aa95]['queuecallerjoinAt']),_0x0c22('0x56'))||0x0;_0x4763a6[_0x0c22('0x12')][_0x1b7ad9][_0x0c22('0x27')]+=0x1;if(_0x1d05ef[_0x582344][_0x29aa95][_0x0c22('0x5a')]){_0x4763a6[_0x0c22('0x12')][_0x1b7ad9][_0x0c22('0x28')]+=0x1;_0x4763a6[_0x0c22('0x12')][_0x1b7ad9][_0x0c22('0x2b')]+=moment(_0x1d05ef[_0x582344][_0x29aa95][_0x0c22('0x57')])[_0x0c22('0x54')](moment(_0x1d05ef[_0x582344][_0x29aa95][_0x0c22('0x53')]),_0x0c22('0x56'))||0x0;}}else{_0x4763a6[_0x0c22('0x12')][_0x1b7ad9][_0x0c22('0x2a')]+=_0x4763a6[_0x0c22('0x12')][_0x1b7ad9][_0x0c22('0x29')]||0x0;}}}}}}return _0x4763a6[_0x0c22('0x12')];};};Realtime[_0x0c22('0x37')]['initVoiceCallReports']=function(){var _0x482145=this;return function(_0x229d78){clearVoiceCallReports(_0x482145[_0x0c22('0x5b')]);if(_0x229d78){for(var _0xea7848=0x0;_0xea7848<_0x229d78[_0x0c22('0x39')];_0xea7848+=0x1){_0x482145[_0x0c22('0x5b')][_0x0c22('0x27')]+=0x1;_0x482145[_0x0c22('0x5b')][_0x0c22('0x2a')]+=_0x229d78[_0xea7848][_0x0c22('0x5c')];if(_0x229d78[_0xea7848][_0x0c22('0x5d')]===_0x0c22('0x5e')){_0x482145['outbound'][_0x0c22('0x28')]+=0x1;_0x482145[_0x0c22('0x5b')][_0x0c22('0x29')]+=_0x229d78[_0xea7848][_0x0c22('0x5c')]-_0x229d78[_0xea7848][_0x0c22('0x5f')]||0x0;_0x482145[_0x0c22('0x5b')][_0x0c22('0x2b')]+=_0x229d78[_0xea7848]['billableseconds'];}}}return _0x482145[_0x0c22('0x5b')];};};Realtime['prototype']['initCampaigns']=function(){var _0x1df1ee=this;return function(_0x3a7497){if(_0x3a7497){freeIsNotKey(_0x3a7497,_0x1df1ee[_0x0c22('0x13')],'name');for(var _0x47ecb8=0x0,_0x219c2e={};_0x47ecb8<_0x3a7497[_0x0c22('0x39')];_0x47ecb8+=0x1){_0x219c2e=_0x3a7497[_0x47ecb8];if(_[_0x0c22('0x3d')](_0x1df1ee['campaigns'][_0x219c2e[_0x0c22('0x24')]])){_0x1df1ee['campaigns'][_0x219c2e['name']]=new Campaign(_0x219c2e);}else{_0x1df1ee[_0x0c22('0x3a')](_0x1df1ee[_0x0c22('0x13')][_0x219c2e[_0x0c22('0x24')]],_0x219c2e);_0x1df1ee['campaigns'][_0x219c2e[_0x0c22('0x24')]][_0x0c22('0x60')]=_0x219c2e[_0x0c22('0x61')]?_0x219c2e[_0x0c22('0x61')][_0x0c22('0x24')]:undefined;}}}return _0x1df1ee[_0x0c22('0x13')];};};Realtime[_0x0c22('0x37')][_0x0c22('0x62')]=function(){var _0x97de5=this;return function(_0x2546e2){if(_0x2546e2){freeIsNotKey(_0x2546e2,_0x97de5[_0x0c22('0x15')],'id');for(var _0x932ff3=0x0,_0x27face={};_0x932ff3<_0x2546e2[_0x0c22('0x39')];_0x932ff3+=0x1){_0x27face=_0x2546e2[_0x932ff3];if(_['isUndefined'](_0x97de5[_0x0c22('0x15')][_0x27face['id']])){_0x97de5[_0x0c22('0x15')][_0x27face['id']]=new VoiceExtension(_0x27face);}else{_0x97de5[_0x0c22('0x3a')](_0x97de5['voiceExtensions'][_0x27face['id']],_0x27face);}}}return _0x97de5[_0x0c22('0x15')];};};Realtime[_0x0c22('0x37')][_0x0c22('0x63')]=function(){var _0x583330=this;return function(_0x34d9e8){clearCampaigns(_0x583330['campaigns']);for(var _0xbd60b5=0x0;_0xbd60b5<_0x34d9e8[_0x0c22('0x39')];_0xbd60b5+=0x1){_[_0x0c22('0x4d')](_0x583330[_0x0c22('0x13')][_0x34d9e8[_0xbd60b5][_0x0c22('0x24')]],_0x34d9e8[_0xbd60b5]);}return _0x583330[_0x0c22('0x13')];};};Realtime['prototype'][_0x0c22('0x64')]=function(){var _0x55a75c=this;return function(_0x307508){if(_0x307508){freeIsNotKey(_0x307508,_0x55a75c[_0x0c22('0x20')],'id');for(var _0x4a9764=0x0,_0x766e6e={},_0x931291={};_0x4a9764<_0x307508['length'];_0x4a9764+=0x1){_0x766e6e=_0x307508[_0x4a9764];if(_[_0x0c22('0x3d')](_0x55a75c[_0x0c22('0x20')][_0x766e6e['id']])){_0x55a75c[_0x0c22('0x20')][_0x766e6e['id']]=new FaxAccount(_0x766e6e);}else{_0x55a75c[_0x0c22('0x3a')](_0x55a75c[_0x0c22('0x20')][_0x766e6e['id']],_0x766e6e);}}}return _0x55a75c['faxAccounts'];};};module[_0x0c22('0x65')]=Realtime; \ No newline at end of file +var _0x9d5a=['queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initFaxAccounts','faxAccounts','bluebird','util','moment','../model/agent','../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/deskAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','SIP/%s','name','hasOwnProperty','mapKeys','isNil','interface','format','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTrunks','initVoiceQueues','initTriggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','queue','queuecallerexit'];(function(_0x279b47,_0x498ac7){var _0x1dd61a=function(_0xc56463){while(--_0xc56463){_0x279b47['push'](_0x279b47['shift']());}};_0x1dd61a(++_0x498ac7);}(_0x9d5a,0x7f));var _0xa9d5=function(_0x2b26c5,_0x547bea){_0x2b26c5=_0x2b26c5-0x0;var _0xfc7f7f=_0x9d5a[_0x2b26c5];return _0xfc7f7f;};'use strict';var BPromise=require(_0xa9d5('0x0'));var util=require(_0xa9d5('0x1'));var _=require('lodash');var moment=require(_0xa9d5('0x2'));var Agent=require(_0xa9d5('0x3'));var Telephone=require(_0xa9d5('0x4'));var Trunk=require(_0xa9d5('0x5'));var VoiceQueue=require(_0xa9d5('0x6'));var Trigger=require(_0xa9d5('0x7'));var Template=require(_0xa9d5('0x8'));var Campaign=require(_0xa9d5('0x9'));var VoiceExtension=require(_0xa9d5('0xa'));var ZendeskAccount=require(_0xa9d5('0xb'));var SalesforceAccount=require(_0xa9d5('0xc'));var FreshdeskAccount=require(_0xa9d5('0xd'));var SugarcrmAccount=require(_0xa9d5('0xe'));var ZohoAccount=require(_0xa9d5('0xf'));var DeskAccount=require(_0xa9d5('0x10'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xa9d5('0x11'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xa9d5('0x12'));var FaxAccount=require(_0xa9d5('0x13'));var Realtime=function(){this[_0xa9d5('0x14')]={};this[_0xa9d5('0x15')]={};this[_0xa9d5('0x16')]={};this[_0xa9d5('0x17')]={};this[_0xa9d5('0x18')]={};this['campaigns']={};this[_0xa9d5('0x19')]={};this[_0xa9d5('0x1a')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xa9d5('0x1b')]={};this[_0xa9d5('0x1c')]={};this[_0xa9d5('0x1d')]={};this[_0xa9d5('0x1e')]={};this[_0xa9d5('0x1f')]={};this[_0xa9d5('0x20')]={};this[_0xa9d5('0x21')]={};this[_0xa9d5('0x22')]={};this['sugarcrmAccounts']={};this[_0xa9d5('0x23')]={};this['zohoAccounts']={};this[_0xa9d5('0x24')]={};this[_0xa9d5('0x25')]={};this[_0xa9d5('0x26')]={};this[_0xa9d5('0x27')]={};this[_0xa9d5('0x28')]={};this['faxAccounts']={};};function freeIsNotKey(_0x43a1f4,_0x594207,_0x4c482b){var _0x391c78=_['mapKeys'](_0x43a1f4,function(_0x57519c,_0x302c9b){return _0x57519c[_0x4c482b];});for(var _0x2f6823 in _0x594207){if(_0x594207['hasOwnProperty'](_0x2f6823)){if(!_0x391c78[_0x2f6823]){delete _0x594207[_0x2f6823];}}}}function freeIsNotKeySip(_0x3655ed,_0x26acaa){var _0x451486=_['mapKeys'](_0x3655ed,function(_0x258ae9,_0x567fde){return util['format'](_0xa9d5('0x29'),_0x258ae9[_0xa9d5('0x2a')]);});for(var _0x878612 in _0x26acaa){if(_0x26acaa[_0xa9d5('0x2b')](_0x878612)){if(!_0x451486[_0x878612]){delete _0x26acaa[_0x878612];}}}}function freeIsNotKeyAgent(_0x407778,_0x296a7f){var _0x37e6fe=_[_0xa9d5('0x2c')](_0x407778,function(_0x570897,_0x2bc0f2){var _0x400882=_[_0xa9d5('0x2d')](_0x570897[_0xa9d5('0x2e')])?util[_0xa9d5('0x2f')]('SIP/%s',_0x570897[_0xa9d5('0x2a')]):_0x570897['interface'];return _0x400882;});for(var _0x2b88b4 in _0x296a7f){if(_0x296a7f[_0xa9d5('0x2b')](_0x2b88b4)){if(!_0x37e6fe[_0x2b88b4]){delete _0x296a7f[_0x2b88b4];}}}}function clearVoiceCallReports(_0x202a98){_0x202a98[_0xa9d5('0x30')]=0x0;_0x202a98[_0xa9d5('0x31')]=0x0;_0x202a98[_0xa9d5('0x32')]=0x0;_0x202a98[_0xa9d5('0x33')]=0x0;_0x202a98[_0xa9d5('0x34')]=0x0;}function clearCampaigns(_0x14df13){if(!_['isEmpty'](_0x14df13)){for(var _0x33f7b6 in _0x14df13){if(_0x14df13['hasOwnProperty'](_0x33f7b6)){_0x14df13[_0x33f7b6][_0xa9d5('0x35')]=0x0;_0x14df13[_0x33f7b6][_0xa9d5('0x36')]=0x0;}}}}function clearVoiceQueues(_0x4285f1){if(!_[_0xa9d5('0x37')](_0x4285f1)){for(var _0x2e272e in _0x4285f1){if(_0x4285f1['hasOwnProperty'](_0x2e272e)){_0x4285f1[_0x2e272e]['total']=0x0;_0x4285f1[_0x2e272e][_0xa9d5('0x31')]=0x0;_0x4285f1[_0x2e272e][_0xa9d5('0x38')]=0x0;_0x4285f1[_0x2e272e][_0xa9d5('0x39')]=0x0;_0x4285f1[_0x2e272e]['sumHoldTime']=0x0;_0x4285f1[_0x2e272e][_0xa9d5('0x33')]=0x0;_0x4285f1[_0x2e272e]['sumBillable']=0x0;_0x4285f1[_0x2e272e][_0xa9d5('0x3a')]=0x0;_0x4285f1[_0x2e272e][_0xa9d5('0x3b')]=0x0;_0x4285f1[_0x2e272e]['outboundBusyCallsDay']=0x0;_0x4285f1[_0x2e272e][_0xa9d5('0x3c')]=0x0;_0x4285f1[_0x2e272e]['outboundNoSuchCallsDay']=0x0;_0x4285f1[_0x2e272e][_0xa9d5('0x3d')]=0x0;_0x4285f1[_0x2e272e][_0xa9d5('0x3e')]=0x0;_0x4285f1[_0x2e272e][_0xa9d5('0x3f')]=0x0;_0x4285f1[_0x2e272e][_0xa9d5('0x40')]=0x0;_0x4285f1[_0x2e272e]['outboundOriginateFailureCallsDay']=0x0;_0x4285f1[_0x2e272e]['outboundRejectCallsDay']=0x0;_0x4285f1[_0x2e272e]['outboundReCallsDay']=0x0;_0x4285f1[_0x2e272e][_0xa9d5('0x3a')]=0x0;_0x4285f1[_0x2e272e][_0xa9d5('0x41')]=0x0;_0x4285f1[_0x2e272e][_0xa9d5('0x42')]=!![];}}}}Realtime[_0xa9d5('0x43')][_0xa9d5('0x44')]=function(_0x2254d1,_0x30e047){for(var _0x5d332e in _0x30e047){if(_0x2254d1[_0xa9d5('0x2b')](_0x5d332e)){_0x2254d1[_0x5d332e]=_0x30e047[_0x5d332e];}}};Realtime[_0xa9d5('0x43')][_0xa9d5('0x45')]=function(){var _0x27d0de=this;return function(_0x10101f){if(_0x10101f){freeIsNotKeyAgent(_0x10101f,_0x27d0de[_0xa9d5('0x14')]);for(var _0x4b83e6=0x0,_0x184e80={},_0x3dd6df={};_0x4b83e6<_0x10101f[_0xa9d5('0x46')];_0x4b83e6+=0x1){_0x184e80=_0x10101f[_0x4b83e6];var _0x130c19=_[_0xa9d5('0x2d')](_0x184e80[_0xa9d5('0x2e')])?util[_0xa9d5('0x2f')](_0xa9d5('0x29'),_0x184e80[_0xa9d5('0x2a')]):_0x184e80[_0xa9d5('0x2e')];if(_[_0xa9d5('0x47')](_0x27d0de[_0xa9d5('0x14')][_0x130c19])){_0x27d0de['agents'][_0x130c19]=new Agent(_0x184e80);}else{_0x27d0de[_0xa9d5('0x44')](_0x27d0de[_0xa9d5('0x14')][_0x130c19],_0x184e80);}}}return _0x27d0de[_0xa9d5('0x14')];};};Realtime['prototype']['initTelephones']=function(){var _0x47becf=this;return function(_0x167f7d){if(_0x167f7d){freeIsNotKeySip(_0x167f7d,_0x47becf[_0xa9d5('0x15')]);for(var _0x3f4331=0x0,_0x40b205={},_0x59a29c={};_0x3f4331<_0x167f7d[_0xa9d5('0x46')];_0x3f4331+=0x1){_0x40b205=_0x167f7d[_0x3f4331];if(_[_0xa9d5('0x47')](_0x47becf[_0xa9d5('0x15')][util[_0xa9d5('0x2f')](_0xa9d5('0x29'),_0x40b205['name'])])){_0x47becf[_0xa9d5('0x15')][util[_0xa9d5('0x2f')]('SIP/%s',_0x40b205[_0xa9d5('0x2a')])]=new Telephone(_0x40b205);}else{_0x47becf[_0xa9d5('0x44')](_0x47becf['telephones'][util[_0xa9d5('0x2f')]('SIP/%s',_0x40b205[_0xa9d5('0x2a')])],_0x40b205);}}}return _0x47becf['telephones'];};};Realtime[_0xa9d5('0x43')][_0xa9d5('0x48')]=function(){var _0x1acbcb=this;return function(_0x3653a7){if(_0x3653a7){freeIsNotKeySip(_0x3653a7,_0x1acbcb[_0xa9d5('0x16')]);for(var _0x5baeee=0x0,_0x24867c={},_0x7712f2={};_0x5baeee<_0x3653a7[_0xa9d5('0x46')];_0x5baeee+=0x1){_0x24867c=_0x3653a7[_0x5baeee];if(_[_0xa9d5('0x47')](_0x1acbcb[_0xa9d5('0x16')][util[_0xa9d5('0x2f')](_0xa9d5('0x29'),_0x24867c[_0xa9d5('0x2a')])])){_0x1acbcb[_0xa9d5('0x16')][util['format'](_0xa9d5('0x29'),_0x24867c[_0xa9d5('0x2a')])]=new Trunk(_0x24867c);}else{_0x1acbcb[_0xa9d5('0x44')](_0x1acbcb['trunks'][util[_0xa9d5('0x2f')]('SIP/%s',_0x24867c[_0xa9d5('0x2a')])],_0x24867c);}}}return _0x1acbcb[_0xa9d5('0x16')];};};Realtime[_0xa9d5('0x43')][_0xa9d5('0x49')]=function(){var _0x67148e=this;return function(_0x3459af){if(_0x3459af){freeIsNotKey(_0x3459af,_0x67148e[_0xa9d5('0x17')],_0xa9d5('0x2a'));for(var _0x39dbe8=0x0,_0x581d39={},_0x46dea5={};_0x39dbe8<_0x3459af[_0xa9d5('0x46')];_0x39dbe8+=0x1){_0x581d39=_0x3459af[_0x39dbe8];if(_[_0xa9d5('0x47')](_0x67148e[_0xa9d5('0x17')][_0x581d39[_0xa9d5('0x2a')]])){_0x67148e[_0xa9d5('0x17')][_0x581d39[_0xa9d5('0x2a')]]=new VoiceQueue(_0x581d39);}else{_0x67148e['mergeFromDatabase'](_0x67148e[_0xa9d5('0x17')][_0x581d39[_0xa9d5('0x2a')]],_0x581d39);}}}return _0x67148e[_0xa9d5('0x17')];};};Realtime[_0xa9d5('0x43')][_0xa9d5('0x4a')]=function(){var _0x49569e=this;return function(_0x5dbfa5){if(_0x5dbfa5){freeIsNotKey(_0x5dbfa5,_0x49569e[_0xa9d5('0x18')],'id');for(var _0x54411c=0x0,_0x390da6={},_0x12eab0={};_0x54411c<_0x5dbfa5[_0xa9d5('0x46')];_0x54411c+=0x1){_0x390da6=_0x5dbfa5[_0x54411c];if(_[_0xa9d5('0x47')](_0x49569e[_0xa9d5('0x18')][_0x390da6['id']])){_0x49569e['triggers'][_0x390da6['id']]=new Trigger(_0x390da6);}else{_0x49569e['mergeFromDatabase'](_0x49569e[_0xa9d5('0x18')][_0x390da6['id']],_0x390da6);}}}return _0x49569e['triggers'];};};Realtime[_0xa9d5('0x43')][_0xa9d5('0x4b')]=function(){var _0x1babaf=this;return function(_0x45fee1){if(_0x45fee1){freeIsNotKey(_0x45fee1,_0x1babaf[_0xa9d5('0x19')],'id');for(var _0x5f4d31=0x0,_0x358bfd={},_0x53dd14={};_0x5f4d31<_0x45fee1['length'];_0x5f4d31+=0x1){_0x358bfd=_0x45fee1[_0x5f4d31];if(_['isUndefined'](_0x1babaf[_0xa9d5('0x19')][_0x358bfd['id']])){_0x1babaf['templates'][_0x358bfd['id']]=new Template(_0x358bfd);}else{_0x1babaf['mergeFromDatabase'](_0x1babaf['templates'][_0x358bfd['id']],_0x358bfd);}}}return _0x1babaf['templates'];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x53ee52=this;return function(_0x56692c){if(_0x56692c){freeIsNotKey(_0x56692c,_0x53ee52[_0xa9d5('0x21')],'id');for(var _0x49ec4a=0x0,_0x17b06e={},_0xdbf2d4={};_0x49ec4a<_0x56692c[_0xa9d5('0x46')];_0x49ec4a+=0x1){_0x17b06e=_0x56692c[_0x49ec4a];if(_[_0xa9d5('0x47')](_0x53ee52[_0xa9d5('0x21')][_0x17b06e['id']])){_0x53ee52[_0xa9d5('0x21')][_0x17b06e['id']]=new ZendeskAccount(_0x17b06e);}else{_0x53ee52[_0xa9d5('0x44')](_0x53ee52['zendeskAccounts'][_0x17b06e['id']],_0x17b06e);}}}return _0x53ee52['zendeskAccounts'];};};Realtime[_0xa9d5('0x43')][_0xa9d5('0x4c')]=function(){var _0x46c8f6=this;return function(_0x4ce1d2){if(_0x4ce1d2){freeIsNotKey(_0x4ce1d2,_0x46c8f6['salesforceAccounts'],'id');for(var _0x7d1ffd=0x0,_0x443d96={},_0x2bc4b8={};_0x7d1ffd<_0x4ce1d2[_0xa9d5('0x46')];_0x7d1ffd+=0x1){_0x443d96=_0x4ce1d2[_0x7d1ffd];if(_[_0xa9d5('0x47')](_0x46c8f6[_0xa9d5('0x22')][_0x443d96['id']])){_0x46c8f6['salesforceAccounts'][_0x443d96['id']]=new SalesforceAccount(_0x443d96);}else{_0x46c8f6[_0xa9d5('0x44')](_0x46c8f6[_0xa9d5('0x22')][_0x443d96['id']],_0x443d96);}}}return _0x46c8f6[_0xa9d5('0x22')];};};Realtime[_0xa9d5('0x43')][_0xa9d5('0x4d')]=function(){var _0x563524=this;return function(_0x507441){if(_0x507441){freeIsNotKey(_0x507441,_0x563524[_0xa9d5('0x23')],'id');for(var _0x3aa0c3=0x0,_0x199138={},_0x15015d={};_0x3aa0c3<_0x507441['length'];_0x3aa0c3+=0x1){_0x199138=_0x507441[_0x3aa0c3];if(_[_0xa9d5('0x47')](_0x563524['freshdeskAccounts'][_0x199138['id']])){_0x563524[_0xa9d5('0x23')][_0x199138['id']]=new FreshdeskAccount(_0x199138);}else{_0x563524['mergeFromDatabase'](_0x563524[_0xa9d5('0x23')][_0x199138['id']],_0x199138);}}}return _0x563524[_0xa9d5('0x23')];};};Realtime[_0xa9d5('0x43')][_0xa9d5('0x4e')]=function(){var _0x2a80c2=this;return function(_0x5ea825){if(_0x5ea825){freeIsNotKey(_0x5ea825,_0x2a80c2['zohoAccounts'],'id');for(var _0x442652=0x0,_0x2c70f8={},_0xb6993c={};_0x442652<_0x5ea825[_0xa9d5('0x46')];_0x442652+=0x1){_0x2c70f8=_0x5ea825[_0x442652];if(_[_0xa9d5('0x47')](_0x2a80c2[_0xa9d5('0x4f')][_0x2c70f8['id']])){_0x2a80c2[_0xa9d5('0x4f')][_0x2c70f8['id']]=new ZohoAccount(_0x2c70f8);}else{_0x2a80c2[_0xa9d5('0x44')](_0x2a80c2[_0xa9d5('0x4f')][_0x2c70f8['id']],_0x2c70f8);}}}return _0x2a80c2['zohoAccounts'];};};Realtime[_0xa9d5('0x43')][_0xa9d5('0x50')]=function(){var _0x26dc28=this;return function(_0x1d60c3){if(_0x1d60c3){freeIsNotKey(_0x1d60c3,_0x26dc28[_0xa9d5('0x24')],'id');for(var _0x18dd88=0x0,_0x33e224={},_0x17f392={};_0x18dd88<_0x1d60c3['length'];_0x18dd88+=0x1){_0x33e224=_0x1d60c3[_0x18dd88];if(_[_0xa9d5('0x47')](_0x26dc28[_0xa9d5('0x24')][_0x33e224['id']])){_0x26dc28[_0xa9d5('0x24')][_0x33e224['id']]=new DeskAccount(_0x33e224);}else{_0x26dc28['mergeFromDatabase'](_0x26dc28[_0xa9d5('0x24')][_0x33e224['id']],_0x33e224);}}}return _0x26dc28['deskAccounts'];};};Realtime['prototype'][_0xa9d5('0x51')]=function(){var _0x2a9367=this;return function(_0x1f2c72){if(_0x1f2c72){freeIsNotKey(_0x1f2c72,_0x2a9367[_0xa9d5('0x52')],'id');for(var _0x1772d7=0x0,_0x3fdfbf={},_0x3e7669={};_0x1772d7<_0x1f2c72['length'];_0x1772d7+=0x1){_0x3fdfbf=_0x1f2c72[_0x1772d7];if(_[_0xa9d5('0x47')](_0x2a9367[_0xa9d5('0x52')][_0x3fdfbf['id']])){_0x2a9367[_0xa9d5('0x52')][_0x3fdfbf['id']]=new SugarcrmAccount(_0x3fdfbf);}else{_0x2a9367[_0xa9d5('0x44')](_0x2a9367[_0xa9d5('0x52')][_0x3fdfbf['id']],_0x3fdfbf);}}}return _0x2a9367[_0xa9d5('0x52')];};};Realtime['prototype'][_0xa9d5('0x53')]=function(){var _0x399d84=this;return function(_0x43175c){if(_0x43175c){freeIsNotKey(_0x43175c,_0x399d84['vtigerAccounts'],'id');for(var _0x350217=0x0,_0x71b220={},_0x21b00a={};_0x350217<_0x43175c[_0xa9d5('0x46')];_0x350217+=0x1){_0x71b220=_0x43175c[_0x350217];if(_[_0xa9d5('0x47')](_0x399d84['vtigerAccounts'][_0x71b220['id']])){_0x399d84[_0xa9d5('0x25')][_0x71b220['id']]=new VtigerAccount(_0x71b220);}else{_0x399d84[_0xa9d5('0x44')](_0x399d84['vtigerAccounts'][_0x71b220['id']],_0x71b220);}}}return _0x399d84[_0xa9d5('0x25')];};};Realtime[_0xa9d5('0x43')]['initServicenowAccounts']=function(){var _0x9a635d=this;return function(_0x249c25){if(_0x249c25){freeIsNotKey(_0x249c25,_0x9a635d['servicenowAccounts'],'id');for(var _0x2cb301=0x0,_0x1bb602={},_0x21a21={};_0x2cb301<_0x249c25[_0xa9d5('0x46')];_0x2cb301+=0x1){_0x1bb602=_0x249c25[_0x2cb301];if(_[_0xa9d5('0x47')](_0x9a635d[_0xa9d5('0x26')][_0x1bb602['id']])){_0x9a635d[_0xa9d5('0x26')][_0x1bb602['id']]=new ServicenowAccount(_0x1bb602);}else{_0x9a635d[_0xa9d5('0x44')](_0x9a635d[_0xa9d5('0x26')][_0x1bb602['id']],_0x1bb602);}}}return _0x9a635d[_0xa9d5('0x26')];};};Realtime[_0xa9d5('0x43')][_0xa9d5('0x54')]=function(){var _0x549a94=this;return function(_0x5dac20){if(_0x5dac20){freeIsNotKey(_0x5dac20,_0x549a94[_0xa9d5('0x27')],'id');for(var _0x17e6a1=0x0,_0x1fb248={},_0x6dc984={};_0x17e6a1<_0x5dac20['length'];_0x17e6a1+=0x1){_0x1fb248=_0x5dac20[_0x17e6a1];if(_[_0xa9d5('0x47')](_0x549a94[_0xa9d5('0x27')][_0x1fb248['id']])){_0x549a94['dynamics365Accounts'][_0x1fb248['id']]=new Dynamics365Account(_0x1fb248);}else{_0x549a94[_0xa9d5('0x44')](_0x549a94[_0xa9d5('0x27')][_0x1fb248['id']],_0x1fb248);}}}return _0x549a94['dynamics365Accounts'];};};Realtime[_0xa9d5('0x43')][_0xa9d5('0x55')]=function(){var _0x197161=this;return function(_0x57d1bf){if(_0x57d1bf){freeIsNotKey(_0x57d1bf,_0x197161[_0xa9d5('0x28')],'id');for(var _0x3df0df=0x0,_0x2f97c0={},_0x184622={};_0x3df0df<_0x57d1bf[_0xa9d5('0x46')];_0x3df0df+=0x1){_0x2f97c0=_0x57d1bf[_0x3df0df];if(_[_0xa9d5('0x47')](_0x197161[_0xa9d5('0x28')][_0x2f97c0['id']])){_0x197161[_0xa9d5('0x28')][_0x2f97c0['id']]=new FreshsalesAccount(_0x2f97c0);}else{_0x197161[_0xa9d5('0x44')](_0x197161[_0xa9d5('0x28')][_0x2f97c0['id']],_0x2f97c0);}}}return _0x197161[_0xa9d5('0x28')];};};Realtime[_0xa9d5('0x43')][_0xa9d5('0x56')]=function(){var _0x4a1b80=this;return function(_0x3f9f9b){for(var _0x60f5f0=0x0;_0x60f5f0<_0x3f9f9b[_0xa9d5('0x46')];_0x60f5f0+=0x1){_[_0xa9d5('0x57')](_0x4a1b80['voiceQueues'][_0x3f9f9b[_0x60f5f0][_0xa9d5('0x2a')]],_0x3f9f9b[_0x60f5f0]);}return _0x4a1b80[_0xa9d5('0x17')];};};Realtime[_0xa9d5('0x43')][_0xa9d5('0x58')]=function(){var _0x242b4c=this;return function(_0xbc7baa){clearVoiceQueues(_0x242b4c['voiceQueues']);if(_0xbc7baa){_0xbc7baa=_['groupBy'](_0xbc7baa,'uniqueid');for(var _0x116942 in _0xbc7baa){if(_0xbc7baa['hasOwnProperty'](_0x116942)){var _0x5a177f={};for(var _0x4f6dca=0x0;_0x4f6dca<_0xbc7baa[_0x116942]['length'];_0x4f6dca+=0x1){var _0x59af99=_0xbc7baa[_0x116942][_0x4f6dca][_0xa9d5('0x59')];if(_0x242b4c[_0xa9d5('0x17')][_0x59af99]){if(_0xbc7baa[_0x116942][_0x4f6dca][_0xa9d5('0x5a')]){_0x242b4c['voiceQueues'][_0x59af99]['unmanaged']+=0x1;}if(_0xbc7baa[_0x116942][_0x4f6dca][_0xa9d5('0x5b')]){_0x242b4c['voiceQueues'][_0x59af99][_0xa9d5('0x39')]+=0x1;}_0x242b4c[_0xa9d5('0x17')][_0x59af99][_0xa9d5('0x32')]+=moment(_0xbc7baa[_0x116942][_0x4f6dca]['queuecallerleaveAt'])[_0xa9d5('0x5c')](moment(_0xbc7baa[_0x116942][_0x4f6dca][_0xa9d5('0x5d')]),_0xa9d5('0x5e'))||0x0;if(_0x4f6dca===_0xbc7baa[_0x116942][_0xa9d5('0x46')]-0x1){_0x242b4c['voiceQueues'][_0x59af99][_0xa9d5('0x33')]+=moment(_0xbc7baa[_0x116942][_0x4f6dca][_0xa9d5('0x5f')]||_0xbc7baa[_0x116942][_0x4f6dca][_0xa9d5('0x60')]||_0xbc7baa[_0x116942][_0x4f6dca][_0xa9d5('0x61')])['diff'](moment(_0xbc7baa[_0x116942][_0x4f6dca][_0xa9d5('0x5d')]),_0xa9d5('0x5e'))||0x0;_0x242b4c[_0xa9d5('0x17')][_0x59af99][_0xa9d5('0x30')]+=0x1;if(_0xbc7baa[_0x116942][_0x4f6dca]['queuecallercomplete']){_0x242b4c[_0xa9d5('0x17')][_0x59af99][_0xa9d5('0x31')]+=0x1;_0x242b4c[_0xa9d5('0x17')][_0x59af99][_0xa9d5('0x34')]+=moment(_0xbc7baa[_0x116942][_0x4f6dca][_0xa9d5('0x5f')])[_0xa9d5('0x5c')](moment(_0xbc7baa[_0x116942][_0x4f6dca][_0xa9d5('0x62')]),'seconds')||0x0;}}else{_0x242b4c['voiceQueues'][_0x59af99][_0xa9d5('0x33')]+=_0x242b4c['voiceQueues'][_0x59af99][_0xa9d5('0x32')]||0x0;}}}}}}return _0x242b4c[_0xa9d5('0x17')];};};Realtime[_0xa9d5('0x43')][_0xa9d5('0x63')]=function(){var _0x5e7957=this;return function(_0x48751b){clearVoiceCallReports(_0x5e7957[_0xa9d5('0x1a')]);if(_0x48751b){for(var _0x4bc1eb=0x0;_0x4bc1eb<_0x48751b['length'];_0x4bc1eb+=0x1){_0x5e7957[_0xa9d5('0x1a')]['total']+=0x1;_0x5e7957[_0xa9d5('0x1a')]['sumDuration']+=_0x48751b[_0x4bc1eb][_0xa9d5('0x64')];if(_0x48751b[_0x4bc1eb][_0xa9d5('0x65')]===_0xa9d5('0x66')){_0x5e7957[_0xa9d5('0x1a')][_0xa9d5('0x31')]+=0x1;_0x5e7957['outbound'][_0xa9d5('0x32')]+=_0x48751b[_0x4bc1eb]['duration']-_0x48751b[_0x4bc1eb][_0xa9d5('0x67')]||0x0;_0x5e7957['outbound'][_0xa9d5('0x34')]+=_0x48751b[_0x4bc1eb][_0xa9d5('0x67')];}}}return _0x5e7957[_0xa9d5('0x1a')];};};Realtime[_0xa9d5('0x43')]['initCampaigns']=function(){var _0x67f8de=this;return function(_0x2e656d){if(_0x2e656d){freeIsNotKey(_0x2e656d,_0x67f8de['campaigns'],_0xa9d5('0x2a'));for(var _0x17f19a=0x0,_0x1df226={};_0x17f19a<_0x2e656d[_0xa9d5('0x46')];_0x17f19a+=0x1){_0x1df226=_0x2e656d[_0x17f19a];if(_[_0xa9d5('0x47')](_0x67f8de[_0xa9d5('0x68')][_0x1df226[_0xa9d5('0x2a')]])){_0x67f8de[_0xa9d5('0x68')][_0x1df226[_0xa9d5('0x2a')]]=new Campaign(_0x1df226);}else{_0x67f8de['mergeFromDatabase'](_0x67f8de[_0xa9d5('0x68')][_0x1df226['name']],_0x1df226);_0x67f8de['campaigns'][_0x1df226[_0xa9d5('0x2a')]][_0xa9d5('0x69')]=_0x1df226[_0xa9d5('0x6a')]?_0x1df226[_0xa9d5('0x6a')]['name']:undefined;}}}return _0x67f8de[_0xa9d5('0x68')];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x565b44=this;return function(_0x48f2d5){if(_0x48f2d5){freeIsNotKey(_0x48f2d5,_0x565b44[_0xa9d5('0x1b')],'id');for(var _0x127207=0x0,_0x2cb915={};_0x127207<_0x48f2d5['length'];_0x127207+=0x1){_0x2cb915=_0x48f2d5[_0x127207];if(_[_0xa9d5('0x47')](_0x565b44[_0xa9d5('0x1b')][_0x2cb915['id']])){_0x565b44[_0xa9d5('0x1b')][_0x2cb915['id']]=new VoiceExtension(_0x2cb915);}else{_0x565b44[_0xa9d5('0x44')](_0x565b44[_0xa9d5('0x1b')][_0x2cb915['id']],_0x2cb915);}}}return _0x565b44[_0xa9d5('0x1b')];};};Realtime[_0xa9d5('0x43')]['initCampaignHopperHistory']=function(){var _0x11312e=this;return function(_0x239926){clearCampaigns(_0x11312e[_0xa9d5('0x68')]);for(var _0x2cfe52=0x0;_0x2cfe52<_0x239926[_0xa9d5('0x46')];_0x2cfe52+=0x1){_['merge'](_0x11312e[_0xa9d5('0x68')][_0x239926[_0x2cfe52]['name']],_0x239926[_0x2cfe52]);}return _0x11312e[_0xa9d5('0x68')];};};Realtime['prototype'][_0xa9d5('0x6b')]=function(){var _0x15384c=this;return function(_0x11526a){if(_0x11526a){freeIsNotKey(_0x11526a,_0x15384c[_0xa9d5('0x6c')],'id');for(var _0x3d7358=0x0,_0x3fb45f={},_0x4da9d7={};_0x3d7358<_0x11526a[_0xa9d5('0x46')];_0x3d7358+=0x1){_0x3fb45f=_0x11526a[_0x3d7358];if(_[_0xa9d5('0x47')](_0x15384c['faxAccounts'][_0x3fb45f['id']])){_0x15384c[_0xa9d5('0x6c')][_0x3fb45f['id']]=new FaxAccount(_0x3fb45f);}else{_0x15384c['mergeFromDatabase'](_0x15384c['faxAccounts'][_0x3fb45f['id']],_0x3fb45f);}}}return _0x15384c['faxAccounts'];};};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 c4bccfb..e9e8c0c 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 _0x036f=['voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','format','voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','interface','isNil','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','match','getAgentByInternal','keys','getCallType','split','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','destinationchannel','channel','calleridpreview','originatecalleridnum','disposition','ANSWERED','calleridname','transfers','linkedid','UserId','create','monitor','monitors','monitorFilename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','voiceDialReport','startsWith','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','exports','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','bind'];(function(_0x28d54c,_0x53d9ba){var _0x32ab5c=function(_0x18959b){while(--_0x18959b){_0x28d54c['push'](_0x28d54c['shift']());}};_0x32ab5c(++_0x53d9ba);}(_0x036f,0xf9));var _0xf036=function(_0x1f16de,_0x548eb9){_0x1f16de=_0x1f16de-0x0;var _0x36cd80=_0x036f[_0x1f16de];return _0x36cd80;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xf036('0x0'));var config=require(_0xf036('0x1'));var ami=require(_0xf036('0x2'));var RpcVoiceAgentReport=require(_0xf036('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xf036('0x4'));var VoiceQueueReport=require(_0xf036('0x5'));var VoiceCallReport=require(_0xf036('0x6'));var VoiceAgentReport=require(_0xf036('0x7'));var VoiceDialReport=require(_0xf036('0x8'));var UserReport=require(_0xf036('0x9'));function Report(_0x2d6ed5){this[_0xf036('0xa')]=_0x2d6ed5;this[_0xf036('0xb')]=_0x2d6ed5['agents'];this[_0xf036('0xc')]=_0x2d6ed5[_0xf036('0xc')];}Report[_0xf036('0xd')][_0xf036('0xe')]=function(_0x2a0e47){var _0x4462be=new VoiceQueueReport(this['realtime']);var _0x56ce13=new VoiceAgentReport(this['realtime']);var _0x145ab7=new VoiceDialReport(this['realtime']);var _0x132acf=new VoiceCallReport(this[_0xf036('0xa')]);var _0x8b3ba1=new UserReport(this['realtime']);if(config['xdr']&&config[_0xf036('0xf')][_0xf036('0x10')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0xf036('0x11')](this));ami['on']('custom:voiceCallReport',this[_0xf036('0x12')][_0xf036('0x11')](this));ami['on'](_0xf036('0x13'),this[_0xf036('0x14')][_0xf036('0x11')](this));ami['on'](_0xf036('0x15'),this['voiceDialReport']['bind'](this));ami['on'](_0xf036('0x16'),this[_0xf036('0x17')]['bind'](this));ami['on']('attendedtransfer',this[_0xf036('0x18')][_0xf036('0x11')](this));}};Report['prototype'][_0xf036('0x19')]=function(_0x49961b){var _0x5a2ea9;_0x5a2ea9=_[_0xf036('0x1a')](this['agents'],function(_0x1d78b6){return _0x1d78b6[_0xf036('0x1b')]==_0x49961b||_0x1d78b6[_0xf036('0x1c')]==_0x49961b;});if(_['isNil'](_0x5a2ea9)){var _0x46f223=_[_0xf036('0x1a')](this[_0xf036('0xc')],function(_0x54d281){return _0x54d281[_0xf036('0x1b')]==_0x49961b||_0x54d281['name']==_0x49961b;});if(_0x46f223){_0x5a2ea9=_[_0xf036('0x1a')](this[_0xf036('0xb')],function(_0x1c5114){return _0x1c5114['interface']==util[_0xf036('0x1d')]('SIP/%s',_0x46f223['name']);});}}return _0x5a2ea9;};Report[_0xf036('0xd')][_0xf036('0x1e')]=function(_0x3f84b2){for(var _0x17280b=0x0;_0x17280b<_0x3f84b2[_0xf036('0x1f')];_0x17280b+=0x1){var _0x167ff2=this[_0xf036('0x19')](_0x3f84b2[_0x17280b][_0xf036('0x20')]);if(_0x167ff2){_0x3f84b2[_0x17280b][_0xf036('0x1b')]=_0x167ff2[_0xf036('0x1b')];_0x3f84b2[_0x17280b][_0xf036('0x21')]=!![];_0x3f84b2[_0x17280b][_0xf036('0x22')]=_0x167ff2[_0xf036('0x1c')];_0x3f84b2[_0x17280b][_0xf036('0x23')]=_[_0xf036('0x24')](_0x167ff2['interface'])?util[_0xf036('0x1d')](_0xf036('0x25'),_0x167ff2[_0xf036('0x1c')]):_0x167ff2[_0xf036('0x23')];if(_0x3f84b2[_0x17280b][_0xf036('0x26')]){_0x3f84b2[_0x17280b][_0xf036('0x27')]=moment()[_0xf036('0x1d')](_0xf036('0x28'));}if(_0x3f84b2[_0x17280b][_0xf036('0x29')]){_0x3f84b2[_0x17280b]['queuecallerexitAt']=moment()[_0xf036('0x1d')](_0xf036('0x28'));}RpcMemberReport[_0xf036('0x1e')](_0x3f84b2[_0x17280b]);}RpcVoiceQueueReport['create'](_0x3f84b2[_0x17280b]);}};function extractCalleridNumber(_0x2171aa){var _0x1bb4e7=_0x2171aa[_0xf036('0x2a')](/<(.*?)>/);return _0x1bb4e7?_0x1bb4e7[0x1]:_0x2171aa;}Report[_0xf036('0xd')][_0xf036('0x2b')]=function(_0x23bb0c){for(var _0x556827=0x0;_0x556827',_0x260ebd[_0xf036('0x43')],_0x260ebd[_0xf036('0x2f')]);}if(RpcVoiceTransferReport[_0xf036('0x44')][_0x260ebd[_0xf036('0x45')]]){var _0x5b84b3=RpcVoiceTransferReport[_0xf036('0x44')][_0x260ebd[_0xf036('0x45')]];_0x5b84b3['transfereelinkedid']=_0x260ebd['uniqueid'];RpcVoiceTransferReport[_0xf036('0x17')](_0x5b84b3);delete RpcVoiceTransferReport[_0xf036('0x44')][_0x260ebd[_0xf036('0x45')]];}if(_[_0xf036('0x24')](_0x260ebd['type'])){_0x260ebd[_0xf036('0x34')]=this[_0xf036('0x2d')](_0x260ebd);}if(_['isNil'](_0x260ebd[_0xf036('0x46')])){var _0x28d1c2=_0x260ebd[_0xf036('0x3e')]['split']('-')[0x0];var _0x19d3ac=this[_0xf036('0xb')][_0x28d1c2];if(!_0x19d3ac)_0x19d3ac=this[_0xf036('0x2b')](_0x260ebd[_0xf036('0x1b')]);if(_0x19d3ac){_0x260ebd['UserId']=_0x19d3ac['id'];_0x260ebd['membername']=_0x19d3ac[_0xf036('0x1c')];}}RpcVoiceCallReport[_0xf036('0x47')](_0x260ebd);if(_0x260ebd[_0xf036('0x48')]){for(var _0x2415b0=0x0;_0x2415b0<_0x260ebd[_0xf036('0x49')][_0xf036('0x1f')];_0x2415b0+=0x1){_0x260ebd[_0xf036('0x4a')]=_0x260ebd['monitors'][_0x2415b0]['filename'];_0x260ebd[_0xf036('0x4b')]=_0x260ebd[_0xf036('0x49')][_0x2415b0][_0xf036('0x4b')];if(_0x260ebd[_0xf036('0x33')]==_0xf036('0x3c')){_0x260ebd[_0xf036('0x2f')]=_0x260ebd['connectedlinenum'];_0x260ebd[_0xf036('0x43')]=_0x260ebd[_0xf036('0x4c')];_0x260ebd[_0xf036('0x20')]=_0x260ebd[_0xf036('0x1b')];_0x260ebd[_0xf036('0x4c')]=_0x260ebd[_0xf036('0x4d')];_0x260ebd[_0xf036('0x33')]=_0x260ebd[_0xf036('0x40')];}else if(_0x260ebd[_0xf036('0x33')]==_0xf036('0x4e')){_0x260ebd[_0xf036('0x2f')]=_0x260ebd[_0xf036('0x32')];_0x260ebd['exten']=_0x260ebd[_0xf036('0x40')];}RpcVoiceRecording[_0xf036('0x47')](_0x260ebd);}}};Report[_0xf036('0xd')][_0xf036('0x14')]=function(_0x357c46){if(_[_0xf036('0x4f')](_0x357c46)){_0x357c46['forEach'](function(_0x5013b6){RpcVoiceAgentReport[_0xf036('0x47')](_0x5013b6);});}else{RpcVoiceAgentReport[_0xf036('0x47')](_0x357c46);}};Report[_0xf036('0xd')][_0xf036('0x50')]=function(_0x2a1e65){RpcVoiceDialReport[_0xf036('0x47')](_0x2a1e65);var _0x3afae5;var _0x47a061;var _0x3ecf32=_0x2a1e65[_0xf036('0x3e')];if(_[_0xf036('0x51')](_0x3ecf32,'Local')){_0x47a061=_0x3ecf32['substring'](_0x3ecf32[_0xf036('0x52')]('/')+0x1,_0x3ecf32['indexOf']('@'));_0x3afae5=_[_0xf036('0x1a')](this[_0xf036('0xb')],function(_0x5db045){return _0x5db045[_0xf036('0x53')]==_0x47a061||_0x5db045[_0xf036('0x54')]==_0x47a061||_0x5db045[_0xf036('0x1b')]==_0x47a061;});}else{_0x47a061=_0x3ecf32[_0xf036('0x55')](_0x3ecf32[_0xf036('0x52')]('/')+0x1,_0x3ecf32[_0xf036('0x56')]('-'));_0x3afae5=this[_0xf036('0x19')](_0x47a061);}if(_0x3afae5){_0x2a1e65[_0xf036('0x23')]=_['isNil'](_0x3afae5[_0xf036('0x23')])?util[_0xf036('0x1d')]('SIP/%s',_0x3afae5[_0xf036('0x1c')]):_0x3afae5[_0xf036('0x23')];_0x2a1e65[_0xf036('0x4d')]=_0x3afae5[_0xf036('0x1c')];_0x2a1e65[_0xf036('0x1b')]=_0x3afae5[_0xf036('0x1b')];RpcMemberReport[_0xf036('0x50')](_0x2a1e65);}};Report[_0xf036('0xd')]['blindTransfer']=function(_0x837f5f){RpcVoiceTransferReport[_0xf036('0x44')][_0x837f5f[_0xf036('0x57')]]=_0x837f5f;};Report[_0xf036('0xd')][_0xf036('0x18')]=function(_0xfeaa26){RpcVoiceTransferReport['attendedTransfer'](_0xfeaa26);};module[_0xf036('0x58')]=Report; \ No newline at end of file +var _0xdb68=['accountcode','name','isNil','interface','format','SIP/%s','voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','match','getAgentByInternal','keys','getCallType','channel','split','outbound','internal','destination','exten','type','queue','context','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','calleridnum','disposition','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','uniqueid','UserId','membername','create','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','voiceDialReport','transfererlinkedid','exports','util','../ami','../rpc/voiceAgentReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./userReport','agents','telephones','sync','realtime','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find'];(function(_0x2069ed,_0x266172){var _0xceb461=function(_0x20d50b){while(--_0x20d50b){_0x2069ed['push'](_0x2069ed['shift']());}};_0xceb461(++_0x266172);}(_0xdb68,0xee));var _0x8db6=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0xdb68[_0x3c81b5];return _0x5888c4;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x8db6('0x0'));var config=require('../../../config/environment');var ami=require(_0x8db6('0x1'));var RpcVoiceAgentReport=require(_0x8db6('0x2'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x8db6('0x3'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x8db6('0x4'));var RpcVoiceTransferReport=require(_0x8db6('0x5'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x8db6('0x6'));var VoiceAgentReport=require(_0x8db6('0x7'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x8db6('0x8'));function Report(_0x344898){this['realtime']=_0x344898;this[_0x8db6('0x9')]=_0x344898['agents'];this[_0x8db6('0xa')]=_0x344898['telephones'];}Report['prototype'][_0x8db6('0xb')]=function(_0x45d2c0){var _0x5a04e2=new VoiceQueueReport(this[_0x8db6('0xc')]);var _0x51888e=new VoiceAgentReport(this[_0x8db6('0xc')]);var _0x2814bc=new VoiceDialReport(this[_0x8db6('0xc')]);var _0x5c514c=new VoiceCallReport(this[_0x8db6('0xc')]);var _0x4f175a=new UserReport(this[_0x8db6('0xc')]);if(config[_0x8db6('0xd')]&&config[_0x8db6('0xd')][_0x8db6('0xe')]){ami['on'](_0x8db6('0xf'),this['voiceQueueReport'][_0x8db6('0x10')](this));ami['on'](_0x8db6('0x11'),this[_0x8db6('0x12')][_0x8db6('0x10')](this));ami['on'](_0x8db6('0x13'),this[_0x8db6('0x14')][_0x8db6('0x10')](this));ami['on'](_0x8db6('0x15'),this['voiceDialReport'][_0x8db6('0x10')](this));ami['on'](_0x8db6('0x16'),this[_0x8db6('0x17')][_0x8db6('0x10')](this));ami['on'](_0x8db6('0x18'),this[_0x8db6('0x19')][_0x8db6('0x10')](this));}};Report[_0x8db6('0x1a')][_0x8db6('0x1b')]=function(_0x18e7c3){var _0x175901;_0x175901=_[_0x8db6('0x1c')](this[_0x8db6('0x9')],function(_0x918ceb){return _0x918ceb[_0x8db6('0x1d')]==_0x18e7c3||_0x918ceb[_0x8db6('0x1e')]==_0x18e7c3;});if(_[_0x8db6('0x1f')](_0x175901)){var _0x160df5=_[_0x8db6('0x1c')](this[_0x8db6('0xa')],function(_0x1a59c7){return _0x1a59c7[_0x8db6('0x1d')]==_0x18e7c3||_0x1a59c7[_0x8db6('0x1e')]==_0x18e7c3;});if(_0x160df5){_0x175901=_['find'](this[_0x8db6('0x9')],function(_0x564ac0){return _0x564ac0[_0x8db6('0x20')]==util[_0x8db6('0x21')](_0x8db6('0x22'),_0x160df5['name']);});}}return _0x175901;};Report['prototype'][_0x8db6('0x23')]=function(_0x4877ac){for(var _0x53a956=0x0;_0x53a956<_0x4877ac[_0x8db6('0x24')];_0x53a956+=0x1){var _0xff1bcf=this['findAgent'](_0x4877ac[_0x53a956][_0x8db6('0x25')]);if(_0xff1bcf){_0x4877ac[_0x53a956][_0x8db6('0x1d')]=_0xff1bcf['accountcode'];_0x4877ac[_0x53a956][_0x8db6('0x26')]=!![];_0x4877ac[_0x53a956][_0x8db6('0x27')]=_0xff1bcf['name'];_0x4877ac[_0x53a956][_0x8db6('0x20')]=_[_0x8db6('0x1f')](_0xff1bcf['interface'])?util[_0x8db6('0x21')]('SIP/%s',_0xff1bcf[_0x8db6('0x1e')]):_0xff1bcf[_0x8db6('0x20')];if(_0x4877ac[_0x53a956][_0x8db6('0x28')]){_0x4877ac[_0x53a956]['queuecallercompleteAt']=moment()[_0x8db6('0x21')](_0x8db6('0x29'));}if(_0x4877ac[_0x53a956][_0x8db6('0x2a')]){_0x4877ac[_0x53a956]['queuecallerexitAt']=moment()[_0x8db6('0x21')](_0x8db6('0x29'));}RpcMemberReport['voiceQueueReport'](_0x4877ac[_0x53a956]);}RpcVoiceQueueReport['create'](_0x4877ac[_0x53a956]);}};function extractCalleridNumber(_0x4c9ba2){var _0x1092a0=_0x4c9ba2[_0x8db6('0x2b')](/<(.*?)>/);return _0x1092a0?_0x1092a0[0x1]:_0x4c9ba2;}Report[_0x8db6('0x1a')][_0x8db6('0x2c')]=function(_0xb3121b){for(var _0x1fc8e5=0x0;_0x1fc8e50x0?_0x3c8b22:0x0;this['voiceQueues'][_0x5415a3['queue']][_0x6340('0x39')]=this[_0x6340('0x14')][_0x5415a3[_0x6340('0x71')]][_0x6340('0x39')]>_[_0x6340('0x74')](_0x5415a3[_0x6340('0x75')])?_[_0x6340('0x74')](_0x5415a3[_0x6340('0x75')]):this[_0x6340('0x14')][_0x5415a3['queue']][_0x6340('0x39')];this[_0x6340('0x78')](this[_0x6340('0x14')][_0x5415a3[_0x6340('0x71')]],_0x6340('0x17'));}logger[_0x6340('0x51')](_0x6340('0x79'),util[_0x6340('0x48')](this['voiceQueues'][_0x5415a3[_0x6340('0x71')]],{'showHidden':![],'depth':null}));ami['emit'](_0x6340('0x7a'),this[_0x6340('0x14')][_0x5415a3[_0x6340('0x71')]]);}}}catch(_0x5914ac){logger[_0x6340('0x4a')](_0x6340('0x6e'),util[_0x6340('0x48')](_0x5914ac,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6340('0x3c')][_0x6340('0x1a')]=function(_0x58551a){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x6340('0x48')](_0x58551a,{'showHidden':![],'depth':null}));this[_0x6340('0x15')]=!![];};VoiceQueueReport['prototype'][_0x6340('0x1c')]=function(_0x4b349f){try{if(this[_0x6340('0x6c')](_0x4b349f)){logger[_0x6340('0x51')](_0x6340('0x7b'),_0x4b349f[_0x6340('0x54')],util[_0x6340('0x48')](_0x4b349f,{'showHidden':![],'depth':null}));if(_[_0x6340('0x6d')](this[_0x6340('0x10')][_0x4b349f[_0x6340('0x54')]]))this[_0x6340('0x10')][_0x4b349f['uniqueid']]=[];if(_[_0x6340('0x6d')](this[_0x6340('0x12')][_0x4b349f[_0x6340('0x54')]]))this['channels'][_0x4b349f[_0x6340('0x54')]]={};var _0x55d110=new QueueReport();_0x55d110[_0x6340('0x57')]=_0x4b349f[_0x6340('0x71')];_0x55d110[_0x6340('0x5c')]=this[_0x6340('0x14')][_0x55d110[_0x6340('0x57')]]&&this[_0x6340('0x14')][_0x55d110[_0x6340('0x57')]]['type']?this[_0x6340('0x14')][_0x55d110[_0x6340('0x57')]][_0x6340('0x5c')]||'inbound':_0x6340('0x5d');_0x55d110['queue']=_0x4b349f[_0x6340('0x71')];_0x55d110['queuecallerjoinAt']=moment()['format'](_0x6340('0x7c'));_0x55d110['position']=_0x4b349f['position'];_0x55d110['count']=_0x4b349f[_0x6340('0x7d')];_0x55d110[_0x6340('0x54')]=_0x4b349f[_0x6340('0x54')];_0x55d110[_0x6340('0x7e')]=this['channels'][_0x4b349f[_0x6340('0x54')]][_0x6340('0x7e')];logger[_0x6340('0x7f')](_0x6340('0x80'),_0x55d110[_0x6340('0x57')],_0x55d110['type']);_[_0x6340('0x81')](_0x55d110,_['pick'](_0x4b349f,_[_0x6340('0x82')](_0x55d110)));this[_0x6340('0x10')][_0x4b349f['uniqueid']]['push'](_0x55d110);this['channels'][_0x4b349f[_0x6340('0x54')]]=_0x55d110;this[_0x6340('0x50')](_0x55d110,'queuecallerjoin');}}catch(_0x57a9a2){logger['error'](_0x6340('0x7b'),_0x4b349f[_0x6340('0x54')],util[_0x6340('0x48')](_0x57a9a2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6340('0x3c')][_0x6340('0x1e')]=function(_0x148d27){try{if(this[_0x6340('0x6c')](_0x148d27)){logger[_0x6340('0x51')](_0x6340('0x83'),_0x148d27[_0x6340('0x54')],util[_0x6340('0x48')](_0x148d27,{'showHidden':![],'depth':null}));if(this[_0x6340('0x10')][_0x148d27[_0x6340('0x54')]]){var _0x146b0d=_['last'](this[_0x6340('0x10')][_0x148d27[_0x6340('0x54')]]);_0x146b0d[_0x6340('0x84')]=![];_0x146b0d[_0x6340('0x85')]=null;_0x146b0d[_0x6340('0x86')]=_0x148d27[_0x6340('0x86')];_0x146b0d['originalposition']=_0x148d27[_0x6340('0x87')];_0x146b0d[_0x6340('0x1d')]=!![];_0x146b0d[_0x6340('0x88')]=moment()[_0x6340('0x55')](_0x6340('0x7c'));_0x146b0d[_0x6340('0x89')]=_0x6340('0x8a');_0x146b0d[_0x6340('0x8b')]=null;logger[_0x6340('0x7f')](_0x6340('0x8c'),_0x146b0d[_0x6340('0x57')],_0x146b0d[_0x6340('0x5c')]);this[_0x6340('0x12')][_0x148d27[_0x6340('0x54')]]=_0x146b0d;this[_0x6340('0x4e')](_0x146b0d,_0x6340('0x1d'));}}}catch(_0x3d2854){logger[_0x6340('0x4a')](_0x6340('0x83'),_0x148d27['uniqueid'],util[_0x6340('0x48')](_0x3d2854,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6340('0x3c')][_0x6340('0x20')]=function(_0x590833){try{if(this[_0x6340('0x6c')](_0x590833)){logger[_0x6340('0x51')]('[%s][voiceQueueReport][queuecallerleave]',_0x590833[_0x6340('0x54')],util[_0x6340('0x48')](_0x590833,{'showHidden':![],'depth':null}));if(this[_0x6340('0x10')][_0x590833[_0x6340('0x54')]]){var _0x199d90=_[_0x6340('0x8d')](this[_0x6340('0x10')][_0x590833[_0x6340('0x54')]]);_0x199d90[_0x6340('0x8e')]=moment()[_0x6340('0x55')](_0x6340('0x7c'));_0x199d90['connectedlinenum']=_0x590833[_0x6340('0x8f')];_0x199d90[_0x6340('0x90')]=_0x590833[_0x6340('0x90')];logger[_0x6340('0x7f')](_0x6340('0x91'),_0x199d90[_0x6340('0x57')],_0x199d90['type'],_0x590833[_0x6340('0x8f')],_0x590833['connectedlinename']);this[_0x6340('0x12')][_0x590833[_0x6340('0x54')]]=_0x199d90;this[_0x6340('0x50')](_0x199d90,_0x6340('0x1f'));}}}catch(_0x487418){logger['error'](_0x6340('0x92'),_0x590833[_0x6340('0x54')],util[_0x6340('0x48')](_0x487418,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6340('0x3c')]['syncAgentConnect']=function(_0x149557){try{if(this['isNotNull'](_0x149557)){logger[_0x6340('0x51')](_0x6340('0x93'),_0x149557[_0x6340('0x54')],util['inspect'](_0x149557,{'showHidden':![],'depth':null}));if(this[_0x6340('0x10')][_0x149557[_0x6340('0x54')]]){var _0x3fbcf7=_['last'](this[_0x6340('0x10')][_0x149557[_0x6340('0x54')]]);_0x3fbcf7[_0x6340('0x84')]=!![];_0x3fbcf7[_0x6340('0x89')]='COMPLETEDBYAGENT';logger[_0x6340('0x7f')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x3fbcf7[_0x6340('0x57')],_0x3fbcf7[_0x6340('0x5c')]);}}}catch(_0x6dfa1c){logger[_0x6340('0x4a')]('[%s][voiceQueueReport][agentconnect]',_0x149557[_0x6340('0x54')],util[_0x6340('0x48')](_0x6dfa1c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6340('0x3c')][_0x6340('0x22')]=function(_0x29b5cd){try{if(this['isNotNull'](_0x29b5cd)){logger[_0x6340('0x51')](_0x6340('0x94'),_0x29b5cd[_0x6340('0x54')],util[_0x6340('0x48')](_0x29b5cd,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x29b5cd[_0x6340('0x54')]]){var _0x10d5e3=_[_0x6340('0x8d')](this[_0x6340('0x10')][_0x29b5cd[_0x6340('0x54')]]);_0x10d5e3[_0x6340('0x1d')]=![];_0x10d5e3['queuecallerabandonAt']=null;_0x10d5e3[_0x6340('0x95')]=!![];_0x10d5e3['lastAssignedTo']=_0x29b5cd[_0x6340('0x96')];_0x10d5e3[_0x6340('0x86')]=_0x29b5cd[_0x6340('0x86')];_0x10d5e3[_0x6340('0x84')]=!![];_0x10d5e3['queuecallerexit']=![];_0x10d5e3[_0x6340('0x97')]=null;if(!_0x10d5e3[_0x6340('0x98')]){if(_0x29b5cd[_0x6340('0x99')]==_0x6340('0x98')){_0x10d5e3['queuecallerexitreason']=_0x6340('0x9a');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x10d5e3[_0x6340('0x57')],_0x10d5e3[_0x6340('0x5c')]);}else{if(_[_0x6340('0x9b')](_0x29b5cd[_0x6340('0x42')][_0x6340('0x9c')](),_0x6340('0x9d'))){if(this[_0x6340('0x10')][_0x29b5cd['linkedid']]){var _0x1b60ad=_[_0x6340('0x8d')](this['queueReports'][_0x29b5cd[_0x6340('0x9e')]]);_0x1b60ad[_0x6340('0x84')]=![];_0x1b60ad[_0x6340('0x9f')]=!![];_0x1b60ad[_0x6340('0x97')]=moment(_0x10d5e3['queuecallerjoinAt'])[_0x6340('0xa0')](_0x29b5cd[_0x6340('0x86')],_0x6340('0xa1'))['format'](_0x6340('0x7c'));_0x1b60ad[_0x6340('0x89')]=_0x6340('0xa2');_0x1b60ad[_0x6340('0x98')]=!![];_0x1b60ad[_0x6340('0xa3')]='FORWARD';_0x1b60ad[_0x6340('0xa4')]=_0x29b5cd['destexten'];_0x1b60ad[_0x6340('0xa5')]=_0x29b5cd['uniqueid'];logger[_0x6340('0x7f')](_0x6340('0xa6'),_0x1b60ad[_0x6340('0x57')],_0x1b60ad[_0x6340('0x5c')]);var _0x1d8e27=this['queueReports'][_0x29b5cd['linkedid']];this['queueReports'][_0x29b5cd[_0x6340('0x9e')]]=this[_0x6340('0x10')][_0x29b5cd[_0x6340('0x54')]];this[_0x6340('0x10')][_0x29b5cd[_0x6340('0x54')]]=_0x1d8e27;}}else{_0x10d5e3[_0x6340('0x89')]=_0x6340('0xa7')+_0x29b5cd[_0x6340('0x99')][_0x6340('0xa8')]();logger['info'](_0x6340('0xa9'),_0x10d5e3[_0x6340('0x57')],_0x10d5e3['type'],_0x10d5e3[_0x6340('0x89')]);}}}this[_0x6340('0x12')][_0x29b5cd[_0x6340('0x54')]]=_0x10d5e3;this['emitVoiceQueueChannelRemove'](_0x10d5e3,'agentcomplete');}}}catch(_0xbdb146){logger[_0x6340('0x4a')](_0x6340('0x94'),_0x29b5cd[_0x6340('0x54')],util['inspect'](_0xbdb146,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6340('0x26')]=function(_0x449dee){try{if(this[_0x6340('0x6c')](_0x449dee)){logger[_0x6340('0x51')](_0x6340('0xaa'),_0x449dee[_0x6340('0x54')],util[_0x6340('0x48')](_0x449dee,{'showHidden':![],'depth':null}));this[_0x6340('0xab')](_0x449dee['uniqueid'],_[_0x6340('0x82')](_0x449dee['variable'])[0x0],_0x449dee[_0x6340('0xac')]);if(this[_0x6340('0x10')][_0x449dee[_0x6340('0x54')]]){var _0x4a15fd=_[_0x6340('0x8d')](this[_0x6340('0x10')][_0x449dee[_0x6340('0x54')]]);if(_0x4a15fd){if(this[_0x6340('0x6c')](_0x449dee['variable'])&&this['isNotNull'](_0x449dee[_0x6340('0xad')][_0x6340('0xae')])){switch(_0x449dee[_0x6340('0xac')]){case _0x6340('0xaf'):_0x4a15fd[_0x6340('0x9f')]=![];_0x4a15fd[_0x6340('0x97')]=null;break;case'TIMEOUT':_0x4a15fd['lastevent']=_0x6340('0xb0');_0x4a15fd[_0x6340('0x9f')]=!![];_0x4a15fd[_0x6340('0x97')]=moment()['format'](_0x6340('0x7c'));_0x4a15fd['queuecallerleaveAt']=moment()[_0x6340('0x55')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x6340('0x51')](_0x6340('0xb1'),_0x449dee['uniqueid'],util[_0x6340('0x48')](_0x4a15fd,{'showHidden':![],'depth':null}));ami['emit'](_0x6340('0xb2'),_0x4a15fd);break;default:_0x4a15fd[_0x6340('0x9f')]=!![];_0x4a15fd[_0x6340('0x97')]=moment()['format'](_0x6340('0x7c'));_0x4a15fd[_0x6340('0x8e')]=moment()[_0x6340('0x55')](_0x6340('0x7c'));}_0x4a15fd[_0x6340('0x1d')]=![];_0x4a15fd[_0x6340('0x88')]=null;_0x4a15fd[_0x6340('0x89')]=_0x449dee[_0x6340('0xac')];this['channels'][_0x449dee[_0x6340('0x54')]]=_0x4a15fd;this['emitVoiceQueueChannelRemove'](_0x4a15fd,'varset');}else if(this['isNotNull'](_0x449dee[_0x6340('0xad')])&&this[_0x6340('0x6c')](_0x449dee[_0x6340('0xad')][_0x6340('0xb3')])){if(!_0x4a15fd['queuecallerabandon']){_0x4a15fd[_0x6340('0x9f')]=!![];_0x4a15fd[_0x6340('0x97')]=moment()[_0x6340('0x55')](_0x6340('0x7c'));_0x4a15fd[_0x6340('0x89')]=_0x6340('0xb4');_0x4a15fd['queuecallerleaveAt']=moment()[_0x6340('0x55')](_0x6340('0x7c'));this['channels'][_0x449dee[_0x6340('0x54')]]=_0x4a15fd;}}logger[_0x6340('0x7f')](_0x6340('0xb5'),_0x449dee[_0x6340('0x54')],_0x4a15fd[_0x6340('0x57')],_0x4a15fd['type'],_[_0x6340('0x82')](_0x449dee[_0x6340('0xad')])[0x0],_0x449dee[_0x6340('0xac')]);_0x4a15fd[_0x6340('0x49')]=this[_0x6340('0x49')][_0x449dee[_0x6340('0x54')]];}}}}catch(_0x1285ee){logger[_0x6340('0x4a')](_0x6340('0xaa'),_0x449dee[_0x6340('0x54')],util[_0x6340('0x48')](_0x1285ee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6340('0x3c')][_0x6340('0xab')]=function(_0x1d133d,_0x5bb041,_0x223349){var _0xc81146=[_0x6340('0xb6'),_0x6340('0xb7'),_0x6340('0xb8'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x6340('0xb9'),_0x6340('0xba'),_0x6340('0xbb'),_0x6340('0xbc'),'sipuri','bridgepeer',_0x6340('0xbd'),'membercalls',_0x6340('0xbe'),'memberinterface','memberlastcall',_0x6340('0x96'),'memberpenalty',_0x6340('0xbf')];if(!_[_0x6340('0x3f')](_0x5bb041)&&!_['includes'](_0xc81146,_0x5bb041)){if(_['isUndefined'](this[_0x6340('0x49')][_0x1d133d])){this[_0x6340('0x49')][_0x1d133d]={};}this['variables'][_0x1d133d][_0x5bb041]=_0x223349;}};VoiceQueueReport[_0x6340('0x3c')][_0x6340('0x28')]=function(_0x280278){try{if(this[_0x6340('0x6c')](_0x280278)){logger[_0x6340('0x51')](_0x6340('0xc0'),_0x280278[_0x6340('0x54')],util[_0x6340('0x48')](_0x280278,{'showHidden':![],'depth':null}));if(this[_0x6340('0x10')][_0x280278[_0x6340('0x54')]]){for(var _0x462c83=0x0,_0x677f3={};_0x462c830x0?_0xe4c1b6:0x0;this['voiceQueues'][_0x2be8f[_0xde9a('0x69')]][_0xde9a('0x5c')]=this[_0xde9a('0x12')][_0x2be8f[_0xde9a('0x69')]][_0xde9a('0x5c')]>_[_0xde9a('0x6e')](_0x2be8f['loggedin'])?_[_0xde9a('0x6e')](_0x2be8f['loggedin']):this[_0xde9a('0x12')][_0x2be8f[_0xde9a('0x69')]][_0xde9a('0x5c')];this[_0xde9a('0x52')](this[_0xde9a('0x12')][_0x2be8f[_0xde9a('0x69')]],_0xde9a('0x14'));}logger[_0xde9a('0x4f')](_0xde9a('0x70'),util[_0xde9a('0x3f')](this['voiceQueues'][_0x2be8f[_0xde9a('0x69')]],{'showHidden':![],'depth':null}));ami[_0xde9a('0x46')]('custom:queuesummary',this[_0xde9a('0x12')][_0x2be8f['queue']]);}}}catch(_0x3bf141){logger[_0xde9a('0x3d')]('[voiceQueueReport][queuesummary]',util[_0xde9a('0x3f')](_0x3bf141,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xde9a('0xb')][_0xde9a('0x17')]=function(_0xe48e4){logger[_0xde9a('0x4f')](_0xde9a('0x71'),util['inspect'](_0xe48e4,{'showHidden':![],'depth':null}));this[_0xde9a('0x67')]=!![];};VoiceQueueReport[_0xde9a('0xb')][_0xde9a('0x19')]=function(_0x53a586){try{if(this[_0xde9a('0x63')](_0x53a586)){logger[_0xde9a('0x4f')](_0xde9a('0x72'),_0x53a586['uniqueid'],util[_0xde9a('0x3f')](_0x53a586,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xde9a('0xf')][_0x53a586['uniqueid']]))this[_0xde9a('0xf')][_0x53a586[_0xde9a('0x4a')]]=[];if(_[_0xde9a('0x64')](this[_0xde9a('0x38')][_0x53a586['uniqueid']]))this[_0xde9a('0x38')][_0x53a586[_0xde9a('0x4a')]]={};var _0x32af25=new QueueReport();_0x32af25['name']=_0x53a586[_0xde9a('0x69')];_0x32af25[_0xde9a('0x53')]=this['voiceQueues'][_0x32af25[_0xde9a('0x4d')]]&&this[_0xde9a('0x12')][_0x32af25[_0xde9a('0x4d')]]['type']?this[_0xde9a('0x12')][_0x32af25[_0xde9a('0x4d')]][_0xde9a('0x53')]||_0xde9a('0x54'):'inbound';_0x32af25['queue']=_0x53a586[_0xde9a('0x69')];_0x32af25[_0xde9a('0x73')]=moment()[_0xde9a('0x4b')](_0xde9a('0x74'));_0x32af25['position']=_0x53a586[_0xde9a('0x75')];_0x32af25[_0xde9a('0x76')]=_0x53a586[_0xde9a('0x76')];_0x32af25['uniqueid']=_0x53a586[_0xde9a('0x4a')];_0x32af25[_0xde9a('0x77')]=this[_0xde9a('0x38')][_0x53a586['uniqueid']]['routealias'];logger['info'](_0xde9a('0x78'),_0x32af25[_0xde9a('0x4d')],_0x32af25['type']);_[_0xde9a('0x79')](_0x32af25,_[_0xde9a('0x7a')](_0x53a586,_[_0xde9a('0x7b')](_0x32af25)));this[_0xde9a('0xf')][_0x53a586[_0xde9a('0x4a')]][_0xde9a('0x7c')](_0x32af25);this[_0xde9a('0x38')][_0x53a586[_0xde9a('0x4a')]]=_0x32af25;this[_0xde9a('0x47')](_0x32af25,_0xde9a('0x18'));}}catch(_0x9b193b){logger[_0xde9a('0x3d')](_0xde9a('0x72'),_0x53a586[_0xde9a('0x4a')],util['inspect'](_0x9b193b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xde9a('0xb')][_0xde9a('0x1a')]=function(_0x8ff4f3){try{if(this[_0xde9a('0x63')](_0x8ff4f3)){logger[_0xde9a('0x4f')](_0xde9a('0x7d'),_0x8ff4f3[_0xde9a('0x4a')],util[_0xde9a('0x3f')](_0x8ff4f3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x8ff4f3[_0xde9a('0x4a')]]){var _0x199855=_[_0xde9a('0x7e')](this[_0xde9a('0xf')][_0x8ff4f3[_0xde9a('0x4a')]]);_0x199855[_0xde9a('0x7f')]=![];_0x199855[_0xde9a('0x80')]=null;_0x199855[_0xde9a('0x81')]=_0x8ff4f3[_0xde9a('0x81')];_0x199855[_0xde9a('0x82')]=_0x8ff4f3['originalposition'];_0x199855[_0xde9a('0x83')]=!![];_0x199855['queuecallerabandonAt']=moment()[_0xde9a('0x4b')](_0xde9a('0x74'));_0x199855['queuecallerexitreason']=_0xde9a('0x84');_0x199855[_0xde9a('0x85')]=null;logger[_0xde9a('0x6b')](_0xde9a('0x86'),_0x199855[_0xde9a('0x4d')],_0x199855[_0xde9a('0x53')]);this[_0xde9a('0x38')][_0x8ff4f3[_0xde9a('0x4a')]]=_0x199855;this[_0xde9a('0x44')](_0x199855,'queuecallerabandon');}}}catch(_0x5f48a8){logger[_0xde9a('0x3d')](_0xde9a('0x7d'),_0x8ff4f3[_0xde9a('0x4a')],util[_0xde9a('0x3f')](_0x5f48a8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xde9a('0xb')]['syncQueueCallerLeave']=function(_0x205811){try{if(this[_0xde9a('0x63')](_0x205811)){logger[_0xde9a('0x4f')]('[%s][voiceQueueReport][queuecallerleave]',_0x205811[_0xde9a('0x4a')],util[_0xde9a('0x3f')](_0x205811,{'showHidden':![],'depth':null}));if(this[_0xde9a('0xf')][_0x205811[_0xde9a('0x4a')]]){var _0x59611b=_[_0xde9a('0x7e')](this[_0xde9a('0xf')][_0x205811[_0xde9a('0x4a')]]);_0x59611b[_0xde9a('0x87')]=moment()[_0xde9a('0x4b')](_0xde9a('0x74'));_0x59611b[_0xde9a('0x88')]=_0x205811[_0xde9a('0x88')];_0x59611b[_0xde9a('0x89')]=_0x205811[_0xde9a('0x89')];logger[_0xde9a('0x6b')](_0xde9a('0x8a'),_0x59611b[_0xde9a('0x4d')],_0x59611b[_0xde9a('0x53')],_0x205811[_0xde9a('0x88')],_0x205811['connectedlinename']);this[_0xde9a('0x38')][_0x205811[_0xde9a('0x4a')]]=_0x59611b;this[_0xde9a('0x47')](_0x59611b,'queuecallerleave');}}}catch(_0x5a5f0c){logger[_0xde9a('0x3d')](_0xde9a('0x8b'),_0x205811[_0xde9a('0x4a')],util[_0xde9a('0x3f')](_0x5a5f0c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xde9a('0xb')][_0xde9a('0x1f')]=function(_0x3245b0){try{if(this[_0xde9a('0x63')](_0x3245b0)){logger[_0xde9a('0x4f')]('[%s][voiceQueueReport][agentconnect]',_0x3245b0[_0xde9a('0x4a')],util['inspect'](_0x3245b0,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3245b0[_0xde9a('0x4a')]]){var _0x5c8438=_[_0xde9a('0x7e')](this[_0xde9a('0xf')][_0x3245b0[_0xde9a('0x4a')]]);_0x5c8438[_0xde9a('0x7f')]=!![];_0x5c8438[_0xde9a('0x8c')]='COMPLETEDBYAGENT';logger['info'](_0xde9a('0x8d'),_0x5c8438[_0xde9a('0x4d')],_0x5c8438[_0xde9a('0x53')]);}}}catch(_0x481dcf){logger[_0xde9a('0x3d')](_0xde9a('0x8e'),_0x3245b0[_0xde9a('0x4a')],util[_0xde9a('0x3f')](_0x481dcf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x727aa8){try{if(this[_0xde9a('0x63')](_0x727aa8)){logger[_0xde9a('0x4f')]('[%s][voiceQueueReport][agentcomplete]',_0x727aa8[_0xde9a('0x4a')],util['inspect'](_0x727aa8,{'showHidden':![],'depth':null}));if(this[_0xde9a('0xf')][_0x727aa8[_0xde9a('0x4a')]]){var _0x597f33=_[_0xde9a('0x7e')](this[_0xde9a('0xf')][_0x727aa8[_0xde9a('0x4a')]]);_0x597f33['queuecallerabandon']=![];_0x597f33[_0xde9a('0x8f')]=null;_0x597f33[_0xde9a('0x90')]=!![];_0x597f33['lastAssignedTo']=_0x727aa8['membername'];_0x597f33[_0xde9a('0x81')]=_0x727aa8[_0xde9a('0x81')];_0x597f33['queuecallercomplete']=!![];_0x597f33[_0xde9a('0x91')]=![];_0x597f33['queuecallerexitAt']=null;if(!_0x597f33[_0xde9a('0x92')]){if(_0x727aa8['reason']=='transfer'){_0x597f33[_0xde9a('0x8c')]=_0xde9a('0x93');logger[_0xde9a('0x6b')](_0xde9a('0x94'),_0x597f33[_0xde9a('0x4d')],_0x597f33[_0xde9a('0x53')]);}else{if(_[_0xde9a('0x95')](_0x727aa8[_0xde9a('0x96')][_0xde9a('0x97')](),_0xde9a('0x98'))){if(this[_0xde9a('0xf')][_0x727aa8[_0xde9a('0x99')]]){var _0x38683e=_[_0xde9a('0x7e')](this[_0xde9a('0xf')][_0x727aa8['linkedid']]);_0x38683e['queuecallercomplete']=![];_0x38683e['queuecallerexit']=!![];_0x38683e[_0xde9a('0x9a')]=moment(_0x597f33[_0xde9a('0x73')])['add'](_0x727aa8['holdtime'],_0xde9a('0x9b'))['format'](_0xde9a('0x74'));_0x38683e[_0xde9a('0x8c')]='FORWARDTRANSFER';_0x38683e[_0xde9a('0x92')]=!![];_0x38683e[_0xde9a('0x9c')]=_0xde9a('0x9d');_0x38683e[_0xde9a('0x9e')]=_0x727aa8[_0xde9a('0x9f')];_0x38683e[_0xde9a('0xa0')]=_0x727aa8[_0xde9a('0x4a')];logger[_0xde9a('0x6b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x38683e[_0xde9a('0x4d')],_0x38683e[_0xde9a('0x53')]);var _0x2aec9c=this['queueReports'][_0x727aa8[_0xde9a('0x99')]];this['queueReports'][_0x727aa8[_0xde9a('0x99')]]=this[_0xde9a('0xf')][_0x727aa8[_0xde9a('0x4a')]];this[_0xde9a('0xf')][_0x727aa8[_0xde9a('0x4a')]]=_0x2aec9c;}}else{_0x597f33[_0xde9a('0x8c')]=_0xde9a('0xa1')+_0x727aa8['reason'][_0xde9a('0xa2')]();logger[_0xde9a('0x6b')](_0xde9a('0xa3'),_0x597f33[_0xde9a('0x4d')],_0x597f33[_0xde9a('0x53')],_0x597f33['queuecallerexitreason']);}}}this[_0xde9a('0x38')][_0x727aa8[_0xde9a('0x4a')]]=_0x597f33;this[_0xde9a('0x44')](_0x597f33,_0xde9a('0xa4'));}}}catch(_0x31a5ec){logger[_0xde9a('0x3d')](_0xde9a('0xa5'),_0x727aa8[_0xde9a('0x4a')],util[_0xde9a('0x3f')](_0x31a5ec,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xde9a('0x21')]=function(_0x5199c3){try{if(this[_0xde9a('0x63')](_0x5199c3)){logger[_0xde9a('0x4f')](_0xde9a('0xa6'),_0x5199c3[_0xde9a('0x4a')],util['inspect'](_0x5199c3,{'showHidden':![],'depth':null}));this['addVariable'](_0x5199c3[_0xde9a('0x4a')],_[_0xde9a('0x7b')](_0x5199c3[_0xde9a('0xa7')])[0x0],_0x5199c3[_0xde9a('0xa8')]);if(this[_0xde9a('0xf')][_0x5199c3['uniqueid']]){var _0x59a753=_[_0xde9a('0x7e')](this['queueReports'][_0x5199c3[_0xde9a('0x4a')]]);if(_0x59a753){if(this[_0xde9a('0x63')](_0x5199c3['variable'])&&this[_0xde9a('0x63')](_0x5199c3[_0xde9a('0xa7')][_0xde9a('0xa9')])){switch(_0x5199c3[_0xde9a('0xa8')]){case _0xde9a('0xaa'):_0x59a753['queuecallerexit']=![];_0x59a753['queuecallerexitAt']=null;break;case'TIMEOUT':_0x59a753['lastevent']=_0xde9a('0xab');_0x59a753['queuecallerexit']=!![];_0x59a753[_0xde9a('0x9a')]=moment()['format'](_0xde9a('0x74'));_0x59a753[_0xde9a('0x87')]=moment()[_0xde9a('0x4b')](_0xde9a('0x74'));logger[_0xde9a('0x4f')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x5199c3[_0xde9a('0x4a')],util[_0xde9a('0x3f')](_0x59a753,{'showHidden':![],'depth':null}));ami[_0xde9a('0x46')](_0xde9a('0xac'),_0x59a753);break;default:_0x59a753[_0xde9a('0x91')]=!![];_0x59a753[_0xde9a('0x9a')]=moment()[_0xde9a('0x4b')](_0xde9a('0x74'));_0x59a753[_0xde9a('0x87')]=moment()['format'](_0xde9a('0x74'));}_0x59a753['queuecallerabandon']=![];_0x59a753['queuecallerabandonAt']=null;_0x59a753[_0xde9a('0x8c')]=_0x5199c3[_0xde9a('0xa8')];this['channels'][_0x5199c3['uniqueid']]=_0x59a753;this[_0xde9a('0x44')](_0x59a753,_0xde9a('0x20'));}else if(this['isNotNull'](_0x5199c3[_0xde9a('0xa7')])&&this[_0xde9a('0x63')](_0x5199c3[_0xde9a('0xa7')][_0xde9a('0xad')])){if(!_0x59a753[_0xde9a('0x83')]){_0x59a753[_0xde9a('0x91')]=!![];_0x59a753['queuecallerexitAt']=moment()[_0xde9a('0x4b')](_0xde9a('0x74'));_0x59a753[_0xde9a('0x8c')]=_0xde9a('0xae');_0x59a753[_0xde9a('0x87')]=moment()[_0xde9a('0x4b')](_0xde9a('0x74'));this['channels'][_0x5199c3[_0xde9a('0x4a')]]=_0x59a753;}}logger[_0xde9a('0x6b')](_0xde9a('0xaf'),_0x5199c3['uniqueid'],_0x59a753[_0xde9a('0x4d')],_0x59a753['type'],_[_0xde9a('0x7b')](_0x5199c3['variable'])[0x0],_0x5199c3[_0xde9a('0xa8')]);_0x59a753[_0xde9a('0x41')]=this['variables'][_0x5199c3[_0xde9a('0x4a')]];}}}}catch(_0x131dbf){logger[_0xde9a('0x3d')]('[%s][voiceQueueReport][varset]',_0x5199c3[_0xde9a('0x4a')],util[_0xde9a('0x3f')](_0x131dbf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xde9a('0xb0')]=function(_0x4189f7,_0x4d0793,_0x18938c){var _0x16097c=[_0xde9a('0xb1'),'rtpaudioqosbridged',_0xde9a('0xb2'),_0xde9a('0xb3'),'rtpaudioqosloss',_0xde9a('0xb4'),_0xde9a('0xb5'),_0xde9a('0xb6'),'sipcallid',_0xde9a('0xb7'),'bridgepeer',_0xde9a('0xb8'),_0xde9a('0xb9'),_0xde9a('0xba'),_0xde9a('0xbb'),_0xde9a('0xbc'),_0xde9a('0xbd'),_0xde9a('0xbe'),_0xde9a('0xbf')];if(!_[_0xde9a('0xc0')](_0x4d0793)&&!_[_0xde9a('0xc1')](_0x16097c,_0x4d0793)){if(_[_0xde9a('0x64')](this[_0xde9a('0x41')][_0x4189f7])){this[_0xde9a('0x41')][_0x4189f7]={};}this[_0xde9a('0x41')][_0x4189f7][_0x4d0793]=_0x18938c;}};VoiceQueueReport[_0xde9a('0xb')][_0xde9a('0x23')]=function(_0x512e3c){try{if(this[_0xde9a('0x63')](_0x512e3c)){logger['debug'](_0xde9a('0xc2'),_0x512e3c[_0xde9a('0x4a')],util[_0xde9a('0x3f')](_0x512e3c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x512e3c[_0xde9a('0x4a')]]){for(var _0xcf80f8=0x0,_0x31fbec={};_0xcf80f8=0x0?moment(_0x860f74[_0x1bc0('0x1c')])['diff'](_0x860f74[_0x1bc0('0x1b')],_0x1bc0('0xf')):null,'data1':_0x1bc0('0x1d'),'data2':_0x860f74[_0x1bc0('0x14')],'data3':_0x860f74[_0x1bc0('0x11')],'data4':_0x860f74[_0x1bc0('0x1e')]||null,'role':_0x1bc0('0x13'),'internal':_0x860f74[_0x1bc0('0x14')]?_[_0x1bc0('0x15')](_0x860f74[_0x1bc0('0x14')]):undefined,'uniqueid':_0x860f74[_0x1bc0('0x16')]},'log':_0x1bc0('0x18')});}; \ No newline at end of file +var _0xfcc8=['agent','toNumber','accountcode','uniqueid','voiceDialReport','Request','membername','endtime','starttime','outbound','dialstring','moment','lodash','../client','voiceQueueReport','queuecallercompleteAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue'];(function(_0x427994,_0x4c94ce){var _0x34b0e6=function(_0x4429b0){while(--_0x4429b0){_0x427994['push'](_0x427994['shift']());}};_0x34b0e6(++_0x4c94ce);}(_0xfcc8,0xfb));var _0x8fcc=function(_0x55ba2e,_0xea6ac5){_0x55ba2e=_0x55ba2e-0x0;var _0x23bcbb=_0xfcc8[_0x55ba2e];return _0x23bcbb;};'use strict';var moment=require(_0x8fcc('0x0'));var _=require(_0x8fcc('0x1'));var util=require('util');var client=require(_0x8fcc('0x2'));exports[_0x8fcc('0x3')]=function(_0x18b0b8){var _0xe6a169=_0x18b0b8[_0x8fcc('0x4')]||_0x18b0b8['queuecallerexitAt'];return client['Request'](_0x8fcc('0x5'),{'body':{'channel':_0x8fcc('0x6'),'membername':_0x18b0b8[_0x8fcc('0x7')],'interface':_[_0x8fcc('0x8')](_0x18b0b8[_0x8fcc('0x9')])?util[_0x8fcc('0xa')]('SIP/%s',_0x18b0b8[_0x8fcc('0x7')]):_0x18b0b8['interface'],'type':_0x8fcc('0xb'),'enterAt':_0x18b0b8[_0x8fcc('0xc')],'exitAt':_0xe6a169,'duration':moment(_0xe6a169)[_0x8fcc('0xd')](_0x18b0b8[_0x8fcc('0xc')],_0x8fcc('0xe')),'data1':_0x8fcc('0xf'),'data2':_0x18b0b8[_0x8fcc('0x10')],'data3':_0x18b0b8[_0x8fcc('0x11')],'data4':null,'data5':_0x18b0b8[_0x8fcc('0x12')],'role':_0x8fcc('0x13'),'internal':_0x18b0b8['accountcode']?_[_0x8fcc('0x14')](_0x18b0b8[_0x8fcc('0x15')]):undefined,'uniqueid':_0x18b0b8[_0x8fcc('0x16')]},'log':_0x8fcc('0x5')});};exports[_0x8fcc('0x17')]=function(_0x301650){return client[_0x8fcc('0x18')]('CreateMemberReport',{'body':{'channel':_0x8fcc('0x6'),'membername':_0x301650[_0x8fcc('0x19')],'interface':_0x301650[_0x8fcc('0x9')],'type':_0x8fcc('0xb'),'enterAt':_0x301650['starttime'],'exitAt':_0x301650[_0x8fcc('0x1a')],'duration':moment(_0x301650[_0x8fcc('0x1a')])[_0x8fcc('0xd')](_0x301650[_0x8fcc('0x1b')],'seconds')>=0x0?moment(_0x301650[_0x8fcc('0x1a')])[_0x8fcc('0xd')](_0x301650[_0x8fcc('0x1b')],_0x8fcc('0xe')):null,'data1':_0x8fcc('0x1c'),'data2':_0x301650[_0x8fcc('0x15')],'data3':_0x301650[_0x8fcc('0x11')],'data4':_0x301650[_0x8fcc('0x1d')]||null,'role':_0x8fcc('0x13'),'internal':_0x301650[_0x8fcc('0x15')]?_['toNumber'](_0x301650[_0x8fcc('0x15')]):undefined,'uniqueid':_0x301650[_0x8fcc('0x16')]},'log':_0x8fcc('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 654d925..a111af6 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 _0x5423=['getSettings','ShowSetting','stopRecordingOnTransfer','../client'];(function(_0x390cf6,_0xaf9791){var _0x4265e3=function(_0x4cf221){while(--_0x4cf221){_0x390cf6['push'](_0x390cf6['shift']());}};_0x4265e3(++_0xaf9791);}(_0x5423,0xe3));var _0x3542=function(_0x226ce,_0x335b02){_0x226ce=_0x226ce-0x0;var _0x156e77=_0x5423[_0x226ce];return _0x156e77;};'use strict';var client=require(_0x3542('0x0'));exports[_0x3542('0x1')]=function(){return client['Request'](_0x3542('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3542('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xd8ea=['GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x350ebb,_0x3ba1d5){var _0x2a0b84=function(_0x5cdb7e){while(--_0x5cdb7e){_0x350ebb['push'](_0x350ebb['shift']());}};_0x2a0b84(++_0x3ba1d5);}(_0xd8ea,0x1bd));var _0xad8e=function(_0x5465db,_0x4d5502){_0x5465db=_0x5465db-0x0;var _0x2f1917=_0xd8ea[_0x5465db];return _0x2f1917;};'use strict';var client=require(_0xad8e('0x0'));exports[_0xad8e('0x1')]=function(){return client[_0xad8e('0x2')](_0xad8e('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xad8e('0x4')]},'log':_0xad8e('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 14a86b6..c8c9d20 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 _0xa7b5=['../client','getTemplates','Request','name','html','GetTemplate'];(function(_0x233716,_0x346676){var _0x302298=function(_0x53d84c){while(--_0x53d84c){_0x233716['push'](_0x233716['shift']());}};_0x302298(++_0x346676);}(_0xa7b5,0x162));var _0x5a7b=function(_0xf6e2b6,_0x1254da){_0xf6e2b6=_0xf6e2b6-0x0;var _0x196bb3=_0xa7b5[_0xf6e2b6];return _0x196bb3;};'use strict';var client=require(_0x5a7b('0x0'));exports[_0x5a7b('0x1')]=function(_0x22430e){return function(_0x65075a){return client[_0x5a7b('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x5a7b('0x3'),_0x5a7b('0x4')]},'log':_0x5a7b('0x5')});};}; \ No newline at end of file +var _0x32a0=['html','../client'];(function(_0x46918a,_0x35fd44){var _0x5beaa0=function(_0x3dbcf4){while(--_0x3dbcf4){_0x46918a['push'](_0x46918a['shift']());}};_0x5beaa0(++_0x35fd44);}(_0x32a0,0x193));var _0x032a=function(_0x3cd590,_0x54deaa){_0x3cd590=_0x3cd590-0x0;var _0x149858=_0x32a0[_0x3cd590];return _0x149858;};'use strict';var client=require(_0x032a('0x0'));exports['getTemplates']=function(_0x321f60){return function(_0x42d26a){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0x032a('0x1')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index adfa814..e797be4 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 _0x9a74=['Action','Actions','action','data2','data3','data5','data6','data7','../client','getTriggers','GetTrigger','name','channel','status','operator','value','Condition'];(function(_0x1fab94,_0x50e113){var _0x4dc581=function(_0x83dea4){while(--_0x83dea4){_0x1fab94['push'](_0x1fab94['shift']());}};_0x4dc581(++_0x50e113);}(_0x9a74,0x16d));var _0x49a7=function(_0x13cf94,_0x24682d){_0x13cf94=_0x13cf94-0x0;var _0x314143=_0x9a74[_0x13cf94];return _0x314143;};'use strict';var client=require(_0x49a7('0x0'));exports[_0x49a7('0x1')]=function(_0x66c8f3){return function(_0x5d6579){return client['Request'](_0x49a7('0x2'),{'options':{'raw':![],'attributes':['id',_0x49a7('0x3'),_0x49a7('0x4'),_0x49a7('0x5')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id','field',_0x49a7('0x6'),_0x49a7('0x7')]},{'model':_0x49a7('0x8'),'as':'AnyConditions','attributes':['id','field','operator',_0x49a7('0x7')]},{'model':_0x49a7('0x9'),'as':_0x49a7('0xa'),'attributes':['id',_0x49a7('0xb'),'data1',_0x49a7('0xc'),_0x49a7('0xd'),'data4',_0x49a7('0xe'),_0x49a7('0xf'),_0x49a7('0x10')]}]},'log':_0x49a7('0x2')});};}; \ No newline at end of file +var _0xa1ca=['data4','data5','data6','../client','getTriggers','Request','GetTrigger','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','data1','data2'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1ca,0xa5));var _0xaa1c=function(_0x39b5bd,_0x398098){_0x39b5bd=_0x39b5bd-0x0;var _0x3791cb=_0xa1ca[_0x39b5bd];return _0x3791cb;};'use strict';var client=require(_0xaa1c('0x0'));exports[_0xaa1c('0x1')]=function(_0x23f003){return function(_0x2b9694){return client[_0xaa1c('0x2')](_0xaa1c('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xaa1c('0x4'),_0xaa1c('0x5')],'include':[{'model':_0xaa1c('0x6'),'as':_0xaa1c('0x7'),'attributes':['id',_0xaa1c('0x8'),_0xaa1c('0x9'),_0xaa1c('0xa')]},{'model':_0xaa1c('0x6'),'as':_0xaa1c('0xb'),'attributes':['id',_0xaa1c('0x8'),_0xaa1c('0x9'),_0xaa1c('0xa')]},{'model':_0xaa1c('0xc'),'as':'Actions','attributes':['id','action',_0xaa1c('0xd'),_0xaa1c('0xe'),'data3',_0xaa1c('0xf'),_0xaa1c('0x10'),_0xaa1c('0x11'),'data7']}]},'log':_0xaa1c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 58deb8f..37334b9 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 _0x7118=['defaultuser','GetTrunk','name','registry'];(function(_0x2c559c,_0x24bc86){var _0x1b9341=function(_0x13f7da){while(--_0x13f7da){_0x2c559c['push'](_0x2c559c['shift']());}};_0x1b9341(++_0x24bc86);}(_0x7118,0x159));var _0x8711=function(_0x52710b,_0x12ef92){_0x52710b=_0x52710b-0x0;var _0x52a48c=_0x7118[_0x52710b];return _0x52a48c;};'use strict';var client=require('../client');exports['getTrunks']=function(_0xc5dd3b){return function(_0xf50b2e){return client['Request'](_0x8711('0x0'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x8711('0x1'),_0x8711('0x2'),_0x8711('0x3')]},'log':_0x8711('0x0')});};}; \ No newline at end of file +var _0xbe9f=['registry','defaultuser','getTrunks','Request','GetTrunk','name'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0xbe9f,0xc2));var _0xfbe9=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xbe9f[_0x3070dc];return _0x431489;};'use strict';var client=require('../client');exports[_0xfbe9('0x0')]=function(_0x3d7cb9){return function(_0x25a09f){return client[_0xfbe9('0x1')](_0xfbe9('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xfbe9('0x3'),_0xfbe9('0x4'),_0xfbe9('0x5')]},'log':_0xfbe9('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 1ba8102..2838633 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x3a7f2d,_0x491411){var _0x1118d9=function(_0x8ce8f9){while(--_0x8ce8f9){_0x3a7f2d['push'](_0x3a7f2d['shift']());}};_0x1118d9(++_0x491411);}(_0xedd9,0xfc));var _0x9edd=function(_0xb1bae1,_0x171c58){_0xb1bae1=_0xb1bae1-0x0;var _0x2e25b7=_0xedd9[_0xb1bae1];return _0x2e25b7;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +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(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe706,0xa3));var _0x6e70=function(_0x3ad2e5,_0x94d414){_0x3ad2e5=_0x3ad2e5-0x0;var _0xc4e565=_0xe706[_0x3ad2e5];return _0xc4e565;};'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 e1b8c13..3ad57a9 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 _0x59ba=['../client','create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x4350c2,_0x112f3c){var _0x8b6406=function(_0x49e845){while(--_0x49e845){_0x4350c2['push'](_0x4350c2['shift']());}};_0x8b6406(++_0x112f3c);}(_0x59ba,0x1d1));var _0xa59b=function(_0x44959b,_0x57d7ad){_0x44959b=_0x44959b-0x0;var _0x1bde09=_0x59ba[_0x44959b];return _0x1bde09;};'use strict';var client=require(_0xa59b('0x0'));exports[_0xa59b('0x1')]=function(_0x37139b){return client[_0xa59b('0x2')]('CreateVoiceAgentReport',{'body':_0x37139b,'log':_0xa59b('0x3')});};exports['update']=function(_0x33c5b0,_0x1f73a4,_0x34e606){return client[_0xa59b('0x2')](_0xa59b('0x4'),{'body':_0x33c5b0,'options':{'where':{'uniqueid':_0x1f73a4,'interface':_0x34e606,'agentcomplete':!![]}},'log':_0xa59b('0x4')});}; \ No newline at end of file +var _0x949a=['create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x949a,0x14e));var _0xa949=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x949a[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xa949('0x0'));exports[_0xa949('0x1')]=function(_0x4b5463){return client[_0xa949('0x2')](_0xa949('0x3'),{'body':_0x4b5463,'log':_0xa949('0x3')});};exports['update']=function(_0x4d73b9,_0x538c31,_0x49478b){return client[_0xa949('0x2')](_0xa949('0x4'),{'body':_0x4d73b9,'options':{'where':{'uniqueid':_0x538c31,'interface':_0x49478b,'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 dd11768..0a494d5 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 _0x7857=['format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','moment','util','lodash','../client','create','merge','calleridnum','context','callerid','DOCUMENTATION','outbound','startOf','day'];(function(_0x4cfe44,_0xfba57b){var _0xa33a19=function(_0xb780){while(--_0xb780){_0x4cfe44['push'](_0x4cfe44['shift']());}};_0xa33a19(++_0xfba57b);}(_0x7857,0x1e7));var _0x7785=function(_0x341a3f,_0x3bcf77){_0x341a3f=_0x341a3f-0x0;var _0x16d0e0=_0x7857[_0x341a3f];return _0x16d0e0;};'use strict';var moment=require(_0x7785('0x0'));var util=require(_0x7785('0x1'));var _=require(_0x7785('0x2'));var client=require(_0x7785('0x3'));exports[_0x7785('0x4')]=function(_0x1cd1f0){return client['Request']('CreateVoiceCallReport',{'body':_[_0x7785('0x5')](_0x1cd1f0,{'source':_0x1cd1f0[_0x7785('0x6')],'destinationcontext':_0x1cd1f0[_0x7785('0x7')],'callerid':_0x1cd1f0[_0x7785('0x8')],'amaflags':_0x7785('0x9')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x7785('0xa')],'createdAt':{'$between':[moment()[_0x7785('0xb')](_0x7785('0xc'))[_0x7785('0xd')](_0x7785('0xe')),moment()[_0x7785('0xf')](_0x7785('0xc'))[_0x7785('0xd')](_0x7785('0xe'))]}},'attributes':[_0x7785('0x10'),_0x7785('0x11'),_0x7785('0x12'),_0x7785('0x13')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x1ef4=['type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','Request','CreateVoiceCallReport','merge','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','format'];(function(_0x5b142f,_0x10815a){var _0x327bbd=function(_0x56806f){while(--_0x56806f){_0x5b142f['push'](_0x5b142f['shift']());}};_0x327bbd(++_0x10815a);}(_0x1ef4,0x1d0));var _0x41ef=function(_0x142ac5,_0x26fffe){_0x142ac5=_0x142ac5-0x0;var _0x3f61ec=_0x1ef4[_0x142ac5];return _0x3f61ec;};'use strict';var moment=require('moment');var util=require(_0x41ef('0x0'));var _=require(_0x41ef('0x1'));var client=require('../client');exports['create']=function(_0x45bcf2){return client[_0x41ef('0x2')](_0x41ef('0x3'),{'body':_[_0x41ef('0x4')](_0x45bcf2,{'source':_0x45bcf2['calleridnum'],'destinationcontext':_0x45bcf2['context'],'callerid':_0x45bcf2[_0x41ef('0x5')],'amaflags':_0x41ef('0x6')}),'log':_0x41ef('0x3')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x41ef('0x7'),{'options':{'where':{'type':[_0x41ef('0x8')],'createdAt':{'$between':[moment()[_0x41ef('0x9')]('day')['format'](_0x41ef('0xa')),moment()['endOf']('day')[_0x41ef('0xb')](_0x41ef('0xa'))]}},'attributes':[_0x41ef('0xc'),_0x41ef('0xd'),_0x41ef('0xe'),_0x41ef('0xf')]},'log':_0x41ef('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 45f7c2b..a8c9ae5 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 _0x9b7b=['create','Request','CreateVoiceDialReport','../client'];(function(_0x463f89,_0xf317cf){var _0x1e0849=function(_0x1cd10b){while(--_0x1cd10b){_0x463f89['push'](_0x463f89['shift']());}};_0x1e0849(++_0xf317cf);}(_0x9b7b,0x11f));var _0xb9b7=function(_0x14b986,_0x2b54cf){_0x14b986=_0x14b986-0x0;var _0x432b5b=_0x9b7b[_0x14b986];return _0x432b5b;};'use strict';var client=require(_0xb9b7('0x0'));exports[_0xb9b7('0x1')]=function(_0x54dc76){return client[_0xb9b7('0x2')](_0xb9b7('0x3'),{'body':_0x54dc76,'log':_0xb9b7('0x3')});}; \ No newline at end of file +var _0x3adc=['../client','CreateVoiceDialReport'];(function(_0xc5bcae,_0x133a6d){var _0x412869=function(_0x32cbc3){while(--_0x32cbc3){_0xc5bcae['push'](_0xc5bcae['shift']());}};_0x412869(++_0x133a6d);}(_0x3adc,0x8a));var _0xc3ad=function(_0xf44882,_0x578ff7){_0xf44882=_0xf44882-0x0;var _0x25d0c7=_0x3adc[_0xf44882];return _0x25d0c7;};'use strict';var client=require(_0xc3ad('0x0'));exports['create']=function(_0x5e71af){return client['Request'](_0xc3ad('0x1'),{'body':_0x5e71af,'log':_0xc3ad('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 0db101f..e57a451 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 _0x8db0=['recordingFormat','../client','getVoiceExtensions','GetVoiceExtension','exten'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x8db0,0x65));var _0x08db=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x8db0[_0x4ea69d];return _0x5318e0;};'use strict';var client=require(_0x08db('0x0'));exports[_0x08db('0x1')]=function(){return function(){return client['Request'](_0x08db('0x2'),{'options':{'raw':!![],'attributes':['id',_0x08db('0x3'),_0x08db('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x26c2=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0x26c2,0x130));var _0x226c=function(_0x3fd86c,_0x57ef35){_0x3fd86c=_0x3fd86c-0x0;var _0x5cb629=_0x26c2[_0x3fd86c];return _0x5cb629;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0x226c('0x0'),{'options':{'raw':!![],'attributes':['id',_0x226c('0x1'),_0x226c('0x2')],'where':{'VoiceExtensionId':null}},'log':_0x226c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 1c2da3e..a4a5bc3 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 _0xa46e=['dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPreviewAutoRecallMe','callerid','active','Pause','TrunkBackup','Interval','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw','autopause','type','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone'];(function(_0x29fa3d,_0x45d24f){var _0x5d4bbf=function(_0x5b89ef){while(--_0x5b89ef){_0x29fa3d['push'](_0x29fa3d['shift']());}};_0x5d4bbf(++_0x45d24f);}(_0xa46e,0x8a));var _0xea46=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0xa46e[_0x4226d6];return _0x19655b;};'use strict';var client=require(_0xea46('0x0'));exports[_0xea46('0x1')]=function(){return function(){return client['Request'](_0xea46('0x2'),{'options':{'raw':![],'attributes':['id',_0xea46('0x3'),_0xea46('0x4'),'acwTimeout',_0xea46('0x5'),'monitor_format',_0xea46('0x6'),'dialActive',_0xea46('0x7'),'dialLimitChannel',_0xea46('0x8'),_0xea46('0x9'),'dialPredictiveOptimization',_0xea46('0xa'),_0xea46('0xb'),_0xea46('0xc'),_0xea46('0xd'),_0xea46('0xe'),'dialQueueOptions','dialQueueTimeout','dialQueueProject',_0xea46('0xf'),_0xea46('0x10'),'dialBusyMaxRetry',_0xea46('0x11'),_0xea46('0x12'),_0xea46('0x13'),'dialGlobalMaxRetry',_0xea46('0x14'),_0xea46('0x15'),'dialPrefix',_0xea46('0x16'),_0xea46('0x17'),'dialAMDInitialSilence',_0xea46('0x18'),'dialAMDAfterGreetingSilence',_0xea46('0x19'),_0xea46('0x1a'),_0xea46('0x1b'),_0xea46('0x1c'),_0xea46('0x1d'),_0xea46('0x1e'),_0xea46('0x1f'),_0xea46('0x20'),_0xea46('0x21'),'dialOrderByScheduledAt',_0xea46('0x22'),_0xea46('0x23'),_0xea46('0x24'),'monitor_format','strategy',_0xea46('0x25'),_0xea46('0x26'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0xea46('0x27'),_0xea46('0x28'),'dialAbandonedMaxRetry',_0xea46('0x29'),_0xea46('0x2a'),_0xea46('0x2b'),_0xea46('0x2c'),'dialAgentRejectRetryFrequency',_0xea46('0x2d'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0xea46('0x2e')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id','name',_0xea46('0x2f'),_0xea46('0x30')]},{'model':_0xea46('0x31'),'as':'mandatoryDispositionPause','attributes':['id',_0xea46('0x3')]},{'model':'Trunk','as':_0xea46('0x32'),'attributes':['id',_0xea46('0x3'),'callerid',_0xea46('0x30')]},{'model':'Interval','as':_0xea46('0x33'),'attributes':['id',_0xea46('0x3')],'include':[{'model':_0xea46('0x33'),'as':'Intervals','attributes':['id','name',_0xea46('0x34')]}]}]},'log':_0xea46('0x1')});};}; \ No newline at end of file +var _0x04f9=['Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallInQueue','dialOrderByScheduledAt','strategy','dialCutDigit','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues'];(function(_0x16b672,_0x29071e){var _0x2d69d2=function(_0x9c9afd){while(--_0x9c9afd){_0x16b672['push'](_0x16b672['shift']());}};_0x2d69d2(++_0x29071e);}(_0x04f9,0xb3));var _0x904f=function(_0x1b1da2,_0xe90b24){_0x1b1da2=_0x1b1da2-0x0;var _0x538381=_0x04f9[_0x1b1da2];return _0x538381;};'use strict';var client=require('../client');exports[_0x904f('0x0')]=function(){return function(){return client[_0x904f('0x1')](_0x904f('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x904f('0x3'),_0x904f('0x4'),_0x904f('0x5'),_0x904f('0x6'),_0x904f('0x7'),_0x904f('0x8'),'dialMethod',_0x904f('0x9'),_0x904f('0xa'),_0x904f('0xb'),_0x904f('0xc'),_0x904f('0xd'),'dialPredictiveInterval',_0x904f('0xe'),_0x904f('0xf'),_0x904f('0x10'),'dialQueueOptions',_0x904f('0x11'),_0x904f('0x12'),_0x904f('0x13'),_0x904f('0x14'),_0x904f('0x15'),_0x904f('0x16'),_0x904f('0x17'),_0x904f('0x18'),_0x904f('0x19'),_0x904f('0x1a'),_0x904f('0x1b'),_0x904f('0x1c'),_0x904f('0x1d'),_0x904f('0x1e'),_0x904f('0x1f'),_0x904f('0x20'),_0x904f('0x21'),_0x904f('0x22'),_0x904f('0x23'),_0x904f('0x24'),_0x904f('0x25'),_0x904f('0x26'),_0x904f('0x27'),'timeout','dialRecallMeTimeout',_0x904f('0x28'),_0x904f('0x29'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2',_0x904f('0x6'),_0x904f('0x2a'),'dialRandomLastDigitCallerIdNumber',_0x904f('0x2b'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency',_0x904f('0x2c'),_0x904f('0x2d'),'dialAgentRejectMaxRetry',_0x904f('0x2e'),_0x904f('0x2f'),_0x904f('0x30'),'dialPredictiveIntervalMinThreshold',_0x904f('0x31')],'include':[{'model':_0x904f('0x32'),'as':_0x904f('0x32'),'attributes':['id',_0x904f('0x33'),_0x904f('0x34'),_0x904f('0x35')]},{'model':_0x904f('0x36'),'as':_0x904f('0x37'),'attributes':['id',_0x904f('0x33')]},{'model':_0x904f('0x32'),'as':_0x904f('0x38'),'attributes':['id',_0x904f('0x33'),_0x904f('0x34'),_0x904f('0x35')]},{'model':_0x904f('0x39'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x904f('0x39'),'as':_0x904f('0x3a'),'attributes':['id','name',_0x904f('0x3b')]}]}]},'log':_0x904f('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index b43f372..14a5bc7 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(_0xb422ee,_0x23107d){var _0x2cbdfa=function(_0x482e7e){while(--_0x482e7e){_0xb422ee['push'](_0xb422ee['shift']());}};_0x2cbdfa(++_0x23107d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x54cb92,_0x2332e5){var _0x13a6a2=function(_0x500cd7){while(--_0x500cd7){_0x54cb92['push'](_0x54cb92['shift']());}};_0x13a6a2(++_0x2332e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 e6dbec9..37cccd2 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 _0x3771=['getVoiceQueueRtPauses','../client','Request'];(function(_0x446208,_0xb483fb){var _0xe49563=function(_0x1d3a21){while(--_0x1d3a21){_0x446208['push'](_0x446208['shift']());}};_0xe49563(++_0xb483fb);}(_0x3771,0x139));var _0x1377=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x3771[_0x50007c];return _0x5c1ec7;};'use strict';var client=require(_0x1377('0x0'));exports['getVoiceQueueRtPauses']=function(_0x3e280f){return function(){return client[_0x1377('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x3e280f,'paused':!![]},'raw':!![]},'log':_0x1377('0x2')});};}; \ No newline at end of file +var _0x0f01=['getVoiceQueueRtPauses','../client','GetVoiceQueueRtPauses'];(function(_0xd73be6,_0x15e94d){var _0x155ad0=function(_0x5f28ec){while(--_0x5f28ec){_0xd73be6['push'](_0xd73be6['shift']());}};_0x155ad0(++_0x15e94d);}(_0x0f01,0x7f));var _0x10f0=function(_0x44b5f6,_0xa66e98){_0x44b5f6=_0x44b5f6-0x0;var _0x439ac8=_0x0f01[_0x44b5f6];return _0x439ac8;};'use strict';var client=require(_0x10f0('0x0'));exports['getVoiceQueueRtPauses']=function(_0x495b9f){return function(){return client['Request'](_0x10f0('0x1'),{'options':{'where':{'VoiceQueueId':_0x495b9f,'paused':!![]},'raw':!![]},'log':_0x10f0('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 25fdb95..a5fd4fd 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x38fbd8,_0x38eaf0){var _0x4f31be=function(_0x3bd2c5){while(--_0x3bd2c5){_0x38fbd8['push'](_0x38fbd8['shift']());}};_0x4f31be(++_0x38eaf0);}(_0x7a54,0x106));var _0x47a5=function(_0x1f95bb,_0x3f339a){_0x1f95bb=_0x1f95bb-0x0;var _0x5b3a69=_0x7a54[_0x1f95bb];return _0x5b3a69;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x250a32,_0x2b233c){var _0x80086=function(_0x1a6d3a){while(--_0x1a6d3a){_0x250a32['push'](_0x250a32['shift']());}};_0x80086(++_0x2b233c);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 b4235e5..823c3ca 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 _0x5b19=['secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x5b19,0xfc));var _0x95b1=function(_0x1732c3,_0x13534b){_0x1732c3=_0x1732c3-0x0;var _0x3458e5=_0x5b19[_0x1732c3];return _0x3458e5;};'use strict';var client=require(_0x95b1('0x0'));exports[_0x95b1('0x1')]={};exports[_0x95b1('0x2')]=function(_0x1f1781){return client[_0x95b1('0x3')](_0x95b1('0x4'),{'body':{'result':_0x1f1781['result'],'transfererchannel':_0x1f1781[_0x95b1('0x5')],'transferercalleridnum':_0x1f1781['transferercalleridnum'],'transferercalleridname':_0x1f1781['transferercalleridname'],'transfererconnectedlinenum':_0x1f1781[_0x95b1('0x6')],'transfererconnectedlinename':_0x1f1781[_0x95b1('0x7')],'transfereraccountcode':_0x1f1781[_0x95b1('0x8')],'transferercontext':_0x1f1781[_0x95b1('0x9')],'transfererexten':_0x1f1781[_0x95b1('0xa')],'transfererlinkedid':_0x1f1781['transfererlinkedid'],'transfereechannel':_0x1f1781['transfereechannel'],'transfereecalleridnum':_0x1f1781[_0x95b1('0xb')],'transfereecalleridname':_0x1f1781[_0x95b1('0xc')],'transfereeconnectedlinenum':_0x1f1781[_0x95b1('0xd')],'transfereeconnectedlinename':_0x1f1781[_0x95b1('0xe')],'transfereeaccountcode':_0x1f1781[_0x95b1('0xf')],'transfereecontext':_0x1f1781['transfereecontext'],'transfereeexten':_0x1f1781[_0x95b1('0x10')],'transfereelinkedid':_0x1f1781[_0x95b1('0x11')],'isexternal':_0x1f1781[_0x95b1('0x12')],'context':_0x1f1781[_0x95b1('0x13')],'extension':_0x1f1781[_0x95b1('0x14')],'type':_0x95b1('0x15')},'log':_0x95b1('0x4')});};exports[_0x95b1('0x16')]=function(_0x37731c){return client[_0x95b1('0x3')](_0x95b1('0x4'),{'body':{'result':_0x37731c['result'],'transfererchannel':_0x37731c[_0x95b1('0x17')],'transferercalleridnum':_0x37731c[_0x95b1('0x18')],'transferercalleridname':_0x37731c[_0x95b1('0x19')],'transfererconnectedlinenum':_0x37731c[_0x95b1('0x1a')],'transfererconnectedlinename':_0x37731c['secondtransfererconnectedlinename'],'transfereraccountcode':_0x37731c[_0x95b1('0x1b')],'transferercontext':_0x37731c[_0x95b1('0x1c')],'transfererexten':_0x37731c[_0x95b1('0x1d')],'transfererlinkedid':_0x37731c[_0x95b1('0x1e')],'transfereechannel':_0x37731c['transfertargetchannel'],'transfereecalleridnum':_0x37731c[_0x95b1('0x1f')],'transfereecalleridname':_0x37731c[_0x95b1('0x20')],'transfereeconnectedlinenum':_0x37731c['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x37731c[_0x95b1('0x21')],'transfereeaccountcode':_0x37731c['transfertargetaccountcode'],'transfereecontext':_0x37731c[_0x95b1('0x22')],'transfereeexten':_0x37731c[_0x95b1('0x23')],'transfereelinkedid':_0x37731c[_0x95b1('0x24')],'isexternal':_0x37731c[_0x95b1('0x12')],'context':_0x37731c[_0x95b1('0x25')],'extension':_0x37731c[_0x95b1('0x26')],'type':_0x95b1('0x27')},'log':_0x95b1('0x4')});}; \ No newline at end of file +var _0x1b1d=['transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','attendedTransfer','Request','result','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','CreateVoiceTransferReport'];(function(_0xef1df0,_0xcfa265){var _0x2bef55=function(_0x1596b4){while(--_0x1596b4){_0xef1df0['push'](_0xef1df0['shift']());}};_0x2bef55(++_0xcfa265);}(_0x1b1d,0x17e));var _0xd1b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b1d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd1b1('0x0'));exports[_0xd1b1('0x1')]={};exports['blindTransfer']=function(_0x565d30){return client['Request'](_0xd1b1('0x2'),{'body':{'result':_0x565d30['result'],'transfererchannel':_0x565d30[_0xd1b1('0x3')],'transferercalleridnum':_0x565d30[_0xd1b1('0x4')],'transferercalleridname':_0x565d30['transferercalleridname'],'transfererconnectedlinenum':_0x565d30[_0xd1b1('0x5')],'transfererconnectedlinename':_0x565d30[_0xd1b1('0x6')],'transfereraccountcode':_0x565d30[_0xd1b1('0x7')],'transferercontext':_0x565d30[_0xd1b1('0x8')],'transfererexten':_0x565d30[_0xd1b1('0x9')],'transfererlinkedid':_0x565d30[_0xd1b1('0xa')],'transfereechannel':_0x565d30['transfereechannel'],'transfereecalleridnum':_0x565d30[_0xd1b1('0xb')],'transfereecalleridname':_0x565d30[_0xd1b1('0xc')],'transfereeconnectedlinenum':_0x565d30['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x565d30[_0xd1b1('0xd')],'transfereeaccountcode':_0x565d30[_0xd1b1('0xe')],'transfereecontext':_0x565d30[_0xd1b1('0xf')],'transfereeexten':_0x565d30[_0xd1b1('0x10')],'transfereelinkedid':_0x565d30[_0xd1b1('0x11')],'isexternal':_0x565d30[_0xd1b1('0x12')],'context':_0x565d30['context'],'extension':_0x565d30['extension'],'type':'blind'},'log':_0xd1b1('0x2')});};exports[_0xd1b1('0x13')]=function(_0x2ea6d0){return client[_0xd1b1('0x14')]('CreateVoiceTransferReport',{'body':{'result':_0x2ea6d0[_0xd1b1('0x15')],'transfererchannel':_0x2ea6d0['origtransfererchannel'],'transferercalleridnum':_0x2ea6d0[_0xd1b1('0x16')],'transferercalleridname':_0x2ea6d0[_0xd1b1('0x17')],'transfererconnectedlinenum':_0x2ea6d0[_0xd1b1('0x18')],'transfererconnectedlinename':_0x2ea6d0[_0xd1b1('0x19')],'transfereraccountcode':_0x2ea6d0[_0xd1b1('0x1a')],'transferercontext':_0x2ea6d0[_0xd1b1('0x1b')],'transfererexten':_0x2ea6d0['secondtransfererexten'],'transfererlinkedid':_0x2ea6d0[_0xd1b1('0x1c')],'transfereechannel':_0x2ea6d0['transfertargetchannel'],'transfereecalleridnum':_0x2ea6d0['transfertargetcalleridnum'],'transfereecalleridname':_0x2ea6d0['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2ea6d0[_0xd1b1('0x1d')],'transfereeconnectedlinename':_0x2ea6d0['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2ea6d0[_0xd1b1('0x1e')],'transfereecontext':_0x2ea6d0[_0xd1b1('0x1f')],'transfereeexten':_0x2ea6d0['transfertargetexten'],'transfereelinkedid':_0x2ea6d0[_0xd1b1('0x20')],'isexternal':_0x2ea6d0[_0xd1b1('0x12')],'context':_0x2ea6d0[_0xd1b1('0x21')],'extension':_0x2ea6d0['origtransfererexten'],'type':_0xd1b1('0x22')},'log':_0xd1b1('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index ec91853..6b668fe 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 _0xa46e=['custom:','send','server','http','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','validate','bluebird','moment','../properties','listen','format','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','Action','message','catch','Command','then','content','hasOwnProperty','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','callerid','Interval','push','length','find','voiceQueues','omit','undefined','values','voicechannel','map','channels','uniqueid','%s.%s','filename','wav','channel','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','Hangup','Redirect','exten','telephones','trunks','outboundChannels','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa46e,0x8a));var _0xea46=function(_0x2998db,_0x3424f1){_0x2998db=_0x2998db-0x0;var _0x115fea=_0xa46e[_0x2998db];return _0x115fea;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var jayson=require('jayson/promise');var schema=require(_0xea46('0x2'));var BPromise=require(_0xea46('0x3'));var moment=require(_0xea46('0x4'));var config=require('../../../config/environment');var properties=require(_0xea46('0x5'));var ami=require('../ami');exports[_0xea46('0x6')]=function(_0x47d633,_0x3599fc,_0x528404){return new BPromise(function(_0x10bee5,_0x3dc26f){var _0x5f1cd1={'QueuePause':function(_0x2d1b30){return new Promise(function(_0x42771a,_0xe7d428){var _0x3db7a2=util[_0xea46('0x7')]('%s/%s','SIP',_0x2d1b30['name']);if(_0x47d633[_0xea46('0x8')]&&_0x47d633[_0xea46('0x8')][_0x3db7a2]&&_0x47d633['timers'][_0x3db7a2][_0xea46('0x9')]){_0x47d633[_0xea46('0x8')][_0x3db7a2][_0xea46('0xa')]();}if(_0x47d633['agents'][_0x3db7a2]){_0x47d633[_0xea46('0xb')][_0x3db7a2][_0xea46('0xc')]({'statePause':_0x2d1b30['pause']?!![]:![]});}_0x42771a({'code':0xc8,'message':_0xea46('0xd')});});},'Reload':function(_0x1a4fe2){var _0x534aa3=this;return new Promise(function(_0x20955e,_0x4e4d3f){if(ami[_0xea46('0xe')]()==![]){return _0x4e4d3f(_0x534aa3[_0xea46('0xf')](0x1f4,[config[_0xea46('0x10')]['ip'],config[_0xea46('0x10')][_0xea46('0x11')],_0xea46('0x12')][_0xea46('0x13')]('\x20')));}_0x1a4fe2=_[_0xea46('0x14')](_0x1a4fe2,_[_0xea46('0x15')](properties['module']));_0x1a4fe2[_0xea46('0x16')]=_0xea46('0x17');return ami[_0xea46('0x18')](_0x1a4fe2)['then'](function(_0x58b4da){_0x20955e({'code':0xc8,'message':_0x58b4da[_0xea46('0x19')]});})[_0xea46('0x1a')](function(_0x5cf5dd){_0x4e4d3f(_0x534aa3['error'](0x1f5,_0x5cf5dd[_0xea46('0x19')]));});});},'Command':function(_0x9b7d04){var _0x4ff93d=this;return new Promise(function(_0x40316b,_0x16ae38){if(ami[_0xea46('0xe')]()==![]){return _0x16ae38(_0x4ff93d[_0xea46('0xf')](0x1f4,[config['asterisk']['ip'],config[_0xea46('0x10')]['username'],'ami\x20disconnected'][_0xea46('0x13')]('\x20')));}_0x9b7d04=_['pick'](_0x9b7d04,'command');_0x9b7d04['action']=_0xea46('0x1b');return ami[_0xea46('0x18')](_0x9b7d04)[_0xea46('0x1c')](function(_0x5beb44){_0x40316b({'code':0xc8,'message':_0x5beb44[_0xea46('0x1d')]});})['catch'](function(_0x12e688){_0x16ae38(_0x4ff93d[_0xea46('0xf')](0x1f5,_0x12e688['message']));});});},'VoiceQueues':function(_0xac33c3){return new Promise(function(_0x5480eb,_0x2b3a8f){var _0x114bf9=[];for(var _0xd4cf78 in _0x47d633['voiceQueues']){if(_0x47d633['voiceQueues'][_0xea46('0x1e')](_0xd4cf78)){var _0x38ac07=_0x47d633['voiceQueues'][_0xd4cf78];var _0x3b3928={'id':_0x38ac07['id'],'name':_0x38ac07['name'],'strategy':_0x38ac07[_0xea46('0x1f')],'answered':_0x38ac07['answered'],'available':_0x38ac07[_0xea46('0x20')],'loggedIn':_0x38ac07[_0xea46('0x21')],'pTalking':_0x38ac07[_0xea46('0x22')],'sumBillable':_0x38ac07[_0xea46('0x23')],'sumDuration':_0x38ac07[_0xea46('0x24')],'sumHoldTime':_0x38ac07[_0xea46('0x25')]||0x0,'talking':_0x38ac07['talking'],'total':_0x38ac07[_0xea46('0x26')],'type':_0x38ac07[_0xea46('0x27')],'unmanaged':_0x38ac07[_0xea46('0x28')],'abandoned':_0x38ac07['abandoned'],'waiting':_0x38ac07[_0xea46('0x29')],'loggedInDb':_0x38ac07[_0xea46('0x2a')]};if(_0x38ac07[_0xea46('0x27')]==='outbound'){_0x3b3928['dialActive']=_0x38ac07['dialActive'];_0x3b3928[_0xea46('0x2b')]=_0x38ac07[_0xea46('0x2b')];_0x3b3928[_0xea46('0x2c')]=_0x38ac07[_0xea46('0x2c')];_0x3b3928[_0xea46('0x2d')]=_0x38ac07[_0xea46('0x2d')];_0x3b3928[_0xea46('0x2e')]=_0x38ac07[_0xea46('0x2e')];_0x3b3928[_0xea46('0x2f')]=_0x38ac07[_0xea46('0x2f')];_0x3b3928[_0xea46('0x30')]=_0x38ac07['temp'];_0x3b3928[_0xea46('0x31')]=_0x38ac07[_0xea46('0x31')];_0x3b3928[_0xea46('0x32')]=_0x38ac07[_0xea46('0x32')];_0x3b3928[_0xea46('0x33')]=_0x38ac07[_0xea46('0x33')];_0x3b3928[_0xea46('0x34')]=_0x38ac07['outboundBusyCallsDay'];_0x3b3928[_0xea46('0x35')]=_0x38ac07[_0xea46('0x35')];_0x3b3928[_0xea46('0x36')]=_0x38ac07[_0xea46('0x36')];_0x3b3928[_0xea46('0x37')]=_0x38ac07['outboundDropCallsDayCallersExit'];_0x3b3928['outboundDropCallsDayTimeout']=_0x38ac07[_0xea46('0x38')];_0x3b3928[_0xea46('0x39')]=_0x38ac07['outboundNoAnswerCallsDay'];_0x3b3928[_0xea46('0x3a')]=_0x38ac07[_0xea46('0x3a')];_0x3b3928[_0xea46('0x3b')]=_0x38ac07[_0xea46('0x3b')];_0x3b3928['outboundReCallsDay']=_0x38ac07['outboundReCallsDay'];_0x3b3928[_0xea46('0x3c')]=_0x38ac07['outboundRejectCallsDay'];_0x3b3928[_0xea46('0x3d')]=_0x38ac07[_0xea46('0x3d')];_0x3b3928['predictiveIntervalAnsweredCalls']=_0x38ac07[_0xea46('0x3e')];_0x3b3928[_0xea46('0x3f')]=_0x38ac07['predictiveIntervalAvgHoldtime'];_0x3b3928[_0xea46('0x40')]=_0x38ac07[_0xea46('0x40')];_0x3b3928['predictiveIntervalDroppedCallsCallersExit']=_0x38ac07[_0xea46('0x41')];_0x3b3928[_0xea46('0x42')]=_0x38ac07[_0xea46('0x42')];_0x3b3928[_0xea46('0x43')]=_0x38ac07['predictiveIntervalErlangCalls'];_0x3b3928[_0xea46('0x44')]=_0x38ac07[_0xea46('0x44')];_0x3b3928[_0xea46('0x45')]=_0x38ac07[_0xea46('0x45')];_0x3b3928[_0xea46('0x46')]=_0x38ac07['predictiveIntervalMultiplicativeFactor'];_0x3b3928[_0xea46('0x47')]=_0x38ac07[_0xea46('0x47')];_0x3b3928['predictiveIntervalAvailable']=_0x38ac07[_0xea46('0x48')];_0x3b3928[_0xea46('0x49')]=_0x38ac07[_0xea46('0x49')];_0x3b3928[_0xea46('0x19')]=_0x38ac07['message'];_0x3b3928[_0xea46('0x4a')]=_0x38ac07[_0xea46('0x4a')];_0x3b3928[_0xea46('0x4b')]=_0x38ac07['erlangCalls'];_0x3b3928[_0xea46('0x4c')]=_0x38ac07[_0xea46('0x4c')];_0x3b3928[_0xea46('0x4d')]=_0x38ac07[_0xea46('0x4d')];_0x3b3928[_0xea46('0x4e')]=_0x38ac07[_0xea46('0x4e')];_0x3b3928[_0xea46('0x4f')]=_0x38ac07[_0xea46('0x4f')];_0x3b3928[_0xea46('0x50')]=_0x38ac07[_0xea46('0x50')];}if(_0x38ac07[_0xea46('0x51')]){_0x3b3928[_0xea46('0x51')]={'id':_0x38ac07[_0xea46('0x51')]['id'],'name':_0x38ac07[_0xea46('0x51')][_0xea46('0x52')],'active':_0x38ac07['Trunk']['active'],'callerid':_0x38ac07[_0xea46('0x51')][_0xea46('0x53')]};}if(_0x38ac07[_0xea46('0x54')]){_0x3b3928[_0xea46('0x54')]={'id':_0x38ac07['Interval']['id'],'name':_0x38ac07['Interval']['name']};}_0x114bf9[_0xea46('0x55')](_0x3b3928);}}_0x5480eb({'count':_0x114bf9[_0xea46('0x56')],'rows':_0x114bf9});});},'UpdateVoiceQueue':function(_0x53a4d9){return new Promise(function(_0x25a278,_0x29caf0){var _0x18039b=_[_0xea46('0x57')](_0x47d633[_0xea46('0x58')],{'id':parseInt(_0x53a4d9['id'])});var _0x5c5eed=_[_0xea46('0x59')](_0x53a4d9,['id']);if(_0x18039b){for(var _0x4bd3f2 in _0x5c5eed){if(typeof _0x5c5eed[_0x4bd3f2]!==_0xea46('0x5a')&&typeof _0x18039b[_0x4bd3f2]!==_0xea46('0x5a')){_0x18039b[_0x4bd3f2]=_0x5c5eed[_0x4bd3f2];}}_0x25a278(_0x18039b);}else{_0x29caf0();}});},'VoiceChannels':function(_0x45ee37){return new Promise(function(_0x875507,_0x9c26cf){var _0x1260d1=_[_0xea46('0x5b')](_0x47d633['channels']);_0x875507({'count':_0x1260d1[_0xea46('0x56')],'rows':_0x1260d1});});},'VoiceChannelMixMonitor':function(_0x1fa670){var _0x53215a=this;return new Promise(function(_0x2a1fca,_0x42e305){if(ami[_0xea46('0xe')]()==![]){return _0x42e305(_0x53215a['error'](0x1f4,[config['asterisk']['ip'],config[_0xea46('0x10')][_0xea46('0x11')],_0xea46('0x12')][_0xea46('0x13')]('\x20')));}var _0x4641bf=schema(properties[_0xea46('0x5c')])[_0xea46('0x2')](_0x1fa670);if(_0x4641bf[_0xea46('0x56')]>0x0){return _0x42e305(_0x53215a[_0xea46('0xf')](0x1f4,_[_0xea46('0x5d')](_0x4641bf,'message')[_0xea46('0x13')](',\x20')));}var _0x5c8cc3=_[_0xea46('0x57')](_0x47d633[_0xea46('0x5e')],{'uniqueid':_0x1fa670[_0xea46('0x5f')]});if(_0x5c8cc3&&_0x5c8cc3['channel']){var _0x41feff=util[_0xea46('0x7')](_0xea46('0x60'),_0x1fa670[_0xea46('0x61')]||_0x1fa670['uniqueid'],_0x1fa670['format']||_0xea46('0x62'));return ami[_0xea46('0x18')]({'action':'MixMonitor','channel':_0x5c8cc3[_0xea46('0x63')],'file':_0x41feff,'options':'ai(mixmonitorid)'})[_0xea46('0x1c')](function(_0x3830fe){var _0x389e22=_[_0xea46('0x57')](_0x5c8cc3[_0xea46('0x64')],{'filename':_0xea46('0x65')+_0x41feff[_0xea46('0x66')]()});if(_['isNil'](_0x389e22)){_0x5c8cc3['monitors'][_0xea46('0x55')]({'filename':'/var/spool/asterisk/monitor/'+_0x41feff[_0xea46('0x66')](),'createdAt':moment()[_0xea46('0x7')](_0xea46('0x67')),'mixmonitorid':_0x3830fe['mixmonitorid'],'status':_0xea46('0x68')});}else{_0x389e22['mixmonitorid']=_0x3830fe[_0xea46('0x69')];_0x389e22[_0xea46('0x6a')]='rec';}_0x2a1fca({'code':0xc8,'message':[_0x1fa670['uniqueid'],_0xea46('0x6b'),_0x3830fe[_0xea46('0x69')]][_0xea46('0x13')]('\x20'),'mixmonitorid':_0x3830fe['mixmonitorid']});})[_0xea46('0x1a')](function(_0x5b4847){_0x42e305(_0x53215a[_0xea46('0xf')](0x1f5,[_0x1fa670['uniqueid'],_0x5b4847[_0xea46('0x19')][_0xea46('0x66')]()][_0xea46('0x13')]('\x20')));});}else{return _0x42e305(_0x53215a[_0xea46('0xf')](0x1f5,_0xea46('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x4c5beb){var _0x3af50c=this;return new Promise(function(_0x2659bd,_0x455bc2){if(ami['isConnected']()==![]){return _0x455bc2(_0x3af50c['error'](0x1f4,[config[_0xea46('0x10')]['ip'],config[_0xea46('0x10')][_0xea46('0x11')],_0xea46('0x12')][_0xea46('0x13')]('\x20')));}var _0x175a42=schema(properties[_0xea46('0x5c')])[_0xea46('0x2')](_0x4c5beb);if(_0x175a42[_0xea46('0x56')]>0x0){return _0x455bc2(_0x3af50c[_0xea46('0xf')](0x1f4,_[_0xea46('0x5d')](_0x175a42,_0xea46('0x19'))[_0xea46('0x13')](',\x20')));}var _0x219776=_[_0xea46('0x57')](_0x47d633['channels'],{'uniqueid':_0x4c5beb[_0xea46('0x5f')]});if(_0x219776){return BPromise[_0xea46('0x6d')]()[_0xea46('0x1c')](function(){if(_0x219776[_0xea46('0x63')]){return ami['Action']({'action':_0xea46('0x6e'),'channel':_0x219776[_0xea46('0x63')],'mixmonitorid':_0x4c5beb['mixmonitorid']})[_0xea46('0x1a')](function(_0x419f86){});}})['then'](function(){if(_0x219776[_0xea46('0x6f')]){return ami[_0xea46('0x18')]({'action':_0xea46('0x6e'),'channel':_0x219776['destinationchannel'],'mixmonitorid':_0x4c5beb[_0xea46('0x69')]})[_0xea46('0x1a')](function(_0x214b85){});}})['then'](function(_0x4cdb8a){var _0x587bd3=_[_0xea46('0x57')](_0x219776[_0xea46('0x64')],{'mixmonitorid':_0x4c5beb[_0xea46('0x69')]});if(_0x587bd3){_0x587bd3[_0xea46('0x6a')]=_0xea46('0x70');}})['then'](function(){var _0x6b69e7=util['format'](_0xea46('0x60'),_0x4c5beb[_0xea46('0x61')]||_0x4c5beb[_0xea46('0x5f')],_0x4c5beb['format']||'wav');var _0x2b8a8b=_[_0xea46('0x57')](_0x219776['monitors'],{'filename':_0xea46('0x65')+_0x6b69e7[_0xea46('0x66')]()});if(_0x2b8a8b){_0x2b8a8b[_0xea46('0x6a')]=_0xea46('0x70');}})[_0xea46('0x1c')](function(){_0x2659bd({'code':0xc8,'message':[_0x4c5beb['uniqueid'],_0xea46('0x71')][_0xea46('0x13')]('\x20')});})[_0xea46('0x1a')](function(_0x199d96){_0x455bc2(_0x3af50c[_0xea46('0xf')](0x1f5,[_0x4c5beb[_0xea46('0x5f')],_0x199d96[_0xea46('0x19')][_0xea46('0x66')]()]['join']('\x20')));});}else{return _0x455bc2(_0x3af50c[_0xea46('0xf')](0x1f5,_0xea46('0x6c')));}});},'VoiceQueuesChannels':function(_0x26e982){return new Promise(function(_0x7f99b2,_0x24cc2c){var _0x3d258e=_[_0xea46('0x5b')](_0x47d633['queueChannels']);_0x7f99b2({'count':_0x3d258e['length'],'rows':_0x3d258e});});},'VoiceQueuesChannel':function(_0x2bc9f6){var _0x1202c6=this;return new Promise(function(_0x123444,_0x3ba634){var _0x10e0e1=schema(properties[_0xea46('0x72')])[_0xea46('0x2')](_0x2bc9f6);if(_0x10e0e1[_0xea46('0x56')]>0x0){return _0x3ba634(_0x1202c6[_0xea46('0xf')](0x1f4,_[_0xea46('0x5d')](_0x10e0e1,_0xea46('0x19'))['join'](',\x20')));}var _0x204435=_[_0xea46('0x57')](_0x47d633[_0xea46('0x73')],{'uniqueid':_0x2bc9f6[_0xea46('0x5f')]});if(_0x204435){_0x123444(_0x204435);}else{return _0x3ba634(_0x1202c6['error'](0x1f5,_0xea46('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x34f8f9){var _0x31604c=this;return new Promise(function(_0x12f788,_0x5d26eb){if(ami[_0xea46('0xe')]()==![]){return _0x5d26eb(_0x31604c[_0xea46('0xf')](0x1f4,[config[_0xea46('0x10')]['ip'],config[_0xea46('0x10')]['username'],_0xea46('0x12')][_0xea46('0x13')]('\x20')));}var _0x50253d=schema(properties['voicequeuechannelhangup'])[_0xea46('0x2')](_0x34f8f9);if(_0x50253d[_0xea46('0x56')]>0x0){return _0x5d26eb(_0x31604c[_0xea46('0xf')](0x1f4,_[_0xea46('0x5d')](_0x50253d,_0xea46('0x19'))[_0xea46('0x13')](',\x20')));}var _0x1d5b31=_[_0xea46('0x57')](_0x47d633[_0xea46('0x73')],{'uniqueid':_0x34f8f9[_0xea46('0x5f')]});if(_0x1d5b31&&_0x1d5b31[_0xea46('0x63')]){return ami[_0xea46('0x18')]({'action':_0xea46('0x74'),'channel':_0x1d5b31['channel']})[_0xea46('0x1c')](function(_0xa8bfed){_0x12f788({'code':0xc8,'message':[_0x34f8f9['uniqueid'],_0xa8bfed[_0xea46('0x19')][_0xea46('0x66')]()][_0xea46('0x13')]('\x20')});})[_0xea46('0x1a')](function(_0x4bba61){_0x5d26eb(_0x31604c[_0xea46('0xf')](0x1f5,[_0x34f8f9['uniqueid'],_0x4bba61[_0xea46('0x19')][_0xea46('0x66')]()][_0xea46('0x13')]('\x20')));});}else{return _0x5d26eb(_0x31604c[_0xea46('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x237779){var _0x4c6d71=this;return new Promise(function(_0x4017da,_0x3f6978){if(ami['isConnected']()==![]){return _0x3f6978(_0x4c6d71[_0xea46('0xf')](0x1f4,[config[_0xea46('0x10')]['ip'],config['asterisk'][_0xea46('0x11')],_0xea46('0x12')]['join']('\x20')));}var _0x5e7a2c=schema(properties['voicequeuechannelredirect'])['validate'](_0x237779);if(_0x5e7a2c[_0xea46('0x56')]>0x0){return _0x3f6978(_0x4c6d71[_0xea46('0xf')](0x1f4,_[_0xea46('0x5d')](_0x5e7a2c,_0xea46('0x19'))[_0xea46('0x13')](',\x20')));}var _0xe6c28b=_[_0xea46('0x57')](_0x47d633[_0xea46('0x73')],{'uniqueid':_0x237779['uniqueid']});if(_0xe6c28b&&_0xe6c28b[_0xea46('0x63')]){return ami[_0xea46('0x18')]({'action':_0xea46('0x75'),'channel':_0xe6c28b[_0xea46('0x63')],'exten':_0x237779[_0xea46('0x76')],'context':_0x237779['context']||_0xe6c28b['context'],'priority':0x1})[_0xea46('0x1c')](function(_0x7e3ea4){_0x4017da({'code':0xc8,'message':[_0x237779[_0xea46('0x5f')],_0x7e3ea4[_0xea46('0x19')][_0xea46('0x66')]()]['join']('\x20')});})[_0xea46('0x1a')](function(_0x1b2383){_0x3f6978(_0x4c6d71['error'](0x1f5,[_0x237779['uniqueid'],_0x1b2383[_0xea46('0x19')][_0xea46('0x66')]()][_0xea46('0x13')]('\x20')));});}else{return _0x3f6978(_0x4c6d71[_0xea46('0xf')](0x1f5,_0xea46('0x6c')));}});},'Agents':function(_0x478db1){return new Promise(function(_0x299a48,_0x4c75b5){var _0x391b01=_[_0xea46('0x5b')](_0x47d633[_0xea46('0xb')]);_0x299a48({'count':_0x391b01[_0xea46('0x56')],'rows':_0x391b01});});},'Telephones':function(_0x55e8fb){return new Promise(function(_0xab4bba,_0x35e967){var _0x23d13e=_[_0xea46('0x5b')](_0x47d633[_0xea46('0x77')]);_0xab4bba({'count':_0x23d13e[_0xea46('0x56')],'rows':_0x23d13e});});},'Trunks':function(_0x46419a){return new Promise(function(_0x11641b,_0x2855f8){var _0x59b475=_[_0xea46('0x5b')](_0x47d633[_0xea46('0x78')]);_0x11641b({'count':_0x59b475['length'],'rows':_0x59b475});});},'OutboundChannels':function(_0x5a8e1b){return new Promise(function(_0x237c32,_0x2fc069){var _0x1bbc4e=_['values'](_0x47d633[_0xea46('0x79')]);_0x237c32({'count':_0x1bbc4e[_0xea46('0x56')],'rows':_0x1bbc4e});});},'Outbound':function(_0x565a67){return new Promise(function(_0x5e477d,_0x2e96ad){_0x5e477d(_0x47d633[_0xea46('0x7a')]);});},'Campaigns':function(_0xdaeb0f){return new Promise(function(_0xde7410,_0x6af502){var _0x4799fe=_[_0xea46('0x5b')](_0x47d633[_0xea46('0x7b')]);_0xde7410({'count':_0x4799fe['length'],'rows':_0x4799fe});});},'VoiceQueuesPreview':function(_0x1bbc55){var _0x2e2679=this;return new Promise(function(_0x2f985a,_0x4e2c45){_0x3599fc[_0xea46('0x7c')](_0x1bbc55['id'])[_0xea46('0x1c')](function(_0x89c609){_0x2f985a({'code':0xc8,'message':_0x89c609[_0xea46('0x19')]});})['catch'](function(_0x394ae5){_0x4e2c45(_0x2e2679[_0xea46('0xf')](0x1f4,_0x394ae5[_0xea46('0x19')]));});});},'EventManager':function(_0x20c8a3){var _0x59698a=this;return new Promise(function(_0x1c934b,_0x5d2231){if(!_0x20c8a3[_0xea46('0x7d')]){return _0x5d2231(_0x59698a[_0xea46('0xf')](0x1f4,_0xea46('0x7e')));}ami[_0xea46('0x7f')](_0xea46('0x80')+_0x20c8a3[_0xea46('0x7d')],_0x20c8a3[_0xea46('0x19')]);_0x1c934b({'code':0xc8,'message':_0x20c8a3});});},'FaxAccounts':function(_0x4cd7dd){return new Promise(function(_0x33f5a3,_0x45a97d){var _0x857744=_[_0xea46('0x5b')](_0x47d633['faxAccounts']);_0x33f5a3({'count':_0x857744[_0xea46('0x56')],'rows':_0x857744});});},'SendFax':function(_0x4d0f53){var _0x20b4bf=this;return new Promise(function(_0x55bd35,_0x5d0b19){_0x528404[_0xea46('0x81')](_0x4d0f53)[_0xea46('0x1c')](function(_0x1d5e79){_0x55bd35({'code':0xc8,'message':_0x1d5e79[_0xea46('0x19')]});})[_0xea46('0x1a')](function(_0x4db97e){_0x5d0b19(_0x20b4bf[_0xea46('0xf')](0x1f4,_0x4db97e[_0xea46('0x19')]));});});},'CheckAfterSend':function(_0xe805bb){var _0x2ca531=this;return new Promise(function(_0xd8c75b,_0x2879bc){_0x528404['checkAfterSend'](_0xe805bb)[_0xea46('0x1c')](function(_0xd2bc4c){_0xd8c75b({'code':0xc8,'message':_0xd2bc4c['message']});})[_0xea46('0x1a')](function(_0x53abbb){_0x2879bc(_0x2ca531[_0xea46('0xf')](0x1f4,_0x53abbb[_0xea46('0x19')]));});});}};var _0x367f04=jayson[_0xea46('0x82')](_0x5f1cd1)[_0xea46('0x83')]();_0x367f04['on'](_0xea46('0xf'),function(_0x5e4e96){return _0x3dc26f(_0x5e4e96);});_0x367f04['listen'](0x232a,'127.0.0.1',function(){console['log'](_0xea46('0x84'),0x232a);return _0x10bee5('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xd117=['bluebird','moment','../../../config/environment','../properties','../ami','listen','%s/%s','SIP','name','timers','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','Reload','Action','then','message','catch','command','content','voiceQueues','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','waiting','loggedInDb','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','undefined','values','channels','voicechannel','map','uniqueid','format','%s.%s','wav','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','filename','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','telephones','outbound','run','event','Event\x20name\x20mandatory','send','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate'];(function(_0x1ded79,_0x53ecc6){var _0x544fa6=function(_0x11b3e9){while(--_0x11b3e9){_0x1ded79['push'](_0x1ded79['shift']());}};_0x544fa6(++_0x53ecc6);}(_0xd117,0x182));var _0x7d11=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0xd117[_0x39caaa];return _0x9b9c7d;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var jayson=require(_0x7d11('0x2'));var schema=require(_0x7d11('0x3'));var BPromise=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var config=require(_0x7d11('0x6'));var properties=require(_0x7d11('0x7'));var ami=require(_0x7d11('0x8'));exports[_0x7d11('0x9')]=function(_0x589c51,_0x2689c6,_0x27d7e8){return new BPromise(function(_0x40c3c4,_0x345602){var _0x3c8d66={'QueuePause':function(_0x47b5e6){return new Promise(function(_0x3803b5,_0xffd020){var _0x2007c1=util['format'](_0x7d11('0xa'),_0x7d11('0xb'),_0x47b5e6[_0x7d11('0xc')]);if(_0x589c51['timers']&&_0x589c51[_0x7d11('0xd')][_0x2007c1]&&_0x589c51['timers'][_0x2007c1]['timer']){_0x589c51[_0x7d11('0xd')][_0x2007c1]['updateAcw']();}if(_0x589c51['agents'][_0x2007c1]){_0x589c51[_0x7d11('0xe')][_0x2007c1]['updateStatusRealtime']({'statePause':_0x47b5e6[_0x7d11('0xf')]?!![]:![]});}_0x3803b5({'code':0xc8,'message':_0x7d11('0x10')});});},'Reload':function(_0x5ee572){var _0x401bb7=this;return new Promise(function(_0x20f519,_0x4cda5d){if(ami[_0x7d11('0x11')]()==![]){return _0x4cda5d(_0x401bb7[_0x7d11('0x12')](0x1f4,[config[_0x7d11('0x13')]['ip'],config[_0x7d11('0x13')][_0x7d11('0x14')],_0x7d11('0x15')][_0x7d11('0x16')]('\x20')));}_0x5ee572=_[_0x7d11('0x17')](_0x5ee572,_['keys'](properties[_0x7d11('0x18')]));_0x5ee572[_0x7d11('0x19')]=_0x7d11('0x1a');return ami[_0x7d11('0x1b')](_0x5ee572)[_0x7d11('0x1c')](function(_0x528fdc){_0x20f519({'code':0xc8,'message':_0x528fdc[_0x7d11('0x1d')]});})[_0x7d11('0x1e')](function(_0x4d1306){_0x4cda5d(_0x401bb7['error'](0x1f5,_0x4d1306[_0x7d11('0x1d')]));});});},'Command':function(_0x52a6ae){var _0x1f9990=this;return new Promise(function(_0x5c0af8,_0xbe0a79){if(ami[_0x7d11('0x11')]()==![]){return _0xbe0a79(_0x1f9990[_0x7d11('0x12')](0x1f4,[config[_0x7d11('0x13')]['ip'],config[_0x7d11('0x13')][_0x7d11('0x14')],_0x7d11('0x15')][_0x7d11('0x16')]('\x20')));}_0x52a6ae=_['pick'](_0x52a6ae,_0x7d11('0x1f'));_0x52a6ae['action']='Command';return ami['Action'](_0x52a6ae)[_0x7d11('0x1c')](function(_0x3545dc){_0x5c0af8({'code':0xc8,'message':_0x3545dc[_0x7d11('0x20')]});})[_0x7d11('0x1e')](function(_0x355d14){_0xbe0a79(_0x1f9990[_0x7d11('0x12')](0x1f5,_0x355d14[_0x7d11('0x1d')]));});});},'VoiceQueues':function(_0x1c1edd){return new Promise(function(_0x5e2f2f,_0x36c2b4){var _0x577ca9=[];for(var _0x4bfa76 in _0x589c51['voiceQueues']){if(_0x589c51[_0x7d11('0x21')]['hasOwnProperty'](_0x4bfa76)){var _0x180e1e=_0x589c51[_0x7d11('0x21')][_0x4bfa76];var _0x328ab7={'id':_0x180e1e['id'],'name':_0x180e1e['name'],'strategy':_0x180e1e[_0x7d11('0x22')],'answered':_0x180e1e[_0x7d11('0x23')],'available':_0x180e1e[_0x7d11('0x24')],'loggedIn':_0x180e1e['loggedIn'],'pTalking':_0x180e1e[_0x7d11('0x25')],'sumBillable':_0x180e1e[_0x7d11('0x26')],'sumDuration':_0x180e1e[_0x7d11('0x27')],'sumHoldTime':_0x180e1e[_0x7d11('0x28')]||0x0,'talking':_0x180e1e['talking'],'total':_0x180e1e[_0x7d11('0x29')],'type':_0x180e1e['type'],'unmanaged':_0x180e1e[_0x7d11('0x2a')],'abandoned':_0x180e1e['abandoned'],'waiting':_0x180e1e[_0x7d11('0x2b')],'loggedInDb':_0x180e1e[_0x7d11('0x2c')]};if(_0x180e1e[_0x7d11('0x2d')]==='outbound'){_0x328ab7['dialActive']=_0x180e1e[_0x7d11('0x2e')];_0x328ab7[_0x7d11('0x2f')]=_0x180e1e['dialMethod'];_0x328ab7[_0x7d11('0x30')]=_0x180e1e[_0x7d11('0x30')];_0x328ab7[_0x7d11('0x31')]=_0x180e1e['dialOriginateCallerIdNumber'];_0x328ab7[_0x7d11('0x32')]=_0x180e1e['dialOriginateTimeout'];_0x328ab7['dialPrefix']=_0x180e1e[_0x7d11('0x33')];_0x328ab7['temp']=_0x180e1e[_0x7d11('0x34')];_0x328ab7[_0x7d11('0x35')]=_0x180e1e[_0x7d11('0x35')];_0x328ab7[_0x7d11('0x36')]=_0x180e1e['outboundAnswerCallsDay'];_0x328ab7[_0x7d11('0x37')]=_0x180e1e[_0x7d11('0x37')];_0x328ab7['outboundBusyCallsDay']=_0x180e1e['outboundBusyCallsDay'];_0x328ab7[_0x7d11('0x38')]=_0x180e1e[_0x7d11('0x38')];_0x328ab7['outboundDropCallsDayACS']=_0x180e1e[_0x7d11('0x39')];_0x328ab7['outboundDropCallsDayCallersExit']=_0x180e1e['outboundDropCallsDayCallersExit'];_0x328ab7[_0x7d11('0x3a')]=_0x180e1e['outboundDropCallsDayTimeout'];_0x328ab7['outboundNoAnswerCallsDay']=_0x180e1e[_0x7d11('0x3b')];_0x328ab7[_0x7d11('0x3c')]=_0x180e1e[_0x7d11('0x3c')];_0x328ab7[_0x7d11('0x3d')]=_0x180e1e[_0x7d11('0x3d')];_0x328ab7[_0x7d11('0x3e')]=_0x180e1e[_0x7d11('0x3e')];_0x328ab7[_0x7d11('0x3f')]=_0x180e1e[_0x7d11('0x3f')];_0x328ab7[_0x7d11('0x40')]=_0x180e1e[_0x7d11('0x40')];_0x328ab7[_0x7d11('0x41')]=_0x180e1e['predictiveIntervalAnsweredCalls'];_0x328ab7[_0x7d11('0x42')]=_0x180e1e['predictiveIntervalAvgHoldtime'];_0x328ab7[_0x7d11('0x43')]=_0x180e1e[_0x7d11('0x43')];_0x328ab7[_0x7d11('0x44')]=_0x180e1e[_0x7d11('0x44')];_0x328ab7['predictiveIntervalDroppedCallsTimeout']=_0x180e1e[_0x7d11('0x45')];_0x328ab7[_0x7d11('0x46')]=_0x180e1e[_0x7d11('0x46')];_0x328ab7[_0x7d11('0x47')]=_0x180e1e['predictiveIntervalErlangCallsDroppedCalls'];_0x328ab7[_0x7d11('0x48')]=_0x180e1e['predictiveIntervalHitRate'];_0x328ab7[_0x7d11('0x49')]=_0x180e1e['predictiveIntervalMultiplicativeFactor'];_0x328ab7[_0x7d11('0x4a')]=_0x180e1e[_0x7d11('0x4a')];_0x328ab7[_0x7d11('0x4b')]=_0x180e1e[_0x7d11('0x4b')];_0x328ab7['predictiveIntervalTotalCalls']=_0x180e1e['predictiveIntervalTotalCalls'];_0x328ab7[_0x7d11('0x1d')]=_0x180e1e[_0x7d11('0x1d')];_0x328ab7['originated']=_0x180e1e[_0x7d11('0x4c')];_0x328ab7[_0x7d11('0x4d')]=_0x180e1e[_0x7d11('0x4d')];_0x328ab7[_0x7d11('0x4e')]=_0x180e1e[_0x7d11('0x4e')];_0x328ab7[_0x7d11('0x4f')]=_0x180e1e['erlangAbandonmentRate'];_0x328ab7[_0x7d11('0x50')]=_0x180e1e['erlangBusyFactor'];_0x328ab7[_0x7d11('0x51')]=_0x180e1e[_0x7d11('0x51')];_0x328ab7[_0x7d11('0x52')]=_0x180e1e[_0x7d11('0x52')];}if(_0x180e1e[_0x7d11('0x53')]){_0x328ab7[_0x7d11('0x53')]={'id':_0x180e1e['Trunk']['id'],'name':_0x180e1e['Trunk']['name'],'active':_0x180e1e[_0x7d11('0x53')][_0x7d11('0x54')],'callerid':_0x180e1e[_0x7d11('0x53')][_0x7d11('0x55')]};}if(_0x180e1e[_0x7d11('0x56')]){_0x328ab7['Interval']={'id':_0x180e1e[_0x7d11('0x56')]['id'],'name':_0x180e1e[_0x7d11('0x56')]['name']};}_0x577ca9[_0x7d11('0x57')](_0x328ab7);}}_0x5e2f2f({'count':_0x577ca9[_0x7d11('0x58')],'rows':_0x577ca9});});},'UpdateVoiceQueue':function(_0xeca3f6){return new Promise(function(_0x518ca2,_0x30358a){var _0x3bbc14=_[_0x7d11('0x59')](_0x589c51['voiceQueues'],{'id':parseInt(_0xeca3f6['id'])});var _0x38de7f=_['omit'](_0xeca3f6,['id']);if(_0x3bbc14){for(var _0xe5d2fe in _0x38de7f){if(typeof _0x38de7f[_0xe5d2fe]!==_0x7d11('0x5a')&&typeof _0x3bbc14[_0xe5d2fe]!==_0x7d11('0x5a')){_0x3bbc14[_0xe5d2fe]=_0x38de7f[_0xe5d2fe];}}_0x518ca2(_0x3bbc14);}else{_0x30358a();}});},'VoiceChannels':function(_0xbe357){return new Promise(function(_0xee795,_0x14cda1){var _0x161213=_[_0x7d11('0x5b')](_0x589c51[_0x7d11('0x5c')]);_0xee795({'count':_0x161213['length'],'rows':_0x161213});});},'VoiceChannelMixMonitor':function(_0x50d458){var _0x49a21c=this;return new Promise(function(_0x10c0e9,_0x1e5bb5){if(ami[_0x7d11('0x11')]()==![]){return _0x1e5bb5(_0x49a21c[_0x7d11('0x12')](0x1f4,[config[_0x7d11('0x13')]['ip'],config[_0x7d11('0x13')][_0x7d11('0x14')],_0x7d11('0x15')][_0x7d11('0x16')]('\x20')));}var _0x347567=schema(properties[_0x7d11('0x5d')])[_0x7d11('0x3')](_0x50d458);if(_0x347567['length']>0x0){return _0x1e5bb5(_0x49a21c[_0x7d11('0x12')](0x1f4,_[_0x7d11('0x5e')](_0x347567,_0x7d11('0x1d'))['join'](',\x20')));}var _0x503ebc=_[_0x7d11('0x59')](_0x589c51[_0x7d11('0x5c')],{'uniqueid':_0x50d458[_0x7d11('0x5f')]});if(_0x503ebc&&_0x503ebc['channel']){var _0x5e898c=util[_0x7d11('0x60')](_0x7d11('0x61'),_0x50d458['filename']||_0x50d458[_0x7d11('0x5f')],_0x50d458[_0x7d11('0x60')]||_0x7d11('0x62'));return ami[_0x7d11('0x1b')]({'action':'MixMonitor','channel':_0x503ebc[_0x7d11('0x63')],'file':_0x5e898c,'options':_0x7d11('0x64')})[_0x7d11('0x1c')](function(_0x503cef){var _0x4d0f77=_[_0x7d11('0x59')](_0x503ebc[_0x7d11('0x65')],{'filename':_0x7d11('0x66')+_0x5e898c[_0x7d11('0x67')]()});if(_[_0x7d11('0x68')](_0x4d0f77)){_0x503ebc['monitors'][_0x7d11('0x57')]({'filename':_0x7d11('0x66')+_0x5e898c[_0x7d11('0x67')](),'createdAt':moment()[_0x7d11('0x60')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x503cef['mixmonitorid'],'status':_0x7d11('0x69')});}else{_0x4d0f77[_0x7d11('0x6a')]=_0x503cef[_0x7d11('0x6a')];_0x4d0f77[_0x7d11('0x6b')]=_0x7d11('0x69');}_0x10c0e9({'code':0xc8,'message':[_0x50d458[_0x7d11('0x5f')],_0x7d11('0x6c'),_0x503cef[_0x7d11('0x6a')]][_0x7d11('0x16')]('\x20'),'mixmonitorid':_0x503cef[_0x7d11('0x6a')]});})['catch'](function(_0x4fb818){_0x1e5bb5(_0x49a21c['error'](0x1f5,[_0x50d458[_0x7d11('0x5f')],_0x4fb818[_0x7d11('0x1d')][_0x7d11('0x67')]()]['join']('\x20')));});}else{return _0x1e5bb5(_0x49a21c[_0x7d11('0x12')](0x1f5,_0x7d11('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x3b1762){var _0x32937c=this;return new Promise(function(_0x1f29f7,_0x178a3a){if(ami['isConnected']()==![]){return _0x178a3a(_0x32937c[_0x7d11('0x12')](0x1f4,[config[_0x7d11('0x13')]['ip'],config[_0x7d11('0x13')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x5a88f4=schema(properties[_0x7d11('0x5d')])['validate'](_0x3b1762);if(_0x5a88f4['length']>0x0){return _0x178a3a(_0x32937c['error'](0x1f4,_[_0x7d11('0x5e')](_0x5a88f4,_0x7d11('0x1d'))[_0x7d11('0x16')](',\x20')));}var _0x407f2c=_[_0x7d11('0x59')](_0x589c51[_0x7d11('0x5c')],{'uniqueid':_0x3b1762['uniqueid']});if(_0x407f2c){return BPromise[_0x7d11('0x6e')]()['then'](function(){if(_0x407f2c[_0x7d11('0x63')]){return ami['Action']({'action':_0x7d11('0x6f'),'channel':_0x407f2c[_0x7d11('0x63')],'mixmonitorid':_0x3b1762['mixmonitorid']})[_0x7d11('0x1e')](function(_0x49c9b6){});}})[_0x7d11('0x1c')](function(){if(_0x407f2c[_0x7d11('0x70')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x407f2c[_0x7d11('0x70')],'mixmonitorid':_0x3b1762[_0x7d11('0x6a')]})[_0x7d11('0x1e')](function(_0x4027f8){});}})[_0x7d11('0x1c')](function(_0x492183){var _0x2b9ba0=_['find'](_0x407f2c[_0x7d11('0x65')],{'mixmonitorid':_0x3b1762[_0x7d11('0x6a')]});if(_0x2b9ba0){_0x2b9ba0[_0x7d11('0x6b')]=_0x7d11('0x71');}})['then'](function(){var _0x17a141=util['format'](_0x7d11('0x61'),_0x3b1762[_0x7d11('0x72')]||_0x3b1762[_0x7d11('0x5f')],_0x3b1762[_0x7d11('0x60')]||_0x7d11('0x62'));var _0x776b20=_[_0x7d11('0x59')](_0x407f2c[_0x7d11('0x65')],{'filename':_0x7d11('0x66')+_0x17a141[_0x7d11('0x67')]()});if(_0x776b20){_0x776b20[_0x7d11('0x6b')]=_0x7d11('0x71');}})[_0x7d11('0x1c')](function(){_0x1f29f7({'code':0xc8,'message':[_0x3b1762[_0x7d11('0x5f')],'StopMixMonitor\x20Success'][_0x7d11('0x16')]('\x20')});})['catch'](function(_0x371869){_0x178a3a(_0x32937c['error'](0x1f5,[_0x3b1762[_0x7d11('0x5f')],_0x371869[_0x7d11('0x1d')][_0x7d11('0x67')]()][_0x7d11('0x16')]('\x20')));});}else{return _0x178a3a(_0x32937c['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x1351ee){return new Promise(function(_0x15938b,_0x12566a){var _0x56331e=_[_0x7d11('0x5b')](_0x589c51[_0x7d11('0x73')]);_0x15938b({'count':_0x56331e[_0x7d11('0x58')],'rows':_0x56331e});});},'VoiceQueuesChannel':function(_0x1b89de){var _0x328a36=this;return new Promise(function(_0x241895,_0x59f63f){var _0xc63022=schema(properties['voicequeuechannel'])[_0x7d11('0x3')](_0x1b89de);if(_0xc63022['length']>0x0){return _0x59f63f(_0x328a36['error'](0x1f4,_[_0x7d11('0x5e')](_0xc63022,_0x7d11('0x1d'))[_0x7d11('0x16')](',\x20')));}var _0x14ee15=_[_0x7d11('0x59')](_0x589c51[_0x7d11('0x73')],{'uniqueid':_0x1b89de[_0x7d11('0x5f')]});if(_0x14ee15){_0x241895(_0x14ee15);}else{return _0x59f63f(_0x328a36[_0x7d11('0x12')](0x1f5,_0x7d11('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x1b8993){var _0xee8fb0=this;return new Promise(function(_0x539b91,_0x3f0d43){if(ami['isConnected']()==![]){return _0x3f0d43(_0xee8fb0[_0x7d11('0x12')](0x1f4,[config[_0x7d11('0x13')]['ip'],config[_0x7d11('0x13')][_0x7d11('0x14')],_0x7d11('0x15')][_0x7d11('0x16')]('\x20')));}var _0x1f852a=schema(properties['voicequeuechannelhangup'])['validate'](_0x1b8993);if(_0x1f852a[_0x7d11('0x58')]>0x0){return _0x3f0d43(_0xee8fb0[_0x7d11('0x12')](0x1f4,_[_0x7d11('0x5e')](_0x1f852a,_0x7d11('0x1d'))[_0x7d11('0x16')](',\x20')));}var _0x549bd8=_[_0x7d11('0x59')](_0x589c51['queueChannels'],{'uniqueid':_0x1b8993[_0x7d11('0x5f')]});if(_0x549bd8&&_0x549bd8[_0x7d11('0x63')]){return ami[_0x7d11('0x1b')]({'action':_0x7d11('0x74'),'channel':_0x549bd8[_0x7d11('0x63')]})[_0x7d11('0x1c')](function(_0x93cf5c){_0x539b91({'code':0xc8,'message':[_0x1b8993[_0x7d11('0x5f')],_0x93cf5c['message']['toLowerCase']()][_0x7d11('0x16')]('\x20')});})[_0x7d11('0x1e')](function(_0x195e2a){_0x3f0d43(_0xee8fb0['error'](0x1f5,[_0x1b8993['uniqueid'],_0x195e2a[_0x7d11('0x1d')]['toLowerCase']()][_0x7d11('0x16')]('\x20')));});}else{return _0x3f0d43(_0xee8fb0[_0x7d11('0x12')](0x1f5,_0x7d11('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x14bd23){var _0x4b4dd5=this;return new Promise(function(_0x3805c7,_0x3b2c9e){if(ami[_0x7d11('0x11')]()==![]){return _0x3b2c9e(_0x4b4dd5[_0x7d11('0x12')](0x1f4,[config[_0x7d11('0x13')]['ip'],config[_0x7d11('0x13')][_0x7d11('0x14')],_0x7d11('0x15')]['join']('\x20')));}var _0x41f989=schema(properties[_0x7d11('0x75')])[_0x7d11('0x3')](_0x14bd23);if(_0x41f989[_0x7d11('0x58')]>0x0){return _0x3b2c9e(_0x4b4dd5[_0x7d11('0x12')](0x1f4,_['map'](_0x41f989,_0x7d11('0x1d'))[_0x7d11('0x16')](',\x20')));}var _0xa4d2ad=_[_0x7d11('0x59')](_0x589c51[_0x7d11('0x73')],{'uniqueid':_0x14bd23['uniqueid']});if(_0xa4d2ad&&_0xa4d2ad['channel']){return ami['Action']({'action':_0x7d11('0x76'),'channel':_0xa4d2ad['channel'],'exten':_0x14bd23[_0x7d11('0x77')],'context':_0x14bd23['context']||_0xa4d2ad['context'],'priority':0x1})[_0x7d11('0x1c')](function(_0x355d3f){_0x3805c7({'code':0xc8,'message':[_0x14bd23[_0x7d11('0x5f')],_0x355d3f[_0x7d11('0x1d')][_0x7d11('0x67')]()][_0x7d11('0x16')]('\x20')});})[_0x7d11('0x1e')](function(_0x45d970){_0x3b2c9e(_0x4b4dd5[_0x7d11('0x12')](0x1f5,[_0x14bd23[_0x7d11('0x5f')],_0x45d970['message'][_0x7d11('0x67')]()][_0x7d11('0x16')]('\x20')));});}else{return _0x3b2c9e(_0x4b4dd5['error'](0x1f5,_0x7d11('0x6d')));}});},'Agents':function(_0x45a528){return new Promise(function(_0x19e4a9,_0x461ab7){var _0x5c828c=_['values'](_0x589c51[_0x7d11('0xe')]);_0x19e4a9({'count':_0x5c828c['length'],'rows':_0x5c828c});});},'Telephones':function(_0xb576ec){return new Promise(function(_0x471bf4,_0xa4317f){var _0x13ccd5=_[_0x7d11('0x5b')](_0x589c51[_0x7d11('0x78')]);_0x471bf4({'count':_0x13ccd5[_0x7d11('0x58')],'rows':_0x13ccd5});});},'Trunks':function(_0x596228){return new Promise(function(_0x3381e0,_0x3212fa){var _0x22121e=_[_0x7d11('0x5b')](_0x589c51['trunks']);_0x3381e0({'count':_0x22121e[_0x7d11('0x58')],'rows':_0x22121e});});},'OutboundChannels':function(_0x18cb6b){return new Promise(function(_0x498714,_0x772073){var _0x41c318=_[_0x7d11('0x5b')](_0x589c51['outboundChannels']);_0x498714({'count':_0x41c318[_0x7d11('0x58')],'rows':_0x41c318});});},'Outbound':function(_0x34d95d){return new Promise(function(_0x561dbf,_0xf089a4){_0x561dbf(_0x589c51[_0x7d11('0x79')]);});},'Campaigns':function(_0x5a280f){return new Promise(function(_0x3ee2ee,_0x5bf46e){var _0x49d16c=_['values'](_0x589c51['campaigns']);_0x3ee2ee({'count':_0x49d16c[_0x7d11('0x58')],'rows':_0x49d16c});});},'VoiceQueuesPreview':function(_0x454789){var _0x265c48=this;return new Promise(function(_0xe98764,_0x241591){_0x2689c6[_0x7d11('0x7a')](_0x454789['id'])[_0x7d11('0x1c')](function(_0x1a2df6){_0xe98764({'code':0xc8,'message':_0x1a2df6[_0x7d11('0x1d')]});})[_0x7d11('0x1e')](function(_0x5bc08e){_0x241591(_0x265c48['error'](0x1f4,_0x5bc08e[_0x7d11('0x1d')]));});});},'EventManager':function(_0x158e0f){var _0x57a6a1=this;return new Promise(function(_0x4c2199,_0xe88ace){if(!_0x158e0f[_0x7d11('0x7b')]){return _0xe88ace(_0x57a6a1[_0x7d11('0x12')](0x1f4,_0x7d11('0x7c')));}ami['emit']('custom:'+_0x158e0f['event'],_0x158e0f[_0x7d11('0x1d')]);_0x4c2199({'code':0xc8,'message':_0x158e0f});});},'FaxAccounts':function(_0x126107){return new Promise(function(_0x4470e9,_0x550772){var _0x3ce304=_[_0x7d11('0x5b')](_0x589c51['faxAccounts']);_0x4470e9({'count':_0x3ce304[_0x7d11('0x58')],'rows':_0x3ce304});});},'SendFax':function(_0x1cb457){var _0x59f0db=this;return new Promise(function(_0x5e5faf,_0xe23940){_0x27d7e8[_0x7d11('0x7d')](_0x1cb457)['then'](function(_0x4f08a4){_0x5e5faf({'code':0xc8,'message':_0x4f08a4[_0x7d11('0x1d')]});})[_0x7d11('0x1e')](function(_0x3df0ab){_0xe23940(_0x59f0db[_0x7d11('0x12')](0x1f4,_0x3df0ab['message']));});});},'CheckAfterSend':function(_0x411f81){var _0x2cfa77=this;return new Promise(function(_0x44ea8e,_0x83416b){_0x27d7e8['checkAfterSend'](_0x411f81)[_0x7d11('0x1c')](function(_0x23fe57){_0x44ea8e({'code':0xc8,'message':_0x23fe57[_0x7d11('0x1d')]});})['catch'](function(_0x421187){_0x83416b(_0x2cfa77['error'](0x1f4,_0x421187[_0x7d11('0x1d')]));});});}};var _0x5b690f=jayson[_0x7d11('0x7e')](_0x3c8d66)[_0x7d11('0x7f')]();_0x5b690f['on'](_0x7d11('0x12'),function(_0x1a548f){return _0x345602(_0x1a548f);});_0x5b690f[_0x7d11('0x9')](0x232a,_0x7d11('0x80'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x40c3c4(_0x7d11('0x81')+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 e63fda8..6966c04 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 _0x4bc3=['[CM][%s][%s]\x20Contact\x20not\x20found','data4','firstName','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','toLowerCase','merge','length','lodash','bluebird','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','xmd-contactid','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','lastName','fax','ListId','scheduledAt','updatedAt','union','resolve','then','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4bc3,0x16e));var _0x34bc=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x4bc3[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0x34bc('0x0'));var BPromise=require(_0x34bc('0x1'));var Redis=require('ioredis');var util=require(_0x34bc('0x2'));var config=require(_0x34bc('0x3'));var logger=require('../../../../config/logger')(_0x34bc('0x4'));var cmContactRpc=require(_0x34bc('0x5'));config[_0x34bc('0x6')]=_[_0x34bc('0x7')](config[_0x34bc('0x6')],{'host':_0x34bc('0x8'),'port':0x18eb});var io=require(_0x34bc('0x9'))(new Redis(config['redis']));function emit(_0x21451b,_0x50320d,_0x502087,_0x18a01c,_0x474108){logger[_0x34bc('0xa')](_0x34bc('0xb'),_0x21451b,_0x50320d['id'],_0x502087,_0x18a01c,JSON[_0x34bc('0xc')](_0x474108));io['to'](_0x502087)[_0x34bc('0xd')](_0x18a01c,_0x474108);}exports['exec']=function(_0x5a478d,_0x2b8112,_0x33025c,_0x2a35f3){var _0x5a608a,_0x41960e;var _0x5ab229={};var _0x1ecedf=Number(_0x33025c[_0x34bc('0xe')]);var _0x164fb2=_0x33025c['data2']?Boolean(Number(_0x33025c[_0x34bc('0xf')])):![];var _0x553a7d;var _0x12cf72=![];if(!_[_0x34bc('0x10')](_0x33025c[_0x34bc('0x11')])){if(_0x33025c['data5']=='1')_0x12cf72=!![];}if(!_0x12cf72){if(_0x2a35f3['xmd-contactid']){_0x5ab229['id']=_0x2a35f3[_0x34bc('0x12')];}}if(!_0x5ab229['id']){_0x5ab229['ListId']=_0x1ecedf;_0x553a7d=_0x33025c[_0x34bc('0x13')]&&_0x33025c[_0x34bc('0x13')]!=='0'?_0x33025c[_0x34bc('0x13')][_0x34bc('0x14')](','):[_0x34bc('0x15')];_0x5ab229[_0x34bc('0x16')]=_['map'](_0x553a7d,function(_0x4fa0ab){var _0x5a5895={};_0x5a5895[_0x4fa0ab]=_0x2a35f3[_0x34bc('0x17')]?_0x2a35f3[_0x34bc('0x18')]:_0x2a35f3[_0x34bc('0x19')];return _0x5a5895;});}var _0x239e6c=['id','firstName',_0x34bc('0x1a'),_0x34bc('0x15'),'mobile',_0x34bc('0x1b'),_0x34bc('0x1c'),'createdAt',_0x34bc('0x1d'),_0x34bc('0x1e')];var _0x2d18ea=_[_0x34bc('0x1f')](_0x239e6c,_0x553a7d);BPromise[_0x34bc('0x20')]()[_0x34bc('0x21')](cmContactRpc['getContacts']({'attributes':_0x2d18ea,'where':_0x5ab229}))[_0x34bc('0x21')](function(_0x3c9939){_0x41960e=_0x3c9939;if(!_[_0x34bc('0x22')](_0x41960e)){if(_0x41960e['length']===0x1){_0x5a608a=_0x41960e[0x0];logger['info'](_0x34bc('0x23'),_0x2a35f3[_0x34bc('0x24')],_0x2b8112['id'],_0x5a608a['id']);}else{logger[_0x34bc('0xa')](_0x34bc('0x25'),_0x2a35f3[_0x34bc('0x24')],_0x2b8112['id'],_[_0x34bc('0x26')](_0x41960e,'id')[_0x34bc('0x27')](','));}return;}else{logger[_0x34bc('0xa')](_0x34bc('0x28'),_0x2a35f3[_0x34bc('0x24')],_0x2b8112['id']);var _0x2de017={'ListId':_0x1ecedf};var _0x1edcb0=_0x33025c['data4']&&_0x33025c[_0x34bc('0x29')]!=='0'?_0x33025c['data4']:'phone';if(_0x164fb2){logger[_0x34bc('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x2a35f3[_0x34bc('0x24')],_0x2b8112['id']);_0x2de017[_0x1edcb0]=_[_0x34bc('0x10')](_0x2a35f3[_0x34bc('0x17')])?_0x2a35f3['calleridnum']:_0x2a35f3[_0x34bc('0x18')];if(_[_0x34bc('0x10')](_0x2a35f3[_0x34bc('0x17')])){_0x2de017[_0x34bc('0x2a')]=_0x2a35f3[_0x34bc('0x2b')]&&_0x2a35f3[_0x34bc('0x2b')]!==''?_0x2a35f3[_0x34bc('0x2b')]:_0x34bc('0x2c');}else{_0x2de017[_0x34bc('0x2a')]=_0x2a35f3[_0x34bc('0x2d')]&&_0x2a35f3[_0x34bc('0x2d')]!==_0x34bc('0x2e')?_0x2a35f3['destcalleridname']:_0x34bc('0x2c');}return BPromise['resolve']()['then'](cmContactRpc[_0x34bc('0x2f')](_0x2de017))['then'](function(_0x1e8445){_0x5a608a=_0x1e8445;_0x41960e[_0x34bc('0x30')](_0x1e8445);if(_0x5a608a){logger[_0x34bc('0xa')](_0x34bc('0x31'),_0x2a35f3[_0x34bc('0x24')],_0x2b8112['id'],_0x5a608a['id']);}return;});}else{logger[_0x34bc('0xa')](_0x34bc('0x32'),_0x2a35f3['uniqueid'],_0x2b8112['id']);_0x2de017[_0x1edcb0]=_[_0x34bc('0x10')](_0x2a35f3[_0x34bc('0x17')])?_0x2a35f3[_0x34bc('0x19')]:_0x2a35f3[_0x34bc('0x18')];if(_[_0x34bc('0x10')](_0x2a35f3['routeId'])){_0x2de017[_0x34bc('0x2a')]=_0x2a35f3[_0x34bc('0x2b')]&&_0x2a35f3[_0x34bc('0x2b')]!==_0x34bc('0x2e')?_0x2a35f3[_0x34bc('0x2b')]:'Unknown';}else{_0x2de017['firstName']=_0x2a35f3[_0x34bc('0x2d')]&&_0x2a35f3[_0x34bc('0x2d')]!==_0x34bc('0x2e')?_0x2a35f3[_0x34bc('0x2d')]:'Unknown';}_0x5a608a=_0x2de017;_0x41960e[_0x34bc('0x30')](_0x2de017);return;}}})[_0x34bc('0x21')](function(){if(_0x5a478d){emit(_0x2a35f3[_0x34bc('0x24')],_0x2b8112,util['format'](_0x34bc('0x33'),_0x5a478d[_0x34bc('0x34')]),util[_0x34bc('0x35')](_0x34bc('0x36'),_0x33025c['action'][_0x34bc('0x37')]()),{'evt':_[_0x34bc('0x38')](_0x2a35f3,{'autoCreate':_0x164fb2}),'contact':_0x5a608a===undefined?{}:_0x5a608a,'contacts':_0x41960e[_0x34bc('0x39')]===0x0?undefined:_0x41960e});}});}; \ No newline at end of file +var _0x032e=['format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','ioredis','util','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s',''];(function(_0x57e9cb,_0x1b379e){var _0x5b7a4c=function(_0x429db9){while(--_0x429db9){_0x57e9cb['push'](_0x57e9cb['shift']());}};_0x5b7a4c(++_0x1b379e);}(_0x032e,0x124));var _0xe032=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x032e[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0xe032('0x0'));var BPromise=require('bluebird');var Redis=require(_0xe032('0x1'));var util=require(_0xe032('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xe032('0x3'));var cmContactRpc=require(_0xe032('0x4'));config[_0xe032('0x5')]=_[_0xe032('0x6')](config[_0xe032('0x5')],{'host':_0xe032('0x7'),'port':0x18eb});var io=require(_0xe032('0x8'))(new Redis(config[_0xe032('0x5')]));function emit(_0x37432f,_0x1576c8,_0x3289b0,_0xd84027,_0xaf3907){logger[_0xe032('0x9')](_0xe032('0xa'),_0x37432f,_0x1576c8['id'],_0x3289b0,_0xd84027,JSON[_0xe032('0xb')](_0xaf3907));io['to'](_0x3289b0)[_0xe032('0xc')](_0xd84027,_0xaf3907);}exports[_0xe032('0xd')]=function(_0x4aec53,_0x1382e1,_0x1ce2ae,_0x13c126){var _0x42e2ba,_0x244f93;var _0x21883b={};var _0x2194fc=Number(_0x1ce2ae['data1']);var _0x646979=_0x1ce2ae[_0xe032('0xe')]?Boolean(Number(_0x1ce2ae[_0xe032('0xe')])):![];var _0x1a53ab;var _0x4aee44=![];if(!_[_0xe032('0xf')](_0x1ce2ae[_0xe032('0x10')])){if(_0x1ce2ae[_0xe032('0x10')]=='1')_0x4aee44=!![];}if(!_0x4aee44){if(_0x13c126[_0xe032('0x11')]){_0x21883b['id']=_0x13c126[_0xe032('0x11')];}}if(!_0x21883b['id']){_0x21883b[_0xe032('0x12')]=_0x2194fc;_0x1a53ab=_0x1ce2ae[_0xe032('0x13')]&&_0x1ce2ae['data3']!=='0'?_0x1ce2ae[_0xe032('0x13')][_0xe032('0x14')](','):[_0xe032('0x15')];_0x21883b[_0xe032('0x16')]=_[_0xe032('0x17')](_0x1a53ab,function(_0x208b00){var _0x4cdab3={};_0x4cdab3[_0x208b00]=_0x13c126[_0xe032('0x18')]?_0x13c126[_0xe032('0x19')]:_0x13c126[_0xe032('0x1a')];return _0x4cdab3;});}var _0x41d2a5=['id',_0xe032('0x1b'),'lastName','phone','mobile',_0xe032('0x1c'),'ListId',_0xe032('0x1d'),_0xe032('0x1e'),_0xe032('0x1f')];var _0x2aa342=_[_0xe032('0x20')](_0x41d2a5,_0x1a53ab);BPromise[_0xe032('0x21')]()[_0xe032('0x22')](cmContactRpc['getContacts']({'attributes':_0x2aa342,'where':_0x21883b}))[_0xe032('0x22')](function(_0x866c81){_0x244f93=_0x866c81;if(!_[_0xe032('0x23')](_0x244f93)){if(_0x244f93[_0xe032('0x24')]===0x1){_0x42e2ba=_0x244f93[0x0];logger[_0xe032('0x9')](_0xe032('0x25'),_0x13c126[_0xe032('0x26')],_0x1382e1['id'],_0x42e2ba['id']);}else{logger[_0xe032('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x13c126['uniqueid'],_0x1382e1['id'],_['map'](_0x244f93,'id')[_0xe032('0x27')](','));}return;}else{logger[_0xe032('0x9')](_0xe032('0x28'),_0x13c126[_0xe032('0x26')],_0x1382e1['id']);var _0x2bfe8f={'ListId':_0x2194fc};var _0x200671=_0x1ce2ae[_0xe032('0x29')]&&_0x1ce2ae[_0xe032('0x29')]!=='0'?_0x1ce2ae[_0xe032('0x29')]:_0xe032('0x15');if(_0x646979){logger['info'](_0xe032('0x2a'),_0x13c126[_0xe032('0x26')],_0x1382e1['id']);_0x2bfe8f[_0x200671]=_[_0xe032('0xf')](_0x13c126[_0xe032('0x18')])?_0x13c126['calleridnum']:_0x13c126['destcalleridnum'];if(_[_0xe032('0xf')](_0x13c126[_0xe032('0x18')])){_0x2bfe8f[_0xe032('0x1b')]=_0x13c126[_0xe032('0x2b')]&&_0x13c126['calleridname']!==''?_0x13c126['calleridname']:_0xe032('0x2c');}else{_0x2bfe8f[_0xe032('0x1b')]=_0x13c126[_0xe032('0x2d')]&&_0x13c126[_0xe032('0x2d')]!==''?_0x13c126[_0xe032('0x2d')]:_0xe032('0x2c');}return BPromise[_0xe032('0x21')]()[_0xe032('0x22')](cmContactRpc[_0xe032('0x2e')](_0x2bfe8f))['then'](function(_0xd90bd5){_0x42e2ba=_0xd90bd5;_0x244f93[_0xe032('0x2f')](_0xd90bd5);if(_0x42e2ba){logger[_0xe032('0x9')](_0xe032('0x30'),_0x13c126['uniqueid'],_0x1382e1['id'],_0x42e2ba['id']);}return;});}else{logger[_0xe032('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x13c126[_0xe032('0x26')],_0x1382e1['id']);_0x2bfe8f[_0x200671]=_['isNil'](_0x13c126[_0xe032('0x18')])?_0x13c126['calleridnum']:_0x13c126[_0xe032('0x19')];if(_['isNil'](_0x13c126[_0xe032('0x18')])){_0x2bfe8f[_0xe032('0x1b')]=_0x13c126['calleridname']&&_0x13c126[_0xe032('0x2b')]!==_0xe032('0x31')?_0x13c126[_0xe032('0x2b')]:_0xe032('0x2c');}else{_0x2bfe8f['firstName']=_0x13c126[_0xe032('0x2d')]&&_0x13c126['destcalleridname']!==_0xe032('0x31')?_0x13c126[_0xe032('0x2d')]:'Unknown';}_0x42e2ba=_0x2bfe8f;_0x244f93[_0xe032('0x2f')](_0x2bfe8f);return;}}})[_0xe032('0x22')](function(){if(_0x4aec53){emit(_0x13c126['uniqueid'],_0x1382e1,util[_0xe032('0x32')](_0xe032('0x33'),_0x4aec53[_0xe032('0x34')]),util[_0xe032('0x32')](_0xe032('0x35'),_0x1ce2ae[_0xe032('0x36')][_0xe032('0x37')]()),{'evt':_[_0xe032('0x38')](_0x13c126,{'autoCreate':_0x646979}),'contact':_0x42e2ba===undefined?{}:_0x42e2ba,'contacts':_0x244f93[_0xe032('0x24')]===0x0?undefined:_0x244f93});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index d531262..699c300 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 _0xb8fa=['winApplication','winArguments','format','user:%s','name','trigger:%s:%s','contactmanager','exec','integration','queue','routeId','urlforward','script','parse','query','search','channel','every','AllConditions','checkConditions','AnyConditions','some','field','account','chat','ChatWebsiteId','operator','value','AccountId','interaction','message','event','agent','membername','lastevent','mailSubstatus','substatus','exports','util','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','defaults','redis','localhost','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','sugarcrmAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:substatus','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','clone','undefined','motionChannel','voice','checkTriggers','status','merge','variables','Actions','length','interface','action','toLowerCase','motionbar','data1','popup','TemplateId','data2','render','html','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','800','data5','windowHeight','data6'];(function(_0x5ecb62,_0x452f59){var _0x64788=function(_0x5b5ec2){while(--_0x5b5ec2){_0x5ecb62['push'](_0x5ecb62['shift']());}};_0x64788(++_0x452f59);}(_0xb8fa,0x11e));var _0xab8f=function(_0xb3b12f,_0x2c3f1f){_0xb3b12f=_0xb3b12f-0x0;var _0x24eebc=_0xb8fa[_0xb3b12f];return _0x24eebc;};'use strict';var util=require(_0xab8f('0x0'));var _=require('lodash');var url=require('url');var Mustache=require(_0xab8f('0x1'));var Redis=require(_0xab8f('0x2'));var urlforward=require(_0xab8f('0x3'));var integration=require(_0xab8f('0x4'));var cmContact=require(_0xab8f('0x5'));var script=require(_0xab8f('0x6'));var config=require(_0xab8f('0x7'));var logger=require(_0xab8f('0x8'))(_0xab8f('0x9'));var ami=require('../ami');config['redis']=_[_0xab8f('0xa')](config[_0xab8f('0xb')],{'host':_0xab8f('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xab8f('0xb')]));var operators={'equals':function(_0x4f2cf9,_0x33e47f){return _0x4f2cf9==_0x33e47f;},'not_equals':function(_0x199682,_0x4113fa){return _0x199682!=_0x4113fa;}};var barAndWebActions=['popup',_0xab8f('0xd'),_0xab8f('0xe')];function Trigger(_0x1cf0f0){this[_0xab8f('0xf')]=_0x1cf0f0[_0xab8f('0xf')];this[_0xab8f('0x10')]=_0x1cf0f0['agents'];this[_0xab8f('0x11')]=_0x1cf0f0[_0xab8f('0x11')];this[_0xab8f('0x12')]=_0x1cf0f0[_0xab8f('0x12')];this[_0xab8f('0x13')]=_0x1cf0f0['voiceExtensions'];this[_0xab8f('0x14')]=_0x1cf0f0[_0xab8f('0x14')];this[_0xab8f('0x15')]=_0x1cf0f0[_0xab8f('0x15')];this[_0xab8f('0x16')]=_0x1cf0f0[_0xab8f('0x16')];this['sugarcrmAccounts']=_0x1cf0f0['sugarcrmAccounts'];this[_0xab8f('0x17')]=_0x1cf0f0['zohoAccounts'];this[_0xab8f('0x18')]=_0x1cf0f0['deskAccounts'];this[_0xab8f('0x19')]=_0x1cf0f0[_0xab8f('0x19')];this[_0xab8f('0x1a')]=_0x1cf0f0[_0xab8f('0x1a')];this[_0xab8f('0x1b')]=_0x1cf0f0['dynamics365Accounts'];this[_0xab8f('0x1c')]=_0x1cf0f0[_0xab8f('0x1c')];this[_0xab8f('0x1d')]={'zendesk':this[_0xab8f('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xab8f('0x1e')],'zoho':this[_0xab8f('0x17')],'desk':this[_0xab8f('0x18')],'vtiger':this[_0xab8f('0x19')],'dynamics365':this[_0xab8f('0x1b')],'freshsales':this[_0xab8f('0x1c')],'servicenow':this['servicenowAccounts']};ami['on'](_0xab8f('0x1f'),this[_0xab8f('0x20')]['bind'](this));ami['on'](_0xab8f('0x21'),this['syncCustomEvent'][_0xab8f('0x22')](this));ami['on']('custom:agentringnoanswer',this[_0xab8f('0x20')][_0xab8f('0x22')](this));ami['on'](_0xab8f('0x23'),this[_0xab8f('0x20')][_0xab8f('0x22')](this));ami['on'](_0xab8f('0x24'),this[_0xab8f('0x20')]['bind'](this));ami['on'](_0xab8f('0x25'),this['syncCustomEvent'][_0xab8f('0x22')](this));ami['on'](_0xab8f('0x26'),this[_0xab8f('0x20')]['bind'](this));ami['on']('custom:agentcongestion',this[_0xab8f('0x20')][_0xab8f('0x22')](this));ami['on'](_0xab8f('0x27'),this['syncCustomEvent'][_0xab8f('0x22')](this));ami['on'](_0xab8f('0x28'),this[_0xab8f('0x20')][_0xab8f('0x22')](this));ami['on'](_0xab8f('0x29'),this[_0xab8f('0x20')]['bind'](this));ami['on'](_0xab8f('0x2a'),this[_0xab8f('0x20')]['bind'](this));ami['on'](_0xab8f('0x2b'),this[_0xab8f('0x2c')][_0xab8f('0x22')](this));ami['on'](_0xab8f('0x2d'),this[_0xab8f('0x2c')][_0xab8f('0x22')](this));ami['on'](_0xab8f('0x2e'),this[_0xab8f('0x2c')][_0xab8f('0x22')](this));ami['on'](_0xab8f('0x2f'),this[_0xab8f('0x20')][_0xab8f('0x22')](this));ami['on']('custom:closedinteraction',this[_0xab8f('0x20')]['bind'](this));ami['on'](_0xab8f('0x30'),this[_0xab8f('0x20')]['bind'](this));ami['on']('custom:incomingmessage',this[_0xab8f('0x20')][_0xab8f('0x22')](this));ami['on'](_0xab8f('0x31'),this['syncCustomEvent'][_0xab8f('0x22')](this));ami['on'](_0xab8f('0x32'),this['syncCustomEvent'][_0xab8f('0x22')](this));ami['on'](_0xab8f('0x33'),this[_0xab8f('0x20')][_0xab8f('0x22')](this));}Trigger[_0xab8f('0x34')][_0xab8f('0x35')]=function(_0xff35cc,_0x44c9d6,_0x5286c9){logger[_0xab8f('0x36')](_0xff35cc,_0x44c9d6,JSON['stringify'](_0x5286c9));io['to'](_0xff35cc)[_0xab8f('0x35')](_0x44c9d6,_0x5286c9);};Trigger[_0xab8f('0x34')][_0xab8f('0x20')]=function(_0x5d8688){var _0x3da79e=_[_0xab8f('0x37')](_0x5d8688);if(typeof _0x3da79e['motionChannel']===_0xab8f('0x38')){_0x3da79e[_0xab8f('0x39')]=_0xab8f('0x3a');}this[_0xab8f('0x3b')](_0x3da79e);};Trigger['prototype'][_0xab8f('0x2c')]=function(_0x3d895c){if(this[_0xab8f('0x10')][_0x3d895c['interface']]){this['syncCustomEvent'](_0x3d895c);}};Trigger[_0xab8f('0x34')][_0xab8f('0x3b')]=function(_0x3dc722){var _0x47d53d;for(var _0x411f2c in this[_0xab8f('0xf')]){if(this[_0xab8f('0xf')]['hasOwnProperty'](_0x411f2c)){if(this[_0xab8f('0xf')][_0x411f2c][_0xab8f('0x3c')]){_0x47d53d=this['checkTrigger'](this[_0xab8f('0xf')][_0x411f2c],_0x3dc722);if(_0x47d53d){_[_0xab8f('0x3d')](_0x3dc722,_0x3dc722[_0xab8f('0x3e')]);for(var _0x1ffdaa=0x0,_0x50d51a,_0x33d3ea,_0x3a39d2;_0x1ffdaa0x0){_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 +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x7a082e,_0x3c7681){var _0x1b545c=function(_0x4ccf81){while(--_0x4ccf81){_0x7a082e['push'](_0x7a082e['shift']());}};_0x1b545c(++_0x3c7681);}(_0x55ca,0x126));var _0xa55c=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x55ca[_0x2a7b8e];return _0x29b5c8;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index d6422ed..4bb7d5a 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 _0xe72f=['%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','localhost','redis','POST','clientId','remoteUri','password','then','catch','error',']\x20Wrong\x20credentials!','GET','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','userId','message','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','headers','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','%2b','telephone1',']\x20Enduser\x20created!','forEach','includes','string','picklist','indexOf','content','ticketType','incident','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','/systemusers(','callDirection','queue','Bearer\x20','odata-entityid','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged'];(function(_0x31c6f6,_0x1e8c90){var _0x5dfdaa=function(_0x12572d){while(--_0x12572d){_0x31c6f6['push'](_0x31c6f6['shift']());}};_0x5dfdaa(++_0x1e8c90);}(_0xe72f,0x73));var _0xfe72=function(_0x1e86ee,_0x4deb46){_0x1e86ee=_0x1e86ee-0x0;var _0x3225dc=_0xe72f[_0x1e86ee];return _0x3225dc;};'use strict';var _=require('lodash');var BPromise=require(_0xfe72('0x0'));var rp=require('request-promise');var util=require(_0xfe72('0x1'));var intUtil=require(_0xfe72('0x2'));var md5=require(_0xfe72('0x3'));var Redis=require(_0xfe72('0x4'));var logger=require(_0xfe72('0x5'))(_0xfe72('0x6'));var config=require(_0xfe72('0x7'));config['redis']=_[_0xfe72('0x8')](config['redis'],{'host':_0xfe72('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfe72('0xa')]));function getAuthToken(_0x197f90,_0x544366,_0x320fa5){var _0x40752b={'method':_0xfe72('0xb'),'uri':_0x544366,'form':{'client_id':_0x197f90[_0xfe72('0xc')],'resource':_0x197f90[_0xfe72('0xd')],'username':_0x197f90['username'],'password':_0x197f90[_0xfe72('0xe')],'grant_type':'password','client_secret':_0x197f90['clientSecret']},'json':!![]};return rp(_0x40752b)[_0xfe72('0xf')](function(_0x4b2846){return _0x4b2846['access_token'];})[_0xfe72('0x10')](function(_0x40dba9){logger[_0xfe72('0x11')]('['+[_0x320fa5['toUpperCase']()]+_0xfe72('0x12'));return _0x40dba9['message'];});}function getUser(_0x5e5fca,_0x5cf61b,_0xafde17,_0x1e4b3b,_0xfd198,_0x1d44e0){return new BPromise(function(_0x303ac5,_0x5a93f7){return getAuthToken(_0x5cf61b,_0x1e4b3b,_0x1d44e0)['then'](function(_0x5f50ab){var _0x299bae={'method':_0xfe72('0x13'),'uri':_0xfd198+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x5f50ab,'OData-Version':_0xfe72('0x14')},'json':!![]};return rp(_0x299bae);})[_0xfe72('0xf')](function(_0x15ce75){var _0x3d85bf=_0x15ce75[_0xfe72('0x15')];var _0x4a9284=![];var _0x4d9e51=null;if(!_[_0xfe72('0x16')](_0xafde17)){if(intUtil[_0xfe72('0x17')](_0xafde17[_0xfe72('0x18')])){_0x5e5fca[_0xfe72('0x19')]=_0xafde17[_0xfe72('0x18')];for(_0x4d9e51=0x0;_0x4d9e51<_0x3d85bf[_0xfe72('0x1a')];_0x4d9e51++){if(_0x3d85bf[_0x4d9e51][_0xfe72('0x1b')]===_0xafde17[_0xfe72('0x18')]&&!_0x3d85bf[_0x4d9e51][_0xfe72('0x1c')]){_0x4a9284=!![];logger[_0xfe72('0x1d')]('['+[_0x1d44e0[_0xfe72('0x1e')]()]+_0xfe72('0x1f')+_0x3d85bf[_0x4d9e51][_0xfe72('0x20')]+'!');_0x5e5fca['userId']=_0x3d85bf[_0x4d9e51][_0xfe72('0x20')];}}}}if(!_0x4a9284){logger[_0xfe72('0x1d')]('['+[_0x1d44e0['toUpperCase']()]+_0xfe72('0x21'));_0x5e5fca[_0xfe72('0x19')]=_0x5cf61b['username'];for(_0x4d9e51=0x0;_0x4d9e51<_0x3d85bf['length'];_0x4d9e51++){if(_0x3d85bf[_0x4d9e51][_0xfe72('0x1b')]===_0x5cf61b[_0xfe72('0x22')]){_0x5e5fca[_0xfe72('0x23')]=_0x3d85bf[_0x4d9e51][_0xfe72('0x20')];}}}_0x303ac5(_0x5e5fca);})[_0xfe72('0x10')](function(_0x119359){_0x5a93f7(_0x119359[_0xfe72('0x24')]);});});}function createEndUser(_0x241983,_0x22e762,_0x421aa3,_0x1d757c,_0x5a8536,_0x34ad0a){return new BPromise(function(_0x55a4d,_0x50824f){return getAuthToken(_0x22e762,_0x421aa3,_0x34ad0a)[_0xfe72('0xf')](function(_0xd1ed8e){var _0x1a7947=_0x34ad0a[_0xfe72('0x25')]()===_0xfe72('0x26')?_0x5a8536[_0xfe72('0x27')]:_0x5a8536[_0xfe72('0x28')];var _0x573737={'method':_0xfe72('0xb'),'uri':_0x1d757c+_0xfe72('0x29'),'body':{'telephone1':_0x1a7947,'fullname':_0x1a7947,'firstname':_0x1a7947,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x241983[_0xfe72('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0xd1ed8e,'OData-Version':_0xfe72('0x14')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x573737);})[_0xfe72('0xf')](function(_0xb33be){var _0x395fae=_0xb33be[_0xfe72('0x2a')]['odata-entityid'];var _0x322957=_0x395fae[_0xfe72('0x2b')](_0x395fae[_0xfe72('0x2c')]('(')+0x1,_0x395fae[_0xfe72('0x2c')](')'));_0x241983[_0xfe72('0x2d')]=_0x322957;_0x55a4d(_0x241983);})[_0xfe72('0x10')](function(_0x1feb69){_0x50824f(_0x1feb69[_0xfe72('0x24')]);});});}function getEndUser(_0x34f6a5,_0x42bf05,_0x47b3c8,_0x3495d1,_0x32c05d,_0xd05b89){return new BPromise(function(_0xa308f3,_0x1956b0){var _0x5d5e7d=_0xd05b89[_0xfe72('0x25')]()==='outbound'?_0x32c05d['destcalleridnum']:_0x32c05d[_0xfe72('0x28')];return getAuthToken(_0x42bf05,_0x47b3c8,_0xd05b89)['then'](function(_0x239b2f){var _0x5c2e09={'method':'GET','uri':_0x3495d1+_0xfe72('0x2e')+_0x5d5e7d['replace']('+',_0xfe72('0x2f'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x239b2f,'If-None-Match':null,'OData-Version':_0xfe72('0x14')},'json':!![]};return rp(_0x5c2e09);})[_0xfe72('0xf')](function(_0x1a39df){var _0x3e4899=null;if(_0x1a39df){var _0x29c6c5=_0x1a39df['value'];var _0x462b6a=![];for(_0x3e4899=0x0;_0x3e4899<_0x29c6c5[_0xfe72('0x1a')];_0x3e4899++){if(_0x29c6c5[_0x3e4899][_0xfe72('0x30')]===_0x5d5e7d){_0x462b6a=!![];_0x34f6a5[_0xfe72('0x2d')]=_0x29c6c5[_0x3e4899]['contactid'];}}if(_0x462b6a){_0xa308f3(_0x34f6a5);}else{return createEndUser(_0x34f6a5,_0x42bf05,_0x47b3c8,_0x3495d1,_0x32c05d,_0xd05b89)[_0xfe72('0xf')](function(_0x7f1f27){logger[_0xfe72('0x1d')]('['+[_0xd05b89[_0xfe72('0x1e')]()]+_0xfe72('0x31'),_0x7f1f27['enduserId']);_0xa308f3(_0x7f1f27);});}}else{return createEndUser(_0x34f6a5,_0x42bf05,_0x47b3c8,_0x3495d1,_0x32c05d,_0xd05b89)['then'](function(_0x4b146e){logger[_0xfe72('0x1d')]('['+[_0xd05b89[_0xfe72('0x1e')]()]+']\x20Enduser\x20Created!',_0x4b146e[_0xfe72('0x2d')]);_0xa308f3(_0x4b146e);});}});});}function getCustomFields(_0x41e739,_0x781505,_0x242b16){var _0x547a07={};if(_0x41e739[_0xfe72('0x1a')]>0x0){_[_0xfe72('0x32')](_0x41e739,function(_0x3681e4){if(_[_0xfe72('0x33')]([_0xfe72('0x34'),_0xfe72('0x35')],_0x3681e4['type'])&&_0x3681e4['nameField']&&!_0x3681e4['customField']){var _0x14f73a=_0x3681e4['idField'][_0xfe72('0x25')]();var _0x108465=_0x14f73a[_0xfe72('0x2b')](0x0,_0x14f73a[_0xfe72('0x36')]('_'));var _0x3bb310=_0x14f73a[_0xfe72('0x2b')](_0x14f73a[_0xfe72('0x36')]('_')+0x1);if(_0x108465===_0x242b16){_0x547a07[_0x3bb310]=_0x3681e4[_0xfe72('0x37')];}}});}return _0x547a07;}function getTicket(_0x21a0dd,_0x5874a0,_0x5c82f6,_0x5e6b8b,_0xd1517b,_0x2183f1,_0x1a7d5c){return new BPromise(function(_0x3216f6,_0x34e6b5){var _0x51398a;return getAuthToken(_0x5874a0,_0x5c82f6,_0x1a7d5c)[_0xfe72('0xf')](function(_0x167ba7){if(_0x2183f1[_0xfe72('0x38')]===_0xfe72('0x39')){_0x51398a={'method':'POST','uri':_0x5e6b8b+'incidents','body':Object[_0xfe72('0x3a')]({},{'title':intUtil[_0xfe72('0x3b')](_0x2183f1[_0xfe72('0x3c')],_0xd1517b,'\x20'),'description':intUtil[_0xfe72('0x3b')](_0x2183f1[_0xfe72('0x3d')],_0xd1517b,'\x0a'),'customerid_contact@odata.bind':_0xfe72('0x3e')+_0x21a0dd[_0xfe72('0x2d')]+')','ownerid@odata.bind':'/systemusers('+_0x21a0dd[_0xfe72('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x2183f1[_0xfe72('0x3f')],_0xd1517b,_0x2183f1[_0xfe72('0x38')])),'headers':{'Authorization':'Bearer\x20'+_0x167ba7,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2183f1[_0xfe72('0x38')]===_0xfe72('0x40')){_0x51398a={'method':_0xfe72('0xb'),'uri':_0x5e6b8b+'phonecalls','body':Object[_0xfe72('0x3a')]({},{'subject':intUtil[_0xfe72('0x3b')](_0x2183f1[_0xfe72('0x3c')],_0xd1517b,'\x20'),'phonenumber':String(_0xd1517b[_0xfe72('0x28')]),'description':intUtil[_0xfe72('0x3b')](_0x2183f1[_0xfe72('0x3d')],_0xd1517b,'\x0a'),'regardingobjectid_contact@odata.bind':_0xfe72('0x3e')+_0x21a0dd[_0xfe72('0x2d')]+')','ownerid@odata.bind':_0xfe72('0x41')+_0x21a0dd['userId']+')','directioncode':_0x21a0dd[_0xfe72('0x42')]===_0xfe72('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xfe72('0x41')+_0x21a0dd['userId']+')','participationtypemask':_0x21a0dd[_0xfe72('0x42')]===_0xfe72('0x43')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x21a0dd[_0xfe72('0x2d')]+')','participationtypemask':_0x21a0dd[_0xfe72('0x42')]==='queue'?0x1:0x2}]},getCustomFields(_0x2183f1[_0xfe72('0x3f')],_0xd1517b,_0x2183f1[_0xfe72('0x38')])),'headers':{'Authorization':_0xfe72('0x44')+_0x167ba7,'OData-Version':_0xfe72('0x14')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x51398a);})[_0xfe72('0xf')](function(_0x511c58){var _0x39fe69=_0x511c58[_0xfe72('0x2a')][_0xfe72('0x45')];var _0x3dbbc7=_0x39fe69[_0xfe72('0x2b')](_0x39fe69[_0xfe72('0x2c')]('(')+0x1,_0x39fe69[_0xfe72('0x2c')](')'));_0x21a0dd['ticketId']=_0x3dbbc7;_0x3216f6(_0x21a0dd);})[_0xfe72('0x10')](function(_0x56aad1){_0x34e6b5(_0x56aad1['message']);});});}function emit(_0x51deca,_0x51e0c1,_0x30f292,_0x6b8e51){var _0x3d93c4={'uri':util['format'](_0xfe72('0x46'),_0x51deca,_0x30f292,_0x6b8e51)};io['to'](util[_0xfe72('0x47')](_0xfe72('0x48'),_0x51e0c1))['emit'](_0xfe72('0x49'),_0x3d93c4);}exports['cs']=function(_0x287e25,_0x4e78b6,_0x1576b5,_0x1b5d15,_0x232f7d,_0x34334f,_0xee668b,_0x5ddd3f){var _0x4a9b7b={};_0x34334f[_0xfe72('0xd')]=intUtil[_0xfe72('0x4a')](_0x34334f[_0xfe72('0xd')]);_0x34334f[_0xfe72('0x4b')]=intUtil[_0xfe72('0x4a')](_0x34334f[_0xfe72('0x4b')]);_0x4a9b7b[_0xfe72('0x42')]=_0x5ddd3f===_0xfe72('0x43')||_0x5ddd3f===_0xfe72('0x4c')?_0xfe72('0x43'):'outbound';var _0x31bd4d=util[_0xfe72('0x47')](_0xfe72('0x4d'),_0x34334f[_0xfe72('0xd')]);var _0x25f5a1=util[_0xfe72('0x47')](_0xfe72('0x4e'),_0x34334f[_0xfe72('0x4f')]);var _0x238af7=util[_0xfe72('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34334f[_0xfe72('0x4b')],_0x4e78b6[_0xfe72('0x50')],md5(_0x4e78b6[_0xfe72('0x50')]));if(_0x232f7d&&_0x232f7d[_0xfe72('0x51')]){logger[_0xfe72('0x1d')](_0xfe72('0x52'),_0xfe72('0x53'));_0x4e78b6['recordingURL']=_0x238af7;}else if(_0xee668b&&_0xee668b[_0xfe72('0x54')]&&_0xee668b['recordingFormat']!==_0xfe72('0x55')){logger[_0xfe72('0x1d')](_0xfe72('0x56'),_0xfe72('0x53'));_0x4e78b6[_0xfe72('0x57')]=_0x238af7;}else{_0x4e78b6['recordingURL']='';}return getUser(_0x4a9b7b,_0x34334f,_0x1b5d15,_0x25f5a1,_0x31bd4d,_0x5ddd3f)[_0xfe72('0xf')](function(_0x5df554){logger[_0xfe72('0x1d')]('['+_0x5ddd3f['toUpperCase']()+_0xfe72('0x58'),_0x5df554[_0xfe72('0x23')]);logger[_0xfe72('0x1d')]('['+_0x5ddd3f[_0xfe72('0x1e')]()+_0xfe72('0x59'),_0x5df554['userEmail']);return getEndUser(_0x5df554,_0x34334f,_0x25f5a1,_0x31bd4d,_0x4e78b6,_0x5ddd3f);})['then'](function(_0x3cf6c3){logger['info']('['+_0x5ddd3f['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x3cf6c3[_0xfe72('0x2d')]);logger['info']('['+_0x5ddd3f[_0xfe72('0x1e')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x4e78b6[_0xfe72('0x28')]);return getTicket(_0x3cf6c3,_0x34334f,_0x25f5a1,_0x31bd4d,_0x4e78b6,_0x1576b5,_0x5ddd3f);})[_0xfe72('0xf')](function(_0x22a777){logger['info'](util[_0xfe72('0x47')]('['+_0x5ddd3f[_0xfe72('0x1e')]()+_0xfe72('0x5a'),_0x1576b5[_0xfe72('0x38')],_0x22a777[_0xfe72('0x5b')]));logger[_0xfe72('0x1d')](util['format']('['+_0x5ddd3f[_0xfe72('0x1e')]()+']\x20Call\x20direction:\x20%s',_0x5ddd3f));if(_0x5ddd3f!=='unmanaged'){logger[_0xfe72('0x1d')]('['+_0x5ddd3f[_0xfe72('0x1e')]()+']',_0xfe72('0x5c'));emit(_0x34334f[_0xfe72('0xd')],_0x1b5d15[_0xfe72('0x5d')],_0x1576b5[_0xfe72('0x38')],_0x22a777[_0xfe72('0x5b')]);}})[_0xfe72('0x10')](function(_0x4dbaf6){logger['error']('['+_0x5ddd3f[_0xfe72('0x1e')]()+_0xfe72('0x5e'),util[_0xfe72('0x5f')](_0x4dbaf6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1375=['format','user:%s','emit','trigger:browser:url','serverUrl','stripTrailingSlash','%s/api/data/v9.0/','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','POST','remoteUri','username','password','clientSecret','access_token','toUpperCase',']\x20Wrong\x20credentials!','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','catch','toLowerCase','destcalleridnum','calleridnum','/systemusers(','headers','substring','lastIndexOf','enduserId','outbound','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','picklist','type','customField','idField','indexOf','content','ticketType','incident','assign','getString','Subjects','Descriptions','/contacts(','phonecall','phonecalls','callDirection','queue','Fields','odata-entityid','message'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1375,0xed));var _0x5137=function(_0x3bed1a,_0x11524c){_0x3bed1a=_0x3bed1a-0x0;var _0x2f4cfe=_0x1375[_0x3bed1a];return _0x2f4cfe;};'use strict';var _=require(_0x5137('0x0'));var BPromise=require(_0x5137('0x1'));var rp=require(_0x5137('0x2'));var util=require(_0x5137('0x3'));var intUtil=require(_0x5137('0x4'));var md5=require(_0x5137('0x5'));var Redis=require(_0x5137('0x6'));var logger=require(_0x5137('0x7'))(_0x5137('0x8'));var config=require(_0x5137('0x9'));config['redis']=_[_0x5137('0xa')](config[_0x5137('0xb')],{'host':_0x5137('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x8b2eaf,_0x46f17c,_0x1cf9d9){var _0x5d65e5={'method':_0x5137('0xd'),'uri':_0x46f17c,'form':{'client_id':_0x8b2eaf['clientId'],'resource':_0x8b2eaf[_0x5137('0xe')],'username':_0x8b2eaf[_0x5137('0xf')],'password':_0x8b2eaf[_0x5137('0x10')],'grant_type':_0x5137('0x10'),'client_secret':_0x8b2eaf[_0x5137('0x11')]},'json':!![]};return rp(_0x5d65e5)['then'](function(_0x23f264){return _0x23f264[_0x5137('0x12')];})['catch'](function(_0x3921bb){logger['error']('['+[_0x1cf9d9[_0x5137('0x13')]()]+_0x5137('0x14'));return _0x3921bb['message'];});}function getUser(_0x2f654d,_0x385b1b,_0x42f82b,_0x4266ab,_0x521268,_0x193070){return new BPromise(function(_0x9248f6,_0x367b91){return getAuthToken(_0x385b1b,_0x4266ab,_0x193070)[_0x5137('0x15')](function(_0x46d248){var _0x21d106={'method':'GET','uri':_0x521268+_0x5137('0x16'),'headers':{'Authorization':_0x5137('0x17')+_0x46d248,'OData-Version':_0x5137('0x18')},'json':!![]};return rp(_0x21d106);})[_0x5137('0x15')](function(_0x421456){var _0x9a7fb3=_0x421456[_0x5137('0x19')];var _0x521f18=![];var _0x2c7699=null;if(!_[_0x5137('0x1a')](_0x42f82b)){if(intUtil[_0x5137('0x1b')](_0x42f82b[_0x5137('0x1c')])){_0x2f654d[_0x5137('0x1d')]=_0x42f82b[_0x5137('0x1c')];for(_0x2c7699=0x0;_0x2c7699<_0x9a7fb3[_0x5137('0x1e')];_0x2c7699++){if(_0x9a7fb3[_0x2c7699][_0x5137('0x1f')]===_0x42f82b[_0x5137('0x1c')]&&!_0x9a7fb3[_0x2c7699][_0x5137('0x20')]){_0x521f18=!![];logger[_0x5137('0x21')]('['+[_0x193070[_0x5137('0x13')]()]+_0x5137('0x22')+_0x9a7fb3[_0x2c7699][_0x5137('0x23')]+'!');_0x2f654d['userId']=_0x9a7fb3[_0x2c7699][_0x5137('0x23')];}}}}if(!_0x521f18){logger['info']('['+[_0x193070['toUpperCase']()]+_0x5137('0x24'));_0x2f654d[_0x5137('0x1d')]=_0x385b1b[_0x5137('0xf')];for(_0x2c7699=0x0;_0x2c7699<_0x9a7fb3[_0x5137('0x1e')];_0x2c7699++){if(_0x9a7fb3[_0x2c7699][_0x5137('0x1f')]===_0x385b1b[_0x5137('0xf')]){_0x2f654d[_0x5137('0x25')]=_0x9a7fb3[_0x2c7699][_0x5137('0x23')];}}}_0x9248f6(_0x2f654d);})[_0x5137('0x26')](function(_0x2dbceb){_0x367b91(_0x2dbceb['message']);});});}function createEndUser(_0x580d50,_0x2bd143,_0x4f5517,_0x5bf68f,_0x566653,_0x25cdfe){return new BPromise(function(_0x325473,_0xebe2e3){return getAuthToken(_0x2bd143,_0x4f5517,_0x25cdfe)['then'](function(_0x5928e5){var _0x5f0d65=_0x25cdfe[_0x5137('0x27')]()==='outbound'?_0x566653[_0x5137('0x28')]:_0x566653[_0x5137('0x29')];var _0x4c04bb={'method':_0x5137('0xd'),'uri':_0x5bf68f+'contacts','body':{'telephone1':_0x5f0d65,'fullname':_0x5f0d65,'firstname':_0x5f0d65,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5137('0x2a')+_0x580d50[_0x5137('0x25')]+')'},'headers':{'Authorization':_0x5137('0x17')+_0x5928e5,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4c04bb);})[_0x5137('0x15')](function(_0x416963){var _0x981451=_0x416963[_0x5137('0x2b')]['odata-entityid'];var _0x1b199e=_0x981451[_0x5137('0x2c')](_0x981451[_0x5137('0x2d')]('(')+0x1,_0x981451[_0x5137('0x2d')](')'));_0x580d50[_0x5137('0x2e')]=_0x1b199e;_0x325473(_0x580d50);})['catch'](function(_0x55dd64){_0xebe2e3(_0x55dd64['message']);});});}function getEndUser(_0x1f77a5,_0x1bd615,_0x227418,_0x1a9605,_0x59650b,_0x58ddae){return new BPromise(function(_0x3a73a3,_0x2664f4){var _0x270c71=_0x58ddae['toLowerCase']()===_0x5137('0x2f')?_0x59650b[_0x5137('0x28')]:_0x59650b[_0x5137('0x29')];return getAuthToken(_0x1bd615,_0x227418,_0x58ddae)[_0x5137('0x15')](function(_0x302f2c){var _0x3e21f4={'method':_0x5137('0x30'),'uri':_0x1a9605+_0x5137('0x31')+_0x270c71[_0x5137('0x32')]('+',_0x5137('0x33'))+'\x27','headers':{'Authorization':_0x5137('0x17')+_0x302f2c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3e21f4);})[_0x5137('0x15')](function(_0x482fb6){var _0x4f5afe=null;if(_0x482fb6){var _0x5f4609=_0x482fb6[_0x5137('0x19')];var _0x4fcc9b=![];for(_0x4f5afe=0x0;_0x4f5afe<_0x5f4609[_0x5137('0x1e')];_0x4f5afe++){if(_0x5f4609[_0x4f5afe][_0x5137('0x34')]===_0x270c71){_0x4fcc9b=!![];_0x1f77a5['enduserId']=_0x5f4609[_0x4f5afe][_0x5137('0x35')];}}if(_0x4fcc9b){_0x3a73a3(_0x1f77a5);}else{return createEndUser(_0x1f77a5,_0x1bd615,_0x227418,_0x1a9605,_0x59650b,_0x58ddae)[_0x5137('0x15')](function(_0x24a750){logger[_0x5137('0x21')]('['+[_0x58ddae['toUpperCase']()]+_0x5137('0x36'),_0x24a750[_0x5137('0x2e')]);_0x3a73a3(_0x24a750);});}}else{return createEndUser(_0x1f77a5,_0x1bd615,_0x227418,_0x1a9605,_0x59650b,_0x58ddae)[_0x5137('0x15')](function(_0x4f27f0){logger['info']('['+[_0x58ddae[_0x5137('0x13')]()]+_0x5137('0x37'),_0x4f27f0[_0x5137('0x2e')]);_0x3a73a3(_0x4f27f0);});}});});}function getCustomFields(_0x14ff87,_0x380f73,_0x15047c){var _0x572c8f={};if(_0x14ff87[_0x5137('0x1e')]>0x0){_[_0x5137('0x38')](_0x14ff87,function(_0x2e90fd){if(_[_0x5137('0x39')](['string',_0x5137('0x3a')],_0x2e90fd[_0x5137('0x3b')])&&_0x2e90fd['nameField']&&!_0x2e90fd[_0x5137('0x3c')]){var _0x55d389=_0x2e90fd[_0x5137('0x3d')][_0x5137('0x27')]();var _0x271f16=_0x55d389['substring'](0x0,_0x55d389[_0x5137('0x3e')]('_'));var _0x2f9258=_0x55d389[_0x5137('0x2c')](_0x55d389['indexOf']('_')+0x1);if(_0x271f16===_0x15047c){_0x572c8f[_0x2f9258]=_0x2e90fd[_0x5137('0x3f')];}}});}return _0x572c8f;}function getTicket(_0x4834bd,_0x299066,_0x44c2d9,_0x3b56fb,_0x45bcbc,_0x38826c,_0x4e2ee6){return new BPromise(function(_0x1817e0,_0x405427){var _0x431cea;return getAuthToken(_0x299066,_0x44c2d9,_0x4e2ee6)[_0x5137('0x15')](function(_0x105fec){if(_0x38826c[_0x5137('0x40')]===_0x5137('0x41')){_0x431cea={'method':'POST','uri':_0x3b56fb+'incidents','body':Object[_0x5137('0x42')]({},{'title':intUtil[_0x5137('0x43')](_0x38826c[_0x5137('0x44')],_0x45bcbc,'\x20'),'description':intUtil[_0x5137('0x43')](_0x38826c[_0x5137('0x45')],_0x45bcbc,'\x0a'),'customerid_contact@odata.bind':_0x5137('0x46')+_0x4834bd['enduserId']+')','ownerid@odata.bind':_0x5137('0x2a')+_0x4834bd[_0x5137('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x38826c['Fields'],_0x45bcbc,_0x38826c['ticketType'])),'headers':{'Authorization':_0x5137('0x17')+_0x105fec,'OData-Version':_0x5137('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x38826c[_0x5137('0x40')]===_0x5137('0x47')){_0x431cea={'method':'POST','uri':_0x3b56fb+_0x5137('0x48'),'body':Object[_0x5137('0x42')]({},{'subject':intUtil[_0x5137('0x43')](_0x38826c[_0x5137('0x44')],_0x45bcbc,'\x20'),'phonenumber':String(_0x45bcbc[_0x5137('0x29')]),'description':intUtil[_0x5137('0x43')](_0x38826c[_0x5137('0x45')],_0x45bcbc,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5137('0x46')+_0x4834bd[_0x5137('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x4834bd[_0x5137('0x25')]+')','directioncode':_0x4834bd[_0x5137('0x49')]===_0x5137('0x4a')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x5137('0x2a')+_0x4834bd[_0x5137('0x25')]+')','participationtypemask':_0x4834bd[_0x5137('0x49')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x5137('0x46')+_0x4834bd[_0x5137('0x2e')]+')','participationtypemask':_0x4834bd[_0x5137('0x49')]===_0x5137('0x4a')?0x1:0x2}]},getCustomFields(_0x38826c[_0x5137('0x4b')],_0x45bcbc,_0x38826c[_0x5137('0x40')])),'headers':{'Authorization':_0x5137('0x17')+_0x105fec,'OData-Version':_0x5137('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x431cea);})['then'](function(_0x1bfc4b){var _0x4c14e9=_0x1bfc4b[_0x5137('0x2b')][_0x5137('0x4c')];var _0x28249b=_0x4c14e9[_0x5137('0x2c')](_0x4c14e9[_0x5137('0x2d')]('(')+0x1,_0x4c14e9[_0x5137('0x2d')](')'));_0x4834bd['ticketId']=_0x28249b;_0x1817e0(_0x4834bd);})['catch'](function(_0x211697){_0x405427(_0x211697[_0x5137('0x4d')]);});});}function emit(_0x2ec1ea,_0x585a0f,_0x16f344,_0xbed4da){var _0x43b84e={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x2ec1ea,_0x16f344,_0xbed4da)};io['to'](util[_0x5137('0x4e')](_0x5137('0x4f'),_0x585a0f))[_0x5137('0x50')](_0x5137('0x51'),_0x43b84e);}exports['cs']=function(_0x53d614,_0x35360b,_0x3e81a9,_0x1c25a2,_0x3017a1,_0x49633c,_0x3ea96c,_0x219cec){var _0x416cf1={};_0x49633c['remoteUri']=intUtil['stripTrailingSlash'](_0x49633c[_0x5137('0xe')]);_0x49633c[_0x5137('0x52')]=intUtil[_0x5137('0x53')](_0x49633c[_0x5137('0x52')]);_0x416cf1['callDirection']=_0x219cec===_0x5137('0x4a')||_0x219cec==='unmanaged'?'queue':_0x5137('0x2f');var _0x1fe2bd=util['format'](_0x5137('0x54'),_0x49633c['remoteUri']);var _0x58a889=util[_0x5137('0x4e')]('https://login.microsoftonline.com/%s/oauth2/token',_0x49633c[_0x5137('0x55')]);var _0x331799=util[_0x5137('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49633c[_0x5137('0x52')],_0x35360b[_0x5137('0x56')],md5(_0x35360b[_0x5137('0x56')]));if(_0x3017a1&&_0x3017a1[_0x5137('0x57')]){logger[_0x5137('0x21')](_0x5137('0x58'),_0x5137('0x59'));_0x35360b['recordingURL']=_0x331799;}else if(_0x3ea96c&&_0x3ea96c[_0x5137('0x5a')]&&_0x3ea96c[_0x5137('0x5a')]!==_0x5137('0x5b')){logger[_0x5137('0x21')]('[OUTBOUND]',_0x5137('0x59'));_0x35360b['recordingURL']=_0x331799;}else{_0x35360b[_0x5137('0x5c')]='';}return getUser(_0x416cf1,_0x49633c,_0x1c25a2,_0x58a889,_0x1fe2bd,_0x219cec)[_0x5137('0x15')](function(_0x3c3faa){logger[_0x5137('0x21')]('['+_0x219cec[_0x5137('0x13')]()+_0x5137('0x5d'),_0x3c3faa[_0x5137('0x25')]);logger[_0x5137('0x21')]('['+_0x219cec['toUpperCase']()+_0x5137('0x5e'),_0x3c3faa[_0x5137('0x1d')]);return getEndUser(_0x3c3faa,_0x49633c,_0x58a889,_0x1fe2bd,_0x35360b,_0x219cec);})[_0x5137('0x15')](function(_0x40921d){logger[_0x5137('0x21')]('['+_0x219cec[_0x5137('0x13')]()+_0x5137('0x5f'),_0x40921d[_0x5137('0x2e')]);logger[_0x5137('0x21')]('['+_0x219cec[_0x5137('0x13')]()+_0x5137('0x60'),_0x35360b[_0x5137('0x29')]);return getTicket(_0x40921d,_0x49633c,_0x58a889,_0x1fe2bd,_0x35360b,_0x3e81a9,_0x219cec);})['then'](function(_0x39f475){logger[_0x5137('0x21')](util[_0x5137('0x4e')]('['+_0x219cec[_0x5137('0x13')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x3e81a9['ticketType'],_0x39f475[_0x5137('0x61')]));logger['info'](util[_0x5137('0x4e')]('['+_0x219cec[_0x5137('0x13')]()+_0x5137('0x62'),_0x219cec));if(_0x219cec!==_0x5137('0x63')){logger[_0x5137('0x21')]('['+_0x219cec['toUpperCase']()+']',_0x5137('0x64'));emit(_0x49633c[_0x5137('0xe')],_0x1c25a2[_0x5137('0x65')],_0x3e81a9[_0x5137('0x40')],_0x39f475['ticketId']);}})['catch'](function(_0xa3c357){logger[_0x5137('0x66')]('['+_0x219cec['toUpperCase']()+_0x5137('0x67'),util[_0x5137('0x68')](_0xa3c357,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index eb1fd99..6d5a29c 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 _0xab41=['Subjects','Descriptions','name','Fields','custom_fields','keyBy','value','%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','base64','debug','[HTTP]','stringify','defaults','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','toString','idField','push','content','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','error','monitor_format','lastevent','Authorization','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','freshdesk','redis','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0xab41,0x104));var _0x1ab4=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xab41[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x1ab4('0x0'));var rp=require(_0x1ab4('0x1'));var md5=require('md5');var util=require(_0x1ab4('0x2'));var Redis=require(_0x1ab4('0x3'));var intUtil=require(_0x1ab4('0x4'));var config=require(_0x1ab4('0x5'));var logger=require('../../../../config/logger')(_0x1ab4('0x6'));config[_0x1ab4('0x7')]=_['defaults'](config[_0x1ab4('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x1ab4('0x8'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x1ab4('0x9')};function emit(_0x304d1b,_0xf18852,_0x52578e){io['to'](_0x304d1b)['emit'](_0xf18852,_0x52578e);}function getTicket(_0x187f1c,_0x5b6ee2,_0x1e56b2,_0x289289,_0x8d2c65){logger[_0x1ab4('0xa')](_0x1ab4('0xb'));var _0x24ab26=_['merge']({'responder_id':_0x5b6ee2['id'],'requester_id':_0x1e56b2['id'],'name':util[_0x1ab4('0xc')](_0x1ab4('0xd'),_0x8d2c65[_0x1ab4('0xe')]),'phone':_0x8d2c65[_0x1ab4('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x289289[_0x1ab4('0x10')],_0x8d2c65,'\x20'),'description':intUtil['getString'](_0x289289[_0x1ab4('0x11')],_0x8d2c65,'
'),'tags':getTags(_0x289289['Tags'],_0x1ab4('0x12'))},getCustomFields(_0x289289[_0x1ab4('0x13')],_0x8d2c65));_0x24ab26[_0x1ab4('0x14')]=_['mapValues'](_[_0x1ab4('0x15')](_0x24ab26['custom_fields'],'id'),_0x1ab4('0x16'));return request({'uri':util[_0x1ab4('0xc')](_0x1ab4('0x17'),_0x187f1c[_0x1ab4('0x18')]),'method':_0x1ab4('0x19'),'body':_0x24ab26})[_0x1ab4('0x1a')](function(_0x1cd7c5){logger['info'](_0x1ab4('0x1b'));return _0x1cd7c5;});}function getUser(_0x255203,_0x107733){if(intUtil[_0x1ab4('0x1c')](_0x107733)){return request({'uri':util[_0x1ab4('0xc')](_0x1ab4('0x1d'),_0x255203['remoteUri']),'qs':{'email':_0x107733}})[_0x1ab4('0x1a')](function(_0x27236a){if(_0x27236a[_0x1ab4('0x1e')]){logger['info'](_0x1ab4('0x1f'));return _['find'](_0x27236a,function(_0x2c306d){return _0x2c306d[_0x1ab4('0x20')][_0x1ab4('0x21')]===_0x107733;});}else{logger['info'](_0x1ab4('0x22'));return request({'uri':util[_0x1ab4('0xc')](_0x1ab4('0x23'),_0x255203['remoteUri'])})[_0x1ab4('0x1a')](function(_0x307e87){logger['info'](_0x1ab4('0x24'));return _0x307e87;});}});}else{logger[_0x1ab4('0xa')](_0x1ab4('0x25'));return request({'uri':util[_0x1ab4('0xc')]('%s/api/v2/agents/me',_0x255203['remoteUri'])})[_0x1ab4('0x1a')](function(_0x1cf004){logger[_0x1ab4('0xa')](_0x1ab4('0x24'));return _0x1cf004;});}}function getEndUser(_0x8ea51a,_0x2f581e,_0x5c760d){logger['info'](_0x1ab4('0x26'),_0x5c760d);return request({'uri':util[_0x1ab4('0xc')](_0x1ab4('0x27'),_0x8ea51a[_0x1ab4('0x18')]),'qs':{'phone':_0x5c760d}})[_0x1ab4('0x1a')](function(_0x223935){if(_0x223935[_0x1ab4('0x1e')]){logger[_0x1ab4('0xa')](_0x1ab4('0x28'));return _[_0x1ab4('0x29')](_0x223935,{'phone':_0x5c760d});}else{logger['info'](_0x1ab4('0x2a'));return request({'uri':util[_0x1ab4('0xc')](_0x1ab4('0x27'),_0x8ea51a[_0x1ab4('0x18')]),'method':_0x1ab4('0x19'),'body':{'name':_0x2f581e,'phone':_0x5c760d}})[_0x1ab4('0x1a')](function(_0x1df339){logger['info'](_0x1ab4('0x2b'));return _0x1df339;});}});}function getAuth(_0x5c6e63){return util[_0x1ab4('0xc')](_0x1ab4('0x2c'),new Buffer(_0x5c6e63['apiKey']+':X')['toString'](_0x1ab4('0x2d')));}function request(_0x11e693){logger[_0x1ab4('0x2e')](_0x1ab4('0x2f'),JSON[_0x1ab4('0x30')](_0x11e693));return rp(_[_0x1ab4('0x31')](_0x11e693,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x22213a,_0xb28c99){var _0x1b445f=[];if(_0x22213a&&_0x22213a['length']>0x0){_0x1b445f=_[_0x1ab4('0x32')](_0x22213a,_0xb28c99);}return _0x1b445f;}function getCustomFields(_0x2b50ce,_0x39b97a){var _0x10873f=[];var _0x1aee77={'custom_fields':[]};if(_0x2b50ce[_0x1ab4('0x1e')]>0x0){_[_0x1ab4('0x33')](_0x2b50ce,function(_0xb8f6c4){if(_[_0x1ab4('0x34')]([_0x1ab4('0x35'),_0x1ab4('0x36')],_0xb8f6c4[_0x1ab4('0x37')])&&_0xb8f6c4[_0x1ab4('0x38')]&&!_0xb8f6c4[_0x1ab4('0x39')]){_0x1aee77[_0xb8f6c4[_0x1ab4('0x38')][_0x1ab4('0x3a')]()]=_0xb8f6c4['content'][_0x1ab4('0x3b')]();}else if(_[_0x1ab4('0x34')]([_0x1ab4('0x35'),_0x1ab4('0x36')],_0xb8f6c4[_0x1ab4('0x37')])&&_0xb8f6c4[_0x1ab4('0x3c')]&&_0xb8f6c4[_0x1ab4('0x39')]){_0x1aee77[_0x1ab4('0x14')][_0x1ab4('0x3d')]({'id':_0xb8f6c4[_0x1ab4('0x3c')],'value':_0xb8f6c4[_0x1ab4('0x3e')][_0x1ab4('0x3b')]()});}else if(_0xb8f6c4['type']===_0x1ab4('0x3f')&&_0xb8f6c4[_0x1ab4('0x40')]&&_0xb8f6c4[_0x1ab4('0x3c')]&&_0xb8f6c4[_0x1ab4('0x39')]){_0x39b97a[_0xb8f6c4[_0x1ab4('0x40')]]&&_0x1aee77[_0x1ab4('0x14')][_0x1ab4('0x3d')]({'id':_0xb8f6c4['idField'],'value':_0x39b97a[_0xb8f6c4[_0x1ab4('0x40')]]['toString']()});}else if(_0xb8f6c4[_0x1ab4('0x37')]==='customVariable'&&_0xb8f6c4['Variable']&&_0xb8f6c4['Variable'][_0x1ab4('0x12')]&&_0xb8f6c4[_0x1ab4('0x3c')]&&_0xb8f6c4[_0x1ab4('0x39')]){_0x39b97a[_0xb8f6c4['Variable']['name'][_0x1ab4('0x3a')]()]&&_0x1aee77['custom_fields'][_0x1ab4('0x3d')]({'id':_0xb8f6c4['idField'],'value':_0x39b97a[_0xb8f6c4[_0x1ab4('0x41')]['name']['toLowerCase']()][_0x1ab4('0x3b')]()});}});}return _0x1aee77;}exports[_0x1ab4('0x42')]=function(_0x270dca,_0x32e505,_0x5bcfb7,_0x24aa60,_0x4e029d,_0x2fa2b5){var _0x4eaa47,_0x2e26d8;_0x2fa2b5['remoteUri']=intUtil[_0x1ab4('0x43')](_0x2fa2b5[_0x1ab4('0x18')]);_0x2fa2b5[_0x1ab4('0x44')]=intUtil['stripTrailingSlash'](_0x2fa2b5[_0x1ab4('0x44')]);if(_0x4e029d&&_0x4e029d['monitor_format']){logger[_0x1ab4('0xa')](_0x1ab4('0x45'),_0x1ab4('0x46'));_0x32e505[_0x1ab4('0x47')]=util[_0x1ab4('0xc')](_0x1ab4('0x48'),_0x2fa2b5[_0x1ab4('0x44')],_0x32e505['uniqueid'],md5(_0x32e505[_0x1ab4('0x49')]));}else{_0x32e505[_0x1ab4('0x47')]='';}headers['Authorization']=getAuth(_0x2fa2b5);return getUser(_0x2fa2b5,_0x24aa60['email'])[_0x1ab4('0x1a')](function(_0xf43649){_0x4eaa47=_0xf43649;logger[_0x1ab4('0xa')](_0x1ab4('0x4a'),_0x4eaa47['id']);return getEndUser(_0x2fa2b5,_0x32e505[_0x1ab4('0xe')],_0x32e505[_0x1ab4('0xf')]);})[_0x1ab4('0x1a')](function(_0x44d530){_0x2e26d8=_0x44d530;logger[_0x1ab4('0xa')](_0x1ab4('0x4b'),_0x2e26d8['id']);return getTicket(_0x2fa2b5,_0x4eaa47,_0x2e26d8,_0x5bcfb7,_0x32e505);})[_0x1ab4('0x1a')](function(_0x9df57a){if(_0x9df57a&&_0x9df57a['id']){logger['info'](_0x1ab4('0x1b'));logger[_0x1ab4('0xa')](_0x1ab4('0x4c'),_0x9df57a['id']);logger['info'](_0x1ab4('0x45'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x1ab4('0x4d'),_0x24aa60[_0x1ab4('0x12')]),_0x1ab4('0x4e'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x2fa2b5[_0x1ab4('0x18')],_0x9df57a['id'])});}})[_0x1ab4('0x4f')](function(_0x5d38ab){logger['error'](_0x1ab4('0x45'),JSON[_0x1ab4('0x30')](_0x5d38ab));});};exports['outbound']=function(_0x244b7f,_0x22ee47,_0x37271f,_0x578676,_0x525d60,_0x4e224c,_0xb8c108){var _0x541b55,_0x314bbb;_0x4e224c[_0x1ab4('0x18')]=intUtil[_0x1ab4('0x43')](_0x4e224c[_0x1ab4('0x18')]);_0x4e224c[_0x1ab4('0x44')]=intUtil[_0x1ab4('0x43')](_0x4e224c[_0x1ab4('0x44')]);if(_0xb8c108&&_0xb8c108[_0x1ab4('0x50')]&&_0xb8c108[_0x1ab4('0x50')]!==_0x1ab4('0x51')){logger[_0x1ab4('0xa')](_0x1ab4('0x52'),_0x1ab4('0x46'));_0x22ee47[_0x1ab4('0x47')]=util[_0x1ab4('0xc')](_0x1ab4('0x48'),_0x4e224c[_0x1ab4('0x44')],_0x22ee47['uniqueid'],md5(_0x22ee47['uniqueid']));}headers['Authorization']=getAuth(_0x4e224c);return getUser(_0x4e224c,_0x578676[_0x1ab4('0x21')])['then'](function(_0x4d754d){_0x541b55=_0x4d754d;logger[_0x1ab4('0xa')](_0x1ab4('0x4a'),_0x541b55['id']);return getEndUser(_0x4e224c,_0x22ee47[_0x1ab4('0x53')],_0x22ee47[_0x1ab4('0x54')]);})[_0x1ab4('0x1a')](function(_0x33eae7){_0x314bbb=_0x33eae7;logger['info'](_0x1ab4('0x4b'),_0x314bbb['id']);return getTicket(_0x4e224c,_0x541b55,_0x314bbb,_0x37271f,_0x22ee47);})[_0x1ab4('0x1a')](function(_0x7b104d){if(_0x7b104d&&_0x7b104d['id']){logger['info'](_0x1ab4('0x1b'));logger['info'](_0x1ab4('0x4c'),_0x7b104d['id']);logger[_0x1ab4('0xa')]('[OUTBOUND]',_0x1ab4('0x55'));emit(util[_0x1ab4('0xc')](_0x1ab4('0x4d'),_0x578676['name']),_0x1ab4('0x4e'),{'uri':util[_0x1ab4('0xc')](_0x1ab4('0x56'),_0x4e224c[_0x1ab4('0x18')],_0x7b104d['id'])});}})[_0x1ab4('0x4f')](function(_0x38158d){logger[_0x1ab4('0x57')](_0x1ab4('0x52'),JSON[_0x1ab4('0x30')](_0x38158d));});};exports['unmanaged']=function(_0x73b862,_0x12f925,_0x6a40ef,_0x286d1a,_0x31a889,_0x5dbf34){var _0x40c9a5,_0x5da73b;_0x5dbf34[_0x1ab4('0x18')]=intUtil[_0x1ab4('0x43')](_0x5dbf34['remoteUri']);_0x5dbf34[_0x1ab4('0x44')]=intUtil[_0x1ab4('0x43')](_0x5dbf34[_0x1ab4('0x44')]);if(_0x31a889&&_0x31a889[_0x1ab4('0x58')]){logger[_0x1ab4('0xa')]('['+_0x12f925[_0x1ab4('0x59')]['toUpperCase']()+']',_0x1ab4('0x46'));_0x12f925[_0x1ab4('0x47')]=util[_0x1ab4('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5dbf34[_0x1ab4('0x44')],_0x12f925[_0x1ab4('0x49')],md5(_0x12f925[_0x1ab4('0x49')]));}else{_0x12f925[_0x1ab4('0x47')]='';}headers[_0x1ab4('0x5a')]=getAuth(_0x5dbf34);return getUser(_0x5dbf34,'')[_0x1ab4('0x1a')](function(_0x344b1f){_0x40c9a5=_0x344b1f;logger[_0x1ab4('0xa')](_0x1ab4('0x4a'),_0x40c9a5['id']);return getEndUser(_0x5dbf34,_0x12f925[_0x1ab4('0xe')],_0x12f925['calleridnum']);})[_0x1ab4('0x1a')](function(_0xa03b48){_0x5da73b=_0xa03b48;logger[_0x1ab4('0xa')]('The\x20Enduser\x20ID\x20is:',_0x5da73b['id']);return getTicket(_0x5dbf34,_0x40c9a5,_0x5da73b,_0x6a40ef,_0x12f925);})[_0x1ab4('0x1a')](function(_0x5762db){if(_0x5762db){logger['info']('Ticket\x20created!');logger[_0x1ab4('0xa')](_0x1ab4('0x4c'),_0x5762db['id']);}})[_0x1ab4('0x4f')](function(_0x58e324){logger[_0x1ab4('0x57')]('['+_0x12f925[_0x1ab4('0x59')][_0x1ab4('0x5b')]()+']',JSON[_0x1ab4('0x30')](_0x58e324));});}; \ No newline at end of file +var _0x47e4=['%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','push','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','catch','error','lastevent','toUpperCase','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','calleridnum','getString','Subjects','
','Tags','name','Fields','custom_fields','mapValues','keyBy','format','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','email','%s/api/v2/agents/me'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x47e4,0x8a));var _0x447e=function(_0x41b8fa,_0x5b9877){_0x41b8fa=_0x41b8fa-0x0;var _0x5ba5aa=_0x47e4[_0x41b8fa];return _0x5ba5aa;};'use strict';var _=require('lodash');var rp=require(_0x447e('0x0'));var md5=require(_0x447e('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x447e('0x2'));var config=require(_0x447e('0x3'));var logger=require(_0x447e('0x4'))('freshdesk');config['redis']=_[_0x447e('0x5')](config[_0x447e('0x6')],{'host':_0x447e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x447e('0x6')]));var headers={'Content-Type':_0x447e('0x8'),'Accept':_0x447e('0x8')};function emit(_0x3c9eed,_0x4ccb0b,_0x3f98a5){io['to'](_0x3c9eed)[_0x447e('0x9')](_0x4ccb0b,_0x3f98a5);}function getTicket(_0x29d184,_0x42c694,_0x449457,_0x1efcda,_0x23b1b4){logger[_0x447e('0xa')](_0x447e('0xb'));var _0x306b1a=_[_0x447e('0xc')]({'responder_id':_0x42c694['id'],'requester_id':_0x449457['id'],'name':util['format']('Caller\x20-\x20%s',_0x23b1b4['calleridname']),'phone':_0x23b1b4[_0x447e('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x447e('0xe')](_0x1efcda[_0x447e('0xf')],_0x23b1b4,'\x20'),'description':intUtil['getString'](_0x1efcda['Descriptions'],_0x23b1b4,_0x447e('0x10')),'tags':getTags(_0x1efcda[_0x447e('0x11')],_0x447e('0x12'))},getCustomFields(_0x1efcda[_0x447e('0x13')],_0x23b1b4));_0x306b1a[_0x447e('0x14')]=_[_0x447e('0x15')](_[_0x447e('0x16')](_0x306b1a[_0x447e('0x14')],'id'),'value');return request({'uri':util[_0x447e('0x17')](_0x447e('0x18'),_0x29d184[_0x447e('0x19')]),'method':'POST','body':_0x306b1a})[_0x447e('0x1a')](function(_0x272aee){logger[_0x447e('0xa')](_0x447e('0x1b'));return _0x272aee;});}function getUser(_0x25845f,_0x172d7e){if(intUtil[_0x447e('0x1c')](_0x172d7e)){return request({'uri':util['format']('%s/api/v2/agents',_0x25845f[_0x447e('0x19')]),'qs':{'email':_0x172d7e}})[_0x447e('0x1a')](function(_0x4d8f3b){if(_0x4d8f3b[_0x447e('0x1d')]){logger[_0x447e('0xa')](_0x447e('0x1e'));return _[_0x447e('0x1f')](_0x4d8f3b,function(_0x596a06){return _0x596a06['contact'][_0x447e('0x20')]===_0x172d7e;});}else{logger[_0x447e('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x447e('0x21'),_0x25845f[_0x447e('0x19')])})[_0x447e('0x1a')](function(_0x188fed){logger[_0x447e('0xa')]('Admin\x20account\x20selected.');return _0x188fed;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x447e('0x17')](_0x447e('0x21'),_0x25845f[_0x447e('0x19')])})[_0x447e('0x1a')](function(_0x24c3ce){logger[_0x447e('0xa')]('Admin\x20account\x20selected.');return _0x24c3ce;});}}function getEndUser(_0x9af38,_0xc58102,_0x2c4678){logger[_0x447e('0xa')]('Searching\x20enduser\x20with\x20phone',_0x2c4678);return request({'uri':util[_0x447e('0x17')](_0x447e('0x22'),_0x9af38[_0x447e('0x19')]),'qs':{'phone':_0x2c4678}})[_0x447e('0x1a')](function(_0x1248c1){if(_0x1248c1[_0x447e('0x1d')]){logger[_0x447e('0xa')]('Enduser\x20found!');return _[_0x447e('0x1f')](_0x1248c1,{'phone':_0x2c4678});}else{logger[_0x447e('0xa')](_0x447e('0x23'));return request({'uri':util[_0x447e('0x17')](_0x447e('0x22'),_0x9af38['remoteUri']),'method':_0x447e('0x24'),'body':{'name':_0xc58102,'phone':_0x2c4678}})[_0x447e('0x1a')](function(_0x4664b2){logger['info'](_0x447e('0x25'));return _0x4664b2;});}});}function getAuth(_0x1df9e9){return util['format'](_0x447e('0x26'),new Buffer(_0x1df9e9['apiKey']+':X')[_0x447e('0x27')](_0x447e('0x28')));}function request(_0x76d202){logger[_0x447e('0x29')](_0x447e('0x2a'),JSON[_0x447e('0x2b')](_0x76d202));return rp(_[_0x447e('0x5')](_0x76d202,{'method':_0x447e('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0x22c735,_0x3a06ea){var _0x5f0611=[];if(_0x22c735&&_0x22c735[_0x447e('0x1d')]>0x0){_0x5f0611=_[_0x447e('0x2d')](_0x22c735,_0x3a06ea);}return _0x5f0611;}function getCustomFields(_0x6f4618,_0x4fc7f2){var _0xebd790=[];var _0xfda3d6={'custom_fields':[]};if(_0x6f4618[_0x447e('0x1d')]>0x0){_[_0x447e('0x2e')](_0x6f4618,function(_0x2dc284){if(_[_0x447e('0x2f')]([_0x447e('0x30'),_0x447e('0x31')],_0x2dc284[_0x447e('0x32')])&&_0x2dc284[_0x447e('0x33')]&&!_0x2dc284['customField']){_0xfda3d6[_0x2dc284[_0x447e('0x33')][_0x447e('0x34')]()]=_0x2dc284[_0x447e('0x35')][_0x447e('0x27')]();}else if(_[_0x447e('0x2f')](['string',_0x447e('0x31')],_0x2dc284['type'])&&_0x2dc284[_0x447e('0x36')]&&_0x2dc284[_0x447e('0x37')]){_0xfda3d6[_0x447e('0x14')][_0x447e('0x38')]({'id':_0x2dc284[_0x447e('0x36')],'value':_0x2dc284[_0x447e('0x35')]['toString']()});}else if(_0x2dc284[_0x447e('0x32')]===_0x447e('0x39')&&_0x2dc284[_0x447e('0x3a')]&&_0x2dc284['idField']&&_0x2dc284[_0x447e('0x37')]){_0x4fc7f2[_0x2dc284[_0x447e('0x3a')]]&&_0xfda3d6['custom_fields'][_0x447e('0x38')]({'id':_0x2dc284[_0x447e('0x36')],'value':_0x4fc7f2[_0x2dc284[_0x447e('0x3a')]]['toString']()});}else if(_0x2dc284[_0x447e('0x32')]===_0x447e('0x3b')&&_0x2dc284[_0x447e('0x3c')]&&_0x2dc284[_0x447e('0x3c')]['name']&&_0x2dc284[_0x447e('0x36')]&&_0x2dc284[_0x447e('0x37')]){_0x4fc7f2[_0x2dc284['Variable'][_0x447e('0x12')][_0x447e('0x34')]()]&&_0xfda3d6['custom_fields'][_0x447e('0x38')]({'id':_0x2dc284[_0x447e('0x36')],'value':_0x4fc7f2[_0x2dc284[_0x447e('0x3c')][_0x447e('0x12')][_0x447e('0x34')]()][_0x447e('0x27')]()});}});}return _0xfda3d6;}exports['queue']=function(_0x3e880e,_0x493cef,_0xe8aeaf,_0x2470b0,_0x3ee538,_0x3b5648){var _0x2d941c,_0x5bc9a4;_0x3b5648[_0x447e('0x19')]=intUtil[_0x447e('0x3d')](_0x3b5648[_0x447e('0x19')]);_0x3b5648[_0x447e('0x3e')]=intUtil[_0x447e('0x3d')](_0x3b5648[_0x447e('0x3e')]);if(_0x3ee538&&_0x3ee538[_0x447e('0x3f')]){logger[_0x447e('0xa')](_0x447e('0x40'),_0x447e('0x41'));_0x493cef['recordingURL']=util[_0x447e('0x17')](_0x447e('0x42'),_0x3b5648[_0x447e('0x3e')],_0x493cef[_0x447e('0x43')],md5(_0x493cef[_0x447e('0x43')]));}else{_0x493cef[_0x447e('0x44')]='';}headers[_0x447e('0x45')]=getAuth(_0x3b5648);return getUser(_0x3b5648,_0x2470b0['email'])[_0x447e('0x1a')](function(_0x183e44){_0x2d941c=_0x183e44;logger[_0x447e('0xa')](_0x447e('0x46'),_0x2d941c['id']);return getEndUser(_0x3b5648,_0x493cef[_0x447e('0x47')],_0x493cef[_0x447e('0xd')]);})['then'](function(_0x8f172a){_0x5bc9a4=_0x8f172a;logger['info'](_0x447e('0x48'),_0x5bc9a4['id']);return getTicket(_0x3b5648,_0x2d941c,_0x5bc9a4,_0xe8aeaf,_0x493cef);})[_0x447e('0x1a')](function(_0x3bc33c){if(_0x3bc33c&&_0x3bc33c['id']){logger['info'](_0x447e('0x1b'));logger[_0x447e('0xa')](_0x447e('0x49'),_0x3bc33c['id']);logger[_0x447e('0xa')](_0x447e('0x40'),_0x447e('0x4a'));emit(util[_0x447e('0x17')]('user:%s',_0x2470b0[_0x447e('0x12')]),_0x447e('0x4b'),{'uri':util[_0x447e('0x17')]('%s/helpdesk/tickets/%d',_0x3b5648[_0x447e('0x19')],_0x3bc33c['id'])});}})['catch'](function(_0x2dddd1){logger['error']('[QUEUE]',JSON['stringify'](_0x2dddd1));});};exports['outbound']=function(_0x1a9f33,_0xe5fef2,_0x1646a6,_0x4f1ad1,_0x3eb97d,_0xec8cf6,_0x2fa671){var _0x51dbf1,_0x259a8d;_0xec8cf6['remoteUri']=intUtil[_0x447e('0x3d')](_0xec8cf6['remoteUri']);_0xec8cf6[_0x447e('0x3e')]=intUtil[_0x447e('0x3d')](_0xec8cf6['serverUrl']);if(_0x2fa671&&_0x2fa671[_0x447e('0x4c')]&&_0x2fa671[_0x447e('0x4c')]!==_0x447e('0x4d')){logger['info'](_0x447e('0x4e'),'Recording\x20is\x20enabled!');_0xe5fef2[_0x447e('0x44')]=util['format'](_0x447e('0x42'),_0xec8cf6[_0x447e('0x3e')],_0xe5fef2[_0x447e('0x43')],md5(_0xe5fef2[_0x447e('0x43')]));}headers[_0x447e('0x45')]=getAuth(_0xec8cf6);return getUser(_0xec8cf6,_0x4f1ad1[_0x447e('0x20')])[_0x447e('0x1a')](function(_0x2fc6f3){_0x51dbf1=_0x2fc6f3;logger['info'](_0x447e('0x46'),_0x51dbf1['id']);return getEndUser(_0xec8cf6,_0xe5fef2[_0x447e('0x4f')],_0xe5fef2[_0x447e('0x50')]);})[_0x447e('0x1a')](function(_0x49e9ef){_0x259a8d=_0x49e9ef;logger[_0x447e('0xa')]('The\x20Enduser\x20ID\x20is:',_0x259a8d['id']);return getTicket(_0xec8cf6,_0x51dbf1,_0x259a8d,_0x1646a6,_0xe5fef2);})[_0x447e('0x1a')](function(_0x3c7350){if(_0x3c7350&&_0x3c7350['id']){logger['info'](_0x447e('0x1b'));logger[_0x447e('0xa')](_0x447e('0x49'),_0x3c7350['id']);logger[_0x447e('0xa')](_0x447e('0x4e'),_0x447e('0x4a'));emit(util[_0x447e('0x17')]('user:%s',_0x4f1ad1[_0x447e('0x12')]),_0x447e('0x4b'),{'uri':util[_0x447e('0x17')](_0x447e('0x51'),_0xec8cf6['remoteUri'],_0x3c7350['id'])});}})[_0x447e('0x52')](function(_0x450ffb){logger[_0x447e('0x53')]('[OUTBOUND]',JSON[_0x447e('0x2b')](_0x450ffb));});};exports['unmanaged']=function(_0x3f0e07,_0x36f350,_0x4ac6e3,_0x33f0a7,_0x320078,_0x594ccd){var _0xa2cfc2,_0x244e90;_0x594ccd[_0x447e('0x19')]=intUtil[_0x447e('0x3d')](_0x594ccd[_0x447e('0x19')]);_0x594ccd['serverUrl']=intUtil[_0x447e('0x3d')](_0x594ccd[_0x447e('0x3e')]);if(_0x320078&&_0x320078[_0x447e('0x3f')]){logger['info']('['+_0x36f350[_0x447e('0x54')][_0x447e('0x55')]()+']',_0x447e('0x41'));_0x36f350[_0x447e('0x44')]=util['format'](_0x447e('0x42'),_0x594ccd[_0x447e('0x3e')],_0x36f350[_0x447e('0x43')],md5(_0x36f350[_0x447e('0x43')]));}else{_0x36f350[_0x447e('0x44')]='';}headers[_0x447e('0x45')]=getAuth(_0x594ccd);return getUser(_0x594ccd,'')[_0x447e('0x1a')](function(_0x32adaa){_0xa2cfc2=_0x32adaa;logger['info'](_0x447e('0x46'),_0xa2cfc2['id']);return getEndUser(_0x594ccd,_0x36f350[_0x447e('0x47')],_0x36f350['calleridnum']);})[_0x447e('0x1a')](function(_0x257843){_0x244e90=_0x257843;logger['info'](_0x447e('0x48'),_0x244e90['id']);return getTicket(_0x594ccd,_0xa2cfc2,_0x244e90,_0x4ac6e3,_0x36f350);})[_0x447e('0x1a')](function(_0x57d7ec){if(_0x57d7ec){logger['info'](_0x447e('0x1b'));logger[_0x447e('0xa')]('The\x20Ticket\x20ID\x20is:',_0x57d7ec['id']);}})[_0x447e('0x52')](function(_0x21a624){logger[_0x447e('0x53')]('['+_0x36f350[_0x447e('0x54')][_0x447e('0x55')]()+']',JSON[_0x447e('0x2b')](_0x21a624));});}; \ 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 bc76f25..ec0bb32 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 _0xc587=['calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','ioredis','freshsales','defaults','redis','socket.io-emitter','info','Getting\x20admin\x20information','then','users','length','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','message','GET','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','Admin\x20selected','error','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0xc587,0x169));var _0x7c58=function(_0x2629a8,_0x3f80b7){_0x2629a8=_0x2629a8-0x0;var _0x5ac9e1=_0xc587[_0x2629a8];return _0x5ac9e1;};'use strict';var _=require('lodash');var rp=require(_0x7c58('0x0'));var md5=require(_0x7c58('0x1'));var util=require(_0x7c58('0x2'));var moment=require(_0x7c58('0x3'));var Promise=require('bluebird');var Redis=require(_0x7c58('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x7c58('0x5'));config['redis']=_[_0x7c58('0x6')](config[_0x7c58('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x7c58('0x8'))(new Redis(config['redis']));function getAdminId(_0x3103cf,_0x55500c,_0x11f67e,_0x43157d){return new Promise(function(_0x1d6dc5,_0x300a25){var _0x1e65ce=![];var _0x418d1e={'method':'GET','uri':_0x43157d+'/api/selector/owners','json':!![]};_0x418d1e['headers']=_0x11f67e;logger[_0x7c58('0x9')](_0x7c58('0xa'));return rp(_0x418d1e)[_0x7c58('0xb')](function(_0x1bc9e4){if(_0x1bc9e4){var _0x2c2e24=_0x1bc9e4[_0x7c58('0xc')];var _0x32b7fc=null;for(_0x32b7fc=0x0;_0x32b7fc<_0x2c2e24[_0x7c58('0xd')];_0x32b7fc++){if(_0x2c2e24[_0x32b7fc]['email']===_0x3103cf[_0x7c58('0xe')]){_0x3103cf['adminId']=_0x2c2e24[_0x32b7fc]['id'];_0x1e65ce=!![];}}if(_0x1e65ce){logger['info'](_0x7c58('0xf'),_0x3103cf[_0x7c58('0x10')]);_0x1d6dc5(_0x3103cf);}else{_0x300a25({'statusCode':0x194,'message':_0x7c58('0x11')});}}else{_0x300a25({'statusCode':0x194,'message':_0x7c58('0x11')});}})[_0x7c58('0x12')](function(_0x5b2b37){logger['error']('['+[_0x55500c['toUpperCase']()]+']',_0x5b2b37[_0x7c58('0x13')]);_0x300a25(_0x5b2b37);});});}function getUser(_0x29adea,_0x40cf8d,_0x285d7e){return function(_0x2501b4){return new Promise(function(_0x244c1f,_0x4c37b0){var _0x5d994d={'method':_0x7c58('0x14'),'uri':_0x285d7e+'/api/selector/owners','json':!![]};_0x5d994d[_0x7c58('0x15')]=_0x40cf8d;logger[_0x7c58('0x9')](_0x7c58('0x16'));return rp(_0x5d994d)[_0x7c58('0xb')](function(_0x3da864){if(_0x3da864){var _0x138fec=_0x3da864[_0x7c58('0xc')];var _0x2674f9=![];var _0x5ad7cf=null;if(_0x2501b4[_0x7c58('0x17')]!==null){logger[_0x7c58('0x9')](_0x7c58('0x18'),_0x2501b4['agentEmail']);_0x2501b4[_0x7c58('0x19')]=_0x2501b4[_0x7c58('0x17')];for(_0x5ad7cf=0x0;_0x5ad7cf<_0x138fec[_0x7c58('0xd')];_0x5ad7cf++){if(_0x138fec[_0x5ad7cf][_0x7c58('0x1a')]===_0x2501b4['agentEmail']){_0x2674f9=!![];_0x2501b4[_0x7c58('0x1b')]=_0x138fec[_0x5ad7cf]['id'];logger['info'](_0x7c58('0x1c'),_0x2501b4[_0x7c58('0x1b')]);}}}if(!_0x2674f9){logger[_0x7c58('0x9')](_0x7c58('0x1d'));_0x2501b4[_0x7c58('0x19')]=_0x2501b4[_0x7c58('0xe')];_0x2501b4[_0x7c58('0x1b')]=_0x2501b4['adminId'];_0x2674f9=!![];}if(_0x2674f9){_0x244c1f(_0x2501b4);}else{_0x4c37b0({'statusCode':0x194,'message':_0x7c58('0x11')});}}else{_0x4c37b0({'statusCode':0x194,'message':_0x7c58('0x11')});}})[_0x7c58('0x12')](function(_0x1e3c69){logger[_0x7c58('0x1e')]('['+[_0x29adea[_0x7c58('0x1f')]()]+']',_0x1e3c69[_0x7c58('0x13')]);_0x4c37b0(_0x1e3c69);});});};}function searchContact(_0xe560aa,_0x14c59b,_0x2a43d8,_0x1760d3){return new Promise(function(_0x3ed6b0,_0x467c86){var _0x1ceed8={'method':_0x7c58('0x14'),'headers':_0x14c59b,'uri':_0xe560aa+_0x7c58('0x20')+_0x1760d3+_0x7c58('0x21')+_0x2a43d8+_0x7c58('0x22'),'json':!![]};rp(_0x1ceed8)['then'](function(_0x4d6fcd){var _0x51a293=_[_0x7c58('0x23')](_0x4d6fcd[_0x7c58('0x24')]['contacts'],[_0x2a43d8,_0x1760d3]);_0x3ed6b0(_0x51a293);})[_0x7c58('0x12')](function(_0x24204c){_0x467c86(_0x24204c);});});}function getEndUser(_0x5ff56c,_0x512a1,_0xd89c57){return function(_0x17a968){return new Promise(function(_0x135ea6,_0x4397dd){logger[_0x7c58('0x9')](util[_0x7c58('0x25')](_0x7c58('0x26'),_0x17a968[_0x7c58('0x27')]));searchContact(_0xd89c57,_0x512a1,_0x7c58('0x28'),_0x17a968[_0x7c58('0x27')])['then'](function(_0x32d4aa){if(_0x32d4aa){_0x17a968[_0x7c58('0x29')]=_0x32d4aa['id'];logger[_0x7c58('0x9')](_0x7c58('0x2a'),_0x17a968[_0x7c58('0x29')]);return _0x135ea6(_0x17a968);}searchContact(_0xd89c57,_0x512a1,_0x7c58('0x2b'),_0x17a968['contactNumber'])[_0x7c58('0xb')](function(_0x2ffea0){if(_0x2ffea0){_0x17a968[_0x7c58('0x29')]=_0x2ffea0['id'];logger[_0x7c58('0x9')](_0x7c58('0x2c'),_0x17a968['endUserId']);return _0x135ea6(_0x17a968);}createEndUser(_0x17a968,_0x5ff56c,_0x512a1,_0xd89c57)[_0x7c58('0xb')](function(_0x40e5d8){logger['info']('Contact\x20created:',_0x40e5d8['endUserId']);return _0x135ea6(_0x40e5d8);});});})[_0x7c58('0x12')](function(_0x42ca12){_0x4397dd(_0x42ca12);});});};}function createEndUser(_0x160b71,_0xce93a7,_0x496df4,_0x5915e3){return new Promise(function(_0x391104,_0x348bfc){var _0x18581a=moment();var _0x4b0253={'method':_0x7c58('0x2d'),'uri':_0x5915e3+_0x7c58('0x2e'),'body':{'contact':{'last_name':_0x160b71[_0x7c58('0x27')],'work_number':_0x160b71[_0x7c58('0x27')],'mobile_number':_0x160b71[_0x7c58('0x27')],'owner_id':_0x160b71[_0x7c58('0x1b')],'created_at':_0x18581a[_0x7c58('0x25')](_0x7c58('0x2f'))}},'json':!![]};_0x4b0253['headers']=_0x496df4;logger[_0x7c58('0x9')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x4b0253)['then'](function(_0x2db91e){_0x160b71['endUserId']=_0x2db91e[_0x7c58('0x30')]['id'];_0x391104(_0x160b71);})[_0x7c58('0x12')](function(_0x5f4fdc){logger[_0x7c58('0x1e')]('['+[_0xce93a7[_0x7c58('0x1f')]()]+']',_0x5f4fdc['message']);_0x348bfc(_0x5f4fdc[_0x7c58('0x13')]);});});}function getTicket(_0x49e8dc,_0x1cef9a,_0x336ebe,_0x5b7e97,_0x493d9d){return function(_0x4c7883){logger[_0x7c58('0x9')](_0x7c58('0x31'));return new Promise(function(_0x3e3a6d,_0x7343a2){var _0x152c58=moment();var _0x3953ae={'method':_0x7c58('0x2d'),'uri':_0x336ebe+_0x7c58('0x32'),'body':{'title':intUtil[_0x7c58('0x33')](_0x5b7e97[_0x7c58('0x34')],_0x493d9d,'\x20'),'description':intUtil['getString'](_0x5b7e97[_0x7c58('0x35')],_0x493d9d,'\x0a'),'owner_id':_0x4c7883[_0x7c58('0x1b')],'creater_id':_0x4c7883['adminId'],'targetable_id':_0x4c7883[_0x7c58('0x29')],'targetable_type':'Contact','created_at':_0x152c58[_0x7c58('0x25')](_0x7c58('0x2f')),'due_date':_0x152c58[_0x7c58('0x36')](0x1e,'m')[_0x7c58('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3953ae['headers']=_0x1cef9a;return rp(_0x3953ae)[_0x7c58('0xb')](function(_0x30b2fb){_0x4c7883[_0x7c58('0x37')]=_0x30b2fb[_0x7c58('0x38')]['id'];logger[_0x7c58('0x9')](_0x7c58('0x39'),_0x4c7883['ticketId']);_0x3e3a6d(_0x4c7883);})['catch'](function(_0x4e28c6){logger['error']('['+[_0x49e8dc[_0x7c58('0x1f')]()]+']',_0x4e28c6['message']);_0x7343a2(_0x4e28c6[_0x7c58('0x13')]);});});};}function emit(_0x31135b,_0x4b3e5b,_0x4feac7){var _0x4aeaa8={'uri':_0x31135b+'/contacts/'+_0x4feac7};io['to'](util[_0x7c58('0x25')](_0x7c58('0x3a'),_0x4b3e5b))[_0x7c58('0x3b')]('trigger:browser:url',_0x4aeaa8);}exports['cs']=function(_0x45a926,_0x1a620c,_0x21bb29,_0xe425a1,_0x1c8787,_0x1fa3e0,_0x5e1411,_0x5963b6){var _0x122378={};var _0x2e81e0={'Authorization':_0x7c58('0x3c')+_0x1fa3e0[_0x7c58('0x3d')]};_0x1fa3e0[_0x7c58('0x3e')]=intUtil[_0x7c58('0x3f')](_0x1fa3e0[_0x7c58('0x3e')]);_0x1fa3e0[_0x7c58('0x40')]=intUtil[_0x7c58('0x3f')](_0x1fa3e0['serverUrl']);var _0x4bb4d5=_0x1fa3e0[_0x7c58('0x3e')];_0x122378[_0x7c58('0xe')]=_0x1fa3e0[_0x7c58('0x41')];_0x122378[_0x7c58('0x27')]=_0x5963b6[_0x7c58('0x42')]()===_0x7c58('0x43')?_0x1a620c[_0x7c58('0x44')]:_0x1a620c[_0x7c58('0x45')];_0x122378[_0x7c58('0x46')]=_0x5963b6===_0x7c58('0x47')||_0x5963b6===_0x7c58('0x48')?_0x7c58('0x47'):_0x7c58('0x43');if(_0xe425a1){_0x122378[_0x7c58('0x17')]=_0xe425a1[_0x7c58('0x1a')];}var _0x480767=util[_0x7c58('0x25')](_0x7c58('0x49'),_0x1fa3e0[_0x7c58('0x40')],_0x1a620c['uniqueid'],md5(_0x1a620c[_0x7c58('0x4a')]));if(_0x1c8787&&_0x1c8787[_0x7c58('0x4b')]){logger[_0x7c58('0x9')](_0x7c58('0x4c'),_0x7c58('0x4d'));_0x1a620c['recordingURL']=_0x480767;}else if(_0x5e1411&&_0x5e1411[_0x7c58('0x4e')]&&_0x5e1411[_0x7c58('0x4e')]!==_0x7c58('0x4f')){logger[_0x7c58('0x9')](_0x7c58('0x50'),'Recording\x20is\x20enabled!');_0x1a620c[_0x7c58('0x51')]=_0x480767;}else{_0x1a620c[_0x7c58('0x51')]='';}return getAdminId(_0x122378,_0x5963b6,_0x2e81e0,_0x4bb4d5)[_0x7c58('0xb')](getUser(_0x5963b6,_0x2e81e0,_0x4bb4d5))[_0x7c58('0xb')](getEndUser(_0x5963b6,_0x2e81e0,_0x4bb4d5))[_0x7c58('0xb')](getTicket(_0x5963b6,_0x2e81e0,_0x4bb4d5,_0x21bb29,_0x1a620c))[_0x7c58('0xb')](function(_0x77510a){logger[_0x7c58('0x9')](util[_0x7c58('0x25')](_0x7c58('0x52'),_0x77510a['ticketId']));if(_0x5963b6!==_0x7c58('0x48')){logger['info']('['+[_0x5963b6[_0x7c58('0x1f')]()]+']',_0x7c58('0x53'));emit(_0x4bb4d5,_0xe425a1['name'],_0x77510a[_0x7c58('0x29')]);}})[_0x7c58('0x12')](function(_0x23da66){logger[_0x7c58('0x1e')]('['+[_0x5963b6[_0x7c58('0x1f')]()]+_0x7c58('0x54'),util[_0x7c58('0x55')](_0x23da66,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x37e8=['username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Contact','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x2fcd6e,_0xc2f135){var _0x7789a3=function(_0x2ea41b){while(--_0x2ea41b){_0x2fcd6e['push'](_0x2fcd6e['shift']());}};_0x7789a3(++_0xc2f135);}(_0x37e8,0x111));var _0x837e=function(_0x415853,_0x43c025){_0x415853=_0x415853-0x0;var _0x17411d=_0x37e8[_0x415853];return _0x17411d;};'use strict';var _=require(_0x837e('0x0'));var rp=require(_0x837e('0x1'));var md5=require('md5');var util=require(_0x837e('0x2'));var moment=require(_0x837e('0x3'));var Promise=require(_0x837e('0x4'));var Redis=require(_0x837e('0x5'));var intUtil=require(_0x837e('0x6'));var config=require('../../../../config/environment');var logger=require(_0x837e('0x7'))('freshsales');config[_0x837e('0x8')]=_[_0x837e('0x9')](config[_0x837e('0x8')],{'host':_0x837e('0xa'),'port':0x18eb});var io=require(_0x837e('0xb'))(new Redis(config['redis']));function getAdminId(_0xc99819,_0x575253,_0x2fadda,_0x5de796){return new Promise(function(_0x3f3cb8,_0x7a64d1){var _0x1bd615=![];var _0x175563={'method':_0x837e('0xc'),'uri':_0x5de796+_0x837e('0xd'),'json':!![]};_0x175563[_0x837e('0xe')]=_0x2fadda;logger[_0x837e('0xf')](_0x837e('0x10'));return rp(_0x175563)[_0x837e('0x11')](function(_0xa6034f){if(_0xa6034f){var _0x6fb6c8=_0xa6034f[_0x837e('0x12')];var _0x18e9db=null;for(_0x18e9db=0x0;_0x18e9db<_0x6fb6c8[_0x837e('0x13')];_0x18e9db++){if(_0x6fb6c8[_0x18e9db][_0x837e('0x14')]===_0xc99819[_0x837e('0x15')]){_0xc99819[_0x837e('0x16')]=_0x6fb6c8[_0x18e9db]['id'];_0x1bd615=!![];}}if(_0x1bd615){logger['info'](_0x837e('0x17'),_0xc99819[_0x837e('0x16')]);_0x3f3cb8(_0xc99819);}else{_0x7a64d1({'statusCode':0x194,'message':_0x837e('0x18')});}}else{_0x7a64d1({'statusCode':0x194,'message':_0x837e('0x18')});}})[_0x837e('0x19')](function(_0x221c0e){logger[_0x837e('0x1a')]('['+[_0x575253[_0x837e('0x1b')]()]+']',_0x221c0e[_0x837e('0x1c')]);_0x7a64d1(_0x221c0e);});});}function getUser(_0x54e1fd,_0x251af3,_0x1253ad){return function(_0x1e1ac9){return new Promise(function(_0x5c37a7,_0x2565b8){var _0x5809b3={'method':_0x837e('0xc'),'uri':_0x1253ad+'/api/selector/owners','json':!![]};_0x5809b3[_0x837e('0xe')]=_0x251af3;logger[_0x837e('0xf')](_0x837e('0x1d'));return rp(_0x5809b3)['then'](function(_0x5bd103){if(_0x5bd103){var _0x1b0253=_0x5bd103['users'];var _0x1c790d=![];var _0xdf71bf=null;if(_0x1e1ac9[_0x837e('0x1e')]!==null){logger['info'](_0x837e('0x1f'),_0x1e1ac9[_0x837e('0x1e')]);_0x1e1ac9[_0x837e('0x20')]=_0x1e1ac9[_0x837e('0x1e')];for(_0xdf71bf=0x0;_0xdf71bf<_0x1b0253['length'];_0xdf71bf++){if(_0x1b0253[_0xdf71bf]['email']===_0x1e1ac9[_0x837e('0x1e')]){_0x1c790d=!![];_0x1e1ac9[_0x837e('0x21')]=_0x1b0253[_0xdf71bf]['id'];logger[_0x837e('0xf')](_0x837e('0x22'),_0x1e1ac9['userId']);}}}if(!_0x1c790d){logger[_0x837e('0xf')](_0x837e('0x23'));_0x1e1ac9[_0x837e('0x20')]=_0x1e1ac9[_0x837e('0x15')];_0x1e1ac9['userId']=_0x1e1ac9[_0x837e('0x16')];_0x1c790d=!![];}if(_0x1c790d){_0x5c37a7(_0x1e1ac9);}else{_0x2565b8({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x2565b8({'statusCode':0x194,'message':_0x837e('0x18')});}})[_0x837e('0x19')](function(_0x5cc784){logger[_0x837e('0x1a')]('['+[_0x54e1fd[_0x837e('0x1b')]()]+']',_0x5cc784[_0x837e('0x1c')]);_0x2565b8(_0x5cc784);});});};}function searchContact(_0x195029,_0x29d741,_0x5e0856,_0x154796){return new Promise(function(_0xb8c5d6,_0xf9e27e){var _0x605830={'method':_0x837e('0xc'),'headers':_0x29d741,'uri':_0x195029+_0x837e('0x24')+_0x154796+_0x837e('0x25')+_0x5e0856+'&entities=contact','json':!![]};rp(_0x605830)[_0x837e('0x11')](function(_0x1487fd){var _0x22c6d3=_[_0x837e('0x26')](_0x1487fd[_0x837e('0x27')][_0x837e('0x27')],[_0x5e0856,_0x154796]);_0xb8c5d6(_0x22c6d3);})[_0x837e('0x19')](function(_0x4ab7e5){_0xf9e27e(_0x4ab7e5);});});}function getEndUser(_0x9aee4b,_0x310578,_0x70d398){return function(_0x2e08a7){return new Promise(function(_0x329802,_0x4c2f43){logger['info'](util[_0x837e('0x28')](_0x837e('0x29'),_0x2e08a7[_0x837e('0x2a')]));searchContact(_0x70d398,_0x310578,'mobile_number',_0x2e08a7[_0x837e('0x2a')])[_0x837e('0x11')](function(_0x570d57){if(_0x570d57){_0x2e08a7[_0x837e('0x2b')]=_0x570d57['id'];logger['info'](_0x837e('0x2c'),_0x2e08a7[_0x837e('0x2b')]);return _0x329802(_0x2e08a7);}searchContact(_0x70d398,_0x310578,'work_number',_0x2e08a7[_0x837e('0x2a')])[_0x837e('0x11')](function(_0xaa6296){if(_0xaa6296){_0x2e08a7[_0x837e('0x2b')]=_0xaa6296['id'];logger['info'](_0x837e('0x2d'),_0x2e08a7[_0x837e('0x2b')]);return _0x329802(_0x2e08a7);}createEndUser(_0x2e08a7,_0x9aee4b,_0x310578,_0x70d398)[_0x837e('0x11')](function(_0x17a4ab){logger['info'](_0x837e('0x2e'),_0x17a4ab[_0x837e('0x2b')]);return _0x329802(_0x17a4ab);});});})[_0x837e('0x19')](function(_0x4df882){_0x4c2f43(_0x4df882);});});};}function createEndUser(_0x4dd10e,_0x41c137,_0x825f5a,_0x37b539){return new Promise(function(_0xa0af70,_0x47a0ba){var _0x5e2a93=moment();var _0x3f6311={'method':_0x837e('0x2f'),'uri':_0x37b539+_0x837e('0x30'),'body':{'contact':{'last_name':_0x4dd10e['contactNumber'],'work_number':_0x4dd10e[_0x837e('0x2a')],'mobile_number':_0x4dd10e[_0x837e('0x2a')],'owner_id':_0x4dd10e[_0x837e('0x21')],'created_at':_0x5e2a93[_0x837e('0x28')](_0x837e('0x31'))}},'json':!![]};_0x3f6311[_0x837e('0xe')]=_0x825f5a;logger[_0x837e('0xf')](_0x837e('0x32'));return rp(_0x3f6311)['then'](function(_0x5ed4ad){_0x4dd10e[_0x837e('0x2b')]=_0x5ed4ad[_0x837e('0x33')]['id'];_0xa0af70(_0x4dd10e);})[_0x837e('0x19')](function(_0x48d621){logger[_0x837e('0x1a')]('['+[_0x41c137[_0x837e('0x1b')]()]+']',_0x48d621[_0x837e('0x1c')]);_0x47a0ba(_0x48d621[_0x837e('0x1c')]);});});}function getTicket(_0x5d91de,_0x3a3c8b,_0x2689a0,_0x249c33,_0x5c79a7){return function(_0x557e40){logger[_0x837e('0xf')](_0x837e('0x34'));return new Promise(function(_0x126bfa,_0x4b9052){var _0x5162c4=moment();var _0x3f3dbd={'method':'POST','uri':_0x2689a0+'/api/tasks','body':{'title':intUtil[_0x837e('0x35')](_0x249c33[_0x837e('0x36')],_0x5c79a7,'\x20'),'description':intUtil['getString'](_0x249c33['Descriptions'],_0x5c79a7,'\x0a'),'owner_id':_0x557e40['userId'],'creater_id':_0x557e40['adminId'],'targetable_id':_0x557e40[_0x837e('0x2b')],'targetable_type':_0x837e('0x37'),'created_at':_0x5162c4[_0x837e('0x28')](_0x837e('0x31')),'due_date':_0x5162c4[_0x837e('0x38')](0x1e,'m')['format'](_0x837e('0x31'))},'json':!![]};_0x3f3dbd[_0x837e('0xe')]=_0x3a3c8b;return rp(_0x3f3dbd)[_0x837e('0x11')](function(_0x14d0bf){_0x557e40[_0x837e('0x39')]=_0x14d0bf[_0x837e('0x3a')]['id'];logger[_0x837e('0xf')](_0x837e('0x3b'),_0x557e40[_0x837e('0x39')]);_0x126bfa(_0x557e40);})[_0x837e('0x19')](function(_0xea85aa){logger[_0x837e('0x1a')]('['+[_0x5d91de[_0x837e('0x1b')]()]+']',_0xea85aa[_0x837e('0x1c')]);_0x4b9052(_0xea85aa[_0x837e('0x1c')]);});});};}function emit(_0x1419cd,_0x506971,_0x48fe08){var _0x4e668b={'uri':_0x1419cd+_0x837e('0x3c')+_0x48fe08};io['to'](util[_0x837e('0x28')]('user:%s',_0x506971))[_0x837e('0x3d')](_0x837e('0x3e'),_0x4e668b);}exports['cs']=function(_0x201697,_0xcaa4d1,_0xb9e3c0,_0x555b22,_0x437f4d,_0x455bf1,_0x5304cc,_0x4c5cb8){var _0x54fcd5={};var _0xa9f736={'Authorization':'Token\x20token='+_0x455bf1[_0x837e('0x3f')]};_0x455bf1[_0x837e('0x40')]=intUtil[_0x837e('0x41')](_0x455bf1['remoteUri']);_0x455bf1[_0x837e('0x42')]=intUtil[_0x837e('0x41')](_0x455bf1['serverUrl']);var _0x47c03c=_0x455bf1[_0x837e('0x40')];_0x54fcd5[_0x837e('0x15')]=_0x455bf1[_0x837e('0x43')];_0x54fcd5[_0x837e('0x2a')]=_0x4c5cb8[_0x837e('0x44')]()===_0x837e('0x45')?_0xcaa4d1['destcalleridnum']:_0xcaa4d1[_0x837e('0x46')];_0x54fcd5[_0x837e('0x47')]=_0x4c5cb8===_0x837e('0x48')||_0x4c5cb8===_0x837e('0x49')?_0x837e('0x48'):'outbound';if(_0x555b22){_0x54fcd5[_0x837e('0x1e')]=_0x555b22[_0x837e('0x14')];}var _0x231302=util[_0x837e('0x28')](_0x837e('0x4a'),_0x455bf1['serverUrl'],_0xcaa4d1[_0x837e('0x4b')],md5(_0xcaa4d1['uniqueid']));if(_0x437f4d&&_0x437f4d[_0x837e('0x4c')]){logger[_0x837e('0xf')](_0x837e('0x4d'),_0x837e('0x4e'));_0xcaa4d1['recordingURL']=_0x231302;}else if(_0x5304cc&&_0x5304cc[_0x837e('0x4f')]&&_0x5304cc['recordingFormat']!==_0x837e('0x50')){logger[_0x837e('0xf')](_0x837e('0x51'),'Recording\x20is\x20enabled!');_0xcaa4d1[_0x837e('0x52')]=_0x231302;}else{_0xcaa4d1[_0x837e('0x52')]='';}return getAdminId(_0x54fcd5,_0x4c5cb8,_0xa9f736,_0x47c03c)[_0x837e('0x11')](getUser(_0x4c5cb8,_0xa9f736,_0x47c03c))[_0x837e('0x11')](getEndUser(_0x4c5cb8,_0xa9f736,_0x47c03c))[_0x837e('0x11')](getTicket(_0x4c5cb8,_0xa9f736,_0x47c03c,_0xb9e3c0,_0xcaa4d1))['then'](function(_0x337867){logger['info'](util[_0x837e('0x28')]('The\x20ticket\x20ID\x20is:\x20%s',_0x337867[_0x837e('0x39')]));if(_0x4c5cb8!==_0x837e('0x49')){logger[_0x837e('0xf')]('['+[_0x4c5cb8[_0x837e('0x1b')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x47c03c,_0x555b22[_0x837e('0x53')],_0x337867[_0x837e('0x2b')]);}})[_0x837e('0x19')](function(_0x2e47af){logger[_0x837e('0x1a')]('['+[_0x4c5cb8[_0x837e('0x1b')]()]+_0x837e('0x54'),util['inspect'](_0x2e47af,{'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 56c8f90..928e5ae 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 _0x9b5f=['data2','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data1','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found'];(function(_0xab92b5,_0x184d79){var _0x3a758c=function(_0x3eae35){while(--_0x3eae35){_0xab92b5['push'](_0xab92b5['shift']());}};_0x3a758c(++_0x184d79);}(_0x9b5f,0x17d));var _0xf9b5=function(_0x2e7f96,_0x2ffe43){_0x2e7f96=_0x2e7f96-0x0;var _0x315277=_0x9b5f[_0x2e7f96];return _0x315277;};'use strict';var _=require(_0xf9b5('0x0'));var util=require('util');var zendesk=require(_0xf9b5('0x1'));var salesforce=require(_0xf9b5('0x2'));var sugarcrm=require(_0xf9b5('0x3'));var freshdesk=require(_0xf9b5('0x4'));var zoho=require(_0xf9b5('0x5'));var desk=require('./desk');var vtiger=require(_0xf9b5('0x6'));var servicenow=require(_0xf9b5('0x7'));var dynamics365=require(_0xf9b5('0x8'));var freshsales=require(_0xf9b5('0x9'));var integrations=[_0xf9b5('0xa'),_0xf9b5('0xb'),'sugarcrm',_0xf9b5('0xc'),'zoho',_0xf9b5('0xd'),_0xf9b5('0xe'),_0xf9b5('0xf'),_0xf9b5('0x10'),_0xf9b5('0x11')];exports[_0xf9b5('0x12')]=function(_0x539797,_0x393abd,_0x304d50,_0x4d7b6d,_0x3b035a,_0x33b8ad){if(_0x304d50){if(_[_0xf9b5('0x13')](integrations,_0x539797['data1'][_0xf9b5('0x14')]())){try{var _0x5d1924=null;var _0x528098='';var _0x22837e=_0x304d50[_0x539797[_0xf9b5('0x15')][_0xf9b5('0x14')]()];if(_0x22837e){var _0xb92cfa=_0x22837e[_0x539797['data2']];if(_0xb92cfa){var _0x3e59cd=_[_0xf9b5('0x16')](_0xb92cfa[_0xf9b5('0x17')],{'id':parseInt(_0x539797[_0xf9b5('0x18')],0xa)});if(_0x3e59cd){if(_0x4d7b6d){if(_0x3b035a&&_0x393abd['queue']){_0x528098=_0xf9b5('0x19');}else if(_0x393abd[_0xf9b5('0x1a')]){_0x528098='outbound';}else{console[_0xf9b5('0x1b')](_0xf9b5('0x1c'),_0x393abd);}}else{_0x528098=_0xf9b5('0x1d');}switch(_0x539797[_0xf9b5('0x15')][_0xf9b5('0x14')]()){case'zendesk':zendesk[_0x528098](_0x539797,_0x393abd,_0x3e59cd,_0x4d7b6d,_0x3b035a,_0xb92cfa,_0x33b8ad);break;case _0xf9b5('0xb'):salesforce[_0x528098](_0x539797,_0x393abd,_0x3e59cd,_0x4d7b6d,_0x3b035a,_0xb92cfa,_0x33b8ad);break;case _0xf9b5('0x1e'):sugarcrm[_0x528098](_0x539797,_0x393abd,_0x3e59cd,_0x4d7b6d,_0x3b035a,_0xb92cfa,_0x33b8ad);break;case _0xf9b5('0xc'):freshdesk[_0x528098](_0x539797,_0x393abd,_0x3e59cd,_0x4d7b6d,_0x3b035a,_0xb92cfa,_0x33b8ad);break;case'zoho':zoho[_0x528098](_0x539797,_0x393abd,_0x3e59cd,_0x4d7b6d,_0x3b035a,_0xb92cfa,_0x33b8ad);break;case'desk':desk[_0x528098](_0x539797,_0x393abd,_0x3e59cd,_0x4d7b6d,_0x3b035a,_0xb92cfa,_0x33b8ad);break;case _0xf9b5('0xe'):vtiger[_0x528098](_0x539797,_0x393abd,_0x3e59cd,_0x4d7b6d,_0x3b035a,_0xb92cfa,_0x33b8ad);break;case _0xf9b5('0x10'):freshsales['cs'](_0x539797,_0x393abd,_0x3e59cd,_0x4d7b6d,_0x3b035a,_0xb92cfa,_0x33b8ad,_0x528098);break;case'servicenow':servicenow['cs'](_0x539797,_0x393abd,_0x3e59cd,_0x4d7b6d,_0x3b035a,_0xb92cfa,_0x33b8ad,_0x528098);break;case _0xf9b5('0xf'):dynamics365['cs'](_0x539797,_0x393abd,_0x3e59cd,_0x4d7b6d,_0x3b035a,_0xb92cfa,_0x33b8ad,_0x528098);break;default:console[_0xf9b5('0x1b')](_0xf9b5('0x1f'));}}else{_0x5d1924=require(_0xf9b5('0x20'))(_0x539797[_0xf9b5('0x15')][_0xf9b5('0x14')]());_0x5d1924[_0xf9b5('0x21')]('[EXEC]',util[_0xf9b5('0x22')](_0xf9b5('0x23'),_0x539797[_0xf9b5('0x15')]['toLowerCase'](),_0x539797['data3']));}}else{_0x5d1924=require('../../../../config/logger')(_0x539797['data1'][_0xf9b5('0x14')]());_0x5d1924[_0xf9b5('0x21')]('[EXEC]',util[_0xf9b5('0x22')](_0xf9b5('0x24'),_0x539797['data1']['toLowerCase'](),_0x539797[_0xf9b5('0x25')]));}}else{}}catch(_0x26b183){console[_0xf9b5('0x21')](_0x26b183);}}}}; \ No newline at end of file +var _0xb645=['./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','dynamics365','freshsales','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','log','unmanaged','zendesk','vtiger','servicenow','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','data2','lodash','./zendesk','./salesforce','./freshdesk','./zoho','./desk'];(function(_0x21f70b,_0x47501e){var _0x153b64=function(_0x30694d){while(--_0x30694d){_0x21f70b['push'](_0x21f70b['shift']());}};_0x153b64(++_0x47501e);}(_0xb645,0x180));var _0x5b64=function(_0x258807,_0x190bbf){_0x258807=_0x258807-0x0;var _0x3ea9b1=_0xb645[_0x258807];return _0x3ea9b1;};'use strict';var _=require(_0x5b64('0x0'));var util=require('util');var zendesk=require(_0x5b64('0x1'));var salesforce=require(_0x5b64('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x5b64('0x3'));var zoho=require(_0x5b64('0x4'));var desk=require(_0x5b64('0x5'));var vtiger=require(_0x5b64('0x6'));var servicenow=require(_0x5b64('0x7'));var dynamics365=require(_0x5b64('0x8'));var freshsales=require(_0x5b64('0x9'));var integrations=['zendesk',_0x5b64('0xa'),_0x5b64('0xb'),_0x5b64('0xc'),_0x5b64('0xd'),_0x5b64('0xe'),'vtiger',_0x5b64('0xf'),_0x5b64('0x10'),'servicenow'];exports[_0x5b64('0x11')]=function(_0x30846a,_0x3b5ce3,_0x364e4b,_0x491373,_0x368f2c,_0x50b83d){if(_0x364e4b){if(_[_0x5b64('0x12')](integrations,_0x30846a[_0x5b64('0x13')][_0x5b64('0x14')]())){try{var _0x3b197d=null;var _0x201da7='';var _0xbcb8a2=_0x364e4b[_0x30846a[_0x5b64('0x13')][_0x5b64('0x14')]()];if(_0xbcb8a2){var _0x24f8d9=_0xbcb8a2[_0x30846a['data2']];if(_0x24f8d9){var _0x4518b6=_[_0x5b64('0x15')](_0x24f8d9[_0x5b64('0x16')],{'id':parseInt(_0x30846a[_0x5b64('0x17')],0xa)});if(_0x4518b6){if(_0x491373){if(_0x368f2c&&_0x3b5ce3[_0x5b64('0x18')]){_0x201da7=_0x5b64('0x18');}else if(_0x3b5ce3[_0x5b64('0x19')]){_0x201da7='outbound';}else{console[_0x5b64('0x1a')]('EVENT\x20UNKNOWN',_0x3b5ce3);}}else{_0x201da7=_0x5b64('0x1b');}switch(_0x30846a[_0x5b64('0x13')][_0x5b64('0x14')]()){case _0x5b64('0x1c'):zendesk[_0x201da7](_0x30846a,_0x3b5ce3,_0x4518b6,_0x491373,_0x368f2c,_0x24f8d9,_0x50b83d);break;case _0x5b64('0xa'):salesforce[_0x201da7](_0x30846a,_0x3b5ce3,_0x4518b6,_0x491373,_0x368f2c,_0x24f8d9,_0x50b83d);break;case _0x5b64('0xb'):sugarcrm[_0x201da7](_0x30846a,_0x3b5ce3,_0x4518b6,_0x491373,_0x368f2c,_0x24f8d9,_0x50b83d);break;case _0x5b64('0xc'):freshdesk[_0x201da7](_0x30846a,_0x3b5ce3,_0x4518b6,_0x491373,_0x368f2c,_0x24f8d9,_0x50b83d);break;case _0x5b64('0xd'):zoho[_0x201da7](_0x30846a,_0x3b5ce3,_0x4518b6,_0x491373,_0x368f2c,_0x24f8d9,_0x50b83d);break;case _0x5b64('0xe'):desk[_0x201da7](_0x30846a,_0x3b5ce3,_0x4518b6,_0x491373,_0x368f2c,_0x24f8d9,_0x50b83d);break;case _0x5b64('0x1d'):vtiger[_0x201da7](_0x30846a,_0x3b5ce3,_0x4518b6,_0x491373,_0x368f2c,_0x24f8d9,_0x50b83d);break;case'freshsales':freshsales['cs'](_0x30846a,_0x3b5ce3,_0x4518b6,_0x491373,_0x368f2c,_0x24f8d9,_0x50b83d,_0x201da7);break;case _0x5b64('0x1e'):servicenow['cs'](_0x30846a,_0x3b5ce3,_0x4518b6,_0x491373,_0x368f2c,_0x24f8d9,_0x50b83d,_0x201da7);break;case _0x5b64('0xf'):dynamics365['cs'](_0x30846a,_0x3b5ce3,_0x4518b6,_0x491373,_0x368f2c,_0x24f8d9,_0x50b83d,_0x201da7);break;default:console[_0x5b64('0x1a')](_0x5b64('0x1f'));}}else{_0x3b197d=require('../../../../config/logger')(_0x30846a[_0x5b64('0x13')]['toLowerCase']());_0x3b197d[_0x5b64('0x20')](_0x5b64('0x21'),util[_0x5b64('0x22')](_0x5b64('0x23'),_0x30846a[_0x5b64('0x13')][_0x5b64('0x14')](),_0x30846a['data3']));}}else{_0x3b197d=require(_0x5b64('0x24'))(_0x30846a[_0x5b64('0x13')]['toLowerCase']());_0x3b197d[_0x5b64('0x20')]('[EXEC]',util[_0x5b64('0x22')](_0x5b64('0x25'),_0x30846a['data1']['toLowerCase'](),_0x30846a[_0x5b64('0x26')]));}}else{}}catch(_0x31971e){console[_0x5b64('0x20')](_0x31971e);}}}}; \ 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 1b6b39c..e0f9b48 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 _0xb6b9=['md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','endUserType','contact','lead','WhoId','account','WhatId','Case','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','isNil','sobject','then','length','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','Contact','find','execute','additionalSearchLead','merge','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','upperFirst','forEach','includes','string','idField','content','toString','variableName','customVariable','Variable','name','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','destcalleridnum','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb6b9,0x79));var _0x9b6b=function(_0x1b1696,_0x6bf4de){_0x1b1696=_0x1b1696-0x0;var _0x5e3646=_0xb6b9[_0x1b1696];return _0x5e3646;};'use strict';var _=require(_0x9b6b('0x0'));var rp=require(_0x9b6b('0x1'));var moment=require(_0x9b6b('0x2'));var BPromise=require(_0x9b6b('0x3'));var md5=require(_0x9b6b('0x4'));var jsforce=require(_0x9b6b('0x5'));var util=require(_0x9b6b('0x6'));var Redis=require(_0x9b6b('0x7'));var intUtil=require('./util');var config=require(_0x9b6b('0x8'));var logger=require(_0x9b6b('0x9'))(_0x9b6b('0xa'));config['redis']=_[_0x9b6b('0xb')](config[_0x9b6b('0xc')],{'host':_0x9b6b('0xd'),'port':0x18eb});var io=require(_0x9b6b('0xe'))(new Redis(config['redis']));function emit(_0x419d58,_0x49e3c3,_0x14f2d9){io['to'](_0x419d58)[_0x9b6b('0xf')](_0x49e3c3,_0x14f2d9);}function getTicket(_0x39e013,_0x4b5e93,_0x2bd67c,_0x429897,_0x1e3a5a,_0x1c3ded,_0x214ec8,_0x2e1206){var _0x5f2185=Object[_0x9b6b('0x10')]({},{'OwnerId':_0x4b5e93['id'],'Subject':intUtil[_0x9b6b('0x11')](_0x429897[_0x9b6b('0x12')],_0x1e3a5a,'\x20'),'Description':intUtil[_0x9b6b('0x11')](_0x429897[_0x9b6b('0x13')],_0x1e3a5a,'\x0a')},getCustomFields(_0x1c3ded,_0x1e3a5a));if(_0x2bd67c){if(_0x429897[_0x9b6b('0x14')]===_0x9b6b('0x15')){_0x5f2185[_0x9b6b('0x16')]=moment['utc']();_0x5f2185[_0x9b6b('0x17')]=![];_0x5f2185['IsRecurrence']=![];if(_0x2bd67c[_0x9b6b('0x18')]===_0x9b6b('0x19')||_0x2bd67c[_0x9b6b('0x18')]===_0x9b6b('0x1a')){_0x5f2185[_0x9b6b('0x1b')]=_0x2bd67c['id'];}else if(_0x2bd67c['endUserType']===_0x9b6b('0x1c')){_0x5f2185[_0x9b6b('0x1d')]=_0x2bd67c['id'];}}else if(_0x429897[_0x9b6b('0x14')]===_0x9b6b('0x1e')){if(_0x2bd67c[_0x9b6b('0x18')]==='contact'){_0x5f2185['ContactId']=_0x2bd67c['id'];}else if(_0x2bd67c[_0x9b6b('0x18')]===_0x9b6b('0x1c')){_0x5f2185['AccountId']=_0x2bd67c['id'];}else if(_0x2bd67c['endUserType']===_0x9b6b('0x1a')&&_0x429897['leadId']){_0x5f2185[_0x429897[_0x9b6b('0x1f')]]=_0x2bd67c['id'];}else{logger[_0x9b6b('0x20')](_0x9b6b('0x21'));}}}return _0x214ec8['sobject'](_0x429897['ticketType'])['create'](_0x5f2185);}function getUser(_0xaf7ed0,_0x3e5be8,_0x354992){if(!_[_0x9b6b('0x22')](_0x3e5be8)&&intUtil['validateEmail'](_0x3e5be8)){var _0x40198e={'Email':_0x3e5be8};var _0x20840a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x354992[_0x9b6b('0x23')]('User')['find'](_0x40198e,_0x20840a)['execute']()[_0x9b6b('0x24')](function(_0x503c73){if(_0x503c73[_0x9b6b('0x25')]){var _0x3e3e26=_['find'](_0x503c73,function(_0x12a609){return _0x12a609['Email']===_0x3e5be8;});if(_0x3e3e26){logger[_0x9b6b('0x20')](_0x9b6b('0x26'),_0x3e5be8);return BPromise[_0x9b6b('0x27')]({'id':_0x3e3e26['Id'],'name':_0x3e3e26[_0x9b6b('0x28')]});}}else{logger[_0x9b6b('0x20')](_0x9b6b('0x29'),_0x3e5be8);return _0x354992[_0x9b6b('0x2a')]()[_0x9b6b('0x24')](function(_0x302d1a){return BPromise['resolve']({'id':_0x302d1a[_0x9b6b('0x2b')],'name':_0x302d1a[_0x9b6b('0x2c')]});});}});}else{logger[_0x9b6b('0x20')](_0x9b6b('0x29'),_0x3e5be8);return _0x354992[_0x9b6b('0x2a')]()[_0x9b6b('0x24')](function(_0x1719a0){return BPromise[_0x9b6b('0x27')]({'id':_0x1719a0[_0x9b6b('0x2b')],'name':_0x1719a0[_0x9b6b('0x2c')]});});}}function getEndUser(_0x1ba838,_0xb69a31,_0x1460a6,_0x51a0ec,_0x5ba2a0){var _0x38a6de={'$or':{'Phone':_0x51a0ec}};var _0x338fec={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger[_0x9b6b('0x20')](_0x9b6b('0x2d'),_0x51a0ec,_0xb69a31[_0x9b6b('0x2e')]);switch(_0xb69a31[_0x9b6b('0x2e')]){case _0x9b6b('0x2f'):var _0x271e5d=_[_0x9b6b('0x30')](_0x38a6de);if(_0xb69a31[_0x9b6b('0x31')]){var _0x4330c1={};_0x4330c1[_0xb69a31[_0x9b6b('0x31')]]=_0x51a0ec;_['merge'](_0x271e5d['$or'],_0x4330c1);}return _0x5ba2a0[_0x9b6b('0x23')](_0x9b6b('0x32'))[_0x9b6b('0x33')](_0x271e5d,_0x338fec)[_0x9b6b('0x34')]()[_0x9b6b('0x24')](function(_0x2191e2){if(_0x2191e2&&_0x2191e2[_0x9b6b('0x25')]){return _0x2191e2;}else{var _0x1bf598=_[_0x9b6b('0x30')](_0x38a6de);if(_0xb69a31[_0x9b6b('0x35')]){var _0x562e9f={};_0x562e9f[_0xb69a31['additionalSearchLead']]=_0x51a0ec;_[_0x9b6b('0x36')](_0x1bf598[_0x9b6b('0x37')],_0x562e9f);}return _0x5ba2a0[_0x9b6b('0x23')](_0x9b6b('0x38'))['find'](_0x1bf598,_0x338fec);}});case _0x9b6b('0x39'):var _0x470329=_[_0x9b6b('0x30')](_0x38a6de);if(_0xb69a31[_0x9b6b('0x3a')]){var _0x4330c1={};_0x4330c1[_0xb69a31[_0x9b6b('0x3a')]]=_0x51a0ec;_[_0x9b6b('0x36')](_0x470329[_0x9b6b('0x37')],_0x4330c1);}return _0x5ba2a0[_0x9b6b('0x23')](_0x9b6b('0x3b'))[_0x9b6b('0x33')](_0x470329,_0x338fec)[_0x9b6b('0x34')]()[_0x9b6b('0x24')](function(_0x45ca83){if(_0x45ca83&&_0x45ca83[_0x9b6b('0x25')]){return _0x45ca83;}else{var _0x198e1b=_[_0x9b6b('0x30')](_0x38a6de);if(_0xb69a31['additionalSearchContact']){var _0x34c39b={};_0x34c39b[_0xb69a31[_0x9b6b('0x31')]]=_0x51a0ec;_['merge'](_0x198e1b[_0x9b6b('0x37')],_0x34c39b);}return _0x5ba2a0[_0x9b6b('0x23')]('Contact')[_0x9b6b('0x33')](_0x198e1b,_0x338fec)[_0x9b6b('0x24')](function(_0x457e04){if(_0x457e04&&_0x457e04[_0x9b6b('0x25')]){return _0x457e04;}else{var _0x37e52f=_[_0x9b6b('0x30')](_0x38a6de);if(_0xb69a31[_0x9b6b('0x35')]){var _0x32c70e={};_0x32c70e[_0xb69a31[_0x9b6b('0x35')]]=_0x51a0ec;_['merge'](_0x37e52f[_0x9b6b('0x37')],_0x32c70e);}return _0x5ba2a0[_0x9b6b('0x23')](_0x9b6b('0x38'))[_0x9b6b('0x33')](_0x37e52f,_0x338fec);}});}});case'contact':var _0x271e5d=_['cloneDeep'](_0x38a6de);if(_0xb69a31[_0x9b6b('0x31')]){var _0x4330c1={};_0x4330c1[_0xb69a31[_0x9b6b('0x31')]]=_0x51a0ec;_['merge'](_0x271e5d[_0x9b6b('0x37')],_0x4330c1);}return _0x5ba2a0[_0x9b6b('0x23')](_0x9b6b('0x32'))['find'](_0x271e5d,_0x338fec)[_0x9b6b('0x34')]();case _0x9b6b('0x1a'):var _0x226c49=_[_0x9b6b('0x30')](_0x38a6de);if(_0xb69a31[_0x9b6b('0x35')]){var _0x4330c1={};_0x4330c1[_0xb69a31[_0x9b6b('0x35')]]=_0x51a0ec;_[_0x9b6b('0x36')](_0x226c49[_0x9b6b('0x37')],_0x4330c1);}return _0x5ba2a0[_0x9b6b('0x23')](_0x9b6b('0x38'))[_0x9b6b('0x33')](_0x226c49,_0x338fec);case _0x9b6b('0x1c'):var _0x470329=_[_0x9b6b('0x30')](_0x38a6de);if(_0xb69a31['additionalSearchAccount']){var _0x4330c1={};_0x4330c1[_0xb69a31[_0x9b6b('0x3a')]]=_0x51a0ec;_['merge'](_0x470329[_0x9b6b('0x37')],_0x4330c1);}return _0x5ba2a0[_0x9b6b('0x23')](_0x9b6b('0x3b'))['find'](_0x470329,_0x338fec);default:return null;}})[_0x9b6b('0x24')](function(_0x17b5b4){if(_0x17b5b4&&_0x17b5b4[_0x9b6b('0x25')]){var _0x19edae=_[_0x9b6b('0x3c')](_0x17b5b4);if(_0x19edae){return BPromise['resolve']({'id':_0x19edae['Id'],'name':_0x19edae[_0x9b6b('0x28')],'phone':_0x19edae[_0x9b6b('0x3d')],'endUserType':_0x19edae[_0x9b6b('0x3e')][_0x9b6b('0x3f')][_0x9b6b('0x40')]()});}}})[_0x9b6b('0x24')](function(_0x5f1b72){if(_0x5f1b72){logger[_0x9b6b('0x20')](_0x9b6b('0x41'),_0x5f1b72[_0x9b6b('0x18')],_0x51a0ec);return BPromise[_0x9b6b('0x27')](_0x5f1b72);}else{logger[_0x9b6b('0x20')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x51a0ec);var _0x93f994={'Phone':_0x51a0ec};if(_0xb69a31[_0x9b6b('0x42')]){if(_0xb69a31[_0x9b6b('0x42')]==='contact'){logger['info'](_0x9b6b('0x43'),_0x51a0ec,_0xb69a31['moduleCreate']);_0x93f994[_0x9b6b('0x44')]=_0x1460a6!==_0x9b6b('0x45')?_0x1460a6:util[_0x9b6b('0x46')](_0x9b6b('0x47'),_0x51a0ec);}else if(_0xb69a31[_0x9b6b('0x42')]===_0x9b6b('0x1a')){logger[_0x9b6b('0x20')](_0x9b6b('0x43'),_0x51a0ec,_0xb69a31[_0x9b6b('0x42')]);_0x93f994['LastName']=_0x1460a6!==_0x9b6b('0x45')?_0x1460a6:util['format'](_0x9b6b('0x47'),_0x51a0ec);_0x93f994['Company']='No\x20Company';}else if(_0xb69a31[_0x9b6b('0x42')]==='account'){logger[_0x9b6b('0x20')](_0x9b6b('0x43'),_0x51a0ec,_0xb69a31[_0x9b6b('0x42')]);_0x93f994[_0x9b6b('0x28')]=_0x1460a6!==_0x9b6b('0x45')?_0x1460a6:util[_0x9b6b('0x46')]('Caller\x20-\x20%s',_0x51a0ec);}else{return null;}}return _0x5ba2a0['sobject'](_[_0x9b6b('0x48')](_0xb69a31[_0x9b6b('0x42')]))['create'](_0x93f994)[_0x9b6b('0x24')](function(_0x2c3e40){return BPromise[_0x9b6b('0x27')]({'id':_0x2c3e40['id'],'endUserType':_0xb69a31['moduleCreate']});});}});}function getCustomFields(_0x3bac29,_0x255ed0){var _0xf2fbf6={};if(_0x3bac29[_0x9b6b('0x25')]>0x0){_[_0x9b6b('0x49')](_0x3bac29,function(_0x393235){if(_[_0x9b6b('0x4a')]([_0x9b6b('0x4b'),'picklist'],_0x393235[_0x9b6b('0x3f')])&&_0x393235[_0x9b6b('0x4c')]){_0xf2fbf6[_0x393235[_0x9b6b('0x4c')]]=_0x393235[_0x9b6b('0x4d')][_0x9b6b('0x4e')]();}else if(_0x393235[_0x9b6b('0x3f')]==='variable'&&_0x393235[_0x9b6b('0x4f')]&&_0x393235['idField']){_0x255ed0[_0x393235['variableName']]&&(_0xf2fbf6[_0x393235[_0x9b6b('0x4c')]]=_0x255ed0[_0x393235[_0x9b6b('0x4f')]][_0x9b6b('0x4e')]());}else if(_0x393235[_0x9b6b('0x3f')]===_0x9b6b('0x50')&&_0x393235[_0x9b6b('0x51')]&&_0x393235['Variable'][_0x9b6b('0x52')]&&_0x393235['idField']){_0x255ed0[_0x393235[_0x9b6b('0x51')][_0x9b6b('0x52')]['toLowerCase']()]&&(_0xf2fbf6[_0x393235['idField']]=_0x255ed0[_0x393235[_0x9b6b('0x51')]['name'][_0x9b6b('0x40')]()][_0x9b6b('0x4e')]());}});}return _0xf2fbf6;}function getConnection(_0x329246){var _0x35f8b6=_0x329246['password']['concat'](_0x329246['securityToken']);var _0x30252c=new jsforce['Connection']({'oauth2':{'loginUrl':_0x329246[_0x9b6b('0x53')]||_0x9b6b('0x54'),'clientId':_0x329246[_0x9b6b('0x55')],'clientSecret':_0x329246[_0x9b6b('0x56')]}});return _0x30252c[_0x9b6b('0x57')](_0x329246[_0x9b6b('0x58')],_0x35f8b6)[_0x9b6b('0x24')](function(){logger[_0x9b6b('0x20')]('Connection\x20established.');return _0x30252c;});}exports[_0x9b6b('0x59')]=function(_0x354c0e,_0x373606,_0xdd3e5b,_0x441943,_0x376544,_0x47691b){var _0x1d3aba,_0x2b6776,_0xb36dc0,_0x2e9641;_0x47691b[_0x9b6b('0x5a')]=intUtil[_0x9b6b('0x5b')](_0x47691b[_0x9b6b('0x5a')]);_0x47691b[_0x9b6b('0x53')]=intUtil[_0x9b6b('0x5b')](_0x47691b[_0x9b6b('0x53')]);if(_0x376544&&_0x376544[_0x9b6b('0x5c')]){logger['info'](_0x9b6b('0x5d'),_0x9b6b('0x5e'));_0x373606['recordingURL']=util[_0x9b6b('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x47691b['serverUrl'],_0x373606[_0x9b6b('0x5f')],md5(_0x373606[_0x9b6b('0x5f')]));}else{_0x373606['recordingURL']='';}return getConnection(_0x47691b)[_0x9b6b('0x24')](function(_0x257ed7){_0x2e9641=_0x257ed7;return getUser(_0x47691b,_0x441943[_0x9b6b('0x60')],_0x2e9641);})[_0x9b6b('0x24')](function(_0x5721f9){_0x1d3aba=_0x5721f9;return getEndUser(_0x47691b,_0xdd3e5b,_0x373606[_0x9b6b('0x61')],_0x373606[_0x9b6b('0x62')],_0x2e9641);})['then'](function(_0x52b1a0){_0x2b6776=_0x52b1a0;return getTicket(_0x47691b,_0x1d3aba,_0x2b6776,_0xdd3e5b,_0x373606,_0xdd3e5b['Fields'],_0x2e9641,_0x9b6b('0x59'));})['then'](function(_0x220d98){_0xb36dc0=_0x220d98;logger[_0x9b6b('0x20')](_0x9b6b('0x63'),_0xb36dc0['id']);logger[_0x9b6b('0x20')](_0x9b6b('0x64'),_0xb36dc0['id'],_0x441943['name'],_0x47691b[_0x9b6b('0x3f')]);switch(_0x47691b['type']){case'integrationTab':emit(util[_0x9b6b('0x46')](_0x9b6b('0x65'),_0x441943['name']),_0x9b6b('0x66'),{'recordId':_0xb36dc0['id']});break;case'newTab':emit(util['format'](_0x9b6b('0x65'),_0x441943[_0x9b6b('0x52')]),_0x9b6b('0x67'),{'uri':util[_0x9b6b('0x46')]('%s/%s/e',_0x2e9641[_0x9b6b('0x68')],_0xb36dc0['id'])});break;default:logger[_0x9b6b('0x69')](_0x9b6b('0x6a'));}})[_0x9b6b('0x6b')](function(_0x4623d2){logger[_0x9b6b('0x69')](_0x9b6b('0x5d'),_0x4623d2);});};exports[_0x9b6b('0x6c')]=function(_0x46456c,_0x12da89,_0x4ec756,_0x20cc4a,_0x22a51a,_0x93e21a,_0xb447f5){var _0x3340fa,_0x3a0508,_0xd4501f,_0x3b0035;_0x93e21a[_0x9b6b('0x5a')]=intUtil[_0x9b6b('0x5b')](_0x93e21a[_0x9b6b('0x5a')]);_0x93e21a[_0x9b6b('0x53')]=intUtil['stripTrailingSlash'](_0x93e21a['remoteUri']);if(_0xb447f5&&_0xb447f5[_0x9b6b('0x6d')]&&_0xb447f5[_0x9b6b('0x6d')]!=='none'){logger['info'](_0x9b6b('0x6e'),_0x9b6b('0x5e'));_0x12da89['recordingURL']=util[_0x9b6b('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x93e21a[_0x9b6b('0x5a')],_0x12da89[_0x9b6b('0x5f')],md5(_0x12da89[_0x9b6b('0x5f')]));}return getConnection(_0x93e21a)['then'](function(_0x21f641){_0x3b0035=_0x21f641;return getUser(_0x93e21a,_0x20cc4a[_0x9b6b('0x60')],_0x3b0035);})['then'](function(_0x18db88){_0x3340fa=_0x18db88;return getEndUser(_0x93e21a,_0x4ec756,_0x12da89['destcalleridname'],_0x12da89[_0x9b6b('0x6f')],_0x3b0035);})[_0x9b6b('0x24')](function(_0x160c78){_0x3a0508=_0x160c78;return getTicket(_0x93e21a,_0x3340fa,_0x3a0508,_0x4ec756,_0x12da89,_0x4ec756[_0x9b6b('0x70')],_0x3b0035,'outbound');})[_0x9b6b('0x24')](function(_0xc4a7d3){_0xd4501f=_0xc4a7d3;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0xd4501f['id']);logger[_0x9b6b('0x20')](_0x9b6b('0x71'),_0xd4501f['id'],_0x20cc4a['name'],_0x93e21a[_0x9b6b('0x3f')]);switch(_0x93e21a[_0x9b6b('0x3f')]){case _0x9b6b('0x72'):emit(util[_0x9b6b('0x46')](_0x9b6b('0x65'),_0x20cc4a[_0x9b6b('0x52')]),_0x9b6b('0x66'),{'recordId':_0xd4501f['id']});break;case _0x9b6b('0x73'):emit(util[_0x9b6b('0x46')](_0x9b6b('0x65'),_0x20cc4a[_0x9b6b('0x52')]),'trigger:browser:url',{'uri':util[_0x9b6b('0x46')](_0x9b6b('0x74'),_0x3b0035[_0x9b6b('0x68')],_0xd4501f['id'])});break;default:logger[_0x9b6b('0x69')](_0x9b6b('0x6e'),_0x9b6b('0x75'));}})['catch'](function(_0x29b65c){logger[_0x9b6b('0x69')]('[OUTBOUND]',_0x29b65c);});};exports[_0x9b6b('0x76')]=function(_0x1c5259,_0x4b64a0,_0x5a2199,_0x2ee70b,_0x38a31c,_0x157f0b){var _0x4b9b03,_0x5e6d36,_0x2478d5,_0x26c0d1;_0x157f0b['serverUrl']=intUtil[_0x9b6b('0x5b')](_0x157f0b[_0x9b6b('0x5a')]);_0x157f0b[_0x9b6b('0x53')]=intUtil['stripTrailingSlash'](_0x157f0b[_0x9b6b('0x53')]);if(_0x38a31c&&_0x38a31c[_0x9b6b('0x5c')]){logger[_0x9b6b('0x20')]('['+_0x4b64a0[_0x9b6b('0x77')]['toUpperCase']()+']',_0x9b6b('0x5e'));_0x4b64a0[_0x9b6b('0x78')]=util[_0x9b6b('0x46')](_0x9b6b('0x79'),_0x157f0b[_0x9b6b('0x5a')],_0x4b64a0['uniqueid'],md5(_0x4b64a0[_0x9b6b('0x5f')]));}else{_0x4b64a0[_0x9b6b('0x78')]='';}return getConnection(_0x157f0b)[_0x9b6b('0x24')](function(_0xd48a0){_0x26c0d1=_0xd48a0;if(!_['isNil'](_0x2ee70b)){return getUser(_0x157f0b,_0x2ee70b[_0x9b6b('0x52')],_0x26c0d1);}else{return getUser(_0x157f0b,null,_0x26c0d1);}})['then'](function(_0x4fd942){_0x4b9b03=_0x4fd942;return getEndUser(_0x157f0b,_0x5a2199,_0x4b64a0[_0x9b6b('0x61')],_0x4b64a0[_0x9b6b('0x62')],_0x26c0d1);})[_0x9b6b('0x24')](function(_0x337e62){_0x5e6d36=_0x337e62;return getTicket(_0x157f0b,_0x4b9b03,_0x5e6d36,_0x5a2199,_0x4b64a0,_0x5a2199[_0x9b6b('0x70')],_0x26c0d1);})['then'](function(_0x3e8fbd){_0x2478d5=_0x3e8fbd;logger['info']('['+_0x4b64a0[_0x9b6b('0x77')][_0x9b6b('0x7a')]()+_0x9b6b('0x7b'),_0x2478d5['id']);logger[_0x9b6b('0x20')]('['+_0x4b64a0[_0x9b6b('0x77')]['toUpperCase']()+_0x9b6b('0x7c'),_0x157f0b['type']);})[_0x9b6b('0x6b')](function(_0x1746cf){logger['error']('['+_0x4b64a0['lastevent'][_0x9b6b('0x7a')]()+']',_0x1746cf);});}; \ No newline at end of file +var _0x4e8e=['type','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.','LastName','','format','Caller\x20-\x20%s','moduleCreate','Company','No\x20Company','upperFirst','includes','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','[OUTBOUND]','recordingURL','email','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','Fields','lastevent',']\x20Ticket\x20%s\x20created.','toUpperCase','lodash','jsforce','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','account','WhatId','contact','AccountId','leadId','info','create','isNil','sobject','User','execute','length','find','Email','Agent\x20%s\x20found.','resolve','Name','identity','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','moduleSearch','contact_lead','additionalSearchContact','$or','Contact','cloneDeep','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone'];(function(_0x1e0d3c,_0x891ad0){var _0x423467=function(_0x332eee){while(--_0x332eee){_0x1e0d3c['push'](_0x1e0d3c['shift']());}};_0x423467(++_0x891ad0);}(_0x4e8e,0x1ba));var _0xe4e8=function(_0x3a4cef,_0x439bbb){_0x3a4cef=_0x3a4cef-0x0;var _0x4944db=_0x4e8e[_0x3a4cef];return _0x4944db;};'use strict';var _=require(_0xe4e8('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0xe4e8('0x1'));var util=require('util');var Redis=require(_0xe4e8('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xe4e8('0x3'))('salesforce');config[_0xe4e8('0x4')]=_[_0xe4e8('0x5')](config['redis'],{'host':_0xe4e8('0x6'),'port':0x18eb});var io=require(_0xe4e8('0x7'))(new Redis(config[_0xe4e8('0x4')]));function emit(_0x20e3d7,_0x5da277,_0x390f56){io['to'](_0x20e3d7)[_0xe4e8('0x8')](_0x5da277,_0x390f56);}function getTicket(_0x4bc7d0,_0x57af18,_0x2ce27b,_0x32a61e,_0x123fda,_0x40147c,_0x126011,_0x38e7da){var _0x182c21=Object['assign']({},{'OwnerId':_0x57af18['id'],'Subject':intUtil[_0xe4e8('0x9')](_0x32a61e[_0xe4e8('0xa')],_0x123fda,'\x20'),'Description':intUtil[_0xe4e8('0x9')](_0x32a61e[_0xe4e8('0xb')],_0x123fda,'\x0a')},getCustomFields(_0x40147c,_0x123fda));if(_0x2ce27b){if(_0x32a61e[_0xe4e8('0xc')]==='Task'){_0x182c21[_0xe4e8('0xd')]=moment[_0xe4e8('0xe')]();_0x182c21[_0xe4e8('0xf')]=![];_0x182c21[_0xe4e8('0x10')]=![];if(_0x2ce27b[_0xe4e8('0x11')]==='contact'||_0x2ce27b[_0xe4e8('0x11')]===_0xe4e8('0x12')){_0x182c21['WhoId']=_0x2ce27b['id'];}else if(_0x2ce27b[_0xe4e8('0x11')]===_0xe4e8('0x13')){_0x182c21[_0xe4e8('0x14')]=_0x2ce27b['id'];}}else if(_0x32a61e['ticketType']==='Case'){if(_0x2ce27b[_0xe4e8('0x11')]===_0xe4e8('0x15')){_0x182c21['ContactId']=_0x2ce27b['id'];}else if(_0x2ce27b[_0xe4e8('0x11')]===_0xe4e8('0x13')){_0x182c21[_0xe4e8('0x16')]=_0x2ce27b['id'];}else if(_0x2ce27b[_0xe4e8('0x11')]===_0xe4e8('0x12')&&_0x32a61e[_0xe4e8('0x17')]){_0x182c21[_0x32a61e[_0xe4e8('0x17')]]=_0x2ce27b['id'];}else{logger[_0xe4e8('0x18')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x126011['sobject'](_0x32a61e[_0xe4e8('0xc')])[_0xe4e8('0x19')](_0x182c21);}function getUser(_0x4d6d96,_0x347258,_0x3b1c0e){if(!_[_0xe4e8('0x1a')](_0x347258)&&intUtil['validateEmail'](_0x347258)){var _0xe65458={'Email':_0x347258};var _0x54dc1b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3b1c0e[_0xe4e8('0x1b')](_0xe4e8('0x1c'))['find'](_0xe65458,_0x54dc1b)[_0xe4e8('0x1d')]()['then'](function(_0x49b2de){if(_0x49b2de[_0xe4e8('0x1e')]){var _0x2f2242=_[_0xe4e8('0x1f')](_0x49b2de,function(_0x852bbf){return _0x852bbf[_0xe4e8('0x20')]===_0x347258;});if(_0x2f2242){logger['info'](_0xe4e8('0x21'),_0x347258);return BPromise[_0xe4e8('0x22')]({'id':_0x2f2242['Id'],'name':_0x2f2242[_0xe4e8('0x23')]});}}else{logger[_0xe4e8('0x18')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x347258);return _0x3b1c0e[_0xe4e8('0x24')]()['then'](function(_0x362eb8){return BPromise[_0xe4e8('0x22')]({'id':_0x362eb8[_0xe4e8('0x25')],'name':_0x362eb8['display_name']});});}});}else{logger[_0xe4e8('0x18')](_0xe4e8('0x26'),_0x347258);return _0x3b1c0e[_0xe4e8('0x24')]()[_0xe4e8('0x27')](function(_0x34fa23){return BPromise[_0xe4e8('0x22')]({'id':_0x34fa23[_0xe4e8('0x25')],'name':_0x34fa23['display_name']});});}}function getEndUser(_0x4a259c,_0x515b94,_0x1da533,_0x1ff81f,_0x4bf11d){var _0x2ab101={'$or':{'Phone':_0x1ff81f}};var _0x276e0a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xe4e8('0x27')](function(){logger[_0xe4e8('0x18')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x1ff81f,_0x515b94[_0xe4e8('0x28')]);switch(_0x515b94[_0xe4e8('0x28')]){case _0xe4e8('0x29'):var _0x38f701=_['cloneDeep'](_0x2ab101);if(_0x515b94[_0xe4e8('0x2a')]){var _0x34cc7b={};_0x34cc7b[_0x515b94[_0xe4e8('0x2a')]]=_0x1ff81f;_['merge'](_0x38f701[_0xe4e8('0x2b')],_0x34cc7b);}return _0x4bf11d[_0xe4e8('0x1b')](_0xe4e8('0x2c'))[_0xe4e8('0x1f')](_0x38f701,_0x276e0a)[_0xe4e8('0x1d')]()[_0xe4e8('0x27')](function(_0xe23209){if(_0xe23209&&_0xe23209['length']){return _0xe23209;}else{var _0x44c69f=_[_0xe4e8('0x2d')](_0x2ab101);if(_0x515b94[_0xe4e8('0x2e')]){var _0x1d0527={};_0x1d0527[_0x515b94[_0xe4e8('0x2e')]]=_0x1ff81f;_[_0xe4e8('0x2f')](_0x44c69f[_0xe4e8('0x2b')],_0x1d0527);}return _0x4bf11d[_0xe4e8('0x1b')](_0xe4e8('0x30'))[_0xe4e8('0x1f')](_0x44c69f,_0x276e0a);}});case _0xe4e8('0x31'):var _0x37e4fb=_[_0xe4e8('0x2d')](_0x2ab101);if(_0x515b94[_0xe4e8('0x32')]){var _0x34cc7b={};_0x34cc7b[_0x515b94['additionalSearchAccount']]=_0x1ff81f;_['merge'](_0x37e4fb[_0xe4e8('0x2b')],_0x34cc7b);}return _0x4bf11d[_0xe4e8('0x1b')]('Account')[_0xe4e8('0x1f')](_0x37e4fb,_0x276e0a)[_0xe4e8('0x1d')]()[_0xe4e8('0x27')](function(_0x137b93){if(_0x137b93&&_0x137b93['length']){return _0x137b93;}else{var _0x44d2aa=_[_0xe4e8('0x2d')](_0x2ab101);if(_0x515b94[_0xe4e8('0x2a')]){var _0x7a87e7={};_0x7a87e7[_0x515b94[_0xe4e8('0x2a')]]=_0x1ff81f;_[_0xe4e8('0x2f')](_0x44d2aa[_0xe4e8('0x2b')],_0x7a87e7);}return _0x4bf11d['sobject'](_0xe4e8('0x2c'))[_0xe4e8('0x1f')](_0x44d2aa,_0x276e0a)[_0xe4e8('0x27')](function(_0x33a9af){if(_0x33a9af&&_0x33a9af[_0xe4e8('0x1e')]){return _0x33a9af;}else{var _0x26fb18=_[_0xe4e8('0x2d')](_0x2ab101);if(_0x515b94[_0xe4e8('0x2e')]){var _0x27d015={};_0x27d015[_0x515b94[_0xe4e8('0x2e')]]=_0x1ff81f;_[_0xe4e8('0x2f')](_0x26fb18[_0xe4e8('0x2b')],_0x27d015);}return _0x4bf11d[_0xe4e8('0x1b')](_0xe4e8('0x30'))['find'](_0x26fb18,_0x276e0a);}});}});case _0xe4e8('0x15'):var _0x38f701=_[_0xe4e8('0x2d')](_0x2ab101);if(_0x515b94[_0xe4e8('0x2a')]){var _0x34cc7b={};_0x34cc7b[_0x515b94[_0xe4e8('0x2a')]]=_0x1ff81f;_[_0xe4e8('0x2f')](_0x38f701['$or'],_0x34cc7b);}return _0x4bf11d[_0xe4e8('0x1b')](_0xe4e8('0x2c'))['find'](_0x38f701,_0x276e0a)[_0xe4e8('0x1d')]();case'lead':var _0x4a1ca8=_[_0xe4e8('0x2d')](_0x2ab101);if(_0x515b94[_0xe4e8('0x2e')]){var _0x34cc7b={};_0x34cc7b[_0x515b94[_0xe4e8('0x2e')]]=_0x1ff81f;_[_0xe4e8('0x2f')](_0x4a1ca8[_0xe4e8('0x2b')],_0x34cc7b);}return _0x4bf11d['sobject']('Lead')[_0xe4e8('0x1f')](_0x4a1ca8,_0x276e0a);case _0xe4e8('0x13'):var _0x37e4fb=_[_0xe4e8('0x2d')](_0x2ab101);if(_0x515b94[_0xe4e8('0x32')]){var _0x34cc7b={};_0x34cc7b[_0x515b94[_0xe4e8('0x32')]]=_0x1ff81f;_['merge'](_0x37e4fb[_0xe4e8('0x2b')],_0x34cc7b);}return _0x4bf11d['sobject'](_0xe4e8('0x33'))[_0xe4e8('0x1f')](_0x37e4fb,_0x276e0a);default:return null;}})[_0xe4e8('0x27')](function(_0x5cc1f6){if(_0x5cc1f6&&_0x5cc1f6[_0xe4e8('0x1e')]){var _0x1be0f2=_[_0xe4e8('0x34')](_0x5cc1f6);if(_0x1be0f2){return BPromise[_0xe4e8('0x22')]({'id':_0x1be0f2['Id'],'name':_0x1be0f2['Name'],'phone':_0x1be0f2[_0xe4e8('0x35')],'endUserType':_0x1be0f2['attributes'][_0xe4e8('0x36')]['toLowerCase']()});}}})['then'](function(_0x19bf5d){if(_0x19bf5d){logger[_0xe4e8('0x18')](_0xe4e8('0x37'),_0x19bf5d['endUserType'],_0x1ff81f);return BPromise[_0xe4e8('0x22')](_0x19bf5d);}else{logger[_0xe4e8('0x18')](_0xe4e8('0x38'),_0x1ff81f);var _0x1c8fdc={'Phone':_0x1ff81f};if(_0x515b94['moduleCreate']){if(_0x515b94['moduleCreate']==='contact'){logger[_0xe4e8('0x18')](_0xe4e8('0x39'),_0x1ff81f,_0x515b94['moduleCreate']);_0x1c8fdc[_0xe4e8('0x3a')]=_0x1da533!==_0xe4e8('0x3b')?_0x1da533:util[_0xe4e8('0x3c')](_0xe4e8('0x3d'),_0x1ff81f);}else if(_0x515b94[_0xe4e8('0x3e')]==='lead'){logger[_0xe4e8('0x18')](_0xe4e8('0x39'),_0x1ff81f,_0x515b94[_0xe4e8('0x3e')]);_0x1c8fdc[_0xe4e8('0x3a')]=_0x1da533!==''?_0x1da533:util[_0xe4e8('0x3c')](_0xe4e8('0x3d'),_0x1ff81f);_0x1c8fdc[_0xe4e8('0x3f')]=_0xe4e8('0x40');}else if(_0x515b94[_0xe4e8('0x3e')]==='account'){logger['info'](_0xe4e8('0x39'),_0x1ff81f,_0x515b94[_0xe4e8('0x3e')]);_0x1c8fdc[_0xe4e8('0x23')]=_0x1da533!==_0xe4e8('0x3b')?_0x1da533:util[_0xe4e8('0x3c')](_0xe4e8('0x3d'),_0x1ff81f);}else{return null;}}return _0x4bf11d[_0xe4e8('0x1b')](_[_0xe4e8('0x41')](_0x515b94[_0xe4e8('0x3e')]))[_0xe4e8('0x19')](_0x1c8fdc)[_0xe4e8('0x27')](function(_0xe537fa){return BPromise[_0xe4e8('0x22')]({'id':_0xe537fa['id'],'endUserType':_0x515b94[_0xe4e8('0x3e')]});});}});}function getCustomFields(_0x9bc589,_0x2a1971){var _0x12c2d5={};if(_0x9bc589[_0xe4e8('0x1e')]>0x0){_['forEach'](_0x9bc589,function(_0x3efc52){if(_[_0xe4e8('0x42')](['string',_0xe4e8('0x43')],_0x3efc52['type'])&&_0x3efc52[_0xe4e8('0x44')]){_0x12c2d5[_0x3efc52['idField']]=_0x3efc52[_0xe4e8('0x45')][_0xe4e8('0x46')]();}else if(_0x3efc52['type']===_0xe4e8('0x47')&&_0x3efc52[_0xe4e8('0x48')]&&_0x3efc52[_0xe4e8('0x44')]){_0x2a1971[_0x3efc52[_0xe4e8('0x48')]]&&(_0x12c2d5[_0x3efc52[_0xe4e8('0x44')]]=_0x2a1971[_0x3efc52['variableName']][_0xe4e8('0x46')]());}else if(_0x3efc52[_0xe4e8('0x36')]===_0xe4e8('0x49')&&_0x3efc52[_0xe4e8('0x4a')]&&_0x3efc52[_0xe4e8('0x4a')][_0xe4e8('0x4b')]&&_0x3efc52[_0xe4e8('0x44')]){_0x2a1971[_0x3efc52[_0xe4e8('0x4a')][_0xe4e8('0x4b')][_0xe4e8('0x4c')]()]&&(_0x12c2d5[_0x3efc52[_0xe4e8('0x44')]]=_0x2a1971[_0x3efc52[_0xe4e8('0x4a')][_0xe4e8('0x4b')][_0xe4e8('0x4c')]()][_0xe4e8('0x46')]());}});}return _0x12c2d5;}function getConnection(_0x146195){var _0xe6bf98=_0x146195[_0xe4e8('0x4d')][_0xe4e8('0x4e')](_0x146195['securityToken']);var _0xe9fc7b=new jsforce[(_0xe4e8('0x4f'))]({'oauth2':{'loginUrl':_0x146195[_0xe4e8('0x50')]||_0xe4e8('0x51'),'clientId':_0x146195[_0xe4e8('0x52')],'clientSecret':_0x146195[_0xe4e8('0x53')]}});return _0xe9fc7b[_0xe4e8('0x54')](_0x146195[_0xe4e8('0x55')],_0xe6bf98)['then'](function(){logger[_0xe4e8('0x18')](_0xe4e8('0x56'));return _0xe9fc7b;});}exports['queue']=function(_0x440a2c,_0x1d2e45,_0x32dbae,_0x5bd671,_0x110fa0,_0xbb2156){var _0x48a02f,_0x391e47,_0x4c9a8b,_0x50149a;_0xbb2156['serverUrl']=intUtil['stripTrailingSlash'](_0xbb2156[_0xe4e8('0x57')]);_0xbb2156['remoteUri']=intUtil[_0xe4e8('0x58')](_0xbb2156[_0xe4e8('0x50')]);if(_0x110fa0&&_0x110fa0[_0xe4e8('0x59')]){logger['info'](_0xe4e8('0x5a'),_0xe4e8('0x5b'));_0x1d2e45['recordingURL']=util['format'](_0xe4e8('0x5c'),_0xbb2156['serverUrl'],_0x1d2e45[_0xe4e8('0x5d')],md5(_0x1d2e45[_0xe4e8('0x5d')]));}else{_0x1d2e45['recordingURL']='';}return getConnection(_0xbb2156)[_0xe4e8('0x27')](function(_0x65bb57){_0x50149a=_0x65bb57;return getUser(_0xbb2156,_0x5bd671['email'],_0x50149a);})[_0xe4e8('0x27')](function(_0xdc0945){_0x48a02f=_0xdc0945;return getEndUser(_0xbb2156,_0x32dbae,_0x1d2e45[_0xe4e8('0x5e')],_0x1d2e45[_0xe4e8('0x5f')],_0x50149a);})[_0xe4e8('0x27')](function(_0x5939fe){_0x391e47=_0x5939fe;return getTicket(_0xbb2156,_0x48a02f,_0x391e47,_0x32dbae,_0x1d2e45,_0x32dbae['Fields'],_0x50149a,_0xe4e8('0x60'));})[_0xe4e8('0x27')](function(_0x9d92ad){_0x4c9a8b=_0x9d92ad;logger[_0xe4e8('0x18')](_0xe4e8('0x61'),_0x4c9a8b['id']);logger[_0xe4e8('0x18')](_0xe4e8('0x62'),_0x4c9a8b['id'],_0x5bd671[_0xe4e8('0x4b')],_0xbb2156['type']);switch(_0xbb2156['type']){case _0xe4e8('0x63'):emit(util[_0xe4e8('0x3c')](_0xe4e8('0x64'),_0x5bd671['name']),'trigger:salesforce:display',{'recordId':_0x4c9a8b['id']});break;case _0xe4e8('0x65'):emit(util[_0xe4e8('0x3c')](_0xe4e8('0x64'),_0x5bd671[_0xe4e8('0x4b')]),'trigger:browser:url',{'uri':util[_0xe4e8('0x3c')](_0xe4e8('0x66'),_0x50149a[_0xe4e8('0x67')],_0x4c9a8b['id'])});break;default:logger[_0xe4e8('0x68')](_0xe4e8('0x69'));}})[_0xe4e8('0x6a')](function(_0x1d02d4){logger[_0xe4e8('0x68')](_0xe4e8('0x5a'),_0x1d02d4);});};exports['outbound']=function(_0x37a366,_0x5e5b38,_0x5e3685,_0x56c828,_0x3b018f,_0x1f1408,_0x532505){var _0x453d1a,_0xbbd5e,_0x41f34a,_0x2e2f1e;_0x1f1408[_0xe4e8('0x57')]=intUtil[_0xe4e8('0x58')](_0x1f1408[_0xe4e8('0x57')]);_0x1f1408[_0xe4e8('0x50')]=intUtil['stripTrailingSlash'](_0x1f1408[_0xe4e8('0x50')]);if(_0x532505&&_0x532505['recordingFormat']&&_0x532505[_0xe4e8('0x6b')]!==_0xe4e8('0x6c')){logger[_0xe4e8('0x18')](_0xe4e8('0x6d'),_0xe4e8('0x5b'));_0x5e5b38[_0xe4e8('0x6e')]=util[_0xe4e8('0x3c')](_0xe4e8('0x5c'),_0x1f1408['serverUrl'],_0x5e5b38[_0xe4e8('0x5d')],md5(_0x5e5b38[_0xe4e8('0x5d')]));}return getConnection(_0x1f1408)[_0xe4e8('0x27')](function(_0xd423a2){_0x2e2f1e=_0xd423a2;return getUser(_0x1f1408,_0x56c828[_0xe4e8('0x6f')],_0x2e2f1e);})[_0xe4e8('0x27')](function(_0x32380e){_0x453d1a=_0x32380e;return getEndUser(_0x1f1408,_0x5e3685,_0x5e5b38['destcalleridname'],_0x5e5b38[_0xe4e8('0x70')],_0x2e2f1e);})[_0xe4e8('0x27')](function(_0xd80bbb){_0xbbd5e=_0xd80bbb;return getTicket(_0x1f1408,_0x453d1a,_0xbbd5e,_0x5e3685,_0x5e5b38,_0x5e3685['Fields'],_0x2e2f1e,_0xe4e8('0x71'));})[_0xe4e8('0x27')](function(_0x5c5d4e){_0x41f34a=_0x5c5d4e;logger[_0xe4e8('0x18')](_0xe4e8('0x72'),_0x41f34a['id']);logger[_0xe4e8('0x18')](_0xe4e8('0x73'),_0x41f34a['id'],_0x56c828[_0xe4e8('0x4b')],_0x1f1408['type']);switch(_0x1f1408['type']){case _0xe4e8('0x63'):emit(util[_0xe4e8('0x3c')](_0xe4e8('0x64'),_0x56c828[_0xe4e8('0x4b')]),_0xe4e8('0x74'),{'recordId':_0x41f34a['id']});break;case'newTab':emit(util['format']('user:%s',_0x56c828[_0xe4e8('0x4b')]),_0xe4e8('0x75'),{'uri':util[_0xe4e8('0x3c')]('%s/%s/e',_0x2e2f1e['instanceUrl'],_0x41f34a['id'])});break;default:logger['error'](_0xe4e8('0x6d'),_0xe4e8('0x76'));}})[_0xe4e8('0x6a')](function(_0x272a26){logger[_0xe4e8('0x68')](_0xe4e8('0x6d'),_0x272a26);});};exports[_0xe4e8('0x77')]=function(_0x3e7a35,_0x3d19d4,_0x29aa71,_0x1e9d70,_0x52af43,_0x4b966f){var _0x3e67f7,_0x2c4064,_0x3e2c89,_0x438d18;_0x4b966f[_0xe4e8('0x57')]=intUtil[_0xe4e8('0x58')](_0x4b966f[_0xe4e8('0x57')]);_0x4b966f['remoteUri']=intUtil['stripTrailingSlash'](_0x4b966f[_0xe4e8('0x50')]);if(_0x52af43&&_0x52af43[_0xe4e8('0x59')]){logger[_0xe4e8('0x18')]('['+_0x3d19d4['lastevent']['toUpperCase']()+']',_0xe4e8('0x5b'));_0x3d19d4[_0xe4e8('0x6e')]=util[_0xe4e8('0x3c')](_0xe4e8('0x5c'),_0x4b966f[_0xe4e8('0x57')],_0x3d19d4[_0xe4e8('0x5d')],md5(_0x3d19d4['uniqueid']));}else{_0x3d19d4['recordingURL']='';}return getConnection(_0x4b966f)[_0xe4e8('0x27')](function(_0x259055){_0x438d18=_0x259055;if(!_[_0xe4e8('0x1a')](_0x1e9d70)){return getUser(_0x4b966f,_0x1e9d70['name'],_0x438d18);}else{return getUser(_0x4b966f,null,_0x438d18);}})[_0xe4e8('0x27')](function(_0x3530e2){_0x3e67f7=_0x3530e2;return getEndUser(_0x4b966f,_0x29aa71,_0x3d19d4['calleridname'],_0x3d19d4[_0xe4e8('0x5f')],_0x438d18);})[_0xe4e8('0x27')](function(_0x20eac2){_0x2c4064=_0x20eac2;return getTicket(_0x4b966f,_0x3e67f7,_0x2c4064,_0x29aa71,_0x3d19d4,_0x29aa71[_0xe4e8('0x78')],_0x438d18);})['then'](function(_0x5c81ab){_0x3e2c89=_0x5c81ab;logger[_0xe4e8('0x18')]('['+_0x3d19d4[_0xe4e8('0x79')]['toUpperCase']()+_0xe4e8('0x7a'),_0x3e2c89['id']);logger['info']('['+_0x3d19d4[_0xe4e8('0x79')][_0xe4e8('0x7b')]()+']\x20Integration\x20account\x20type\x20%s.',_0x4b966f[_0xe4e8('0x36')]);})['catch'](function(_0x577f0c){logger[_0xe4e8('0x68')]('['+_0x3d19d4[_0xe4e8('0x79')][_0xe4e8('0x7b')]()+']',_0x577f0c);});}; \ 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 9c8460f..b8be57e 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 _0xc607=['Fields','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/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','serverUrl','stripTrailingSlash','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','adminId','result','sys_id','toUpperCase','catch','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','info','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','toString','variable','variableName','customVariable','Variable','name','outbound','incident','assign','getString','Descriptions'];(function(_0x3691a4,_0x453148){var _0x164fe5=function(_0xb9360d){while(--_0xb9360d){_0x3691a4['push'](_0x3691a4['shift']());}};_0x164fe5(++_0x453148);}(_0xc607,0x105));var _0x7c60=function(_0x4b19df,_0x59e0da){_0x4b19df=_0x4b19df-0x0;var _0x154c8b=_0xc607[_0x4b19df];return _0x154c8b;};'use strict';var _=require(_0x7c60('0x0'));var Promise=require(_0x7c60('0x1'));var rp=require(_0x7c60('0x2'));var util=require(_0x7c60('0x3'));var md5=require(_0x7c60('0x4'));var Redis=require(_0x7c60('0x5'));var intUtil=require('./util');var config=require(_0x7c60('0x6'));var logger=require(_0x7c60('0x7'))(_0x7c60('0x8'));config[_0x7c60('0x9')]=_[_0x7c60('0xa')](config[_0x7c60('0x9')],{'host':_0x7c60('0xb'),'port':0x18eb});var io=require(_0x7c60('0xc'))(new Redis(config[_0x7c60('0x9')]));function getAdminUser(_0x18580c,_0x1b6e89,_0x1e7a06,_0x382d8b,_0x5e7a42,_0x304e4){return new Promise(function(_0x2674dc,_0x445088){var _0x117304={'method':_0x7c60('0xd'),'uri':_0x382d8b+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x5e7a42+'&'+_0x304e4,'auth':_0x1b6e89,'json':!![]};return rp(_0x117304)[_0x7c60('0xe')](function(_0x3c2901){if(_0x3c2901['result']['length']>0x0){_0x1e7a06[_0x7c60('0xf')]=_0x3c2901[_0x7c60('0x10')][0x0][_0x7c60('0x11')];}logger['info']('['+[_0x18580c[_0x7c60('0x12')]()]+'],\x20getAdminUser\x20crm',_0x1e7a06);_0x2674dc(_0x1e7a06);})[_0x7c60('0x13')](function(_0x81e432){logger['error']('['+[_0x18580c[_0x7c60('0x12')]()]+']',_0x81e432[_0x7c60('0x14')]);_0x445088(_0x81e432[_0x7c60('0x14')]);});});}function getUser(_0x20fd7f,_0x409194,_0x364003,_0x2e02b7,_0x45df25){return function(_0x72190f){logger['info']('['+[_0x20fd7f[_0x7c60('0x12')]()]+_0x7c60('0x15'),_0x72190f);return new Promise(function(_0x1ca428,_0x13963f){if(intUtil[_0x7c60('0x16')](_0x72190f[_0x7c60('0x17')])){var _0x3624fe={'method':'GET','uri':_0x364003+'sys_user?sysparm_query=email%3D'+_0x72190f[_0x7c60('0x17')]+'&'+_0x2e02b7+'&'+_0x45df25,'auth':_0x409194,'json':!![]};logger['info']('['+[_0x20fd7f[_0x7c60('0x12')]()]+_0x7c60('0x18'),_0x3624fe);return rp(_0x3624fe)[_0x7c60('0xe')](function(_0x180175){logger['info']('['+[_0x20fd7f[_0x7c60('0x12')]()]+_0x7c60('0x19'),_0x180175);if(_0x180175[_0x7c60('0x10')][_0x7c60('0x1a')]>0x0&&String(_0x180175[_0x7c60('0x10')][0x0][_0x7c60('0x1b')])===_0x7c60('0x1c')){_0x72190f['userId']=_0x180175[_0x7c60('0x10')][0x0][_0x7c60('0x11')];}else{_0x72190f[_0x7c60('0x1d')]=_0x72190f['adminId'];_0x72190f[_0x7c60('0x17')]=_0x72190f[_0x7c60('0x1e')];}logger[_0x7c60('0x1f')]('['+[_0x20fd7f[_0x7c60('0x12')]()]+'],\x20getUser\x20crm',_0x72190f);_0x1ca428(_0x72190f);})[_0x7c60('0x13')](function(_0x1a88bf){logger[_0x7c60('0x20')]('['+[_0x20fd7f['toUpperCase']()]+']',_0x1a88bf['message']);_0x13963f(_0x1a88bf[_0x7c60('0x14')]);});}else{logger['info']('['+[_0x20fd7f['toUpperCase']()]+_0x7c60('0x21'));_0x72190f[_0x7c60('0x1d')]=_0x72190f[_0x7c60('0xf')];_0x72190f[_0x7c60('0x17')]=_0x72190f[_0x7c60('0x1e')];_0x1ca428(_0x72190f);}});};}function createEndUser(_0x35bd70,_0x524f2e,_0x20ee27,_0x4d6bdd,_0x133725){logger[_0x7c60('0x1f')]('['+[_0x35bd70[_0x7c60('0x12')]()]+_0x7c60('0x22'),_0x20ee27);return new Promise(function(_0x1a731d,_0x1bf415){var _0x9faded={'method':_0x7c60('0x23'),'uri':_0x4d6bdd+'sys_user?'+_0x133725,'body':{'user_name':_0x20ee27[_0x7c60('0x24')],'roles':_0x7c60('0x25'),'first_name':_0x20ee27[_0x7c60('0x24')],'active':'true','date_format':'System','phone':_0x20ee27['endUserNumber']},'auth':_0x524f2e,'json':!![]};return rp(_0x9faded)[_0x7c60('0xe')](function(_0x499022){logger[_0x7c60('0x1f')]('['+[_0x35bd70[_0x7c60('0x12')]()]+'],\x20EndUser\x20schema',_0x499022[_0x7c60('0x10')]);_0x20ee27[_0x7c60('0x26')]=_0x499022[_0x7c60('0x10')][_0x7c60('0x11')];_0x1a731d(_0x20ee27);})[_0x7c60('0x13')](function(_0x8446b9){logger[_0x7c60('0x20')]('['+[_0x35bd70['toUpperCase']()]+']',_0x8446b9[_0x7c60('0x14')]);_0x1bf415(_0x8446b9[_0x7c60('0x14')]);});});}function getEndUser(_0x8e1c74,_0x6bf546,_0x2dc2b7,_0x4da18e,_0x1472c6){return function(_0x29c3df){logger[_0x7c60('0x1f')]('['+[_0x8e1c74[_0x7c60('0x12')]()]+_0x7c60('0x27'),_0x29c3df);return new Promise(function(_0x1c7948,_0x4474ea){var _0xea4af6={'method':_0x7c60('0xd'),'uri':_0x2dc2b7+_0x7c60('0x28')+_0x29c3df[_0x7c60('0x24')]+'&'+_0x4da18e+'&'+_0x1472c6,'auth':_0x6bf546,'json':!![]};return rp(_0xea4af6)[_0x7c60('0xe')](function(_0x337aa7){if(_0x337aa7['result'][_0x7c60('0x1a')]>0x0){_0x29c3df[_0x7c60('0x26')]=_0x337aa7[_0x7c60('0x10')][0x0][_0x7c60('0x11')];logger[_0x7c60('0x1f')]('['+[_0x8e1c74[_0x7c60('0x12')]()]+_0x7c60('0x29'),_0x29c3df);_0x1c7948(_0x29c3df);}else{return createEndUser(_0x8e1c74,_0x6bf546,_0x29c3df,_0x2dc2b7,_0x4da18e)[_0x7c60('0xe')](function(_0xbb4294){logger[_0x7c60('0x1f')]('['+[_0x8e1c74[_0x7c60('0x12')]()]+_0x7c60('0x2a'),_0xbb4294);_0x1c7948(_0xbb4294);});}})[_0x7c60('0x13')](function(_0x560015){logger[_0x7c60('0x20')]('['+[_0x8e1c74['toUpperCase']()]+']',_0x560015[_0x7c60('0x14')]);_0x4474ea(_0x560015['message']);});});};}function getCustomFields(_0x1cf11a,_0x322282){var _0x367dab={};if(_0x1cf11a[_0x7c60('0x1a')]>0x0){_['forEach'](_0x1cf11a,function(_0x2e7baf){if(_[_0x7c60('0x2b')]([_0x7c60('0x2c'),_0x7c60('0x2d')],_0x2e7baf[_0x7c60('0x2e')])&&_0x2e7baf[_0x7c60('0x2f')]&&!_0x2e7baf[_0x7c60('0x30')]){_0x367dab[_0x2e7baf[_0x7c60('0x2f')][_0x7c60('0x31')]()]=_0x2e7baf[_0x7c60('0x32')]['toString']();}else if(_['includes'](['string',_0x7c60('0x2d')],_0x2e7baf['type'])&&_0x2e7baf['idField']&&_0x2e7baf[_0x7c60('0x30')]){_0x367dab[_0x2e7baf[_0x7c60('0x33')][_0x7c60('0x31')]()]=_0x2e7baf[_0x7c60('0x32')][_0x7c60('0x34')]();}else if(_0x2e7baf['type']===_0x7c60('0x35')&&_0x2e7baf[_0x7c60('0x36')]&&_0x2e7baf[_0x7c60('0x33')]&&_0x2e7baf[_0x7c60('0x30')]){_0x367dab[_0x2e7baf['idField'][_0x7c60('0x31')]()]=_0x322282[_0x2e7baf['variableName']][_0x7c60('0x34')]();}else if(_0x2e7baf[_0x7c60('0x2e')]===_0x7c60('0x37')&&_0x2e7baf[_0x7c60('0x38')]&&_0x2e7baf['Variable'][_0x7c60('0x39')]&&_0x2e7baf[_0x7c60('0x33')]&&_0x2e7baf[_0x7c60('0x30')]){_0x367dab[_0x2e7baf[_0x7c60('0x33')]['toLowerCase']()]=_0x322282[_0x2e7baf[_0x7c60('0x38')][_0x7c60('0x39')][_0x7c60('0x31')]()][_0x7c60('0x34')]();}});}return _0x367dab;}function getTicket(_0x3c6935,_0x524a4e,_0x3a9b57,_0x1dbfdd,_0x5a8e8c,_0x18c4e7){return function(_0x22fee9){logger[_0x7c60('0x1f')]('['+[_0x3c6935[_0x7c60('0x12')]()]+']\x20getTicket\x20input\x20crm',_0x22fee9);return new Promise(function(_0x4ea2e2,_0x4a8fa2){var _0x569a4f=_0x3c6935[_0x7c60('0x31')]()===_0x7c60('0x3a')?_0x22fee9[_0x7c60('0x1d')]:_0x22fee9[_0x7c60('0x26')];var _0x1ebb63={'method':_0x7c60('0x23'),'uri':_0x3a9b57+_0x7c60('0x3b')+'?'+_0x18c4e7,'body':Object[_0x7c60('0x3c')]({},{'active':'true','caller_id':_0x569a4f,'assigned_to':_0x22fee9[_0x7c60('0x1d')],'short_description':intUtil[_0x7c60('0x3d')](_0x1dbfdd['Subjects'],_0x5a8e8c,'\x20'),'description':intUtil[_0x7c60('0x3d')](_0x1dbfdd[_0x7c60('0x3e')],_0x5a8e8c,'\x0a')},getCustomFields(_0x1dbfdd[_0x7c60('0x3f')],_0x5a8e8c)),'auth':_0x524a4e,'json':!![]};return rp(_0x1ebb63)[_0x7c60('0xe')](function(_0x58272f){logger[_0x7c60('0x1f')]('['+[_0x3c6935['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x58272f[_0x7c60('0x10')]);_0x22fee9[_0x7c60('0x40')]=_0x58272f[_0x7c60('0x10')][_0x7c60('0x11')];_0x22fee9[_0x7c60('0x41')]=_0x58272f['result'][_0x7c60('0x42')];logger[_0x7c60('0x1f')]('['+[_0x3c6935[_0x7c60('0x12')]()]+']\x20getTicket\x20crm',_0x22fee9);_0x4ea2e2(_0x22fee9);})[_0x7c60('0x13')](function(_0x4af543){logger[_0x7c60('0x20')]('['+[_0x3c6935[_0x7c60('0x12')]()]+']',_0x4af543['message']);_0x4a8fa2(_0x4af543[_0x7c60('0x14')]);});});};}function createRemoteTag(_0x1983d2,_0x24b08a,_0x119309,_0x4bbb81){return new Promise(function(_0x10fac9,_0x185cc8){var _0x5026bf={'method':'POST','uri':_0x119309+_0x7c60('0x43')+'?'+_0x4bbb81,'body':{'short_description':_0x1983d2,'global':!![],'active':!![],'name':_0x1983d2},'auth':_0x24b08a,'json':!![]};return rp(_0x5026bf)[_0x7c60('0xe')](function(_0x23bab8){var _0x41b6be=_0x23bab8[_0x7c60('0x10')][_0x7c60('0x11')];_0x10fac9(_0x41b6be);});});}function getRemoteTag(_0x2389c3,_0x4b5ed3,_0x5e3b90,_0x27610d,_0x2193c3){return new Promise(function(_0xcba415,_0x3e478d){var _0x396049={'method':_0x7c60('0xd'),'uri':_0x5e3b90+_0x7c60('0x43')+_0x7c60('0x44')+_0x2389c3+'&'+_0x27610d,'auth':_0x4b5ed3,'json':!![]};return rp(_0x396049)['then'](function(_0x5e4a0a){if(_0x5e4a0a[_0x7c60('0x10')]['length']>0x0){var _0x4ab57c=_0x5e4a0a[_0x7c60('0x10')][0x0][_0x7c60('0x11')];_0xcba415(_0x4ab57c);}else{return createRemoteTag(_0x2389c3,_0x4b5ed3,_0x5e3b90,_0x27610d)[_0x7c60('0xe')](function(_0x35fb82){_0xcba415(_0x35fb82);});}});});}function assignTagToIncident(_0x2a96dd,_0x479394,_0x107b95,_0x2c7fc6,_0x2f330a){return new Promise(function(_0x1ce5a1,_0x314019){var _0x426932={'method':'POST','uri':_0x107b95+_0x7c60('0x45')+'?'+_0x2f330a,'body':{'label':_0x2a96dd,'table':'incident','id_type':'Incident','table_key':_0x2c7fc6[_0x7c60('0x40')],'title':_0x7c60('0x46')+_0x2c7fc6[_0x7c60('0x41')],'id_display':_0x2c7fc6['ticketNumber']},'auth':_0x479394,'json':!![]};return rp(_0x426932)['then'](function(_0x3ee761){_0x1ce5a1();})[_0x7c60('0x13')](function(){_0x1ce5a1();});});}function manageTags(_0x542f7d,_0x502ffe,_0x29a4dd,_0x1c4334,_0x1ab129,_0x4272d9,_0x19a756){return new Promise(function(_0xbce392,_0x81bf96){var _0xb68c9=[];_0x502ffe[_0x7c60('0x47')](function(_0x566613){_0xb68c9[_0x7c60('0x48')](getRemoteTag(_0x566613,_0x29a4dd,_0x1c4334,_0x4272d9,_0x19a756));});return Promise[_0x7c60('0x49')](_0xb68c9)[_0x7c60('0xe')](function(_0x323282){if(_0x323282['length']){logger[_0x7c60('0x1f')]('['+[_0x542f7d[_0x7c60('0x12')]()]+_0x7c60('0x4a'),_0x323282);var _0x410f72=[];_0x323282[_0x7c60('0x47')](function(_0x3f68c9){_0x410f72[_0x7c60('0x48')](assignTagToIncident(_0x3f68c9,_0x29a4dd,_0x1c4334,_0x1ab129,_0x4272d9));});return Promise[_0x7c60('0x49')](_0x410f72)[_0x7c60('0xe')](function(){_0xbce392();})['catch'](function(){_0xbce392();});}else{_0xbce392();}});});}function getTags(_0x353ac9,_0x188729,_0x50f4ee,_0x376add,_0x11459e,_0x175d35){return function(_0x22d36d){return new Promise(function(_0x3dc85e,_0x2a0210){var _0x39993d=[];var _0x2bea2f=_0x376add['Tags'];if(_0x2bea2f&&_0x2bea2f[_0x7c60('0x1a')]>0x0){_0x39993d=_['map'](_0x2bea2f,_0x7c60('0x39'));}if(_0x39993d[_0x7c60('0x1a')]>0x0){return manageTags(_0x353ac9,_0x39993d,_0x188729,_0x50f4ee,_0x22d36d,_0x11459e,_0x175d35)['then'](function(){_0x3dc85e(_0x22d36d);});}else{_0x3dc85e(_0x22d36d);}});};}function emit(_0x510478,_0x3d7d9c,_0x396c06){var _0x5c5f08=_0x7c60('0x4b')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x7c60('0x4c')+_0x7c60('0x4d');var _0x59180c={'uri':_0x510478+_0x7c60('0x4e')+_0x396c06+_0x5c5f08};io['to'](util[_0x7c60('0x4f')](_0x7c60('0x50'),_0x3d7d9c))[_0x7c60('0x51')](_0x7c60('0x52'),_0x59180c);}exports['cs']=function(_0x30ac75,_0x58cb4a,_0x10a75b,_0x27ee86,_0x1755c6,_0x144e3b,_0xadba6d,_0x445e18){var _0xe7acc2={};var _0x2aaf99={'user':_0x144e3b[_0x7c60('0x53')],'pass':_0x144e3b[_0x7c60('0x54')]};var _0xdbf0bf=_0x7c60('0x55');var _0x58ad55=_0x7c60('0x56');_0x144e3b[_0x7c60('0x57')]=intUtil['stripTrailingSlash'](_0x144e3b[_0x7c60('0x57')]);_0x144e3b[_0x7c60('0x58')]=intUtil[_0x7c60('0x59')](_0x144e3b[_0x7c60('0x58')]);var _0x2d1820=util[_0x7c60('0x4f')](_0x7c60('0x5a'),_0x144e3b[_0x7c60('0x57')]);_0xe7acc2[_0x7c60('0x17')]=!_['isNil'](_0x27ee86)?_0x27ee86[_0x7c60('0x5b')]:null;_0xe7acc2[_0x7c60('0x1e')]=_0x144e3b[_0x7c60('0x5b')];_0xe7acc2[_0x7c60('0x24')]=_0x445e18[_0x7c60('0x31')]()===_0x7c60('0x3a')?_0x58cb4a[_0x7c60('0x5c')]:_0x58cb4a[_0x7c60('0x5d')];_0xe7acc2[_0x7c60('0x5e')]=_0x445e18===_0x7c60('0x5f')||_0x445e18===_0x7c60('0x60')?_0x7c60('0x5f'):_0x7c60('0x3a');var _0x4f34fc=util[_0x7c60('0x4f')](_0x7c60('0x61'),_0x144e3b['serverUrl'],_0x58cb4a[_0x7c60('0x62')],md5(_0x58cb4a[_0x7c60('0x62')]));if(_0x1755c6&&_0x1755c6[_0x7c60('0x63')]){logger[_0x7c60('0x1f')]('[QUEUE]',_0x7c60('0x64'));_0x58cb4a[_0x7c60('0x65')]=_0x4f34fc;}else if(_0xadba6d&&_0xadba6d[_0x7c60('0x66')]&&_0xadba6d[_0x7c60('0x66')]!==_0x7c60('0x67')){logger[_0x7c60('0x1f')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x58cb4a[_0x7c60('0x65')]=_0x4f34fc;}else{_0x58cb4a[_0x7c60('0x65')]='';}return getAdminUser(_0x445e18,_0x2aaf99,_0xe7acc2,_0x2d1820,_0x58ad55,_0xdbf0bf)[_0x7c60('0xe')](getUser(_0x445e18,_0x2aaf99,_0x2d1820,_0x58ad55,_0xdbf0bf))[_0x7c60('0xe')](getEndUser(_0x445e18,_0x2aaf99,_0x2d1820,_0x58ad55,_0xdbf0bf))['then'](getTicket(_0x445e18,_0x2aaf99,_0x2d1820,_0x10a75b,_0x58cb4a,_0x58ad55))[_0x7c60('0xe')](function(_0x40f7cc){logger[_0x7c60('0x1f')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x40f7cc[_0x7c60('0x40')]));logger[_0x7c60('0x1f')](util[_0x7c60('0x4f')](_0x7c60('0x68'),_0x445e18));if(_0x445e18!==_0x7c60('0x60')){logger[_0x7c60('0x1f')]('['+[_0x445e18['toUpperCase']()]+']',_0x7c60('0x69'));emit(_0x144e3b[_0x7c60('0x57')],_0x27ee86[_0x7c60('0x39')],_0x40f7cc['ticketId']);}})[_0x7c60('0x13')](function(_0x504810){logger[_0x7c60('0x20')]('['+[_0x445e18[_0x7c60('0x12')]()]+_0x7c60('0x6a'),util[_0x7c60('0x6b')](_0x504810,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x748d=['name','outbound','assign','getString','Subjects','Descriptions','Fields','ticketNumber','label','?sysparm_query=name%3D','label_entry','incident','Incident','ticketId','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20Error\x20running\x20ServiceNow\x20integration','bluebird','request-promise','util','md5','ioredis','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','then','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','customField','nameField','content','idField','toLowerCase','variableName','toString','customVariable','Variable'];(function(_0x1ddd51,_0x1d68f9){var _0x3c5dc7=function(_0x29f842){while(--_0x29f842){_0x1ddd51['push'](_0x1ddd51['shift']());}};_0x3c5dc7(++_0x1d68f9);}(_0x748d,0x95));var _0xd748=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x748d[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var Promise=require(_0xd748('0x0'));var rp=require(_0xd748('0x1'));var util=require(_0xd748('0x2'));var md5=require(_0xd748('0x3'));var Redis=require(_0xd748('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('servicenow');config[_0xd748('0x5')]=_['defaults'](config['redis'],{'host':_0xd748('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x59bca7,_0x4835fe,_0x221ae3,_0x269e52,_0x4f0bd2,_0xac35cf){return new Promise(function(_0x2c3811,_0x370853){var _0x1408a9={'method':_0xd748('0x7'),'uri':_0x269e52+_0xd748('0x8')+'&'+_0x4f0bd2+'&'+_0xac35cf,'auth':_0x4835fe,'json':!![]};return rp(_0x1408a9)['then'](function(_0x1b7d3a){if(_0x1b7d3a['result'][_0xd748('0x9')]>0x0){_0x221ae3[_0xd748('0xa')]=_0x1b7d3a[_0xd748('0xb')][0x0][_0xd748('0xc')];}logger[_0xd748('0xd')]('['+[_0x59bca7[_0xd748('0xe')]()]+_0xd748('0xf'),_0x221ae3);_0x2c3811(_0x221ae3);})[_0xd748('0x10')](function(_0x4f3d37){logger[_0xd748('0x11')]('['+[_0x59bca7[_0xd748('0xe')]()]+']',_0x4f3d37[_0xd748('0x12')]);_0x370853(_0x4f3d37[_0xd748('0x12')]);});});}function getUser(_0x1d5962,_0x2cec9e,_0x3013a7,_0x5f56ef,_0x3b752b){return function(_0x55d19d){logger[_0xd748('0xd')]('['+[_0x1d5962[_0xd748('0xe')]()]+_0xd748('0x13'),_0x55d19d);return new Promise(function(_0x47e5b9,_0x5d301e){if(intUtil[_0xd748('0x14')](_0x55d19d[_0xd748('0x15')])){var _0x2ef370={'method':'GET','uri':_0x3013a7+_0xd748('0x16')+_0x55d19d[_0xd748('0x15')]+'&'+_0x5f56ef+'&'+_0x3b752b,'auth':_0x2cec9e,'json':!![]};logger[_0xd748('0xd')]('['+[_0x1d5962[_0xd748('0xe')]()]+'],\x20getUser\x20rp\x20obj',_0x2ef370);return rp(_0x2ef370)[_0xd748('0x17')](function(_0x1c8c45){logger[_0xd748('0xd')]('['+[_0x1d5962[_0xd748('0xe')]()]+_0xd748('0x18'),_0x1c8c45);if(_0x1c8c45[_0xd748('0xb')]['length']>0x0&&String(_0x1c8c45[_0xd748('0xb')][0x0][_0xd748('0x19')])===_0xd748('0x1a')){_0x55d19d[_0xd748('0x1b')]=_0x1c8c45[_0xd748('0xb')][0x0][_0xd748('0xc')];}else{_0x55d19d[_0xd748('0x1b')]=_0x55d19d[_0xd748('0xa')];_0x55d19d[_0xd748('0x15')]=_0x55d19d[_0xd748('0x1c')];}logger[_0xd748('0xd')]('['+[_0x1d5962[_0xd748('0xe')]()]+_0xd748('0x1d'),_0x55d19d);_0x47e5b9(_0x55d19d);})['catch'](function(_0x345fe8){logger[_0xd748('0x11')]('['+[_0x1d5962[_0xd748('0xe')]()]+']',_0x345fe8[_0xd748('0x12')]);_0x5d301e(_0x345fe8['message']);});}else{logger[_0xd748('0xd')]('['+[_0x1d5962[_0xd748('0xe')]()]+_0xd748('0x1e'));_0x55d19d[_0xd748('0x1b')]=_0x55d19d[_0xd748('0xa')];_0x55d19d['userEmail']=_0x55d19d[_0xd748('0x1c')];_0x47e5b9(_0x55d19d);}});};}function createEndUser(_0x4f900d,_0x1c6afa,_0x5c36ad,_0x5810d8,_0xbddba5){logger[_0xd748('0xd')]('['+[_0x4f900d[_0xd748('0xe')]()]+_0xd748('0x1f'),_0x5c36ad);return new Promise(function(_0x14c902,_0x4c8c3b){var _0x4d07a5={'method':_0xd748('0x20'),'uri':_0x5810d8+'sys_user?'+_0xbddba5,'body':{'user_name':_0x5c36ad[_0xd748('0x21')],'roles':'user','first_name':_0x5c36ad[_0xd748('0x21')],'active':_0xd748('0x1a'),'date_format':_0xd748('0x22'),'phone':_0x5c36ad[_0xd748('0x21')]},'auth':_0x1c6afa,'json':!![]};return rp(_0x4d07a5)[_0xd748('0x17')](function(_0x199336){logger['info']('['+[_0x4f900d[_0xd748('0xe')]()]+'],\x20EndUser\x20schema',_0x199336[_0xd748('0xb')]);_0x5c36ad[_0xd748('0x23')]=_0x199336['result'][_0xd748('0xc')];_0x14c902(_0x5c36ad);})[_0xd748('0x10')](function(_0x6574ff){logger[_0xd748('0x11')]('['+[_0x4f900d['toUpperCase']()]+']',_0x6574ff['message']);_0x4c8c3b(_0x6574ff[_0xd748('0x12')]);});});}function getEndUser(_0x146cd0,_0x21429c,_0x44db79,_0x35af51,_0x3fad38){return function(_0x57ef30){logger['info']('['+[_0x146cd0['toUpperCase']()]+_0xd748('0x24'),_0x57ef30);return new Promise(function(_0x5839f7,_0xef5a8c){var _0x307309={'method':_0xd748('0x7'),'uri':_0x44db79+_0xd748('0x25')+_0x57ef30[_0xd748('0x21')]+'&'+_0x35af51+'&'+_0x3fad38,'auth':_0x21429c,'json':!![]};return rp(_0x307309)[_0xd748('0x17')](function(_0x48db55){if(_0x48db55['result'][_0xd748('0x9')]>0x0){_0x57ef30[_0xd748('0x23')]=_0x48db55[_0xd748('0xb')][0x0][_0xd748('0xc')];logger[_0xd748('0xd')]('['+[_0x146cd0[_0xd748('0xe')]()]+_0xd748('0x26'),_0x57ef30);_0x5839f7(_0x57ef30);}else{return createEndUser(_0x146cd0,_0x21429c,_0x57ef30,_0x44db79,_0x35af51)[_0xd748('0x17')](function(_0x193218){logger[_0xd748('0xd')]('['+[_0x146cd0['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x193218);_0x5839f7(_0x193218);});}})[_0xd748('0x10')](function(_0xbe5f87){logger[_0xd748('0x11')]('['+[_0x146cd0['toUpperCase']()]+']',_0xbe5f87[_0xd748('0x12')]);_0xef5a8c(_0xbe5f87[_0xd748('0x12')]);});});};}function getCustomFields(_0x28b306,_0x237492){var _0x1ab932={};if(_0x28b306[_0xd748('0x9')]>0x0){_[_0xd748('0x27')](_0x28b306,function(_0x18b9ac){if(_[_0xd748('0x28')]([_0xd748('0x29'),_0xd748('0x2a')],_0x18b9ac[_0xd748('0x2b')])&&_0x18b9ac['nameField']&&!_0x18b9ac[_0xd748('0x2c')]){_0x1ab932[_0x18b9ac[_0xd748('0x2d')]['toLowerCase']()]=_0x18b9ac[_0xd748('0x2e')]['toString']();}else if(_['includes']([_0xd748('0x29'),_0xd748('0x2a')],_0x18b9ac[_0xd748('0x2b')])&&_0x18b9ac[_0xd748('0x2f')]&&_0x18b9ac[_0xd748('0x2c')]){_0x1ab932[_0x18b9ac[_0xd748('0x2f')][_0xd748('0x30')]()]=_0x18b9ac['content']['toString']();}else if(_0x18b9ac[_0xd748('0x2b')]==='variable'&&_0x18b9ac[_0xd748('0x31')]&&_0x18b9ac[_0xd748('0x2f')]&&_0x18b9ac[_0xd748('0x2c')]){_0x1ab932[_0x18b9ac[_0xd748('0x2f')][_0xd748('0x30')]()]=_0x237492[_0x18b9ac[_0xd748('0x31')]][_0xd748('0x32')]();}else if(_0x18b9ac[_0xd748('0x2b')]===_0xd748('0x33')&&_0x18b9ac['Variable']&&_0x18b9ac[_0xd748('0x34')][_0xd748('0x35')]&&_0x18b9ac[_0xd748('0x2f')]&&_0x18b9ac['customField']){_0x1ab932[_0x18b9ac['idField'][_0xd748('0x30')]()]=_0x237492[_0x18b9ac[_0xd748('0x34')][_0xd748('0x35')][_0xd748('0x30')]()][_0xd748('0x32')]();}});}return _0x1ab932;}function getTicket(_0x5ee1e2,_0x3317f6,_0x18a3c8,_0x5e99be,_0x3f6553,_0x431822){return function(_0x40599e){logger[_0xd748('0xd')]('['+[_0x5ee1e2[_0xd748('0xe')]()]+']\x20getTicket\x20input\x20crm',_0x40599e);return new Promise(function(_0x5cdcfb,_0x4f1982){var _0x1de525=_0x5ee1e2['toLowerCase']()===_0xd748('0x36')?_0x40599e[_0xd748('0x1b')]:_0x40599e[_0xd748('0x23')];var _0x531013={'method':_0xd748('0x20'),'uri':_0x18a3c8+'incident'+'?'+_0x431822,'body':Object[_0xd748('0x37')]({},{'active':_0xd748('0x1a'),'caller_id':_0x1de525,'assigned_to':_0x40599e['userId'],'short_description':intUtil[_0xd748('0x38')](_0x5e99be[_0xd748('0x39')],_0x3f6553,'\x20'),'description':intUtil[_0xd748('0x38')](_0x5e99be[_0xd748('0x3a')],_0x3f6553,'\x0a')},getCustomFields(_0x5e99be[_0xd748('0x3b')],_0x3f6553)),'auth':_0x3317f6,'json':!![]};return rp(_0x531013)[_0xd748('0x17')](function(_0x5c4da2){logger['info']('['+[_0x5ee1e2[_0xd748('0xe')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x5c4da2[_0xd748('0xb')]);_0x40599e['ticketId']=_0x5c4da2[_0xd748('0xb')][_0xd748('0xc')];_0x40599e[_0xd748('0x3c')]=_0x5c4da2[_0xd748('0xb')]['number'];logger[_0xd748('0xd')]('['+[_0x5ee1e2['toUpperCase']()]+']\x20getTicket\x20crm',_0x40599e);_0x5cdcfb(_0x40599e);})[_0xd748('0x10')](function(_0x47f87c){logger[_0xd748('0x11')]('['+[_0x5ee1e2[_0xd748('0xe')]()]+']',_0x47f87c[_0xd748('0x12')]);_0x4f1982(_0x47f87c['message']);});});};}function createRemoteTag(_0x52254a,_0x1a0796,_0x544336,_0x43af5e){return new Promise(function(_0x5863da,_0x12d384){var _0x18317c={'method':_0xd748('0x20'),'uri':_0x544336+_0xd748('0x3d')+'?'+_0x43af5e,'body':{'short_description':_0x52254a,'global':!![],'active':!![],'name':_0x52254a},'auth':_0x1a0796,'json':!![]};return rp(_0x18317c)['then'](function(_0x26a7e9){var _0x35fa71=_0x26a7e9[_0xd748('0xb')]['sys_id'];_0x5863da(_0x35fa71);});});}function getRemoteTag(_0x44dc94,_0xc18c5c,_0x40d3c3,_0x233fbc,_0x45ce45){return new Promise(function(_0x3f5613,_0x4bf17d){var _0x26218e={'method':_0xd748('0x7'),'uri':_0x40d3c3+_0xd748('0x3d')+_0xd748('0x3e')+_0x44dc94+'&'+_0x233fbc,'auth':_0xc18c5c,'json':!![]};return rp(_0x26218e)[_0xd748('0x17')](function(_0x492066){if(_0x492066['result'][_0xd748('0x9')]>0x0){var _0x4f6b6d=_0x492066['result'][0x0][_0xd748('0xc')];_0x3f5613(_0x4f6b6d);}else{return createRemoteTag(_0x44dc94,_0xc18c5c,_0x40d3c3,_0x233fbc)[_0xd748('0x17')](function(_0x53968f){_0x3f5613(_0x53968f);});}});});}function assignTagToIncident(_0x2aac96,_0xae8d56,_0x2738ed,_0x5511ee,_0x52fe3){return new Promise(function(_0x4cfb7c,_0x50af1d){var _0x51810b={'method':_0xd748('0x20'),'uri':_0x2738ed+_0xd748('0x3f')+'?'+_0x52fe3,'body':{'label':_0x2aac96,'table':_0xd748('0x40'),'id_type':_0xd748('0x41'),'table_key':_0x5511ee[_0xd748('0x42')],'title':_0xd748('0x43')+_0x5511ee[_0xd748('0x3c')],'id_display':_0x5511ee[_0xd748('0x3c')]},'auth':_0xae8d56,'json':!![]};return rp(_0x51810b)[_0xd748('0x17')](function(_0x3c6c28){_0x4cfb7c();})[_0xd748('0x10')](function(){_0x4cfb7c();});});}function manageTags(_0x1fa827,_0x154933,_0xe4a164,_0x597aa0,_0x280ed1,_0x83bc26,_0x174bc1){return new Promise(function(_0x40a988,_0x368888){var _0x4a1078=[];_0x154933[_0xd748('0x27')](function(_0x153771){_0x4a1078[_0xd748('0x44')](getRemoteTag(_0x153771,_0xe4a164,_0x597aa0,_0x83bc26,_0x174bc1));});return Promise[_0xd748('0x45')](_0x4a1078)[_0xd748('0x17')](function(_0x3176e9){if(_0x3176e9[_0xd748('0x9')]){logger[_0xd748('0xd')]('['+[_0x1fa827[_0xd748('0xe')]()]+_0xd748('0x46'),_0x3176e9);var _0x4d2403=[];_0x3176e9['forEach'](function(_0x4ae41c){_0x4d2403[_0xd748('0x44')](assignTagToIncident(_0x4ae41c,_0xe4a164,_0x597aa0,_0x280ed1,_0x83bc26));});return Promise[_0xd748('0x45')](_0x4d2403)[_0xd748('0x17')](function(){_0x40a988();})[_0xd748('0x10')](function(){_0x40a988();});}else{_0x40a988();}});});}function getTags(_0x298f01,_0x7a5c2e,_0x36e3e0,_0x296f2c,_0x2e701b,_0x303fe9){return function(_0x4bf34b){return new Promise(function(_0x5072d2,_0x1e6870){var _0x8d461f=[];var _0xc43dcb=_0x296f2c[_0xd748('0x47')];if(_0xc43dcb&&_0xc43dcb[_0xd748('0x9')]>0x0){_0x8d461f=_[_0xd748('0x48')](_0xc43dcb,'name');}if(_0x8d461f[_0xd748('0x9')]>0x0){return manageTags(_0x298f01,_0x8d461f,_0x7a5c2e,_0x36e3e0,_0x4bf34b,_0x2e701b,_0x303fe9)[_0xd748('0x17')](function(){_0x5072d2(_0x4bf34b);});}else{_0x5072d2(_0x4bf34b);}});};}function emit(_0x2e38f0,_0x2728d4,_0x37394d){var _0x16530c=_0xd748('0x49')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xd748('0x4a');var _0x12083e={'uri':_0x2e38f0+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x37394d+_0x16530c};io['to'](util[_0xd748('0x4b')](_0xd748('0x4c'),_0x2728d4))['emit'](_0xd748('0x4d'),_0x12083e);}exports['cs']=function(_0x453e3d,_0x7f0037,_0x220e09,_0x43b5ca,_0x2f203a,_0x3f34df,_0x362ad7,_0x299efd){var _0x5bf02b={};var _0xd9777={'user':_0x3f34df[_0xd748('0x4e')],'pass':_0x3f34df[_0xd748('0x4f')]};var _0x49742d=_0xd748('0x50');var _0xf04814=_0xd748('0x51');_0x3f34df['remoteUri']=intUtil[_0xd748('0x52')](_0x3f34df[_0xd748('0x53')]);_0x3f34df[_0xd748('0x54')]=intUtil['stripTrailingSlash'](_0x3f34df[_0xd748('0x54')]);var _0x125700=util['format'](_0xd748('0x55'),_0x3f34df['remoteUri']);_0x5bf02b['userEmail']=!_[_0xd748('0x56')](_0x43b5ca)?_0x43b5ca[_0xd748('0x57')]:null;_0x5bf02b[_0xd748('0x1c')]=_0x3f34df['email'];_0x5bf02b['endUserNumber']=_0x299efd[_0xd748('0x30')]()===_0xd748('0x36')?_0x7f0037[_0xd748('0x58')]:_0x7f0037[_0xd748('0x59')];_0x5bf02b[_0xd748('0x5a')]=_0x299efd===_0xd748('0x5b')||_0x299efd===_0xd748('0x5c')?_0xd748('0x5b'):'outbound';var _0xf403f6=util['format'](_0xd748('0x5d'),_0x3f34df['serverUrl'],_0x7f0037['uniqueid'],md5(_0x7f0037['uniqueid']));if(_0x2f203a&&_0x2f203a[_0xd748('0x5e')]){logger[_0xd748('0xd')](_0xd748('0x5f'),'Recording\x20is\x20enabled!');_0x7f0037[_0xd748('0x60')]=_0xf403f6;}else if(_0x362ad7&&_0x362ad7[_0xd748('0x61')]&&_0x362ad7[_0xd748('0x61')]!==_0xd748('0x62')){logger[_0xd748('0xd')](_0xd748('0x63'),'Recording\x20is\x20enabled!');_0x7f0037['recordingURL']=_0xf403f6;}else{_0x7f0037[_0xd748('0x60')]='';}return getAdminUser(_0x299efd,_0xd9777,_0x5bf02b,_0x125700,_0xf04814,_0x49742d)['then'](getUser(_0x299efd,_0xd9777,_0x125700,_0xf04814,_0x49742d))[_0xd748('0x17')](getEndUser(_0x299efd,_0xd9777,_0x125700,_0xf04814,_0x49742d))[_0xd748('0x17')](getTicket(_0x299efd,_0xd9777,_0x125700,_0x220e09,_0x7f0037,_0xf04814))['then'](function(_0x4bfbe9){logger[_0xd748('0xd')](util[_0xd748('0x4b')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4bfbe9[_0xd748('0x42')]));logger['info'](util['format']('call\x20direction:\x20%s',_0x299efd));if(_0x299efd!==_0xd748('0x5c')){logger[_0xd748('0xd')]('['+[_0x299efd['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3f34df[_0xd748('0x53')],_0x43b5ca[_0xd748('0x35')],_0x4bfbe9[_0xd748('0x42')]);}})['catch'](function(_0x481c7e){logger[_0xd748('0x11')]('['+[_0x299efd[_0xd748('0xe')]()]+_0xd748('0x64'),util['inspect'](_0x481c7e,{'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 a3ac9fd..867d2f7 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 _0xf549=['../../../../config/logger','sugarcrm','redis','defaults','localhost','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','date_start','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','forEach','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','string','nameField','toLowerCase','type','customField','content','variable','custom_fields','Variable','POST','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','trigger:browser:url','catch','error','unmanaged','toUpperCase','request-promise','bluebird','md5','ioredis'];(function(_0x31e3e4,_0x5c795a){var _0x4ee39e=function(_0x21ee01){while(--_0x21ee01){_0x31e3e4['push'](_0x31e3e4['shift']());}};_0x4ee39e(++_0x5c795a);}(_0xf549,0x6d));var _0x9f54=function(_0x2f070e,_0x746f67){_0x2f070e=_0x2f070e-0x0;var _0x4c2618=_0xf549[_0x2f070e];return _0x4c2618;};'use strict';var _=require('lodash');var rp=require(_0x9f54('0x0'));var BPromise=require(_0x9f54('0x1'));var md5=require(_0x9f54('0x2'));var util=require('util');var Redis=require(_0x9f54('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x9f54('0x4'))(_0x9f54('0x5'));config[_0x9f54('0x6')]=_[_0x9f54('0x7')](config['redis'],{'host':_0x9f54('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x5d836d,_0x314131,_0x5c9931){io['to'](_0x5d836d)[_0x9f54('0x9')](_0x314131,_0x5c9931);}function getTicket(_0x17cb1c,_0x43b1cc,_0x4d7f93,_0x24bdb7,_0x1f18e3,_0x222236,_0x1b8bec,_0x21458e){logger[_0x9f54('0xa')](_0x9f54('0xb'));var _0x2382d3=new Date();var _0x516f76=[{'name':_0x9f54('0xc'),'value':intUtil['getString'](_0x24bdb7[_0x9f54('0xd')],_0x1f18e3,'\x20')},{'name':_0x9f54('0xe'),'value':_0x43b1cc['id']},{'name':_0x9f54('0xf'),'value':_0x43b1cc['id']},{'name':_0x9f54('0x10'),'value':intUtil[_0x9f54('0x11')](_0x24bdb7['Descriptions'],_0x1f18e3,'\x0a')},{'name':_0x9f54('0x12'),'value':_0x2382d3['toISOString']()[_0x9f54('0x13')](0x0,0x13)[_0x9f54('0x14')]('T','\x20')},{'name':_0x9f54('0x15'),'value':'0'},{'name':_0x9f54('0x16'),'value':'15'},{'name':_0x9f54('0x17'),'value':_0x4d7f93['id']},{'name':'parent_type','value':_0x9f54('0x18')},{'name':_0x9f54('0x19'),'value':_0x4d7f93[_0x9f54('0xc')]},{'name':_0x9f54('0x1a'),'value':_0x21458e}];if(_0x222236[_0x9f54('0x1b')]){_[_0x9f54('0x1c')](_0x222236,function(_0x36c9c9){if(_0x1f18e3[_0x36c9c9[_0x9f54('0x1d')]]){_0x516f76[_0x9f54('0x1e')]({'name':_0x36c9c9[_0x9f54('0x1f')],'value':_0x1f18e3[_0x36c9c9[_0x9f54('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x9f54('0x20'),'rest_data':JSON[_0x9f54('0x21')]({'session':_0x1b8bec['id'],'module_name':_0x9f54('0x22'),'name_value_list':_0x516f76})}});}function getAuth(_0x3657e8){return util[_0x9f54('0x23')](_0x9f54('0x24'),new Buffer(_0x3657e8['apiKey']+':X')[_0x9f54('0x25')](_0x9f54('0x26')));}function getServerInfo(_0x533d3c){return request({'form':{'method':_0x9f54('0x27'),'input_type':_0x9f54('0x20'),'response_type':_0x9f54('0x20'),'rest_data':JSON[_0x9f54('0x21')]({'session':_0x533d3c['id']})}});}function getUser(_0x1ba03c,_0xf9dbd6,_0x3f323d){if(!_[_0x9f54('0x28')](_0xf9dbd6)){logger[_0x9f54('0xa')](_0x9f54('0x29'),_0xf9dbd6);return request({'form':{'method':_0x9f54('0x2a'),'input_type':_0x9f54('0x20'),'response_type':_0x9f54('0x20'),'rest_data':JSON[_0x9f54('0x21')]({'session':_0x3f323d['id'],'module_name':_0x9f54('0x2b'),'query':util[_0x9f54('0x23')](_0x9f54('0x2c'),_0xf9dbd6),'order_by':'','offset':'0','select_fields':['id',_0x9f54('0xc'),_0x9f54('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9f54('0x2e')](function(_0x49f8b1){if(_0x49f8b1[_0x9f54('0x2f')][_0x9f54('0x1b')]){var _0xc1e6d2=_[_0x9f54('0x30')](_0x49f8b1[_0x9f54('0x2f')],function(_0x502f8d){return _0x502f8d[_0x9f54('0x31')]['user_name'][_0x9f54('0x32')]===_0xf9dbd6;});if(_0xc1e6d2){logger[_0x9f54('0xa')]('Agent\x20found!');return BPromise[_0x9f54('0x33')]({'id':_0xc1e6d2[_0x9f54('0x31')]['id']['value'],'name':_0xc1e6d2['name_value_list']['name']['value']});}}logger[_0x9f54('0xa')](_0x9f54('0x34'));return BPromise['resolve']({'id':_0x3f323d[_0x9f54('0x31')]['user_id']['value'],'name':_0x3f323d['name_value_list'][_0x9f54('0x2d')]['value']});});}else{logger[_0x9f54('0xa')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x3f323d[_0x9f54('0x31')][_0x9f54('0x35')][_0x9f54('0x32')],'name':_0x3f323d['name_value_list'][_0x9f54('0x2d')][_0x9f54('0x32')]});}}function getEndUser(_0xa4a4b5,_0x1f6826,_0x6a0fa,_0x2d4bee){logger[_0x9f54('0xa')](_0x9f54('0x36'),_0x6a0fa);return request({'form':{'method':_0x9f54('0x2a'),'input_type':_0x9f54('0x20'),'response_type':'JSON','rest_data':JSON[_0x9f54('0x21')]({'session':_0x2d4bee['id'],'module_name':_0x9f54('0x18'),'query':util[_0x9f54('0x23')](_0x9f54('0x37'),_0x6a0fa),'order_by':'','offset':'0','select_fields':['id','name',_0x9f54('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9f54('0x2e')](function(_0x529e8f){if(_0x529e8f[_0x9f54('0x2f')][_0x9f54('0x1b')]){var _0x3073cc=_['find'](_0x529e8f[_0x9f54('0x2f')],function(_0x2950b9){return _0x2950b9['name_value_list']['phone_home'][_0x9f54('0x32')]===_0x6a0fa;});if(_0x3073cc){logger[_0x9f54('0xa')]('Enduser\x20found!');return BPromise[_0x9f54('0x33')]({'id':_0x3073cc['name_value_list']['id'][_0x9f54('0x32')],'name':_0x3073cc['name_value_list'][_0x9f54('0xc')][_0x9f54('0x32')],'phone':_0x3073cc[_0x9f54('0x31')][_0x9f54('0x38')][_0x9f54('0x32')]});}}else{logger[_0x9f54('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9f54('0x21')]({'session':_0x2d4bee['id'],'module_name':_0x9f54('0x18'),'name_value_list':[{'name':_0x9f54('0x39'),'value':_0x1f6826!==_0x9f54('0x3a')?_0x1f6826:util[_0x9f54('0x23')](_0x9f54('0x3b'),_0x6a0fa)},{'name':_0x9f54('0x38'),'value':_0x6a0fa}]})}})[_0x9f54('0x2e')](function(_0x5843af){logger[_0x9f54('0xa')](_0x9f54('0x3c'));return BPromise[_0x9f54('0x33')]({'id':_0x5843af['id'],'name':_0x5843af[_0x9f54('0x2f')][_0x9f54('0x39')][_0x9f54('0x32')],'phone':_0x5843af[_0x9f54('0x2f')][_0x9f54('0x38')][_0x9f54('0x32')]});});}});}function request(_0x3140be){logger['debug'](_0x9f54('0x3d'),JSON[_0x9f54('0x21')](_0x3140be));return rp(_[_0x9f54('0x3e')](def,_0x3140be));}function getTags(_0x59cadc,_0x38a9c2){var _0x497779=[];if(_0x59cadc&&_0x59cadc['length']>0x0){_0x497779=_[_0x9f54('0x3f')](_0x59cadc,_0x38a9c2);}return _0x497779;}function getCustomFields(_0x5c4c4c,_0x382684){var _0x3097a3=[];var _0x371b08={'custom_fields':[]};if(_0x5c4c4c['length']>0x0){_[_0x9f54('0x1c')](_0x5c4c4c,function(_0x59ade8){if(_0x59ade8['type']===_0x9f54('0x40')&&_0x59ade8[_0x9f54('0x41')]&&!_0x59ade8['customField']){_0x371b08[_0x59ade8[_0x9f54('0x41')][_0x9f54('0x42')]()]=_0x59ade8['content']['toString']();}else if(_0x59ade8[_0x9f54('0x43')]==='string'&&_0x59ade8[_0x9f54('0x1f')]&&_0x59ade8[_0x9f54('0x44')]){_0x371b08['custom_fields'][_0x9f54('0x1e')]({'id':_0x59ade8[_0x9f54('0x1f')],'value':_0x59ade8[_0x9f54('0x45')][_0x9f54('0x25')]()});}else if(_0x59ade8[_0x9f54('0x43')]===_0x9f54('0x46')&&_0x59ade8[_0x9f54('0x1d')]&&_0x59ade8[_0x9f54('0x1f')]&&_0x59ade8[_0x9f54('0x44')]){_0x382684[_0x59ade8['variableName']]&&_0x371b08[_0x9f54('0x47')][_0x9f54('0x1e')]({'id':_0x59ade8[_0x9f54('0x1f')],'value':_0x382684[_0x59ade8[_0x9f54('0x1d')]][_0x9f54('0x25')]()});}else if(_0x59ade8[_0x9f54('0x43')]==='customVariable'&&_0x59ade8[_0x9f54('0x48')]&&_0x59ade8[_0x9f54('0x48')][_0x9f54('0xc')]&&_0x59ade8[_0x9f54('0x1f')]&&_0x59ade8[_0x9f54('0x44')]){_0x382684[_0x59ade8[_0x9f54('0x48')]['name'][_0x9f54('0x42')]()]&&_0x371b08[_0x9f54('0x47')][_0x9f54('0x1e')]({'id':_0x59ade8['idField'],'value':_0x382684[_0x59ade8[_0x9f54('0x48')][_0x9f54('0xc')][_0x9f54('0x42')]()][_0x9f54('0x25')]()});}});}return _0x371b08;}function getConnection(_0x3f9c09){return request({'method':_0x9f54('0x49'),'form':{'method':_0x9f54('0x4a'),'input_type':_0x9f54('0x20'),'response_type':_0x9f54('0x20'),'rest_data':JSON[_0x9f54('0x21')]({'user_auth':{'user_name':_0x3f9c09[_0x9f54('0x4b')],'password':_0x3f9c09['password'],'encryption':_0x9f54('0x4c')},'application':_0x9f54('0x4d')})}})[_0x9f54('0x2e')](function(_0x302bd7){var _0x3f11b9=_0x302bd7;if(_0x3f11b9['id']){def[_0x9f54('0x4e')]=_0x3f11b9['id'];return BPromise[_0x9f54('0x33')](_0x3f11b9);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x3f9c09['id']));}});}function setRelationship(_0x224f7a,_0x1ce141,_0x27943d,_0x14908b){return request({'form':{'method':'set_relationship','input_type':_0x9f54('0x20'),'response_type':_0x9f54('0x20'),'rest_data':JSON[_0x9f54('0x21')]({'session':_0x224f7a['id'],'module_name':_0x9f54('0x22'),'module_id':_0x27943d['id'],'link_field_name':_0x14908b,'related_ids':[_0x1ce141['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9f54('0x4f')]=function(_0x43b855,_0x4eb9cb,_0x18de55,_0xced811,_0x423f84,_0x52e5ca){var _0x50b494,_0x46514e,_0x49269a,_0x2bbad2;_0x52e5ca[_0x9f54('0x50')]=intUtil[_0x9f54('0x51')](_0x52e5ca['remoteUri']);_0x52e5ca[_0x9f54('0x52')]=intUtil['stripTrailingSlash'](_0x52e5ca['serverUrl']);def[_0x9f54('0x53')]=util[_0x9f54('0x23')](_0x9f54('0x54'),_0x52e5ca[_0x9f54('0x50')]);if(_0x423f84&&_0x423f84[_0x9f54('0x55')]){logger[_0x9f54('0xa')](_0x9f54('0x56'),'Recording\x20is\x20enabled!');_0x4eb9cb['recordingURL']=util[_0x9f54('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x52e5ca[_0x9f54('0x52')],_0x4eb9cb[_0x9f54('0x57')],md5(_0x4eb9cb[_0x9f54('0x57')]));}else{_0x4eb9cb['recordingURL']='';}return getConnection(_0x52e5ca)[_0x9f54('0x2e')](function(_0x5edca4){_0x2bbad2=_0x5edca4;return getUser(_0x52e5ca,_0xced811[_0x9f54('0xc')],_0x2bbad2);})[_0x9f54('0x2e')](function(_0x44facf){_0x50b494=_0x44facf;logger[_0x9f54('0xa')](_0x9f54('0x58'),_0x50b494['id']);return getEndUser(_0x52e5ca,_0x4eb9cb[_0x9f54('0x59')],_0x4eb9cb[_0x9f54('0x5a')],_0x2bbad2);})[_0x9f54('0x2e')](function(_0x17f975){_0x46514e=_0x17f975;logger[_0x9f54('0xa')]('The\x20Enduser\x20ID\x20is:',_0x46514e['id']);return getTicket(_0x52e5ca,_0x50b494,_0x46514e,_0x18de55,_0x4eb9cb,_0x18de55[_0x9f54('0x5b')],_0x2bbad2,_0x9f54('0x5c'));})[_0x9f54('0x2e')](function(_0x194243){_0x49269a=_0x194243;logger[_0x9f54('0xa')](_0x9f54('0x5d'));logger[_0x9f54('0xa')](_0x9f54('0x5e'),_0x49269a['id']);return setRelationship(_0x2bbad2,_0x50b494,_0x49269a,_0x9f54('0x5f'));})[_0x9f54('0x2e')](function(){return setRelationship(_0x2bbad2,_0x46514e,_0x49269a,_0x9f54('0x60'));})[_0x9f54('0x2e')](function(){return getServerInfo(_0x2bbad2);})[_0x9f54('0x2e')](function(_0x7e0c0c){var _0xaec339=parseInt(_0x7e0c0c['version']['charAt'](0x0));var _0xdbe9ed=util[_0x9f54('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x52e5ca[_0x9f54('0x50')],_0x49269a['id']);if(_0xaec339>0x6){_0xdbe9ed=util[_0x9f54('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x52e5ca[_0x9f54('0x50')],_0x49269a['id']);}logger[_0x9f54('0xa')]('[QUEUE]',_0x9f54('0x61'));emit(util[_0x9f54('0x23')]('user:%s',_0xced811[_0x9f54('0xc')]),'trigger:browser:url',{'uri':_0xdbe9ed});})['catch'](function(_0x5a5302){logger['error'](_0x9f54('0x56'),JSON['stringify'](_0x5a5302));});};exports['outbound']=function(_0x2b4588,_0x50572d,_0x51d384,_0x50d8e0,_0x24c337,_0x1b3207,_0x2737cd){var _0x1d2b86,_0x2c5821,_0x3c857c,_0x36f6ef;_0x1b3207['remoteUri']=intUtil[_0x9f54('0x51')](_0x1b3207[_0x9f54('0x50')]);_0x1b3207[_0x9f54('0x52')]=intUtil[_0x9f54('0x51')](_0x1b3207[_0x9f54('0x52')]);def[_0x9f54('0x53')]=util[_0x9f54('0x23')](_0x9f54('0x54'),_0x1b3207[_0x9f54('0x50')]);if(_0x2737cd&&_0x2737cd[_0x9f54('0x62')]&&_0x2737cd[_0x9f54('0x62')]!=='none'){logger['info'](_0x9f54('0x63'),_0x9f54('0x64'));_0x50572d[_0x9f54('0x65')]=util[_0x9f54('0x23')](_0x9f54('0x66'),_0x1b3207[_0x9f54('0x52')],_0x50572d['uniqueid'],md5(_0x50572d[_0x9f54('0x57')]));}return getConnection(_0x1b3207)['then'](function(_0x116371){_0x36f6ef=_0x116371;return getUser(_0x1b3207,_0x50d8e0[_0x9f54('0xc')],_0x36f6ef);})[_0x9f54('0x2e')](function(_0x5838ef){_0x1d2b86=_0x5838ef;logger[_0x9f54('0xa')](_0x9f54('0x58'),_0x1d2b86['id']);return getEndUser(_0x1b3207,_0x50572d['destcalleridname'],_0x50572d[_0x9f54('0x67')],_0x36f6ef);})[_0x9f54('0x2e')](function(_0x34d7f8){_0x2c5821=_0x34d7f8;logger[_0x9f54('0xa')](_0x9f54('0x68'),_0x2c5821['id']);return getTicket(_0x1b3207,_0x1d2b86,_0x2c5821,_0x51d384,_0x50572d,_0x51d384[_0x9f54('0x5b')],_0x36f6ef,_0x9f54('0x69'));})[_0x9f54('0x2e')](function(_0x249062){_0x3c857c=_0x249062;logger[_0x9f54('0xa')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x3c857c['id']);return setRelationship(_0x36f6ef,_0x1d2b86,_0x3c857c,'users');})['then'](function(){return setRelationship(_0x36f6ef,_0x2c5821,_0x3c857c,_0x9f54('0x60'));})[_0x9f54('0x2e')](function(){return getServerInfo(_0x36f6ef);})['then'](function(_0x4de98c){var _0x2fcc45=parseInt(_0x4de98c['version'][_0x9f54('0x6a')](0x0));var _0x475ee3=util[_0x9f54('0x23')](_0x9f54('0x6b'),_0x1b3207[_0x9f54('0x50')],_0x3c857c['id']);if(_0x2fcc45>0x6){_0x475ee3=util[_0x9f54('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1b3207['remoteUri'],_0x3c857c['id']);}logger[_0x9f54('0xa')](_0x9f54('0x63'),_0x9f54('0x61'));emit(util[_0x9f54('0x23')]('user:%s',_0x50d8e0[_0x9f54('0xc')]),_0x9f54('0x6c'),{'uri':_0x475ee3});})[_0x9f54('0x6d')](function(_0x528769){logger[_0x9f54('0x6e')](_0x9f54('0x63'),JSON[_0x9f54('0x21')](_0x528769));});};exports[_0x9f54('0x6f')]=function(_0x4a5f11,_0x39c249,_0x6fea88,_0x5463c6,_0x552990,_0x54d6dd){var _0x466518,_0x6c2d87,_0x2d857f,_0x17bcfe;_0x54d6dd[_0x9f54('0x50')]=intUtil[_0x9f54('0x51')](_0x54d6dd['remoteUri']);_0x54d6dd[_0x9f54('0x52')]=intUtil[_0x9f54('0x51')](_0x54d6dd['serverUrl']);def[_0x9f54('0x53')]=util[_0x9f54('0x23')](_0x9f54('0x54'),_0x54d6dd[_0x9f54('0x50')]);if(_0x552990&&_0x552990[_0x9f54('0x55')]){logger['info']('['+_0x39c249['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x39c249[_0x9f54('0x65')]=util['format'](_0x9f54('0x66'),_0x54d6dd[_0x9f54('0x52')],_0x39c249['uniqueid'],md5(_0x39c249['uniqueid']));}else{_0x39c249[_0x9f54('0x65')]='';}return getConnection(_0x54d6dd)[_0x9f54('0x2e')](function(_0x450076){_0x17bcfe=_0x450076;if(!_['isNil'](_0x5463c6)){return getUser(_0x54d6dd,_0x5463c6['name'],_0x17bcfe);}else{return getUser(_0x54d6dd,null,_0x17bcfe);}})['then'](function(_0x4d4e30){_0x466518=_0x4d4e30;logger[_0x9f54('0xa')]('The\x20User\x20ID\x20is:',_0x466518['id']);return getEndUser(_0x54d6dd,_0x39c249['calleridname'],_0x39c249['calleridnum'],_0x17bcfe);})[_0x9f54('0x2e')](function(_0x4f80f9){_0x6c2d87=_0x4f80f9;logger[_0x9f54('0xa')](_0x9f54('0x68'),_0x6c2d87['id']);return getTicket(_0x54d6dd,_0x466518,_0x6c2d87,_0x6fea88,_0x39c249,_0x6fea88['Fields'],_0x17bcfe,_0x9f54('0x5c'));})[_0x9f54('0x2e')](function(_0x20969f){_0x2d857f=_0x20969f;logger[_0x9f54('0xa')](_0x9f54('0x5d'));logger[_0x9f54('0xa')]('The\x20Ticket\x20ID\x20is:',_0x2d857f['id']);return setRelationship(_0x17bcfe,_0x466518,_0x2d857f,_0x9f54('0x5f'));})[_0x9f54('0x2e')](function(){return setRelationship(_0x17bcfe,_0x6c2d87,_0x2d857f,_0x9f54('0x60'));})[_0x9f54('0x2e')](function(){return getServerInfo(_0x17bcfe);})['catch'](function(_0x393f46){logger['error']('['+_0x39c249['lastevent'][_0x9f54('0x70')]()+']',JSON[_0x9f54('0x21')](_0x393f46));});}; \ No newline at end of file +var _0xb179=['then','entry_list','find','value','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','','Caller\x20-\x20%s','Enduser\x20created.','first_name','merge','map','string','nameField','customField','content','type','custom_fields','customVariable','Variable','toLowerCase','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','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','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','The\x20Ticket\x20ID\x20is:','charAt','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','./util','../../../../config/logger','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','slice','replace','duration_minutes','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','JSON','stringify','Calls','format','apiKey','toString','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name'];(function(_0x156a67,_0x5b3f5d){var _0x36788f=function(_0x36d096){while(--_0x36d096){_0x156a67['push'](_0x156a67['shift']());}};_0x36788f(++_0x5b3f5d);}(_0xb179,0x1aa));var _0x9b17=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb179[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x9b17('0x0'));var rp=require(_0x9b17('0x1'));var BPromise=require(_0x9b17('0x2'));var md5=require(_0x9b17('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x9b17('0x4'));var config=require('../../../../config/environment');var logger=require(_0x9b17('0x5'))('sugarcrm');config[_0x9b17('0x6')]=_[_0x9b17('0x7')](config[_0x9b17('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x9b17('0x8'))(new Redis(config[_0x9b17('0x6')]));var def={'method':_0x9b17('0x9'),'json':!![]};function emit(_0x596db0,_0x2edce9,_0x336b44){io['to'](_0x596db0)[_0x9b17('0xa')](_0x2edce9,_0x336b44);}function getTicket(_0x4eba86,_0x408e57,_0x53bbe3,_0x1b291e,_0x4450b1,_0xd31a7,_0x1fb3db,_0xf7c3b7){logger[_0x9b17('0xb')](_0x9b17('0xc'));var _0x585c78=new Date();var _0x1c50ae=[{'name':_0x9b17('0xd'),'value':intUtil[_0x9b17('0xe')](_0x1b291e[_0x9b17('0xf')],_0x4450b1,'\x20')},{'name':_0x9b17('0x10'),'value':_0x408e57['id']},{'name':_0x9b17('0x11'),'value':_0x408e57['id']},{'name':_0x9b17('0x12'),'value':intUtil[_0x9b17('0xe')](_0x1b291e['Descriptions'],_0x4450b1,'\x0a')},{'name':'date_start','value':_0x585c78['toISOString']()[_0x9b17('0x13')](0x0,0x13)[_0x9b17('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x9b17('0x15'),'value':'15'},{'name':'parent_id','value':_0x53bbe3['id']},{'name':_0x9b17('0x16'),'value':_0x9b17('0x17')},{'name':_0x9b17('0x18'),'value':_0x53bbe3['name']},{'name':_0x9b17('0x19'),'value':_0xf7c3b7}];if(_0xd31a7[_0x9b17('0x1a')]){_[_0x9b17('0x1b')](_0xd31a7,function(_0x1da6df){if(_0x4450b1[_0x1da6df[_0x9b17('0x1c')]]){_0x1c50ae[_0x9b17('0x1d')]({'name':_0x1da6df[_0x9b17('0x1e')],'value':_0x4450b1[_0x1da6df['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x9b17('0x1f'),'rest_data':JSON[_0x9b17('0x20')]({'session':_0x1fb3db['id'],'module_name':_0x9b17('0x21'),'name_value_list':_0x1c50ae})}});}function getAuth(_0x38dcff){return util[_0x9b17('0x22')]('Basic\x20%s',new Buffer(_0x38dcff[_0x9b17('0x23')]+':X')[_0x9b17('0x24')]('base64'));}function getServerInfo(_0x6d26f7){return request({'form':{'method':'get_server_info','input_type':_0x9b17('0x1f'),'response_type':_0x9b17('0x1f'),'rest_data':JSON[_0x9b17('0x20')]({'session':_0x6d26f7['id']})}});}function getUser(_0x44381d,_0x7bea8d,_0x3c1fee){if(!_[_0x9b17('0x25')](_0x7bea8d)){logger['info']('Getting\x20agent\x20with\x20name',_0x7bea8d);return request({'form':{'method':_0x9b17('0x26'),'input_type':_0x9b17('0x1f'),'response_type':'JSON','rest_data':JSON[_0x9b17('0x20')]({'session':_0x3c1fee['id'],'module_name':_0x9b17('0x27'),'query':util['format'](_0x9b17('0x28'),_0x7bea8d),'order_by':'','offset':'0','select_fields':['id','name',_0x9b17('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9b17('0x2a')](function(_0x357726){if(_0x357726[_0x9b17('0x2b')]['length']){var _0x2b6fb9=_[_0x9b17('0x2c')](_0x357726['entry_list'],function(_0x3c20a4){return _0x3c20a4['name_value_list']['user_name'][_0x9b17('0x2d')]===_0x7bea8d;});if(_0x2b6fb9){logger[_0x9b17('0xb')]('Agent\x20found!');return BPromise[_0x9b17('0x2e')]({'id':_0x2b6fb9[_0x9b17('0x2f')]['id']['value'],'name':_0x2b6fb9[_0x9b17('0x2f')]['name'][_0x9b17('0x2d')]});}}logger[_0x9b17('0xb')](_0x9b17('0x30'));return BPromise[_0x9b17('0x2e')]({'id':_0x3c1fee['name_value_list'][_0x9b17('0x31')][_0x9b17('0x2d')],'name':_0x3c1fee[_0x9b17('0x2f')][_0x9b17('0x29')]['value']});});}else{logger['info'](_0x9b17('0x32'));return BPromise[_0x9b17('0x2e')]({'id':_0x3c1fee[_0x9b17('0x2f')][_0x9b17('0x31')][_0x9b17('0x2d')],'name':_0x3c1fee[_0x9b17('0x2f')][_0x9b17('0x29')]['value']});}}function getEndUser(_0x308fc6,_0x414467,_0x113cce,_0x3a52b8){logger['info'](_0x9b17('0x33'),_0x113cce);return request({'form':{'method':_0x9b17('0x26'),'input_type':'JSON','response_type':_0x9b17('0x1f'),'rest_data':JSON['stringify']({'session':_0x3a52b8['id'],'module_name':_0x9b17('0x17'),'query':util['format'](_0x9b17('0x34'),_0x113cce),'order_by':'','offset':'0','select_fields':['id','name',_0x9b17('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9b17('0x2a')](function(_0x1d9112){if(_0x1d9112[_0x9b17('0x2b')]['length']){var _0x5debff=_['find'](_0x1d9112[_0x9b17('0x2b')],function(_0x262aad){return _0x262aad[_0x9b17('0x2f')][_0x9b17('0x35')][_0x9b17('0x2d')]===_0x113cce;});if(_0x5debff){logger[_0x9b17('0xb')](_0x9b17('0x36'));return BPromise['resolve']({'id':_0x5debff[_0x9b17('0x2f')]['id']['value'],'name':_0x5debff[_0x9b17('0x2f')][_0x9b17('0xd')]['value'],'phone':_0x5debff[_0x9b17('0x2f')]['phone_home']['value']});}}else{logger[_0x9b17('0xb')](_0x9b17('0x37'));return request({'form':{'method':_0x9b17('0x38'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9b17('0x20')]({'session':_0x3a52b8['id'],'module_name':_0x9b17('0x17'),'name_value_list':[{'name':'first_name','value':_0x414467!==_0x9b17('0x39')?_0x414467:util[_0x9b17('0x22')](_0x9b17('0x3a'),_0x113cce)},{'name':_0x9b17('0x35'),'value':_0x113cce}]})}})[_0x9b17('0x2a')](function(_0x26d8b2){logger[_0x9b17('0xb')](_0x9b17('0x3b'));return BPromise['resolve']({'id':_0x26d8b2['id'],'name':_0x26d8b2['entry_list'][_0x9b17('0x3c')][_0x9b17('0x2d')],'phone':_0x26d8b2[_0x9b17('0x2b')][_0x9b17('0x35')][_0x9b17('0x2d')]});});}});}function request(_0x589d59){logger['debug']('[HTTP]',JSON[_0x9b17('0x20')](_0x589d59));return rp(_[_0x9b17('0x3d')](def,_0x589d59));}function getTags(_0x5a690c,_0x1da17f){var _0x47cdd0=[];if(_0x5a690c&&_0x5a690c[_0x9b17('0x1a')]>0x0){_0x47cdd0=_[_0x9b17('0x3e')](_0x5a690c,_0x1da17f);}return _0x47cdd0;}function getCustomFields(_0x1f6576,_0x48d924){var _0x8dae8e=[];var _0x2ac976={'custom_fields':[]};if(_0x1f6576['length']>0x0){_['forEach'](_0x1f6576,function(_0x53a77c){if(_0x53a77c['type']===_0x9b17('0x3f')&&_0x53a77c[_0x9b17('0x40')]&&!_0x53a77c[_0x9b17('0x41')]){_0x2ac976[_0x53a77c[_0x9b17('0x40')]['toLowerCase']()]=_0x53a77c[_0x9b17('0x42')][_0x9b17('0x24')]();}else if(_0x53a77c[_0x9b17('0x43')]==='string'&&_0x53a77c[_0x9b17('0x1e')]&&_0x53a77c[_0x9b17('0x41')]){_0x2ac976[_0x9b17('0x44')][_0x9b17('0x1d')]({'id':_0x53a77c[_0x9b17('0x1e')],'value':_0x53a77c[_0x9b17('0x42')]['toString']()});}else if(_0x53a77c[_0x9b17('0x43')]==='variable'&&_0x53a77c[_0x9b17('0x1c')]&&_0x53a77c['idField']&&_0x53a77c['customField']){_0x48d924[_0x53a77c['variableName']]&&_0x2ac976['custom_fields'][_0x9b17('0x1d')]({'id':_0x53a77c['idField'],'value':_0x48d924[_0x53a77c[_0x9b17('0x1c')]]['toString']()});}else if(_0x53a77c[_0x9b17('0x43')]===_0x9b17('0x45')&&_0x53a77c[_0x9b17('0x46')]&&_0x53a77c[_0x9b17('0x46')][_0x9b17('0xd')]&&_0x53a77c[_0x9b17('0x1e')]&&_0x53a77c['customField']){_0x48d924[_0x53a77c[_0x9b17('0x46')][_0x9b17('0xd')][_0x9b17('0x47')]()]&&_0x2ac976['custom_fields'][_0x9b17('0x1d')]({'id':_0x53a77c[_0x9b17('0x1e')],'value':_0x48d924[_0x53a77c[_0x9b17('0x46')][_0x9b17('0xd')][_0x9b17('0x47')]()][_0x9b17('0x24')]()});}});}return _0x2ac976;}function getConnection(_0x194b5b){return request({'method':'POST','form':{'method':_0x9b17('0x48'),'input_type':'JSON','response_type':_0x9b17('0x1f'),'rest_data':JSON[_0x9b17('0x20')]({'user_auth':{'user_name':_0x194b5b[_0x9b17('0x49')],'password':_0x194b5b['password'],'encryption':_0x9b17('0x4a')},'application':_0x9b17('0x4b')})}})[_0x9b17('0x2a')](function(_0x7043ab){var _0x27543c=_0x7043ab;if(_0x27543c['id']){def[_0x9b17('0x4c')]=_0x27543c['id'];return BPromise['resolve'](_0x27543c);}else{throw new Error(util[_0x9b17('0x22')](_0x9b17('0x4d'),_0x194b5b['id']));}});}function setRelationship(_0x4ea8f2,_0x505d33,_0x19707c,_0x2ed04f){return request({'form':{'method':_0x9b17('0x4e'),'input_type':_0x9b17('0x1f'),'response_type':_0x9b17('0x1f'),'rest_data':JSON[_0x9b17('0x20')]({'session':_0x4ea8f2['id'],'module_name':_0x9b17('0x21'),'module_id':_0x19707c['id'],'link_field_name':_0x2ed04f,'related_ids':[_0x505d33['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9b17('0x4f')]=function(_0x42c680,_0x536128,_0x2e2cfd,_0x21e462,_0x4a73f5,_0x2c87b0){var _0x2c52ad,_0x389f87,_0x30496f,_0x19dd7a;_0x2c87b0[_0x9b17('0x50')]=intUtil[_0x9b17('0x51')](_0x2c87b0[_0x9b17('0x50')]);_0x2c87b0['serverUrl']=intUtil[_0x9b17('0x51')](_0x2c87b0[_0x9b17('0x52')]);def[_0x9b17('0x53')]=util[_0x9b17('0x22')](_0x9b17('0x54'),_0x2c87b0[_0x9b17('0x50')]);if(_0x4a73f5&&_0x4a73f5[_0x9b17('0x55')]){logger[_0x9b17('0xb')](_0x9b17('0x56'),_0x9b17('0x57'));_0x536128[_0x9b17('0x58')]=util['format'](_0x9b17('0x59'),_0x2c87b0[_0x9b17('0x52')],_0x536128[_0x9b17('0x5a')],md5(_0x536128[_0x9b17('0x5a')]));}else{_0x536128[_0x9b17('0x58')]='';}return getConnection(_0x2c87b0)[_0x9b17('0x2a')](function(_0x38161e){_0x19dd7a=_0x38161e;return getUser(_0x2c87b0,_0x21e462[_0x9b17('0xd')],_0x19dd7a);})[_0x9b17('0x2a')](function(_0x34e000){_0x2c52ad=_0x34e000;logger[_0x9b17('0xb')]('The\x20User\x20ID\x20is:',_0x2c52ad['id']);return getEndUser(_0x2c87b0,_0x536128[_0x9b17('0x5b')],_0x536128[_0x9b17('0x5c')],_0x19dd7a);})[_0x9b17('0x2a')](function(_0x422c96){_0x389f87=_0x422c96;logger['info'](_0x9b17('0x5d'),_0x389f87['id']);return getTicket(_0x2c87b0,_0x2c52ad,_0x389f87,_0x2e2cfd,_0x536128,_0x2e2cfd['Fields'],_0x19dd7a,'Inbound');})[_0x9b17('0x2a')](function(_0x590b8a){_0x30496f=_0x590b8a;logger[_0x9b17('0xb')](_0x9b17('0x5e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x30496f['id']);return setRelationship(_0x19dd7a,_0x2c52ad,_0x30496f,_0x9b17('0x5f'));})[_0x9b17('0x2a')](function(){return setRelationship(_0x19dd7a,_0x389f87,_0x30496f,_0x9b17('0x60'));})[_0x9b17('0x2a')](function(){return getServerInfo(_0x19dd7a);})[_0x9b17('0x2a')](function(_0x1773ac){var _0x1ddf82=parseInt(_0x1773ac[_0x9b17('0x61')]['charAt'](0x0));var _0x452ac0=util[_0x9b17('0x22')](_0x9b17('0x62'),_0x2c87b0[_0x9b17('0x50')],_0x30496f['id']);if(_0x1ddf82>0x6){_0x452ac0=util[_0x9b17('0x22')](_0x9b17('0x63'),_0x2c87b0[_0x9b17('0x50')],_0x30496f['id']);}logger[_0x9b17('0xb')](_0x9b17('0x56'),_0x9b17('0x64'));emit(util[_0x9b17('0x22')](_0x9b17('0x65'),_0x21e462[_0x9b17('0xd')]),_0x9b17('0x66'),{'uri':_0x452ac0});})[_0x9b17('0x67')](function(_0x5d447e){logger[_0x9b17('0x68')]('[QUEUE]',JSON['stringify'](_0x5d447e));});};exports[_0x9b17('0x69')]=function(_0x3495d0,_0x50f580,_0xf35960,_0x2a0915,_0x728c46,_0x437a65,_0x493e34){var _0x24ec05,_0x54b8b2,_0x4a98db,_0x1092df;_0x437a65['remoteUri']=intUtil[_0x9b17('0x51')](_0x437a65[_0x9b17('0x50')]);_0x437a65[_0x9b17('0x52')]=intUtil[_0x9b17('0x51')](_0x437a65[_0x9b17('0x52')]);def[_0x9b17('0x53')]=util['format']('%s/service/v4_1/rest.php',_0x437a65[_0x9b17('0x50')]);if(_0x493e34&&_0x493e34[_0x9b17('0x6a')]&&_0x493e34[_0x9b17('0x6a')]!==_0x9b17('0x6b')){logger['info']('[OUTBOUND]',_0x9b17('0x57'));_0x50f580[_0x9b17('0x58')]=util['format'](_0x9b17('0x59'),_0x437a65[_0x9b17('0x52')],_0x50f580[_0x9b17('0x5a')],md5(_0x50f580['uniqueid']));}return getConnection(_0x437a65)[_0x9b17('0x2a')](function(_0x4b6f3d){_0x1092df=_0x4b6f3d;return getUser(_0x437a65,_0x2a0915[_0x9b17('0xd')],_0x1092df);})[_0x9b17('0x2a')](function(_0x272616){_0x24ec05=_0x272616;logger[_0x9b17('0xb')](_0x9b17('0x6c'),_0x24ec05['id']);return getEndUser(_0x437a65,_0x50f580[_0x9b17('0x6d')],_0x50f580[_0x9b17('0x6e')],_0x1092df);})[_0x9b17('0x2a')](function(_0x2150a7){_0x54b8b2=_0x2150a7;logger[_0x9b17('0xb')](_0x9b17('0x5d'),_0x54b8b2['id']);return getTicket(_0x437a65,_0x24ec05,_0x54b8b2,_0xf35960,_0x50f580,_0xf35960[_0x9b17('0x6f')],_0x1092df,'Outbound');})[_0x9b17('0x2a')](function(_0xb34cd4){_0x4a98db=_0xb34cd4;logger['info'](_0x9b17('0x5e'));logger[_0x9b17('0xb')](_0x9b17('0x70'),_0x4a98db['id']);return setRelationship(_0x1092df,_0x24ec05,_0x4a98db,_0x9b17('0x5f'));})[_0x9b17('0x2a')](function(){return setRelationship(_0x1092df,_0x54b8b2,_0x4a98db,_0x9b17('0x60'));})[_0x9b17('0x2a')](function(){return getServerInfo(_0x1092df);})[_0x9b17('0x2a')](function(_0x23f0e0){var _0x1da2ac=parseInt(_0x23f0e0['version'][_0x9b17('0x71')](0x0));var _0x56f6e6=util[_0x9b17('0x22')](_0x9b17('0x62'),_0x437a65[_0x9b17('0x50')],_0x4a98db['id']);if(_0x1da2ac>0x6){_0x56f6e6=util[_0x9b17('0x22')](_0x9b17('0x63'),_0x437a65[_0x9b17('0x50')],_0x4a98db['id']);}logger[_0x9b17('0xb')]('[OUTBOUND]',_0x9b17('0x64'));emit(util[_0x9b17('0x22')](_0x9b17('0x65'),_0x2a0915[_0x9b17('0xd')]),_0x9b17('0x66'),{'uri':_0x56f6e6});})[_0x9b17('0x67')](function(_0x4a2ab5){logger['error']('[OUTBOUND]',JSON[_0x9b17('0x20')](_0x4a2ab5));});};exports[_0x9b17('0x72')]=function(_0x4ea18c,_0x5a0e64,_0x324d22,_0x463b0e,_0x4f4060,_0x475905){var _0x3a1a9d,_0x51e6dd,_0x45e611,_0x4f787f;_0x475905[_0x9b17('0x50')]=intUtil[_0x9b17('0x51')](_0x475905[_0x9b17('0x50')]);_0x475905[_0x9b17('0x52')]=intUtil[_0x9b17('0x51')](_0x475905[_0x9b17('0x52')]);def['uri']=util[_0x9b17('0x22')](_0x9b17('0x54'),_0x475905['remoteUri']);if(_0x4f4060&&_0x4f4060[_0x9b17('0x55')]){logger[_0x9b17('0xb')]('['+_0x5a0e64[_0x9b17('0x73')][_0x9b17('0x74')]()+']',_0x9b17('0x57'));_0x5a0e64['recordingURL']=util[_0x9b17('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x475905['serverUrl'],_0x5a0e64[_0x9b17('0x5a')],md5(_0x5a0e64[_0x9b17('0x5a')]));}else{_0x5a0e64[_0x9b17('0x58')]='';}return getConnection(_0x475905)['then'](function(_0x45156e){_0x4f787f=_0x45156e;if(!_[_0x9b17('0x25')](_0x463b0e)){return getUser(_0x475905,_0x463b0e[_0x9b17('0xd')],_0x4f787f);}else{return getUser(_0x475905,null,_0x4f787f);}})['then'](function(_0x26063a){_0x3a1a9d=_0x26063a;logger[_0x9b17('0xb')](_0x9b17('0x6c'),_0x3a1a9d['id']);return getEndUser(_0x475905,_0x5a0e64[_0x9b17('0x5b')],_0x5a0e64[_0x9b17('0x5c')],_0x4f787f);})[_0x9b17('0x2a')](function(_0x4abe9d){_0x51e6dd=_0x4abe9d;logger['info'](_0x9b17('0x5d'),_0x51e6dd['id']);return getTicket(_0x475905,_0x3a1a9d,_0x51e6dd,_0x324d22,_0x5a0e64,_0x324d22[_0x9b17('0x6f')],_0x4f787f,'Inbound');})[_0x9b17('0x2a')](function(_0x421de2){_0x45e611=_0x421de2;logger[_0x9b17('0xb')](_0x9b17('0x5e'));logger[_0x9b17('0xb')](_0x9b17('0x70'),_0x45e611['id']);return setRelationship(_0x4f787f,_0x3a1a9d,_0x45e611,_0x9b17('0x5f'));})[_0x9b17('0x2a')](function(){return setRelationship(_0x4f787f,_0x51e6dd,_0x45e611,'contacts');})[_0x9b17('0x2a')](function(){return getServerInfo(_0x4f787f);})[_0x9b17('0x67')](function(_0x56f5e3){logger['error']('['+_0x5a0e64['lastevent'][_0x9b17('0x74')]()+']',JSON[_0x9b17('0x20')](_0x56f5e3));});}; \ 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 45a704a..af25556 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 _0x807b=['type','string','push','content','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','join','lastIndexOf','validateEmail','isNil','test','util','getString','length','sortBy'];(function(_0x2bc8e0,_0x38204a){var _0xca8f97=function(_0x1de1c1){while(--_0x1de1c1){_0x2bc8e0['push'](_0x2bc8e0['shift']());}};_0xca8f97(++_0x38204a);}(_0x807b,0x1d0));var _0xb807=function(_0x2b6f59,_0x5b3bd5){_0x2b6f59=_0x2b6f59-0x0;var _0xde9aec=_0x807b[_0x2b6f59];return _0xde9aec;};'use strict';var _=require('lodash');var util=require(_0xb807('0x0'));exports[_0xb807('0x1')]=function(_0x47e766,_0x54dff3,_0x1e421c){var _0x8146fc=[];if(_0x47e766[_0xb807('0x2')]>0x0){var _0x4e3347=_[_0xb807('0x3')](_0x47e766,['id']);for(var _0x400a22=0x0;_0x400a22<_0x4e3347[_0xb807('0x2')];_0x400a22++){var _0x5ec4dc=_0x4e3347[_0x400a22];if(_0x5ec4dc[_0xb807('0x4')]===_0xb807('0x5')){_0x8146fc[_0xb807('0x6')](_0x5ec4dc[_0xb807('0x7')]);}else if(_0x5ec4dc['type']==='variable'&&_0x5ec4dc['variableName']){_0x54dff3[_0x5ec4dc[_0xb807('0x8')]]&&_0x8146fc['push'](_0x54dff3[_0x5ec4dc[_0xb807('0x8')]]['toString']());}else if(_0x5ec4dc[_0xb807('0x4')]===_0xb807('0x9')&&_0x5ec4dc[_0xb807('0xa')]&&_0x5ec4dc[_0xb807('0xa')]['name']){_0x54dff3[_0x5ec4dc[_0xb807('0xa')][_0xb807('0xb')][_0xb807('0xc')]()]&&_0x8146fc[_0xb807('0x6')](_0x54dff3[_0x5ec4dc[_0xb807('0xa')]['name'][_0xb807('0xc')]()][_0xb807('0xd')]());}else if(_0x5ec4dc['type']===_0xb807('0xe')){if(_0x5ec4dc[_0xb807('0xf')]==='string'&&_0x5ec4dc[_0xb807('0x10')]){_0x8146fc['push'](util[_0xb807('0x11')](_0xb807('0x12'),_0x5ec4dc[_0xb807('0x10')],_0x5ec4dc[_0xb807('0x13')]));}else if(_0x5ec4dc['keyType']===_0xb807('0x14')&&_0x5ec4dc[_0xb807('0x8')]&&_0x5ec4dc['key']){_0x54dff3[_0x5ec4dc[_0xb807('0x8')]]&&_0x8146fc[_0xb807('0x6')](util[_0xb807('0x11')](_0xb807('0x12'),_0x5ec4dc[_0xb807('0x10')],_0x54dff3[_0x5ec4dc[_0xb807('0x8')]]));}else if(_0x5ec4dc[_0xb807('0xf')]===_0xb807('0x9')&&_0x5ec4dc['Variable']&&_0x5ec4dc[_0xb807('0xa')][_0xb807('0xb')]&&_0x5ec4dc['key']){_0x54dff3[_0x5ec4dc[_0xb807('0xa')][_0xb807('0xb')][_0xb807('0xc')]()]&&_0x8146fc[_0xb807('0x6')](util[_0xb807('0x11')](_0xb807('0x12'),_0x5ec4dc['key'],_0x54dff3[_0x5ec4dc['Variable'][_0xb807('0xb')]['toLowerCase']()]));}}}}return _0x8146fc[_0xb807('0x15')](_0x1e421c);};exports['stripTrailingSlash']=function(_0x2562c4){var _0x186618=_0x2562c4['slice'](-0x1);if(_0x186618==='/'){_0x2562c4=_0x2562c4['substring'](0x0,_0x2562c4[_0xb807('0x16')](_0x186618));}return _0x2562c4;};exports[_0xb807('0x17')]=function(_0x5e4c50){if(!_[_0xb807('0x18')](_0x5e4c50)&&_0x5e4c50!==''){var _0x56e74c=/^(([^<>()\[\]\\.,;:\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 _0x56e74c[_0xb807('0x19')](String(_0x5e4c50)[_0xb807('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x06c7=['validateEmail','test','lodash','util','getString','length','sortBy','type','string','push','variableName','customVariable','name','Variable','toLowerCase','toString','keyValue','format','keyType','variable','key','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf'];(function(_0x5e9018,_0x5d3a28){var _0x2062e2=function(_0x4aa0d8){while(--_0x4aa0d8){_0x5e9018['push'](_0x5e9018['shift']());}};_0x2062e2(++_0x5d3a28);}(_0x06c7,0x6e));var _0x706c=function(_0x234126,_0xfef156){_0x234126=_0x234126-0x0;var _0x39c05c=_0x06c7[_0x234126];return _0x39c05c;};'use strict';var _=require(_0x706c('0x0'));var util=require(_0x706c('0x1'));exports[_0x706c('0x2')]=function(_0x4a3cd0,_0x3d1485,_0x59e75c){var _0x49bf40=[];if(_0x4a3cd0[_0x706c('0x3')]>0x0){var _0x5ba1cb=_[_0x706c('0x4')](_0x4a3cd0,['id']);for(var _0x4678d5=0x0;_0x4678d5<_0x5ba1cb[_0x706c('0x3')];_0x4678d5++){var _0x79d03d=_0x5ba1cb[_0x4678d5];if(_0x79d03d[_0x706c('0x5')]===_0x706c('0x6')){_0x49bf40[_0x706c('0x7')](_0x79d03d['content']);}else if(_0x79d03d[_0x706c('0x5')]==='variable'&&_0x79d03d[_0x706c('0x8')]){_0x3d1485[_0x79d03d[_0x706c('0x8')]]&&_0x49bf40[_0x706c('0x7')](_0x3d1485[_0x79d03d['variableName']]['toString']());}else if(_0x79d03d[_0x706c('0x5')]===_0x706c('0x9')&&_0x79d03d['Variable']&&_0x79d03d['Variable'][_0x706c('0xa')]){_0x3d1485[_0x79d03d[_0x706c('0xb')][_0x706c('0xa')]['toLowerCase']()]&&_0x49bf40['push'](_0x3d1485[_0x79d03d[_0x706c('0xb')][_0x706c('0xa')][_0x706c('0xc')]()][_0x706c('0xd')]());}else if(_0x79d03d[_0x706c('0x5')]===_0x706c('0xe')){if(_0x79d03d['keyType']===_0x706c('0x6')&&_0x79d03d['key']){_0x49bf40[_0x706c('0x7')](util[_0x706c('0xf')]('%s:\x20%s',_0x79d03d['key'],_0x79d03d['keyContent']));}else if(_0x79d03d[_0x706c('0x10')]===_0x706c('0x11')&&_0x79d03d['variableName']&&_0x79d03d[_0x706c('0x12')]){_0x3d1485[_0x79d03d[_0x706c('0x8')]]&&_0x49bf40[_0x706c('0x7')](util[_0x706c('0xf')](_0x706c('0x13'),_0x79d03d[_0x706c('0x12')],_0x3d1485[_0x79d03d['variableName']]));}else if(_0x79d03d[_0x706c('0x10')]==='customVariable'&&_0x79d03d['Variable']&&_0x79d03d[_0x706c('0xb')][_0x706c('0xa')]&&_0x79d03d[_0x706c('0x12')]){_0x3d1485[_0x79d03d[_0x706c('0xb')][_0x706c('0xa')][_0x706c('0xc')]()]&&_0x49bf40[_0x706c('0x7')](util[_0x706c('0xf')](_0x706c('0x13'),_0x79d03d['key'],_0x3d1485[_0x79d03d[_0x706c('0xb')][_0x706c('0xa')][_0x706c('0xc')]()]));}}}}return _0x49bf40[_0x706c('0x14')](_0x59e75c);};exports[_0x706c('0x15')]=function(_0x1abec8){var _0x51854d=_0x1abec8[_0x706c('0x16')](-0x1);if(_0x51854d==='/'){_0x1abec8=_0x1abec8[_0x706c('0x17')](0x0,_0x1abec8[_0x706c('0x18')](_0x51854d));}return _0x1abec8;};exports[_0x706c('0x19')]=function(_0x4f11e8){if(!_['isNil'](_0x4f11e8)&&_0x4f11e8!==''){var _0x505d12=/^(([^<>()\[\]\\.,;:\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 _0x505d12[_0x706c('0x1a')](String(_0x4f11e8)[_0x706c('0xc')]());}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 fc21de1..7698007 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index f7d950c..3799d18 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 _0xa37b=['Authorization','The\x20Ticket\x20ID\x20is:','user:%s','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','zendesk','defaults','socket.io-emitter','redis','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','GET','forEach','includes','type','nameField','customField','toLowerCase','content','string','picklist','idField','custom_fields','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','uniqueid'];(function(_0x230b8d,_0x198f5e){var _0x9e1e70=function(_0x4d11e0){while(--_0x4d11e0){_0x230b8d['push'](_0x230b8d['shift']());}};_0x9e1e70(++_0x198f5e);}(_0xa37b,0xec));var _0xba37=function(_0x58f29c,_0x551df2){_0x58f29c=_0x58f29c-0x0;var _0x5266ed=_0xa37b[_0x58f29c];return _0x5266ed;};'use strict';var _=require(_0xba37('0x0'));var rp=require(_0xba37('0x1'));var md5=require(_0xba37('0x2'));var util=require(_0xba37('0x3'));var Redis=require(_0xba37('0x4'));var intUtil=require(_0xba37('0x5'));var config=require(_0xba37('0x6'));var logger=require('../../../../config/logger')(_0xba37('0x7'));config['redis']=_[_0xba37('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xba37('0x9'))(new Redis(config[_0xba37('0xa')]));function emit(_0x599666,_0xa12803,_0x4f5073){io['to'](_0x599666)[_0xba37('0xb')](_0xa12803,_0x4f5073);}var headers={'Content-Type':'application/json','Accept':_0xba37('0xc')};function getTicket(_0x5a6180,_0x1672d3,_0x36ef0d,_0x5627aa,_0x3e594f){logger[_0xba37('0xd')](_0xba37('0xe'));return request({'uri':util[_0xba37('0xf')]('%s/tickets.json',_0x5a6180[_0xba37('0x10')]),'method':_0xba37('0x11'),'body':{'ticket':_[_0xba37('0x12')]({'requester_id':_0x36ef0d['id'],'submitter_id':_0x1672d3?_0x1672d3['id']:undefined,'assignee_id':_0x1672d3?_0x1672d3['id']:undefined,'tags':getTags(_0x5627aa[_0xba37('0x13')],_0xba37('0x14')),'subject':intUtil['getString'](_0x5627aa['Subjects'],_0x3e594f,'\x20'),'description':intUtil[_0xba37('0x15')](_0x5627aa[_0xba37('0x16')],_0x3e594f,'\x0a'),'comment':{'public':![],'body':intUtil[_0xba37('0x15')](_0x5627aa[_0xba37('0x16')],_0x3e594f,'\x0a')}},getCustomFields(_0x5627aa[_0xba37('0x17')],_0x3e594f))}})['then'](function(_0x43d66f){logger['info'](_0xba37('0x18'));return _0x43d66f[_0xba37('0x19')];});}function getUser(_0x5f4900,_0x59fca9){if(intUtil[_0xba37('0x1a')](_0x59fca9)){logger[_0xba37('0xd')](_0xba37('0x1b'),_0x59fca9);return request({'uri':util[_0xba37('0xf')](_0xba37('0x1c'),_0x5f4900[_0xba37('0x10')]),'qs':{'query':util[_0xba37('0xf')](_0xba37('0x1d'),_0x59fca9)}})[_0xba37('0x1e')](function(_0x29b63f){if(_0x29b63f['count']){logger[_0xba37('0xd')](_0xba37('0x1f'));return _[_0xba37('0x20')](_0x29b63f[_0xba37('0x21')],{'email':_0x59fca9,'role':'agent'});}else{logger[_0xba37('0xd')](_0xba37('0x22'));return request({'uri':util[_0xba37('0xf')](_0xba37('0x23'),_0x5f4900[_0xba37('0x10')])})[_0xba37('0x1e')](function(_0xc5d080){logger['info'](_0xba37('0x24'));return _0xc5d080[_0xba37('0x25')];});}});}else{logger[_0xba37('0xd')](_0xba37('0x22'));return request({'uri':util[_0xba37('0xf')](_0xba37('0x23'),_0x5f4900[_0xba37('0x10')])})[_0xba37('0x1e')](function(_0x4e2f6e){logger[_0xba37('0xd')](_0xba37('0x24'));return _0x4e2f6e[_0xba37('0x25')];});}}function getEndUser(_0x3c614d,_0x3af3fb,_0x27ba8a){logger[_0xba37('0xd')]('Searching\x20enduser\x20with\x20phone',_0x27ba8a);return request({'uri':util[_0xba37('0xf')](_0xba37('0x1c'),_0x3c614d['remoteUri']),'qs':{'query':util[_0xba37('0xf')](_0xba37('0x26'),_0x27ba8a)}})['then'](function(_0x2e7e9c){var _0xad3962;if(_0x2e7e9c[_0xba37('0x21')][_0xba37('0x27')]){_0x2e7e9c[_0xba37('0x21')]=_[_0xba37('0x28')](_0x2e7e9c[_0xba37('0x21')],{'suspended':![],'role':_0xba37('0x29')});if(_0x2e7e9c[_0xba37('0x21')]['length']){_0xad3962=_[_0xba37('0x2a')](_0x2e7e9c[_0xba37('0x21')]);}}if(_0xad3962){logger[_0xba37('0xd')]('Enduser\x20found!');return _0xad3962;}else{logger[_0xba37('0xd')](_0xba37('0x2b'));return request({'uri':util[_0xba37('0xf')](_0xba37('0x2c'),_0x3c614d[_0xba37('0x10')]),'method':'POST','body':{'user':{'role':_0xba37('0x29'),'name':util[_0xba37('0xf')](_0xba37('0x2d'),_0x3af3fb||_0x27ba8a),'phone':_0x27ba8a}}})['then'](function(_0x19b1cd){logger['info'](_0xba37('0x2e'));return _0x19b1cd[_0xba37('0x25')];});}});}function getAuth(_0x3d66bb){var _0x3fcde5;if(_0x3d66bb['authType']===_0xba37('0x2f')){_0x3fcde5=util['format'](_0xba37('0x30'),_0x3d66bb[_0xba37('0x31')],_0x3d66bb[_0xba37('0x2f')]);}else if(_0x3d66bb[_0xba37('0x32')]===_0xba37('0x33')){_0x3fcde5=util[_0xba37('0xf')](_0xba37('0x34'),_0x3d66bb[_0xba37('0x31')],_0x3d66bb[_0xba37('0x33')]);}return util['format'](_0xba37('0x35'),new Buffer(_0x3fcde5)[_0xba37('0x36')](_0xba37('0x37')));}function request(_0x449164){logger[_0xba37('0x38')]('[HTTP]',JSON[_0xba37('0x39')](_0x449164));return rp(_['defaults'](_0x449164,{'method':_0xba37('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x1ceb60,_0x578bca){var _0x473b3d=[];if(_0x1ceb60&&_0x1ceb60[_0xba37('0x27')]>0x0){_0x473b3d=_['map'](_0x1ceb60,_0x578bca);}return _0x473b3d;}function getCustomFields(_0x23356e,_0x3c9c3b){var _0x51315e=[];var _0x13eeeb={'custom_fields':[]};if(_0x23356e[_0xba37('0x27')]>0x0){_[_0xba37('0x3b')](_0x23356e,function(_0x3a62c8){if(_[_0xba37('0x3c')](['string','picklist'],_0x3a62c8[_0xba37('0x3d')])&&_0x3a62c8[_0xba37('0x3e')]&&!_0x3a62c8[_0xba37('0x3f')]){_0x13eeeb[_0x3a62c8[_0xba37('0x3e')][_0xba37('0x40')]()]=_0x3a62c8[_0xba37('0x41')][_0xba37('0x36')]();}else if(_[_0xba37('0x3c')]([_0xba37('0x42'),_0xba37('0x43')],_0x3a62c8['type'])&&_0x3a62c8[_0xba37('0x44')]&&_0x3a62c8[_0xba37('0x3f')]){_0x13eeeb[_0xba37('0x45')]['push']({'id':_0x3a62c8['idField'],'value':_0x3a62c8[_0xba37('0x41')][_0xba37('0x36')]()});}else if(_0x3a62c8['type']===_0xba37('0x46')&&_0x3a62c8[_0xba37('0x47')]&&_0x3a62c8['idField']&&_0x3a62c8[_0xba37('0x3f')]){_0x3c9c3b[_0x3a62c8[_0xba37('0x47')]]&&_0x13eeeb[_0xba37('0x45')]['push']({'id':_0x3a62c8[_0xba37('0x44')],'value':_0x3c9c3b[_0x3a62c8['variableName']]['toString']()});}else if(_0x3a62c8['type']===_0xba37('0x48')&&_0x3a62c8[_0xba37('0x49')]&&_0x3a62c8[_0xba37('0x49')][_0xba37('0x14')]&&_0x3a62c8['idField']&&_0x3a62c8[_0xba37('0x3f')]){_0x3c9c3b[_0x3a62c8[_0xba37('0x49')]['name']['toLowerCase']()]&&_0x13eeeb[_0xba37('0x45')]['push']({'id':_0x3a62c8['idField'],'value':_0x3c9c3b[_0x3a62c8[_0xba37('0x49')][_0xba37('0x14')][_0xba37('0x40')]()][_0xba37('0x36')]()});}});}return _0x13eeeb;}exports['queue']=function(_0x35cdc6,_0x6ab599,_0x36940c,_0x20152a,_0x419a21,_0x17055d){var _0x353a76,_0x13b146;_0x17055d['remoteUri']=intUtil[_0xba37('0x4a')](_0x17055d[_0xba37('0x10')]);_0x17055d[_0xba37('0x4b')]=intUtil[_0xba37('0x4a')](_0x17055d['serverUrl']);if(_0x419a21&&_0x419a21[_0xba37('0x4c')]){logger[_0xba37('0xd')]('[QUEUE]',_0xba37('0x4d'));_0x6ab599[_0xba37('0x4e')]=util[_0xba37('0xf')](_0xba37('0x4f'),_0x17055d[_0xba37('0x4b')],_0x6ab599['uniqueid'],md5(_0x6ab599['uniqueid']));}else{_0x6ab599[_0xba37('0x4e')]='';}headers['Authorization']=getAuth(_0x17055d);return getUser(_0x17055d,_0x20152a[_0xba37('0x50')])[_0xba37('0x1e')](function(_0x59812d){_0x353a76=_0x59812d;logger['info'](_0xba37('0x51'),_0x353a76['id']);return getEndUser(_0x17055d,_0x6ab599[_0xba37('0x52')],_0x6ab599[_0xba37('0x53')]);})[_0xba37('0x1e')](function(_0x8c401b){_0x13b146=_0x8c401b;logger[_0xba37('0xd')](_0xba37('0x54'),_0x13b146['id']);return getTicket(_0x17055d,_0x353a76,_0x13b146,_0x36940c,_0x6ab599);})[_0xba37('0x1e')](function(_0x213095){if(_0x213095){logger['info']('The\x20Ticket\x20ID\x20is:',_0x213095['id']);switch(_0x17055d[_0xba37('0x3d')]){case _0xba37('0x55'):logger['info']('[QUEUE]',_0xba37('0x56'));return request({'uri':util[_0xba37('0xf')](_0xba37('0x57'),_0x17055d[_0xba37('0x10')],_0x353a76['id'],_0x213095['id']),'method':'POST'});case _0xba37('0x58'):logger[_0xba37('0xd')](_0xba37('0x59'),_0xba37('0x5a'));emit(util[_0xba37('0xf')]('user:%s',_0x20152a['name']),_0xba37('0x5b'),{'uri':util[_0xba37('0xf')](_0xba37('0x5c'),_0x17055d[_0xba37('0x10')][_0xba37('0x5d')](_0xba37('0x5e'),''),_0x213095['id'])});break;default:logger[_0xba37('0x5f')](_0xba37('0x59'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xba37('0x60')](function(_0x1a93a6){logger[_0xba37('0x5f')](_0xba37('0x61'),util['inspect'](_0x1a93a6,{'showHidden':!![],'depth':null}));});};exports[_0xba37('0x62')]=function(_0x184ecf,_0x22a6f0,_0x25aeac,_0x34ebf2,_0x5413b0,_0x4bc73f,_0x457551){var _0x3ad66d,_0x1d2366;_0x4bc73f[_0xba37('0x10')]=intUtil[_0xba37('0x4a')](_0x4bc73f['remoteUri']);_0x4bc73f[_0xba37('0x4b')]=intUtil[_0xba37('0x4a')](_0x4bc73f['serverUrl']);if(_0x457551&&_0x457551[_0xba37('0x63')]&&_0x457551['recordingFormat']!==_0xba37('0x64')){logger[_0xba37('0xd')](_0xba37('0x65'),_0xba37('0x4d'));_0x22a6f0[_0xba37('0x4e')]=util[_0xba37('0xf')](_0xba37('0x4f'),_0x4bc73f[_0xba37('0x4b')],_0x22a6f0[_0xba37('0x66')],md5(_0x22a6f0[_0xba37('0x66')]));}headers[_0xba37('0x67')]=getAuth(_0x4bc73f);return getUser(_0x4bc73f,_0x34ebf2['email'])[_0xba37('0x1e')](function(_0x4d2a4b){_0x3ad66d=_0x4d2a4b;logger[_0xba37('0xd')](_0xba37('0x51'),_0x3ad66d['id']);return getEndUser(_0x4bc73f,_0x22a6f0['destcalleridname'],_0x22a6f0['destcalleridnum']);})[_0xba37('0x1e')](function(_0x47512a){_0x1d2366=_0x47512a;logger['info'](_0xba37('0x54'),_0x1d2366['id']);return getTicket(_0x4bc73f,_0x3ad66d,_0x1d2366,_0x25aeac,_0x22a6f0);})[_0xba37('0x1e')](function(_0x3aa506){if(_0x3aa506){logger[_0xba37('0xd')](_0xba37('0x68'),_0x3aa506['id']);switch(_0x4bc73f[_0xba37('0x3d')]){case'integrationTab':logger['info'](_0xba37('0x65'),_0xba37('0x56'));return request({'uri':util[_0xba37('0xf')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x4bc73f['remoteUri'],_0x3ad66d['id'],_0x3aa506['id']),'method':_0xba37('0x11')});case _0xba37('0x58'):logger[_0xba37('0xd')](_0xba37('0x65'),_0xba37('0x5a'));emit(util[_0xba37('0xf')](_0xba37('0x69'),_0x34ebf2[_0xba37('0x14')]),_0xba37('0x5b'),{'uri':util[_0xba37('0xf')]('%s/agent/tickets/%s',_0x4bc73f[_0xba37('0x10')][_0xba37('0x5d')](_0xba37('0x5e'),''),_0x3aa506['id'])});break;default:logger[_0xba37('0x5f')](_0xba37('0x65'),_0xba37('0x6a'));}}})[_0xba37('0x60')](function(_0x13921f){logger[_0xba37('0x5f')](_0xba37('0x6b'),util[_0xba37('0x6c')](_0x13921f,{'showHidden':!![],'depth':null}));});};exports[_0xba37('0x6d')]=function(_0x2468f2,_0x336b9f,_0x58b4ac,_0x2f7248,_0x552563,_0x58cfd0){var _0x7ae293,_0x5ac8b9;_0x58cfd0['remoteUri']=intUtil[_0xba37('0x4a')](_0x58cfd0[_0xba37('0x10')]);_0x58cfd0[_0xba37('0x4b')]=intUtil[_0xba37('0x4a')](_0x58cfd0[_0xba37('0x4b')]);if(_0x552563&&_0x552563[_0xba37('0x4c')]){logger[_0xba37('0xd')]('['+_0x336b9f[_0xba37('0x6e')][_0xba37('0x6f')]()+']',_0xba37('0x4d'));_0x336b9f[_0xba37('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x58cfd0[_0xba37('0x4b')],_0x336b9f[_0xba37('0x66')],md5(_0x336b9f[_0xba37('0x66')]));}else{_0x336b9f['recordingURL']='';}headers[_0xba37('0x67')]=getAuth(_0x58cfd0);return getUser(_0x58cfd0)[_0xba37('0x1e')](function(_0x207de0){_0x7ae293=_0x207de0;logger[_0xba37('0xd')](_0xba37('0x51'),_0x7ae293['id']);return getEndUser(_0x58cfd0,_0x336b9f[_0xba37('0x52')],_0x336b9f['calleridnum']);})[_0xba37('0x1e')](function(_0x1ad50e){_0x5ac8b9=_0x1ad50e;logger[_0xba37('0xd')](_0xba37('0x54'),_0x5ac8b9['id']);return getTicket(_0x58cfd0,_0x7ae293,_0x5ac8b9,_0x58b4ac,_0x336b9f);})[_0xba37('0x1e')](function(_0x2033b3){if(_0x2033b3){logger[_0xba37('0xd')](_0xba37('0x68'),_0x2033b3['id']);}})[_0xba37('0x60')](function(_0x41098c){logger[_0xba37('0x5f')]('['+_0x336b9f[_0xba37('0x6e')][_0xba37('0x6f')]()+']'+_0xba37('0x70'),util[_0xba37('0x6c')](_0x41098c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe66f=['includes','custom_fields','push','idField','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','integrationTab','newTab','user:%s','trigger:browser:url','replace','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','md5','util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','ticket','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','find','results','agent','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Searching\x20enduser\x20with\x20phone','%s/search.json','length','filter','end-user','first','%s/users.json','POST','Enduser\x20created.','authType','%s:%s','password','%s/token:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','string','picklist','type','nameField','customField','toLowerCase','content'];(function(_0x555ecf,_0x207d87){var _0x292667=function(_0x4e8c51){while(--_0x4e8c51){_0x555ecf['push'](_0x555ecf['shift']());}};_0x292667(++_0x207d87);}(_0xe66f,0x1da));var _0xfe66=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xe66f[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xfe66('0x0'));var util=require(_0xfe66('0x1'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xfe66('0x2'));var logger=require('../../../../config/logger')(_0xfe66('0x3'));config[_0xfe66('0x4')]=_[_0xfe66('0x5')](config[_0xfe66('0x4')],{'host':_0xfe66('0x6'),'port':0x18eb});var io=require(_0xfe66('0x7'))(new Redis(config[_0xfe66('0x4')]));function emit(_0xed4198,_0x3d8503,_0x2705a4){io['to'](_0xed4198)['emit'](_0x3d8503,_0x2705a4);}var headers={'Content-Type':_0xfe66('0x8'),'Accept':_0xfe66('0x8')};function getTicket(_0x51f8ba,_0xbefca6,_0x5eaa3c,_0x3ba73f,_0x4c1298){logger[_0xfe66('0x9')](_0xfe66('0xa'));return request({'uri':util[_0xfe66('0xb')](_0xfe66('0xc'),_0x51f8ba[_0xfe66('0xd')]),'method':'POST','body':{'ticket':_[_0xfe66('0xe')]({'requester_id':_0x5eaa3c['id'],'submitter_id':_0xbefca6?_0xbefca6['id']:undefined,'assignee_id':_0xbefca6?_0xbefca6['id']:undefined,'tags':getTags(_0x3ba73f[_0xfe66('0xf')],_0xfe66('0x10')),'subject':intUtil[_0xfe66('0x11')](_0x3ba73f[_0xfe66('0x12')],_0x4c1298,'\x20'),'description':intUtil[_0xfe66('0x11')](_0x3ba73f[_0xfe66('0x13')],_0x4c1298,'\x0a'),'comment':{'public':![],'body':intUtil[_0xfe66('0x11')](_0x3ba73f[_0xfe66('0x13')],_0x4c1298,'\x0a')}},getCustomFields(_0x3ba73f['Fields'],_0x4c1298))}})['then'](function(_0x60b436){logger['info']('Ticket\x20created!');return _0x60b436[_0xfe66('0x14')];});}function getUser(_0xd5fa8b,_0x20e40d){if(intUtil['validateEmail'](_0x20e40d)){logger[_0xfe66('0x9')](_0xfe66('0x15'),_0x20e40d);return request({'uri':util[_0xfe66('0xb')]('%s/search.json',_0xd5fa8b[_0xfe66('0xd')]),'qs':{'query':util[_0xfe66('0xb')](_0xfe66('0x16'),_0x20e40d)}})[_0xfe66('0x17')](function(_0x19c929){if(_0x19c929['count']){logger['info'](_0xfe66('0x18'));return _[_0xfe66('0x19')](_0x19c929[_0xfe66('0x1a')],{'email':_0x20e40d,'role':_0xfe66('0x1b')});}else{logger[_0xfe66('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0xd5fa8b[_0xfe66('0xd')])})[_0xfe66('0x17')](function(_0x40c351){logger[_0xfe66('0x9')](_0xfe66('0x1c'));return _0x40c351[_0xfe66('0x1d')];});}});}else{logger['info'](_0xfe66('0x1e'));return request({'uri':util[_0xfe66('0xb')](_0xfe66('0x1f'),_0xd5fa8b['remoteUri'])})['then'](function(_0x1067bd){logger[_0xfe66('0x9')]('Admin\x20account\x20selected.');return _0x1067bd[_0xfe66('0x1d')];});}}function getEndUser(_0x3de2c4,_0x2e5d3a,_0x51b56b){logger[_0xfe66('0x9')](_0xfe66('0x20'),_0x51b56b);return request({'uri':util[_0xfe66('0xb')](_0xfe66('0x21'),_0x3de2c4[_0xfe66('0xd')]),'qs':{'query':util[_0xfe66('0xb')]('type:user\x20role:end-user\x20phone:%s',_0x51b56b)}})[_0xfe66('0x17')](function(_0x9a78e3){var _0x38ddf0;if(_0x9a78e3[_0xfe66('0x1a')][_0xfe66('0x22')]){_0x9a78e3[_0xfe66('0x1a')]=_[_0xfe66('0x23')](_0x9a78e3['results'],{'suspended':![],'role':_0xfe66('0x24')});if(_0x9a78e3[_0xfe66('0x1a')][_0xfe66('0x22')]){_0x38ddf0=_[_0xfe66('0x25')](_0x9a78e3[_0xfe66('0x1a')]);}}if(_0x38ddf0){logger[_0xfe66('0x9')]('Enduser\x20found!');return _0x38ddf0;}else{logger[_0xfe66('0x9')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xfe66('0xb')](_0xfe66('0x26'),_0x3de2c4[_0xfe66('0xd')]),'method':_0xfe66('0x27'),'body':{'user':{'role':_0xfe66('0x24'),'name':util[_0xfe66('0xb')]('Caller\x20-\x20%s',_0x2e5d3a||_0x51b56b),'phone':_0x51b56b}}})[_0xfe66('0x17')](function(_0x469c67){logger[_0xfe66('0x9')](_0xfe66('0x28'));return _0x469c67[_0xfe66('0x1d')];});}});}function getAuth(_0x12e849){var _0x210ec6;if(_0x12e849[_0xfe66('0x29')]==='password'){_0x210ec6=util[_0xfe66('0xb')](_0xfe66('0x2a'),_0x12e849['username'],_0x12e849[_0xfe66('0x2b')]);}else if(_0x12e849[_0xfe66('0x29')]==='token'){_0x210ec6=util[_0xfe66('0xb')](_0xfe66('0x2c'),_0x12e849[_0xfe66('0x2d')],_0x12e849[_0xfe66('0x2e')]);}return util[_0xfe66('0xb')](_0xfe66('0x2f'),new Buffer(_0x210ec6)[_0xfe66('0x30')](_0xfe66('0x31')));}function request(_0x2a65e4){logger[_0xfe66('0x32')](_0xfe66('0x33'),JSON[_0xfe66('0x34')](_0x2a65e4));return rp(_[_0xfe66('0x5')](_0x2a65e4,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3e8d63,_0x1fb93b){var _0x2bd479=[];if(_0x3e8d63&&_0x3e8d63[_0xfe66('0x22')]>0x0){_0x2bd479=_[_0xfe66('0x35')](_0x3e8d63,_0x1fb93b);}return _0x2bd479;}function getCustomFields(_0x27b658,_0x3bd3ce){var _0x70b0a9=[];var _0x5eada7={'custom_fields':[]};if(_0x27b658[_0xfe66('0x22')]>0x0){_['forEach'](_0x27b658,function(_0x515328){if(_['includes']([_0xfe66('0x36'),_0xfe66('0x37')],_0x515328[_0xfe66('0x38')])&&_0x515328[_0xfe66('0x39')]&&!_0x515328[_0xfe66('0x3a')]){_0x5eada7[_0x515328[_0xfe66('0x39')][_0xfe66('0x3b')]()]=_0x515328[_0xfe66('0x3c')][_0xfe66('0x30')]();}else if(_[_0xfe66('0x3d')]([_0xfe66('0x36'),_0xfe66('0x37')],_0x515328[_0xfe66('0x38')])&&_0x515328['idField']&&_0x515328[_0xfe66('0x3a')]){_0x5eada7[_0xfe66('0x3e')][_0xfe66('0x3f')]({'id':_0x515328[_0xfe66('0x40')],'value':_0x515328[_0xfe66('0x3c')][_0xfe66('0x30')]()});}else if(_0x515328['type']===_0xfe66('0x41')&&_0x515328['variableName']&&_0x515328['idField']&&_0x515328[_0xfe66('0x3a')]){_0x3bd3ce[_0x515328[_0xfe66('0x42')]]&&_0x5eada7[_0xfe66('0x3e')]['push']({'id':_0x515328[_0xfe66('0x40')],'value':_0x3bd3ce[_0x515328['variableName']][_0xfe66('0x30')]()});}else if(_0x515328[_0xfe66('0x38')]==='customVariable'&&_0x515328['Variable']&&_0x515328[_0xfe66('0x43')][_0xfe66('0x10')]&&_0x515328['idField']&&_0x515328[_0xfe66('0x3a')]){_0x3bd3ce[_0x515328[_0xfe66('0x43')][_0xfe66('0x10')][_0xfe66('0x3b')]()]&&_0x5eada7[_0xfe66('0x3e')]['push']({'id':_0x515328[_0xfe66('0x40')],'value':_0x3bd3ce[_0x515328['Variable'][_0xfe66('0x10')][_0xfe66('0x3b')]()][_0xfe66('0x30')]()});}});}return _0x5eada7;}exports[_0xfe66('0x44')]=function(_0xdcfb7d,_0x1818bc,_0x2e91e3,_0x531ba8,_0x1ebc41,_0x43b13c){var _0x58b43d,_0x3f2f06;_0x43b13c[_0xfe66('0xd')]=intUtil[_0xfe66('0x45')](_0x43b13c[_0xfe66('0xd')]);_0x43b13c[_0xfe66('0x46')]=intUtil['stripTrailingSlash'](_0x43b13c[_0xfe66('0x46')]);if(_0x1ebc41&&_0x1ebc41[_0xfe66('0x47')]){logger['info'](_0xfe66('0x48'),_0xfe66('0x49'));_0x1818bc[_0xfe66('0x4a')]=util[_0xfe66('0xb')](_0xfe66('0x4b'),_0x43b13c[_0xfe66('0x46')],_0x1818bc[_0xfe66('0x4c')],md5(_0x1818bc[_0xfe66('0x4c')]));}else{_0x1818bc[_0xfe66('0x4a')]='';}headers[_0xfe66('0x4d')]=getAuth(_0x43b13c);return getUser(_0x43b13c,_0x531ba8[_0xfe66('0x4e')])['then'](function(_0x278e63){_0x58b43d=_0x278e63;logger[_0xfe66('0x9')](_0xfe66('0x4f'),_0x58b43d['id']);return getEndUser(_0x43b13c,_0x1818bc[_0xfe66('0x50')],_0x1818bc[_0xfe66('0x51')]);})[_0xfe66('0x17')](function(_0x227f6f){_0x3f2f06=_0x227f6f;logger[_0xfe66('0x9')](_0xfe66('0x52'),_0x3f2f06['id']);return getTicket(_0x43b13c,_0x58b43d,_0x3f2f06,_0x2e91e3,_0x1818bc);})[_0xfe66('0x17')](function(_0xc699ed){if(_0xc699ed){logger[_0xfe66('0x9')](_0xfe66('0x53'),_0xc699ed['id']);switch(_0x43b13c[_0xfe66('0x38')]){case'integrationTab':logger[_0xfe66('0x9')](_0xfe66('0x48'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xfe66('0xb')](_0xfe66('0x54'),_0x43b13c[_0xfe66('0xd')],_0x58b43d['id'],_0xc699ed['id']),'method':_0xfe66('0x27')});case'newTab':logger[_0xfe66('0x9')](_0xfe66('0x48'),_0xfe66('0x55'));emit(util[_0xfe66('0xb')]('user:%s',_0x531ba8[_0xfe66('0x10')]),'trigger:browser:url',{'uri':util[_0xfe66('0xb')](_0xfe66('0x56'),_0x43b13c[_0xfe66('0xd')]['replace']('/api/v2',''),_0xc699ed['id'])});break;default:logger[_0xfe66('0x57')](_0xfe66('0x48'),_0xfe66('0x58'));}}})[_0xfe66('0x59')](function(_0x3e3801){logger['error'](_0xfe66('0x5a'),util[_0xfe66('0x5b')](_0x3e3801,{'showHidden':!![],'depth':null}));});};exports[_0xfe66('0x5c')]=function(_0xb738d8,_0x1abd5e,_0x5bb960,_0x38fedc,_0x475853,_0x789bed,_0x42dd30){var _0x2f3df5,_0x145ed2;_0x789bed[_0xfe66('0xd')]=intUtil[_0xfe66('0x45')](_0x789bed[_0xfe66('0xd')]);_0x789bed[_0xfe66('0x46')]=intUtil['stripTrailingSlash'](_0x789bed[_0xfe66('0x46')]);if(_0x42dd30&&_0x42dd30[_0xfe66('0x5d')]&&_0x42dd30[_0xfe66('0x5d')]!==_0xfe66('0x5e')){logger[_0xfe66('0x9')](_0xfe66('0x5f'),_0xfe66('0x49'));_0x1abd5e[_0xfe66('0x4a')]=util[_0xfe66('0xb')](_0xfe66('0x4b'),_0x789bed[_0xfe66('0x46')],_0x1abd5e['uniqueid'],md5(_0x1abd5e[_0xfe66('0x4c')]));}headers['Authorization']=getAuth(_0x789bed);return getUser(_0x789bed,_0x38fedc['email'])[_0xfe66('0x17')](function(_0x19750a){_0x2f3df5=_0x19750a;logger[_0xfe66('0x9')](_0xfe66('0x4f'),_0x2f3df5['id']);return getEndUser(_0x789bed,_0x1abd5e[_0xfe66('0x60')],_0x1abd5e['destcalleridnum']);})[_0xfe66('0x17')](function(_0x57fca0){_0x145ed2=_0x57fca0;logger[_0xfe66('0x9')](_0xfe66('0x52'),_0x145ed2['id']);return getTicket(_0x789bed,_0x2f3df5,_0x145ed2,_0x5bb960,_0x1abd5e);})[_0xfe66('0x17')](function(_0x1fec16){if(_0x1fec16){logger[_0xfe66('0x9')](_0xfe66('0x53'),_0x1fec16['id']);switch(_0x789bed[_0xfe66('0x38')]){case _0xfe66('0x61'):logger[_0xfe66('0x9')](_0xfe66('0x5f'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xfe66('0xb')](_0xfe66('0x54'),_0x789bed[_0xfe66('0xd')],_0x2f3df5['id'],_0x1fec16['id']),'method':_0xfe66('0x27')});case _0xfe66('0x62'):logger[_0xfe66('0x9')](_0xfe66('0x5f'),_0xfe66('0x55'));emit(util['format'](_0xfe66('0x63'),_0x38fedc['name']),_0xfe66('0x64'),{'uri':util['format'](_0xfe66('0x56'),_0x789bed[_0xfe66('0xd')][_0xfe66('0x65')](_0xfe66('0x66'),''),_0x1fec16['id'])});break;default:logger[_0xfe66('0x57')](_0xfe66('0x5f'),_0xfe66('0x58'));}}})['catch'](function(_0x1919a2){logger[_0xfe66('0x57')](_0xfe66('0x67'),util[_0xfe66('0x5b')](_0x1919a2,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x40d477,_0x5f1483,_0x465d50,_0x2b6cf1,_0x3f619f,_0x3a2fc0){var _0x260b74,_0x502aaa;_0x3a2fc0[_0xfe66('0xd')]=intUtil[_0xfe66('0x45')](_0x3a2fc0[_0xfe66('0xd')]);_0x3a2fc0[_0xfe66('0x46')]=intUtil['stripTrailingSlash'](_0x3a2fc0[_0xfe66('0x46')]);if(_0x3f619f&&_0x3f619f[_0xfe66('0x47')]){logger[_0xfe66('0x9')]('['+_0x5f1483[_0xfe66('0x68')]['toUpperCase']()+']',_0xfe66('0x49'));_0x5f1483[_0xfe66('0x4a')]=util['format'](_0xfe66('0x4b'),_0x3a2fc0[_0xfe66('0x46')],_0x5f1483['uniqueid'],md5(_0x5f1483[_0xfe66('0x4c')]));}else{_0x5f1483['recordingURL']='';}headers[_0xfe66('0x4d')]=getAuth(_0x3a2fc0);return getUser(_0x3a2fc0)[_0xfe66('0x17')](function(_0x14223e){_0x260b74=_0x14223e;logger[_0xfe66('0x9')](_0xfe66('0x4f'),_0x260b74['id']);return getEndUser(_0x3a2fc0,_0x5f1483[_0xfe66('0x50')],_0x5f1483[_0xfe66('0x51')]);})[_0xfe66('0x17')](function(_0x87e6d8){_0x502aaa=_0x87e6d8;logger[_0xfe66('0x9')](_0xfe66('0x52'),_0x502aaa['id']);return getTicket(_0x3a2fc0,_0x260b74,_0x502aaa,_0x465d50,_0x5f1483);})['then'](function(_0x388324){if(_0x388324){logger[_0xfe66('0x9')](_0xfe66('0x53'),_0x388324['id']);}})[_0xfe66('0x59')](function(_0x35ddb9){logger[_0xfe66('0x57')]('['+_0x5f1483[_0xfe66('0x68')][_0xfe66('0x69')]()+']'+_0xfe66('0x6a'),util[_0xfe66('0x5b')](_0x35ddb9,{'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 849e7a8..474948f 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 _0x05d9=['variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','https://www.zohoapis.','role','first_name','last_name','data','code','SUCCESS','enduserType','log','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','moduleCreate','lead','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','diff','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','Call_Type','Inbound','/crm/v2/Calls','err','queue','host','serverUrl','stripTrailingSlash','[QUEUE]','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','user:%s','unmanaged','monitor_format','toUpperCase','Recording\x20is\x20enabled!','recordingURL','calleridnum','lodash','request-promise','md5','util','./util','moment','ioredis','../../../../config/environment','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','length','forEach','includes','string','picklist','type','idField','toString','variable'];(function(_0x5e421b,_0x3dd0f4){var _0x1c7fa1=function(_0x2e451d){while(--_0x2e451d){_0x5e421b['push'](_0x5e421b['shift']());}};_0x1c7fa1(++_0x3dd0f4);}(_0x05d9,0x1b3));var _0x905d=function(_0x193113,_0x44166a){_0x193113=_0x193113-0x0;var _0x387f99=_0x05d9[_0x193113];return _0x387f99;};'use strict';var _=require(_0x905d('0x0'));var rp=require(_0x905d('0x1'));var md5=require(_0x905d('0x2'));var util=require(_0x905d('0x3'));var intUtil=require(_0x905d('0x4'));var moment=require(_0x905d('0x5'));var Redis=require(_0x905d('0x6'));var BPromise=require('bluebird');var config=require(_0x905d('0x7'));var logger=require('../../../../config/logger')(_0x905d('0x8'));config[_0x905d('0x9')]=_['defaults'](config[_0x905d('0x9')],{'host':_0x905d('0xa'),'port':0x18eb});var io=require(_0x905d('0xb'))(new Redis(config[_0x905d('0x9')]));function emit(_0x37ee2f,_0x1afd41,_0x26643a){io['to'](_0x37ee2f)[_0x905d('0xc')](_0x1afd41,_0x26643a);}function request(_0x4ceb60){logger[_0x905d('0xd')](_0x905d('0xe'),JSON['stringify'](_0x4ceb60));return rp(_0x4ceb60);}function getCustomFields(_0x45bb19,_0x520305){var _0x110ca7={};if(_0x45bb19[_0x905d('0xf')]>0x0){_[_0x905d('0x10')](_0x45bb19,function(_0x1282ff){if(_[_0x905d('0x11')]([_0x905d('0x12'),_0x905d('0x13')],_0x1282ff[_0x905d('0x14')])&&_0x1282ff[_0x905d('0x15')]){_0x110ca7[_0x1282ff[_0x905d('0x15')]]=_0x1282ff['content'][_0x905d('0x16')]();}else if(_0x1282ff[_0x905d('0x14')]===_0x905d('0x17')&&_0x1282ff['variableName']&&_0x1282ff[_0x905d('0x15')]&&_0x520305[_0x1282ff[_0x905d('0x18')]]){_0x110ca7[_0x1282ff[_0x905d('0x15')]]=_0x520305[_0x1282ff['variableName']]['toString']();}else if(_0x1282ff[_0x905d('0x14')]===_0x905d('0x19')&&_0x1282ff[_0x905d('0x1a')]&&_0x1282ff['Variable'][_0x905d('0x1b')]&&_0x1282ff[_0x905d('0x15')]&&_0x520305[_0x1282ff['Variable'][_0x905d('0x1b')][_0x905d('0x1c')]()]){_0x110ca7[_0x1282ff[_0x905d('0x15')]]=_0x520305[_0x1282ff[_0x905d('0x1a')][_0x905d('0x1b')][_0x905d('0x1c')]()]['toString']();}});}return _0x110ca7;}function getName(_0x5a1866){if(_0x5a1866[_0x905d('0x1d')]('\x20')>0x0){var _0x4620b2=_0x5a1866['split'](/ (.+)/);if(_0x4620b2[0x1]){return _0x4620b2;}}return[_0x5a1866,_0x5a1866];}var accountsTokens={};function getAccessToken(_0x34a891){return new Promise(function(_0x45523d,_0x24b502){if(!_[_0x905d('0x1e')](accountsTokens[_0x34a891['id']])&&!_[_0x905d('0x1e')](accountsTokens[_0x34a891['id']][_0x905d('0x1f')])){if(moment()[_0x905d('0x20')](accountsTokens[_0x34a891['id']][_0x905d('0x21')])){_0x45523d(accountsTokens[_0x34a891['id']]['access_token']);}}var _0x821110;switch(_0x34a891[_0x905d('0x22')]){case'US':_0x821110=_0x905d('0x23');break;case'AU':_0x821110=_0x905d('0x24');break;case'EU':_0x821110=_0x905d('0x25');break;case'IN':_0x821110=_0x905d('0x26');break;case'CN':_0x821110=_0x905d('0x27');break;default:_0x821110=_0x905d('0x25');break;}var _0x21b604={'method':_0x905d('0x28'),'uri':_0x821110+_0x905d('0x29'),'qs':{'refresh_token':_0x34a891['refreshToken'],'client_id':_0x34a891[_0x905d('0x2a')],'client_secret':_0x34a891[_0x905d('0x2b')],'grant_type':_0x905d('0x2c')},'json':!![]};return rp(_0x21b604)[_0x905d('0x2d')](function(_0x329cba){accountsTokens[_0x34a891['id']]={'access_token':_0x329cba[_0x905d('0x1f')],'expires_in':moment()['add'](_0x329cba['expires_in'],_0x905d('0x2e'))};_0x45523d(_0x329cba[_0x905d('0x1f')]);})[_0x905d('0x2f')](function(_0x424c3c){logger[_0x905d('0x30')](_0x905d('0x31'),_0x424c3c[_0x905d('0x32')]);_0x24b502(_0x424c3c);});});}function getUser(_0xfeedee,_0x214bf6,_0xf47300,_0x274dfd){logger['info'](_0x905d('0x33'));return request({'method':'GET','uri':util[_0x905d('0x34')](_0x905d('0x35'),_0x214bf6),'qs':{'type':_0x905d('0x36')},'headers':{'Authorization':_0x905d('0x37')+_0xfeedee},'json':!![]})[_0x905d('0x2d')](function(_0x12912a){if(_0x12912a['users']){var _0x10246f=-0x1;if(_['isArrayLikeObject'](_0x12912a[_0x905d('0x38')])){if(!_[_0x905d('0x1e')](_0x274dfd)){_0x10246f=_[_0x905d('0x39')](_0x12912a[_0x905d('0x38')],function(_0x1c637b){return _0x1c637b[_0x905d('0x3a')]===_0x274dfd;});}if(_0x10246f>=0x0){logger[_0x905d('0x3b')](_0x905d('0x3c'));}else{logger['info'](_0x905d('0x3d'));_0x10246f=_[_0x905d('0x39')](_0x12912a['users'],function(_0x5e4b0e){return _0x5e4b0e[_0x905d('0x3e')][_0x905d('0x1b')]==='Administrator';});}return _0x12912a[_0x905d('0x38')][_0x10246f];}else{if(_0x12912a[_0x905d('0x3f')]['profile'][_0x905d('0x1b')]==='Administrator'){logger[_0x905d('0x3b')](_0x905d('0x3d'));user=_0x12912a[_0x905d('0x3f')];return user;}else{logger[_0x905d('0x30')](_0x905d('0x40'),JSON[_0x905d('0x41')](_0x12912a));throw new Error(_0x905d('0x42')+JSON['stringify'](_0x12912a));}}}else{logger[_0x905d('0x30')](_0x905d('0x40'),JSON['stringify'](_0x12912a));throw new Error(_0x905d('0x42')+JSON[_0x905d('0x41')](_0x12912a));}})[_0x905d('0x2f')](function(_0x36eb55){console[_0x905d('0x30')](_0x36eb55);});}function getZohoUser(_0x356dd2,_0x280f15){return new BPromise(function(_0x3add27,_0x1b8de3){request(_0x356dd2)[_0x905d('0x2d')](function(_0x1b61ff){var _0x33e16d=null;if(_0x1b61ff){_0x33e16d=_0x1b61ff['data'][0x0];_0x33e16d['enduserType']=_0x280f15;}_0x3add27(_0x33e16d);})[_0x905d('0x2f')](function(_0x292649){_0x1b8de3(_0x292649);});});}function createEndUser(_0x20dc8e,_0x24e1c4,_0x5d2a8f,_0x2d7e3b,_0x36906d,_0x520a47){var _0x5d2a8f=getName(_0x5d2a8f);return request({'method':_0x905d('0x28'),'uri':_0x905d('0x43')+_0x24e1c4+'/crm/v2/'+_['startCase'](_0x520a47['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5d2a8f[0x1],'First_Name':_0x5d2a8f[0x0],'Phone':_0x2d7e3b,'Owner':{'name':!_[_0x905d('0x1e')](_0x36906d[_0x905d('0x44')]['name'])?_0x36906d[_0x905d('0x44')][_0x905d('0x1b')]:!_[_0x905d('0x1e')](_0x36906d[_0x905d('0x45')])?_0x36906d[_0x905d('0x45')]+'\x20'+_0x36906d['last_name']:_0x36906d[_0x905d('0x46')],'id':_0x36906d['id']}}]},'headers':{'Authorization':_0x905d('0x37')+_0x20dc8e},'json':!![]})[_0x905d('0x2d')](function(_0xbec1a8){if(_0xbec1a8&&_0xbec1a8[_0x905d('0x47')][0x0][_0x905d('0x48')]===_0x905d('0x49')){var _0xedb1de=_0xbec1a8[_0x905d('0x47')][0x0]['details'];_0xedb1de[_0x905d('0x4a')]=_['startCase'](_0x520a47['moduleCreate'])+'s';return _0xedb1de;}logger['error'](_0x905d('0x40'),JSON[_0x905d('0x41')](data));throw new Error('Error:\x20'+JSON[_0x905d('0x41')](data));})[_0x905d('0x2f')](function(_0x5152b9){console[_0x905d('0x4b')]('CREATE\x20ERROR',_0x5152b9);});}function getEndUser(_0x29167a,_0xd35a01,_0x2e0e37,_0x5b5af9,_0x3fc5f9,_0x107c2c,_0x4d9ddd){var _0xac4dd0={'method':_0x905d('0x4c'),'uri':'','headers':{'Authorization':_0x905d('0x37')+_0x29167a},'json':!![]};switch(_0x4d9ddd[_0x905d('0x4d')]){case _0x905d('0x4e'):_0xac4dd0[_0x905d('0x4f')]=_0x905d('0x43')+_0xd35a01+_0x905d('0x50')+_0x3fc5f9+'))';return getZohoUser(_0xac4dd0,'Contacts')['then'](function(_0xf6e0e2){if(_0xf6e0e2)return _0xf6e0e2;_0xac4dd0[_0x905d('0x4f')]=_0x905d('0x43')+_0xd35a01+_0x905d('0x51')+_0x3fc5f9+'))';return getZohoUser(_0xac4dd0,_0x905d('0x52'))[_0x905d('0x2d')](function(_0x197e2e){if(_0x197e2e)return _0x197e2e;if(_0x4d9ddd['moduleCreate']!=_0x905d('0x53')){return createEndUser(_0x29167a,_0xd35a01,_0x5b5af9,_0x3fc5f9,_0x107c2c,_0x4d9ddd);}else{return{};}});});break;case _0x905d('0x54'):_0xac4dd0[_0x905d('0x4f')]=_0x905d('0x43')+_0xd35a01+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3fc5f9+'))';return getZohoUser(_0xac4dd0,_0x905d('0x55'))['then'](function(_0x4901d6){if(_0x4901d6)return _0x4901d6;if(_0x4d9ddd[_0x905d('0x56')]!=_0x905d('0x53')){return createEndUser(_0x29167a,_0xd35a01,_0x5b5af9,_0x3fc5f9,_0x107c2c,_0x4d9ddd);}else{return{};}});break;case _0x905d('0x57'):_0xac4dd0[_0x905d('0x4f')]=_0x905d('0x43')+_0xd35a01+_0x905d('0x51')+_0x3fc5f9+'))';return getZohoUser(_0xac4dd0,_0x905d('0x52'))[_0x905d('0x2d')](function(_0x41cbc6){if(_0x41cbc6)return _0x41cbc6;if(_0x4d9ddd['moduleCreate']!='nothing'){return createEndUser(_0x29167a,_0xd35a01,_0x5b5af9,_0x3fc5f9,_0x107c2c,_0x4d9ddd);}else{return{};}});break;}}function getCall(_0x4b35d1,_0x5e847e,_0x4c9e40,_0x2ca498,_0x26e8da,_0x254be6,_0xcc3772,_0x25e5a9){logger['info'](_0x905d('0x58'));var _0x333146={};_0x333146[_0x905d('0x59')]={'name':!_[_0x905d('0x1e')](_0x2ca498[_0x905d('0x44')]['name'])&&!_[_0x905d('0x1e')](_0x2ca498[_0x905d('0x3e')][_0x905d('0x1b')])&&_0x2ca498['profile'][_0x905d('0x1b')]===_0x905d('0x5a')?_0x2ca498[_0x905d('0x44')][_0x905d('0x1b')]:!_['isNil'](_0x2ca498[_0x905d('0x45')])?_0x2ca498[_0x905d('0x45')]+'\x20'+_0x2ca498[_0x905d('0x46')]:_0x2ca498['last_name'],'id':_0x2ca498['id']};_0x333146['Subject']=intUtil[_0x905d('0x5b')](_0x254be6[_0x905d('0x5c')],_0xcc3772,'\x20');_0x333146[_0x905d('0x5d')]=intUtil[_0x905d('0x5b')](_0x254be6['Descriptions'],_0xcc3772,'\x0a');if(_0x26e8da[_0x905d('0x4a')]===_0x905d('0x55')){_0x333146[_0x905d('0x5e')]={'name':!_[_0x905d('0x1e')](_0x26e8da[_0x905d('0x5f')])?_0x26e8da[_0x905d('0x5f')]:!_[_0x905d('0x1e')](_0x26e8da[_0x905d('0x60')])?_0x26e8da[_0x905d('0x60')]+'\x20'+_0x26e8da[_0x905d('0x61')]:_0x26e8da[_0x905d('0x61')],'id':_0x26e8da['id']};}if(_0x26e8da[_0x905d('0x4a')]===_0x905d('0x52')){_0x333146[_0x905d('0x62')]={'name':!_[_0x905d('0x1e')](_0x26e8da[_0x905d('0x5f')])?_0x26e8da[_0x905d('0x5f')]:!_[_0x905d('0x1e')](_0x26e8da[_0x905d('0x60')])?_0x26e8da['First_Name']+'\x20'+_0x26e8da[_0x905d('0x61')]:_0x26e8da[_0x905d('0x61')],'id':_0x26e8da['id']};_0x333146[_0x905d('0x63')]=_['startCase'](_0x26e8da[_0x905d('0x4a')]);}if(_0xcc3772['talktime']){_0x333146[_0x905d('0x64')]=moment[_0x905d('0x65')](parseInt(_0xcc3772[_0x905d('0x66')])*0x3e8)[_0x905d('0x34')](_0x905d('0x67'));}else if(_0xcc3772[_0x905d('0x68')]&&_0xcc3772[_0x905d('0x69')]){_0x333146[_0x905d('0x64')]=moment[_0x905d('0x65')](moment(_0xcc3772[_0x905d('0x69')],'YYYY-MM-DDTHH:mm:ss')[_0x905d('0x6a')](moment(_0xcc3772['starttime'],_0x905d('0x6b'))))[_0x905d('0x34')](_0x905d('0x67'));}switch(_0xcc3772[_0x905d('0x6c')]){case _0x905d('0x6d'):_0x333146[_0x905d('0x6e')]=_0x905d('0x6f');break;case'complete':case _0x905d('0x70'):_0x333146[_0x905d('0x6e')]=_0x905d('0x71');break;case _0x905d('0x72'):_0x333146[_0x905d('0x6e')]=_0x905d('0x73');break;case _0x905d('0x74'):_0x333146[_0x905d('0x6e')]=_0x905d('0x75');break;case _0x905d('0x76'):_0x333146['Call_Result']=_0x905d('0x77');default:}_0x333146['Call_Start_Time']=(_0x25e5a9===_0x905d('0x78')?moment(_0xcc3772['starttime'])['format'](_0x905d('0x6b')):moment(_0xcc3772['agentcalledAt'])[_0x905d('0x34')](_0x905d('0x6b')))||moment()[_0x905d('0x34')]('YYYY-MM-DDTHH:mm:ss');_0x333146[_0x905d('0x79')]=_0x25e5a9||_0x905d('0x7a');_0x333146=_['merge'](_0x333146,getCustomFields(_0x254be6['Fields'],_0xcc3772));return request({'method':_0x905d('0x28'),'uri':_0x905d('0x43')+_0x5e847e+_0x905d('0x7b'),'headers':{'Authorization':_0x905d('0x37')+_0x4b35d1},'body':{'data':[_0x333146]},'json':!![]})[_0x905d('0x2d')](function(_0x52467d){if(_0x52467d&&_0x52467d[_0x905d('0x47')][0x0]['code']===_0x905d('0x49')){logger[_0x905d('0x3b')]('Call\x20created!');return{'id':_0x52467d[_0x905d('0x47')][0x0]['details']['id']};}})[_0x905d('0x2f')](function(_0x5affbe){logger[_0x905d('0x3b')](_0x905d('0x7c'),_0x5affbe[_0x905d('0x32')]);console[_0x905d('0x4b')](_0x905d('0x7c'),_0x5affbe);});}exports[_0x905d('0x7d')]=function(_0x9e78b3,_0x42c444,_0x3cf82d,_0x116bed,_0xe12dbf,_0x3dc912){var _0x4186d0,_0x30d70f,_0x8d2496;_0x3dc912['host']=intUtil['stripTrailingSlash'](_0x3dc912[_0x905d('0x7e')]);_0x3dc912[_0x905d('0x7f')]=intUtil[_0x905d('0x80')](_0x3dc912[_0x905d('0x7f')]);if(_0xe12dbf&&_0xe12dbf['monitor_format']){logger[_0x905d('0x3b')](_0x905d('0x81'),'Recording\x20is\x20enabled!');_0x42c444['recordingURL']=_0x3dc912[_0x905d('0x7f')]+_0x905d('0x82')+_0x42c444[_0x905d('0x83')]+_0x905d('0x84')+md5(_0x42c444[_0x905d('0x83')]);}else{_0x42c444['recordingURL']='';}var _0x4c93a7=_0x3dc912[_0x905d('0x7e')]===_0x905d('0x85')?'eu':_0x905d('0x86');return getAccessToken(_0x3dc912)[_0x905d('0x2d')](function(_0x2830a2){_0x8d2496=_0x2830a2;return getUser(_0x8d2496,_0x4c93a7,_0x3dc912,_0x116bed[_0x905d('0x3a')]);})[_0x905d('0x2d')](function(_0x18dfb4){_0x4186d0=_0x18dfb4;logger['info'](_0x905d('0x87'),_0x4186d0['id']);return getEndUser(_0x8d2496,_0x4c93a7,_0x3dc912,_0x42c444['calleridname'],_0x42c444['calleridnum'],_0x4186d0,_0x3cf82d);})[_0x905d('0x2d')](function(_0x1bc167){_0x30d70f=_0x1bc167;return getCall(_0x8d2496,_0x4c93a7,_0x3dc912,_0x4186d0,_0x30d70f,_0x3cf82d,_0x42c444,'Inbound');})[_0x905d('0x2d')](function(_0x2d9afd){if(_0x2d9afd){logger[_0x905d('0x3b')](_0x905d('0x88'),_0x2d9afd['id']);logger[_0x905d('0x3b')]('[QUEUE]',_0x905d('0x89'));emit(util['format']('user:%s',_0x116bed['name']),_0x905d('0x8a'),{'uri':_0x905d('0x8b')+_0x3dc912[_0x905d('0x7e')]+_0x905d('0x8c')+_0x2d9afd['id']});}})[_0x905d('0x2f')](function(_0x53acbc){logger[_0x905d('0x30')](_0x905d('0x81'),JSON[_0x905d('0x41')](_0x53acbc));});};exports[_0x905d('0x78')]=function(_0x491f22,_0x5208b8,_0x35a6b7,_0x4603a8,_0x214b30,_0x4e4a6a,_0x280e75){var _0x5e656f,_0xe6277b,_0x2ce752;_0x4e4a6a[_0x905d('0x7e')]=intUtil[_0x905d('0x80')](_0x4e4a6a['host']);_0x4e4a6a[_0x905d('0x7f')]=intUtil[_0x905d('0x80')](_0x4e4a6a['serverUrl']);if(_0x280e75&&_0x280e75[_0x905d('0x8d')]&&_0x280e75[_0x905d('0x8d')]!==_0x905d('0x8e')){logger[_0x905d('0x3b')](_0x905d('0x8f'),'Recording\x20is\x20enabled!');_0x5208b8['recordingURL']=_0x4e4a6a[_0x905d('0x7f')]+_0x905d('0x82')+_0x5208b8['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x5208b8['uniqueid']);}var _0x253db9=_0x4e4a6a['host']==='zoho.eu'?'eu':_0x905d('0x86');return getAccessToken(_0x4e4a6a)['then'](function(_0x24fab5){_0x2ce752=_0x24fab5;return getUser(_0x2ce752,_0x253db9,_0x4e4a6a,_0x4603a8[_0x905d('0x3a')]);})['then'](function(_0x333758){_0x5e656f=_0x333758;logger[_0x905d('0x3b')](_0x905d('0x87'),_0x5e656f['id']);return getEndUser(_0x2ce752,_0x253db9,_0x4e4a6a,_0x5208b8[_0x905d('0x90')],_0x5208b8['destcalleridnum'],_0x5e656f,_0x35a6b7);})[_0x905d('0x2d')](function(_0x40be5f){_0xe6277b=_0x40be5f;return getCall(_0x2ce752,_0x253db9,_0x4e4a6a,_0x5e656f,_0xe6277b,_0x35a6b7,_0x5208b8,_0x905d('0x91'));})[_0x905d('0x2d')](function(_0x359c74){if(_0x359c74){logger[_0x905d('0x3b')](_0x905d('0x88'),_0x359c74['id']);logger[_0x905d('0x3b')](_0x905d('0x8f'),_0x905d('0x89'));emit(util[_0x905d('0x34')](_0x905d('0x92'),_0x4603a8[_0x905d('0x1b')]),'trigger:browser:url',{'uri':'https://crm.'+_0x4e4a6a[_0x905d('0x7e')]+_0x905d('0x8c')+_0x359c74['id']});}})[_0x905d('0x2f')](function(_0x2f7c33){logger[_0x905d('0x30')](_0x905d('0x8f'),JSON['stringify'](_0x2f7c33));});};exports[_0x905d('0x93')]=function(_0x2c347e,_0x518fab,_0x1a8fe8,_0x2abddf,_0x2213c9,_0x1d66e3){var _0x2ce2fe,_0x289914,_0x5bc96a;_0x1d66e3[_0x905d('0x7e')]=intUtil[_0x905d('0x80')](_0x1d66e3[_0x905d('0x7e')]);_0x1d66e3[_0x905d('0x7f')]=intUtil[_0x905d('0x80')](_0x1d66e3['serverUrl']);if(_0x2213c9&&_0x2213c9[_0x905d('0x94')]){logger[_0x905d('0x3b')]('['+_0x518fab[_0x905d('0x6c')][_0x905d('0x95')]()+']',_0x905d('0x96'));_0x518fab['recordingURL']=_0x1d66e3[_0x905d('0x7f')]+'/api/voice/recordings/'+_0x518fab[_0x905d('0x83')]+_0x905d('0x84')+md5(_0x518fab[_0x905d('0x83')]);}else{_0x518fab[_0x905d('0x97')]='';}var _0x3edefe=_0x1d66e3['host']===_0x905d('0x85')?'eu':'com';return getAccessToken(_0x1d66e3)[_0x905d('0x2d')](function(_0x604d62){_0x5bc96a=_0x604d62;return getUser(_0x5bc96a,_0x3edefe,_0x1d66e3);})['then'](function(_0xac4e6e){_0x2ce2fe=_0xac4e6e;logger[_0x905d('0x3b')]('The\x20User\x20ID\x20is:',_0x2ce2fe['id']);return getEndUser(_0x5bc96a,_0x3edefe,_0x1d66e3,_0x518fab['calleridname'],_0x518fab[_0x905d('0x98')],_0x2ce2fe,_0x1a8fe8);})[_0x905d('0x2d')](function(_0x4d6416){_0x289914=_0x4d6416;return getCall(_0x5bc96a,_0x3edefe,_0x1d66e3,_0x2ce2fe,_0x289914,_0x1a8fe8,_0x518fab,_0x905d('0x7a'));})[_0x905d('0x2d')](function(_0x20bad7){if(_0x20bad7){logger['info']('The\x20Call\x20ID\x20is:',_0x20bad7['id']);}})[_0x905d('0x2f')](function(_0x48dc43){logger[_0x905d('0x30')]('['+_0x518fab['lastevent'][_0x905d('0x95')]()+']',JSON['stringify'](_0x48dc43));});}; \ No newline at end of file +var _0xbd5b=['variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','then','add','seconds','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','enduserType','POST','https://www.zohoapis.','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','err','queue','stripTrailingSlash','host','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','unmanaged','monitor_format','toUpperCase','request-promise','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','socket.io-emitter','emit','[HTTP]','stringify','includes','string','picklist','idField','toString','type','variable'];(function(_0xc36691,_0x221292){var _0x46e95a=function(_0x16b0f9){while(--_0x16b0f9){_0xc36691['push'](_0xc36691['shift']());}};_0x46e95a(++_0x221292);}(_0xbd5b,0x124));var _0xbbd5=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0xbd5b[_0x584291];return _0x4e7d08;};'use strict';var _=require('lodash');var rp=require(_0xbbd5('0x0'));var md5=require('md5');var util=require('util');var intUtil=require(_0xbbd5('0x1'));var moment=require('moment');var Redis=require(_0xbbd5('0x2'));var BPromise=require(_0xbbd5('0x3'));var config=require(_0xbbd5('0x4'));var logger=require(_0xbbd5('0x5'))(_0xbbd5('0x6'));config['redis']=_[_0xbbd5('0x7')](config[_0xbbd5('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xbbd5('0x9'))(new Redis(config[_0xbbd5('0x8')]));function emit(_0x3b4389,_0x244583,_0x30d5c1){io['to'](_0x3b4389)[_0xbbd5('0xa')](_0x244583,_0x30d5c1);}function request(_0x21b701){logger['debug'](_0xbbd5('0xb'),JSON[_0xbbd5('0xc')](_0x21b701));return rp(_0x21b701);}function getCustomFields(_0x5769d9,_0x27b958){var _0x18bf65={};if(_0x5769d9['length']>0x0){_['forEach'](_0x5769d9,function(_0x323cec){if(_[_0xbbd5('0xd')]([_0xbbd5('0xe'),_0xbbd5('0xf')],_0x323cec['type'])&&_0x323cec['idField']){_0x18bf65[_0x323cec[_0xbbd5('0x10')]]=_0x323cec['content'][_0xbbd5('0x11')]();}else if(_0x323cec[_0xbbd5('0x12')]===_0xbbd5('0x13')&&_0x323cec[_0xbbd5('0x14')]&&_0x323cec[_0xbbd5('0x10')]&&_0x27b958[_0x323cec[_0xbbd5('0x14')]]){_0x18bf65[_0x323cec[_0xbbd5('0x10')]]=_0x27b958[_0x323cec[_0xbbd5('0x14')]][_0xbbd5('0x11')]();}else if(_0x323cec[_0xbbd5('0x12')]===_0xbbd5('0x15')&&_0x323cec['Variable']&&_0x323cec[_0xbbd5('0x16')][_0xbbd5('0x17')]&&_0x323cec[_0xbbd5('0x10')]&&_0x27b958[_0x323cec[_0xbbd5('0x16')][_0xbbd5('0x17')][_0xbbd5('0x18')]()]){_0x18bf65[_0x323cec[_0xbbd5('0x10')]]=_0x27b958[_0x323cec['Variable'][_0xbbd5('0x17')]['toLowerCase']()][_0xbbd5('0x11')]();}});}return _0x18bf65;}function getName(_0x5d0993){if(_0x5d0993[_0xbbd5('0x19')]('\x20')>0x0){var _0x448e04=_0x5d0993['split'](/ (.+)/);if(_0x448e04[0x1]){return _0x448e04;}}return[_0x5d0993,_0x5d0993];}var accountsTokens={};function getAccessToken(_0x319fe6){return new Promise(function(_0x81148e,_0x52bfbc){if(!_[_0xbbd5('0x1a')](accountsTokens[_0x319fe6['id']])&&!_[_0xbbd5('0x1a')](accountsTokens[_0x319fe6['id']]['access_token'])){if(moment()[_0xbbd5('0x1b')](accountsTokens[_0x319fe6['id']][_0xbbd5('0x1c')])){_0x81148e(accountsTokens[_0x319fe6['id']][_0xbbd5('0x1d')]);}}var _0x25663b;switch(_0x319fe6[_0xbbd5('0x1e')]){case'US':_0x25663b=_0xbbd5('0x1f');break;case'AU':_0x25663b=_0xbbd5('0x20');break;case'EU':_0x25663b=_0xbbd5('0x21');break;case'IN':_0x25663b=_0xbbd5('0x22');break;case'CN':_0x25663b=_0xbbd5('0x23');break;default:_0x25663b=_0xbbd5('0x21');break;}var _0x4f083a={'method':'POST','uri':_0x25663b+_0xbbd5('0x24'),'qs':{'refresh_token':_0x319fe6['refreshToken'],'client_id':_0x319fe6[_0xbbd5('0x25')],'client_secret':_0x319fe6['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4f083a)[_0xbbd5('0x26')](function(_0x2a1f1a){accountsTokens[_0x319fe6['id']]={'access_token':_0x2a1f1a[_0xbbd5('0x1d')],'expires_in':moment()[_0xbbd5('0x27')](_0x2a1f1a[_0xbbd5('0x1c')],_0xbbd5('0x28'))};_0x81148e(_0x2a1f1a[_0xbbd5('0x1d')]);})[_0xbbd5('0x29')](function(_0x3eb6d1){logger[_0xbbd5('0x2a')]('Failing\x20creating\x20the\x20access_token',_0x3eb6d1[_0xbbd5('0x2b')]);_0x52bfbc(_0x3eb6d1);});});}function getUser(_0x17ea31,_0x49b75d,_0x33f9ee,_0x24e6e3){logger[_0xbbd5('0x2c')](_0xbbd5('0x2d'));return request({'method':_0xbbd5('0x2e'),'uri':util[_0xbbd5('0x2f')](_0xbbd5('0x30'),_0x49b75d),'qs':{'type':_0xbbd5('0x31')},'headers':{'Authorization':_0xbbd5('0x32')+_0x17ea31},'json':!![]})[_0xbbd5('0x26')](function(_0x253d43){if(_0x253d43[_0xbbd5('0x33')]){var _0x2c46c9=-0x1;if(_[_0xbbd5('0x34')](_0x253d43[_0xbbd5('0x33')])){if(!_[_0xbbd5('0x1a')](_0x24e6e3)){_0x2c46c9=_[_0xbbd5('0x35')](_0x253d43[_0xbbd5('0x33')],function(_0x530225){return _0x530225[_0xbbd5('0x36')]===_0x24e6e3;});}if(_0x2c46c9>=0x0){logger[_0xbbd5('0x2c')](_0xbbd5('0x37'));}else{logger[_0xbbd5('0x2c')](_0xbbd5('0x38'));_0x2c46c9=_[_0xbbd5('0x35')](_0x253d43[_0xbbd5('0x33')],function(_0x3b07db){return _0x3b07db[_0xbbd5('0x39')][_0xbbd5('0x17')]===_0xbbd5('0x3a');});}return _0x253d43['users'][_0x2c46c9];}else{if(_0x253d43[_0xbbd5('0x3b')][_0xbbd5('0x39')][_0xbbd5('0x17')]==='Administrator'){logger[_0xbbd5('0x2c')](_0xbbd5('0x38'));user=_0x253d43[_0xbbd5('0x3b')];return user;}else{logger[_0xbbd5('0x2a')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x253d43));throw new Error(_0xbbd5('0x3c')+JSON[_0xbbd5('0xc')](_0x253d43));}}}else{logger[_0xbbd5('0x2a')](_0xbbd5('0x3d'),JSON[_0xbbd5('0xc')](_0x253d43));throw new Error(_0xbbd5('0x3c')+JSON[_0xbbd5('0xc')](_0x253d43));}})[_0xbbd5('0x29')](function(_0x1e1c88){console[_0xbbd5('0x2a')](_0x1e1c88);});}function getZohoUser(_0x1baeaf,_0x1b9ff9){return new BPromise(function(_0x3a67d1,_0x3d7592){request(_0x1baeaf)[_0xbbd5('0x26')](function(_0x294585){var _0x29131f=null;if(_0x294585){_0x29131f=_0x294585['data'][0x0];_0x29131f[_0xbbd5('0x3e')]=_0x1b9ff9;}_0x3a67d1(_0x29131f);})[_0xbbd5('0x29')](function(_0x17f46c){_0x3d7592(_0x17f46c);});});}function createEndUser(_0x239d72,_0x35ca36,_0x4aca5c,_0x1c4cb6,_0x1a5c8a,_0x80850e){var _0x4aca5c=getName(_0x4aca5c);return request({'method':_0xbbd5('0x3f'),'uri':_0xbbd5('0x40')+_0x35ca36+'/crm/v2/'+_['startCase'](_0x80850e[_0xbbd5('0x41')])+'s','body':{'data':[{'Last_Name':_0x4aca5c[0x1],'First_Name':_0x4aca5c[0x0],'Phone':_0x1c4cb6,'Owner':{'name':!_[_0xbbd5('0x1a')](_0x1a5c8a[_0xbbd5('0x42')]['name'])?_0x1a5c8a[_0xbbd5('0x42')][_0xbbd5('0x17')]:!_[_0xbbd5('0x1a')](_0x1a5c8a[_0xbbd5('0x43')])?_0x1a5c8a[_0xbbd5('0x43')]+'\x20'+_0x1a5c8a[_0xbbd5('0x44')]:_0x1a5c8a['last_name'],'id':_0x1a5c8a['id']}}]},'headers':{'Authorization':_0xbbd5('0x32')+_0x239d72},'json':!![]})[_0xbbd5('0x26')](function(_0x16c0ba){if(_0x16c0ba&&_0x16c0ba[_0xbbd5('0x45')][0x0][_0xbbd5('0x46')]===_0xbbd5('0x47')){var _0x1c094d=_0x16c0ba['data'][0x0][_0xbbd5('0x48')];_0x1c094d[_0xbbd5('0x3e')]=_[_0xbbd5('0x49')](_0x80850e[_0xbbd5('0x41')])+'s';return _0x1c094d;}logger[_0xbbd5('0x2a')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0xbbd5('0x4a')+JSON[_0xbbd5('0xc')](data));})[_0xbbd5('0x29')](function(_0x179c4e){console[_0xbbd5('0x4b')](_0xbbd5('0x4c'),_0x179c4e);});}function getEndUser(_0x19d194,_0x37362a,_0x452892,_0x5de95e,_0x3835bf,_0x38ecfe,_0xe577e4){var _0x564af1={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x19d194},'json':!![]};switch(_0xe577e4[_0xbbd5('0x4d')]){case _0xbbd5('0x4e'):_0x564af1['uri']=_0xbbd5('0x40')+_0x37362a+_0xbbd5('0x4f')+_0x3835bf+'))';return getZohoUser(_0x564af1,_0xbbd5('0x50'))[_0xbbd5('0x26')](function(_0x47512c){if(_0x47512c)return _0x47512c;_0x564af1[_0xbbd5('0x51')]=_0xbbd5('0x40')+_0x37362a+_0xbbd5('0x52')+_0x3835bf+'))';return getZohoUser(_0x564af1,_0xbbd5('0x53'))[_0xbbd5('0x26')](function(_0x10267d){if(_0x10267d)return _0x10267d;if(_0xe577e4[_0xbbd5('0x41')]!=_0xbbd5('0x54')){return createEndUser(_0x19d194,_0x37362a,_0x5de95e,_0x3835bf,_0x38ecfe,_0xe577e4);}else{return{};}});});break;case _0xbbd5('0x55'):_0x564af1[_0xbbd5('0x51')]=_0xbbd5('0x40')+_0x37362a+_0xbbd5('0x4f')+_0x3835bf+'))';return getZohoUser(_0x564af1,_0xbbd5('0x50'))[_0xbbd5('0x26')](function(_0x5e67c2){if(_0x5e67c2)return _0x5e67c2;if(_0xe577e4[_0xbbd5('0x41')]!=_0xbbd5('0x54')){return createEndUser(_0x19d194,_0x37362a,_0x5de95e,_0x3835bf,_0x38ecfe,_0xe577e4);}else{return{};}});break;case _0xbbd5('0x56'):_0x564af1[_0xbbd5('0x51')]=_0xbbd5('0x40')+_0x37362a+_0xbbd5('0x52')+_0x3835bf+'))';return getZohoUser(_0x564af1,_0xbbd5('0x53'))[_0xbbd5('0x26')](function(_0xe771b9){if(_0xe771b9)return _0xe771b9;if(_0xe577e4['moduleCreate']!='nothing'){return createEndUser(_0x19d194,_0x37362a,_0x5de95e,_0x3835bf,_0x38ecfe,_0xe577e4);}else{return{};}});break;}}function getCall(_0x400212,_0xc4e8e,_0x3aa9d8,_0x442a05,_0x98cdf0,_0x46a9a7,_0x114fa0,_0x25d29a){logger[_0xbbd5('0x2c')](_0xbbd5('0x57'));var _0x4448c5={};_0x4448c5[_0xbbd5('0x58')]={'name':!_['isNil'](_0x442a05[_0xbbd5('0x42')][_0xbbd5('0x17')])&&!_[_0xbbd5('0x1a')](_0x442a05['profile']['name'])&&_0x442a05[_0xbbd5('0x39')][_0xbbd5('0x17')]===_0xbbd5('0x59')?_0x442a05[_0xbbd5('0x42')][_0xbbd5('0x17')]:!_[_0xbbd5('0x1a')](_0x442a05[_0xbbd5('0x43')])?_0x442a05[_0xbbd5('0x43')]+'\x20'+_0x442a05['last_name']:_0x442a05[_0xbbd5('0x44')],'id':_0x442a05['id']};_0x4448c5[_0xbbd5('0x5a')]=intUtil['getString'](_0x46a9a7[_0xbbd5('0x5b')],_0x114fa0,'\x20');_0x4448c5[_0xbbd5('0x5c')]=intUtil[_0xbbd5('0x5d')](_0x46a9a7[_0xbbd5('0x5e')],_0x114fa0,'\x0a');if(_0x98cdf0['enduserType']===_0xbbd5('0x50')){_0x4448c5[_0xbbd5('0x5f')]={'name':!_['isNil'](_0x98cdf0['Full_Name'])?_0x98cdf0[_0xbbd5('0x60')]:!_[_0xbbd5('0x1a')](_0x98cdf0[_0xbbd5('0x61')])?_0x98cdf0[_0xbbd5('0x61')]+'\x20'+_0x98cdf0[_0xbbd5('0x62')]:_0x98cdf0[_0xbbd5('0x62')],'id':_0x98cdf0['id']};}if(_0x98cdf0[_0xbbd5('0x3e')]==='Leads'){_0x4448c5[_0xbbd5('0x63')]={'name':!_[_0xbbd5('0x1a')](_0x98cdf0[_0xbbd5('0x60')])?_0x98cdf0[_0xbbd5('0x60')]:!_[_0xbbd5('0x1a')](_0x98cdf0['First_Name'])?_0x98cdf0[_0xbbd5('0x61')]+'\x20'+_0x98cdf0[_0xbbd5('0x62')]:_0x98cdf0['Last_Name'],'id':_0x98cdf0['id']};_0x4448c5[_0xbbd5('0x64')]=_['startCase'](_0x98cdf0[_0xbbd5('0x3e')]);}if(_0x114fa0[_0xbbd5('0x65')]){_0x4448c5[_0xbbd5('0x66')]=moment[_0xbbd5('0x67')](parseInt(_0x114fa0['talktime'])*0x3e8)[_0xbbd5('0x2f')](_0xbbd5('0x68'));}else if(_0x114fa0['answertime']&&_0x114fa0[_0xbbd5('0x69')]){_0x4448c5[_0xbbd5('0x66')]=moment[_0xbbd5('0x67')](moment(_0x114fa0[_0xbbd5('0x69')],'YYYY-MM-DDTHH:mm:ss')[_0xbbd5('0x6a')](moment(_0x114fa0[_0xbbd5('0x6b')],_0xbbd5('0x6c'))))['format']('mm:ss');}switch(_0x114fa0[_0xbbd5('0x6d')]){case _0xbbd5('0x6e'):_0x4448c5[_0xbbd5('0x6f')]='Called';break;case _0xbbd5('0x70'):case _0xbbd5('0x71'):_0x4448c5['Call_Result']=_0xbbd5('0x72');break;case _0xbbd5('0x73'):_0x4448c5[_0xbbd5('0x6f')]=_0xbbd5('0x74');break;case'abandoned':_0x4448c5[_0xbbd5('0x6f')]=_0xbbd5('0x75');break;case _0xbbd5('0x76'):_0x4448c5[_0xbbd5('0x6f')]=_0xbbd5('0x77');default:}_0x4448c5['Call_Start_Time']=(_0x25d29a===_0xbbd5('0x78')?moment(_0x114fa0[_0xbbd5('0x6b')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x114fa0[_0xbbd5('0x79')])['format'](_0xbbd5('0x6c')))||moment()[_0xbbd5('0x2f')](_0xbbd5('0x6c'));_0x4448c5[_0xbbd5('0x7a')]=_0x25d29a||_0xbbd5('0x7b');_0x4448c5=_[_0xbbd5('0x7c')](_0x4448c5,getCustomFields(_0x46a9a7['Fields'],_0x114fa0));return request({'method':'POST','uri':_0xbbd5('0x40')+_0xc4e8e+_0xbbd5('0x7d'),'headers':{'Authorization':_0xbbd5('0x32')+_0x400212},'body':{'data':[_0x4448c5]},'json':!![]})[_0xbbd5('0x26')](function(_0x2da7a9){if(_0x2da7a9&&_0x2da7a9[_0xbbd5('0x45')][0x0]['code']===_0xbbd5('0x47')){logger[_0xbbd5('0x2c')]('Call\x20created!');return{'id':_0x2da7a9['data'][0x0][_0xbbd5('0x48')]['id']};}})[_0xbbd5('0x29')](function(_0x1e91f3){logger[_0xbbd5('0x2c')](_0xbbd5('0x7e'),_0x1e91f3[_0xbbd5('0x2b')]);console[_0xbbd5('0x4b')](_0xbbd5('0x7e'),_0x1e91f3);});}exports[_0xbbd5('0x7f')]=function(_0x258ea4,_0x4223b6,_0x1f3d17,_0x5ccc37,_0x2ed07d,_0x1773c6){var _0x616a71,_0x324ed4,_0x38b809;_0x1773c6['host']=intUtil[_0xbbd5('0x80')](_0x1773c6[_0xbbd5('0x81')]);_0x1773c6[_0xbbd5('0x82')]=intUtil[_0xbbd5('0x80')](_0x1773c6['serverUrl']);if(_0x2ed07d&&_0x2ed07d['monitor_format']){logger[_0xbbd5('0x2c')]('[QUEUE]',_0xbbd5('0x83'));_0x4223b6[_0xbbd5('0x84')]=_0x1773c6[_0xbbd5('0x82')]+_0xbbd5('0x85')+_0x4223b6[_0xbbd5('0x86')]+_0xbbd5('0x87')+md5(_0x4223b6['uniqueid']);}else{_0x4223b6[_0xbbd5('0x84')]='';}var _0x387c7e=_0x1773c6[_0xbbd5('0x81')]===_0xbbd5('0x88')?'eu':_0xbbd5('0x89');return getAccessToken(_0x1773c6)[_0xbbd5('0x26')](function(_0x489cbe){_0x38b809=_0x489cbe;return getUser(_0x38b809,_0x387c7e,_0x1773c6,_0x5ccc37['email']);})['then'](function(_0x25b940){_0x616a71=_0x25b940;logger[_0xbbd5('0x2c')](_0xbbd5('0x8a'),_0x616a71['id']);return getEndUser(_0x38b809,_0x387c7e,_0x1773c6,_0x4223b6[_0xbbd5('0x8b')],_0x4223b6[_0xbbd5('0x8c')],_0x616a71,_0x1f3d17);})[_0xbbd5('0x26')](function(_0xada155){_0x324ed4=_0xada155;return getCall(_0x38b809,_0x387c7e,_0x1773c6,_0x616a71,_0x324ed4,_0x1f3d17,_0x4223b6,_0xbbd5('0x7b'));})[_0xbbd5('0x26')](function(_0x297a19){if(_0x297a19){logger[_0xbbd5('0x2c')](_0xbbd5('0x8d'),_0x297a19['id']);logger[_0xbbd5('0x2c')](_0xbbd5('0x8e'),_0xbbd5('0x8f'));emit(util[_0xbbd5('0x2f')](_0xbbd5('0x90'),_0x5ccc37[_0xbbd5('0x17')]),_0xbbd5('0x91'),{'uri':_0xbbd5('0x92')+_0x1773c6[_0xbbd5('0x81')]+_0xbbd5('0x93')+_0x297a19['id']});}})[_0xbbd5('0x29')](function(_0x47e59d){logger[_0xbbd5('0x2a')]('[QUEUE]',JSON[_0xbbd5('0xc')](_0x47e59d));});};exports[_0xbbd5('0x78')]=function(_0x54f570,_0x1ddeba,_0x3e2089,_0x1f200f,_0x11d29a,_0x1a8d1a,_0x5eae9d){var _0x50853f,_0x47bd68,_0x8b66b0;_0x1a8d1a[_0xbbd5('0x81')]=intUtil[_0xbbd5('0x80')](_0x1a8d1a[_0xbbd5('0x81')]);_0x1a8d1a[_0xbbd5('0x82')]=intUtil[_0xbbd5('0x80')](_0x1a8d1a[_0xbbd5('0x82')]);if(_0x5eae9d&&_0x5eae9d[_0xbbd5('0x94')]&&_0x5eae9d[_0xbbd5('0x94')]!==_0xbbd5('0x95')){logger[_0xbbd5('0x2c')](_0xbbd5('0x96'),_0xbbd5('0x83'));_0x1ddeba['recordingURL']=_0x1a8d1a[_0xbbd5('0x82')]+_0xbbd5('0x85')+_0x1ddeba['uniqueid']+_0xbbd5('0x87')+md5(_0x1ddeba[_0xbbd5('0x86')]);}var _0x4fecea=_0x1a8d1a['host']===_0xbbd5('0x88')?'eu':_0xbbd5('0x89');return getAccessToken(_0x1a8d1a)[_0xbbd5('0x26')](function(_0x53b980){_0x8b66b0=_0x53b980;return getUser(_0x8b66b0,_0x4fecea,_0x1a8d1a,_0x1f200f[_0xbbd5('0x36')]);})[_0xbbd5('0x26')](function(_0x174e0e){_0x50853f=_0x174e0e;logger[_0xbbd5('0x2c')](_0xbbd5('0x8a'),_0x50853f['id']);return getEndUser(_0x8b66b0,_0x4fecea,_0x1a8d1a,_0x1ddeba['destcalleridname'],_0x1ddeba[_0xbbd5('0x97')],_0x50853f,_0x3e2089);})[_0xbbd5('0x26')](function(_0x299a3f){_0x47bd68=_0x299a3f;return getCall(_0x8b66b0,_0x4fecea,_0x1a8d1a,_0x50853f,_0x47bd68,_0x3e2089,_0x1ddeba,_0xbbd5('0x98'));})['then'](function(_0x128438){if(_0x128438){logger[_0xbbd5('0x2c')](_0xbbd5('0x8d'),_0x128438['id']);logger[_0xbbd5('0x2c')](_0xbbd5('0x96'),_0xbbd5('0x8f'));emit(util[_0xbbd5('0x2f')](_0xbbd5('0x90'),_0x1f200f[_0xbbd5('0x17')]),'trigger:browser:url',{'uri':_0xbbd5('0x92')+_0x1a8d1a[_0xbbd5('0x81')]+_0xbbd5('0x93')+_0x128438['id']});}})[_0xbbd5('0x29')](function(_0x13dfd8){logger[_0xbbd5('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x13dfd8));});};exports[_0xbbd5('0x99')]=function(_0x4fb2d3,_0x924e10,_0x4ad2d8,_0x2ca09c,_0x22fda5,_0xde9ecb){var _0x535ebf,_0x39ed2e,_0x2200fa;_0xde9ecb['host']=intUtil[_0xbbd5('0x80')](_0xde9ecb['host']);_0xde9ecb[_0xbbd5('0x82')]=intUtil[_0xbbd5('0x80')](_0xde9ecb[_0xbbd5('0x82')]);if(_0x22fda5&&_0x22fda5[_0xbbd5('0x9a')]){logger[_0xbbd5('0x2c')]('['+_0x924e10[_0xbbd5('0x6d')][_0xbbd5('0x9b')]()+']',_0xbbd5('0x83'));_0x924e10['recordingURL']=_0xde9ecb[_0xbbd5('0x82')]+'/api/voice/recordings/'+_0x924e10['uniqueid']+_0xbbd5('0x87')+md5(_0x924e10['uniqueid']);}else{_0x924e10['recordingURL']='';}var _0x72794=_0xde9ecb[_0xbbd5('0x81')]===_0xbbd5('0x88')?'eu':'com';return getAccessToken(_0xde9ecb)[_0xbbd5('0x26')](function(_0x513acc){_0x2200fa=_0x513acc;return getUser(_0x2200fa,_0x72794,_0xde9ecb);})['then'](function(_0x1cbc9a){_0x535ebf=_0x1cbc9a;logger['info'](_0xbbd5('0x8a'),_0x535ebf['id']);return getEndUser(_0x2200fa,_0x72794,_0xde9ecb,_0x924e10[_0xbbd5('0x8b')],_0x924e10['calleridnum'],_0x535ebf,_0x4ad2d8);})[_0xbbd5('0x26')](function(_0x2ae319){_0x39ed2e=_0x2ae319;return getCall(_0x2200fa,_0x72794,_0xde9ecb,_0x535ebf,_0x39ed2e,_0x4ad2d8,_0x924e10,_0xbbd5('0x7b'));})[_0xbbd5('0x26')](function(_0x292fde){if(_0x292fde){logger['info']('The\x20Call\x20ID\x20is:',_0x292fde['id']);}})[_0xbbd5('0x29')](function(_0x164c01){logger[_0xbbd5('0x2a')]('['+_0x924e10[_0xbbd5('0x6d')][_0xbbd5('0x9b')]()+']',JSON['stringify'](_0x164c01));});}; \ 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 96f6298..bb0c80d 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 _0xaaf3=['data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2'];(function(_0x1fab34,_0x472743){var _0x22ff37=function(_0x623f97){while(--_0x623f97){_0x1fab34['push'](_0x1fab34['shift']());}};_0x22ff37(++_0x472743);}(_0xaaf3,0x117));var _0x3aaf=function(_0x3f2c44,_0x320482){_0x3f2c44=_0x3f2c44-0x0;var _0x26d1b1=_0xaaf3[_0x3f2c44];return _0x26d1b1;};'use strict';var util=require(_0x3aaf('0x0'));var sh=require(_0x3aaf('0x1'));var Mustache=require(_0x3aaf('0x2'));var logger=require(_0x3aaf('0x3'))(_0x3aaf('0x4'));exports[_0x3aaf('0x5')]=function(_0x3f6cd2,_0xcc3b7c){var _0x473ab1=_0x3f6cd2[_0x3aaf('0x6')]?_0x3f6cd2[_0x3aaf('0x6')]:'Script';var _0x576203=_0x3f6cd2[_0x3aaf('0x7')]?Mustache['render'](_0x3f6cd2[_0x3aaf('0x7')],_0xcc3b7c):_0xcc3b7c;sh['exec'](_0x576203,function(_0x30d889,_0x3ab2a5,_0xc75b6a){if(_0x30d889!==0x0){logger[_0x3aaf('0x8')](util['format'](_0x3aaf('0x9'),_0x473ab1,_0x576203,_0x30d889,_0xc75b6a));}else{logger[_0x3aaf('0xa')](util[_0x3aaf('0xb')](_0x3aaf('0xc'),_0x473ab1,_0x576203,_0x3ab2a5));}});}; \ No newline at end of file +var _0xa4ec=['shelljs','mustache','trigger','exec','data2','Script','data3','render','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x4a1353,_0x2fbe86){var _0x3805cc=function(_0x39a7ee){while(--_0x39a7ee){_0x4a1353['push'](_0x4a1353['shift']());}};_0x3805cc(++_0x2fbe86);}(_0xa4ec,0xbb));var _0xca4e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa4ec[_0x47a7d0];return _0xb9bd08;};'use strict';var util=require('util');var sh=require(_0xca4e('0x0'));var Mustache=require(_0xca4e('0x1'));var logger=require('../../../../config/logger')(_0xca4e('0x2'));exports[_0xca4e('0x3')]=function(_0x20e9d1,_0x251c35){var _0x26d049=_0x20e9d1[_0xca4e('0x4')]?_0x20e9d1['data2']:_0xca4e('0x5');var _0x38ecda=_0x20e9d1[_0xca4e('0x6')]?Mustache[_0xca4e('0x7')](_0x20e9d1['data3'],_0x251c35):_0x251c35;sh[_0xca4e('0x3')](_0x38ecda,function(_0x2e4236,_0xab40fb,_0x178c80){if(_0x2e4236!==0x0){logger['error'](util[_0xca4e('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x26d049,_0x38ecda,_0x2e4236,_0x178c80));}else{logger[_0xca4e('0x9')](util[_0xca4e('0x8')](_0xca4e('0xa'),_0x26d049,_0x38ecda,_0xab40fb));}});}; \ 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 4d19e19..c772291 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 _0x2c57=['data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','name','message','request-promise','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data5','number','headers','parse','error','stack','GET','DELETE','PUT'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x2c57,0x16f));var _0x72c5=function(_0x2975e5,_0x5e753e){_0x2975e5=_0x2975e5-0x0;var _0x1acbd7=_0x2c57[_0x2975e5];return _0x1acbd7;};'use strict';var rp=require(_0x72c5('0x0'));var util=require('util');var _=require('lodash');var Mustache=require(_0x72c5('0x1'));var logger=require(_0x72c5('0x2'))(_0x72c5('0x3'));exports[_0x72c5('0x4')]=function(_0x5e6935,_0x2611f1){var _0x1feea4,_0x481a44;var _0x5beb55={'method':_0x5e6935[_0x72c5('0x5')][_0x72c5('0x6')](),'uri':Mustache[_0x72c5('0x7')](_0x5e6935['data2'],_0x2611f1),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5e6935[_0x72c5('0x8')])===_0x72c5('0x9')&&parseInt(_0x5e6935[_0x72c5('0x8')])>=0x1&&parseInt(_0x5e6935[_0x72c5('0x8')])<=0xa?parseInt(_0x5e6935['data5'])*0x3e8:0x5*0x3e8};try{_0x5beb55[_0x72c5('0xa')]=_0x5e6935['data6']?JSON[_0x72c5('0xb')](Mustache[_0x72c5('0x7')](_0x5e6935['data6'],_0x2611f1)):{};}catch(_0x52269a){logger[_0x72c5('0xc')](_0x52269a[_0x72c5('0xd')]);}switch(_0x5e6935[_0x72c5('0x5')][_0x72c5('0x6')]()){case _0x72c5('0xe'):case _0x72c5('0xf'):_0x1feea4=null;_0x5beb55['qs']=_0x2611f1;break;case'POST':case _0x72c5('0x10'):if(_0x5e6935['data7']){try{_0x1feea4=JSON[_0x72c5('0xb')](Mustache[_0x72c5('0x7')](_0x5e6935[_0x72c5('0x11')],_0x2611f1));_0x5beb55[_0x72c5('0x12')]=_0x1feea4;}catch(_0x12ffbf){logger['error'](_0x12ffbf['stack']);logger[_0x72c5('0xc')](_0x72c5('0x13'));}}else{_0x1feea4=_0x2611f1;_0x5beb55[_0x72c5('0x12')]=_0x1feea4;}break;}logger[_0x72c5('0x14')](util[_0x72c5('0x15')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x5e6935[_0x72c5('0x5')],_0x5e6935[_0x72c5('0x16')],JSON[_0x72c5('0x17')](_0x5beb55)));rp(_0x5beb55)[_0x72c5('0x18')](function(_0x3d5408){_0x1feea4=!_[_0x72c5('0x19')](_0x1feea4)?_0x72c5('0x1a')+_0x1feea4:'';_0x481a44=typeof _0x3d5408[_0x72c5('0x12')]===_0x72c5('0x1b')?JSON['stringify'](_0x3d5408[_0x72c5('0x12')]):_0x3d5408['body'];logger['info'](util[_0x72c5('0x15')](_0x72c5('0x1c'),_0x5e6935[_0x72c5('0x5')],_0x5e6935['data2'],_0x3d5408['statusCode'],_0x481a44));})[_0x72c5('0x1d')](function(_0x44189f){logger[_0x72c5('0xc')](util[_0x72c5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5e6935[_0x72c5('0x5')],_0x5e6935[_0x72c5('0x16')],_0x44189f['statusCode'],_0x44189f[_0x72c5('0x1e')],_0x44189f[_0x72c5('0x1f')]));});}; \ No newline at end of file +var _0x61da=['PUT','data7','error','body','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','request-promise','util','../../../../config/logger','trigger','exec','data1','toUpperCase','data2','data5','parse','render','data6','stack','GET','DELETE','POST'];(function(_0x536380,_0x3f79d5){var _0xd2229d=function(_0x1daa83){while(--_0x1daa83){_0x536380['push'](_0x536380['shift']());}};_0xd2229d(++_0x3f79d5);}(_0x61da,0x170));var _0xa61d=function(_0x1dd698,_0x4ddabc){_0x1dd698=_0x1dd698-0x0;var _0x4c2126=_0x61da[_0x1dd698];return _0x4c2126;};'use strict';var rp=require(_0xa61d('0x0'));var util=require(_0xa61d('0x1'));var _=require('lodash');var Mustache=require('mustache');var logger=require(_0xa61d('0x2'))(_0xa61d('0x3'));exports[_0xa61d('0x4')]=function(_0x20fc05,_0x4384ba){var _0x341f68,_0x4d647b;var _0x51bcb1={'method':_0x20fc05[_0xa61d('0x5')][_0xa61d('0x6')](),'uri':Mustache['render'](_0x20fc05[_0xa61d('0x7')],_0x4384ba),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x20fc05[_0xa61d('0x8')])==='number'&&parseInt(_0x20fc05[_0xa61d('0x8')])>=0x1&&parseInt(_0x20fc05['data5'])<=0xa?parseInt(_0x20fc05['data5'])*0x3e8:0x5*0x3e8};try{_0x51bcb1['headers']=_0x20fc05['data6']?JSON[_0xa61d('0x9')](Mustache[_0xa61d('0xa')](_0x20fc05[_0xa61d('0xb')],_0x4384ba)):{};}catch(_0x3f5297){logger['error'](_0x3f5297[_0xa61d('0xc')]);}switch(_0x20fc05[_0xa61d('0x5')]['toUpperCase']()){case _0xa61d('0xd'):case _0xa61d('0xe'):_0x341f68=null;_0x51bcb1['qs']=_0x4384ba;break;case _0xa61d('0xf'):case _0xa61d('0x10'):if(_0x20fc05[_0xa61d('0x11')]){try{_0x341f68=JSON[_0xa61d('0x9')](Mustache['render'](_0x20fc05[_0xa61d('0x11')],_0x4384ba));_0x51bcb1['body']=_0x341f68;}catch(_0x3858cb){logger['error'](_0x3858cb[_0xa61d('0xc')]);logger[_0xa61d('0x12')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x341f68=_0x4384ba;_0x51bcb1[_0xa61d('0x13')]=_0x341f68;}break;}logger[_0xa61d('0x14')](util[_0xa61d('0x15')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x20fc05[_0xa61d('0x5')],_0x20fc05['data2'],JSON[_0xa61d('0x16')](_0x51bcb1)));rp(_0x51bcb1)[_0xa61d('0x17')](function(_0x29d10a){_0x341f68=!_[_0xa61d('0x18')](_0x341f68)?_0xa61d('0x19')+_0x341f68:'';_0x4d647b=typeof _0x29d10a[_0xa61d('0x13')]===_0xa61d('0x1a')?JSON[_0xa61d('0x16')](_0x29d10a['body']):_0x29d10a['body'];logger[_0xa61d('0x14')](util[_0xa61d('0x15')](_0xa61d('0x1b'),_0x20fc05['data1'],_0x20fc05[_0xa61d('0x7')],_0x29d10a[_0xa61d('0x1c')],_0x4d647b));})[_0xa61d('0x1d')](function(_0xb8bfbc){logger[_0xa61d('0x12')](util[_0xa61d('0x15')](_0xa61d('0x1e'),_0x20fc05[_0xa61d('0x5')],_0x20fc05[_0xa61d('0x7')],_0xb8bfbc['statusCode'],_0xb8bfbc['name'],_0xb8bfbc[_0xa61d('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index c9dee21..8ac34a1 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 _0x0e85=['debug','rpc','routing','error','message','result','catch','exports','jayson/promise','../../config/logger','http','request','then'];(function(_0x3e5cd5,_0x58272b){var _0x1b8d19=function(_0x3e216b){while(--_0x3e216b){_0x3e5cd5['push'](_0x3e5cd5['shift']());}};_0x1b8d19(++_0x58272b);}(_0x0e85,0x10c));var _0x50e8=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x0e85[_0x29d915];return _0x160f86;};'use strict';var jayson=require(_0x50e8('0x0'));var BPromise=require('bluebird');var logger=require(_0x50e8('0x1'))('routing');var client=jayson['client'][_0x50e8('0x2')]({'port':0x2329});client['Request']=function(_0x235b24,_0x2f5851){return new BPromise(function(_0x1df1db,_0x78ec7d){return client[_0x50e8('0x3')](_0x235b24,_0x2f5851)[_0x50e8('0x4')](function(_0x2d2064){logger[_0x50e8('0x5')](_0x50e8('0x6'),_0x50e8('0x7'),_0x235b24,_0x2f5851,_0x2d2064);if(_0x2d2064['error']){logger[_0x50e8('0x8')](_0x50e8('0x6'),_0x50e8('0x7'),_0x235b24,_0x2d2064[_0x50e8('0x8')][_0x50e8('0x9')],_0x2f5851);return _0x78ec7d(_0x2d2064[_0x50e8('0x8')][_0x50e8('0x9')]);}else{return _0x1df1db(_0x2d2064[_0x50e8('0xa')]);}})[_0x50e8('0xb')](function(_0x43ca9a){logger['error'](_0x50e8('0x6'),_0x50e8('0x7'),_0x235b24,_0x43ca9a,_0x2f5851);return _0x78ec7d(_0x43ca9a);});});};module[_0x50e8('0xc')]=client; \ No newline at end of file +var _0x5f61=['routing','client','http','Request','request','then','debug','rpc','error','message','catch','exports','jayson/promise','bluebird'];(function(_0x1cc1a0,_0x5a0a16){var _0x287e9d=function(_0x102184){while(--_0x102184){_0x1cc1a0['push'](_0x1cc1a0['shift']());}};_0x287e9d(++_0x5a0a16);}(_0x5f61,0xc2));var _0x15f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f61[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x15f6('0x0'));var BPromise=require(_0x15f6('0x1'));var logger=require('../../config/logger')(_0x15f6('0x2'));var client=jayson[_0x15f6('0x3')][_0x15f6('0x4')]({'port':0x2329});client[_0x15f6('0x5')]=function(_0x4f5fa8,_0x29bd0a){return new BPromise(function(_0x3415e6,_0x25c17f){return client[_0x15f6('0x6')](_0x4f5fa8,_0x29bd0a)[_0x15f6('0x7')](function(_0x864890){logger[_0x15f6('0x8')](_0x15f6('0x9'),_0x15f6('0x2'),_0x4f5fa8,_0x29bd0a,_0x864890);if(_0x864890[_0x15f6('0xa')]){logger[_0x15f6('0xa')]('rpc','routing',_0x4f5fa8,_0x864890[_0x15f6('0xa')]['message'],_0x29bd0a);return _0x25c17f(_0x864890[_0x15f6('0xa')][_0x15f6('0xb')]);}else{return _0x3415e6(_0x864890['result']);}})[_0x15f6('0xc')](function(_0x22c63c){logger[_0x15f6('0xa')](_0x15f6('0x9'),_0x15f6('0x2'),_0x4f5fa8,_0x22c63c,_0x29bd0a);return _0x25c17f(_0x22c63c);});});};module[_0x15f6('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 9a37c00..c94bfe8 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 _0x92ac=['./server','./realtime','./rpc/setting','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','catch','bluebird'];(function(_0x56eefb,_0x1a1c6d){var _0x13ed78=function(_0x18f89a){while(--_0x18f89a){_0x56eefb['push'](_0x56eefb['shift']());}};_0x13ed78(++_0x1a1c6d);}(_0x92ac,0x151));var _0xc92a=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x92ac[_0x54d4a8];return _0x3b321b;};'use strict';var BPromise=require(_0xc92a('0x0'));var server=require(_0xc92a('0x1'));var Realtime=require(_0xc92a('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require(_0xc92a('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xc92a('0x4')]()[_0xc92a('0x5')](mailAccount[_0xc92a('0x6')]())[_0xc92a('0x5')](realtime[_0xc92a('0x7')]())['then'](function(){email[_0xc92a('0x8')](realtime[_0xc92a('0x9')]);return realtime;});}function main(){return server[_0xc92a('0xa')](realtime,email)[_0xc92a('0x5')](function(){return initRealtime();})[_0xc92a('0x5')](function(){return setting[_0xc92a('0xb')]();})['then'](function(_0x576801){return setInterval(initRealtime,_0x576801['loginMailFrequency']*0x3e8);})[_0xc92a('0xc')](function(_0xc2d920){console['log'](_0xc2d920);});}main(); \ No newline at end of file +var _0x65c5=['loginMailFrequency','catch','./realtime','./lib/email','./rpc/setting','resolve','then','initMailAccounts','mailAccounts','listen','getSettings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x65c5,0x1c5));var _0x565c=function(_0x7a707a,_0x58300d){_0x7a707a=_0x7a707a-0x0;var _0x284197=_0x65c5[_0x7a707a];return _0x284197;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x565c('0x0'));var EmailChannel=require(_0x565c('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x565c('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x565c('0x3')]()[_0x565c('0x4')](mailAccount['getMailAccounts']())['then'](realtime[_0x565c('0x5')]())[_0x565c('0x4')](function(){email['refresh'](realtime[_0x565c('0x6')]);return realtime;});}function main(){return server[_0x565c('0x7')](realtime,email)[_0x565c('0x4')](function(){return initRealtime();})[_0x565c('0x4')](function(){return setting[_0x565c('0x8')]();})['then'](function(_0x5c520c){return setInterval(initRealtime,_0x5c520c[_0x565c('0x9')]*0x3e8);})[_0x565c('0xa')](function(_0x5a6679){console['log'](_0x5a6679);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 28be495..aac2e1a 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 _0x8f5e=['defaults','./imap','./smtp','../rpc/mailAccount','mailAccounts','imapAccounts','smtp','prototype','active','status','Imap','messageStatus','total','isNil','stringify','refresh','hasOwnProperty','box','bind','end','error','handleImapError','disabled','emit','handleImapBox','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','info','catch','handleImapEnd','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8f5e,0x198));var _0xe8f5=function(_0x4bc806,_0x499538){_0x4bc806=_0x4bc806-0x0;var _0x3ce956=_0x8f5e[_0x4bc806];return _0x3ce956;};'use strict';var _=require('lodash');var moment=require(_0xe8f5('0x0'));var BPromise=require(_0xe8f5('0x1'));var md5=require(_0xe8f5('0x2'));var Redis=require(_0xe8f5('0x3'));var config=require(_0xe8f5('0x4'));var logger=require(_0xe8f5('0x5'))(_0xe8f5('0x6'));config[_0xe8f5('0x7')]=_[_0xe8f5('0x8')](config[_0xe8f5('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xe8f5('0x9'));var EmailSmtp=require(_0xe8f5('0xa'));var mailAccount=require(_0xe8f5('0xb'));var md5Accounts={};function EmailChannel(_0x10a8e5){logger['info']('start\x20email\x20channel');this[_0xe8f5('0xc')]=_0x10a8e5[_0xe8f5('0xc')];this[_0xe8f5('0xd')]={};this[_0xe8f5('0xe')]=new EmailSmtp();}EmailChannel[_0xe8f5('0xf')]['emit']=function(_0x417f78){var _0x5c5912=this[_0xe8f5('0xc')][_0x417f78];var _0x1168f9={'id':_0x5c5912['id'],'name':_0x5c5912['name'],'key':_0x5c5912['key'],'active':_0x5c5912[_0xe8f5('0x10')],'Imap':{'status':_0x5c5912['Imap'][_0xe8f5('0x11')],'messageStatus':_0x5c5912[_0xe8f5('0x12')][_0xe8f5('0x13')],'total':_0x5c5912[_0xe8f5('0x12')][_0xe8f5('0x14')]}};if(_[_0xe8f5('0x15')](md5Accounts[_0x417f78])){md5Accounts[_0x417f78]={};}var _0x18b5b7=md5(JSON[_0xe8f5('0x16')](_0x1168f9));if(md5Accounts[_0x417f78][_0xe8f5('0x2')]!==_0x18b5b7){md5Accounts[_0x417f78]['md5']=_0x18b5b7;io['emit']('mailAccount:update',_0x1168f9);}};EmailChannel[_0xe8f5('0xf')][_0xe8f5('0x17')]=function(_0x1aac40){for(var _0x37ecfa in _0x1aac40){if(_0x1aac40[_0xe8f5('0x18')](_0x37ecfa)){if(_0x1aac40[_0x37ecfa][_0xe8f5('0x12')]&&_0x1aac40[_0x37ecfa][_0xe8f5('0x10')]){var _0x5f2d55=_0x1aac40[_0x37ecfa][_0xe8f5('0x12')];if(!this[_0xe8f5('0xd')][_0xe8f5('0x18')](_0x5f2d55['id'])){this['imapAccounts'][_0x5f2d55['id']]=new EmailImap(_0x5f2d55,_0x1aac40[_0x37ecfa][_0xe8f5('0x6')]);this['imapAccounts'][_0x5f2d55['id']]['on'](_0xe8f5('0x19'),this['handleImapBox']['bind'](this,_0x37ecfa));this[_0xe8f5('0xd')][_0x5f2d55['id']]['on'](_0xe8f5('0x6'),this['handleImapEmail'][_0xe8f5('0x1a')](this,_0x37ecfa));this['imapAccounts'][_0x5f2d55['id']]['on'](_0xe8f5('0x1b'),this['handleImapEnd'][_0xe8f5('0x1a')](this,_0x37ecfa));this[_0xe8f5('0xd')][_0x5f2d55['id']]['on'](_0xe8f5('0x1c'),this[_0xe8f5('0x1d')][_0xe8f5('0x1a')](this,_0x37ecfa));}}else{if(_[_0xe8f5('0x15')](this['mailAccounts'][_0x37ecfa][_0xe8f5('0x12')])){this['mailAccounts'][_0x37ecfa][_0xe8f5('0x12')]={};}this[_0xe8f5('0xc')][_0x37ecfa][_0xe8f5('0x12')][_0xe8f5('0x11')]=_0xe8f5('0x1e');this['mailAccounts'][_0x37ecfa][_0xe8f5('0x12')][_0xe8f5('0x13')]='';this[_0xe8f5('0x1f')](_0x37ecfa);}}}};EmailChannel[_0xe8f5('0xf')][_0xe8f5('0x20')]=function(_0x43ab9f,_0x4c54be){if(this[_0xe8f5('0xc')][_0x43ab9f]){this[_0xe8f5('0xc')][_0x43ab9f]['Imap'][_0xe8f5('0x11')]='connected';this[_0xe8f5('0xc')][_0x43ab9f][_0xe8f5('0x12')][_0xe8f5('0x13')]=_0x4c54be['name'];if(_0x4c54be[_0xe8f5('0x21')]){this[_0xe8f5('0xc')][_0x43ab9f][_0xe8f5('0x12')]['total']=_0x4c54be['messages'][_0xe8f5('0x14')];}return this[_0xe8f5('0x1f')](_0x43ab9f);}};EmailChannel[_0xe8f5('0xf')][_0xe8f5('0x22')]=function(_0x2912eb,_0x59111f){logger['info'](_0xe8f5('0x23'),_0x59111f[_0xe8f5('0x24')],_0x59111f[_0xe8f5('0x25')],_0x59111f[_0xe8f5('0x26')],_0x2912eb);if(this[_0xe8f5('0xc')][_0x2912eb]){return mailAccount[_0xe8f5('0x27')](_0x2912eb,_0x59111f)[_0xe8f5('0x28')](function(_0x1b6033){if(_0x1b6033){logger[_0xe8f5('0x29')]('Mail\x20accepted\x20from\x20routing');}})[_0xe8f5('0x2a')](function(_0x10765d){logger[_0xe8f5('0x1c')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x10765d));});}};EmailChannel[_0xe8f5('0xf')][_0xe8f5('0x2b')]=function(_0x888635){if(this[_0xe8f5('0xc')][_0x888635]&&this[_0xe8f5('0xc')][_0x888635][_0xe8f5('0x12')]){if(this[_0xe8f5('0xd')][this['mailAccounts'][_0x888635][_0xe8f5('0x12')]['id']]){delete this[_0xe8f5('0xd')][this['mailAccounts'][_0x888635][_0xe8f5('0x12')]['id']];}this[_0xe8f5('0xc')][_0x888635][_0xe8f5('0x12')][_0xe8f5('0x2c')]=moment();this[_0xe8f5('0x1f')](_0x888635);}};EmailChannel[_0xe8f5('0xf')][_0xe8f5('0x1d')]=function(_0x42570b,_0x54515a){if(this['mailAccounts'][_0x42570b]){this[_0xe8f5('0xc')][_0x42570b][_0xe8f5('0x12')]['status']=_0xe8f5('0x1c');this['mailAccounts'][_0x42570b]['Imap'][_0xe8f5('0x13')]=_0x54515a;return this[_0xe8f5('0x1f')](_0x42570b);}};EmailChannel[_0xe8f5('0xf')][_0xe8f5('0x2d')]=function(_0x546ee6,_0x381f50){return this['smtp'][_0xe8f5('0x2e')](_0x546ee6,_0x381f50);};EmailChannel[_0xe8f5('0xf')][_0xe8f5('0x2f')]=function(_0x424a10){var _0x3474ff=this;if(this[_0xe8f5('0xc')][_0x424a10['id']]){if(_[_0xe8f5('0x15')](this[_0xe8f5('0xc')][_0x424a10['id']]['Smtp'])){this[_0xe8f5('0xc')][_0x424a10['id']]['Smtp']={};}this[_0xe8f5('0xc')][_0x424a10['id']][_0xe8f5('0x30')][_0xe8f5('0x2c')]=moment();return new BPromise(function(_0x513504,_0x3da801){return _0x3474ff['smtp'][_0xe8f5('0x31')](_0x424a10)[_0xe8f5('0x28')](function(_0xee10e7){_0x3474ff[_0xe8f5('0xc')][_0x424a10['id']][_0xe8f5('0x30')][_0xe8f5('0x11')]=_0xe8f5('0x32');_0x3474ff['mailAccounts'][_0x424a10['id']][_0xe8f5('0x30')][_0xe8f5('0x13')]='';_0x3474ff[_0xe8f5('0x1f')](_0x424a10['id']);_0x513504(_0xee10e7);})[_0xe8f5('0x2a')](function(_0x507d49){_0x3474ff[_0xe8f5('0xc')][_0x424a10['id']]['Smtp']['status']=_0xe8f5('0x1c');_0x3474ff[_0xe8f5('0xc')][_0x424a10['id']]['Smtp']['messageStatus']=_0x507d49;_0x3474ff[_0xe8f5('0x1f')](_0x424a10['id']);_0x3da801(_0x507d49);});});}return this[_0xe8f5('0xe')][_0xe8f5('0x31')](_0x424a10);};module[_0xe8f5('0x33')]=EmailChannel; \ No newline at end of file +var _0xb078=['verify','verified','exports','moment','bluebird','md5','ioredis','../../../config/logger','email','redis','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','disabled','connected','messages','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','stringify','lastSync','sendMail','send','verifySmtp','Smtp'];(function(_0x50af39,_0x1800aa){var _0x17af74=function(_0x25b795){while(--_0x25b795){_0x50af39['push'](_0x50af39['shift']());}};_0x17af74(++_0x1800aa);}(_0xb078,0xa5));var _0x8b07=function(_0x31daa7,_0x43ee9f){_0x31daa7=_0x31daa7-0x0;var _0x3ef762=_0xb078[_0x31daa7];return _0x3ef762;};'use strict';var _=require('lodash');var moment=require(_0x8b07('0x0'));var BPromise=require(_0x8b07('0x1'));var md5=require(_0x8b07('0x2'));var Redis=require(_0x8b07('0x3'));var config=require('../../../config/environment');var logger=require(_0x8b07('0x4'))(_0x8b07('0x5'));config[_0x8b07('0x6')]=_['defaults'](config[_0x8b07('0x6')],{'host':_0x8b07('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8b07('0x6')]));var EmailImap=require(_0x8b07('0x8'));var EmailSmtp=require(_0x8b07('0x9'));var mailAccount=require(_0x8b07('0xa'));var md5Accounts={};function EmailChannel(_0x418142){logger[_0x8b07('0xb')](_0x8b07('0xc'));this[_0x8b07('0xd')]=_0x418142['mailAccounts'];this['imapAccounts']={};this[_0x8b07('0xe')]=new EmailSmtp();}EmailChannel[_0x8b07('0xf')][_0x8b07('0x10')]=function(_0x20216c){var _0x458128=this[_0x8b07('0xd')][_0x20216c];var _0x2d704f={'id':_0x458128['id'],'name':_0x458128[_0x8b07('0x11')],'key':_0x458128[_0x8b07('0x12')],'active':_0x458128[_0x8b07('0x13')],'Imap':{'status':_0x458128[_0x8b07('0x14')][_0x8b07('0x15')],'messageStatus':_0x458128[_0x8b07('0x14')][_0x8b07('0x16')],'total':_0x458128['Imap'][_0x8b07('0x17')]}};if(_[_0x8b07('0x18')](md5Accounts[_0x20216c])){md5Accounts[_0x20216c]={};}var _0x215090=md5(JSON['stringify'](_0x2d704f));if(md5Accounts[_0x20216c][_0x8b07('0x2')]!==_0x215090){md5Accounts[_0x20216c][_0x8b07('0x2')]=_0x215090;io[_0x8b07('0x10')]('mailAccount:update',_0x2d704f);}};EmailChannel[_0x8b07('0xf')][_0x8b07('0x19')]=function(_0x4aa3eb){for(var _0x403552 in _0x4aa3eb){if(_0x4aa3eb['hasOwnProperty'](_0x403552)){if(_0x4aa3eb[_0x403552][_0x8b07('0x14')]&&_0x4aa3eb[_0x403552][_0x8b07('0x13')]){var _0xb8d540=_0x4aa3eb[_0x403552][_0x8b07('0x14')];if(!this['imapAccounts'][_0x8b07('0x1a')](_0xb8d540['id'])){this[_0x8b07('0x1b')][_0xb8d540['id']]=new EmailImap(_0xb8d540,_0x4aa3eb[_0x403552]['email']);this[_0x8b07('0x1b')][_0xb8d540['id']]['on'](_0x8b07('0x1c'),this[_0x8b07('0x1d')]['bind'](this,_0x403552));this[_0x8b07('0x1b')][_0xb8d540['id']]['on']('email',this[_0x8b07('0x1e')][_0x8b07('0x1f')](this,_0x403552));this[_0x8b07('0x1b')][_0xb8d540['id']]['on'](_0x8b07('0x20'),this[_0x8b07('0x21')][_0x8b07('0x1f')](this,_0x403552));this[_0x8b07('0x1b')][_0xb8d540['id']]['on'](_0x8b07('0x22'),this[_0x8b07('0x23')][_0x8b07('0x1f')](this,_0x403552));}}else{if(_['isNil'](this['mailAccounts'][_0x403552]['Imap'])){this[_0x8b07('0xd')][_0x403552]['Imap']={};}this[_0x8b07('0xd')][_0x403552][_0x8b07('0x14')][_0x8b07('0x15')]=_0x8b07('0x24');this[_0x8b07('0xd')][_0x403552][_0x8b07('0x14')][_0x8b07('0x16')]='';this[_0x8b07('0x10')](_0x403552);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x37031d,_0x2bf188){if(this['mailAccounts'][_0x37031d]){this['mailAccounts'][_0x37031d][_0x8b07('0x14')][_0x8b07('0x15')]=_0x8b07('0x25');this[_0x8b07('0xd')][_0x37031d][_0x8b07('0x14')][_0x8b07('0x16')]=_0x2bf188[_0x8b07('0x11')];if(_0x2bf188[_0x8b07('0x26')]){this[_0x8b07('0xd')][_0x37031d][_0x8b07('0x14')][_0x8b07('0x17')]=_0x2bf188[_0x8b07('0x26')]['total'];}return this[_0x8b07('0x10')](_0x37031d);}};EmailChannel[_0x8b07('0xf')][_0x8b07('0x1e')]=function(_0x19c4ba,_0x49ff86){logger[_0x8b07('0xb')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x49ff86[_0x8b07('0x27')],_0x49ff86[_0x8b07('0x28')],_0x49ff86['from'],_0x19c4ba);if(this[_0x8b07('0xd')][_0x19c4ba]){return mailAccount[_0x8b07('0x29')](_0x19c4ba,_0x49ff86)[_0x8b07('0x2a')](function(_0x1f9cee){if(_0x1f9cee){logger[_0x8b07('0xb')](_0x8b07('0x2b'));}})[_0x8b07('0x2c')](function(_0x2017f4){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x8b07('0x2d')](_0x2017f4));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x20d074){if(this[_0x8b07('0xd')][_0x20d074]&&this[_0x8b07('0xd')][_0x20d074][_0x8b07('0x14')]){if(this[_0x8b07('0x1b')][this[_0x8b07('0xd')][_0x20d074][_0x8b07('0x14')]['id']]){delete this[_0x8b07('0x1b')][this[_0x8b07('0xd')][_0x20d074][_0x8b07('0x14')]['id']];}this[_0x8b07('0xd')][_0x20d074][_0x8b07('0x14')][_0x8b07('0x2e')]=moment();this[_0x8b07('0x10')](_0x20d074);}};EmailChannel['prototype'][_0x8b07('0x23')]=function(_0x34b6ab,_0x3e9bdd){if(this['mailAccounts'][_0x34b6ab]){this[_0x8b07('0xd')][_0x34b6ab][_0x8b07('0x14')][_0x8b07('0x15')]=_0x8b07('0x22');this['mailAccounts'][_0x34b6ab]['Imap'][_0x8b07('0x16')]=_0x3e9bdd;return this[_0x8b07('0x10')](_0x34b6ab);}};EmailChannel[_0x8b07('0xf')][_0x8b07('0x2f')]=function(_0x184719,_0x566a6b){return this[_0x8b07('0xe')][_0x8b07('0x30')](_0x184719,_0x566a6b);};EmailChannel[_0x8b07('0xf')][_0x8b07('0x31')]=function(_0x32b31b){var _0x1bbde5=this;if(this[_0x8b07('0xd')][_0x32b31b['id']]){if(_[_0x8b07('0x18')](this['mailAccounts'][_0x32b31b['id']]['Smtp'])){this['mailAccounts'][_0x32b31b['id']]['Smtp']={};}this['mailAccounts'][_0x32b31b['id']][_0x8b07('0x32')][_0x8b07('0x2e')]=moment();return new BPromise(function(_0x33238b,_0xfbfeae){return _0x1bbde5['smtp'][_0x8b07('0x33')](_0x32b31b)['then'](function(_0x2dec5a){_0x1bbde5['mailAccounts'][_0x32b31b['id']]['Smtp']['status']=_0x8b07('0x34');_0x1bbde5['mailAccounts'][_0x32b31b['id']][_0x8b07('0x32')]['messageStatus']='';_0x1bbde5['emit'](_0x32b31b['id']);_0x33238b(_0x2dec5a);})[_0x8b07('0x2c')](function(_0x2ddd21){_0x1bbde5[_0x8b07('0xd')][_0x32b31b['id']][_0x8b07('0x32')][_0x8b07('0x15')]=_0x8b07('0x22');_0x1bbde5[_0x8b07('0xd')][_0x32b31b['id']][_0x8b07('0x32')][_0x8b07('0x16')]=_0x2ddd21;_0x1bbde5[_0x8b07('0x10')](_0x32b31b['id']);_0xfbfeae(_0x2ddd21);});});}return this['smtp'][_0x8b07('0x33')](_0x32b31b);};module[_0x8b07('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index eae5ecc..f702dee 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 _0x40be=['handleFetchEnd','error','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','account','textCode','hasOwnProperty','path','util','imap','lodash','randomstring','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','once','ready','handleReady','bind','end','handleEnd','handleError','connect','inherits','prototype','connTimeout','isNil','service','user','password','host','port','tls','autotls','anonymous@xcally.com','openBox','handleOpenBox','emit','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError'];(function(_0x275a90,_0xa0f3cc){var _0x17b092=function(_0x45ec5a){while(--_0x45ec5a){_0x275a90['push'](_0x275a90['shift']());}};_0x17b092(++_0xa0f3cc);}(_0x40be,0x100));var _0xe40b=function(_0x10052d,_0x26177a){_0x10052d=_0x10052d-0x0;var _0x10279c=_0x40be[_0x10052d];return _0x10279c;};'use strict';var fs=require('fs');var path=require(_0xe40b('0x0'));var util=require(_0xe40b('0x1'));var Imap=require(_0xe40b('0x2'));var _=require(_0xe40b('0x3'));var rs=require(_0xe40b('0x4'));var simpleParser=require('mailparser')[_0xe40b('0x5')];var Iconv=require(_0xe40b('0x6'))[_0xe40b('0x7')];var EventEmitter=require(_0xe40b('0x8'))[_0xe40b('0x9')];var utils=require(_0xe40b('0xa'));var logger=require(_0xe40b('0xb'))(_0xe40b('0xc'));function EmailImap(_0x18aabb,_0x105a3e){this[_0xe40b('0xd')]=_0xe40b('0xe');this['account']=this[_0xe40b('0xf')](_0x18aabb,_0x105a3e);this[_0xe40b('0x2')]=new Imap(this['account']);this['imap'][_0xe40b('0x10')](_0xe40b('0x11'),this[_0xe40b('0x12')][_0xe40b('0x13')](this));this[_0xe40b('0x2')][_0xe40b('0x10')](_0xe40b('0x14'),this[_0xe40b('0x15')][_0xe40b('0x13')](this));this[_0xe40b('0x2')]['on']('error',this[_0xe40b('0x16')][_0xe40b('0x13')](this));this[_0xe40b('0x2')][_0xe40b('0x17')]();}util[_0xe40b('0x18')](EmailImap,EventEmitter);EmailImap[_0xe40b('0x19')]['getAccount']=function(_0x78343d,_0x587931){var _0xba3a4d={'connTimeout':_0x78343d[_0xe40b('0x1a')]?_0x78343d['connTimeout']*0x3e8:0x2710,'authTimeout':_0x78343d['authTimeout']?_0x78343d['authTimeout']*0x3e8:0x1388};if(_[_0xe40b('0x1b')](_0x78343d[_0xe40b('0x1c')])){if(_0x78343d['authentication']){_0xba3a4d[_0xe40b('0x1d')]=_0x78343d[_0xe40b('0x1d')];_0xba3a4d[_0xe40b('0x1e')]=_0x78343d[_0xe40b('0x1e')];}_0xba3a4d['host']=_0x78343d[_0xe40b('0x1f')];_0xba3a4d[_0xe40b('0x20')]=_0x78343d[_0xe40b('0x20')]||0x3e1;if(_0x78343d[_0xe40b('0x21')]){_0xba3a4d['tls']=!![];}else{_0xba3a4d[_0xe40b('0x21')]=![];_0xba3a4d[_0xe40b('0x22')]='required';}}else{_0xba3a4d[_0xe40b('0x1d')]=_0x78343d[_0xe40b('0x1d')];_0xba3a4d['password']=_0x78343d['password'];_0xba3a4d['host']=utils['getHost'](_0x78343d[_0xe40b('0x1c')]);_0xba3a4d['port']=0x3e1;_0xba3a4d['tls']=!![];}_0xba3a4d['email']=_0x587931||_0x78343d[_0xe40b('0x1d')]||_0xe40b('0x23');return _0xba3a4d;};EmailImap[_0xe40b('0x19')][_0xe40b('0x12')]=function(){this[_0xe40b('0x2')][_0xe40b('0x24')](this[_0xe40b('0xd')],![],this[_0xe40b('0x25')][_0xe40b('0x13')](this));};EmailImap['prototype'][_0xe40b('0x25')]=function(_0x399c0e,_0x3a796c){if(_0x399c0e){this['handleError'](_0x399c0e,!![]);}else{this[_0xe40b('0x26')](_0xe40b('0x27'),_0x3a796c);this['readUnseen']();}};EmailImap[_0xe40b('0x19')][_0xe40b('0x28')]=function(_0x2dee6b){if(_0x2dee6b){this[_0xe40b('0x16')](_0x2dee6b,!![]);}else{this['imap'][_0xe40b('0x14')]();}};EmailImap[_0xe40b('0x19')][_0xe40b('0x29')]=function(){this[_0xe40b('0x2')][_0xe40b('0x2a')]([_0xe40b('0x2b')],this[_0xe40b('0x2c')]['bind'](this));};EmailImap['prototype'][_0xe40b('0x2c')]=function(_0x48ac52,_0x4a2ecc){if(_0x48ac52){this[_0xe40b('0x16')](_0x48ac52,!![]);}else{if(_0x4a2ecc[_0xe40b('0x2d')]){try{var _0x13cfaf=this[_0xe40b('0x2')]['fetch'](_0x4a2ecc,{'bodies':'','markSeen':!![]});_0x13cfaf['on'](_0xe40b('0x2e'),this[_0xe40b('0x2f')][_0xe40b('0x13')](this));_0x13cfaf[_0xe40b('0x10')]('error',this[_0xe40b('0x30')][_0xe40b('0x13')](this));_0x13cfaf['once']('end',this[_0xe40b('0x31')][_0xe40b('0x13')](this));}catch(_0x3cdacb){logger[_0xe40b('0x32')](_0x3cdacb);}}else{this[_0xe40b('0x2')][_0xe40b('0x33')](!![],this[_0xe40b('0x28')][_0xe40b('0x13')](this));}}};EmailImap[_0xe40b('0x19')][_0xe40b('0x2f')]=function(_0x8b47ae,_0x2d11f4){_0x8b47ae['on']('body',this[_0xe40b('0x34')][_0xe40b('0x13')](this));_0x8b47ae['once'](_0xe40b('0x35'),this[_0xe40b('0x36')][_0xe40b('0x13')](this));_0x8b47ae[_0xe40b('0x10')](_0xe40b('0x14'),this[_0xe40b('0x37')][_0xe40b('0x13')](this));};EmailImap[_0xe40b('0x19')]['handleMessageBody']=function(_0x309096,_0x2264ed){simpleParser(_0x309096,{'Iconv':Iconv},this[_0xe40b('0x38')][_0xe40b('0x13')](this));};EmailImap['prototype'][_0xe40b('0x36')]=function(_0x547357){};EmailImap[_0xe40b('0x19')][_0xe40b('0x37')]=function(){};EmailImap[_0xe40b('0x19')][_0xe40b('0x38')]=function(_0x165ac4,_0x3aead6){if(_0x165ac4){logger[_0xe40b('0x32')](_0x165ac4);}else{var _0x4e6d7b=this;utils[_0xe40b('0x39')](this[_0xe40b('0x3a')],_0x3aead6,function(_0x50ca9d){_0x4e6d7b[_0xe40b('0x26')](_0xe40b('0xc'),_0x50ca9d);});}};EmailImap['prototype'][_0xe40b('0x31')]=function(){this[_0xe40b('0x2')][_0xe40b('0x33')](!![],this[_0xe40b('0x28')][_0xe40b('0x13')](this));};EmailImap['prototype']['handleFetchError']=function(_0x2e0cc7){this['handleError'](_0x2e0cc7);this[_0xe40b('0x2')][_0xe40b('0x33')](!![],this[_0xe40b('0x28')][_0xe40b('0x13')](this));};EmailImap['prototype'][_0xe40b('0x15')]=function(){this[_0xe40b('0x26')](_0xe40b('0x14'));};EmailImap['prototype'][_0xe40b('0x16')]=function(_0x2a3ab6,_0x17a9c5){logger['error'](_0xe40b('0x16'),this[_0xe40b('0x3a')][_0xe40b('0xc')],JSON['stringify'](_0x2a3ab6));var _0x15073e='';if(_0x2a3ab6){if(_0x2a3ab6['textCode']){_0x15073e=_0x2a3ab6[_0xe40b('0x3b')];}else{for(var _0x54945f in _0x2a3ab6){if(_0x2a3ab6[_0xe40b('0x3c')](_0x54945f)){_0x15073e+=_['upperFirst'](_0x54945f)+':\x20'+_0x2a3ab6[_0x54945f]+'\x0a';}}}}if(_0x17a9c5){this[_0xe40b('0x2')]['end']();}else{this[_0xe40b('0x26')]('error',_0x15073e);this[_0xe40b('0x26')](_0xe40b('0x14'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x17d6=['handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','textCode','hasOwnProperty','upperFirst','exports','util','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','./utils','email','INBOX','account','getAccount','imap','handleReady','bind','handleEnd','error','handleError','connect','inherits','prototype','authTimeout','user','host','port','tls','autotls','required','password','getHost','service','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','once','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x17d6,0xbc));var _0x617d=function(_0x4029c2,_0x47b63e){_0x4029c2=_0x4029c2-0x0;var _0x4b02ba=_0x17d6[_0x4029c2];return _0x4b02ba;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x617d('0x0'));var Imap=require('imap');var _=require(_0x617d('0x1'));var rs=require(_0x617d('0x2'));var simpleParser=require(_0x617d('0x3'))[_0x617d('0x4')];var Iconv=require(_0x617d('0x5'))[_0x617d('0x6')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0x617d('0x7'));var logger=require('../../../config/logger')(_0x617d('0x8'));function EmailImap(_0xb721b4,_0x52fd76){this['mailbox']=_0x617d('0x9');this[_0x617d('0xa')]=this[_0x617d('0xb')](_0xb721b4,_0x52fd76);this[_0x617d('0xc')]=new Imap(this[_0x617d('0xa')]);this[_0x617d('0xc')]['once']('ready',this[_0x617d('0xd')][_0x617d('0xe')](this));this['imap']['once']('end',this[_0x617d('0xf')]['bind'](this));this[_0x617d('0xc')]['on'](_0x617d('0x10'),this[_0x617d('0x11')][_0x617d('0xe')](this));this[_0x617d('0xc')][_0x617d('0x12')]();}util[_0x617d('0x13')](EmailImap,EventEmitter);EmailImap[_0x617d('0x14')][_0x617d('0xb')]=function(_0x5cf250,_0x5c18e6){var _0x3fa560={'connTimeout':_0x5cf250['connTimeout']?_0x5cf250['connTimeout']*0x3e8:0x2710,'authTimeout':_0x5cf250[_0x617d('0x15')]?_0x5cf250[_0x617d('0x15')]*0x3e8:0x1388};if(_['isNil'](_0x5cf250['service'])){if(_0x5cf250['authentication']){_0x3fa560[_0x617d('0x16')]=_0x5cf250[_0x617d('0x16')];_0x3fa560['password']=_0x5cf250['password'];}_0x3fa560[_0x617d('0x17')]=_0x5cf250[_0x617d('0x17')];_0x3fa560[_0x617d('0x18')]=_0x5cf250['port']||0x3e1;if(_0x5cf250[_0x617d('0x19')]){_0x3fa560[_0x617d('0x19')]=!![];}else{_0x3fa560[_0x617d('0x19')]=![];_0x3fa560[_0x617d('0x1a')]=_0x617d('0x1b');}}else{_0x3fa560[_0x617d('0x16')]=_0x5cf250[_0x617d('0x16')];_0x3fa560[_0x617d('0x1c')]=_0x5cf250[_0x617d('0x1c')];_0x3fa560[_0x617d('0x17')]=utils[_0x617d('0x1d')](_0x5cf250[_0x617d('0x1e')]);_0x3fa560[_0x617d('0x18')]=0x3e1;_0x3fa560[_0x617d('0x19')]=!![];}_0x3fa560['email']=_0x5c18e6||_0x5cf250[_0x617d('0x16')]||_0x617d('0x1f');return _0x3fa560;};EmailImap[_0x617d('0x14')][_0x617d('0xd')]=function(){this['imap'][_0x617d('0x20')](this['mailbox'],![],this[_0x617d('0x21')][_0x617d('0xe')](this));};EmailImap[_0x617d('0x14')][_0x617d('0x21')]=function(_0x21dc96,_0x3c69a2){if(_0x21dc96){this[_0x617d('0x11')](_0x21dc96,!![]);}else{this[_0x617d('0x22')](_0x617d('0x23'),_0x3c69a2);this[_0x617d('0x24')]();}};EmailImap[_0x617d('0x14')][_0x617d('0x25')]=function(_0x4d2fff){if(_0x4d2fff){this['handleError'](_0x4d2fff,!![]);}else{this['imap'][_0x617d('0x26')]();}};EmailImap[_0x617d('0x14')]['readUnseen']=function(){this[_0x617d('0xc')][_0x617d('0x27')]([_0x617d('0x28')],this[_0x617d('0x29')][_0x617d('0xe')](this));};EmailImap[_0x617d('0x14')][_0x617d('0x29')]=function(_0x13dcb3,_0x1f037d){if(_0x13dcb3){this['handleError'](_0x13dcb3,!![]);}else{if(_0x1f037d[_0x617d('0x2a')]){try{var _0x4b42a6=this[_0x617d('0xc')][_0x617d('0x2b')](_0x1f037d,{'bodies':'','markSeen':!![]});_0x4b42a6['on']('message',this[_0x617d('0x2c')]['bind'](this));_0x4b42a6[_0x617d('0x2d')]('error',this[_0x617d('0x2e')]['bind'](this));_0x4b42a6[_0x617d('0x2d')](_0x617d('0x26'),this[_0x617d('0x2f')][_0x617d('0xe')](this));}catch(_0x1dda68){logger['error'](_0x1dda68);}}else{this[_0x617d('0xc')][_0x617d('0x30')](!![],this[_0x617d('0x25')]['bind'](this));}}};EmailImap[_0x617d('0x14')][_0x617d('0x2c')]=function(_0x339fe1,_0x98c4a1){_0x339fe1['on'](_0x617d('0x31'),this[_0x617d('0x32')][_0x617d('0xe')](this));_0x339fe1['once'](_0x617d('0x33'),this[_0x617d('0x34')][_0x617d('0xe')](this));_0x339fe1[_0x617d('0x2d')](_0x617d('0x26'),this[_0x617d('0x35')][_0x617d('0xe')](this));};EmailImap[_0x617d('0x14')][_0x617d('0x32')]=function(_0x123e4b,_0xea00c){simpleParser(_0x123e4b,{'Iconv':Iconv},this[_0x617d('0x36')][_0x617d('0xe')](this));};EmailImap[_0x617d('0x14')][_0x617d('0x34')]=function(_0x129260){};EmailImap[_0x617d('0x14')][_0x617d('0x35')]=function(){};EmailImap[_0x617d('0x14')]['handleSimpleParser']=function(_0xaeca4b,_0x1495a5){if(_0xaeca4b){logger[_0x617d('0x10')](_0xaeca4b);}else{var _0x3c08c8=this;utils[_0x617d('0x37')](this[_0x617d('0xa')],_0x1495a5,function(_0x4341b3){_0x3c08c8['emit']('email',_0x4341b3);});}};EmailImap[_0x617d('0x14')][_0x617d('0x2f')]=function(){this['imap'][_0x617d('0x30')](!![],this[_0x617d('0x25')]['bind'](this));};EmailImap[_0x617d('0x14')]['handleFetchError']=function(_0x25fe06){this[_0x617d('0x11')](_0x25fe06);this[_0x617d('0xc')]['closeBox'](!![],this[_0x617d('0x25')][_0x617d('0xe')](this));};EmailImap[_0x617d('0x14')]['handleEnd']=function(){this[_0x617d('0x22')](_0x617d('0x26'));};EmailImap[_0x617d('0x14')][_0x617d('0x11')]=function(_0x1675ef,_0x4956e3){logger[_0x617d('0x10')](_0x617d('0x11'),this[_0x617d('0xa')]['email'],JSON['stringify'](_0x1675ef));var _0x29808f='';if(_0x1675ef){if(_0x1675ef[_0x617d('0x38')]){_0x29808f=_0x1675ef[_0x617d('0x38')];}else{for(var _0x904f1b in _0x1675ef){if(_0x1675ef[_0x617d('0x39')](_0x904f1b)){_0x29808f+=_[_0x617d('0x3a')](_0x904f1b)+':\x20'+_0x1675ef[_0x904f1b]+'\x0a';}}}}if(_0x4956e3){this[_0x617d('0xc')][_0x617d('0x26')]();}else{this['emit'](_0x617d('0x10'),_0x29808f);this[_0x617d('0x22')]('end');}};module[_0x617d('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index dad7bb1..8767b49 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 _0x38e5=['sendMail','toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x38e5,0xaa));var _0x538e=function(_0x3c93a4,_0x581864){_0x3c93a4=_0x3c93a4-0x0;var _0x64c273=_0x38e5[_0x3c93a4];return _0x64c273;};'use strict';var nodemailer=require('nodemailer');var BPromise=require('bluebird');var inlineBase64=require(_0x538e('0x0'));function EmailSmtp(){}EmailSmtp[_0x538e('0x1')][_0x538e('0x2')]=function(_0x32bfae,_0xab4a5d){return new BPromise(function(_0x193bd3,_0x2652e2){var _0x522400=nodemailer[_0x538e('0x3')](_0x32bfae);_0x522400[_0x538e('0x4')](_0x538e('0x5'),inlineBase64());_0x522400[_0x538e('0x6')](_0xab4a5d,function(_0x587619,_0x3ef765){if(_0x587619){_0x2652e2(_0x587619[_0x538e('0x7')]());}else{_0x193bd3(_0x3ef765);}});});};EmailSmtp[_0x538e('0x1')][_0x538e('0x8')]=function(_0x1a7574){return new BPromise(function(_0x1138aa,_0x1f6406){var _0x203712=nodemailer[_0x538e('0x3')](_0x1a7574);_0x203712['verify'](function(_0x4ae89c,_0x51c883){if(_0x4ae89c){_0x1f6406(_0x4ae89c[_0x538e('0x7')]());}else{if(_0x51c883){_0x1138aa(_0x51c883);}else{_0x1f6406(_0x538e('0x9'));}}});});};module[_0x538e('0xa')]=EmailSmtp; \ No newline at end of file +var _0x8c40=['bluebird','nodemailer-plugin-inline-base64','send','createTransport','compile','toString','prototype','verify','exports','nodemailer'];(function(_0xb80461,_0x3e0f95){var _0x4cc423=function(_0x5b448e){while(--_0x5b448e){_0xb80461['push'](_0xb80461['shift']());}};_0x4cc423(++_0x3e0f95);}(_0x8c40,0x171));var _0x08c4=function(_0x9393ae,_0x3a428e){_0x9393ae=_0x9393ae-0x0;var _0x4a0ea1=_0x8c40[_0x9393ae];return _0x4a0ea1;};'use strict';var nodemailer=require(_0x08c4('0x0'));var BPromise=require(_0x08c4('0x1'));var inlineBase64=require(_0x08c4('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0x08c4('0x3')]=function(_0x164310,_0x249065){return new BPromise(function(_0x4823a8,_0x327433){var _0x3fcdce=nodemailer[_0x08c4('0x4')](_0x164310);_0x3fcdce['use'](_0x08c4('0x5'),inlineBase64());_0x3fcdce['sendMail'](_0x249065,function(_0x53f3d6,_0x107dd3){if(_0x53f3d6){_0x327433(_0x53f3d6[_0x08c4('0x6')]());}else{_0x4823a8(_0x107dd3);}});});};EmailSmtp[_0x08c4('0x7')][_0x08c4('0x8')]=function(_0x48a0f8){return new BPromise(function(_0x50f53a,_0x2d7d1a){var _0x59075c=nodemailer[_0x08c4('0x4')](_0x48a0f8);_0x59075c[_0x08c4('0x8')](function(_0x248bf0,_0x20fcc1){if(_0x248bf0){_0x2d7d1a(_0x248bf0[_0x08c4('0x6')]());}else{if(_0x20fcc1){_0x50f53a(_0x20fcc1);}else{_0x2d7d1a('Not\x20verifired');}}});});};module[_0x08c4('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 24e75f8..9adb065 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 _0x4753=['head','name','substring','indexOf','split','slice','Anonymous','isEmpty','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','push','Data','getHost','gmail','yahoo','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','util','node-tnef','email','value','address','anonymous','generate','@xcally.com'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4753,0x1f4));var _0x3475=function(_0x6c79b0,_0x532a89){_0x6c79b0=_0x6c79b0-0x0;var _0x169f4f=_0x4753[_0x6c79b0];return _0x169f4f;};'use strict';var _=require(_0x3475('0x0'));var moment=require(_0x3475('0x1'));var random=require(_0x3475('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x3475('0x3'));var tnef=require(_0x3475('0x4'));var logger=require('../../../config/logger')(_0x3475('0x5'));var config=require('../../../config/environment');function getAddress(_0x5a801b){var _0x5de37e=_['head'](_0x5a801b[_0x3475('0x6')]);return _0x5de37e&&_0x5de37e[_0x3475('0x7')]?_0x5de37e['address']:_0x3475('0x8')+random[_0x3475('0x9')](0x6)+_0x3475('0xa');}function getFirstName(_0x1d021b){var _0x6b37e6=_[_0x3475('0xb')](_0x1d021b[_0x3475('0x6')]);if(_0x6b37e6&&_0x6b37e6[_0x3475('0xc')]){if(_0x6b37e6[_0x3475('0xc')]==_0x6b37e6[_0x3475('0x7')]){return _0x6b37e6['name'][_0x3475('0xd')](0x0,_0x6b37e6[_0x3475('0xc')][_0x3475('0xe')]('@'));}var _0x4cb55a=_0x6b37e6[_0x3475('0xc')][_0x3475('0xf')](/\s+/);return _0x4cb55a['length']>0x1?_0x4cb55a[_0x3475('0x10')](0x0,-0x1)['join']('\x20'):_0x6b37e6[_0x3475('0xc')];}return _0x3475('0x11');}function getLastName(_0x1b9cfc){var _0x4a4485=_[_0x3475('0xb')](_0x1b9cfc[_0x3475('0x6')]);if(_0x4a4485&&_0x4a4485[_0x3475('0xc')]){var _0x219520=_0x4a4485['name'][_0x3475('0xf')](/\s+/);return _0x219520['length']>0x1?_0x219520['pop']():'';}return'';}function getMails(_0x3fd0d2,_0x1dd054){var _0x325fe5='';for(var _0x1e0c0a=0x0;_0x1e0c0a<_0x1dd054[_0x3475('0x6')]['length'];_0x1e0c0a+=0x1){if(_0x1dd054[_0x3475('0x6')][_0x1e0c0a]['address']!==_0x3fd0d2){if(!_[_0x3475('0x12')](_0x325fe5)){_0x325fe5+=',';}_0x325fe5+=_0x1dd054[_0x3475('0x6')][_0x1e0c0a][_0x3475('0xc')]||_0x1dd054[_0x3475('0x6')][_0x1e0c0a]['address']||'';_0x325fe5+='\x20<';_0x325fe5+=_0x1dd054[_0x3475('0x6')][_0x1e0c0a]['address']?_0x1dd054[_0x3475('0x6')][_0x1e0c0a][_0x3475('0x7')]:_0x3475('0x8')+random[_0x3475('0x9')](0x6)+'@xcally.com';_0x325fe5+='>';}}return _0x325fe5;}function parseEmail(_0x101ff1,_0xdac710,_0x649ad){if(_0xdac710['html']){var _0x217f68=/)<[^<]*)*<\/script>/gi;while(_0x217f68[_0x3475('0x13')](_0xdac710[_0x3475('0x14')])){_0xdac710[_0x3475('0x14')]=_0xdac710[_0x3475('0x14')][_0x3475('0x15')](_0x217f68,'');}if(_0xdac710[_0x3475('0x14')][_0x3475('0x16')](_0x3475('0x17'))){var _0x3ade34=[];_0xdac710[_0x3475('0x18')][_0x3475('0x19')](_0x1c8ca6=>{_0x3ade34['push'](_0x1c8ca6['filename']);});var _0x52c825=/]+>/g;var _0x552cc=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2939e3=_0xdac710['html'][_0x3475('0x15')](_0x552cc,_0x3475('0x1a'));var _0x6a0197=_0x2939e3[_0x3475('0x15')](_0x52c825,_0x3475('0x1b'));for(let _0x52ca74=0x0;_0x52ca74<_0x3ade34['length'];_0x52ca74++){var _0x307467=_0x6a0197[_0x3475('0x15')](_0x3475('0x1b'),_0x3475('0x1c')+_0x3ade34[_0x52ca74]+_0x3475('0x1d'));_0x6a0197=_0x307467;}_0xdac710[_0x3475('0x14')]=_0x6a0197;}_0x649ad['body']=_0xdac710[_0x3475('0x14')];}else{_0x649ad[_0x3475('0x1e')]=_0xdac710[_0x3475('0x1f')];}if(_0x649ad[_0x3475('0x1e')]){_0x649ad[_0x3475('0x1e')]=_0x649ad['body']['replace'](/0x0){var _0x301d31=[_0x3475('0x33'),_0x3475('0x34'),'Precedence:\x20auto_reply'];for(var _0x2f9670=0x0;_0x2f9670<_0xdac710[_0x3475('0x32')][_0x3475('0x26')];_0x2f9670++){var _0x4d4e13=_[_0x3475('0xe')](_0x301d31,_0xdac710['headerLines'][_0x2f9670][_0x3475('0x35')]);if(_0x4d4e13>=0x0){_0x649ad[_0x3475('0x36')]=!![];}}}return _0x649ad;}exports[_0x3475('0x37')]=function(_0x14de28,_0x1c9a92,_0x588dba){var _0x264209={'from':getAddress(_0x1c9a92['from']),'firstName':getFirstName(_0x1c9a92['from']),'lastName':getLastName(_0x1c9a92[_0x3475('0x38')]),'mapKey':_0x3475('0x5'),'message':{'from':getMails(_0x14de28['email'],_0x1c9a92[_0x3475('0x38')]),'to':_0x14de28[_0x3475('0x5')],'cc':'','subject':_0x1c9a92[_0x3475('0x39')]||'','messageId':_0x1c9a92[_0x3475('0x3a')],'inReplyTo':_0x1c9a92['inReplyTo'],'sentAt':moment(_0x1c9a92['date'])[_0x3475('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x1c9a92['html']&&!_0x1c9a92['textAsHtml']){var _0x368d76=_['filter'](_0x1c9a92[_0x3475('0x18')],{'contentType':_0x3475('0x3b')});if(_0x368d76[_0x3475('0x26')]){logger[_0x3475('0x3c')](util[_0x3475('0x2b')](_0x3475('0x3d'),_0x1c9a92['messageId']));tnef[_0x3475('0x3e')](_['first'](_0x368d76)[_0x3475('0x30')],function(_0x3793c4,_0x5c5e3e){if(_0x5c5e3e){_0x1c9a92[_0x3475('0x14')]=_0x5c5e3e[_0x3475('0x3f')]||_0x3475('0x40');if(_0x5c5e3e['Attachments']){for(var _0x24991a=0x0;_0x24991a<_0x5c5e3e['Attachments'][_0x3475('0x26')];_0x24991a++){var _0x59d93a=_0x5c5e3e['Attachments'][_0x24991a];_0x264209[_0x3475('0x21')][_0x3475('0x18')][_0x3475('0x41')]({'filename':_0x59d93a['Title'],'content':Buffer['from'](_0x59d93a[_0x3475('0x42')])});}}}_0x588dba(parseEmail(_0x14de28,_0x1c9a92,_0x264209));});}else{_0x1c9a92['html']=_0x3475('0x40');_0x588dba(parseEmail(_0x14de28,_0x1c9a92,_0x264209));}}else{_0x588dba(parseEmail(_0x14de28,_0x1c9a92,_0x264209));}};exports[_0x3475('0x43')]=function(_0x42e5e6){switch(_0x42e5e6){case _0x3475('0x44'):return'imap.gmail.com';case _0x3475('0x45'):return'imap.mail.yahoo.com';case'hotmail':return'imap-mail.outlook.com';case _0x3475('0x46'):return _0x3475('0x47');}return _0x3475('0x48');}; \ No newline at end of file +var _0x5d59=['attach','attachment','filename','attachment-','format','%s-%s','now','root','server/files/attachments/','content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','line','isAutoreply','parser','from','subject','messageId','date','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','address','anonymous','generate','name','substring','indexOf','split','join','Anonymous','value','length','pop','isEmpty','html','test','attachments','forEach','push','replace','_SRC','_IMG','\x20[Attachment:\x20','textAsHtml','body','0x1?_0x1a9bba['slice'](0x0,-0x1)[_0x95d5('0xf')]('\x20'):_0x47e9eb[_0x95d5('0xb')];}return _0x95d5('0x10');}function getLastName(_0xf64b7e){var _0x5ceae1=_[_0x95d5('0x7')](_0xf64b7e[_0x95d5('0x11')]);if(_0x5ceae1&&_0x5ceae1[_0x95d5('0xb')]){var _0x515b33=_0x5ceae1[_0x95d5('0xb')][_0x95d5('0xe')](/\s+/);return _0x515b33[_0x95d5('0x12')]>0x1?_0x515b33[_0x95d5('0x13')]():'';}return'';}function getMails(_0x14d8a9,_0x53e0b3){var _0x501dcb='';for(var _0x1747f2=0x0;_0x1747f2<_0x53e0b3['value'][_0x95d5('0x12')];_0x1747f2+=0x1){if(_0x53e0b3[_0x95d5('0x11')][_0x1747f2]['address']!==_0x14d8a9){if(!_[_0x95d5('0x14')](_0x501dcb)){_0x501dcb+=',';}_0x501dcb+=_0x53e0b3[_0x95d5('0x11')][_0x1747f2][_0x95d5('0xb')]||_0x53e0b3[_0x95d5('0x11')][_0x1747f2][_0x95d5('0x8')]||'';_0x501dcb+='\x20<';_0x501dcb+=_0x53e0b3[_0x95d5('0x11')][_0x1747f2]['address']?_0x53e0b3[_0x95d5('0x11')][_0x1747f2][_0x95d5('0x8')]:_0x95d5('0x9')+random['generate'](0x6)+'@xcally.com';_0x501dcb+='>';}}return _0x501dcb;}function parseEmail(_0x3f7d56,_0x4023d3,_0x553561){if(_0x4023d3[_0x95d5('0x15')]){var _0x2557e7=/)<[^<]*)*<\/script>/gi;while(_0x2557e7[_0x95d5('0x16')](_0x4023d3['html'])){_0x4023d3[_0x95d5('0x15')]=_0x4023d3['html']['replace'](_0x2557e7,'');}if(_0x4023d3['html']['includes']('{_0x4cb5b8[_0x95d5('0x19')](_0x413f8e['filename']);});var _0x3fe6ef=/]+>/g;var _0x126587=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x316d19=_0x4023d3[_0x95d5('0x15')][_0x95d5('0x1a')](_0x126587,_0x95d5('0x1b'));var _0x244e31=_0x316d19[_0x95d5('0x1a')](_0x3fe6ef,_0x95d5('0x1c'));for(let _0x20f0da=0x0;_0x20f0da<_0x4cb5b8['length'];_0x20f0da++){var _0x4d6a64=_0x244e31[_0x95d5('0x1a')](_0x95d5('0x1c'),_0x95d5('0x1d')+_0x4cb5b8[_0x20f0da]+'\x20]');_0x244e31=_0x4d6a64;}_0x4023d3[_0x95d5('0x15')]=_0x244e31;}_0x553561['body']=_0x4023d3[_0x95d5('0x15')];}else{_0x553561['body']=_0x4023d3[_0x95d5('0x1e')];}if(_0x553561[_0x95d5('0x1f')]){_0x553561[_0x95d5('0x1f')]=_0x553561[_0x95d5('0x1f')][_0x95d5('0x1a')](/0x0){var _0x3b610d=[_0x95d5('0x32'),_0x95d5('0x33'),'Precedence:\x20auto_reply'];for(var _0x619d72=0x0;_0x619d72<_0x4023d3[_0x95d5('0x31')][_0x95d5('0x12')];_0x619d72++){var _0x31dc31=_[_0x95d5('0xd')](_0x3b610d,_0x4023d3[_0x95d5('0x31')][_0x619d72][_0x95d5('0x34')]);if(_0x31dc31>=0x0){_0x553561[_0x95d5('0x35')]=!![];}}}return _0x553561;}exports[_0x95d5('0x36')]=function(_0x5bc9c8,_0x37238b,_0x23cb91){var _0x37e352={'from':getAddress(_0x37238b[_0x95d5('0x37')]),'firstName':getFirstName(_0x37238b['from']),'lastName':getLastName(_0x37238b[_0x95d5('0x37')]),'mapKey':'email','message':{'from':getMails(_0x5bc9c8[_0x95d5('0x24')],_0x37238b[_0x95d5('0x37')]),'to':_0x5bc9c8[_0x95d5('0x24')],'cc':'','subject':_0x37238b[_0x95d5('0x38')]||'','messageId':_0x37238b[_0x95d5('0x39')],'inReplyTo':_0x37238b['inReplyTo'],'sentAt':moment(_0x37238b[_0x95d5('0x3a')])[_0x95d5('0x2b')](_0x95d5('0x3b')),'attach':![],'attachments':[]}};if(!_0x37238b[_0x95d5('0x15')]&&!_0x37238b[_0x95d5('0x1e')]){var _0x1fa13f=_[_0x95d5('0x3c')](_0x37238b[_0x95d5('0x17')],{'contentType':'application/ms-tnef'});if(_0x1fa13f['length']){logger[_0x95d5('0x3d')](util[_0x95d5('0x2b')](_0x95d5('0x3e'),_0x37238b['messageId']));tnef[_0x95d5('0x3f')](_[_0x95d5('0x40')](_0x1fa13f)['content'],function(_0x63b1e1,_0x547dce){if(_0x547dce){_0x37238b[_0x95d5('0x15')]=_0x547dce[_0x95d5('0x41')]||_0x95d5('0x42');if(_0x547dce[_0x95d5('0x43')]){for(var _0x2ebc44=0x0;_0x2ebc44<_0x547dce[_0x95d5('0x43')][_0x95d5('0x12')];_0x2ebc44++){var _0x22d93b=_0x547dce['Attachments'][_0x2ebc44];_0x37e352['message'][_0x95d5('0x17')][_0x95d5('0x19')]({'filename':_0x22d93b[_0x95d5('0x44')],'content':Buffer[_0x95d5('0x37')](_0x22d93b[_0x95d5('0x45')])});}}}_0x23cb91(parseEmail(_0x5bc9c8,_0x37238b,_0x37e352));});}else{_0x37238b['html']=_0x95d5('0x42');_0x23cb91(parseEmail(_0x5bc9c8,_0x37238b,_0x37e352));}}else{_0x23cb91(parseEmail(_0x5bc9c8,_0x37238b,_0x37e352));}};exports[_0x95d5('0x46')]=function(_0x4922d6){switch(_0x4922d6){case _0x95d5('0x47'):return _0x95d5('0x48');case'yahoo':return _0x95d5('0x49');case _0x95d5('0x4a'):return _0x95d5('0x4b');case'outlook365':return _0x95d5('0x4c');}return _0x95d5('0x4d');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 9cbf2d8..43c33af 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 _0x38b4=['active','Imap','Smtp','name','Service','key'];(function(_0x1a50d4,_0x22b81c){var _0x656838=function(_0xbc1811){while(--_0xbc1811){_0x1a50d4['push'](_0x1a50d4['shift']());}};_0x656838(++_0x22b81c);}(_0x38b4,0x129));var _0x438b=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x38b4[_0x4b174a];return _0x3cd7bf;};'use strict';var _=require('lodash');function MailAccount(_0x2817ba){this['id']=_0x2817ba['id']||0x0;this[_0x438b('0x0')]=_0x2817ba[_0x438b('0x0')]||_0x438b('0x1');this[_0x438b('0x2')]=_0x2817ba['key']||'SERV';this[_0x438b('0x3')]=_0x2817ba[_0x438b('0x3')]||![];this[_0x438b('0x4')]=_0x2817ba[_0x438b('0x4')]||[];this[_0x438b('0x5')]=_0x2817ba[_0x438b('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x2a89=['Service','key','active','Imap','Smtp','lodash','name'];(function(_0x56d5e9,_0x25f6cd){var _0x3488fd=function(_0x50ae76){while(--_0x50ae76){_0x56d5e9['push'](_0x56d5e9['shift']());}};_0x3488fd(++_0x25f6cd);}(_0x2a89,0x178));var _0x92a8=function(_0x4e2ece,_0x371f7b){_0x4e2ece=_0x4e2ece-0x0;var _0x5bc940=_0x2a89[_0x4e2ece];return _0x5bc940;};'use strict';var _=require(_0x92a8('0x0'));function MailAccount(_0x18d641){this['id']=_0x18d641['id']||0x0;this['name']=_0x18d641[_0x92a8('0x1')]||_0x92a8('0x2');this[_0x92a8('0x3')]=_0x18d641[_0x92a8('0x3')]||'SERV';this[_0x92a8('0x4')]=_0x18d641[_0x92a8('0x4')]||![];this['Imap']=_0x18d641[_0x92a8('0x5')]||[];this[_0x92a8('0x6')]=_0x18d641['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 8109daa..2542f29 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 _0xe3d2=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','isUndefined','merge'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0xe3d2,0x1cf));var _0x2e3d=function(_0x51f84a,_0x445f17){_0x51f84a=_0x51f84a-0x0;var _0x4ba63d=_0xe3d2[_0x51f84a];return _0x4ba63d;};'use strict';var _=require(_0x2e3d('0x0'));var MailAccount=require(_0x2e3d('0x1'));var Realtime=function(){this[_0x2e3d('0x2')]={};};function freeIsNotKey(_0x10acaf,_0x33b31a,_0x2801a0){var _0x25b44f=_[_0x2e3d('0x3')](_0x10acaf,function(_0x629c84,_0x407b52){return _0x629c84[_0x2801a0];});for(var _0x10535f in _0x33b31a){if(_0x33b31a[_0x2e3d('0x4')](_0x10535f)){if(!_0x25b44f[_0x10535f]){delete _0x33b31a[_0x10535f];}}}}Realtime[_0x2e3d('0x5')][_0x2e3d('0x6')]=function(_0x3f882d,_0x1c0e5b){for(var _0x46e9e2 in _0x1c0e5b){if(_0x3f882d[_0x2e3d('0x4')](_0x46e9e2)){_0x3f882d[_0x46e9e2]=_0x1c0e5b[_0x46e9e2];}}};Realtime[_0x2e3d('0x5')][_0x2e3d('0x7')]=function(){var _0x5f1d88=this;return function(_0x285191){if(_0x285191){freeIsNotKey(_0x285191,_0x5f1d88[_0x2e3d('0x2')],'id');for(var _0x1c1c8d=0x0,_0x4ff55d={},_0x15f986={};_0x1c1c8d<_0x285191['length'];_0x1c1c8d+=0x1){_0x4ff55d=_0x285191[_0x1c1c8d];if(_[_0x2e3d('0x8')](_0x5f1d88[_0x2e3d('0x2')][_0x4ff55d['id']])){_0x5f1d88[_0x2e3d('0x2')][_0x4ff55d['id']]=new MailAccount(_0x4ff55d);}else{_[_0x2e3d('0x9')](_0x5f1d88[_0x2e3d('0x2')][_0x4ff55d['id']],_0x4ff55d);}}}return _0x5f1d88[_0x2e3d('0x2')];};};module[_0x2e3d('0xa')]=Realtime; \ No newline at end of file +var _0x5d87=['hasOwnProperty','prototype','initMailAccounts','isUndefined','mailAccounts','merge','exports','lodash','../model/mailAccount','mapKeys'];(function(_0x3e009d,_0x196241){var _0x472075=function(_0x32168a){while(--_0x32168a){_0x3e009d['push'](_0x3e009d['shift']());}};_0x472075(++_0x196241);}(_0x5d87,0x115));var _0x75d8=function(_0x5c2c62,_0x177145){_0x5c2c62=_0x5c2c62-0x0;var _0x4d399a=_0x5d87[_0x5c2c62];return _0x4d399a;};'use strict';var _=require(_0x75d8('0x0'));var MailAccount=require(_0x75d8('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x2c0a5e,_0x5e2662,_0xe66f5e){var _0x206cf1=_[_0x75d8('0x2')](_0x2c0a5e,function(_0xdf056a,_0x5b211d){return _0xdf056a[_0xe66f5e];});for(var _0x111866 in _0x5e2662){if(_0x5e2662[_0x75d8('0x3')](_0x111866)){if(!_0x206cf1[_0x111866]){delete _0x5e2662[_0x111866];}}}}Realtime[_0x75d8('0x4')]['mergeFromDatabase']=function(_0xaab5de,_0xcf4f78){for(var _0x342f1a in _0xcf4f78){if(_0xaab5de[_0x75d8('0x3')](_0x342f1a)){_0xaab5de[_0x342f1a]=_0xcf4f78[_0x342f1a];}}};Realtime[_0x75d8('0x4')][_0x75d8('0x5')]=function(){var _0xcf20bb=this;return function(_0x44a81a){if(_0x44a81a){freeIsNotKey(_0x44a81a,_0xcf20bb['mailAccounts'],'id');for(var _0x430002=0x0,_0x5ace6d={},_0x8001ff={};_0x430002<_0x44a81a['length'];_0x430002+=0x1){_0x5ace6d=_0x44a81a[_0x430002];if(_[_0x75d8('0x6')](_0xcf20bb[_0x75d8('0x7')][_0x5ace6d['id']])){_0xcf20bb['mailAccounts'][_0x5ace6d['id']]=new MailAccount(_0x5ace6d);}else{_[_0x75d8('0x8')](_0xcf20bb[_0x75d8('0x7')][_0x5ace6d['id']],_0x5ace6d);}}}return _0xcf20bb[_0x75d8('0x7')];};};module[_0x75d8('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 1068b3f..684062e 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 _0x9416=['Imap','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','email','active','key','ListId','TemplateId','MailServerIn'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9416,0xde));var _0x6941=function(_0x594377,_0x211fdc){_0x594377=_0x594377-0x0;var _0x4d0034=_0x9416[_0x594377];return _0x4d0034;};'use strict';var client=require(_0x6941('0x0'));exports[_0x6941('0x1')]=function(){return function(){return client[_0x6941('0x2')](_0x6941('0x3'),{'options':{'attributes':['id',_0x6941('0x4'),_0x6941('0x5'),_0x6941('0x6'),_0x6941('0x7'),_0x6941('0x8'),_0x6941('0x9'),_0x6941('0xa')],'raw':![],'include':[{'model':_0x6941('0xb'),'as':_0x6941('0xc')},{'model':_0x6941('0xd'),'as':_0x6941('0xe')}]},'log':_0x6941('0xf')});};};exports[_0x6941('0x10')]=function(_0x293b7e,_0x5cb607){return client[_0x6941('0x2')](_0x6941('0x11'),{'account':{'id':_0x293b7e},'body':_0x5cb607,'log':_0x6941('0x11')});}; \ No newline at end of file +var _0xe829=['key','ListId','MailServerOut','Smtp','getMailAccount','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','name','service','email'];(function(_0x47a17d,_0x628c9e){var _0x426f5c=function(_0x20296f){while(--_0x20296f){_0x47a17d['push'](_0x47a17d['shift']());}};_0x426f5c(++_0x628c9e);}(_0xe829,0xde));var _0x9e82=function(_0x185334,_0x4630ac){_0x185334=_0x185334-0x0;var _0xf2e59a=_0xe829[_0x185334];return _0xf2e59a;};'use strict';var client=require('../client');exports[_0x9e82('0x0')]=function(){return function(){return client[_0x9e82('0x1')](_0x9e82('0x2'),{'options':{'attributes':['id',_0x9e82('0x3'),_0x9e82('0x4'),_0x9e82('0x5'),'active',_0x9e82('0x6'),_0x9e82('0x7'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':'Imap'},{'model':_0x9e82('0x8'),'as':_0x9e82('0x9')}]},'log':_0x9e82('0xa')});};};exports['notify']=function(_0x166f01,_0x2b1ecb){return client[_0x9e82('0x1')](_0x9e82('0xb'),{'account':{'id':_0x166f01},'body':_0x2b1ecb,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 023d23f..776a789 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 _0x6aae=['getSettings','loginMailFrequency','GetSettings'];(function(_0x53db0b,_0x1c9695){var _0x152d41=function(_0x194c32){while(--_0x194c32){_0x53db0b['push'](_0x53db0b['shift']());}};_0x152d41(++_0x1c9695);}(_0x6aae,0xf6));var _0xe6aa=function(_0x2a1a2c,_0x12d1e2){_0x2a1a2c=_0x2a1a2c-0x0;var _0x435e08=_0x6aae[_0x2a1a2c];return _0x435e08;};'use strict';var client=require('../client');exports[_0xe6aa('0x0')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe6aa('0x1')]},'log':_0xe6aa('0x2')});}; \ No newline at end of file +var _0xc88d=['ShowSetting','GetSettings','getSettings'];(function(_0x290fa6,_0x16d017){var _0x47f1f3=function(_0x2b5eb8){while(--_0x2b5eb8){_0x290fa6['push'](_0x290fa6['shift']());}};_0x47f1f3(++_0x16d017);}(_0xc88d,0x1d3));var _0xdc88=function(_0x1c6a52,_0x2ff2a5){_0x1c6a52=_0x1c6a52-0x0;var _0x4f886d=_0xc88d[_0x1c6a52];return _0x4f886d;};'use strict';var client=require('../client');exports[_0xdc88('0x0')]=function(){return client['Request'](_0xdc88('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xdc88('0x2')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 71b3934..929d603 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index cbab63a..e18e78f 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 _0x730d=['../../config/triggers','default','../../config/socketio','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','sticky-session','ioredis','../../config/environment','listen','port','socket.io','redis','defaults','socket.io-redis'];(function(_0x39e111,_0x51d815){var _0x261469=function(_0x19a40d){while(--_0x19a40d){_0x39e111['push'](_0x39e111['shift']());}};_0x261469(++_0x51d815);}(_0x730d,0x193));var _0xd730=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x730d[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var http=require(_0xd730('0x0'));var express=require(_0xd730('0x1'));var sticky=require(_0xd730('0x2'));var Redis=require(_0xd730('0x3'));var config=require(_0xd730('0x4'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0xd730('0x5')](server,config[_0xd730('0x6')])){var socketio=require(_0xd730('0x7'))(server,{'transports':['websocket','polling']});config[_0xd730('0x8')]=_[_0xd730('0x9')](config[_0xd730('0x8')],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0xd730('0xa'))({'pubClient':new Redis(config[_0xd730('0x8')]),'subClient':new Redis(config['redis'])}));require(_0xd730('0xb'))[_0xd730('0xc')]();require(_0xd730('0xd'))[_0xd730('0xc')](socketio);require('../../config/express')[_0xd730('0xc')](app);require('../../routes')[_0xd730('0xc')](app);}else{server[_0xd730('0xe')]('listening',function(){console[_0xd730('0xf')](_0xd730('0x10'),config[_0xd730('0x6')]);});}exports=module[_0xd730('0x11')]=app; \ No newline at end of file +var _0x4397=['port','socket.io','websocket','polling','defaults','redis','localhost','adapter','socket.io-redis','default','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','ioredis','../../config/environment'];(function(_0x4adb57,_0x3cce9a){var _0xd0617a=function(_0x4658f5){while(--_0x4658f5){_0x4adb57['push'](_0x4adb57['shift']());}};_0xd0617a(++_0x3cce9a);}(_0x4397,0x13b));var _0x7439=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x4397[_0x2c0dc0];return _0x4c0990;};'use strict';var _=require(_0x7439('0x0'));var http=require(_0x7439('0x1'));var express=require('express');var sticky=require(_0x7439('0x2'));var Redis=require(_0x7439('0x3'));var config=require(_0x7439('0x4'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x7439('0x5')])){var socketio=require(_0x7439('0x6'))(server,{'transports':[_0x7439('0x7'),_0x7439('0x8')]});config['redis']=_[_0x7439('0x9')](config[_0x7439('0xa')],{'host':_0x7439('0xb'),'port':0x18eb});socketio[_0x7439('0xc')](require(_0x7439('0xd'))({'pubClient':new Redis(config[_0x7439('0xa')]),'subClient':new Redis(config[_0x7439('0xa')])}));require('../../config/triggers')[_0x7439('0xe')]();require('../../config/socketio')[_0x7439('0xe')](socketio);require('../../config/express')[_0x7439('0xe')](app);require(_0x7439('0xf'))['default'](app);}else{server[_0x7439('0x10')]('listening',function(){console[_0x7439('0x11')](_0x7439('0x12'),config[_0x7439('0x5')]);});}exports=module[_0x7439('0x13')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index bd3d9ad..6423ed6 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 _0x3455=['debug','rpc','routing','error','message','result','exports','jayson/promise','bluebird','client','http','Request','request','then'];(function(_0x514ab5,_0x566d5e){var _0x7f0709=function(_0x5ccd85){while(--_0x5ccd85){_0x514ab5['push'](_0x514ab5['shift']());}};_0x7f0709(++_0x566d5e);}(_0x3455,0x149));var _0x5345=function(_0x10bb45,_0xa57a18){_0x10bb45=_0x10bb45-0x0;var _0x4f1846=_0x3455[_0x10bb45];return _0x4f1846;};'use strict';var jayson=require(_0x5345('0x0'));var BPromise=require(_0x5345('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x5345('0x2')][_0x5345('0x3')]({'port':0x2329});client[_0x5345('0x4')]=function(_0xdab713,_0x569f72){return new BPromise(function(_0x4c1421,_0x4b156d){return client[_0x5345('0x5')](_0xdab713,_0x569f72)[_0x5345('0x6')](function(_0x3cc703){logger[_0x5345('0x7')](_0x5345('0x8'),_0x5345('0x9'),_0xdab713,_0x569f72,_0x3cc703);if(_0x3cc703[_0x5345('0xa')]){logger[_0x5345('0xa')](_0x5345('0x8'),_0x5345('0x9'),_0xdab713,_0x3cc703[_0x5345('0xa')][_0x5345('0xb')],_0x569f72);return _0x4b156d(_0x3cc703[_0x5345('0xa')][_0x5345('0xb')]);}else{return _0x4c1421(_0x3cc703[_0x5345('0xc')]);}})['catch'](function(_0x573eae){logger[_0x5345('0xa')](_0x5345('0x8'),'routing',_0xdab713,_0x573eae,_0x569f72);return _0x4b156d(_0x573eae);});});};module[_0x5345('0xd')]=client; \ No newline at end of file +var _0xd2a7=['catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','then','debug','rpc','routing','error','message','result'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd2a7,0x12e));var _0x7d2a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2a7[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x7d2a('0x0'));var BPromise=require(_0x7d2a('0x1'));var logger=require(_0x7d2a('0x2'))('routing');var client=jayson[_0x7d2a('0x3')][_0x7d2a('0x4')]({'port':0x2329});client[_0x7d2a('0x5')]=function(_0x2e037b,_0x41f6e2){return new BPromise(function(_0x562bce,_0xc4c123){return client['request'](_0x2e037b,_0x41f6e2)[_0x7d2a('0x6')](function(_0x54e756){logger[_0x7d2a('0x7')](_0x7d2a('0x8'),_0x7d2a('0x9'),_0x2e037b,_0x41f6e2,_0x54e756);if(_0x54e756['error']){logger[_0x7d2a('0xa')](_0x7d2a('0x8'),_0x7d2a('0x9'),_0x2e037b,_0x54e756[_0x7d2a('0xa')][_0x7d2a('0xb')],_0x41f6e2);return _0xc4c123(_0x54e756[_0x7d2a('0xa')][_0x7d2a('0xb')]);}else{return _0x562bce(_0x54e756[_0x7d2a('0xc')]);}})[_0x7d2a('0xd')](function(_0x588031){logger[_0x7d2a('0xa')](_0x7d2a('0x8'),'routing',_0x2e037b,_0x588031,_0x41f6e2);return _0xc4c123(_0x588031);});});};module[_0x7d2a('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 508d587..339b593 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 _0x682b=['bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/faxQueue','./rpc/whatsappQueue','getAgents','initAgents','then','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log'];(function(_0x6b852a,_0x5662cf){var _0x43cacc=function(_0x55e8f4){while(--_0x55e8f4){_0x6b852a['push'](_0x6b852a['shift']());}};_0x43cacc(++_0x5662cf);}(_0x682b,0xcf));var _0xb682=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x682b[_0x500419];return _0x241c1a;};'use strict';var BPromise=require(_0xb682('0x0'));var server=require('./server');var Realtime=require(_0xb682('0x1'));var user=require(_0xb682('0x2'));var interval=require(_0xb682('0x3'));var openchannelQueue=require(_0xb682('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xb682('0x5'));var whatsappQueue=require(_0xb682('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0xb682('0x7')]())['then'](realtime[_0xb682('0x8')]())[_0xb682('0x9')](interval['getIntervals']())[_0xb682('0x9')](realtime[_0xb682('0xa')]())[_0xb682('0x9')](openchannelQueue[_0xb682('0xb')]())['then'](realtime[_0xb682('0xc')]())['then'](chatQueue[_0xb682('0xd')]())[_0xb682('0x9')](realtime[_0xb682('0xe')]())[_0xb682('0x9')](smsQueue[_0xb682('0xf')]())['then'](realtime[_0xb682('0x10')]())[_0xb682('0x9')](mailQueue[_0xb682('0x11')]())[_0xb682('0x9')](realtime['initMailQueues']())[_0xb682('0x9')](faxQueue['getFaxQueues']())[_0xb682('0x9')](realtime['initFaxQueues']())[_0xb682('0x9')](whatsappQueue[_0xb682('0x12')]())['then'](realtime[_0xb682('0x13')]())['then'](function(){return realtime;});}function main(){return server[_0xb682('0x14')](realtime)[_0xb682('0x9')](function(_0x16b7d9){return initRealtime();})[_0xb682('0x9')](function(_0x57b056){return setInterval(initRealtime,0x1388);})[_0xb682('0x15')](function(_0x1ea000){console[_0xb682('0x16')](_0x1ea000);});}main(); \ No newline at end of file +var _0xce27=['getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','getOpenchannelQueues'];(function(_0x1c67da,_0x1710dd){var _0xc4fb0c=function(_0x5cd552){while(--_0x5cd552){_0x1c67da['push'](_0x1c67da['shift']());}};_0xc4fb0c(++_0x1710dd);}(_0xce27,0x1af));var _0x7ce2=function(_0x8efa7a,_0x5742e6){_0x8efa7a=_0x8efa7a-0x0;var _0x11a81a=_0xce27[_0x8efa7a];return _0x11a81a;};'use strict';var BPromise=require(_0x7ce2('0x0'));var server=require(_0x7ce2('0x1'));var Realtime=require(_0x7ce2('0x2'));var user=require(_0x7ce2('0x3'));var interval=require(_0x7ce2('0x4'));var openchannelQueue=require(_0x7ce2('0x5'));var chatQueue=require(_0x7ce2('0x6'));var smsQueue=require(_0x7ce2('0x7'));var mailQueue=require(_0x7ce2('0x8'));var faxQueue=require(_0x7ce2('0x9'));var whatsappQueue=require(_0x7ce2('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x7ce2('0xb')]()[_0x7ce2('0xc')](user[_0x7ce2('0xd')]())[_0x7ce2('0xc')](realtime[_0x7ce2('0xe')]())[_0x7ce2('0xc')](interval[_0x7ce2('0xf')]())[_0x7ce2('0xc')](realtime['initIntervals']())[_0x7ce2('0xc')](openchannelQueue[_0x7ce2('0x10')]())['then'](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x7ce2('0x11')]())[_0x7ce2('0xc')](realtime[_0x7ce2('0x12')]())[_0x7ce2('0xc')](smsQueue[_0x7ce2('0x13')]())[_0x7ce2('0xc')](realtime[_0x7ce2('0x14')]())['then'](mailQueue[_0x7ce2('0x15')]())[_0x7ce2('0xc')](realtime[_0x7ce2('0x16')]())['then'](faxQueue[_0x7ce2('0x17')]())[_0x7ce2('0xc')](realtime[_0x7ce2('0x18')]())[_0x7ce2('0xc')](whatsappQueue[_0x7ce2('0x19')]())['then'](realtime[_0x7ce2('0x1a')]())[_0x7ce2('0xc')](function(){return realtime;});}function main(){return server[_0x7ce2('0x1b')](realtime)[_0x7ce2('0xc')](function(_0x53fe3d){return initRealtime();})[_0x7ce2('0xc')](function(_0x415e8c){return setInterval(initRealtime,0x1388);})['catch'](function(_0x6dfffb){console['log'](_0x6dfffb);});}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 edcea4d..b0c5b52 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 _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x5405cd,_0x5ac921){var _0x11eafc=function(_0x2d9a78){while(--_0x2d9a78){_0x5405cd['push'](_0x5405cd['shift']());}};_0x11eafc(++_0x5ac921);}(_0x5fc3,0xa8));var _0x35fc=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x5fc3[_0x456fb1];return _0x4083d6;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x4d3905,_0x459407){var _0x3e08c6=function(_0xeca770){while(--_0xeca770){_0x4d3905['push'](_0x4d3905['shift']());}};_0x3e08c6(++_0x459407);}(_0x7a54,0x106));var _0x47a5=function(_0x4f72ff,_0x35e8be){_0x4f72ff=_0x4f72ff-0x0;var _0x12c7a1=_0x7a54[_0x4f72ff];return _0x12c7a1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index c320469..f046121 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 _0x1ecc=['error','message','result','catch','sendMailMessage','SendMail','bluebird','then'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0x1ecc,0x14e));var _0xc1ec=function(_0x4fa438,_0x1f15a7){_0x4fa438=_0x4fa438-0x0;var _0x4e3958=_0x1ecc[_0x4fa438];return _0x4e3958;};'use strict';var BPromise=require(_0xc1ec('0x0'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function request(_0x520151,_0x52dcdc){return new BPromise(function(_0x32e55f,_0x7f4fa0){return client['request'](_0x520151,_0x52dcdc)[_0xc1ec('0x1')](function(_0x1193b0){if(_0x1193b0[_0xc1ec('0x2')]){return _0x7f4fa0(_0x1193b0[_0xc1ec('0x2')][_0xc1ec('0x3')]);}else{return _0x32e55f(_0x1193b0[_0xc1ec('0x4')]);}})[_0xc1ec('0x5')](function(_0x150d71){return _0x7f4fa0(_0x150d71);});});}exports[_0xc1ec('0x6')]=function(_0x2a1520,_0x4d8624){return request(_0xc1ec('0x7'),{'account':_0x2a1520,'message':_0x4d8624});}; \ No newline at end of file +var _0xd4d0=['error','message','result','SendMail','bluebird','jayson/promise','client','http','request','then'];(function(_0x31cdff,_0x545438){var _0x14091f=function(_0x363721){while(--_0x363721){_0x31cdff['push'](_0x31cdff['shift']());}};_0x14091f(++_0x545438);}(_0xd4d0,0x7c));var _0x0d4d=function(_0x3c7627,_0x1968b7){_0x3c7627=_0x3c7627-0x0;var _0x1059e0=_0xd4d0[_0x3c7627];return _0x1059e0;};'use strict';var BPromise=require(_0x0d4d('0x0'));var jayson=require(_0x0d4d('0x1'));var client=jayson[_0x0d4d('0x2')][_0x0d4d('0x3')]({'port':0x232b});function request(_0x927e60,_0x102a8e){return new BPromise(function(_0x29e3c4,_0x5d01d2){return client[_0x0d4d('0x4')](_0x927e60,_0x102a8e)[_0x0d4d('0x5')](function(_0x317bfb){if(_0x317bfb['error']){return _0x5d01d2(_0x317bfb[_0x0d4d('0x6')][_0x0d4d('0x7')]);}else{return _0x29e3c4(_0x317bfb[_0x0d4d('0x8')]);}})['catch'](function(_0x4c8613){return _0x5d01d2(_0x4c8613);});});}exports['sendMailMessage']=function(_0x2a3064,_0x26095f){return request(_0x0d4d('0x9'),{'account':_0x2a3064,'message':_0x26095f});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 17508d2..0357b79 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 _0xabf9=['fax','sms','length','Status','faxStatusTime','faxCurrentCapacity','smsStatusTime','whatsappStatusTime','whatsappCurrentCapacity','busy','stringify','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','idle','updateRealtime','mail','chat','openchannel'];(function(_0x1f57e7,_0x31455f){var _0xc38613=function(_0x3a13dc){while(--_0x3a13dc){_0x1f57e7['push'](_0x1f57e7['shift']());}};_0xc38613(++_0x31455f);}(_0xabf9,0x1e4));var _0x9abf=function(_0x38112c,_0x53ef3c){_0x38112c=_0x38112c-0x0;var _0x5e74fa=_0xabf9[_0x38112c];return _0x5e74fa;};'use strict';var _=require(_0x9abf('0x0'));var moment=require(_0x9abf('0x1'));var md5=require(_0x9abf('0x2'));var Redis=require(_0x9abf('0x3'));var config=require(_0x9abf('0x4'));config[_0x9abf('0x5')]=_[_0x9abf('0x6')](config[_0x9abf('0x5')],{'host':_0x9abf('0x7'),'port':0x18eb});var io=require(_0x9abf('0x8'))(new Redis(config[_0x9abf('0x5')]));function Agent(_0x21ee33){this['id']=_0x21ee33['id']||0x0;this[_0x9abf('0x9')]=_0x21ee33[_0x9abf('0x9')]||'';this[_0x9abf('0xa')]=_0x21ee33[_0x9abf('0xa')]||!![];this[_0x9abf('0xb')]=_0x21ee33['voicePause']||![];this[_0x9abf('0xc')]=_0x21ee33['chatPause']||![];this[_0x9abf('0xd')]=_0x21ee33[_0x9abf('0xd')]||![];this[_0x9abf('0xe')]=_0x21ee33['faxPause']||![];this[_0x9abf('0xf')]=_0x21ee33[_0x9abf('0xf')]||![];this[_0x9abf('0x10')]=_0x21ee33[_0x9abf('0x10')]||![];this[_0x9abf('0x11')]=_0x9abf('0x12');this[_0x9abf('0x13')]=0x0;this['chatCapacity']=_0x21ee33[_0x9abf('0x14')]||0x0;this[_0x9abf('0x15')]=0x0;this[_0x9abf('0x16')]='unknown';this[_0x9abf('0x17')]=0x0;this[_0x9abf('0x18')]=_0x21ee33[_0x9abf('0x18')]||0x0;this[_0x9abf('0x19')]=0x0;this[_0x9abf('0x1a')]=_0x9abf('0x12');this['faxStatusTime']=0x0;this[_0x9abf('0x1b')]=_0x21ee33[_0x9abf('0x1b')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x9abf('0x1c')]=_0x9abf('0x12');this['smsStatusTime']=0x0;this[_0x9abf('0x1d')]=_0x21ee33[_0x9abf('0x1d')]||0x0;this[_0x9abf('0x1e')]=0x0;this[_0x9abf('0x1f')]=_0x9abf('0x12');this['whatsappStatusTime']=0x0;this[_0x9abf('0x20')]=_0x21ee33[_0x9abf('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x9abf('0x21')]=_0x9abf('0x12');this[_0x9abf('0x22')]=0x0;this[_0x9abf('0x23')]=_0x21ee33['openchannelCapacity']||0x0;this[_0x9abf('0x24')]=0x0;this['busy']=![];this[_0x9abf('0x25')]=undefined;this[_0x9abf('0x2')]='';this['updateRealtime']();}Agent[_0x9abf('0x26')][_0x9abf('0x27')]=function(_0x409515){if(this[_0x409515+_0x9abf('0x28')]>0x0){if(this[_0x409515+_0x9abf('0x29')]>0x0&&this[_0x409515+'CurrentCapacity']>=this[_0x409515+'Capacity']){return'maxcapacity';}else{return'working';}}else{return _0x9abf('0x2a');}};Agent[_0x9abf('0x26')][_0x9abf('0x2b')]=function(){var _0x15a889=[_0x9abf('0x2c'),_0x9abf('0x2d'),_0x9abf('0x2e'),_0x9abf('0x2f'),_0x9abf('0x30'),'whatsapp'];for(var _0xfe906e=0x0;_0xfe906e<_0x15a889[_0x9abf('0x31')];_0xfe906e+=0x1){var _0x3009ce=this[_0x9abf('0x27')](_0x15a889[_0xfe906e]);if(this[_0x15a889[_0xfe906e]+_0x9abf('0x32')]!==_0x3009ce){this[_0x15a889[_0xfe906e]+'StatusTime']=_['toNumber'](moment()['format']('x'));}this[_0x15a889[_0xfe906e]+_0x9abf('0x32')]=_0x3009ce;}var _0x345586={'id':this['id'],'name':this[_0x9abf('0x9')],'online':this[_0x9abf('0xa')],'voicePause':this[_0x9abf('0xb')],'chatPause':this[_0x9abf('0xc')],'mailPause':this[_0x9abf('0xd')],'smsPause':this['smsPause'],'faxPause':this[_0x9abf('0xe')],'openchannelPause':this[_0x9abf('0x10')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x9abf('0x14')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x9abf('0x16')],'mailStatusTime':this[_0x9abf('0x17')],'mailCapacity':this[_0x9abf('0x18')],'mailCurrentCapacity':this[_0x9abf('0x19')],'faxStatus':this[_0x9abf('0x1a')],'faxStatusTime':this[_0x9abf('0x33')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x9abf('0x34')],'smsStatus':this[_0x9abf('0x1c')],'smsStatusTime':this[_0x9abf('0x35')],'smsCapacity':this[_0x9abf('0x1d')],'smsCurrentCapacity':this[_0x9abf('0x1e')],'whatsappStatus':this[_0x9abf('0x1f')],'whatsappStatusTime':this[_0x9abf('0x36')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x9abf('0x37')],'openchannelStatus':this[_0x9abf('0x21')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x9abf('0x24')],'busy':this[_0x9abf('0x38')],'busyQueue':this[_0x9abf('0x25')]};var _0x2995a4=md5(JSON[_0x9abf('0x39')](_0x345586));if(this['md5']!==_0x2995a4){this[_0x9abf('0x2')]=_0x2995a4;io['emit']('user:save',_0x345586);}};module[_0x9abf('0x3a')]=Agent; \ No newline at end of file +var _0x2593=['chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','smsStatus','openchannelStatus','stringify','emit','user:save','lodash','moment','md5','ioredis','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause'];(function(_0x2ea7af,_0x22cfe9){var _0x44ddd4=function(_0x166c64){while(--_0x166c64){_0x2ea7af['push'](_0x2ea7af['shift']());}};_0x44ddd4(++_0x22cfe9);}(_0x2593,0x1e1));var _0x3259=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0x2593[_0x1abeb2];return _0x48da20;};'use strict';var _=require(_0x3259('0x0'));var moment=require(_0x3259('0x1'));var md5=require(_0x3259('0x2'));var Redis=require(_0x3259('0x3'));var config=require('../../../config/environment');config[_0x3259('0x4')]=_['defaults'](config[_0x3259('0x4')],{'host':_0x3259('0x5'),'port':0x18eb});var io=require(_0x3259('0x6'))(new Redis(config['redis']));function Agent(_0x20e52c){this['id']=_0x20e52c['id']||0x0;this[_0x3259('0x7')]=_0x20e52c['name']||'';this['online']=_0x20e52c[_0x3259('0x8')]||!![];this[_0x3259('0x9')]=_0x20e52c[_0x3259('0x9')]||![];this[_0x3259('0xa')]=_0x20e52c['chatPause']||![];this[_0x3259('0xb')]=_0x20e52c[_0x3259('0xb')]||![];this[_0x3259('0xc')]=_0x20e52c[_0x3259('0xc')]||![];this[_0x3259('0xd')]=_0x20e52c[_0x3259('0xd')]||![];this[_0x3259('0xe')]=_0x20e52c[_0x3259('0xe')]||![];this[_0x3259('0xf')]='unknown';this[_0x3259('0x10')]=0x0;this['chatCapacity']=_0x20e52c[_0x3259('0x11')]||0x0;this[_0x3259('0x12')]=0x0;this[_0x3259('0x13')]=_0x3259('0x14');this[_0x3259('0x15')]=0x0;this[_0x3259('0x16')]=_0x20e52c[_0x3259('0x16')]||0x0;this[_0x3259('0x17')]=0x0;this['faxStatus']='unknown';this[_0x3259('0x18')]=0x0;this[_0x3259('0x19')]=_0x20e52c[_0x3259('0x19')]||0x0;this[_0x3259('0x1a')]=0x0;this['smsStatus']='unknown';this[_0x3259('0x1b')]=0x0;this[_0x3259('0x1c')]=_0x20e52c[_0x3259('0x1c')]||0x0;this[_0x3259('0x1d')]=0x0;this[_0x3259('0x1e')]=_0x3259('0x14');this[_0x3259('0x1f')]=0x0;this[_0x3259('0x20')]=_0x20e52c[_0x3259('0x20')]||0x0;this[_0x3259('0x21')]=0x0;this['openchannelStatus']='unknown';this[_0x3259('0x22')]=0x0;this[_0x3259('0x23')]=_0x20e52c[_0x3259('0x23')]||0x0;this[_0x3259('0x24')]=0x0;this[_0x3259('0x25')]=![];this[_0x3259('0x26')]=undefined;this[_0x3259('0x2')]='';this['updateRealtime']();}Agent[_0x3259('0x27')][_0x3259('0x28')]=function(_0x37f38f){if(this[_0x37f38f+_0x3259('0x29')]>0x0){if(this[_0x37f38f+_0x3259('0x2a')]>0x0&&this[_0x37f38f+_0x3259('0x29')]>=this[_0x37f38f+_0x3259('0x2a')]){return _0x3259('0x2b');}else{return _0x3259('0x2c');}}else{return _0x3259('0x2d');}};Agent[_0x3259('0x27')]['updateRealtime']=function(){var _0x4f4163=[_0x3259('0x2e'),_0x3259('0x2f'),_0x3259('0x30'),_0x3259('0x31'),_0x3259('0x32'),_0x3259('0x33')];for(var _0x177602=0x0;_0x177602<_0x4f4163[_0x3259('0x34')];_0x177602+=0x1){var _0x5943bd=this[_0x3259('0x28')](_0x4f4163[_0x177602]);if(this[_0x4f4163[_0x177602]+_0x3259('0x35')]!==_0x5943bd){this[_0x4f4163[_0x177602]+_0x3259('0x36')]=_[_0x3259('0x37')](moment()[_0x3259('0x38')]('x'));}this[_0x4f4163[_0x177602]+_0x3259('0x35')]=_0x5943bd;}var _0x5956a1={'id':this['id'],'name':this[_0x3259('0x7')],'online':this[_0x3259('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0x3259('0xa')],'mailPause':this[_0x3259('0xb')],'smsPause':this[_0x3259('0xd')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x3259('0xf')],'chatStatusTime':this[_0x3259('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x3259('0x12')],'mailStatus':this[_0x3259('0x13')],'mailStatusTime':this[_0x3259('0x15')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x3259('0x19')],'faxCurrentCapacity':this[_0x3259('0x1a')],'smsStatus':this[_0x3259('0x39')],'smsStatusTime':this[_0x3259('0x1b')],'smsCapacity':this[_0x3259('0x1c')],'smsCurrentCapacity':this[_0x3259('0x1d')],'whatsappStatus':this[_0x3259('0x1e')],'whatsappStatusTime':this[_0x3259('0x1f')],'whatsappCapacity':this[_0x3259('0x20')],'whatsappCurrentCapacity':this[_0x3259('0x21')],'openchannelStatus':this[_0x3259('0x3a')],'openchannelStatusTime':this[_0x3259('0x22')],'openchannelCapacity':this[_0x3259('0x23')],'openchannelCurrentCapacity':this[_0x3259('0x24')],'busy':this[_0x3259('0x25')],'busyQueue':this[_0x3259('0x26')]};var _0x36381b=md5(JSON[_0x3259('0x3b')](_0x5956a1));if(this[_0x3259('0x2')]!==_0x36381b){this[_0x3259('0x2')]=_0x36381b;io[_0x3259('0x3c')](_0x3259('0x3d'),_0x5956a1);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 6e157f1..d3319fe 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 _0xcc49=['format','chat:queue:%s','emit','chat_queue:save','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','length','online','chatPause','paused','available','stringify'];(function(_0x2782fb,_0x3928f9){var _0x118ff4=function(_0x365ba5){while(--_0x365ba5){_0x2782fb['push'](_0x2782fb['shift']());}};_0x118ff4(++_0x3928f9);}(_0xcc49,0xb2));var _0x9cc4=function(_0x5ecfc0,_0x2b1d77){_0x5ecfc0=_0x5ecfc0-0x0;var _0x2f0385=_0xcc49[_0x5ecfc0];return _0x2f0385;};'use strict';var _=require('lodash');var md5=require(_0x9cc4('0x0'));var util=require(_0x9cc4('0x1'));var Redis=require('ioredis');var config=require(_0x9cc4('0x2'));config[_0x9cc4('0x3')]=_[_0x9cc4('0x4')](config[_0x9cc4('0x3')],{'host':_0x9cc4('0x5'),'port':0x18eb});var io=require(_0x9cc4('0x6'))(new Redis(config['redis']));function ChatQueue(_0x4cd903){this['id']=_0x4cd903['id']||0x0;this[_0x9cc4('0x7')]=_0x4cd903['name']||'';this[_0x9cc4('0x8')]=_0x4cd903[_0x9cc4('0x8')]||0xa;this[_0x9cc4('0x9')]=_0x4cd903['strategy']||_0x9cc4('0xa');this[_0x9cc4('0xb')]=_0x4cd903['Agents'];this[_0x9cc4('0xc')]={};this[_0x9cc4('0xd')]=0x0;this[_0x9cc4('0x0')]='';this[_0x9cc4('0xe')]();this['updateRealtime']();}ChatQueue[_0x9cc4('0xf')][_0x9cc4('0xe')]=function(){var _0x186c34=this['mapAgentsId'][_0x9cc4('0x10')];this[_0x9cc4('0xc')]=_['map'](this[_0x9cc4('0xb')],'id');this[_0x9cc4('0xc')][_0x9cc4('0x10')]=_0x186c34;};ChatQueue[_0x9cc4('0xf')][_0x9cc4('0x11')]=function(){this[_0x9cc4('0x12')]=0x0;this['paused']=0x0;for(var _0x38ccd8=0x0;_0x38ccd8=0x0?this[_0x9cc4('0x17')]:0x0;var _0x22ec7b={'id':this['id'],'available':this[_0x9cc4('0x17')],'loggedIn':this[_0x9cc4('0x12')],'name':this[_0x9cc4('0x7')],'paused':this['paused'],'waiting':this[_0x9cc4('0xd')]};var _0x8209c2=md5(JSON[_0x9cc4('0x18')](_0x22ec7b));if(this['md5']!==_0x8209c2){this[_0x9cc4('0x0')]=_0x8209c2;io['to'](util[_0x9cc4('0x19')](_0x9cc4('0x1a'),_0x22ec7b['name']))[_0x9cc4('0x1b')](_0x9cc4('0x1c'),_0x22ec7b);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xe6b2=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','loggedIn','online','chatPause','paused','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x37d7c6,_0x15b80a){var _0x32f183=function(_0x48663a){while(--_0x48663a){_0x37d7c6['push'](_0x37d7c6['shift']());}};_0x32f183(++_0x15b80a);}(_0xe6b2,0x18f));var _0x2e6b=function(_0x1d04b3,_0x2dfd11){_0x1d04b3=_0x1d04b3-0x0;var _0x1cf900=_0xe6b2[_0x1d04b3];return _0x1cf900;};'use strict';var _=require(_0x2e6b('0x0'));var md5=require(_0x2e6b('0x1'));var util=require(_0x2e6b('0x2'));var Redis=require(_0x2e6b('0x3'));var config=require(_0x2e6b('0x4'));config[_0x2e6b('0x5')]=_[_0x2e6b('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2e6b('0x7'))(new Redis(config[_0x2e6b('0x5')]));function ChatQueue(_0x520fb0){this['id']=_0x520fb0['id']||0x0;this[_0x2e6b('0x8')]=_0x520fb0[_0x2e6b('0x8')]||'';this['timeout']=_0x520fb0[_0x2e6b('0x9')]||0xa;this[_0x2e6b('0xa')]=_0x520fb0[_0x2e6b('0xa')]||_0x2e6b('0xb');this[_0x2e6b('0xc')]=_0x520fb0[_0x2e6b('0xc')];this[_0x2e6b('0xd')]={};this[_0x2e6b('0xe')]=0x0;this[_0x2e6b('0x1')]='';this[_0x2e6b('0xf')]();this['updateRealtime']();}ChatQueue[_0x2e6b('0x10')]['updateRouting']=function(){var _0x313d4a=this[_0x2e6b('0xd')][_0x2e6b('0x11')];this['mapAgentsId']=_['map'](this[_0x2e6b('0xc')],'id');this[_0x2e6b('0xd')][_0x2e6b('0x11')]=_0x313d4a;};ChatQueue[_0x2e6b('0x10')]['updateRealtime']=function(){this[_0x2e6b('0x12')]=0x0;this['paused']=0x0;for(var _0x4c475f=0x0;_0x4c475f=0x0?this['available']:0x0;var _0xb68f2b={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2e6b('0x12')],'name':this[_0x2e6b('0x8')],'paused':this[_0x2e6b('0x15')],'waiting':this['waiting']};var _0xa51d2e=md5(JSON[_0x2e6b('0x17')](_0xb68f2b));if(this['md5']!==_0xa51d2e){this[_0x2e6b('0x1')]=_0xa51d2e;io['to'](util[_0x2e6b('0x18')](_0x2e6b('0x19'),_0xb68f2b['name']))[_0x2e6b('0x1a')](_0x2e6b('0x1b'),_0xb68f2b);}};module[_0x2e6b('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 5792e7e..6aed219 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 _0x6527=['available','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','length','online','loggedIn','faxPause','paused'];(function(_0xb63d9d,_0x4a4ba6){var _0x24aa90=function(_0x8affb3){while(--_0x8affb3){_0xb63d9d['push'](_0xb63d9d['shift']());}};_0x24aa90(++_0x4a4ba6);}(_0x6527,0x148));var _0x7652=function(_0x20570b,_0x1b836c){_0x20570b=_0x20570b-0x0;var _0x49dca0=_0x6527[_0x20570b];return _0x49dca0;};'use strict';var _=require('lodash');var md5=require(_0x7652('0x0'));var util=require(_0x7652('0x1'));var Redis=require(_0x7652('0x2'));var config=require(_0x7652('0x3'));config[_0x7652('0x4')]=_['defaults'](config['redis'],{'host':_0x7652('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7652('0x4')]));function FaxQueue(_0x213fc7){this['id']=_0x213fc7['id']||0x0;this[_0x7652('0x6')]=_0x213fc7['name']||'';this[_0x7652('0x7')]=_0x213fc7[_0x7652('0x7')]||0xa;this['strategy']=_0x213fc7['strategy']||_0x7652('0x8');this[_0x7652('0x9')]=_0x213fc7[_0x7652('0x9')];this[_0x7652('0xa')]={};this[_0x7652('0xb')]=0x0;this[_0x7652('0x0')]='';this[_0x7652('0xc')]();this[_0x7652('0xd')]();}FaxQueue['prototype'][_0x7652('0xc')]=function(){var _0x1e199b=this[_0x7652('0xa')][_0x7652('0xe')];this[_0x7652('0xa')]=_[_0x7652('0xf')](this[_0x7652('0x9')],'id');this['mapAgentsId']['_rr']=_0x1e199b;};FaxQueue[_0x7652('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4a8e8e=0x0;_0x4a8e8e=0x0?this[_0x7652('0x16')]:0x0;var _0xe6a73c={'id':this['id'],'available':this[_0x7652('0x16')],'loggedIn':this[_0x7652('0x13')],'name':this[_0x7652('0x6')],'paused':this[_0x7652('0x15')],'waiting':this[_0x7652('0xb')]};var _0x3777da=md5(JSON['stringify'](_0xe6a73c));if(this[_0x7652('0x0')]!==_0x3777da){this[_0x7652('0x0')]=_0x3777da;io['to'](util['format']('fax:queue:%s',_0xe6a73c['name']))['emit'](_0x7652('0x17'),_0xe6a73c);}};module[_0x7652('0x18')]=FaxQueue; \ No newline at end of file +var _0x35f5=['md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','faxPause','paused','available','stringify','emit','exports','lodash'];(function(_0xd7da8a,_0x1f8df5){var _0x3f6ae7=function(_0x45b867){while(--_0x45b867){_0xd7da8a['push'](_0xd7da8a['shift']());}};_0x3f6ae7(++_0x1f8df5);}(_0x35f5,0x6f));var _0x535f=function(_0xc0638b,_0x2fccf4){_0xc0638b=_0xc0638b-0x0;var _0xd57dfa=_0x35f5[_0xc0638b];return _0xd57dfa;};'use strict';var _=require(_0x535f('0x0'));var md5=require(_0x535f('0x1'));var util=require(_0x535f('0x2'));var Redis=require(_0x535f('0x3'));var config=require(_0x535f('0x4'));config[_0x535f('0x5')]=_[_0x535f('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x535f('0x7'))(new Redis(config[_0x535f('0x5')]));function FaxQueue(_0x5c003e){this['id']=_0x5c003e['id']||0x0;this[_0x535f('0x8')]=_0x5c003e['name']||'';this[_0x535f('0x9')]=_0x5c003e['timeout']||0xa;this[_0x535f('0xa')]=_0x5c003e[_0x535f('0xa')]||_0x535f('0xb');this[_0x535f('0xc')]=_0x5c003e[_0x535f('0xc')];this[_0x535f('0xd')]={};this[_0x535f('0xe')]=0x0;this[_0x535f('0x1')]='';this[_0x535f('0xf')]();this[_0x535f('0x10')]();}FaxQueue[_0x535f('0x11')][_0x535f('0xf')]=function(){var _0x546518=this[_0x535f('0xd')][_0x535f('0x12')];this[_0x535f('0xd')]=_[_0x535f('0x13')](this[_0x535f('0xc')],'id');this['mapAgentsId']['_rr']=_0x546518;};FaxQueue['prototype']['updateRealtime']=function(){this[_0x535f('0x14')]=0x0;this['paused']=0x0;for(var _0x46cc04=0x0;_0x46cc04=0x0?this[_0x535f('0x18')]:0x0;var _0x254d8b={'id':this['id'],'available':this['available'],'loggedIn':this[_0x535f('0x14')],'name':this[_0x535f('0x8')],'paused':this[_0x535f('0x17')],'waiting':this[_0x535f('0xe')]};var _0x33063d=md5(JSON[_0x535f('0x19')](_0x254d8b));if(this[_0x535f('0x1')]!==_0x33063d){this[_0x535f('0x1')]=_0x33063d;io['to'](util['format']('fax:queue:%s',_0x254d8b[_0x535f('0x8')]))[_0x535f('0x1a')]('fax_queue:save',_0x254d8b);}};module[_0x535f('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index ab05236..65e668c 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 _0xed85=['name','Intervals','exports'];(function(_0x58f1a0,_0x5af1be){var _0x6f5197=function(_0x96b471){while(--_0x96b471){_0x58f1a0['push'](_0x58f1a0['shift']());}};_0x6f5197(++_0x5af1be);}(_0xed85,0xba));var _0x5ed8=function(_0xb7cb72,_0x19d391){_0xb7cb72=_0xb7cb72-0x0;var _0x4b7570=_0xed85[_0xb7cb72];return _0x4b7570;};'use strict';function Interval(_0x5d386f){this['id']=_0x5d386f['id']||0x0;this[_0x5ed8('0x0')]=_0x5d386f[_0x5ed8('0x0')]||'';this[_0x5ed8('0x1')]=_0x5d386f[_0x5ed8('0x1')]||{};}module[_0x5ed8('0x2')]=Interval; \ No newline at end of file +var _0x6d19=['name','Intervals'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0x6d19,0xb4));var _0x96d1=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0x6d19[_0x286bfb];return _0x52b683;};'use strict';function Interval(_0x594892){this['id']=_0x594892['id']||0x0;this[_0x96d1('0x0')]=_0x594892[_0x96d1('0x0')]||'';this[_0x96d1('0x1')]=_0x594892[_0x96d1('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 4e59b16..7307f8e 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 _0x1e01=['mapAgentsId','map','_rr','prototype','loggedIn','length','mailPause','paused','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime'];(function(_0x4041c2,_0xb8d7d8){var _0x259c8b=function(_0x14688b){while(--_0x14688b){_0x4041c2['push'](_0x4041c2['shift']());}};_0x259c8b(++_0xb8d7d8);}(_0x1e01,0x159));var _0x11e0=function(_0x58c572,_0x5ed2b0){_0x58c572=_0x58c572-0x0;var _0xc39254=_0x1e01[_0x58c572];return _0xc39254;};'use strict';var _=require(_0x11e0('0x0'));var md5=require(_0x11e0('0x1'));var util=require('util');var Redis=require(_0x11e0('0x2'));var config=require('../../../config/environment');config[_0x11e0('0x3')]=_[_0x11e0('0x4')](config[_0x11e0('0x3')],{'host':_0x11e0('0x5'),'port':0x18eb});var io=require(_0x11e0('0x6'))(new Redis(config[_0x11e0('0x3')]));function MailQueue(_0x5a0b9d){this['id']=_0x5a0b9d['id']||0x0;this[_0x11e0('0x7')]=_0x5a0b9d[_0x11e0('0x7')]||'';this[_0x11e0('0x8')]=_0x5a0b9d[_0x11e0('0x8')]||0xa;this['strategy']=_0x5a0b9d[_0x11e0('0x9')]||_0x11e0('0xa');this['Agents']=_0x5a0b9d[_0x11e0('0xb')];this['mapAgentsId']={};this[_0x11e0('0xc')]=0x0;this[_0x11e0('0x1')]='';this[_0x11e0('0xd')]();this[_0x11e0('0xe')]();}MailQueue['prototype']['updateRouting']=function(){var _0x218224=this[_0x11e0('0xf')]['_rr'];this[_0x11e0('0xf')]=_[_0x11e0('0x10')](this[_0x11e0('0xb')],'id');this['mapAgentsId'][_0x11e0('0x11')]=_0x218224;};MailQueue[_0x11e0('0x12')][_0x11e0('0xe')]=function(){this[_0x11e0('0x13')]=0x0;this['paused']=0x0;for(var _0x16aa3b=0x0;_0x16aa3b=0x0?this[_0x11e0('0x17')]:0x0;var _0x23a464={'id':this['id'],'available':this['available'],'loggedIn':this[_0x11e0('0x13')],'name':this[_0x11e0('0x7')],'paused':this[_0x11e0('0x16')],'waiting':this[_0x11e0('0xc')]};var _0x388f32=md5(JSON[_0x11e0('0x18')](_0x23a464));if(this[_0x11e0('0x1')]!==_0x388f32){this[_0x11e0('0x1')]=_0x388f32;io['to'](util[_0x11e0('0x19')](_0x11e0('0x1a'),_0x23a464[_0x11e0('0x7')]))[_0x11e0('0x1b')](_0x11e0('0x1c'),_0x23a464);}};module[_0x11e0('0x1d')]=MailQueue; \ No newline at end of file +var _0x6d9f=['strategy','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','paused','length','online','mailPause','available','stringify','format','lodash','md5','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0x6d9f,0xe1));var _0xf6d9=function(_0x3e0098,_0x52fe79){_0x3e0098=_0x3e0098-0x0;var _0x343e68=_0x6d9f[_0x3e0098];return _0x343e68;};'use strict';var _=require(_0xf6d9('0x0'));var md5=require(_0xf6d9('0x1'));var util=require('util');var Redis=require(_0xf6d9('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xf6d9('0x3')](config[_0xf6d9('0x4')],{'host':_0xf6d9('0x5'),'port':0x18eb});var io=require(_0xf6d9('0x6'))(new Redis(config['redis']));function MailQueue(_0x4f35a6){this['id']=_0x4f35a6['id']||0x0;this['name']=_0x4f35a6[_0xf6d9('0x7')]||'';this['timeout']=_0x4f35a6[_0xf6d9('0x8')]||0xa;this[_0xf6d9('0x9')]=_0x4f35a6['strategy']||'beepall';this['Agents']=_0x4f35a6['Agents'];this[_0xf6d9('0xa')]={};this[_0xf6d9('0xb')]=0x0;this['md5']='';this[_0xf6d9('0xc')]();this[_0xf6d9('0xd')]();}MailQueue[_0xf6d9('0xe')][_0xf6d9('0xc')]=function(){var _0x4beb57=this[_0xf6d9('0xa')][_0xf6d9('0xf')];this[_0xf6d9('0xa')]=_[_0xf6d9('0x10')](this[_0xf6d9('0x11')],'id');this[_0xf6d9('0xa')][_0xf6d9('0xf')]=_0x4beb57;};MailQueue[_0xf6d9('0xe')]['updateRealtime']=function(){this[_0xf6d9('0x12')]=0x0;this[_0xf6d9('0x13')]=0x0;for(var _0x3ad671=0x0;_0x3ad671=0x0?this['available']:0x0;var _0x37484f={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf6d9('0x12')],'name':this[_0xf6d9('0x7')],'paused':this[_0xf6d9('0x13')],'waiting':this['waiting']};var _0x492d91=md5(JSON[_0xf6d9('0x18')](_0x37484f));if(this[_0xf6d9('0x1')]!==_0x492d91){this[_0xf6d9('0x1')]=_0x492d91;io['to'](util[_0xf6d9('0x19')]('mail:queue:%s',_0x37484f[_0xf6d9('0x7')]))['emit']('mail_queue:save',_0x37484f);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index f37d886..869b3b7 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x4f839e,_0x125a75){var _0x5832ee=function(_0x11e57a){while(--_0x11e57a){_0x4f839e['push'](_0x4f839e['shift']());}};_0x5832ee(++_0x125a75);}(_0x814b,0x1a2));var _0xb814=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0x814b[_0x53c4f8];return _0x416458;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x5fc3[_0x3aaf0a];return _0x33e6bc;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 254f75e..a24fa6d 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 _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(_0x51db2a,_0x24873d){var _0x37c028=function(_0x346cb6){while(--_0x346cb6){_0x51db2a['push'](_0x51db2a['shift']());}};_0x37c028(++_0x24873d);}(_0x0506,0x1d1));var _0x6050=function(_0x10d54d,_0x4a880e){_0x10d54d=_0x10d54d-0x0;var _0x4037a6=_0x0506[_0x10d54d];return _0x4037a6;};'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 +var _0x0c6d=['smsPause','available','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online'];(function(_0x5f7195,_0x17528a){var _0x18493a=function(_0x362656){while(--_0x362656){_0x5f7195['push'](_0x5f7195['shift']());}};_0x18493a(++_0x17528a);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x261075,_0x397aba){_0x261075=_0x261075-0x0;var _0x16f7ca=_0x0c6d[_0x261075];return _0x16f7ca;};'use strict';var _=require('lodash');var md5=require(_0xd0c6('0x0'));var util=require(_0xd0c6('0x1'));var Redis=require(_0xd0c6('0x2'));var config=require(_0xd0c6('0x3'));config[_0xd0c6('0x4')]=_[_0xd0c6('0x5')](config['redis'],{'host':_0xd0c6('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function SmsQueue(_0x4c7f45){this['id']=_0x4c7f45['id']||0x0;this[_0xd0c6('0x7')]=_0x4c7f45[_0xd0c6('0x7')]||'';this[_0xd0c6('0x8')]=_0x4c7f45['timeout']||0xa;this[_0xd0c6('0x9')]=_0x4c7f45['strategy']||_0xd0c6('0xa');this[_0xd0c6('0xb')]=_0x4c7f45[_0xd0c6('0xb')];this[_0xd0c6('0xc')]={};this[_0xd0c6('0xd')]=0x0;this[_0xd0c6('0x0')]='';this[_0xd0c6('0xe')]();this[_0xd0c6('0xf')]();}SmsQueue[_0xd0c6('0x10')]['updateRouting']=function(){var _0x8f70a4=this['mapAgentsId']['_rr'];this[_0xd0c6('0xc')]=_[_0xd0c6('0x11')](this[_0xd0c6('0xb')],'id');this[_0xd0c6('0xc')][_0xd0c6('0x12')]=_0x8f70a4;};SmsQueue[_0xd0c6('0x10')][_0xd0c6('0xf')]=function(){this[_0xd0c6('0x13')]=0x0;this[_0xd0c6('0x14')]=0x0;for(var _0x35ddf1=0x0;_0x35ddf1=0x0?this[_0xd0c6('0x18')]:0x0;var _0x336efd={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xd0c6('0x7')],'paused':this[_0xd0c6('0x14')],'waiting':this['waiting']};var _0x4cf897=md5(JSON['stringify'](_0x336efd));if(this[_0xd0c6('0x0')]!==_0x4cf897){this[_0xd0c6('0x0')]=_0x4cf897;io['to'](util[_0xd0c6('0x19')](_0xd0c6('0x1a'),_0x336efd[_0xd0c6('0x7')]))[_0xd0c6('0x1b')](_0xd0c6('0x1c'),_0x336efd);}};module[_0xd0c6('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 84c8edd..11da71b 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 _0xe246=['strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','length','online','loggedIn','whatsappPause','paused','available','waiting','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe246,0xed));var _0x6e24=function(_0x2f9e8b,_0x2e90c3){_0x2f9e8b=_0x2f9e8b-0x0;var _0x2055b7=_0xe246[_0x2f9e8b];return _0x2055b7;};'use strict';var _=require(_0x6e24('0x0'));var md5=require(_0x6e24('0x1'));var util=require(_0x6e24('0x2'));var Redis=require(_0x6e24('0x3'));var config=require(_0x6e24('0x4'));config['redis']=_[_0x6e24('0x5')](config[_0x6e24('0x6')],{'host':_0x6e24('0x7'),'port':0x18eb});var io=require(_0x6e24('0x8'))(new Redis(config[_0x6e24('0x6')]));function WhatsappQueue(_0xa2cf22){this['id']=_0xa2cf22['id']||0x0;this[_0x6e24('0x9')]=_0xa2cf22['name']||'';this['timeout']=_0xa2cf22[_0x6e24('0xa')]||0xa;this[_0x6e24('0xb')]=_0xa2cf22[_0x6e24('0xb')]||_0x6e24('0xc');this[_0x6e24('0xd')]=_0xa2cf22['Agents'];this[_0x6e24('0xe')]={};this['waiting']=0x0;this[_0x6e24('0x1')]='';this[_0x6e24('0xf')]();this[_0x6e24('0x10')]();}WhatsappQueue[_0x6e24('0x11')][_0x6e24('0xf')]=function(){var _0x496d09=this[_0x6e24('0xe')]['_rr'];this['mapAgentsId']=_[_0x6e24('0x12')](this[_0x6e24('0xd')],'id');this[_0x6e24('0xe')]['_rr']=_0x496d09;};WhatsappQueue[_0x6e24('0x11')][_0x6e24('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x175ff4=0x0;_0x175ff4=0x0?this[_0x6e24('0x18')]:0x0;var _0x5574f7={'id':this['id'],'available':this[_0x6e24('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x6e24('0x9')],'paused':this[_0x6e24('0x17')],'waiting':this[_0x6e24('0x19')]};var _0x183bce=md5(JSON[_0x6e24('0x1a')](_0x5574f7));if(this[_0x6e24('0x1')]!==_0x183bce){this[_0x6e24('0x1')]=_0x183bce;io['to'](util[_0x6e24('0x1b')](_0x6e24('0x1c'),_0x5574f7[_0x6e24('0x9')]))[_0x6e24('0x1d')](_0x6e24('0x1e'),_0x5574f7);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x954f=['paused','online','whatsappPause','available','whatsapp:queue:%s','emit','whatsapp_queue:save','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','loggedIn'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x954f,0xbd));var _0xf954=function(_0x154b23,_0x441adb){_0x154b23=_0x154b23-0x0;var _0x5d47f4=_0x954f[_0x154b23];return _0x5d47f4;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xf954('0x0'));var Redis=require(_0xf954('0x1'));var config=require(_0xf954('0x2'));config[_0xf954('0x3')]=_['defaults'](config[_0xf954('0x3')],{'host':_0xf954('0x4'),'port':0x18eb});var io=require(_0xf954('0x5'))(new Redis(config[_0xf954('0x3')]));function WhatsappQueue(_0x2cba6c){this['id']=_0x2cba6c['id']||0x0;this[_0xf954('0x6')]=_0x2cba6c[_0xf954('0x6')]||'';this[_0xf954('0x7')]=_0x2cba6c[_0xf954('0x7')]||0xa;this[_0xf954('0x8')]=_0x2cba6c[_0xf954('0x8')]||'beepall';this[_0xf954('0x9')]=_0x2cba6c[_0xf954('0x9')];this[_0xf954('0xa')]={};this[_0xf954('0xb')]=0x0;this[_0xf954('0xc')]='';this[_0xf954('0xd')]();this[_0xf954('0xe')]();}WhatsappQueue[_0xf954('0xf')][_0xf954('0xd')]=function(){var _0x1b8206=this[_0xf954('0xa')]['_rr'];this[_0xf954('0xa')]=_[_0xf954('0x10')](this['Agents'],'id');this[_0xf954('0xa')][_0xf954('0x11')]=_0x1b8206;};WhatsappQueue[_0xf954('0xf')]['updateRealtime']=function(){this[_0xf954('0x12')]=0x0;this[_0xf954('0x13')]=0x0;for(var _0x428ba5=0x0;_0x428ba5=0x0?this['available']:0x0;var _0x29d1f5={'id':this['id'],'available':this[_0xf954('0x16')],'loggedIn':this[_0xf954('0x12')],'name':this[_0xf954('0x6')],'paused':this[_0xf954('0x13')],'waiting':this[_0xf954('0xb')]};var _0x54e4a6=md5(JSON['stringify'](_0x29d1f5));if(this[_0xf954('0xc')]!==_0x54e4a6){this[_0xf954('0xc')]=_0x54e4a6;io['to'](util['format'](_0xf954('0x17'),_0x29d1f5['name']))[_0xf954('0x18')](_0xf954('0x19'),_0x29d1f5);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 9cfba10..850a0d1 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(_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 +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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 45751da..c384c5c 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 _0x4205=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','updateChatInteraction'];(function(_0x3fd07e,_0x5df898){var _0x483e29=function(_0x3c9511){while(--_0x3c9511){_0x3fd07e['push'](_0x3fd07e['shift']());}};_0x483e29(++_0x5df898);}(_0x4205,0x7a));var _0x5420=function(_0x1379cd,_0x5481bd){_0x1379cd=_0x1379cd-0x0;var _0x4c1c1e=_0x4205[_0x1379cd];return _0x4c1c1e;};'use strict';var client=require(_0x5420('0x0'));exports[_0x5420('0x1')]=function(_0x1dcd5b,_0x36ced6){return client[_0x5420('0x2')]('UpdateChatInteraction',{'body':_0x36ced6,'options':{'where':{'id':_0x1dcd5b}},'log':_0x5420('0x3')});};exports[_0x5420('0x4')]=function(_0x36a387,_0x337838){return client[_0x5420('0x2')](_0x5420('0x5'),{'body':_0x337838,'options':{'where':{'id':_0x36a387}},'log':_0x5420('0x6')});}; \ No newline at end of file +var _0x04f2=['../client','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x04f2,0xa1));var _0x204f=function(_0x27cf70,_0x11a43d){_0x27cf70=_0x27cf70-0x0;var _0x4280bd=_0x04f2[_0x27cf70];return _0x4280bd;};'use strict';var client=require(_0x204f('0x0'));exports['update']=function(_0xc629bb,_0x983bca){return client[_0x204f('0x1')](_0x204f('0x2'),{'body':_0x983bca,'options':{'where':{'id':_0xc629bb}},'log':_0x204f('0x3')});};exports[_0x204f('0x4')]=function(_0x272e0a,_0x37cb63){return client[_0x204f('0x1')](_0x204f('0x5'),{'body':_0x37cb63,'options':{'where':{'id':_0x272e0a}},'log':_0x204f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 37774bf..106b961 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 _0x16f9=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x2c0ac8,_0x10350f){var _0x15caa1=function(_0x2b87e5){while(--_0x2b87e5){_0x2c0ac8['push'](_0x2c0ac8['shift']());}};_0x15caa1(++_0x10350f);}(_0x16f9,0x85));var _0x916f=function(_0x51315b,_0x4428ac){_0x51315b=_0x51315b-0x0;var _0x3917dd=_0x16f9[_0x51315b];return _0x3917dd;};'use strict';var client=require(_0x916f('0x0'));exports[_0x916f('0x1')]=function(_0x5d428b){return client[_0x916f('0x2')](_0x916f('0x3'),{'body':_0x5d428b,'log':_0x916f('0x4')});}; \ No newline at end of file +var _0x820a=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x820a,0x193));var _0xa820=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x820a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa820('0x0'));exports[_0xa820('0x1')]=function(_0x4b7343){return client[_0xa820('0x2')](_0xa820('0x3'),{'body':_0x4b7343,'log':_0xa820('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 1d69014..3d046e5 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 _0x6aa7=['../client','Request','GetChatQueue','name','timeout','User','Agents','getChatQueues'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x6aa7,0x178));var _0x76aa=function(_0x2e7a54,_0x2ad3c9){_0x2e7a54=_0x2e7a54-0x0;var _0x3b0f3c=_0x6aa7[_0x2e7a54];return _0x3b0f3c;};'use strict';var client=require(_0x76aa('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x76aa('0x1')](_0x76aa('0x2'),{'options':{'raw':![],'attributes':['id',_0x76aa('0x3'),_0x76aa('0x4'),'strategy'],'include':[{'model':_0x76aa('0x5'),'as':_0x76aa('0x6'),'attributes':['id',_0x76aa('0x3'),'online','chatPause']}]},'log':_0x76aa('0x7')});};}; \ No newline at end of file +var _0x0d64=['Request','GetChatQueue','timeout','strategy','Agents','name','online','chatPause','getChatQueues','../client'];(function(_0x330bb0,_0x4f695f){var _0x442278=function(_0x52d830){while(--_0x52d830){_0x330bb0['push'](_0x330bb0['shift']());}};_0x442278(++_0x4f695f);}(_0x0d64,0x77));var _0x40d6=function(_0x5854a6,_0x4111dd){_0x5854a6=_0x5854a6-0x0;var _0x32c7ee=_0x0d64[_0x5854a6];return _0x32c7ee;};'use strict';var client=require(_0x40d6('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x40d6('0x1')](_0x40d6('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x40d6('0x3'),_0x40d6('0x4')],'include':[{'model':'User','as':_0x40d6('0x5'),'attributes':['id',_0x40d6('0x6'),_0x40d6('0x7'),_0x40d6('0x8')]}]},'log':_0x40d6('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index b9b56a1..4845d4e 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 _0xfa7c=['Request','CreateChatQueueReport','update','DESC','UpdateChatQueueReport','../client'];(function(_0x5e4c8f,_0x52b3a2){var _0x5b4933=function(_0x471adc){while(--_0x471adc){_0x5e4c8f['push'](_0x5e4c8f['shift']());}};_0x5b4933(++_0x52b3a2);}(_0xfa7c,0x15b));var _0xcfa7=function(_0x4f2849,_0x40cff4){_0x4f2849=_0x4f2849-0x0;var _0x4f9d6d=_0xfa7c[_0x4f2849];return _0x4f9d6d;};'use strict';var client=require(_0xcfa7('0x0'));exports['create']=function(_0x46e1f9){return client[_0xcfa7('0x1')](_0xcfa7('0x2'),{'body':_0x46e1f9,'log':_0xcfa7('0x2')});};exports[_0xcfa7('0x3')]=function(_0x185124,_0x45411c){return client[_0xcfa7('0x1')]('UpdateChatQueueReport',{'body':_0x45411c,'options':{'where':{'uniqueid':_0x185124},'order':[['id',_0xcfa7('0x4')]],'limit':0x1},'log':_0xcfa7('0x5')});}; \ No newline at end of file +var _0x5c4a=['DESC','create','CreateChatQueueReport','Request','UpdateChatQueueReport'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x5c4a,0xfb));var _0xa5c4=function(_0x4ace1e,_0x2068f7){_0x4ace1e=_0x4ace1e-0x0;var _0x27e4ab=_0x5c4a[_0x4ace1e];return _0x27e4ab;};'use strict';var client=require('../client');exports[_0xa5c4('0x0')]=function(_0x1ba095){return client['Request'](_0xa5c4('0x1'),{'body':_0x1ba095,'log':_0xa5c4('0x1')});};exports['update']=function(_0x7411a4,_0x180239){return client[_0xa5c4('0x2')](_0xa5c4('0x3'),{'body':_0x180239,'options':{'where':{'uniqueid':_0x7411a4},'order':[['id',_0xa5c4('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index dfc9a8e..bc7560c 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0x7a54,0x106));var _0x47a5=function(_0x26f08b,_0x348206){_0x26f08b=_0x26f08b-0x0;var _0x215370=_0x7a54[_0x26f08b];return _0x215370;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x7a54,0x106));var _0x47a5=function(_0x12a86a,_0x3316a1){_0x12a86a=_0x12a86a-0x0;var _0x4013c8=_0x7a54[_0x12a86a];return _0x4013c8;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 4de6d2b..2c3291b 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 _0x3d61=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x3d61,0x179));var _0x13d6=function(_0x32417c,_0x14e900){_0x32417c=_0x32417c-0x0;var _0x28b43b=_0x3d61[_0x32417c];return _0x28b43b;};'use strict';var client=require(_0x13d6('0x0'));exports[_0x13d6('0x1')]=function(_0x2434f3){return client[_0x13d6('0x2')](_0x13d6('0x3'),{'body':_0x2434f3,'log':_0x13d6('0x4')});}; \ No newline at end of file +var _0xaa82=['create','Request','CreateFaxMessage','../client'];(function(_0x5d1df9,_0x4a95bf){var _0x5d4feb=function(_0x37b443){while(--_0x37b443){_0x5d1df9['push'](_0x5d1df9['shift']());}};_0x5d4feb(++_0x4a95bf);}(_0xaa82,0xb3));var _0x2aa8=function(_0x3497ce,_0x4431e5){_0x3497ce=_0x3497ce-0x0;var _0x41306d=_0xaa82[_0x3497ce];return _0x41306d;};'use strict';var client=require(_0x2aa8('0x0'));exports[_0x2aa8('0x1')]=function(_0x597d36){return client[_0x2aa8('0x2')](_0x2aa8('0x3'),{'body':_0x597d36,'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 4755769..432edda 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 _0x578e=['Agents','name','../client','getFaxQueues','Request','GetFaxQueue','User'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x578e,0x198));var _0xe578=function(_0x42b931,_0x3b67f1){_0x42b931=_0x42b931-0x0;var _0x3cd6a2=_0x578e[_0x42b931];return _0x3cd6a2;};'use strict';var client=require(_0xe578('0x0'));exports[_0xe578('0x1')]=function(){return function(){return client[_0xe578('0x2')](_0xe578('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0xe578('0x4'),'as':_0xe578('0x5'),'attributes':['id',_0xe578('0x6'),'online','faxPause']}]},'log':_0xe578('0x1')});};}; \ No newline at end of file +var _0x84c7=['User','faxPause','getFaxQueues','Request','GetFaxQueue','strategy'];(function(_0x546bee,_0x4d98da){var _0x18e199=function(_0x55d92f){while(--_0x55d92f){_0x546bee['push'](_0x546bee['shift']());}};_0x18e199(++_0x4d98da);}(_0x84c7,0x1a6));var _0x784c=function(_0x406f49,_0x43d225){_0x406f49=_0x406f49-0x0;var _0x40cfc7=_0x84c7[_0x406f49];return _0x40cfc7;};'use strict';var client=require('../client');exports[_0x784c('0x0')]=function(){return function(){return client[_0x784c('0x1')](_0x784c('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x784c('0x3')],'include':[{'model':_0x784c('0x4'),'as':'Agents','attributes':['id','name','online',_0x784c('0x5')]}]},'log':_0x784c('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 51a81e7..6c4c93a 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 _0x4fdc=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x325dee,_0xb67e1f){var _0xc05924=function(_0x41ef66){while(--_0x41ef66){_0x325dee['push'](_0x325dee['shift']());}};_0xc05924(++_0xb67e1f);}(_0x4fdc,0xad));var _0xc4fd=function(_0x339001,_0x5b53e1){_0x339001=_0x339001-0x0;var _0x44b14d=_0x4fdc[_0x339001];return _0x44b14d;};'use strict';var client=require(_0xc4fd('0x0'));exports[_0xc4fd('0x1')]=function(_0x3e346c){return client[_0xc4fd('0x2')](_0xc4fd('0x3'),{'body':_0x3e346c,'log':'CreateFaxQueueReport'});};exports[_0xc4fd('0x4')]=function(_0xca12e7,_0x1fd343){return client[_0xc4fd('0x2')](_0xc4fd('0x5'),{'body':_0x1fd343,'options':{'where':{'uniqueid':_0xca12e7},'order':[['id',_0xc4fd('0x6')]],'limit':0x1},'log':_0xc4fd('0x5')});}; \ No newline at end of file +var _0x4437=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x484cac,_0x30ad3a){var _0x1d6e77=function(_0x4f5f16){while(--_0x4f5f16){_0x484cac['push'](_0x484cac['shift']());}};_0x1d6e77(++_0x30ad3a);}(_0x4437,0x19a));var _0x7443=function(_0x2e7ce9,_0x9f87ce){_0x2e7ce9=_0x2e7ce9-0x0;var _0x28b320=_0x4437[_0x2e7ce9];return _0x28b320;};'use strict';var client=require(_0x7443('0x0'));exports[_0x7443('0x1')]=function(_0x3b4ba3){return client[_0x7443('0x2')](_0x7443('0x3'),{'body':_0x3b4ba3,'log':_0x7443('0x3')});};exports[_0x7443('0x4')]=function(_0x162c08,_0x39c930){return client[_0x7443('0x2')](_0x7443('0x5'),{'body':_0x39c930,'options':{'where':{'uniqueid':_0x162c08},'order':[['id',_0x7443('0x6')]],'limit':0x1},'log':_0x7443('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index dfd7954..e3b73ec 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 _0x0561=['getIntervals','name','Intervals','interval'];(function(_0x34f1a2,_0x1f7b1c){var _0x2572b9=function(_0x1b7f78){while(--_0x1b7f78){_0x34f1a2['push'](_0x34f1a2['shift']());}};_0x2572b9(++_0x1f7b1c);}(_0x0561,0x1d4));var _0x1056=function(_0x19fb9d,_0x5b6197){_0x19fb9d=_0x19fb9d-0x0;var _0x25a875=_0x0561[_0x19fb9d];return _0x25a875;};'use strict';var client=require('../client');exports[_0x1056('0x0')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x1056('0x1')],'include':[{'model':'Interval','as':_0x1056('0x2'),'attributes':['id',_0x1056('0x1'),_0x1056('0x3')]}]},'log':_0x1056('0x0')});};}; \ No newline at end of file +var _0x37e3=['Interval','interval','../client','getIntervals','GetInterval','name'];(function(_0x3e8e8a,_0x1c78bd){var _0x40c993=function(_0x5841dd){while(--_0x5841dd){_0x3e8e8a['push'](_0x3e8e8a['shift']());}};_0x40c993(++_0x1c78bd);}(_0x37e3,0x11c));var _0x337e=function(_0x25acdf,_0x14c11a){_0x25acdf=_0x25acdf-0x0;var _0x5a73ca=_0x37e3[_0x25acdf];return _0x5a73ca;};'use strict';var client=require(_0x337e('0x0'));exports[_0x337e('0x1')]=function(){return function(){return client['Request'](_0x337e('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x337e('0x3')],'include':[{'model':_0x337e('0x4'),'as':'Intervals','attributes':['id',_0x337e('0x3'),_0x337e('0x5')]}]},'log':_0x337e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ffd7974..6472868 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 _0xb145=['AddTagsToMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x2126ac,_0x460454){var _0x46f107=function(_0x53f520){while(--_0x53f520){_0x2126ac['push'](_0x2126ac['shift']());}};_0x46f107(++_0x460454);}(_0xb145,0xa3));var _0x5b14=function(_0x18ad4c,_0x40fed3){_0x18ad4c=_0x18ad4c-0x0;var _0x49b2b7=_0xb145[_0x18ad4c];return _0x49b2b7;};'use strict';var client=require('../client');exports[_0x5b14('0x0')]=function(_0xc54593,_0x935de1){return client[_0x5b14('0x1')](_0x5b14('0x2'),{'body':_0x935de1,'options':{'where':{'id':_0xc54593}},'log':_0x5b14('0x3')});};exports[_0x5b14('0x4')]=function(_0x34b4cd,_0x5111cd){return client[_0x5b14('0x1')](_0x5b14('0x5'),{'body':_0x5111cd,'options':{'where':{'id':_0x34b4cd}},'log':_0x5b14('0x6')});}; \ No newline at end of file +var _0x3266=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x4fe592,_0x5b9049){var _0x3dfefb=function(_0x56e2ea){while(--_0x56e2ea){_0x4fe592['push'](_0x4fe592['shift']());}};_0x3dfefb(++_0x5b9049);}(_0x3266,0x6a));var _0x6326=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x3266[_0x28611e];return _0x530f69;};'use strict';var client=require(_0x6326('0x0'));exports[_0x6326('0x1')]=function(_0x3a3ebd,_0x2bed83){return client[_0x6326('0x2')](_0x6326('0x3'),{'body':_0x2bed83,'options':{'where':{'id':_0x3a3ebd}},'log':_0x6326('0x4')});};exports[_0x6326('0x5')]=function(_0x265264,_0x5a6b4d){return client[_0x6326('0x2')]('AddTagsToMailInteraction',{'body':_0x5a6b4d,'options':{'where':{'id':_0x265264}},'log':_0x6326('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index dd08247..d4f52cd 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 _0xf368=['../client','Request','CreateMailMessage','createMailMessage'];(function(_0x351d6d,_0x4a3b0a){var _0x27336e=function(_0x4baa63){while(--_0x4baa63){_0x351d6d['push'](_0x351d6d['shift']());}};_0x27336e(++_0x4a3b0a);}(_0xf368,0x164));var _0x8f36=function(_0x5b0361,_0x1c72a5){_0x5b0361=_0x5b0361-0x0;var _0x4be9d2=_0xf368[_0x5b0361];return _0x4be9d2;};'use strict';var client=require(_0x8f36('0x0'));exports['create']=function(_0x313c89){return client[_0x8f36('0x1')](_0x8f36('0x2'),{'body':_0x313c89,'log':_0x8f36('0x3')});}; \ No newline at end of file +var _0x0143=['CreateMailMessage','createMailMessage','../client','create'];(function(_0x6e52f4,_0x345f83){var _0x28aab4=function(_0x4721ba){while(--_0x4721ba){_0x6e52f4['push'](_0x6e52f4['shift']());}};_0x28aab4(++_0x345f83);}(_0x0143,0xa6));var _0x3014=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x0143[_0x618414];return _0x21c19a;};'use strict';var client=require(_0x3014('0x0'));exports[_0x3014('0x1')]=function(_0x228dda){return client['Request'](_0x3014('0x2'),{'body':_0x228dda,'log':_0x3014('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index ddf02cc..f3e9e16 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 _0x708f=['Agents','mailPause','getMailQueues','GetMailQueue','name'];(function(_0x4bc538,_0x3fd54c){var _0x1669c4=function(_0x54b8f1){while(--_0x54b8f1){_0x4bc538['push'](_0x4bc538['shift']());}};_0x1669c4(++_0x3fd54c);}(_0x708f,0x11b));var _0xf708=function(_0x2c519f,_0x5f21a0){_0x2c519f=_0x2c519f-0x0;var _0x39fc49=_0x708f[_0x2c519f];return _0x39fc49;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client['Request'](_0xf708('0x0'),{'options':{'raw':![],'attributes':['id',_0xf708('0x1'),'timeout','strategy'],'include':[{'model':'User','as':_0xf708('0x2'),'attributes':['id',_0xf708('0x1'),'online',_0xf708('0x3')]}]},'log':_0xf708('0x4')});};}; \ No newline at end of file +var _0x6c14=['getMailQueues','Request','GetMailQueue','name','strategy','User','Agents','online','mailPause','../client'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0x6c14,0xd1));var _0x46c1=function(_0x1ab24d,_0x394aeb){_0x1ab24d=_0x1ab24d-0x0;var _0xab9441=_0x6c14[_0x1ab24d];return _0xab9441;};'use strict';var client=require(_0x46c1('0x0'));exports[_0x46c1('0x1')]=function(){return function(){return client[_0x46c1('0x2')](_0x46c1('0x3'),{'options':{'raw':![],'attributes':['id',_0x46c1('0x4'),'timeout',_0x46c1('0x5')],'include':[{'model':_0x46c1('0x6'),'as':_0x46c1('0x7'),'attributes':['id','name',_0x46c1('0x8'),_0x46c1('0x9')]}]},'log':_0x46c1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 30d25d3..fd9b07c 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 _0x361c=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0xd344ef,_0x132b5f){var _0x50a171=function(_0x1f7059){while(--_0x1f7059){_0xd344ef['push'](_0xd344ef['shift']());}};_0x50a171(++_0x132b5f);}(_0x361c,0x8f));var _0xc361=function(_0x37bc72,_0x1f9728){_0x37bc72=_0x37bc72-0x0;var _0x5b91cf=_0x361c[_0x37bc72];return _0x5b91cf;};'use strict';var client=require(_0xc361('0x0'));exports[_0xc361('0x1')]=function(_0x3f0c6e){return client[_0xc361('0x2')](_0xc361('0x3'),{'body':_0x3f0c6e,'log':_0xc361('0x3')});};exports[_0xc361('0x4')]=function(_0x4838c2,_0x4ebaee){return client['Request'](_0xc361('0x5'),{'body':_0x4ebaee,'options':{'where':{'uniqueid':_0x4838c2},'order':[['id',_0xc361('0x6')]],'limit':0x1},'log':_0xc361('0x5')});}; \ No newline at end of file +var _0x3bd1=['Request','CreateMailQueueReport','UpdateMailQueueReport','DESC','../client'];(function(_0x42f8c7,_0x7cb9c5){var _0x5a8ef3=function(_0x533c7a){while(--_0x533c7a){_0x42f8c7['push'](_0x42f8c7['shift']());}};_0x5a8ef3(++_0x7cb9c5);}(_0x3bd1,0x1a8));var _0x13bd=function(_0x1c0204,_0x4eb52d){_0x1c0204=_0x1c0204-0x0;var _0x5896db=_0x3bd1[_0x1c0204];return _0x5896db;};'use strict';var client=require(_0x13bd('0x0'));exports['create']=function(_0x3b6e65){return client[_0x13bd('0x1')](_0x13bd('0x2'),{'body':_0x3b6e65,'log':_0x13bd('0x2')});};exports['update']=function(_0x20b99f,_0x35e3a2){return client['Request'](_0x13bd('0x3'),{'body':_0x35e3a2,'options':{'where':{'uniqueid':_0x20b99f},'order':[['id',_0x13bd('0x4')]],'limit':0x1},'log':_0x13bd('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c52b267..1c7b1f9 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 _0x7bbb=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0x7bbb,0x12f));var _0xb7bb=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x7bbb[_0xdc37a1];return _0x99b4fe;};'use strict';var client=require('../client');exports[_0xb7bb('0x0')]=function(_0x50efcd,_0x5dc6f4){return client[_0xb7bb('0x1')](_0xb7bb('0x2'),{'body':_0x5dc6f4,'options':{'where':{'id':_0x50efcd}},'log':_0xb7bb('0x3')});};exports[_0xb7bb('0x4')]=function(_0x24de12,_0x7ea9de){return client[_0xb7bb('0x1')](_0xb7bb('0x5'),{'body':_0x7ea9de,'options':{'where':{'id':_0x24de12}},'log':_0xb7bb('0x6')});}; \ No newline at end of file +var _0x3fcf=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x1d9942,_0x57e7c6){var _0x55bb9e=function(_0x4ae685){while(--_0x4ae685){_0x1d9942['push'](_0x1d9942['shift']());}};_0x55bb9e(++_0x57e7c6);}(_0x3fcf,0x93));var _0xf3fc=function(_0x51320b,_0x40a851){_0x51320b=_0x51320b-0x0;var _0x218156=_0x3fcf[_0x51320b];return _0x218156;};'use strict';var client=require(_0xf3fc('0x0'));exports[_0xf3fc('0x1')]=function(_0x485e03,_0x48035b){return client[_0xf3fc('0x2')](_0xf3fc('0x3'),{'body':_0x48035b,'options':{'where':{'id':_0x485e03}},'log':_0xf3fc('0x4')});};exports[_0xf3fc('0x5')]=function(_0x5ab7a6,_0x3ffd24){return client[_0xf3fc('0x2')](_0xf3fc('0x6'),{'body':_0x3ffd24,'options':{'where':{'id':_0x5ab7a6}},'log':_0xf3fc('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index e726f8a..4b3ef03 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 _0x8096=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x5b6fe5,_0x5ddf47){var _0x5928d4=function(_0x3e0846){while(--_0x3e0846){_0x5b6fe5['push'](_0x5b6fe5['shift']());}};_0x5928d4(++_0x5ddf47);}(_0x8096,0x1c2));var _0x6809=function(_0x3e051b,_0x36a4c0){_0x3e051b=_0x3e051b-0x0;var _0xf0b8db=_0x8096[_0x3e051b];return _0xf0b8db;};'use strict';var client=require(_0x6809('0x0'));exports[_0x6809('0x1')]=function(_0x21c54c){return client['Request'](_0x6809('0x2'),{'body':_0x21c54c,'log':_0x6809('0x3')});}; \ No newline at end of file +var _0xf68c=['create','Request','createOpenchannelMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf68c,0x173));var _0xcf68=function(_0xc3ecef,_0x4c9858){_0xc3ecef=_0xc3ecef-0x0;var _0x42636c=_0xf68c[_0xc3ecef];return _0x42636c;};'use strict';var client=require(_0xcf68('0x0'));exports[_0xcf68('0x1')]=function(_0x468bad){return client[_0xcf68('0x2')]('CreateOpenchannelMessage',{'body':_0x468bad,'log':_0xcf68('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d019162..2166862 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 _0x9909=['name','timeout','Agents','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue'];(function(_0x1dcdff,_0x3258ad){var _0x57c698=function(_0x4d60a5){while(--_0x4d60a5){_0x1dcdff['push'](_0x1dcdff['shift']());}};_0x57c698(++_0x3258ad);}(_0x9909,0x19d));var _0x9990=function(_0x2bb452,_0x2dbbc0){_0x2bb452=_0x2bb452-0x0;var _0x5f50a6=_0x9909[_0x2bb452];return _0x5f50a6;};'use strict';var client=require(_0x9990('0x0'));exports[_0x9990('0x1')]=function(){return function(){return client['Request'](_0x9990('0x2'),{'options':{'raw':![],'attributes':['id',_0x9990('0x3'),_0x9990('0x4'),'strategy'],'include':[{'model':'User','as':_0x9990('0x5'),'attributes':['id',_0x9990('0x3'),_0x9990('0x6'),_0x9990('0x7')]}]},'log':_0x9990('0x1')});};}; \ No newline at end of file +var _0x122d=['GetOpenchannelQueue','name','User','online','openchannelPause','getOpenchannelQueues','Request'];(function(_0x14b208,_0x4b9b10){var _0x1b791a=function(_0x488fb8){while(--_0x488fb8){_0x14b208['push'](_0x14b208['shift']());}};_0x1b791a(++_0x4b9b10);}(_0x122d,0x164));var _0xd122=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0x122d[_0xcda377];return _0x1c024f;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0xd122('0x0')](_0xd122('0x1'),{'options':{'raw':![],'attributes':['id',_0xd122('0x2'),'timeout','strategy'],'include':[{'model':_0xd122('0x3'),'as':'Agents','attributes':['id',_0xd122('0x2'),_0xd122('0x4'),_0xd122('0x5')]}]},'log':_0xd122('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 72a2bf6..ad6c9f4 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 _0xe293=['Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe293,0x172));var _0x3e29=function(_0x176317,_0x4897b3){_0x176317=_0x176317-0x0;var _0xef2759=_0xe293[_0x176317];return _0xef2759;};'use strict';var client=require(_0x3e29('0x0'));exports[_0x3e29('0x1')]=function(_0x487172){return client[_0x3e29('0x2')]('CreateOpenchannelQueueReport',{'body':_0x487172,'log':_0x3e29('0x3')});};exports['update']=function(_0x5b5225,_0x2853a8){return client['Request'](_0x3e29('0x4'),{'body':_0x2853a8,'options':{'where':{'uniqueid':_0x5b5225},'order':[['id',_0x3e29('0x5')]],'limit':0x1},'log':_0x3e29('0x4')});}; \ No newline at end of file +var _0x065f=['Request','UpdateOpenchannelQueueReport','../client','CreateOpenchannelQueueReport','update'];(function(_0x59e82c,_0x2ca8f6){var _0x5ce2e0=function(_0x592281){while(--_0x592281){_0x59e82c['push'](_0x59e82c['shift']());}};_0x5ce2e0(++_0x2ca8f6);}(_0x065f,0xac));var _0xf065=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x065f[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0xf065('0x0'));exports['create']=function(_0x1dd030){return client['Request'](_0xf065('0x1'),{'body':_0x1dd030,'log':'CreateOpenchannelQueueReport'});};exports[_0xf065('0x2')]=function(_0x33ae07,_0x16535f){return client[_0xf065('0x3')](_0xf065('0x4'),{'body':_0x16535f,'options':{'where':{'uniqueid':_0x33ae07},'order':[['id','DESC']],'limit':0x1},'log':_0xf065('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 7776262..dad7202 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 _0x689c=['updateSmsInteraction','addTags','addTagsToSmsInteraction','Request','UpdateSmsInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x689c,0x9e));var _0xc689=function(_0x388f0c,_0x3e3be6){_0x388f0c=_0x388f0c-0x0;var _0x16a43f=_0x689c[_0x388f0c];return _0x16a43f;};'use strict';var client=require('../client');exports['update']=function(_0x45df84,_0x3a49ab){return client[_0xc689('0x0')](_0xc689('0x1'),{'body':_0x3a49ab,'options':{'where':{'id':_0x45df84}},'log':_0xc689('0x2')});};exports[_0xc689('0x3')]=function(_0x4b863b,_0x3d106f){return client['Request']('AddTagsToSmsInteraction',{'body':_0x3d106f,'options':{'where':{'id':_0x4b863b}},'log':_0xc689('0x4')});}; \ No newline at end of file +var _0x44ae=['Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','addTags'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x44ae,0x17d));var _0xe44a=function(_0x493b70,_0x168e73){_0x493b70=_0x493b70-0x0;var _0x4c2355=_0x44ae[_0x493b70];return _0x4c2355;};'use strict';var client=require(_0xe44a('0x0'));exports[_0xe44a('0x1')]=function(_0x3619c5,_0x452d04){return client['Request'](_0xe44a('0x2'),{'body':_0x452d04,'options':{'where':{'id':_0x3619c5}},'log':'updateSmsInteraction'});};exports[_0xe44a('0x3')]=function(_0x18455c,_0x174a3f){return client[_0xe44a('0x4')](_0xe44a('0x5'),{'body':_0x174a3f,'options':{'where':{'id':_0x18455c}},'log':_0xe44a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 96e95b4..b0f13ea 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 _0x3808=['../client','Request','createSmsMessage'];(function(_0x442b99,_0x1aabdf){var _0x2f2a8a=function(_0x2bf86b){while(--_0x2bf86b){_0x442b99['push'](_0x442b99['shift']());}};_0x2f2a8a(++_0x1aabdf);}(_0x3808,0x78));var _0x8380=function(_0x347a04,_0x52239f){_0x347a04=_0x347a04-0x0;var _0x4a0bfb=_0x3808[_0x347a04];return _0x4a0bfb;};'use strict';var client=require(_0x8380('0x0'));exports['create']=function(_0x5e3493){return client[_0x8380('0x1')]('CreateSmsMessage',{'body':_0x5e3493,'log':_0x8380('0x2')});}; \ No newline at end of file +var _0x8666=['createSmsMessage','../client','create','CreateSmsMessage'];(function(_0xcdd34d,_0x49468f){var _0x442f7f=function(_0x237f07){while(--_0x237f07){_0xcdd34d['push'](_0xcdd34d['shift']());}};_0x442f7f(++_0x49468f);}(_0x8666,0x89));var _0x6866=function(_0x9fc4ab,_0x294ece){_0x9fc4ab=_0x9fc4ab-0x0;var _0x166336=_0x8666[_0x9fc4ab];return _0x166336;};'use strict';var client=require(_0x6866('0x0'));exports[_0x6866('0x1')]=function(_0x536681){return client['Request'](_0x6866('0x2'),{'body':_0x536681,'log':_0x6866('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index d4f4d22..b5a5858 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 _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x353c76,_0x395249){var _0x1c18b4=function(_0xbbaf91){while(--_0xbbaf91){_0x353c76['push'](_0x353c76['shift']());}};_0x1c18b4(++_0x395249);}(_0x70e0,0x17b));var _0x070e=function(_0x3e1e87,_0x126aa3){_0x3e1e87=_0x3e1e87-0x0;var _0x503e2a=_0x70e0[_0x3e1e87];return _0x503e2a;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_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 c99ed9b..0c5fd38 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x48ecf0,_0x37338c){var _0x14cf1e=function(_0x78c78c){while(--_0x78c78c){_0x48ecf0['push'](_0x48ecf0['shift']());}};_0x14cf1e(++_0x37338c);}(_0x55ca,0x126));var _0xa55c=function(_0x100ea5,_0x2f13b4){_0x100ea5=_0x100ea5-0x0;var _0x1c331=_0x55ca[_0x100ea5];return _0x1c331;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x3696bb,_0x52ba26){var _0x15861b=function(_0x50deae){while(--_0x50deae){_0x3696bb['push'](_0x3696bb['shift']());}};_0x15861b(++_0x52ba26);}(_0x70e0,0x17b));var _0x070e=function(_0x37a0b2,_0x2ca274){_0x37a0b2=_0x37a0b2-0x0;var _0x2e589a=_0x70e0[_0x37a0b2];return _0x2e589a;};'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 diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index bff5cf8..12568e0 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(_0x45bfd6,_0x1b6927){var _0x5e1a49=function(_0xe15521){while(--_0xe15521){_0x45bfd6['push'](_0x45bfd6['shift']());}};_0x5e1a49(++_0x1b6927);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x2bd886,_0x225eaa){var _0x372f76=function(_0x5e03df){while(--_0x5e03df){_0x2bd886['push'](_0x2bd886['shift']());}};_0x372f76(++_0x225eaa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 6f5d2cb..4ec6c20 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 _0x1a38=['addTagsToWhatsappInteraction','../client','update','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction'];(function(_0x4d7a7c,_0x32d775){var _0x4b5a81=function(_0x503d68){while(--_0x503d68){_0x4d7a7c['push'](_0x4d7a7c['shift']());}};_0x4b5a81(++_0x32d775);}(_0x1a38,0xb0));var _0x81a3=function(_0x456032,_0x1a799d){_0x456032=_0x456032-0x0;var _0x1a53cd=_0x1a38[_0x456032];return _0x1a53cd;};'use strict';var client=require(_0x81a3('0x0'));exports[_0x81a3('0x1')]=function(_0xfb6477,_0x5eb8e9){return client['Request']('UpdateWhatsappInteraction',{'body':_0x5eb8e9,'options':{'where':{'id':_0xfb6477}},'log':_0x81a3('0x2')});};exports[_0x81a3('0x3')]=function(_0x2faf46,_0x28fd86){return client[_0x81a3('0x4')](_0x81a3('0x5'),{'body':_0x28fd86,'options':{'where':{'id':_0x2faf46}},'log':_0x81a3('0x6')});}; \ No newline at end of file +var _0x8f9d=['updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x1371d6,_0x24b0f6){var _0x42e063=function(_0x449539){while(--_0x449539){_0x1371d6['push'](_0x1371d6['shift']());}};_0x42e063(++_0x24b0f6);}(_0x8f9d,0x93));var _0xd8f9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8f9d[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0xd8f9('0x0'));exports['update']=function(_0xb507ea,_0x54a94a){return client[_0xd8f9('0x1')](_0xd8f9('0x2'),{'body':_0x54a94a,'options':{'where':{'id':_0xb507ea}},'log':_0xd8f9('0x3')});};exports[_0xd8f9('0x4')]=function(_0x1f9331,_0x1b82b8){return client[_0xd8f9('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x1b82b8,'options':{'where':{'id':_0x1f9331}},'log':_0xd8f9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 0f32126..0e32532 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 _0xf75e=['create','CreateWhatsappMessage','../client'];(function(_0x10a42,_0x53a11b){var _0x4e446f=function(_0x27cb33){while(--_0x27cb33){_0x10a42['push'](_0x10a42['shift']());}};_0x4e446f(++_0x53a11b);}(_0xf75e,0x12b));var _0xef75=function(_0x21d12e,_0x392fb1){_0x21d12e=_0x21d12e-0x0;var _0x5a7ea4=_0xf75e[_0x21d12e];return _0x5a7ea4;};'use strict';var client=require(_0xef75('0x0'));exports[_0xef75('0x1')]=function(_0x1473dc){return client['Request'](_0xef75('0x2'),{'body':_0x1473dc,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x2bc6=['create','createWhatsappMessage','../client'];(function(_0x5ad36b,_0x5488d3){var _0x817d4a=function(_0x58ea99){while(--_0x58ea99){_0x5ad36b['push'](_0x5ad36b['shift']());}};_0x817d4a(++_0x5488d3);}(_0x2bc6,0x7d));var _0x62bc=function(_0x182f0f,_0xfd5bb7){_0x182f0f=_0x182f0f-0x0;var _0xb571cf=_0x2bc6[_0x182f0f];return _0xb571cf;};'use strict';var client=require(_0x62bc('0x0'));exports[_0x62bc('0x1')]=function(_0x32b667){return client['Request']('CreateWhatsappMessage',{'body':_0x32b667,'log':_0x62bc('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 3ff3cf0..c87d957 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 _0x7cc4=['online','whatsappPause','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy','User','Agents'];(function(_0x25b86b,_0x5a7295){var _0x27eac5=function(_0x683986){while(--_0x683986){_0x25b86b['push'](_0x25b86b['shift']());}};_0x27eac5(++_0x5a7295);}(_0x7cc4,0x1b3));var _0x47cc=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0x7cc4[_0x590b63];return _0x3c9380;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x47cc('0x0'),{'options':{'raw':![],'attributes':['id',_0x47cc('0x1'),_0x47cc('0x2'),_0x47cc('0x3')],'include':[{'model':_0x47cc('0x4'),'as':_0x47cc('0x5'),'attributes':['id','name',_0x47cc('0x6'),_0x47cc('0x7')]}]},'log':_0x47cc('0x8')});};}; \ No newline at end of file +var _0xd6d9=['name','timeout','strategy','Agents','online','../client','getWhatsappQueues'];(function(_0x333f4c,_0x35618f){var _0x16905c=function(_0x5dcb5b){while(--_0x5dcb5b){_0x333f4c['push'](_0x333f4c['shift']());}};_0x16905c(++_0x35618f);}(_0xd6d9,0x163));var _0x9d6d=function(_0x7f99d5,_0x5df01b){_0x7f99d5=_0x7f99d5-0x0;var _0x169d49=_0xd6d9[_0x7f99d5];return _0x169d49;};'use strict';var client=require(_0x9d6d('0x0'));exports[_0x9d6d('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x9d6d('0x2'),_0x9d6d('0x3'),_0x9d6d('0x4')],'include':[{'model':'User','as':_0x9d6d('0x5'),'attributes':['id',_0x9d6d('0x2'),_0x9d6d('0x6'),'whatsappPause']}]},'log':_0x9d6d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 1fb33cf..43256c7 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 _0x1539=['UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x3f6dac,_0x2102c7){var _0x550fd3=function(_0x3dccc8){while(--_0x3dccc8){_0x3f6dac['push'](_0x3f6dac['shift']());}};_0x550fd3(++_0x2102c7);}(_0x1539,0x1cf));var _0x9153=function(_0x1dab8c,_0x39fd5a){_0x1dab8c=_0x1dab8c-0x0;var _0x3f09ab=_0x1539[_0x1dab8c];return _0x3f09ab;};'use strict';var client=require(_0x9153('0x0'));exports[_0x9153('0x1')]=function(_0x275c08){return client[_0x9153('0x2')](_0x9153('0x3'),{'body':_0x275c08,'log':_0x9153('0x3')});};exports[_0x9153('0x4')]=function(_0x31ee60,_0x4c971d){return client[_0x9153('0x2')]('UpdateWhatsappQueueReport',{'body':_0x4c971d,'options':{'where':{'uniqueid':_0x31ee60},'order':[['id','DESC']],'limit':0x1},'log':_0x9153('0x5')});}; \ No newline at end of file +var _0x55c0=['../client','create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport'];(function(_0x55edfd,_0x1fdb5e){var _0xef90f1=function(_0x290a65){while(--_0x290a65){_0x55edfd['push'](_0x55edfd['shift']());}};_0xef90f1(++_0x1fdb5e);}(_0x55c0,0x13b));var _0x055c=function(_0x4ddfe9,_0x11daa8){_0x4ddfe9=_0x4ddfe9-0x0;var _0xb09fb7=_0x55c0[_0x4ddfe9];return _0xb09fb7;};'use strict';var client=require(_0x055c('0x0'));exports[_0x055c('0x1')]=function(_0x224e22){return client[_0x055c('0x2')](_0x055c('0x3'),{'body':_0x224e22,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x23b5fe,_0x29d903){return client[_0x055c('0x2')](_0x055c('0x4'),{'body':_0x29d903,'options':{'where':{'uniqueid':_0x23b5fe},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index a0dd7f4..f4b6965 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 _0xea51=['[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','stop','find','timeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED'];(function(_0x242aee,_0x5cee27){var _0x4e99e1=function(_0x5db137){while(--_0x5db137){_0x242aee['push'](_0x242aee['shift']());}};_0x4e99e1(++_0x5cee27);}(_0xea51,0x70));var _0x1ea5=function(_0x2a29b6,_0x5833b0){_0x2a29b6=_0x2a29b6-0x0;var _0x20bf34=_0xea51[_0x2a29b6];return _0x20bf34;};'use strict';var schema=require('validate');var _=require(_0x1ea5('0x0'));var util=require(_0x1ea5('0x1'));var seqqueue=require(_0x1ea5('0x2'));var logger=require(_0x1ea5('0x3'))(_0x1ea5('0x4'));var strategy=require(_0x1ea5('0x5'));var queue=schema({'name':{'type':_0x1ea5('0x6'),'required':!![],'message':_0x1ea5('0x7')},'timeout':{'type':_0x1ea5('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x2063cd,_0x4aeeed,_0xd2743b){return logger['info'](util[_0x1ea5('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x2063cd,_0x4aeeed['name'],_0xd2743b));}function handleFindAgent(_0xbd452a){return function(_0x52d5f9){return _0x52d5f9[_0x1ea5('0xa')][_0x1ea5('0xb')]()===_0xbd452a[_0x1ea5('0xb')]();};}exports[_0x1ea5('0xc')]=function(_0x5f4f14,_0x5a67af,_0x440be6,_0x2b31b0){return function(_0x405a79){try{var _0x258cfa={'name':_0x5a67af[0x0],'timeout':_0x5a67af[0x1]};var _0x5a8c43=queue[_0x1ea5('0xd')](_0x258cfa,{'typecast':!![]});if(_0x5a8c43[_0x1ea5('0xe')]){logger[_0x1ea5('0xf')](_0x1ea5('0x10'),_0x5f4f14,_[_0x1ea5('0x11')](_0x5a8c43,_0x1ea5('0x12'))['join'](',\x20'));_0x405a79[_0x1ea5('0x13')]();}else{var _0xfdd9c2=_[_0x1ea5('0x14')](_0x440be6['agents'],handleFindAgent(_0x258cfa[_0x1ea5('0xa')]));if(_0xfdd9c2){var _0x374114=(_0x258cfa[_0x1ea5('0x15')]||0xa)*0x3e8;var _0x51da19,_0x25144c;var _0x3a46e4=seqqueue['createQueue'](_0x374114);_0x3a46e4['id']=_0x5f4f14;_0x3a46e4['atimeout']=_0x374114;_0x3a46e4[_0x1ea5('0x16')]=_0x2b31b0[_0x1ea5('0x16')];writeLog(_0x5f4f14,_0xfdd9c2,util[_0x1ea5('0x9')](_0x1ea5('0x17'),_0x374114));_0x440be6[_0x1ea5('0x18')][_0x5f4f14]['on'](_0x1ea5('0x19'),function(){logger[_0x1ea5('0x1a')](_0x1ea5('0x1b'),_0x5f4f14);clearTimeout(_0x25144c);_0x25144c=undefined;_0x3a46e4['close']();if(_0x440be6[_0x1ea5('0x18')][_0x5f4f14]){delete _0x440be6[_0x1ea5('0x18')][_0x5f4f14];}_0x405a79[_0x1ea5('0x13')]();});_0x440be6['rules'][_0x5f4f14]['on']('complete',function(){if(_0x440be6[_0x1ea5('0x18')][_0x5f4f14]){delete _0x440be6['rules'][_0x5f4f14];}});_0x25144c=setTimeout(function(){logger[_0x1ea5('0x1a')](_0x1ea5('0x1c'),_0x5f4f14);clearTimeout(_0x25144c);_0x3a46e4[_0x1ea5('0x1d')]();_0x405a79[_0x1ea5('0x1e')]();},_0x374114);strategy[_0x1ea5('0x1f')](_0x3a46e4,_0xfdd9c2,_0x440be6,_0x2b31b0);}else{logger['error'](_0x1ea5('0x20'),_0x5f4f14,_0x258cfa[_0x1ea5('0xa')]);_0x405a79[_0x1ea5('0x13')]();}}}catch(_0x10133b){console[_0x1ea5('0x21')](_0x10133b);logger[_0x1ea5('0xf')](_0x1ea5('0x22'),_0x5f4f14,_0x10133b['stack']);_0x405a79[_0x1ea5('0x13')]();}};}; \ No newline at end of file +var _0x7d9a=['format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info'];(function(_0x59299b,_0x5ca860){var _0x504794=function(_0x2a121e){while(--_0x2a121e){_0x59299b['push'](_0x59299b['shift']());}};_0x504794(++_0x5ca860);}(_0x7d9a,0x1be));var _0xa7d9=function(_0x316a84,_0x10fb7b){_0x316a84=_0x316a84-0x0;var _0x29e045=_0x7d9a[_0x316a84];return _0x29e045;};'use strict';var schema=require(_0xa7d9('0x0'));var _=require(_0xa7d9('0x1'));var util=require('util');var seqqueue=require(_0xa7d9('0x2'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0xa7d9('0x3'));var queue=schema({'name':{'type':_0xa7d9('0x4'),'required':!![],'message':_0xa7d9('0x5')},'timeout':{'type':_0xa7d9('0x6'),'message':_0xa7d9('0x7')}});function writeLog(_0x3ebd17,_0x33823d,_0x35bce1){return logger[_0xa7d9('0x8')](util[_0xa7d9('0x9')](_0xa7d9('0xa'),_0x3ebd17,_0x33823d[_0xa7d9('0xb')],_0x35bce1));}function handleFindAgent(_0x2ddd0f){return function(_0x2be573){return _0x2be573[_0xa7d9('0xb')][_0xa7d9('0xc')]()===_0x2ddd0f['toLowerCase']();};}exports[_0xa7d9('0xd')]=function(_0x1c83de,_0xef00a0,_0x3452e4,_0x365718){return function(_0x309ee0){try{var _0x3796a7={'name':_0xef00a0[0x0],'timeout':_0xef00a0[0x1]};var _0x3594a2=queue[_0xa7d9('0x0')](_0x3796a7,{'typecast':!![]});if(_0x3594a2[_0xa7d9('0xe')]){logger[_0xa7d9('0xf')](_0xa7d9('0x10'),_0x1c83de,_[_0xa7d9('0x11')](_0x3594a2,_0xa7d9('0x12'))[_0xa7d9('0x13')](',\x20'));_0x309ee0[_0xa7d9('0x14')]();}else{var _0x337fe4=_[_0xa7d9('0x15')](_0x3452e4[_0xa7d9('0x16')],handleFindAgent(_0x3796a7[_0xa7d9('0xb')]));if(_0x337fe4){var _0x10dcb2=(_0x3796a7['timeout']||0xa)*0x3e8;var _0x50840d,_0x25e54f;var _0xd8c0e6=seqqueue[_0xa7d9('0x17')](_0x10dcb2);_0xd8c0e6['id']=_0x1c83de;_0xd8c0e6[_0xa7d9('0x18')]=_0x10dcb2;_0xd8c0e6['channel']=_0x365718[_0xa7d9('0x19')];writeLog(_0x1c83de,_0x337fe4,util[_0xa7d9('0x9')](_0xa7d9('0x1a'),_0x10dcb2));_0x3452e4[_0xa7d9('0x1b')][_0x1c83de]['on'](_0xa7d9('0x1c'),function(){logger[_0xa7d9('0x8')](_0xa7d9('0x1d'),_0x1c83de);clearTimeout(_0x25e54f);_0x25e54f=undefined;_0xd8c0e6[_0xa7d9('0x1e')]();if(_0x3452e4['rules'][_0x1c83de]){delete _0x3452e4[_0xa7d9('0x1b')][_0x1c83de];}_0x309ee0[_0xa7d9('0x14')]();});_0x3452e4[_0xa7d9('0x1b')][_0x1c83de]['on'](_0xa7d9('0x1f'),function(){if(_0x3452e4[_0xa7d9('0x1b')][_0x1c83de]){delete _0x3452e4['rules'][_0x1c83de];}});_0x25e54f=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x1c83de);clearTimeout(_0x25e54f);_0xd8c0e6[_0xa7d9('0x1e')]();_0x309ee0[_0xa7d9('0x20')]();},_0x10dcb2);strategy['agent'](_0xd8c0e6,_0x337fe4,_0x3452e4,_0x365718);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x1c83de,_0x3796a7['name']);_0x309ee0[_0xa7d9('0x14')]();}}}catch(_0x287e77){console['log'](_0x287e77);logger[_0xa7d9('0xf')](_0xa7d9('0x21'),_0x1c83de,_0x287e77[_0xa7d9('0x22')]);_0x309ee0[_0xa7d9('0x14')]();}};}; \ 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 180dc2e..d59e1db 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 _0x5c5f=['../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','Message','create','then','catch','error','finally','stop','LexRuntime','$LATEST','toString','message','amazonlex','providerResponse','dialogState','Failed','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x36089c,_0xe50bb){var _0x6ef4ce=function(_0x4052c5){while(--_0x4052c5){_0x36089c['push'](_0x36089c['shift']());}};_0x6ef4ce(++_0xe50bb);}(_0x5c5f,0x112));var _0xf5c5=function(_0xf67a65,_0x4f9b5f){_0xf67a65=_0xf67a65-0x0;var _0x160786=_0x5c5f[_0xf67a65];return _0x160786;};'use strict';var _=require('lodash');var moment=require(_0xf5c5('0x0'));var AWS=require(_0xf5c5('0x1'));var utils=require(_0xf5c5('0x2'));var logger=require('../../../../config/logger')(_0xf5c5('0x3'));var rpc={'chatMessage':require(_0xf5c5('0x4')),'openchannelMessage':require(_0xf5c5('0x5')),'mailMessage':require(_0xf5c5('0x6')),'smsMessage':require(_0xf5c5('0x7')),'faxMessage':require(_0xf5c5('0x8')),'whatsappMessage':require(_0xf5c5('0x9'))};exports[_0xf5c5('0xa')]=function(_0x7b5bef,_0x28624c){return function(_0xcbe637){try{if(!_[_0xf5c5('0xb')](this[_0xf5c5('0xc')]['UserId'])){logger[_0xf5c5('0xd')](_0xf5c5('0xe'),_0x7b5bef,_0xf5c5('0xf'));return _0xcbe637[_0xf5c5('0x10')]();}var _0x53a937={'ContactId':this[_0xf5c5('0x11')]['id'],'sentAt':moment()[_0xf5c5('0x12')](_0xf5c5('0x13')),'direction':_0xf5c5('0x14')};if(this[_0xf5c5('0x15')]===_0xf5c5('0x16')||this['channel']==='whatsapp'){_0x53a937[_0xf5c5('0x17')]=this[_0xf5c5('0xc')][_0xf5c5('0x17')];}var _0x4e3b87=this[_0xf5c5('0x15')];if(_0x4e3b87===_0xf5c5('0x18')){_0x53a937['ChatWebsiteId']=this[_0xf5c5('0x19')]['id'];}else{_0x53a937[_[_0xf5c5('0x1a')](_0x4e3b87)+_0xf5c5('0x1b')]=this[_0xf5c5('0x19')]['id'];}_0x53a937[_[_0xf5c5('0x1a')](_0x4e3b87)+_0xf5c5('0x1c')]=this[_0xf5c5('0xc')]['id'];if(this['interaction']['created']){var _0x31802c=_0x28624c[0x4];if(!_[_0xf5c5('0x1d')](_0x31802c)){_0x53a937[_0xf5c5('0x1e')]=utils[_0xf5c5('0x1f')](_0x31802c,this);return rpc[_0x4e3b87+_0xf5c5('0x20')][_0xf5c5('0x21')](_0x53a937)[_0xf5c5('0x22')](function(_0x44967c){logger[_0xf5c5('0xd')](_0xf5c5('0xe'),_0x7b5bef,_0x53a937[_0xf5c5('0x1e')]);})[_0xf5c5('0x23')](function(_0x1a16bc){logger[_0xf5c5('0x24')](_0xf5c5('0xe'),_0x7b5bef,JSON['stringify'](_0x1a16bc));})[_0xf5c5('0x25')](function(){logger[_0xf5c5('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x7b5bef);_0xcbe637[_0xf5c5('0x26')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x7b5bef);_0xcbe637[_0xf5c5('0x26')]();}}else{var _0x2d5357=this;var _0x28368f=new AWS[(_0xf5c5('0x27'))]({'accessKeyId':_0x28624c[0x0],'secretAccessKey':_0x28624c[0x1],'region':_0x28624c[0x2]});var _0x5988f6={'botAlias':_0xf5c5('0x28'),'botName':_0x28624c[0x3],'inputText':this['message'][_0xf5c5('0x1e')],'userId':this[_0xf5c5('0x15')]+':'+this[_0xf5c5('0xc')]['id'][_0xf5c5('0x29')]()};_0x28368f['postText'](_0x5988f6,function(_0x435b8a,_0x686132){if(_0x435b8a){logger[_0xf5c5('0x24')]('[%s][AMAZONLEX]\x20%s',_0x7b5bef,_0x435b8a[_0xf5c5('0x2a')]);_0xcbe637[_0xf5c5('0x10')]();}else if(_0x686132&&_0x686132[_0xf5c5('0x2a')]){_0x2d5357[_0xf5c5('0x1e')][_0xf5c5('0x2b')]=_0x686132;_0x53a937[_0xf5c5('0x1e')]=_0x686132[_0xf5c5('0x2a')];_0x53a937['providerName']=_0xf5c5('0x2b');_0x53a937[_0xf5c5('0x2c')]=JSON['stringify'](_0x686132);return rpc[_0x4e3b87+_0xf5c5('0x20')][_0xf5c5('0x21')](_0x53a937)[_0xf5c5('0x22')](function(_0x43f656){logger[_0xf5c5('0xd')](_0xf5c5('0xe'),_0x7b5bef,_0x53a937['body']);if(_0x686132[_0xf5c5('0x2d')]==_0xf5c5('0x2e')){_0xcbe637[_0xf5c5('0x10')]();}else{_0xcbe637[_0xf5c5('0x26')]();}})[_0xf5c5('0x23')](function(_0x3cfbdc){logger[_0xf5c5('0x24')](_0xf5c5('0xe'),_0x7b5bef,JSON['stringify'](_0x3cfbdc));_0xcbe637['next']();});}else{_0xcbe637[_0xf5c5('0x10')]();}});}}catch(_0x1fabc2){logger[_0xf5c5('0x24')]('[%s][AMAZONLEX]\x20%s',_0x7b5bef,JSON['stringify'](_0x1fabc2));_0xcbe637[_0xf5c5('0x26')]();}};}; \ No newline at end of file +var _0x47c2=['getMustacheRender','Message','create','catch','error','[%s][AMAZONLEX]\x20%s','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','postText','amazonlex','providerName','stringify','dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','account','upperFirst','AccountId','InteractionId','isEmpty','body'];(function(_0x4ba22d,_0x2523cd){var _0x578896=function(_0x56e477){while(--_0x56e477){_0x4ba22d['push'](_0x4ba22d['shift']());}};_0x578896(++_0x2523cd);}(_0x47c2,0xf4));var _0x247c=function(_0x56ed09,_0x47abc8){_0x56ed09=_0x56ed09-0x0;var _0x1d5fae=_0x47c2[_0x56ed09];return _0x1d5fae;};'use strict';var _=require(_0x247c('0x0'));var moment=require(_0x247c('0x1'));var AWS=require(_0x247c('0x2'));var utils=require(_0x247c('0x3'));var logger=require('../../../../config/logger')(_0x247c('0x4'));var rpc={'chatMessage':require(_0x247c('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x247c('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x247c('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x247c('0x8')]=function(_0x3878c2,_0x35505e){return function(_0x386e87){try{if(!_['isNil'](this[_0x247c('0x9')]['UserId'])){logger[_0x247c('0xa')]('[%s][AMAZONLEX]\x20%s',_0x3878c2,_0x247c('0xb'));return _0x386e87[_0x247c('0xc')]();}var _0x40fed6={'ContactId':this[_0x247c('0xd')]['id'],'sentAt':moment()[_0x247c('0xe')](_0x247c('0xf')),'direction':_0x247c('0x10')};if(this[_0x247c('0x11')]===_0x247c('0x12')||this[_0x247c('0x11')]===_0x247c('0x13')){_0x40fed6['phone']=this['interaction']['phone'];}var _0x27f352=this['channel'];if(_0x27f352==='chat'){_0x40fed6['ChatWebsiteId']=this[_0x247c('0x14')]['id'];}else{_0x40fed6[_[_0x247c('0x15')](_0x27f352)+_0x247c('0x16')]=this[_0x247c('0x14')]['id'];}_0x40fed6[_['upperFirst'](_0x27f352)+_0x247c('0x17')]=this[_0x247c('0x9')]['id'];if(this[_0x247c('0x9')]['created']){var _0x215fd8=_0x35505e[0x4];if(!_[_0x247c('0x18')](_0x215fd8)){_0x40fed6[_0x247c('0x19')]=utils[_0x247c('0x1a')](_0x215fd8,this);return rpc[_0x27f352+_0x247c('0x1b')][_0x247c('0x1c')](_0x40fed6)['then'](function(_0x21a33d){logger[_0x247c('0xa')]('[%s][AMAZONLEX]\x20%s',_0x3878c2,_0x40fed6['body']);})[_0x247c('0x1d')](function(_0x5b642a){logger[_0x247c('0x1e')](_0x247c('0x1f'),_0x3878c2,JSON['stringify'](_0x5b642a));})[_0x247c('0x20')](function(){logger[_0x247c('0xa')](_0x247c('0x21'),_0x3878c2);_0x386e87[_0x247c('0x22')]();});}else{logger['info'](_0x247c('0x23'),_0x3878c2);_0x386e87[_0x247c('0x22')]();}}else{var _0x462447=this;var _0x1b50c7=new AWS[(_0x247c('0x24'))]({'accessKeyId':_0x35505e[0x0],'secretAccessKey':_0x35505e[0x1],'region':_0x35505e[0x2]});var _0x3a3bed={'botAlias':'$LATEST','botName':_0x35505e[0x3],'inputText':this[_0x247c('0x25')][_0x247c('0x19')],'userId':this[_0x247c('0x11')]+':'+this[_0x247c('0x9')]['id'][_0x247c('0x26')]()};_0x1b50c7[_0x247c('0x27')](_0x3a3bed,function(_0x3950d9,_0x1bbfb3){if(_0x3950d9){logger[_0x247c('0x1e')](_0x247c('0x1f'),_0x3878c2,_0x3950d9[_0x247c('0x25')]);_0x386e87[_0x247c('0xc')]();}else if(_0x1bbfb3&&_0x1bbfb3['message']){_0x462447['body'][_0x247c('0x28')]=_0x1bbfb3;_0x40fed6[_0x247c('0x19')]=_0x1bbfb3[_0x247c('0x25')];_0x40fed6[_0x247c('0x29')]=_0x247c('0x28');_0x40fed6['providerResponse']=JSON[_0x247c('0x2a')](_0x1bbfb3);return rpc[_0x27f352+_0x247c('0x1b')][_0x247c('0x1c')](_0x40fed6)['then'](function(_0x197fa4){logger[_0x247c('0xa')](_0x247c('0x1f'),_0x3878c2,_0x40fed6[_0x247c('0x19')]);if(_0x1bbfb3[_0x247c('0x2b')]==_0x247c('0x2c')){_0x386e87[_0x247c('0xc')]();}else{_0x386e87[_0x247c('0x22')]();}})[_0x247c('0x1d')](function(_0x1ba911){logger[_0x247c('0x1e')](_0x247c('0x1f'),_0x3878c2,JSON[_0x247c('0x2a')](_0x1ba911));_0x386e87[_0x247c('0xc')]();});}else{_0x386e87[_0x247c('0xc')]();}});}}catch(_0x581cac){logger[_0x247c('0x1e')](_0x247c('0x1f'),_0x3878c2,JSON['stringify'](_0x581cac));_0x386e87['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 8bc36ad..ec3097f 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 _0x7232=['InteractionId','Message','Smtp','service','account','host','port','secure','authentication','auth','user','pass','inReplyTo','messageId','html','replace',''+_[_0x2723('0x32')](_0x4c9fe5[_0x2723('0x17')],_0x2723('0x33'),_0x2723('0x34'))+'';_0x4c9fe5[_0x2723('0x35')]={'Auto-Submitted':_0x2723('0x36'),'X-Auto-Response-Suppress':_0x2723('0x37'),'Precedence':_0x2723('0x38')};return mailRpc[_0x2723('0x39')](_0x400e3f,_0x4c9fe5)[_0x2723('0x3a')](function(_0x4cc140){logger['info'](_0x2723('0x3b'),_0x25a184);_0x4c9fe5[_0x2723('0x30')]=_0x4cc140[_0x2723('0x19')][_0x2723('0x30')];return rpc[_0x340f0e+_0x2723('0x24')][_0x2723('0x3c')](_0x4c9fe5);})['then'](function(_0x373bd7){logger['info'](_0x2723('0xc'),_0x25a184,JSON[_0x2723('0x3d')](_0x373bd7));})[_0x2723('0x3e')](function(_0x580515){logger[_0x2723('0x3f')]('[RPC][%s][AUTOREPLY]\x20%s',_0x25a184,JSON[_0x2723('0x3d')](_0x580515));})[_0x2723('0x40')](function(){Promise['resolve']()[_0x2723('0x3a')](function(){if(_0x4b8075[0x0]!=='2'||_0x9d56ac[_0x2723('0x41')])return;return rpc[_0x340f0e+_0x2723('0x42')][_0x2723('0x43')](_0x9d56ac['id'],{'autoreplyExecuted':!![]})[_0x2723('0x3a')](function(_0xe39cc6){logger[_0x2723('0xb')](_0x2723('0x13'),_0x25a184,JSON['stringify'](_0xe39cc6));})[_0x2723('0x3e')](function(_0x13fc1){logger[_0x2723('0x3f')](_0x2723('0x44'),_0x25a184,JSON['stringify'](_0x13fc1));});})[_0x2723('0x3a')](function(){_0x465e3c[_0x2723('0xe')]();});});}else{return rpc[this[_0x2723('0xa')]+_0x2723('0x24')][_0x2723('0x3c')](_0x4c9fe5)[_0x2723('0x3a')](function(_0x26a420){logger['info'](_0x2723('0xc'),_0x25a184,_0x4c9fe5[_0x2723('0x17')]);})[_0x2723('0x3e')](function(_0x42d5ec){logger[_0x2723('0x3f')](_0x2723('0xc'),_0x25a184,JSON[_0x2723('0x3d')](_0x42d5ec));})[_0x2723('0x40')](function(){Promise['resolve']()[_0x2723('0x3a')](function(){if(_0x4b8075[0x0]!=='2'||_0x9d56ac[_0x2723('0x41')])return;return rpc[_0x340f0e+_0x2723('0x42')]['update'](_0x9d56ac['id'],{'autoreplyExecuted':!![]})['then'](function(_0x344750){logger['info'](_0x2723('0x13'),_0x25a184,JSON[_0x2723('0x3d')](_0x344750));})['catch'](function(_0x43854e){logger[_0x2723('0x3f')](_0x2723('0x44'),_0x25a184,JSON[_0x2723('0x3d')](_0x43854e));});})['then'](function(){_0x465e3c[_0x2723('0xe')]();});});}}}catch(_0x516f5d){logger['error']('[%s][AUTOREPLY]\x20%s',_0x25a184,JSON[_0x2723('0x3d')](_0x516f5d));_0x465e3c[_0x2723('0x45')]();}};}; \ No newline at end of file +var _0x40bf=['resolve','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','channel','body','info','[%s][AUTOREPLY]\x20%s','next','interaction','created','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','mail','message','from','phone','read','subject','startsWith','Re:','chat','account','upperFirst','Smtp','service','host','port','secure','authentication','auth','user','pass','','replace','','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','Message','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally'];(function(_0x1a6dcf,_0x703fa2){var _0x3480a3=function(_0x2e63de){while(--_0x2e63de){_0x1a6dcf['push'](_0x1a6dcf['shift']());}};_0x3480a3(++_0x703fa2);}(_0x40bf,0x1d3));var _0xf40b=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0x40bf[_0x30b0d8];return _0x459c09;};'use strict';var _=require(_0xf40b('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0xf40b('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xf40b('0x2')),'mailMessage':require(_0xf40b('0x3')),'smsMessage':require(_0xf40b('0x4')),'faxMessage':require(_0xf40b('0x5')),'whatsappMessage':require(_0xf40b('0x6')),'chatInteraction':require(_0xf40b('0x7')),'openchannelInteraction':require(_0xf40b('0x8')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0xf40b('0x9')),'faxInteraction':require(_0xf40b('0xa')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports[_0xf40b('0xb')]=function(_0x4470b6,_0x1081bc,_0x2d5144,_0x462901){return function(_0x4d1199){try{var _0x558427=this[_0xf40b('0xc')];if(_0x558427==='mail'&&_0x462901[_0xf40b('0xd')]['isAutoreply']){logger[_0xf40b('0xe')](_0xf40b('0xf'),_0x4470b6,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x4d1199[_0xf40b('0x10')]();}if(_0x1081bc[0x0]==='1'&&(_['isNil'](this[_0xf40b('0x11')][_0xf40b('0x12')])||!this[_0xf40b('0x11')]['created'])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x4470b6,'Autoreply\x20already\x20sent');return _0x4d1199[_0xf40b('0x10')]();}if(_0x1081bc[0x0]==='2'&&this[_0xf40b('0x11')][_0xf40b('0x13')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4470b6,_0xf40b('0x14'));return _0x4d1199[_0xf40b('0x10')]();}var _0x577936={'ContactId':this[_0xf40b('0x15')]['id'],'sentAt':moment()['format'](_0xf40b('0x16')),'direction':_0xf40b('0x17')};if(this['channel']===_0xf40b('0x18')){_0x577936[_0xf40b('0xd')]=utils['getMustacheRender'](_0x1081bc[0x2],this);}else{_0x577936[_0xf40b('0xd')]=utils['getMustacheRender'](_0x1081bc[0x1],this);}if(this[_0xf40b('0x19')]){_0x577936['to']=this['message'][_0xf40b('0x1a')]||'';if(this[_0xf40b('0xc')]==='mail'&&_0x1081bc[0x1]==='1'){_0x577936['cc']=this['message']['cc']||'';}_0x577936['from']=this[_0xf40b('0x19')]['to']||'';_0x577936[_0xf40b('0x1b')]=this[_0xf40b('0x19')][_0xf40b('0x1b')]||'';_0x577936[_0xf40b('0x1c')]=!![];if(this['message'][_0xf40b('0x1d')]){_0x577936[_0xf40b('0x1d')]='';_0x577936[_0xf40b('0x1d')]+=_[_0xf40b('0x1e')](this[_0xf40b('0x19')][_0xf40b('0x1d')],_0xf40b('0x1f'))?'':'Re:\x20';_0x577936[_0xf40b('0x1d')]+=this[_0xf40b('0x19')]['subject'];}}if(this[_0xf40b('0xc')]===_0xf40b('0x20')){_0x577936['ChatWebsiteId']=this[_0xf40b('0x21')]['id'];}else{_0x577936[_[_0xf40b('0x22')](this['channel'])+'AccountId']=this[_0xf40b('0x21')]['id'];}_0x577936[_[_0xf40b('0x22')](this[_0xf40b('0xc')])+'InteractionId']=this[_0xf40b('0x11')]['id'];var _0x4401e2=this['interaction'];if(rpc[this[_0xf40b('0xc')]+'Message']){if(this[_0xf40b('0xc')]===_0xf40b('0x18')){var _0xb6b028={'tls':{'rejectUnauthorized':![]}};if(this[_0xf40b('0x21')][_0xf40b('0x23')]['service']){_0xb6b028[_0xf40b('0x24')]=this[_0xf40b('0x21')][_0xf40b('0x23')][_0xf40b('0x24')];}else{_0xb6b028['host']=this['account'][_0xf40b('0x23')][_0xf40b('0x25')];_0xb6b028[_0xf40b('0x26')]=this[_0xf40b('0x21')][_0xf40b('0x23')]['port'];_0xb6b028[_0xf40b('0x27')]=this[_0xf40b('0x21')][_0xf40b('0x23')][_0xf40b('0x27')];}if(this['account']['Smtp'][_0xf40b('0x28')]){_0xb6b028[_0xf40b('0x29')]={'user':this[_0xf40b('0x21')][_0xf40b('0x23')][_0xf40b('0x2a')],'pass':this[_0xf40b('0x21')]['Smtp'][_0xf40b('0x2b')]};}_0x577936['inReplyTo']=this['message']['messageId'];_0x577936['html']=_0xf40b('0x2c')+_[_0xf40b('0x2d')](_0x577936[_0xf40b('0xd')],_0xf40b('0x2e'),']+(>|$)/g,''),'priorityTrue':_0x89eb29[0x1],'priorityFalse':_0x89eb29[0x2]};var _0xd00b=gotoif['validate'](_0x30afde,{'typecast':!![]});if(_0xd00b[_0x559d('0x8')]){logger[_0x559d('0x9')](_0x559d('0xa'),_0x8f4a84,_[_0x559d('0xb')](_0xd00b,_0x559d('0xc'))[_0x559d('0xd')](',\x20'));_0x5c57ec[_0x559d('0xe')]();}else{try{var _0x180b11=eval('('+_0x30afde[_0x559d('0xf')]+')');var _0x2f3e07=_0x180b11?_0x30afde['priorityTrue']:_0x30afde[_0x559d('0x10')];logger['info'](_0x559d('0x11'),_0x8f4a84,_0x30afde[_0x559d('0xf')],_0x180b11,_0x2f3e07||_0x559d('0x12'));if(_0x2f3e07){var _0xf85a16=_[_0x559d('0x13')](_0x5c57ec['rules'](),{'p':_0x2f3e07});if(_0xf85a16>=0x0){logger['info'](_0x559d('0x14'),_0x8f4a84,_0x2f3e07||_0x559d('0x12'),_0xf85a16);_0x5c57ec['next'](_0xf85a16);}else{logger[_0x559d('0x15')](_0x559d('0x16'),_0x8f4a84,_0x2f3e07||_0x559d('0x12'));_0x5c57ec['stop']();}}else{_0x5c57ec[_0x559d('0x12')]();}}catch(_0x4b5699){logger[_0x559d('0x9')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x8f4a84,_0x4b5699['message']);_0x5c57ec['stop']();}}}catch(_0x4f7235){logger[_0x559d('0x9')](_0x559d('0xa'),_0x8f4a84,JSON[_0x559d('0x17')](_0x4f7235));_0x5c57ec['stop']();}};}; \ No newline at end of file +var _0xaf4b=['[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20%s','stringify','validate','lodash','./utils','../../../../config/logger','routing','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','length','error','message','join','stop','condition','priorityFalse','info'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0xaf4b,0x8a));var _0xbaf4=function(_0x32e294,_0x26568e){_0x32e294=_0x32e294-0x0;var _0x58fd55=_0xaf4b[_0x32e294];return _0x58fd55;};'use strict';var schema=require(_0xbaf4('0x0'));var _=require(_0xbaf4('0x1'));var htmlToText=require('html-to-text');var utils=require(_0xbaf4('0x2'));var logger=require(_0xbaf4('0x3'))(_0xbaf4('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xbaf4('0x5'),'message':_0xbaf4('0x6')},'priorityFalse':{'type':_0xbaf4('0x5'),'message':_0xbaf4('0x7')}});exports['consequence']=function(_0x18d329,_0xdf5438){return function(_0x201d26){try{var _0x7e5982={'condition':htmlToText[_0xbaf4('0x8')](utils[_0xbaf4('0x9')](_0xdf5438[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xdf5438[0x1],'priorityFalse':_0xdf5438[0x2]};var _0x2cb193=gotoif[_0xbaf4('0x0')](_0x7e5982,{'typecast':!![]});if(_0x2cb193[_0xbaf4('0xa')]){logger[_0xbaf4('0xb')]('[%s][GOTOIF]\x20%s',_0x18d329,_['map'](_0x2cb193,_0xbaf4('0xc'))[_0xbaf4('0xd')](',\x20'));_0x201d26[_0xbaf4('0xe')]();}else{try{var _0x45a719=eval('('+_0x7e5982[_0xbaf4('0xf')]+')');var _0x43eba5=_0x45a719?_0x7e5982['priorityTrue']:_0x7e5982[_0xbaf4('0x10')];logger[_0xbaf4('0x11')](_0xbaf4('0x12'),_0x18d329,_0x7e5982[_0xbaf4('0xf')],_0x45a719,_0x43eba5||_0xbaf4('0x13'));if(_0x43eba5){var _0x44eb48=_[_0xbaf4('0x14')](_0x201d26[_0xbaf4('0x15')](),{'p':_0x43eba5});if(_0x44eb48>=0x0){logger[_0xbaf4('0x11')](_0xbaf4('0x16'),_0x18d329,_0x43eba5||_0xbaf4('0x13'),_0x44eb48);_0x201d26['next'](_0x44eb48);}else{logger[_0xbaf4('0x11')](_0xbaf4('0x17'),_0x18d329,_0x43eba5||_0xbaf4('0x13'));_0x201d26['stop']();}}else{_0x201d26[_0xbaf4('0x13')]();}}catch(_0x5723b4){logger[_0xbaf4('0xb')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x18d329,_0x5723b4[_0xbaf4('0xc')]);_0x201d26['stop']();}}}catch(_0x1a93db){logger[_0xbaf4('0xb')](_0xbaf4('0x18'),_0x18d329,JSON[_0xbaf4('0x19')](_0x1a93db));_0x201d26[_0xbaf4('0xe')]();}};}; \ 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 38c9196..fccc8c3 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 _0x5008=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x5008,0x7b));var _0x8500=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x5008[_0x247fa1];return _0x244f35;};'use strict';var schema=require(_0x8500('0x0'));var _=require(_0x8500('0x1'));var logger=require(_0x8500('0x2'))('routing');var gotop=schema({'priority':{'type':_0x8500('0x3'),'required':!![],'message':_0x8500('0x4')}});exports[_0x8500('0x5')]=function(_0x27c011,_0x3feb6b){return function(_0x5ecd3c){try{var _0xb495f5={'priority':_0x3feb6b[0x0]};var _0x5e7ed5=gotop[_0x8500('0x0')](_0xb495f5,{'typecast':!![]});if(_0x5e7ed5[_0x8500('0x6')]){logger[_0x8500('0x7')](_0x8500('0x8'),_0x27c011,_[_0x8500('0x9')](_0x5e7ed5,_0x8500('0xa'))['join'](',\x20'));_0x5ecd3c['stop']();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x27c011,_0xb495f5[_0x8500('0xb')]);if(_0xb495f5[_0x8500('0xb')]){var _0x5594b6=_[_0x8500('0xc')](_0x5ecd3c['rules'](),{'p':_0xb495f5[_0x8500('0xb')]});if(_0x5594b6>=0x0){logger['info'](_0x8500('0xd'),_0x27c011,_0xb495f5[_0x8500('0xb')]||'next',_0x5594b6);_0x5ecd3c[_0x8500('0xe')](_0x5594b6);}else{logger[_0x8500('0xf')](_0x8500('0x10'),_0x27c011,_0xb495f5[_0x8500('0xb')]||_0x8500('0xe'));_0x5ecd3c['stop']();}}else{_0x5ecd3c[_0x8500('0xe')]();}}}catch(_0x180d4){logger[_0x8500('0x7')](_0x8500('0x8'),_0x27c011,JSON[_0x8500('0x11')](_0x180d4));_0x5ecd3c['stop']();}};}; \ No newline at end of file +var _0x42d2=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','../../../../config/logger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x42d2,0x173));var _0x242d=function(_0x21c6b8,_0x16d6f6){_0x21c6b8=_0x21c6b8-0x0;var _0x39d474=_0x42d2[_0x21c6b8];return _0x39d474;};'use strict';var schema=require(_0x242d('0x0'));var _=require(_0x242d('0x1'));var logger=require(_0x242d('0x2'))('routing');var gotop=schema({'priority':{'type':_0x242d('0x3'),'required':!![],'message':_0x242d('0x4')}});exports[_0x242d('0x5')]=function(_0x37f471,_0x337890){return function(_0x2906d1){try{var _0x316ea1={'priority':_0x337890[0x0]};var _0x4f3f6a=gotop[_0x242d('0x0')](_0x316ea1,{'typecast':!![]});if(_0x4f3f6a[_0x242d('0x6')]){logger['error'](_0x242d('0x7'),_0x37f471,_[_0x242d('0x8')](_0x4f3f6a,_0x242d('0x9'))[_0x242d('0xa')](',\x20'));_0x2906d1[_0x242d('0xb')]();}else{logger[_0x242d('0xc')](_0x242d('0xd'),_0x37f471,_0x316ea1[_0x242d('0xe')]);if(_0x316ea1[_0x242d('0xe')]){var _0x38b61b=_[_0x242d('0xf')](_0x2906d1[_0x242d('0x10')](),{'p':_0x316ea1['priority']});if(_0x38b61b>=0x0){logger[_0x242d('0xc')](_0x242d('0x11'),_0x37f471,_0x316ea1[_0x242d('0xe')]||_0x242d('0x12'),_0x38b61b);_0x2906d1[_0x242d('0x12')](_0x38b61b);}else{logger[_0x242d('0xc')](_0x242d('0x13'),_0x37f471,_0x316ea1[_0x242d('0xe')]||_0x242d('0x12'));_0x2906d1[_0x242d('0xb')]();}}else{_0x2906d1[_0x242d('0x12')]();}}}catch(_0x33605f){logger[_0x242d('0x14')]('[%s][GOTOP]\x20%s',_0x37f471,JSON[_0x242d('0x15')](_0x33605f));_0x2906d1[_0x242d('0xb')]();}};}; \ 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 8b760b0..9def481 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 _0x983c=['consequence','getMustacheRender','contact','channel','AccountId','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x522c6d,_0x4d250d){var _0x26300d=function(_0x3ab228){while(--_0x3ab228){_0x522c6d['push'](_0x522c6d['shift']());}};_0x26300d(++_0x4d250d);}(_0x983c,0xf3));var _0xc983=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0x983c[_0x27d8bc];return _0x4b04cb;};'use strict';var _=require(_0xc983('0x0'));var utils=require(_0xc983('0x1'));var logger=require(_0xc983('0x2'))(_0xc983('0x3'));var rpc={'chatMessage':require(_0xc983('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc983('0x5')),'smsMessage':require(_0xc983('0x6')),'faxMessage':require(_0xc983('0x7')),'whatsappMessage':require(_0xc983('0x8'))};exports[_0xc983('0x9')]=function(_0x290ca8,_0x3897b9){return function(_0x541e6f){try{var _0x346933={'body':utils[_0xc983('0xa')](_0x3897b9[0x0],this),'ContactId':this[_0xc983('0xb')]['id']};if(this[_0xc983('0xc')]==='chat'){_0x346933['ChatWebsiteId']=this['account']['id'];}else{_0x346933[_['upperFirst'](this[_0xc983('0xc')])+_0xc983('0xd')]=this[_0xc983('0xe')]['id'];}_0x346933[_[_0xc983('0xf')](this[_0xc983('0xc')])+_0xc983('0x10')]=this[_0xc983('0x11')]['id'];if(rpc[this[_0xc983('0xc')]+_0xc983('0x12')]){return rpc[this['channel']+_0xc983('0x12')][_0xc983('0x13')](_0x346933)[_0xc983('0x14')](function(_0x1b4dd2){logger[_0xc983('0x15')](_0xc983('0x16'),_0x290ca8,_0x346933['body']);_0x541e6f[_0xc983('0x17')]();})[_0xc983('0x18')](function(_0x1e4763){logger[_0xc983('0x19')](_0xc983('0x16'),_0x290ca8,JSON[_0xc983('0x1a')](_0x1e4763));_0x541e6f['stop']();});}}catch(_0x18d7f5){logger[_0xc983('0x19')](_0xc983('0x16'),_0x290ca8,JSON[_0xc983('0x1a')](_0x18d7f5));_0x541e6f[_0xc983('0x1b')]();}};}; \ No newline at end of file +var _0xa6ea=['stop','error','lodash','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','stringify'];(function(_0x130105,_0x255d1a){var _0x4ff166=function(_0x1a8582){while(--_0x1a8582){_0x130105['push'](_0x130105['shift']());}};_0x4ff166(++_0x255d1a);}(_0xa6ea,0x1ce));var _0xaa6e=function(_0x411498,_0x459dca){_0x411498=_0x411498-0x0;var _0x252213=_0xa6ea[_0x411498];return _0x252213;};'use strict';var _=require(_0xaa6e('0x0'));var utils=require('./utils');var logger=require(_0xaa6e('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xaa6e('0x2')),'mailMessage':require(_0xaa6e('0x3')),'smsMessage':require(_0xaa6e('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xaa6e('0x5'))};exports[_0xaa6e('0x6')]=function(_0x56a9e9,_0x19f1f1){return function(_0x4a4697){try{var _0x2222d8={'body':utils[_0xaa6e('0x7')](_0x19f1f1[0x0],this),'ContactId':this['contact']['id']};if(this[_0xaa6e('0x8')]===_0xaa6e('0x9')){_0x2222d8['ChatWebsiteId']=this[_0xaa6e('0xa')]['id'];}else{_0x2222d8[_[_0xaa6e('0xb')](this[_0xaa6e('0x8')])+'AccountId']=this['account']['id'];}_0x2222d8[_[_0xaa6e('0xb')](this[_0xaa6e('0x8')])+_0xaa6e('0xc')]=this[_0xaa6e('0xd')]['id'];if(rpc[this[_0xaa6e('0x8')]+_0xaa6e('0xe')]){return rpc[this[_0xaa6e('0x8')]+_0xaa6e('0xe')][_0xaa6e('0xf')](_0x2222d8)[_0xaa6e('0x10')](function(_0x2b6467){logger[_0xaa6e('0x11')](_0xaa6e('0x12'),_0x56a9e9,_0x2222d8['body']);_0x4a4697[_0xaa6e('0x13')]();})['catch'](function(_0x373858){logger['error'](_0xaa6e('0x12'),_0x56a9e9,JSON[_0xaa6e('0x14')](_0x373858));_0x4a4697[_0xaa6e('0x15')]();});}}catch(_0xc76ed4){logger[_0xaa6e('0x16')](_0xaa6e('0x12'),_0x56a9e9,JSON['stringify'](_0xc76ed4));_0x4a4697['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 0cb8dd7..f890585 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 _0x681d=['stop','../../../../config/logger','routing','consequence','info','next','error','stringify'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0x681d,0xf9));var _0xd681=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x681d[_0x2fc012];return _0x2891f9;};'use strict';var utils=require('./utils');var logger=require(_0xd681('0x0'))(_0xd681('0x1'));exports[_0xd681('0x2')]=function(_0x31d73a,_0x48ebf3){return function(_0x36001d){try{logger[_0xd681('0x3')]('[%s][NOOP]\x20%s',_0x31d73a,utils['getMustacheRender'](_0x48ebf3[0x0],this));_0x36001d[_0xd681('0x4')]();}catch(_0x218bd1){logger[_0xd681('0x5')]('[%s][NOOP]\x20%s',_0x31d73a,JSON[_0xd681('0x6')](_0x218bd1));_0x36001d[_0xd681('0x7')]();}};}; \ No newline at end of file +var _0x967d=['getMustacheRender','error','stop','./utils','../../../../config/logger','[%s][NOOP]\x20%s'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x967d,0x81));var _0xd967=function(_0x455776,_0x517f60){_0x455776=_0x455776-0x0;var _0x21c0fc=_0x967d[_0x455776];return _0x21c0fc;};'use strict';var utils=require(_0xd967('0x0'));var logger=require(_0xd967('0x1'))('routing');exports['consequence']=function(_0x3a6afa,_0x3c71fb){return function(_0x42e1cf){try{logger['info'](_0xd967('0x2'),_0x3a6afa,utils[_0xd967('0x3')](_0x3c71fb[0x0],this));_0x42e1cf['next']();}catch(_0xc2f820){logger[_0xd967('0x4')](_0xd967('0x2'),_0x3a6afa,JSON['stringify'](_0xc2f820));_0x42e1cf[_0xd967('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 7102ecc..2a9c686 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 _0x63da=['close','strategy','rrmemory','beepall','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','localhost','socket.io-emitter','from','emit','clone','queue_id','queue','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','error','update\x20queue\x20report','toLowerCase','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END'];(function(_0x2a530f,_0x20a9f2){var _0xdeb772=function(_0xe348ac){while(--_0xe348ac){_0x2a530f['push'](_0x2a530f['shift']());}};_0xdeb772(++_0x20a9f2);}(_0x63da,0x147));var _0xa63d=function(_0x6cf3b6,_0x4b7560){_0x6cf3b6=_0x6cf3b6-0x0;var _0xdbe948=_0x63da[_0x6cf3b6];return _0xdbe948;};'use strict';var schema=require(_0xa63d('0x0'));var _=require(_0xa63d('0x1'));var util=require(_0xa63d('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xa63d('0x3'));var Redis=require(_0xa63d('0x4'));var config=require(_0xa63d('0x5'));var logger=require(_0xa63d('0x6'))('routing');var strategy=require(_0xa63d('0x7'));config[_0xa63d('0x8')]=_['defaults'](config[_0xa63d('0x8')],{'host':_0xa63d('0x9'),'port':0x18eb});var io=require(_0xa63d('0xa'))(new Redis(config[_0xa63d('0x8')]));var attributes=['id','queue_id','account','queue',_0xa63d('0xb'),'joinAt'];function emit(_0x2f1e21,_0x3fb568,_0x956ec){io['to'](_0x2f1e21)[_0xa63d('0xc')](_0x3fb568,_0x956ec);}function emitChannelQueueInteraction(_0x510b6a,_0xaea43,_0x1564e7,_0x448a4c,_0x4f8404,_0xcbc9b6,_0x579604,_0x470102){var _0x3ddff4=_[_0xa63d('0xd')](_0x1564e7);_0x3ddff4[_0xa63d('0xe')]=_0x470102;_0x3ddff4[_0xa63d('0xf')]=_0xaea43;_0x3ddff4[_0xa63d('0x10')]=_0x448a4c;_0x3ddff4['id']=_0x4f8404;if(_0xcbc9b6){_0x579604[util[_0xa63d('0x11')](_0xa63d('0x12'),_0x510b6a)][_0x4f8404]=_[_0xa63d('0x13')](_0x3ddff4,attributes);}else{delete _0x579604[util[_0xa63d('0x11')]('%sQueuesWaitingInteractions',_0x510b6a)][_0x4f8404];}emit(util[_0xa63d('0x11')](_0xa63d('0x14'),_0x510b6a,_0xaea43),util[_0xa63d('0x11')]('%s_queue_waiting_interaction:%s',_0x510b6a,_0xcbc9b6?_0xa63d('0x15'):_0xa63d('0x16')),_[_0xa63d('0x13')](_0x3ddff4,attributes));}var rpc={'openchannelQueueReport':require(_0xa63d('0x17')),'mailQueueReport':require(_0xa63d('0x18')),'chatQueueReport':require(_0xa63d('0x19')),'smsQueueReport':require(_0xa63d('0x1a')),'faxQueueReport':require(_0xa63d('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xa63d('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xa63d('0x1d'),'message':_0xa63d('0x1e')}});function startRouting(_0x110ace,_0x54f7b5,_0x421dd0,_0x205c26){if(_0x110ace&&_0x54f7b5&&_0x421dd0){_0x54f7b5[_0xa63d('0x1f')]+=0x1;var _0x79873c={'uniqueid':_0x110ace,'from':_0x421dd0['body']?_0x421dd0[_0xa63d('0x20')][_0xa63d('0xb')]:'','joinAt':moment()[_0xa63d('0x11')](_0xa63d('0x21')),'ContactId':_0x421dd0[_0xa63d('0x22')]?_0x421dd0[_0xa63d('0x22')]['id']:null,'ListId':_0x421dd0['list']?_0x421dd0[_0xa63d('0x23')]['id']:null};_0x79873c[_[_0xa63d('0x24')](_0x421dd0[_0xa63d('0x25')])+_0xa63d('0x26')]=_0x54f7b5['id']||null;_0x79873c[_[_0xa63d('0x24')](_0x421dd0[_0xa63d('0x25')])+_0xa63d('0x27')]=_0x421dd0[_0xa63d('0x28')]?_0x421dd0[_0xa63d('0x28')]['id']:null;_0x79873c[_[_0xa63d('0x24')](_0x421dd0[_0xa63d('0x25')])+_0xa63d('0x29')]=_0x421dd0[_0xa63d('0x2a')]?_0x421dd0['message']['id']:null;_0x79873c[_['upperFirst'](_0x421dd0[_0xa63d('0x25')])+(_0x421dd0['channel']!==_0xa63d('0x2b')?_0xa63d('0x2c'):'WebsiteId')]=_0x421dd0[_0xa63d('0x10')]?_0x421dd0[_0xa63d('0x10')]['id']:null;logger[_0xa63d('0x2d')](util[_0xa63d('0x11')](_0xa63d('0x2e'),_0x110ace,_0x54f7b5['name']));emitChannelQueueInteraction(_0x421dd0[_0xa63d('0x25')],_0x54f7b5[_0xa63d('0x2f')],_0x79873c,_0x421dd0[_0xa63d('0x10')]['name'],_0x421dd0[_0xa63d('0x2a')]['id'],!![],_0x205c26,_0x54f7b5['id']);if(rpc[_0x421dd0[_0xa63d('0x25')]+_0xa63d('0x30')]){return rpc[_0x421dd0[_0xa63d('0x25')]+_0xa63d('0x30')][_0xa63d('0x31')](_0x79873c)[_0xa63d('0x32')](function(_0xd497ad){logger['error'](_0xa63d('0x33'));});}}}function stopRouting(_0x470f0e,_0x294457,_0x1275ea,_0x19779){if(_0x470f0e&&_0x294457){_0x294457['waiting']-=0x1;var _0x13f6d6={'leaveAt':moment()[_0xa63d('0x11')](_0xa63d('0x21')),'acceptAt':moment()[_0xa63d('0x11')](_0xa63d('0x21')),'reason':_0xa63d('0x34')};logger[_0xa63d('0x2d')](util[_0xa63d('0x11')](_0xa63d('0x35'),_0x470f0e,_0x294457[_0xa63d('0x2f')]));emitChannelQueueInteraction(_0x1275ea[_0xa63d('0x25')],_0x294457['name'],_0x1275ea[_0xa63d('0x20')],_0x1275ea[_0xa63d('0x10')][_0xa63d('0x2f')],_0x1275ea['message']['id'],![],_0x19779,_0x294457['id']);if(rpc[_0x1275ea[_0xa63d('0x25')]+'QueueReport']){return rpc[_0x1275ea[_0xa63d('0x25')]+_0xa63d('0x30')][_0xa63d('0x36')](_0x470f0e,_0x13f6d6)[_0xa63d('0x32')](function(_0x332181){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x26d12b,_0x5823e4,_0x554467,_0x23ff5b){if(_0x26d12b&&_0x5823e4){_0x5823e4[_0xa63d('0x1f')]-=0x1;var _0x44b098={'leaveAt':moment()[_0xa63d('0x11')](_0xa63d('0x21')),'exitAt':moment()['format'](_0xa63d('0x21')),'reason':_0xa63d('0x37')};logger[_0xa63d('0x2d')](util[_0xa63d('0x11')](_0xa63d('0x38'),_0x26d12b,_0x5823e4[_0xa63d('0x2f')]));emitChannelQueueInteraction(_0x554467['channel'],_0x5823e4[_0xa63d('0x2f')],_0x554467['body'],_0x554467[_0xa63d('0x10')]['name'],_0x554467[_0xa63d('0x2a')]['id'],![],_0x23ff5b);if(rpc[_0x554467[_0xa63d('0x25')]+_0xa63d('0x30')]){return rpc[_0x554467[_0xa63d('0x25')]+_0xa63d('0x30')][_0xa63d('0x36')](_0x26d12b,_0x44b098)[_0xa63d('0x32')](function(_0x1b9deb){logger[_0xa63d('0x39')](_0xa63d('0x3a'));});}}}function handleFindQueue(_0x17d675){return function(_0x4bba0f){return _0x4bba0f[_0xa63d('0x2f')][_0xa63d('0x3b')]()===_0x17d675[_0xa63d('0x3b')]();};}exports['consequence']=function(_0x4ce813,_0x316a80,_0x492af4,_0x7a8691){return function(_0x3e2766){try{var _0x5b24e4={'name':_0x316a80[0x0],'timeout':_0x316a80[0x1]};var _0x1b8b7a=queue['validate'](_0x5b24e4,{'typecast':!![]});if(_0x1b8b7a['length']){logger[_0xa63d('0x39')]('[%s][QUEUE]\x20%s',_0x4ce813,_[_0xa63d('0x3c')](_0x1b8b7a,'message')[_0xa63d('0x3d')](',\x20'));_0x3e2766[_0xa63d('0x3e')]();}else{var _0x336843=_[_0xa63d('0x3f')](_0x492af4[_0x7a8691[_0xa63d('0x25')]+_0xa63d('0x40')],handleFindQueue(_0x5b24e4[_0xa63d('0x2f')]));if(_0x336843){startRouting(_0x4ce813,_0x336843,_0x7a8691,_0x492af4);var _0x1a82ff=(_0x336843[_0xa63d('0x37')]||0xa)*0x3e8;var _0x5d14db=(_0x5b24e4['timeout']||0x14)*0x3e8;var _0x3b1b0a,_0x117aa2;if(_0x1a82ff>_0x5d14db){_0x5d14db=_0x1a82ff;}var _0x2e917a=seqqueue[_0xa63d('0x41')](_0x1a82ff);_0x2e917a['id']=_0x4ce813;_0x2e917a[_0xa63d('0x42')]=_0x1a82ff;_0x2e917a[_0xa63d('0x43')]=_0x5d14db;_0x2e917a[_0xa63d('0x25')]=_0x7a8691[_0xa63d('0x25')];_0x492af4[_0xa63d('0x44')][_0x4ce813]['on'](_0xa63d('0x45'),function(){logger['info'](_0xa63d('0x46'),_0x4ce813);stopRouting(_0x4ce813,_0x336843,_0x7a8691,_0x492af4);clearTimeout(_0x3b1b0a);_0x3b1b0a=undefined;_0x2e917a['close'](!![]);if(_0x492af4['rules'][_0x4ce813]){delete _0x492af4[_0xa63d('0x44')][_0x4ce813];}_0x3e2766[_0xa63d('0x3e')]();});_0x492af4[_0xa63d('0x44')][_0x4ce813]['on'](_0xa63d('0x47'),function(){if(_0x492af4[_0xa63d('0x44')][_0x4ce813]){delete _0x492af4[_0xa63d('0x44')][_0x4ce813];}});_0x3b1b0a=setTimeout(function(){logger[_0xa63d('0x2d')](_0xa63d('0x48'),_0x4ce813);endRouting(_0x4ce813,_0x336843,_0x7a8691,_0x492af4);clearTimeout(_0x3b1b0a);_0x2e917a[_0xa63d('0x49')](!![]);_0x3e2766['next']();},_0x5d14db);switch(_0x336843[_0xa63d('0x4a')]){case'rrmemory':strategy[_0xa63d('0x4b')](_0x2e917a,_0x336843,_0x492af4,_0x7a8691);break;default:strategy[_0xa63d('0x4c')](_0x2e917a,_0x336843,_0x492af4,_0x7a8691);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4ce813,_0x5b24e4[_0xa63d('0x2f')]);_0x3e2766[_0xa63d('0x3e')]();}}}catch(_0x54b930){console[_0xa63d('0x4d')](_0x54b930);logger['error'](_0xa63d('0x4e'),_0x4ce813,_0x54b930[_0xa63d('0x4f')]);_0x3e2766[_0xa63d('0x3e')]();}};}; \ No newline at end of file +var _0x856c=['toLowerCase','consequence','join','stop','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/logger','routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','account','joinAt','clone','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','body','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','QueueReport','update','update\x20queue\x20report','waiting','[%s][END:QUEUE][NAME:%s]'];(function(_0x3d8acd,_0x32746d){var _0x1004e1=function(_0x4dd783){while(--_0x4dd783){_0x3d8acd['push'](_0x3d8acd['shift']());}};_0x1004e1(++_0x32746d);}(_0x856c,0xa8));var _0xc856=function(_0x592b38,_0x1d17b1){_0x592b38=_0x592b38-0x0;var _0x5a6dcb=_0x856c[_0x592b38];return _0x5a6dcb;};'use strict';var schema=require(_0xc856('0x0'));var _=require(_0xc856('0x1'));var util=require(_0xc856('0x2'));var seqqueue=require(_0xc856('0x3'));var moment=require(_0xc856('0x4'));var Redis=require(_0xc856('0x5'));var config=require('../../../../config/environment');var logger=require(_0xc856('0x6'))(_0xc856('0x7'));var strategy=require(_0xc856('0x8'));config['redis']=_[_0xc856('0x9')](config[_0xc856('0xa')],{'host':_0xc856('0xb'),'port':0x18eb});var io=require(_0xc856('0xc'))(new Redis(config[_0xc856('0xa')]));var attributes=['id',_0xc856('0xd'),_0xc856('0xe'),'queue','from',_0xc856('0xf')];function emit(_0x1448d3,_0x1927ae,_0x118132){io['to'](_0x1448d3)['emit'](_0x1927ae,_0x118132);}function emitChannelQueueInteraction(_0x44de75,_0x25c469,_0xaece57,_0x5e80bd,_0x3ff013,_0x2a0e5e,_0x2cd8cb,_0x679c23){var _0x272862=_[_0xc856('0x10')](_0xaece57);_0x272862[_0xc856('0xd')]=_0x679c23;_0x272862['queue']=_0x25c469;_0x272862[_0xc856('0xe')]=_0x5e80bd;_0x272862['id']=_0x3ff013;if(_0x2a0e5e){_0x2cd8cb[util[_0xc856('0x11')](_0xc856('0x12'),_0x44de75)][_0x3ff013]=_[_0xc856('0x13')](_0x272862,attributes);}else{delete _0x2cd8cb[util[_0xc856('0x11')](_0xc856('0x12'),_0x44de75)][_0x3ff013];}emit(util[_0xc856('0x11')]('%s:queue:%s',_0x44de75,_0x25c469),util[_0xc856('0x11')](_0xc856('0x14'),_0x44de75,_0x2a0e5e?_0xc856('0x15'):_0xc856('0x16')),_['pick'](_0x272862,attributes));}var rpc={'openchannelQueueReport':require(_0xc856('0x17')),'mailQueueReport':require(_0xc856('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xc856('0x19')),'whatsappQueueReport':require(_0xc856('0x1a'))};var queue=schema({'name':{'type':_0xc856('0x1b'),'required':!![],'message':_0xc856('0x1c')},'timeout':{'type':'number','message':_0xc856('0x1d')}});function startRouting(_0x277572,_0x14792e,_0x3b28f0,_0x3904ab){if(_0x277572&&_0x14792e&&_0x3b28f0){_0x14792e['waiting']+=0x1;var _0x3dd17e={'uniqueid':_0x277572,'from':_0x3b28f0[_0xc856('0x1e')]?_0x3b28f0[_0xc856('0x1e')]['from']:'','joinAt':moment()[_0xc856('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b28f0[_0xc856('0x1f')]?_0x3b28f0['contact']['id']:null,'ListId':_0x3b28f0[_0xc856('0x20')]?_0x3b28f0[_0xc856('0x20')]['id']:null};_0x3dd17e[_[_0xc856('0x21')](_0x3b28f0['channel'])+_0xc856('0x22')]=_0x14792e['id']||null;_0x3dd17e[_[_0xc856('0x21')](_0x3b28f0['channel'])+_0xc856('0x23')]=_0x3b28f0[_0xc856('0x24')]?_0x3b28f0['interaction']['id']:null;_0x3dd17e[_['upperFirst'](_0x3b28f0[_0xc856('0x25')])+_0xc856('0x26')]=_0x3b28f0[_0xc856('0x27')]?_0x3b28f0[_0xc856('0x27')]['id']:null;_0x3dd17e[_['upperFirst'](_0x3b28f0[_0xc856('0x25')])+(_0x3b28f0[_0xc856('0x25')]!==_0xc856('0x28')?_0xc856('0x29'):_0xc856('0x2a'))]=_0x3b28f0['account']?_0x3b28f0[_0xc856('0xe')]['id']:null;logger[_0xc856('0x2b')](util[_0xc856('0x11')](_0xc856('0x2c'),_0x277572,_0x14792e['name']));emitChannelQueueInteraction(_0x3b28f0[_0xc856('0x25')],_0x14792e['name'],_0x3dd17e,_0x3b28f0[_0xc856('0xe')][_0xc856('0x2d')],_0x3b28f0[_0xc856('0x27')]['id'],!![],_0x3904ab,_0x14792e['id']);if(rpc[_0x3b28f0[_0xc856('0x25')]+'QueueReport']){return rpc[_0x3b28f0[_0xc856('0x25')]+'QueueReport'][_0xc856('0x2e')](_0x3dd17e)[_0xc856('0x2f')](function(_0x3b74c8){logger[_0xc856('0x30')](_0xc856('0x31'));});}}}function stopRouting(_0x19e36e,_0x5e7ee4,_0x1be19b,_0x140793){if(_0x19e36e&&_0x5e7ee4){_0x5e7ee4['waiting']-=0x1;var _0xebb6dc={'leaveAt':moment()['format'](_0xc856('0x32')),'acceptAt':moment()[_0xc856('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xc856('0x33')};logger[_0xc856('0x2b')](util[_0xc856('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x19e36e,_0x5e7ee4[_0xc856('0x2d')]));emitChannelQueueInteraction(_0x1be19b[_0xc856('0x25')],_0x5e7ee4[_0xc856('0x2d')],_0x1be19b['body'],_0x1be19b['account']['name'],_0x1be19b[_0xc856('0x27')]['id'],![],_0x140793,_0x5e7ee4['id']);if(rpc[_0x1be19b[_0xc856('0x25')]+_0xc856('0x34')]){return rpc[_0x1be19b[_0xc856('0x25')]+_0xc856('0x34')][_0xc856('0x35')](_0x19e36e,_0xebb6dc)[_0xc856('0x2f')](function(_0x276011){logger[_0xc856('0x30')](_0xc856('0x36'));});}}}function endRouting(_0x2b0a1b,_0x4042eb,_0x49ff2a,_0x8b5dd9){if(_0x2b0a1b&&_0x4042eb){_0x4042eb[_0xc856('0x37')]-=0x1;var _0x5241c1={'leaveAt':moment()[_0xc856('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0xc856('0x32')),'reason':'timeout'};logger[_0xc856('0x2b')](util[_0xc856('0x11')](_0xc856('0x38'),_0x2b0a1b,_0x4042eb['name']));emitChannelQueueInteraction(_0x49ff2a[_0xc856('0x25')],_0x4042eb[_0xc856('0x2d')],_0x49ff2a[_0xc856('0x1e')],_0x49ff2a[_0xc856('0xe')]['name'],_0x49ff2a['message']['id'],![],_0x8b5dd9);if(rpc[_0x49ff2a[_0xc856('0x25')]+'QueueReport']){return rpc[_0x49ff2a[_0xc856('0x25')]+_0xc856('0x34')][_0xc856('0x35')](_0x2b0a1b,_0x5241c1)[_0xc856('0x2f')](function(_0x2fb72a){logger[_0xc856('0x30')](_0xc856('0x36'));});}}}function handleFindQueue(_0x33ffaf){return function(_0x382a48){return _0x382a48[_0xc856('0x2d')]['toLowerCase']()===_0x33ffaf[_0xc856('0x39')]();};}exports[_0xc856('0x3a')]=function(_0x2b8a72,_0x1c61c6,_0x6d3cbe,_0x4c2298){return function(_0x2d9f41){try{var _0x912b26={'name':_0x1c61c6[0x0],'timeout':_0x1c61c6[0x1]};var _0x1911fa=queue[_0xc856('0x0')](_0x912b26,{'typecast':!![]});if(_0x1911fa['length']){logger[_0xc856('0x30')]('[%s][QUEUE]\x20%s',_0x2b8a72,_['map'](_0x1911fa,_0xc856('0x27'))[_0xc856('0x3b')](',\x20'));_0x2d9f41[_0xc856('0x3c')]();}else{var _0x28ec0d=_['find'](_0x6d3cbe[_0x4c2298[_0xc856('0x25')]+_0xc856('0x3d')],handleFindQueue(_0x912b26[_0xc856('0x2d')]));if(_0x28ec0d){startRouting(_0x2b8a72,_0x28ec0d,_0x4c2298,_0x6d3cbe);var _0x3b6ad4=(_0x28ec0d['timeout']||0xa)*0x3e8;var _0x463e39=(_0x912b26[_0xc856('0x3e')]||0x14)*0x3e8;var _0x1818b1,_0x401334;if(_0x3b6ad4>_0x463e39){_0x463e39=_0x3b6ad4;}var _0x172ecf=seqqueue[_0xc856('0x3f')](_0x3b6ad4);_0x172ecf['id']=_0x2b8a72;_0x172ecf[_0xc856('0x40')]=_0x3b6ad4;_0x172ecf[_0xc856('0x41')]=_0x463e39;_0x172ecf[_0xc856('0x25')]=_0x4c2298['channel'];_0x6d3cbe[_0xc856('0x42')][_0x2b8a72]['on'](_0xc856('0x43'),function(){logger[_0xc856('0x2b')](_0xc856('0x44'),_0x2b8a72);stopRouting(_0x2b8a72,_0x28ec0d,_0x4c2298,_0x6d3cbe);clearTimeout(_0x1818b1);_0x1818b1=undefined;_0x172ecf[_0xc856('0x45')](!![]);if(_0x6d3cbe[_0xc856('0x42')][_0x2b8a72]){delete _0x6d3cbe['rules'][_0x2b8a72];}_0x2d9f41[_0xc856('0x3c')]();});_0x6d3cbe[_0xc856('0x42')][_0x2b8a72]['on']('complete',function(){if(_0x6d3cbe['rules'][_0x2b8a72]){delete _0x6d3cbe[_0xc856('0x42')][_0x2b8a72];}});_0x1818b1=setTimeout(function(){logger[_0xc856('0x2b')](_0xc856('0x46'),_0x2b8a72);endRouting(_0x2b8a72,_0x28ec0d,_0x4c2298,_0x6d3cbe);clearTimeout(_0x1818b1);_0x172ecf[_0xc856('0x45')](!![]);_0x2d9f41['next']();},_0x463e39);switch(_0x28ec0d[_0xc856('0x47')]){case _0xc856('0x48'):strategy[_0xc856('0x48')](_0x172ecf,_0x28ec0d,_0x6d3cbe,_0x4c2298);break;default:strategy[_0xc856('0x49')](_0x172ecf,_0x28ec0d,_0x6d3cbe,_0x4c2298);}}else{logger[_0xc856('0x30')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x2b8a72,_0x912b26['name']);_0x2d9f41[_0xc856('0x3c')]();}}}catch(_0x19bafa){console['log'](_0x19bafa);logger[_0xc856('0x30')]('[%s][QUEUE]\x20%s',_0x2b8a72,_0x19bafa[_0xc856('0x4a')]);_0x2d9f41[_0xc856('0x3c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index d089088..988e953 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 _0xdacd=['agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','writeLog','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun','handleTimeout','bind','timeout','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime'];(function(_0x3ccb4d,_0x5481fd){var _0x1c6414=function(_0x34b981){while(--_0x34b981){_0x3ccb4d['push'](_0x3ccb4d['shift']());}};_0x1c6414(++_0x5481fd);}(_0xdacd,0x143));var _0xddac=function(_0x133a9f,_0x985147){_0x133a9f=_0x133a9f-0x0;var _0x1a11a8=_0xdacd[_0x133a9f];return _0x1a11a8;};'use strict';var _=require(_0xddac('0x0'));var uuid=require('uuid');var util=require(_0xddac('0x1'));var logger=require(_0xddac('0x2'))(_0xddac('0x3'));var Agent=function(_0x5979a3,_0x523b94,_0xc23621,_0x29dcb0){this[_0xddac('0x4')]=uuid['v4']();this[_0xddac('0x5')]=_0x5979a3;this[_0xddac('0x6')]=_0x523b94;this['realtime']=_0xc23621;this[_0xddac('0x3')]=_0x29dcb0;this[_0xddac('0x5')][_0xddac('0x7')](this[_0xddac('0x8')]['bind'](this),this[_0xddac('0x9')][_0xddac('0xa')](this));this[_0xddac('0x5')]['on'](_0xddac('0xb'),this[_0xddac('0x9')][_0xddac('0xa')](this));this[_0xddac('0x5')]['on']('drained',this[_0xddac('0xc')][_0xddac('0xa')](this));};Agent[_0xddac('0xd')][_0xddac('0x7')]=function(){this[_0xddac('0x5')][_0xddac('0x7')](this[_0xddac('0x8')][_0xddac('0xa')](this),this[_0xddac('0x9')][_0xddac('0xa')](this));};Agent[_0xddac('0xd')][_0xddac('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0xddac('0xd')]['handleRun']=function(_0x44e06){logger[_0xddac('0xe')](_0xddac('0xf'),this[_0xddac('0x5')]['id'],this[_0xddac('0x6')]['id']);if(_[_0xddac('0x10')](this[_0xddac('0x11')][_0xddac('0x12')][this[_0xddac('0x6')]['id']])){logger['info'](_0xddac('0x13'),this[_0xddac('0x5')]['id'],this[_0xddac('0x6')]['id']);setTimeout(this[_0xddac('0x7')]['bind'](this),0x3e8);}else{if(this['routing'][_0xddac('0x14')]||util[_0xddac('0x15')](this['squeue']['id'],this[_0xddac('0x11')]['agents'][this[_0xddac('0x6')]['id']],this['squeue'][_0xddac('0x16')],![])){this['realtime'][_0xddac('0x12')][this[_0xddac('0x6')]['id']][_0xddac('0x17')]=!![];this[_0xddac('0x11')][_0xddac('0x12')][this[_0xddac('0x6')]['id']]['busyQueue']=undefined;util['showNotification'](this[_0xddac('0x4')],this[_0xddac('0x5')]['id'],this[_0xddac('0x11')][_0xddac('0x12')][this[_0xddac('0x6')]['id']],null,this[_0xddac('0x3')]);util['writeLog'](this[_0xddac('0x5')]['id'],this[_0xddac('0x11')][_0xddac('0x12')][this[_0xddac('0x6')]['id']],_0xddac('0x18')+(this[_0xddac('0x3')]['forcedOwnership']?':FORCED':''));}else{logger['info'](_0xddac('0x19'),this[_0xddac('0x5')]['id'],this[_0xddac('0x6')]['id']);setTimeout(this[_0xddac('0x7')][_0xddac('0xa')](this),0x3e8);}}};Agent['prototype'][_0xddac('0x9')]=function(_0x5aaa12){if(_[_0xddac('0x10')](this['realtime'][_0xddac('0x12')][this[_0xddac('0x6')]['id']])){return logger[_0xddac('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xddac('0x5')]['id'],this[_0xddac('0x6')]['id']);}else{logger[_0xddac('0xe')](_0xddac('0x1a'),this[_0xddac('0x5')]['id'],this['agent']['id']);util[_0xddac('0x1b')](this[_0xddac('0x4')],this[_0xddac('0x5')]['id'],this[_0xddac('0x11')][_0xddac('0x12')][this[_0xddac('0x6')]['id']],null,this[_0xddac('0x3')]);this[_0xddac('0x11')][_0xddac('0x12')][this[_0xddac('0x6')]['id']][_0xddac('0x17')]=![];this[_0xddac('0x11')][_0xddac('0x12')][this[_0xddac('0x6')]['id']][_0xddac('0x1c')]=undefined;util[_0xddac('0x1d')](this['squeue']['id'],this['realtime'][_0xddac('0x12')][this[_0xddac('0x6')]['id']],_0x5aaa12?'STOP':'TIMEOUT');}if(!_0x5aaa12){setTimeout(this[_0xddac('0x7')][_0xddac('0xa')](this),0x3e8);}};function agent(_0x48d111,_0x5c3ed7,_0x42a263,_0x3ba551){return new Agent(_0x48d111,_0x5c3ed7,_0x42a263,_0x3ba551);}module[_0xddac('0x1e')]=agent; \ No newline at end of file +var _0x43ef=['exports','lodash','uuid','./util','routing','notificationId','agent','squeue','push','bind','handleTimeout','timeout','drained','handleRun','prototype','handleDrained','[%s][AGENT]\x20try\x20with\x20%s','isNil','forcedOwnership','isAgentAvailable','realtime','agents','channel','busy','busyQueue','writeLog','RINGING',':FORCED','info','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP'];(function(_0x53d7e4,_0x5cc277){var _0x8c3c03=function(_0x410369){while(--_0x410369){_0x53d7e4['push'](_0x53d7e4['shift']());}};_0x8c3c03(++_0x5cc277);}(_0x43ef,0x199));var _0xf43e=function(_0x3d6a1f,_0x1d57ec){_0x3d6a1f=_0x3d6a1f-0x0;var _0x719e2e=_0x43ef[_0x3d6a1f];return _0x719e2e;};'use strict';var _=require(_0xf43e('0x0'));var uuid=require(_0xf43e('0x1'));var util=require(_0xf43e('0x2'));var logger=require('../../../../../config/logger')(_0xf43e('0x3'));var Agent=function(_0x183277,_0x240f84,_0x4511bd,_0x2513b1){this[_0xf43e('0x4')]=uuid['v4']();this['squeue']=_0x183277;this[_0xf43e('0x5')]=_0x240f84;this['realtime']=_0x4511bd;this[_0xf43e('0x3')]=_0x2513b1;this[_0xf43e('0x6')][_0xf43e('0x7')](this['handleRun'][_0xf43e('0x8')](this),this[_0xf43e('0x9')][_0xf43e('0x8')](this));this[_0xf43e('0x6')]['on'](_0xf43e('0xa'),this[_0xf43e('0x9')][_0xf43e('0x8')](this));this[_0xf43e('0x6')]['on'](_0xf43e('0xb'),this['handleDrained'][_0xf43e('0x8')](this));};Agent['prototype']['push']=function(){this[_0xf43e('0x6')][_0xf43e('0x7')](this[_0xf43e('0xc')]['bind'](this),this[_0xf43e('0x9')]['bind'](this));};Agent[_0xf43e('0xd')][_0xf43e('0xe')]=function(){this[_0xf43e('0x9')](!![]);};Agent['prototype'][_0xf43e('0xc')]=function(_0x3a0e52){logger['info'](_0xf43e('0xf'),this[_0xf43e('0x6')]['id'],this[_0xf43e('0x5')]['id']);if(_[_0xf43e('0x10')](this['realtime']['agents'][this['agent']['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xf43e('0x5')]['id']);setTimeout(this['push'][_0xf43e('0x8')](this),0x3e8);}else{if(this[_0xf43e('0x3')][_0xf43e('0x11')]||util[_0xf43e('0x12')](this['squeue']['id'],this[_0xf43e('0x13')][_0xf43e('0x14')][this[_0xf43e('0x5')]['id']],this[_0xf43e('0x6')][_0xf43e('0x15')],![])){this[_0xf43e('0x13')]['agents'][this['agent']['id']][_0xf43e('0x16')]=!![];this['realtime'][_0xf43e('0x14')][this[_0xf43e('0x5')]['id']][_0xf43e('0x17')]=undefined;util['showNotification'](this[_0xf43e('0x4')],this['squeue']['id'],this[_0xf43e('0x13')][_0xf43e('0x14')][this['agent']['id']],null,this[_0xf43e('0x3')]);util[_0xf43e('0x18')](this['squeue']['id'],this[_0xf43e('0x13')][_0xf43e('0x14')][this[_0xf43e('0x5')]['id']],_0xf43e('0x19')+(this[_0xf43e('0x3')]['forcedOwnership']?_0xf43e('0x1a'):''));}else{logger[_0xf43e('0x1b')](_0xf43e('0x1c'),this[_0xf43e('0x6')]['id'],this[_0xf43e('0x5')]['id']);setTimeout(this[_0xf43e('0x7')][_0xf43e('0x8')](this),0x3e8);}}};Agent[_0xf43e('0xd')][_0xf43e('0x9')]=function(_0x425e34){if(_['isNil'](this[_0xf43e('0x13')]['agents'][this[_0xf43e('0x5')]['id']])){return logger['info'](_0xf43e('0x1d'),this[_0xf43e('0x6')]['id'],this[_0xf43e('0x5')]['id']);}else{logger['info'](_0xf43e('0x1e'),this[_0xf43e('0x6')]['id'],this[_0xf43e('0x5')]['id']);util[_0xf43e('0x1f')](this[_0xf43e('0x4')],this[_0xf43e('0x6')]['id'],this['realtime'][_0xf43e('0x14')][this[_0xf43e('0x5')]['id']],null,this['routing']);this[_0xf43e('0x13')][_0xf43e('0x14')][this[_0xf43e('0x5')]['id']][_0xf43e('0x16')]=![];this[_0xf43e('0x13')][_0xf43e('0x14')][this[_0xf43e('0x5')]['id']]['busyQueue']=undefined;util[_0xf43e('0x18')](this[_0xf43e('0x6')]['id'],this[_0xf43e('0x13')][_0xf43e('0x14')][this[_0xf43e('0x5')]['id']],_0x425e34?_0xf43e('0x20'):'TIMEOUT');}if(!_0x425e34){setTimeout(this[_0xf43e('0x7')][_0xf43e('0x8')](this),0x3e8);}};function agent(_0x18cba4,_0x2eace2,_0x4a27ae,_0x5433db){return new Agent(_0x18cba4,_0x2eace2,_0x4a27ae,_0x5433db);}module[_0xf43e('0x21')]=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 ff47b1e..1a6d765 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 _0xe8f7=['bind','handleTimeout','drained','handleDrained','prototype','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','busyQueue','name','notificationId','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busy','exports','lodash','./util','../../../../../config/logger','routing','queue','realtime','squeue','push','handleRun'];(function(_0x48b5e7,_0x5226b9){var _0x23741d=function(_0x6403a1){while(--_0x6403a1){_0x48b5e7['push'](_0x48b5e7['shift']());}};_0x23741d(++_0x5226b9);}(_0xe8f7,0x137));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7e8f('0x0'));var uuid=require('uuid');var util=require(_0x7e8f('0x1'));var logger=require(_0x7e8f('0x2'))(_0x7e8f('0x3'));var Beepall=function(_0x4773eb,_0x428a60,_0xa9b6b5,_0x4249af){this['notificationId']=uuid['v4']();this['squeue']=_0x4773eb;this[_0x7e8f('0x4')]=_0x428a60;this[_0x7e8f('0x5')]=_0xa9b6b5;this['routing']=_0x4249af;this[_0x7e8f('0x6')][_0x7e8f('0x7')](this[_0x7e8f('0x8')][_0x7e8f('0x9')](this),this[_0x7e8f('0xa')][_0x7e8f('0x9')](this));this[_0x7e8f('0x6')]['on']('timeout',this[_0x7e8f('0xa')][_0x7e8f('0x9')](this));this['squeue']['on'](_0x7e8f('0xb'),this[_0x7e8f('0xc')][_0x7e8f('0x9')](this));};Beepall[_0x7e8f('0xd')]['push']=function(){this[_0x7e8f('0x6')][_0x7e8f('0x7')](this['handleRun'][_0x7e8f('0x9')](this),this[_0x7e8f('0xa')]['bind'](this));};Beepall['prototype'][_0x7e8f('0xc')]=function(_0x27287f){this[_0x7e8f('0xa')](!![]);};Beepall[_0x7e8f('0xd')][_0x7e8f('0x8')]=function(_0x31bb2a){var _0x2bdd98=!![];if(!_[_0x7e8f('0xe')](this[_0x7e8f('0x4')])&&!_[_0x7e8f('0xe')](this[_0x7e8f('0x4')][_0x7e8f('0xf')])&&this[_0x7e8f('0x4')][_0x7e8f('0xf')][_0x7e8f('0x10')]>0x0){for(var _0xbbb0e=0x0,_0x577a7b;_0xbbb0e0x0){for(var _0xc6e591=0x0,_0x54a570;_0xc6e5910x0&&_0x2f3415[_0xa36371+'CurrentCapacity']>=_0x2f3415[_0xa36371+_0x6709('0x25')]){writeLog(_0x1c5153,_0x2f3415,_0xa36371[_0x6709('0x27')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x6709('0x28')]=function(_0x2499a2,_0x50ada6,_0x271098,_0x5b5201,_0x46a325){return sendNotification(!![],_0x2499a2,_0x50ada6,_0x271098,_0x5b5201,_0x46a325);};exports[_0x6709('0x29')]=function(_0x5b6906,_0x137137,_0x4e6989,_0xe066d8,_0x388aee){return sendNotification(![],_0x5b6906,_0x137137,_0x4e6989,_0xe066d8,_0x388aee);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x1261=['info','[%s][QUEUE][AGENT:%s][STATUS:%s]','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','emit','format','name','split','\x20interaction','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','notification:%s','save'];(function(_0x2b32b2,_0x19af7a){var _0x28aebb=function(_0x1c76ef){while(--_0x1c76ef){_0x2b32b2['push'](_0x2b32b2['shift']());}};_0x28aebb(++_0x19af7a);}(_0x1261,0x144));var _0x1126=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0x1261[_0x4907de];return _0x482054;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var utils=require(_0x1126('0x1'));var Mustache=require(_0x1126('0x2'));var Redis=require(_0x1126('0x3'));var config=require(_0x1126('0x4'));var logger=require(_0x1126('0x5'))(_0x1126('0x6'));config[_0x1126('0x7')]=_[_0x1126('0x8')](config[_0x1126('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1126('0x7')]));function emit(_0x907180,_0x4f239c,_0x17e5f0){io['to'](_0x907180)[_0x1126('0x9')](_0x4f239c,_0x17e5f0);}function sendNotification(_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1,_0x3f09ac,_0x18dbe6){io['to'](util[_0x1126('0xa')]('user:%s',_0x59cfa1[_0x1126('0xb')]))['emit']('user:save',_0x59cfa1);var _0x15c071=_0x18dbe6||{};var _0x561b93=_0x2d9033[_0x1126('0xc')]('.');var _0x1b364a={'uniqueid':_0x3abb0b,'channel':_0x561b93[0x0],'id':_0x561b93[0x1],'title':_0x561b93[0x0]+_0x1126('0xd'),'interactionId':_0x561b93[0x2],'queue':_0x3f09ac?_0x3f09ac[_0x1126('0xb')]:null,'sound':_0x15c071[_0x1126('0xe')][_0x1126('0xf')],'shake':_0x15c071[_0x1126('0xe')][_0x1126('0x10')]};try{if(!_0x15c071[_0x1126('0x11')]){_0x15c071['body']={};}if(_0x3f09ac){_0x15c071['body'][_0x1126('0x12')]=_0x3f09ac;}else if(_0x15c071[_0x1126('0x11')][_0x1126('0x12')]){delete _0x15c071['body'][_0x1126('0x12')];}_0x1b364a['msg']=utils[_0x1126('0x13')](_0x15c071[_0x1126('0xe')][_0x1126('0x14')],_0x15c071);}catch(_0x4e1c97){_0x1b364a[_0x1126('0x15')]=_0x1126('0x16');logger['error'](util['format'](_0x1126('0x17'),_0x3abb0b,_0x4e1c97[_0x1126('0x18')]));}io['to'](util['format']('user:%s',_0x59cfa1[_0x1126('0xb')]))['emit'](util[_0x1126('0xa')](_0x1126('0x19'),_0x245be9?_0x1126('0x1a'):'remove'),_0x1b364a);}function writeLog(_0x2a08ba,_0x49d209,_0x56efeb){return logger[_0x1126('0x1b')](util[_0x1126('0xa')](_0x1126('0x1c'),_0x2a08ba,_0x49d209[_0x1126('0xb')],_0x56efeb));}exports['isAgentAvailable']=function(_0x29ab60,_0x477e6a,_0x48a08d,_0x2175fa){if(_0x477e6a['busy']){writeLog(_0x29ab60,_0x477e6a,'BUSY');return![];}if(!_0x477e6a['online']){writeLog(_0x29ab60,_0x477e6a,_0x1126('0x1d'));return![];}if(_0x477e6a[_0x48a08d+_0x1126('0x1e')]){writeLog(_0x29ab60,_0x477e6a,_0x1126('0x1f'));return![];}if(_0x2175fa&&_0x477e6a[_0x1126('0x20')](_0x48a08d+_0x1126('0x21'))&&_0x477e6a[_0x1126('0x20')](_0x48a08d+_0x1126('0x22'))){if(_0x477e6a[_0x48a08d+_0x1126('0x21')]>0x0&&_0x477e6a[_0x48a08d+'CurrentCapacity']>=_0x477e6a[_0x48a08d+_0x1126('0x21')]){writeLog(_0x29ab60,_0x477e6a,_0x48a08d[_0x1126('0x23')]()+_0x1126('0x24'));return![];}}return!![];};exports['showNotification']=function(_0x541bc9,_0xeb7d89,_0x39bf0e,_0x55e195,_0x2fb797){return sendNotification(!![],_0x541bc9,_0xeb7d89,_0x39bf0e,_0x55e195,_0x2fb797);};exports[_0x1126('0x25')]=function(_0x4a334a,_0x3fa694,_0x4bf807,_0xc62460,_0x4bd50b){return sendNotification(![],_0x4a334a,_0x3fa694,_0x4bf807,_0xc62460,_0x4bd50b);};exports[_0x1126('0x26')]=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 5f36530..7347a8f 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 _0x6719=['isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil'];(function(_0xc971a4,_0x5b381c){var _0x4ebd6b=function(_0x371149){while(--_0x371149){_0xc971a4['push'](_0xc971a4['shift']());}};_0x4ebd6b(++_0x5b381c);}(_0x6719,0x139));var _0x9671=function(_0x2862b1,_0x51a367){_0x2862b1=_0x2862b1-0x0;var _0x817ee6=_0x6719[_0x2862b1];return _0x817ee6;};'use strict';var schema=require('validate');var sh=require(_0x9671('0x0'));var _=require(_0x9671('0x1'));var utils=require(_0x9671('0x2'));var logger=require(_0x9671('0x3'))(_0x9671('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x9671('0x5')}});exports['consequence']=function(_0x591ae6,_0x5d97f7){return function(_0x106b41){try{var _0x4e4e39={'command':_0x5d97f7[0x0]};var _0x4e01f4=system[_0x9671('0x6')](_0x4e4e39,{'typecast':!![]});if(_0x4e01f4[_0x9671('0x7')]){logger[_0x9671('0x8')](_0x9671('0x9'),_0x591ae6,_[_0x9671('0xa')](_0x4e01f4,_0x9671('0xb'))[_0x9671('0xc')](',\x20'));logger[_0x9671('0xd')](_0x9671('0xe'),_0x591ae6);_0x106b41[_0x9671('0xf')]();}else{var _0x49a112=this;var _0x1196f3=utils[_0x9671('0x10')](_0x5d97f7[0x0],this);logger[_0x9671('0xd')](_0x9671('0x11'),_0x591ae6,_0x1196f3);sh[_0x9671('0x12')](_[_0x9671('0x13')](_0x1196f3),function(_0x7359c6,_0x2c725f){logger['info'](_0x9671('0x14'),_0x591ae6,_0x7359c6);if(_0x7359c6==0x0){var _0x5ed7f3=_0x2c725f[_0x9671('0x15')](/(\r\n|\n|\r)/gm,'');if(_[_0x9671('0x16')](_0x5d97f7[0x1])||_[_0x9671('0x17')](_0x5d97f7[0x1])){logger[_0x9671('0xd')](_0x9671('0x18'),_0x591ae6);_0x49a112[_0x9671('0x19')][_0x5d97f7[0x1]]=_0x5ed7f3;}else{logger[_0x9671('0xd')](_0x9671('0x1a'),_0x591ae6,_0x5d97f7[0x1],_0x5ed7f3);_0x49a112[_0x9671('0x19')][_0x5d97f7[0x1]]=_0x5ed7f3;}}_0x106b41[_0x9671('0xf')]();});}}catch(_0x2c5da7){logger[_0x9671('0x8')]('[%s][SYSTEM]\x20%s',_0x591ae6,_['isObject'](_0x2c5da7)?JSON[_0x9671('0x1b')](_0x2c5da7):_0x2c5da7);logger[_0x9671('0xd')](_0x9671('0xe'),_0x591ae6);_0x106b41[_0x9671('0xf')]();}};}; \ No newline at end of file +var _0x6f4e=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','validate','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil'];(function(_0x5625b2,_0x2db670){var _0x2fa588=function(_0x45f196){while(--_0x45f196){_0x5625b2['push'](_0x5625b2['shift']());}};_0x2fa588(++_0x2db670);}(_0x6f4e,0x1ae));var _0xe6f4=function(_0x4d3eb2,_0x3f607a){_0x4d3eb2=_0x4d3eb2-0x0;var _0x195ad6=_0x6f4e[_0x4d3eb2];return _0x195ad6;};'use strict';var schema=require(_0xe6f4('0x0'));var sh=require('shelljs');var _=require(_0xe6f4('0x1'));var utils=require('./utils');var logger=require(_0xe6f4('0x2'))(_0xe6f4('0x3'));var system=schema({'command':{'type':_0xe6f4('0x4'),'required':!![],'message':_0xe6f4('0x5')}});exports[_0xe6f4('0x6')]=function(_0x55f514,_0x22b4ef){return function(_0x3b57f1){try{var _0x297a01={'command':_0x22b4ef[0x0]};var _0xddf2ad=system['validate'](_0x297a01,{'typecast':!![]});if(_0xddf2ad[_0xe6f4('0x7')]){logger[_0xe6f4('0x8')]('[%s][SYSTEM]\x20%s',_0x55f514,_[_0xe6f4('0x9')](_0xddf2ad,_0xe6f4('0xa'))[_0xe6f4('0xb')](',\x20'));logger[_0xe6f4('0xc')](_0xe6f4('0xd'),_0x55f514);_0x3b57f1[_0xe6f4('0xe')]();}else{var _0x2684ec=this;var _0x11e844=utils[_0xe6f4('0xf')](_0x22b4ef[0x0],this);logger[_0xe6f4('0xc')](_0xe6f4('0x10'),_0x55f514,_0x11e844);sh['exec'](_['trim'](_0x11e844),function(_0x7932ab,_0x4f46f8){logger[_0xe6f4('0xc')](_0xe6f4('0x11'),_0x55f514,_0x7932ab);if(_0x7932ab==0x0){var _0x3bef56=_0x4f46f8[_0xe6f4('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xe6f4('0x13')](_0x22b4ef[0x1])||_['isEmpty'](_0x22b4ef[0x1])){logger[_0xe6f4('0xc')](_0xe6f4('0x14'),_0x55f514);_0x2684ec[_0xe6f4('0x15')][_0x22b4ef[0x1]]=_0x3bef56;}else{logger[_0xe6f4('0xc')](_0xe6f4('0x16'),_0x55f514,_0x22b4ef[0x1],_0x3bef56);_0x2684ec[_0xe6f4('0x15')][_0x22b4ef[0x1]]=_0x3bef56;}}_0x3b57f1[_0xe6f4('0xe')]();});}}catch(_0x12176d){logger[_0xe6f4('0x8')](_0xe6f4('0x17'),_0x55f514,_[_0xe6f4('0x18')](_0x12176d)?JSON['stringify'](_0x12176d):_0x12176d);logger['info'](_0xe6f4('0xd'),_0x55f514);_0x3b57f1['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 498c12a..281ea95 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 _0xc426=['stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','consequence','error','[%s][TAG]\x20%s','map','message','join','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','finally','next','isObject'];(function(_0x3b0f80,_0x1a666a){var _0x52d4bf=function(_0x4ffda1){while(--_0x4ffda1){_0x3b0f80['push'](_0x3b0f80['shift']());}};_0x52d4bf(++_0x1a666a);}(_0xc426,0x153));var _0x6c42=function(_0x1dc405,_0x439d0f){_0x1dc405=_0x1dc405-0x0;var _0x1a6d0d=_0xc426[_0x1dc405];return _0x1a6d0d;};'use strict';var schema=require(_0x6c42('0x0'));var _=require(_0x6c42('0x1'));var rpc={'chatInteraction':require(_0x6c42('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6c42('0x3')),'mailInteraction':require(_0x6c42('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x6c42('0x5'))};var logger=require(_0x6c42('0x6'))(_0x6c42('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x6c42('0x8')]=function(_0x5a3089,_0x1fbe75,_0x24190c,_0x2e0543){return function(_0x5ea0b9){try{var _0x450a60={'tag':_0x1fbe75[0x0]};var _0x1583be=tag[_0x6c42('0x0')](_0x450a60,{'typecast':!![]});if(_0x1583be['length']){logger[_0x6c42('0x9')](_0x6c42('0xa'),_0x5a3089,_[_0x6c42('0xb')](_0x1583be,_0x6c42('0xc'))[_0x6c42('0xd')](',\x20'));logger[_0x6c42('0xe')](_0x6c42('0xf'),_0x5a3089);_0x5ea0b9['next']();}else{var _0x49311c={'ids':[_0x1fbe75[0x0]]};if(rpc[_0x2e0543[_0x6c42('0x10')]+_0x6c42('0x11')]){rpc[_0x2e0543[_0x6c42('0x10')]+_0x6c42('0x11')][_0x6c42('0x12')](_0x2e0543[_0x6c42('0x13')]['id'],_0x49311c)[_0x6c42('0x14')](function(_0x3e7efd){logger['info'](_0x6c42('0x15'),_0x5a3089,_0x1fbe75[0x1],_0x2e0543[_0x6c42('0x10')],_0x2e0543[_0x6c42('0x13')]['id']);})['catch'](function(_0x55818d){logger['error']('[%s][TAG]\x20%s',_0x5a3089,JSON['stringify'](_0x55818d));logger[_0x6c42('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5a3089);})[_0x6c42('0x16')](function(){_0x5ea0b9[_0x6c42('0x17')]();});}}}catch(_0x15502c){logger[_0x6c42('0x9')](_0x6c42('0xa'),_0x5a3089,_[_0x6c42('0x18')](_0x15502c)?JSON[_0x6c42('0x19')](_0x15502c):_0x15502c);logger[_0x6c42('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5a3089);_0x5ea0b9[_0x6c42('0x17')]();}};}; \ No newline at end of file +var _0xf144=['lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','error','[%s][TAG]\x20%s','map','message','join','[%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','isObject','info','validate'];(function(_0x1f3726,_0x1ed394){var _0x2629c5=function(_0x68c651){while(--_0x68c651){_0x1f3726['push'](_0x1f3726['shift']());}};_0x2629c5(++_0x1ed394);}(_0xf144,0xef));var _0x4f14=function(_0x274577,_0x4a0269){_0x274577=_0x274577-0x0;var _0x307b8b=_0xf144[_0x274577];return _0x307b8b;};'use strict';var schema=require(_0x4f14('0x0'));var _=require(_0x4f14('0x1'));var rpc={'chatInteraction':require(_0x4f14('0x2')),'openchannelInteraction':require(_0x4f14('0x3')),'smsInteraction':require(_0x4f14('0x4')),'mailInteraction':require(_0x4f14('0x5')),'faxInteraction':require(_0x4f14('0x6')),'whatsappInteraction':require(_0x4f14('0x7'))};var logger=require(_0x4f14('0x8'))(_0x4f14('0x9'));var tag=schema({'tag':{'type':_0x4f14('0xa'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x4f14('0xb')]=function(_0x404506,_0x42ddf1,_0x3b6798,_0x4fc445){return function(_0x3b9683){try{var _0x25010f={'tag':_0x42ddf1[0x0]};var _0x28725c=tag[_0x4f14('0x0')](_0x25010f,{'typecast':!![]});if(_0x28725c['length']){logger[_0x4f14('0xc')](_0x4f14('0xd'),_0x404506,_[_0x4f14('0xe')](_0x28725c,_0x4f14('0xf'))[_0x4f14('0x10')](',\x20'));logger['info'](_0x4f14('0x11'),_0x404506);_0x3b9683['next']();}else{var _0x3df6df={'ids':[_0x42ddf1[0x0]]};if(rpc[_0x4fc445[_0x4f14('0x12')]+'Interaction']){rpc[_0x4fc445[_0x4f14('0x12')]+_0x4f14('0x13')][_0x4f14('0x14')](_0x4fc445[_0x4f14('0x15')]['id'],_0x3df6df)[_0x4f14('0x16')](function(_0x499d31){logger['info'](_0x4f14('0x17'),_0x404506,_0x42ddf1[0x1],_0x4fc445[_0x4f14('0x12')],_0x4fc445[_0x4f14('0x15')]['id']);})[_0x4f14('0x18')](function(_0x572cb1){logger[_0x4f14('0xc')](_0x4f14('0xd'),_0x404506,JSON[_0x4f14('0x19')](_0x572cb1));logger['info'](_0x4f14('0x11'),_0x404506);})[_0x4f14('0x1a')](function(){_0x3b9683[_0x4f14('0x1b')]();});}}}catch(_0x460fde){logger[_0x4f14('0xc')](_0x4f14('0xd'),_0x404506,_[_0x4f14('0x1c')](_0x460fde)?JSON[_0x4f14('0x19')](_0x460fde):_0x460fde);logger[_0x4f14('0x1d')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x404506);_0x3b9683[_0x4f14('0x1b')]();}};}; \ 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 d19ff3f..8202cc6 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 _0x3ee6=['[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','push','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error'];(function(_0x3df4b8,_0x22bedd){var _0x1abd96=function(_0x215194){while(--_0x215194){_0x3df4b8['push'](_0x3df4b8['shift']());}};_0x1abd96(++_0x22bedd);}(_0x3ee6,0xd0));var _0x63ee=function(_0x42215b,_0x4877ff){_0x42215b=_0x42215b-0x0;var _0x5cb7d1=_0x3ee6[_0x42215b];return _0x5cb7d1;};'use strict';var rp=require(_0x63ee('0x0'));var logger=require(_0x63ee('0x1'))(_0x63ee('0x2'));var _=require(_0x63ee('0x3'));var arr=[];exports['consequence']=function(_0x43a8bf,_0x40159d){return function(_0x4e2c3e){var _0x53094f=_0x40159d[0xa];var _0x6638e0=_0x40159d[0xb];var _0x4c4157=_0x40159d[0xc];var _0x568e0e=_0x40159d[0xd];var _0x12ec36=_0x40159d[0xe];var _0x2df28a=_0x40159d[0xf][_0x63ee('0x4')](/\n/g,_0x63ee('0x5'));var _0x57c154=_0x40159d[0x10][_0x63ee('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x6638e0)){arr[_0x63ee('0x6')](_0x6638e0);var _0x2ff141=_0x40159d[0x3];var _0x5bc4cc=_0x40159d[0x4];var _0x527ec6=_0x40159d[0x1];var _0x2c5876=_0x40159d[0x0];var _0x323b43={};_0x323b43[_0x63ee('0x7')]=_0x40159d[0x8]+'?params='+_0x4c4157+'|'+_0x53094f+'|'+_0x568e0e+'|'+_0x6638e0+'|'+_0x12ec36;_0x323b43['urlOnRing']=_0x40159d[0x7]+_0x63ee('0x8')+_0x4c4157+'|'+_0x53094f+'|'+_0x568e0e+'|'+_0x6638e0+'|'+_0x12ec36+'|'+_0x2df28a+'|'+_0x57c154;_0x323b43[_0x63ee('0x9')]=_0x40159d[0x9];var _0x2c966d={};_0x2c966d[_0x63ee('0xa')]=_0x63ee('0xb');_0x2c966d[_0x63ee('0xc')]=_0x63ee('0xd');var _0x168a52=[];_0x168a52[_0x63ee('0x6')](_0x40159d[0x2]);_0x168a52[_0x63ee('0x6')](_0x40159d[0x5]);_0x168a52['push'](_0x40159d[0x6]);_0x2c966d[_0x63ee('0xe')]=_0x168a52;_0x2c966d['id']=0x1;var _0x51e2e3=JSON[_0x63ee('0xf')](_0x2c966d);var _0x25a791={'encoding':_0x63ee('0x10'),'method':_0x63ee('0x11'),'timeout':0x2710,'url':_0x2ff141,'headers':{'Content-Type':_0x63ee('0x12')},'body':_0x51e2e3};return rp(_0x25a791)[_0x63ee('0x13')](function(_0x4ac0a7){const _0x195a69=JSON[_0x63ee('0x14')](_0x4ac0a7);if(!_0x195a69[_0x63ee('0x15')][_0x63ee('0x16')]){throw new Error(_0x63ee('0x17'));}var _0x3301a5=_0x6638e0;var _0xa0b40c=_0x63ee('0x18')+_0x527ec6+_0x63ee('0x19')+_0x2c5876+'&sessionId='+_0x3301a5+_0x63ee('0x1a')+JSON[_0x63ee('0xf')](_0x323b43);var _0x167549=_0x5bc4cc+'?'+_0xa0b40c;return rp(_0x167549);})[_0x63ee('0x13')](function(_0x457c66){logger['info'](_0x63ee('0x1b'),_0x43a8bf,_0x457c66);_0x4e2c3e[_0x63ee('0x1c')]();})['catch'](function(_0x4ecf2b){logger[_0x63ee('0x1d')](_0x63ee('0x1e'),_0x43a8bf,_[_0x63ee('0x1f')](_0x4ecf2b)?JSON[_0x63ee('0xf')](_0x4ecf2b):_0x4ecf2b);_0x4e2c3e[_0x63ee('0x1c')]();});}else{logger['info'](_0x63ee('0x20'),_0x43a8bf);_0x4e2c3e[_0x63ee('0x21')]();}};}; \ No newline at end of file +var _0x209e=['method','login','params','stringify','utf8','POST','application/json-rpc','then','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','urlOnRing','title','2.0'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x209e,0x197));var _0xe209=function(_0x56016,_0x9b89aa){_0x56016=_0x56016-0x0;var _0x1fba4d=_0x209e[_0x56016];return _0x1fba4d;};'use strict';var rp=require(_0xe209('0x0'));var logger=require(_0xe209('0x1'))(_0xe209('0x2'));var _=require(_0xe209('0x3'));var arr=[];exports[_0xe209('0x4')]=function(_0x37b02c,_0x2e5c16){return function(_0x12bccf){var _0x11105b=_0x2e5c16[0xa];var _0x563a33=_0x2e5c16[0xb];var _0x504b22=_0x2e5c16[0xc];var _0x1b6148=_0x2e5c16[0xd];var _0x546f8d=_0x2e5c16[0xe];var _0x58ed37=_0x2e5c16[0xf][_0xe209('0x5')](/\n/g,_0xe209('0x6'));var _0x3c9649=_0x2e5c16[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xe209('0x7')](_0x563a33)){arr[_0xe209('0x8')](_0x563a33);var _0x27ab99=_0x2e5c16[0x3];var _0x1a24fc=_0x2e5c16[0x4];var _0x541fa0=_0x2e5c16[0x1];var _0x12c404=_0x2e5c16[0x0];var _0x28dfe5={};_0x28dfe5[_0xe209('0x9')]=_0x2e5c16[0x8]+'?params='+_0x504b22+'|'+_0x11105b+'|'+_0x1b6148+'|'+_0x563a33+'|'+_0x546f8d;_0x28dfe5[_0xe209('0xa')]=_0x2e5c16[0x7]+'?params='+_0x504b22+'|'+_0x11105b+'|'+_0x1b6148+'|'+_0x563a33+'|'+_0x546f8d+'|'+_0x58ed37+'|'+_0x3c9649;_0x28dfe5[_0xe209('0xb')]=_0x2e5c16[0x9];var _0x38a01d={};_0x38a01d['jsonrpc']=_0xe209('0xc');_0x38a01d[_0xe209('0xd')]=_0xe209('0xe');var _0x58d4e6=[];_0x58d4e6[_0xe209('0x8')](_0x2e5c16[0x2]);_0x58d4e6[_0xe209('0x8')](_0x2e5c16[0x5]);_0x58d4e6['push'](_0x2e5c16[0x6]);_0x38a01d[_0xe209('0xf')]=_0x58d4e6;_0x38a01d['id']=0x1;var _0x10cec3=JSON[_0xe209('0x10')](_0x38a01d);var _0x159e58={'encoding':_0xe209('0x11'),'method':_0xe209('0x12'),'timeout':0x2710,'url':_0x27ab99,'headers':{'Content-Type':_0xe209('0x13')},'body':_0x10cec3};return rp(_0x159e58)[_0xe209('0x14')](function(_0x38c102){const _0x1daa16=JSON['parse'](_0x38c102);if(!_0x1daa16['result'][_0xe209('0x15')]){throw new Error(_0xe209('0x16'));}var _0x54f545=_0x563a33;var _0x474640=_0xe209('0x17')+_0x541fa0+_0xe209('0x18')+_0x12c404+_0xe209('0x19')+_0x54f545+_0xe209('0x1a')+JSON[_0xe209('0x10')](_0x28dfe5);var _0x826a86=_0x1a24fc+'?'+_0x474640;return rp(_0x826a86);})[_0xe209('0x14')](function(_0x2fbac7){logger[_0xe209('0x1b')](_0xe209('0x1c'),_0x37b02c,_0x2fbac7);_0x12bccf[_0xe209('0x1d')]();})[_0xe209('0x1e')](function(_0x4148c3){logger[_0xe209('0x1f')]('[%s][TVOX]\x20%s',_0x37b02c,_[_0xe209('0x20')](_0x4148c3)?JSON[_0xe209('0x10')](_0x4148c3):_0x4148c3);_0x12bccf[_0xe209('0x1d')]();});}else{logger[_0xe209('0x1b')](_0xe209('0x21'),_0x37b02c);_0x12bccf[_0xe209('0x22')]();}};}; \ 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 41feeac..6187a15 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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x224095,_0x3f1c36){var _0x2140cb=function(_0xa9ee55){while(--_0xa9ee55){_0x224095['push'](_0x224095['shift']());}};_0x2140cb(++_0x3f1c36);}(_0xe706,0xa3));var _0x6e70=function(_0xbbfe59,_0x46067f){_0xbbfe59=_0xbbfe59-0x0;var _0x28a2a4=_0xe706[_0xbbfe59];return _0x28a2a4;};'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 +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x351e9d,_0x468878){var _0x3659e1=function(_0x22487a){while(--_0x22487a){_0x351e9d['push'](_0x351e9d['shift']());}};_0x3659e1(++_0x468878);}(_0xe706,0xa3));var _0x6e70=function(_0x5b75c4,_0xca1d42){_0x5b75c4=_0x5b75c4-0x0;var _0x6f2bda=_0xe706[_0x5b75c4];return _0x6f2bda;};'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 b513fba..ce32290 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 _0xec56=['busy','busyQueue','emit','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','bluebird','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','autoreply','appdata','split','mail','push','slice','dialogflowv2','tag','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','condition','intervals','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','info','Applications\x20executed','stringify','complete','No\x20applications\x20to\x20execute','stack','agent','agents'];(function(_0x1491a1,_0x5dd3e3){var _0x42225c=function(_0x164da6){while(--_0x164da6){_0x1491a1['push'](_0x1491a1['shift']());}};_0x42225c(++_0x5dd3e3);}(_0xec56,0x1bd));var _0x6ec5=function(_0x2342a2,_0x42d5a5){_0x2342a2=_0x2342a2-0x0;var _0x47d931=_0xec56[_0x2342a2];return _0x47d931;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x6ec5('0x1'));var BPromise=require(_0x6ec5('0x2'));var uuid=require(_0x6ec5('0x3'));var utils=require(_0x6ec5('0x4'));var config=require(_0x6ec5('0x5'));var logger=require(_0x6ec5('0x6'))(_0x6ec5('0x7'));var rpc={'openchannelQueueReport':require(_0x6ec5('0x8')),'mailQueueReport':require(_0x6ec5('0x9')),'chatQueueReport':require(_0x6ec5('0xa')),'smsQueueReport':require(_0x6ec5('0xb')),'faxQueueReport':require(_0x6ec5('0xc')),'whatsappQueueReport':require(_0x6ec5('0xd'))};var RuleEngine=require(_0x6ec5('0xe'));function getId(_0x3dd891,_0x225d2f,_0x17bcf0){return util[_0x6ec5('0xf')](_0x6ec5('0x10'),_0x3dd891,_0x225d2f||0x0,_0x17bcf0||0x0);}function getIntervals(_0x4a23b6,_0x2e880d){var _0x3ef4f6=[];if(!_[_0x6ec5('0x11')](_0x2e880d[_0x6ec5('0x12')])&&!_[_0x6ec5('0x11')](_0x4a23b6[_0x2e880d[_0x6ec5('0x12')]])&&!_[_0x6ec5('0x11')](_0x4a23b6[_0x2e880d['IntervalId']][_0x6ec5('0x13')])){_0x3ef4f6=_[_0x6ec5('0x14')](_0x4a23b6[_0x2e880d[_0x6ec5('0x12')]][_0x6ec5('0x13')],_0x6ec5('0x15'));}else if(!_[_0x6ec5('0x11')](_0x2e880d[_0x6ec5('0x15')])){_0x3ef4f6=[_0x2e880d[_0x6ec5('0x15')]];}return _0x3ef4f6;}exports['listen']=function(_0x3ed07a){_0x3ed07a['rules']={};return new BPromise(function(_0x14e9dc,_0x287542){var _0x4a4e3c={'Start':function(_0x9fc0e7){var _0xdc0b10=this;return new Promise(function(_0x4d09fe,_0x13b725){if(_0x9fc0e7){try{var _0x3df696=[];var _0x125ae6=getId(_0x9fc0e7[_0x6ec5('0x16')],_0x9fc0e7[_0x6ec5('0x17')]?_0x9fc0e7[_0x6ec5('0x17')]['id']:0x0,_0x9fc0e7[_0x6ec5('0x18')]?_0x9fc0e7[_0x6ec5('0x18')]['id']:0x0);if(_0x9fc0e7[_0x6ec5('0x19')]&&_[_0x6ec5('0x1a')](_0x9fc0e7[_0x6ec5('0x19')])&&_0x9fc0e7[_0x6ec5('0x19')][_0x6ec5('0x1b')]){for(var _0x2228dd=0x0;_0x2228dd<_0x9fc0e7[_0x6ec5('0x19')][_0x6ec5('0x1b')];_0x2228dd+=0x1){var _0x12ba7f=_0x9fc0e7['applications'][_0x2228dd];if(fs[_0x6ec5('0x1c')](path[_0x6ec5('0x1d')](__dirname,_0x6ec5('0x19'),_0x12ba7f[_0x6ec5('0x1e')]+_0x6ec5('0x1f')))){var _0x38a821=[];switch(_0x12ba7f[_0x6ec5('0x1e')]['toLowerCase']()){case _0x6ec5('0x20'):var _0x2ecdcf=_0x12ba7f[_0x6ec5('0x21')][_0x6ec5('0x22')](',');if(_0x9fc0e7['channel']===_0x6ec5('0x23')){_0x38a821[_0x6ec5('0x24')](_0x2ecdcf[0x0]);_0x38a821['push'](_0x2ecdcf[0x1]);_0x38a821[_0x6ec5('0x24')](_0x2ecdcf[_0x6ec5('0x25')](0x2,_0x2ecdcf[_0x6ec5('0x1b')])['join'](','));}else{_0x38a821[_0x6ec5('0x24')](_0x2ecdcf[0x0]);_0x38a821[_0x6ec5('0x24')](_0x2ecdcf[_0x6ec5('0x25')](0x1,_0x2ecdcf[_0x6ec5('0x1b')])[_0x6ec5('0x1d')](','));}break;case'dialogflow':var _0x171e2a=_0x12ba7f[_0x6ec5('0x21')]['split'](',');_0x38a821[_0x6ec5('0x24')](_0x171e2a[0x0]);_0x38a821[_0x6ec5('0x24')](_0x171e2a[0x1]);_0x38a821['push'](_0x171e2a[_0x6ec5('0x25')](0x2,_0x171e2a[_0x6ec5('0x1b')])[_0x6ec5('0x1d')](','));break;case _0x6ec5('0x26'):var _0x116659=_0x12ba7f['appdata'][_0x6ec5('0x22')](',');_0x38a821[_0x6ec5('0x24')](_0x116659[0x0]);_0x38a821[_0x6ec5('0x24')](_0x116659[0x1]);_0x38a821[_0x6ec5('0x24')](_0x116659[0x2]);_0x38a821[_0x6ec5('0x24')](_0x116659[0x3]);_0x38a821[_0x6ec5('0x24')](_0x116659[_0x6ec5('0x25')](0x4,_0x116659['length'])[_0x6ec5('0x1d')](','));break;case'amazonlex':var _0x15e1f6=_0x12ba7f['appdata'][_0x6ec5('0x22')](',');_0x38a821[_0x6ec5('0x24')](_0x15e1f6[0x0]);_0x38a821['push'](_0x15e1f6[0x1]);_0x38a821['push'](_0x15e1f6[0x2]);_0x38a821[_0x6ec5('0x24')](_0x15e1f6[0x3]);_0x38a821[_0x6ec5('0x24')](_0x15e1f6['slice'](0x4,_0x15e1f6[_0x6ec5('0x1b')])[_0x6ec5('0x1d')](','));break;case'message':_0x38a821[_0x6ec5('0x24')](_0x12ba7f[_0x6ec5('0x21')]);break;case _0x6ec5('0x27'):_0x38a821[_0x6ec5('0x24')](_0x12ba7f[_0x6ec5('0x28')]);_0x38a821[_0x6ec5('0x24')](_0x12ba7f[_0x6ec5('0x21')]);break;case _0x6ec5('0x29'):var _0x4b7a08=utils[_0x6ec5('0x2a')](_0x9fc0e7['account'][_0x6ec5('0x2b')],_0x9fc0e7);var _0xe1e58=_0x12ba7f[_0x6ec5('0x21')][_0x6ec5('0x22')](',');_0x38a821[_0x6ec5('0x24')](_0xe1e58[0x0]);_0x38a821[_0x6ec5('0x24')](_0xe1e58[0x1]);_0x38a821[_0x6ec5('0x24')](_0xe1e58[0x2]);_0x38a821[_0x6ec5('0x24')](_0xe1e58[0x3]);_0x38a821[_0x6ec5('0x24')](_0xe1e58[0x4]);_0x38a821[_0x6ec5('0x24')](_0xe1e58[0x5]);_0x38a821[_0x6ec5('0x24')](_0xe1e58[0x6]);_0x38a821['push'](_0xe1e58[0x7]);_0x38a821['push'](_0xe1e58[0x8]);_0x38a821[_0x6ec5('0x24')](_0xe1e58[0x9]);_0x38a821['push'](_0xe1e58[0xa]);_0x38a821[_0x6ec5('0x24')](_0x9fc0e7[_0x6ec5('0x18')]['id']);_0x38a821[_0x6ec5('0x24')](_0x9fc0e7[_0x6ec5('0x17')]['id']);_0x38a821[_0x6ec5('0x24')](_0x12ba7f[_0x6ec5('0x2c')]);_0x38a821[_0x6ec5('0x24')](_0x9fc0e7['interaction'][_0x6ec5('0x2d')]);_0x38a821[_0x6ec5('0x24')](_0x9fc0e7[_0x6ec5('0x2e')][_0x6ec5('0x2e')]);_0x38a821[_0x6ec5('0x24')](_0x4b7a08);break;default:_0x38a821=_[_0x6ec5('0x11')](_0x12ba7f[_0x6ec5('0x21')])?[]:_0x12ba7f[_0x6ec5('0x21')][_0x6ec5('0x22')](',');}var _0x53dcd8={'id':util[_0x6ec5('0xf')]('%s:%s:%s',_0x125ae6,_0x12ba7f['id'],_0x12ba7f[_0x6ec5('0x1e')]),'condition':require('./interval')[_0x6ec5('0x2f')](_0x125ae6,getIntervals(_0x3ed07a[_0x6ec5('0x30')],_0x12ba7f),_0x3ed07a),'consequence':require('./applications/'+_0x12ba7f[_0x6ec5('0x1e')])[_0x6ec5('0x31')](_0x125ae6,_0x38a821,_0x3ed07a,_0x9fc0e7),'p':_0x12ba7f[_0x6ec5('0x32')]||0x0};logger['info'](_0x6ec5('0x33'),_0x53dcd8['id'],_0x6ec5('0x34'),getIntervals(_0x3ed07a['intervals'],_0x12ba7f)[_0x6ec5('0x1d')](_0x6ec5('0x35')));_0x3df696[_0x6ec5('0x24')](_0x53dcd8);}else{logger[_0x6ec5('0x36')](_0x6ec5('0x37'),path[_0x6ec5('0x1d')](__dirname,_0x6ec5('0x19'),_0x12ba7f[_0x6ec5('0x1e')]+_0x6ec5('0x1f')));}}_0x3ed07a[_0x6ec5('0x38')][_0x125ae6]=new RuleEngine(_0x3df696);_0x3ed07a[_0x6ec5('0x38')][_0x125ae6]['execute'](_0x9fc0e7,function(_0x17cfed){logger[_0x6ec5('0x39')](_0x6ec5('0x3a'),JSON[_0x6ec5('0x3b')](_0x17cfed['matchPath']));if(_0x3ed07a[_0x6ec5('0x38')][_0x125ae6]){_0x3ed07a[_0x6ec5('0x38')][_0x125ae6]['emit'](_0x6ec5('0x3c'));}});return _0x4d09fe({'code':0xc8,'message':_0x9fc0e7});}else{logger['info'](_0x6ec5('0x3d'));return _0x4d09fe({'code':0xc8,'message':_0x9fc0e7});}}catch(_0x1de4f7){logger[_0x6ec5('0x36')](_0x1de4f7[_0x6ec5('0x3e')]);return _0x13b725(_0xdc0b10['error'](0x1f4,_0x1de4f7));}}return _0x13b725('routing\x20is\x20empty');});},'AcceptMessage':function(_0x1bbe7f){var _0x56dc23=this;return new Promise(function(_0x2e69ff,_0x3c0821){if(_0x1bbe7f[_0x6ec5('0x3f')]&&_0x1bbe7f[_0x6ec5('0x3f')]['id']){if(_0x3ed07a[_0x6ec5('0x40')][_0x1bbe7f['agent']['id']]){_0x3ed07a['agents'][_0x1bbe7f[_0x6ec5('0x3f')]['id']][_0x6ec5('0x41')]=![];_0x3ed07a[_0x6ec5('0x40')][_0x1bbe7f[_0x6ec5('0x3f')]['id']][_0x6ec5('0x42')]=undefined;}}if(_0x1bbe7f[_0x6ec5('0x17')]&&_0x1bbe7f[_0x6ec5('0x17')]['id']){try{var _0x269286=getId(_0x1bbe7f[_0x6ec5('0x16')],_0x1bbe7f[_0x6ec5('0x17')]?_0x1bbe7f[_0x6ec5('0x17')]['id']:0x0,_0x1bbe7f[_0x6ec5('0x18')]?_0x1bbe7f[_0x6ec5('0x18')]['id']:0x0);if(_0x3ed07a[_0x6ec5('0x38')][_0x269286]){_0x3ed07a['rules'][_0x269286][_0x6ec5('0x43')]('end');if(rpc[_0x1bbe7f[_0x6ec5('0x16')]+_0x6ec5('0x44')]){rpc[_0x1bbe7f['channel']+_0x6ec5('0x44')][_0x6ec5('0x45')](_0x269286,{'UserId':_0x1bbe7f['message'][_0x6ec5('0x46')]})[_0x6ec5('0x47')](function(_0x486552){logger['error'](_0x6ec5('0x48'));});}}return _0x2e69ff({'code':0xc8,'message':_0x1bbe7f});}catch(_0x49fa43){logger['error'](_0x49fa43[_0x6ec5('0x3e')]);return _0x3c0821(_0x56dc23[_0x6ec5('0x36')](0x1f4,_0x49fa43));}}logger[_0x6ec5('0x36')](_0x6ec5('0x49'));return _0x3c0821(_0x56dc23['error'](0x1f4,_0x6ec5('0x49')));});},'RejectMessage':function(_0x2a310f){var _0x2bad24=this;return new Promise(function(_0x33ec4b,_0x9bde51){if(_0x2a310f[_0x6ec5('0x3f')]&&_0x2a310f[_0x6ec5('0x3f')]['id']){try{if(_0x3ed07a[_0x6ec5('0x40')][_0x2a310f[_0x6ec5('0x3f')]['id']]){_0x3ed07a[_0x6ec5('0x40')][_0x2a310f[_0x6ec5('0x3f')]['id']][_0x6ec5('0x41')]=![];_0x3ed07a[_0x6ec5('0x40')][_0x2a310f['agent']['id']][_0x6ec5('0x42')]=undefined;}return _0x33ec4b({'code':0xc8,'message':_0x2a310f});}catch(_0x3ba190){logger['error'](_0x3ba190[_0x6ec5('0x3e')]);return _0x9bde51(_0x2bad24[_0x6ec5('0x36')](0x1f4,_0x3ba190));}}logger[_0x6ec5('0x36')](_0x6ec5('0x49'));return _0x9bde51(_0x2bad24[_0x6ec5('0x36')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x5f3d3f){var _0x282cbc=this;return new Promise(function(_0x5f056d,_0x13383a){if(_0x5f3d3f[_0x6ec5('0x16')]&&_0x5f3d3f[_0x6ec5('0x18')]&&_0x5f3d3f[_0x6ec5('0x18')]['id']){try{var _0x301e31=getId(_0x5f3d3f['channel'],_0x5f3d3f[_0x6ec5('0x17')]?_0x5f3d3f['message']['id']:0x0,_0x5f3d3f['interaction']?_0x5f3d3f['interaction']['id']:0x0);if(_0x3ed07a[_0x6ec5('0x38')][_0x301e31]){_0x3ed07a[_0x6ec5('0x38')][_0x301e31]['emit']('end');}return _0x5f056d({'code':0xc8,'message':_0x5f3d3f});}catch(_0x36d685){logger[_0x6ec5('0x36')](_0x36d685[_0x6ec5('0x3e')]);return _0x13383a(_0x282cbc[_0x6ec5('0x36')](0x1f4,_0x36d685));}}logger[_0x6ec5('0x36')]('message\x20is\x20empty');return _0x13383a(_0x282cbc[_0x6ec5('0x36')](0x1f4,_0x6ec5('0x49')));});},'AgentCapacity':function(_0x29ef66){var _0x394604=this;return new Promise(function(_0x156964,_0x522966){if(_0x3ed07a[_0x6ec5('0x40')][_0x6ec5('0x4a')](_0x29ef66['id'])){for(var _0x278c00 in _0x29ef66[_0x6ec5('0x4b')]){if(_0x29ef66[_0x6ec5('0x4b')][_0x6ec5('0x4a')](_0x278c00)){if(_0x3ed07a[_0x6ec5('0x40')][_0x29ef66['id']][_0x6ec5('0x4a')](_0x278c00+_0x6ec5('0x4c'))){_0x3ed07a[_0x6ec5('0x40')][_0x29ef66['id']][_0x278c00+_0x6ec5('0x4c')]=parseInt(_0x29ef66[_0x6ec5('0x4b')][_0x278c00],0xa);}}}_0x3ed07a[_0x6ec5('0x40')][_0x29ef66['id']][_0x6ec5('0x4d')]();return _0x156964({'code':0xc8,'message':_0x3ed07a[_0x6ec5('0x40')][_0x29ef66['id']]});}else{return _0x522966(_0x394604[_0x6ec5('0x36')](0x1f4,_0x6ec5('0x4e')));}});},'Agents':function(_0x583bce){return new Promise(function(_0x183353,_0x594ab3){var _0x34157f=_['values'](_0x3ed07a['agents']);_0x183353({'count':_0x34157f[_0x6ec5('0x1b')],'rows':_0x34157f});});},'ChatQueues':function(_0x3ac2f1){return new Promise(function(_0x191b1e,_0x352f55){var _0x1d4424=[];for(var _0x48b5a9 in _0x3ed07a[_0x6ec5('0x4f')]){if(_0x3ed07a[_0x6ec5('0x4f')][_0x6ec5('0x4a')](_0x48b5a9)){var _0x189dbc=_0x3ed07a[_0x6ec5('0x4f')][_0x48b5a9];var _0x5d81c8={'id':_0x189dbc['id'],'available':_0x189dbc[_0x6ec5('0x50')],'loggedIn':_0x189dbc[_0x6ec5('0x51')],'name':_0x189dbc[_0x6ec5('0x52')],'paused':_0x189dbc[_0x6ec5('0x53')],'waiting':_0x189dbc['waiting']};_0x1d4424[_0x6ec5('0x24')](_0x5d81c8);}}_0x191b1e({'count':_0x1d4424[_0x6ec5('0x1b')],'rows':_0x1d4424});});},'MailQueues':function(_0x566605){return new Promise(function(_0x530689,_0x12f741){var _0x18a10f=[];for(var _0x7fd652 in _0x3ed07a[_0x6ec5('0x54')]){if(_0x3ed07a[_0x6ec5('0x54')][_0x6ec5('0x4a')](_0x7fd652)){var _0x3233ab=_0x3ed07a[_0x6ec5('0x54')][_0x7fd652];var _0xdfe6c6={'id':_0x3233ab['id'],'available':_0x3233ab[_0x6ec5('0x50')],'loggedIn':_0x3233ab[_0x6ec5('0x51')],'name':_0x3233ab['name'],'paused':_0x3233ab[_0x6ec5('0x53')],'waiting':_0x3233ab[_0x6ec5('0x55')]};_0x18a10f[_0x6ec5('0x24')](_0xdfe6c6);}}_0x530689({'count':_0x18a10f[_0x6ec5('0x1b')],'rows':_0x18a10f});});},'OpenchannelQueues':function(_0x480f40){return new Promise(function(_0x26869d,_0x1ac8be){var _0x1d5ee3=[];for(var _0x1e4b50 in _0x3ed07a['openchannelQueues']){if(_0x3ed07a[_0x6ec5('0x56')][_0x6ec5('0x4a')](_0x1e4b50)){var _0x37fb7b=_0x3ed07a['openchannelQueues'][_0x1e4b50];var _0x4b325a={'id':_0x37fb7b['id'],'available':_0x37fb7b[_0x6ec5('0x50')],'loggedIn':_0x37fb7b[_0x6ec5('0x51')],'name':_0x37fb7b['name'],'paused':_0x37fb7b[_0x6ec5('0x53')],'waiting':_0x37fb7b[_0x6ec5('0x55')]};_0x1d5ee3[_0x6ec5('0x24')](_0x4b325a);}}_0x26869d({'count':_0x1d5ee3[_0x6ec5('0x1b')],'rows':_0x1d5ee3});});},'SmsQueues':function(_0x4baeb6){return new Promise(function(_0x259fc6,_0x1536ab){var _0x16f010=[];for(var _0x488642 in _0x3ed07a[_0x6ec5('0x57')]){if(_0x3ed07a[_0x6ec5('0x57')][_0x6ec5('0x4a')](_0x488642)){var _0x29da35=_0x3ed07a[_0x6ec5('0x57')][_0x488642];var _0xb7d939={'id':_0x29da35['id'],'available':_0x29da35[_0x6ec5('0x50')],'loggedIn':_0x29da35[_0x6ec5('0x51')],'name':_0x29da35['name'],'paused':_0x29da35[_0x6ec5('0x53')],'waiting':_0x29da35[_0x6ec5('0x55')]};_0x16f010['push'](_0xb7d939);}}_0x259fc6({'count':_0x16f010['length'],'rows':_0x16f010});});},'FaxQueues':function(_0x42060b){return new Promise(function(_0x30ba67,_0x7e9bd5){var _0x598c2f=[];for(var _0x4055f3 in _0x3ed07a[_0x6ec5('0x58')]){if(_0x3ed07a[_0x6ec5('0x58')][_0x6ec5('0x4a')](_0x4055f3)){var _0x55511f=_0x3ed07a[_0x6ec5('0x58')][_0x4055f3];var _0x376411={'id':_0x55511f['id'],'available':_0x55511f[_0x6ec5('0x50')],'loggedIn':_0x55511f[_0x6ec5('0x51')],'name':_0x55511f[_0x6ec5('0x52')],'paused':_0x55511f[_0x6ec5('0x53')],'waiting':_0x55511f[_0x6ec5('0x55')]};_0x598c2f[_0x6ec5('0x24')](_0x376411);}}_0x30ba67({'count':_0x598c2f[_0x6ec5('0x1b')],'rows':_0x598c2f});});},'WhatsappQueues':function(_0x5a3d2d){return new Promise(function(_0x5321e1,_0x307c53){var _0x2e79ea=[];for(var _0x3f9b98 in _0x3ed07a['whatsappQueues']){if(_0x3ed07a[_0x6ec5('0x59')]['hasOwnProperty'](_0x3f9b98)){var _0x1c6f21=_0x3ed07a[_0x6ec5('0x59')][_0x3f9b98];var _0x4e94fc={'id':_0x1c6f21['id'],'available':_0x1c6f21['available'],'loggedIn':_0x1c6f21[_0x6ec5('0x51')],'name':_0x1c6f21[_0x6ec5('0x52')],'paused':_0x1c6f21[_0x6ec5('0x53')],'waiting':_0x1c6f21[_0x6ec5('0x55')]};_0x2e79ea['push'](_0x4e94fc);}}_0x5321e1({'count':_0x2e79ea[_0x6ec5('0x1b')],'rows':_0x2e79ea});});},'ChatQueuesWaitingInteractions':function(_0x27b01b){return new Promise(function(_0x180865,_0x569fc6){var _0x5befa3=_['values'](_0x3ed07a[_0x6ec5('0x5a')]);_0x180865({'count':_0x5befa3[_0x6ec5('0x1b')],'rows':_0x5befa3});});},'MailQueuesWaitingInteractions':function(_0x2a91a9){return new Promise(function(_0x97c2f8,_0x19aef8){var _0xcbb364=_[_0x6ec5('0x5b')](_0x3ed07a['mailQueuesWaitingInteractions']);_0x97c2f8({'count':_0xcbb364[_0x6ec5('0x1b')],'rows':_0xcbb364});});},'OpenchannelQueuesWaitingInteractions':function(_0x5e6fad){return new Promise(function(_0x412ac1,_0x306bba){var _0x516d5e=_[_0x6ec5('0x5b')](_0x3ed07a[_0x6ec5('0x5c')]);_0x412ac1({'count':_0x516d5e['length'],'rows':_0x516d5e});});},'SmsQueuesWaitingInteractions':function(_0x302429){return new Promise(function(_0x268721,_0x4bed50){var _0x2d865e=_[_0x6ec5('0x5b')](_0x3ed07a[_0x6ec5('0x5d')]);_0x268721({'count':_0x2d865e['length'],'rows':_0x2d865e});});},'FaxQueuesWaitingInteractions':function(_0x49b67c){return new Promise(function(_0x454d37,_0x8f9c0e){var _0x5652ba=_[_0x6ec5('0x5b')](_0x3ed07a[_0x6ec5('0x5e')]);_0x454d37({'count':_0x5652ba[_0x6ec5('0x1b')],'rows':_0x5652ba});});},'WhatsappQueuesWaitingInteractions':function(_0xf5ab73){return new Promise(function(_0x3914ca,_0x1d7820){var _0x209b76=_[_0x6ec5('0x5b')](_0x3ed07a[_0x6ec5('0x5f')]);_0x3914ca({'count':_0x209b76[_0x6ec5('0x1b')],'rows':_0x209b76});});}};var _0x5402c0=jayson[_0x6ec5('0x60')](_0x4a4e3c)[_0x6ec5('0x61')]();_0x5402c0['on'](_0x6ec5('0x36'),function(_0x442afc){logger['error'](JSON[_0x6ec5('0x3b')](_0x442afc));return _0x287542(_0x442afc);});_0x5402c0['listen'](0x232c,_0x6ec5('0x62'),function(){console[_0x6ec5('0x63')](_0x6ec5('0x64'),0x232c);return _0x14e9dc(_0x6ec5('0x65')+0x232c);});});}; \ No newline at end of file +var _0x97f5=['message\x20is\x20empty','busy','hasOwnProperty','capacity','values','chatQueues','available','name','waiting','mailQueues','paused','openchannelQueues','loggedIn','smsQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','RPC\x20listening\x20on\x20port:','lodash','util','path','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','interval','listen','rules','channel','applications','length','join','app','.js','toLowerCase','appdata','split','push','slice','dialogflowv2','tag','tvox','getMustacheRender','account','message','ChatWebsiteId','interaction','ContactId','body','%s:%s:%s','./interval','condition','./applications/','consequence','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','update','catch'];(function(_0x3e8d2a,_0x26898f){var _0x51cb91=function(_0x49b4c2){while(--_0x49b4c2){_0x3e8d2a['push'](_0x3e8d2a['shift']());}};_0x51cb91(++_0x26898f);}(_0x97f5,0x72));var _0x597f=function(_0x52206,_0x16e7ab){_0x52206=_0x52206-0x0;var _0x87bad4=_0x97f5[_0x52206];return _0x87bad4;};'use strict';var _=require(_0x597f('0x0'));var util=require(_0x597f('0x1'));var path=require(_0x597f('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require(_0x597f('0x3'));var utils=require(_0x597f('0x4'));var config=require(_0x597f('0x5'));var logger=require(_0x597f('0x6'))(_0x597f('0x7'));var rpc={'openchannelQueueReport':require(_0x597f('0x8')),'mailQueueReport':require(_0x597f('0x9')),'chatQueueReport':require(_0x597f('0xa')),'smsQueueReport':require(_0x597f('0xb')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x597f('0xc'))};var RuleEngine=require(_0x597f('0xd'));function getId(_0x1098e6,_0x40b1cd,_0x189e0d){return util[_0x597f('0xe')]('%s.%s.%s',_0x1098e6,_0x40b1cd||0x0,_0x189e0d||0x0);}function getIntervals(_0x31c4bc,_0x5bbf3f){var _0x87960e=[];if(!_['isNil'](_0x5bbf3f['IntervalId'])&&!_[_0x597f('0xf')](_0x31c4bc[_0x5bbf3f['IntervalId']])&&!_[_0x597f('0xf')](_0x31c4bc[_0x5bbf3f[_0x597f('0x10')]][_0x597f('0x11')])){_0x87960e=_['map'](_0x31c4bc[_0x5bbf3f[_0x597f('0x10')]][_0x597f('0x11')],_0x597f('0x12'));}else if(!_[_0x597f('0xf')](_0x5bbf3f[_0x597f('0x12')])){_0x87960e=[_0x5bbf3f[_0x597f('0x12')]];}return _0x87960e;}exports[_0x597f('0x13')]=function(_0x22adab){_0x22adab[_0x597f('0x14')]={};return new BPromise(function(_0x1c0d3a,_0x3bae9c){var _0xe0f331={'Start':function(_0xf1eed0){var _0x5b6349=this;return new Promise(function(_0x44d2f2,_0x41b574){if(_0xf1eed0){try{var _0x257f1a=[];var _0x55eed9=getId(_0xf1eed0[_0x597f('0x15')],_0xf1eed0['message']?_0xf1eed0['message']['id']:0x0,_0xf1eed0['interaction']?_0xf1eed0['interaction']['id']:0x0);if(_0xf1eed0['applications']&&_['isArray'](_0xf1eed0[_0x597f('0x16')])&&_0xf1eed0[_0x597f('0x16')]['length']){for(var _0x1d7474=0x0;_0x1d7474<_0xf1eed0[_0x597f('0x16')][_0x597f('0x17')];_0x1d7474+=0x1){var _0x3d0862=_0xf1eed0['applications'][_0x1d7474];if(fs['existsSync'](path[_0x597f('0x18')](__dirname,_0x597f('0x16'),_0x3d0862[_0x597f('0x19')]+_0x597f('0x1a')))){var _0x599bed=[];switch(_0x3d0862['app'][_0x597f('0x1b')]()){case'autoreply':var _0x59611d=_0x3d0862[_0x597f('0x1c')][_0x597f('0x1d')](',');if(_0xf1eed0[_0x597f('0x15')]==='mail'){_0x599bed['push'](_0x59611d[0x0]);_0x599bed['push'](_0x59611d[0x1]);_0x599bed[_0x597f('0x1e')](_0x59611d[_0x597f('0x1f')](0x2,_0x59611d['length'])[_0x597f('0x18')](','));}else{_0x599bed[_0x597f('0x1e')](_0x59611d[0x0]);_0x599bed[_0x597f('0x1e')](_0x59611d['slice'](0x1,_0x59611d['length'])[_0x597f('0x18')](','));}break;case'dialogflow':var _0x16bc39=_0x3d0862[_0x597f('0x1c')][_0x597f('0x1d')](',');_0x599bed[_0x597f('0x1e')](_0x16bc39[0x0]);_0x599bed[_0x597f('0x1e')](_0x16bc39[0x1]);_0x599bed[_0x597f('0x1e')](_0x16bc39[_0x597f('0x1f')](0x2,_0x16bc39['length'])['join'](','));break;case _0x597f('0x20'):var _0x508d4e=_0x3d0862[_0x597f('0x1c')][_0x597f('0x1d')](',');_0x599bed[_0x597f('0x1e')](_0x508d4e[0x0]);_0x599bed[_0x597f('0x1e')](_0x508d4e[0x1]);_0x599bed[_0x597f('0x1e')](_0x508d4e[0x2]);_0x599bed[_0x597f('0x1e')](_0x508d4e[0x3]);_0x599bed[_0x597f('0x1e')](_0x508d4e['slice'](0x4,_0x508d4e['length'])[_0x597f('0x18')](','));break;case'amazonlex':var _0x22ae6b=_0x3d0862[_0x597f('0x1c')][_0x597f('0x1d')](',');_0x599bed[_0x597f('0x1e')](_0x22ae6b[0x0]);_0x599bed['push'](_0x22ae6b[0x1]);_0x599bed[_0x597f('0x1e')](_0x22ae6b[0x2]);_0x599bed[_0x597f('0x1e')](_0x22ae6b[0x3]);_0x599bed['push'](_0x22ae6b[_0x597f('0x1f')](0x4,_0x22ae6b[_0x597f('0x17')])[_0x597f('0x18')](','));break;case'message':_0x599bed['push'](_0x3d0862[_0x597f('0x1c')]);break;case _0x597f('0x21'):_0x599bed[_0x597f('0x1e')](_0x3d0862['TagId']);_0x599bed['push'](_0x3d0862[_0x597f('0x1c')]);break;case _0x597f('0x22'):var _0x3d7137=utils[_0x597f('0x23')](_0xf1eed0[_0x597f('0x24')]['notificationTemplate'],_0xf1eed0);var _0x8335af=_0x3d0862[_0x597f('0x1c')][_0x597f('0x1d')](',');_0x599bed[_0x597f('0x1e')](_0x8335af[0x0]);_0x599bed[_0x597f('0x1e')](_0x8335af[0x1]);_0x599bed[_0x597f('0x1e')](_0x8335af[0x2]);_0x599bed[_0x597f('0x1e')](_0x8335af[0x3]);_0x599bed['push'](_0x8335af[0x4]);_0x599bed[_0x597f('0x1e')](_0x8335af[0x5]);_0x599bed['push'](_0x8335af[0x6]);_0x599bed[_0x597f('0x1e')](_0x8335af[0x7]);_0x599bed[_0x597f('0x1e')](_0x8335af[0x8]);_0x599bed[_0x597f('0x1e')](_0x8335af[0x9]);_0x599bed['push'](_0x8335af[0xa]);_0x599bed[_0x597f('0x1e')](_0xf1eed0['interaction']['id']);_0x599bed[_0x597f('0x1e')](_0xf1eed0[_0x597f('0x25')]['id']);_0x599bed[_0x597f('0x1e')](_0x3d0862[_0x597f('0x26')]);_0x599bed[_0x597f('0x1e')](_0xf1eed0[_0x597f('0x27')][_0x597f('0x28')]);_0x599bed[_0x597f('0x1e')](_0xf1eed0['body'][_0x597f('0x29')]);_0x599bed[_0x597f('0x1e')](_0x3d7137);break;default:_0x599bed=_[_0x597f('0xf')](_0x3d0862['appdata'])?[]:_0x3d0862['appdata']['split'](',');}var _0x1ea2f2={'id':util[_0x597f('0xe')](_0x597f('0x2a'),_0x55eed9,_0x3d0862['id'],_0x3d0862['app']),'condition':require(_0x597f('0x2b'))[_0x597f('0x2c')](_0x55eed9,getIntervals(_0x22adab['intervals'],_0x3d0862),_0x22adab),'consequence':require(_0x597f('0x2d')+_0x3d0862[_0x597f('0x19')])[_0x597f('0x2e')](_0x55eed9,_0x599bed,_0x22adab,_0xf1eed0),'p':_0x3d0862['priority']||0x0};logger['info']('Push\x20new\x20rule',_0x1ea2f2['id'],_0x597f('0x2f'),getIntervals(_0x22adab[_0x597f('0x30')],_0x3d0862)[_0x597f('0x18')](_0x597f('0x31')));_0x257f1a[_0x597f('0x1e')](_0x1ea2f2);}else{logger[_0x597f('0x32')](_0x597f('0x33'),path[_0x597f('0x18')](__dirname,_0x597f('0x16'),_0x3d0862[_0x597f('0x19')]+'.js'));}}_0x22adab['rules'][_0x55eed9]=new RuleEngine(_0x257f1a);_0x22adab[_0x597f('0x14')][_0x55eed9][_0x597f('0x34')](_0xf1eed0,function(_0x31ad81){logger[_0x597f('0x35')](_0x597f('0x36'),JSON[_0x597f('0x37')](_0x31ad81[_0x597f('0x38')]));if(_0x22adab['rules'][_0x55eed9]){_0x22adab[_0x597f('0x14')][_0x55eed9][_0x597f('0x39')](_0x597f('0x3a'));}});return _0x44d2f2({'code':0xc8,'message':_0xf1eed0});}else{logger[_0x597f('0x35')](_0x597f('0x3b'));return _0x44d2f2({'code':0xc8,'message':_0xf1eed0});}}catch(_0x9e4a37){logger['error'](_0x9e4a37[_0x597f('0x3c')]);return _0x41b574(_0x5b6349[_0x597f('0x32')](0x1f4,_0x9e4a37));}}return _0x41b574(_0x597f('0x3d'));});},'AcceptMessage':function(_0xce0e8b){var _0x5c5085=this;return new Promise(function(_0x392124,_0x5dc72e){if(_0xce0e8b['agent']&&_0xce0e8b[_0x597f('0x3e')]['id']){if(_0x22adab[_0x597f('0x3f')][_0xce0e8b[_0x597f('0x3e')]['id']]){_0x22adab[_0x597f('0x3f')][_0xce0e8b[_0x597f('0x3e')]['id']]['busy']=![];_0x22adab[_0x597f('0x3f')][_0xce0e8b[_0x597f('0x3e')]['id']][_0x597f('0x40')]=undefined;}}if(_0xce0e8b[_0x597f('0x25')]&&_0xce0e8b[_0x597f('0x25')]['id']){try{var _0x471b50=getId(_0xce0e8b['channel'],_0xce0e8b[_0x597f('0x25')]?_0xce0e8b[_0x597f('0x25')]['id']:0x0,_0xce0e8b[_0x597f('0x27')]?_0xce0e8b['interaction']['id']:0x0);if(_0x22adab['rules'][_0x471b50]){_0x22adab[_0x597f('0x14')][_0x471b50][_0x597f('0x39')]('end');if(rpc[_0xce0e8b[_0x597f('0x15')]+'QueueReport']){rpc[_0xce0e8b[_0x597f('0x15')]+_0x597f('0x41')][_0x597f('0x42')](_0x471b50,{'UserId':_0xce0e8b[_0x597f('0x25')]['UserId']})[_0x597f('0x43')](function(_0x32137c){logger[_0x597f('0x32')]('error\x20update\x20queue\x20report');});}}return _0x392124({'code':0xc8,'message':_0xce0e8b});}catch(_0x24e1b2){logger['error'](_0x24e1b2[_0x597f('0x3c')]);return _0x5dc72e(_0x5c5085['error'](0x1f4,_0x24e1b2));}}logger[_0x597f('0x32')]('message\x20is\x20empty');return _0x5dc72e(_0x5c5085[_0x597f('0x32')](0x1f4,_0x597f('0x44')));});},'RejectMessage':function(_0x27c6f1){var _0x2958f1=this;return new Promise(function(_0x3a67db,_0x2bac8b){if(_0x27c6f1[_0x597f('0x3e')]&&_0x27c6f1[_0x597f('0x3e')]['id']){try{if(_0x22adab[_0x597f('0x3f')][_0x27c6f1['agent']['id']]){_0x22adab[_0x597f('0x3f')][_0x27c6f1['agent']['id']][_0x597f('0x45')]=![];_0x22adab[_0x597f('0x3f')][_0x27c6f1['agent']['id']]['busyQueue']=undefined;}return _0x3a67db({'code':0xc8,'message':_0x27c6f1});}catch(_0x56763a){logger[_0x597f('0x32')](_0x56763a[_0x597f('0x3c')]);return _0x2bac8b(_0x2958f1[_0x597f('0x32')](0x1f4,_0x56763a));}}logger[_0x597f('0x32')]('message\x20is\x20empty');return _0x2bac8b(_0x2958f1[_0x597f('0x32')](0x1f4,_0x597f('0x44')));});},'AbandonInteraction':function(_0x36020c){var _0x39dbf7=this;return new Promise(function(_0x165f46,_0x2124b9){if(_0x36020c['channel']&&_0x36020c[_0x597f('0x27')]&&_0x36020c[_0x597f('0x27')]['id']){try{var _0x41fc3e=getId(_0x36020c[_0x597f('0x15')],_0x36020c[_0x597f('0x25')]?_0x36020c[_0x597f('0x25')]['id']:0x0,_0x36020c[_0x597f('0x27')]?_0x36020c['interaction']['id']:0x0);if(_0x22adab[_0x597f('0x14')][_0x41fc3e]){_0x22adab['rules'][_0x41fc3e][_0x597f('0x39')]('end');}return _0x165f46({'code':0xc8,'message':_0x36020c});}catch(_0x3f0cdc){logger[_0x597f('0x32')](_0x3f0cdc[_0x597f('0x3c')]);return _0x2124b9(_0x39dbf7[_0x597f('0x32')](0x1f4,_0x3f0cdc));}}logger[_0x597f('0x32')]('message\x20is\x20empty');return _0x2124b9(_0x39dbf7[_0x597f('0x32')](0x1f4,_0x597f('0x44')));});},'AgentCapacity':function(_0x4dab7f){var _0x3fd8c5=this;return new Promise(function(_0x3840aa,_0x331206){if(_0x22adab[_0x597f('0x3f')][_0x597f('0x46')](_0x4dab7f['id'])){for(var _0xd9cff0 in _0x4dab7f[_0x597f('0x47')]){if(_0x4dab7f[_0x597f('0x47')]['hasOwnProperty'](_0xd9cff0)){if(_0x22adab[_0x597f('0x3f')][_0x4dab7f['id']]['hasOwnProperty'](_0xd9cff0+'CurrentCapacity')){_0x22adab[_0x597f('0x3f')][_0x4dab7f['id']][_0xd9cff0+'CurrentCapacity']=parseInt(_0x4dab7f['capacity'][_0xd9cff0],0xa);}}}_0x22adab[_0x597f('0x3f')][_0x4dab7f['id']]['updateRealtime']();return _0x3840aa({'code':0xc8,'message':_0x22adab[_0x597f('0x3f')][_0x4dab7f['id']]});}else{return _0x331206(_0x3fd8c5[_0x597f('0x32')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x3e8808){return new Promise(function(_0x793bf9,_0x35f3c2){var _0x6181db=_[_0x597f('0x48')](_0x22adab[_0x597f('0x3f')]);_0x793bf9({'count':_0x6181db[_0x597f('0x17')],'rows':_0x6181db});});},'ChatQueues':function(_0x869239){return new Promise(function(_0xc37638,_0x371675){var _0x154f43=[];for(var _0x118f62 in _0x22adab[_0x597f('0x49')]){if(_0x22adab[_0x597f('0x49')]['hasOwnProperty'](_0x118f62)){var _0x93b356=_0x22adab[_0x597f('0x49')][_0x118f62];var _0x47e771={'id':_0x93b356['id'],'available':_0x93b356[_0x597f('0x4a')],'loggedIn':_0x93b356['loggedIn'],'name':_0x93b356[_0x597f('0x4b')],'paused':_0x93b356['paused'],'waiting':_0x93b356[_0x597f('0x4c')]};_0x154f43[_0x597f('0x1e')](_0x47e771);}}_0xc37638({'count':_0x154f43['length'],'rows':_0x154f43});});},'MailQueues':function(_0x468fd0){return new Promise(function(_0x5c66d1,_0xbf9ccc){var _0x47b060=[];for(var _0x719c38 in _0x22adab[_0x597f('0x4d')]){if(_0x22adab[_0x597f('0x4d')][_0x597f('0x46')](_0x719c38)){var _0x3139bc=_0x22adab['mailQueues'][_0x719c38];var _0x266e9a={'id':_0x3139bc['id'],'available':_0x3139bc['available'],'loggedIn':_0x3139bc['loggedIn'],'name':_0x3139bc[_0x597f('0x4b')],'paused':_0x3139bc[_0x597f('0x4e')],'waiting':_0x3139bc['waiting']};_0x47b060['push'](_0x266e9a);}}_0x5c66d1({'count':_0x47b060[_0x597f('0x17')],'rows':_0x47b060});});},'OpenchannelQueues':function(_0x748cd0){return new Promise(function(_0x9504fb,_0x393711){var _0x4e2ea6=[];for(var _0x5a18bf in _0x22adab[_0x597f('0x4f')]){if(_0x22adab[_0x597f('0x4f')][_0x597f('0x46')](_0x5a18bf)){var _0x1ec264=_0x22adab[_0x597f('0x4f')][_0x5a18bf];var _0x2f7879={'id':_0x1ec264['id'],'available':_0x1ec264[_0x597f('0x4a')],'loggedIn':_0x1ec264[_0x597f('0x50')],'name':_0x1ec264[_0x597f('0x4b')],'paused':_0x1ec264['paused'],'waiting':_0x1ec264[_0x597f('0x4c')]};_0x4e2ea6[_0x597f('0x1e')](_0x2f7879);}}_0x9504fb({'count':_0x4e2ea6[_0x597f('0x17')],'rows':_0x4e2ea6});});},'SmsQueues':function(_0x5543e6){return new Promise(function(_0x533441,_0x30f1ab){var _0x27aebd=[];for(var _0x37c654 in _0x22adab[_0x597f('0x51')]){if(_0x22adab[_0x597f('0x51')][_0x597f('0x46')](_0x37c654)){var _0x8ddf1=_0x22adab[_0x597f('0x51')][_0x37c654];var _0x55836c={'id':_0x8ddf1['id'],'available':_0x8ddf1[_0x597f('0x4a')],'loggedIn':_0x8ddf1[_0x597f('0x50')],'name':_0x8ddf1['name'],'paused':_0x8ddf1['paused'],'waiting':_0x8ddf1['waiting']};_0x27aebd[_0x597f('0x1e')](_0x55836c);}}_0x533441({'count':_0x27aebd[_0x597f('0x17')],'rows':_0x27aebd});});},'FaxQueues':function(_0x509807){return new Promise(function(_0x2b5826,_0x79fd2b){var _0x1563bf=[];for(var _0x40a961 in _0x22adab['faxQueues']){if(_0x22adab['faxQueues'][_0x597f('0x46')](_0x40a961)){var _0x328ef5=_0x22adab['faxQueues'][_0x40a961];var _0x1bc5ed={'id':_0x328ef5['id'],'available':_0x328ef5[_0x597f('0x4a')],'loggedIn':_0x328ef5['loggedIn'],'name':_0x328ef5[_0x597f('0x4b')],'paused':_0x328ef5[_0x597f('0x4e')],'waiting':_0x328ef5[_0x597f('0x4c')]};_0x1563bf['push'](_0x1bc5ed);}}_0x2b5826({'count':_0x1563bf[_0x597f('0x17')],'rows':_0x1563bf});});},'WhatsappQueues':function(_0x50d17f){return new Promise(function(_0xeb9f62,_0x4190c2){var _0x3b31ac=[];for(var _0x5172d9 in _0x22adab[_0x597f('0x52')]){if(_0x22adab['whatsappQueues']['hasOwnProperty'](_0x5172d9)){var _0x53ba5e=_0x22adab['whatsappQueues'][_0x5172d9];var _0x8a057={'id':_0x53ba5e['id'],'available':_0x53ba5e[_0x597f('0x4a')],'loggedIn':_0x53ba5e[_0x597f('0x50')],'name':_0x53ba5e[_0x597f('0x4b')],'paused':_0x53ba5e['paused'],'waiting':_0x53ba5e['waiting']};_0x3b31ac[_0x597f('0x1e')](_0x8a057);}}_0xeb9f62({'count':_0x3b31ac['length'],'rows':_0x3b31ac});});},'ChatQueuesWaitingInteractions':function(_0x11f13c){return new Promise(function(_0x39689a,_0x40b97b){var _0x5d104e=_[_0x597f('0x48')](_0x22adab[_0x597f('0x53')]);_0x39689a({'count':_0x5d104e['length'],'rows':_0x5d104e});});},'MailQueuesWaitingInteractions':function(_0x537277){return new Promise(function(_0x502b9e,_0x41aa6c){var _0x2c42d0=_[_0x597f('0x48')](_0x22adab[_0x597f('0x54')]);_0x502b9e({'count':_0x2c42d0[_0x597f('0x17')],'rows':_0x2c42d0});});},'OpenchannelQueuesWaitingInteractions':function(_0x3f56c){return new Promise(function(_0x1cba8a,_0x376574){var _0x365a6b=_[_0x597f('0x48')](_0x22adab[_0x597f('0x55')]);_0x1cba8a({'count':_0x365a6b[_0x597f('0x17')],'rows':_0x365a6b});});},'SmsQueuesWaitingInteractions':function(_0x41ec20){return new Promise(function(_0x211b52,_0x5432b0){var _0x2fec5a=_[_0x597f('0x48')](_0x22adab[_0x597f('0x56')]);_0x211b52({'count':_0x2fec5a[_0x597f('0x17')],'rows':_0x2fec5a});});},'FaxQueuesWaitingInteractions':function(_0x7e53ef){return new Promise(function(_0x3ca1a7,_0x5866c3){var _0x3d70bd=_[_0x597f('0x48')](_0x22adab[_0x597f('0x57')]);_0x3ca1a7({'count':_0x3d70bd[_0x597f('0x17')],'rows':_0x3d70bd});});},'WhatsappQueuesWaitingInteractions':function(_0x42a2fa){return new Promise(function(_0x627e3a,_0x152c2f){var _0x1d49f4=_[_0x597f('0x48')](_0x22adab[_0x597f('0x58')]);_0x627e3a({'count':_0x1d49f4[_0x597f('0x17')],'rows':_0x1d49f4});});}};var _0x2c496f=jayson['server'](_0xe0f331)[_0x597f('0x59')]();_0x2c496f['on'](_0x597f('0x32'),function(_0x1b551a){logger['error'](JSON[_0x597f('0x37')](_0x1b551a));return _0x3bae9c(_0x1b551a);});_0x2c496f['listen'](0x232c,'127.0.0.1',function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x1c0d3a(_0x597f('0x5a')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 3e8b5cd..2cf7b88 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 _0xffff=['util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','then','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20'];(function(_0x517d04,_0x40bbba){var _0x5063f5=function(_0x2bbd58){while(--_0x2bbd58){_0x517d04['push'](_0x517d04['shift']());}};_0x5063f5(++_0x40bbba);}(_0xffff,0x78));var _0xffff=function(_0x383c64,_0x245ca6){_0x383c64=_0x383c64-0x0;var _0x2467fd=_0xffff[_0x383c64];return _0x2467fd;};'use strict';var util=require(_0xffff('0x0'));var BPromise=require(_0xffff('0x1'));var jayson=require(_0xffff('0x2'));var _=require(_0xffff('0x3'));var logger=require(_0xffff('0x4'))(_0xffff('0x5'));var client=jayson[_0xffff('0x6')]['http']({'port':0x232a});function request(_0x4638ea,_0xeb58b6){return new BPromise(function(_0x2299d6,_0x456407){return client[_0xffff('0x7')](_0x4638ea,_0xeb58b6)['then'](function(_0x3c2faf){if(_0x3c2faf[_0xffff('0x8')]){return _0x456407(_0x3c2faf[_0xffff('0x8')][_0xffff('0x9')]);}else{return _0x2299d6(_0x3c2faf[_0xffff('0xa')]);}})[_0xffff('0xb')](function(_0x3246fe){return _0x456407(_0x3246fe);});});}exports[_0xffff('0xc')]=function(_0x28b077,_0x25cf9f,_0x3d044f){return function(_0x4ac526){if(_0x3d044f[_0xffff('0xd')]&&!_0x3d044f['rules'][_0x28b077]){logger[_0xffff('0xe')](_0xffff('0xf'),_0x28b077);return _0x4ac526[_0xffff('0x10')]();}var _0x21a1b8=[];for(var _0x131069=0x0;_0x131069<_0x25cf9f[_0xffff('0x11')];_0x131069+=0x1){_0x21a1b8['push'](request(_0xffff('0x12'),{'command':util[_0xffff('0x13')]('iftime\x20%s',_0x25cf9f[_0x131069])})[_0xffff('0x14')](function(_0x2a1da2){return _0x2a1da2&&_0x2a1da2['message']&&_0x2a1da2[_0xffff('0x9')][_0xffff('0x15')](_0xffff('0x16'))>=0x0?!![]:![];})[_0xffff('0xb')](function(_0x3ece9f){logger['error'](_0xffff('0x17'),_0x28b077,_0x25cf9f[_0x131069]);}));}BPromise[_0xffff('0x18')](_0x21a1b8)[_0xffff('0x14')](function(_0x29f358){var _0xde1fa1=_['some'](_0x29f358);logger[_0xffff('0xe')](_0xffff('0x19'),_0x28b077,_0x25cf9f[_0xffff('0x1a')]('\x20|\x20'),_0xde1fa1);_0x4ac526[_0xffff('0x1b')](_0xde1fa1);})[_0xffff('0xb')](function(_0x3d6ac1){console[_0xffff('0x1c')](_0x3d6ac1);logger[_0xffff('0x8')](_0xffff('0x19'),_0x28b077,_0x25cf9f[_0xffff('0x1a')](_0xffff('0x1d')),_0x3d6ac1['stack']);_0x4ac526[_0xffff('0x10')]();});};}; \ No newline at end of file +var _0xfa63=['../../../config/logger','routing','client','http','request','then','error','message','result','catch','rules','stop','length','Command','iftime\x20%s','indexOf','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','util','bluebird','jayson/promise','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa63,0xdc));var _0x3fa6=function(_0x691cd3,_0x40fc55){_0x691cd3=_0x691cd3-0x0;var _0x12324d=_0xfa63[_0x691cd3];return _0x12324d;};'use strict';var util=require(_0x3fa6('0x0'));var BPromise=require(_0x3fa6('0x1'));var jayson=require(_0x3fa6('0x2'));var _=require(_0x3fa6('0x3'));var logger=require(_0x3fa6('0x4'))(_0x3fa6('0x5'));var client=jayson[_0x3fa6('0x6')][_0x3fa6('0x7')]({'port':0x232a});function request(_0x4e1d08,_0xef8a0a){return new BPromise(function(_0x4cdb97,_0x4b6b0b){return client[_0x3fa6('0x8')](_0x4e1d08,_0xef8a0a)[_0x3fa6('0x9')](function(_0x3f5e2d){if(_0x3f5e2d[_0x3fa6('0xa')]){return _0x4b6b0b(_0x3f5e2d[_0x3fa6('0xa')][_0x3fa6('0xb')]);}else{return _0x4cdb97(_0x3f5e2d[_0x3fa6('0xc')]);}})[_0x3fa6('0xd')](function(_0x3c52fd){return _0x4b6b0b(_0x3c52fd);});});}exports['condition']=function(_0x556b83,_0x5b2df4,_0x351797){return function(_0x515aa7){if(_0x351797[_0x3fa6('0xe')]&&!_0x351797[_0x3fa6('0xe')][_0x556b83]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x556b83);return _0x515aa7[_0x3fa6('0xf')]();}var _0x807865=[];for(var _0x1a207f=0x0;_0x1a207f<_0x5b2df4[_0x3fa6('0x10')];_0x1a207f+=0x1){_0x807865['push'](request(_0x3fa6('0x11'),{'command':util['format'](_0x3fa6('0x12'),_0x5b2df4[_0x1a207f])})['then'](function(_0x12d1f6){return _0x12d1f6&&_0x12d1f6[_0x3fa6('0xb')]&&_0x12d1f6[_0x3fa6('0xb')][_0x3fa6('0x13')]('true')>=0x0?!![]:![];})[_0x3fa6('0xd')](function(_0x2f9b78){logger['error']('[%s][INTERVAL]\x20%s',_0x556b83,_0x5b2df4[_0x1a207f]);}));}BPromise[_0x3fa6('0x14')](_0x807865)[_0x3fa6('0x9')](function(_0x2b183b){var _0x54da7d=_[_0x3fa6('0x15')](_0x2b183b);logger[_0x3fa6('0x16')](_0x3fa6('0x17'),_0x556b83,_0x5b2df4[_0x3fa6('0x18')](_0x3fa6('0x19')),_0x54da7d);_0x515aa7[_0x3fa6('0x1a')](_0x54da7d);})[_0x3fa6('0xd')](function(_0xcb765a){console[_0x3fa6('0x1b')](_0xcb765a);logger[_0x3fa6('0xa')](_0x3fa6('0x17'),_0x556b83,_0x5b2df4[_0x3fa6('0x18')]('\x20|\x20'),_0xcb765a['stack']);_0x515aa7[_0x3fa6('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index e38a426..d332233 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(_0x1fe9b0,_0x3f62c0){var _0x1c1486=function(_0x3516b4){while(--_0x3516b4){_0x1fe9b0['push'](_0x1fe9b0['shift']());}};_0x1c1486(++_0x3f62c0);}(_0x0fd9,0xa3));var _0x90fd=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0x0fd9[_0x32f9ca];return _0x52e083;};'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 _0x2547=['transfertargetuniqueid','clone','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','then','agentacw','agentcomplete','acw','acwtime','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','holdtime','ringtime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','secondtransfererexten'];(function(_0x13cb48,_0x14b4ba){var _0x3d41d8=function(_0x234100){while(--_0x234100){_0x13cb48['push'](_0x13cb48['shift']());}};_0x3d41d8(++_0x14b4ba);}(_0x2547,0x1cd));var _0x7254=function(_0x13458d,_0x2ce516){_0x13458d=_0x13458d-0x0;var _0xb5d95=_0x2547[_0x13458d];return _0xb5d95;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var utils=require(_0x7254('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x44b692,_0x3ea6e6){utils[_0x7254('0x2')](util[_0x7254('0x3')](_0x7254('0x4'),_0x44b692[_0x7254('0x5')],_0x44b692['channel'],_0x44b692[_0x7254('0x6')],_0x44b692[_0x7254('0x7')],_0x44b692[_0x7254('0x8')],_0x44b692[_0x7254('0x9')],_0x44b692['connectedlinenum'],_0x44b692[_0x7254('0xa')]));if(_0x44b692[_0x7254('0x6')]){utils[_0x7254('0xb')](_0x44b692['queue'])[_0x7254('0xc')](function(_0x555b2e){if(_0x555b2e){_0x44b692['type']=_0x555b2e['type'];_0x44b692[_0x7254('0xd')]=_0x44b692[_0x7254('0xe')]?_0x555b2e[_0x7254('0xf')]:![];_0x44b692[_0x7254('0x10')]=_0x44b692[_0x7254('0xd')]?_0x555b2e[_0x7254('0x11')]:0x0;}utils['request'](_0x7254('0x12'),_0x44b692);});}else{utils['request'](_0x7254('0x12'),_0x44b692);}if(_0x3ea6e6){delete transfers[_0x44b692['uniqueid']];}else{delete agents[_0x44b692[_0x7254('0x13')]];}}exports[_0x7254('0x14')]=function(_0x348d4e){try{utils[_0x7254('0x15')](util[_0x7254('0x3')](_0x7254('0x16'),_0x348d4e[_0x7254('0x5')]),_0x348d4e);agents[_0x348d4e[_0x7254('0x13')]]=_0x348d4e;agents[_0x348d4e[_0x7254('0x13')]][_0x7254('0x17')]=utils[_0x7254('0x18')]();agents[_0x348d4e[_0x7254('0x13')]][_0x7254('0xa')]='called';agents[_0x348d4e[_0x7254('0x13')]][_0x7254('0x19')]=null;agents[_0x348d4e[_0x7254('0x13')]][_0x7254('0x1a')]=null;utils[_0x7254('0x2')](util[_0x7254('0x3')](_0x7254('0x1b'),_0x348d4e['uniqueid'],agents[_0x348d4e[_0x7254('0x13')]][_0x7254('0x7')],_0x348d4e[_0x7254('0x13')]));}catch(_0x45aa93){utils[_0x7254('0x1c')](util[_0x7254('0x3')](_0x7254('0x16'),_0x348d4e[_0x7254('0x5')]),_0x45aa93);}};exports[_0x7254('0x1d')]=function(_0x3b6cb6){try{if(!_[_0x7254('0x1e')](agents[_0x3b6cb6[_0x7254('0x13')]])){utils[_0x7254('0x15')](util[_0x7254('0x3')](_0x7254('0x1f'),_0x3b6cb6[_0x7254('0x5')]),_0x3b6cb6);utils[_0x7254('0x2')](util[_0x7254('0x3')](_0x7254('0x20'),_0x3b6cb6[_0x7254('0x5')],agents[_0x3b6cb6[_0x7254('0x13')]]['membername'],_0x3b6cb6['destuniqueid']));agents[_0x3b6cb6[_0x7254('0x13')]][_0x7254('0x1d')]=!![];agents[_0x3b6cb6[_0x7254('0x13')]][_0x7254('0x21')]=utils[_0x7254('0x18')]();agents[_0x3b6cb6[_0x7254('0x13')]][_0x7254('0xa')]='timeout';agents[_0x3b6cb6[_0x7254('0x13')]][_0x7254('0x22')]=_0x7254('0x23');agents[_0x3b6cb6['destuniqueid']][_0x7254('0x24')]=_0x3b6cb6['ringtime']?parseInt(_0x3b6cb6[_0x7254('0x25')])/0x3e8:0x0;agents[_0x3b6cb6[_0x7254('0x13')]]['talktime']=0x0;unanswered[_0x7254('0x26')](_0x3b6cb6[_0x7254('0x13')]);}}catch(_0x4f684c){utils[_0x7254('0x1c')](util[_0x7254('0x3')](_0x7254('0x1f'),_0x3b6cb6[_0x7254('0x5')]),_0x4f684c);}};exports[_0x7254('0x27')]=function(_0xfe02ea){try{_['forIn'](agents,function(_0x146028,_0x2dba3f){if(_0x146028['uniqueid']==_0xfe02ea[_0x7254('0x5')]&&!_[_0x7254('0x28')](unanswered,_0x146028[_0x7254('0x13')])){utils['debug'](util[_0x7254('0x3')](_0x7254('0x29'),_0xfe02ea[_0x7254('0x5')]),_0xfe02ea);utils[_0x7254('0x2')](util[_0x7254('0x3')](_0x7254('0x2a'),_0xfe02ea[_0x7254('0x5')],_0x146028['membername'],_0x146028[_0x7254('0x13')]));_0x146028['agentringnoanswer']=!![];_0x146028['agentringnoanswerAt']=utils[_0x7254('0x18')]();_0x146028[_0x7254('0xa')]=_0x7254('0x2b');_0x146028[_0x7254('0x22')]=_0x7254('0x2b');_0x146028[_0x7254('0x24')]=_0xfe02ea[_0x7254('0x24')];_0x146028[_0x7254('0x2c')]=0x0;writeDB(_0x146028);}});}catch(_0x447515){utils[_0x7254('0x1c')](util[_0x7254('0x3')](_0x7254('0x29'),_0xfe02ea[_0x7254('0x5')]),_0x447515);}};exports[_0x7254('0x2d')]=function(_0x57a7d4){try{if(agents[_0x57a7d4[_0x7254('0x13')]]){utils[_0x7254('0x15')](util[_0x7254('0x3')](_0x7254('0x2e'),_0x57a7d4[_0x7254('0x5')]),_0x57a7d4);utils['info'](util[_0x7254('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x57a7d4[_0x7254('0x5')],agents[_0x57a7d4[_0x7254('0x13')]][_0x7254('0x7')],_0x57a7d4[_0x7254('0x13')]));agents[_0x57a7d4[_0x7254('0x13')]]['agentconnectAt']=utils[_0x7254('0x18')]();agents[_0x57a7d4['destuniqueid']][_0x7254('0x19')]=_0x57a7d4[_0x7254('0x19')];agents[_0x57a7d4['destuniqueid']][_0x7254('0x1a')]=_0x57a7d4[_0x7254('0x1a')];agents[_0x57a7d4[_0x7254('0x13')]][_0x7254('0x24')]=_0x57a7d4[_0x7254('0x25')];agents[_0x57a7d4[_0x7254('0x13')]]['lastevent']=_0x7254('0x2f');_[_0x7254('0x30')](agents,function(_0x105b8c,_0x4eca7a){if(_0x105b8c[_0x7254('0x13')]!=_0x57a7d4[_0x7254('0x13')]&&_0x105b8c[_0x7254('0x5')]==_0x57a7d4['uniqueid']){_0x105b8c[_0x7254('0x2c')]=0x0;_0x105b8c[_0x7254('0x24')]=_0x57a7d4[_0x7254('0x25')];_0x105b8c[_0x7254('0x1d')]=!![];_0x105b8c[_0x7254('0x21')]=utils['now']();_0x105b8c['lastevent']=_0x7254('0x31');_0x105b8c[_0x7254('0x22')]=_0x7254('0x31');_0x105b8c[_0x7254('0x32')]=_0x57a7d4['destuniqueid'];_0x105b8c['answeredelsewheremembername']=_0x57a7d4[_0x7254('0x7')];writeDB(_0x105b8c);}});}}catch(_0x565cd8){utils[_0x7254('0x1c')](util[_0x7254('0x3')](_0x7254('0x2e'),_0x57a7d4[_0x7254('0x5')]),_0x565cd8);}};exports['agentcomplete']=function(_0x4adf34){try{if(!_[_0x7254('0x1e')](agents[_0x4adf34[_0x7254('0x13')]])){utils[_0x7254('0x15')](util[_0x7254('0x3')](_0x7254('0x33'),_0x4adf34['uniqueid']),_0x4adf34);utils['info'](util[_0x7254('0x3')](_0x7254('0x34'),_0x4adf34[_0x7254('0x5')],agents[_0x4adf34['destuniqueid']][_0x7254('0x7')],_0x4adf34[_0x7254('0x13')]));agents[_0x4adf34['destuniqueid']][_0x7254('0xe')]=!![];agents[_0x4adf34[_0x7254('0x13')]][_0x7254('0x35')]=utils[_0x7254('0x18')]();agents[_0x4adf34['destuniqueid']][_0x7254('0x2c')]=utils[_0x7254('0x36')](agents[_0x4adf34['destuniqueid']][_0x7254('0x35')],agents[_0x4adf34[_0x7254('0x13')]][_0x7254('0x37')]);agents[_0x4adf34['destuniqueid']][_0x7254('0x22')]=_0x4adf34[_0x7254('0x22')];agents[_0x4adf34['destuniqueid']]['lastevent']=_0x7254('0x38');writeDB(agents[_0x4adf34['destuniqueid']]);}}catch(_0x2e437c){utils[_0x7254('0x1c')](util['format']('[%s][agents][agentcomplete]',_0x4adf34[_0x7254('0x5')]),_0x2e437c);}};exports[_0x7254('0x39')]=function(_0x38bcd5){try{if(!_[_0x7254('0x1e')](agents[_0x38bcd5[_0x7254('0x3a')]])){utils[_0x7254('0x15')](util['format'](_0x7254('0x3b'),_0x38bcd5['uniqueid']),_0x38bcd5);utils[_0x7254('0x2')](util[_0x7254('0x3')](_0x7254('0x3c'),_0x38bcd5['uniqueid'],agents[_0x38bcd5[_0x7254('0x3a')]][_0x7254('0x7')],agents[_0x38bcd5[_0x7254('0x3a')]]['uniqueid']));agents[_0x38bcd5[_0x7254('0x3a')]][_0x7254('0x3d')]=!![];agents[_0x38bcd5[_0x7254('0x3a')]][_0x7254('0x3e')]=_0x7254('0x3f');agents[_0x38bcd5['transfereruniqueid']]['transferexten']=_0x38bcd5[_0x7254('0x40')];agents[_0x38bcd5[_0x7254('0x3a')]][_0x7254('0x41')]=agents[_0x38bcd5[_0x7254('0x3a')]][_0x7254('0x5')];}}catch(_0x4c6838){utils['error'](util[_0x7254('0x3')](_0x7254('0x3b'),_0x38bcd5[_0x7254('0x5')]),_0x4c6838);}};exports[_0x7254('0x42')]=function(_0x5061be){try{utils[_0x7254('0x15')](util[_0x7254('0x3')]('[%s][agents][attendedtransfer]',_0x5061be[_0x7254('0x43')]),_0x5061be);if(_0x5061be['origtransfereruniqueid']==_0x5061be[_0x7254('0x44')]){if(!_['isNil'](agents[_0x5061be[_0x7254('0x45')]])){utils['info'](util['format'](_0x7254('0x46'),_0x5061be[_0x7254('0x43')],agents[_0x5061be[_0x7254('0x45')]][_0x7254('0x7')]));agents[_0x5061be['secondtransfereruniqueid']][_0x7254('0x3d')]=!![];agents[_0x5061be['secondtransfereruniqueid']][_0x7254('0x3e')]=_0x7254('0x47');agents[_0x5061be[_0x7254('0x45')]][_0x7254('0x48')]=_0x5061be[_0x7254('0x49')];agents[_0x5061be[_0x7254('0x45')]]['transferuniqueid']=_0x5061be[_0x7254('0x43')];}if(_0x5061be[_0x7254('0x4a')]&&agents[_0x5061be[_0x7254('0x4a')]]){agents[_0x5061be[_0x7254('0x4a')]][_0x7254('0x4b')]=0x1;transfers[_0x5061be[_0x7254('0x4a')]]=_['clone'](agents[_0x5061be[_0x7254('0x4a')]]);transfers[_0x5061be[_0x7254('0x4a')]][_0x7254('0x9')]=agents[_0x5061be[_0x7254('0x45')]][_0x7254('0x9')];transfers[_0x5061be[_0x7254('0x4a')]][_0x7254('0x4c')]=agents[_0x5061be['secondtransfereruniqueid']]['calleridname'];transfers[_0x5061be[_0x7254('0x4a')]]['agentcalledAt']=utils['now']();transfers[_0x5061be[_0x7254('0x4a')]][_0x7254('0x37')]=utils[_0x7254('0x18')]();transfers[_0x5061be['transfereeuniqueid']][_0x7254('0x24')]=0x0;transfers[_0x5061be['transfereeuniqueid']][_0x7254('0x4b')]=0x2;}}else if(_0x5061be[_0x7254('0x45')]==_0x5061be[_0x7254('0x4d')]){if(!_[_0x7254('0x1e')](agents[_0x5061be[_0x7254('0x43')]])){utils['info'](util[_0x7254('0x3')](_0x7254('0x46'),_0x5061be[_0x7254('0x43')],agents[_0x5061be[_0x7254('0x43')]]['membername']));agents[_0x5061be['origtransfereruniqueid']][_0x7254('0x3d')]=!![];agents[_0x5061be[_0x7254('0x43')]][_0x7254('0x3e')]=_0x7254('0x47');agents[_0x5061be[_0x7254('0x43')]][_0x7254('0x48')]=_0x5061be[_0x7254('0x4e')];agents[_0x5061be[_0x7254('0x43')]][_0x7254('0x41')]=_0x5061be[_0x7254('0x45')];}if(_0x5061be[_0x7254('0x4f')]&&agents[_0x5061be[_0x7254('0x4f')]]){agents[_0x5061be[_0x7254('0x4f')]]['agententerreason']=0x1;transfers[_0x5061be[_0x7254('0x4f')]]=_[_0x7254('0x50')](agents[_0x5061be[_0x7254('0x4f')]]);transfers[_0x5061be['transfertargetuniqueid']][_0x7254('0x9')]=agents[_0x5061be[_0x7254('0x43')]][_0x7254('0x9')];transfers[_0x5061be[_0x7254('0x4f')]]['calleridname']=agents[_0x5061be[_0x7254('0x43')]]['calleridname'];transfers[_0x5061be[_0x7254('0x4f')]][_0x7254('0x17')]=utils[_0x7254('0x18')]();transfers[_0x5061be[_0x7254('0x4f')]]['agentconnectAt']=utils[_0x7254('0x18')]();transfers[_0x5061be['transfertargetuniqueid']][_0x7254('0x24')]=0x0;transfers[_0x5061be['transfertargetuniqueid']][_0x7254('0x4b')]=0x2;}}}catch(_0x42dc64){utils[_0x7254('0x1c')](util[_0x7254('0x3')](_0x7254('0x51'),_0x5061be[_0x7254('0x43')]),_0x42dc64);}};exports[_0x7254('0x52')]=function(_0x23b89a){try{utils['debug'](util[_0x7254('0x3')]('[%s][agents][hangup]',_0x23b89a[_0x7254('0x5')]),_0x23b89a);if(agents[_0x23b89a[_0x7254('0x5')]]&&agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0x22')]===_0x7254('0x23')){if(_0x23b89a[_0x7254('0x53')]==='21'){agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0x22')]='rejected';agents[_0x23b89a[_0x7254('0x5')]]['lastevent']=_0x7254('0x54');}utils[_0x7254('0x2')](util[_0x7254('0x3')](_0x7254('0x55'),_0x23b89a[_0x7254('0x5')],agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0x7')],agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0x22')],agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0xa')]));writeDB(agents[_0x23b89a[_0x7254('0x5')]]);var _0x3f7be7=unanswered[_0x7254('0x56')](_0x23b89a[_0x7254('0x5')]);if(_0x3f7be7>-0x1){unanswered[_0x7254('0x57')](_0x3f7be7,0x1);}}if(transfers[_0x23b89a[_0x7254('0x5')]]){transfers[_0x23b89a['uniqueid']]['agentcomplete']=!![];transfers[_0x23b89a[_0x7254('0x5')]][_0x7254('0x35')]=utils['now']();transfers[_0x23b89a['uniqueid']]['talktime']=utils[_0x7254('0x36')](transfers[_0x23b89a[_0x7254('0x5')]][_0x7254('0x35')],transfers[_0x23b89a[_0x7254('0x5')]]['agentconnectAt']);transfers[_0x23b89a[_0x7254('0x5')]][_0x7254('0x22')]='agent';transfers[_0x23b89a[_0x7254('0x5')]][_0x7254('0xa')]=_0x7254('0x38');utils['info'](util['format'](_0x7254('0x55'),_0x23b89a[_0x7254('0x5')],transfers[_0x23b89a['uniqueid']][_0x7254('0x7')],transfers[_0x23b89a[_0x7254('0x5')]][_0x7254('0x22')],transfers[_0x23b89a[_0x7254('0x5')]][_0x7254('0xa')]));writeDB(transfers[_0x23b89a['uniqueid']],!![]);}if(agents[_0x23b89a[_0x7254('0x5')]]&&agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0x37')]){agents[_0x23b89a['uniqueid']][_0x7254('0xe')]=!![];agents[_0x23b89a['uniqueid']]['agentcompleteAt']=utils['now']();agents[_0x23b89a[_0x7254('0x5')]]['talktime']=utils['diffTime'](agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0x35')],agents[_0x23b89a[_0x7254('0x5')]]['agentconnectAt']);agents[_0x23b89a[_0x7254('0x5')]]['reason']=agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0x3d')]?'transfer':_0x7254('0x58');agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0xa')]=_0x7254('0x38');utils[_0x7254('0x2')](util[_0x7254('0x3')](_0x7254('0x55'),_0x23b89a['uniqueid'],agents[_0x23b89a[_0x7254('0x5')]]['membername'],agents[_0x23b89a['uniqueid']][_0x7254('0x22')],agents[_0x23b89a[_0x7254('0x5')]][_0x7254('0xa')]));writeDB(agents[_0x23b89a[_0x7254('0x5')]]);}}catch(_0x54c7d5){utils[_0x7254('0x1c')](util[_0x7254('0x3')](_0x7254('0x59'),_0x23b89a[_0x7254('0x5')]),_0x54c7d5);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 767b70e..f0a660e 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 _0x3c54=['noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','uniqueid','blinds','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','accountcode','then','UserId','CreateVoiceCallReport','recording','newchannel','format','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','newstate','debug','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','linkedid','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','endtime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','diffTime','[%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','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf'];(function(_0x486a26,_0xe30d3d){var _0x495ad3=function(_0x281a63){while(--_0x281a63){_0x486a26['push'](_0x486a26['shift']());}};_0x495ad3(++_0xe30d3d);}(_0x3c54,0x14d));var _0x43c5=function(_0x5e6054,_0x395086){_0x5e6054=_0x5e6054-0x0;var _0xee1927=_0x3c54[_0x5e6054];return _0xee1927;};'use strict';var _=require(_0x43c5('0x0'));var util=require(_0x43c5('0x1'));var utils=require(_0x43c5('0x2'));var transfers=require(_0x43c5('0x3'));var dispositions=[_0x43c5('0x4'),_0x43c5('0x5'),_0x43c5('0x5'),_0x43c5('0x4'),_0x43c5('0x4'),'NO\x20ANSWER','ANSWERED',_0x43c5('0x6'),'FAILED',_0x43c5('0x5'),'FAILED'];var channels={};function writeDB(_0x48ae46){var _0x2d1330;if(transfers['blinds'][_0x48ae46['uniqueid']]){_0x2d1330=_0x48ae46[_0x43c5('0x7')];_0x48ae46[_0x43c5('0x7')]=transfers[_0x43c5('0x8')][_0x48ae46[_0x43c5('0x7')]][_0x43c5('0x9')];}utils[_0x43c5('0xa')](util['format'](_0x43c5('0xb'),_0x48ae46[_0x43c5('0x7')],_0x48ae46[_0x43c5('0xc')],_0x48ae46['queue'],_0x48ae46[_0x43c5('0xd')],_0x48ae46[_0x43c5('0xe')],_0x48ae46[_0x43c5('0xf')],_0x48ae46['connectedlinenum'],_0x48ae46['lastevent']));if(_0x48ae46[_0x43c5('0x10')]){utils['getUserByInternal'](_0x48ae46[_0x43c5('0x10')])[_0x43c5('0x11')](function(_0x53b6ac){if(_0x53b6ac){_0x48ae46[_0x43c5('0x12')]=_0x53b6ac['id'];}utils['request'](_0x43c5('0x13'),_0x48ae46);});}else{utils['request']('CreateVoiceCallReport',_0x48ae46);}if(channels[_0x48ae46[_0x43c5('0x7')]]){delete channels[_0x48ae46[_0x43c5('0x7')]];}else if(_0x2d1330&&channels[_0x2d1330]){if(!transfers[_0x43c5('0x8')][_0x2d1330][_0x43c5('0x14')])delete transfers[_0x43c5('0x8')][_0x2d1330];delete channels[_0x2d1330];}}exports[_0x43c5('0x15')]=function(_0x15d99a){try{utils['debug'](util[_0x43c5('0x16')]('[%s][calls][newchannel]',_0x15d99a[_0x43c5('0x7')]),_0x15d99a);if(_0x15d99a[_0x43c5('0x7')]==_0x15d99a['linkedid']&&_0x15d99a['channel']!=_0x43c5('0x17')){utils[_0x43c5('0xa')](util[_0x43c5('0x16')](_0x43c5('0x18'),_0x15d99a[_0x43c5('0x7')],_0x15d99a[_0x43c5('0x19')],_0x15d99a[_0x43c5('0x1a')]));channels[_0x15d99a[_0x43c5('0x7')]]={'uniqueid':_0x15d99a[_0x43c5('0x7')],'accountcode':_0x15d99a[_0x43c5('0x10')],'source':_0x15d99a[_0x43c5('0xf')],'destination':_0x15d99a[_0x43c5('0x1a')],'destinationcontext':_0x15d99a[_0x43c5('0x19')],'channel':_0x15d99a[_0x43c5('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x43c5('0x1b')};}}catch(_0xefd68){utils[_0x43c5('0x1c')](util[_0x43c5('0x16')]('[%s][calls][newchannel]',_0x15d99a[_0x43c5('0x7')]),_0xefd68);}};exports[_0x43c5('0x1d')]=function(_0x523e87){try{utils[_0x43c5('0x1e')](util[_0x43c5('0x16')](_0x43c5('0x1f'),_0x523e87[_0x43c5('0x7')]),_0x523e87);if(!_[_0x43c5('0x20')](channels[_0x523e87['uniqueid']])&&_0x523e87['channelstate']==0x6){utils[_0x43c5('0xa')](util[_0x43c5('0x16')](_0x43c5('0x21'),_0x523e87[_0x43c5('0x7')],_0x523e87[_0x43c5('0x19')],_0x523e87['channel']));if(_[_0x43c5('0x20')](channels[_0x523e87[_0x43c5('0x7')]][_0x43c5('0x22')])){channels[_0x523e87[_0x43c5('0x7')]][_0x43c5('0x22')]=utils[_0x43c5('0x23')]();}}else if(!_[_0x43c5('0x20')](channels[_0x523e87[_0x43c5('0x24')]])&&_0x523e87[_0x43c5('0x25')]==0x6&&_0x523e87['context']!=_0x43c5('0x26')){utils[_0x43c5('0xa')](util[_0x43c5('0x16')](_0x43c5('0x27'),_0x523e87['uniqueid'],_0x523e87[_0x43c5('0x24')],_0x523e87[_0x43c5('0x19')],_0x523e87[_0x43c5('0xc')]));channels[_0x523e87['linkedid']][_0x43c5('0x10')]=_0x523e87['accountcode'];channels[_0x523e87[_0x43c5('0x24')]][_0x43c5('0x28')]=_0x523e87[_0x43c5('0xc')];if(_[_0x43c5('0x20')](channels[_0x523e87[_0x43c5('0x24')]][_0x43c5('0x29')])){channels[_0x523e87[_0x43c5('0x24')]][_0x43c5('0x29')]=utils['now']();}channels[_0x523e87[_0x43c5('0x24')]]['disposition']=dispositions[_[_0x43c5('0x2a')](_0x523e87[_0x43c5('0x25')])]||_0x43c5('0x2b');}}catch(_0x4d4649){utils[_0x43c5('0x1c')](util[_0x43c5('0x16')]('[%s][calls][newstate]',_0x523e87[_0x43c5('0x7')]),_0x4d4649);}};exports[_0x43c5('0x2c')]=function(_0x2bd129){try{if(!_[_0x43c5('0x20')](channels[_0x2bd129[_0x43c5('0x7')]])){utils['debug'](util[_0x43c5('0x16')](_0x43c5('0x2d'),_0x2bd129[_0x43c5('0x7')]),_0x2bd129);if(_[_0x43c5('0x20')](channels[_0x2bd129['uniqueid']][_0x43c5('0x2e')])){channels[_0x2bd129[_0x43c5('0x7')]][_0x43c5('0x2e')]=_0x2bd129[_0x43c5('0x2f')]+'\x20<'+_0x2bd129[_0x43c5('0xf')]+'>';}utils[_0x43c5('0xa')](util[_0x43c5('0x16')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x2bd129['uniqueid'],channels[_0x2bd129[_0x43c5('0x7')]][_0x43c5('0x2e')],_0x2bd129['cause-txt']));channels[_0x2bd129['uniqueid']]['endtime']=utils[_0x43c5('0x23')]();channels[_0x2bd129[_0x43c5('0x7')]]['duration']=utils['diffTime'](channels[_0x2bd129['uniqueid']][_0x43c5('0x30')],channels[_0x2bd129[_0x43c5('0x7')]][_0x43c5('0x31')]);channels[_0x2bd129[_0x43c5('0x7')]]['billableseconds']=channels[_0x2bd129['uniqueid']][_0x43c5('0x29')]?utils['diffTime'](channels[_0x2bd129['uniqueid']]['endtime'],channels[_0x2bd129[_0x43c5('0x7')]]['answertime']):0x0;writeDB(channels[_0x2bd129[_0x43c5('0x7')]]);}}catch(_0xed6dab){utils[_0x43c5('0x1c')](util[_0x43c5('0x16')](_0x43c5('0x2d'),_0x2bd129[_0x43c5('0x7')]),_0xed6dab);}};exports[_0x43c5('0x32')]=function(_0x5ec3de){try{if(!_[_0x43c5('0x20')](channels[_0x5ec3de[_0x43c5('0x33')]])){utils[_0x43c5('0x1e')](util[_0x43c5('0x16')](_0x43c5('0x34'),_0x5ec3de[_0x43c5('0x35')]),_0x5ec3de);if(channels[_0x5ec3de['localtwolinkedid']][_0x43c5('0xc')]==_0x5ec3de[_0x43c5('0x36')]){utils[_0x43c5('0xa')](util[_0x43c5('0x16')](_0x43c5('0x37'),_0x5ec3de[_0x43c5('0x35')],_0x5ec3de[_0x43c5('0x33')],_0x5ec3de[_0x43c5('0x38')]));channels[_0x5ec3de['localtwolinkedid']][_0x43c5('0x28')]=_0x5ec3de[_0x43c5('0x38')];channels[_0x5ec3de['localtwolinkedid']][_0x43c5('0x39')]=_0x43c5('0x3a');}else if(channels[_0x5ec3de[_0x43c5('0x33')]][_0x43c5('0xc')]=_0x5ec3de['transfertargetchannel']){utils[_0x43c5('0xa')](util[_0x43c5('0x16')](_0x43c5('0x37'),_0x5ec3de['origtransfereruniqueid'],_0x5ec3de[_0x43c5('0x33')],_0x5ec3de[_0x43c5('0x3b')]));channels[_0x5ec3de[_0x43c5('0x33')]][_0x43c5('0x28')]=_0x5ec3de[_0x43c5('0x3b')];channels[_0x5ec3de[_0x43c5('0x33')]][_0x43c5('0x39')]=_0x43c5('0x3a');}}}catch(_0x1de452){utils[_0x43c5('0x1c')](util[_0x43c5('0x16')](_0x43c5('0x34'),_0x5ec3de[_0x43c5('0x35')]),_0x1de452);}};exports[_0x43c5('0x3c')]=function(_0x4ad8f4){try{if(!_[_0x43c5('0x20')](channels[_0x4ad8f4[_0x43c5('0x7')]])){utils[_0x43c5('0x1e')](util[_0x43c5('0x16')](_0x43c5('0x3d'),_0x4ad8f4[_0x43c5('0x7')]),_0x4ad8f4);channels[_0x4ad8f4['uniqueid']][_0x43c5('0x3e')]=utils[_0x43c5('0x23')]();utils[_0x43c5('0xa')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x4ad8f4[_0x43c5('0x7')],channels[_0x4ad8f4[_0x43c5('0x7')]][_0x43c5('0x3e')]));}}catch(_0xe08128){utils[_0x43c5('0x1c')](util[_0x43c5('0x16')](_0x43c5('0x3d'),_0x4ad8f4[_0x43c5('0x7')]),_0xe08128);}};exports[_0x43c5('0x3f')]=function(_0x2146e4){try{if(!_[_0x43c5('0x20')](channels[_0x2146e4[_0x43c5('0x7')]])){utils[_0x43c5('0x1e')](util['format'](_0x43c5('0x40'),_0x2146e4['uniqueid']),_0x2146e4);if(!_[_0x43c5('0x20')](channels[_0x2146e4[_0x43c5('0x7')]]['musiconholdstartAt'])){channels[_0x2146e4[_0x43c5('0x7')]][_0x43c5('0x41')]+=utils[_0x43c5('0x42')](utils[_0x43c5('0x23')](),channels[_0x2146e4[_0x43c5('0x7')]][_0x43c5('0x3e')]);utils['info'](util[_0x43c5('0x16')](_0x43c5('0x43'),_0x2146e4['uniqueid'],channels[_0x2146e4[_0x43c5('0x7')]][_0x43c5('0x41')]));delete channels[_0x2146e4['uniqueid']][_0x43c5('0x3e')];}}}catch(_0x26cb0f){utils[_0x43c5('0x1c')](util['format'](_0x43c5('0x40'),_0x2146e4[_0x43c5('0x7')]),_0x26cb0f);}};exports[_0x43c5('0x44')]=function(_0x449855){try{if(!_[_0x43c5('0x20')](channels[_0x449855[_0x43c5('0x7')]])){utils[_0x43c5('0x1e')](util[_0x43c5('0x16')](_0x43c5('0x45'),_0x449855[_0x43c5('0x7')]),_0x449855);if(!_[_0x43c5('0x20')](_0x449855[_0x43c5('0x46')][_0x43c5('0x47')])){utils[_0x43c5('0xa')](util[_0x43c5('0x16')](_0x43c5('0x48'),_0x449855[_0x43c5('0x7')],_0x449855[_0x43c5('0x49')]));channels[_0x449855[_0x43c5('0x7')]][_0x43c5('0x4a')]=_0x449855[_0x43c5('0x49')];}if(!_[_0x43c5('0x20')](_0x449855[_0x43c5('0x46')][_0x43c5('0x4b')])){utils['info'](util['format'](_0x43c5('0x4c'),_0x449855[_0x43c5('0x7')],_0x449855['value']));channels[_0x449855[_0x43c5('0x7')]]['destination']=_0x449855[_0x43c5('0x49')];channels[_0x449855[_0x43c5('0x7')]][_0x43c5('0x2e')]='\x22'+_0x449855[_0x43c5('0x49')]+_0x43c5('0x4d')+_0x449855[_0x43c5('0x49')]+'>';}if(!_[_0x43c5('0x20')](_0x449855[_0x43c5('0x46')][_0x43c5('0x4e')])||!_[_0x43c5('0x20')](_0x449855[_0x43c5('0x46')]['xmd-callerid'])){utils[_0x43c5('0xa')](util[_0x43c5('0x16')](_0x43c5('0x4f'),_0x449855[_0x43c5('0x7')],!_[_0x43c5('0x20')](_0x449855['variable'][_0x43c5('0x4e')])?'xmd-callerid-preview':_0x43c5('0x50'),_0x449855['value']));channels[_0x449855[_0x43c5('0x7')]][_0x43c5('0x2e')]=_0x449855[_0x43c5('0x49')];}if(!_['isNil'](_0x449855['variable'][_0x43c5('0x51')])||!_[_0x43c5('0x20')](_0x449855[_0x43c5('0x46')][_0x43c5('0x52')])){utils['info'](util[_0x43c5('0x16')](_0x43c5('0x4f'),_0x449855[_0x43c5('0x7')],!_['isNil'](_0x449855[_0x43c5('0x46')]['xmd-queue'])?_0x43c5('0x51'):_0x43c5('0x52'),_0x449855[_0x43c5('0x49')]));channels[_0x449855[_0x43c5('0x7')]][_0x43c5('0x53')]='Queue';channels[_0x449855['uniqueid']][_0x43c5('0x54')]=_0x449855[_0x43c5('0x49')];channels[_0x449855[_0x43c5('0x7')]][_0x43c5('0x55')]=!![];}if(!_[_0x43c5('0x20')](_0x449855[_0x43c5('0x46')][_0x43c5('0x56')])){utils[_0x43c5('0xa')](util['format'](_0x43c5('0x57'),_0x449855[_0x43c5('0x7')],_0x449855[_0x43c5('0x49')]));channels[_0x449855[_0x43c5('0x7')]][_0x43c5('0x58')]=_0x449855[_0x43c5('0x49')];}if(!_[_0x43c5('0x20')](_0x449855[_0x43c5('0x46')][_0x43c5('0x59')])){utils['info'](util[_0x43c5('0x16')](_0x43c5('0x5a'),_0x449855[_0x43c5('0x7')],_0x449855[_0x43c5('0x49')]));channels[_0x449855[_0x43c5('0x7')]]['type']=_0x449855[_0x43c5('0x49')];}if(!_[_0x43c5('0x20')](_0x449855[_0x43c5('0x46')]['outboundrouteid'])){utils[_0x43c5('0xa')](util[_0x43c5('0x16')](_0x43c5('0x5b'),_0x449855['uniqueid'],_0x449855['value']));channels[_0x449855['uniqueid']][_0x43c5('0x5c')]=_0x449855[_0x43c5('0x49')];}if(!_[_0x43c5('0x20')](_0x449855['variable'][_0x43c5('0x5d')])){utils[_0x43c5('0xa')](util[_0x43c5('0x16')](_0x43c5('0x5e'),_0x449855['uniqueid'],_0x449855[_0x43c5('0x49')]));channels[_0x449855[_0x43c5('0x7')]][_0x43c5('0x5d')]=_0x449855['value'];}}}catch(_0x42110d){utils['error'](util[_0x43c5('0x16')](_0x43c5('0x45'),_0x449855['uniqueid']),_0x42110d);}};exports[_0x43c5('0x5f')]=function(_0x10f61f){try{if(!_[_0x43c5('0x20')](channels[_0x10f61f[_0x43c5('0x7')]])){utils['debug'](util['format'](_0x43c5('0x60'),_0x10f61f[_0x43c5('0x7')]),_0x10f61f);utils[_0x43c5('0xa')](util[_0x43c5('0x16')](_0x43c5('0x61'),_0x10f61f[_0x43c5('0x7')],_0x10f61f['application'],_0x10f61f['appdata']));if(_0x10f61f[_0x43c5('0x62')][_0x43c5('0x63')]()==_0x43c5('0x64')&&_[_0x43c5('0x65')](_0x10f61f[_0x43c5('0x66')][_0x43c5('0x63')](),_0x43c5('0x67'))){var _0x4f1c9e=_0x10f61f['appdata'][_0x43c5('0x68')]('=');var _0x5a41d4=_0x4f1c9e[0x0][_0x43c5('0x69')](_0x4f1c9e[0x0][_0x43c5('0x6a')]('(')+0x1,_0x4f1c9e[0x0]['lastIndexOf'](')'));var _0x1fe469=_0x4f1c9e[0x1];channels[_0x10f61f[_0x43c5('0x7')]][_0x5a41d4]=_0x1fe469;}if(!_['includes']([_0x43c5('0x2c'),_0x43c5('0x6b'),_0x43c5('0x6c'),_0x43c5('0x64'),_0x43c5('0x6d')],_0x10f61f[_0x43c5('0x62')][_0x43c5('0x63')]())){channels[_0x10f61f[_0x43c5('0x7')]][_0x43c5('0x53')]=_0x10f61f[_0x43c5('0x62')];channels[_0x10f61f['uniqueid']][_0x43c5('0x54')]=_0x10f61f[_0x43c5('0x66')];}}}catch(_0x5cb8bd){utils[_0x43c5('0x1c')](util['format'](_0x43c5('0x60'),_0x10f61f[_0x43c5('0x7')]),_0x5cb8bd);}}; \ No newline at end of file +var _0x8579=['_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%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','destination','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','uniqueid','blinds','transfereeuniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','format','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','disposition','ANSWERED','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','endtime','billableseconds','answertime','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel'];(function(_0x5520f8,_0x3a53cb){var _0x4478ad=function(_0x13128a){while(--_0x13128a){_0x5520f8['push'](_0x5520f8['shift']());}};_0x4478ad(++_0x3a53cb);}(_0x8579,0x16c));var _0x9857=function(_0x20665a,_0x1ce83b){_0x20665a=_0x20665a-0x0;var _0x118cad=_0x8579[_0x20665a];return _0x118cad;};'use strict';var _=require(_0x9857('0x0'));var util=require(_0x9857('0x1'));var utils=require('./utils');var transfers=require(_0x9857('0x2'));var dispositions=[_0x9857('0x3'),_0x9857('0x4'),_0x9857('0x4'),'NO\x20ANSWER','NO\x20ANSWER','NO\x20ANSWER','ANSWERED',_0x9857('0x5'),_0x9857('0x4'),_0x9857('0x4'),_0x9857('0x4')];var channels={};function writeDB(_0x3f0977){var _0x3a36cd;if(transfers['blinds'][_0x3f0977[_0x9857('0x6')]]){_0x3a36cd=_0x3f0977[_0x9857('0x6')];_0x3f0977[_0x9857('0x6')]=transfers[_0x9857('0x7')][_0x3f0977[_0x9857('0x6')]][_0x9857('0x8')];}utils['info'](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3f0977[_0x9857('0x6')],_0x3f0977[_0x9857('0x9')],_0x3f0977[_0x9857('0xa')],_0x3f0977[_0x9857('0xb')],_0x3f0977[_0x9857('0xc')],_0x3f0977[_0x9857('0xd')],_0x3f0977[_0x9857('0xe')],_0x3f0977[_0x9857('0xf')]));if(_0x3f0977[_0x9857('0x10')]){utils[_0x9857('0x11')](_0x3f0977[_0x9857('0x10')])[_0x9857('0x12')](function(_0xaf5d4){if(_0xaf5d4){_0x3f0977[_0x9857('0x13')]=_0xaf5d4['id'];}utils[_0x9857('0x14')](_0x9857('0x15'),_0x3f0977);});}else{utils[_0x9857('0x14')](_0x9857('0x15'),_0x3f0977);}if(channels[_0x3f0977[_0x9857('0x6')]]){delete channels[_0x3f0977[_0x9857('0x6')]];}else if(_0x3a36cd&&channels[_0x3a36cd]){if(!transfers['blinds'][_0x3a36cd][_0x9857('0x16')])delete transfers[_0x9857('0x7')][_0x3a36cd];delete channels[_0x3a36cd];}}exports[_0x9857('0x17')]=function(_0x77427f){try{utils[_0x9857('0x18')](util[_0x9857('0x19')]('[%s][calls][newchannel]',_0x77427f['uniqueid']),_0x77427f);if(_0x77427f['uniqueid']==_0x77427f['linkedid']&&_0x77427f[_0x9857('0x9')]!=_0x9857('0x1a')){utils[_0x9857('0x1b')](util[_0x9857('0x19')](_0x9857('0x1c'),_0x77427f[_0x9857('0x6')],_0x77427f[_0x9857('0x1d')],_0x77427f[_0x9857('0x1e')]));channels[_0x77427f[_0x9857('0x6')]]={'uniqueid':_0x77427f[_0x9857('0x6')],'accountcode':_0x77427f['accountcode'],'source':_0x77427f[_0x9857('0xd')],'destination':_0x77427f[_0x9857('0x1e')],'destinationcontext':_0x77427f[_0x9857('0x1d')],'channel':_0x77427f[_0x9857('0x9')],'starttime':utils[_0x9857('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9857('0x3'),'amaflags':_0x9857('0x20')};}}catch(_0x3c4201){utils[_0x9857('0x21')](util['format'](_0x9857('0x22'),_0x77427f[_0x9857('0x6')]),_0x3c4201);}};exports[_0x9857('0x23')]=function(_0x2f8d3b){try{utils[_0x9857('0x18')](util[_0x9857('0x19')]('[%s][calls][newstate]',_0x2f8d3b[_0x9857('0x6')]),_0x2f8d3b);if(!_[_0x9857('0x24')](channels[_0x2f8d3b[_0x9857('0x6')]])&&_0x2f8d3b[_0x9857('0x25')]==0x6){utils[_0x9857('0x1b')](util['format'](_0x9857('0x26'),_0x2f8d3b[_0x9857('0x6')],_0x2f8d3b[_0x9857('0x1d')],_0x2f8d3b[_0x9857('0x9')]));if(_['isNil'](channels[_0x2f8d3b[_0x9857('0x6')]][_0x9857('0x27')])){channels[_0x2f8d3b[_0x9857('0x6')]]['systemanswertime']=utils[_0x9857('0x1f')]();}}else if(!_['isNil'](channels[_0x2f8d3b[_0x9857('0x28')]])&&_0x2f8d3b[_0x9857('0x25')]==0x6&&_0x2f8d3b['context']!=_0x9857('0x29')){utils[_0x9857('0x1b')](util[_0x9857('0x19')](_0x9857('0x2a'),_0x2f8d3b['uniqueid'],_0x2f8d3b[_0x9857('0x28')],_0x2f8d3b['context'],_0x2f8d3b[_0x9857('0x9')]));channels[_0x2f8d3b[_0x9857('0x28')]][_0x9857('0x10')]=_0x2f8d3b[_0x9857('0x10')];channels[_0x2f8d3b[_0x9857('0x28')]][_0x9857('0x2b')]=_0x2f8d3b[_0x9857('0x9')];if(_[_0x9857('0x24')](channels[_0x2f8d3b[_0x9857('0x28')]]['answertime'])){channels[_0x2f8d3b[_0x9857('0x28')]]['answertime']=utils['now']();}channels[_0x2f8d3b[_0x9857('0x28')]][_0x9857('0x2c')]=dispositions[_['toNumber'](_0x2f8d3b[_0x9857('0x25')])]||_0x9857('0x2d');}}catch(_0x19fe21){utils[_0x9857('0x21')](util[_0x9857('0x19')](_0x9857('0x2e'),_0x2f8d3b[_0x9857('0x6')]),_0x19fe21);}};exports[_0x9857('0x2f')]=function(_0x567905){try{if(!_['isNil'](channels[_0x567905[_0x9857('0x6')]])){utils['debug'](util[_0x9857('0x19')](_0x9857('0x30'),_0x567905[_0x9857('0x6')]),_0x567905);if(_['isNil'](channels[_0x567905[_0x9857('0x6')]][_0x9857('0x31')])){channels[_0x567905[_0x9857('0x6')]]['callerid']=_0x567905['calleridname']+'\x20<'+_0x567905[_0x9857('0xd')]+'>';}utils['info'](util[_0x9857('0x19')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x567905[_0x9857('0x6')],channels[_0x567905[_0x9857('0x6')]]['callerid'],_0x567905['cause-txt']));channels[_0x567905['uniqueid']][_0x9857('0x32')]=utils['now']();channels[_0x567905[_0x9857('0x6')]]['duration']=utils['diffTime'](channels[_0x567905[_0x9857('0x6')]][_0x9857('0x32')],channels[_0x567905[_0x9857('0x6')]]['starttime']);channels[_0x567905[_0x9857('0x6')]][_0x9857('0x33')]=channels[_0x567905[_0x9857('0x6')]][_0x9857('0x34')]?utils[_0x9857('0x35')](channels[_0x567905[_0x9857('0x6')]][_0x9857('0x32')],channels[_0x567905[_0x9857('0x6')]][_0x9857('0x34')]):0x0;writeDB(channels[_0x567905[_0x9857('0x6')]]);}}catch(_0x3332){utils[_0x9857('0x21')](util[_0x9857('0x19')](_0x9857('0x30'),_0x567905[_0x9857('0x6')]),_0x3332);}};exports[_0x9857('0x36')]=function(_0x10e1b9){try{if(!_['isNil'](channels[_0x10e1b9[_0x9857('0x37')]])){utils[_0x9857('0x18')](util[_0x9857('0x19')](_0x9857('0x38'),_0x10e1b9[_0x9857('0x39')]),_0x10e1b9);if(channels[_0x10e1b9['localtwolinkedid']][_0x9857('0x9')]==_0x10e1b9[_0x9857('0x3a')]){utils[_0x9857('0x1b')](util['format'](_0x9857('0x3b'),_0x10e1b9[_0x9857('0x39')],_0x10e1b9[_0x9857('0x37')],_0x10e1b9[_0x9857('0x3c')]));channels[_0x10e1b9[_0x9857('0x37')]][_0x9857('0x2b')]=_0x10e1b9['secondtransfererchannel'];channels[_0x10e1b9['localtwolinkedid']][_0x9857('0x3d')]='_attended';}else if(channels[_0x10e1b9['localtwolinkedid']][_0x9857('0x9')]=_0x10e1b9[_0x9857('0x3e')]){utils[_0x9857('0x1b')](util['format'](_0x9857('0x3b'),_0x10e1b9['origtransfereruniqueid'],_0x10e1b9[_0x9857('0x37')],_0x10e1b9['origtransfererchannel']));channels[_0x10e1b9[_0x9857('0x37')]][_0x9857('0x2b')]=_0x10e1b9[_0x9857('0x3f')];channels[_0x10e1b9[_0x9857('0x37')]]['userfield']=_0x9857('0x40');}}}catch(_0x582294){utils[_0x9857('0x21')](util[_0x9857('0x19')]('[%s][calls][attendedtransfer]',_0x10e1b9['origtransfereruniqueid']),_0x582294);}};exports[_0x9857('0x41')]=function(_0x4131d1){try{if(!_[_0x9857('0x24')](channels[_0x4131d1[_0x9857('0x6')]])){utils['debug'](util[_0x9857('0x19')](_0x9857('0x42'),_0x4131d1[_0x9857('0x6')]),_0x4131d1);channels[_0x4131d1[_0x9857('0x6')]][_0x9857('0x43')]=utils[_0x9857('0x1f')]();utils[_0x9857('0x1b')](util[_0x9857('0x19')](_0x9857('0x44'),_0x4131d1[_0x9857('0x6')],channels[_0x4131d1[_0x9857('0x6')]][_0x9857('0x43')]));}}catch(_0x5aa592){utils[_0x9857('0x21')](util['format'](_0x9857('0x42'),_0x4131d1[_0x9857('0x6')]),_0x5aa592);}};exports['musiconholdstop']=function(_0x22dd5a){try{if(!_[_0x9857('0x24')](channels[_0x22dd5a[_0x9857('0x6')]])){utils[_0x9857('0x18')](util['format'](_0x9857('0x45'),_0x22dd5a[_0x9857('0x6')]),_0x22dd5a);if(!_[_0x9857('0x24')](channels[_0x22dd5a['uniqueid']][_0x9857('0x43')])){channels[_0x22dd5a['uniqueid']][_0x9857('0x46')]+=utils['diffTime'](utils['now'](),channels[_0x22dd5a[_0x9857('0x6')]][_0x9857('0x43')]);utils['info'](util['format'](_0x9857('0x47'),_0x22dd5a['uniqueid'],channels[_0x22dd5a[_0x9857('0x6')]][_0x9857('0x46')]));delete channels[_0x22dd5a[_0x9857('0x6')]][_0x9857('0x43')];}}}catch(_0x503a18){utils[_0x9857('0x21')](util[_0x9857('0x19')](_0x9857('0x45'),_0x22dd5a[_0x9857('0x6')]),_0x503a18);}};exports[_0x9857('0x48')]=function(_0x1da744){try{if(!_[_0x9857('0x24')](channels[_0x1da744['uniqueid']])){utils[_0x9857('0x18')](util[_0x9857('0x19')](_0x9857('0x49'),_0x1da744[_0x9857('0x6')]),_0x1da744);if(!_[_0x9857('0x24')](_0x1da744[_0x9857('0x4a')][_0x9857('0x4b')])){utils[_0x9857('0x1b')](util[_0x9857('0x19')](_0x9857('0x4c'),_0x1da744[_0x9857('0x6')],_0x1da744[_0x9857('0x4d')]));channels[_0x1da744[_0x9857('0x6')]]['source']=_0x1da744['value'];}if(!_['isNil'](_0x1da744[_0x9857('0x4a')]['xmd-phone'])){utils[_0x9857('0x1b')](util[_0x9857('0x19')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1da744[_0x9857('0x6')],_0x1da744[_0x9857('0x4d')]));channels[_0x1da744[_0x9857('0x6')]][_0x9857('0x4e')]=_0x1da744['value'];channels[_0x1da744[_0x9857('0x6')]][_0x9857('0x31')]='\x22'+_0x1da744[_0x9857('0x4d')]+'\x22\x20<'+_0x1da744[_0x9857('0x4d')]+'>';}if(!_['isNil'](_0x1da744['variable'][_0x9857('0x4f')])||!_[_0x9857('0x24')](_0x1da744[_0x9857('0x4a')]['xmd-callerid'])){utils[_0x9857('0x1b')](util[_0x9857('0x19')](_0x9857('0x50'),_0x1da744[_0x9857('0x6')],!_[_0x9857('0x24')](_0x1da744[_0x9857('0x4a')][_0x9857('0x4f')])?'xmd-callerid-preview':_0x9857('0x51'),_0x1da744[_0x9857('0x4d')]));channels[_0x1da744['uniqueid']][_0x9857('0x31')]=_0x1da744[_0x9857('0x4d')];}if(!_[_0x9857('0x24')](_0x1da744[_0x9857('0x4a')][_0x9857('0x52')])||!_[_0x9857('0x24')](_0x1da744[_0x9857('0x4a')][_0x9857('0x53')])){utils[_0x9857('0x1b')](util[_0x9857('0x19')](_0x9857('0x50'),_0x1da744[_0x9857('0x6')],!_['isNil'](_0x1da744[_0x9857('0x4a')][_0x9857('0x52')])?_0x9857('0x52'):_0x9857('0x53'),_0x1da744[_0x9857('0x4d')]));channels[_0x1da744[_0x9857('0x6')]][_0x9857('0x54')]='Queue';channels[_0x1da744['uniqueid']][_0x9857('0x55')]=_0x1da744[_0x9857('0x4d')];channels[_0x1da744[_0x9857('0x6')]][_0x9857('0xa')]=!![];}if(!_[_0x9857('0x24')](_0x1da744[_0x9857('0x4a')][_0x9857('0x56')])){utils[_0x9857('0x1b')](util[_0x9857('0x19')](_0x9857('0x57'),_0x1da744[_0x9857('0x6')],_0x1da744[_0x9857('0x4d')]));channels[_0x1da744[_0x9857('0x6')]]['ContactId']=_0x1da744[_0x9857('0x4d')];}if(!_['isNil'](_0x1da744['variable']['xmd-cdrtype'])){utils['info'](util[_0x9857('0x19')](_0x9857('0x58'),_0x1da744[_0x9857('0x6')],_0x1da744['value']));channels[_0x1da744[_0x9857('0x6')]][_0x9857('0x59')]=_0x1da744[_0x9857('0x4d')];}if(!_[_0x9857('0x24')](_0x1da744[_0x9857('0x4a')]['outboundrouteid'])){utils[_0x9857('0x1b')](util[_0x9857('0x19')](_0x9857('0x5a'),_0x1da744[_0x9857('0x6')],_0x1da744[_0x9857('0x4d')]));channels[_0x1da744[_0x9857('0x6')]][_0x9857('0x5b')]=_0x1da744[_0x9857('0x4d')];}if(!_[_0x9857('0x24')](_0x1da744['variable']['sipcallid'])){utils['info'](util[_0x9857('0x19')](_0x9857('0x5c'),_0x1da744[_0x9857('0x6')],_0x1da744['value']));channels[_0x1da744[_0x9857('0x6')]][_0x9857('0x5d')]=_0x1da744['value'];}}}catch(_0x33abe7){utils[_0x9857('0x21')](util[_0x9857('0x19')](_0x9857('0x49'),_0x1da744['uniqueid']),_0x33abe7);}};exports['newexten']=function(_0x27ecc0){try{if(!_[_0x9857('0x24')](channels[_0x27ecc0[_0x9857('0x6')]])){utils[_0x9857('0x18')](util[_0x9857('0x19')](_0x9857('0x5e'),_0x27ecc0[_0x9857('0x6')]),_0x27ecc0);utils[_0x9857('0x1b')](util[_0x9857('0x19')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x27ecc0[_0x9857('0x6')],_0x27ecc0[_0x9857('0x5f')],_0x27ecc0['appdata']));if(_0x27ecc0['application'][_0x9857('0x60')]()==_0x9857('0x61')&&_[_0x9857('0x62')](_0x27ecc0['appdata'][_0x9857('0x60')](),_0x9857('0x63'))){var _0x44a580=_0x27ecc0['appdata'][_0x9857('0x64')]('=');var _0x5e0995=_0x44a580[0x0][_0x9857('0x65')](_0x44a580[0x0]['lastIndexOf']('(')+0x1,_0x44a580[0x0][_0x9857('0x66')](')'));var _0x1065ac=_0x44a580[0x1];channels[_0x27ecc0['uniqueid']][_0x5e0995]=_0x1065ac;}if(!_[_0x9857('0x67')]([_0x9857('0x2f'),_0x9857('0x68'),_0x9857('0x69'),_0x9857('0x61'),_0x9857('0x6a')],_0x27ecc0['application'][_0x9857('0x60')]())){channels[_0x27ecc0[_0x9857('0x6')]]['lastapplication']=_0x27ecc0[_0x9857('0x5f')];channels[_0x27ecc0['uniqueid']][_0x9857('0x55')]=_0x27ecc0['appdata'];}}}catch(_0x142765){utils[_0x9857('0x21')](util[_0x9857('0x19')](_0x9857('0x5e'),_0x27ecc0[_0x9857('0x6')]),_0x142765);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 441e7df..589321d 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 _0x5788=['[core]\x20fullybooted','error','[core]\x20close','./utils','connect','info','[core]\x20connected','shutdown','fullybooted'];(function(_0x245be0,_0x5556a2){var _0x2986e2=function(_0xb05235){while(--_0xb05235){_0x245be0['push'](_0x245be0['shift']());}};_0x2986e2(++_0x5556a2);}(_0x5788,0xdb));var _0x8578=function(_0x3f922e,_0x10829d){_0x3f922e=_0x3f922e-0x0;var _0x33f681=_0x5788[_0x3f922e];return _0x33f681;};'use strict';var utils=require(_0x8578('0x0'));exports[_0x8578('0x1')]=function(){utils[_0x8578('0x2')](_0x8578('0x3'));};exports[_0x8578('0x4')]=function(){utils['info']('[core]\x20shutdown');};exports[_0x8578('0x5')]=function(){utils[_0x8578('0x2')](_0x8578('0x6'));};exports[_0x8578('0x7')]=function(_0xaaa0c1){utils[_0x8578('0x7')]('[core]\x20error',_0xaaa0c1);};exports['close']=function(){utils['info'](_0x8578('0x8'));};exports['managerevent']=function(_0x4cc9a4){}; \ No newline at end of file +var _0x07d7=['close','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x4ae471,_0x5f396a){var _0x581275=function(_0x455d1f){while(--_0x455d1f){_0x4ae471['push'](_0x4ae471['shift']());}};_0x581275(++_0x5f396a);}(_0x07d7,0x85));var _0x707d=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0x07d7[_0x10df1e];return _0x3e24fb;};'use strict';var utils=require(_0x707d('0x0'));exports[_0x707d('0x1')]=function(){utils[_0x707d('0x2')](_0x707d('0x3'));};exports[_0x707d('0x4')]=function(){utils[_0x707d('0x2')](_0x707d('0x5'));};exports[_0x707d('0x6')]=function(){utils[_0x707d('0x2')](_0x707d('0x7'));};exports[_0x707d('0x8')]=function(_0x16cc4a){utils[_0x707d('0x8')](_0x707d('0x9'),_0x16cc4a);};exports[_0x707d('0xa')]=function(){utils[_0x707d('0x2')]('[core]\x20close');};exports['managerevent']=function(_0x5fe2d4){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 155826d..9c5309a 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 _0xb888=['[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','debug','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','dialstatus','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','util','./utils','info','format'];(function(_0x8e040a,_0x3836d9){var _0x1563f9=function(_0x211647){while(--_0x211647){_0x8e040a['push'](_0x8e040a['shift']());}};_0x1563f9(++_0x3836d9);}(_0xb888,0x153));var _0x8b88=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb888[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x8b88('0x0'));var utils=require(_0x8b88('0x1'));var dials={};function writeDB(_0x7d33ea){utils[_0x8b88('0x2')](util[_0x8b88('0x3')](_0x8b88('0x4'),_0x7d33ea[_0x8b88('0x5')],_0x7d33ea[_0x8b88('0x6')],_0x7d33ea[_0x8b88('0x7')],_0x7d33ea[_0x8b88('0x8')],_0x7d33ea[_0x8b88('0x9')],_0x7d33ea['dialstatus']));utils[_0x8b88('0xa')]('CreateVoiceDialReport',_0x7d33ea);delete dials[_0x7d33ea[_0x8b88('0x5')]];}exports[_0x8b88('0xb')]=function(_0x44d139){try{utils['debug'](util['format'](_0x8b88('0xc'),_0x44d139[_0x8b88('0x5')]),_0x44d139);utils[_0x8b88('0x2')](util[_0x8b88('0x3')](_0x8b88('0xd'),_0x44d139[_0x8b88('0x5')],_0x44d139[_0x8b88('0xe')],_0x44d139[_0x8b88('0xf')]));if(_0x44d139[_0x8b88('0xe')][_0x8b88('0x10')]()==_0x8b88('0x11')&&_[_0x8b88('0x12')](_0x44d139[_0x8b88('0xf')]['toLowerCase'](),_0x8b88('0x13'))){var _0x3315ec=_0x44d139[_0x8b88('0xf')][_0x8b88('0x14')]('=');dials[_0x44d139[_0x8b88('0x5')]]={'routeId':_0x3315ec[0x1]};}}catch(_0x309c09){utils[_0x8b88('0x15')](util[_0x8b88('0x3')]('[%s][dials][newexten]',_0x44d139[_0x8b88('0x5')]),_0x309c09);}};exports[_0x8b88('0x16')]=function(_0x58f8a9){try{utils[_0x8b88('0x17')](util['format']('[%s][dials][varset]',_0x58f8a9[_0x8b88('0x5')]),_0x58f8a9);if(!_[_0x8b88('0x18')](_0x58f8a9['variable'][_0x8b88('0x19')])){utils['info'](util[_0x8b88('0x3')](_0x8b88('0x1a'),_0x58f8a9[_0x8b88('0x5')],_0x58f8a9['value']));dials[_0x58f8a9[_0x8b88('0x5')]]={'routeId':_0x58f8a9[_0x8b88('0x1b')]};}}catch(_0x9e3869){utils[_0x8b88('0x15')](util['format']('[%s][dials][varset]',_0x58f8a9['uniqueid']),_0x9e3869);}};exports['dialbegin']=function(_0x4de1e3){try{if(!_[_0x8b88('0x18')](dials[_0x4de1e3[_0x8b88('0x5')]])){utils[_0x8b88('0x17')](util[_0x8b88('0x3')]('[%s][dials][dialbegin]',_0x4de1e3[_0x8b88('0x5')]),_0x4de1e3);dials[_0x4de1e3['uniqueid']]=_[_0x8b88('0x1c')](dials[_0x4de1e3[_0x8b88('0x5')]],_0x4de1e3);dials[_0x4de1e3[_0x8b88('0x5')]][_0x8b88('0x1d')]=utils[_0x8b88('0x1e')]();dials[_0x4de1e3[_0x8b88('0x5')]][_0x8b88('0x1f')]=_0x8b88('0x20');utils[_0x8b88('0x2')](util[_0x8b88('0x3')](_0x8b88('0x21'),_0x4de1e3[_0x8b88('0x5')],dials[_0x4de1e3['uniqueid']][_0x8b88('0x1d')]));}}catch(_0x479949){utils[_0x8b88('0x15')](util[_0x8b88('0x3')]('[%s][dials][dialbegin]',_0x4de1e3[_0x8b88('0x5')]),_0x479949);}};exports['dialend']=function(_0xd8fe31){try{if(!_[_0x8b88('0x18')](dials[_0xd8fe31[_0x8b88('0x5')]])){utils[_0x8b88('0x17')](util[_0x8b88('0x3')](_0x8b88('0x22'),_0xd8fe31[_0x8b88('0x5')]),_0xd8fe31);dials[_0xd8fe31[_0x8b88('0x5')]][_0x8b88('0x23')]=_0xd8fe31[_0x8b88('0x23')];if(_0xd8fe31[_0x8b88('0x23')]=='ANSWER'){dials[_0xd8fe31['uniqueid']]=_[_0x8b88('0x1c')](dials[_0xd8fe31[_0x8b88('0x5')]],_0xd8fe31);dials[_0xd8fe31['uniqueid']][_0x8b88('0x24')]=utils['now']();dials[_0xd8fe31[_0x8b88('0x5')]][_0x8b88('0x1f')]=_0x8b88('0x25');utils[_0x8b88('0x2')](util[_0x8b88('0x3')](_0x8b88('0x26'),_0xd8fe31[_0x8b88('0x5')],_0xd8fe31['dialstatus'],dials[_0xd8fe31[_0x8b88('0x5')]][_0x8b88('0x24')]));}else{utils[_0x8b88('0x2')](util[_0x8b88('0x3')](_0x8b88('0x27'),_0xd8fe31[_0x8b88('0x5')],_0xd8fe31[_0x8b88('0x23')]));}}}catch(_0x52f2ef){utils['error'](util['format'](_0x8b88('0x22'),_0xd8fe31[_0x8b88('0x5')]),_0x52f2ef);}};exports[_0x8b88('0x28')]=function(_0x50bfcb){try{if(!_[_0x8b88('0x18')](dials[_0x50bfcb[_0x8b88('0x5')]])){utils['debug'](util['format'](_0x8b88('0x29'),_0x50bfcb[_0x8b88('0x5')]),_0x50bfcb);utils[_0x8b88('0x2')](util[_0x8b88('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x50bfcb[_0x8b88('0x5')],_0x50bfcb[_0x8b88('0x8')],_0x50bfcb[_0x8b88('0x2a')],_0x50bfcb[_0x8b88('0x2b')]));dials[_0x50bfcb[_0x8b88('0x5')]]=_[_0x8b88('0x1c')](dials[_0x50bfcb[_0x8b88('0x5')]],{'endtime':utils[_0x8b88('0x1e')](),'lastevent':_0x8b88('0x2c')});dials[_0x50bfcb['uniqueid']][_0x8b88('0x2d')]=utils[_0x8b88('0x2e')](dials[_0x50bfcb[_0x8b88('0x5')]][_0x8b88('0x2f')],dials[_0x50bfcb[_0x8b88('0x5')]][_0x8b88('0x1d')]);dials[_0x50bfcb[_0x8b88('0x5')]][_0x8b88('0x30')]=utils[_0x8b88('0x2e')](dials[_0x50bfcb[_0x8b88('0x5')]][_0x8b88('0x24')]||dials[_0x50bfcb[_0x8b88('0x5')]][_0x8b88('0x2f')],dials[_0x50bfcb[_0x8b88('0x5')]]['starttime']);dials[_0x50bfcb[_0x8b88('0x5')]]['billableseconds']=dials[_0x50bfcb[_0x8b88('0x5')]][_0x8b88('0x24')]?utils[_0x8b88('0x2e')](dials[_0x50bfcb['uniqueid']]['endtime'],dials[_0x50bfcb[_0x8b88('0x5')]][_0x8b88('0x24')]):0x0;writeDB(dials[_0x50bfcb[_0x8b88('0x5')]]);}}catch(_0x29f8f1){utils[_0x8b88('0x15')](util[_0x8b88('0x3')]('[%s][dials][hangup]',_0x50bfcb['uniqueid']),_0x29f8f1);}}; \ No newline at end of file +var _0x870b=['[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','holdtime','billableseconds','util','./utils','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup'];(function(_0xe5b255,_0x5c9466){var _0x28bc9f=function(_0x58c82e){while(--_0x58c82e){_0xe5b255['push'](_0xe5b255['shift']());}};_0x28bc9f(++_0x5c9466);}(_0x870b,0x1c2));var _0xb870=function(_0x521c3f,_0x4d8aa0){_0x521c3f=_0x521c3f-0x0;var _0x326ab7=_0x870b[_0x521c3f];return _0x326ab7;};'use strict';var _=require('lodash');var util=require(_0xb870('0x0'));var utils=require(_0xb870('0x1'));var dials={};function writeDB(_0x4fa966){utils[_0xb870('0x2')](util[_0xb870('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x4fa966[_0xb870('0x4')],_0x4fa966[_0xb870('0x5')],_0x4fa966[_0xb870('0x6')],_0x4fa966[_0xb870('0x7')],_0x4fa966[_0xb870('0x8')],_0x4fa966[_0xb870('0x9')]));utils[_0xb870('0xa')]('CreateVoiceDialReport',_0x4fa966);delete dials[_0x4fa966['uniqueid']];}exports['newexten']=function(_0x49b8dd){try{utils[_0xb870('0xb')](util['format'](_0xb870('0xc'),_0x49b8dd[_0xb870('0x4')]),_0x49b8dd);utils[_0xb870('0x2')](util[_0xb870('0x3')](_0xb870('0xd'),_0x49b8dd['uniqueid'],_0x49b8dd[_0xb870('0xe')],_0x49b8dd[_0xb870('0xf')]));if(_0x49b8dd['application'][_0xb870('0x10')]()=='set'&&_[_0xb870('0x11')](_0x49b8dd[_0xb870('0xf')][_0xb870('0x10')](),'cdr(routeid)')){var _0x5bdce0=_0x49b8dd[_0xb870('0xf')][_0xb870('0x12')]('=');dials[_0x49b8dd[_0xb870('0x4')]]={'routeId':_0x5bdce0[0x1]};}}catch(_0x2b981c){utils[_0xb870('0x13')](util[_0xb870('0x3')](_0xb870('0xc'),_0x49b8dd[_0xb870('0x4')]),_0x2b981c);}};exports[_0xb870('0x14')]=function(_0x363998){try{utils[_0xb870('0xb')](util[_0xb870('0x3')](_0xb870('0x15'),_0x363998[_0xb870('0x4')]),_0x363998);if(!_[_0xb870('0x16')](_0x363998[_0xb870('0x17')]['outboundrouteid'])){utils[_0xb870('0x2')](util[_0xb870('0x3')](_0xb870('0x18'),_0x363998[_0xb870('0x4')],_0x363998[_0xb870('0x19')]));dials[_0x363998[_0xb870('0x4')]]={'routeId':_0x363998[_0xb870('0x19')]};}}catch(_0x5af20a){utils['error'](util['format'](_0xb870('0x15'),_0x363998[_0xb870('0x4')]),_0x5af20a);}};exports[_0xb870('0x1a')]=function(_0x1518ce){try{if(!_['isNil'](dials[_0x1518ce['uniqueid']])){utils[_0xb870('0xb')](util[_0xb870('0x3')](_0xb870('0x1b'),_0x1518ce[_0xb870('0x4')]),_0x1518ce);dials[_0x1518ce['uniqueid']]=_[_0xb870('0x1c')](dials[_0x1518ce['uniqueid']],_0x1518ce);dials[_0x1518ce[_0xb870('0x4')]][_0xb870('0x1d')]=utils[_0xb870('0x1e')]();dials[_0x1518ce[_0xb870('0x4')]][_0xb870('0x1f')]=_0xb870('0x20');utils[_0xb870('0x2')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x1518ce[_0xb870('0x4')],dials[_0x1518ce[_0xb870('0x4')]][_0xb870('0x1d')]));}}catch(_0x24eb63){utils[_0xb870('0x13')](util[_0xb870('0x3')]('[%s][dials][dialbegin]',_0x1518ce[_0xb870('0x4')]),_0x24eb63);}};exports['dialend']=function(_0x5891dc){try{if(!_[_0xb870('0x16')](dials[_0x5891dc['uniqueid']])){utils[_0xb870('0xb')](util[_0xb870('0x3')]('[%s][dials][dialend]',_0x5891dc[_0xb870('0x4')]),_0x5891dc);dials[_0x5891dc[_0xb870('0x4')]][_0xb870('0x9')]=_0x5891dc[_0xb870('0x9')];if(_0x5891dc[_0xb870('0x9')]==_0xb870('0x21')){dials[_0x5891dc[_0xb870('0x4')]]=_[_0xb870('0x1c')](dials[_0x5891dc[_0xb870('0x4')]],_0x5891dc);dials[_0x5891dc[_0xb870('0x4')]][_0xb870('0x22')]=utils[_0xb870('0x1e')]();dials[_0x5891dc[_0xb870('0x4')]]['lastevent']=_0xb870('0x23');utils['info'](util[_0xb870('0x3')](_0xb870('0x24'),_0x5891dc[_0xb870('0x4')],_0x5891dc[_0xb870('0x9')],dials[_0x5891dc[_0xb870('0x4')]][_0xb870('0x22')]));}else{utils['info'](util[_0xb870('0x3')](_0xb870('0x25'),_0x5891dc['uniqueid'],_0x5891dc[_0xb870('0x9')]));}}}catch(_0x3fe96b){utils['error'](util[_0xb870('0x3')](_0xb870('0x26'),_0x5891dc[_0xb870('0x4')]),_0x3fe96b);}};exports[_0xb870('0x27')]=function(_0x13cd08){try{if(!_[_0xb870('0x16')](dials[_0x13cd08[_0xb870('0x4')]])){utils[_0xb870('0xb')](util[_0xb870('0x3')](_0xb870('0x28'),_0x13cd08['uniqueid']),_0x13cd08);utils[_0xb870('0x2')](util['format'](_0xb870('0x29'),_0x13cd08[_0xb870('0x4')],_0x13cd08[_0xb870('0x7')],_0x13cd08[_0xb870('0x2a')],_0x13cd08['cause-txt']));dials[_0x13cd08['uniqueid']]=_[_0xb870('0x1c')](dials[_0x13cd08[_0xb870('0x4')]],{'endtime':utils[_0xb870('0x1e')](),'lastevent':_0xb870('0x2b')});dials[_0x13cd08[_0xb870('0x4')]][_0xb870('0x2c')]=utils[_0xb870('0x2d')](dials[_0x13cd08['uniqueid']][_0xb870('0x2e')],dials[_0x13cd08[_0xb870('0x4')]][_0xb870('0x1d')]);dials[_0x13cd08['uniqueid']][_0xb870('0x2f')]=utils[_0xb870('0x2d')](dials[_0x13cd08[_0xb870('0x4')]][_0xb870('0x22')]||dials[_0x13cd08[_0xb870('0x4')]][_0xb870('0x2e')],dials[_0x13cd08['uniqueid']][_0xb870('0x1d')]);dials[_0x13cd08[_0xb870('0x4')]][_0xb870('0x30')]=dials[_0x13cd08['uniqueid']][_0xb870('0x22')]?utils[_0xb870('0x2d')](dials[_0x13cd08[_0xb870('0x4')]][_0xb870('0x2e')],dials[_0x13cd08['uniqueid']]['answertime']):0x0;writeDB(dials[_0x13cd08[_0xb870('0x4')]]);}}catch(_0x57de54){utils['error'](util['format'](_0xb870('0x28'),_0x13cd08[_0xb870('0x4')]),_0x57de54);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 0495d96..2ff1315 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 _0x401e=['XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','devicestatechange','[%s][index][devicestatechange]','device','agentcalled','debug','format','[%s][index][agentcalled]','agentringnoanswer','uniqueid','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','port','username','password','xdr','info'];(function(_0x1c5bdb,_0x44bf0e){var _0x4988a1=function(_0x1db1da){while(--_0x1db1da){_0x1c5bdb['push'](_0x1c5bdb['shift']());}};_0x4988a1(++_0x44bf0e);}(_0x401e,0x10a));var _0xe401=function(_0x19c106,_0x238007){_0x19c106=_0x19c106-0x0;var _0x3341d6=_0x401e[_0x19c106];return _0x3341d6;};var AsteriskManager=require(_0xe401('0x0'));var config=require(_0xe401('0x1'));var utils=require(_0xe401('0x2'));var util=require(_0xe401('0x3'));var ami=new AsteriskManager(config[_0xe401('0x4')][_0xe401('0x5')],config[_0xe401('0x4')]['ip'],config['asterisk'][_0xe401('0x6')],config[_0xe401('0x4')][_0xe401('0x7')],!![]);ami['keepConnected']();if(config[_0xe401('0x8')]&&config[_0xe401('0x8')]['disabled']){utils[_0xe401('0x9')](_0xe401('0xa'));}else{var agents=require(_0xe401('0xb'));var calls=require(_0xe401('0xc'));var queues=require(_0xe401('0xd'));var recordings=require(_0xe401('0xe'));var members=require(_0xe401('0xf'));var dials=require('./dials.controller');var transfers=require(_0xe401('0x10'));var core=require(_0xe401('0x11'));ami['on']('connect',core[_0xe401('0x12')]);ami['on'](_0xe401('0x13'),core[_0xe401('0x13')]);ami['on'](_0xe401('0x14'),core['fullybooted']);ami['on']('error',core[_0xe401('0x15')]);ami['on'](_0xe401('0x16'),core[_0xe401('0x16')]);ami['on']('managerevent',core['managerevent']);ami['on'](_0xe401('0x17'),function(_0x4db692){try{utils['debug'](util['format'](_0xe401('0x18'),_0x4db692['device']),_0x4db692);members[_0xe401('0x17')](_0x4db692);}catch(_0x295092){utils[_0xe401('0x15')](util['format']('[%s][index][devicestatechange]',_0x4db692[_0xe401('0x19')]),_0x295092);}});ami['on'](_0xe401('0x1a'),function(_0x5bbc4f){try{utils[_0xe401('0x1b')](util[_0xe401('0x1c')](_0xe401('0x1d'),_0x5bbc4f['uniqueid']),_0x5bbc4f);agents[_0xe401('0x1a')](_0x5bbc4f);}catch(_0x57e3f6){utils['error'](util[_0xe401('0x1c')](_0xe401('0x1d'),_0x5bbc4f['uniqueid']),_0x57e3f6);}});ami['on'](_0xe401('0x1e'),function(_0x41d8bc){try{utils[_0xe401('0x1b')](util[_0xe401('0x1c')]('[%s][index][agentringnoanswer]',_0x41d8bc[_0xe401('0x1f')]),_0x41d8bc);agents[_0xe401('0x1e')](_0x41d8bc);}catch(_0x422cc3){utils[_0xe401('0x15')](util[_0xe401('0x1c')](_0xe401('0x20'),_0x41d8bc[_0xe401('0x1f')]),_0x422cc3);}});ami['on'](_0xe401('0x21'),function(_0x184e92){try{utils[_0xe401('0x1b')](util[_0xe401('0x1c')](_0xe401('0x22'),_0x184e92['uniqueid']),_0x184e92);agents[_0xe401('0x21')](_0x184e92);queues['agentconnect'](_0x184e92);}catch(_0x35d161){utils[_0xe401('0x15')](util['format']('[%s][index][agentconnect]',_0x184e92[_0xe401('0x1f')]),_0x35d161);}});ami['on']('agentcomplete',function(_0x5c9c36){try{utils[_0xe401('0x1b')](util[_0xe401('0x1c')](_0xe401('0x23'),_0x5c9c36['uniqueid']),_0x5c9c36);agents['agentcomplete'](_0x5c9c36);queues[_0xe401('0x24')](_0x5c9c36);members['agentcomplete'](_0x5c9c36);}catch(_0x31ffa6){utils[_0xe401('0x15')](util[_0xe401('0x1c')]('[%s][index][agentcomplete]',_0x5c9c36[_0xe401('0x1f')]),_0x31ffa6);}});ami['on'](_0xe401('0x25'),function(_0x5a8047){try{utils[_0xe401('0x1b')](util[_0xe401('0x1c')](_0xe401('0x26'),_0x5a8047[_0xe401('0x1f')]),_0x5a8047);agents['queuecallerabandon'](_0x5a8047);queues[_0xe401('0x25')](_0x5a8047);}catch(_0x5b545f){utils['error'](util[_0xe401('0x1c')](_0xe401('0x26'),_0x5a8047[_0xe401('0x1f')]),_0x5b545f);}});ami['on'](_0xe401('0x27'),function(_0x33203f){try{utils[_0xe401('0x1b')](util[_0xe401('0x1c')]('[%s][index][queuecallerjoin]',_0x33203f[_0xe401('0x1f')]),_0x33203f);queues[_0xe401('0x27')](_0x33203f);recordings[_0xe401('0x27')](_0x33203f);}catch(_0x2355fe){utils[_0xe401('0x15')](util[_0xe401('0x1c')](_0xe401('0x28'),_0x33203f[_0xe401('0x1f')]),_0x2355fe);}});ami['on'](_0xe401('0x29'),function(_0x3dd2d6){try{utils[_0xe401('0x1b')](util[_0xe401('0x1c')](_0xe401('0x2a'),_0x3dd2d6[_0xe401('0x1f')]),_0x3dd2d6);queues[_0xe401('0x29')](_0x3dd2d6);}catch(_0x572b94){utils['error'](util[_0xe401('0x1c')](_0xe401('0x2a'),_0x3dd2d6[_0xe401('0x1f')]),_0x572b94);}});ami['on'](_0xe401('0x2b'),function(_0x2acc7){try{utils['debug'](util[_0xe401('0x1c')]('[%s][index][musiconholdstart]',_0x2acc7['uniqueid']),_0x2acc7);queues[_0xe401('0x2b')](_0x2acc7);calls[_0xe401('0x2b')](_0x2acc7);}catch(_0x189d9f){utils[_0xe401('0x15')](util[_0xe401('0x1c')](_0xe401('0x2c'),_0x2acc7[_0xe401('0x1f')]),_0x189d9f);}});ami['on'](_0xe401('0x2d'),function(_0x1456a3){try{utils[_0xe401('0x1b')](util['format']('[%s][index][musiconholdstop]',_0x1456a3[_0xe401('0x1f')]),_0x1456a3);queues[_0xe401('0x2d')](_0x1456a3);calls[_0xe401('0x2d')](_0x1456a3);}catch(_0x8f3518){utils[_0xe401('0x15')](util[_0xe401('0x1c')](_0xe401('0x2e'),_0x1456a3[_0xe401('0x1f')]),_0x8f3518);}});ami['on']('newstate',function(_0x2e69e5){try{utils[_0xe401('0x1b')](util[_0xe401('0x1c')]('[%s][index][newstate]',_0x2e69e5[_0xe401('0x1f')]),_0x2e69e5);calls[_0xe401('0x2f')](_0x2e69e5);recordings[_0xe401('0x2f')](_0x2e69e5);}catch(_0x525916){utils[_0xe401('0x15')](util[_0xe401('0x1c')](_0xe401('0x30'),_0x2e69e5[_0xe401('0x1f')]),_0x525916);}});ami['on']('hangup',function(_0x1f09d0){try{utils[_0xe401('0x1b')](util[_0xe401('0x1c')](_0xe401('0x31'),_0x1f09d0['uniqueid']),_0x1f09d0);calls[_0xe401('0x32')](_0x1f09d0);recordings['hangup'](_0x1f09d0);dials[_0xe401('0x32')](_0x1f09d0);agents['hangup'](_0x1f09d0);queues[_0xe401('0x32')](_0x1f09d0);}catch(_0x53afb6){utils[_0xe401('0x15')](util['format'](_0xe401('0x31'),_0x1f09d0[_0xe401('0x1f')]),_0x53afb6);}});ami['on'](_0xe401('0x33'),function(_0x18d2b0){try{utils['debug'](util[_0xe401('0x1c')](_0xe401('0x34'),_0x18d2b0[_0xe401('0x1f')]),_0x18d2b0);members[_0xe401('0x33')](_0x18d2b0);}catch(_0x289869){utils['error'](util[_0xe401('0x1c')](_0xe401('0x34'),_0x18d2b0['uniqueid']),_0x289869);}});ami['on'](_0xe401('0x35'),function(_0x4a29ec){try{utils[_0xe401('0x1b')](util['format'](_0xe401('0x36'),_0x4a29ec['uniqueid']),_0x4a29ec);queues[_0xe401('0x35')](_0x4a29ec);agents['blindtransfer'](_0x4a29ec);transfers[_0xe401('0x35')](_0x4a29ec);recordings[_0xe401('0x35')](_0x4a29ec);}catch(_0x29286e){utils[_0xe401('0x15')](util[_0xe401('0x1c')](_0xe401('0x36'),_0x4a29ec['uniqueid']),_0x29286e);}});ami['on'](_0xe401('0x37'),function(_0x30b907){try{utils[_0xe401('0x1b')](util['format'](_0xe401('0x38'),_0x30b907['origtransfereruniqueid']),_0x30b907);queues[_0xe401('0x37')](_0x30b907);transfers[_0xe401('0x37')](_0x30b907);agents[_0xe401('0x37')](_0x30b907);calls[_0xe401('0x37')](_0x30b907);}catch(_0x27c8e9){utils[_0xe401('0x15')](util[_0xe401('0x1c')](_0xe401('0x38'),_0x30b907[_0xe401('0x39')]),_0x27c8e9);}});ami['on']('varset',function(_0x5364e8){try{utils[_0xe401('0x1b')](util[_0xe401('0x1c')](_0xe401('0x3a'),_0x5364e8[_0xe401('0x1f')]),_0x5364e8);queues[_0xe401('0x3b')](_0x5364e8);recordings['varset'](_0x5364e8);calls['varset'](_0x5364e8);dials['varset'](_0x5364e8);}catch(_0x2d7bfd){utils[_0xe401('0x15')](util[_0xe401('0x1c')]('[%s][index][varset]',_0x5364e8[_0xe401('0x1f')]),_0x2d7bfd);}});ami['on'](_0xe401('0x3c'),function(_0x2d5e9a){try{utils[_0xe401('0x1b')](util['format'](_0xe401('0x3d'),_0x2d5e9a[_0xe401('0x1f')]),_0x2d5e9a);calls[_0xe401('0x3c')](_0x2d5e9a);recordings[_0xe401('0x3c')](_0x2d5e9a);dials[_0xe401('0x3c')](_0x2d5e9a);}catch(_0x2a29d2){utils[_0xe401('0x15')](util[_0xe401('0x1c')](_0xe401('0x3d'),_0x2d5e9a['uniqueid']),_0x2a29d2);}});ami['on']('newchannel',function(_0x225506){try{utils['debug'](util[_0xe401('0x1c')](_0xe401('0x3e'),_0x225506['uniqueid']),_0x225506);calls[_0xe401('0x3f')](_0x225506);recordings[_0xe401('0x3f')](_0x225506);}catch(_0x4ce3ed){utils[_0xe401('0x15')](util[_0xe401('0x1c')](_0xe401('0x3e'),_0x225506[_0xe401('0x1f')]),_0x4ce3ed);}});ami['on'](_0xe401('0x40'),function(_0x1ba43d){try{utils[_0xe401('0x1b')](util[_0xe401('0x1c')](_0xe401('0x41'),_0x1ba43d[_0xe401('0x1f')]),_0x1ba43d);dials[_0xe401('0x40')](_0x1ba43d);}catch(_0x3ce2ef){utils[_0xe401('0x15')](util[_0xe401('0x1c')](_0xe401('0x42'),_0x1ba43d['uniqueid']),_0x3ce2ef);}});ami['on'](_0xe401('0x43'),function(_0x446d96){try{utils[_0xe401('0x1b')](util['format']('[%s][index][dialend]',_0x446d96[_0xe401('0x1f')]),_0x446d96);dials[_0xe401('0x43')](_0x446d96);}catch(_0x2ee7ce){utils[_0xe401('0x15')](util['format'](_0xe401('0x44'),_0x446d96[_0xe401('0x1f')]),_0x2ee7ce);}});} \ No newline at end of file +var _0xcdba=['./agents.controller','./calls.controller','./recordings.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','port','username','password','keepConnected','xdr','disabled','XDR\x20DISABLED'];(function(_0x28c6d2,_0xb0d949){var _0x4cd798=function(_0x3b0e5b){while(--_0x3b0e5b){_0x28c6d2['push'](_0x28c6d2['shift']());}};_0x4cd798(++_0xb0d949);}(_0xcdba,0x175));var _0xacdb=function(_0x467448,_0x5a7d80){_0x467448=_0x467448-0x0;var _0xf1e76f=_0xcdba[_0x467448];return _0xf1e76f;};var AsteriskManager=require(_0xacdb('0x0'));var config=require(_0xacdb('0x1'));var utils=require('./utils');var util=require(_0xacdb('0x2'));var ami=new AsteriskManager(config[_0xacdb('0x3')][_0xacdb('0x4')],config['asterisk']['ip'],config[_0xacdb('0x3')][_0xacdb('0x5')],config['asterisk'][_0xacdb('0x6')],!![]);ami[_0xacdb('0x7')]();if(config[_0xacdb('0x8')]&&config['xdr'][_0xacdb('0x9')]){utils['info'](_0xacdb('0xa'));}else{var agents=require(_0xacdb('0xb'));var calls=require(_0xacdb('0xc'));var queues=require('./queues.controller');var recordings=require(_0xacdb('0xd'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0xacdb('0xe'),core[_0xacdb('0xe')]);ami['on']('shutdown',core[_0xacdb('0xf')]);ami['on'](_0xacdb('0x10'),core[_0xacdb('0x10')]);ami['on'](_0xacdb('0x11'),core['error']);ami['on']('close',core[_0xacdb('0x12')]);ami['on'](_0xacdb('0x13'),core[_0xacdb('0x13')]);ami['on'](_0xacdb('0x14'),function(_0x43d8c2){try{utils[_0xacdb('0x15')](util[_0xacdb('0x16')](_0xacdb('0x17'),_0x43d8c2['device']),_0x43d8c2);members['devicestatechange'](_0x43d8c2);}catch(_0x53d8c0){utils[_0xacdb('0x11')](util[_0xacdb('0x16')](_0xacdb('0x17'),_0x43d8c2[_0xacdb('0x18')]),_0x53d8c0);}});ami['on'](_0xacdb('0x19'),function(_0x1c033e){try{utils[_0xacdb('0x15')](util[_0xacdb('0x16')](_0xacdb('0x1a'),_0x1c033e[_0xacdb('0x1b')]),_0x1c033e);agents[_0xacdb('0x19')](_0x1c033e);}catch(_0x4f896c){utils[_0xacdb('0x11')](util[_0xacdb('0x16')](_0xacdb('0x1a'),_0x1c033e['uniqueid']),_0x4f896c);}});ami['on'](_0xacdb('0x1c'),function(_0x1f6787){try{utils[_0xacdb('0x15')](util['format'](_0xacdb('0x1d'),_0x1f6787[_0xacdb('0x1b')]),_0x1f6787);agents['agentringnoanswer'](_0x1f6787);}catch(_0x2fe8c5){utils[_0xacdb('0x11')](util[_0xacdb('0x16')](_0xacdb('0x1d'),_0x1f6787[_0xacdb('0x1b')]),_0x2fe8c5);}});ami['on'](_0xacdb('0x1e'),function(_0x38f71a){try{utils[_0xacdb('0x15')](util[_0xacdb('0x16')](_0xacdb('0x1f'),_0x38f71a['uniqueid']),_0x38f71a);agents[_0xacdb('0x1e')](_0x38f71a);queues[_0xacdb('0x1e')](_0x38f71a);}catch(_0x43bcf8){utils[_0xacdb('0x11')](util[_0xacdb('0x16')](_0xacdb('0x1f'),_0x38f71a['uniqueid']),_0x43bcf8);}});ami['on']('agentcomplete',function(_0x160ee0){try{utils[_0xacdb('0x15')](util['format'](_0xacdb('0x20'),_0x160ee0[_0xacdb('0x1b')]),_0x160ee0);agents[_0xacdb('0x21')](_0x160ee0);queues[_0xacdb('0x21')](_0x160ee0);members[_0xacdb('0x21')](_0x160ee0);}catch(_0xbcc528){utils['error'](util[_0xacdb('0x16')](_0xacdb('0x20'),_0x160ee0['uniqueid']),_0xbcc528);}});ami['on'](_0xacdb('0x22'),function(_0x354812){try{utils[_0xacdb('0x15')](util[_0xacdb('0x16')](_0xacdb('0x23'),_0x354812[_0xacdb('0x1b')]),_0x354812);agents[_0xacdb('0x22')](_0x354812);queues[_0xacdb('0x22')](_0x354812);}catch(_0x1d779d){utils[_0xacdb('0x11')](util[_0xacdb('0x16')](_0xacdb('0x23'),_0x354812['uniqueid']),_0x1d779d);}});ami['on'](_0xacdb('0x24'),function(_0xe1d924){try{utils['debug'](util[_0xacdb('0x16')](_0xacdb('0x25'),_0xe1d924['uniqueid']),_0xe1d924);queues[_0xacdb('0x24')](_0xe1d924);recordings['queuecallerjoin'](_0xe1d924);}catch(_0x2feda7){utils[_0xacdb('0x11')](util[_0xacdb('0x16')](_0xacdb('0x25'),_0xe1d924[_0xacdb('0x1b')]),_0x2feda7);}});ami['on']('queuecallerleave',function(_0x5d620c){try{utils['debug'](util[_0xacdb('0x16')](_0xacdb('0x26'),_0x5d620c[_0xacdb('0x1b')]),_0x5d620c);queues[_0xacdb('0x27')](_0x5d620c);}catch(_0x3c75df){utils[_0xacdb('0x11')](util[_0xacdb('0x16')]('[%s][index][queuecallerleave]',_0x5d620c[_0xacdb('0x1b')]),_0x3c75df);}});ami['on'](_0xacdb('0x28'),function(_0x3a5bf3){try{utils['debug'](util[_0xacdb('0x16')](_0xacdb('0x29'),_0x3a5bf3['uniqueid']),_0x3a5bf3);queues['musiconholdstart'](_0x3a5bf3);calls[_0xacdb('0x28')](_0x3a5bf3);}catch(_0x397e88){utils['error'](util[_0xacdb('0x16')]('[%s][index][musiconholdstart]',_0x3a5bf3[_0xacdb('0x1b')]),_0x397e88);}});ami['on']('musiconholdstop',function(_0x404a12){try{utils['debug'](util[_0xacdb('0x16')](_0xacdb('0x2a'),_0x404a12['uniqueid']),_0x404a12);queues[_0xacdb('0x2b')](_0x404a12);calls[_0xacdb('0x2b')](_0x404a12);}catch(_0x1dc235){utils[_0xacdb('0x11')](util[_0xacdb('0x16')]('[%s][index][musiconholdstop]',_0x404a12['uniqueid']),_0x1dc235);}});ami['on']('newstate',function(_0x1f9acd){try{utils['debug'](util[_0xacdb('0x16')]('[%s][index][newstate]',_0x1f9acd['uniqueid']),_0x1f9acd);calls[_0xacdb('0x2c')](_0x1f9acd);recordings['newstate'](_0x1f9acd);}catch(_0x8a919a){utils[_0xacdb('0x11')](util[_0xacdb('0x16')]('[%s][index][newstate]',_0x1f9acd[_0xacdb('0x1b')]),_0x8a919a);}});ami['on'](_0xacdb('0x2d'),function(_0x2f7f14){try{utils['debug'](util[_0xacdb('0x16')](_0xacdb('0x2e'),_0x2f7f14[_0xacdb('0x1b')]),_0x2f7f14);calls[_0xacdb('0x2d')](_0x2f7f14);recordings[_0xacdb('0x2d')](_0x2f7f14);dials[_0xacdb('0x2d')](_0x2f7f14);agents[_0xacdb('0x2d')](_0x2f7f14);queues[_0xacdb('0x2d')](_0x2f7f14);}catch(_0x1900da){utils[_0xacdb('0x11')](util[_0xacdb('0x16')](_0xacdb('0x2e'),_0x2f7f14[_0xacdb('0x1b')]),_0x1900da);}});ami['on'](_0xacdb('0x2f'),function(_0xed0947){try{utils[_0xacdb('0x15')](util[_0xacdb('0x16')](_0xacdb('0x30'),_0xed0947[_0xacdb('0x1b')]),_0xed0947);members['cdr'](_0xed0947);}catch(_0x155d1a){utils[_0xacdb('0x11')](util[_0xacdb('0x16')](_0xacdb('0x30'),_0xed0947[_0xacdb('0x1b')]),_0x155d1a);}});ami['on'](_0xacdb('0x31'),function(_0x730545){try{utils['debug'](util[_0xacdb('0x16')](_0xacdb('0x32'),_0x730545['uniqueid']),_0x730545);queues[_0xacdb('0x31')](_0x730545);agents['blindtransfer'](_0x730545);transfers['blindtransfer'](_0x730545);recordings[_0xacdb('0x31')](_0x730545);}catch(_0x53988e){utils[_0xacdb('0x11')](util['format'](_0xacdb('0x32'),_0x730545['uniqueid']),_0x53988e);}});ami['on'](_0xacdb('0x33'),function(_0x2e3ea8){try{utils[_0xacdb('0x15')](util[_0xacdb('0x16')](_0xacdb('0x34'),_0x2e3ea8[_0xacdb('0x35')]),_0x2e3ea8);queues['attendedtransfer'](_0x2e3ea8);transfers[_0xacdb('0x33')](_0x2e3ea8);agents['attendedtransfer'](_0x2e3ea8);calls[_0xacdb('0x33')](_0x2e3ea8);}catch(_0x4f0d81){utils[_0xacdb('0x11')](util[_0xacdb('0x16')](_0xacdb('0x34'),_0x2e3ea8[_0xacdb('0x35')]),_0x4f0d81);}});ami['on'](_0xacdb('0x36'),function(_0x3698f5){try{utils[_0xacdb('0x15')](util[_0xacdb('0x16')](_0xacdb('0x37'),_0x3698f5[_0xacdb('0x1b')]),_0x3698f5);queues[_0xacdb('0x36')](_0x3698f5);recordings[_0xacdb('0x36')](_0x3698f5);calls[_0xacdb('0x36')](_0x3698f5);dials['varset'](_0x3698f5);}catch(_0x116a87){utils[_0xacdb('0x11')](util[_0xacdb('0x16')](_0xacdb('0x37'),_0x3698f5[_0xacdb('0x1b')]),_0x116a87);}});ami['on'](_0xacdb('0x38'),function(_0x10ac73){try{utils[_0xacdb('0x15')](util[_0xacdb('0x16')](_0xacdb('0x39'),_0x10ac73[_0xacdb('0x1b')]),_0x10ac73);calls[_0xacdb('0x38')](_0x10ac73);recordings[_0xacdb('0x38')](_0x10ac73);dials[_0xacdb('0x38')](_0x10ac73);}catch(_0x315796){utils[_0xacdb('0x11')](util[_0xacdb('0x16')](_0xacdb('0x39'),_0x10ac73[_0xacdb('0x1b')]),_0x315796);}});ami['on'](_0xacdb('0x3a'),function(_0x345fbe){try{utils[_0xacdb('0x15')](util[_0xacdb('0x16')](_0xacdb('0x3b'),_0x345fbe['uniqueid']),_0x345fbe);calls['newchannel'](_0x345fbe);recordings[_0xacdb('0x3a')](_0x345fbe);}catch(_0x11d7ee){utils[_0xacdb('0x11')](util[_0xacdb('0x16')](_0xacdb('0x3b'),_0x345fbe[_0xacdb('0x1b')]),_0x11d7ee);}});ami['on'](_0xacdb('0x3c'),function(_0x41bab4){try{utils[_0xacdb('0x15')](util[_0xacdb('0x16')](_0xacdb('0x3d'),_0x41bab4[_0xacdb('0x1b')]),_0x41bab4);dials['dialbegin'](_0x41bab4);}catch(_0x14a40a){utils[_0xacdb('0x11')](util[_0xacdb('0x16')](_0xacdb('0x3e'),_0x41bab4['uniqueid']),_0x14a40a);}});ami['on']('dialend',function(_0x1e21d6){try{utils[_0xacdb('0x15')](util['format'](_0xacdb('0x3f'),_0x1e21d6[_0xacdb('0x1b')]),_0x1e21d6);dials['dialend'](_0x1e21d6);}catch(_0x200c6e){utils[_0xacdb('0x11')](util[_0xacdb('0x16')](_0xacdb('0x3f'),_0x1e21d6[_0xacdb('0x1b')]),_0x200c6e);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a159f37..c6a5cd2 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 _0xac92=['exitAt','duration','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','cdr','channel','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data2','destinationchannel','source','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','type','getUserByInterface','then','membername','internal','request','CreateMemberReport','split','name','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac92,0x7b));var _0x2ac9=function(_0x243106,_0x31004e){_0x243106=_0x243106-0x0;var _0x1c0c33=_0xac92[_0x243106];return _0x1c0c33;};'use strict';var _=require(_0x2ac9('0x0'));var util=require(_0x2ac9('0x1'));var utils=require(_0x2ac9('0x2'));var members={};var exclude=[_0x2ac9('0x3'),_0x2ac9('0x4')];function writeDB(_0x218242){utils[_0x2ac9('0x5')](util[_0x2ac9('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x218242[_0x2ac9('0x7')],_0x218242[_0x2ac9('0x8')],_0x218242['channel'],_0x218242['data2'],_0x218242['membername'],_0x218242[_0x2ac9('0x9')]));if(_0x218242[_0x2ac9('0x8')]){utils[_0x2ac9('0xa')](_0x218242[_0x2ac9('0x8')])[_0x2ac9('0xb')](function(_0x2314b7){if(_0x2314b7){_0x218242[_0x2ac9('0xc')]=_0x2314b7['name'];_0x218242[_0x2ac9('0xd')]=_0x2314b7[_0x2ac9('0xd')];utils[_0x2ac9('0xe')](_0x2ac9('0xf'),_0x218242);}else{utils['getUserByName'](_0x218242['interface'][_0x2ac9('0x10')]('/')[0x1])['then'](function(_0x45d26c){if(_0x45d26c){_0x218242[_0x2ac9('0xc')]=_0x45d26c[_0x2ac9('0x11')];_0x218242['internal']=_0x45d26c[_0x2ac9('0xd')];utils[_0x2ac9('0xe')](_0x2ac9('0xf'),_0x218242);}});}})['catch'](function(_0x82a01e){utils[_0x2ac9('0x12')](util[_0x2ac9('0x6')](_0x2ac9('0x13'),_0x218242[_0x2ac9('0x7')]),_0x82a01e);});}delete members[_0x218242['interface']];}function startsWith(_0x70caf9,_0x4c1c29){return _[_0x2ac9('0x14')](_0x70caf9,function(_0x3a7034){return _[_0x2ac9('0x15')](_0x4c1c29,_0x3a7034);});}exports['devicestatechange']=function(_0x22d971){try{utils[_0x2ac9('0x16')](util['format'](_0x2ac9('0x17'),members[_0x22d971[_0x2ac9('0x18')]]?members[_0x22d971[_0x2ac9('0x18')]]['uniqueid']:_0x22d971['device']),_0x22d971);utils[_0x2ac9('0x5')](util['format'](_0x2ac9('0x19'),members[_0x22d971['device']]?members[_0x22d971[_0x2ac9('0x18')]][_0x2ac9('0x7')]:_0x22d971['device'],_0x22d971['state'],_0x22d971[_0x2ac9('0x18')]));switch(_0x22d971[_0x2ac9('0x1a')]){case _0x2ac9('0x1b'):case _0x2ac9('0x1c'):if(!startsWith(exclude,_0x22d971['device'])){members[_0x22d971[_0x2ac9('0x18')]]={'channel':_0x2ac9('0x1d'),'interface':_0x22d971[_0x2ac9('0x18')],'type':_0x2ac9('0x1e'),'enterAt':utils[_0x2ac9('0x1f')](),'role':'agent'};}break;case _0x2ac9('0x20'):if(!_['isNil'](members[_0x22d971[_0x2ac9('0x18')]])){members[_0x22d971['device']][_0x2ac9('0x21')]=utils['now']();members[_0x22d971[_0x2ac9('0x18')]][_0x2ac9('0x22')]=utils[_0x2ac9('0x23')](members[_0x22d971[_0x2ac9('0x18')]]['exitAt'],members[_0x22d971[_0x2ac9('0x18')]][_0x2ac9('0x24')]);if(members[_0x22d971[_0x2ac9('0x18')]]['uniqueid']){writeDB(members[_0x22d971[_0x2ac9('0x18')]]);}}break;default:break;}}catch(_0x3f5f44){utils[_0x2ac9('0x12')](util[_0x2ac9('0x6')](_0x2ac9('0x17'),members[_0x22d971[_0x2ac9('0x18')]]?members[_0x22d971[_0x2ac9('0x18')]][_0x2ac9('0x7')]:_0x22d971[_0x2ac9('0x18')]),_0x3f5f44);}};exports[_0x2ac9('0x25')]=function(_0x3808d0){try{if(!_[_0x2ac9('0x26')](members[_0x3808d0[_0x2ac9('0x8')]])){utils[_0x2ac9('0x16')](util[_0x2ac9('0x6')](_0x2ac9('0x27'),_0x3808d0[_0x2ac9('0x7')]),_0x3808d0);utils[_0x2ac9('0x5')](util['format'](_0x2ac9('0x28'),_0x3808d0['uniqueid'],_0x3808d0[_0x2ac9('0x8')],_0x3808d0['queue']));members[_0x3808d0[_0x2ac9('0x8')]]=_[_0x2ac9('0x29')](members[_0x3808d0[_0x2ac9('0x8')]],{'data4':_0x3808d0['queue'],'uniqueid':_0x3808d0[_0x2ac9('0x7')]});}}catch(_0xfd438d){utils[_0x2ac9('0x12')](util[_0x2ac9('0x6')](_0x2ac9('0x27'),_0x3808d0[_0x2ac9('0x7')]),_0xfd438d);}};exports[_0x2ac9('0x2a')]=function(_0x46fcef){try{utils[_0x2ac9('0x16')](util[_0x2ac9('0x6')]('[%s][members][cdr]',_0x46fcef[_0x2ac9('0x7')]),_0x46fcef);if(_0x46fcef[_0x2ac9('0x2b')]){var _0x2a76bb=_0x46fcef[_0x2ac9('0x2b')][_0x2ac9('0x10')]('-')[0x0];if(!_[_0x2ac9('0x26')](members[_0x2a76bb])){members[_0x2a76bb]=_[_0x2ac9('0x29')](members[_0x2a76bb],{'data1':members[_0x2a76bb][_0x2ac9('0x2c')]||_0x46fcef['type'],'data2':members[_0x2a76bb]['data2']||_0x46fcef['source'],'data3':members[_0x2a76bb][_0x2ac9('0x2d')]||_0x46fcef[_0x2ac9('0x2e')],'uniqueid':members[_0x2a76bb][_0x2ac9('0x7')]||_0x46fcef[_0x2ac9('0x7')]});utils[_0x2ac9('0x5')](util[_0x2ac9('0x6')](_0x2ac9('0x2f'),_0x46fcef[_0x2ac9('0x7')],members[_0x2a76bb][_0x2ac9('0x2c')],members[_0x2a76bb][_0x2ac9('0x30')],members[_0x2a76bb]['data3']));if(members[_0x2a76bb][_0x2ac9('0x21')]){writeDB(members[_0x2a76bb]);}}}if(_0x46fcef['destinationchannel']){var _0x465aba=_0x46fcef[_0x2ac9('0x31')][_0x2ac9('0x10')]('-')[0x0];if(!_[_0x2ac9('0x26')](members[_0x465aba])){members[_0x465aba]=_[_0x2ac9('0x29')](members[_0x465aba],{'data1':members[_0x465aba][_0x2ac9('0x2c')]||_0x46fcef[_0x2ac9('0x9')],'data2':members[_0x465aba][_0x2ac9('0x30')]||_0x46fcef[_0x2ac9('0x32')],'data3':members[_0x465aba]['data3']||_0x46fcef[_0x2ac9('0x2e')],'uniqueid':members[_0x465aba][_0x2ac9('0x7')]||_0x46fcef[_0x2ac9('0x7')]});utils[_0x2ac9('0x5')](util[_0x2ac9('0x6')](_0x2ac9('0x2f'),_0x46fcef['uniqueid'],members[_0x465aba][_0x2ac9('0x2c')],members[_0x465aba]['data2'],members[_0x465aba][_0x2ac9('0x2d')]));if(members[_0x465aba][_0x2ac9('0x21')]){writeDB(members[_0x465aba]);}}}}catch(_0x5cbf3b){utils[_0x2ac9('0x12')](util[_0x2ac9('0x6')](_0x2ac9('0x33'),_0x46fcef[_0x2ac9('0x7')]),_0x5cbf3b);}}; \ No newline at end of file +var _0x2b84=['data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','split','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','destination','[%s][members][cdr]','lodash','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b84,0x105));var _0x42b8=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x2b84[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x42b8('0x0'));var util=require('util');var utils=require(_0x42b8('0x1'));var members={};var exclude=[_0x42b8('0x2'),_0x42b8('0x3')];function writeDB(_0x2f479c){utils['info'](util[_0x42b8('0x4')](_0x42b8('0x5'),_0x2f479c[_0x42b8('0x6')],_0x2f479c[_0x42b8('0x7')],_0x2f479c[_0x42b8('0x8')],_0x2f479c[_0x42b8('0x9')],_0x2f479c[_0x42b8('0xa')],_0x2f479c[_0x42b8('0xb')]));if(_0x2f479c['interface']){utils[_0x42b8('0xc')](_0x2f479c['interface'])[_0x42b8('0xd')](function(_0x5c83cd){if(_0x5c83cd){_0x2f479c['membername']=_0x5c83cd[_0x42b8('0xe')];_0x2f479c[_0x42b8('0xf')]=_0x5c83cd[_0x42b8('0xf')];utils[_0x42b8('0x10')](_0x42b8('0x11'),_0x2f479c);}else{utils['getUserByName'](_0x2f479c[_0x42b8('0x7')][_0x42b8('0x12')]('/')[0x1])[_0x42b8('0xd')](function(_0x57df36){if(_0x57df36){_0x2f479c[_0x42b8('0xa')]=_0x57df36[_0x42b8('0xe')];_0x2f479c[_0x42b8('0xf')]=_0x57df36['internal'];utils[_0x42b8('0x10')](_0x42b8('0x11'),_0x2f479c);}});}})['catch'](function(_0x1aa6a1){utils[_0x42b8('0x13')](util[_0x42b8('0x4')](_0x42b8('0x14'),_0x2f479c[_0x42b8('0x6')]),_0x1aa6a1);});}delete members[_0x2f479c[_0x42b8('0x7')]];}function startsWith(_0x1638f5,_0x49e6be){return _['some'](_0x1638f5,function(_0x276222){return _[_0x42b8('0x15')](_0x49e6be,_0x276222);});}exports[_0x42b8('0x16')]=function(_0x59be69){try{utils[_0x42b8('0x17')](util[_0x42b8('0x4')]('[%s][members][devicestatechange]',members[_0x59be69[_0x42b8('0x18')]]?members[_0x59be69[_0x42b8('0x18')]][_0x42b8('0x6')]:_0x59be69[_0x42b8('0x18')]),_0x59be69);utils[_0x42b8('0x19')](util[_0x42b8('0x4')](_0x42b8('0x1a'),members[_0x59be69[_0x42b8('0x18')]]?members[_0x59be69[_0x42b8('0x18')]]['uniqueid']:_0x59be69[_0x42b8('0x18')],_0x59be69[_0x42b8('0x1b')],_0x59be69['device']));switch(_0x59be69[_0x42b8('0x1b')]){case _0x42b8('0x1c'):case _0x42b8('0x1d'):if(!startsWith(exclude,_0x59be69[_0x42b8('0x18')])){members[_0x59be69[_0x42b8('0x18')]]={'channel':_0x42b8('0x1e'),'interface':_0x59be69[_0x42b8('0x18')],'type':_0x42b8('0x1f'),'enterAt':utils[_0x42b8('0x20')](),'role':_0x42b8('0x21')};}break;case _0x42b8('0x22'):if(!_[_0x42b8('0x23')](members[_0x59be69[_0x42b8('0x18')]])){members[_0x59be69[_0x42b8('0x18')]][_0x42b8('0x24')]=utils['now']();members[_0x59be69[_0x42b8('0x18')]][_0x42b8('0x25')]=utils[_0x42b8('0x26')](members[_0x59be69[_0x42b8('0x18')]][_0x42b8('0x24')],members[_0x59be69[_0x42b8('0x18')]][_0x42b8('0x27')]);if(members[_0x59be69[_0x42b8('0x18')]][_0x42b8('0x6')]){writeDB(members[_0x59be69[_0x42b8('0x18')]]);}}break;default:break;}}catch(_0x28841e){utils['error'](util['format'](_0x42b8('0x28'),members[_0x59be69[_0x42b8('0x18')]]?members[_0x59be69[_0x42b8('0x18')]]['uniqueid']:_0x59be69['device']),_0x28841e);}};exports[_0x42b8('0x29')]=function(_0x2a08e6){try{if(!_[_0x42b8('0x23')](members[_0x2a08e6['interface']])){utils[_0x42b8('0x17')](util[_0x42b8('0x4')](_0x42b8('0x2a'),_0x2a08e6[_0x42b8('0x6')]),_0x2a08e6);utils[_0x42b8('0x19')](util[_0x42b8('0x4')](_0x42b8('0x2b'),_0x2a08e6[_0x42b8('0x6')],_0x2a08e6[_0x42b8('0x7')],_0x2a08e6['queue']));members[_0x2a08e6[_0x42b8('0x7')]]=_[_0x42b8('0x2c')](members[_0x2a08e6[_0x42b8('0x7')]],{'data4':_0x2a08e6[_0x42b8('0x2d')],'uniqueid':_0x2a08e6[_0x42b8('0x6')]});}}catch(_0x1c5958){utils[_0x42b8('0x13')](util['format'](_0x42b8('0x2a'),_0x2a08e6[_0x42b8('0x6')]),_0x1c5958);}};exports[_0x42b8('0x2e')]=function(_0x55de8a){try{utils[_0x42b8('0x17')](util['format']('[%s][members][cdr]',_0x55de8a['uniqueid']),_0x55de8a);if(_0x55de8a[_0x42b8('0x8')]){var _0x2342f1=_0x55de8a[_0x42b8('0x8')][_0x42b8('0x12')]('-')[0x0];if(!_[_0x42b8('0x23')](members[_0x2342f1])){members[_0x2342f1]=_[_0x42b8('0x2c')](members[_0x2342f1],{'data1':members[_0x2342f1][_0x42b8('0x2f')]||_0x55de8a[_0x42b8('0xb')],'data2':members[_0x2342f1][_0x42b8('0x9')]||_0x55de8a[_0x42b8('0x30')],'data3':members[_0x2342f1][_0x42b8('0x31')]||_0x55de8a['destination'],'uniqueid':members[_0x2342f1][_0x42b8('0x6')]||_0x55de8a[_0x42b8('0x6')]});utils['info'](util['format'](_0x42b8('0x32'),_0x55de8a[_0x42b8('0x6')],members[_0x2342f1][_0x42b8('0x2f')],members[_0x2342f1][_0x42b8('0x9')],members[_0x2342f1][_0x42b8('0x31')]));if(members[_0x2342f1][_0x42b8('0x24')]){writeDB(members[_0x2342f1]);}}}if(_0x55de8a['destinationchannel']){var _0x4afeb7=_0x55de8a[_0x42b8('0x33')][_0x42b8('0x12')]('-')[0x0];if(!_[_0x42b8('0x23')](members[_0x4afeb7])){members[_0x4afeb7]=_[_0x42b8('0x2c')](members[_0x4afeb7],{'data1':members[_0x4afeb7][_0x42b8('0x2f')]||_0x55de8a[_0x42b8('0xb')],'data2':members[_0x4afeb7]['data2']||_0x55de8a[_0x42b8('0x30')],'data3':members[_0x4afeb7][_0x42b8('0x31')]||_0x55de8a[_0x42b8('0x34')],'uniqueid':members[_0x4afeb7][_0x42b8('0x6')]||_0x55de8a[_0x42b8('0x6')]});utils['info'](util[_0x42b8('0x4')](_0x42b8('0x32'),_0x55de8a['uniqueid'],members[_0x4afeb7][_0x42b8('0x2f')],members[_0x4afeb7]['data2'],members[_0x4afeb7][_0x42b8('0x31')]));if(members[_0x4afeb7][_0x42b8('0x24')]){writeDB(members[_0x4afeb7]);}}}}catch(_0x476ed8){utils['error'](util[_0x42b8('0x4')](_0x42b8('0x35'),_0x55de8a['uniqueid']),_0x476ed8);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 6812686..2a02056 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 _0x0245=['format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','accountcode','getVoiceQueueByName','then','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','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','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info'];(function(_0x431e4f,_0x284597){var _0x14b76d=function(_0x4ffe93){while(--_0x4ffe93){_0x431e4f['push'](_0x431e4f['shift']());}};_0x14b76d(++_0x284597);}(_0x0245,0xdb));var _0x5024=function(_0x43a8a2,_0x25c502){_0x43a8a2=_0x43a8a2-0x0;var _0x345d3f=_0x0245[_0x43a8a2];return _0x345d3f;};'use strict';var _=require(_0x5024('0x0'));var util=require('util');var utils=require(_0x5024('0x1'));var queues={};function writeDB(_0xd767e4){utils[_0x5024('0x2')](util[_0x5024('0x3')](_0x5024('0x4'),_0xd767e4[_0x5024('0x5')],_0xd767e4[_0x5024('0x6')],_0xd767e4[_0x5024('0x7')],_0xd767e4['lastAssignedTo'],_0xd767e4['calleridnum'],_0xd767e4[_0x5024('0x8')],_0xd767e4['queuecallerexitreason']));if(_0xd767e4['queue']){utils[_0x5024('0x9')](_0xd767e4[_0x5024('0x7')])[_0x5024('0xa')](function(_0x13ea33){if(_0x13ea33){_0xd767e4[_0x5024('0xb')]=_0x13ea33[_0x5024('0xb')];}utils['request'](_0x5024('0xc'),_0xd767e4);});}else{utils['request'](_0x5024('0xc'),_0xd767e4);}if(_0xd767e4[_0x5024('0xd')]){delete queues[_0xd767e4[_0x5024('0xd')]];}else{delete queues[_0xd767e4[_0x5024('0x5')]];}}exports[_0x5024('0xe')]=function(_0x433165){try{utils['debug'](util[_0x5024('0x3')](_0x5024('0xf'),_0x433165['uniqueid']),_0x433165);utils[_0x5024('0x2')](util[_0x5024('0x3')](_0x5024('0x10'),_0x433165[_0x5024('0x5')],_0x433165[_0x5024('0x7')],_0x433165[_0x5024('0x11')]));queues[_0x433165['uniqueid']]=_[_0x5024('0x12')](_0x433165,{'originalposition':_0x433165[_0x5024('0x11')],'queuecallerjoinAt':utils[_0x5024('0x13')](),'mohtime':0x0});}catch(_0x1b214a){utils[_0x5024('0x14')](util['format']('[%s][queues][queuecallerjoin]',_0x433165['uniqueid']),_0x1b214a);}};exports[_0x5024('0x15')]=function(_0x57593b){try{if(!_[_0x5024('0x16')](queues[_0x57593b[_0x5024('0x5')]])){utils[_0x5024('0x17')](util[_0x5024('0x3')](_0x5024('0x18'),_0x57593b['uniqueid']),_0x57593b);if(queues[_0x57593b[_0x5024('0x5')]][_0x5024('0x19')]){if(!queues[_0x57593b['uniqueid']][_0x5024('0x1a')]&&!queues[_0x57593b[_0x5024('0x5')]][_0x5024('0x1b')]){queues[_0x57593b[_0x5024('0x5')]][_0x5024('0x1c')]=!![];queues[_0x57593b[_0x5024('0x5')]][_0x5024('0x1d')]=utils['now']();queues[_0x57593b[_0x5024('0x5')]][_0x5024('0x1e')]=_0x5024('0x1f');}utils[_0x5024('0x2')](util[_0x5024('0x3')](_0x5024('0x20'),_0x57593b['uniqueid'],queues[_0x57593b[_0x5024('0x5')]]['name'],queues[_0x57593b[_0x5024('0x5')]][_0x5024('0x1e')]));writeDB(queues[_0x57593b[_0x5024('0x5')]]);}else if(queues[_0x57593b[_0x5024('0x5')]][_0x5024('0xd')]){utils[_0x5024('0x2')](util[_0x5024('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x57593b['uniqueid'],queues[_0x57593b[_0x5024('0x5')]][_0x5024('0x21')],queues[_0x57593b[_0x5024('0x5')]][_0x5024('0xd')]));queues[queues[_0x57593b[_0x5024('0x5')]][_0x5024('0xd')]]=queues[_0x57593b[_0x5024('0x5')]];queues[queues[_0x57593b['uniqueid']][_0x5024('0xd')]][_0x5024('0x22')]=0x2;delete queues[_0x57593b['uniqueid']];}}}catch(_0x577af1){utils[_0x5024('0x14')](util[_0x5024('0x3')]('[%s][queues][hangup]',_0x57593b[_0x5024('0x5')]),_0x577af1);}};exports[_0x5024('0x23')]=function(_0x80170a){try{utils[_0x5024('0x17')](util[_0x5024('0x3')](_0x5024('0x24'),_0x80170a[_0x5024('0x5')]),_0x80170a);if(!_[_0x5024('0x16')](_0x80170a[_0x5024('0x25')][_0x5024('0x26')])&&_0x80170a[_0x5024('0x27')][_0x5024('0x28')]()!=='CONTINUE'){if(!_[_0x5024('0x16')](queues[_0x80170a[_0x5024('0x5')]])){queues[_0x80170a[_0x5024('0x5')]]['queuecallerabandon']=![];queues[_0x80170a[_0x5024('0x5')]][_0x5024('0x29')]=null;queues[_0x80170a[_0x5024('0x5')]][_0x5024('0x1b')]=!![];queues[_0x80170a[_0x5024('0x5')]][_0x5024('0x2a')]=utils['now']();queues[_0x80170a[_0x5024('0x5')]][_0x5024('0x1e')]=_0x80170a[_0x5024('0x27')][_0x5024('0x28')]();utils[_0x5024('0x2')](util[_0x5024('0x3')](_0x5024('0x2b'),_0x80170a['uniqueid'],queues[_0x80170a[_0x5024('0x5')]][_0x5024('0x21')],_0x80170a['value'],queues[_0x80170a[_0x5024('0x5')]][_0x5024('0x1e')]));writeDB(queues[_0x80170a[_0x5024('0x5')]]);}}else if(!_[_0x5024('0x16')](_0x80170a[_0x5024('0x25')][_0x5024('0x2c')])){if(!_[_0x5024('0x16')](queues[_0x80170a['uniqueid']])&&!queues[_0x80170a[_0x5024('0x5')]][_0x5024('0x1a')]){queues[_0x80170a[_0x5024('0x5')]][_0x5024('0x1a')]=![];queues[_0x80170a[_0x5024('0x5')]]['queuecallerabandonAt']=null;queues[_0x80170a['uniqueid']][_0x5024('0x1b')]=!![];queues[_0x80170a[_0x5024('0x5')]][_0x5024('0x2a')]=utils[_0x5024('0x13')]();queues[_0x80170a['uniqueid']][_0x5024('0x1e')]=_0x5024('0x2d');utils[_0x5024('0x2')](util[_0x5024('0x3')](_0x5024('0x2e'),_0x80170a[_0x5024('0x5')],queues[_0x80170a['uniqueid']][_0x5024('0x21')],_0x80170a['value'],queues[_0x80170a[_0x5024('0x5')]][_0x5024('0x1e')]));}}}catch(_0x13c2a4){utils['error'](util[_0x5024('0x3')](_0x5024('0x24'),_0x80170a['uniqueid']),_0x13c2a4);}};exports['queuecallerabandon']=function(_0x3a5f19){try{if(!_['isNil'](queues[_0x3a5f19[_0x5024('0x5')]])){utils['debug'](util[_0x5024('0x3')](_0x5024('0x2f'),_0x3a5f19[_0x5024('0x5')]),_0x3a5f19);queues[_0x3a5f19[_0x5024('0x5')]][_0x5024('0x1b')]=![];queues[_0x3a5f19[_0x5024('0x5')]][_0x5024('0x2a')]=null;queues[_0x3a5f19[_0x5024('0x5')]][_0x5024('0x1a')]=!![];queues[_0x3a5f19[_0x5024('0x5')]]['queuecallerabandonAt']=utils[_0x5024('0x13')]();queues[_0x3a5f19[_0x5024('0x5')]][_0x5024('0x1e')]=_0x5024('0x30');utils[_0x5024('0x2')](util[_0x5024('0x3')](_0x5024('0x31'),_0x3a5f19[_0x5024('0x5')],queues[_0x3a5f19[_0x5024('0x5')]]['name'],queues[_0x3a5f19[_0x5024('0x5')]]['queuecallerexitreason']));}}catch(_0x3b3083){utils[_0x5024('0x14')](util[_0x5024('0x3')](_0x5024('0x2f'),_0x3a5f19['uniqueid']),_0x3b3083);}};exports['queuecallerleave']=function(_0x50fd78){try{if(!_[_0x5024('0x16')](queues[_0x50fd78[_0x5024('0x5')]])){utils[_0x5024('0x17')](util['format'](_0x5024('0x32'),_0x50fd78[_0x5024('0x5')]),_0x50fd78);utils[_0x5024('0x2')](util['format'](_0x5024('0x33'),_0x50fd78[_0x5024('0x5')],queues[_0x50fd78['uniqueid']][_0x5024('0x21')],_0x50fd78['connectedlinenum'],_0x50fd78[_0x5024('0x34')]));queues[_0x50fd78['uniqueid']][_0x5024('0x35')]=!![];queues[_0x50fd78[_0x5024('0x5')]][_0x5024('0x19')]=utils[_0x5024('0x13')]();queues[_0x50fd78[_0x5024('0x5')]][_0x5024('0x36')]=utils[_0x5024('0x37')](queues[_0x50fd78[_0x5024('0x5')]][_0x5024('0x19')],queues[_0x50fd78[_0x5024('0x5')]][_0x5024('0x38')]);queues[_0x50fd78[_0x5024('0x5')]][_0x5024('0x11')]=_0x50fd78['position'];queues[_0x50fd78[_0x5024('0x5')]][_0x5024('0x39')]=_0x50fd78['count'];queues[_0x50fd78[_0x5024('0x5')]][_0x5024('0x3a')]=_0x50fd78[_0x5024('0x3a')];queues[_0x50fd78[_0x5024('0x5')]][_0x5024('0x34')]=_0x50fd78['connectedlinename'];}}catch(_0x4d4fb3){utils['error'](util['format'](_0x5024('0x32'),_0x50fd78[_0x5024('0x5')]),_0x4d4fb3);}};exports[_0x5024('0x3b')]=function(_0x284a36){try{if(!_['isNil'](queues[_0x284a36['uniqueid']])){utils[_0x5024('0x17')](util['format'](_0x5024('0x3c'),_0x284a36[_0x5024('0x5')]),_0x284a36);utils[_0x5024('0x2')](util[_0x5024('0x3')](_0x5024('0x3d'),_0x284a36[_0x5024('0x5')],queues[_0x284a36[_0x5024('0x5')]][_0x5024('0x21')],_0x284a36[_0x5024('0x3e')],_0x284a36[_0x5024('0x3f')]));queues[_0x284a36[_0x5024('0x5')]]['queuecallerabandon']=![];queues[_0x284a36['uniqueid']][_0x5024('0x1a')]=![];queues[_0x284a36[_0x5024('0x5')]][_0x5024('0x29')]=null;queues[_0x284a36[_0x5024('0x5')]][_0x5024('0x1b')]=![];queues[_0x284a36['uniqueid']]['queuecallerexitreason']=null;queues[_0x284a36[_0x5024('0x5')]][_0x5024('0x2a')]=null;queues[_0x284a36[_0x5024('0x5')]][_0x5024('0x40')]=!![];queues[_0x284a36[_0x5024('0x5')]]['accountcode']=_0x284a36[_0x5024('0x3f')];queues[_0x284a36[_0x5024('0x5')]][_0x5024('0x41')]=_0x284a36[_0x5024('0x3e')];}}catch(_0x1310a9){utils[_0x5024('0x14')](util['format'](_0x5024('0x3c'),_0x284a36[_0x5024('0x5')]),_0x1310a9);}};exports[_0x5024('0x42')]=function(_0x8f8706){try{if(!_[_0x5024('0x16')](queues[_0x8f8706[_0x5024('0x5')]])){if(queues[_0x8f8706[_0x5024('0x5')]]['queuecallerleaveAt']){utils['debug'](util[_0x5024('0x3')](_0x5024('0x43'),_0x8f8706[_0x5024('0x5')]),_0x8f8706);queues[_0x8f8706[_0x5024('0x5')]][_0x5024('0x1a')]=![];queues[_0x8f8706[_0x5024('0x5')]][_0x5024('0x1a')]=![];queues[_0x8f8706[_0x5024('0x5')]][_0x5024('0x29')]=null;queues[_0x8f8706[_0x5024('0x5')]]['queuecallerexit']=![];queues[_0x8f8706[_0x5024('0x5')]][_0x5024('0x2a')]=null;queues[_0x8f8706[_0x5024('0x5')]][_0x5024('0x40')]=!![];queues[_0x8f8706[_0x5024('0x5')]][_0x5024('0x41')]=_0x8f8706['membername'];queues[_0x8f8706[_0x5024('0x5')]][_0x5024('0x1c')]=!![];queues[_0x8f8706[_0x5024('0x5')]][_0x5024('0x1d')]=utils[_0x5024('0x13')]();if(_0x8f8706[_0x5024('0x44')]=='transfer'){if(!queues[_0x8f8706['uniqueid']][_0x5024('0x45')]){queues[_0x8f8706[_0x5024('0x5')]][_0x5024('0x1e')]=_0x5024('0x46');}}else{queues[_0x8f8706[_0x5024('0x5')]][_0x5024('0x1e')]=_0x5024('0x47')+_0x8f8706['reason'][_0x5024('0x28')]();}utils[_0x5024('0x2')](util[_0x5024('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x8f8706[_0x5024('0x5')],queues[_0x8f8706[_0x5024('0x5')]][_0x5024('0x21')],_0x8f8706[_0x5024('0x3e')],queues[_0x8f8706[_0x5024('0x5')]][_0x5024('0x1e')]));writeDB(queues[_0x8f8706['uniqueid']]);}}}catch(_0xa85a71){utils[_0x5024('0x14')](util[_0x5024('0x3')](_0x5024('0x43'),_0x8f8706[_0x5024('0x5')]),_0xa85a71);}};exports[_0x5024('0x48')]=function(_0x1e964f){try{if(!_[_0x5024('0x16')](queues[_0x1e964f['transfereeuniqueid']])){utils[_0x5024('0x17')](util[_0x5024('0x3')](_0x5024('0x49'),_0x1e964f[_0x5024('0x5')]),_0x1e964f);queues[_0x1e964f['transfereeuniqueid']][_0x5024('0x45')]=!![];queues[_0x1e964f[_0x5024('0x4a')]][_0x5024('0x4b')]=_0x5024('0x4c');queues[_0x1e964f[_0x5024('0x4a')]][_0x5024('0x4d')]=_0x1e964f[_0x5024('0x4e')];queues[_0x1e964f[_0x5024('0x4a')]]['transferuniqueid']=_0x1e964f[_0x5024('0x4a')];queues[_0x1e964f[_0x5024('0x4a')]][_0x5024('0x1e')]=_0x5024('0x4f');utils[_0x5024('0x2')](util[_0x5024('0x3')](_0x5024('0x50'),_0x1e964f[_0x5024('0x5')],queues[_0x1e964f['transfereeuniqueid']][_0x5024('0x21')],_0x1e964f[_0x5024('0x4a')],_0x1e964f['extension']));}}catch(_0x28beca){utils[_0x5024('0x14')](util[_0x5024('0x3')](_0x5024('0x49'),_0x1e964f[_0x5024('0x5')]),_0x28beca);}};exports[_0x5024('0x51')]=function(_0x2061f1){try{utils[_0x5024('0x17')](util[_0x5024('0x3')](_0x5024('0x52'),_0x2061f1[_0x5024('0x53')]),_0x2061f1);if(_0x2061f1[_0x5024('0x53')]==_0x2061f1[_0x5024('0x54')]){if(!_[_0x5024('0x16')](queues[_0x2061f1[_0x5024('0x55')]])){utils[_0x5024('0x2')](util[_0x5024('0x3')](_0x5024('0x56'),_0x2061f1[_0x5024('0x53')],queues[_0x2061f1[_0x5024('0x55')]]['name'],_0x2061f1['origtransfererexten']));queues[_0x2061f1[_0x5024('0x55')]][_0x5024('0x45')]=!![];queues[_0x2061f1['secondtransfererlinkedid']][_0x5024('0x4b')]='ATTENDED';queues[_0x2061f1['secondtransfererlinkedid']]['transferexten']=_0x2061f1[_0x5024('0x57')];queues[_0x2061f1['secondtransfererlinkedid']][_0x5024('0x58')]=_0x2061f1['origtransfereruniqueid'];queues[_0x2061f1[_0x5024('0x55')]][_0x5024('0x1e')]=_0x5024('0x59');}if(!_[_0x5024('0x16')](queues[_0x2061f1['origtransfererlinkedid']])){if(_0x2061f1[_0x5024('0x5a')]&&queues[_0x2061f1[_0x5024('0x5a')]]){queues[_0x2061f1[_0x5024('0x5a')]]['queuecallerenterreason']=0x1;queues[_0x2061f1[_0x5024('0x4a')]]=_[_0x5024('0x5b')](queues[_0x2061f1[_0x5024('0x5a')]]);queues[_0x2061f1[_0x5024('0x4a')]][_0x5024('0xd')]=_0x2061f1[_0x5024('0x5c')];queues[_0x2061f1[_0x5024('0x4a')]][_0x5024('0x22')]=0x2;queues[_0x2061f1['transfereeuniqueid']][_0x5024('0x5d')]=queues[_0x2061f1[_0x5024('0x55')]][_0x5024('0x5d')];queues[_0x2061f1['transfereeuniqueid']][_0x5024('0x5e')]=queues[_0x2061f1[_0x5024('0x55')]][_0x5024('0x5e')];queues[_0x2061f1['transfereeuniqueid']][_0x5024('0x38')]=utils[_0x5024('0x13')]();queues[_0x2061f1[_0x5024('0x4a')]][_0x5024('0x19')]=utils[_0x5024('0x13')]();queues[_0x2061f1['transfereeuniqueid']][_0x5024('0x36')]=0x0;queues[_0x2061f1[_0x5024('0x4a')]][_0x5024('0x5f')]=0x0;utils[_0x5024('0x2')](util[_0x5024('0x3')](_0x5024('0x60'),_0x2061f1[_0x5024('0x53')],queues[_0x2061f1[_0x5024('0x4a')]]['name'],queues[_0x2061f1[_0x5024('0x4a')]][_0x5024('0x5d')],queues[_0x2061f1[_0x5024('0x4a')]][_0x5024('0x5e')]));}else{utils['info'](util[_0x5024('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x2061f1['origtransfereruniqueid'],queues[_0x2061f1[_0x5024('0x54')]][_0x5024('0x21')],_0x2061f1[_0x5024('0x55')]));queues[_0x2061f1['origtransfererlinkedid']][_0x5024('0xd')]=_0x2061f1[_0x5024('0x55')];}}}else if(_0x2061f1[_0x5024('0x61')]==_0x2061f1[_0x5024('0x55')]){if(!_[_0x5024('0x16')](queues[_0x2061f1['origtransfererlinkedid']])){utils['info'](util['format'](_0x5024('0x62'),_0x2061f1[_0x5024('0x53')],queues[_0x2061f1[_0x5024('0x54')]][_0x5024('0x21')],_0x2061f1[_0x5024('0x61')],_0x2061f1[_0x5024('0x63')]));queues[_0x2061f1[_0x5024('0x54')]][_0x5024('0x45')]=!![];queues[_0x2061f1[_0x5024('0x54')]]['transfertype']=_0x5024('0x64');queues[_0x2061f1[_0x5024('0x54')]][_0x5024('0x4d')]=_0x2061f1['secondtransfererexten'];queues[_0x2061f1['origtransfererlinkedid']]['transferuniqueid']=_0x2061f1['secondtransfereruniqueid'];queues[_0x2061f1[_0x5024('0x54')]]['queuecallerexitreason']=_0x5024('0x59');}if(!_[_0x5024('0x16')](queues[_0x2061f1[_0x5024('0x55')]])){if(_0x2061f1[_0x5024('0x65')]&&queues[_0x2061f1[_0x5024('0x65')]]){queues[_0x2061f1['transfertargetlinkedid']][_0x5024('0x22')]=0x1;queues[_0x2061f1['transfertargetuniqueid']]=_['clone'](queues[_0x2061f1['transfertargetlinkedid']]);queues[_0x2061f1['transfertargetuniqueid']]['transfereduniqueid']=_0x2061f1[_0x5024('0x5c')];queues[_0x2061f1[_0x5024('0x5c')]][_0x5024('0x22')]=0x2;queues[_0x2061f1['transfertargetuniqueid']][_0x5024('0x5d')]=queues[_0x2061f1[_0x5024('0x54')]][_0x5024('0x5d')];queues[_0x2061f1['transfertargetuniqueid']][_0x5024('0x5e')]=queues[_0x2061f1[_0x5024('0x54')]][_0x5024('0x5e')];queues[_0x2061f1[_0x5024('0x5c')]][_0x5024('0x38')]=utils[_0x5024('0x13')]();queues[_0x2061f1[_0x5024('0x5c')]][_0x5024('0x19')]=utils[_0x5024('0x13')]();queues[_0x2061f1[_0x5024('0x5c')]][_0x5024('0x36')]=0x0;queues[_0x2061f1[_0x5024('0x5c')]][_0x5024('0x5f')]=0x0;utils[_0x5024('0x2')](util['format'](_0x5024('0x66'),_0x2061f1[_0x5024('0x53')],queues[_0x2061f1[_0x5024('0x5c')]][_0x5024('0x21')],queues[_0x2061f1[_0x5024('0x5c')]][_0x5024('0xd')],queues[_0x2061f1[_0x5024('0x5c')]][_0x5024('0x5d')],queues[_0x2061f1[_0x5024('0x5c')]][_0x5024('0x5e')]));}else{utils[_0x5024('0x2')](util[_0x5024('0x3')](_0x5024('0x67'),_0x2061f1[_0x5024('0x53')],queues[_0x2061f1[_0x5024('0x55')]][_0x5024('0x21')],_0x2061f1[_0x5024('0x54')]));queues[_0x2061f1[_0x5024('0x55')]]['transfereduniqueid']=_0x2061f1['origtransfererlinkedid'];}}}}catch(_0x5dafc7){utils[_0x5024('0x14')](util['format'](_0x5024('0x52'),_0x2061f1[_0x5024('0x53')]),_0x5dafc7);}};exports[_0x5024('0x68')]=function(_0x127b59){try{if(!_[_0x5024('0x16')](queues[_0x127b59['uniqueid']])){utils['debug'](util[_0x5024('0x3')](_0x5024('0x69'),_0x127b59[_0x5024('0x5')]),_0x127b59);queues[_0x127b59[_0x5024('0x5')]][_0x5024('0x6a')]=utils[_0x5024('0x13')]();utils[_0x5024('0x2')](util[_0x5024('0x3')](_0x5024('0x6b'),_0x127b59[_0x5024('0x5')],queues[_0x127b59[_0x5024('0x5')]]['name'],queues[_0x127b59[_0x5024('0x5')]]['musiconholdstartAt']));}}catch(_0x13cb78){utils[_0x5024('0x14')](util[_0x5024('0x3')]('[%s][queues][musiconholdstart]',_0x127b59['uniqueid']),_0x13cb78);}};exports[_0x5024('0x6c')]=function(_0x3b5840){try{if(!_[_0x5024('0x16')](queues[_0x3b5840[_0x5024('0x5')]])){if(!_[_0x5024('0x16')](queues[_0x3b5840['uniqueid']][_0x5024('0x6a')])){utils['debug'](util[_0x5024('0x3')](_0x5024('0x6d'),_0x3b5840[_0x5024('0x5')]),_0x3b5840);queues[_0x3b5840[_0x5024('0x5')]][_0x5024('0x5f')]+=utils[_0x5024('0x37')](utils[_0x5024('0x13')](),queues[_0x3b5840['uniqueid']]['musiconholdstartAt']);utils[_0x5024('0x2')](util[_0x5024('0x3')](_0x5024('0x6e'),_0x3b5840[_0x5024('0x5')],queues[_0x3b5840[_0x5024('0x5')]][_0x5024('0x21')],queues[_0x3b5840[_0x5024('0x5')]][_0x5024('0x5f')]));delete queues[_0x3b5840[_0x5024('0x5')]][_0x5024('0x6a')];}}}catch(_0x506e53){utils[_0x5024('0x14')](util['format'](_0x5024('0x6d'),_0x3b5840[_0x5024('0x5')]),_0x506e53);}}; \ No newline at end of file +var _0xcded=['[%s][queues][agentconnect]','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','transfer','COMPLETEDBY','transfereeuniqueid','[%s][queues][blindtransfer]','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','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','queue','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','position','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','now','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][queuecallerabandon]','queuecallerexit','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','connectedlinenum','agentconnect'];(function(_0xc00822,_0x24d698){var _0x23cca7=function(_0x221307){while(--_0x221307){_0xc00822['push'](_0xc00822['shift']());}};_0x23cca7(++_0x24d698);}(_0xcded,0x15f));var _0xdcde=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0xcded[_0x95942];return _0x6d7f81;};'use strict';var _=require(_0xdcde('0x0'));var util=require('util');var utils=require(_0xdcde('0x1'));var queues={};function writeDB(_0x19f9df){utils[_0xdcde('0x2')](util[_0xdcde('0x3')](_0xdcde('0x4'),_0x19f9df['uniqueid'],_0x19f9df[_0xdcde('0x5')],_0x19f9df['queue'],_0x19f9df[_0xdcde('0x6')],_0x19f9df[_0xdcde('0x7')],_0x19f9df[_0xdcde('0x8')],_0x19f9df['queuecallerexitreason']));if(_0x19f9df['queue']){utils[_0xdcde('0x9')](_0x19f9df[_0xdcde('0xa')])['then'](function(_0x5ecbb4){if(_0x5ecbb4){_0x19f9df['type']=_0x5ecbb4[_0xdcde('0xb')];}utils[_0xdcde('0xc')](_0xdcde('0xd'),_0x19f9df);});}else{utils[_0xdcde('0xc')](_0xdcde('0xd'),_0x19f9df);}if(_0x19f9df[_0xdcde('0xe')]){delete queues[_0x19f9df[_0xdcde('0xe')]];}else{delete queues[_0x19f9df[_0xdcde('0xf')]];}}exports[_0xdcde('0x10')]=function(_0x473451){try{utils[_0xdcde('0x11')](util[_0xdcde('0x3')]('[%s][queues][queuecallerjoin]',_0x473451[_0xdcde('0xf')]),_0x473451);utils[_0xdcde('0x2')](util[_0xdcde('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x473451[_0xdcde('0xf')],_0x473451['queue'],_0x473451['position']));queues[_0x473451[_0xdcde('0xf')]]=_['assign'](_0x473451,{'originalposition':_0x473451[_0xdcde('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x3da263){utils['error'](util['format']('[%s][queues][queuecallerjoin]',_0x473451[_0xdcde('0xf')]),_0x3da263);}};exports[_0xdcde('0x13')]=function(_0x5372b0){try{if(!_[_0xdcde('0x14')](queues[_0x5372b0[_0xdcde('0xf')]])){utils[_0xdcde('0x11')](util[_0xdcde('0x3')](_0xdcde('0x15'),_0x5372b0[_0xdcde('0xf')]),_0x5372b0);if(queues[_0x5372b0[_0xdcde('0xf')]][_0xdcde('0x16')]){if(!queues[_0x5372b0[_0xdcde('0xf')]][_0xdcde('0x17')]&&!queues[_0x5372b0[_0xdcde('0xf')]]['queuecallerexit']){queues[_0x5372b0['uniqueid']][_0xdcde('0x18')]=!![];queues[_0x5372b0[_0xdcde('0xf')]]['queuecallercompleteAt']=utils[_0xdcde('0x19')]();queues[_0x5372b0[_0xdcde('0xf')]][_0xdcde('0x1a')]=_0xdcde('0x1b');}utils[_0xdcde('0x2')](util[_0xdcde('0x3')](_0xdcde('0x1c'),_0x5372b0[_0xdcde('0xf')],queues[_0x5372b0[_0xdcde('0xf')]][_0xdcde('0x1d')],queues[_0x5372b0['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x5372b0[_0xdcde('0xf')]]);}else if(queues[_0x5372b0[_0xdcde('0xf')]][_0xdcde('0xe')]){utils[_0xdcde('0x2')](util[_0xdcde('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x5372b0[_0xdcde('0xf')],queues[_0x5372b0['uniqueid']][_0xdcde('0x1d')],queues[_0x5372b0[_0xdcde('0xf')]][_0xdcde('0xe')]));queues[queues[_0x5372b0[_0xdcde('0xf')]][_0xdcde('0xe')]]=queues[_0x5372b0[_0xdcde('0xf')]];queues[queues[_0x5372b0['uniqueid']]['transfereduniqueid']][_0xdcde('0x1e')]=0x2;delete queues[_0x5372b0[_0xdcde('0xf')]];}}}catch(_0x26edfd){utils[_0xdcde('0x1f')](util[_0xdcde('0x3')](_0xdcde('0x15'),_0x5372b0[_0xdcde('0xf')]),_0x26edfd);}};exports[_0xdcde('0x20')]=function(_0x526e66){try{utils[_0xdcde('0x11')](util[_0xdcde('0x3')](_0xdcde('0x21'),_0x526e66[_0xdcde('0xf')]),_0x526e66);if(!_[_0xdcde('0x14')](_0x526e66[_0xdcde('0x22')][_0xdcde('0x23')])&&_0x526e66[_0xdcde('0x24')][_0xdcde('0x25')]()!==_0xdcde('0x26')){if(!_[_0xdcde('0x14')](queues[_0x526e66[_0xdcde('0xf')]])){queues[_0x526e66['uniqueid']][_0xdcde('0x17')]=![];queues[_0x526e66[_0xdcde('0xf')]][_0xdcde('0x27')]=null;queues[_0x526e66[_0xdcde('0xf')]]['queuecallerexit']=!![];queues[_0x526e66['uniqueid']]['queuecallerexitAt']=utils[_0xdcde('0x19')]();queues[_0x526e66['uniqueid']]['queuecallerexitreason']=_0x526e66[_0xdcde('0x24')][_0xdcde('0x25')]();utils[_0xdcde('0x2')](util[_0xdcde('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x526e66[_0xdcde('0xf')],queues[_0x526e66[_0xdcde('0xf')]]['name'],_0x526e66[_0xdcde('0x24')],queues[_0x526e66[_0xdcde('0xf')]][_0xdcde('0x1a')]));writeDB(queues[_0x526e66[_0xdcde('0xf')]]);}}else if(!_[_0xdcde('0x14')](_0x526e66[_0xdcde('0x22')][_0xdcde('0x28')])){if(!_[_0xdcde('0x14')](queues[_0x526e66[_0xdcde('0xf')]])&&!queues[_0x526e66[_0xdcde('0xf')]]['queuecallerabandon']){queues[_0x526e66[_0xdcde('0xf')]][_0xdcde('0x17')]=![];queues[_0x526e66[_0xdcde('0xf')]]['queuecallerabandonAt']=null;queues[_0x526e66['uniqueid']]['queuecallerexit']=!![];queues[_0x526e66[_0xdcde('0xf')]][_0xdcde('0x29')]=utils['now']();queues[_0x526e66[_0xdcde('0xf')]][_0xdcde('0x1a')]=_0xdcde('0x2a');utils[_0xdcde('0x2')](util[_0xdcde('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x526e66[_0xdcde('0xf')],queues[_0x526e66[_0xdcde('0xf')]]['name'],_0x526e66[_0xdcde('0x24')],queues[_0x526e66['uniqueid']][_0xdcde('0x1a')]));}}}catch(_0x5d9f33){utils[_0xdcde('0x1f')](util[_0xdcde('0x3')]('[%s][queues][varset]',_0x526e66[_0xdcde('0xf')]),_0x5d9f33);}};exports[_0xdcde('0x17')]=function(_0x4a6a26){try{if(!_[_0xdcde('0x14')](queues[_0x4a6a26[_0xdcde('0xf')]])){utils[_0xdcde('0x11')](util[_0xdcde('0x3')](_0xdcde('0x2b'),_0x4a6a26[_0xdcde('0xf')]),_0x4a6a26);queues[_0x4a6a26[_0xdcde('0xf')]][_0xdcde('0x2c')]=![];queues[_0x4a6a26[_0xdcde('0xf')]]['queuecallerexitAt']=null;queues[_0x4a6a26[_0xdcde('0xf')]][_0xdcde('0x17')]=!![];queues[_0x4a6a26['uniqueid']][_0xdcde('0x27')]=utils[_0xdcde('0x19')]();queues[_0x4a6a26[_0xdcde('0xf')]][_0xdcde('0x1a')]=_0xdcde('0x2d');utils[_0xdcde('0x2')](util['format'](_0xdcde('0x2e'),_0x4a6a26['uniqueid'],queues[_0x4a6a26[_0xdcde('0xf')]][_0xdcde('0x1d')],queues[_0x4a6a26[_0xdcde('0xf')]][_0xdcde('0x1a')]));}}catch(_0x7b7c41){utils[_0xdcde('0x1f')](util['format'](_0xdcde('0x2b'),_0x4a6a26[_0xdcde('0xf')]),_0x7b7c41);}};exports[_0xdcde('0x2f')]=function(_0x42eb9c){try{if(!_['isNil'](queues[_0x42eb9c['uniqueid']])){utils[_0xdcde('0x11')](util[_0xdcde('0x3')](_0xdcde('0x30'),_0x42eb9c[_0xdcde('0xf')]),_0x42eb9c);utils['info'](util[_0xdcde('0x3')](_0xdcde('0x31'),_0x42eb9c[_0xdcde('0xf')],queues[_0x42eb9c[_0xdcde('0xf')]][_0xdcde('0x1d')],_0x42eb9c['connectedlinenum'],_0x42eb9c[_0xdcde('0x32')]));queues[_0x42eb9c[_0xdcde('0xf')]][_0xdcde('0x2f')]=!![];queues[_0x42eb9c['uniqueid']][_0xdcde('0x16')]=utils['now']();queues[_0x42eb9c[_0xdcde('0xf')]][_0xdcde('0x33')]=utils[_0xdcde('0x34')](queues[_0x42eb9c['uniqueid']]['queuecallerleaveAt'],queues[_0x42eb9c[_0xdcde('0xf')]][_0xdcde('0x35')]);queues[_0x42eb9c[_0xdcde('0xf')]][_0xdcde('0x12')]=_0x42eb9c[_0xdcde('0x12')];queues[_0x42eb9c[_0xdcde('0xf')]][_0xdcde('0x36')]=_0x42eb9c[_0xdcde('0x36')];queues[_0x42eb9c[_0xdcde('0xf')]][_0xdcde('0x37')]=_0x42eb9c[_0xdcde('0x37')];queues[_0x42eb9c['uniqueid']][_0xdcde('0x32')]=_0x42eb9c['connectedlinename'];}}catch(_0x21d73a){utils[_0xdcde('0x1f')](util[_0xdcde('0x3')](_0xdcde('0x30'),_0x42eb9c[_0xdcde('0xf')]),_0x21d73a);}};exports[_0xdcde('0x38')]=function(_0x1972b9){try{if(!_[_0xdcde('0x14')](queues[_0x1972b9[_0xdcde('0xf')]])){utils['debug'](util[_0xdcde('0x3')](_0xdcde('0x39'),_0x1972b9[_0xdcde('0xf')]),_0x1972b9);utils[_0xdcde('0x2')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x1972b9[_0xdcde('0xf')],queues[_0x1972b9[_0xdcde('0xf')]][_0xdcde('0x1d')],_0x1972b9[_0xdcde('0x3a')],_0x1972b9['destaccountcode']));queues[_0x1972b9['uniqueid']][_0xdcde('0x17')]=![];queues[_0x1972b9['uniqueid']]['queuecallerabandon']=![];queues[_0x1972b9[_0xdcde('0xf')]]['queuecallerabandonAt']=null;queues[_0x1972b9[_0xdcde('0xf')]][_0xdcde('0x2c')]=![];queues[_0x1972b9[_0xdcde('0xf')]][_0xdcde('0x1a')]=null;queues[_0x1972b9[_0xdcde('0xf')]][_0xdcde('0x29')]=null;queues[_0x1972b9[_0xdcde('0xf')]][_0xdcde('0x3b')]=!![];queues[_0x1972b9[_0xdcde('0xf')]]['accountcode']=_0x1972b9[_0xdcde('0x3c')];queues[_0x1972b9['uniqueid']][_0xdcde('0x6')]=_0x1972b9[_0xdcde('0x3a')];}}catch(_0x474bce){utils[_0xdcde('0x1f')](util['format'](_0xdcde('0x39'),_0x1972b9[_0xdcde('0xf')]),_0x474bce);}};exports[_0xdcde('0x3d')]=function(_0x49ea3a){try{if(!_[_0xdcde('0x14')](queues[_0x49ea3a[_0xdcde('0xf')]])){if(queues[_0x49ea3a[_0xdcde('0xf')]][_0xdcde('0x16')]){utils[_0xdcde('0x11')](util['format'](_0xdcde('0x3e'),_0x49ea3a[_0xdcde('0xf')]),_0x49ea3a);queues[_0x49ea3a[_0xdcde('0xf')]][_0xdcde('0x17')]=![];queues[_0x49ea3a[_0xdcde('0xf')]][_0xdcde('0x17')]=![];queues[_0x49ea3a[_0xdcde('0xf')]][_0xdcde('0x27')]=null;queues[_0x49ea3a['uniqueid']]['queuecallerexit']=![];queues[_0x49ea3a[_0xdcde('0xf')]][_0xdcde('0x29')]=null;queues[_0x49ea3a[_0xdcde('0xf')]][_0xdcde('0x3b')]=!![];queues[_0x49ea3a[_0xdcde('0xf')]]['lastAssignedTo']=_0x49ea3a[_0xdcde('0x3a')];queues[_0x49ea3a[_0xdcde('0xf')]]['queuecallercomplete']=!![];queues[_0x49ea3a[_0xdcde('0xf')]][_0xdcde('0x3f')]=utils[_0xdcde('0x19')]();if(_0x49ea3a['reason']=='transfer'){if(!queues[_0x49ea3a[_0xdcde('0xf')]][_0xdcde('0x40')]){queues[_0x49ea3a['uniqueid']][_0xdcde('0x1a')]='TRANSFER';}}else{queues[_0x49ea3a['uniqueid']][_0xdcde('0x1a')]=_0xdcde('0x41')+_0x49ea3a['reason'][_0xdcde('0x25')]();}utils[_0xdcde('0x2')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x49ea3a['uniqueid'],queues[_0x49ea3a[_0xdcde('0xf')]][_0xdcde('0x1d')],_0x49ea3a[_0xdcde('0x3a')],queues[_0x49ea3a[_0xdcde('0xf')]][_0xdcde('0x1a')]));writeDB(queues[_0x49ea3a[_0xdcde('0xf')]]);}}}catch(_0x25fccb){utils[_0xdcde('0x1f')](util[_0xdcde('0x3')](_0xdcde('0x3e'),_0x49ea3a[_0xdcde('0xf')]),_0x25fccb);}};exports['blindtransfer']=function(_0x29340a){try{if(!_['isNil'](queues[_0x29340a[_0xdcde('0x42')]])){utils[_0xdcde('0x11')](util[_0xdcde('0x3')](_0xdcde('0x43'),_0x29340a[_0xdcde('0xf')]),_0x29340a);queues[_0x29340a['transfereeuniqueid']]['transfer']=!![];queues[_0x29340a[_0xdcde('0x42')]]['transfertype']=_0xdcde('0x44');queues[_0x29340a[_0xdcde('0x42')]][_0xdcde('0x45')]=_0x29340a[_0xdcde('0x46')];queues[_0x29340a[_0xdcde('0x42')]][_0xdcde('0x47')]=_0x29340a[_0xdcde('0x42')];queues[_0x29340a['transfereeuniqueid']]['queuecallerexitreason']=_0xdcde('0x48');utils[_0xdcde('0x2')](util['format'](_0xdcde('0x49'),_0x29340a[_0xdcde('0xf')],queues[_0x29340a[_0xdcde('0x42')]][_0xdcde('0x1d')],_0x29340a[_0xdcde('0x42')],_0x29340a[_0xdcde('0x46')]));}}catch(_0x381dae){utils['error'](util[_0xdcde('0x3')]('[%s][queues][blindtransfer]',_0x29340a[_0xdcde('0xf')]),_0x381dae);}};exports[_0xdcde('0x4a')]=function(_0x1a8e73){try{utils[_0xdcde('0x11')](util['format'](_0xdcde('0x4b'),_0x1a8e73[_0xdcde('0x4c')]),_0x1a8e73);if(_0x1a8e73[_0xdcde('0x4c')]==_0x1a8e73[_0xdcde('0x4d')]){if(!_[_0xdcde('0x14')](queues[_0x1a8e73[_0xdcde('0x4e')]])){utils['info'](util['format'](_0xdcde('0x4f'),_0x1a8e73[_0xdcde('0x4c')],queues[_0x1a8e73[_0xdcde('0x4e')]][_0xdcde('0x1d')],_0x1a8e73[_0xdcde('0x50')]));queues[_0x1a8e73['secondtransfererlinkedid']][_0xdcde('0x40')]=!![];queues[_0x1a8e73['secondtransfererlinkedid']][_0xdcde('0x51')]='ATTENDED';queues[_0x1a8e73[_0xdcde('0x4e')]][_0xdcde('0x45')]=_0x1a8e73[_0xdcde('0x50')];queues[_0x1a8e73[_0xdcde('0x4e')]][_0xdcde('0x47')]=_0x1a8e73[_0xdcde('0x4c')];queues[_0x1a8e73['secondtransfererlinkedid']][_0xdcde('0x1a')]=_0xdcde('0x52');}if(!_[_0xdcde('0x14')](queues[_0x1a8e73['origtransfererlinkedid']])){if(_0x1a8e73[_0xdcde('0x53')]&&queues[_0x1a8e73[_0xdcde('0x53')]]){queues[_0x1a8e73[_0xdcde('0x53')]]['queuecallerenterreason']=0x1;queues[_0x1a8e73[_0xdcde('0x42')]]=_[_0xdcde('0x54')](queues[_0x1a8e73['transfereelinkedid']]);queues[_0x1a8e73[_0xdcde('0x42')]][_0xdcde('0xe')]=_0x1a8e73[_0xdcde('0x55')];queues[_0x1a8e73[_0xdcde('0x42')]][_0xdcde('0x1e')]=0x2;queues[_0x1a8e73['transfereeuniqueid']][_0xdcde('0x7')]=queues[_0x1a8e73['secondtransfererlinkedid']][_0xdcde('0x7')];queues[_0x1a8e73[_0xdcde('0x42')]]['calleridname']=queues[_0x1a8e73['secondtransfererlinkedid']]['calleridname'];queues[_0x1a8e73[_0xdcde('0x42')]][_0xdcde('0x35')]=utils[_0xdcde('0x19')]();queues[_0x1a8e73[_0xdcde('0x42')]]['queuecallerleaveAt']=utils[_0xdcde('0x19')]();queues[_0x1a8e73[_0xdcde('0x42')]]['holdtime']=0x0;queues[_0x1a8e73['transfereeuniqueid']]['mohtime']=0x0;utils['info'](util[_0xdcde('0x3')](_0xdcde('0x56'),_0x1a8e73['origtransfereruniqueid'],queues[_0x1a8e73[_0xdcde('0x42')]][_0xdcde('0x1d')],queues[_0x1a8e73[_0xdcde('0x42')]]['calleridnum'],queues[_0x1a8e73[_0xdcde('0x42')]][_0xdcde('0x57')]));}else{utils[_0xdcde('0x2')](util[_0xdcde('0x3')](_0xdcde('0x58'),_0x1a8e73['origtransfereruniqueid'],queues[_0x1a8e73[_0xdcde('0x4d')]][_0xdcde('0x1d')],_0x1a8e73[_0xdcde('0x4e')]));queues[_0x1a8e73['origtransfererlinkedid']]['transfereduniqueid']=_0x1a8e73[_0xdcde('0x4e')];}}}else if(_0x1a8e73['secondtransfereruniqueid']==_0x1a8e73['secondtransfererlinkedid']){if(!_[_0xdcde('0x14')](queues[_0x1a8e73[_0xdcde('0x4d')]])){utils[_0xdcde('0x2')](util[_0xdcde('0x3')](_0xdcde('0x59'),_0x1a8e73['origtransfereruniqueid'],queues[_0x1a8e73['origtransfererlinkedid']]['name'],_0x1a8e73[_0xdcde('0x5a')],_0x1a8e73[_0xdcde('0x5b')]));queues[_0x1a8e73['origtransfererlinkedid']][_0xdcde('0x40')]=!![];queues[_0x1a8e73[_0xdcde('0x4d')]]['transfertype']='ATTENDED';queues[_0x1a8e73[_0xdcde('0x4d')]][_0xdcde('0x45')]=_0x1a8e73[_0xdcde('0x5b')];queues[_0x1a8e73['origtransfererlinkedid']][_0xdcde('0x47')]=_0x1a8e73[_0xdcde('0x5a')];queues[_0x1a8e73[_0xdcde('0x4d')]][_0xdcde('0x1a')]=_0xdcde('0x52');}if(!_['isNil'](queues[_0x1a8e73[_0xdcde('0x4e')]])){if(_0x1a8e73[_0xdcde('0x5c')]&&queues[_0x1a8e73[_0xdcde('0x5c')]]){queues[_0x1a8e73[_0xdcde('0x5c')]][_0xdcde('0x1e')]=0x1;queues[_0x1a8e73[_0xdcde('0x55')]]=_[_0xdcde('0x54')](queues[_0x1a8e73[_0xdcde('0x5c')]]);queues[_0x1a8e73[_0xdcde('0x55')]]['transfereduniqueid']=_0x1a8e73[_0xdcde('0x55')];queues[_0x1a8e73[_0xdcde('0x55')]][_0xdcde('0x1e')]=0x2;queues[_0x1a8e73['transfertargetuniqueid']][_0xdcde('0x7')]=queues[_0x1a8e73[_0xdcde('0x4d')]]['calleridnum'];queues[_0x1a8e73[_0xdcde('0x55')]][_0xdcde('0x57')]=queues[_0x1a8e73[_0xdcde('0x4d')]]['calleridname'];queues[_0x1a8e73[_0xdcde('0x55')]][_0xdcde('0x35')]=utils[_0xdcde('0x19')]();queues[_0x1a8e73[_0xdcde('0x55')]][_0xdcde('0x16')]=utils[_0xdcde('0x19')]();queues[_0x1a8e73[_0xdcde('0x55')]][_0xdcde('0x33')]=0x0;queues[_0x1a8e73[_0xdcde('0x55')]][_0xdcde('0x5d')]=0x0;utils[_0xdcde('0x2')](util['format'](_0xdcde('0x5e'),_0x1a8e73[_0xdcde('0x4c')],queues[_0x1a8e73[_0xdcde('0x55')]][_0xdcde('0x1d')],queues[_0x1a8e73[_0xdcde('0x55')]][_0xdcde('0xe')],queues[_0x1a8e73['transfertargetuniqueid']][_0xdcde('0x7')],queues[_0x1a8e73[_0xdcde('0x55')]]['calleridname']));}else{utils['info'](util['format'](_0xdcde('0x58'),_0x1a8e73[_0xdcde('0x4c')],queues[_0x1a8e73[_0xdcde('0x4e')]][_0xdcde('0x1d')],_0x1a8e73[_0xdcde('0x4d')]));queues[_0x1a8e73[_0xdcde('0x4e')]]['transfereduniqueid']=_0x1a8e73['origtransfererlinkedid'];}}}}catch(_0x5515d5){utils['error'](util[_0xdcde('0x3')](_0xdcde('0x4b'),_0x1a8e73['origtransfereruniqueid']),_0x5515d5);}};exports[_0xdcde('0x5f')]=function(_0xc955f8){try{if(!_[_0xdcde('0x14')](queues[_0xc955f8['uniqueid']])){utils[_0xdcde('0x11')](util[_0xdcde('0x3')](_0xdcde('0x60'),_0xc955f8['uniqueid']),_0xc955f8);queues[_0xc955f8['uniqueid']][_0xdcde('0x61')]=utils['now']();utils[_0xdcde('0x2')](util[_0xdcde('0x3')](_0xdcde('0x62'),_0xc955f8[_0xdcde('0xf')],queues[_0xc955f8[_0xdcde('0xf')]][_0xdcde('0x1d')],queues[_0xc955f8['uniqueid']]['musiconholdstartAt']));}}catch(_0x567b73){utils[_0xdcde('0x1f')](util[_0xdcde('0x3')]('[%s][queues][musiconholdstart]',_0xc955f8['uniqueid']),_0x567b73);}};exports[_0xdcde('0x63')]=function(_0x2ca568){try{if(!_[_0xdcde('0x14')](queues[_0x2ca568[_0xdcde('0xf')]])){if(!_[_0xdcde('0x14')](queues[_0x2ca568[_0xdcde('0xf')]][_0xdcde('0x61')])){utils[_0xdcde('0x11')](util[_0xdcde('0x3')](_0xdcde('0x64'),_0x2ca568[_0xdcde('0xf')]),_0x2ca568);queues[_0x2ca568[_0xdcde('0xf')]][_0xdcde('0x5d')]+=utils[_0xdcde('0x34')](utils['now'](),queues[_0x2ca568['uniqueid']][_0xdcde('0x61')]);utils[_0xdcde('0x2')](util[_0xdcde('0x3')](_0xdcde('0x65'),_0x2ca568[_0xdcde('0xf')],queues[_0x2ca568[_0xdcde('0xf')]][_0xdcde('0x1d')],queues[_0x2ca568[_0xdcde('0xf')]][_0xdcde('0x5d')]));delete queues[_0x2ca568[_0xdcde('0xf')]][_0xdcde('0x61')];}}}catch(_0x2e1041){utils[_0xdcde('0x1f')](util['format'](_0xdcde('0x64'),_0x2ca568['uniqueid']),_0x2e1041);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index d2a1ef2..bb86270 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 _0x6525=['.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','blinds','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','then','name','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','channelstate','transfer','linkedid','isNil','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith'];(function(_0x4ac58f,_0x4c2ec3){var _0x325c76=function(_0x852725){while(--_0x852725){_0x4ac58f['push'](_0x4ac58f['shift']());}};_0x325c76(++_0x4c2ec3);}(_0x6525,0x14b));var _0x5652=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x6525[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require(_0x5652('0x0'));var util=require(_0x5652('0x1'));var utils=require(_0x5652('0x2'));var transfers=require(_0x5652('0x3'));var recordings={};function writeDB(_0x40efa1){var _0x13cb4a;utils[_0x5652('0x4')](util[_0x5652('0x5')]('[%s][recordings][writeDB]',_0x40efa1['uniqueid']));if(transfers[_0x5652('0x6')][_0x40efa1[_0x5652('0x7')]]){_0x13cb4a=_0x40efa1['uniqueid'];_0x40efa1[_0x5652('0x7')]=transfers['blinds'][_0x40efa1[_0x5652('0x7')]][_0x5652('0x8')];}if(_0x40efa1[_0x5652('0x9')]){utils[_0x5652('0xa')](_0x40efa1[_0x5652('0x9')])[_0x5652('0xb')](function(_0x2a78d0){if(_0x2a78d0){_0x40efa1['membername']=_0x2a78d0[_0x5652('0xc')];_0x40efa1['UserId']=_0x2a78d0['id'];}utils[_0x5652('0xd')](_0x5652('0xe'),_0x40efa1);});}else{utils[_0x5652('0xd')](_0x5652('0xe'),_0x40efa1);}if(_0x13cb4a)delete transfers[_0x5652('0x6')][_0x13cb4a];}exports['newchannel']=function(_0x51e442){try{utils[_0x5652('0xf')](util['format'](_0x5652('0x10'),_0x51e442['uniqueid']),_0x51e442);if(_0x51e442[_0x5652('0x7')]==_0x51e442['linkedid']){utils[_0x5652('0x4')](util['format'](_0x5652('0x11'),_0x51e442['uniqueid'],_0x51e442[_0x5652('0x12')],_0x51e442[_0x5652('0x13')]));recordings[_0x51e442[_0x5652('0x7')]]={'uniqueid':_0x51e442[_0x5652('0x7')],'accountcode':_0x51e442[_0x5652('0x9')],'exten':_0x51e442[_0x5652('0x13')],'context':_0x51e442[_0x5652('0x12')],'channel':_0x51e442[_0x5652('0x14')],'monitors':[]};}}catch(_0x56745b){utils[_0x5652('0x15')](util[_0x5652('0x5')](_0x5652('0x10'),_0x51e442[_0x5652('0x7')]),_0x56745b);}};exports[_0x5652('0x16')]=function(_0x26c808){try{utils[_0x5652('0xf')](util['format'](_0x5652('0x17'),_0x26c808[_0x5652('0x7')]),_0x26c808);if(!_['isNil'](recordings[_0x26c808['uniqueid']])&&_0x26c808[_0x5652('0x18')]==0x6){utils['info'](util[_0x5652('0x5')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x26c808[_0x5652('0x7')],_0x26c808[_0x5652('0x12')],_0x26c808[_0x5652('0x14')]));}else if(!_['isNil'](recordings[_0x26c808['linkedid']])&&_0x26c808[_0x5652('0x18')]==0x6&&_0x26c808['context']!=_0x5652('0x19')){utils['info'](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x26c808['uniqueid'],_0x26c808[_0x5652('0x1a')],_0x26c808[_0x5652('0x12')],_0x26c808['channel']));recordings[_0x26c808[_0x5652('0x1a')]][_0x5652('0x9')]=_0x26c808[_0x5652('0x9')];}}catch(_0x22ebb5){utils[_0x5652('0x15')](util[_0x5652('0x5')]('[%s][recordings][newstate]',_0x26c808[_0x5652('0x7')]),_0x22ebb5);}};exports['varset']=function(_0x35d877){try{if(!_[_0x5652('0x1b')](_0x35d877['variable'])&&!_[_0x5652('0x1b')](_0x35d877[_0x5652('0x1c')][_0x5652('0x1d')])){utils[_0x5652('0xf')](util['format'](_0x5652('0x1e'),_0x35d877[_0x5652('0x7')]),_0x35d877);utils[_0x5652('0x4')](util[_0x5652('0x5')](_0x5652('0x1f'),_0x35d877[_0x5652('0x7')],_0x35d877[_0x5652('0x1c')],_0x35d877[_0x5652('0x20')]));if(_[_0x5652('0x21')](_0x35d877['value'],_0x5652('0x22'))){_0x35d877[_0x5652('0x20')]=_0x35d877[_0x5652('0x20')][_0x5652('0x23')](_0x5652('0x22'),_0x5652('0x24'));}if(recordings[_0x35d877[_0x5652('0x1a')]]){var _0x192ceb=_[_0x5652('0x25')](recordings[_0x35d877[_0x5652('0x1a')]][_0x5652('0x26')],{'value':_0x35d877[_0x5652('0x20')]});if(_['isNil'](_0x192ceb)){recordings[_0x35d877[_0x5652('0x1a')]][_0x5652('0x26')][_0x5652('0x27')]({'value':_0x35d877[_0x5652('0x20')]});}}}}catch(_0xb3fa07){utils[_0x5652('0x15')](util[_0x5652('0x5')]('[%s][recordings][varset]',_0x35d877[_0x5652('0x7')]),_0xb3fa07);}};exports[_0x5652('0x28')]=function(_0x441687){try{if(!_['isNil'](recordings[_0x441687['uniqueid']])){utils[_0x5652('0xf')](util['format']('[%s][recordings][hangup]',_0x441687[_0x5652('0x7')]),_0x441687);utils[_0x5652('0x4')](util['format'](_0x5652('0x29'),_0x441687['uniqueid'],_0x441687['calleridnum'],_0x441687['calleridname'],_0x441687[_0x5652('0x2a')]));recordings[_0x441687[_0x5652('0x7')]]['calleridnum']=_0x441687[_0x5652('0x2b')];recordings[_0x441687[_0x5652('0x7')]][_0x5652('0x2c')]=_0x441687[_0x5652('0x2c')];recordings[_0x441687[_0x5652('0x7')]]['connectedlinenum']=_0x441687[_0x5652('0x2d')];recordings[_0x441687[_0x5652('0x7')]][_0x5652('0x2e')]=_0x441687['connectedlinename'];if(recordings[_0x441687[_0x5652('0x7')]][_0x5652('0x2f')]=='outbound'&&recordings[_0x441687[_0x5652('0x7')]]['accountcode']){recordings[_0x441687['uniqueid']][_0x5652('0x2d')]=recordings[_0x441687[_0x5652('0x7')]][_0x5652('0x9')];recordings[_0x441687[_0x5652('0x7')]]['connectedlinename']='';}recordings[_0x441687[_0x5652('0x7')]][_0x5652('0x26')][_0x5652('0x30')](function(_0x56c8c6){var _0x224b90=_[_0x5652('0x31')](recordings[_0x441687[_0x5652('0x7')]]);_0x224b90[_0x5652('0x20')]=_0x56c8c6[_0x5652('0x20')];writeDB(_0x224b90);});delete recordings[_0x441687[_0x5652('0x7')]];}}catch(_0x3afd81){utils[_0x5652('0x15')](util[_0x5652('0x5')](_0x5652('0x32'),_0x441687['uniqueid']),_0x3afd81);}};exports['newexten']=function(_0x1b6d4e){try{if(!_[_0x5652('0x1b')](recordings[_0x1b6d4e['uniqueid']])){utils[_0x5652('0xf')](util['format'](_0x5652('0x33'),_0x1b6d4e['uniqueid']),_0x1b6d4e);utils[_0x5652('0x4')](util[_0x5652('0x5')](_0x5652('0x34'),_0x1b6d4e[_0x5652('0x7')],_0x1b6d4e[_0x5652('0x35')],_0x1b6d4e[_0x5652('0x36')]));if(_0x1b6d4e['application']['toLowerCase']()==_0x5652('0x37')&&_[_0x5652('0x38')](_0x1b6d4e['appdata'][_0x5652('0x39')](),_0x5652('0x3a'))){var _0x513287=_0x1b6d4e['appdata'][_0x5652('0x3b')]('=');var _0x30c5b7=_0x513287[0x0]['substring'](_0x513287[0x0][_0x5652('0x3c')]('(')+0x1,_0x513287[0x0][_0x5652('0x3c')](')'));var _0x2bf0c6=_0x513287[0x1];recordings[_0x1b6d4e[_0x5652('0x7')]][_0x30c5b7]=_0x2bf0c6;}}}catch(_0x584789){utils['error'](util[_0x5652('0x5')](_0x5652('0x33'),_0x1b6d4e[_0x5652('0x7')]),_0x584789);}};exports[_0x5652('0x3d')]=function(_0x4a5a02){try{if(!_[_0x5652('0x1b')](recordings[_0x4a5a02[_0x5652('0x7')]])){utils[_0x5652('0xf')](util[_0x5652('0x5')](_0x5652('0x3e'),_0x4a5a02['uniqueid']),_0x4a5a02);utils['info'](util['format'](_0x5652('0x3f'),_0x4a5a02[_0x5652('0x7')],_0x4a5a02[_0x5652('0x40')]));recordings[_0x4a5a02['uniqueid']][_0x5652('0x40')]=_0x4a5a02[_0x5652('0x40')];}}catch(_0x15f388){utils['error'](util[_0x5652('0x5')](_0x5652('0x3e'),_0x4a5a02[_0x5652('0x7')]),_0x15f388);}};exports[_0x5652('0x41')]=function(_0x132bf9){try{utils[_0x5652('0xf')](util[_0x5652('0x5')](_0x5652('0x42'),_0x132bf9[_0x5652('0x7')]),_0x132bf9);utils[_0x5652('0x4')](util[_0x5652('0x5')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x132bf9[_0x5652('0x7')],_0x132bf9[_0x5652('0x43')],_0x132bf9[_0x5652('0x44')],_0x132bf9[_0x5652('0x45')],_0x132bf9[_0x5652('0x46')]));if(recordings[_0x132bf9[_0x5652('0x47')]]&&transfers['blinds'][_0x132bf9[_0x5652('0x47')]]){transfers['blinds'][_0x132bf9[_0x5652('0x47')]][_0x5652('0x48')]=!![];}}catch(_0xb13101){utils['error'](util[_0x5652('0x5')](_0x5652('0x42'),_0x132bf9[_0x5652('0x7')]),_0xb13101);}}; \ No newline at end of file +var _0xee9c=['[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','util','./utils','./transfers.controller','format','[%s][recordings][writeDB]','uniqueid','blinds','getUserByInternal','accountcode','membername','name','UserId','request','CreateVoiceRecording','debug','linkedid','info','context','exten','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','forEach','clone','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]'];(function(_0x1a889d,_0x33def6){var _0x49fd37=function(_0x126aea){while(--_0x126aea){_0x1a889d['push'](_0x1a889d['shift']());}};_0x49fd37(++_0x33def6);}(_0xee9c,0x1e6));var _0xcee9=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0xee9c[_0x23be51];return _0x47a26d;};'use strict';var _=require('lodash');var util=require(_0xcee9('0x0'));var utils=require(_0xcee9('0x1'));var transfers=require(_0xcee9('0x2'));var recordings={};function writeDB(_0x29b467){var _0x58c6fd;utils['info'](util[_0xcee9('0x3')](_0xcee9('0x4'),_0x29b467['uniqueid']));if(transfers['blinds'][_0x29b467[_0xcee9('0x5')]]){_0x58c6fd=_0x29b467['uniqueid'];_0x29b467[_0xcee9('0x5')]=transfers[_0xcee9('0x6')][_0x29b467[_0xcee9('0x5')]]['transfereeuniqueid'];}if(_0x29b467['accountcode']){utils[_0xcee9('0x7')](_0x29b467[_0xcee9('0x8')])['then'](function(_0x7c80be){if(_0x7c80be){_0x29b467[_0xcee9('0x9')]=_0x7c80be[_0xcee9('0xa')];_0x29b467[_0xcee9('0xb')]=_0x7c80be['id'];}utils[_0xcee9('0xc')](_0xcee9('0xd'),_0x29b467);});}else{utils['request'](_0xcee9('0xd'),_0x29b467);}if(_0x58c6fd)delete transfers[_0xcee9('0x6')][_0x58c6fd];}exports['newchannel']=function(_0x279200){try{utils[_0xcee9('0xe')](util[_0xcee9('0x3')]('[%s][recordings][newchannel]',_0x279200[_0xcee9('0x5')]),_0x279200);if(_0x279200[_0xcee9('0x5')]==_0x279200[_0xcee9('0xf')]){utils[_0xcee9('0x10')](util[_0xcee9('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x279200['uniqueid'],_0x279200[_0xcee9('0x11')],_0x279200[_0xcee9('0x12')]));recordings[_0x279200[_0xcee9('0x5')]]={'uniqueid':_0x279200[_0xcee9('0x5')],'accountcode':_0x279200[_0xcee9('0x8')],'exten':_0x279200[_0xcee9('0x12')],'context':_0x279200[_0xcee9('0x11')],'channel':_0x279200[_0xcee9('0x13')],'monitors':[]};}}catch(_0x1adcc9){utils[_0xcee9('0x14')](util[_0xcee9('0x3')](_0xcee9('0x15'),_0x279200['uniqueid']),_0x1adcc9);}};exports[_0xcee9('0x16')]=function(_0x414032){try{utils[_0xcee9('0xe')](util[_0xcee9('0x3')](_0xcee9('0x17'),_0x414032['uniqueid']),_0x414032);if(!_[_0xcee9('0x18')](recordings[_0x414032[_0xcee9('0x5')]])&&_0x414032[_0xcee9('0x19')]==0x6){utils[_0xcee9('0x10')](util['format'](_0xcee9('0x1a'),_0x414032[_0xcee9('0x5')],_0x414032['context'],_0x414032['channel']));}else if(!_[_0xcee9('0x18')](recordings[_0x414032[_0xcee9('0xf')]])&&_0x414032[_0xcee9('0x19')]==0x6&&_0x414032['context']!=_0xcee9('0x1b')){utils[_0xcee9('0x10')](util[_0xcee9('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x414032[_0xcee9('0x5')],_0x414032['linkedid'],_0x414032[_0xcee9('0x11')],_0x414032[_0xcee9('0x13')]));recordings[_0x414032[_0xcee9('0xf')]][_0xcee9('0x8')]=_0x414032[_0xcee9('0x8')];}}catch(_0x3ce813){utils[_0xcee9('0x14')](util[_0xcee9('0x3')](_0xcee9('0x17'),_0x414032[_0xcee9('0x5')]),_0x3ce813);}};exports['varset']=function(_0x484f36){try{if(!_[_0xcee9('0x18')](_0x484f36['variable'])&&!_[_0xcee9('0x18')](_0x484f36[_0xcee9('0x1c')][_0xcee9('0x1d')])){utils[_0xcee9('0xe')](util['format'](_0xcee9('0x1e'),_0x484f36[_0xcee9('0x5')]),_0x484f36);utils[_0xcee9('0x10')](util['format'](_0xcee9('0x1f'),_0x484f36[_0xcee9('0x5')],_0x484f36[_0xcee9('0x1c')],_0x484f36['value']));if(_[_0xcee9('0x20')](_0x484f36[_0xcee9('0x21')],_0xcee9('0x22'))){_0x484f36[_0xcee9('0x21')]=_0x484f36['value'][_0xcee9('0x23')](_0xcee9('0x22'),'.WAV');}if(recordings[_0x484f36[_0xcee9('0xf')]]){var _0x326cf1=_[_0xcee9('0x24')](recordings[_0x484f36[_0xcee9('0xf')]]['monitors'],{'value':_0x484f36['value']});if(_[_0xcee9('0x18')](_0x326cf1)){recordings[_0x484f36[_0xcee9('0xf')]][_0xcee9('0x25')][_0xcee9('0x26')]({'value':_0x484f36[_0xcee9('0x21')]});}}}}catch(_0x2daa14){utils[_0xcee9('0x14')](util['format'](_0xcee9('0x1e'),_0x484f36[_0xcee9('0x5')]),_0x2daa14);}};exports[_0xcee9('0x27')]=function(_0x4b7726){try{if(!_[_0xcee9('0x18')](recordings[_0x4b7726[_0xcee9('0x5')]])){utils[_0xcee9('0xe')](util[_0xcee9('0x3')](_0xcee9('0x28'),_0x4b7726['uniqueid']),_0x4b7726);utils['info'](util[_0xcee9('0x3')](_0xcee9('0x29'),_0x4b7726[_0xcee9('0x5')],_0x4b7726['calleridnum'],_0x4b7726[_0xcee9('0x2a')],_0x4b7726[_0xcee9('0x2b')]));recordings[_0x4b7726[_0xcee9('0x5')]][_0xcee9('0x2c')]=_0x4b7726[_0xcee9('0x2c')];recordings[_0x4b7726[_0xcee9('0x5')]]['calleridname']=_0x4b7726[_0xcee9('0x2a')];recordings[_0x4b7726[_0xcee9('0x5')]][_0xcee9('0x2d')]=_0x4b7726[_0xcee9('0x2d')];recordings[_0x4b7726['uniqueid']]['connectedlinename']=_0x4b7726[_0xcee9('0x2e')];if(recordings[_0x4b7726[_0xcee9('0x5')]]['type']=='outbound'&&recordings[_0x4b7726[_0xcee9('0x5')]][_0xcee9('0x8')]){recordings[_0x4b7726['uniqueid']][_0xcee9('0x2d')]=recordings[_0x4b7726[_0xcee9('0x5')]][_0xcee9('0x8')];recordings[_0x4b7726['uniqueid']]['connectedlinename']='';}recordings[_0x4b7726[_0xcee9('0x5')]][_0xcee9('0x25')][_0xcee9('0x2f')](function(_0xe0ba07){var _0x45ac81=_[_0xcee9('0x30')](recordings[_0x4b7726[_0xcee9('0x5')]]);_0x45ac81[_0xcee9('0x21')]=_0xe0ba07[_0xcee9('0x21')];writeDB(_0x45ac81);});delete recordings[_0x4b7726[_0xcee9('0x5')]];}}catch(_0x8cc88d){utils['error'](util['format'](_0xcee9('0x28'),_0x4b7726[_0xcee9('0x5')]),_0x8cc88d);}};exports['newexten']=function(_0x33c17b){try{if(!_[_0xcee9('0x18')](recordings[_0x33c17b[_0xcee9('0x5')]])){utils['debug'](util[_0xcee9('0x3')]('[%s][recordings][newexten]',_0x33c17b[_0xcee9('0x5')]),_0x33c17b);utils[_0xcee9('0x10')](util[_0xcee9('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x33c17b[_0xcee9('0x5')],_0x33c17b[_0xcee9('0x31')],_0x33c17b[_0xcee9('0x32')]));if(_0x33c17b['application'][_0xcee9('0x33')]()=='set'&&_[_0xcee9('0x34')](_0x33c17b[_0xcee9('0x32')][_0xcee9('0x33')](),_0xcee9('0x35'))){var _0x38d082=_0x33c17b[_0xcee9('0x32')][_0xcee9('0x36')]('=');var _0xa1d58f=_0x38d082[0x0][_0xcee9('0x37')](_0x38d082[0x0][_0xcee9('0x38')]('(')+0x1,_0x38d082[0x0][_0xcee9('0x38')](')'));var _0x2831a6=_0x38d082[0x1];recordings[_0x33c17b['uniqueid']][_0xa1d58f]=_0x2831a6;}}}catch(_0x4c7070){utils[_0xcee9('0x14')](util[_0xcee9('0x3')](_0xcee9('0x39'),_0x33c17b['uniqueid']),_0x4c7070);}};exports['queuecallerjoin']=function(_0x515c6d){try{if(!_[_0xcee9('0x18')](recordings[_0x515c6d[_0xcee9('0x5')]])){utils[_0xcee9('0xe')](util[_0xcee9('0x3')]('[%s][recordings][queuecallerjoin]',_0x515c6d[_0xcee9('0x5')]),_0x515c6d);utils['info'](util[_0xcee9('0x3')](_0xcee9('0x3a'),_0x515c6d[_0xcee9('0x5')],_0x515c6d[_0xcee9('0x3b')]));recordings[_0x515c6d['uniqueid']]['queue']=_0x515c6d['queue'];}}catch(_0x5d61c5){utils['error'](util['format'](_0xcee9('0x3c'),_0x515c6d[_0xcee9('0x5')]),_0x5d61c5);}};exports['blindtransfer']=function(_0x2db398){try{utils[_0xcee9('0xe')](util[_0xcee9('0x3')]('[%s][recordings][blindtransfer]',_0x2db398[_0xcee9('0x5')]),_0x2db398);utils['info'](util[_0xcee9('0x3')](_0xcee9('0x3d'),_0x2db398[_0xcee9('0x5')],_0x2db398[_0xcee9('0x3e')],_0x2db398[_0xcee9('0x3f')],_0x2db398['transfereecalleridnum'],_0x2db398[_0xcee9('0x40')]));if(recordings[_0x2db398[_0xcee9('0x41')]]&&transfers[_0xcee9('0x6')][_0x2db398['transfereruniqueid']]){transfers['blinds'][_0x2db398[_0xcee9('0x41')]][_0xcee9('0x42')]=!![];}}catch(_0x24fa8e){utils[_0xcee9('0x14')](util[_0xcee9('0x3')](_0xcee9('0x43'),_0x2db398[_0xcee9('0x5')]),_0x24fa8e);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 4e93954..a0a3452 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 _0xa7f5=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','attended','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','./utils','format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blinds','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum'];(function(_0x2d9b4d,_0x3101b9){var _0x4a3e64=function(_0x1deba9){while(--_0x1deba9){_0x2d9b4d['push'](_0x2d9b4d['shift']());}};_0x4a3e64(++_0x3101b9);}(_0xa7f5,0x146));var _0x5a7f=function(_0x4e936b,_0x193d71){_0x4e936b=_0x4e936b-0x0;var _0xda6dd6=_0xa7f5[_0x4e936b];return _0xda6dd6;};'use strict';var _=require(_0x5a7f('0x0'));var util=require('util');var utils=require(_0x5a7f('0x1'));function writeDB(_0xf967ba){utils['info'](util[_0x5a7f('0x2')](_0x5a7f('0x3'),_0xf967ba['type']==='attended'?_0xf967ba[_0x5a7f('0x4')]:_0xf967ba[_0x5a7f('0x5')],_0xf967ba[_0x5a7f('0x6')]));utils[_0x5a7f('0x7')](_0x5a7f('0x8'),_0xf967ba);}exports[_0x5a7f('0x9')]={};exports['blindtransfer']=function(_0x55ee90){try{utils[_0x5a7f('0xa')](util[_0x5a7f('0x2')](_0x5a7f('0xb'),_0x55ee90[_0x5a7f('0x5')]),_0x55ee90);utils[_0x5a7f('0xc')](util[_0x5a7f('0x2')](_0x5a7f('0xd'),_0x55ee90['uniqueid'],_0x55ee90['transferercalleridnum'],_0x55ee90[_0x5a7f('0xe')],_0x55ee90[_0x5a7f('0xf')],_0x55ee90['transfereecalleridname']));_0x55ee90[_0x5a7f('0x6')]='blind';exports['blinds'][_0x55ee90[_0x5a7f('0x10')]]=_0x55ee90;writeDB(_0x55ee90);}catch(_0x208a55){utils[_0x5a7f('0x11')](util['format']('[%s][transfers][blindtransfer]',_0x55ee90[_0x5a7f('0x5')]),_0x208a55);}};exports[_0x5a7f('0x12')]=function(_0x1d9dc5){try{utils['debug'](util[_0x5a7f('0x2')](_0x5a7f('0x13'),_0x1d9dc5['origtransfereruniqueid']),_0x1d9dc5);utils[_0x5a7f('0xc')](util[_0x5a7f('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1d9dc5[_0x5a7f('0x4')],_0x1d9dc5[_0x5a7f('0x14')],_0x1d9dc5['origtransferercalleridname'],_0x1d9dc5[_0x5a7f('0x15')],_0x1d9dc5['transfertargetcalleridname']));_0x1d9dc5=_[_0x5a7f('0x16')](_0x1d9dc5,{'transfererchannel':_0x1d9dc5[_0x5a7f('0x17')],'transferercalleridnum':_0x1d9dc5[_0x5a7f('0x14')],'transferercalleridname':_0x1d9dc5['origtransferercalleridname'],'transfererconnectedlinenum':_0x1d9dc5[_0x5a7f('0x18')],'transfererconnectedlinename':_0x1d9dc5[_0x5a7f('0x19')],'transfereraccountcode':_0x1d9dc5[_0x5a7f('0x1a')],'transferercontext':_0x1d9dc5[_0x5a7f('0x1b')],'transfererexten':_0x1d9dc5[_0x5a7f('0x1c')],'transfererlinkedid':_0x1d9dc5['origtransfererlinkedid'],'context':_0x1d9dc5[_0x5a7f('0x1d')],'extension':_0x1d9dc5[_0x5a7f('0x1e')],'type':_0x5a7f('0x1f')});if(_['isNil'](_0x1d9dc5[_0x5a7f('0x20')])){_0x1d9dc5=_[_0x5a7f('0x16')](_0x1d9dc5,{'transfereechannel':_0x1d9dc5[_0x5a7f('0x21')],'transfereecalleridnum':_0x1d9dc5[_0x5a7f('0x15')],'transfereecalleridname':_0x1d9dc5[_0x5a7f('0x22')],'transfereeconnectedlinenum':_0x1d9dc5[_0x5a7f('0x23')],'transfereeconnectedlinename':_0x1d9dc5['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1d9dc5[_0x5a7f('0x24')],'transfereecontext':_0x1d9dc5['transfertargetcontext'],'transfereeexten':_0x1d9dc5[_0x5a7f('0x25')],'transfereelinkedid':_0x1d9dc5[_0x5a7f('0x26')]});}writeDB(_0x1d9dc5);}catch(_0x2e4c75){utils['error'](util[_0x5a7f('0x2')](_0x5a7f('0x13'),_0x1d9dc5[_0x5a7f('0x4')]),_0x2e4c75);}}; \ No newline at end of file +var _0x1e36=['attended','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','blind','blinds','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s'];(function(_0x1d1219,_0x23fc71){var _0x5b5b89=function(_0x3d85e5){while(--_0x3d85e5){_0x1d1219['push'](_0x1d1219['shift']());}};_0x5b5b89(++_0x23fc71);}(_0x1e36,0xdb));var _0x61e3=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x1e36[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x61e3('0x0'));var util=require(_0x61e3('0x1'));var utils=require(_0x61e3('0x2'));function writeDB(_0x2b6c29){utils[_0x61e3('0x3')](util[_0x61e3('0x4')](_0x61e3('0x5'),_0x2b6c29['type']===_0x61e3('0x6')?_0x2b6c29[_0x61e3('0x7')]:_0x2b6c29[_0x61e3('0x8')],_0x2b6c29[_0x61e3('0x9')]));utils[_0x61e3('0xa')](_0x61e3('0xb'),_0x2b6c29);}exports['blinds']={};exports[_0x61e3('0xc')]=function(_0x41e795){try{utils[_0x61e3('0xd')](util[_0x61e3('0x4')](_0x61e3('0xe'),_0x41e795[_0x61e3('0x8')]),_0x41e795);utils['info'](util[_0x61e3('0x4')](_0x61e3('0xf'),_0x41e795[_0x61e3('0x8')],_0x41e795['transferercalleridnum'],_0x41e795[_0x61e3('0x10')],_0x41e795[_0x61e3('0x11')],_0x41e795['transfereecalleridname']));_0x41e795[_0x61e3('0x9')]=_0x61e3('0x12');exports[_0x61e3('0x13')][_0x41e795[_0x61e3('0x14')]]=_0x41e795;writeDB(_0x41e795);}catch(_0x33b7d7){utils[_0x61e3('0x15')](util[_0x61e3('0x4')](_0x61e3('0xe'),_0x41e795[_0x61e3('0x8')]),_0x33b7d7);}};exports[_0x61e3('0x16')]=function(_0xd6d18){try{utils[_0x61e3('0xd')](util[_0x61e3('0x4')](_0x61e3('0x17'),_0xd6d18[_0x61e3('0x7')]),_0xd6d18);utils[_0x61e3('0x3')](util['format'](_0x61e3('0x18'),_0xd6d18[_0x61e3('0x7')],_0xd6d18[_0x61e3('0x19')],_0xd6d18['origtransferercalleridname'],_0xd6d18[_0x61e3('0x1a')],_0xd6d18[_0x61e3('0x1b')]));_0xd6d18=_[_0x61e3('0x1c')](_0xd6d18,{'transfererchannel':_0xd6d18[_0x61e3('0x1d')],'transferercalleridnum':_0xd6d18[_0x61e3('0x19')],'transferercalleridname':_0xd6d18[_0x61e3('0x1e')],'transfererconnectedlinenum':_0xd6d18[_0x61e3('0x1f')],'transfererconnectedlinename':_0xd6d18[_0x61e3('0x20')],'transfereraccountcode':_0xd6d18[_0x61e3('0x21')],'transferercontext':_0xd6d18['secondtransferercontext'],'transfererexten':_0xd6d18['secondtransfererexten'],'transfererlinkedid':_0xd6d18[_0x61e3('0x22')],'context':_0xd6d18[_0x61e3('0x23')],'extension':_0xd6d18[_0x61e3('0x24')],'type':_0x61e3('0x6')});if(_['isNil'](_0xd6d18[_0x61e3('0x25')])){_0xd6d18=_['assign'](_0xd6d18,{'transfereechannel':_0xd6d18[_0x61e3('0x26')],'transfereecalleridnum':_0xd6d18[_0x61e3('0x1a')],'transfereecalleridname':_0xd6d18[_0x61e3('0x1b')],'transfereeconnectedlinenum':_0xd6d18[_0x61e3('0x27')],'transfereeconnectedlinename':_0xd6d18[_0x61e3('0x28')],'transfereeaccountcode':_0xd6d18[_0x61e3('0x29')],'transfereecontext':_0xd6d18[_0x61e3('0x2a')],'transfereeexten':_0xd6d18[_0x61e3('0x2b')],'transfereelinkedid':_0xd6d18[_0x61e3('0x2c')]});}writeDB(_0xd6d18);}catch(_0x14661f){utils['error'](util[_0x61e3('0x4')](_0x61e3('0x17'),_0xd6d18[_0x61e3('0x7')]),_0x14661f);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index f3cc62f..c8dc81a 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 _0xb258=['catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','then','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','client','http','../../config/logger','info','inspect','debug','error','request','[utils][request]\x20name:%s'];(function(_0x30e899,_0x127f10){var _0x462e0f=function(_0x5da9dc){while(--_0x5da9dc){_0x30e899['push'](_0x30e899['shift']());}};_0x462e0f(++_0x127f10);}(_0xb258,0x19c));var _0x8b25=function(_0x228ad1,_0x41324f){_0x228ad1=_0x228ad1-0x0;var _0x39b7d8=_0xb258[_0x228ad1];return _0x39b7d8;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x8b25('0x0'));var moment=require(_0x8b25('0x1'));var util=require('util');var client=jayson[_0x8b25('0x2')][_0x8b25('0x3')]({'port':0x2329});var logger=require(_0x8b25('0x4'))('xdr');exports[_0x8b25('0x5')]=function(_0x15393d,_0x43e7eb){logger[_0x8b25('0x5')](_0x15393d,_0x43e7eb?util[_0x8b25('0x6')](_0x43e7eb,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x789e30,_0x5dda4f){logger[_0x8b25('0x7')](_0x789e30,_0x5dda4f?util[_0x8b25('0x6')](_0x5dda4f,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x1075d8,_0x4604a5){logger[_0x8b25('0x8')](_0x1075d8,_0x4604a5?util['inspect'](_0x4604a5,{'showHidden':![],'depth':null}):'');};exports[_0x8b25('0x9')]=function(_0x4e5404,_0x110f94){return client[_0x8b25('0x9')](_0x4e5404,{'body':_0x110f94})['then'](function(_0x335be7){logger[_0x8b25('0x7')](_0x8b25('0xa'),_0x4e5404,_0x335be7?util[_0x8b25('0x6')](_0x335be7,{'showHidden':![],'depth':null}):'');})[_0x8b25('0xb')](function(_0x3ea6ca){logger[_0x8b25('0x8')]('[utils][request]\x20name:%s',_0x4e5404,_0x3ea6ca?util['inspect'](_0x3ea6ca,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4718de){return client['request'](_0x8b25('0xc'),{'options':{'raw':!![],'attributes':['id',_0x8b25('0xd'),_0x8b25('0xe'),_0x8b25('0xf')],'where':_0x4718de,'limit':0x1}})['then'](function(_0x4d08ce){logger[_0x8b25('0x7')](_0x8b25('0x10'),JSON[_0x8b25('0x11')](_0x4718de),_0x4d08ce?util[_0x8b25('0x6')](_0x4d08ce,{'showHidden':![],'depth':null}):'');return _0x4d08ce[_0x8b25('0x12')][_0x8b25('0x13')]?_0x4d08ce[_0x8b25('0x12')][0x0]:null;});}exports[_0x8b25('0x14')]=function(_0x32de19){return new BPromise(function(_0x39f814,_0x1ff8a8){if(_0x32de19){return getUser({'internal':_0x32de19})[_0x8b25('0x15')](function(_0xe4765a){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x32de19,_0xe4765a?_0x8b25('0x16'):_0x8b25('0x17'));return _0x39f814(_0xe4765a);})[_0x8b25('0xb')](function(_0x3f79f2){logger[_0x8b25('0x8')]('[utils][getUserByInternal]',_0x3f79f2?util['inspect'](_0x3f79f2,{'showHidden':![],'depth':null}):'');return _0x39f814(null);});}return _0x39f814(null);});};exports[_0x8b25('0x18')]=function(_0x134e72){return new BPromise(function(_0x297e3e,_0x51b074){if(_0x134e72){return getUser({'interface':_0x134e72})[_0x8b25('0x15')](function(_0x49de9d){logger[_0x8b25('0x5')](_0x8b25('0x19'),_0x134e72,_0x49de9d?'found':_0x8b25('0x17'));return _0x297e3e(_0x49de9d);})['catch'](function(_0x9aea30){logger[_0x8b25('0x8')](_0x8b25('0x1a'),_0x9aea30?util[_0x8b25('0x6')](_0x9aea30,{'showHidden':![],'depth':null}):'');return _0x297e3e(null);});}return _0x297e3e(null);});};exports[_0x8b25('0x1b')]=function(_0x14bc16){return new BPromise(function(_0x47dd67,_0x59dc2e){if(_0x14bc16){return getUser({'name':_0x14bc16})['then'](function(_0x491f27){logger[_0x8b25('0x5')](_0x8b25('0x1c'),_0x14bc16,_0x491f27?_0x8b25('0x16'):_0x8b25('0x17'));return _0x47dd67(_0x491f27);})['catch'](function(_0x427561){logger[_0x8b25('0x8')](_0x8b25('0x1d'),_0x427561?util[_0x8b25('0x6')](_0x427561,{'showHidden':![],'depth':null}):'');return _0x47dd67(null);});}return _0x47dd67(null);});};exports[_0x8b25('0x1e')]=function(_0x40abaa){return new BPromise(function(_0x3bce75,_0x1e4e15){if(_0x40abaa){return client[_0x8b25('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x8b25('0xe'),_0x8b25('0x1f'),_0x8b25('0x20'),'acwTimeout'],'where':{'name':_0x40abaa},'limit':0x1}})[_0x8b25('0x15')](function(_0x1506c6){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x40abaa,_0x1506c6?util['inspect'](_0x1506c6,{'showHidden':![],'depth':null}):'');logger[_0x8b25('0x5')](_0x8b25('0x21'),_0x40abaa,_0x1506c6?_0x8b25('0x16'):'notfound');return _0x3bce75(_0x1506c6[_0x8b25('0x12')][_0x8b25('0x13')]?_0x1506c6['result'][0x0]:null);})[_0x8b25('0xb')](function(_0x4801b){logger[_0x8b25('0x8')](_0x8b25('0x22'),_0x4801b?util[_0x8b25('0x6')](_0x4801b,{'showHidden':![],'depth':null}):'');return _0x3bce75(null);});}return _0x3bce75(null);});};exports[_0x8b25('0x23')]=function(_0x397c3e,_0x3e1171){return moment(_0x397c3e)[_0x8b25('0x24')](_0x3e1171,_0x8b25('0x25'))[_0x8b25('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x8b25('0x27')]=function(_0x2c621b,_0x2eef89){return moment(_0x2c621b)[_0x8b25('0x28')](_0x2eef89,'seconds')['format'](_0x8b25('0x29'));};exports['diffTime']=function(_0x5dedbc,_0xf686d3){return moment(_0x5dedbc)[_0x8b25('0x2a')](moment(_0xf686d3),_0x8b25('0x25'));};exports[_0x8b25('0x2b')]=function(_0x1e3af2,_0x498ea1){return parseInt(_0x1e3af2,0xa)+parseInt(_0x498ea1,0xa);};exports[_0x8b25('0x2c')]=function(){return moment()[_0x8b25('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x8b25('0x2d')]=function(_0x32e182,_0x5821e3){if(_0x5821e3){return moment(_0x32e182)[_0x8b25('0x2d')](_0x5821e3);}return!![];};exports[_0x8b25('0x2e')]=function(_0x5366b1,_0x2056c7){if(_0x2056c7){return moment(_0x5366b1)['isBefore'](_0x2056c7);}else if(_0x5366b1){return!![];}return![];}; \ No newline at end of file +var _0xbb57=['isAfter','isBefore','bluebird','moment','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','sumTime','now'];(function(_0x507bce,_0x70b497){var _0x391bee=function(_0x2eda3d){while(--_0x2eda3d){_0x507bce['push'](_0x507bce['shift']());}};_0x391bee(++_0x70b497);}(_0xbb57,0x136));var _0x7bb5=function(_0x31ee12,_0x25f4f8){_0x31ee12=_0x31ee12-0x0;var _0x5b4d30=_0xbb57[_0x31ee12];return _0x5b4d30;};'use strict';var BPromise=require(_0x7bb5('0x0'));var jayson=require('jayson/promise');var moment=require(_0x7bb5('0x1'));var util=require('util');var client=jayson['client']['http']({'port':0x2329});var logger=require(_0x7bb5('0x2'))(_0x7bb5('0x3'));exports[_0x7bb5('0x4')]=function(_0x4f2b8f,_0x28ff86){logger[_0x7bb5('0x4')](_0x4f2b8f,_0x28ff86?util[_0x7bb5('0x5')](_0x28ff86,{'showHidden':![],'depth':null}):'');};exports[_0x7bb5('0x6')]=function(_0x59625d,_0x5191bc){logger['debug'](_0x59625d,_0x5191bc?util['inspect'](_0x5191bc,{'showHidden':![],'depth':null}):'');};exports[_0x7bb5('0x7')]=function(_0x38461f,_0x367b9c){logger[_0x7bb5('0x7')](_0x38461f,_0x367b9c?util['inspect'](_0x367b9c,{'showHidden':![],'depth':null}):'');};exports[_0x7bb5('0x8')]=function(_0x12e893,_0x3c2da1){return client['request'](_0x12e893,{'body':_0x3c2da1})[_0x7bb5('0x9')](function(_0x36397e){logger['debug'](_0x7bb5('0xa'),_0x12e893,_0x36397e?util['inspect'](_0x36397e,{'showHidden':![],'depth':null}):'');})[_0x7bb5('0xb')](function(_0x5449c0){logger[_0x7bb5('0x7')]('[utils][request]\x20name:%s',_0x12e893,_0x5449c0?util[_0x7bb5('0x5')](_0x5449c0,{'showHidden':![],'depth':null}):'');});};function getUser(_0x59ebdc){return client[_0x7bb5('0x8')](_0x7bb5('0xc'),{'options':{'raw':!![],'attributes':['id',_0x7bb5('0xd'),'name',_0x7bb5('0xe')],'where':_0x59ebdc,'limit':0x1}})[_0x7bb5('0x9')](function(_0x58adcd){logger[_0x7bb5('0x6')](_0x7bb5('0xf'),JSON['stringify'](_0x59ebdc),_0x58adcd?util[_0x7bb5('0x5')](_0x58adcd,{'showHidden':![],'depth':null}):'');return _0x58adcd[_0x7bb5('0x10')]['length']?_0x58adcd[_0x7bb5('0x10')][0x0]:null;});}exports[_0x7bb5('0x11')]=function(_0x545202){return new BPromise(function(_0x77522d,_0x13cda7){if(_0x545202){return getUser({'internal':_0x545202})['then'](function(_0x5bb051){logger[_0x7bb5('0x4')](_0x7bb5('0x12'),_0x545202,_0x5bb051?_0x7bb5('0x13'):_0x7bb5('0x14'));return _0x77522d(_0x5bb051);})['catch'](function(_0xa3ca61){logger[_0x7bb5('0x7')](_0x7bb5('0x15'),_0xa3ca61?util['inspect'](_0xa3ca61,{'showHidden':![],'depth':null}):'');return _0x77522d(null);});}return _0x77522d(null);});};exports[_0x7bb5('0x16')]=function(_0x4054ce){return new BPromise(function(_0x4c5710,_0x570ba8){if(_0x4054ce){return getUser({'interface':_0x4054ce})[_0x7bb5('0x9')](function(_0x302c51){logger[_0x7bb5('0x4')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x4054ce,_0x302c51?_0x7bb5('0x13'):_0x7bb5('0x14'));return _0x4c5710(_0x302c51);})[_0x7bb5('0xb')](function(_0x167bf1){logger[_0x7bb5('0x7')](_0x7bb5('0x17'),_0x167bf1?util[_0x7bb5('0x5')](_0x167bf1,{'showHidden':![],'depth':null}):'');return _0x4c5710(null);});}return _0x4c5710(null);});};exports[_0x7bb5('0x18')]=function(_0x4e0e81){return new BPromise(function(_0x51bf3e,_0x27289d){if(_0x4e0e81){return getUser({'name':_0x4e0e81})['then'](function(_0x2de211){logger[_0x7bb5('0x4')](_0x7bb5('0x19'),_0x4e0e81,_0x2de211?_0x7bb5('0x13'):'notfound');return _0x51bf3e(_0x2de211);})[_0x7bb5('0xb')](function(_0x3fa08a){logger[_0x7bb5('0x7')](_0x7bb5('0x1a'),_0x3fa08a?util[_0x7bb5('0x5')](_0x3fa08a,{'showHidden':![],'depth':null}):'');return _0x51bf3e(null);});}return _0x51bf3e(null);});};exports[_0x7bb5('0x1b')]=function(_0xc363b5){return new BPromise(function(_0x190ec3,_0x214087){if(_0xc363b5){return client[_0x7bb5('0x8')](_0x7bb5('0x1c'),{'options':{'raw':!![],'attributes':['id','name',_0x7bb5('0x1d'),'acw',_0x7bb5('0x1e')],'where':{'name':_0xc363b5},'limit':0x1}})[_0x7bb5('0x9')](function(_0x4ed58d){logger[_0x7bb5('0x6')]('[utils][getVoiceQueueByName]\x20name:%s',_0xc363b5,_0x4ed58d?util[_0x7bb5('0x5')](_0x4ed58d,{'showHidden':![],'depth':null}):'');logger[_0x7bb5('0x4')](_0x7bb5('0x1f'),_0xc363b5,_0x4ed58d?_0x7bb5('0x13'):_0x7bb5('0x14'));return _0x190ec3(_0x4ed58d[_0x7bb5('0x10')][_0x7bb5('0x20')]?_0x4ed58d[_0x7bb5('0x10')][0x0]:null);})['catch'](function(_0x424ac0){logger[_0x7bb5('0x7')]('[utils][getVoiceQueueByName]',_0x424ac0?util[_0x7bb5('0x5')](_0x424ac0,{'showHidden':![],'depth':null}):'');return _0x190ec3(null);});}return _0x190ec3(null);});};exports[_0x7bb5('0x21')]=function(_0x3002e0,_0x58abe8){return moment(_0x3002e0)[_0x7bb5('0x22')](_0x58abe8,'seconds')[_0x7bb5('0x23')](_0x7bb5('0x24'));};exports[_0x7bb5('0x25')]=function(_0x44b607,_0xb5a337){return moment(_0x44b607)[_0x7bb5('0x26')](_0xb5a337,_0x7bb5('0x27'))[_0x7bb5('0x23')](_0x7bb5('0x24'));};exports['diffTime']=function(_0x35e8bd,_0x1e986e){return moment(_0x35e8bd)['diff'](moment(_0x1e986e),_0x7bb5('0x27'));};exports[_0x7bb5('0x28')]=function(_0x1626c4,_0x268eef){return parseInt(_0x1626c4,0xa)+parseInt(_0x268eef,0xa);};exports[_0x7bb5('0x29')]=function(){return moment()[_0x7bb5('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7bb5('0x2a')]=function(_0x553edc,_0x9c1bcd){if(_0x9c1bcd){return moment(_0x553edc)[_0x7bb5('0x2a')](_0x9c1bcd);}return!![];};exports[_0x7bb5('0x2b')]=function(_0x53016b,_0x24e438){if(_0x24e438){return moment(_0x53016b)['isBefore'](_0x24e438);}else if(_0x53016b){return!![];}return![];}; \ No newline at end of file